@svgt/mcp 0.0.0-stage → 0.0.0

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/stdio.js ADDED
@@ -0,0 +1,218 @@
1
+ #!/usr/bin/env node
2
+ import{createRequire as e}from"node:module";let t=e(import.meta.url);var r,a,i={532(e,t,r){r.d(t,{},{E3:{},ES:{},HQ:[],Yl:{"src/tools/list-frameworks.ts":()=>r.e(116).then(()=>r(475)),"src/tools/transform-svg-files.ts":()=>r.e(116).then(()=>r(806)),"src/tools/transform-svg.ts":()=>r.e(116).then(()=>r(650))}})},241(e,t,r){var a=r(532).Yl,i=r(532).E3,n=r(532).ES,s=r(532).HQ,o=r(532).middleware;e.exports=(()=>{var e={6982(e){"use strict";e.exports=r(982)},9896(e){"use strict";e.exports=r(896)},857(e){"use strict";e.exports=r(857)},6928(e){"use strict";e.exports=r(928)},7016(e){"use strict";e.exports=r(16)},8717(e,t,r){var a=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(e){throw t=0,e}},i=a((e,t)=>{function r(e){return"string"==typeof e?!["false","0","no","off",""].includes(e.toLowerCase()):!!e}t.exports={parseBoolean:r,optionsFromEnv:function(e=process.env){let t={};for(let a of["ENCODING","PATH","QUIET","DEBUG","OVERRIDE","FAST"]){let i=null!=e[`DOTENV_${a}`]?e[`DOTENV_${a}`]:e[`DOTENV_CONFIG_${a}`];null!=i&&(t[a.toLowerCase()]="ENCODING"===a||"PATH"===a?i:r(i))}return t}}}),n=a((e,t)=>{var a=r(9896),n=r(6928),s=r(857),{URL:o,fileURLToPath:l}=r(7016),{parseBoolean:c,optionsFromEnv:u}=i(),d=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg,p=new Uint8Array(256);for(let e=48;e<=57;e++)p[e]=1;for(let e=65;e<=90;e++)p[e]=1;for(let e=97;e<=122;e++)p[e]=1;function m(e){return e<=32?32===e||e>=9&&e<=13:e>=160&&(160===e||5760===e||e>=8192&&e<=8202||8232===e||8233===e||8239===e||8287===e||12288===e||65279===e)}function h(e){return 10===e||8232===e||8233===e}function f(e){console.log(`┆ ${e}`)}function g(e){return"~"===e[0]?n.join(s.homedir(),e.slice(1)):e}p[45]=1,p[46]=1,p[95]=1;var y={configDotenv:function(e){e=function(e={}){let t={...e};for(let e of Object.keys(t))void 0===t[e]&&delete t[e];return{...u(),...t}}(e);let t=n.resolve(process.cwd(),".env"),r="utf8",i=process.env;e&&null!=e.processEnv&&(i=e.processEnv);let s=c(e&&e.debug);e&&e.encoding?r=e.encoding:s&&f("no encoding is specified (UTF-8 is used by default)");let d=[t];if(e&&e.path)if(Array.isArray(e.path))for(let t of(d=[],e.path))d.push(g(t));else d=[g(e.path)];let p,m={},h={fast:e.fast};for(let t of d)try{let i=y.parse(a.readFileSync(t,{encoding:r}),h);y.populate(m,i,e)}catch(e){s&&f(`failed to load ${t} ${e.message}`),p=e}let v=y.populate(i,m,e),_=c(Object.prototype.hasOwnProperty.call(e,"quiet")?e.quiet:u(i).quiet);if(s||!_){var b;let e=Object.keys(v).length,t=[];for(let e of d)try{let r=n.relative(process.cwd(),e instanceof o?l(e):e);t.push(r)}catch(t){s&&f(`failed to load ${e} ${t.message}`),p=t}b=`injected env (${e}) from ${t.join(",")}`,console.error(`◇ ${b}`)}return p?{parsed:m,error:p}:{parsed:m}},config:function(e){return y.configDotenv(e)},parse:function(e,t){return t&&c(t.fast)?function(e){let t={},r="string"==typeof e?e:e.toString();-1!==r.indexOf("\r")&&(r=r.replace(/\r\n?/g,`
3
+ `));let a=r.length,i=0;for(;i<a;){let e=r.charCodeAt(i);for(;i<a&&m(e);)i++,e=r.charCodeAt(i);if(i>=a)break;if(35===e){for(;i<a&&!h(r.charCodeAt(i));)i++;continue}let n=-1;if(101===e&&i+6<a&&120===r.charCodeAt(i+1)&&112===r.charCodeAt(i+2)&&111===r.charCodeAt(i+3)&&114===r.charCodeAt(i+4)&&116===r.charCodeAt(i+5))if(m(r.charCodeAt(i+6))){let e=i+7;for(;e<a&&m(r.charCodeAt(e));)e++;p[r.charCodeAt(e)]&&(n=i+6,i=e)}else e=r.charCodeAt(i);let s=i,o=0;for(;i<a&&p[o=r.charCodeAt(i)];)i++;if(i===s){for(;i<a&&!h(r.charCodeAt(i));)i++;continue}let l=r.slice(s,i),c=i;if(i>=a&&(o=0),m(o))do o=++i<a?r.charCodeAt(i):0;while(m(o));if(61===o)i++;else if(58===o&&i===c&&i+1<a&&m(r.charCodeAt(i+1)))i+=2;else{for(i=-1===n?c:n;i<a&&!h(r.charCodeAt(i));)i++;continue}let u=i,d=i;for(;d<a&&m(r.charCodeAt(d));)d++;let f=r.charCodeAt(d),g,y=!1;if(39===f||34===f||96===f){let e=r[d],t=r.indexOf(e,d+1),n=-1,s=-1;for(;-1!==t;){let i=92===r.charCodeAt(t-1),o=t+1;for(;o<a&&!h(r.charCodeAt(o))&&m(r.charCodeAt(o));)o++;if((o===a||h(r.charCodeAt(o))||35===r.charCodeAt(o))&&(n=t,s=o),!i)break;t=r.indexOf(e,t+1)}if(-1!==n){if(g=r.slice(d+1,n),i=s,35===r.charCodeAt(i))for(;i<a&&!h(r.charCodeAt(i));)i++;y=!0}}if(!y){let e,t=r.indexOf(`
4
+ `,u);if(-1===t&&(t=a),a<4096)(-1===(e=r.indexOf("#",u))||e>t)&&(e=t);else for(e=u;e<t&&35!==r.charCodeAt(e);)e++;let n=u,s=e;for(;n<s&&m(r.charCodeAt(n));)n++;for(;s>n&&m(r.charCodeAt(s-1));)s--;let o=r.charCodeAt(n);if((g=r.slice(n,s)).includes("\u2028")||g.includes("\u2029")?g=g.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"):s-n>=2&&(39===o||34===o||96===o)&&r.charCodeAt(s-1)===o&&(g=r.slice(n+1,s-1)),i=e,e<t)for(;i<a&&!h(r.charCodeAt(i));)i++}34===f&&(y||d<i)&&-1!==g.indexOf("\\")&&(g=g.replace(/\\n/g,`
5
+ `).replace(/\\r/g,"\r")),t[l]=g}return t}(e):function(e){let t,r={},a=e.toString();for(a=a.replace(/\r\n?/mg,`
6
+ `);null!=(t=d.exec(a));){let e=t[1],a=t[2]||"",i=(a=a.trim())[0];a=a.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),'"'===i&&(a=(a=a.replace(/\\n/g,`
7
+ `)).replace(/\\r/g,"\r")),r[e]=a}return r}(e)},populate:function(e,t,r={}){let a=c(r&&r.debug),i=c(r&&r.override),n={};if(null===e||"object"!=typeof e||null===t||"object"!=typeof t){let e=Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw e.code="OBJECT_REQUIRED",e}for(let r of Object.keys(t))Object.prototype.hasOwnProperty.call(e,r)?(!0===i&&(e[r]=t[r],n[r]=t[r]),a&&f(!0===i?`"${r}" is already defined and WAS overwritten`:`"${r}" is already defined and was NOT overwritten`)):(e[r]=t[r],n[r]=t[r]);return n}};t.exports.configDotenv=y.configDotenv,t.exports.config=y.config,t.exports.parse=y.parse,t.exports.populate=y.populate,t.exports=y})();e.exports=n,e.exports.config=n.config,e.exports.configDotenv=n.configDotenv,e.exports.parse=n.parse,e.exports.populate=n.populate}},t={};function l(r){var a=t[r];if(void 0!==a)return a.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,l),i.exports}return l.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return l.d(t,{a:t}),t},l.d=(e,t,r)=>{var a=(t,r)=>{for(var a in t)l.o(t,a)&&!l.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,[r]:t[a]})};a(t,"get"),a(r,"value")},l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";let e,t,c,u,d,p,m,h,f,g,y,v,_,b,S,$,w,k,x,R,P,E;var j,T,O,C,I,N,q,A,z,M,L,Z,D,V=Object.create,F=Object.defineProperty,U=Object.getOwnPropertyDescriptor,H=Object.getOwnPropertyNames,J=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty,K=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);let W=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),G=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),Y=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),Q=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function X(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 ee(e,t="|"){return e.map(e=>e$(e)).join(t)}function et(e,t){return"bigint"==typeof t?t.toString():t}class er{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 ea(e){return new er(e)}function ei(e){let t=+!!e.startsWith("^"),r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}let en=Symbol("evaluating");function es(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function eo(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function el(e){return eo(e._zod.def)??e._zod.def.shape}function ec(e,t,r){Object.defineProperty(e,t,{get(){let e=r();return es(this,t,e),e},enumerable:!0,configurable:!0})}function eu(e,t,r){t in e?es(e,t,r):e[t]=r}function ed(e,t,r,a){let i=el(t);for(let n of r){let r=Object.getOwnPropertyDescriptor(i,n);r.enumerable&&(r.get?ec(e,n,()=>{let e=t._zod.def.shape[n];return a?a(e,n):e}):eu(e,n,a?a(r.value,n):r.value))}}function ep(...e){let t={};for(let r of e)Object.assign(t,Object.getOwnPropertyDescriptors(r));return Object.defineProperties({},t)}let em="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function eh(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let ef=ea(()=>{if(eW.jitless||"u">typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function eg(e){if(!1===eh(e))return!1;let t=e.constructor;if(void 0===t||"function"!=typeof t)return!0;let r=t.prototype;return!1!==eh(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function ey(e){return eg(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}let ev=new Set(["string","number","symbol"]);function e_(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function eb(e,t,r){let a=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(a._zod.parent=e),a}function eS(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 e$(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}let ew={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]},ek={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function ex(e,t){let r=el(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={};for(let a of(ed(r,e,Reflect.ownKeys(el(e))),Reflect.ownKeys(t))){let e=Object.getOwnPropertyDescriptor(t,a);e.enumerable&&(e.get?ec(r,a,()=>t[a]):eu(r,a,e.value))}return r}function eP(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(ex(t,r)):void 0,s={};return ed(s,t,Reflect.ownKeys(el(t)),e&&((t,r)=>n&&!n.has(r)?t:new e({type:"optional",innerType:t}))),eb(t,ep(t._zod.def,{shape:s,checks:[]}))}function eE(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 ej(e,t){return t.map(t=>(t.path??(t.path=[]),t.path.unshift(e),t))}function eT(e){return"string"==typeof e?e:e?.message}function eO(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 eC(e,t,r){var a;for(let i=t;i<e.length;i++)(a=e[i]).schema??(a.schema=r)}function eI(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:eT(e.inst?._zod.def?.error?.(e))??eT(i?.(e))??eT(t?.error?.(e))??eT(r.customError?.(e))??eT(r.localeError?.(e))??"Invalid input",s={};for(let t of Object.keys(e))"inst"!==t&&"schema"!==t&&"continue"!==t&&"input"!==t&&"__proto__"!==t&&(s[t]=e[t]);return s.path??(s.path=[]),s.message=n,t?.reportInput&&(s.input=e.input),s}let eN=/[\uD800-\uDBFF]/;function eq(e){let t=e.length;if(!eN.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 eA(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function ez(...e){let[t,r,a]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:a}:{...t}}function eM(e,t,r,a=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:a,value:r}),r}function eL(e,t){for(let r in e){let a=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return eM(this,r,a(this))},set(e){eM(this,r,e)}})}return t}let eZ=!1,eD={configurable:!0,get(){eZ=!0}};function eV(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,eD);let e=eZ;eZ=!1;try{let t=a(this);return eZ?delete this[r]:Object.defineProperty(this,r,{configurable:!0,writable:!0,value:t}),eZ=eZ||e,t}catch(t){throw delete this[r],eZ=eZ||e,t}},set(e){Object.defineProperty(this,r,{configurable:!0,writable:!0,value:e})}})}let eF=Object.freeze({status:"aborted"}),eU={value:void 0,enumerable:!1},eH="captureStackTrace"in Error?Error:null;function eJ(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 s(a,s){if(a._zod){if(a._zod.traits.has(e))return}else{eU.value=new i(s);try{Object.defineProperty(a,"_zod",eU)}finally{eU.value=void 0}}if(a._zod.traits.add(e),t(a,s),n){let e=Object.getPrototypeOf(a),t=a._zod.constr.prototype,i=e;for(;i&&i!==t;)i=Object.getPrototypeOf(i);let s=i??e;if(!n.has(s))for(let e in n.add(s),r){let t=Object.getOwnPropertyDescriptor(r,e);t.get?Object.defineProperty(s,e,{...t,enumerable:!1}):function(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:eM(this,t,r.bind(this))},set(e){eM(this,t,e)}})}(s,e,t.value)}}let o=c.prototype;for(let e in o)Object.prototype.hasOwnProperty.call(o,e)&&(e in a||(a[e]=o[e].bind(a)))}let o=a?.Parent??Object;class l extends o{}function c(e){let t=a?.Parent?function(e){let t=eH;if(t){let r=t.stackTraceLimit;if("number"==typeof r){try{t.stackTraceLimit=0}catch{return eH=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}(l):this;s(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:s}),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 eB extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class eK extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(q=globalThis).__zod_globalConfig??(q.__zod_globalConfig={});let eW=globalThis.__zod_globalConfig;function eG(e){return e&&Object.assign(eW,e),eW}class eY extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}let eQ="~memo",eX=[];function e0(e){return null!==e&&"object"==typeof e}function e1(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}let e2=new WeakMap,e9=[],e4={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),e9.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;let i;if("backward"!==r.direction&&(a=e.value,void 0!==(i=r[eQ]?.backEdges)&&e0(a)&&i.has(a)))throw new eY;return t(e,r)};e._zod.parse=r,e._zod.run===t&&(e._zod.run=r)})},attach(e){var r;let a,i,n,s=!1;(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,o=(l,c)=>{let u;if(void 0===a){let t=function e(t,r,a){var i;let n=e2.get(t);if(void 0!==n)return 2*!!n;if(r.has(t))return 2;r.add(t);let s=0,o=t=>{if(2!==s&&t?._zod){let i=e(t,r,a);i>s&&(s=i)}},l=e=>{e>s&&(s=e)},c=t._zod.def;switch(c.type){case"object":{let t=eo(c);l(t?((t,i)=>{let n=0;for(let s of Reflect.ownKeys(t)){let o=Object.getOwnPropertyDescriptor(t,s);if(i&&!o.enumerable)continue;let l=o.get?1:o.value?._zod?e(o.value,r,a):0;l>n&&(n=l)}return n})(t,!0):1),o(c.catchall);break}case"array":o(c.element);break;case"tuple":for(let e of c.items)o(e);o(c.rest);break;case"record":case"map":o(c.keyType),o(c.valueType);break;case"set":o(c.valueType);break;case"union":for(let e of c.options)o(e);break;case"intersection":o(c.left),o(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":o(c.innerType);break;case"pipe":o(c.in),o(c.out);break;case"function":o(c.input),o(c.output);break;case"lazy":{let i=c._cachedInner??(a?t._zod.innerType:void 0);l(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 c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let r=t.value;if(r&&"object"==typeof r){if(r._zod)o(r);else if(Array.isArray(r))for(let e of r)o(e)}}}return r.delete(t),1!==(i=s)&&e2.set(t,2===i),i}(e,new Set,!1);if(0===t)return e._zod.parse=r,e._zod.run===o&&(e._zod.run=r),r(l,c);2===t||s?a=!0:s=!0}let d=l.value;if(!e0(d))return r(l,c);let p=c[eQ];if(p||(p={buckets:new WeakMap,backEdges:void 0},c[eQ]=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(...e1(h.issues)):(l.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(h.value)),l;t=u;let f=e9.length,g=r(l,c);t=void 0;let y=e9.length>f?e9.pop():void 0;return g instanceof Promise?g.then(e=>(y&&(y.issues=e.issues.length?e1(e.issues):eX),e)):(y&&(y.issues=g.issues.length?e1(g.issues):eX),g)};e._zod.parse=o,e._zod.run===r&&(e._zod.run=o)})}},e6=/^[cC][0-9a-z]{6,}$/,e5=/^[0-9a-z]+$/,e3=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,e8=/^[0-9a-vA-V]{20}$/,e7=/^[A-Za-z0-9]{27}$/,te=/^[a-zA-Z0-9_-]{21}$/,tt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,tr=/^([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})$/,ta=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)$/,ti=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,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])$/,ts=/^(([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}|:))$/,to=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,tl=/^(([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])$/,tc=/^https?$/,tu=/^\+[1-9]\d{6,14}$/,td="(?:(?:\\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])))",tp=RegExp(`^${td}$`);function tm(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 th=/^[\s\S]{0,}$/,tf=/^-?\d+$/,tg=/^-?\d+(?:\.\d+)?$/,ty=/^(?:true|false)$/i,tv=/^null$/i,t_=/^[^A-Z]*$/,tb=/^[^a-z]*$/,tS=eJ("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),t$=e=>{let t=e.value;return null!=t&&void 0!==t.length},tw={number:"number",bigint:"bigint",object:"date"},tk=eJ("$ZodCheckLessThan",(e,t)=>{tS.init(e,t);let r=tw[typeof t.value];e._zod.check=a=>{(t.inclusive?a.value<=t.value:a.value<t.value)||a.issues.push({origin:tw[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})}}),tx=eJ("$ZodCheckGreaterThan",(e,t)=>{tS.init(e,t);let r=tw[typeof t.value];e._zod.check=a=>{(t.inclusive?a.value>=t.value:a.value>t.value)||a.issues.push({origin:tw[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=eJ("$ZodCheckMultipleOf",(e,t)=>{tS.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})}}),tP=eJ("$ZodCheckNumberFormat",(e,t)=>{tS.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),a=r?"int":"number",[i,n]=ew[t.format];e._zod.check=s=>{let o=s.value;if(r){if(!Number.isInteger(o))return void s.issues.push({expected:a,format:t.format,code:"invalid_type",continue:!1,input:o,inst:e});if(!Number.isSafeInteger(o))return void(o>0?s.issues.push({input:o,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}):s.issues.push({input:o,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}))}o<i&&s.issues.push({origin:"number",input:o,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),o>n&&s.issues.push({origin:"number",input:o,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),tE=eJ("$ZodCheckMaxLength",(e,t)=>{var r;tS.init(e,t),(r=e._zod.def).when??(r.when=t$),e._zod.check=r=>{let a=r.value,i=a.length;if(("string"==typeof a&&i>t.maximum?eq(a):i)<=t.maximum)return;let n=eA(a);r.issues.push({origin:n,code:"too_big",maximum:t.maximum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),tj=eJ("$ZodCheckMinLength",(e,t)=>{var r;tS.init(e,t),(r=e._zod.def).when??(r.when=t$),e._zod.check=r=>{let a=r.value,i=a.length;if(("string"==typeof a&&i>=t.minimum&&i<2*t.minimum?eq(a):i)>=t.minimum)return;let n=eA(a);r.issues.push({origin:n,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),tT=eJ("$ZodCheckLengthEquals",(e,t)=>{var r;tS.init(e,t),(r=e._zod.def).when??(r.when=t$),e._zod.check=r=>{let a=r.value,i=a.length,n="string"==typeof a&&i>=t.length&&i<=2*t.length?eq(a):i;if(n===t.length)return;let s=eA(a),o=n>t.length;r.issues.push({origin:s,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),tO=eJ("$ZodCheckStringFormat",(e,t)=>{var r,a;tS.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=()=>{})}),tC=eJ("$ZodCheckRegex",(e,t)=>{tO.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})}}),tI=eJ("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=t_),tO.init(e,t)}),tN=eJ("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=tb),tO.init(e,t)}),tq=eJ("$ZodCheckIncludes",(e,t)=>{tS.init(e,t);let r=e_(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})}}),tA=eJ("$ZodCheckStartsWith",(e,t)=>{tS.init(e,t);let r=RegExp(`^${e_(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})}}),tz=eJ("$ZodCheckEndsWith",(e,t)=>{tS.init(e,t);let r=RegExp(`.*${e_(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})}}),tM=eJ("$ZodCheckOverwrite",(e,t)=>{tS.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class tL{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(", ")}) {
8
+ ${t.join("\n")}
9
+ };`)(...Object.values(this.closed))}}let tZ={major:4,minor:6,patch:7},tD=eJ("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=tZ;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=eE(t);for(let s of r){if(s._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)||!s._zod.def.when(t))continue}else if(n)continue;let r=t.issues.length,o=s._zod.check(t);if(o instanceof Promise&&a?.async===!1)throw new eB;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,t.issues.length!==r&&(eC(t.issues,r,e),n||(n=eE(t,r)))});else{if(t.issues.length===r)continue;eC(t.issues,r,e),n||(n=eE(t,r))}}return i?i.then(()=>t):t},r=(r,a,n)=>{if(eE(r))return r.aborted=!0,r;let s=t(a,i,n);if(s instanceof Promise){if(!1===n.async)throw new eB;return s.then(t=>e._zod.parse(t,n))}return e._zod.parse(s,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 s=e._zod.parse(a,n);if(s instanceof Promise){if(!1===n.async)throw new eB;return s.then(e=>t(e,i,n))}return t(s,i,n)}}},{get"~standard"(){return eM(this,"~standard",tF(this),!1)},set"~standard"(e){eM(this,"~standard",e)}}),tV=(e,t)=>e.issues.length?{issues:e.issues.map(e=>eI(e,t,eG()))}:{value:e.value};function tF(e){return{validate:t=>{let r={async:!1};try{let a=e._zod.run({value:t,issues:[]},r);if(!(a instanceof Promise))return tV(a,r)}catch(e){}return async function(e,t){let r={async:!0};return tV(await e._zod.run({value:t,issues:[]},r),r)}(e,t)},vendor:"zod",version:1}}let tU=eJ("$ZodString",(e,t)=>{tD.init(e,t),e._zod.pattern=t.pattern??th,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}}),tH=eJ("$ZodStringFormat",(e,t)=>{tO.init(e,t),tU.init(e,t)}),tJ=eJ("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=tr),tH.init(e,t)}),tB=eJ("$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=ta(e))}else t.pattern??(t.pattern=ta());tH.init(e,t)}),tK=eJ("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ti),tH.init(e,t)});function tW(e){try{if("u">typeof URL&&"function"==typeof URL.canParse)return URL.canParse(e);return new URL(e),!0}catch{return!1}}let tG=/[\t\n\r]/g;function tY(e){return e.replace(tG,"")}let tQ=eJ("$ZodURL",(e,t)=>{tH.init(e,t),e._zod.check=r=>{try{var a,i;let n=r.value.trim(),s="normalize"in t||"hostname"in t||"protocol"in t?function(e,t){if(!t.normalize&&t.protocol?.source===tc.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):tW(n)||2;if(1===s)return void r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});if(2===s)return void r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});if(!0===s){r.value=tY(n);return}t.hostname&&((a=t.hostname).lastIndex=0,!a.test(s.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(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.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?s.href:tY(n);return}catch(a){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),tX=eJ("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=RegExp("^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$","u")),tH.init(e,t)}),t0=eJ("$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?te:(r=t.length,RegExp(`^[a-zA-Z0-9_-]{${r}}$`))),tH.init(e,t)}),t1=eJ("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=e6),tH.init(e,t)}),t2=eJ("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=e5),tH.init(e,t)}),t9=eJ("$ZodULID",(e,t)=>{t.pattern??(t.pattern=e3),tH.init(e,t)}),t4=eJ("$ZodXID",(e,t)=>{t.pattern??(t.pattern=e8),tH.init(e,t)}),t6=eJ("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=e7),tH.init(e,t)}),t5=eJ("$ZodISODateTime",(e,t)=>{let r,a,i;t.pattern??(r=["Z"],t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)"),a=`${tm({precision:t.precision,seconds:!0})}(?:${r.join("|")})`,i=t.local?`${a}|${tm({precision:t.precision})}`:a,t.pattern=RegExp(`^${td}T(?:${i})$`)),tH.init(e,t)}),t3=eJ("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=tp),tH.init(e,t)}),t8=eJ("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=RegExp(`^${tm(t)}$`)),tH.init(e,t)}),t7=eJ("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=tt),tH.init(e,t)}),re=eJ("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=tn),tH.init(e,t)}),rt=/^[0-9a-fA-F:.]+$/;function rr(e){return!!rt.test(e)&&tW(`http://[${e}]`)}let ra=eJ("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ts),tH.init(e,t),e._zod.check=r=>{rr(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}),ri=eJ("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=to),tH.init(e,t)}),rn=eJ("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=tl),tH.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)&&rr(r)}(r.value)&&r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function rs(e){if(""===e)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let ro=/^[0-9a-zA-Z+/]*={0,2}$/,rl=eJ("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ro),tH.init(e,t),e._zod.check=r=>{rs(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),rc=/^[A-Za-z0-9_-]*$/,ru=eJ("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=rc),tH.init(e,t),e._zod.check=r=>{!function(e){if(!rc.test(e))return!1;let t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return rs(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})}}),rd=eJ("$ZodE164",(e,t)=>{t.pattern??(t.pattern=tu),tH.init(e,t)}),rp=eJ("$ZodJWT",(e,t)=>{tH.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})}}),rm=eJ("$ZodNumber",(e,t)=>{tD.init(e,t),e._zod.pattern=tg,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}}),rh=eJ("$ZodNumberFormat",(e,t)=>{tP.init(e,t),rm.init(e,t)}),rf=eJ("$ZodBoolean",(e,t)=>{tD.init(e,t),e._zod.pattern=ty,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}}),rg=eJ("$ZodNull",(e,t)=>{tD.init(e,t),e._zod.pattern=tv,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}}),ry=eJ("$ZodAny",(e,t)=>{tD.init(e,t),e._zod.parse=e=>e}),rv=eJ("$ZodUnknown",(e,t)=>{tD.init(e,t),e._zod.parse=e=>e}),r_=eJ("$ZodNever",(e,t)=>{tD.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}),rb=e=>Array.isArray(e)?e.length:-1;function rS(e,t,r){e.issues.length&&t.issues.push(...ej(r,e.issues)),t.value[r]=e.value}let r$=eJ("$ZodArray",(e,t)=>{tD.init(e,t);let r=eW.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 s=[],o=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)s.push(l.then(t=>rS(t,a,e)));else if(rS(l,a,e),o&&0!==l.issues.length&&eE(l))break}return s.length?Promise.all(s).then(()=>a):a},function(e,t){let r=eO(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 s=t(r.value);if(s>a&&!n?.skipChecks&&n?.direction!=="backward"){for(let[t,a]of eO(e._zod.def.checks))if(s>t&&a._zod.def.when(r)){let t=r.issues.length;return a._zod.check(r),r.issues[t].continue=!1,eC(r.issues,t,e),r}}return i(r,n)}}(e,rb)});function rw(e,t,r,a,i,n){let s=r in a,o="optional"===n;if(s||!o||"optional"!==i){if(e.issues.length){if(void 0!==i&&o&&!s)return;t.issues.push(...ej(r,e.issues))}if(!s&&void 0===i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}void 0===e.value?(s||"defaulted"===i&&!o)&&(t.value[r]=void 0):t.value[r]=e.value}}let rk=[];function rx(e){var t;let r=Object.keys(e.shape),a=Object.getOwnPropertySymbols(e.shape),i=a.length?a:rk,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 s=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(s)}}function rR(e,t,r,a,i,n,s){let o=[],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(s&&r.issues.length!==m){if(eE(r,m))break;m=r.issues.length}if(l.has(i))continue;if("__proto__"===i){"never"===u&&o.push(i);continue}if("never"===u){o.push(i);continue}let n=c.run({value:t[i],issues:[]},a);n instanceof Promise?e.push(n.then(e=>rw(e,r,i,t,d,p))):rw(n,r,i,t,d,p)}return(o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:n,continue:!0}),e.length)?Promise.all(e).then(()=>r):r}let rP=eJ("$ZodObject",(e,t)=>{let r;tD.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=ea(()=>rx(t));eV(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)||es(r,e,new Set),a.values))r[e].add(t);void 0!==a.optin&&r[e].add(void 0)}}return r});let s=t.catchall,o=eW.memoizer;o?.attach(e),e._zod.parse=(t,a)=>{r??(r=n.value);let i=t.value;if(!eh(i))return t.issues.push({expected:"object",code:"invalid_type",input:i,inst:e}),t;t.value=o?o.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(eE(t,d))break;d=t.issues.length}if("__proto__"===e)continue;let r=c[e],n=r._zod.optin,s=r._zod.optout,o=r._zod.run({value:i[e],issues:[]},a);o instanceof Promise?l.push(o.then(r=>rw(r,t,e,i,n,s))):rw(o,t,e,i,n,s)}return s?rR(l,i,t,a,n.value,e,!0===u):l.length?Promise.all(l).then(()=>t):t}}),rE=eJ("$ZodObjectJIT",(e,t)=>{let r,a;rP.init(e,t);let i=e._zod.parse,n=ea(()=>rx(t)),s=eW.memoizer,o=!eW.jitless,l=o&&ef.value,c=t.catchall;e._zod.parse=(u,d)=>{a??(a=n.value);let p=u.value;return eh(p)?o&&l&&d?.async===!1&&!0!==d.jitless?(r||(r=(t=>{let r=n.value,a=r.symbolKeys,i=new tL(["payload","ctx"],{shape:t,inst:e,memo:s,syms:a}),o=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,l=(e,t)=>`
10
+ let ${e}_ab = false;
11
+ for (let i = 0; i < ${e}.issues.length; i++) {
12
+ const iss = ${e}.issues[i];
13
+ iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
14
+ payload.issues.push(iss);
15
+ if (iss.continue !== true) ${e}_ab = true;
16
+ }
17
+ if (${e}_ab && ctx && ctx.abortEarly) {
18
+ payload.value = newResult;
19
+ return payload;
20
+ }`;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(s?"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),s=`${n} in input`,u=t[e],d=u?._zod?.optin,p=void 0!==d,m=u?._zod?.optout==="optional";if(i.write(`const ${r} = ${o(n)};`),p&&m){let e="optional"===d?`${r}_present`:`${r}.value !== undefined || ${r}_present`;i.write(`
21
+ const ${r}_present = ${s};
22
+ if (!${r}.issues.length || ${r}_present) {
23
+ if (${r}.issues.length) {${l(r,n)}
24
+ }
25
+
26
+ if (${e}) {
27
+ newResult[${n}] = ${r}.value;
28
+ }
29
+ }
30
+
31
+ `)}else p?(i.write(`
32
+ if (${r}.issues.length) {${l(r,n)}
33
+ }
34
+ `),"defaulted"===d?i.write(`newResult[${n}] = ${r}.value;`):i.write(`
35
+ if (${r}.value !== undefined || ${s}) {
36
+ newResult[${n}] = ${r}.value;
37
+ }
38
+ `)):i.write(`
39
+ const ${r}_present = ${s};
40
+ if (${r}.issues.length) {${l(r,n)}
41
+ }
42
+ if (!${r}_present && !${r}.issues.length) {
43
+ payload.issues.push({
44
+ code: "invalid_type",
45
+ expected: "nonoptional",
46
+ input: undefined,
47
+ path: [${n}]
48
+ });
49
+ if (ctx && ctx.abortEarly) {
50
+ payload.value = newResult;
51
+ return payload;
52
+ }
53
+ }
54
+
55
+ if (${r}_present) {
56
+ newResult[${n}] = ${r}.value;
57
+ }
58
+
59
+ `)}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 rj(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=>!eE(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=>eI(e,a,eG())))}),t)}let rT=eJ("$ZodUnion",(e,t)=>{tD.init(e,t),eV(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),eV(e,"optout",e=>e.def.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),eV(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)))}),eV(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=>ei(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,s=[];for(let e of t.options){let t=e._zod.run({value:a.value,issues:[]},i);if(t instanceof Promise)s.push(t),n=!0;else{if(0===t.issues.length)return t;s.push(t)}}return n?Promise.all(s).then(t=>rj(t,a,e,i)):rj(s,a,e,i)}}),rO=eJ("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,rT.init(e,t);let r=e._zod.parse;eV(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)||es(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=eo(e._zod.def);if(a&&!Object.prototype.hasOwnProperty.call(a,t.discriminator))throw Error(`Invalid discriminated union option at index "${r}"`)});let a=ea(()=>(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 s=i.value;if(!eh(s))return i.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),i;let o=s?.[t.discriminator],l=a.value.get(o);return l&&(void 0!==o||"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:s,path:[t.discriminator],inst:e}),i)}}),rC=eJ("$ZodIntersection",(e,t)=>{tD.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])=>rI(e,t,r)):rI(e,i,n)}});function rI(e,t,r){let a,i=new Map,n=new Map,s=(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)s(r,"l")||e.issues.push(r);for(let t of r.issues)s(t,"r")||e.issues.push(t);let o=[...i].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(o.length){let t=a?o.filter(e=>a.keys.includes(e)):[];for(let r of(t.length&&e.issues.push({...a,keys:t}),o))!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(eg(t)&&eg(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(eE(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(l.mergeErrorPath)}`)}return e.value=l.data,e}let rN=eJ("$ZodRecord",(e,t)=>{tD.init(e,t);let r=eW.memoizer;r?.attach(e),e._zod.parse=(a,i)=>{let n=a.value;if(!eg(n))return a.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),a;let s=[],o=t.keyType._zod.values;if(o&&!t.partial){let l;a.value=r?r.alloc(e,a,{},i):{};let c=new Set;for(let r of o)if("string"==typeof r||"number"==typeof r||"symbol"==typeof r){if(c.add("number"==typeof r?r.toString():r),"__proto__"===r)continue;let o=t.keyType._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(o.issues.length){a.issues.push({code:"invalid_key",origin:"record",issues:o.issues.map(e=>eI(e,i,eG())),input:r,path:[r],inst:e});continue}let l=o.value;if("__proto__"===l)continue;let u=t.valueType._zod.run({value:n[r],issues:[]},i);u instanceof Promise?s.push(u.then(e=>{e.issues.length&&a.issues.push(...ej(r,e.issues)),a.value[l]=e.value})):(u.issues.length&&a.issues.push(...ej(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&&tg.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]:o?(l=l??[]).push(c):a.issues.push({code:"invalid_key",origin:"record",issues:r.issues.map(e=>eI(e,i,eG())),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?s.push(d.then(e=>{e.issues.length&&a.issues.push(...ej(c,e.issues)),a.value[u]=e.value})):(d.issues.length&&a.issues.push(...ej(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 s.length?Promise.all(s).then(()=>a):a}}),rq=eJ("$ZodEnum",(e,t)=>{tD.init(e,t);let r=X(t.entries),a=new Set(r);e._zod.values=a,eV(e,"pattern",e=>{let t=X(e.def.entries).filter(e=>ev.has(typeof e));return new RegExp(t.length?`^(${t.map(e=>e_(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}}),rA=eJ("$ZodLiteral",(e,t)=>{tD.init(e,t);let r=new Set(t.values);e._zod.values=r,eV(e,"pattern",e=>{let t=e.def.values;return new RegExp(t.length?`^(${t.map(e=>"string"==typeof e?e_(e):e?e_(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}}),rz=eJ("$ZodTransform",(e,t)=>{tD.init(e,t),e._zod.optin="optional",eW.memoizer?.guard(e),e._zod.parse=(r,a)=>{if("backward"===a.direction)throw new eK(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 eB;return r.value=i,r}});function rM(e,t){return e.value=t.issues.length?void 0:t.value,e}let rL=eJ("$ZodOptional",(e,t)=>{tD.init(e,t),eV(e,"optin",e=>"defaulted"===e.def.innerType._zod.optin?"defaulted":"optional"),e._zod.optout="optional",eV(e,"values",e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),eV(e,"pattern",e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${ei(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=>rM(e,t)):rM(e,a)}return t.innerType._zod.run(e,r)}}),rZ=eJ("$ZodExactOptional",(e,t)=>{rL.init(e,t),eV(e,"values",e=>e.def.innerType._zod.values),eV(e,"pattern",e=>e.def.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),rD=eJ("$ZodNullable",(e,t)=>{tD.init(e,t),eV(e,"optin",e=>e.def.innerType._zod.optin),eV(e,"optout",e=>e.def.innerType._zod.optout),eV(e,"pattern",e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${ei(t.source)}|null)$`):void 0}),eV(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)}),rV=eJ("$ZodDefault",(e,t)=>{tD.init(e,t),e._zod.optin="defaulted",eV(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=>rF(e,t)):rF(a,t)}});function rF(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}let rU=eJ("$ZodPrefault",(e,t)=>{tD.init(e,t),e._zod.optin="defaulted",eV(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))}),rH=eJ("$ZodNonOptional",(e,t)=>{tD.init(e,t),eV(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=>rJ(t,e)):rJ(i,e)}});function rJ(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 rB(e,t,r,a){return t.issues.length?e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>eI(e,a,eG()))},input:e.value}):(e.value=t.value,t.memo&&(e.memo=!0)),e}let rK=eJ("$ZodCatch",(e,t)=>{tD.init(e,t),eV(e,"optin",e=>"defaulted"===e.def.innerType._zod.optin?"defaulted":"optional"),eV(e,"optout",e=>e.def.innerType._zod.optout),eV(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=>rB(e,a,t,r)):rB(e,a,t,r)}}),rW=eJ("$ZodPipe",(e,t)=>{tD.init(e,t),eV(e,"values",e=>e.def.in._zod.values),eV(e,"optin",e=>e.def.in._zod.optin),eV(e,"optout",e=>e.def.out._zod.optout),eV(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=>rG(e,t.in,r)):rG(a,t.in,r)}let a=t.in._zod.run(e,r);return a instanceof Promise?a.then(e=>rG(e,t.out,r)):rG(a,t.out,r)}});function rG(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 rY=eJ("$ZodPreprocess",(e,t)=>{rW.init(e,t)}),rQ=eJ("$ZodReadonly",(e,t)=>{tD.init(e,t),eV(e,"propValues",e=>e.def.innerType._zod.propValues),eV(e,"values",e=>e.def.innerType._zod.values),eV(e,"optin",e=>e.def.innerType?._zod?.optin),eV(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(rX):rX(a)}});function rX(e){return e.memo||(e.value=Object.freeze(e.value)),e}let r0=eJ("$ZodLazy",(e,t)=>{var r;let a;tD.init(e,t),Object.defineProperty(r=e._zod,"innerType",{get(){if(a!==en)return void 0===a&&(a=en,t._cachedInner||(t._cachedInner=t.getter()),a=t._cachedInner),a},set(e){Object.defineProperty(r,"innerType",{value:e})},configurable:!0}),eV(e,"pattern",e=>e.innerType?._zod?.pattern),eV(e,"propValues",e=>e.innerType?._zod?.propValues),eV(e,"optin",e=>e.innerType?._zod?.optin??void 0),eV(e,"optout",e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,r)=>e._zod.innerType._zod.run(t,r)}),r1=eJ("$ZodCustom",(e,t)=>{tS.init(e,t),tD.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=>r2(t,r,a,e));r2(i,r,a,e)}});function r2(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(ez(e))}}(A=globalThis).__zod_globalRegistry??(A.__zod_globalRegistry=new class{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 r9=globalThis.__zod_globalRegistry;function r4(e){return e.checks&&(e.checks=[...e.checks]),e}function r6(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...eS(t)})}function r5(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...eS(t)})}function r3(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...eS(t)})}function r8(e,t){return new e({type:"string",format:"date",check:"string_format",...eS(t)})}function r7(e,t){return new tk({check:"less_than",...eS(t),value:e,inclusive:!1})}function ae(e,t){return new tk({check:"less_than",...eS(t),value:e,inclusive:!0})}function at(e,t){return new tx({check:"greater_than",...eS(t),value:e,inclusive:!1})}function ar(e,t){return new tx({check:"greater_than",...eS(t),value:e,inclusive:!0})}function aa(e,t){return new tR({check:"multiple_of",...eS(t),value:e})}function ai(e,t){return new tE({check:"max_length",...eS(t),maximum:e})}function an(e,t){return new tj({check:"min_length",...eS(t),minimum:e})}function as(e,t){return new tT({check:"length_equals",...eS(t),length:e})}function ao(e){return new tM({check:"overwrite",tx:e})}function al(e,...t){for(let r of t)for(let t of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,t)&&es(e,t,r[t]);return e}function ac(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??r9,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 au(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 ad(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 s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let o=e._zod.toJSONSchema?.();if(o)s.schema=o;else{let a={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,a);else{let r=s.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&&(s.ref||(s.ref=n),ad(n,t,a),t.seen.get(n).isParent=!0)}let l=t.metadataRegistry.get(e);return l&&al(s.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 s.schema.examples,delete s.schema.default),"input"===t.io&&"_prefault"in s.schema&&((a=s.schema).default??(a.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function ap(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function am(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}/${ap(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+ap(n)}})(t);a.def={...a.schema},n&&(a.defId=n);let s=a.schema;for(let e in s)delete s[e];s.$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>
60
+
61
+ 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 ah=new Set(["type","properties","required","additionalProperties"]),af=["oneOf","anyOf"];function ag(e){let t=e.additionalProperties;return void 0===t||!1===t||"object"!=typeof t||null===t?null:Object.keys(t).length?t:null}function ay(e){let t=[];for(let r of e){if("object"!=typeof r||"object"!==r.type)return null;for(let e in r)if(!ah.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]??ag(r);null!=t&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}es(r,a,1===e.length?e[0]:ay(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=ag(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 av(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},s=r.ref;if(r.ref=null,s){a(s);let r=e.seen.get(s),o=r.schema;if(o.$ref&&("draft-07"===e.target||"draft-04"===e.target||"openapi-3.0"===e.target)?(i.allOf=i.allOf??[],i.allOf.push(o)):al(i,o),al(i,n),t._zod.parent===s)for(let e in i)"$ref"!==e&&"allOf"!==e&&(e in n||delete i[e]);if(o.$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 o=t._zod.parent;if(o&&o!==s){a(o);let t=e.seen.get(o);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 ah)if(t in e)return;let r=t.filter(e=>af.some(t=>Array.isArray(e[t]))),a=null;if(r.length){let e=r[0],i=af.find(t=>Array.isArray(e[t]));if(1!==Object.keys(e).length)return;let n=t.filter(t=>t!==e),s=e[i].map(e=>ay([...n,e]));if(s.some(e=>!e))return;a={[i]:s}}else a=ay(t);a&&(delete e.allOf,al(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)}al(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 s=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,es(s,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(s).length>0&&("draft-2020-12"===e.target?i.$defs=s:i.definitions=s);try{let r=JSON.parse(JSON.stringify(i));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:a_(t,"input",e.processors),output:a_(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw Error("Error converting schema to JSON.")}}let a_=(e,t,r={})=>a=>{let{libraryOptions:i,target:n}=a??{},s=ac({...i??{},target:n,io:t,processors:r});return ad(e,s),am(s,e),av(s,e)},ab=(e,t,r)=>{(void 0===e[t]||r>e[t])&&(e[t]=r)},aS=(e,t,r)=>{(void 0===e[t]||r<e[t])&&(e[t]=r)},a$=(e,t)=>{ab(e,"minimum",t),aS(e,"maximum",t)},aw=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},ak=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},ax=(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)},aP=(e,t)=>ab(e,"minimum",t.minimum),aE=(e,t)=>aS(e,"maximum",t.maximum),aj=e=>(t,r)=>{aR(t,r.format);let[a,i]=e[r.format];ab(t,"minimum",a),aS(t,"maximum",i)},aT={greater_than:(e,t)=>ab(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>aS(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>aw(e,t.value),number_format:aj(ew),bigint_format:aj(ek),min_length:aP,max_length:aE,length_equals:(e,t)=>a$(e,t.length),min_size:aP,max_size:aE,size_equals:(e,t)=>a$(e,t.size),string_format:(e,t)=>{aR(e,t.format),t.pattern&&ak(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)=>ax(e,t.mime)};function aO(e){let t={},r=e._zod.def;for(let a of e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[])aT[a._zod.def.check]?.(t,a._zod.def);let a=e._zod.bag;for(let e of(void 0!==a.minimum&&ab(t,"minimum",a.minimum),void 0!==a.exclusiveMinimum&&ab(t,"exclusiveMinimum",a.exclusiveMinimum),void 0!==a.maximum&&aS(t,"maximum",a.maximum),void 0!==a.exclusiveMaximum&&aS(t,"exclusiveMaximum",a.exclusiveMaximum),void 0!==a.multipleOf&&aw(t,a.multipleOf),void 0!==a.format&&(t.format??(t.format=a.format),a.format.includes("int")&&(t.isInt=!0)),a.mime&&ax(t,a.mime),a.patterns??[]))ak(t,e);return t}let aC={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},aI=new Map([[ro,/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/],[rc,/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/]]),aN=e=>aI.get(e)??e,aq=(e,t,r,a)=>{r.type="string";let{minimum:i,maximum:n,format:s,patterns:o,contentEncoding:l,laxFormat:c}=aO(e);if("number"==typeof i&&(r.minLength=i),"number"==typeof n&&(r.maxLength=n),s&&(r.format=aC[s]??s,""===r.format&&delete r.format,("time"===s||c)&&delete r.format),l&&(r.contentEncoding=l),o&&o.size>0){let e=[...o].map(aN);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}))])}},aA=(e,t,r,a)=>{let{minimum:i,maximum:n,multipleOf:s,exclusiveMaximum:o,exclusiveMinimum:l,isInt:c}=aO(e);r.type=c?"integer":"number";let u="number"==typeof l&&l>=(i??-1/0),d="number"==typeof o&&o<=(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=o,r.exclusiveMaximum=!0):r.exclusiveMaximum=o:"number"==typeof n&&(r.maximum=n),s){let i=new Set;for(let n of s)Number.isFinite(n)&&0!==n?i.add(Math.abs(n)):au(e,t,r,a,`A multipleOf divisor of ${n} cannot be represented in JSON Schema`);let[n,...o]=i;void 0!==n&&(r.multipleOf=n),o.length&&(r.allOf=[...r.allOf??[],...o.map(e=>({multipleOf:e}))])}},az=(e,t,r,a)=>{r.type="boolean"},aM=(e,t,r,a)=>{"openapi-3.0"===t.target?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},aL=(e,t,r,a)=>{r.not={}},aZ=(e,t,r,a)=>{},aD=(e,t,r,a)=>{},aV=(e,t,r,a)=>{let i=X(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},aF=(e,t,r,a)=>{let i=e._zod.def;if(0===i.values.length){r.not={};return}let n=[];for(let s of i.values)if(void 0===s){if(au(e,t,r,a,"Literal `undefined` cannot be represented in JSON Schema"))return}else if("bigint"==typeof s){if(au(e,t,r,a,"BigInt literals cannot be represented in JSON Schema"))return;n.push(Number(s))}else n.push(s);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)=>{au(e,t,r,a,"Custom types cannot be represented in JSON Schema")},aH=(e,t,r,a)=>{au(e,t,r,a,"Transforms cannot be represented in JSON Schema")},aJ=(e,t,r,a)=>{let i=e._zod.def,{minimum:n,maximum:s}=aO(e);"number"==typeof n&&(r.minItems=n),"number"==typeof s&&(r.maxItems=s),r.type="array",r.items=ad(i.element,t,{...a,path:[...a.path,"items"]})};function aB(e){let t=e._zod.def;return"pipe"===t.type&&t.in._zod.traits.has("$ZodTransform")?aB(t.out):"catch"===t.type?aB(t.innerType):e._zod.optin}let aK=(e,t,r,a)=>{let i=e._zod.def,n=i.shape;if(Object.getOwnPropertySymbols(n).length&&au(e,t,r,a,"Symbol keys cannot be represented in JSON Schema"))return;for(let e in r.type="object",r.properties={},n)es(r.properties,e,ad(n[e],t,{...a,path:[...a.path,"properties",e]}));let s=[];for(let e of Object.keys(n)){let r=i.shape[e];("input"===t.io?void 0===aB(r):void 0===r._zod.optout)&&s.push(e)}s.length>0&&(r.required=s),i.catchall?._zod.def.type==="never"?r.additionalProperties=!1:i.catchall?i.catchall&&(r.additionalProperties=ad(i.catchall,t,{...a,path:[...a.path,"additionalProperties"]})):"output"===t.io&&(r.additionalProperties=!1)},aW=(e,t,r,a)=>{let i=e._zod.def,n=!1===i.inclusive,s=i.options.map((e,r)=>ad(e,t,{...a,path:[...a.path,n?"oneOf":"anyOf",r]}));n?r.oneOf=s:r.anyOf=s},aG=(e,t,r,a)=>{let i=e._zod.def,n=ad(i.left,t,{...a,path:[...a.path,"allOf",0]}),s=ad(i.right,t,{...a,path:[...a.path,"allOf",1]}),o=e=>"allOf"in e&&1===Object.keys(e).length,l=[...o(n)?n.allOf:[n],...o(s)?s.allOf:[s]];r.allOf=l,t.intersections.push(l)},aY=new WeakMap,aQ=(e,t,r,a)=>{let i=e._zod.def;r.type="object";let n=i.keyType,s=aO(n).patterns;if("loose"===i.mode&&s&&s.size>0){let e=ad(i.valueType,t,{...a,path:[...a.path,"patternProperties","*"]});for(let t of(r.patternProperties={},s))es(r.patternProperties,aN(t).source,e)}else{if("draft-07"===t.target||"draft-2020-12"===t.target){r.propertyNames=ad(i.keyType,t,{...a,path:[...a.path,"propertyNames"]});let n=aY.get(t);n||(n=[],aY.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 aY.get(e)??[]){let i=e.seen.get(a),n=(i?.def??i?.schema)?.propertyNames;if(!n||!0===n||r.has(n))continue;let s=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 s=n.map(r=>e(t,r,a));s.some((e,t)=>e!==n[t])&&(r={...r,[i]:s})}let i=Array.isArray(r.type)?r.type:[r.type],n=!i.includes("string")&&i.some(e=>"number"===e||"integer"===e),s=r.enum??(void 0!==r.const?[r.const]:void 0);if(!n&&!s?.some(e=>"number"==typeof e))return r;let{minimum:o,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",s||(h.pattern=(i.includes("number")?tg:tf).source)),h}(t,n,new Set);s!==n&&r.set(n,s)}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=ad(i.valueType,t,{...a,path:[...a.path,"additionalProperties"]})}let o=n._zod.values,l="input"===t.io&&void 0!==aB(i.valueType);if(o&&!i.partial&&!l){let e=[...o].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(r.required=e.map(String))}},aX=(e,t,r,a)=>{let i=e._zod.def,n=ad(i.innerType,t,a),s=t.seen.get(e);"openapi-3.0"===t.target?(s.ref=i.innerType,r.nullable=!0):r.anyOf=[n,{type:"null"}]},a0=(e,t,r,a)=>{let i=e._zod.def;ad(i.innerType,t,a),t.seen.get(e).ref=i.innerType},a1=Symbol();function a2(e,t,r,a,i){let n=!1,s=JSON.stringify(e,(e,t)=>"bigint"!=typeof t?t:(n=!0,null));return n?(au(t,r,a,i,"BigInt defaults cannot be represented in JSON Schema"),a1):JSON.parse(s)}let a9=(e,t,r,a)=>{let i=e._zod.def;ad(i.innerType,t,a),t.seen.get(e).ref=i.innerType;let n=a2(i.defaultValue,e,t,r,a);n!==a1&&(r.default=n)},a4=(e,t,r,a)=>{let i=e._zod.def;if(ad(i.innerType,t,a),t.seen.get(e).ref=i.innerType,"input"!==t.io)return;let n=a2(i.defaultValue,e,t,r,a);n!==a1&&(r._prefault=n)},a6=(e,t,r,a)=>{let i,n=e._zod.def;ad(n.innerType,t,a),t.seen.get(e).ref=n.innerType;try{i=n.catchValue(void 0)}catch{au(e,t,r,a,"Dynamic catch values are not supported in JSON Schema");return}r.default=i},a5=(e,t,r,a)=>{let i=e._zod.def,n=i.in._zod.traits.has("$ZodTransform"),s="input"===t.io?n?i.out:i.in:i.out;ad(s,t,a),t.seen.get(e).ref=s},a3=(e,t,r,a)=>{let i=e._zod.def;ad(i.innerType,t,a),t.seen.get(e).ref=i.innerType,r.readOnly=!0},a8=(e,t,r,a)=>{let i=e._zod.def;ad(i.innerType,t,a),t.seen.get(e).ref=i.innerType},a7=(e,t,r,a)=>{let i=e._zod.innerType;ad(i,t,a),t.seen.get(e).ref=i},ie={string:aq,number:aA,boolean:az,bigint:(e,t,r,a)=>{au(e,t,r,a,"BigInt cannot be represented in JSON Schema")},symbol:(e,t,r,a)=>{au(e,t,r,a,"Symbols cannot be represented in JSON Schema")},null:aM,undefined:(e,t,r,a)=>{au(e,t,r,a,"Undefined cannot be represented in JSON Schema")},void:(e,t,r,a)=>{au(e,t,r,a,"Void cannot be represented in JSON Schema")},never:aL,any:aZ,unknown:aD,date:(e,t,r,a)=>{au(e,t,r,a,"Date cannot be represented in JSON Schema")},enum:aV,literal:aF,nan:(e,t,r,a)=>{au(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:s}=aO(e);void 0!==i&&(r.minLength=i),void 0!==n&&(r.maxLength=n),s&&(0===s.length?r.not={}:1===s.length?r.contentMediaType=s[0]:r.anyOf=s.map(e=>({contentMediaType:e})))},success:(e,t,r,a)=>{r.type="boolean"},custom:aU,function:(e,t,r,a)=>{au(e,t,r,a,"Function types cannot be represented in JSON Schema")},transform:aH,map:(e,t,r,a)=>{au(e,t,r,a,"Map cannot be represented in JSON Schema")},set:(e,t,r,a)=>{au(e,t,r,a,"Set cannot be represented in JSON Schema")},array:aJ,object:aK,union:aW,intersection:aG,tuple:(e,t,r,a)=>{let i=e._zod.def;r.type="array";let n="draft-2020-12"===t.target?"prefixItems":"items",s="draft-2020-12"===t.target||"openapi-3.0"===t.target?"items":"additionalItems",o=i.items.map((e,r)=>ad(e,t,{...a,path:[...a.path,n,r]})),l=i.rest?ad(i.rest,t,{...a,path:[...a.path,s,..."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!==aB(e):"optional"===e._zod.optout))break;c--}let u=i.items.length,d=!i.rest;"draft-2020-12"===t.target?(r.prefixItems=o,d?r.items=!1:l&&(r.items=l)):"openapi-3.0"===t.target?(r.items={anyOf:o},l&&r.items.anyOf.push(l)):(r.items=o,d?r.additionalItems=!1:l&&(r.additionalItems=l)),c>0&&(r.minItems=c),d&&(r.maxItems=u);let{minimum:p,maximum:m}=aO(e);"number"==typeof p&&(r.minItems=p),"number"==typeof m&&(r.maxItems=m)},record:aQ,nullable:aX,nonoptional:a0,default:a9,prefault:a4,catch:a6,pipe:a5,readonly:a3,promise:(e,t,r,a)=>{let i=e._zod.def;ad(i.innerType,t,a),t.seen.get(e).ref=i.innerType},optional:a8,lazy:a7};function it(e,t){if("_idmap"in e){let r=ac({...t,processors:ie}),a={};for(let t of e._idmap.entries()){let[e,a]=t;ad(a,r)}let i={};for(let n of(r.external={registry:e,uri:t?.uri,defs:a},e._idmap.entries())){let[e,t]=n;am(r,t),es(i,e,av(r,t))}return Object.keys(a).length>0&&(i.__shared={["draft-2020-12"===r.target?"$defs":"definitions"]:a}),{schemas:i}}let r=ac({...t,processors:ie});return ad(e,r),am(r,e),av(r,e)}let ir={get:function(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,et,2)),e.message},set:function(e){this._zod.message=e},enumerable:!0,configurable:!0},ia={value:void 0,enumerable:!1},ii=new WeakSet([Object.prototype,Error.prototype]),is=(e,t)=>{e.name="$ZodError",ia.value=t,Object.defineProperty(e,"issues",ia),ia.value=void 0,Object.defineProperty(e,"message",ir);let r=Object.getPrototypeOf(e);ii.has(r)||(ii.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})}}))},io=eJ("$ZodError",is);function il(e,t){return{callee:t?.callee??e,Err:t?.Err}}eJ("$ZodError",is,void 0,{Parent:Error});let ic=e=>{let t=(r,a,i,n)=>{let s=i?{...i,async:!1}:{async:!1},o=r._zod.run({value:a,issues:[]},s);if(o instanceof Promise)throw new eB;if(o.issues.length){let r=new(n?.Err??e)(o.issues.map(e=>eI(e,s,eG())));throw em(r,n?.callee??t),r}return o.value};return t},iu=e=>{let t=async(r,a,i,n)=>{let s=i?{...i,async:!0}:{async:!0},o=r._zod.run({value:a,issues:[]},s);if(o instanceof Promise&&(o=await o),o.issues.length){let r=new(n?.Err??e)(o.issues.map(e=>eI(e,s,eG())));throw em(r,n?.callee??t),r}return o.value};return t},id=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 eB;return n.issues.length?ip(e,n.issues,i):{success:!0,data:n.value}};function ip(e,t,r){let a;return{success:!1,get error(){return a||(a=new e(t.map(e=>eI(e,r,eG()))),t=void 0,r=void 0),a},set error(e){a=e,t=void 0,r=void 0}}}let im=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?ip(e,n.issues,i):{success:!0,data:n.value}},ih=Symbol.for("zod.compile.invalid"),ig=Symbol.for("zod.compile.fallback"),iy=new WeakSet([Object.prototype,Error.prototype]);function iv(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 i_=eJ("ZodError",(e,t)=>{io.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);iy.has(r)||(iy.add(r),iv(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],s=i===e.length-1;if("_errors"===r){s&&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 o=a[r];s&&o._errors.push(t(n)),a=o,i++}}}};return a(e),r})(e,t)),iv(r,"flatten",e=>t=>(function(e,t=e=>e.message){let r={},a=[];for(let s of e.issues)if(s.path.length>0){var i,n;(i=s.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(s))}else a.push(t(s));return{formErrors:a,fieldErrors:r}})(e,t)),iv(r,"addIssue",e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,et,2)}),iv(r,"addIssues",e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,et,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return 0===this.issues.length}}))},void 0,{Parent:Error}),ib=ic(i_),iS=iu(i_),i$=id(i_),iw=im(i_),ik=(_=ic(i_),b=(e,t,r,a)=>_(e,t,r?{...r,direction:"backward"}:{direction:"backward"},il(b,a))),ix=(S=ic(i_),$=(e,t,r,a)=>S(e,t,r,il($,a))),iR=(w=iu(i_),k=async(e,t,r,a)=>{let i=r?{...r,direction:"backward"}:{direction:"backward"};return await w(e,t,i,il(k,a))}),iP=(x=iu(i_),R=async(e,t,r,a)=>await x(e,t,r,il(R,a)));function iE(){eW.memoizer||eG({memoizer:e4})}let ij=eJ("ZodType",(e,t)=>(eW.localeError||eG({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 ${e$(r.values[0])}`;return`Invalid option: expected one of ${ee(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":""}: ${ee(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"}}})()}),tD.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(ep(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 eb(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 nL({type:"custom",check:"custom",fn:e,...eS(t)})}(e,t))},superRefine(e,t){var r;let a,i;return this.check((r=t=>(t.addIssue=e=>{"string"==typeof e?t.issues.push(ez(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(ez(e)))},e(t.value,t)),(i=new tS({check:"custom",...eS(t)}))._zod.check=r,a=i))},overwrite(e){return this.check(ao(e))},optional(){return nx(this)},exactOptional(){return new nR({type:"optional",innerType:this})},nullable(){return nE(this)},nullish(){return nx(nE(this))},nonoptional(e){return new nO({type:"nonoptional",innerType:this,...eS(e)})},array(){return ns(this)},or(e){return nd([this,e])},and(e){return nf(this,e)},transform(e){return nN(this,nw(e))},default(e){return new nj({type:"default",innerType:this,get defaultValue(){return"function"==typeof e?e():ey(e)}})},prefault(e){return new nT({type:"prefault",innerType:this,get defaultValue(){return"function"==typeof e?e():ey(e)}})},catch(e){let t;return new nC({type:"catch",innerType:this,catchValue:"function"==typeof e?e:((t=()=>e)["~constantCatch"]=!0,t)})},pipe(e){return nN(this,e)},readonly(){return new nA({type:"readonly",innerType:this})},describe(e){let t=this.clone();return r9.add(t,{description:e}),t},meta(...e){if(0===e.length)return r9.get(this);let t=this.clone();return r9.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 eM(this,"~standard",{...tF(this),jsonSchema:{input:a_(this,"input"),output:a_(this,"output")}},!1)},set"~standard"(e){eM(this,"~standard",e)},parse:function e(t,r){return ib(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await iS(this,t,r,{callee:e})},safeParse(e,t){return i$(this,e,t)},async safeParseAsync(e,t){return iw(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){eM(this,"spa",e)},validate(e,t){let r=this._zod.bag.validator;if(void 0!==r){if(r(e)!==ih)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[ig]=!0,a=n({value:t,issues:[]},i)):a=e._zod.run({value:t,issues:[]},i),a instanceof Promise)throw new eB;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 ik(this,t,r,{callee:e})},decode:function e(t,r){return ix(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 iP(this,t,r,{callee:e})},safeEncode(e,t){let r;return r=t?{...t,direction:"backward"}:{direction:"backward"},id(i_)(this,e,r)},safeDecode(e,t){return id(i_)(this,e,t)},async safeEncodeAsync(e,t){return(async(e,t,r)=>{let a=r?{...r,direction:"backward"}:{direction:"backward"};return im(i_)(e,t,a)})(this,e,t)},async safeDecodeAsync(e,t){return(async(e,t,r)=>im(i_)(e,t,r))(this,e,t)},toJSONSchema(e){return((e,t={})=>r=>{let a=ac({...r,processors:t});return ad(e,a),am(a,e),av(a,e)})(this,{})(e)},get description(){return r9.get(this)?.description},get _def(){return this._zod.def}}),iT=eJ("_ZodString",(e,t)=>{tU.init(e,t),ij.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aq(e,t,r,a)},eL({format:e=>aO(e).format??null,minLength:e=>aO(e).minimum??null,maxLength:e=>aO(e).maximum??null},{regex(...e){return this.check(function(e,t){return new tC({check:"string_format",format:"regex",...eS(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new tq({check:"string_format",format:"includes",...eS(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new tA({check:"string_format",format:"starts_with",...eS(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new tz({check:"string_format",format:"ends_with",...eS(t),suffix:e})}(...e))},min(...e){return this.check(an(...e))},max(...e){return this.check(ai(...e))},length(...e){return this.check(as(...e))},nonempty(...e){return this.check(an(1,...e))},lowercase(e){return this.check(new tI({check:"string_format",format:"lowercase",...eS(e)}))},uppercase(e){return this.check(new tN({check:"string_format",format:"uppercase",...eS(e)}))},trim(){return this.check(ao(e=>e.trim()))},normalize(...e){return this.check(function(e){return ao(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(ao(e=>e.toLowerCase()))},toUpperCase(){return this.check(ao(e=>e.toUpperCase()))},slugify(){return this.check(ao(e=>e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")))}})),iO=eJ("ZodString",(e,t)=>{tU.init(e,t),iT.init(e,t)},{email(e){return this.check(r6(iM,e))},url(e){return this.check(r5(iD,e))},jwt(e){return this.check(new i2({type:"string",format:"jwt",check:"string_format",abort:!1,...eS(e)}))},emoji(e){return this.check(new iV({type:"string",format:"emoji",check:"string_format",abort:!1,...eS(e)}))},guid(e){return this.check(new iL({type:"string",format:"guid",check:"string_format",abort:!1,...eS(e)}))},uuid(e){return this.check(new iZ({type:"string",format:"uuid",check:"string_format",abort:!1,...eS(e)}))},uuidv4(e){return this.check(new iZ({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...eS(e)}))},uuidv6(e){return this.check(new iZ({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...eS(e)}))},uuidv7(e){return this.check(new iZ({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...eS(e)}))},nanoid(e){return this.check(new iF({type:"string",format:"nanoid",check:"string_format",abort:!1,...eS(e)}))},cuid(e){return this.check(new iU({type:"string",format:"cuid",check:"string_format",abort:!1,...eS(e)}))},cuid2(e){return this.check(new iH({type:"string",format:"cuid2",check:"string_format",abort:!1,...eS(e)}))},ulid(e){return this.check(new iJ({type:"string",format:"ulid",check:"string_format",abort:!1,...eS(e)}))},base64(e){return this.check(new iX({type:"string",format:"base64",check:"string_format",abort:!1,...eS(e)}))},base64url(e){return this.check(new i0({type:"string",format:"base64url",check:"string_format",abort:!1,...eS(e)}))},xid(e){return this.check(new iB({type:"string",format:"xid",check:"string_format",abort:!1,...eS(e)}))},ksuid(e){return this.check(new iK({type:"string",format:"ksuid",check:"string_format",abort:!1,...eS(e)}))},ipv4(e){return this.check(new iW({type:"string",format:"ipv4",check:"string_format",abort:!1,...eS(e)}))},ipv6(e){return this.check(new iG({type:"string",format:"ipv6",check:"string_format",abort:!1,...eS(e)}))},cidrv4(e){return this.check(new iY({type:"string",format:"cidrv4",check:"string_format",abort:!1,...eS(e)}))},cidrv6(e){return this.check(new iQ({type:"string",format:"cidrv6",check:"string_format",abort:!1,...eS(e)}))},e164(e){return this.check(new i1({type:"string",format:"e164",check:"string_format",abort:!1,...eS(e)}))},datetime(e){return this.check(r3(iN,e))},date(e){return this.check(r8(iq,e))},time(e){return this.check(new iA({type:"string",format:"time",check:"string_format",precision:null,...eS(e)}))},duration(e){return this.check(new iz({type:"string",format:"duration",check:"string_format",...eS(e)}))}});function iC(e){return new iO(r4({type:"string",...eS(e)}))}let iI=eJ("ZodStringFormat",(e,t)=>{tH.init(e,t),iT.init(e,t)}),iN=eJ("ZodISODateTime",(e,t)=>{t5.init(e,t),iI.init(e,t)}),iq=eJ("ZodISODate",(e,t)=>{t3.init(e,t),iI.init(e,t)}),iA=eJ("ZodISOTime",(e,t)=>{t8.init(e,t),iI.init(e,t)}),iz=eJ("ZodISODuration",(e,t)=>{t7.init(e,t),iI.init(e,t)}),iM=eJ("ZodEmail",(e,t)=>{tK.init(e,t),iI.init(e,t)}),iL=eJ("ZodGUID",(e,t)=>{tJ.init(e,t),iI.init(e,t)}),iZ=eJ("ZodUUID",(e,t)=>{tB.init(e,t),iI.init(e,t)}),iD=eJ("ZodURL",(e,t)=>{tQ.init(e,t),iI.init(e,t)}),iV=eJ("ZodEmoji",(e,t)=>{tX.init(e,t),iI.init(e,t)}),iF=eJ("ZodNanoID",(e,t)=>{t0.init(e,t),iI.init(e,t)}),iU=eJ("ZodCUID",(e,t)=>{t1.init(e,t),iI.init(e,t)}),iH=eJ("ZodCUID2",(e,t)=>{t2.init(e,t),iI.init(e,t)}),iJ=eJ("ZodULID",(e,t)=>{t9.init(e,t),iI.init(e,t)}),iB=eJ("ZodXID",(e,t)=>{t4.init(e,t),iI.init(e,t)}),iK=eJ("ZodKSUID",(e,t)=>{t6.init(e,t),iI.init(e,t)}),iW=eJ("ZodIPv4",(e,t)=>{re.init(e,t),iI.init(e,t)}),iG=eJ("ZodIPv6",(e,t)=>{ra.init(e,t),iI.init(e,t)}),iY=eJ("ZodCIDRv4",(e,t)=>{ri.init(e,t),iI.init(e,t)}),iQ=eJ("ZodCIDRv6",(e,t)=>{rn.init(e,t),iI.init(e,t)}),iX=eJ("ZodBase64",(e,t)=>{rl.init(e,t),iI.init(e,t)}),i0=eJ("ZodBase64URL",(e,t)=>{ru.init(e,t),iI.init(e,t)}),i1=eJ("ZodE164",(e,t)=>{rd.init(e,t),iI.init(e,t)}),i2=eJ("ZodJWT",(e,t)=>{rp.init(e,t),iI.init(e,t)}),i9=eJ("ZodNumber",(e,t)=>{rm.init(e,t),ij.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aA(e,t,r,a),e.isFinite=!0},eL({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=aO(e);return Math.max(t??-1/0,r??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=aO(e);return Math.min(t??1/0,r??1/0)},isInt:e=>{let{isInt:t,multipleOf:r}=aO(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>aO(e).format??null},{gt(e,t){return this.check(at(e,t))},gte(e,t){return this.check(ar(e,t))},min(e,t){return this.check(ar(e,t))},lt(e,t){return this.check(r7(e,t))},lte(e,t){return this.check(ae(e,t))},max(e,t){return this.check(ae(e,t))},int(e){return this.check(i5(e))},safe(e){return this.check(i5(e))},positive(e){return this.check(at(0,e))},nonnegative(e){return this.check(ar(0,e))},negative(e){return this.check(r7(0,e))},nonpositive(e){return this.check(ae(0,e))},multipleOf(e,t){return this.check(aa(e,t))},step(e,t){return this.check(aa(e,t))},finite(){return this}}));function i4(e){return new i9(r4({type:"number",checks:[],...eS(e)}))}let i6=eJ("ZodNumberFormat",(e,t)=>{rh.init(e,t),i9.init(e,t)});function i5(e){return new i6({type:"number",check:"number_format",abort:!1,format:"safeint",...eS(e)})}let i3=eJ("ZodBoolean",(e,t)=>{rf.init(e,t),ij.init(e,t),e._zod.processJSONSchema=(t,r,a)=>az(e,t,r,a)});function i8(e){return new i3({type:"boolean",...eS(e)})}let i7=eJ("ZodNull",(e,t)=>{rg.init(e,t),ij.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aM(e,t,r,a)});function ne(e){return new i7({type:"null",...eS(e)})}let nt=eJ("ZodAny",(e,t)=>{ry.init(e,t),ij.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aZ(e,t,r,a)}),nr=eJ("ZodUnknown",(e,t)=>{rv.init(e,t),ij.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aD(e,t,r,a)});function na(){return new nr({type:"unknown"})}let ni=eJ("ZodNever",(e,t)=>{r_.init(e,t),ij.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aL(e,t,r,a)}),nn=eJ("ZodArray",(e,t)=>{iE(),r$.init(e,t),ij.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aJ(e,t,r,a),e.element=t.element},{min(e,t){return this.check(an(e,t))},nonempty(e){return this.check(an(1,e))},max(e,t){return this.check(ai(e,t))},length(e,t){return this.check(as(e,t))},unwrap(){return this.element}});function ns(e,t){return new nn({type:"array",element:e,...eS(t)})}let no=eJ("ZodObject",(e,t)=>{var r;let a,i;iE(),rE.init(e,t),ij.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aK(e,t,r,a),(i=(r="shape")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=this._zod.def.shape,Object.defineProperty(this,r,e),e.value},set(e){Object.defineProperty(this,r,{configurable:!0,writable:!0,enumerable:!1,value:e})}})},{keyof(){return n_(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(ep(this._zod.def,{catchall:e}))},passthrough(){return this.clone(ep(this._zod.def,{catchall:na()}))},loose(){return this.clone(ep(this._zod.def,{catchall:na()}))},strict(){return this.clone(ep(this._zod.def,{catchall:new ni({type:"never",...eS(void 0)})}))},strip(){return this.clone(ep(this._zod.def,{catchall:void 0}))},extend(e){if(!eg(e))throw Error("Invalid input to extend: expected a plain object");let t=this._zod.def.checks;if(t&&t.length>0){let t=el(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 eb(this,ep(this._zod.def,{shape:eR(this,e)}))},safeExtend(e){if(!eg(e))throw Error("Invalid input to safeExtend: expected a plain object");return eb(this,ep(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 ed(t,this,Reflect.ownKeys(el(this))),ed(t,e,Reflect.ownKeys(el(e))),eb(this,ep(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 ed(i,e,ex(e,t)),eb(e,ep(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(ex(e,t)),n={};return ed(n,e,Reflect.ownKeys(el(e)).filter(e=>!i.has(e))),eb(e,ep(r,{shape:n,checks:[]}))}(this,e)},partial(...e){return eP(nk,this,e[0])},exactPartial(...e){return eP(nR,this,e[0],"exactPartial")},required(...e){var t;let r,a;return r=(t=e[0])?new Set(ex(this,t)):void 0,ed(a={},this,Reflect.ownKeys(el(this)),(e,t)=>r&&!r.has(t)?e:new nO({type:"nonoptional",innerType:e})),eb(this,ep(this._zod.def,{shape:a}))}});function nl(e,t){return new no({type:"object",shape:e??{},...eS(t)})}function nc(e,t){return new no({type:"object",shape:e,catchall:na(),...eS(t)})}let nu=eJ("ZodUnion",(e,t)=>{rT.init(e,t),ij.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aW(e,t,r,a),e.options=t.options});function nd(e,t){return new nu({type:"union",options:e,...eS(t)})}let np=eJ("ZodDiscriminatedUnion",(e,t)=>{nu.init(e,t),rO.init(e,t)});function nm(e,t,r){return new np({type:"union",options:t,discriminator:e,...eS(r)})}let nh=eJ("ZodIntersection",(e,t)=>{rC.init(e,t),ij.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aG(e,t,r,a)});function nf(e,t){return new nh({type:"intersection",left:e,right:t})}let ng=eJ("ZodRecord",(e,t)=>{iE(),rN.init(e,t),ij.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aQ(e,t,r,a),e.keyType=t.keyType,e.valueType=t.valueType});function ny(e,t,r){return new ng(t&&t._zod?{type:"record",keyType:e,valueType:t,...eS(r)}:{type:"record",keyType:iC(),valueType:e,...eS(t)})}let nv=eJ("ZodEnum",(e,t)=>{rq.init(e,t),ij.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aV(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 nv({...t,checks:[],...eS(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 nv({...t,checks:[],...eS(a),entries:i})}});function n_(e,t){return new nv({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...eS(t)})}let nb=eJ("ZodLiteral",(e,t)=>{rA.init(e,t),ij.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aF(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 nS(e,t){return new nb({type:"literal",values:Array.isArray(e)?e:[e],...eS(t)})}let n$=eJ("ZodTransform",(e,t)=>{iE(),rz.init(e,t),ij.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aH(e,t,r,a),e._zod.parse=(r,a)=>{if("backward"===a.direction)throw new eK(e.constructor.name);r.addIssue=a=>{"string"==typeof a?r.issues.push(ez(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(ez(a)))};let i=t.transform(r.value,r);return i instanceof Promise?i.then(e=>(r.value=e,r)):(r.value=i,r)}});function nw(e){return new n$({type:"transform",transform:e})}let nk=eJ("ZodOptional",(e,t)=>{rL.init(e,t),ij.init(e,t),e._zod.processJSONSchema=(t,r,a)=>a8(e,t,r,a),e.unwrap=()=>e._zod.def.innerType});function nx(e){return new nk({type:"optional",innerType:e})}let nR=eJ("ZodExactOptional",(e,t)=>{rZ.init(e,t),ij.init(e,t),e._zod.processJSONSchema=(t,r,a)=>a8(e,t,r,a),e.unwrap=()=>e._zod.def.innerType}),nP=eJ("ZodNullable",(e,t)=>{rD.init(e,t),ij.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aX(e,t,r,a),e.unwrap=()=>e._zod.def.innerType});function nE(e){return new nP({type:"nullable",innerType:e})}let nj=eJ("ZodDefault",(e,t)=>{rV.init(e,t),ij.init(e,t),e._zod.processJSONSchema=(t,r,a)=>a9(e,t,r,a),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),nT=eJ("ZodPrefault",(e,t)=>{rU.init(e,t),ij.init(e,t),e._zod.processJSONSchema=(t,r,a)=>a4(e,t,r,a),e.unwrap=()=>e._zod.def.innerType}),nO=eJ("ZodNonOptional",(e,t)=>{rH.init(e,t),ij.init(e,t),e._zod.processJSONSchema=(t,r,a)=>a0(e,t,r,a),e.unwrap=()=>e._zod.def.innerType}),nC=eJ("ZodCatch",(e,t)=>{rK.init(e,t),ij.init(e,t),e._zod.processJSONSchema=(t,r,a)=>a6(e,t,r,a),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),nI=eJ("ZodPipe",(e,t)=>{rW.init(e,t),ij.init(e,t),e._zod.processJSONSchema=(t,r,a)=>a5(e,t,r,a),e.in=t.in,e.out=t.out});function nN(e,t){return new nI({type:"pipe",in:e,out:t})}let nq=eJ("ZodPreprocess",(e,t)=>{nI.init(e,t),rY.init(e,t)}),nA=eJ("ZodReadonly",(e,t)=>{rQ.init(e,t),ij.init(e,t),e._zod.processJSONSchema=(t,r,a)=>a3(e,t,r,a),e.unwrap=()=>e._zod.def.innerType}),nz=eJ("ZodLazy",(e,t)=>{r0.init(e,t),ij.init(e,t),e._zod.processJSONSchema=(t,r,a)=>a7(e,t,r,a),e.unwrap=()=>e._zod.def.getter()});function nM(e){return new nz({type:"lazy",getter:e})}let nL=eJ("ZodCustom",(e,t)=>{r1.init(e,t),ij.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aU(e,t,r,a)});function nZ(e,t){return new nq({type:"pipe",in:nw(e),out:t})}let nD="2025-11-25",nV=[nD,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],nF="io.modelcontextprotocol/protocolVersion",nU="io.modelcontextprotocol/clientInfo",nH="io.modelcontextprotocol/serverInfo",nJ="io.modelcontextprotocol/clientCapabilities",nB="io.modelcontextprotocol/subscriptionId",nK="io.modelcontextprotocol/logLevel",nW=nM(()=>nd([iC(),i4(),i8(),ne(),ny(iC(),nW),ns(nW)])),nG=ny(iC(),nW),nY=ns(nW),nQ=nd([iC(),i4().int()]),nX=iC(),n0=nl({ttl:i4().optional()}),n1=nl({taskId:iC()}),n2=nc({progressToken:nQ.optional(),"io.modelcontextprotocol/related-task":n1.optional()}),n9=nl({_meta:n2.optional()}),n4=n9.extend({task:n0.optional()}),n6=nl({method:iC(),params:n9.loose().optional()}),n5=nl({_meta:n2.optional()}),n3=nl({method:iC(),params:n5.loose().optional()}),n8=nc({get[nH](){return sm.optional().catch(void 0)}}),n7=nc({_meta:n8.optional()}),se=nd([iC(),i4().int()]),st=nl({jsonrpc:nS("2.0"),id:se,...n6.shape}).strict(),sr=nl({jsonrpc:nS("2.0"),...n3.shape}).strict(),sa=nl({jsonrpc:nS("2.0"),id:se,result:n7}).strict(),si=nl({jsonrpc:nS("2.0"),id:se.optional(),error:nl({code:i4().int(),message:iC(),data:na().optional()})}).strict(),sn=nd([st,sr,sa,si]),ss=nd([sa,si]),so=n7.strict(),sl=n5.extend({requestId:se.optional(),reason:iC().optional()}),sc=n3.extend({method:nS("notifications/cancelled"),params:sl}),su=nl({src:iC(),mimeType:iC().optional(),sizes:ns(iC()).optional(),theme:n_(["light","dark"]).optional()}),sd=nl({icons:ns(su).optional()}),sp=nl({name:iC(),title:iC().optional()}),sm=sp.extend({...sp.shape,...sd.shape,version:iC(),websiteUrl:iC().optional(),description:iC().optional()}),sh=nf(nl({applyDefaults:i8().optional()}),nG),sf=nZ(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,nf(nl({form:sh.optional(),url:nG.optional()}),nG.optional())),sg=nc({list:nG.optional(),cancel:nG.optional(),requests:nc({sampling:nc({createMessage:nG.optional()}).optional(),elicitation:nc({create:nG.optional()}).optional()}).optional()}),sy=nc({list:nG.optional(),cancel:nG.optional(),requests:nc({tools:nc({call:nG.optional()}).optional()}).optional()}),sv=nl({experimental:ny(iC(),nG).optional(),sampling:nl({context:nG.optional(),tools:nG.optional()}).optional(),elicitation:sf.optional(),roots:nl({listChanged:i8().optional()}).optional(),tasks:sg.optional(),extensions:ny(iC(),nG).optional()}),s_=n9.extend({protocolVersion:iC(),capabilities:sv,clientInfo:sm}),sb=n6.extend({method:nS("initialize"),params:s_}),sS=nl({experimental:ny(iC(),nG).optional(),logging:nG.optional(),completions:nG.optional(),prompts:nl({listChanged:i8().optional()}).optional(),resources:nl({subscribe:i8().optional(),listChanged:i8().optional()}).optional(),tools:nl({listChanged:i8().optional()}).optional(),tasks:sy.optional(),extensions:ny(iC(),nG).optional()}),s$=n7.extend({protocolVersion:iC(),capabilities:sS,serverInfo:sm,instructions:iC().optional()}),sw=n3.extend({method:nS("notifications/initialized"),params:n5.optional()}),sk=n6.extend({method:nS("server/discover"),params:n9.optional()}),sx=n7.extend({supportedVersions:ns(iC()),capabilities:sS,instructions:iC().optional()}),sR=n6.extend({method:nS("ping"),params:n9.optional()}),sP=nl({progress:i4(),total:nx(i4()),message:nx(iC())}),sE=nl({...n5.shape,...sP.shape,progressToken:nQ}),sj=n3.extend({method:nS("notifications/progress"),params:sE}),sT=n9.extend({cursor:nX.optional()}),sO=n6.extend({params:sT.optional()}),sC=n7.extend({nextCursor:nX.optional()}),sI=nl({uri:iC(),mimeType:nx(iC()),_meta:ny(iC(),na()).optional()}),sN=sI.extend({text:iC()}),sq=iC().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),sA=sI.extend({blob:sq}),sz=n_(["user","assistant"]),sM=nl({audience:ns(sz).optional(),priority:i4().min(0).max(1).optional(),lastModified:r3(iN,{offset:!0}).optional()}),sL=nl({...sp.shape,...sd.shape,uri:iC(),description:nx(iC()),mimeType:nx(iC()),size:nx(i4()),annotations:sM.optional(),_meta:nx(nc({}))}),sZ=nl({...sp.shape,...sd.shape,uriTemplate:iC(),description:nx(iC()),mimeType:nx(iC()),annotations:sM.optional(),_meta:nx(nc({}))}),sD=sO.extend({method:nS("resources/list")}),sV=sC.extend({resources:ns(sL)}),sF=sO.extend({method:nS("resources/templates/list")}),sU=sC.extend({resourceTemplates:ns(sZ)}),sH=n9.extend({uri:iC()}),sJ=n6.extend({method:nS("resources/read"),params:sH}),sB=n7.extend({contents:ns(nd([sN,sA]))}),sK=n3.extend({method:nS("notifications/resources/list_changed"),params:n5.optional()}),sW=n6.extend({method:nS("resources/subscribe"),params:sH}),sG=n6.extend({method:nS("resources/unsubscribe"),params:sH}),sY=nl({toolsListChanged:i8().optional(),promptsListChanged:i8().optional(),resourcesListChanged:i8().optional(),resourceSubscriptions:ns(iC()).optional()}),sQ=n9.extend({notifications:sY}),sX=n6.extend({method:nS("subscriptions/listen"),params:sQ}),s0=n5.extend({notifications:sY}),s1=n3.extend({method:nS("notifications/subscriptions/acknowledged"),params:s0}),s2=n8.extend({[nB]:se}),s9=n7.extend({_meta:s2}),s4=n5.extend({uri:iC()}),s6=n3.extend({method:nS("notifications/resources/updated"),params:s4}),s5=nl({name:iC(),description:nx(iC()),required:nx(i8())}),s3=nl({...sp.shape,...sd.shape,description:nx(iC()),arguments:nx(ns(s5)),_meta:nx(nc({}))}),s8=sO.extend({method:nS("prompts/list")}),s7=sC.extend({prompts:ns(s3)}),oe=n9.extend({name:iC(),arguments:ny(iC(),iC()).optional()}),ot=n6.extend({method:nS("prompts/get"),params:oe}),or=nl({type:nS("text"),text:iC(),annotations:sM.optional(),_meta:ny(iC(),na()).optional()}),oa=nl({type:nS("image"),data:sq,mimeType:iC(),annotations:sM.optional(),_meta:ny(iC(),na()).optional()}),oi=nl({type:nS("audio"),data:sq,mimeType:iC(),annotations:sM.optional(),_meta:ny(iC(),na()).optional()}),on=nl({type:nS("tool_use"),name:iC(),id:iC(),input:ny(iC(),na()),_meta:ny(iC(),na()).optional()}),os=nl({type:nS("resource"),resource:nd([sN,sA]),annotations:sM.optional(),_meta:ny(iC(),na()).optional()}),oo=sL.extend({type:nS("resource_link")}),ol=nd([or,oa,oi,oo,os]),oc=nl({role:sz,content:ol}),ou=n7.extend({description:iC().optional(),messages:ns(oc)}),od=n3.extend({method:nS("notifications/prompts/list_changed"),params:n5.optional()}),op=nl({title:iC().optional(),readOnlyHint:i8().optional(),destructiveHint:i8().optional(),idempotentHint:i8().optional(),openWorldHint:i8().optional()}),om=nl({taskSupport:n_(["required","optional","forbidden"]).optional()}),oh=nl({...sp.shape,...sd.shape,description:iC().optional(),inputSchema:nl({type:nS("object"),properties:ny(iC(),nW).optional(),required:ns(iC()).optional()}).catchall(na()),outputSchema:nc({$schema:iC().optional()}).optional(),annotations:op.optional(),execution:om.optional(),_meta:ny(iC(),na()).optional()}),of=sO.extend({method:nS("tools/list")}),og=sC.extend({tools:ns(oh)}),oy=n7.extend({content:ns(ol).default([]),structuredContent:na().optional(),isError:i8().optional()}),ov=oy.or(n7.extend({toolResult:na()})),o_=n4.extend({name:iC(),arguments:ny(iC(),na()).optional()}),ob=n6.extend({method:nS("tools/call"),params:o_}),oS=n3.extend({method:nS("notifications/tools/list_changed"),params:n5.optional()}),o$=nl({autoRefresh:i8().default(!0),debounceMs:i4().int().nonnegative().default(300)}),ow=n_(["debug","info","notice","warning","error","critical","alert","emergency"]),ok=n9.extend({level:ow}),ox=n6.extend({method:nS("logging/setLevel"),params:ok}),oR=n5.extend({level:ow,logger:iC().optional(),data:na()}),oP=n3.extend({method:nS("notifications/message"),params:oR}),oE=nl({name:iC().optional()}),oj=nl({hints:ns(oE).optional(),costPriority:i4().min(0).max(1).optional(),speedPriority:i4().min(0).max(1).optional(),intelligencePriority:i4().min(0).max(1).optional()}),oT=nl({mode:n_(["auto","required","none"]).optional()}),oO=nl({type:nS("tool_result"),toolUseId:iC().describe("The unique identifier for the corresponding tool call."),content:ns(ol),structuredContent:na().optional(),isError:i8().optional(),_meta:ny(iC(),na()).optional()}),oC=nm("type",[or,oa,oi]),oI=nm("type",[or,oa,oi,on,oO]),oN=nl({role:sz,content:nd([oI,ns(oI)]),_meta:ny(iC(),na()).optional()}),oq=n4.extend({messages:ns(oN),modelPreferences:oj.optional(),systemPrompt:iC().optional(),includeContext:n_(["none","thisServer","allServers"]).optional(),temperature:i4().optional(),maxTokens:i4().int(),stopSequences:ns(iC()).optional(),metadata:nG.optional(),tools:ns(oh).optional(),toolChoice:oT.optional()}),oA=n6.extend({method:nS("sampling/createMessage"),params:oq}),oz=n7.extend({model:iC(),stopReason:nx(n_(["endTurn","stopSequence","maxTokens"]).or(iC())),role:sz,content:oC}),oM=n7.extend({model:iC(),stopReason:nx(n_(["endTurn","stopSequence","maxTokens","toolUse"]).or(iC())),role:sz,content:nd([oI,ns(oI)])}),oL=nl({type:nS("boolean"),title:iC().optional(),description:iC().optional(),default:i8().optional()}),oZ=nl({type:nS("string"),title:iC().optional(),description:iC().optional(),minLength:i4().optional(),maxLength:i4().optional(),format:n_(["email","uri","date","date-time"]).optional(),default:iC().optional()}),oD=nl({type:n_(["number","integer"]),title:iC().optional(),description:iC().optional(),minimum:i4().optional(),maximum:i4().optional(),default:i4().optional()}),oV=nl({type:nS("string"),title:iC().optional(),description:iC().optional(),enum:ns(iC()),default:iC().optional()}),oF=nl({type:nS("string"),title:iC().optional(),description:iC().optional(),oneOf:ns(nl({const:iC(),title:iC()})),default:iC().optional()}),oU=nl({type:nS("string"),title:iC().optional(),description:iC().optional(),enum:ns(iC()),enumNames:ns(iC()).optional(),default:iC().optional()}),oH=nd([oV,oF]),oJ=nl({type:nS("array"),title:iC().optional(),description:iC().optional(),minItems:i4().optional(),maxItems:i4().optional(),items:nl({type:nS("string"),enum:ns(iC())}),default:ns(iC()).optional()}),oB=nl({type:nS("array"),title:iC().optional(),description:iC().optional(),minItems:i4().optional(),maxItems:i4().optional(),items:nl({anyOf:ns(nl({const:iC(),title:iC()}))}),default:ns(iC()).optional()}),oK=nd([oJ,oB]),oW=nd([oU,oH,oK]),oG=nd([oW,oL,oZ,oD]),oY=n4.extend({mode:nS("form").optional(),message:iC(),requestedSchema:nl({type:nS("object"),properties:ny(iC(),oG),required:ns(iC()).optional()}).catchall(na())}),oQ=n4.extend({mode:nS("url"),message:iC(),elicitationId:iC(),url:iC().url()}),oX=nd([oY,oQ]),o0=n6.extend({method:nS("elicitation/create"),params:oX}),o1=n5.extend({elicitationId:iC()}),o2=n3.extend({method:nS("notifications/elicitation/complete"),params:o1}),o9=n7.extend({action:n_(["accept","decline","cancel"]),content:nZ(e=>null===e?void 0:e,ny(iC(),nd([iC(),i4(),i8(),ns(iC())])).optional())}),o4=nl({type:nS("ref/resource"),uri:iC()}),o6=nl({type:nS("ref/prompt"),name:iC()}),o5=n9.extend({ref:nd([o6,o4]),argument:nl({name:iC(),value:iC()}),context:nl({arguments:ny(iC(),iC()).optional()}).optional()}),o3=n6.extend({method:nS("completion/complete"),params:o5}),o8=n7.extend({completion:nc({values:ns(iC()).max(100),total:nx(i4().int()),hasMore:nx(i8())})}),o7=nl({uri:iC().startsWith("file://"),name:iC().optional(),_meta:ny(iC(),na()).optional()}),le=n6.extend({method:nS("roots/list"),params:n9.optional()}),lt=n7.extend({roots:ns(o7)}),lr=n3.extend({method:nS("notifications/roots/list_changed"),params:n5.optional()}),la=nc({ttl:i4().optional(),pollInterval:i4().optional()}),li=n_(["working","input_required","completed","failed","cancelled"]),ln=nl({taskId:iC(),status:li,ttl:nd([i4(),ne()]),createdAt:iC(),lastUpdatedAt:iC(),pollInterval:nx(i4()),statusMessage:nx(iC())}),ls=n7.extend({task:ln}),lo=n5.merge(ln),ll=n3.extend({method:nS("notifications/tasks/status"),params:lo}),lc=n6.extend({method:nS("tasks/get"),params:n9.extend({taskId:iC()})}),lu=n7.merge(ln),ld=n6.extend({method:nS("tasks/result"),params:n9.extend({taskId:iC()})}),lp=n7.loose(),lm=sO.extend({method:nS("tasks/list")}),lh=sC.extend({tasks:ns(ln)}),lf=n6.extend({method:nS("tasks/cancel"),params:n9.extend({taskId:iC()})}),lg=n7.merge(ln),ly=nd([sR,sb,sk,o3,ox,ot,s8,sD,sF,sJ,sW,sG,sX,ob,of]),lv=nd([sc,sj,sw,lr]),l_=nd([so,oz,oM,o9,lt]),lb=nd([sR,oA,o0,le]),lS=nd([sc,sj,oP,s6,sK,oS,od,s1,o2]),l$=nd([so,s$,sx,o8,ou,s7,sV,sU,sB,oy,og,s9]);z||(z={});let lw=r5(iD,void 0).superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:"custom",message:"URL must be parseable",fatal:!0}),eF}).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"}),lk=nc({resource:iC().url(),authorization_servers:ns(lw).optional(),jwks_uri:iC().url().optional(),scopes_supported:ns(iC()).optional(),bearer_methods_supported:ns(iC()).optional(),resource_signing_alg_values_supported:ns(iC()).optional(),resource_name:iC().optional(),resource_documentation:iC().optional(),resource_policy_uri:iC().url().optional(),resource_tos_uri:iC().url().optional(),tls_client_certificate_bound_access_tokens:i8().optional(),authorization_details_types_supported:ns(iC()).optional(),dpop_signing_alg_values_supported:ns(iC()).optional(),dpop_bound_access_tokens_required:i8().optional()}),lx=nc({issuer:iC(),authorization_endpoint:lw,token_endpoint:lw,registration_endpoint:lw.optional(),scopes_supported:ns(iC()).optional(),response_types_supported:ns(iC()),response_modes_supported:ns(iC()).optional(),grant_types_supported:ns(iC()).optional(),token_endpoint_auth_methods_supported:ns(iC()).optional(),token_endpoint_auth_signing_alg_values_supported:ns(iC()).optional(),service_documentation:lw.optional(),revocation_endpoint:lw.optional(),revocation_endpoint_auth_methods_supported:ns(iC()).optional(),revocation_endpoint_auth_signing_alg_values_supported:ns(iC()).optional(),introspection_endpoint:iC().optional(),introspection_endpoint_auth_methods_supported:ns(iC()).optional(),introspection_endpoint_auth_signing_alg_values_supported:ns(iC()).optional(),code_challenge_methods_supported:ns(iC()).optional(),client_id_metadata_document_supported:i8().optional(),authorization_response_iss_parameter_supported:i8().optional().catch(void 0),dpop_signing_alg_values_supported:ns(iC()).optional()}),lR=nc({issuer:iC(),authorization_endpoint:lw,token_endpoint:lw,userinfo_endpoint:lw.optional(),jwks_uri:lw,registration_endpoint:lw.optional(),scopes_supported:ns(iC()).optional(),response_types_supported:ns(iC()),response_modes_supported:ns(iC()).optional(),grant_types_supported:ns(iC()).optional(),acr_values_supported:ns(iC()).optional(),subject_types_supported:ns(iC()),id_token_signing_alg_values_supported:ns(iC()),id_token_encryption_alg_values_supported:ns(iC()).optional(),id_token_encryption_enc_values_supported:ns(iC()).optional(),userinfo_signing_alg_values_supported:ns(iC()).optional(),userinfo_encryption_alg_values_supported:ns(iC()).optional(),userinfo_encryption_enc_values_supported:ns(iC()).optional(),request_object_signing_alg_values_supported:ns(iC()).optional(),request_object_encryption_alg_values_supported:ns(iC()).optional(),request_object_encryption_enc_values_supported:ns(iC()).optional(),token_endpoint_auth_methods_supported:ns(iC()).optional(),token_endpoint_auth_signing_alg_values_supported:ns(iC()).optional(),display_values_supported:ns(iC()).optional(),claim_types_supported:ns(iC()).optional(),claims_supported:ns(iC()).optional(),service_documentation:iC().optional(),claims_locales_supported:ns(iC()).optional(),ui_locales_supported:ns(iC()).optional(),claims_parameter_supported:i8().optional(),request_parameter_supported:i8().optional(),request_uri_parameter_supported:i8().optional(),require_request_uri_registration:i8().optional(),op_policy_uri:lw.optional(),op_tos_uri:lw.optional(),client_id_metadata_document_supported:i8().optional(),authorization_response_iss_parameter_supported:i8().optional().catch(void 0)}),lP=nl({...lR.shape,...lx.pick({code_challenge_methods_supported:!0}).shape}),lE=nl({access_token:iC(),id_token:iC().optional(),token_type:iC(),expires_in:new i9(r4({type:"number",coerce:!0,checks:[],...eS(void 0)})).optional(),scope:iC().optional(),refresh_token:iC().optional(),issuer:iC().optional().catch(void 0)}).strip(),lj=nl({issued_token_type:nS("urn:ietf:params:oauth:token-type:id-jag"),access_token:iC(),token_type:iC().optional(),expires_in:i4().optional(),scope:iC().optional()}).strip(),lT=nl({error:iC(),error_description:iC().optional(),error_uri:iC().optional()}),lO=lw.optional().or(nS("").transform(()=>void 0)),lC=nl({redirect_uris:ns(lw),token_endpoint_auth_method:iC().optional(),grant_types:ns(iC()).optional(),response_types:ns(iC()).optional(),application_type:iC().optional(),client_name:iC().optional(),client_uri:lw.optional(),logo_uri:lO,scope:iC().optional(),contacts:ns(iC()).optional(),tos_uri:lO,policy_uri:iC().optional(),jwks_uri:lw.optional(),jwks:new nt({type:"any"}).optional(),software_id:iC().optional(),software_version:iC().optional(),software_statement:iC().optional()}).strip(),lI=nl({client_id:iC(),client_secret:iC().optional(),client_id_issued_at:i4().optional(),client_secret_expires_at:i4().optional(),issuer:iC().optional().catch(void 0)}).strip(),lN=lC.merge(lI),lq=nl({error:iC(),error_description:iC().optional()}).strip(),lA=nl({token:iC(),token_type_hint:iC().optional()}).strip(),lz=Symbol.for("mcp.sdk.errorBrands");function lM(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,lz,{value:r,enumerable:!1,configurable:!0})}function lL(e,t){try{if("object"==typeof t&&null!==t&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&"string"==typeof e.mcpBrand&&Object.prototype.hasOwnProperty.call(t,lz)){let r=t[lz];if(r&&"function"==typeof r.has&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}(class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](e){return lL(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 lL(this,e)}constructor(e,t,r){super(t),this.code=e,this.errorUri=r,this.name="OAuthError",lM(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 lZ=((j={}).NotConnected="NOT_CONNECTED",j.AlreadyConnected="ALREADY_CONNECTED",j.NotInitialized="NOT_INITIALIZED",j.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",j.RequestTimeout="REQUEST_TIMEOUT",j.ConnectionClosed="CONNECTION_CLOSED",j.SendFailed="SEND_FAILED",j.InvalidResult="INVALID_RESULT",j.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",j.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",j.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",j.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",j.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",j.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",j.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",j.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",j.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",j.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",j.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",j);var lD=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return lL(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 lL(this,e)}constructor(e,t,r,a){super(t,a),this.code=e,this.data=r,this.name="SdkError",lM(this,new.target)}};function lV(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function lF(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(lV(i)&&lV(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}(class extends lD{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 lU="2026-07-28",lH=[lU];function lJ(e){return e.filter(e=>e>=lU)}function lB(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 lK=["task","inputRequests","requestState"];function lW(e){return null===e||"object"!=typeof e||Array.isArray(e)||void 0!==e.content||lK.some(t=>t in e)?e:{...e,content:[]}}function lG(){let e,t,r,a,i,n,s,o,l,u,d,p,m,h,f,g,y,v,_,b,S,$,w,k,x,R,P,E,j,T,O,C,I,N,q,A,z,M,L,Z,D,V,F,U,H,J,B,K,W,G,Y,Q,X,ee,et,er,ea,ei,en,es,eo,el,ec,eu,ed,ep,em,eh,ef,eg,ey,ev,e_,eb,eS,e$,ew,ek,ex,eR,eP,eE,ej,eT,eO,eC,eI,eN,eq,eA,ez,eM,eL,eZ,eD,eV,eF,eU,eH,eJ,eB,eK,eW,eG,eY,eQ,eX,e0,e1,e2,e9,e4,e6,e5,e3,e8,e7,te,tt,tr,ta,ti,tn,ts,to,tl,tc,tu,td,tp,tm,th,tf,tg,ty,tv,t_,tb,tS,t$;return c??=(e=nM(()=>nd([iC(),i4(),i8(),ne(),ny(iC(),e),ns(e)])),t=ny(iC(),e),r=nd([iC(),i4().int()]),a=iC(),i=nl({ttl:i4().optional()}),n=nl({taskId:iC()}),l=(o=nl({_meta:(s=nc({progressToken:r.optional(),"io.modelcontextprotocol/related-task":n.optional()})).optional()})).extend({task:i.optional()}),u=nl({method:iC(),params:o.loose().optional()}),d=nl({_meta:s.optional()}),p=nl({method:iC(),params:d.loose().optional()}),m=nc({_meta:s.optional()}),h=nd([iC(),i4().int()]),f=m.strict(),g=d.extend({requestId:h.optional(),reason:iC().optional()}),y=p.extend({method:nS("notifications/cancelled"),params:g}),v=nl({src:iC(),mimeType:iC().optional(),sizes:ns(iC()).optional(),theme:n_(["light","dark"]).optional()}),_=nl({icons:ns(v).optional()}),S=(b=nl({name:iC(),title:iC().optional()})).extend({...b.shape,..._.shape,version:iC(),websiteUrl:iC().optional(),description:iC().optional()}),$=nf(nl({applyDefaults:i8().optional()}),t),w=nZ(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,nf(nl({form:$.optional(),url:t.optional()}),t.optional())),k=nc({list:t.optional(),cancel:t.optional(),requests:nc({sampling:nc({createMessage:t.optional()}).optional(),elicitation:nc({create:t.optional()}).optional()}).optional()}),x=nc({list:t.optional(),cancel:t.optional(),requests:nc({tools:nc({call:t.optional()}).optional()}).optional()}),R=nl({experimental:ny(iC(),t).optional(),sampling:nl({context:t.optional(),tools:t.optional()}).optional(),elicitation:w.optional(),roots:nl({listChanged:i8().optional()}).optional(),tasks:k.optional(),extensions:ny(iC(),t).optional()}),P=o.extend({protocolVersion:iC(),capabilities:R,clientInfo:S}),E=u.extend({method:nS("initialize"),params:P}),j=nl({experimental:ny(iC(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:nl({listChanged:i8().optional()}).optional(),resources:nl({subscribe:i8().optional(),listChanged:i8().optional()}).optional(),tools:nl({listChanged:i8().optional()}).optional(),tasks:x.optional(),extensions:ny(iC(),t).optional()}),T=m.extend({protocolVersion:iC(),capabilities:j,serverInfo:S,instructions:iC().optional()}),O=p.extend({method:nS("notifications/initialized"),params:d.optional()}),C=u.extend({method:nS("ping"),params:o.optional()}),I=nl({progress:i4(),total:nx(i4()),message:nx(iC())}),N=nl({...d.shape,...I.shape,progressToken:r}),q=p.extend({method:nS("notifications/progress"),params:N}),A=o.extend({cursor:a.optional()}),z=u.extend({params:A.optional()}),M=m.extend({nextCursor:a.optional()}),Z=(L=nl({uri:iC(),mimeType:nx(iC()),_meta:ny(iC(),na()).optional()})).extend({text:iC()}),D=iC().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),V=L.extend({blob:D}),U=nl({audience:ns(F=n_(["user","assistant"])).optional(),priority:i4().min(0).max(1).optional(),lastModified:r3(iN,{offset:!0}).optional()}),H=nl({...b.shape,..._.shape,uri:iC(),description:nx(iC()),mimeType:nx(iC()),size:nx(i4()),annotations:U.optional(),_meta:nx(nc({}))}),J=nl({...b.shape,..._.shape,uriTemplate:iC(),description:nx(iC()),mimeType:nx(iC()),annotations:U.optional(),_meta:nx(nc({}))}),B=z.extend({method:nS("resources/list")}),K=M.extend({resources:ns(H)}),W=z.extend({method:nS("resources/templates/list")}),G=M.extend({resourceTemplates:ns(J)}),Y=o.extend({uri:iC()}),Q=u.extend({method:nS("resources/read"),params:Y}),X=m.extend({contents:ns(nd([Z,V]))}),ee=p.extend({method:nS("notifications/resources/list_changed"),params:d.optional()}),et=u.extend({method:nS("resources/subscribe"),params:Y}),er=u.extend({method:nS("resources/unsubscribe"),params:Y}),ea=d.extend({uri:iC()}),ei=p.extend({method:nS("notifications/resources/updated"),params:ea}),en=nl({name:iC(),description:nx(iC()),required:nx(i8())}),es=nl({...b.shape,..._.shape,description:nx(iC()),arguments:nx(ns(en)),_meta:nx(nc({}))}),eo=z.extend({method:nS("prompts/list")}),el=M.extend({prompts:ns(es)}),ec=o.extend({name:iC(),arguments:ny(iC(),iC()).optional()}),eu=u.extend({method:nS("prompts/get"),params:ec}),ed=nl({type:nS("text"),text:iC(),annotations:U.optional(),_meta:ny(iC(),na()).optional()}),ep=nl({type:nS("image"),data:D,mimeType:iC(),annotations:U.optional(),_meta:ny(iC(),na()).optional()}),em=nl({type:nS("audio"),data:D,mimeType:iC(),annotations:U.optional(),_meta:ny(iC(),na()).optional()}),eh=nl({type:nS("tool_use"),name:iC(),id:iC(),input:ny(iC(),na()),_meta:ny(iC(),na()).optional()}),ef=nl({type:nS("resource"),resource:nd([Z,V]),annotations:U.optional(),_meta:ny(iC(),na()).optional()}),ev=nl({role:F,content:ey=nd([ed,ep,em,eg=H.extend({type:nS("resource_link")}),ef])}),e_=m.extend({description:iC().optional(),messages:ns(ev)}),eb=p.extend({method:nS("notifications/prompts/list_changed"),params:d.optional()}),eS=nl({title:iC().optional(),readOnlyHint:i8().optional(),destructiveHint:i8().optional(),idempotentHint:i8().optional(),openWorldHint:i8().optional()}),e$=nl({taskSupport:n_(["required","optional","forbidden"]).optional()}),ew=nl({...b.shape,..._.shape,description:iC().optional(),inputSchema:nl({type:nS("object"),properties:ny(iC(),e).optional(),required:ns(iC()).optional()}).catchall(na()),outputSchema:nl({type:nS("object"),properties:ny(iC(),e).optional(),required:ns(iC()).optional()}).catchall(na()).optional(),annotations:eS.optional(),execution:e$.optional(),_meta:ny(iC(),na()).optional()}),ek=z.extend({method:nS("tools/list")}),ex=M.extend({tools:ns(ew)}),eR=m.extend({content:ns(ey),structuredContent:ny(iC(),na()).optional(),isError:i8().optional()}),eP=l.extend({name:iC(),arguments:ny(iC(),na()).optional()}),eE=u.extend({method:nS("tools/call"),params:eP}),ej=p.extend({method:nS("notifications/tools/list_changed"),params:d.optional()}),eT=n_(["debug","info","notice","warning","error","critical","alert","emergency"]),eO=o.extend({level:eT}),eC=u.extend({method:nS("logging/setLevel"),params:eO}),eI=d.extend({level:eT,logger:iC().optional(),data:na()}),eN=p.extend({method:nS("notifications/message"),params:eI}),eq=nl({name:iC().optional()}),eA=nl({hints:ns(eq).optional(),costPriority:i4().min(0).max(1).optional(),speedPriority:i4().min(0).max(1).optional(),intelligencePriority:i4().min(0).max(1).optional()}),ez=nl({mode:n_(["auto","required","none"]).optional()}),eM=nl({type:nS("tool_result"),toolUseId:iC().describe("The unique identifier for the corresponding tool call."),content:ns(ey),structuredContent:nl({}).loose().optional(),isError:i8().optional(),_meta:ny(iC(),na()).optional()}),eL=nm("type",[ed,ep,em]),eD=nl({role:F,content:nd([eZ=nm("type",[ed,ep,em,eh,eM]),ns(eZ)]),_meta:ny(iC(),na()).optional()}),eV=l.extend({messages:ns(eD),modelPreferences:eA.optional(),systemPrompt:iC().optional(),includeContext:n_(["none","thisServer","allServers"]).optional(),temperature:i4().optional(),maxTokens:i4().int(),stopSequences:ns(iC()).optional(),metadata:t.optional(),tools:ns(ew).optional(),toolChoice:ez.optional()}),eF=u.extend({method:nS("sampling/createMessage"),params:eV}),eU=m.extend({model:iC(),stopReason:nx(n_(["endTurn","stopSequence","maxTokens"]).or(iC())),role:F,content:eL}),eH=m.extend({model:iC(),stopReason:nx(n_(["endTurn","stopSequence","maxTokens","toolUse"]).or(iC())),role:F,content:nd([eZ,ns(eZ)])}),eJ=nl({type:nS("boolean"),title:iC().optional(),description:iC().optional(),default:i8().optional()}),eB=nl({type:nS("string"),title:iC().optional(),description:iC().optional(),minLength:i4().optional(),maxLength:i4().optional(),format:n_(["email","uri","date","date-time"]).optional(),default:iC().optional()}),eK=nl({type:n_(["number","integer"]),title:iC().optional(),description:iC().optional(),minimum:i4().optional(),maximum:i4().optional(),default:i4().optional()}),eW=nl({type:nS("string"),title:iC().optional(),description:iC().optional(),enum:ns(iC()),default:iC().optional()}),eG=nl({type:nS("string"),title:iC().optional(),description:iC().optional(),oneOf:ns(nl({const:iC(),title:iC()})),default:iC().optional()}),eY=nl({type:nS("string"),title:iC().optional(),description:iC().optional(),enum:ns(iC()),enumNames:ns(iC()).optional(),default:iC().optional()}),eQ=nd([eW,eG]),e1=nd([eX=nl({type:nS("array"),title:iC().optional(),description:iC().optional(),minItems:i4().optional(),maxItems:i4().optional(),items:nl({type:nS("string"),enum:ns(iC())}),default:ns(iC()).optional()}),e0=nl({type:nS("array"),title:iC().optional(),description:iC().optional(),minItems:i4().optional(),maxItems:i4().optional(),items:nl({anyOf:ns(nl({const:iC(),title:iC()}))}),default:ns(iC()).optional()})]),e2=nd([eY,eQ,e1]),e9=nd([e2,eJ,eB,eK]),e5=nd([e4=l.extend({mode:nS("form").optional(),message:iC(),requestedSchema:nl({type:nS("object"),properties:ny(iC(),e9),required:ns(iC()).optional()}).catchall(na())}),e6=l.extend({mode:nS("url"),message:iC(),elicitationId:iC(),url:iC().url()})]),e3=u.extend({method:nS("elicitation/create"),params:e5}),e8=d.extend({elicitationId:iC()}),e7=p.extend({method:nS("notifications/elicitation/complete"),params:e8}),te=m.extend({action:n_(["accept","decline","cancel"]),content:nZ(e=>null===e?void 0:e,ny(iC(),nd([iC(),i4(),i8(),ns(iC())])).optional())}),tt=nl({type:nS("ref/resource"),uri:iC()}),tr=nl({type:nS("ref/prompt"),name:iC()}),ta=o.extend({ref:nd([tr,tt]),argument:nl({name:iC(),value:iC()}),context:nl({arguments:ny(iC(),iC()).optional()}).optional()}),ti=u.extend({method:nS("completion/complete"),params:ta}),tn=m.extend({completion:nc({values:ns(iC()).max(100),total:nx(i4().int()),hasMore:nx(i8())})}),ts=nl({uri:iC().startsWith("file://"),name:iC().optional(),_meta:ny(iC(),na()).optional()}),to=u.extend({method:nS("roots/list"),params:o.optional()}),tl=m.extend({roots:ns(ts)}),tc=p.extend({method:nS("notifications/roots/list_changed"),params:d.optional()}),tu=nc({ttl:i4().optional(),pollInterval:i4().optional()}),td=n_(["working","input_required","completed","failed","cancelled"]),tp=nl({taskId:iC(),status:td,ttl:nd([i4(),ne()]),createdAt:iC(),lastUpdatedAt:iC(),pollInterval:nx(i4()),statusMessage:nx(iC())}),tm=m.extend({task:tp}),th=d.merge(tp),tf=p.extend({method:nS("notifications/tasks/status"),params:th}),tg=u.extend({method:nS("tasks/get"),params:o.extend({taskId:iC()})}),ty=m.merge(tp),tv=u.extend({method:nS("tasks/result"),params:o.extend({taskId:iC()})}),t_=m.loose(),tb=z.extend({method:nS("tasks/list")}),tS=M.extend({tasks:ns(tp)}),t$=u.extend({method:nS("tasks/cancel"),params:o.extend({taskId:iC()})}),{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:a,TaskMetadataSchema:i,RelatedTaskMetadataSchema:n,RequestMetaSchema:s,BaseRequestParamsSchema:o,TaskAugmentedRequestParamsSchema:l,RequestSchema:u,NotificationsParamsSchema:d,NotificationSchema:p,ResultSchema:m,RequestIdSchema:h,EmptyResultSchema:f,CancelledNotificationParamsSchema:g,CancelledNotificationSchema:y,IconSchema:v,IconsSchema:_,BaseMetadataSchema:b,ImplementationSchema:S,ClientTasksCapabilitySchema:k,ServerTasksCapabilitySchema:x,ClientCapabilitiesSchema:R,InitializeRequestParamsSchema:P,InitializeRequestSchema:E,ServerCapabilitiesSchema:j,InitializeResultSchema:T,InitializedNotificationSchema:O,PingRequestSchema:C,ProgressSchema:I,ProgressNotificationParamsSchema:N,ProgressNotificationSchema:q,PaginatedRequestParamsSchema:A,PaginatedRequestSchema:z,PaginatedResultSchema:M,ResourceContentsSchema:L,TextResourceContentsSchema:Z,BlobResourceContentsSchema:V,RoleSchema:F,AnnotationsSchema:U,ResourceSchema:H,ResourceTemplateSchema:J,ListResourcesRequestSchema:B,ListResourcesResultSchema:K,ListResourceTemplatesRequestSchema:W,ListResourceTemplatesResultSchema:G,ResourceRequestParamsSchema:Y,ReadResourceRequestParamsSchema:Y,ReadResourceRequestSchema:Q,ReadResourceResultSchema:X,ResourceListChangedNotificationSchema:ee,SubscribeRequestParamsSchema:Y,SubscribeRequestSchema:et,UnsubscribeRequestParamsSchema:Y,UnsubscribeRequestSchema:er,ResourceUpdatedNotificationParamsSchema:ea,ResourceUpdatedNotificationSchema:ei,PromptArgumentSchema:en,PromptSchema:es,ListPromptsRequestSchema:eo,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:ek,ListToolsResultSchema:ex,CallToolResultSchema:eR,CallToolRequestParamsSchema:eP,CallToolRequestSchema:eE,ToolListChangedNotificationSchema:ej,LoggingLevelSchema:eT,SetLevelRequestParamsSchema:eO,SetLevelRequestSchema:eC,LoggingMessageNotificationParamsSchema:eI,LoggingMessageNotificationSchema:eN,ModelHintSchema:eq,ModelPreferencesSchema:eA,ToolChoiceSchema:ez,ToolResultContentSchema:eM,SamplingContentSchema:eL,SamplingMessageContentBlockSchema:eZ,SamplingMessageSchema:eD,CreateMessageRequestParamsSchema:eV,CreateMessageRequestSchema:eF,CreateMessageResultSchema:eU,CreateMessageResultWithToolsSchema:eH,BooleanSchemaSchema:eJ,StringSchemaSchema:eB,NumberSchemaSchema:eK,UntitledSingleSelectEnumSchemaSchema:eW,TitledSingleSelectEnumSchemaSchema:eG,LegacyTitledEnumSchemaSchema:eY,SingleSelectEnumSchemaSchema:eQ,UntitledMultiSelectEnumSchemaSchema:eX,TitledMultiSelectEnumSchemaSchema:e0,MultiSelectEnumSchemaSchema:e1,EnumSchemaSchema:e2,PrimitiveSchemaDefinitionSchema:e9,ElicitRequestFormParamsSchema:e4,ElicitRequestURLParamsSchema:e6,ElicitRequestParamsSchema:e5,ElicitRequestSchema:e3,ElicitationCompleteNotificationParamsSchema:e8,ElicitationCompleteNotificationSchema:e7,ElicitResultSchema:te,ResourceTemplateReferenceSchema:tt,PromptReferenceSchema:tr,CompleteRequestParamsSchema:ta,CompleteRequestSchema:ti,CompleteResultSchema:tn,RootSchema:ts,ListRootsRequestSchema:to,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:nd([C,E,ti,eC,eu,eo,B,W,Q,et,er,eE,ek,tg,tv,tb,t$]),ClientNotificationSchema:nd([y,q,O,tc,tf]),ClientResultSchema:nd([f,eU,eH,te,tl,ty,tS,tm]),ServerRequestSchema:nd([C,eF,e3,to,tg,tv,tb,t$]),ServerNotificationSchema:nd([y,q,eN,ei,ee,ej,eb,tf,e7]),ServerResultSchema:nd([f,T,tn,e_,el,K,G,X,eR,ex,ty,tS,tm]),CallToolResultWireSchema:na().superRefine((e,t)=>{if(!("object"!=typeof e||null===e||Array.isArray(e))&&void 0===e.content){for(let r of lK)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(lW).pipe(eR)})}function lY(e){return"object"!==e.type}let lQ=new Set(["const","enum","default","examples"]),lX=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function l0(e){return void 0!==e&&!("string"==typeof e&&e.startsWith("#"))}let l1={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},l2={"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},l9={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 l4(){if(u)return u;let e=lG();return u={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 l6(e){return Object.prototype.hasOwnProperty.call(l1,e)}function l5(e){return Object.prototype.hasOwnProperty.call(l2,e)}function l3(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function l8(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(l1),Object.keys(l2);let l7={ok:!1,reason:"not-in-era"};function ce(e){return l3(e)&&l3(e.outputSchema)&&lY(e.outputSchema)}let ct={era:"2025-11-25",hasRequestMethod:l6,hasNotificationMethod:l5,validateRequest:(e,t)=>l8(l6(e)?l4().requestSchemas[e]:void 0,t),validateResult:(e,t)=>l8(Object.prototype.hasOwnProperty.call(l9,e)?l4().resultSchemas[e]:void 0,t),validateNotification:(e,t)=>l8(l5(e)?l4().notificationSchemas[e]:void 0,t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>l7,validateInputResponse:()=>l7,samplingResultVariant:(e,t)=>{let r=lG();return l8(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)},outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let r=lB(e),a=r.structuredContent;if(void 0===a)return r;let i="object"!=typeof a||null===a||Array.isArray(a),n=void 0!==t&&lY(t);return i||n?{...r,structuredContent:{result:a}}:r},decodeResult(e,t){if(l3(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=>ce(e))?{...t,tools:r.map(e=>ce(e)?{...e,outputSchema:function(e){var t;let r="string"==typeof e.$schema?e.$schema:void 0;if(l0(e.$id))return{...void 0!==r&&{$schema:r},type:"object",properties:{result:e},required:["result"]};let a="string"==typeof(t=e.$schema)&&G.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&&l0(e.$id))return e;let r={},n=!1;for(let[s,o]of Object.entries(e))t?r[s]=i(o,!1):("$ref"===s||"$dynamicRef"===s)&&"string"==typeof o?r[s]="#"===o?"#/properties/result":o.startsWith("#/")?`#/properties/result${o.slice(1)}`:o:"$recursiveRef"===s&&"#"===o&&a?n=!0:lQ.has(s)?r[s]=o:lX.has(s)?r[s]=i(o,!0):r[s]=i(o,!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 cr(){return d??=function(){let e=nM(()=>nd([iC(),i4(),i8(),ne(),ny(iC(),e),ns(e)])),t=ny(iC(),e),r=nd([iC(),i4().int()]),a=iC(),i=nd([iC(),i4().int()]),n=n_(["user","assistant"]),s=n_(["debug","info","notice","warning","error","critical","alert","emergency"]),o=iC().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),l=nl({ttl:i4().optional()}),c=nl({taskId:iC()}),u=nc({progressToken:r.optional(),"io.modelcontextprotocol/related-task":c.optional()}),d=nl({_meta:u.optional()}),p=d.extend({task:l.optional()}),m=nl({_meta:u.optional()}),h=nl({method:iC(),params:m.loose().optional()}),f=nl({src:iC(),mimeType:iC().optional(),sizes:ns(iC()).optional(),theme:n_(["light","dark"]).optional()}),g=nl({icons:ns(f).optional()}),y=nl({name:iC(),title:iC().optional()}),v=y.extend({...y.shape,...g.shape,version:iC(),websiteUrl:iC().optional(),description:iC().optional()}),_=nf(nl({applyDefaults:i8().optional()}),t),b=nZ(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,nf(nl({form:_.optional(),url:t.optional()}),t.optional())),S=nc({list:t.optional(),cancel:t.optional(),requests:nc({sampling:nc({createMessage:t.optional()}).optional(),elicitation:nc({create:t.optional()}).optional()}).optional()}),$=nc({list:t.optional(),cancel:t.optional(),requests:nc({tools:nc({call:t.optional()}).optional()}).optional()}),w=nl({experimental:ny(iC(),t).optional(),sampling:nl({context:t.optional(),tools:t.optional()}).optional(),elicitation:b.optional(),roots:nl({listChanged:i8().optional()}).optional(),tasks:S.optional(),extensions:ny(iC(),t).optional()}),k=nl({experimental:ny(iC(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:nl({listChanged:i8().optional()}).optional(),resources:nl({subscribe:i8().optional(),listChanged:i8().optional()}).optional(),tools:nl({listChanged:i8().optional()}).optional(),tasks:$.optional(),extensions:ny(iC(),t).optional()}),x=nl({progress:i4(),total:nx(i4()),message:nx(iC())}),R=nl({...m.shape,...x.shape,progressToken:r}),P=h.extend({method:nS("notifications/progress"),params:R}),E=m.extend({level:s,logger:iC().optional(),data:na()}),j=h.extend({method:nS("notifications/message"),params:E}),T=nl({uri:iC(),mimeType:nx(iC()),_meta:ny(iC(),na()).optional()}),O=T.extend({text:iC()}),C=T.extend({blob:o}),I=nl({audience:ns(n).optional(),priority:i4().min(0).max(1).optional(),lastModified:r3(iN,{offset:!0}).optional()}),N=nl({...y.shape,...g.shape,uri:iC(),description:nx(iC()),mimeType:nx(iC()),size:nx(i4()),annotations:I.optional(),_meta:nx(nc({}))}),q=nl({...y.shape,...g.shape,uriTemplate:iC(),description:nx(iC()),mimeType:nx(iC()),annotations:I.optional(),_meta:nx(nc({}))}),A=h.extend({method:nS("notifications/resources/list_changed"),params:m.optional()}),z=m.extend({uri:iC()}),M=h.extend({method:nS("notifications/resources/updated"),params:z}),L=nl({name:iC(),description:nx(iC()),required:nx(i8())}),Z=nl({...y.shape,...g.shape,description:nx(iC()),arguments:nx(ns(L)),_meta:nx(nc({}))}),D=h.extend({method:nS("notifications/prompts/list_changed"),params:m.optional()}),V=nl({type:nS("text"),text:iC(),annotations:I.optional(),_meta:ny(iC(),na()).optional()}),F=nl({type:nS("image"),data:o,mimeType:iC(),annotations:I.optional(),_meta:ny(iC(),na()).optional()}),U=nl({type:nS("audio"),data:o,mimeType:iC(),annotations:I.optional(),_meta:ny(iC(),na()).optional()}),H=nl({type:nS("tool_use"),name:iC(),id:iC(),input:ny(iC(),na()),_meta:ny(iC(),na()).optional()}),J=nl({type:nS("resource"),resource:nd([O,C]),annotations:I.optional(),_meta:ny(iC(),na()).optional()}),B=N.extend({type:nS("resource_link")}),K=nd([V,F,U,B,J]),W=nl({role:n,content:K}),G=nl({title:iC().optional(),readOnlyHint:i8().optional(),destructiveHint:i8().optional(),idempotentHint:i8().optional(),openWorldHint:i8().optional()}),Y=h.extend({method:nS("notifications/tools/list_changed"),params:m.optional()}),Q=nl({name:iC().optional()}),X=nl({hints:ns(Q).optional(),costPriority:i4().min(0).max(1).optional(),speedPriority:i4().min(0).max(1).optional(),intelligencePriority:i4().min(0).max(1).optional()}),ee=nl({mode:n_(["auto","required","none"]).optional()}),et=nl({type:nS("boolean"),title:iC().optional(),description:iC().optional(),default:i8().optional()}),er=nl({type:nS("string"),title:iC().optional(),description:iC().optional(),minLength:i4().optional(),maxLength:i4().optional(),format:n_(["email","uri","date","date-time"]).optional(),default:iC().optional()}),ea=nl({type:n_(["number","integer"]),title:iC().optional(),description:iC().optional(),minimum:i4().optional(),maximum:i4().optional(),default:i4().optional()}),ei=nl({type:nS("string"),title:iC().optional(),description:iC().optional(),enum:ns(iC()),default:iC().optional()}),en=nl({type:nS("string"),title:iC().optional(),description:iC().optional(),oneOf:ns(nl({const:iC(),title:iC()})),default:iC().optional()}),es=nl({type:nS("string"),title:iC().optional(),description:iC().optional(),enum:ns(iC()),enumNames:ns(iC()).optional(),default:iC().optional()}),eo=nd([ei,en]),el=nl({type:nS("array"),title:iC().optional(),description:iC().optional(),minItems:i4().optional(),maxItems:i4().optional(),items:nl({type:nS("string"),enum:ns(iC())}),default:ns(iC()).optional()}),ec=nl({type:nS("array"),title:iC().optional(),description:iC().optional(),minItems:i4().optional(),maxItems:i4().optional(),items:nl({anyOf:ns(nl({const:iC(),title:iC()}))}),default:ns(iC()).optional()}),eu=nd([el,ec]),ed=nd([es,eo,eu]),ep=nd([ed,et,er,ea]),em=p.extend({mode:nS("form").optional(),message:iC(),requestedSchema:nl({type:nS("object"),properties:ny(iC(),ep),required:ns(iC()).optional()}).catchall(na())}),eh=nl({type:nS("ref/resource"),uri:iC()}),ef=nl({type:nS("ref/prompt"),name:iC()}),eg=nl({uri:iC().startsWith("file://"),name:iC().optional(),_meta:ny(iC(),na()).optional()}),ey=w.shape,ev=nl({experimental:ey.experimental,sampling:ey.sampling,elicitation:ey.elicitation,roots:ey.roots,extensions:ey.extensions}),e_=k.shape,eb=nl({experimental:e_.experimental,logging:e_.logging,completions:e_.completions,prompts:e_.prompts,resources:e_.resources,tools:e_.tools,extensions:e_.extensions}),eS=nc({progressToken:r.optional(),[nF]:iC(),[nU]:v.optional(),[nJ]:ev,[nK]:s.optional()}),e$=nl({...y.shape,...g.shape,description:iC().optional(),inputSchema:nc({$schema:iC().optional(),type:nS("object")}),outputSchema:nc({$schema:iC().optional()}).optional(),annotations:G.optional(),_meta:ny(iC(),na()).optional()}),ew=nl({type:nS("tool_result"),toolUseId:iC(),content:ns(K),structuredContent:na().optional(),isError:i8().optional(),_meta:ny(iC(),na()).optional()}),ek=nd([V,F,U,H,ew]),ex=nl({role:n,content:nd([ek,ns(ek)]),_meta:ny(iC(),na()).optional()}),eR=iC(),eP=nc({[nH]:v.optional().catch(void 0)}),eE=eP.optional();function ej(e){return nc({_meta:eE,resultType:eR.default("complete"),...e})}let eT=ej({}),eO=ej({nextCursor:a.optional()}),eC=ej({content:ns(K),structuredContent:na().optional(),isError:i8().optional()}),eI=ej({ttlMs:i4().int().min(0),cacheScope:n_(["public","private"]),tools:ns(e$),nextCursor:a.optional()}),eN=ej({ttlMs:i4().int().min(0),cacheScope:n_(["public","private"]),prompts:ns(Z),nextCursor:a.optional()}),eq=ej({description:iC().optional(),messages:ns(W)}),eA=ej({ttlMs:i4().int().min(0),cacheScope:n_(["public","private"]),resources:ns(N),nextCursor:a.optional()}),ez=ej({ttlMs:i4().int().min(0),cacheScope:n_(["public","private"]),resourceTemplates:ns(q),nextCursor:a.optional()}),eM=ej({ttlMs:i4().int().min(0),cacheScope:n_(["public","private"]),contents:ns(nd([O,C]))}),eL=ej({completion:nl({values:ns(iC()).max(100),total:i4().int().optional(),hasMore:i8().optional()}).loose()}),eZ=ej({ttlMs:i4().int().min(0),cacheScope:n_(["public","private"])}),eD=ej({ttlMs:i4().int().min(0).catch(0),cacheScope:n_(["public","private"]).catch("private"),supportedVersions:ns(iC()),capabilities:eb,instructions:iC().optional()}),eV=nl({messages:ns(ex),modelPreferences:X.optional(),systemPrompt:iC().optional(),includeContext:n_(["none","thisServer","allServers"]).optional(),temperature:i4().optional(),maxTokens:i4().int(),stopSequences:ns(iC()).optional(),metadata:t.optional(),tools:ns(e$).optional(),toolChoice:ee.optional()}),eF=nl({method:nS("sampling/createMessage"),params:eV}),eU=nl({method:nS("roots/list"),params:nl({_meta:ny(iC(),na()).optional()}).optional()}),eH=nl({...ex.shape,model:iC(),stopReason:iC().optional()}),eJ=nl({roots:ns(eg)}),eB=nl({action:n_(["accept","decline","cancel"]),content:ny(iC(),nd([iC(),i4(),i8(),ns(iC())])).optional()}),eK=nl({mode:nS("url"),message:iC(),url:iC().url()}),eW=nd([em,eK]),eG=nl({method:nS("elicitation/create"),params:eW}),eY=nd([eF,eU,eG]),eQ=nd([eH,eJ,eB]),eX=ny(iC(),eY),e0=ny(iC(),eQ),e1=ej({inputRequests:eX.optional(),requestState:iC().optional()}),e2={inputResponses:e0.optional(),requestState:iC().optional()},e9=nl({_meta:eS,...e2}),e4=nc({progressToken:r.optional()});function e6(e,t){return nl({method:nS(e),params:nl({_meta:eS,...t})})}function e5(e,t){return nl({method:nS(e),params:nl({_meta:e4.optional(),...t}).optional()})}let e3={name:iC(),arguments:ny(iC(),na()).optional(),...e2},e8={cursor:a.optional()},e7=e6("tools/call",e3),te=e6("tools/list",e8),tt=e6("prompts/list",e8),tr=e6("prompts/get",{name:iC(),arguments:ny(iC(),iC()).optional(),...e2}),ta=e6("resources/list",e8),ti=e6("resources/templates/list",e8),tn=e6("resources/read",{uri:iC(),...e2}),ts={ref:nd([ef,eh]),argument:nl({name:iC(),value:iC()}),context:nl({arguments:ny(iC(),iC()).optional()}).optional()},to=e6("completion/complete",ts),tl=e6("server/discover",{}),tc=nl({toolsListChanged:i8().optional(),promptsListChanged:i8().optional(),resourcesListChanged:i8().optional(),resourceSubscriptions:ns(iC()).optional()}),tu={notifications:tc},td=e6("subscriptions/listen",tu),tp=eP.extend({"io.modelcontextprotocol/subscriptionId":i}),tm=nc({_meta:tp,resultType:eR.default("complete")}),th={"tools/call":e5("tools/call",e3),"tools/list":e5("tools/list",e8),"prompts/get":e5("prompts/get",{name:iC(),arguments:ny(iC(),iC()).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:iC()}),"completion/complete":e5("completion/complete",ts),"server/discover":e5("server/discover",{}),"subscriptions/listen":e5("subscriptions/listen",tu)};function tf(e){return nc({_meta:eE,...e})}let tg={"tools/call":tf({content:ns(K),structuredContent:na().optional(),isError:i8().optional()}),"tools/list":tf({ttlMs:i4().int().min(0),cacheScope:n_(["public","private"]),tools:ns(e$),nextCursor:a.optional()}),"prompts/get":tf({description:iC().optional(),messages:ns(W)}),"prompts/list":tf({ttlMs:i4().int().min(0),cacheScope:n_(["public","private"]),prompts:ns(Z),nextCursor:a.optional()}),"resources/list":tf({ttlMs:i4().int().min(0),cacheScope:n_(["public","private"]),resources:ns(N),nextCursor:a.optional()}),"resources/templates/list":tf({ttlMs:i4().int().min(0),cacheScope:n_(["public","private"]),resourceTemplates:ns(q),nextCursor:a.optional()}),"resources/read":tf({ttlMs:i4().int().min(0),cacheScope:n_(["public","private"]),contents:ns(nd([O,C]))}),"completion/complete":tf({completion:nl({values:ns(iC()).max(100),total:i4().int().optional(),hasMore:i8().optional()}).loose()}),"server/discover":tf({ttlMs:i4().int().min(0).catch(0),cacheScope:n_(["public","private"]).catch("private"),supportedVersions:ns(iC()),capabilities:eb,instructions:iC().optional()}),"subscriptions/listen":tf({})},ty=nc({"io.modelcontextprotocol/subscriptionId":i.optional()}),tv=nl({method:nS("notifications/subscriptions/acknowledged"),params:nl({_meta:ty.optional(),notifications:tc})}),t_=nl({_meta:ty.optional(),requestId:i,reason:iC().optional()}),tb=nl({method:nS("notifications/cancelled"),params:t_}),tS=e=>nl({jsonrpc:nS("2.0"),id:nd([iC(),i4().int()]),result:e}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:a,RequestIdSchema:i,RoleSchema:n,LoggingLevelSchema:s,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:k,ProgressSchema:x,ProgressNotificationParamsSchema:R,ProgressNotificationSchema:P,LoggingMessageNotificationParamsSchema:E,LoggingMessageNotificationSchema:j,ResourceContentsSchema:T,TextResourceContentsSchema:O,BlobResourceContentsSchema:C,AnnotationsSchema:I,ResourceSchema:N,ResourceTemplateSchema:q,ResourceListChangedNotificationSchema:A,ResourceUpdatedNotificationParamsSchema:z,ResourceUpdatedNotificationSchema:M,PromptArgumentSchema:L,PromptSchema:Z,PromptListChangedNotificationSchema:D,TextContentSchema:V,ImageContentSchema:F,AudioContentSchema:U,ToolUseContentSchema:H,EmbeddedResourceSchema:J,ResourceLinkSchema:B,ContentBlockSchema:K,PromptMessageSchema:W,ToolAnnotationsSchema:G,ToolListChangedNotificationSchema:Y,ModelHintSchema:Q,ModelPreferencesSchema:X,ToolChoiceSchema:ee,BooleanSchemaSchema:et,StringSchemaSchema:er,NumberSchemaSchema:ea,UntitledSingleSelectEnumSchemaSchema:ei,TitledSingleSelectEnumSchemaSchema:en,LegacyTitledEnumSchemaSchema:es,SingleSelectEnumSchemaSchema:eo,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:ek,SamplingMessageSchema:ex,ResultTypeSchema:eR,ResultMetaSchema:eP,ResultSchema:eT,PaginatedResultSchema:eO,CallToolResultSchema:eC,ListToolsResultSchema:eI,ListPromptsResultSchema:eN,GetPromptResultSchema:eq,ListResourcesResultSchema:eA,ListResourceTemplatesResultSchema:ez,ReadResourceResultSchema:eM,CompleteResultSchema:eL,CacheableResultSchema:eZ,DiscoverResultSchema:eD,CreateMessageRequestParamsSchema:eV,CreateMessageRequestSchema:eF,ListRootsRequestSchema:eU,CreateMessageResultSchema:eH,ListRootsResultSchema:eJ,ElicitResultSchema:eB,ElicitRequestURLParamsSchema:eK,ElicitRequestParamsSchema:eW,ElicitRequestSchema:eG,InputRequestSchema:eY,InputResponseSchema:eQ,InputRequestsSchema:eX,InputResponsesSchema:e0,InputRequiredResultSchema:e1,InputResponseRequestParamsSchema:e9,CallToolRequestSchema:e7,ListToolsRequestSchema:te,ListPromptsRequestSchema:tt,GetPromptRequestSchema:tr,ListResourcesRequestSchema:ta,ListResourceTemplatesRequestSchema:ti,ReadResourceRequestSchema:tn,CompleteRequestSchema:to,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":j,"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(eT),CallToolResultResponseSchema:tS(nd([eC,e1])),ListToolsResultResponseSchema:tS(eI),ListPromptsResultResponseSchema:tS(eN),GetPromptResultResponseSchema:tS(nd([eq,e1])),ListResourcesResultResponseSchema:tS(eA),ListResourceTemplatesResultResponseSchema:tS(ez),ReadResourceResultResponseSchema:tS(nd([eM,e1])),CompleteResultResponseSchema:tS(eL),DiscoverResultResponseSchema:tS(eD),SubscriptionsListenResultResponseSchema:tS(tm)}}()}let ca=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"],ci=Symbol("modelcontextprotocol.resultCacheHintFallback");function cn(e,t){if(void 0===t)return e;let r=e[ci];if(void 0===r)return{...e,[ci]: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,[ci]:a}}function cs(e){return"number"==typeof e&&Number.isSafeInteger(e)&&e>=0}function co(e){return"public"===e||"private"===e}function cl(e,t){if(void 0!==e.ttlMs&&!cs(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&&!co(e.cacheScope))throw RangeError(`Invalid cache hint for ${t}: cacheScope must be 'public' or 'private' (got ${String(e.cacheScope)})`)}let cc=((T={})[T.ParseError=-32700]="ParseError",T[T.InvalidRequest=-32600]="InvalidRequest",T[T.MethodNotFound=-32601]="MethodNotFound",T[T.InvalidParams=-32602]="InvalidParams",T[T.InternalError=-32603]="InternalError",T[T.ResourceNotFound=-32002]="ResourceNotFound",T[T.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",T[T.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",T[T.UrlElicitationRequired=-32042]="UrlElicitationRequired",T);var cu=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](e){return lL(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 lL(this,e)}constructor(e,t,r){super(t),this.code=e,this.data=r,this.name="ProtocolError",lM(this,new.target)}static fromError(t,r,a){return t===cc.UrlElicitationRequired&&a&&a.elicitations?new cp(a.elicitations,r):t===cc.UnsupportedProtocolVersion&&a&&Array.isArray(a.supported)&&"string"==typeof a.requested?new cm({supported:a.supported,requested:a.requested},r):(t===cc.InvalidParams||t===cc.ResourceNotFound)&&"string"==typeof a?.uri&&(t===cc.ResourceNotFound||1===Object.keys(a).length)?new cd(a.uri,r):t===cc.MissingRequiredClientCapability&&a&&null!==a.requiredCapabilities&&"object"==typeof a.requiredCapabilities&&!Array.isArray(a.requiredCapabilities)?new ch({requiredCapabilities:a.requiredCapabilities},r):new e(t,r,a)}},cd=class extends cu{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(cc.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},cp=class extends cu{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(cc.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},cm=class extends cu{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(cc.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},ch=class extends cu{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(cc.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}};let cf=["tools/call","prompts/get","resources/read"],cg=["elicitation/create","sampling/createMessage","roots/list"];function cy(){if(p)return p;let e=cr();return p={request:{"elicitation/create":nl({method:nS("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":nl({method:nS("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":nl({method:nS("roots/list"),params:nc({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}}}function cv(e){return cg.includes(e)}function c_(e){return cv(e)?cy().request[e]:void 0}let cb={"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},cS={"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 c$(e){return Object.prototype.hasOwnProperty.call(cb,e)}function cw(e){return Object.prototype.hasOwnProperty.call(cS,e)}function ck(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function cx(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(cb),Object.keys(cS);let cR={ok:!1,reason:"not-in-era"},cP=[nF,nJ],cE={era:"2026-07-28",hasRequestMethod:c$,hasNotificationMethod:cw,hasInputRequestMethod:e=>void 0!==c_(e),validateRequest:(e,t)=>cx(c$(e)?cr().dispatchRequestSchemas[e]:void 0,t),validateResult:(e,t)=>cx(Object.prototype.hasOwnProperty.call(cb,e)?cr().dispatchResultSchemas[e]:void 0,t),validateNotification:(e,t)=>cx(cw(e)?cr().notificationSchemas2026[e]:void 0,t),validateInputRequest:(e,t)=>cx(c_(e),t),validateInputResponse:(e,t)=>cx(cv(e)?cy().response[e]:void 0,t),samplingResultVariant:()=>cR,outboundEnvelope:e=>({[nF]:e.protocolVersion,[nU]:e.clientInfo,[nJ]:e.clientCapabilities,...void 0!==e.logLevel&&{[nK]:e.logLevel}}),validateEnvelopeMeta(e){let t=[];for(let r of cP)r in e||t.push({key:r,problem:"missing"});let r=cr().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=>lB(e),inputRequestSchema:c_,decodeResult(e,t){if(!ck(t))return{kind:"invalid",error:new lD(lZ.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let r=t.resultType;if(void 0===r)return{kind:"invalid",error:new lD(lZ.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 lD(lZ.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:r})};if("input_required"===r){let r=t.inputRequests,a=ck(r)?r:{},i=t.requestState,n=void 0===t._meta?void 0:cr().ResultMetaSchema.safeParse(t._meta),s=n?.success?n.data:void 0;return 0===Object.keys(a).length&&"string"!=typeof i?{kind:"invalid",error:new lD(lZ.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!==s&&{_meta:s}}}if("complete"!==r)return{kind:"invalid",error:new lD(lZ.UnsupportedResultType,`Unsupported result type '${r}' for ${e}`,{resultType:r,method:e})};let a=function(){if(m)return m;let e=cr();return m={"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 lD(lZ.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:{[nH]:t}}:null===r||"object"!=typeof r||Array.isArray(r)||void 0!==r[nH]?e:{...e,_meta:{...r,[nH]:t}}})(function(e,t){let r=t[ci];if("complete"!==t.resultType||!ca.includes(e)){let e;return void 0===r?t:(e={...t},delete e[ci],e)}let a=cs(t.ttlMs)?t.ttlMs:void 0!==r&&cs(r.ttlMs)?r.ttlMs:0,i=co(t.cacheScope)?t.cacheScope:void 0!==r&&co(r.cacheScope)?r.cacheScope:"private",n={...t,ttlMs:a,cacheScope:i};return delete n[ci],n}(e,function(e,t){let r=t.resultType;if(void 0===r)return{...t,resultType:"complete"};if("complete"===r||cf.includes(e))return t;throw new cu(cc.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=>ck(e)&&"execution"in e)&&(i().tools=n.map(e=>{if(!ck(e)||!("execution"in e))return e;let t={...e};return delete t.execution,t}));let s=t.capabilities;if(ck(s)&&"tasks"in s){let e={...s};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=cr().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("; ")}`}},cj="2026-07-28";function cT(e){return void 0!==e&&e>=lU?cE:ct}function cO(e){return void 0!==e.revision?cT(e.revision).era:"modern"===e.era?cE.era:ct.era}function cC(e){return cq.some(t=>t.hasRequestMethod(e))}function cI(e){return cq.some(t=>t.hasNotificationMethod(e))}function cN(e){return"tasks/get"===e||"tasks/cancel"===e}let cq=[ct,cE];function cA(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function cz(e){if(!cA(e))return;let t=e._meta;return cA(t)?t:void 0}function cM(e){let t=cz(e);return void 0!==t&&nF in t}function cL(e){let t=cz(e)?.[nF];return"string"==typeof t?t:void 0}function cZ(e){return cT(cj).validateEnvelopeMeta(e)}var cD=(e=>{let t={};for(var r in e)F(t,r,{get:e[r],enumerable:!0});return t})({AnnotationsSchema:()=>sM,AudioContentSchema:()=>oi,BaseMetadataSchema:()=>sp,BaseRequestParamsSchema:()=>n9,BlobResourceContentsSchema:()=>sA,BooleanSchemaSchema:()=>oL,CallToolRequestParamsSchema:()=>o_,CallToolRequestSchema:()=>ob,CallToolResultSchema:()=>oy,CancelTaskRequestSchema:()=>lf,CancelTaskResultSchema:()=>lg,CancelledNotificationParamsSchema:()=>sl,CancelledNotificationSchema:()=>sc,ClientCapabilitiesSchema:()=>sv,ClientNotificationSchema:()=>lv,ClientRequestSchema:()=>ly,ClientResultSchema:()=>l_,ClientTasksCapabilitySchema:()=>sg,CompatibilityCallToolResultSchema:()=>ov,CompleteRequestParamsSchema:()=>o5,CompleteRequestSchema:()=>o3,CompleteResultSchema:()=>o8,ContentBlockSchema:()=>ol,CreateMessageRequestParamsSchema:()=>oq,CreateMessageRequestSchema:()=>oA,CreateMessageResultSchema:()=>oz,CreateMessageResultWithToolsSchema:()=>oM,CreateTaskResultSchema:()=>ls,CursorSchema:()=>nX,DiscoverRequestSchema:()=>sk,DiscoverResultSchema:()=>sx,ElicitRequestFormParamsSchema:()=>oY,ElicitRequestParamsSchema:()=>oX,ElicitRequestSchema:()=>o0,ElicitRequestURLParamsSchema:()=>oQ,ElicitResultSchema:()=>o9,ElicitationCompleteNotificationParamsSchema:()=>o1,ElicitationCompleteNotificationSchema:()=>o2,EmbeddedResourceSchema:()=>os,EmptyResultSchema:()=>so,EnumSchemaSchema:()=>oW,GetPromptRequestParamsSchema:()=>oe,GetPromptRequestSchema:()=>ot,GetPromptResultSchema:()=>ou,GetTaskPayloadRequestSchema:()=>ld,GetTaskPayloadResultSchema:()=>lp,GetTaskRequestSchema:()=>lc,GetTaskResultSchema:()=>lu,IconSchema:()=>su,IconsSchema:()=>sd,ImageContentSchema:()=>oa,ImplementationSchema:()=>sm,InitializeRequestParamsSchema:()=>s_,InitializeRequestSchema:()=>sb,InitializeResultSchema:()=>s$,InitializedNotificationSchema:()=>sw,JSONArraySchema:()=>nY,JSONObjectSchema:()=>nG,JSONRPCErrorResponseSchema:()=>si,JSONRPCMessageSchema:()=>sn,JSONRPCNotificationSchema:()=>sr,JSONRPCRequestSchema:()=>st,JSONRPCResponseSchema:()=>ss,JSONRPCResultResponseSchema:()=>sa,JSONValueSchema:()=>nW,LegacyTitledEnumSchemaSchema:()=>oU,ListChangedOptionsBaseSchema:()=>o$,ListPromptsRequestSchema:()=>s8,ListPromptsResultSchema:()=>s7,ListResourceTemplatesRequestSchema:()=>sF,ListResourceTemplatesResultSchema:()=>sU,ListResourcesRequestSchema:()=>sD,ListResourcesResultSchema:()=>sV,ListRootsRequestSchema:()=>le,ListRootsResultSchema:()=>lt,ListTasksRequestSchema:()=>lm,ListTasksResultSchema:()=>lh,ListToolsRequestSchema:()=>of,ListToolsResultSchema:()=>og,LoggingLevelSchema:()=>ow,LoggingMessageNotificationParamsSchema:()=>oR,LoggingMessageNotificationSchema:()=>oP,ModelHintSchema:()=>oE,ModelPreferencesSchema:()=>oj,MultiSelectEnumSchemaSchema:()=>oK,NotificationSchema:()=>n3,NotificationsParamsSchema:()=>n5,NumberSchemaSchema:()=>oD,PaginatedRequestParamsSchema:()=>sT,PaginatedRequestSchema:()=>sO,PaginatedResultSchema:()=>sC,PingRequestSchema:()=>sR,PrimitiveSchemaDefinitionSchema:()=>oG,ProgressNotificationParamsSchema:()=>sE,ProgressNotificationSchema:()=>sj,ProgressSchema:()=>sP,ProgressTokenSchema:()=>nQ,PromptArgumentSchema:()=>s5,PromptListChangedNotificationSchema:()=>od,PromptMessageSchema:()=>oc,PromptReferenceSchema:()=>o6,PromptSchema:()=>s3,ReadResourceRequestParamsSchema:()=>sH,ReadResourceRequestSchema:()=>sJ,ReadResourceResultSchema:()=>sB,RelatedTaskMetadataSchema:()=>n1,RequestIdSchema:()=>se,RequestMetaSchema:()=>n2,RequestSchema:()=>n6,ResourceContentsSchema:()=>sI,ResourceLinkSchema:()=>oo,ResourceListChangedNotificationSchema:()=>sK,ResourceRequestParamsSchema:()=>sH,ResourceSchema:()=>sL,ResourceTemplateReferenceSchema:()=>o4,ResourceTemplateSchema:()=>sZ,ResourceUpdatedNotificationParamsSchema:()=>s4,ResourceUpdatedNotificationSchema:()=>s6,ResultMetaObjectSchema:()=>n8,ResultSchema:()=>n7,RoleSchema:()=>sz,RootSchema:()=>o7,RootsListChangedNotificationSchema:()=>lr,SamplingContentSchema:()=>oC,SamplingMessageContentBlockSchema:()=>oI,SamplingMessageSchema:()=>oN,ServerCapabilitiesSchema:()=>sS,ServerNotificationSchema:()=>lS,ServerRequestSchema:()=>lb,ServerResultSchema:()=>l$,ServerTasksCapabilitySchema:()=>sy,SetLevelRequestParamsSchema:()=>ok,SetLevelRequestSchema:()=>ox,SingleSelectEnumSchemaSchema:()=>oH,StringSchemaSchema:()=>oZ,SubscribeRequestParamsSchema:()=>sH,SubscribeRequestSchema:()=>sW,SubscriptionFilterSchema:()=>sY,SubscriptionsAcknowledgedNotificationParamsSchema:()=>s0,SubscriptionsAcknowledgedNotificationSchema:()=>s1,SubscriptionsListenRequestParamsSchema:()=>sQ,SubscriptionsListenRequestSchema:()=>sX,SubscriptionsListenResultMetaSchema:()=>s2,SubscriptionsListenResultSchema:()=>s9,TaskAugmentedRequestParamsSchema:()=>n4,TaskCreationParamsSchema:()=>la,TaskMetadataSchema:()=>n0,TaskSchema:()=>ln,TaskStatusNotificationParamsSchema:()=>lo,TaskStatusNotificationSchema:()=>ll,TaskStatusSchema:()=>li,TextContentSchema:()=>or,TextResourceContentsSchema:()=>sN,TitledMultiSelectEnumSchemaSchema:()=>oB,TitledSingleSelectEnumSchemaSchema:()=>oF,ToolAnnotationsSchema:()=>op,ToolChoiceSchema:()=>oT,ToolExecutionSchema:()=>om,ToolListChangedNotificationSchema:()=>oS,ToolResultContentSchema:()=>oO,ToolSchema:()=>oh,ToolUseContentSchema:()=>on,UnsubscribeRequestParamsSchema:()=>sH,UnsubscribeRequestSchema:()=>sG,UntitledMultiSelectEnumSchemaSchema:()=>oJ,UntitledSingleSelectEnumSchemaSchema:()=>oV});let cV=e=>st.safeParse(e).success,cF=e=>"object"==typeof e&&null!==e&&!Array.isArray(e)&&"input_required"===e.resultType,cU="x-mcp-header",cH=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,cJ=new Set(["string","integer","boolean"]),cB=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],cK=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function cW(e){return 0===e.length?"<root>":e.join(".")}cc.InvalidRequest,cc.UnsupportedProtocolVersion,cc.InvalidParams,cc.MethodNotFound,cc.InvalidParams,cc.MissingRequiredClientCapability;let cG={[cc.ParseError]:400,[cc.InvalidRequest]:400,[cc.MethodNotFound]:404,[cc.UnsupportedProtocolVersion]:400,[cc.MissingRequiredClientCapability]:400,[-32020]:400};function cY(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 cQ(e){if(!cM(e))return!1;let t=cL(e);if(void 0===t||!(t>=lU))return!1;let r=cz(e);return void 0!==r&&0===cZ(r).length}function cX(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function c0(e){if(null==e)return!1;let t=typeof e;return("object"===t||"function"===t)&&"~standard"in e&&"function"==typeof e["~standard"]?.validate}let c1=!1,c2="draft-2020-12";function c9(e,t="input"){let r,a=e["~standard"];if(a.jsonSchema)r=a.jsonSchema[t]({target:c2});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().");c1||(c1=!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=it(e,{target:c2,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&&c4.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 c4=/^#\/(\$defs|definitions)\/([^/~%]+)$/;async function c6(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 c5=/\\\.\\d\{(\d+)\}/;function c3(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let c8=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function c7(e){return c8.has(e)||e.startsWith("x-")}let ue=new Set(["$schema",...Object.keys(oY.shape.requestedSchema.shape)]),ut={string:cX([oZ,oV,oF,oU]),number:cX([oD]),integer:cX([oD]),boolean:cX([oL]),array:cX([oJ,oB])},ur=new Set(oZ.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(!c0(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&&c3(n)?r[i]=Object.fromEntries(Object.entries(n).map(([e,r])=>[e,function(e,t,r,a){if(!c3(e))return e;let i="string"==typeof e.type&&Object.hasOwn(ut,e.type)?ut[e.type]:void 0;if(void 0===i)return e;let n={};for(let[o,l]of Object.entries(e))if(i.has(o)||c7(o))n[o]=l;else if("pattern"===o&&"string"===e.type&&"string"==typeof e.format)if(ur.has(e.format)){var s;"string"==typeof l&&(s=e.format,"zod"!==r||(function(e,t){let r;switch(e){case"email":r=[r6(iM,void 0)];break;case"uri":r=[r5(iD,void 0)];break;case"date":r=[r8(iq,void 0)];break;case"date-time":let a,i;a=c5.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(iN,{local:e,offset:t,precision:r}))))}return new Set(r.map(e=>{let t;return t=it(e,{target:c2,io:"input"}),"string"==typeof t.pattern?t.pattern:void 0}).filter(e=>void 0!==e))})(s,l).has(l))||a.push(`${t}.${o}`)}else n[o]=l;else a.push(`${t}.${o}`);return n}(r,`properties.${e}`,t,a)])):ue.has(i)?r[i]=n:c7(i)||a.push(i);if(a.length>0)throw new cu(cc.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${a.join(", ")}`);return r}(function(e){try{return c9(e,"input")}catch(t){let e=t instanceof Error?t.message:String(t);throw new cu(cc.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${e}`)}}(e.requestedSchema),r),i=(t=oY.shape.requestedSchema,i$(t,a));if(!i.success)throw new cu(cc.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${function(e,t){if(!c3(e.properties))return t;let r=Object.entries(e.properties).filter(([,e])=>!i$(oG,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}]`)):c3(t)&&c3(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):c7(t)?[]:[n]}):[]}(a,i.data);if(n.length>0)throw new cu(cc.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);let s=(i.data.required??[]).filter(e=>!Object.prototype.hasOwnProperty.call(i.data.properties,e));if(s.length>0)throw new cu(cc.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${s.join(", ")}`);return{...e,mode:"form",requestedSchema:i.data}}(e)}}catch(e){throw e instanceof cu?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 ua={},ui={};function un(e,t){let r=e.slice(0,-6);ua[r]=t,ui[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"])un(e,cD[e]);for(let[e,t]of Object.entries({IdJagTokenExchangeResponseSchema:lj,OAuthClientInformationFullSchema:lN,OAuthClientInformationSchema:lI,OAuthClientMetadataSchema:lC,OAuthClientRegistrationErrorSchema:lq,OAuthErrorResponseSchema:lT,OAuthMetadataSchema:lx,OAuthProtectedResourceMetadataSchema:lk,OAuthTokenRevocationRequestSchema:lA,OAuthTokensSchema:lE,OpenIdProviderDiscoveryMetadataSchema:lP,OpenIdProviderMetadataSchema:lR}))un(e,t);let us=Object.freeze(ua);Object.freeze(ui);let uo=[nF,nU,nJ,nK],ul=["inputResponses","requestState"];function uc(e,t){let r=e.params;if(!uh(r))return{message:e,lifted:{}};let a=r._meta,i=uh(a)?uo.filter(e=>e in a):[],n="request"===t?ul.filter(e=>e in r):[];if(0===i.length&&0===n.length)return{message:e,lifted:{}};let s={},o={...r};if(i.length>0&&uh(a)){let e={},t={...a};for(let r of i)e[r]=a[r],delete t[r];s.envelope=e,Object.keys(t).length>0?o._meta=t:delete o._meta}for(let e of n)"inputResponses"===e&&(s.inputResponses=o[e]),"requestState"===e&&(s.requestState=o[e]),delete o[e];return{message:{...e,params:o},lifted:s}}function uu(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 ud=(O=void 0,()=>O);function up(e,t){return{...e,mcpReq:{...e.mcpReq,requestState:()=>t}}}var um=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{h=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??nV,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 lD(lZ.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 lD(lZ.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),sa.safeParse(e).success||si.safeParse(e).success)?this._onresponse(e):cV(e)?this._onrequest(e,t):sr.safeParse(e).success?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 lD(lZ.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}=uc(e,"notification"),a=this._negotiatedWireCodec();if(t?.classification===void 0&&"drop"===this._shouldDropInbound(e))return;if(t?.classification!==void 0){let e=cO(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(cI(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}=uc(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 s=this._transport,o=(e,t,r)=>{let i={jsonrpc:"2.0",id:a.id,error:{code:e,message:t,...void 0!==r&&{data:r}}};s?.send(i).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)))};if(t?.classification!==void 0){let e=cO(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;o(cc.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(cC(a.method)&&!n.hasRequestMethod(a.method)&&!(cN(a.method)&&this._customSchemaRequestMethods.has(a.method)))return void o(cc.MethodNotFound,"Method not found");let l=this._requestHandlers.get(a.method)??this.fallbackRequestHandler;if(void 0===l)return void o(cc.MethodNotFound,"Method not found");let c=n.checkInboundEnvelope(i);if(void 0!==c)return void o(cc.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(!uf(e))return{accepted:t,droppedKeys:r};for(let[a,i]of Object.entries(e)){if(!uf(i)||"method"in i||"result"in i){r.push(a);continue}t[a]=i}return{accepted:t,droppedKeys:r}}(i.inputResponses),h={sessionId:s?.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?ud:(r=i.requestState,()=>r),signal:p.signal,send:(e,t,r)=>{let a=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(a,e.method),c0(t))return d(e,t,r);let i=uu(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}`)),o(cc.InternalError,"Internal error");return}let r={result:t,jsonrpc:"2.0",id:a.id};await s?.send(r)},async e=>{if(p.signal.aborted)return;let t=Number.isSafeInteger(e.code)?e.code:cc.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 s?.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),s=this._timeoutInfo.get(a);if(s&&n&&s.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(sa.safeParse(e).success?e:cu.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(c0(t))return cN(e.method)||this._assertOutboundRequestInEra(a,e.method),this._requestWithSchemaViaCodec(a,e,t,r);this._assertOutboundRequestInEra(a,e.method);let i=uu(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 cT(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 cT(void 0);case"server/discover":return cT(cj);default:return}}(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(cC(t)&&!e.hasRequestMethod(t))throw new lD(lZ.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:s,resumptionToken:o,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 lD?e:new lD(lZ.RequestTimeout,String(e))}let h=e.era===cj&&!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:s,resumptionToken:o,onresumptiontoken:l}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))):h.abort(),p(e instanceof lD?e:new lD(lZ.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 s;return a?.allowInputRequired===!0?d({resultType:"input_required",inputRequests:(s=n).inputRequests,...void 0!==s.requestState&&{requestState:s.requestState},...void 0!==s._meta&&{_meta:s._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)}))}c6(r,n.result).then(e=>{e.success?d(e.data):p(new lD(lZ.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 lD(lZ.RequestTimeout,"Request timed out",{timeout:b})),a?.resetTimeoutOnProgress??!1),this._transport.send(y,{relatedRequestId:s,resumptionToken:o,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 lD(lZ.NotConnected,"Not connected");if(cI(t.method)&&!e.hasNotificationMethod(t.method))throw new lD(lZ.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(!cC(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 cu(cc.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 c6(t.params,{...a.params});if(!n.success)throw new cu(cc.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(!cI(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 cu(cc.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 c6(t.params,{...a.params});if(!i.success)throw new cu(cc.InvalidParams,`Invalid params for notification ${e}: ${i.error}`);await r(i.data,a)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function uh(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function uf(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}K(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,s,o,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;s=t.exec(l);){if(s.index!==c)throw TypeError("invalid parameter format");c+=s[0].length,n=s[1].toLowerCase(),34===(o=s[2]).charCodeAt(0)&&-1!==(o=o.slice(1,-1)).indexOf("\\")&&(o=o.replace(r,"$1")),d.parameters[n]=o}if(c!==l.length)throw TypeError("invalid parameter format")}return d}})();var ug=class{_buffer;_maxBufferSize;constructor(e){this._maxBufferSize=e?.maxBufferSize??0xa00000}append(e){if((this._buffer?.length??0)+e.length>this._maxBufferSize)throw this.clear(),Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){for(;this._buffer;){let e=this._buffer.indexOf("\n");if(-1===e)break;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");this._buffer=this._buffer.subarray(e+1);try{return sn.parse(JSON.parse(t))}catch(e){if(e instanceof SyntaxError)continue;throw e}}return null}clear(){this._buffer=void 0}};let uy=/^[A-Za-z0-9._-]{1,128}$/;function uv(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"),!uy.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 u_=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 s=t.indexOf("}",i);if(-1===s)throw Error("Unclosed template expression");if(++n>1e4)throw Error("Template contains too many expressions (max 10000)");let o=t.slice(i+1,s),l=this.getOperator(o),c=o.includes("*"),u=this.getNames(o),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=s+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 s={};for(let[e,t]of a.entries()){let{name:r,exploded:a}=t,i=n[e+1];s[r.replace("*","")]=a&&i.includes(",")?i.split(","):i}return s}};function ub(e){if(void 0!==e){if(function(e){if("object"!=typeof e||null===e||c0(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 nl(e);if("object"==typeof e&&null!==e&&!c0(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(!c0(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 uS=K(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;)o(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 s(e,...t){let i=[l(e[0])],c=0;for(;c<t.length;)i.push(n),o(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 o(e,t){t instanceof a?e.push(...t._items):t instanceof r?e.push(t):e.push("number"==typeof t||"boolean"==typeof t||null===t?t:l(Array.isArray(t)?t.join(","):t))}function l(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.str=s,e.addCodeArg=o,e.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:s`${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())}}),u$=K(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=uS();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 s=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=s;let o=(0,t._)`\n`;var l=class extends n{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o:t.nil}}get(){return this._scope}name(e){return new s(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,s=this._values[i];if(s){let e=s.get(n);if(e)return e}else s=this._values[i]=new Map;s.set(n,a);let o=this._scope[i]||(this._scope[i]=[]),l=o.length;return o[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,s={},o){let l=t.nil;for(let c in r){let u=r[c];if(!u)continue;let d=s[c]=s[c]||new Map;u.forEach(r=>{if(d.has(r))return;d.set(r,a.Started);let s=n(r);if(s){let a=this.opts.es5?e.varKinds.var:e.varKinds.const;l=(0,t._)`${l}${a} ${r} = ${s};${this.opts._n}`}else if(s=null==o?void 0:o(r))l=(0,t._)`${l}${s}${this.opts._n}`;else throw new i(r);d.set(r,a.Completed)})}return l}};e.ValueScope=l}),uw=K(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=uS(),r=u$();var a=uS();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=u$();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}},s=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=T(this.rhs,e,t)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},o=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=T(this.rhs,e,r),this}get names(){return j(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},l=class extends o{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=T(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=T(this.condition,e,t),this}get names(){let e=super.names;return j(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=T(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 j(j(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=T(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 k=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}},x=class extends h{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};x.kind="catch";var R=class extends h{render(e){return"finally"+super.render(e)}};R.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 s(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 o(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 s=this._scope.toName(e);return this._for(new b(n,s,t,a),()=>i(s))}forOf(e,a,i,n=r.varKinds.const){let s=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(s,(0,t._)`${e}[${r}]`),i(s)})}return this._for(new S("of",n,s,a),()=>i(s))}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 s=this._scope.toName(e);return this._for(new S("in",n,s,a),()=>i(s))}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 k;if(this._blockNode(a),this.code(e),t){let e=this.name("e");this._currNode=a.catch=new x(e),t(e)}return r&&(this._currNode=a.finally=new R,this.code(r)),this._endBlockNode(x,R)}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 j(e,r){return r instanceof t._CodeOrName?E(e,r.names):e}function T(e,r,a){if(e instanceof t.Name)return i(e);if(!(e instanceof t._Code&&e._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=i(r)),r instanceof t._Code?e.push(...r._items):e.push(r),e),[]));function i(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)}}),uk=K(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=uw(),i=uS();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 s(e,t){if("boolean"==typeof e)return!e;for(let r in e)if(t[r])return!0;return!1}function o(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,s,o,l)=>{let c=void 0===o?s:o instanceof a.Name?(s instanceof a.Name?e(n,s,o):t(n,s,o),o):s instanceof a.Name?(t(n,o,s),s):r(s,o);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),!s(t,e.self.RULES.all))},e.checkUnknownRules=n,e.schemaHasRules=s,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(o(e))},e.escapeJsonPointer=o,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():"/"+o(e)},e.checkStrictMode=m}),ux=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uw();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")}}),uR=K(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;let t=uw(),r=uk(),a=ux();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,s,l){let{it:c}=r,{gen:u,compositeRule:d,allErrors:p}=c,m=o(r,a,s);(null!=l?l:d||p)?i(u,m):n(c,(0,t._)`[${m}]`)},e.reportExtraError=function(t,r=e.keywordError,s){let{it:l}=t,{gen:c,compositeRule:u,allErrors:d}=l;i(c,o(t,r,s)),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:s,it:o}){if(void 0===s)throw Error("ajv implementation error");let l=e.name("err");e.forRange("i",s,a.default.errors,s=>{e.const(l,(0,t._)`${a.default.vErrors}[${s}]`),e.if((0,t._)`${l}.instancePath === undefined`,()=>e.assign((0,t._)`${l}.instancePath`,(0,t.strConcat)(a.default.instancePath,o.errorPath))),e.assign((0,t._)`${l}.schemaPath`,(0,t.str)`${o.errSchemaPath}/${r}`),o.opts.verbose&&(e.assign((0,t._)`${l}.schema`,i),e.assign((0,t._)`${l}.data`,n))})};let s={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 o(e,i,n){let{createErrors:o}=e.it;return!1===o?(0,t._)`{}`:function(e,i,n={}){let{gen:o,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 o=n?a:(0,t.str)`${a}/${e}`;return i&&(o=(0,t.str)`${o}${(0,r.getErrorPath)(i,r.Type.Str)}`),[s.schemaPath,o]}(e,n)];return function(e,{params:r,message:i},n){let{keyword:o,data:l,schemaValue:c,it:u}=e,{opts:d,propertyName:p,topSchemaRef:m,schemaPath:h}=u;n.push([s.keyword,o],[s.params,"function"==typeof r?r(e):r||(0,t._)`{}`]),d.messages&&n.push([s.message,"function"==typeof i?i(e):i]),d.verbose&&n.push([s.schema,c],[s.parentSchema,(0,t._)`${m}${h}`],[a.default.data,l]),p&&n.push([s.propertyName,p])}(e,i,c),o.object(...c)}(e,i,n)}}),uP=K(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=uR(),r=uw(),a=ux(),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:s}=e;!1===i?n(e,!1):"object"==typeof i&&!0===i.$async?t.return(a.default.data):(t.assign((0,r._)`${s}.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)}}),uE=K(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:{}}}}),uj=K(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}),uT=K(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=uE(),i=uj(),n=uR(),s=uw(),o=uk();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;let{gen:n,data:o,opts:l}=e,u=(a=l.coerceTypes)?r.filter(e=>c.has(e)||"array"===a&&"array"===e):[],p=r.length>0&&!(0===u.length&&1===r.length&&(0,i.schemaHasRulesForType)(e,r[0]));if(p){let a=d(r,o,l.strictNumbers,t.Wrong);n.if(a,()=>{u.length?function(e,t,r){let{gen:a,data:i,opts:n}=e,o=a.let("dataType",(0,s._)`typeof ${i}`),l=a.let("coerced",(0,s._)`undefined`);for(let e of("array"===n.coerceTypes&&a.if((0,s._)`${o} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>a.assign(i,(0,s._)`${i}[0]`).assign(o,(0,s._)`typeof ${i}`).if(d(t,i,n.strictNumbers),()=>a.assign(l,i))),a.if((0,s._)`${l} !== undefined`),r))(c.has(e)||"array"===e&&"array"===n.coerceTypes)&&function(e){switch(e){case"string":a.elseIf((0,s._)`${o} == "number" || ${o} == "boolean"`).assign(l,(0,s._)`"" + ${i}`).elseIf((0,s._)`${i} === null`).assign(l,(0,s._)`""`);return;case"number":a.elseIf((0,s._)`${o} == "boolean" || ${i} === null
62
+ || (${o} == "string" && ${i} && ${i} == +${i})`).assign(l,(0,s._)`+${i}`);return;case"integer":a.elseIf((0,s._)`${o} === "boolean" || ${i} === null
63
+ || (${o} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(l,(0,s._)`+${i}`);return;case"boolean":a.elseIf((0,s._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(l,!1).elseIf((0,s._)`${i} === "true" || ${i} === 1`).assign(l,!0);return;case"null":a.elseIf((0,s._)`${i} === "" || ${i} === 0 || ${i} === false`),a.assign(l,null);return;case"array":a.elseIf((0,s._)`${o} === "string" || ${o} === "number"
64
+ || ${o} === "boolean" || ${i} === null`).assign(l,(0,s._)`[${i}]`)}}(e);a.else(),m(e),a.endIf(),a.if((0,s._)`${l} !== undefined`,()=>{a.assign(i,l),function({gen:e,parentData:t,parentDataProperty:r},a){e.if((0,s._)`${t} !== undefined`,()=>e.assign((0,s._)`${t}[${r}]`,a))}(e,l)})}(e,r,u):m(e)})}return p};let c=new Set(["string","number","integer","boolean","null"]);function u(e,r,a,i=t.Correct){let n,o=i===t.Correct?s.operators.EQ:s.operators.NEQ;switch(e){case"null":return(0,s._)`${r} ${o} null`;case"array":n=(0,s._)`Array.isArray(${r})`;break;case"object":n=(0,s._)`${r} && typeof ${r} == "object" && !Array.isArray(${r})`;break;case"integer":n=l((0,s._)`!(${r} % 1) && !isNaN(${r})`);break;case"number":n=l();break;default:return(0,s._)`typeof ${r} ${o} ${e}`}return i===t.Correct?n:(0,s.not)(n);function l(e=s.nil){return(0,s.and)((0,s._)`typeof ${r} == "number"`,e,a?(0,s._)`isFinite(${r})`:s.nil)}}function d(e,t,r,a){let i;if(1===e.length)return u(e[0],t,r,a);let n=(0,o.toHash)(e);if(n.array&&n.object){let e=(0,s._)`typeof ${t} != "object"`;i=n.null?e:(0,s._)`!${t} || ${e}`,delete n.null,delete n.array,delete n.object}else i=s.nil;for(let e in n.number&&delete n.integer,n)i=(0,s.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,s._)`{type: ${e}}`:(0,s._)`{type: ${t}}`};function m(e){let t=function(e){let{gen:t,data:r,schema:a}=e,i=(0,o.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}),uO=K(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;let t=uw(),r=uk();function a(e,a,i){let{gen:n,compositeRule:s,data:o,opts:l}=e;if(void 0===i)return;let c=(0,t._)`${o}${(0,t.getProperty)(a)}`;if(s)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))}}),uC=K(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=uw(),r=uk(),a=ux(),i=uk();function n(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}function s(e,r,a){return(0,t._)`${n(e)}.call(${r}, ${a})`}function o(e,r,a,i){let n=(0,t._)`${r}${(0,t.getProperty)(a)} === undefined`;return i?(0,t.or)(n,(0,t.not)(s(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(o(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)(o(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=s,e.propertyInData=function(e,r,a,i){let n=(0,t._)`${r}${(0,t.getProperty)(a)} !== undefined`;return i?(0,t._)`${n} && ${s(e,r,a)}`:n},e.noPropertyInData=o,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:s,errorPath:o},it:l},c,u,d){let p=d?(0,t._)`${e}, ${r}, ${n}${s}`:r,m=[[a.default.instancePath,(0,t.strConcat)(a.default.instancePath,o)],[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:s}=r.code,o=s(a,n);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,t._)`${"new RegExp"===s.code?c:(0,i.useFunc)(e,s)}(${a}, ${n})`})},e.validateArray=function(e){let{gen:a,data:i,keyword:n,it:s}=e,o=a.name("valid");if(s.allErrors){let e=a.let("valid",!0);return l(()=>a.assign(e,!1)),e}return a.var(o,!0),l(()=>a.break()),o;function l(s){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},o),a.if((0,t.not)(o),s)})}},e.validateUnion=function(e){let{gen:a,schema:i,keyword:n,it:s}=e;if(!Array.isArray(i))throw Error("ajv implementation error");if(i.some(e=>(0,r.alwaysValidSchema)(s,e))&&!s.opts.unevaluated)return;let o=a.let("valid",!1),l=a.name("_valid");a.block(()=>i.forEach((r,i)=>{let s=e.subschema({keyword:n,schemaProp:i,compositeRule:!0},l);a.assign(o,(0,t._)`${o} || ${l}`),e.mergeValidEvaluated(s,l)||a.if((0,t.not)(o))})),e.result(o,()=>e.reset(),()=>e.error(!0))}}),uI=K(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;let t=uw(),r=ux(),a=uC(),i=uR();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 s(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:o,it:l}=e,c=r.macro.call(l.self,n,o,l),u=s(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,o){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,o);let f=s(c,u,!m&&o.compile?o.compile.call(h.self,d,p,h):o.validate),g=c.let("valid");function y(i=o.async?(0,t._)`await `:t.nil){let n=h.opts.passContext?r.default.this:r.default.self,s=!("compile"in o&&!m||!1===o.schema);c.assign(g,(0,t._)`${i}${(0,a.callValidateCode)(e,f,n,s)}`,o.modifying)}function v(e){var r;c.if((0,t.not)(null!=(r=o.valid)?r:g),e)}e.block$data(g,function(){if(!1===o.errors)y(),o.modifying&&n(e),v(()=>e.error());else{let a,s,l=o.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):(s=(0,t._)`${f}.errors`,c.assign(s,null),y(t.nil),s);o.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=o.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 s=i.dependencies;if(null==s?void 0:s.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw Error(`parent schema must have dependencies of ${n}: ${s.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)}}}),uN=K(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;let t=uw(),r=uk();e.getSubschema=function(e,{keyword:a,schemaProp:i,schema:n,schemaPath:s,errSchemaPath:o,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===s||void 0===o||void 0===l)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:s,topSchemaRef:l,errSchemaPath:o}}throw Error('either "keyword" or "schema" must be passed')},e.extendSubschemaData=function(e,a,{dataProp:i,dataPropType:n,data:s,dataTypes:o,propertyName:l}){if(void 0!==s&&void 0!==i)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:c}=a;if(void 0!==i){let{errorPath:s,dataPathArr:o,opts:l}=a;u(c.let("data",(0,t._)`${a.data}${(0,t.getProperty)(i)}`,!0)),e.errorPath=(0,t.str)`${s}${(0,r.getErrorPath)(i,n,l.jsPropertySyntax)}`,e.parentDataProperty=(0,t._)`${i}`,e.dataPathArr=[...o,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!==s&&(u(s instanceof t.Name?s:c.let("data",s,!0)),void 0!==l&&(e.propertyName=l)),o&&(e.dataTypes=o)},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}}),uq=K((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,s=n[i];if(!e(t[s],r[s]))return!1}return!0}return t!=t&&r!=r}}),uA=K((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,s,o,l,c,u,d){if(n&&"object"==typeof n&&!Array.isArray(n)){for(var p in a(n,s,o,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],s+"/"+p+"/"+h,o,s,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],s+"/"+p+"/"+f.replace(/~/g,"~0").replace(/\//g,"~1"),o,s,p,n,f)}else(p in r.keywords||t.allKeys&&!(p in r.skipKeywords))&&e(t,a,i,m,s+"/"+p,o,s,p,n)}i(n,s,o,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}}),uz=K(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;let t=uk(),r=uq(),a=uA(),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 s(e,t="",r){return!1!==r&&(t=c(t)),o(e,e.parse(t))}function o(e,t){return e.serialize(t).split("#")[0]+"#"}e.getFullPath=s,e._getFullPath=o;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,o=c(e[i]||t),l={"":o},d=s(n,o,!1),p={},m=new Set;return a(e,{allKeys:!0},(e,t,r,a)=>{if(void 0===a)return;let n=d+t,s=l[a];function o(t){let r=this.opts.uriResolver.resolve;if(t=c(s?r(s,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}"`);o.call(this,`#${e}`)}}"string"==typeof e[i]&&(s=o.call(this,e[i])),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),l[t]=s}),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`)}}}),uM=K(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;let t=uP(),r=uT(),a=uj(),i=uT(),n=uO(),s=uI(),o=uN(),l=uw(),c=ux(),u=uz(),d=uk(),p=uR();function m({gen:e,validateName:t,schema:r,schemaEnv:a,opts:i},n){i.code.es5?e.func(t,(0,l._)`${c.default.data}, ${c.default.valCxt}`,a.$async,()=>{e.code((0,l._)`"use strict"; ${h(r,i)}`),e.if(c.default.valCxt,()=>{e.var(c.default.instancePath,(0,l._)`${c.default.valCxt}.${c.default.instancePath}`),e.var(c.default.parentData,(0,l._)`${c.default.valCxt}.${c.default.parentData}`),e.var(c.default.parentDataProperty,(0,l._)`${c.default.valCxt}.${c.default.parentDataProperty}`),e.var(c.default.rootData,(0,l._)`${c.default.valCxt}.${c.default.rootData}`),i.dynamicRef&&e.var(c.default.dynamicAnchors,(0,l._)`${c.default.valCxt}.${c.default.dynamicAnchors}`)},()=>{e.var(c.default.instancePath,(0,l._)`""`),e.var(c.default.parentData,(0,l._)`undefined`),e.var(c.default.parentDataProperty,(0,l._)`undefined`),e.var(c.default.rootData,c.default.data),i.dynamicRef&&e.var(c.default.dynamicAnchors,(0,l._)`{}`)}),e.code(n)}):e.func(t,(0,l._)`${c.default.data}, ${(0,l._)`{${c.default.instancePath}="", ${c.default.parentData}, ${c.default.parentDataProperty}, ${c.default.rootData}=${c.default.data}${i.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){let{gen:s,schema:o,data:u,allErrors:p,opts:m,self:h}=e,{RULES:f}=h;if(o.$ref&&(m.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(o,f)))return void s.block(()=>x(e,"$ref",f.all.$ref.definition));function g(d){(0,a.shouldUseGroup)(o,d)&&(d.type?(s.if((0,i.checkDataType)(d.type,u,m.strictNumbers)),S(e,d),1===t.length&&t[0]===d.type&&r&&(s.else(),(0,i.reportTypeError)(e)),s.endIf()):S(e,d),p||s.if((0,l._)`${c.default.errors} === ${n||0}`))}m.jtd||!e.schemaEnv.meta&&e.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)}}(e,t),e.opts.allowUnionTypes||t.length>1&&!(2===t.length&&t.includes("null"))&&w(e,"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=>t.includes(e)||"number"===e&&t.includes("integer"))&&w(e,`missing type "${r.join(",")}" for keyword "${i}"`)}}}(e,e.dataTypes)),s.block(()=>{for(let e of f.rules)g(e);g(f.post)})}function S(e,t){let{gen:r,schema:i,opts:{useDefaults:s}}=e;s&&(0,n.assignDefaults)(e,t.type),r.block(()=>{for(let r of t.rules)(0,a.shouldUseRule)(i,r)&&x(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 k=class{constructor(e,t,r){if((0,s.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,s.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,o.getSubschema)(this.it,e);(0,o.extendSubschemaData)(a,this.it,e),(0,o.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){let r,{schema:a,gen:i,opts:n}=e;n.$comment&&a.$comment&&_(e),(r=e.schema[e.opts.schemaId])&&(e.baseId=(0,u.resolveUrl)(e.opts.uriResolver,e.baseId,r)),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}(e);let s=i.const("_errs",c.default.errors);v(e,s),i.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 x(e,t,r,a){let i=new k(e,r,t);"code"in r?r.code(i,a):i.$data&&r.validate?(0,s.funcKeywordCode)(i,r):"macro"in r?(0,s.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,s.funcKeywordCode)(i,r)}e.KeywordCxt=k;let R=/^\/(?:[^~]|~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(!R.test(e))throw Error(`Invalid JSON-pointer: ${e}`);i=e,n=c.default.rootData}else{let s=P.exec(e);if(!s)throw Error(`Invalid JSON-pointer: ${e}`);let l=+s[1];if("#"===(i=s[2])){if(l>=t)throw Error(o("property/index",l));return a[t-l]}if(l>t)throw Error(o("data",l));if(n=r[t-l],!i)return n}let s=n;for(let e of i.split("/"))e&&(n=(0,l._)`${n}${(0,l.getProperty)((0,d.unescapeJsonPointer)(e))}`,s=(0,l._)`${s} && ${n}`);return s;function o(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}e.getData=E}),uL=K(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}}}),uZ=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uz();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))}}}),uD=K(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;let t=uw(),r=uL(),a=ux(),i=uz(),n=uk(),s=uM();var o=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,o,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,s.validateFunctionCode)(g),h.optimize(this.opts.code.optimize);let r=h.toString();o=`${h.scopeRefs(a.default.scope)}return ${r}`,this.opts.code.process&&(o=this.opts.code.process(o,e));let i=Function(`${a.default.self}`,`${a.default.scope}`,o)(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,o&&this.logger.error("Error compiling schema, function code:",o),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 t of this._compilations)if(t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId)return t}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 s=(0,i.normalizeId)(a),c=this.refs[s]||this.schemas[s];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),s===(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 o({schema:t,schemaId:r,root:e,baseId:n})}return h.call(this,r,c)}}e.SchemaEnv=o,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 s=d.call(this,e,r);if(void 0===s){let i=null==(a=e.localRefs)?void 0:a[r],{schemaId:n}=this.opts;i&&(s=new o({schema:i,schemaId:n,root:e,baseId:t}))}if(void 0!==s)return e.refs[r]=c.call(this,s)},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 s;let l;if((null==(s=e.fragment)?void 0:s[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 s="object"==typeof(r=e)&&r[this.opts.schemaId];!m.has(a)&&s&&(t=(0,i.resolveUrl)(this.opts.uriResolver,t,s))}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 o({schema:r,schemaId:c,root:a,baseId:t})).schema!==l.root.schema)return l}}),uV=K((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}}),uF=K((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),s=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),o=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="",s=r.indexOf("%");if(-1!==s){let t="%25"===r.slice(s,s+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(s+t)))return{host:e,isIPV6:!1,error:!0};r=r.slice(0,s)}let o=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),s=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;s+=2;continue}if(!p(r))return;n[e]=parseInt(r,16).toString(16),s++}if(-1===t){if(8!==s)return;return g(n)}if(s>=8)return;let o=n.slice(0,r.length);for(let e=s;e<8;e++)o.push("0");for(let e=r.length;e<n.length;e++)o.push(n[e]);return g(o)}(r);return void 0===o?{host:e,isIPV6:!1,error:!0}:{host:o+(i?"%"+i:""),escapedHost:o+(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&&s(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 k(e){return w(e,c)}function x(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(k(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&&s(i)?t+=i:t+="%"+e,r+=2;continue}}if(o(a))t+=a;else{let i=e.charCodeAt(r);if(i<128)t+=x(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),o(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));s(i)?t+=i:t+="%"+e,r+=2;continue}}if(l(a))t+=a;else{let i=e.charCodeAt(r);if(i<128)t+=x(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:k,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}}}),uU=K((e,t)=>{let{isUUID:r}=uF(),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 s(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function o(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:s,serialize:o},c={scheme:"https",domainHost:l.domainHost,parse:s,serialize:o},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,s=e.nss;return n.path=`${a||t.nid}:${s}`,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}}),uH=K((e,t)=>{let{normalizeIPv6:r,removeDotSegments:a,recomposeAuthority:i,normalizePercentEncoding:n,normalizePathEncoding:s,serializePathEncoding:o,normalizeQueryFragmentEncoding:l,encodeQuery:c,encodeFragment:u,reescapeHostDelimiters:d,isIPv4:p,nonSimpleDomain:m}=uF(),{SCHEMES:h,getSchemeHandler:f}=uU(),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:""},s=Object.assign({},t),l=[];r.scheme&&(r.scheme=v(r.scheme));let d=f(s.scheme||r.scheme);d&&d.serialize&&d.serialize(r,s);let p=void 0!==r.userinfo||void 0!==r.host||void 0!==r.port,m=!s.skipEscape&&void 0===r.scheme&&!p;void 0!==r.path&&(s.skipEscape?r.path=n(r.path):r.path=o(r.path,m)),"suffix"!==s.reference&&r.scheme&&(r.scheme=v(r.scheme),l.push(r.scheme,":"));let h=i(r);if(void 0!==h&&("suffix"!==s.reference&&l.push("//"),l.push(h),r.path&&"/"!==r.path[0]&&l.push("/")),void 0!==r.path){let e=r.path;s.absolutePath||d&&d.absolutePath||(e=a(e)),m&&(e=o(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 k(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 x(e){return"["===e[0]&&"]"===e[e.length-1]}function R(e,t,r,a){if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!x(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},o=!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.",o=!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.",o=!0):e.length!==t.length&&(i.error=i.error||"URI authority introducer must not contain whitespace.",o=!0))}let j=e.match(S);if(j){let t;if(i.scheme=j[1],i.userinfo=j[3],i.host=j[4],i.port=parseInt(j[5],10),i.path=j[6]||"",i.query=j[7],i.fragment=j[8],void 0!==i.scheme){let e=unescape(i.scheme);g.test(e)?i.scheme=e.toLowerCase():(i.error=i.error||y,_=!0)}t=j[4],(c=k(j[3])||void 0!==t&&!x(t)&&k(t)||k(j[6])||k(j[7])||k(j[8]))&&(i.error=i.error||"URI contains malformed percent-encoding."),isNaN(i.port)&&(i.port=j[5]);let S=void 0!==j[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,o=!0),i.host)if(!1===p(i.host)){let e=x(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.",o=!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=R(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=s(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:o,malformedPercentEncoding:c,malformedSchemeSpecific:u,malformedHost:m,malformedScheme:_}}function E(e,t){return P(e,t).parsed}function j(e,t){let{parsed:r,malformedAuthorityOrPort:a,malformedPercentEncoding:i,malformedSchemeSpecific:n,malformedHost:s,malformedScheme:o}=P(e,t);return{normalized:a||i||n||s||o?e:b(r,t),malformedAuthorityOrPort:a,malformedPercentEncoding:i,malformedSchemeSpecific:n,malformedHost:s,malformedScheme:o}}function T(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:s,malformedHost:o,malformedScheme:l}=j(r,t);return i||n||s||o||l?void 0:a}let O={SCHEMES:h,normalize:function(e,t){return"string"==typeof e?e=j(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:s,malformedPercentEncoding:o,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(s||m||o||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;R(S,a||{},$,void 0!==w&&""!==w&&(p(w)||r(w).isIPV6));let k=w&&-1!==w.indexOf("%")&&!/\P{ASCII}/u.test(w);if(S.error&&!k)throw Error(S.error);return i.skipEscape=!0,b(S,i)},resolveComponent:_,equal:function(e,t,r){let a=T(e,r),i=T(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}),uJ=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uH();t.code='require("ajv/dist/runtime/uri").default',e.default=t}),uB=K(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=uM();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=uw();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=uL(),i=uZ(),n=uE(),s=uD(),o=uw(),l=uz(),c=uT(),u=uk(),d=uV(),p=uJ(),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,s,l,c,u,d,h,v,b,R,P,E,j,T,O,C,I,N,q,A,z,M,L;let Z,D,V,F,U;this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...(Z=(t=e).strict,V=!0===(D=null==(r=t.code)?void 0:r.optimize)||void 0===D?1:D||0,F=null!=(i=null==(a=t.code)?void 0:a.regExp)?i:m,U=null!=(s=t.uriResolver)?s: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!=(R=null!=(b=t.strictTuples)?b:Z)?R:"log",strictRequired:null!=(E=null!=(P=t.strictRequired)?P:Z)&&E,code:t.code?{...t.code,optimize:V,regExp:F}:{optimize:V,regExp:F},loopRequired:null!=(j=t.loopRequired)?j:200,loopEnum:null!=(T=t.loopEnum)?T: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:U})};let{es5:H,lines:J}=this.opts.code;this.scope=new o.ValueScope({scope:{},prefixes:f,es5:H,lines:J}),this.logger=function(e){if(!1===e)return x;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=k.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||s.call(this,r)}async function n(e){e&&!this.getSchema(e)&&await a.call(this,{$ref:e},!0)}async function s(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof i.default))throw t;return o.call(this,t),await l.call(this,t.missingSchema),s.call(this,e)}}function o({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 s.SchemaEnv({schema:{},schemaId:r});if(!(t=s.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;T.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:o}=this.opts;if("object"==typeof e)n=e[o];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 s.SchemaEnv({schema:e,schemaId:o,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):s.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{s.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 k(){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 x={log(){},warn(){},error(){}},R=/^[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(!R.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,s=i?n.post:n.rules.find(({type:e})=>e===r);if(s||(s={type:r,rules:[]},n.rules.push(s)),n.keywords[e]=!0,!t)return;let o={keyword:e,definition:{...t,type:(0,c.getJSONTypes)(t.type),schemaType:(0,c.getJSONTypes)(t.schemaType)}};t.before?j.call(this,s,o,t.before):s.rules.push(o),n.all[e]=o,null==(a=t.implements)||a.forEach(e=>this.addKeyword(e))}function j(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 T(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]}}}),uK=K(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}}}),uW=K(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;let t=uZ(),r=uC(),a=uw(),i=ux(),n=uD(),s=uk();function o(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,o){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=s.mergeEvaluated.props(l,r.props,c.props));else{let t=l.var("props",(0,a._)`${e}.evaluated.props`);c.props=s.mergeEvaluated.props(l,t,c.props,a.Name)}if(!0!==c.items)if(r&&!r.dynamicItems)void 0!==r.items&&(c.items=s.mergeEvaluated.items(l,r.items,c.items));else{let t=l.var("items",(0,a._)`${e}.evaluated.items`);c.items=s.mergeEvaluated.items(l,t,c.items,a.Name)}}o?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=o,e.callRef=l,e.default={keyword:"$ref",schemaType:"string",code(e){let r,i,s,{gen:c,schema:u,it:d}=e,{baseId:p,schemaEnv:m,validateName:h,opts:f,self:g}=d,{root:y}=m;if(("#"===u||"#/"===u)&&p===y.baseId){if(m===y)return l(e,h,m,m.$async);let t=c.scopeValue("root",{ref:y});return l(e,(0,a._)`${t}.validate`,y,y.$async)}let v=n.resolveRef.call(g,y,p,u);if(void 0===v)throw new t.default(d.opts.uriResolver,p,u);v instanceof n.SchemaEnv?l(e,o(e,v),v,v.$async):(r=c.scopeValue("schema",!0===f.code.source?{ref:v,code:(0,a.stringify)(v)}:{ref:v}),i=c.name("valid"),s=e.subschema({schema:v,dataTypes:[],schemaPath:a.nil,topSchemaRef:r,errSchemaPath:u},i),e.mergeEvaluated(s),e.ok(i))}}}),uG=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uK(),r=uW();e.default=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,r.default]}),uY=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uw(),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})`)}}}),uQ=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uw();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,s=n.opts.multipleOfPrecision,o=r.let("res"),l=s?(0,t._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${s}`:(0,t._)`${o} !== parseInt(${o})`;e.fail$data((0,t._)`(${i} === 0 || (${o} = ${a}/${i}, ${l}))`)}}}),uX=K(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'}),u0=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uw(),r=uk(),a=uX();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:s,it:o}=e,l="maxLength"===i?t.operators.GT:t.operators.LT,c=!1===o.opts.unicode?(0,t._)`${n}.length`:(0,t._)`${(0,r.useFunc)(e.gen,a.default)}(${n})`;e.fail$data((0,t._)`${c} ${l} ${s}`)}}}),u1=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uC(),r=uk(),a=uw();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:s,schema:o,schemaCode:l,it:c}=e,u=c.opts.unicodeRegExp?"u":"";if(s){let{regExp:t}=c.opts.code,s="new RegExp"===t.code?(0,a._)`new RegExp`:(0,r.useFunc)(i,t),o=i.let("valid");i.try(()=>i.assign(o,(0,a._)`${s}(${l}, ${u}).test(${n})`),()=>i.assign(o,!1)),e.fail$data((0,a._)`!${o}`)}else{let r=(0,t.usePattern)(e,o);e.fail$data((0,a._)`!${r}.test(${n})`)}}}}),u2=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uw();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}`)}}}),u9=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uC(),r=uw(),a=uk();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:s,data:o,$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,()=>{e.setParams({missingProperty:a}),i.forOf(a,s,()=>{i.assign(n,(0,t.propertyInData)(i,o,a,u.ownProperties)),i.if((0,r.not)(n),()=>{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",s,r=>{e.setParams({missingProperty:r}),i.if((0,t.noPropertyInData)(i,o,r,u.ownProperties),()=>e.error())})}}}}),u4=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uw();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}`)}}}),u6=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uq();t.code='require("ajv/dist/runtime/equal").default',e.default=t}),u5=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uT(),r=uw(),a=uk(),i=u6();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:s,$data:o,schema:l,parentSchema:c,schemaCode:u,it:d}=e;if(!o&&!l)return;let p=n.let("valid"),m=c.items?(0,t.getSchemaTypes)(c.items):[];e.block$data(p,function(){let o=n.let("i",(0,r._)`${s}.length`),l=n.let("j");e.setParams({i:o,j:l}),n.assign(p,!0),n.if((0,r._)`${o} > 1`,()=>(m.length>0&&!m.some(e=>"object"===e||"array"===e)?function(a,i){let o=n.name("item"),l=(0,t.checkDataTypes)(m,o,d.opts.strictNumbers,t.DataType.Wrong),c=n.const("indices",(0,r._)`{}`);n.for((0,r._)`;${a}--;`,()=>{n.let(o,(0,r._)`${s}[${a}]`),n.if(l,(0,r._)`continue`),m.length>1&&n.if((0,r._)`typeof ${o} == "string"`,(0,r._)`${o} += "_"`),n.if((0,r._)`typeof ${c}[${o}] == "number"`,()=>{n.assign(i,(0,r._)`${c}[${o}]`),e.error(),n.assign(p,!1).break()}).code((0,r._)`${c}[${o}] = ${a}`)})}:function(t,o){let l=(0,a.useFunc)(n,i.default),c=n.name("outer");n.label(c).for((0,r._)`;${t}--;`,()=>n.for((0,r._)`${o} = ${t}; ${o}--;`,()=>n.if((0,r._)`${l}(${s}[${t}], ${s}[${o}])`,()=>{e.error(),n.assign(p,!1).break(c)})))})(o,l))},(0,r._)`${u} === false`),e.ok(p)}}}),u3=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uw(),r=uk(),a=u6();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:s,schemaCode:o,schema:l}=e;s||l&&"object"==typeof l?e.fail$data((0,t._)`!${(0,r.useFunc)(i,a.default)}(${n}, ${o})`):e.fail((0,t._)`${l} !== ${n}`)}}}),u8=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uw(),r=uk(),a=u6();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:s,data:o,$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)(s,a.default);if(p||l)n=s.let("valid"),e.block$data(n,function(){s.assign(n,!1),s.forOf("v",u,e=>s.if((0,t._)`${m()}(${o}, ${e})`,()=>s.assign(n,!0).break()))});else{if(!Array.isArray(c))throw Error("ajv implementation error");let e=s.const("vSchema",u);n=(0,t.or)(...c.map((r,a)=>{let i;return"object"==typeof(i=c[a])&&null!==i?(0,t._)`${m()}(${o}, ${e}[${a}])`:(0,t._)`${o} === ${i}`}))}e.pass(n)}}}),u7=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uY(),r=uQ(),a=u0(),i=u1(),n=u2(),s=u9(),o=u4(),l=u5(),c=u3(),u=u8();e.default=[t.default,r.default,a.default,i.default,n.default,s.default,o.default,l.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},c.default,u.default]}),de=K(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;let t=uw(),r=uk();function a(e,a){let{gen:i,schema:n,data:s,keyword:o,it:l}=e;l.items=!0;let c=i.const("len",(0,t._)`${s}.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),()=>{i.forRange("i",a.length,c,a=>{e.subschema({keyword:o,dataProp:a,dataPropType:r.Type.Num},n),l.allErrors||i.if((0,t.not)(n),()=>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')}}}),dt=K(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;let t=uw(),r=uk(),a=uC();function i(e,a,n=e.schema){let{gen:s,parentSchema:o,data:l,keyword:c,it:u}=e;(function(e){let{opts:t,errSchemaPath:i}=u,s=n.length,o=s===e.minItems&&(s===e.maxItems||!1===e[a]);if(t.strictTuples&&!o){let e=`"${c}" is ${s}-tuple, but minItems or maxItems/${a} are not specified or different at path "${i}"`;(0,r.checkStrictMode)(u,e,t.strictTuples)}})(o),u.opts.unevaluated&&n.length&&!0!==u.items&&(u.items=r.mergeEvaluated.items(s,n.length,u.items));let d=s.name("valid"),p=s.const("len",(0,t._)`${l}.length`);n.forEach((a,i)=>{(0,r.alwaysValidSchema)(u,a)||(s.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))}}}),dr=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=dt();e.default={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,t.validateTuple)(e,"items")}}),da=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uw(),r=uk(),a=uC(),i=de();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:s}=e,{prefixItems:o}=n;s.items=!0,(0,r.alwaysValidSchema)(s,t)||(o?(0,i.validateAdditionalItems)(e,o):e.ok((0,a.validateArray)(e)))}}}),di=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uw(),r=uk();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:s,parentSchema:o,data:l,it:c}=e,{minContains:u,maxContains:d}=o;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,s)){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,()=>{n.code((0,t._)`${r}++`),void 0===i?n.if((0,t._)`${r} >= ${a}`,()=>n.assign(m,!0).break()):(n.if((0,t._)`${r} > ${i}`,()=>n.assign(m,!1).break()),1===a?n.assign(m,!0):n.if((0,t._)`${r} >= ${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())}}}),dn=K(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;let t=uw(),r=uk(),a=uC();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},
65
+ missingProperty: ${i},
66
+ depsCount: ${r},
67
+ 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),s(e,r)}};function n(e,r=e.schema){let{gen:i,data:s,it:o}=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,s,n,o.opts.ownProperties);e.setParams({property:n,depsCount:c.length,deps:c.join(", ")}),o.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 s(e,t=e.schema){let{gen:i,data:n,keyword:o,it:l}=e,c=i.name("valid");for(let s in t)(0,r.alwaysValidSchema)(l,t[s])||(i.if((0,a.propertyInData)(i,n,s,l.opts.ownProperties),()=>{let t=e.subschema({keyword:o,schemaProp:s},c);e.mergeValidEvaluated(t,c)},()=>i.var(c,!0)),e.ok(c))}e.validatePropertyDeps=n,e.validateSchemaDeps=s,e.default=i}),ds=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uw(),r=uk();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:s}=e;if((0,r.alwaysValidSchema)(s,i))return;let o=a.name("valid");a.forIn("key",n,r=>{e.setParams({propertyName:r}),e.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:!0},o),a.if((0,t.not)(o),()=>{e.error(!0),s.allErrors||a.break()})}),e.ok(o)}}}),dl=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uC(),r=uw(),a=ux(),i=uk();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:s,parentSchema:o,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,s))return;let m=(0,t.allSchemaProperties)(o.properties),h=(0,t.allSchemaProperties)(o.patternProperties);function f(e){n.code((0,r._)`delete ${l}[${e}]`)}function g(t){if("all"===p.removeAdditional||p.removeAdditional&&!1===s)return void f(t);if(!1===s){e.setParams({additionalProperty:t}),e.error(),d||n.break();return}if("object"==typeof s&&!(0,i.alwaysValidSchema)(u,s)){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 s;if(m.length>8){let e=(0,i.schemaRefOrVal)(u,o.properties,"properties");s=(0,t.isOwnProperty)(n,e,a)}else s=m.length?(0,r.or)(...m.map(e=>(0,r._)`${a} === ${e}`)):r.nil;return h.length&&(s=(0,r.or)(s,...h.map(i=>(0,r._)`${(0,t.usePattern)(e,i)}.test(${a})`))),(0,r.not)(s)}(a),()=>g(a)):g(a)}),e.ok((0,r._)`${c} === ${a.default.errors}`)}}}),dc=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uM(),r=uC(),a=uk(),i=dl();e.default={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:n,schema:s,parentSchema:o,data:l,it:c}=e;"all"===c.opts.removeAdditional&&void 0===o.additionalProperties&&i.default.code(new t.KeywordCxt(c,i.default,"additionalProperties"));let u=(0,r.allSchemaProperties)(s);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,s[e]));if(0===d.length)return;let p=n.name("valid");for(let t of d)c.opts.useDefaults&&!c.compositeRule&&void 0!==s[t].default?m(t):(n.if((0,r.propertyInData)(n,l,t,c.opts.ownProperties)),m(t),c.allErrors||n.else().var(p,!0),n.endIf()),e.it.definedProperties.add(t),e.ok(p);function m(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},p)}}}}),du=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uC(),r=uw(),a=uk(),i=uk();e.default={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:n,schema:s,data:o,parentSchema:l,it:c}=e,{opts:u}=c,d=(0,t.allSchemaProperties)(s),p=d.filter(e=>(0,a.alwaysValidSchema)(c,s[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",o,s=>{n.if((0,r._)`${(0,t.usePattern)(e,a)}.test(${s})`,()=>{let t=p.includes(a);t||e.subschema({keyword:"patternProperties",schemaProp:a,dataProp:s,dataPropType:i.Type.Str},h),c.opts.unevaluated&&!0!==f?n.assign((0,r._)`${f}[${s}]`,!0):t||c.allErrors||n.if((0,r.not)(h),()=>n.break())})})}}}}),dd=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uk();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"}}}),dp=K(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:uC().validateUnion,error:{message:"must match a schema in anyOf"}}}),dm=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uw(),r=uk();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:s}=e;if(!Array.isArray(i))throw Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;let o=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)(s,i)?a.var(c,!0):u=e.subschema({keyword:"oneOf",schemaProp:n,compositeRule:!0},c),n>0&&a.if((0,t._)`${c} && ${o}`).assign(o,!1).assign(l,(0,t._)`[${l}, ${n}]`).else(),a.if(c,()=>{a.assign(o,!0),a.assign(l,n),u&&e.mergeEvaluated(u,t.Name)})})}),e.result(o,()=>e.reset(),()=>e.error(!0))}}}),dh=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uk();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 s=e.subschema({keyword:"allOf",schemaProp:a},n);e.ok(n),e.mergeEvaluated(s)})}}}),df=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uw(),r=uk();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:s,it:o}=e;void 0===s.then&&void 0===s.else&&(0,r.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let l=a(o,"then"),c=a(o,"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))}}}),dg=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uk();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`)}}}),dy=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=dr(),a=dt(),i=da(),n=di(),s=dn(),o=ds(),l=dl(),c=dc(),u=du(),d=dd(),p=dp(),m=dm(),h=dh(),f=df(),g=dg();e.default=function(e=!1){let y=[d.default,p.default,m.default,h.default,f.default,g.default,o.default,l.default,s.default,c.default,u.default];return e?y.push(r.default,i.default):y.push(t.default,a.default),y.push(n.default),y}}),dv=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uw();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,s,o,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"),s=c.let("format"),c.if((0,t._)`typeof ${i} == "object" && !(${i} instanceof RegExp)`,()=>c.assign(n,(0,t._)`${i}.type || "string"`).assign(s,(0,t._)`${i}.validate`),()=>c.assign(n,(0,t._)`"string"`).assign(s,i)),e.fail$data((0,t.or)(!1===f.strictSchema?t.nil:(0,t._)`${m} && !${s}`,(o=y.$async?(0,t._)`(${i}.async ? await ${s}(${u}) : ${s}(${u}))`:(0,t._)`${s}(${u})`,l=(0,t._)`(typeof ${s} == "function" ? ${o} : ${s}.test(${u}))`,(0,t._)`${s} && ${s} !== true && ${n} === ${r} && !${l}`)))):function(){let a,i,n=v.formats[p];if(!n){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===n)return;let[o,l,d]=(a=n instanceof RegExp?(0,t.regexpCode)(n):f.code.formats?(0,t._)`${f.code.formats}${(0,t.getProperty)(p)}`:void 0,i=c.scopeValue("formats",{key:p,ref:n,code:a}),"object"!=typeof n||n instanceof RegExp?["string",n,i]:[n.type||"string",n.validate,(0,t._)`${i}.validate`]);o===r&&e.pass(function(){if("object"==typeof n&&!(n instanceof RegExp)&&n.async){if(!y.$async)throw Error("async format in sync schema");return(0,t._)`await ${d}(${u})`}return"function"==typeof l?(0,t._)`${d}(${u})`:(0,t._)`${d}.test(${u})`}())}())}}}),d_=K(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=[dv().default]}),db=K(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"]}),dS=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uG(),r=u7(),a=dy(),i=d_(),n=db();e.default=[t.default,r.default,(0,a.default)(),i.default,n.metadataVocabulary,n.contentVocabulary]}),d$=K(e=>{var t,r;Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0,(r=t||(e.DiscrError=t={})).Tag="tag",r.Mapping="mapping"}),dw=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uw(),r=d$(),a=uD(),i=uZ(),n=uk();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:s,data:o,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=s.let("valid",!1),h=s.const("tag",(0,t._)`${o}${(0,t.getProperty)(p)}`);s.if((0,t._)`typeof ${h} == "string"`,()=>(function(){let o=function(){var e;let t={},r=o(c),s=!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}"`);s=s&&(r||o(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(!s)throw Error(`discriminator: "${p}" must be required`);return t;function o({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 s.if(!1),o)s.elseIf((0,t._)`${h} === ${r}`),s.assign(m,function(r){let a=s.name("valid"),i=e.subschema({keyword:"oneOf",schemaProp:r},a);return e.mergeEvaluated(i,t.Name),a}(o[r]));s.else(),e.error(!1,{discrError:r.DiscrError.Mapping,tag:h,tagName:p}),s.endIf()})(),()=>e.error(!1,{discrError:r.DiscrError.Tag,tag:h,tagName:p})),e.ok(m)}}}),dk=K((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}}),dx=K((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=uB(),a=dS(),i=dw(),n=dk(),s=["/properties"],o="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,s):n;this.addMetaSchema(e,o,!1),this.refs["http://json-schema.org/schema"]=o}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(o)?o:void 0)}};e.Ajv=l,t.exports=e=l,t.exports.Ajv=l,Object.defineProperty(e,"__esModule",{value:!0}),e.default=l;var c=uM();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=uw();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=uL();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return d.default}});var p=uZ();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}),dR=K(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicAnchor=void 0;let t=uw(),r=ux(),a=uD(),i=uW();function n(e,n){let{gen:s,it:o}=e;o.schemaEnv.root.dynamicAnchors[n]=!0;let l=(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(n)}`,c="#"===o.errSchemaPath?o.validateName:function(e){let{schemaEnv:t,schema:r,self:n}=e.it,{root:s,baseId:o,localRefs:l,meta:c}=t.root,{schemaId:u}=n.opts,d=new a.SchemaEnv({schema:r,schemaId:u,root:s,baseId:o,localRefs:l,meta:c});return a.compileSchema.call(n,d),(0,i.getValidate)(e,d)}(e);s.if((0,t._)`!${l}`,()=>s.assign(l,c))}e.dynamicAnchor=n,e.default={keyword:"$dynamicAnchor",schemaType:"string",code:e=>n(e,e.schema)}}),dP=K(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicRef=void 0;let t=uw(),r=ux(),a=uW();function i(e,i){let{gen:n,keyword:s,it:o}=e;if("#"!==i[0])throw Error(`"${s}" only supports hash fragment reference`);let l=i.slice(1);if(o.allErrors)c();else{let t=n.let("valid",!1);c(t),e.ok(t)}function c(e){if(o.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(o.validateName,e))}else u(o.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)}}),dE=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=dR(),r=uk();e.default={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){e.schema?(0,t.dynamicAnchor)(e,""):(0,r.checkStrictMode)(e.it,"$recursiveAnchor: false is ignored")}}}),dj=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=dP();e.default={keyword:"$recursiveRef",schemaType:"string",code:e=>(0,t.dynamicRef)(e,e.schema)}}),dT=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=dR(),r=dP(),a=dE(),i=dj();e.default=[t.default,r.default,a.default,i.default]}),dO=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=dn();e.default={keyword:"dependentRequired",type:"object",schemaType:"object",error:t.error,code:e=>(0,t.validatePropertyDeps)(e)}}),dC=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=dn();e.default={keyword:"dependentSchemas",type:"object",schemaType:"object",code:e=>(0,t.validateSchemaDeps)(e)}}),dI=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uk();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`)}}}),dN=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=dO(),r=dC(),a=dI();e.default=[t.default,r.default,a.default]}),dq=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uw(),r=uk(),a=ux();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:s,errsCount:o,it:l}=e;if(!o)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",s,e=>i.if((0,t._)`!${u} || !${u}[${e}]`,()=>d(e)))):!0!==u&&i.forIn("key",s,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._)`${o} === ${a.default.errors}`)}}}),dA=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uw(),r=uk();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:s}=e,o=s.items||0;if(!0===o)return;let l=a.const("len",(0,t._)`${n}.length`);if(!1===i)e.setParams({len:o}),e.fail((0,t._)`${l} > ${o}`);else if("object"==typeof i&&!(0,r.alwaysValidSchema)(s,i)){let i=a.var("valid",(0,t._)`${l} <= ${o}`);a.if((0,t.not)(i),()=>{a.forRange("i",o,l,n=>{e.subschema({keyword:"unevaluatedItems",dataProp:n,dataPropType:r.Type.Num},i),s.allErrors||a.if((0,t.not)(i),()=>a.break())})}),e.ok(i)}s.items=!0}}}),dz=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=dq(),r=dA();e.default=[t.default,r.default]}),dM=K((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"}]}}}}}),dL=K((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:"#"}}}}}),dZ=K((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:"#"}}}}),dD=K((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:{}}}}}),dV=K((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"}}}}),dF=K((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}}}}),dU=K((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:[]}}}}),dH=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=dM(),r=dL(),a=dZ(),i=dD(),n=dV(),s=dF(),o=dU(),l=["/properties"];e.default=function(e){return[t,r,a,i,c(this,n),s,c(this,o)].forEach(e=>this.addMetaSchema(e,void 0,!1)),this;function c(t,r){return e?t.$dataMetaSchema(r,l):r}}}),dJ=K((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=uB(),a=dS(),i=dT(),n=dN(),s=dz(),o=dw(),l=dH(),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(s.default),this.opts.discriminator&&this.addKeyword(o.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=uM();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return d.KeywordCxt}});var p=uw();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=uL();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return m.default}});var h=uZ();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return h.default}})}),dB=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uG(),r=u7(),a=dy(),i=dT(),n=dN(),s=dz(),o=d_(),l=db();e.default=[i.default,t.default,r.default,(0,a.default)(!0),o.default,l.metadataVocabulary,l.contentVocabulary,n.default,s.default]}),dK=K((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}}}}),dW=K((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"}}}}}),dG=K((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"}}}}),dY=K((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"}}}}),dQ=K((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"}}}}),dX=K((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"}}}}),d0=K((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}}}}),d1=K((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:[]}}}}),d2=K(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=dK(),r=dW(),a=dG(),i=dY(),n=dQ(),s=dX(),o=d0(),l=d1(),c=["/properties"];e.default=function(e){return[t,r,a,i,n,u(this,s),o,u(this,l)].forEach(e=>this.addMetaSchema(e,void 0,!1)),this;function u(t,r){return e?t.$dataMetaSchema(r,c):r}}}),d9=K((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=uB(),a=dB(),i=dw(),n=d2(),s="https://json-schema.org/draft/2020-12/schema";var o=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"]=s)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};e.Ajv2020=o,t.exports=e=o,t.exports.Ajv2020=o,Object.defineProperty(e,"__esModule",{value:!0}),e.default=o;var l=uM();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var c=uw();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=uL();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return u.default}});var d=uZ();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return d.default}})}),d4=K(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(o(!0),l),"date-time":t(d(!0),p),"iso-time":t(o(),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],s=+i[2],o=+i[3];return s>=1&&s<=12&&o>=1&&o<=(2===s&&(t=n)%4==0&&(t%100!=0||t%400==0)?29:a[s])}function n(e,t){if(e&&t)return e>t?1:e<t?-1:0}let s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function o(e){return function(t){let r=s.exec(t);if(!r)return!1;let a=+r[1],i=+r[2],n=+r[3],o=r[4],l="-"===r[5]?-1:1,c=+(r[6]||0),u=+(r[7]||0);if(c>23||u>59||e&&!o)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=s.exec(e),a=s.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=o(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,s]=t.split(u),o=n(r,i);if(void 0!==o)return o||l(a,s)}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/}),d6=K(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;let t=dx(),r=uw(),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:s,data:o,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(${o}, ${l}) ${i[c].fail} 0`}m.$data?(a=s.scopeValue("formats",{ref:p.formats,code:d.code.formats}),n=s.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=s.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)}),d5=K((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});let r=d4(),a=d6(),i=uw(),n=new i.Name("fullFormats"),s=new i.Name("fastFormats"),o=(e,t={keywords:!0})=>{if(Array.isArray(t))return l(e,t,r.fullFormats,n),e;let[i,o]="fast"===t.mode?[r.fastFormats,s]:[r.fullFormats,n];return l(e,t.formats||r.formatNames,i,o),t.keywords&&(0,a.default)(e),e};function l(e,t,r,a){var n;for(let s of(null!=(n=e.opts.code).formats||(n.formats=(0,i._)`require("ajv-formats/dist/formats").${a}`),t))e.addFormat(s,r[s])}o.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=o,Object.defineProperty(e,"__esModule",{value:!0}),e.default=o}),d3=dx(),d8=dJ(),d7=d9();let pe=((e,t,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var a,i=H(t),n=0,s=i.length;n<s;n++)a=i[n],B.call(e,a)||void 0===a||F(e,a,{get:(e=>t[e]).bind(null,a),enumerable:!(r=U(t,a))||r.enumerable});return e})(F(null!=(P=d5())?V(J(P)):{},"default",{value:P,enumerable:!0}),P).default;function pt(e){let t=new e({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return pe(t),t}var pr=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(e){this._userAjv=void 0!==e,this._ajv=e}get ajv(){return this._ajv??=pt(d7.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(W.has(r))return"2020-12";if(G.has(r))return"2019-09";if(Y.has(r)||Q.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??=pt(d8.Ajv2019):this._ajvDraft7??=pt(d3.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)}}};d3.Ajv;let pa=r(708),pi=Symbol.for("mcp.completable");function pn(e){return!!e&&"object"==typeof e&&pi in e}var ps=class{static{f=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 lD(lZ.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(cV(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=sa.safeParse(e).success||si.safeParse(e).success,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=si.safeParse(e).success?e.error.code:void 0,r=void 0!==t&&(this._dispatchWindowOpen||t===cc.MissingRequiredClientCapability)?cG[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}
68
+
69
+ `)}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 lD(lZ.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=function(e,t){if(!Number.isFinite(e)||e<1)return;let r=setInterval(t,Math.min(e,0x7fffffff));return r.unref?.(),r}(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
70
+ data: ${JSON.stringify(e)}
71
+
72
+ `)}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 po(e,t,r){if(null===r||"object"!=typeof r||"string"!=typeof r.method)throw new cu(cc.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 cu(cc.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 pl(e,t){if("tools/call"===e)return{content:[{type:"text",text:t}],isError:!0};throw new cu(cc.InternalError,t)}var pc=class{constructor(e){this._host=e}async fulfill(e,t,r,a,i){let{maxRounds:n,roundTimeoutMs:s}=this._host,o=a.mcpReq.signal,l=i,c=0;for(;;){let i;if((c+=1)>n)return pl(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 cu(cc.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:s}=po(e,a,i);if("roots/list"!==n.method&&void 0===n.params)throw new cu(cc.InternalError,`Handler for ${e} returned an input request '${a}' of kind '${n.method}' without params`);if(void 0!==lF(s,t))return pl(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)}}(o);try{let e={relatedRequestId:a.mcpReq.id,timeout:s,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(o.aborted)throw t;return pl(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 lD?e.reason:new lD(lZ.RequestTimeout,String(e.reason)));let a=setTimeout(()=>{e?.removeEventListener("abort",i),t()},250),i=()=>{clearTimeout(a),r(e?.reason instanceof lD?e.reason:new lD(lZ.RequestTimeout,String(e?.reason)))};e?.addEventListener("abort",i,{once:!0})})}(o);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=up(m,t))}let h=await t(r,m);if(!cF(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 pu=new Set(["tools/call","prompts/get","resources/read"]);var pd=class extends um{_clientCapabilities;_clientVersion;static{g=(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())},y=e=>e._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_boundFromTransport=!1;_legacyInputRequiredShim(){return this._legacyShim??=new pc({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 pr,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&&cl(r,`cacheHints['${e}']`);this._cacheHints=t.cacheHints}this.setRequestHandler("initialize",e=>this._oninitialize(e)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),lJ(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 lD(lZ.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 ps?f(e):void 0)?.revision;void 0!==t&&!this._servedModernEra()&&lH.includes(t)&&lJ(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=i$(ow,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?.[nK]))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(ow.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 lD(lZ.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]=uh(i)&&uh(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=pu.has(e);return void 0!==r||a?async(i,n)=>{let s=a?await this._invokeInputRequiredCapableHandler(e,t,i,n):await t(i,n);if(cF(s)){if(!a)throw new cu(cc.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 s}return void 0===r?s:cn(s,r)}:async(r,a)=>{let i=await t(r,a);if(cF(i))throw new cu(cc.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=cT(this._negotiatedProtocolVersion),i=a.validateRequest("tools/call",e);if(!i.ok)throw new cu("not-in-era"===i.reason?cc.InternalError:cc.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(cF(n))return n;let s=lW(n),o=a.validateResult("tools/call",s);if(!o.ok)throw new cu("not-in-era"===o.reason?cc.InternalError:cc.InvalidParams,"not-in-era"===o.reason?"No wire schema for tools/call in the resolved era":`Invalid tools/call result: ${o.message}`);return o.value}}_servedModernEra(){return void 0!==this._negotiatedProtocolVersion&&this._negotiatedProtocolVersion>=lU}async _invokeInputRequiredCapableHandler(e,t,r,a){let i,n=this._servedModernEra(),s=a.mcpReq.requestState();if(void 0!==s&&"string"!=typeof s)throw new cu(cc.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"});let o=a;if("string"==typeof s){let t=await this._verifyRequestState(s,a,e);void 0!==t&&(o=up(a,t))}try{i=await t(r,o)}catch(e){if(e instanceof cu&&e.code===cc.UrlElicitationRequired){if(!n)throw e;throw new cu(cc.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(!cF(i))return i;if(!n){if(!this._inputRequiredServing.legacyShim)throw new cu(cc.InternalError,`Handler for ${e} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??nD}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(e,t,r,o,i)}let l=i.inputRequests,c=null!=l&&Object.keys(l).length>0,u="string"==typeof i.requestState;if(!c&&!u)throw new cu(cc.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}=po(e,r,a),s=lF(n,t);if(void 0!==s)throw new ch({requiredCapabilities:s},`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 cu(cc.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(e){return this._servedModernEra()?e.mcpReq.envelope?.[nJ]:this._clientCapabilities}_assertPushApiInServedEra(e){if(this._servedModernEra())throw new lD(lZ.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 lD(lZ.CapabilityNotSupported,`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new lD(lZ.CapabilityNotSupported,`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new lD(lZ.CapabilityNotSupported,`Client does not support listing roots (required for ${e})`)}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new lD(lZ.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 lD(lZ.CapabilityNotSupported,`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new lD(lZ.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 lD(lZ.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 lD(lZ.CapabilityNotSupported,`Client does not support URL elicitation (required for ${e})`)}}assertRequestHandlerCapability(e){switch(e){case"completion/complete":if(!this._capabilities.completions)throw new lD(lZ.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new lD(lZ.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new lD(lZ.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 lD(lZ.CapabilityNotSupported,`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new lD(lZ.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>=lU)),a=r.includes(t)?t:r[0]??nD;return this._negotiatedProtocolVersion=a,this.transport?.setProtocolVersion?.(a),{protocolVersion:a,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:lJ(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 lD(lZ.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]:[],s=n.some(e=>"tool_use"===e.type);if(a){if(r.some(e=>"tool_result"!==e.type))throw new cu(cc.InvalidParams,"The last message must contain only tool_result content if any is present");if(!s)throw new cu(cc.InvalidParams,"tool_result blocks are not matching any tool_use from the previous message")}if(s){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 cu(cc.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 lD(lZ.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 lD(lZ.CapabilityNotSupported,"Client does not support url elicitation.");break;case"form":if(!this._clientCapabilities?.elicitation?.form)throw new lD(lZ.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 cu(cc.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(e){if(e instanceof cu)throw e;throw new cu(cc.InternalError,`Error validating elicitation response: ${e instanceof Error?e.message:String(e)}`)}return a}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw new lD(lZ.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"})}},pp=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 pf;try{let r=c9(t.inputSchema,"input");return this._toolInputSchemaJson[e]=r,r}catch{return}}}constructor(e,t){this.server=new pd(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])=>{let r,a,i,n,s,o,l,c={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?(o=c9(t.inputSchema,"input"),(a=[],i=new Map,l=void 0!==(s=(n=(e,t,s)=>{if(null===e||"object"!=typeof e)return;if(cU in e){if(!s||0===t.length)return`${cW(t)}: 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=e[cU];if("string"!=typeof n||0===n.length)return`${cW(t)}: x-mcp-header MUST be a non-empty string`;if(!cH.test(n))return`${cW(t)}: x-mcp-header '${n}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let o="string"==typeof e.type?e.type:void 0;if(void 0===o||!cJ.has(o)){let e=`${cW(t)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${o??"<none>"}`;if("number"!==o)return e;r??=e}let l=n.toLowerCase(),c=i.get(l);if(void 0!==c)return`x-mcp-header '${n}' is not case-insensitively unique (also declared as '${c}')`;i.set(l,n),a.push({path:t,headerName:n,type:o})}let o=e.properties;if(null!==o&&"object"==typeof o)for(let[e,r]of Object.entries(o)){let a=n(r,[...t,e],s);if(void 0!==a)return a}for(let r of cB){let a=e[r];if(void 0!==a)for(let e of Array.isArray(a)?a:null!==a&&"object"==typeof a&&cK.has(r)?Object.values(a):[a]){let a=n(e,[...t,`<${r}>`],!1);if(void 0!==a)return a}}})(o,[],!0))?{valid:!1,reason:r??s}:void 0===r?{valid:!0,declarations:a}:{valid:!1,reason:r,declarations:a}).valid||console.warn(`[mcp-sdk] tool '${e}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${l.reason}`),o):pf,annotations:t.annotations,icons:t.icons,execution:t.execution,_meta:t._meta};return t.outputSchema&&(c.outputSchema=c9(t.outputSchema,"output")),c})})),this.server.setRequestHandler("tools/call",async(e,t)=>{let r=this._registeredTools[e.params.name];if(!r)throw new cu(cc.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new cu(cc.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),cF(i))return i;return this.server.projectCallToolResult(i,r.outputSchemaJson)}catch(e){if(e instanceof cu&&e.code===cc.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 cu(cc.InvalidParams,`Invalid arguments for tool ${r}: arguments contain more than the maximum of ${this._maxToolInputElements} elements`);if(!e.inputSchema)return;let a=await c6(e.inputSchema,t??{});if(!a.success)throw new cu(cc.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${a.error}`);return a.data}async validateToolOutput(e,t,r){if(!e.outputSchema||cF(t)||t.isError)return;if(void 0===t.structuredContent)throw new cu(cc.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let a=await c6(e.outputSchema,t.structuredContent);if(!a.success)throw new cu(cc.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 cu(cc.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,t){let r=this._registeredPrompts[t.name];if(!r)throw new cu(cc.InvalidParams,`Prompt ${t.name} not found`);if(!r.enabled)throw new cu(cc.InvalidParams,`Prompt ${t.name} disabled`);if(!r.argsSchema)return p_;let a=pS(pb(r.argsSchema)?.[e.params.argument.name]);if(!pn(a))return p_;let i=a[pi]?.complete;return i?pv(await i(e.params.argument.value,e.params.context)):p_}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 p_;throw new cu(cc.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)):p_}_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 cu(cc.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 cu(cc.InvalidParams,`Resource ${r} disabled`);return cn(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 cu(cc.InvalidParams,`Resource template ${e.resourceTemplate.uriTemplate} disabled`);return cn(await e.readCallback(r,a,t),e.cacheHint)}}throw new cd(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=c9(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 cu(cc.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new cu(cc.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,...s}=r;if(void 0!==i&&cl(i,`resource ${e}`),"string"==typeof t){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let o=this._createRegisteredResource(e,r.title,t,s,n,a);return void 0!==i&&(o.cacheHint=i),this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let o=this._createRegisteredResourceTemplate(e,r.title,t,s,n,a);return void 0!==i&&(o.cacheHint=i),this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}_createRegisteredResource(e,t,r,a,i,n){let s={name:e,title:t,metadata:a,readCallback:n,scopeChallenge:i,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({uri:null}),update:e=>{void 0!==e.uri&&e.uri!==r&&(delete this._registeredResources[r],e.uri&&(this._registeredResources[e.uri]=s)),void 0!==e.name&&(s.name=e.name),void 0!==e.metadata&&(s.metadata=e.metadata),void 0!==e.title&&(s.title=e.title,s.metadata={...s.metadata,title:e.title}),void 0!==e.callback&&(s.readCallback=e.callback),void 0!==e.scopeChallenge&&(s.scopeChallenge=null===e.scopeChallenge?void 0:e.scopeChallenge),void 0!==e.enabled&&(s.enabled=e.enabled),this.sendResourceListChanged()}};return this._registeredResources[r]=s,s}_createRegisteredResourceTemplate(e,t,r,a,i,n){let s={resourceTemplate:r,title:t,metadata:a,readCallback:n,scopeChallenge:i,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&(delete this._registeredResourceTemplates[e],t.name&&(this._registeredResourceTemplates[t.name]=s)),void 0!==t.template&&(s.resourceTemplate=t.template),void 0!==t.metadata&&(s.metadata=t.metadata),void 0!==t.title&&(s.title=t.title,s.metadata={...s.metadata,title:t.title}),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()}};this._registeredResourceTemplates[e]=s;let o=r.uriTemplate.variableNames;return Array.isArray(o)&&o.some(e=>!!r.completeCallback(e))&&this.setCompletionRequestHandler(),s}_createRegisteredPrompt(e,t,r,a,i,n,s,o){let l=a,c=i,u={title:t,description:r,argsSchema:a,icons:n,scopeChallenge:s,_meta:o,handler:py(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=py(e,l,c)),void 0!==t.enabled&&(u.enabled=t.enabled),this.sendPromptListChanged()}};if(this._registeredPrompts[e]=u,a){let e=pb(a);e&&Object.values(e).some(e=>pn(pS(e)))&&this.setCompletionRequestHandler()}return u}_createRegisteredTool(e,t,r,a,i,n,s,o,l,c,u){let d;uv(e);let p=u,m={title:t,description:r,inputSchema:a,outputSchema:i,get outputSchemaJson(){return d??=pg(m.outputSchema)},set outputSchemaJson(e){d=e},annotations:n,icons:s,execution:o,scopeChallenge:l,_meta:c,handler:u,executor:ph(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&&uv(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=ph(m.inputSchema,p)),void 0!==t.outputSchema&&(m.outputSchema=t.outputSchema,m.outputSchemaJson=pg(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:s,annotations:o,icons:l,scopeChallenge:c,_meta:u}=t;return this._createRegisteredTool(e,a,i,ub(n),ub(s),o,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:s,scopeChallenge:o,_meta:l}=t,c=this._createRegisteredPrompt(e,a,i,ub(n),r,s,o,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 u_(e):e}get uriTemplate(){return this._uriTemplate}get listCallback(){return this._callbacks.list}completeCallback(e){return this._callbacks.complete?.[e]}};function ph(e,t){return e?async(e,r)=>t(e,r):async(e,r)=>t(r)}let pf={type:"object",properties:{}};function pg(e){if(void 0!==e)try{return c9(e,"output")}catch{return}}function py(e,t,r){return t?async(a,i)=>{let n=await c6(t,a??{});if(!n.success)throw new cu(cc.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 p_={completion:{values:[],hasMore:!1}};function pb(e){if(e.shape&&"object"==typeof e.shape)return e.shape}function pS(e){return e?.type!=="optional"?e:e.def?.innerType??e}function p$(e,t){return{method:e.method,params:{...e.params,_meta:{...e.params?._meta,[nB]:t}}}}let pw=new Set(["notifications/tools/list_changed","notifications/prompts/list_changed","notifications/resources/list_changed","notifications/resources/updated"]);var pk=class{_subs=new Map;_serverCapabilities;_serverInfo;constructor(e=1024,t,r){this._maxSubscriptions=e,this._serverCapabilities=t,this._serverInfo=r}setServerCapabilities(e,t){this._serverCapabilities=e,void 0!==t&&(this._serverInfo=t)}has(e){return this._subs.has(e)}serve(e){var t;let r,a,i;if(void 0===this._serverCapabilities)throw Error("StdioListenRouter.serve() called before setServerCapabilities(); refusing to honor a filter without capabilities");if(this._subs.size>=this._maxSubscriptions)return{jsonrpc:"2.0",id:e.id,error:{code:-32603,message:"Subscription limit reached"}};let n=(r=cT(cj).validateRequest("subscriptions/listen",e)).ok?r.value.params?.notifications:void 0;if(void 0===n)return{jsonrpc:"2.0",id:e.id,error:{code:-32602,message:"Invalid params: 'notifications' is required and must be a valid SubscriptionFilter"}};let s=(t=this._serverCapabilities,a={},i=e=>void 0===t||!0===e,!0===n.toolsListChanged&&i(t?.tools?.listChanged)&&(a.toolsListChanged=!0),!0===n.promptsListChanged&&i(t?.prompts?.listChanged)&&(a.promptsListChanged=!0),!0===n.resourcesListChanged&&i(t?.resources?.listChanged)&&(a.resourcesListChanged=!0),void 0!==n.resourceSubscriptions&&n.resourceSubscriptions.length>0&&i(t?.resources?.subscribe)&&(a.resourceSubscriptions=[...n.resourceSubscriptions]),a);return this._subs.set(e.id,s),p$({method:"notifications/subscriptions/acknowledged",params:{notifications:s}},e.id)}cancel(e){return this._subs.delete(e)}routeOutbound(e){if(!pw.has(e.method))return"passthrough";let t=e.params?.uri,r=function(e,t){switch(e){case"notifications/tools/list_changed":return{kind:"tools_list_changed"};case"notifications/prompts/list_changed":return{kind:"prompts_list_changed"};case"notifications/resources/list_changed":return{kind:"resources_list_changed"};default:return{kind:"resource_updated",uri:t??""}}}(e.method,"string"==typeof t?t:void 0),a=[];for(let[t,i]of this._subs)(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)}})(i,r)&&a.push(p$({method:e.method,params:e.params??{}},t));return a}teardownAll(){let e=[];for(let t of this._subs.keys())e.push({jsonrpc:"2.0",id:t,result:{resultType:"complete",_meta:{[nB]:t,...void 0!==this._serverInfo&&{[nH]:this._serverInfo}}}});return this._subs.clear(),e}};let px=Symbol("swallowsErrorsAfterClose");var pR=class{_readBuffer;_started=!1;_closed=!1;constructor(e=pa.stdin,t=pa.stdout,r){this._stdin=e,this._stdout=t,this._readBuffer=new ug({maxBufferSize:r?.maxBufferSize})}onclose;onerror;onmessage;_ondata=e=>{try{this._readBuffer.append(e),this.processReadBuffer()}catch(e){this.onerror?.(e),this.close().catch(()=>{})}};_onerror=e=>{this.onerror?.(e)};_onstdouterror=e=>{this._closed||(this.onerror?.(e),this.close().catch(()=>{}))};_onstdinclose=()=>{this.close().catch(()=>{})};async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");for(let e of(this._started=!0,this._stdout.listeners("error")))e[px]&&this._stdout.off("error",e);(this._stdin.readableEnded||this._stdin.destroyed)&&setImmediate(this._onstdinclose),this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror),this._stdin.on("end",this._onstdinclose),this._stdin.on("close",this._onstdinclose),this._stdout.on("error",this._onstdouterror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(null===e)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._closed||(this._closed=!0,this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.off("end",this._onstdinclose),this._stdin.off("close",this._onstdinclose),this._onstdouterror[px]=!0,0===this._stdin.listenerCount("data")&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.())}send(e){return this._closed?Promise.reject(Error("StdioServerTransport is closed")):new Promise((t,r)=>{let a=JSON.stringify(e)+"\n",i=!1,n=e=>{i||(i=!0,this._stdout.off("error",n),this._stdout.off("drain",s),r(e))},s=()=>{i||(i=!0,this._stdout.off("error",n),this._stdout.off("drain",s),t())};if(this._stdout.once("error",n),this._stdout.write(a)){if(i)return;i=!0,this._stdout.off("error",n),t()}else i||this._stdout.once("drain",s)})}},pP=class{onclose;onerror;onmessage;_closed=!1;_pendingRequests=new Set;_drainWaiters=[];constructor(e,t,r){this._wire=e,this._onInstanceClose=t,this._outboundIntercept=r}async start(){}async send(e,t){if(sa.safeParse(e).success||si.safeParse(e).success){let{id:t}=e;void 0!==t&&this._settle(t)}if(!this._closed&&this._outboundIntercept?.(e)!=="handled")return this._wire.send(e,t)}setProtocolVersion=e=>{this._wire.setProtocolVersion?.(e)};deliver(e,t){if(!this._closed){if(cV(e))this._pendingRequests.add(e.id);else if(sr.safeParse(e).success&&"notifications/cancelled"===e.method){let t=e.params?.requestId;void 0!==t&&this._settle(t)}this.onmessage?.(e,t)}}async whenRequestsAnswered(e){return!!this._closed||0===this._pendingRequests.size||await new Promise(t=>{let r=()=>{clearTimeout(a),t(!0)},a=setTimeout(()=>{this._drainWaiters=this._drainWaiters.filter(e=>e!==r),t(!1)},e);this._drainWaiters.push(r)})}async close(){if(!this._closed){this._closed=!0,this._pendingRequests.clear(),this._releaseDrainWaiters();try{this._onInstanceClose()}finally{this.onclose?.()}}}_settle(e){this._pendingRequests.delete(e),0===this._pendingRequests.size&&this._releaseDrainWaiters()}_releaseDrainWaiters(){let e=this._drainWaiters;for(let t of(this._drainWaiters=[],e))t()}};function pE(e){return e instanceof Error?e:Error(String(e))}function pj(e){let{tags:t,enabled:r,...a}=e;return{...a,_meta:void 0===t?a._meta:{...a._meta,"xmcp/tags":t}}}let pT=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}},pO=r(290),pC=(e,t)=>{globalThis[e]=t},pI=e=>globalThis[e];function pN({name:e,fallback:t=!0}){let r=Symbol.for(`xmcp-context-${e}`),a=Symbol.for(`xmcp-context-${e}-fallback-store`);if(pI(r))return pI(r);let i=new pO.AsyncLocalStorage,n=globalThis[a]??{current:null};pC(a,n);let s={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 pC(r,s),s}let pq=pN({name:"http-request-context"});pq.setContext;let pA=pq.getContext;pq.provider;let pz=pN({name:"request-context",fallback:!1});function pM(){try{return pz.getContext().value}catch{throw Error("getRequestContext() can only be used while handling an MCP request.")}}function pL(e,t,r,a=!1){let i;if(a){let t;try{t=pz.getContext()}catch{}if(t?.request===e.mcpReq)return r()}let n=new Map;if(e.http){let e=pA(),t=Object.fromEntries(Object.entries(e.headers).map(([e,t])=>[e,Array.isArray(t)?Object.freeze([...t]):t]));i=Object.freeze({id:e.id,headers:Object.freeze(t)})}let s=Object.freeze({clientInfo:t?Object.freeze({...t}):void 0,http:i,authInfo:e.http?.authInfo,_meta:e.mcpReq._meta?Object.freeze({...e.mcpReq._meta}):void 0,signal:e.mcpReq.signal,set(e,t){n.set(e,t)},get:e=>n.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)});return pz.provider({request:e.mcpReq,value:s},r)}function pZ(e){let t=e?.["xmcp/tags"];return Array.isArray(t)?t:void 0}function pD(e,t,r=!1){let a;try{a=new URL(t).toString()}catch{return}for(let i of r?[t,a]:[a]){let t=e.uiOwners.get(i)??e.resources.get(i);if(t)return t}for(let{component:t,template:r}of e.templates.values())if(r.uriTemplate.match(a))return t}let pV=pN({name:"client-info-context"}),pF=pV.setContext,pU=pV.getContext,pH=pV.provider,pJ=e=>{if(!("object"==typeof e&&null!==e&&!Array.isArray(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},pB=(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}},pK=new Set(["message","mode","requestedSchema"]),pW=new Set(["elicitationId","message","mode","url"]),pG=new Set(["properties","required","type"]),pY=new Set(["default","description","format","maxLength","minLength","title","type"]),pQ=new Set(["default","description","enum","enumNames","title","type"]),pX=new Set(["default","description","title","type"]),p0=new Set(["default","description","maximum","minimum","title","type"]),p1=new Set(["date","date-time","email","uri"]);function p2(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 p9(e,t){if("object"!=typeof e||null===e||Array.isArray(e))throw Error(t)}function p4(e,t){if("string"!=typeof e)throw Error(t)}function p6(e,t){if("string"!=typeof e||0===e.trim().length)throw Error(t)}function p5(e,t){if(void 0!==e&&"string"!=typeof e)throw Error(t)}function p3(e,t){if(void 0!==e&&"number"!=typeof e)throw Error(t)}function p8(e,t){if(!Array.isArray(e)||e.some(e=>"string"!=typeof e))throw Error(t)}let p7=new Set(["_meta","includeContext","maxTokens","messages","metadata","modelPreferences","stopSequences","systemPrompt","temperature"]),me=new Set(["task","toolChoice","tools"]),mt=new Set(["text","image","audio"]);function mr(e,t){if("object"!=typeof e||null===e||Array.isArray(e))throw Error(t)}let ma={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 mi(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=ma[e.type];return t?t(e):{valid:!0}}let mn=Symbol("Let zodToJsonSchema decide on which parser to use"),ms={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"};(C=M||(M={})).assertEqual=e=>{},C.assertIs=function(e){},C.assertNever=function(e){throw Error()},C.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},C.getValidEnumValues=e=>{let t=C.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(let a of t)r[a]=e[a];return C.objectValues(r)},C.objectValues=e=>C.objectKeys(e).map(function(t){return e[t]}),C.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},C.find=(e,t)=>{for(let r of e)if(t(r))return r},C.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,C.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},C.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(L||(L={})).mergeShapes=(e,t)=>({...e,...t});let mo=M.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ml=e=>{switch(typeof e){case"undefined":return mo.undefined;case"string":return mo.string;case"number":return Number.isNaN(e)?mo.nan:mo.number;case"boolean":return mo.boolean;case"function":return mo.function;case"bigint":return mo.bigint;case"symbol":return mo.symbol;case"object":if(Array.isArray(e))return mo.array;if(null===e)return mo.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return mo.promise;if("u">typeof Map&&e instanceof Map)return mo.map;if("u">typeof Set&&e instanceof Set)return mo.set;if("u">typeof Date&&e instanceof Date)return mo.date;return mo.object;default:return mo.unknown}},mc=M.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 mu 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 mu))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,M.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()}}mu.create=e=>new mu(e);let md=(e,t)=>{let r;switch(e.code){case mc.invalid_type:r=e.received===mo.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case mc.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,M.jsonStringifyReplacer)}`;break;case mc.unrecognized_keys:r=`Unrecognized key(s) in object: ${M.joinValues(e.keys,", ")}`;break;case mc.invalid_union:r="Invalid input";break;case mc.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${M.joinValues(e.options)}`;break;case mc.invalid_enum_value:r=`Invalid enum value. Expected ${M.joinValues(e.options)}, received '${e.received}'`;break;case mc.invalid_arguments:r="Invalid function arguments";break;case mc.invalid_return_type:r="Invalid function return type";break;case mc.invalid_date:r="Invalid date";break;case mc.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}"`:M.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case mc.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 mc.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 mc.custom:r="Invalid input";break;case mc.invalid_intersection_types:r="Intersection results could not be merged";break;case mc.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case mc.not_finite:r="Number must be finite";break;default:r=t.defaultError,M.assertNever(e)}return{message:r}};function mp(e,t){let r=(e=>{let{data:t,path:r,errorMaps:a,issueData:i}=e,n=[...r,...i.path||[]],s={...i,path:n};if(void 0!==i.message)return{...i,path:n,message:i.message};let o="";for(let e of a.filter(e=>!!e).slice().reverse())o=e(s,{data:t,defaultError:o}).message;return{...i,path:n,message:o}})({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,md,void 0].filter(e=>!!e)});e.common.issues.push(r)}(I=Z||(Z={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},I.toString=e=>"string"==typeof e?e:e?.message;class mm{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 mh;"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 mm.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 mh;"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 mh=Object.freeze({status:"aborted"}),mf=e=>({status:"dirty",value:e}),mg=e=>({status:"valid",value:e}),my=e=>"u">typeof Promise&&e instanceof Promise;class mv{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 m_=(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 mu(e.common.issues);return this._error=t,this._error}}};function mb(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 mS{get description(){return this._def.description}_getType(e){return ml(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ml(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new mm,ctx:{common:e.parent.common,data:e.data,parsedType:ml(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(my(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:ml(e)},a=this._parseSync({data:e,path:r.path,parent:r});return m_(r,a)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ml(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:ml(e)},a=this._parse({data:e,path:r.path,parent:r});return m_(r,await (my(a)?a:Promise.resolve(a)))}refine(e,t){return this._refinement((r,a)=>{let i=e(r),n=()=>a.addIssue({code:mc.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 he({schema:this,typeName:D.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 ht.create(this,this._def)}nullable(){return hr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return mY.create(this)}promise(){return m7.create(this,this._def)}or(e){return mX.create([this,e],this._def)}and(e){return m0.create(this,e,this._def)}transform(e){return new he({...mb(this._def),schema:this,typeName:D.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new ha({...mb(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:D.ZodDefault})}brand(){return new hs({typeName:D.ZodBranded,type:this,...mb(this._def)})}catch(e){return new hi({...mb(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:D.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return ho.create(this,e)}readonly(){return hl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let m$=/^c[^\s-]{8,}$/i,mw=/^[0-9a-z]+$/,mk=/^[0-9A-HJKMNP-TV-Z]{26}$/i,mx=/^[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,mR=/^[a-z0-9_-]{21}$/i,mP=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,mE=/^[-+]?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)?)??$/,mj=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,mT=/^(?:(?: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])$/,mO=/^(?:(?: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])$/,mC=/^(([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]))$/,mI=/^(([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])$/,mN=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,mq=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,mA="((\\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])))",mz=RegExp(`^${mA}$`);function mM(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 mL extends mS{_parse(e){var t,r,a,i;let n;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==mo.string){let t=this._getOrReturnCtx(e);return mp(t,{code:mc.invalid_type,expected:mo.string,received:t.parsedType}),mh}let s=new mm;for(let o of this._def.checks)if("min"===o.kind)e.data.length<o.value&&(mp(n=this._getOrReturnCtx(e,n),{code:mc.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),s.dirty());else if("max"===o.kind)e.data.length>o.value&&(mp(n=this._getOrReturnCtx(e,n),{code:mc.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),s.dirty());else if("length"===o.kind){let t=e.data.length>o.value,r=e.data.length<o.value;(t||r)&&(n=this._getOrReturnCtx(e,n),t?mp(n,{code:mc.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):r&&mp(n,{code:mc.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),s.dirty())}else if("email"===o.kind)mj.test(e.data)||(mp(n=this._getOrReturnCtx(e,n),{validation:"email",code:mc.invalid_string,message:o.message}),s.dirty());else if("emoji"===o.kind)v||(v=RegExp("^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$","u")),v.test(e.data)||(mp(n=this._getOrReturnCtx(e,n),{validation:"emoji",code:mc.invalid_string,message:o.message}),s.dirty());else if("uuid"===o.kind)mx.test(e.data)||(mp(n=this._getOrReturnCtx(e,n),{validation:"uuid",code:mc.invalid_string,message:o.message}),s.dirty());else if("nanoid"===o.kind)mR.test(e.data)||(mp(n=this._getOrReturnCtx(e,n),{validation:"nanoid",code:mc.invalid_string,message:o.message}),s.dirty());else if("cuid"===o.kind)m$.test(e.data)||(mp(n=this._getOrReturnCtx(e,n),{validation:"cuid",code:mc.invalid_string,message:o.message}),s.dirty());else if("cuid2"===o.kind)mw.test(e.data)||(mp(n=this._getOrReturnCtx(e,n),{validation:"cuid2",code:mc.invalid_string,message:o.message}),s.dirty());else if("ulid"===o.kind)mk.test(e.data)||(mp(n=this._getOrReturnCtx(e,n),{validation:"ulid",code:mc.invalid_string,message:o.message}),s.dirty());else if("url"===o.kind)try{new URL(e.data)}catch{mp(n=this._getOrReturnCtx(e,n),{validation:"url",code:mc.invalid_string,message:o.message}),s.dirty()}else"regex"===o.kind?(o.regex.lastIndex=0,o.regex.test(e.data)||(mp(n=this._getOrReturnCtx(e,n),{validation:"regex",code:mc.invalid_string,message:o.message}),s.dirty())):"trim"===o.kind?e.data=e.data.trim():"includes"===o.kind?e.data.includes(o.value,o.position)||(mp(n=this._getOrReturnCtx(e,n),{code:mc.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),s.dirty()):"toLowerCase"===o.kind?e.data=e.data.toLowerCase():"toUpperCase"===o.kind?e.data=e.data.toUpperCase():"startsWith"===o.kind?e.data.startsWith(o.value)||(mp(n=this._getOrReturnCtx(e,n),{code:mc.invalid_string,validation:{startsWith:o.value},message:o.message}),s.dirty()):"endsWith"===o.kind?e.data.endsWith(o.value)||(mp(n=this._getOrReturnCtx(e,n),{code:mc.invalid_string,validation:{endsWith:o.value},message:o.message}),s.dirty()):"datetime"===o.kind?(function(e){let t=`${mA}T${mM(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,RegExp(`^${t}$`)})(o).test(e.data)||(mp(n=this._getOrReturnCtx(e,n),{code:mc.invalid_string,validation:"datetime",message:o.message}),s.dirty()):"date"===o.kind?mz.test(e.data)||(mp(n=this._getOrReturnCtx(e,n),{code:mc.invalid_string,validation:"date",message:o.message}),s.dirty()):"time"===o.kind?RegExp(`^${mM(o)}$`).test(e.data)||(mp(n=this._getOrReturnCtx(e,n),{code:mc.invalid_string,validation:"time",message:o.message}),s.dirty()):"duration"===o.kind?mE.test(e.data)||(mp(n=this._getOrReturnCtx(e,n),{validation:"duration",code:mc.invalid_string,message:o.message}),s.dirty()):"ip"===o.kind?(t=e.data,("v4"===(r=o.version)||!r)&&mT.test(t)||("v6"===r||!r)&&mC.test(t)||(mp(n=this._getOrReturnCtx(e,n),{validation:"ip",code:mc.invalid_string,message:o.message}),s.dirty())):"jwt"===o.kind?!function(e,t){if(!mP.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,o.alg)&&(mp(n=this._getOrReturnCtx(e,n),{validation:"jwt",code:mc.invalid_string,message:o.message}),s.dirty()):"cidr"===o.kind?(a=e.data,("v4"===(i=o.version)||!i)&&mO.test(a)||("v6"===i||!i)&&mI.test(a)||(mp(n=this._getOrReturnCtx(e,n),{validation:"cidr",code:mc.invalid_string,message:o.message}),s.dirty())):"base64"===o.kind?mN.test(e.data)||(mp(n=this._getOrReturnCtx(e,n),{validation:"base64",code:mc.invalid_string,message:o.message}),s.dirty()):"base64url"===o.kind?mq.test(e.data)||(mp(n=this._getOrReturnCtx(e,n),{validation:"base64url",code:mc.invalid_string,message:o.message}),s.dirty()):M.assertNever(o);return{status:s.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:mc.invalid_string,...Z.errToObj(r)})}_addCheck(e){return new mL({...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 mL({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new mL({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new mL({...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}}mL.create=e=>new mL({checks:[],typeName:D.ZodString,coerce:e?.coerce??!1,...mb(e)});class mZ extends mS{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)!==mo.number){let t=this._getOrReturnCtx(e);return mp(t,{code:mc.invalid_type,expected:mo.number,received:t.parsedType}),mh}let r=new mm;for(let a of this._def.checks)"int"===a.kind?M.isInteger(e.data)||(mp(t=this._getOrReturnCtx(e,t),{code:mc.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty()):"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(mp(t=this._getOrReturnCtx(e,t),{code:mc.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)&&(mp(t=this._getOrReturnCtx(e,t),{code:mc.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)&&(mp(t=this._getOrReturnCtx(e,t),{code:mc.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(mp(t=this._getOrReturnCtx(e,t),{code:mc.not_finite,message:a.message}),r.dirty()):M.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 mZ({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:Z.toString(a)}]})}_addCheck(e){return new mZ({...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&&M.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)}}mZ.create=e=>new mZ({checks:[],typeName:D.ZodNumber,coerce:e?.coerce||!1,...mb(e)});class mD extends mS{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)!==mo.bigint)return this._getInvalidInput(e);let r=new mm;for(let a of this._def.checks)"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(mp(t=this._getOrReturnCtx(e,t),{code:mc.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)&&(mp(t=this._getOrReturnCtx(e,t),{code:mc.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(mp(t=this._getOrReturnCtx(e,t),{code:mc.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):M.assertNever(a);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return mp(t,{code:mc.invalid_type,expected:mo.bigint,received:t.parsedType}),mh}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 mD({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:Z.toString(a)}]})}_addCheck(e){return new mD({...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}}mD.create=e=>new mD({checks:[],typeName:D.ZodBigInt,coerce:e?.coerce??!1,...mb(e)});class mV extends mS{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==mo.boolean){let t=this._getOrReturnCtx(e);return mp(t,{code:mc.invalid_type,expected:mo.boolean,received:t.parsedType}),mh}return mg(e.data)}}mV.create=e=>new mV({typeName:D.ZodBoolean,coerce:e?.coerce||!1,...mb(e)});class mF extends mS{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==mo.date){let t=this._getOrReturnCtx(e);return mp(t,{code:mc.invalid_type,expected:mo.date,received:t.parsedType}),mh}if(Number.isNaN(e.data.getTime()))return mp(this._getOrReturnCtx(e),{code:mc.invalid_date}),mh;let r=new mm;for(let a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(mp(t=this._getOrReturnCtx(e,t),{code:mc.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(mp(t=this._getOrReturnCtx(e,t),{code:mc.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):M.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new mF({...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}}mF.create=e=>new mF({checks:[],coerce:e?.coerce||!1,typeName:D.ZodDate,...mb(e)});class mU extends mS{_parse(e){if(this._getType(e)!==mo.symbol){let t=this._getOrReturnCtx(e);return mp(t,{code:mc.invalid_type,expected:mo.symbol,received:t.parsedType}),mh}return mg(e.data)}}mU.create=e=>new mU({typeName:D.ZodSymbol,...mb(e)});class mH extends mS{_parse(e){if(this._getType(e)!==mo.undefined){let t=this._getOrReturnCtx(e);return mp(t,{code:mc.invalid_type,expected:mo.undefined,received:t.parsedType}),mh}return mg(e.data)}}mH.create=e=>new mH({typeName:D.ZodUndefined,...mb(e)});class mJ extends mS{_parse(e){if(this._getType(e)!==mo.null){let t=this._getOrReturnCtx(e);return mp(t,{code:mc.invalid_type,expected:mo.null,received:t.parsedType}),mh}return mg(e.data)}}mJ.create=e=>new mJ({typeName:D.ZodNull,...mb(e)});class mB extends mS{constructor(){super(...arguments),this._any=!0}_parse(e){return mg(e.data)}}mB.create=e=>new mB({typeName:D.ZodAny,...mb(e)});class mK extends mS{constructor(){super(...arguments),this._unknown=!0}_parse(e){return mg(e.data)}}mK.create=e=>new mK({typeName:D.ZodUnknown,...mb(e)});class mW extends mS{_parse(e){let t=this._getOrReturnCtx(e);return mp(t,{code:mc.invalid_type,expected:mo.never,received:t.parsedType}),mh}}mW.create=e=>new mW({typeName:D.ZodNever,...mb(e)});class mG extends mS{_parse(e){if(this._getType(e)!==mo.undefined){let t=this._getOrReturnCtx(e);return mp(t,{code:mc.invalid_type,expected:mo.void,received:t.parsedType}),mh}return mg(e.data)}}mG.create=e=>new mG({typeName:D.ZodVoid,...mb(e)});class mY extends mS{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==mo.array)return mp(t,{code:mc.invalid_type,expected:mo.array,received:t.parsedType}),mh;if(null!==a.exactLength){let e=t.data.length>a.exactLength.value,i=t.data.length<a.exactLength.value;(e||i)&&(mp(t,{code:e?mc.too_big:mc.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&&(mp(t,{code:mc.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&&(mp(t,{code:mc.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 mv(t,e,t.path,r)))).then(e=>mm.mergeArray(r,e));let i=[...t.data].map((e,r)=>a.type._parseSync(new mv(t,e,t.path,r)));return mm.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new mY({...this._def,minLength:{value:e,message:Z.toString(t)}})}max(e,t){return new mY({...this._def,maxLength:{value:e,message:Z.toString(t)}})}length(e,t){return new mY({...this._def,exactLength:{value:e,message:Z.toString(t)}})}nonempty(e){return this.min(1,e)}}mY.create=(e,t)=>new mY({type:e,minLength:null,maxLength:null,exactLength:null,typeName:D.ZodArray,...mb(t)});class mQ extends mS{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=M.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==mo.object){let t=this._getOrReturnCtx(e);return mp(t,{code:mc.invalid_type,expected:mo.object,received:t.parsedType}),mh}let{status:t,ctx:r}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),n=[];if(!(this._def.catchall instanceof mW&&"strip"===this._def.unknownKeys))for(let e in r.data)i.includes(e)||n.push(e);let s=[];for(let e of i){let t=a[e],i=r.data[e];s.push({key:{status:"valid",value:e},value:t._parse(new mv(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof mW){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of n)s.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)n.length>0&&(mp(r,{code:mc.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];s.push({key:{status:"valid",value:t},value:e._parse(new mv(r,a,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of s){let r=await t.key,a=await t.value;e.push({key:r,value:a,alwaysSet:t.alwaysSet})}return e}).then(e=>mm.mergeObjectSync(t,e)):mm.mergeObjectSync(t,s)}get shape(){return this._def.shape()}strict(e){return Z.errToObj,new mQ({...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 mQ({...this._def,unknownKeys:"strip"})}passthrough(){return new mQ({...this._def,unknownKeys:"passthrough"})}extend(e){return new mQ({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new mQ({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:D.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new mQ({...this._def,catchall:e})}pick(e){let t={};for(let r of M.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new mQ({...this._def,shape:()=>t})}omit(e){let t={};for(let r of M.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new mQ({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof mQ){let r={};for(let a in t.shape){let i=t.shape[a];r[a]=ht.create(e(i))}return new mQ({...t._def,shape:()=>r})}return t instanceof mY?new mY({...t._def,type:e(t.element)}):t instanceof ht?ht.create(e(t.unwrap())):t instanceof hr?hr.create(e(t.unwrap())):t instanceof m1?m1.create(t.items.map(t=>e(t))):t}(this)}partial(e){let t={};for(let r of M.objectKeys(this.shape)){let a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new mQ({...this._def,shape:()=>t})}required(e){let t={};for(let r of M.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof ht;)e=e._def.innerType;t[r]=e}return new mQ({...this._def,shape:()=>t})}keyof(){return m5(M.objectKeys(this.shape))}}mQ.create=(e,t)=>new mQ({shape:()=>e,unknownKeys:"strip",catchall:mW.create(),typeName:D.ZodObject,...mb(t)}),mQ.strictCreate=(e,t)=>new mQ({shape:()=>e,unknownKeys:"strict",catchall:mW.create(),typeName:D.ZodObject,...mb(t)}),mQ.lazycreate=(e,t)=>new mQ({shape:e,unknownKeys:"strip",catchall:mW.create(),typeName:D.ZodObject,...mb(t)});class mX extends mS{_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 mu(e.ctx.common.issues));return mp(t,{code:mc.invalid_union,unionErrors:r}),mh});{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 mu(e));return mp(t,{code:mc.invalid_union,unionErrors:i}),mh}}get options(){return this._def.options}}mX.create=(e,t)=>new mX({options:e,typeName:D.ZodUnion,...mb(t)});class m0 extends mS{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(e,a)=>{if("aborted"===e.status||"aborted"===a.status)return mh;let i=function e(t,r){let a=ml(t),i=ml(r);if(t===r)return{valid:!0,data:t};if(a===mo.object&&i===mo.object){let a=M.objectKeys(r),i=M.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===mo.array&&i===mo.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}}return a===mo.date&&i===mo.date&&+t==+r?{valid:!0,data:t}:{valid:!1}}(e.value,a.value);return i.valid?(("dirty"===e.status||"dirty"===a.status)&&t.dirty(),{status:t.value,value:i.data}):(mp(r,{code:mc.invalid_intersection_types}),mh)};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}))}}m0.create=(e,t,r)=>new m0({left:e,right:t,typeName:D.ZodIntersection,...mb(r)});class m1 extends mS{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==mo.array)return mp(r,{code:mc.invalid_type,expected:mo.array,received:r.parsedType}),mh;if(r.data.length<this._def.items.length)return mp(r,{code:mc.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),mh;!this._def.rest&&r.data.length>this._def.items.length&&(mp(r,{code:mc.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 mv(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(a).then(e=>mm.mergeArray(t,e)):mm.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new m1({...this._def,rest:e})}}m1.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new m1({items:e,typeName:D.ZodTuple,rest:null,...mb(t)})};class m2 extends mS{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!==mo.map)return mp(r,{code:mc.invalid_type,expected:mo.map,received:r.parsedType}),mh;let a=this._def.keyType,i=this._def.valueType,n=[...r.data.entries()].map(([e,t],n)=>({key:a._parse(new mv(r,e,r.path,[n,"key"])),value:i._parse(new mv(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 mh;("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 mh;("dirty"===a.status||"dirty"===i.status)&&t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}}}m2.create=(e,t,r)=>new m2({valueType:t,keyType:e,typeName:D.ZodMap,...mb(r)});class m9 extends mS{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==mo.set)return mp(r,{code:mc.invalid_type,expected:mo.set,received:r.parsedType}),mh;let a=this._def;null!==a.minSize&&r.data.size<a.minSize.value&&(mp(r,{code:mc.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&&(mp(r,{code:mc.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 mh;"dirty"===a.status&&t.dirty(),r.add(a.value)}return{status:t.value,value:r}}let s=[...r.data.values()].map((e,t)=>i._parse(new mv(r,e,r.path,t)));return r.common.async?Promise.all(s).then(e=>n(e)):n(s)}min(e,t){return new m9({...this._def,minSize:{value:e,message:Z.toString(t)}})}max(e,t){return new m9({...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)}}m9.create=(e,t)=>new m9({valueType:e,minSize:null,maxSize:null,typeName:D.ZodSet,...mb(t)});class m4 extends mS{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})}}m4.create=(e,t)=>new m4({getter:e,typeName:D.ZodLazy,...mb(t)});class m6 extends mS{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return mp(t,{received:t.data,code:mc.invalid_literal,expected:this._def.value}),mh}return{status:"valid",value:e.data}}get value(){return this._def.value}}function m5(e,t){return new m3({values:e,typeName:D.ZodEnum,...mb(t)})}m6.create=(e,t)=>new m6({value:e,typeName:D.ZodLiteral,...mb(t)});class m3 extends mS{_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return mp(t,{expected:M.joinValues(r),received:t.parsedType,code:mc.invalid_type}),mh}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 mp(t,{received:t.data,code:mc.invalid_enum_value,options:r}),mh}return mg(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 m3.create(e,{...this._def,...t})}exclude(e,t=this._def){return m3.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}m3.create=m5;class m8 extends mS{_parse(e){let t=M.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==mo.string&&r.parsedType!==mo.number){let e=M.objectValues(t);return mp(r,{expected:M.joinValues(e),received:r.parsedType,code:mc.invalid_type}),mh}if(this._cache||(this._cache=new Set(M.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let e=M.objectValues(t);return mp(r,{received:r.data,code:mc.invalid_enum_value,options:e}),mh}return mg(e.data)}get enum(){return this._def.values}}m8.create=(e,t)=>new m8({values:e,typeName:D.ZodNativeEnum,...mb(t)});class m7 extends mS{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==mo.promise&&!1===t.common.async?(mp(t,{code:mc.invalid_type,expected:mo.promise,received:t.parsedType}),mh):mg((t.parsedType===mo.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}m7.create=(e,t)=>new m7({type:e,typeName:D.ZodPromise,...mb(t)});class he extends mS{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===D.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=>{mp(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 mh;let a=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===a.status?mh:"dirty"===a.status||"dirty"===t.value?mf(a.value):a});{if("aborted"===t.value)return mh;let a=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===a.status?mh:"dirty"===a.status||"dirty"===t.value?mf(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?mh:("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?mh:("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?mh: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 mh;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}}M.assertNever(a)}}he.create=(e,t,r)=>new he({schema:e,typeName:D.ZodEffects,effect:t,...mb(r)}),he.createWithPreprocess=(e,t,r)=>new he({schema:t,effect:{type:"preprocess",transform:e},typeName:D.ZodEffects,...mb(r)});class ht extends mS{_parse(e){return this._getType(e)===mo.undefined?mg(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ht.create=(e,t)=>new ht({innerType:e,typeName:D.ZodOptional,...mb(t)});class hr extends mS{_parse(e){return this._getType(e)===mo.null?mg(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}hr.create=(e,t)=>new hr({innerType:e,typeName:D.ZodNullable,...mb(t)});class ha extends mS{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===mo.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ha.create=(e,t)=>new ha({innerType:e,typeName:D.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...mb(t)});class hi extends mS{_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 my(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new mu(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new mu(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}hi.create=(e,t)=>new hi({innerType:e,typeName:D.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...mb(t)});class hn extends mS{_parse(e){if(this._getType(e)!==mo.nan){let t=this._getOrReturnCtx(e);return mp(t,{code:mc.invalid_type,expected:mo.nan,received:t.parsedType}),mh}return{status:"valid",value:e.data}}}hn.create=e=>new hn({typeName:D.ZodNaN,...mb(e)}),Symbol("zod_brand");class hs extends mS{_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 ho extends mS{_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?mh:"dirty"===e.status?(t.dirty(),mf(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?mh:"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 ho({in:e,out:t,typeName:D.ZodPipeline})}}class hl extends mS{_parse(e){let t=this._def.innerType._parse(e),r=e=>("valid"===e.status&&(e.value=Object.freeze(e.value)),e);return my(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}hl.create=(e,t)=>new hl({innerType:e,typeName:D.ZodReadonly,...mb(t)}),mQ.lazycreate,(N=D||(D={})).ZodString="ZodString",N.ZodNumber="ZodNumber",N.ZodNaN="ZodNaN",N.ZodBigInt="ZodBigInt",N.ZodBoolean="ZodBoolean",N.ZodDate="ZodDate",N.ZodSymbol="ZodSymbol",N.ZodUndefined="ZodUndefined",N.ZodNull="ZodNull",N.ZodAny="ZodAny",N.ZodUnknown="ZodUnknown",N.ZodNever="ZodNever",N.ZodVoid="ZodVoid",N.ZodArray="ZodArray",N.ZodObject="ZodObject",N.ZodUnion="ZodUnion",N.ZodDiscriminatedUnion="ZodDiscriminatedUnion",N.ZodIntersection="ZodIntersection",N.ZodTuple="ZodTuple",N.ZodRecord="ZodRecord",N.ZodMap="ZodMap",N.ZodSet="ZodSet",N.ZodFunction="ZodFunction",N.ZodLazy="ZodLazy",N.ZodLiteral="ZodLiteral",N.ZodEnum="ZodEnum",N.ZodEffects="ZodEffects",N.ZodNativeEnum="ZodNativeEnum",N.ZodOptional="ZodOptional",N.ZodNullable="ZodNullable",N.ZodDefault="ZodDefault",N.ZodCatch="ZodCatch",N.ZodPromise="ZodPromise",N.ZodBranded="ZodBranded",N.ZodPipeline="ZodPipeline",N.ZodReadonly="ZodReadonly";let hc=mL.create;mZ.create,hn.create,mD.create,mV.create,mF.create,mU.create,mH.create,mJ.create,mB.create,mK.create,mW.create,mG.create,mY.create;let hu=mQ.create;mQ.strictCreate,mX.create,m0.create,m1.create,m2.create,m9.create,m4.create,m6.create,m3.create,m8.create,m7.create,he.create,ht.create,hr.create,he.createWithPreprocess,ho.create;let hd=(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 hp(e){if("openAi"!==e.target)return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?hd(t,e.currentPath):t.join("/")}}function hm(e,t,r,a){a?.errorMessages&&r&&(e.errorMessage={...e.errorMessage,[t]:r})}function hh(e,t,r,a,i){e[t]=r,hm(e,t,a,i)}function hf(e,t){return hA(e.type._def,t)}let hg=/^[cC][^\s-]{8,}$/,hy=/^[0-9a-z]+$/,hv=/^[0-9A-HJKMNP-TV-Z]{26}$/,h_=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,hb=()=>(void 0===E&&(E=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),E),hS=/^(?:(?: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])$/,h$=/^(([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])$/,hw=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,hk=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,hx=/^[a-zA-Z0-9_-]{21}$/,hR=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function hP(e,t){let r={type:"string"};if(e.checks)for(let a of e.checks)switch(a.kind){case"min":hh(r,"minLength","number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value,a.message,t);break;case"max":hh(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":hT(r,"email",a.message,t);break;case"format:idn-email":hT(r,"idn-email",a.message,t);break;case"pattern:zod":hO(r,h_,a.message,t)}break;case"url":hT(r,"uri",a.message,t);break;case"uuid":hT(r,"uuid",a.message,t);break;case"regex":hO(r,a.regex,a.message,t);break;case"cuid":hO(r,hg,a.message,t);break;case"cuid2":hO(r,hy,a.message,t);break;case"startsWith":hO(r,RegExp(`^${hE(a.value,t)}`),a.message,t);break;case"endsWith":hO(r,RegExp(`${hE(a.value,t)}$`),a.message,t);break;case"datetime":hT(r,"date-time",a.message,t);break;case"date":hT(r,"date",a.message,t);break;case"time":hT(r,"time",a.message,t);break;case"duration":hT(r,"duration",a.message,t);break;case"length":hh(r,"minLength","number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value,a.message,t),hh(r,"maxLength","number"==typeof r.maxLength?Math.min(r.maxLength,a.value):a.value,a.message,t);break;case"includes":hO(r,RegExp(hE(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&hT(r,"ipv4",a.message,t),"v4"!==a.version&&hT(r,"ipv6",a.message,t);break;case"base64url":hO(r,hk,a.message,t);break;case"jwt":hO(r,hR,a.message,t);break;case"cidr":"v6"!==a.version&&hO(r,hS,a.message,t),"v4"!==a.version&&hO(r,h$,a.message,t);break;case"emoji":hO(r,hb(),a.message,t);break;case"ulid":hO(r,hv,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":hT(r,"binary",a.message,t);break;case"contentEncoding:base64":hh(r,"contentEncoding","base64",a.message,t);break;case"pattern:zod":hO(r,hw,a.message,t)}break;case"nanoid":hO(r,hx,a.message,t)}return r}function hE(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let r=0;r<e.length;r++)hj.has(e[r])||(t+="\\"),t+=e[r];return t}(e):e}let hj=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function hT(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}}})):hh(e,"format",t,r,a)}function hO(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:hC(t,a),...r&&a.errorMessages&&{errorMessage:{pattern:r}}})):hh(e,"pattern",hC(t,a),r,a)}function hC(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,s=!1,o=!1;for(let e=0;e<a.length;e++){if(n){i+=a[e],n=!1;continue}if(r.i){if(s){if(a[e].match(/[a-z]/)){o?(i+=a[e],i+=`${a[e-2]}-${a[e]}`.toUpperCase(),o=!1):"-"===a[e+1]&&a[e+2]?.match(/[a-z]/)?(i+=a[e],o=!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
73
+ ]))`;continue}else if("$"===a[e]){i+=`($|(?=[\r
74
+ ]))`;continue}}if(r.s&&"."===a[e]){i+=s?`${a[e]}\r
75
+ `:`[${a[e]}\r
76
+ ]`;continue}i+=a[e],"\\"===a[e]?n=!0:s&&"]"===a[e]?s=!1:s||"["!==a[e]||(s=!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 hI(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===D.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((r,a)=>({...r,[a]:hA(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",a]})??hp(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:hA(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if("openApi3"===t.target)return r;if(e.keyType?._def.typeName===D.ZodString&&e.keyType._def.checks?.length){let{type:a,...i}=hP(e.keyType._def,t);return{...r,propertyNames:i}}if(e.keyType?._def.typeName===D.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===D.ZodBranded&&e.keyType._def.type._def.typeName===D.ZodString&&e.keyType._def.type._def.checks?.length){let{type:a,...i}=hf(e.keyType._def,t);return{...r,propertyNames:i}}return r}let hN={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"},hq=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,r)=>hA(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 hA(e,t,r=!1){let a=t.seen.get(e);if(t.override){let i=t.override?.(e,t,a,r);if(i!==mn)return i}if(a&&!r){let e=hz(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 D.ZodString:return hP(e,r);case D.ZodNumber:let a={type:"number"};if(!e.checks)return a;for(let t of e.checks)switch(t.kind){case"int":a.type="integer",hm(a,"type",t.message,r);break;case"min":"jsonSchema7"===r.target?t.inclusive?hh(a,"minimum",t.value,t.message,r):hh(a,"exclusiveMinimum",t.value,t.message,r):(t.inclusive||(a.exclusiveMinimum=!0),hh(a,"minimum",t.value,t.message,r));break;case"max":"jsonSchema7"===r.target?t.inclusive?hh(a,"maximum",t.value,t.message,r):hh(a,"exclusiveMaximum",t.value,t.message,r):(t.inclusive||(a.exclusiveMaximum=!0),hh(a,"maximum",t.value,t.message,r));break;case"multipleOf":hh(a,"multipleOf",t.value,t.message,r)}return a;case D.ZodObject:return function(e,t){let r="openAi"===t.target,a={type:"object",properties:{}},i=[],n=e.shape();for(let e in n){let s=n[e];if(void 0===s||void 0===s._def)continue;let o=function(e){try{return e.isOptional()}catch{return!0}}(s);o&&r&&("ZodOptional"===s._def.typeName&&(s=s._def.innerType),s.isNullable()||(s=s.nullable()),o=!1);let l=hA(s._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==l&&(a.properties[e]=l,o||i.push(e))}i.length&&(a.required=i);let s=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return hA(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!==s&&(a.additionalProperties=s),a}(e,r);case D.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?hh(i,"minimum",t.value,t.message,r):hh(i,"exclusiveMinimum",t.value,t.message,r):(t.inclusive||(i.exclusiveMinimum=!0),hh(i,"minimum",t.value,t.message,r));break;case"max":"jsonSchema7"===r.target?t.inclusive?hh(i,"maximum",t.value,t.message,r):hh(i,"exclusiveMaximum",t.value,t.message,r):(t.inclusive||(i.exclusiveMaximum=!0),hh(i,"maximum",t.value,t.message,r));break;case"multipleOf":hh(i,"multipleOf",t.value,t.message,r)}return i;case D.ZodBoolean:return{type:"boolean"};case D.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":let n={type:"integer",format:"unix-time"};if("openApi3"===r.target)return n;for(let e of t.checks)switch(e.kind){case"min":hh(n,"minimum",e.value,e.message,r);break;case"max":hh(n,"maximum",e.value,e.message,r)}return n}}(e,r);case D.ZodUndefined:return{not:hp(r)};case D.ZodNull:return"openApi3"===r.target?{enum:["null"],nullable:!0}:{type:"null"};case D.ZodArray:let n;return n={type:"array"},e.type?._def&&e.type?._def?.typeName!==D.ZodAny&&(n.items=hA(e.type._def,{...r,currentPath:[...r.currentPath,"items"]})),e.minLength&&hh(n,"minItems",e.minLength.value,e.minLength.message,r),e.maxLength&&hh(n,"maxItems",e.maxLength.value,e.maxLength.message,r),e.exactLength&&(hh(n,"minItems",e.exactLength.value,e.exactLength.message,r),hh(n,"maxItems",e.exactLength.value,e.exactLength.message,r)),n;case D.ZodUnion:case D.ZodDiscriminatedUnion:if("openApi3"===r.target)return hq(e,r);let s=e.options instanceof Map?Array.from(e.options.values()):e.options;if(s.every(e=>e._def.typeName in hN&&(!e._def.checks||!e._def.checks.length))){let e=s.reduce((e,t)=>{let r=hN[t._def.typeName];return r&&!e.includes(r)?[...e,r]:e},[]);return{type:e.length>1?e:e[0]}}if(s.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){let e=s.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===s.length){let t=e.filter((e,t,r)=>r.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:s.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(s.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:s.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return hq(e,r);case D.ZodIntersection:let o,l,c;return o=[hA(e.left._def,{...r,currentPath:[...r.currentPath,"allOf","0"]}),hA(e.right._def,{...r,currentPath:[...r.currentPath,"allOf","1"]})].filter(e=>!!e),l="jsonSchema2019-09"===r.target?{unevaluatedProperties:!1}:void 0,c=[],o.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 D.ZodTuple:return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,t)=>hA(e._def,{...r,currentPath:[...r.currentPath,"items",`${t}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:hA(e.rest._def,{...r,currentPath:[...r.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,t)=>hA(e._def,{...r,currentPath:[...r.currentPath,"items",`${t}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])};case D.ZodRecord:return hI(e,r);case D.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 D.ZodEnum:return{type:"string",enum:Array.from(e.values)};case D.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 D.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:hN[e.innerType._def.typeName],nullable:!0}:{type:[hN[e.innerType._def.typeName],"null"]};if("openApi3"===r.target){let t=hA(e.innerType._def,{...r,currentPath:[...r.currentPath]});return t&&"$ref"in t?{allOf:[t],nullable:!0}:t&&{...t,nullable:!0}}let h=hA(e.innerType._def,{...r,currentPath:[...r.currentPath,"anyOf","0"]});return h&&{anyOf:[h,{type:"null"}]};case D.ZodOptional:if(r.currentPath.toString()===r.propertyPath?.toString())return hA(e.innerType._def,r);let f=hA(e.innerType._def,{...r,currentPath:[...r.currentPath,"anyOf","1"]});return f?{anyOf:[{not:hp(r)},f]}:hp(r);case D.ZodMap:if("record"===r.mapStrategy)return hI(e,r);return{type:"array",maxItems:125,items:{type:"array",items:[hA(e.keyType._def,{...r,currentPath:[...r.currentPath,"items","items","0"]})||hp(r),hA(e.valueType._def,{...r,currentPath:[...r.currentPath,"items","items","1"]})||hp(r)],minItems:2,maxItems:2}};case D.ZodSet:let g;return g={type:"array",uniqueItems:!0,items:hA(e.valueType._def,{...r,currentPath:[...r.currentPath,"items"]})},e.minSize&&hh(g,"minItems",e.minSize.value,e.minSize.message,r),e.maxSize&&hh(g,"maxItems",e.maxSize.value,e.maxSize.message,r),g;case D.ZodLazy:return()=>e.getter()._def;case D.ZodPromise:return hA(e.type._def,r);case D.ZodNaN:case D.ZodNever:return"openAi"===r.target?void 0:{not:hp({...r,currentPath:[...r.currentPath,"not"]})};case D.ZodEffects:return"input"===r.effectStrategy?hA(e.schema._def,r):hp(r);case D.ZodAny:case D.ZodUnknown:return hp(r);case D.ZodDefault:return{...hA(e.innerType._def,r),default:e.defaultValue()};case D.ZodBranded:return hf(e,r);case D.ZodReadonly:case D.ZodCatch:return hA(e.innerType._def,r);case D.ZodPipeline:if("input"===r.pipeStrategy)return hA(e.in._def,r);if("output"===r.pipeStrategy)return hA(e.out._def,r);let y=hA(e.in._def,{...r,currentPath:[...r.currentPath,"allOf","0"]}),v=hA(e.out._def,{...r,currentPath:[...r.currentPath,"allOf",y?"1":"0"]});return{allOf:[y,v].filter(e=>void 0!==e)};case D.ZodFunction:case D.ZodVoid:case D.ZodSymbol:default:return}})(e,e.typeName,t),s="function"==typeof n?hA(n(),t):n;if(s&&hM(e,t,s),t.postProcess){let r=t.postProcess(s,e,t);return i.jsonSchema=s,r}return i.jsonSchema=s,s}let hz=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:hd(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`),hp(t);return"seen"===t.$refStrategy?hp(t):void 0}},hM=(e,t,r)=>(e.description&&(r.description=e.description,t.markdownDescription&&(r.markdownDescription=e.description)),r);function hL(e){if("object"!=typeof e||null===e)return!1;let t=e["~standard"];return"object"==typeof t&&null!==t&&"function"==typeof t.validate}function hZ(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){var i;let r,a,n,s,o,l,c,u,d=(a=void 0!==(r="string"==typeof(i={$refStrategy:"none",target:"openapi-3.0"===t?"openApi3":"jsonSchema7"})?{...ms,name:i}:{...ms,...i}).name?[...r.basePath,r.definitionPath,r.name]:r.basePath,n={...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}]))},s=i.definitions?Object.entries(i.definitions).reduce((e,[t,r])=>({...e,[t]:hA(r._def,{...n,currentPath:[...n.basePath,n.definitionPath,t]},!0)??hp(n)}),{}):void 0,o=i?.nameStrategy==="title"?void 0:i?.name,l=hA(e._def,void 0===o?n:{...n,currentPath:[...n.basePath,n.definitionPath,o]},!1)??hp(n),void 0!==(c=void 0!==i.name&&"title"===i.nameStrategy?i.name:void 0)&&(l.title=c),n.flags.hasReferencedOpenAiAnyType&&(s||(s={}),s[n.openAiAnyTypeName]||(s[n.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===n.$refStrategy?"1":[...n.basePath,n.definitionPath,n.openAiAnyTypeName].join("/")}})),u=void 0===o?s?{...l,[n.definitionPath]:s}:l:{$ref:[..."relative"===n.$refStrategy?[]:n.basePath,n.definitionPath,o].join("/"),[n.definitionPath]:{...s,[o]:l}},"jsonSchema7"===n.target?u.$schema="http://json-schema.org/draft-07/schema#":("jsonSchema2019-09"===n.target||"openAi"===n.target)&&(u.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===n.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);return delete d.$schema,d}if("zod"===a.vendor&&"_zod"in e)try{let t=it(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".`)}function hD(e,t={}){let{strict:r=!1}=t,a=Object.entries(e),i=e=>({target:t})=>{let i={},n=[];for(let[r,s]of a)i[r]=hZ(s,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}}(s,e)&&n.push(r);let s={type:"object",properties:i};return n.length>0&&(s.required=n),r&&(s.additionalProperties=!1),s};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 hV(e,t={}){let r;return hL(e)?{..."object"==typeof(r=e.shape)&&null!==r&&Object.values(r).every(hL)?{shape:r}:{},"~standard":{version:1,vendor:"xmcp",validate:t=>e["~standard"].validate(t),jsonSchema:{input:({target:t})=>hZ(e,t,"input"),output:({target:t})=>hZ(e,t,"output")}}}:hD(e,t)}async function hF(e,t,r,a){if(hL(t)){let i=await t["~standard"].validate(e);if(i.issues){let e=i.issues.map(e=>{let t=(e.path??[]).map(e=>"object"==typeof e&&null!==e&&"key"in e?String(e.key):String(e)).join(".");return t?`${t}: ${e.message}`:e.message}).join("; ");throw Error(`Tool "${r}" ${a}: ${e}`)}return}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 hU(e){return!(!e||"object"!=typeof e||Array.isArray(e))&&("structuredContent"in e||"content"in e&&Array.isArray(e.content)||"_meta"in e||"isError"in e)}function hH(e){return!!(e&&"object"==typeof e&&Object.keys(e).some(e=>e.startsWith("ui/")))}function hJ(e){let t=e.mcpReq.envelope,r=pJ(t?.[nU]);if(!r)try{let e,t=pA();r=t.clientInfo??(e=t.headers,pJ({name:pB(e,"x-mcp-client-name"),version:pB(e,"x-mcp-client-version"),title:pB(e,"x-mcp-client-title"),websiteUrl:pB(e,"x-mcp-client-website-url"),description:pB(e,"x-mcp-client-description")}))}catch{}if(!r)try{r=pU().clientInfo}catch{}return r}function hB(e,t=!1){let r=[...e];return(e,a,i)=>pL(a,hJ(a),async()=>{if(0===r.length)return i();let t=Object.freeze({...pM(),...e,params:Object.freeze({...e.params})}),a=-1,n=async e=>{if(e<=a)throw Error("MCP middleware next() can only be called once");a=e;let s=r[e];return s?s(t,()=>n(e+1)):i()};return n(0)},t)}function hK(e,t=new WeakMap){if(null===e||"object"!=typeof e)return e;let r=Object.getPrototypeOf(e);if(!Array.isArray(e)&&r!==Object.prototype&&null!==r)return e;if(t.has(e))return t.get(e);let a=Array.isArray(e)?[]:Object.create(r);for(let[r,i]of(t.set(e,a),Object.entries(e)))Object.defineProperty(a,r,{value:hK(i,t),enumerable:!0,configurable:!0,writable:!0});return Object.freeze(a)}let hW=new Set(["tools/list","prompts/get","prompts/list","resources/read","resources/list","resources/templates/list","completion/complete"]);function hG(e){return e.endsWith(".tsx")}function hY(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 hQ=["ui/resourceUri","resourceUri","visibility"],hX=["prefersBorder","domain","csp","permissions","connectDomains","resourceDomains","frameDomains","baseUriDomains"];function h0(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 h1(e){return(e.split("/").pop()||e).replace(/\.[^/.]+$/,"")}function h2(e,t,r){return e.names?.includes(t)===!0||e.tags?.some(e=>r.includes(e))===!0}function h9(e,t){return t?new Map([...e].filter(([e,{metadata:r}])=>{if(r?.enabled===!1)return!1;let a=r?.name??h1(e),i=r?.tags??[];return(!t.include||h2(t.include,a,i))&&(!t.exclude||!h2(t.exclude,a,i))})):e}function h4(e){return Error(`[xmcp] Invalid prompt file: ${e}
77
+ -> Default export must be a prompt handler function.`)}let h6=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}
78
+ -> ${r}`)});let i=r.length;e.warn(`[xmcp] ${i} prompt${1===i?"":"s"} skipped due to empty files or missing default exports`)}}();function h5(e){return Error(`[xmcp] Invalid resource file: ${e}
79
+ -> Default export must be a resource handler function.`)}let h3=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}
80
+ -> ${r}`)});let i=r.length;e.warn(`[xmcp] ${i} resource${1===i?"":"s"} skipped due to empty files or missing default exports`)}}();function h8(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),s=n[n.length-1];if(s&&s.includes(".")){let e=s.split(".")[0];"index"!==e?n[n.length-1]=e:n.pop()}let o=[],l=[],c=n.map(e=>{if(!e.match(/^\[.+\]$/))return l.push(e),e;{let t=e.slice(1,-1);return o.push(t),`{${t}}`}}),u=`${i}://${c.join("/")}`,d=o.length>0?"template":"direct";return{filePath:e,uriTemplate:u,scheme:i,parameters:o,pathSegments:l,type:d}}let h7={ttlMs:0,cacheScope:"private"},fe=hu({cursor:hc().optional()}).passthrough().optional(),ft=hu({uri:hc()}).passthrough();function fr({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 fa(e){return Error(`[xmcp] Invalid tool file: ${e}
81
+ -> Default export must be a tool handler function.`)}let fi=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}
82
+ -> ${r}`)});let i=r.length;e.warn(`[xmcp] ${i} tool${1===i?"":"s"} skipped due to empty files or missing default exports`)}}(),fn="u"<typeof s?[]:s??[],fs={name:"svgt",version:"0.0.0",description:"Transform SVG into frontend components.",icons:[]};var fo=l(8717);l.n(fo)().config(),pH({clientInfo:void 0},()=>{let e;!function(e,t={}){let r,a=t.legacy??"serve",i=t.transport??new pR,n={phase:"opening"},s=!1,o=()=>s||"closed"===n.phase,l=e=>{try{t.onerror?.(e)}catch{}},c=(e,t,r,a)=>i.send({jsonrpc:"2.0",id:e,error:{code:t,message:r,...void 0!==a&&{data:a}}}).catch(e=>l(pE(e))),u=new pk(t.maxSubscriptions??1024),d=e=>{if(!sr.safeParse(e).success)return;let t=u.routeOutbound(e);if("passthrough"!==t){for(let e of t)i.send({jsonrpc:"2.0",...e}).catch(e=>l(pE(e)));return"handled"}},p=async e=>{if(cV(e)&&"subscriptions/listen"===e.method){let t,r=cz(e.params),a=cM(e.params)?(void 0===r?[]:cZ(r))[0]:{key:"_meta",problem:"the per-request envelope is required on protocol revision 2026-07-28"},n=cL(e.params);if(void 0!==a)t={jsonrpc:"2.0",id:e.id,error:{code:-32602,message:`Invalid _meta envelope: ${a.key}: ${a.problem}`}};else if(void 0!==n&&lH.includes(n))t=u.serve(e);else{let r=new cm({supported:[...lH],requested:n??"unknown"});t={jsonrpc:"2.0",id:e.id,error:{code:r.code,message:r.message,data:r.data}}}return await i.send("error"in t?t:{jsonrpc:"2.0",method:t.method,params:t.params}).catch(e=>l(pE(e))),!0}if(sr.safeParse(e).success&&"notifications/cancelled"===e.method){let t=e.params?.requestId;if(void 0!==t&&u.cancel(t))return!0}return!1},m=(e,t,r)=>{let a=function(e,t){switch(e.reason){case"http-method":return cY("http-method","modern-only-method-not-allowed",405,new cu(-32e3,"Method not allowed."),!0);case"batch":return cY("jsonrpc-shape","modern-only-batch-not-supported",400,new cu(cc.InvalidRequest,"Bad Request: JSON-RPC batches are not supported by this endpoint"),!0);case"response":return cY("jsonrpc-shape","modern-only-response-post",400,new cu(cc.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 cY("era-classification","modern-only-missing-envelope",400,void 0===r?new cu(cc.UnsupportedProtocolVersion,"Unsupported protocol version: the request did not name a protocol version",{supported:[...t]}):new cm({supported:[...t],requested:r}),!0)}}}({kind:"legacy",reason:t,...void 0!==r&&{requestedVersion:r}},lH);return void 0===a?Promise.resolve():(l(Error(`Rejected 2025-era request on a modern-only stdio connection (${a.cell}): ${a.message}`)),c(e.id,a.code,a.message,a.data))},f=async(t,a)=>{let n=await e({era:t}),o=n instanceof pp?n.server:n;"modern"===t&&(h(o,a),g(o,lH),u.setServerCapabilities(o.getCapabilities(),y(o)));let l=new pP(i,()=>{s||l===r||$()},"modern"===t?d:void 0);return await n.connect(l),{product:n,channel:l}},v=e=>e.product.close().catch(e=>l(pE(e))),_=async e=>{if("closed"===n.phase)return;if("pinned"===n.phase)return"modern"===n.era&&cV(e)&&"initialize"===e.method&&!cQ(e.params)?void await m(e,"initialize",null!==e.params&&"object"==typeof e.params&&"string"==typeof e.params.protocolVersion?e.params.protocolVersion:void 0):void("modern"===n.era&&await p(e)||o()||n.instance.channel.deliver(e));if(!cV(e)&&!sr.safeParse(e).success)return void l(Error("Discarded a JSON-RPC response received before the connection negotiated an era"));let t=function(e){let t=e.params;if("initialize"===e.method&&!cQ(t)){let e=null!==t&&"object"==typeof t&&"string"==typeof t.protocolVersion?t.protocolVersion:void 0;return{kind:"legacy",reason:"initialize",...void 0!==e&&{requestedVersion:e}}}if(!cM(t))return{kind:"legacy",reason:"no-claim"};let r=cz(t),a=(void 0===r?[]:cZ(r))[0];if(void 0!==a)return{kind:"invalid-envelope",issue:a};let i=cL(t);return void 0!==i&&lH.includes(i)?{kind:"modern",revision:i,classification:{era:"modern",revision:i}}:{kind:"unsupported-revision",requested:i??"unknown"}}(e);switch(t.kind){case"invalid-envelope":{let r=`Invalid _meta envelope for protocol revision 2026-07-28: ${t.issue.key}: ${t.issue.problem}`;cV(e)?await c(e.id,cc.InvalidParams,r,{envelope:t.issue}):l(Error(`Discarded a notification with a malformed envelope: ${r}`));return}case"unsupported-revision":if(cV(e)){let r=new cm({supported:[...lH],requested:t.requested});l(r),await c(e.id,r.code,r.message,r.data)}else l(Error(`Discarded a notification claiming unsupported protocol revision ${t.requested}`));return;case"modern":if(cV(e)&&"server/discover"===e.method){if("probe"===n.phase)return void n.instance.channel.deliver(e,{classification:t.classification});let r=await f("modern",t.revision);if(o())return void await v(r);n={phase:"probe",instance:r},r.channel.deliver(e,{classification:t.classification});return}if("probe"===n.phase){if(sr.safeParse(e).success)return void n.instance.channel.deliver(e,{classification:t.classification});n={phase:"pinned",era:"modern",instance:n.instance}}else{let e=await f("modern",t.revision);if(o())return void await v(e);n={phase:"pinned",era:"modern",instance:e}}if(await p(e)||o())return;n.instance.channel.deliver(e,{classification:t.classification});return;case"legacy":{if("reject"===a){cV(e)&&await m(e,t.reason,t.requestedVersion);return}if("probe"===n.phase){if(await (async e=>{r=e.channel;try{await e.channel.whenRequestsAnswered(3e3)||l(Error("Discarded the probe instance with requests still unanswered after 3000ms; continuing with the fallback")),await e.product.close()}catch(e){l(pE(e))}finally{r=void 0}})(n.instance),o())return;n={phase:"opening"}}let i=await f("legacy");if(o())return void await v(i);(n={phase:"pinned",era:"legacy",instance:i}).instance.channel.deliver(e);return}}},b=[],S=!1,$=async()=>{if(s||"closed"===n.phase)return;s=!0;let e=n;for(let e of(n={phase:"closed"},u.teardownAll()))await i.send(e).catch(e=>l(pE(e)));("probe"===e.phase||"pinned"===e.phase)&&await e.instance.product.close().catch(e=>l(pE(e))),await i.close().catch(e=>l(pE(e)))};i.onmessage=e=>{b.push(e),(async()=>{if(!S){S=!0;try{for(;b.length>0;){let e=b.shift();try{await _(e)}catch(t){cV(e)&&await c(e.id,cc.InternalError,"Internal server error"),l(pE(t))}}}finally{S=!1}}})()},i.onerror=e=>{l(e),("probe"===n.phase||"pinned"===n.phase)&&n.instance.channel.onerror?.(e)},i.onclose=()=>{if(s||"closed"===n.phase)return;s=!0;let e=n;n={phase:"closed"},("probe"===e.phase||"pinned"===e.phase)&&e.instance.product.close().catch(e=>l(pE(e)))},i.start().catch(e=>{throw l(pE(e)),e}).catch(()=>{})}(async()=>{let e=await async function(){let e=function(){let{instructions:e,...t}=fs;return new pp(t,{instructions:e,cacheHints:{}})}(),t=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 fa(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 fa(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}}(a);return fi(t),e}(),r=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 h4(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 h4(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}}(i);return h6(t),e}(),s=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 h5(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 h5(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}}(n);return h3(t),e}(),[c,u,d]=await Promise.all([t,r,s]);return async function(e,t,r,a){let i=await o?.(),n=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}(i?.mcp),s=function(e){if(void 0!==e){if("function"!=typeof e)throw Error("src/middleware.ts must export authorize as a function");return e}}(i?.authorize),c;pT.clear();let u={};return!function(e,t,r,a){let i=e.server,n=i.setRequestHandler,s=a?{tools:new Map,prompts:new Map,resources:new Map,templates:new Map,uiOwners:new Map}:void 0,o=a&&s?function(e,t){let r=async(t,r,a)=>!r||await e(t,r,a)===!0;async function a(e,t,a){if(!Array.isArray(t))return t;let i=await Promise.all(t.map(t=>r(e,a(t),"list")));return t.filter((e,t)=>i[t])}return async(e,i)=>{switch(e.method){case"tools/call":{let{name:a}=e.params;if(!await r(e,t.tools.get(a),"call"))throw new cu(cc.InvalidParams,`Tool ${a} not found`);return i()}case"prompts/get":{let{name:a}=e.params;if(!await r(e,t.prompts.get(a),"get"))throw new cu(cc.InvalidParams,`Prompt ${a} not found`);return i()}case"resources/read":{let{uri:a}=e.params;if(!await r(e,pD(t,a),"read"))throw new cd(a);return i()}case"completion/complete":{let{ref:a}=e.params,n="ref/prompt"===a.type?t.prompts.get(a.name):[...t.templates.values()].find(({component:e})=>e.uriTemplate===a.uri)?.component??t.uiOwners.get(a.uri)??t.resources.get(a.uri);if(!await r(e,n,"complete"))throw new cu(cc.InvalidParams,"ref/prompt"===a.type?`Prompt ${a.name} not found`:`Resource template ${a.uri} not found`);return i()}case"tools/list":{let r=await i();return{...r,tools:await a(e,r.tools,e=>t.tools.get(e.name))}}case"prompts/list":{let r=await i();return{...r,prompts:await a(e,r.prompts,e=>t.prompts.get(e.name))}}case"resources/list":{let r=await i();return{...r,resources:await a(e,r.resources,e=>pD(t,e.uri,!0))}}case"resources/templates/list":{let r=await i();return{...r,resourceTemplates:await a(e,r.resourceTemplates,e=>t.templates.get(e.name)?.component)}}default:return i()}}}(a,s):void 0,l=hB(o?[o,...t]:t),c=o?hB([o]):void 0;i.setRequestHandler=(e,...t)=>{if(1===t.length&&"function"==typeof t[0]){let r=t[0];hW.has(e)?t[0]=(e,t)=>l({method:e.method,params:e.params??{}},t,()=>r(e,t)):"tools/call"===e&&c&&s&&(t[0]=(e,t)=>{let a=s.tools.get(e.params.name);return a?c({method:"tools/call",params:{name:e.params.name,arguments:e.params.arguments??{}},tool:{metadata:a.metadata}},t,()=>r(e,t)):r(e,t)})}Reflect.apply(n,i,[e,...t])};try{if(s){let t={registerTool:e.registerTool,registerPrompt:e.registerPrompt,registerResource:e.registerResource};e.registerTool=(r,a,...i)=>{let n=hK({name:r,description:a.description??"",annotations:a.annotations,icons:a.icons,tags:pZ(a._meta),_meta:a._meta});return s.tools.set(r,Object.freeze({type:"tool",name:r,metadata:n})),Reflect.apply(t.registerTool,e,[r,a,...i])},e.registerPrompt=(r,a,...i)=>{let n=hK({name:r,title:a.title,description:a.description,icons:a.icons,tags:pZ(a._meta),_meta:a._meta});return s.prompts.set(r,Object.freeze({type:"prompt",name:r,metadata:n})),Reflect.apply(t.registerPrompt,e,[r,a,...i])},e.registerResource=(r,a,i,...n)=>{let o=hK({name:r,title:i.title,description:i.description,icons:i.icons,mimeType:i.mimeType,tags:pZ(i._meta),_meta:i._meta});if("string"==typeof a)s.resources.set(a,Object.freeze({type:"resource",name:r,uri:a,metadata:o}));else{let e=a.uriTemplate.toString();s.templates.set(r,{component:Object.freeze({type:"resourceTemplate",name:r,uriTemplate:e,metadata:o}),template:a})}return Reflect.apply(t.registerResource,e,[r,a,i,...n])};try{r(async(e,t,r)=>{let i=s.resources.get(t);return!i||await a(e,i,r)===!0})}finally{Object.assign(e,t)}for(let[e,t]of pT.getAll()){let r=s.tools.get(e);r&&s.uiOwners.set(t.uri,r)}}else r()}finally{i.setRequestHandler=n}}(e,n,i=>{var s,o;!function(e,t,r=[]){t.forEach((t,a)=>{var i,n;let s,o,l,c,u={name:h1(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(hL(m)?(!function(e,t){let{type:r}=hZ(e,"draft-2020-12","input");if(void 0!==r&&"object"!==r)throw Error(`Invalid schema for tool "${t}": tool input schemas must describe an object, got JSON Schema type ${JSON.stringify(r)}.`)}(m,u.name),f=m):h0(m)?f=m:null!=m&&console.warn(`Invalid schema for tool "${u.name}" at ${a}. Expected a zod schema or Record<string, z.ZodType>`),null!=h)if(hL(h))s=h;else if(h0(h))s=h;else throw Error(`Invalid outputSchema for tool "${u.name}" at ${a}. Expected a zod schema or Record<string, z.ZodType>`);u.annotations={...u.annotations??{}},void 0===u.annotations.title&&(u.annotations.title=u.name),u._meta={...pj(u)._meta};let g=hG(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))hQ.includes(e)?i[e]=t:hX.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"),pT.add(u.name,{name:u.name,uri:e,handler:d,mimeType:"text/html;profile=mcp-app",_meta:r,toolPath:g?a:void 0})}let _=hY(v),b=y?_:void 0;o=hG(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 s,o,l=e(i,(s=hJ(n),o=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:o?{headers:o}:void 0,clientInfo:s,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;p9(e,"Elicitation request must be a plain object."),p2(e,pW,"URL elicitation"),p4(e.message,"URL elicitation requires a string message."),p6(e.elicitationId,"URL elicitation requires a non-empty elicitationId."),p6(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){p9(e,"Elicitation request must be a plain object."),p2(e,pK,"Form elicitation"),p4(e.message,"Form elicitation requires a string message.");let t=e.requestedSchema;if(p9(t,"Form elicitation requires a flat object schema."),p2(t,pG,"Form elicitation schema"),"object"!==t.type)throw Error('Form elicitation schema must use type "object".');for(let[e,r]of(p9(t.properties,"Form elicitation schema requires a properties object."),Object.entries(t.properties)))!function(e,t){if(p9(t,`Form elicitation field "${e}" must be a plain object.`),p5(t.title,`Form elicitation field "${e}" title must be a string.`),p5(t.description,`Form elicitation field "${e}" description must be a string.`),"string"===t.type&&"enum"in t){var r,a;if(p2(t,pQ,`Form elicitation field "${e}"`),p8(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&&p8(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(p5(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)){p2(t,pY,`Form elicitation field "${e}"`),p3(t.minLength,`Form elicitation field "${e}" minLength must be a number.`),p3(t.maxLength,`Form elicitation field "${e}" maxLength must be a number.`),p5(t.default,`Form elicitation field "${e}" default must be a string.`);let r=t.format;if(p5(r,`Form elicitation field "${e}" format must be a string.`),void 0!==r&&!p1.has(r))throw Error(`Form elicitation field "${e}" format must be one of: ${Array.from(p1).join(", ")}.`);return}if("boolean"===t.type){if(p2(t,pX,`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){p2(t,p0,`Form elicitation field "${e}"`),p3(t.minimum,`Form elicitation field "${e}" minimum must be a number.`),p3(t.maximum,`Form elicitation field "${e}" maximum must be a number.`),p3(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 lD&&e.code===lZ.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){mr(e,"Sampling request must be a plain object.");let t=Object.keys(e),r=t.filter(e=>me.has(e));if(r.length>0)throw Error(`Sampling request key(s) not supported by xmcp yet: ${r.join(", ")}.`);let a=t.filter(e=>!p7.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(mr(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;mr(r,`Sampling message at index ${e} requires a content object.`);let a=r.type;if("string"!=typeof a||!mt.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 lD&&e.code===lZ.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),cF(l))return l;if(r&&hL(r)&&void 0!==l&&!hU(l)){if(await hF(l,r,a,"returned data that does not match outputSchema"),"string"==typeof l||"number"==typeof l)return{content:[{type:"text",text:`${l}`}],structuredContent:l};l={structuredContent:l}}if("string"==typeof l||"number"==typeof l){if(r&&!hL(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 hH(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)&&!hU(l)&&(await hF(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(hH(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}
83
+
84
+ Expected CallToolResult format:
85
+ {
86
+ content: [
87
+ { type: "text", text: "your text here" },
88
+ { type: "image", data: "base64data", mimeType: "image/jpeg" },
89
+ { type: "audio", data: "base64data", mimeType: "audio/mpeg" },
90
+ { type: "resource_link", name: "resource name", uri: "resource://uri" }
91
+ // All content types support an optional "_meta" object property
92
+ ]
93
+ }
94
+
95
+ Or with structured content:
96
+ {
97
+ structuredContent: { your: "data" }
98
+ }
99
+
100
+ Or both for backwards compatibility:
101
+ {
102
+ content: [{ type: "text", text: "fallback" }],
103
+ structuredContent: { your: "data" }
104
+ }
105
+
106
+ Or for widget metadata only:
107
+ {
108
+ _meta: {
109
+ "ui/...": ...
110
+ }
111
+ }`)}let c="content"in l&&Array.isArray(l.content),u="structuredContent"in l&&void 0!==l.structuredContent,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}
112
+
113
+ Expected CallToolResult format:
114
+ {
115
+ content: [
116
+ { type: "text", text: "your text here" },
117
+ { type: "image", data: "base64data", mimeType: "image/jpeg" },
118
+ { type: "audio", data: "base64data", mimeType: "audio/mpeg" },
119
+ { type: "resource_link", name: "resource name", uri: "resource://uri" }
120
+ ]
121
+ }
122
+
123
+ Or with structured content:
124
+ {
125
+ structuredContent: { your: "data" }
126
+ }
127
+
128
+ Or both for backwards compatibility:
129
+ {
130
+ content: [{ type: "text", text: "fallback" }],
131
+ structuredContent: { your: "data" }
132
+ }`)}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&&await hF(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=mi(t);if(!r.valid)throw Error(`Invalid content item at index ${e}: ${r.error}
133
+
134
+ Content item: ${JSON.stringify(t,null,2)}
135
+
136
+ Expected content formats:
137
+ - Text: { type: "text", text: "your text here" }
138
+ - Image: { type: "image", data: "base64data", mimeType: "image/jpeg" }
139
+ - Audio: { type: "audio", data: "base64data", mimeType: "audio/mpeg" }
140
+ - Resource: { type: "resource_link", name: "name", uri: "uri" }
141
+ All content types support an optional "_meta" object property`)}return l}}(d,b,s,u.name);let S={title:u.annotations?.title,description:u.description,inputSchema:hV(f),outputSchema:s?hV(s,{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=hB(r,!0),c=Object.freeze({metadata:hK(n)}),(e,t)=>l({method:"tools/call",params:{name:c.metadata.name,arguments:e},tool:c},t,()=>o(e,t))))})}(e,h9(t,u),n),h9(r,u).forEach((t,r)=>{let a=h1(r),i={name:a,title:a,description:"No description provided"},n={},{default:s,metadata:o,schema:l}=t;if("object"==typeof o&&null!==o&&Object.assign(i,o),!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 us.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=mi(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}
142
+
143
+ Validation error: ${e.error}
144
+
145
+ Expected formats:
146
+ - String: "your text here"
147
+ - Number: 42
148
+ - Messages: [{ role: "user", content: { type: "text", text: "your text here" } }]
149
+ - Prompt result: { description: "optional description", messages: [...] }
150
+ - Text content: { type: "text", text: "your text here" }
151
+ - Image content: { type: "image", data: "base64data", mimeType: "image/jpeg" }
152
+ - Audio content: { type: "audio", data: "base64data", mimeType: "audio/mpeg" }
153
+ - Resource link: { type: "resource_link", name: "resource name", uri: "resource://uri" }
154
+ - 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}]}}}(s,i.role||"assistant");h0(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:pj(i)._meta,argsSchema:hD(n)},c)}),s=h9(a,u),o=void 0,[...pT.getAll()].forEach(([t,r])=>{let a=r.mimeType||"text/html;profile=mcp-app",i=r?._meta?hY(r._meta):void 0,n={name:r.name,description:`Auto-generated resource for ${r.name} tool`,mimeType:r.mimeType,_meta:i};o?.(r.name,r.uri),e.registerResource(r.name,r.uri,n,async(e,t)=>{if(r.mimeType&&r.toolPath)try{var i;let e,t,n=(i=r.toolPath,function(e){let{normalizedPath:t,baseName:r}=function(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}}(e),a=l(6982).createHash("md5").update(t).digest("hex").slice(0,6);return`${r}_${a}`}(i)),s=function(e){try{let t=l(9896),r=l(6928);for(let a of[r.join(process.cwd(),"dist","client"),r.join(process.cwd(),"client")]){let i=r.join(a,`${e}.bundle.js`),n=r.join(a,`${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}(n);if(!s)throw Error(`React client bundle not found for "${r.name}" (bundle: "${n}").
155
+ React tool bundles are generated automatically when you run "xmcp build" (or "xmcp dev").
156
+ Please re-run the build so the framework can regenerate the bundle.`);let o=s.js,c=s.css,u=(e=`
157
+ <script type="module">
158
+ const componentSource = ${JSON.stringify(o)};
159
+ const blobUrl = URL.createObjectURL(
160
+ new Blob([componentSource], { type: "text/javascript" })
161
+ );
162
+
163
+ await import(blobUrl);
164
+
165
+ let nextId = 1;
166
+
167
+ window.parent.postMessage({
168
+ jsonrpc: "2.0",
169
+ id: nextId++,
170
+ method: ${JSON.stringify("ui/initialize")},
171
+ params: {
172
+ appCapabilities: {
173
+ availableDisplayModes: ["inline", "fullscreen", "pip"]
174
+ },
175
+ appInfo: { name: "xmcp React Widget", version: "1.0.0" },
176
+ protocolVersion: ${JSON.stringify("2026-01-26")}
177
+ }
178
+ }, "*");
179
+
180
+ window.addEventListener("message", (event) => {
181
+ const data = event.data;
182
+
183
+ if (event.source !== window.parent) return;
184
+
185
+ // handshake ack
186
+ if (data?.result?.hostContext && data?.id === 1) {
187
+ window.parent.postMessage({
188
+ jsonrpc: "2.0",
189
+ method: ${JSON.stringify("ui/notifications/initialized")},
190
+ params: {}
191
+ }, "*");
192
+ }
193
+ });
194
+
195
+ requestAnimationFrame(() => {
196
+ URL.revokeObjectURL(blobUrl);
197
+ });
198
+ <\/script>`,t=c?`<style>${c}</style>`:"",`<!DOCTYPE html>
199
+ <html>
200
+ <head>
201
+ <meta charset="utf-8">
202
+ <meta name="viewport" content="width=device-width, initial-scale=1">
203
+ ${t}
204
+ </head>
205
+ <body>
206
+ <div id="root"></div>
207
+ ${e}
208
+ </body>
209
+ </html>`);return{contents:[{uri:r.uri,text:u,mimeType:a,_meta:r._meta}]}}catch(e){throw console.error(`React failed for ${r.name}:`,e),e}let n=r.handler({},t);if(n instanceof Promise&&(n=await n),"string"==typeof n)return{contents:[{uri:r.uri,text:n,mimeType:a,_meta:r._meta}]};if(n&&"object"==typeof n&&"_meta"in n&&!("content"in n))return{contents:[{uri:r.uri,text:"",mimeType:a,_meta:r._meta}]};if(n&&"object"==typeof n&&"content"in n&&Array.isArray(n.content)){let e=n.content.find(e=>"text"===e.type);if(e&&"text"===e.type&&"string"==typeof e.text)return{contents:[{uri:r.uri,text:e.text,mimeType:a,_meta:r._meta}]}}return{contents:[{uri:r.uri,text:"",mimeType:a,_meta:r._meta}]}})}),s.forEach((t,r)=>{let a={name:h1(r),description:"No description provided"},{default:i,metadata:n,schema:s,complete:l}=t;if("object"==typeof n&&null!==n&&Object.assign(a,n),!1===a.enabled)return;let c={};h0(s)?c=s:null!=s&&console.warn(`Invalid schema for resource "${a.name}" at ${r}. Expected Record<string, z.ZodType>`);let u=h8(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=h8(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]||"",s=e.split("://")[1]||"",o=n.split("/"),l=s.split("/");for(let e=0;e<o.length&&e<l.length;e++){let t=o[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),cF(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}
210
+
211
+ Expected ReadResourceResult format:
212
+ {
213
+ contents: [
214
+ { uri: "resource://uri", text: "content here" },
215
+ { uri: "resource://uri", mimeType: "application/json", text: "json content" },
216
+ { uri: "resource://uri", blob: base64data }
217
+ ]
218
+ }`)}return n.contents.forEach(e=>{e.uri||(e.uri=t.href)}),n}}(i,r,c);if("direct"===u.type)o?.(a.name,d),e.registerResource(a.name,d,pj(a),p);else{let t=Object.create(null);for(let e of u.parameters)l&&Object.hasOwn(l,e)&&(t[e]=l[e]);let r=new pm(d,{list:void 0,complete:t});o?.(a.name,r),e.registerResource(a.name,r,pj(a),async(e,t,r)=>{let a={};for(let e of u.parameters){let r=t[e],i=c[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,i){let n=[...h9(new Map(t.map(e=>[e.uri,{metadata:{name:e.frontmatter.name},skill:e}])),r).values()].map(({skill:e})=>e);if(0===n.length)return;for(let{frontmatter:t,files:r}of n){let i=r[0].uri.slice(0,r[0].uri.lastIndexOf("/")+1);r.forEach(({uri:r,mimeType:n,text:s,blob:o},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!==s?{uri:r,mimeType:n,text:s}:{uri:r,mimeType:n,blob:o??""};a?.(u,r),e.registerResource(u,r,c,()=>({contents:[d]}))})}let s=n.map(fr),o=new Map(s.map(e=>[e.uri,e]));e.server.registerCapabilities({extensions:{"io.modelcontextprotocol/skills":{}}}),e.server.setRequestHandler("skills/list",{params:fe},(e,t)=>pL(t,hJ(t),async()=>{let t=Object.freeze({...pM(),method:"skills/list",params:Object.freeze({...e})}),r=i?await Promise.all(s.map(e=>i(t,e.uri,"list"))):void 0,a=r?s.filter((e,t)=>r[t]):s,n=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 cu(cc.InvalidParams,`Invalid cursor: ${e}`);return r}(e.cursor,a.length),o=n+50;return{skills:a.slice(n,o),...o<a.length?{nextCursor:btoa(String(o))}:{},...h7}})),e.server.setRequestHandler("skills/get",{params:ft},(e,t)=>pL(t,hJ(t),async()=>{let{uri:t}=e,r=o.get(t),a=Object.freeze({...pM(),method:"skills/get",params:Object.freeze({...e})});if(!r||i&&!await i(a,t,"read"))throw new cu(cc.InvalidParams,`No skill is served at ${t}`);return{skill:r,...h7}}))}(e,fn,u,void 0,i)},s),e}(e,c,u,d)}();return e.server.oninitialized=()=>{pF({clientInfo:pJ(e.server.getClientVersion())})},e},{legacy:"serve",onerror:void 0}),e=()=>{process.exit(0)},process.on("SIGINT",e),process.on("SIGTERM",e)})})(),{}})()},290(e){e.exports=t("async_hooks")},982(e){e.exports=t("crypto")},896(e){e.exports=t("fs")},455(e){e.exports=t("node:fs/promises")},760(e){e.exports=t("node:path")},708(e){e.exports=t("node:process")},857(e){e.exports=t("os")},928(e){e.exports=t("path")},16(e){e.exports=t("url")}},n={};function s(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}};return i[e].call(r.exports,r,r.exports,s),r.exports}s.m=i,s.d=(e,t,r)=>{var a=(t,r)=>{for(var a in t)s.o(t,a)&&!s.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,[r]:t[a]})};a(t,"get"),a(r,"value")},s.f={},s.e=e=>Promise.all(Object.keys(s.f).reduce((t,r)=>(s.f[r](e,t),t),[])),s.u=e=>e+".js",s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{Object.defineProperties(e,{[Symbol.toStringTag]:{value:"Module"},__esModule:{value:!0}})},r={435:0},a=e=>{var t,a,i=e.__rspack_esm_ids,n=e.__webpack_modules__,o=e.__rspack_esm_runtime,l=0;for(t in n)s.o(n,t)&&(s.m[t]=n[t]);for(o&&o(s);l<i.length;l++)a=i[l],s.o(r,a)&&r[a]&&r[a][0](),r[a]=0},s.f.j=function(e,t){var i=s.o(r,e)?r[e]:void 0;if(0!==i)if(i)t.push(i[1]);else{var n=import("./"+s.u(e)).then(a,t=>{throw 0!==r[e]&&(r[e]=void 0),t}),n=Promise.race([n,new Promise(t=>{i=r[e]=[t]})]);t.push(i[1]=n)}},s(241);