xmcp 1.7.0 → 1.7.1
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/client.js +23 -21
- package/dist/index.js +40 -38
- package/dist/runtime/adapter-express.js +23 -25
- package/dist/runtime/adapter-fastify.js +23 -25
- package/dist/runtime/adapter-fetch-cloudflare.js +22 -24
- package/dist/runtime/adapter-fetch.js +23 -25
- package/dist/runtime/adapter-nestjs.js +23 -25
- package/dist/runtime/adapter-nextjs.js +38 -40
- package/dist/runtime/cloudflare-worker.js +30 -32
- package/dist/runtime/http.js +30 -32
- package/dist/runtime/stdio.js +18 -20
- package/dist/runtime/vercel.js +30 -32
- package/package.json +3 -3
package/dist/runtime/stdio.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
!function(t,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r();else if("function"==typeof define&&define.amd)define([],r);else{var a=r();for(var i in a)("object"==typeof exports?exports:t)[i]=a[i]}}(this,()=>(()=>{var t={8583(t,r,a){let i=a(9896),n=a(6928),o=a(857),s=a(6982),l=a(4519).version,c=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function u(t){console.log(`[dotenv@${l}][DEBUG] ${t}`)}function d(t){console.log(`[dotenv@${l}] ${t}`)}function p(t){return t&&t.DOTENV_KEY&&t.DOTENV_KEY.length>0?t.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function m(t){let r=null;if(t&&t.path&&t.path.length>0)if(Array.isArray(t.path))for(let a of t.path)i.existsSync(a)&&(r=a.endsWith(".vault")?a:`${a}.vault`);else r=t.path.endsWith(".vault")?t.path:`${t.path}.vault`;else r=n.resolve(process.cwd(),".env.vault");return i.existsSync(r)?r:null}function h(t){return"~"===t[0]?n.join(o.homedir(),t.slice(1)):t}let f={configDotenv:function(t){let r,a=n.resolve(process.cwd(),".env"),o="utf8",s=!!(t&&t.debug),l=!t||!("quiet"in t)||t.quiet;t&&t.encoding?o=t.encoding:s&&u("No encoding is specified. UTF-8 is used by default");let c=[a];if(t&&t.path)if(Array.isArray(t.path))for(let r of(c=[],t.path))c.push(h(r));else c=[h(t.path)];let p={};for(let a of c)try{let r=f.parse(i.readFileSync(a,{encoding:o}));f.populate(p,r,t)}catch(t){s&&u(`Failed to load ${a} ${t.message}`),r=t}let m=process.env;if(t&&null!=t.processEnv&&(m=t.processEnv),f.populate(m,p,t),s||!l){let t=Object.keys(p).length,a=[];for(let t of c)try{let r=n.relative(process.cwd(),t);a.push(r)}catch(a){s&&u(`Failed to load ${t} ${a.message}`),r=a}d(`injecting env (${t}) from ${a.join(",")}`)}return r?{parsed:p,error:r}:{parsed:p}},_configVault:function(t){let r=!!(t&&t.debug),a=!t||!("quiet"in t)||t.quiet;(r||!a)&&d("Loading env from encrypted .env.vault");let i=f._parseVault(t),n=process.env;return t&&null!=t.processEnv&&(n=t.processEnv),f.populate(n,i,t),{parsed:i}},_parseVault:function(t){let r,a=m(t=t||{});t.path=a;let i=f.configDotenv(t);if(!i.parsed){let t=Error(`MISSING_DATA: Cannot parse ${a} for an unknown reason`);throw t.code="MISSING_DATA",t}let n=p(t).split(","),o=n.length;for(let t=0;t<o;t++)try{let a=n[t].trim(),o=function(t,r){let a;try{a=new URL(r)}catch(t){if("ERR_INVALID_URL"===t.code){let t=Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw t.code="INVALID_DOTENV_KEY",t}throw t}let i=a.password;if(!i){let t=Error("INVALID_DOTENV_KEY: Missing key part");throw t.code="INVALID_DOTENV_KEY",t}let n=a.searchParams.get("environment");if(!n){let t=Error("INVALID_DOTENV_KEY: Missing environment part");throw t.code="INVALID_DOTENV_KEY",t}let o=`DOTENV_VAULT_${n.toUpperCase()}`,s=t.parsed[o];if(!s){let t=Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${o} in your .env.vault file.`);throw t.code="NOT_FOUND_DOTENV_ENVIRONMENT",t}return{ciphertext:s,key:i}}(i,a);r=f.decrypt(o.ciphertext,o.key);break}catch(r){if(t+1>=o)throw r}return f.parse(r)},config:function(t){if(0===p(t).length)return f.configDotenv(t);let r=m(t);if(!r){var a;return a=`You set DOTENV_KEY but you are missing a .env.vault file at ${r}. Did you forget to build it?`,console.log(`[dotenv@${l}][WARN] ${a}`),f.configDotenv(t)}return f._configVault(t)},decrypt:function(t,r){let a=Buffer.from(r.slice(-64),"hex"),i=Buffer.from(t,"base64"),n=i.subarray(0,12),o=i.subarray(-16);i=i.subarray(12,-16);try{let t=s.createDecipheriv("aes-256-gcm",a,n);return t.setAuthTag(o),`${t.update(i)}${t.final()}`}catch(i){let t=i instanceof RangeError,r="Invalid key length"===i.message,a="Unsupported state or unable to authenticate data"===i.message;if(t||r){let t=Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw t.code="INVALID_DOTENV_KEY",t}if(a){let t=Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw t.code="DECRYPTION_FAILED",t}throw i}},parse:function(t){let r,a={},i=t.toString();for(i=i.replace(/\r\n?/mg,"\n");null!=(r=c.exec(i));){let t=r[1],i=r[2]||"",n=(i=i.trim())[0];i=i.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),'"'===n&&(i=(i=i.replace(/\\n/g,"\n")).replace(/\\r/g,"\r")),a[t]=i}return a},populate:function(t,r,a={}){let i=!!(a&&a.debug),n=!!(a&&a.override);if("object"!=typeof r){let t=Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw t.code="OBJECT_REQUIRED",t}for(let a of Object.keys(r))Object.prototype.hasOwnProperty.call(t,a)?(!0===n&&(t[a]=r[a]),i&&(!0===n?u(`"${a}" is already defined and WAS overwritten`):u(`"${a}" is already defined and was NOT overwritten`))):t[a]=r[a]}};t.exports.configDotenv=f.configDotenv,t.exports._configVault=f._configVault,t.exports._parseVault=f._parseVault,t.exports.config=f.config,t.exports.decrypt=f.decrypt,t.exports.parse=f.parse,t.exports.populate=f.populate,t.exports=f},6982(t){"use strict";t.exports=require("crypto")},9896(t){"use strict";t.exports=require("fs")},857(t){"use strict";t.exports=require("os")},6928(t){"use strict";t.exports=require("path")},4519(t){"use strict";t.exports=JSON.parse('{"name":"dotenv","version":"16.6.1","description":"Loads environment variables from .env file","main":"lib/main.js","types":"lib/main.d.ts","exports":{".":{"types":"./lib/main.d.ts","require":"./lib/main.js","default":"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},"scripts":{"dts-check":"tsc --project tests/types/tsconfig.json","lint":"standard","pretest":"npm run lint && npm run dts-check","test":"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov","prerelease":"npm test","release":"standard-version"},"repository":{"type":"git","url":"git://github.com/motdotla/dotenv.git"},"homepage":"https://github.com/motdotla/dotenv#readme","funding":"https://dotenvx.com","keywords":["dotenv","env",".env","environment","variables","config","settings"],"readmeFilename":"README.md","license":"BSD-2-Clause","devDependencies":{"@types/node":"^18.11.3","decache":"^4.6.2","sinon":"^14.0.1","standard":"^17.0.0","standard-version":"^9.5.0","tap":"^19.2.0","typescript":"^4.8.4"},"engines":{"node":">=12"},"browser":{"fs":false}}')}},r={};function a(i){var n=r[i];if(void 0!==n)return n.exports;var o=r[i]={exports:{}};return t[i](o,o.exports,a),o.exports}return a.n=t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return a.d(r,{a:r}),r},a.d=(t,r)=>{for(var i in r)a.o(r,i)&&!a.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:r[i]})},a.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r),(()=>{"use strict";let t,r,i,n,o,s,l,c,u,d,p,m,h,f,y,g,v,_,b,S,$;var w,k,x,R,P,E,O,T,j,N,C,I,q,z,A=Object.create,M=Object.defineProperty,L=Object.getOwnPropertyDescriptor,D=Object.getOwnPropertyNames,Z=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty,F=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports);let U=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),J=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),H=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),K=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function B(t){let r=Object.values(t).filter(t=>"number"==typeof t);return Object.entries(t).filter(([t,a])=>-1===r.indexOf(+t)).map(([t,r])=>r)}function W(t,r="|"){return t.map(t=>eg(t)).join(r)}function G(t,r){return"bigint"==typeof r?r.toString():r}class Y{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return void 0!==t&&(this._value=t(),this._getter=void 0),this._value}}function X(t){return new Y(t)}function Q(t){let r=+!!t.startsWith("^"),a=t.endsWith("$")?t.length-1:t.length;return t.slice(r,a)}let ee=Symbol("evaluating");function et(t,r,a){Object.defineProperty(t,r,{value:a,writable:!0,enumerable:!0,configurable:!0})}function er(t){let r=Object.getOwnPropertyDescriptor(t,"shape");return r?.get?r.get.raw:r?.value}function ea(t){return er(t._zod.def)??t._zod.def.shape}function ei(t,r,a){Object.defineProperty(t,r,{get(){let t=a();return et(this,r,t),t},enumerable:!0,configurable:!0})}function en(t,r,a){r in t?et(t,r,a):t[r]=a}function eo(t,r,a,i){let n=ea(r);for(let o of a){let a=Object.getOwnPropertyDescriptor(n,o);a.enumerable&&(a.get?ei(t,o,()=>{let t=r._zod.def.shape[o];return i?i(t,o):t}):en(t,o,i?i(a.value,o):a.value))}}function es(...t){let r={};for(let a of t)Object.assign(r,Object.getOwnPropertyDescriptors(a));return Object.defineProperties({},r)}let el="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function ec(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}let eu=X(()=>{if(eF.jitless||"undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(t){return!1}});function ed(t){if(!1===ec(t))return!1;let r=t.constructor;if(void 0===r||"function"!=typeof r)return!0;let a=r.prototype;return!1!==ec(a)&&!1!==Object.prototype.hasOwnProperty.call(a,"isPrototypeOf")}function ep(t){return ed(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}let em=new Set(["string","number","symbol"]);function eh(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ef(t,r,a){let i=new t._zod.constr(r??t._zod.def);return(!r||a?.parent)&&(i._zod.parent=t),i}function ey(t){if(!t)return{};if("string"==typeof t)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return(delete t.message,"string"==typeof t.error)?{...t,error:()=>t.error}:t}function eg(t){return"bigint"==typeof t?t.toString()+"n":"string"==typeof t?`"${t}"`:`${t}`}let ev={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-0x80000000,0x7fffffff],uint32:[0,0xffffffff],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},e_={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function eb(t,r){let a=ea(t),i=[];for(let t of Reflect.ownKeys(r)){if(!Object.getOwnPropertyDescriptor(a,t)?.enumerable)throw Error(`Unrecognized key: "${String(t)}"`);r[t]&&i.push(t)}return i}function eS(t,r){let a={};eo(a,t,Reflect.ownKeys(ea(t)));for(let t of Reflect.ownKeys(r)){let i=Object.getOwnPropertyDescriptor(r,t);i.enumerable&&(i.get?ei(a,t,()=>r[t]):en(a,t,i.value))}return a}function e$(t,r,a,i="partial"){let n=r._zod.def.checks;if(n&&n.length>0)throw Error(`.${i}() cannot be used on object schemas containing refinements`);let o=a?new Set(eb(r,a)):void 0,s={};return eo(s,r,Reflect.ownKeys(ea(r)),t&&((r,a)=>o&&!o.has(a)?r:new t({type:"optional",innerType:r}))),ef(r,es(r._zod.def,{shape:s,checks:[]}))}function ew(t,r=0){if(!0===t.aborted)return!0;for(let a=r;a<t.issues.length;a++)if(t.issues[a]?.continue!==!0)return!0;return!1}function ek(t,r){return r.map(r=>(r.path??(r.path=[]),r.path.unshift(t),r))}function ex(t){return"string"==typeof t?t:t?.message}function eR(t,r,a){var i;for(let n=r;n<t.length;n++)(i=t[n]).schema??(i.schema=a)}function eP(t,r,a){let i=t.inst?._zod?.traits;i?.has("$ZodType")&&(i.has("$ZodCheck")?t.schema??(t.schema=t.inst):t.schema=t.inst);let n=t.schema!==t.inst?t.schema?._zod.def?.error:void 0,o=t.message?t.message:ex(t.inst?._zod.def?.error?.(t))??ex(n?.(t))??ex(r?.error?.(t))??ex(a.customError?.(t))??ex(a.localeError?.(t))??"Invalid input",s={};for(let r of Object.keys(t))"inst"!==r&&"schema"!==r&&"continue"!==r&&"input"!==r&&"__proto__"!==r&&(s[r]=t[r]);return s.path??(s.path=[]),s.message=o,r?.reportInput&&(s.input=t.input),s}let eE=/[\uD800-\uDBFF]/;function eO(t){let r=t.length;if(!eE.test(t))return r;let a=r;for(let i=0;i<r-1;i++)(64512&t.charCodeAt(i))==55296&&(64512&t.charCodeAt(i+1))==56320&&(a--,i++);return a}function eT(t){return Array.isArray(t)?"array":"string"==typeof t?"string":"unknown"}function ej(...t){let[r,a,i]=t;return"string"==typeof r?{message:r,code:"custom",input:a,inst:i}:{...r}}function eN(t,r,a,i=!0){return Object.defineProperty(t,r,{configurable:!0,writable:!0,enumerable:i,value:a}),a}function eC(t,r){for(let a in t){let i=t[a];Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get(){return eN(this,a,i(this))},set(t){eN(this,a,t)}})}return r}let eI=!1,eq={configurable:!0,get(){eI=!0}};function ez(r,a,i){let n=Object.getPrototypeOf(r._zod);if(a in n&&t!==r._zod){t=void 0;return}t=r._zod,Object.defineProperty(n,a,{configurable:!0,get(){Object.defineProperty(this,a,eq);let t=eI;eI=!1;try{let r=i(this);return eI?delete this[a]:Object.defineProperty(this,a,{configurable:!0,writable:!0,value:r}),eI=eI||t,r}catch(r){throw delete this[a],eI=eI||t,r}},set(t){Object.defineProperty(this,a,{configurable:!0,writable:!0,value:t})}})}let eA=Object.freeze({status:"aborted"}),eM={value:void 0,enumerable:!1},eL="captureStackTrace"in Error?Error:null;function eD(t,r,a,i){function n(t){this.def=t,this.constr=u,this.traits=new Set}n.prototype={};let o=a&&new WeakSet;function s(i,s){if(i._zod){if(i._zod.traits.has(t))return}else{eM.value=new n(s);try{Object.defineProperty(i,"_zod",eM)}finally{eM.value=void 0}}if(i._zod.traits.add(t),r(i,s),o){let t=Object.getPrototypeOf(i),r=i._zod.constr.prototype,n=t;for(;n&&n!==r;)n=Object.getPrototypeOf(n);let s=n??t;if(!o.has(s)){o.add(s);for(let t in a){let r=Object.getOwnPropertyDescriptor(a,t);r.get?Object.defineProperty(s,t,{...r,enumerable:!1}):function(t,r,a){Object.defineProperty(t,r,{configurable:!0,get(){return this==null?a:eN(this,r,a.bind(this))},set(t){eN(this,r,t)}})}(s,t,r.value)}}}let l=u.prototype;for(let t in l)Object.prototype.hasOwnProperty.call(l,t)&&(t in i||(i[t]=l[t].bind(i)))}let l=i?.Parent??Object;class c extends l{}function u(t){let r=i?.Parent?function(t){let r=eL;if(r){let a=r.stackTraceLimit;if("number"==typeof a){try{r.stackTraceLimit=0}catch{return eL=null,new t}try{return new t}finally{r.stackTraceLimit=a}}}return new t}(c):this;s(r,t);let a=r._zod.deferred;if(a){for(let t of a)t();r._zod.deferred=void 0}let n=globalThis.__zod_globalConfig?.postProcessor;return n&&n(r),r}return Object.defineProperty(c,"name",{value:t}),Object.defineProperty(u,"init",{value:s}),Object.defineProperty(u,Symbol.hasInstance,{value:r=>!!i?.Parent&&r instanceof i.Parent||r?._zod?.traits?.has(t)}),Object.defineProperty(u,"name",{value:t}),u}class eZ extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class eV extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(O=globalThis).__zod_globalConfig??(O.__zod_globalConfig={});let eF=globalThis.__zod_globalConfig;function eU(t){return t&&Object.assign(eF,t),eF}class eJ extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}let eH="~memo",eK=[];function eB(t){return null!==t&&"object"==typeof t}function eW(t){return t.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}let eG=new WeakMap,eY=[],eX={alloc(t,a,i){let n=r;if(!n)return i;r=void 0;let o={value:i,issues:null};return n.set(a.value,o),eY.push(o),i},guard(t){var r;(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred.push(()=>{let r=t._zod.parse,a=(t,a)=>{var i,n;let o;if("backward"!==a.direction&&(i=a,n=t.value,void 0!==(o=i[eH]?.backEdges)&&eB(n)&&o.has(n)))throw new eJ;return r(t,a)};t._zod.parse=a,t._zod.run===r&&(t._zod.run=a)})},attach(t){var a;let i,n,o,s=!1;(a=t._zod).deferred??(a.deferred=[]),t._zod.deferred.push(()=>{let a=t._zod.parse,l=(c,u)=>{let d;if(void 0===i){let r=function t(r,a,i){var n,o;let s=eG.get(r);if(void 0!==s)return 2*!!s;if(a.has(r))return 2;a.add(r);let l=0,c=r=>{if(2!==l&&r?._zod){let n=t(r,a,i);n>l&&(l=n)}},u=t=>{t>l&&(l=t)},d=r._zod.def;switch(d.type){case"object":{let r=er(d);u(r?((r,n)=>{let o=0;for(let s of Reflect.ownKeys(r)){let l=Object.getOwnPropertyDescriptor(r,s);if(n&&!l.enumerable)continue;let c=l.get?1:l.value?._zod?t(l.value,a,i):0;c>o&&(o=c)}return o})(r,!0):1),c(d.catchall);break}case"array":c(d.element);break;case"tuple":for(let t of d.items)c(t);c(d.rest);break;case"record":case"map":c(d.keyType),c(d.valueType);break;case"set":c(d.valueType);break;case"union":for(let t of d.options)c(t);break;case"intersection":c(d.left),c(d.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":c(d.innerType);break;case"pipe":c(d.in),c(d.out);break;case"function":c(d.input),c(d.output);break;case"lazy":{let n=d._cachedInner??(i?r._zod.innerType:void 0);u(n?t(n,a,!1):1);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let t in d){let r=Object.getOwnPropertyDescriptor(d,t);if(!r||r.get)continue;let a=r.value;if(a&&"object"==typeof a){if(a._zod)c(a);else if(Array.isArray(a))for(let t of a)c(t)}}}return a.delete(r),n=r,1!==(o=l)&&eG.set(n,2===o),o}(t,new Set,!1);if(0===r)return t._zod.parse=a,t._zod.run===l&&(t._zod.run=a),a(c,u);2===r||s?i=!0:s=!0}let p=c.value;if(!eB(p))return a(c,u);let m=u[eH];if(m||(m={buckets:new WeakMap,backEdges:void 0},u[eH]=m),n===u)d=o;else{var h;let r;(r=(h=m).buckets.get(t))||(r=new WeakMap,h.buckets.set(t,r)),d=r,n=u,o=d}let f=d.get(p);if(f)return c.value=f.value,f.issues?f.issues.length&&c.issues.push(...eW(f.issues)):(c.memo=!0,m.backEdges??(m.backEdges=new WeakSet),m.backEdges.add(f.value)),c;r=d;let y=eY.length,g=a(c,u);r=void 0;let v=eY.length>y?eY.pop():void 0;return g instanceof Promise?g.then(t=>(v&&(v.issues=t.issues.length?eW(t.issues):eK),t)):(v&&(v.issues=g.issues.length?eW(g.issues):eK),g)};t._zod.parse=l,t._zod.run===a&&(t._zod.run=l)})}},eQ=/^[cC][0-9a-z]{6,}$/,e0=/^[0-9a-z]+$/,e1=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,e2=/^[0-9a-vA-V]{20}$/,e9=/^[A-Za-z0-9]{27}$/,e4=/^[a-zA-Z0-9_-]{21}$/,e6=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,e3=/^([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})$/,e5=t=>t?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,e8=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,e7=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,te=/^(?:(?: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])$/,tt=/^(([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}|:))$/,tr=/^((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])$/,ta=/^(([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])$/,ti=/^https?$/,tn=/^\+[1-9]\d{6,14}$/,to="(?:(?:\\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])))",ts=RegExp(`^${to}$`);function tl(t){let r="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof t.precision?-1===t.precision?`${r}`:0===t.precision?`${r}:[0-5]\\d`:`${r}:[0-5]\\d\\.\\d{${t.precision}}`:t.seconds?`${r}:[0-5]\\d(?:\\.\\d+)?`:`${r}(?::[0-5]\\d(?:\\.\\d+)?)?`}let tc=/^[\s\S]{0,}$/,tu=/^-?\d+$/,td=/^-?\d+(?:\.\d+)?$/,tp=/^(?:true|false)$/i,tm=/^null$/i,th=/^[^A-Z]*$/,tf=/^[^a-z]*$/,ty=eD("$ZodCheck",(t,r)=>{var a;t._zod??(t._zod={}),t._zod.def=r,(a=t._zod).onattach??(a.onattach=[])}),tg=t=>{let r=t.value;return null!=r&&void 0!==r.length},tv={number:"number",bigint:"bigint",object:"date"},t_=eD("$ZodCheckLessThan",(t,r)=>{ty.init(t,r);let a=tv[typeof r.value];t._zod.check=i=>{(r.inclusive?i.value<=r.value:i.value<r.value)||i.issues.push({origin:tv[typeof i.value]??a,code:"too_big",maximum:"object"==typeof r.value?r.value.getTime():r.value,input:i.value,inclusive:r.inclusive,inst:t,continue:!r.abort})}}),tb=eD("$ZodCheckGreaterThan",(t,r)=>{ty.init(t,r);let a=tv[typeof r.value];t._zod.check=i=>{(r.inclusive?i.value>=r.value:i.value>r.value)||i.issues.push({origin:tv[typeof i.value]??a,code:"too_small",minimum:"object"==typeof r.value?r.value.getTime():r.value,input:i.value,inclusive:r.inclusive,inst:t,continue:!r.abort})}}),tS=eD("$ZodCheckMultipleOf",(t,r)=>{ty.init(t,r),t._zod.check=a=>{let i,n,o;if(typeof a.value!=typeof r.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof a.value?r.value!==BigInt(0)&&a.value%r.value===BigInt(0):0==(n=Math.round(i=a.value/r.value),o=4*Number.EPSILON*Math.max(Math.abs(i),1),Math.abs(i-n)<o?0:i-n))||a.issues.push({origin:typeof a.value,code:"not_multiple_of",divisor:r.value,input:a.value,inst:t,continue:!r.abort})}}),t$=eD("$ZodCheckNumberFormat",(t,r)=>{ty.init(t,r),r.format=r.format||"float64";let a=r.format?.includes("int"),i=a?"int":"number",[n,o]=ev[r.format];t._zod.check=s=>{let l=s.value;if(a){if(!Number.isInteger(l))return void s.issues.push({expected:i,format:r.format,code:"invalid_type",continue:!1,input:l,inst:t});if(!Number.isSafeInteger(l))return void(l>0?s.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:i,inclusive:!0,continue:!r.abort}):s.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:i,inclusive:!0,continue:!r.abort}))}l<n&&s.issues.push({origin:"number",input:l,code:"too_small",minimum:n,inclusive:!0,inst:t,continue:!r.abort}),l>o&&s.issues.push({origin:"number",input:l,code:"too_big",maximum:o,inclusive:!0,inst:t,continue:!r.abort})}}),tw=eD("$ZodCheckMaxLength",(t,r)=>{var a;ty.init(t,r),(a=t._zod.def).when??(a.when=tg),t._zod.check=a=>{let i=a.value,n=i.length;if(("string"==typeof i&&n>r.maximum?eO(i):n)<=r.maximum)return;let o=eT(i);a.issues.push({origin:o,code:"too_big",maximum:r.maximum,inclusive:!0,input:i,inst:t,continue:!r.abort})}}),tk=eD("$ZodCheckMinLength",(t,r)=>{var a;ty.init(t,r),(a=t._zod.def).when??(a.when=tg),t._zod.check=a=>{let i=a.value,n=i.length;if(("string"==typeof i&&n>=r.minimum&&n<2*r.minimum?eO(i):n)>=r.minimum)return;let o=eT(i);a.issues.push({origin:o,code:"too_small",minimum:r.minimum,inclusive:!0,input:i,inst:t,continue:!r.abort})}}),tx=eD("$ZodCheckLengthEquals",(t,r)=>{var a;ty.init(t,r),(a=t._zod.def).when??(a.when=tg),t._zod.check=a=>{let i=a.value,n=i.length,o="string"==typeof i&&n>=r.length&&n<=2*r.length?eO(i):n;if(o===r.length)return;let s=eT(i),l=o>r.length;a.issues.push({origin:s,...l?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length},inclusive:!0,exact:!0,input:a.value,inst:t,continue:!r.abort})}}),tR=eD("$ZodCheckStringFormat",(t,r)=>{var a,i;ty.init(t,r),r.pattern?(a=t._zod).check??(a.check=a=>{r.pattern.lastIndex=0,r.pattern.test(a.value)||a.issues.push({origin:"string",code:"invalid_format",format:r.format,input:a.value,...r.pattern?{pattern:r.pattern.toString()}:{},inst:t,continue:!r.abort})}):(i=t._zod).check??(i.check=()=>{})}),tP=eD("$ZodCheckRegex",(t,r)=>{tR.init(t,r),t._zod.check=a=>{r.pattern.lastIndex=0,r.pattern.test(a.value)||a.issues.push({origin:"string",code:"invalid_format",format:"regex",input:a.value,pattern:r.pattern.toString(),inst:t,continue:!r.abort})}}),tE=eD("$ZodCheckLowerCase",(t,r)=>{r.pattern??(r.pattern=th),tR.init(t,r)}),tO=eD("$ZodCheckUpperCase",(t,r)=>{r.pattern??(r.pattern=tf),tR.init(t,r)}),tT=eD("$ZodCheckIncludes",(t,r)=>{ty.init(t,r);let a=eh(r.includes),i=new RegExp("number"==typeof r.position?`^.{${r.position},}${a}`:a);r.pattern=i,t._zod.check=a=>{a.value.includes(r.includes,r.position)||a.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:r.includes,input:a.value,inst:t,continue:!r.abort})}}),tj=eD("$ZodCheckStartsWith",(t,r)=>{ty.init(t,r);let a=RegExp(`^${eh(r.prefix)}.*`);r.pattern??(r.pattern=a),t._zod.check=a=>{a.value.startsWith(r.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:r.prefix,input:a.value,inst:t,continue:!r.abort})}}),tN=eD("$ZodCheckEndsWith",(t,r)=>{ty.init(t,r);let a=RegExp(`.*${eh(r.suffix)}$`);r.pattern??(r.pattern=a),t._zod.check=a=>{a.value.endsWith(r.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:r.suffix,input:a.value,inst:t,continue:!r.abort})}}),tC=eD("$ZodCheckOverwrite",(t,r)=>{ty.init(t,r),t._zod.check=t=>{t.value=r.tx(t.value)}});class tI{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if("function"==typeof t){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let r=t.split("\n").filter(t=>t),a=Math.min(...r.map(t=>t.length-t.trimStart().length));for(let t of r.map(t=>t.slice(a)).map(t=>" ".repeat(2*this.indent)+t))this.content.push(t)}compile(){let t=Function,r=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
1
|
+
!function(t,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r();else if("function"==typeof define&&define.amd)define([],r);else{var a=r();for(var i in a)("object"==typeof exports?exports:t)[i]=a[i]}}(this,()=>(()=>{var t={8583(t,r,a){let i=a(9896),n=a(6928),o=a(857),s=a(6982),l=a(4519).version,c=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function u(t){console.log(`[dotenv@${l}][DEBUG] ${t}`)}function d(t){console.log(`[dotenv@${l}] ${t}`)}function p(t){return t&&t.DOTENV_KEY&&t.DOTENV_KEY.length>0?t.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function m(t){let r=null;if(t&&t.path&&t.path.length>0)if(Array.isArray(t.path))for(let a of t.path)i.existsSync(a)&&(r=a.endsWith(".vault")?a:`${a}.vault`);else r=t.path.endsWith(".vault")?t.path:`${t.path}.vault`;else r=n.resolve(process.cwd(),".env.vault");return i.existsSync(r)?r:null}function h(t){return"~"===t[0]?n.join(o.homedir(),t.slice(1)):t}let f={configDotenv:function(t){let r,a=n.resolve(process.cwd(),".env"),o="utf8",s=!!(t&&t.debug),l=!t||!("quiet"in t)||t.quiet;t&&t.encoding?o=t.encoding:s&&u("No encoding is specified. UTF-8 is used by default");let c=[a];if(t&&t.path)if(Array.isArray(t.path))for(let r of(c=[],t.path))c.push(h(r));else c=[h(t.path)];let p={};for(let a of c)try{let r=f.parse(i.readFileSync(a,{encoding:o}));f.populate(p,r,t)}catch(t){s&&u(`Failed to load ${a} ${t.message}`),r=t}let m=process.env;if(t&&null!=t.processEnv&&(m=t.processEnv),f.populate(m,p,t),s||!l){let t=Object.keys(p).length,a=[];for(let t of c)try{let r=n.relative(process.cwd(),t);a.push(r)}catch(a){s&&u(`Failed to load ${t} ${a.message}`),r=a}d(`injecting env (${t}) from ${a.join(",")}`)}return r?{parsed:p,error:r}:{parsed:p}},_configVault:function(t){let r=!!(t&&t.debug),a=!t||!("quiet"in t)||t.quiet;(r||!a)&&d("Loading env from encrypted .env.vault");let i=f._parseVault(t),n=process.env;return t&&null!=t.processEnv&&(n=t.processEnv),f.populate(n,i,t),{parsed:i}},_parseVault:function(t){let r,a=m(t=t||{});t.path=a;let i=f.configDotenv(t);if(!i.parsed){let t=Error(`MISSING_DATA: Cannot parse ${a} for an unknown reason`);throw t.code="MISSING_DATA",t}let n=p(t).split(","),o=n.length;for(let t=0;t<o;t++)try{let a=n[t].trim(),o=function(t,r){let a;try{a=new URL(r)}catch(t){if("ERR_INVALID_URL"===t.code){let t=Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw t.code="INVALID_DOTENV_KEY",t}throw t}let i=a.password;if(!i){let t=Error("INVALID_DOTENV_KEY: Missing key part");throw t.code="INVALID_DOTENV_KEY",t}let n=a.searchParams.get("environment");if(!n){let t=Error("INVALID_DOTENV_KEY: Missing environment part");throw t.code="INVALID_DOTENV_KEY",t}let o=`DOTENV_VAULT_${n.toUpperCase()}`,s=t.parsed[o];if(!s){let t=Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${o} in your .env.vault file.`);throw t.code="NOT_FOUND_DOTENV_ENVIRONMENT",t}return{ciphertext:s,key:i}}(i,a);r=f.decrypt(o.ciphertext,o.key);break}catch(r){if(t+1>=o)throw r}return f.parse(r)},config:function(t){if(0===p(t).length)return f.configDotenv(t);let r=m(t);if(!r){var a;return a=`You set DOTENV_KEY but you are missing a .env.vault file at ${r}. Did you forget to build it?`,console.log(`[dotenv@${l}][WARN] ${a}`),f.configDotenv(t)}return f._configVault(t)},decrypt:function(t,r){let a=Buffer.from(r.slice(-64),"hex"),i=Buffer.from(t,"base64"),n=i.subarray(0,12),o=i.subarray(-16);i=i.subarray(12,-16);try{let t=s.createDecipheriv("aes-256-gcm",a,n);return t.setAuthTag(o),`${t.update(i)}${t.final()}`}catch(i){let t=i instanceof RangeError,r="Invalid key length"===i.message,a="Unsupported state or unable to authenticate data"===i.message;if(t||r){let t=Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw t.code="INVALID_DOTENV_KEY",t}if(a){let t=Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw t.code="DECRYPTION_FAILED",t}throw i}},parse:function(t){let r,a={},i=t.toString();for(i=i.replace(/\r\n?/mg,"\n");null!=(r=c.exec(i));){let t=r[1],i=r[2]||"",n=(i=i.trim())[0];i=i.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),'"'===n&&(i=(i=i.replace(/\\n/g,"\n")).replace(/\\r/g,"\r")),a[t]=i}return a},populate:function(t,r,a={}){let i=!!(a&&a.debug),n=!!(a&&a.override);if("object"!=typeof r){let t=Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw t.code="OBJECT_REQUIRED",t}for(let a of Object.keys(r))Object.prototype.hasOwnProperty.call(t,a)?(!0===n&&(t[a]=r[a]),i&&(!0===n?u(`"${a}" is already defined and WAS overwritten`):u(`"${a}" is already defined and was NOT overwritten`))):t[a]=r[a]}};t.exports.configDotenv=f.configDotenv,t.exports._configVault=f._configVault,t.exports._parseVault=f._parseVault,t.exports.config=f.config,t.exports.decrypt=f.decrypt,t.exports.parse=f.parse,t.exports.populate=f.populate,t.exports=f},6982(t){"use strict";t.exports=require("crypto")},9896(t){"use strict";t.exports=require("fs")},857(t){"use strict";t.exports=require("os")},6928(t){"use strict";t.exports=require("path")},4519(t){"use strict";t.exports=JSON.parse('{"name":"dotenv","version":"16.6.1","description":"Loads environment variables from .env file","main":"lib/main.js","types":"lib/main.d.ts","exports":{".":{"types":"./lib/main.d.ts","require":"./lib/main.js","default":"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},"scripts":{"dts-check":"tsc --project tests/types/tsconfig.json","lint":"standard","pretest":"npm run lint && npm run dts-check","test":"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov","prerelease":"npm test","release":"standard-version"},"repository":{"type":"git","url":"git://github.com/motdotla/dotenv.git"},"homepage":"https://github.com/motdotla/dotenv#readme","funding":"https://dotenvx.com","keywords":["dotenv","env",".env","environment","variables","config","settings"],"readmeFilename":"README.md","license":"BSD-2-Clause","devDependencies":{"@types/node":"^18.11.3","decache":"^4.6.2","sinon":"^14.0.1","standard":"^17.0.0","standard-version":"^9.5.0","tap":"^19.2.0","typescript":"^4.8.4"},"engines":{"node":">=12"},"browser":{"fs":false}}')}},r={};function a(i){var n=r[i];if(void 0!==n)return n.exports;var o=r[i]={exports:{}};return t[i](o,o.exports,a),o.exports}return a.n=t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return a.d(r,{a:r}),r},a.d=(t,r)=>{for(var i in r)a.o(r,i)&&!a.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:r[i]})},a.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r),(()=>{"use strict";let t,r,i,n,o,s,l,c,u,d,p,m,h,f,y,g,v,_,b,S,$;var w,k,x,R,P,E,j,T,O,C,N,I,q,A=Object.create,z=Object.defineProperty,M=Object.getOwnPropertyDescriptor,L=Object.getOwnPropertyNames,D=Object.getPrototypeOf,Z=Object.prototype.hasOwnProperty,V=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports);let F=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),U=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),H=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),J=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function K(t){let r=Object.values(t).filter(t=>"number"==typeof t);return Object.entries(t).filter(([t,a])=>-1===r.indexOf(+t)).map(([t,r])=>r)}function B(t,r="|"){return t.map(t=>ey(t)).join(r)}function G(t,r){return"bigint"==typeof r?r.toString():r}class W{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return void 0!==t&&(this._value=t(),this._getter=void 0),this._value}}function Y(t){return new W(t)}function X(t){let r=+!!t.startsWith("^"),a=t.endsWith("$")?t.length-1:t.length;return t.slice(r,a)}let Q=Symbol("evaluating");function ee(t,r,a){Object.defineProperty(t,r,{value:a,writable:!0,enumerable:!0,configurable:!0})}function et(t){let r=Object.getOwnPropertyDescriptor(t,"shape");return r?.get?r.get.raw:r?.value}function er(t){return et(t._zod.def)??t._zod.def.shape}function ea(t,r,a){Object.defineProperty(t,r,{get(){let t=a();return ee(this,r,t),t},enumerable:!0,configurable:!0})}function ei(t,r,a){r in t?ee(t,r,a):t[r]=a}function en(t,r,a,i){let n=er(r);for(let o of a){let a=Object.getOwnPropertyDescriptor(n,o);a.enumerable&&(a.get?ea(t,o,()=>{let t=r._zod.def.shape[o];return i?i(t,o):t}):ei(t,o,i?i(a.value,o):a.value))}}function eo(...t){let r={};for(let a of t)Object.assign(r,Object.getOwnPropertyDescriptors(a));return Object.defineProperties({},r)}let es="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function el(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}let ec=Y(()=>{if(eV.jitless||"undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(t){return!1}});function eu(t){if(!1===el(t))return!1;let r=t.constructor;if(void 0===r||"function"!=typeof r)return!0;let a=r.prototype;return!1!==el(a)&&!1!==Object.prototype.hasOwnProperty.call(a,"isPrototypeOf")}function ed(t){return eu(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}let ep=new Set(["string","number","symbol"]);function em(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function eh(t,r,a){let i=new t._zod.constr(r??t._zod.def);return(!r||a?.parent)&&(i._zod.parent=t),i}function ef(t){if(!t)return{};if("string"==typeof t)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return(delete t.message,"string"==typeof t.error)?{...t,error:()=>t.error}:t}function ey(t){return"bigint"==typeof t?t.toString()+"n":"string"==typeof t?`"${t}"`:`${t}`}let eg={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]},ev={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function e_(t,r){let a=er(t),i=[];for(let t of Reflect.ownKeys(r)){if(!Object.getOwnPropertyDescriptor(a,t)?.enumerable)throw Error(`Unrecognized key: "${String(t)}"`);r[t]&&i.push(t)}return i}function eb(t,r){let a={};en(a,t,Reflect.ownKeys(er(t)));for(let t of Reflect.ownKeys(r)){let i=Object.getOwnPropertyDescriptor(r,t);i.enumerable&&(i.get?ea(a,t,()=>r[t]):ei(a,t,i.value))}return a}function eS(t,r,a,i="partial"){let n=r._zod.def.checks;if(n&&n.length>0)throw Error(`.${i}() cannot be used on object schemas containing refinements`);let o=a?new Set(e_(r,a)):void 0,s={};return en(s,r,Reflect.ownKeys(er(r)),t&&((r,a)=>o&&!o.has(a)?r:new t({type:"optional",innerType:r}))),eh(r,eo(r._zod.def,{shape:s,checks:[]}))}function e$(t,r=0){if(!0===t.aborted)return!0;for(let a=r;a<t.issues.length;a++)if(t.issues[a]?.continue!==!0)return!0;return!1}function ew(t,r){return r.map(r=>(r.path??(r.path=[]),r.path.unshift(t),r))}function ek(t){return"string"==typeof t?t:t?.message}function ex(t,r,a){var i;for(let n=r;n<t.length;n++)(i=t[n]).schema??(i.schema=a)}function eR(t,r,a){let i=t.inst?._zod?.traits;i?.has("$ZodType")&&(i.has("$ZodCheck")?t.schema??(t.schema=t.inst):t.schema=t.inst);let n=t.schema!==t.inst?t.schema?._zod.def?.error:void 0,o=t.message?t.message:ek(t.inst?._zod.def?.error?.(t))??ek(n?.(t))??ek(r?.error?.(t))??ek(a.customError?.(t))??ek(a.localeError?.(t))??"Invalid input",s={};for(let r of Object.keys(t))"inst"!==r&&"schema"!==r&&"continue"!==r&&"input"!==r&&"__proto__"!==r&&(s[r]=t[r]);return s.path??(s.path=[]),s.message=o,r?.reportInput&&(s.input=t.input),s}let eP=/[\uD800-\uDBFF]/;function eE(t){let r=t.length;if(!eP.test(t))return r;let a=r;for(let i=0;i<r-1;i++)(64512&t.charCodeAt(i))==55296&&(64512&t.charCodeAt(i+1))==56320&&(a--,i++);return a}function ej(t){return Array.isArray(t)?"array":"string"==typeof t?"string":"unknown"}function eT(...t){let[r,a,i]=t;return"string"==typeof r?{message:r,code:"custom",input:a,inst:i}:{...r}}function eO(t,r,a,i=!0){return Object.defineProperty(t,r,{configurable:!0,writable:!0,enumerable:i,value:a}),a}function eC(t,r){for(let a in t){let i=t[a];Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get(){return eO(this,a,i(this))},set(t){eO(this,a,t)}})}return r}let eN=!1,eI={configurable:!0,get(){eN=!0}};function eq(r,a,i){let n=Object.getPrototypeOf(r._zod);if(a in n&&t!==r._zod){t=void 0;return}t=r._zod,Object.defineProperty(n,a,{configurable:!0,get(){Object.defineProperty(this,a,eI);let t=eN;eN=!1;try{let r=i(this);return eN?delete this[a]:Object.defineProperty(this,a,{configurable:!0,writable:!0,value:r}),eN=eN||t,r}catch(r){throw delete this[a],eN=eN||t,r}},set(t){Object.defineProperty(this,a,{configurable:!0,writable:!0,value:t})}})}let eA=Object.freeze({status:"aborted"}),ez={value:void 0,enumerable:!1},eM="captureStackTrace"in Error?Error:null;function eL(t,r,a,i){function n(t){this.def=t,this.constr=u,this.traits=new Set}n.prototype={};let o=a&&new WeakSet;function s(i,s){if(i._zod){if(i._zod.traits.has(t))return}else{ez.value=new n(s);try{Object.defineProperty(i,"_zod",ez)}finally{ez.value=void 0}}if(i._zod.traits.add(t),r(i,s),o){let t=Object.getPrototypeOf(i),r=i._zod.constr.prototype,n=t;for(;n&&n!==r;)n=Object.getPrototypeOf(n);let s=n??t;if(!o.has(s)){o.add(s);for(let t in a){let r=Object.getOwnPropertyDescriptor(a,t);r.get?Object.defineProperty(s,t,{...r,enumerable:!1}):function(t,r,a){Object.defineProperty(t,r,{configurable:!0,get(){return this==null?a:eO(this,r,a.bind(this))},set(t){eO(this,r,t)}})}(s,t,r.value)}}}let l=u.prototype;for(let t in l)Object.prototype.hasOwnProperty.call(l,t)&&(t in i||(i[t]=l[t].bind(i)))}let l=i?.Parent??Object;class c extends l{}function u(t){let r=i?.Parent?function(t){let r=eM;if(r){let a=r.stackTraceLimit;if("number"==typeof a){try{r.stackTraceLimit=0}catch{return eM=null,new t}try{return new t}finally{r.stackTraceLimit=a}}}return new t}(c):this;s(r,t);let a=r._zod.deferred;if(a){for(let t of a)t();r._zod.deferred=void 0}let n=globalThis.__zod_globalConfig?.postProcessor;return n&&n(r),r}return Object.defineProperty(c,"name",{value:t}),Object.defineProperty(u,"init",{value:s}),Object.defineProperty(u,Symbol.hasInstance,{value:r=>!!i?.Parent&&r instanceof i.Parent||r?._zod?.traits?.has(t)}),Object.defineProperty(u,"name",{value:t}),u}class eD extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class eZ extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(j=globalThis).__zod_globalConfig??(j.__zod_globalConfig={});let eV=globalThis.__zod_globalConfig;function eF(t){return t&&Object.assign(eV,t),eV}class eU extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}let eH="~memo",eJ=[];function eK(t){return null!==t&&"object"==typeof t}function eB(t){return t.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}let eG=new WeakMap,eW=[],eY={alloc(t,a,i){let n=r;if(!n)return i;r=void 0;let o={value:i,issues:null};return n.set(a.value,o),eW.push(o),i},guard(t){var r;(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred.push(()=>{let r=t._zod.parse,a=(t,a)=>{var i,n;let o;if("backward"!==a.direction&&(i=a,n=t.value,void 0!==(o=i[eH]?.backEdges)&&eK(n)&&o.has(n)))throw new eU;return r(t,a)};t._zod.parse=a,t._zod.run===r&&(t._zod.run=a)})},attach(t){var a;let i,n,o,s=!1;(a=t._zod).deferred??(a.deferred=[]),t._zod.deferred.push(()=>{let a=t._zod.parse,l=(c,u)=>{let d;if(void 0===i){let r=function t(r,a,i){var n,o;let s=eG.get(r);if(void 0!==s)return 2*!!s;if(a.has(r))return 2;a.add(r);let l=0,c=r=>{if(2!==l&&r?._zod){let n=t(r,a,i);n>l&&(l=n)}},u=t=>{t>l&&(l=t)},d=r._zod.def;switch(d.type){case"object":{let r=et(d);u(r?((r,n)=>{let o=0;for(let s of Reflect.ownKeys(r)){let l=Object.getOwnPropertyDescriptor(r,s);if(n&&!l.enumerable)continue;let c=l.get?1:l.value?._zod?t(l.value,a,i):0;c>o&&(o=c)}return o})(r,!0):1),c(d.catchall);break}case"array":c(d.element);break;case"tuple":for(let t of d.items)c(t);c(d.rest);break;case"record":case"map":c(d.keyType),c(d.valueType);break;case"set":c(d.valueType);break;case"union":for(let t of d.options)c(t);break;case"intersection":c(d.left),c(d.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":c(d.innerType);break;case"pipe":c(d.in),c(d.out);break;case"function":c(d.input),c(d.output);break;case"lazy":{let n=d._cachedInner??(i?r._zod.innerType:void 0);u(n?t(n,a,!1):1);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let t in d){let r=Object.getOwnPropertyDescriptor(d,t);if(!r||r.get)continue;let a=r.value;if(a&&"object"==typeof a){if(a._zod)c(a);else if(Array.isArray(a))for(let t of a)c(t)}}}return a.delete(r),n=r,1!==(o=l)&&eG.set(n,2===o),o}(t,new Set,!1);if(0===r)return t._zod.parse=a,t._zod.run===l&&(t._zod.run=a),a(c,u);2===r||s?i=!0:s=!0}let p=c.value;if(!eK(p))return a(c,u);let m=u[eH];if(m||(m={buckets:new WeakMap,backEdges:void 0},u[eH]=m),n===u)d=o;else{var h;let r;(r=(h=m).buckets.get(t))||(r=new WeakMap,h.buckets.set(t,r)),d=r,n=u,o=d}let f=d.get(p);if(f)return c.value=f.value,f.issues?f.issues.length&&c.issues.push(...eB(f.issues)):(c.memo=!0,m.backEdges??(m.backEdges=new WeakSet),m.backEdges.add(f.value)),c;r=d;let y=eW.length,g=a(c,u);r=void 0;let v=eW.length>y?eW.pop():void 0;return g instanceof Promise?g.then(t=>(v&&(v.issues=t.issues.length?eB(t.issues):eJ),t)):(v&&(v.issues=g.issues.length?eB(g.issues):eJ),g)};t._zod.parse=l,t._zod.run===a&&(t._zod.run=l)})}},eX=/^[cC][0-9a-z]{6,}$/,eQ=/^[0-9a-z]+$/,e0=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,e1=/^[0-9a-vA-V]{20}$/,e2=/^[A-Za-z0-9]{27}$/,e9=/^[a-zA-Z0-9_-]{21}$/,e4=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,e6=/^([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})$/,e5=t=>t?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,e3=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,e8=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,e7=/^(?:(?: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])$/,te=/^(([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}|:))$/,tt=/^((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])$/,tr=/^(([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])$/,ta=/^https?$/,ti=/^\+[1-9]\d{6,14}$/,tn="(?:(?:\\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])))",to=RegExp(`^${tn}$`);function ts(t){let r="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof t.precision?-1===t.precision?`${r}`:0===t.precision?`${r}:[0-5]\\d`:`${r}:[0-5]\\d\\.\\d{${t.precision}}`:t.seconds?`${r}:[0-5]\\d(?:\\.\\d+)?`:`${r}(?::[0-5]\\d(?:\\.\\d+)?)?`}let tl=/^[\s\S]{0,}$/,tc=/^-?\d+$/,tu=/^-?\d+(?:\.\d+)?$/,td=/^(?:true|false)$/i,tp=/^null$/i,tm=/^[^A-Z]*$/,th=/^[^a-z]*$/,tf=eL("$ZodCheck",(t,r)=>{var a;t._zod??(t._zod={}),t._zod.def=r,(a=t._zod).onattach??(a.onattach=[])}),ty=t=>{let r=t.value;return null!=r&&void 0!==r.length},tg={number:"number",bigint:"bigint",object:"date"},tv=eL("$ZodCheckLessThan",(t,r)=>{tf.init(t,r);let a=tg[typeof r.value];t._zod.check=i=>{(r.inclusive?i.value<=r.value:i.value<r.value)||i.issues.push({origin:tg[typeof i.value]??a,code:"too_big",maximum:"object"==typeof r.value?r.value.getTime():r.value,input:i.value,inclusive:r.inclusive,inst:t,continue:!r.abort})}}),t_=eL("$ZodCheckGreaterThan",(t,r)=>{tf.init(t,r);let a=tg[typeof r.value];t._zod.check=i=>{(r.inclusive?i.value>=r.value:i.value>r.value)||i.issues.push({origin:tg[typeof i.value]??a,code:"too_small",minimum:"object"==typeof r.value?r.value.getTime():r.value,input:i.value,inclusive:r.inclusive,inst:t,continue:!r.abort})}}),tb=eL("$ZodCheckMultipleOf",(t,r)=>{tf.init(t,r),t._zod.check=a=>{let i,n,o;if(typeof a.value!=typeof r.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof a.value?r.value!==BigInt(0)&&a.value%r.value===BigInt(0):0==(n=Math.round(i=a.value/r.value),o=4*Number.EPSILON*Math.max(Math.abs(i),1),Math.abs(i-n)<o?0:i-n))||a.issues.push({origin:typeof a.value,code:"not_multiple_of",divisor:r.value,input:a.value,inst:t,continue:!r.abort})}}),tS=eL("$ZodCheckNumberFormat",(t,r)=>{tf.init(t,r),r.format=r.format||"float64";let a=r.format?.includes("int"),i=a?"int":"number",[n,o]=eg[r.format];t._zod.check=s=>{let l=s.value;if(a){if(!Number.isInteger(l))return void s.issues.push({expected:i,format:r.format,code:"invalid_type",continue:!1,input:l,inst:t});if(!Number.isSafeInteger(l))return void(l>0?s.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:i,inclusive:!0,continue:!r.abort}):s.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:i,inclusive:!0,continue:!r.abort}))}l<n&&s.issues.push({origin:"number",input:l,code:"too_small",minimum:n,inclusive:!0,inst:t,continue:!r.abort}),l>o&&s.issues.push({origin:"number",input:l,code:"too_big",maximum:o,inclusive:!0,inst:t,continue:!r.abort})}}),t$=eL("$ZodCheckMaxLength",(t,r)=>{var a;tf.init(t,r),(a=t._zod.def).when??(a.when=ty),t._zod.check=a=>{let i=a.value,n=i.length;if(("string"==typeof i&&n>r.maximum?eE(i):n)<=r.maximum)return;let o=ej(i);a.issues.push({origin:o,code:"too_big",maximum:r.maximum,inclusive:!0,input:i,inst:t,continue:!r.abort})}}),tw=eL("$ZodCheckMinLength",(t,r)=>{var a;tf.init(t,r),(a=t._zod.def).when??(a.when=ty),t._zod.check=a=>{let i=a.value,n=i.length;if(("string"==typeof i&&n>=r.minimum&&n<2*r.minimum?eE(i):n)>=r.minimum)return;let o=ej(i);a.issues.push({origin:o,code:"too_small",minimum:r.minimum,inclusive:!0,input:i,inst:t,continue:!r.abort})}}),tk=eL("$ZodCheckLengthEquals",(t,r)=>{var a;tf.init(t,r),(a=t._zod.def).when??(a.when=ty),t._zod.check=a=>{let i=a.value,n=i.length,o="string"==typeof i&&n>=r.length&&n<=2*r.length?eE(i):n;if(o===r.length)return;let s=ej(i),l=o>r.length;a.issues.push({origin:s,...l?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length},inclusive:!0,exact:!0,input:a.value,inst:t,continue:!r.abort})}}),tx=eL("$ZodCheckStringFormat",(t,r)=>{var a,i;tf.init(t,r),r.pattern?(a=t._zod).check??(a.check=a=>{r.pattern.lastIndex=0,r.pattern.test(a.value)||a.issues.push({origin:"string",code:"invalid_format",format:r.format,input:a.value,...r.pattern?{pattern:r.pattern.toString()}:{},inst:t,continue:!r.abort})}):(i=t._zod).check??(i.check=()=>{})}),tR=eL("$ZodCheckRegex",(t,r)=>{tx.init(t,r),t._zod.check=a=>{r.pattern.lastIndex=0,r.pattern.test(a.value)||a.issues.push({origin:"string",code:"invalid_format",format:"regex",input:a.value,pattern:r.pattern.toString(),inst:t,continue:!r.abort})}}),tP=eL("$ZodCheckLowerCase",(t,r)=>{r.pattern??(r.pattern=tm),tx.init(t,r)}),tE=eL("$ZodCheckUpperCase",(t,r)=>{r.pattern??(r.pattern=th),tx.init(t,r)}),tj=eL("$ZodCheckIncludes",(t,r)=>{tf.init(t,r);let a=em(r.includes),i=new RegExp("number"==typeof r.position?`^.{${r.position},}${a}`:a);r.pattern=i,t._zod.check=a=>{a.value.includes(r.includes,r.position)||a.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:r.includes,input:a.value,inst:t,continue:!r.abort})}}),tT=eL("$ZodCheckStartsWith",(t,r)=>{tf.init(t,r);let a=RegExp(`^${em(r.prefix)}.*`);r.pattern??(r.pattern=a),t._zod.check=a=>{a.value.startsWith(r.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:r.prefix,input:a.value,inst:t,continue:!r.abort})}}),tO=eL("$ZodCheckEndsWith",(t,r)=>{tf.init(t,r);let a=RegExp(`.*${em(r.suffix)}$`);r.pattern??(r.pattern=a),t._zod.check=a=>{a.value.endsWith(r.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:r.suffix,input:a.value,inst:t,continue:!r.abort})}}),tC=eL("$ZodCheckOverwrite",(t,r)=>{tf.init(t,r),t._zod.check=t=>{t.value=r.tx(t.value)}});class tN{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if("function"==typeof t){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let r=t.split("\n").filter(t=>t),a=Math.min(...r.map(t=>t.length-t.trimStart().length));for(let t of r.map(t=>t.slice(a)).map(t=>" ".repeat(2*this.indent)+t))this.content.push(t)}compile(){let t=Function,r=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
2
2
|
${r.join("\n")}
|
|
3
|
-
};`)(...Object.values(this.closed))}}let tq={major:4,minor:6,patch:5},tz=eD("$ZodType",(t,r)=>{var a;t??(t={}),t._zod.def=r,t._zod.bag=t._zod.bag||{},t._zod.version=tq;let i=t._zod.def.checks,n=t._zod.traits.has("$ZodCheck")?[t,...i??[]]:i?.length?[...i]:[];for(let r of n)for(let a of r._zod.onattach)a(t);if(0===n.length)(a=t._zod).deferred??(a.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let r=(r,a,i)=>{let n;if(r.memo)return r;let o=ew(r);for(let s of a){if(s._zod.def.when){if(function(t,r=0){if(!0===t.aborted)return!0;for(let a=r;a<t.issues.length;a++)if(t.issues[a]?.continue===!1)return!0;return!1}(r)||!s._zod.def.when(r))continue}else if(o)continue;let a=r.issues.length,l=s._zod.check(r);if(l instanceof Promise&&i?.async===!1)throw new eZ;if(n||l instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await l,r.issues.length!==a&&(eR(r.issues,a,t),o||(o=ew(r,a)))});else{if(r.issues.length===a)continue;eR(r.issues,a,t),o||(o=ew(r,a))}}return n?n.then(()=>r):r},a=(a,i,o)=>{if(ew(a))return a.aborted=!0,a;let s=r(i,n,o);if(s instanceof Promise){if(!1===o.async)throw new eZ;return s.then(r=>t._zod.parse(r,o))}return t._zod.parse(s,o)};t._zod.run=(i,o)=>{if(o.skipChecks)return t._zod.parse(i,o);if("backward"===o.direction){let r=t._zod.parse({value:i.value,issues:[]},{...o,skipChecks:!0});return r instanceof Promise?r.then(t=>a(t,i,o)):a(r,i,o)}let s=t._zod.parse(i,o);if(s instanceof Promise){if(!1===o.async)throw new eZ;return s.then(t=>r(t,n,o))}return r(s,n,o)}}},{get"~standard"(){return eN(this,"~standard",tL(this),!1)},set"~standard"(value){eN(this,"~standard",value)}}),tA=(t,r)=>t.issues.length?{issues:t.issues.map(t=>eP(t,r,eU()))}:{value:t.value};async function tM(t,r){let a={async:!0};return tA(await t._zod.run({value:r,issues:[]},a),a)}function tL(t){return{validate:r=>{let a={async:!1};try{let i=t._zod.run({value:r,issues:[]},a);if(!(i instanceof Promise))return tA(i,a)}catch(t){}return tM(t,r)},vendor:"zod",version:1}}let tD=eD("$ZodString",(t,r)=>{tz.init(t,r),t._zod.pattern=r.pattern??tc,t._zod.parse=(a,i)=>{if(r.coerce)try{a.value=String(a.value)}catch(t){}return"string"==typeof a.value||a.issues.push({expected:"string",code:"invalid_type",input:a.value,inst:t}),a}}),tZ=eD("$ZodStringFormat",(t,r)=>{tR.init(t,r),tD.init(t,r)}),tV=eD("$ZodGUID",(t,r)=>{r.pattern??(r.pattern=e3),tZ.init(t,r)}),tF=eD("$ZodUUID",(t,r)=>{if(r.version){let t={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[r.version];if(void 0===t)throw Error(`Invalid UUID version: "${r.version}"`);r.pattern??(r.pattern=e5(t))}else r.pattern??(r.pattern=e5());tZ.init(t,r)}),tU=eD("$ZodEmail",(t,r)=>{r.pattern??(r.pattern=e8),tZ.init(t,r)});function tJ(t){try{if("undefined"!=typeof URL&&"function"==typeof URL.canParse)return URL.canParse(t);return new URL(t),!0}catch{return!1}}let tH=/[\t\n\r]/g;function tK(t){return t.replace(tH,"")}let tB=eD("$ZodURL",(t,r)=>{tZ.init(t,r),t._zod.check=a=>{try{var i,n;let o=a.value.trim(),s="normalize"in r||"hostname"in r||"protocol"in r?function(t,r){if(!r.normalize&&r.protocol?.source===ti.source&&!/^https?:\/\//i.test(t))return 1;try{if("undefined"!=typeof URL){let r=URL;if("function"==typeof r.parse)return r.parse(t)??2}return new URL(t)}catch{return 2}}(o,r):tJ(o)||2;if(1===s)return void a.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:a.value,inst:t,continue:!r.abort});if(2===s)return void a.issues.push({code:"invalid_format",format:"url",input:a.value,inst:t,continue:!r.abort});if(!0===s){a.value=tK(o);return}r.hostname&&((i=r.hostname).lastIndex=0,!i.test(s.hostname))&&a.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:r.hostname.source,input:a.value,inst:t,continue:!r.abort}),r.protocol&&((n=r.protocol).lastIndex=0,!n.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol))&&a.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:r.protocol.source,input:a.value,inst:t,continue:!r.abort}),a.value=r.normalize?s.href:tK(o);return}catch(i){a.issues.push({code:"invalid_format",format:"url",input:a.value,inst:t,continue:!r.abort})}}}),tW=eD("$ZodEmoji",(t,r)=>{r.pattern??(r.pattern=RegExp(e7,"u")),tZ.init(t,r)}),tG=eD("$ZodNanoID",(t,r)=>{var a;if(void 0!==r.length&&(!Number.isInteger(r.length)||r.length<1))throw Error(`Invalid nanoid length: ${r.length}`);r.pattern??(r.pattern=void 0===r.length?e4:(a=r.length,RegExp(`^[a-zA-Z0-9_-]{${a}}$`))),tZ.init(t,r)}),tY=eD("$ZodCUID",(t,r)=>{r.pattern??(r.pattern=eQ),tZ.init(t,r)}),tX=eD("$ZodCUID2",(t,r)=>{r.pattern??(r.pattern=e0),tZ.init(t,r)}),tQ=eD("$ZodULID",(t,r)=>{r.pattern??(r.pattern=e1),tZ.init(t,r)}),t0=eD("$ZodXID",(t,r)=>{r.pattern??(r.pattern=e2),tZ.init(t,r)}),t1=eD("$ZodKSUID",(t,r)=>{r.pattern??(r.pattern=e9),tZ.init(t,r)}),t2=eD("$ZodISODateTime",(t,r)=>{let a,i,n;r.pattern??(a=["Z"],r.offset&&a.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)"),i=`${tl({precision:r.precision,seconds:!0})}(?:${a.join("|")})`,n=r.local?`${i}|${tl({precision:r.precision})}`:i,r.pattern=RegExp(`^${to}T(?:${n})$`)),tZ.init(t,r)}),t9=eD("$ZodISODate",(t,r)=>{r.pattern??(r.pattern=ts),tZ.init(t,r)}),t4=eD("$ZodISOTime",(t,r)=>{r.pattern??(r.pattern=RegExp(`^${tl(r)}$`)),tZ.init(t,r)}),t6=eD("$ZodISODuration",(t,r)=>{r.pattern??(r.pattern=e6),tZ.init(t,r)}),t3=eD("$ZodIPv4",(t,r)=>{r.pattern??(r.pattern=te),tZ.init(t,r)}),t5=/^[0-9a-fA-F:.]+$/;function t8(t){return!!t5.test(t)&&tJ(`http://[${t}]`)}let t7=eD("$ZodIPv6",(t,r)=>{r.pattern??(r.pattern=tt),tZ.init(t,r),t._zod.check=a=>{t8(a.value)||a.issues.push({code:"invalid_format",format:"ipv6",input:a.value,inst:t,continue:!r.abort})}}),re=eD("$ZodCIDRv4",(t,r)=>{r.pattern??(r.pattern=tr),tZ.init(t,r)}),rt=eD("$ZodCIDRv6",(t,r)=>{r.pattern??(r.pattern=ta),tZ.init(t,r),t._zod.check=a=>{!function(t){let r=t.split("/");if(2!==r.length)return!1;let[a,i]=r;if(!i)return!1;let n=Number(i);return`${n}`===i&&!(n<0)&&!(n>128)&&t8(a)}(a.value)&&a.issues.push({code:"invalid_format",format:"cidrv6",input:a.value,inst:t,continue:!r.abort})}});function rr(t){if(""===t)return!0;if(/\s/.test(t)||t.length%4!=0)return!1;try{return atob(t),!0}catch{return!1}}let ra=/^[0-9a-zA-Z+/]*={0,2}$/,ri=eD("$ZodBase64",(t,r)=>{r.pattern??(r.pattern=ra),tZ.init(t,r),t._zod.check=a=>{rr(a.value)||a.issues.push({code:"invalid_format",format:"base64",input:a.value,inst:t,continue:!r.abort})}}),rn=/^[A-Za-z0-9_-]*$/,ro=eD("$ZodBase64URL",(t,r)=>{r.pattern??(r.pattern=rn),tZ.init(t,r),t._zod.check=a=>{!function(t){if(!rn.test(t))return!1;let r=t.replace(/[-_]/g,t=>"-"===t?"+":"/");return rr(r.padEnd(4*Math.ceil(r.length/4),"="))}(a.value)&&a.issues.push({code:"invalid_format",format:"base64url",input:a.value,inst:t,continue:!r.abort})}}),rs=eD("$ZodE164",(t,r)=>{r.pattern??(r.pattern=tn),tZ.init(t,r)}),rl=eD("$ZodJWT",(t,r)=>{tZ.init(t,r),t._zod.check=a=>{!function(t,r=null){try{let a=t.split(".");if(3!==a.length)return!1;let[i]=a;if(!i)return!1;let n=JSON.parse(atob(i));if("typ"in n&&n?.typ!=="JWT"||!n.alg||r&&(!("alg"in n)||n.alg!==r))return!1;return!0}catch{return!1}}(a.value,r.alg)&&a.issues.push({code:"invalid_format",format:"jwt",input:a.value,inst:t,continue:!r.abort})}}),rc=eD("$ZodNumber",(t,r)=>{tz.init(t,r),t._zod.pattern=td,t._zod.parse=(a,i)=>{if(r.coerce)try{a.value=Number(a.value)}catch(t){}let n=a.value;if("number"==typeof n&&!Number.isNaN(n)&&Number.isFinite(n))return a;let o="number"==typeof n?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:String(n):void 0;return a.issues.push({expected:"number",code:"invalid_type",input:n,inst:t,...o?{received:o}:{}}),a}}),ru=eD("$ZodNumberFormat",(t,r)=>{t$.init(t,r),rc.init(t,r)}),rd=eD("$ZodBoolean",(t,r)=>{tz.init(t,r),t._zod.pattern=tp,t._zod.parse=(a,i)=>{if(r.coerce)try{a.value=!!a.value}catch(t){}let n=a.value;return"boolean"==typeof n||a.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:t}),a}}),rp=eD("$ZodNull",(t,r)=>{tz.init(t,r),t._zod.pattern=tm,t._zod.values=new Set([null]),t._zod.parse=(r,a)=>{let i=r.value;return null===i||r.issues.push({expected:"null",code:"invalid_type",input:i,inst:t}),r}}),rm=eD("$ZodAny",(t,r)=>{tz.init(t,r),t._zod.parse=t=>t}),rh=eD("$ZodUnknown",(t,r)=>{tz.init(t,r),t._zod.parse=t=>t}),rf=eD("$ZodNever",(t,r)=>{tz.init(t,r),t._zod.parse=(r,a)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function ry(t,r,a){t.issues.length&&r.issues.push(...ek(a,t.issues)),r.value[a]=t.value}let rg=eD("$ZodArray",(t,r)=>{tz.init(t,r);let a=eF.memoizer;a?.attach(t),t._zod.parse=(i,n)=>{let o=i.value;if(!Array.isArray(o))return i.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),i;i.value=a?a.alloc(t,i,Array(o.length),n):Array(o.length);let s=[],l=n?.abortEarly;for(let t=0;t<o.length;t++){let a=o[t],c=r.element._zod.run({value:a,issues:[]},n);if(c instanceof Promise)s.push(c.then(r=>ry(r,i,t)));else if(ry(c,i,t),l&&0!==c.issues.length&&ew(c))break}return s.length?Promise.all(s).then(()=>i):i}});function rv(t,r,a,i,n,o){let s=a in i,l="optional"===o;if(s||!l||"optional"!==n){if(t.issues.length){if(void 0!==n&&l&&!s)return;r.issues.push(...ek(a,t.issues))}if(!s&&void 0===n){t.issues.length||r.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[a]});return}void 0===t.value?(s||"defaulted"===n&&!l)&&(r.value[a]=void 0):r.value[a]=t.value}}let r_=[];function rb(t){var r;let a=Object.keys(t.shape),i=Object.getOwnPropertySymbols(t.shape),n=i.length?i:r_,o=n.length?[...a,...n]:a;for(let r of o)if(!t.shape?.[r]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(r)}": expected a Zod schema`);let s=Object.keys(r=t.shape).filter(t=>void 0!==r[t]._zod.optin&&"optional"===r[t]._zod.optout);return{...t,allKeys:o,symbolKeys:n,keySet:new Set(a),numKeys:a.length,optionalKeys:new Set(s)}}function rS(t,r,a,i,n,o,s){let l=[],c=n.keySet,u=n.catchall._zod,d=u.def.type,p=u.optin,m=u.optout,h=0;for(let n in r){if(s&&a.issues.length!==h){if(ew(a,h))break;h=a.issues.length}if(c.has(n))continue;if("__proto__"===n){"never"===d&&l.push(n);continue}if("never"===d){l.push(n);continue}let o=u.run({value:r[n],issues:[]},i);o instanceof Promise?t.push(o.then(t=>rv(t,a,n,r,p,m))):rv(o,a,n,r,p,m)}return(l.length&&a.issues.push({code:"unrecognized_keys",keys:l,input:r,inst:o,continue:!0}),t.length)?Promise.all(t).then(()=>a):a}let r$=eD("$ZodObject",(t,r)=>{let a;tz.init(t,r);let i=Object.getOwnPropertyDescriptor(r,"shape"),n=i?.get?i.get.raw:r.shape??{};if(n){let t=()=>{let a={...n};return Object.defineProperty(r,"shape",{value:a}),t.raw=a,a};t.raw=n,Object.defineProperty(r,"shape",{get:t})}let o=X(()=>rb(r));ez(t,"propValues",t=>{let r=t.def.shape,a={};for(let t in r){let i=r[t]._zod;if(i.values){for(let r of(Object.prototype.hasOwnProperty.call(a,t)||et(a,t,new Set),i.values))a[t].add(r);void 0!==i.optin&&a[t].add(void 0)}}return a});let s=r.catchall,l=eF.memoizer;l?.attach(t),t._zod.parse=(r,i)=>{a??(a=o.value);let n=r.value;if(!ec(n))return r.issues.push({expected:"object",code:"invalid_type",input:n,inst:t}),r;r.value=l?l.alloc(t,r,{},i):{};let c=[],u=a.shape,d=i?.abortEarly,p=r.issues.length;for(let t of a.allKeys){if(d&&r.issues.length!==p){if(ew(r,p))break;p=r.issues.length}if("__proto__"===t)continue;let a=u[t],o=a._zod.optin,s=a._zod.optout,l=a._zod.run({value:n[t],issues:[]},i);l instanceof Promise?c.push(l.then(a=>rv(a,r,t,n,o,s))):rv(l,r,t,n,o,s)}return s?rS(c,n,r,i,o.value,t,!0===d):c.length?Promise.all(c).then(()=>r):r}}),rw=eD("$ZodObjectJIT",(t,r)=>{let a,i;r$.init(t,r);let n=t._zod.parse,o=X(()=>rb(r)),s=eF.memoizer,l=!eF.jitless,c=l&&eu.value,u=r.catchall;t._zod.parse=(d,p)=>{i??(i=o.value);let m=d.value;return ec(m)?l&&c&&p?.async===!1&&!0!==p.jitless?(a||(a=(r=>{let a=o.value,i=a.symbolKeys,n=new tI(["payload","ctx"],{shape:r,inst:t,memo:s,syms:i}),l=t=>`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`,c=(t,r)=>`
|
|
3
|
+
};`)(...Object.values(this.closed))}}let tI={major:4,minor:6,patch:5},tq=eL("$ZodType",(t,r)=>{var a;t??(t={}),t._zod.def=r,t._zod.bag=t._zod.bag||{},t._zod.version=tI;let i=t._zod.def.checks,n=t._zod.traits.has("$ZodCheck")?[t,...i??[]]:i?.length?[...i]:[];for(let r of n)for(let a of r._zod.onattach)a(t);if(0===n.length)(a=t._zod).deferred??(a.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let r=(r,a,i)=>{let n;if(r.memo)return r;let o=e$(r);for(let s of a){if(s._zod.def.when){if(function(t,r=0){if(!0===t.aborted)return!0;for(let a=r;a<t.issues.length;a++)if(t.issues[a]?.continue===!1)return!0;return!1}(r)||!s._zod.def.when(r))continue}else if(o)continue;let a=r.issues.length,l=s._zod.check(r);if(l instanceof Promise&&i?.async===!1)throw new eD;if(n||l instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await l,r.issues.length!==a&&(ex(r.issues,a,t),o||(o=e$(r,a)))});else{if(r.issues.length===a)continue;ex(r.issues,a,t),o||(o=e$(r,a))}}return n?n.then(()=>r):r},a=(a,i,o)=>{if(e$(a))return a.aborted=!0,a;let s=r(i,n,o);if(s instanceof Promise){if(!1===o.async)throw new eD;return s.then(r=>t._zod.parse(r,o))}return t._zod.parse(s,o)};t._zod.run=(i,o)=>{if(o.skipChecks)return t._zod.parse(i,o);if("backward"===o.direction){let r=t._zod.parse({value:i.value,issues:[]},{...o,skipChecks:!0});return r instanceof Promise?r.then(t=>a(t,i,o)):a(r,i,o)}let s=t._zod.parse(i,o);if(s instanceof Promise){if(!1===o.async)throw new eD;return s.then(t=>r(t,n,o))}return r(s,n,o)}}},{get"~standard"(){return eO(this,"~standard",tM(this),!1)},set"~standard"(value){eO(this,"~standard",value)}}),tA=(t,r)=>t.issues.length?{issues:t.issues.map(t=>eR(t,r,eF()))}:{value:t.value};async function tz(t,r){let a={async:!0};return tA(await t._zod.run({value:r,issues:[]},a),a)}function tM(t){return{validate:r=>{let a={async:!1};try{let i=t._zod.run({value:r,issues:[]},a);if(!(i instanceof Promise))return tA(i,a)}catch(t){}return tz(t,r)},vendor:"zod",version:1}}let tL=eL("$ZodString",(t,r)=>{tq.init(t,r),t._zod.pattern=r.pattern??tl,t._zod.parse=(a,i)=>{if(r.coerce)try{a.value=String(a.value)}catch(t){}return"string"==typeof a.value||a.issues.push({expected:"string",code:"invalid_type",input:a.value,inst:t}),a}}),tD=eL("$ZodStringFormat",(t,r)=>{tx.init(t,r),tL.init(t,r)}),tZ=eL("$ZodGUID",(t,r)=>{r.pattern??(r.pattern=e6),tD.init(t,r)}),tV=eL("$ZodUUID",(t,r)=>{if(r.version){let t={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[r.version];if(void 0===t)throw Error(`Invalid UUID version: "${r.version}"`);r.pattern??(r.pattern=e5(t))}else r.pattern??(r.pattern=e5());tD.init(t,r)}),tF=eL("$ZodEmail",(t,r)=>{r.pattern??(r.pattern=e3),tD.init(t,r)});function tU(t){try{if("undefined"!=typeof URL&&"function"==typeof URL.canParse)return URL.canParse(t);return new URL(t),!0}catch{return!1}}let tH=/[\t\n\r]/g;function tJ(t){return t.replace(tH,"")}let tK=eL("$ZodURL",(t,r)=>{tD.init(t,r),t._zod.check=a=>{try{var i,n;let o=a.value.trim(),s="normalize"in r||"hostname"in r||"protocol"in r?function(t,r){if(!r.normalize&&r.protocol?.source===ta.source&&!/^https?:\/\//i.test(t))return 1;try{if("undefined"!=typeof URL){let r=URL;if("function"==typeof r.parse)return r.parse(t)??2}return new URL(t)}catch{return 2}}(o,r):tU(o)||2;if(1===s)return void a.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:a.value,inst:t,continue:!r.abort});if(2===s)return void a.issues.push({code:"invalid_format",format:"url",input:a.value,inst:t,continue:!r.abort});if(!0===s){a.value=tJ(o);return}r.hostname&&((i=r.hostname).lastIndex=0,!i.test(s.hostname))&&a.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:r.hostname.source,input:a.value,inst:t,continue:!r.abort}),r.protocol&&((n=r.protocol).lastIndex=0,!n.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol))&&a.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:r.protocol.source,input:a.value,inst:t,continue:!r.abort}),a.value=r.normalize?s.href:tJ(o);return}catch(i){a.issues.push({code:"invalid_format",format:"url",input:a.value,inst:t,continue:!r.abort})}}}),tB=eL("$ZodEmoji",(t,r)=>{r.pattern??(r.pattern=RegExp(e8,"u")),tD.init(t,r)}),tG=eL("$ZodNanoID",(t,r)=>{var a;if(void 0!==r.length&&(!Number.isInteger(r.length)||r.length<1))throw Error(`Invalid nanoid length: ${r.length}`);r.pattern??(r.pattern=void 0===r.length?e9:(a=r.length,RegExp(`^[a-zA-Z0-9_-]{${a}}$`))),tD.init(t,r)}),tW=eL("$ZodCUID",(t,r)=>{r.pattern??(r.pattern=eX),tD.init(t,r)}),tY=eL("$ZodCUID2",(t,r)=>{r.pattern??(r.pattern=eQ),tD.init(t,r)}),tX=eL("$ZodULID",(t,r)=>{r.pattern??(r.pattern=e0),tD.init(t,r)}),tQ=eL("$ZodXID",(t,r)=>{r.pattern??(r.pattern=e1),tD.init(t,r)}),t0=eL("$ZodKSUID",(t,r)=>{r.pattern??(r.pattern=e2),tD.init(t,r)}),t1=eL("$ZodISODateTime",(t,r)=>{let a,i,n;r.pattern??(a=["Z"],r.offset&&a.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)"),i=`${ts({precision:r.precision,seconds:!0})}(?:${a.join("|")})`,n=r.local?`${i}|${ts({precision:r.precision})}`:i,r.pattern=RegExp(`^${tn}T(?:${n})$`)),tD.init(t,r)}),t2=eL("$ZodISODate",(t,r)=>{r.pattern??(r.pattern=to),tD.init(t,r)}),t9=eL("$ZodISOTime",(t,r)=>{r.pattern??(r.pattern=RegExp(`^${ts(r)}$`)),tD.init(t,r)}),t4=eL("$ZodISODuration",(t,r)=>{r.pattern??(r.pattern=e4),tD.init(t,r)}),t6=eL("$ZodIPv4",(t,r)=>{r.pattern??(r.pattern=e7),tD.init(t,r)}),t5=/^[0-9a-fA-F:.]+$/;function t3(t){return!!t5.test(t)&&tU(`http://[${t}]`)}let t8=eL("$ZodIPv6",(t,r)=>{r.pattern??(r.pattern=te),tD.init(t,r),t._zod.check=a=>{t3(a.value)||a.issues.push({code:"invalid_format",format:"ipv6",input:a.value,inst:t,continue:!r.abort})}}),t7=eL("$ZodCIDRv4",(t,r)=>{r.pattern??(r.pattern=tt),tD.init(t,r)}),re=eL("$ZodCIDRv6",(t,r)=>{r.pattern??(r.pattern=tr),tD.init(t,r),t._zod.check=a=>{!function(t){let r=t.split("/");if(2!==r.length)return!1;let[a,i]=r;if(!i)return!1;let n=Number(i);return`${n}`===i&&!(n<0)&&!(n>128)&&t3(a)}(a.value)&&a.issues.push({code:"invalid_format",format:"cidrv6",input:a.value,inst:t,continue:!r.abort})}});function rt(t){if(""===t)return!0;if(/\s/.test(t)||t.length%4!=0)return!1;try{return atob(t),!0}catch{return!1}}let rr=/^[0-9a-zA-Z+/]*={0,2}$/,ra=eL("$ZodBase64",(t,r)=>{r.pattern??(r.pattern=rr),tD.init(t,r),t._zod.check=a=>{rt(a.value)||a.issues.push({code:"invalid_format",format:"base64",input:a.value,inst:t,continue:!r.abort})}}),ri=/^[A-Za-z0-9_-]*$/,rn=eL("$ZodBase64URL",(t,r)=>{r.pattern??(r.pattern=ri),tD.init(t,r),t._zod.check=a=>{!function(t){if(!ri.test(t))return!1;let r=t.replace(/[-_]/g,t=>"-"===t?"+":"/");return rt(r.padEnd(4*Math.ceil(r.length/4),"="))}(a.value)&&a.issues.push({code:"invalid_format",format:"base64url",input:a.value,inst:t,continue:!r.abort})}}),ro=eL("$ZodE164",(t,r)=>{r.pattern??(r.pattern=ti),tD.init(t,r)}),rs=eL("$ZodJWT",(t,r)=>{tD.init(t,r),t._zod.check=a=>{!function(t,r=null){try{let a=t.split(".");if(3!==a.length)return!1;let[i]=a;if(!i)return!1;let n=JSON.parse(atob(i));if("typ"in n&&n?.typ!=="JWT"||!n.alg||r&&(!("alg"in n)||n.alg!==r))return!1;return!0}catch{return!1}}(a.value,r.alg)&&a.issues.push({code:"invalid_format",format:"jwt",input:a.value,inst:t,continue:!r.abort})}}),rl=eL("$ZodNumber",(t,r)=>{tq.init(t,r),t._zod.pattern=tu,t._zod.parse=(a,i)=>{if(r.coerce)try{a.value=Number(a.value)}catch(t){}let n=a.value;if("number"==typeof n&&!Number.isNaN(n)&&Number.isFinite(n))return a;let o="number"==typeof n?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:String(n):void 0;return a.issues.push({expected:"number",code:"invalid_type",input:n,inst:t,...o?{received:o}:{}}),a}}),rc=eL("$ZodNumberFormat",(t,r)=>{tS.init(t,r),rl.init(t,r)}),ru=eL("$ZodBoolean",(t,r)=>{tq.init(t,r),t._zod.pattern=td,t._zod.parse=(a,i)=>{if(r.coerce)try{a.value=!!a.value}catch(t){}let n=a.value;return"boolean"==typeof n||a.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:t}),a}}),rd=eL("$ZodNull",(t,r)=>{tq.init(t,r),t._zod.pattern=tp,t._zod.values=new Set([null]),t._zod.parse=(r,a)=>{let i=r.value;return null===i||r.issues.push({expected:"null",code:"invalid_type",input:i,inst:t}),r}}),rp=eL("$ZodAny",(t,r)=>{tq.init(t,r),t._zod.parse=t=>t}),rm=eL("$ZodUnknown",(t,r)=>{tq.init(t,r),t._zod.parse=t=>t}),rh=eL("$ZodNever",(t,r)=>{tq.init(t,r),t._zod.parse=(r,a)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function rf(t,r,a){t.issues.length&&r.issues.push(...ew(a,t.issues)),r.value[a]=t.value}let ry=eL("$ZodArray",(t,r)=>{tq.init(t,r);let a=eV.memoizer;a?.attach(t),t._zod.parse=(i,n)=>{let o=i.value;if(!Array.isArray(o))return i.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),i;i.value=a?a.alloc(t,i,Array(o.length),n):Array(o.length);let s=[],l=n?.abortEarly;for(let t=0;t<o.length;t++){let a=o[t],c=r.element._zod.run({value:a,issues:[]},n);if(c instanceof Promise)s.push(c.then(r=>rf(r,i,t)));else if(rf(c,i,t),l&&0!==c.issues.length&&e$(c))break}return s.length?Promise.all(s).then(()=>i):i}});function rg(t,r,a,i,n,o){let s=a in i,l="optional"===o;if(s||!l||"optional"!==n){if(t.issues.length){if(void 0!==n&&l&&!s)return;r.issues.push(...ew(a,t.issues))}if(!s&&void 0===n){t.issues.length||r.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[a]});return}void 0===t.value?(s||"defaulted"===n&&!l)&&(r.value[a]=void 0):r.value[a]=t.value}}let rv=[];function r_(t){var r;let a=Object.keys(t.shape),i=Object.getOwnPropertySymbols(t.shape),n=i.length?i:rv,o=n.length?[...a,...n]:a;for(let r of o)if(!t.shape?.[r]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(r)}": expected a Zod schema`);let s=Object.keys(r=t.shape).filter(t=>void 0!==r[t]._zod.optin&&"optional"===r[t]._zod.optout);return{...t,allKeys:o,symbolKeys:n,keySet:new Set(a),numKeys:a.length,optionalKeys:new Set(s)}}function rb(t,r,a,i,n,o,s){let l=[],c=n.keySet,u=n.catchall._zod,d=u.def.type,p=u.optin,m=u.optout,h=0;for(let n in r){if(s&&a.issues.length!==h){if(e$(a,h))break;h=a.issues.length}if(c.has(n))continue;if("__proto__"===n){"never"===d&&l.push(n);continue}if("never"===d){l.push(n);continue}let o=u.run({value:r[n],issues:[]},i);o instanceof Promise?t.push(o.then(t=>rg(t,a,n,r,p,m))):rg(o,a,n,r,p,m)}return(l.length&&a.issues.push({code:"unrecognized_keys",keys:l,input:r,inst:o,continue:!0}),t.length)?Promise.all(t).then(()=>a):a}let rS=eL("$ZodObject",(t,r)=>{let a;tq.init(t,r);let i=Object.getOwnPropertyDescriptor(r,"shape"),n=i?.get?i.get.raw:r.shape??{};if(n){let t=()=>{let a={...n};return Object.defineProperty(r,"shape",{value:a}),t.raw=a,a};t.raw=n,Object.defineProperty(r,"shape",{get:t})}let o=Y(()=>r_(r));eq(t,"propValues",t=>{let r=t.def.shape,a={};for(let t in r){let i=r[t]._zod;if(i.values){for(let r of(Object.prototype.hasOwnProperty.call(a,t)||ee(a,t,new Set),i.values))a[t].add(r);void 0!==i.optin&&a[t].add(void 0)}}return a});let s=r.catchall,l=eV.memoizer;l?.attach(t),t._zod.parse=(r,i)=>{a??(a=o.value);let n=r.value;if(!el(n))return r.issues.push({expected:"object",code:"invalid_type",input:n,inst:t}),r;r.value=l?l.alloc(t,r,{},i):{};let c=[],u=a.shape,d=i?.abortEarly,p=r.issues.length;for(let t of a.allKeys){if(d&&r.issues.length!==p){if(e$(r,p))break;p=r.issues.length}if("__proto__"===t)continue;let a=u[t],o=a._zod.optin,s=a._zod.optout,l=a._zod.run({value:n[t],issues:[]},i);l instanceof Promise?c.push(l.then(a=>rg(a,r,t,n,o,s))):rg(l,r,t,n,o,s)}return s?rb(c,n,r,i,o.value,t,!0===d):c.length?Promise.all(c).then(()=>r):r}}),r$=eL("$ZodObjectJIT",(t,r)=>{let a,i;rS.init(t,r);let n=t._zod.parse,o=Y(()=>r_(r)),s=eV.memoizer,l=!eV.jitless,c=l&&ec.value,u=r.catchall;t._zod.parse=(d,p)=>{i??(i=o.value);let m=d.value;return el(m)?l&&c&&p?.async===!1&&!0!==p.jitless?(a||(a=(r=>{let a=o.value,i=a.symbolKeys,n=new tN(["payload","ctx"],{shape:r,inst:t,memo:s,syms:i}),l=t=>`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`,c=(t,r)=>`
|
|
4
4
|
let ${t}_ab = false;
|
|
5
5
|
for (let i = 0; i < ${t}.issues.length; i++) {
|
|
6
6
|
const iss = ${t}.issues[i];
|
|
@@ -50,27 +50,25 @@ ${r.join("\n")}
|
|
|
50
50
|
newResult[${o}] = ${a}.value;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
`)}return n.write("payload.value = newResult;"),n.write("return payload;"),n.compile()})(r.shape)),d=a(d,p),u)?rS([],m,d,p,i,t,p?.abortEarly===!0):d:n(d,p):(d.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),d)}});function rk(t,r,a,i){for(let a of t)if(0===a.issues.length)return r.value=a.value,r;let n=t.filter(t=>!ew(t));return 1===n.length?(r.value=n[0].value,n[0]):(r.issues.push({code:"invalid_union",input:r.value,inst:a,errors:t.map(t=>t.issues.map(t=>eP(t,i,eU())))}),r)}let rx=eD("$ZodUnion",(t,r)=>{tz.init(t,r),ez(t,"optin",t=>t.def.options.some(t=>"defaulted"===t._zod.optin)?"defaulted":t.def.options.some(t=>void 0!==t._zod.optin)?"optional":void 0),ez(t,"optout",t=>t.def.options.some(t=>"optional"===t._zod.optout)?"optional":void 0),ez(t,"values",t=>{if(t.def.options.every(t=>t._zod.values))return new Set(t.def.options.flatMap(t=>Array.from(t._zod.values)))}),ez(t,"pattern",t=>{if(t.def.options.every(t=>t._zod.pattern)){let r=t.def.options.map(t=>t._zod.pattern);return RegExp(`^(${r.map(t=>Q(t.source)).join("|")})$`)}});let a=1===r.options.length?r.options[0]._zod.run:null;t._zod.parse=(i,n)=>{if(a)return a(i,n);let o=!1,s=[];for(let t of r.options){let r=t._zod.run({value:i.value,issues:[]},n);if(r instanceof Promise)s.push(r),o=!0;else{if(0===r.issues.length)return r;s.push(r)}}return o?Promise.all(s).then(r=>rk(r,i,t,n)):rk(s,i,t,n)}}),rR=eD("$ZodDiscriminatedUnion",(t,r)=>{r.inclusive=!1,rx.init(t,r);let a=t._zod.parse;ez(t,"propValues",t=>{let r={},a=0;for(let i of t.def.options){let n=i._zod.propValues;if(!n||0===Object.keys(n).length)throw Error(`Invalid discriminated union option at index "${t.def.options.indexOf(i)}"`);for(let[i,o]of(n[t.def.discriminator]?.has(void 0)&&a++,Object.entries(n)))for(let t of(Object.prototype.hasOwnProperty.call(r,i)||et(r,i,new Set),o))r[i].add(t)}return!t.def.unionFallback&&a>1&&r[t.def.discriminator]?.delete(void 0),r}),r.options.forEach((t,a)=>{let i=er(t._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,r.discriminator))throw Error(`Invalid discriminated union option at index "${a}"`)});let i=X(()=>(function(t){let r=new Map;for(let a of t.options){let i=a._zod.propValues?.[t.discriminator];if(!i||0===i.size)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let t of i)if(r.has(t)){if(void 0!==t)throw Error(`Duplicate discriminator value "${String(t)}"`);r.set(t,null)}else r.set(t,a)}return r})(r));t._zod.parse=(n,o)=>{let s=n.value;if(!ec(s))return n.issues.push({code:"invalid_type",expected:"object",input:s,inst:t}),n;let l=s?.[r.discriminator],c=i.value.get(l);return c&&(void 0!==l||"backward"!==o.direction)?c._zod.run(n,o):r.unionFallback||"backward"===o.direction?a(n,o):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:r.discriminator,options:Array.from(i.value.keys()).filter(t=>null!==i.value.get(t)),input:s,path:[r.discriminator],inst:t}),n)}}),rP=eD("$ZodIntersection",(t,r)=>{tz.init(t,r),t._zod.parse=(t,a)=>{let i=t.value,n=r.left._zod.run({value:i,issues:[]},a),o=r.right._zod.run({value:i,issues:[]},a);return n instanceof Promise||o instanceof Promise?Promise.all([n,o]).then(([r,a])=>rE(t,r,a)):rE(t,n,o)}});function rE(t,r,a){let i,n=new Map,o=new Map,s=(t,r)=>{let a;if("unrecognized_keys"!==t.code||t.path?.length)if("invalid_key"!==t.code||"record"!==t.origin||t.path?.length!==1)return!1;else{let r=String(t.path[0]);o.has(r)||o.set(r,t),a=[r]}else i??(i=t),a=t.keys;for(let t of a)n.has(t)||n.set(t,{}),n.get(t)[r]=!0;return!0};for(let a of r.issues)s(a,"l")||t.issues.push(a);for(let r of a.issues)s(r,"r")||t.issues.push(r);let l=[...n].filter(([,t])=>t.l&&t.r).map(([t])=>t);if(l.length){let r=i?l.filter(t=>i.keys.includes(t)):[];for(let a of(r.length&&t.issues.push({...i,keys:r}),l))!r.includes(a)&&o.has(a)&&t.issues.push(o.get(a))}let c=function t(r,a){if(r===a||r instanceof Date&&a instanceof Date&&+r==+a)return{valid:!0,data:r};if(ed(r)&&ed(a)){let i=Object.keys(a),n=Object.keys(r).filter(t=>-1!==i.indexOf(t)),o={...r,...a};for(let i of(Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__,n)){if("__proto__"===i)continue;let n=t(r[i],a[i]);if(!n.valid)return{valid:!1,mergeErrorPath:[i,...n.mergeErrorPath]};o[i]=n.data}return{valid:!0,data:o}}if(Array.isArray(r)&&Array.isArray(a)){if(r.length!==a.length)return{valid:!1,mergeErrorPath:[]};let i=[];for(let n=0;n<r.length;n++){let o=t(r[n],a[n]);if(!o.valid)return{valid:!1,mergeErrorPath:[n,...o.mergeErrorPath]};i.push(o.data)}return{valid:!0,data:i}}return{valid:!1,mergeErrorPath:[]}}(r.value,a.value);if(!c.valid){if(ew(t))return t;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return t.value=c.data,t}let rO=eD("$ZodRecord",(t,r)=>{tz.init(t,r);let a=eF.memoizer;a?.attach(t),t._zod.parse=(i,n)=>{let o=i.value;if(!ed(o))return i.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),i;let s=[],l=r.keyType._zod.values;if(l&&!r.partial){let c;i.value=a?a.alloc(t,i,{},n):{};let u=new Set;for(let a of l)if("string"==typeof a||"number"==typeof a||"symbol"==typeof a){if(u.add("number"==typeof a?a.toString():a),"__proto__"===a)continue;let l=r.keyType._zod.run({value:a,issues:[]},n);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(l.issues.length){i.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(t=>eP(t,n,eU())),input:a,path:[a],inst:t});continue}let c=l.value;if("__proto__"===c)continue;let d=r.valueType._zod.run({value:o[a],issues:[]},n);d instanceof Promise?s.push(d.then(t=>{t.issues.length&&i.issues.push(...ek(a,t.issues)),i.value[c]=t.value})):(d.issues.length&&i.issues.push(...ek(a,d.issues)),i.value[c]=d.value)}for(let t in o)if(!u.has(t))if("loose"===r.mode){if("__proto__"===t)continue;i.value[t]=o[t]}else(c=c??[]).push(t);c&&c.length>0&&i.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:c,continue:!0})}else{let c;for(let u of(i.value=a?a.alloc(t,i,{},n):{},Reflect.ownKeys(o))){if("__proto__"===u||!Object.prototype.propertyIsEnumerable.call(o,u))continue;let a=r.keyType._zod.run({value:u,issues:[]},n);if(a instanceof Promise)throw Error("Async schemas not supported in object keys currently");if("string"==typeof u&&td.test(u)&&a.issues.length){let t=r.keyType._zod.run({value:Number(u),issues:[]},n);if(t instanceof Promise)throw Error("Async schemas not supported in object keys currently");0===t.issues.length&&(a=t)}if(a.issues.length){"loose"===r.mode?i.value[u]=o[u]:l?(c=c??[]).push(u):i.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(t=>eP(t,n,eU())),input:u,path:[u],inst:t});continue}let d=a.value;if("__proto__"===d)continue;let p=r.valueType._zod.run({value:o[u],issues:[]},n);p instanceof Promise?s.push(p.then(t=>{t.issues.length&&i.issues.push(...ek(u,t.issues)),i.value[d]=t.value})):(p.issues.length&&i.issues.push(...ek(u,p.issues)),i.value[d]=p.value)}c&&c.length>0&&i.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:c,continue:!0})}return s.length?Promise.all(s).then(()=>i):i}}),rT=eD("$ZodEnum",(t,r)=>{tz.init(t,r);let a=B(r.entries),i=new Set(a);t._zod.values=i,ez(t,"pattern",t=>{let r=B(t.def.entries).filter(t=>em.has(typeof t));return new RegExp(r.length?`^(${r.map(t=>eh(t.toString())).join("|")})$`:"^[^\\s\\S]$")}),t._zod.parse=(r,n)=>{let o=r.value;return i.has(o)||r.issues.push({code:"invalid_value",values:a,input:o,inst:t}),r}}),rj=eD("$ZodLiteral",(t,r)=>{tz.init(t,r);let a=new Set(r.values);t._zod.values=a,ez(t,"pattern",t=>{let r=t.def.values;return new RegExp(r.length?`^(${r.map(t=>"string"==typeof t?eh(t):t?eh(t.toString()):String(t)).join("|")})$`:"^[^\\s\\S]$")}),t._zod.parse=(i,n)=>{let o=i.value;return a.has(o)||i.issues.push({code:"invalid_value",values:r.values,input:o,inst:t}),i}}),rN=eD("$ZodTransform",(t,r)=>{tz.init(t,r),t._zod.optin="optional",eF.memoizer?.guard(t),t._zod.parse=(a,i)=>{if("backward"===i.direction)throw new eV(t.constructor.name);let n=r.transform(a.value,a);if(i.async)return(n instanceof Promise?n:Promise.resolve(n)).then(t=>(a.value=t,a));if(n instanceof Promise)throw new eZ;return a.value=n,a}});function rC(t,r){return t.value=r.issues.length?void 0:r.value,t}let rI=eD("$ZodOptional",(t,r)=>{tz.init(t,r),ez(t,"optin",t=>"defaulted"===t.def.innerType._zod.optin?"defaulted":"optional"),t._zod.optout="optional",ez(t,"values",t=>{let r=t.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),ez(t,"pattern",t=>{let r=t.def.innerType._zod.pattern;return r?RegExp(`^(${Q(r.source)})?$`):void 0}),t._zod.parse=(t,a)=>{if(void 0===t.value){if("defaulted"!==r.innerType._zod.optin)return t;let i=r.innerType._zod.run({value:t.value,issues:[]},a);return i instanceof Promise?i.then(r=>rC(t,r)):rC(t,i)}return r.innerType._zod.run(t,a)}}),rq=eD("$ZodExactOptional",(t,r)=>{rI.init(t,r),ez(t,"values",t=>t.def.innerType._zod.values),ez(t,"pattern",t=>t.def.innerType._zod.pattern),t._zod.parse=(t,a)=>r.innerType._zod.run(t,a)}),rz=eD("$ZodNullable",(t,r)=>{tz.init(t,r),ez(t,"optin",t=>t.def.innerType._zod.optin),ez(t,"optout",t=>t.def.innerType._zod.optout),ez(t,"pattern",t=>{let r=t.def.innerType._zod.pattern;return r?RegExp(`^(${Q(r.source)}|null)$`):void 0}),ez(t,"values",t=>t.def.innerType._zod.values?new Set([...t.def.innerType._zod.values,null]):void 0),t._zod.parse=(t,a)=>null===t.value?t:r.innerType._zod.run(t,a)}),rA=eD("$ZodDefault",(t,r)=>{tz.init(t,r),t._zod.optin="defaulted",ez(t,"values",t=>t.def.innerType._zod.values),t._zod.parse=(t,a)=>{if("backward"===a.direction)return r.innerType._zod.run(t,a);if(void 0===t.value)return t.value=r.defaultValue,t;let i=r.innerType._zod.run(t,a);return i instanceof Promise?i.then(t=>rM(t,r)):rM(i,r)}});function rM(t,r){return void 0===t.value&&(t.value=r.defaultValue),t}let rL=eD("$ZodPrefault",(t,r)=>{tz.init(t,r),t._zod.optin="defaulted",ez(t,"values",t=>t.def.innerType._zod.values),t._zod.parse=(t,a)=>("backward"===a.direction||void 0===t.value&&(t.value=r.defaultValue),r.innerType._zod.run(t,a))}),rD=eD("$ZodNonOptional",(t,r)=>{tz.init(t,r),ez(t,"values",t=>{let r=t.def.innerType._zod.values;return r?new Set([...r].filter(t=>void 0!==t)):void 0}),t._zod.parse=(a,i)=>{let n=r.innerType._zod.run(a,i);return n instanceof Promise?n.then(r=>rZ(r,t)):rZ(n,t)}});function rZ(t,r){return t.issues.length||void 0!==t.value||t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:r}),t}function rV(t,r,a,i){return r.issues.length?t.value=a.catchValue({...r,value:t.value,error:{issues:r.issues.map(t=>eP(t,i,eU()))},input:t.value}):(t.value=r.value,r.memo&&(t.memo=!0)),t}let rF=eD("$ZodCatch",(t,r)=>{tz.init(t,r),ez(t,"optin",t=>"defaulted"===t.def.innerType._zod.optin?"defaulted":"optional"),ez(t,"optout",t=>t.def.innerType._zod.optout),ez(t,"values",t=>t.def.innerType._zod.values),t._zod.parse=(t,a)=>{if("backward"===a.direction)return r.innerType._zod.run(t,a);let i=r.innerType._zod.run({value:t.value,issues:[]},a);return i instanceof Promise?i.then(i=>rV(t,i,r,a)):rV(t,i,r,a)}}),rU=eD("$ZodPipe",(t,r)=>{tz.init(t,r),ez(t,"values",t=>t.def.in._zod.values),ez(t,"optin",t=>t.def.in._zod.optin),ez(t,"optout",t=>t.def.out._zod.optout),ez(t,"propValues",t=>t.def.in._zod.propValues),t._zod.parse=(t,a)=>{if("backward"===a.direction){let i=r.out._zod.run(t,a);return i instanceof Promise?i.then(t=>rJ(t,r.in,a)):rJ(i,r.in,a)}let i=r.in._zod.run(t,a);return i instanceof Promise?i.then(t=>rJ(t,r.out,a)):rJ(i,r.out,a)}});function rJ(t,r,a){return t.issues.some(t=>"unrecognized_keys"!==t.code)?(t.aborted=!0,t):r._zod.run({value:t.value,issues:t.issues},a)}let rH=eD("$ZodPreprocess",(t,r)=>{rU.init(t,r)}),rK=eD("$ZodReadonly",(t,r)=>{tz.init(t,r),ez(t,"propValues",t=>t.def.innerType._zod.propValues),ez(t,"values",t=>t.def.innerType._zod.values),ez(t,"optin",t=>t.def.innerType?._zod?.optin),ez(t,"optout",t=>t.def.innerType?._zod?.optout),t._zod.parse=(t,a)=>{if("backward"===a.direction)return r.innerType._zod.run(t,a);let i=r.innerType._zod.run(t,a);return i instanceof Promise?i.then(rB):rB(i)}});function rB(t){return t.memo||(t.value=Object.freeze(t.value)),t}let rW=eD("$ZodLazy",(t,r)=>{var a;let i;tz.init(t,r),a=t._zod,Object.defineProperty(a,"innerType",{get(){if(i!==ee)return void 0===i&&(i=ee,i=(()=>(r._cachedInner||(r._cachedInner=r.getter()),r._cachedInner))()),i},set(t){Object.defineProperty(a,"innerType",{value:t})},configurable:!0}),ez(t,"pattern",t=>t.innerType?._zod?.pattern),ez(t,"propValues",t=>t.innerType?._zod?.propValues),ez(t,"optin",t=>t.innerType?._zod?.optin??void 0),ez(t,"optout",t=>t.innerType?._zod?.optout??void 0),t._zod.parse=(r,a)=>t._zod.innerType._zod.run(r,a)}),rG=eD("$ZodCustom",(t,r)=>{ty.init(t,r),tz.init(t,r),t._zod.parse=(t,r)=>t,t._zod.check=a=>{let i=a.value,n=r.fn(i);if(n instanceof Promise)return n.then(r=>rY(r,a,i,t));rY(n,a,i,t)}});function rY(t,r,a,i){if(!t){let t={code:"custom",input:a,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(t.params=i._zod.def.params),r.issues.push(ej(t))}}(T=globalThis).__zod_globalRegistry??(T.__zod_globalRegistry=new class t{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let a=r[0];return this._map.set(t,a),a&&"object"==typeof a&&"id"in a&&this._idmap.set(a.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&"object"==typeof r&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let a={...this.get(r)??{}};delete a.id;let i={...a,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}});let rX=globalThis.__zod_globalRegistry;function rQ(t){return t.checks&&(t.checks=[...t.checks]),t}function r0(t,r){return new t({type:"string",format:"email",check:"string_format",abort:!1,...ey(r)})}function r1(t,r){return new t({type:"string",format:"url",check:"string_format",abort:!1,...ey(r)})}function r2(t,r){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ey(r)})}function r9(t,r){return new t({type:"string",format:"date",check:"string_format",...ey(r)})}function r4(t,r){return new t_({check:"less_than",...ey(r),value:t,inclusive:!1})}function r6(t,r){return new t_({check:"less_than",...ey(r),value:t,inclusive:!0})}function r3(t,r){return new tb({check:"greater_than",...ey(r),value:t,inclusive:!1})}function r5(t,r){return new tb({check:"greater_than",...ey(r),value:t,inclusive:!0})}function r8(t,r){return new tS({check:"multiple_of",...ey(r),value:t})}function r7(t,r){return new tw({check:"max_length",...ey(r),maximum:t})}function ae(t,r){return new tk({check:"min_length",...ey(r),minimum:t})}function at(t,r){return new tx({check:"length_equals",...ey(r),length:t})}function ar(t){return new tC({check:"overwrite",tx:t})}function aa(t,...r){for(let a of r)for(let r of Reflect.ownKeys(a))Object.prototype.propertyIsEnumerable.call(a,r)&&et(t,r,a[r]);return t}function ai(t){let r=t?.target??"draft-2020-12";return"draft-4"===r&&(r="draft-04"),"draft-7"===r&&(r="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??rX,target:r,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:t?.cycles??"ref",reused:t?.reused??"inline",intersections:[],deferred:[],external:t?.external??void 0}}function an(t,r,a,i,n){let o="function"==typeof r.unrepresentable?r.unrepresentable({zodSchema:t,path:i.path,message:n}):r.unrepresentable;if("any"===o)return!1;if(void 0===o||"throw"===o)throw Error(n);return Object.assign(a,o),!0}function ao(t,r,a={path:[],schemaPath:[]}){var i;let n=t._zod.def,o=r.seen.get(t);if(o)return o.count++,a.schemaPath.includes(t)&&(o.cycle=a.path),o.schema;let s={schema:{},count:1,cycle:void 0,path:a.path};r.seen.set(t,s),r.sharedDefsExtractedFor=void 0,r.sharedEmitDoneFor=void 0;let l=t._zod.toJSONSchema?.();if(l)s.schema=l;else{let i={...a,schemaPath:[...a.schemaPath,t],path:a.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(r,s.schema,i);else{let a=s.schema,o=r.processors[n.type];if(!o)throw Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);o(t,r,a,i)}let o=t._zod.parent;o&&(s.ref||(s.ref=o),ao(o,r,i),r.seen.get(o).isParent=!0)}let c=r.metadataRegistry.get(t);return c&&aa(s.schema,c),"input"===r.io&&function t(r,a){let i=a??{seen:new Set};if(i.seen.has(r))return!1;i.seen.add(r);let n=r._zod.def;if("transform"===n.type)return!0;if("array"===n.type)return t(n.element,i);if("set"===n.type)return t(n.valueType,i);if("lazy"===n.type)return t(n.getter(),i);if("promise"===n.type||"optional"===n.type||"nonoptional"===n.type||"nullable"===n.type||"readonly"===n.type||"default"===n.type||"prefault"===n.type||"catch"===n.type)return t(n.innerType,i);if("intersection"===n.type)return t(n.left,i)||t(n.right,i);if("record"===n.type||"map"===n.type)return t(n.keyType,i)||t(n.valueType,i);if("pipe"===n.type)return!!r._zod.traits.has("$ZodCodec")||t(n.in,i)||t(n.out,i);if("object"===n.type){for(let r in n.shape)if(t(n.shape[r],i))return!0;return!1}if("union"===n.type){for(let r of n.options)if(t(r,i))return!0;return!1}if("tuple"===n.type){for(let r of n.items)if(t(r,i))return!0;if(n.rest&&t(n.rest,i))return!0}return!1}(t)&&(delete s.schema.examples,delete s.schema.default),"input"===r.io&&"_prefault"in s.schema&&((i=s.schema).default??(i.default=s.schema._prefault)),delete s.schema._prefault,r.seen.get(t).schema}function as(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function al(t,r){let a=t.seen.get(r);if(!a)throw Error("Unprocessed schema. This is a bug in Zod.");if(t.external&&t.sharedDefsExtractedFor===t.external)return;let i=new Map;for(let r of t.seen.entries()){let a=t.metadataRegistry.get(r[0])?.id;if(a){let t=i.get(a);if(t&&t!==r[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(a,r[0])}}let n=r=>{if(r[1].schema.$ref)return;let i=r[1],{ref:n,defId:o}=(r=>{let i="draft-2020-12"===t.target?"$defs":"definitions";if(t.external){let a=t.external.registry.get(r[0])?.id,n=t.external.uri??(t=>t);if(a)return{ref:n(a)};let o=r[1].defId??r[1].schema.id??`schema${t.counter++}`;return r[1].defId=o,{defId:o,ref:`${n("__shared")}#/${i}/${as(o)}`}}let n=`#/${i}/`;if(r[1]===a&&!r[1].schema.id)return{ref:"#"};let o=r[1].schema.id??`__schema${t.counter++}`;return{defId:o,ref:n+as(o)}})(r);i.def={...i.schema},o&&(i.defId=o);let s=i.schema;for(let t in s)delete s[t];s.$ref=n};if("throw"===t.cycles)for(let r of t.seen.entries()){let t=r[1];if(t.cycle)throw Error(`Cycle detected: #/${t.cycle?.join("/")}/<root>
|
|
53
|
+
`)}return n.write("payload.value = newResult;"),n.write("return payload;"),n.compile()})(r.shape)),d=a(d,p),u)?rb([],m,d,p,i,t,p?.abortEarly===!0):d:n(d,p):(d.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),d)}});function rw(t,r,a,i){for(let a of t)if(0===a.issues.length)return r.value=a.value,r;let n=t.filter(t=>!e$(t));return 1===n.length?(r.value=n[0].value,n[0]):(r.issues.push({code:"invalid_union",input:r.value,inst:a,errors:t.map(t=>t.issues.map(t=>eR(t,i,eF())))}),r)}let rk=eL("$ZodUnion",(t,r)=>{tq.init(t,r),eq(t,"optin",t=>t.def.options.some(t=>"defaulted"===t._zod.optin)?"defaulted":t.def.options.some(t=>void 0!==t._zod.optin)?"optional":void 0),eq(t,"optout",t=>t.def.options.some(t=>"optional"===t._zod.optout)?"optional":void 0),eq(t,"values",t=>{if(t.def.options.every(t=>t._zod.values))return new Set(t.def.options.flatMap(t=>Array.from(t._zod.values)))}),eq(t,"pattern",t=>{if(t.def.options.every(t=>t._zod.pattern)){let r=t.def.options.map(t=>t._zod.pattern);return RegExp(`^(${r.map(t=>X(t.source)).join("|")})$`)}});let a=1===r.options.length?r.options[0]._zod.run:null;t._zod.parse=(i,n)=>{if(a)return a(i,n);let o=!1,s=[];for(let t of r.options){let r=t._zod.run({value:i.value,issues:[]},n);if(r instanceof Promise)s.push(r),o=!0;else{if(0===r.issues.length)return r;s.push(r)}}return o?Promise.all(s).then(r=>rw(r,i,t,n)):rw(s,i,t,n)}}),rx=eL("$ZodDiscriminatedUnion",(t,r)=>{r.inclusive=!1,rk.init(t,r);let a=t._zod.parse;eq(t,"propValues",t=>{let r={},a=0;for(let i of t.def.options){let n=i._zod.propValues;if(!n||0===Object.keys(n).length)throw Error(`Invalid discriminated union option at index "${t.def.options.indexOf(i)}"`);for(let[i,o]of(n[t.def.discriminator]?.has(void 0)&&a++,Object.entries(n)))for(let t of(Object.prototype.hasOwnProperty.call(r,i)||ee(r,i,new Set),o))r[i].add(t)}return!t.def.unionFallback&&a>1&&r[t.def.discriminator]?.delete(void 0),r}),r.options.forEach((t,a)=>{let i=et(t._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,r.discriminator))throw Error(`Invalid discriminated union option at index "${a}"`)});let i=Y(()=>(function(t){let r=new Map;for(let a of t.options){let i=a._zod.propValues?.[t.discriminator];if(!i||0===i.size)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let t of i)if(r.has(t)){if(void 0!==t)throw Error(`Duplicate discriminator value "${String(t)}"`);r.set(t,null)}else r.set(t,a)}return r})(r));t._zod.parse=(n,o)=>{let s=n.value;if(!el(s))return n.issues.push({code:"invalid_type",expected:"object",input:s,inst:t}),n;let l=s?.[r.discriminator],c=i.value.get(l);return c&&(void 0!==l||"backward"!==o.direction)?c._zod.run(n,o):r.unionFallback||"backward"===o.direction?a(n,o):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:r.discriminator,options:Array.from(i.value.keys()).filter(t=>null!==i.value.get(t)),input:s,path:[r.discriminator],inst:t}),n)}}),rR=eL("$ZodIntersection",(t,r)=>{tq.init(t,r),t._zod.parse=(t,a)=>{let i=t.value,n=r.left._zod.run({value:i,issues:[]},a),o=r.right._zod.run({value:i,issues:[]},a);return n instanceof Promise||o instanceof Promise?Promise.all([n,o]).then(([r,a])=>rP(t,r,a)):rP(t,n,o)}});function rP(t,r,a){let i,n=new Map,o=new Map,s=(t,r)=>{let a;if("unrecognized_keys"!==t.code||t.path?.length)if("invalid_key"!==t.code||"record"!==t.origin||t.path?.length!==1)return!1;else{let r=String(t.path[0]);o.has(r)||o.set(r,t),a=[r]}else i??(i=t),a=t.keys;for(let t of a)n.has(t)||n.set(t,{}),n.get(t)[r]=!0;return!0};for(let a of r.issues)s(a,"l")||t.issues.push(a);for(let r of a.issues)s(r,"r")||t.issues.push(r);let l=[...n].filter(([,t])=>t.l&&t.r).map(([t])=>t);if(l.length){let r=i?l.filter(t=>i.keys.includes(t)):[];for(let a of(r.length&&t.issues.push({...i,keys:r}),l))!r.includes(a)&&o.has(a)&&t.issues.push(o.get(a))}let c=function t(r,a){if(r===a||r instanceof Date&&a instanceof Date&&+r==+a)return{valid:!0,data:r};if(eu(r)&&eu(a)){let i=Object.keys(a),n=Object.keys(r).filter(t=>-1!==i.indexOf(t)),o={...r,...a};for(let i of(Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__,n)){if("__proto__"===i)continue;let n=t(r[i],a[i]);if(!n.valid)return{valid:!1,mergeErrorPath:[i,...n.mergeErrorPath]};o[i]=n.data}return{valid:!0,data:o}}if(Array.isArray(r)&&Array.isArray(a)){if(r.length!==a.length)return{valid:!1,mergeErrorPath:[]};let i=[];for(let n=0;n<r.length;n++){let o=t(r[n],a[n]);if(!o.valid)return{valid:!1,mergeErrorPath:[n,...o.mergeErrorPath]};i.push(o.data)}return{valid:!0,data:i}}return{valid:!1,mergeErrorPath:[]}}(r.value,a.value);if(!c.valid){if(e$(t))return t;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return t.value=c.data,t}let rE=eL("$ZodRecord",(t,r)=>{tq.init(t,r);let a=eV.memoizer;a?.attach(t),t._zod.parse=(i,n)=>{let o=i.value;if(!eu(o))return i.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),i;let s=[],l=r.keyType._zod.values;if(l&&!r.partial){let c;i.value=a?a.alloc(t,i,{},n):{};let u=new Set;for(let a of l)if("string"==typeof a||"number"==typeof a||"symbol"==typeof a){if(u.add("number"==typeof a?a.toString():a),"__proto__"===a)continue;let l=r.keyType._zod.run({value:a,issues:[]},n);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(l.issues.length){i.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(t=>eR(t,n,eF())),input:a,path:[a],inst:t});continue}let c=l.value;if("__proto__"===c)continue;let d=r.valueType._zod.run({value:o[a],issues:[]},n);d instanceof Promise?s.push(d.then(t=>{t.issues.length&&i.issues.push(...ew(a,t.issues)),i.value[c]=t.value})):(d.issues.length&&i.issues.push(...ew(a,d.issues)),i.value[c]=d.value)}for(let t in o)if(!u.has(t))if("loose"===r.mode){if("__proto__"===t)continue;i.value[t]=o[t]}else(c=c??[]).push(t);c&&c.length>0&&i.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:c,continue:!0})}else{let c;for(let u of(i.value=a?a.alloc(t,i,{},n):{},Reflect.ownKeys(o))){if("__proto__"===u||!Object.prototype.propertyIsEnumerable.call(o,u))continue;let a=r.keyType._zod.run({value:u,issues:[]},n);if(a instanceof Promise)throw Error("Async schemas not supported in object keys currently");if("string"==typeof u&&tu.test(u)&&a.issues.length){let t=r.keyType._zod.run({value:Number(u),issues:[]},n);if(t instanceof Promise)throw Error("Async schemas not supported in object keys currently");0===t.issues.length&&(a=t)}if(a.issues.length){"loose"===r.mode?i.value[u]=o[u]:l?(c=c??[]).push(u):i.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(t=>eR(t,n,eF())),input:u,path:[u],inst:t});continue}let d=a.value;if("__proto__"===d)continue;let p=r.valueType._zod.run({value:o[u],issues:[]},n);p instanceof Promise?s.push(p.then(t=>{t.issues.length&&i.issues.push(...ew(u,t.issues)),i.value[d]=t.value})):(p.issues.length&&i.issues.push(...ew(u,p.issues)),i.value[d]=p.value)}c&&c.length>0&&i.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:c,continue:!0})}return s.length?Promise.all(s).then(()=>i):i}}),rj=eL("$ZodEnum",(t,r)=>{tq.init(t,r);let a=K(r.entries),i=new Set(a);t._zod.values=i,eq(t,"pattern",t=>{let r=K(t.def.entries).filter(t=>ep.has(typeof t));return new RegExp(r.length?`^(${r.map(t=>em(t.toString())).join("|")})$`:"^[^\\s\\S]$")}),t._zod.parse=(r,n)=>{let o=r.value;return i.has(o)||r.issues.push({code:"invalid_value",values:a,input:o,inst:t}),r}}),rT=eL("$ZodLiteral",(t,r)=>{tq.init(t,r);let a=new Set(r.values);t._zod.values=a,eq(t,"pattern",t=>{let r=t.def.values;return new RegExp(r.length?`^(${r.map(t=>"string"==typeof t?em(t):t?em(t.toString()):String(t)).join("|")})$`:"^[^\\s\\S]$")}),t._zod.parse=(i,n)=>{let o=i.value;return a.has(o)||i.issues.push({code:"invalid_value",values:r.values,input:o,inst:t}),i}}),rO=eL("$ZodTransform",(t,r)=>{tq.init(t,r),t._zod.optin="optional",eV.memoizer?.guard(t),t._zod.parse=(a,i)=>{if("backward"===i.direction)throw new eZ(t.constructor.name);let n=r.transform(a.value,a);if(i.async)return(n instanceof Promise?n:Promise.resolve(n)).then(t=>(a.value=t,a));if(n instanceof Promise)throw new eD;return a.value=n,a}});function rC(t,r){return t.value=r.issues.length?void 0:r.value,t}let rN=eL("$ZodOptional",(t,r)=>{tq.init(t,r),eq(t,"optin",t=>"defaulted"===t.def.innerType._zod.optin?"defaulted":"optional"),t._zod.optout="optional",eq(t,"values",t=>{let r=t.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),eq(t,"pattern",t=>{let r=t.def.innerType._zod.pattern;return r?RegExp(`^(${X(r.source)})?$`):void 0}),t._zod.parse=(t,a)=>{if(void 0===t.value){if("defaulted"!==r.innerType._zod.optin)return t;let i=r.innerType._zod.run({value:t.value,issues:[]},a);return i instanceof Promise?i.then(r=>rC(t,r)):rC(t,i)}return r.innerType._zod.run(t,a)}}),rI=eL("$ZodExactOptional",(t,r)=>{rN.init(t,r),eq(t,"values",t=>t.def.innerType._zod.values),eq(t,"pattern",t=>t.def.innerType._zod.pattern),t._zod.parse=(t,a)=>r.innerType._zod.run(t,a)}),rq=eL("$ZodNullable",(t,r)=>{tq.init(t,r),eq(t,"optin",t=>t.def.innerType._zod.optin),eq(t,"optout",t=>t.def.innerType._zod.optout),eq(t,"pattern",t=>{let r=t.def.innerType._zod.pattern;return r?RegExp(`^(${X(r.source)}|null)$`):void 0}),eq(t,"values",t=>t.def.innerType._zod.values?new Set([...t.def.innerType._zod.values,null]):void 0),t._zod.parse=(t,a)=>null===t.value?t:r.innerType._zod.run(t,a)}),rA=eL("$ZodDefault",(t,r)=>{tq.init(t,r),t._zod.optin="defaulted",eq(t,"values",t=>t.def.innerType._zod.values),t._zod.parse=(t,a)=>{if("backward"===a.direction)return r.innerType._zod.run(t,a);if(void 0===t.value)return t.value=r.defaultValue,t;let i=r.innerType._zod.run(t,a);return i instanceof Promise?i.then(t=>rz(t,r)):rz(i,r)}});function rz(t,r){return void 0===t.value&&(t.value=r.defaultValue),t}let rM=eL("$ZodPrefault",(t,r)=>{tq.init(t,r),t._zod.optin="defaulted",eq(t,"values",t=>t.def.innerType._zod.values),t._zod.parse=(t,a)=>("backward"===a.direction||void 0===t.value&&(t.value=r.defaultValue),r.innerType._zod.run(t,a))}),rL=eL("$ZodNonOptional",(t,r)=>{tq.init(t,r),eq(t,"values",t=>{let r=t.def.innerType._zod.values;return r?new Set([...r].filter(t=>void 0!==t)):void 0}),t._zod.parse=(a,i)=>{let n=r.innerType._zod.run(a,i);return n instanceof Promise?n.then(r=>rD(r,t)):rD(n,t)}});function rD(t,r){return t.issues.length||void 0!==t.value||t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:r}),t}function rZ(t,r,a,i){return r.issues.length?t.value=a.catchValue({...r,value:t.value,error:{issues:r.issues.map(t=>eR(t,i,eF()))},input:t.value}):(t.value=r.value,r.memo&&(t.memo=!0)),t}let rV=eL("$ZodCatch",(t,r)=>{tq.init(t,r),eq(t,"optin",t=>"defaulted"===t.def.innerType._zod.optin?"defaulted":"optional"),eq(t,"optout",t=>t.def.innerType._zod.optout),eq(t,"values",t=>t.def.innerType._zod.values),t._zod.parse=(t,a)=>{if("backward"===a.direction)return r.innerType._zod.run(t,a);let i=r.innerType._zod.run({value:t.value,issues:[]},a);return i instanceof Promise?i.then(i=>rZ(t,i,r,a)):rZ(t,i,r,a)}}),rF=eL("$ZodPipe",(t,r)=>{tq.init(t,r),eq(t,"values",t=>t.def.in._zod.values),eq(t,"optin",t=>t.def.in._zod.optin),eq(t,"optout",t=>t.def.out._zod.optout),eq(t,"propValues",t=>t.def.in._zod.propValues),t._zod.parse=(t,a)=>{if("backward"===a.direction){let i=r.out._zod.run(t,a);return i instanceof Promise?i.then(t=>rU(t,r.in,a)):rU(i,r.in,a)}let i=r.in._zod.run(t,a);return i instanceof Promise?i.then(t=>rU(t,r.out,a)):rU(i,r.out,a)}});function rU(t,r,a){return t.issues.some(t=>"unrecognized_keys"!==t.code)?(t.aborted=!0,t):r._zod.run({value:t.value,issues:t.issues},a)}let rH=eL("$ZodPreprocess",(t,r)=>{rF.init(t,r)}),rJ=eL("$ZodReadonly",(t,r)=>{tq.init(t,r),eq(t,"propValues",t=>t.def.innerType._zod.propValues),eq(t,"values",t=>t.def.innerType._zod.values),eq(t,"optin",t=>t.def.innerType?._zod?.optin),eq(t,"optout",t=>t.def.innerType?._zod?.optout),t._zod.parse=(t,a)=>{if("backward"===a.direction)return r.innerType._zod.run(t,a);let i=r.innerType._zod.run(t,a);return i instanceof Promise?i.then(rK):rK(i)}});function rK(t){return t.memo||(t.value=Object.freeze(t.value)),t}let rB=eL("$ZodLazy",(t,r)=>{var a;let i;tq.init(t,r),a=t._zod,Object.defineProperty(a,"innerType",{get(){if(i!==Q)return void 0===i&&(i=Q,i=(()=>(r._cachedInner||(r._cachedInner=r.getter()),r._cachedInner))()),i},set(t){Object.defineProperty(a,"innerType",{value:t})},configurable:!0}),eq(t,"pattern",t=>t.innerType?._zod?.pattern),eq(t,"propValues",t=>t.innerType?._zod?.propValues),eq(t,"optin",t=>t.innerType?._zod?.optin??void 0),eq(t,"optout",t=>t.innerType?._zod?.optout??void 0),t._zod.parse=(r,a)=>t._zod.innerType._zod.run(r,a)}),rG=eL("$ZodCustom",(t,r)=>{tf.init(t,r),tq.init(t,r),t._zod.parse=(t,r)=>t,t._zod.check=a=>{let i=a.value,n=r.fn(i);if(n instanceof Promise)return n.then(r=>rW(r,a,i,t));rW(n,a,i,t)}});function rW(t,r,a,i){if(!t){let t={code:"custom",input:a,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(t.params=i._zod.def.params),r.issues.push(eT(t))}}(T=globalThis).__zod_globalRegistry??(T.__zod_globalRegistry=new class t{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let a=r[0];return this._map.set(t,a),a&&"object"==typeof a&&"id"in a&&this._idmap.set(a.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&"object"==typeof r&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let a={...this.get(r)??{}};delete a.id;let i={...a,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}});let rY=globalThis.__zod_globalRegistry;function rX(t){return t.checks&&(t.checks=[...t.checks]),t}function rQ(t,r){return new t({type:"string",format:"email",check:"string_format",abort:!1,...ef(r)})}function r0(t,r){return new t({type:"string",format:"url",check:"string_format",abort:!1,...ef(r)})}function r1(t,r){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ef(r)})}function r2(t,r){return new t({type:"string",format:"date",check:"string_format",...ef(r)})}function r9(t,r){return new tv({check:"less_than",...ef(r),value:t,inclusive:!1})}function r4(t,r){return new tv({check:"less_than",...ef(r),value:t,inclusive:!0})}function r6(t,r){return new t_({check:"greater_than",...ef(r),value:t,inclusive:!1})}function r5(t,r){return new t_({check:"greater_than",...ef(r),value:t,inclusive:!0})}function r3(t,r){return new tb({check:"multiple_of",...ef(r),value:t})}function r8(t,r){return new t$({check:"max_length",...ef(r),maximum:t})}function r7(t,r){return new tw({check:"min_length",...ef(r),minimum:t})}function ae(t,r){return new tk({check:"length_equals",...ef(r),length:t})}function at(t){return new tC({check:"overwrite",tx:t})}function ar(t,...r){for(let a of r)for(let r of Reflect.ownKeys(a))Object.prototype.propertyIsEnumerable.call(a,r)&&ee(t,r,a[r]);return t}function aa(t){let r=t?.target??"draft-2020-12";return"draft-4"===r&&(r="draft-04"),"draft-7"===r&&(r="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??rY,target:r,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:t?.cycles??"ref",reused:t?.reused??"inline",intersections:[],deferred:[],external:t?.external??void 0}}function ai(t,r,a,i,n){let o="function"==typeof r.unrepresentable?r.unrepresentable({zodSchema:t,path:i.path,message:n}):r.unrepresentable;if("any"===o)return!1;if(void 0===o||"throw"===o)throw Error(n);return Object.assign(a,o),!0}function an(t,r,a={path:[],schemaPath:[]}){var i;let n=t._zod.def,o=r.seen.get(t);if(o)return o.count++,a.schemaPath.includes(t)&&(o.cycle=a.path),o.schema;let s={schema:{},count:1,cycle:void 0,path:a.path};r.seen.set(t,s),r.sharedDefsExtractedFor=void 0,r.sharedEmitDoneFor=void 0;let l=t._zod.toJSONSchema?.();if(l)s.schema=l;else{let i={...a,schemaPath:[...a.schemaPath,t],path:a.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(r,s.schema,i);else{let a=s.schema,o=r.processors[n.type];if(!o)throw Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);o(t,r,a,i)}let o=t._zod.parent;o&&(s.ref||(s.ref=o),an(o,r,i),r.seen.get(o).isParent=!0)}let c=r.metadataRegistry.get(t);return c&&ar(s.schema,c),"input"===r.io&&function t(r,a){let i=a??{seen:new Set};if(i.seen.has(r))return!1;i.seen.add(r);let n=r._zod.def;if("transform"===n.type)return!0;if("array"===n.type)return t(n.element,i);if("set"===n.type)return t(n.valueType,i);if("lazy"===n.type)return t(n.getter(),i);if("promise"===n.type||"optional"===n.type||"nonoptional"===n.type||"nullable"===n.type||"readonly"===n.type||"default"===n.type||"prefault"===n.type||"catch"===n.type)return t(n.innerType,i);if("intersection"===n.type)return t(n.left,i)||t(n.right,i);if("record"===n.type||"map"===n.type)return t(n.keyType,i)||t(n.valueType,i);if("pipe"===n.type)return!!r._zod.traits.has("$ZodCodec")||t(n.in,i)||t(n.out,i);if("object"===n.type){for(let r in n.shape)if(t(n.shape[r],i))return!0;return!1}if("union"===n.type){for(let r of n.options)if(t(r,i))return!0;return!1}if("tuple"===n.type){for(let r of n.items)if(t(r,i))return!0;if(n.rest&&t(n.rest,i))return!0}return!1}(t)&&(delete s.schema.examples,delete s.schema.default),"input"===r.io&&"_prefault"in s.schema&&((i=s.schema).default??(i.default=s.schema._prefault)),delete s.schema._prefault,r.seen.get(t).schema}function ao(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function as(t,r){let a=t.seen.get(r);if(!a)throw Error("Unprocessed schema. This is a bug in Zod.");if(t.external&&t.sharedDefsExtractedFor===t.external)return;let i=new Map;for(let r of t.seen.entries()){let a=t.metadataRegistry.get(r[0])?.id;if(a){let t=i.get(a);if(t&&t!==r[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(a,r[0])}}let n=r=>{if(r[1].schema.$ref)return;let i=r[1],{ref:n,defId:o}=(r=>{let i="draft-2020-12"===t.target?"$defs":"definitions";if(t.external){let a=t.external.registry.get(r[0])?.id,n=t.external.uri??(t=>t);if(a)return{ref:n(a)};let o=r[1].defId??r[1].schema.id??`schema${t.counter++}`;return r[1].defId=o,{defId:o,ref:`${n("__shared")}#/${i}/${ao(o)}`}}let n=`#/${i}/`;if(r[1]===a&&!r[1].schema.id)return{ref:"#"};let o=r[1].schema.id??`__schema${t.counter++}`;return{defId:o,ref:n+ao(o)}})(r);i.def={...i.schema},o&&(i.defId=o);let s=i.schema;for(let t in s)delete s[t];s.$ref=n};if("throw"===t.cycles)for(let r of t.seen.entries()){let t=r[1];if(t.cycle)throw Error(`Cycle detected: #/${t.cycle?.join("/")}/<root>
|
|
54
54
|
|
|
55
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of t.seen.entries()){let i=a[1];if(r===a[0]){n(a);continue}if(t.external){let i=t.external.registry.get(a[0])?.id;if(r!==a[0]&&i){n(a);continue}}if(t.metadataRegistry.get(a[0])?.id||i.cycle){n(a);continue}i.count>1&&"ref"===t.reused&&n(a)}t.external&&(t.sharedDefsExtractedFor=t.external)}let ac=new Set(["type","properties","required","additionalProperties"]),au=["oneOf","anyOf"];function ad(t){let r=t.additionalProperties;return void 0===r||!1===r||"object"!=typeof r||null===r?null:Object.keys(r).length?r:null}function ap(t){let r=[];for(let a of t){if("object"!=typeof a||"object"!==a.type)return null;for(let t in a)if(!ac.has(t))return null;r.push(a)}let a={},i=new Set;for(let t of r){for(let i in t.properties){if(Object.prototype.hasOwnProperty.call(a,i))continue;let t=[];for(let a of r){let r=a.properties?.[i]??ad(a);null!=r&&(t.some(t=>JSON.stringify(t)===JSON.stringify(r))||t.push(r))}et(a,i,1===t.length?t[0]:ap(t)??{allOf:t})}for(let r of t.required??[])i.add(r)}let n={type:"object",properties:a};if(i.size&&(n.required=[...i]),r.every(t=>!1===t.additionalProperties))n.additionalProperties=!1;else{let t=[];for(let a of r){let r=ad(a);r&&!t.some(t=>JSON.stringify(t)===JSON.stringify(r))&&t.push(r)}1===t.length?n.additionalProperties=t[0]:t.length>1&&(n.additionalProperties={allOf:t})}return n}function am(t,r){let a=t.seen.get(r);if(!a)throw Error("Unprocessed schema. This is a bug in Zod.");let i=r=>{let a=t.seen.get(r);if(null===a.ref)return;let n=a.def??a.schema,o={...n},s=a.ref;if(a.ref=null,s){i(s);let a=t.seen.get(s),l=a.schema;if(l.$ref&&("draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target)?(n.allOf=n.allOf??[],n.allOf.push(l)):aa(n,l),aa(n,o),r._zod.parent===s)for(let t in n)"$ref"!==t&&"allOf"!==t&&(t in o||delete n[t]);if(l.$ref&&a.def)for(let t in n)"$ref"!==t&&"allOf"!==t&&t in a.def&&JSON.stringify(n[t])===JSON.stringify(a.def[t])&&delete n[t]}let l=r._zod.parent;if(l&&l!==s){i(l);let r=t.seen.get(l);if(r?.schema.$ref&&(n.$ref=r.schema.$ref,r.def))for(let t in n)"$ref"!==t&&"allOf"!==t&&t in r.def&&JSON.stringify(n[t])===JSON.stringify(r.def[t])&&delete n[t]}t.override({zodSchema:r,jsonSchema:n,path:a.path??[]})};if(!t.external||t.sharedEmitDoneFor!==t.external){for(let r of[...t.seen.entries()].reverse())i(r[0]);if("openapi-3.0"!==t.target)for(let r of t.seen.entries())!function t(r){let a=r.anyOf;if(!Array.isArray(a)||0===a.length||void 0!==r.type)return;let i=[];for(let r of a){if(!r||"object"!=typeof r)return;t(r);let a=Object.keys(r);if(1!==a.length||"type"!==a[0])return;let n=r.type;for(let t of Array.isArray(n)?n:[n]){if("string"!=typeof t)return;i.includes(t)||i.push(t)}}delete r.anyOf,r.type=1===i.length?i[0]:i}(r[1].def??r[1].schema);for(let r of t.deferred)r();if(t.intersections.length){let r=new Map;for(let a of t.seen.values())for(let t of[a.schema,a.def]){let a=t?.allOf;if(!Array.isArray(a))continue;let i=r.get(a);i?i.push(t):r.set(a,[t])}for(let a of t.intersections)for(let t of r.get(a)??[])!function(t){let r=t.allOf;if(!Array.isArray(r)||r.length<2)return;for(let r of ac)if(r in t)return;let a=r.filter(t=>au.some(r=>Array.isArray(t[r]))),i=null;if(a.length){let t=a[0],n=au.find(r=>Array.isArray(t[r]));if(1!==Object.keys(t).length)return;let o=r.filter(r=>r!==t),s=t[n].map(t=>ap([...o,t]));if(s.some(t=>!t))return;i={[n]:s}}else i=ap(r);i&&(delete t.allOf,aa(t,i))}(t)}}let n={};if("draft-2020-12"===t.target?n.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===t.target?n.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===t.target?n.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let a=t.external.registry.get(r)?.id;if(!a)throw Error("Schema is missing an `id` property");n.$id=t.external.uri(a)}aa(n,a.defId?a.schema:a.def??a.schema);let o=t.metadataRegistry.get(r)?.id;void 0!==o&&n.id===o&&delete n.id;let s=t.external?.defs??{};if(!t.external||t.sharedEmitDoneFor!==t.external)for(let r of t.seen.entries()){let t=r[1];t.def&&t.defId&&(t.def.id===t.defId&&delete t.def.id,et(s,t.defId,t.def))}t.external&&(t.sharedEmitDoneFor=t.external),t.external||Object.keys(s).length>0&&("draft-2020-12"===t.target?n.$defs=s:n.definitions=s);try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...r["~standard"],jsonSchema:{input:ah(r,"input",t.processors),output:ah(r,"output",t.processors)}},enumerable:!1,writable:!1}),a}catch(t){throw Error("Error converting schema to JSON.")}}let ah=(t,r,a={})=>i=>{let{libraryOptions:n,target:o}=i??{},s=ai({...n??{},target:o,io:r,processors:a});return ao(t,s),al(s,t),am(s,t)},af=(t,r,a)=>{(void 0===t[r]||a>t[r])&&(t[r]=a)},ay=(t,r,a)=>{(void 0===t[r]||a<t[r])&&(t[r]=a)},ag=(t,r)=>{af(t,"minimum",r),ay(t,"maximum",r)},av=(t,r)=>{t.multipleOf??(t.multipleOf=[]),t.multipleOf.includes(r)||t.multipleOf.push(r)},a_=(t,r)=>{t.patterns??(t.patterns=new Set),t.patterns.add(r)},ab=(t,r)=>{t.mime=t.mime?t.mime.filter(t=>r.includes(t)):[...r]},aS=(t,r)=>{t.format=r,r.includes("int")&&(t.isInt=!0)},a$=(t,r)=>af(t,"minimum",r.minimum),aw=(t,r)=>ay(t,"maximum",r.maximum),ak=t=>(r,a)=>{aS(r,a.format);let[i,n]=t[a.format];af(r,"minimum",i),ay(r,"maximum",n)},ax={greater_than:(t,r)=>af(t,r.inclusive?"minimum":"exclusiveMinimum",r.value),less_than:(t,r)=>ay(t,r.inclusive?"maximum":"exclusiveMaximum",r.value),multiple_of:(t,r)=>av(t,r.value),number_format:ak(ev),bigint_format:ak(e_),min_length:a$,max_length:aw,length_equals:(t,r)=>ag(t,r.length),min_size:a$,max_size:aw,size_equals:(t,r)=>ag(t,r.size),string_format:(t,r)=>{aS(t,r.format),r.pattern&&a_(t,r.pattern),("base64"===r.format||"base64url"===r.format)&&(t.contentEncoding=r.format),(r.local||-1===r.precision)&&(t.laxFormat=!0)},mime_type:(t,r)=>ab(t,r.mime)};function aR(t){let r={},a=t._zod.def;for(let i of t._zod.traits.has("$ZodCheck")?[t,...a.checks??[]]:a.checks??[])ax[i._zod.def.check]?.(r,i._zod.def);let i=t._zod.bag;for(let t of(void 0!==i.minimum&&af(r,"minimum",i.minimum),void 0!==i.exclusiveMinimum&&af(r,"exclusiveMinimum",i.exclusiveMinimum),void 0!==i.maximum&&ay(r,"maximum",i.maximum),void 0!==i.exclusiveMaximum&&ay(r,"exclusiveMaximum",i.exclusiveMaximum),void 0!==i.multipleOf&&av(r,i.multipleOf),void 0!==i.format&&(r.format??(r.format=i.format),i.format.includes("int")&&(r.isInt=!0)),i.mime&&ab(r,i.mime),i.patterns??[]))a_(r,t);return r}let aP={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},aE=new Map([[ra,/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/],[rn,/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/]]),aO=t=>aE.get(t)??t,aT=(t,r,a,i)=>{a.type="string";let{minimum:n,maximum:o,format:s,patterns:l,contentEncoding:c,laxFormat:u}=aR(t);if("number"==typeof n&&(a.minLength=n),"number"==typeof o&&(a.maxLength=o),s&&(a.format=aP[s]??s,""===a.format&&delete a.format,("time"===s||u)&&delete a.format),c&&(a.contentEncoding=c),l&&l.size>0){let t=[...l].map(aO);1===t.length?a.pattern=t[0].source:t.length>1&&(a.allOf=[...t.map(t=>({..."draft-07"===r.target||"draft-04"===r.target||"openapi-3.0"===r.target?{type:"string"}:{},pattern:t.source}))])}},aj=(t,r,a,i)=>{let{minimum:n,maximum:o,multipleOf:s,exclusiveMaximum:l,exclusiveMinimum:c,isInt:u}=aR(t);a.type=u?"integer":"number";let d="number"==typeof c&&c>=(n??-1/0),p="number"==typeof l&&l<=(o??1/0),m="draft-04"===r.target||"openapi-3.0"===r.target;if(d?m?(a.minimum=c,a.exclusiveMinimum=!0):a.exclusiveMinimum=c:"number"==typeof n&&(a.minimum=n),p?m?(a.maximum=l,a.exclusiveMaximum=!0):a.exclusiveMaximum=l:"number"==typeof o&&(a.maximum=o),s){let n=new Set;for(let o of s)Number.isFinite(o)&&0!==o?n.add(Math.abs(o)):an(t,r,a,i,`A multipleOf divisor of ${o} cannot be represented in JSON Schema`);let[o,...l]=n;void 0!==o&&(a.multipleOf=o),l.length&&(a.allOf=[...a.allOf??[],...l.map(t=>({multipleOf:t}))])}},aN=(t,r,a,i)=>{a.type="boolean"},aC=(t,r,a,i)=>{"openapi-3.0"===r.target?(a.type="string",a.nullable=!0,a.enum=[null]):a.type="null"},aI=(t,r,a,i)=>{a.not={}},aq=(t,r,a,i)=>{},az=(t,r,a,i)=>{},aA=(t,r,a,i)=>{let n=B(t._zod.def.entries);if(0===n.length){a.not={};return}n.every(t=>"number"==typeof t)&&(a.type="number"),n.every(t=>"string"==typeof t)&&(a.type="string"),a.enum=n},aM=(t,r,a,i)=>{let n=t._zod.def;if(0===n.values.length){a.not={};return}let o=[];for(let s of n.values)if(void 0===s){if(an(t,r,a,i,"Literal `undefined` cannot be represented in JSON Schema"))return}else if("bigint"==typeof s){if(an(t,r,a,i,"BigInt literals cannot be represented in JSON Schema"))return;o.push(Number(s))}else o.push(s);if(0===o.length);else if(1===o.length){let t=o[0];a.type=null===t?"null":typeof t,"draft-04"===r.target||"openapi-3.0"===r.target?a.enum=[t]:a.const=t}else o.every(t=>"number"==typeof t)&&(a.type="number"),o.every(t=>"string"==typeof t)&&(a.type="string"),o.every(t=>"boolean"==typeof t)&&(a.type="boolean"),o.every(t=>null===t)&&(a.type="null"),a.enum=o},aL=(t,r,a,i)=>{an(t,r,a,i,"Custom types cannot be represented in JSON Schema")},aD=(t,r,a,i)=>{an(t,r,a,i,"Transforms cannot be represented in JSON Schema")},aZ=(t,r,a,i)=>{let n=t._zod.def,{minimum:o,maximum:s}=aR(t);"number"==typeof o&&(a.minItems=o),"number"==typeof s&&(a.maxItems=s),a.type="array",a.items=ao(n.element,r,{...i,path:[...i.path,"items"]})};function aV(t){let r=t._zod.def;return"pipe"===r.type&&r.in._zod.traits.has("$ZodTransform")?aV(r.out):"catch"===r.type?aV(r.innerType):t._zod.optin}let aF=(t,r,a,i)=>{let n=t._zod.def,o=n.shape;if(Object.getOwnPropertySymbols(o).length&&an(t,r,a,i,"Symbol keys cannot be represented in JSON Schema"))return;for(let t in a.type="object",a.properties={},o)et(a.properties,t,ao(o[t],r,{...i,path:[...i.path,"properties",t]}));let s=[];for(let t of Object.keys(o)){let a=n.shape[t];("input"===r.io?void 0===aV(a):void 0===a._zod.optout)&&s.push(t)}s.length>0&&(a.required=s),n.catchall?._zod.def.type==="never"?a.additionalProperties=!1:n.catchall?n.catchall&&(a.additionalProperties=ao(n.catchall,r,{...i,path:[...i.path,"additionalProperties"]})):"output"===r.io&&(a.additionalProperties=!1)},aU=(t,r,a,i)=>{let n=t._zod.def,o=!1===n.inclusive,s=n.options.map((t,a)=>ao(t,r,{...i,path:[...i.path,o?"oneOf":"anyOf",a]}));o?a.oneOf=s:a.anyOf=s},aJ=(t,r,a,i)=>{let n=t._zod.def,o=ao(n.left,r,{...i,path:[...i.path,"allOf",0]}),s=ao(n.right,r,{...i,path:[...i.path,"allOf",1]}),l=t=>"allOf"in t&&1===Object.keys(t).length,c=[...l(o)?o.allOf:[o],...l(s)?s.allOf:[s]];a.allOf=c,r.intersections.push(c)},aH=new WeakMap,aK=(t,r,a,i)=>{let n=t._zod.def;a.type="object";let o=n.keyType,s=aR(o).patterns;if("loose"===n.mode&&s&&s.size>0){let t=ao(n.valueType,r,{...i,path:[...i.path,"patternProperties","*"]});for(let r of(a.patternProperties={},s))et(a.patternProperties,aO(r).source,t)}else{if("draft-07"===r.target||"draft-2020-12"===r.target){a.propertyNames=ao(n.keyType,r,{...i,path:[...i.path,"propertyNames"]});let o=aH.get(r);o||(o=[],aH.set(r,o),r.deferred.push(()=>(function(t){let r=new Map;for(let a of t.seen.values())a.def&&!r.has(a.schema)&&r.set(a.schema,a);let a=new Map;for(let i of aH.get(t)??[]){let n=t.seen.get(i),o=(n?.def??n?.schema)?.propertyNames;if(!o||!0===o||a.has(o))continue;let s=function t(r,a,i){if(a.$ref){if(i.has(a))return a;i.add(a);let n=r.get(a)?.def;if(!n)return a;let o=t(r,n,i);return o===n?a:o}for(let n of["anyOf","oneOf"]){let o=a[n];if(!Array.isArray(o))continue;let s=o.map(a=>t(r,a,i));s.some((t,r)=>t!==o[r])&&(a={...a,[n]:s})}let n=Array.isArray(a.type)?a.type:[a.type],o=!n.includes("string")&&n.some(t=>"number"===t||"integer"===t),s=a.enum??(void 0!==a.const?[a.const]:void 0);if(!o&&!s?.some(t=>"number"==typeof t))return a;let{minimum:l,maximum:c,exclusiveMinimum:u,exclusiveMaximum:d,multipleOf:p,format:m,id:h,...f}=a;return f.enum?f.enum=f.enum.map(t=>"number"==typeof t?String(t):t):"number"==typeof f.const&&(f.const=String(f.const)),o&&(f.type="string",s||(f.pattern=(n.includes("number")?td:tu).source)),f}(r,o,new Set);s!==o&&a.set(o,s)}if(a.size)for(let r of t.seen.values())for(let t of[r.schema,r.def]){let r=t&&a.get(t.propertyNames);r&&(t.propertyNames=r)}})(r))),o.push(t)}a.additionalProperties=ao(n.valueType,r,{...i,path:[...i.path,"additionalProperties"]})}let l=o._zod.values,c="input"===r.io&&void 0!==aV(n.valueType);if(l&&!n.partial&&!c){let t=[...l].filter(t=>"string"==typeof t||"number"==typeof t);t.length>0&&(a.required=t.map(String))}},aB=(t,r,a,i)=>{let n=t._zod.def,o=ao(n.innerType,r,i),s=r.seen.get(t);"openapi-3.0"===r.target?(s.ref=n.innerType,a.nullable=!0):a.anyOf=[o,{type:"null"}]},aW=(t,r,a,i)=>{let n=t._zod.def;ao(n.innerType,r,i),r.seen.get(t).ref=n.innerType},aG=Symbol();function aY(t,r,a,i,n){let o=!1,s=JSON.stringify(t,(t,r)=>"bigint"!=typeof r?r:(o=!0,null));return o?(an(r,a,i,n,"BigInt defaults cannot be represented in JSON Schema"),aG):JSON.parse(s)}let aX=(t,r,a,i)=>{let n=t._zod.def;ao(n.innerType,r,i),r.seen.get(t).ref=n.innerType;let o=aY(n.defaultValue,t,r,a,i);o!==aG&&(a.default=o)},aQ=(t,r,a,i)=>{let n=t._zod.def;if(ao(n.innerType,r,i),r.seen.get(t).ref=n.innerType,"input"!==r.io)return;let o=aY(n.defaultValue,t,r,a,i);o!==aG&&(a._prefault=o)},a0=(t,r,a,i)=>{let n,o=t._zod.def;ao(o.innerType,r,i),r.seen.get(t).ref=o.innerType;try{n=o.catchValue(void 0)}catch{an(t,r,a,i,"Dynamic catch values are not supported in JSON Schema");return}a.default=n},a1=(t,r,a,i)=>{let n=t._zod.def,o=n.in._zod.traits.has("$ZodTransform"),s="input"===r.io?o?n.out:n.in:n.out;ao(s,r,i),r.seen.get(t).ref=s},a2=(t,r,a,i)=>{let n=t._zod.def;ao(n.innerType,r,i),r.seen.get(t).ref=n.innerType,a.readOnly=!0},a9=(t,r,a,i)=>{let n=t._zod.def;ao(n.innerType,r,i),r.seen.get(t).ref=n.innerType},a4=(t,r,a,i)=>{let n=t._zod.innerType;ao(n,r,i),r.seen.get(t).ref=n},a6={string:aT,number:aj,boolean:aN,bigint:(t,r,a,i)=>{an(t,r,a,i,"BigInt cannot be represented in JSON Schema")},symbol:(t,r,a,i)=>{an(t,r,a,i,"Symbols cannot be represented in JSON Schema")},null:aC,undefined:(t,r,a,i)=>{an(t,r,a,i,"Undefined cannot be represented in JSON Schema")},void:(t,r,a,i)=>{an(t,r,a,i,"Void cannot be represented in JSON Schema")},never:aI,any:aq,unknown:az,date:(t,r,a,i)=>{an(t,r,a,i,"Date cannot be represented in JSON Schema")},enum:aA,literal:aM,nan:(t,r,a,i)=>{an(t,r,a,i,"NaN cannot be represented in JSON Schema")},template_literal:(t,r,a,i)=>{let n=t._zod.pattern;if(!n)throw Error("Pattern not found in template literal");a.type="string",a.pattern=n.source},file:(t,r,a,i)=>{a.type="string",a.format="binary",a.contentEncoding="binary";let{minimum:n,maximum:o,mime:s}=aR(t);void 0!==n&&(a.minLength=n),void 0!==o&&(a.maxLength=o),s&&(0===s.length?a.not={}:1===s.length?a.contentMediaType=s[0]:a.anyOf=s.map(t=>({contentMediaType:t})))},success:(t,r,a,i)=>{a.type="boolean"},custom:aL,function:(t,r,a,i)=>{an(t,r,a,i,"Function types cannot be represented in JSON Schema")},transform:aD,map:(t,r,a,i)=>{an(t,r,a,i,"Map cannot be represented in JSON Schema")},set:(t,r,a,i)=>{an(t,r,a,i,"Set cannot be represented in JSON Schema")},array:aZ,object:aF,union:aU,intersection:aJ,tuple:(t,r,a,i)=>{let n=t._zod.def;a.type="array";let o="draft-2020-12"===r.target?"prefixItems":"items",s="draft-2020-12"===r.target||"openapi-3.0"===r.target?"items":"additionalItems",l=n.items.map((t,a)=>ao(t,r,{...i,path:[...i.path,o,a]})),c=n.rest?ao(n.rest,r,{...i,path:[...i.path,s,..."openapi-3.0"===r.target?[n.items.length]:[]]}):null,u=n.items.length;for(;u>0;){let t=n.items[u-1];if(!("input"===r.io?void 0!==aV(t):"optional"===t._zod.optout))break;u--}let d=n.items.length,p=!n.rest;"draft-2020-12"===r.target?(a.prefixItems=l,p?a.items=!1:c&&(a.items=c)):"openapi-3.0"===r.target?(a.items={anyOf:l},c&&a.items.anyOf.push(c)):(a.items=l,p?a.additionalItems=!1:c&&(a.additionalItems=c)),u>0&&(a.minItems=u),p&&(a.maxItems=d);let{minimum:m,maximum:h}=aR(t);"number"==typeof m&&(a.minItems=m),"number"==typeof h&&(a.maxItems=h)},record:aK,nullable:aB,nonoptional:aW,default:aX,prefault:aQ,catch:a0,pipe:a1,readonly:a2,promise:(t,r,a,i)=>{let n=t._zod.def;ao(n.innerType,r,i),r.seen.get(t).ref=n.innerType},optional:a9,lazy:a4};function a3(t,r){if("_idmap"in t){let a=ai({...r,processors:a6}),i={};for(let r of t._idmap.entries()){let[t,i]=r;ao(i,a)}let n={};for(let o of(a.external={registry:t,uri:r?.uri,defs:i},t._idmap.entries())){let[t,r]=o;al(a,r),et(n,t,am(a,r))}return Object.keys(i).length>0&&(n.__shared={["draft-2020-12"===a.target?"$defs":"definitions"]:i}),{schemas:n}}let a=ai({...r,processors:a6});return ao(t,a),al(a,t),am(a,t)}let a5={get:function(){let t=this._zod;return t.message??(t.message=JSON.stringify(t.def,G,2)),t.message},set:function(t){this._zod.message=t},enumerable:!0,configurable:!0},a8={value:void 0,enumerable:!1},a7=new WeakSet([Object.prototype,Error.prototype]),ie=(t,r)=>{t.name="$ZodError",a8.value=r,Object.defineProperty(t,"issues",a8),a8.value=void 0,Object.defineProperty(t,"message",a5);let a=Object.getPrototypeOf(t);a7.has(a)||(a7.add(a),Object.defineProperty(a,"toString",{configurable:!0,enumerable:!1,get(){let t=()=>this.message;return Object.defineProperty(this,"toString",{value:t,configurable:!0,writable:!0}),t},set(t){Object.defineProperty(this,"toString",{value:t,configurable:!0,writable:!0})}}))},it=eD("$ZodError",ie);function ir(t,r){return{callee:r?.callee??t,Err:r?.Err}}eD("$ZodError",ie,void 0,{Parent:Error});let ia=t=>{let r=(a,i,n,o)=>{let s=n?{...n,async:!1}:{async:!1},l=a._zod.run({value:i,issues:[]},s);if(l instanceof Promise)throw new eZ;if(l.issues.length){let a=new(o?.Err??t)(l.issues.map(t=>eP(t,s,eU())));throw el(a,o?.callee??r),a}return l.value};return r},ii=t=>{let r=async(a,i,n,o)=>{let s=n?{...n,async:!0}:{async:!0},l=a._zod.run({value:i,issues:[]},s);if(l instanceof Promise&&(l=await l),l.issues.length){let a=new(o?.Err??t)(l.issues.map(t=>eP(t,s,eU())));throw el(a,o?.callee??r),a}return l.value};return r},io=t=>(r,a,i)=>{let n=i?{...i,async:!1}:{async:!1},o=r._zod.run({value:a,issues:[]},n);if(o instanceof Promise)throw new eZ;return o.issues.length?is(t,o.issues,n):{success:!0,data:o.value}};function is(t,r,a){let i;return{success:!1,get error(){return i||(i=new t(r.map(t=>eP(t,a,eU()))),r=void 0,a=void 0),i},set error(e){i=e,r=void 0,a=void 0}}}let il=t=>async(r,a,i)=>{let n=i?{...i,async:!0}:{async:!0},o=r._zod.run({value:a,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length?is(t,o.issues,n):{success:!0,data:o.value}},ic=Symbol.for("zod.compile.invalid"),iu=Symbol.for("zod.compile.fallback"),id=async(t,r,a)=>{let i=a?{...a,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},n=t._zod.run({value:r,issues:[]},i);return n instanceof Promise&&(n=await n),0===n.issues.length},ip=new WeakSet([Object.prototype,Error.prototype]);function im(t,r,a){Object.defineProperty(t,r,{configurable:!0,enumerable:!1,get(){let t=a(this);return Object.defineProperty(this,r,{value:t,configurable:!0,writable:!0}),t},set(t){Object.defineProperty(this,r,{value:t,configurable:!0,writable:!0})}})}let ih=eD("ZodError",(t,r)=>{it.init(t,r),t.name="ZodError";let a=Object.getPrototypeOf(t);ip.has(a)||(ip.add(a),im(a,"format",t=>r=>(function(t,r=t=>t.message){let a={_errors:[]},i=(t,n=[])=>{for(let o of t.issues)if("invalid_union"===o.code&&o.errors.length)o.errors.map(t=>i({issues:t},[...n,...o.path]));else if("invalid_key"===o.code)i({issues:o.issues},[...n,...o.path]);else if("invalid_element"===o.code)i({issues:o.issues},[...n,...o.path]);else{let t=[...n,...o.path];if(0===t.length)a._errors.push(r(o));else{let i=a,n=0;for(;n<t.length;){let a=t[n],s=n===t.length-1;if("_errors"===a){s&&i._errors.push(r(o)),n++;continue}Object.prototype.hasOwnProperty.call(i,a)||Object.defineProperty(i,a,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let l=i[a];s&&l._errors.push(r(o)),i=l,n++}}}};return i(t),a})(t,r)),im(a,"flatten",t=>r=>(function(t,r=t=>t.message){let a={},i=[];for(let s of t.issues)if(s.path.length>0){var n,o;(n=s.path[0],o=()=>[],!Object.prototype.hasOwnProperty.call(a,n)&&("__proto__"===n?Object.defineProperty(a,n,{value:o(),writable:!0,enumerable:!0,configurable:!0}):a[n]=o()),a[n]).push(r(s))}else i.push(r(s));return{formErrors:i,fieldErrors:a}})(t,r)),im(a,"addIssue",t=>r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,G,2)}),im(a,"addIssues",t=>r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,G,2)}),Object.defineProperty(a,"isEmpty",{configurable:!0,enumerable:!1,get(){return 0===this.issues.length}}))},void 0,{Parent:Error}),iy=ia(ih),ig=ii(ih),iv=io(ih),i_=il(ih),ib=(m=ia(ih),h=(t,r,a,i)=>m(t,r,a?{...a,direction:"backward"}:{direction:"backward"},ir(h,i))),iS=(f=ia(ih),y=(t,r,a,i)=>f(t,r,a,ir(y,i))),i$=(g=ii(ih),v=async(t,r,a,i)=>{let n=a?{...a,direction:"backward"}:{direction:"backward"};return await g(t,r,n,ir(v,i))}),iw=(_=ii(ih),b=async(t,r,a,i)=>await _(t,r,a,ir(b,i))),ik=(t,r,a)=>{let i=a?{...a,direction:"backward"}:{direction:"backward"};return io(ih)(t,r,i)},ix=(t,r,a)=>io(ih)(t,r,a),iR=async(t,r,a)=>{let i=a?{...a,direction:"backward"}:{direction:"backward"};return il(ih)(t,r,i)},iP=async(t,r,a)=>il(ih)(t,r,a);function iE(){eF.memoizer||eU({memoizer:eX})}let iO=eD("ZodType",(t,r)=>(eF.localeError||eU({localeError:(()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}},r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},a={nan:"NaN"};function i(t,r){return"number"!==t||"number"!=typeof r||Number.isFinite(r)?a[t]??t:String(r)}return a=>{switch(a.code){case"invalid_type":{let t=i(a.expected),r=i(function(t){let r=typeof t;switch(r){case"number":return Number.isNaN(t)?"nan":"number";case"object":if(null===t)return"null";if(Array.isArray(t))return"array";if(t&&Object.getPrototypeOf(t)!==Object.prototype&&"constructor"in t&&t.constructor)return t.constructor.name}return r}(a.input),a.input);return`Invalid input: expected ${t}, received ${r}`}case"invalid_value":if(1===a.values.length)return`Invalid input: expected ${eg(a.values[0])}`;return`Invalid option: expected one of ${W(a.values,"|")}`;case"too_big":{let r=a.exact?"exactly ":a.inclusive?"<=":"<",i=t[a.origin]??null;if(i)return`Too big: expected ${a.origin??"value"} to have ${r}${a.maximum.toString()} ${i.unit??"elements"}`;return`Too big: expected ${a.origin??"value"} to be ${r}${a.maximum.toString()}`}case"too_small":{let r=a.exact?"exactly ":a.inclusive?">=":">",i=t[a.origin]??null;if(i)return`Too small: expected ${a.origin} to have ${r}${a.minimum.toString()} ${i.unit}`;return`Too small: expected ${a.origin} to be ${r}${a.minimum.toString()}`}case"invalid_format":if("starts_with"===a.format)return`Invalid string: must start with "${a.prefix}"`;if("ends_with"===a.format)return`Invalid string: must end with "${a.suffix}"`;if("includes"===a.format)return`Invalid string: must include "${a.includes}"`;if("regex"===a.format)return`Invalid string: must match pattern ${a.pattern}`;return`Invalid ${r[a.format]??a.format}`;case"not_multiple_of":return`Invalid number: must be a multiple of ${a.divisor}`;case"unrecognized_keys":return`Unrecognized key${a.keys.length>1?"s":""}: ${W(a.keys,", ")}`;case"invalid_key":return`Invalid key in ${a.origin}`;case"invalid_union":if(a.options&&Array.isArray(a.options)&&a.options.length>0){let t=a.options.map(t=>`'${t}'`).join(" | ");return`Invalid discriminator value. Expected ${t}`}if(!1===a.inclusive)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${a.origin}`;default:return"Invalid input"}}})()}),tz.init(t,r),t.def=r,t.type=r.type,t),{check(...t){let r=this.def;return this.clone(es(r,{checks:[...r.checks??[],...t.map(t=>"function"==typeof t?{_zod:{check:t,def:{check:"custom"},onattach:[]}}:t)]}),{parent:!0})},with(...t){return this.check(...t)},clone(t,r){return ef(this,t,r)},brand(){return this},register(t,r){return t.add(this,r),this},refine(t,r){return this.check(function(t,r={}){return new nL({type:"custom",check:"custom",fn:t,...ey(r)})}(t,r))},superRefine(t,r){return this.check(function(t,r){var a;let i,n;return a=r=>(r.addIssue=t=>{"string"==typeof t?r.issues.push(ej(t,r.value,i._zod.def)):(t.fatal&&(t.continue=!1),t.code??(t.code="custom"),"input"in t||(t.input=r.value),t.inst??(t.inst=i),t.continue??(t.continue=!i._zod.def.abort),r.issues.push(ej(t)))},t(r.value,r)),(n=new ty({check:"custom",...ey(r)}))._zod.check=a,i=n}(t,r))},overwrite(t){return this.check(ar(t))},optional(){return nx(this)},exactOptional(){var t;return t=this,new nR({type:"optional",innerType:t})},nullable(){return nE(this)},nullish(){return nx(nE(this))},nonoptional(t){var r;return r=this,new nj({type:"nonoptional",innerType:r,...ey(t)})},array(){return no(this)},or(t){return nd([this,t])},and(t){return nf(this,t)},transform(t){return nI(this,nw(t))},default(t){var r,a;return r=this,a=t,new nO({type:"default",innerType:r,get defaultValue(){return"function"==typeof a?a():ep(a)}})},prefault(t){var r,a;return r=this,a=t,new nT({type:"prefault",innerType:r,get defaultValue(){return"function"==typeof a?a():ep(a)}})},catch(t){return function(t,r){let a;return new nN({type:"catch",innerType:t,catchValue:"function"==typeof r?r:((a=()=>r)["~constantCatch"]=!0,a)})}(this,t)},pipe(t){return nI(this,t)},readonly(){var t;return t=this,new nz({type:"readonly",innerType:t})},describe(t){let r=this.clone();return rX.add(r,{description:t}),r},meta(...t){if(0===t.length)return rX.get(this);let r=this.clone();return rX.add(r,t[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(t,...r){return 0===r.length?t(this):t(this,...r)},get"~standard"(){return eN(this,"~standard",{...tL(this),jsonSchema:{input:ah(this,"input"),output:ah(this,"output")}},!1)},set"~standard"(value){eN(this,"~standard",value)},parse:function t(r,a){return iy(this,r,a,{callee:t})},parseAsync:async function t(r,a){return await ig(this,r,a,{callee:t})},safeParse(t,r){return iv(this,t,r)},async safeParseAsync(t,r){return i_(this,t,r)},get spa(){return this?.safeParseAsync},set spa(value){eN(this,"spa",value)},validate(t,r){let a=this._zod.bag.validator;if(void 0!==a){if(a(t)!==ic)return!0;if(!0===a.definite&&void 0===r)return!1}return function(t,r,a){let i,n=a?{...a,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=t._zod.bag.fallbackRun;if(o?(n[iu]=!0,i=o({value:r,issues:[]},n)):i=t._zod.run({value:r,issues:[]},n),i instanceof Promise)throw new eZ;return 0===i.issues.length}(this,t,r)},validateAsync(t,r){return id(this,t,r)},encode:function t(r,a){return ib(this,r,a,{callee:t})},decode:function t(r,a){return iS(this,r,a,{callee:t})},encodeAsync:async function t(r,a){return await i$(this,r,a,{callee:t})},decodeAsync:async function t(r,a){return await iw(this,r,a,{callee:t})},safeEncode(t,r){return ik(this,t,r)},safeDecode(t,r){return ix(this,t,r)},async safeEncodeAsync(t,r){return iR(this,t,r)},async safeDecodeAsync(t,r){return iP(this,t,r)},toJSONSchema(t){return((t,r={})=>a=>{let i=ai({...a,processors:r});return ao(t,i),al(i,t),am(i,t)})(this,{})(t)},get description(){return rX.get(this)?.description},get _def(){return this._zod.def}}),iT=eD("_ZodString",(t,r)=>{tD.init(t,r),iO.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aT(t,r,a,i)},eC({format:t=>aR(t).format??null,minLength:t=>aR(t).minimum??null,maxLength:t=>aR(t).maximum??null},{regex(...t){return this.check(function(t,r){return new tP({check:"string_format",format:"regex",...ey(r),pattern:t})}(...t))},includes(...t){return this.check(function(t,r){return new tT({check:"string_format",format:"includes",...ey(r),includes:t})}(...t))},startsWith(...t){return this.check(function(t,r){return new tj({check:"string_format",format:"starts_with",...ey(r),prefix:t})}(...t))},endsWith(...t){return this.check(function(t,r){return new tN({check:"string_format",format:"ends_with",...ey(r),suffix:t})}(...t))},min(...t){return this.check(ae(...t))},max(...t){return this.check(r7(...t))},length(...t){return this.check(at(...t))},nonempty(...t){return this.check(ae(1,...t))},lowercase(t){return this.check(new tE({check:"string_format",format:"lowercase",...ey(t)}))},uppercase(t){return this.check(new tO({check:"string_format",format:"uppercase",...ey(t)}))},trim(){return this.check(ar(t=>t.trim()))},normalize(...t){return this.check(function(t){return ar(r=>r.normalize(t))}(...t))},toLowerCase(){return this.check(ar(t=>t.toLowerCase()))},toUpperCase(){return this.check(ar(t=>t.toUpperCase()))},slugify(){return this.check(ar(t=>t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")))}})),ij=eD("ZodString",(t,r)=>{tD.init(t,r),iT.init(t,r)},{email(t){return this.check(r0(iM,t))},url(t){return this.check(r1(iZ,t))},jwt(t){return this.check(new i2({type:"string",format:"jwt",check:"string_format",abort:!1,...ey(t)}))},emoji(t){return this.check(new iV({type:"string",format:"emoji",check:"string_format",abort:!1,...ey(t)}))},guid(t){return this.check(new iL({type:"string",format:"guid",check:"string_format",abort:!1,...ey(t)}))},uuid(t){return this.check(new iD({type:"string",format:"uuid",check:"string_format",abort:!1,...ey(t)}))},uuidv4(t){return this.check(new iD({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ey(t)}))},uuidv6(t){return this.check(new iD({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ey(t)}))},uuidv7(t){return this.check(new iD({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ey(t)}))},nanoid(t){return this.check(new iF({type:"string",format:"nanoid",check:"string_format",abort:!1,...ey(t)}))},cuid(t){return this.check(new iU({type:"string",format:"cuid",check:"string_format",abort:!1,...ey(t)}))},cuid2(t){return this.check(new iJ({type:"string",format:"cuid2",check:"string_format",abort:!1,...ey(t)}))},ulid(t){return this.check(new iH({type:"string",format:"ulid",check:"string_format",abort:!1,...ey(t)}))},base64(t){return this.check(new iQ({type:"string",format:"base64",check:"string_format",abort:!1,...ey(t)}))},base64url(t){return this.check(new i0({type:"string",format:"base64url",check:"string_format",abort:!1,...ey(t)}))},xid(t){return this.check(new iK({type:"string",format:"xid",check:"string_format",abort:!1,...ey(t)}))},ksuid(t){return this.check(new iB({type:"string",format:"ksuid",check:"string_format",abort:!1,...ey(t)}))},ipv4(t){return this.check(new iW({type:"string",format:"ipv4",check:"string_format",abort:!1,...ey(t)}))},ipv6(t){return this.check(new iG({type:"string",format:"ipv6",check:"string_format",abort:!1,...ey(t)}))},cidrv4(t){return this.check(new iY({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ey(t)}))},cidrv6(t){return this.check(new iX({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ey(t)}))},e164(t){return this.check(new i1({type:"string",format:"e164",check:"string_format",abort:!1,...ey(t)}))},datetime(t){return this.check(r2(iI,t))},date(t){return this.check(r9(iq,t))},time(t){return this.check(new iz({type:"string",format:"time",check:"string_format",precision:null,...ey(t)}))},duration(t){return this.check(new iA({type:"string",format:"duration",check:"string_format",...ey(t)}))}});function iN(t){return new ij(rQ({type:"string",...ey(t)}))}let iC=eD("ZodStringFormat",(t,r)=>{tZ.init(t,r),iT.init(t,r)}),iI=eD("ZodISODateTime",(t,r)=>{t2.init(t,r),iC.init(t,r)}),iq=eD("ZodISODate",(t,r)=>{t9.init(t,r),iC.init(t,r)}),iz=eD("ZodISOTime",(t,r)=>{t4.init(t,r),iC.init(t,r)}),iA=eD("ZodISODuration",(t,r)=>{t6.init(t,r),iC.init(t,r)}),iM=eD("ZodEmail",(t,r)=>{tU.init(t,r),iC.init(t,r)}),iL=eD("ZodGUID",(t,r)=>{tV.init(t,r),iC.init(t,r)}),iD=eD("ZodUUID",(t,r)=>{tF.init(t,r),iC.init(t,r)}),iZ=eD("ZodURL",(t,r)=>{tB.init(t,r),iC.init(t,r)}),iV=eD("ZodEmoji",(t,r)=>{tW.init(t,r),iC.init(t,r)}),iF=eD("ZodNanoID",(t,r)=>{tG.init(t,r),iC.init(t,r)}),iU=eD("ZodCUID",(t,r)=>{tY.init(t,r),iC.init(t,r)}),iJ=eD("ZodCUID2",(t,r)=>{tX.init(t,r),iC.init(t,r)}),iH=eD("ZodULID",(t,r)=>{tQ.init(t,r),iC.init(t,r)}),iK=eD("ZodXID",(t,r)=>{t0.init(t,r),iC.init(t,r)}),iB=eD("ZodKSUID",(t,r)=>{t1.init(t,r),iC.init(t,r)}),iW=eD("ZodIPv4",(t,r)=>{t3.init(t,r),iC.init(t,r)}),iG=eD("ZodIPv6",(t,r)=>{t7.init(t,r),iC.init(t,r)}),iY=eD("ZodCIDRv4",(t,r)=>{re.init(t,r),iC.init(t,r)}),iX=eD("ZodCIDRv6",(t,r)=>{rt.init(t,r),iC.init(t,r)}),iQ=eD("ZodBase64",(t,r)=>{ri.init(t,r),iC.init(t,r)}),i0=eD("ZodBase64URL",(t,r)=>{ro.init(t,r),iC.init(t,r)}),i1=eD("ZodE164",(t,r)=>{rs.init(t,r),iC.init(t,r)}),i2=eD("ZodJWT",(t,r)=>{rl.init(t,r),iC.init(t,r)}),i9=eD("ZodNumber",(t,r)=>{rc.init(t,r),iO.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aj(t,r,a,i),t.isFinite=!0},eC({minValue:t=>{let{minimum:r,exclusiveMinimum:a}=aR(t);return Math.max(r??-1/0,a??-1/0)},maxValue:t=>{let{maximum:r,exclusiveMaximum:a}=aR(t);return Math.min(r??1/0,a??1/0)},isInt:t=>{let{isInt:r,multipleOf:a}=aR(t);return!!r||!!a?.some(Number.isSafeInteger)},format:t=>aR(t).format??null},{gt(t,r){return this.check(r3(t,r))},gte(t,r){return this.check(r5(t,r))},min(t,r){return this.check(r5(t,r))},lt(t,r){return this.check(r4(t,r))},lte(t,r){return this.check(r6(t,r))},max(t,r){return this.check(r6(t,r))},int(t){return this.check(i3(t))},safe(t){return this.check(i3(t))},positive(t){return this.check(r3(0,t))},nonnegative(t){return this.check(r5(0,t))},negative(t){return this.check(r4(0,t))},nonpositive(t){return this.check(r6(0,t))},multipleOf(t,r){return this.check(r8(t,r))},step(t,r){return this.check(r8(t,r))},finite(){return this}}));function i4(t){return new i9(rQ({type:"number",checks:[],...ey(t)}))}let i6=eD("ZodNumberFormat",(t,r)=>{ru.init(t,r),i9.init(t,r)});function i3(t){return new i6({type:"number",check:"number_format",abort:!1,format:"safeint",...ey(t)})}let i5=eD("ZodBoolean",(t,r)=>{rd.init(t,r),iO.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aN(t,r,a,i)});function i8(t){return new i5({type:"boolean",...ey(t)})}let i7=eD("ZodNull",(t,r)=>{rp.init(t,r),iO.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aC(t,r,a,i)});function ne(t){return new i7({type:"null",...ey(t)})}let nt=eD("ZodAny",(t,r)=>{rm.init(t,r),iO.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aq(t,r,a,i)}),nr=eD("ZodUnknown",(t,r)=>{rh.init(t,r),iO.init(t,r),t._zod.processJSONSchema=(r,a,i)=>az(t,r,a,i)});function na(){return new nr({type:"unknown"})}let ni=eD("ZodNever",(t,r)=>{rf.init(t,r),iO.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aI(t,r,a,i)}),nn=eD("ZodArray",(t,r)=>{iE(),rg.init(t,r),iO.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aZ(t,r,a,i),t.element=r.element},{min(t,r){return this.check(ae(t,r))},nonempty(t){return this.check(ae(1,t))},max(t,r){return this.check(r7(t,r))},length(t,r){return this.check(at(t,r))},unwrap(){return this.element}});function no(t,r){return new nn({type:"array",element:t,...ey(r)})}let ns=eD("ZodObject",(t,r)=>{var a;let i,n;iE(),rw.init(t,r),iO.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aF(t,r,a,i),a="shape",(n=a in(i=Object.getPrototypeOf(t))?void 0:i)&&Object.defineProperty(n,a,{configurable:!0,get(){let t={configurable:!0,writable:!0,enumerable:!1,value:void 0};return Object.defineProperty(this,a,t),t.value=(t=>t._zod.def.shape)(this),Object.defineProperty(this,a,t),t.value},set(t){Object.defineProperty(this,a,{configurable:!0,writable:!0,enumerable:!1,value:t})}})},{keyof(){return n_(Object.keys(this._zod.def.shape))},catchall(t){return this.clone(es(this._zod.def,{catchall:t}))},passthrough(){return this.clone(es(this._zod.def,{catchall:na()}))},loose(){return this.clone(es(this._zod.def,{catchall:na()}))},strict(){return this.clone(es(this._zod.def,{catchall:new ni({type:"never",...ey(void 0)})}))},strip(){return this.clone(es(this._zod.def,{catchall:void 0}))},extend(t){if(!ed(t))throw Error("Invalid input to extend: expected a plain object");let r=this._zod.def.checks;if(r&&r.length>0){let r=ea(this);for(let a of Reflect.ownKeys(t))if(void 0!==Object.getOwnPropertyDescriptor(r,a))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ef(this,es(this._zod.def,{shape:eS(this,t)}))},safeExtend(t){if(!ed(t))throw Error("Invalid input to safeExtend: expected a plain object");return ef(this,es(this._zod.def,{shape:eS(this,t)}))},merge(t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(this._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};return eo(r,this,Reflect.ownKeys(ea(this))),eo(r,t,Reflect.ownKeys(ea(t))),ef(this,es(this._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))},pick(t){return function(t,r){let a=t._zod.def,i=a.checks;if(i&&i.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let n={};return eo(n,t,eb(t,r)),ef(t,es(a,{shape:n,checks:[]}))}(this,t)},omit(t){return function(t,r){let a=t._zod.def,i=a.checks;if(i&&i.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let n=new Set(eb(t,r)),o={};return eo(o,t,Reflect.ownKeys(ea(t)).filter(t=>!n.has(t))),ef(t,es(a,{shape:o,checks:[]}))}(this,t)},partial(...t){return e$(nk,this,t[0])},exactPartial(...t){return e$(nR,this,t[0],"exactPartial")},required(...t){var r;let a,i;return a=(r=t[0])?new Set(eb(this,r)):void 0,eo(i={},this,Reflect.ownKeys(ea(this)),(t,r)=>a&&!a.has(r)?t:new nj({type:"nonoptional",innerType:t})),ef(this,es(this._zod.def,{shape:i}))}});function nl(t,r){return new ns({type:"object",shape:t??{},...ey(r)})}function nc(t,r){return new ns({type:"object",shape:t,catchall:na(),...ey(r)})}let nu=eD("ZodUnion",(t,r)=>{rx.init(t,r),iO.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aU(t,r,a,i),t.options=r.options});function nd(t,r){return new nu({type:"union",options:t,...ey(r)})}let np=eD("ZodDiscriminatedUnion",(t,r)=>{nu.init(t,r),rR.init(t,r)});function nm(t,r,a){return new np({type:"union",options:r,discriminator:t,...ey(a)})}let nh=eD("ZodIntersection",(t,r)=>{rP.init(t,r),iO.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aJ(t,r,a,i)});function nf(t,r){return new nh({type:"intersection",left:t,right:r})}let ny=eD("ZodRecord",(t,r)=>{iE(),rO.init(t,r),iO.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aK(t,r,a,i),t.keyType=r.keyType,t.valueType=r.valueType});function ng(t,r,a){return new ny(r&&r._zod?{type:"record",keyType:t,valueType:r,...ey(a)}:{type:"record",keyType:iN(),valueType:t,...ey(r)})}let nv=eD("ZodEnum",(t,r)=>{rT.init(t,r),iO.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aA(t,r,a,i),t.enum=r.entries,t.options=[...t._zod.values];let a=new Set(Object.keys(r.entries));t.extract=(t,i)=>{let n={};for(let i of t)if(a.has(i))n[i]=r.entries[i];else throw Error(`Key ${i} not found in enum`);return new nv({...r,checks:[],...ey(i),entries:n})},t.exclude=(t,i)=>{let n={...r.entries};for(let r of t)if(a.has(r))delete n[r];else throw Error(`Key ${r} not found in enum`);return new nv({...r,checks:[],...ey(i),entries:n})}});function n_(t,r){return new nv({type:"enum",entries:Array.isArray(t)?Object.fromEntries(t.map(t=>[t,t])):t,...ey(r)})}let nb=eD("ZodLiteral",(t,r)=>{rj.init(t,r),iO.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aM(t,r,a,i),t.values=new Set(r.values),Object.defineProperty(t,"value",{get(){if(r.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return r.values[0]}})});function nS(t,r){return new nb({type:"literal",values:Array.isArray(t)?t:[t],...ey(r)})}let n$=eD("ZodTransform",(t,r)=>{iE(),rN.init(t,r),iO.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aD(t,r,a,i),t._zod.parse=(a,i)=>{if("backward"===i.direction)throw new eV(t.constructor.name);a.addIssue=i=>{"string"==typeof i?a.issues.push(ej(i,a.value,r)):(i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=a.value),i.inst??(i.inst=t),a.issues.push(ej(i)))};let n=r.transform(a.value,a);return n instanceof Promise?n.then(t=>(a.value=t,a)):(a.value=n,a)}});function nw(t){return new n$({type:"transform",transform:t})}let nk=eD("ZodOptional",(t,r)=>{rI.init(t,r),iO.init(t,r),t._zod.processJSONSchema=(r,a,i)=>a9(t,r,a,i),t.unwrap=()=>t._zod.def.innerType});function nx(t){return new nk({type:"optional",innerType:t})}let nR=eD("ZodExactOptional",(t,r)=>{rq.init(t,r),iO.init(t,r),t._zod.processJSONSchema=(r,a,i)=>a9(t,r,a,i),t.unwrap=()=>t._zod.def.innerType}),nP=eD("ZodNullable",(t,r)=>{rz.init(t,r),iO.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aB(t,r,a,i),t.unwrap=()=>t._zod.def.innerType});function nE(t){return new nP({type:"nullable",innerType:t})}let nO=eD("ZodDefault",(t,r)=>{rA.init(t,r),iO.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aX(t,r,a,i),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap}),nT=eD("ZodPrefault",(t,r)=>{rL.init(t,r),iO.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aQ(t,r,a,i),t.unwrap=()=>t._zod.def.innerType}),nj=eD("ZodNonOptional",(t,r)=>{rD.init(t,r),iO.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aW(t,r,a,i),t.unwrap=()=>t._zod.def.innerType}),nN=eD("ZodCatch",(t,r)=>{rF.init(t,r),iO.init(t,r),t._zod.processJSONSchema=(r,a,i)=>a0(t,r,a,i),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap}),nC=eD("ZodPipe",(t,r)=>{rU.init(t,r),iO.init(t,r),t._zod.processJSONSchema=(r,a,i)=>a1(t,r,a,i),t.in=r.in,t.out=r.out});function nI(t,r){return new nC({type:"pipe",in:t,out:r})}let nq=eD("ZodPreprocess",(t,r)=>{nC.init(t,r),rH.init(t,r)}),nz=eD("ZodReadonly",(t,r)=>{rK.init(t,r),iO.init(t,r),t._zod.processJSONSchema=(r,a,i)=>a2(t,r,a,i),t.unwrap=()=>t._zod.def.innerType}),nA=eD("ZodLazy",(t,r)=>{rW.init(t,r),iO.init(t,r),t._zod.processJSONSchema=(r,a,i)=>a4(t,r,a,i),t.unwrap=()=>t._zod.def.getter()});function nM(t){return new nA({type:"lazy",getter:t})}let nL=eD("ZodCustom",(t,r)=>{rG.init(t,r),iO.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aL(t,r,a,i)});function nD(t,r){return new nq({type:"pipe",in:nw(t),out:r})}j||(j={});let nZ="2025-11-25",nV=[nZ,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],nF="io.modelcontextprotocol/protocolVersion",nU="io.modelcontextprotocol/clientInfo",nJ="io.modelcontextprotocol/serverInfo",nH="io.modelcontextprotocol/clientCapabilities",nK="io.modelcontextprotocol/subscriptionId",nB="io.modelcontextprotocol/logLevel",nW=nM(()=>nd([iN(),i4(),i8(),ne(),ng(iN(),nW),no(nW)])),nG=ng(iN(),nW),nY=no(nW),nX=nd([iN(),i4().int()]),nQ=iN(),n0=nl({ttl:i4().optional()}),n1=nl({taskId:iN()}),n2=nc({progressToken:nX.optional(),"io.modelcontextprotocol/related-task":n1.optional()}),n9=nl({_meta:n2.optional()}),n4=n9.extend({task:n0.optional()}),n6=nl({method:iN(),params:n9.loose().optional()}),n3=nl({_meta:n2.optional()}),n5=nl({method:iN(),params:n3.loose().optional()}),n8=nc({get[nJ](){return om.optional().catch(void 0)}}),n7=nc({_meta:n8.optional()}),oe=nd([iN(),i4().int()]),ot=nl({jsonrpc:nS("2.0"),id:oe,...n6.shape}).strict(),or=nl({jsonrpc:nS("2.0"),...n5.shape}).strict(),oa=nl({jsonrpc:nS("2.0"),id:oe,result:n7}).strict(),oi=nl({jsonrpc:nS("2.0"),id:oe.optional(),error:nl({code:i4().int(),message:iN(),data:na().optional()})}).strict(),on=nd([ot,or,oa,oi]),oo=nd([oa,oi]),os=n7.strict(),ol=n3.extend({requestId:oe.optional(),reason:iN().optional()}),oc=n5.extend({method:nS("notifications/cancelled"),params:ol}),ou=nl({src:iN(),mimeType:iN().optional(),sizes:no(iN()).optional(),theme:n_(["light","dark"]).optional()}),od=nl({icons:no(ou).optional()}),op=nl({name:iN(),title:iN().optional()}),om=op.extend({...op.shape,...od.shape,version:iN(),websiteUrl:iN().optional(),description:iN().optional()}),oh=nf(nl({applyDefaults:i8().optional()}),nG),of=nD(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,nf(nl({form:oh.optional(),url:nG.optional()}),nG.optional())),oy=nc({list:nG.optional(),cancel:nG.optional(),requests:nc({sampling:nc({createMessage:nG.optional()}).optional(),elicitation:nc({create:nG.optional()}).optional()}).optional()}),og=nc({list:nG.optional(),cancel:nG.optional(),requests:nc({tools:nc({call:nG.optional()}).optional()}).optional()}),ov=nl({experimental:ng(iN(),nG).optional(),sampling:nl({context:nG.optional(),tools:nG.optional()}).optional(),elicitation:of.optional(),roots:nl({listChanged:i8().optional()}).optional(),tasks:oy.optional(),extensions:ng(iN(),nG).optional()}),o_=n9.extend({protocolVersion:iN(),capabilities:ov,clientInfo:om}),ob=n6.extend({method:nS("initialize"),params:o_}),oS=nl({experimental:ng(iN(),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:og.optional(),extensions:ng(iN(),nG).optional()}),o$=n7.extend({protocolVersion:iN(),capabilities:oS,serverInfo:om,instructions:iN().optional()}),ow=n5.extend({method:nS("notifications/initialized"),params:n3.optional()}),ok=n6.extend({method:nS("server/discover"),params:n9.optional()}),ox=n7.extend({supportedVersions:no(iN()),capabilities:oS,instructions:iN().optional()}),oR=n6.extend({method:nS("ping"),params:n9.optional()}),oP=nl({progress:i4(),total:nx(i4()),message:nx(iN())}),oE=nl({...n3.shape,...oP.shape,progressToken:nX}),oO=n5.extend({method:nS("notifications/progress"),params:oE}),oT=n9.extend({cursor:nQ.optional()}),oj=n6.extend({params:oT.optional()}),oN=n7.extend({nextCursor:nQ.optional()}),oC=nl({uri:iN(),mimeType:nx(iN()),_meta:ng(iN(),na()).optional()}),oI=oC.extend({text:iN()}),oq=iN().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),oz=oC.extend({blob:oq}),oA=n_(["user","assistant"]),oM=nl({audience:no(oA).optional(),priority:i4().min(0).max(1).optional(),lastModified:r2(iI,{offset:!0}).optional()}),oL=nl({...op.shape,...od.shape,uri:iN(),description:nx(iN()),mimeType:nx(iN()),size:nx(i4()),annotations:oM.optional(),_meta:nx(nc({}))}),oD=nl({...op.shape,...od.shape,uriTemplate:iN(),description:nx(iN()),mimeType:nx(iN()),annotations:oM.optional(),_meta:nx(nc({}))}),oZ=oj.extend({method:nS("resources/list")}),oV=oN.extend({resources:no(oL)}),oF=oj.extend({method:nS("resources/templates/list")}),oU=oN.extend({resourceTemplates:no(oD)}),oJ=n9.extend({uri:iN()}),oH=n6.extend({method:nS("resources/read"),params:oJ}),oK=n7.extend({contents:no(nd([oI,oz]))}),oB=n5.extend({method:nS("notifications/resources/list_changed"),params:n3.optional()}),oW=n6.extend({method:nS("resources/subscribe"),params:oJ}),oG=n6.extend({method:nS("resources/unsubscribe"),params:oJ}),oY=nl({toolsListChanged:i8().optional(),promptsListChanged:i8().optional(),resourcesListChanged:i8().optional(),resourceSubscriptions:no(iN()).optional()}),oX=n9.extend({notifications:oY}),oQ=n6.extend({method:nS("subscriptions/listen"),params:oX}),o0=n3.extend({notifications:oY}),o1=n5.extend({method:nS("notifications/subscriptions/acknowledged"),params:o0}),o2=n8.extend({[nK]:oe}),o9=n7.extend({_meta:o2}),o4=n3.extend({uri:iN()}),o6=n5.extend({method:nS("notifications/resources/updated"),params:o4}),o3=nl({name:iN(),description:nx(iN()),required:nx(i8())}),o5=nl({...op.shape,...od.shape,description:nx(iN()),arguments:nx(no(o3)),_meta:nx(nc({}))}),o8=oj.extend({method:nS("prompts/list")}),o7=oN.extend({prompts:no(o5)}),se=n9.extend({name:iN(),arguments:ng(iN(),iN()).optional()}),st=n6.extend({method:nS("prompts/get"),params:se}),sr=nl({type:nS("text"),text:iN(),annotations:oM.optional(),_meta:ng(iN(),na()).optional()}),sa=nl({type:nS("image"),data:oq,mimeType:iN(),annotations:oM.optional(),_meta:ng(iN(),na()).optional()}),si=nl({type:nS("audio"),data:oq,mimeType:iN(),annotations:oM.optional(),_meta:ng(iN(),na()).optional()}),sn=nl({type:nS("tool_use"),name:iN(),id:iN(),input:ng(iN(),na()),_meta:ng(iN(),na()).optional()}),so=nl({type:nS("resource"),resource:nd([oI,oz]),annotations:oM.optional(),_meta:ng(iN(),na()).optional()}),ss=oL.extend({type:nS("resource_link")}),sl=nd([sr,sa,si,ss,so]),sc=nl({role:oA,content:sl}),su=n7.extend({description:iN().optional(),messages:no(sc)}),sd=n5.extend({method:nS("notifications/prompts/list_changed"),params:n3.optional()}),sp=nl({title:iN().optional(),readOnlyHint:i8().optional(),destructiveHint:i8().optional(),idempotentHint:i8().optional(),openWorldHint:i8().optional()}),sm=nl({taskSupport:n_(["required","optional","forbidden"]).optional()}),sh=nl({...op.shape,...od.shape,description:iN().optional(),inputSchema:nl({type:nS("object"),properties:ng(iN(),nW).optional(),required:no(iN()).optional()}).catchall(na()),outputSchema:nc({$schema:iN().optional()}).optional(),annotations:sp.optional(),execution:sm.optional(),_meta:ng(iN(),na()).optional()}),sf=oj.extend({method:nS("tools/list")}),sy=oN.extend({tools:no(sh)}),sg=n7.extend({content:no(sl).default([]),structuredContent:na().optional(),isError:i8().optional()}),sv=sg.or(n7.extend({toolResult:na()})),s_=n4.extend({name:iN(),arguments:ng(iN(),na()).optional()}),sb=n6.extend({method:nS("tools/call"),params:s_}),sS=n5.extend({method:nS("notifications/tools/list_changed"),params:n3.optional()}),s$=nl({autoRefresh:i8().default(!0),debounceMs:i4().int().nonnegative().default(300)}),sw=n_(["debug","info","notice","warning","error","critical","alert","emergency"]),sk=n9.extend({level:sw}),sx=n6.extend({method:nS("logging/setLevel"),params:sk}),sR=n3.extend({level:sw,logger:iN().optional(),data:na()}),sP=n5.extend({method:nS("notifications/message"),params:sR}),sE=nl({name:iN().optional()}),sO=nl({hints:no(sE).optional(),costPriority:i4().min(0).max(1).optional(),speedPriority:i4().min(0).max(1).optional(),intelligencePriority:i4().min(0).max(1).optional()}),sT=nl({mode:n_(["auto","required","none"]).optional()}),sj=nl({type:nS("tool_result"),toolUseId:iN().describe("The unique identifier for the corresponding tool call."),content:no(sl),structuredContent:na().optional(),isError:i8().optional(),_meta:ng(iN(),na()).optional()}),sN=nm("type",[sr,sa,si]),sC=nm("type",[sr,sa,si,sn,sj]),sI=nl({role:oA,content:nd([sC,no(sC)]),_meta:ng(iN(),na()).optional()}),sq=n4.extend({messages:no(sI),modelPreferences:sO.optional(),systemPrompt:iN().optional(),includeContext:n_(["none","thisServer","allServers"]).optional(),temperature:i4().optional(),maxTokens:i4().int(),stopSequences:no(iN()).optional(),metadata:nG.optional(),tools:no(sh).optional(),toolChoice:sT.optional()}),sz=n6.extend({method:nS("sampling/createMessage"),params:sq}),sA=n7.extend({model:iN(),stopReason:nx(n_(["endTurn","stopSequence","maxTokens"]).or(iN())),role:oA,content:sN}),sM=n7.extend({model:iN(),stopReason:nx(n_(["endTurn","stopSequence","maxTokens","toolUse"]).or(iN())),role:oA,content:nd([sC,no(sC)])}),sL=nl({type:nS("boolean"),title:iN().optional(),description:iN().optional(),default:i8().optional()}),sD=nl({type:nS("string"),title:iN().optional(),description:iN().optional(),minLength:i4().optional(),maxLength:i4().optional(),format:n_(["email","uri","date","date-time"]).optional(),default:iN().optional()}),sZ=nl({type:n_(["number","integer"]),title:iN().optional(),description:iN().optional(),minimum:i4().optional(),maximum:i4().optional(),default:i4().optional()}),sV=nl({type:nS("string"),title:iN().optional(),description:iN().optional(),enum:no(iN()),default:iN().optional()}),sF=nl({type:nS("string"),title:iN().optional(),description:iN().optional(),oneOf:no(nl({const:iN(),title:iN()})),default:iN().optional()}),sU=nl({type:nS("string"),title:iN().optional(),description:iN().optional(),enum:no(iN()),enumNames:no(iN()).optional(),default:iN().optional()}),sJ=nd([sV,sF]),sH=nl({type:nS("array"),title:iN().optional(),description:iN().optional(),minItems:i4().optional(),maxItems:i4().optional(),items:nl({type:nS("string"),enum:no(iN())}),default:no(iN()).optional()}),sK=nl({type:nS("array"),title:iN().optional(),description:iN().optional(),minItems:i4().optional(),maxItems:i4().optional(),items:nl({anyOf:no(nl({const:iN(),title:iN()}))}),default:no(iN()).optional()}),sB=nd([sH,sK]),sW=nd([sU,sJ,sB]),sG=nd([sW,sL,sD,sZ]),sY=n4.extend({mode:nS("form").optional(),message:iN(),requestedSchema:nl({type:nS("object"),properties:ng(iN(),sG),required:no(iN()).optional()}).catchall(na())}),sX=n4.extend({mode:nS("url"),message:iN(),elicitationId:iN(),url:iN().url()}),sQ=nd([sY,sX]),s0=n6.extend({method:nS("elicitation/create"),params:sQ}),s1=n3.extend({elicitationId:iN()}),s2=n5.extend({method:nS("notifications/elicitation/complete"),params:s1}),s9=n7.extend({action:n_(["accept","decline","cancel"]),content:nD(t=>null===t?void 0:t,ng(iN(),nd([iN(),i4(),i8(),no(iN())])).optional())}),s4=nl({type:nS("ref/resource"),uri:iN()}),s6=nl({type:nS("ref/prompt"),name:iN()}),s3=n9.extend({ref:nd([s6,s4]),argument:nl({name:iN(),value:iN()}),context:nl({arguments:ng(iN(),iN()).optional()}).optional()}),s5=n6.extend({method:nS("completion/complete"),params:s3}),s8=n7.extend({completion:nc({values:no(iN()).max(100),total:nx(i4().int()),hasMore:nx(i8())})}),s7=nl({uri:iN().startsWith("file://"),name:iN().optional(),_meta:ng(iN(),na()).optional()}),le=n6.extend({method:nS("roots/list"),params:n9.optional()}),lt=n7.extend({roots:no(s7)}),lr=n5.extend({method:nS("notifications/roots/list_changed"),params:n3.optional()}),la=nc({ttl:i4().optional(),pollInterval:i4().optional()}),li=n_(["working","input_required","completed","failed","cancelled"]),ln=nl({taskId:iN(),status:li,ttl:nd([i4(),ne()]),createdAt:iN(),lastUpdatedAt:iN(),pollInterval:nx(i4()),statusMessage:nx(iN())}),lo=n7.extend({task:ln}),ls=n3.merge(ln),ll=n5.extend({method:nS("notifications/tasks/status"),params:ls}),lc=n6.extend({method:nS("tasks/get"),params:n9.extend({taskId:iN()})}),lu=n7.merge(ln),ld=n6.extend({method:nS("tasks/result"),params:n9.extend({taskId:iN()})}),lp=n7.loose(),lm=oj.extend({method:nS("tasks/list")}),lh=oN.extend({tasks:no(ln)}),lf=n6.extend({method:nS("tasks/cancel"),params:n9.extend({taskId:iN()})}),ly=n7.merge(ln),lg=nd([oR,ob,ok,s5,sx,st,o8,oZ,oF,oH,oW,oG,oQ,sb,sf]),lv=nd([oc,oO,ow,lr]),l_=nd([os,sA,sM,s9,lt]),lb=nd([oR,sz,s0,le]),lS=nd([oc,oO,sP,o6,oB,sS,sd,o1,s2]),l$=nd([os,o$,ox,s8,su,o7,oV,oU,oK,sg,sy,o9]),lw=r1(iZ,void 0).superRefine((t,r)=>{if(!URL.canParse(t))return r.addIssue({code:"custom",message:"URL must be parseable",fatal:!0}),eA}).refine(t=>{let r=new URL(t);return"javascript:"!==r.protocol&&"data:"!==r.protocol&&"vbscript:"!==r.protocol},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),lk=nc({resource:iN().url(),authorization_servers:no(lw).optional(),jwks_uri:iN().url().optional(),scopes_supported:no(iN()).optional(),bearer_methods_supported:no(iN()).optional(),resource_signing_alg_values_supported:no(iN()).optional(),resource_name:iN().optional(),resource_documentation:iN().optional(),resource_policy_uri:iN().url().optional(),resource_tos_uri:iN().url().optional(),tls_client_certificate_bound_access_tokens:i8().optional(),authorization_details_types_supported:no(iN()).optional(),dpop_signing_alg_values_supported:no(iN()).optional(),dpop_bound_access_tokens_required:i8().optional()}),lx=nc({issuer:iN(),authorization_endpoint:lw,token_endpoint:lw,registration_endpoint:lw.optional(),scopes_supported:no(iN()).optional(),response_types_supported:no(iN()),response_modes_supported:no(iN()).optional(),grant_types_supported:no(iN()).optional(),token_endpoint_auth_methods_supported:no(iN()).optional(),token_endpoint_auth_signing_alg_values_supported:no(iN()).optional(),service_documentation:lw.optional(),revocation_endpoint:lw.optional(),revocation_endpoint_auth_methods_supported:no(iN()).optional(),revocation_endpoint_auth_signing_alg_values_supported:no(iN()).optional(),introspection_endpoint:iN().optional(),introspection_endpoint_auth_methods_supported:no(iN()).optional(),introspection_endpoint_auth_signing_alg_values_supported:no(iN()).optional(),code_challenge_methods_supported:no(iN()).optional(),client_id_metadata_document_supported:i8().optional(),authorization_response_iss_parameter_supported:i8().optional().catch(void 0)}),lR=nc({issuer:iN(),authorization_endpoint:lw,token_endpoint:lw,userinfo_endpoint:lw.optional(),jwks_uri:lw,registration_endpoint:lw.optional(),scopes_supported:no(iN()).optional(),response_types_supported:no(iN()),response_modes_supported:no(iN()).optional(),grant_types_supported:no(iN()).optional(),acr_values_supported:no(iN()).optional(),subject_types_supported:no(iN()),id_token_signing_alg_values_supported:no(iN()),id_token_encryption_alg_values_supported:no(iN()).optional(),id_token_encryption_enc_values_supported:no(iN()).optional(),userinfo_signing_alg_values_supported:no(iN()).optional(),userinfo_encryption_alg_values_supported:no(iN()).optional(),userinfo_encryption_enc_values_supported:no(iN()).optional(),request_object_signing_alg_values_supported:no(iN()).optional(),request_object_encryption_alg_values_supported:no(iN()).optional(),request_object_encryption_enc_values_supported:no(iN()).optional(),token_endpoint_auth_methods_supported:no(iN()).optional(),token_endpoint_auth_signing_alg_values_supported:no(iN()).optional(),display_values_supported:no(iN()).optional(),claim_types_supported:no(iN()).optional(),claims_supported:no(iN()).optional(),service_documentation:iN().optional(),claims_locales_supported:no(iN()).optional(),ui_locales_supported:no(iN()).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:iN(),id_token:iN().optional(),token_type:iN(),expires_in:new i9(rQ({type:"number",coerce:!0,checks:[],...ey(void 0)})).optional(),scope:iN().optional(),refresh_token:iN().optional()}).strip(),lO=nl({issued_token_type:nS("urn:ietf:params:oauth:token-type:id-jag"),access_token:iN(),token_type:iN().optional(),expires_in:i4().optional(),scope:iN().optional()}).strip(),lT=nl({error:iN(),error_description:iN().optional(),error_uri:iN().optional()}),lj=lw.optional().or(nS("").transform(()=>void 0)),lN=nl({redirect_uris:no(lw),token_endpoint_auth_method:iN().optional(),grant_types:no(iN()).optional(),response_types:no(iN()).optional(),application_type:iN().optional(),client_name:iN().optional(),client_uri:lw.optional(),logo_uri:lj,scope:iN().optional(),contacts:no(iN()).optional(),tos_uri:lj,policy_uri:iN().optional(),jwks_uri:lw.optional(),jwks:new nt({type:"any"}).optional(),software_id:iN().optional(),software_version:iN().optional(),software_statement:iN().optional()}).strip(),lC=nl({client_id:iN(),client_secret:iN().optional(),client_id_issued_at:i4().optional(),client_secret_expires_at:i4().optional()}).strip(),lI=lN.merge(lC),lq=nl({error:iN(),error_description:iN().optional()}).strip(),lz=nl({token:iN(),token_type_hint:iN().optional()}).strip(),lA=Symbol.for("mcp.sdk.errorBrands");function lM(t,r){let a=new Set,i=r;for(;"function"==typeof i;){let t=i.mcpBrand;Object.prototype.hasOwnProperty.call(i,"mcpBrand")&&"string"==typeof t&&a.add(t),i=Object.getPrototypeOf(i)}0!==a.size&&Object.defineProperty(t,lA,{value:a,enumerable:!1,configurable:!0})}function lL(t,r){try{if("object"==typeof r&&null!==r&&Object.prototype.hasOwnProperty.call(t,"mcpBrand")&&"string"==typeof t.mcpBrand&&Object.prototype.hasOwnProperty.call(r,lA)){let a=r[lA];if(a&&"function"==typeof a.has&&a.has(t.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(t,r)}(class t extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return lL(this,t)}static isInstance(t){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return lL(this,t)}constructor(t,r,a){super(r),this.code=t,this.errorUri=a,this.name="OAuthError",lM(this,new.target)}toResponseObject(){let t={error:this.code,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}static fromResponse(r){return new t(r.error,r.error_description??r.error,r.error_uri)}});let lD=((w={}).NotConnected="NOT_CONNECTED",w.AlreadyConnected="ALREADY_CONNECTED",w.NotInitialized="NOT_INITIALIZED",w.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",w.RequestTimeout="REQUEST_TIMEOUT",w.ConnectionClosed="CONNECTION_CLOSED",w.SendFailed="SEND_FAILED",w.InvalidResult="INVALID_RESULT",w.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",w.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",w.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",w.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",w.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",w.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",w.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",w.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",w.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",w.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",w.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",w);var lZ=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](t){return lL(this,t)}static isInstance(t){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return lL(this,t)}constructor(t,r,a){super(r),this.code=t,this.data=a,this.name="SdkError",lM(this,new.target)}};function lV(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function lF(t,r){let a={};for(let[i,n]of Object.entries(t)){if(void 0===n)continue;let t=void 0===r?void 0:r[i];if(void 0===t){a[i]=n;continue}if(lV(n)&&lV(t)){let r={};for(let[a,o]of Object.entries(n))void 0!==o&&void 0===t[a]&&("elicitation"!==i||"form"!==a||void 0!==t.form||void 0!==t.url)&&(r[a]=o);Object.keys(r).length>0&&(a[i]=r)}}return Object.keys(a).length>0?a:void 0}(class extends lZ{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(t,r,a){super(t,r,a),this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}});let lU="2026-07-28",lJ=[lU];function lH(t){return t.filter(t=>t>=lU)}function lK(t){let r=t.structuredContent;return void 0===r||!("object"!=typeof r||null===r||Array.isArray(r))||t.content?.some(t=>"text"===t.type)?t:{...t,content:[...t.content??[],{type:"text",text:JSON.stringify(r)}]}}let lB=["task","inputRequests","requestState"];function lW(t){return null===t||"object"!=typeof t||Array.isArray(t)||void 0!==t.content||lB.some(r=>r in t)?t:{...t,content:[]}}function lG(){let t,r,a,n,o,s,l,c,u,d,p,m,h,f,y,g,v,_,b,S,$,w,k,x,R,P,E,O,T,j,N,C,I,q,z,A,M,L,D,Z,V,F,U,J,H,K,B,W,G,Y,X,Q,ee,et,er,ea,ei,en,eo,es,el,ec,eu,ed,ep,em,eh,ef,ey,eg,ev,e_,eb,eS,e$,ew,ek,ex,eR,eP,eE,eO,eT,ej,eN,eC,eI,eq,ez,eA,eM,eL,eD,eZ,eV,eF,eU,eJ,eH,eK,eB,eW,eG,eY,eX,eQ,e0,e1,e2,e9,e4,e6,e3,e5,e8,e7,te,tt,tr,ta,ti,tn,to,ts,tl,tc,tu,td,tp,tm,th,tf,ty,tg,tv,t_,tb,tS,t$,tw;return i??=(t=nM(()=>nd([iN(),i4(),i8(),ne(),ng(iN(),t),no(t)])),r=ng(iN(),t),a=nd([iN(),i4().int()]),n=iN(),o=nl({ttl:i4().optional()}),s=nl({taskId:iN()}),u=(c=nl({_meta:(l=nc({progressToken:a.optional(),"io.modelcontextprotocol/related-task":s.optional()})).optional()})).extend({task:o.optional()}),d=nl({method:iN(),params:c.loose().optional()}),p=nl({_meta:l.optional()}),m=nl({method:iN(),params:p.loose().optional()}),h=nc({_meta:l.optional()}),f=nd([iN(),i4().int()]),y=h.strict(),g=p.extend({requestId:f.optional(),reason:iN().optional()}),v=m.extend({method:nS("notifications/cancelled"),params:g}),_=nl({src:iN(),mimeType:iN().optional(),sizes:no(iN()).optional(),theme:n_(["light","dark"]).optional()}),b=nl({icons:no(_).optional()}),$=(S=nl({name:iN(),title:iN().optional()})).extend({...S.shape,...b.shape,version:iN(),websiteUrl:iN().optional(),description:iN().optional()}),w=nf(nl({applyDefaults:i8().optional()}),r),k=nD(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,nf(nl({form:w.optional(),url:r.optional()}),r.optional())),x=nc({list:r.optional(),cancel:r.optional(),requests:nc({sampling:nc({createMessage:r.optional()}).optional(),elicitation:nc({create:r.optional()}).optional()}).optional()}),R=nc({list:r.optional(),cancel:r.optional(),requests:nc({tools:nc({call:r.optional()}).optional()}).optional()}),P=nl({experimental:ng(iN(),r).optional(),sampling:nl({context:r.optional(),tools:r.optional()}).optional(),elicitation:k.optional(),roots:nl({listChanged:i8().optional()}).optional(),tasks:x.optional(),extensions:ng(iN(),r).optional()}),E=c.extend({protocolVersion:iN(),capabilities:P,clientInfo:$}),O=d.extend({method:nS("initialize"),params:E}),T=nl({experimental:ng(iN(),r).optional(),logging:r.optional(),completions:r.optional(),prompts:nl({listChanged:i8().optional()}).optional(),resources:nl({subscribe:i8().optional(),listChanged:i8().optional()}).optional(),tools:nl({listChanged:i8().optional()}).optional(),tasks:R.optional(),extensions:ng(iN(),r).optional()}),j=h.extend({protocolVersion:iN(),capabilities:T,serverInfo:$,instructions:iN().optional()}),N=m.extend({method:nS("notifications/initialized"),params:p.optional()}),C=d.extend({method:nS("ping"),params:c.optional()}),I=nl({progress:i4(),total:nx(i4()),message:nx(iN())}),q=nl({...p.shape,...I.shape,progressToken:a}),z=m.extend({method:nS("notifications/progress"),params:q}),A=c.extend({cursor:n.optional()}),M=d.extend({params:A.optional()}),L=h.extend({nextCursor:n.optional()}),Z=(D=nl({uri:iN(),mimeType:nx(iN()),_meta:ng(iN(),na()).optional()})).extend({text:iN()}),V=iN().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),F=D.extend({blob:V}),J=nl({audience:no(U=n_(["user","assistant"])).optional(),priority:i4().min(0).max(1).optional(),lastModified:r2(iI,{offset:!0}).optional()}),H=nl({...S.shape,...b.shape,uri:iN(),description:nx(iN()),mimeType:nx(iN()),size:nx(i4()),annotations:J.optional(),_meta:nx(nc({}))}),K=nl({...S.shape,...b.shape,uriTemplate:iN(),description:nx(iN()),mimeType:nx(iN()),annotations:J.optional(),_meta:nx(nc({}))}),B=M.extend({method:nS("resources/list")}),W=L.extend({resources:no(H)}),G=M.extend({method:nS("resources/templates/list")}),Y=L.extend({resourceTemplates:no(K)}),X=c.extend({uri:iN()}),Q=d.extend({method:nS("resources/read"),params:X}),ee=h.extend({contents:no(nd([Z,F]))}),et=m.extend({method:nS("notifications/resources/list_changed"),params:p.optional()}),er=d.extend({method:nS("resources/subscribe"),params:X}),ea=d.extend({method:nS("resources/unsubscribe"),params:X}),ei=p.extend({uri:iN()}),en=m.extend({method:nS("notifications/resources/updated"),params:ei}),eo=nl({name:iN(),description:nx(iN()),required:nx(i8())}),es=nl({...S.shape,...b.shape,description:nx(iN()),arguments:nx(no(eo)),_meta:nx(nc({}))}),el=M.extend({method:nS("prompts/list")}),ec=L.extend({prompts:no(es)}),eu=c.extend({name:iN(),arguments:ng(iN(),iN()).optional()}),ed=d.extend({method:nS("prompts/get"),params:eu}),ep=nl({type:nS("text"),text:iN(),annotations:J.optional(),_meta:ng(iN(),na()).optional()}),em=nl({type:nS("image"),data:V,mimeType:iN(),annotations:J.optional(),_meta:ng(iN(),na()).optional()}),eh=nl({type:nS("audio"),data:V,mimeType:iN(),annotations:J.optional(),_meta:ng(iN(),na()).optional()}),ef=nl({type:nS("tool_use"),name:iN(),id:iN(),input:ng(iN(),na()),_meta:ng(iN(),na()).optional()}),ey=nl({type:nS("resource"),resource:nd([Z,F]),annotations:J.optional(),_meta:ng(iN(),na()).optional()}),e_=nl({role:U,content:ev=nd([ep,em,eh,eg=H.extend({type:nS("resource_link")}),ey])}),eb=h.extend({description:iN().optional(),messages:no(e_)}),eS=m.extend({method:nS("notifications/prompts/list_changed"),params:p.optional()}),e$=nl({title:iN().optional(),readOnlyHint:i8().optional(),destructiveHint:i8().optional(),idempotentHint:i8().optional(),openWorldHint:i8().optional()}),ew=nl({taskSupport:n_(["required","optional","forbidden"]).optional()}),ek=nl({...S.shape,...b.shape,description:iN().optional(),inputSchema:nl({type:nS("object"),properties:ng(iN(),t).optional(),required:no(iN()).optional()}).catchall(na()),outputSchema:nl({type:nS("object"),properties:ng(iN(),t).optional(),required:no(iN()).optional()}).catchall(na()).optional(),annotations:e$.optional(),execution:ew.optional(),_meta:ng(iN(),na()).optional()}),ex=M.extend({method:nS("tools/list")}),eR=L.extend({tools:no(ek)}),eP=h.extend({content:no(ev),structuredContent:ng(iN(),na()).optional(),isError:i8().optional()}),eE=u.extend({name:iN(),arguments:ng(iN(),na()).optional()}),eO=d.extend({method:nS("tools/call"),params:eE}),eT=m.extend({method:nS("notifications/tools/list_changed"),params:p.optional()}),ej=n_(["debug","info","notice","warning","error","critical","alert","emergency"]),eN=c.extend({level:ej}),eC=d.extend({method:nS("logging/setLevel"),params:eN}),eI=p.extend({level:ej,logger:iN().optional(),data:na()}),eq=m.extend({method:nS("notifications/message"),params:eI}),ez=nl({name:iN().optional()}),eA=nl({hints:no(ez).optional(),costPriority:i4().min(0).max(1).optional(),speedPriority:i4().min(0).max(1).optional(),intelligencePriority:i4().min(0).max(1).optional()}),eM=nl({mode:n_(["auto","required","none"]).optional()}),eL=nl({type:nS("tool_result"),toolUseId:iN().describe("The unique identifier for the corresponding tool call."),content:no(ev),structuredContent:nl({}).loose().optional(),isError:i8().optional(),_meta:ng(iN(),na()).optional()}),eD=nm("type",[ep,em,eh]),eV=nl({role:U,content:nd([eZ=nm("type",[ep,em,eh,ef,eL]),no(eZ)]),_meta:ng(iN(),na()).optional()}),eF=u.extend({messages:no(eV),modelPreferences:eA.optional(),systemPrompt:iN().optional(),includeContext:n_(["none","thisServer","allServers"]).optional(),temperature:i4().optional(),maxTokens:i4().int(),stopSequences:no(iN()).optional(),metadata:r.optional(),tools:no(ek).optional(),toolChoice:eM.optional()}),eU=d.extend({method:nS("sampling/createMessage"),params:eF}),eJ=h.extend({model:iN(),stopReason:nx(n_(["endTurn","stopSequence","maxTokens"]).or(iN())),role:U,content:eD}),eH=h.extend({model:iN(),stopReason:nx(n_(["endTurn","stopSequence","maxTokens","toolUse"]).or(iN())),role:U,content:nd([eZ,no(eZ)])}),eK=nl({type:nS("boolean"),title:iN().optional(),description:iN().optional(),default:i8().optional()}),eB=nl({type:nS("string"),title:iN().optional(),description:iN().optional(),minLength:i4().optional(),maxLength:i4().optional(),format:n_(["email","uri","date","date-time"]).optional(),default:iN().optional()}),eW=nl({type:n_(["number","integer"]),title:iN().optional(),description:iN().optional(),minimum:i4().optional(),maximum:i4().optional(),default:i4().optional()}),eG=nl({type:nS("string"),title:iN().optional(),description:iN().optional(),enum:no(iN()),default:iN().optional()}),eY=nl({type:nS("string"),title:iN().optional(),description:iN().optional(),oneOf:no(nl({const:iN(),title:iN()})),default:iN().optional()}),eX=nl({type:nS("string"),title:iN().optional(),description:iN().optional(),enum:no(iN()),enumNames:no(iN()).optional(),default:iN().optional()}),eQ=nd([eG,eY]),e0=nl({type:nS("array"),title:iN().optional(),description:iN().optional(),minItems:i4().optional(),maxItems:i4().optional(),items:nl({type:nS("string"),enum:no(iN())}),default:no(iN()).optional()}),e2=nd([e0,e1=nl({type:nS("array"),title:iN().optional(),description:iN().optional(),minItems:i4().optional(),maxItems:i4().optional(),items:nl({anyOf:no(nl({const:iN(),title:iN()}))}),default:no(iN()).optional()})]),e9=nd([eX,eQ,e2]),e4=nd([e9,eK,eB,eW]),e6=u.extend({mode:nS("form").optional(),message:iN(),requestedSchema:nl({type:nS("object"),properties:ng(iN(),e4),required:no(iN()).optional()}).catchall(na())}),e5=nd([e6,e3=u.extend({mode:nS("url"),message:iN(),elicitationId:iN(),url:iN().url()})]),e8=d.extend({method:nS("elicitation/create"),params:e5}),e7=p.extend({elicitationId:iN()}),te=m.extend({method:nS("notifications/elicitation/complete"),params:e7}),tt=h.extend({action:n_(["accept","decline","cancel"]),content:nD(t=>null===t?void 0:t,ng(iN(),nd([iN(),i4(),i8(),no(iN())])).optional())}),tr=nl({type:nS("ref/resource"),uri:iN()}),ta=nl({type:nS("ref/prompt"),name:iN()}),ti=c.extend({ref:nd([ta,tr]),argument:nl({name:iN(),value:iN()}),context:nl({arguments:ng(iN(),iN()).optional()}).optional()}),tn=d.extend({method:nS("completion/complete"),params:ti}),to=h.extend({completion:nc({values:no(iN()).max(100),total:nx(i4().int()),hasMore:nx(i8())})}),ts=nl({uri:iN().startsWith("file://"),name:iN().optional(),_meta:ng(iN(),na()).optional()}),tl=d.extend({method:nS("roots/list"),params:c.optional()}),tc=h.extend({roots:no(ts)}),tu=m.extend({method:nS("notifications/roots/list_changed"),params:p.optional()}),td=nc({ttl:i4().optional(),pollInterval:i4().optional()}),tp=n_(["working","input_required","completed","failed","cancelled"]),tm=nl({taskId:iN(),status:tp,ttl:nd([i4(),ne()]),createdAt:iN(),lastUpdatedAt:iN(),pollInterval:nx(i4()),statusMessage:nx(iN())}),th=h.extend({task:tm}),tf=p.merge(tm),ty=m.extend({method:nS("notifications/tasks/status"),params:tf}),tg=d.extend({method:nS("tasks/get"),params:c.extend({taskId:iN()})}),tv=h.merge(tm),t_=d.extend({method:nS("tasks/result"),params:c.extend({taskId:iN()})}),tb=h.loose(),tS=M.extend({method:nS("tasks/list")}),t$=L.extend({tasks:no(tm)}),tw=d.extend({method:nS("tasks/cancel"),params:c.extend({taskId:iN()})}),{JSONValueSchema:t,JSONObjectSchema:r,ProgressTokenSchema:a,CursorSchema:n,TaskMetadataSchema:o,RelatedTaskMetadataSchema:s,RequestMetaSchema:l,BaseRequestParamsSchema:c,TaskAugmentedRequestParamsSchema:u,RequestSchema:d,NotificationsParamsSchema:p,NotificationSchema:m,ResultSchema:h,RequestIdSchema:f,EmptyResultSchema:y,CancelledNotificationParamsSchema:g,CancelledNotificationSchema:v,IconSchema:_,IconsSchema:b,BaseMetadataSchema:S,ImplementationSchema:$,ClientTasksCapabilitySchema:x,ServerTasksCapabilitySchema:R,ClientCapabilitiesSchema:P,InitializeRequestParamsSchema:E,InitializeRequestSchema:O,ServerCapabilitiesSchema:T,InitializeResultSchema:j,InitializedNotificationSchema:N,PingRequestSchema:C,ProgressSchema:I,ProgressNotificationParamsSchema:q,ProgressNotificationSchema:z,PaginatedRequestParamsSchema:A,PaginatedRequestSchema:M,PaginatedResultSchema:L,ResourceContentsSchema:D,TextResourceContentsSchema:Z,BlobResourceContentsSchema:F,RoleSchema:U,AnnotationsSchema:J,ResourceSchema:H,ResourceTemplateSchema:K,ListResourcesRequestSchema:B,ListResourcesResultSchema:W,ListResourceTemplatesRequestSchema:G,ListResourceTemplatesResultSchema:Y,ResourceRequestParamsSchema:X,ReadResourceRequestParamsSchema:X,ReadResourceRequestSchema:Q,ReadResourceResultSchema:ee,ResourceListChangedNotificationSchema:et,SubscribeRequestParamsSchema:X,SubscribeRequestSchema:er,UnsubscribeRequestParamsSchema:X,UnsubscribeRequestSchema:ea,ResourceUpdatedNotificationParamsSchema:ei,ResourceUpdatedNotificationSchema:en,PromptArgumentSchema:eo,PromptSchema:es,ListPromptsRequestSchema:el,ListPromptsResultSchema:ec,GetPromptRequestParamsSchema:eu,GetPromptRequestSchema:ed,TextContentSchema:ep,ImageContentSchema:em,AudioContentSchema:eh,ToolUseContentSchema:ef,EmbeddedResourceSchema:ey,ResourceLinkSchema:eg,ContentBlockSchema:ev,PromptMessageSchema:e_,GetPromptResultSchema:eb,PromptListChangedNotificationSchema:eS,ToolAnnotationsSchema:e$,ToolExecutionSchema:ew,ToolSchema:ek,ListToolsRequestSchema:ex,ListToolsResultSchema:eR,CallToolResultSchema:eP,CallToolRequestParamsSchema:eE,CallToolRequestSchema:eO,ToolListChangedNotificationSchema:eT,LoggingLevelSchema:ej,SetLevelRequestParamsSchema:eN,SetLevelRequestSchema:eC,LoggingMessageNotificationParamsSchema:eI,LoggingMessageNotificationSchema:eq,ModelHintSchema:ez,ModelPreferencesSchema:eA,ToolChoiceSchema:eM,ToolResultContentSchema:eL,SamplingContentSchema:eD,SamplingMessageContentBlockSchema:eZ,SamplingMessageSchema:eV,CreateMessageRequestParamsSchema:eF,CreateMessageRequestSchema:eU,CreateMessageResultSchema:eJ,CreateMessageResultWithToolsSchema:eH,BooleanSchemaSchema:eK,StringSchemaSchema:eB,NumberSchemaSchema:eW,UntitledSingleSelectEnumSchemaSchema:eG,TitledSingleSelectEnumSchemaSchema:eY,LegacyTitledEnumSchemaSchema:eX,SingleSelectEnumSchemaSchema:eQ,UntitledMultiSelectEnumSchemaSchema:e0,TitledMultiSelectEnumSchemaSchema:e1,MultiSelectEnumSchemaSchema:e2,EnumSchemaSchema:e9,PrimitiveSchemaDefinitionSchema:e4,ElicitRequestFormParamsSchema:e6,ElicitRequestURLParamsSchema:e3,ElicitRequestParamsSchema:e5,ElicitRequestSchema:e8,ElicitationCompleteNotificationParamsSchema:e7,ElicitationCompleteNotificationSchema:te,ElicitResultSchema:tt,ResourceTemplateReferenceSchema:tr,PromptReferenceSchema:ta,CompleteRequestParamsSchema:ti,CompleteRequestSchema:tn,CompleteResultSchema:to,RootSchema:ts,ListRootsRequestSchema:tl,ListRootsResultSchema:tc,RootsListChangedNotificationSchema:tu,TaskCreationParamsSchema:td,TaskStatusSchema:tp,TaskSchema:tm,CreateTaskResultSchema:th,TaskStatusNotificationParamsSchema:tf,TaskStatusNotificationSchema:ty,GetTaskRequestSchema:tg,GetTaskResultSchema:tv,GetTaskPayloadRequestSchema:t_,GetTaskPayloadResultSchema:tb,ListTasksRequestSchema:tS,ListTasksResultSchema:t$,CancelTaskRequestSchema:tw,CancelTaskResultSchema:h.merge(tm),ClientRequestSchema:nd([C,O,tn,eC,ed,el,B,G,Q,er,ea,eO,ex,tg,t_,tS,tw]),ClientNotificationSchema:nd([v,z,N,tu,ty]),ClientResultSchema:nd([y,eJ,eH,tt,tc,tv,t$,th]),ServerRequestSchema:nd([C,eU,e8,tl,tg,t_,tS,tw]),ServerNotificationSchema:nd([v,z,eq,en,et,eT,eS,ty,te]),ServerResultSchema:nd([y,j,to,eb,ec,W,Y,ee,eP,eR,tv,t$,th]),CallToolResultWireSchema:na().superRefine((t,r)=>{if(!("object"!=typeof t||null===t||Array.isArray(t))&&void 0===t.content){for(let a of lB)if(a in t)return void r.addIssue({code:"custom",message:`content is required when the body carries '${a}' — another result family cannot default into an empty tools/call success`})}}).transform(lW).pipe(eP)})}function lY(t){return"object"!==t.type}let lX=new Set(["const","enum","default","examples"]),lQ=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function l0(t){return void 0!==t&&!("string"==typeof t&&t.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(n)return n;let t=lG();return n={requestSchemas:{ping:t.PingRequestSchema,initialize:t.InitializeRequestSchema,"completion/complete":t.CompleteRequestSchema,"logging/setLevel":t.SetLevelRequestSchema,"prompts/get":t.GetPromptRequestSchema,"prompts/list":t.ListPromptsRequestSchema,"resources/list":t.ListResourcesRequestSchema,"resources/templates/list":t.ListResourceTemplatesRequestSchema,"resources/read":t.ReadResourceRequestSchema,"resources/subscribe":t.SubscribeRequestSchema,"resources/unsubscribe":t.UnsubscribeRequestSchema,"tools/call":t.CallToolRequestSchema,"tools/list":t.ListToolsRequestSchema,"tasks/get":t.GetTaskRequestSchema,"tasks/result":t.GetTaskPayloadRequestSchema,"tasks/list":t.ListTasksRequestSchema,"tasks/cancel":t.CancelTaskRequestSchema,"sampling/createMessage":t.CreateMessageRequestSchema,"elicitation/create":t.ElicitRequestSchema,"roots/list":t.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":t.CancelledNotificationSchema,"notifications/progress":t.ProgressNotificationSchema,"notifications/initialized":t.InitializedNotificationSchema,"notifications/roots/list_changed":t.RootsListChangedNotificationSchema,"notifications/tasks/status":t.TaskStatusNotificationSchema,"notifications/message":t.LoggingMessageNotificationSchema,"notifications/resources/updated":t.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":t.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":t.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":t.PromptListChangedNotificationSchema,"notifications/elicitation/complete":t.ElicitationCompleteNotificationSchema},resultSchemas:{ping:t.EmptyResultSchema,initialize:t.InitializeResultSchema,"completion/complete":t.CompleteResultSchema,"logging/setLevel":t.EmptyResultSchema,"prompts/get":t.GetPromptResultSchema,"prompts/list":t.ListPromptsResultSchema,"resources/list":t.ListResourcesResultSchema,"resources/templates/list":t.ListResourceTemplatesResultSchema,"resources/read":t.ReadResourceResultSchema,"resources/subscribe":t.EmptyResultSchema,"resources/unsubscribe":t.EmptyResultSchema,"tools/call":t.CallToolResultWireSchema,"tools/list":t.ListToolsResultSchema,"sampling/createMessage":t.CreateMessageResultWithToolsSchema,"elicitation/create":t.ElicitResultSchema,"roots/list":t.ListRootsResultSchema}}}function l6(t){return Object.prototype.hasOwnProperty.call(l1,t)}function l3(t){return Object.prototype.hasOwnProperty.call(l2,t)}function l5(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function l8(t,r){if(void 0===t)return{ok:!1,reason:"not-in-era"};let a=t.safeParse(r);return a.success?{ok:!0,value:a.data}:{ok:!1,reason:"invalid",message:String(a.error)}}Object.keys(l1),Object.keys(l2);let l7={ok:!1,reason:"not-in-era"};function ce(t){return l5(t)&&l5(t.outputSchema)&&lY(t.outputSchema)}let ct={era:"2025-11-25",hasRequestMethod:l6,hasNotificationMethod:l3,validateRequest:(t,r)=>l8(l6(t)?l4().requestSchemas[t]:void 0,r),validateResult:(t,r)=>l8(Object.prototype.hasOwnProperty.call(l9,t)?l4().resultSchemas[t]:void 0,r),validateNotification:(t,r)=>l8(l3(t)?l4().notificationSchemas[t]:void 0,r),hasInputRequestMethod:()=>!1,validateInputRequest:()=>l7,validateInputResponse:()=>l7,samplingResultVariant:(t,r)=>{let a=lG();return l8(t?a.CreateMessageResultWithToolsSchema:a.CreateMessageResultSchema,r)},outboundEnvelope:t=>void 0,validateEnvelopeMeta:t=>[],projectCallToolResult(t,r){let a=lK(t),i=a.structuredContent;if(void 0===i)return a;let n="object"!=typeof i||null===i||Array.isArray(i),o=void 0!==r&&lY(r);return n||o?{...a,structuredContent:{result:i}}:a},decodeResult(t,r){if(l5(r)&&"resultType"in r){let t={...r};return delete t.resultType,{kind:"complete",result:t}}return{kind:"complete",result:r}},encodeResult(t,r){if("tools/list"!==t)return r;let a=r.tools;return Array.isArray(a)&&a.some(t=>ce(t))?{...r,tools:a.map(t=>ce(t)?{...t,outputSchema:function(t){var r;let a="string"==typeof t.$schema?t.$schema:void 0;if(l0(t.$id))return{...void 0!==a&&{$schema:a},type:"object",properties:{result:t},required:["result"]};let i="string"==typeof(r=t.$schema)&&J.has(r.replace(/#$/,""))&&!0!==t.$recursiveAnchor,n=(t,r)=>{if(Array.isArray(t))return t.map(t=>n(t,!1));if(null===t||"object"!=typeof t||!r&&l0(t.$id))return t;let a={},o=!1;for(let[s,l]of Object.entries(t))r?a[s]=n(l,!1):("$ref"===s||"$dynamicRef"===s)&&"string"==typeof l?a[s]="#"===l?"#/properties/result":l.startsWith("#/")?`#/properties/result${l.slice(1)}`:l:"$recursiveRef"===s&&"#"===l&&i?o=!0:lX.has(s)?a[s]=l:lQ.has(s)?a[s]=n(l,!0):a[s]=n(l,!1);return o&&("$ref"in a?a.allOf=[...Array.isArray(a.allOf)?a.allOf:[],{$ref:"#/properties/result"}]:a.$ref="#/properties/result"),a};return{...void 0!==a&&{$schema:a},type:"object",properties:{result:n(t,!1)},required:["result"]}}(t.outputSchema)}:t)}:r},encodeErrorCode:t=>-32002===t?-32602:t,checkInboundEnvelope:t=>void 0};function cr(){return o??=function(){let t=nM(()=>nd([iN(),i4(),i8(),ne(),ng(iN(),t),no(t)])),r=ng(iN(),t),a=nd([iN(),i4().int()]),i=iN(),n=nd([iN(),i4().int()]),o=n_(["user","assistant"]),s=n_(["debug","info","notice","warning","error","critical","alert","emergency"]),l=iN().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),c=nl({ttl:i4().optional()}),u=nl({taskId:iN()}),d=nc({progressToken:a.optional(),"io.modelcontextprotocol/related-task":u.optional()}),p=nl({_meta:d.optional()}),m=p.extend({task:c.optional()}),h=nl({_meta:d.optional()}),f=nl({method:iN(),params:h.loose().optional()}),y=nl({src:iN(),mimeType:iN().optional(),sizes:no(iN()).optional(),theme:n_(["light","dark"]).optional()}),g=nl({icons:no(y).optional()}),v=nl({name:iN(),title:iN().optional()}),_=v.extend({...v.shape,...g.shape,version:iN(),websiteUrl:iN().optional(),description:iN().optional()}),b=nf(nl({applyDefaults:i8().optional()}),r),S=nD(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,nf(nl({form:b.optional(),url:r.optional()}),r.optional())),$=nc({list:r.optional(),cancel:r.optional(),requests:nc({sampling:nc({createMessage:r.optional()}).optional(),elicitation:nc({create:r.optional()}).optional()}).optional()}),w=nc({list:r.optional(),cancel:r.optional(),requests:nc({tools:nc({call:r.optional()}).optional()}).optional()}),k=nl({experimental:ng(iN(),r).optional(),sampling:nl({context:r.optional(),tools:r.optional()}).optional(),elicitation:S.optional(),roots:nl({listChanged:i8().optional()}).optional(),tasks:$.optional(),extensions:ng(iN(),r).optional()}),x=nl({experimental:ng(iN(),r).optional(),logging:r.optional(),completions:r.optional(),prompts:nl({listChanged:i8().optional()}).optional(),resources:nl({subscribe:i8().optional(),listChanged:i8().optional()}).optional(),tools:nl({listChanged:i8().optional()}).optional(),tasks:w.optional(),extensions:ng(iN(),r).optional()}),R=nl({progress:i4(),total:nx(i4()),message:nx(iN())}),P=nl({...h.shape,...R.shape,progressToken:a}),E=f.extend({method:nS("notifications/progress"),params:P}),O=h.extend({level:s,logger:iN().optional(),data:na()}),T=f.extend({method:nS("notifications/message"),params:O}),j=nl({uri:iN(),mimeType:nx(iN()),_meta:ng(iN(),na()).optional()}),N=j.extend({text:iN()}),C=j.extend({blob:l}),I=nl({audience:no(o).optional(),priority:i4().min(0).max(1).optional(),lastModified:r2(iI,{offset:!0}).optional()}),q=nl({...v.shape,...g.shape,uri:iN(),description:nx(iN()),mimeType:nx(iN()),size:nx(i4()),annotations:I.optional(),_meta:nx(nc({}))}),z=nl({...v.shape,...g.shape,uriTemplate:iN(),description:nx(iN()),mimeType:nx(iN()),annotations:I.optional(),_meta:nx(nc({}))}),A=f.extend({method:nS("notifications/resources/list_changed"),params:h.optional()}),M=h.extend({uri:iN()}),L=f.extend({method:nS("notifications/resources/updated"),params:M}),D=nl({name:iN(),description:nx(iN()),required:nx(i8())}),Z=nl({...v.shape,...g.shape,description:nx(iN()),arguments:nx(no(D)),_meta:nx(nc({}))}),V=f.extend({method:nS("notifications/prompts/list_changed"),params:h.optional()}),F=nl({type:nS("text"),text:iN(),annotations:I.optional(),_meta:ng(iN(),na()).optional()}),U=nl({type:nS("image"),data:l,mimeType:iN(),annotations:I.optional(),_meta:ng(iN(),na()).optional()}),J=nl({type:nS("audio"),data:l,mimeType:iN(),annotations:I.optional(),_meta:ng(iN(),na()).optional()}),H=nl({type:nS("tool_use"),name:iN(),id:iN(),input:ng(iN(),na()),_meta:ng(iN(),na()).optional()}),K=nl({type:nS("resource"),resource:nd([N,C]),annotations:I.optional(),_meta:ng(iN(),na()).optional()}),B=q.extend({type:nS("resource_link")}),W=nd([F,U,J,B,K]),G=nl({role:o,content:W}),Y=nl({title:iN().optional(),readOnlyHint:i8().optional(),destructiveHint:i8().optional(),idempotentHint:i8().optional(),openWorldHint:i8().optional()}),X=f.extend({method:nS("notifications/tools/list_changed"),params:h.optional()}),Q=nl({name:iN().optional()}),ee=nl({hints:no(Q).optional(),costPriority:i4().min(0).max(1).optional(),speedPriority:i4().min(0).max(1).optional(),intelligencePriority:i4().min(0).max(1).optional()}),et=nl({mode:n_(["auto","required","none"]).optional()}),er=nl({type:nS("boolean"),title:iN().optional(),description:iN().optional(),default:i8().optional()}),ea=nl({type:nS("string"),title:iN().optional(),description:iN().optional(),minLength:i4().optional(),maxLength:i4().optional(),format:n_(["email","uri","date","date-time"]).optional(),default:iN().optional()}),ei=nl({type:n_(["number","integer"]),title:iN().optional(),description:iN().optional(),minimum:i4().optional(),maximum:i4().optional(),default:i4().optional()}),en=nl({type:nS("string"),title:iN().optional(),description:iN().optional(),enum:no(iN()),default:iN().optional()}),eo=nl({type:nS("string"),title:iN().optional(),description:iN().optional(),oneOf:no(nl({const:iN(),title:iN()})),default:iN().optional()}),es=nl({type:nS("string"),title:iN().optional(),description:iN().optional(),enum:no(iN()),enumNames:no(iN()).optional(),default:iN().optional()}),el=nd([en,eo]),ec=nl({type:nS("array"),title:iN().optional(),description:iN().optional(),minItems:i4().optional(),maxItems:i4().optional(),items:nl({type:nS("string"),enum:no(iN())}),default:no(iN()).optional()}),eu=nl({type:nS("array"),title:iN().optional(),description:iN().optional(),minItems:i4().optional(),maxItems:i4().optional(),items:nl({anyOf:no(nl({const:iN(),title:iN()}))}),default:no(iN()).optional()}),ed=nd([ec,eu]),ep=nd([es,el,ed]),em=nd([ep,er,ea,ei]),eh=m.extend({mode:nS("form").optional(),message:iN(),requestedSchema:nl({type:nS("object"),properties:ng(iN(),em),required:no(iN()).optional()}).catchall(na())}),ef=nl({type:nS("ref/resource"),uri:iN()}),ey=nl({type:nS("ref/prompt"),name:iN()}),eg=nl({uri:iN().startsWith("file://"),name:iN().optional(),_meta:ng(iN(),na()).optional()}),ev=k.shape,e_=nl({experimental:ev.experimental,sampling:ev.sampling,elicitation:ev.elicitation,roots:ev.roots,extensions:ev.extensions}),eb=x.shape,eS=nl({experimental:eb.experimental,logging:eb.logging,completions:eb.completions,prompts:eb.prompts,resources:eb.resources,tools:eb.tools,extensions:eb.extensions}),e$=nc({progressToken:a.optional(),[nF]:iN(),[nU]:_.optional(),[nH]:e_,[nB]:s.optional()}),ew=nl({...v.shape,...g.shape,description:iN().optional(),inputSchema:nc({$schema:iN().optional(),type:nS("object")}),outputSchema:nc({$schema:iN().optional()}).optional(),annotations:Y.optional(),_meta:ng(iN(),na()).optional()}),ek=nl({type:nS("tool_result"),toolUseId:iN(),content:no(W),structuredContent:na().optional(),isError:i8().optional(),_meta:ng(iN(),na()).optional()}),ex=nd([F,U,J,H,ek]),eR=nl({role:o,content:nd([ex,no(ex)]),_meta:ng(iN(),na()).optional()}),eP=iN(),eE=nc({[nJ]:_.optional().catch(void 0)}),eO=eE.optional();function eT(t){return nc({_meta:eO,resultType:eP.default("complete"),...t})}let ej=eT({}),eN=eT({nextCursor:i.optional()}),eC=eT({content:no(W),structuredContent:na().optional(),isError:i8().optional()}),eI=eT({ttlMs:i4().int().min(0),cacheScope:n_(["public","private"]),tools:no(ew),nextCursor:i.optional()}),eq=eT({ttlMs:i4().int().min(0),cacheScope:n_(["public","private"]),prompts:no(Z),nextCursor:i.optional()}),ez=eT({description:iN().optional(),messages:no(G)}),eA=eT({ttlMs:i4().int().min(0),cacheScope:n_(["public","private"]),resources:no(q),nextCursor:i.optional()}),eM=eT({ttlMs:i4().int().min(0),cacheScope:n_(["public","private"]),resourceTemplates:no(z),nextCursor:i.optional()}),eL=eT({ttlMs:i4().int().min(0),cacheScope:n_(["public","private"]),contents:no(nd([N,C]))}),eD=eT({completion:nl({values:no(iN()).max(100),total:i4().int().optional(),hasMore:i8().optional()}).loose()}),eZ=eT({ttlMs:i4().int().min(0),cacheScope:n_(["public","private"])}),eV=eT({ttlMs:i4().int().min(0).catch(0),cacheScope:n_(["public","private"]).catch("private"),supportedVersions:no(iN()),capabilities:eS,instructions:iN().optional()}),eF=nl({messages:no(eR),modelPreferences:ee.optional(),systemPrompt:iN().optional(),includeContext:n_(["none","thisServer","allServers"]).optional(),temperature:i4().optional(),maxTokens:i4().int(),stopSequences:no(iN()).optional(),metadata:r.optional(),tools:no(ew).optional(),toolChoice:et.optional()}),eU=nl({method:nS("sampling/createMessage"),params:eF}),eJ=nl({method:nS("roots/list"),params:nl({_meta:ng(iN(),na()).optional()}).optional()}),eH=nl({...eR.shape,model:iN(),stopReason:iN().optional()}),eK=nl({roots:no(eg)}),eB=nl({action:n_(["accept","decline","cancel"]),content:ng(iN(),nd([iN(),i4(),i8(),no(iN())])).optional()}),eW=nl({mode:nS("url"),message:iN(),url:iN().url()}),eG=nd([eh,eW]),eY=nl({method:nS("elicitation/create"),params:eG}),eX=nd([eU,eJ,eY]),eQ=nd([eH,eK,eB]),e0=ng(iN(),eX),e1=ng(iN(),eQ),e2=eT({inputRequests:e0.optional(),requestState:iN().optional()}),e9={inputResponses:e1.optional(),requestState:iN().optional()},e4=nl({_meta:e$,...e9}),e6=nc({progressToken:a.optional()});function e3(t,r){return nl({method:nS(t),params:nl({_meta:e$,...r})})}function e5(t,r){return nl({method:nS(t),params:nl({_meta:e6.optional(),...r}).optional()})}let e8={name:iN(),arguments:ng(iN(),na()).optional(),...e9},e7={cursor:i.optional()},te=e3("tools/call",e8),tt=e3("tools/list",e7),tr=e3("prompts/list",e7),ta=e3("prompts/get",{name:iN(),arguments:ng(iN(),iN()).optional(),...e9}),ti=e3("resources/list",e7),tn=e3("resources/templates/list",e7),to=e3("resources/read",{uri:iN(),...e9}),ts={ref:nd([ey,ef]),argument:nl({name:iN(),value:iN()}),context:nl({arguments:ng(iN(),iN()).optional()}).optional()},tl=e3("completion/complete",ts),tc=e3("server/discover",{}),tu=nl({toolsListChanged:i8().optional(),promptsListChanged:i8().optional(),resourcesListChanged:i8().optional(),resourceSubscriptions:no(iN()).optional()}),td={notifications:tu},tp=e3("subscriptions/listen",td),tm=eE.extend({"io.modelcontextprotocol/subscriptionId":n}),th=nc({_meta:tm,resultType:eP.default("complete")}),tf={"tools/call":e5("tools/call",e8),"tools/list":e5("tools/list",e7),"prompts/get":e5("prompts/get",{name:iN(),arguments:ng(iN(),iN()).optional()}),"prompts/list":e5("prompts/list",e7),"resources/list":e5("resources/list",e7),"resources/templates/list":e5("resources/templates/list",e7),"resources/read":e5("resources/read",{uri:iN()}),"completion/complete":e5("completion/complete",ts),"server/discover":e5("server/discover",{}),"subscriptions/listen":e5("subscriptions/listen",td)};function ty(t){return nc({_meta:eO,...t})}let tg={"tools/call":ty({content:no(W),structuredContent:na().optional(),isError:i8().optional()}),"tools/list":ty({ttlMs:i4().int().min(0),cacheScope:n_(["public","private"]),tools:no(ew),nextCursor:i.optional()}),"prompts/get":ty({description:iN().optional(),messages:no(G)}),"prompts/list":ty({ttlMs:i4().int().min(0),cacheScope:n_(["public","private"]),prompts:no(Z),nextCursor:i.optional()}),"resources/list":ty({ttlMs:i4().int().min(0),cacheScope:n_(["public","private"]),resources:no(q),nextCursor:i.optional()}),"resources/templates/list":ty({ttlMs:i4().int().min(0),cacheScope:n_(["public","private"]),resourceTemplates:no(z),nextCursor:i.optional()}),"resources/read":ty({ttlMs:i4().int().min(0),cacheScope:n_(["public","private"]),contents:no(nd([N,C]))}),"completion/complete":ty({completion:nl({values:no(iN()).max(100),total:i4().int().optional(),hasMore:i8().optional()}).loose()}),"server/discover":ty({ttlMs:i4().int().min(0).catch(0),cacheScope:n_(["public","private"]).catch("private"),supportedVersions:no(iN()),capabilities:eS,instructions:iN().optional()}),"subscriptions/listen":ty({})},tv=nc({"io.modelcontextprotocol/subscriptionId":n.optional()}),t_=nl({method:nS("notifications/subscriptions/acknowledged"),params:nl({_meta:tv.optional(),notifications:tu})}),tb=nl({_meta:tv.optional(),requestId:n,reason:iN().optional()}),tS=nl({method:nS("notifications/cancelled"),params:tb}),t$=t=>nl({jsonrpc:nS("2.0"),id:nd([iN(),i4().int()]),result:t}).strict();return{JSONValueSchema:t,JSONObjectSchema:r,ProgressTokenSchema:a,CursorSchema:i,RequestIdSchema:n,RoleSchema:o,LoggingLevelSchema:s,TaskMetadataSchema:c,RelatedTaskMetadataSchema:u,RequestMetaSchema:d,BaseRequestParamsSchema:p,TaskAugmentedRequestParamsSchema:m,NotificationsParamsSchema:h,NotificationSchema:f,IconSchema:y,IconsSchema:g,BaseMetadataSchema:v,ImplementationSchema:_,ClientTasksCapabilitySchema:$,ServerTasksCapabilitySchema:w,ClientCapabilitiesSchema:k,ServerCapabilitiesSchema:x,ProgressSchema:R,ProgressNotificationParamsSchema:P,ProgressNotificationSchema:E,LoggingMessageNotificationParamsSchema:O,LoggingMessageNotificationSchema:T,ResourceContentsSchema:j,TextResourceContentsSchema:N,BlobResourceContentsSchema:C,AnnotationsSchema:I,ResourceSchema:q,ResourceTemplateSchema:z,ResourceListChangedNotificationSchema:A,ResourceUpdatedNotificationParamsSchema:M,ResourceUpdatedNotificationSchema:L,PromptArgumentSchema:D,PromptSchema:Z,PromptListChangedNotificationSchema:V,TextContentSchema:F,ImageContentSchema:U,AudioContentSchema:J,ToolUseContentSchema:H,EmbeddedResourceSchema:K,ResourceLinkSchema:B,ContentBlockSchema:W,PromptMessageSchema:G,ToolAnnotationsSchema:Y,ToolListChangedNotificationSchema:X,ModelHintSchema:Q,ModelPreferencesSchema:ee,ToolChoiceSchema:et,BooleanSchemaSchema:er,StringSchemaSchema:ea,NumberSchemaSchema:ei,UntitledSingleSelectEnumSchemaSchema:en,TitledSingleSelectEnumSchemaSchema:eo,LegacyTitledEnumSchemaSchema:es,SingleSelectEnumSchemaSchema:el,UntitledMultiSelectEnumSchemaSchema:ec,TitledMultiSelectEnumSchemaSchema:eu,MultiSelectEnumSchemaSchema:ed,EnumSchemaSchema:ep,PrimitiveSchemaDefinitionSchema:em,ElicitRequestFormParamsSchema:eh,ResourceTemplateReferenceSchema:ef,PromptReferenceSchema:ey,RootSchema:eg,ClientCapabilities2026Schema:e_,ServerCapabilities2026Schema:eS,RequestMetaEnvelopeSchema:e$,ToolSchema:ew,ToolResultContentSchema:ek,SamplingMessageContentBlockSchema:ex,SamplingMessageSchema:eR,ResultTypeSchema:eP,ResultMetaSchema:eE,ResultSchema:ej,PaginatedResultSchema:eN,CallToolResultSchema:eC,ListToolsResultSchema:eI,ListPromptsResultSchema:eq,GetPromptResultSchema:ez,ListResourcesResultSchema:eA,ListResourceTemplatesResultSchema:eM,ReadResourceResultSchema:eL,CompleteResultSchema:eD,CacheableResultSchema:eZ,DiscoverResultSchema:eV,CreateMessageRequestParamsSchema:eF,CreateMessageRequestSchema:eU,ListRootsRequestSchema:eJ,CreateMessageResultSchema:eH,ListRootsResultSchema:eK,ElicitResultSchema:eB,ElicitRequestURLParamsSchema:eW,ElicitRequestParamsSchema:eG,ElicitRequestSchema:eY,InputRequestSchema:eX,InputResponseSchema:eQ,InputRequestsSchema:e0,InputResponsesSchema:e1,InputRequiredResultSchema:e2,InputResponseRequestParamsSchema:e4,CallToolRequestSchema:te,ListToolsRequestSchema:tt,ListPromptsRequestSchema:tr,GetPromptRequestSchema:ta,ListResourcesRequestSchema:ti,ListResourceTemplatesRequestSchema:tn,ReadResourceRequestSchema:to,CompleteRequestSchema:tl,DiscoverRequestSchema:tc,SubscriptionFilterSchema:tu,SubscriptionsListenRequestSchema:tp,SubscriptionsListenResultMetaSchema:tm,SubscriptionsListenResultSchema:th,dispatchRequestSchemas:tf,dispatchResultSchemas:tg,NotificationMetaSchema:tv,SubscriptionsAcknowledgedNotificationSchema:t_,CancelledNotificationParamsSchema:tb,CancelledNotificationSchema:tS,notificationSchemas2026:{"notifications/cancelled":tS,"notifications/progress":E,"notifications/message":T,"notifications/resources/updated":L,"notifications/resources/list_changed":A,"notifications/tools/list_changed":X,"notifications/prompts/list_changed":V,"notifications/subscriptions/acknowledged":t_},JSONRPCResultResponseSchema:t$(ej),CallToolResultResponseSchema:t$(nd([eC,e2])),ListToolsResultResponseSchema:t$(eI),ListPromptsResultResponseSchema:t$(eq),GetPromptResultResponseSchema:t$(nd([ez,e2])),ListResourcesResultResponseSchema:t$(eA),ListResourceTemplatesResultResponseSchema:t$(eM),ReadResourceResultResponseSchema:t$(nd([eL,e2])),CompleteResultResponseSchema:t$(eD),DiscoverResultResponseSchema:t$(eV)}}()}let ca=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"],ci=Symbol("modelcontextprotocol.resultCacheHintFallback");function cn(t,r){if(void 0===r)return t;let a=t[ci];if(void 0===a)return{...t,[ci]:r};let i={},n=a.ttlMs??r.ttlMs;void 0!==n&&(i.ttlMs=n);let o=a.cacheScope??r.cacheScope;return void 0!==o&&(i.cacheScope=o),{...t,[ci]:i}}function co(t){return"number"==typeof t&&Number.isSafeInteger(t)&&t>=0}function cs(t){return"public"===t||"private"===t}function cl(t,r){if(void 0!==t.ttlMs&&!co(t.ttlMs))throw RangeError(`Invalid cache hint for ${r}: ttlMs must be a non-negative safe integer (got ${String(t.ttlMs)})`);if(void 0!==t.cacheScope&&!cs(t.cacheScope))throw RangeError(`Invalid cache hint for ${r}: cacheScope must be 'public' or 'private' (got ${String(t.cacheScope)})`)}let cc=((k={})[k.ParseError=-32700]="ParseError",k[k.InvalidRequest=-32600]="InvalidRequest",k[k.MethodNotFound=-32601]="MethodNotFound",k[k.InvalidParams=-32602]="InvalidParams",k[k.InternalError=-32603]="InternalError",k[k.ResourceNotFound=-32002]="ResourceNotFound",k[k.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",k[k.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",k[k.UrlElicitationRequired=-32042]="UrlElicitationRequired",k);var cu=class t extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return lL(this,t)}static isInstance(t){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return lL(this,t)}constructor(t,r,a){super(r),this.code=t,this.data=a,this.name="ProtocolError",lM(this,new.target)}static fromError(r,a,i){return r===cc.UrlElicitationRequired&&i&&i.elicitations?new cp(i.elicitations,a):r===cc.UnsupportedProtocolVersion&&i&&Array.isArray(i.supported)&&"string"==typeof i.requested?new cm({supported:i.supported,requested:i.requested},a):(r===cc.InvalidParams||r===cc.ResourceNotFound)&&"string"==typeof i?.uri&&(r===cc.ResourceNotFound||1===Object.keys(i).length)?new cd(i.uri,a):r===cc.MissingRequiredClientCapability&&i&&null!==i.requiredCapabilities&&"object"==typeof i.requiredCapabilities&&!Array.isArray(i.requiredCapabilities)?new ch({requiredCapabilities:i.requiredCapabilities},a):new t(r,a,i)}},cd=class extends cu{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(t,r=`Resource not found: ${t}`){super(cc.InvalidParams,r,{uri:t})}get uri(){return this.data.uri}},cp=class extends cu{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(cc.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}},cm=class extends cu{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(t,r=`Unsupported protocol version: ${t.requested}`){super(cc.UnsupportedProtocolVersion,r,t)}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(t,r=`Missing required client capabilities: ${Object.keys(t.requiredCapabilities).join(", ")}`){super(cc.MissingRequiredClientCapability,r,t)}get requiredCapabilities(){return this.data.requiredCapabilities}};let cf=["tools/call","prompts/get","resources/read"],cy=["elicitation/create","sampling/createMessage","roots/list"];function cg(){if(s)return s;let t=cr();return s={request:{"elicitation/create":nl({method:nS("elicitation/create"),params:t.ElicitRequestParamsSchema}),"sampling/createMessage":nl({method:nS("sampling/createMessage"),params:t.CreateMessageRequestParamsSchema}),"roots/list":nl({method:nS("roots/list"),params:nc({}).optional()})},response:{"elicitation/create":t.ElicitResultSchema,"sampling/createMessage":t.CreateMessageResultSchema,"roots/list":t.ListRootsResultSchema}}}function cv(t){return cy.includes(t)}function c_(t){return cv(t)?cg().request[t]: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$(t){return Object.prototype.hasOwnProperty.call(cb,t)}function cw(t){return Object.prototype.hasOwnProperty.call(cS,t)}function ck(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function cx(t,r){if(void 0===t)return{ok:!1,reason:"not-in-era"};let a=t.safeParse(r);return a.success?{ok:!0,value:a.data}:{ok:!1,reason:"invalid",message:String(a.error)}}Object.keys(cb),Object.keys(cS);let cR={ok:!1,reason:"not-in-era"},cP=[nF,nH],cE={era:"2026-07-28",hasRequestMethod:c$,hasNotificationMethod:cw,hasInputRequestMethod:t=>void 0!==c_(t),validateRequest:(t,r)=>cx(c$(t)?cr().dispatchRequestSchemas[t]:void 0,r),validateResult:(t,r)=>cx(Object.prototype.hasOwnProperty.call(cb,t)?cr().dispatchResultSchemas[t]:void 0,r),validateNotification:(t,r)=>cx(cw(t)?cr().notificationSchemas2026[t]:void 0,r),validateInputRequest:(t,r)=>cx(c_(t),r),validateInputResponse:(t,r)=>cx(cv(t)?cg().response[t]:void 0,r),samplingResultVariant:()=>cR,outboundEnvelope:t=>({[nF]:t.protocolVersion,[nU]:t.clientInfo,[nH]:t.clientCapabilities,...void 0!==t.logLevel&&{[nB]:t.logLevel}}),validateEnvelopeMeta(t){let r=[];for(let a of cP)a in t||r.push({key:a,problem:"missing"});let a=cr().RequestMetaEnvelopeSchema.safeParse(t);if(!a.success)for(let t of a.error.issues){let a=t.path.map(String),i=a.length>0?a.join("."):"_meta";1===a.length&&r.some(t=>t.key===i&&"missing"===t.problem)||r.push({key:i,problem:t.message})}return r},projectCallToolResult:t=>lK(t),inputRequestSchema:c_,decodeResult(t,r){if(!ck(r))return{kind:"invalid",error:new lZ(lD.InvalidResult,`Invalid result for ${t}: not an object`,{method:t})};let a=r.resultType;if(void 0===a)return{kind:"invalid",error:new lZ(lD.InvalidResult,`Invalid result for ${t}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:t,violation:"missing-resultType"})};if("string"!=typeof a)return{kind:"invalid",error:new lZ(lD.InvalidResult,`Invalid result for ${t}: non-string resultType`,{method:t,resultType:a})};if("input_required"===a){let a=r.inputRequests,i=ck(a)?a:{},n=r.requestState;return 0===Object.keys(i).length&&"string"!=typeof n?{kind:"invalid",error:new lZ(lD.InvalidResult,`Invalid result for ${t}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:t,violation:"input-required-missing-both"})}:{kind:"input_required",inputRequests:i,..."string"==typeof n&&{requestState:n}}}if("complete"!==a)return{kind:"invalid",error:new lZ(lD.UnsupportedResultType,`Unsupported result type '${a}' for ${t}`,{resultType:a,method:t})};let i=function(){if(l)return l;let t=cr();return l={"tools/call":t.CallToolResultSchema,"tools/list":t.ListToolsResultSchema,"prompts/get":t.GetPromptResultSchema,"prompts/list":t.ListPromptsResultSchema,"resources/list":t.ListResourcesResultSchema,"resources/templates/list":t.ListResourceTemplatesResultSchema,"resources/read":t.ReadResourceResultSchema,"completion/complete":t.CompleteResultSchema,"server/discover":t.DiscoverResultSchema}}(),n=Object.hasOwn(i,t)?i[t]:void 0;if(void 0!==n){let a=n.safeParse(r);if(!a.success)return{kind:"invalid",error:new lZ(lD.InvalidResult,`Invalid result for ${t}: ${a.error}`,{method:t})}}let o={...r};return delete o.resultType,{kind:"complete",result:o}},encodeResult:(t,r,a)=>(function(t,r){if(void 0===r)return t;let a=t._meta;return void 0===a?{...t,_meta:{[nJ]:r}}:null===a||"object"!=typeof a||Array.isArray(a)||void 0!==a[nJ]?t:{...t,_meta:{...a,[nJ]:r}}})(function(t,r){var a,i;let n=r[ci];if("complete"!==r.resultType||!ca.includes(t)){let t;return void 0===n?r:(t={...r},delete t[ci],t)}let o=co(r.ttlMs)?r.ttlMs:void 0!==(a=n)&&co(a.ttlMs)?a.ttlMs:0,s=cs(r.cacheScope)?r.cacheScope:void 0!==(i=n)&&cs(i.cacheScope)?i.cacheScope:"private",l={...r,ttlMs:o,cacheScope:s};return delete l[ci],l}(t,function(t,r){let a=r.resultType;if(void 0===a)return{...r,resultType:"complete"};if("complete"===a||cf.includes(t))return r;throw new cu(cc.InternalError,`Handler for ${t} returned resultType '${String(a)}', but results of ${t} only support 'complete' on protocol revision 2026-07-28`)}(t,function(t,r){let a=r,i=!1,n=()=>(i||(a={...a},i=!0),a),o=r.tools;"tools/list"===t&&Array.isArray(o)&&o.some(t=>ck(t)&&"execution"in t)&&(n().tools=o.map(t=>{if(!ck(t)||!("execution"in t))return t;let r={...t};return delete r.execution,r}));let s=r.capabilities;if(ck(s)&&"tasks"in s){let t={...s};delete t.tasks,n().capabilities=t}return a}(t,r))),a),encodeErrorCode:t=>-32002===t?-32602:t,checkInboundEnvelope(t){if(void 0===t.envelope)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let r=cr().RequestMetaEnvelopeSchema.safeParse(t.envelope);if(!r.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${r.error.issues.map(t=>t.message).join("; ")}`}},cO="2026-07-28";function cT(t){return void 0!==t&&t>=lU?cE:ct}function cj(t){return void 0!==t.revision?cT(t.revision).era:"modern"===t.era?cE.era:ct.era}function cN(t){return cI.some(r=>r.hasRequestMethod(t))}function cC(t){return cI.some(r=>r.hasNotificationMethod(t))}let cI=[ct,cE];function cq(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function cz(t){if(!cq(t))return;let r=t._meta;return cq(r)?r:void 0}function cA(t){let r=cz(t);return void 0!==r&&nF in r}function cM(t){let r=cz(t)?.[nF];return"string"==typeof r?r:void 0}function cL(t){return cT(cO).validateEnvelopeMeta(t)}var cD=((t,r)=>{let a={};for(var i in t)M(a,i,{get:t[i],enumerable:!0});return r&&M(a,Symbol.toStringTag,{value:"Module"}),a})({AnnotationsSchema:()=>oM,AudioContentSchema:()=>si,BaseMetadataSchema:()=>op,BaseRequestParamsSchema:()=>n9,BlobResourceContentsSchema:()=>oz,BooleanSchemaSchema:()=>sL,CallToolRequestParamsSchema:()=>s_,CallToolRequestSchema:()=>sb,CallToolResultSchema:()=>sg,CancelTaskRequestSchema:()=>lf,CancelTaskResultSchema:()=>ly,CancelledNotificationParamsSchema:()=>ol,CancelledNotificationSchema:()=>oc,ClientCapabilitiesSchema:()=>ov,ClientNotificationSchema:()=>lv,ClientRequestSchema:()=>lg,ClientResultSchema:()=>l_,ClientTasksCapabilitySchema:()=>oy,CompatibilityCallToolResultSchema:()=>sv,CompleteRequestParamsSchema:()=>s3,CompleteRequestSchema:()=>s5,CompleteResultSchema:()=>s8,ContentBlockSchema:()=>sl,CreateMessageRequestParamsSchema:()=>sq,CreateMessageRequestSchema:()=>sz,CreateMessageResultSchema:()=>sA,CreateMessageResultWithToolsSchema:()=>sM,CreateTaskResultSchema:()=>lo,CursorSchema:()=>nQ,DiscoverRequestSchema:()=>ok,DiscoverResultSchema:()=>ox,ElicitRequestFormParamsSchema:()=>sY,ElicitRequestParamsSchema:()=>sQ,ElicitRequestSchema:()=>s0,ElicitRequestURLParamsSchema:()=>sX,ElicitResultSchema:()=>s9,ElicitationCompleteNotificationParamsSchema:()=>s1,ElicitationCompleteNotificationSchema:()=>s2,EmbeddedResourceSchema:()=>so,EmptyResultSchema:()=>os,EnumSchemaSchema:()=>sW,GetPromptRequestParamsSchema:()=>se,GetPromptRequestSchema:()=>st,GetPromptResultSchema:()=>su,GetTaskPayloadRequestSchema:()=>ld,GetTaskPayloadResultSchema:()=>lp,GetTaskRequestSchema:()=>lc,GetTaskResultSchema:()=>lu,IconSchema:()=>ou,IconsSchema:()=>od,ImageContentSchema:()=>sa,ImplementationSchema:()=>om,InitializeRequestParamsSchema:()=>o_,InitializeRequestSchema:()=>ob,InitializeResultSchema:()=>o$,InitializedNotificationSchema:()=>ow,JSONArraySchema:()=>nY,JSONObjectSchema:()=>nG,JSONRPCErrorResponseSchema:()=>oi,JSONRPCMessageSchema:()=>on,JSONRPCNotificationSchema:()=>or,JSONRPCRequestSchema:()=>ot,JSONRPCResponseSchema:()=>oo,JSONRPCResultResponseSchema:()=>oa,JSONValueSchema:()=>nW,LegacyTitledEnumSchemaSchema:()=>sU,ListChangedOptionsBaseSchema:()=>s$,ListPromptsRequestSchema:()=>o8,ListPromptsResultSchema:()=>o7,ListResourceTemplatesRequestSchema:()=>oF,ListResourceTemplatesResultSchema:()=>oU,ListResourcesRequestSchema:()=>oZ,ListResourcesResultSchema:()=>oV,ListRootsRequestSchema:()=>le,ListRootsResultSchema:()=>lt,ListTasksRequestSchema:()=>lm,ListTasksResultSchema:()=>lh,ListToolsRequestSchema:()=>sf,ListToolsResultSchema:()=>sy,LoggingLevelSchema:()=>sw,LoggingMessageNotificationParamsSchema:()=>sR,LoggingMessageNotificationSchema:()=>sP,ModelHintSchema:()=>sE,ModelPreferencesSchema:()=>sO,MultiSelectEnumSchemaSchema:()=>sB,NotificationSchema:()=>n5,NotificationsParamsSchema:()=>n3,NumberSchemaSchema:()=>sZ,PaginatedRequestParamsSchema:()=>oT,PaginatedRequestSchema:()=>oj,PaginatedResultSchema:()=>oN,PingRequestSchema:()=>oR,PrimitiveSchemaDefinitionSchema:()=>sG,ProgressNotificationParamsSchema:()=>oE,ProgressNotificationSchema:()=>oO,ProgressSchema:()=>oP,ProgressTokenSchema:()=>nX,PromptArgumentSchema:()=>o3,PromptListChangedNotificationSchema:()=>sd,PromptMessageSchema:()=>sc,PromptReferenceSchema:()=>s6,PromptSchema:()=>o5,ReadResourceRequestParamsSchema:()=>oJ,ReadResourceRequestSchema:()=>oH,ReadResourceResultSchema:()=>oK,RelatedTaskMetadataSchema:()=>n1,RequestIdSchema:()=>oe,RequestMetaSchema:()=>n2,RequestSchema:()=>n6,ResourceContentsSchema:()=>oC,ResourceLinkSchema:()=>ss,ResourceListChangedNotificationSchema:()=>oB,ResourceRequestParamsSchema:()=>oJ,ResourceSchema:()=>oL,ResourceTemplateReferenceSchema:()=>s4,ResourceTemplateSchema:()=>oD,ResourceUpdatedNotificationParamsSchema:()=>o4,ResourceUpdatedNotificationSchema:()=>o6,ResultMetaObjectSchema:()=>n8,ResultSchema:()=>n7,RoleSchema:()=>oA,RootSchema:()=>s7,RootsListChangedNotificationSchema:()=>lr,SamplingContentSchema:()=>sN,SamplingMessageContentBlockSchema:()=>sC,SamplingMessageSchema:()=>sI,ServerCapabilitiesSchema:()=>oS,ServerNotificationSchema:()=>lS,ServerRequestSchema:()=>lb,ServerResultSchema:()=>l$,ServerTasksCapabilitySchema:()=>og,SetLevelRequestParamsSchema:()=>sk,SetLevelRequestSchema:()=>sx,SingleSelectEnumSchemaSchema:()=>sJ,StringSchemaSchema:()=>sD,SubscribeRequestParamsSchema:()=>oJ,SubscribeRequestSchema:()=>oW,SubscriptionFilterSchema:()=>oY,SubscriptionsAcknowledgedNotificationParamsSchema:()=>o0,SubscriptionsAcknowledgedNotificationSchema:()=>o1,SubscriptionsListenRequestParamsSchema:()=>oX,SubscriptionsListenRequestSchema:()=>oQ,SubscriptionsListenResultMetaSchema:()=>o2,SubscriptionsListenResultSchema:()=>o9,TaskAugmentedRequestParamsSchema:()=>n4,TaskCreationParamsSchema:()=>la,TaskMetadataSchema:()=>n0,TaskSchema:()=>ln,TaskStatusNotificationParamsSchema:()=>ls,TaskStatusNotificationSchema:()=>ll,TaskStatusSchema:()=>li,TextContentSchema:()=>sr,TextResourceContentsSchema:()=>oI,TitledMultiSelectEnumSchemaSchema:()=>sK,TitledSingleSelectEnumSchemaSchema:()=>sF,ToolAnnotationsSchema:()=>sp,ToolChoiceSchema:()=>sT,ToolExecutionSchema:()=>sm,ToolListChangedNotificationSchema:()=>sS,ToolResultContentSchema:()=>sj,ToolSchema:()=>sh,ToolUseContentSchema:()=>sn,UnsubscribeRequestParamsSchema:()=>oJ,UnsubscribeRequestSchema:()=>oG,UntitledMultiSelectEnumSchemaSchema:()=>sH,UntitledSingleSelectEnumSchemaSchema:()=>sV});let cZ=t=>ot.safeParse(t).success,cV=t=>"object"==typeof t&&null!==t&&!Array.isArray(t)&&"input_required"===t.resultType,cF="x-mcp-header",cU=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,cJ=new Set(["string","integer","boolean","number"]),cH=["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 cB(t){return 0===t.length?"<root>":t.join(".")}function cW(t,r,a,i,n){return{kind:"reject",rung:t,cell:r,httpStatus:a,code:i.code,message:i.message,...void 0!==i.data&&{data:i.data},settled:n}}function cG(t){if(!cA(t))return!1;let r=cM(t);if(void 0===r||!(r>=lU))return!1;let a=cz(t);return void 0!==a&&0===cL(a).length}cc.InvalidRequest,cc.UnsupportedProtocolVersion,cc.InvalidParams,cc.MethodNotFound,cc.InvalidParams,cc.MissingRequiredClientCapability,cc.ParseError,cc.InvalidRequest,cc.MethodNotFound,cc.UnsupportedProtocolVersion,cc.MissingRequiredClientCapability;function cY(t){return new Set(t.flatMap(t=>Object.keys(t.shape)))}function cX(t){if(null==t)return!1;let r=typeof t;return("object"===r||"function"===r)&&"~standard"in t&&"function"==typeof t["~standard"]?.validate}let cQ=!1,c0="draft-2020-12";function c1(t,r="input"){let a,i=t["~standard"];if(i.jsonSchema)a=i.jsonSchema[r]({target:c0});else if("zod"===i.vendor){if(!("_zod"in t))throw Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");cQ||(cQ=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),a=a3(t,{target:c0,io:r})}else throw Error(`Schema library "${i.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if("output"===r)return void 0!==a.type||!function t(r){if("properties"in r||"patternProperties"in r||"additionalProperties"in r||"required"in r)return!0;for(let a of["oneOf","anyOf","allOf"]){let i=r[a];if(Array.isArray(i)&&i.length>0)return i.every(r=>null!==r&&"object"==typeof r&&("object"===r.type||t(r)))}return!1}(a)?a:{type:"object",...a};if(void 0!==a.type&&"object"!==a.type)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(a.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...a}}async function c2(t,r){let a=await t["~standard"].validate(r);return a.issues&&a.issues.length>0?{success:!1,error:a.issues.map(t=>t.path?.length?`${t.path.map(t=>String("object"==typeof t?t.key:t)).join(".")}: ${t.message}`:t.message).join(", ")}:{success:!0,data:a.value}}let c9=/\\\.\\d\{(\d+)\}/;function c4(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}let c6=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function c3(t){return c6.has(t)||t.startsWith("x-")}let c5=new Set(["$schema",...Object.keys(sY.shape.requestedSchema.shape)]),c8={string:cY([sD,sV,sF,sU]),number:cY([sZ]),integer:cY([sZ]),boolean:cY([sL]),array:cY([sH,sK])},c7=new Set(sD.shape.format.unwrap().options);Object.assign(function(t){let r=void 0!==t.inputRequests&&Object.keys(t.inputRequests).length>0,a="string"==typeof t.requestState;if(!r&&!a)throw TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...void 0!==t.inputRequests&&{inputRequests:t.inputRequests},...void 0!==t.requestState&&{requestState:t.requestState}}},{elicit(t){try{return{method:"elicitation/create",params:function(t){var r;if(!cX(t.requestedSchema))return{...t,mode:"form",requestedSchema:t.requestedSchema};let a=t.requestedSchema["~standard"].vendor,i=function(t,r){let a={},i=[];for(let[n,o]of Object.entries(t))"properties"===n&&c4(o)?a[n]=Object.fromEntries(Object.entries(o).map(([t,a])=>[t,function(t,r,a,i){if(!c4(t))return t;let n="string"==typeof t.type&&Object.hasOwn(c8,t.type)?c8[t.type]:void 0;if(void 0===n)return t;let o={};for(let[l,c]of Object.entries(t))if(n.has(l)||c3(l))o[l]=c;else if("pattern"===l&&"string"===t.type&&"string"==typeof t.format)if(c7.has(t.format)){var s;"string"==typeof c&&(s=t.format,"zod"!==a||(function(t,r){let a;switch(t){case"email":a=[r0(iM,void 0)];break;case"uri":a=[r1(iZ,void 0)];break;case"date":a=[r9(iq,void 0)];break;case"date-time":let i,n;i=c9.exec(r),n=[void 0,-1,0],i&&n.push(Number(i[1])),a=[!1,!0].flatMap(t=>[!1,!0].flatMap(r=>n.map(a=>r2(iI,{local:t,offset:r,precision:a}))))}return new Set(a.map(t=>{let r;return r=a3(t,{target:c0,io:"input"}),"string"==typeof r.pattern?r.pattern:void 0}).filter(t=>void 0!==t))})(s,c).has(c))||i.push(`${r}.${l}`)}else o[l]=c;else i.push(`${r}.${l}`);return o}(a,`properties.${t}`,r,i)])):c5.has(n)?a[n]=o:c3(n)||i.push(n);if(i.length>0)throw new cu(cc.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${i.join(", ")}`);return a}(function(t){try{return c1(t,"input")}catch(r){let t=r instanceof Error?r.message:String(r);throw new cu(cc.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}(t.requestedSchema),a),n=(r=sY.shape.requestedSchema,iv(r,i));if(!n.success)throw new cu(cc.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${function(t,r){if(!c4(t.properties))return r;let a=Object.entries(t.properties).filter(([,t])=>!iv(sG,t).success).map(([t])=>`properties.${t}`);return a.length>0?a.join(", "):r}(i,n.error.message)}`);let o=function t(r,a,i=""){return Array.isArray(r)&&Array.isArray(a)?r.flatMap((r,n)=>t(r,a[n],`${i}[${n}]`)):c4(r)&&c4(a)?Object.entries(r).flatMap(([r,n])=>{let o=i?`${i}.${r}`:r;return Object.prototype.hasOwnProperty.call(a,r)?t(n,a[r],o):c3(r)?[]:[o]}):[]}(i,n.data);if(o.length>0)throw new cu(cc.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${o.join(", ")}`);let s=(n.data.required??[]).filter(t=>!Object.prototype.hasOwnProperty.call(n.data.properties,t));if(s.length>0)throw new cu(cc.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${s.join(", ")}`);return{...t,mode:"form",requestedSchema:n.data}}(t)}}catch(t){throw t instanceof cu?TypeError(t.message,{cause:t}):t}},elicitUrl:t=>({method:"elicitation/create",params:{...t,mode:"url"}}),createMessage:t=>({method:"sampling/createMessage",params:t}),listRoots:()=>({method:"roots/list"})});let ue={},ut={};function ur(t,r){let a=t.slice(0,-6);ue[a]=r,ut[a]=t=>r.safeParse(t).success}for(let t of["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"])ur(t,cD[t]);for(let[t,r]of Object.entries({IdJagTokenExchangeResponseSchema:lO,OAuthClientInformationFullSchema:lI,OAuthClientInformationSchema:lC,OAuthClientMetadataSchema:lN,OAuthClientRegistrationErrorSchema:lq,OAuthErrorResponseSchema:lT,OAuthMetadataSchema:lx,OAuthProtectedResourceMetadataSchema:lk,OAuthTokenRevocationRequestSchema:lz,OAuthTokensSchema:lE,OpenIdProviderDiscoveryMetadataSchema:lP,OpenIdProviderMetadataSchema:lR}))ur(t,r);let ua=Object.freeze(ue);Object.freeze(ut);let ui=[nF,nU,nH,nB],un=["inputResponses","requestState"];function uo(t,r){let a=t.params;if(!ud(a))return{message:t,lifted:{}};let i=a._meta,n=ud(i)?ui.filter(t=>t in i):[],o="request"===r?un.filter(t=>t in a):[];if(0===n.length&&0===o.length)return{message:t,lifted:{}};let s={},l={...a};if(n.length>0&&ud(i)){let t={},r={...i};for(let a of n)t[a]=i[a],delete r[a];s.envelope=t,Object.keys(r).length>0?l._meta=r:delete l._meta}for(let t of o)"inputResponses"===t&&(s.inputResponses=l[t]),"requestState"===t&&(s.requestState=l[t]),delete l[t];return{message:{...t,params:l},lifted:s}}function us(t,r){let a=t.validateResult(r,void 0);if(a.ok||"not-in-era"!==a.reason)return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(a){let i=t.validateResult(r,a);return i.ok?{value:i.value}:{issues:[{message:"invalid"===i.reason?i.message:`not-in-era: ${r}`}]}}}}}let ul=(x=void 0,()=>x);function uc(t,r){return{...t,mcpReq:{...t.mcpReq,requestState:()=>r}}}var uu=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{c=(t,r)=>{t._negotiatedProtocolVersion=r}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(t){this._options=t,this._supportedProtocolVersions=t?.supportedProtocolVersions??nV,this.setNotificationHandler("notifications/cancelled",t=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",t=>{this._onprogress(t)}),this.setRequestHandler("ping",t=>({}))}_shouldDropInbound(t){}_outboundMetaEnvelope(){}_envelopeOutbound(t){let r=this._outboundMetaEnvelope();if(void 0===r)return t;let a=t.params??{};return{...t,params:{...a,_meta:{...r,...a._meta}}}}_resolveNonCompleteResult(t,r){return Promise.reject(new lZ(lD.UnsupportedResultType,`Unsupported result type '${t.kind}' for ${r.request.method}`,{resultType:t.kind,method:r.request.method}))}_getRequestHandler(t){return this._requestHandlers.get(t)}async _oncancel(t){t.params.requestId&&this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,a,i,n=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:a,resetTimeoutOnProgress:n,onTimeout:i})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let a=Date.now()-r.startTime;if(r.maxTotalTimeout&&a>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),new lZ(lD.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:a});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{try{r?.()}finally{this._onclose()}};let a=this.transport?.onerror;this._transport.onerror=t=>{a?.(t),this._onerror(t)};let i=this._transport?.onmessage;this._transport.onmessage=(t,r)=>{if(i?.(t,r),oa.safeParse(t).success||oi.safeParse(t).success)this._onresponse(t);else if(cZ(t))this._onrequest(t,r);else or.safeParse(t).success?this._onnotification(t,r):this._onerror(Error(`Unknown message type: ${JSON.stringify(t)}`))},t.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let t=this._responseHandlers;for(let t of(this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._timeoutInfo.values()))clearTimeout(t.timeoutId);this._timeoutInfo.clear();let r=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let a=new lZ(lD.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let r of t.values())r(a);for(let t of r.values())t.abort(a)}}_onerror(t){this.onerror?.(t)}_onnotification(t,r){let{message:a}=uo(t,"notification"),i=this._negotiatedWireCodec();if(r?.classification===void 0&&"drop"===this._shouldDropInbound(t))return;if(r?.classification!==void 0){let t=cj(r.classification);if(t!==i.era)return void this._onerror(Error(`Era mismatch on inbound notification '${a.method}': classified as ${t} but this instance serves ${i.era}`))}if(cC(a.method)&&!i.hasNotificationMethod(a.method))return;let n=this._notificationHandlers.get(a.method),o=this.fallbackNotificationHandler;(void 0!==n||void 0!==o)&&Promise.resolve().then(()=>void 0===n?o(a):n(a,i)).catch(t=>this._onerror(Error(`Uncaught error in notification handler: ${t}`)))}_onrequest(t,r){var a;let{message:i,lifted:n}=uo(t,"request"),o=this._negotiatedWireCodec();if(r?.classification===void 0&&"drop"===this._shouldDropInbound(t))return void this._onerror(Error(`Dropped inbound request '${t.method}': not servable on this connection's protocol era`));let s=this._transport,l=(t,r,a)=>{let n={jsonrpc:"2.0",id:i.id,error:{code:t,message:r,...void 0!==a&&{data:a}}};s?.send(n).catch(t=>this._onerror(Error(`Failed to send an error response: ${t}`)))};if(r?.classification!==void 0){let t=cj(r.classification);if(t!==o.era){this._onerror(Error(`Era mismatch on inbound request '${i.method}': classified as ${t} but this instance serves ${o.era}`));let a=r.classification.revision??t;l(cc.UnsupportedProtocolVersion,`Unsupported protocol version: ${a}`,{supported:this._supportedProtocolVersions,requested:a});return}}if(cN(i.method)&&!o.hasRequestMethod(i.method))return void l(cc.MethodNotFound,"Method not found");let c=this._requestHandlers.get(i.method)??this.fallbackRequestHandler;if(void 0===c)return void l(cc.MethodNotFound,"Method not found");let u=o.checkInboundEnvelope(n);if(void 0!==u)return void l(cc.InvalidParams,u);let d=(t,r)=>this._notificationViaCodec(this._resolveOutboundCodec(t.method),t,{...r,relatedRequestId:i.id}),p=(t,r,a)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(t.method),t,r,{...a,relatedRequestId:i.id}),m=new AbortController;this._requestHandlerAbortControllers.set(i.id,m);let h=void 0===n.inputResponses?void 0:function(t){let r={},a=[];if(!up(t))return{accepted:r,droppedKeys:a};for(let[i,n]of Object.entries(t)){if(!up(n)||"method"in n||"result"in n){a.push(i);continue}r[i]=n}return{accepted:r,droppedKeys:a}}(n.inputResponses),f={sessionId:s?.sessionId,mcpReq:{id:i.id,method:i.method,_meta:i.params?._meta,...void 0!==n.envelope&&{envelope:n.envelope},...void 0!==h&&{inputResponses:h.accepted},...void 0!==h&&h.droppedKeys.length>0&&{droppedInputResponseKeys:h.droppedKeys},requestState:void 0===n.requestState?ul:(a=n.requestState,()=>a),signal:m.signal,send:(t,r,a)=>{let i=this._resolveOutboundCodec(t.method);if(this._assertOutboundRequestInEra(i,t.method),cX(r))return p(t,r,a);let n=us(i,t.method);if(void 0===n)throw TypeError(`'${t.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return p(t,n,r)},notify:d},http:r?.authInfo?{authInfo:r.authInfo}:void 0},y=this.buildContext(f,r);Promise.resolve().then(()=>c(i,y)).then(async t=>{let r;if(m.signal.aborted)return;try{r=o.encodeResult(i.method,t,this._outboundServerInfo())}catch(t){this._onerror(Error(`Failed to encode result for ${i.method}: ${t}`)),l(cc.InternalError,"Internal error");return}let a={result:r,jsonrpc:"2.0",id:i.id};await s?.send(a)},async t=>{if(m.signal.aborted)return;let r=Number.isSafeInteger(t.code)?t.code:cc.InternalError,a={jsonrpc:"2.0",id:i.id,error:{code:o.encodeErrorCode(r),message:t.message??"Internal error",...void 0!==t.data&&{data:t.data}}};await s?.send(a)}).catch(t=>this._onerror(Error(`Failed to send response: ${t}`))).finally(()=>{this._requestHandlerAbortControllers.get(i.id)===m&&this._requestHandlerAbortControllers.delete(i.id)})}_onprogress(t){let{progressToken:r,...a}=t.params,i=Number(r),n=this._progressHandlers.get(i);if(!n)return void this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));let o=this._responseHandlers.get(i),s=this._timeoutInfo.get(i);if(s&&o&&s.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(t){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),o(t);return}n(a)}_onresponse(t){let r=Number(t.id),a=this._responseHandlers.get(r);void 0===a?this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`)):(this._responseHandlers.delete(r),this._cleanupTimeout(r),this._progressHandlers.delete(r),a(oa.safeParse(t).success?t:cu.fromError(t.error.code,t.error.message,t.error.data)))}get transport(){return this._transport}async close(){await this._transport?.close()}request(t,r,a){let i=this._resolveOutboundCodec(t.method);if(this._assertOutboundRequestInEra(i,t.method),cX(r))return this._requestWithSchemaViaCodec(i,t,r,a);let n=us(i,t.method);if(void 0===n)throw TypeError(`'${t.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(i,t,n,r)}_negotiatedWireCodec(){return cT(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(t){if(void 0===this._negotiatedProtocolVersion){let r=function(t){switch(t){case"initialize":case"notifications/initialized":return cT(void 0);case"server/discover":return cT(cO);default:return}}(t);if(r)return r}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(t,r){if(cN(r)&&!t.hasRequestMethod(r))throw new lZ(lD.MethodNotSupportedByProtocolVersion,`Method '${r}' is not supported by the negotiated protocol version (wire era ${t.era})`,{method:r,era:t.era})}_requestWithSchema(t,r,a){let i=this._resolveOutboundCodec(t.method);return this._assertOutboundRequestInEra(i,t.method),this._requestWithSchemaViaCodec(i,t,r,a)}_requestWithSchemaViaCodec(t,r,a,i){let n,o,{relatedRequestId:s,resumptionToken:l,onresumptiontoken:c,headers:u}=i??{},d=Date.now();return new Promise((p,m)=>{let h=t=>{m(t)};if(!this._transport)return void h(Error("Not connected"));if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(r.method)}catch(t){h(t);return}if(i?.signal?.aborted){let t=i.signal.reason;throw t instanceof lZ?t:new lZ(lD.RequestTimeout,String(t))}let f=t.era===cO&&!0===this._transport.hasPerRequestStream?new AbortController:void 0,y=this._requestMessageId++;o=y;let g={...r,jsonrpc:"2.0",id:y};i?.onprogress&&(this._progressHandlers.set(y,i.onprogress),g.params={...r.params,_meta:{...r.params?._meta,progressToken:y}});let v=this._envelopeOutbound(g),_=!1,b=t=>{_||(this._progressHandlers.delete(y),void 0===f?this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:y,reason:String(t)}}),{relatedRequestId:s,resumptionToken:l,onresumptiontoken:c}).catch(t=>this._onerror(Error(`Failed to send cancellation: ${t}`))):f.abort(),m(t instanceof lZ?t:new lZ(lD.RequestTimeout,String(t))))};this._responseHandlers.set(y,n=>{let o;if(!i?.signal?.aborted){if(_=!0,n instanceof Error)return m(n);try{o=t.decodeResult(r.method,n.result)}catch(t){return m(t instanceof Error?t:Error(String(t)))}if("invalid"===o.kind)return m(o.error);if("input_required"===o.kind){var s;return i?.allowInputRequired===!0?p({resultType:"input_required",inputRequests:(s=o).inputRequests,...void 0!==s.requestState&&{requestState:s.requestState}}):p(this._resolveNonCompleteResult(o,{codec:t,request:r,resultSchema:a,options:i,flowStartedAt:d,retry:(i,n)=>this._requestWithSchemaViaCodec(t,void 0===i?{method:r.method}:{method:r.method,params:i},a,n)}))}c2(a,o.result).then(t=>{t.success?p(t.data):m(new lZ(lD.InvalidResult,`Invalid result for ${r.method}: ${t.error}`))},m)}}),n=()=>b(i?.signal?.reason),i?.signal?.addEventListener("abort",n,{once:!0});let S=i?.timeout??6e4;this._setupTimeout(y,S,i?.maxTotalTimeout,()=>b(new lZ(lD.RequestTimeout,"Request timed out",{timeout:S})),i?.resetTimeoutOnProgress??!1),this._transport.send(v,{relatedRequestId:s,resumptionToken:l,onresumptiontoken:c,headers:u,requestSignal:f?.signal}).catch(t=>{this._progressHandlers.delete(y),m(t)})}).finally(()=>{n&&i?.signal?.removeEventListener("abort",n),void 0!==o&&(this._responseHandlers.delete(o),this._cleanupTimeout(o))})}async notification(t,r){return this._notificationViaCodec(this._resolveOutboundCodec(t.method),t,r)}async _notificationViaCodec(t,r,a){if(!this._transport)throw new lZ(lD.NotConnected,"Not connected");if(cC(r.method)&&!t.hasNotificationMethod(r.method))throw new lZ(lD.MethodNotSupportedByProtocolVersion,`Notification '${r.method}' is not supported by the negotiated protocol version (wire era ${t.era})`,{method:r.method,era:t.era});this.assertNotificationCapability(r.method);let i=this._envelopeOutbound({jsonrpc:"2.0",...r});if((this._options?.debouncedNotificationMethods??[]).includes(r.method)&&!r.params&&!a?.relatedRequestId){if(this._pendingDebouncedNotifications.has(r.method))return;this._pendingDebouncedNotifications.add(r.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(r.method),this._transport&&this._transport?.send(i,a).catch(t=>this._onerror(t))});return}await this._transport.send(i,a)}setRequestHandler(t,r,a){let i;if(this.assertRequestHandlerCapability(t),"function"==typeof r){if(!cN(t))throw TypeError(`'${t}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);i=(a,i)=>{let n=this._negotiatedWireCodec(),o=n.validateRequest(t,a);if(o.ok||"not-in-era"!==o.reason||(o=n.validateInputRequest(t,a)),!o.ok){if("not-in-era"===o.reason)throw new cu(cc.InternalError,`No wire schema for ${t} in the resolved era`);throw Error(o.message)}return Promise.resolve(r(o.value,i))}}else if(a)i=async(i,n)=>{let o=await c2(r.params,{...i.params});if(!o.success)throw new cu(cc.InvalidParams,`Invalid params for ${t}: ${o.error}`);return a(o.data,n)};else throw TypeError("setRequestHandler: handler is required");this._requestHandlers.set(t,this._wrapHandler(t,i))}_wrapHandler(t,r){return r}_outboundServerInfo(){}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r,a){if("function"==typeof r){if(!cC(t))throw TypeError(`'${t}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(t,(a,i)=>{let n=i.validateNotification(t,a);if(!n.ok){if("not-in-era"===n.reason)throw new cu(cc.InternalError,`No wire schema for ${t} in the resolved era`);throw Error(n.message)}return Promise.resolve(r(n.value))});return}if(!a)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(t,async i=>{let n=await c2(r.params,{...i.params});if(!n.success)throw new cu(cc.InvalidParams,`Invalid params for notification ${t}: ${n.error}`);await a(n.data,i)})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}};function ud(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function up(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}F(t=>{var r=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,a=/\\([\u000b\u0020-\u00ff])/g,i=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function n(t){this.parameters=Object.create(null),this.type=t}t.parse=function(t){if(!t)throw TypeError("argument string is required");var o,s,l,c="object"==typeof t?function(t){var r;if("function"==typeof t.getHeader?r=t.getHeader("content-type"):"object"==typeof t.headers&&(r=t.headers&&t.headers["content-type"]),"string"!=typeof r)throw TypeError("content-type header is missing from object");return r}(t):t;if("string"!=typeof c)throw TypeError("argument string is required to be a string");var u=c.indexOf(";"),d=-1!==u?c.slice(0,u).trim():c.trim();if(!i.test(d))throw TypeError("invalid media type");var p=new n(d.toLowerCase());if(-1!==u){for(r.lastIndex=u;s=r.exec(c);){if(s.index!==u)throw TypeError("invalid parameter format");u+=s[0].length,o=s[1].toLowerCase(),34===(l=s[2]).charCodeAt(0)&&-1!==(l=l.slice(1,-1)).indexOf("\\")&&(l=l.replace(a,"$1")),p.parameters[o]=l}if(u!==c.length)throw TypeError("invalid parameter format")}return p}})();var um=class{_buffer;_maxBufferSize;constructor(t){this._maxBufferSize=t?.maxBufferSize??0xa00000}append(t){if((this._buffer?.length??0)+t.length>this._maxBufferSize)throw this.clear(),Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){for(;this._buffer;){let r=this._buffer.indexOf("\n");if(-1===r)break;let a=this._buffer.toString("utf8",0,r).replace(/\r$/,"");this._buffer=this._buffer.subarray(r+1);try{var t;return t=a,on.parse(JSON.parse(t))}catch(t){if(t instanceof SyntaxError)continue;throw t}}return null}clear(){this._buffer=void 0}};let uh=/^[A-Za-z0-9._-]{1,128}$/;function uf(t){let r=function(t){let r=[];if(0===t.length)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(t.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${t.length})`]};if(t.includes(" ")&&r.push("Tool name contains spaces, which may cause parsing issues"),t.includes(",")&&r.push("Tool name contains commas, which may cause parsing issues"),(t.startsWith("-")||t.endsWith("-"))&&r.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(t.startsWith(".")||t.endsWith("."))&&r.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!uh.test(t)){let a=[...t].filter(t=>!/[A-Za-z0-9._-]/.test(t)).filter((t,r,a)=>a.indexOf(t)===r);return r.push(`Tool name contains invalid characters: ${a.map(t=>`"${t}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:r}}return{isValid:!0,warnings:r}}(t);var a=r.warnings;if(a.length>0){for(let r of(console.warn(`Tool name validation warning for "${t}":`),a))console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}return r.isValid}var uy=class t{static isTemplate(t){return/\{[^}\s]+\}/.test(t)}static validateLength(t,r,a){if(t.length>r)throw Error(`${a} exceeds maximum length of ${r} characters (got ${t.length})`)}template;parts;get variableNames(){return this.parts.flatMap(t=>"string"==typeof t?[]:t.names)}constructor(r){t.validateLength(r,1e6,"Template"),this.template=r,this.parts=this.parse(r)}toString(){return this.template}parse(r){let a=[],i="",n=0,o=0;for(;n<r.length;)if("{"===r[n]){i&&(a.push(i),i="");let s=r.indexOf("}",n);if(-1===s)throw Error("Unclosed template expression");if(++o>1e4)throw Error("Template contains too many expressions (max 10000)");let l=r.slice(n+1,s),c=this.getOperator(l),u=l.includes("*"),d=this.getNames(l),p=d[0];for(let r of d)t.validateLength(r,1e6,"Variable name");a.push({name:p,operator:c,names:d,exploded:u}),n=s+1}else i+=r[n],n++;return i&&a.push(i),a}getOperator(t){return["+","#",".","/","?","&"].find(r=>t.startsWith(r))||""}getNames(t){let r=this.getOperator(t);return t.slice(r.length).split(",").map(t=>t.replace("*","").trim()).filter(t=>t.length>0)}encodeValue(r,a){return(t.validateLength(r,1e6,"Variable value"),"+"===a||"#"===a)?encodeURI(r):encodeURIComponent(r)}expandPart(t,r){if("?"===t.operator||"&"===t.operator){let a=t.names.map(a=>{let i=r[a];return void 0===i?"":`${a}=${Array.isArray(i)?i.map(r=>this.encodeValue(r,t.operator)).join(","):this.encodeValue(i.toString(),t.operator)}`}).filter(t=>t.length>0);return 0===a.length?"":("?"===t.operator?"?":"&")+a.join("&")}if(t.names.length>1){let a=t.names.map(t=>r[t]).filter(t=>void 0!==t);return 0===a.length?"":a.map(t=>Array.isArray(t)?t[0]:t).join(",")}let a=r[t.name];if(void 0===a)return"";let i=(Array.isArray(a)?a:[a]).map(r=>this.encodeValue(r,t.operator));switch(t.operator){case"":case"+":default:return i.join(",");case"#":return"#"+i.join(",");case".":return"."+i.join(".");case"/":return"/"+i.join("/")}}expand(t){let r="",a=!1;for(let i of this.parts){if("string"==typeof i){r+=i;continue}let n=this.expandPart(i,t);n&&(r+=("?"===i.operator||"&"===i.operator)&&a?n.replace("?","&"):n,("?"===i.operator||"&"===i.operator)&&(a=!0))}return r}escapeRegExp(t){return t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}partToRegExp(r){let a,i=[];for(let a of r.names)t.validateLength(a,1e6,"Variable name");if("?"===r.operator||"&"===r.operator){for(let t=0;t<r.names.length;t++){let a=r.names[t],n=0===t?"\\"+r.operator:"&";i.push({pattern:n+this.escapeRegExp(a)+"=([^&]+)",name:a})}return i}let n=r.name;switch(r.operator){case"":a=r.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)";break;case"+":case"#":a="(.+)";break;case".":a=String.raw`\.([^/,]+)`;break;case"/":a="/"+(r.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)");break;default:a="([^/]+)"}return i.push({pattern:a,name:n}),i}match(r){t.validateLength(r,1e6,"URI");let a="^",i=[];for(let t of this.parts)if("string"==typeof t)a+=this.escapeRegExp(t);else for(let{pattern:r,name:n}of this.partToRegExp(t))a+=r,i.push({name:n,exploded:t.exploded});a+="$",t.validateLength(a,1e6,"Generated regex pattern");let n=new RegExp(a),o=r.match(n);if(!o)return null;let s={};for(let[t,r]of i.entries()){let{name:a,exploded:i}=r,n=o[t+1];s[a.replace("*","")]=i&&n.includes(",")?n.split(","):n}return s}};function ug(t){if(void 0!==t){if(function(t){if("object"!=typeof t||null===t||cX(t))return!1;let r=Object.getPrototypeOf(t);return(r===Object.prototype||null===r)&&Object.values(t).every(t=>"object"==typeof t&&null!==t&&"_zod"in t)}(t))return nl(t);if("object"==typeof t&&null!==t&&!cX(t)&&Object.values(t).some(t=>"object"==typeof t&&null!==t&&!("_zod"in t)&&"_def"in t&&"string"==typeof t._def?.typeName))throw TypeError("Raw-shape inputSchema/outputSchema/argsSchema fields must be Zod v4 schemas. Got a Zod v3 field schema. Import from `zod/v4` (or upgrade your zod import), or wrap with `z.object({...})` yourself.");if(!cX(t))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return t}}var uv=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;var r=class{};t._CodeOrName=r,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var a=class extends r{constructor(r){if(super(),!t.IDENTIFIER.test(r))throw Error("CodeGen: name must be a valid identifier");this.str=r}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};t.Name=a;var i=class extends r{constructor(t){super(),this._items="string"==typeof t?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return""===t||'""'===t}get str(){var t;return null!=(t=this._str)?t:this._str=this._items.reduce((t,r)=>`${t}${r}`,"")}get names(){var t;return null!=(t=this._names)?t:this._names=this._items.reduce((t,r)=>(r instanceof a&&(t[r.str]=(t[r.str]||0)+1),t),{})}};function n(t,...r){let a=[t[0]],o=0;for(;o<r.length;)l(a,r[o]),a.push(t[++o]);return new i(a)}t._Code=i,t.nil=new i(""),t._=n;let o=new i("+");function s(t,...r){let n=[c(t[0])],u=0;for(;u<r.length;)n.push(o),l(n,r[u]),n.push(o,c(t[++u]));return function(t){let r=1;for(;r<t.length-1;){if(t[r]===o){var i,n;let o=(i=t[r-1],'""'===(n=t[r+1])?i:'""'===i?n:"string"==typeof i?n instanceof a||'"'!==i[i.length-1]?void 0:"string"!=typeof n?`${i.slice(0,-1)}${n}"`:'"'===n[0]?i.slice(0,-1)+n.slice(1):void 0:"string"!=typeof n||'"'!==n[0]||i instanceof a?void 0:`"${i}${n.slice(1)}`);if(void 0!==o){t.splice(r-1,3,o);continue}t[r++]="+"}r++}}(n),new i(n)}function l(t,r){var n;r instanceof i?t.push(...r._items):r instanceof a?t.push(r):t.push("number"==typeof(n=r)||"boolean"==typeof n||null===n?n:c(Array.isArray(n)?n.join(","):n))}function c(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.str=s,t.addCodeArg=l,t.strConcat=function(t,r){return r.emptyStr()?t:t.emptyStr()?r:s`${t}${r}`},t.stringify=function(t){return new i(c(t))},t.safeStringify=c,t.getProperty=function(r){return"string"==typeof r&&t.IDENTIFIER.test(r)?new i(`.${r}`):n`[${r}]`},t.getEsmExportName=function(r){if("string"==typeof r&&t.IDENTIFIER.test(r))return new i(`${r}`);throw Error(`CodeGen: invalid export name: ${r}, use explicit $id name mapping`)},t.regexpCode=function(t){return new i(t.toString())}}),u_=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;let r=uv();var a,i,n=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}};(a=i||(t.UsedValueState=i={}))[a.Started=0]="Started",a[a.Completed=1]="Completed",t.varKinds={const:new r.Name("const"),let:new r.Name("let"),var:new r.Name("var")};var o=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof r.Name?t:this.name(t)}name(t){return new r.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,a;if((null==(a=null==(r=this._parent)?void 0:r._prefixes)?void 0:a.has(t))||this._prefixes&&!this._prefixes.has(t))throw Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};t.Scope=o;var s=class extends r.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:a,itemIndex:i}){this.value=t,this.scopePath=(0,r._)`.${new r.Name(a)}[${i}]`}};t.ValueScopeName=s;let l=(0,r._)`\n`;var c=class extends o{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?l:r.nil}}get(){return this._scope}name(t){return new s(t,this._newName(t))}value(t,r){var a;if(void 0===r.ref)throw Error("CodeGen: ref must be passed in value");let i=this.toName(t),{prefix:n}=i,o=null!=(a=r.key)?a:r.ref,s=this._values[n];if(s){let t=s.get(o);if(t)return t}else s=this._values[n]=new Map;s.set(o,i);let l=this._scope[n]||(this._scope[n]=[]),c=l.length;return l[c]=r.ref,i.setValue(r,{property:n,itemIndex:c}),i}getValue(t,r){let a=this._values[t];if(a)return a.get(r)}scopeRefs(t,a=this._values){return this._reduceValues(a,a=>{if(void 0===a.scopePath)throw Error(`CodeGen: name "${a}" has no value`);return(0,r._)`${t}${a.scopePath}`})}scopeCode(t=this._values,r,a){return this._reduceValues(t,t=>{if(void 0===t.value)throw Error(`CodeGen: name "${t}" has no value`);return t.value.code},r,a)}_reduceValues(a,o,s={},l){let c=r.nil;for(let u in a){let d=a[u];if(!d)continue;let p=s[u]=s[u]||new Map;d.forEach(a=>{if(p.has(a))return;p.set(a,i.Started);let s=o(a);if(s){let i=this.opts.es5?t.varKinds.var:t.varKinds.const;c=(0,r._)`${c}${i} ${a} = ${s};${this.opts._n}`}else if(s=null==l?void 0:l(a))c=(0,r._)`${c}${s}${this.opts._n}`;else throw new n(a);p.set(a,i.Completed)})}return c}};t.ValueScope=c}),ub=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;let r=uv(),a=u_();var i=uv();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return i._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return i.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return i.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return i.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return i.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return i.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return i.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return i.Name}});var n=u_();Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return n.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return n.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return n.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return n.varKinds}}),t.operators={GT:new r._Code(">"),GTE:new r._Code(">="),LT:new r._Code("<"),LTE:new r._Code("<="),EQ:new r._Code("==="),NEQ:new r._Code("!=="),NOT:new r._Code("!"),OR:new r._Code("||"),AND:new r._Code("&&"),ADD:new r._Code("+")};var o=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},s=class extends o{constructor(t,r,a){super(),this.varKind=t,this.name=r,this.rhs=a}render({es5:t,_n:r}){let i=t?a.varKinds.var:this.varKind,n=void 0===this.rhs?"":` = ${this.rhs}`;return`${i} ${this.name}${n};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=j(this.rhs,t,r)),this}get names(){return this.rhs instanceof r._CodeOrName?this.rhs.names:{}}},l=class extends o{constructor(t,r,a){super(),this.lhs=t,this.rhs=r,this.sideEffects=a}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,a){if(!(this.lhs instanceof r.Name)||t[this.lhs.str]||this.sideEffects)return this.rhs=j(this.rhs,t,a),this}get names(){return T(this.lhs instanceof r.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends l{constructor(t,r,a,i){super(t,a,i),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},u=class extends o{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},d=class extends o{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},p=class extends o{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},m=class extends o{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=j(this.code,t,r),this}get names(){return this.code instanceof r._CodeOrName?this.code.names:{}}},h=class extends o{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,a)=>r+a.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let a=t[r].optimizeNodes();Array.isArray(a)?t.splice(r,1,...a):a?t[r]=a:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:a}=this,i=a.length;for(;i--;){let n=a[i];n.optimizeNames(t,r)||(function(t,r){for(let a in r)t[a]=(t[a]||0)-(r[a]||0)}(t,n.names),a.splice(i,1))}return a.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>O(t,r.names),{})}},f=class extends h{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},y=class extends h{},g=class extends f{};g.kind="else";var v=class t extends f{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let r=this.condition;if(!0===r)return this.nodes;let a=this.else;if(a){let t=a.optimizeNodes();a=this.else=Array.isArray(t)?new g(t):t}return a?!1===r?a instanceof t?a:a.nodes:this.nodes.length?this:new t(N(r),a instanceof t?[a]:a.nodes):!1!==r&&this.nodes.length?this:void 0}optimizeNames(t,r){var a;if(this.else=null==(a=this.else)?void 0:a.optimizeNames(t,r),super.optimizeNames(t,r)||this.else)return this.condition=j(this.condition,t,r),this}get names(){let t=super.names;return T(t,this.condition),this.else&&O(t,this.else.names),t}};v.kind="if";var _=class extends f{};_.kind="for";var b=class extends _{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=j(this.iteration,t,r),this}get names(){return O(super.names,this.iteration.names)}},S=class extends _{constructor(t,r,a,i){super(),this.varKind=t,this.name=r,this.from=a,this.to=i}render(t){let r=t.es5?a.varKinds.var:this.varKind,{name:i,from:n,to:o}=this;return`for(${r} ${i}=${n}; ${i}<${o}; ${i}++)`+super.render(t)}get names(){return T(T(super.names,this.from),this.to)}},$=class extends _{constructor(t,r,a,i){super(),this.loop=t,this.varKind=r,this.name=a,this.iterable=i}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=j(this.iterable,t,r),this}get names(){return O(super.names,this.iterable.names)}},w=class extends f{constructor(t,r,a){super(),this.name=t,this.args=r,this.async=a}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};w.kind="func";var k=class extends h{render(t){return"return "+super.render(t)}};k.kind="return";var x=class extends f{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),null==(t=this.catch)||t.optimizeNodes(),null==(r=this.finally)||r.optimizeNodes(),this}optimizeNames(t,r){var a,i;return super.optimizeNames(t,r),null==(a=this.catch)||a.optimizeNames(t,r),null==(i=this.finally)||i.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&O(t,this.catch.names),this.finally&&O(t,this.finally.names),t}},R=class extends f{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};R.kind="catch";var P=class extends f{render(t){return"finally"+super.render(t)}};P.kind="finally";var E=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?"\n":""},this._extScope=t,this._scope=new a.Scope({parent:t}),this._nodes=[new y]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let a=this._extScope.value(t,r);return(this._values[a.prefix]||(this._values[a.prefix]=new Set)).add(a),a}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,a,i){let n=this._scope.toName(r);return void 0!==a&&i&&(this._constants[n.str]=a),this._leafNode(new s(t,n,a)),n}const(t,r,i){return this._def(a.varKinds.const,t,r,i)}let(t,r,i){return this._def(a.varKinds.let,t,r,i)}var(t,r,i){return this._def(a.varKinds.var,t,r,i)}assign(t,r,a){return this._leafNode(new l(t,r,a))}add(r,a){return this._leafNode(new c(r,t.operators.ADD,a))}code(t){return"function"==typeof t?t():t!==r.nil&&this._leafNode(new m(t)),this}object(...t){let a=["{"];for(let[i,n]of t)a.length>1&&a.push(","),a.push(i),(i!==n||this.opts.es5)&&(a.push(":"),(0,r.addCodeArg)(a,n));return a.push("}"),new r._Code(a)}if(t,r,a){if(this._blockNode(new v(t)),r&&a)this.code(r).else().code(a).endIf();else if(r)this.code(r).endIf();else if(a)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new v(t))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(v,g)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new b(t),r)}forRange(t,r,i,n,o=this.opts.es5?a.varKinds.var:a.varKinds.let){let s=this._scope.toName(t);return this._for(new S(o,s,r,i),()=>n(s))}forOf(t,i,n,o=a.varKinds.const){let s=this._scope.toName(t);if(this.opts.es5){let t=i instanceof r.Name?i:this.var("_arr",i);return this.forRange("_i",0,(0,r._)`${t}.length`,a=>{this.var(s,(0,r._)`${t}[${a}]`),n(s)})}return this._for(new $("of",o,s,i),()=>n(s))}forIn(t,i,n,o=this.opts.es5?a.varKinds.var:a.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,r._)`Object.keys(${i})`,n);let s=this._scope.toName(t);return this._for(new $("in",o,s,i),()=>n(s))}endFor(){return this._endBlockNode(_)}label(t){return this._leafNode(new u(t))}break(t){return this._leafNode(new d(t))}return(t){let r=new k;if(this._blockNode(r),this.code(t),1!==r.nodes.length)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(k)}try(t,r,a){if(!r&&!a)throw Error('CodeGen: "try" without "catch" and "finally"');let i=new x;if(this._blockNode(i),this.code(t),r){let t=this.name("e");this._currNode=i.catch=new R(t),r(t)}return a&&(this._currNode=i.finally=new P,this.code(a)),this._endBlockNode(R,P)}throw(t){return this._leafNode(new p(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(void 0===r)throw Error("CodeGen: not in self-balancing block");let a=this._nodes.length-r;if(a<0||void 0!==t&&a!==t)throw Error(`CodeGen: wrong number of nodes: ${a} vs ${t} expected`);return this._nodes.length=r,this}func(t,a=r.nil,i,n){return this._blockNode(new w(t,a,i)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(w)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let a=this._currNode;if(a instanceof t||r&&a instanceof r)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof v))throw Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};function O(t,r){for(let a in r)t[a]=(t[a]||0)+(r[a]||0);return t}function T(t,a){return a instanceof r._CodeOrName?O(t,a.names):t}function j(t,a,i){var n;if(t instanceof r.Name)return o(t);if(!((n=t)instanceof r._Code&&n._items.some(t=>t instanceof r.Name&&1===a[t.str]&&void 0!==i[t.str])))return t;return new r._Code(t._items.reduce((t,a)=>(a instanceof r.Name&&(a=o(a)),a instanceof r._Code?t.push(...a._items):t.push(a),t),[]));function o(t){let r=i[t.str];return void 0===r||1!==a[t.str]?t:(delete a[t.str],r)}}function N(t){return"boolean"==typeof t||"number"==typeof t||null===t?!t:(0,r._)`!${z(t)}`}t.CodeGen=E,t.not=N;let C=q(t.operators.AND);t.and=function(...t){return t.reduce(C)};let I=q(t.operators.OR);function q(t){return(a,i)=>a===r.nil?i:i===r.nil?a:(0,r._)`${z(a)} ${t} ${z(i)}`}function z(t){return t instanceof r.Name?t:(0,r._)`(${t})`}t.or=function(...t){return t.reduce(I)}}),uS=F(t=>{var r,a;Object.defineProperty(t,"__esModule",{value:!0}),t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.setEvaluated=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.schemaHasRules=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;let i=ub(),n=uv();function o(t,r=t.schema){let{opts:a,self:i}=t;if(!a.strictSchema||"boolean"==typeof r)return;let n=i.RULES.keywords;for(let a in r)n[a]||h(t,`unknown keyword: "${a}"`)}function s(t,r){if("boolean"==typeof t)return!t;for(let a in t)if(r[a])return!0;return!1}function l(t){return"number"==typeof t?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}function c(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function u({mergeNames:t,mergeToName:r,mergeValues:a,resultToName:n}){return(o,s,l,c)=>{let u=void 0===l?s:l instanceof i.Name?(s instanceof i.Name?t(o,s,l):r(o,s,l),l):s instanceof i.Name?(r(o,l,s),s):a(s,l);return c!==i.Name||u instanceof i.Name?u:n(o,u)}}function d(t,r){if(!0===r)return t.var("props",!0);let a=t.var("props",(0,i._)`{}`);return void 0!==r&&p(t,a,r),a}function p(t,r,a){Object.keys(a).forEach(a=>t.assign((0,i._)`${r}${(0,i.getProperty)(a)}`,!0))}t.toHash=function(t){let r={};for(let a of t)r[a]=!0;return r},t.alwaysValidSchema=function(t,r){return"boolean"==typeof r?r:0===Object.keys(r).length||(o(t,r),!s(r,t.self.RULES.all))},t.checkUnknownRules=o,t.schemaHasRules=s,t.schemaHasRulesButRef=function(t,r){if("boolean"==typeof t)return!t;for(let a in t)if("$ref"!==a&&r.all[a])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:t,schemaPath:r},a,n,o){if(!o){if("number"==typeof a||"boolean"==typeof a)return a;if("string"==typeof a)return(0,i._)`${a}`}return(0,i._)`${t}${r}${(0,i.getProperty)(n)}`},t.unescapeFragment=function(t){return c(decodeURIComponent(t))},t.escapeFragment=function(t){return encodeURIComponent(l(t))},t.escapeJsonPointer=l,t.unescapeJsonPointer=c,t.eachItem=function(t,r){if(Array.isArray(t))for(let a of t)r(a);else r(t)},t.mergeEvaluated={props:u({mergeNames:(t,r,a)=>t.if((0,i._)`${a} !== true && ${r} !== undefined`,()=>{t.if((0,i._)`${r} === true`,()=>t.assign(a,!0),()=>t.assign(a,(0,i._)`${a} || {}`).code((0,i._)`Object.assign(${a}, ${r})`))}),mergeToName:(t,r,a)=>t.if((0,i._)`${a} !== true`,()=>{!0===r?t.assign(a,!0):(t.assign(a,(0,i._)`${a} || {}`),p(t,a,r))}),mergeValues:(t,r)=>!0===t||{...t,...r},resultToName:d}),items:u({mergeNames:(t,r,a)=>t.if((0,i._)`${a} !== true && ${r} !== undefined`,()=>t.assign(a,(0,i._)`${r} === true ? true : ${a} > ${r} ? ${a} : ${r}`)),mergeToName:(t,r,a)=>t.if((0,i._)`${a} !== true`,()=>t.assign(a,!0===r||(0,i._)`${a} > ${r} ? ${a} : ${r}`)),mergeValues:(t,r)=>!0===t||Math.max(t,r),resultToName:(t,r)=>t.var("items",r)})},t.evaluatedPropsToName=d,t.setEvaluated=p;let m={};function h(t,r,a=t.opts.strictSchema){if(a){if(r=`strict mode: ${r}`,!0===a)throw Error(r);t.self.logger.warn(r)}}t.useFunc=function(t,r){return t.scopeValue("func",{ref:r,code:m[r.code]||(m[r.code]=new n._Code(r.code))})},(a=r||(t.Type=r={}))[a.Num=0]="Num",a[a.Str=1]="Str",t.getErrorPath=function(t,a,n){if(t instanceof i.Name){let o=a===r.Num;return n?o?(0,i._)`"[" + ${t} + "]"`:(0,i._)`"['" + ${t} + "']"`:o?(0,i._)`"/" + ${t}`:(0,i._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,i.getProperty)(t).toString():"/"+l(t)},t.checkStrictMode=h}),u$=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ub();t.default={data:new r.Name("data"),valCxt:new r.Name("valCxt"),instancePath:new r.Name("instancePath"),parentData:new r.Name("parentData"),parentDataProperty:new r.Name("parentDataProperty"),rootData:new r.Name("rootData"),dynamicAnchors:new r.Name("dynamicAnchors"),vErrors:new r.Name("vErrors"),errors:new r.Name("errors"),this:new r.Name("this"),self:new r.Name("self"),scope:new r.Name("scope"),json:new r.Name("json"),jsonPos:new r.Name("jsonPos"),jsonLen:new r.Name("jsonLen"),jsonPart:new r.Name("jsonPart")}}),uw=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;let r=ub(),a=uS(),i=u$();function n(t,a){let n=t.const("err",a);t.if((0,r._)`${i.default.vErrors} === null`,()=>t.assign(i.default.vErrors,(0,r._)`[${n}]`),(0,r._)`${i.default.vErrors}.push(${n})`),t.code((0,r._)`${i.default.errors}++`)}function o(t,a){let{gen:i,validateName:n,schemaEnv:o}=t;o.$async?i.throw((0,r._)`new ${t.ValidationError}(${a})`):(i.assign((0,r._)`${n}.errors`,a),i.return(!1))}t.keywordError={message:({keyword:t})=>(0,r.str)`must pass "${t}" keyword validation`},t.keyword$DataError={message:({keyword:t,schemaType:a})=>a?(0,r.str)`"${t}" keyword must be ${a} ($data)`:(0,r.str)`"${t}" keyword is invalid ($data)`},t.reportError=function(a,i=t.keywordError,s,c){let{it:u}=a,{gen:d,compositeRule:p,allErrors:m}=u,h=l(a,i,s);(null!=c?c:p||m)?n(d,h):o(u,(0,r._)`[${h}]`)},t.reportExtraError=function(r,a=t.keywordError,s){let{it:c}=r,{gen:u,compositeRule:d,allErrors:p}=c;n(u,l(r,a,s)),d||p||o(c,i.default.vErrors)},t.resetErrorsCount=function(t,a){t.assign(i.default.errors,a),t.if((0,r._)`${i.default.vErrors} !== null`,()=>t.if(a,()=>t.assign((0,r._)`${i.default.vErrors}.length`,a),()=>t.assign(i.default.vErrors,null)))},t.extendErrors=function({gen:t,keyword:a,schemaValue:n,data:o,errsCount:s,it:l}){if(void 0===s)throw Error("ajv implementation error");let c=t.name("err");t.forRange("i",s,i.default.errors,s=>{t.const(c,(0,r._)`${i.default.vErrors}[${s}]`),t.if((0,r._)`${c}.instancePath === undefined`,()=>t.assign((0,r._)`${c}.instancePath`,(0,r.strConcat)(i.default.instancePath,l.errorPath))),t.assign((0,r._)`${c}.schemaPath`,(0,r.str)`${l.errSchemaPath}/${a}`),l.opts.verbose&&(t.assign((0,r._)`${c}.schema`,n),t.assign((0,r._)`${c}.data`,o))})};let s={keyword:new r.Name("keyword"),schemaPath:new r.Name("schemaPath"),params:new r.Name("params"),propertyName:new r.Name("propertyName"),message:new r.Name("message"),schema:new r.Name("schema"),parentSchema:new r.Name("parentSchema")};function l(t,n,o){let{createErrors:l}=t.it;return!1===l?(0,r._)`{}`:function(t,n,o={}){let{gen:l,it:c}=t,u=[function({errorPath:t},{instancePath:n}){let o=n?(0,r.str)`${t}${(0,a.getErrorPath)(n,a.Type.Str)}`:t;return[i.default.instancePath,(0,r.strConcat)(i.default.instancePath,o)]}(c,o),function({keyword:t,it:{errSchemaPath:i}},{schemaPath:n,parentSchema:o}){let l=o?i:(0,r.str)`${i}/${t}`;return n&&(l=(0,r.str)`${l}${(0,a.getErrorPath)(n,a.Type.Str)}`),[s.schemaPath,l]}(t,o)];return function(t,{params:a,message:n},o){let{keyword:l,data:c,schemaValue:u,it:d}=t,{opts:p,propertyName:m,topSchemaRef:h,schemaPath:f}=d;o.push([s.keyword,l],[s.params,"function"==typeof a?a(t):a||(0,r._)`{}`]),p.messages&&o.push([s.message,"function"==typeof n?n(t):n]),p.verbose&&o.push([s.schema,u],[s.parentSchema,(0,r._)`${h}${f}`],[i.default.data,c]),m&&o.push([s.propertyName,m])}(t,n,u),l.object(...u)}(t,n,o)}}),uk=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;let r=uw(),a=ub(),i=u$(),n={message:"boolean schema is false"};function o(t,a){let{gen:i,data:o}=t;(0,r.reportError)({gen:i,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t},n,void 0,a)}t.topBoolOrEmptySchema=function(t){let{gen:r,schema:n,validateName:s}=t;!1===n?o(t,!1):"object"==typeof n&&!0===n.$async?r.return(i.default.data):(r.assign((0,a._)`${s}.errors`,null),r.return(!0))},t.boolOrEmptySchema=function(t,r){let{gen:a,schema:i}=t;!1===i?(a.var(r,!1),o(t)):a.var(r,!0)}}),ux=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRules=t.isJSONType=void 0;let r=new Set(["string","number","integer","boolean","null","object","array"]);t.isJSONType=function(t){return"string"==typeof t&&r.has(t)},t.getRules=function(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}}),uR=F(t=>{function r(t,r){return r.rules.some(r=>a(t,r))}function a(t,r){var a;return void 0!==t[r.keyword]||(null==(a=r.definition.implements)?void 0:a.some(r=>void 0!==t[r]))}Object.defineProperty(t,"__esModule",{value:!0}),t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0,t.schemaHasRulesForType=function({schema:t,self:a},i){let n=a.RULES.types[i];return n&&!0!==n&&r(t,n)},t.shouldUseGroup=r,t.shouldUseRule=a}),uP=F(t=>{var r,a;Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;let i=ux(),n=uR(),o=uw(),s=ub(),l=uS();function c(t){let r=Array.isArray(t)?t:t?[t]:[];if(r.every(i.isJSONType))return r;throw Error("type must be JSONType or JSONType[]: "+r.join(","))}(a=r||(t.DataType=r={}))[a.Correct=0]="Correct",a[a.Wrong=1]="Wrong",t.getSchemaTypes=function(t){let r=c(t.type);if(r.includes("null")){if(!1===t.nullable)throw Error("type: null contradicts nullable: false")}else{if(!r.length&&void 0!==t.nullable)throw Error('"nullable" cannot be used without "type"');!0===t.nullable&&r.push("null")}return r},t.getJSONTypes=c,t.coerceAndCheckDataType=function(t,a){var i,o;let{gen:l,data:c,opts:d}=t,m=(i=a,(o=d.coerceTypes)?i.filter(t=>u.has(t)||"array"===o&&"array"===t):[]),f=a.length>0&&!(0===m.length&&1===a.length&&(0,n.schemaHasRulesForType)(t,a[0]));if(f){let i=p(a,c,d.strictNumbers,r.Wrong);l.if(i,()=>{m.length?function(t,r,a){let{gen:i,data:n,opts:o}=t,l=i.let("dataType",(0,s._)`typeof ${n}`),c=i.let("coerced",(0,s._)`undefined`);for(let t of("array"===o.coerceTypes&&i.if((0,s._)`${l} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>i.assign(n,(0,s._)`${n}[0]`).assign(l,(0,s._)`typeof ${n}`).if(p(r,n,o.strictNumbers),()=>i.assign(c,n))),i.if((0,s._)`${c} !== undefined`),a))(u.has(t)||"array"===t&&"array"===o.coerceTypes)&&function(t){switch(t){case"string":i.elseIf((0,s._)`${l} == "number" || ${l} == "boolean"`).assign(c,(0,s._)`"" + ${n}`).elseIf((0,s._)`${n} === null`).assign(c,(0,s._)`""`);return;case"number":i.elseIf((0,s._)`${l} == "boolean" || ${n} === null
|
|
55
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of t.seen.entries()){let i=a[1];if(r===a[0]){n(a);continue}if(t.external){let i=t.external.registry.get(a[0])?.id;if(r!==a[0]&&i){n(a);continue}}if(t.metadataRegistry.get(a[0])?.id||i.cycle){n(a);continue}i.count>1&&"ref"===t.reused&&n(a)}t.external&&(t.sharedDefsExtractedFor=t.external)}let al=new Set(["type","properties","required","additionalProperties"]),ac=["oneOf","anyOf"];function au(t){let r=t.additionalProperties;return void 0===r||!1===r||"object"!=typeof r||null===r?null:Object.keys(r).length?r:null}function ad(t){let r=[];for(let a of t){if("object"!=typeof a||"object"!==a.type)return null;for(let t in a)if(!al.has(t))return null;r.push(a)}let a={},i=new Set;for(let t of r){for(let i in t.properties){if(Object.prototype.hasOwnProperty.call(a,i))continue;let t=[];for(let a of r){let r=a.properties?.[i]??au(a);null!=r&&(t.some(t=>JSON.stringify(t)===JSON.stringify(r))||t.push(r))}ee(a,i,1===t.length?t[0]:ad(t)??{allOf:t})}for(let r of t.required??[])i.add(r)}let n={type:"object",properties:a};if(i.size&&(n.required=[...i]),r.every(t=>!1===t.additionalProperties))n.additionalProperties=!1;else{let t=[];for(let a of r){let r=au(a);r&&!t.some(t=>JSON.stringify(t)===JSON.stringify(r))&&t.push(r)}1===t.length?n.additionalProperties=t[0]:t.length>1&&(n.additionalProperties={allOf:t})}return n}function ap(t,r){let a=t.seen.get(r);if(!a)throw Error("Unprocessed schema. This is a bug in Zod.");let i=r=>{let a=t.seen.get(r);if(null===a.ref)return;let n=a.def??a.schema,o={...n},s=a.ref;if(a.ref=null,s){i(s);let a=t.seen.get(s),l=a.schema;if(l.$ref&&("draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target)?(n.allOf=n.allOf??[],n.allOf.push(l)):ar(n,l),ar(n,o),r._zod.parent===s)for(let t in n)"$ref"!==t&&"allOf"!==t&&(t in o||delete n[t]);if(l.$ref&&a.def)for(let t in n)"$ref"!==t&&"allOf"!==t&&t in a.def&&JSON.stringify(n[t])===JSON.stringify(a.def[t])&&delete n[t]}let l=r._zod.parent;if(l&&l!==s){i(l);let r=t.seen.get(l);if(r?.schema.$ref&&(n.$ref=r.schema.$ref,r.def))for(let t in n)"$ref"!==t&&"allOf"!==t&&t in r.def&&JSON.stringify(n[t])===JSON.stringify(r.def[t])&&delete n[t]}t.override({zodSchema:r,jsonSchema:n,path:a.path??[]})};if(!t.external||t.sharedEmitDoneFor!==t.external){for(let r of[...t.seen.entries()].reverse())i(r[0]);if("openapi-3.0"!==t.target)for(let r of t.seen.entries())!function t(r){let a=r.anyOf;if(!Array.isArray(a)||0===a.length||void 0!==r.type)return;let i=[];for(let r of a){if(!r||"object"!=typeof r)return;t(r);let a=Object.keys(r);if(1!==a.length||"type"!==a[0])return;let n=r.type;for(let t of Array.isArray(n)?n:[n]){if("string"!=typeof t)return;i.includes(t)||i.push(t)}}delete r.anyOf,r.type=1===i.length?i[0]:i}(r[1].def??r[1].schema);for(let r of t.deferred)r();if(t.intersections.length){let r=new Map;for(let a of t.seen.values())for(let t of[a.schema,a.def]){let a=t?.allOf;if(!Array.isArray(a))continue;let i=r.get(a);i?i.push(t):r.set(a,[t])}for(let a of t.intersections)for(let t of r.get(a)??[])!function(t){let r=t.allOf;if(!Array.isArray(r)||r.length<2)return;for(let r of al)if(r in t)return;let a=r.filter(t=>ac.some(r=>Array.isArray(t[r]))),i=null;if(a.length){let t=a[0],n=ac.find(r=>Array.isArray(t[r]));if(1!==Object.keys(t).length)return;let o=r.filter(r=>r!==t),s=t[n].map(t=>ad([...o,t]));if(s.some(t=>!t))return;i={[n]:s}}else i=ad(r);i&&(delete t.allOf,ar(t,i))}(t)}}let n={};if("draft-2020-12"===t.target?n.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===t.target?n.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===t.target?n.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let a=t.external.registry.get(r)?.id;if(!a)throw Error("Schema is missing an `id` property");n.$id=t.external.uri(a)}ar(n,a.defId?a.schema:a.def??a.schema);let o=t.metadataRegistry.get(r)?.id;void 0!==o&&n.id===o&&delete n.id;let s=t.external?.defs??{};if(!t.external||t.sharedEmitDoneFor!==t.external)for(let r of t.seen.entries()){let t=r[1];t.def&&t.defId&&(t.def.id===t.defId&&delete t.def.id,ee(s,t.defId,t.def))}t.external&&(t.sharedEmitDoneFor=t.external),t.external||Object.keys(s).length>0&&("draft-2020-12"===t.target?n.$defs=s:n.definitions=s);try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...r["~standard"],jsonSchema:{input:am(r,"input",t.processors),output:am(r,"output",t.processors)}},enumerable:!1,writable:!1}),a}catch(t){throw Error("Error converting schema to JSON.")}}let am=(t,r,a={})=>i=>{let{libraryOptions:n,target:o}=i??{},s=aa({...n??{},target:o,io:r,processors:a});return an(t,s),as(s,t),ap(s,t)},ah=(t,r,a)=>{(void 0===t[r]||a>t[r])&&(t[r]=a)},af=(t,r,a)=>{(void 0===t[r]||a<t[r])&&(t[r]=a)},ay=(t,r)=>{ah(t,"minimum",r),af(t,"maximum",r)},ag=(t,r)=>{t.multipleOf??(t.multipleOf=[]),t.multipleOf.includes(r)||t.multipleOf.push(r)},av=(t,r)=>{t.patterns??(t.patterns=new Set),t.patterns.add(r)},a_=(t,r)=>{t.mime=t.mime?t.mime.filter(t=>r.includes(t)):[...r]},ab=(t,r)=>{t.format=r,r.includes("int")&&(t.isInt=!0)},aS=(t,r)=>ah(t,"minimum",r.minimum),a$=(t,r)=>af(t,"maximum",r.maximum),aw=t=>(r,a)=>{ab(r,a.format);let[i,n]=t[a.format];ah(r,"minimum",i),af(r,"maximum",n)},ak={greater_than:(t,r)=>ah(t,r.inclusive?"minimum":"exclusiveMinimum",r.value),less_than:(t,r)=>af(t,r.inclusive?"maximum":"exclusiveMaximum",r.value),multiple_of:(t,r)=>ag(t,r.value),number_format:aw(eg),bigint_format:aw(ev),min_length:aS,max_length:a$,length_equals:(t,r)=>ay(t,r.length),min_size:aS,max_size:a$,size_equals:(t,r)=>ay(t,r.size),string_format:(t,r)=>{ab(t,r.format),r.pattern&&av(t,r.pattern),("base64"===r.format||"base64url"===r.format)&&(t.contentEncoding=r.format),(r.local||-1===r.precision)&&(t.laxFormat=!0)},mime_type:(t,r)=>a_(t,r.mime)};function ax(t){let r={},a=t._zod.def;for(let i of t._zod.traits.has("$ZodCheck")?[t,...a.checks??[]]:a.checks??[])ak[i._zod.def.check]?.(r,i._zod.def);let i=t._zod.bag;for(let t of(void 0!==i.minimum&&ah(r,"minimum",i.minimum),void 0!==i.exclusiveMinimum&&ah(r,"exclusiveMinimum",i.exclusiveMinimum),void 0!==i.maximum&&af(r,"maximum",i.maximum),void 0!==i.exclusiveMaximum&&af(r,"exclusiveMaximum",i.exclusiveMaximum),void 0!==i.multipleOf&&ag(r,i.multipleOf),void 0!==i.format&&(r.format??(r.format=i.format),i.format.includes("int")&&(r.isInt=!0)),i.mime&&a_(r,i.mime),i.patterns??[]))av(r,t);return r}let aR={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},aP=new Map([[rr,/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/],[ri,/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/]]),aE=t=>aP.get(t)??t,aj=(t,r,a,i)=>{a.type="string";let{minimum:n,maximum:o,format:s,patterns:l,contentEncoding:c,laxFormat:u}=ax(t);if("number"==typeof n&&(a.minLength=n),"number"==typeof o&&(a.maxLength=o),s&&(a.format=aR[s]??s,""===a.format&&delete a.format,("time"===s||u)&&delete a.format),c&&(a.contentEncoding=c),l&&l.size>0){let t=[...l].map(aE);1===t.length?a.pattern=t[0].source:t.length>1&&(a.allOf=[...t.map(t=>({..."draft-07"===r.target||"draft-04"===r.target||"openapi-3.0"===r.target?{type:"string"}:{},pattern:t.source}))])}},aT=(t,r,a,i)=>{let{minimum:n,maximum:o,multipleOf:s,exclusiveMaximum:l,exclusiveMinimum:c,isInt:u}=ax(t);a.type=u?"integer":"number";let d="number"==typeof c&&c>=(n??-1/0),p="number"==typeof l&&l<=(o??1/0),m="draft-04"===r.target||"openapi-3.0"===r.target;if(d?m?(a.minimum=c,a.exclusiveMinimum=!0):a.exclusiveMinimum=c:"number"==typeof n&&(a.minimum=n),p?m?(a.maximum=l,a.exclusiveMaximum=!0):a.exclusiveMaximum=l:"number"==typeof o&&(a.maximum=o),s){let n=new Set;for(let o of s)Number.isFinite(o)&&0!==o?n.add(Math.abs(o)):ai(t,r,a,i,`A multipleOf divisor of ${o} cannot be represented in JSON Schema`);let[o,...l]=n;void 0!==o&&(a.multipleOf=o),l.length&&(a.allOf=[...a.allOf??[],...l.map(t=>({multipleOf:t}))])}},aO=(t,r,a,i)=>{a.type="boolean"},aC=(t,r,a,i)=>{"openapi-3.0"===r.target?(a.type="string",a.nullable=!0,a.enum=[null]):a.type="null"},aN=(t,r,a,i)=>{a.not={}},aI=(t,r,a,i)=>{},aq=(t,r,a,i)=>{},aA=(t,r,a,i)=>{let n=K(t._zod.def.entries);if(0===n.length){a.not={};return}n.every(t=>"number"==typeof t)&&(a.type="number"),n.every(t=>"string"==typeof t)&&(a.type="string"),a.enum=n},az=(t,r,a,i)=>{let n=t._zod.def;if(0===n.values.length){a.not={};return}let o=[];for(let s of n.values)if(void 0===s){if(ai(t,r,a,i,"Literal `undefined` cannot be represented in JSON Schema"))return}else if("bigint"==typeof s){if(ai(t,r,a,i,"BigInt literals cannot be represented in JSON Schema"))return;o.push(Number(s))}else o.push(s);if(0===o.length);else if(1===o.length){let t=o[0];a.type=null===t?"null":typeof t,"draft-04"===r.target||"openapi-3.0"===r.target?a.enum=[t]:a.const=t}else o.every(t=>"number"==typeof t)&&(a.type="number"),o.every(t=>"string"==typeof t)&&(a.type="string"),o.every(t=>"boolean"==typeof t)&&(a.type="boolean"),o.every(t=>null===t)&&(a.type="null"),a.enum=o},aM=(t,r,a,i)=>{ai(t,r,a,i,"Custom types cannot be represented in JSON Schema")},aL=(t,r,a,i)=>{ai(t,r,a,i,"Transforms cannot be represented in JSON Schema")},aD=(t,r,a,i)=>{let n=t._zod.def,{minimum:o,maximum:s}=ax(t);"number"==typeof o&&(a.minItems=o),"number"==typeof s&&(a.maxItems=s),a.type="array",a.items=an(n.element,r,{...i,path:[...i.path,"items"]})};function aZ(t){let r=t._zod.def;return"pipe"===r.type&&r.in._zod.traits.has("$ZodTransform")?aZ(r.out):"catch"===r.type?aZ(r.innerType):t._zod.optin}let aV=(t,r,a,i)=>{let n=t._zod.def,o=n.shape;if(Object.getOwnPropertySymbols(o).length&&ai(t,r,a,i,"Symbol keys cannot be represented in JSON Schema"))return;for(let t in a.type="object",a.properties={},o)ee(a.properties,t,an(o[t],r,{...i,path:[...i.path,"properties",t]}));let s=[];for(let t of Object.keys(o)){let a=n.shape[t];("input"===r.io?void 0===aZ(a):void 0===a._zod.optout)&&s.push(t)}s.length>0&&(a.required=s),n.catchall?._zod.def.type==="never"?a.additionalProperties=!1:n.catchall?n.catchall&&(a.additionalProperties=an(n.catchall,r,{...i,path:[...i.path,"additionalProperties"]})):"output"===r.io&&(a.additionalProperties=!1)},aF=(t,r,a,i)=>{let n=t._zod.def,o=!1===n.inclusive,s=n.options.map((t,a)=>an(t,r,{...i,path:[...i.path,o?"oneOf":"anyOf",a]}));o?a.oneOf=s:a.anyOf=s},aU=(t,r,a,i)=>{let n=t._zod.def,o=an(n.left,r,{...i,path:[...i.path,"allOf",0]}),s=an(n.right,r,{...i,path:[...i.path,"allOf",1]}),l=t=>"allOf"in t&&1===Object.keys(t).length,c=[...l(o)?o.allOf:[o],...l(s)?s.allOf:[s]];a.allOf=c,r.intersections.push(c)},aH=new WeakMap,aJ=(t,r,a,i)=>{let n=t._zod.def;a.type="object";let o=n.keyType,s=ax(o).patterns;if("loose"===n.mode&&s&&s.size>0){let t=an(n.valueType,r,{...i,path:[...i.path,"patternProperties","*"]});for(let r of(a.patternProperties={},s))ee(a.patternProperties,aE(r).source,t)}else{if("draft-07"===r.target||"draft-2020-12"===r.target){a.propertyNames=an(n.keyType,r,{...i,path:[...i.path,"propertyNames"]});let o=aH.get(r);o||(o=[],aH.set(r,o),r.deferred.push(()=>(function(t){let r=new Map;for(let a of t.seen.values())a.def&&!r.has(a.schema)&&r.set(a.schema,a);let a=new Map;for(let i of aH.get(t)??[]){let n=t.seen.get(i),o=(n?.def??n?.schema)?.propertyNames;if(!o||!0===o||a.has(o))continue;let s=function t(r,a,i){if(a.$ref){if(i.has(a))return a;i.add(a);let n=r.get(a)?.def;if(!n)return a;let o=t(r,n,i);return o===n?a:o}for(let n of["anyOf","oneOf"]){let o=a[n];if(!Array.isArray(o))continue;let s=o.map(a=>t(r,a,i));s.some((t,r)=>t!==o[r])&&(a={...a,[n]:s})}let n=Array.isArray(a.type)?a.type:[a.type],o=!n.includes("string")&&n.some(t=>"number"===t||"integer"===t),s=a.enum??(void 0!==a.const?[a.const]:void 0);if(!o&&!s?.some(t=>"number"==typeof t))return a;let{minimum:l,maximum:c,exclusiveMinimum:u,exclusiveMaximum:d,multipleOf:p,format:m,id:h,...f}=a;return f.enum?f.enum=f.enum.map(t=>"number"==typeof t?String(t):t):"number"==typeof f.const&&(f.const=String(f.const)),o&&(f.type="string",s||(f.pattern=(n.includes("number")?tu:tc).source)),f}(r,o,new Set);s!==o&&a.set(o,s)}if(a.size)for(let r of t.seen.values())for(let t of[r.schema,r.def]){let r=t&&a.get(t.propertyNames);r&&(t.propertyNames=r)}})(r))),o.push(t)}a.additionalProperties=an(n.valueType,r,{...i,path:[...i.path,"additionalProperties"]})}let l=o._zod.values,c="input"===r.io&&void 0!==aZ(n.valueType);if(l&&!n.partial&&!c){let t=[...l].filter(t=>"string"==typeof t||"number"==typeof t);t.length>0&&(a.required=t.map(String))}},aK=(t,r,a,i)=>{let n=t._zod.def,o=an(n.innerType,r,i),s=r.seen.get(t);"openapi-3.0"===r.target?(s.ref=n.innerType,a.nullable=!0):a.anyOf=[o,{type:"null"}]},aB=(t,r,a,i)=>{let n=t._zod.def;an(n.innerType,r,i),r.seen.get(t).ref=n.innerType},aG=Symbol();function aW(t,r,a,i,n){let o=!1,s=JSON.stringify(t,(t,r)=>"bigint"!=typeof r?r:(o=!0,null));return o?(ai(r,a,i,n,"BigInt defaults cannot be represented in JSON Schema"),aG):JSON.parse(s)}let aY=(t,r,a,i)=>{let n=t._zod.def;an(n.innerType,r,i),r.seen.get(t).ref=n.innerType;let o=aW(n.defaultValue,t,r,a,i);o!==aG&&(a.default=o)},aX=(t,r,a,i)=>{let n=t._zod.def;if(an(n.innerType,r,i),r.seen.get(t).ref=n.innerType,"input"!==r.io)return;let o=aW(n.defaultValue,t,r,a,i);o!==aG&&(a._prefault=o)},aQ=(t,r,a,i)=>{let n,o=t._zod.def;an(o.innerType,r,i),r.seen.get(t).ref=o.innerType;try{n=o.catchValue(void 0)}catch{ai(t,r,a,i,"Dynamic catch values are not supported in JSON Schema");return}a.default=n},a0=(t,r,a,i)=>{let n=t._zod.def,o=n.in._zod.traits.has("$ZodTransform"),s="input"===r.io?o?n.out:n.in:n.out;an(s,r,i),r.seen.get(t).ref=s},a1=(t,r,a,i)=>{let n=t._zod.def;an(n.innerType,r,i),r.seen.get(t).ref=n.innerType,a.readOnly=!0},a2=(t,r,a,i)=>{let n=t._zod.def;an(n.innerType,r,i),r.seen.get(t).ref=n.innerType},a9=(t,r,a,i)=>{let n=t._zod.innerType;an(n,r,i),r.seen.get(t).ref=n},a4={string:aj,number:aT,boolean:aO,bigint:(t,r,a,i)=>{ai(t,r,a,i,"BigInt cannot be represented in JSON Schema")},symbol:(t,r,a,i)=>{ai(t,r,a,i,"Symbols cannot be represented in JSON Schema")},null:aC,undefined:(t,r,a,i)=>{ai(t,r,a,i,"Undefined cannot be represented in JSON Schema")},void:(t,r,a,i)=>{ai(t,r,a,i,"Void cannot be represented in JSON Schema")},never:aN,any:aI,unknown:aq,date:(t,r,a,i)=>{ai(t,r,a,i,"Date cannot be represented in JSON Schema")},enum:aA,literal:az,nan:(t,r,a,i)=>{ai(t,r,a,i,"NaN cannot be represented in JSON Schema")},template_literal:(t,r,a,i)=>{let n=t._zod.pattern;if(!n)throw Error("Pattern not found in template literal");a.type="string",a.pattern=n.source},file:(t,r,a,i)=>{a.type="string",a.format="binary",a.contentEncoding="binary";let{minimum:n,maximum:o,mime:s}=ax(t);void 0!==n&&(a.minLength=n),void 0!==o&&(a.maxLength=o),s&&(0===s.length?a.not={}:1===s.length?a.contentMediaType=s[0]:a.anyOf=s.map(t=>({contentMediaType:t})))},success:(t,r,a,i)=>{a.type="boolean"},custom:aM,function:(t,r,a,i)=>{ai(t,r,a,i,"Function types cannot be represented in JSON Schema")},transform:aL,map:(t,r,a,i)=>{ai(t,r,a,i,"Map cannot be represented in JSON Schema")},set:(t,r,a,i)=>{ai(t,r,a,i,"Set cannot be represented in JSON Schema")},array:aD,object:aV,union:aF,intersection:aU,tuple:(t,r,a,i)=>{let n=t._zod.def;a.type="array";let o="draft-2020-12"===r.target?"prefixItems":"items",s="draft-2020-12"===r.target||"openapi-3.0"===r.target?"items":"additionalItems",l=n.items.map((t,a)=>an(t,r,{...i,path:[...i.path,o,a]})),c=n.rest?an(n.rest,r,{...i,path:[...i.path,s,..."openapi-3.0"===r.target?[n.items.length]:[]]}):null,u=n.items.length;for(;u>0;){let t=n.items[u-1];if(!("input"===r.io?void 0!==aZ(t):"optional"===t._zod.optout))break;u--}let d=n.items.length,p=!n.rest;"draft-2020-12"===r.target?(a.prefixItems=l,p?a.items=!1:c&&(a.items=c)):"openapi-3.0"===r.target?(a.items={anyOf:l},c&&a.items.anyOf.push(c)):(a.items=l,p?a.additionalItems=!1:c&&(a.additionalItems=c)),u>0&&(a.minItems=u),p&&(a.maxItems=d);let{minimum:m,maximum:h}=ax(t);"number"==typeof m&&(a.minItems=m),"number"==typeof h&&(a.maxItems=h)},record:aJ,nullable:aK,nonoptional:aB,default:aY,prefault:aX,catch:aQ,pipe:a0,readonly:a1,promise:(t,r,a,i)=>{let n=t._zod.def;an(n.innerType,r,i),r.seen.get(t).ref=n.innerType},optional:a2,lazy:a9};function a6(t,r){if("_idmap"in t){let a=aa({...r,processors:a4}),i={};for(let r of t._idmap.entries()){let[t,i]=r;an(i,a)}let n={};for(let o of(a.external={registry:t,uri:r?.uri,defs:i},t._idmap.entries())){let[t,r]=o;as(a,r),ee(n,t,ap(a,r))}return Object.keys(i).length>0&&(n.__shared={["draft-2020-12"===a.target?"$defs":"definitions"]:i}),{schemas:n}}let a=aa({...r,processors:a4});return an(t,a),as(a,t),ap(a,t)}let a5={get:function(){let t=this._zod;return t.message??(t.message=JSON.stringify(t.def,G,2)),t.message},set:function(t){this._zod.message=t},enumerable:!0,configurable:!0},a3={value:void 0,enumerable:!1},a8=new WeakSet([Object.prototype,Error.prototype]),a7=(t,r)=>{t.name="$ZodError",a3.value=r,Object.defineProperty(t,"issues",a3),a3.value=void 0,Object.defineProperty(t,"message",a5);let a=Object.getPrototypeOf(t);a8.has(a)||(a8.add(a),Object.defineProperty(a,"toString",{configurable:!0,enumerable:!1,get(){let t=()=>this.message;return Object.defineProperty(this,"toString",{value:t,configurable:!0,writable:!0}),t},set(t){Object.defineProperty(this,"toString",{value:t,configurable:!0,writable:!0})}}))},ie=eL("$ZodError",a7);function it(t,r){return{callee:r?.callee??t,Err:r?.Err}}eL("$ZodError",a7,void 0,{Parent:Error});let ir=t=>{let r=(a,i,n,o)=>{let s=n?{...n,async:!1}:{async:!1},l=a._zod.run({value:i,issues:[]},s);if(l instanceof Promise)throw new eD;if(l.issues.length){let a=new(o?.Err??t)(l.issues.map(t=>eR(t,s,eF())));throw es(a,o?.callee??r),a}return l.value};return r},ia=t=>{let r=async(a,i,n,o)=>{let s=n?{...n,async:!0}:{async:!0},l=a._zod.run({value:i,issues:[]},s);if(l instanceof Promise&&(l=await l),l.issues.length){let a=new(o?.Err??t)(l.issues.map(t=>eR(t,s,eF())));throw es(a,o?.callee??r),a}return l.value};return r},ii=t=>(r,a,i)=>{let n=i?{...i,async:!1}:{async:!1},o=r._zod.run({value:a,issues:[]},n);if(o instanceof Promise)throw new eD;return o.issues.length?io(t,o.issues,n):{success:!0,data:o.value}};function io(t,r,a){let i;return{success:!1,get error(){return i||(i=new t(r.map(t=>eR(t,a,eF()))),r=void 0,a=void 0),i},set error(e){i=e,r=void 0,a=void 0}}}let is=t=>async(r,a,i)=>{let n=i?{...i,async:!0}:{async:!0},o=r._zod.run({value:a,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length?io(t,o.issues,n):{success:!0,data:o.value}},il=Symbol.for("zod.compile.invalid"),ic=Symbol.for("zod.compile.fallback"),iu=async(t,r,a)=>{let i=a?{...a,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},n=t._zod.run({value:r,issues:[]},i);return n instanceof Promise&&(n=await n),0===n.issues.length},id=new WeakSet([Object.prototype,Error.prototype]);function ip(t,r,a){Object.defineProperty(t,r,{configurable:!0,enumerable:!1,get(){let t=a(this);return Object.defineProperty(this,r,{value:t,configurable:!0,writable:!0}),t},set(t){Object.defineProperty(this,r,{value:t,configurable:!0,writable:!0})}})}let im=eL("ZodError",(t,r)=>{ie.init(t,r),t.name="ZodError";let a=Object.getPrototypeOf(t);id.has(a)||(id.add(a),ip(a,"format",t=>r=>(function(t,r=t=>t.message){let a={_errors:[]},i=(t,n=[])=>{for(let o of t.issues)if("invalid_union"===o.code&&o.errors.length)o.errors.map(t=>i({issues:t},[...n,...o.path]));else if("invalid_key"===o.code)i({issues:o.issues},[...n,...o.path]);else if("invalid_element"===o.code)i({issues:o.issues},[...n,...o.path]);else{let t=[...n,...o.path];if(0===t.length)a._errors.push(r(o));else{let i=a,n=0;for(;n<t.length;){let a=t[n],s=n===t.length-1;if("_errors"===a){s&&i._errors.push(r(o)),n++;continue}Object.prototype.hasOwnProperty.call(i,a)||Object.defineProperty(i,a,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let l=i[a];s&&l._errors.push(r(o)),i=l,n++}}}};return i(t),a})(t,r)),ip(a,"flatten",t=>r=>(function(t,r=t=>t.message){let a={},i=[];for(let s of t.issues)if(s.path.length>0){var n,o;(n=s.path[0],o=()=>[],!Object.prototype.hasOwnProperty.call(a,n)&&("__proto__"===n?Object.defineProperty(a,n,{value:o(),writable:!0,enumerable:!0,configurable:!0}):a[n]=o()),a[n]).push(r(s))}else i.push(r(s));return{formErrors:i,fieldErrors:a}})(t,r)),ip(a,"addIssue",t=>r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,G,2)}),ip(a,"addIssues",t=>r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,G,2)}),Object.defineProperty(a,"isEmpty",{configurable:!0,enumerable:!1,get(){return 0===this.issues.length}}))},void 0,{Parent:Error}),ih=ir(im),iy=ia(im),ig=ii(im),iv=is(im),i_=(m=ir(im),h=(t,r,a,i)=>m(t,r,a?{...a,direction:"backward"}:{direction:"backward"},it(h,i))),ib=(f=ir(im),y=(t,r,a,i)=>f(t,r,a,it(y,i))),iS=(g=ia(im),v=async(t,r,a,i)=>{let n=a?{...a,direction:"backward"}:{direction:"backward"};return await g(t,r,n,it(v,i))}),i$=(_=ia(im),b=async(t,r,a,i)=>await _(t,r,a,it(b,i))),iw=(t,r,a)=>{let i=a?{...a,direction:"backward"}:{direction:"backward"};return ii(im)(t,r,i)},ik=(t,r,a)=>ii(im)(t,r,a),ix=async(t,r,a)=>{let i=a?{...a,direction:"backward"}:{direction:"backward"};return is(im)(t,r,i)},iR=async(t,r,a)=>is(im)(t,r,a);function iP(){eV.memoizer||eF({memoizer:eY})}let iE=eL("ZodType",(t,r)=>(eV.localeError||eF({localeError:(()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}},r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},a={nan:"NaN"};function i(t,r){return"number"!==t||"number"!=typeof r||Number.isFinite(r)?a[t]??t:String(r)}return a=>{switch(a.code){case"invalid_type":{let t=i(a.expected),r=i(function(t){let r=typeof t;switch(r){case"number":return Number.isNaN(t)?"nan":"number";case"object":if(null===t)return"null";if(Array.isArray(t))return"array";if(t&&Object.getPrototypeOf(t)!==Object.prototype&&"constructor"in t&&t.constructor)return t.constructor.name}return r}(a.input),a.input);return`Invalid input: expected ${t}, received ${r}`}case"invalid_value":if(1===a.values.length)return`Invalid input: expected ${ey(a.values[0])}`;return`Invalid option: expected one of ${B(a.values,"|")}`;case"too_big":{let r=a.exact?"exactly ":a.inclusive?"<=":"<",i=t[a.origin]??null;if(i)return`Too big: expected ${a.origin??"value"} to have ${r}${a.maximum.toString()} ${i.unit??"elements"}`;return`Too big: expected ${a.origin??"value"} to be ${r}${a.maximum.toString()}`}case"too_small":{let r=a.exact?"exactly ":a.inclusive?">=":">",i=t[a.origin]??null;if(i)return`Too small: expected ${a.origin} to have ${r}${a.minimum.toString()} ${i.unit}`;return`Too small: expected ${a.origin} to be ${r}${a.minimum.toString()}`}case"invalid_format":if("starts_with"===a.format)return`Invalid string: must start with "${a.prefix}"`;if("ends_with"===a.format)return`Invalid string: must end with "${a.suffix}"`;if("includes"===a.format)return`Invalid string: must include "${a.includes}"`;if("regex"===a.format)return`Invalid string: must match pattern ${a.pattern}`;return`Invalid ${r[a.format]??a.format}`;case"not_multiple_of":return`Invalid number: must be a multiple of ${a.divisor}`;case"unrecognized_keys":return`Unrecognized key${a.keys.length>1?"s":""}: ${B(a.keys,", ")}`;case"invalid_key":return`Invalid key in ${a.origin}`;case"invalid_union":if(a.options&&Array.isArray(a.options)&&a.options.length>0){let t=a.options.map(t=>`'${t}'`).join(" | ");return`Invalid discriminator value. Expected ${t}`}if(!1===a.inclusive)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${a.origin}`;default:return"Invalid input"}}})()}),tq.init(t,r),t.def=r,t.type=r.type,t),{check(...t){let r=this.def;return this.clone(eo(r,{checks:[...r.checks??[],...t.map(t=>"function"==typeof t?{_zod:{check:t,def:{check:"custom"},onattach:[]}}:t)]}),{parent:!0})},with(...t){return this.check(...t)},clone(t,r){return eh(this,t,r)},brand(){return this},register(t,r){return t.add(this,r),this},refine(t,r){return this.check(function(t,r={}){return new nM({type:"custom",check:"custom",fn:t,...ef(r)})}(t,r))},superRefine(t,r){return this.check(function(t,r){var a;let i,n;return a=r=>(r.addIssue=t=>{"string"==typeof t?r.issues.push(eT(t,r.value,i._zod.def)):(t.fatal&&(t.continue=!1),t.code??(t.code="custom"),"input"in t||(t.input=r.value),t.inst??(t.inst=i),t.continue??(t.continue=!i._zod.def.abort),r.issues.push(eT(t)))},t(r.value,r)),(n=new tf({check:"custom",...ef(r)}))._zod.check=a,i=n}(t,r))},overwrite(t){return this.check(at(t))},optional(){return nk(this)},exactOptional(){var t;return t=this,new nx({type:"optional",innerType:t})},nullable(){return nP(this)},nullish(){return nk(nP(this))},nonoptional(t){var r;return r=this,new nT({type:"nonoptional",innerType:r,...ef(t)})},array(){return nn(this)},or(t){return nu([this,t])},and(t){return nh(this,t)},transform(t){return nN(this,n$(t))},default(t){var r,a;return r=this,a=t,new nE({type:"default",innerType:r,get defaultValue(){return"function"==typeof a?a():ed(a)}})},prefault(t){var r,a;return r=this,a=t,new nj({type:"prefault",innerType:r,get defaultValue(){return"function"==typeof a?a():ed(a)}})},catch(t){return function(t,r){let a;return new nO({type:"catch",innerType:t,catchValue:"function"==typeof r?r:((a=()=>r)["~constantCatch"]=!0,a)})}(this,t)},pipe(t){return nN(this,t)},readonly(){var t;return t=this,new nq({type:"readonly",innerType:t})},describe(t){let r=this.clone();return rY.add(r,{description:t}),r},meta(...t){if(0===t.length)return rY.get(this);let r=this.clone();return rY.add(r,t[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(t,...r){return 0===r.length?t(this):t(this,...r)},get"~standard"(){return eO(this,"~standard",{...tM(this),jsonSchema:{input:am(this,"input"),output:am(this,"output")}},!1)},set"~standard"(value){eO(this,"~standard",value)},parse:function t(r,a){return ih(this,r,a,{callee:t})},parseAsync:async function t(r,a){return await iy(this,r,a,{callee:t})},safeParse(t,r){return ig(this,t,r)},async safeParseAsync(t,r){return iv(this,t,r)},get spa(){return this?.safeParseAsync},set spa(value){eO(this,"spa",value)},validate(t,r){let a=this._zod.bag.validator;if(void 0!==a){if(a(t)!==il)return!0;if(!0===a.definite&&void 0===r)return!1}return function(t,r,a){let i,n=a?{...a,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=t._zod.bag.fallbackRun;if(o?(n[ic]=!0,i=o({value:r,issues:[]},n)):i=t._zod.run({value:r,issues:[]},n),i instanceof Promise)throw new eD;return 0===i.issues.length}(this,t,r)},validateAsync(t,r){return iu(this,t,r)},encode:function t(r,a){return i_(this,r,a,{callee:t})},decode:function t(r,a){return ib(this,r,a,{callee:t})},encodeAsync:async function t(r,a){return await iS(this,r,a,{callee:t})},decodeAsync:async function t(r,a){return await i$(this,r,a,{callee:t})},safeEncode(t,r){return iw(this,t,r)},safeDecode(t,r){return ik(this,t,r)},async safeEncodeAsync(t,r){return ix(this,t,r)},async safeDecodeAsync(t,r){return iR(this,t,r)},toJSONSchema(t){return((t,r={})=>a=>{let i=aa({...a,processors:r});return an(t,i),as(i,t),ap(i,t)})(this,{})(t)},get description(){return rY.get(this)?.description},get _def(){return this._zod.def}}),ij=eL("_ZodString",(t,r)=>{tL.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aj(t,r,a,i)},eC({format:t=>ax(t).format??null,minLength:t=>ax(t).minimum??null,maxLength:t=>ax(t).maximum??null},{regex(...t){return this.check(function(t,r){return new tR({check:"string_format",format:"regex",...ef(r),pattern:t})}(...t))},includes(...t){return this.check(function(t,r){return new tj({check:"string_format",format:"includes",...ef(r),includes:t})}(...t))},startsWith(...t){return this.check(function(t,r){return new tT({check:"string_format",format:"starts_with",...ef(r),prefix:t})}(...t))},endsWith(...t){return this.check(function(t,r){return new tO({check:"string_format",format:"ends_with",...ef(r),suffix:t})}(...t))},min(...t){return this.check(r7(...t))},max(...t){return this.check(r8(...t))},length(...t){return this.check(ae(...t))},nonempty(...t){return this.check(r7(1,...t))},lowercase(t){return this.check(new tP({check:"string_format",format:"lowercase",...ef(t)}))},uppercase(t){return this.check(new tE({check:"string_format",format:"uppercase",...ef(t)}))},trim(){return this.check(at(t=>t.trim()))},normalize(...t){return this.check(function(t){return at(r=>r.normalize(t))}(...t))},toLowerCase(){return this.check(at(t=>t.toLowerCase()))},toUpperCase(){return this.check(at(t=>t.toUpperCase()))},slugify(){return this.check(at(t=>t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")))}})),iT=eL("ZodString",(t,r)=>{tL.init(t,r),ij.init(t,r)},{email(t){return this.check(rQ(iz,t))},url(t){return this.check(r0(iD,t))},jwt(t){return this.check(new i1({type:"string",format:"jwt",check:"string_format",abort:!1,...ef(t)}))},emoji(t){return this.check(new iZ({type:"string",format:"emoji",check:"string_format",abort:!1,...ef(t)}))},guid(t){return this.check(new iM({type:"string",format:"guid",check:"string_format",abort:!1,...ef(t)}))},uuid(t){return this.check(new iL({type:"string",format:"uuid",check:"string_format",abort:!1,...ef(t)}))},uuidv4(t){return this.check(new iL({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ef(t)}))},uuidv6(t){return this.check(new iL({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ef(t)}))},uuidv7(t){return this.check(new iL({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ef(t)}))},nanoid(t){return this.check(new iV({type:"string",format:"nanoid",check:"string_format",abort:!1,...ef(t)}))},cuid(t){return this.check(new iF({type:"string",format:"cuid",check:"string_format",abort:!1,...ef(t)}))},cuid2(t){return this.check(new iU({type:"string",format:"cuid2",check:"string_format",abort:!1,...ef(t)}))},ulid(t){return this.check(new iH({type:"string",format:"ulid",check:"string_format",abort:!1,...ef(t)}))},base64(t){return this.check(new iX({type:"string",format:"base64",check:"string_format",abort:!1,...ef(t)}))},base64url(t){return this.check(new iQ({type:"string",format:"base64url",check:"string_format",abort:!1,...ef(t)}))},xid(t){return this.check(new iJ({type:"string",format:"xid",check:"string_format",abort:!1,...ef(t)}))},ksuid(t){return this.check(new iK({type:"string",format:"ksuid",check:"string_format",abort:!1,...ef(t)}))},ipv4(t){return this.check(new iB({type:"string",format:"ipv4",check:"string_format",abort:!1,...ef(t)}))},ipv6(t){return this.check(new iG({type:"string",format:"ipv6",check:"string_format",abort:!1,...ef(t)}))},cidrv4(t){return this.check(new iW({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ef(t)}))},cidrv6(t){return this.check(new iY({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ef(t)}))},e164(t){return this.check(new i0({type:"string",format:"e164",check:"string_format",abort:!1,...ef(t)}))},datetime(t){return this.check(r1(iN,t))},date(t){return this.check(r2(iI,t))},time(t){return this.check(new iq({type:"string",format:"time",check:"string_format",precision:null,...ef(t)}))},duration(t){return this.check(new iA({type:"string",format:"duration",check:"string_format",...ef(t)}))}});function iO(t){return new iT(rX({type:"string",...ef(t)}))}let iC=eL("ZodStringFormat",(t,r)=>{tD.init(t,r),ij.init(t,r)}),iN=eL("ZodISODateTime",(t,r)=>{t1.init(t,r),iC.init(t,r)}),iI=eL("ZodISODate",(t,r)=>{t2.init(t,r),iC.init(t,r)}),iq=eL("ZodISOTime",(t,r)=>{t9.init(t,r),iC.init(t,r)}),iA=eL("ZodISODuration",(t,r)=>{t4.init(t,r),iC.init(t,r)}),iz=eL("ZodEmail",(t,r)=>{tF.init(t,r),iC.init(t,r)}),iM=eL("ZodGUID",(t,r)=>{tZ.init(t,r),iC.init(t,r)}),iL=eL("ZodUUID",(t,r)=>{tV.init(t,r),iC.init(t,r)}),iD=eL("ZodURL",(t,r)=>{tK.init(t,r),iC.init(t,r)}),iZ=eL("ZodEmoji",(t,r)=>{tB.init(t,r),iC.init(t,r)}),iV=eL("ZodNanoID",(t,r)=>{tG.init(t,r),iC.init(t,r)}),iF=eL("ZodCUID",(t,r)=>{tW.init(t,r),iC.init(t,r)}),iU=eL("ZodCUID2",(t,r)=>{tY.init(t,r),iC.init(t,r)}),iH=eL("ZodULID",(t,r)=>{tX.init(t,r),iC.init(t,r)}),iJ=eL("ZodXID",(t,r)=>{tQ.init(t,r),iC.init(t,r)}),iK=eL("ZodKSUID",(t,r)=>{t0.init(t,r),iC.init(t,r)}),iB=eL("ZodIPv4",(t,r)=>{t6.init(t,r),iC.init(t,r)}),iG=eL("ZodIPv6",(t,r)=>{t8.init(t,r),iC.init(t,r)}),iW=eL("ZodCIDRv4",(t,r)=>{t7.init(t,r),iC.init(t,r)}),iY=eL("ZodCIDRv6",(t,r)=>{re.init(t,r),iC.init(t,r)}),iX=eL("ZodBase64",(t,r)=>{ra.init(t,r),iC.init(t,r)}),iQ=eL("ZodBase64URL",(t,r)=>{rn.init(t,r),iC.init(t,r)}),i0=eL("ZodE164",(t,r)=>{ro.init(t,r),iC.init(t,r)}),i1=eL("ZodJWT",(t,r)=>{rs.init(t,r),iC.init(t,r)}),i2=eL("ZodNumber",(t,r)=>{rl.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aT(t,r,a,i),t.isFinite=!0},eC({minValue:t=>{let{minimum:r,exclusiveMinimum:a}=ax(t);return Math.max(r??-1/0,a??-1/0)},maxValue:t=>{let{maximum:r,exclusiveMaximum:a}=ax(t);return Math.min(r??1/0,a??1/0)},isInt:t=>{let{isInt:r,multipleOf:a}=ax(t);return!!r||!!a?.some(Number.isSafeInteger)},format:t=>ax(t).format??null},{gt(t,r){return this.check(r6(t,r))},gte(t,r){return this.check(r5(t,r))},min(t,r){return this.check(r5(t,r))},lt(t,r){return this.check(r9(t,r))},lte(t,r){return this.check(r4(t,r))},max(t,r){return this.check(r4(t,r))},int(t){return this.check(i6(t))},safe(t){return this.check(i6(t))},positive(t){return this.check(r6(0,t))},nonnegative(t){return this.check(r5(0,t))},negative(t){return this.check(r9(0,t))},nonpositive(t){return this.check(r4(0,t))},multipleOf(t,r){return this.check(r3(t,r))},step(t,r){return this.check(r3(t,r))},finite(){return this}}));function i9(t){return new i2(rX({type:"number",checks:[],...ef(t)}))}let i4=eL("ZodNumberFormat",(t,r)=>{rc.init(t,r),i2.init(t,r)});function i6(t){return new i4({type:"number",check:"number_format",abort:!1,format:"safeint",...ef(t)})}let i5=eL("ZodBoolean",(t,r)=>{ru.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aO(t,r,a,i)});function i3(t){return new i5({type:"boolean",...ef(t)})}let i8=eL("ZodNull",(t,r)=>{rd.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aC(t,r,a,i)});function i7(t){return new i8({type:"null",...ef(t)})}let ne=eL("ZodAny",(t,r)=>{rp.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aI(t,r,a,i)}),nt=eL("ZodUnknown",(t,r)=>{rm.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aq(t,r,a,i)});function nr(){return new nt({type:"unknown"})}let na=eL("ZodNever",(t,r)=>{rh.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aN(t,r,a,i)}),ni=eL("ZodArray",(t,r)=>{iP(),ry.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aD(t,r,a,i),t.element=r.element},{min(t,r){return this.check(r7(t,r))},nonempty(t){return this.check(r7(1,t))},max(t,r){return this.check(r8(t,r))},length(t,r){return this.check(ae(t,r))},unwrap(){return this.element}});function nn(t,r){return new ni({type:"array",element:t,...ef(r)})}let no=eL("ZodObject",(t,r)=>{var a;let i,n;iP(),r$.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aV(t,r,a,i),a="shape",(n=a in(i=Object.getPrototypeOf(t))?void 0:i)&&Object.defineProperty(n,a,{configurable:!0,get(){let t={configurable:!0,writable:!0,enumerable:!1,value:void 0};return Object.defineProperty(this,a,t),t.value=(t=>t._zod.def.shape)(this),Object.defineProperty(this,a,t),t.value},set(t){Object.defineProperty(this,a,{configurable:!0,writable:!0,enumerable:!1,value:t})}})},{keyof(){return nv(Object.keys(this._zod.def.shape))},catchall(t){return this.clone(eo(this._zod.def,{catchall:t}))},passthrough(){return this.clone(eo(this._zod.def,{catchall:nr()}))},loose(){return this.clone(eo(this._zod.def,{catchall:nr()}))},strict(){return this.clone(eo(this._zod.def,{catchall:new na({type:"never",...ef(void 0)})}))},strip(){return this.clone(eo(this._zod.def,{catchall:void 0}))},extend(t){if(!eu(t))throw Error("Invalid input to extend: expected a plain object");let r=this._zod.def.checks;if(r&&r.length>0){let r=er(this);for(let a of Reflect.ownKeys(t))if(void 0!==Object.getOwnPropertyDescriptor(r,a))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return eh(this,eo(this._zod.def,{shape:eb(this,t)}))},safeExtend(t){if(!eu(t))throw Error("Invalid input to safeExtend: expected a plain object");return eh(this,eo(this._zod.def,{shape:eb(this,t)}))},merge(t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(this._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};return en(r,this,Reflect.ownKeys(er(this))),en(r,t,Reflect.ownKeys(er(t))),eh(this,eo(this._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))},pick(t){return function(t,r){let a=t._zod.def,i=a.checks;if(i&&i.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let n={};return en(n,t,e_(t,r)),eh(t,eo(a,{shape:n,checks:[]}))}(this,t)},omit(t){return function(t,r){let a=t._zod.def,i=a.checks;if(i&&i.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let n=new Set(e_(t,r)),o={};return en(o,t,Reflect.ownKeys(er(t)).filter(t=>!n.has(t))),eh(t,eo(a,{shape:o,checks:[]}))}(this,t)},partial(...t){return eS(nw,this,t[0])},exactPartial(...t){return eS(nx,this,t[0],"exactPartial")},required(...t){var r;let a,i;return a=(r=t[0])?new Set(e_(this,r)):void 0,en(i={},this,Reflect.ownKeys(er(this)),(t,r)=>a&&!a.has(r)?t:new nT({type:"nonoptional",innerType:t})),eh(this,eo(this._zod.def,{shape:i}))}});function ns(t,r){return new no({type:"object",shape:t??{},...ef(r)})}function nl(t,r){return new no({type:"object",shape:t,catchall:nr(),...ef(r)})}let nc=eL("ZodUnion",(t,r)=>{rk.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aF(t,r,a,i),t.options=r.options});function nu(t,r){return new nc({type:"union",options:t,...ef(r)})}let nd=eL("ZodDiscriminatedUnion",(t,r)=>{nc.init(t,r),rx.init(t,r)});function np(t,r,a){return new nd({type:"union",options:r,discriminator:t,...ef(a)})}let nm=eL("ZodIntersection",(t,r)=>{rR.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aU(t,r,a,i)});function nh(t,r){return new nm({type:"intersection",left:t,right:r})}let nf=eL("ZodRecord",(t,r)=>{iP(),rE.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aJ(t,r,a,i),t.keyType=r.keyType,t.valueType=r.valueType});function ny(t,r,a){return new nf(r&&r._zod?{type:"record",keyType:t,valueType:r,...ef(a)}:{type:"record",keyType:iO(),valueType:t,...ef(r)})}let ng=eL("ZodEnum",(t,r)=>{rj.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aA(t,r,a,i),t.enum=r.entries,t.options=[...t._zod.values];let a=new Set(Object.keys(r.entries));t.extract=(t,i)=>{let n={};for(let i of t)if(a.has(i))n[i]=r.entries[i];else throw Error(`Key ${i} not found in enum`);return new ng({...r,checks:[],...ef(i),entries:n})},t.exclude=(t,i)=>{let n={...r.entries};for(let r of t)if(a.has(r))delete n[r];else throw Error(`Key ${r} not found in enum`);return new ng({...r,checks:[],...ef(i),entries:n})}});function nv(t,r){return new ng({type:"enum",entries:Array.isArray(t)?Object.fromEntries(t.map(t=>[t,t])):t,...ef(r)})}let n_=eL("ZodLiteral",(t,r)=>{rT.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,a,i)=>az(t,r,a,i),t.values=new Set(r.values),Object.defineProperty(t,"value",{get(){if(r.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return r.values[0]}})});function nb(t,r){return new n_({type:"literal",values:Array.isArray(t)?t:[t],...ef(r)})}let nS=eL("ZodTransform",(t,r)=>{iP(),rO.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aL(t,r,a,i),t._zod.parse=(a,i)=>{if("backward"===i.direction)throw new eZ(t.constructor.name);a.addIssue=i=>{"string"==typeof i?a.issues.push(eT(i,a.value,r)):(i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=a.value),i.inst??(i.inst=t),a.issues.push(eT(i)))};let n=r.transform(a.value,a);return n instanceof Promise?n.then(t=>(a.value=t,a)):(a.value=n,a)}});function n$(t){return new nS({type:"transform",transform:t})}let nw=eL("ZodOptional",(t,r)=>{rN.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,a,i)=>a2(t,r,a,i),t.unwrap=()=>t._zod.def.innerType});function nk(t){return new nw({type:"optional",innerType:t})}let nx=eL("ZodExactOptional",(t,r)=>{rI.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,a,i)=>a2(t,r,a,i),t.unwrap=()=>t._zod.def.innerType}),nR=eL("ZodNullable",(t,r)=>{rq.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aK(t,r,a,i),t.unwrap=()=>t._zod.def.innerType});function nP(t){return new nR({type:"nullable",innerType:t})}let nE=eL("ZodDefault",(t,r)=>{rA.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aY(t,r,a,i),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap}),nj=eL("ZodPrefault",(t,r)=>{rM.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aX(t,r,a,i),t.unwrap=()=>t._zod.def.innerType}),nT=eL("ZodNonOptional",(t,r)=>{rL.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aB(t,r,a,i),t.unwrap=()=>t._zod.def.innerType}),nO=eL("ZodCatch",(t,r)=>{rV.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aQ(t,r,a,i),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap}),nC=eL("ZodPipe",(t,r)=>{rF.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,a,i)=>a0(t,r,a,i),t.in=r.in,t.out=r.out});function nN(t,r){return new nC({type:"pipe",in:t,out:r})}let nI=eL("ZodPreprocess",(t,r)=>{nC.init(t,r),rH.init(t,r)}),nq=eL("ZodReadonly",(t,r)=>{rJ.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,a,i)=>a1(t,r,a,i),t.unwrap=()=>t._zod.def.innerType}),nA=eL("ZodLazy",(t,r)=>{rB.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,a,i)=>a9(t,r,a,i),t.unwrap=()=>t._zod.def.getter()});function nz(t){return new nA({type:"lazy",getter:t})}let nM=eL("ZodCustom",(t,r)=>{rG.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aM(t,r,a,i)});function nL(t,r){return new nI({type:"pipe",in:n$(t),out:r})}O||(O={});let nD="2025-11-25",nZ=[nD,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],nV="io.modelcontextprotocol/protocolVersion",nF="io.modelcontextprotocol/clientInfo",nU="io.modelcontextprotocol/serverInfo",nH="io.modelcontextprotocol/clientCapabilities",nJ="io.modelcontextprotocol/subscriptionId",nK="io.modelcontextprotocol/logLevel",nB=nz(()=>nu([iO(),i9(),i3(),i7(),ny(iO(),nB),nn(nB)])),nG=ny(iO(),nB),nW=nn(nB),nY=nu([iO(),i9().int()]),nX=iO(),nQ=ns({ttl:i9().optional()}),n0=ns({taskId:iO()}),n1=nl({progressToken:nY.optional(),"io.modelcontextprotocol/related-task":n0.optional()}),n2=ns({_meta:n1.optional()}),n9=n2.extend({task:nQ.optional()}),n4=ns({method:iO(),params:n2.loose().optional()}),n6=ns({_meta:n1.optional()}),n5=ns({method:iO(),params:n6.loose().optional()}),n3=nl({get[nU](){return op.optional().catch(void 0)}}),n8=nl({_meta:n3.optional()}),n7=nu([iO(),i9().int()]),oe=ns({jsonrpc:nb("2.0"),id:n7,...n4.shape}).strict(),ot=ns({jsonrpc:nb("2.0"),...n5.shape}).strict(),or=ns({jsonrpc:nb("2.0"),id:n7,result:n8}).strict(),oa=ns({jsonrpc:nb("2.0"),id:n7.optional(),error:ns({code:i9().int(),message:iO(),data:nr().optional()})}).strict(),oi=nu([oe,ot,or,oa]),on=nu([or,oa]),oo=n8.strict(),os=n6.extend({requestId:n7.optional(),reason:iO().optional()}),ol=n5.extend({method:nb("notifications/cancelled"),params:os}),oc=ns({src:iO(),mimeType:iO().optional(),sizes:nn(iO()).optional(),theme:nv(["light","dark"]).optional()}),ou=ns({icons:nn(oc).optional()}),od=ns({name:iO(),title:iO().optional()}),op=od.extend({...od.shape,...ou.shape,version:iO(),websiteUrl:iO().optional(),description:iO().optional()}),om=nh(ns({applyDefaults:i3().optional()}),nG),oh=nL(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,nh(ns({form:om.optional(),url:nG.optional()}),nG.optional())),of=nl({list:nG.optional(),cancel:nG.optional(),requests:nl({sampling:nl({createMessage:nG.optional()}).optional(),elicitation:nl({create:nG.optional()}).optional()}).optional()}),oy=nl({list:nG.optional(),cancel:nG.optional(),requests:nl({tools:nl({call:nG.optional()}).optional()}).optional()}),og=ns({experimental:ny(iO(),nG).optional(),sampling:ns({context:nG.optional(),tools:nG.optional()}).optional(),elicitation:oh.optional(),roots:ns({listChanged:i3().optional()}).optional(),tasks:of.optional(),extensions:ny(iO(),nG).optional()}),ov=n2.extend({protocolVersion:iO(),capabilities:og,clientInfo:op}),o_=n4.extend({method:nb("initialize"),params:ov}),ob=ns({experimental:ny(iO(),nG).optional(),logging:nG.optional(),completions:nG.optional(),prompts:ns({listChanged:i3().optional()}).optional(),resources:ns({subscribe:i3().optional(),listChanged:i3().optional()}).optional(),tools:ns({listChanged:i3().optional()}).optional(),tasks:oy.optional(),extensions:ny(iO(),nG).optional()}),oS=n8.extend({protocolVersion:iO(),capabilities:ob,serverInfo:op,instructions:iO().optional()}),o$=n5.extend({method:nb("notifications/initialized"),params:n6.optional()}),ow=n4.extend({method:nb("server/discover"),params:n2.optional()}),ok=n8.extend({supportedVersions:nn(iO()),capabilities:ob,instructions:iO().optional()}),ox=n4.extend({method:nb("ping"),params:n2.optional()}),oR=ns({progress:i9(),total:nk(i9()),message:nk(iO())}),oP=ns({...n6.shape,...oR.shape,progressToken:nY}),oE=n5.extend({method:nb("notifications/progress"),params:oP}),oj=n2.extend({cursor:nX.optional()}),oT=n4.extend({params:oj.optional()}),oO=n8.extend({nextCursor:nX.optional()}),oC=ns({uri:iO(),mimeType:nk(iO()),_meta:ny(iO(),nr()).optional()}),oN=oC.extend({text:iO()}),oI=iO().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),oq=oC.extend({blob:oI}),oA=nv(["user","assistant"]),oz=ns({audience:nn(oA).optional(),priority:i9().min(0).max(1).optional(),lastModified:r1(iN,{offset:!0}).optional()}),oM=ns({...od.shape,...ou.shape,uri:iO(),description:nk(iO()),mimeType:nk(iO()),size:nk(i9()),annotations:oz.optional(),_meta:nk(nl({}))}),oL=ns({...od.shape,...ou.shape,uriTemplate:iO(),description:nk(iO()),mimeType:nk(iO()),annotations:oz.optional(),_meta:nk(nl({}))}),oD=oT.extend({method:nb("resources/list")}),oZ=oO.extend({resources:nn(oM)}),oV=oT.extend({method:nb("resources/templates/list")}),oF=oO.extend({resourceTemplates:nn(oL)}),oU=n2.extend({uri:iO()}),oH=n4.extend({method:nb("resources/read"),params:oU}),oJ=n8.extend({contents:nn(nu([oN,oq]))}),oK=n5.extend({method:nb("notifications/resources/list_changed"),params:n6.optional()}),oB=n4.extend({method:nb("resources/subscribe"),params:oU}),oG=n4.extend({method:nb("resources/unsubscribe"),params:oU}),oW=ns({toolsListChanged:i3().optional(),promptsListChanged:i3().optional(),resourcesListChanged:i3().optional(),resourceSubscriptions:nn(iO()).optional()}),oY=n2.extend({notifications:oW}),oX=n4.extend({method:nb("subscriptions/listen"),params:oY}),oQ=n6.extend({notifications:oW}),o0=n5.extend({method:nb("notifications/subscriptions/acknowledged"),params:oQ}),o1=n3.extend({[nJ]:n7}),o2=n8.extend({_meta:o1}),o9=n6.extend({uri:iO()}),o4=n5.extend({method:nb("notifications/resources/updated"),params:o9}),o6=ns({name:iO(),description:nk(iO()),required:nk(i3())}),o5=ns({...od.shape,...ou.shape,description:nk(iO()),arguments:nk(nn(o6)),_meta:nk(nl({}))}),o3=oT.extend({method:nb("prompts/list")}),o8=oO.extend({prompts:nn(o5)}),o7=n2.extend({name:iO(),arguments:ny(iO(),iO()).optional()}),se=n4.extend({method:nb("prompts/get"),params:o7}),st=ns({type:nb("text"),text:iO(),annotations:oz.optional(),_meta:ny(iO(),nr()).optional()}),sr=ns({type:nb("image"),data:oI,mimeType:iO(),annotations:oz.optional(),_meta:ny(iO(),nr()).optional()}),sa=ns({type:nb("audio"),data:oI,mimeType:iO(),annotations:oz.optional(),_meta:ny(iO(),nr()).optional()}),si=ns({type:nb("tool_use"),name:iO(),id:iO(),input:ny(iO(),nr()),_meta:ny(iO(),nr()).optional()}),sn=ns({type:nb("resource"),resource:nu([oN,oq]),annotations:oz.optional(),_meta:ny(iO(),nr()).optional()}),so=oM.extend({type:nb("resource_link")}),ss=nu([st,sr,sa,so,sn]),sl=ns({role:oA,content:ss}),sc=n8.extend({description:iO().optional(),messages:nn(sl)}),su=n5.extend({method:nb("notifications/prompts/list_changed"),params:n6.optional()}),sd=ns({title:iO().optional(),readOnlyHint:i3().optional(),destructiveHint:i3().optional(),idempotentHint:i3().optional(),openWorldHint:i3().optional()}),sp=ns({taskSupport:nv(["required","optional","forbidden"]).optional()}),sm=ns({...od.shape,...ou.shape,description:iO().optional(),inputSchema:ns({type:nb("object"),properties:ny(iO(),nB).optional(),required:nn(iO()).optional()}).catchall(nr()),outputSchema:nl({$schema:iO().optional()}).optional(),annotations:sd.optional(),execution:sp.optional(),_meta:ny(iO(),nr()).optional()}),sh=oT.extend({method:nb("tools/list")}),sf=oO.extend({tools:nn(sm)}),sy=n8.extend({content:nn(ss).default([]),structuredContent:nr().optional(),isError:i3().optional()}),sg=sy.or(n8.extend({toolResult:nr()})),sv=n9.extend({name:iO(),arguments:ny(iO(),nr()).optional()}),s_=n4.extend({method:nb("tools/call"),params:sv}),sb=n5.extend({method:nb("notifications/tools/list_changed"),params:n6.optional()}),sS=ns({autoRefresh:i3().default(!0),debounceMs:i9().int().nonnegative().default(300)}),s$=nv(["debug","info","notice","warning","error","critical","alert","emergency"]),sw=n2.extend({level:s$}),sk=n4.extend({method:nb("logging/setLevel"),params:sw}),sx=n6.extend({level:s$,logger:iO().optional(),data:nr()}),sR=n5.extend({method:nb("notifications/message"),params:sx}),sP=ns({name:iO().optional()}),sE=ns({hints:nn(sP).optional(),costPriority:i9().min(0).max(1).optional(),speedPriority:i9().min(0).max(1).optional(),intelligencePriority:i9().min(0).max(1).optional()}),sj=ns({mode:nv(["auto","required","none"]).optional()}),sT=ns({type:nb("tool_result"),toolUseId:iO().describe("The unique identifier for the corresponding tool call."),content:nn(ss),structuredContent:nr().optional(),isError:i3().optional(),_meta:ny(iO(),nr()).optional()}),sO=np("type",[st,sr,sa]),sC=np("type",[st,sr,sa,si,sT]),sN=ns({role:oA,content:nu([sC,nn(sC)]),_meta:ny(iO(),nr()).optional()}),sI=n9.extend({messages:nn(sN),modelPreferences:sE.optional(),systemPrompt:iO().optional(),includeContext:nv(["none","thisServer","allServers"]).optional(),temperature:i9().optional(),maxTokens:i9().int(),stopSequences:nn(iO()).optional(),metadata:nG.optional(),tools:nn(sm).optional(),toolChoice:sj.optional()}),sq=n4.extend({method:nb("sampling/createMessage"),params:sI}),sA=n8.extend({model:iO(),stopReason:nk(nv(["endTurn","stopSequence","maxTokens"]).or(iO())),role:oA,content:sO}),sz=n8.extend({model:iO(),stopReason:nk(nv(["endTurn","stopSequence","maxTokens","toolUse"]).or(iO())),role:oA,content:nu([sC,nn(sC)])}),sM=ns({type:nb("boolean"),title:iO().optional(),description:iO().optional(),default:i3().optional()}),sL=ns({type:nb("string"),title:iO().optional(),description:iO().optional(),minLength:i9().optional(),maxLength:i9().optional(),format:nv(["email","uri","date","date-time"]).optional(),default:iO().optional()}),sD=ns({type:nv(["number","integer"]),title:iO().optional(),description:iO().optional(),minimum:i9().optional(),maximum:i9().optional(),default:i9().optional()}),sZ=ns({type:nb("string"),title:iO().optional(),description:iO().optional(),enum:nn(iO()),default:iO().optional()}),sV=ns({type:nb("string"),title:iO().optional(),description:iO().optional(),oneOf:nn(ns({const:iO(),title:iO()})),default:iO().optional()}),sF=ns({type:nb("string"),title:iO().optional(),description:iO().optional(),enum:nn(iO()),enumNames:nn(iO()).optional(),default:iO().optional()}),sU=nu([sZ,sV]),sH=ns({type:nb("array"),title:iO().optional(),description:iO().optional(),minItems:i9().optional(),maxItems:i9().optional(),items:ns({type:nb("string"),enum:nn(iO())}),default:nn(iO()).optional()}),sJ=ns({type:nb("array"),title:iO().optional(),description:iO().optional(),minItems:i9().optional(),maxItems:i9().optional(),items:ns({anyOf:nn(ns({const:iO(),title:iO()}))}),default:nn(iO()).optional()}),sK=nu([sH,sJ]),sB=nu([sF,sU,sK]),sG=nu([sB,sM,sL,sD]),sW=n9.extend({mode:nb("form").optional(),message:iO(),requestedSchema:ns({type:nb("object"),properties:ny(iO(),sG),required:nn(iO()).optional()}).catchall(nr())}),sY=n9.extend({mode:nb("url"),message:iO(),elicitationId:iO(),url:iO().url()}),sX=nu([sW,sY]),sQ=n4.extend({method:nb("elicitation/create"),params:sX}),s0=n6.extend({elicitationId:iO()}),s1=n5.extend({method:nb("notifications/elicitation/complete"),params:s0}),s2=n8.extend({action:nv(["accept","decline","cancel"]),content:nL(t=>null===t?void 0:t,ny(iO(),nu([iO(),i9(),i3(),nn(iO())])).optional())}),s9=ns({type:nb("ref/resource"),uri:iO()}),s4=ns({type:nb("ref/prompt"),name:iO()}),s6=n2.extend({ref:nu([s4,s9]),argument:ns({name:iO(),value:iO()}),context:ns({arguments:ny(iO(),iO()).optional()}).optional()}),s5=n4.extend({method:nb("completion/complete"),params:s6}),s3=n8.extend({completion:nl({values:nn(iO()).max(100),total:nk(i9().int()),hasMore:nk(i3())})}),s8=ns({uri:iO().startsWith("file://"),name:iO().optional(),_meta:ny(iO(),nr()).optional()}),s7=n4.extend({method:nb("roots/list"),params:n2.optional()}),le=n8.extend({roots:nn(s8)}),lt=n5.extend({method:nb("notifications/roots/list_changed"),params:n6.optional()}),lr=nl({ttl:i9().optional(),pollInterval:i9().optional()}),la=nv(["working","input_required","completed","failed","cancelled"]),li=ns({taskId:iO(),status:la,ttl:nu([i9(),i7()]),createdAt:iO(),lastUpdatedAt:iO(),pollInterval:nk(i9()),statusMessage:nk(iO())}),ln=n8.extend({task:li}),lo=n6.merge(li),ls=n5.extend({method:nb("notifications/tasks/status"),params:lo}),ll=n4.extend({method:nb("tasks/get"),params:n2.extend({taskId:iO()})}),lc=n8.merge(li),lu=n4.extend({method:nb("tasks/result"),params:n2.extend({taskId:iO()})}),ld=n8.loose(),lp=oT.extend({method:nb("tasks/list")}),lm=oO.extend({tasks:nn(li)}),lh=n4.extend({method:nb("tasks/cancel"),params:n2.extend({taskId:iO()})}),lf=n8.merge(li),ly=nu([ox,o_,ow,s5,sk,se,o3,oD,oV,oH,oB,oG,oX,s_,sh]),lg=nu([ol,oE,o$,lt]),lv=nu([oo,sA,sz,s2,le]),l_=nu([ox,sq,sQ,s7]),lb=nu([ol,oE,sR,o4,oK,sb,su,o0,s1]),lS=nu([oo,oS,ok,s3,sc,o8,oZ,oF,oJ,sy,sf,o2]),l$=r0(iD,void 0).superRefine((t,r)=>{if(!URL.canParse(t))return r.addIssue({code:"custom",message:"URL must be parseable",fatal:!0}),eA}).refine(t=>{let r=new URL(t);return"javascript:"!==r.protocol&&"data:"!==r.protocol&&"vbscript:"!==r.protocol},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),lw=nl({resource:iO().url(),authorization_servers:nn(l$).optional(),jwks_uri:iO().url().optional(),scopes_supported:nn(iO()).optional(),bearer_methods_supported:nn(iO()).optional(),resource_signing_alg_values_supported:nn(iO()).optional(),resource_name:iO().optional(),resource_documentation:iO().optional(),resource_policy_uri:iO().url().optional(),resource_tos_uri:iO().url().optional(),tls_client_certificate_bound_access_tokens:i3().optional(),authorization_details_types_supported:nn(iO()).optional(),dpop_signing_alg_values_supported:nn(iO()).optional(),dpop_bound_access_tokens_required:i3().optional()}),lk=nl({issuer:iO(),authorization_endpoint:l$,token_endpoint:l$,registration_endpoint:l$.optional(),scopes_supported:nn(iO()).optional(),response_types_supported:nn(iO()),response_modes_supported:nn(iO()).optional(),grant_types_supported:nn(iO()).optional(),token_endpoint_auth_methods_supported:nn(iO()).optional(),token_endpoint_auth_signing_alg_values_supported:nn(iO()).optional(),service_documentation:l$.optional(),revocation_endpoint:l$.optional(),revocation_endpoint_auth_methods_supported:nn(iO()).optional(),revocation_endpoint_auth_signing_alg_values_supported:nn(iO()).optional(),introspection_endpoint:iO().optional(),introspection_endpoint_auth_methods_supported:nn(iO()).optional(),introspection_endpoint_auth_signing_alg_values_supported:nn(iO()).optional(),code_challenge_methods_supported:nn(iO()).optional(),client_id_metadata_document_supported:i3().optional(),authorization_response_iss_parameter_supported:i3().optional().catch(void 0)}),lx=nl({issuer:iO(),authorization_endpoint:l$,token_endpoint:l$,userinfo_endpoint:l$.optional(),jwks_uri:l$,registration_endpoint:l$.optional(),scopes_supported:nn(iO()).optional(),response_types_supported:nn(iO()),response_modes_supported:nn(iO()).optional(),grant_types_supported:nn(iO()).optional(),acr_values_supported:nn(iO()).optional(),subject_types_supported:nn(iO()),id_token_signing_alg_values_supported:nn(iO()),id_token_encryption_alg_values_supported:nn(iO()).optional(),id_token_encryption_enc_values_supported:nn(iO()).optional(),userinfo_signing_alg_values_supported:nn(iO()).optional(),userinfo_encryption_alg_values_supported:nn(iO()).optional(),userinfo_encryption_enc_values_supported:nn(iO()).optional(),request_object_signing_alg_values_supported:nn(iO()).optional(),request_object_encryption_alg_values_supported:nn(iO()).optional(),request_object_encryption_enc_values_supported:nn(iO()).optional(),token_endpoint_auth_methods_supported:nn(iO()).optional(),token_endpoint_auth_signing_alg_values_supported:nn(iO()).optional(),display_values_supported:nn(iO()).optional(),claim_types_supported:nn(iO()).optional(),claims_supported:nn(iO()).optional(),service_documentation:iO().optional(),claims_locales_supported:nn(iO()).optional(),ui_locales_supported:nn(iO()).optional(),claims_parameter_supported:i3().optional(),request_parameter_supported:i3().optional(),request_uri_parameter_supported:i3().optional(),require_request_uri_registration:i3().optional(),op_policy_uri:l$.optional(),op_tos_uri:l$.optional(),client_id_metadata_document_supported:i3().optional(),authorization_response_iss_parameter_supported:i3().optional().catch(void 0)}),lR=ns({...lx.shape,...lk.pick({code_challenge_methods_supported:!0}).shape}),lP=ns({access_token:iO(),id_token:iO().optional(),token_type:iO(),expires_in:new i2(rX({type:"number",coerce:!0,checks:[],...ef(void 0)})).optional(),scope:iO().optional(),refresh_token:iO().optional()}).strip(),lE=ns({issued_token_type:nb("urn:ietf:params:oauth:token-type:id-jag"),access_token:iO(),token_type:iO().optional(),expires_in:i9().optional(),scope:iO().optional()}).strip(),lj=ns({error:iO(),error_description:iO().optional(),error_uri:iO().optional()}),lT=l$.optional().or(nb("").transform(()=>void 0)),lO=ns({redirect_uris:nn(l$),token_endpoint_auth_method:iO().optional(),grant_types:nn(iO()).optional(),response_types:nn(iO()).optional(),application_type:iO().optional(),client_name:iO().optional(),client_uri:l$.optional(),logo_uri:lT,scope:iO().optional(),contacts:nn(iO()).optional(),tos_uri:lT,policy_uri:iO().optional(),jwks_uri:l$.optional(),jwks:new ne({type:"any"}).optional(),software_id:iO().optional(),software_version:iO().optional(),software_statement:iO().optional()}).strip(),lC=ns({client_id:iO(),client_secret:iO().optional(),client_id_issued_at:i9().optional(),client_secret_expires_at:i9().optional()}).strip(),lN=lO.merge(lC),lI=ns({error:iO(),error_description:iO().optional()}).strip(),lq=ns({token:iO(),token_type_hint:iO().optional()}).strip(),lA=Symbol.for("mcp.sdk.errorBrands");function lz(t,r){let a=new Set,i=r;for(;"function"==typeof i;){let t=i.mcpBrand;Object.prototype.hasOwnProperty.call(i,"mcpBrand")&&"string"==typeof t&&a.add(t),i=Object.getPrototypeOf(i)}0!==a.size&&Object.defineProperty(t,lA,{value:a,enumerable:!1,configurable:!0})}function lM(t,r){try{if("object"==typeof r&&null!==r&&Object.prototype.hasOwnProperty.call(t,"mcpBrand")&&"string"==typeof t.mcpBrand&&Object.prototype.hasOwnProperty.call(r,lA)){let a=r[lA];if(a&&"function"==typeof a.has&&a.has(t.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(t,r)}(class t extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return lM(this,t)}static isInstance(t){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return lM(this,t)}constructor(t,r,a){super(r),this.code=t,this.errorUri=a,this.name="OAuthError",lz(this,new.target)}toResponseObject(){let t={error:this.code,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}static fromResponse(r){return new t(r.error,r.error_description??r.error,r.error_uri)}});let lL=((w={}).NotConnected="NOT_CONNECTED",w.AlreadyConnected="ALREADY_CONNECTED",w.NotInitialized="NOT_INITIALIZED",w.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",w.RequestTimeout="REQUEST_TIMEOUT",w.ConnectionClosed="CONNECTION_CLOSED",w.SendFailed="SEND_FAILED",w.InvalidResult="INVALID_RESULT",w.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",w.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",w.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",w.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",w.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",w.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",w.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",w.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",w.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",w.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",w.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",w);var lD=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](t){return lM(this,t)}static isInstance(t){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return lM(this,t)}constructor(t,r,a){super(r),this.code=t,this.data=a,this.name="SdkError",lz(this,new.target)}};function lZ(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function lV(t,r){let a={};for(let[i,n]of Object.entries(t)){if(void 0===n)continue;let t=void 0===r?void 0:r[i];if(void 0===t){a[i]=n;continue}if(lZ(n)&&lZ(t)){let r={};for(let[a,o]of Object.entries(n))void 0!==o&&void 0===t[a]&&("elicitation"!==i||"form"!==a||void 0!==t.form||void 0!==t.url)&&(r[a]=o);Object.keys(r).length>0&&(a[i]=r)}}return Object.keys(a).length>0?a:void 0}(class extends lD{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(t,r,a){super(t,r,a),this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}});let lF="2026-07-28",lU=[lF];function lH(t){return t.filter(t=>t>=lF)}function lJ(t){let r=t.structuredContent;return void 0===r||!("object"!=typeof r||null===r||Array.isArray(r))||t.content?.some(t=>"text"===t.type)?t:{...t,content:[...t.content??[],{type:"text",text:JSON.stringify(r)}]}}let lK=["task","inputRequests","requestState"];function lB(t){return null===t||"object"!=typeof t||Array.isArray(t)||void 0!==t.content||lK.some(r=>r in t)?t:{...t,content:[]}}function lG(){let t,r,a,n,o,s,l,c,u,d,p,m,h,f,y,g,v,_,b,S,$,w,k,x,R,P,E,j,T,O,C,N,I,q,A,z,M,L,D,Z,V,F,U,H,J,K,B,G,W,Y,X,Q,ee,et,er,ea,ei,en,eo,es,el,ec,eu,ed,ep,em,eh,ef,ey,eg,ev,e_,eb,eS,e$,ew,ek,ex,eR,eP,eE,ej,eT,eO,eC,eN,eI,eq,eA,ez,eM,eL,eD,eZ,eV,eF,eU,eH,eJ,eK,eB,eG,eW,eY,eX,eQ,e0,e1,e2,e9,e4,e6,e5,e3,e8,e7,te,tt,tr,ta,ti,tn,to,ts,tl,tc,tu,td,tp,tm,th,tf,ty,tg,tv,t_,tb,tS,t$,tw;return i??=(t=nz(()=>nu([iO(),i9(),i3(),i7(),ny(iO(),t),nn(t)])),r=ny(iO(),t),a=nu([iO(),i9().int()]),n=iO(),o=ns({ttl:i9().optional()}),s=ns({taskId:iO()}),u=(c=ns({_meta:(l=nl({progressToken:a.optional(),"io.modelcontextprotocol/related-task":s.optional()})).optional()})).extend({task:o.optional()}),d=ns({method:iO(),params:c.loose().optional()}),p=ns({_meta:l.optional()}),m=ns({method:iO(),params:p.loose().optional()}),h=nl({_meta:l.optional()}),f=nu([iO(),i9().int()]),y=h.strict(),g=p.extend({requestId:f.optional(),reason:iO().optional()}),v=m.extend({method:nb("notifications/cancelled"),params:g}),_=ns({src:iO(),mimeType:iO().optional(),sizes:nn(iO()).optional(),theme:nv(["light","dark"]).optional()}),b=ns({icons:nn(_).optional()}),$=(S=ns({name:iO(),title:iO().optional()})).extend({...S.shape,...b.shape,version:iO(),websiteUrl:iO().optional(),description:iO().optional()}),w=nh(ns({applyDefaults:i3().optional()}),r),k=nL(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,nh(ns({form:w.optional(),url:r.optional()}),r.optional())),x=nl({list:r.optional(),cancel:r.optional(),requests:nl({sampling:nl({createMessage:r.optional()}).optional(),elicitation:nl({create:r.optional()}).optional()}).optional()}),R=nl({list:r.optional(),cancel:r.optional(),requests:nl({tools:nl({call:r.optional()}).optional()}).optional()}),P=ns({experimental:ny(iO(),r).optional(),sampling:ns({context:r.optional(),tools:r.optional()}).optional(),elicitation:k.optional(),roots:ns({listChanged:i3().optional()}).optional(),tasks:x.optional(),extensions:ny(iO(),r).optional()}),E=c.extend({protocolVersion:iO(),capabilities:P,clientInfo:$}),j=d.extend({method:nb("initialize"),params:E}),T=ns({experimental:ny(iO(),r).optional(),logging:r.optional(),completions:r.optional(),prompts:ns({listChanged:i3().optional()}).optional(),resources:ns({subscribe:i3().optional(),listChanged:i3().optional()}).optional(),tools:ns({listChanged:i3().optional()}).optional(),tasks:R.optional(),extensions:ny(iO(),r).optional()}),O=h.extend({protocolVersion:iO(),capabilities:T,serverInfo:$,instructions:iO().optional()}),C=m.extend({method:nb("notifications/initialized"),params:p.optional()}),N=d.extend({method:nb("ping"),params:c.optional()}),I=ns({progress:i9(),total:nk(i9()),message:nk(iO())}),q=ns({...p.shape,...I.shape,progressToken:a}),A=m.extend({method:nb("notifications/progress"),params:q}),z=c.extend({cursor:n.optional()}),M=d.extend({params:z.optional()}),L=h.extend({nextCursor:n.optional()}),Z=(D=ns({uri:iO(),mimeType:nk(iO()),_meta:ny(iO(),nr()).optional()})).extend({text:iO()}),V=iO().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),F=D.extend({blob:V}),H=ns({audience:nn(U=nv(["user","assistant"])).optional(),priority:i9().min(0).max(1).optional(),lastModified:r1(iN,{offset:!0}).optional()}),J=ns({...S.shape,...b.shape,uri:iO(),description:nk(iO()),mimeType:nk(iO()),size:nk(i9()),annotations:H.optional(),_meta:nk(nl({}))}),K=ns({...S.shape,...b.shape,uriTemplate:iO(),description:nk(iO()),mimeType:nk(iO()),annotations:H.optional(),_meta:nk(nl({}))}),B=M.extend({method:nb("resources/list")}),G=L.extend({resources:nn(J)}),W=M.extend({method:nb("resources/templates/list")}),Y=L.extend({resourceTemplates:nn(K)}),X=c.extend({uri:iO()}),Q=d.extend({method:nb("resources/read"),params:X}),ee=h.extend({contents:nn(nu([Z,F]))}),et=m.extend({method:nb("notifications/resources/list_changed"),params:p.optional()}),er=d.extend({method:nb("resources/subscribe"),params:X}),ea=d.extend({method:nb("resources/unsubscribe"),params:X}),ei=p.extend({uri:iO()}),en=m.extend({method:nb("notifications/resources/updated"),params:ei}),eo=ns({name:iO(),description:nk(iO()),required:nk(i3())}),es=ns({...S.shape,...b.shape,description:nk(iO()),arguments:nk(nn(eo)),_meta:nk(nl({}))}),el=M.extend({method:nb("prompts/list")}),ec=L.extend({prompts:nn(es)}),eu=c.extend({name:iO(),arguments:ny(iO(),iO()).optional()}),ed=d.extend({method:nb("prompts/get"),params:eu}),ep=ns({type:nb("text"),text:iO(),annotations:H.optional(),_meta:ny(iO(),nr()).optional()}),em=ns({type:nb("image"),data:V,mimeType:iO(),annotations:H.optional(),_meta:ny(iO(),nr()).optional()}),eh=ns({type:nb("audio"),data:V,mimeType:iO(),annotations:H.optional(),_meta:ny(iO(),nr()).optional()}),ef=ns({type:nb("tool_use"),name:iO(),id:iO(),input:ny(iO(),nr()),_meta:ny(iO(),nr()).optional()}),ey=ns({type:nb("resource"),resource:nu([Z,F]),annotations:H.optional(),_meta:ny(iO(),nr()).optional()}),e_=ns({role:U,content:ev=nu([ep,em,eh,eg=J.extend({type:nb("resource_link")}),ey])}),eb=h.extend({description:iO().optional(),messages:nn(e_)}),eS=m.extend({method:nb("notifications/prompts/list_changed"),params:p.optional()}),e$=ns({title:iO().optional(),readOnlyHint:i3().optional(),destructiveHint:i3().optional(),idempotentHint:i3().optional(),openWorldHint:i3().optional()}),ew=ns({taskSupport:nv(["required","optional","forbidden"]).optional()}),ek=ns({...S.shape,...b.shape,description:iO().optional(),inputSchema:ns({type:nb("object"),properties:ny(iO(),t).optional(),required:nn(iO()).optional()}).catchall(nr()),outputSchema:ns({type:nb("object"),properties:ny(iO(),t).optional(),required:nn(iO()).optional()}).catchall(nr()).optional(),annotations:e$.optional(),execution:ew.optional(),_meta:ny(iO(),nr()).optional()}),ex=M.extend({method:nb("tools/list")}),eR=L.extend({tools:nn(ek)}),eP=h.extend({content:nn(ev),structuredContent:ny(iO(),nr()).optional(),isError:i3().optional()}),eE=u.extend({name:iO(),arguments:ny(iO(),nr()).optional()}),ej=d.extend({method:nb("tools/call"),params:eE}),eT=m.extend({method:nb("notifications/tools/list_changed"),params:p.optional()}),eO=nv(["debug","info","notice","warning","error","critical","alert","emergency"]),eC=c.extend({level:eO}),eN=d.extend({method:nb("logging/setLevel"),params:eC}),eI=p.extend({level:eO,logger:iO().optional(),data:nr()}),eq=m.extend({method:nb("notifications/message"),params:eI}),eA=ns({name:iO().optional()}),ez=ns({hints:nn(eA).optional(),costPriority:i9().min(0).max(1).optional(),speedPriority:i9().min(0).max(1).optional(),intelligencePriority:i9().min(0).max(1).optional()}),eM=ns({mode:nv(["auto","required","none"]).optional()}),eL=ns({type:nb("tool_result"),toolUseId:iO().describe("The unique identifier for the corresponding tool call."),content:nn(ev),structuredContent:ns({}).loose().optional(),isError:i3().optional(),_meta:ny(iO(),nr()).optional()}),eD=np("type",[ep,em,eh]),eV=ns({role:U,content:nu([eZ=np("type",[ep,em,eh,ef,eL]),nn(eZ)]),_meta:ny(iO(),nr()).optional()}),eF=u.extend({messages:nn(eV),modelPreferences:ez.optional(),systemPrompt:iO().optional(),includeContext:nv(["none","thisServer","allServers"]).optional(),temperature:i9().optional(),maxTokens:i9().int(),stopSequences:nn(iO()).optional(),metadata:r.optional(),tools:nn(ek).optional(),toolChoice:eM.optional()}),eU=d.extend({method:nb("sampling/createMessage"),params:eF}),eH=h.extend({model:iO(),stopReason:nk(nv(["endTurn","stopSequence","maxTokens"]).or(iO())),role:U,content:eD}),eJ=h.extend({model:iO(),stopReason:nk(nv(["endTurn","stopSequence","maxTokens","toolUse"]).or(iO())),role:U,content:nu([eZ,nn(eZ)])}),eK=ns({type:nb("boolean"),title:iO().optional(),description:iO().optional(),default:i3().optional()}),eB=ns({type:nb("string"),title:iO().optional(),description:iO().optional(),minLength:i9().optional(),maxLength:i9().optional(),format:nv(["email","uri","date","date-time"]).optional(),default:iO().optional()}),eG=ns({type:nv(["number","integer"]),title:iO().optional(),description:iO().optional(),minimum:i9().optional(),maximum:i9().optional(),default:i9().optional()}),eW=ns({type:nb("string"),title:iO().optional(),description:iO().optional(),enum:nn(iO()),default:iO().optional()}),eY=ns({type:nb("string"),title:iO().optional(),description:iO().optional(),oneOf:nn(ns({const:iO(),title:iO()})),default:iO().optional()}),eX=ns({type:nb("string"),title:iO().optional(),description:iO().optional(),enum:nn(iO()),enumNames:nn(iO()).optional(),default:iO().optional()}),eQ=nu([eW,eY]),e0=ns({type:nb("array"),title:iO().optional(),description:iO().optional(),minItems:i9().optional(),maxItems:i9().optional(),items:ns({type:nb("string"),enum:nn(iO())}),default:nn(iO()).optional()}),e2=nu([e0,e1=ns({type:nb("array"),title:iO().optional(),description:iO().optional(),minItems:i9().optional(),maxItems:i9().optional(),items:ns({anyOf:nn(ns({const:iO(),title:iO()}))}),default:nn(iO()).optional()})]),e9=nu([eX,eQ,e2]),e4=nu([e9,eK,eB,eG]),e6=u.extend({mode:nb("form").optional(),message:iO(),requestedSchema:ns({type:nb("object"),properties:ny(iO(),e4),required:nn(iO()).optional()}).catchall(nr())}),e3=nu([e6,e5=u.extend({mode:nb("url"),message:iO(),elicitationId:iO(),url:iO().url()})]),e8=d.extend({method:nb("elicitation/create"),params:e3}),e7=p.extend({elicitationId:iO()}),te=m.extend({method:nb("notifications/elicitation/complete"),params:e7}),tt=h.extend({action:nv(["accept","decline","cancel"]),content:nL(t=>null===t?void 0:t,ny(iO(),nu([iO(),i9(),i3(),nn(iO())])).optional())}),tr=ns({type:nb("ref/resource"),uri:iO()}),ta=ns({type:nb("ref/prompt"),name:iO()}),ti=c.extend({ref:nu([ta,tr]),argument:ns({name:iO(),value:iO()}),context:ns({arguments:ny(iO(),iO()).optional()}).optional()}),tn=d.extend({method:nb("completion/complete"),params:ti}),to=h.extend({completion:nl({values:nn(iO()).max(100),total:nk(i9().int()),hasMore:nk(i3())})}),ts=ns({uri:iO().startsWith("file://"),name:iO().optional(),_meta:ny(iO(),nr()).optional()}),tl=d.extend({method:nb("roots/list"),params:c.optional()}),tc=h.extend({roots:nn(ts)}),tu=m.extend({method:nb("notifications/roots/list_changed"),params:p.optional()}),td=nl({ttl:i9().optional(),pollInterval:i9().optional()}),tp=nv(["working","input_required","completed","failed","cancelled"]),tm=ns({taskId:iO(),status:tp,ttl:nu([i9(),i7()]),createdAt:iO(),lastUpdatedAt:iO(),pollInterval:nk(i9()),statusMessage:nk(iO())}),th=h.extend({task:tm}),tf=p.merge(tm),ty=m.extend({method:nb("notifications/tasks/status"),params:tf}),tg=d.extend({method:nb("tasks/get"),params:c.extend({taskId:iO()})}),tv=h.merge(tm),t_=d.extend({method:nb("tasks/result"),params:c.extend({taskId:iO()})}),tb=h.loose(),tS=M.extend({method:nb("tasks/list")}),t$=L.extend({tasks:nn(tm)}),tw=d.extend({method:nb("tasks/cancel"),params:c.extend({taskId:iO()})}),{JSONValueSchema:t,JSONObjectSchema:r,ProgressTokenSchema:a,CursorSchema:n,TaskMetadataSchema:o,RelatedTaskMetadataSchema:s,RequestMetaSchema:l,BaseRequestParamsSchema:c,TaskAugmentedRequestParamsSchema:u,RequestSchema:d,NotificationsParamsSchema:p,NotificationSchema:m,ResultSchema:h,RequestIdSchema:f,EmptyResultSchema:y,CancelledNotificationParamsSchema:g,CancelledNotificationSchema:v,IconSchema:_,IconsSchema:b,BaseMetadataSchema:S,ImplementationSchema:$,ClientTasksCapabilitySchema:x,ServerTasksCapabilitySchema:R,ClientCapabilitiesSchema:P,InitializeRequestParamsSchema:E,InitializeRequestSchema:j,ServerCapabilitiesSchema:T,InitializeResultSchema:O,InitializedNotificationSchema:C,PingRequestSchema:N,ProgressSchema:I,ProgressNotificationParamsSchema:q,ProgressNotificationSchema:A,PaginatedRequestParamsSchema:z,PaginatedRequestSchema:M,PaginatedResultSchema:L,ResourceContentsSchema:D,TextResourceContentsSchema:Z,BlobResourceContentsSchema:F,RoleSchema:U,AnnotationsSchema:H,ResourceSchema:J,ResourceTemplateSchema:K,ListResourcesRequestSchema:B,ListResourcesResultSchema:G,ListResourceTemplatesRequestSchema:W,ListResourceTemplatesResultSchema:Y,ResourceRequestParamsSchema:X,ReadResourceRequestParamsSchema:X,ReadResourceRequestSchema:Q,ReadResourceResultSchema:ee,ResourceListChangedNotificationSchema:et,SubscribeRequestParamsSchema:X,SubscribeRequestSchema:er,UnsubscribeRequestParamsSchema:X,UnsubscribeRequestSchema:ea,ResourceUpdatedNotificationParamsSchema:ei,ResourceUpdatedNotificationSchema:en,PromptArgumentSchema:eo,PromptSchema:es,ListPromptsRequestSchema:el,ListPromptsResultSchema:ec,GetPromptRequestParamsSchema:eu,GetPromptRequestSchema:ed,TextContentSchema:ep,ImageContentSchema:em,AudioContentSchema:eh,ToolUseContentSchema:ef,EmbeddedResourceSchema:ey,ResourceLinkSchema:eg,ContentBlockSchema:ev,PromptMessageSchema:e_,GetPromptResultSchema:eb,PromptListChangedNotificationSchema:eS,ToolAnnotationsSchema:e$,ToolExecutionSchema:ew,ToolSchema:ek,ListToolsRequestSchema:ex,ListToolsResultSchema:eR,CallToolResultSchema:eP,CallToolRequestParamsSchema:eE,CallToolRequestSchema:ej,ToolListChangedNotificationSchema:eT,LoggingLevelSchema:eO,SetLevelRequestParamsSchema:eC,SetLevelRequestSchema:eN,LoggingMessageNotificationParamsSchema:eI,LoggingMessageNotificationSchema:eq,ModelHintSchema:eA,ModelPreferencesSchema:ez,ToolChoiceSchema:eM,ToolResultContentSchema:eL,SamplingContentSchema:eD,SamplingMessageContentBlockSchema:eZ,SamplingMessageSchema:eV,CreateMessageRequestParamsSchema:eF,CreateMessageRequestSchema:eU,CreateMessageResultSchema:eH,CreateMessageResultWithToolsSchema:eJ,BooleanSchemaSchema:eK,StringSchemaSchema:eB,NumberSchemaSchema:eG,UntitledSingleSelectEnumSchemaSchema:eW,TitledSingleSelectEnumSchemaSchema:eY,LegacyTitledEnumSchemaSchema:eX,SingleSelectEnumSchemaSchema:eQ,UntitledMultiSelectEnumSchemaSchema:e0,TitledMultiSelectEnumSchemaSchema:e1,MultiSelectEnumSchemaSchema:e2,EnumSchemaSchema:e9,PrimitiveSchemaDefinitionSchema:e4,ElicitRequestFormParamsSchema:e6,ElicitRequestURLParamsSchema:e5,ElicitRequestParamsSchema:e3,ElicitRequestSchema:e8,ElicitationCompleteNotificationParamsSchema:e7,ElicitationCompleteNotificationSchema:te,ElicitResultSchema:tt,ResourceTemplateReferenceSchema:tr,PromptReferenceSchema:ta,CompleteRequestParamsSchema:ti,CompleteRequestSchema:tn,CompleteResultSchema:to,RootSchema:ts,ListRootsRequestSchema:tl,ListRootsResultSchema:tc,RootsListChangedNotificationSchema:tu,TaskCreationParamsSchema:td,TaskStatusSchema:tp,TaskSchema:tm,CreateTaskResultSchema:th,TaskStatusNotificationParamsSchema:tf,TaskStatusNotificationSchema:ty,GetTaskRequestSchema:tg,GetTaskResultSchema:tv,GetTaskPayloadRequestSchema:t_,GetTaskPayloadResultSchema:tb,ListTasksRequestSchema:tS,ListTasksResultSchema:t$,CancelTaskRequestSchema:tw,CancelTaskResultSchema:h.merge(tm),ClientRequestSchema:nu([N,j,tn,eN,ed,el,B,W,Q,er,ea,ej,ex,tg,t_,tS,tw]),ClientNotificationSchema:nu([v,A,C,tu,ty]),ClientResultSchema:nu([y,eH,eJ,tt,tc,tv,t$,th]),ServerRequestSchema:nu([N,eU,e8,tl,tg,t_,tS,tw]),ServerNotificationSchema:nu([v,A,eq,en,et,eT,eS,ty,te]),ServerResultSchema:nu([y,O,to,eb,ec,G,Y,ee,eP,eR,tv,t$,th]),CallToolResultWireSchema:nr().superRefine((t,r)=>{if(!("object"!=typeof t||null===t||Array.isArray(t))&&void 0===t.content){for(let a of lK)if(a in t)return void r.addIssue({code:"custom",message:`content is required when the body carries '${a}' — another result family cannot default into an empty tools/call success`})}}).transform(lB).pipe(eP)})}function lW(t){return"object"!==t.type}let lY=new Set(["const","enum","default","examples"]),lX=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function lQ(t){return void 0!==t&&!("string"==typeof t&&t.startsWith("#"))}let l0={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},l1={"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},l2={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 l9(){if(n)return n;let t=lG();return n={requestSchemas:{ping:t.PingRequestSchema,initialize:t.InitializeRequestSchema,"completion/complete":t.CompleteRequestSchema,"logging/setLevel":t.SetLevelRequestSchema,"prompts/get":t.GetPromptRequestSchema,"prompts/list":t.ListPromptsRequestSchema,"resources/list":t.ListResourcesRequestSchema,"resources/templates/list":t.ListResourceTemplatesRequestSchema,"resources/read":t.ReadResourceRequestSchema,"resources/subscribe":t.SubscribeRequestSchema,"resources/unsubscribe":t.UnsubscribeRequestSchema,"tools/call":t.CallToolRequestSchema,"tools/list":t.ListToolsRequestSchema,"tasks/get":t.GetTaskRequestSchema,"tasks/result":t.GetTaskPayloadRequestSchema,"tasks/list":t.ListTasksRequestSchema,"tasks/cancel":t.CancelTaskRequestSchema,"sampling/createMessage":t.CreateMessageRequestSchema,"elicitation/create":t.ElicitRequestSchema,"roots/list":t.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":t.CancelledNotificationSchema,"notifications/progress":t.ProgressNotificationSchema,"notifications/initialized":t.InitializedNotificationSchema,"notifications/roots/list_changed":t.RootsListChangedNotificationSchema,"notifications/tasks/status":t.TaskStatusNotificationSchema,"notifications/message":t.LoggingMessageNotificationSchema,"notifications/resources/updated":t.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":t.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":t.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":t.PromptListChangedNotificationSchema,"notifications/elicitation/complete":t.ElicitationCompleteNotificationSchema},resultSchemas:{ping:t.EmptyResultSchema,initialize:t.InitializeResultSchema,"completion/complete":t.CompleteResultSchema,"logging/setLevel":t.EmptyResultSchema,"prompts/get":t.GetPromptResultSchema,"prompts/list":t.ListPromptsResultSchema,"resources/list":t.ListResourcesResultSchema,"resources/templates/list":t.ListResourceTemplatesResultSchema,"resources/read":t.ReadResourceResultSchema,"resources/subscribe":t.EmptyResultSchema,"resources/unsubscribe":t.EmptyResultSchema,"tools/call":t.CallToolResultWireSchema,"tools/list":t.ListToolsResultSchema,"sampling/createMessage":t.CreateMessageResultWithToolsSchema,"elicitation/create":t.ElicitResultSchema,"roots/list":t.ListRootsResultSchema}}}function l4(t){return Object.prototype.hasOwnProperty.call(l0,t)}function l6(t){return Object.prototype.hasOwnProperty.call(l1,t)}function l5(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function l3(t,r){if(void 0===t)return{ok:!1,reason:"not-in-era"};let a=t.safeParse(r);return a.success?{ok:!0,value:a.data}:{ok:!1,reason:"invalid",message:String(a.error)}}Object.keys(l0),Object.keys(l1);let l8={ok:!1,reason:"not-in-era"};function l7(t){return l5(t)&&l5(t.outputSchema)&&lW(t.outputSchema)}let ce={era:"2025-11-25",hasRequestMethod:l4,hasNotificationMethod:l6,validateRequest:(t,r)=>l3(l4(t)?l9().requestSchemas[t]:void 0,r),validateResult:(t,r)=>l3(Object.prototype.hasOwnProperty.call(l2,t)?l9().resultSchemas[t]:void 0,r),validateNotification:(t,r)=>l3(l6(t)?l9().notificationSchemas[t]:void 0,r),hasInputRequestMethod:()=>!1,validateInputRequest:()=>l8,validateInputResponse:()=>l8,samplingResultVariant:(t,r)=>{let a=lG();return l3(t?a.CreateMessageResultWithToolsSchema:a.CreateMessageResultSchema,r)},outboundEnvelope:t=>void 0,validateEnvelopeMeta:t=>[],projectCallToolResult(t,r){let a=lJ(t),i=a.structuredContent;if(void 0===i)return a;let n="object"!=typeof i||null===i||Array.isArray(i),o=void 0!==r&&lW(r);return n||o?{...a,structuredContent:{result:i}}:a},decodeResult(t,r){if(l5(r)&&"resultType"in r){let t={...r};return delete t.resultType,{kind:"complete",result:t}}return{kind:"complete",result:r}},encodeResult(t,r){if("tools/list"!==t)return r;let a=r.tools;return Array.isArray(a)&&a.some(t=>l7(t))?{...r,tools:a.map(t=>l7(t)?{...t,outputSchema:function(t){var r;let a="string"==typeof t.$schema?t.$schema:void 0;if(lQ(t.$id))return{...void 0!==a&&{$schema:a},type:"object",properties:{result:t},required:["result"]};let i="string"==typeof(r=t.$schema)&&U.has(r.replace(/#$/,""))&&!0!==t.$recursiveAnchor,n=(t,r)=>{if(Array.isArray(t))return t.map(t=>n(t,!1));if(null===t||"object"!=typeof t||!r&&lQ(t.$id))return t;let a={},o=!1;for(let[s,l]of Object.entries(t))r?a[s]=n(l,!1):("$ref"===s||"$dynamicRef"===s)&&"string"==typeof l?a[s]="#"===l?"#/properties/result":l.startsWith("#/")?`#/properties/result${l.slice(1)}`:l:"$recursiveRef"===s&&"#"===l&&i?o=!0:lY.has(s)?a[s]=l:lX.has(s)?a[s]=n(l,!0):a[s]=n(l,!1);return o&&("$ref"in a?a.allOf=[...Array.isArray(a.allOf)?a.allOf:[],{$ref:"#/properties/result"}]:a.$ref="#/properties/result"),a};return{...void 0!==a&&{$schema:a},type:"object",properties:{result:n(t,!1)},required:["result"]}}(t.outputSchema)}:t)}:r},encodeErrorCode:t=>-32002===t?-32602:t,checkInboundEnvelope:t=>void 0};function ct(){return o??=function(){let t=nz(()=>nu([iO(),i9(),i3(),i7(),ny(iO(),t),nn(t)])),r=ny(iO(),t),a=nu([iO(),i9().int()]),i=iO(),n=nu([iO(),i9().int()]),o=nv(["user","assistant"]),s=nv(["debug","info","notice","warning","error","critical","alert","emergency"]),l=iO().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),c=ns({ttl:i9().optional()}),u=ns({taskId:iO()}),d=nl({progressToken:a.optional(),"io.modelcontextprotocol/related-task":u.optional()}),p=ns({_meta:d.optional()}),m=p.extend({task:c.optional()}),h=ns({_meta:d.optional()}),f=ns({method:iO(),params:h.loose().optional()}),y=ns({src:iO(),mimeType:iO().optional(),sizes:nn(iO()).optional(),theme:nv(["light","dark"]).optional()}),g=ns({icons:nn(y).optional()}),v=ns({name:iO(),title:iO().optional()}),_=v.extend({...v.shape,...g.shape,version:iO(),websiteUrl:iO().optional(),description:iO().optional()}),b=nh(ns({applyDefaults:i3().optional()}),r),S=nL(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,nh(ns({form:b.optional(),url:r.optional()}),r.optional())),$=nl({list:r.optional(),cancel:r.optional(),requests:nl({sampling:nl({createMessage:r.optional()}).optional(),elicitation:nl({create:r.optional()}).optional()}).optional()}),w=nl({list:r.optional(),cancel:r.optional(),requests:nl({tools:nl({call:r.optional()}).optional()}).optional()}),k=ns({experimental:ny(iO(),r).optional(),sampling:ns({context:r.optional(),tools:r.optional()}).optional(),elicitation:S.optional(),roots:ns({listChanged:i3().optional()}).optional(),tasks:$.optional(),extensions:ny(iO(),r).optional()}),x=ns({experimental:ny(iO(),r).optional(),logging:r.optional(),completions:r.optional(),prompts:ns({listChanged:i3().optional()}).optional(),resources:ns({subscribe:i3().optional(),listChanged:i3().optional()}).optional(),tools:ns({listChanged:i3().optional()}).optional(),tasks:w.optional(),extensions:ny(iO(),r).optional()}),R=ns({progress:i9(),total:nk(i9()),message:nk(iO())}),P=ns({...h.shape,...R.shape,progressToken:a}),E=f.extend({method:nb("notifications/progress"),params:P}),j=h.extend({level:s,logger:iO().optional(),data:nr()}),T=f.extend({method:nb("notifications/message"),params:j}),O=ns({uri:iO(),mimeType:nk(iO()),_meta:ny(iO(),nr()).optional()}),C=O.extend({text:iO()}),N=O.extend({blob:l}),I=ns({audience:nn(o).optional(),priority:i9().min(0).max(1).optional(),lastModified:r1(iN,{offset:!0}).optional()}),q=ns({...v.shape,...g.shape,uri:iO(),description:nk(iO()),mimeType:nk(iO()),size:nk(i9()),annotations:I.optional(),_meta:nk(nl({}))}),A=ns({...v.shape,...g.shape,uriTemplate:iO(),description:nk(iO()),mimeType:nk(iO()),annotations:I.optional(),_meta:nk(nl({}))}),z=f.extend({method:nb("notifications/resources/list_changed"),params:h.optional()}),M=h.extend({uri:iO()}),L=f.extend({method:nb("notifications/resources/updated"),params:M}),D=ns({name:iO(),description:nk(iO()),required:nk(i3())}),Z=ns({...v.shape,...g.shape,description:nk(iO()),arguments:nk(nn(D)),_meta:nk(nl({}))}),V=f.extend({method:nb("notifications/prompts/list_changed"),params:h.optional()}),F=ns({type:nb("text"),text:iO(),annotations:I.optional(),_meta:ny(iO(),nr()).optional()}),U=ns({type:nb("image"),data:l,mimeType:iO(),annotations:I.optional(),_meta:ny(iO(),nr()).optional()}),H=ns({type:nb("audio"),data:l,mimeType:iO(),annotations:I.optional(),_meta:ny(iO(),nr()).optional()}),J=ns({type:nb("tool_use"),name:iO(),id:iO(),input:ny(iO(),nr()),_meta:ny(iO(),nr()).optional()}),K=ns({type:nb("resource"),resource:nu([C,N]),annotations:I.optional(),_meta:ny(iO(),nr()).optional()}),B=q.extend({type:nb("resource_link")}),G=nu([F,U,H,B,K]),W=ns({role:o,content:G}),Y=ns({title:iO().optional(),readOnlyHint:i3().optional(),destructiveHint:i3().optional(),idempotentHint:i3().optional(),openWorldHint:i3().optional()}),X=f.extend({method:nb("notifications/tools/list_changed"),params:h.optional()}),Q=ns({name:iO().optional()}),ee=ns({hints:nn(Q).optional(),costPriority:i9().min(0).max(1).optional(),speedPriority:i9().min(0).max(1).optional(),intelligencePriority:i9().min(0).max(1).optional()}),et=ns({mode:nv(["auto","required","none"]).optional()}),er=ns({type:nb("boolean"),title:iO().optional(),description:iO().optional(),default:i3().optional()}),ea=ns({type:nb("string"),title:iO().optional(),description:iO().optional(),minLength:i9().optional(),maxLength:i9().optional(),format:nv(["email","uri","date","date-time"]).optional(),default:iO().optional()}),ei=ns({type:nv(["number","integer"]),title:iO().optional(),description:iO().optional(),minimum:i9().optional(),maximum:i9().optional(),default:i9().optional()}),en=ns({type:nb("string"),title:iO().optional(),description:iO().optional(),enum:nn(iO()),default:iO().optional()}),eo=ns({type:nb("string"),title:iO().optional(),description:iO().optional(),oneOf:nn(ns({const:iO(),title:iO()})),default:iO().optional()}),es=ns({type:nb("string"),title:iO().optional(),description:iO().optional(),enum:nn(iO()),enumNames:nn(iO()).optional(),default:iO().optional()}),el=nu([en,eo]),ec=ns({type:nb("array"),title:iO().optional(),description:iO().optional(),minItems:i9().optional(),maxItems:i9().optional(),items:ns({type:nb("string"),enum:nn(iO())}),default:nn(iO()).optional()}),eu=ns({type:nb("array"),title:iO().optional(),description:iO().optional(),minItems:i9().optional(),maxItems:i9().optional(),items:ns({anyOf:nn(ns({const:iO(),title:iO()}))}),default:nn(iO()).optional()}),ed=nu([ec,eu]),ep=nu([es,el,ed]),em=nu([ep,er,ea,ei]),eh=m.extend({mode:nb("form").optional(),message:iO(),requestedSchema:ns({type:nb("object"),properties:ny(iO(),em),required:nn(iO()).optional()}).catchall(nr())}),ef=ns({type:nb("ref/resource"),uri:iO()}),ey=ns({type:nb("ref/prompt"),name:iO()}),eg=ns({uri:iO().startsWith("file://"),name:iO().optional(),_meta:ny(iO(),nr()).optional()}),ev=k.shape,e_=ns({experimental:ev.experimental,sampling:ev.sampling,elicitation:ev.elicitation,roots:ev.roots,extensions:ev.extensions}),eb=x.shape,eS=ns({experimental:eb.experimental,logging:eb.logging,completions:eb.completions,prompts:eb.prompts,resources:eb.resources,tools:eb.tools,extensions:eb.extensions}),e$=nl({progressToken:a.optional(),[nV]:iO(),[nF]:_.optional(),[nH]:e_,[nK]:s.optional()}),ew=ns({...v.shape,...g.shape,description:iO().optional(),inputSchema:nl({$schema:iO().optional(),type:nb("object")}),outputSchema:nl({$schema:iO().optional()}).optional(),annotations:Y.optional(),_meta:ny(iO(),nr()).optional()}),ek=ns({type:nb("tool_result"),toolUseId:iO(),content:nn(G),structuredContent:nr().optional(),isError:i3().optional(),_meta:ny(iO(),nr()).optional()}),ex=nu([F,U,H,J,ek]),eR=ns({role:o,content:nu([ex,nn(ex)]),_meta:ny(iO(),nr()).optional()}),eP=iO(),eE=nl({[nU]:_.optional().catch(void 0)}),ej=eE.optional();function eT(t){return nl({_meta:ej,resultType:eP.default("complete"),...t})}let eO=eT({}),eC=eT({nextCursor:i.optional()}),eN=eT({content:nn(G),structuredContent:nr().optional(),isError:i3().optional()}),eI=eT({ttlMs:i9().int().min(0),cacheScope:nv(["public","private"]),tools:nn(ew),nextCursor:i.optional()}),eq=eT({ttlMs:i9().int().min(0),cacheScope:nv(["public","private"]),prompts:nn(Z),nextCursor:i.optional()}),eA=eT({description:iO().optional(),messages:nn(W)}),ez=eT({ttlMs:i9().int().min(0),cacheScope:nv(["public","private"]),resources:nn(q),nextCursor:i.optional()}),eM=eT({ttlMs:i9().int().min(0),cacheScope:nv(["public","private"]),resourceTemplates:nn(A),nextCursor:i.optional()}),eL=eT({ttlMs:i9().int().min(0),cacheScope:nv(["public","private"]),contents:nn(nu([C,N]))}),eD=eT({completion:ns({values:nn(iO()).max(100),total:i9().int().optional(),hasMore:i3().optional()}).loose()}),eZ=eT({ttlMs:i9().int().min(0),cacheScope:nv(["public","private"])}),eV=eT({ttlMs:i9().int().min(0).catch(0),cacheScope:nv(["public","private"]).catch("private"),supportedVersions:nn(iO()),capabilities:eS,instructions:iO().optional()}),eF=ns({messages:nn(eR),modelPreferences:ee.optional(),systemPrompt:iO().optional(),includeContext:nv(["none","thisServer","allServers"]).optional(),temperature:i9().optional(),maxTokens:i9().int(),stopSequences:nn(iO()).optional(),metadata:r.optional(),tools:nn(ew).optional(),toolChoice:et.optional()}),eU=ns({method:nb("sampling/createMessage"),params:eF}),eH=ns({method:nb("roots/list"),params:ns({_meta:ny(iO(),nr()).optional()}).optional()}),eJ=ns({...eR.shape,model:iO(),stopReason:iO().optional()}),eK=ns({roots:nn(eg)}),eB=ns({action:nv(["accept","decline","cancel"]),content:ny(iO(),nu([iO(),i9(),i3(),nn(iO())])).optional()}),eG=ns({mode:nb("url"),message:iO(),url:iO().url()}),eW=nu([eh,eG]),eY=ns({method:nb("elicitation/create"),params:eW}),eX=nu([eU,eH,eY]),eQ=nu([eJ,eK,eB]),e0=ny(iO(),eX),e1=ny(iO(),eQ),e2=eT({inputRequests:e0.optional(),requestState:iO().optional()}),e9={inputResponses:e1.optional(),requestState:iO().optional()},e4=ns({_meta:e$,...e9}),e6=nl({progressToken:a.optional()});function e5(t,r){return ns({method:nb(t),params:ns({_meta:e$,...r})})}function e3(t,r){return ns({method:nb(t),params:ns({_meta:e6.optional(),...r}).optional()})}let e8={name:iO(),arguments:ny(iO(),nr()).optional(),...e9},e7={cursor:i.optional()},te=e5("tools/call",e8),tt=e5("tools/list",e7),tr=e5("prompts/list",e7),ta=e5("prompts/get",{name:iO(),arguments:ny(iO(),iO()).optional(),...e9}),ti=e5("resources/list",e7),tn=e5("resources/templates/list",e7),to=e5("resources/read",{uri:iO(),...e9}),ts={ref:nu([ey,ef]),argument:ns({name:iO(),value:iO()}),context:ns({arguments:ny(iO(),iO()).optional()}).optional()},tl=e5("completion/complete",ts),tc=e5("server/discover",{}),tu=ns({toolsListChanged:i3().optional(),promptsListChanged:i3().optional(),resourcesListChanged:i3().optional(),resourceSubscriptions:nn(iO()).optional()}),td={notifications:tu},tp=e5("subscriptions/listen",td),tm=eE.extend({"io.modelcontextprotocol/subscriptionId":n}),th=nl({_meta:tm,resultType:eP.default("complete")}),tf={"tools/call":e3("tools/call",e8),"tools/list":e3("tools/list",e7),"prompts/get":e3("prompts/get",{name:iO(),arguments:ny(iO(),iO()).optional()}),"prompts/list":e3("prompts/list",e7),"resources/list":e3("resources/list",e7),"resources/templates/list":e3("resources/templates/list",e7),"resources/read":e3("resources/read",{uri:iO()}),"completion/complete":e3("completion/complete",ts),"server/discover":e3("server/discover",{}),"subscriptions/listen":e3("subscriptions/listen",td)};function ty(t){return nl({_meta:ej,...t})}let tg={"tools/call":ty({content:nn(G),structuredContent:nr().optional(),isError:i3().optional()}),"tools/list":ty({ttlMs:i9().int().min(0),cacheScope:nv(["public","private"]),tools:nn(ew),nextCursor:i.optional()}),"prompts/get":ty({description:iO().optional(),messages:nn(W)}),"prompts/list":ty({ttlMs:i9().int().min(0),cacheScope:nv(["public","private"]),prompts:nn(Z),nextCursor:i.optional()}),"resources/list":ty({ttlMs:i9().int().min(0),cacheScope:nv(["public","private"]),resources:nn(q),nextCursor:i.optional()}),"resources/templates/list":ty({ttlMs:i9().int().min(0),cacheScope:nv(["public","private"]),resourceTemplates:nn(A),nextCursor:i.optional()}),"resources/read":ty({ttlMs:i9().int().min(0),cacheScope:nv(["public","private"]),contents:nn(nu([C,N]))}),"completion/complete":ty({completion:ns({values:nn(iO()).max(100),total:i9().int().optional(),hasMore:i3().optional()}).loose()}),"server/discover":ty({ttlMs:i9().int().min(0).catch(0),cacheScope:nv(["public","private"]).catch("private"),supportedVersions:nn(iO()),capabilities:eS,instructions:iO().optional()}),"subscriptions/listen":ty({})},tv=nl({"io.modelcontextprotocol/subscriptionId":n.optional()}),t_=ns({method:nb("notifications/subscriptions/acknowledged"),params:ns({_meta:tv.optional(),notifications:tu})}),tb=ns({_meta:tv.optional(),requestId:n,reason:iO().optional()}),tS=ns({method:nb("notifications/cancelled"),params:tb}),t$=t=>ns({jsonrpc:nb("2.0"),id:nu([iO(),i9().int()]),result:t}).strict();return{JSONValueSchema:t,JSONObjectSchema:r,ProgressTokenSchema:a,CursorSchema:i,RequestIdSchema:n,RoleSchema:o,LoggingLevelSchema:s,TaskMetadataSchema:c,RelatedTaskMetadataSchema:u,RequestMetaSchema:d,BaseRequestParamsSchema:p,TaskAugmentedRequestParamsSchema:m,NotificationsParamsSchema:h,NotificationSchema:f,IconSchema:y,IconsSchema:g,BaseMetadataSchema:v,ImplementationSchema:_,ClientTasksCapabilitySchema:$,ServerTasksCapabilitySchema:w,ClientCapabilitiesSchema:k,ServerCapabilitiesSchema:x,ProgressSchema:R,ProgressNotificationParamsSchema:P,ProgressNotificationSchema:E,LoggingMessageNotificationParamsSchema:j,LoggingMessageNotificationSchema:T,ResourceContentsSchema:O,TextResourceContentsSchema:C,BlobResourceContentsSchema:N,AnnotationsSchema:I,ResourceSchema:q,ResourceTemplateSchema:A,ResourceListChangedNotificationSchema:z,ResourceUpdatedNotificationParamsSchema:M,ResourceUpdatedNotificationSchema:L,PromptArgumentSchema:D,PromptSchema:Z,PromptListChangedNotificationSchema:V,TextContentSchema:F,ImageContentSchema:U,AudioContentSchema:H,ToolUseContentSchema:J,EmbeddedResourceSchema:K,ResourceLinkSchema:B,ContentBlockSchema:G,PromptMessageSchema:W,ToolAnnotationsSchema:Y,ToolListChangedNotificationSchema:X,ModelHintSchema:Q,ModelPreferencesSchema:ee,ToolChoiceSchema:et,BooleanSchemaSchema:er,StringSchemaSchema:ea,NumberSchemaSchema:ei,UntitledSingleSelectEnumSchemaSchema:en,TitledSingleSelectEnumSchemaSchema:eo,LegacyTitledEnumSchemaSchema:es,SingleSelectEnumSchemaSchema:el,UntitledMultiSelectEnumSchemaSchema:ec,TitledMultiSelectEnumSchemaSchema:eu,MultiSelectEnumSchemaSchema:ed,EnumSchemaSchema:ep,PrimitiveSchemaDefinitionSchema:em,ElicitRequestFormParamsSchema:eh,ResourceTemplateReferenceSchema:ef,PromptReferenceSchema:ey,RootSchema:eg,ClientCapabilities2026Schema:e_,ServerCapabilities2026Schema:eS,RequestMetaEnvelopeSchema:e$,ToolSchema:ew,ToolResultContentSchema:ek,SamplingMessageContentBlockSchema:ex,SamplingMessageSchema:eR,ResultTypeSchema:eP,ResultMetaSchema:eE,ResultSchema:eO,PaginatedResultSchema:eC,CallToolResultSchema:eN,ListToolsResultSchema:eI,ListPromptsResultSchema:eq,GetPromptResultSchema:eA,ListResourcesResultSchema:ez,ListResourceTemplatesResultSchema:eM,ReadResourceResultSchema:eL,CompleteResultSchema:eD,CacheableResultSchema:eZ,DiscoverResultSchema:eV,CreateMessageRequestParamsSchema:eF,CreateMessageRequestSchema:eU,ListRootsRequestSchema:eH,CreateMessageResultSchema:eJ,ListRootsResultSchema:eK,ElicitResultSchema:eB,ElicitRequestURLParamsSchema:eG,ElicitRequestParamsSchema:eW,ElicitRequestSchema:eY,InputRequestSchema:eX,InputResponseSchema:eQ,InputRequestsSchema:e0,InputResponsesSchema:e1,InputRequiredResultSchema:e2,InputResponseRequestParamsSchema:e4,CallToolRequestSchema:te,ListToolsRequestSchema:tt,ListPromptsRequestSchema:tr,GetPromptRequestSchema:ta,ListResourcesRequestSchema:ti,ListResourceTemplatesRequestSchema:tn,ReadResourceRequestSchema:to,CompleteRequestSchema:tl,DiscoverRequestSchema:tc,SubscriptionFilterSchema:tu,SubscriptionsListenRequestSchema:tp,SubscriptionsListenResultMetaSchema:tm,SubscriptionsListenResultSchema:th,dispatchRequestSchemas:tf,dispatchResultSchemas:tg,NotificationMetaSchema:tv,SubscriptionsAcknowledgedNotificationSchema:t_,CancelledNotificationParamsSchema:tb,CancelledNotificationSchema:tS,notificationSchemas2026:{"notifications/cancelled":tS,"notifications/progress":E,"notifications/message":T,"notifications/resources/updated":L,"notifications/resources/list_changed":z,"notifications/tools/list_changed":X,"notifications/prompts/list_changed":V,"notifications/subscriptions/acknowledged":t_},JSONRPCResultResponseSchema:t$(eO),CallToolResultResponseSchema:t$(nu([eN,e2])),ListToolsResultResponseSchema:t$(eI),ListPromptsResultResponseSchema:t$(eq),GetPromptResultResponseSchema:t$(nu([eA,e2])),ListResourcesResultResponseSchema:t$(ez),ListResourceTemplatesResultResponseSchema:t$(eM),ReadResourceResultResponseSchema:t$(nu([eL,e2])),CompleteResultResponseSchema:t$(eD),DiscoverResultResponseSchema:t$(eV)}}()}let cr=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"],ca=Symbol("modelcontextprotocol.resultCacheHintFallback");function ci(t,r){if(void 0===r)return t;let a=t[ca];if(void 0===a)return{...t,[ca]:r};let i={},n=a.ttlMs??r.ttlMs;void 0!==n&&(i.ttlMs=n);let o=a.cacheScope??r.cacheScope;return void 0!==o&&(i.cacheScope=o),{...t,[ca]:i}}function cn(t){return"number"==typeof t&&Number.isSafeInteger(t)&&t>=0}function co(t){return"public"===t||"private"===t}function cs(t,r){if(void 0!==t.ttlMs&&!cn(t.ttlMs))throw RangeError(`Invalid cache hint for ${r}: ttlMs must be a non-negative safe integer (got ${String(t.ttlMs)})`);if(void 0!==t.cacheScope&&!co(t.cacheScope))throw RangeError(`Invalid cache hint for ${r}: cacheScope must be 'public' or 'private' (got ${String(t.cacheScope)})`)}let cl=((k={})[k.ParseError=-32700]="ParseError",k[k.InvalidRequest=-32600]="InvalidRequest",k[k.MethodNotFound=-32601]="MethodNotFound",k[k.InvalidParams=-32602]="InvalidParams",k[k.InternalError=-32603]="InternalError",k[k.ResourceNotFound=-32002]="ResourceNotFound",k[k.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",k[k.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",k[k.UrlElicitationRequired=-32042]="UrlElicitationRequired",k);var cc=class t extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return lM(this,t)}static isInstance(t){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return lM(this,t)}constructor(t,r,a){super(r),this.code=t,this.data=a,this.name="ProtocolError",lz(this,new.target)}static fromError(r,a,i){return r===cl.UrlElicitationRequired&&i&&i.elicitations?new cd(i.elicitations,a):r===cl.UnsupportedProtocolVersion&&i&&Array.isArray(i.supported)&&"string"==typeof i.requested?new cp({supported:i.supported,requested:i.requested},a):(r===cl.InvalidParams||r===cl.ResourceNotFound)&&"string"==typeof i?.uri&&(r===cl.ResourceNotFound||1===Object.keys(i).length)?new cu(i.uri,a):r===cl.MissingRequiredClientCapability&&i&&null!==i.requiredCapabilities&&"object"==typeof i.requiredCapabilities&&!Array.isArray(i.requiredCapabilities)?new cm({requiredCapabilities:i.requiredCapabilities},a):new t(r,a,i)}},cu=class extends cc{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(t,r=`Resource not found: ${t}`){super(cl.InvalidParams,r,{uri:t})}get uri(){return this.data.uri}},cd=class extends cc{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(cl.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}},cp=class extends cc{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(t,r=`Unsupported protocol version: ${t.requested}`){super(cl.UnsupportedProtocolVersion,r,t)}get supported(){return this.data.supported}get requested(){return this.data.requested}},cm=class extends cc{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(t,r=`Missing required client capabilities: ${Object.keys(t.requiredCapabilities).join(", ")}`){super(cl.MissingRequiredClientCapability,r,t)}get requiredCapabilities(){return this.data.requiredCapabilities}};let ch=["tools/call","prompts/get","resources/read"],cf=["elicitation/create","sampling/createMessage","roots/list"];function cy(){if(s)return s;let t=ct();return s={request:{"elicitation/create":ns({method:nb("elicitation/create"),params:t.ElicitRequestParamsSchema}),"sampling/createMessage":ns({method:nb("sampling/createMessage"),params:t.CreateMessageRequestParamsSchema}),"roots/list":ns({method:nb("roots/list"),params:nl({}).optional()})},response:{"elicitation/create":t.ElicitResultSchema,"sampling/createMessage":t.CreateMessageResultSchema,"roots/list":t.ListRootsResultSchema}}}function cg(t){return cf.includes(t)}function cv(t){return cg(t)?cy().request[t]:void 0}let c_={"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},cb={"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 cS(t){return Object.prototype.hasOwnProperty.call(c_,t)}function c$(t){return Object.prototype.hasOwnProperty.call(cb,t)}function cw(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function ck(t,r){if(void 0===t)return{ok:!1,reason:"not-in-era"};let a=t.safeParse(r);return a.success?{ok:!0,value:a.data}:{ok:!1,reason:"invalid",message:String(a.error)}}Object.keys(c_),Object.keys(cb);let cx={ok:!1,reason:"not-in-era"},cR=[nV,nH],cP={era:"2026-07-28",hasRequestMethod:cS,hasNotificationMethod:c$,hasInputRequestMethod:t=>void 0!==cv(t),validateRequest:(t,r)=>ck(cS(t)?ct().dispatchRequestSchemas[t]:void 0,r),validateResult:(t,r)=>ck(Object.prototype.hasOwnProperty.call(c_,t)?ct().dispatchResultSchemas[t]:void 0,r),validateNotification:(t,r)=>ck(c$(t)?ct().notificationSchemas2026[t]:void 0,r),validateInputRequest:(t,r)=>ck(cv(t),r),validateInputResponse:(t,r)=>ck(cg(t)?cy().response[t]:void 0,r),samplingResultVariant:()=>cx,outboundEnvelope:t=>({[nV]:t.protocolVersion,[nF]:t.clientInfo,[nH]:t.clientCapabilities,...void 0!==t.logLevel&&{[nK]:t.logLevel}}),validateEnvelopeMeta(t){let r=[];for(let a of cR)a in t||r.push({key:a,problem:"missing"});let a=ct().RequestMetaEnvelopeSchema.safeParse(t);if(!a.success)for(let t of a.error.issues){let a=t.path.map(String),i=a.length>0?a.join("."):"_meta";1===a.length&&r.some(t=>t.key===i&&"missing"===t.problem)||r.push({key:i,problem:t.message})}return r},projectCallToolResult:t=>lJ(t),inputRequestSchema:cv,decodeResult(t,r){if(!cw(r))return{kind:"invalid",error:new lD(lL.InvalidResult,`Invalid result for ${t}: not an object`,{method:t})};let a=r.resultType;if(void 0===a)return{kind:"invalid",error:new lD(lL.InvalidResult,`Invalid result for ${t}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:t,violation:"missing-resultType"})};if("string"!=typeof a)return{kind:"invalid",error:new lD(lL.InvalidResult,`Invalid result for ${t}: non-string resultType`,{method:t,resultType:a})};if("input_required"===a){let a=r.inputRequests,i=cw(a)?a:{},n=r.requestState;return 0===Object.keys(i).length&&"string"!=typeof n?{kind:"invalid",error:new lD(lL.InvalidResult,`Invalid result for ${t}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:t,violation:"input-required-missing-both"})}:{kind:"input_required",inputRequests:i,..."string"==typeof n&&{requestState:n}}}if("complete"!==a)return{kind:"invalid",error:new lD(lL.UnsupportedResultType,`Unsupported result type '${a}' for ${t}`,{resultType:a,method:t})};let i=function(){if(l)return l;let t=ct();return l={"tools/call":t.CallToolResultSchema,"tools/list":t.ListToolsResultSchema,"prompts/get":t.GetPromptResultSchema,"prompts/list":t.ListPromptsResultSchema,"resources/list":t.ListResourcesResultSchema,"resources/templates/list":t.ListResourceTemplatesResultSchema,"resources/read":t.ReadResourceResultSchema,"completion/complete":t.CompleteResultSchema,"server/discover":t.DiscoverResultSchema}}(),n=Object.hasOwn(i,t)?i[t]:void 0;if(void 0!==n){let a=n.safeParse(r);if(!a.success)return{kind:"invalid",error:new lD(lL.InvalidResult,`Invalid result for ${t}: ${a.error}`,{method:t})}}let o={...r};return delete o.resultType,{kind:"complete",result:o}},encodeResult:(t,r,a)=>(function(t,r){if(void 0===r)return t;let a=t._meta;return void 0===a?{...t,_meta:{[nU]:r}}:null===a||"object"!=typeof a||Array.isArray(a)||void 0!==a[nU]?t:{...t,_meta:{...a,[nU]:r}}})(function(t,r){var a,i;let n=r[ca];if("complete"!==r.resultType||!cr.includes(t)){let t;return void 0===n?r:(t={...r},delete t[ca],t)}let o=cn(r.ttlMs)?r.ttlMs:void 0!==(a=n)&&cn(a.ttlMs)?a.ttlMs:0,s=co(r.cacheScope)?r.cacheScope:void 0!==(i=n)&&co(i.cacheScope)?i.cacheScope:"private",l={...r,ttlMs:o,cacheScope:s};return delete l[ca],l}(t,function(t,r){let a=r.resultType;if(void 0===a)return{...r,resultType:"complete"};if("complete"===a||ch.includes(t))return r;throw new cc(cl.InternalError,`Handler for ${t} returned resultType '${String(a)}', but results of ${t} only support 'complete' on protocol revision 2026-07-28`)}(t,function(t,r){let a=r,i=!1,n=()=>(i||(a={...a},i=!0),a),o=r.tools;"tools/list"===t&&Array.isArray(o)&&o.some(t=>cw(t)&&"execution"in t)&&(n().tools=o.map(t=>{if(!cw(t)||!("execution"in t))return t;let r={...t};return delete r.execution,r}));let s=r.capabilities;if(cw(s)&&"tasks"in s){let t={...s};delete t.tasks,n().capabilities=t}return a}(t,r))),a),encodeErrorCode:t=>-32002===t?-32602:t,checkInboundEnvelope(t){if(void 0===t.envelope)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let r=ct().RequestMetaEnvelopeSchema.safeParse(t.envelope);if(!r.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${r.error.issues.map(t=>t.message).join("; ")}`}},cE="2026-07-28";function cj(t){return void 0!==t&&t>=lF?cP:ce}function cT(t){return void 0!==t.revision?cj(t.revision).era:"modern"===t.era?cP.era:ce.era}function cO(t){return cN.some(r=>r.hasRequestMethod(t))}function cC(t){return cN.some(r=>r.hasNotificationMethod(t))}let cN=[ce,cP];function cI(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function cq(t){if(!cI(t))return;let r=t._meta;return cI(r)?r:void 0}function cA(t){let r=cq(t);return void 0!==r&&nV in r}function cz(t){let r=cq(t)?.[nV];return"string"==typeof r?r:void 0}function cM(t){return cj(cE).validateEnvelopeMeta(t)}var cL=((t,r)=>{let a={};for(var i in t)z(a,i,{get:t[i],enumerable:!0});return r&&z(a,Symbol.toStringTag,{value:"Module"}),a})({AnnotationsSchema:()=>oz,AudioContentSchema:()=>sa,BaseMetadataSchema:()=>od,BaseRequestParamsSchema:()=>n2,BlobResourceContentsSchema:()=>oq,BooleanSchemaSchema:()=>sM,CallToolRequestParamsSchema:()=>sv,CallToolRequestSchema:()=>s_,CallToolResultSchema:()=>sy,CancelTaskRequestSchema:()=>lh,CancelTaskResultSchema:()=>lf,CancelledNotificationParamsSchema:()=>os,CancelledNotificationSchema:()=>ol,ClientCapabilitiesSchema:()=>og,ClientNotificationSchema:()=>lg,ClientRequestSchema:()=>ly,ClientResultSchema:()=>lv,ClientTasksCapabilitySchema:()=>of,CompatibilityCallToolResultSchema:()=>sg,CompleteRequestParamsSchema:()=>s6,CompleteRequestSchema:()=>s5,CompleteResultSchema:()=>s3,ContentBlockSchema:()=>ss,CreateMessageRequestParamsSchema:()=>sI,CreateMessageRequestSchema:()=>sq,CreateMessageResultSchema:()=>sA,CreateMessageResultWithToolsSchema:()=>sz,CreateTaskResultSchema:()=>ln,CursorSchema:()=>nX,DiscoverRequestSchema:()=>ow,DiscoverResultSchema:()=>ok,ElicitRequestFormParamsSchema:()=>sW,ElicitRequestParamsSchema:()=>sX,ElicitRequestSchema:()=>sQ,ElicitRequestURLParamsSchema:()=>sY,ElicitResultSchema:()=>s2,ElicitationCompleteNotificationParamsSchema:()=>s0,ElicitationCompleteNotificationSchema:()=>s1,EmbeddedResourceSchema:()=>sn,EmptyResultSchema:()=>oo,EnumSchemaSchema:()=>sB,GetPromptRequestParamsSchema:()=>o7,GetPromptRequestSchema:()=>se,GetPromptResultSchema:()=>sc,GetTaskPayloadRequestSchema:()=>lu,GetTaskPayloadResultSchema:()=>ld,GetTaskRequestSchema:()=>ll,GetTaskResultSchema:()=>lc,IconSchema:()=>oc,IconsSchema:()=>ou,ImageContentSchema:()=>sr,ImplementationSchema:()=>op,InitializeRequestParamsSchema:()=>ov,InitializeRequestSchema:()=>o_,InitializeResultSchema:()=>oS,InitializedNotificationSchema:()=>o$,JSONArraySchema:()=>nW,JSONObjectSchema:()=>nG,JSONRPCErrorResponseSchema:()=>oa,JSONRPCMessageSchema:()=>oi,JSONRPCNotificationSchema:()=>ot,JSONRPCRequestSchema:()=>oe,JSONRPCResponseSchema:()=>on,JSONRPCResultResponseSchema:()=>or,JSONValueSchema:()=>nB,LegacyTitledEnumSchemaSchema:()=>sF,ListChangedOptionsBaseSchema:()=>sS,ListPromptsRequestSchema:()=>o3,ListPromptsResultSchema:()=>o8,ListResourceTemplatesRequestSchema:()=>oV,ListResourceTemplatesResultSchema:()=>oF,ListResourcesRequestSchema:()=>oD,ListResourcesResultSchema:()=>oZ,ListRootsRequestSchema:()=>s7,ListRootsResultSchema:()=>le,ListTasksRequestSchema:()=>lp,ListTasksResultSchema:()=>lm,ListToolsRequestSchema:()=>sh,ListToolsResultSchema:()=>sf,LoggingLevelSchema:()=>s$,LoggingMessageNotificationParamsSchema:()=>sx,LoggingMessageNotificationSchema:()=>sR,ModelHintSchema:()=>sP,ModelPreferencesSchema:()=>sE,MultiSelectEnumSchemaSchema:()=>sK,NotificationSchema:()=>n5,NotificationsParamsSchema:()=>n6,NumberSchemaSchema:()=>sD,PaginatedRequestParamsSchema:()=>oj,PaginatedRequestSchema:()=>oT,PaginatedResultSchema:()=>oO,PingRequestSchema:()=>ox,PrimitiveSchemaDefinitionSchema:()=>sG,ProgressNotificationParamsSchema:()=>oP,ProgressNotificationSchema:()=>oE,ProgressSchema:()=>oR,ProgressTokenSchema:()=>nY,PromptArgumentSchema:()=>o6,PromptListChangedNotificationSchema:()=>su,PromptMessageSchema:()=>sl,PromptReferenceSchema:()=>s4,PromptSchema:()=>o5,ReadResourceRequestParamsSchema:()=>oU,ReadResourceRequestSchema:()=>oH,ReadResourceResultSchema:()=>oJ,RelatedTaskMetadataSchema:()=>n0,RequestIdSchema:()=>n7,RequestMetaSchema:()=>n1,RequestSchema:()=>n4,ResourceContentsSchema:()=>oC,ResourceLinkSchema:()=>so,ResourceListChangedNotificationSchema:()=>oK,ResourceRequestParamsSchema:()=>oU,ResourceSchema:()=>oM,ResourceTemplateReferenceSchema:()=>s9,ResourceTemplateSchema:()=>oL,ResourceUpdatedNotificationParamsSchema:()=>o9,ResourceUpdatedNotificationSchema:()=>o4,ResultMetaObjectSchema:()=>n3,ResultSchema:()=>n8,RoleSchema:()=>oA,RootSchema:()=>s8,RootsListChangedNotificationSchema:()=>lt,SamplingContentSchema:()=>sO,SamplingMessageContentBlockSchema:()=>sC,SamplingMessageSchema:()=>sN,ServerCapabilitiesSchema:()=>ob,ServerNotificationSchema:()=>lb,ServerRequestSchema:()=>l_,ServerResultSchema:()=>lS,ServerTasksCapabilitySchema:()=>oy,SetLevelRequestParamsSchema:()=>sw,SetLevelRequestSchema:()=>sk,SingleSelectEnumSchemaSchema:()=>sU,StringSchemaSchema:()=>sL,SubscribeRequestParamsSchema:()=>oU,SubscribeRequestSchema:()=>oB,SubscriptionFilterSchema:()=>oW,SubscriptionsAcknowledgedNotificationParamsSchema:()=>oQ,SubscriptionsAcknowledgedNotificationSchema:()=>o0,SubscriptionsListenRequestParamsSchema:()=>oY,SubscriptionsListenRequestSchema:()=>oX,SubscriptionsListenResultMetaSchema:()=>o1,SubscriptionsListenResultSchema:()=>o2,TaskAugmentedRequestParamsSchema:()=>n9,TaskCreationParamsSchema:()=>lr,TaskMetadataSchema:()=>nQ,TaskSchema:()=>li,TaskStatusNotificationParamsSchema:()=>lo,TaskStatusNotificationSchema:()=>ls,TaskStatusSchema:()=>la,TextContentSchema:()=>st,TextResourceContentsSchema:()=>oN,TitledMultiSelectEnumSchemaSchema:()=>sJ,TitledSingleSelectEnumSchemaSchema:()=>sV,ToolAnnotationsSchema:()=>sd,ToolChoiceSchema:()=>sj,ToolExecutionSchema:()=>sp,ToolListChangedNotificationSchema:()=>sb,ToolResultContentSchema:()=>sT,ToolSchema:()=>sm,ToolUseContentSchema:()=>si,UnsubscribeRequestParamsSchema:()=>oU,UnsubscribeRequestSchema:()=>oG,UntitledMultiSelectEnumSchemaSchema:()=>sH,UntitledSingleSelectEnumSchemaSchema:()=>sZ});let cD=t=>oe.safeParse(t).success,cZ=t=>"object"==typeof t&&null!==t&&!Array.isArray(t)&&"input_required"===t.resultType,cV="x-mcp-header",cF=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,cU=new Set(["string","integer","boolean","number"]),cH=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],cJ=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function cK(t){return 0===t.length?"<root>":t.join(".")}function cB(t,r,a,i,n){return{kind:"reject",rung:t,cell:r,httpStatus:a,code:i.code,message:i.message,...void 0!==i.data&&{data:i.data},settled:n}}function cG(t){if(!cA(t))return!1;let r=cz(t);if(void 0===r||!(r>=lF))return!1;let a=cq(t);return void 0!==a&&0===cM(a).length}cl.InvalidRequest,cl.UnsupportedProtocolVersion,cl.InvalidParams,cl.MethodNotFound,cl.InvalidParams,cl.MissingRequiredClientCapability,cl.ParseError,cl.InvalidRequest,cl.MethodNotFound,cl.UnsupportedProtocolVersion,cl.MissingRequiredClientCapability;function cW(t){return new Set(t.flatMap(t=>Object.keys(t.shape)))}function cY(t){if(null==t)return!1;let r=typeof t;return("object"===r||"function"===r)&&"~standard"in t&&"function"==typeof t["~standard"]?.validate}let cX=!1,cQ="draft-2020-12";function c0(t,r="input"){let a,i=t["~standard"];if(i.jsonSchema)a=i.jsonSchema[r]({target:cQ});else if("zod"===i.vendor){if(!("_zod"in t))throw Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");cX||(cX=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),a=a6(t,{target:cQ,io:r})}else throw Error(`Schema library "${i.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if("output"===r)return void 0!==a.type||!function t(r){if("properties"in r||"patternProperties"in r||"additionalProperties"in r||"required"in r)return!0;for(let a of["oneOf","anyOf","allOf"]){let i=r[a];if(Array.isArray(i)&&i.length>0)return i.every(r=>null!==r&&"object"==typeof r&&("object"===r.type||t(r)))}return!1}(a)?a:{type:"object",...a};if(void 0!==a.type&&"object"!==a.type)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(a.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...a}}async function c1(t,r){let a=await t["~standard"].validate(r);return a.issues&&a.issues.length>0?{success:!1,error:a.issues.map(t=>t.path?.length?`${t.path.map(t=>String("object"==typeof t?t.key:t)).join(".")}: ${t.message}`:t.message).join(", ")}:{success:!0,data:a.value}}let c2=/\\\.\\d\{(\d+)\}/;function c9(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}let c4=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function c6(t){return c4.has(t)||t.startsWith("x-")}let c5=new Set(["$schema",...Object.keys(sW.shape.requestedSchema.shape)]),c3={string:cW([sL,sZ,sV,sF]),number:cW([sD]),integer:cW([sD]),boolean:cW([sM]),array:cW([sH,sJ])},c8=new Set(sL.shape.format.unwrap().options);Object.assign(function(t){let r=void 0!==t.inputRequests&&Object.keys(t.inputRequests).length>0,a="string"==typeof t.requestState;if(!r&&!a)throw TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...void 0!==t.inputRequests&&{inputRequests:t.inputRequests},...void 0!==t.requestState&&{requestState:t.requestState}}},{elicit(t){try{return{method:"elicitation/create",params:function(t){var r;if(!cY(t.requestedSchema))return{...t,mode:"form",requestedSchema:t.requestedSchema};let a=t.requestedSchema["~standard"].vendor,i=function(t,r){let a={},i=[];for(let[n,o]of Object.entries(t))"properties"===n&&c9(o)?a[n]=Object.fromEntries(Object.entries(o).map(([t,a])=>[t,function(t,r,a,i){if(!c9(t))return t;let n="string"==typeof t.type&&Object.hasOwn(c3,t.type)?c3[t.type]:void 0;if(void 0===n)return t;let o={};for(let[l,c]of Object.entries(t))if(n.has(l)||c6(l))o[l]=c;else if("pattern"===l&&"string"===t.type&&"string"==typeof t.format)if(c8.has(t.format)){var s;"string"==typeof c&&(s=t.format,"zod"!==a||(function(t,r){let a;switch(t){case"email":a=[rQ(iz,void 0)];break;case"uri":a=[r0(iD,void 0)];break;case"date":a=[r2(iI,void 0)];break;case"date-time":let i,n;i=c2.exec(r),n=[void 0,-1,0],i&&n.push(Number(i[1])),a=[!1,!0].flatMap(t=>[!1,!0].flatMap(r=>n.map(a=>r1(iN,{local:t,offset:r,precision:a}))))}return new Set(a.map(t=>{let r;return r=a6(t,{target:cQ,io:"input"}),"string"==typeof r.pattern?r.pattern:void 0}).filter(t=>void 0!==t))})(s,c).has(c))||i.push(`${r}.${l}`)}else o[l]=c;else i.push(`${r}.${l}`);return o}(a,`properties.${t}`,r,i)])):c5.has(n)?a[n]=o:c6(n)||i.push(n);if(i.length>0)throw new cc(cl.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${i.join(", ")}`);return a}(function(t){try{return c0(t,"input")}catch(r){let t=r instanceof Error?r.message:String(r);throw new cc(cl.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}(t.requestedSchema),a),n=(r=sW.shape.requestedSchema,ig(r,i));if(!n.success)throw new cc(cl.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${function(t,r){if(!c9(t.properties))return r;let a=Object.entries(t.properties).filter(([,t])=>!ig(sG,t).success).map(([t])=>`properties.${t}`);return a.length>0?a.join(", "):r}(i,n.error.message)}`);let o=function t(r,a,i=""){return Array.isArray(r)&&Array.isArray(a)?r.flatMap((r,n)=>t(r,a[n],`${i}[${n}]`)):c9(r)&&c9(a)?Object.entries(r).flatMap(([r,n])=>{let o=i?`${i}.${r}`:r;return Object.prototype.hasOwnProperty.call(a,r)?t(n,a[r],o):c6(r)?[]:[o]}):[]}(i,n.data);if(o.length>0)throw new cc(cl.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${o.join(", ")}`);let s=(n.data.required??[]).filter(t=>!Object.prototype.hasOwnProperty.call(n.data.properties,t));if(s.length>0)throw new cc(cl.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${s.join(", ")}`);return{...t,mode:"form",requestedSchema:n.data}}(t)}}catch(t){throw t instanceof cc?TypeError(t.message,{cause:t}):t}},elicitUrl:t=>({method:"elicitation/create",params:{...t,mode:"url"}}),createMessage:t=>({method:"sampling/createMessage",params:t}),listRoots:()=>({method:"roots/list"})});let c7={},ue={};function ut(t,r){let a=t.slice(0,-6);c7[a]=r,ue[a]=t=>r.safeParse(t).success}for(let t of["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"])ut(t,cL[t]);for(let[t,r]of Object.entries({IdJagTokenExchangeResponseSchema:lE,OAuthClientInformationFullSchema:lN,OAuthClientInformationSchema:lC,OAuthClientMetadataSchema:lO,OAuthClientRegistrationErrorSchema:lI,OAuthErrorResponseSchema:lj,OAuthMetadataSchema:lk,OAuthProtectedResourceMetadataSchema:lw,OAuthTokenRevocationRequestSchema:lq,OAuthTokensSchema:lP,OpenIdProviderDiscoveryMetadataSchema:lR,OpenIdProviderMetadataSchema:lx}))ut(t,r);let ur=Object.freeze(c7);Object.freeze(ue);let ua=[nV,nF,nH,nK],ui=["inputResponses","requestState"];function un(t,r){let a=t.params;if(!uu(a))return{message:t,lifted:{}};let i=a._meta,n=uu(i)?ua.filter(t=>t in i):[],o="request"===r?ui.filter(t=>t in a):[];if(0===n.length&&0===o.length)return{message:t,lifted:{}};let s={},l={...a};if(n.length>0&&uu(i)){let t={},r={...i};for(let a of n)t[a]=i[a],delete r[a];s.envelope=t,Object.keys(r).length>0?l._meta=r:delete l._meta}for(let t of o)"inputResponses"===t&&(s.inputResponses=l[t]),"requestState"===t&&(s.requestState=l[t]),delete l[t];return{message:{...t,params:l},lifted:s}}function uo(t,r){let a=t.validateResult(r,void 0);if(a.ok||"not-in-era"!==a.reason)return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(a){let i=t.validateResult(r,a);return i.ok?{value:i.value}:{issues:[{message:"invalid"===i.reason?i.message:`not-in-era: ${r}`}]}}}}}let us=(x=void 0,()=>x);function ul(t,r){return{...t,mcpReq:{...t.mcpReq,requestState:()=>r}}}var uc=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{c=(t,r)=>{t._negotiatedProtocolVersion=r}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(t){this._options=t,this._supportedProtocolVersions=t?.supportedProtocolVersions??nZ,this.setNotificationHandler("notifications/cancelled",t=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",t=>{this._onprogress(t)}),this.setRequestHandler("ping",t=>({}))}_shouldDropInbound(t){}_outboundMetaEnvelope(){}_envelopeOutbound(t){let r=this._outboundMetaEnvelope();if(void 0===r)return t;let a=t.params??{};return{...t,params:{...a,_meta:{...r,...a._meta}}}}_resolveNonCompleteResult(t,r){return Promise.reject(new lD(lL.UnsupportedResultType,`Unsupported result type '${t.kind}' for ${r.request.method}`,{resultType:t.kind,method:r.request.method}))}_getRequestHandler(t){return this._requestHandlers.get(t)}async _oncancel(t){t.params.requestId&&this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,a,i,n=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:a,resetTimeoutOnProgress:n,onTimeout:i})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let a=Date.now()-r.startTime;if(r.maxTotalTimeout&&a>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),new lD(lL.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:a});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{try{r?.()}finally{this._onclose()}};let a=this.transport?.onerror;this._transport.onerror=t=>{a?.(t),this._onerror(t)};let i=this._transport?.onmessage;this._transport.onmessage=(t,r)=>{if(i?.(t,r),or.safeParse(t).success||oa.safeParse(t).success)this._onresponse(t);else if(cD(t))this._onrequest(t,r);else ot.safeParse(t).success?this._onnotification(t,r):this._onerror(Error(`Unknown message type: ${JSON.stringify(t)}`))},t.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let t=this._responseHandlers;for(let t of(this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._timeoutInfo.values()))clearTimeout(t.timeoutId);this._timeoutInfo.clear();let r=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let a=new lD(lL.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let r of t.values())r(a);for(let t of r.values())t.abort(a)}}_onerror(t){this.onerror?.(t)}_onnotification(t,r){let{message:a}=un(t,"notification"),i=this._negotiatedWireCodec();if(r?.classification===void 0&&"drop"===this._shouldDropInbound(t))return;if(r?.classification!==void 0){let t=cT(r.classification);if(t!==i.era)return void this._onerror(Error(`Era mismatch on inbound notification '${a.method}': classified as ${t} but this instance serves ${i.era}`))}if(cC(a.method)&&!i.hasNotificationMethod(a.method))return;let n=this._notificationHandlers.get(a.method),o=this.fallbackNotificationHandler;(void 0!==n||void 0!==o)&&Promise.resolve().then(()=>void 0===n?o(a):n(a,i)).catch(t=>this._onerror(Error(`Uncaught error in notification handler: ${t}`)))}_onrequest(t,r){var a;let{message:i,lifted:n}=un(t,"request"),o=this._negotiatedWireCodec();if(r?.classification===void 0&&"drop"===this._shouldDropInbound(t))return void this._onerror(Error(`Dropped inbound request '${t.method}': not servable on this connection's protocol era`));let s=this._transport,l=(t,r,a)=>{let n={jsonrpc:"2.0",id:i.id,error:{code:t,message:r,...void 0!==a&&{data:a}}};s?.send(n).catch(t=>this._onerror(Error(`Failed to send an error response: ${t}`)))};if(r?.classification!==void 0){let t=cT(r.classification);if(t!==o.era){this._onerror(Error(`Era mismatch on inbound request '${i.method}': classified as ${t} but this instance serves ${o.era}`));let a=r.classification.revision??t;l(cl.UnsupportedProtocolVersion,`Unsupported protocol version: ${a}`,{supported:this._supportedProtocolVersions,requested:a});return}}if(cO(i.method)&&!o.hasRequestMethod(i.method))return void l(cl.MethodNotFound,"Method not found");let c=this._requestHandlers.get(i.method)??this.fallbackRequestHandler;if(void 0===c)return void l(cl.MethodNotFound,"Method not found");let u=o.checkInboundEnvelope(n);if(void 0!==u)return void l(cl.InvalidParams,u);let d=(t,r)=>this._notificationViaCodec(this._resolveOutboundCodec(t.method),t,{...r,relatedRequestId:i.id}),p=(t,r,a)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(t.method),t,r,{...a,relatedRequestId:i.id}),m=new AbortController;this._requestHandlerAbortControllers.set(i.id,m);let h=void 0===n.inputResponses?void 0:function(t){let r={},a=[];if(!ud(t))return{accepted:r,droppedKeys:a};for(let[i,n]of Object.entries(t)){if(!ud(n)||"method"in n||"result"in n){a.push(i);continue}r[i]=n}return{accepted:r,droppedKeys:a}}(n.inputResponses),f={sessionId:s?.sessionId,mcpReq:{id:i.id,method:i.method,_meta:i.params?._meta,...void 0!==n.envelope&&{envelope:n.envelope},...void 0!==h&&{inputResponses:h.accepted},...void 0!==h&&h.droppedKeys.length>0&&{droppedInputResponseKeys:h.droppedKeys},requestState:void 0===n.requestState?us:(a=n.requestState,()=>a),signal:m.signal,send:(t,r,a)=>{let i=this._resolveOutboundCodec(t.method);if(this._assertOutboundRequestInEra(i,t.method),cY(r))return p(t,r,a);let n=uo(i,t.method);if(void 0===n)throw TypeError(`'${t.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return p(t,n,r)},notify:d},http:r?.authInfo?{authInfo:r.authInfo}:void 0},y=this.buildContext(f,r);Promise.resolve().then(()=>c(i,y)).then(async t=>{let r;if(m.signal.aborted)return;try{r=o.encodeResult(i.method,t,this._outboundServerInfo())}catch(t){this._onerror(Error(`Failed to encode result for ${i.method}: ${t}`)),l(cl.InternalError,"Internal error");return}let a={result:r,jsonrpc:"2.0",id:i.id};await s?.send(a)},async t=>{if(m.signal.aborted)return;let r=Number.isSafeInteger(t.code)?t.code:cl.InternalError,a={jsonrpc:"2.0",id:i.id,error:{code:o.encodeErrorCode(r),message:t.message??"Internal error",...void 0!==t.data&&{data:t.data}}};await s?.send(a)}).catch(t=>this._onerror(Error(`Failed to send response: ${t}`))).finally(()=>{this._requestHandlerAbortControllers.get(i.id)===m&&this._requestHandlerAbortControllers.delete(i.id)})}_onprogress(t){let{progressToken:r,...a}=t.params,i=Number(r),n=this._progressHandlers.get(i);if(!n)return void this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));let o=this._responseHandlers.get(i),s=this._timeoutInfo.get(i);if(s&&o&&s.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(t){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),o(t);return}n(a)}_onresponse(t){let r=Number(t.id),a=this._responseHandlers.get(r);void 0===a?this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`)):(this._responseHandlers.delete(r),this._cleanupTimeout(r),this._progressHandlers.delete(r),a(or.safeParse(t).success?t:cc.fromError(t.error.code,t.error.message,t.error.data)))}get transport(){return this._transport}async close(){await this._transport?.close()}request(t,r,a){let i=this._resolveOutboundCodec(t.method);if(this._assertOutboundRequestInEra(i,t.method),cY(r))return this._requestWithSchemaViaCodec(i,t,r,a);let n=uo(i,t.method);if(void 0===n)throw TypeError(`'${t.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(i,t,n,r)}_negotiatedWireCodec(){return cj(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(t){if(void 0===this._negotiatedProtocolVersion){let r=function(t){switch(t){case"initialize":case"notifications/initialized":return cj(void 0);case"server/discover":return cj(cE);default:return}}(t);if(r)return r}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(t,r){if(cO(r)&&!t.hasRequestMethod(r))throw new lD(lL.MethodNotSupportedByProtocolVersion,`Method '${r}' is not supported by the negotiated protocol version (wire era ${t.era})`,{method:r,era:t.era})}_requestWithSchema(t,r,a){let i=this._resolveOutboundCodec(t.method);return this._assertOutboundRequestInEra(i,t.method),this._requestWithSchemaViaCodec(i,t,r,a)}_requestWithSchemaViaCodec(t,r,a,i){let n,o,{relatedRequestId:s,resumptionToken:l,onresumptiontoken:c,headers:u}=i??{},d=Date.now();return new Promise((p,m)=>{let h=t=>{m(t)};if(!this._transport)return void h(Error("Not connected"));if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(r.method)}catch(t){h(t);return}if(i?.signal?.aborted){let t=i.signal.reason;throw t instanceof lD?t:new lD(lL.RequestTimeout,String(t))}let f=t.era===cE&&!0===this._transport.hasPerRequestStream?new AbortController:void 0,y=this._requestMessageId++;o=y;let g={...r,jsonrpc:"2.0",id:y};i?.onprogress&&(this._progressHandlers.set(y,i.onprogress),g.params={...r.params,_meta:{...r.params?._meta,progressToken:y}});let v=this._envelopeOutbound(g),_=!1,b=t=>{_||(this._progressHandlers.delete(y),void 0===f?this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:y,reason:String(t)}}),{relatedRequestId:s,resumptionToken:l,onresumptiontoken:c}).catch(t=>this._onerror(Error(`Failed to send cancellation: ${t}`))):f.abort(),m(t instanceof lD?t:new lD(lL.RequestTimeout,String(t))))};this._responseHandlers.set(y,n=>{let o;if(!i?.signal?.aborted){if(_=!0,n instanceof Error)return m(n);try{o=t.decodeResult(r.method,n.result)}catch(t){return m(t instanceof Error?t:Error(String(t)))}if("invalid"===o.kind)return m(o.error);if("input_required"===o.kind){var s;return i?.allowInputRequired===!0?p({resultType:"input_required",inputRequests:(s=o).inputRequests,...void 0!==s.requestState&&{requestState:s.requestState}}):p(this._resolveNonCompleteResult(o,{codec:t,request:r,resultSchema:a,options:i,flowStartedAt:d,retry:(i,n)=>this._requestWithSchemaViaCodec(t,void 0===i?{method:r.method}:{method:r.method,params:i},a,n)}))}c1(a,o.result).then(t=>{t.success?p(t.data):m(new lD(lL.InvalidResult,`Invalid result for ${r.method}: ${t.error}`))},m)}}),n=()=>b(i?.signal?.reason),i?.signal?.addEventListener("abort",n,{once:!0});let S=i?.timeout??6e4;this._setupTimeout(y,S,i?.maxTotalTimeout,()=>b(new lD(lL.RequestTimeout,"Request timed out",{timeout:S})),i?.resetTimeoutOnProgress??!1),this._transport.send(v,{relatedRequestId:s,resumptionToken:l,onresumptiontoken:c,headers:u,requestSignal:f?.signal}).catch(t=>{this._progressHandlers.delete(y),m(t)})}).finally(()=>{n&&i?.signal?.removeEventListener("abort",n),void 0!==o&&(this._responseHandlers.delete(o),this._cleanupTimeout(o))})}async notification(t,r){return this._notificationViaCodec(this._resolveOutboundCodec(t.method),t,r)}async _notificationViaCodec(t,r,a){if(!this._transport)throw new lD(lL.NotConnected,"Not connected");if(cC(r.method)&&!t.hasNotificationMethod(r.method))throw new lD(lL.MethodNotSupportedByProtocolVersion,`Notification '${r.method}' is not supported by the negotiated protocol version (wire era ${t.era})`,{method:r.method,era:t.era});this.assertNotificationCapability(r.method);let i=this._envelopeOutbound({jsonrpc:"2.0",...r});if((this._options?.debouncedNotificationMethods??[]).includes(r.method)&&!r.params&&!a?.relatedRequestId){if(this._pendingDebouncedNotifications.has(r.method))return;this._pendingDebouncedNotifications.add(r.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(r.method),this._transport&&this._transport?.send(i,a).catch(t=>this._onerror(t))});return}await this._transport.send(i,a)}setRequestHandler(t,r,a){let i;if(this.assertRequestHandlerCapability(t),"function"==typeof r){if(!cO(t))throw TypeError(`'${t}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);i=(a,i)=>{let n=this._negotiatedWireCodec(),o=n.validateRequest(t,a);if(o.ok||"not-in-era"!==o.reason||(o=n.validateInputRequest(t,a)),!o.ok){if("not-in-era"===o.reason)throw new cc(cl.InternalError,`No wire schema for ${t} in the resolved era`);throw Error(o.message)}return Promise.resolve(r(o.value,i))}}else if(a)i=async(i,n)=>{let o=await c1(r.params,{...i.params});if(!o.success)throw new cc(cl.InvalidParams,`Invalid params for ${t}: ${o.error}`);return a(o.data,n)};else throw TypeError("setRequestHandler: handler is required");this._requestHandlers.set(t,this._wrapHandler(t,i))}_wrapHandler(t,r){return r}_outboundServerInfo(){}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r,a){if("function"==typeof r){if(!cC(t))throw TypeError(`'${t}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(t,(a,i)=>{let n=i.validateNotification(t,a);if(!n.ok){if("not-in-era"===n.reason)throw new cc(cl.InternalError,`No wire schema for ${t} in the resolved era`);throw Error(n.message)}return Promise.resolve(r(n.value))});return}if(!a)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(t,async i=>{let n=await c1(r.params,{...i.params});if(!n.success)throw new cc(cl.InvalidParams,`Invalid params for notification ${t}: ${n.error}`);await a(n.data,i)})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}};function uu(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function ud(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}V(t=>{var r=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,a=/\\([\u000b\u0020-\u00ff])/g,i=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function n(t){this.parameters=Object.create(null),this.type=t}t.parse=function(t){if(!t)throw TypeError("argument string is required");var o,s,l,c="object"==typeof t?function(t){var r;if("function"==typeof t.getHeader?r=t.getHeader("content-type"):"object"==typeof t.headers&&(r=t.headers&&t.headers["content-type"]),"string"!=typeof r)throw TypeError("content-type header is missing from object");return r}(t):t;if("string"!=typeof c)throw TypeError("argument string is required to be a string");var u=c.indexOf(";"),d=-1!==u?c.slice(0,u).trim():c.trim();if(!i.test(d))throw TypeError("invalid media type");var p=new n(d.toLowerCase());if(-1!==u){for(r.lastIndex=u;s=r.exec(c);){if(s.index!==u)throw TypeError("invalid parameter format");u+=s[0].length,o=s[1].toLowerCase(),34===(l=s[2]).charCodeAt(0)&&-1!==(l=l.slice(1,-1)).indexOf("\\")&&(l=l.replace(a,"$1")),p.parameters[o]=l}if(u!==c.length)throw TypeError("invalid parameter format")}return p}})();var up=class{_buffer;_maxBufferSize;constructor(t){this._maxBufferSize=t?.maxBufferSize??0xa00000}append(t){if((this._buffer?.length??0)+t.length>this._maxBufferSize)throw this.clear(),Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){for(;this._buffer;){let r=this._buffer.indexOf("\n");if(-1===r)break;let a=this._buffer.toString("utf8",0,r).replace(/\r$/,"");this._buffer=this._buffer.subarray(r+1);try{var t;return t=a,oi.parse(JSON.parse(t))}catch(t){if(t instanceof SyntaxError)continue;throw t}}return null}clear(){this._buffer=void 0}};let um=/^[A-Za-z0-9._-]{1,128}$/;function uh(t){let r=function(t){let r=[];if(0===t.length)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(t.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${t.length})`]};if(t.includes(" ")&&r.push("Tool name contains spaces, which may cause parsing issues"),t.includes(",")&&r.push("Tool name contains commas, which may cause parsing issues"),(t.startsWith("-")||t.endsWith("-"))&&r.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(t.startsWith(".")||t.endsWith("."))&&r.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!um.test(t)){let a=[...t].filter(t=>!/[A-Za-z0-9._-]/.test(t)).filter((t,r,a)=>a.indexOf(t)===r);return r.push(`Tool name contains invalid characters: ${a.map(t=>`"${t}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:r}}return{isValid:!0,warnings:r}}(t);var a=r.warnings;if(a.length>0){for(let r of(console.warn(`Tool name validation warning for "${t}":`),a))console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}return r.isValid}var uf=class t{static isTemplate(t){return/\{[^}\s]+\}/.test(t)}static validateLength(t,r,a){if(t.length>r)throw Error(`${a} exceeds maximum length of ${r} characters (got ${t.length})`)}template;parts;get variableNames(){return this.parts.flatMap(t=>"string"==typeof t?[]:t.names)}constructor(r){t.validateLength(r,1e6,"Template"),this.template=r,this.parts=this.parse(r)}toString(){return this.template}parse(r){let a=[],i="",n=0,o=0;for(;n<r.length;)if("{"===r[n]){i&&(a.push(i),i="");let s=r.indexOf("}",n);if(-1===s)throw Error("Unclosed template expression");if(++o>1e4)throw Error("Template contains too many expressions (max 10000)");let l=r.slice(n+1,s),c=this.getOperator(l),u=l.includes("*"),d=this.getNames(l),p=d[0];for(let r of d)t.validateLength(r,1e6,"Variable name");a.push({name:p,operator:c,names:d,exploded:u}),n=s+1}else i+=r[n],n++;return i&&a.push(i),a}getOperator(t){return["+","#",".","/","?","&"].find(r=>t.startsWith(r))||""}getNames(t){let r=this.getOperator(t);return t.slice(r.length).split(",").map(t=>t.replace("*","").trim()).filter(t=>t.length>0)}encodeValue(r,a){return(t.validateLength(r,1e6,"Variable value"),"+"===a||"#"===a)?encodeURI(r):encodeURIComponent(r)}expandPart(t,r){if("?"===t.operator||"&"===t.operator){let a=t.names.map(a=>{let i=r[a];return void 0===i?"":`${a}=${Array.isArray(i)?i.map(r=>this.encodeValue(r,t.operator)).join(","):this.encodeValue(i.toString(),t.operator)}`}).filter(t=>t.length>0);return 0===a.length?"":("?"===t.operator?"?":"&")+a.join("&")}if(t.names.length>1){let a=t.names.map(t=>r[t]).filter(t=>void 0!==t);return 0===a.length?"":a.map(t=>Array.isArray(t)?t[0]:t).join(",")}let a=r[t.name];if(void 0===a)return"";let i=(Array.isArray(a)?a:[a]).map(r=>this.encodeValue(r,t.operator));switch(t.operator){case"":case"+":default:return i.join(",");case"#":return"#"+i.join(",");case".":return"."+i.join(".");case"/":return"/"+i.join("/")}}expand(t){let r="",a=!1;for(let i of this.parts){if("string"==typeof i){r+=i;continue}let n=this.expandPart(i,t);n&&(r+=("?"===i.operator||"&"===i.operator)&&a?n.replace("?","&"):n,("?"===i.operator||"&"===i.operator)&&(a=!0))}return r}escapeRegExp(t){return t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}partToRegExp(r){let a,i=[];for(let a of r.names)t.validateLength(a,1e6,"Variable name");if("?"===r.operator||"&"===r.operator){for(let t=0;t<r.names.length;t++){let a=r.names[t],n=0===t?"\\"+r.operator:"&";i.push({pattern:n+this.escapeRegExp(a)+"=([^&]+)",name:a})}return i}let n=r.name;switch(r.operator){case"":a=r.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)";break;case"+":case"#":a="(.+)";break;case".":a=String.raw`\.([^/,]+)`;break;case"/":a="/"+(r.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)");break;default:a="([^/]+)"}return i.push({pattern:a,name:n}),i}match(r){t.validateLength(r,1e6,"URI");let a="^",i=[];for(let t of this.parts)if("string"==typeof t)a+=this.escapeRegExp(t);else for(let{pattern:r,name:n}of this.partToRegExp(t))a+=r,i.push({name:n,exploded:t.exploded});a+="$",t.validateLength(a,1e6,"Generated regex pattern");let n=new RegExp(a),o=r.match(n);if(!o)return null;let s={};for(let[t,r]of i.entries()){let{name:a,exploded:i}=r,n=o[t+1];s[a.replace("*","")]=i&&n.includes(",")?n.split(","):n}return s}};function uy(t){if(void 0!==t){if(function(t){if("object"!=typeof t||null===t||cY(t))return!1;let r=Object.getPrototypeOf(t);return(r===Object.prototype||null===r)&&Object.values(t).every(t=>"object"==typeof t&&null!==t&&"_zod"in t)}(t))return ns(t);if("object"==typeof t&&null!==t&&!cY(t)&&Object.values(t).some(t=>"object"==typeof t&&null!==t&&!("_zod"in t)&&"_def"in t&&"string"==typeof t._def?.typeName))throw TypeError("Raw-shape inputSchema/outputSchema/argsSchema fields must be Zod v4 schemas. Got a Zod v3 field schema. Import from `zod/v4` (or upgrade your zod import), or wrap with `z.object({...})` yourself.");if(!cY(t))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return t}}var ug=V(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;var r=class{};t._CodeOrName=r,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var a=class extends r{constructor(r){if(super(),!t.IDENTIFIER.test(r))throw Error("CodeGen: name must be a valid identifier");this.str=r}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};t.Name=a;var i=class extends r{constructor(t){super(),this._items="string"==typeof t?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return""===t||'""'===t}get str(){var t;return null!=(t=this._str)?t:this._str=this._items.reduce((t,r)=>`${t}${r}`,"")}get names(){var t;return null!=(t=this._names)?t:this._names=this._items.reduce((t,r)=>(r instanceof a&&(t[r.str]=(t[r.str]||0)+1),t),{})}};function n(t,...r){let a=[t[0]],o=0;for(;o<r.length;)l(a,r[o]),a.push(t[++o]);return new i(a)}t._Code=i,t.nil=new i(""),t._=n;let o=new i("+");function s(t,...r){let n=[c(t[0])],u=0;for(;u<r.length;)n.push(o),l(n,r[u]),n.push(o,c(t[++u]));return function(t){let r=1;for(;r<t.length-1;){if(t[r]===o){var i,n;let o=(i=t[r-1],'""'===(n=t[r+1])?i:'""'===i?n:"string"==typeof i?n instanceof a||'"'!==i[i.length-1]?void 0:"string"!=typeof n?`${i.slice(0,-1)}${n}"`:'"'===n[0]?i.slice(0,-1)+n.slice(1):void 0:"string"!=typeof n||'"'!==n[0]||i instanceof a?void 0:`"${i}${n.slice(1)}`);if(void 0!==o){t.splice(r-1,3,o);continue}t[r++]="+"}r++}}(n),new i(n)}function l(t,r){var n;r instanceof i?t.push(...r._items):r instanceof a?t.push(r):t.push("number"==typeof(n=r)||"boolean"==typeof n||null===n?n:c(Array.isArray(n)?n.join(","):n))}function c(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.str=s,t.addCodeArg=l,t.strConcat=function(t,r){return r.emptyStr()?t:t.emptyStr()?r:s`${t}${r}`},t.stringify=function(t){return new i(c(t))},t.safeStringify=c,t.getProperty=function(r){return"string"==typeof r&&t.IDENTIFIER.test(r)?new i(`.${r}`):n`[${r}]`},t.getEsmExportName=function(r){if("string"==typeof r&&t.IDENTIFIER.test(r))return new i(`${r}`);throw Error(`CodeGen: invalid export name: ${r}, use explicit $id name mapping`)},t.regexpCode=function(t){return new i(t.toString())}}),uv=V(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;let r=ug();var a,i,n=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}};(a=i||(t.UsedValueState=i={}))[a.Started=0]="Started",a[a.Completed=1]="Completed",t.varKinds={const:new r.Name("const"),let:new r.Name("let"),var:new r.Name("var")};var o=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof r.Name?t:this.name(t)}name(t){return new r.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,a;if((null==(a=null==(r=this._parent)?void 0:r._prefixes)?void 0:a.has(t))||this._prefixes&&!this._prefixes.has(t))throw Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};t.Scope=o;var s=class extends r.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:a,itemIndex:i}){this.value=t,this.scopePath=(0,r._)`.${new r.Name(a)}[${i}]`}};t.ValueScopeName=s;let l=(0,r._)`\n`;var c=class extends o{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?l:r.nil}}get(){return this._scope}name(t){return new s(t,this._newName(t))}value(t,r){var a;if(void 0===r.ref)throw Error("CodeGen: ref must be passed in value");let i=this.toName(t),{prefix:n}=i,o=null!=(a=r.key)?a:r.ref,s=this._values[n];if(s){let t=s.get(o);if(t)return t}else s=this._values[n]=new Map;s.set(o,i);let l=this._scope[n]||(this._scope[n]=[]),c=l.length;return l[c]=r.ref,i.setValue(r,{property:n,itemIndex:c}),i}getValue(t,r){let a=this._values[t];if(a)return a.get(r)}scopeRefs(t,a=this._values){return this._reduceValues(a,a=>{if(void 0===a.scopePath)throw Error(`CodeGen: name "${a}" has no value`);return(0,r._)`${t}${a.scopePath}`})}scopeCode(t=this._values,r,a){return this._reduceValues(t,t=>{if(void 0===t.value)throw Error(`CodeGen: name "${t}" has no value`);return t.value.code},r,a)}_reduceValues(a,o,s={},l){let c=r.nil;for(let u in a){let d=a[u];if(!d)continue;let p=s[u]=s[u]||new Map;d.forEach(a=>{if(p.has(a))return;p.set(a,i.Started);let s=o(a);if(s){let i=this.opts.es5?t.varKinds.var:t.varKinds.const;c=(0,r._)`${c}${i} ${a} = ${s};${this.opts._n}`}else if(s=null==l?void 0:l(a))c=(0,r._)`${c}${s}${this.opts._n}`;else throw new n(a);p.set(a,i.Completed)})}return c}};t.ValueScope=c}),u_=V(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;let r=ug(),a=uv();var i=ug();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return i._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return i.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return i.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return i.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return i.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return i.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return i.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return i.Name}});var n=uv();Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return n.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return n.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return n.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return n.varKinds}}),t.operators={GT:new r._Code(">"),GTE:new r._Code(">="),LT:new r._Code("<"),LTE:new r._Code("<="),EQ:new r._Code("==="),NEQ:new r._Code("!=="),NOT:new r._Code("!"),OR:new r._Code("||"),AND:new r._Code("&&"),ADD:new r._Code("+")};var o=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},s=class extends o{constructor(t,r,a){super(),this.varKind=t,this.name=r,this.rhs=a}render({es5:t,_n:r}){let i=t?a.varKinds.var:this.varKind,n=void 0===this.rhs?"":` = ${this.rhs}`;return`${i} ${this.name}${n};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=O(this.rhs,t,r)),this}get names(){return this.rhs instanceof r._CodeOrName?this.rhs.names:{}}},l=class extends o{constructor(t,r,a){super(),this.lhs=t,this.rhs=r,this.sideEffects=a}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,a){if(!(this.lhs instanceof r.Name)||t[this.lhs.str]||this.sideEffects)return this.rhs=O(this.rhs,t,a),this}get names(){return T(this.lhs instanceof r.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends l{constructor(t,r,a,i){super(t,a,i),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},u=class extends o{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},d=class extends o{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},p=class extends o{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},m=class extends o{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=O(this.code,t,r),this}get names(){return this.code instanceof r._CodeOrName?this.code.names:{}}},h=class extends o{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,a)=>r+a.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let a=t[r].optimizeNodes();Array.isArray(a)?t.splice(r,1,...a):a?t[r]=a:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:a}=this,i=a.length;for(;i--;){let n=a[i];n.optimizeNames(t,r)||(function(t,r){for(let a in r)t[a]=(t[a]||0)-(r[a]||0)}(t,n.names),a.splice(i,1))}return a.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>j(t,r.names),{})}},f=class extends h{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},y=class extends h{},g=class extends f{};g.kind="else";var v=class t extends f{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let r=this.condition;if(!0===r)return this.nodes;let a=this.else;if(a){let t=a.optimizeNodes();a=this.else=Array.isArray(t)?new g(t):t}return a?!1===r?a instanceof t?a:a.nodes:this.nodes.length?this:new t(C(r),a instanceof t?[a]:a.nodes):!1!==r&&this.nodes.length?this:void 0}optimizeNames(t,r){var a;if(this.else=null==(a=this.else)?void 0:a.optimizeNames(t,r),super.optimizeNames(t,r)||this.else)return this.condition=O(this.condition,t,r),this}get names(){let t=super.names;return T(t,this.condition),this.else&&j(t,this.else.names),t}};v.kind="if";var _=class extends f{};_.kind="for";var b=class extends _{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=O(this.iteration,t,r),this}get names(){return j(super.names,this.iteration.names)}},S=class extends _{constructor(t,r,a,i){super(),this.varKind=t,this.name=r,this.from=a,this.to=i}render(t){let r=t.es5?a.varKinds.var:this.varKind,{name:i,from:n,to:o}=this;return`for(${r} ${i}=${n}; ${i}<${o}; ${i}++)`+super.render(t)}get names(){return T(T(super.names,this.from),this.to)}},$=class extends _{constructor(t,r,a,i){super(),this.loop=t,this.varKind=r,this.name=a,this.iterable=i}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=O(this.iterable,t,r),this}get names(){return j(super.names,this.iterable.names)}},w=class extends f{constructor(t,r,a){super(),this.name=t,this.args=r,this.async=a}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};w.kind="func";var k=class extends h{render(t){return"return "+super.render(t)}};k.kind="return";var x=class extends f{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),null==(t=this.catch)||t.optimizeNodes(),null==(r=this.finally)||r.optimizeNodes(),this}optimizeNames(t,r){var a,i;return super.optimizeNames(t,r),null==(a=this.catch)||a.optimizeNames(t,r),null==(i=this.finally)||i.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&j(t,this.catch.names),this.finally&&j(t,this.finally.names),t}},R=class extends f{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};R.kind="catch";var P=class extends f{render(t){return"finally"+super.render(t)}};P.kind="finally";var E=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?"\n":""},this._extScope=t,this._scope=new a.Scope({parent:t}),this._nodes=[new y]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let a=this._extScope.value(t,r);return(this._values[a.prefix]||(this._values[a.prefix]=new Set)).add(a),a}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,a,i){let n=this._scope.toName(r);return void 0!==a&&i&&(this._constants[n.str]=a),this._leafNode(new s(t,n,a)),n}const(t,r,i){return this._def(a.varKinds.const,t,r,i)}let(t,r,i){return this._def(a.varKinds.let,t,r,i)}var(t,r,i){return this._def(a.varKinds.var,t,r,i)}assign(t,r,a){return this._leafNode(new l(t,r,a))}add(r,a){return this._leafNode(new c(r,t.operators.ADD,a))}code(t){return"function"==typeof t?t():t!==r.nil&&this._leafNode(new m(t)),this}object(...t){let a=["{"];for(let[i,n]of t)a.length>1&&a.push(","),a.push(i),(i!==n||this.opts.es5)&&(a.push(":"),(0,r.addCodeArg)(a,n));return a.push("}"),new r._Code(a)}if(t,r,a){if(this._blockNode(new v(t)),r&&a)this.code(r).else().code(a).endIf();else if(r)this.code(r).endIf();else if(a)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new v(t))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(v,g)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new b(t),r)}forRange(t,r,i,n,o=this.opts.es5?a.varKinds.var:a.varKinds.let){let s=this._scope.toName(t);return this._for(new S(o,s,r,i),()=>n(s))}forOf(t,i,n,o=a.varKinds.const){let s=this._scope.toName(t);if(this.opts.es5){let t=i instanceof r.Name?i:this.var("_arr",i);return this.forRange("_i",0,(0,r._)`${t}.length`,a=>{this.var(s,(0,r._)`${t}[${a}]`),n(s)})}return this._for(new $("of",o,s,i),()=>n(s))}forIn(t,i,n,o=this.opts.es5?a.varKinds.var:a.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,r._)`Object.keys(${i})`,n);let s=this._scope.toName(t);return this._for(new $("in",o,s,i),()=>n(s))}endFor(){return this._endBlockNode(_)}label(t){return this._leafNode(new u(t))}break(t){return this._leafNode(new d(t))}return(t){let r=new k;if(this._blockNode(r),this.code(t),1!==r.nodes.length)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(k)}try(t,r,a){if(!r&&!a)throw Error('CodeGen: "try" without "catch" and "finally"');let i=new x;if(this._blockNode(i),this.code(t),r){let t=this.name("e");this._currNode=i.catch=new R(t),r(t)}return a&&(this._currNode=i.finally=new P,this.code(a)),this._endBlockNode(R,P)}throw(t){return this._leafNode(new p(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(void 0===r)throw Error("CodeGen: not in self-balancing block");let a=this._nodes.length-r;if(a<0||void 0!==t&&a!==t)throw Error(`CodeGen: wrong number of nodes: ${a} vs ${t} expected`);return this._nodes.length=r,this}func(t,a=r.nil,i,n){return this._blockNode(new w(t,a,i)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(w)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let a=this._currNode;if(a instanceof t||r&&a instanceof r)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof v))throw Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};function j(t,r){for(let a in r)t[a]=(t[a]||0)+(r[a]||0);return t}function T(t,a){return a instanceof r._CodeOrName?j(t,a.names):t}function O(t,a,i){var n;if(t instanceof r.Name)return o(t);if(!((n=t)instanceof r._Code&&n._items.some(t=>t instanceof r.Name&&1===a[t.str]&&void 0!==i[t.str])))return t;return new r._Code(t._items.reduce((t,a)=>(a instanceof r.Name&&(a=o(a)),a instanceof r._Code?t.push(...a._items):t.push(a),t),[]));function o(t){let r=i[t.str];return void 0===r||1!==a[t.str]?t:(delete a[t.str],r)}}function C(t){return"boolean"==typeof t||"number"==typeof t||null===t?!t:(0,r._)`!${A(t)}`}t.CodeGen=E,t.not=C;let N=q(t.operators.AND);t.and=function(...t){return t.reduce(N)};let I=q(t.operators.OR);function q(t){return(a,i)=>a===r.nil?i:i===r.nil?a:(0,r._)`${A(a)} ${t} ${A(i)}`}function A(t){return t instanceof r.Name?t:(0,r._)`(${t})`}t.or=function(...t){return t.reduce(I)}}),ub=V(t=>{var r,a;Object.defineProperty(t,"__esModule",{value:!0}),t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.setEvaluated=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.schemaHasRules=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;let i=u_(),n=ug();function o(t,r=t.schema){let{opts:a,self:i}=t;if(!a.strictSchema||"boolean"==typeof r)return;let n=i.RULES.keywords;for(let a in r)n[a]||h(t,`unknown keyword: "${a}"`)}function s(t,r){if("boolean"==typeof t)return!t;for(let a in t)if(r[a])return!0;return!1}function l(t){return"number"==typeof t?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}function c(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function u({mergeNames:t,mergeToName:r,mergeValues:a,resultToName:n}){return(o,s,l,c)=>{let u=void 0===l?s:l instanceof i.Name?(s instanceof i.Name?t(o,s,l):r(o,s,l),l):s instanceof i.Name?(r(o,l,s),s):a(s,l);return c!==i.Name||u instanceof i.Name?u:n(o,u)}}function d(t,r){if(!0===r)return t.var("props",!0);let a=t.var("props",(0,i._)`{}`);return void 0!==r&&p(t,a,r),a}function p(t,r,a){Object.keys(a).forEach(a=>t.assign((0,i._)`${r}${(0,i.getProperty)(a)}`,!0))}t.toHash=function(t){let r={};for(let a of t)r[a]=!0;return r},t.alwaysValidSchema=function(t,r){return"boolean"==typeof r?r:0===Object.keys(r).length||(o(t,r),!s(r,t.self.RULES.all))},t.checkUnknownRules=o,t.schemaHasRules=s,t.schemaHasRulesButRef=function(t,r){if("boolean"==typeof t)return!t;for(let a in t)if("$ref"!==a&&r.all[a])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:t,schemaPath:r},a,n,o){if(!o){if("number"==typeof a||"boolean"==typeof a)return a;if("string"==typeof a)return(0,i._)`${a}`}return(0,i._)`${t}${r}${(0,i.getProperty)(n)}`},t.unescapeFragment=function(t){return c(decodeURIComponent(t))},t.escapeFragment=function(t){return encodeURIComponent(l(t))},t.escapeJsonPointer=l,t.unescapeJsonPointer=c,t.eachItem=function(t,r){if(Array.isArray(t))for(let a of t)r(a);else r(t)},t.mergeEvaluated={props:u({mergeNames:(t,r,a)=>t.if((0,i._)`${a} !== true && ${r} !== undefined`,()=>{t.if((0,i._)`${r} === true`,()=>t.assign(a,!0),()=>t.assign(a,(0,i._)`${a} || {}`).code((0,i._)`Object.assign(${a}, ${r})`))}),mergeToName:(t,r,a)=>t.if((0,i._)`${a} !== true`,()=>{!0===r?t.assign(a,!0):(t.assign(a,(0,i._)`${a} || {}`),p(t,a,r))}),mergeValues:(t,r)=>!0===t||{...t,...r},resultToName:d}),items:u({mergeNames:(t,r,a)=>t.if((0,i._)`${a} !== true && ${r} !== undefined`,()=>t.assign(a,(0,i._)`${r} === true ? true : ${a} > ${r} ? ${a} : ${r}`)),mergeToName:(t,r,a)=>t.if((0,i._)`${a} !== true`,()=>t.assign(a,!0===r||(0,i._)`${a} > ${r} ? ${a} : ${r}`)),mergeValues:(t,r)=>!0===t||Math.max(t,r),resultToName:(t,r)=>t.var("items",r)})},t.evaluatedPropsToName=d,t.setEvaluated=p;let m={};function h(t,r,a=t.opts.strictSchema){if(a){if(r=`strict mode: ${r}`,!0===a)throw Error(r);t.self.logger.warn(r)}}t.useFunc=function(t,r){return t.scopeValue("func",{ref:r,code:m[r.code]||(m[r.code]=new n._Code(r.code))})},(a=r||(t.Type=r={}))[a.Num=0]="Num",a[a.Str=1]="Str",t.getErrorPath=function(t,a,n){if(t instanceof i.Name){let o=a===r.Num;return n?o?(0,i._)`"[" + ${t} + "]"`:(0,i._)`"['" + ${t} + "']"`:o?(0,i._)`"/" + ${t}`:(0,i._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,i.getProperty)(t).toString():"/"+l(t)},t.checkStrictMode=h}),uS=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u_();t.default={data:new r.Name("data"),valCxt:new r.Name("valCxt"),instancePath:new r.Name("instancePath"),parentData:new r.Name("parentData"),parentDataProperty:new r.Name("parentDataProperty"),rootData:new r.Name("rootData"),dynamicAnchors:new r.Name("dynamicAnchors"),vErrors:new r.Name("vErrors"),errors:new r.Name("errors"),this:new r.Name("this"),self:new r.Name("self"),scope:new r.Name("scope"),json:new r.Name("json"),jsonPos:new r.Name("jsonPos"),jsonLen:new r.Name("jsonLen"),jsonPart:new r.Name("jsonPart")}}),u$=V(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;let r=u_(),a=ub(),i=uS();function n(t,a){let n=t.const("err",a);t.if((0,r._)`${i.default.vErrors} === null`,()=>t.assign(i.default.vErrors,(0,r._)`[${n}]`),(0,r._)`${i.default.vErrors}.push(${n})`),t.code((0,r._)`${i.default.errors}++`)}function o(t,a){let{gen:i,validateName:n,schemaEnv:o}=t;o.$async?i.throw((0,r._)`new ${t.ValidationError}(${a})`):(i.assign((0,r._)`${n}.errors`,a),i.return(!1))}t.keywordError={message:({keyword:t})=>(0,r.str)`must pass "${t}" keyword validation`},t.keyword$DataError={message:({keyword:t,schemaType:a})=>a?(0,r.str)`"${t}" keyword must be ${a} ($data)`:(0,r.str)`"${t}" keyword is invalid ($data)`},t.reportError=function(a,i=t.keywordError,s,c){let{it:u}=a,{gen:d,compositeRule:p,allErrors:m}=u,h=l(a,i,s);(null!=c?c:p||m)?n(d,h):o(u,(0,r._)`[${h}]`)},t.reportExtraError=function(r,a=t.keywordError,s){let{it:c}=r,{gen:u,compositeRule:d,allErrors:p}=c;n(u,l(r,a,s)),d||p||o(c,i.default.vErrors)},t.resetErrorsCount=function(t,a){t.assign(i.default.errors,a),t.if((0,r._)`${i.default.vErrors} !== null`,()=>t.if(a,()=>t.assign((0,r._)`${i.default.vErrors}.length`,a),()=>t.assign(i.default.vErrors,null)))},t.extendErrors=function({gen:t,keyword:a,schemaValue:n,data:o,errsCount:s,it:l}){if(void 0===s)throw Error("ajv implementation error");let c=t.name("err");t.forRange("i",s,i.default.errors,s=>{t.const(c,(0,r._)`${i.default.vErrors}[${s}]`),t.if((0,r._)`${c}.instancePath === undefined`,()=>t.assign((0,r._)`${c}.instancePath`,(0,r.strConcat)(i.default.instancePath,l.errorPath))),t.assign((0,r._)`${c}.schemaPath`,(0,r.str)`${l.errSchemaPath}/${a}`),l.opts.verbose&&(t.assign((0,r._)`${c}.schema`,n),t.assign((0,r._)`${c}.data`,o))})};let s={keyword:new r.Name("keyword"),schemaPath:new r.Name("schemaPath"),params:new r.Name("params"),propertyName:new r.Name("propertyName"),message:new r.Name("message"),schema:new r.Name("schema"),parentSchema:new r.Name("parentSchema")};function l(t,n,o){let{createErrors:l}=t.it;return!1===l?(0,r._)`{}`:function(t,n,o={}){let{gen:l,it:c}=t,u=[function({errorPath:t},{instancePath:n}){let o=n?(0,r.str)`${t}${(0,a.getErrorPath)(n,a.Type.Str)}`:t;return[i.default.instancePath,(0,r.strConcat)(i.default.instancePath,o)]}(c,o),function({keyword:t,it:{errSchemaPath:i}},{schemaPath:n,parentSchema:o}){let l=o?i:(0,r.str)`${i}/${t}`;return n&&(l=(0,r.str)`${l}${(0,a.getErrorPath)(n,a.Type.Str)}`),[s.schemaPath,l]}(t,o)];return function(t,{params:a,message:n},o){let{keyword:l,data:c,schemaValue:u,it:d}=t,{opts:p,propertyName:m,topSchemaRef:h,schemaPath:f}=d;o.push([s.keyword,l],[s.params,"function"==typeof a?a(t):a||(0,r._)`{}`]),p.messages&&o.push([s.message,"function"==typeof n?n(t):n]),p.verbose&&o.push([s.schema,u],[s.parentSchema,(0,r._)`${h}${f}`],[i.default.data,c]),m&&o.push([s.propertyName,m])}(t,n,u),l.object(...u)}(t,n,o)}}),uw=V(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;let r=u$(),a=u_(),i=uS(),n={message:"boolean schema is false"};function o(t,a){let{gen:i,data:o}=t;(0,r.reportError)({gen:i,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t},n,void 0,a)}t.topBoolOrEmptySchema=function(t){let{gen:r,schema:n,validateName:s}=t;!1===n?o(t,!1):"object"==typeof n&&!0===n.$async?r.return(i.default.data):(r.assign((0,a._)`${s}.errors`,null),r.return(!0))},t.boolOrEmptySchema=function(t,r){let{gen:a,schema:i}=t;!1===i?(a.var(r,!1),o(t)):a.var(r,!0)}}),uk=V(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRules=t.isJSONType=void 0;let r=new Set(["string","number","integer","boolean","null","object","array"]);t.isJSONType=function(t){return"string"==typeof t&&r.has(t)},t.getRules=function(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}}),ux=V(t=>{function r(t,r){return r.rules.some(r=>a(t,r))}function a(t,r){var a;return void 0!==t[r.keyword]||(null==(a=r.definition.implements)?void 0:a.some(r=>void 0!==t[r]))}Object.defineProperty(t,"__esModule",{value:!0}),t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0,t.schemaHasRulesForType=function({schema:t,self:a},i){let n=a.RULES.types[i];return n&&!0!==n&&r(t,n)},t.shouldUseGroup=r,t.shouldUseRule=a}),uR=V(t=>{var r,a;Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;let i=uk(),n=ux(),o=u$(),s=u_(),l=ub();function c(t){let r=Array.isArray(t)?t:t?[t]:[];if(r.every(i.isJSONType))return r;throw Error("type must be JSONType or JSONType[]: "+r.join(","))}(a=r||(t.DataType=r={}))[a.Correct=0]="Correct",a[a.Wrong=1]="Wrong",t.getSchemaTypes=function(t){let r=c(t.type);if(r.includes("null")){if(!1===t.nullable)throw Error("type: null contradicts nullable: false")}else{if(!r.length&&void 0!==t.nullable)throw Error('"nullable" cannot be used without "type"');!0===t.nullable&&r.push("null")}return r},t.getJSONTypes=c,t.coerceAndCheckDataType=function(t,a){var i,o;let{gen:l,data:c,opts:d}=t,m=(i=a,(o=d.coerceTypes)?i.filter(t=>u.has(t)||"array"===o&&"array"===t):[]),f=a.length>0&&!(0===m.length&&1===a.length&&(0,n.schemaHasRulesForType)(t,a[0]));if(f){let i=p(a,c,d.strictNumbers,r.Wrong);l.if(i,()=>{m.length?function(t,r,a){let{gen:i,data:n,opts:o}=t,l=i.let("dataType",(0,s._)`typeof ${n}`),c=i.let("coerced",(0,s._)`undefined`);for(let t of("array"===o.coerceTypes&&i.if((0,s._)`${l} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>i.assign(n,(0,s._)`${n}[0]`).assign(l,(0,s._)`typeof ${n}`).if(p(r,n,o.strictNumbers),()=>i.assign(c,n))),i.if((0,s._)`${c} !== undefined`),a))(u.has(t)||"array"===t&&"array"===o.coerceTypes)&&function(t){switch(t){case"string":i.elseIf((0,s._)`${l} == "number" || ${l} == "boolean"`).assign(c,(0,s._)`"" + ${n}`).elseIf((0,s._)`${n} === null`).assign(c,(0,s._)`""`);return;case"number":i.elseIf((0,s._)`${l} == "boolean" || ${n} === null
|
|
56
56
|
|| (${l} == "string" && ${n} && ${n} == +${n})`).assign(c,(0,s._)`+${n}`);return;case"integer":i.elseIf((0,s._)`${l} === "boolean" || ${n} === null
|
|
57
57
|
|| (${l} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(c,(0,s._)`+${n}`);return;case"boolean":i.elseIf((0,s._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(c,!1).elseIf((0,s._)`${n} === "true" || ${n} === 1`).assign(c,!0);return;case"null":i.elseIf((0,s._)`${n} === "" || ${n} === 0 || ${n} === false`),i.assign(c,null);return;case"array":i.elseIf((0,s._)`${l} === "string" || ${l} === "number"
|
|
58
|
-
|| ${l} === "boolean" || ${n} === null`).assign(c,(0,s._)`[${n}]`)}}(t);i.else(),h(t),i.endIf(),i.if((0,s._)`${c} !== undefined`,()=>{i.assign(n,c),function({gen:t,parentData:r,parentDataProperty:a},i){t.if((0,s._)`${r} !== undefined`,()=>t.assign((0,s._)`${r}[${a}]`,i))}(t,c)})}(t,a,m):h(t)})}return f};let u=new Set(["string","number","integer","boolean","null"]);function d(t,a,i,n=r.Correct){let o,l=n===r.Correct?s.operators.EQ:s.operators.NEQ;switch(t){case"null":return(0,s._)`${a} ${l} null`;case"array":o=(0,s._)`Array.isArray(${a})`;break;case"object":o=(0,s._)`${a} && typeof ${a} == "object" && !Array.isArray(${a})`;break;case"integer":o=c((0,s._)`!(${a} % 1) && !isNaN(${a})`);break;case"number":o=c();break;default:return(0,s._)`typeof ${a} ${l} ${t}`}return n===r.Correct?o:(0,s.not)(o);function c(t=s.nil){return(0,s.and)((0,s._)`typeof ${a} == "number"`,t,i?(0,s._)`isFinite(${a})`:s.nil)}}function p(t,r,a,i){let n;if(1===t.length)return d(t[0],r,a,i);let o=(0,l.toHash)(t);if(o.array&&o.object){let t=(0,s._)`typeof ${r} != "object"`;n=o.null?t:(0,s._)`!${r} || ${t}`,delete o.null,delete o.array,delete o.object}else n=s.nil;for(let t in o.number&&delete o.integer,o)n=(0,s.and)(n,d(t,r,a,i));return n}t.checkDataType=d,t.checkDataTypes=p;let m={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:r})=>"string"==typeof t?(0,s._)`{type: ${t}}`:(0,s._)`{type: ${r}}`};function h(t){let r=function(t){let{gen:r,data:a,schema:i}=t,n=(0,l.schemaRefOrVal)(t,i,"type");return{gen:r,keyword:"type",data:a,schema:i.type,schemaCode:n,schemaValue:n,parentSchema:i,params:{},it:t}}(t);(0,o.reportError)(r,m)}t.reportTypeError=h}),uE=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;let r=ub(),a=uS();function i(t,i,n){let{gen:o,compositeRule:s,data:l,opts:c}=t;if(void 0===n)return;let u=(0,r._)`${l}${(0,r.getProperty)(i)}`;if(s)return void(0,a.checkStrictMode)(t,`default is ignored for: ${u}`);let d=(0,r._)`${u} === undefined`;"empty"===c.useDefaults&&(d=(0,r._)`${d} || ${u} === null || ${u} === ""`),o.if(d,(0,r._)`${u} = ${(0,r.stringify)(n)}`)}t.assignDefaults=function(t,r){let{properties:a,items:n}=t.schema;if("object"===r&&a)for(let r in a)i(t,r,a[r].default);else"array"===r&&Array.isArray(n)&&n.forEach((r,a)=>i(t,a,r.default))}}),uO=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateUnion=t.validateArray=t.usePattern=t.callValidateCode=t.schemaProperties=t.allSchemaProperties=t.noPropertyInData=t.propertyInData=t.isOwnProperty=t.hasPropFunc=t.reportMissingProp=t.checkMissingProp=t.checkReportMissingProp=void 0;let r=ub(),a=uS(),i=u$(),n=uS();function o(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,r._)`Object.prototype.hasOwnProperty`})}function s(t,a,i){return(0,r._)`${o(t)}.call(${a}, ${i})`}function l(t,a,i,n){let o=(0,r._)`${a}${(0,r.getProperty)(i)} === undefined`;return n?(0,r.or)(o,(0,r.not)(s(t,a,i))):o}function c(t){return t?Object.keys(t).filter(t=>"__proto__"!==t):[]}t.checkReportMissingProp=function(t,a){let{gen:i,data:n,it:o}=t;i.if(l(i,n,a,o.opts.ownProperties),()=>{t.setParams({missingProperty:(0,r._)`${a}`},!0),t.error()})},t.checkMissingProp=function({gen:t,data:a,it:{opts:i}},n,o){return(0,r.or)(...n.map(n=>(0,r.and)(l(t,a,n,i.ownProperties),(0,r._)`${o} = ${n}`)))},t.reportMissingProp=function(t,r){t.setParams({missingProperty:r},!0),t.error()},t.hasPropFunc=o,t.isOwnProperty=s,t.propertyInData=function(t,a,i,n){let o=(0,r._)`${a}${(0,r.getProperty)(i)} !== undefined`;return n?(0,r._)`${o} && ${s(t,a,i)}`:o},t.noPropertyInData=l,t.allSchemaProperties=c,t.schemaProperties=function(t,r){return c(r).filter(i=>!(0,a.alwaysValidSchema)(t,r[i]))},t.callValidateCode=function({schemaCode:t,data:a,it:{gen:n,topSchemaRef:o,schemaPath:s,errorPath:l},it:c},u,d,p){let m=p?(0,r._)`${t}, ${a}, ${o}${s}`:a,h=[[i.default.instancePath,(0,r.strConcat)(i.default.instancePath,l)],[i.default.parentData,c.parentData],[i.default.parentDataProperty,c.parentDataProperty],[i.default.rootData,i.default.rootData]];c.opts.dynamicRef&&h.push([i.default.dynamicAnchors,i.default.dynamicAnchors]);let f=(0,r._)`${m}, ${n.object(...h)}`;return d!==r.nil?(0,r._)`${u}.call(${d}, ${f})`:(0,r._)`${u}(${f})`};let u=(0,r._)`new RegExp`;t.usePattern=function({gen:t,it:{opts:a}},i){let o=a.unicodeRegExp?"u":"",{regExp:s}=a.code,l=s(i,o);return t.scopeValue("pattern",{key:l.toString(),ref:l,code:(0,r._)`${"new RegExp"===s.code?u:(0,n.useFunc)(t,s)}(${i}, ${o})`})},t.validateArray=function(t){let{gen:i,data:n,keyword:o,it:s}=t,l=i.name("valid");if(s.allErrors){let t=i.let("valid",!0);return c(()=>i.assign(t,!1)),t}return i.var(l,!0),c(()=>i.break()),l;function c(s){let c=i.const("len",(0,r._)`${n}.length`);i.forRange("i",0,c,n=>{t.subschema({keyword:o,dataProp:n,dataPropType:a.Type.Num},l),i.if((0,r.not)(l),s)})}},t.validateUnion=function(t){let{gen:i,schema:n,keyword:o,it:s}=t;if(!Array.isArray(n))throw Error("ajv implementation error");if(n.some(t=>(0,a.alwaysValidSchema)(s,t))&&!s.opts.unevaluated)return;let l=i.let("valid",!1),c=i.name("_valid");i.block(()=>n.forEach((a,n)=>{let s=t.subschema({keyword:o,schemaProp:n,compositeRule:!0},c);i.assign(l,(0,r._)`${l} || ${c}`),t.mergeValidEvaluated(s,c)||i.if((0,r.not)(l))})),t.result(l,()=>t.reset(),()=>t.error(!0))}}),uT=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;let r=ub(),a=u$(),i=uO(),n=uw();function o(t){let{gen:a,data:i,it:n}=t;a.if(n.parentData,()=>a.assign(i,(0,r._)`${n.parentData}[${n.parentDataProperty}]`))}function s(t,a,i){if(void 0===i)throw Error(`keyword "${a}" failed to compile`);return t.scopeValue("keyword","function"==typeof i?{ref:i}:{ref:i,code:(0,r.stringify)(i)})}t.macroKeywordCode=function(t,a){let{gen:i,keyword:n,schema:o,parentSchema:l,it:c}=t,u=a.macro.call(c.self,o,l,c),d=s(i,n,u);!1!==c.opts.validateSchema&&c.self.validateSchema(u,!0);let p=i.name("valid");t.subschema({schema:u,schemaPath:r.nil,errSchemaPath:`${c.errSchemaPath}/${n}`,topSchemaRef:d,compositeRule:!0},p),t.pass(p,()=>t.error(!0))},t.funcKeywordCode=function(t,l){var c;let{gen:u,keyword:d,schema:p,parentSchema:m,$data:h,it:f}=t;!function({schemaEnv:t},r){if(r.async&&!t.$async)throw Error("async keyword in sync schema")}(f,l);let y=s(u,d,!h&&l.compile?l.compile.call(f.self,p,m,f):l.validate),g=u.let("valid");function v(n=l.async?(0,r._)`await `:r.nil){let o=f.opts.passContext?a.default.this:a.default.self,s=!("compile"in l&&!h||!1===l.schema);u.assign(g,(0,r._)`${n}${(0,i.callValidateCode)(t,y,o,s)}`,l.modifying)}function _(t){var a;u.if((0,r.not)(null!=(a=l.valid)?a:g),t)}t.block$data(g,function(){if(!1===l.errors)v(),l.modifying&&o(t),_(()=>t.error());else{let i,s,c=l.async?(i=u.let("ruleErrs",null),u.try(()=>v((0,r._)`await `),t=>u.assign(g,!1).if((0,r._)`${t} instanceof ${f.ValidationError}`,()=>u.assign(i,(0,r._)`${t}.errors`),()=>u.throw(t))),i):(s=(0,r._)`${y}.errors`,u.assign(s,null),v(r.nil),s);l.modifying&&o(t),_(()=>(function(t,i){let{gen:o}=t;o.if((0,r._)`Array.isArray(${i})`,()=>{o.assign(a.default.vErrors,(0,r._)`${a.default.vErrors} === null ? ${i} : ${a.default.vErrors}.concat(${i})`).assign(a.default.errors,(0,r._)`${a.default.vErrors}.length`),(0,n.extendErrors)(t)},()=>t.error())})(t,c))}}),t.ok(null!=(c=l.valid)?c:g)},t.validSchemaType=function(t,r,a=!1){return!r.length||r.some(r=>"array"===r?Array.isArray(t):"object"===r?t&&"object"==typeof t&&!Array.isArray(t):typeof t==r||a&&void 0===t)},t.validateKeywordUsage=function({schema:t,opts:r,self:a,errSchemaPath:i},n,o){if(Array.isArray(n.keyword)?!n.keyword.includes(o):n.keyword!==o)throw Error("ajv implementation error");let s=n.dependencies;if(null==s?void 0:s.some(r=>!Object.prototype.hasOwnProperty.call(t,r)))throw Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(n.validateSchema&&!n.validateSchema(t[o])){let t=`keyword "${o}" value is invalid at path "${i}": `+a.errorsText(n.validateSchema.errors);if("log"===r.validateSchema)a.logger.error(t);else throw Error(t)}}}),uj=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;let r=ub(),a=uS();t.getSubschema=function(t,{keyword:i,schemaProp:n,schema:o,schemaPath:s,errSchemaPath:l,topSchemaRef:c}){if(void 0!==i&&void 0!==o)throw Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==i){let o=t.schema[i];return void 0===n?{schema:o,schemaPath:(0,r._)`${t.schemaPath}${(0,r.getProperty)(i)}`,errSchemaPath:`${t.errSchemaPath}/${i}`}:{schema:o[n],schemaPath:(0,r._)`${t.schemaPath}${(0,r.getProperty)(i)}${(0,r.getProperty)(n)}`,errSchemaPath:`${t.errSchemaPath}/${i}/${(0,a.escapeFragment)(n)}`}}if(void 0!==o){if(void 0===s||void 0===l||void 0===c)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:s,topSchemaRef:c,errSchemaPath:l}}throw Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(t,i,{dataProp:n,dataPropType:o,data:s,dataTypes:l,propertyName:c}){if(void 0!==s&&void 0!==n)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:u}=i;if(void 0!==n){let{errorPath:s,dataPathArr:l,opts:c}=i;d(u.let("data",(0,r._)`${i.data}${(0,r.getProperty)(n)}`,!0)),t.errorPath=(0,r.str)`${s}${(0,a.getErrorPath)(n,o,c.jsPropertySyntax)}`,t.parentDataProperty=(0,r._)`${n}`,t.dataPathArr=[...l,t.parentDataProperty]}function d(r){t.data=r,t.dataLevel=i.dataLevel+1,t.dataTypes=[],i.definedProperties=new Set,t.parentData=i.data,t.dataNames=[...i.dataNames,r]}void 0!==s&&(d(s instanceof r.Name?s:u.let("data",s,!0)),void 0!==c&&(t.propertyName=c)),l&&(t.dataTypes=l)},t.extendSubschemaMode=function(t,{jtdDiscriminator:r,jtdMetadata:a,compositeRule:i,createErrors:n,allErrors:o}){void 0!==i&&(t.compositeRule=i),void 0!==n&&(t.createErrors=n),void 0!==o&&(t.allErrors=o),t.jtdDiscriminator=r,t.jtdMetadata=a}}),uN=F((t,r)=>{r.exports=function t(r,a){if(r===a)return!0;if(r&&a&&"object"==typeof r&&"object"==typeof a){if(r.constructor!==a.constructor)return!1;if(Array.isArray(r)){if((i=r.length)!=a.length)return!1;for(n=i;0!=n--;)if(!t(r[n],a[n]))return!1;return!0}if(r.constructor===RegExp)return r.source===a.source&&r.flags===a.flags;if(r.valueOf!==Object.prototype.valueOf)return r.valueOf()===a.valueOf();if(r.toString!==Object.prototype.toString)return r.toString()===a.toString();if((i=(o=Object.keys(r)).length)!==Object.keys(a).length)return!1;for(n=i;0!=n--;)if(!Object.prototype.hasOwnProperty.call(a,o[n]))return!1;for(n=i;0!=n--;){var i,n,o,s=o[n];if(!t(r[s],a[s]))return!1}return!0}return r!=r&&a!=a}}),uC=F((t,r)=>{var a=r.exports=function(t,r,i){"function"==typeof r&&(i=r,r={});var n="function"==typeof(i=r.cb||i)?i:i.pre||function(){};!function t(r,i,n,o,s,l,c,u,d,p){if(o&&"object"==typeof o&&!Array.isArray(o)){for(var m in i(o,s,l,c,u,d,p),o){var h=o[m];if(Array.isArray(h)){if(m in a.arrayKeywords)for(var f=0;f<h.length;f++)t(r,i,n,h[f],s+"/"+m+"/"+f,l,s,m,o,f)}else if(m in a.propsKeywords){if(h&&"object"==typeof h)for(var y in h)t(r,i,n,h[y],s+"/"+m+"/"+y.replace(/~/g,"~0").replace(/\//g,"~1"),l,s,m,o,y)}else(m in a.keywords||r.allKeys&&!(m in a.skipKeywords))&&t(r,i,n,h,s+"/"+m,l,s,m,o)}n(o,s,l,c,u,d,p)}}(r,n,i.post||function(){},t,"",t)};a.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},a.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},a.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},a.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0}}),uI=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;let r=uS(),a=uN(),i=uC(),n=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);t.inlineRef=function(t,a=!0){return"boolean"==typeof t||(!0===a?!function t(r){for(let a in r){if(o.has(a))return!0;let i=r[a];if(Array.isArray(i)&&i.some(t)||"object"==typeof i&&t(i))return!0}return!1}(t):!!a&&function t(a){let i=0;for(let o in a)if("$ref"===o||(i++,!n.has(o)&&("object"==typeof a[o]&&(0,r.eachItem)(a[o],r=>i+=t(r)),i===1/0)))return 1/0;return i}(t)<=a)};let o=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function s(t,r="",a){return!1!==a&&(r=u(r)),l(t,t.parse(r))}function l(t,r){return t.serialize(r).split("#")[0]+"#"}t.getFullPath=s,t._getFullPath=l;let c=/#\/?$/;function u(t){return t?t.replace(c,""):""}t.normalizeId=u,t.resolveUrl=function(t,r,a){return a=u(a),t.resolve(r,a)};let d=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(t,r){if("boolean"==typeof t)return{};let{schemaId:n,uriResolver:o}=this.opts,l=u(t[n]||r),c={"":l},p=s(o,l,!1),m={},h=new Set;return i(t,{allKeys:!0},(t,r,a,i)=>{if(void 0===i)return;let o=p+r,s=c[i];function l(r){let a=this.opts.uriResolver.resolve;if(r=u(s?a(s,r):r),h.has(r))throw y(r);h.add(r);let i=this.refs[r];return"string"==typeof i&&(i=this.refs[i]),"object"==typeof i?f(t,i.schema,r):r!==u(o)&&("#"===r[0]?(f(t,m[r],r),m[r]=t):this.refs[r]=o),r}function g(t){if("string"==typeof t){if(!d.test(t))throw Error(`invalid anchor "${t}"`);l.call(this,`#${t}`)}}"string"==typeof t[n]&&(s=l.call(this,t[n])),g.call(this,t.$anchor),g.call(this,t.$dynamicAnchor),c[r]=s}),m;function f(t,r,i){if(void 0!==r&&!a(t,r))throw y(i)}function y(t){return Error(`reference "${t}" resolves to more than one schema`)}}}),uq=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;let r=uk(),a=uP(),i=uR(),n=uP(),o=uE(),s=uT(),l=uj(),c=ub(),u=u$(),d=uI(),p=uS(),m=uw();function h({gen:t,validateName:r,schema:a,schemaEnv:i,opts:n},o){var s;n.code.es5?t.func(r,(0,c._)`${u.default.data}, ${u.default.valCxt}`,i.$async,()=>{var r,i;t.code((0,c._)`"use strict"; ${f(a,n)}`),r=t,i=n,r.if(u.default.valCxt,()=>{r.var(u.default.instancePath,(0,c._)`${u.default.valCxt}.${u.default.instancePath}`),r.var(u.default.parentData,(0,c._)`${u.default.valCxt}.${u.default.parentData}`),r.var(u.default.parentDataProperty,(0,c._)`${u.default.valCxt}.${u.default.parentDataProperty}`),r.var(u.default.rootData,(0,c._)`${u.default.valCxt}.${u.default.rootData}`),i.dynamicRef&&r.var(u.default.dynamicAnchors,(0,c._)`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{r.var(u.default.instancePath,(0,c._)`""`),r.var(u.default.parentData,(0,c._)`undefined`),r.var(u.default.parentDataProperty,(0,c._)`undefined`),r.var(u.default.rootData,u.default.data),i.dynamicRef&&r.var(u.default.dynamicAnchors,(0,c._)`{}`)}),t.code(o)}):t.func(r,(0,c._)`${u.default.data}, ${(s=n,(0,c._)`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${s.dynamicRef?(0,c._)`, ${u.default.dynamicAnchors}={}`:c.nil}}={}`)}`,i.$async,()=>t.code(f(a,n)).code(o))}function f(t,r){let a="object"==typeof t&&t[r.schemaId];return a&&(r.code.source||r.code.process)?(0,c._)`/*# sourceURL=${a} */`:c.nil}function y({schema:t,self:r}){if("boolean"==typeof t)return!t;for(let a in t)if(r.RULES.all[a])return!0;return!1}function g(t){return"boolean"!=typeof t.schema}function v(t){(0,p.checkUnknownRules)(t),function(t){let{schema:r,errSchemaPath:a,opts:i,self:n}=t;r.$ref&&i.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(r,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${a}"`)}(t)}function _(t,r){if(t.opts.jtd)return S(t,[],!1,r);let i=(0,a.getSchemaTypes)(t.schema);S(t,i,!(0,a.coerceAndCheckDataType)(t,i),r)}function b({gen:t,schemaEnv:r,schema:a,errSchemaPath:i,opts:n}){let o=a.$comment;if(!0===n.$comment)t.code((0,c._)`${u.default.self}.logger.log(${o})`);else if("function"==typeof n.$comment){let a=(0,c.str)`${i}/$comment`,n=t.scopeValue("root",{ref:r.root});t.code((0,c._)`${u.default.self}.opts.$comment(${o}, ${a}, ${n}.schema)`)}}function S(t,r,a,o){var s,l,d,m;let{gen:h,schema:f,data:y,allErrors:g,opts:v,self:_}=t,{RULES:b}=_;if(f.$ref&&(v.ignoreKeywordsWithRef||!(0,p.schemaHasRulesButRef)(f,b)))return void h.block(()=>R(t,"$ref",b.all.$ref.definition));function S(s){(0,i.shouldUseGroup)(f,s)&&(s.type?(h.if((0,n.checkDataType)(s.type,y,v.strictNumbers)),$(t,s),1===r.length&&r[0]===s.type&&a&&(h.else(),(0,n.reportTypeError)(t)),h.endIf()):$(t,s),g||h.if((0,c._)`${u.default.errors} === ${o||0}`))}v.jtd||(s=t,l=r,!s.schemaEnv.meta&&s.opts.strictTypes&&(function(t,r){if(r.length){if(!t.dataTypes.length){t.dataTypes=r;return}r.forEach(r=>{w(t.dataTypes,r)||k(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),function(t,r){let a=[];for(let i of t.dataTypes)w(r,i)?a.push(i):r.includes("integer")&&"number"===i&&a.push("integer");t.dataTypes=a}(t,r)}}(s,l),s.opts.allowUnionTypes||(d=s,(m=l).length>1&&!(2===m.length&&m.includes("null"))&&k(d,"use allowUnionTypes to allow union type keyword")),function(t,r){let a=t.self.RULES.all;for(let n in a){let o=a[n];if("object"==typeof o&&(0,i.shouldUseRule)(t.schema,o)){let{type:a}=o.definition;a.length&&!a.some(t=>{var a,i;return a=r,i=t,a.includes(i)||"number"===i&&a.includes("integer")})&&k(t,`missing type "${a.join(",")}" for keyword "${n}"`)}}}(s,s.dataTypes))),h.block(()=>{for(let t of b.rules)S(t);S(b.post)})}function $(t,r){let{gen:a,schema:n,opts:{useDefaults:s}}=t;s&&(0,o.assignDefaults)(t,r.type),a.block(()=>{for(let a of r.rules)(0,i.shouldUseRule)(n,a)&&R(t,a.keyword,a.definition,r.type)})}function w(t,r){return t.includes(r)||"integer"===r&&t.includes("number")}function k(t,r){let a=t.schemaEnv.baseId+t.errSchemaPath;r+=` at "${a}" (strictTypes)`,(0,p.checkStrictMode)(t,r,t.opts.strictTypes)}t.validateFunctionCode=function(t){g(t)&&(v(t),y(t))?function(t){let{schema:r,opts:a,gen:i}=t;h(t,()=>{a.$comment&&r.$comment&&b(t),function(t){let{schema:r,opts:a}=t;void 0!==r.default&&a.useDefaults&&a.strictSchema&&(0,p.checkStrictMode)(t,"default is ignored in the schema root")}(t),i.let(u.default.vErrors,null),i.let(u.default.errors,0),a.unevaluated&&function(t){let{gen:r,validateName:a}=t;t.evaluated=r.const("evaluated",(0,c._)`${a}.evaluated`),r.if((0,c._)`${t.evaluated}.dynamicProps`,()=>r.assign((0,c._)`${t.evaluated}.props`,(0,c._)`undefined`)),r.if((0,c._)`${t.evaluated}.dynamicItems`,()=>r.assign((0,c._)`${t.evaluated}.items`,(0,c._)`undefined`))}(t),_(t),function(t){let{gen:r,schemaEnv:a,validateName:i,ValidationError:n,opts:o}=t;a.$async?r.if((0,c._)`${u.default.errors} === 0`,()=>r.return(u.default.data),()=>r.throw((0,c._)`new ${n}(${u.default.vErrors})`)):(r.assign((0,c._)`${i}.errors`,u.default.vErrors),o.unevaluated&&function({gen:t,evaluated:r,props:a,items:i}){a instanceof c.Name&&t.assign((0,c._)`${r}.props`,a),i instanceof c.Name&&t.assign((0,c._)`${r}.items`,i)}(t),r.return((0,c._)`${u.default.errors} === 0`))}(t)})}(t):h(t,()=>(0,r.topBoolOrEmptySchema)(t))};var x=class{constructor(t,r,a){if((0,s.validateKeywordUsage)(t,r,a),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=a,this.data=t.data,this.schema=t.schema[a],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,p.schemaRefOrVal)(t,this.schema,a,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",O(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,s.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw Error(`${a} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:!1!==r.errors)&&(this.errsCount=t.gen.const("_errs",u.default.errors))}result(t,r,a){this.failResult((0,c.not)(t),r,a)}failResult(t,r,a){this.gen.if(t),a?a():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,c.not)(t),void 0,r)}fail(t){if(void 0===t){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,c._)`${r} !== undefined && (${(0,c.or)(this.invalid$data(),t)})`)}error(t,r,a){if(r){this.setParams(r),this._error(t,a),this.setParams({});return}this._error(t,a)}_error(t,r){(t?m.reportExtraError:m.reportError)(this,this.def.error,r)}$dataError(){(0,m.reportError)(this,this.def.$dataError||m.keyword$DataError)}reset(){if(void 0===this.errsCount)throw Error('add "trackErrors" to keyword definition');(0,m.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,a=c.nil){this.gen.block(()=>{this.check$data(t,a),r()})}check$data(t=c.nil,r=c.nil){if(!this.$data)return;let{gen:a,schemaCode:i,schemaType:n,def:o}=this;a.if((0,c.or)((0,c._)`${i} === undefined`,r)),t!==c.nil&&a.assign(t,!0),(n.length||o.validateSchema)&&(a.elseIf(this.invalid$data()),this.$dataError(),t!==c.nil&&a.assign(t,!1)),a.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:a,def:i,it:o}=this;return(0,c.or)(function(){if(a.length){if(!(r instanceof c.Name))throw Error("ajv implementation error");let t=Array.isArray(a)?a:[a];return(0,c._)`${(0,n.checkDataTypes)(t,r,o.opts.strictNumbers,n.DataType.Wrong)}`}return c.nil}(),function(){if(i.validateSchema){let a=t.scopeValue("validate$data",{ref:i.validateSchema});return(0,c._)`!${a}(${r})`}return c.nil}())}subschema(t,a){let i=(0,l.getSubschema)(this.it,t);(0,l.extendSubschemaData)(i,this.it,t),(0,l.extendSubschemaMode)(i,t);let n={...this.it,...i,items:void 0,props:void 0};return!function(t,a){if(g(t)&&(v(t),y(t)))return function(t,r){var a;let i,{schema:n,gen:o,opts:s}=t;s.$comment&&n.$comment&&b(t),(i=(a=t).schema[a.opts.schemaId])&&(a.baseId=(0,d.resolveUrl)(a.opts.uriResolver,a.baseId,i)),function(t){if(t.schema.$async&&!t.schemaEnv.$async)throw Error("async schema in sync schema")}(t);let l=o.const("_errs",u.default.errors);_(t,l),o.var(r,(0,c._)`${l} === ${u.default.errors}`)}(t,a);(0,r.boolOrEmptySchema)(t,a)}(n,a),n}mergeEvaluated(t,r){let{it:a,gen:i}=this;a.opts.unevaluated&&(!0!==a.props&&void 0!==t.props&&(a.props=p.mergeEvaluated.props(i,t.props,a.props,r)),!0!==a.items&&void 0!==t.items&&(a.items=p.mergeEvaluated.items(i,t.items,a.items,r)))}mergeValidEvaluated(t,r){let{it:a,gen:i}=this;if(a.opts.unevaluated&&(!0!==a.props||!0!==a.items))return i.if(r,()=>this.mergeEvaluated(t,c.Name)),!0}};function R(t,r,a,i){let n=new x(t,a,r);"code"in a?a.code(n,i):n.$data&&a.validate?(0,s.funcKeywordCode)(n,a):"macro"in a?(0,s.macroKeywordCode)(n,a):(a.compile||a.validate)&&(0,s.funcKeywordCode)(n,a)}t.KeywordCxt=x;let P=/^\/(?:[^~]|~0|~1)*$/,E=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function O(t,{dataLevel:r,dataNames:a,dataPathArr:i}){let n,o;if(""===t)return u.default.rootData;if("/"===t[0]){if(!P.test(t))throw Error(`Invalid JSON-pointer: ${t}`);n=t,o=u.default.rootData}else{let s=E.exec(t);if(!s)throw Error(`Invalid JSON-pointer: ${t}`);let c=+s[1];if("#"===(n=s[2])){if(c>=r)throw Error(l("property/index",c));return i[r-c]}if(c>r)throw Error(l("data",c));if(o=a[r-c],!n)return o}let s=o;for(let t of n.split("/"))t&&(o=(0,c._)`${o}${(0,c.getProperty)((0,p.unescapeJsonPointer)(t))}`,s=(0,c._)`${s} && ${o}`);return s;function l(t,a){return`Cannot access ${t} ${a} levels up, current level is ${r}`}}t.getData=O}),uz=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}}}),uA=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uI();t.default=class extends Error{constructor(t,a,i,n){super(n||`can't resolve reference ${i} from id ${a}`),this.missingRef=(0,r.resolveUrl)(t,a,i),this.missingSchema=(0,r.normalizeId)((0,r.getFullPath)(t,this.missingRef))}}}),uM=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;let r=ub(),a=uz(),i=u$(),n=uI(),o=uS(),s=uq();var l=class{constructor(t){var r;let a;this.refs={},this.dynamicAnchors={},"object"==typeof t.schema&&(a=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=null!=(r=t.baseId)?r:(0,n.normalizeId)(null==a?void 0:a[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=null==a?void 0:a.$async,this.refs={}}};function c(t){let o,l,c=d.call(this,t);if(c)return c;let u=(0,n.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:p,lines:m}=this.opts.code,{ownProperties:h}=this.opts,f=new r.CodeGen(this.scope,{es5:p,lines:m,ownProperties:h});t.$async&&(o=f.scopeValue("Error",{ref:a.default,code:(0,r._)`require("ajv/dist/runtime/validation_error").default`}));let y=f.scopeName("validate");t.validateName=y;let g={gen:f,allErrors:this.opts.allErrors,data:i.default.data,parentData:i.default.parentData,parentDataProperty:i.default.parentDataProperty,dataNames:[i.default.data],dataPathArr:[r.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:f.scopeValue("schema",!0===this.opts.code.source?{ref:t.schema,code:(0,r.stringify)(t.schema)}:{ref:t.schema}),validateName:y,ValidationError:o,schema:t.schema,schemaEnv:t,rootId:u,baseId:t.baseId||u,schemaPath:r.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,r._)`""`,opts:this.opts,self:this};try{this._compilations.add(t),(0,s.validateFunctionCode)(g),f.optimize(this.opts.code.optimize);let a=f.toString();l=`${f.scopeRefs(i.default.scope)}return ${a}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let n=Function(`${i.default.self}`,`${i.default.scope}`,l)(this,this.scope.get());if(this.scope.value(y,{ref:n}),n.errors=null,n.schema=t.schema,n.schemaEnv=t,t.$async&&(n.$async=!0),!0===this.opts.code.source&&(n.source={validateName:y,validateCode:a,scopeValues:f._values}),this.opts.unevaluated){let{props:t,items:a}=g;n.evaluated={props:t instanceof r.Name?void 0:t,items:a instanceof r.Name?void 0:a,dynamicProps:t instanceof r.Name,dynamicItems:a instanceof r.Name},n.source&&(n.source.evaluated=(0,r.stringify)(n.evaluated))}return t.validate=n,t}catch(r){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),r}finally{this._compilations.delete(t)}}function u(t){return(0,n.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:c.call(this,t)}function d(t){for(let i of this._compilations){var r,a;if(r=i,a=t,r.schema===a.schema&&r.root===a.root&&r.baseId===a.baseId)return i}}function p(t,r){let a;for(;"string"==typeof(a=this.refs[r]);)r=a;return a||this.schemas[r]||m.call(this,t,r)}function m(t,r){let a=this.opts.uriResolver.parse(r),i=(0,n._getFullPath)(this.opts.uriResolver,a),o=(0,n.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&i===o)return f.call(this,a,t);let s=(0,n.normalizeId)(i),u=this.refs[s]||this.schemas[s];if("string"==typeof u){let r=m.call(this,t,u);if("object"!=typeof(null==r?void 0:r.schema))return;return f.call(this,a,r)}if("object"==typeof(null==u?void 0:u.schema)){if(u.validate||c.call(this,u),s===(0,n.normalizeId)(r)){let{schema:r}=u,{schemaId:a}=this.opts,i=r[a];return i&&(o=(0,n.resolveUrl)(this.opts.uriResolver,o,i)),new l({schema:r,schemaId:a,root:t,baseId:o})}return f.call(this,a,u)}}t.SchemaEnv=l,t.compileSchema=c,t.resolveRef=function(t,r,a){var i;a=(0,n.resolveUrl)(this.opts.uriResolver,r,a);let o=t.refs[a];if(o)return o;let s=p.call(this,t,a);if(void 0===s){let n=null==(i=t.localRefs)?void 0:i[a],{schemaId:o}=this.opts;n&&(s=new l({schema:n,schemaId:o,root:t,baseId:r}))}if(void 0!==s)return t.refs[a]=u.call(this,s)},t.getCompilingSchema=d,t.resolveSchema=m;let h=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function f(t,{baseId:r,schema:a,root:i}){var s;let c;if((null==(s=t.fragment)?void 0:s[0])!=="/")return;for(let i of t.fragment.slice(1).split("/")){if("boolean"==typeof a)return;let t=a[(0,o.unescapeFragment)(i)];if(void 0===t)return;let s="object"==typeof(a=t)&&a[this.opts.schemaId];!h.has(i)&&s&&(r=(0,n.resolveUrl)(this.opts.uriResolver,r,s))}if("boolean"!=typeof a&&a.$ref&&!(0,o.schemaHasRulesButRef)(a,this.RULES)){let t=(0,n.resolveUrl)(this.opts.uriResolver,r,a.$ref);c=m.call(this,i,t)}let{schemaId:u}=this.opts;if((c=c||new l({schema:a,schemaId:u,root:i,baseId:r})).schema!==c.root.schema)return c}}),uL=F((t,r)=>{r.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),uD=F((t,r)=>{let a=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),i=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function n(t){let r="",a=0,i=0;for(i=0;i<t.length;i++)if(48!==(a=t[i].charCodeAt(0))){if(!(a>=48&&a<=57||a>=65&&a<=70||a>=97&&a<=102))return"";r+=t[i];break}for(i+=1;i<t.length;i++){if(!((a=t[i].charCodeAt(0))>=48&&a<=57||a>=65&&a<=70||a>=97&&a<=102))return"";r+=t[i]}return r}function o(t){return t.length=0,!0}function s(t,r,a){if(t.length){let i=n(t);if(""===i)return a.error=!0,!1;r.push(i),t.length=0}return!0}function l(t){if(2>function(t,r){let a=0;for(let r=0;r<t.length;r++)":"===t[r]&&a++;return a}(t,":"))return{host:t,isIPV6:!1};let r=function(t){let r=0,a={error:!1,address:"",zone:""},i=[],l=[],c=!1,u=!1,d=s;for(let n=0;n<t.length;n++){let s=t[n];if("["!==s&&"]"!==s)if(":"===s){if(!0===c&&(u=!0),!d(l,i,a))break;if(++r>7){a.error=!0;break}n>0&&":"===t[n-1]&&(c=!0),i.push(":");continue}else if("%"===s){if(!d(l,i,a))break;d=o}else{l.push(s);continue}}return l.length&&(d===o?a.zone=l.join(""):u?i.push(l.join("")):i.push(n(l))),a.address=i.join(""),a}(t);if(r.error)return{host:t,isIPV6:!1};{let t=r.address,a=r.address;return r.zone&&(t+="%"+r.zone,a+="%25"+r.zone),{host:t,isIPV6:!0,escapedHost:a}}}r.exports={nonSimpleDomain:RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u),recomposeAuthority:function(t){let r=[];if(void 0!==t.userinfo&&(r.push(t.userinfo),r.push("@")),void 0!==t.host){let a=unescape(t.host);if(!i(a)){let r=l(a);a=!0===r.isIPV6?`[${r.escapedHost}]`:t.host}r.push(a)}return("number"==typeof t.port||"string"==typeof t.port)&&(r.push(":"),r.push(String(t.port))),r.length?r.join(""):void 0},normalizeComponentEncoding:function(t,r){let a=!0!==r?escape:unescape;return void 0!==t.scheme&&(t.scheme=a(t.scheme)),void 0!==t.userinfo&&(t.userinfo=a(t.userinfo)),void 0!==t.host&&(t.host=a(t.host)),void 0!==t.path&&(t.path=a(t.path)),void 0!==t.query&&(t.query=a(t.query)),void 0!==t.fragment&&(t.fragment=a(t.fragment)),t},removeDotSegments:function(t){let r=t,a=[],i=-1,n=0;for(;n=r.length;){if(1===n)if("."===r)break;else if("/"===r){a.push("/");break}else{a.push(r);break}if(2===n){if("."===r[0]){if("."===r[1])break;else if("/"===r[1]){r=r.slice(2);continue}}else if("/"===r[0]&&("."===r[1]||"/"===r[1])){a.push("/");break}}else if(3===n&&"/.."===r){0!==a.length&&a.pop(),a.push("/");break}if("."===r[0]){if("."===r[1]){if("/"===r[2]){r=r.slice(3);continue}}else if("/"===r[1]){r=r.slice(2);continue}}else if("/"===r[0]&&"."===r[1]){if("/"===r[2]){r=r.slice(2);continue}else if("."===r[2]&&"/"===r[3]){r=r.slice(3),0!==a.length&&a.pop();continue}}if(-1===(i=r.indexOf("/",1))){a.push(r);break}a.push(r.slice(0,i)),r=r.slice(i)}return a.join("")},isIPv4:i,isUUID:a,normalizeIPv6:l,stringArrayToHexStripped:n}}),uZ=F((t,r)=>{let{isUUID:a}=uD(),i=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,n=["http","https","ws","wss","urn","urn:uuid"];function o(t){return!0===t.secure||!1!==t.secure&&!!t.scheme&&3===t.scheme.length&&("w"===t.scheme[0]||"W"===t.scheme[0])&&("s"===t.scheme[1]||"S"===t.scheme[1])&&("s"===t.scheme[2]||"S"===t.scheme[2])}function s(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function l(t){let r="https"===String(t.scheme).toLowerCase();return(t.port===(r?443:80)||""===t.port)&&(t.port=void 0),t.path||(t.path="/"),t}let c={scheme:"http",domainHost:!0,parse:s,serialize:l},u={scheme:"https",domainHost:c.domainHost,parse:s,serialize:l},d={scheme:"ws",domainHost:!0,parse:function(t){return t.secure=o(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t},serialize:function(t){if((t.port===(o(t)?443:80)||""===t.port)&&(t.port=void 0),"boolean"==typeof t.secure&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[r,a]=t.resourceName.split("?");t.path=r&&"/"!==r?r:void 0,t.query=a,t.resourceName=void 0}return t.fragment=void 0,t}},p={scheme:"wss",domainHost:d.domainHost,parse:d.parse,serialize:d.serialize},m={http:c,https:u,ws:d,wss:p,urn:{scheme:"urn",parse:function(t,r){if(!t.path)return t.error="URN can not be parsed",t;let a=t.path.match(i);if(a){let i=r.scheme||t.scheme||"urn";t.nid=a[1].toLowerCase(),t.nss=a[2];let n=h(`${i}:${r.nid||t.nid}`);t.path=void 0,n&&(t=n.parse(t,r))}else t.error=t.error||"URN can not be parsed.";return t},serialize:function(t,r){if(void 0===t.nid)throw Error("URN without nid cannot be serialized");let a=r.scheme||t.scheme||"urn",i=t.nid.toLowerCase(),n=h(`${a}:${r.nid||i}`);n&&(t=n.serialize(t,r));let o=t,s=t.nss;return o.path=`${i||r.nid}:${s}`,r.skipEscape=!0,o},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(t,r){return t.uuid=t.nss,t.nss=void 0,r.tolerant||t.uuid&&a(t.uuid)||(t.error=t.error||"UUID is not valid."),t},serialize:function(t){return t.nss=(t.uuid||"").toLowerCase(),t},skipNormalize:!0}};function h(t){return t&&(m[t]||m[t.toLowerCase()])||void 0}Object.setPrototypeOf(m,null),r.exports={wsIsSecure:o,SCHEMES:m,isValidSchemeName:function(t){return -1!==n.indexOf(t)},getSchemeHandler:h}}),uV=F((t,r)=>{let{normalizeIPv6:a,removeDotSegments:i,recomposeAuthority:n,normalizeComponentEncoding:o,isIPv4:s,nonSimpleDomain:l}=uD(),{SCHEMES:c,getSchemeHandler:u}=uZ();function d(t,r,a,n){let o={};return n||(t=h(p(t,a),a),r=h(p(r,a),a)),!(a=a||{}).tolerant&&r.scheme?(o.scheme=r.scheme,o.userinfo=r.userinfo,o.host=r.host,o.port=r.port,o.path=i(r.path||""),o.query=r.query):(void 0!==r.userinfo||void 0!==r.host||void 0!==r.port?(o.userinfo=r.userinfo,o.host=r.host,o.port=r.port,o.path=i(r.path||""),o.query=r.query):(r.path?("/"===r.path[0]?o.path=i(r.path):(void 0===t.userinfo&&void 0===t.host&&void 0===t.port||t.path?t.path?o.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+r.path:o.path=r.path:o.path="/"+r.path,o.path=i(o.path)),o.query=r.query):(o.path=t.path,void 0!==r.query?o.query=r.query:o.query=t.query),o.userinfo=t.userinfo,o.host=t.host,o.port=t.port),o.scheme=t.scheme),o.fragment=r.fragment,o}function p(t,r){let a={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},o=Object.assign({},r),s=[],l=u(o.scheme||a.scheme);l&&l.serialize&&l.serialize(a,o),void 0!==a.path&&(o.skipEscape?a.path=unescape(a.path):(a.path=escape(a.path),void 0!==a.scheme&&(a.path=a.path.split("%3A").join(":")))),"suffix"!==o.reference&&a.scheme&&s.push(a.scheme,":");let c=n(a);if(void 0!==c&&("suffix"!==o.reference&&s.push("//"),s.push(c),a.path&&"/"!==a.path[0]&&s.push("/")),void 0!==a.path){let t=a.path;o.absolutePath||l&&l.absolutePath||(t=i(t)),void 0===c&&"/"===t[0]&&"/"===t[1]&&(t="/%2F"+t.slice(2)),s.push(t)}return void 0!==a.query&&s.push("?",a.query),void 0!==a.fragment&&s.push("#",a.fragment),s.join("")}let m=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function h(t,r){let i=Object.assign({},r),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1;"suffix"===i.reference&&(t=i.scheme?i.scheme+":"+t:"//"+t);let c=t.match(m);if(c){if(n.scheme=c[1],n.userinfo=c[3],n.host=c[4],n.port=parseInt(c[5],10),n.path=c[6]||"",n.query=c[7],n.fragment=c[8],isNaN(n.port)&&(n.port=c[5]),n.host)if(!1===s(n.host)){let t=a(n.host);n.host=t.host.toLowerCase(),o=t.isIPV6}else o=!0;void 0!==n.scheme||void 0!==n.userinfo||void 0!==n.host||void 0!==n.port||void 0!==n.query||n.path?void 0===n.scheme?n.reference="relative":void 0===n.fragment?n.reference="absolute":n.reference="uri":n.reference="same-document",i.reference&&"suffix"!==i.reference&&i.reference!==n.reference&&(n.error=n.error||"URI is not a "+i.reference+" reference.");let r=u(i.scheme||n.scheme);if(!i.unicodeSupport&&(!r||!r.unicodeSupport)&&n.host&&(i.domainHost||r&&r.domainHost)&&!1===o&&l(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(t){n.error=n.error||"Host's domain name can not be converted to ASCII: "+t}(!r||r&&!r.skipNormalize)&&(-1!==t.indexOf("%")&&(void 0!==n.scheme&&(n.scheme=unescape(n.scheme)),void 0!==n.host&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),r&&r.parse&&r.parse(n,i)}else n.error=n.error||"URI can not be parsed.";return n}let f={SCHEMES:c,normalize:function(t,r){return"string"==typeof t?t=p(h(t,r),r):"object"==typeof t&&(t=h(p(t,r),r)),t},resolve:function(t,r,a){let i=a?Object.assign({scheme:"null"},a):{scheme:"null"},n=d(h(t,i),h(r,i),i,!0);return i.skipEscape=!0,p(n,i)},resolveComponent:d,equal:function(t,r,a){return"string"==typeof t?t=p(o(h(t=unescape(t),a),!0),{...a,skipEscape:!0}):"object"==typeof t&&(t=p(o(t,!0),{...a,skipEscape:!0})),"string"==typeof r?r=p(o(h(r=unescape(r),a),!0),{...a,skipEscape:!0}):"object"==typeof r&&(r=p(o(r,!0),{...a,skipEscape:!0})),t.toLowerCase()===r.toLowerCase()},serialize:p,parse:h};r.exports=f,r.exports.default=f,r.exports.fastUri=f}),uF=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV();r.code='require("ajv/dist/runtime/uri").default',t.default=r}),uU=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var r=uq();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return r.KeywordCxt}});var a=ub();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return a._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return a.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return a.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return a.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return a.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return a.CodeGen}});let i=uz(),n=uA(),o=ux(),s=uM(),l=ub(),c=uI(),u=uP(),d=uS(),p=uL(),m=uF(),h=(t,r)=>new RegExp(t,r);h.code="new RegExp";let f=["removeAdditional","useDefaults","coerceTypes"],y=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."},v={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};var _=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...function(t){var r,a,i,n,o,s,l,c,u,d,p,f,y,g,v,_,b,S,$,w,k,x,R,P,E;let O=t.strict,T=null==(r=t.code)?void 0:r.optimize,j=!0===T||void 0===T?1:T||0,N=null!=(i=null==(a=t.code)?void 0:a.regExp)?i:h,C=null!=(n=t.uriResolver)?n:m.default;return{strictSchema:null==(s=null!=(o=t.strictSchema)?o:O)||s,strictNumbers:null==(c=null!=(l=t.strictNumbers)?l:O)||c,strictTypes:null!=(d=null!=(u=t.strictTypes)?u:O)?d:"log",strictTuples:null!=(f=null!=(p=t.strictTuples)?p:O)?f:"log",strictRequired:null!=(g=null!=(y=t.strictRequired)?y:O)&&g,code:t.code?{...t.code,optimize:j,regExp:N}:{optimize:j,regExp:N},loopRequired:null!=(v=t.loopRequired)?v:200,loopEnum:null!=(_=t.loopEnum)?_:200,meta:null==(b=t.meta)||b,messages:null==(S=t.messages)||S,inlineRefs:null==($=t.inlineRefs)||$,schemaId:null!=(w=t.schemaId)?w:"$id",addUsedSchema:null==(k=t.addUsedSchema)||k,validateSchema:null==(x=t.validateSchema)||x,validateFormats:null==(R=t.validateFormats)||R,unicodeRegExp:null==(P=t.unicodeRegExp)||P,int32range:null==(E=t.int32range)||E,uriResolver:C}}(t)};const{es5:r,lines:a}=this.opts.code;this.scope=new l.ValueScope({scope:{},prefixes:y,es5:r,lines:a}),this.logger=function(t){if(!1===t)return R;if(void 0===t)return console;if(t.log&&t.warn&&t.error)return t;throw Error("logger must implement log, warn and error methods")}(t.logger);const i=t.validateFormats;t.validateFormats=!1,this.RULES=(0,o.getRules)(),b.call(this,g,t,"NOT SUPPORTED"),b.call(this,v,t,"DEPRECATED","warn"),this._metaOpts=x.call(this),t.formats&&w.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&k.call(this,t.keywords),"object"==typeof t.meta&&this.addMetaSchema(t.meta),$.call(this),t.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:a}=this.opts,i=p;"id"===a&&((i={...p}).id=i.$id,delete i.$id),r&&t&&this.addMetaSchema(i,i[a],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta="object"==typeof t?t[r]||t:void 0}validate(t,r){let a;if("string"==typeof t){if(!(a=this.getSchema(t)))throw Error(`no schema with key or ref "${t}"`)}else a=this.compile(t);let i=a(r);return"$async"in a||(this.errors=a.errors),i}compile(t,r){let a=this._addSchema(t,r);return a.validate||this._compileSchemaEnv(a)}compileAsync(t,r){if("function"!=typeof this.opts.loadSchema)throw Error("options.loadSchema should be a function");let{loadSchema:a}=this.opts;return i.call(this,t,r);async function i(t,r){await o.call(this,t.$schema);let a=this._addSchema(t,r);return a.validate||s.call(this,a)}async function o(t){t&&!this.getSchema(t)&&await i.call(this,{$ref:t},!0)}async function s(t){try{return this._compileSchemaEnv(t)}catch(r){if(!(r instanceof n.default))throw r;return l.call(this,r),await c.call(this,r.missingSchema),s.call(this,t)}}function l({missingSchema:t,missingRef:r}){if(this.refs[t])throw Error(`AnySchema ${t} is loaded but ${r} cannot be resolved`)}async function c(t){let a=await u.call(this,t);this.refs[t]||await o.call(this,a.$schema),this.refs[t]||this.addSchema(a,t,r)}async function u(t){let r=this._loading[t];if(r)return r;try{return await (this._loading[t]=a(t))}finally{delete this._loading[t]}}}addSchema(t,r,a,i=this.opts.validateSchema){let n;if(Array.isArray(t)){for(let r of t)this.addSchema(r,void 0,a,i);return this}if("object"==typeof t){let{schemaId:r}=this.opts;if(void 0!==(n=t[r])&&"string"!=typeof n)throw Error(`schema ${r} must be string`)}return r=(0,c.normalizeId)(r||n),this._checkUnique(r),this.schemas[r]=this._addSchema(t,a,r,i,!0),this}addMetaSchema(t,r,a=this.opts.validateSchema){return this.addSchema(t,r,!0,a),this}validateSchema(t,r){let a;if("boolean"==typeof t)return!0;if(void 0!==(a=t.$schema)&&"string"!=typeof a)throw Error("$schema must be a string");if(!(a=a||this.opts.defaultMeta||this.defaultMeta()))return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(a,t);if(!i&&r){let t="schema is invalid: "+this.errorsText();if("log"===this.opts.validateSchema)this.logger.error(t);else throw Error(t)}return i}getSchema(t){let r;for(;"string"==typeof(r=S.call(this,t));)t=r;if(void 0===r){let{schemaId:a}=this.opts,i=new s.SchemaEnv({schema:{},schemaId:a});if(!(r=s.resolveSchema.call(this,i,t)))return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=S.call(this,t);return"object"==typeof r&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{this._cache.delete(t);let r=t[this.opts.schemaId];return r&&(r=(0,c.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let a;if("string"==typeof t)a=t,"object"==typeof r&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=a);else if("object"==typeof t&&void 0===r){if(Array.isArray(a=(r=t).keyword)&&!a.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(E.call(this,a,r),!r)return(0,d.eachItem)(a,t=>O.call(this,t)),this;j.call(this,r);let i={...r,type:(0,u.getJSONTypes)(r.type),schemaType:(0,u.getJSONTypes)(r.schemaType)};return(0,d.eachItem)(a,0===i.type.length?t=>O.call(this,t,i):t=>i.type.forEach(r=>O.call(this,t,i,r))),this}getKeyword(t){let r=this.RULES.all[t];return"object"==typeof r?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;for(let a of(delete r.keywords[t],delete r.all[t],r.rules)){let r=a.rules.findIndex(r=>r.keyword===t);r>=0&&a.rules.splice(r,1)}return this}addFormat(t,r){return"string"==typeof r&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:a="data"}={}){return t&&0!==t.length?t.map(t=>`${a}${t.instancePath} ${t.message}`).reduce((t,a)=>t+r+a):"No errors"}$dataMetaSchema(t,r){let a=this.RULES.all;for(let i of(t=JSON.parse(JSON.stringify(t)),r)){let r=i.split("/").slice(1),n=t;for(let t of r)n=n[t];for(let t in a){let r=a[t];if("object"!=typeof r)continue;let{$data:i}=r.definition,o=n[t];i&&o&&(n[t]=C(o))}}return t}_removeAllSchemas(t,r){for(let a in t){let i=t[a];(!r||r.test(a))&&("string"==typeof i?delete t[a]:i&&!i.meta&&(this._cache.delete(i.schema),delete t[a]))}}_addSchema(t,r,a,i=this.opts.validateSchema,n=this.opts.addUsedSchema){let o,{schemaId:l}=this.opts;if("object"==typeof t)o=t[l];else if(this.opts.jtd)throw Error("schema must be object");else if("boolean"!=typeof t)throw Error("schema must be object or boolean");let u=this._cache.get(t);if(void 0!==u)return u;a=(0,c.normalizeId)(o||a);let d=c.getSchemaRefs.call(this,t,a);return u=new s.SchemaEnv({schema:t,schemaId:l,meta:r,baseId:a,localRefs:d}),this._cache.set(u.schema,u),n&&!a.startsWith("#")&&(a&&this._checkUnique(a),this.refs[a]=u),i&&this.validateSchema(t,!0),u}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):s.compileSchema.call(this,t),!t.validate)throw Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{s.compileSchema.call(this,t)}finally{this.opts=r}}};function b(t,r,a,i="error"){for(let n in t)n in r&&this.logger[i](`${a}: option ${n}. ${t[n]}`)}function S(t){return t=(0,c.normalizeId)(t),this.schemas[t]||this.refs[t]}function $(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let r in t)this.addSchema(t[r],r)}function w(){for(let t in this.opts.formats){let r=this.opts.formats[t];r&&this.addFormat(t,r)}}function k(t){if(Array.isArray(t))return void this.addVocabulary(t);for(let r in this.logger.warn("keywords option as map is deprecated, pass array"),t){let a=t[r];a.keyword||(a.keyword=r),this.addKeyword(a)}}function x(){let t={...this.opts};for(let r of f)delete t[r];return t}_.ValidationError=i.default,_.MissingRefError=n.default,t.default=_;let R={log(){},warn(){},error(){}},P=/^[a-z_$][a-z0-9_$:-]*$/i;function E(t,r){let{RULES:a}=this;if((0,d.eachItem)(t,t=>{if(a.keywords[t])throw Error(`Keyword ${t} is already defined`);if(!P.test(t))throw Error(`Keyword ${t} has invalid name`)}),r&&r.$data&&!("code"in r||"validate"in r))throw Error('$data keyword must have "code" or "validate" function')}function O(t,r,a){var i;let n=null==r?void 0:r.post;if(a&&n)throw Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,s=n?o.post:o.rules.find(({type:t})=>t===a);if(s||(s={type:a,rules:[]},o.rules.push(s)),o.keywords[t]=!0,!r)return;let l={keyword:t,definition:{...r,type:(0,u.getJSONTypes)(r.type),schemaType:(0,u.getJSONTypes)(r.schemaType)}};r.before?T.call(this,s,l,r.before):s.rules.push(l),o.all[t]=l,null==(i=r.implements)||i.forEach(t=>this.addKeyword(t))}function T(t,r,a){let i=t.rules.findIndex(t=>t.keyword===a);i>=0?t.rules.splice(i,0,r):(t.rules.push(r),this.logger.warn(`rule ${a} is not defined`))}function j(t){let{metaSchema:r}=t;void 0!==r&&(t.$data&&this.opts.$data&&(r=C(r)),t.validateSchema=this.compile(r,!0))}let N={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function C(t){return{anyOf:[t,N]}}}),uJ=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}}}),uH=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;let r=uA(),a=uO(),i=ub(),n=u$(),o=uM(),s=uS();function l(t,r){let{gen:a}=t;return r.validate?a.scopeValue("validate",{ref:r.validate}):(0,i._)`${a.scopeValue("wrapper",{ref:r})}.validate`}function c(t,r,o,l){let{gen:c,it:u}=t,{allErrors:d,schemaEnv:p,opts:m}=u,h=m.passContext?n.default.this:i.nil;function f(t){let r=(0,i._)`${t}.errors`;c.assign(n.default.vErrors,(0,i._)`${n.default.vErrors} === null ? ${r} : ${n.default.vErrors}.concat(${r})`),c.assign(n.default.errors,(0,i._)`${n.default.vErrors}.length`)}function y(t){var r;if(!u.opts.unevaluated)return;let a=null==(r=null==o?void 0:o.validate)?void 0:r.evaluated;if(!0!==u.props)if(a&&!a.dynamicProps)void 0!==a.props&&(u.props=s.mergeEvaluated.props(c,a.props,u.props));else{let r=c.var("props",(0,i._)`${t}.evaluated.props`);u.props=s.mergeEvaluated.props(c,r,u.props,i.Name)}if(!0!==u.items)if(a&&!a.dynamicItems)void 0!==a.items&&(u.items=s.mergeEvaluated.items(c,a.items,u.items));else{let r=c.var("items",(0,i._)`${t}.evaluated.items`);u.items=s.mergeEvaluated.items(c,r,u.items,i.Name)}}l?function(){if(!p.$async)throw Error("async schema referenced by sync schema");let n=c.let("valid");c.try(()=>{c.code((0,i._)`await ${(0,a.callValidateCode)(t,r,h)}`),y(r),d||c.assign(n,!0)},t=>{c.if((0,i._)`!(${t} instanceof ${u.ValidationError})`,()=>c.throw(t)),f(t),d||c.assign(n,!1)}),t.ok(n)}():t.result((0,a.callValidateCode)(t,r,h),()=>y(r),()=>f(r))}t.getValidate=l,t.callRef=c,t.default={keyword:"$ref",schemaType:"string",code(t){var a,n;let s,u,d,{gen:p,schema:m,it:h}=t,{baseId:f,schemaEnv:y,validateName:g,opts:v,self:_}=h,{root:b}=y;if(("#"===m||"#/"===m)&&f===b.baseId){if(y===b)return c(t,g,y,y.$async);let r=p.scopeValue("root",{ref:b});return c(t,(0,i._)`${r}.validate`,b,b.$async)}let S=o.resolveRef.call(_,b,f,m);if(void 0===S)throw new r.default(h.opts.uriResolver,f,m);return S instanceof o.SchemaEnv?void c(t,l(t,a=S),a,a.$async):(n=S,s=p.scopeValue("schema",!0===v.code.source?{ref:n,code:(0,i.stringify)(n)}:{ref:n}),u=p.name("valid"),d=t.subschema({schema:n,dataTypes:[],schemaPath:i.nil,topSchemaRef:s,errSchemaPath:m},u),void(t.mergeEvaluated(d),t.ok(u)))}}}),uK=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uJ(),a=uH();t.default=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",r.default,a.default]}),uB=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ub(),a=r.operators,i={maximum:{okStr:"<=",ok:a.LTE,fail:a.GT},minimum:{okStr:">=",ok:a.GTE,fail:a.LT},exclusiveMaximum:{okStr:"<",ok:a.LT,fail:a.GTE},exclusiveMinimum:{okStr:">",ok:a.GT,fail:a.LTE}};t.default={keyword:Object.keys(i),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:a})=>(0,r.str)`must be ${i[t].okStr} ${a}`,params:({keyword:t,schemaCode:a})=>(0,r._)`{comparison: ${i[t].okStr}, limit: ${a}}`},code(t){let{keyword:a,data:n,schemaCode:o}=t;t.fail$data((0,r._)`${n} ${i[a].fail} ${o} || isNaN(${n})`)}}}),uW=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ub();t.default={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:t})=>(0,r.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,r._)`{multipleOf: ${t}}`},code(t){let{gen:a,data:i,schemaCode:n,it:o}=t,s=o.opts.multipleOfPrecision,l=a.let("res"),c=s?(0,r._)`Math.abs(Math.round(${l}) - ${l}) > 1e-${s}`:(0,r._)`${l} !== parseInt(${l})`;t.fail$data((0,r._)`(${n} === 0 || (${l} = ${i}/${n}, ${c}))`)}}}),uG=F(t=>{function r(t){let r,a=t.length,i=0,n=0;for(;n<a;)i++,(r=t.charCodeAt(n++))>=55296&&r<=56319&&n<a&&(64512&(r=t.charCodeAt(n)))==56320&&n++;return i}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,r.code='require("ajv/dist/runtime/ucs2length").default'}),uY=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ub(),a=uS(),i=uG();t.default={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:a})=>(0,r.str)`must NOT have ${"maxLength"===t?"more":"fewer"} than ${a} characters`,params:({schemaCode:t})=>(0,r._)`{limit: ${t}}`},code(t){let{keyword:n,data:o,schemaCode:s,it:l}=t,c="maxLength"===n?r.operators.GT:r.operators.LT,u=!1===l.opts.unicode?(0,r._)`${o}.length`:(0,r._)`${(0,a.useFunc)(t.gen,i.default)}(${o})`;t.fail$data((0,r._)`${u} ${c} ${s}`)}}}),uX=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uO(),a=uS(),i=ub();t.default={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,i.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,i._)`{pattern: ${t}}`},code(t){let{gen:n,data:o,$data:s,schema:l,schemaCode:c,it:u}=t,d=u.opts.unicodeRegExp?"u":"";if(s){let{regExp:r}=u.opts.code,s="new RegExp"===r.code?(0,i._)`new RegExp`:(0,a.useFunc)(n,r),l=n.let("valid");n.try(()=>n.assign(l,(0,i._)`${s}(${c}, ${d}).test(${o})`),()=>n.assign(l,!1)),t.fail$data((0,i._)`!${l}`)}else{let a=(0,r.usePattern)(t,l);t.fail$data((0,i._)`!${a}.test(${o})`)}}}}),uQ=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ub();t.default={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:a})=>(0,r.str)`must NOT have ${"maxProperties"===t?"more":"fewer"} than ${a} properties`,params:({schemaCode:t})=>(0,r._)`{limit: ${t}}`},code(t){let{keyword:a,data:i,schemaCode:n}=t,o="maxProperties"===a?r.operators.GT:r.operators.LT;t.fail$data((0,r._)`Object.keys(${i}).length ${o} ${n}`)}}}),u0=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uO(),a=ub(),i=uS();t.default={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:t}})=>(0,a.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,a._)`{missingProperty: ${t}}`},code(t){let{gen:n,schema:o,schemaCode:s,data:l,$data:c,it:u}=t,{opts:d}=u;if(!c&&0===o.length)return;let p=o.length>=d.loopRequired;if(u.allErrors?function(){if(p||c)t.block$data(a.nil,m);else for(let a of o)(0,r.checkReportMissingProp)(t,a)}():function(){let i=n.let("missing");if(p||c){let o=n.let("valid",!0);t.block$data(o,()=>{var c,u;return c=i,u=o,void(t.setParams({missingProperty:c}),n.forOf(c,s,()=>{n.assign(u,(0,r.propertyInData)(n,l,c,d.ownProperties)),n.if((0,a.not)(u),()=>{t.error(),n.break()})},a.nil))}),t.ok(o)}else n.if((0,r.checkMissingProp)(t,o,i)),(0,r.reportMissingProp)(t,i),n.else()}(),d.strictRequired){let r=t.parentSchema.properties,{definedProperties:a}=t.it;for(let t of o)if((null==r?void 0:r[t])===void 0&&!a.has(t)){let r=`required property "${t}" is not defined at "${u.schemaEnv.baseId+u.errSchemaPath}" (strictRequired)`;(0,i.checkStrictMode)(u,r,u.opts.strictRequired)}}function m(){n.forOf("prop",s,a=>{t.setParams({missingProperty:a}),n.if((0,r.noPropertyInData)(n,l,a,d.ownProperties),()=>t.error())})}}}}),u1=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ub();t.default={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:a})=>(0,r.str)`must NOT have ${"maxItems"===t?"more":"fewer"} than ${a} items`,params:({schemaCode:t})=>(0,r._)`{limit: ${t}}`},code(t){let{keyword:a,data:i,schemaCode:n}=t,o="maxItems"===a?r.operators.GT:r.operators.LT;t.fail$data((0,r._)`${i}.length ${o} ${n}`)}}}),u2=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uN();r.code='require("ajv/dist/runtime/equal").default',t.default=r}),u9=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uP(),a=ub(),i=uS(),n=u2();t.default={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:t,j:r}})=>(0,a.str)`must NOT have duplicate items (items ## ${r} and ${t} are identical)`,params:({params:{i:t,j:r}})=>(0,a._)`{i: ${t}, j: ${r}}`},code(t){let{gen:o,data:s,$data:l,schema:c,parentSchema:u,schemaCode:d,it:p}=t;if(!l&&!c)return;let m=o.let("valid"),h=u.items?(0,r.getSchemaTypes)(u.items):[];t.block$data(m,function(){let l=o.let("i",(0,a._)`${s}.length`),c=o.let("j");t.setParams({i:l,j:c}),o.assign(m,!0),o.if((0,a._)`${l} > 1`,()=>(h.length>0&&!h.some(t=>"object"===t||"array"===t)?function(i,n){let l=o.name("item"),c=(0,r.checkDataTypes)(h,l,p.opts.strictNumbers,r.DataType.Wrong),u=o.const("indices",(0,a._)`{}`);o.for((0,a._)`;${i}--;`,()=>{o.let(l,(0,a._)`${s}[${i}]`),o.if(c,(0,a._)`continue`),h.length>1&&o.if((0,a._)`typeof ${l} == "string"`,(0,a._)`${l} += "_"`),o.if((0,a._)`typeof ${u}[${l}] == "number"`,()=>{o.assign(n,(0,a._)`${u}[${l}]`),t.error(),o.assign(m,!1).break()}).code((0,a._)`${u}[${l}] = ${i}`)})}:function(r,l){let c=(0,i.useFunc)(o,n.default),u=o.name("outer");o.label(u).for((0,a._)`;${r}--;`,()=>o.for((0,a._)`${l} = ${r}; ${l}--;`,()=>o.if((0,a._)`${c}(${s}[${r}], ${s}[${l}])`,()=>{t.error(),o.assign(m,!1).break(u)})))})(l,c))},(0,a._)`${d} === false`),t.ok(m)}}}),u4=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ub(),a=uS(),i=u2();t.default={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:t})=>(0,r._)`{allowedValue: ${t}}`},code(t){let{gen:n,data:o,$data:s,schemaCode:l,schema:c}=t;s||c&&"object"==typeof c?t.fail$data((0,r._)`!${(0,a.useFunc)(n,i.default)}(${o}, ${l})`):t.fail((0,r._)`${c} !== ${o}`)}}}),u6=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ub(),a=uS(),i=u2();t.default={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,r._)`{allowedValues: ${t}}`},code(t){let n,o,{gen:s,data:l,$data:c,schema:u,schemaCode:d,it:p}=t;if(!c&&0===u.length)throw Error("enum must have non-empty array");let m=u.length>=p.opts.loopEnum,h=()=>null!=n?n:n=(0,a.useFunc)(s,i.default);if(m||c)o=s.let("valid"),t.block$data(o,function(){s.assign(o,!1),s.forOf("v",d,t=>s.if((0,r._)`${h()}(${l}, ${t})`,()=>s.assign(o,!0).break()))});else{if(!Array.isArray(u))throw Error("ajv implementation error");let t=s.const("vSchema",d);o=(0,r.or)(...u.map((a,i)=>{var n,o;let s;return n=t,"object"==typeof(s=u[o=i])&&null!==s?(0,r._)`${h()}(${l}, ${n}[${o}])`:(0,r._)`${l} === ${s}`}))}t.pass(o)}}}),u3=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uB(),a=uW(),i=uY(),n=uX(),o=uQ(),s=u0(),l=u1(),c=u9(),u=u4(),d=u6();t.default=[r.default,a.default,i.default,n.default,o.default,s.default,l.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,d.default]}),u5=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;let r=ub(),a=uS();function i(t,i){let{gen:n,schema:o,data:s,keyword:l,it:c}=t;c.items=!0;let u=n.const("len",(0,r._)`${s}.length`);if(!1===o)t.setParams({len:i.length}),t.pass((0,r._)`${u} <= ${i.length}`);else if("object"==typeof o&&!(0,a.alwaysValidSchema)(c,o)){let o=n.var("valid",(0,r._)`${u} <= ${i.length}`);n.if((0,r.not)(o),()=>{var s;return s=o,void n.forRange("i",i.length,u,i=>{t.subschema({keyword:l,dataProp:i,dataPropType:a.Type.Num},s),c.allErrors||n.if((0,r.not)(s),()=>n.break())})}),t.ok(o)}}t.validateAdditionalItems=i,t.default={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,r.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,r._)`{limit: ${t}}`},code(t){let{parentSchema:r,it:n}=t,{items:o}=r;Array.isArray(o)?i(t,o):(0,a.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas')}}}),u8=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;let r=ub(),a=uS(),i=uO();function n(t,i,o=t.schema){let{gen:s,parentSchema:l,data:c,keyword:u,it:d}=t;(function(t){let{opts:r,errSchemaPath:n}=d,s=o.length,l=s===t.minItems&&(s===t.maxItems||!1===t[i]);if(r.strictTuples&&!l){let t=`"${u}" is ${s}-tuple, but minItems or maxItems/${i} are not specified or different at path "${n}"`;(0,a.checkStrictMode)(d,t,r.strictTuples)}})(l),d.opts.unevaluated&&o.length&&!0!==d.items&&(d.items=a.mergeEvaluated.items(s,o.length,d.items));let p=s.name("valid"),m=s.const("len",(0,r._)`${c}.length`);o.forEach((i,n)=>{(0,a.alwaysValidSchema)(d,i)||(s.if((0,r._)`${m} > ${n}`,()=>t.subschema({keyword:u,schemaProp:n,dataProp:n},p)),t.ok(p))})}t.validateTuple=n,t.default={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:r,it:o}=t;if(Array.isArray(r))return n(t,"additionalItems",r);o.items=!0,(0,a.alwaysValidSchema)(o,r)||t.ok((0,i.validateArray)(t))}}}),u7=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u8();t.default={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,r.validateTuple)(t,"items")}}),de=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ub(),a=uS(),i=uO(),n=u5();t.default={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,r.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,r._)`{limit: ${t}}`},code(t){let{schema:r,parentSchema:o,it:s}=t,{prefixItems:l}=o;s.items=!0,(0,a.alwaysValidSchema)(s,r)||(l?(0,n.validateAdditionalItems)(t,l):t.ok((0,i.validateArray)(t)))}}}),dt=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ub(),a=uS();t.default={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:t,max:a}})=>void 0===a?(0,r.str)`must contain at least ${t} valid item(s)`:(0,r.str)`must contain at least ${t} and no more than ${a} valid item(s)`,params:({params:{min:t,max:a}})=>void 0===a?(0,r._)`{minContains: ${t}}`:(0,r._)`{minContains: ${t}, maxContains: ${a}}`},code(t){let i,n,{gen:o,schema:s,parentSchema:l,data:c,it:u}=t,{minContains:d,maxContains:p}=l;u.opts.next?(i=void 0===d?1:d,n=p):i=1;let m=o.const("len",(0,r._)`${c}.length`);if(t.setParams({min:i,max:n}),void 0===n&&0===i)return void(0,a.checkStrictMode)(u,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==n&&i>n){(0,a.checkStrictMode)(u,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,a.alwaysValidSchema)(u,s)){let a=(0,r._)`${m} >= ${i}`;void 0!==n&&(a=(0,r._)`${a} && ${m} <= ${n}`),t.pass(a);return}u.items=!0;let h=o.name("valid");function f(){let t=o.name("_valid"),a=o.let("count",0);y(t,()=>o.if(t,()=>{var t;return t=a,void(o.code((0,r._)`${t}++`),void 0===n?o.if((0,r._)`${t} >= ${i}`,()=>o.assign(h,!0).break()):(o.if((0,r._)`${t} > ${n}`,()=>o.assign(h,!1).break()),1===i?o.assign(h,!0):o.if((0,r._)`${t} >= ${i}`,()=>o.assign(h,!0))))}))}function y(r,i){o.forRange("i",0,m,n=>{t.subschema({keyword:"contains",dataProp:n,dataPropType:a.Type.Num,compositeRule:!0},r),i()})}void 0===n&&1===i?y(h,()=>o.if(h,()=>o.break())):0===i?(o.let(h,!0),void 0!==n&&o.if((0,r._)`${c}.length > 0`,f)):(o.let(h,!1),f()),t.result(h,()=>t.reset())}}}),dr=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;let r=ub(),a=uS(),i=uO();t.error={message:({params:{property:t,depsCount:a,deps:i}})=>(0,r.str)`must have ${1===a?"property":"properties"} ${i} when property ${t} is present`,params:({params:{property:t,depsCount:a,deps:i,missingProperty:n}})=>(0,r._)`{property: ${t},
|
|
58
|
+
|| ${l} === "boolean" || ${n} === null`).assign(c,(0,s._)`[${n}]`)}}(t);i.else(),h(t),i.endIf(),i.if((0,s._)`${c} !== undefined`,()=>{i.assign(n,c),function({gen:t,parentData:r,parentDataProperty:a},i){t.if((0,s._)`${r} !== undefined`,()=>t.assign((0,s._)`${r}[${a}]`,i))}(t,c)})}(t,a,m):h(t)})}return f};let u=new Set(["string","number","integer","boolean","null"]);function d(t,a,i,n=r.Correct){let o,l=n===r.Correct?s.operators.EQ:s.operators.NEQ;switch(t){case"null":return(0,s._)`${a} ${l} null`;case"array":o=(0,s._)`Array.isArray(${a})`;break;case"object":o=(0,s._)`${a} && typeof ${a} == "object" && !Array.isArray(${a})`;break;case"integer":o=c((0,s._)`!(${a} % 1) && !isNaN(${a})`);break;case"number":o=c();break;default:return(0,s._)`typeof ${a} ${l} ${t}`}return n===r.Correct?o:(0,s.not)(o);function c(t=s.nil){return(0,s.and)((0,s._)`typeof ${a} == "number"`,t,i?(0,s._)`isFinite(${a})`:s.nil)}}function p(t,r,a,i){let n;if(1===t.length)return d(t[0],r,a,i);let o=(0,l.toHash)(t);if(o.array&&o.object){let t=(0,s._)`typeof ${r} != "object"`;n=o.null?t:(0,s._)`!${r} || ${t}`,delete o.null,delete o.array,delete o.object}else n=s.nil;for(let t in o.number&&delete o.integer,o)n=(0,s.and)(n,d(t,r,a,i));return n}t.checkDataType=d,t.checkDataTypes=p;let m={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:r})=>"string"==typeof t?(0,s._)`{type: ${t}}`:(0,s._)`{type: ${r}}`};function h(t){let r=function(t){let{gen:r,data:a,schema:i}=t,n=(0,l.schemaRefOrVal)(t,i,"type");return{gen:r,keyword:"type",data:a,schema:i.type,schemaCode:n,schemaValue:n,parentSchema:i,params:{},it:t}}(t);(0,o.reportError)(r,m)}t.reportTypeError=h}),uP=V(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;let r=u_(),a=ub();function i(t,i,n){let{gen:o,compositeRule:s,data:l,opts:c}=t;if(void 0===n)return;let u=(0,r._)`${l}${(0,r.getProperty)(i)}`;if(s)return void(0,a.checkStrictMode)(t,`default is ignored for: ${u}`);let d=(0,r._)`${u} === undefined`;"empty"===c.useDefaults&&(d=(0,r._)`${d} || ${u} === null || ${u} === ""`),o.if(d,(0,r._)`${u} = ${(0,r.stringify)(n)}`)}t.assignDefaults=function(t,r){let{properties:a,items:n}=t.schema;if("object"===r&&a)for(let r in a)i(t,r,a[r].default);else"array"===r&&Array.isArray(n)&&n.forEach((r,a)=>i(t,a,r.default))}}),uE=V(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateUnion=t.validateArray=t.usePattern=t.callValidateCode=t.schemaProperties=t.allSchemaProperties=t.noPropertyInData=t.propertyInData=t.isOwnProperty=t.hasPropFunc=t.reportMissingProp=t.checkMissingProp=t.checkReportMissingProp=void 0;let r=u_(),a=ub(),i=uS(),n=ub();function o(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,r._)`Object.prototype.hasOwnProperty`})}function s(t,a,i){return(0,r._)`${o(t)}.call(${a}, ${i})`}function l(t,a,i,n){let o=(0,r._)`${a}${(0,r.getProperty)(i)} === undefined`;return n?(0,r.or)(o,(0,r.not)(s(t,a,i))):o}function c(t){return t?Object.keys(t).filter(t=>"__proto__"!==t):[]}t.checkReportMissingProp=function(t,a){let{gen:i,data:n,it:o}=t;i.if(l(i,n,a,o.opts.ownProperties),()=>{t.setParams({missingProperty:(0,r._)`${a}`},!0),t.error()})},t.checkMissingProp=function({gen:t,data:a,it:{opts:i}},n,o){return(0,r.or)(...n.map(n=>(0,r.and)(l(t,a,n,i.ownProperties),(0,r._)`${o} = ${n}`)))},t.reportMissingProp=function(t,r){t.setParams({missingProperty:r},!0),t.error()},t.hasPropFunc=o,t.isOwnProperty=s,t.propertyInData=function(t,a,i,n){let o=(0,r._)`${a}${(0,r.getProperty)(i)} !== undefined`;return n?(0,r._)`${o} && ${s(t,a,i)}`:o},t.noPropertyInData=l,t.allSchemaProperties=c,t.schemaProperties=function(t,r){return c(r).filter(i=>!(0,a.alwaysValidSchema)(t,r[i]))},t.callValidateCode=function({schemaCode:t,data:a,it:{gen:n,topSchemaRef:o,schemaPath:s,errorPath:l},it:c},u,d,p){let m=p?(0,r._)`${t}, ${a}, ${o}${s}`:a,h=[[i.default.instancePath,(0,r.strConcat)(i.default.instancePath,l)],[i.default.parentData,c.parentData],[i.default.parentDataProperty,c.parentDataProperty],[i.default.rootData,i.default.rootData]];c.opts.dynamicRef&&h.push([i.default.dynamicAnchors,i.default.dynamicAnchors]);let f=(0,r._)`${m}, ${n.object(...h)}`;return d!==r.nil?(0,r._)`${u}.call(${d}, ${f})`:(0,r._)`${u}(${f})`};let u=(0,r._)`new RegExp`;t.usePattern=function({gen:t,it:{opts:a}},i){let o=a.unicodeRegExp?"u":"",{regExp:s}=a.code,l=s(i,o);return t.scopeValue("pattern",{key:l.toString(),ref:l,code:(0,r._)`${"new RegExp"===s.code?u:(0,n.useFunc)(t,s)}(${i}, ${o})`})},t.validateArray=function(t){let{gen:i,data:n,keyword:o,it:s}=t,l=i.name("valid");if(s.allErrors){let t=i.let("valid",!0);return c(()=>i.assign(t,!1)),t}return i.var(l,!0),c(()=>i.break()),l;function c(s){let c=i.const("len",(0,r._)`${n}.length`);i.forRange("i",0,c,n=>{t.subschema({keyword:o,dataProp:n,dataPropType:a.Type.Num},l),i.if((0,r.not)(l),s)})}},t.validateUnion=function(t){let{gen:i,schema:n,keyword:o,it:s}=t;if(!Array.isArray(n))throw Error("ajv implementation error");if(n.some(t=>(0,a.alwaysValidSchema)(s,t))&&!s.opts.unevaluated)return;let l=i.let("valid",!1),c=i.name("_valid");i.block(()=>n.forEach((a,n)=>{let s=t.subschema({keyword:o,schemaProp:n,compositeRule:!0},c);i.assign(l,(0,r._)`${l} || ${c}`),t.mergeValidEvaluated(s,c)||i.if((0,r.not)(l))})),t.result(l,()=>t.reset(),()=>t.error(!0))}}),uj=V(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;let r=u_(),a=uS(),i=uE(),n=u$();function o(t){let{gen:a,data:i,it:n}=t;a.if(n.parentData,()=>a.assign(i,(0,r._)`${n.parentData}[${n.parentDataProperty}]`))}function s(t,a,i){if(void 0===i)throw Error(`keyword "${a}" failed to compile`);return t.scopeValue("keyword","function"==typeof i?{ref:i}:{ref:i,code:(0,r.stringify)(i)})}t.macroKeywordCode=function(t,a){let{gen:i,keyword:n,schema:o,parentSchema:l,it:c}=t,u=a.macro.call(c.self,o,l,c),d=s(i,n,u);!1!==c.opts.validateSchema&&c.self.validateSchema(u,!0);let p=i.name("valid");t.subschema({schema:u,schemaPath:r.nil,errSchemaPath:`${c.errSchemaPath}/${n}`,topSchemaRef:d,compositeRule:!0},p),t.pass(p,()=>t.error(!0))},t.funcKeywordCode=function(t,l){var c;let{gen:u,keyword:d,schema:p,parentSchema:m,$data:h,it:f}=t;!function({schemaEnv:t},r){if(r.async&&!t.$async)throw Error("async keyword in sync schema")}(f,l);let y=s(u,d,!h&&l.compile?l.compile.call(f.self,p,m,f):l.validate),g=u.let("valid");function v(n=l.async?(0,r._)`await `:r.nil){let o=f.opts.passContext?a.default.this:a.default.self,s=!("compile"in l&&!h||!1===l.schema);u.assign(g,(0,r._)`${n}${(0,i.callValidateCode)(t,y,o,s)}`,l.modifying)}function _(t){var a;u.if((0,r.not)(null!=(a=l.valid)?a:g),t)}t.block$data(g,function(){if(!1===l.errors)v(),l.modifying&&o(t),_(()=>t.error());else{let i,s,c=l.async?(i=u.let("ruleErrs",null),u.try(()=>v((0,r._)`await `),t=>u.assign(g,!1).if((0,r._)`${t} instanceof ${f.ValidationError}`,()=>u.assign(i,(0,r._)`${t}.errors`),()=>u.throw(t))),i):(s=(0,r._)`${y}.errors`,u.assign(s,null),v(r.nil),s);l.modifying&&o(t),_(()=>(function(t,i){let{gen:o}=t;o.if((0,r._)`Array.isArray(${i})`,()=>{o.assign(a.default.vErrors,(0,r._)`${a.default.vErrors} === null ? ${i} : ${a.default.vErrors}.concat(${i})`).assign(a.default.errors,(0,r._)`${a.default.vErrors}.length`),(0,n.extendErrors)(t)},()=>t.error())})(t,c))}}),t.ok(null!=(c=l.valid)?c:g)},t.validSchemaType=function(t,r,a=!1){return!r.length||r.some(r=>"array"===r?Array.isArray(t):"object"===r?t&&"object"==typeof t&&!Array.isArray(t):typeof t==r||a&&void 0===t)},t.validateKeywordUsage=function({schema:t,opts:r,self:a,errSchemaPath:i},n,o){if(Array.isArray(n.keyword)?!n.keyword.includes(o):n.keyword!==o)throw Error("ajv implementation error");let s=n.dependencies;if(null==s?void 0:s.some(r=>!Object.prototype.hasOwnProperty.call(t,r)))throw Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(n.validateSchema&&!n.validateSchema(t[o])){let t=`keyword "${o}" value is invalid at path "${i}": `+a.errorsText(n.validateSchema.errors);if("log"===r.validateSchema)a.logger.error(t);else throw Error(t)}}}),uT=V(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;let r=u_(),a=ub();t.getSubschema=function(t,{keyword:i,schemaProp:n,schema:o,schemaPath:s,errSchemaPath:l,topSchemaRef:c}){if(void 0!==i&&void 0!==o)throw Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==i){let o=t.schema[i];return void 0===n?{schema:o,schemaPath:(0,r._)`${t.schemaPath}${(0,r.getProperty)(i)}`,errSchemaPath:`${t.errSchemaPath}/${i}`}:{schema:o[n],schemaPath:(0,r._)`${t.schemaPath}${(0,r.getProperty)(i)}${(0,r.getProperty)(n)}`,errSchemaPath:`${t.errSchemaPath}/${i}/${(0,a.escapeFragment)(n)}`}}if(void 0!==o){if(void 0===s||void 0===l||void 0===c)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:s,topSchemaRef:c,errSchemaPath:l}}throw Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(t,i,{dataProp:n,dataPropType:o,data:s,dataTypes:l,propertyName:c}){if(void 0!==s&&void 0!==n)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:u}=i;if(void 0!==n){let{errorPath:s,dataPathArr:l,opts:c}=i;d(u.let("data",(0,r._)`${i.data}${(0,r.getProperty)(n)}`,!0)),t.errorPath=(0,r.str)`${s}${(0,a.getErrorPath)(n,o,c.jsPropertySyntax)}`,t.parentDataProperty=(0,r._)`${n}`,t.dataPathArr=[...l,t.parentDataProperty]}function d(r){t.data=r,t.dataLevel=i.dataLevel+1,t.dataTypes=[],i.definedProperties=new Set,t.parentData=i.data,t.dataNames=[...i.dataNames,r]}void 0!==s&&(d(s instanceof r.Name?s:u.let("data",s,!0)),void 0!==c&&(t.propertyName=c)),l&&(t.dataTypes=l)},t.extendSubschemaMode=function(t,{jtdDiscriminator:r,jtdMetadata:a,compositeRule:i,createErrors:n,allErrors:o}){void 0!==i&&(t.compositeRule=i),void 0!==n&&(t.createErrors=n),void 0!==o&&(t.allErrors=o),t.jtdDiscriminator=r,t.jtdMetadata=a}}),uO=V((t,r)=>{r.exports=function t(r,a){if(r===a)return!0;if(r&&a&&"object"==typeof r&&"object"==typeof a){if(r.constructor!==a.constructor)return!1;if(Array.isArray(r)){if((i=r.length)!=a.length)return!1;for(n=i;0!=n--;)if(!t(r[n],a[n]))return!1;return!0}if(r.constructor===RegExp)return r.source===a.source&&r.flags===a.flags;if(r.valueOf!==Object.prototype.valueOf)return r.valueOf()===a.valueOf();if(r.toString!==Object.prototype.toString)return r.toString()===a.toString();if((i=(o=Object.keys(r)).length)!==Object.keys(a).length)return!1;for(n=i;0!=n--;)if(!Object.prototype.hasOwnProperty.call(a,o[n]))return!1;for(n=i;0!=n--;){var i,n,o,s=o[n];if(!t(r[s],a[s]))return!1}return!0}return r!=r&&a!=a}}),uC=V((t,r)=>{var a=r.exports=function(t,r,i){"function"==typeof r&&(i=r,r={});var n="function"==typeof(i=r.cb||i)?i:i.pre||function(){};!function t(r,i,n,o,s,l,c,u,d,p){if(o&&"object"==typeof o&&!Array.isArray(o)){for(var m in i(o,s,l,c,u,d,p),o){var h=o[m];if(Array.isArray(h)){if(m in a.arrayKeywords)for(var f=0;f<h.length;f++)t(r,i,n,h[f],s+"/"+m+"/"+f,l,s,m,o,f)}else if(m in a.propsKeywords){if(h&&"object"==typeof h)for(var y in h)t(r,i,n,h[y],s+"/"+m+"/"+y.replace(/~/g,"~0").replace(/\//g,"~1"),l,s,m,o,y)}else(m in a.keywords||r.allKeys&&!(m in a.skipKeywords))&&t(r,i,n,h,s+"/"+m,l,s,m,o)}n(o,s,l,c,u,d,p)}}(r,n,i.post||function(){},t,"",t)};a.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},a.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},a.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},a.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0}}),uN=V(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;let r=ub(),a=uO(),i=uC(),n=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);t.inlineRef=function(t,a=!0){return"boolean"==typeof t||(!0===a?!function t(r){for(let a in r){if(o.has(a))return!0;let i=r[a];if(Array.isArray(i)&&i.some(t)||"object"==typeof i&&t(i))return!0}return!1}(t):!!a&&function t(a){let i=0;for(let o in a)if("$ref"===o||(i++,!n.has(o)&&("object"==typeof a[o]&&(0,r.eachItem)(a[o],r=>i+=t(r)),i===1/0)))return 1/0;return i}(t)<=a)};let o=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function s(t,r="",a){return!1!==a&&(r=u(r)),l(t,t.parse(r))}function l(t,r){return t.serialize(r).split("#")[0]+"#"}t.getFullPath=s,t._getFullPath=l;let c=/#\/?$/;function u(t){return t?t.replace(c,""):""}t.normalizeId=u,t.resolveUrl=function(t,r,a){return a=u(a),t.resolve(r,a)};let d=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(t,r){if("boolean"==typeof t)return{};let{schemaId:n,uriResolver:o}=this.opts,l=u(t[n]||r),c={"":l},p=s(o,l,!1),m={},h=new Set;return i(t,{allKeys:!0},(t,r,a,i)=>{if(void 0===i)return;let o=p+r,s=c[i];function l(r){let a=this.opts.uriResolver.resolve;if(r=u(s?a(s,r):r),h.has(r))throw y(r);h.add(r);let i=this.refs[r];return"string"==typeof i&&(i=this.refs[i]),"object"==typeof i?f(t,i.schema,r):r!==u(o)&&("#"===r[0]?(f(t,m[r],r),m[r]=t):this.refs[r]=o),r}function g(t){if("string"==typeof t){if(!d.test(t))throw Error(`invalid anchor "${t}"`);l.call(this,`#${t}`)}}"string"==typeof t[n]&&(s=l.call(this,t[n])),g.call(this,t.$anchor),g.call(this,t.$dynamicAnchor),c[r]=s}),m;function f(t,r,i){if(void 0!==r&&!a(t,r))throw y(i)}function y(t){return Error(`reference "${t}" resolves to more than one schema`)}}}),uI=V(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;let r=uw(),a=uR(),i=ux(),n=uR(),o=uP(),s=uj(),l=uT(),c=u_(),u=uS(),d=uN(),p=ub(),m=u$();function h({gen:t,validateName:r,schema:a,schemaEnv:i,opts:n},o){var s;n.code.es5?t.func(r,(0,c._)`${u.default.data}, ${u.default.valCxt}`,i.$async,()=>{var r,i;t.code((0,c._)`"use strict"; ${f(a,n)}`),r=t,i=n,r.if(u.default.valCxt,()=>{r.var(u.default.instancePath,(0,c._)`${u.default.valCxt}.${u.default.instancePath}`),r.var(u.default.parentData,(0,c._)`${u.default.valCxt}.${u.default.parentData}`),r.var(u.default.parentDataProperty,(0,c._)`${u.default.valCxt}.${u.default.parentDataProperty}`),r.var(u.default.rootData,(0,c._)`${u.default.valCxt}.${u.default.rootData}`),i.dynamicRef&&r.var(u.default.dynamicAnchors,(0,c._)`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{r.var(u.default.instancePath,(0,c._)`""`),r.var(u.default.parentData,(0,c._)`undefined`),r.var(u.default.parentDataProperty,(0,c._)`undefined`),r.var(u.default.rootData,u.default.data),i.dynamicRef&&r.var(u.default.dynamicAnchors,(0,c._)`{}`)}),t.code(o)}):t.func(r,(0,c._)`${u.default.data}, ${(s=n,(0,c._)`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${s.dynamicRef?(0,c._)`, ${u.default.dynamicAnchors}={}`:c.nil}}={}`)}`,i.$async,()=>t.code(f(a,n)).code(o))}function f(t,r){let a="object"==typeof t&&t[r.schemaId];return a&&(r.code.source||r.code.process)?(0,c._)`/*# sourceURL=${a} */`:c.nil}function y({schema:t,self:r}){if("boolean"==typeof t)return!t;for(let a in t)if(r.RULES.all[a])return!0;return!1}function g(t){return"boolean"!=typeof t.schema}function v(t){(0,p.checkUnknownRules)(t),function(t){let{schema:r,errSchemaPath:a,opts:i,self:n}=t;r.$ref&&i.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(r,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${a}"`)}(t)}function _(t,r){if(t.opts.jtd)return S(t,[],!1,r);let i=(0,a.getSchemaTypes)(t.schema);S(t,i,!(0,a.coerceAndCheckDataType)(t,i),r)}function b({gen:t,schemaEnv:r,schema:a,errSchemaPath:i,opts:n}){let o=a.$comment;if(!0===n.$comment)t.code((0,c._)`${u.default.self}.logger.log(${o})`);else if("function"==typeof n.$comment){let a=(0,c.str)`${i}/$comment`,n=t.scopeValue("root",{ref:r.root});t.code((0,c._)`${u.default.self}.opts.$comment(${o}, ${a}, ${n}.schema)`)}}function S(t,r,a,o){var s,l,d,m;let{gen:h,schema:f,data:y,allErrors:g,opts:v,self:_}=t,{RULES:b}=_;if(f.$ref&&(v.ignoreKeywordsWithRef||!(0,p.schemaHasRulesButRef)(f,b)))return void h.block(()=>R(t,"$ref",b.all.$ref.definition));function S(s){(0,i.shouldUseGroup)(f,s)&&(s.type?(h.if((0,n.checkDataType)(s.type,y,v.strictNumbers)),$(t,s),1===r.length&&r[0]===s.type&&a&&(h.else(),(0,n.reportTypeError)(t)),h.endIf()):$(t,s),g||h.if((0,c._)`${u.default.errors} === ${o||0}`))}v.jtd||(s=t,l=r,!s.schemaEnv.meta&&s.opts.strictTypes&&(function(t,r){if(r.length){if(!t.dataTypes.length){t.dataTypes=r;return}r.forEach(r=>{w(t.dataTypes,r)||k(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),function(t,r){let a=[];for(let i of t.dataTypes)w(r,i)?a.push(i):r.includes("integer")&&"number"===i&&a.push("integer");t.dataTypes=a}(t,r)}}(s,l),s.opts.allowUnionTypes||(d=s,(m=l).length>1&&!(2===m.length&&m.includes("null"))&&k(d,"use allowUnionTypes to allow union type keyword")),function(t,r){let a=t.self.RULES.all;for(let n in a){let o=a[n];if("object"==typeof o&&(0,i.shouldUseRule)(t.schema,o)){let{type:a}=o.definition;a.length&&!a.some(t=>{var a,i;return a=r,i=t,a.includes(i)||"number"===i&&a.includes("integer")})&&k(t,`missing type "${a.join(",")}" for keyword "${n}"`)}}}(s,s.dataTypes))),h.block(()=>{for(let t of b.rules)S(t);S(b.post)})}function $(t,r){let{gen:a,schema:n,opts:{useDefaults:s}}=t;s&&(0,o.assignDefaults)(t,r.type),a.block(()=>{for(let a of r.rules)(0,i.shouldUseRule)(n,a)&&R(t,a.keyword,a.definition,r.type)})}function w(t,r){return t.includes(r)||"integer"===r&&t.includes("number")}function k(t,r){let a=t.schemaEnv.baseId+t.errSchemaPath;r+=` at "${a}" (strictTypes)`,(0,p.checkStrictMode)(t,r,t.opts.strictTypes)}t.validateFunctionCode=function(t){g(t)&&(v(t),y(t))?function(t){let{schema:r,opts:a,gen:i}=t;h(t,()=>{a.$comment&&r.$comment&&b(t),function(t){let{schema:r,opts:a}=t;void 0!==r.default&&a.useDefaults&&a.strictSchema&&(0,p.checkStrictMode)(t,"default is ignored in the schema root")}(t),i.let(u.default.vErrors,null),i.let(u.default.errors,0),a.unevaluated&&function(t){let{gen:r,validateName:a}=t;t.evaluated=r.const("evaluated",(0,c._)`${a}.evaluated`),r.if((0,c._)`${t.evaluated}.dynamicProps`,()=>r.assign((0,c._)`${t.evaluated}.props`,(0,c._)`undefined`)),r.if((0,c._)`${t.evaluated}.dynamicItems`,()=>r.assign((0,c._)`${t.evaluated}.items`,(0,c._)`undefined`))}(t),_(t),function(t){let{gen:r,schemaEnv:a,validateName:i,ValidationError:n,opts:o}=t;a.$async?r.if((0,c._)`${u.default.errors} === 0`,()=>r.return(u.default.data),()=>r.throw((0,c._)`new ${n}(${u.default.vErrors})`)):(r.assign((0,c._)`${i}.errors`,u.default.vErrors),o.unevaluated&&function({gen:t,evaluated:r,props:a,items:i}){a instanceof c.Name&&t.assign((0,c._)`${r}.props`,a),i instanceof c.Name&&t.assign((0,c._)`${r}.items`,i)}(t),r.return((0,c._)`${u.default.errors} === 0`))}(t)})}(t):h(t,()=>(0,r.topBoolOrEmptySchema)(t))};var x=class{constructor(t,r,a){if((0,s.validateKeywordUsage)(t,r,a),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=a,this.data=t.data,this.schema=t.schema[a],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,p.schemaRefOrVal)(t,this.schema,a,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",j(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,s.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw Error(`${a} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:!1!==r.errors)&&(this.errsCount=t.gen.const("_errs",u.default.errors))}result(t,r,a){this.failResult((0,c.not)(t),r,a)}failResult(t,r,a){this.gen.if(t),a?a():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,c.not)(t),void 0,r)}fail(t){if(void 0===t){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,c._)`${r} !== undefined && (${(0,c.or)(this.invalid$data(),t)})`)}error(t,r,a){if(r){this.setParams(r),this._error(t,a),this.setParams({});return}this._error(t,a)}_error(t,r){(t?m.reportExtraError:m.reportError)(this,this.def.error,r)}$dataError(){(0,m.reportError)(this,this.def.$dataError||m.keyword$DataError)}reset(){if(void 0===this.errsCount)throw Error('add "trackErrors" to keyword definition');(0,m.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,a=c.nil){this.gen.block(()=>{this.check$data(t,a),r()})}check$data(t=c.nil,r=c.nil){if(!this.$data)return;let{gen:a,schemaCode:i,schemaType:n,def:o}=this;a.if((0,c.or)((0,c._)`${i} === undefined`,r)),t!==c.nil&&a.assign(t,!0),(n.length||o.validateSchema)&&(a.elseIf(this.invalid$data()),this.$dataError(),t!==c.nil&&a.assign(t,!1)),a.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:a,def:i,it:o}=this;return(0,c.or)(function(){if(a.length){if(!(r instanceof c.Name))throw Error("ajv implementation error");let t=Array.isArray(a)?a:[a];return(0,c._)`${(0,n.checkDataTypes)(t,r,o.opts.strictNumbers,n.DataType.Wrong)}`}return c.nil}(),function(){if(i.validateSchema){let a=t.scopeValue("validate$data",{ref:i.validateSchema});return(0,c._)`!${a}(${r})`}return c.nil}())}subschema(t,a){let i=(0,l.getSubschema)(this.it,t);(0,l.extendSubschemaData)(i,this.it,t),(0,l.extendSubschemaMode)(i,t);let n={...this.it,...i,items:void 0,props:void 0};return!function(t,a){if(g(t)&&(v(t),y(t)))return function(t,r){var a;let i,{schema:n,gen:o,opts:s}=t;s.$comment&&n.$comment&&b(t),(i=(a=t).schema[a.opts.schemaId])&&(a.baseId=(0,d.resolveUrl)(a.opts.uriResolver,a.baseId,i)),function(t){if(t.schema.$async&&!t.schemaEnv.$async)throw Error("async schema in sync schema")}(t);let l=o.const("_errs",u.default.errors);_(t,l),o.var(r,(0,c._)`${l} === ${u.default.errors}`)}(t,a);(0,r.boolOrEmptySchema)(t,a)}(n,a),n}mergeEvaluated(t,r){let{it:a,gen:i}=this;a.opts.unevaluated&&(!0!==a.props&&void 0!==t.props&&(a.props=p.mergeEvaluated.props(i,t.props,a.props,r)),!0!==a.items&&void 0!==t.items&&(a.items=p.mergeEvaluated.items(i,t.items,a.items,r)))}mergeValidEvaluated(t,r){let{it:a,gen:i}=this;if(a.opts.unevaluated&&(!0!==a.props||!0!==a.items))return i.if(r,()=>this.mergeEvaluated(t,c.Name)),!0}};function R(t,r,a,i){let n=new x(t,a,r);"code"in a?a.code(n,i):n.$data&&a.validate?(0,s.funcKeywordCode)(n,a):"macro"in a?(0,s.macroKeywordCode)(n,a):(a.compile||a.validate)&&(0,s.funcKeywordCode)(n,a)}t.KeywordCxt=x;let P=/^\/(?:[^~]|~0|~1)*$/,E=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function j(t,{dataLevel:r,dataNames:a,dataPathArr:i}){let n,o;if(""===t)return u.default.rootData;if("/"===t[0]){if(!P.test(t))throw Error(`Invalid JSON-pointer: ${t}`);n=t,o=u.default.rootData}else{let s=E.exec(t);if(!s)throw Error(`Invalid JSON-pointer: ${t}`);let c=+s[1];if("#"===(n=s[2])){if(c>=r)throw Error(l("property/index",c));return i[r-c]}if(c>r)throw Error(l("data",c));if(o=a[r-c],!n)return o}let s=o;for(let t of n.split("/"))t&&(o=(0,c._)`${o}${(0,c.getProperty)((0,p.unescapeJsonPointer)(t))}`,s=(0,c._)`${s} && ${o}`);return s;function l(t,a){return`Cannot access ${t} ${a} levels up, current level is ${r}`}}t.getData=j}),uq=V(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}}}),uA=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uN();t.default=class extends Error{constructor(t,a,i,n){super(n||`can't resolve reference ${i} from id ${a}`),this.missingRef=(0,r.resolveUrl)(t,a,i),this.missingSchema=(0,r.normalizeId)((0,r.getFullPath)(t,this.missingRef))}}}),uz=V(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;let r=u_(),a=uq(),i=uS(),n=uN(),o=ub(),s=uI();var l=class{constructor(t){var r;let a;this.refs={},this.dynamicAnchors={},"object"==typeof t.schema&&(a=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=null!=(r=t.baseId)?r:(0,n.normalizeId)(null==a?void 0:a[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=null==a?void 0:a.$async,this.refs={}}};function c(t){let o,l,c=d.call(this,t);if(c)return c;let u=(0,n.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:p,lines:m}=this.opts.code,{ownProperties:h}=this.opts,f=new r.CodeGen(this.scope,{es5:p,lines:m,ownProperties:h});t.$async&&(o=f.scopeValue("Error",{ref:a.default,code:(0,r._)`require("ajv/dist/runtime/validation_error").default`}));let y=f.scopeName("validate");t.validateName=y;let g={gen:f,allErrors:this.opts.allErrors,data:i.default.data,parentData:i.default.parentData,parentDataProperty:i.default.parentDataProperty,dataNames:[i.default.data],dataPathArr:[r.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:f.scopeValue("schema",!0===this.opts.code.source?{ref:t.schema,code:(0,r.stringify)(t.schema)}:{ref:t.schema}),validateName:y,ValidationError:o,schema:t.schema,schemaEnv:t,rootId:u,baseId:t.baseId||u,schemaPath:r.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,r._)`""`,opts:this.opts,self:this};try{this._compilations.add(t),(0,s.validateFunctionCode)(g),f.optimize(this.opts.code.optimize);let a=f.toString();l=`${f.scopeRefs(i.default.scope)}return ${a}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let n=Function(`${i.default.self}`,`${i.default.scope}`,l)(this,this.scope.get());if(this.scope.value(y,{ref:n}),n.errors=null,n.schema=t.schema,n.schemaEnv=t,t.$async&&(n.$async=!0),!0===this.opts.code.source&&(n.source={validateName:y,validateCode:a,scopeValues:f._values}),this.opts.unevaluated){let{props:t,items:a}=g;n.evaluated={props:t instanceof r.Name?void 0:t,items:a instanceof r.Name?void 0:a,dynamicProps:t instanceof r.Name,dynamicItems:a instanceof r.Name},n.source&&(n.source.evaluated=(0,r.stringify)(n.evaluated))}return t.validate=n,t}catch(r){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),r}finally{this._compilations.delete(t)}}function u(t){return(0,n.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:c.call(this,t)}function d(t){for(let i of this._compilations){var r,a;if(r=i,a=t,r.schema===a.schema&&r.root===a.root&&r.baseId===a.baseId)return i}}function p(t,r){let a;for(;"string"==typeof(a=this.refs[r]);)r=a;return a||this.schemas[r]||m.call(this,t,r)}function m(t,r){let a=this.opts.uriResolver.parse(r),i=(0,n._getFullPath)(this.opts.uriResolver,a),o=(0,n.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&i===o)return f.call(this,a,t);let s=(0,n.normalizeId)(i),u=this.refs[s]||this.schemas[s];if("string"==typeof u){let r=m.call(this,t,u);if("object"!=typeof(null==r?void 0:r.schema))return;return f.call(this,a,r)}if("object"==typeof(null==u?void 0:u.schema)){if(u.validate||c.call(this,u),s===(0,n.normalizeId)(r)){let{schema:r}=u,{schemaId:a}=this.opts,i=r[a];return i&&(o=(0,n.resolveUrl)(this.opts.uriResolver,o,i)),new l({schema:r,schemaId:a,root:t,baseId:o})}return f.call(this,a,u)}}t.SchemaEnv=l,t.compileSchema=c,t.resolveRef=function(t,r,a){var i;a=(0,n.resolveUrl)(this.opts.uriResolver,r,a);let o=t.refs[a];if(o)return o;let s=p.call(this,t,a);if(void 0===s){let n=null==(i=t.localRefs)?void 0:i[a],{schemaId:o}=this.opts;n&&(s=new l({schema:n,schemaId:o,root:t,baseId:r}))}if(void 0!==s)return t.refs[a]=u.call(this,s)},t.getCompilingSchema=d,t.resolveSchema=m;let h=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function f(t,{baseId:r,schema:a,root:i}){var s;let c;if((null==(s=t.fragment)?void 0:s[0])!=="/")return;for(let i of t.fragment.slice(1).split("/")){if("boolean"==typeof a)return;let t=a[(0,o.unescapeFragment)(i)];if(void 0===t)return;let s="object"==typeof(a=t)&&a[this.opts.schemaId];!h.has(i)&&s&&(r=(0,n.resolveUrl)(this.opts.uriResolver,r,s))}if("boolean"!=typeof a&&a.$ref&&!(0,o.schemaHasRulesButRef)(a,this.RULES)){let t=(0,n.resolveUrl)(this.opts.uriResolver,r,a.$ref);c=m.call(this,i,t)}let{schemaId:u}=this.opts;if((c=c||new l({schema:a,schemaId:u,root:i,baseId:r})).schema!==c.root.schema)return c}}),uM=V((t,r)=>{r.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),uL=V((t,r)=>{let a=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),i=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function n(t){let r="",a=0,i=0;for(i=0;i<t.length;i++)if(48!==(a=t[i].charCodeAt(0))){if(!(a>=48&&a<=57||a>=65&&a<=70||a>=97&&a<=102))return"";r+=t[i];break}for(i+=1;i<t.length;i++){if(!((a=t[i].charCodeAt(0))>=48&&a<=57||a>=65&&a<=70||a>=97&&a<=102))return"";r+=t[i]}return r}function o(t){return t.length=0,!0}function s(t,r,a){if(t.length){let i=n(t);if(""===i)return a.error=!0,!1;r.push(i),t.length=0}return!0}function l(t){if(2>function(t,r){let a=0;for(let r=0;r<t.length;r++)":"===t[r]&&a++;return a}(t,":"))return{host:t,isIPV6:!1};let r=function(t){let r=0,a={error:!1,address:"",zone:""},i=[],l=[],c=!1,u=!1,d=s;for(let n=0;n<t.length;n++){let s=t[n];if("["!==s&&"]"!==s)if(":"===s){if(!0===c&&(u=!0),!d(l,i,a))break;if(++r>7){a.error=!0;break}n>0&&":"===t[n-1]&&(c=!0),i.push(":");continue}else if("%"===s){if(!d(l,i,a))break;d=o}else{l.push(s);continue}}return l.length&&(d===o?a.zone=l.join(""):u?i.push(l.join("")):i.push(n(l))),a.address=i.join(""),a}(t);if(r.error)return{host:t,isIPV6:!1};{let t=r.address,a=r.address;return r.zone&&(t+="%"+r.zone,a+="%25"+r.zone),{host:t,isIPV6:!0,escapedHost:a}}}r.exports={nonSimpleDomain:RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u),recomposeAuthority:function(t){let r=[];if(void 0!==t.userinfo&&(r.push(t.userinfo),r.push("@")),void 0!==t.host){let a=unescape(t.host);if(!i(a)){let r=l(a);a=!0===r.isIPV6?`[${r.escapedHost}]`:t.host}r.push(a)}return("number"==typeof t.port||"string"==typeof t.port)&&(r.push(":"),r.push(String(t.port))),r.length?r.join(""):void 0},normalizeComponentEncoding:function(t,r){let a=!0!==r?escape:unescape;return void 0!==t.scheme&&(t.scheme=a(t.scheme)),void 0!==t.userinfo&&(t.userinfo=a(t.userinfo)),void 0!==t.host&&(t.host=a(t.host)),void 0!==t.path&&(t.path=a(t.path)),void 0!==t.query&&(t.query=a(t.query)),void 0!==t.fragment&&(t.fragment=a(t.fragment)),t},removeDotSegments:function(t){let r=t,a=[],i=-1,n=0;for(;n=r.length;){if(1===n)if("."===r)break;else if("/"===r){a.push("/");break}else{a.push(r);break}if(2===n){if("."===r[0]){if("."===r[1])break;else if("/"===r[1]){r=r.slice(2);continue}}else if("/"===r[0]&&("."===r[1]||"/"===r[1])){a.push("/");break}}else if(3===n&&"/.."===r){0!==a.length&&a.pop(),a.push("/");break}if("."===r[0]){if("."===r[1]){if("/"===r[2]){r=r.slice(3);continue}}else if("/"===r[1]){r=r.slice(2);continue}}else if("/"===r[0]&&"."===r[1]){if("/"===r[2]){r=r.slice(2);continue}else if("."===r[2]&&"/"===r[3]){r=r.slice(3),0!==a.length&&a.pop();continue}}if(-1===(i=r.indexOf("/",1))){a.push(r);break}a.push(r.slice(0,i)),r=r.slice(i)}return a.join("")},isIPv4:i,isUUID:a,normalizeIPv6:l,stringArrayToHexStripped:n}}),uD=V((t,r)=>{let{isUUID:a}=uL(),i=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,n=["http","https","ws","wss","urn","urn:uuid"];function o(t){return!0===t.secure||!1!==t.secure&&!!t.scheme&&3===t.scheme.length&&("w"===t.scheme[0]||"W"===t.scheme[0])&&("s"===t.scheme[1]||"S"===t.scheme[1])&&("s"===t.scheme[2]||"S"===t.scheme[2])}function s(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function l(t){let r="https"===String(t.scheme).toLowerCase();return(t.port===(r?443:80)||""===t.port)&&(t.port=void 0),t.path||(t.path="/"),t}let c={scheme:"http",domainHost:!0,parse:s,serialize:l},u={scheme:"https",domainHost:c.domainHost,parse:s,serialize:l},d={scheme:"ws",domainHost:!0,parse:function(t){return t.secure=o(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t},serialize:function(t){if((t.port===(o(t)?443:80)||""===t.port)&&(t.port=void 0),"boolean"==typeof t.secure&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[r,a]=t.resourceName.split("?");t.path=r&&"/"!==r?r:void 0,t.query=a,t.resourceName=void 0}return t.fragment=void 0,t}},p={scheme:"wss",domainHost:d.domainHost,parse:d.parse,serialize:d.serialize},m={http:c,https:u,ws:d,wss:p,urn:{scheme:"urn",parse:function(t,r){if(!t.path)return t.error="URN can not be parsed",t;let a=t.path.match(i);if(a){let i=r.scheme||t.scheme||"urn";t.nid=a[1].toLowerCase(),t.nss=a[2];let n=h(`${i}:${r.nid||t.nid}`);t.path=void 0,n&&(t=n.parse(t,r))}else t.error=t.error||"URN can not be parsed.";return t},serialize:function(t,r){if(void 0===t.nid)throw Error("URN without nid cannot be serialized");let a=r.scheme||t.scheme||"urn",i=t.nid.toLowerCase(),n=h(`${a}:${r.nid||i}`);n&&(t=n.serialize(t,r));let o=t,s=t.nss;return o.path=`${i||r.nid}:${s}`,r.skipEscape=!0,o},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(t,r){return t.uuid=t.nss,t.nss=void 0,r.tolerant||t.uuid&&a(t.uuid)||(t.error=t.error||"UUID is not valid."),t},serialize:function(t){return t.nss=(t.uuid||"").toLowerCase(),t},skipNormalize:!0}};function h(t){return t&&(m[t]||m[t.toLowerCase()])||void 0}Object.setPrototypeOf(m,null),r.exports={wsIsSecure:o,SCHEMES:m,isValidSchemeName:function(t){return -1!==n.indexOf(t)},getSchemeHandler:h}}),uZ=V((t,r)=>{let{normalizeIPv6:a,removeDotSegments:i,recomposeAuthority:n,normalizeComponentEncoding:o,isIPv4:s,nonSimpleDomain:l}=uL(),{SCHEMES:c,getSchemeHandler:u}=uD();function d(t,r,a,n){let o={};return n||(t=h(p(t,a),a),r=h(p(r,a),a)),!(a=a||{}).tolerant&&r.scheme?(o.scheme=r.scheme,o.userinfo=r.userinfo,o.host=r.host,o.port=r.port,o.path=i(r.path||""),o.query=r.query):(void 0!==r.userinfo||void 0!==r.host||void 0!==r.port?(o.userinfo=r.userinfo,o.host=r.host,o.port=r.port,o.path=i(r.path||""),o.query=r.query):(r.path?("/"===r.path[0]?o.path=i(r.path):(void 0===t.userinfo&&void 0===t.host&&void 0===t.port||t.path?t.path?o.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+r.path:o.path=r.path:o.path="/"+r.path,o.path=i(o.path)),o.query=r.query):(o.path=t.path,void 0!==r.query?o.query=r.query:o.query=t.query),o.userinfo=t.userinfo,o.host=t.host,o.port=t.port),o.scheme=t.scheme),o.fragment=r.fragment,o}function p(t,r){let a={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},o=Object.assign({},r),s=[],l=u(o.scheme||a.scheme);l&&l.serialize&&l.serialize(a,o),void 0!==a.path&&(o.skipEscape?a.path=unescape(a.path):(a.path=escape(a.path),void 0!==a.scheme&&(a.path=a.path.split("%3A").join(":")))),"suffix"!==o.reference&&a.scheme&&s.push(a.scheme,":");let c=n(a);if(void 0!==c&&("suffix"!==o.reference&&s.push("//"),s.push(c),a.path&&"/"!==a.path[0]&&s.push("/")),void 0!==a.path){let t=a.path;o.absolutePath||l&&l.absolutePath||(t=i(t)),void 0===c&&"/"===t[0]&&"/"===t[1]&&(t="/%2F"+t.slice(2)),s.push(t)}return void 0!==a.query&&s.push("?",a.query),void 0!==a.fragment&&s.push("#",a.fragment),s.join("")}let m=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function h(t,r){let i=Object.assign({},r),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1;"suffix"===i.reference&&(t=i.scheme?i.scheme+":"+t:"//"+t);let c=t.match(m);if(c){if(n.scheme=c[1],n.userinfo=c[3],n.host=c[4],n.port=parseInt(c[5],10),n.path=c[6]||"",n.query=c[7],n.fragment=c[8],isNaN(n.port)&&(n.port=c[5]),n.host)if(!1===s(n.host)){let t=a(n.host);n.host=t.host.toLowerCase(),o=t.isIPV6}else o=!0;void 0!==n.scheme||void 0!==n.userinfo||void 0!==n.host||void 0!==n.port||void 0!==n.query||n.path?void 0===n.scheme?n.reference="relative":void 0===n.fragment?n.reference="absolute":n.reference="uri":n.reference="same-document",i.reference&&"suffix"!==i.reference&&i.reference!==n.reference&&(n.error=n.error||"URI is not a "+i.reference+" reference.");let r=u(i.scheme||n.scheme);if(!i.unicodeSupport&&(!r||!r.unicodeSupport)&&n.host&&(i.domainHost||r&&r.domainHost)&&!1===o&&l(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(t){n.error=n.error||"Host's domain name can not be converted to ASCII: "+t}(!r||r&&!r.skipNormalize)&&(-1!==t.indexOf("%")&&(void 0!==n.scheme&&(n.scheme=unescape(n.scheme)),void 0!==n.host&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),r&&r.parse&&r.parse(n,i)}else n.error=n.error||"URI can not be parsed.";return n}let f={SCHEMES:c,normalize:function(t,r){return"string"==typeof t?t=p(h(t,r),r):"object"==typeof t&&(t=h(p(t,r),r)),t},resolve:function(t,r,a){let i=a?Object.assign({scheme:"null"},a):{scheme:"null"},n=d(h(t,i),h(r,i),i,!0);return i.skipEscape=!0,p(n,i)},resolveComponent:d,equal:function(t,r,a){return"string"==typeof t?t=p(o(h(t=unescape(t),a),!0),{...a,skipEscape:!0}):"object"==typeof t&&(t=p(o(t,!0),{...a,skipEscape:!0})),"string"==typeof r?r=p(o(h(r=unescape(r),a),!0),{...a,skipEscape:!0}):"object"==typeof r&&(r=p(o(r,!0),{...a,skipEscape:!0})),t.toLowerCase()===r.toLowerCase()},serialize:p,parse:h};r.exports=f,r.exports.default=f,r.exports.fastUri=f}),uV=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uZ();r.code='require("ajv/dist/runtime/uri").default',t.default=r}),uF=V(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var r=uI();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return r.KeywordCxt}});var a=u_();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return a._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return a.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return a.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return a.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return a.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return a.CodeGen}});let i=uq(),n=uA(),o=uk(),s=uz(),l=u_(),c=uN(),u=uR(),d=ub(),p=uM(),m=uV(),h=(t,r)=>new RegExp(t,r);h.code="new RegExp";let f=["removeAdditional","useDefaults","coerceTypes"],y=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."},v={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};var _=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...function(t){var r,a,i,n,o,s,l,c,u,d,p,f,y,g,v,_,b,S,$,w,k,x,R,P,E;let j=t.strict,T=null==(r=t.code)?void 0:r.optimize,O=!0===T||void 0===T?1:T||0,C=null!=(i=null==(a=t.code)?void 0:a.regExp)?i:h,N=null!=(n=t.uriResolver)?n:m.default;return{strictSchema:null==(s=null!=(o=t.strictSchema)?o:j)||s,strictNumbers:null==(c=null!=(l=t.strictNumbers)?l:j)||c,strictTypes:null!=(d=null!=(u=t.strictTypes)?u:j)?d:"log",strictTuples:null!=(f=null!=(p=t.strictTuples)?p:j)?f:"log",strictRequired:null!=(g=null!=(y=t.strictRequired)?y:j)&&g,code:t.code?{...t.code,optimize:O,regExp:C}:{optimize:O,regExp:C},loopRequired:null!=(v=t.loopRequired)?v:200,loopEnum:null!=(_=t.loopEnum)?_:200,meta:null==(b=t.meta)||b,messages:null==(S=t.messages)||S,inlineRefs:null==($=t.inlineRefs)||$,schemaId:null!=(w=t.schemaId)?w:"$id",addUsedSchema:null==(k=t.addUsedSchema)||k,validateSchema:null==(x=t.validateSchema)||x,validateFormats:null==(R=t.validateFormats)||R,unicodeRegExp:null==(P=t.unicodeRegExp)||P,int32range:null==(E=t.int32range)||E,uriResolver:N}}(t)};const{es5:r,lines:a}=this.opts.code;this.scope=new l.ValueScope({scope:{},prefixes:y,es5:r,lines:a}),this.logger=function(t){if(!1===t)return R;if(void 0===t)return console;if(t.log&&t.warn&&t.error)return t;throw Error("logger must implement log, warn and error methods")}(t.logger);const i=t.validateFormats;t.validateFormats=!1,this.RULES=(0,o.getRules)(),b.call(this,g,t,"NOT SUPPORTED"),b.call(this,v,t,"DEPRECATED","warn"),this._metaOpts=x.call(this),t.formats&&w.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&k.call(this,t.keywords),"object"==typeof t.meta&&this.addMetaSchema(t.meta),$.call(this),t.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:a}=this.opts,i=p;"id"===a&&((i={...p}).id=i.$id,delete i.$id),r&&t&&this.addMetaSchema(i,i[a],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta="object"==typeof t?t[r]||t:void 0}validate(t,r){let a;if("string"==typeof t){if(!(a=this.getSchema(t)))throw Error(`no schema with key or ref "${t}"`)}else a=this.compile(t);let i=a(r);return"$async"in a||(this.errors=a.errors),i}compile(t,r){let a=this._addSchema(t,r);return a.validate||this._compileSchemaEnv(a)}compileAsync(t,r){if("function"!=typeof this.opts.loadSchema)throw Error("options.loadSchema should be a function");let{loadSchema:a}=this.opts;return i.call(this,t,r);async function i(t,r){await o.call(this,t.$schema);let a=this._addSchema(t,r);return a.validate||s.call(this,a)}async function o(t){t&&!this.getSchema(t)&&await i.call(this,{$ref:t},!0)}async function s(t){try{return this._compileSchemaEnv(t)}catch(r){if(!(r instanceof n.default))throw r;return l.call(this,r),await c.call(this,r.missingSchema),s.call(this,t)}}function l({missingSchema:t,missingRef:r}){if(this.refs[t])throw Error(`AnySchema ${t} is loaded but ${r} cannot be resolved`)}async function c(t){let a=await u.call(this,t);this.refs[t]||await o.call(this,a.$schema),this.refs[t]||this.addSchema(a,t,r)}async function u(t){let r=this._loading[t];if(r)return r;try{return await (this._loading[t]=a(t))}finally{delete this._loading[t]}}}addSchema(t,r,a,i=this.opts.validateSchema){let n;if(Array.isArray(t)){for(let r of t)this.addSchema(r,void 0,a,i);return this}if("object"==typeof t){let{schemaId:r}=this.opts;if(void 0!==(n=t[r])&&"string"!=typeof n)throw Error(`schema ${r} must be string`)}return r=(0,c.normalizeId)(r||n),this._checkUnique(r),this.schemas[r]=this._addSchema(t,a,r,i,!0),this}addMetaSchema(t,r,a=this.opts.validateSchema){return this.addSchema(t,r,!0,a),this}validateSchema(t,r){let a;if("boolean"==typeof t)return!0;if(void 0!==(a=t.$schema)&&"string"!=typeof a)throw Error("$schema must be a string");if(!(a=a||this.opts.defaultMeta||this.defaultMeta()))return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(a,t);if(!i&&r){let t="schema is invalid: "+this.errorsText();if("log"===this.opts.validateSchema)this.logger.error(t);else throw Error(t)}return i}getSchema(t){let r;for(;"string"==typeof(r=S.call(this,t));)t=r;if(void 0===r){let{schemaId:a}=this.opts,i=new s.SchemaEnv({schema:{},schemaId:a});if(!(r=s.resolveSchema.call(this,i,t)))return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=S.call(this,t);return"object"==typeof r&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{this._cache.delete(t);let r=t[this.opts.schemaId];return r&&(r=(0,c.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let a;if("string"==typeof t)a=t,"object"==typeof r&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=a);else if("object"==typeof t&&void 0===r){if(Array.isArray(a=(r=t).keyword)&&!a.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(E.call(this,a,r),!r)return(0,d.eachItem)(a,t=>j.call(this,t)),this;O.call(this,r);let i={...r,type:(0,u.getJSONTypes)(r.type),schemaType:(0,u.getJSONTypes)(r.schemaType)};return(0,d.eachItem)(a,0===i.type.length?t=>j.call(this,t,i):t=>i.type.forEach(r=>j.call(this,t,i,r))),this}getKeyword(t){let r=this.RULES.all[t];return"object"==typeof r?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;for(let a of(delete r.keywords[t],delete r.all[t],r.rules)){let r=a.rules.findIndex(r=>r.keyword===t);r>=0&&a.rules.splice(r,1)}return this}addFormat(t,r){return"string"==typeof r&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:a="data"}={}){return t&&0!==t.length?t.map(t=>`${a}${t.instancePath} ${t.message}`).reduce((t,a)=>t+r+a):"No errors"}$dataMetaSchema(t,r){let a=this.RULES.all;for(let i of(t=JSON.parse(JSON.stringify(t)),r)){let r=i.split("/").slice(1),n=t;for(let t of r)n=n[t];for(let t in a){let r=a[t];if("object"!=typeof r)continue;let{$data:i}=r.definition,o=n[t];i&&o&&(n[t]=N(o))}}return t}_removeAllSchemas(t,r){for(let a in t){let i=t[a];(!r||r.test(a))&&("string"==typeof i?delete t[a]:i&&!i.meta&&(this._cache.delete(i.schema),delete t[a]))}}_addSchema(t,r,a,i=this.opts.validateSchema,n=this.opts.addUsedSchema){let o,{schemaId:l}=this.opts;if("object"==typeof t)o=t[l];else if(this.opts.jtd)throw Error("schema must be object");else if("boolean"!=typeof t)throw Error("schema must be object or boolean");let u=this._cache.get(t);if(void 0!==u)return u;a=(0,c.normalizeId)(o||a);let d=c.getSchemaRefs.call(this,t,a);return u=new s.SchemaEnv({schema:t,schemaId:l,meta:r,baseId:a,localRefs:d}),this._cache.set(u.schema,u),n&&!a.startsWith("#")&&(a&&this._checkUnique(a),this.refs[a]=u),i&&this.validateSchema(t,!0),u}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):s.compileSchema.call(this,t),!t.validate)throw Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{s.compileSchema.call(this,t)}finally{this.opts=r}}};function b(t,r,a,i="error"){for(let n in t)n in r&&this.logger[i](`${a}: option ${n}. ${t[n]}`)}function S(t){return t=(0,c.normalizeId)(t),this.schemas[t]||this.refs[t]}function $(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let r in t)this.addSchema(t[r],r)}function w(){for(let t in this.opts.formats){let r=this.opts.formats[t];r&&this.addFormat(t,r)}}function k(t){if(Array.isArray(t))return void this.addVocabulary(t);for(let r in this.logger.warn("keywords option as map is deprecated, pass array"),t){let a=t[r];a.keyword||(a.keyword=r),this.addKeyword(a)}}function x(){let t={...this.opts};for(let r of f)delete t[r];return t}_.ValidationError=i.default,_.MissingRefError=n.default,t.default=_;let R={log(){},warn(){},error(){}},P=/^[a-z_$][a-z0-9_$:-]*$/i;function E(t,r){let{RULES:a}=this;if((0,d.eachItem)(t,t=>{if(a.keywords[t])throw Error(`Keyword ${t} is already defined`);if(!P.test(t))throw Error(`Keyword ${t} has invalid name`)}),r&&r.$data&&!("code"in r||"validate"in r))throw Error('$data keyword must have "code" or "validate" function')}function j(t,r,a){var i;let n=null==r?void 0:r.post;if(a&&n)throw Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,s=n?o.post:o.rules.find(({type:t})=>t===a);if(s||(s={type:a,rules:[]},o.rules.push(s)),o.keywords[t]=!0,!r)return;let l={keyword:t,definition:{...r,type:(0,u.getJSONTypes)(r.type),schemaType:(0,u.getJSONTypes)(r.schemaType)}};r.before?T.call(this,s,l,r.before):s.rules.push(l),o.all[t]=l,null==(i=r.implements)||i.forEach(t=>this.addKeyword(t))}function T(t,r,a){let i=t.rules.findIndex(t=>t.keyword===a);i>=0?t.rules.splice(i,0,r):(t.rules.push(r),this.logger.warn(`rule ${a} is not defined`))}function O(t){let{metaSchema:r}=t;void 0!==r&&(t.$data&&this.opts.$data&&(r=N(r)),t.validateSchema=this.compile(r,!0))}let C={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function N(t){return{anyOf:[t,C]}}}),uU=V(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}}}),uH=V(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;let r=uA(),a=uE(),i=u_(),n=uS(),o=uz(),s=ub();function l(t,r){let{gen:a}=t;return r.validate?a.scopeValue("validate",{ref:r.validate}):(0,i._)`${a.scopeValue("wrapper",{ref:r})}.validate`}function c(t,r,o,l){let{gen:c,it:u}=t,{allErrors:d,schemaEnv:p,opts:m}=u,h=m.passContext?n.default.this:i.nil;function f(t){let r=(0,i._)`${t}.errors`;c.assign(n.default.vErrors,(0,i._)`${n.default.vErrors} === null ? ${r} : ${n.default.vErrors}.concat(${r})`),c.assign(n.default.errors,(0,i._)`${n.default.vErrors}.length`)}function y(t){var r;if(!u.opts.unevaluated)return;let a=null==(r=null==o?void 0:o.validate)?void 0:r.evaluated;if(!0!==u.props)if(a&&!a.dynamicProps)void 0!==a.props&&(u.props=s.mergeEvaluated.props(c,a.props,u.props));else{let r=c.var("props",(0,i._)`${t}.evaluated.props`);u.props=s.mergeEvaluated.props(c,r,u.props,i.Name)}if(!0!==u.items)if(a&&!a.dynamicItems)void 0!==a.items&&(u.items=s.mergeEvaluated.items(c,a.items,u.items));else{let r=c.var("items",(0,i._)`${t}.evaluated.items`);u.items=s.mergeEvaluated.items(c,r,u.items,i.Name)}}l?function(){if(!p.$async)throw Error("async schema referenced by sync schema");let n=c.let("valid");c.try(()=>{c.code((0,i._)`await ${(0,a.callValidateCode)(t,r,h)}`),y(r),d||c.assign(n,!0)},t=>{c.if((0,i._)`!(${t} instanceof ${u.ValidationError})`,()=>c.throw(t)),f(t),d||c.assign(n,!1)}),t.ok(n)}():t.result((0,a.callValidateCode)(t,r,h),()=>y(r),()=>f(r))}t.getValidate=l,t.callRef=c,t.default={keyword:"$ref",schemaType:"string",code(t){var a,n;let s,u,d,{gen:p,schema:m,it:h}=t,{baseId:f,schemaEnv:y,validateName:g,opts:v,self:_}=h,{root:b}=y;if(("#"===m||"#/"===m)&&f===b.baseId){if(y===b)return c(t,g,y,y.$async);let r=p.scopeValue("root",{ref:b});return c(t,(0,i._)`${r}.validate`,b,b.$async)}let S=o.resolveRef.call(_,b,f,m);if(void 0===S)throw new r.default(h.opts.uriResolver,f,m);return S instanceof o.SchemaEnv?void c(t,l(t,a=S),a,a.$async):(n=S,s=p.scopeValue("schema",!0===v.code.source?{ref:n,code:(0,i.stringify)(n)}:{ref:n}),u=p.name("valid"),d=t.subschema({schema:n,dataTypes:[],schemaPath:i.nil,topSchemaRef:s,errSchemaPath:m},u),void(t.mergeEvaluated(d),t.ok(u)))}}}),uJ=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uU(),a=uH();t.default=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",r.default,a.default]}),uK=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u_(),a=r.operators,i={maximum:{okStr:"<=",ok:a.LTE,fail:a.GT},minimum:{okStr:">=",ok:a.GTE,fail:a.LT},exclusiveMaximum:{okStr:"<",ok:a.LT,fail:a.GTE},exclusiveMinimum:{okStr:">",ok:a.GT,fail:a.LTE}};t.default={keyword:Object.keys(i),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:a})=>(0,r.str)`must be ${i[t].okStr} ${a}`,params:({keyword:t,schemaCode:a})=>(0,r._)`{comparison: ${i[t].okStr}, limit: ${a}}`},code(t){let{keyword:a,data:n,schemaCode:o}=t;t.fail$data((0,r._)`${n} ${i[a].fail} ${o} || isNaN(${n})`)}}}),uB=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u_();t.default={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:t})=>(0,r.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,r._)`{multipleOf: ${t}}`},code(t){let{gen:a,data:i,schemaCode:n,it:o}=t,s=o.opts.multipleOfPrecision,l=a.let("res"),c=s?(0,r._)`Math.abs(Math.round(${l}) - ${l}) > 1e-${s}`:(0,r._)`${l} !== parseInt(${l})`;t.fail$data((0,r._)`(${n} === 0 || (${l} = ${i}/${n}, ${c}))`)}}}),uG=V(t=>{function r(t){let r,a=t.length,i=0,n=0;for(;n<a;)i++,(r=t.charCodeAt(n++))>=55296&&r<=56319&&n<a&&(64512&(r=t.charCodeAt(n)))==56320&&n++;return i}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,r.code='require("ajv/dist/runtime/ucs2length").default'}),uW=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u_(),a=ub(),i=uG();t.default={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:a})=>(0,r.str)`must NOT have ${"maxLength"===t?"more":"fewer"} than ${a} characters`,params:({schemaCode:t})=>(0,r._)`{limit: ${t}}`},code(t){let{keyword:n,data:o,schemaCode:s,it:l}=t,c="maxLength"===n?r.operators.GT:r.operators.LT,u=!1===l.opts.unicode?(0,r._)`${o}.length`:(0,r._)`${(0,a.useFunc)(t.gen,i.default)}(${o})`;t.fail$data((0,r._)`${u} ${c} ${s}`)}}}),uY=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uE(),a=ub(),i=u_();t.default={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,i.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,i._)`{pattern: ${t}}`},code(t){let{gen:n,data:o,$data:s,schema:l,schemaCode:c,it:u}=t,d=u.opts.unicodeRegExp?"u":"";if(s){let{regExp:r}=u.opts.code,s="new RegExp"===r.code?(0,i._)`new RegExp`:(0,a.useFunc)(n,r),l=n.let("valid");n.try(()=>n.assign(l,(0,i._)`${s}(${c}, ${d}).test(${o})`),()=>n.assign(l,!1)),t.fail$data((0,i._)`!${l}`)}else{let a=(0,r.usePattern)(t,l);t.fail$data((0,i._)`!${a}.test(${o})`)}}}}),uX=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u_();t.default={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:a})=>(0,r.str)`must NOT have ${"maxProperties"===t?"more":"fewer"} than ${a} properties`,params:({schemaCode:t})=>(0,r._)`{limit: ${t}}`},code(t){let{keyword:a,data:i,schemaCode:n}=t,o="maxProperties"===a?r.operators.GT:r.operators.LT;t.fail$data((0,r._)`Object.keys(${i}).length ${o} ${n}`)}}}),uQ=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uE(),a=u_(),i=ub();t.default={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:t}})=>(0,a.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,a._)`{missingProperty: ${t}}`},code(t){let{gen:n,schema:o,schemaCode:s,data:l,$data:c,it:u}=t,{opts:d}=u;if(!c&&0===o.length)return;let p=o.length>=d.loopRequired;if(u.allErrors?function(){if(p||c)t.block$data(a.nil,m);else for(let a of o)(0,r.checkReportMissingProp)(t,a)}():function(){let i=n.let("missing");if(p||c){let o=n.let("valid",!0);t.block$data(o,()=>{var c,u;return c=i,u=o,void(t.setParams({missingProperty:c}),n.forOf(c,s,()=>{n.assign(u,(0,r.propertyInData)(n,l,c,d.ownProperties)),n.if((0,a.not)(u),()=>{t.error(),n.break()})},a.nil))}),t.ok(o)}else n.if((0,r.checkMissingProp)(t,o,i)),(0,r.reportMissingProp)(t,i),n.else()}(),d.strictRequired){let r=t.parentSchema.properties,{definedProperties:a}=t.it;for(let t of o)if((null==r?void 0:r[t])===void 0&&!a.has(t)){let r=`required property "${t}" is not defined at "${u.schemaEnv.baseId+u.errSchemaPath}" (strictRequired)`;(0,i.checkStrictMode)(u,r,u.opts.strictRequired)}}function m(){n.forOf("prop",s,a=>{t.setParams({missingProperty:a}),n.if((0,r.noPropertyInData)(n,l,a,d.ownProperties),()=>t.error())})}}}}),u0=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u_();t.default={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:a})=>(0,r.str)`must NOT have ${"maxItems"===t?"more":"fewer"} than ${a} items`,params:({schemaCode:t})=>(0,r._)`{limit: ${t}}`},code(t){let{keyword:a,data:i,schemaCode:n}=t,o="maxItems"===a?r.operators.GT:r.operators.LT;t.fail$data((0,r._)`${i}.length ${o} ${n}`)}}}),u1=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uO();r.code='require("ajv/dist/runtime/equal").default',t.default=r}),u2=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uR(),a=u_(),i=ub(),n=u1();t.default={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:t,j:r}})=>(0,a.str)`must NOT have duplicate items (items ## ${r} and ${t} are identical)`,params:({params:{i:t,j:r}})=>(0,a._)`{i: ${t}, j: ${r}}`},code(t){let{gen:o,data:s,$data:l,schema:c,parentSchema:u,schemaCode:d,it:p}=t;if(!l&&!c)return;let m=o.let("valid"),h=u.items?(0,r.getSchemaTypes)(u.items):[];t.block$data(m,function(){let l=o.let("i",(0,a._)`${s}.length`),c=o.let("j");t.setParams({i:l,j:c}),o.assign(m,!0),o.if((0,a._)`${l} > 1`,()=>(h.length>0&&!h.some(t=>"object"===t||"array"===t)?function(i,n){let l=o.name("item"),c=(0,r.checkDataTypes)(h,l,p.opts.strictNumbers,r.DataType.Wrong),u=o.const("indices",(0,a._)`{}`);o.for((0,a._)`;${i}--;`,()=>{o.let(l,(0,a._)`${s}[${i}]`),o.if(c,(0,a._)`continue`),h.length>1&&o.if((0,a._)`typeof ${l} == "string"`,(0,a._)`${l} += "_"`),o.if((0,a._)`typeof ${u}[${l}] == "number"`,()=>{o.assign(n,(0,a._)`${u}[${l}]`),t.error(),o.assign(m,!1).break()}).code((0,a._)`${u}[${l}] = ${i}`)})}:function(r,l){let c=(0,i.useFunc)(o,n.default),u=o.name("outer");o.label(u).for((0,a._)`;${r}--;`,()=>o.for((0,a._)`${l} = ${r}; ${l}--;`,()=>o.if((0,a._)`${c}(${s}[${r}], ${s}[${l}])`,()=>{t.error(),o.assign(m,!1).break(u)})))})(l,c))},(0,a._)`${d} === false`),t.ok(m)}}}),u9=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u_(),a=ub(),i=u1();t.default={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:t})=>(0,r._)`{allowedValue: ${t}}`},code(t){let{gen:n,data:o,$data:s,schemaCode:l,schema:c}=t;s||c&&"object"==typeof c?t.fail$data((0,r._)`!${(0,a.useFunc)(n,i.default)}(${o}, ${l})`):t.fail((0,r._)`${c} !== ${o}`)}}}),u4=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u_(),a=ub(),i=u1();t.default={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,r._)`{allowedValues: ${t}}`},code(t){let n,o,{gen:s,data:l,$data:c,schema:u,schemaCode:d,it:p}=t;if(!c&&0===u.length)throw Error("enum must have non-empty array");let m=u.length>=p.opts.loopEnum,h=()=>null!=n?n:n=(0,a.useFunc)(s,i.default);if(m||c)o=s.let("valid"),t.block$data(o,function(){s.assign(o,!1),s.forOf("v",d,t=>s.if((0,r._)`${h()}(${l}, ${t})`,()=>s.assign(o,!0).break()))});else{if(!Array.isArray(u))throw Error("ajv implementation error");let t=s.const("vSchema",d);o=(0,r.or)(...u.map((a,i)=>{var n,o;let s;return n=t,"object"==typeof(s=u[o=i])&&null!==s?(0,r._)`${h()}(${l}, ${n}[${o}])`:(0,r._)`${l} === ${s}`}))}t.pass(o)}}}),u6=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uK(),a=uB(),i=uW(),n=uY(),o=uX(),s=uQ(),l=u0(),c=u2(),u=u9(),d=u4();t.default=[r.default,a.default,i.default,n.default,o.default,s.default,l.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,d.default]}),u5=V(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;let r=u_(),a=ub();function i(t,i){let{gen:n,schema:o,data:s,keyword:l,it:c}=t;c.items=!0;let u=n.const("len",(0,r._)`${s}.length`);if(!1===o)t.setParams({len:i.length}),t.pass((0,r._)`${u} <= ${i.length}`);else if("object"==typeof o&&!(0,a.alwaysValidSchema)(c,o)){let o=n.var("valid",(0,r._)`${u} <= ${i.length}`);n.if((0,r.not)(o),()=>{var s;return s=o,void n.forRange("i",i.length,u,i=>{t.subschema({keyword:l,dataProp:i,dataPropType:a.Type.Num},s),c.allErrors||n.if((0,r.not)(s),()=>n.break())})}),t.ok(o)}}t.validateAdditionalItems=i,t.default={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,r.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,r._)`{limit: ${t}}`},code(t){let{parentSchema:r,it:n}=t,{items:o}=r;Array.isArray(o)?i(t,o):(0,a.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas')}}}),u3=V(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;let r=u_(),a=ub(),i=uE();function n(t,i,o=t.schema){let{gen:s,parentSchema:l,data:c,keyword:u,it:d}=t;(function(t){let{opts:r,errSchemaPath:n}=d,s=o.length,l=s===t.minItems&&(s===t.maxItems||!1===t[i]);if(r.strictTuples&&!l){let t=`"${u}" is ${s}-tuple, but minItems or maxItems/${i} are not specified or different at path "${n}"`;(0,a.checkStrictMode)(d,t,r.strictTuples)}})(l),d.opts.unevaluated&&o.length&&!0!==d.items&&(d.items=a.mergeEvaluated.items(s,o.length,d.items));let p=s.name("valid"),m=s.const("len",(0,r._)`${c}.length`);o.forEach((i,n)=>{(0,a.alwaysValidSchema)(d,i)||(s.if((0,r._)`${m} > ${n}`,()=>t.subschema({keyword:u,schemaProp:n,dataProp:n},p)),t.ok(p))})}t.validateTuple=n,t.default={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:r,it:o}=t;if(Array.isArray(r))return n(t,"additionalItems",r);o.items=!0,(0,a.alwaysValidSchema)(o,r)||t.ok((0,i.validateArray)(t))}}}),u8=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u3();t.default={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,r.validateTuple)(t,"items")}}),u7=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u_(),a=ub(),i=uE(),n=u5();t.default={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,r.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,r._)`{limit: ${t}}`},code(t){let{schema:r,parentSchema:o,it:s}=t,{prefixItems:l}=o;s.items=!0,(0,a.alwaysValidSchema)(s,r)||(l?(0,n.validateAdditionalItems)(t,l):t.ok((0,i.validateArray)(t)))}}}),de=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u_(),a=ub();t.default={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:t,max:a}})=>void 0===a?(0,r.str)`must contain at least ${t} valid item(s)`:(0,r.str)`must contain at least ${t} and no more than ${a} valid item(s)`,params:({params:{min:t,max:a}})=>void 0===a?(0,r._)`{minContains: ${t}}`:(0,r._)`{minContains: ${t}, maxContains: ${a}}`},code(t){let i,n,{gen:o,schema:s,parentSchema:l,data:c,it:u}=t,{minContains:d,maxContains:p}=l;u.opts.next?(i=void 0===d?1:d,n=p):i=1;let m=o.const("len",(0,r._)`${c}.length`);if(t.setParams({min:i,max:n}),void 0===n&&0===i)return void(0,a.checkStrictMode)(u,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==n&&i>n){(0,a.checkStrictMode)(u,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,a.alwaysValidSchema)(u,s)){let a=(0,r._)`${m} >= ${i}`;void 0!==n&&(a=(0,r._)`${a} && ${m} <= ${n}`),t.pass(a);return}u.items=!0;let h=o.name("valid");function f(){let t=o.name("_valid"),a=o.let("count",0);y(t,()=>o.if(t,()=>{var t;return t=a,void(o.code((0,r._)`${t}++`),void 0===n?o.if((0,r._)`${t} >= ${i}`,()=>o.assign(h,!0).break()):(o.if((0,r._)`${t} > ${n}`,()=>o.assign(h,!1).break()),1===i?o.assign(h,!0):o.if((0,r._)`${t} >= ${i}`,()=>o.assign(h,!0))))}))}function y(r,i){o.forRange("i",0,m,n=>{t.subschema({keyword:"contains",dataProp:n,dataPropType:a.Type.Num,compositeRule:!0},r),i()})}void 0===n&&1===i?y(h,()=>o.if(h,()=>o.break())):0===i?(o.let(h,!0),void 0!==n&&o.if((0,r._)`${c}.length > 0`,f)):(o.let(h,!1),f()),t.result(h,()=>t.reset())}}}),dt=V(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;let r=u_(),a=ub(),i=uE();t.error={message:({params:{property:t,depsCount:a,deps:i}})=>(0,r.str)`must have ${1===a?"property":"properties"} ${i} when property ${t} is present`,params:({params:{property:t,depsCount:a,deps:i,missingProperty:n}})=>(0,r._)`{property: ${t},
|
|
59
59
|
missingProperty: ${n},
|
|
60
60
|
depsCount: ${a},
|
|
61
|
-
deps: ${i}}`};let n={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(t){let[r,a]=function({schema:t}){let r={},a={};for(let i in t)"__proto__"!==i&&((Array.isArray(t[i])?r:a)[i]=t[i]);return[r,a]}(t);o(t,r),s(t,a)}};function o(t,a=t.schema){let{gen:n,data:s,it:l}=t;if(0===Object.keys(a).length)return;let c=n.let("missing");for(let o in a){let u=a[o];if(0===u.length)continue;let d=(0,i.propertyInData)(n,s,o,l.opts.ownProperties);t.setParams({property:o,depsCount:u.length,deps:u.join(", ")}),l.allErrors?n.if(d,()=>{for(let r of u)(0,i.checkReportMissingProp)(t,r)}):(n.if((0,r._)`${d} && (${(0,i.checkMissingProp)(t,u,c)})`),(0,i.reportMissingProp)(t,c),n.else())}}function s(t,r=t.schema){let{gen:n,data:o,keyword:l,it:c}=t,u=n.name("valid");for(let s in r)(0,a.alwaysValidSchema)(c,r[s])||(n.if((0,i.propertyInData)(n,o,s,c.opts.ownProperties),()=>{let r=t.subschema({keyword:l,schemaProp:s},u);t.mergeValidEvaluated(r,u)},()=>n.var(u,!0)),t.ok(u))}t.validatePropertyDeps=o,t.validateSchemaDeps=s,t.default=n}),da=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ub(),a=uS();t.default={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:t})=>(0,r._)`{propertyName: ${t.propertyName}}`},code(t){let{gen:i,schema:n,data:o,it:s}=t;if((0,a.alwaysValidSchema)(s,n))return;let l=i.name("valid");i.forIn("key",o,a=>{t.setParams({propertyName:a}),t.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},l),i.if((0,r.not)(l),()=>{t.error(!0),s.allErrors||i.break()})}),t.ok(l)}}}),di=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uO(),a=ub(),i=u$(),n=uS();t.default={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:t})=>(0,a._)`{additionalProperty: ${t.additionalProperty}}`},code(t){let{gen:o,schema:s,parentSchema:l,data:c,errsCount:u,it:d}=t;if(!u)throw Error("ajv implementation error");let{allErrors:p,opts:m}=d;if(d.props=!0,"all"!==m.removeAdditional&&(0,n.alwaysValidSchema)(d,s))return;let h=(0,r.allSchemaProperties)(l.properties),f=(0,r.allSchemaProperties)(l.patternProperties);function y(t){o.code((0,a._)`delete ${c}[${t}]`)}function g(r){if("all"===m.removeAdditional||m.removeAdditional&&!1===s)return void y(r);if(!1===s){t.setParams({additionalProperty:r}),t.error(),p||o.break();return}if("object"==typeof s&&!(0,n.alwaysValidSchema)(d,s)){let i=o.name("valid");"failing"===m.removeAdditional?(v(r,i,!1),o.if((0,a.not)(i),()=>{t.reset(),y(r)})):(v(r,i),p||o.if((0,a.not)(i),()=>o.break()))}}function v(r,a,i){let o={keyword:"additionalProperties",dataProp:r,dataPropType:n.Type.Str};!1===i&&Object.assign(o,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(o,a)}o.forIn("key",c,i=>{h.length||f.length?o.if(function(i){let s;if(h.length>8){let t=(0,n.schemaRefOrVal)(d,l.properties,"properties");s=(0,r.isOwnProperty)(o,t,i)}else s=h.length?(0,a.or)(...h.map(t=>(0,a._)`${i} === ${t}`)):a.nil;return f.length&&(s=(0,a.or)(s,...f.map(n=>(0,a._)`${(0,r.usePattern)(t,n)}.test(${i})`))),(0,a.not)(s)}(i),()=>g(i)):g(i)}),t.ok((0,a._)`${u} === ${i.default.errors}`)}}}),dn=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uq(),a=uO(),i=uS(),n=di();t.default={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:o,schema:s,parentSchema:l,data:c,it:u}=t;"all"===u.opts.removeAdditional&&void 0===l.additionalProperties&&n.default.code(new r.KeywordCxt(u,n.default,"additionalProperties"));let d=(0,a.allSchemaProperties)(s);for(let t of d)u.definedProperties.add(t);u.opts.unevaluated&&d.length&&!0!==u.props&&(u.props=i.mergeEvaluated.props(o,(0,i.toHash)(d),u.props));let p=d.filter(t=>!(0,i.alwaysValidSchema)(u,s[t]));if(0===p.length)return;let m=o.name("valid");for(let r of p){var h;(h=r,u.opts.useDefaults&&!u.compositeRule&&void 0!==s[h].default)?f(r):(o.if((0,a.propertyInData)(o,c,r,u.opts.ownProperties)),f(r),u.allErrors||o.else().var(m,!0),o.endIf()),t.it.definedProperties.add(r),t.ok(m)}function f(r){t.subschema({keyword:"properties",schemaProp:r,dataProp:r},m)}}}}),ds=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uO(),a=ub(),i=uS(),n=uS();t.default={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:o,schema:s,data:l,parentSchema:c,it:u}=t,{opts:d}=u,p=(0,r.allSchemaProperties)(s),m=p.filter(t=>(0,i.alwaysValidSchema)(u,s[t]));if(0===p.length||m.length===p.length&&(!u.opts.unevaluated||!0===u.props))return;let h=d.strictSchema&&!d.allowMatchingProperties&&c.properties,f=o.name("valid");!0===u.props||u.props instanceof a.Name||(u.props=(0,n.evaluatedPropsToName)(o,u.props));let{props:y}=u;for(let t of p)h&&function(t){for(let r in h)new RegExp(t).test(r)&&(0,i.checkStrictMode)(u,`property ${r} matches pattern ${t} (use allowMatchingProperties)`)}(t),u.allErrors?g(t):(o.var(f,!0),g(t),o.if(f));function g(i){o.forIn("key",l,s=>{o.if((0,a._)`${(0,r.usePattern)(t,i)}.test(${s})`,()=>{let r=m.includes(i);r||t.subschema({keyword:"patternProperties",schemaProp:i,dataProp:s,dataPropType:n.Type.Str},f),u.opts.unevaluated&&!0!==y?o.assign((0,a._)`${y}[${s}]`,!0):r||u.allErrors||o.if((0,a.not)(f),()=>o.break())})})}}}}),dl=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uS();t.default={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:a,schema:i,it:n}=t;if((0,r.alwaysValidSchema)(n,i))return void t.fail();let o=a.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),t.failResult(o,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}}}),dc=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:uO().validateUnion,error:{message:"must match a schema in anyOf"}}}),du=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ub(),a=uS();t.default={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:t})=>(0,r._)`{passingSchemas: ${t.passing}}`},code(t){let{gen:i,schema:n,parentSchema:o,it:s}=t;if(!Array.isArray(n))throw Error("ajv implementation error");if(s.opts.discriminator&&o.discriminator)return;let l=i.let("valid",!1),c=i.let("passing",null),u=i.name("_valid");t.setParams({passing:c}),i.block(function(){n.forEach((n,o)=>{let d;(0,a.alwaysValidSchema)(s,n)?i.var(u,!0):d=t.subschema({keyword:"oneOf",schemaProp:o,compositeRule:!0},u),o>0&&i.if((0,r._)`${u} && ${l}`).assign(l,!1).assign(c,(0,r._)`[${c}, ${o}]`).else(),i.if(u,()=>{i.assign(l,!0),i.assign(c,o),d&&t.mergeEvaluated(d,r.Name)})})}),t.result(l,()=>t.reset(),()=>t.error(!0))}}}),dd=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uS();t.default={keyword:"allOf",schemaType:"array",code(t){let{gen:a,schema:i,it:n}=t;if(!Array.isArray(i))throw Error("ajv implementation error");let o=a.name("valid");i.forEach((a,i)=>{if((0,r.alwaysValidSchema)(n,a))return;let s=t.subschema({keyword:"allOf",schemaProp:i},o);t.ok(o),t.mergeEvaluated(s)})}}}),dp=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ub(),a=uS();function i(t,r){let i=t.schema[r];return void 0!==i&&!(0,a.alwaysValidSchema)(t,i)}t.default={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:t})=>(0,r.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,r._)`{failingKeyword: ${t.ifClause}}`},code(t){let n,{gen:o,parentSchema:s,it:l}=t;void 0===s.then&&void 0===s.else&&(0,a.checkStrictMode)(l,'"if" without "then" and "else" is ignored');let c=i(l,"then"),u=i(l,"else");if(!c&&!u)return;let d=o.let("valid",!0),p=o.name("_valid");if(n=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},p),t.mergeEvaluated(n),t.reset(),c&&u){let r=o.let("ifClause");t.setParams({ifClause:r}),o.if(p,m("then",r),m("else",r))}else c?o.if(p,m("then")):o.if((0,r.not)(p),m("else"));function m(a,i){return()=>{let n=t.subschema({keyword:a},p);o.assign(d,p),t.mergeValidEvaluated(n,d),i?o.assign(i,(0,r._)`${a}`):t.setParams({ifClause:a})}}t.pass(d,()=>t.error(!0))}}}),dm=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uS();t.default={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:a,it:i}){void 0===a.if&&(0,r.checkStrictMode)(i,`"${t}" without "if" is ignored`)}}}),dh=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u5(),a=u7(),i=u8(),n=de(),o=dt(),s=dr(),l=da(),c=di(),u=dn(),d=ds(),p=dl(),m=dc(),h=du(),f=dd(),y=dp(),g=dm();t.default=function(t=!1){let v=[p.default,m.default,h.default,f.default,y.default,g.default,l.default,c.default,s.default,u.default,d.default];return t?v.push(a.default,n.default):v.push(r.default,i.default),v.push(o.default),v}}),df=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ub();t.default={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,r.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,r._)`{format: ${t}}`},code(t,a){let i,n,o,s,l,c,{gen:u,data:d,$data:p,schema:m,schemaCode:h,it:f}=t,{opts:y,errSchemaPath:g,schemaEnv:v,self:_}=f;y.validateFormats&&(p?(i=u.scopeValue("formats",{ref:_.formats,code:y.code.formats}),n=u.const("fDef",(0,r._)`${i}[${h}]`),o=u.let("fType"),s=u.let("format"),u.if((0,r._)`typeof ${n} == "object" && !(${n} instanceof RegExp)`,()=>u.assign(o,(0,r._)`${n}.type || "string"`).assign(s,(0,r._)`${n}.validate`),()=>u.assign(o,(0,r._)`"string"`).assign(s,n)),t.fail$data((0,r.or)(!1===y.strictSchema?r.nil:(0,r._)`${h} && !${s}`,(l=v.$async?(0,r._)`(${n}.async ? await ${s}(${d}) : ${s}(${d}))`:(0,r._)`${s}(${d})`,c=(0,r._)`(typeof ${s} == "function" ? ${l} : ${s}.test(${d}))`,(0,r._)`${s} && ${s} !== true && ${o} === ${a} && !${c}`)))):function(){var i;let n,o,s=_.formats[m];if(!s){if(!1===y.strictSchema)return _.logger.warn(l());throw Error(l());function l(){return`unknown format "${m}" ignored in schema at path "${g}"`}}if(!0===s)return;let[c,p,h]=(n=(i=s)instanceof RegExp?(0,r.regexpCode)(i):y.code.formats?(0,r._)`${y.code.formats}${(0,r.getProperty)(m)}`:void 0,o=u.scopeValue("formats",{key:m,ref:i,code:n}),"object"!=typeof i||i instanceof RegExp?["string",i,o]:[i.type||"string",i.validate,(0,r._)`${o}.validate`]);c===a&&t.pass(function(){if("object"==typeof s&&!(s instanceof RegExp)&&s.async){if(!v.$async)throw Error("async format in sync schema");return(0,r._)`await ${h}(${d})`}return"function"==typeof p?(0,r._)`${h}(${d})`:(0,r._)`${h}.test(${d})`}())}())}}}),dy=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=[df().default]}),dg=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contentVocabulary=t.metadataVocabulary=void 0,t.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],t.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),dv=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uK(),a=u3(),i=dh(),n=dy(),o=dg();t.default=[r.default,a.default,(0,i.default)(),n.default,o.metadataVocabulary,o.contentVocabulary]}),d_=F(t=>{var r,a;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,(a=r||(t.DiscrError=r={})).Tag="tag",a.Mapping="mapping"}),db=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ub(),a=d_(),i=uM(),n=uA(),o=uS();t.default={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:t,tagName:r}})=>t===a.DiscrError.Tag?`tag "${r}" must be string`:`value of tag "${r}" must be in oneOf`,params:({params:{discrError:t,tag:a,tagName:i}})=>(0,r._)`{error: ${t}, tag: ${i}, tagValue: ${a}}`},code(t){let{gen:s,data:l,schema:c,parentSchema:u,it:d}=t,{oneOf:p}=u;if(!d.opts.discriminator)throw Error("discriminator: requires discriminator option");let m=c.propertyName;if("string"!=typeof m)throw Error("discriminator: requires propertyName");if(c.mapping)throw Error("discriminator: mapping is not supported");if(!p)throw Error("discriminator: requires oneOf keyword");let h=s.let("valid",!1),f=s.const("tag",(0,r._)`${l}${(0,r.getProperty)(m)}`);s.if((0,r._)`typeof ${f} == "string"`,()=>(function(){let l=function(){var t;let r={},a=l(u),s=!0;for(let r=0;r<p.length;r++){let u=p[r];if((null==u?void 0:u.$ref)&&!(0,o.schemaHasRulesButRef)(u,d.self.RULES)){let t=u.$ref;if((u=i.resolveRef.call(d.self,d.schemaEnv.root,d.baseId,t))instanceof i.SchemaEnv&&(u=u.schema),void 0===u)throw new n.default(d.opts.uriResolver,d.baseId,t)}let h=null==(t=null==u?void 0:u.properties)?void 0:t[m];if("object"!=typeof h)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${m}"`);s=s&&(a||l(u)),function(t,r){if(t.const)c(t.const,r);else if(t.enum)for(let a of t.enum)c(a,r);else throw Error(`discriminator: "properties/${m}" must have "const" or "enum"`)}(h,r)}if(!s)throw Error(`discriminator: "${m}" must be required`);return r;function l({required:t}){return Array.isArray(t)&&t.includes(m)}function c(t,a){if("string"!=typeof t||t in r)throw Error(`discriminator: "${m}" values must be unique strings`);r[t]=a}}();for(let a in s.if(!1),l)s.elseIf((0,r._)`${f} === ${a}`),s.assign(h,function(a){let i=s.name("valid"),n=t.subschema({keyword:"oneOf",schemaProp:a},i);return t.mergeEvaluated(n,r.Name),i}(l[a]));s.else(),t.error(!1,{discrError:a.DiscrError.Mapping,tag:f,tagName:m}),s.endIf()})(),()=>t.error(!1,{discrError:a.DiscrError.Tag,tag:f,tagName:m})),t.ok(h)}}}),dS=F((t,r)=>{r.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}),d$=F((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv=void 0;let a=uU(),i=dv(),n=db(),o=dS(),s=["/properties"],l="http://json-schema.org/draft-07/schema";var c=class extends a.default{_addVocabularies(){super._addVocabularies(),i.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(n.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(o,s):o;this.addMetaSchema(t,l,!1),this.refs["http://json-schema.org/schema"]=l}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}};t.Ajv=c,r.exports=t=c,r.exports.Ajv=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var u=uq();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=ub();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var p=uz();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return p.default}});var m=uA();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return m.default}})}),dw=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicAnchor=void 0;let r=ub(),a=u$(),i=uM(),n=uH();function o(t,o){let{gen:s,it:l}=t;l.schemaEnv.root.dynamicAnchors[o]=!0;let c=(0,r._)`${a.default.dynamicAnchors}${(0,r.getProperty)(o)}`,u="#"===l.errSchemaPath?l.validateName:function(t){let{schemaEnv:r,schema:a,self:o}=t.it,{root:s,baseId:l,localRefs:c,meta:u}=r.root,{schemaId:d}=o.opts,p=new i.SchemaEnv({schema:a,schemaId:d,root:s,baseId:l,localRefs:c,meta:u});return i.compileSchema.call(o,p),(0,n.getValidate)(t,p)}(t);s.if((0,r._)`!${c}`,()=>s.assign(c,u))}t.dynamicAnchor=o,t.default={keyword:"$dynamicAnchor",schemaType:"string",code:t=>o(t,t.schema)}}),dk=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicRef=void 0;let r=ub(),a=u$(),i=uH();function n(t,n){let{gen:o,keyword:s,it:l}=t;if("#"!==n[0])throw Error(`"${s}" only supports hash fragment reference`);let c=n.slice(1);if(l.allErrors)u();else{let r=o.let("valid",!1);u(r),t.ok(r)}function u(t){if(l.schemaEnv.root.dynamicAnchors[c]){let i=o.let("_v",(0,r._)`${a.default.dynamicAnchors}${(0,r.getProperty)(c)}`);o.if(i,d(i,t),d(l.validateName,t))}else d(l.validateName,t)()}function d(r,a){return a?()=>o.block(()=>{(0,i.callRef)(t,r),o.let(a,!0)}):()=>(0,i.callRef)(t,r)}}t.dynamicRef=n,t.default={keyword:"$dynamicRef",schemaType:"string",code:t=>n(t,t.schema)}}),dx=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dw(),a=uS();t.default={keyword:"$recursiveAnchor",schemaType:"boolean",code(t){t.schema?(0,r.dynamicAnchor)(t,""):(0,a.checkStrictMode)(t.it,"$recursiveAnchor: false is ignored")}}}),dR=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dk();t.default={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,r.dynamicRef)(t,t.schema)}}),dP=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dw(),a=dk(),i=dx(),n=dR();t.default=[r.default,a.default,i.default,n.default]}),dE=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dr();t.default={keyword:"dependentRequired",type:"object",schemaType:"object",error:r.error,code:t=>(0,r.validatePropertyDeps)(t)}}),dO=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dr();t.default={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,r.validateSchemaDeps)(t)}}),dT=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uS();t.default={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:t,parentSchema:a,it:i}){void 0===a.contains&&(0,r.checkStrictMode)(i,`"${t}" without "contains" is ignored`)}}}),dj=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dE(),a=dO(),i=dT();t.default=[r.default,a.default,i.default]}),dN=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ub(),a=uS(),i=u$();t.default={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:t})=>(0,r._)`{unevaluatedProperty: ${t.unevaluatedProperty}}`},code(t){let{gen:n,schema:o,data:s,errsCount:l,it:c}=t;if(!l)throw Error("ajv implementation error");let{allErrors:u,props:d}=c;function p(i){if(!1===o){t.setParams({unevaluatedProperty:i}),t.error(),u||n.break();return}if(!(0,a.alwaysValidSchema)(c,o)){let o=n.name("valid");t.subschema({keyword:"unevaluatedProperties",dataProp:i,dataPropType:a.Type.Str},o),u||n.if((0,r.not)(o),()=>n.break())}}d instanceof r.Name?n.if((0,r._)`${d} !== true`,()=>n.forIn("key",s,t=>{var a,i;return n.if((a=d,i=t,(0,r._)`!${a} || !${a}[${i}]`),()=>p(t))})):!0!==d&&n.forIn("key",s,t=>void 0===d?p(t):n.if(function(t,a){let i=[];for(let n in t)!0===t[n]&&i.push((0,r._)`${a} !== ${n}`);return(0,r.and)(...i)}(d,t),()=>p(t))),c.props=!0,t.ok((0,r._)`${l} === ${i.default.errors}`)}}}),dC=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ub(),a=uS();t.default={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:t}})=>(0,r.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,r._)`{limit: ${t}}`},code(t){let{gen:i,schema:n,data:o,it:s}=t,l=s.items||0;if(!0===l)return;let c=i.const("len",(0,r._)`${o}.length`);if(!1===n)t.setParams({len:l}),t.fail((0,r._)`${c} > ${l}`);else if("object"==typeof n&&!(0,a.alwaysValidSchema)(s,n)){let n=i.var("valid",(0,r._)`${c} <= ${l}`);i.if((0,r.not)(n),()=>{var o,u;return o=n,u=l,void i.forRange("i",u,c,n=>{t.subschema({keyword:"unevaluatedItems",dataProp:n,dataPropType:a.Type.Num},o),s.allErrors||i.if((0,r.not)(o),()=>i.break())})}),t.ok(n)}s.items=!0}}}),dI=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dN(),a=dC();t.default=[r.default,a.default]}),dq=F((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/schema",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format"},{$ref:"meta/content"}],type:["object","boolean"],properties:{definitions:{$comment:"While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},dependencies:{$comment:'"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"',type:"object",additionalProperties:{anyOf:[{$recursiveRef:"#"},{$ref:"meta/validation#/$defs/stringArray"}]}}}}}),dz=F((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/applicator":!0},$recursiveAnchor:!0,title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{additionalItems:{$recursiveRef:"#"},unevaluatedItems:{$recursiveRef:"#"},items:{anyOf:[{$recursiveRef:"#"},{$ref:"#/$defs/schemaArray"}]},contains:{$recursiveRef:"#"},additionalProperties:{$recursiveRef:"#"},unevaluatedProperties:{$recursiveRef:"#"},properties:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$recursiveRef:"#"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$recursiveRef:"#"}},propertyNames:{$recursiveRef:"#"},if:{$recursiveRef:"#"},then:{$recursiveRef:"#"},else:{$recursiveRef:"#"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$recursiveRef:"#"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$recursiveRef:"#"}}}}}),dA=F((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/content",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentMediaType:{type:"string"},contentEncoding:{type:"string"},contentSchema:{$recursiveRef:"#"}}}}),dM=F((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/core",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0},$recursiveAnchor:!0,title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{type:"string",format:"uri"},$anchor:{type:"string",pattern:"^[A-Za-z][-A-Za-z0-9.:_]*$"},$ref:{type:"string",format:"uri-reference"},$recursiveRef:{type:"string",format:"uri-reference"},$recursiveAnchor:{type:"boolean",default:!1},$vocabulary:{type:"object",propertyNames:{type:"string",format:"uri"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}}}}}),dL=F((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/format",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:"Format vocabulary meta-schema",type:["object","boolean"],properties:{format:{type:"string"}}}}),dD=F((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},$recursiveAnchor:!0,title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),dZ=F((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/validation",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/validation":!0},$recursiveAnchor:!0,title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}},const:!0,enum:{type:"array",items:!0},type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),dV=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dq(),a=dz(),i=dA(),n=dM(),o=dL(),s=dD(),l=dZ(),c=["/properties"];t.default=function(t){return[r,a,i,n,u(this,o),s,u(this,l)].forEach(t=>this.addMetaSchema(t,void 0,!1)),this;function u(r,a){return t?r.$dataMetaSchema(a,c):a}}}),dF=F((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv2019=void 0;let a=uU(),i=dv(),n=dP(),o=dj(),s=dI(),l=db(),c=dV(),u="https://json-schema.org/draft/2019-09/schema";var d=class extends a.default{constructor(t={}){super({...t,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(n.default),i.default.forEach(t=>this.addVocabulary(t)),this.addVocabulary(o.default),this.addVocabulary(s.default),this.opts.discriminator&&this.addKeyword(l.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:t,meta:r}=this.opts;r&&(c.default.call(this,t),this.refs["http://json-schema.org/schema"]=u)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(u)?u:void 0)}};t.Ajv2019=d,r.exports=t=d,r.exports.Ajv2019=d,Object.defineProperty(t,"__esModule",{value:!0}),t.default=d;var p=uq();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return p.KeywordCxt}});var m=ub();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return m._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return m.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return m.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return m.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return m.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return m.CodeGen}});var h=uz();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return h.default}});var f=uA();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return f.default}})}),dU=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uK(),a=u3(),i=dh(),n=dP(),o=dj(),s=dI(),l=dy(),c=dg();t.default=[n.default,r.default,a.default,(0,i.default)(!0),l.default,c.metadataVocabulary,c.contentVocabulary,o.default,s.default]}),dJ=F((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}}),dH=F((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}}),dK=F((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}}),dB=F((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}}),dW=F((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}}),dG=F((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}}),dY=F((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),dX=F((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),dQ=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dJ(),a=dH(),i=dK(),n=dB(),o=dW(),s=dG(),l=dY(),c=dX(),u=["/properties"];t.default=function(t){return[r,a,i,n,o,d(this,s),l,d(this,c)].forEach(t=>this.addMetaSchema(t,void 0,!1)),this;function d(r,a){return t?r.$dataMetaSchema(a,u):a}}}),d0=F((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv2020=void 0;let a=uU(),i=dU(),n=db(),o=dQ(),s="https://json-schema.org/draft/2020-12/schema";var l=class extends a.default{constructor(t={}){super({...t,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),i.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(n.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:t,meta:r}=this.opts;r&&(o.default.call(this,t),this.refs["http://json-schema.org/schema"]=s)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};t.Ajv2020=l,r.exports=t=l,r.exports.Ajv2020=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var c=uq();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=ub();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var d=uz();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.default}});var p=uA();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}),d1=F(t=>{function r(t,r){return{validate:t,compare:r}}Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0,t.fullFormats={date:r(n,o),time:r(l(!0),c),"date-time":r(p(!0),m),"iso-time":r(l(),u),"iso-date-time":r(p(),h),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(t){return f.test(t)&&y.test(t)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:function(t){if(S.test(t))return!1;try{return new RegExp(t),!0}catch(t){return!1}},uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:function(t){return g.lastIndex=0,g.test(t)},int32:{type:"number",validate:function(t){return Number.isInteger(t)&&t<=_&&t>=v}},int64:{type:"number",validate:function(t){return Number.isInteger(t)}},float:{type:"number",validate:b},double:{type:"number",validate:b},password:!0,binary:!0},t.fastFormats={...t.fullFormats,date:r(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,c),"date-time":r(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,m),"iso-time":r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":r(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,h),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},t.formatNames=Object.keys(t.fullFormats);let a=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function n(t){var r;let n=a.exec(t);if(!n)return!1;let o=+n[1],s=+n[2],l=+n[3];return s>=1&&s<=12&&l>=1&&l<=(2===s&&(r=o)%4==0&&(r%100!=0||r%400==0)?29:i[s])}function o(t,r){if(t&&r)return t>r?1:t<r?-1:0}let s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function l(t){return function(r){let a=s.exec(r);if(!a)return!1;let i=+a[1],n=+a[2],o=+a[3],l=a[4],c="-"===a[5]?-1:1,u=+(a[6]||0),d=+(a[7]||0);if(u>23||d>59||t&&!l)return!1;if(i<=23&&n<=59&&o<60)return!0;let p=n-d*c,m=i-u*c-(p<0);return(23===m||-1===m)&&(59===p||-1===p)&&o<61}}function c(t,r){if(!(t&&r))return;let a=new Date("2020-01-01T"+t).valueOf(),i=new Date("2020-01-01T"+r).valueOf();if(a&&i)return a-i}function u(t,r){if(!(t&&r))return;let a=s.exec(t),i=s.exec(r);if(a&&i)return(t=a[1]+a[2]+a[3])>(r=i[1]+i[2]+i[3])?1:t<r?-1:0}let d=/t|\s/i;function p(t){let r=l(t);return function(t){let a=t.split(d);return 2===a.length&&n(a[0])&&r(a[1])}}function m(t,r){if(!(t&&r))return;let a=new Date(t).valueOf(),i=new Date(r).valueOf();if(a&&i)return a-i}function h(t,r){if(!(t&&r))return;let[a,i]=t.split(d),[n,s]=r.split(d),l=o(a,n);if(void 0!==l)return l||c(i,s)}let f=/\/|:/,y=/^(?:[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,v=-0x80000000,_=0x80000000-1;function b(){return!0}let S=/[^\\]\\Z/}),d2=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;let r=d$(),a=ub(),i=a.operators,n={formatMaximum:{okStr:"<=",ok:i.LTE,fail:i.GT},formatMinimum:{okStr:">=",ok:i.GTE,fail:i.LT},formatExclusiveMaximum:{okStr:"<",ok:i.LT,fail:i.GTE},formatExclusiveMinimum:{okStr:">",ok:i.GT,fail:i.LTE}};t.formatLimitDefinition={keyword:Object.keys(n),type:"string",schemaType:"string",$data:!0,error:{message:({keyword:t,schemaCode:r})=>(0,a.str)`should be ${n[t].okStr} ${r}`,params:({keyword:t,schemaCode:r})=>(0,a._)`{comparison: ${n[t].okStr}, limit: ${r}}`},code(t){let i,o,{gen:s,data:l,schemaCode:c,keyword:u,it:d}=t,{opts:p,self:m}=d;if(!p.validateFormats)return;let h=new r.KeywordCxt(d,m.RULES.all.format.definition,"format");function f(t){return(0,a._)`${t}.compare(${l}, ${c}) ${n[u].fail} 0`}h.$data?(i=s.scopeValue("formats",{ref:m.formats,code:p.code.formats}),o=s.const("fmt",(0,a._)`${i}[${h.schemaCode}]`),t.fail$data((0,a.or)((0,a._)`typeof ${o} != "object"`,(0,a._)`${o} instanceof RegExp`,(0,a._)`typeof ${o}.compare != "function"`,f(o)))):function(){let r=h.schema,i=m.formats[r];if(!i||!0===i)return;if("object"!=typeof i||i instanceof RegExp||"function"!=typeof i.compare)throw Error(`"${u}": format "${r}" does not define "compare" function`);let n=s.scopeValue("formats",{key:r,ref:i,code:p.code.formats?(0,a._)`${p.code.formats}${(0,a.getProperty)(r)}`:void 0});t.fail$data(f(n))}()},dependencies:["format"]},t.default=r=>(r.addKeyword(t.formatLimitDefinition),r)}),d9=F((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});let a=d1(),i=d2(),n=ub(),o=new n.Name("fullFormats"),s=new n.Name("fastFormats"),l=(t,r={keywords:!0})=>{if(Array.isArray(r))return c(t,r,a.fullFormats,o),t;let[n,l]="fast"===r.mode?[a.fastFormats,s]:[a.fullFormats,o];return c(t,r.formats||a.formatNames,n,l),r.keywords&&(0,i.default)(t),t};function c(t,r,a,i){var o;for(let s of(null!=(o=t.opts.code).formats||(o.formats=(0,n._)`require("ajv-formats/dist/formats").${i}`),r))t.addFormat(s,a[s])}l.get=(t,r="full")=>{let i=("fast"===r?a.fastFormats:a.fullFormats)[t];if(!i)throw Error(`Unknown format "${t}"`);return i},r.exports=t=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l}),d4=d$(),d6=dF(),d3=d0();let d5=((t,r,a,i)=>{if(r&&"object"==typeof r||"function"==typeof r)for(var n,o=D(r),s=0,l=o.length;s<l;s++)n=o[s],V.call(t,n)||n===a||M(t,n,{get:(t=>r[t]).bind(null,n),enumerable:!(i=L(r,n))||i.enumerable});return t})(M(null!=(S=d9())?A(Z(S)):{},"default",{value:S,enumerable:!0}),S).default;function d8(t){let r=new t({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return d5(r),r}var d7=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(t){this._userAjv=void 0!==t,this._ajv=t}get ajv(){return this._ajv??=d8(d3.Ajv2020)}_engineFor(t){if(this._userAjv)return this.ajv;let r=function(t,r){if(!("$schema"in t)||"string"!=typeof t.$schema)return"2020-12";let a=t.$schema.replace(/#$/,"");if(U.has(a))return"2020-12";if(J.has(a))return"2019-09";if(H.has(a)||K.has(a))return"draft-7";throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${t.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${r}`)}(t,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");return"2020-12"===r?this.ajv:"2019-09"===r?this._ajv2019??=d8(d6.Ajv2019):this._ajvDraft7??=d8(d4.Ajv)}getValidator(t){let r=this._engineFor(t),a="$id"in t&&"string"==typeof t.$id?r.getSchema(t.$id)??r.compile(t):r.compile(t);return t=>a(t)?{valid:!0,data:t,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:r.errorsText(a.errors)}}};d4.Ajv;let pe=require("node:process");var pt=a.n(pe);let pr=Symbol.for("mcp.completable");function pa(t){return!!t&&"object"==typeof t&&pr in t}function pi(t,r){return{method:t.method,params:{...t.params,_meta:{...t.params?._meta,[nK]:r}}}}let pn=new Set(["notifications/tools/list_changed","notifications/prompts/list_changed","notifications/resources/list_changed","notifications/resources/updated"]);var po=class{_subs=new Map;_serverCapabilities;_serverInfo;constructor(t=1024,r,a){this._maxSubscriptions=t,this._serverCapabilities=r,this._serverInfo=a}setServerCapabilities(t,r){this._serverCapabilities=t,void 0!==r&&(this._serverInfo=r)}has(t){return this._subs.has(t)}serve(t){var r;let a,i,n;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:t.id,error:{code:-32603,message:"Subscription limit reached"}};let o=(a=cT(cO).validateRequest("subscriptions/listen",t)).ok?a.value.params?.notifications:void 0;if(void 0===o)return{jsonrpc:"2.0",id:t.id,error:{code:-32602,message:"Invalid params: 'notifications' is required and must be a valid SubscriptionFilter"}};let s=(r=this._serverCapabilities,i={},n=t=>void 0===r||!0===t,!0===o.toolsListChanged&&n(r?.tools?.listChanged)&&(i.toolsListChanged=!0),!0===o.promptsListChanged&&n(r?.prompts?.listChanged)&&(i.promptsListChanged=!0),!0===o.resourcesListChanged&&n(r?.resources?.listChanged)&&(i.resourcesListChanged=!0),void 0!==o.resourceSubscriptions&&o.resourceSubscriptions.length>0&&n(r?.resources?.subscribe)&&(i.resourceSubscriptions=[...o.resourceSubscriptions]),i);return this._subs.set(t.id,s),pi({method:"notifications/subscriptions/acknowledged",params:{notifications:s}},t.id)}cancel(t){return this._subs.delete(t)}routeOutbound(t){if(!pn.has(t.method))return"passthrough";let r=t.params?.uri,a=function(t,r){switch(t){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:r??""}}}(t.method,"string"==typeof r?r:void 0),i=[];for(let[r,n]of this._subs)(function(t,r){switch(r.kind){case"tools_list_changed":return!0===t.toolsListChanged;case"prompts_list_changed":return!0===t.promptsListChanged;case"resources_list_changed":return!0===t.resourcesListChanged;case"resource_updated":return void 0!==t.resourceSubscriptions&&t.resourceSubscriptions.includes(r.uri)}})(n,a)&&i.push(pi({method:t.method,params:t.params??{}},r));return i}teardownAll(){let t=[];for(let r of this._subs.keys())t.push({jsonrpc:"2.0",id:r,result:{resultType:"complete",_meta:{[nK]:r,...void 0!==this._serverInfo&&{[nJ]:this._serverInfo}}}});return this._subs.clear(),t}};function ps(t,r,a){if(null===a||"object"!=typeof a||"string"!=typeof a.method)throw new cu(cc.InternalError,`Handler for ${t} returned an invalid input request '${r}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);let i=function(t){switch(t.method){case"elicitation/create":if(t.params?.mode==="url")return{elicitation:{url:{}}};return{elicitation:{form:{}}};case"sampling/createMessage":{let r=t.params;if(void 0!==r&&(void 0!==r.tools||void 0!==r.toolChoice))return{sampling:{tools:{}}};return{sampling:{}}}case"roots/list":return{roots:{}};default:return}}(a);if(void 0===i)throw new cu(cc.InternalError,`Handler for ${t} returned an input request '${r}' of kind '${a.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:a,required:i}}function pl(t,r){if("tools/call"===t)return{content:[{type:"text",text:r}],isError:!0};throw new cu(cc.InternalError,r)}var pc=class{constructor(t){this._host=t}async fulfill(t,r,a,i,n){let{maxRounds:o,roundTimeoutMs:s}=this._host,l=i.mcpReq.signal,c=n,u=0;for(;;){let n;if((u+=1)>o)return pl(t,`Multi-round-trip request '${t}' still required input after ${o} rounds (inputRequired.maxRounds)`);let d=c.inputRequests,p=null!=d&&Object.keys(d).length>0,m="string"==typeof c.requestState?c.requestState:void 0;if(!p&&void 0===m)throw new cu(cc.InternalError,`Handler for ${t} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(p){let r=this._host.resolvedClientCapabilities(i),a=[];for(let[i,n]of Object.entries(d)){let{embedded:o,required:s}=ps(t,i,n);if("roots/list"!==o.method&&void 0===o.params)throw new cu(cc.InternalError,`Handler for ${t} returned an input request '${i}' of kind '${o.method}' without params`);if(void 0!==lF(s,r))return pl(t,`Cannot request input '${i}' (${o.method}): the client on this 2025-era connection did not declare the required capability${void 0===r?" (no client capabilities are available on this connection — per-request legacy serving cannot receive server-to-client requests)":""}`);a.push([i,o])}let o=function(t){let r=new AbortController,a=()=>r.abort(t?.reason);return t?.addEventListener("abort",a,{once:!0}),t?.aborted&&r.abort(t.reason),{signal:r.signal,abort:t=>r.abort(t),dispose:()=>t?.removeEventListener("abort",a)}}(l);try{let t={relatedRequestId:i.mcpReq.id,timeout:s,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:o.signal},r=await Promise.all(a.map(async([r,a])=>{try{return[r,await this._dispatchLeg(a,t)]}catch(t){throw o.abort(t),t}}));n=Object.fromEntries(r)}catch(r){if(l.aborted)throw r;return pl(t,`Fulfilling input required by '${t}' failed: ${r instanceof Error?r.message:String(r)}`)}finally{o.dispose()}}else await function(t,r){return new Promise((t,a)=>{if(r?.aborted)return void a(r.reason instanceof lZ?r.reason:new lZ(lD.RequestTimeout,String(r.reason)));let i=setTimeout(()=>{r?.removeEventListener("abort",n),t()},250),n=()=>{clearTimeout(i),a(r?.reason instanceof lZ?r.reason:new lZ(lD.RequestTimeout,String(r?.reason)))};r?.addEventListener("abort",n,{once:!0})})}(0,l);let h={...i,mcpReq:{...i.mcpReq,inputResponses:n,droppedInputResponseKeys:void 0,requestState:function(t){return()=>t}(m)}};if(void 0!==m){let r=await this._host.verifyRequestState(m,h,t);void 0!==r&&(h=uc(h,r))}let f=await r(a,h);if(!cV(f))return f;c=f}}async _dispatchLeg(t,r){switch(t.method){case"elicitation/create":{let a=t.params;return"url"===a.mode&&void 0===a.elicitationId&&(a={...a,elicitationId:function(){let t=globalThis.crypto;if(t?.randomUUID!==void 0)return t.randomUUID();let r=new Uint8Array(16);t.getRandomValues(r),r[6]=15&r[6]|64,r[8]=63&r[8]|128;let a=[...r].map(t=>t.toString(16).padStart(2,"0")).join("");return`${a.slice(0,8)}-${a.slice(8,12)}-${a.slice(12,16)}-${a.slice(16,20)}-${a.slice(20)}`}()}),await this._host.sendElicitation(a,r)}case"sampling/createMessage":return await this._host.sendSampling(t.params,r);case"roots/list":return await this._host.listRoots(t.params,r)}}};let pu=new Set(["tools/call","prompts/get","resources/read"]);var pd=class extends uu{_clientCapabilities;_clientVersion;static{u=(t,r)=>{let a=r.filter(r=>!t._supportedProtocolVersions.includes(r));a.length>0&&(t._supportedProtocolVersions=[...t._supportedProtocolVersions,...a]),t.setRequestHandler("server/discover",()=>t._ondiscover())},d=t=>t._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new pc({maxRounds:this._inputRequiredServing.maxRounds,roundTimeoutMs:this._inputRequiredServing.roundTimeoutMs,resolvedClientCapabilities:t=>this._inputRequestCapabilityView(t),verifyRequestState:(t,r,a)=>this._verifyRequestState(t,r,a),sendElicitation:(t,r)=>this._sendElicitationLeg(t,r,{validateAcceptedContent:!1}),sendSampling:(t,r)=>this.createMessage(t,r),listRoots:(t,r)=>this.listRoots(t,r)})}oninitialized;constructor(t,r){if(super(r),this._serverInfo=t,this._capabilities=r?.capabilities?{...r.capabilities}:{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new d7,this._requestStateVerify=r?.requestState?.verify,this._inputRequiredServing=function(t){if(t?.maxRounds!==void 0&&(!Number.isInteger(t.maxRounds)||t.maxRounds<1))throw RangeError(`inputRequired.maxRounds must be a positive integer (got ${t.maxRounds})`);if(t?.roundTimeoutMs!==void 0&&(!Number.isFinite(t.roundTimeoutMs)||t.roundTimeoutMs<=0))throw RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${t.roundTimeoutMs})`);return{maxRounds:t?.maxRounds??8,roundTimeoutMs:t?.roundTimeoutMs??6e5,legacyShim:t?.legacyShim??!0}}(r?.inputRequired),r?.cacheHints!==void 0){for(const[t,a]of Object.entries(r.cacheHints))void 0!==a&&cl(a,`cacheHints['${t}']`);this._cacheHints=r.cacheHints}this.setRequestHandler("initialize",t=>this._oninitialize(t)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),lH(this._supportedProtocolVersions).length>0&&this.setRequestHandler("server/discover",()=>this._ondiscover()),this._capabilities.logging&&this._registerLoggingHandler()}_registerLoggingHandler(){this.setRequestHandler("logging/setLevel",async(t,r)=>{let a=r.sessionId||r.http?.req?.headers.get("mcp-session-id")||void 0,{level:i}=t.params,n=iv(sw,i);return n.success&&this._loggingLevels.set(a,n.data),{}})}buildContext(t,r){let a=t.http||r?.request||r?.closeSSEStream||r?.closeStandaloneSSEStream;return{...t,mcpReq:{...t.mcpReq,log:(r,a,i)=>{let n;if(!this._capabilities.logging)return Promise.resolve();if(this._servedModernEra()){if(void 0===(n=t.mcpReq.envelope?.[nB]))return Promise.resolve()}else n=this._loggingLevels.get(t.sessionId)??this._loggingLevels.get(void 0);return void 0!==n&&this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(n)?Promise.resolve():t.mcpReq.notify({method:"notifications/message",params:{level:r,data:a,logger:i}})},elicitInput:(t,r)=>this.elicitInput(t,r),requestSampling:(t,r)=>this.createMessage(t,r)},http:a?{...t.http,req:r?.request,closeSSE:r?.closeSSEStream,closeStandaloneSSE:r?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map(sw.options.map((t,r)=>[t,r]));isMessageIgnored=(t,r)=>{let a=this._loggingLevels.get(r);return!!a&&this.LOG_LEVEL_SEVERITY.get(t)<this.LOG_LEVEL_SEVERITY.get(a)};registerCapabilities(t){if(this.transport)throw new lZ(lD.AlreadyConnected,"Cannot register capabilities after connecting to transport");let r=!!this._capabilities.logging;this._capabilities=function(t,r){let a={...t};for(let t in r){let i=r[t];if(void 0===i)continue;let n=a[t];a[t]=ud(n)&&ud(i)?{...n,...i}:i}return a}(this._capabilities,t),!r&&this._capabilities.logging&&this._registerLoggingHandler()}_wrapHandler(t,r){if("tools/call"!==t){let a=this._cacheHints?.[t],i=pu.has(t);return void 0!==a||i?async(n,o)=>{let s=i?await this._invokeInputRequiredCapableHandler(t,r,n,o):await r(n,o);if(cV(s)){if(!i)throw new cu(cc.InternalError,`Handler for ${t} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return s}return void 0===a?s:cn(s,a)}:async(a,i)=>{let n=await r(a,i);if(cV(n))throw new cu(cc.InternalError,`Handler for ${t} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return n}}return async(t,a)=>{let i=cT(this._negotiatedProtocolVersion),n=i.validateRequest("tools/call",t);if(!n.ok)throw new cu("not-in-era"===n.reason?cc.InternalError:cc.InvalidParams,"not-in-era"===n.reason?"No wire schema for tools/call in the resolved era":`Invalid tools/call request: ${n.message}`);let o=await this._invokeInputRequiredCapableHandler("tools/call",r,t,a);if(cV(o))return o;let s=lW(o),l=i.validateResult("tools/call",s);if(!l.ok)throw new cu("not-in-era"===l.reason?cc.InternalError:cc.InvalidParams,"not-in-era"===l.reason?"No wire schema for tools/call in the resolved era":`Invalid tools/call result: ${l.message}`);return l.value}}_servedModernEra(){return void 0!==this._negotiatedProtocolVersion&&this._negotiatedProtocolVersion>=lU}async _invokeInputRequiredCapableHandler(t,r,a,i){let n,o=this._servedModernEra(),s=i.mcpReq.requestState();if(void 0!==s&&"string"!=typeof s)throw new cu(cc.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"});let l=i;if("string"==typeof s){let r=await this._verifyRequestState(s,i,t);void 0!==r&&(l=uc(i,r))}try{n=await r(a,l)}catch(t){if(t instanceof cu&&t.code===cc.UrlElicitationRequired){if(!o)throw t;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 t}if(!cV(n))return n;if(!o){if(!this._inputRequiredServing.legacyShim)throw new cu(cc.InternalError,`Handler for ${t} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??nZ}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(t,r,a,l,n)}let c=n.inputRequests,u=null!=c&&Object.keys(c).length>0,d="string"==typeof n.requestState;if(!u&&!d)throw new cu(cc.InternalError,`Handler for ${t} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(u){let r=this._inputRequestCapabilityView(i);for(let[a,i]of Object.entries(c)){let{embedded:n,required:o}=ps(t,a,i),s=lF(o,r);if(void 0!==s)throw new ch({requiredCapabilities:s},`Cannot request input '${a}' (${n.method}): the request's client capabilities do not declare the required capability`)}}return n}async _verifyRequestState(t,r,a){if(void 0!==this._requestStateVerify)try{return await this._requestStateVerify(t,r)}catch(t){throw this.onerror?.(Error(`requestState verification rejected ${a}: ${t instanceof Error?t.message:String(t)}`)),new cu(cc.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(t){return this._servedModernEra()?t.mcpReq.envelope?.[nH]:this._clientCapabilities}_assertPushApiInServedEra(t){if(this._servedModernEra())throw new lZ(lD.MethodNotSupportedByProtocolVersion,`Server-to-client requests are not available on protocol revision ${this._negotiatedProtocolVersion}: '${t}' cannot be sent while serving a request on that revision. Return inputRequired({ ... }) from the handler instead — the client fulfils the embedded requests and retries the original request (multi round-trip requests).`,{method:t,era:"2026-07-28"})}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new lZ(lD.CapabilityNotSupported,`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new lZ(lD.CapabilityNotSupported,`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new lZ(lD.CapabilityNotSupported,`Client does not support listing roots (required for ${t})`)}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new lZ(lD.CapabilityNotSupported,`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new lZ(lD.CapabilityNotSupported,`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new lZ(lD.CapabilityNotSupported,`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new lZ(lD.CapabilityNotSupported,`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new lZ(lD.CapabilityNotSupported,`Client does not support URL elicitation (required for ${t})`)}}assertRequestHandlerCapability(t){switch(t){case"completion/complete":if(!this._capabilities.completions)throw new lZ(lD.CapabilityNotSupported,`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new lZ(lD.CapabilityNotSupported,`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new lZ(lD.CapabilityNotSupported,`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new lZ(lD.CapabilityNotSupported,`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new lZ(lD.CapabilityNotSupported,`Server does not support tools (required for ${t})`)}}async _oninitialize(t){let r=t.params.protocolVersion;this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo;let a=this._supportedProtocolVersions.filter(t=>!(t>=lU)),i=a.includes(r)?r:a[0]??nZ;return this._negotiatedProtocolVersion=i,this.transport?.setProtocolVersion?.(i),{protocolVersion:i,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:lH(this._supportedProtocolVersions),capabilities:{...this.getCapabilities()},...this._instructions&&{instructions:this._instructions}}}_outboundServerInfo(){return this._serverInfo}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}projectCallToolResult(t,r){return this._wireCodec().projectCallToolResult(t,r)}getCapabilities(){return this._capabilities}async ping(){return this._assertPushApiInServedEra("ping"),this.request({method:"ping"})}async createMessage(t,r){if(this._assertPushApiInServedEra("sampling/createMessage"),(t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new lZ(lD.CapabilityNotSupported,"Client does not support sampling tools capability.");if(t.messages.length>0){let r=t.messages.at(-1),a=Array.isArray(r.content)?r.content:[r.content],i=a.some(t=>"tool_result"===t.type),n=t.messages.length>1?t.messages.at(-2):void 0,o=n?Array.isArray(n.content)?n.content:[n.content]:[],s=o.some(t=>"tool_use"===t.type);if(i){if(a.some(t=>"tool_result"!==t.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 t=new Set(o.filter(t=>"tool_use"===t.type).map(t=>t.id)),r=new Set(a.filter(t=>"tool_result"===t.type).map(t=>t.toolUseId));if(t.size!==r.size||![...t].every(t=>r.has(t)))throw new cu(cc.InvalidParams,"ids of tool_result blocks and tool_use blocks from previous message do not match")}}let a=!!(t.tools||t.toolChoice),i=await this.request({method:"sampling/createMessage",params:t},r),n=this._wireCodec().samplingResultVariant(a,i);if(!n.ok)throw new lZ(lD.InvalidResult,`Invalid sampling/createMessage result: ${"invalid"===n.reason?n.message:n.reason}`);return n.value}async elicitInput(t,r){switch(this._assertPushApiInServedEra("elicitation/create"),t.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw new lZ(lD.CapabilityNotSupported,"Client does not support url elicitation.");break;case"form":if(!this._clientCapabilities?.elicitation?.form)throw new lZ(lD.CapabilityNotSupported,"Client does not support form elicitation.")}return this._sendElicitationLeg(t,r)}async _sendElicitationLeg(t,r,a){let i=t.mode??"form",n=a?.validateAcceptedContent??!0;switch(i){case"url":return this.request({method:"elicitation/create",params:t},r);case"form":{let a="form"===t.mode?t:{...t,mode:"form"},i=await this.request({method:"elicitation/create",params:a},r);if(n&&"accept"===i.action&&i.content&&a.requestedSchema)try{let t=this._jsonSchemaValidator.getValidator(a.requestedSchema)(i.content);if(!t.valid)throw new cu(cc.InvalidParams,`Elicitation response content does not match requested schema: ${t.errorMessage}`)}catch(t){if(t instanceof cu)throw t;throw new cu(cc.InternalError,`Error validating elicitation response: ${t instanceof Error?t.message:String(t)}`)}return i}}}createElicitationCompletionNotifier(t,r){if(!this._clientCapabilities?.elicitation?.url)throw new lZ(lD.CapabilityNotSupported,"Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},r)}async listRoots(t,r){return this._assertPushApiInServedEra("roots/list"),this.request({method:"roots/list",params:t},r)}async sendLoggingMessage(t,r){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,r))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}},pp=class{server;_registeredResources={};_registeredResourceTemplates={};_registeredTools={};_registeredPrompts={};_toolInputSchemaJson={};toolInputSchemaJson(t){let r=this._registeredTools[t];if(void 0!==r&&r.enabled){if(Object.hasOwn(this._toolInputSchemaJson,t))return this._toolInputSchemaJson[t];if(void 0===r.inputSchema)return pf;try{let a=c1(r.inputSchema,"input");return this._toolInputSchemaJson[t]=a,a}catch{return}}}constructor(t,r){this.server=new pd(t,r),r?.capabilities?.tools&&this.setToolRequestHandlers(),r?.capabilities?.resources&&this.setResourceRequestHandlers(),r?.capabilities?.prompts&&this.setPromptRequestHandlers()}async connect(t){return await this.server.connect(t)}async close(){await this.server.close()}_toolHandlersInitialized=!1;setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler("tools/list"),this.server.assertCanSetRequestHandler("tools/call"),this.server.registerCapabilities({tools:{listChanged:this.server.getCapabilities().tools?.listChanged??!0}}),this.server.setRequestHandler("tools/list",()=>({tools:Object.entries(this._registeredTools).filter(([,t])=>t.enabled).map(([t,r])=>{let a={name:t,title:r.title,description:r.description,inputSchema:r.inputSchema?c1(r.inputSchema,"input"):pf,annotations:r.annotations,icons:r.icons,execution:r.execution,_meta:r._meta};return r.outputSchema&&(a.outputSchema=c1(r.outputSchema,"output")),a})})),this.server.setRequestHandler("tools/call",async(t,r)=>{let a=this._registeredTools[t.params.name];if(!a)throw new cu(cc.InvalidParams,`Tool ${t.params.name} not found`);if(!a.enabled)throw new cu(cc.InvalidParams,`Tool ${t.params.name} disabled`);try{let i=await this.validateToolInput(a,t.params.arguments,t.params.name),n=await this.executeToolHandler(a,i,r);if(await this.validateToolOutput(a,n,t.params.name),cV(n))return n;return this.server.projectCallToolResult(n,a.outputSchemaJson)}catch(t){if(t instanceof cu&&t.code===cc.UrlElicitationRequired)throw t;return this.createToolError(t instanceof Error?t.message:String(t))}}),this._toolHandlersInitialized=!0)}createToolError(t){return{content:[{type:"text",text:t}],isError:!0}}async validateToolInput(t,r,a){if(!t.inputSchema)return;let i=await c2(t.inputSchema,r??{});if(!i.success)throw new cu(cc.InvalidParams,`Input validation error: Invalid arguments for tool ${a}: ${i.error}`);return i.data}async validateToolOutput(t,r,a){if(!t.outputSchema||cV(r)||r.isError)return;if(void 0===r.structuredContent)throw new cu(cc.InvalidParams,`Output validation error: Tool ${a} has an output schema but no structured content was provided`);let i=await c2(t.outputSchema,r.structuredContent);if(!i.success)throw new cu(cc.InvalidParams,`Output validation error: Invalid structured content for tool ${a}: ${i.error}`)}async executeToolHandler(t,r,a){return t.executor(r,a)}_completionHandlerInitialized=!1;setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler("completion/complete"),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler("completion/complete",async t=>{switch(t.params.ref.type){case"ref/prompt":if("ref/prompt"!==t.params.ref.type)throw TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`);return this.handlePromptCompletion(t,t.params.ref);case"ref/resource":if("ref/resource"!==t.params.ref.type)throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`);return this.handleResourceCompletion(t,t.params.ref);default:throw new cu(cc.InvalidParams,`Invalid completion reference: ${t.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(t,r){let a=this._registeredPrompts[r.name];if(!a)throw new cu(cc.InvalidParams,`Prompt ${r.name} not found`);if(!a.enabled)throw new cu(cc.InvalidParams,`Prompt ${r.name} disabled`);if(!a.argsSchema)return p_;let i=pS(pb(a.argsSchema)?.[t.params.argument.name]);if(!pa(i))return p_;let n=i[pr]?.complete;return n?pv(await n(t.params.argument.value,t.params.context)):p_}async handleResourceCompletion(t,r){let a=Object.values(this._registeredResourceTemplates).find(t=>t.resourceTemplate.uriTemplate.toString()===r.uri);if(!a){if(this._registeredResources[r.uri])return p_;throw new cu(cc.InvalidParams,`Resource template ${t.params.ref.uri} not found`)}let i=a.resourceTemplate.completeCallback(t.params.argument.name);return i?pv(await i(t.params.argument.value,t.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(t,r)=>{let a=Object.entries(this._registeredResources).filter(([t,r])=>r.enabled).map(([t,r])=>({uri:t,name:r.name,...r.metadata})),i=[];for(let t of Object.values(this._registeredResourceTemplates))if(t.resourceTemplate.listCallback)for(let a of(await t.resourceTemplate.listCallback(r)).resources)i.push({...t.metadata,...a});return{resources:[...a,...i]}}),this.server.setRequestHandler("resources/templates/list",async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([t,r])=>({name:t,uriTemplate:r.resourceTemplate.uriTemplate.toString(),...r.metadata}))})),this.server.setRequestHandler("resources/read",async(t,r)=>{let a;try{a=new URL(t.params.uri)}catch{throw new cu(cc.InvalidParams,`Resource URI ${t.params.uri} is invalid`,{uri:t.params.uri,reason:"invalid_uri"})}let i=this._registeredResources[a.toString()];if(i){if(!i.enabled)throw new cu(cc.InvalidParams,`Resource ${a} disabled`);return cn(await i.readCallback(a,r),i.cacheHint)}for(let t of Object.values(this._registeredResourceTemplates)){let i=t.resourceTemplate.uriTemplate.match(a.toString());if(i)return cn(await t.readCallback(a,i,r),t.cacheHint)}throw new cd(t.params.uri)}),this._resourceHandlersInitialized=!0)}_promptHandlersInitialized=!1;setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler("prompts/list"),this.server.assertCanSetRequestHandler("prompts/get"),this.server.registerCapabilities({prompts:{listChanged:this.server.getCapabilities().prompts?.listChanged??!0}}),this.server.setRequestHandler("prompts/list",()=>({prompts:Object.entries(this._registeredPrompts).filter(([,t])=>t.enabled).map(([t,r])=>{let a,i,n;return{name:t,title:r.title,description:r.description,arguments:r.argsSchema?(i=(a=c1(r.argsSchema,"input")).properties||{},n=a.required||[],Object.entries(i).map(([t,r])=>({name:t,description:r?.description,required:n.includes(t)}))):void 0,icons:r.icons,_meta:r._meta}})})),this.server.setRequestHandler("prompts/get",async(t,r)=>{let a=this._registeredPrompts[t.params.name];if(!a)throw new cu(cc.InvalidParams,`Prompt ${t.params.name} not found`);if(!a.enabled)throw new cu(cc.InvalidParams,`Prompt ${t.params.name} disabled`);return a.handler(t.params.arguments,r)}),this._promptHandlersInitialized=!0)}registerResource(t,r,a,i){let n=a.cacheHint,o=a;if(void 0!==n){cl(n,`resource ${t}`);let r={...a};delete r.cacheHint,o=r}if("string"==typeof r){if(this._registeredResources[r])throw Error(`Resource ${r} is already registered`);let s=this._createRegisteredResource(t,a.title,r,o,i);return void 0!==n&&(s.cacheHint=n),this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}{if(this._registeredResourceTemplates[t])throw Error(`Resource template ${t} is already registered`);let s=this._createRegisteredResourceTemplate(t,a.title,r,o,i);return void 0!==n&&(s.cacheHint=n),this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}_createRegisteredResource(t,r,a,i,n){let o={name:t,title:r,metadata:i,readCallback:n,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({uri:null}),update:t=>{void 0!==t.uri&&t.uri!==a&&(delete this._registeredResources[a],t.uri&&(this._registeredResources[t.uri]=o)),void 0!==t.name&&(o.name=t.name),void 0!==t.title&&(o.title=t.title),void 0!==t.metadata&&(o.metadata=t.metadata),void 0!==t.callback&&(o.readCallback=t.callback),void 0!==t.enabled&&(o.enabled=t.enabled),this.sendResourceListChanged()}};return this._registeredResources[a]=o,o}_createRegisteredResourceTemplate(t,r,a,i,n){let o={resourceTemplate:a,title:r,metadata:i,readCallback:n,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:r=>{void 0!==r.name&&r.name!==t&&(delete this._registeredResourceTemplates[t],r.name&&(this._registeredResourceTemplates[r.name]=o)),void 0!==r.title&&(o.title=r.title),void 0!==r.template&&(o.resourceTemplate=r.template),void 0!==r.metadata&&(o.metadata=r.metadata),void 0!==r.callback&&(o.readCallback=r.callback),void 0!==r.enabled&&(o.enabled=r.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[t]=o;let s=a.uriTemplate.variableNames;return Array.isArray(s)&&s.some(t=>!!a.completeCallback(t))&&this.setCompletionRequestHandler(),o}_createRegisteredPrompt(t,r,a,i,n,o,s){let l=i,c=n,u={title:r,description:a,argsSchema:i,icons:o,_meta:s,handler:pg(t,i,n),enabled:!0,disable:()=>u.update({enabled:!1}),enable:()=>u.update({enabled:!0}),remove:()=>u.update({name:null}),update:r=>{void 0!==r.name&&r.name!==t&&(delete this._registeredPrompts[t],r.name&&(this._registeredPrompts[r.name]=u)),void 0!==r.title&&(u.title=r.title),void 0!==r.description&&(u.description=r.description),void 0!==r.icons&&(u.icons=r.icons),void 0!==r._meta&&(u._meta=r._meta);let a=!1;void 0!==r.argsSchema&&(u.argsSchema=r.argsSchema,l=r.argsSchema,a=!0),void 0!==r.callback&&(c=r.callback,a=!0),a&&(u.handler=pg(t,l,c)),void 0!==r.enabled&&(u.enabled=r.enabled),this.sendPromptListChanged()}};if(this._registeredPrompts[t]=u,i){let t=pb(i);t&&Object.values(t).some(t=>pa(pS(t)))&&this.setCompletionRequestHandler()}return u}_createRegisteredTool(t,r,a,i,n,o,s,l,c,u){if(uf(t),void 0!==i)try{let r,a,n,o,s=c1(i,"input");this._toolInputSchemaJson[t]=s;let l=(r=[],a=new Map,o=(n=(t,i,o)=>{if(null===t||"object"!=typeof t)return;if(cF in t){if(!o||0===i.length)return`${cB(i)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let n=t[cF];if("string"!=typeof n||0===n.length)return`${cB(i)}: x-mcp-header MUST be a non-empty string`;if(!cU.test(n))return`${cB(i)}: x-mcp-header '${n}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let s="string"==typeof t.type?t.type:void 0;if(void 0===s||!cJ.has(s))return`${cB(i)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${s??"<none>"}`;let l=n.toLowerCase(),c=a.get(l);if(void 0!==c)return`x-mcp-header '${n}' is not case-insensitively unique (also declared as '${c}')`;a.set(l,n),r.push({path:i,headerName:n,type:s})}let s=t.properties;if(null!==s&&"object"==typeof s)for(let[t,r]of Object.entries(s)){let a=n(r,[...i,t],o);if(void 0!==a)return a}for(let r of cH){let a=t[r];if(void 0!==a)for(let t of Array.isArray(a)?a:null!==a&&"object"==typeof a&&cK.has(r)?Object.values(a):[a]){let a=n(t,[...i,`<${r}>`],!1);if(void 0!==a)return a}}})(s,[],!0),void 0===o?{valid:!0,declarations:r}:{valid:!1,reason:o});l.valid||console.warn(`[mcp-sdk] tool '${t}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${l.reason}`)}catch{}let d=u,p={title:r,description:a,inputSchema:i,outputSchema:n,outputSchemaJson:py(n),annotations:o,icons:s,execution:l,_meta:c,handler:u,executor:ph(i,u),enabled:!0,disable:()=>p.update({enabled:!1}),enable:()=>p.update({enabled:!0}),remove:()=>p.update({name:null}),update:r=>{void 0!==r.name&&r.name!==t&&("string"==typeof r.name&&uf(r.name),delete this._registeredTools[t],delete this._toolInputSchemaJson[t],r.name&&(delete this._toolInputSchemaJson[r.name],this._registeredTools[r.name]=p,t=r.name)),void 0!==r.title&&(p.title=r.title),void 0!==r.description&&(p.description=r.description);let a=!1;void 0!==r.paramsSchema&&(p.inputSchema=r.paramsSchema,delete this._toolInputSchemaJson[t],a=!0),void 0!==r.callback&&(p.handler=r.callback,d=r.callback,a=!0),a&&(p.executor=ph(p.inputSchema,d)),void 0!==r.outputSchema&&(p.outputSchema=r.outputSchema,p.outputSchemaJson=py(r.outputSchema)),void 0!==r.annotations&&(p.annotations=r.annotations),void 0!==r.icons&&(p.icons=r.icons),void 0!==r._meta&&(p._meta=r._meta),void 0!==r.enabled&&(p.enabled=r.enabled),this.sendToolListChanged()}};return this._registeredTools[t]=p,this.setToolRequestHandlers(),this.sendToolListChanged(),p}registerTool(t,r,a){if(this._registeredTools[t])throw Error(`Tool ${t} is already registered`);let{title:i,description:n,inputSchema:o,outputSchema:s,annotations:l,icons:c,_meta:u}=r;return this._createRegisteredTool(t,i,n,ug(o),ug(s),l,c,void 0,u,a)}registerPrompt(t,r,a){if(this._registeredPrompts[t])throw Error(`Prompt ${t} is already registered`);let{title:i,description:n,argsSchema:o,icons:s,_meta:l}=r,c=this._createRegisteredPrompt(t,i,n,ug(o),a,s,l);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),c}isConnected(){return void 0!==this.server.transport}async sendLoggingMessage(t,r){return this.server.sendLoggingMessage(t,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}},pm=class{_uriTemplate;constructor(t,r){this._callbacks=r,this._uriTemplate="string"==typeof t?new uy(t):t}get uriTemplate(){return this._uriTemplate}get listCallback(){return this._callbacks.list}completeCallback(t){return this._callbacks.complete?.[t]}};function ph(t,r){return t?async(t,a)=>r(t,a):async(t,a)=>r(a)}let pf={type:"object",properties:{}};function py(t){if(void 0!==t)try{return c1(t,"output")}catch{return}}function pg(t,r,a){return r?async(i,n)=>{let o=await c2(r,i);if(!o.success)throw new cu(cc.InvalidParams,`Invalid arguments for prompt ${t}: ${o.error}`);return a(o.data,n)}:async(t,r)=>a(r)}function pv(t){return{completion:{values:t.map(String).slice(0,100),total:t.length,hasMore:t.length>100}}}let p_={completion:{values:[],hasMore:!1}};function pb(t){if(t.shape&&"object"==typeof t.shape)return t.shape}function pS(t){return t?.type!=="optional"?t:t.def?.innerType??t}var p$=class{_readBuffer;_started=!1;_closed=!1;constructor(t=pt().stdin,r=pt().stdout,a){this._stdin=t,this._stdout=r,this._readBuffer=new um({maxBufferSize:a?.maxBufferSize})}onclose;onerror;onmessage;_ondata=t=>{try{this._readBuffer.append(t),this.processReadBuffer()}catch(t){this.onerror?.(t),this.close().catch(()=>{})}};_onerror=t=>{this.onerror?.(t)};_onstdouterror=t=>{this.onerror?.(t),this.close().catch(()=>{})};async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror),this._stdout.on("error",this._onstdouterror)}processReadBuffer(){for(;;)try{let t=this._readBuffer.readMessage();if(null===t)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async close(){this._closed||(this._closed=!0,this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdout.off("error",this._onstdouterror),0===this._stdin.listenerCount("data")&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.())}send(t){return this._closed?Promise.reject(Error("StdioServerTransport is closed")):new Promise((r,a)=>{let i=JSON.stringify(t)+"\n",n=!1,o=t=>{n||(n=!0,this._stdout.off("error",o),this._stdout.off("drain",s),a(t))},s=()=>{n||(n=!0,this._stdout.off("error",o),this._stdout.off("drain",s),r())};if(this._stdout.once("error",o),this._stdout.write(i)){if(n)return;n=!0,this._stdout.off("error",o),r()}else n||this._stdout.once("drain",s)})}},pw=class{onclose;onerror;onmessage;_closed=!1;_pendingRequests=new Set;_drainWaiters=[];constructor(t,r,a){this._wire=t,this._onInstanceClose=r,this._outboundIntercept=a}async start(){}async send(t,r){if(oa.safeParse(t).success||oi.safeParse(t).success){let{id:r}=t;void 0!==r&&this._settle(r)}if(!this._closed&&this._outboundIntercept?.(t)!=="handled")return this._wire.send(t,r)}setProtocolVersion=t=>{this._wire.setProtocolVersion?.(t)};deliver(t,r){if(!this._closed){if(cZ(t))this._pendingRequests.add(t.id);else if(or.safeParse(t).success&&"notifications/cancelled"===t.method){let r=t.params?.requestId;void 0!==r&&this._settle(r)}this.onmessage?.(t,r)}}async whenRequestsAnswered(t){return!!this._closed||0===this._pendingRequests.size||await new Promise(r=>{let a=()=>{clearTimeout(i),r(!0)},i=setTimeout(()=>{this._drainWaiters=this._drainWaiters.filter(t=>t!==a),r(!1)},t);this._drainWaiters.push(a)})}async close(){if(!this._closed){this._closed=!0,this._pendingRequests.clear(),this._releaseDrainWaiters();try{this._onInstanceClose()}finally{this.onclose?.()}}}_settle(t){this._pendingRequests.delete(t),0===this._pendingRequests.size&&this._releaseDrainWaiters()}_releaseDrainWaiters(){let t=this._drainWaiters;for(let r of(this._drainWaiters=[],t))r()}};function pk(t){return t instanceof Error?t:Error(String(t))}let px=Symbol("Let zodToJsonSchema decide on which parser to use"),pR={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"};(R=N||(N={})).assertEqual=t=>{},R.assertIs=function(t){},R.assertNever=function(t){throw Error()},R.arrayToEnum=t=>{let r={};for(let a of t)r[a]=a;return r},R.getValidEnumValues=t=>{let r=R.objectKeys(t).filter(r=>"number"!=typeof t[t[r]]),a={};for(let i of r)a[i]=t[i];return R.objectValues(a)},R.objectValues=t=>R.objectKeys(t).map(function(r){return t[r]}),R.objectKeys="function"==typeof Object.keys?t=>Object.keys(t):t=>{let r=[];for(let a in t)Object.prototype.hasOwnProperty.call(t,a)&&r.push(a);return r},R.find=(t,r)=>{for(let a of t)if(r(a))return a},R.isInteger="function"==typeof Number.isInteger?t=>Number.isInteger(t):t=>"number"==typeof t&&Number.isFinite(t)&&Math.floor(t)===t,R.joinValues=function(t,r=" | "){return t.map(t=>"string"==typeof t?`'${t}'`:t).join(r)},R.jsonStringifyReplacer=(t,r)=>"bigint"==typeof r?r.toString():r,(C||(C={})).mergeShapes=(t,r)=>({...t,...r});let pP=N.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),pE=t=>{switch(typeof t){case"undefined":return pP.undefined;case"string":return pP.string;case"number":return Number.isNaN(t)?pP.nan:pP.number;case"boolean":return pP.boolean;case"function":return pP.function;case"bigint":return pP.bigint;case"symbol":return pP.symbol;case"object":if(Array.isArray(t))return pP.array;if(null===t)return pP.null;if(t.then&&"function"==typeof t.then&&t.catch&&"function"==typeof t.catch)return pP.promise;if("undefined"!=typeof Map&&t instanceof Map)return pP.map;if("undefined"!=typeof Set&&t instanceof Set)return pP.set;if("undefined"!=typeof Date&&t instanceof Date)return pP.date;return pP.object;default:return pP.unknown}},pO=N.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 pT extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=t=>{this.issues=[...this.issues,t]},this.addIssues=(t=[])=>{this.issues=[...this.issues,...t]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(t){return t.message},a={_errors:[]},i=t=>{for(let n of t.issues)if("invalid_union"===n.code)n.unionErrors.map(i);else if("invalid_return_type"===n.code)i(n.returnTypeError);else if("invalid_arguments"===n.code)i(n.argumentsError);else if(0===n.path.length)a._errors.push(r(n));else{let t=a,i=0;for(;i<n.path.length;){let a=n.path[i];i===n.path.length-1?(t[a]=t[a]||{_errors:[]},t[a]._errors.push(r(n))):t[a]=t[a]||{_errors:[]},t=t[a],i++}}};return i(this),a}static assert(t){if(!(t instanceof pT))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,N.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(t=t=>t.message){let r=Object.create(null),a=[];for(let i of this.issues)if(i.path.length>0){let a=i.path[0];r[a]=r[a]||[],r[a].push(t(i))}else a.push(t(i));return{formErrors:a,fieldErrors:r}}get formErrors(){return this.flatten()}}pT.create=t=>new pT(t);let pj=(t,r)=>{let a;switch(t.code){case pO.invalid_type:a=t.received===pP.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case pO.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(t.expected,N.jsonStringifyReplacer)}`;break;case pO.unrecognized_keys:a=`Unrecognized key(s) in object: ${N.joinValues(t.keys,", ")}`;break;case pO.invalid_union:a="Invalid input";break;case pO.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${N.joinValues(t.options)}`;break;case pO.invalid_enum_value:a=`Invalid enum value. Expected ${N.joinValues(t.options)}, received '${t.received}'`;break;case pO.invalid_arguments:a="Invalid function arguments";break;case pO.invalid_return_type:a="Invalid function return type";break;case pO.invalid_date:a="Invalid date";break;case pO.invalid_string:"object"==typeof t.validation?"includes"in t.validation?(a=`Invalid input: must include "${t.validation.includes}"`,"number"==typeof t.validation.position&&(a=`${a} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?a=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?a=`Invalid input: must end with "${t.validation.endsWith}"`:N.assertNever(t.validation):a="regex"!==t.validation?`Invalid ${t.validation}`:"Invalid";break;case pO.too_small:a="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:"number"===t.type||"bigint"===t.type?`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:"date"===t.type?`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:"Invalid input";break;case pO.too_big:a="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"bigint"===t.type?`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"date"===t.type?`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:"Invalid input";break;case pO.custom:a="Invalid input";break;case pO.invalid_intersection_types:a="Intersection results could not be merged";break;case pO.not_multiple_of:a=`Number must be a multiple of ${t.multipleOf}`;break;case pO.not_finite:a="Number must be finite";break;default:a=r.defaultError,N.assertNever(t)}return{message:a}};(P=I||(I={})).errToObj=t=>"string"==typeof t?{message:t}:t||{},P.toString=t=>"string"==typeof t?t:t?.message;let pN=t=>{let{data:r,path:a,errorMaps:i,issueData:n}=t,o=[...a,...n.path||[]],s={...n,path:o};if(void 0!==n.message)return{...n,path:o,message:n.message};let l="";for(let t of i.filter(t=>!!t).slice().reverse())l=t(s,{data:r,defaultError:l}).message;return{...n,path:o,message:l}};function pC(t,r){let a=pN({issueData:r,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,pj,void 0].filter(t=>!!t)});t.common.issues.push(a)}class pI{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(t,r){let a=[];for(let i of r){if("aborted"===i.status)return pq;"dirty"===i.status&&t.dirty(),a.push(i.value)}return{status:t.value,value:a}}static async mergeObjectAsync(t,r){let a=[];for(let t of r){let r=await t.key,i=await t.value;a.push({key:r,value:i})}return pI.mergeObjectSync(t,a)}static mergeObjectSync(t,r){let a={};for(let i of r){let{key:r,value:n}=i;if("aborted"===r.status||"aborted"===n.status)return pq;"dirty"===r.status&&t.dirty(),"dirty"===n.status&&t.dirty(),"__proto__"!==r.value&&(void 0!==n.value||i.alwaysSet)&&(a[r.value]=n.value)}return{status:t.value,value:a}}}let pq=Object.freeze({status:"aborted"}),pz=t=>({status:"dirty",value:t}),pA=t=>({status:"valid",value:t}),pM=t=>"undefined"!=typeof Promise&&t instanceof Promise;class pL{constructor(t,r,a,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=a,this._key=i}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 pD=(t,r)=>{if("valid"===r.status)return{success:!0,data:r.value};if(!t.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new pT(t.common.issues);return this._error=r,this._error}}};function pZ(t){if(!t)return{};let{errorMap:r,invalid_type_error:a,required_error:i,description:n}=t;if(r&&(a||i))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return r?{errorMap:r,description:n}:{errorMap:(r,n)=>{let{message:o}=t;return"invalid_enum_value"===r.code?{message:o??n.defaultError}:void 0===n.data?{message:o??i??n.defaultError}:"invalid_type"!==r.code?{message:n.defaultError}:{message:o??a??n.defaultError}},description:n}}class pV{get description(){return this._def.description}_getType(t){return pE(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:pE(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new pI,ctx:{common:t.parent.common,data:t.data,parsedType:pE(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(pM(r))throw Error("Synchronous parse encountered promise.");return r}_parseAsync(t){return Promise.resolve(this._parse(t))}parse(t,r){let a=this.safeParse(t,r);if(a.success)return a.data;throw a.error}safeParse(t,r){let a={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:pE(t)},i=this._parseSync({data:t,path:a.path,parent:a});return pD(a,i)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:pE(t)};if(!this["~standard"].async)try{let a=this._parseSync({data:t,path:[],parent:r});return"valid"===a.status?{value:a.value}:{issues:r.common.issues}}catch(t){t?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(t=>"valid"===t.status?{value:t.value}:{issues:r.common.issues})}async parseAsync(t,r){let a=await this.safeParseAsync(t,r);if(a.success)return a.data;throw a.error}async safeParseAsync(t,r){let a={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:pE(t)},i=this._parse({data:t,path:a.path,parent:a});return pD(a,await (pM(i)?i:Promise.resolve(i)))}refine(t,r){return this._refinement((a,i)=>{let n=t(a),o=()=>i.addIssue({code:pO.custom,..."string"==typeof r||void 0===r?{message:r}:"function"==typeof r?r(a):r});return"undefined"!=typeof Promise&&n instanceof Promise?n.then(t=>!!t||(o(),!1)):!!n||(o(),!1)})}refinement(t,r){return this._refinement((a,i)=>!!t(a)||(i.addIssue("function"==typeof r?r(a,i):r),!1))}_refinement(t){return new mx({schema:this,typeName:q.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return mR.create(this,this._def)}nullable(){return mP.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ml.create(this)}promise(){return mk.create(this,this._def)}or(t){return mu.create([this,t],this._def)}and(t){return mm.create(this,t,this._def)}transform(t){return new mx({...pZ(this._def),schema:this,typeName:q.ZodEffects,effect:{type:"transform",transform:t}})}default(t){return new mE({...pZ(this._def),innerType:this,defaultValue:"function"==typeof t?t:()=>t,typeName:q.ZodDefault})}brand(){return new mj({typeName:q.ZodBranded,type:this,...pZ(this._def)})}catch(t){return new mO({...pZ(this._def),innerType:this,catchValue:"function"==typeof t?t:()=>t,typeName:q.ZodCatch})}describe(t){return new this.constructor({...this._def,description:t})}pipe(t){return mN.create(this,t)}readonly(){return mC.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let pF=/^c[^\s-]{8,}$/i,pU=/^[0-9a-z]+$/,pJ=/^[0-9A-HJKMNP-TV-Z]{26}$/i,pH=/^[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,pK=/^[a-z0-9_-]{21}$/i,pB=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,pW=/^[-+]?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)?)??$/,pG=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,pY=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,pX=/^(?:(?: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])$/,pQ=/^(([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]))$/,p0=/^(([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])$/,p1=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,p2=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,p9="((\\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])))",p4=RegExp(`^${p9}$`);function p6(t){let r="[0-5]\\d";t.precision?r=`${r}\\.\\d{${t.precision}}`:null==t.precision&&(r=`${r}(\\.\\d+)?`);let a=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${r})${a}`}class p3 extends pV{_parse(t){var r,a,i,n;let o;if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==pP.string){let r=this._getOrReturnCtx(t);return pC(r,{code:pO.invalid_type,expected:pP.string,received:r.parsedType}),pq}let s=new pI;for(let l of this._def.checks)if("min"===l.kind)t.data.length<l.value&&(pC(o=this._getOrReturnCtx(t,o),{code:pO.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),s.dirty());else if("max"===l.kind)t.data.length>l.value&&(pC(o=this._getOrReturnCtx(t,o),{code:pO.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),s.dirty());else if("length"===l.kind){let r=t.data.length>l.value,a=t.data.length<l.value;(r||a)&&(o=this._getOrReturnCtx(t,o),r?pC(o,{code:pO.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}):a&&pC(o,{code:pO.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}),s.dirty())}else if("email"===l.kind)pG.test(t.data)||(pC(o=this._getOrReturnCtx(t,o),{validation:"email",code:pO.invalid_string,message:l.message}),s.dirty());else if("emoji"===l.kind)p||(p=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),p.test(t.data)||(pC(o=this._getOrReturnCtx(t,o),{validation:"emoji",code:pO.invalid_string,message:l.message}),s.dirty());else if("uuid"===l.kind)pH.test(t.data)||(pC(o=this._getOrReturnCtx(t,o),{validation:"uuid",code:pO.invalid_string,message:l.message}),s.dirty());else if("nanoid"===l.kind)pK.test(t.data)||(pC(o=this._getOrReturnCtx(t,o),{validation:"nanoid",code:pO.invalid_string,message:l.message}),s.dirty());else if("cuid"===l.kind)pF.test(t.data)||(pC(o=this._getOrReturnCtx(t,o),{validation:"cuid",code:pO.invalid_string,message:l.message}),s.dirty());else if("cuid2"===l.kind)pU.test(t.data)||(pC(o=this._getOrReturnCtx(t,o),{validation:"cuid2",code:pO.invalid_string,message:l.message}),s.dirty());else if("ulid"===l.kind)pJ.test(t.data)||(pC(o=this._getOrReturnCtx(t,o),{validation:"ulid",code:pO.invalid_string,message:l.message}),s.dirty());else if("url"===l.kind)try{new URL(t.data)}catch{pC(o=this._getOrReturnCtx(t,o),{validation:"url",code:pO.invalid_string,message:l.message}),s.dirty()}else"regex"===l.kind?(l.regex.lastIndex=0,l.regex.test(t.data)||(pC(o=this._getOrReturnCtx(t,o),{validation:"regex",code:pO.invalid_string,message:l.message}),s.dirty())):"trim"===l.kind?t.data=t.data.trim():"includes"===l.kind?t.data.includes(l.value,l.position)||(pC(o=this._getOrReturnCtx(t,o),{code:pO.invalid_string,validation:{includes:l.value,position:l.position},message:l.message}),s.dirty()):"toLowerCase"===l.kind?t.data=t.data.toLowerCase():"toUpperCase"===l.kind?t.data=t.data.toUpperCase():"startsWith"===l.kind?t.data.startsWith(l.value)||(pC(o=this._getOrReturnCtx(t,o),{code:pO.invalid_string,validation:{startsWith:l.value},message:l.message}),s.dirty()):"endsWith"===l.kind?t.data.endsWith(l.value)||(pC(o=this._getOrReturnCtx(t,o),{code:pO.invalid_string,validation:{endsWith:l.value},message:l.message}),s.dirty()):"datetime"===l.kind?(function(t){let r=`${p9}T${p6(t)}`,a=[];return a.push(t.local?"Z?":"Z"),t.offset&&a.push("([+-]\\d{2}:?\\d{2})"),r=`${r}(${a.join("|")})`,RegExp(`^${r}$`)})(l).test(t.data)||(pC(o=this._getOrReturnCtx(t,o),{code:pO.invalid_string,validation:"datetime",message:l.message}),s.dirty()):"date"===l.kind?p4.test(t.data)||(pC(o=this._getOrReturnCtx(t,o),{code:pO.invalid_string,validation:"date",message:l.message}),s.dirty()):"time"===l.kind?RegExp(`^${p6(l)}$`).test(t.data)||(pC(o=this._getOrReturnCtx(t,o),{code:pO.invalid_string,validation:"time",message:l.message}),s.dirty()):"duration"===l.kind?pW.test(t.data)||(pC(o=this._getOrReturnCtx(t,o),{validation:"duration",code:pO.invalid_string,message:l.message}),s.dirty()):"ip"===l.kind?(r=t.data,!(("v4"===(a=l.version)||!a)&&pY.test(r)||("v6"===a||!a)&&pQ.test(r))&&1&&(pC(o=this._getOrReturnCtx(t,o),{validation:"ip",code:pO.invalid_string,message:l.message}),s.dirty())):"jwt"===l.kind?!function(t,r){if(!pB.test(t))return!1;try{let[a]=t.split(".");if(!a)return!1;let i=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),n=JSON.parse(atob(i));if("object"!=typeof n||null===n||"typ"in n&&n?.typ!=="JWT"||!n.alg||r&&n.alg!==r)return!1;return!0}catch{return!1}}(t.data,l.alg)&&(pC(o=this._getOrReturnCtx(t,o),{validation:"jwt",code:pO.invalid_string,message:l.message}),s.dirty()):"cidr"===l.kind?(i=t.data,!(("v4"===(n=l.version)||!n)&&pX.test(i)||("v6"===n||!n)&&p0.test(i))&&1&&(pC(o=this._getOrReturnCtx(t,o),{validation:"cidr",code:pO.invalid_string,message:l.message}),s.dirty())):"base64"===l.kind?p1.test(t.data)||(pC(o=this._getOrReturnCtx(t,o),{validation:"base64",code:pO.invalid_string,message:l.message}),s.dirty()):"base64url"===l.kind?p2.test(t.data)||(pC(o=this._getOrReturnCtx(t,o),{validation:"base64url",code:pO.invalid_string,message:l.message}),s.dirty()):N.assertNever(l);return{status:s.value,value:t.data}}_regex(t,r,a){return this.refinement(r=>t.test(r),{validation:r,code:pO.invalid_string,...I.errToObj(a)})}_addCheck(t){return new p3({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...I.errToObj(t)})}url(t){return this._addCheck({kind:"url",...I.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...I.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...I.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...I.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...I.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...I.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...I.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...I.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...I.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...I.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...I.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...I.errToObj(t)})}datetime(t){return"string"==typeof t?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:void 0===t?.precision?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...I.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return"string"==typeof t?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:void 0===t?.precision?null:t?.precision,...I.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...I.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...I.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...I.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...I.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...I.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...I.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...I.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...I.errToObj(r)})}nonempty(t){return this.min(1,I.errToObj(t))}trim(){return new p3({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new p3({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new p3({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>"datetime"===t.kind)}get isDate(){return!!this._def.checks.find(t=>"date"===t.kind)}get isTime(){return!!this._def.checks.find(t=>"time"===t.kind)}get isDuration(){return!!this._def.checks.find(t=>"duration"===t.kind)}get isEmail(){return!!this._def.checks.find(t=>"email"===t.kind)}get isURL(){return!!this._def.checks.find(t=>"url"===t.kind)}get isEmoji(){return!!this._def.checks.find(t=>"emoji"===t.kind)}get isUUID(){return!!this._def.checks.find(t=>"uuid"===t.kind)}get isNANOID(){return!!this._def.checks.find(t=>"nanoid"===t.kind)}get isCUID(){return!!this._def.checks.find(t=>"cuid"===t.kind)}get isCUID2(){return!!this._def.checks.find(t=>"cuid2"===t.kind)}get isULID(){return!!this._def.checks.find(t=>"ulid"===t.kind)}get isIP(){return!!this._def.checks.find(t=>"ip"===t.kind)}get isCIDR(){return!!this._def.checks.find(t=>"cidr"===t.kind)}get isBase64(){return!!this._def.checks.find(t=>"base64"===t.kind)}get isBase64url(){return!!this._def.checks.find(t=>"base64url"===t.kind)}get minLength(){let t=null;for(let r of this._def.checks)"min"===r.kind&&(null===t||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)"max"===r.kind&&(null===t||r.value<t)&&(t=r.value);return t}}p3.create=t=>new p3({checks:[],typeName:q.ZodString,coerce:t?.coerce??!1,...pZ(t)});class p5 extends pV{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){let r;if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==pP.number){let r=this._getOrReturnCtx(t);return pC(r,{code:pO.invalid_type,expected:pP.number,received:r.parsedType}),pq}let a=new pI;for(let i of this._def.checks)"int"===i.kind?N.isInteger(t.data)||(pC(r=this._getOrReturnCtx(t,r),{code:pO.invalid_type,expected:"integer",received:"float",message:i.message}),a.dirty()):"min"===i.kind?(i.inclusive?t.data<i.value:t.data<=i.value)&&(pC(r=this._getOrReturnCtx(t,r),{code:pO.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):"max"===i.kind?(i.inclusive?t.data>i.value:t.data>=i.value)&&(pC(r=this._getOrReturnCtx(t,r),{code:pO.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):"multipleOf"===i.kind?0!==function(t,r){let a=(t.toString().split(".")[1]||"").length,i=(r.toString().split(".")[1]||"").length,n=a>i?a:i;return Number.parseInt(t.toFixed(n).replace(".",""))%Number.parseInt(r.toFixed(n).replace(".",""))/10**n}(t.data,i.value)&&(pC(r=this._getOrReturnCtx(t,r),{code:pO.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):"finite"===i.kind?Number.isFinite(t.data)||(pC(r=this._getOrReturnCtx(t,r),{code:pO.not_finite,message:i.message}),a.dirty()):N.assertNever(i);return{status:a.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,I.toString(r))}gt(t,r){return this.setLimit("min",t,!1,I.toString(r))}lte(t,r){return this.setLimit("max",t,!0,I.toString(r))}lt(t,r){return this.setLimit("max",t,!1,I.toString(r))}setLimit(t,r,a,i){return new p5({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:a,message:I.toString(i)}]})}_addCheck(t){return new p5({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:I.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:I.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:I.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:I.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:I.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:I.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:I.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:I.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:I.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)"min"===r.kind&&(null===t||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)"max"===r.kind&&(null===t||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>"int"===t.kind||"multipleOf"===t.kind&&N.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let a of this._def.checks)if("finite"===a.kind||"int"===a.kind||"multipleOf"===a.kind)return!0;else"min"===a.kind?(null===r||a.value>r)&&(r=a.value):"max"===a.kind&&(null===t||a.value<t)&&(t=a.value);return Number.isFinite(r)&&Number.isFinite(t)}}p5.create=t=>new p5({checks:[],typeName:q.ZodNumber,coerce:t?.coerce||!1,...pZ(t)});class p8 extends pV{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){let r;if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==pP.bigint)return this._getInvalidInput(t);let a=new pI;for(let i of this._def.checks)"min"===i.kind?(i.inclusive?t.data<i.value:t.data<=i.value)&&(pC(r=this._getOrReturnCtx(t,r),{code:pO.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):"max"===i.kind?(i.inclusive?t.data>i.value:t.data>=i.value)&&(pC(r=this._getOrReturnCtx(t,r),{code:pO.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):"multipleOf"===i.kind?t.data%i.value!==BigInt(0)&&(pC(r=this._getOrReturnCtx(t,r),{code:pO.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):N.assertNever(i);return{status:a.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return pC(r,{code:pO.invalid_type,expected:pP.bigint,received:r.parsedType}),pq}gte(t,r){return this.setLimit("min",t,!0,I.toString(r))}gt(t,r){return this.setLimit("min",t,!1,I.toString(r))}lte(t,r){return this.setLimit("max",t,!0,I.toString(r))}lt(t,r){return this.setLimit("max",t,!1,I.toString(r))}setLimit(t,r,a,i){return new p8({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:a,message:I.toString(i)}]})}_addCheck(t){return new p8({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:I.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:I.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:I.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:I.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:I.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)"min"===r.kind&&(null===t||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)"max"===r.kind&&(null===t||r.value<t)&&(t=r.value);return t}}p8.create=t=>new p8({checks:[],typeName:q.ZodBigInt,coerce:t?.coerce??!1,...pZ(t)});class p7 extends pV{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==pP.boolean){let r=this._getOrReturnCtx(t);return pC(r,{code:pO.invalid_type,expected:pP.boolean,received:r.parsedType}),pq}return pA(t.data)}}p7.create=t=>new p7({typeName:q.ZodBoolean,coerce:t?.coerce||!1,...pZ(t)});class me extends pV{_parse(t){let r;if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==pP.date){let r=this._getOrReturnCtx(t);return pC(r,{code:pO.invalid_type,expected:pP.date,received:r.parsedType}),pq}if(Number.isNaN(t.data.getTime()))return pC(this._getOrReturnCtx(t),{code:pO.invalid_date}),pq;let a=new pI;for(let i of this._def.checks)"min"===i.kind?t.data.getTime()<i.value&&(pC(r=this._getOrReturnCtx(t,r),{code:pO.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),a.dirty()):"max"===i.kind?t.data.getTime()>i.value&&(pC(r=this._getOrReturnCtx(t,r),{code:pO.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),a.dirty()):N.assertNever(i);return{status:a.value,value:new Date(t.data.getTime())}}_addCheck(t){return new me({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:I.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:I.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)"min"===r.kind&&(null===t||r.value>t)&&(t=r.value);return null!=t?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)"max"===r.kind&&(null===t||r.value<t)&&(t=r.value);return null!=t?new Date(t):null}}me.create=t=>new me({checks:[],coerce:t?.coerce||!1,typeName:q.ZodDate,...pZ(t)});class mt extends pV{_parse(t){if(this._getType(t)!==pP.symbol){let r=this._getOrReturnCtx(t);return pC(r,{code:pO.invalid_type,expected:pP.symbol,received:r.parsedType}),pq}return pA(t.data)}}mt.create=t=>new mt({typeName:q.ZodSymbol,...pZ(t)});class mr extends pV{_parse(t){if(this._getType(t)!==pP.undefined){let r=this._getOrReturnCtx(t);return pC(r,{code:pO.invalid_type,expected:pP.undefined,received:r.parsedType}),pq}return pA(t.data)}}mr.create=t=>new mr({typeName:q.ZodUndefined,...pZ(t)});class ma extends pV{_parse(t){if(this._getType(t)!==pP.null){let r=this._getOrReturnCtx(t);return pC(r,{code:pO.invalid_type,expected:pP.null,received:r.parsedType}),pq}return pA(t.data)}}ma.create=t=>new ma({typeName:q.ZodNull,...pZ(t)});class mi extends pV{constructor(){super(...arguments),this._any=!0}_parse(t){return pA(t.data)}}mi.create=t=>new mi({typeName:q.ZodAny,...pZ(t)});class mn extends pV{constructor(){super(...arguments),this._unknown=!0}_parse(t){return pA(t.data)}}mn.create=t=>new mn({typeName:q.ZodUnknown,...pZ(t)});class mo extends pV{_parse(t){let r=this._getOrReturnCtx(t);return pC(r,{code:pO.invalid_type,expected:pP.never,received:r.parsedType}),pq}}mo.create=t=>new mo({typeName:q.ZodNever,...pZ(t)});class ms extends pV{_parse(t){if(this._getType(t)!==pP.undefined){let r=this._getOrReturnCtx(t);return pC(r,{code:pO.invalid_type,expected:pP.void,received:r.parsedType}),pq}return pA(t.data)}}ms.create=t=>new ms({typeName:q.ZodVoid,...pZ(t)});class ml extends pV{_parse(t){let{ctx:r,status:a}=this._processInputParams(t),i=this._def;if(r.parsedType!==pP.array)return pC(r,{code:pO.invalid_type,expected:pP.array,received:r.parsedType}),pq;if(null!==i.exactLength){let t=r.data.length>i.exactLength.value,n=r.data.length<i.exactLength.value;(t||n)&&(pC(r,{code:t?pO.too_big:pO.too_small,minimum:n?i.exactLength.value:void 0,maximum:t?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),a.dirty())}if(null!==i.minLength&&r.data.length<i.minLength.value&&(pC(r,{code:pO.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),a.dirty()),null!==i.maxLength&&r.data.length>i.maxLength.value&&(pC(r,{code:pO.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),a.dirty()),r.common.async)return Promise.all([...r.data].map((t,a)=>i.type._parseAsync(new pL(r,t,r.path,a)))).then(t=>pI.mergeArray(a,t));let n=[...r.data].map((t,a)=>i.type._parseSync(new pL(r,t,r.path,a)));return pI.mergeArray(a,n)}get element(){return this._def.type}min(t,r){return new ml({...this._def,minLength:{value:t,message:I.toString(r)}})}max(t,r){return new ml({...this._def,maxLength:{value:t,message:I.toString(r)}})}length(t,r){return new ml({...this._def,exactLength:{value:t,message:I.toString(r)}})}nonempty(t){return this.min(1,t)}}ml.create=(t,r)=>new ml({type:t,minLength:null,maxLength:null,exactLength:null,typeName:q.ZodArray,...pZ(r)});class mc extends pV{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let t=this._def.shape(),r=N.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==pP.object){let r=this._getOrReturnCtx(t);return pC(r,{code:pO.invalid_type,expected:pP.object,received:r.parsedType}),pq}let{status:r,ctx:a}=this._processInputParams(t),{shape:i,keys:n}=this._getCached(),o=[];if(!(this._def.catchall instanceof mo&&"strip"===this._def.unknownKeys))for(let t in a.data)n.includes(t)||o.push(t);let s=[];for(let t of n){let r=i[t],n=a.data[t];s.push({key:{status:"valid",value:t},value:r._parse(new pL(a,n,a.path,t)),alwaysSet:t in a.data})}if(this._def.catchall instanceof mo){let t=this._def.unknownKeys;if("passthrough"===t)for(let t of o)s.push({key:{status:"valid",value:t},value:{status:"valid",value:a.data[t]}});else if("strict"===t)o.length>0&&(pC(a,{code:pO.unrecognized_keys,keys:o}),r.dirty());else if("strip"===t);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let t=this._def.catchall;for(let r of o){let i=a.data[r];s.push({key:{status:"valid",value:r},value:t._parse(new pL(a,i,a.path,r)),alwaysSet:r in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let t=[];for(let r of s){let a=await r.key,i=await r.value;t.push({key:a,value:i,alwaysSet:r.alwaysSet})}return t}).then(t=>pI.mergeObjectSync(r,t)):pI.mergeObjectSync(r,s)}get shape(){return this._def.shape()}strict(t){return I.errToObj,new mc({...this._def,unknownKeys:"strict",...void 0!==t?{errorMap:(r,a)=>{let i=this._def.errorMap?.(r,a).message??a.defaultError;return"unrecognized_keys"===r.code?{message:I.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new mc({...this._def,unknownKeys:"strip"})}passthrough(){return new mc({...this._def,unknownKeys:"passthrough"})}extend(t){return new mc({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new mc({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:q.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new mc({...this._def,catchall:t})}pick(t){let r={};for(let a of N.objectKeys(t))t[a]&&this.shape[a]&&(r[a]=this.shape[a]);return new mc({...this._def,shape:()=>r})}omit(t){let r={};for(let a of N.objectKeys(this.shape))t[a]||(r[a]=this.shape[a]);return new mc({...this._def,shape:()=>r})}deepPartial(){return function t(r){if(r instanceof mc){let a={};for(let i in r.shape){let n=r.shape[i];a[i]=mR.create(t(n))}return new mc({...r._def,shape:()=>a})}if(r instanceof ml)return new ml({...r._def,type:t(r.element)});if(r instanceof mR)return mR.create(t(r.unwrap()));if(r instanceof mP)return mP.create(t(r.unwrap()));if(r instanceof mh)return mh.create(r.items.map(r=>t(r)));else return r}(this)}partial(t){let r={};for(let a of N.objectKeys(this.shape)){let i=this.shape[a];t&&!t[a]?r[a]=i:r[a]=i.optional()}return new mc({...this._def,shape:()=>r})}required(t){let r={};for(let a of N.objectKeys(this.shape))if(t&&!t[a])r[a]=this.shape[a];else{let t=this.shape[a];for(;t instanceof mR;)t=t._def.innerType;r[a]=t}return new mc({...this._def,shape:()=>r})}keyof(){return mS(N.objectKeys(this.shape))}}mc.create=(t,r)=>new mc({shape:()=>t,unknownKeys:"strip",catchall:mo.create(),typeName:q.ZodObject,...pZ(r)}),mc.strictCreate=(t,r)=>new mc({shape:()=>t,unknownKeys:"strict",catchall:mo.create(),typeName:q.ZodObject,...pZ(r)}),mc.lazycreate=(t,r)=>new mc({shape:t,unknownKeys:"strip",catchall:mo.create(),typeName:q.ZodObject,...pZ(r)});class mu extends pV{_parse(t){let{ctx:r}=this._processInputParams(t),a=this._def.options;if(r.common.async)return Promise.all(a.map(async t=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await t._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(function(t){for(let r of t)if("valid"===r.result.status)return r.result;for(let a of t)if("dirty"===a.result.status)return r.common.issues.push(...a.ctx.common.issues),a.result;let a=t.map(t=>new pT(t.ctx.common.issues));return pC(r,{code:pO.invalid_union,unionErrors:a}),pq});{let t,i=[];for(let n of a){let a={...r,common:{...r.common,issues:[]},parent:null},o=n._parseSync({data:r.data,path:r.path,parent:a});if("valid"===o.status)return o;"dirty"!==o.status||t||(t={result:o,ctx:a}),a.common.issues.length&&i.push(a.common.issues)}if(t)return r.common.issues.push(...t.ctx.common.issues),t.result;let n=i.map(t=>new pT(t));return pC(r,{code:pO.invalid_union,unionErrors:n}),pq}}get options(){return this._def.options}}mu.create=(t,r)=>new mu({options:t,typeName:q.ZodUnion,...pZ(r)});let md=t=>{if(t instanceof m_)return md(t.schema);if(t instanceof mx)return md(t.innerType());if(t instanceof mb)return[t.value];if(t instanceof m$)return t.options;if(t instanceof mw)return N.objectValues(t.enum);else if(t instanceof mE)return md(t._def.innerType);else if(t instanceof mr)return[void 0];else if(t instanceof ma)return[null];else if(t instanceof mR)return[void 0,...md(t.unwrap())];else if(t instanceof mP)return[null,...md(t.unwrap())];else if(t instanceof mj)return md(t.unwrap());else if(t instanceof mC)return md(t.unwrap());else if(t instanceof mO)return md(t._def.innerType);else return[]};class mp extends pV{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==pP.object)return pC(r,{code:pO.invalid_type,expected:pP.object,received:r.parsedType}),pq;let a=this.discriminator,i=r.data[a],n=this.optionsMap.get(i);return n?r.common.async?n._parseAsync({data:r.data,path:r.path,parent:r}):n._parseSync({data:r.data,path:r.path,parent:r}):(pC(r,{code:pO.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),pq)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,a){let i=new Map;for(let a of r){let r=md(a.shape[t]);if(!r.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let n of r){if(i.has(n))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(n)}`);i.set(n,a)}}return new mp({typeName:q.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,...pZ(a)})}}class mm extends pV{_parse(t){let{status:r,ctx:a}=this._processInputParams(t),i=(t,i)=>{if("aborted"===t.status||"aborted"===i.status)return pq;let n=function t(r,a){let i=pE(r),n=pE(a);if(r===a)return{valid:!0,data:r};if(i===pP.object&&n===pP.object){let i=N.objectKeys(a),n=N.objectKeys(r).filter(t=>-1!==i.indexOf(t)),o={...r,...a};for(let i of n){let n=t(r[i],a[i]);if(!n.valid)return{valid:!1};o[i]=n.data}return{valid:!0,data:o}}if(i===pP.array&&n===pP.array){if(r.length!==a.length)return{valid:!1};let i=[];for(let n=0;n<r.length;n++){let o=t(r[n],a[n]);if(!o.valid)return{valid:!1};i.push(o.data)}return{valid:!0,data:i}}if(i===pP.date&&n===pP.date&&+r==+a)return{valid:!0,data:r};return{valid:!1}}(t.value,i.value);return n.valid?(("dirty"===t.status||"dirty"===i.status)&&r.dirty(),{status:r.value,value:n.data}):(pC(a,{code:pO.invalid_intersection_types}),pq)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([t,r])=>i(t,r)):i(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}}mm.create=(t,r,a)=>new mm({left:t,right:r,typeName:q.ZodIntersection,...pZ(a)});class mh extends pV{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==pP.array)return pC(a,{code:pO.invalid_type,expected:pP.array,received:a.parsedType}),pq;if(a.data.length<this._def.items.length)return pC(a,{code:pO.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),pq;!this._def.rest&&a.data.length>this._def.items.length&&(pC(a,{code:pO.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...a.data].map((t,r)=>{let i=this._def.items[r]||this._def.rest;return i?i._parse(new pL(a,t,a.path,r)):null}).filter(t=>!!t);return a.common.async?Promise.all(i).then(t=>pI.mergeArray(r,t)):pI.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new mh({...this._def,rest:t})}}mh.create=(t,r)=>{if(!Array.isArray(t))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new mh({items:t,typeName:q.ZodTuple,rest:null,...pZ(r)})};class mf extends pV{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==pP.object)return pC(a,{code:pO.invalid_type,expected:pP.object,received:a.parsedType}),pq;let i=[],n=this._def.keyType,o=this._def.valueType;for(let t in a.data)i.push({key:n._parse(new pL(a,t,a.path,t)),value:o._parse(new pL(a,a.data[t],a.path,t)),alwaysSet:t in a.data});return a.common.async?pI.mergeObjectAsync(r,i):pI.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,a){return new mf(r instanceof pV?{keyType:t,valueType:r,typeName:q.ZodRecord,...pZ(a)}:{keyType:p3.create(),valueType:t,typeName:q.ZodRecord,...pZ(r)})}}class my extends pV{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==pP.map)return pC(a,{code:pO.invalid_type,expected:pP.map,received:a.parsedType}),pq;let i=this._def.keyType,n=this._def.valueType,o=[...a.data.entries()].map(([t,r],o)=>({key:i._parse(new pL(a,t,a.path,[o,"key"])),value:n._parse(new pL(a,r,a.path,[o,"value"]))}));if(a.common.async){let t=new Map;return Promise.resolve().then(async()=>{for(let a of o){let i=await a.key,n=await a.value;if("aborted"===i.status||"aborted"===n.status)return pq;("dirty"===i.status||"dirty"===n.status)&&r.dirty(),t.set(i.value,n.value)}return{status:r.value,value:t}})}{let t=new Map;for(let a of o){let i=a.key,n=a.value;if("aborted"===i.status||"aborted"===n.status)return pq;("dirty"===i.status||"dirty"===n.status)&&r.dirty(),t.set(i.value,n.value)}return{status:r.value,value:t}}}}my.create=(t,r,a)=>new my({valueType:r,keyType:t,typeName:q.ZodMap,...pZ(a)});class mg extends pV{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==pP.set)return pC(a,{code:pO.invalid_type,expected:pP.set,received:a.parsedType}),pq;let i=this._def;null!==i.minSize&&a.data.size<i.minSize.value&&(pC(a,{code:pO.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),null!==i.maxSize&&a.data.size>i.maxSize.value&&(pC(a,{code:pO.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let n=this._def.valueType;function o(t){let a=new Set;for(let i of t){if("aborted"===i.status)return pq;"dirty"===i.status&&r.dirty(),a.add(i.value)}return{status:r.value,value:a}}let s=[...a.data.values()].map((t,r)=>n._parse(new pL(a,t,a.path,r)));return a.common.async?Promise.all(s).then(t=>o(t)):o(s)}min(t,r){return new mg({...this._def,minSize:{value:t,message:I.toString(r)}})}max(t,r){return new mg({...this._def,maxSize:{value:t,message:I.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}}mg.create=(t,r)=>new mg({valueType:t,minSize:null,maxSize:null,typeName:q.ZodSet,...pZ(r)});class mv extends pV{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==pP.function)return pC(r,{code:pO.invalid_type,expected:pP.function,received:r.parsedType}),pq;function a(t,a){return pN({data:t,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,pj,pj].filter(t=>!!t),issueData:{code:pO.invalid_arguments,argumentsError:a}})}function i(t,a){return pN({data:t,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,pj,pj].filter(t=>!!t),issueData:{code:pO.invalid_return_type,returnTypeError:a}})}let n={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof mk){let t=this;return pA(async function(...r){let s=new pT([]),l=await t._def.args.parseAsync(r,n).catch(t=>{throw s.addIssue(a(r,t)),s}),c=await Reflect.apply(o,this,l);return await t._def.returns._def.type.parseAsync(c,n).catch(t=>{throw s.addIssue(i(c,t)),s})})}{let t=this;return pA(function(...r){let s=t._def.args.safeParse(r,n);if(!s.success)throw new pT([a(r,s.error)]);let l=Reflect.apply(o,this,s.data),c=t._def.returns.safeParse(l,n);if(!c.success)throw new pT([i(l,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new mv({...this._def,args:mh.create(t).rest(mn.create())})}returns(t){return new mv({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,a){return new mv({args:t||mh.create([]).rest(mn.create()),returns:r||mn.create(),typeName:q.ZodFunction,...pZ(a)})}}class m_ extends pV{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}m_.create=(t,r)=>new m_({getter:t,typeName:q.ZodLazy,...pZ(r)});class mb extends pV{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return pC(r,{received:r.data,code:pO.invalid_literal,expected:this._def.value}),pq}return{status:"valid",value:t.data}}get value(){return this._def.value}}function mS(t,r){return new m$({values:t,typeName:q.ZodEnum,...pZ(r)})}mb.create=(t,r)=>new mb({value:t,typeName:q.ZodLiteral,...pZ(r)});class m$ extends pV{_parse(t){if("string"!=typeof t.data){let r=this._getOrReturnCtx(t),a=this._def.values;return pC(r,{expected:N.joinValues(a),received:r.parsedType,code:pO.invalid_type}),pq}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),a=this._def.values;return pC(r,{received:r.data,code:pO.invalid_enum_value,options:a}),pq}return pA(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return m$.create(t,{...this._def,...r})}exclude(t,r=this._def){return m$.create(this.options.filter(r=>!t.includes(r)),{...this._def,...r})}}m$.create=mS;class mw extends pV{_parse(t){let r=N.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(t);if(a.parsedType!==pP.string&&a.parsedType!==pP.number){let t=N.objectValues(r);return pC(a,{expected:N.joinValues(t),received:a.parsedType,code:pO.invalid_type}),pq}if(this._cache||(this._cache=new Set(N.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let t=N.objectValues(r);return pC(a,{received:a.data,code:pO.invalid_enum_value,options:t}),pq}return pA(t.data)}get enum(){return this._def.values}}mw.create=(t,r)=>new mw({values:t,typeName:q.ZodNativeEnum,...pZ(r)});class mk extends pV{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);return r.parsedType!==pP.promise&&!1===r.common.async?(pC(r,{code:pO.invalid_type,expected:pP.promise,received:r.parsedType}),pq):pA((r.parsedType===pP.promise?r.data:Promise.resolve(r.data)).then(t=>this._def.type.parseAsync(t,{path:r.path,errorMap:r.common.contextualErrorMap})))}}mk.create=(t,r)=>new mk({type:t,typeName:q.ZodPromise,...pZ(r)});class mx extends pV{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===q.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:a}=this._processInputParams(t),i=this._def.effect||null,n={addIssue:t=>{pC(a,t),t.fatal?r.abort():r.dirty()},get path(){return a.path}};if(n.addIssue=n.addIssue.bind(n),"preprocess"===i.type){let t=i.transform(a.data,n);if(a.common.async)return Promise.resolve(t).then(async t=>{if("aborted"===r.value)return pq;let i=await this._def.schema._parseAsync({data:t,path:a.path,parent:a});return"aborted"===i.status?pq:"dirty"===i.status||"dirty"===r.value?pz(i.value):i});{if("aborted"===r.value)return pq;let i=this._def.schema._parseSync({data:t,path:a.path,parent:a});return"aborted"===i.status?pq:"dirty"===i.status||"dirty"===r.value?pz(i.value):i}}if("refinement"===i.type){let t=t=>{let r=i.refinement(t,n);if(a.common.async)return Promise.resolve(r);if(r instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return t};if(!1!==a.common.async)return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(a=>"aborted"===a.status?pq:("dirty"===a.status&&r.dirty(),t(a.value).then(()=>({status:r.value,value:a.value}))));{let i=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===i.status?pq:("dirty"===i.status&&r.dirty(),t(i.value),{status:r.value,value:i.value})}}if("transform"===i.type)if(!1!==a.common.async)return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(t=>"valid"!==t.status?pq:Promise.resolve(i.transform(t.value,n)).then(t=>({status:r.value,value:t})));else{let t=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if("valid"!==t.status)return pq;let o=i.transform(t.value,n);if(o instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}N.assertNever(i)}}mx.create=(t,r,a)=>new mx({schema:t,typeName:q.ZodEffects,effect:r,...pZ(a)}),mx.createWithPreprocess=(t,r,a)=>new mx({schema:r,effect:{type:"preprocess",transform:t},typeName:q.ZodEffects,...pZ(a)});class mR extends pV{_parse(t){return this._getType(t)===pP.undefined?pA(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}mR.create=(t,r)=>new mR({innerType:t,typeName:q.ZodOptional,...pZ(r)});class mP extends pV{_parse(t){return this._getType(t)===pP.null?pA(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}mP.create=(t,r)=>new mP({innerType:t,typeName:q.ZodNullable,...pZ(r)});class mE extends pV{_parse(t){let{ctx:r}=this._processInputParams(t),a=r.data;return r.parsedType===pP.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}mE.create=(t,r)=>new mE({innerType:t,typeName:q.ZodDefault,defaultValue:"function"==typeof r.default?r.default:()=>r.default,...pZ(r)});class mO extends pV{_parse(t){let{ctx:r}=this._processInputParams(t),a={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return pM(i)?i.then(t=>({status:"valid",value:"valid"===t.status?t.value:this._def.catchValue({get error(){return new pT(a.common.issues)},input:a.data})})):{status:"valid",value:"valid"===i.status?i.value:this._def.catchValue({get error(){return new pT(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}}mO.create=(t,r)=>new mO({innerType:t,typeName:q.ZodCatch,catchValue:"function"==typeof r.catch?r.catch:()=>r.catch,...pZ(r)});class mT extends pV{_parse(t){if(this._getType(t)!==pP.nan){let r=this._getOrReturnCtx(t);return pC(r,{code:pO.invalid_type,expected:pP.nan,received:r.parsedType}),pq}return{status:"valid",value:t.data}}}mT.create=t=>new mT({typeName:q.ZodNaN,...pZ(t)}),Symbol("zod_brand");class mj extends pV{_parse(t){let{ctx:r}=this._processInputParams(t),a=r.data;return this._def.type._parse({data:a,path:r.path,parent:r})}unwrap(){return this._def.type}}class mN extends pV{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.common.async)return(async()=>{let t=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return"aborted"===t.status?pq:"dirty"===t.status?(r.dirty(),pz(t.value)):this._def.out._parseAsync({data:t.value,path:a.path,parent:a})})();{let t=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===t.status?pq:"dirty"===t.status?(r.dirty(),{status:"dirty",value:t.value}):this._def.out._parseSync({data:t.value,path:a.path,parent:a})}}static create(t,r){return new mN({in:t,out:r,typeName:q.ZodPipeline})}}class mC extends pV{_parse(t){let r=this._def.innerType._parse(t),a=t=>("valid"===t.status&&(t.value=Object.freeze(t.value)),t);return pM(r)?r.then(t=>a(t)):a(r)}unwrap(){return this._def.innerType}}mC.create=(t,r)=>new mC({innerType:t,typeName:q.ZodReadonly,...pZ(r)}),mc.lazycreate,(E=q||(q={})).ZodString="ZodString",E.ZodNumber="ZodNumber",E.ZodNaN="ZodNaN",E.ZodBigInt="ZodBigInt",E.ZodBoolean="ZodBoolean",E.ZodDate="ZodDate",E.ZodSymbol="ZodSymbol",E.ZodUndefined="ZodUndefined",E.ZodNull="ZodNull",E.ZodAny="ZodAny",E.ZodUnknown="ZodUnknown",E.ZodNever="ZodNever",E.ZodVoid="ZodVoid",E.ZodArray="ZodArray",E.ZodObject="ZodObject",E.ZodUnion="ZodUnion",E.ZodDiscriminatedUnion="ZodDiscriminatedUnion",E.ZodIntersection="ZodIntersection",E.ZodTuple="ZodTuple",E.ZodRecord="ZodRecord",E.ZodMap="ZodMap",E.ZodSet="ZodSet",E.ZodFunction="ZodFunction",E.ZodLazy="ZodLazy",E.ZodLiteral="ZodLiteral",E.ZodEnum="ZodEnum",E.ZodEffects="ZodEffects",E.ZodNativeEnum="ZodNativeEnum",E.ZodOptional="ZodOptional",E.ZodNullable="ZodNullable",E.ZodDefault="ZodDefault",E.ZodCatch="ZodCatch",E.ZodPromise="ZodPromise",E.ZodBranded="ZodBranded",E.ZodPipeline="ZodPipeline",E.ZodReadonly="ZodReadonly",p3.create,p5.create,mT.create,p8.create,p7.create,me.create,mt.create,mr.create,ma.create,mi.create,mn.create,mo.create,ms.create,ml.create,mc.create,mc.strictCreate,mu.create,mp.create,mm.create,mh.create,mf.create,my.create,mg.create,mv.create,m_.create,mb.create,m$.create,mw.create,mk.create,mx.create,mR.create,mP.create,mx.createWithPreprocess,mN.create;let mI=(t,r)=>{let a=0;for(;a<t.length&&a<r.length&&t[a]===r[a];a++);return[(t.length-a).toString(),...r.slice(a)].join("/")};function mq(t){if("openAi"!==t.target)return{};let r=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===t.$refStrategy?mI(r,t.currentPath):r.join("/")}}function mz(t,r,a,i){i?.errorMessages&&a&&(t.errorMessage={...t.errorMessage,[r]:a})}function mA(t,r,a,i,n){t[r]=a,mz(t,r,i,n)}function mM(t,r){return m6(t.type._def,r)}let mL=/^[cC][^\s-]{8,}$/,mD=/^[0-9a-z]+$/,mZ=/^[0-9A-HJKMNP-TV-Z]{26}$/,mV=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,mF=()=>(void 0===$&&($=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),$),mU=/^(?:(?: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])$/,mJ=/^(([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])$/,mH=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,mK=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,mB=/^[a-zA-Z0-9_-]{21}$/,mW=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function mG(t,r){let a={type:"string"};if(t.checks)for(let i of t.checks)switch(i.kind){case"min":mA(a,"minLength","number"==typeof a.minLength?Math.max(a.minLength,i.value):i.value,i.message,r);break;case"max":mA(a,"maxLength","number"==typeof a.maxLength?Math.min(a.maxLength,i.value):i.value,i.message,r);break;case"email":switch(r.emailStrategy){case"format:email":mQ(a,"email",i.message,r);break;case"format:idn-email":mQ(a,"idn-email",i.message,r);break;case"pattern:zod":m0(a,mV,i.message,r)}break;case"url":mQ(a,"uri",i.message,r);break;case"uuid":mQ(a,"uuid",i.message,r);break;case"regex":m0(a,i.regex,i.message,r);break;case"cuid":m0(a,mL,i.message,r);break;case"cuid2":m0(a,mD,i.message,r);break;case"startsWith":m0(a,RegExp(`^${mY(i.value,r)}`),i.message,r);break;case"endsWith":m0(a,RegExp(`${mY(i.value,r)}$`),i.message,r);break;case"datetime":mQ(a,"date-time",i.message,r);break;case"date":mQ(a,"date",i.message,r);break;case"time":mQ(a,"time",i.message,r);break;case"duration":mQ(a,"duration",i.message,r);break;case"length":mA(a,"minLength","number"==typeof a.minLength?Math.max(a.minLength,i.value):i.value,i.message,r),mA(a,"maxLength","number"==typeof a.maxLength?Math.min(a.maxLength,i.value):i.value,i.message,r);break;case"includes":m0(a,RegExp(mY(i.value,r)),i.message,r);break;case"ip":"v6"!==i.version&&mQ(a,"ipv4",i.message,r),"v4"!==i.version&&mQ(a,"ipv6",i.message,r);break;case"base64url":m0(a,mK,i.message,r);break;case"jwt":m0(a,mW,i.message,r);break;case"cidr":"v6"!==i.version&&m0(a,mU,i.message,r),"v4"!==i.version&&m0(a,mJ,i.message,r);break;case"emoji":m0(a,mF(),i.message,r);break;case"ulid":m0(a,mZ,i.message,r);break;case"base64":switch(r.base64Strategy){case"format:binary":mQ(a,"binary",i.message,r);break;case"contentEncoding:base64":mA(a,"contentEncoding","base64",i.message,r);break;case"pattern:zod":m0(a,mH,i.message,r)}break;case"nanoid":m0(a,mB,i.message,r)}return a}function mY(t,r){return"escape"===r.patternStrategy?function(t){let r="";for(let a=0;a<t.length;a++)mX.has(t[a])||(r+="\\"),r+=t[a];return r}(t):t}let mX=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function mQ(t,r,a,i){t.format||t.anyOf?.some(t=>t.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&i.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,0===Object.keys(t.errorMessage).length&&delete t.errorMessage)),t.anyOf.push({format:r,...a&&i.errorMessages&&{errorMessage:{format:a}}})):mA(t,"format",r,a,i)}function m0(t,r,a,i){t.pattern||t.allOf?.some(t=>t.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&i.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,0===Object.keys(t.errorMessage).length&&delete t.errorMessage)),t.allOf.push({pattern:m1(r,i),...a&&i.errorMessages&&{errorMessage:{pattern:a}}})):mA(t,"pattern",m1(r,i),a,i)}function m1(t,r){if(!r.applyRegexFlags||!t.flags)return t.source;let a={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},i=a.i?t.source.toLowerCase():t.source,n="",o=!1,s=!1,l=!1;for(let t=0;t<i.length;t++){if(o){n+=i[t],o=!1;continue}if(a.i){if(s){if(i[t].match(/[a-z]/)){l?(n+=i[t],n+=`${i[t-2]}-${i[t]}`.toUpperCase(),l=!1):"-"===i[t+1]&&i[t+2]?.match(/[a-z]/)?(n+=i[t],l=!0):n+=`${i[t]}${i[t].toUpperCase()}`;continue}}else if(i[t].match(/[a-z]/)){n+=`[${i[t]}${i[t].toUpperCase()}]`;continue}}if(a.m){if("^"===i[t]){n+=`(^|(?<=[\r
|
|
61
|
+
deps: ${i}}`};let n={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(t){let[r,a]=function({schema:t}){let r={},a={};for(let i in t)"__proto__"!==i&&((Array.isArray(t[i])?r:a)[i]=t[i]);return[r,a]}(t);o(t,r),s(t,a)}};function o(t,a=t.schema){let{gen:n,data:s,it:l}=t;if(0===Object.keys(a).length)return;let c=n.let("missing");for(let o in a){let u=a[o];if(0===u.length)continue;let d=(0,i.propertyInData)(n,s,o,l.opts.ownProperties);t.setParams({property:o,depsCount:u.length,deps:u.join(", ")}),l.allErrors?n.if(d,()=>{for(let r of u)(0,i.checkReportMissingProp)(t,r)}):(n.if((0,r._)`${d} && (${(0,i.checkMissingProp)(t,u,c)})`),(0,i.reportMissingProp)(t,c),n.else())}}function s(t,r=t.schema){let{gen:n,data:o,keyword:l,it:c}=t,u=n.name("valid");for(let s in r)(0,a.alwaysValidSchema)(c,r[s])||(n.if((0,i.propertyInData)(n,o,s,c.opts.ownProperties),()=>{let r=t.subschema({keyword:l,schemaProp:s},u);t.mergeValidEvaluated(r,u)},()=>n.var(u,!0)),t.ok(u))}t.validatePropertyDeps=o,t.validateSchemaDeps=s,t.default=n}),dr=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u_(),a=ub();t.default={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:t})=>(0,r._)`{propertyName: ${t.propertyName}}`},code(t){let{gen:i,schema:n,data:o,it:s}=t;if((0,a.alwaysValidSchema)(s,n))return;let l=i.name("valid");i.forIn("key",o,a=>{t.setParams({propertyName:a}),t.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},l),i.if((0,r.not)(l),()=>{t.error(!0),s.allErrors||i.break()})}),t.ok(l)}}}),da=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uE(),a=u_(),i=uS(),n=ub();t.default={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:t})=>(0,a._)`{additionalProperty: ${t.additionalProperty}}`},code(t){let{gen:o,schema:s,parentSchema:l,data:c,errsCount:u,it:d}=t;if(!u)throw Error("ajv implementation error");let{allErrors:p,opts:m}=d;if(d.props=!0,"all"!==m.removeAdditional&&(0,n.alwaysValidSchema)(d,s))return;let h=(0,r.allSchemaProperties)(l.properties),f=(0,r.allSchemaProperties)(l.patternProperties);function y(t){o.code((0,a._)`delete ${c}[${t}]`)}function g(r){if("all"===m.removeAdditional||m.removeAdditional&&!1===s)return void y(r);if(!1===s){t.setParams({additionalProperty:r}),t.error(),p||o.break();return}if("object"==typeof s&&!(0,n.alwaysValidSchema)(d,s)){let i=o.name("valid");"failing"===m.removeAdditional?(v(r,i,!1),o.if((0,a.not)(i),()=>{t.reset(),y(r)})):(v(r,i),p||o.if((0,a.not)(i),()=>o.break()))}}function v(r,a,i){let o={keyword:"additionalProperties",dataProp:r,dataPropType:n.Type.Str};!1===i&&Object.assign(o,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(o,a)}o.forIn("key",c,i=>{h.length||f.length?o.if(function(i){let s;if(h.length>8){let t=(0,n.schemaRefOrVal)(d,l.properties,"properties");s=(0,r.isOwnProperty)(o,t,i)}else s=h.length?(0,a.or)(...h.map(t=>(0,a._)`${i} === ${t}`)):a.nil;return f.length&&(s=(0,a.or)(s,...f.map(n=>(0,a._)`${(0,r.usePattern)(t,n)}.test(${i})`))),(0,a.not)(s)}(i),()=>g(i)):g(i)}),t.ok((0,a._)`${u} === ${i.default.errors}`)}}}),di=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uI(),a=uE(),i=ub(),n=da();t.default={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:o,schema:s,parentSchema:l,data:c,it:u}=t;"all"===u.opts.removeAdditional&&void 0===l.additionalProperties&&n.default.code(new r.KeywordCxt(u,n.default,"additionalProperties"));let d=(0,a.allSchemaProperties)(s);for(let t of d)u.definedProperties.add(t);u.opts.unevaluated&&d.length&&!0!==u.props&&(u.props=i.mergeEvaluated.props(o,(0,i.toHash)(d),u.props));let p=d.filter(t=>!(0,i.alwaysValidSchema)(u,s[t]));if(0===p.length)return;let m=o.name("valid");for(let r of p){var h;(h=r,u.opts.useDefaults&&!u.compositeRule&&void 0!==s[h].default)?f(r):(o.if((0,a.propertyInData)(o,c,r,u.opts.ownProperties)),f(r),u.allErrors||o.else().var(m,!0),o.endIf()),t.it.definedProperties.add(r),t.ok(m)}function f(r){t.subschema({keyword:"properties",schemaProp:r,dataProp:r},m)}}}}),dn=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uE(),a=u_(),i=ub(),n=ub();t.default={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:o,schema:s,data:l,parentSchema:c,it:u}=t,{opts:d}=u,p=(0,r.allSchemaProperties)(s),m=p.filter(t=>(0,i.alwaysValidSchema)(u,s[t]));if(0===p.length||m.length===p.length&&(!u.opts.unevaluated||!0===u.props))return;let h=d.strictSchema&&!d.allowMatchingProperties&&c.properties,f=o.name("valid");!0===u.props||u.props instanceof a.Name||(u.props=(0,n.evaluatedPropsToName)(o,u.props));let{props:y}=u;for(let t of p)h&&function(t){for(let r in h)new RegExp(t).test(r)&&(0,i.checkStrictMode)(u,`property ${r} matches pattern ${t} (use allowMatchingProperties)`)}(t),u.allErrors?g(t):(o.var(f,!0),g(t),o.if(f));function g(i){o.forIn("key",l,s=>{o.if((0,a._)`${(0,r.usePattern)(t,i)}.test(${s})`,()=>{let r=m.includes(i);r||t.subschema({keyword:"patternProperties",schemaProp:i,dataProp:s,dataPropType:n.Type.Str},f),u.opts.unevaluated&&!0!==y?o.assign((0,a._)`${y}[${s}]`,!0):r||u.allErrors||o.if((0,a.not)(f),()=>o.break())})})}}}}),ds=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ub();t.default={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:a,schema:i,it:n}=t;if((0,r.alwaysValidSchema)(n,i))return void t.fail();let o=a.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),t.failResult(o,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}}}),dl=V(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:uE().validateUnion,error:{message:"must match a schema in anyOf"}}}),dc=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u_(),a=ub();t.default={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:t})=>(0,r._)`{passingSchemas: ${t.passing}}`},code(t){let{gen:i,schema:n,parentSchema:o,it:s}=t;if(!Array.isArray(n))throw Error("ajv implementation error");if(s.opts.discriminator&&o.discriminator)return;let l=i.let("valid",!1),c=i.let("passing",null),u=i.name("_valid");t.setParams({passing:c}),i.block(function(){n.forEach((n,o)=>{let d;(0,a.alwaysValidSchema)(s,n)?i.var(u,!0):d=t.subschema({keyword:"oneOf",schemaProp:o,compositeRule:!0},u),o>0&&i.if((0,r._)`${u} && ${l}`).assign(l,!1).assign(c,(0,r._)`[${c}, ${o}]`).else(),i.if(u,()=>{i.assign(l,!0),i.assign(c,o),d&&t.mergeEvaluated(d,r.Name)})})}),t.result(l,()=>t.reset(),()=>t.error(!0))}}}),du=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ub();t.default={keyword:"allOf",schemaType:"array",code(t){let{gen:a,schema:i,it:n}=t;if(!Array.isArray(i))throw Error("ajv implementation error");let o=a.name("valid");i.forEach((a,i)=>{if((0,r.alwaysValidSchema)(n,a))return;let s=t.subschema({keyword:"allOf",schemaProp:i},o);t.ok(o),t.mergeEvaluated(s)})}}}),dd=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u_(),a=ub();function i(t,r){let i=t.schema[r];return void 0!==i&&!(0,a.alwaysValidSchema)(t,i)}t.default={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:t})=>(0,r.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,r._)`{failingKeyword: ${t.ifClause}}`},code(t){let n,{gen:o,parentSchema:s,it:l}=t;void 0===s.then&&void 0===s.else&&(0,a.checkStrictMode)(l,'"if" without "then" and "else" is ignored');let c=i(l,"then"),u=i(l,"else");if(!c&&!u)return;let d=o.let("valid",!0),p=o.name("_valid");if(n=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},p),t.mergeEvaluated(n),t.reset(),c&&u){let r=o.let("ifClause");t.setParams({ifClause:r}),o.if(p,m("then",r),m("else",r))}else c?o.if(p,m("then")):o.if((0,r.not)(p),m("else"));function m(a,i){return()=>{let n=t.subschema({keyword:a},p);o.assign(d,p),t.mergeValidEvaluated(n,d),i?o.assign(i,(0,r._)`${a}`):t.setParams({ifClause:a})}}t.pass(d,()=>t.error(!0))}}}),dp=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ub();t.default={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:a,it:i}){void 0===a.if&&(0,r.checkStrictMode)(i,`"${t}" without "if" is ignored`)}}}),dm=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u5(),a=u8(),i=u3(),n=u7(),o=de(),s=dt(),l=dr(),c=da(),u=di(),d=dn(),p=ds(),m=dl(),h=dc(),f=du(),y=dd(),g=dp();t.default=function(t=!1){let v=[p.default,m.default,h.default,f.default,y.default,g.default,l.default,c.default,s.default,u.default,d.default];return t?v.push(a.default,n.default):v.push(r.default,i.default),v.push(o.default),v}}),dh=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u_();t.default={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,r.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,r._)`{format: ${t}}`},code(t,a){let i,n,o,s,l,c,{gen:u,data:d,$data:p,schema:m,schemaCode:h,it:f}=t,{opts:y,errSchemaPath:g,schemaEnv:v,self:_}=f;y.validateFormats&&(p?(i=u.scopeValue("formats",{ref:_.formats,code:y.code.formats}),n=u.const("fDef",(0,r._)`${i}[${h}]`),o=u.let("fType"),s=u.let("format"),u.if((0,r._)`typeof ${n} == "object" && !(${n} instanceof RegExp)`,()=>u.assign(o,(0,r._)`${n}.type || "string"`).assign(s,(0,r._)`${n}.validate`),()=>u.assign(o,(0,r._)`"string"`).assign(s,n)),t.fail$data((0,r.or)(!1===y.strictSchema?r.nil:(0,r._)`${h} && !${s}`,(l=v.$async?(0,r._)`(${n}.async ? await ${s}(${d}) : ${s}(${d}))`:(0,r._)`${s}(${d})`,c=(0,r._)`(typeof ${s} == "function" ? ${l} : ${s}.test(${d}))`,(0,r._)`${s} && ${s} !== true && ${o} === ${a} && !${c}`)))):function(){var i;let n,o,s=_.formats[m];if(!s){if(!1===y.strictSchema)return _.logger.warn(l());throw Error(l());function l(){return`unknown format "${m}" ignored in schema at path "${g}"`}}if(!0===s)return;let[c,p,h]=(n=(i=s)instanceof RegExp?(0,r.regexpCode)(i):y.code.formats?(0,r._)`${y.code.formats}${(0,r.getProperty)(m)}`:void 0,o=u.scopeValue("formats",{key:m,ref:i,code:n}),"object"!=typeof i||i instanceof RegExp?["string",i,o]:[i.type||"string",i.validate,(0,r._)`${o}.validate`]);c===a&&t.pass(function(){if("object"==typeof s&&!(s instanceof RegExp)&&s.async){if(!v.$async)throw Error("async format in sync schema");return(0,r._)`await ${h}(${d})`}return"function"==typeof p?(0,r._)`${h}(${d})`:(0,r._)`${h}.test(${d})`}())}())}}}),df=V(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=[dh().default]}),dy=V(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contentVocabulary=t.metadataVocabulary=void 0,t.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],t.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),dg=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uJ(),a=u6(),i=dm(),n=df(),o=dy();t.default=[r.default,a.default,(0,i.default)(),n.default,o.metadataVocabulary,o.contentVocabulary]}),dv=V(t=>{var r,a;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,(a=r||(t.DiscrError=r={})).Tag="tag",a.Mapping="mapping"}),d_=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u_(),a=dv(),i=uz(),n=uA(),o=ub();t.default={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:t,tagName:r}})=>t===a.DiscrError.Tag?`tag "${r}" must be string`:`value of tag "${r}" must be in oneOf`,params:({params:{discrError:t,tag:a,tagName:i}})=>(0,r._)`{error: ${t}, tag: ${i}, tagValue: ${a}}`},code(t){let{gen:s,data:l,schema:c,parentSchema:u,it:d}=t,{oneOf:p}=u;if(!d.opts.discriminator)throw Error("discriminator: requires discriminator option");let m=c.propertyName;if("string"!=typeof m)throw Error("discriminator: requires propertyName");if(c.mapping)throw Error("discriminator: mapping is not supported");if(!p)throw Error("discriminator: requires oneOf keyword");let h=s.let("valid",!1),f=s.const("tag",(0,r._)`${l}${(0,r.getProperty)(m)}`);s.if((0,r._)`typeof ${f} == "string"`,()=>(function(){let l=function(){var t;let r={},a=l(u),s=!0;for(let r=0;r<p.length;r++){let u=p[r];if((null==u?void 0:u.$ref)&&!(0,o.schemaHasRulesButRef)(u,d.self.RULES)){let t=u.$ref;if((u=i.resolveRef.call(d.self,d.schemaEnv.root,d.baseId,t))instanceof i.SchemaEnv&&(u=u.schema),void 0===u)throw new n.default(d.opts.uriResolver,d.baseId,t)}let h=null==(t=null==u?void 0:u.properties)?void 0:t[m];if("object"!=typeof h)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${m}"`);s=s&&(a||l(u)),function(t,r){if(t.const)c(t.const,r);else if(t.enum)for(let a of t.enum)c(a,r);else throw Error(`discriminator: "properties/${m}" must have "const" or "enum"`)}(h,r)}if(!s)throw Error(`discriminator: "${m}" must be required`);return r;function l({required:t}){return Array.isArray(t)&&t.includes(m)}function c(t,a){if("string"!=typeof t||t in r)throw Error(`discriminator: "${m}" values must be unique strings`);r[t]=a}}();for(let a in s.if(!1),l)s.elseIf((0,r._)`${f} === ${a}`),s.assign(h,function(a){let i=s.name("valid"),n=t.subschema({keyword:"oneOf",schemaProp:a},i);return t.mergeEvaluated(n,r.Name),i}(l[a]));s.else(),t.error(!1,{discrError:a.DiscrError.Mapping,tag:f,tagName:m}),s.endIf()})(),()=>t.error(!1,{discrError:a.DiscrError.Tag,tag:f,tagName:m})),t.ok(h)}}}),db=V((t,r)=>{r.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}),dS=V((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv=void 0;let a=uF(),i=dg(),n=d_(),o=db(),s=["/properties"],l="http://json-schema.org/draft-07/schema";var c=class extends a.default{_addVocabularies(){super._addVocabularies(),i.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(n.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(o,s):o;this.addMetaSchema(t,l,!1),this.refs["http://json-schema.org/schema"]=l}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}};t.Ajv=c,r.exports=t=c,r.exports.Ajv=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var u=uI();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=u_();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var p=uq();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return p.default}});var m=uA();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return m.default}})}),d$=V(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicAnchor=void 0;let r=u_(),a=uS(),i=uz(),n=uH();function o(t,o){let{gen:s,it:l}=t;l.schemaEnv.root.dynamicAnchors[o]=!0;let c=(0,r._)`${a.default.dynamicAnchors}${(0,r.getProperty)(o)}`,u="#"===l.errSchemaPath?l.validateName:function(t){let{schemaEnv:r,schema:a,self:o}=t.it,{root:s,baseId:l,localRefs:c,meta:u}=r.root,{schemaId:d}=o.opts,p=new i.SchemaEnv({schema:a,schemaId:d,root:s,baseId:l,localRefs:c,meta:u});return i.compileSchema.call(o,p),(0,n.getValidate)(t,p)}(t);s.if((0,r._)`!${c}`,()=>s.assign(c,u))}t.dynamicAnchor=o,t.default={keyword:"$dynamicAnchor",schemaType:"string",code:t=>o(t,t.schema)}}),dw=V(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicRef=void 0;let r=u_(),a=uS(),i=uH();function n(t,n){let{gen:o,keyword:s,it:l}=t;if("#"!==n[0])throw Error(`"${s}" only supports hash fragment reference`);let c=n.slice(1);if(l.allErrors)u();else{let r=o.let("valid",!1);u(r),t.ok(r)}function u(t){if(l.schemaEnv.root.dynamicAnchors[c]){let i=o.let("_v",(0,r._)`${a.default.dynamicAnchors}${(0,r.getProperty)(c)}`);o.if(i,d(i,t),d(l.validateName,t))}else d(l.validateName,t)()}function d(r,a){return a?()=>o.block(()=>{(0,i.callRef)(t,r),o.let(a,!0)}):()=>(0,i.callRef)(t,r)}}t.dynamicRef=n,t.default={keyword:"$dynamicRef",schemaType:"string",code:t=>n(t,t.schema)}}),dk=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=d$(),a=ub();t.default={keyword:"$recursiveAnchor",schemaType:"boolean",code(t){t.schema?(0,r.dynamicAnchor)(t,""):(0,a.checkStrictMode)(t.it,"$recursiveAnchor: false is ignored")}}}),dx=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dw();t.default={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,r.dynamicRef)(t,t.schema)}}),dR=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=d$(),a=dw(),i=dk(),n=dx();t.default=[r.default,a.default,i.default,n.default]}),dP=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dt();t.default={keyword:"dependentRequired",type:"object",schemaType:"object",error:r.error,code:t=>(0,r.validatePropertyDeps)(t)}}),dE=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dt();t.default={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,r.validateSchemaDeps)(t)}}),dj=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ub();t.default={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:t,parentSchema:a,it:i}){void 0===a.contains&&(0,r.checkStrictMode)(i,`"${t}" without "contains" is ignored`)}}}),dT=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dP(),a=dE(),i=dj();t.default=[r.default,a.default,i.default]}),dO=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u_(),a=ub(),i=uS();t.default={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:t})=>(0,r._)`{unevaluatedProperty: ${t.unevaluatedProperty}}`},code(t){let{gen:n,schema:o,data:s,errsCount:l,it:c}=t;if(!l)throw Error("ajv implementation error");let{allErrors:u,props:d}=c;function p(i){if(!1===o){t.setParams({unevaluatedProperty:i}),t.error(),u||n.break();return}if(!(0,a.alwaysValidSchema)(c,o)){let o=n.name("valid");t.subschema({keyword:"unevaluatedProperties",dataProp:i,dataPropType:a.Type.Str},o),u||n.if((0,r.not)(o),()=>n.break())}}d instanceof r.Name?n.if((0,r._)`${d} !== true`,()=>n.forIn("key",s,t=>{var a,i;return n.if((a=d,i=t,(0,r._)`!${a} || !${a}[${i}]`),()=>p(t))})):!0!==d&&n.forIn("key",s,t=>void 0===d?p(t):n.if(function(t,a){let i=[];for(let n in t)!0===t[n]&&i.push((0,r._)`${a} !== ${n}`);return(0,r.and)(...i)}(d,t),()=>p(t))),c.props=!0,t.ok((0,r._)`${l} === ${i.default.errors}`)}}}),dC=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u_(),a=ub();t.default={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:t}})=>(0,r.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,r._)`{limit: ${t}}`},code(t){let{gen:i,schema:n,data:o,it:s}=t,l=s.items||0;if(!0===l)return;let c=i.const("len",(0,r._)`${o}.length`);if(!1===n)t.setParams({len:l}),t.fail((0,r._)`${c} > ${l}`);else if("object"==typeof n&&!(0,a.alwaysValidSchema)(s,n)){let n=i.var("valid",(0,r._)`${c} <= ${l}`);i.if((0,r.not)(n),()=>{var o,u;return o=n,u=l,void i.forRange("i",u,c,n=>{t.subschema({keyword:"unevaluatedItems",dataProp:n,dataPropType:a.Type.Num},o),s.allErrors||i.if((0,r.not)(o),()=>i.break())})}),t.ok(n)}s.items=!0}}}),dN=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dO(),a=dC();t.default=[r.default,a.default]}),dI=V((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/schema",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format"},{$ref:"meta/content"}],type:["object","boolean"],properties:{definitions:{$comment:"While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},dependencies:{$comment:'"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"',type:"object",additionalProperties:{anyOf:[{$recursiveRef:"#"},{$ref:"meta/validation#/$defs/stringArray"}]}}}}}),dq=V((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/applicator":!0},$recursiveAnchor:!0,title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{additionalItems:{$recursiveRef:"#"},unevaluatedItems:{$recursiveRef:"#"},items:{anyOf:[{$recursiveRef:"#"},{$ref:"#/$defs/schemaArray"}]},contains:{$recursiveRef:"#"},additionalProperties:{$recursiveRef:"#"},unevaluatedProperties:{$recursiveRef:"#"},properties:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$recursiveRef:"#"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$recursiveRef:"#"}},propertyNames:{$recursiveRef:"#"},if:{$recursiveRef:"#"},then:{$recursiveRef:"#"},else:{$recursiveRef:"#"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$recursiveRef:"#"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$recursiveRef:"#"}}}}}),dA=V((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/content",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentMediaType:{type:"string"},contentEncoding:{type:"string"},contentSchema:{$recursiveRef:"#"}}}}),dz=V((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/core",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0},$recursiveAnchor:!0,title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{type:"string",format:"uri"},$anchor:{type:"string",pattern:"^[A-Za-z][-A-Za-z0-9.:_]*$"},$ref:{type:"string",format:"uri-reference"},$recursiveRef:{type:"string",format:"uri-reference"},$recursiveAnchor:{type:"boolean",default:!1},$vocabulary:{type:"object",propertyNames:{type:"string",format:"uri"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}}}}}),dM=V((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/format",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:"Format vocabulary meta-schema",type:["object","boolean"],properties:{format:{type:"string"}}}}),dL=V((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},$recursiveAnchor:!0,title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),dD=V((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/validation",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/validation":!0},$recursiveAnchor:!0,title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}},const:!0,enum:{type:"array",items:!0},type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),dZ=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dI(),a=dq(),i=dA(),n=dz(),o=dM(),s=dL(),l=dD(),c=["/properties"];t.default=function(t){return[r,a,i,n,u(this,o),s,u(this,l)].forEach(t=>this.addMetaSchema(t,void 0,!1)),this;function u(r,a){return t?r.$dataMetaSchema(a,c):a}}}),dV=V((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv2019=void 0;let a=uF(),i=dg(),n=dR(),o=dT(),s=dN(),l=d_(),c=dZ(),u="https://json-schema.org/draft/2019-09/schema";var d=class extends a.default{constructor(t={}){super({...t,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(n.default),i.default.forEach(t=>this.addVocabulary(t)),this.addVocabulary(o.default),this.addVocabulary(s.default),this.opts.discriminator&&this.addKeyword(l.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:t,meta:r}=this.opts;r&&(c.default.call(this,t),this.refs["http://json-schema.org/schema"]=u)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(u)?u:void 0)}};t.Ajv2019=d,r.exports=t=d,r.exports.Ajv2019=d,Object.defineProperty(t,"__esModule",{value:!0}),t.default=d;var p=uI();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return p.KeywordCxt}});var m=u_();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return m._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return m.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return m.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return m.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return m.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return m.CodeGen}});var h=uq();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return h.default}});var f=uA();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return f.default}})}),dF=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uJ(),a=u6(),i=dm(),n=dR(),o=dT(),s=dN(),l=df(),c=dy();t.default=[n.default,r.default,a.default,(0,i.default)(!0),l.default,c.metadataVocabulary,c.contentVocabulary,o.default,s.default]}),dU=V((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}}),dH=V((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}}),dJ=V((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}}),dK=V((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}}),dB=V((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}}),dG=V((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}}),dW=V((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),dY=V((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),dX=V(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dU(),a=dH(),i=dJ(),n=dK(),o=dB(),s=dG(),l=dW(),c=dY(),u=["/properties"];t.default=function(t){return[r,a,i,n,o,d(this,s),l,d(this,c)].forEach(t=>this.addMetaSchema(t,void 0,!1)),this;function d(r,a){return t?r.$dataMetaSchema(a,u):a}}}),dQ=V((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv2020=void 0;let a=uF(),i=dF(),n=d_(),o=dX(),s="https://json-schema.org/draft/2020-12/schema";var l=class extends a.default{constructor(t={}){super({...t,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),i.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(n.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:t,meta:r}=this.opts;r&&(o.default.call(this,t),this.refs["http://json-schema.org/schema"]=s)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};t.Ajv2020=l,r.exports=t=l,r.exports.Ajv2020=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var c=uI();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=u_();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var d=uq();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.default}});var p=uA();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}),d0=V(t=>{function r(t,r){return{validate:t,compare:r}}Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0,t.fullFormats={date:r(n,o),time:r(l(!0),c),"date-time":r(p(!0),m),"iso-time":r(l(),u),"iso-date-time":r(p(),h),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(t){return f.test(t)&&y.test(t)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:function(t){if(S.test(t))return!1;try{return new RegExp(t),!0}catch(t){return!1}},uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:function(t){return g.lastIndex=0,g.test(t)},int32:{type:"number",validate:function(t){return Number.isInteger(t)&&t<=_&&t>=v}},int64:{type:"number",validate:function(t){return Number.isInteger(t)}},float:{type:"number",validate:b},double:{type:"number",validate:b},password:!0,binary:!0},t.fastFormats={...t.fullFormats,date:r(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,c),"date-time":r(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,m),"iso-time":r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":r(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,h),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},t.formatNames=Object.keys(t.fullFormats);let a=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function n(t){var r;let n=a.exec(t);if(!n)return!1;let o=+n[1],s=+n[2],l=+n[3];return s>=1&&s<=12&&l>=1&&l<=(2===s&&(r=o)%4==0&&(r%100!=0||r%400==0)?29:i[s])}function o(t,r){if(t&&r)return t>r?1:t<r?-1:0}let s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function l(t){return function(r){let a=s.exec(r);if(!a)return!1;let i=+a[1],n=+a[2],o=+a[3],l=a[4],c="-"===a[5]?-1:1,u=+(a[6]||0),d=+(a[7]||0);if(u>23||d>59||t&&!l)return!1;if(i<=23&&n<=59&&o<60)return!0;let p=n-d*c,m=i-u*c-(p<0);return(23===m||-1===m)&&(59===p||-1===p)&&o<61}}function c(t,r){if(!(t&&r))return;let a=new Date("2020-01-01T"+t).valueOf(),i=new Date("2020-01-01T"+r).valueOf();if(a&&i)return a-i}function u(t,r){if(!(t&&r))return;let a=s.exec(t),i=s.exec(r);if(a&&i)return(t=a[1]+a[2]+a[3])>(r=i[1]+i[2]+i[3])?1:t<r?-1:0}let d=/t|\s/i;function p(t){let r=l(t);return function(t){let a=t.split(d);return 2===a.length&&n(a[0])&&r(a[1])}}function m(t,r){if(!(t&&r))return;let a=new Date(t).valueOf(),i=new Date(r).valueOf();if(a&&i)return a-i}function h(t,r){if(!(t&&r))return;let[a,i]=t.split(d),[n,s]=r.split(d),l=o(a,n);if(void 0!==l)return l||c(i,s)}let f=/\/|:/,y=/^(?:[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,v=-0x80000000,_=0x80000000-1;function b(){return!0}let S=/[^\\]\\Z/}),d1=V(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;let r=dS(),a=u_(),i=a.operators,n={formatMaximum:{okStr:"<=",ok:i.LTE,fail:i.GT},formatMinimum:{okStr:">=",ok:i.GTE,fail:i.LT},formatExclusiveMaximum:{okStr:"<",ok:i.LT,fail:i.GTE},formatExclusiveMinimum:{okStr:">",ok:i.GT,fail:i.LTE}};t.formatLimitDefinition={keyword:Object.keys(n),type:"string",schemaType:"string",$data:!0,error:{message:({keyword:t,schemaCode:r})=>(0,a.str)`should be ${n[t].okStr} ${r}`,params:({keyword:t,schemaCode:r})=>(0,a._)`{comparison: ${n[t].okStr}, limit: ${r}}`},code(t){let i,o,{gen:s,data:l,schemaCode:c,keyword:u,it:d}=t,{opts:p,self:m}=d;if(!p.validateFormats)return;let h=new r.KeywordCxt(d,m.RULES.all.format.definition,"format");function f(t){return(0,a._)`${t}.compare(${l}, ${c}) ${n[u].fail} 0`}h.$data?(i=s.scopeValue("formats",{ref:m.formats,code:p.code.formats}),o=s.const("fmt",(0,a._)`${i}[${h.schemaCode}]`),t.fail$data((0,a.or)((0,a._)`typeof ${o} != "object"`,(0,a._)`${o} instanceof RegExp`,(0,a._)`typeof ${o}.compare != "function"`,f(o)))):function(){let r=h.schema,i=m.formats[r];if(!i||!0===i)return;if("object"!=typeof i||i instanceof RegExp||"function"!=typeof i.compare)throw Error(`"${u}": format "${r}" does not define "compare" function`);let n=s.scopeValue("formats",{key:r,ref:i,code:p.code.formats?(0,a._)`${p.code.formats}${(0,a.getProperty)(r)}`:void 0});t.fail$data(f(n))}()},dependencies:["format"]},t.default=r=>(r.addKeyword(t.formatLimitDefinition),r)}),d2=V((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});let a=d0(),i=d1(),n=u_(),o=new n.Name("fullFormats"),s=new n.Name("fastFormats"),l=(t,r={keywords:!0})=>{if(Array.isArray(r))return c(t,r,a.fullFormats,o),t;let[n,l]="fast"===r.mode?[a.fastFormats,s]:[a.fullFormats,o];return c(t,r.formats||a.formatNames,n,l),r.keywords&&(0,i.default)(t),t};function c(t,r,a,i){var o;for(let s of(null!=(o=t.opts.code).formats||(o.formats=(0,n._)`require("ajv-formats/dist/formats").${i}`),r))t.addFormat(s,a[s])}l.get=(t,r="full")=>{let i=("fast"===r?a.fastFormats:a.fullFormats)[t];if(!i)throw Error(`Unknown format "${t}"`);return i},r.exports=t=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l}),d9=dS(),d4=dV(),d6=dQ();let d5=((t,r,a,i)=>{if(r&&"object"==typeof r||"function"==typeof r)for(var n,o=L(r),s=0,l=o.length;s<l;s++)n=o[s],Z.call(t,n)||n===a||z(t,n,{get:(t=>r[t]).bind(null,n),enumerable:!(i=M(r,n))||i.enumerable});return t})(z(null!=(S=d2())?A(D(S)):{},"default",{value:S,enumerable:!0}),S).default;function d3(t){let r=new t({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return d5(r),r}var d8=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(t){this._userAjv=void 0!==t,this._ajv=t}get ajv(){return this._ajv??=d3(d6.Ajv2020)}_engineFor(t){if(this._userAjv)return this.ajv;let r=function(t,r){if(!("$schema"in t)||"string"!=typeof t.$schema)return"2020-12";let a=t.$schema.replace(/#$/,"");if(F.has(a))return"2020-12";if(U.has(a))return"2019-09";if(H.has(a)||J.has(a))return"draft-7";throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${t.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${r}`)}(t,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");return"2020-12"===r?this.ajv:"2019-09"===r?this._ajv2019??=d3(d4.Ajv2019):this._ajvDraft7??=d3(d9.Ajv)}getValidator(t){let r=this._engineFor(t),a="$id"in t&&"string"==typeof t.$id?r.getSchema(t.$id)??r.compile(t):r.compile(t);return t=>a(t)?{valid:!0,data:t,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:r.errorsText(a.errors)}}};d9.Ajv;let d7=require("node:process");var pe=a.n(d7);let pt=Symbol.for("mcp.completable");function pr(t){return!!t&&"object"==typeof t&&pt in t}function pa(t,r){return{method:t.method,params:{...t.params,_meta:{...t.params?._meta,[nJ]:r}}}}let pi=new Set(["notifications/tools/list_changed","notifications/prompts/list_changed","notifications/resources/list_changed","notifications/resources/updated"]);var pn=class{_subs=new Map;_serverCapabilities;_serverInfo;constructor(t=1024,r,a){this._maxSubscriptions=t,this._serverCapabilities=r,this._serverInfo=a}setServerCapabilities(t,r){this._serverCapabilities=t,void 0!==r&&(this._serverInfo=r)}has(t){return this._subs.has(t)}serve(t){var r;let a,i,n;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:t.id,error:{code:-32603,message:"Subscription limit reached"}};let o=(a=cj(cE).validateRequest("subscriptions/listen",t)).ok?a.value.params?.notifications:void 0;if(void 0===o)return{jsonrpc:"2.0",id:t.id,error:{code:-32602,message:"Invalid params: 'notifications' is required and must be a valid SubscriptionFilter"}};let s=(r=this._serverCapabilities,i={},n=t=>void 0===r||!0===t,!0===o.toolsListChanged&&n(r?.tools?.listChanged)&&(i.toolsListChanged=!0),!0===o.promptsListChanged&&n(r?.prompts?.listChanged)&&(i.promptsListChanged=!0),!0===o.resourcesListChanged&&n(r?.resources?.listChanged)&&(i.resourcesListChanged=!0),void 0!==o.resourceSubscriptions&&o.resourceSubscriptions.length>0&&n(r?.resources?.subscribe)&&(i.resourceSubscriptions=[...o.resourceSubscriptions]),i);return this._subs.set(t.id,s),pa({method:"notifications/subscriptions/acknowledged",params:{notifications:s}},t.id)}cancel(t){return this._subs.delete(t)}routeOutbound(t){if(!pi.has(t.method))return"passthrough";let r=t.params?.uri,a=function(t,r){switch(t){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:r??""}}}(t.method,"string"==typeof r?r:void 0),i=[];for(let[r,n]of this._subs)(function(t,r){switch(r.kind){case"tools_list_changed":return!0===t.toolsListChanged;case"prompts_list_changed":return!0===t.promptsListChanged;case"resources_list_changed":return!0===t.resourcesListChanged;case"resource_updated":return void 0!==t.resourceSubscriptions&&t.resourceSubscriptions.includes(r.uri)}})(n,a)&&i.push(pa({method:t.method,params:t.params??{}},r));return i}teardownAll(){let t=[];for(let r of this._subs.keys())t.push({jsonrpc:"2.0",id:r,result:{resultType:"complete",_meta:{[nJ]:r,...void 0!==this._serverInfo&&{[nU]:this._serverInfo}}}});return this._subs.clear(),t}};function po(t,r,a){if(null===a||"object"!=typeof a||"string"!=typeof a.method)throw new cc(cl.InternalError,`Handler for ${t} returned an invalid input request '${r}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);let i=function(t){switch(t.method){case"elicitation/create":if(t.params?.mode==="url")return{elicitation:{url:{}}};return{elicitation:{form:{}}};case"sampling/createMessage":{let r=t.params;if(void 0!==r&&(void 0!==r.tools||void 0!==r.toolChoice))return{sampling:{tools:{}}};return{sampling:{}}}case"roots/list":return{roots:{}};default:return}}(a);if(void 0===i)throw new cc(cl.InternalError,`Handler for ${t} returned an input request '${r}' of kind '${a.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:a,required:i}}function ps(t,r){if("tools/call"===t)return{content:[{type:"text",text:r}],isError:!0};throw new cc(cl.InternalError,r)}var pl=class{constructor(t){this._host=t}async fulfill(t,r,a,i,n){let{maxRounds:o,roundTimeoutMs:s}=this._host,l=i.mcpReq.signal,c=n,u=0;for(;;){let n;if((u+=1)>o)return ps(t,`Multi-round-trip request '${t}' still required input after ${o} rounds (inputRequired.maxRounds)`);let d=c.inputRequests,p=null!=d&&Object.keys(d).length>0,m="string"==typeof c.requestState?c.requestState:void 0;if(!p&&void 0===m)throw new cc(cl.InternalError,`Handler for ${t} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(p){let r=this._host.resolvedClientCapabilities(i),a=[];for(let[i,n]of Object.entries(d)){let{embedded:o,required:s}=po(t,i,n);if("roots/list"!==o.method&&void 0===o.params)throw new cc(cl.InternalError,`Handler for ${t} returned an input request '${i}' of kind '${o.method}' without params`);if(void 0!==lV(s,r))return ps(t,`Cannot request input '${i}' (${o.method}): the client on this 2025-era connection did not declare the required capability${void 0===r?" (no client capabilities are available on this connection — per-request legacy serving cannot receive server-to-client requests)":""}`);a.push([i,o])}let o=function(t){let r=new AbortController,a=()=>r.abort(t?.reason);return t?.addEventListener("abort",a,{once:!0}),t?.aborted&&r.abort(t.reason),{signal:r.signal,abort:t=>r.abort(t),dispose:()=>t?.removeEventListener("abort",a)}}(l);try{let t={relatedRequestId:i.mcpReq.id,timeout:s,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:o.signal},r=await Promise.all(a.map(async([r,a])=>{try{return[r,await this._dispatchLeg(a,t)]}catch(t){throw o.abort(t),t}}));n=Object.fromEntries(r)}catch(r){if(l.aborted)throw r;return ps(t,`Fulfilling input required by '${t}' failed: ${r instanceof Error?r.message:String(r)}`)}finally{o.dispose()}}else await function(t,r){return new Promise((t,a)=>{if(r?.aborted)return void a(r.reason instanceof lD?r.reason:new lD(lL.RequestTimeout,String(r.reason)));let i=setTimeout(()=>{r?.removeEventListener("abort",n),t()},250),n=()=>{clearTimeout(i),a(r?.reason instanceof lD?r.reason:new lD(lL.RequestTimeout,String(r?.reason)))};r?.addEventListener("abort",n,{once:!0})})}(0,l);let h={...i,mcpReq:{...i.mcpReq,inputResponses:n,droppedInputResponseKeys:void 0,requestState:function(t){return()=>t}(m)}};if(void 0!==m){let r=await this._host.verifyRequestState(m,h,t);void 0!==r&&(h=ul(h,r))}let f=await r(a,h);if(!cZ(f))return f;c=f}}async _dispatchLeg(t,r){switch(t.method){case"elicitation/create":{let a=t.params;return"url"===a.mode&&void 0===a.elicitationId&&(a={...a,elicitationId:function(){let t=globalThis.crypto;if(t?.randomUUID!==void 0)return t.randomUUID();let r=new Uint8Array(16);t.getRandomValues(r),r[6]=15&r[6]|64,r[8]=63&r[8]|128;let a=[...r].map(t=>t.toString(16).padStart(2,"0")).join("");return`${a.slice(0,8)}-${a.slice(8,12)}-${a.slice(12,16)}-${a.slice(16,20)}-${a.slice(20)}`}()}),await this._host.sendElicitation(a,r)}case"sampling/createMessage":return await this._host.sendSampling(t.params,r);case"roots/list":return await this._host.listRoots(t.params,r)}}};let pc=new Set(["tools/call","prompts/get","resources/read"]);var pu=class extends uc{_clientCapabilities;_clientVersion;static{u=(t,r)=>{let a=r.filter(r=>!t._supportedProtocolVersions.includes(r));a.length>0&&(t._supportedProtocolVersions=[...t._supportedProtocolVersions,...a]),t.setRequestHandler("server/discover",()=>t._ondiscover())},d=t=>t._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new pl({maxRounds:this._inputRequiredServing.maxRounds,roundTimeoutMs:this._inputRequiredServing.roundTimeoutMs,resolvedClientCapabilities:t=>this._inputRequestCapabilityView(t),verifyRequestState:(t,r,a)=>this._verifyRequestState(t,r,a),sendElicitation:(t,r)=>this._sendElicitationLeg(t,r,{validateAcceptedContent:!1}),sendSampling:(t,r)=>this.createMessage(t,r),listRoots:(t,r)=>this.listRoots(t,r)})}oninitialized;constructor(t,r){if(super(r),this._serverInfo=t,this._capabilities=r?.capabilities?{...r.capabilities}:{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new d8,this._requestStateVerify=r?.requestState?.verify,this._inputRequiredServing=function(t){if(t?.maxRounds!==void 0&&(!Number.isInteger(t.maxRounds)||t.maxRounds<1))throw RangeError(`inputRequired.maxRounds must be a positive integer (got ${t.maxRounds})`);if(t?.roundTimeoutMs!==void 0&&(!Number.isFinite(t.roundTimeoutMs)||t.roundTimeoutMs<=0))throw RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${t.roundTimeoutMs})`);return{maxRounds:t?.maxRounds??8,roundTimeoutMs:t?.roundTimeoutMs??6e5,legacyShim:t?.legacyShim??!0}}(r?.inputRequired),r?.cacheHints!==void 0){for(const[t,a]of Object.entries(r.cacheHints))void 0!==a&&cs(a,`cacheHints['${t}']`);this._cacheHints=r.cacheHints}this.setRequestHandler("initialize",t=>this._oninitialize(t)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),lH(this._supportedProtocolVersions).length>0&&this.setRequestHandler("server/discover",()=>this._ondiscover()),this._capabilities.logging&&this._registerLoggingHandler()}_registerLoggingHandler(){this.setRequestHandler("logging/setLevel",async(t,r)=>{let a=r.sessionId||r.http?.req?.headers.get("mcp-session-id")||void 0,{level:i}=t.params,n=ig(s$,i);return n.success&&this._loggingLevels.set(a,n.data),{}})}buildContext(t,r){let a=t.http||r?.request||r?.closeSSEStream||r?.closeStandaloneSSEStream;return{...t,mcpReq:{...t.mcpReq,log:(r,a,i)=>{let n;if(!this._capabilities.logging)return Promise.resolve();if(this._servedModernEra()){if(void 0===(n=t.mcpReq.envelope?.[nK]))return Promise.resolve()}else n=this._loggingLevels.get(t.sessionId)??this._loggingLevels.get(void 0);return void 0!==n&&this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(n)?Promise.resolve():t.mcpReq.notify({method:"notifications/message",params:{level:r,data:a,logger:i}})},elicitInput:(t,r)=>this.elicitInput(t,r),requestSampling:(t,r)=>this.createMessage(t,r)},http:a?{...t.http,req:r?.request,closeSSE:r?.closeSSEStream,closeStandaloneSSE:r?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map(s$.options.map((t,r)=>[t,r]));isMessageIgnored=(t,r)=>{let a=this._loggingLevels.get(r);return!!a&&this.LOG_LEVEL_SEVERITY.get(t)<this.LOG_LEVEL_SEVERITY.get(a)};registerCapabilities(t){if(this.transport)throw new lD(lL.AlreadyConnected,"Cannot register capabilities after connecting to transport");let r=!!this._capabilities.logging;this._capabilities=function(t,r){let a={...t};for(let t in r){let i=r[t];if(void 0===i)continue;let n=a[t];a[t]=uu(n)&&uu(i)?{...n,...i}:i}return a}(this._capabilities,t),!r&&this._capabilities.logging&&this._registerLoggingHandler()}_wrapHandler(t,r){if("tools/call"!==t){let a=this._cacheHints?.[t],i=pc.has(t);return void 0!==a||i?async(n,o)=>{let s=i?await this._invokeInputRequiredCapableHandler(t,r,n,o):await r(n,o);if(cZ(s)){if(!i)throw new cc(cl.InternalError,`Handler for ${t} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return s}return void 0===a?s:ci(s,a)}:async(a,i)=>{let n=await r(a,i);if(cZ(n))throw new cc(cl.InternalError,`Handler for ${t} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return n}}return async(t,a)=>{let i=cj(this._negotiatedProtocolVersion),n=i.validateRequest("tools/call",t);if(!n.ok)throw new cc("not-in-era"===n.reason?cl.InternalError:cl.InvalidParams,"not-in-era"===n.reason?"No wire schema for tools/call in the resolved era":`Invalid tools/call request: ${n.message}`);let o=await this._invokeInputRequiredCapableHandler("tools/call",r,t,a);if(cZ(o))return o;let s=lB(o),l=i.validateResult("tools/call",s);if(!l.ok)throw new cc("not-in-era"===l.reason?cl.InternalError:cl.InvalidParams,"not-in-era"===l.reason?"No wire schema for tools/call in the resolved era":`Invalid tools/call result: ${l.message}`);return l.value}}_servedModernEra(){return void 0!==this._negotiatedProtocolVersion&&this._negotiatedProtocolVersion>=lF}async _invokeInputRequiredCapableHandler(t,r,a,i){let n,o=this._servedModernEra(),s=i.mcpReq.requestState();if(void 0!==s&&"string"!=typeof s)throw new cc(cl.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"});let l=i;if("string"==typeof s){let r=await this._verifyRequestState(s,i,t);void 0!==r&&(l=ul(i,r))}try{n=await r(a,l)}catch(t){if(t instanceof cc&&t.code===cl.UrlElicitationRequired){if(!o)throw t;throw new cc(cl.InternalError,`URL elicitation cannot be signalled by throwing UrlElicitationRequiredError on protocol revision ${this._negotiatedProtocolVersion}: return inputRequired({ inputRequests: { …: inputRequired.elicitUrl(...) } }) from the handler instead. The urlElicitationRequired error (-32042) of earlier revisions is not available on this revision.`)}throw t}if(!cZ(n))return n;if(!o){if(!this._inputRequiredServing.legacyShim)throw new cc(cl.InternalError,`Handler for ${t} 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(t,r,a,l,n)}let c=n.inputRequests,u=null!=c&&Object.keys(c).length>0,d="string"==typeof n.requestState;if(!u&&!d)throw new cc(cl.InternalError,`Handler for ${t} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(u){let r=this._inputRequestCapabilityView(i);for(let[a,i]of Object.entries(c)){let{embedded:n,required:o}=po(t,a,i),s=lV(o,r);if(void 0!==s)throw new cm({requiredCapabilities:s},`Cannot request input '${a}' (${n.method}): the request's client capabilities do not declare the required capability`)}}return n}async _verifyRequestState(t,r,a){if(void 0!==this._requestStateVerify)try{return await this._requestStateVerify(t,r)}catch(t){throw this.onerror?.(Error(`requestState verification rejected ${a}: ${t instanceof Error?t.message:String(t)}`)),new cc(cl.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(t){return this._servedModernEra()?t.mcpReq.envelope?.[nH]:this._clientCapabilities}_assertPushApiInServedEra(t){if(this._servedModernEra())throw new lD(lL.MethodNotSupportedByProtocolVersion,`Server-to-client requests are not available on protocol revision ${this._negotiatedProtocolVersion}: '${t}' cannot be sent while serving a request on that revision. Return inputRequired({ ... }) from the handler instead — the client fulfils the embedded requests and retries the original request (multi round-trip requests).`,{method:t,era:"2026-07-28"})}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new lD(lL.CapabilityNotSupported,`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new lD(lL.CapabilityNotSupported,`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new lD(lL.CapabilityNotSupported,`Client does not support listing roots (required for ${t})`)}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new lD(lL.CapabilityNotSupported,`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new lD(lL.CapabilityNotSupported,`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new lD(lL.CapabilityNotSupported,`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new lD(lL.CapabilityNotSupported,`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new lD(lL.CapabilityNotSupported,`Client does not support URL elicitation (required for ${t})`)}}assertRequestHandlerCapability(t){switch(t){case"completion/complete":if(!this._capabilities.completions)throw new lD(lL.CapabilityNotSupported,`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new lD(lL.CapabilityNotSupported,`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new lD(lL.CapabilityNotSupported,`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new lD(lL.CapabilityNotSupported,`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new lD(lL.CapabilityNotSupported,`Server does not support tools (required for ${t})`)}}async _oninitialize(t){let r=t.params.protocolVersion;this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo;let a=this._supportedProtocolVersions.filter(t=>!(t>=lF)),i=a.includes(r)?r:a[0]??nD;return this._negotiatedProtocolVersion=i,this.transport?.setProtocolVersion?.(i),{protocolVersion:i,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:lH(this._supportedProtocolVersions),capabilities:{...this.getCapabilities()},...this._instructions&&{instructions:this._instructions}}}_outboundServerInfo(){return this._serverInfo}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}projectCallToolResult(t,r){return this._wireCodec().projectCallToolResult(t,r)}getCapabilities(){return this._capabilities}async ping(){return this._assertPushApiInServedEra("ping"),this.request({method:"ping"})}async createMessage(t,r){if(this._assertPushApiInServedEra("sampling/createMessage"),(t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new lD(lL.CapabilityNotSupported,"Client does not support sampling tools capability.");if(t.messages.length>0){let r=t.messages.at(-1),a=Array.isArray(r.content)?r.content:[r.content],i=a.some(t=>"tool_result"===t.type),n=t.messages.length>1?t.messages.at(-2):void 0,o=n?Array.isArray(n.content)?n.content:[n.content]:[],s=o.some(t=>"tool_use"===t.type);if(i){if(a.some(t=>"tool_result"!==t.type))throw new cc(cl.InvalidParams,"The last message must contain only tool_result content if any is present");if(!s)throw new cc(cl.InvalidParams,"tool_result blocks are not matching any tool_use from the previous message")}if(s){let t=new Set(o.filter(t=>"tool_use"===t.type).map(t=>t.id)),r=new Set(a.filter(t=>"tool_result"===t.type).map(t=>t.toolUseId));if(t.size!==r.size||![...t].every(t=>r.has(t)))throw new cc(cl.InvalidParams,"ids of tool_result blocks and tool_use blocks from previous message do not match")}}let a=!!(t.tools||t.toolChoice),i=await this.request({method:"sampling/createMessage",params:t},r),n=this._wireCodec().samplingResultVariant(a,i);if(!n.ok)throw new lD(lL.InvalidResult,`Invalid sampling/createMessage result: ${"invalid"===n.reason?n.message:n.reason}`);return n.value}async elicitInput(t,r){switch(this._assertPushApiInServedEra("elicitation/create"),t.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw new lD(lL.CapabilityNotSupported,"Client does not support url elicitation.");break;case"form":if(!this._clientCapabilities?.elicitation?.form)throw new lD(lL.CapabilityNotSupported,"Client does not support form elicitation.")}return this._sendElicitationLeg(t,r)}async _sendElicitationLeg(t,r,a){let i=t.mode??"form",n=a?.validateAcceptedContent??!0;switch(i){case"url":return this.request({method:"elicitation/create",params:t},r);case"form":{let a="form"===t.mode?t:{...t,mode:"form"},i=await this.request({method:"elicitation/create",params:a},r);if(n&&"accept"===i.action&&i.content&&a.requestedSchema)try{let t=this._jsonSchemaValidator.getValidator(a.requestedSchema)(i.content);if(!t.valid)throw new cc(cl.InvalidParams,`Elicitation response content does not match requested schema: ${t.errorMessage}`)}catch(t){if(t instanceof cc)throw t;throw new cc(cl.InternalError,`Error validating elicitation response: ${t instanceof Error?t.message:String(t)}`)}return i}}}createElicitationCompletionNotifier(t,r){if(!this._clientCapabilities?.elicitation?.url)throw new lD(lL.CapabilityNotSupported,"Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},r)}async listRoots(t,r){return this._assertPushApiInServedEra("roots/list"),this.request({method:"roots/list",params:t},r)}async sendLoggingMessage(t,r){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,r))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}},pd=class{server;_registeredResources={};_registeredResourceTemplates={};_registeredTools={};_registeredPrompts={};_toolInputSchemaJson={};toolInputSchemaJson(t){let r=this._registeredTools[t];if(void 0!==r&&r.enabled){if(Object.hasOwn(this._toolInputSchemaJson,t))return this._toolInputSchemaJson[t];if(void 0===r.inputSchema)return ph;try{let a=c0(r.inputSchema,"input");return this._toolInputSchemaJson[t]=a,a}catch{return}}}constructor(t,r){this.server=new pu(t,r),r?.capabilities?.tools&&this.setToolRequestHandlers(),r?.capabilities?.resources&&this.setResourceRequestHandlers(),r?.capabilities?.prompts&&this.setPromptRequestHandlers()}async connect(t){return await this.server.connect(t)}async close(){await this.server.close()}_toolHandlersInitialized=!1;setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler("tools/list"),this.server.assertCanSetRequestHandler("tools/call"),this.server.registerCapabilities({tools:{listChanged:this.server.getCapabilities().tools?.listChanged??!0}}),this.server.setRequestHandler("tools/list",()=>({tools:Object.entries(this._registeredTools).filter(([,t])=>t.enabled).map(([t,r])=>{let a={name:t,title:r.title,description:r.description,inputSchema:r.inputSchema?c0(r.inputSchema,"input"):ph,annotations:r.annotations,icons:r.icons,execution:r.execution,_meta:r._meta};return r.outputSchema&&(a.outputSchema=c0(r.outputSchema,"output")),a})})),this.server.setRequestHandler("tools/call",async(t,r)=>{let a=this._registeredTools[t.params.name];if(!a)throw new cc(cl.InvalidParams,`Tool ${t.params.name} not found`);if(!a.enabled)throw new cc(cl.InvalidParams,`Tool ${t.params.name} disabled`);try{let i=await this.validateToolInput(a,t.params.arguments,t.params.name),n=await this.executeToolHandler(a,i,r);if(await this.validateToolOutput(a,n,t.params.name),cZ(n))return n;return this.server.projectCallToolResult(n,a.outputSchemaJson)}catch(t){if(t instanceof cc&&t.code===cl.UrlElicitationRequired)throw t;return this.createToolError(t instanceof Error?t.message:String(t))}}),this._toolHandlersInitialized=!0)}createToolError(t){return{content:[{type:"text",text:t}],isError:!0}}async validateToolInput(t,r,a){if(!t.inputSchema)return;let i=await c1(t.inputSchema,r??{});if(!i.success)throw new cc(cl.InvalidParams,`Input validation error: Invalid arguments for tool ${a}: ${i.error}`);return i.data}async validateToolOutput(t,r,a){if(!t.outputSchema||cZ(r)||r.isError)return;if(void 0===r.structuredContent)throw new cc(cl.InvalidParams,`Output validation error: Tool ${a} has an output schema but no structured content was provided`);let i=await c1(t.outputSchema,r.structuredContent);if(!i.success)throw new cc(cl.InvalidParams,`Output validation error: Invalid structured content for tool ${a}: ${i.error}`)}async executeToolHandler(t,r,a){return t.executor(r,a)}_completionHandlerInitialized=!1;setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler("completion/complete"),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler("completion/complete",async t=>{switch(t.params.ref.type){case"ref/prompt":if("ref/prompt"!==t.params.ref.type)throw TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`);return this.handlePromptCompletion(t,t.params.ref);case"ref/resource":if("ref/resource"!==t.params.ref.type)throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`);return this.handleResourceCompletion(t,t.params.ref);default:throw new cc(cl.InvalidParams,`Invalid completion reference: ${t.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(t,r){let a=this._registeredPrompts[r.name];if(!a)throw new cc(cl.InvalidParams,`Prompt ${r.name} not found`);if(!a.enabled)throw new cc(cl.InvalidParams,`Prompt ${r.name} disabled`);if(!a.argsSchema)return pv;let i=pb(p_(a.argsSchema)?.[t.params.argument.name]);if(!pr(i))return pv;let n=i[pt]?.complete;return n?pg(await n(t.params.argument.value,t.params.context)):pv}async handleResourceCompletion(t,r){let a=Object.values(this._registeredResourceTemplates).find(t=>t.resourceTemplate.uriTemplate.toString()===r.uri);if(!a){if(this._registeredResources[r.uri])return pv;throw new cc(cl.InvalidParams,`Resource template ${t.params.ref.uri} not found`)}let i=a.resourceTemplate.completeCallback(t.params.argument.name);return i?pg(await i(t.params.argument.value,t.params.context)):pv}_resourceHandlersInitialized=!1;setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler("resources/list"),this.server.assertCanSetRequestHandler("resources/templates/list"),this.server.assertCanSetRequestHandler("resources/read"),this.server.registerCapabilities({resources:{listChanged:this.server.getCapabilities().resources?.listChanged??!0}}),this.server.setRequestHandler("resources/list",async(t,r)=>{let a=Object.entries(this._registeredResources).filter(([t,r])=>r.enabled).map(([t,r])=>({uri:t,name:r.name,...r.metadata})),i=[];for(let t of Object.values(this._registeredResourceTemplates))if(t.resourceTemplate.listCallback)for(let a of(await t.resourceTemplate.listCallback(r)).resources)i.push({...t.metadata,...a});return{resources:[...a,...i]}}),this.server.setRequestHandler("resources/templates/list",async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([t,r])=>({name:t,uriTemplate:r.resourceTemplate.uriTemplate.toString(),...r.metadata}))})),this.server.setRequestHandler("resources/read",async(t,r)=>{let a;try{a=new URL(t.params.uri)}catch{throw new cc(cl.InvalidParams,`Resource URI ${t.params.uri} is invalid`,{uri:t.params.uri,reason:"invalid_uri"})}let i=this._registeredResources[a.toString()];if(i){if(!i.enabled)throw new cc(cl.InvalidParams,`Resource ${a} disabled`);return ci(await i.readCallback(a,r),i.cacheHint)}for(let t of Object.values(this._registeredResourceTemplates)){let i=t.resourceTemplate.uriTemplate.match(a.toString());if(i)return ci(await t.readCallback(a,i,r),t.cacheHint)}throw new cu(t.params.uri)}),this._resourceHandlersInitialized=!0)}_promptHandlersInitialized=!1;setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler("prompts/list"),this.server.assertCanSetRequestHandler("prompts/get"),this.server.registerCapabilities({prompts:{listChanged:this.server.getCapabilities().prompts?.listChanged??!0}}),this.server.setRequestHandler("prompts/list",()=>({prompts:Object.entries(this._registeredPrompts).filter(([,t])=>t.enabled).map(([t,r])=>{let a,i,n;return{name:t,title:r.title,description:r.description,arguments:r.argsSchema?(i=(a=c0(r.argsSchema,"input")).properties||{},n=a.required||[],Object.entries(i).map(([t,r])=>({name:t,description:r?.description,required:n.includes(t)}))):void 0,icons:r.icons,_meta:r._meta}})})),this.server.setRequestHandler("prompts/get",async(t,r)=>{let a=this._registeredPrompts[t.params.name];if(!a)throw new cc(cl.InvalidParams,`Prompt ${t.params.name} not found`);if(!a.enabled)throw new cc(cl.InvalidParams,`Prompt ${t.params.name} disabled`);return a.handler(t.params.arguments,r)}),this._promptHandlersInitialized=!0)}registerResource(t,r,a,i){let n=a.cacheHint,o=a;if(void 0!==n){cs(n,`resource ${t}`);let r={...a};delete r.cacheHint,o=r}if("string"==typeof r){if(this._registeredResources[r])throw Error(`Resource ${r} is already registered`);let s=this._createRegisteredResource(t,a.title,r,o,i);return void 0!==n&&(s.cacheHint=n),this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}{if(this._registeredResourceTemplates[t])throw Error(`Resource template ${t} is already registered`);let s=this._createRegisteredResourceTemplate(t,a.title,r,o,i);return void 0!==n&&(s.cacheHint=n),this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}_createRegisteredResource(t,r,a,i,n){let o={name:t,title:r,metadata:i,readCallback:n,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({uri:null}),update:t=>{void 0!==t.uri&&t.uri!==a&&(delete this._registeredResources[a],t.uri&&(this._registeredResources[t.uri]=o)),void 0!==t.name&&(o.name=t.name),void 0!==t.title&&(o.title=t.title),void 0!==t.metadata&&(o.metadata=t.metadata),void 0!==t.callback&&(o.readCallback=t.callback),void 0!==t.enabled&&(o.enabled=t.enabled),this.sendResourceListChanged()}};return this._registeredResources[a]=o,o}_createRegisteredResourceTemplate(t,r,a,i,n){let o={resourceTemplate:a,title:r,metadata:i,readCallback:n,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:r=>{void 0!==r.name&&r.name!==t&&(delete this._registeredResourceTemplates[t],r.name&&(this._registeredResourceTemplates[r.name]=o)),void 0!==r.title&&(o.title=r.title),void 0!==r.template&&(o.resourceTemplate=r.template),void 0!==r.metadata&&(o.metadata=r.metadata),void 0!==r.callback&&(o.readCallback=r.callback),void 0!==r.enabled&&(o.enabled=r.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[t]=o;let s=a.uriTemplate.variableNames;return Array.isArray(s)&&s.some(t=>!!a.completeCallback(t))&&this.setCompletionRequestHandler(),o}_createRegisteredPrompt(t,r,a,i,n,o,s){let l=i,c=n,u={title:r,description:a,argsSchema:i,icons:o,_meta:s,handler:py(t,i,n),enabled:!0,disable:()=>u.update({enabled:!1}),enable:()=>u.update({enabled:!0}),remove:()=>u.update({name:null}),update:r=>{void 0!==r.name&&r.name!==t&&(delete this._registeredPrompts[t],r.name&&(this._registeredPrompts[r.name]=u)),void 0!==r.title&&(u.title=r.title),void 0!==r.description&&(u.description=r.description),void 0!==r.icons&&(u.icons=r.icons),void 0!==r._meta&&(u._meta=r._meta);let a=!1;void 0!==r.argsSchema&&(u.argsSchema=r.argsSchema,l=r.argsSchema,a=!0),void 0!==r.callback&&(c=r.callback,a=!0),a&&(u.handler=py(t,l,c)),void 0!==r.enabled&&(u.enabled=r.enabled),this.sendPromptListChanged()}};if(this._registeredPrompts[t]=u,i){let t=p_(i);t&&Object.values(t).some(t=>pr(pb(t)))&&this.setCompletionRequestHandler()}return u}_createRegisteredTool(t,r,a,i,n,o,s,l,c,u){if(uh(t),void 0!==i)try{let r,a,n,o,s=c0(i,"input");this._toolInputSchemaJson[t]=s;let l=(r=[],a=new Map,o=(n=(t,i,o)=>{if(null===t||"object"!=typeof t)return;if(cV in t){if(!o||0===i.length)return`${cK(i)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let n=t[cV];if("string"!=typeof n||0===n.length)return`${cK(i)}: x-mcp-header MUST be a non-empty string`;if(!cF.test(n))return`${cK(i)}: x-mcp-header '${n}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let s="string"==typeof t.type?t.type:void 0;if(void 0===s||!cU.has(s))return`${cK(i)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${s??"<none>"}`;let l=n.toLowerCase(),c=a.get(l);if(void 0!==c)return`x-mcp-header '${n}' is not case-insensitively unique (also declared as '${c}')`;a.set(l,n),r.push({path:i,headerName:n,type:s})}let s=t.properties;if(null!==s&&"object"==typeof s)for(let[t,r]of Object.entries(s)){let a=n(r,[...i,t],o);if(void 0!==a)return a}for(let r of cH){let a=t[r];if(void 0!==a)for(let t of Array.isArray(a)?a:null!==a&&"object"==typeof a&&cJ.has(r)?Object.values(a):[a]){let a=n(t,[...i,`<${r}>`],!1);if(void 0!==a)return a}}})(s,[],!0),void 0===o?{valid:!0,declarations:r}:{valid:!1,reason:o});l.valid||console.warn(`[mcp-sdk] tool '${t}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${l.reason}`)}catch{}let d=u,p={title:r,description:a,inputSchema:i,outputSchema:n,outputSchemaJson:pf(n),annotations:o,icons:s,execution:l,_meta:c,handler:u,executor:pm(i,u),enabled:!0,disable:()=>p.update({enabled:!1}),enable:()=>p.update({enabled:!0}),remove:()=>p.update({name:null}),update:r=>{void 0!==r.name&&r.name!==t&&("string"==typeof r.name&&uh(r.name),delete this._registeredTools[t],delete this._toolInputSchemaJson[t],r.name&&(delete this._toolInputSchemaJson[r.name],this._registeredTools[r.name]=p,t=r.name)),void 0!==r.title&&(p.title=r.title),void 0!==r.description&&(p.description=r.description);let a=!1;void 0!==r.paramsSchema&&(p.inputSchema=r.paramsSchema,delete this._toolInputSchemaJson[t],a=!0),void 0!==r.callback&&(p.handler=r.callback,d=r.callback,a=!0),a&&(p.executor=pm(p.inputSchema,d)),void 0!==r.outputSchema&&(p.outputSchema=r.outputSchema,p.outputSchemaJson=pf(r.outputSchema)),void 0!==r.annotations&&(p.annotations=r.annotations),void 0!==r.icons&&(p.icons=r.icons),void 0!==r._meta&&(p._meta=r._meta),void 0!==r.enabled&&(p.enabled=r.enabled),this.sendToolListChanged()}};return this._registeredTools[t]=p,this.setToolRequestHandlers(),this.sendToolListChanged(),p}registerTool(t,r,a){if(this._registeredTools[t])throw Error(`Tool ${t} is already registered`);let{title:i,description:n,inputSchema:o,outputSchema:s,annotations:l,icons:c,_meta:u}=r;return this._createRegisteredTool(t,i,n,uy(o),uy(s),l,c,void 0,u,a)}registerPrompt(t,r,a){if(this._registeredPrompts[t])throw Error(`Prompt ${t} is already registered`);let{title:i,description:n,argsSchema:o,icons:s,_meta:l}=r,c=this._createRegisteredPrompt(t,i,n,uy(o),a,s,l);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),c}isConnected(){return void 0!==this.server.transport}async sendLoggingMessage(t,r){return this.server.sendLoggingMessage(t,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}},pp=class{_uriTemplate;constructor(t,r){this._callbacks=r,this._uriTemplate="string"==typeof t?new uf(t):t}get uriTemplate(){return this._uriTemplate}get listCallback(){return this._callbacks.list}completeCallback(t){return this._callbacks.complete?.[t]}};function pm(t,r){return t?async(t,a)=>r(t,a):async(t,a)=>r(a)}let ph={type:"object",properties:{}};function pf(t){if(void 0!==t)try{return c0(t,"output")}catch{return}}function py(t,r,a){return r?async(i,n)=>{let o=await c1(r,i);if(!o.success)throw new cc(cl.InvalidParams,`Invalid arguments for prompt ${t}: ${o.error}`);return a(o.data,n)}:async(t,r)=>a(r)}function pg(t){return{completion:{values:t.map(String).slice(0,100),total:t.length,hasMore:t.length>100}}}let pv={completion:{values:[],hasMore:!1}};function p_(t){if(t.shape&&"object"==typeof t.shape)return t.shape}function pb(t){return t?.type!=="optional"?t:t.def?.innerType??t}var pS=class{_readBuffer;_started=!1;_closed=!1;constructor(t=pe().stdin,r=pe().stdout,a){this._stdin=t,this._stdout=r,this._readBuffer=new up({maxBufferSize:a?.maxBufferSize})}onclose;onerror;onmessage;_ondata=t=>{try{this._readBuffer.append(t),this.processReadBuffer()}catch(t){this.onerror?.(t),this.close().catch(()=>{})}};_onerror=t=>{this.onerror?.(t)};_onstdouterror=t=>{this.onerror?.(t),this.close().catch(()=>{})};async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror),this._stdout.on("error",this._onstdouterror)}processReadBuffer(){for(;;)try{let t=this._readBuffer.readMessage();if(null===t)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async close(){this._closed||(this._closed=!0,this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdout.off("error",this._onstdouterror),0===this._stdin.listenerCount("data")&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.())}send(t){return this._closed?Promise.reject(Error("StdioServerTransport is closed")):new Promise((r,a)=>{let i=JSON.stringify(t)+"\n",n=!1,o=t=>{n||(n=!0,this._stdout.off("error",o),this._stdout.off("drain",s),a(t))},s=()=>{n||(n=!0,this._stdout.off("error",o),this._stdout.off("drain",s),r())};if(this._stdout.once("error",o),this._stdout.write(i)){if(n)return;n=!0,this._stdout.off("error",o),r()}else n||this._stdout.once("drain",s)})}},p$=class{onclose;onerror;onmessage;_closed=!1;_pendingRequests=new Set;_drainWaiters=[];constructor(t,r,a){this._wire=t,this._onInstanceClose=r,this._outboundIntercept=a}async start(){}async send(t,r){if(or.safeParse(t).success||oa.safeParse(t).success){let{id:r}=t;void 0!==r&&this._settle(r)}if(!this._closed&&this._outboundIntercept?.(t)!=="handled")return this._wire.send(t,r)}setProtocolVersion=t=>{this._wire.setProtocolVersion?.(t)};deliver(t,r){if(!this._closed){if(cD(t))this._pendingRequests.add(t.id);else if(ot.safeParse(t).success&&"notifications/cancelled"===t.method){let r=t.params?.requestId;void 0!==r&&this._settle(r)}this.onmessage?.(t,r)}}async whenRequestsAnswered(t){return!!this._closed||0===this._pendingRequests.size||await new Promise(r=>{let a=()=>{clearTimeout(i),r(!0)},i=setTimeout(()=>{this._drainWaiters=this._drainWaiters.filter(t=>t!==a),r(!1)},t);this._drainWaiters.push(a)})}async close(){if(!this._closed){this._closed=!0,this._pendingRequests.clear(),this._releaseDrainWaiters();try{this._onInstanceClose()}finally{this.onclose?.()}}}_settle(t){this._pendingRequests.delete(t),0===this._pendingRequests.size&&this._releaseDrainWaiters()}_releaseDrainWaiters(){let t=this._drainWaiters;for(let r of(this._drainWaiters=[],t))r()}};function pw(t){return t instanceof Error?t:Error(String(t))}let pk=Symbol("Let zodToJsonSchema decide on which parser to use"),px={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"};(R=C||(C={})).assertEqual=t=>{},R.assertIs=function(t){},R.assertNever=function(t){throw Error()},R.arrayToEnum=t=>{let r={};for(let a of t)r[a]=a;return r},R.getValidEnumValues=t=>{let r=R.objectKeys(t).filter(r=>"number"!=typeof t[t[r]]),a={};for(let i of r)a[i]=t[i];return R.objectValues(a)},R.objectValues=t=>R.objectKeys(t).map(function(r){return t[r]}),R.objectKeys="function"==typeof Object.keys?t=>Object.keys(t):t=>{let r=[];for(let a in t)Object.prototype.hasOwnProperty.call(t,a)&&r.push(a);return r},R.find=(t,r)=>{for(let a of t)if(r(a))return a},R.isInteger="function"==typeof Number.isInteger?t=>Number.isInteger(t):t=>"number"==typeof t&&Number.isFinite(t)&&Math.floor(t)===t,R.joinValues=function(t,r=" | "){return t.map(t=>"string"==typeof t?`'${t}'`:t).join(r)},R.jsonStringifyReplacer=(t,r)=>"bigint"==typeof r?r.toString():r,(N||(N={})).mergeShapes=(t,r)=>({...t,...r});let pR=C.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),pP=t=>{switch(typeof t){case"undefined":return pR.undefined;case"string":return pR.string;case"number":return Number.isNaN(t)?pR.nan:pR.number;case"boolean":return pR.boolean;case"function":return pR.function;case"bigint":return pR.bigint;case"symbol":return pR.symbol;case"object":if(Array.isArray(t))return pR.array;if(null===t)return pR.null;if(t.then&&"function"==typeof t.then&&t.catch&&"function"==typeof t.catch)return pR.promise;if("undefined"!=typeof Map&&t instanceof Map)return pR.map;if("undefined"!=typeof Set&&t instanceof Set)return pR.set;if("undefined"!=typeof Date&&t instanceof Date)return pR.date;return pR.object;default:return pR.unknown}},pE=C.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 pj extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=t=>{this.issues=[...this.issues,t]},this.addIssues=(t=[])=>{this.issues=[...this.issues,...t]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(t){return t.message},a={_errors:[]},i=t=>{for(let n of t.issues)if("invalid_union"===n.code)n.unionErrors.map(i);else if("invalid_return_type"===n.code)i(n.returnTypeError);else if("invalid_arguments"===n.code)i(n.argumentsError);else if(0===n.path.length)a._errors.push(r(n));else{let t=a,i=0;for(;i<n.path.length;){let a=n.path[i],o=i===n.path.length-1;if("_errors"===a){o&&t._errors.push(r(n)),i++;continue}Object.prototype.hasOwnProperty.call(t,a)||("__proto__"===a?Object.defineProperty(t,a,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):t[a]={_errors:[]}),t=t[a],o&&t._errors.push(r(n)),i++}}};return i(this),a}static assert(t){if(!(t instanceof pj))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,C.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(t=t=>t.message){let r=Object.create(null),a=[];for(let i of this.issues)if(i.path.length>0){let a=i.path[0];r[a]=r[a]||[],r[a].push(t(i))}else a.push(t(i));return{formErrors:a,fieldErrors:r}}get formErrors(){return this.flatten()}}pj.create=t=>new pj(t);let pT=(t,r)=>{let a;switch(t.code){case pE.invalid_type:a=t.received===pR.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case pE.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(t.expected,C.jsonStringifyReplacer)}`;break;case pE.unrecognized_keys:a=`Unrecognized key(s) in object: ${C.joinValues(t.keys,", ")}`;break;case pE.invalid_union:a="Invalid input";break;case pE.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${C.joinValues(t.options)}`;break;case pE.invalid_enum_value:a=`Invalid enum value. Expected ${C.joinValues(t.options)}, received '${t.received}'`;break;case pE.invalid_arguments:a="Invalid function arguments";break;case pE.invalid_return_type:a="Invalid function return type";break;case pE.invalid_date:a="Invalid date";break;case pE.invalid_string:"object"==typeof t.validation?"includes"in t.validation?(a=`Invalid input: must include "${t.validation.includes}"`,"number"==typeof t.validation.position&&(a=`${a} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?a=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?a=`Invalid input: must end with "${t.validation.endsWith}"`:C.assertNever(t.validation):a="regex"!==t.validation?`Invalid ${t.validation}`:"Invalid";break;case pE.too_small:a="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:"number"===t.type||"bigint"===t.type?`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:"date"===t.type?`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:"Invalid input";break;case pE.too_big:a="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"bigint"===t.type?`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"date"===t.type?`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:"Invalid input";break;case pE.custom:a="Invalid input";break;case pE.invalid_intersection_types:a="Intersection results could not be merged";break;case pE.not_multiple_of:a=`Number must be a multiple of ${t.multipleOf}`;break;case pE.not_finite:a="Number must be finite";break;default:a=r.defaultError,C.assertNever(t)}return{message:a}};(P=I||(I={})).errToObj=t=>"string"==typeof t?{message:t}:t||{},P.toString=t=>"string"==typeof t?t:t?.message;let pO=t=>{let{data:r,path:a,errorMaps:i,issueData:n}=t,o=[...a,...n.path||[]],s={...n,path:o};if(void 0!==n.message)return{...n,path:o,message:n.message};let l="";for(let t of i.filter(t=>!!t).slice().reverse())l=t(s,{data:r,defaultError:l}).message;return{...n,path:o,message:l}};function pC(t,r){let a=pO({issueData:r,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,pT,void 0].filter(t=>!!t)});t.common.issues.push(a)}class pN{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(t,r){let a=[];for(let i of r){if("aborted"===i.status)return pI;"dirty"===i.status&&t.dirty(),a.push(i.value)}return{status:t.value,value:a}}static async mergeObjectAsync(t,r){let a=[];for(let t of r){let r=await t.key,i=await t.value;a.push({key:r,value:i})}return pN.mergeObjectSync(t,a)}static mergeObjectSync(t,r){let a={};for(let i of r){let{key:r,value:n}=i;if("aborted"===r.status||"aborted"===n.status)return pI;"dirty"===r.status&&t.dirty(),"dirty"===n.status&&t.dirty(),"__proto__"!==r.value&&(void 0!==n.value||i.alwaysSet)&&(a[r.value]=n.value)}return{status:t.value,value:a}}}let pI=Object.freeze({status:"aborted"}),pq=t=>({status:"dirty",value:t}),pA=t=>({status:"valid",value:t}),pz=t=>"undefined"!=typeof Promise&&t instanceof Promise;class pM{constructor(t,r,a,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=a,this._key=i}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 pL=(t,r)=>{if("valid"===r.status)return{success:!0,data:r.value};if(!t.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new pj(t.common.issues);return this._error=r,this._error}}};function pD(t){if(!t)return{};let{errorMap:r,invalid_type_error:a,required_error:i,description:n}=t;if(r&&(a||i))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return r?{errorMap:r,description:n}:{errorMap:(r,n)=>{let{message:o}=t;return"invalid_enum_value"===r.code?{message:o??n.defaultError}:void 0===n.data?{message:o??i??n.defaultError}:"invalid_type"!==r.code?{message:n.defaultError}:{message:o??a??n.defaultError}},description:n}}class pZ{get description(){return this._def.description}_getType(t){return pP(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:pP(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new pN,ctx:{common:t.parent.common,data:t.data,parsedType:pP(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(pz(r))throw Error("Synchronous parse encountered promise.");return r}_parseAsync(t){return Promise.resolve(this._parse(t))}parse(t,r){let a=this.safeParse(t,r);if(a.success)return a.data;throw a.error}safeParse(t,r){let a={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:pP(t)},i=this._parseSync({data:t,path:a.path,parent:a});return pL(a,i)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:pP(t)};if(!this["~standard"].async)try{let a=this._parseSync({data:t,path:[],parent:r});return"valid"===a.status?{value:a.value}:{issues:r.common.issues}}catch(t){t?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(t=>"valid"===t.status?{value:t.value}:{issues:r.common.issues})}async parseAsync(t,r){let a=await this.safeParseAsync(t,r);if(a.success)return a.data;throw a.error}async safeParseAsync(t,r){let a={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:pP(t)},i=this._parse({data:t,path:a.path,parent:a});return pL(a,await (pz(i)?i:Promise.resolve(i)))}refine(t,r){return this._refinement((a,i)=>{let n=t(a),o=()=>i.addIssue({code:pE.custom,..."string"==typeof r||void 0===r?{message:r}:"function"==typeof r?r(a):r});return"undefined"!=typeof Promise&&n instanceof Promise?n.then(t=>!!t||(o(),!1)):!!n||(o(),!1)})}refinement(t,r){return this._refinement((a,i)=>!!t(a)||(i.addIssue("function"==typeof r?r(a,i):r),!1))}_refinement(t){return new mk({schema:this,typeName:q.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return mx.create(this,this._def)}nullable(){return mR.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ms.create(this)}promise(){return mw.create(this,this._def)}or(t){return mc.create([this,t],this._def)}and(t){return mp.create(this,t,this._def)}transform(t){return new mk({...pD(this._def),schema:this,typeName:q.ZodEffects,effect:{type:"transform",transform:t}})}default(t){return new mP({...pD(this._def),innerType:this,defaultValue:"function"==typeof t?t:()=>t,typeName:q.ZodDefault})}brand(){return new mT({typeName:q.ZodBranded,type:this,...pD(this._def)})}catch(t){return new mE({...pD(this._def),innerType:this,catchValue:"function"==typeof t?t:()=>t,typeName:q.ZodCatch})}describe(t){return new this.constructor({...this._def,description:t})}pipe(t){return mO.create(this,t)}readonly(){return mC.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let pV=/^c[^\s-]{8,}$/i,pF=/^[0-9a-z]+$/,pU=/^[0-9A-HJKMNP-TV-Z]{26}$/i,pH=/^[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,pJ=/^[a-z0-9_-]{21}$/i,pK=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,pB=/^[-+]?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)?)??$/,pG=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,pW=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,pY=/^(?:(?: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])$/,pX=/^(([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]))$/,pQ=/^(([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])$/,p0=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,p1=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,p2="((\\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])))",p9=RegExp(`^${p2}$`);function p4(t){let r="[0-5]\\d";t.precision?r=`${r}\\.\\d{${t.precision}}`:null==t.precision&&(r=`${r}(\\.\\d+)?`);let a=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${r})${a}`}class p6 extends pZ{_parse(t){var r,a,i,n;let o;if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==pR.string){let r=this._getOrReturnCtx(t);return pC(r,{code:pE.invalid_type,expected:pR.string,received:r.parsedType}),pI}let s=new pN;for(let l of this._def.checks)if("min"===l.kind)t.data.length<l.value&&(pC(o=this._getOrReturnCtx(t,o),{code:pE.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),s.dirty());else if("max"===l.kind)t.data.length>l.value&&(pC(o=this._getOrReturnCtx(t,o),{code:pE.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),s.dirty());else if("length"===l.kind){let r=t.data.length>l.value,a=t.data.length<l.value;(r||a)&&(o=this._getOrReturnCtx(t,o),r?pC(o,{code:pE.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}):a&&pC(o,{code:pE.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}),s.dirty())}else if("email"===l.kind)pG.test(t.data)||(pC(o=this._getOrReturnCtx(t,o),{validation:"email",code:pE.invalid_string,message:l.message}),s.dirty());else if("emoji"===l.kind)p||(p=RegExp("^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$","u")),p.test(t.data)||(pC(o=this._getOrReturnCtx(t,o),{validation:"emoji",code:pE.invalid_string,message:l.message}),s.dirty());else if("uuid"===l.kind)pH.test(t.data)||(pC(o=this._getOrReturnCtx(t,o),{validation:"uuid",code:pE.invalid_string,message:l.message}),s.dirty());else if("nanoid"===l.kind)pJ.test(t.data)||(pC(o=this._getOrReturnCtx(t,o),{validation:"nanoid",code:pE.invalid_string,message:l.message}),s.dirty());else if("cuid"===l.kind)pV.test(t.data)||(pC(o=this._getOrReturnCtx(t,o),{validation:"cuid",code:pE.invalid_string,message:l.message}),s.dirty());else if("cuid2"===l.kind)pF.test(t.data)||(pC(o=this._getOrReturnCtx(t,o),{validation:"cuid2",code:pE.invalid_string,message:l.message}),s.dirty());else if("ulid"===l.kind)pU.test(t.data)||(pC(o=this._getOrReturnCtx(t,o),{validation:"ulid",code:pE.invalid_string,message:l.message}),s.dirty());else if("url"===l.kind)try{new URL(t.data)}catch{pC(o=this._getOrReturnCtx(t,o),{validation:"url",code:pE.invalid_string,message:l.message}),s.dirty()}else"regex"===l.kind?(l.regex.lastIndex=0,l.regex.test(t.data)||(pC(o=this._getOrReturnCtx(t,o),{validation:"regex",code:pE.invalid_string,message:l.message}),s.dirty())):"trim"===l.kind?t.data=t.data.trim():"includes"===l.kind?t.data.includes(l.value,l.position)||(pC(o=this._getOrReturnCtx(t,o),{code:pE.invalid_string,validation:{includes:l.value,position:l.position},message:l.message}),s.dirty()):"toLowerCase"===l.kind?t.data=t.data.toLowerCase():"toUpperCase"===l.kind?t.data=t.data.toUpperCase():"startsWith"===l.kind?t.data.startsWith(l.value)||(pC(o=this._getOrReturnCtx(t,o),{code:pE.invalid_string,validation:{startsWith:l.value},message:l.message}),s.dirty()):"endsWith"===l.kind?t.data.endsWith(l.value)||(pC(o=this._getOrReturnCtx(t,o),{code:pE.invalid_string,validation:{endsWith:l.value},message:l.message}),s.dirty()):"datetime"===l.kind?(function(t){let r=`${p2}T${p4(t)}`,a=[];return a.push(t.local?"Z?":"Z"),t.offset&&a.push("([+-]\\d{2}:?\\d{2})"),r=`${r}(${a.join("|")})`,RegExp(`^${r}$`)})(l).test(t.data)||(pC(o=this._getOrReturnCtx(t,o),{code:pE.invalid_string,validation:"datetime",message:l.message}),s.dirty()):"date"===l.kind?p9.test(t.data)||(pC(o=this._getOrReturnCtx(t,o),{code:pE.invalid_string,validation:"date",message:l.message}),s.dirty()):"time"===l.kind?RegExp(`^${p4(l)}$`).test(t.data)||(pC(o=this._getOrReturnCtx(t,o),{code:pE.invalid_string,validation:"time",message:l.message}),s.dirty()):"duration"===l.kind?pB.test(t.data)||(pC(o=this._getOrReturnCtx(t,o),{validation:"duration",code:pE.invalid_string,message:l.message}),s.dirty()):"ip"===l.kind?(r=t.data,!(("v4"===(a=l.version)||!a)&&pW.test(r)||("v6"===a||!a)&&pX.test(r))&&1&&(pC(o=this._getOrReturnCtx(t,o),{validation:"ip",code:pE.invalid_string,message:l.message}),s.dirty())):"jwt"===l.kind?!function(t,r){if(!pK.test(t))return!1;try{let[a]=t.split(".");if(!a)return!1;let i=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),n=JSON.parse(atob(i));if("object"!=typeof n||null===n||"typ"in n&&n?.typ!=="JWT"||!n.alg||r&&n.alg!==r)return!1;return!0}catch{return!1}}(t.data,l.alg)&&(pC(o=this._getOrReturnCtx(t,o),{validation:"jwt",code:pE.invalid_string,message:l.message}),s.dirty()):"cidr"===l.kind?(i=t.data,!(("v4"===(n=l.version)||!n)&&pY.test(i)||("v6"===n||!n)&&pQ.test(i))&&1&&(pC(o=this._getOrReturnCtx(t,o),{validation:"cidr",code:pE.invalid_string,message:l.message}),s.dirty())):"base64"===l.kind?p0.test(t.data)||(pC(o=this._getOrReturnCtx(t,o),{validation:"base64",code:pE.invalid_string,message:l.message}),s.dirty()):"base64url"===l.kind?p1.test(t.data)||(pC(o=this._getOrReturnCtx(t,o),{validation:"base64url",code:pE.invalid_string,message:l.message}),s.dirty()):C.assertNever(l);return{status:s.value,value:t.data}}_regex(t,r,a){return this.refinement(r=>t.test(r),{validation:r,code:pE.invalid_string,...I.errToObj(a)})}_addCheck(t){return new p6({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...I.errToObj(t)})}url(t){return this._addCheck({kind:"url",...I.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...I.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...I.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...I.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...I.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...I.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...I.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...I.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...I.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...I.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...I.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...I.errToObj(t)})}datetime(t){return"string"==typeof t?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:void 0===t?.precision?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...I.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return"string"==typeof t?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:void 0===t?.precision?null:t?.precision,...I.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...I.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...I.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...I.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...I.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...I.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...I.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...I.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...I.errToObj(r)})}nonempty(t){return this.min(1,I.errToObj(t))}trim(){return new p6({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new p6({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new p6({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>"datetime"===t.kind)}get isDate(){return!!this._def.checks.find(t=>"date"===t.kind)}get isTime(){return!!this._def.checks.find(t=>"time"===t.kind)}get isDuration(){return!!this._def.checks.find(t=>"duration"===t.kind)}get isEmail(){return!!this._def.checks.find(t=>"email"===t.kind)}get isURL(){return!!this._def.checks.find(t=>"url"===t.kind)}get isEmoji(){return!!this._def.checks.find(t=>"emoji"===t.kind)}get isUUID(){return!!this._def.checks.find(t=>"uuid"===t.kind)}get isNANOID(){return!!this._def.checks.find(t=>"nanoid"===t.kind)}get isCUID(){return!!this._def.checks.find(t=>"cuid"===t.kind)}get isCUID2(){return!!this._def.checks.find(t=>"cuid2"===t.kind)}get isULID(){return!!this._def.checks.find(t=>"ulid"===t.kind)}get isIP(){return!!this._def.checks.find(t=>"ip"===t.kind)}get isCIDR(){return!!this._def.checks.find(t=>"cidr"===t.kind)}get isBase64(){return!!this._def.checks.find(t=>"base64"===t.kind)}get isBase64url(){return!!this._def.checks.find(t=>"base64url"===t.kind)}get minLength(){let t=null;for(let r of this._def.checks)"min"===r.kind&&(null===t||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)"max"===r.kind&&(null===t||r.value<t)&&(t=r.value);return t}}p6.create=t=>new p6({checks:[],typeName:q.ZodString,coerce:t?.coerce??!1,...pD(t)});class p5 extends pZ{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){let r;if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==pR.number){let r=this._getOrReturnCtx(t);return pC(r,{code:pE.invalid_type,expected:pR.number,received:r.parsedType}),pI}let a=new pN;for(let i of this._def.checks)"int"===i.kind?C.isInteger(t.data)||(pC(r=this._getOrReturnCtx(t,r),{code:pE.invalid_type,expected:"integer",received:"float",message:i.message}),a.dirty()):"min"===i.kind?(i.inclusive?t.data<i.value:t.data<=i.value)&&(pC(r=this._getOrReturnCtx(t,r),{code:pE.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):"max"===i.kind?(i.inclusive?t.data>i.value:t.data>=i.value)&&(pC(r=this._getOrReturnCtx(t,r),{code:pE.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):"multipleOf"===i.kind?0!==function(t,r){let a=(t.toString().split(".")[1]||"").length,i=(r.toString().split(".")[1]||"").length,n=a>i?a:i;return Number.parseInt(t.toFixed(n).replace(".",""))%Number.parseInt(r.toFixed(n).replace(".",""))/10**n}(t.data,i.value)&&(pC(r=this._getOrReturnCtx(t,r),{code:pE.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):"finite"===i.kind?Number.isFinite(t.data)||(pC(r=this._getOrReturnCtx(t,r),{code:pE.not_finite,message:i.message}),a.dirty()):C.assertNever(i);return{status:a.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,I.toString(r))}gt(t,r){return this.setLimit("min",t,!1,I.toString(r))}lte(t,r){return this.setLimit("max",t,!0,I.toString(r))}lt(t,r){return this.setLimit("max",t,!1,I.toString(r))}setLimit(t,r,a,i){return new p5({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:a,message:I.toString(i)}]})}_addCheck(t){return new p5({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:I.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:I.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:I.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:I.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:I.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:I.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:I.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:I.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:I.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)"min"===r.kind&&(null===t||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)"max"===r.kind&&(null===t||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>"int"===t.kind||"multipleOf"===t.kind&&C.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let a of this._def.checks)if("finite"===a.kind||"int"===a.kind||"multipleOf"===a.kind)return!0;else"min"===a.kind?(null===r||a.value>r)&&(r=a.value):"max"===a.kind&&(null===t||a.value<t)&&(t=a.value);return Number.isFinite(r)&&Number.isFinite(t)}}p5.create=t=>new p5({checks:[],typeName:q.ZodNumber,coerce:t?.coerce||!1,...pD(t)});class p3 extends pZ{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){let r;if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==pR.bigint)return this._getInvalidInput(t);let a=new pN;for(let i of this._def.checks)"min"===i.kind?(i.inclusive?t.data<i.value:t.data<=i.value)&&(pC(r=this._getOrReturnCtx(t,r),{code:pE.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):"max"===i.kind?(i.inclusive?t.data>i.value:t.data>=i.value)&&(pC(r=this._getOrReturnCtx(t,r),{code:pE.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):"multipleOf"===i.kind?t.data%i.value!==BigInt(0)&&(pC(r=this._getOrReturnCtx(t,r),{code:pE.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):C.assertNever(i);return{status:a.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return pC(r,{code:pE.invalid_type,expected:pR.bigint,received:r.parsedType}),pI}gte(t,r){return this.setLimit("min",t,!0,I.toString(r))}gt(t,r){return this.setLimit("min",t,!1,I.toString(r))}lte(t,r){return this.setLimit("max",t,!0,I.toString(r))}lt(t,r){return this.setLimit("max",t,!1,I.toString(r))}setLimit(t,r,a,i){return new p3({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:a,message:I.toString(i)}]})}_addCheck(t){return new p3({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:I.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:I.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:I.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:I.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:I.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)"min"===r.kind&&(null===t||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)"max"===r.kind&&(null===t||r.value<t)&&(t=r.value);return t}}p3.create=t=>new p3({checks:[],typeName:q.ZodBigInt,coerce:t?.coerce??!1,...pD(t)});class p8 extends pZ{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==pR.boolean){let r=this._getOrReturnCtx(t);return pC(r,{code:pE.invalid_type,expected:pR.boolean,received:r.parsedType}),pI}return pA(t.data)}}p8.create=t=>new p8({typeName:q.ZodBoolean,coerce:t?.coerce||!1,...pD(t)});class p7 extends pZ{_parse(t){let r;if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==pR.date){let r=this._getOrReturnCtx(t);return pC(r,{code:pE.invalid_type,expected:pR.date,received:r.parsedType}),pI}if(Number.isNaN(t.data.getTime()))return pC(this._getOrReturnCtx(t),{code:pE.invalid_date}),pI;let a=new pN;for(let i of this._def.checks)"min"===i.kind?t.data.getTime()<i.value&&(pC(r=this._getOrReturnCtx(t,r),{code:pE.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),a.dirty()):"max"===i.kind?t.data.getTime()>i.value&&(pC(r=this._getOrReturnCtx(t,r),{code:pE.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),a.dirty()):C.assertNever(i);return{status:a.value,value:new Date(t.data.getTime())}}_addCheck(t){return new p7({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:I.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:I.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)"min"===r.kind&&(null===t||r.value>t)&&(t=r.value);return null!=t?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)"max"===r.kind&&(null===t||r.value<t)&&(t=r.value);return null!=t?new Date(t):null}}p7.create=t=>new p7({checks:[],coerce:t?.coerce||!1,typeName:q.ZodDate,...pD(t)});class me extends pZ{_parse(t){if(this._getType(t)!==pR.symbol){let r=this._getOrReturnCtx(t);return pC(r,{code:pE.invalid_type,expected:pR.symbol,received:r.parsedType}),pI}return pA(t.data)}}me.create=t=>new me({typeName:q.ZodSymbol,...pD(t)});class mt extends pZ{_parse(t){if(this._getType(t)!==pR.undefined){let r=this._getOrReturnCtx(t);return pC(r,{code:pE.invalid_type,expected:pR.undefined,received:r.parsedType}),pI}return pA(t.data)}}mt.create=t=>new mt({typeName:q.ZodUndefined,...pD(t)});class mr extends pZ{_parse(t){if(this._getType(t)!==pR.null){let r=this._getOrReturnCtx(t);return pC(r,{code:pE.invalid_type,expected:pR.null,received:r.parsedType}),pI}return pA(t.data)}}mr.create=t=>new mr({typeName:q.ZodNull,...pD(t)});class ma extends pZ{constructor(){super(...arguments),this._any=!0}_parse(t){return pA(t.data)}}ma.create=t=>new ma({typeName:q.ZodAny,...pD(t)});class mi extends pZ{constructor(){super(...arguments),this._unknown=!0}_parse(t){return pA(t.data)}}mi.create=t=>new mi({typeName:q.ZodUnknown,...pD(t)});class mn extends pZ{_parse(t){let r=this._getOrReturnCtx(t);return pC(r,{code:pE.invalid_type,expected:pR.never,received:r.parsedType}),pI}}mn.create=t=>new mn({typeName:q.ZodNever,...pD(t)});class mo extends pZ{_parse(t){if(this._getType(t)!==pR.undefined){let r=this._getOrReturnCtx(t);return pC(r,{code:pE.invalid_type,expected:pR.void,received:r.parsedType}),pI}return pA(t.data)}}mo.create=t=>new mo({typeName:q.ZodVoid,...pD(t)});class ms extends pZ{_parse(t){let{ctx:r,status:a}=this._processInputParams(t),i=this._def;if(r.parsedType!==pR.array)return pC(r,{code:pE.invalid_type,expected:pR.array,received:r.parsedType}),pI;if(null!==i.exactLength){let t=r.data.length>i.exactLength.value,n=r.data.length<i.exactLength.value;(t||n)&&(pC(r,{code:t?pE.too_big:pE.too_small,minimum:n?i.exactLength.value:void 0,maximum:t?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),a.dirty())}if(null!==i.minLength&&r.data.length<i.minLength.value&&(pC(r,{code:pE.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),a.dirty()),null!==i.maxLength&&r.data.length>i.maxLength.value&&(pC(r,{code:pE.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),a.dirty()),r.common.async)return Promise.all([...r.data].map((t,a)=>i.type._parseAsync(new pM(r,t,r.path,a)))).then(t=>pN.mergeArray(a,t));let n=[...r.data].map((t,a)=>i.type._parseSync(new pM(r,t,r.path,a)));return pN.mergeArray(a,n)}get element(){return this._def.type}min(t,r){return new ms({...this._def,minLength:{value:t,message:I.toString(r)}})}max(t,r){return new ms({...this._def,maxLength:{value:t,message:I.toString(r)}})}length(t,r){return new ms({...this._def,exactLength:{value:t,message:I.toString(r)}})}nonempty(t){return this.min(1,t)}}ms.create=(t,r)=>new ms({type:t,minLength:null,maxLength:null,exactLength:null,typeName:q.ZodArray,...pD(r)});class ml extends pZ{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let t=this._def.shape(),r=C.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==pR.object){let r=this._getOrReturnCtx(t);return pC(r,{code:pE.invalid_type,expected:pR.object,received:r.parsedType}),pI}let{status:r,ctx:a}=this._processInputParams(t),{shape:i,keys:n}=this._getCached(),o=[];if(!(this._def.catchall instanceof mn&&"strip"===this._def.unknownKeys))for(let t in a.data)n.includes(t)||o.push(t);let s=[];for(let t of n){let r=i[t],n=a.data[t];s.push({key:{status:"valid",value:t},value:r._parse(new pM(a,n,a.path,t)),alwaysSet:t in a.data})}if(this._def.catchall instanceof mn){let t=this._def.unknownKeys;if("passthrough"===t)for(let t of o)s.push({key:{status:"valid",value:t},value:{status:"valid",value:a.data[t]}});else if("strict"===t)o.length>0&&(pC(a,{code:pE.unrecognized_keys,keys:o}),r.dirty());else if("strip"===t);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let t=this._def.catchall;for(let r of o){let i=a.data[r];s.push({key:{status:"valid",value:r},value:t._parse(new pM(a,i,a.path,r)),alwaysSet:r in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let t=[];for(let r of s){let a=await r.key,i=await r.value;t.push({key:a,value:i,alwaysSet:r.alwaysSet})}return t}).then(t=>pN.mergeObjectSync(r,t)):pN.mergeObjectSync(r,s)}get shape(){return this._def.shape()}strict(t){return I.errToObj,new ml({...this._def,unknownKeys:"strict",...void 0!==t?{errorMap:(r,a)=>{let i=this._def.errorMap?.(r,a).message??a.defaultError;return"unrecognized_keys"===r.code?{message:I.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new ml({...this._def,unknownKeys:"strip"})}passthrough(){return new ml({...this._def,unknownKeys:"passthrough"})}extend(t){return new ml({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new ml({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:q.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new ml({...this._def,catchall:t})}pick(t){let r={};for(let a of C.objectKeys(t))t[a]&&this.shape[a]&&(r[a]=this.shape[a]);return new ml({...this._def,shape:()=>r})}omit(t){let r={};for(let a of C.objectKeys(this.shape))t[a]||(r[a]=this.shape[a]);return new ml({...this._def,shape:()=>r})}deepPartial(){return function t(r){if(r instanceof ml){let a={};for(let i in r.shape){let n=r.shape[i];a[i]=mx.create(t(n))}return new ml({...r._def,shape:()=>a})}if(r instanceof ms)return new ms({...r._def,type:t(r.element)});if(r instanceof mx)return mx.create(t(r.unwrap()));if(r instanceof mR)return mR.create(t(r.unwrap()));if(r instanceof mm)return mm.create(r.items.map(r=>t(r)));else return r}(this)}partial(t){let r={};for(let a of C.objectKeys(this.shape)){let i=this.shape[a];t&&!t[a]?r[a]=i:r[a]=i.optional()}return new ml({...this._def,shape:()=>r})}required(t){let r={};for(let a of C.objectKeys(this.shape))if(t&&!t[a])r[a]=this.shape[a];else{let t=this.shape[a];for(;t instanceof mx;)t=t._def.innerType;r[a]=t}return new ml({...this._def,shape:()=>r})}keyof(){return mb(C.objectKeys(this.shape))}}ml.create=(t,r)=>new ml({shape:()=>t,unknownKeys:"strip",catchall:mn.create(),typeName:q.ZodObject,...pD(r)}),ml.strictCreate=(t,r)=>new ml({shape:()=>t,unknownKeys:"strict",catchall:mn.create(),typeName:q.ZodObject,...pD(r)}),ml.lazycreate=(t,r)=>new ml({shape:t,unknownKeys:"strip",catchall:mn.create(),typeName:q.ZodObject,...pD(r)});class mc extends pZ{_parse(t){let{ctx:r}=this._processInputParams(t),a=this._def.options;if(r.common.async)return Promise.all(a.map(async t=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await t._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(function(t){for(let r of t)if("valid"===r.result.status)return r.result;for(let a of t)if("dirty"===a.result.status)return r.common.issues.push(...a.ctx.common.issues),a.result;let a=t.map(t=>new pj(t.ctx.common.issues));return pC(r,{code:pE.invalid_union,unionErrors:a}),pI});{let t,i=[];for(let n of a){let a={...r,common:{...r.common,issues:[]},parent:null},o=n._parseSync({data:r.data,path:r.path,parent:a});if("valid"===o.status)return o;"dirty"!==o.status||t||(t={result:o,ctx:a}),a.common.issues.length&&i.push(a.common.issues)}if(t)return r.common.issues.push(...t.ctx.common.issues),t.result;let n=i.map(t=>new pj(t));return pC(r,{code:pE.invalid_union,unionErrors:n}),pI}}get options(){return this._def.options}}mc.create=(t,r)=>new mc({options:t,typeName:q.ZodUnion,...pD(r)});let mu=t=>{if(t instanceof mv)return mu(t.schema);if(t instanceof mk)return mu(t.innerType());if(t instanceof m_)return[t.value];if(t instanceof mS)return t.options;if(t instanceof m$)return C.objectValues(t.enum);else if(t instanceof mP)return mu(t._def.innerType);else if(t instanceof mt)return[void 0];else if(t instanceof mr)return[null];else if(t instanceof mx)return[void 0,...mu(t.unwrap())];else if(t instanceof mR)return[null,...mu(t.unwrap())];else if(t instanceof mT)return mu(t.unwrap());else if(t instanceof mC)return mu(t.unwrap());else if(t instanceof mE)return mu(t._def.innerType);else return[]};class md extends pZ{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==pR.object)return pC(r,{code:pE.invalid_type,expected:pR.object,received:r.parsedType}),pI;let a=this.discriminator,i=r.data[a],n=this.optionsMap.get(i);return n?r.common.async?n._parseAsync({data:r.data,path:r.path,parent:r}):n._parseSync({data:r.data,path:r.path,parent:r}):(pC(r,{code:pE.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),pI)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,a){let i=new Map;for(let a of r){let r=mu(a.shape[t]);if(!r.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let n of r){if(i.has(n))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(n)}`);i.set(n,a)}}return new md({typeName:q.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,...pD(a)})}}class mp extends pZ{_parse(t){let{status:r,ctx:a}=this._processInputParams(t),i=(t,i)=>{if("aborted"===t.status||"aborted"===i.status)return pI;let n=function t(r,a){let i=pP(r),n=pP(a);if(r===a)return{valid:!0,data:r};if(i===pR.object&&n===pR.object){let i=C.objectKeys(a),n=C.objectKeys(r).filter(t=>-1!==i.indexOf(t)),o={...r,...a};for(let i of(Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__,n)){if("__proto__"===i)continue;let n=t(r[i],a[i]);if(!n.valid)return{valid:!1};o[i]=n.data}return{valid:!0,data:o}}if(i===pR.array&&n===pR.array){if(r.length!==a.length)return{valid:!1};let i=[];for(let n=0;n<r.length;n++){let o=t(r[n],a[n]);if(!o.valid)return{valid:!1};i.push(o.data)}return{valid:!0,data:i}}if(i===pR.date&&n===pR.date&&+r==+a)return{valid:!0,data:r};return{valid:!1}}(t.value,i.value);return n.valid?(("dirty"===t.status||"dirty"===i.status)&&r.dirty(),{status:r.value,value:n.data}):(pC(a,{code:pE.invalid_intersection_types}),pI)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([t,r])=>i(t,r)):i(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}}mp.create=(t,r,a)=>new mp({left:t,right:r,typeName:q.ZodIntersection,...pD(a)});class mm extends pZ{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==pR.array)return pC(a,{code:pE.invalid_type,expected:pR.array,received:a.parsedType}),pI;if(a.data.length<this._def.items.length)return pC(a,{code:pE.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),pI;!this._def.rest&&a.data.length>this._def.items.length&&(pC(a,{code:pE.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...a.data].map((t,r)=>{let i=this._def.items[r]||this._def.rest;return i?i._parse(new pM(a,t,a.path,r)):null}).filter(t=>!!t);return a.common.async?Promise.all(i).then(t=>pN.mergeArray(r,t)):pN.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new mm({...this._def,rest:t})}}mm.create=(t,r)=>{if(!Array.isArray(t))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new mm({items:t,typeName:q.ZodTuple,rest:null,...pD(r)})};class mh extends pZ{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==pR.object)return pC(a,{code:pE.invalid_type,expected:pR.object,received:a.parsedType}),pI;let i=[],n=this._def.keyType,o=this._def.valueType;for(let t in a.data)i.push({key:n._parse(new pM(a,t,a.path,t)),value:o._parse(new pM(a,a.data[t],a.path,t)),alwaysSet:t in a.data});return a.common.async?pN.mergeObjectAsync(r,i):pN.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,a){return new mh(r instanceof pZ?{keyType:t,valueType:r,typeName:q.ZodRecord,...pD(a)}:{keyType:p6.create(),valueType:t,typeName:q.ZodRecord,...pD(r)})}}class mf extends pZ{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==pR.map)return pC(a,{code:pE.invalid_type,expected:pR.map,received:a.parsedType}),pI;let i=this._def.keyType,n=this._def.valueType,o=[...a.data.entries()].map(([t,r],o)=>({key:i._parse(new pM(a,t,a.path,[o,"key"])),value:n._parse(new pM(a,r,a.path,[o,"value"]))}));if(a.common.async){let t=new Map;return Promise.resolve().then(async()=>{for(let a of o){let i=await a.key,n=await a.value;if("aborted"===i.status||"aborted"===n.status)return pI;("dirty"===i.status||"dirty"===n.status)&&r.dirty(),t.set(i.value,n.value)}return{status:r.value,value:t}})}{let t=new Map;for(let a of o){let i=a.key,n=a.value;if("aborted"===i.status||"aborted"===n.status)return pI;("dirty"===i.status||"dirty"===n.status)&&r.dirty(),t.set(i.value,n.value)}return{status:r.value,value:t}}}}mf.create=(t,r,a)=>new mf({valueType:r,keyType:t,typeName:q.ZodMap,...pD(a)});class my extends pZ{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==pR.set)return pC(a,{code:pE.invalid_type,expected:pR.set,received:a.parsedType}),pI;let i=this._def;null!==i.minSize&&a.data.size<i.minSize.value&&(pC(a,{code:pE.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),null!==i.maxSize&&a.data.size>i.maxSize.value&&(pC(a,{code:pE.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let n=this._def.valueType;function o(t){let a=new Set;for(let i of t){if("aborted"===i.status)return pI;"dirty"===i.status&&r.dirty(),a.add(i.value)}return{status:r.value,value:a}}let s=[...a.data.values()].map((t,r)=>n._parse(new pM(a,t,a.path,r)));return a.common.async?Promise.all(s).then(t=>o(t)):o(s)}min(t,r){return new my({...this._def,minSize:{value:t,message:I.toString(r)}})}max(t,r){return new my({...this._def,maxSize:{value:t,message:I.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}}my.create=(t,r)=>new my({valueType:t,minSize:null,maxSize:null,typeName:q.ZodSet,...pD(r)});class mg extends pZ{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==pR.function)return pC(r,{code:pE.invalid_type,expected:pR.function,received:r.parsedType}),pI;function a(t,a){return pO({data:t,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,pT,pT].filter(t=>!!t),issueData:{code:pE.invalid_arguments,argumentsError:a}})}function i(t,a){return pO({data:t,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,pT,pT].filter(t=>!!t),issueData:{code:pE.invalid_return_type,returnTypeError:a}})}let n={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof mw){let t=this;return pA(async function(...r){let s=new pj([]),l=await t._def.args.parseAsync(r,n).catch(t=>{throw s.addIssue(a(r,t)),s}),c=await Reflect.apply(o,this,l);return await t._def.returns._def.type.parseAsync(c,n).catch(t=>{throw s.addIssue(i(c,t)),s})})}{let t=this;return pA(function(...r){let s=t._def.args.safeParse(r,n);if(!s.success)throw new pj([a(r,s.error)]);let l=Reflect.apply(o,this,s.data),c=t._def.returns.safeParse(l,n);if(!c.success)throw new pj([i(l,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new mg({...this._def,args:mm.create(t).rest(mi.create())})}returns(t){return new mg({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,a){return new mg({args:t||mm.create([]).rest(mi.create()),returns:r||mi.create(),typeName:q.ZodFunction,...pD(a)})}}class mv extends pZ{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}mv.create=(t,r)=>new mv({getter:t,typeName:q.ZodLazy,...pD(r)});class m_ extends pZ{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return pC(r,{received:r.data,code:pE.invalid_literal,expected:this._def.value}),pI}return{status:"valid",value:t.data}}get value(){return this._def.value}}function mb(t,r){return new mS({values:t,typeName:q.ZodEnum,...pD(r)})}m_.create=(t,r)=>new m_({value:t,typeName:q.ZodLiteral,...pD(r)});class mS extends pZ{_parse(t){if("string"!=typeof t.data){let r=this._getOrReturnCtx(t),a=this._def.values;return pC(r,{expected:C.joinValues(a),received:r.parsedType,code:pE.invalid_type}),pI}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),a=this._def.values;return pC(r,{received:r.data,code:pE.invalid_enum_value,options:a}),pI}return pA(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return mS.create(t,{...this._def,...r})}exclude(t,r=this._def){return mS.create(this.options.filter(r=>!t.includes(r)),{...this._def,...r})}}mS.create=mb;class m$ extends pZ{_parse(t){let r=C.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(t);if(a.parsedType!==pR.string&&a.parsedType!==pR.number){let t=C.objectValues(r);return pC(a,{expected:C.joinValues(t),received:a.parsedType,code:pE.invalid_type}),pI}if(this._cache||(this._cache=new Set(C.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let t=C.objectValues(r);return pC(a,{received:a.data,code:pE.invalid_enum_value,options:t}),pI}return pA(t.data)}get enum(){return this._def.values}}m$.create=(t,r)=>new m$({values:t,typeName:q.ZodNativeEnum,...pD(r)});class mw extends pZ{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);return r.parsedType!==pR.promise&&!1===r.common.async?(pC(r,{code:pE.invalid_type,expected:pR.promise,received:r.parsedType}),pI):pA((r.parsedType===pR.promise?r.data:Promise.resolve(r.data)).then(t=>this._def.type.parseAsync(t,{path:r.path,errorMap:r.common.contextualErrorMap})))}}mw.create=(t,r)=>new mw({type:t,typeName:q.ZodPromise,...pD(r)});class mk extends pZ{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===q.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:a}=this._processInputParams(t),i=this._def.effect||null,n={addIssue:t=>{pC(a,t),t.fatal?r.abort():r.dirty()},get path(){return a.path}};if(n.addIssue=n.addIssue.bind(n),"preprocess"===i.type){let t=i.transform(a.data,n);if(a.common.async)return Promise.resolve(t).then(async t=>{if("aborted"===r.value)return pI;let i=await this._def.schema._parseAsync({data:t,path:a.path,parent:a});return"aborted"===i.status?pI:"dirty"===i.status||"dirty"===r.value?pq(i.value):i});{if("aborted"===r.value)return pI;let i=this._def.schema._parseSync({data:t,path:a.path,parent:a});return"aborted"===i.status?pI:"dirty"===i.status||"dirty"===r.value?pq(i.value):i}}if("refinement"===i.type){let t=t=>{let r=i.refinement(t,n);if(a.common.async)return Promise.resolve(r);if(r instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return t};if(!1!==a.common.async)return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(a=>"aborted"===a.status?pI:("dirty"===a.status&&r.dirty(),t(a.value).then(()=>({status:r.value,value:a.value}))));{let i=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===i.status?pI:("dirty"===i.status&&r.dirty(),t(i.value),{status:r.value,value:i.value})}}if("transform"===i.type)if(!1!==a.common.async)return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(t=>"valid"!==t.status?pI:Promise.resolve(i.transform(t.value,n)).then(t=>({status:r.value,value:t})));else{let t=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if("valid"!==t.status)return pI;let o=i.transform(t.value,n);if(o instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}C.assertNever(i)}}mk.create=(t,r,a)=>new mk({schema:t,typeName:q.ZodEffects,effect:r,...pD(a)}),mk.createWithPreprocess=(t,r,a)=>new mk({schema:r,effect:{type:"preprocess",transform:t},typeName:q.ZodEffects,...pD(a)});class mx extends pZ{_parse(t){return this._getType(t)===pR.undefined?pA(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}mx.create=(t,r)=>new mx({innerType:t,typeName:q.ZodOptional,...pD(r)});class mR extends pZ{_parse(t){return this._getType(t)===pR.null?pA(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}mR.create=(t,r)=>new mR({innerType:t,typeName:q.ZodNullable,...pD(r)});class mP extends pZ{_parse(t){let{ctx:r}=this._processInputParams(t),a=r.data;return r.parsedType===pR.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}mP.create=(t,r)=>new mP({innerType:t,typeName:q.ZodDefault,defaultValue:"function"==typeof r.default?r.default:()=>r.default,...pD(r)});class mE extends pZ{_parse(t){let{ctx:r}=this._processInputParams(t),a={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return pz(i)?i.then(t=>({status:"valid",value:"valid"===t.status?t.value:this._def.catchValue({get error(){return new pj(a.common.issues)},input:a.data})})):{status:"valid",value:"valid"===i.status?i.value:this._def.catchValue({get error(){return new pj(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}}mE.create=(t,r)=>new mE({innerType:t,typeName:q.ZodCatch,catchValue:"function"==typeof r.catch?r.catch:()=>r.catch,...pD(r)});class mj extends pZ{_parse(t){if(this._getType(t)!==pR.nan){let r=this._getOrReturnCtx(t);return pC(r,{code:pE.invalid_type,expected:pR.nan,received:r.parsedType}),pI}return{status:"valid",value:t.data}}}mj.create=t=>new mj({typeName:q.ZodNaN,...pD(t)}),Symbol("zod_brand");class mT extends pZ{_parse(t){let{ctx:r}=this._processInputParams(t),a=r.data;return this._def.type._parse({data:a,path:r.path,parent:r})}unwrap(){return this._def.type}}class mO extends pZ{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.common.async)return(async()=>{let t=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return"aborted"===t.status?pI:"dirty"===t.status?(r.dirty(),pq(t.value)):this._def.out._parseAsync({data:t.value,path:a.path,parent:a})})();{let t=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===t.status?pI:"dirty"===t.status?(r.dirty(),{status:"dirty",value:t.value}):this._def.out._parseSync({data:t.value,path:a.path,parent:a})}}static create(t,r){return new mO({in:t,out:r,typeName:q.ZodPipeline})}}class mC extends pZ{_parse(t){let r=this._def.innerType._parse(t),a=t=>("valid"===t.status&&(t.value=Object.freeze(t.value)),t);return pz(r)?r.then(t=>a(t)):a(r)}unwrap(){return this._def.innerType}}mC.create=(t,r)=>new mC({innerType:t,typeName:q.ZodReadonly,...pD(r)}),ml.lazycreate,(E=q||(q={})).ZodString="ZodString",E.ZodNumber="ZodNumber",E.ZodNaN="ZodNaN",E.ZodBigInt="ZodBigInt",E.ZodBoolean="ZodBoolean",E.ZodDate="ZodDate",E.ZodSymbol="ZodSymbol",E.ZodUndefined="ZodUndefined",E.ZodNull="ZodNull",E.ZodAny="ZodAny",E.ZodUnknown="ZodUnknown",E.ZodNever="ZodNever",E.ZodVoid="ZodVoid",E.ZodArray="ZodArray",E.ZodObject="ZodObject",E.ZodUnion="ZodUnion",E.ZodDiscriminatedUnion="ZodDiscriminatedUnion",E.ZodIntersection="ZodIntersection",E.ZodTuple="ZodTuple",E.ZodRecord="ZodRecord",E.ZodMap="ZodMap",E.ZodSet="ZodSet",E.ZodFunction="ZodFunction",E.ZodLazy="ZodLazy",E.ZodLiteral="ZodLiteral",E.ZodEnum="ZodEnum",E.ZodEffects="ZodEffects",E.ZodNativeEnum="ZodNativeEnum",E.ZodOptional="ZodOptional",E.ZodNullable="ZodNullable",E.ZodDefault="ZodDefault",E.ZodCatch="ZodCatch",E.ZodPromise="ZodPromise",E.ZodBranded="ZodBranded",E.ZodPipeline="ZodPipeline",E.ZodReadonly="ZodReadonly",p6.create,p5.create,mj.create,p3.create,p8.create,p7.create,me.create,mt.create,mr.create,ma.create,mi.create,mn.create,mo.create,ms.create,ml.create,ml.strictCreate,mc.create,md.create,mp.create,mm.create,mh.create,mf.create,my.create,mg.create,mv.create,m_.create,mS.create,m$.create,mw.create,mk.create,mx.create,mR.create,mk.createWithPreprocess,mO.create;let mN=(t,r)=>{let a=0;for(;a<t.length&&a<r.length&&t[a]===r[a];a++);return[(t.length-a).toString(),...r.slice(a)].join("/")};function mI(t){if("openAi"!==t.target)return{};let r=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===t.$refStrategy?mN(r,t.currentPath):r.join("/")}}function mq(t,r,a,i){i?.errorMessages&&a&&(t.errorMessage={...t.errorMessage,[r]:a})}function mA(t,r,a,i,n){t[r]=a,mq(t,r,i,n)}function mz(t,r){return m4(t.type._def,r)}let mM=/^[cC][^\s-]{8,}$/,mL=/^[0-9a-z]+$/,mD=/^[0-9A-HJKMNP-TV-Z]{26}$/,mZ=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,mV=()=>(void 0===$&&($=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),$),mF=/^(?:(?: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])$/,mU=/^(([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])$/,mH=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,mJ=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,mK=/^[a-zA-Z0-9_-]{21}$/,mB=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function mG(t,r){let a={type:"string"};if(t.checks)for(let i of t.checks)switch(i.kind){case"min":mA(a,"minLength","number"==typeof a.minLength?Math.max(a.minLength,i.value):i.value,i.message,r);break;case"max":mA(a,"maxLength","number"==typeof a.maxLength?Math.min(a.maxLength,i.value):i.value,i.message,r);break;case"email":switch(r.emailStrategy){case"format:email":mX(a,"email",i.message,r);break;case"format:idn-email":mX(a,"idn-email",i.message,r);break;case"pattern:zod":mQ(a,mZ,i.message,r)}break;case"url":mX(a,"uri",i.message,r);break;case"uuid":mX(a,"uuid",i.message,r);break;case"regex":mQ(a,i.regex,i.message,r);break;case"cuid":mQ(a,mM,i.message,r);break;case"cuid2":mQ(a,mL,i.message,r);break;case"startsWith":mQ(a,RegExp(`^${mW(i.value,r)}`),i.message,r);break;case"endsWith":mQ(a,RegExp(`${mW(i.value,r)}$`),i.message,r);break;case"datetime":mX(a,"date-time",i.message,r);break;case"date":mX(a,"date",i.message,r);break;case"time":mX(a,"time",i.message,r);break;case"duration":mX(a,"duration",i.message,r);break;case"length":mA(a,"minLength","number"==typeof a.minLength?Math.max(a.minLength,i.value):i.value,i.message,r),mA(a,"maxLength","number"==typeof a.maxLength?Math.min(a.maxLength,i.value):i.value,i.message,r);break;case"includes":mQ(a,RegExp(mW(i.value,r)),i.message,r);break;case"ip":"v6"!==i.version&&mX(a,"ipv4",i.message,r),"v4"!==i.version&&mX(a,"ipv6",i.message,r);break;case"base64url":mQ(a,mJ,i.message,r);break;case"jwt":mQ(a,mB,i.message,r);break;case"cidr":"v6"!==i.version&&mQ(a,mF,i.message,r),"v4"!==i.version&&mQ(a,mU,i.message,r);break;case"emoji":mQ(a,mV(),i.message,r);break;case"ulid":mQ(a,mD,i.message,r);break;case"base64":switch(r.base64Strategy){case"format:binary":mX(a,"binary",i.message,r);break;case"contentEncoding:base64":mA(a,"contentEncoding","base64",i.message,r);break;case"pattern:zod":mQ(a,mH,i.message,r)}break;case"nanoid":mQ(a,mK,i.message,r)}return a}function mW(t,r){return"escape"===r.patternStrategy?function(t){let r="";for(let a=0;a<t.length;a++)mY.has(t[a])||(r+="\\"),r+=t[a];return r}(t):t}let mY=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function mX(t,r,a,i){t.format||t.anyOf?.some(t=>t.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&i.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,0===Object.keys(t.errorMessage).length&&delete t.errorMessage)),t.anyOf.push({format:r,...a&&i.errorMessages&&{errorMessage:{format:a}}})):mA(t,"format",r,a,i)}function mQ(t,r,a,i){t.pattern||t.allOf?.some(t=>t.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&i.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,0===Object.keys(t.errorMessage).length&&delete t.errorMessage)),t.allOf.push({pattern:m0(r,i),...a&&i.errorMessages&&{errorMessage:{pattern:a}}})):mA(t,"pattern",m0(r,i),a,i)}function m0(t,r){if(!r.applyRegexFlags||!t.flags)return t.source;let a={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},i=a.i?t.source.toLowerCase():t.source,n="",o=!1,s=!1,l=!1;for(let t=0;t<i.length;t++){if(o){n+=i[t],o=!1;continue}if(a.i){if(s){if(i[t].match(/[a-z]/)){l?(n+=i[t],n+=`${i[t-2]}-${i[t]}`.toUpperCase(),l=!1):"-"===i[t+1]&&i[t+2]?.match(/[a-z]/)?(n+=i[t],l=!0):n+=`${i[t]}${i[t].toUpperCase()}`;continue}}else if(i[t].match(/[a-z]/)){n+=`[${i[t]}${i[t].toUpperCase()}]`;continue}}if(a.m){if("^"===i[t]){n+=`(^|(?<=[\r
|
|
62
62
|
]))`;continue}else if("$"===i[t]){n+=`($|(?=[\r
|
|
63
63
|
]))`;continue}}if(a.s&&"."===i[t]){n+=s?`${i[t]}\r
|
|
64
64
|
`:`[${i[t]}\r
|
|
65
|
-
]`;continue}n+=i[t],"\\"===i[t]?o=!0:s&&"]"===i[t]?s=!1:s||"["!==i[t]||(s=!0)}try{new RegExp(n)}catch{return console.warn(`Could not convert regex pattern at ${r.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return n}function m2(t,r){if("openAi"===r.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===r.target&&t.keyType?._def.typeName===q.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((a,i)=>({...a,[i]:m6(t.valueType._def,{...r,currentPath:[...r.currentPath,"properties",i]})??mq(r)}),{}),additionalProperties:r.rejectedAdditionalProperties};let a={type:"object",additionalProperties:m6(t.valueType._def,{...r,currentPath:[...r.currentPath,"additionalProperties"]})??r.allowedAdditionalProperties};if("openApi3"===r.target)return a;if(t.keyType?._def.typeName===q.ZodString&&t.keyType._def.checks?.length){let{type:i,...n}=mG(t.keyType._def,r);return{...a,propertyNames:n}}if(t.keyType?._def.typeName===q.ZodEnum)return{...a,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===q.ZodBranded&&t.keyType._def.type._def.typeName===q.ZodString&&t.keyType._def.type._def.checks?.length){let{type:i,...n}=mM(t.keyType._def,r);return{...a,propertyNames:n}}return a}let m9={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"},m4=(t,r)=>{let a=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((t,a)=>m6(t._def,{...r,currentPath:[...r.currentPath,"anyOf",`${a}`]})).filter(t=>!!t&&(!r.strictUnions||"object"==typeof t&&Object.keys(t).length>0));return a.length?{anyOf:a}:void 0};function m6(t,r,a=!1){let i=r.seen.get(t);if(r.override){let n=r.override?.(t,r,i,a);if(n!==px)return n}if(i&&!a){let t=m3(i,r);if(void 0!==t)return t}let n={def:t,path:r.currentPath,jsonSchema:void 0};r.seen.set(t,n);let o=((t,r,a)=>{switch(r){case q.ZodString:return mG(t,a);case q.ZodNumber:let i={type:"number"};if(!t.checks)return i;for(let r of t.checks)switch(r.kind){case"int":i.type="integer",mz(i,"type",r.message,a);break;case"min":"jsonSchema7"===a.target?r.inclusive?mA(i,"minimum",r.value,r.message,a):mA(i,"exclusiveMinimum",r.value,r.message,a):(r.inclusive||(i.exclusiveMinimum=!0),mA(i,"minimum",r.value,r.message,a));break;case"max":"jsonSchema7"===a.target?r.inclusive?mA(i,"maximum",r.value,r.message,a):mA(i,"exclusiveMaximum",r.value,r.message,a):(r.inclusive||(i.exclusiveMaximum=!0),mA(i,"maximum",r.value,r.message,a));break;case"multipleOf":mA(i,"multipleOf",r.value,r.message,a)}return i;case q.ZodObject:return function(t,r){let a="openAi"===r.target,i={type:"object",properties:{}},n=[],o=t.shape();for(let t in o){let s=o[t];if(void 0===s||void 0===s._def)continue;let l=function(t){try{return t.isOptional()}catch{return!0}}(s);l&&a&&("ZodOptional"===s._def.typeName&&(s=s._def.innerType),s.isNullable()||(s=s.nullable()),l=!1);let c=m6(s._def,{...r,currentPath:[...r.currentPath,"properties",t],propertyPath:[...r.currentPath,"properties",t]});void 0!==c&&(i.properties[t]=c,l||n.push(t))}n.length&&(i.required=n);let s=function(t,r){if("ZodNever"!==t.catchall._def.typeName)return m6(t.catchall._def,{...r,currentPath:[...r.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return r.allowedAdditionalProperties;case"strict":return r.rejectedAdditionalProperties;case"strip":return"strict"===r.removeAdditionalStrategy?r.allowedAdditionalProperties:r.rejectedAdditionalProperties}}(t,r);return void 0!==s&&(i.additionalProperties=s),i}(t,a);case q.ZodBigInt:let n={type:"integer",format:"int64"};if(!t.checks)return n;for(let r of t.checks)switch(r.kind){case"min":"jsonSchema7"===a.target?r.inclusive?mA(n,"minimum",r.value,r.message,a):mA(n,"exclusiveMinimum",r.value,r.message,a):(r.inclusive||(n.exclusiveMinimum=!0),mA(n,"minimum",r.value,r.message,a));break;case"max":"jsonSchema7"===a.target?r.inclusive?mA(n,"maximum",r.value,r.message,a):mA(n,"exclusiveMaximum",r.value,r.message,a):(r.inclusive||(n.exclusiveMaximum=!0),mA(n,"maximum",r.value,r.message,a));break;case"multipleOf":mA(n,"multipleOf",r.value,r.message,a)}return n;case q.ZodBoolean:return{type:"boolean"};case q.ZodDate:return function t(r,a,i){let n=i??a.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((i,n)=>t(r,a,i))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":var o=r,s=a;let l={type:"integer",format:"unix-time"};if("openApi3"===s.target)return l;for(let t of o.checks)switch(t.kind){case"min":mA(l,"minimum",t.value,t.message,s);break;case"max":mA(l,"maximum",t.value,t.message,s)}return l}}(t,a);case q.ZodUndefined:return{not:mq(a)};case q.ZodNull:return"openApi3"===a.target?{enum:["null"],nullable:!0}:{type:"null"};case q.ZodArray:let o;return o={type:"array"},t.type?._def&&t.type?._def?.typeName!==q.ZodAny&&(o.items=m6(t.type._def,{...a,currentPath:[...a.currentPath,"items"]})),t.minLength&&mA(o,"minItems",t.minLength.value,t.minLength.message,a),t.maxLength&&mA(o,"maxItems",t.maxLength.value,t.maxLength.message,a),t.exactLength&&(mA(o,"minItems",t.exactLength.value,t.exactLength.message,a),mA(o,"maxItems",t.exactLength.value,t.exactLength.message,a)),o;case q.ZodUnion:case q.ZodDiscriminatedUnion:if("openApi3"===a.target)return m4(t,a);let s=t.options instanceof Map?Array.from(t.options.values()):t.options;if(s.every(t=>t._def.typeName in m9&&(!t._def.checks||!t._def.checks.length))){let t=s.reduce((t,r)=>{let a=m9[r._def.typeName];return a&&!t.includes(a)?[...t,a]:t},[]);return{type:t.length>1?t:t[0]}}if(s.every(t=>"ZodLiteral"===t._def.typeName&&!t.description)){let t=s.reduce((t,r)=>{let a=typeof r._def.value;switch(a){case"string":case"number":case"boolean":return[...t,a];case"bigint":return[...t,"integer"];case"object":if(null===r._def.value)return[...t,"null"];default:return t}},[]);if(t.length===s.length){let r=t.filter((t,r,a)=>a.indexOf(t)===r);return{type:r.length>1?r:r[0],enum:s.reduce((t,r)=>t.includes(r._def.value)?t:[...t,r._def.value],[])}}}else if(s.every(t=>"ZodEnum"===t._def.typeName))return{type:"string",enum:s.reduce((t,r)=>[...t,...r._def.values.filter(r=>!t.includes(r))],[])};return m4(t,a);case q.ZodIntersection:let l,c,u;return l=[m6(t.left._def,{...a,currentPath:[...a.currentPath,"allOf","0"]}),m6(t.right._def,{...a,currentPath:[...a.currentPath,"allOf","1"]})].filter(t=>!!t),c="jsonSchema2019-09"===a.target?{unevaluatedProperties:!1}:void 0,u=[],l.forEach(t=>{if((!("type"in t)||"string"!==t.type)&&"allOf"in t)u.push(...t.allOf),void 0===t.unevaluatedProperties&&(c=void 0);else{let r=t;if("additionalProperties"in t&&!1===t.additionalProperties){let{additionalProperties:a,...i}=t;r=i}else c=void 0;u.push(r)}}),u.length?{allOf:u,...c}:void 0;case q.ZodTuple:return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((t,r)=>m6(t._def,{...a,currentPath:[...a.currentPath,"items",`${r}`]})).reduce((t,r)=>void 0===r?t:[...t,r],[]),additionalItems:m6(t.rest._def,{...a,currentPath:[...a.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((t,r)=>m6(t._def,{...a,currentPath:[...a.currentPath,"items",`${r}`]})).reduce((t,r)=>void 0===r?t:[...t,r],[])};case q.ZodRecord:return m2(t,a);case q.ZodLiteral:let d;return"bigint"!=(d=typeof t.value)&&"number"!==d&&"boolean"!==d&&"string"!==d?{type:Array.isArray(t.value)?"array":"object"}:"openApi3"===a.target?{type:"bigint"===d?"integer":d,enum:[t.value]}:{type:"bigint"===d?"integer":d,const:t.value};case q.ZodEnum:return{type:"string",enum:Array.from(t.values)};case q.ZodNativeEnum:let p,m,h;return p=t.values,{type:1===(h=Array.from(new Set((m=Object.keys(t.values).filter(t=>"number"!=typeof p[p[t]]).map(t=>p[t])).map(t=>typeof t)))).length?"string"===h[0]?"string":"number":["string","number"],enum:m};case q.ZodNullable:if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return"openApi3"===a.target?{type:m9[t.innerType._def.typeName],nullable:!0}:{type:[m9[t.innerType._def.typeName],"null"]};if("openApi3"===a.target){let r=m6(t.innerType._def,{...a,currentPath:[...a.currentPath]});return r&&"$ref"in r?{allOf:[r],nullable:!0}:r&&{...r,nullable:!0}}let f=m6(t.innerType._def,{...a,currentPath:[...a.currentPath,"anyOf","0"]});return f&&{anyOf:[f,{type:"null"}]};case q.ZodOptional:if(a.currentPath.toString()===a.propertyPath?.toString())return m6(t.innerType._def,a);let y=m6(t.innerType._def,{...a,currentPath:[...a.currentPath,"anyOf","1"]});return y?{anyOf:[{not:mq(a)},y]}:mq(a);case q.ZodMap:if("record"===a.mapStrategy)return m2(t,a);return{type:"array",maxItems:125,items:{type:"array",items:[m6(t.keyType._def,{...a,currentPath:[...a.currentPath,"items","items","0"]})||mq(a),m6(t.valueType._def,{...a,currentPath:[...a.currentPath,"items","items","1"]})||mq(a)],minItems:2,maxItems:2}};case q.ZodSet:let g;return g={type:"array",uniqueItems:!0,items:m6(t.valueType._def,{...a,currentPath:[...a.currentPath,"items"]})},t.minSize&&mA(g,"minItems",t.minSize.value,t.minSize.message,a),t.maxSize&&mA(g,"maxItems",t.maxSize.value,t.maxSize.message,a),g;case q.ZodLazy:return()=>t.getter()._def;case q.ZodPromise:return m6(t.type._def,a);case q.ZodNaN:case q.ZodNever:return"openAi"===a.target?void 0:{not:mq({...a,currentPath:[...a.currentPath,"not"]})};case q.ZodEffects:return"input"===a.effectStrategy?m6(t.schema._def,a):mq(a);case q.ZodAny:case q.ZodUnknown:return mq(a);case q.ZodDefault:return{...m6(t.innerType._def,a),default:t.defaultValue()};case q.ZodBranded:return mM(t,a);case q.ZodReadonly:case q.ZodCatch:return m6(t.innerType._def,a);case q.ZodPipeline:if("input"===a.pipeStrategy)return m6(t.in._def,a);if("output"===a.pipeStrategy)return m6(t.out._def,a);let v=m6(t.in._def,{...a,currentPath:[...a.currentPath,"allOf","0"]}),_=m6(t.out._def,{...a,currentPath:[...a.currentPath,"allOf",v?"1":"0"]});return{allOf:[v,_].filter(t=>void 0!==t)};case q.ZodFunction:case q.ZodVoid:case q.ZodSymbol:default:return}})(t,t.typeName,r),s="function"==typeof o?m6(o(),r):o;if(s&&m5(t,r,s),r.postProcess){let a=r.postProcess(s,t,r);return n.jsonSchema=s,a}return n.jsonSchema=s,s}let m3=(t,r)=>{switch(r.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:mI(r.currentPath,t.path)};case"none":case"seen":if(t.path.length<r.currentPath.length&&t.path.every((t,a)=>r.currentPath[a]===t))return console.warn(`Recursive reference detected at ${r.currentPath.join("/")}! Defaulting to any`),mq(r);return"seen"===r.$refStrategy?mq(r):void 0}},m5=(t,r,a)=>(t.description&&(a.description=t.description,r.markdownDescription&&(a.markdownDescription=t.description)),a);Symbol("ZodOutput"),Symbol("ZodInput");(z=globalThis).__zod_globalRegistry??(z.__zod_globalRegistry=new class t{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let a=r[0];return this._map.set(t,a),a&&"object"==typeof a&&"id"in a&&this._idmap.set(a.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&"object"==typeof r&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let a={...this.get(r)??{}};delete a.id;let i={...a,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}});let m8=globalThis.__zod_globalRegistry;function m7(t){let r=t?.target??"draft-2020-12";return"draft-4"===r&&(r="draft-04"),"draft-7"===r&&(r="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??m8,target:r,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0}}function he(t,r,a={path:[],schemaPath:[]}){var i;let n=t._zod.def,o=r.seen.get(t);if(o)return o.count++,a.schemaPath.includes(t)&&(o.cycle=a.path),o.schema;let s={schema:{},count:1,cycle:void 0,path:a.path};r.seen.set(t,s);let l=t._zod.toJSONSchema?.();if(l)s.schema=l;else{let i={...a,schemaPath:[...a.schemaPath,t],path:a.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(r,s.schema,i);else{let a=s.schema,o=r.processors[n.type];if(!o)throw Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);o(t,r,a,i)}let o=t._zod.parent;o&&(s.ref||(s.ref=o),he(o,r,i),r.seen.get(o).isParent=!0)}let c=r.metadataRegistry.get(t);return c&&Object.assign(s.schema,c),"input"===r.io&&function t(r,a){let i=a??{seen:new Set};if(i.seen.has(r))return!1;i.seen.add(r);let n=r._zod.def;if("transform"===n.type)return!0;if("array"===n.type)return t(n.element,i);if("set"===n.type)return t(n.valueType,i);if("lazy"===n.type)return t(n.getter(),i);if("promise"===n.type||"optional"===n.type||"nonoptional"===n.type||"nullable"===n.type||"readonly"===n.type||"default"===n.type||"prefault"===n.type)return t(n.innerType,i);if("intersection"===n.type)return t(n.left,i)||t(n.right,i);if("record"===n.type||"map"===n.type)return t(n.keyType,i)||t(n.valueType,i);if("pipe"===n.type)return!!r._zod.traits.has("$ZodCodec")||t(n.in,i)||t(n.out,i);if("object"===n.type){for(let r in n.shape)if(t(n.shape[r],i))return!0;return!1}if("union"===n.type){for(let r of n.options)if(t(r,i))return!0;return!1}if("tuple"===n.type){for(let r of n.items)if(t(r,i))return!0;if(n.rest&&t(n.rest,i))return!0}return!1}(t)&&(delete s.schema.examples,delete s.schema.default),"input"===r.io&&"_prefault"in s.schema&&((i=s.schema).default??(i.default=s.schema._prefault)),delete s.schema._prefault,r.seen.get(t).schema}function ht(t,r){let a=t.seen.get(r);if(!a)throw Error("Unprocessed schema. This is a bug in Zod.");let i=new Map;for(let r of t.seen.entries()){let a=t.metadataRegistry.get(r[0])?.id;if(a){let t=i.get(a);if(t&&t!==r[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(a,r[0])}}let n=r=>{if(r[1].schema.$ref)return;let i=r[1],{ref:n,defId:o}=(r=>{let i="draft-2020-12"===t.target?"$defs":"definitions";if(t.external){let a=t.external.registry.get(r[0])?.id,n=t.external.uri??(t=>t);if(a)return{ref:n(a)};let o=r[1].defId??r[1].schema.id??`schema${t.counter++}`;return r[1].defId=o,{defId:o,ref:`${n("__shared")}#/${i}/${o}`}}if(r[1]===a)return{ref:"#"};let n=`#/${i}/`,o=r[1].schema.id??`__schema${t.counter++}`;return{defId:o,ref:n+o}})(r);i.def={...i.schema},o&&(i.defId=o);let s=i.schema;for(let t in s)delete s[t];s.$ref=n};if("throw"===t.cycles)for(let r of t.seen.entries()){let t=r[1];if(t.cycle)throw Error(`Cycle detected: #/${t.cycle?.join("/")}/<root>
|
|
66
|
-
|
|
67
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of t.seen.entries()){let i=a[1];if(r===a[0]){n(a);continue}if(t.external){let i=t.external.registry.get(a[0])?.id;if(r!==a[0]&&i){n(a);continue}}if(t.metadataRegistry.get(a[0])?.id||i.cycle||i.count>1&&"ref"===t.reused){n(a);continue}}}function hr(t,r){let a=t.seen.get(r);if(!a)throw Error("Unprocessed schema. This is a bug in Zod.");let i=r=>{let a=t.seen.get(r);if(null===a.ref)return;let n=a.def??a.schema,o={...n},s=a.ref;if(a.ref=null,s){i(s);let a=t.seen.get(s),l=a.schema;if(l.$ref&&("draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target)?(n.allOf=n.allOf??[],n.allOf.push(l)):Object.assign(n,l),Object.assign(n,o),r._zod.parent===s)for(let t in n)"$ref"!==t&&"allOf"!==t&&(t in o||delete n[t]);if(l.$ref&&a.def)for(let t in n)"$ref"!==t&&"allOf"!==t&&t in a.def&&JSON.stringify(n[t])===JSON.stringify(a.def[t])&&delete n[t]}let l=r._zod.parent;if(l&&l!==s){i(l);let r=t.seen.get(l);if(r?.schema.$ref&&(n.$ref=r.schema.$ref,r.def))for(let t in n)"$ref"!==t&&"allOf"!==t&&t in r.def&&JSON.stringify(n[t])===JSON.stringify(r.def[t])&&delete n[t]}t.override({zodSchema:r,jsonSchema:n,path:a.path??[]})};for(let r of[...t.seen.entries()].reverse())i(r[0]);let n={};if("draft-2020-12"===t.target?n.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===t.target?n.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===t.target?n.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let a=t.external.registry.get(r)?.id;if(!a)throw Error("Schema is missing an `id` property");n.$id=t.external.uri(a)}Object.assign(n,a.def??a.schema);let o=t.metadataRegistry.get(r)?.id;void 0!==o&&n.id===o&&delete n.id;let s=t.external?.defs??{};for(let r of t.seen.entries()){let t=r[1];t.def&&t.defId&&(t.def.id===t.defId&&delete t.def.id,s[t.defId]=t.def)}t.external||Object.keys(s).length>0&&("draft-2020-12"===t.target?n.$defs=s:n.definitions=s);try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...r["~standard"],jsonSchema:{input:ha(r,"input",t.processors),output:ha(r,"output",t.processors)}},enumerable:!1,writable:!1}),a}catch(t){throw Error("Error converting schema to JSON.")}}let ha=(t,r,a={})=>i=>{let{libraryOptions:n,target:o}=i??{},s=m7({...n??{},target:o,io:r,processors:a});return he(t,s),ht(s,t),hr(s,t)},hi={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},hn={string:(t,r,a,i)=>{a.type="string";let{minimum:n,maximum:o,format:s,patterns:l,contentEncoding:c}=t._zod.bag;if("number"==typeof n&&(a.minLength=n),"number"==typeof o&&(a.maxLength=o),s&&(a.format=hi[s]??s,""===a.format&&delete a.format,"time"===s&&delete a.format),c&&(a.contentEncoding=c),l&&l.size>0){let t=[...l];1===t.length?a.pattern=t[0].source:t.length>1&&(a.allOf=[...t.map(t=>({..."draft-07"===r.target||"draft-04"===r.target||"openapi-3.0"===r.target?{type:"string"}:{},pattern:t.source}))])}},number:(t,r,a,i)=>{let{minimum:n,maximum:o,format:s,multipleOf:l,exclusiveMaximum:c,exclusiveMinimum:u}=t._zod.bag;"string"==typeof s&&s.includes("int")?a.type="integer":a.type="number";let d="number"==typeof u&&u>=(n??-1/0),p="number"==typeof c&&c<=(o??1/0),m="draft-04"===r.target||"openapi-3.0"===r.target;d?m?(a.minimum=u,a.exclusiveMinimum=!0):a.exclusiveMinimum=u:"number"==typeof n&&(a.minimum=n),p?m?(a.maximum=c,a.exclusiveMaximum=!0):a.exclusiveMaximum=c:"number"==typeof o&&(a.maximum=o),"number"==typeof l&&(a.multipleOf=l)},boolean:(t,r,a,i)=>{a.type="boolean"},bigint:(t,r,a,i)=>{if("throw"===r.unrepresentable)throw Error("BigInt cannot be represented in JSON Schema")},symbol:(t,r,a,i)=>{if("throw"===r.unrepresentable)throw Error("Symbols cannot be represented in JSON Schema")},null:(t,r,a,i)=>{"openapi-3.0"===r.target?(a.type="string",a.nullable=!0,a.enum=[null]):a.type="null"},undefined:(t,r,a,i)=>{if("throw"===r.unrepresentable)throw Error("Undefined cannot be represented in JSON Schema")},void:(t,r,a,i)=>{if("throw"===r.unrepresentable)throw Error("Void cannot be represented in JSON Schema")},never:(t,r,a,i)=>{a.not={}},any:(t,r,a,i)=>{},unknown:(t,r,a,i)=>{},date:(t,r,a,i)=>{if("throw"===r.unrepresentable)throw Error("Date cannot be represented in JSON Schema")},enum:(t,r,a,i)=>{var n;let o,s=(o=Object.values(n=t._zod.def.entries).filter(t=>"number"==typeof t),Object.entries(n).filter(([t,r])=>-1===o.indexOf(+t)).map(([t,r])=>r));s.every(t=>"number"==typeof t)&&(a.type="number"),s.every(t=>"string"==typeof t)&&(a.type="string"),a.enum=s},literal:(t,r,a,i)=>{let n=t._zod.def,o=[];for(let t of n.values)if(void 0===t){if("throw"===r.unrepresentable)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof t)if("throw"===r.unrepresentable)throw Error("BigInt literals cannot be represented in JSON Schema");else o.push(Number(t));else o.push(t);if(0===o.length);else if(1===o.length){let t=o[0];a.type=null===t?"null":typeof t,"draft-04"===r.target||"openapi-3.0"===r.target?a.enum=[t]:a.const=t}else o.every(t=>"number"==typeof t)&&(a.type="number"),o.every(t=>"string"==typeof t)&&(a.type="string"),o.every(t=>"boolean"==typeof t)&&(a.type="boolean"),o.every(t=>null===t)&&(a.type="null"),a.enum=o},nan:(t,r,a,i)=>{if("throw"===r.unrepresentable)throw Error("NaN cannot be represented in JSON Schema")},template_literal:(t,r,a,i)=>{let n=t._zod.pattern;if(!n)throw Error("Pattern not found in template literal");a.type="string",a.pattern=n.source},file:(t,r,a,i)=>{let n={type:"string",format:"binary",contentEncoding:"binary"},{minimum:o,maximum:s,mime:l}=t._zod.bag;void 0!==o&&(n.minLength=o),void 0!==s&&(n.maxLength=s),l?1===l.length?(n.contentMediaType=l[0],Object.assign(a,n)):(Object.assign(a,n),a.anyOf=l.map(t=>({contentMediaType:t}))):Object.assign(a,n)},success:(t,r,a,i)=>{a.type="boolean"},custom:(t,r,a,i)=>{if("throw"===r.unrepresentable)throw Error("Custom types cannot be represented in JSON Schema")},function:(t,r,a,i)=>{if("throw"===r.unrepresentable)throw Error("Function types cannot be represented in JSON Schema")},transform:(t,r,a,i)=>{if("throw"===r.unrepresentable)throw Error("Transforms cannot be represented in JSON Schema")},map:(t,r,a,i)=>{if("throw"===r.unrepresentable)throw Error("Map cannot be represented in JSON Schema")},set:(t,r,a,i)=>{if("throw"===r.unrepresentable)throw Error("Set cannot be represented in JSON Schema")},array:(t,r,a,i)=>{let n=t._zod.def,{minimum:o,maximum:s}=t._zod.bag;"number"==typeof o&&(a.minItems=o),"number"==typeof s&&(a.maxItems=s),a.type="array",a.items=he(n.element,r,{...i,path:[...i.path,"items"]})},object:(t,r,a,i)=>{let n=t._zod.def;a.type="object",a.properties={};let o=n.shape;for(let t in o)a.properties[t]=he(o[t],r,{...i,path:[...i.path,"properties",t]});let s=new Set([...new Set(Object.keys(o))].filter(t=>{let a=n.shape[t]._zod;return"input"===r.io?void 0===a.optin:void 0===a.optout}));s.size>0&&(a.required=Array.from(s)),n.catchall?._zod.def.type==="never"?a.additionalProperties=!1:n.catchall?n.catchall&&(a.additionalProperties=he(n.catchall,r,{...i,path:[...i.path,"additionalProperties"]})):"output"===r.io&&(a.additionalProperties=!1)},union:(t,r,a,i)=>{let n=t._zod.def,o=!1===n.inclusive,s=n.options.map((t,a)=>he(t,r,{...i,path:[...i.path,o?"oneOf":"anyOf",a]}));o?a.oneOf=s:a.anyOf=s},intersection:(t,r,a,i)=>{let n=t._zod.def,o=he(n.left,r,{...i,path:[...i.path,"allOf",0]}),s=he(n.right,r,{...i,path:[...i.path,"allOf",1]}),l=t=>"allOf"in t&&1===Object.keys(t).length;a.allOf=[...l(o)?o.allOf:[o],...l(s)?s.allOf:[s]]},tuple:(t,r,a,i)=>{let n=t._zod.def;a.type="array";let o="draft-2020-12"===r.target?"prefixItems":"items",s="draft-2020-12"===r.target||"openapi-3.0"===r.target?"items":"additionalItems",l=n.items.map((t,a)=>he(t,r,{...i,path:[...i.path,o,a]})),c=n.rest?he(n.rest,r,{...i,path:[...i.path,s,..."openapi-3.0"===r.target?[n.items.length]:[]]}):null;"draft-2020-12"===r.target?(a.prefixItems=l,c&&(a.items=c)):"openapi-3.0"===r.target?(a.items={anyOf:l},c&&a.items.anyOf.push(c),a.minItems=l.length,c||(a.maxItems=l.length)):(a.items=l,c&&(a.additionalItems=c));let{minimum:u,maximum:d}=t._zod.bag;"number"==typeof u&&(a.minItems=u),"number"==typeof d&&(a.maxItems=d)},record:(t,r,a,i)=>{let n=t._zod.def;a.type="object";let o=n.keyType,s=o._zod.bag,l=s?.patterns;if("loose"===n.mode&&l&&l.size>0){let t=he(n.valueType,r,{...i,path:[...i.path,"patternProperties","*"]});for(let r of(a.patternProperties={},l))a.patternProperties[r.source]=t}else("draft-07"===r.target||"draft-2020-12"===r.target)&&(a.propertyNames=he(n.keyType,r,{...i,path:[...i.path,"propertyNames"]})),a.additionalProperties=he(n.valueType,r,{...i,path:[...i.path,"additionalProperties"]});let c=o._zod.values;if(c){let t=[...c].filter(t=>"string"==typeof t||"number"==typeof t);t.length>0&&(a.required=t)}},nullable:(t,r,a,i)=>{let n=t._zod.def,o=he(n.innerType,r,i),s=r.seen.get(t);"openapi-3.0"===r.target?(s.ref=n.innerType,a.nullable=!0):a.anyOf=[o,{type:"null"}]},nonoptional:(t,r,a,i)=>{let n=t._zod.def;he(n.innerType,r,i),r.seen.get(t).ref=n.innerType},default:(t,r,a,i)=>{let n=t._zod.def;he(n.innerType,r,i),r.seen.get(t).ref=n.innerType,a.default=JSON.parse(JSON.stringify(n.defaultValue))},prefault:(t,r,a,i)=>{let n=t._zod.def;he(n.innerType,r,i),r.seen.get(t).ref=n.innerType,"input"===r.io&&(a._prefault=JSON.parse(JSON.stringify(n.defaultValue)))},catch:(t,r,a,i)=>{let n,o=t._zod.def;he(o.innerType,r,i),r.seen.get(t).ref=o.innerType;try{n=o.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}a.default=n},pipe:(t,r,a,i)=>{let n=t._zod.def,o=n.in._zod.traits.has("$ZodTransform"),s="input"===r.io?o?n.out:n.in:n.out;he(s,r,i),r.seen.get(t).ref=s},readonly:(t,r,a,i)=>{let n=t._zod.def;he(n.innerType,r,i),r.seen.get(t).ref=n.innerType,a.readOnly=!0},promise:(t,r,a,i)=>{let n=t._zod.def;he(n.innerType,r,i),r.seen.get(t).ref=n.innerType},optional:(t,r,a,i)=>{let n=t._zod.def;he(n.innerType,r,i),r.seen.get(t).ref=n.innerType},lazy:(t,r,a,i)=>{let n=t._zod.innerType;he(n,r,i),r.seen.get(t).ref=n}};function ho(t,r={}){let{strict:a=!1}=r,i=Object.entries(t),n=t=>({target:r})=>{let n={},o=[];for(let[a,s]of i)n[a]=function(t,r,a){let i=t["~standard"];if(i.jsonSchema)return i.jsonSchema[a]({target:r});if("zod"===t["~standard"].vendor&&!("_zod"in t)&&"_def"in t){let a=((t,r)=>{let a,i,n=(i=void 0!==(a="string"==typeof r?{...pR,name:r}:{...pR,...r}).name?[...a.basePath,a.definitionPath,a.name]:a.basePath,{...a,flags:{hasReferencedOpenAiAnyType:!1},currentPath:i,propertyPath:void 0,seen:new Map(Object.entries(a.definitions).map(([t,r])=>[r._def,{def:r._def,path:[...a.basePath,a.definitionPath,t],jsonSchema:void 0}]))}),o="object"==typeof r&&r.definitions?Object.entries(r.definitions).reduce((t,[r,a])=>({...t,[r]:m6(a._def,{...n,currentPath:[...n.basePath,n.definitionPath,r]},!0)??mq(n)}),{}):void 0,s="string"==typeof r?r:r?.nameStrategy==="title"?void 0:r?.name,l=m6(t._def,void 0===s?n:{...n,currentPath:[...n.basePath,n.definitionPath,s]},!1)??mq(n),c="object"==typeof r&&void 0!==r.name&&"title"===r.nameStrategy?r.name:void 0;void 0!==c&&(l.title=c),n.flags.hasReferencedOpenAiAnyType&&(o||(o={}),o[n.openAiAnyTypeName]||(o[n.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===n.$refStrategy?"1":[...n.basePath,n.definitionPath,n.openAiAnyTypeName].join("/")}}));let u=void 0===s?o?{...l,[n.definitionPath]:o}:l:{$ref:[..."relative"===n.$refStrategy?[]:n.basePath,n.definitionPath,s].join("/"),[n.definitionPath]:{...o,[s]:l}};return"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})(t,{$refStrategy:"none",target:"openapi-3.0"===r?"openApi3":"jsonSchema7"});return delete a.$schema,a}if("zod"===i.vendor&&"_zod"in t)try{let r=function(t,r){if("_idmap"in t){let r=m7({...void 0,processors:hn}),a={};for(let a of t._idmap.entries()){let[t,i]=a;he(i,r)}let i={};for(let n of(r.external={registry:t,uri:void 0,defs:a},t._idmap.entries())){let[t,a]=n;ht(r,a),i[t]=hr(r,a)}return Object.keys(a).length>0&&(i.__shared={["draft-2020-12"===r.target?"$defs":"definitions"]:a}),{schemas:i}}let a=m7({...void 0,processors:hn});return he(t,a),ht(a,t),hr(a,t)}(t);return delete r.$schema,r}catch(t){throw Error(`Failed to convert a zod schema to JSON Schema (zod v4 without "~standard.jsonSchema"). Upgrade to zod >= 4.2.0. Original error: ${t instanceof Error?t.message:String(t)}`)}throw Error(`Schema library "${i.vendor}" cannot be converted to JSON Schema. Use zod v3 (>= 3.25.76), zod >= 4.2.0, or a Standard Schema library implementing "~standard.jsonSchema".`)}(s,r,t),!function(t,r){if("function"!=typeof t.safeParse)return!1;try{let a=t.safeParse(void 0);return a.success&&("input"===r||void 0===a.data)}catch{return!1}}(s,t)&&o.push(a);let s={type:"object",properties:n};return o.length>0&&(s.required=o),a&&(s.additionalProperties=!1),s},o=async r=>{if("object"!=typeof r||null===r||Array.isArray(r))return{issues:[{message:"Expected an object."}]};let n={},o=[];for(let[t,a]of i){let i=await a["~standard"].validate(r[t]);if(i.issues)for(let r of i.issues)o.push({message:r.message,path:[t,...r.path??[]]});else(t in r||void 0!==i.value)&&(n[t]=i.value)}if(a)for(let a of Object.keys(r))a in t||o.push({message:`Unrecognized key: "${a}"`,path:[a]});return o.length>0?{issues:o}:{value:n}};return{shape:t,"~standard":{version:1,vendor:"xmcp",validate:o,jsonSchema:{input:n("input"),output:n("output")}}}}let hs=require("async_hooks"),hl=(t,r)=>{globalThis[t]=r},hc=t=>globalThis[t];function hu({name:t,fallback:r=!0}){let a=Symbol.for(`xmcp-context-${t}`),i=Symbol.for(`xmcp-context-${t}-fallback-store`);if(hc(a))return hc(a);let n=new hs.AsyncLocalStorage,o=globalThis[i]??{current:null};hl(i,o);let s={provider:(t,a)=>(r&&(o.current=t),n.run(t,a)),getContext:()=>{let a=n.getStore();if(a)return a;if(r&&o.current)return o.current;throw Error(`getContext() can only be used within the ${t} context.`)},setContext:a=>{let i=n.getStore()??(r?o.current:null);if(!i)throw Error(`setContext() can only be used within the ${t} context.`);Object.assign(i,a)}};return hl(a,s),s}let hd=hu({name:"http-request-context"});hd.setContext;let hp=hd.getContext;hd.provider;let hm=hu({name:"client-info-context"}),hh=hm.setContext,hf=hm.getContext,hy=hm.provider,hg=t=>{if(!("object"==typeof t&&null!==t&&!Array.isArray(t))||"string"!=typeof t.name||"string"!=typeof t.version)return;let r={name:t.name,version:t.version};return"string"==typeof t.title&&(r.title=t.title),"string"==typeof t.websiteUrl&&(r.websiteUrl=t.websiteUrl),"string"==typeof t.description&&(r.description=t.description),r},hv=(t,r)=>{let a=r.toLowerCase();for(let[r,i]of Object.entries(t)){if(r.toLowerCase()!==a)continue;let t=Array.isArray(i)?i[0]:i;if("string"!=typeof t)break;let n=t.trim();return n.length>0?n:void 0}},h_=new Set(["message","mode","requestedSchema"]),hb=new Set(["elicitationId","message","mode","url"]),hS=new Set(["properties","required","type"]),h$=new Set(["default","description","format","maxLength","minLength","title","type"]),hw=new Set(["default","description","enum","enumNames","title","type"]),hk=new Set(["default","description","title","type"]),hx=new Set(["default","description","maximum","minimum","title","type"]),hR=new Set(["date","date-time","email","uri"]);async function hP(t,r,a){let i=function(t){let r=t.mode??"form";if("url"===r)return function(t){let r;hO(t,"Elicitation request must be a plain object."),hE(t,hb,"URL elicitation"),hT(t.message,"URL elicitation requires a string message."),hj(t.elicitationId,"URL elicitation requires a non-empty elicitationId."),hj(t.url,"URL elicitation requires a non-empty URL.");try{r=new URL(t.url)}catch{throw Error("URL elicitation requires a valid http or https URL.")}if("http:"!==r.protocol&&"https:"!==r.protocol)throw Error("URL elicitation requires a valid http or https URL.")}(t),t;if("form"!==r)throw Error(`Unsupported elicitation mode "${String(t.mode)}". Expected "form" or "url".`);return function(t){hO(t,"Elicitation request must be a plain object."),hE(t,h_,"Form elicitation"),hT(t.message,"Form elicitation requires a string message.");let r=t.requestedSchema;if(hO(r,"Form elicitation requires a flat object schema."),hE(r,hS,"Form elicitation schema"),"object"!==r.type)throw Error('Form elicitation schema must use type "object".');for(let[t,a]of(hO(r.properties,"Form elicitation schema requires a properties object."),Object.entries(r.properties)))!function(t,r){if(hO(r,`Form elicitation field "${t}" must be a plain object.`),hN(r.title,`Form elicitation field "${t}" title must be a string.`),hN(r.description,`Form elicitation field "${t}" description must be a string.`),"string"===r.type&&"enum"in r){var a,i;if(hE(r,hw,`Form elicitation field "${t}"`),hI(r.enum,`Form elicitation field "${t}" enum values must be strings.`),a=r.enumNames,i=`Form elicitation field "${t}" enumNames must be strings.`,void 0!==a&&hI(a,i),void 0!==r.enumNames&&r.enumNames.length!==r.enum.length)throw Error(`Form elicitation field "${t}" enumNames length must match enum length.`);if(hN(r.default,`Form elicitation field "${t}" default must be a string.`),void 0!==r.default&&!r.enum.includes(r.default))throw Error(`Form elicitation field "${t}" default must be one of its enum values.`);return}if("string"===r.type&&!("enum"in r)){hE(r,h$,`Form elicitation field "${t}"`),hC(r.minLength,`Form elicitation field "${t}" minLength must be a number.`),hC(r.maxLength,`Form elicitation field "${t}" maxLength must be a number.`),hN(r.default,`Form elicitation field "${t}" default must be a string.`);let a=r.format;if(hN(a,`Form elicitation field "${t}" format must be a string.`),void 0!==a&&!hR.has(a))throw Error(`Form elicitation field "${t}" format must be one of: ${Array.from(hR).join(", ")}.`);return}if("boolean"===r.type){if(hE(r,hk,`Form elicitation field "${t}"`),void 0!==r.default&&"boolean"!=typeof r.default)throw Error(`Form elicitation field "${t}" default must be a boolean.`);return}if("number"===r.type||"integer"===r.type){hE(r,hx,`Form elicitation field "${t}"`),hC(r.minimum,`Form elicitation field "${t}" minimum must be a number.`),hC(r.maximum,`Form elicitation field "${t}" maximum must be a number.`),hC(r.default,`Form elicitation field "${t}" default must be a number.`);return}throw Error(`Form elicitation field "${t}" uses unsupported type "${String(r.type)}". Supported types are string, boolean, number, integer, and string enums.`)}(t,a);if(void 0!==r.required){if(!Array.isArray(r.required)||r.required.some(t=>"string"!=typeof t))throw Error("Form elicitation schema required fields must be a string array.");for(let t of r.required)if(!(t in r.properties))throw Error(`Form elicitation schema required field "${t}" is not defined in properties.`)}}(t),{...t,mode:"form"}}(r);try{let r=await t.mcpReq.elicitInput(i,a);return{...r,content:r.content??void 0}}catch(t){if(t instanceof lZ&&t.code===lD.MethodNotSupportedByProtocolVersion)throw Error("extra.elicit() is not available on protocol revision 2026-07-28: server-initiated elicitation was replaced by multi round-trip requests. Return inputRequired({ ... }) from the tool handler instead (re-exported from xmcp); the client fulfils the embedded requests and retries the tool call.");throw t}}function hE(t,r,a){let i=Object.keys(t).filter(t=>!r.has(t));if(0!==i.length)throw Error(`${a} includes unsupported key(s): ${i.join(", ")}.`)}function hO(t,r){if("object"!=typeof t||null===t||Array.isArray(t))throw Error(r)}function hT(t,r){if("string"!=typeof t)throw Error(r)}function hj(t,r){if("string"!=typeof t||0===t.trim().length)throw Error(r)}function hN(t,r){if(void 0!==t&&"string"!=typeof t)throw Error(r)}function hC(t,r){if(void 0!==t&&"number"!=typeof t)throw Error(r)}function hI(t,r){if(!Array.isArray(t)||t.some(t=>"string"!=typeof t))throw Error(r)}let hq=new Set(["_meta","includeContext","maxTokens","messages","metadata","modelPreferences","stopSequences","systemPrompt","temperature"]),hz=new Set(["task","toolChoice","tools"]),hA=new Set(["text","image","audio"]);async function hM(t,r,a){let i=function(t){hL(t,"Sampling request must be a plain object.");let r=Object.keys(t),a=r.filter(t=>hz.has(t));if(a.length>0)throw Error(`Sampling request key(s) not supported by xmcp yet: ${a.join(", ")}.`);let i=r.filter(t=>!hq.has(t));if(i.length>0)throw Error(`Sampling request includes unsupported key(s): ${i.join(", ")}.`);if(!Array.isArray(t.messages)||0===t.messages.length)throw Error("Sampling requires at least one message.");for(let[r,a]of t.messages.entries())!function(t,r){if(hL(r,`Sampling message at index ${t} must be a plain object.`),"user"!==r.role&&"assistant"!==r.role)throw Error(`Sampling message at index ${t} requires role "user" or "assistant".`);let a=r.content;hL(a,`Sampling message at index ${t} requires a content object.`);let i=a.type;if("string"!=typeof i||!hA.has(i))throw Error(`Sampling message at index ${t} uses unsupported content type "${String(i)}". Supported types are text, image, and audio.`);if("text"===i&&"string"!=typeof a.text)throw Error(`Sampling message at index ${t} requires string text content.`);if(("image"===i||"audio"===i)&&("string"!=typeof a.data||"string"!=typeof a.mimeType))throw Error(`Sampling message at index ${t} requires base64 data and a mimeType.`)}(r,a);if("number"!=typeof t.maxTokens)throw Error("Sampling requires a numeric maxTokens.");return t}(r);try{return await t.mcpReq.requestSampling(i,a)}catch(t){if(t instanceof lZ&&t.code===lD.MethodNotSupportedByProtocolVersion)throw Error("extra.sample() is not available on protocol revision 2026-07-28: server-initiated sampling was replaced by multi round-trip requests. Return inputRequired({ ... }) with inputRequired.createMessage(...) from the tool handler instead (re-exported from xmcp); the client fulfils the embedded requests and retries the tool call.");throw t}}function hL(t,r){if("object"!=typeof t||null===t||Array.isArray(t))throw Error(r)}let hD={text:t=>"string"!=typeof t.text?{valid:!1,error:'Text content must have a "text" property of type string'}:{valid:!0},image:t=>"string"!=typeof t.data?{valid:!1,error:'Image content must have a "data" property of type string (base64-encoded image)'}:"string"!=typeof t.mimeType?{valid:!1,error:'Image content must have a "mimeType" property of type string'}:{valid:!0},audio:t=>"string"!=typeof t.data?{valid:!1,error:'Audio content must have a "data" property of type string (base64-encoded audio)'}:"string"!=typeof t.mimeType?{valid:!1,error:'Audio content must have a "mimeType" property of type string'}:{valid:!0},resource_link:t=>"string"!=typeof t.name?{valid:!1,error:'Resource link content must have a "name" property of type string'}:"string"!=typeof t.uri?{valid:!1,error:'Resource link content must have a "uri" property of type string'}:void 0!==t.title&&"string"!=typeof t.title?{valid:!1,error:'Resource link "title" property must be a string if provided'}:void 0!==t.description&&"string"!=typeof t.description?{valid:!1,error:'Resource link "description" property must be a string if provided'}:void 0!==t.mimeType&&"string"!=typeof t.mimeType?{valid:!1,error:'Resource link "mimeType" property must be a string if provided'}:{valid:!0}};function hZ(t){if(!t||"object"!=typeof t)return{valid:!1,error:"Content must be an object"};if("string"!=typeof t.type)return{valid:!1,error:'Content must have a "type" property of type string'};if(void 0!==t._meta&&(null===t._meta||"object"!=typeof t._meta))return{valid:!1,error:'Content "_meta" property must be an object if provided'};let r=hD[t.type];return r?r(t):{valid:!0}}function hV(t,r,a,i){if(null===t||"object"!=typeof t||Array.isArray(t))throw Error(`Tool "${a}" ${i}: expected a plain object.`);let n=new Set(Object.keys(r)),o=Object.keys(t).filter(t=>!n.has(t));if(o.length>0)throw Error(`Tool "${a}" ${i}: unrecognized key(s): ${o.join(", ")}`);for(let[n,o]of Object.entries(r))try{o.parse(t[n])}catch(t){throw Error(`Tool "${a}" ${i}: ${t?.message??`invalid field "${n}"`}`)}}function hF(t){return!!(t&&"object"==typeof t&&Object.keys(t).some(t=>t.startsWith("ui/")))}function hU(t){let r=t.mcpReq.envelope,a=hg(r?.[nU]);if(!a)try{let t,r=hp();a=r.clientInfo??(t=r.headers,hg({name:hv(t,"x-mcp-client-name"),version:hv(t,"x-mcp-client-version"),title:hv(t,"x-mcp-client-title"),websiteUrl:hv(t,"x-mcp-client-website-url"),description:hv(t,"x-mcp-client-description")}))}catch{}if(!a)try{a=hf().clientInfo}catch{}return a}function hJ(t){return t.endsWith(".tsx")}let hH=new class{add(t,r){this.resources.set(t,r)}getAll(){return this.resources}clear(){this.resources.clear()}has(t){return this.resources.has(t)}constructor(){!function(t,r,a){r in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a}(this,"resources",new Map)}};function hK(t){let r={};return!function t(a,i=""){if(a&&"object"==typeof a)for(let[n,o]of Object.entries(a)){let a=i?`${i}/${n}`:n;!o||"object"!=typeof o||Array.isArray(o)||o instanceof Date||o instanceof RegExp?r[a]=o:t(o,a)}}(t),r}let hB=["ui/resourceUri","resourceUri","visibility"],hW=["prefersBorder","domain","csp","permissions","connectDomains","resourceDomains","frameDomains","baseUriDomains"],hG=hu({name:"request-context",fallback:!1});function hY(t){let r=[...t];return(t,a,i)=>(function(t,r,a){let i,n=new Map;if(t.http){let t=hp(),r=Object.fromEntries(Object.entries(t.headers).map(([t,r])=>[t,Array.isArray(r)?Object.freeze([...r]):r]));i=Object.freeze({id:t.id,headers:Object.freeze(r)})}return hG.provider(Object.freeze({clientInfo:r?Object.freeze({...r}):void 0,http:i,signal:t.mcpReq.signal,set(t,r){n.set(t,r)},get:t=>n.get(t),async progress(r,a){let i=t.mcpReq._meta?.progressToken;void 0!==i&&await t.mcpReq.notify({method:"notifications/progress",params:{progressToken:i,progress:r,...void 0===a?{}:{total:a}}})},log:(r,a)=>t.mcpReq.log(r,a)}),a)})(a,hU(a),async()=>{if(0===r.length)return i();let a=Object.freeze({...function(){try{return hG.getContext()}catch{throw Error("getRequestContext() can only be used while handling an MCP request.")}}(),method:t.method,params:Object.freeze({...t.params})}),n=-1,o=async t=>{if(t<=n)throw Error("MCP middleware next() can only be called once");n=t;let s=r[t];return s?s(a,()=>o(t+1)):i()};return o(0)})}let hX=new Set(["tools/list","prompts/get","prompts/list","resources/read","resources/list","resources/templates/list","completion/complete"]);function hQ(t){let{tags:r,enabled:a,...i}=t;return{...i,_meta:void 0===r?i._meta:{...i._meta,"xmcp/tags":r}}}function h0(t){return"object"==typeof t&&null!==t&&Object.entries(t).every(([t,r])=>"string"==typeof t&&"object"==typeof r&&null!==r&&"parse"in r&&"function"==typeof r.parse)}function h1(t){return(t.split("/").pop()||t).replace(/\.[^/.]+$/,"")}function h2(t,r,a){return t.names?.includes(r)===!0||t.tags?.some(t=>a.includes(t))===!0}function h9(t,r){return r?new Map([...t].filter(([t,{metadata:a}])=>{if(a?.enabled===!1)return!1;let i=a?.name??h1(t),n=a?.tags??[];return(!r.include||h2(r.include,i,n))&&(!r.exclude||!h2(r.exclude,i,n))})):t}function h4(t){return Error(`[xmcp] Invalid prompt file: ${t}
|
|
68
|
-
-> Default export must be a
|
|
69
|
-
-> ${a}`)});let n=a.length;t.warn(`[xmcp] ${n}
|
|
70
|
-
-> Default export must be a
|
|
71
|
-
-> ${a}`)});let n=a.length;t.warn(`[xmcp] ${n}
|
|
72
|
-
-> Default export must be a tool handler function.`)}async function fa(t){let r=new Map,a=[];for(let i of(await Promise.all(Object.entries(t).map(async([t,r])=>{let a=await r(),i=function(t,r){if("object"!=typeof t||null===t)throw fr(r);let a=Object.keys(t),i=t.default,n=a.filter(t=>"__esModule"!==t);if(0===a.length||1===n.length&&"default"===n[0]&&"object"==typeof i&&null!==i&&0===Object.keys(i).length)return"empty";if(!("default"in t)||void 0===t.default)return"missing-default";if("function"!=typeof t.default)throw fr(r);return"valid"}(a,t);return"empty"===i?{skipped:!0,issue:{path:t,message:"File is empty."}}:"missing-default"===i?{skipped:!0,issue:{path:t,message:"File does not export a default tool handler."}}:{skipped:!1,path:t,toolModule:a}})))){if(i.skipped){a.push(i.issue);continue}r.set(i.path,i.toolModule)}return{toolModules:r,skippedTools:a}}let fi=function(t=console){let r="";return a=>{let i=a.map(({path:t,message:r})=>`${t}:${r}`).sort().join("|");if(i===r||(r=i,0===a.length))return;a.forEach(({path:r,message:a})=>{t.warn(`[xmcp] Failed to load tool file: ${r}
|
|
73
|
-
-> ${a}`)});let n=a.length;t.warn(`[xmcp] ${n} tool${1===n?"":"s"} skipped due to empty files or missing default exports`)}}(),fn=INJECTED_TOOLS,fo=INJECTED_PROMPTS,fs=INJECTED_RESOURCES,fl=SERVER_INFO;async function fc(t,r,i,n){let o=await INJECTED_MIDDLEWARE?.(),s=function(t){if(void 0===t)return[];let r=Array.isArray(t)?[...t]:[t];if(!r.every(t=>"function"==typeof t))throw Error("src/middleware.ts must export mcp as a function or an array of functions");return r}(o?.mcp),l="undefined"!=typeof OBSERVABILITY_CONFIG&&OBSERVABILITY_CONFIG.enabled?function(t=t=>console.error(t)){let r=new Map,a=[];function i(r){try{t(JSON.stringify({"@timestamp":new Date().toISOString(),...r}))}catch{}}return{middleware:async(t,n)=>{let o,s,l;if("tools/call"!==t.method&&"prompts/get"!==t.method&&"resources/read"!==t.method)return n();try{s=performance.now(),o={log:{level:"info"},...function(t){let r=t.http?.headers.traceparent;if("string"!=typeof r)return{};let a=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(-.*)?$/.exec(r);return!a||"ff"===a[1]||/^0+$/.test(a[2])||/^0+$/.test(a[3])||"00"===a[1]&&void 0!==a[5]?{}:{trace:{id:a[2]},parent:{id:a[3]}}}(t),transaction:{id:crypto.randomUUID()},...t.http?{http:{request:{id:t.http.id}}}:{},xmcp:{method:t.method,component:"resources/read"===t.method?function(t){try{let i=new URL(t).href;return r.get(i)??a.find(({template:t})=>t.uriTemplate.match(i))?.name??"unknown"}catch{return"unknown"}}(t.params.uri):t.params.name}}}catch{return n()}i({...o,event:{kind:"event",category:["api"],type:["start"],action:"execution.start"}});let c="unknown";try{let r=await n();try{c=t.signal.aborted?"cancelled":cV(r)?"input_required":"isError"in r&&!0===r.isError?"failure":"success","failure"===c&&(l={message:"Operation returned an error result"})}catch{}return r}catch(r){throw l={message:"cancelled"==(c=t.signal.aborted?"cancelled":"failure")?"Operation cancelled":"Operation threw an exception"},r}finally{try{i({...o,log:{level:"failure"===c?"error":"info"},event:{kind:"event",category:["api"],type:["end"],action:"execution.end",duration:Math.round((performance.now()-s)*1e6),outcome:"success"===c?"success":"failure"===c?"failure":"unknown"},xmcp:{...o.xmcp,status:c},...l?{error:l}:{}})}catch{}}},registerResource(t,i){try{"string"==typeof i?r.set(new URL(i).href,t):a.push({name:t,template:i})}catch{}}}}():void 0;l&&s.unshift(l.middleware),hH.clear();let c="undefined"==typeof COMPONENTS_CONFIG?void 0:COMPONENTS_CONFIG;return!function(t,r,a){let i=t.server,n=i.setRequestHandler,o=hY(r);i.setRequestHandler=(t,...r)=>{if(hX.has(t)&&1===r.length&&"function"==typeof r[0]){let t=r[0];r[0]=(r,a)=>o({method:r.method,params:r.params??{}},a,()=>t(r,a))}Reflect.apply(n,i,[t,...r])};try{a()}finally{i.setRequestHandler=n}}(t,s,()=>{var o,u;!function(t,r,a=[]){r.forEach((r,i)=>{var n,o;let s,l,c,u={name:h1(i),description:"No description provided"},{default:d,metadata:p,schema:m,outputSchema:h}=r;if("object"==typeof p&&null!==p&&Object.assign(u,p),!1===u.enabled)return;if("function"==typeof d&&"__x402"in d){let t=global.__XMCP_X402_REGISTRY;t&&t.set(u.name,d.__x402)}let f={};if(h0(m)?f=m:null!=m&&console.warn(`Invalid schema for tool "${u.name}" at ${i}. Expected Record<string, z.ZodType>`),null!=h)if(h0(h))s=h;else throw Error(`Invalid outputSchema for tool "${u.name}" at ${i}. Expected Record<string, z.ZodType>`);u.annotations={...u.annotations??{}},void 0===u.annotations.title&&(u.annotations.title=u.name),u._meta={...hQ(u)._meta};let y=hJ(i),g=!!(n=u._meta)&&"object"==typeof n&&"ui"in n&&"object"==typeof n.ui||y,v=u._meta;if(g){let t=`ui://app/${u.name}.html`;u._meta.ui||(u._meta.ui={}),u._meta.ui.resourceUri||(u._meta.ui.resourceUri=t);let r=function(t){let r={},a={};if(t.ui&&"object"==typeof t.ui){let i=t.ui,n={},o={};for(let[t,r]of Object.entries(i))hB.includes(t)?n[t]=r:hW.includes(t)?o[t]=r:n[t]=r;Object.keys(n).length>0&&(r.ui=n),Object.keys(o).length>0&&(a.ui=o)}for(let[a,i]of Object.entries(t))"ui"!==a&&(r[a]=i);return{toolMeta:r,resourceMeta:a}}(v);v=r.toolMeta;let a=r.resourceMeta;a.ui=a.ui||{},a.ui.csp=a.ui.csp||{},a.ui.csp.resourceDomains=a.ui.csp.resourceDomains||[],a.ui.csp.resourceDomains.includes("https://esm.sh")||a.ui.csp.resourceDomains.push("https://esm.sh"),hH.add(u.name,{name:u.name,uri:t,handler:d,mimeType:"text/html;profile=mcp-app",_meta:a,toolPath:y?i:void 0})}let _=hK(v),b=g?_:void 0;l=hJ(i)&&g?async(t,r)=>({content:[{type:"text",text:""}],_meta:b,structuredContent:{args:t}}):function(t,r,a,i="unknown-tool"){return async(n,o)=>{let s,l,c=t(n,(s=hU(o),l=function(t){if(!t)return;let r={};return t.headers.forEach((t,a)=>{r[a]=t}),r}(o.http?.req),{signal:o.mcpReq.signal,authInfo:o.http?.authInfo,sessionId:o.sessionId,_meta:o.mcpReq._meta,requestId:o.mcpReq.id,requestInfo:l?{headers:l}:void 0,clientInfo:s,sendNotification:t=>o.mcpReq.notify(t),sendRequest:(t,r,a)=>o.mcpReq.send(t,r,a),elicit:(t,r)=>hP(o,t,r),sample:(t,r)=>hM(o,t,r),inputResponses:o.mcpReq.inputResponses,requestState:o.mcpReq.requestState}));if(c instanceof Promise&&(c=await c),cV(c))return c;if("string"==typeof c||"number"==typeof c){if(a){let t=Object.entries(a);if(1===t.length){let[r,a]=t[0];try{return a.parse(c),{content:[{type:"text",text:"number"==typeof c?`${c}`:c}],structuredContent:{[r]:c}}}catch{}}}return hF(r)?{content:[{type:"text",text:""}],structuredContent:{args:n},_meta:r}:{content:[{type:"text",text:"number"==typeof c?`${c}`:c}]}}if(!a||!c||"object"!=typeof c||Array.isArray(c)||"structuredContent"in c||"content"in c&&Array.isArray(c.content)||"_meta"in c||"isError"in c||(hV(c,a,i,"returned data that does not match outputSchema"),c={structuredContent:c}),c&&"object"==typeof c&&"_meta"in c&&!("content"in c)&&!("structuredContent"in c)){let t=c._meta;if(hF(t))return{content:[{type:"text",text:""}],_meta:t}}if(!c||"object"!=typeof c){let t=null===c?"null":typeof c,r=void 0===c?"undefined":null===c?"null":"object"==typeof c?JSON.stringify(c,null,2):String(c);throw Error(`Tool handler must return a CallToolResult, string, or number. Got ${t}: ${r}
|
|
65
|
+
]`;continue}n+=i[t],"\\"===i[t]?o=!0:s&&"]"===i[t]?s=!1:s||"["!==i[t]||(s=!0)}try{new RegExp(n)}catch{return console.warn(`Could not convert regex pattern at ${r.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return n}function m1(t,r){if("openAi"===r.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===r.target&&t.keyType?._def.typeName===q.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((a,i)=>({...a,[i]:m4(t.valueType._def,{...r,currentPath:[...r.currentPath,"properties",i]})??mI(r)}),{}),additionalProperties:r.rejectedAdditionalProperties};let a={type:"object",additionalProperties:m4(t.valueType._def,{...r,currentPath:[...r.currentPath,"additionalProperties"]})??r.allowedAdditionalProperties};if("openApi3"===r.target)return a;if(t.keyType?._def.typeName===q.ZodString&&t.keyType._def.checks?.length){let{type:i,...n}=mG(t.keyType._def,r);return{...a,propertyNames:n}}if(t.keyType?._def.typeName===q.ZodEnum)return{...a,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===q.ZodBranded&&t.keyType._def.type._def.typeName===q.ZodString&&t.keyType._def.type._def.checks?.length){let{type:i,...n}=mz(t.keyType._def,r);return{...a,propertyNames:n}}return a}let m2={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"},m9=(t,r)=>{let a=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((t,a)=>m4(t._def,{...r,currentPath:[...r.currentPath,"anyOf",`${a}`]})).filter(t=>!!t&&(!r.strictUnions||"object"==typeof t&&Object.keys(t).length>0));return a.length?{anyOf:a}:void 0};function m4(t,r,a=!1){let i=r.seen.get(t);if(r.override){let n=r.override?.(t,r,i,a);if(n!==pk)return n}if(i&&!a){let t=m6(i,r);if(void 0!==t)return t}let n={def:t,path:r.currentPath,jsonSchema:void 0};r.seen.set(t,n);let o=((t,r,a)=>{switch(r){case q.ZodString:return mG(t,a);case q.ZodNumber:let i={type:"number"};if(!t.checks)return i;for(let r of t.checks)switch(r.kind){case"int":i.type="integer",mq(i,"type",r.message,a);break;case"min":"jsonSchema7"===a.target?r.inclusive?mA(i,"minimum",r.value,r.message,a):mA(i,"exclusiveMinimum",r.value,r.message,a):(r.inclusive||(i.exclusiveMinimum=!0),mA(i,"minimum",r.value,r.message,a));break;case"max":"jsonSchema7"===a.target?r.inclusive?mA(i,"maximum",r.value,r.message,a):mA(i,"exclusiveMaximum",r.value,r.message,a):(r.inclusive||(i.exclusiveMaximum=!0),mA(i,"maximum",r.value,r.message,a));break;case"multipleOf":mA(i,"multipleOf",r.value,r.message,a)}return i;case q.ZodObject:return function(t,r){let a="openAi"===r.target,i={type:"object",properties:{}},n=[],o=t.shape();for(let t in o){let s=o[t];if(void 0===s||void 0===s._def)continue;let l=function(t){try{return t.isOptional()}catch{return!0}}(s);l&&a&&("ZodOptional"===s._def.typeName&&(s=s._def.innerType),s.isNullable()||(s=s.nullable()),l=!1);let c=m4(s._def,{...r,currentPath:[...r.currentPath,"properties",t],propertyPath:[...r.currentPath,"properties",t]});void 0!==c&&(i.properties[t]=c,l||n.push(t))}n.length&&(i.required=n);let s=function(t,r){if("ZodNever"!==t.catchall._def.typeName)return m4(t.catchall._def,{...r,currentPath:[...r.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return r.allowedAdditionalProperties;case"strict":return r.rejectedAdditionalProperties;case"strip":return"strict"===r.removeAdditionalStrategy?r.allowedAdditionalProperties:r.rejectedAdditionalProperties}}(t,r);return void 0!==s&&(i.additionalProperties=s),i}(t,a);case q.ZodBigInt:let n={type:"integer",format:"int64"};if(!t.checks)return n;for(let r of t.checks)switch(r.kind){case"min":"jsonSchema7"===a.target?r.inclusive?mA(n,"minimum",r.value,r.message,a):mA(n,"exclusiveMinimum",r.value,r.message,a):(r.inclusive||(n.exclusiveMinimum=!0),mA(n,"minimum",r.value,r.message,a));break;case"max":"jsonSchema7"===a.target?r.inclusive?mA(n,"maximum",r.value,r.message,a):mA(n,"exclusiveMaximum",r.value,r.message,a):(r.inclusive||(n.exclusiveMaximum=!0),mA(n,"maximum",r.value,r.message,a));break;case"multipleOf":mA(n,"multipleOf",r.value,r.message,a)}return n;case q.ZodBoolean:return{type:"boolean"};case q.ZodDate:return function t(r,a,i){let n=i??a.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((i,n)=>t(r,a,i))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":var o=r,s=a;let l={type:"integer",format:"unix-time"};if("openApi3"===s.target)return l;for(let t of o.checks)switch(t.kind){case"min":mA(l,"minimum",t.value,t.message,s);break;case"max":mA(l,"maximum",t.value,t.message,s)}return l}}(t,a);case q.ZodUndefined:return{not:mI(a)};case q.ZodNull:return"openApi3"===a.target?{enum:["null"],nullable:!0}:{type:"null"};case q.ZodArray:let o;return o={type:"array"},t.type?._def&&t.type?._def?.typeName!==q.ZodAny&&(o.items=m4(t.type._def,{...a,currentPath:[...a.currentPath,"items"]})),t.minLength&&mA(o,"minItems",t.minLength.value,t.minLength.message,a),t.maxLength&&mA(o,"maxItems",t.maxLength.value,t.maxLength.message,a),t.exactLength&&(mA(o,"minItems",t.exactLength.value,t.exactLength.message,a),mA(o,"maxItems",t.exactLength.value,t.exactLength.message,a)),o;case q.ZodUnion:case q.ZodDiscriminatedUnion:if("openApi3"===a.target)return m9(t,a);let s=t.options instanceof Map?Array.from(t.options.values()):t.options;if(s.every(t=>t._def.typeName in m2&&(!t._def.checks||!t._def.checks.length))){let t=s.reduce((t,r)=>{let a=m2[r._def.typeName];return a&&!t.includes(a)?[...t,a]:t},[]);return{type:t.length>1?t:t[0]}}if(s.every(t=>"ZodLiteral"===t._def.typeName&&!t.description)){let t=s.reduce((t,r)=>{let a=typeof r._def.value;switch(a){case"string":case"number":case"boolean":return[...t,a];case"bigint":return[...t,"integer"];case"object":if(null===r._def.value)return[...t,"null"];default:return t}},[]);if(t.length===s.length){let r=t.filter((t,r,a)=>a.indexOf(t)===r);return{type:r.length>1?r:r[0],enum:s.reduce((t,r)=>t.includes(r._def.value)?t:[...t,r._def.value],[])}}}else if(s.every(t=>"ZodEnum"===t._def.typeName))return{type:"string",enum:s.reduce((t,r)=>[...t,...r._def.values.filter(r=>!t.includes(r))],[])};return m9(t,a);case q.ZodIntersection:let l,c,u;return l=[m4(t.left._def,{...a,currentPath:[...a.currentPath,"allOf","0"]}),m4(t.right._def,{...a,currentPath:[...a.currentPath,"allOf","1"]})].filter(t=>!!t),c="jsonSchema2019-09"===a.target?{unevaluatedProperties:!1}:void 0,u=[],l.forEach(t=>{if((!("type"in t)||"string"!==t.type)&&"allOf"in t)u.push(...t.allOf),void 0===t.unevaluatedProperties&&(c=void 0);else{let r=t;if("additionalProperties"in t&&!1===t.additionalProperties){let{additionalProperties:a,...i}=t;r=i}else c=void 0;u.push(r)}}),u.length?{allOf:u,...c}:void 0;case q.ZodTuple:return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((t,r)=>m4(t._def,{...a,currentPath:[...a.currentPath,"items",`${r}`]})).reduce((t,r)=>void 0===r?t:[...t,r],[]),additionalItems:m4(t.rest._def,{...a,currentPath:[...a.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((t,r)=>m4(t._def,{...a,currentPath:[...a.currentPath,"items",`${r}`]})).reduce((t,r)=>void 0===r?t:[...t,r],[])};case q.ZodRecord:return m1(t,a);case q.ZodLiteral:let d;return"bigint"!=(d=typeof t.value)&&"number"!==d&&"boolean"!==d&&"string"!==d?{type:Array.isArray(t.value)?"array":"object"}:"openApi3"===a.target?{type:"bigint"===d?"integer":d,enum:[t.value]}:{type:"bigint"===d?"integer":d,const:t.value};case q.ZodEnum:return{type:"string",enum:Array.from(t.values)};case q.ZodNativeEnum:let p,m,h;return p=t.values,{type:1===(h=Array.from(new Set((m=Object.keys(t.values).filter(t=>"number"!=typeof p[p[t]]).map(t=>p[t])).map(t=>typeof t)))).length?"string"===h[0]?"string":"number":["string","number"],enum:m};case q.ZodNullable:if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return"openApi3"===a.target?{type:m2[t.innerType._def.typeName],nullable:!0}:{type:[m2[t.innerType._def.typeName],"null"]};if("openApi3"===a.target){let r=m4(t.innerType._def,{...a,currentPath:[...a.currentPath]});return r&&"$ref"in r?{allOf:[r],nullable:!0}:r&&{...r,nullable:!0}}let f=m4(t.innerType._def,{...a,currentPath:[...a.currentPath,"anyOf","0"]});return f&&{anyOf:[f,{type:"null"}]};case q.ZodOptional:if(a.currentPath.toString()===a.propertyPath?.toString())return m4(t.innerType._def,a);let y=m4(t.innerType._def,{...a,currentPath:[...a.currentPath,"anyOf","1"]});return y?{anyOf:[{not:mI(a)},y]}:mI(a);case q.ZodMap:if("record"===a.mapStrategy)return m1(t,a);return{type:"array",maxItems:125,items:{type:"array",items:[m4(t.keyType._def,{...a,currentPath:[...a.currentPath,"items","items","0"]})||mI(a),m4(t.valueType._def,{...a,currentPath:[...a.currentPath,"items","items","1"]})||mI(a)],minItems:2,maxItems:2}};case q.ZodSet:let g;return g={type:"array",uniqueItems:!0,items:m4(t.valueType._def,{...a,currentPath:[...a.currentPath,"items"]})},t.minSize&&mA(g,"minItems",t.minSize.value,t.minSize.message,a),t.maxSize&&mA(g,"maxItems",t.maxSize.value,t.maxSize.message,a),g;case q.ZodLazy:return()=>t.getter()._def;case q.ZodPromise:return m4(t.type._def,a);case q.ZodNaN:case q.ZodNever:return"openAi"===a.target?void 0:{not:mI({...a,currentPath:[...a.currentPath,"not"]})};case q.ZodEffects:return"input"===a.effectStrategy?m4(t.schema._def,a):mI(a);case q.ZodAny:case q.ZodUnknown:return mI(a);case q.ZodDefault:return{...m4(t.innerType._def,a),default:t.defaultValue()};case q.ZodBranded:return mz(t,a);case q.ZodReadonly:case q.ZodCatch:return m4(t.innerType._def,a);case q.ZodPipeline:if("input"===a.pipeStrategy)return m4(t.in._def,a);if("output"===a.pipeStrategy)return m4(t.out._def,a);let v=m4(t.in._def,{...a,currentPath:[...a.currentPath,"allOf","0"]}),_=m4(t.out._def,{...a,currentPath:[...a.currentPath,"allOf",v?"1":"0"]});return{allOf:[v,_].filter(t=>void 0!==t)};case q.ZodFunction:case q.ZodVoid:case q.ZodSymbol:default:return}})(t,t.typeName,r),s="function"==typeof o?m4(o(),r):o;if(s&&m5(t,r,s),r.postProcess){let a=r.postProcess(s,t,r);return n.jsonSchema=s,a}return n.jsonSchema=s,s}let m6=(t,r)=>{switch(r.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:mN(r.currentPath,t.path)};case"none":case"seen":if(t.path.length<r.currentPath.length&&t.path.every((t,a)=>r.currentPath[a]===t))return console.warn(`Recursive reference detected at ${r.currentPath.join("/")}! Defaulting to any`),mI(r);return"seen"===r.$refStrategy?mI(r):void 0}},m5=(t,r,a)=>(t.description&&(a.description=t.description,r.markdownDescription&&(a.markdownDescription=t.description)),a);function m3(t,r={}){let{strict:a=!1}=r,i=Object.entries(t),n=t=>({target:r})=>{let n={},o=[];for(let[a,s]of i)n[a]=function(t,r,a){let i=t["~standard"];if(i.jsonSchema)return i.jsonSchema[a]({target:r});if("zod"===t["~standard"].vendor&&!("_zod"in t)&&"_def"in t){let a=((t,r)=>{let a,i,n=(i=void 0!==(a="string"==typeof r?{...px,name:r}:{...px,...r}).name?[...a.basePath,a.definitionPath,a.name]:a.basePath,{...a,flags:{hasReferencedOpenAiAnyType:!1},currentPath:i,propertyPath:void 0,seen:new Map(Object.entries(a.definitions).map(([t,r])=>[r._def,{def:r._def,path:[...a.basePath,a.definitionPath,t],jsonSchema:void 0}]))}),o="object"==typeof r&&r.definitions?Object.entries(r.definitions).reduce((t,[r,a])=>({...t,[r]:m4(a._def,{...n,currentPath:[...n.basePath,n.definitionPath,r]},!0)??mI(n)}),{}):void 0,s="string"==typeof r?r:r?.nameStrategy==="title"?void 0:r?.name,l=m4(t._def,void 0===s?n:{...n,currentPath:[...n.basePath,n.definitionPath,s]},!1)??mI(n),c="object"==typeof r&&void 0!==r.name&&"title"===r.nameStrategy?r.name:void 0;void 0!==c&&(l.title=c),n.flags.hasReferencedOpenAiAnyType&&(o||(o={}),o[n.openAiAnyTypeName]||(o[n.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===n.$refStrategy?"1":[...n.basePath,n.definitionPath,n.openAiAnyTypeName].join("/")}}));let u=void 0===s?o?{...l,[n.definitionPath]:o}:l:{$ref:[..."relative"===n.$refStrategy?[]:n.basePath,n.definitionPath,s].join("/"),[n.definitionPath]:{...o,[s]:l}};return"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})(t,{$refStrategy:"none",target:"openapi-3.0"===r?"openApi3":"jsonSchema7"});return delete a.$schema,a}if("zod"===i.vendor&&"_zod"in t)try{let r=a6(t);return delete r.$schema,r}catch(t){throw Error(`Failed to convert a zod schema to JSON Schema (zod v4 without "~standard.jsonSchema"). Upgrade to zod >= 4.2.0. Original error: ${t instanceof Error?t.message:String(t)}`)}throw Error(`Schema library "${i.vendor}" cannot be converted to JSON Schema. Use zod v3 (>= 3.25.76), zod >= 4.2.0, or a Standard Schema library implementing "~standard.jsonSchema".`)}(s,r,t),!function(t,r){if("function"!=typeof t.safeParse)return!1;try{let a=t.safeParse(void 0);return a.success&&("input"===r||void 0===a.data)}catch{return!1}}(s,t)&&o.push(a);let s={type:"object",properties:n};return o.length>0&&(s.required=o),a&&(s.additionalProperties=!1),s},o=async r=>{if("object"!=typeof r||null===r||Array.isArray(r))return{issues:[{message:"Expected an object."}]};let n={},o=[];for(let[t,a]of i){let i=await a["~standard"].validate(r[t]);if(i.issues)for(let r of i.issues)o.push({message:r.message,path:[t,...r.path??[]]});else(t in r||void 0!==i.value)&&(n[t]=i.value)}if(a)for(let a of Object.keys(r))a in t||o.push({message:`Unrecognized key: "${a}"`,path:[a]});return o.length>0?{issues:o}:{value:n}};return{shape:t,"~standard":{version:1,vendor:"xmcp",validate:o,jsonSchema:{input:n("input"),output:n("output")}}}}let m8=require("async_hooks"),m7=(t,r)=>{globalThis[t]=r},he=t=>globalThis[t];function ht({name:t,fallback:r=!0}){let a=Symbol.for(`xmcp-context-${t}`),i=Symbol.for(`xmcp-context-${t}-fallback-store`);if(he(a))return he(a);let n=new m8.AsyncLocalStorage,o=globalThis[i]??{current:null};m7(i,o);let s={provider:(t,a)=>(r&&(o.current=t),n.run(t,a)),getContext:()=>{let a=n.getStore();if(a)return a;if(r&&o.current)return o.current;throw Error(`getContext() can only be used within the ${t} context.`)},setContext:a=>{let i=n.getStore()??(r?o.current:null);if(!i)throw Error(`setContext() can only be used within the ${t} context.`);Object.assign(i,a)}};return m7(a,s),s}let hr=ht({name:"http-request-context"});hr.setContext;let ha=hr.getContext;hr.provider;let hi=ht({name:"client-info-context"}),hn=hi.setContext,ho=hi.getContext,hs=hi.provider,hl=t=>{if(!("object"==typeof t&&null!==t&&!Array.isArray(t))||"string"!=typeof t.name||"string"!=typeof t.version)return;let r={name:t.name,version:t.version};return"string"==typeof t.title&&(r.title=t.title),"string"==typeof t.websiteUrl&&(r.websiteUrl=t.websiteUrl),"string"==typeof t.description&&(r.description=t.description),r},hc=(t,r)=>{let a=r.toLowerCase();for(let[r,i]of Object.entries(t)){if(r.toLowerCase()!==a)continue;let t=Array.isArray(i)?i[0]:i;if("string"!=typeof t)break;let n=t.trim();return n.length>0?n:void 0}},hu=new Set(["message","mode","requestedSchema"]),hd=new Set(["elicitationId","message","mode","url"]),hp=new Set(["properties","required","type"]),hm=new Set(["default","description","format","maxLength","minLength","title","type"]),hh=new Set(["default","description","enum","enumNames","title","type"]),hf=new Set(["default","description","title","type"]),hy=new Set(["default","description","maximum","minimum","title","type"]),hg=new Set(["date","date-time","email","uri"]);async function hv(t,r,a){let i=function(t){let r=t.mode??"form";if("url"===r)return function(t){let r;hb(t,"Elicitation request must be a plain object."),h_(t,hd,"URL elicitation"),hS(t.message,"URL elicitation requires a string message."),h$(t.elicitationId,"URL elicitation requires a non-empty elicitationId."),h$(t.url,"URL elicitation requires a non-empty URL.");try{r=new URL(t.url)}catch{throw Error("URL elicitation requires a valid http or https URL.")}if("http:"!==r.protocol&&"https:"!==r.protocol)throw Error("URL elicitation requires a valid http or https URL.")}(t),t;if("form"!==r)throw Error(`Unsupported elicitation mode "${String(t.mode)}". Expected "form" or "url".`);return function(t){hb(t,"Elicitation request must be a plain object."),h_(t,hu,"Form elicitation"),hS(t.message,"Form elicitation requires a string message.");let r=t.requestedSchema;if(hb(r,"Form elicitation requires a flat object schema."),h_(r,hp,"Form elicitation schema"),"object"!==r.type)throw Error('Form elicitation schema must use type "object".');for(let[t,a]of(hb(r.properties,"Form elicitation schema requires a properties object."),Object.entries(r.properties)))!function(t,r){if(hb(r,`Form elicitation field "${t}" must be a plain object.`),hw(r.title,`Form elicitation field "${t}" title must be a string.`),hw(r.description,`Form elicitation field "${t}" description must be a string.`),"string"===r.type&&"enum"in r){var a,i;if(h_(r,hh,`Form elicitation field "${t}"`),hx(r.enum,`Form elicitation field "${t}" enum values must be strings.`),a=r.enumNames,i=`Form elicitation field "${t}" enumNames must be strings.`,void 0!==a&&hx(a,i),void 0!==r.enumNames&&r.enumNames.length!==r.enum.length)throw Error(`Form elicitation field "${t}" enumNames length must match enum length.`);if(hw(r.default,`Form elicitation field "${t}" default must be a string.`),void 0!==r.default&&!r.enum.includes(r.default))throw Error(`Form elicitation field "${t}" default must be one of its enum values.`);return}if("string"===r.type&&!("enum"in r)){h_(r,hm,`Form elicitation field "${t}"`),hk(r.minLength,`Form elicitation field "${t}" minLength must be a number.`),hk(r.maxLength,`Form elicitation field "${t}" maxLength must be a number.`),hw(r.default,`Form elicitation field "${t}" default must be a string.`);let a=r.format;if(hw(a,`Form elicitation field "${t}" format must be a string.`),void 0!==a&&!hg.has(a))throw Error(`Form elicitation field "${t}" format must be one of: ${Array.from(hg).join(", ")}.`);return}if("boolean"===r.type){if(h_(r,hf,`Form elicitation field "${t}"`),void 0!==r.default&&"boolean"!=typeof r.default)throw Error(`Form elicitation field "${t}" default must be a boolean.`);return}if("number"===r.type||"integer"===r.type){h_(r,hy,`Form elicitation field "${t}"`),hk(r.minimum,`Form elicitation field "${t}" minimum must be a number.`),hk(r.maximum,`Form elicitation field "${t}" maximum must be a number.`),hk(r.default,`Form elicitation field "${t}" default must be a number.`);return}throw Error(`Form elicitation field "${t}" uses unsupported type "${String(r.type)}". Supported types are string, boolean, number, integer, and string enums.`)}(t,a);if(void 0!==r.required){if(!Array.isArray(r.required)||r.required.some(t=>"string"!=typeof t))throw Error("Form elicitation schema required fields must be a string array.");for(let t of r.required)if(!(t in r.properties))throw Error(`Form elicitation schema required field "${t}" is not defined in properties.`)}}(t),{...t,mode:"form"}}(r);try{let r=await t.mcpReq.elicitInput(i,a);return{...r,content:r.content??void 0}}catch(t){if(t instanceof lD&&t.code===lL.MethodNotSupportedByProtocolVersion)throw Error("extra.elicit() is not available on protocol revision 2026-07-28: server-initiated elicitation was replaced by multi round-trip requests. Return inputRequired({ ... }) from the tool handler instead (re-exported from xmcp); the client fulfils the embedded requests and retries the tool call.");throw t}}function h_(t,r,a){let i=Object.keys(t).filter(t=>!r.has(t));if(0!==i.length)throw Error(`${a} includes unsupported key(s): ${i.join(", ")}.`)}function hb(t,r){if("object"!=typeof t||null===t||Array.isArray(t))throw Error(r)}function hS(t,r){if("string"!=typeof t)throw Error(r)}function h$(t,r){if("string"!=typeof t||0===t.trim().length)throw Error(r)}function hw(t,r){if(void 0!==t&&"string"!=typeof t)throw Error(r)}function hk(t,r){if(void 0!==t&&"number"!=typeof t)throw Error(r)}function hx(t,r){if(!Array.isArray(t)||t.some(t=>"string"!=typeof t))throw Error(r)}let hR=new Set(["_meta","includeContext","maxTokens","messages","metadata","modelPreferences","stopSequences","systemPrompt","temperature"]),hP=new Set(["task","toolChoice","tools"]),hE=new Set(["text","image","audio"]);async function hj(t,r,a){let i=function(t){hT(t,"Sampling request must be a plain object.");let r=Object.keys(t),a=r.filter(t=>hP.has(t));if(a.length>0)throw Error(`Sampling request key(s) not supported by xmcp yet: ${a.join(", ")}.`);let i=r.filter(t=>!hR.has(t));if(i.length>0)throw Error(`Sampling request includes unsupported key(s): ${i.join(", ")}.`);if(!Array.isArray(t.messages)||0===t.messages.length)throw Error("Sampling requires at least one message.");for(let[r,a]of t.messages.entries())!function(t,r){if(hT(r,`Sampling message at index ${t} must be a plain object.`),"user"!==r.role&&"assistant"!==r.role)throw Error(`Sampling message at index ${t} requires role "user" or "assistant".`);let a=r.content;hT(a,`Sampling message at index ${t} requires a content object.`);let i=a.type;if("string"!=typeof i||!hE.has(i))throw Error(`Sampling message at index ${t} uses unsupported content type "${String(i)}". Supported types are text, image, and audio.`);if("text"===i&&"string"!=typeof a.text)throw Error(`Sampling message at index ${t} requires string text content.`);if(("image"===i||"audio"===i)&&("string"!=typeof a.data||"string"!=typeof a.mimeType))throw Error(`Sampling message at index ${t} requires base64 data and a mimeType.`)}(r,a);if("number"!=typeof t.maxTokens)throw Error("Sampling requires a numeric maxTokens.");return t}(r);try{return await t.mcpReq.requestSampling(i,a)}catch(t){if(t instanceof lD&&t.code===lL.MethodNotSupportedByProtocolVersion)throw Error("extra.sample() is not available on protocol revision 2026-07-28: server-initiated sampling was replaced by multi round-trip requests. Return inputRequired({ ... }) with inputRequired.createMessage(...) from the tool handler instead (re-exported from xmcp); the client fulfils the embedded requests and retries the tool call.");throw t}}function hT(t,r){if("object"!=typeof t||null===t||Array.isArray(t))throw Error(r)}let hO={text:t=>"string"!=typeof t.text?{valid:!1,error:'Text content must have a "text" property of type string'}:{valid:!0},image:t=>"string"!=typeof t.data?{valid:!1,error:'Image content must have a "data" property of type string (base64-encoded image)'}:"string"!=typeof t.mimeType?{valid:!1,error:'Image content must have a "mimeType" property of type string'}:{valid:!0},audio:t=>"string"!=typeof t.data?{valid:!1,error:'Audio content must have a "data" property of type string (base64-encoded audio)'}:"string"!=typeof t.mimeType?{valid:!1,error:'Audio content must have a "mimeType" property of type string'}:{valid:!0},resource_link:t=>"string"!=typeof t.name?{valid:!1,error:'Resource link content must have a "name" property of type string'}:"string"!=typeof t.uri?{valid:!1,error:'Resource link content must have a "uri" property of type string'}:void 0!==t.title&&"string"!=typeof t.title?{valid:!1,error:'Resource link "title" property must be a string if provided'}:void 0!==t.description&&"string"!=typeof t.description?{valid:!1,error:'Resource link "description" property must be a string if provided'}:void 0!==t.mimeType&&"string"!=typeof t.mimeType?{valid:!1,error:'Resource link "mimeType" property must be a string if provided'}:{valid:!0}};function hC(t){if(!t||"object"!=typeof t)return{valid:!1,error:"Content must be an object"};if("string"!=typeof t.type)return{valid:!1,error:'Content must have a "type" property of type string'};if(void 0!==t._meta&&(null===t._meta||"object"!=typeof t._meta))return{valid:!1,error:'Content "_meta" property must be an object if provided'};let r=hO[t.type];return r?r(t):{valid:!0}}function hN(t,r,a,i){if(null===t||"object"!=typeof t||Array.isArray(t))throw Error(`Tool "${a}" ${i}: expected a plain object.`);let n=new Set(Object.keys(r)),o=Object.keys(t).filter(t=>!n.has(t));if(o.length>0)throw Error(`Tool "${a}" ${i}: unrecognized key(s): ${o.join(", ")}`);for(let[n,o]of Object.entries(r))try{o.parse(t[n])}catch(t){throw Error(`Tool "${a}" ${i}: ${t?.message??`invalid field "${n}"`}`)}}function hI(t){return!!(t&&"object"==typeof t&&Object.keys(t).some(t=>t.startsWith("ui/")))}function hq(t){let r=t.mcpReq.envelope,a=hl(r?.[nF]);if(!a)try{let t,r=ha();a=r.clientInfo??(t=r.headers,hl({name:hc(t,"x-mcp-client-name"),version:hc(t,"x-mcp-client-version"),title:hc(t,"x-mcp-client-title"),websiteUrl:hc(t,"x-mcp-client-website-url"),description:hc(t,"x-mcp-client-description")}))}catch{}if(!a)try{a=ho().clientInfo}catch{}return a}function hA(t){return t.endsWith(".tsx")}let hz=new class{add(t,r){this.resources.set(t,r)}getAll(){return this.resources}clear(){this.resources.clear()}has(t){return this.resources.has(t)}constructor(){!function(t,r,a){r in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a}(this,"resources",new Map)}};function hM(t){let r={};return!function t(a,i=""){if(a&&"object"==typeof a)for(let[n,o]of Object.entries(a)){let a=i?`${i}/${n}`:n;!o||"object"!=typeof o||Array.isArray(o)||o instanceof Date||o instanceof RegExp?r[a]=o:t(o,a)}}(t),r}let hL=["ui/resourceUri","resourceUri","visibility"],hD=["prefersBorder","domain","csp","permissions","connectDomains","resourceDomains","frameDomains","baseUriDomains"],hZ=ht({name:"request-context",fallback:!1});function hV(t){let r=[...t];return(t,a,i)=>(function(t,r,a){let i,n=new Map;if(t.http){let t=ha(),r=Object.fromEntries(Object.entries(t.headers).map(([t,r])=>[t,Array.isArray(r)?Object.freeze([...r]):r]));i=Object.freeze({id:t.id,headers:Object.freeze(r)})}return hZ.provider(Object.freeze({clientInfo:r?Object.freeze({...r}):void 0,http:i,signal:t.mcpReq.signal,set(t,r){n.set(t,r)},get:t=>n.get(t),async progress(r,a){let i=t.mcpReq._meta?.progressToken;void 0!==i&&await t.mcpReq.notify({method:"notifications/progress",params:{progressToken:i,progress:r,...void 0===a?{}:{total:a}}})},log:(r,a)=>t.mcpReq.log(r,a)}),a)})(a,hq(a),async()=>{if(0===r.length)return i();let a=Object.freeze({...function(){try{return hZ.getContext()}catch{throw Error("getRequestContext() can only be used while handling an MCP request.")}}(),method:t.method,params:Object.freeze({...t.params})}),n=-1,o=async t=>{if(t<=n)throw Error("MCP middleware next() can only be called once");n=t;let s=r[t];return s?s(a,()=>o(t+1)):i()};return o(0)})}let hF=new Set(["tools/list","prompts/get","prompts/list","resources/read","resources/list","resources/templates/list","completion/complete"]);function hU(t){let{tags:r,enabled:a,...i}=t;return{...i,_meta:void 0===r?i._meta:{...i._meta,"xmcp/tags":r}}}function hH(t){return"object"==typeof t&&null!==t&&Object.entries(t).every(([t,r])=>"string"==typeof t&&"object"==typeof r&&null!==r&&"parse"in r&&"function"==typeof r.parse)}function hJ(t){return(t.split("/").pop()||t).replace(/\.[^/.]+$/,"")}function hK(t,r,a){return t.names?.includes(r)===!0||t.tags?.some(t=>a.includes(t))===!0}function hB(t,r){return r?new Map([...t].filter(([t,{metadata:a}])=>{if(a?.enabled===!1)return!1;let i=a?.name??hJ(t),n=a?.tags??[];return(!r.include||hK(r.include,i,n))&&(!r.exclude||!hK(r.exclude,i,n))})):t}function hG(t){return Error(`[xmcp] Invalid prompt file: ${t}
|
|
66
|
+
-> Default export must be a prompt handler function.`)}async function hW(t){let r=new Map,a=[];for(let i of(await Promise.all(Object.entries(t).map(async([t,r])=>{let a=await r(),i=function(t,r){if("object"!=typeof t||null===t)throw hG(r);let a=Object.keys(t),i=t.default,n=a.filter(t=>"__esModule"!==t);if(0===a.length||1===n.length&&"default"===n[0]&&"object"==typeof i&&null!==i&&0===Object.keys(i).length)return"empty";if(!("default"in t)||void 0===t.default)return"missing-default";if("function"!=typeof t.default)throw hG(r);return"valid"}(a,t);return"empty"===i?{skipped:!0,issue:{path:t,message:"File is empty."}}:"missing-default"===i?{skipped:!0,issue:{path:t,message:"File does not export a default prompt handler."}}:{skipped:!1,path:t,promptModule:a}})))){if(i.skipped){a.push(i.issue);continue}r.set(i.path,i.promptModule)}return{promptModules:r,skippedPrompts:a}}let hY=function(t=console){let r="";return a=>{let i=a.map(({path:t,message:r})=>`${t}:${r}`).sort().join("|");if(i===r||(r=i,0===a.length))return;a.forEach(({path:r,message:a})=>{t.warn(`[xmcp] Failed to load prompt file: ${r}
|
|
67
|
+
-> ${a}`)});let n=a.length;t.warn(`[xmcp] ${n} prompt${1===n?"":"s"} skipped due to empty files or missing default exports`)}}();function hX(t){return Error(`[xmcp] Invalid resource file: ${t}
|
|
68
|
+
-> Default export must be a resource handler function.`)}async function hQ(t){let r=new Map,a=[];for(let i of(await Promise.all(Object.entries(t).map(async([t,r])=>{let a=await r(),i=function(t,r){if("object"!=typeof t||null===t)throw hX(r);let a=Object.keys(t),i=t.default,n=a.filter(t=>"__esModule"!==t);if(0===a.length||1===n.length&&"default"===n[0]&&"object"==typeof i&&null!==i&&0===Object.keys(i).length)return"empty";if(!("default"in t)||void 0===t.default)return"missing-default";if("function"!=typeof t.default)throw hX(r);return"valid"}(a,t);return"empty"===i?{skipped:!0,issue:{path:t,message:"File is empty."}}:"missing-default"===i?{skipped:!0,issue:{path:t,message:"File does not export a default resource handler."}}:{skipped:!1,path:t,resourceModule:a}})))){if(i.skipped){a.push(i.issue);continue}r.set(i.path,i.resourceModule)}return{resourceModules:r,skippedResources:a}}let h0=function(t=console){let r="";return a=>{let i=a.map(({path:t,message:r})=>`${t}:${r}`).sort().join("|");if(i===r||(r=i,0===a.length))return;a.forEach(({path:r,message:a})=>{t.warn(`[xmcp] Failed to load resource file: ${r}
|
|
69
|
+
-> ${a}`)});let n=a.length;t.warn(`[xmcp] ${n} resource${1===n?"":"s"} skipped due to empty files or missing default exports`)}}();function h1(t){let r=t.replace(/\\/g,"/");if(!r)throw Error("Invalid tool path: path is empty");let a=r.replace(/\.[^/.]+$/,"").replace(/\//g,"_");return{normalizedPath:r,baseName:a}}function h2(t){let r=t.split("/").filter(t=>""!==t),a=r.findIndex(t=>t.match(/^\(.+\)$/));if(-1===a)return null;let i=r[r.length-1];if(i&&i.match(/^\[.+\]\.ts$/))return null;let n=r[a].slice(1,-1),o=r.slice(a+1),s=o[o.length-1];if(s&&s.includes(".")){let t=s.split(".")[0];"index"!==t?o[o.length-1]=t:o.pop()}let l=[],c=[],u=o.map(t=>{if(!t.match(/^\[.+\]$/))return c.push(t),t;{let r=t.slice(1,-1);return l.push(r),`{${r}}`}}),d=`${n}://${u.join("/")}`,p=l.length>0?"template":"direct";return{filePath:t,uriTemplate:d,scheme:n,parameters:l,pathSegments:c,type:p}}function h9(t){return Error(`[xmcp] Invalid tool file: ${t}
|
|
70
|
+
-> Default export must be a tool handler function.`)}async function h4(t){let r=new Map,a=[];for(let i of(await Promise.all(Object.entries(t).map(async([t,r])=>{let a=await r(),i=function(t,r){if("object"!=typeof t||null===t)throw h9(r);let a=Object.keys(t),i=t.default,n=a.filter(t=>"__esModule"!==t);if(0===a.length||1===n.length&&"default"===n[0]&&"object"==typeof i&&null!==i&&0===Object.keys(i).length)return"empty";if(!("default"in t)||void 0===t.default)return"missing-default";if("function"!=typeof t.default)throw h9(r);return"valid"}(a,t);return"empty"===i?{skipped:!0,issue:{path:t,message:"File is empty."}}:"missing-default"===i?{skipped:!0,issue:{path:t,message:"File does not export a default tool handler."}}:{skipped:!1,path:t,toolModule:a}})))){if(i.skipped){a.push(i.issue);continue}r.set(i.path,i.toolModule)}return{toolModules:r,skippedTools:a}}let h6=function(t=console){let r="";return a=>{let i=a.map(({path:t,message:r})=>`${t}:${r}`).sort().join("|");if(i===r||(r=i,0===a.length))return;a.forEach(({path:r,message:a})=>{t.warn(`[xmcp] Failed to load tool file: ${r}
|
|
71
|
+
-> ${a}`)});let n=a.length;t.warn(`[xmcp] ${n} tool${1===n?"":"s"} skipped due to empty files or missing default exports`)}}(),h5=INJECTED_TOOLS,h3=INJECTED_PROMPTS,h8=INJECTED_RESOURCES,h7=SERVER_INFO;async function fe(t,r,i,n){let o=await INJECTED_MIDDLEWARE?.(),s=function(t){if(void 0===t)return[];let r=Array.isArray(t)?[...t]:[t];if(!r.every(t=>"function"==typeof t))throw Error("src/middleware.ts must export mcp as a function or an array of functions");return r}(o?.mcp),l="undefined"!=typeof OBSERVABILITY_CONFIG&&OBSERVABILITY_CONFIG.enabled?function(t=t=>console.error(t)){let r=new Map,a=[];function i(r){try{t(JSON.stringify({"@timestamp":new Date().toISOString(),...r}))}catch{}}return{middleware:async(t,n)=>{let o,s,l;if("tools/call"!==t.method&&"prompts/get"!==t.method&&"resources/read"!==t.method)return n();try{s=performance.now(),o={log:{level:"info"},...function(t){let r=t.http?.headers.traceparent;if("string"!=typeof r)return{};let a=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(-.*)?$/.exec(r);return!a||"ff"===a[1]||/^0+$/.test(a[2])||/^0+$/.test(a[3])||"00"===a[1]&&void 0!==a[5]?{}:{trace:{id:a[2]},parent:{id:a[3]}}}(t),transaction:{id:crypto.randomUUID()},...t.http?{http:{request:{id:t.http.id}}}:{},xmcp:{method:t.method,component:"resources/read"===t.method?function(t){try{let i=new URL(t).href;return r.get(i)??a.find(({template:t})=>t.uriTemplate.match(i))?.name??"unknown"}catch{return"unknown"}}(t.params.uri):t.params.name}}}catch{return n()}i({...o,event:{kind:"event",category:["api"],type:["start"],action:"execution.start"}});let c="unknown";try{let r=await n();try{c=t.signal.aborted?"cancelled":cZ(r)?"input_required":"isError"in r&&!0===r.isError?"failure":"success","failure"===c&&(l={message:"Operation returned an error result"})}catch{}return r}catch(r){throw l={message:"cancelled"==(c=t.signal.aborted?"cancelled":"failure")?"Operation cancelled":"Operation threw an exception"},r}finally{try{i({...o,log:{level:"failure"===c?"error":"info"},event:{kind:"event",category:["api"],type:["end"],action:"execution.end",duration:Math.round((performance.now()-s)*1e6),outcome:"success"===c?"success":"failure"===c?"failure":"unknown"},xmcp:{...o.xmcp,status:c},...l?{error:l}:{}})}catch{}}},registerResource(t,i){try{"string"==typeof i?r.set(new URL(i).href,t):a.push({name:t,template:i})}catch{}}}}():void 0;l&&s.unshift(l.middleware),hz.clear();let c="undefined"==typeof COMPONENTS_CONFIG?void 0:COMPONENTS_CONFIG;return!function(t,r,a){let i=t.server,n=i.setRequestHandler,o=hV(r);i.setRequestHandler=(t,...r)=>{if(hF.has(t)&&1===r.length&&"function"==typeof r[0]){let t=r[0];r[0]=(r,a)=>o({method:r.method,params:r.params??{}},a,()=>t(r,a))}Reflect.apply(n,i,[t,...r])};try{a()}finally{i.setRequestHandler=n}}(t,s,()=>{var o,u;!function(t,r,a=[]){r.forEach((r,i)=>{var n,o;let s,l,c,u={name:hJ(i),description:"No description provided"},{default:d,metadata:p,schema:m,outputSchema:h}=r;if("object"==typeof p&&null!==p&&Object.assign(u,p),!1===u.enabled)return;if("function"==typeof d&&"__x402"in d){let t=global.__XMCP_X402_REGISTRY;t&&t.set(u.name,d.__x402)}let f={};if(hH(m)?f=m:null!=m&&console.warn(`Invalid schema for tool "${u.name}" at ${i}. Expected Record<string, z.ZodType>`),null!=h)if(hH(h))s=h;else throw Error(`Invalid outputSchema for tool "${u.name}" at ${i}. Expected Record<string, z.ZodType>`);u.annotations={...u.annotations??{}},void 0===u.annotations.title&&(u.annotations.title=u.name),u._meta={...hU(u)._meta};let y=hA(i),g=!!(n=u._meta)&&"object"==typeof n&&"ui"in n&&"object"==typeof n.ui||y,v=u._meta;if(g){let t=`ui://app/${u.name}.html`;u._meta.ui||(u._meta.ui={}),u._meta.ui.resourceUri||(u._meta.ui.resourceUri=t);let r=function(t){let r={},a={};if(t.ui&&"object"==typeof t.ui){let i=t.ui,n={},o={};for(let[t,r]of Object.entries(i))hL.includes(t)?n[t]=r:hD.includes(t)?o[t]=r:n[t]=r;Object.keys(n).length>0&&(r.ui=n),Object.keys(o).length>0&&(a.ui=o)}for(let[a,i]of Object.entries(t))"ui"!==a&&(r[a]=i);return{toolMeta:r,resourceMeta:a}}(v);v=r.toolMeta;let a=r.resourceMeta;a.ui=a.ui||{},a.ui.csp=a.ui.csp||{},a.ui.csp.resourceDomains=a.ui.csp.resourceDomains||[],a.ui.csp.resourceDomains.includes("https://esm.sh")||a.ui.csp.resourceDomains.push("https://esm.sh"),hz.add(u.name,{name:u.name,uri:t,handler:d,mimeType:"text/html;profile=mcp-app",_meta:a,toolPath:y?i:void 0})}let _=hM(v),b=g?_:void 0;l=hA(i)&&g?async(t,r)=>({content:[{type:"text",text:""}],_meta:b,structuredContent:{args:t}}):function(t,r,a,i="unknown-tool"){return async(n,o)=>{let s,l,c=t(n,(s=hq(o),l=function(t){if(!t)return;let r={};return t.headers.forEach((t,a)=>{r[a]=t}),r}(o.http?.req),{signal:o.mcpReq.signal,authInfo:o.http?.authInfo,sessionId:o.sessionId,_meta:o.mcpReq._meta,requestId:o.mcpReq.id,requestInfo:l?{headers:l}:void 0,clientInfo:s,sendNotification:t=>o.mcpReq.notify(t),sendRequest:(t,r,a)=>o.mcpReq.send(t,r,a),elicit:(t,r)=>hv(o,t,r),sample:(t,r)=>hj(o,t,r),inputResponses:o.mcpReq.inputResponses,requestState:o.mcpReq.requestState}));if(c instanceof Promise&&(c=await c),cZ(c))return c;if("string"==typeof c||"number"==typeof c){if(a){let t=Object.entries(a);if(1===t.length){let[r,a]=t[0];try{return a.parse(c),{content:[{type:"text",text:"number"==typeof c?`${c}`:c}],structuredContent:{[r]:c}}}catch{}}}return hI(r)?{content:[{type:"text",text:""}],structuredContent:{args:n},_meta:r}:{content:[{type:"text",text:"number"==typeof c?`${c}`:c}]}}if(!a||!c||"object"!=typeof c||Array.isArray(c)||"structuredContent"in c||"content"in c&&Array.isArray(c.content)||"_meta"in c||"isError"in c||(hN(c,a,i,"returned data that does not match outputSchema"),c={structuredContent:c}),c&&"object"==typeof c&&"_meta"in c&&!("content"in c)&&!("structuredContent"in c)){let t=c._meta;if(hI(t))return{content:[{type:"text",text:""}],_meta:t}}if(!c||"object"!=typeof c){let t=null===c?"null":typeof c,r=void 0===c?"undefined":null===c?"null":"object"==typeof c?JSON.stringify(c,null,2):String(c);throw Error(`Tool handler must return a CallToolResult, string, or number. Got ${t}: ${r}
|
|
74
72
|
|
|
75
73
|
Expected CallToolResult format:
|
|
76
74
|
{
|
|
@@ -120,7 +118,7 @@ Or both for backwards compatibility:
|
|
|
120
118
|
{
|
|
121
119
|
content: [{ type: "text", text: "fallback" }],
|
|
122
120
|
structuredContent: { your: "data" }
|
|
123
|
-
}`)}if(p&&!u&&!d){let{isError:t,...r}=c,a=Object.keys(r).length>0?`Tool execution failed: ${JSON.stringify(r)}`:"Tool execution failed";c.content=[{type:"text",text:a}],u=!0}if(a&&d&&!p&&
|
|
121
|
+
}`)}if(p&&!u&&!d){let{isError:t,...r}=c,a=Object.keys(r).length>0?`Tool execution failed: ${JSON.stringify(r)}`:"Tool execution failed";c.content=[{type:"text",text:a}],u=!0}if(a&&d&&!p&&hN(c.structuredContent,a,i,"returned structuredContent that does not match outputSchema"),!u&&d&&(c.content=[{type:"text",text:JSON.stringify(c.structuredContent)}],u=!0),u)for(let t=0;t<c.content.length;t++){let r=c.content[t],a=hC(r);if(!a.valid)throw Error(`Invalid content item at index ${t}: ${a.error}
|
|
124
122
|
|
|
125
123
|
Content item: ${JSON.stringify(r,null,2)}
|
|
126
124
|
|
|
@@ -137,7 +135,7 @@ Expected format:
|
|
|
137
135
|
key: "value",
|
|
138
136
|
nested: { data: "here" }
|
|
139
137
|
}
|
|
140
|
-
}`)}}return c}}(d,b,s,u.name);let S={title:u.annotations?.title,description:u.description,inputSchema:
|
|
138
|
+
}`)}}return c}}(d,b,s,u.name);let S={title:u.annotations?.title,description:u.description,inputSchema:m3(f),outputSchema:s?m3(s,{strict:!0}):void 0,annotations:u.annotations,icons:u.icons,_meta:_};t.registerTool(u.name,S,(o=u.name,c=hV(a),(t,r)=>c({method:"tools/call",params:{name:o,arguments:t}},r,()=>l(t,r))))})}(t,hB(r,c),s),hB(i,c).forEach((r,a)=>{let i=hJ(a),n={name:i,title:i,description:"No description provided"},o={},{default:s,metadata:l,schema:c}=r;if("object"==typeof l&&null!==l&&Object.assign(n,l),!1===n.enabled)return;let u=function(t,r="assistant"){return async(a,i)=>{let n,o=t(a,i);if(o instanceof Promise&&(o=await o),Array.isArray(o)||null!==o&&"object"==typeof o&&"messages"in o){let t=Array.isArray(o)?{messages:o}:o,r=await ur.GetPromptResult["~standard"].validate(t);if(r.issues){let t=r.issues.map(t=>{let r=t.path?.map(t=>"object"==typeof t?t.key:t).join(".");return`${r||"result"}: ${t.message}`});throw Error(`Invalid prompt result: ${t.join("; ")}`)}return t}if("string"==typeof o||"number"==typeof o)n={type:"text",text:"number"==typeof o?`${o}`:o};else{let t=hC(o);if(t.valid)n=o;else{let r=null===o?"null":typeof o,a=void 0===o?"undefined":null===o?"null":"object"==typeof o?JSON.stringify(o,null,2):String(o);throw Error(`Prompt handler must return a PromptContent object, string, number, PromptMessage[], or GetPromptResult. Got ${r}: ${a}
|
|
141
139
|
|
|
142
140
|
Validation error: ${t.error}
|
|
143
141
|
|
|
@@ -150,7 +148,7 @@ Expected formats:
|
|
|
150
148
|
- Image content: { type: "image", data: "base64data", mimeType: "image/jpeg" }
|
|
151
149
|
- Audio content: { type: "audio", data: "base64data", mimeType: "audio/mpeg" }
|
|
152
150
|
- Resource link: { type: "resource_link", name: "resource name", uri: "resource://uri" }
|
|
153
|
-
- All content types support an optional "_meta" object property`)}}if("user"!==r&&"assistant"!==r)throw Error(`Invalid role: ${r}`);return{messages:[{role:r,content:n}]}}}(s,n.role||"assistant");
|
|
151
|
+
- All content types support an optional "_meta" object property`)}}if("user"!==r&&"assistant"!==r)throw Error(`Invalid role: ${r}`);return{messages:[{role:r,content:n}]}}}(s,n.role||"assistant");hH(c)?Object.assign(o,c):null!=c&&console.warn(`Invalid schema for prompt "${n.name}" at ${a}. Expected Record<string, z.ZodType>`),t.registerPrompt(n.name,{title:n.title,description:n.description,icons:n.icons,_meta:hU(n)._meta,argsSchema:m3(o)},u)}),o=hB(n,c),u=l?.registerResource,[...hz.getAll()].forEach(([r,i])=>{let n=i.mimeType||"text/html;profile=mcp-app",o=i?._meta?hM(i._meta):void 0,s={name:i.name,description:`Auto-generated resource for ${i.name} tool`,mimeType:i.mimeType,_meta:o},l=async(t,r)=>{if(i.mimeType&&i.toolPath)try{var o;let t,r,s=(o=i.toolPath,IS_CLOUDFLARE?function(t){let{normalizedPath:r,baseName:a}=h1(t),i=5381;for(let t=0;t<r.length;t++)i=Math.imul(i,33)+r.charCodeAt(t)>>>0;let n=i.toString(16).slice(0,6).padStart(6,"0");return`${a}_${n}`}(o):function(t){let{normalizedPath:r,baseName:i}=h1(t),n=a(6982).createHash("md5").update(r).digest("hex").slice(0,6);return`${i}_${n}`}(o)),l=function(t){if(INJECTED_CLIENT_BUNDLES)return INJECTED_CLIENT_BUNDLES[t]||null;if(!IS_CLOUDFLARE)try{let r=a(9896),i=a(6928);for(let a of[i.join(process.cwd(),"dist","client"),i.join(process.cwd(),"client")]){let n=i.join(a,`${t}.bundle.js`),o=i.join(a,`${t}.bundle.css`);if(r.existsSync(n)){let t,a=r.readFileSync(n,"utf-8");return r.existsSync(o)&&(t=r.readFileSync(o,"utf-8")),{js:a,css:t}}}}catch{}return null}(s);if(!l)throw Error(`React client bundle not found for "${i.name}" (bundle: "${s}").
|
|
154
152
|
React tool bundles are generated automatically when you run "xmcp build" (or "xmcp dev").
|
|
155
153
|
Please re-run the build so the framework can regenerate the bundle.`);let c=l.js,u=l.css,d=(t=`
|
|
156
154
|
<script type="module">
|
|
@@ -205,7 +203,7 @@ Please re-run the build so the framework can regenerate the bundle.`);let c=l.js
|
|
|
205
203
|
<div id="root"></div>
|
|
206
204
|
${t}
|
|
207
205
|
</body>
|
|
208
|
-
</html>`);return{contents:[{uri:i.uri,text:d,mimeType:n,_meta:i._meta}]}}catch(t){throw console.error(`React failed for ${i.name}:`,t),t}let s=i.handler({},r);if(s instanceof Promise&&(s=await s),"string"==typeof s)return{contents:[{uri:i.uri,text:s,mimeType:n,_meta:i._meta}]};if(s&&"object"==typeof s&&"_meta"in s&&!("content"in s))return{contents:[{uri:i.uri,text:"",mimeType:n,_meta:i._meta}]};if(s&&"object"==typeof s&&"content"in s&&Array.isArray(s.content)){let t=s.content.find(t=>"text"===t.type);if(t&&"text"===t.type&&"string"==typeof t.text)return{contents:[{uri:i.uri,text:t.text,mimeType:n,_meta:i._meta}]}}return{contents:[{uri:i.uri,text:"",mimeType:n,_meta:i._meta}]}};u?.(i.name,i.uri),t.registerResource(i.name,i.uri,s,l)}),o.forEach((r,a)=>{let i={name:
|
|
206
|
+
</html>`);return{contents:[{uri:i.uri,text:d,mimeType:n,_meta:i._meta}]}}catch(t){throw console.error(`React failed for ${i.name}:`,t),t}let s=i.handler({},r);if(s instanceof Promise&&(s=await s),"string"==typeof s)return{contents:[{uri:i.uri,text:s,mimeType:n,_meta:i._meta}]};if(s&&"object"==typeof s&&"_meta"in s&&!("content"in s))return{contents:[{uri:i.uri,text:"",mimeType:n,_meta:i._meta}]};if(s&&"object"==typeof s&&"content"in s&&Array.isArray(s.content)){let t=s.content.find(t=>"text"===t.type);if(t&&"text"===t.type&&"string"==typeof t.text)return{contents:[{uri:i.uri,text:t.text,mimeType:n,_meta:i._meta}]}}return{contents:[{uri:i.uri,text:"",mimeType:n,_meta:i._meta}]}};u?.(i.name,i.uri),t.registerResource(i.name,i.uri,s,l)}),o.forEach((r,a)=>{let i={name:hJ(a),description:"No description provided"},{default:n,metadata:o,schema:s,complete:l}=r;if("object"==typeof o&&null!==o&&Object.assign(i,o),!1===i.enabled)return;let c={};hH(s)?c=s:null!=s&&console.warn(`Invalid schema for resource "${i.name}" at ${a}. Expected Record<string, z.ZodType>`);let d=h2(a);if(!d)return void console.warn(`Skipping resource "${i.name}" at ${a}: Invalid file path format`);let p=d.uriTemplate;i.mimeType&&i.mimeType.includes("html")&&(p=p.endsWith(".html")?p:`${p}.html`);let m=function(t,r,a={}){let i=h2(r);if(!i)throw Error(`Invalid resource file path: ${r}. Must follow (scheme)/path/[param] convention.`);return async(r,n)=>{let o=t(function(t,r,a){let i={},n={};if(0===r.parameters.length)return n;let o=r.uriTemplate.split("://")[1]||"",s=t.split("://")[1]||"",l=o.split("/"),c=s.split("/");for(let t=0;t<l.length&&t<c.length;t++){let r=l[t],a=c[t],n=r.match(/^\{(.+)\}$/);n&&(i[n[1]]=a)}for(let t of r.parameters){let r=i[t],o=a[t];if(void 0===r)throw Error(`Missing required parameter: ${t}`);if(!o){n[t]=r;continue}try{n[t]=o.parse(r)}catch(a){throw Error(`Invalid parameter "${t}": ${r}. Validation error: ${a instanceof Error?a.message:String(a)}`)}}return n}(r.href,i,a),n);if(o instanceof Promise&&(o=await o),"string"==typeof o)return{contents:[{uri:r.href,text:o}]};if(!o||"object"!=typeof o||!Array.isArray(o.contents)){let t=null===o?"null":typeof o,r=void 0===o?"undefined":null===o?"null":"object"==typeof o?JSON.stringify(o,null,2):String(o);throw Error(`Resource handler must return a ReadResourceResult or string. Got ${t}: ${r}
|
|
209
207
|
|
|
210
208
|
Expected ReadResourceResult format:
|
|
211
209
|
{
|
|
@@ -214,4 +212,4 @@ Expected ReadResourceResult format:
|
|
|
214
212
|
{ uri: "resource://uri", mimeType: "application/json", text: "json content" },
|
|
215
213
|
{ uri: "resource://uri", blob: base64data }
|
|
216
214
|
]
|
|
217
|
-
}`)}return o.contents.forEach(t=>{t.uri||(t.uri=r.href)}),o}}(n,a,c);if("direct"===d.type)u?.(i.name,p),t.registerResource(i.name,p,
|
|
215
|
+
}`)}return o.contents.forEach(t=>{t.uri||(t.uri=r.href)}),o}}(n,a,c);if("direct"===d.type)u?.(i.name,p),t.registerResource(i.name,p,hU(i),m);else{let r=Object.create(null);for(let t of d.parameters)l&&Object.hasOwn(l,t)&&(r[t]=l[t]);let a=new pp(p,{list:void 0,complete:r}),o=async(t,r,a)=>{let i={};for(let t of d.parameters){let a=r[t],n=c[t];if(void 0===a)throw Error(`Missing required parameter: ${t}. Available variables: ${Object.keys(r)}`);n?i[t]=n.parse(a):i[t]=a}let o=n(i,a);return o instanceof Promise&&(o=await o),"string"==typeof o?{contents:[{uri:t.href,text:o}]}:o};u?.(i.name,a),t.registerResource(i.name,a,hU(i),o)}})}),t}async function ft(){let{toolModules:t,skippedTools:r}=await h4(h5);return h6(r),t}async function fr(){let{promptModules:t,skippedPrompts:r}=await hW(h3);return hY(r),t}async function fa(){let{resourceModules:t,skippedResources:r}=await hQ(h8);return h0(r),t}async function fi(){let{instructions:t,...r}=h7,a=new pd(r,{instructions:t}),i=ft(),n=fr(),o=fa(),[s,l,c]=await Promise.all([i,n,o]);return fe(a,s,l,c)}var fn=a(8583);a.n(fn)().config();let fo=STDIO_CONFIG.debug||!1;if(STDIO_CONFIG.silent){let t=new console.Console(process.stderr,process.stderr);for(let r of["log","debug","info","warn","error","dir","table","trace","assert","time","timeEnd","timeLog","count","countReset","group","groupEnd","groupCollapsed","clear"])console[r]=t[r].bind(t)}hs({clientInfo:void 0},()=>{let t;!function(t,r={}){let a,i=r.legacy??"serve",n=r.transport??new pS,o={phase:"opening"},s=!1,l=()=>s||"closed"===o.phase,p=t=>{try{r.onerror?.(t)}catch{}},m=(t,r,a,i)=>n.send({jsonrpc:"2.0",id:t,error:{code:r,message:a,...void 0!==i&&{data:i}}}).catch(t=>p(pw(t))),h=new pn(r.maxSubscriptions??1024),f=t=>{if(!ot.safeParse(t).success)return;let r=h.routeOutbound(t);if("passthrough"!==r){for(let t of r)n.send({jsonrpc:"2.0",...t}).catch(t=>p(pw(t)));return"handled"}},y=async t=>{if(cD(t)&&"subscriptions/listen"===t.method){let r,a=cq(t.params),i=cA(t.params)?(void 0===a?[]:cM(a))[0]:{key:"_meta",problem:"the per-request envelope is required on protocol revision 2026-07-28"},o=cz(t.params);if(void 0!==i)r={jsonrpc:"2.0",id:t.id,error:{code:-32602,message:`Invalid _meta envelope: ${i.key}: ${i.problem}`}};else if(void 0!==o&&lU.includes(o))r=h.serve(t);else{let a=new cp({supported:[...lU],requested:o??"unknown"});r={jsonrpc:"2.0",id:t.id,error:{code:a.code,message:a.message,data:a.data}}}return await n.send("error"in r?r:{jsonrpc:"2.0",method:r.method,params:r.params}).catch(t=>p(pw(t))),!0}if(ot.safeParse(t).success&&"notifications/cancelled"===t.method){let r=t.params?.requestId;if(void 0!==r&&h.cancel(r))return!0}return!1},g=(t,r,a)=>{let i=function(t,r){switch(t.reason){case"http-method":return cB("http-method","modern-only-method-not-allowed",405,new cc(-32e3,"Method not allowed."),!0);case"batch":return cB("jsonrpc-shape","modern-only-batch-not-supported",400,new cc(cl.InvalidRequest,"Bad Request: JSON-RPC batches are not supported by this endpoint"),!0);case"response":return cB("jsonrpc-shape","modern-only-response-post",400,new cc(cl.InvalidRequest,"Bad Request: JSON-RPC responses cannot be posted to this endpoint"),!0);case"notification":return;case"initialize":case"no-claim":{let a=t.requestedVersion;return cB("era-classification","modern-only-missing-envelope",400,void 0===a?new cc(cl.UnsupportedProtocolVersion,"Unsupported protocol version: the request did not name a protocol version",{supported:[...r]}):new cp({supported:[...r],requested:a}),!0)}}}({kind:"legacy",reason:r,...void 0!==a&&{requestedVersion:a}},lU);return void 0===i?Promise.resolve():(p(Error(`Rejected 2025-era request on a modern-only stdio connection (${i.cell}): ${i.message}`)),m(t.id,i.code,i.message,i.data))},v=async(r,i)=>{let o=await t({era:r}),l=o instanceof pd?o.server:o;"modern"===r&&(c(l,i),u(l,lU),h.setServerCapabilities(l.getCapabilities(),d(l)));let p=new p$(n,()=>{!s&&p!==a&&x()},"modern"===r?f:void 0);return await o.connect(p),{product:o,channel:p}},_=t=>t.product.close().catch(t=>p(pw(t))),b=async t=>{a=t.channel;try{await t.channel.whenRequestsAnswered(3e3)||p(Error("Discarded the probe instance with requests still unanswered after 3000ms; continuing with the fallback")),await t.product.close()}catch(t){p(pw(t))}finally{a=void 0}},S=async t=>{if("closed"===o.phase)return;if("pinned"===o.phase)return"modern"===o.era&&cD(t)&&"initialize"===t.method&&!cG(t.params)?void await g(t,"initialize",null!==t.params&&"object"==typeof t.params&&"string"==typeof t.params.protocolVersion?t.params.protocolVersion:void 0):void("modern"===o.era&&await y(t)||o.instance.channel.deliver(t));if(!cD(t)&&!ot.safeParse(t).success)return void p(Error("Discarded a JSON-RPC response received before the connection negotiated an era"));let r=function(t){let r=t.params;if("initialize"===t.method&&!cG(r)){let t=null!==r&&"object"==typeof r&&"string"==typeof r.protocolVersion?r.protocolVersion:void 0;return{kind:"legacy",reason:"initialize",...void 0!==t&&{requestedVersion:t}}}if(!cA(r))return{kind:"legacy",reason:"no-claim"};let a=cq(r),i=(void 0===a?[]:cM(a))[0];if(void 0!==i)return{kind:"invalid-envelope",issue:i};let n=cz(r);return void 0!==n&&lU.includes(n)?{kind:"modern",revision:n,classification:{era:"modern",revision:n}}:{kind:"unsupported-revision",requested:n??"unknown"}}(t);switch(r.kind){case"invalid-envelope":{let a=`Invalid _meta envelope for protocol revision 2026-07-28: ${r.issue.key}: ${r.issue.problem}`;cD(t)?await m(t.id,cl.InvalidParams,a,{envelope:r.issue}):p(Error(`Discarded a notification with a malformed envelope: ${a}`));return}case"unsupported-revision":if(cD(t)){let a=new cp({supported:[...lU],requested:r.requested});p(a),await m(t.id,a.code,a.message,a.data)}else p(Error(`Discarded a notification claiming unsupported protocol revision ${r.requested}`));return;case"modern":if(cD(t)&&"server/discover"===t.method){if("probe"===o.phase)return void o.instance.channel.deliver(t,{classification:r.classification});let a=await v("modern",r.revision);if(l())return void await _(a);o={phase:"probe",instance:a},a.channel.deliver(t,{classification:r.classification});return}if("probe"===o.phase){if(ot.safeParse(t).success)return void o.instance.channel.deliver(t,{classification:r.classification});o={phase:"pinned",era:"modern",instance:o.instance}}else{let t=await v("modern",r.revision);if(l())return void await _(t);o={phase:"pinned",era:"modern",instance:t}}if(await y(t))return;o.instance.channel.deliver(t,{classification:r.classification});return;case"legacy":{if("reject"===i){cD(t)&&await g(t,r.reason,r.requestedVersion);return}if("probe"===o.phase){if(await b(o.instance),l())return;o={phase:"opening"}}let a=await v("legacy");if(l())return void await _(a);(o={phase:"pinned",era:"legacy",instance:a}).instance.channel.deliver(t);return}}},$=[],w=!1,k=async()=>{if(!w){w=!0;try{for(;$.length>0;){let t=$.shift();try{await S(t)}catch(r){cD(t)&&await m(t.id,cl.InternalError,"Internal server error"),p(pw(r))}}}finally{w=!1}}},x=async()=>{if(s||"closed"===o.phase)return;s=!0;let t=o;for(let t of(o={phase:"closed"},h.teardownAll()))await n.send(t).catch(t=>p(pw(t)));("probe"===t.phase||"pinned"===t.phase)&&await t.instance.product.close().catch(t=>p(pw(t))),await n.close().catch(t=>p(pw(t)))};n.onmessage=t=>{$.push(t),k()},n.onerror=t=>{p(t),("probe"===o.phase||"pinned"===o.phase)&&o.instance.channel.onerror?.(t)},n.onclose=()=>{if(s||"closed"===o.phase)return;s=!0;let t=o;o={phase:"closed"},("probe"===t.phase||"pinned"===t.phase)&&t.instance.product.close().catch(t=>p(pw(t)))},n.start().catch(t=>{throw p(pw(t)),t}).catch(()=>{})}(async()=>{let t=await fi();return t.server.oninitialized=()=>{let r=hl(t.server.getClientVersion());hn({clientInfo:r}),fo&&r&&console.log(`[STDIO] MCP client initialized: ${r.name}@${r.version}`)},t},{legacy:"serve",onerror:fo?t=>console.error("[STDIO] Error:",t):void 0}),fo&&console.log("[STDIO] MCP Server running with STDIO transport"),t=()=>{fo&&console.log("[STDIO] Shutting down STDIO transport"),process.exit(0)},process.on("SIGINT",t),process.on("SIGTERM",t)})})(),{}})());
|