xmcp 1.4.1 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/managed.d.ts +23 -0
- package/dist/client.d.ts +4 -0
- package/dist/client.js +70 -0
- package/dist/config/index.d.ts +105 -32
- package/dist/config/schemas/components.d.ts +54 -0
- package/dist/config/schemas/experimental/index.d.ts +4 -4
- package/dist/config/schemas/index.d.ts +1 -0
- package/dist/config.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +59 -66
- package/dist/runtime/adapter-express.js +83 -88
- package/dist/runtime/adapter-fastify.js +83 -88
- package/dist/runtime/adapter-fetch-cloudflare.js +235 -0
- package/dist/runtime/adapter-fetch.js +239 -0
- package/dist/runtime/adapter-nestjs.js +83 -88
- package/dist/runtime/adapter-nextjs.js +82 -87
- package/dist/runtime/cloudflare-worker.js +87 -92
- package/dist/runtime/http.js +92 -97
- package/dist/runtime/stdio.js +71 -76
- package/dist/runtime/utils/component-visibility.d.ts +10 -0
- package/dist/runtime/utils/execution-logger.d.ts +7 -0
- package/dist/runtime/utils/resources.d.ts +2 -2
- package/dist/runtime/utils/server.d.ts +6 -6
- package/dist/runtime/vercel.js +92 -97
- package/package.json +11 -3
- package/dist/runtime/adapter-tanstack-cloudflare.js +0 -240
- package/dist/runtime/adapter-tanstack.js +0 -244
package/dist/client.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
(()=>{var t,r,o={6507(t,r,o){"use strict";let i=o(5317),a=o(8388),n=o(442);function s(t,r,o){let s=a(t,r,o),l=i.spawn(s.command,s.args,s.options);return n.hookChildProcess(l,s),l}t.exports=s,t.exports.spawn=s,t.exports.sync=function(t,r,o){let s=a(t,r,o),l=i.spawnSync(s.command,s.args,s.options);return l.error=l.error||n.verifyENOENTSync(l.status,s),l},t.exports._parse=a,t.exports._enoent=n},442(t){"use strict";let r="win32"===process.platform;function o(t,r){return Object.assign(Error(`${r} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${r} ${t.command}`,path:t.command,spawnargs:t.args})}function i(t,i){return r&&1===t&&!i.file?o(i.original,"spawn"):null}t.exports={hookChildProcess:function(t,o){if(!r)return;let a=t.emit;t.emit=function(r,n){if("exit"===r){let r=i(n,o);if(r)return a.call(t,"error",r)}return a.apply(t,arguments)}},verifyENOENT:i,verifyENOENTSync:function(t,i){return r&&1===t&&!i.file?o(i.original,"spawnSync"):null},notFoundError:o}},8388(t,r,o){"use strict";let i=o(6928),a=o(3803),n=o(2077),s=o(1880),l="win32"===process.platform,c=/\.(?:com|exe)$/i,u=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;t.exports=function(t,r,o){r&&!Array.isArray(r)&&(o=r,r=null);let d={command:t,args:r=r?r.slice(0):[],options:o=Object.assign({},o),file:void 0,original:{command:t,args:r}};return o.shell?d:function(t){let r;if(!l)return t;let o=(t.file=a(t),(r=t.file&&s(t.file))?(t.args.unshift(t.file),t.command=r,a(t)):t.file),d=!c.test(o);if(t.options.forceShell||d){let r=u.test(o);t.command=i.normalize(t.command),t.command=n.command(t.command),t.args=t.args.map(t=>n.argument(t,r));let a=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${a}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}(d)}},2077(t){"use strict";let r=/([()\][%!^"`<>&|;, *?])/g;t.exports.command=function(t){return t.replace(r,"^$1")},t.exports.argument=function(t,o){return t=(t=(t=`${t}`).replace(/(?=(\\+?)?)\1"/g,'$1$1\\"')).replace(/(?=(\\+?)?)\1$/,"$1$1"),t=(t=`"${t}"`).replace(r,"^$1"),o&&(t=t.replace(r,"^$1")),t}},1880(t,r,o){"use strict";let i=o(9896),a=o(600);t.exports=function(t){let r,o=Buffer.alloc(150);try{r=i.openSync(t,"r"),i.readSync(r,o,0,150,0),i.closeSync(r)}catch(t){}return a(o.toString())}},3803(t,r,o){"use strict";let i=o(6928),a=o(1905),n=o(9695);function s(t,r){let o,s=t.options.env||process.env,l=process.cwd(),c=null!=t.options.cwd,u=c&&void 0!==process.chdir&&!process.chdir.disabled;if(u)try{process.chdir(t.options.cwd)}catch(t){}try{o=a.sync(t.command,{path:s[n({env:s})],pathExt:r?i.delimiter:void 0})}catch(t){}finally{u&&process.chdir(l)}return o&&(o=i.resolve(c?t.options.cwd:"",o)),o}t.exports=function(t){return s(t)||s(t,!0)}},9344(t,r,o){var i;function a(t,r,o){if("function"==typeof r&&(o=r,r={}),!o){if("function"!=typeof Promise)throw TypeError("callback not provided");return new Promise(function(o,i){a(t,r||{},function(t,r){t?i(t):o(r)})})}i(t,r||{},function(t,i){t&&("EACCES"===t.code||r&&r.ignoreErrors)&&(t=null,i=!1),o(t,i)})}o(9896),i="win32"===process.platform||global.TESTING_WINDOWS?o(8541):o(709),t.exports=a,a.sync=function(t,r){try{return i.sync(t,r||{})}catch(t){if(r&&r.ignoreErrors||"EACCES"===t.code)return!1;throw t}}},709(t,r,o){t.exports=a,a.sync=function(t,r){return n(i.statSync(t),r)};var i=o(9896);function a(t,r,o){i.stat(t,function(t,i){o(t,!t&&n(i,r))})}function n(t,r){var o,i,a,n,s,l,c,u,d;return t.isFile()&&(o=t,i=r,a=o.mode,n=o.uid,s=o.gid,l=void 0!==i.uid?i.uid:process.getuid&&process.getuid(),c=void 0!==i.gid?i.gid:process.getgid&&process.getgid(),u=parseInt("100",8),d=parseInt("010",8),a&parseInt("001",8)||a&d&&s===c||a&u&&n===l||a&(u|d)&&0===l)}},8541(t,r,o){t.exports=n,n.sync=function(t,r){return a(i.statSync(t),t,r)};var i=o(9896);function a(t,r,o){if(!t.isSymbolicLink()&&!t.isFile())return!1;var i=void 0!==o.pathExt?o.pathExt:process.env.PATHEXT;if(!i||-1!==(i=i.split(";")).indexOf(""))return!0;for(var a=0;a<i.length;a++){var n=i[a].toLowerCase();if(n&&r.substr(-n.length).toLowerCase()===n)return!0}return!1}function n(t,r,o){i.stat(t,function(i,n){o(i,!i&&a(n,t,r))})}},9695(t){"use strict";let r=(t={})=>{let r=t.env||process.env;return"win32"!==(t.platform||process.platform)?"PATH":Object.keys(r).reverse().find(t=>"PATH"===t.toUpperCase())||"Path"};t.exports=r,t.exports.default=r},600(t,r,o){"use strict";let i=o(9638);t.exports=(t="")=>{let r=t.match(i);if(!r)return null;let[o,a]=r[0].replace(/#! ?/,"").split(" "),n=o.split("/").pop();return"env"===n?a:a?`${n} ${a}`:n}},9638(t){"use strict";t.exports=/^#!(.*)/},1905(t,r,o){let i="win32"===process.platform||"cygwin"===process.env.OSTYPE||"msys"===process.env.OSTYPE,a=o(6928),n=i?";":":",s=o(9344),l=t=>Object.assign(Error(`not found: ${t}`),{code:"ENOENT"}),c=(t,r)=>{let o=r.colon||n,a=t.match(/\//)||i&&t.match(/\\/)?[""]:[...i?[process.cwd()]:[],...(r.path||process.env.PATH||"").split(o)],s=i?r.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",l=i?s.split(o):[""];return i&&-1!==t.indexOf(".")&&""!==l[0]&&l.unshift(""),{pathEnv:a,pathExt:l,pathExtExe:s}},u=(t,r,o)=>{"function"==typeof r&&(o=r,r={}),r||(r={});let{pathEnv:i,pathExt:n,pathExtExe:u}=c(t,r),d=[],p=o=>new Promise((n,s)=>{if(o===i.length)return r.all&&d.length?n(d):s(l(t));let c=i[o],u=/^".*"$/.test(c)?c.slice(1,-1):c,p=a.join(u,t);n(h(!u&&/^\.[\\\/]/.test(t)?t.slice(0,2)+p:p,o,0))}),h=(t,o,i)=>new Promise((a,l)=>{if(i===n.length)return a(p(o+1));let c=n[i];s(t+c,{pathExt:u},(n,s)=>{if(!n&&s)if(!r.all)return a(t+c);else d.push(t+c);return a(h(t,o,i+1))})});return o?p(0).then(t=>o(null,t),o):p(0)};t.exports=u,u.sync=(t,r)=>{let{pathEnv:o,pathExt:i,pathExtExe:n}=c(t,r=r||{}),u=[];for(let l=0;l<o.length;l++){let c=o[l],d=/^".*"$/.test(c)?c.slice(1,-1):c,p=a.join(d,t),h=!d&&/^\.[\\\/]/.test(t)?t.slice(0,2)+p:p;for(let t=0;t<i.length;t++){let o=h+i[t];try{if(s.sync(o,{pathExt:n}))if(!r.all)return o;else u.push(o)}catch(t){}}}if(r.all&&u.length)return u;if(r.nothrow)return null;throw l(t)}},5317(t){"use strict";t.exports=require("child_process")},9896(t){"use strict";t.exports=require("fs")},7598(t){"use strict";t.exports=require("node:crypto")},6928(t){"use strict";t.exports=require("path")},4891(t,r,o){"use strict";let i;o.d(r,{importJWK:()=>B,importPKCS8:()=>W,SignJWT:()=>V});let a=new TextEncoder,n=new TextDecoder;function s(t){let r=new Uint8Array(t.length);for(let o=0;o<t.length;o++){let i=t.charCodeAt(o);if(i>127)throw TypeError("non-ASCII string encountered in encode()");r[o]=i}return r}function l(t){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(t);let r=atob(t),o=new Uint8Array(r.length);for(let t=0;t<r.length;t++)o[t]=r.charCodeAt(t);return o}function c(t){if(Uint8Array.fromBase64)return Uint8Array.fromBase64("string"==typeof t?t:n.decode(t),{alphabet:"base64url"});let r=t;r instanceof Uint8Array&&(r=n.decode(r)),r=r.replace(/-/g,"+").replace(/_/g,"/");try{return l(r)}catch{throw TypeError("The input to be decoded is not correctly encoded.")}}function u(t){let r=t;return("string"==typeof r&&(r=a.encode(r)),Uint8Array.prototype.toBase64)?r.toBase64({alphabet:"base64url",omitPadding:!0}):(function(t){if(Uint8Array.prototype.toBase64)return t.toBase64();let r=[];for(let o=0;o<t.length;o+=32768)r.push(String.fromCharCode.apply(null,t.subarray(o,o+32768)));return btoa(r.join(""))})(r).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}class d extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(t,r){super(t,r),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}class p extends d{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"}class h extends d{static code="ERR_JWS_INVALID";code="ERR_JWS_INVALID"}class m extends d{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"}class f extends d{[Symbol.asyncIterator];static code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";constructor(t="multiple matching keys found in the JSON Web Key Set",r){super(t,r)}}let y=(t,r="algorithm.name")=>TypeError(`CryptoKey does not support this operation, its ${r} must be ${t}`);function g(t,r){if(parseInt(t.hash.name.slice(4),10)!==r)throw y(`SHA-${r}`,"algorithm.hash")}function v(t,r,...o){if((o=o.filter(Boolean)).length>2){let r=o.pop();t+=`one of type ${o.join(", ")}, or ${r}.`}else 2===o.length?t+=`one of type ${o[0]} or ${o[1]}.`:t+=`of type ${o[0]}.`;return null==r?t+=` Received ${r}`:"function"==typeof r&&r.name?t+=` Received function ${r.name}`:"object"==typeof r&&null!=r&&r.constructor?.name&&(t+=` Received an instance of ${r.constructor.name}`),t}let _=(t,r,...o)=>v(`Key for the ${t} algorithm must be `,r,...o);async function b(t,r,o){if(r instanceof Uint8Array){if(!t.startsWith("HS"))throw TypeError(((t,...r)=>v("Key must be ",t,...r))(r,"CryptoKey","KeyObject","JSON Web Key"));return crypto.subtle.importKey("raw",r,{hash:`SHA-${t.slice(-3)}`,name:"HMAC"},!1,[o])}return!function(t,r,o){switch(r){case"HS256":case"HS384":case"HS512":if("HMAC"!==t.algorithm.name)throw y("HMAC");g(t.algorithm,parseInt(r.slice(2),10));break;case"RS256":case"RS384":case"RS512":if("RSASSA-PKCS1-v1_5"!==t.algorithm.name)throw y("RSASSA-PKCS1-v1_5");g(t.algorithm,parseInt(r.slice(2),10));break;case"PS256":case"PS384":case"PS512":if("RSA-PSS"!==t.algorithm.name)throw y("RSA-PSS");g(t.algorithm,parseInt(r.slice(2),10));break;case"Ed25519":case"EdDSA":if("Ed25519"!==t.algorithm.name)throw y("Ed25519");break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":let i;if(i=t.algorithm,i.name!==r)throw y(r);break;case"ES256":case"ES384":case"ES512":{if("ECDSA"!==t.algorithm.name)throw y("ECDSA");let o=function(t){switch(t){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw Error("unreachable")}}(r);if(t.algorithm.namedCurve!==o)throw y(o,"algorithm.namedCurve");break}default:throw TypeError("CryptoKey does not support this operation")}if(o&&!t.usages.includes(o))throw TypeError(`CryptoKey does not support this operation, its usages must include ${o}.`)}(r,t,o),r}async function S(t,r,o){let i=await b(t,r,"sign");return!function(t,r){if(t.startsWith("RS")||t.startsWith("PS")){let{modulusLength:o}=r.algorithm;if("number"!=typeof o||o<2048)throw TypeError(`${t} requires key modulusLength to be 2048 bits or larger`)}}(t,i),new Uint8Array(await crypto.subtle.sign(function(t,r){let o=`SHA-${t.slice(-3)}`;switch(t){case"HS256":case"HS384":case"HS512":return{hash:o,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:o,name:"RSA-PSS",saltLength:parseInt(t.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:o,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:o,name:"ECDSA",namedCurve:r.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return{name:t};default:throw new p(`alg ${t} is not supported either by JOSE or your javascript runtime`)}}(t,i.algorithm),i,o))}function w(t){if("object"!=typeof t||null===t||"[object Object]"!==Object.prototype.toString.call(t))return!1;if(null===Object.getPrototypeOf(t))return!0;let r=t;for(;null!==Object.getPrototypeOf(r);)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(t)===r}let $=t=>w(t)&&"string"==typeof t.kty,P=t=>{if(t?.[Symbol.toStringTag]==="CryptoKey")return!0;try{return t instanceof CryptoKey}catch{return!1}},R=t=>t?.[Symbol.toStringTag]==="KeyObject",E=t=>P(t)||R(t),k=t=>t?.[Symbol.toStringTag],x=(t,r,o)=>{if(void 0!==r.use){let t;switch(o){case"sign":case"verify":t="sig";break;case"encrypt":case"decrypt":t="enc"}if(r.use!==t)throw TypeError(`Invalid key for this operation, its "use" must be "${t}" when present`)}if(void 0!==r.alg&&r.alg!==t)throw TypeError(`Invalid key for this operation, its "alg" must be "${t}" when present`);if(Array.isArray(r.key_ops)){let i;switch(!0){case"sign"===o||"verify"===o:case"dir"===t:case t.includes("CBC-HS"):i=o;break;case t.startsWith("PBES2"):i="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(t):i=!t.includes("GCM")&&t.endsWith("KW")?"encrypt"===o?"wrapKey":"unwrapKey":o;break;case"encrypt"===o&&t.startsWith("RSA"):i="wrapKey";break;case"decrypt"===o:i=t.startsWith("RSA")?"unwrapKey":"deriveBits"}if(i&&r.key_ops?.includes?.(i)===!1)throw TypeError(`Invalid key for this operation, its "key_ops" must include "${i}" when present`)}return!0},T='Invalid or unsupported JWK "alg" (Algorithm) Parameter value';async function O(t){if(!t.alg)throw TypeError('"alg" argument is required when "jwk.alg" is not present');let{algorithm:r,keyUsages:o}=function(t){let r,o;switch(t.kty){case"AKP":switch(t.alg){case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":r={name:t.alg},o=t.priv?["sign"]:["verify"];break;default:throw new p(T)}break;case"RSA":switch(t.alg){case"PS256":case"PS384":case"PS512":r={name:"RSA-PSS",hash:`SHA-${t.alg.slice(-3)}`},o=t.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":r={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${t.alg.slice(-3)}`},o=t.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":r={name:"RSA-OAEP",hash:`SHA-${parseInt(t.alg.slice(-3),10)||1}`},o=t.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new p(T)}break;case"EC":switch(t.alg){case"ES256":case"ES384":case"ES512":r={name:"ECDSA",namedCurve:({ES256:"P-256",ES384:"P-384",ES512:"P-521"})[t.alg]},o=t.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":r={name:"ECDH",namedCurve:t.crv},o=t.d?["deriveBits"]:[];break;default:throw new p(T)}break;case"OKP":switch(t.alg){case"Ed25519":case"EdDSA":r={name:"Ed25519"},o=t.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":r={name:t.crv},o=t.d?["deriveBits"]:[];break;default:throw new p(T)}break;default:throw new p('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:r,keyUsages:o}}(t),i={...t};return"AKP"!==i.kty&&delete i.alg,delete i.use,crypto.subtle.importKey("jwk",i,r,t.ext??(!t.d&&!t.priv),t.key_ops??o)}let C="given KeyObject instance cannot be used for this algorithm",j=async(t,r,o,a=!1)=>{let n=(i||=new WeakMap).get(t);if(n?.[o])return n[o];let s=await O({...r,alg:o});return a&&Object.freeze(t),n?n[o]=s:i.set(t,{[o]:s}),s};async function I(t,r){if(t instanceof Uint8Array||P(t))return t;if(R(t)){if("secret"===t.type)return t.export();if("toCryptoKey"in t&&"function"==typeof t.toCryptoKey)try{return((t,r)=>{let o,a=(i||=new WeakMap).get(t);if(a?.[r])return a[r];let n="public"===t.type,s=!!n;if("x25519"===t.asymmetricKeyType){switch(r){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw TypeError(C)}o=t.toCryptoKey(t.asymmetricKeyType,s,n?[]:["deriveBits"])}if("ed25519"===t.asymmetricKeyType){if("EdDSA"!==r&&"Ed25519"!==r)throw TypeError(C);o=t.toCryptoKey(t.asymmetricKeyType,s,[n?"verify":"sign"])}switch(t.asymmetricKeyType){case"ml-dsa-44":case"ml-dsa-65":case"ml-dsa-87":if(r!==t.asymmetricKeyType.toUpperCase())throw TypeError(C);o=t.toCryptoKey(t.asymmetricKeyType,s,[n?"verify":"sign"])}if("rsa"===t.asymmetricKeyType){let i;switch(r){case"RSA-OAEP":i="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":i="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":i="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":i="SHA-512";break;default:throw TypeError(C)}if(r.startsWith("RSA-OAEP"))return t.toCryptoKey({name:"RSA-OAEP",hash:i},s,n?["encrypt"]:["decrypt"]);o=t.toCryptoKey({name:r.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:i},s,[n?"verify":"sign"])}if("ec"===t.asymmetricKeyType){let i=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(t.asymmetricKeyDetails?.namedCurve);if(!i)throw TypeError(C);let a={ES256:"P-256",ES384:"P-384",ES512:"P-521"};a[r]&&i===a[r]&&(o=t.toCryptoKey({name:"ECDSA",namedCurve:i},s,[n?"verify":"sign"])),r.startsWith("ECDH-ES")&&(o=t.toCryptoKey({name:"ECDH",namedCurve:i},s,n?[]:["deriveBits"]))}if(!o)throw TypeError(C);return a?a[r]=o:i.set(t,{[r]:o}),o})(t,r)}catch(t){if(t instanceof TypeError)throw t}let o=t.export({format:"jwk"});return j(t,o,r)}if($(t))return t.k?c(t.k):j(t,t,r,!0);throw Error("unreachable")}function N(t,r){if(t)throw TypeError(`${r} can only be called once`)}Symbol();class A{#e;#t;#r;constructor(t){if(!(t instanceof Uint8Array))throw TypeError("payload must be an instance of Uint8Array");this.#e=t}setProtectedHeader(t){return N(this.#t,"setProtectedHeader"),this.#t=t,this}setUnprotectedHeader(t){return N(this.#r,"setUnprotectedHeader"),this.#r=t,this}async sign(t,r){let o,i,a,n;if(!this.#t&&!this.#r)throw new h("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!function(...t){let r,o=t.filter(Boolean);if(0===o.length||1===o.length)return!0;for(let t of o){let o=Object.keys(t);if(!r||0===r.size){r=new Set(o);continue}for(let t of o){if(r.has(t))return!1;r.add(t)}}return!0}(this.#t,this.#r))throw new h("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let l={...this.#t,...this.#r},c=function(t,r,o,i,a){let n;if(void 0!==a.crit&&i?.crit===void 0)throw new t('"crit" (Critical) Header Parameter MUST be integrity protected');if(!i||void 0===i.crit)return new Set;if(!Array.isArray(i.crit)||0===i.crit.length||i.crit.some(t=>"string"!=typeof t||0===t.length))throw new t('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');for(let s of(n=void 0!==o?new Map([...Object.entries(o),...r.entries()]):r,i.crit)){if(!n.has(s))throw new p(`Extension Header Parameter "${s}" is not recognized`);if(void 0===a[s])throw new t(`Extension Header Parameter "${s}" is missing`);if(n.get(s)&&void 0===i[s])throw new t(`Extension Header Parameter "${s}" MUST be integrity protected`)}return new Set(i.crit)}(h,new Map([["b64",!0]]),r?.crit,this.#t,l),d=!0;if(c.has("b64")&&"boolean"!=typeof(d=this.#t.b64))throw new h('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:m}=l;if("string"!=typeof m||!m)throw new h('JWS "alg" (Algorithm) Header Parameter missing or invalid');var f="sign";switch(m.substring(0,2)){case"A1":case"A2":case"di":case"HS":case"PB":((t,r,o)=>{if(!(r instanceof Uint8Array)){if($(r)){if("oct"===r.kty&&"string"==typeof r.k&&x(t,r,o))return;throw TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!E(r))throw TypeError(_(t,r,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==r.type)throw TypeError(`${k(r)} instances for symmetric algorithms must be of type "secret"`)}})(m,t,f);break;default:((t,r,o)=>{if($(r))switch(o){case"decrypt":case"sign":if("oct"!==r.kty&&("AKP"===r.kty&&"string"==typeof r.priv||"string"==typeof r.d)&&x(t,r,o))return;throw TypeError("JSON Web Key for this operation must be a private JWK");case"encrypt":case"verify":if("oct"!==r.kty&&void 0===r.d&&void 0===r.priv&&x(t,r,o))return;throw TypeError("JSON Web Key for this operation must be a public JWK")}if(!E(r))throw TypeError(_(t,r,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===r.type)throw TypeError(`${k(r)} instances for asymmetric algorithms must not be of type "secret"`);if("public"===r.type)switch(o){case"sign":throw TypeError(`${k(r)} instances for asymmetric algorithm signing must be of type "private"`);case"decrypt":throw TypeError(`${k(r)} instances for asymmetric algorithm decryption must be of type "private"`)}if("private"===r.type)switch(o){case"verify":throw TypeError(`${k(r)} instances for asymmetric algorithm verifying must be of type "public"`);case"encrypt":throw TypeError(`${k(r)} instances for asymmetric algorithm encryption must be of type "public"`)}})(m,t,f)}d?i=s(o=u(this.#e)):(i=this.#e,o=""),this.#t?n=s(a=u(JSON.stringify(this.#t))):(a="",n=new Uint8Array);let y=function(...t){let r=new Uint8Array(t.reduce((t,{length:r})=>t+r,0)),o=0;for(let i of t)r.set(i,o),o+=i.length;return r}(n,s("."),i),g=await I(t,m),v={signature:u(await S(m,g,y)),payload:o};return this.#r&&(v.header=this.#r),this.#t&&(v.protected=a),v}}class z{#o;constructor(t){this.#o=new A(t)}setProtectedHeader(t){return this.#o.setProtectedHeader(t),this}async sign(t,r){let o=await this.#o.sign(t,r);if(void 0===o.payload)throw TypeError("use the flattened module for creating JWS with b64: false");return`${o.protected}.${o.payload}.${o.signature}`}}let q=t=>Math.floor(t.getTime()/1e3),M=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function L(t){let r,o=M.exec(t);if(!o||o[4]&&o[1])throw TypeError("Invalid time period format");let i=parseFloat(o[2]);switch(o[3].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":r=Math.round(i);break;case"minute":case"minutes":case"min":case"mins":case"m":r=Math.round(60*i);break;case"hour":case"hours":case"hr":case"hrs":case"h":r=Math.round(3600*i);break;case"day":case"days":case"d":r=Math.round(86400*i);break;case"week":case"weeks":case"w":r=Math.round(604800*i);break;default:r=Math.round(0x1e187e0*i)}return"-"===o[1]||"ago"===o[4]?-r:r}function D(t,r){if(!Number.isFinite(r))throw TypeError(`Invalid ${t} input`);return r}class U{#e;constructor(t){if(!w(t))throw TypeError("JWT Claims Set MUST be an object");this.#e=structuredClone(t)}data(){return a.encode(JSON.stringify(this.#e))}get iss(){return this.#e.iss}set iss(t){this.#e.iss=t}get sub(){return this.#e.sub}set sub(t){this.#e.sub=t}get aud(){return this.#e.aud}set aud(t){this.#e.aud=t}set jti(t){this.#e.jti=t}set nbf(t){"number"==typeof t?this.#e.nbf=D("setNotBefore",t):t instanceof Date?this.#e.nbf=D("setNotBefore",q(t)):this.#e.nbf=q(new Date)+L(t)}set exp(t){"number"==typeof t?this.#e.exp=D("setExpirationTime",t):t instanceof Date?this.#e.exp=D("setExpirationTime",q(t)):this.#e.exp=q(new Date)+L(t)}set iat(t){void 0===t?this.#e.iat=q(new Date):t instanceof Date?this.#e.iat=D("setIssuedAt",q(t)):"string"==typeof t?this.#e.iat=D("setIssuedAt",q(new Date)+L(t)):this.#e.iat=D("setIssuedAt",t)}}class V{#t;#i;constructor(t={}){this.#i=new U(t)}setIssuer(t){return this.#i.iss=t,this}setSubject(t){return this.#i.sub=t,this}setAudience(t){return this.#i.aud=t,this}setJti(t){return this.#i.jti=t,this}setNotBefore(t){return this.#i.nbf=t,this}setExpirationTime(t){return this.#i.exp=t,this}setIssuedAt(t){return this.#i.iat=t,this}setProtectedHeader(t){return this.#t=t,this}async sign(t,r){let o=new z(this.#i.data());if(o.setProtectedHeader(this.#t),Array.isArray(this.#t?.crit)&&this.#t.crit.includes("b64")&&!1===this.#t.b64)throw new m("JWTs MUST NOT use unencoded payload");return o.sign(t,r)}}let H=(t,r)=>{if(t.byteLength!==r.length)return!1;for(let o=0;o<t.byteLength;o++)if(t[o]!==r[o])return!1;return!0},F=t=>{let r=t.data[t.pos++];if(128&r){let o=127&r,i=0;for(let r=0;r<o;r++)i=i<<8|t.data[t.pos++];return i}return r},K=(t,r,o)=>{if(t.data[t.pos++]!==r)throw Error(o)},J=(t,r)=>{let o=t.data.subarray(t.pos,t.pos+r);return t.pos+=r,o},Z=async(t,r,o,i)=>{let a,n,s="spki"===t,l=()=>s?["verify"]:["sign"];switch(o){case"PS256":case"PS384":case"PS512":a={name:"RSA-PSS",hash:`SHA-${o.slice(-3)}`},n=l();break;case"RS256":case"RS384":case"RS512":a={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${o.slice(-3)}`},n=l();break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":a={name:"RSA-OAEP",hash:`SHA-${parseInt(o.slice(-3),10)||1}`},n=s?["encrypt","wrapKey"]:["decrypt","unwrapKey"];break;case"ES256":case"ES384":case"ES512":a={name:"ECDSA",namedCurve:({ES256:"P-256",ES384:"P-384",ES512:"P-521"})[o]},n=l();break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":try{let t=i.getNamedCurve(r);a="X25519"===t?{name:"X25519"}:{name:"ECDH",namedCurve:t}}catch(t){throw new p("Invalid or unsupported key format")}n=s?[]:["deriveBits"];break;case"Ed25519":case"EdDSA":a={name:"Ed25519"},n=l();break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":a={name:o},n=l();break;default:throw new p('Invalid or unsupported "alg" (Algorithm) value')}return crypto.subtle.importKey(t,r,a,i?.extractable??!!s,n)};async function W(t,r,o){let i,a,n;if("string"!=typeof t||0!==t.indexOf("-----BEGIN PRIVATE KEY-----"))throw TypeError('"pkcs8" must be PKCS#8 formatted string');return i=/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,a=l(t.replace(i,"")),n=o,r?.startsWith?.("ECDH-ES")&&((n||={}).getNamedCurve=t=>{let r,o={data:t,pos:0};return K(o,48,"Invalid PKCS#8 structure"),F(o),K(o,2,"Expected version field"),r=F(o),o.pos+=r,K(o,48,"Expected algorithm identifier"),F(o),o.pos,(t=>{let r,o=(K(t,6,"Expected algorithm OID"),r=F(t),J(t,r));if(H(o,[43,101,110]))return"X25519";if(!H(o,[42,134,72,206,61,2,1]))throw Error("Unsupported key algorithm");K(t,6,"Expected curve OID");let i=F(t),a=J(t,i);for(let{name:t,oid:r}of[{name:"P-256",oid:[42,134,72,206,61,3,1,7]},{name:"P-384",oid:[43,129,4,0,34]},{name:"P-521",oid:[43,129,4,0,35]}])if(H(a,r))return t;throw Error("Unsupported named curve")})(o)}),Z("pkcs8",a,r,n)}async function B(t,r,o){let i;if(!w(t))throw TypeError("JWK must be an object");switch(r??=t.alg,i??=o?.extractable??t.ext,t.kty){case"oct":if("string"!=typeof t.k||!t.k)throw TypeError('missing "k" (Key Value) Parameter value');return c(t.k);case"RSA":if("oth"in t&&void 0!==t.oth)throw new p('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');return O({...t,alg:r,ext:i});case"AKP":if("string"!=typeof t.alg||!t.alg)throw TypeError('missing "alg" (Algorithm) Parameter value');if(void 0!==r&&r!==t.alg)throw TypeError("JWK alg and alg option value mismatch");return O({...t,ext:i});case"EC":case"OKP":return O({...t,alg:r,ext:i});default:throw new p('Unsupported "kty" (Key Type) Parameter value')}}},8330(t){"use strict";t.exports=JSON.parse('{"name":"xmcp","description":"The MCP framework","version":"1.6.0","author":{"name":"xmcp","email":"support@xmcp.dev","url":"https://xmcp.dev"},"contributors":[{"name":"Valentina Bearzotti","email":"valebearzotti1@gmail.com","url":"https://github.com/valebearzotti"},{"name":"Jose Rago","email":"jose@basement.studio","url":"https://github.com/ragojose"}],"license":"MIT","keywords":["mcp","modelcontextprotocol","http","stdio"],"repository":{"type":"git","url":"https://github.com/basementstudio/xmcp"},"homepage":"https://xmcp.dev","type":"commonjs","main":"./dist/index.js","types":"./dist/index.d.ts","bin":{"xmcp":"dist/cli.js"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js","default":"./dist/index.js"},"./node":{"types":"./dist/node.d.ts","node":"./dist/node.js"},"./host-bridge":{"types":"./dist/host-bridge.d.ts","import":"./dist/host-bridge.js","require":"./dist/host-bridge.js","default":"./dist/host-bridge.js"},"./headers":{"types":"./dist/runtime/headers.d.ts","require":"./dist/runtime/headers.js","default":"./dist/runtime/headers.js"},"./cloudflare":{"types":"./dist/cloudflare.d.ts","import":"./dist/cloudflare.js","require":"./dist/cloudflare.js","default":"./dist/cloudflare.js"},"./config":{"types":"./dist/config/index.d.ts","import":"./dist/config.js","require":"./dist/config.js","default":"./dist/config.js"},"./package.json":"./package.json","./client":{"types":"./dist/client.d.ts","node":"./dist/client.js"}},"typesVersions":{"*":{"node":["dist/node.d.ts"],"host-bridge":["dist/host-bridge.d.ts"],"headers":["dist/runtime/headers.d.ts"],"cloudflare":["dist/cloudflare.d.ts"],"config":["dist/config/index.d.ts"],"client":["dist/client.d.ts"]}},"files":["dist"],"scripts":{"dev":"cross-env NODE_ENV=development tsx --watch --tsconfig ./bundler.tsconfig.json ./bundler/index.ts","build":"cross-env NODE_ENV=production tsx --tsconfig ./bundler.tsconfig.json ./bundler/index.ts","analyze":"cross-env GENERATE_STATS=true pnpm build && pnpm tsx scripts/analyze-rspack-stats.ts","bench":"tsx bench/run.mts","test:config":"pnpm --dir ../compiler test:config","test:adapters":"node --import tsx --test src/runtime/adapters/*/__tests__/*.test.ts","test:runtime":"node --import tsx --test src/runtime/utils/__tests__/*.test.ts src/runtime/utils/ui/__tests__/*.test.ts","test:client":"node --import tsx --test src/client/__tests__/*.test.ts"},"dependencies":{},"devDependencies":{"@modelcontextprotocol/client":"^2.0.0","@modelcontextprotocol/node":"^2.0.0","@modelcontextprotocol/server":"^2.0.0","@nestjs/common":"^11.1.12","@rspack/core":"^1.6.7","@types/async-retry":"^1.4.9","@types/content-type":"^1.1.9","@types/express":"^5.0.6","@types/fs-extra":"^11.0.4","@types/jsonwebtoken":"^9.0.10","@types/node":"^22.19.2","@types/react":"^19.2.7","@types/react-dom":"^19.2.3","async-retry":"^1.3.3","chalk":"^5.6.2","chokidar":"^3.6.0","ci-info":"^4.3.1","commander":"^11.1.0","content-type":"^1.0.5","cross-env":"^7.0.3","del":"^7.1.0","dotenv":"^16.6.1","express":"^4.22.1","fastify":"^5.12.5","fs-extra":"^11.3.2","glob":"^11.1.0","is-docker":"^4.0.0","is-wsl":"^3.1.0","jose":"^6.1.3","json5":"^2.2.3","jsonwebtoken":"^9.0.3","memfs":"^4.51.1","postcss-loader":"^8.2.0","raw-body":"^3.0.2","reflect-metadata":"^0.2.2","rxjs":"^7.8.2","ts-checker-rspack-plugin":"^1.2.1","tsx":"^4.21.0","typescript":"^5.9.3","zod-to-json-schema":"^3.25.0"},"peerDependencies":{"@modelcontextprotocol/client":"^2.0.0","@modelcontextprotocol/server":"^2.0.0","jose":"^6.1.3","react":">=19.0.0","react-dom":">=19.0.0","zod":"^3.25.76 || ^4.0.0"},"peerDependenciesMeta":{"@modelcontextprotocol/client":{"optional":true},"@modelcontextprotocol/server":{"optional":true},"jose":{"optional":true},"react":{"optional":true},"react-dom":{"optional":true}}}')}},i={};function a(t){var r=i[t];if(void 0!==r)return r.exports;var n=i[t]={exports:{}};return o[t](n,n.exports,a),n.exports}r=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,a.t=function(o,i){if(1&i&&(o=this(o)),8&i||"object"==typeof o&&o&&(4&i&&o.__esModule||16&i&&"function"==typeof o.then))return o;var n=Object.create(null);a.r(n);var s={};t=t||[null,r({}),r([]),r(r)];for(var l=2&i&&o;("object"==typeof l||"function"==typeof l)&&!~t.indexOf(l);l=r(l))Object.getOwnPropertyNames(l).forEach(t=>{s[t]=()=>o[t]});return s.default=()=>o,a.d(n,s),n},a.d=(t,r)=>{for(var o in r)a.o(r,o)&&!a.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},a.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r),a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};for(var s in(()=>{"use strict";let t,r,o,i,s,l,c,u,d,p,h,m,f,y,g,v,_,b,S,w;a.r(n),a.d(n,{createClient:()=>hl,withClient:()=>hc});var $,P,R,E,k,x,T,O,C=Object.create,j=Object.defineProperty,I=Object.getOwnPropertyDescriptor,N=Object.getOwnPropertyNames,A=Object.getPrototypeOf,z=Object.prototype.hasOwnProperty,q=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports),M=(t,r,o)=>(o=null!=t?C(A(t)):{},((t,r,o,i)=>{if(r&&"object"==typeof r||"function"==typeof r)for(var a,n=N(r),s=0,l=n.length;s<l;s++)a=n[s],z.call(t,a)||a===o||j(t,a,{get:(t=>r[t]).bind(null,a),enumerable:!(i=I(r,a))||i.enumerable});return t})(!r&&t&&t.__esModule?o:j(o,"default",{value:t,enumerable:!0}),t));let L=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),D=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),U=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),V=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function H(t){let r=Object.values(t).filter(t=>"number"==typeof t);return Object.entries(t).filter(([t,o])=>-1===r.indexOf(+t)).map(([t,r])=>r)}function F(t,r="|"){return t.map(t=>ep(t)).join(r)}function K(t,r){return"bigint"==typeof r?r.toString():r}class J{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 Z(t){return new J(t)}function W(t){let r=+!!t.startsWith("^"),o=t.endsWith("$")?t.length-1:t.length;return t.slice(r,o)}let B=Symbol("evaluating");function G(t,r,o){Object.defineProperty(t,r,{value:o,writable:!0,enumerable:!0,configurable:!0})}function X(t){let r=Object.getOwnPropertyDescriptor(t,"shape");return r?.get?r.get.raw:r?.value}function Y(t){return X(t._zod.def)??t._zod.def.shape}function Q(t,r,o){Object.defineProperty(t,r,{get(){let t=o();return G(this,r,t),t},enumerable:!0,configurable:!0})}function ee(t,r,o){r in t?G(t,r,o):t[r]=o}function et(t,r,o,i){let a=Y(r);for(let n of o){let o=Object.getOwnPropertyDescriptor(a,n);o.enumerable&&(o.get?Q(t,n,()=>{let t=r._zod.def.shape[n];return i?i(t,n):t}):ee(t,n,i?i(o.value,n):o.value))}}function er(...t){let r={};for(let o of t)Object.assign(r,Object.getOwnPropertyDescriptors(o));return Object.defineProperties({},r)}let eo="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function ei(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}let ea=Z(()=>{if(eM.jitless||"undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(t){return!1}});function en(t){if(!1===ei(t))return!1;let r=t.constructor;if(void 0===r||"function"!=typeof r)return!0;let o=r.prototype;return!1!==ei(o)&&!1!==Object.prototype.hasOwnProperty.call(o,"isPrototypeOf")}function es(t){return en(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}let el=new Set(["string","number","symbol"]);function ec(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function eu(t,r,o){let i=new t._zod.constr(r??t._zod.def);return(!r||o?.parent)&&(i._zod.parent=t),i}function ed(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 ep(t){return"bigint"==typeof t?t.toString()+"n":"string"==typeof t?`"${t}"`:`${t}`}let eh={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]},em={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function ef(t,r){let o=Y(t),i=[];for(let t of Reflect.ownKeys(r)){if(!Object.getOwnPropertyDescriptor(o,t)?.enumerable)throw Error(`Unrecognized key: "${String(t)}"`);r[t]&&i.push(t)}return i}function ey(t,r){let o={};et(o,t,Reflect.ownKeys(Y(t)));var i=o,a=r;for(let t of Reflect.ownKeys(a)){let r=Object.getOwnPropertyDescriptor(a,t);r.enumerable&&(r.get?Q(i,t,()=>a[t]):ee(i,t,r.value))}return o}function eg(t,r,o,i="partial"){let a=r._zod.def.checks;if(a&&a.length>0)throw Error(`.${i}() cannot be used on object schemas containing refinements`);let n=o?new Set(ef(r,o)):void 0,s={};return et(s,r,Reflect.ownKeys(Y(r)),t&&((r,o)=>n&&!n.has(o)?r:new t({type:"optional",innerType:r}))),eu(r,er(r._zod.def,{shape:s,checks:[]}))}function ev(t,r=0){if(!0===t.aborted)return!0;for(let o=r;o<t.issues.length;o++)if(t.issues[o]?.continue!==!0)return!0;return!1}function e_(t,r){return r.map(r=>(r.path??(r.path=[]),r.path.unshift(t),r))}function eb(t){return"string"==typeof t?t:t?.message}function eS(t,r,o){var i;for(let a=r;a<t.length;a++)(i=t[a]).schema??(i.schema=o)}function ew(t,r,o){let i=t.inst?._zod?.traits;i?.has("$ZodType")&&(i.has("$ZodCheck")?t.schema??(t.schema=t.inst):t.schema=t.inst);let a=t.schema!==t.inst?t.schema?._zod.def?.error:void 0,n=t.message?t.message:eb(t.inst?._zod.def?.error?.(t))??eb(a?.(t))??eb(r?.error?.(t))??eb(o.customError?.(t))??eb(o.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=n,r?.reportInput&&(s.input=t.input),s}let e$=/[\uD800-\uDBFF]/;function eP(t){let r=t.length;if(!e$.test(t))return r;let o=r;for(let i=0;i<r-1;i++)(64512&t.charCodeAt(i))==55296&&(64512&t.charCodeAt(i+1))==56320&&(o--,i++);return o}function eR(t){return Array.isArray(t)?"array":"string"==typeof t?"string":"unknown"}function eE(...t){let[r,o,i]=t;return"string"==typeof r?{message:r,code:"custom",input:o,inst:i}:{...r}}function ek(t,r,o,i=!0){return Object.defineProperty(t,r,{configurable:!0,writable:!0,enumerable:i,value:o}),o}function ex(t,r){for(let o in t){let i=t[o];Object.defineProperty(r,o,{configurable:!0,enumerable:!0,get(){return ek(this,o,i(this))},set(t){ek(this,o,t)}})}return r}let eT=!1,eO={configurable:!0,get(){eT=!0}};function eC(r,o,i){let a=Object.getPrototypeOf(r._zod);if(o in a&&t!==r._zod){t=void 0;return}t=r._zod,Object.defineProperty(a,o,{configurable:!0,get(){Object.defineProperty(this,o,eO);let t=eT;eT=!1;try{let r=i(this);return eT?delete this[o]:Object.defineProperty(this,o,{configurable:!0,writable:!0,value:r}),eT=eT||t,r}catch(r){throw delete this[o],eT=eT||t,r}},set(t){Object.defineProperty(this,o,{configurable:!0,writable:!0,value:t})}})}let ej=Object.freeze({status:"aborted"}),eI={value:void 0,enumerable:!1},eN="captureStackTrace"in Error?Error:null;function eA(t,r,o,i){function a(t){this.def=t,this.constr=u,this.traits=new Set}a.prototype={};let n=o&&new WeakSet;function s(i,s){if(i._zod){if(i._zod.traits.has(t))return}else{eI.value=new a(s);try{Object.defineProperty(i,"_zod",eI)}finally{eI.value=void 0}}if(i._zod.traits.add(t),r(i,s),n){let t=Object.getPrototypeOf(i),r=i._zod.constr.prototype,a=t;for(;a&&a!==r;)a=Object.getPrototypeOf(a);let s=a??t;if(!n.has(s)){n.add(s);var l=s,c=o;for(let t in c){let r=Object.getOwnPropertyDescriptor(c,t);r.get?Object.defineProperty(l,t,{...r,enumerable:!1}):function(t,r,o){Object.defineProperty(t,r,{configurable:!0,get(){return this==null?o:ek(this,r,o.bind(this))},set(t){ek(this,r,t)}})}(l,t,r.value)}}}let d=u.prototype;for(let t in d)Object.prototype.hasOwnProperty.call(d,t)&&(t in i||(i[t]=d[t].bind(i)))}let l=i?.Parent??Object;class c extends l{}function u(t){let r=i?.Parent?function(t){let r=eN;if(r){let o=r.stackTraceLimit;if("number"==typeof o){try{r.stackTraceLimit=0}catch{return eN=null,new t}try{return new t}finally{r.stackTraceLimit=o}}}return new t}(c):this;s(r,t);let o=r._zod.deferred;if(o){for(let t of o)t();r._zod.deferred=void 0}let a=globalThis.__zod_globalConfig?.postProcessor;return a&&a(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 eq extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(x=globalThis).__zod_globalConfig??(x.__zod_globalConfig={});let eM=globalThis.__zod_globalConfig;function eL(t){return t&&Object.assign(eM,t),eM}class eD extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}let eU="~memo",eV=[];function eH(t){return null!==t&&"object"==typeof t}function eF(t){return t.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}let eK=new WeakMap,eJ=[],eZ={alloc(t,o,i){let a=r;if(!a)return i;r=void 0;let n={value:i,issues:null};return a.set(o.value,n),eJ.push(n),i},guard(t){var r;(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred.push(()=>{let r=t._zod.parse,o=(t,o)=>{var i,a;let n;if("backward"!==o.direction&&(i=o,a=t.value,void 0!==(n=i[eU]?.backEdges)&&eH(a)&&n.has(a)))throw new eD;return r(t,o)};t._zod.parse=o,t._zod.run===r&&(t._zod.run=o)})},attach(t){var o;let i,a,n,s=!1;(o=t._zod).deferred??(o.deferred=[]),t._zod.deferred.push(()=>{let o=t._zod.parse,l=(c,u)=>{let d;if(void 0===i){let r=function t(r,o,i){var a,n;let s=eK.get(r);if(void 0!==s)return 2*!!s;if(o.has(r))return 2;o.add(r);let l=0,c=r=>{if(2!==l&&r?._zod){let a=t(r,o,i);a>l&&(l=a)}},u=t=>{t>l&&(l=t)},d=r._zod.def;switch(d.type){case"object":{let r=X(d);u(r?((r,a)=>{let n=0;for(let s of Reflect.ownKeys(r)){let l=Object.getOwnPropertyDescriptor(r,s);if(a&&!l.enumerable)continue;let c=l.get?1:l.value?._zod?t(l.value,o,i):0;c>n&&(n=c)}return n})(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 a=d._cachedInner??(i?r._zod.innerType:void 0);u(a?t(a,o,!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 o=r.value;if(o&&"object"==typeof o){if(o._zod)c(o);else if(Array.isArray(o))for(let t of o)c(t)}}}return o.delete(r),a=r,1!==(n=l)&&eK.set(a,2===n),n}(t,new Set,!1);if(0===r)return t._zod.parse=o,t._zod.run===l&&(t._zod.run=o),o(c,u);2===r||s?i=!0:s=!0}let p=c.value;if(!eH(p))return o(c,u);let h=u[eU];if(h||(h={buckets:new WeakMap,backEdges:void 0},u[eU]=h),a===u)d=n;else{var m,f;let r;m=h,f=t,(r=m.buckets.get(f))||(r=new WeakMap,m.buckets.set(f,r)),d=r,a=u,n=d}let y=d.get(p);if(y)return c.value=y.value,y.issues?y.issues.length&&c.issues.push(...eF(y.issues)):(c.memo=!0,h.backEdges??(h.backEdges=new WeakSet),h.backEdges.add(y.value)),c;r=d;let g=eJ.length,v=o(c,u);r=void 0;let _=eJ.length>g?eJ.pop():void 0;return v instanceof Promise?v.then(t=>(_&&(_.issues=t.issues.length?eF(t.issues):eV),t)):(_&&(_.issues=v.issues.length?eF(v.issues):eV),v)};t._zod.parse=l,t._zod.run===o&&(t._zod.run=l)})}},eW=/^[cC][0-9a-z]{6,}$/,eB=/^[0-9a-z]+$/,eG=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,eX=/^[0-9a-vA-V]{20}$/,eY=/^[A-Za-z0-9]{27}$/,eQ=/^[a-zA-Z0-9_-]{21}$/,e0=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,e1=/^([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})$/,e2=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)$/,e9=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,e4=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,e5=/^(?:(?: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])$/,e3=/^(([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}|:))$/,e6=/^((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])$/,e8=/^(([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])$/,e7=/^https?$/,te=/^\+[1-9]\d{6,14}$/,tt="(?:(?:\\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])))",tr=($=tt,RegExp(`^${$}$`));function to(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 ti=/^[\s\S]{0,}$/,ta=/^-?\d+$/,tn=/^-?\d+(?:\.\d+)?$/,ts=/^(?:true|false)$/i,tl=/^null$/i,tc=/^[^A-Z]*$/,tu=/^[^a-z]*$/,td=eA("$ZodCheck",(t,r)=>{var o;t._zod??(t._zod={}),t._zod.def=r,(o=t._zod).onattach??(o.onattach=[])}),tp=t=>{let r=t.value;return null!=r&&void 0!==r.length},th={number:"number",bigint:"bigint",object:"date"},tm=eA("$ZodCheckLessThan",(t,r)=>{td.init(t,r);let o=th[typeof r.value];t._zod.check=i=>{(r.inclusive?i.value<=r.value:i.value<r.value)||i.issues.push({origin:th[typeof i.value]??o,code:"too_big",maximum:"object"==typeof r.value?r.value.getTime():r.value,input:i.value,inclusive:r.inclusive,inst:t,continue:!r.abort})}}),tf=eA("$ZodCheckGreaterThan",(t,r)=>{td.init(t,r);let o=th[typeof r.value];t._zod.check=i=>{(r.inclusive?i.value>=r.value:i.value>r.value)||i.issues.push({origin:th[typeof i.value]??o,code:"too_small",minimum:"object"==typeof r.value?r.value.getTime():r.value,input:i.value,inclusive:r.inclusive,inst:t,continue:!r.abort})}}),ty=eA("$ZodCheckMultipleOf",(t,r)=>{td.init(t,r),t._zod.check=o=>{var i;let a,n,s;if(typeof o.value!=typeof r.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof o.value?r.value!==BigInt(0)&&o.value%r.value===BigInt(0):0==(n=Math.round(a=(i=o.value)/r.value),s=4*Number.EPSILON*Math.max(Math.abs(a),1),Math.abs(a-n)<s?0:a-n))||o.issues.push({origin:typeof o.value,code:"not_multiple_of",divisor:r.value,input:o.value,inst:t,continue:!r.abort})}}),tg=eA("$ZodCheckNumberFormat",(t,r)=>{td.init(t,r),r.format=r.format||"float64";let o=r.format?.includes("int"),i=o?"int":"number",[a,n]=eh[r.format];t._zod.check=s=>{let l=s.value;if(o){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<a&&s.issues.push({origin:"number",input:l,code:"too_small",minimum:a,inclusive:!0,inst:t,continue:!r.abort}),l>n&&s.issues.push({origin:"number",input:l,code:"too_big",maximum:n,inclusive:!0,inst:t,continue:!r.abort})}}),tv=eA("$ZodCheckMaxLength",(t,r)=>{var o;td.init(t,r),(o=t._zod.def).when??(o.when=tp),t._zod.check=o=>{let i=o.value,a=i.length;if(("string"==typeof i&&a>r.maximum?eP(i):a)<=r.maximum)return;let n=eR(i);o.issues.push({origin:n,code:"too_big",maximum:r.maximum,inclusive:!0,input:i,inst:t,continue:!r.abort})}}),t_=eA("$ZodCheckMinLength",(t,r)=>{var o;td.init(t,r),(o=t._zod.def).when??(o.when=tp),t._zod.check=o=>{let i=o.value,a=i.length;if(("string"==typeof i&&a>=r.minimum&&a<2*r.minimum?eP(i):a)>=r.minimum)return;let n=eR(i);o.issues.push({origin:n,code:"too_small",minimum:r.minimum,inclusive:!0,input:i,inst:t,continue:!r.abort})}}),tb=eA("$ZodCheckLengthEquals",(t,r)=>{var o;td.init(t,r),(o=t._zod.def).when??(o.when=tp),t._zod.check=o=>{let i=o.value,a=i.length,n="string"==typeof i&&a>=r.length&&a<=2*r.length?eP(i):a;if(n===r.length)return;let s=eR(i),l=n>r.length;o.issues.push({origin:s,...l?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length},inclusive:!0,exact:!0,input:o.value,inst:t,continue:!r.abort})}}),tS=eA("$ZodCheckStringFormat",(t,r)=>{var o,i;td.init(t,r),r.pattern?(o=t._zod).check??(o.check=o=>{r.pattern.lastIndex=0,r.pattern.test(o.value)||o.issues.push({origin:"string",code:"invalid_format",format:r.format,input:o.value,...r.pattern?{pattern:r.pattern.toString()}:{},inst:t,continue:!r.abort})}):(i=t._zod).check??(i.check=()=>{})}),tw=eA("$ZodCheckRegex",(t,r)=>{tS.init(t,r),t._zod.check=o=>{r.pattern.lastIndex=0,r.pattern.test(o.value)||o.issues.push({origin:"string",code:"invalid_format",format:"regex",input:o.value,pattern:r.pattern.toString(),inst:t,continue:!r.abort})}}),t$=eA("$ZodCheckLowerCase",(t,r)=>{r.pattern??(r.pattern=tc),tS.init(t,r)}),tP=eA("$ZodCheckUpperCase",(t,r)=>{r.pattern??(r.pattern=tu),tS.init(t,r)}),tR=eA("$ZodCheckIncludes",(t,r)=>{td.init(t,r);let o=ec(r.includes),i=new RegExp("number"==typeof r.position?`^.{${r.position},}${o}`:o);r.pattern=i,t._zod.check=o=>{o.value.includes(r.includes,r.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:r.includes,input:o.value,inst:t,continue:!r.abort})}}),tE=eA("$ZodCheckStartsWith",(t,r)=>{td.init(t,r);let o=RegExp(`^${ec(r.prefix)}.*`);r.pattern??(r.pattern=o),t._zod.check=o=>{o.value.startsWith(r.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:r.prefix,input:o.value,inst:t,continue:!r.abort})}}),tk=eA("$ZodCheckEndsWith",(t,r)=>{td.init(t,r);let o=RegExp(`.*${ec(r.suffix)}$`);r.pattern??(r.pattern=o),t._zod.check=o=>{o.value.endsWith(r.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:r.suffix,input:o.value,inst:t,continue:!r.abort})}}),tx=eA("$ZodCheckOverwrite",(t,r)=>{td.init(t,r),t._zod.check=t=>{t.value=r.tx(t.value)}});class tT{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),o=Math.min(...r.map(t=>t.length-t.trimStart().length));for(let t of r.map(t=>t.slice(o)).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
|
+
${r.join("\n")}
|
|
3
|
+
};`)(...Object.values(this.closed))}}let tO={major:4,minor:6,patch:5},tC=eA("$ZodType",(t,r)=>{var o;t??(t={}),t._zod.def=r,t._zod.bag=t._zod.bag||{},t._zod.version=tO;let i=t._zod.def.checks,a=t._zod.traits.has("$ZodCheck")?[t,...i??[]]:i?.length?[...i]:[];for(let r of a)for(let o of r._zod.onattach)o(t);if(0===a.length)(o=t._zod).deferred??(o.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let r=(r,o,i)=>{let a;if(r.memo)return r;let n=ev(r);for(let s of o){if(s._zod.def.when){if(function(t,r=0){if(!0===t.aborted)return!0;for(let o=r;o<t.issues.length;o++)if(t.issues[o]?.continue===!1)return!0;return!1}(r)||!s._zod.def.when(r))continue}else if(n)continue;let o=r.issues.length,l=s._zod.check(r);if(l instanceof Promise&&i?.async===!1)throw new ez;if(a||l instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await l,r.issues.length!==o&&(eS(r.issues,o,t),n||(n=ev(r,o)))});else{if(r.issues.length===o)continue;eS(r.issues,o,t),n||(n=ev(r,o))}}return a?a.then(()=>r):r},o=(o,i,n)=>{if(ev(o))return o.aborted=!0,o;let s=r(i,a,n);if(s instanceof Promise){if(!1===n.async)throw new ez;return s.then(r=>t._zod.parse(r,n))}return t._zod.parse(s,n)};t._zod.run=(i,n)=>{if(n.skipChecks)return t._zod.parse(i,n);if("backward"===n.direction){let r=t._zod.parse({value:i.value,issues:[]},{...n,skipChecks:!0});return r instanceof Promise?r.then(t=>o(t,i,n)):o(r,i,n)}let s=t._zod.parse(i,n);if(s instanceof Promise){if(!1===n.async)throw new ez;return s.then(t=>r(t,a,n))}return r(s,a,n)}}},{get"~standard"(){var tj;return tj=this,ek(tj,"~standard",tA(this),!1)},set"~standard"(value){ek(this,"~standard",value)}}),tI=(t,r)=>t.issues.length?{issues:t.issues.map(t=>ew(t,r,eL()))}:{value:t.value};async function tN(t,r){let o={async:!0};return tI(await t._zod.run({value:r,issues:[]},o),o)}function tA(t){return{validate:r=>{let o={async:!1};try{let i=t._zod.run({value:r,issues:[]},o);if(!(i instanceof Promise))return tI(i,o)}catch(t){}return tN(t,r)},vendor:"zod",version:1}}let tz=eA("$ZodString",(t,r)=>{tC.init(t,r),t._zod.pattern=r.pattern??ti,t._zod.parse=(o,i)=>{if(r.coerce)try{o.value=String(o.value)}catch(t){}return"string"==typeof o.value||o.issues.push({expected:"string",code:"invalid_type",input:o.value,inst:t}),o}}),tq=eA("$ZodStringFormat",(t,r)=>{tS.init(t,r),tz.init(t,r)}),tM=eA("$ZodGUID",(t,r)=>{r.pattern??(r.pattern=e1),tq.init(t,r)}),tL=eA("$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=e2(t))}else r.pattern??(r.pattern=e2());tq.init(t,r)}),tD=eA("$ZodEmail",(t,r)=>{r.pattern??(r.pattern=e9),tq.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 tV=/[\t\n\r]/g;function tH(t){return t.replace(tV,"")}let tF=eA("$ZodURL",(t,r)=>{tq.init(t,r),t._zod.check=o=>{try{var i,a,n,s,l,c;let u=o.value.trim(),d=(i=u,a=r,"normalize"in a||"hostname"in a||"protocol"in a?function(t,r){if(!r.normalize&&r.protocol?.source===e7.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}}(i,a):tU(i)||2);if(1===d)return void o.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:o.value,inst:t,continue:!r.abort});if(2===d)return void o.issues.push({code:"invalid_format",format:"url",input:o.value,inst:t,continue:!r.abort});if(!0===d){o.value=tH(u);return}r.hostname&&(n=d,(s=r.hostname).lastIndex=0,!s.test(n.hostname))&&o.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:r.hostname.source,input:o.value,inst:t,continue:!r.abort}),r.protocol&&(l=d,(c=r.protocol).lastIndex=0,!c.test(l.protocol.endsWith(":")?l.protocol.slice(0,-1):l.protocol))&&o.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:r.protocol.source,input:o.value,inst:t,continue:!r.abort}),o.value=r.normalize?d.href:tH(u);return}catch(i){o.issues.push({code:"invalid_format",format:"url",input:o.value,inst:t,continue:!r.abort})}}}),tK=eA("$ZodEmoji",(t,r)=>{r.pattern??(r.pattern=RegExp(e4,"u")),tq.init(t,r)}),tJ=eA("$ZodNanoID",(t,r)=>{var o;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?eQ:(o=r.length,RegExp(`^[a-zA-Z0-9_-]{${o}}$`))),tq.init(t,r)}),tZ=eA("$ZodCUID",(t,r)=>{r.pattern??(r.pattern=eW),tq.init(t,r)}),tW=eA("$ZodCUID2",(t,r)=>{r.pattern??(r.pattern=eB),tq.init(t,r)}),tB=eA("$ZodULID",(t,r)=>{r.pattern??(r.pattern=eG),tq.init(t,r)}),tG=eA("$ZodXID",(t,r)=>{r.pattern??(r.pattern=eX),tq.init(t,r)}),tX=eA("$ZodKSUID",(t,r)=>{r.pattern??(r.pattern=eY),tq.init(t,r)}),tY=eA("$ZodISODateTime",(t,r)=>{var o;let i,a,n;r.pattern??(i=["Z"],(o=r).offset&&i.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)"),a=`${to({precision:o.precision,seconds:!0})}(?:${i.join("|")})`,n=o.local?`${a}|${to({precision:o.precision})}`:a,r.pattern=RegExp(`^${tt}T(?:${n})$`)),tq.init(t,r)}),tQ=eA("$ZodISODate",(t,r)=>{r.pattern??(r.pattern=tr),tq.init(t,r)}),t0=eA("$ZodISOTime",(t,r)=>{var o;r.pattern??(o=r,r.pattern=RegExp(`^${to(o)}$`)),tq.init(t,r)}),t1=eA("$ZodISODuration",(t,r)=>{r.pattern??(r.pattern=e0),tq.init(t,r)}),t2=eA("$ZodIPv4",(t,r)=>{r.pattern??(r.pattern=e5),tq.init(t,r)}),t9=/^[0-9a-fA-F:.]+$/;function t4(t){return!!t9.test(t)&&tU(`http://[${t}]`)}let t5=eA("$ZodIPv6",(t,r)=>{r.pattern??(r.pattern=e3),tq.init(t,r),t._zod.check=o=>{t4(o.value)||o.issues.push({code:"invalid_format",format:"ipv6",input:o.value,inst:t,continue:!r.abort})}}),t3=eA("$ZodCIDRv4",(t,r)=>{r.pattern??(r.pattern=e6),tq.init(t,r)}),t6=eA("$ZodCIDRv6",(t,r)=>{r.pattern??(r.pattern=e8),tq.init(t,r),t._zod.check=o=>{!function(t){let r=t.split("/");if(2!==r.length)return!1;let[o,i]=r;if(!i)return!1;let a=Number(i);return`${a}`===i&&!(a<0)&&!(a>128)&&t4(o)}(o.value)&&o.issues.push({code:"invalid_format",format:"cidrv6",input:o.value,inst:t,continue:!r.abort})}});function t8(t){if(""===t)return!0;if(/\s/.test(t)||t.length%4!=0)return!1;try{return atob(t),!0}catch{return!1}}let t7=/^[0-9a-zA-Z+/]*={0,2}$/,re=eA("$ZodBase64",(t,r)=>{r.pattern??(r.pattern=t7),tq.init(t,r),t._zod.check=o=>{t8(o.value)||o.issues.push({code:"invalid_format",format:"base64",input:o.value,inst:t,continue:!r.abort})}}),rt=/^[A-Za-z0-9_-]*$/,rr=eA("$ZodBase64URL",(t,r)=>{r.pattern??(r.pattern=rt),tq.init(t,r),t._zod.check=o=>{!function(t){if(!rt.test(t))return!1;let r=t.replace(/[-_]/g,t=>"-"===t?"+":"/");return t8(r.padEnd(4*Math.ceil(r.length/4),"="))}(o.value)&&o.issues.push({code:"invalid_format",format:"base64url",input:o.value,inst:t,continue:!r.abort})}}),ro=eA("$ZodE164",(t,r)=>{r.pattern??(r.pattern=te),tq.init(t,r)}),ri=eA("$ZodJWT",(t,r)=>{tq.init(t,r),t._zod.check=o=>{!function(t,r=null){try{let o=t.split(".");if(3!==o.length)return!1;let[i]=o;if(!i)return!1;let a=JSON.parse(atob(i));if("typ"in a&&a?.typ!=="JWT"||!a.alg||r&&(!("alg"in a)||a.alg!==r))return!1;return!0}catch{return!1}}(o.value,r.alg)&&o.issues.push({code:"invalid_format",format:"jwt",input:o.value,inst:t,continue:!r.abort})}}),ra=eA("$ZodNumber",(t,r)=>{tC.init(t,r),t._zod.pattern=tn,t._zod.parse=(o,i)=>{if(r.coerce)try{o.value=Number(o.value)}catch(t){}let a=o.value;if("number"==typeof a&&!Number.isNaN(a)&&Number.isFinite(a))return o;let n="number"==typeof a?Number.isNaN(a)?"NaN":Number.isFinite(a)?void 0:String(a):void 0;return o.issues.push({expected:"number",code:"invalid_type",input:a,inst:t,...n?{received:n}:{}}),o}}),rn=eA("$ZodNumberFormat",(t,r)=>{tg.init(t,r),ra.init(t,r)}),rs=eA("$ZodBoolean",(t,r)=>{tC.init(t,r),t._zod.pattern=ts,t._zod.parse=(o,i)=>{if(r.coerce)try{o.value=!!o.value}catch(t){}let a=o.value;return"boolean"==typeof a||o.issues.push({expected:"boolean",code:"invalid_type",input:a,inst:t}),o}}),rl=eA("$ZodNull",(t,r)=>{tC.init(t,r),t._zod.pattern=tl,t._zod.values=new Set([null]),t._zod.parse=(r,o)=>{let i=r.value;return null===i||r.issues.push({expected:"null",code:"invalid_type",input:i,inst:t}),r}}),rc=eA("$ZodAny",(t,r)=>{tC.init(t,r),t._zod.parse=t=>t}),ru=eA("$ZodUnknown",(t,r)=>{tC.init(t,r),t._zod.parse=t=>t}),rd=eA("$ZodNever",(t,r)=>{tC.init(t,r),t._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function rp(t,r,o){t.issues.length&&r.issues.push(...e_(o,t.issues)),r.value[o]=t.value}let rh=eA("$ZodArray",(t,r)=>{tC.init(t,r);let o=eM.memoizer;o?.attach(t),t._zod.parse=(i,a)=>{let n=i.value;if(!Array.isArray(n))return i.issues.push({expected:"array",code:"invalid_type",input:n,inst:t}),i;i.value=o?o.alloc(t,i,Array(n.length),a):Array(n.length);let s=[],l=a?.abortEarly;for(let t=0;t<n.length;t++){let o=n[t],c=r.element._zod.run({value:o,issues:[]},a);if(c instanceof Promise)s.push(c.then(r=>rp(r,i,t)));else if(rp(c,i,t),l&&0!==c.issues.length&&ev(c))break}return s.length?Promise.all(s).then(()=>i):i}});function rm(t,r,o,i,a,n){let s=o in i,l="optional"===n;if(s||!l||"optional"!==a){if(t.issues.length){if(void 0!==a&&l&&!s)return;r.issues.push(...e_(o,t.issues))}if(!s&&void 0===a){t.issues.length||r.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[o]});return}void 0===t.value?(s||"defaulted"===a&&!l)&&(r.value[o]=void 0):r.value[o]=t.value}}let rf=[];function ry(t){var r;let o=Object.keys(t.shape),i=Object.getOwnPropertySymbols(t.shape),a=i.length?i:rf,n=a.length?[...o,...a]:o;for(let r of n)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:n,symbolKeys:a,keySet:new Set(o),numKeys:o.length,optionalKeys:new Set(s)}}function rg(t,r,o,i,a,n,s){let l=[],c=a.keySet,u=a.catchall._zod,d=u.def.type,p=u.optin,h=u.optout,m=0;for(let a in r){if(s&&o.issues.length!==m){if(ev(o,m))break;m=o.issues.length}if(c.has(a))continue;if("__proto__"===a){"never"===d&&l.push(a);continue}if("never"===d){l.push(a);continue}let n=u.run({value:r[a],issues:[]},i);n instanceof Promise?t.push(n.then(t=>rm(t,o,a,r,p,h))):rm(n,o,a,r,p,h)}return(l.length&&o.issues.push({code:"unrecognized_keys",keys:l,input:r,inst:n,continue:!0}),t.length)?Promise.all(t).then(()=>o):o}let rv=eA("$ZodObject",(t,r)=>{let o;tC.init(t,r);let i=Object.getOwnPropertyDescriptor(r,"shape"),a=i?.get?i.get.raw:r.shape??{};if(a){let t=()=>{let o={...a};return Object.defineProperty(r,"shape",{value:o}),t.raw=o,o};t.raw=a,Object.defineProperty(r,"shape",{get:t})}let n=Z(()=>ry(r));eC(t,"propValues",t=>{let r=t.def.shape,o={};for(let t in r){let i=r[t]._zod;if(i.values){for(let r of(Object.prototype.hasOwnProperty.call(o,t)||G(o,t,new Set),i.values))o[t].add(r);void 0!==i.optin&&o[t].add(void 0)}}return o});let s=r.catchall,l=eM.memoizer;l?.attach(t),t._zod.parse=(r,i)=>{o??(o=n.value);let a=r.value;if(!ei(a))return r.issues.push({expected:"object",code:"invalid_type",input:a,inst:t}),r;r.value=l?l.alloc(t,r,{},i):{};let c=[],u=o.shape,d=i?.abortEarly,p=r.issues.length;for(let t of o.allKeys){if(d&&r.issues.length!==p){if(ev(r,p))break;p=r.issues.length}if("__proto__"===t)continue;let o=u[t],n=o._zod.optin,s=o._zod.optout,l=o._zod.run({value:a[t],issues:[]},i);l instanceof Promise?c.push(l.then(o=>rm(o,r,t,a,n,s))):rm(l,r,t,a,n,s)}return s?rg(c,a,r,i,n.value,t,!0===d):c.length?Promise.all(c).then(()=>r):r}}),r_=eA("$ZodObjectJIT",(t,r)=>{let o,i;rv.init(t,r);let a=t._zod.parse,n=Z(()=>ry(r)),s=eM.memoizer,l=!eM.jitless,c=l&&ea.value,u=r.catchall;t._zod.parse=(d,p)=>{i??(i=n.value);let h=d.value;return ei(h)?l&&c&&p?.async===!1&&!0!==p.jitless?(o||(o=(r=>{let o=n.value,i=o.symbolKeys,a=new tT(["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
|
+
let ${t}_ab = false;
|
|
5
|
+
for (let i = 0; i < ${t}.issues.length; i++) {
|
|
6
|
+
const iss = ${t}.issues[i];
|
|
7
|
+
iss.path = iss.path ? [${r}, ...iss.path] : [${r}];
|
|
8
|
+
payload.issues.push(iss);
|
|
9
|
+
if (iss.continue !== true) ${t}_ab = true;
|
|
10
|
+
}
|
|
11
|
+
if (${t}_ab && ctx && ctx.abortEarly) {
|
|
12
|
+
payload.value = newResult;
|
|
13
|
+
return payload;
|
|
14
|
+
}`;a.write("const input = payload.value;");let u=Object.create(null),d=0;for(let t of o.allKeys)u[t]=`key_${d++}`;for(let t of(a.write(s?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};"),o.allKeys)){if("__proto__"===t)continue;let o=u[t],n="symbol"==typeof t?`syms[${i.indexOf(t)}]`:JSON.stringify(t),s=`${n} in input`,d=r[t],p=d?._zod?.optin,h=void 0!==p,m=d?._zod?.optout==="optional";if(a.write(`const ${o} = ${l(n)};`),h&&m){let t="optional"===p?`${o}_present`:`${o}.value !== undefined || ${o}_present`;a.write(`
|
|
15
|
+
const ${o}_present = ${s};
|
|
16
|
+
if (!${o}.issues.length || ${o}_present) {
|
|
17
|
+
if (${o}.issues.length) {${c(o,n)}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (${t}) {
|
|
21
|
+
newResult[${n}] = ${o}.value;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
`)}else h?(a.write(`
|
|
26
|
+
if (${o}.issues.length) {${c(o,n)}
|
|
27
|
+
}
|
|
28
|
+
`),"defaulted"===p?a.write(`newResult[${n}] = ${o}.value;`):a.write(`
|
|
29
|
+
if (${o}.value !== undefined || ${s}) {
|
|
30
|
+
newResult[${n}] = ${o}.value;
|
|
31
|
+
}
|
|
32
|
+
`)):a.write(`
|
|
33
|
+
const ${o}_present = ${s};
|
|
34
|
+
if (${o}.issues.length) {${c(o,n)}
|
|
35
|
+
}
|
|
36
|
+
if (!${o}_present && !${o}.issues.length) {
|
|
37
|
+
payload.issues.push({
|
|
38
|
+
code: "invalid_type",
|
|
39
|
+
expected: "nonoptional",
|
|
40
|
+
input: undefined,
|
|
41
|
+
path: [${n}]
|
|
42
|
+
});
|
|
43
|
+
if (ctx && ctx.abortEarly) {
|
|
44
|
+
payload.value = newResult;
|
|
45
|
+
return payload;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (${o}_present) {
|
|
50
|
+
newResult[${n}] = ${o}.value;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
`)}return a.write("payload.value = newResult;"),a.write("return payload;"),a.compile()})(r.shape)),d=o(d,p),u)?rg([],h,d,p,i,t,p?.abortEarly===!0):d:a(d,p):(d.issues.push({expected:"object",code:"invalid_type",input:h,inst:t}),d)}});function rb(t,r,o,i){for(let o of t)if(0===o.issues.length)return r.value=o.value,r;let a=t.filter(t=>!ev(t));return 1===a.length?(r.value=a[0].value,a[0]):(r.issues.push({code:"invalid_union",input:r.value,inst:o,errors:t.map(t=>t.issues.map(t=>ew(t,i,eL())))}),r)}let rS=eA("$ZodUnion",(t,r)=>{tC.init(t,r),eC(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),eC(t,"optout",t=>t.def.options.some(t=>"optional"===t._zod.optout)?"optional":void 0),eC(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)))}),eC(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=>W(t.source)).join("|")})$`)}});let o=1===r.options.length?r.options[0]._zod.run:null;t._zod.parse=(i,a)=>{if(o)return o(i,a);let n=!1,s=[];for(let t of r.options){let r=t._zod.run({value:i.value,issues:[]},a);if(r instanceof Promise)s.push(r),n=!0;else{if(0===r.issues.length)return r;s.push(r)}}return n?Promise.all(s).then(r=>rb(r,i,t,a)):rb(s,i,t,a)}}),rw=eA("$ZodDiscriminatedUnion",(t,r)=>{r.inclusive=!1,rS.init(t,r);let o=t._zod.parse;eC(t,"propValues",t=>{let r={},o=0;for(let i of t.def.options){let a=i._zod.propValues;if(!a||0===Object.keys(a).length)throw Error(`Invalid discriminated union option at index "${t.def.options.indexOf(i)}"`);for(let[i,n]of(a[t.def.discriminator]?.has(void 0)&&o++,Object.entries(a)))for(let t of(Object.prototype.hasOwnProperty.call(r,i)||G(r,i,new Set),n))r[i].add(t)}return!t.def.unionFallback&&o>1&&r[t.def.discriminator]?.delete(void 0),r}),r.options.forEach((t,o)=>{let i=X(t._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,r.discriminator))throw Error(`Invalid discriminated union option at index "${o}"`)});let i=Z(()=>(function(t){let r=new Map;for(let o of t.options){let i=o._zod.propValues?.[t.discriminator];if(!i||0===i.size)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);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,o)}return r})(r));t._zod.parse=(a,n)=>{let s=a.value;if(!ei(s))return a.issues.push({code:"invalid_type",expected:"object",input:s,inst:t}),a;let l=s?.[r.discriminator],c=i.value.get(l);return c&&(void 0!==l||"backward"!==n.direction)?c._zod.run(a,n):r.unionFallback||"backward"===n.direction?o(a,n):(a.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}),a)}}),r$=eA("$ZodIntersection",(t,r)=>{tC.init(t,r),t._zod.parse=(t,o)=>{let i=t.value,a=r.left._zod.run({value:i,issues:[]},o),n=r.right._zod.run({value:i,issues:[]},o);return a instanceof Promise||n instanceof Promise?Promise.all([a,n]).then(([r,o])=>rP(t,r,o)):rP(t,a,n)}});function rP(t,r,o){let i,a=new Map,n=new Map,s=(t,r)=>{let o;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]);n.has(r)||n.set(r,t),o=[r]}else i??(i=t),o=t.keys;for(let t of o)a.has(t)||a.set(t,{}),a.get(t)[r]=!0;return!0};for(let o of r.issues)s(o,"l")||t.issues.push(o);for(let r of o.issues)s(r,"r")||t.issues.push(r);let l=[...a].filter(([,t])=>t.l&&t.r).map(([t])=>t);if(l.length){let r=i?l.filter(t=>i.keys.includes(t)):[];for(let o of(r.length&&t.issues.push({...i,keys:r}),l))!r.includes(o)&&n.has(o)&&t.issues.push(n.get(o))}let c=function t(r,o){if(r===o||r instanceof Date&&o instanceof Date&&+r==+o)return{valid:!0,data:r};if(en(r)&&en(o)){let i=Object.keys(o),a=Object.keys(r).filter(t=>-1!==i.indexOf(t)),n={...r,...o};for(let i of(Object.prototype.hasOwnProperty.call(n,"__proto__")&&delete n.__proto__,a)){if("__proto__"===i)continue;let a=t(r[i],o[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};n[i]=a.data}return{valid:!0,data:n}}if(Array.isArray(r)&&Array.isArray(o)){if(r.length!==o.length)return{valid:!1,mergeErrorPath:[]};let i=[];for(let a=0;a<r.length;a++){let n=r[a],s=t(n,o[a]);if(!s.valid)return{valid:!1,mergeErrorPath:[a,...s.mergeErrorPath]};i.push(s.data)}return{valid:!0,data:i}}return{valid:!1,mergeErrorPath:[]}}(r.value,o.value);if(!c.valid){if(ev(t))return t;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return t.value=c.data,t}let rR=eA("$ZodRecord",(t,r)=>{tC.init(t,r);let o=eM.memoizer;o?.attach(t),t._zod.parse=(i,a)=>{let n=i.value;if(!en(n))return i.issues.push({expected:"record",code:"invalid_type",input:n,inst:t}),i;let s=[],l=r.keyType._zod.values;if(l&&!r.partial){let c;i.value=o?o.alloc(t,i,{},a):{};let u=new Set;for(let o of l)if("string"==typeof o||"number"==typeof o||"symbol"==typeof o){if(u.add("number"==typeof o?o.toString():o),"__proto__"===o)continue;let l=r.keyType._zod.run({value:o,issues:[]},a);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=>ew(t,a,eL())),input:o,path:[o],inst:t});continue}let c=l.value;if("__proto__"===c)continue;let d=r.valueType._zod.run({value:n[o],issues:[]},a);d instanceof Promise?s.push(d.then(t=>{t.issues.length&&i.issues.push(...e_(o,t.issues)),i.value[c]=t.value})):(d.issues.length&&i.issues.push(...e_(o,d.issues)),i.value[c]=d.value)}for(let t in n)if(!u.has(t))if("loose"===r.mode){if("__proto__"===t)continue;i.value[t]=n[t]}else(c=c??[]).push(t);c&&c.length>0&&i.issues.push({code:"unrecognized_keys",input:n,inst:t,keys:c,continue:!0})}else{let c;for(let u of(i.value=o?o.alloc(t,i,{},a):{},Reflect.ownKeys(n))){if("__proto__"===u||!Object.prototype.propertyIsEnumerable.call(n,u))continue;let o=r.keyType._zod.run({value:u,issues:[]},a);if(o instanceof Promise)throw Error("Async schemas not supported in object keys currently");if("string"==typeof u&&tn.test(u)&&o.issues.length){let t=r.keyType._zod.run({value:Number(u),issues:[]},a);if(t instanceof Promise)throw Error("Async schemas not supported in object keys currently");0===t.issues.length&&(o=t)}if(o.issues.length){"loose"===r.mode?i.value[u]=n[u]:l?(c=c??[]).push(u):i.issues.push({code:"invalid_key",origin:"record",issues:o.issues.map(t=>ew(t,a,eL())),input:u,path:[u],inst:t});continue}let d=o.value;if("__proto__"===d)continue;let p=r.valueType._zod.run({value:n[u],issues:[]},a);p instanceof Promise?s.push(p.then(t=>{t.issues.length&&i.issues.push(...e_(u,t.issues)),i.value[d]=t.value})):(p.issues.length&&i.issues.push(...e_(u,p.issues)),i.value[d]=p.value)}c&&c.length>0&&i.issues.push({code:"unrecognized_keys",input:n,inst:t,keys:c,continue:!0})}return s.length?Promise.all(s).then(()=>i):i}}),rE=eA("$ZodEnum",(t,r)=>{tC.init(t,r);let o=H(r.entries),i=new Set(o);t._zod.values=i,eC(t,"pattern",t=>{let r=H(t.def.entries).filter(t=>el.has(typeof t));return new RegExp(r.length?`^(${r.map(t=>ec(t.toString())).join("|")})$`:"^[^\\s\\S]$")}),t._zod.parse=(r,a)=>{let n=r.value;return i.has(n)||r.issues.push({code:"invalid_value",values:o,input:n,inst:t}),r}}),rk=eA("$ZodLiteral",(t,r)=>{tC.init(t,r);let o=new Set(r.values);t._zod.values=o,eC(t,"pattern",t=>{let r=t.def.values;return new RegExp(r.length?`^(${r.map(t=>"string"==typeof t?ec(t):t?ec(t.toString()):String(t)).join("|")})$`:"^[^\\s\\S]$")}),t._zod.parse=(i,a)=>{let n=i.value;return o.has(n)||i.issues.push({code:"invalid_value",values:r.values,input:n,inst:t}),i}}),rx=eA("$ZodTransform",(t,r)=>{tC.init(t,r),t._zod.optin="optional",eM.memoizer?.guard(t),t._zod.parse=(o,i)=>{if("backward"===i.direction)throw new eq(t.constructor.name);let a=r.transform(o.value,o);if(i.async)return(a instanceof Promise?a:Promise.resolve(a)).then(t=>(o.value=t,o));if(a instanceof Promise)throw new ez;return o.value=a,o}});function rT(t,r){return t.value=r.issues.length?void 0:r.value,t}let rO=eA("$ZodOptional",(t,r)=>{tC.init(t,r),eC(t,"optin",t=>"defaulted"===t.def.innerType._zod.optin?"defaulted":"optional"),t._zod.optout="optional",eC(t,"values",t=>{let r=t.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),eC(t,"pattern",t=>{let r=t.def.innerType._zod.pattern;return r?RegExp(`^(${W(r.source)})?$`):void 0}),t._zod.parse=(t,o)=>{if(void 0===t.value){if("defaulted"!==r.innerType._zod.optin)return t;let i=r.innerType._zod.run({value:t.value,issues:[]},o);return i instanceof Promise?i.then(r=>rT(t,r)):rT(t,i)}return r.innerType._zod.run(t,o)}}),rC=eA("$ZodExactOptional",(t,r)=>{rO.init(t,r),eC(t,"values",t=>t.def.innerType._zod.values),eC(t,"pattern",t=>t.def.innerType._zod.pattern),t._zod.parse=(t,o)=>r.innerType._zod.run(t,o)}),rj=eA("$ZodNullable",(t,r)=>{tC.init(t,r),eC(t,"optin",t=>t.def.innerType._zod.optin),eC(t,"optout",t=>t.def.innerType._zod.optout),eC(t,"pattern",t=>{let r=t.def.innerType._zod.pattern;return r?RegExp(`^(${W(r.source)}|null)$`):void 0}),eC(t,"values",t=>t.def.innerType._zod.values?new Set([...t.def.innerType._zod.values,null]):void 0),t._zod.parse=(t,o)=>null===t.value?t:r.innerType._zod.run(t,o)}),rI=eA("$ZodDefault",(t,r)=>{tC.init(t,r),t._zod.optin="defaulted",eC(t,"values",t=>t.def.innerType._zod.values),t._zod.parse=(t,o)=>{if("backward"===o.direction)return r.innerType._zod.run(t,o);if(void 0===t.value)return t.value=r.defaultValue,t;let i=r.innerType._zod.run(t,o);return i instanceof Promise?i.then(t=>rN(t,r)):rN(i,r)}});function rN(t,r){return void 0===t.value&&(t.value=r.defaultValue),t}let rA=eA("$ZodPrefault",(t,r)=>{tC.init(t,r),t._zod.optin="defaulted",eC(t,"values",t=>t.def.innerType._zod.values),t._zod.parse=(t,o)=>("backward"===o.direction||void 0===t.value&&(t.value=r.defaultValue),r.innerType._zod.run(t,o))}),rz=eA("$ZodNonOptional",(t,r)=>{tC.init(t,r),eC(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=(o,i)=>{let a=r.innerType._zod.run(o,i);return a instanceof Promise?a.then(r=>rq(r,t)):rq(a,t)}});function rq(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 rM(t,r,o,i){return r.issues.length?t.value=o.catchValue({...r,value:t.value,error:{issues:r.issues.map(t=>ew(t,i,eL()))},input:t.value}):(t.value=r.value,r.memo&&(t.memo=!0)),t}let rL=eA("$ZodCatch",(t,r)=>{tC.init(t,r),eC(t,"optin",t=>"defaulted"===t.def.innerType._zod.optin?"defaulted":"optional"),eC(t,"optout",t=>t.def.innerType._zod.optout),eC(t,"values",t=>t.def.innerType._zod.values),t._zod.parse=(t,o)=>{if("backward"===o.direction)return r.innerType._zod.run(t,o);let i=r.innerType._zod.run({value:t.value,issues:[]},o);return i instanceof Promise?i.then(i=>rM(t,i,r,o)):rM(t,i,r,o)}}),rD=eA("$ZodPipe",(t,r)=>{tC.init(t,r),eC(t,"values",t=>t.def.in._zod.values),eC(t,"optin",t=>t.def.in._zod.optin),eC(t,"optout",t=>t.def.out._zod.optout),eC(t,"propValues",t=>t.def.in._zod.propValues),t._zod.parse=(t,o)=>{if("backward"===o.direction){let i=r.out._zod.run(t,o);return i instanceof Promise?i.then(t=>rU(t,r.in,o)):rU(i,r.in,o)}let i=r.in._zod.run(t,o);return i instanceof Promise?i.then(t=>rU(t,r.out,o)):rU(i,r.out,o)}});function rU(t,r,o){return t.issues.some(t=>"unrecognized_keys"!==t.code)?(t.aborted=!0,t):r._zod.run({value:t.value,issues:t.issues},o)}let rV=eA("$ZodPreprocess",(t,r)=>{rD.init(t,r)}),rH=eA("$ZodReadonly",(t,r)=>{tC.init(t,r),eC(t,"propValues",t=>t.def.innerType._zod.propValues),eC(t,"values",t=>t.def.innerType._zod.values),eC(t,"optin",t=>t.def.innerType?._zod?.optin),eC(t,"optout",t=>t.def.innerType?._zod?.optout),t._zod.parse=(t,o)=>{if("backward"===o.direction)return r.innerType._zod.run(t,o);let i=r.innerType._zod.run(t,o);return i instanceof Promise?i.then(rF):rF(i)}});function rF(t){return t.memo||(t.value=Object.freeze(t.value)),t}let rK=eA("$ZodLazy",(t,r)=>{var o,i,a;let n;tC.init(t,r),o=t._zod,i="innerType",a=()=>(r._cachedInner||(r._cachedInner=r.getter()),r._cachedInner),Object.defineProperty(o,i,{get(){if(n!==B)return void 0===n&&(n=B,n=a()),n},set(t){Object.defineProperty(o,i,{value:t})},configurable:!0}),eC(t,"pattern",t=>t.innerType?._zod?.pattern),eC(t,"propValues",t=>t.innerType?._zod?.propValues),eC(t,"optin",t=>t.innerType?._zod?.optin??void 0),eC(t,"optout",t=>t.innerType?._zod?.optout??void 0),t._zod.parse=(r,o)=>t._zod.innerType._zod.run(r,o)}),rJ=eA("$ZodCustom",(t,r)=>{td.init(t,r),tC.init(t,r),t._zod.parse=(t,r)=>t,t._zod.check=o=>{let i=o.value,a=r.fn(i);if(a instanceof Promise)return a.then(r=>rZ(r,o,i,t));rZ(a,o,i,t)}});function rZ(t,r,o,i){if(!t){let t={code:"custom",input:o,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(eE(t))}}class rW{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let o=r[0];return this._map.set(t,o),o&&"object"==typeof o&&"id"in o&&this._idmap.set(o.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&"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 o={...this.get(r)??{}};delete o.id;let i={...o,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}(T=globalThis).__zod_globalRegistry??(T.__zod_globalRegistry=new rW);let rB=globalThis.__zod_globalRegistry;function rG(t){return t.checks&&(t.checks=[...t.checks]),t}function rX(t,r){return new t({type:"string",format:"email",check:"string_format",abort:!1,...ed(r)})}function rY(t,r){return new t({type:"string",format:"url",check:"string_format",abort:!1,...ed(r)})}function rQ(t,r){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ed(r)})}function r0(t,r){return new t({type:"string",format:"date",check:"string_format",...ed(r)})}function r1(t,r){return new tm({check:"less_than",...ed(r),value:t,inclusive:!1})}function r2(t,r){return new tm({check:"less_than",...ed(r),value:t,inclusive:!0})}function r9(t,r){return new tf({check:"greater_than",...ed(r),value:t,inclusive:!1})}function r4(t,r){return new tf({check:"greater_than",...ed(r),value:t,inclusive:!0})}function r5(t,r){return new ty({check:"multiple_of",...ed(r),value:t})}function r3(t,r){return new tv({check:"max_length",...ed(r),maximum:t})}function r6(t,r){return new t_({check:"min_length",...ed(r),minimum:t})}function r8(t,r){return new tb({check:"length_equals",...ed(r),length:t})}function r7(t){return new tx({check:"overwrite",tx:t})}function oe(t,...r){for(let o of r)for(let r of Reflect.ownKeys(o))Object.prototype.propertyIsEnumerable.call(o,r)&&G(t,r,o[r]);return t}function ot(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??rB,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 or(t,r,o,i,a){let n="function"==typeof r.unrepresentable?r.unrepresentable({zodSchema:t,path:i.path,message:a}):r.unrepresentable;if("any"===n)return!1;if(void 0===n||"throw"===n)throw Error(a);return Object.assign(o,n),!0}function oo(t,r,o={path:[],schemaPath:[]}){var i;let a=t._zod.def,n=r.seen.get(t);if(n)return n.count++,o.schemaPath.includes(t)&&(n.cycle=o.path),n.schema;let s={schema:{},count:1,cycle:void 0,path:o.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={...o,schemaPath:[...o.schemaPath,t],path:o.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(r,s.schema,i);else{let o=s.schema,n=r.processors[a.type];if(!n)throw Error(`[toJSONSchema]: Non-representable type encountered: ${a.type}`);n(t,r,o,i)}let n=t._zod.parent;n&&(s.ref||(s.ref=n),oo(n,r,i),r.seen.get(n).isParent=!0)}let c=r.metadataRegistry.get(t);return c&&oe(s.schema,c),"input"===r.io&&function t(r,o){let i=o??{seen:new Set};if(i.seen.has(r))return!1;i.seen.add(r);let a=r._zod.def;if("transform"===a.type)return!0;if("array"===a.type)return t(a.element,i);if("set"===a.type)return t(a.valueType,i);if("lazy"===a.type)return t(a.getter(),i);if("promise"===a.type||"optional"===a.type||"nonoptional"===a.type||"nullable"===a.type||"readonly"===a.type||"default"===a.type||"prefault"===a.type||"catch"===a.type)return t(a.innerType,i);if("intersection"===a.type)return t(a.left,i)||t(a.right,i);if("record"===a.type||"map"===a.type)return t(a.keyType,i)||t(a.valueType,i);if("pipe"===a.type)return!!r._zod.traits.has("$ZodCodec")||t(a.in,i)||t(a.out,i);if("object"===a.type){for(let r in a.shape)if(t(a.shape[r],i))return!0;return!1}if("union"===a.type){for(let r of a.options)if(t(r,i))return!0;return!1}if("tuple"===a.type){for(let r of a.items)if(t(r,i))return!0;if(a.rest&&t(a.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 oi(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function oa(t,r){let o=t.seen.get(r);if(!o)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 o=t.metadataRegistry.get(r[0])?.id;if(o){let t=i.get(o);if(t&&t!==r[0])throw Error(`Duplicate schema id "${o}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(o,r[0])}}let a=r=>{if(r[1].schema.$ref)return;let i=r[1],{ref:a,defId:n}=(r=>{let i="draft-2020-12"===t.target?"$defs":"definitions";if(t.external){let o=t.external.registry.get(r[0])?.id,a=t.external.uri??(t=>t);if(o)return{ref:a(o)};let n=r[1].defId??r[1].schema.id??`schema${t.counter++}`;return r[1].defId=n,{defId:n,ref:`${a("__shared")}#/${i}/${oi(n)}`}}let a=`#/${i}/`;if(r[1]===o&&!r[1].schema.id)return{ref:"#"};let n=r[1].schema.id??`__schema${t.counter++}`;return{defId:n,ref:a+oi(n)}})(r);i.def={...i.schema},n&&(i.defId=n);let s=i.schema;for(let t in s)delete s[t];s.$ref=a};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
|
+
|
|
55
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let o of t.seen.entries()){let i=o[1];if(r===o[0]){a(o);continue}if(t.external){let i=t.external.registry.get(o[0])?.id;if(r!==o[0]&&i){a(o);continue}}if(t.metadataRegistry.get(o[0])?.id||i.cycle){a(o);continue}i.count>1&&"ref"===t.reused&&a(o)}t.external&&(t.sharedDefsExtractedFor=t.external)}let on=new Set(["type","properties","required","additionalProperties"]),os=["oneOf","anyOf"];function ol(t){let r=t.additionalProperties;return void 0===r||!1===r||"object"!=typeof r||null===r?null:Object.keys(r).length?r:null}function oc(t){let r=[];for(let o of t){if("object"!=typeof o||"object"!==o.type)return null;for(let t in o)if(!on.has(t))return null;r.push(o)}let o={},i=new Set;for(let t of r){for(let i in t.properties){if(Object.prototype.hasOwnProperty.call(o,i))continue;let t=[];for(let o of r){let r=o.properties?.[i]??ol(o);null!=r&&(t.some(t=>JSON.stringify(t)===JSON.stringify(r))||t.push(r))}G(o,i,1===t.length?t[0]:oc(t)??{allOf:t})}for(let r of t.required??[])i.add(r)}let a={type:"object",properties:o};if(i.size&&(a.required=[...i]),r.every(t=>!1===t.additionalProperties))a.additionalProperties=!1;else{let t=[];for(let o of r){let r=ol(o);r&&!t.some(t=>JSON.stringify(t)===JSON.stringify(r))&&t.push(r)}1===t.length?a.additionalProperties=t[0]:t.length>1&&(a.additionalProperties={allOf:t})}return a}function ou(t,r){let o=t.seen.get(r);if(!o)throw Error("Unprocessed schema. This is a bug in Zod.");let i=r=>{let o=t.seen.get(r);if(null===o.ref)return;let a=o.def??o.schema,n={...a},s=o.ref;if(o.ref=null,s){i(s);let o=t.seen.get(s),l=o.schema;if(l.$ref&&("draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target)?(a.allOf=a.allOf??[],a.allOf.push(l)):oe(a,l),oe(a,n),r._zod.parent===s)for(let t in a)"$ref"!==t&&"allOf"!==t&&(t in n||delete a[t]);if(l.$ref&&o.def)for(let t in a)"$ref"!==t&&"allOf"!==t&&t in o.def&&JSON.stringify(a[t])===JSON.stringify(o.def[t])&&delete a[t]}let l=r._zod.parent;if(l&&l!==s){i(l);let r=t.seen.get(l);if(r?.schema.$ref&&(a.$ref=r.schema.$ref,r.def))for(let t in a)"$ref"!==t&&"allOf"!==t&&t in r.def&&JSON.stringify(a[t])===JSON.stringify(r.def[t])&&delete a[t]}t.override({zodSchema:r,jsonSchema:a,path:o.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 o=r.anyOf;if(!Array.isArray(o)||0===o.length||void 0!==r.type)return;let i=[];for(let r of o){if(!r||"object"!=typeof r)return;t(r);let o=Object.keys(r);if(1!==o.length||"type"!==o[0])return;let a=r.type;for(let t of Array.isArray(a)?a:[a]){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 o of t.seen.values())for(let t of[o.schema,o.def]){let o=t?.allOf;if(!Array.isArray(o))continue;let i=r.get(o);i?i.push(t):r.set(o,[t])}for(let o of t.intersections)for(let t of r.get(o)??[])!function(t){let r=t.allOf;if(!Array.isArray(r)||r.length<2)return;for(let r of on)if(r in t)return;let o=r.filter(t=>os.some(r=>Array.isArray(t[r]))),i=null;if(o.length){let t=o[0],a=os.find(r=>Array.isArray(t[r]));if(1!==Object.keys(t).length)return;let n=r.filter(r=>r!==t),s=t[a].map(t=>oc([...n,t]));if(s.some(t=>!t))return;i={[a]:s}}else i=oc(r);i&&(delete t.allOf,oe(t,i))}(t)}}let a={};if("draft-2020-12"===t.target?a.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===t.target?a.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===t.target?a.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let o=t.external.registry.get(r)?.id;if(!o)throw Error("Schema is missing an `id` property");a.$id=t.external.uri(o)}oe(a,o.defId?o.schema:o.def??o.schema);let n=t.metadataRegistry.get(r)?.id;void 0!==n&&a.id===n&&delete a.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,G(s,t.defId,t.def))}t.external&&(t.sharedEmitDoneFor=t.external),t.external||Object.keys(s).length>0&&("draft-2020-12"===t.target?a.$defs=s:a.definitions=s);try{let o=JSON.parse(JSON.stringify(a));return Object.defineProperty(o,"~standard",{value:{...r["~standard"],jsonSchema:{input:od(r,"input",t.processors),output:od(r,"output",t.processors)}},enumerable:!1,writable:!1}),o}catch(t){throw Error("Error converting schema to JSON.")}}let od=(t,r,o={})=>i=>{let{libraryOptions:a,target:n}=i??{},s=ot({...a??{},target:n,io:r,processors:o});return oo(t,s),oa(s,t),ou(s,t)},op=(t,r,o)=>{(void 0===t[r]||o>t[r])&&(t[r]=o)},oh=(t,r,o)=>{(void 0===t[r]||o<t[r])&&(t[r]=o)},om=(t,r)=>{op(t,"minimum",r),oh(t,"maximum",r)},of=(t,r)=>{t.multipleOf??(t.multipleOf=[]),t.multipleOf.includes(r)||t.multipleOf.push(r)},oy=(t,r)=>{t.patterns??(t.patterns=new Set),t.patterns.add(r)},og=(t,r)=>{t.mime=t.mime?t.mime.filter(t=>r.includes(t)):[...r]},ov=(t,r)=>{t.format=r,r.includes("int")&&(t.isInt=!0)},o_=(t,r)=>op(t,"minimum",r.minimum),ob=(t,r)=>oh(t,"maximum",r.maximum),oS=t=>(r,o)=>{ov(r,o.format);let[i,a]=t[o.format];op(r,"minimum",i),oh(r,"maximum",a)},ow={greater_than:(t,r)=>op(t,r.inclusive?"minimum":"exclusiveMinimum",r.value),less_than:(t,r)=>oh(t,r.inclusive?"maximum":"exclusiveMaximum",r.value),multiple_of:(t,r)=>of(t,r.value),number_format:oS(eh),bigint_format:oS(em),min_length:o_,max_length:ob,length_equals:(t,r)=>om(t,r.length),min_size:o_,max_size:ob,size_equals:(t,r)=>om(t,r.size),string_format:(t,r)=>{ov(t,r.format),r.pattern&&oy(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)=>og(t,r.mime)};function o$(t){let r={},o=t._zod.def;for(let i of t._zod.traits.has("$ZodCheck")?[t,...o.checks??[]]:o.checks??[])ow[i._zod.def.check]?.(r,i._zod.def);let i=t._zod.bag;for(let t of(void 0!==i.minimum&&op(r,"minimum",i.minimum),void 0!==i.exclusiveMinimum&&op(r,"exclusiveMinimum",i.exclusiveMinimum),void 0!==i.maximum&&oh(r,"maximum",i.maximum),void 0!==i.exclusiveMaximum&&oh(r,"exclusiveMaximum",i.exclusiveMaximum),void 0!==i.multipleOf&&of(r,i.multipleOf),void 0!==i.format&&(r.format??(r.format=i.format),i.format.includes("int")&&(r.isInt=!0)),i.mime&&og(r,i.mime),i.patterns??[]))oy(r,t);return r}let oP={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},oR=new Map([[t7,/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/],[rt,/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/]]),oE=t=>oR.get(t)??t,ok=(t,r,o,i)=>{o.type="string";let{minimum:a,maximum:n,format:s,patterns:l,contentEncoding:c,laxFormat:u}=o$(t);if("number"==typeof a&&(o.minLength=a),"number"==typeof n&&(o.maxLength=n),s&&(o.format=oP[s]??s,""===o.format&&delete o.format,("time"===s||u)&&delete o.format),c&&(o.contentEncoding=c),l&&l.size>0){let t=[...l].map(oE);1===t.length?o.pattern=t[0].source:t.length>1&&(o.allOf=[...t.map(t=>({..."draft-07"===r.target||"draft-04"===r.target||"openapi-3.0"===r.target?{type:"string"}:{},pattern:t.source}))])}},ox=(t,r,o,i)=>{let{minimum:a,maximum:n,multipleOf:s,exclusiveMaximum:l,exclusiveMinimum:c,isInt:u}=o$(t);o.type=u?"integer":"number";let d="number"==typeof c&&c>=(a??-1/0),p="number"==typeof l&&l<=(n??1/0),h="draft-04"===r.target||"openapi-3.0"===r.target;if(d?h?(o.minimum=c,o.exclusiveMinimum=!0):o.exclusiveMinimum=c:"number"==typeof a&&(o.minimum=a),p?h?(o.maximum=l,o.exclusiveMaximum=!0):o.exclusiveMaximum=l:"number"==typeof n&&(o.maximum=n),s){let a=new Set;for(let n of s)Number.isFinite(n)&&0!==n?a.add(Math.abs(n)):or(t,r,o,i,`A multipleOf divisor of ${n} cannot be represented in JSON Schema`);let[n,...l]=a;void 0!==n&&(o.multipleOf=n),l.length&&(o.allOf=[...o.allOf??[],...l.map(t=>({multipleOf:t}))])}},oT=(t,r,o,i)=>{o.type="boolean"},oO=(t,r,o,i)=>{"openapi-3.0"===r.target?(o.type="string",o.nullable=!0,o.enum=[null]):o.type="null"},oC=(t,r,o,i)=>{o.not={}},oj=(t,r,o,i)=>{},oI=(t,r,o,i)=>{},oN=(t,r,o,i)=>{let a=H(t._zod.def.entries);if(0===a.length){o.not={};return}a.every(t=>"number"==typeof t)&&(o.type="number"),a.every(t=>"string"==typeof t)&&(o.type="string"),o.enum=a},oA=(t,r,o,i)=>{let a=t._zod.def;if(0===a.values.length){o.not={};return}let n=[];for(let s of a.values)if(void 0===s){if(or(t,r,o,i,"Literal `undefined` cannot be represented in JSON Schema"))return}else if("bigint"==typeof s){if(or(t,r,o,i,"BigInt literals cannot be represented in JSON Schema"))return;n.push(Number(s))}else n.push(s);if(0===n.length);else if(1===n.length){let t=n[0];o.type=null===t?"null":typeof t,"draft-04"===r.target||"openapi-3.0"===r.target?o.enum=[t]:o.const=t}else n.every(t=>"number"==typeof t)&&(o.type="number"),n.every(t=>"string"==typeof t)&&(o.type="string"),n.every(t=>"boolean"==typeof t)&&(o.type="boolean"),n.every(t=>null===t)&&(o.type="null"),o.enum=n},oz=(t,r,o,i)=>{or(t,r,o,i,"Custom types cannot be represented in JSON Schema")},oq=(t,r,o,i)=>{or(t,r,o,i,"Transforms cannot be represented in JSON Schema")},oM=(t,r,o,i)=>{let a=t._zod.def,{minimum:n,maximum:s}=o$(t);"number"==typeof n&&(o.minItems=n),"number"==typeof s&&(o.maxItems=s),o.type="array",o.items=oo(a.element,r,{...i,path:[...i.path,"items"]})};function oL(t){let r=t._zod.def;return"pipe"===r.type&&r.in._zod.traits.has("$ZodTransform")?oL(r.out):"catch"===r.type?oL(r.innerType):t._zod.optin}let oD=(t,r,o,i)=>{let a=t._zod.def,n=a.shape;if(Object.getOwnPropertySymbols(n).length&&or(t,r,o,i,"Symbol keys cannot be represented in JSON Schema"))return;for(let t in o.type="object",o.properties={},n)G(o.properties,t,oo(n[t],r,{...i,path:[...i.path,"properties",t]}));let s=[];for(let t of Object.keys(n)){let o=a.shape[t];("input"===r.io?void 0===oL(o):void 0===o._zod.optout)&&s.push(t)}s.length>0&&(o.required=s),a.catchall?._zod.def.type==="never"?o.additionalProperties=!1:a.catchall?a.catchall&&(o.additionalProperties=oo(a.catchall,r,{...i,path:[...i.path,"additionalProperties"]})):"output"===r.io&&(o.additionalProperties=!1)},oU=(t,r,o,i)=>{let a=t._zod.def,n=!1===a.inclusive,s=a.options.map((t,o)=>oo(t,r,{...i,path:[...i.path,n?"oneOf":"anyOf",o]}));n?o.oneOf=s:o.anyOf=s},oV=(t,r,o,i)=>{let a=t._zod.def,n=oo(a.left,r,{...i,path:[...i.path,"allOf",0]}),s=oo(a.right,r,{...i,path:[...i.path,"allOf",1]}),l=t=>"allOf"in t&&1===Object.keys(t).length,c=[...l(n)?n.allOf:[n],...l(s)?s.allOf:[s]];o.allOf=c,r.intersections.push(c)},oH=new WeakMap,oF=(t,r,o,i)=>{let a=t._zod.def;o.type="object";let n=a.keyType,s=o$(n).patterns;if("loose"===a.mode&&s&&s.size>0){let t=oo(a.valueType,r,{...i,path:[...i.path,"patternProperties","*"]});for(let r of(o.patternProperties={},s))G(o.patternProperties,oE(r).source,t)}else{if("draft-07"===r.target||"draft-2020-12"===r.target){o.propertyNames=oo(a.keyType,r,{...i,path:[...i.path,"propertyNames"]});let n=oH.get(r);n||(n=[],oH.set(r,n),r.deferred.push(()=>(function(t){let r=new Map;for(let o of t.seen.values())o.def&&!r.has(o.schema)&&r.set(o.schema,o);let o=new Map;for(let i of oH.get(t)??[]){let a=t.seen.get(i),n=(a?.def??a?.schema)?.propertyNames;if(!n||!0===n||o.has(n))continue;let s=function t(r,o,i){if(o.$ref){if(i.has(o))return o;i.add(o);let a=r.get(o)?.def;if(!a)return o;let n=t(r,a,i);return n===a?o:n}for(let a of["anyOf","oneOf"]){let n=o[a];if(!Array.isArray(n))continue;let s=n.map(o=>t(r,o,i));s.some((t,r)=>t!==n[r])&&(o={...o,[a]:s})}let a=Array.isArray(o.type)?o.type:[o.type],n=!a.includes("string")&&a.some(t=>"number"===t||"integer"===t),s=o.enum??(void 0!==o.const?[o.const]:void 0);if(!n&&!s?.some(t=>"number"==typeof t))return o;let{minimum:l,maximum:c,exclusiveMinimum:u,exclusiveMaximum:d,multipleOf:p,format:h,id:m,...f}=o;return f.enum?f.enum=f.enum.map(t=>"number"==typeof t?String(t):t):"number"==typeof f.const&&(f.const=String(f.const)),n&&(f.type="string",s||(f.pattern=(a.includes("number")?tn:ta).source)),f}(r,n,new Set);s!==n&&o.set(n,s)}if(o.size)for(let r of t.seen.values())for(let t of[r.schema,r.def]){let r=t&&o.get(t.propertyNames);r&&(t.propertyNames=r)}})(r))),n.push(t)}o.additionalProperties=oo(a.valueType,r,{...i,path:[...i.path,"additionalProperties"]})}let l=n._zod.values,c="input"===r.io&&void 0!==oL(a.valueType);if(l&&!a.partial&&!c){let t=[...l].filter(t=>"string"==typeof t||"number"==typeof t);t.length>0&&(o.required=t.map(String))}},oK=(t,r,o,i)=>{let a=t._zod.def,n=oo(a.innerType,r,i),s=r.seen.get(t);"openapi-3.0"===r.target?(s.ref=a.innerType,o.nullable=!0):o.anyOf=[n,{type:"null"}]},oJ=(t,r,o,i)=>{let a=t._zod.def;oo(a.innerType,r,i),r.seen.get(t).ref=a.innerType},oZ=Symbol();function oW(t,r,o,i,a){let n=!1,s=JSON.stringify(t,(t,r)=>"bigint"!=typeof r?r:(n=!0,null));return n?(or(r,o,i,a,"BigInt defaults cannot be represented in JSON Schema"),oZ):JSON.parse(s)}let oB=(t,r,o,i)=>{let a=t._zod.def;oo(a.innerType,r,i),r.seen.get(t).ref=a.innerType;let n=oW(a.defaultValue,t,r,o,i);n!==oZ&&(o.default=n)},oG=(t,r,o,i)=>{let a=t._zod.def;if(oo(a.innerType,r,i),r.seen.get(t).ref=a.innerType,"input"!==r.io)return;let n=oW(a.defaultValue,t,r,o,i);n!==oZ&&(o._prefault=n)},oX=(t,r,o,i)=>{let a,n=t._zod.def;oo(n.innerType,r,i),r.seen.get(t).ref=n.innerType;try{a=n.catchValue(void 0)}catch{or(t,r,o,i,"Dynamic catch values are not supported in JSON Schema");return}o.default=a},oY=(t,r,o,i)=>{let a=t._zod.def,n=a.in._zod.traits.has("$ZodTransform"),s="input"===r.io?n?a.out:a.in:a.out;oo(s,r,i),r.seen.get(t).ref=s},oQ=(t,r,o,i)=>{let a=t._zod.def;oo(a.innerType,r,i),r.seen.get(t).ref=a.innerType,o.readOnly=!0},o0=(t,r,o,i)=>{let a=t._zod.def;oo(a.innerType,r,i),r.seen.get(t).ref=a.innerType},o1=(t,r,o,i)=>{let a=t._zod.innerType;oo(a,r,i),r.seen.get(t).ref=a},o2={string:ok,number:ox,boolean:oT,bigint:(t,r,o,i)=>{or(t,r,o,i,"BigInt cannot be represented in JSON Schema")},symbol:(t,r,o,i)=>{or(t,r,o,i,"Symbols cannot be represented in JSON Schema")},null:oO,undefined:(t,r,o,i)=>{or(t,r,o,i,"Undefined cannot be represented in JSON Schema")},void:(t,r,o,i)=>{or(t,r,o,i,"Void cannot be represented in JSON Schema")},never:oC,any:oj,unknown:oI,date:(t,r,o,i)=>{or(t,r,o,i,"Date cannot be represented in JSON Schema")},enum:oN,literal:oA,nan:(t,r,o,i)=>{or(t,r,o,i,"NaN cannot be represented in JSON Schema")},template_literal:(t,r,o,i)=>{let a=t._zod.pattern;if(!a)throw Error("Pattern not found in template literal");o.type="string",o.pattern=a.source},file:(t,r,o,i)=>{o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:a,maximum:n,mime:s}=o$(t);void 0!==a&&(o.minLength=a),void 0!==n&&(o.maxLength=n),s&&(0===s.length?o.not={}:1===s.length?o.contentMediaType=s[0]:o.anyOf=s.map(t=>({contentMediaType:t})))},success:(t,r,o,i)=>{o.type="boolean"},custom:oz,function:(t,r,o,i)=>{or(t,r,o,i,"Function types cannot be represented in JSON Schema")},transform:oq,map:(t,r,o,i)=>{or(t,r,o,i,"Map cannot be represented in JSON Schema")},set:(t,r,o,i)=>{or(t,r,o,i,"Set cannot be represented in JSON Schema")},array:oM,object:oD,union:oU,intersection:oV,tuple:(t,r,o,i)=>{let a=t._zod.def;o.type="array";let n="draft-2020-12"===r.target?"prefixItems":"items",s="draft-2020-12"===r.target||"openapi-3.0"===r.target?"items":"additionalItems",l=a.items.map((t,o)=>oo(t,r,{...i,path:[...i.path,n,o]})),c=a.rest?oo(a.rest,r,{...i,path:[...i.path,s,..."openapi-3.0"===r.target?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let t=a.items[u-1];if(!("input"===r.io?void 0!==oL(t):"optional"===t._zod.optout))break;u--}let d=a.items.length,p=!a.rest;"draft-2020-12"===r.target?(o.prefixItems=l,p?o.items=!1:c&&(o.items=c)):"openapi-3.0"===r.target?(o.items={anyOf:l},c&&o.items.anyOf.push(c)):(o.items=l,p?o.additionalItems=!1:c&&(o.additionalItems=c)),u>0&&(o.minItems=u),p&&(o.maxItems=d);let{minimum:h,maximum:m}=o$(t);"number"==typeof h&&(o.minItems=h),"number"==typeof m&&(o.maxItems=m)},record:oF,nullable:oK,nonoptional:oJ,default:oB,prefault:oG,catch:oX,pipe:oY,readonly:oQ,promise:(t,r,o,i)=>{let a=t._zod.def;oo(a.innerType,r,i),r.seen.get(t).ref=a.innerType},optional:o0,lazy:o1};function o9(t,r){if("_idmap"in t){let o=ot({...r,processors:o2}),i={};for(let r of t._idmap.entries()){let[t,i]=r;oo(i,o)}let a={};for(let n of(o.external={registry:t,uri:r?.uri,defs:i},t._idmap.entries())){let[t,r]=n;oa(o,r),G(a,t,ou(o,r))}return Object.keys(i).length>0&&(a.__shared={["draft-2020-12"===o.target?"$defs":"definitions"]:i}),{schemas:a}}let o=ot({...r,processors:o2});return oo(t,o),oa(o,t),ou(o,t)}let o4={get:function(){let t=this._zod;return t.message??(t.message=JSON.stringify(t.def,K,2)),t.message},set:function(t){this._zod.message=t},enumerable:!0,configurable:!0},o5={value:void 0,enumerable:!1},o3=new WeakSet([Object.prototype,Error.prototype]),o6=(t,r)=>{t.name="$ZodError",o5.value=r,Object.defineProperty(t,"issues",o5),o5.value=void 0,Object.defineProperty(t,"message",o4);let o=Object.getPrototypeOf(t);o3.has(o)||(o3.add(o),Object.defineProperty(o,"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})}}))},o8=eA("$ZodError",o6);function o7(t,r){return{callee:r?.callee??t,Err:r?.Err}}eA("$ZodError",o6,void 0,{Parent:Error});let ie=t=>{let r=(o,i,a,n)=>{let s=a?{...a,async:!1}:{async:!1},l=o._zod.run({value:i,issues:[]},s);if(l instanceof Promise)throw new ez;if(l.issues.length){let o=new(n?.Err??t)(l.issues.map(t=>ew(t,s,eL())));throw eo(o,n?.callee??r),o}return l.value};return r},it=t=>{let r=async(o,i,a,n)=>{let s=a?{...a,async:!0}:{async:!0},l=o._zod.run({value:i,issues:[]},s);if(l instanceof Promise&&(l=await l),l.issues.length){let o=new(n?.Err??t)(l.issues.map(t=>ew(t,s,eL())));throw eo(o,n?.callee??r),o}return l.value};return r},ir=t=>(r,o,i)=>{let a=i?{...i,async:!1}:{async:!1},n=r._zod.run({value:o,issues:[]},a);if(n instanceof Promise)throw new ez;return n.issues.length?io(t,n.issues,a):{success:!0,data:n.value}};function io(t,r,o){let i;return{success:!1,get error(){return i||(i=new t(r.map(t=>ew(t,o,eL()))),r=void 0,o=void 0),i},set error(e){i=e,r=void 0,o=void 0}}}let ii=t=>async(r,o,i)=>{let a=i?{...i,async:!0}:{async:!0},n=r._zod.run({value:o,issues:[]},a);return n instanceof Promise&&(n=await n),n.issues.length?io(t,n.issues,a):{success:!0,data:n.value}},ia=Symbol.for("zod.compile.invalid"),is=Symbol.for("zod.compile.fallback"),il=async(t,r,o)=>{let i=o?{...o,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},a=t._zod.run({value:r,issues:[]},i);return a instanceof Promise&&(a=await a),0===a.issues.length},ic=new WeakSet([Object.prototype,Error.prototype]);function iu(t,r,o){Object.defineProperty(t,r,{configurable:!0,enumerable:!1,get(){let t=o(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 id=eA("ZodError",(t,r)=>{o8.init(t,r),t.name="ZodError";let o=Object.getPrototypeOf(t);ic.has(o)||(ic.add(o),iu(o,"format",t=>r=>(function(t,r=t=>t.message){let o={_errors:[]},i=(t,a=[])=>{for(let n of t.issues)if("invalid_union"===n.code&&n.errors.length)n.errors.map(t=>i({issues:t},[...a,...n.path]));else if("invalid_key"===n.code)i({issues:n.issues},[...a,...n.path]);else if("invalid_element"===n.code)i({issues:n.issues},[...a,...n.path]);else{let t=[...a,...n.path];if(0===t.length)o._errors.push(r(n));else{let i=o,a=0;for(;a<t.length;){let o=t[a],s=a===t.length-1;if("_errors"===o){s&&i._errors.push(r(n)),a++;continue}Object.prototype.hasOwnProperty.call(i,o)||Object.defineProperty(i,o,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let l=i[o];s&&l._errors.push(r(n)),i=l,a++}}}};return i(t),o})(t,r)),iu(o,"flatten",t=>r=>(function(t,r=t=>t.message){let o={},i=[];for(let l of t.issues)if(l.path.length>0){var a,n,s;(a=o,n=l.path[0],s=()=>[],!Object.prototype.hasOwnProperty.call(a,n)&&("__proto__"===n?Object.defineProperty(a,n,{value:s(),writable:!0,enumerable:!0,configurable:!0}):a[n]=s()),a[n]).push(r(l))}else i.push(r(l));return{formErrors:i,fieldErrors:o}})(t,r)),iu(o,"addIssue",t=>r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,K,2)}),iu(o,"addIssues",t=>r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,K,2)}),Object.defineProperty(o,"isEmpty",{configurable:!0,enumerable:!1,get(){return 0===this.issues.length}}))},void 0,{Parent:Error}),ip=ie(id),ih=it(id),im=ir(id),iy=ii(id),ig=(d=ie(id),p=(t,r,o,i)=>d(t,r,o?{...o,direction:"backward"}:{direction:"backward"},o7(p,i))),iv=(h=ie(id),m=(t,r,o,i)=>h(t,r,o,o7(m,i))),i_=(f=it(id),y=async(t,r,o,i)=>{let a=o?{...o,direction:"backward"}:{direction:"backward"};return await f(t,r,a,o7(y,i))}),ib=(g=it(id),v=async(t,r,o,i)=>await g(t,r,o,o7(v,i))),iS=(_=id,(t,r,o)=>{let i=o?{...o,direction:"backward"}:{direction:"backward"};return ir(_)(t,r,i)}),iw=(b=id,(t,r,o)=>ir(b)(t,r,o)),i$=(S=id,async(t,r,o)=>{let i=o?{...o,direction:"backward"}:{direction:"backward"};return ii(S)(t,r,i)}),iP=(w=id,async(t,r,o)=>ii(w)(t,r,o));function iR(){eM.memoizer||eL({memoizer:eZ})}let iE=eA("ZodType",(t,r)=>(eM.localeError||eL({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"},o={nan:"NaN"};function i(t,r){return"number"!==t||"number"!=typeof r||Number.isFinite(r)?o[t]??t:String(r)}return o=>{switch(o.code){case"invalid_type":{let t=i(o.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}(o.input),o.input);return`Invalid input: expected ${t}, received ${r}`}case"invalid_value":if(1===o.values.length)return`Invalid input: expected ${ep(o.values[0])}`;return`Invalid option: expected one of ${F(o.values,"|")}`;case"too_big":{let r=o.exact?"exactly ":o.inclusive?"<=":"<",i=t[o.origin]??null;if(i)return`Too big: expected ${o.origin??"value"} to have ${r}${o.maximum.toString()} ${i.unit??"elements"}`;return`Too big: expected ${o.origin??"value"} to be ${r}${o.maximum.toString()}`}case"too_small":{let r=o.exact?"exactly ":o.inclusive?">=":">",i=t[o.origin]??null;if(i)return`Too small: expected ${o.origin} to have ${r}${o.minimum.toString()} ${i.unit}`;return`Too small: expected ${o.origin} to be ${r}${o.minimum.toString()}`}case"invalid_format":if("starts_with"===o.format)return`Invalid string: must start with "${o.prefix}"`;if("ends_with"===o.format)return`Invalid string: must end with "${o.suffix}"`;if("includes"===o.format)return`Invalid string: must include "${o.includes}"`;if("regex"===o.format)return`Invalid string: must match pattern ${o.pattern}`;return`Invalid ${r[o.format]??o.format}`;case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${F(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":if(o.options&&Array.isArray(o.options)&&o.options.length>0){let t=o.options.map(t=>`'${t}'`).join(" | ");return`Invalid discriminator value. Expected ${t}`}if(!1===o.inclusive)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}})()}),tC.init(t,r),t.def=r,t.type=r.type,t),{check(...t){let r=this.def;return this.clone(er(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 eu(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 aq({type:"custom",check:"custom",fn:t,...ed(r)})}(t,r))},superRefine(t,r){var o,i,a,n,s;let l,c;return this.check((o=t,i=r,a=o,n=t=>(t.addIssue=r=>{"string"==typeof r?t.issues.push(eE(r,t.value,l._zod.def)):(r.fatal&&(r.continue=!1),r.code??(r.code="custom"),"input"in r||(r.input=t.value),r.inst??(r.inst=l),r.continue??(r.continue=!l._zod.def.abort),t.issues.push(eE(r)))},a(t.value,t)),(c=new td({check:"custom",...ed(s=i)}))._zod.check=n,l=c))},overwrite(t){return this.check(r7(t))},optional(){return a$(this)},exactOptional(){var t;return t=this,new aP({type:"optional",innerType:t})},nullable(){return aE(this)},nullish(){return a$(aE(this))},nonoptional(t){var r,o;return r=this,new aT({type:"nonoptional",innerType:r,...ed(o=t)})},array(){return ai(this)},or(t){return ac([this,t])},and(t){return ah(this,t)},transform(t){return aj(this,aS(t))},default(t){var r,o;return r=this,o=t,new ak({type:"default",innerType:r,get defaultValue(){return"function"==typeof o?o():es(o)}})},prefault(t){var r,o;return r=this,o=t,new ax({type:"prefault",innerType:r,get defaultValue(){return"function"==typeof o?o():es(o)}})},catch(t){var r,o,i;let a;return r=this,new aO({type:"catch",innerType:r,catchValue:"function"==typeof(o=t)?o:(i=o,(a=()=>i)["~constantCatch"]=!0,a)})},pipe(t){return aj(this,t)},readonly(){var t;return t=this,new aN({type:"readonly",innerType:t})},describe(t){let r=this.clone();return rB.add(r,{description:t}),r},meta(...t){if(0===t.length)return rB.get(this);let r=this.clone();return rB.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"(){var ik;return ik=this,ek(ik,"~standard",{...tA(this),jsonSchema:{input:od(this,"input"),output:od(this,"output")}},!1)},set"~standard"(value){ek(this,"~standard",value)},parse:function t(r,o){return ip(this,r,o,{callee:t})},parseAsync:async function t(r,o){return await ih(this,r,o,{callee:t})},safeParse(t,r){return im(this,t,r)},async safeParseAsync(t,r){return iy(this,t,r)},get spa(){return this?.safeParseAsync},set spa(value){ek(this,"spa",value)},validate(t,r){var o=this,i=t,a=r;let n=o._zod.bag.validator;if(void 0!==n){if(n(i)!==ia)return!0;if(!0===n.definite&&void 0===a)return!1}var s=o,l=i,c=a;let u,d=c?{...c,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},p=s._zod.bag.fallbackRun;if(p?(d[is]=!0,u=p({value:l,issues:[]},d)):u=s._zod.run({value:l,issues:[]},d),u instanceof Promise)throw new ez;return 0===u.issues.length},validateAsync(t,r){return il(this,t,r)},encode:function t(r,o){return ig(this,r,o,{callee:t})},decode:function t(r,o){return iv(this,r,o,{callee:t})},encodeAsync:async function t(r,o){return await i_(this,r,o,{callee:t})},decodeAsync:async function t(r,o){return await ib(this,r,o,{callee:t})},safeEncode(t,r){return iS(this,t,r)},safeDecode(t,r){return iw(this,t,r)},async safeEncodeAsync(t,r){return i$(this,t,r)},async safeDecodeAsync(t,r){return iP(this,t,r)},toJSONSchema(t){return((t,r={})=>o=>{let i=ot({...o,processors:r});return oo(t,i),oa(i,t),ou(i,t)})(this,{})(t)},get description(){return rB.get(this)?.description},get _def(){return this._zod.def}}),ix=eA("_ZodString",(t,r)=>{tz.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>ok(t,r,o,i)},ex({format:t=>o$(t).format??null,minLength:t=>o$(t).minimum??null,maxLength:t=>o$(t).maximum??null},{regex(...t){return this.check(function(t,r){return new tw({check:"string_format",format:"regex",...ed(r),pattern:t})}(...t))},includes(...t){return this.check(function(t,r){return new tR({check:"string_format",format:"includes",...ed(r),includes:t})}(...t))},startsWith(...t){return this.check(function(t,r){return new tE({check:"string_format",format:"starts_with",...ed(r),prefix:t})}(...t))},endsWith(...t){return this.check(function(t,r){return new tk({check:"string_format",format:"ends_with",...ed(r),suffix:t})}(...t))},min(...t){return this.check(r6(...t))},max(...t){return this.check(r3(...t))},length(...t){return this.check(r8(...t))},nonempty(...t){return this.check(r6(1,...t))},lowercase(t){return this.check(new t$({check:"string_format",format:"lowercase",...ed(t)}))},uppercase(t){return this.check(new tP({check:"string_format",format:"uppercase",...ed(t)}))},trim(){return this.check(r7(t=>t.trim()))},normalize(...t){return this.check(function(t){return r7(r=>r.normalize(t))}(...t))},toLowerCase(){return this.check(r7(t=>t.toLowerCase()))},toUpperCase(){return this.check(r7(t=>t.toUpperCase()))},slugify(){return this.check(r7(t=>t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")))}})),iT=eA("ZodString",(t,r)=>{tz.init(t,r),ix.init(t,r)},{email(t){return this.check(rX(iz,t))},url(t){return this.check(rY(iL,t))},jwt(t){return this.check(new i0({type:"string",format:"jwt",check:"string_format",abort:!1,...ed(t)}))},emoji(t){return this.check(new iD({type:"string",format:"emoji",check:"string_format",abort:!1,...ed(t)}))},guid(t){return this.check(new iq({type:"string",format:"guid",check:"string_format",abort:!1,...ed(t)}))},uuid(t){return this.check(new iM({type:"string",format:"uuid",check:"string_format",abort:!1,...ed(t)}))},uuidv4(t){return this.check(new iM({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ed(t)}))},uuidv6(t){return this.check(new iM({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ed(t)}))},uuidv7(t){return this.check(new iM({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ed(t)}))},nanoid(t){return this.check(new iU({type:"string",format:"nanoid",check:"string_format",abort:!1,...ed(t)}))},cuid(t){return this.check(new iV({type:"string",format:"cuid",check:"string_format",abort:!1,...ed(t)}))},cuid2(t){return this.check(new iH({type:"string",format:"cuid2",check:"string_format",abort:!1,...ed(t)}))},ulid(t){return this.check(new iF({type:"string",format:"ulid",check:"string_format",abort:!1,...ed(t)}))},base64(t){return this.check(new iX({type:"string",format:"base64",check:"string_format",abort:!1,...ed(t)}))},base64url(t){return this.check(new iY({type:"string",format:"base64url",check:"string_format",abort:!1,...ed(t)}))},xid(t){return this.check(new iK({type:"string",format:"xid",check:"string_format",abort:!1,...ed(t)}))},ksuid(t){return this.check(new iJ({type:"string",format:"ksuid",check:"string_format",abort:!1,...ed(t)}))},ipv4(t){return this.check(new iZ({type:"string",format:"ipv4",check:"string_format",abort:!1,...ed(t)}))},ipv6(t){return this.check(new iW({type:"string",format:"ipv6",check:"string_format",abort:!1,...ed(t)}))},cidrv4(t){return this.check(new iB({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ed(t)}))},cidrv6(t){return this.check(new iG({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ed(t)}))},e164(t){return this.check(new iQ({type:"string",format:"e164",check:"string_format",abort:!1,...ed(t)}))},datetime(t){return this.check(rQ(ij,t))},date(t){return this.check(r0(iI,t))},time(t){return this.check(new iN({type:"string",format:"time",check:"string_format",precision:null,...ed(t)}))},duration(t){return this.check(new iA({type:"string",format:"duration",check:"string_format",...ed(t)}))}});function iO(t){return new iT(rG({type:"string",...ed(t)}))}let iC=eA("ZodStringFormat",(t,r)=>{tq.init(t,r),ix.init(t,r)}),ij=eA("ZodISODateTime",(t,r)=>{tY.init(t,r),iC.init(t,r)}),iI=eA("ZodISODate",(t,r)=>{tQ.init(t,r),iC.init(t,r)}),iN=eA("ZodISOTime",(t,r)=>{t0.init(t,r),iC.init(t,r)}),iA=eA("ZodISODuration",(t,r)=>{t1.init(t,r),iC.init(t,r)}),iz=eA("ZodEmail",(t,r)=>{tD.init(t,r),iC.init(t,r)}),iq=eA("ZodGUID",(t,r)=>{tM.init(t,r),iC.init(t,r)}),iM=eA("ZodUUID",(t,r)=>{tL.init(t,r),iC.init(t,r)}),iL=eA("ZodURL",(t,r)=>{tF.init(t,r),iC.init(t,r)}),iD=eA("ZodEmoji",(t,r)=>{tK.init(t,r),iC.init(t,r)}),iU=eA("ZodNanoID",(t,r)=>{tJ.init(t,r),iC.init(t,r)}),iV=eA("ZodCUID",(t,r)=>{tZ.init(t,r),iC.init(t,r)}),iH=eA("ZodCUID2",(t,r)=>{tW.init(t,r),iC.init(t,r)}),iF=eA("ZodULID",(t,r)=>{tB.init(t,r),iC.init(t,r)}),iK=eA("ZodXID",(t,r)=>{tG.init(t,r),iC.init(t,r)}),iJ=eA("ZodKSUID",(t,r)=>{tX.init(t,r),iC.init(t,r)}),iZ=eA("ZodIPv4",(t,r)=>{t2.init(t,r),iC.init(t,r)}),iW=eA("ZodIPv6",(t,r)=>{t5.init(t,r),iC.init(t,r)}),iB=eA("ZodCIDRv4",(t,r)=>{t3.init(t,r),iC.init(t,r)}),iG=eA("ZodCIDRv6",(t,r)=>{t6.init(t,r),iC.init(t,r)}),iX=eA("ZodBase64",(t,r)=>{re.init(t,r),iC.init(t,r)}),iY=eA("ZodBase64URL",(t,r)=>{rr.init(t,r),iC.init(t,r)}),iQ=eA("ZodE164",(t,r)=>{ro.init(t,r),iC.init(t,r)}),i0=eA("ZodJWT",(t,r)=>{ri.init(t,r),iC.init(t,r)}),i1=eA("ZodNumber",(t,r)=>{ra.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>ox(t,r,o,i),t.isFinite=!0},ex({minValue:t=>{let{minimum:r,exclusiveMinimum:o}=o$(t);return Math.max(r??-1/0,o??-1/0)},maxValue:t=>{let{maximum:r,exclusiveMaximum:o}=o$(t);return Math.min(r??1/0,o??1/0)},isInt:t=>{let{isInt:r,multipleOf:o}=o$(t);return!!r||!!o?.some(Number.isSafeInteger)},format:t=>o$(t).format??null},{gt(t,r){return this.check(r9(t,r))},gte(t,r){return this.check(r4(t,r))},min(t,r){return this.check(r4(t,r))},lt(t,r){return this.check(r1(t,r))},lte(t,r){return this.check(r2(t,r))},max(t,r){return this.check(r2(t,r))},int(t){return this.check(i4(t))},safe(t){return this.check(i4(t))},positive(t){return this.check(r9(0,t))},nonnegative(t){return this.check(r4(0,t))},negative(t){return this.check(r1(0,t))},nonpositive(t){return this.check(r2(0,t))},multipleOf(t,r){return this.check(r5(t,r))},step(t,r){return this.check(r5(t,r))},finite(){return this}}));function i2(t){return new i1(rG({type:"number",checks:[],...ed(t)}))}let i9=eA("ZodNumberFormat",(t,r)=>{rn.init(t,r),i1.init(t,r)});function i4(t){return new i9({type:"number",check:"number_format",abort:!1,format:"safeint",...ed(t)})}let i5=eA("ZodBoolean",(t,r)=>{rs.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oT(t,r,o,i)});function i3(t){return new i5({type:"boolean",...ed(t)})}let i6=eA("ZodNull",(t,r)=>{rl.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oO(t,r,o,i)});function i8(t){return new i6({type:"null",...ed(t)})}let i7=eA("ZodAny",(t,r)=>{rc.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oj(t,r,o,i)}),ae=eA("ZodUnknown",(t,r)=>{ru.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oI(t,r,o,i)});function at(){return new ae({type:"unknown"})}let ar=eA("ZodNever",(t,r)=>{rd.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oC(t,r,o,i)}),ao=eA("ZodArray",(t,r)=>{iR(),rh.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oM(t,r,o,i),t.element=r.element},{min(t,r){return this.check(r6(t,r))},nonempty(t){return this.check(r6(1,t))},max(t,r){return this.check(r3(t,r))},length(t,r){return this.check(r8(t,r))},unwrap(){return this.element}});function ai(t,r){return new ao({type:"array",element:t,...ed(r)})}let aa=eA("ZodObject",(t,r)=>{var o,i,a,n,s,l;let c,u;iR(),r_.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oD(t,r,o,i),o=t,i="shape",a=t=>t._zod.def.shape,n=!1,s=o,l=i,c=Object.getPrototypeOf(s),(u=l in c?void 0:c)&&Object.defineProperty(u,i,{configurable:!0,get(){let t={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,i,t),t.value=a(this),Object.defineProperty(this,i,t),t.value},set(t){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:n,value:t})}})},{keyof(){return ag(Object.keys(this._zod.def.shape))},catchall(t){return this.clone(er(this._zod.def,{catchall:t}))},passthrough(){return this.clone(er(this._zod.def,{catchall:at()}))},loose(){return this.clone(er(this._zod.def,{catchall:at()}))},strict(){return this.clone(er(this._zod.def,{catchall:new ar({type:"never",...ed(void 0)})}))},strip(){return this.clone(er(this._zod.def,{catchall:void 0}))},extend(t){var r=this,o=t;if(!en(o))throw Error("Invalid input to extend: expected a plain object");let i=r._zod.def.checks;if(i&&i.length>0){let t=Y(r);for(let r of Reflect.ownKeys(o))if(void 0!==Object.getOwnPropertyDescriptor(t,r))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return eu(r,er(r._zod.def,{shape:ey(r,o)}))},safeExtend(t){var r=this,o=t;if(!en(o))throw Error("Invalid input to safeExtend: expected a plain object");return eu(r,er(r._zod.def,{shape:ey(r,o)}))},merge(t){var r=this,o=t;if(!o?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(r._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let i={};et(i,r,Reflect.ownKeys(Y(r))),et(i,o,Reflect.ownKeys(Y(o)));let a=er(r._zod.def,{shape:i,get catchall(){return o._zod.def.catchall},checks:o._zod.def.checks??[]});return eu(r,a)},pick(t){return function(t,r){let o=t._zod.def,i=o.checks;if(i&&i.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let a={};return et(a,t,ef(t,r)),eu(t,er(o,{shape:a,checks:[]}))}(this,t)},omit(t){return function(t,r){let o=t._zod.def,i=o.checks;if(i&&i.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let a=new Set(ef(t,r)),n={};return et(n,t,Reflect.ownKeys(Y(t)).filter(t=>!a.has(t))),eu(t,er(o,{shape:n,checks:[]}))}(this,t)},partial(...t){return eg(aw,this,t[0])},exactPartial(...t){return eg(aP,this,t[0],"exactPartial")},required(...t){var r,o,i;let a,n;return r=aT,o=this,a=(i=t[0])?new Set(ef(o,i)):void 0,et(n={},o,Reflect.ownKeys(Y(o)),(t,o)=>a&&!a.has(o)?t:new r({type:"nonoptional",innerType:t})),eu(o,er(o._zod.def,{shape:n}))}});function an(t,r){return new aa({type:"object",shape:t??{},...ed(r)})}function as(t,r){return new aa({type:"object",shape:t,catchall:at(),...ed(r)})}let al=eA("ZodUnion",(t,r)=>{rS.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oU(t,r,o,i),t.options=r.options});function ac(t,r){return new al({type:"union",options:t,...ed(r)})}let au=eA("ZodDiscriminatedUnion",(t,r)=>{al.init(t,r),rw.init(t,r)});function ad(t,r,o){return new au({type:"union",options:r,discriminator:t,...ed(o)})}let ap=eA("ZodIntersection",(t,r)=>{r$.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oV(t,r,o,i)});function ah(t,r){return new ap({type:"intersection",left:t,right:r})}let am=eA("ZodRecord",(t,r)=>{iR(),rR.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oF(t,r,o,i),t.keyType=r.keyType,t.valueType=r.valueType});function af(t,r,o){return new am(r&&r._zod?{type:"record",keyType:t,valueType:r,...ed(o)}:{type:"record",keyType:iO(),valueType:t,...ed(r)})}let ay=eA("ZodEnum",(t,r)=>{rE.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oN(t,r,o,i),t.enum=r.entries,t.options=[...t._zod.values];let o=new Set(Object.keys(r.entries));t.extract=(t,i)=>{let a={};for(let i of t)if(o.has(i))a[i]=r.entries[i];else throw Error(`Key ${i} not found in enum`);return new ay({...r,checks:[],...ed(i),entries:a})},t.exclude=(t,i)=>{let a={...r.entries};for(let r of t)if(o.has(r))delete a[r];else throw Error(`Key ${r} not found in enum`);return new ay({...r,checks:[],...ed(i),entries:a})}});function ag(t,r){return new ay({type:"enum",entries:Array.isArray(t)?Object.fromEntries(t.map(t=>[t,t])):t,...ed(r)})}let av=eA("ZodLiteral",(t,r)=>{rk.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oA(t,r,o,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 a_(t,r){return new av({type:"literal",values:Array.isArray(t)?t:[t],...ed(r)})}let ab=eA("ZodTransform",(t,r)=>{iR(),rx.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oq(t,r,o,i),t._zod.parse=(o,i)=>{if("backward"===i.direction)throw new eq(t.constructor.name);o.addIssue=i=>{"string"==typeof i?o.issues.push(eE(i,o.value,r)):(i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=o.value),i.inst??(i.inst=t),o.issues.push(eE(i)))};let a=r.transform(o.value,o);return a instanceof Promise?a.then(t=>(o.value=t,o)):(o.value=a,o)}});function aS(t){return new ab({type:"transform",transform:t})}let aw=eA("ZodOptional",(t,r)=>{rO.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>o0(t,r,o,i),t.unwrap=()=>t._zod.def.innerType});function a$(t){return new aw({type:"optional",innerType:t})}let aP=eA("ZodExactOptional",(t,r)=>{rC.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>o0(t,r,o,i),t.unwrap=()=>t._zod.def.innerType}),aR=eA("ZodNullable",(t,r)=>{rj.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oK(t,r,o,i),t.unwrap=()=>t._zod.def.innerType});function aE(t){return new aR({type:"nullable",innerType:t})}let ak=eA("ZodDefault",(t,r)=>{rI.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oB(t,r,o,i),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap}),ax=eA("ZodPrefault",(t,r)=>{rA.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oG(t,r,o,i),t.unwrap=()=>t._zod.def.innerType}),aT=eA("ZodNonOptional",(t,r)=>{rz.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oJ(t,r,o,i),t.unwrap=()=>t._zod.def.innerType}),aO=eA("ZodCatch",(t,r)=>{rL.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oX(t,r,o,i),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap}),aC=eA("ZodPipe",(t,r)=>{rD.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oY(t,r,o,i),t.in=r.in,t.out=r.out});function aj(t,r){return new aC({type:"pipe",in:t,out:r})}let aI=eA("ZodPreprocess",(t,r)=>{aC.init(t,r),rV.init(t,r)}),aN=eA("ZodReadonly",(t,r)=>{rH.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oQ(t,r,o,i),t.unwrap=()=>t._zod.def.innerType}),aA=eA("ZodLazy",(t,r)=>{rK.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>o1(t,r,o,i),t.unwrap=()=>t._zod.def.getter()});function az(t){return new aA({type:"lazy",getter:t})}let aq=eA("ZodCustom",(t,r)=>{rJ.init(t,r),iE.init(t,r),t._zod.processJSONSchema=(r,o,i)=>oz(t,r,o,i)});function aM(t,r){return new aI({type:"pipe",in:aS(t),out:r})}let aL="custom";O||(O={});let aD="2025-11-25",aU=[aD,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],aV="io.modelcontextprotocol/protocolVersion",aH="io.modelcontextprotocol/clientInfo",aF="io.modelcontextprotocol/serverInfo",aK="io.modelcontextprotocol/clientCapabilities",aJ="io.modelcontextprotocol/subscriptionId",aZ="io.modelcontextprotocol/logLevel",aW=az(()=>ac([iO(),i2(),i3(),i8(),af(iO(),aW),ai(aW)])),aB=af(iO(),aW),aG=ai(aW),aX=ac([iO(),i2().int()]),aY=iO(),aQ=an({ttl:i2().optional()}),a0=an({taskId:iO()}),a1=as({progressToken:aX.optional(),"io.modelcontextprotocol/related-task":a0.optional()}),a2=an({_meta:a1.optional()}),a9=a2.extend({task:aQ.optional()}),a4=an({method:iO(),params:a2.loose().optional()}),a5=an({_meta:a1.optional()}),a3=an({method:iO(),params:a5.loose().optional()}),a6=as({get[aF](){return np.optional().catch(void 0)}}),a8=as({_meta:a6.optional()}),a7=ac([iO(),i2().int()]),ne=an({jsonrpc:a_("2.0"),id:a7,...a4.shape}).strict(),nt=an({jsonrpc:a_("2.0"),...a3.shape}).strict(),nr=an({jsonrpc:a_("2.0"),id:a7,result:a8}).strict(),no=an({jsonrpc:a_("2.0"),id:a7.optional(),error:an({code:i2().int(),message:iO(),data:at().optional()})}).strict(),ni=ac([ne,nt,nr,no]),na=ac([nr,no]),nn=a8.strict(),ns=a5.extend({requestId:a7.optional(),reason:iO().optional()}),nl=a3.extend({method:a_("notifications/cancelled"),params:ns}),nc=an({src:iO(),mimeType:iO().optional(),sizes:ai(iO()).optional(),theme:ag(["light","dark"]).optional()}),nu=an({icons:ai(nc).optional()}),nd=an({name:iO(),title:iO().optional()}),np=nd.extend({...nd.shape,...nu.shape,version:iO(),websiteUrl:iO().optional(),description:iO().optional()}),nh=ah(an({applyDefaults:i3().optional()}),aB),nm=aM(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,ah(an({form:nh.optional(),url:aB.optional()}),aB.optional())),nf=as({list:aB.optional(),cancel:aB.optional(),requests:as({sampling:as({createMessage:aB.optional()}).optional(),elicitation:as({create:aB.optional()}).optional()}).optional()}),ny=as({list:aB.optional(),cancel:aB.optional(),requests:as({tools:as({call:aB.optional()}).optional()}).optional()}),ng=an({experimental:af(iO(),aB).optional(),sampling:an({context:aB.optional(),tools:aB.optional()}).optional(),elicitation:nm.optional(),roots:an({listChanged:i3().optional()}).optional(),tasks:nf.optional(),extensions:af(iO(),aB).optional()}),nv=a2.extend({protocolVersion:iO(),capabilities:ng,clientInfo:np}),n_=a4.extend({method:a_("initialize"),params:nv}),nb=an({experimental:af(iO(),aB).optional(),logging:aB.optional(),completions:aB.optional(),prompts:an({listChanged:i3().optional()}).optional(),resources:an({subscribe:i3().optional(),listChanged:i3().optional()}).optional(),tools:an({listChanged:i3().optional()}).optional(),tasks:ny.optional(),extensions:af(iO(),aB).optional()}),nS=a8.extend({protocolVersion:iO(),capabilities:nb,serverInfo:np,instructions:iO().optional()}),nw=a3.extend({method:a_("notifications/initialized"),params:a5.optional()}),n$=a4.extend({method:a_("server/discover"),params:a2.optional()}),nP=a8.extend({supportedVersions:ai(iO()),capabilities:nb,instructions:iO().optional()}),nR=a4.extend({method:a_("ping"),params:a2.optional()}),nE=an({progress:i2(),total:a$(i2()),message:a$(iO())}),nk=an({...a5.shape,...nE.shape,progressToken:aX}),nx=a3.extend({method:a_("notifications/progress"),params:nk}),nT=a2.extend({cursor:aY.optional()}),nO=a4.extend({params:nT.optional()}),nC=a8.extend({nextCursor:aY.optional()}),nj=an({uri:iO(),mimeType:a$(iO()),_meta:af(iO(),at()).optional()}),nI=nj.extend({text:iO()}),nN=iO().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),nA=nj.extend({blob:nN}),nz=ag(["user","assistant"]),nq=an({audience:ai(nz).optional(),priority:i2().min(0).max(1).optional(),lastModified:rQ(ij,{offset:!0}).optional()}),nM=an({...nd.shape,...nu.shape,uri:iO(),description:a$(iO()),mimeType:a$(iO()),size:a$(i2()),annotations:nq.optional(),_meta:a$(as({}))}),nL=an({...nd.shape,...nu.shape,uriTemplate:iO(),description:a$(iO()),mimeType:a$(iO()),annotations:nq.optional(),_meta:a$(as({}))}),nD=nO.extend({method:a_("resources/list")}),nU=nC.extend({resources:ai(nM)}),nV=nO.extend({method:a_("resources/templates/list")}),nH=nC.extend({resourceTemplates:ai(nL)}),nF=a2.extend({uri:iO()}),nK=a4.extend({method:a_("resources/read"),params:nF}),nJ=a8.extend({contents:ai(ac([nI,nA]))}),nZ=a3.extend({method:a_("notifications/resources/list_changed"),params:a5.optional()}),nW=a4.extend({method:a_("resources/subscribe"),params:nF}),nB=a4.extend({method:a_("resources/unsubscribe"),params:nF}),nG=an({toolsListChanged:i3().optional(),promptsListChanged:i3().optional(),resourcesListChanged:i3().optional(),resourceSubscriptions:ai(iO()).optional()}),nX=a2.extend({notifications:nG}),nY=a4.extend({method:a_("subscriptions/listen"),params:nX}),nQ=a5.extend({notifications:nG}),n0=a3.extend({method:a_("notifications/subscriptions/acknowledged"),params:nQ}),n1=a6.extend({[aJ]:a7}),n2=a8.extend({_meta:n1}),n9=a5.extend({uri:iO()}),n4=a3.extend({method:a_("notifications/resources/updated"),params:n9}),n5=an({name:iO(),description:a$(iO()),required:a$(i3())}),n3=an({...nd.shape,...nu.shape,description:a$(iO()),arguments:a$(ai(n5)),_meta:a$(as({}))}),n6=nO.extend({method:a_("prompts/list")}),n8=nC.extend({prompts:ai(n3)}),n7=a2.extend({name:iO(),arguments:af(iO(),iO()).optional()}),se=a4.extend({method:a_("prompts/get"),params:n7}),st=an({type:a_("text"),text:iO(),annotations:nq.optional(),_meta:af(iO(),at()).optional()}),sr=an({type:a_("image"),data:nN,mimeType:iO(),annotations:nq.optional(),_meta:af(iO(),at()).optional()}),so=an({type:a_("audio"),data:nN,mimeType:iO(),annotations:nq.optional(),_meta:af(iO(),at()).optional()}),si=an({type:a_("tool_use"),name:iO(),id:iO(),input:af(iO(),at()),_meta:af(iO(),at()).optional()}),sa=an({type:a_("resource"),resource:ac([nI,nA]),annotations:nq.optional(),_meta:af(iO(),at()).optional()}),sn=nM.extend({type:a_("resource_link")}),ss=ac([st,sr,so,sn,sa]),sl=an({role:nz,content:ss}),sc=a8.extend({description:iO().optional(),messages:ai(sl)}),su=a3.extend({method:a_("notifications/prompts/list_changed"),params:a5.optional()}),sd=an({title:iO().optional(),readOnlyHint:i3().optional(),destructiveHint:i3().optional(),idempotentHint:i3().optional(),openWorldHint:i3().optional()}),sp=an({taskSupport:ag(["required","optional","forbidden"]).optional()}),sh=an({...nd.shape,...nu.shape,description:iO().optional(),inputSchema:an({type:a_("object"),properties:af(iO(),aW).optional(),required:ai(iO()).optional()}).catchall(at()),outputSchema:as({$schema:iO().optional()}).optional(),annotations:sd.optional(),execution:sp.optional(),_meta:af(iO(),at()).optional()}),sm=nO.extend({method:a_("tools/list")}),sf=nC.extend({tools:ai(sh)}),sy=a8.extend({content:ai(ss).default([]),structuredContent:at().optional(),isError:i3().optional()}),sg=sy.or(a8.extend({toolResult:at()})),sv=a9.extend({name:iO(),arguments:af(iO(),at()).optional()}),s_=a4.extend({method:a_("tools/call"),params:sv}),sb=a3.extend({method:a_("notifications/tools/list_changed"),params:a5.optional()}),sS=an({autoRefresh:i3().default(!0),debounceMs:i2().int().nonnegative().default(300)}),sw=ag(["debug","info","notice","warning","error","critical","alert","emergency"]),s$=a2.extend({level:sw}),sP=a4.extend({method:a_("logging/setLevel"),params:s$}),sR=a5.extend({level:sw,logger:iO().optional(),data:at()}),sE=a3.extend({method:a_("notifications/message"),params:sR}),sk=an({name:iO().optional()}),sx=an({hints:ai(sk).optional(),costPriority:i2().min(0).max(1).optional(),speedPriority:i2().min(0).max(1).optional(),intelligencePriority:i2().min(0).max(1).optional()}),sT=an({mode:ag(["auto","required","none"]).optional()}),sO=an({type:a_("tool_result"),toolUseId:iO().describe("The unique identifier for the corresponding tool call."),content:ai(ss),structuredContent:at().optional(),isError:i3().optional(),_meta:af(iO(),at()).optional()}),sC=ad("type",[st,sr,so]),sj=ad("type",[st,sr,so,si,sO]),sI=an({role:nz,content:ac([sj,ai(sj)]),_meta:af(iO(),at()).optional()}),sN=a9.extend({messages:ai(sI),modelPreferences:sx.optional(),systemPrompt:iO().optional(),includeContext:ag(["none","thisServer","allServers"]).optional(),temperature:i2().optional(),maxTokens:i2().int(),stopSequences:ai(iO()).optional(),metadata:aB.optional(),tools:ai(sh).optional(),toolChoice:sT.optional()}),sA=a4.extend({method:a_("sampling/createMessage"),params:sN}),sz=a8.extend({model:iO(),stopReason:a$(ag(["endTurn","stopSequence","maxTokens"]).or(iO())),role:nz,content:sC}),sq=a8.extend({model:iO(),stopReason:a$(ag(["endTurn","stopSequence","maxTokens","toolUse"]).or(iO())),role:nz,content:ac([sj,ai(sj)])}),sM=an({type:a_("boolean"),title:iO().optional(),description:iO().optional(),default:i3().optional()}),sL=an({type:a_("string"),title:iO().optional(),description:iO().optional(),minLength:i2().optional(),maxLength:i2().optional(),format:ag(["email","uri","date","date-time"]).optional(),default:iO().optional()}),sD=an({type:ag(["number","integer"]),title:iO().optional(),description:iO().optional(),minimum:i2().optional(),maximum:i2().optional(),default:i2().optional()}),sU=an({type:a_("string"),title:iO().optional(),description:iO().optional(),enum:ai(iO()),default:iO().optional()}),sV=an({type:a_("string"),title:iO().optional(),description:iO().optional(),oneOf:ai(an({const:iO(),title:iO()})),default:iO().optional()}),sH=an({type:a_("string"),title:iO().optional(),description:iO().optional(),enum:ai(iO()),enumNames:ai(iO()).optional(),default:iO().optional()}),sF=ac([sU,sV]),sK=an({type:a_("array"),title:iO().optional(),description:iO().optional(),minItems:i2().optional(),maxItems:i2().optional(),items:an({type:a_("string"),enum:ai(iO())}),default:ai(iO()).optional()}),sJ=an({type:a_("array"),title:iO().optional(),description:iO().optional(),minItems:i2().optional(),maxItems:i2().optional(),items:an({anyOf:ai(an({const:iO(),title:iO()}))}),default:ai(iO()).optional()}),sZ=ac([sK,sJ]),sW=ac([sH,sF,sZ]),sB=ac([sW,sM,sL,sD]),sG=a9.extend({mode:a_("form").optional(),message:iO(),requestedSchema:an({type:a_("object"),properties:af(iO(),sB),required:ai(iO()).optional()}).catchall(at())}),sX=a9.extend({mode:a_("url"),message:iO(),elicitationId:iO(),url:iO().url()}),sY=ac([sG,sX]),sQ=a4.extend({method:a_("elicitation/create"),params:sY}),s0=a5.extend({elicitationId:iO()}),s1=a3.extend({method:a_("notifications/elicitation/complete"),params:s0}),s2=a8.extend({action:ag(["accept","decline","cancel"]),content:aM(t=>null===t?void 0:t,af(iO(),ac([iO(),i2(),i3(),ai(iO())])).optional())}),s9=an({type:a_("ref/resource"),uri:iO()}),s4=an({type:a_("ref/prompt"),name:iO()}),s5=a2.extend({ref:ac([s4,s9]),argument:an({name:iO(),value:iO()}),context:an({arguments:af(iO(),iO()).optional()}).optional()}),s3=a4.extend({method:a_("completion/complete"),params:s5}),s6=a8.extend({completion:as({values:ai(iO()).max(100),total:a$(i2().int()),hasMore:a$(i3())})}),s8=an({uri:iO().startsWith("file://"),name:iO().optional(),_meta:af(iO(),at()).optional()}),s7=a4.extend({method:a_("roots/list"),params:a2.optional()}),le=a8.extend({roots:ai(s8)}),lt=a3.extend({method:a_("notifications/roots/list_changed"),params:a5.optional()}),lr=as({ttl:i2().optional(),pollInterval:i2().optional()}),lo=ag(["working","input_required","completed","failed","cancelled"]),li=an({taskId:iO(),status:lo,ttl:ac([i2(),i8()]),createdAt:iO(),lastUpdatedAt:iO(),pollInterval:a$(i2()),statusMessage:a$(iO())}),la=a8.extend({task:li}),ln=a5.merge(li),ls=a3.extend({method:a_("notifications/tasks/status"),params:ln}),ll=a4.extend({method:a_("tasks/get"),params:a2.extend({taskId:iO()})}),lc=a8.merge(li),lu=a4.extend({method:a_("tasks/result"),params:a2.extend({taskId:iO()})}),ld=a8.loose(),lp=nO.extend({method:a_("tasks/list")}),lh=nC.extend({tasks:ai(li)}),lm=a4.extend({method:a_("tasks/cancel"),params:a2.extend({taskId:iO()})}),lf=a8.merge(li),ly=ac([nR,n_,n$,s3,sP,se,n6,nD,nV,nK,nW,nB,nY,s_,sm]),lg=ac([nl,nx,nw,lt]),lv=ac([nn,sz,sq,s2,le]),l_=ac([nR,sA,sQ,s7]),lb=ac([nl,nx,sE,n4,nZ,sb,su,n0,s1]),lS=ac([nn,nS,nP,s6,sc,n8,nU,nH,nJ,sy,sf,n2]),lw=rY(iL,void 0).superRefine((t,r)=>{if(!URL.canParse(t))return r.addIssue({code:aL,message:"URL must be parseable",fatal:!0}),ej}).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"}),l$=as({resource:iO().url(),authorization_servers:ai(lw).optional(),jwks_uri:iO().url().optional(),scopes_supported:ai(iO()).optional(),bearer_methods_supported:ai(iO()).optional(),resource_signing_alg_values_supported:ai(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:ai(iO()).optional(),dpop_signing_alg_values_supported:ai(iO()).optional(),dpop_bound_access_tokens_required:i3().optional()}),lP=as({issuer:iO(),authorization_endpoint:lw,token_endpoint:lw,registration_endpoint:lw.optional(),scopes_supported:ai(iO()).optional(),response_types_supported:ai(iO()),response_modes_supported:ai(iO()).optional(),grant_types_supported:ai(iO()).optional(),token_endpoint_auth_methods_supported:ai(iO()).optional(),token_endpoint_auth_signing_alg_values_supported:ai(iO()).optional(),service_documentation:lw.optional(),revocation_endpoint:lw.optional(),revocation_endpoint_auth_methods_supported:ai(iO()).optional(),revocation_endpoint_auth_signing_alg_values_supported:ai(iO()).optional(),introspection_endpoint:iO().optional(),introspection_endpoint_auth_methods_supported:ai(iO()).optional(),introspection_endpoint_auth_signing_alg_values_supported:ai(iO()).optional(),code_challenge_methods_supported:ai(iO()).optional(),client_id_metadata_document_supported:i3().optional(),authorization_response_iss_parameter_supported:i3().optional().catch(void 0)}),lR=as({issuer:iO(),authorization_endpoint:lw,token_endpoint:lw,userinfo_endpoint:lw.optional(),jwks_uri:lw,registration_endpoint:lw.optional(),scopes_supported:ai(iO()).optional(),response_types_supported:ai(iO()),response_modes_supported:ai(iO()).optional(),grant_types_supported:ai(iO()).optional(),acr_values_supported:ai(iO()).optional(),subject_types_supported:ai(iO()),id_token_signing_alg_values_supported:ai(iO()),id_token_encryption_alg_values_supported:ai(iO()).optional(),id_token_encryption_enc_values_supported:ai(iO()).optional(),userinfo_signing_alg_values_supported:ai(iO()).optional(),userinfo_encryption_alg_values_supported:ai(iO()).optional(),userinfo_encryption_enc_values_supported:ai(iO()).optional(),request_object_signing_alg_values_supported:ai(iO()).optional(),request_object_encryption_alg_values_supported:ai(iO()).optional(),request_object_encryption_enc_values_supported:ai(iO()).optional(),token_endpoint_auth_methods_supported:ai(iO()).optional(),token_endpoint_auth_signing_alg_values_supported:ai(iO()).optional(),display_values_supported:ai(iO()).optional(),claim_types_supported:ai(iO()).optional(),claims_supported:ai(iO()).optional(),service_documentation:iO().optional(),claims_locales_supported:ai(iO()).optional(),ui_locales_supported:ai(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:lw.optional(),op_tos_uri:lw.optional(),client_id_metadata_document_supported:i3().optional(),authorization_response_iss_parameter_supported:i3().optional().catch(void 0)}),lE=an({...lR.shape,...lP.pick({code_challenge_methods_supported:!0}).shape}),lk=an({access_token:iO(),id_token:iO().optional(),token_type:iO(),expires_in:new i1(rG({type:"number",coerce:!0,checks:[],...ed(void 0)})).optional(),scope:iO().optional(),refresh_token:iO().optional()}).strip(),lx=an({issued_token_type:a_("urn:ietf:params:oauth:token-type:id-jag"),access_token:iO(),token_type:iO().optional(),expires_in:i2().optional(),scope:iO().optional()}).strip(),lT=an({error:iO(),error_description:iO().optional(),error_uri:iO().optional()}),lO=lw.optional().or(a_("").transform(()=>void 0)),lC=an({redirect_uris:ai(lw),token_endpoint_auth_method:iO().optional(),grant_types:ai(iO()).optional(),response_types:ai(iO()).optional(),application_type:iO().optional(),client_name:iO().optional(),client_uri:lw.optional(),logo_uri:lO,scope:iO().optional(),contacts:ai(iO()).optional(),tos_uri:lO,policy_uri:iO().optional(),jwks_uri:lw.optional(),jwks:new i7({type:"any"}).optional(),software_id:iO().optional(),software_version:iO().optional(),software_statement:iO().optional()}).strip(),lj=an({client_id:iO(),client_secret:iO().optional(),client_id_issued_at:i2().optional(),client_secret_expires_at:i2().optional()}).strip(),lI=lC.merge(lj),lN=an({error:iO(),error_description:iO().optional()}).strip(),lA=an({token:iO(),token_type_hint:iO().optional()}).strip(),lz=Symbol.for("mcp.sdk.errorBrands");function lq(t,r){let o=new Set,i=r;for(;"function"==typeof i;){let t=i.mcpBrand;Object.prototype.hasOwnProperty.call(i,"mcpBrand")&&"string"==typeof t&&o.add(t),i=Object.getPrototypeOf(i)}0!==o.size&&Object.defineProperty(t,lz,{value:o,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,lz)){let o=r[lz];if(o&&"function"==typeof o.has&&o.has(t.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(t,r)}let lL=((P={}).InvalidRequest="invalid_request",P.InvalidClient="invalid_client",P.InvalidGrant="invalid_grant",P.UnauthorizedClient="unauthorized_client",P.UnsupportedGrantType="unsupported_grant_type",P.InvalidScope="invalid_scope",P.AccessDenied="access_denied",P.ServerError="server_error",P.TemporarilyUnavailable="temporarily_unavailable",P.UnsupportedResponseType="unsupported_response_type",P.UnsupportedTokenType="unsupported_token_type",P.InvalidToken="invalid_token",P.MethodNotAllowed="method_not_allowed",P.TooManyRequests="too_many_requests",P.InvalidClientMetadata="invalid_client_metadata",P.InvalidRedirectUri="invalid_redirect_uri",P.InsufficientScope="insufficient_scope",P.InvalidTarget="invalid_target",P);var lD=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,o){super(r),this.code=t,this.errorUri=o,this.name="OAuthError",lq(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 lU=((R={}).NotConnected="NOT_CONNECTED",R.AlreadyConnected="ALREADY_CONNECTED",R.NotInitialized="NOT_INITIALIZED",R.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",R.RequestTimeout="REQUEST_TIMEOUT",R.ConnectionClosed="CONNECTION_CLOSED",R.SendFailed="SEND_FAILED",R.InvalidResult="INVALID_RESULT",R.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",R.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",R.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",R.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",R.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",R.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",R.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",R.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",R.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",R.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",R.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",R);var lV=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,o){super(r),this.code=t,this.data=o,this.name="SdkError",lq(this,new.target)}},lH=class extends lV{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(t,r,o){super(t,r,o),this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};let lF="2026-07-28",lK=[lF];function lJ(t){return t.filter(t=>!(t>=lF))}function lZ(t){return t.filter(t=>t>=lF)}function lW(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 lG(t){return null===t||"object"!=typeof t||Array.isArray(t)||void 0!==t.content||lB.some(r=>r in t)?t:{...t,content:[]}}function lX(){let t,r,i,a,n,s,l,c,u,d,p,h,m,f,y,g,v,_,b,S,w,$,P,R,E,k,x,T,O,C,j,I,N,A,z,q,M,L,D,U,V,H,F,K,J,Z,W,B,G,X,Y,Q,ee,et,er,eo,ei,ea,en,es,el,ec,eu,ed,ep,eh,em,ef,ey,eg,ev,e_,eb,eS,ew,e$,eP,eR,eE,ek,ex,eT,eO,eC,ej,eI,eN,eA,ez,eq,eM,eL,eD,eU,eV,eH,eF,eK,eJ,eZ,eW,eB,eG,eX,eY,eQ,e0,e1,e2,e9,e4,e5,e3,e6,e8,e7,te,tt,tr,to,ti,ta,tn,ts,tl,tc,tu,td,tp,th,tm,tf,ty,tg,tv,t_,tb,tS,tw,t$;return o??=(t=az(()=>ac([iO(),i2(),i3(),i8(),af(iO(),t),ai(t)])),r=af(iO(),t),i=ac([iO(),i2().int()]),a=iO(),n=an({ttl:i2().optional()}),s=an({taskId:iO()}),l=as({progressToken:i.optional(),"io.modelcontextprotocol/related-task":s.optional()}),u=(c=an({_meta:l.optional()})).extend({task:n.optional()}),d=an({method:iO(),params:c.loose().optional()}),p=an({_meta:l.optional()}),h=an({method:iO(),params:p.loose().optional()}),m=as({_meta:l.optional()}),f=ac([iO(),i2().int()]),y=m.strict(),g=p.extend({requestId:f.optional(),reason:iO().optional()}),v=h.extend({method:a_("notifications/cancelled"),params:g}),_=an({src:iO(),mimeType:iO().optional(),sizes:ai(iO()).optional(),theme:ag(["light","dark"]).optional()}),b=an({icons:ai(_).optional()}),w=(S=an({name:iO(),title:iO().optional()})).extend({...S.shape,...b.shape,version:iO(),websiteUrl:iO().optional(),description:iO().optional()}),$=ah(an({applyDefaults:i3().optional()}),r),P=aM(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,ah(an({form:$.optional(),url:r.optional()}),r.optional())),R=as({list:r.optional(),cancel:r.optional(),requests:as({sampling:as({createMessage:r.optional()}).optional(),elicitation:as({create:r.optional()}).optional()}).optional()}),E=as({list:r.optional(),cancel:r.optional(),requests:as({tools:as({call:r.optional()}).optional()}).optional()}),k=an({experimental:af(iO(),r).optional(),sampling:an({context:r.optional(),tools:r.optional()}).optional(),elicitation:P.optional(),roots:an({listChanged:i3().optional()}).optional(),tasks:R.optional(),extensions:af(iO(),r).optional()}),x=c.extend({protocolVersion:iO(),capabilities:k,clientInfo:w}),T=d.extend({method:a_("initialize"),params:x}),O=an({experimental:af(iO(),r).optional(),logging:r.optional(),completions:r.optional(),prompts:an({listChanged:i3().optional()}).optional(),resources:an({subscribe:i3().optional(),listChanged:i3().optional()}).optional(),tools:an({listChanged:i3().optional()}).optional(),tasks:E.optional(),extensions:af(iO(),r).optional()}),C=m.extend({protocolVersion:iO(),capabilities:O,serverInfo:w,instructions:iO().optional()}),j=h.extend({method:a_("notifications/initialized"),params:p.optional()}),I=d.extend({method:a_("ping"),params:c.optional()}),N=an({progress:i2(),total:a$(i2()),message:a$(iO())}),A=an({...p.shape,...N.shape,progressToken:i}),z=h.extend({method:a_("notifications/progress"),params:A}),q=c.extend({cursor:a.optional()}),M=d.extend({params:q.optional()}),L=m.extend({nextCursor:a.optional()}),U=(D=an({uri:iO(),mimeType:a$(iO()),_meta:af(iO(),at()).optional()})).extend({text:iO()}),V=iO().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),H=D.extend({blob:V}),F=ag(["user","assistant"]),K=an({audience:ai(F).optional(),priority:i2().min(0).max(1).optional(),lastModified:rQ(ij,{offset:!0}).optional()}),J=an({...S.shape,...b.shape,uri:iO(),description:a$(iO()),mimeType:a$(iO()),size:a$(i2()),annotations:K.optional(),_meta:a$(as({}))}),Z=an({...S.shape,...b.shape,uriTemplate:iO(),description:a$(iO()),mimeType:a$(iO()),annotations:K.optional(),_meta:a$(as({}))}),W=M.extend({method:a_("resources/list")}),B=L.extend({resources:ai(J)}),G=M.extend({method:a_("resources/templates/list")}),X=L.extend({resourceTemplates:ai(Z)}),Y=c.extend({uri:iO()}),Q=d.extend({method:a_("resources/read"),params:Y}),ee=m.extend({contents:ai(ac([U,H]))}),et=h.extend({method:a_("notifications/resources/list_changed"),params:p.optional()}),er=d.extend({method:a_("resources/subscribe"),params:Y}),eo=d.extend({method:a_("resources/unsubscribe"),params:Y}),ei=p.extend({uri:iO()}),ea=h.extend({method:a_("notifications/resources/updated"),params:ei}),en=an({name:iO(),description:a$(iO()),required:a$(i3())}),es=an({...S.shape,...b.shape,description:a$(iO()),arguments:a$(ai(en)),_meta:a$(as({}))}),el=M.extend({method:a_("prompts/list")}),ec=L.extend({prompts:ai(es)}),eu=c.extend({name:iO(),arguments:af(iO(),iO()).optional()}),ed=d.extend({method:a_("prompts/get"),params:eu}),ep=an({type:a_("text"),text:iO(),annotations:K.optional(),_meta:af(iO(),at()).optional()}),eh=an({type:a_("image"),data:V,mimeType:iO(),annotations:K.optional(),_meta:af(iO(),at()).optional()}),em=an({type:a_("audio"),data:V,mimeType:iO(),annotations:K.optional(),_meta:af(iO(),at()).optional()}),ef=an({type:a_("tool_use"),name:iO(),id:iO(),input:af(iO(),at()),_meta:af(iO(),at()).optional()}),ey=an({type:a_("resource"),resource:ac([U,H]),annotations:K.optional(),_meta:af(iO(),at()).optional()}),eg=J.extend({type:a_("resource_link")}),ev=ac([ep,eh,em,eg,ey]),e_=an({role:F,content:ev}),eb=m.extend({description:iO().optional(),messages:ai(e_)}),eS=h.extend({method:a_("notifications/prompts/list_changed"),params:p.optional()}),ew=an({title:iO().optional(),readOnlyHint:i3().optional(),destructiveHint:i3().optional(),idempotentHint:i3().optional(),openWorldHint:i3().optional()}),e$=an({taskSupport:ag(["required","optional","forbidden"]).optional()}),eP=an({...S.shape,...b.shape,description:iO().optional(),inputSchema:an({type:a_("object"),properties:af(iO(),t).optional(),required:ai(iO()).optional()}).catchall(at()),outputSchema:an({type:a_("object"),properties:af(iO(),t).optional(),required:ai(iO()).optional()}).catchall(at()).optional(),annotations:ew.optional(),execution:e$.optional(),_meta:af(iO(),at()).optional()}),eR=M.extend({method:a_("tools/list")}),eE=L.extend({tools:ai(eP)}),ek=m.extend({content:ai(ev),structuredContent:af(iO(),at()).optional(),isError:i3().optional()}),ex=u.extend({name:iO(),arguments:af(iO(),at()).optional()}),eT=d.extend({method:a_("tools/call"),params:ex}),eO=h.extend({method:a_("notifications/tools/list_changed"),params:p.optional()}),eC=ag(["debug","info","notice","warning","error","critical","alert","emergency"]),ej=c.extend({level:eC}),eI=d.extend({method:a_("logging/setLevel"),params:ej}),eN=p.extend({level:eC,logger:iO().optional(),data:at()}),eA=h.extend({method:a_("notifications/message"),params:eN}),ez=an({name:iO().optional()}),eq=an({hints:ai(ez).optional(),costPriority:i2().min(0).max(1).optional(),speedPriority:i2().min(0).max(1).optional(),intelligencePriority:i2().min(0).max(1).optional()}),eM=an({mode:ag(["auto","required","none"]).optional()}),eL=an({type:a_("tool_result"),toolUseId:iO().describe("The unique identifier for the corresponding tool call."),content:ai(ev),structuredContent:an({}).loose().optional(),isError:i3().optional(),_meta:af(iO(),at()).optional()}),eD=ad("type",[ep,eh,em]),eU=ad("type",[ep,eh,em,ef,eL]),eV=an({role:F,content:ac([eU,ai(eU)]),_meta:af(iO(),at()).optional()}),eH=u.extend({messages:ai(eV),modelPreferences:eq.optional(),systemPrompt:iO().optional(),includeContext:ag(["none","thisServer","allServers"]).optional(),temperature:i2().optional(),maxTokens:i2().int(),stopSequences:ai(iO()).optional(),metadata:r.optional(),tools:ai(eP).optional(),toolChoice:eM.optional()}),eF=d.extend({method:a_("sampling/createMessage"),params:eH}),eK=m.extend({model:iO(),stopReason:a$(ag(["endTurn","stopSequence","maxTokens"]).or(iO())),role:F,content:eD}),eJ=m.extend({model:iO(),stopReason:a$(ag(["endTurn","stopSequence","maxTokens","toolUse"]).or(iO())),role:F,content:ac([eU,ai(eU)])}),eZ=an({type:a_("boolean"),title:iO().optional(),description:iO().optional(),default:i3().optional()}),eW=an({type:a_("string"),title:iO().optional(),description:iO().optional(),minLength:i2().optional(),maxLength:i2().optional(),format:ag(["email","uri","date","date-time"]).optional(),default:iO().optional()}),eB=an({type:ag(["number","integer"]),title:iO().optional(),description:iO().optional(),minimum:i2().optional(),maximum:i2().optional(),default:i2().optional()}),eG=an({type:a_("string"),title:iO().optional(),description:iO().optional(),enum:ai(iO()),default:iO().optional()}),eX=an({type:a_("string"),title:iO().optional(),description:iO().optional(),oneOf:ai(an({const:iO(),title:iO()})),default:iO().optional()}),eY=an({type:a_("string"),title:iO().optional(),description:iO().optional(),enum:ai(iO()),enumNames:ai(iO()).optional(),default:iO().optional()}),eQ=ac([eG,eX]),e0=an({type:a_("array"),title:iO().optional(),description:iO().optional(),minItems:i2().optional(),maxItems:i2().optional(),items:an({type:a_("string"),enum:ai(iO())}),default:ai(iO()).optional()}),e1=an({type:a_("array"),title:iO().optional(),description:iO().optional(),minItems:i2().optional(),maxItems:i2().optional(),items:an({anyOf:ai(an({const:iO(),title:iO()}))}),default:ai(iO()).optional()}),e2=ac([e0,e1]),e9=ac([eY,eQ,e2]),e4=ac([e9,eZ,eW,eB]),e5=u.extend({mode:a_("form").optional(),message:iO(),requestedSchema:an({type:a_("object"),properties:af(iO(),e4),required:ai(iO()).optional()}).catchall(at())}),e3=u.extend({mode:a_("url"),message:iO(),elicitationId:iO(),url:iO().url()}),e6=ac([e5,e3]),e8=d.extend({method:a_("elicitation/create"),params:e6}),e7=p.extend({elicitationId:iO()}),te=h.extend({method:a_("notifications/elicitation/complete"),params:e7}),tt=m.extend({action:ag(["accept","decline","cancel"]),content:aM(t=>null===t?void 0:t,af(iO(),ac([iO(),i2(),i3(),ai(iO())])).optional())}),tr=an({type:a_("ref/resource"),uri:iO()}),to=an({type:a_("ref/prompt"),name:iO()}),ti=c.extend({ref:ac([to,tr]),argument:an({name:iO(),value:iO()}),context:an({arguments:af(iO(),iO()).optional()}).optional()}),ta=d.extend({method:a_("completion/complete"),params:ti}),tn=m.extend({completion:as({values:ai(iO()).max(100),total:a$(i2().int()),hasMore:a$(i3())})}),ts=an({uri:iO().startsWith("file://"),name:iO().optional(),_meta:af(iO(),at()).optional()}),tl=d.extend({method:a_("roots/list"),params:c.optional()}),tc=m.extend({roots:ai(ts)}),tu=h.extend({method:a_("notifications/roots/list_changed"),params:p.optional()}),td=as({ttl:i2().optional(),pollInterval:i2().optional()}),tp=ag(["working","input_required","completed","failed","cancelled"]),th=an({taskId:iO(),status:tp,ttl:ac([i2(),i8()]),createdAt:iO(),lastUpdatedAt:iO(),pollInterval:a$(i2()),statusMessage:a$(iO())}),tm=m.extend({task:th}),tf=p.merge(th),ty=h.extend({method:a_("notifications/tasks/status"),params:tf}),tg=d.extend({method:a_("tasks/get"),params:c.extend({taskId:iO()})}),tv=m.merge(th),t_=d.extend({method:a_("tasks/result"),params:c.extend({taskId:iO()})}),tb=m.loose(),tS=M.extend({method:a_("tasks/list")}),tw=L.extend({tasks:ai(th)}),t$=d.extend({method:a_("tasks/cancel"),params:c.extend({taskId:iO()})}),{JSONValueSchema:t,JSONObjectSchema:r,ProgressTokenSchema:i,CursorSchema:a,TaskMetadataSchema:n,RelatedTaskMetadataSchema:s,RequestMetaSchema:l,BaseRequestParamsSchema:c,TaskAugmentedRequestParamsSchema:u,RequestSchema:d,NotificationsParamsSchema:p,NotificationSchema:h,ResultSchema:m,RequestIdSchema:f,EmptyResultSchema:y,CancelledNotificationParamsSchema:g,CancelledNotificationSchema:v,IconSchema:_,IconsSchema:b,BaseMetadataSchema:S,ImplementationSchema:w,ClientTasksCapabilitySchema:R,ServerTasksCapabilitySchema:E,ClientCapabilitiesSchema:k,InitializeRequestParamsSchema:x,InitializeRequestSchema:T,ServerCapabilitiesSchema:O,InitializeResultSchema:C,InitializedNotificationSchema:j,PingRequestSchema:I,ProgressSchema:N,ProgressNotificationParamsSchema:A,ProgressNotificationSchema:z,PaginatedRequestParamsSchema:q,PaginatedRequestSchema:M,PaginatedResultSchema:L,ResourceContentsSchema:D,TextResourceContentsSchema:U,BlobResourceContentsSchema:H,RoleSchema:F,AnnotationsSchema:K,ResourceSchema:J,ResourceTemplateSchema:Z,ListResourcesRequestSchema:W,ListResourcesResultSchema:B,ListResourceTemplatesRequestSchema:G,ListResourceTemplatesResultSchema:X,ResourceRequestParamsSchema:Y,ReadResourceRequestParamsSchema:Y,ReadResourceRequestSchema:Q,ReadResourceResultSchema:ee,ResourceListChangedNotificationSchema:et,SubscribeRequestParamsSchema:Y,SubscribeRequestSchema:er,UnsubscribeRequestParamsSchema:Y,UnsubscribeRequestSchema:eo,ResourceUpdatedNotificationParamsSchema:ei,ResourceUpdatedNotificationSchema:ea,PromptArgumentSchema:en,PromptSchema:es,ListPromptsRequestSchema:el,ListPromptsResultSchema:ec,GetPromptRequestParamsSchema:eu,GetPromptRequestSchema:ed,TextContentSchema:ep,ImageContentSchema:eh,AudioContentSchema:em,ToolUseContentSchema:ef,EmbeddedResourceSchema:ey,ResourceLinkSchema:eg,ContentBlockSchema:ev,PromptMessageSchema:e_,GetPromptResultSchema:eb,PromptListChangedNotificationSchema:eS,ToolAnnotationsSchema:ew,ToolExecutionSchema:e$,ToolSchema:eP,ListToolsRequestSchema:eR,ListToolsResultSchema:eE,CallToolResultSchema:ek,CallToolRequestParamsSchema:ex,CallToolRequestSchema:eT,ToolListChangedNotificationSchema:eO,LoggingLevelSchema:eC,SetLevelRequestParamsSchema:ej,SetLevelRequestSchema:eI,LoggingMessageNotificationParamsSchema:eN,LoggingMessageNotificationSchema:eA,ModelHintSchema:ez,ModelPreferencesSchema:eq,ToolChoiceSchema:eM,ToolResultContentSchema:eL,SamplingContentSchema:eD,SamplingMessageContentBlockSchema:eU,SamplingMessageSchema:eV,CreateMessageRequestParamsSchema:eH,CreateMessageRequestSchema:eF,CreateMessageResultSchema:eK,CreateMessageResultWithToolsSchema:eJ,BooleanSchemaSchema:eZ,StringSchemaSchema:eW,NumberSchemaSchema:eB,UntitledSingleSelectEnumSchemaSchema:eG,TitledSingleSelectEnumSchemaSchema:eX,LegacyTitledEnumSchemaSchema:eY,SingleSelectEnumSchemaSchema:eQ,UntitledMultiSelectEnumSchemaSchema:e0,TitledMultiSelectEnumSchemaSchema:e1,MultiSelectEnumSchemaSchema:e2,EnumSchemaSchema:e9,PrimitiveSchemaDefinitionSchema:e4,ElicitRequestFormParamsSchema:e5,ElicitRequestURLParamsSchema:e3,ElicitRequestParamsSchema:e6,ElicitRequestSchema:e8,ElicitationCompleteNotificationParamsSchema:e7,ElicitationCompleteNotificationSchema:te,ElicitResultSchema:tt,ResourceTemplateReferenceSchema:tr,PromptReferenceSchema:to,CompleteRequestParamsSchema:ti,CompleteRequestSchema:ta,CompleteResultSchema:tn,RootSchema:ts,ListRootsRequestSchema:tl,ListRootsResultSchema:tc,RootsListChangedNotificationSchema:tu,TaskCreationParamsSchema:td,TaskStatusSchema:tp,TaskSchema:th,CreateTaskResultSchema:tm,TaskStatusNotificationParamsSchema:tf,TaskStatusNotificationSchema:ty,GetTaskRequestSchema:tg,GetTaskResultSchema:tv,GetTaskPayloadRequestSchema:t_,GetTaskPayloadResultSchema:tb,ListTasksRequestSchema:tS,ListTasksResultSchema:tw,CancelTaskRequestSchema:t$,CancelTaskResultSchema:m.merge(th),ClientRequestSchema:ac([I,T,ta,eI,ed,el,W,G,Q,er,eo,eT,eR,tg,t_,tS,t$]),ClientNotificationSchema:ac([v,z,j,tu,ty]),ClientResultSchema:ac([y,eK,eJ,tt,tc,tv,tw,tm]),ServerRequestSchema:ac([I,eF,e8,tl,tg,t_,tS,t$]),ServerNotificationSchema:ac([v,z,eA,ea,et,eO,eS,ty,te]),ServerResultSchema:ac([y,C,tn,eb,ec,B,X,ee,ek,eE,tv,tw,tm]),CallToolResultWireSchema:at().superRefine((t,r)=>{if(!("object"!=typeof t||null===t||Array.isArray(t))&&void 0===t.content){for(let o of lB)if(o in t)return void r.addIssue({code:"custom",message:`content is required when the body carries '${o}' — another result family cannot default into an empty tools/call success`})}}).transform(lG).pipe(ek)})}function lY(t){return"object"!==t.type}let lQ=new Set(["const","enum","default","examples"]),l0=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function l1(t){return void 0!==t&&!("string"==typeof t&&t.startsWith("#"))}let 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,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},l9={"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},l4={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 l5(){if(i)return i;let t=lX();return i={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 l3(t){return Object.prototype.hasOwnProperty.call(l2,t)}function l6(t){return Object.prototype.hasOwnProperty.call(l9,t)}function l8(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function l7(t,r){if(void 0===t)return{ok:!1,reason:"not-in-era"};let o=t.safeParse(r);return o.success?{ok:!0,value:o.data}:{ok:!1,reason:"invalid",message:String(o.error)}}Object.keys(l2),Object.keys(l9);let ce={ok:!1,reason:"not-in-era"};function ct(t){return l8(t)&&l8(t.outputSchema)&&lY(t.outputSchema)}let cr={era:"2025-11-25",hasRequestMethod:l3,hasNotificationMethod:l6,validateRequest:(t,r)=>{var o;return l7(l3(o=t)?l5().requestSchemas[o]:void 0,r)},validateResult:(t,r)=>{var o,i;return l7((i=o=t,Object.prototype.hasOwnProperty.call(l4,i))?l5().resultSchemas[o]:void 0,r)},validateNotification:(t,r)=>{var o;return l7(l6(o=t)?l5().notificationSchemas[o]:void 0,r)},hasInputRequestMethod:()=>!1,validateInputRequest:()=>ce,validateInputResponse:()=>ce,samplingResultVariant:(t,r)=>{let o=lX();return l7(t?o.CreateMessageResultWithToolsSchema:o.CreateMessageResultSchema,r)},outboundEnvelope:t=>void 0,validateEnvelopeMeta:t=>[],projectCallToolResult(t,r){let o=lW(t),i=o.structuredContent;if(void 0===i)return o;let a="object"!=typeof i||null===i||Array.isArray(i),n=void 0!==r&&lY(r);return a||n?{...o,structuredContent:{result:i}}:o},decodeResult(t,r){if(l8(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 o=r.tools;return Array.isArray(o)&&o.some(t=>ct(t))?{...r,tools:o.map(t=>ct(t)?{...t,outputSchema:function(t){var r;let o="string"==typeof t.$schema?t.$schema:void 0;if(l1(t.$id))return{...void 0!==o&&{$schema:o},type:"object",properties:{result:t},required:["result"]};let i="string"==typeof(r=t.$schema)&&D.has(r.replace(/#$/,""))&&!0!==t.$recursiveAnchor,a=(t,r)=>{if(Array.isArray(t))return t.map(t=>a(t,!1));if(null===t||"object"!=typeof t||!r&&l1(t.$id))return t;let o={},n=!1;for(let[s,l]of Object.entries(t))r?o[s]=a(l,!1):("$ref"===s||"$dynamicRef"===s)&&"string"==typeof l?o[s]="#"===l?"#/properties/result":l.startsWith("#/")?`#/properties/result${l.slice(1)}`:l:"$recursiveRef"===s&&"#"===l&&i?n=!0:lQ.has(s)?o[s]=l:l0.has(s)?o[s]=a(l,!0):o[s]=a(l,!1);return n&&("$ref"in o?o.allOf=[...Array.isArray(o.allOf)?o.allOf:[],{$ref:"#/properties/result"}]:o.$ref="#/properties/result"),o};return{...void 0!==o&&{$schema:o},type:"object",properties:{result:a(t,!1)},required:["result"]}}(t.outputSchema)}:t)}:r},encodeErrorCode:t=>-32002===t?-32602:t,checkInboundEnvelope:t=>void 0};function co(){return s??=function(){let t=az(()=>ac([iO(),i2(),i3(),i8(),af(iO(),t),ai(t)])),r=af(iO(),t),o=ac([iO(),i2().int()]),i=iO(),a=ac([iO(),i2().int()]),n=ag(["user","assistant"]),s=ag(["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=an({ttl:i2().optional()}),u=an({taskId:iO()}),d=as({progressToken:o.optional(),"io.modelcontextprotocol/related-task":u.optional()}),p=an({_meta:d.optional()}),h=p.extend({task:c.optional()}),m=an({_meta:d.optional()}),f=an({method:iO(),params:m.loose().optional()}),y=an({src:iO(),mimeType:iO().optional(),sizes:ai(iO()).optional(),theme:ag(["light","dark"]).optional()}),g=an({icons:ai(y).optional()}),v=an({name:iO(),title:iO().optional()}),_=v.extend({...v.shape,...g.shape,version:iO(),websiteUrl:iO().optional(),description:iO().optional()}),b=ah(an({applyDefaults:i3().optional()}),r),S=aM(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,ah(an({form:b.optional(),url:r.optional()}),r.optional())),w=as({list:r.optional(),cancel:r.optional(),requests:as({sampling:as({createMessage:r.optional()}).optional(),elicitation:as({create:r.optional()}).optional()}).optional()}),$=as({list:r.optional(),cancel:r.optional(),requests:as({tools:as({call:r.optional()}).optional()}).optional()}),P=an({experimental:af(iO(),r).optional(),sampling:an({context:r.optional(),tools:r.optional()}).optional(),elicitation:S.optional(),roots:an({listChanged:i3().optional()}).optional(),tasks:w.optional(),extensions:af(iO(),r).optional()}),R=an({experimental:af(iO(),r).optional(),logging:r.optional(),completions:r.optional(),prompts:an({listChanged:i3().optional()}).optional(),resources:an({subscribe:i3().optional(),listChanged:i3().optional()}).optional(),tools:an({listChanged:i3().optional()}).optional(),tasks:$.optional(),extensions:af(iO(),r).optional()}),E=an({progress:i2(),total:a$(i2()),message:a$(iO())}),k=an({...m.shape,...E.shape,progressToken:o}),x=f.extend({method:a_("notifications/progress"),params:k}),T=m.extend({level:s,logger:iO().optional(),data:at()}),O=f.extend({method:a_("notifications/message"),params:T}),C=an({uri:iO(),mimeType:a$(iO()),_meta:af(iO(),at()).optional()}),j=C.extend({text:iO()}),I=C.extend({blob:l}),N=an({audience:ai(n).optional(),priority:i2().min(0).max(1).optional(),lastModified:rQ(ij,{offset:!0}).optional()}),A=an({...v.shape,...g.shape,uri:iO(),description:a$(iO()),mimeType:a$(iO()),size:a$(i2()),annotations:N.optional(),_meta:a$(as({}))}),z=an({...v.shape,...g.shape,uriTemplate:iO(),description:a$(iO()),mimeType:a$(iO()),annotations:N.optional(),_meta:a$(as({}))}),q=f.extend({method:a_("notifications/resources/list_changed"),params:m.optional()}),M=m.extend({uri:iO()}),L=f.extend({method:a_("notifications/resources/updated"),params:M}),D=an({name:iO(),description:a$(iO()),required:a$(i3())}),U=an({...v.shape,...g.shape,description:a$(iO()),arguments:a$(ai(D)),_meta:a$(as({}))}),V=f.extend({method:a_("notifications/prompts/list_changed"),params:m.optional()}),H=an({type:a_("text"),text:iO(),annotations:N.optional(),_meta:af(iO(),at()).optional()}),F=an({type:a_("image"),data:l,mimeType:iO(),annotations:N.optional(),_meta:af(iO(),at()).optional()}),K=an({type:a_("audio"),data:l,mimeType:iO(),annotations:N.optional(),_meta:af(iO(),at()).optional()}),J=an({type:a_("tool_use"),name:iO(),id:iO(),input:af(iO(),at()),_meta:af(iO(),at()).optional()}),Z=an({type:a_("resource"),resource:ac([j,I]),annotations:N.optional(),_meta:af(iO(),at()).optional()}),W=A.extend({type:a_("resource_link")}),B=ac([H,F,K,W,Z]),G=an({role:n,content:B}),X=an({title:iO().optional(),readOnlyHint:i3().optional(),destructiveHint:i3().optional(),idempotentHint:i3().optional(),openWorldHint:i3().optional()}),Y=f.extend({method:a_("notifications/tools/list_changed"),params:m.optional()}),Q=an({name:iO().optional()}),ee=an({hints:ai(Q).optional(),costPriority:i2().min(0).max(1).optional(),speedPriority:i2().min(0).max(1).optional(),intelligencePriority:i2().min(0).max(1).optional()}),et=an({mode:ag(["auto","required","none"]).optional()}),er=an({type:a_("boolean"),title:iO().optional(),description:iO().optional(),default:i3().optional()}),eo=an({type:a_("string"),title:iO().optional(),description:iO().optional(),minLength:i2().optional(),maxLength:i2().optional(),format:ag(["email","uri","date","date-time"]).optional(),default:iO().optional()}),ei=an({type:ag(["number","integer"]),title:iO().optional(),description:iO().optional(),minimum:i2().optional(),maximum:i2().optional(),default:i2().optional()}),ea=an({type:a_("string"),title:iO().optional(),description:iO().optional(),enum:ai(iO()),default:iO().optional()}),en=an({type:a_("string"),title:iO().optional(),description:iO().optional(),oneOf:ai(an({const:iO(),title:iO()})),default:iO().optional()}),es=an({type:a_("string"),title:iO().optional(),description:iO().optional(),enum:ai(iO()),enumNames:ai(iO()).optional(),default:iO().optional()}),el=ac([ea,en]),ec=an({type:a_("array"),title:iO().optional(),description:iO().optional(),minItems:i2().optional(),maxItems:i2().optional(),items:an({type:a_("string"),enum:ai(iO())}),default:ai(iO()).optional()}),eu=an({type:a_("array"),title:iO().optional(),description:iO().optional(),minItems:i2().optional(),maxItems:i2().optional(),items:an({anyOf:ai(an({const:iO(),title:iO()}))}),default:ai(iO()).optional()}),ed=ac([ec,eu]),ep=ac([es,el,ed]),eh=ac([ep,er,eo,ei]),em=h.extend({mode:a_("form").optional(),message:iO(),requestedSchema:an({type:a_("object"),properties:af(iO(),eh),required:ai(iO()).optional()}).catchall(at())}),ef=an({type:a_("ref/resource"),uri:iO()}),ey=an({type:a_("ref/prompt"),name:iO()}),eg=an({uri:iO().startsWith("file://"),name:iO().optional(),_meta:af(iO(),at()).optional()}),ev=P.shape,e_=an({experimental:ev.experimental,sampling:ev.sampling,elicitation:ev.elicitation,roots:ev.roots,extensions:ev.extensions}),eb=R.shape,eS=an({experimental:eb.experimental,logging:eb.logging,completions:eb.completions,prompts:eb.prompts,resources:eb.resources,tools:eb.tools,extensions:eb.extensions}),ew=as({progressToken:o.optional(),[aV]:iO(),[aH]:_.optional(),[aK]:e_,[aZ]:s.optional()}),e$=an({...v.shape,...g.shape,description:iO().optional(),inputSchema:as({$schema:iO().optional(),type:a_("object")}),outputSchema:as({$schema:iO().optional()}).optional(),annotations:X.optional(),_meta:af(iO(),at()).optional()}),eP=an({type:a_("tool_result"),toolUseId:iO(),content:ai(B),structuredContent:at().optional(),isError:i3().optional(),_meta:af(iO(),at()).optional()}),eR=ac([H,F,K,J,eP]),eE=an({role:n,content:ac([eR,ai(eR)]),_meta:af(iO(),at()).optional()}),ek=iO(),ex=as({[aF]:_.optional().catch(void 0)}),eT=ex.optional();function eO(t){return as({_meta:eT,resultType:ek.default("complete"),...t})}let eC=eO({}),ej=eO({nextCursor:i.optional()}),eI=eO({content:ai(B),structuredContent:at().optional(),isError:i3().optional()}),eN=eO({ttlMs:i2().int().min(0),cacheScope:ag(["public","private"]),tools:ai(e$),nextCursor:i.optional()}),eA=eO({ttlMs:i2().int().min(0),cacheScope:ag(["public","private"]),prompts:ai(U),nextCursor:i.optional()}),ez=eO({description:iO().optional(),messages:ai(G)}),eq=eO({ttlMs:i2().int().min(0),cacheScope:ag(["public","private"]),resources:ai(A),nextCursor:i.optional()}),eM=eO({ttlMs:i2().int().min(0),cacheScope:ag(["public","private"]),resourceTemplates:ai(z),nextCursor:i.optional()}),eL=eO({ttlMs:i2().int().min(0),cacheScope:ag(["public","private"]),contents:ai(ac([j,I]))}),eD=eO({completion:an({values:ai(iO()).max(100),total:i2().int().optional(),hasMore:i3().optional()}).loose()}),eU=eO({ttlMs:i2().int().min(0),cacheScope:ag(["public","private"])}),eV=eO({ttlMs:i2().int().min(0).catch(0),cacheScope:ag(["public","private"]).catch("private"),supportedVersions:ai(iO()),capabilities:eS,instructions:iO().optional()}),eH=an({messages:ai(eE),modelPreferences:ee.optional(),systemPrompt:iO().optional(),includeContext:ag(["none","thisServer","allServers"]).optional(),temperature:i2().optional(),maxTokens:i2().int(),stopSequences:ai(iO()).optional(),metadata:r.optional(),tools:ai(e$).optional(),toolChoice:et.optional()}),eF=an({method:a_("sampling/createMessage"),params:eH}),eK=an({method:a_("roots/list"),params:an({_meta:af(iO(),at()).optional()}).optional()}),eJ=an({...eE.shape,model:iO(),stopReason:iO().optional()}),eZ=an({roots:ai(eg)}),eW=an({action:ag(["accept","decline","cancel"]),content:af(iO(),ac([iO(),i2(),i3(),ai(iO())])).optional()}),eB=an({mode:a_("url"),message:iO(),url:iO().url()}),eG=ac([em,eB]),eX=an({method:a_("elicitation/create"),params:eG}),eY=ac([eF,eK,eX]),eQ=ac([eJ,eZ,eW]),e0=af(iO(),eY),e1=af(iO(),eQ),e2=eO({inputRequests:e0.optional(),requestState:iO().optional()}),e9={inputResponses:e1.optional(),requestState:iO().optional()},e4=an({_meta:ew,...e9}),e5=as({progressToken:o.optional()});function e3(t,r){return an({method:a_(t),params:an({_meta:ew,...r})})}function e6(t,r){return an({method:a_(t),params:an({_meta:e5.optional(),...r}).optional()})}let e8={name:iO(),arguments:af(iO(),at()).optional(),...e9},e7={cursor:i.optional()},te=e3("tools/call",e8),tt=e3("tools/list",e7),tr=e3("prompts/list",e7),to=e3("prompts/get",{name:iO(),arguments:af(iO(),iO()).optional(),...e9}),ti=e3("resources/list",e7),ta=e3("resources/templates/list",e7),tn=e3("resources/read",{uri:iO(),...e9}),ts={ref:ac([ey,ef]),argument:an({name:iO(),value:iO()}),context:an({arguments:af(iO(),iO()).optional()}).optional()},tl=e3("completion/complete",ts),tc=e3("server/discover",{}),tu=an({toolsListChanged:i3().optional(),promptsListChanged:i3().optional(),resourcesListChanged:i3().optional(),resourceSubscriptions:ai(iO()).optional()}),td={notifications:tu},tp=e3("subscriptions/listen",td),th=ex.extend({"io.modelcontextprotocol/subscriptionId":a}),tm=as({_meta:th,resultType:ek.default("complete")}),tf={"tools/call":e6("tools/call",e8),"tools/list":e6("tools/list",e7),"prompts/get":e6("prompts/get",{name:iO(),arguments:af(iO(),iO()).optional()}),"prompts/list":e6("prompts/list",e7),"resources/list":e6("resources/list",e7),"resources/templates/list":e6("resources/templates/list",e7),"resources/read":e6("resources/read",{uri:iO()}),"completion/complete":e6("completion/complete",ts),"server/discover":e6("server/discover",{}),"subscriptions/listen":e6("subscriptions/listen",td)};function ty(t){return as({_meta:eT,...t})}let tg={"tools/call":ty({content:ai(B),structuredContent:at().optional(),isError:i3().optional()}),"tools/list":ty({ttlMs:i2().int().min(0),cacheScope:ag(["public","private"]),tools:ai(e$),nextCursor:i.optional()}),"prompts/get":ty({description:iO().optional(),messages:ai(G)}),"prompts/list":ty({ttlMs:i2().int().min(0),cacheScope:ag(["public","private"]),prompts:ai(U),nextCursor:i.optional()}),"resources/list":ty({ttlMs:i2().int().min(0),cacheScope:ag(["public","private"]),resources:ai(A),nextCursor:i.optional()}),"resources/templates/list":ty({ttlMs:i2().int().min(0),cacheScope:ag(["public","private"]),resourceTemplates:ai(z),nextCursor:i.optional()}),"resources/read":ty({ttlMs:i2().int().min(0),cacheScope:ag(["public","private"]),contents:ai(ac([j,I]))}),"completion/complete":ty({completion:an({values:ai(iO()).max(100),total:i2().int().optional(),hasMore:i3().optional()}).loose()}),"server/discover":ty({ttlMs:i2().int().min(0).catch(0),cacheScope:ag(["public","private"]).catch("private"),supportedVersions:ai(iO()),capabilities:eS,instructions:iO().optional()}),"subscriptions/listen":ty({})},tv=as({"io.modelcontextprotocol/subscriptionId":a.optional()}),t_=an({method:a_("notifications/subscriptions/acknowledged"),params:an({_meta:tv.optional(),notifications:tu})}),tb=an({_meta:tv.optional(),requestId:a,reason:iO().optional()}),tS=an({method:a_("notifications/cancelled"),params:tb}),tw=t=>an({jsonrpc:a_("2.0"),id:ac([iO(),i2().int()]),result:t}).strict();return{JSONValueSchema:t,JSONObjectSchema:r,ProgressTokenSchema:o,CursorSchema:i,RequestIdSchema:a,RoleSchema:n,LoggingLevelSchema:s,TaskMetadataSchema:c,RelatedTaskMetadataSchema:u,RequestMetaSchema:d,BaseRequestParamsSchema:p,TaskAugmentedRequestParamsSchema:h,NotificationsParamsSchema:m,NotificationSchema:f,IconSchema:y,IconsSchema:g,BaseMetadataSchema:v,ImplementationSchema:_,ClientTasksCapabilitySchema:w,ServerTasksCapabilitySchema:$,ClientCapabilitiesSchema:P,ServerCapabilitiesSchema:R,ProgressSchema:E,ProgressNotificationParamsSchema:k,ProgressNotificationSchema:x,LoggingMessageNotificationParamsSchema:T,LoggingMessageNotificationSchema:O,ResourceContentsSchema:C,TextResourceContentsSchema:j,BlobResourceContentsSchema:I,AnnotationsSchema:N,ResourceSchema:A,ResourceTemplateSchema:z,ResourceListChangedNotificationSchema:q,ResourceUpdatedNotificationParamsSchema:M,ResourceUpdatedNotificationSchema:L,PromptArgumentSchema:D,PromptSchema:U,PromptListChangedNotificationSchema:V,TextContentSchema:H,ImageContentSchema:F,AudioContentSchema:K,ToolUseContentSchema:J,EmbeddedResourceSchema:Z,ResourceLinkSchema:W,ContentBlockSchema:B,PromptMessageSchema:G,ToolAnnotationsSchema:X,ToolListChangedNotificationSchema:Y,ModelHintSchema:Q,ModelPreferencesSchema:ee,ToolChoiceSchema:et,BooleanSchemaSchema:er,StringSchemaSchema:eo,NumberSchemaSchema:ei,UntitledSingleSelectEnumSchemaSchema:ea,TitledSingleSelectEnumSchemaSchema:en,LegacyTitledEnumSchemaSchema:es,SingleSelectEnumSchemaSchema:el,UntitledMultiSelectEnumSchemaSchema:ec,TitledMultiSelectEnumSchemaSchema:eu,MultiSelectEnumSchemaSchema:ed,EnumSchemaSchema:ep,PrimitiveSchemaDefinitionSchema:eh,ElicitRequestFormParamsSchema:em,ResourceTemplateReferenceSchema:ef,PromptReferenceSchema:ey,RootSchema:eg,ClientCapabilities2026Schema:e_,ServerCapabilities2026Schema:eS,RequestMetaEnvelopeSchema:ew,ToolSchema:e$,ToolResultContentSchema:eP,SamplingMessageContentBlockSchema:eR,SamplingMessageSchema:eE,ResultTypeSchema:ek,ResultMetaSchema:ex,ResultSchema:eC,PaginatedResultSchema:ej,CallToolResultSchema:eI,ListToolsResultSchema:eN,ListPromptsResultSchema:eA,GetPromptResultSchema:ez,ListResourcesResultSchema:eq,ListResourceTemplatesResultSchema:eM,ReadResourceResultSchema:eL,CompleteResultSchema:eD,CacheableResultSchema:eU,DiscoverResultSchema:eV,CreateMessageRequestParamsSchema:eH,CreateMessageRequestSchema:eF,ListRootsRequestSchema:eK,CreateMessageResultSchema:eJ,ListRootsResultSchema:eZ,ElicitResultSchema:eW,ElicitRequestURLParamsSchema:eB,ElicitRequestParamsSchema:eG,ElicitRequestSchema:eX,InputRequestSchema:eY,InputResponseSchema:eQ,InputRequestsSchema:e0,InputResponsesSchema:e1,InputRequiredResultSchema:e2,InputResponseRequestParamsSchema:e4,CallToolRequestSchema:te,ListToolsRequestSchema:tt,ListPromptsRequestSchema:tr,GetPromptRequestSchema:to,ListResourcesRequestSchema:ti,ListResourceTemplatesRequestSchema:ta,ReadResourceRequestSchema:tn,CompleteRequestSchema:tl,DiscoverRequestSchema:tc,SubscriptionFilterSchema:tu,SubscriptionsListenRequestSchema:tp,SubscriptionsListenResultMetaSchema:th,SubscriptionsListenResultSchema:tm,dispatchRequestSchemas:tf,dispatchResultSchemas:tg,NotificationMetaSchema:tv,SubscriptionsAcknowledgedNotificationSchema:t_,CancelledNotificationParamsSchema:tb,CancelledNotificationSchema:tS,notificationSchemas2026:{"notifications/cancelled":tS,"notifications/progress":x,"notifications/message":O,"notifications/resources/updated":L,"notifications/resources/list_changed":q,"notifications/tools/list_changed":Y,"notifications/prompts/list_changed":V,"notifications/subscriptions/acknowledged":t_},JSONRPCResultResponseSchema:tw(eC),CallToolResultResponseSchema:tw(ac([eI,e2])),ListToolsResultResponseSchema:tw(eN),ListPromptsResultResponseSchema:tw(eA),GetPromptResultResponseSchema:tw(ac([ez,e2])),ListResourcesResultResponseSchema:tw(eq),ListResourceTemplatesResultResponseSchema:tw(eM),ReadResourceResultResponseSchema:tw(ac([eL,e2])),CompleteResultResponseSchema:tw(eD),DiscoverResultResponseSchema:tw(eV)}}()}let ci=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"],ca=Symbol("modelcontextprotocol.resultCacheHintFallback");function cn(t){return"number"==typeof t&&Number.isSafeInteger(t)&&t>=0}function cs(t){return"public"===t||"private"===t}let cl=((E={})[E.ParseError=-32700]="ParseError",E[E.InvalidRequest=-32600]="InvalidRequest",E[E.MethodNotFound=-32601]="MethodNotFound",E[E.InvalidParams=-32602]="InvalidParams",E[E.InternalError=-32603]="InternalError",E[E.ResourceNotFound=-32002]="ResourceNotFound",E[E.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",E[E.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",E[E.UrlElicitationRequired=-32042]="UrlElicitationRequired",E);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,o){super(r),this.code=t,this.data=o,this.name="ProtocolError",lq(this,new.target)}static fromError(r,o,i){return r===cl.UrlElicitationRequired&&i&&i.elicitations?new cd(i.elicitations,o):r===cl.UnsupportedProtocolVersion&&i&&Array.isArray(i.supported)&&"string"==typeof i.requested?new cp({supported:i.supported,requested:i.requested},o):(r===cl.InvalidParams||r===cl.ResourceNotFound)&&"string"==typeof i?.uri&&(r===cl.ResourceNotFound||1===Object.keys(i).length)?new cu(i.uri,o):r===cl.MissingRequiredClientCapability&&i&&null!==i.requiredCapabilities&&"object"==typeof i.requiredCapabilities&&!Array.isArray(i.requiredCapabilities)?new ch({requiredCapabilities:i.requiredCapabilities},o):new t(r,o,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}},ch=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 cm=["tools/call","prompts/get","resources/read"],cf=["elicitation/create","sampling/createMessage","roots/list"];function cy(){if(l)return l;let t=co();return l={request:{"elicitation/create":an({method:a_("elicitation/create"),params:t.ElicitRequestParamsSchema}),"sampling/createMessage":an({method:a_("sampling/createMessage"),params:t.CreateMessageRequestParamsSchema}),"roots/list":an({method:a_("roots/list"),params:as({}).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 cw(t){return Object.prototype.hasOwnProperty.call(cb,t)}function c$(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function cP(t,r){if(void 0===t)return{ok:!1,reason:"not-in-era"};let o=t.safeParse(r);return o.success?{ok:!0,value:o.data}:{ok:!1,reason:"invalid",message:String(o.error)}}Object.keys(c_),Object.keys(cb);let cR={ok:!1,reason:"not-in-era"},cE=[aV,aK],ck={era:"2026-07-28",hasRequestMethod:cS,hasNotificationMethod:cw,hasInputRequestMethod:t=>void 0!==cv(t),validateRequest:(t,r)=>{var o;return cP(cS(o=t)?co().dispatchRequestSchemas[o]:void 0,r)},validateResult:(t,r)=>{var o,i;return cP((i=o=t,Object.prototype.hasOwnProperty.call(c_,i))?co().dispatchResultSchemas[o]:void 0,r)},validateNotification:(t,r)=>{var o;return cP(cw(o=t)?co().notificationSchemas2026[o]:void 0,r)},validateInputRequest:(t,r)=>cP(cv(t),r),validateInputResponse:(t,r)=>{var o;return cP(cg(o=t)?cy().response[o]:void 0,r)},samplingResultVariant:()=>cR,outboundEnvelope:t=>({[aV]:t.protocolVersion,[aH]:t.clientInfo,[aK]:t.clientCapabilities,...void 0!==t.logLevel&&{[aZ]:t.logLevel}}),validateEnvelopeMeta(t){let r=[];for(let o of cE)o in t||r.push({key:o,problem:"missing"});let o=co().RequestMetaEnvelopeSchema.safeParse(t);if(!o.success)for(let t of o.error.issues){let o=t.path.map(String),i=o.length>0?o.join("."):"_meta";1===o.length&&r.some(t=>t.key===i&&"missing"===t.problem)||r.push({key:i,problem:t.message})}return r},projectCallToolResult:t=>lW(t),inputRequestSchema:cv,decodeResult(t,r){if(!c$(r))return{kind:"invalid",error:new lV(lU.InvalidResult,`Invalid result for ${t}: not an object`,{method:t})};let o=r.resultType;if(void 0===o)return{kind:"invalid",error:new lV(lU.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 o)return{kind:"invalid",error:new lV(lU.InvalidResult,`Invalid result for ${t}: non-string resultType`,{method:t,resultType:o})};if("input_required"===o){let o=r.inputRequests,i=c$(o)?o:{},a=r.requestState;return 0===Object.keys(i).length&&"string"!=typeof a?{kind:"invalid",error:new lV(lU.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 a&&{requestState:a}}}if("complete"!==o)return{kind:"invalid",error:new lV(lU.UnsupportedResultType,`Unsupported result type '${o}' for ${t}`,{resultType:o,method:t})};let i=function(){if(c)return c;let t=co();return c={"tools/call":t.CallToolResultSchema,"tools/list":t.ListToolsResultSchema,"prompts/get":t.GetPromptResultSchema,"prompts/list":t.ListPromptsResultSchema,"resources/list":t.ListResourcesResultSchema,"resources/templates/list":t.ListResourceTemplatesResultSchema,"resources/read":t.ReadResourceResultSchema,"completion/complete":t.CompleteResultSchema,"server/discover":t.DiscoverResultSchema}}(),a=Object.hasOwn(i,t)?i[t]:void 0;if(void 0!==a){let o=a.safeParse(r);if(!o.success)return{kind:"invalid",error:new lV(lU.InvalidResult,`Invalid result for ${t}: ${o.error}`,{method:t})}}let n={...r};return delete n.resultType,{kind:"complete",result:n}},encodeResult:(t,r,o)=>(function(t,r){var o;if(void 0===r)return t;let i=t._meta;return void 0===i?{...t,_meta:{[aF]:r}}:null===(o=i)||"object"!=typeof o||Array.isArray(o)||void 0!==i[aF]?t:{...t,_meta:{...i,[aF]:r}}})(function(t,r){var o,i,a,n;let s=r[ca];if("complete"!==r.resultType||(o=t,!ci.includes(o))){let t;return void 0===s?r:(t={...i=r},delete t[ca],t)}let l=cn(r.ttlMs)?r.ttlMs:void 0!==(a=s)&&cn(a.ttlMs)?a.ttlMs:0,c=cs(r.cacheScope)?r.cacheScope:void 0!==(n=s)&&cs(n.cacheScope)?n.cacheScope:"private",u={...r,ttlMs:l,cacheScope:c};return delete u[ca],u}(t,function(t,r){let o=r.resultType;if(void 0===o)return{...r,resultType:"complete"};if("complete"===o||cm.includes(t))return r;throw new cc(cl.InternalError,`Handler for ${t} returned resultType '${String(o)}', but results of ${t} only support 'complete' on protocol revision 2026-07-28`)}(t,function(t,r){let o=r,i=!1,a=()=>(i||(o={...o},i=!0),o),n=r.tools;"tools/list"===t&&Array.isArray(n)&&n.some(t=>c$(t)&&"execution"in t)&&(a().tools=n.map(t=>{if(!c$(t)||!("execution"in t))return t;let r={...t};return delete r.execution,r}));let s=r.capabilities;if(c$(s)&&"tasks"in s){let t={...s};delete t.tasks,a().capabilities=t}return o}(t,r))),o),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=co().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("; ")}`}},cx="2026-07-28";function cT(t){return void 0!==t&&t>=lF?ck:cr}function cO(t){return void 0!==t.revision?cT(t.revision).era:"modern"===t.era?ck.era:cr.era}function cC(t){return cI.some(r=>r.hasRequestMethod(t))}function cj(t){return cI.some(r=>r.hasNotificationMethod(t))}let cI=[cr,ck];var cN=((t,r)=>{let o={};for(var i in t)j(o,i,{get:t[i],enumerable:!0});return r&&j(o,Symbol.toStringTag,{value:"Module"}),o})({AnnotationsSchema:()=>nq,AudioContentSchema:()=>so,BaseMetadataSchema:()=>nd,BaseRequestParamsSchema:()=>a2,BlobResourceContentsSchema:()=>nA,BooleanSchemaSchema:()=>sM,CallToolRequestParamsSchema:()=>sv,CallToolRequestSchema:()=>s_,CallToolResultSchema:()=>sy,CancelTaskRequestSchema:()=>lm,CancelTaskResultSchema:()=>lf,CancelledNotificationParamsSchema:()=>ns,CancelledNotificationSchema:()=>nl,ClientCapabilitiesSchema:()=>ng,ClientNotificationSchema:()=>lg,ClientRequestSchema:()=>ly,ClientResultSchema:()=>lv,ClientTasksCapabilitySchema:()=>nf,CompatibilityCallToolResultSchema:()=>sg,CompleteRequestParamsSchema:()=>s5,CompleteRequestSchema:()=>s3,CompleteResultSchema:()=>s6,ContentBlockSchema:()=>ss,CreateMessageRequestParamsSchema:()=>sN,CreateMessageRequestSchema:()=>sA,CreateMessageResultSchema:()=>sz,CreateMessageResultWithToolsSchema:()=>sq,CreateTaskResultSchema:()=>la,CursorSchema:()=>aY,DiscoverRequestSchema:()=>n$,DiscoverResultSchema:()=>nP,ElicitRequestFormParamsSchema:()=>sG,ElicitRequestParamsSchema:()=>sY,ElicitRequestSchema:()=>sQ,ElicitRequestURLParamsSchema:()=>sX,ElicitResultSchema:()=>s2,ElicitationCompleteNotificationParamsSchema:()=>s0,ElicitationCompleteNotificationSchema:()=>s1,EmbeddedResourceSchema:()=>sa,EmptyResultSchema:()=>nn,EnumSchemaSchema:()=>sW,GetPromptRequestParamsSchema:()=>n7,GetPromptRequestSchema:()=>se,GetPromptResultSchema:()=>sc,GetTaskPayloadRequestSchema:()=>lu,GetTaskPayloadResultSchema:()=>ld,GetTaskRequestSchema:()=>ll,GetTaskResultSchema:()=>lc,IconSchema:()=>nc,IconsSchema:()=>nu,ImageContentSchema:()=>sr,ImplementationSchema:()=>np,InitializeRequestParamsSchema:()=>nv,InitializeRequestSchema:()=>n_,InitializeResultSchema:()=>nS,InitializedNotificationSchema:()=>nw,JSONArraySchema:()=>aG,JSONObjectSchema:()=>aB,JSONRPCErrorResponseSchema:()=>no,JSONRPCMessageSchema:()=>ni,JSONRPCNotificationSchema:()=>nt,JSONRPCRequestSchema:()=>ne,JSONRPCResponseSchema:()=>na,JSONRPCResultResponseSchema:()=>nr,JSONValueSchema:()=>aW,LegacyTitledEnumSchemaSchema:()=>sH,ListChangedOptionsBaseSchema:()=>sS,ListPromptsRequestSchema:()=>n6,ListPromptsResultSchema:()=>n8,ListResourceTemplatesRequestSchema:()=>nV,ListResourceTemplatesResultSchema:()=>nH,ListResourcesRequestSchema:()=>nD,ListResourcesResultSchema:()=>nU,ListRootsRequestSchema:()=>s7,ListRootsResultSchema:()=>le,ListTasksRequestSchema:()=>lp,ListTasksResultSchema:()=>lh,ListToolsRequestSchema:()=>sm,ListToolsResultSchema:()=>sf,LoggingLevelSchema:()=>sw,LoggingMessageNotificationParamsSchema:()=>sR,LoggingMessageNotificationSchema:()=>sE,ModelHintSchema:()=>sk,ModelPreferencesSchema:()=>sx,MultiSelectEnumSchemaSchema:()=>sZ,NotificationSchema:()=>a3,NotificationsParamsSchema:()=>a5,NumberSchemaSchema:()=>sD,PaginatedRequestParamsSchema:()=>nT,PaginatedRequestSchema:()=>nO,PaginatedResultSchema:()=>nC,PingRequestSchema:()=>nR,PrimitiveSchemaDefinitionSchema:()=>sB,ProgressNotificationParamsSchema:()=>nk,ProgressNotificationSchema:()=>nx,ProgressSchema:()=>nE,ProgressTokenSchema:()=>aX,PromptArgumentSchema:()=>n5,PromptListChangedNotificationSchema:()=>su,PromptMessageSchema:()=>sl,PromptReferenceSchema:()=>s4,PromptSchema:()=>n3,ReadResourceRequestParamsSchema:()=>nF,ReadResourceRequestSchema:()=>nK,ReadResourceResultSchema:()=>nJ,RelatedTaskMetadataSchema:()=>a0,RequestIdSchema:()=>a7,RequestMetaSchema:()=>a1,RequestSchema:()=>a4,ResourceContentsSchema:()=>nj,ResourceLinkSchema:()=>sn,ResourceListChangedNotificationSchema:()=>nZ,ResourceRequestParamsSchema:()=>nF,ResourceSchema:()=>nM,ResourceTemplateReferenceSchema:()=>s9,ResourceTemplateSchema:()=>nL,ResourceUpdatedNotificationParamsSchema:()=>n9,ResourceUpdatedNotificationSchema:()=>n4,ResultMetaObjectSchema:()=>a6,ResultSchema:()=>a8,RoleSchema:()=>nz,RootSchema:()=>s8,RootsListChangedNotificationSchema:()=>lt,SamplingContentSchema:()=>sC,SamplingMessageContentBlockSchema:()=>sj,SamplingMessageSchema:()=>sI,ServerCapabilitiesSchema:()=>nb,ServerNotificationSchema:()=>lb,ServerRequestSchema:()=>l_,ServerResultSchema:()=>lS,ServerTasksCapabilitySchema:()=>ny,SetLevelRequestParamsSchema:()=>s$,SetLevelRequestSchema:()=>sP,SingleSelectEnumSchemaSchema:()=>sF,StringSchemaSchema:()=>sL,SubscribeRequestParamsSchema:()=>nF,SubscribeRequestSchema:()=>nW,SubscriptionFilterSchema:()=>nG,SubscriptionsAcknowledgedNotificationParamsSchema:()=>nQ,SubscriptionsAcknowledgedNotificationSchema:()=>n0,SubscriptionsListenRequestParamsSchema:()=>nX,SubscriptionsListenRequestSchema:()=>nY,SubscriptionsListenResultMetaSchema:()=>n1,SubscriptionsListenResultSchema:()=>n2,TaskAugmentedRequestParamsSchema:()=>a9,TaskCreationParamsSchema:()=>lr,TaskMetadataSchema:()=>aQ,TaskSchema:()=>li,TaskStatusNotificationParamsSchema:()=>ln,TaskStatusNotificationSchema:()=>ls,TaskStatusSchema:()=>lo,TextContentSchema:()=>st,TextResourceContentsSchema:()=>nI,TitledMultiSelectEnumSchemaSchema:()=>sJ,TitledSingleSelectEnumSchemaSchema:()=>sV,ToolAnnotationsSchema:()=>sd,ToolChoiceSchema:()=>sT,ToolExecutionSchema:()=>sp,ToolListChangedNotificationSchema:()=>sb,ToolResultContentSchema:()=>sO,ToolSchema:()=>sh,ToolUseContentSchema:()=>si,UnsubscribeRequestParamsSchema:()=>nF,UnsubscribeRequestSchema:()=>nB,UntitledMultiSelectEnumSchemaSchema:()=>sK,UntitledSingleSelectEnumSchemaSchema:()=>sU});let cA=t=>nr.safeParse(t).success,cz=t=>no.safeParse(t).success,cq=t=>"object"==typeof t&&null!==t&&!Array.isArray(t)&&"input_required"===t.resultType,cM="x-mcp-header",cL=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,cD=new Set(["string","integer","boolean","number"]);function cU(t){let r=[],o=new Map,i=(t,a,n)=>{if(null===t||"object"!=typeof t)return;if(cM in t){if(!n||0===a.length)return`${cF(a)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let i=t[cM];if("string"!=typeof i||0===i.length)return`${cF(a)}: x-mcp-header MUST be a non-empty string`;if(!cL.test(i))return`${cF(a)}: x-mcp-header '${i}' 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||!cD.has(s))return`${cF(a)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${s??"<none>"}`;let l=i.toLowerCase(),c=o.get(l);if(void 0!==c)return`x-mcp-header '${i}' is not case-insensitively unique (also declared as '${c}')`;o.set(l,i),r.push({path:a,headerName:i,type:s})}let s=t.properties;if(null!==s&&"object"==typeof s)for(let[t,r]of Object.entries(s)){let o=i(r,[...a,t],n);if(void 0!==o)return o}for(let r of cV){let o=t[r];if(void 0!==o)for(let t of Array.isArray(o)?o:null!==o&&"object"==typeof o&&cH.has(r)?Object.values(o):[o]){let o=i(t,[...a,`<${r}>`],!1);if(void 0!==o)return o}}},a=i(t,[],!0);return void 0===a?{valid:!0,declarations:r}:{valid:!1,reason:a}}let cV=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],cH=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function cF(t){return 0===t.length?"<root>":t.join(".")}let cK="=?base64?";function cJ(t){return!function(t){if(0===t.length||t.startsWith(cK)&&t.endsWith("?=")||t!==t.trim())return!0;for(let r=0;r<t.length;r++){let o=t.codePointAt(r);if(9!==o&&(!(o>=32)||!(o<=126)))return!0}return!1}(t)?t:`${cK}${function(t){let r=new TextEncoder().encode(t),o="";for(let t of r)o+=String.fromCodePoint(t);return btoa(o)}(t)}?=`}function cZ(t){return new Set(t.flatMap(t=>Object.keys(t.shape)))}function cW(t){if(null==t)return!1;let r=typeof t;return("object"===r||"function"===r)&&"~standard"in t&&"function"==typeof t["~standard"]?.validate}cl.InvalidRequest,cl.UnsupportedProtocolVersion,cl.InvalidParams,cl.MethodNotFound,cl.InvalidParams,cl.MissingRequiredClientCapability,cl.ParseError,cl.InvalidRequest,cl.MethodNotFound,cl.UnsupportedProtocolVersion,cl.MissingRequiredClientCapability;let cB=!1,cG="draft-2020-12";async function cX(t,r){let o=await t["~standard"].validate(r);return o.issues&&o.issues.length>0?{success:!1,error:o.issues.map(t=>{var r;return r=t,r.path?.length?`${r.path.map(t=>String("object"==typeof t?t.key:t)).join(".")}: ${r.message}`:r.message}).join(", ")}:{success:!0,data:o.value}}let cY=/\\\.\\d\{(\d+)\}/;function cQ(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}let c0=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function c1(t){return c0.has(t)||t.startsWith("x-")}let c2=new Set(["$schema",...Object.keys(sG.shape.requestedSchema.shape)]),c9={string:cZ([sL,sU,sV,sH]),number:cZ([sD]),integer:cZ([sD]),boolean:cZ([sM]),array:cZ([sK,sJ])},c4=new Set(sL.shape.format.unwrap().options);async function c5(t){let{config:r,method:o,originalParams:i,requestOptions:a,hooks:n,signal:s}=t,l=t.flowStartedAt??Date.now(),c=t.firstPayload,u=0;for(;;){let t;if((u+=1)>r.maxRounds){var d,p;throw new lV(lU.InputRequiredRoundsExceeded,(d=o,p=r.maxRounds,`Multi-round-trip request '${d}' still required input after ${p} rounds (inputRequired.maxRounds)`),{rounds:r.maxRounds,lastResult:{inputRequests:c.inputRequests,...void 0!==c.requestState&&{requestState:c.requestState}}})}a.onprogress?.({progress:u,message:`Fulfilling input required by '${o}' (round ${u})`});let h=Object.entries(c.inputRequests??{});if(h.length>0){let r=function(t){let r=new AbortController,o=()=>r.abort(t?.reason);return t?.addEventListener("abort",o,{once:!0}),t?.aborted&&r.abort(t.reason),{signal:r.signal,abort:t=>r.abort(t),dispose:()=>t?.removeEventListener("abort",o)}}(s);try{let o=await Promise.all(h.map(async([t,o])=>{try{return[t,await n.dispatchInputRequest(t,o,r.signal)]}catch(t){throw r.abort(t),t}}));t=Object.fromEntries(o)}finally{r.dispose()}}else await function(t,r){return new Promise((t,o)=>{if(r?.aborted)return void o(r.reason instanceof lV?r.reason:new lV(lU.RequestTimeout,String(r.reason)));let i=setTimeout(()=>{r?.removeEventListener("abort",a),t()},250),a=()=>{clearTimeout(i),o(r?.reason instanceof lV?r.reason:new lV(lU.RequestTimeout,String(r?.reason)))};r?.addEventListener("abort",a,{once:!0})})}(0,s);let m={...void 0!==a.timeout&&{timeout:a.timeout}};if(void 0!==a.maxTotalTimeout){let t=Date.now()-l,r=a.maxTotalTimeout-t;if(r<=0)throw new lV(lU.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:a.maxTotalTimeout,totalElapsed:t});m.maxTotalTimeout=r}let f=await n.retry(function(t,r,o){let i=void 0!==r&&Object.keys(r).length>0;return i||void 0!==o?{...t,...i&&{inputResponses:r},...void 0!==o&&{requestState:o}}:t}(i,t,c.requestState),m);if(cq(f)){c={inputRequests:f.inputRequests??{},...void 0!==f.requestState&&{requestState:f.requestState}};continue}return f}}Object.assign(function(t){let r=void 0!==t.inputRequests&&Object.keys(t.inputRequests).length>0,o="string"==typeof t.requestState;if(!r&&!o)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(!cW(t.requestedSchema))return{...t,mode:"form",requestedSchema:t.requestedSchema};let o=t.requestedSchema["~standard"].vendor,i=function(t,r){let o={},i=[];for(let[a,n]of Object.entries(t))"properties"===a&&cQ(n)?o[a]=Object.fromEntries(Object.entries(n).map(([t,o])=>[t,function(t,r,o,i){if(!cQ(t))return t;let a="string"==typeof t.type&&Object.hasOwn(c9,t.type)?c9[t.type]:void 0;if(void 0===a)return t;let n={};for(let[c,u]of Object.entries(t))if(a.has(c)||c1(c))n[c]=u;else if("pattern"===c&&"string"===t.type&&"string"==typeof t.format)if(c4.has(t.format)){var s,l;"string"==typeof u&&(s=t.format,l=u,"zod"!==o||(function(t,r){var o;let i,a,n;switch(t){case"email":i=[rX(iz,void 0)];break;case"uri":i=[rY(iL,void 0)];break;case"date":i=[r0(iI,void 0)];break;case"date-time":o=r,a=cY.exec(o),n=[void 0,-1,0],a&&n.push(Number(a[1])),i=[!1,!0].flatMap(t=>[!1,!0].flatMap(r=>n.map(o=>rQ(ij,{local:t,offset:r,precision:o}))))}return new Set(i.map(t=>{let r;return r=o9(t,{target:cG,io:"input"}),"string"==typeof r.pattern?r.pattern:void 0}).filter(t=>void 0!==t))})(s,l).has(l))||i.push(`${r}.${c}`)}else n[c]=u;else i.push(`${r}.${c}`);return n}(o,`properties.${t}`,r,i)])):c2.has(a)?o[a]=n:c1(a)||i.push(a);if(i.length>0)throw new cc(cl.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${i.join(", ")}`);return o}(function(t){try{return function(t,r="input"){let o,i=t["~standard"];if(i.jsonSchema)o=i.jsonSchema[r]({target:cG});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().");cB||(cB=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),o=o9(t,{target:cG,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!==o.type||!function t(r){if("properties"in r||"patternProperties"in r||"additionalProperties"in r||"required"in r)return!0;for(let o of["oneOf","anyOf","allOf"]){let i=r[o];if(Array.isArray(i)&&i.length>0)return i.every(r=>null!==r&&"object"==typeof r&&("object"===r.type||t(r)))}return!1}(o)?o:{type:"object",...o};if(void 0!==o.type&&"object"!==o.type)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(o.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...o}}(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),o),a=(r=sG.shape.requestedSchema,im(r,i));if(!a.success)throw new cc(cl.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${function(t,r){if(!cQ(t.properties))return r;let o=Object.entries(t.properties).filter(([,t])=>!im(sB,t).success).map(([t])=>`properties.${t}`);return o.length>0?o.join(", "):r}(i,a.error.message)}`);let n=function t(r,o,i=""){return Array.isArray(r)&&Array.isArray(o)?r.flatMap((r,a)=>t(r,o[a],`${i}[${a}]`)):cQ(r)&&cQ(o)?Object.entries(r).flatMap(([r,a])=>{let n=i?`${i}.${r}`:r;return Object.prototype.hasOwnProperty.call(o,r)?t(a,o[r],n):c1(r)?[]:[n]}):[]}(i,a.data);if(n.length>0)throw new cc(cl.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);let s=(a.data.required??[]).filter(t=>!Object.prototype.hasOwnProperty.call(a.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:a.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 c3={},c6={};function c8(t,r){let o=t.slice(0,-6);c3[o]=r,c6[o]=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"])c8(t,cN[t]);for(let[t,r]of Object.entries({IdJagTokenExchangeResponseSchema:lx,OAuthClientInformationFullSchema:lI,OAuthClientInformationSchema:lj,OAuthClientMetadataSchema:lC,OAuthClientRegistrationErrorSchema:lN,OAuthErrorResponseSchema:lT,OAuthMetadataSchema:lP,OAuthProtectedResourceMetadataSchema:l$,OAuthTokenRevocationRequestSchema:lA,OAuthTokensSchema:lk,OpenIdProviderDiscoveryMetadataSchema:lE,OpenIdProviderMetadataSchema:lR}))c8(t,r);Object.freeze(c3);let c7=Object.freeze(c6),ue=[aV,aH,aK,aZ],ut=["inputResponses","requestState"];function ur(t,r){let o=t.params;if(!un(o))return{message:t,lifted:{}};let i=o._meta,a=un(i)?ue.filter(t=>t in i):[],n="request"===r?ut.filter(t=>t in o):[];if(0===a.length&&0===n.length)return{message:t,lifted:{}};let s={},l={...o};if(a.length>0&&un(i)){let t={},r={...i};for(let o of a)t[o]=i[o],delete r[o];s.envelope=t,Object.keys(r).length>0?l._meta=r:delete l._meta}for(let t of n)"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 o=t.validateResult(r,void 0);if(o.ok||"not-in-era"!==o.reason)return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(o){let i=t.validateResult(r,o);return i.ok?{value:i.value}:{issues:[{message:"invalid"===i.reason?i.message:`not-in-era: ${r}`}]}}}}}let ui=(k=void 0,()=>k);var ua=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;_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(t){this._options=t,this._supportedProtocolVersions=t?.supportedProtocolVersions??aU,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 o=t.params??{};return{...t,params:{...o,_meta:{...r,...o._meta}}}}_resolveNonCompleteResult(t,r){return Promise.reject(new lV(lU.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,o,i,a=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:o,resetTimeoutOnProgress:a,onTimeout:i})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let o=Date.now()-r.startTime;if(r.maxTotalTimeout&&o>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),new lV(lU.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:o});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 o=this.transport?.onerror;this._transport.onerror=t=>{o?.(t),this._onerror(t)};let i=this._transport?.onmessage;this._transport.onmessage=(t,r)=>{if(i?.(t,r),cA(t)||cz(t))this._onresponse(t);else{let o;if(o=t,ne.safeParse(o).success)this._onrequest(t,r);else{let o;(o=t,nt.safeParse(o).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 o=new lV(lU.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let r of t.values())r(o);for(let t of r.values())t.abort(o)}}_onerror(t){this.onerror?.(t)}_onnotification(t,r){let{message:o}=ur(t,"notification"),i=this._negotiatedWireCodec();if(r?.classification===void 0&&"drop"===this._shouldDropInbound(t))return;if(r?.classification!==void 0){let t=cO(r.classification);if(t!==i.era)return void this._onerror(Error(`Era mismatch on inbound notification '${o.method}': classified as ${t} but this instance serves ${i.era}`))}if(cj(o.method)&&!i.hasNotificationMethod(o.method))return;let a=this._notificationHandlers.get(o.method),n=this.fallbackNotificationHandler;(void 0!==a||void 0!==n)&&Promise.resolve().then(()=>void 0===a?n(o):a(o,i)).catch(t=>this._onerror(Error(`Uncaught error in notification handler: ${t}`)))}_onrequest(t,r){var o;let{message:i,lifted:a}=ur(t,"request"),n=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,o)=>{let a={jsonrpc:"2.0",id:i.id,error:{code:t,message:r,...void 0!==o&&{data:o}}};s?.send(a).catch(t=>this._onerror(Error(`Failed to send an error response: ${t}`)))};if(r?.classification!==void 0){let t=cO(r.classification);if(t!==n.era){this._onerror(Error(`Era mismatch on inbound request '${i.method}': classified as ${t} but this instance serves ${n.era}`));let o=r.classification.revision??t;l(cl.UnsupportedProtocolVersion,`Unsupported protocol version: ${o}`,{supported:this._supportedProtocolVersions,requested:o});return}}if(cC(i.method)&&!n.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=n.checkInboundEnvelope(a);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,o)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(t.method),t,r,{...o,relatedRequestId:i.id}),h=new AbortController;this._requestHandlerAbortControllers.set(i.id,h);let m=void 0===a.inputResponses?void 0:function(t){let r={},o=[];if(!us(t))return{accepted:r,droppedKeys:o};for(let[i,a]of Object.entries(t)){if(!us(a)||"method"in a||"result"in a){o.push(i);continue}r[i]=a}return{accepted:r,droppedKeys:o}}(a.inputResponses),f={sessionId:s?.sessionId,mcpReq:{id:i.id,method:i.method,_meta:i.params?._meta,...void 0!==a.envelope&&{envelope:a.envelope},...void 0!==m&&{inputResponses:m.accepted},...void 0!==m&&m.droppedKeys.length>0&&{droppedInputResponseKeys:m.droppedKeys},requestState:void 0===a.requestState?ui:(o=a.requestState,()=>o),signal:h.signal,send:(t,r,o)=>{let i=this._resolveOutboundCodec(t.method);if(this._assertOutboundRequestInEra(i,t.method),cW(r))return p(t,r,o);let a=uo(i,t.method);if(void 0===a)throw TypeError(`'${t.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return p(t,a,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(h.signal.aborted)return;try{r=n.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 o={result:r,jsonrpc:"2.0",id:i.id};await s?.send(o)},async t=>{if(h.signal.aborted)return;let r=Number.isSafeInteger(t.code)?t.code:cl.InternalError,o={jsonrpc:"2.0",id:i.id,error:{code:n.encodeErrorCode(r),message:t.message??"Internal error",...void 0!==t.data&&{data:t.data}}};await s?.send(o)}).catch(t=>this._onerror(Error(`Failed to send response: ${t}`))).finally(()=>{this._requestHandlerAbortControllers.get(i.id)===h&&this._requestHandlerAbortControllers.delete(i.id)})}_onprogress(t){let{progressToken:r,...o}=t.params,i=Number(r),a=this._progressHandlers.get(i);if(!a)return void this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));let n=this._responseHandlers.get(i),s=this._timeoutInfo.get(i);if(s&&n&&s.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(t){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),n(t);return}a(o)}_onresponse(t){let r=Number(t.id),o=this._responseHandlers.get(r);void 0===o?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),o(cA(t)?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,o){let i=this._resolveOutboundCodec(t.method);if(this._assertOutboundRequestInEra(i,t.method),cW(r))return this._requestWithSchemaViaCodec(i,t,r,o);let a=uo(i,t.method);if(void 0===a)throw TypeError(`'${t.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(i,t,a,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(cx);default:return}}(t);if(r)return r}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(t,r){if(cC(r)&&!t.hasRequestMethod(r))throw new lV(lU.MethodNotSupportedByProtocolVersion,`Method '${r}' is not supported by the negotiated protocol version (wire era ${t.era})`,{method:r,era:t.era})}_requestWithSchema(t,r,o){let i=this._resolveOutboundCodec(t.method);return this._assertOutboundRequestInEra(i,t.method),this._requestWithSchemaViaCodec(i,t,r,o)}_requestWithSchemaViaCodec(t,r,o,i){let a,n,{relatedRequestId:s,resumptionToken:l,onresumptiontoken:c,headers:u}=i??{},d=Date.now();return new Promise((p,h)=>{let m=t=>{h(t)};if(!this._transport)return void m(Error("Not connected"));if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(r.method)}catch(t){m(t);return}if(i?.signal?.aborted){let t=i.signal.reason;throw t instanceof lV?t:new lV(lU.RequestTimeout,String(t))}let f=t.era===cx&&!0===this._transport.hasPerRequestStream?new AbortController:void 0,y=this._requestMessageId++;n=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(),h(t instanceof lV?t:new lV(lU.RequestTimeout,String(t))))};this._responseHandlers.set(y,a=>{let n;if(!i?.signal?.aborted){if(_=!0,a instanceof Error)return h(a);try{n=t.decodeResult(r.method,a.result)}catch(t){return h(t instanceof Error?t:Error(String(t)))}if("invalid"===n.kind)return h(n.error);if("input_required"===n.kind){var s;return i?.allowInputRequired===!0?p({resultType:"input_required",inputRequests:(s=n).inputRequests,...void 0!==s.requestState&&{requestState:s.requestState}}):p(this._resolveNonCompleteResult(n,{codec:t,request:r,resultSchema:o,options:i,flowStartedAt:d,retry:(i,a)=>this._requestWithSchemaViaCodec(t,void 0===i?{method:r.method}:{method:r.method,params:i},o,a)}))}cX(o,n.result).then(t=>{t.success?p(t.data):h(new lV(lU.InvalidResult,`Invalid result for ${r.method}: ${t.error}`))},h)}}),a=()=>b(i?.signal?.reason),i?.signal?.addEventListener("abort",a,{once:!0});let S=i?.timeout??6e4;this._setupTimeout(y,S,i?.maxTotalTimeout,()=>b(new lV(lU.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),h(t)})}).finally(()=>{a&&i?.signal?.removeEventListener("abort",a),void 0!==n&&(this._responseHandlers.delete(n),this._cleanupTimeout(n))})}async notification(t,r){return this._notificationViaCodec(this._resolveOutboundCodec(t.method),t,r)}async _notificationViaCodec(t,r,o){if(!this._transport)throw new lV(lU.NotConnected,"Not connected");if(cj(r.method)&&!t.hasNotificationMethod(r.method))throw new lV(lU.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&&!o?.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,o).catch(t=>this._onerror(t))});return}await this._transport.send(i,o)}setRequestHandler(t,r,o){let i;if(this.assertRequestHandlerCapability(t),"function"==typeof r){if(!cC(t))throw TypeError(`'${t}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);i=(o,i)=>{let a=this._negotiatedWireCodec(),n=a.validateRequest(t,o);if(n.ok||"not-in-era"!==n.reason||(n=a.validateInputRequest(t,o)),!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,i))}}else if(o)i=async(i,a)=>{let n=await cX(r.params,{...i.params});if(!n.success)throw new cc(cl.InvalidParams,`Invalid params for ${t}: ${n.error}`);return o(n.data,a)};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,o){if("function"==typeof r){if(!cj(t))throw TypeError(`'${t}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(t,(o,i)=>{let a=i.validateNotification(t,o);if(!a.ok){if("not-in-era"===a.reason)throw new cc(cl.InternalError,`No wire schema for ${t} in the resolved era`);throw Error(a.message)}return Promise.resolve(r(a.value))});return}if(!o)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(t,async i=>{let a=await cX(r.params,{...i.params});if(!a.success)throw new cc(cl.InvalidParams,`Invalid params for notification ${t}: ${a.error}`);await o(a.data,i)})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}};function un(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function us(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function ul(t){throw new lV(lU.SendFailed,`ctx.mcpReq.${t} is not available while fulfilling an embedded input request: the request is fulfilled locally and has no related peer request`)}async function uc(t,r,o,i,a){var n,s,l,c,u;if(!us(i)||"string"!=typeof i.method)throw new lV(lU.InvalidResult,`Invalid input request '${o}': each inputRequests entry must be an embedded request object with a method`,{key:o});let d=i.method;if(!r.hasInputRequestMethod(d))throw new lV(lU.InvalidResult,`Invalid input request '${o}': '${d}' is not an embedded request the ${r.era} revision defines (expected elicitation/create, sampling/createMessage, or roots/list)`,{key:o,method:d});let p=t.getRequestHandler(d);if(void 0===p)throw new lV(lU.CapabilityNotSupported,`Cannot fulfil input request '${o}': no handler is registered for '${d}' on this client. Declare the corresponding capability and register a handler, or handle input_required results manually.`,{key:o,method:d});let h=us(i.params)?i.params:void 0;return await p({jsonrpc:"2.0",id:o,method:d,...void 0!==h&&{params:h}},t.buildContext((n=o,s=d,l=h,c=a,{sessionId:t.sessionId,mcpReq:{id:n,method:s,_meta:l?._meta,requestState:(u=void 0,()=>u),signal:c,send:()=>ul("send"),notify:()=>ul("notify")}})))}var uu=M(q(t=>{var r=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,o=/\\([\u000b\u0020-\u00ff])/g,i=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function a(t){this.parameters=Object.create(null),this.type=t}t.parse=function(t){if(!t)throw TypeError("argument string is required");var n,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 a(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,n=s[1].toLowerCase(),34===(l=s[2]).charCodeAt(0)&&-1!==(l=l.slice(1,-1)).indexOf("\\")&&(l=l.replace(o,"$1")),p.parameters[n]=l}if(u!==c.length)throw TypeError("invalid parameter format")}return p}})(),1),ud=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 o=this._buffer.toString("utf8",0,r).replace(/\r$/,"");this._buffer=this._buffer.subarray(r+1);try{var t;return t=o,ni.parse(JSON.parse(t))}catch(t){if(t instanceof SyntaxError)continue;throw t}}return null}clear(){this._buffer=void 0}};function up(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):{...t}:{}}var uh=q(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 o=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=o;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 o&&(t[r.str]=(t[r.str]||0)+1),t),{})}};function a(t,...r){let o=[t[0]],n=0;for(;n<r.length;)l(o,r[n]),o.push(t[++n]);return new i(o)}t._Code=i,t.nil=new i(""),t._=a;let n=new i("+");function s(t,...r){let a=[c(t[0])],u=0;for(;u<r.length;)a.push(n),l(a,r[u]),a.push(n,c(t[++u]));return function(t){let r=1;for(;r<t.length-1;){if(t[r]===n){var i,a;let n=(i=t[r-1],'""'===(a=t[r+1])?i:'""'===i?a:"string"==typeof i?a instanceof o||'"'!==i[i.length-1]?void 0:"string"!=typeof a?`${i.slice(0,-1)}${a}"`:'"'===a[0]?i.slice(0,-1)+a.slice(1):void 0:"string"!=typeof a||'"'!==a[0]||i instanceof o?void 0:`"${i}${a.slice(1)}`);if(void 0!==n){t.splice(r-1,3,n);continue}t[r++]="+"}r++}}(a),new i(a)}function l(t,r){var a;r instanceof i?t.push(...r._items):r instanceof o?t.push(r):t.push("number"==typeof(a=r)||"boolean"==typeof a||null===a?a:c(Array.isArray(a)?a.join(","):a))}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}`):a`[${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())}}),um=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;let r=uh();var o,i,a=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}};(o=i||(t.UsedValueState=i={}))[o.Started=0]="Started",o[o.Completed=1]="Completed",t.varKinds={const:new r.Name("const"),let:new r.Name("let"),var:new r.Name("var")};var n=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,o;if((null==(o=null==(r=this._parent)?void 0:r._prefixes)?void 0:o.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=n;var s=class extends r.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:o,itemIndex:i}){this.value=t,this.scopePath=(0,r._)`.${new r.Name(o)}[${i}]`}};t.ValueScopeName=s;let l=(0,r._)`\n`;var c=class extends n{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 o;if(void 0===r.ref)throw Error("CodeGen: ref must be passed in value");let i=this.toName(t),{prefix:a}=i,n=null!=(o=r.key)?o:r.ref,s=this._values[a];if(s){let t=s.get(n);if(t)return t}else s=this._values[a]=new Map;s.set(n,i);let l=this._scope[a]||(this._scope[a]=[]),c=l.length;return l[c]=r.ref,i.setValue(r,{property:a,itemIndex:c}),i}getValue(t,r){let o=this._values[t];if(o)return o.get(r)}scopeRefs(t,o=this._values){return this._reduceValues(o,o=>{if(void 0===o.scopePath)throw Error(`CodeGen: name "${o}" has no value`);return(0,r._)`${t}${o.scopePath}`})}scopeCode(t=this._values,r,o){return this._reduceValues(t,t=>{if(void 0===t.value)throw Error(`CodeGen: name "${t}" has no value`);return t.value.code},r,o)}_reduceValues(o,n,s={},l){let c=r.nil;for(let u in o){let d=o[u];if(!d)continue;let p=s[u]=s[u]||new Map;d.forEach(o=>{if(p.has(o))return;p.set(o,i.Started);let s=n(o);if(s){let i=this.opts.es5?t.varKinds.var:t.varKinds.const;c=(0,r._)`${c}${i} ${o} = ${s};${this.opts._n}`}else if(s=null==l?void 0:l(o))c=(0,r._)`${c}${s}${this.opts._n}`;else throw new a(o);p.set(o,i.Completed)})}return c}};t.ValueScope=c}),uf=q(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=uh(),o=um();var i=uh();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 a=um();Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return a.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return a.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return a.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return a.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 n=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},s=class extends n{constructor(t,r,o){super(),this.varKind=t,this.name=r,this.rhs=o}render({es5:t,_n:r}){let i=t?o.varKinds.var:this.varKind,a=void 0===this.rhs?"":` = ${this.rhs}`;return`${i} ${this.name}${a};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=C(this.rhs,t,r)),this}get names(){return this.rhs instanceof r._CodeOrName?this.rhs.names:{}}},l=class extends n{constructor(t,r,o){super(),this.lhs=t,this.rhs=r,this.sideEffects=o}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,o){if(!(this.lhs instanceof r.Name)||t[this.lhs.str]||this.sideEffects)return this.rhs=C(this.rhs,t,o),this}get names(){return O(this.lhs instanceof r.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends l{constructor(t,r,o,i){super(t,o,i),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},u=class extends n{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},d=class extends n{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},p=class extends n{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},h=class extends n{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=C(this.code,t,r),this}get names(){return this.code instanceof r._CodeOrName?this.code.names:{}}},m=class extends n{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,o)=>r+o.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let o=t[r].optimizeNodes();Array.isArray(o)?t.splice(r,1,...o):o?t[r]=o:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:o}=this,i=o.length;for(;i--;){let a=o[i];a.optimizeNames(t,r)||(function(t,r){for(let o in r)t[o]=(t[o]||0)-(r[o]||0)}(t,a.names),o.splice(i,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>T(t,r.names),{})}},f=class extends m{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},y=class extends m{},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 o=this.else;if(o){let t=o.optimizeNodes();o=this.else=Array.isArray(t)?new g(t):t}return o?!1===r?o instanceof t?o:o.nodes:this.nodes.length?this:new t(j(r),o instanceof t?[o]:o.nodes):!1!==r&&this.nodes.length?this:void 0}optimizeNames(t,r){var o;if(this.else=null==(o=this.else)?void 0:o.optimizeNames(t,r),super.optimizeNames(t,r)||this.else)return this.condition=C(this.condition,t,r),this}get names(){let t=super.names;return O(t,this.condition),this.else&&T(t,this.else.names),t}};v.kind="if";var _=class extends f{};_.kind="for";var b=class extends _{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=C(this.iteration,t,r),this}get names(){return T(super.names,this.iteration.names)}},S=class extends _{constructor(t,r,o,i){super(),this.varKind=t,this.name=r,this.from=o,this.to=i}render(t){let r=t.es5?o.varKinds.var:this.varKind,{name:i,from:a,to:n}=this;return`for(${r} ${i}=${a}; ${i}<${n}; ${i}++)`+super.render(t)}get names(){return O(O(super.names,this.from),this.to)}},w=class extends _{constructor(t,r,o,i){super(),this.loop=t,this.varKind=r,this.name=o,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=C(this.iterable,t,r),this}get names(){return T(super.names,this.iterable.names)}},$=class extends f{constructor(t,r,o){super(),this.name=t,this.args=r,this.async=o}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};$.kind="func";var P=class extends m{render(t){return"return "+super.render(t)}};P.kind="return";var R=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 o,i;return super.optimizeNames(t,r),null==(o=this.catch)||o.optimizeNames(t,r),null==(i=this.finally)||i.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&T(t,this.catch.names),this.finally&&T(t,this.finally.names),t}},E=class extends f{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};E.kind="catch";var k=class extends f{render(t){return"finally"+super.render(t)}};k.kind="finally";var x=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?"\n":""},this._extScope=t,this._scope=new o.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 o=this._extScope.value(t,r);return(this._values[o.prefix]||(this._values[o.prefix]=new Set)).add(o),o}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,o,i){let a=this._scope.toName(r);return void 0!==o&&i&&(this._constants[a.str]=o),this._leafNode(new s(t,a,o)),a}const(t,r,i){return this._def(o.varKinds.const,t,r,i)}let(t,r,i){return this._def(o.varKinds.let,t,r,i)}var(t,r,i){return this._def(o.varKinds.var,t,r,i)}assign(t,r,o){return this._leafNode(new l(t,r,o))}add(r,o){return this._leafNode(new c(r,t.operators.ADD,o))}code(t){return"function"==typeof t?t():t!==r.nil&&this._leafNode(new h(t)),this}object(...t){let o=["{"];for(let[i,a]of t)o.length>1&&o.push(","),o.push(i),(i!==a||this.opts.es5)&&(o.push(":"),(0,r.addCodeArg)(o,a));return o.push("}"),new r._Code(o)}if(t,r,o){if(this._blockNode(new v(t)),r&&o)this.code(r).else().code(o).endIf();else if(r)this.code(r).endIf();else if(o)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,a,n=this.opts.es5?o.varKinds.var:o.varKinds.let){let s=this._scope.toName(t);return this._for(new S(n,s,r,i),()=>a(s))}forOf(t,i,a,n=o.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`,o=>{this.var(s,(0,r._)`${t}[${o}]`),a(s)})}return this._for(new w("of",n,s,i),()=>a(s))}forIn(t,i,a,n=this.opts.es5?o.varKinds.var:o.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,r._)`Object.keys(${i})`,a);let s=this._scope.toName(t);return this._for(new w("in",n,s,i),()=>a(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 P;if(this._blockNode(r),this.code(t),1!==r.nodes.length)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(P)}try(t,r,o){if(!r&&!o)throw Error('CodeGen: "try" without "catch" and "finally"');let i=new R;if(this._blockNode(i),this.code(t),r){let t=this.name("e");this._currNode=i.catch=new E(t),r(t)}return o&&(this._currNode=i.finally=new k,this.code(o)),this._endBlockNode(E,k)}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 o=this._nodes.length-r;if(o<0||void 0!==t&&o!==t)throw Error(`CodeGen: wrong number of nodes: ${o} vs ${t} expected`);return this._nodes.length=r,this}func(t,o=r.nil,i,a){return this._blockNode(new $(t,o,i)),a&&this.code(a).endFunc(),this}endFunc(){return this._endBlockNode($)}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 o=this._currNode;if(o instanceof t||r&&o instanceof r)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof v))throw Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};function T(t,r){for(let o in r)t[o]=(t[o]||0)+(r[o]||0);return t}function O(t,o){return o instanceof r._CodeOrName?T(t,o.names):t}function C(t,o,i){var a;if(t instanceof r.Name)return n(t);if(!((a=t)instanceof r._Code&&a._items.some(t=>t instanceof r.Name&&1===o[t.str]&&void 0!==i[t.str])))return t;return new r._Code(t._items.reduce((t,o)=>(o instanceof r.Name&&(o=n(o)),o instanceof r._Code?t.push(...o._items):t.push(o),t),[]));function n(t){let r=i[t.str];return void 0===r||1!==o[t.str]?t:(delete o[t.str],r)}}function j(t){return"boolean"==typeof t||"number"==typeof t||null===t?!t:(0,r._)`!${z(t)}`}t.CodeGen=x,t.not=j;let I=A(t.operators.AND);t.and=function(...t){return t.reduce(I)};let N=A(t.operators.OR);function A(t){return(o,i)=>o===r.nil?i:i===r.nil?o:(0,r._)`${z(o)} ${t} ${z(i)}`}function z(t){return t instanceof r.Name?t:(0,r._)`(${t})`}t.or=function(...t){return t.reduce(N)}}),uy=q(t=>{var r,o;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=uf(),a=uh();function n(t,r=t.schema){let{opts:o,self:i}=t;if(!o.strictSchema||"boolean"==typeof r)return;let a=i.RULES.keywords;for(let o in r)a[o]||m(t,`unknown keyword: "${o}"`)}function s(t,r){if("boolean"==typeof t)return!t;for(let o in t)if(r[o])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:o,resultToName:a}){return(n,s,l,c)=>{let u=void 0===l?s:l instanceof i.Name?(s instanceof i.Name?t(n,s,l):r(n,s,l),l):s instanceof i.Name?(r(n,l,s),s):o(s,l);return c!==i.Name||u instanceof i.Name?u:a(n,u)}}function d(t,r){if(!0===r)return t.var("props",!0);let o=t.var("props",(0,i._)`{}`);return void 0!==r&&p(t,o,r),o}function p(t,r,o){Object.keys(o).forEach(o=>t.assign((0,i._)`${r}${(0,i.getProperty)(o)}`,!0))}t.toHash=function(t){let r={};for(let o of t)r[o]=!0;return r},t.alwaysValidSchema=function(t,r){return"boolean"==typeof r?r:0===Object.keys(r).length||(n(t,r),!s(r,t.self.RULES.all))},t.checkUnknownRules=n,t.schemaHasRules=s,t.schemaHasRulesButRef=function(t,r){if("boolean"==typeof t)return!t;for(let o in t)if("$ref"!==o&&r.all[o])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:t,schemaPath:r},o,a,n){if(!n){if("number"==typeof o||"boolean"==typeof o)return o;if("string"==typeof o)return(0,i._)`${o}`}return(0,i._)`${t}${r}${(0,i.getProperty)(a)}`},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 o of t)r(o);else r(t)},t.mergeEvaluated={props:u({mergeNames:(t,r,o)=>t.if((0,i._)`${o} !== true && ${r} !== undefined`,()=>{t.if((0,i._)`${r} === true`,()=>t.assign(o,!0),()=>t.assign(o,(0,i._)`${o} || {}`).code((0,i._)`Object.assign(${o}, ${r})`))}),mergeToName:(t,r,o)=>t.if((0,i._)`${o} !== true`,()=>{!0===r?t.assign(o,!0):(t.assign(o,(0,i._)`${o} || {}`),p(t,o,r))}),mergeValues:(t,r)=>!0===t||{...t,...r},resultToName:d}),items:u({mergeNames:(t,r,o)=>t.if((0,i._)`${o} !== true && ${r} !== undefined`,()=>t.assign(o,(0,i._)`${r} === true ? true : ${o} > ${r} ? ${o} : ${r}`)),mergeToName:(t,r,o)=>t.if((0,i._)`${o} !== true`,()=>t.assign(o,!0===r||(0,i._)`${o} > ${r} ? ${o} : ${r}`)),mergeValues:(t,r)=>!0===t||Math.max(t,r),resultToName:(t,r)=>t.var("items",r)})},t.evaluatedPropsToName=d,t.setEvaluated=p;let h={};function m(t,r,o=t.opts.strictSchema){if(o){if(r=`strict mode: ${r}`,!0===o)throw Error(r);t.self.logger.warn(r)}}t.useFunc=function(t,r){return t.scopeValue("func",{ref:r,code:h[r.code]||(h[r.code]=new a._Code(r.code))})},(o=r||(t.Type=r={}))[o.Num=0]="Num",o[o.Str=1]="Str",t.getErrorPath=function(t,o,a){if(t instanceof i.Name){let n=o===r.Num;return a?n?(0,i._)`"[" + ${t} + "]"`:(0,i._)`"['" + ${t} + "']"`:n?(0,i._)`"/" + ${t}`:(0,i._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return a?(0,i.getProperty)(t).toString():"/"+l(t)},t.checkStrictMode=m}),ug=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf();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")}}),uv=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;let r=uf(),o=uy(),i=ug();function a(t,o){let a=t.const("err",o);t.if((0,r._)`${i.default.vErrors} === null`,()=>t.assign(i.default.vErrors,(0,r._)`[${a}]`),(0,r._)`${i.default.vErrors}.push(${a})`),t.code((0,r._)`${i.default.errors}++`)}function n(t,o){let{gen:i,validateName:a,schemaEnv:n}=t;n.$async?i.throw((0,r._)`new ${t.ValidationError}(${o})`):(i.assign((0,r._)`${a}.errors`,o),i.return(!1))}t.keywordError={message:({keyword:t})=>(0,r.str)`must pass "${t}" keyword validation`},t.keyword$DataError={message:({keyword:t,schemaType:o})=>o?(0,r.str)`"${t}" keyword must be ${o} ($data)`:(0,r.str)`"${t}" keyword is invalid ($data)`},t.reportError=function(o,i=t.keywordError,s,c){let{it:u}=o,{gen:d,compositeRule:p,allErrors:h}=u,m=l(o,i,s);(null!=c?c:p||h)?a(d,m):n(u,(0,r._)`[${m}]`)},t.reportExtraError=function(r,o=t.keywordError,s){let{it:c}=r,{gen:u,compositeRule:d,allErrors:p}=c;a(u,l(r,o,s)),d||p||n(c,i.default.vErrors)},t.resetErrorsCount=function(t,o){t.assign(i.default.errors,o),t.if((0,r._)`${i.default.vErrors} !== null`,()=>t.if(o,()=>t.assign((0,r._)`${i.default.vErrors}.length`,o),()=>t.assign(i.default.vErrors,null)))},t.extendErrors=function({gen:t,keyword:o,schemaValue:a,data:n,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}/${o}`),l.opts.verbose&&(t.assign((0,r._)`${c}.schema`,a),t.assign((0,r._)`${c}.data`,n))})};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,a,n){let{createErrors:l}=t.it;return!1===l?(0,r._)`{}`:function(t,a,n={}){let{gen:l,it:c}=t,u=[function({errorPath:t},{instancePath:a}){let n=a?(0,r.str)`${t}${(0,o.getErrorPath)(a,o.Type.Str)}`:t;return[i.default.instancePath,(0,r.strConcat)(i.default.instancePath,n)]}(c,n),function({keyword:t,it:{errSchemaPath:i}},{schemaPath:a,parentSchema:n}){let l=n?i:(0,r.str)`${i}/${t}`;return a&&(l=(0,r.str)`${l}${(0,o.getErrorPath)(a,o.Type.Str)}`),[s.schemaPath,l]}(t,n)];return function(t,{params:o,message:a},n){let{keyword:l,data:c,schemaValue:u,it:d}=t,{opts:p,propertyName:h,topSchemaRef:m,schemaPath:f}=d;n.push([s.keyword,l],[s.params,"function"==typeof o?o(t):o||(0,r._)`{}`]),p.messages&&n.push([s.message,"function"==typeof a?a(t):a]),p.verbose&&n.push([s.schema,u],[s.parentSchema,(0,r._)`${m}${f}`],[i.default.data,c]),h&&n.push([s.propertyName,h])}(t,a,u),l.object(...u)}(t,a,n)}}),u_=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;let r=uv(),o=uf(),i=ug(),a={message:"boolean schema is false"};function n(t,o){let{gen:i,data:n}=t;(0,r.reportError)({gen:i,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t},a,void 0,o)}t.topBoolOrEmptySchema=function(t){let{gen:r,schema:a,validateName:s}=t;!1===a?n(t,!1):"object"==typeof a&&!0===a.$async?r.return(i.default.data):(r.assign((0,o._)`${s}.errors`,null),r.return(!0))},t.boolOrEmptySchema=function(t,r){let{gen:o,schema:i}=t;!1===i?(o.var(r,!1),n(t)):o.var(r,!0)}}),ub=q(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:{}}}}),uS=q(t=>{function r(t,r){return r.rules.some(r=>o(t,r))}function o(t,r){var o;return void 0!==t[r.keyword]||(null==(o=r.definition.implements)?void 0:o.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:o},i){let a=o.RULES.types[i];return a&&!0!==a&&r(t,a)},t.shouldUseGroup=r,t.shouldUseRule=o}),uw=q(t=>{var r,o;Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;let i=ub(),a=uS(),n=uv(),s=uf(),l=uy();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(","))}(o=r||(t.DataType=r={}))[o.Correct=0]="Correct",o[o.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,o){var i,n;let{gen:l,data:c,opts:d}=t,h=(i=o,(n=d.coerceTypes)?i.filter(t=>u.has(t)||"array"===n&&"array"===t):[]),f=o.length>0&&!(0===h.length&&1===o.length&&(0,a.schemaHasRulesForType)(t,o[0]));if(f){let i=p(o,c,d.strictNumbers,r.Wrong);l.if(i,()=>{h.length?function(t,r,o){let{gen:i,data:a,opts:n}=t,l=i.let("dataType",(0,s._)`typeof ${a}`),c=i.let("coerced",(0,s._)`undefined`);for(let t of("array"===n.coerceTypes&&i.if((0,s._)`${l} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>i.assign(a,(0,s._)`${a}[0]`).assign(l,(0,s._)`typeof ${a}`).if(p(r,a,n.strictNumbers),()=>i.assign(c,a))),i.if((0,s._)`${c} !== undefined`),o))(u.has(t)||"array"===t&&"array"===n.coerceTypes)&&function(t){switch(t){case"string":i.elseIf((0,s._)`${l} == "number" || ${l} == "boolean"`).assign(c,(0,s._)`"" + ${a}`).elseIf((0,s._)`${a} === null`).assign(c,(0,s._)`""`);return;case"number":i.elseIf((0,s._)`${l} == "boolean" || ${a} === null
|
|
56
|
+
|| (${l} == "string" && ${a} && ${a} == +${a})`).assign(c,(0,s._)`+${a}`);return;case"integer":i.elseIf((0,s._)`${l} === "boolean" || ${a} === null
|
|
57
|
+
|| (${l} === "string" && ${a} && ${a} == +${a} && !(${a} % 1))`).assign(c,(0,s._)`+${a}`);return;case"boolean":i.elseIf((0,s._)`${a} === "false" || ${a} === 0 || ${a} === null`).assign(c,!1).elseIf((0,s._)`${a} === "true" || ${a} === 1`).assign(c,!0);return;case"null":i.elseIf((0,s._)`${a} === "" || ${a} === 0 || ${a} === false`),i.assign(c,null);return;case"array":i.elseIf((0,s._)`${l} === "string" || ${l} === "number"
|
|
58
|
+
|| ${l} === "boolean" || ${a} === null`).assign(c,(0,s._)`[${a}]`)}}(t);i.else(),m(t),i.endIf(),i.if((0,s._)`${c} !== undefined`,()=>{i.assign(a,c),function({gen:t,parentData:r,parentDataProperty:o},i){t.if((0,s._)`${r} !== undefined`,()=>t.assign((0,s._)`${r}[${o}]`,i))}(t,c)})}(t,o,h):m(t)})}return f};let u=new Set(["string","number","integer","boolean","null"]);function d(t,o,i,a=r.Correct){let n,l=a===r.Correct?s.operators.EQ:s.operators.NEQ;switch(t){case"null":return(0,s._)`${o} ${l} null`;case"array":n=(0,s._)`Array.isArray(${o})`;break;case"object":n=(0,s._)`${o} && typeof ${o} == "object" && !Array.isArray(${o})`;break;case"integer":n=c((0,s._)`!(${o} % 1) && !isNaN(${o})`);break;case"number":n=c();break;default:return(0,s._)`typeof ${o} ${l} ${t}`}return a===r.Correct?n:(0,s.not)(n);function c(t=s.nil){return(0,s.and)((0,s._)`typeof ${o} == "number"`,t,i?(0,s._)`isFinite(${o})`:s.nil)}}function p(t,r,o,i){let a;if(1===t.length)return d(t[0],r,o,i);let n=(0,l.toHash)(t);if(n.array&&n.object){let t=(0,s._)`typeof ${r} != "object"`;a=n.null?t:(0,s._)`!${r} || ${t}`,delete n.null,delete n.array,delete n.object}else a=s.nil;for(let t in n.number&&delete n.integer,n)a=(0,s.and)(a,d(t,r,o,i));return a}t.checkDataType=d,t.checkDataTypes=p;let h={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:r})=>"string"==typeof t?(0,s._)`{type: ${t}}`:(0,s._)`{type: ${r}}`};function m(t){let r=function(t){let{gen:r,data:o,schema:i}=t,a=(0,l.schemaRefOrVal)(t,i,"type");return{gen:r,keyword:"type",data:o,schema:i.type,schemaCode:a,schemaValue:a,parentSchema:i,params:{},it:t}}(t);(0,n.reportError)(r,h)}t.reportTypeError=m}),u$=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;let r=uf(),o=uy();function i(t,i,a){let{gen:n,compositeRule:s,data:l,opts:c}=t;if(void 0===a)return;let u=(0,r._)`${l}${(0,r.getProperty)(i)}`;if(s)return void(0,o.checkStrictMode)(t,`default is ignored for: ${u}`);let d=(0,r._)`${u} === undefined`;"empty"===c.useDefaults&&(d=(0,r._)`${d} || ${u} === null || ${u} === ""`),n.if(d,(0,r._)`${u} = ${(0,r.stringify)(a)}`)}t.assignDefaults=function(t,r){let{properties:o,items:a}=t.schema;if("object"===r&&o)for(let r in o)i(t,r,o[r].default);else"array"===r&&Array.isArray(a)&&a.forEach((r,o)=>i(t,o,r.default))}}),uP=q(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=uf(),o=uy(),i=ug(),a=uy();function n(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,r._)`Object.prototype.hasOwnProperty`})}function s(t,o,i){return(0,r._)`${n(t)}.call(${o}, ${i})`}function l(t,o,i,a){let n=(0,r._)`${o}${(0,r.getProperty)(i)} === undefined`;return a?(0,r.or)(n,(0,r.not)(s(t,o,i))):n}function c(t){return t?Object.keys(t).filter(t=>"__proto__"!==t):[]}t.checkReportMissingProp=function(t,o){let{gen:i,data:a,it:n}=t;i.if(l(i,a,o,n.opts.ownProperties),()=>{t.setParams({missingProperty:(0,r._)`${o}`},!0),t.error()})},t.checkMissingProp=function({gen:t,data:o,it:{opts:i}},a,n){return(0,r.or)(...a.map(a=>(0,r.and)(l(t,o,a,i.ownProperties),(0,r._)`${n} = ${a}`)))},t.reportMissingProp=function(t,r){t.setParams({missingProperty:r},!0),t.error()},t.hasPropFunc=n,t.isOwnProperty=s,t.propertyInData=function(t,o,i,a){let n=(0,r._)`${o}${(0,r.getProperty)(i)} !== undefined`;return a?(0,r._)`${n} && ${s(t,o,i)}`:n},t.noPropertyInData=l,t.allSchemaProperties=c,t.schemaProperties=function(t,r){return c(r).filter(i=>!(0,o.alwaysValidSchema)(t,r[i]))},t.callValidateCode=function({schemaCode:t,data:o,it:{gen:a,topSchemaRef:n,schemaPath:s,errorPath:l},it:c},u,d,p){let h=p?(0,r._)`${t}, ${o}, ${n}${s}`:o,m=[[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&&m.push([i.default.dynamicAnchors,i.default.dynamicAnchors]);let f=(0,r._)`${h}, ${a.object(...m)}`;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:o}},i){let n=o.unicodeRegExp?"u":"",{regExp:s}=o.code,l=s(i,n);return t.scopeValue("pattern",{key:l.toString(),ref:l,code:(0,r._)`${"new RegExp"===s.code?u:(0,a.useFunc)(t,s)}(${i}, ${n})`})},t.validateArray=function(t){let{gen:i,data:a,keyword:n,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._)`${a}.length`);i.forRange("i",0,c,a=>{t.subschema({keyword:n,dataProp:a,dataPropType:o.Type.Num},l),i.if((0,r.not)(l),s)})}},t.validateUnion=function(t){let{gen:i,schema:a,keyword:n,it:s}=t;if(!Array.isArray(a))throw Error("ajv implementation error");if(a.some(t=>(0,o.alwaysValidSchema)(s,t))&&!s.opts.unevaluated)return;let l=i.let("valid",!1),c=i.name("_valid");i.block(()=>a.forEach((o,a)=>{let s=t.subschema({keyword:n,schemaProp:a,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))}}),uR=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;let r=uf(),o=ug(),i=uP(),a=uv();function n(t){let{gen:o,data:i,it:a}=t;o.if(a.parentData,()=>o.assign(i,(0,r._)`${a.parentData}[${a.parentDataProperty}]`))}function s(t,o,i){if(void 0===i)throw Error(`keyword "${o}" failed to compile`);return t.scopeValue("keyword","function"==typeof i?{ref:i}:{ref:i,code:(0,r.stringify)(i)})}t.macroKeywordCode=function(t,o){let{gen:i,keyword:a,schema:n,parentSchema:l,it:c}=t,u=o.macro.call(c.self,n,l,c),d=s(i,a,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}/${a}`,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:h,$data:m,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,!m&&l.compile?l.compile.call(f.self,p,h,f):l.validate),g=u.let("valid");function v(a=l.async?(0,r._)`await `:r.nil){let n=f.opts.passContext?o.default.this:o.default.self,s=!("compile"in l&&!m||!1===l.schema);u.assign(g,(0,r._)`${a}${(0,i.callValidateCode)(t,y,n,s)}`,l.modifying)}function _(t){var o;u.if((0,r.not)(null!=(o=l.valid)?o:g),t)}t.block$data(g,function(){if(!1===l.errors)v(),l.modifying&&n(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&&n(t),_(()=>(function(t,i){let{gen:n}=t;n.if((0,r._)`Array.isArray(${i})`,()=>{n.assign(o.default.vErrors,(0,r._)`${o.default.vErrors} === null ? ${i} : ${o.default.vErrors}.concat(${i})`).assign(o.default.errors,(0,r._)`${o.default.vErrors}.length`),(0,a.extendErrors)(t)},()=>t.error())})(t,c))}}),t.ok(null!=(c=l.valid)?c:g)},t.validSchemaType=function(t,r,o=!1){return!r.length||r.some(r=>"array"===r?Array.isArray(t):"object"===r?t&&"object"==typeof t&&!Array.isArray(t):typeof t==r||o&&void 0===t)},t.validateKeywordUsage=function({schema:t,opts:r,self:o,errSchemaPath:i},a,n){if(Array.isArray(a.keyword)?!a.keyword.includes(n):a.keyword!==n)throw Error("ajv implementation error");let s=a.dependencies;if(null==s?void 0:s.some(r=>!Object.prototype.hasOwnProperty.call(t,r)))throw Error(`parent schema must have dependencies of ${n}: ${s.join(",")}`);if(a.validateSchema&&!a.validateSchema(t[n])){let t=`keyword "${n}" value is invalid at path "${i}": `+o.errorsText(a.validateSchema.errors);if("log"===r.validateSchema)o.logger.error(t);else throw Error(t)}}}),uE=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;let r=uf(),o=uy();t.getSubschema=function(t,{keyword:i,schemaProp:a,schema:n,schemaPath:s,errSchemaPath:l,topSchemaRef:c}){if(void 0!==i&&void 0!==n)throw Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==i){let n=t.schema[i];return void 0===a?{schema:n,schemaPath:(0,r._)`${t.schemaPath}${(0,r.getProperty)(i)}`,errSchemaPath:`${t.errSchemaPath}/${i}`}:{schema:n[a],schemaPath:(0,r._)`${t.schemaPath}${(0,r.getProperty)(i)}${(0,r.getProperty)(a)}`,errSchemaPath:`${t.errSchemaPath}/${i}/${(0,o.escapeFragment)(a)}`}}if(void 0!==n){if(void 0===s||void 0===l||void 0===c)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:s,topSchemaRef:c,errSchemaPath:l}}throw Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(t,i,{dataProp:a,dataPropType:n,data:s,dataTypes:l,propertyName:c}){if(void 0!==s&&void 0!==a)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:u}=i;if(void 0!==a){let{errorPath:s,dataPathArr:l,opts:c}=i;d(u.let("data",(0,r._)`${i.data}${(0,r.getProperty)(a)}`,!0)),t.errorPath=(0,r.str)`${s}${(0,o.getErrorPath)(a,n,c.jsPropertySyntax)}`,t.parentDataProperty=(0,r._)`${a}`,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:o,compositeRule:i,createErrors:a,allErrors:n}){void 0!==i&&(t.compositeRule=i),void 0!==a&&(t.createErrors=a),void 0!==n&&(t.allErrors=n),t.jtdDiscriminator=r,t.jtdMetadata=o}}),uk=q((t,r)=>{r.exports=function t(r,o){if(r===o)return!0;if(r&&o&&"object"==typeof r&&"object"==typeof o){if(r.constructor!==o.constructor)return!1;if(Array.isArray(r)){if((i=r.length)!=o.length)return!1;for(a=i;0!=a--;)if(!t(r[a],o[a]))return!1;return!0}if(r.constructor===RegExp)return r.source===o.source&&r.flags===o.flags;if(r.valueOf!==Object.prototype.valueOf)return r.valueOf()===o.valueOf();if(r.toString!==Object.prototype.toString)return r.toString()===o.toString();if((i=(n=Object.keys(r)).length)!==Object.keys(o).length)return!1;for(a=i;0!=a--;)if(!Object.prototype.hasOwnProperty.call(o,n[a]))return!1;for(a=i;0!=a--;){var i,a,n,s=n[a];if(!t(r[s],o[s]))return!1}return!0}return r!=r&&o!=o}}),ux=q((t,r)=>{var o=r.exports=function(t,r,i){"function"==typeof r&&(i=r,r={});var a="function"==typeof(i=r.cb||i)?i:i.pre||function(){};!function t(r,i,a,n,s,l,c,u,d,p){if(n&&"object"==typeof n&&!Array.isArray(n)){for(var h in i(n,s,l,c,u,d,p),n){var m,f=n[h];if(Array.isArray(f)){if(h in o.arrayKeywords)for(var y=0;y<f.length;y++)t(r,i,a,f[y],s+"/"+h+"/"+y,l,s,h,n,y)}else if(h in o.propsKeywords){if(f&&"object"==typeof f)for(var g in f){t(r,i,a,f[g],s+"/"+h+"/"+(m=g).replace(/~/g,"~0").replace(/\//g,"~1"),l,s,h,n,g)}}else(h in o.keywords||r.allKeys&&!(h in o.skipKeywords))&&t(r,i,a,f,s+"/"+h,l,s,h,n)}a(n,s,l,c,u,d,p)}}(r,a,i.post||function(){},t,"",t)};o.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},o.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},o.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},o.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}}),uT=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;let r=uy(),o=uk(),i=ux(),a=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);t.inlineRef=function(t,o=!0){return"boolean"==typeof t||(!0===o?!function t(r){for(let o in r){if(n.has(o))return!0;let i=r[o];if(Array.isArray(i)&&i.some(t)||"object"==typeof i&&t(i))return!0}return!1}(t):!!o&&function t(o){let i=0;for(let n in o)if("$ref"===n||(i++,!a.has(n)&&("object"==typeof o[n]&&(0,r.eachItem)(o[n],r=>i+=t(r)),i===1/0)))return 1/0;return i}(t)<=o)};let n=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function s(t,r="",o){return!1!==o&&(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,o){return o=u(o),t.resolve(r,o)};let d=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(t,r){if("boolean"==typeof t)return{};let{schemaId:a,uriResolver:n}=this.opts,l=u(t[a]||r),c={"":l},p=s(n,l,!1),h={},m=new Set;return i(t,{allKeys:!0},(t,r,o,i)=>{if(void 0===i)return;let n=p+r,s=c[i];function l(r){let o=this.opts.uriResolver.resolve;if(r=u(s?o(s,r):r),m.has(r))throw y(r);m.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(n)&&("#"===r[0]?(f(t,h[r],r),h[r]=t):this.refs[r]=n),r}function g(t){if("string"==typeof t){if(!d.test(t))throw Error(`invalid anchor "${t}"`);l.call(this,`#${t}`)}}"string"==typeof t[a]&&(s=l.call(this,t[a])),g.call(this,t.$anchor),g.call(this,t.$dynamicAnchor),c[r]=s}),h;function f(t,r,i){if(void 0!==r&&!o(t,r))throw y(i)}function y(t){return Error(`reference "${t}" resolves to more than one schema`)}}}),uO=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;let r=u_(),o=uw(),i=uS(),a=uw(),n=u$(),s=uR(),l=uE(),c=uf(),u=ug(),d=uT(),p=uy(),h=uv();function m({gen:t,validateName:r,schema:o,schemaEnv:i,opts:a},n){var s;a.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(o,a)}`),r=t,i=a,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(n)}):t.func(r,(0,c._)`${u.default.data}, ${(s=a,(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(o,a)).code(n))}function f(t,r){let o="object"==typeof t&&t[r.schemaId];return o&&(r.code.source||r.code.process)?(0,c._)`/*# sourceURL=${o} */`:c.nil}function y({schema:t,self:r}){if("boolean"==typeof t)return!t;for(let o in t)if(r.RULES.all[o])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:o,opts:i,self:a}=t;r.$ref&&i.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(r,a.RULES)&&a.logger.warn(`$ref: keywords ignored in schema at path "${o}"`)}(t)}function _(t,r){if(t.opts.jtd)return S(t,[],!1,r);let i=(0,o.getSchemaTypes)(t.schema);S(t,i,!(0,o.coerceAndCheckDataType)(t,i),r)}function b({gen:t,schemaEnv:r,schema:o,errSchemaPath:i,opts:a}){let n=o.$comment;if(!0===a.$comment)t.code((0,c._)`${u.default.self}.logger.log(${n})`);else if("function"==typeof a.$comment){let o=(0,c.str)`${i}/$comment`,a=t.scopeValue("root",{ref:r.root});t.code((0,c._)`${u.default.self}.opts.$comment(${n}, ${o}, ${a}.schema)`)}}function S(t,r,o,n){var s,l,d,h;let{gen:m,schema:f,data:y,allErrors:g,opts:v,self:_}=t,{RULES:b}=_;if(f.$ref&&(v.ignoreKeywordsWithRef||!(0,p.schemaHasRulesButRef)(f,b)))return void m.block(()=>E(t,"$ref",b.all.$ref.definition));function S(s){(0,i.shouldUseGroup)(f,s)&&(s.type?(m.if((0,a.checkDataType)(s.type,y,v.strictNumbers)),w(t,s),1===r.length&&r[0]===s.type&&o&&(m.else(),(0,a.reportTypeError)(t)),m.endIf()):w(t,s),g||m.if((0,c._)`${u.default.errors} === ${n||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=>{$(t.dataTypes,r)||P(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),function(t,r){let o=[];for(let i of t.dataTypes)$(r,i)?o.push(i):r.includes("integer")&&"number"===i&&o.push("integer");t.dataTypes=o}(t,r)}}(s,l),s.opts.allowUnionTypes||(d=s,(h=l).length>1&&!(2===h.length&&h.includes("null"))&&P(d,"use allowUnionTypes to allow union type keyword")),function(t,r){let o=t.self.RULES.all;for(let a in o){let n=o[a];if("object"==typeof n&&(0,i.shouldUseRule)(t.schema,n)){let{type:o}=n.definition;o.length&&!o.some(t=>{var o,i;return o=r,i=t,o.includes(i)||"number"===i&&o.includes("integer")})&&P(t,`missing type "${o.join(",")}" for keyword "${a}"`)}}}(s,s.dataTypes))),m.block(()=>{for(let t of b.rules)S(t);S(b.post)})}function w(t,r){let{gen:o,schema:a,opts:{useDefaults:s}}=t;s&&(0,n.assignDefaults)(t,r.type),o.block(()=>{for(let o of r.rules)(0,i.shouldUseRule)(a,o)&&E(t,o.keyword,o.definition,r.type)})}function $(t,r){return t.includes(r)||"integer"===r&&t.includes("number")}function P(t,r){let o=t.schemaEnv.baseId+t.errSchemaPath;r+=` at "${o}" (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:o,gen:i}=t;m(t,()=>{o.$comment&&r.$comment&&b(t),function(t){let{schema:r,opts:o}=t;void 0!==r.default&&o.useDefaults&&o.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),o.unevaluated&&function(t){let{gen:r,validateName:o}=t;t.evaluated=r.const("evaluated",(0,c._)`${o}.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:o,validateName:i,ValidationError:a,opts:n}=t;o.$async?r.if((0,c._)`${u.default.errors} === 0`,()=>r.return(u.default.data),()=>r.throw((0,c._)`new ${a}(${u.default.vErrors})`)):(r.assign((0,c._)`${i}.errors`,u.default.vErrors),n.unevaluated&&function({gen:t,evaluated:r,props:o,items:i}){o instanceof c.Name&&t.assign((0,c._)`${r}.props`,o),i instanceof c.Name&&t.assign((0,c._)`${r}.items`,i)}(t),r.return((0,c._)`${u.default.errors} === 0`))}(t)})}(t):m(t,()=>(0,r.topBoolOrEmptySchema)(t))};var R=class{constructor(t,r,o){if((0,s.validateKeywordUsage)(t,r,o),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=o,this.data=t.data,this.schema=t.schema[o],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,p.schemaRefOrVal)(t,this.schema,o,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",T(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,s.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw Error(`${o} 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,o){this.failResult((0,c.not)(t),r,o)}failResult(t,r,o){this.gen.if(t),o?o():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,o){if(r){this.setParams(r),this._error(t,o),this.setParams({});return}this._error(t,o)}_error(t,r){(t?h.reportExtraError:h.reportError)(this,this.def.error,r)}$dataError(){(0,h.reportError)(this,this.def.$dataError||h.keyword$DataError)}reset(){if(void 0===this.errsCount)throw Error('add "trackErrors" to keyword definition');(0,h.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,o=c.nil){this.gen.block(()=>{this.check$data(t,o),r()})}check$data(t=c.nil,r=c.nil){if(!this.$data)return;let{gen:o,schemaCode:i,schemaType:a,def:n}=this;o.if((0,c.or)((0,c._)`${i} === undefined`,r)),t!==c.nil&&o.assign(t,!0),(a.length||n.validateSchema)&&(o.elseIf(this.invalid$data()),this.$dataError(),t!==c.nil&&o.assign(t,!1)),o.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:o,def:i,it:n}=this;return(0,c.or)(function(){if(o.length){if(!(r instanceof c.Name))throw Error("ajv implementation error");let t=Array.isArray(o)?o:[o];return(0,c._)`${(0,a.checkDataTypes)(t,r,n.opts.strictNumbers,a.DataType.Wrong)}`}return c.nil}(),function(){if(i.validateSchema){let o=t.scopeValue("validate$data",{ref:i.validateSchema});return(0,c._)`!${o}(${r})`}return c.nil}())}subschema(t,o){let i=(0,l.getSubschema)(this.it,t);(0,l.extendSubschemaData)(i,this.it,t),(0,l.extendSubschemaMode)(i,t);let a={...this.it,...i,items:void 0,props:void 0};return!function(t,o){if(g(t)&&(v(t),y(t)))return function(t,r){var o;let i,{schema:a,gen:n,opts:s}=t;s.$comment&&a.$comment&&b(t),(i=(o=t).schema[o.opts.schemaId])&&(o.baseId=(0,d.resolveUrl)(o.opts.uriResolver,o.baseId,i)),function(t){if(t.schema.$async&&!t.schemaEnv.$async)throw Error("async schema in sync schema")}(t);let l=n.const("_errs",u.default.errors);_(t,l),n.var(r,(0,c._)`${l} === ${u.default.errors}`)}(t,o);(0,r.boolOrEmptySchema)(t,o)}(a,o),a}mergeEvaluated(t,r){let{it:o,gen:i}=this;o.opts.unevaluated&&(!0!==o.props&&void 0!==t.props&&(o.props=p.mergeEvaluated.props(i,t.props,o.props,r)),!0!==o.items&&void 0!==t.items&&(o.items=p.mergeEvaluated.items(i,t.items,o.items,r)))}mergeValidEvaluated(t,r){let{it:o,gen:i}=this;if(o.opts.unevaluated&&(!0!==o.props||!0!==o.items))return i.if(r,()=>this.mergeEvaluated(t,c.Name)),!0}};function E(t,r,o,i){let a=new R(t,o,r);"code"in o?o.code(a,i):a.$data&&o.validate?(0,s.funcKeywordCode)(a,o):"macro"in o?(0,s.macroKeywordCode)(a,o):(o.compile||o.validate)&&(0,s.funcKeywordCode)(a,o)}t.KeywordCxt=R;let k=/^\/(?:[^~]|~0|~1)*$/,x=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function T(t,{dataLevel:r,dataNames:o,dataPathArr:i}){let a,n;if(""===t)return u.default.rootData;if("/"===t[0]){if(!k.test(t))throw Error(`Invalid JSON-pointer: ${t}`);a=t,n=u.default.rootData}else{let s=x.exec(t);if(!s)throw Error(`Invalid JSON-pointer: ${t}`);let c=+s[1];if("#"===(a=s[2])){if(c>=r)throw Error(l("property/index",c));return i[r-c]}if(c>r)throw Error(l("data",c));if(n=o[r-c],!a)return n}let s=n;for(let t of a.split("/"))t&&(n=(0,c._)`${n}${(0,c.getProperty)((0,p.unescapeJsonPointer)(t))}`,s=(0,c._)`${s} && ${n}`);return s;function l(t,o){return`Cannot access ${t} ${o} levels up, current level is ${r}`}}t.getData=T}),uC=q(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}}}),uj=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uT();t.default=class extends Error{constructor(t,o,i,a){super(a||`can't resolve reference ${i} from id ${o}`),this.missingRef=(0,r.resolveUrl)(t,o,i),this.missingSchema=(0,r.normalizeId)((0,r.getFullPath)(t,this.missingRef))}}}),uI=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;let r=uf(),o=uC(),i=ug(),a=uT(),n=uy(),s=uO();var l=class{constructor(t){var r;let o;this.refs={},this.dynamicAnchors={},"object"==typeof t.schema&&(o=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=null!=(r=t.baseId)?r:(0,a.normalizeId)(null==o?void 0:o[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=null==o?void 0:o.$async,this.refs={}}};function c(t){let n,l,c=d.call(this,t);if(c)return c;let u=(0,a.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:p,lines:h}=this.opts.code,{ownProperties:m}=this.opts,f=new r.CodeGen(this.scope,{es5:p,lines:h,ownProperties:m});t.$async&&(n=f.scopeValue("Error",{ref:o.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:n,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 o=f.toString();l=`${f.scopeRefs(i.default.scope)}return ${o}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let a=Function(`${i.default.self}`,`${i.default.scope}`,l)(this,this.scope.get());if(this.scope.value(y,{ref:a}),a.errors=null,a.schema=t.schema,a.schemaEnv=t,t.$async&&(a.$async=!0),!0===this.opts.code.source&&(a.source={validateName:y,validateCode:o,scopeValues:f._values}),this.opts.unevaluated){let{props:t,items:o}=g;a.evaluated={props:t instanceof r.Name?void 0:t,items:o instanceof r.Name?void 0:o,dynamicProps:t instanceof r.Name,dynamicItems:o instanceof r.Name},a.source&&(a.source.evaluated=(0,r.stringify)(a.evaluated))}return t.validate=a,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,a.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,o;if(r=i,o=t,r.schema===o.schema&&r.root===o.root&&r.baseId===o.baseId)return i}}function p(t,r){let o;for(;"string"==typeof(o=this.refs[r]);)r=o;return o||this.schemas[r]||h.call(this,t,r)}function h(t,r){let o=this.opts.uriResolver.parse(r),i=(0,a._getFullPath)(this.opts.uriResolver,o),n=(0,a.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&i===n)return f.call(this,o,t);let s=(0,a.normalizeId)(i),u=this.refs[s]||this.schemas[s];if("string"==typeof u){let r=h.call(this,t,u);if("object"!=typeof(null==r?void 0:r.schema))return;return f.call(this,o,r)}if("object"==typeof(null==u?void 0:u.schema)){if(u.validate||c.call(this,u),s===(0,a.normalizeId)(r)){let{schema:r}=u,{schemaId:o}=this.opts,i=r[o];return i&&(n=(0,a.resolveUrl)(this.opts.uriResolver,n,i)),new l({schema:r,schemaId:o,root:t,baseId:n})}return f.call(this,o,u)}}t.SchemaEnv=l,t.compileSchema=c,t.resolveRef=function(t,r,o){var i;o=(0,a.resolveUrl)(this.opts.uriResolver,r,o);let n=t.refs[o];if(n)return n;let s=p.call(this,t,o);if(void 0===s){let a=null==(i=t.localRefs)?void 0:i[o],{schemaId:n}=this.opts;a&&(s=new l({schema:a,schemaId:n,root:t,baseId:r}))}if(void 0!==s)return t.refs[o]=u.call(this,s)},t.getCompilingSchema=d,t.resolveSchema=h;let m=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function f(t,{baseId:r,schema:o,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 o)return;let t=o[(0,n.unescapeFragment)(i)];if(void 0===t)return;let s="object"==typeof(o=t)&&o[this.opts.schemaId];!m.has(i)&&s&&(r=(0,a.resolveUrl)(this.opts.uriResolver,r,s))}if("boolean"!=typeof o&&o.$ref&&!(0,n.schemaHasRulesButRef)(o,this.RULES)){let t=(0,a.resolveUrl)(this.opts.uriResolver,r,o.$ref);c=h.call(this,i,t)}let{schemaId:u}=this.opts;if((c=c||new l({schema:o,schemaId:u,root:i,baseId:r})).schema!==c.root.schema)return c}}),uN=q((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}}),uA=q((t,r)=>{let o=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 a(t){let r="",o=0,i=0;for(i=0;i<t.length;i++)if(48!==(o=t[i].charCodeAt(0))){if(!(o>=48&&o<=57||o>=65&&o<=70||o>=97&&o<=102))return"";r+=t[i];break}for(i+=1;i<t.length;i++){if(!((o=t[i].charCodeAt(0))>=48&&o<=57||o>=65&&o<=70||o>=97&&o<=102))return"";r+=t[i]}return r}let n=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function s(t){return t.length=0,!0}function l(t,r,o){if(t.length){let i=a(t);if(""===i)return o.error=!0,!1;r.push(i),t.length=0}return!0}function c(t){if(2>function(t,r){let o=0;for(let r=0;r<t.length;r++)":"===t[r]&&o++;return o}(t,":"))return{host:t,isIPV6:!1};let r=function(t){let r=0,o={error:!1,address:"",zone:""},i=[],n=[],c=!1,u=!1,d=l;for(let a=0;a<t.length;a++){let l=t[a];if("["!==l&&"]"!==l)if(":"===l){if(!0===c&&(u=!0),!d(n,i,o))break;if(++r>7){o.error=!0;break}a>0&&":"===t[a-1]&&(c=!0),i.push(":");continue}else if("%"===l){if(!d(n,i,o))break;d=s}else{n.push(l);continue}}return n.length&&(d===s?o.zone=n.join(""):u?i.push(n.join("")):i.push(a(n))),o.address=i.join(""),o}(t);if(r.error)return{host:t,isIPV6:!1};{let t=r.address,o=r.address;return r.zone&&(t+="%"+r.zone,o+="%25"+r.zone),{host:t,isIPV6:!0,escapedHost:o}}}r.exports={nonSimpleDomain:n,recomposeAuthority:function(t){let r=[];if(void 0!==t.userinfo&&(r.push(t.userinfo),r.push("@")),void 0!==t.host){let o=unescape(t.host);if(!i(o)){let r=c(o);o=!0===r.isIPV6?`[${r.escapedHost}]`:t.host}r.push(o)}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 o=!0!==r?escape:unescape;return void 0!==t.scheme&&(t.scheme=o(t.scheme)),void 0!==t.userinfo&&(t.userinfo=o(t.userinfo)),void 0!==t.host&&(t.host=o(t.host)),void 0!==t.path&&(t.path=o(t.path)),void 0!==t.query&&(t.query=o(t.query)),void 0!==t.fragment&&(t.fragment=o(t.fragment)),t},removeDotSegments:function(t){let r=t,o=[],i=-1,a=0;for(;a=r.length;){if(1===a)if("."===r)break;else if("/"===r){o.push("/");break}else{o.push(r);break}if(2===a){if("."===r[0]){if("."===r[1])break;else if("/"===r[1]){r=r.slice(2);continue}}else if("/"===r[0]&&("."===r[1]||"/"===r[1])){o.push("/");break}}else if(3===a&&"/.."===r){0!==o.length&&o.pop(),o.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!==o.length&&o.pop();continue}}if(-1===(i=r.indexOf("/",1))){o.push(r);break}o.push(r.slice(0,i)),r=r.slice(i)}return o.join("")},isIPv4:i,isUUID:o,normalizeIPv6:c,stringArrayToHexStripped:a}}),uz=q((t,r)=>{let{isUUID:o}=uA(),i=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,a=["http","https","ws","wss","urn","urn:uuid"];function n(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=n(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t},serialize:function(t){if((t.port===(n(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,o]=t.resourceName.split("?");t.path=r&&"/"!==r?r:void 0,t.query=o,t.resourceName=void 0}return t.fragment=void 0,t}},p={scheme:"wss",domainHost:d.domainHost,parse:d.parse,serialize:d.serialize},h={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 o=t.path.match(i);if(o){let i=r.scheme||t.scheme||"urn";t.nid=o[1].toLowerCase(),t.nss=o[2];let a=m(`${i}:${r.nid||t.nid}`);t.path=void 0,a&&(t=a.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 o=r.scheme||t.scheme||"urn",i=t.nid.toLowerCase(),a=m(`${o}:${r.nid||i}`);a&&(t=a.serialize(t,r));let n=t,s=t.nss;return n.path=`${i||r.nid}:${s}`,r.skipEscape=!0,n},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(t,r){return t.uuid=t.nss,t.nss=void 0,r.tolerant||t.uuid&&o(t.uuid)||(t.error=t.error||"UUID is not valid."),t},serialize:function(t){return t.nss=(t.uuid||"").toLowerCase(),t},skipNormalize:!0}};function m(t){return t&&(h[t]||h[t.toLowerCase()])||void 0}Object.setPrototypeOf(h,null),r.exports={wsIsSecure:n,SCHEMES:h,isValidSchemeName:function(t){return -1!==a.indexOf(t)},getSchemeHandler:m}}),uq=q((t,r)=>{let{normalizeIPv6:o,removeDotSegments:i,recomposeAuthority:a,normalizeComponentEncoding:n,isIPv4:s,nonSimpleDomain:l}=uA(),{SCHEMES:c,getSchemeHandler:u}=uz();function d(t,r,o,a){let n={};return a||(t=m(p(t,o),o),r=m(p(r,o),o)),!(o=o||{}).tolerant&&r.scheme?(n.scheme=r.scheme,n.userinfo=r.userinfo,n.host=r.host,n.port=r.port,n.path=i(r.path||""),n.query=r.query):(void 0!==r.userinfo||void 0!==r.host||void 0!==r.port?(n.userinfo=r.userinfo,n.host=r.host,n.port=r.port,n.path=i(r.path||""),n.query=r.query):(r.path?("/"===r.path[0]?n.path=i(r.path):(void 0===t.userinfo&&void 0===t.host&&void 0===t.port||t.path?t.path?n.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+r.path:n.path=r.path:n.path="/"+r.path,n.path=i(n.path)),n.query=r.query):(n.path=t.path,void 0!==r.query?n.query=r.query:n.query=t.query),n.userinfo=t.userinfo,n.host=t.host,n.port=t.port),n.scheme=t.scheme),n.fragment=r.fragment,n}function p(t,r){let o={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:""},n=Object.assign({},r),s=[],l=u(n.scheme||o.scheme);l&&l.serialize&&l.serialize(o,n),void 0!==o.path&&(n.skipEscape?o.path=unescape(o.path):(o.path=escape(o.path),void 0!==o.scheme&&(o.path=o.path.split("%3A").join(":")))),"suffix"!==n.reference&&o.scheme&&s.push(o.scheme,":");let c=a(o);if(void 0!==c&&("suffix"!==n.reference&&s.push("//"),s.push(c),o.path&&"/"!==o.path[0]&&s.push("/")),void 0!==o.path){let t=o.path;n.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!==o.query&&s.push("?",o.query),void 0!==o.fragment&&s.push("#",o.fragment),s.join("")}let h=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function m(t,r){let i=Object.assign({},r),a={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1;"suffix"===i.reference&&(t=i.scheme?i.scheme+":"+t:"//"+t);let c=t.match(h);if(c){if(a.scheme=c[1],a.userinfo=c[3],a.host=c[4],a.port=parseInt(c[5],10),a.path=c[6]||"",a.query=c[7],a.fragment=c[8],isNaN(a.port)&&(a.port=c[5]),a.host)if(!1===s(a.host)){let t=o(a.host);a.host=t.host.toLowerCase(),n=t.isIPV6}else n=!0;void 0!==a.scheme||void 0!==a.userinfo||void 0!==a.host||void 0!==a.port||void 0!==a.query||a.path?void 0===a.scheme?a.reference="relative":void 0===a.fragment?a.reference="absolute":a.reference="uri":a.reference="same-document",i.reference&&"suffix"!==i.reference&&i.reference!==a.reference&&(a.error=a.error||"URI is not a "+i.reference+" reference.");let r=u(i.scheme||a.scheme);if(!i.unicodeSupport&&(!r||!r.unicodeSupport)&&a.host&&(i.domainHost||r&&r.domainHost)&&!1===n&&l(a.host))try{a.host=URL.domainToASCII(a.host.toLowerCase())}catch(t){a.error=a.error||"Host's domain name can not be converted to ASCII: "+t}(!r||r&&!r.skipNormalize)&&(-1!==t.indexOf("%")&&(void 0!==a.scheme&&(a.scheme=unescape(a.scheme)),void 0!==a.host&&(a.host=unescape(a.host))),a.path&&(a.path=escape(unescape(a.path))),a.fragment&&(a.fragment=encodeURI(decodeURIComponent(a.fragment)))),r&&r.parse&&r.parse(a,i)}else a.error=a.error||"URI can not be parsed.";return a}let f={SCHEMES:c,normalize:function(t,r){return"string"==typeof t?t=p(m(t,r),r):"object"==typeof t&&(t=m(p(t,r),r)),t},resolve:function(t,r,o){let i=o?Object.assign({scheme:"null"},o):{scheme:"null"},a=d(m(t,i),m(r,i),i,!0);return i.skipEscape=!0,p(a,i)},resolveComponent:d,equal:function(t,r,o){return"string"==typeof t?t=p(n(m(t=unescape(t),o),!0),{...o,skipEscape:!0}):"object"==typeof t&&(t=p(n(t,!0),{...o,skipEscape:!0})),"string"==typeof r?r=p(n(m(r=unescape(r),o),!0),{...o,skipEscape:!0}):"object"==typeof r&&(r=p(n(r,!0),{...o,skipEscape:!0})),t.toLowerCase()===r.toLowerCase()},serialize:p,parse:m};r.exports=f,r.exports.default=f,r.exports.fastUri=f}),uM=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uq();r.code='require("ajv/dist/runtime/uri").default',t.default=r}),uL=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var r=uO();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return r.KeywordCxt}});var o=uf();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return o._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return o.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return o.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return o.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return o.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return o.CodeGen}});let i=uC(),a=uj(),n=ub(),s=uI(),l=uf(),c=uT(),u=uw(),d=uy(),p=uN(),h=uM(),m=(t,r)=>new RegExp(t,r);m.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,o,i,a,n,s,l,c,u,d,p,f,y,g,v,_,b,S,w,$,P,R,E,k,x;let T=t.strict,O=null==(r=t.code)?void 0:r.optimize,C=!0===O||void 0===O?1:O||0,j=null!=(i=null==(o=t.code)?void 0:o.regExp)?i:m,I=null!=(a=t.uriResolver)?a:h.default;return{strictSchema:null==(s=null!=(n=t.strictSchema)?n:T)||s,strictNumbers:null==(c=null!=(l=t.strictNumbers)?l:T)||c,strictTypes:null!=(d=null!=(u=t.strictTypes)?u:T)?d:"log",strictTuples:null!=(f=null!=(p=t.strictTuples)?p:T)?f:"log",strictRequired:null!=(g=null!=(y=t.strictRequired)?y:T)&&g,code:t.code?{...t.code,optimize:C,regExp:j}:{optimize:C,regExp:j},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==(w=t.inlineRefs)||w,schemaId:null!=($=t.schemaId)?$:"$id",addUsedSchema:null==(P=t.addUsedSchema)||P,validateSchema:null==(R=t.validateSchema)||R,validateFormats:null==(E=t.validateFormats)||E,unicodeRegExp:null==(k=t.unicodeRegExp)||k,int32range:null==(x=t.int32range)||x,uriResolver:I}}(t)};const{es5:r,lines:o}=this.opts.code;this.scope=new l.ValueScope({scope:{},prefixes:y,es5:r,lines:o}),this.logger=function(t){if(!1===t)return E;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,n.getRules)(),b.call(this,g,t,"NOT SUPPORTED"),b.call(this,v,t,"DEPRECATED","warn"),this._metaOpts=R.call(this),t.formats&&$.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&P.call(this,t.keywords),"object"==typeof t.meta&&this.addMetaSchema(t.meta),w.call(this),t.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:o}=this.opts,i=p;"id"===o&&((i={...p}).id=i.$id,delete i.$id),r&&t&&this.addMetaSchema(i,i[o],!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 o;if("string"==typeof t){if(!(o=this.getSchema(t)))throw Error(`no schema with key or ref "${t}"`)}else o=this.compile(t);let i=o(r);return"$async"in o||(this.errors=o.errors),i}compile(t,r){let o=this._addSchema(t,r);return o.validate||this._compileSchemaEnv(o)}compileAsync(t,r){if("function"!=typeof this.opts.loadSchema)throw Error("options.loadSchema should be a function");let{loadSchema:o}=this.opts;return i.call(this,t,r);async function i(t,r){await n.call(this,t.$schema);let o=this._addSchema(t,r);return o.validate||s.call(this,o)}async function n(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 a.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 o=await u.call(this,t);this.refs[t]||await n.call(this,o.$schema),this.refs[t]||this.addSchema(o,t,r)}async function u(t){let r=this._loading[t];if(r)return r;try{return await (this._loading[t]=o(t))}finally{delete this._loading[t]}}}addSchema(t,r,o,i=this.opts.validateSchema){let a;if(Array.isArray(t)){for(let r of t)this.addSchema(r,void 0,o,i);return this}if("object"==typeof t){let{schemaId:r}=this.opts;if(void 0!==(a=t[r])&&"string"!=typeof a)throw Error(`schema ${r} must be string`)}return r=(0,c.normalizeId)(r||a),this._checkUnique(r),this.schemas[r]=this._addSchema(t,o,r,i,!0),this}addMetaSchema(t,r,o=this.opts.validateSchema){return this.addSchema(t,r,!0,o),this}validateSchema(t,r){let o;if("boolean"==typeof t)return!0;if(void 0!==(o=t.$schema)&&"string"!=typeof o)throw Error("$schema must be a string");if(!(o=o||this.opts.defaultMeta||this.defaultMeta()))return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(o,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:o}=this.opts,i=new s.SchemaEnv({schema:{},schemaId:o});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 o;if("string"==typeof t)o=t,"object"==typeof r&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=o);else if("object"==typeof t&&void 0===r){if(Array.isArray(o=(r=t).keyword)&&!o.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(x.call(this,o,r),!r)return(0,d.eachItem)(o,t=>T.call(this,t)),this;C.call(this,r);let i={...r,type:(0,u.getJSONTypes)(r.type),schemaType:(0,u.getJSONTypes)(r.schemaType)};return(0,d.eachItem)(o,0===i.type.length?t=>T.call(this,t,i):t=>i.type.forEach(r=>T.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 o of(delete r.keywords[t],delete r.all[t],r.rules)){let r=o.rules.findIndex(r=>r.keyword===t);r>=0&&o.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:o="data"}={}){return t&&0!==t.length?t.map(t=>`${o}${t.instancePath} ${t.message}`).reduce((t,o)=>t+r+o):"No errors"}$dataMetaSchema(t,r){let o=this.RULES.all;for(let i of(t=JSON.parse(JSON.stringify(t)),r)){let r=i.split("/").slice(1),a=t;for(let t of r)a=a[t];for(let t in o){let r=o[t];if("object"!=typeof r)continue;let{$data:i}=r.definition,n=a[t];i&&n&&(a[t]=I(n))}}return t}_removeAllSchemas(t,r){for(let o in t){let i=t[o];(!r||r.test(o))&&("string"==typeof i?delete t[o]:i&&!i.meta&&(this._cache.delete(i.schema),delete t[o]))}}_addSchema(t,r,o,i=this.opts.validateSchema,a=this.opts.addUsedSchema){let n,{schemaId:l}=this.opts;if("object"==typeof t)n=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;o=(0,c.normalizeId)(n||o);let d=c.getSchemaRefs.call(this,t,o);return u=new s.SchemaEnv({schema:t,schemaId:l,meta:r,baseId:o,localRefs:d}),this._cache.set(u.schema,u),a&&!o.startsWith("#")&&(o&&this._checkUnique(o),this.refs[o]=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,o,i="error"){for(let a in t)a in r&&this.logger[i](`${o}: option ${a}. ${t[a]}`)}function S(t){return t=(0,c.normalizeId)(t),this.schemas[t]||this.refs[t]}function w(){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 $(){for(let t in this.opts.formats){let r=this.opts.formats[t];r&&this.addFormat(t,r)}}function P(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 o=t[r];o.keyword||(o.keyword=r),this.addKeyword(o)}}function R(){let t={...this.opts};for(let r of f)delete t[r];return t}_.ValidationError=i.default,_.MissingRefError=a.default,t.default=_;let E={log(){},warn(){},error(){}},k=/^[a-z_$][a-z0-9_$:-]*$/i;function x(t,r){let{RULES:o}=this;if((0,d.eachItem)(t,t=>{if(o.keywords[t])throw Error(`Keyword ${t} is already defined`);if(!k.test(t))throw Error(`Keyword ${t} has invalid name`)}),r&&r.$data&&!("code"in r||"validate"in r))throw Error('$data keyword must have "code" or "validate" function')}function T(t,r,o){var i;let a=null==r?void 0:r.post;if(o&&a)throw Error('keyword with "post" flag cannot have "type"');let{RULES:n}=this,s=a?n.post:n.rules.find(({type:t})=>t===o);if(s||(s={type:o,rules:[]},n.rules.push(s)),n.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?O.call(this,s,l,r.before):s.rules.push(l),n.all[t]=l,null==(i=r.implements)||i.forEach(t=>this.addKeyword(t))}function O(t,r,o){let i=t.rules.findIndex(t=>t.keyword===o);i>=0?t.rules.splice(i,0,r):(t.rules.push(r),this.logger.warn(`rule ${o} is not defined`))}function C(t){let{metaSchema:r}=t;void 0!==r&&(t.$data&&this.opts.$data&&(r=I(r)),t.validateSchema=this.compile(r,!0))}let j={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function I(t){return{anyOf:[t,j]}}}),uD=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}}}),uU=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;let r=uj(),o=uP(),i=uf(),a=ug(),n=uI(),s=uy();function l(t,r){let{gen:o}=t;return r.validate?o.scopeValue("validate",{ref:r.validate}):(0,i._)`${o.scopeValue("wrapper",{ref:r})}.validate`}function c(t,r,n,l){let{gen:c,it:u}=t,{allErrors:d,schemaEnv:p,opts:h}=u,m=h.passContext?a.default.this:i.nil;function f(t){let r=(0,i._)`${t}.errors`;c.assign(a.default.vErrors,(0,i._)`${a.default.vErrors} === null ? ${r} : ${a.default.vErrors}.concat(${r})`),c.assign(a.default.errors,(0,i._)`${a.default.vErrors}.length`)}function y(t){var r;if(!u.opts.unevaluated)return;let o=null==(r=null==n?void 0:n.validate)?void 0:r.evaluated;if(!0!==u.props)if(o&&!o.dynamicProps)void 0!==o.props&&(u.props=s.mergeEvaluated.props(c,o.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(o&&!o.dynamicItems)void 0!==o.items&&(u.items=s.mergeEvaluated.items(c,o.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 a=c.let("valid");c.try(()=>{c.code((0,i._)`await ${(0,o.callValidateCode)(t,r,m)}`),y(r),d||c.assign(a,!0)},t=>{c.if((0,i._)`!(${t} instanceof ${u.ValidationError})`,()=>c.throw(t)),f(t),d||c.assign(a,!1)}),t.ok(a)}():t.result((0,o.callValidateCode)(t,r,m),()=>y(r),()=>f(r))}t.getValidate=l,t.callRef=c,t.default={keyword:"$ref",schemaType:"string",code(t){var o,a;let s,u,d,{gen:p,schema:h,it:m}=t,{baseId:f,schemaEnv:y,validateName:g,opts:v,self:_}=m,{root:b}=y;if(("#"===h||"#/"===h)&&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=n.resolveRef.call(_,b,f,h);if(void 0===S)throw new r.default(m.opts.uriResolver,f,h);return S instanceof n.SchemaEnv?void c(t,l(t,o=S),o,o.$async):(a=S,s=p.scopeValue("schema",!0===v.code.source?{ref:a,code:(0,i.stringify)(a)}:{ref:a}),u=p.name("valid"),d=t.subschema({schema:a,dataTypes:[],schemaPath:i.nil,topSchemaRef:s,errSchemaPath:h},u),void(t.mergeEvaluated(d),t.ok(u)))}}}),uV=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uD(),o=uU();t.default=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",r.default,o.default]}),uH=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf(),o=r.operators,i={maximum:{okStr:"<=",ok:o.LTE,fail:o.GT},minimum:{okStr:">=",ok:o.GTE,fail:o.LT},exclusiveMaximum:{okStr:"<",ok:o.LT,fail:o.GTE},exclusiveMinimum:{okStr:">",ok:o.GT,fail:o.LTE}};t.default={keyword:Object.keys(i),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:o})=>(0,r.str)`must be ${i[t].okStr} ${o}`,params:({keyword:t,schemaCode:o})=>(0,r._)`{comparison: ${i[t].okStr}, limit: ${o}}`},code(t){let{keyword:o,data:a,schemaCode:n}=t;t.fail$data((0,r._)`${a} ${i[o].fail} ${n} || isNaN(${a})`)}}}),uF=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf();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:o,data:i,schemaCode:a,it:n}=t,s=n.opts.multipleOfPrecision,l=o.let("res"),c=s?(0,r._)`Math.abs(Math.round(${l}) - ${l}) > 1e-${s}`:(0,r._)`${l} !== parseInt(${l})`;t.fail$data((0,r._)`(${a} === 0 || (${l} = ${i}/${a}, ${c}))`)}}}),uK=q(t=>{function r(t){let r,o=t.length,i=0,a=0;for(;a<o;)i++,(r=t.charCodeAt(a++))>=55296&&r<=56319&&a<o&&(64512&(r=t.charCodeAt(a)))==56320&&a++;return i}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,r.code='require("ajv/dist/runtime/ucs2length").default'}),uJ=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf(),o=uy(),i=uK();t.default={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:o})=>(0,r.str)`must NOT have ${"maxLength"===t?"more":"fewer"} than ${o} characters`,params:({schemaCode:t})=>(0,r._)`{limit: ${t}}`},code(t){let{keyword:a,data:n,schemaCode:s,it:l}=t,c="maxLength"===a?r.operators.GT:r.operators.LT,u=!1===l.opts.unicode?(0,r._)`${n}.length`:(0,r._)`${(0,o.useFunc)(t.gen,i.default)}(${n})`;t.fail$data((0,r._)`${u} ${c} ${s}`)}}}),uZ=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uP(),o=uy(),i=uf();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:a,data:n,$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,o.useFunc)(a,r),l=a.let("valid");a.try(()=>a.assign(l,(0,i._)`${s}(${c}, ${d}).test(${n})`),()=>a.assign(l,!1)),t.fail$data((0,i._)`!${l}`)}else{let o=(0,r.usePattern)(t,l);t.fail$data((0,i._)`!${o}.test(${n})`)}}}}),uW=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf();t.default={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:o})=>(0,r.str)`must NOT have ${"maxProperties"===t?"more":"fewer"} than ${o} properties`,params:({schemaCode:t})=>(0,r._)`{limit: ${t}}`},code(t){let{keyword:o,data:i,schemaCode:a}=t,n="maxProperties"===o?r.operators.GT:r.operators.LT;t.fail$data((0,r._)`Object.keys(${i}).length ${n} ${a}`)}}}),uB=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uP(),o=uf(),i=uy();t.default={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:t}})=>(0,o.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,o._)`{missingProperty: ${t}}`},code(t){let{gen:a,schema:n,schemaCode:s,data:l,$data:c,it:u}=t,{opts:d}=u;if(!c&&0===n.length)return;let p=n.length>=d.loopRequired;if(u.allErrors?function(){if(p||c)t.block$data(o.nil,h);else for(let o of n)(0,r.checkReportMissingProp)(t,o)}():function(){let i=a.let("missing");if(p||c){let n=a.let("valid",!0);t.block$data(n,()=>{var c,u;return c=i,u=n,void(t.setParams({missingProperty:c}),a.forOf(c,s,()=>{a.assign(u,(0,r.propertyInData)(a,l,c,d.ownProperties)),a.if((0,o.not)(u),()=>{t.error(),a.break()})},o.nil))}),t.ok(n)}else a.if((0,r.checkMissingProp)(t,n,i)),(0,r.reportMissingProp)(t,i),a.else()}(),d.strictRequired){let r=t.parentSchema.properties,{definedProperties:o}=t.it;for(let t of n)if((null==r?void 0:r[t])===void 0&&!o.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 h(){a.forOf("prop",s,o=>{t.setParams({missingProperty:o}),a.if((0,r.noPropertyInData)(a,l,o,d.ownProperties),()=>t.error())})}}}}),uG=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf();t.default={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:o})=>(0,r.str)`must NOT have ${"maxItems"===t?"more":"fewer"} than ${o} items`,params:({schemaCode:t})=>(0,r._)`{limit: ${t}}`},code(t){let{keyword:o,data:i,schemaCode:a}=t,n="maxItems"===o?r.operators.GT:r.operators.LT;t.fail$data((0,r._)`${i}.length ${n} ${a}`)}}}),uX=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uk();r.code='require("ajv/dist/runtime/equal").default',t.default=r}),uY=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uw(),o=uf(),i=uy(),a=uX();t.default={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:t,j:r}})=>(0,o.str)`must NOT have duplicate items (items ## ${r} and ${t} are identical)`,params:({params:{i:t,j:r}})=>(0,o._)`{i: ${t}, j: ${r}}`},code(t){let{gen:n,data:s,$data:l,schema:c,parentSchema:u,schemaCode:d,it:p}=t;if(!l&&!c)return;let h=n.let("valid"),m=u.items?(0,r.getSchemaTypes)(u.items):[];t.block$data(h,function(){let l=n.let("i",(0,o._)`${s}.length`),c=n.let("j");t.setParams({i:l,j:c}),n.assign(h,!0),n.if((0,o._)`${l} > 1`,()=>(m.length>0&&!m.some(t=>"object"===t||"array"===t)?function(i,a){let l=n.name("item"),c=(0,r.checkDataTypes)(m,l,p.opts.strictNumbers,r.DataType.Wrong),u=n.const("indices",(0,o._)`{}`);n.for((0,o._)`;${i}--;`,()=>{n.let(l,(0,o._)`${s}[${i}]`),n.if(c,(0,o._)`continue`),m.length>1&&n.if((0,o._)`typeof ${l} == "string"`,(0,o._)`${l} += "_"`),n.if((0,o._)`typeof ${u}[${l}] == "number"`,()=>{n.assign(a,(0,o._)`${u}[${l}]`),t.error(),n.assign(h,!1).break()}).code((0,o._)`${u}[${l}] = ${i}`)})}:function(r,l){let c=(0,i.useFunc)(n,a.default),u=n.name("outer");n.label(u).for((0,o._)`;${r}--;`,()=>n.for((0,o._)`${l} = ${r}; ${l}--;`,()=>n.if((0,o._)`${c}(${s}[${r}], ${s}[${l}])`,()=>{t.error(),n.assign(h,!1).break(u)})))})(l,c))},(0,o._)`${d} === false`),t.ok(h)}}}),uQ=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf(),o=uy(),i=uX();t.default={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:t})=>(0,r._)`{allowedValue: ${t}}`},code(t){let{gen:a,data:n,$data:s,schemaCode:l,schema:c}=t;s||c&&"object"==typeof c?t.fail$data((0,r._)`!${(0,o.useFunc)(a,i.default)}(${n}, ${l})`):t.fail((0,r._)`${c} !== ${n}`)}}}),u0=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf(),o=uy(),i=uX();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 a,n,{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 h=u.length>=p.opts.loopEnum,m=()=>null!=a?a:a=(0,o.useFunc)(s,i.default);if(h||c)n=s.let("valid"),t.block$data(n,function(){s.assign(n,!1),s.forOf("v",d,t=>s.if((0,r._)`${m()}(${l}, ${t})`,()=>s.assign(n,!0).break()))});else{if(!Array.isArray(u))throw Error("ajv implementation error");let t=s.const("vSchema",d);n=(0,r.or)(...u.map((o,i)=>{var a,n;let s;return a=t,"object"==typeof(s=u[n=i])&&null!==s?(0,r._)`${m()}(${l}, ${a}[${n}])`:(0,r._)`${l} === ${s}`}))}t.pass(n)}}}),u1=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uH(),o=uF(),i=uJ(),a=uZ(),n=uW(),s=uB(),l=uG(),c=uY(),u=uQ(),d=u0();t.default=[r.default,o.default,i.default,a.default,n.default,s.default,l.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,d.default]}),u2=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;let r=uf(),o=uy();function i(t,i){let{gen:a,schema:n,data:s,keyword:l,it:c}=t;c.items=!0;let u=a.const("len",(0,r._)`${s}.length`);if(!1===n)t.setParams({len:i.length}),t.pass((0,r._)`${u} <= ${i.length}`);else if("object"==typeof n&&!(0,o.alwaysValidSchema)(c,n)){let n=a.var("valid",(0,r._)`${u} <= ${i.length}`);a.if((0,r.not)(n),()=>{var s;return s=n,void a.forRange("i",i.length,u,i=>{t.subschema({keyword:l,dataProp:i,dataPropType:o.Type.Num},s),c.allErrors||a.if((0,r.not)(s),()=>a.break())})}),t.ok(n)}}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:a}=t,{items:n}=r;Array.isArray(n)?i(t,n):(0,o.checkStrictMode)(a,'"additionalItems" is ignored when "items" is not an array of schemas')}}}),u9=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;let r=uf(),o=uy(),i=uP();function a(t,i,n=t.schema){let{gen:s,parentSchema:l,data:c,keyword:u,it:d}=t;(function(t){let{opts:r,errSchemaPath:a}=d,s=n.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 "${a}"`;(0,o.checkStrictMode)(d,t,r.strictTuples)}})(l),d.opts.unevaluated&&n.length&&!0!==d.items&&(d.items=o.mergeEvaluated.items(s,n.length,d.items));let p=s.name("valid"),h=s.const("len",(0,r._)`${c}.length`);n.forEach((i,a)=>{(0,o.alwaysValidSchema)(d,i)||(s.if((0,r._)`${h} > ${a}`,()=>t.subschema({keyword:u,schemaProp:a,dataProp:a},p)),t.ok(p))})}t.validateTuple=a,t.default={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:r,it:n}=t;if(Array.isArray(r))return a(t,"additionalItems",r);n.items=!0,(0,o.alwaysValidSchema)(n,r)||t.ok((0,i.validateArray)(t))}}}),u4=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u9();t.default={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,r.validateTuple)(t,"items")}}),u5=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf(),o=uy(),i=uP(),a=u2();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:n,it:s}=t,{prefixItems:l}=n;s.items=!0,(0,o.alwaysValidSchema)(s,r)||(l?(0,a.validateAdditionalItems)(t,l):t.ok((0,i.validateArray)(t)))}}}),u3=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf(),o=uy();t.default={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:t,max:o}})=>void 0===o?(0,r.str)`must contain at least ${t} valid item(s)`:(0,r.str)`must contain at least ${t} and no more than ${o} valid item(s)`,params:({params:{min:t,max:o}})=>void 0===o?(0,r._)`{minContains: ${t}}`:(0,r._)`{minContains: ${t}, maxContains: ${o}}`},code(t){let i,a,{gen:n,schema:s,parentSchema:l,data:c,it:u}=t,{minContains:d,maxContains:p}=l;u.opts.next?(i=void 0===d?1:d,a=p):i=1;let h=n.const("len",(0,r._)`${c}.length`);if(t.setParams({min:i,max:a}),void 0===a&&0===i)return void(0,o.checkStrictMode)(u,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==a&&i>a){(0,o.checkStrictMode)(u,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,o.alwaysValidSchema)(u,s)){let o=(0,r._)`${h} >= ${i}`;void 0!==a&&(o=(0,r._)`${o} && ${h} <= ${a}`),t.pass(o);return}u.items=!0;let m=n.name("valid");function f(){let t=n.name("_valid"),o=n.let("count",0);y(t,()=>n.if(t,()=>{var t;return t=o,void(n.code((0,r._)`${t}++`),void 0===a?n.if((0,r._)`${t} >= ${i}`,()=>n.assign(m,!0).break()):(n.if((0,r._)`${t} > ${a}`,()=>n.assign(m,!1).break()),1===i?n.assign(m,!0):n.if((0,r._)`${t} >= ${i}`,()=>n.assign(m,!0))))}))}function y(r,i){n.forRange("i",0,h,a=>{t.subschema({keyword:"contains",dataProp:a,dataPropType:o.Type.Num,compositeRule:!0},r),i()})}void 0===a&&1===i?y(m,()=>n.if(m,()=>n.break())):0===i?(n.let(m,!0),void 0!==a&&n.if((0,r._)`${c}.length > 0`,f)):(n.let(m,!1),f()),t.result(m,()=>t.reset())}}}),u6=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;let r=uf(),o=uy(),i=uP();t.error={message:({params:{property:t,depsCount:o,deps:i}})=>(0,r.str)`must have ${1===o?"property":"properties"} ${i} when property ${t} is present`,params:({params:{property:t,depsCount:o,deps:i,missingProperty:a}})=>(0,r._)`{property: ${t},
|
|
59
|
+
missingProperty: ${a},
|
|
60
|
+
depsCount: ${o},
|
|
61
|
+
deps: ${i}}`};let a={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(t){let[r,o]=function({schema:t}){let r={},o={};for(let i in t)"__proto__"!==i&&((Array.isArray(t[i])?r:o)[i]=t[i]);return[r,o]}(t);n(t,r),s(t,o)}};function n(t,o=t.schema){let{gen:a,data:s,it:l}=t;if(0===Object.keys(o).length)return;let c=a.let("missing");for(let n in o){let u=o[n];if(0===u.length)continue;let d=(0,i.propertyInData)(a,s,n,l.opts.ownProperties);t.setParams({property:n,depsCount:u.length,deps:u.join(", ")}),l.allErrors?a.if(d,()=>{for(let r of u)(0,i.checkReportMissingProp)(t,r)}):(a.if((0,r._)`${d} && (${(0,i.checkMissingProp)(t,u,c)})`),(0,i.reportMissingProp)(t,c),a.else())}}function s(t,r=t.schema){let{gen:a,data:n,keyword:l,it:c}=t,u=a.name("valid");for(let s in r)(0,o.alwaysValidSchema)(c,r[s])||(a.if((0,i.propertyInData)(a,n,s,c.opts.ownProperties),()=>{let r=t.subschema({keyword:l,schemaProp:s},u);t.mergeValidEvaluated(r,u)},()=>a.var(u,!0)),t.ok(u))}t.validatePropertyDeps=n,t.validateSchemaDeps=s,t.default=a}),u8=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf(),o=uy();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:a,data:n,it:s}=t;if((0,o.alwaysValidSchema)(s,a))return;let l=i.name("valid");i.forIn("key",n,o=>{t.setParams({propertyName:o}),t.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},l),i.if((0,r.not)(l),()=>{t.error(!0),s.allErrors||i.break()})}),t.ok(l)}}}),u7=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uP(),o=uf(),i=ug(),a=uy();t.default={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:t})=>(0,o._)`{additionalProperty: ${t.additionalProperty}}`},code(t){let{gen:n,schema:s,parentSchema:l,data:c,errsCount:u,it:d}=t;if(!u)throw Error("ajv implementation error");let{allErrors:p,opts:h}=d;if(d.props=!0,"all"!==h.removeAdditional&&(0,a.alwaysValidSchema)(d,s))return;let m=(0,r.allSchemaProperties)(l.properties),f=(0,r.allSchemaProperties)(l.patternProperties);function y(t){n.code((0,o._)`delete ${c}[${t}]`)}function g(r){if("all"===h.removeAdditional||h.removeAdditional&&!1===s)return void y(r);if(!1===s){t.setParams({additionalProperty:r}),t.error(),p||n.break();return}if("object"==typeof s&&!(0,a.alwaysValidSchema)(d,s)){let i=n.name("valid");"failing"===h.removeAdditional?(v(r,i,!1),n.if((0,o.not)(i),()=>{t.reset(),y(r)})):(v(r,i),p||n.if((0,o.not)(i),()=>n.break()))}}function v(r,o,i){let n={keyword:"additionalProperties",dataProp:r,dataPropType:a.Type.Str};!1===i&&Object.assign(n,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(n,o)}n.forIn("key",c,i=>{m.length||f.length?n.if(function(i){let s;if(m.length>8){let t=(0,a.schemaRefOrVal)(d,l.properties,"properties");s=(0,r.isOwnProperty)(n,t,i)}else s=m.length?(0,o.or)(...m.map(t=>(0,o._)`${i} === ${t}`)):o.nil;return f.length&&(s=(0,o.or)(s,...f.map(a=>(0,o._)`${(0,r.usePattern)(t,a)}.test(${i})`))),(0,o.not)(s)}(i),()=>g(i)):g(i)}),t.ok((0,o._)`${u} === ${i.default.errors}`)}}}),de=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uO(),o=uP(),i=uy(),a=u7();t.default={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:n,schema:s,parentSchema:l,data:c,it:u}=t;"all"===u.opts.removeAdditional&&void 0===l.additionalProperties&&a.default.code(new r.KeywordCxt(u,a.default,"additionalProperties"));let d=(0,o.allSchemaProperties)(s);for(let t of d)u.definedProperties.add(t);u.opts.unevaluated&&d.length&&!0!==u.props&&(u.props=i.mergeEvaluated.props(n,(0,i.toHash)(d),u.props));let p=d.filter(t=>!(0,i.alwaysValidSchema)(u,s[t]));if(0===p.length)return;let h=n.name("valid");for(let r of p){var m;(m=r,u.opts.useDefaults&&!u.compositeRule&&void 0!==s[m].default)?f(r):(n.if((0,o.propertyInData)(n,c,r,u.opts.ownProperties)),f(r),u.allErrors||n.else().var(h,!0),n.endIf()),t.it.definedProperties.add(r),t.ok(h)}function f(r){t.subschema({keyword:"properties",schemaProp:r,dataProp:r},h)}}}}),dt=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uP(),o=uf(),i=uy(),a=uy();t.default={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:n,schema:s,data:l,parentSchema:c,it:u}=t,{opts:d}=u,p=(0,r.allSchemaProperties)(s),h=p.filter(t=>(0,i.alwaysValidSchema)(u,s[t]));if(0===p.length||h.length===p.length&&(!u.opts.unevaluated||!0===u.props))return;let m=d.strictSchema&&!d.allowMatchingProperties&&c.properties,f=n.name("valid");!0===u.props||u.props instanceof o.Name||(u.props=(0,a.evaluatedPropsToName)(n,u.props));let{props:y}=u;for(let t of p)m&&function(t){for(let r in m)new RegExp(t).test(r)&&(0,i.checkStrictMode)(u,`property ${r} matches pattern ${t} (use allowMatchingProperties)`)}(t),u.allErrors?g(t):(n.var(f,!0),g(t),n.if(f));function g(i){n.forIn("key",l,s=>{n.if((0,o._)`${(0,r.usePattern)(t,i)}.test(${s})`,()=>{let r=h.includes(i);r||t.subschema({keyword:"patternProperties",schemaProp:i,dataProp:s,dataPropType:a.Type.Str},f),u.opts.unevaluated&&!0!==y?n.assign((0,o._)`${y}[${s}]`,!0):r||u.allErrors||n.if((0,o.not)(f),()=>n.break())})})}}}}),dr=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uy();t.default={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:o,schema:i,it:a}=t;if((0,r.alwaysValidSchema)(a,i))return void t.fail();let n=o.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),t.failResult(n,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}}}),di=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:uP().validateUnion,error:{message:"must match a schema in anyOf"}}}),da=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf(),o=uy();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:a,parentSchema:n,it:s}=t;if(!Array.isArray(a))throw Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;let l=i.let("valid",!1),c=i.let("passing",null),u=i.name("_valid");t.setParams({passing:c}),i.block(function(){a.forEach((a,n)=>{let d;(0,o.alwaysValidSchema)(s,a)?i.var(u,!0):d=t.subschema({keyword:"oneOf",schemaProp:n,compositeRule:!0},u),n>0&&i.if((0,r._)`${u} && ${l}`).assign(l,!1).assign(c,(0,r._)`[${c}, ${n}]`).else(),i.if(u,()=>{i.assign(l,!0),i.assign(c,n),d&&t.mergeEvaluated(d,r.Name)})})}),t.result(l,()=>t.reset(),()=>t.error(!0))}}}),dn=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uy();t.default={keyword:"allOf",schemaType:"array",code(t){let{gen:o,schema:i,it:a}=t;if(!Array.isArray(i))throw Error("ajv implementation error");let n=o.name("valid");i.forEach((o,i)=>{if((0,r.alwaysValidSchema)(a,o))return;let s=t.subschema({keyword:"allOf",schemaProp:i},n);t.ok(n),t.mergeEvaluated(s)})}}}),ds=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf(),o=uy();function i(t,r){let i=t.schema[r];return void 0!==i&&!(0,o.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 a,{gen:n,parentSchema:s,it:l}=t;void 0===s.then&&void 0===s.else&&(0,o.checkStrictMode)(l,'"if" without "then" and "else" is ignored');let c=i(l,"then"),u=i(l,"else");if(!c&&!u)return;let d=n.let("valid",!0),p=n.name("_valid");if(a=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},p),t.mergeEvaluated(a),t.reset(),c&&u){let r=n.let("ifClause");t.setParams({ifClause:r}),n.if(p,h("then",r),h("else",r))}else c?n.if(p,h("then")):n.if((0,r.not)(p),h("else"));function h(o,i){return()=>{let a=t.subschema({keyword:o},p);n.assign(d,p),t.mergeValidEvaluated(a,d),i?n.assign(i,(0,r._)`${o}`):t.setParams({ifClause:o})}}t.pass(d,()=>t.error(!0))}}}),dl=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uy();t.default={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:o,it:i}){void 0===o.if&&(0,r.checkStrictMode)(i,`"${t}" without "if" is ignored`)}}}),dc=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u2(),o=u4(),i=u9(),a=u5(),n=u3(),s=u6(),l=u8(),c=u7(),u=de(),d=dt(),p=dr(),h=di(),m=da(),f=dn(),y=ds(),g=dl();t.default=function(t=!1){let v=[p.default,h.default,m.default,f.default,y.default,g.default,l.default,c.default,s.default,u.default,d.default];return t?v.push(o.default,a.default):v.push(r.default,i.default),v.push(n.default),v}}),du=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf();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,o){let i,a,n,s,l,c,{gen:u,data:d,$data:p,schema:h,schemaCode:m,it:f}=t,{opts:y,errSchemaPath:g,schemaEnv:v,self:_}=f;y.validateFormats&&(p?(i=u.scopeValue("formats",{ref:_.formats,code:y.code.formats}),a=u.const("fDef",(0,r._)`${i}[${m}]`),n=u.let("fType"),s=u.let("format"),u.if((0,r._)`typeof ${a} == "object" && !(${a} instanceof RegExp)`,()=>u.assign(n,(0,r._)`${a}.type || "string"`).assign(s,(0,r._)`${a}.validate`),()=>u.assign(n,(0,r._)`"string"`).assign(s,a)),t.fail$data((0,r.or)(!1===y.strictSchema?r.nil:(0,r._)`${m} && !${s}`,(l=v.$async?(0,r._)`(${a}.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 && ${n} === ${o} && !${c}`)))):function(){var i;let a,n,s=_.formats[h];if(!s){if(!1===y.strictSchema)return _.logger.warn(l());throw Error(l());function l(){return`unknown format "${h}" ignored in schema at path "${g}"`}}if(!0===s)return;let[c,p,m]=(a=(i=s)instanceof RegExp?(0,r.regexpCode)(i):y.code.formats?(0,r._)`${y.code.formats}${(0,r.getProperty)(h)}`:void 0,n=u.scopeValue("formats",{key:h,ref:i,code:a}),"object"!=typeof i||i instanceof RegExp?["string",i,n]:[i.type||"string",i.validate,(0,r._)`${n}.validate`]);c===o&&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 ${m}(${d})`}return"function"==typeof p?(0,r._)`${m}(${d})`:(0,r._)`${m}.test(${d})`}())}())}}}),dd=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=[du().default]}),dp=q(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"]}),dh=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV(),o=u1(),i=dc(),a=dd(),n=dp();t.default=[r.default,o.default,(0,i.default)(),a.default,n.metadataVocabulary,n.contentVocabulary]}),dm=q(t=>{var r,o;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,(o=r||(t.DiscrError=r={})).Tag="tag",o.Mapping="mapping"}),df=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf(),o=dm(),i=uI(),a=uj(),n=uy();t.default={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:t,tagName:r}})=>t===o.DiscrError.Tag?`tag "${r}" must be string`:`value of tag "${r}" must be in oneOf`,params:({params:{discrError:t,tag:o,tagName:i}})=>(0,r._)`{error: ${t}, tag: ${i}, tagValue: ${o}}`},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 h=c.propertyName;if("string"!=typeof h)throw Error("discriminator: requires propertyName");if(c.mapping)throw Error("discriminator: mapping is not supported");if(!p)throw Error("discriminator: requires oneOf keyword");let m=s.let("valid",!1),f=s.const("tag",(0,r._)`${l}${(0,r.getProperty)(h)}`);s.if((0,r._)`typeof ${f} == "string"`,()=>(function(){let l=function(){var t;let r={},o=l(u),s=!0;for(let r=0;r<p.length;r++){let u=p[r];if((null==u?void 0:u.$ref)&&!(0,n.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 a.default(d.opts.uriResolver,d.baseId,t)}let m=null==(t=null==u?void 0:u.properties)?void 0:t[h];if("object"!=typeof m)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${h}"`);s=s&&(o||l(u)),function(t,r){if(t.const)c(t.const,r);else if(t.enum)for(let o of t.enum)c(o,r);else throw Error(`discriminator: "properties/${h}" must have "const" or "enum"`)}(m,r)}if(!s)throw Error(`discriminator: "${h}" must be required`);return r;function l({required:t}){return Array.isArray(t)&&t.includes(h)}function c(t,o){if("string"!=typeof t||t in r)throw Error(`discriminator: "${h}" values must be unique strings`);r[t]=o}}();for(let o in s.if(!1),l)s.elseIf((0,r._)`${f} === ${o}`),s.assign(m,function(o){let i=s.name("valid"),a=t.subschema({keyword:"oneOf",schemaProp:o},i);return t.mergeEvaluated(a,r.Name),i}(l[o]));s.else(),t.error(!1,{discrError:o.DiscrError.Mapping,tag:f,tagName:h}),s.endIf()})(),()=>t.error(!1,{discrError:o.DiscrError.Tag,tag:f,tagName:h})),t.ok(m)}}}),dy=q((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}}),dg=q((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 o=uL(),i=dh(),a=df(),n=dy(),s=["/properties"],l="http://json-schema.org/draft-07/schema";var c=class extends o.default{_addVocabularies(){super._addVocabularies(),i.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(a.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(n,s):n;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=uO();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=uf();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=uC();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return p.default}});var h=uj();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return h.default}})}),dv=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicAnchor=void 0;let r=uf(),o=ug(),i=uI(),a=uU();function n(t,n){let{gen:s,it:l}=t;l.schemaEnv.root.dynamicAnchors[n]=!0;let c=(0,r._)`${o.default.dynamicAnchors}${(0,r.getProperty)(n)}`,u="#"===l.errSchemaPath?l.validateName:function(t){let{schemaEnv:r,schema:o,self:n}=t.it,{root:s,baseId:l,localRefs:c,meta:u}=r.root,{schemaId:d}=n.opts,p=new i.SchemaEnv({schema:o,schemaId:d,root:s,baseId:l,localRefs:c,meta:u});return i.compileSchema.call(n,p),(0,a.getValidate)(t,p)}(t);s.if((0,r._)`!${c}`,()=>s.assign(c,u))}t.dynamicAnchor=n,t.default={keyword:"$dynamicAnchor",schemaType:"string",code:t=>n(t,t.schema)}}),d_=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicRef=void 0;let r=uf(),o=ug(),i=uU();function a(t,a){let{gen:n,keyword:s,it:l}=t;if("#"!==a[0])throw Error(`"${s}" only supports hash fragment reference`);let c=a.slice(1);if(l.allErrors)u();else{let r=n.let("valid",!1);u(r),t.ok(r)}function u(t){if(l.schemaEnv.root.dynamicAnchors[c]){let i=n.let("_v",(0,r._)`${o.default.dynamicAnchors}${(0,r.getProperty)(c)}`);n.if(i,d(i,t),d(l.validateName,t))}else d(l.validateName,t)()}function d(r,o){return o?()=>n.block(()=>{(0,i.callRef)(t,r),n.let(o,!0)}):()=>(0,i.callRef)(t,r)}}t.dynamicRef=a,t.default={keyword:"$dynamicRef",schemaType:"string",code:t=>a(t,t.schema)}}),db=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dv(),o=uy();t.default={keyword:"$recursiveAnchor",schemaType:"boolean",code(t){t.schema?(0,r.dynamicAnchor)(t,""):(0,o.checkStrictMode)(t.it,"$recursiveAnchor: false is ignored")}}}),dS=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=d_();t.default={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,r.dynamicRef)(t,t.schema)}}),dw=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dv(),o=d_(),i=db(),a=dS();t.default=[r.default,o.default,i.default,a.default]}),d$=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u6();t.default={keyword:"dependentRequired",type:"object",schemaType:"object",error:r.error,code:t=>(0,r.validatePropertyDeps)(t)}}),dP=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u6();t.default={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,r.validateSchemaDeps)(t)}}),dR=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uy();t.default={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:t,parentSchema:o,it:i}){void 0===o.contains&&(0,r.checkStrictMode)(i,`"${t}" without "contains" is ignored`)}}}),dE=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=d$(),o=dP(),i=dR();t.default=[r.default,o.default,i.default]}),dk=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf(),o=uy(),i=ug();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:a,schema:n,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===n){t.setParams({unevaluatedProperty:i}),t.error(),u||a.break();return}if(!(0,o.alwaysValidSchema)(c,n)){let n=a.name("valid");t.subschema({keyword:"unevaluatedProperties",dataProp:i,dataPropType:o.Type.Str},n),u||a.if((0,r.not)(n),()=>a.break())}}d instanceof r.Name?a.if((0,r._)`${d} !== true`,()=>a.forIn("key",s,t=>{var o,i;return a.if((o=d,i=t,(0,r._)`!${o} || !${o}[${i}]`),()=>p(t))})):!0!==d&&a.forIn("key",s,t=>void 0===d?p(t):a.if(function(t,o){let i=[];for(let a in t)!0===t[a]&&i.push((0,r._)`${o} !== ${a}`);return(0,r.and)(...i)}(d,t),()=>p(t))),c.props=!0,t.ok((0,r._)`${l} === ${i.default.errors}`)}}}),dx=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uf(),o=uy();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:a,data:n,it:s}=t,l=s.items||0;if(!0===l)return;let c=i.const("len",(0,r._)`${n}.length`);if(!1===a)t.setParams({len:l}),t.fail((0,r._)`${c} > ${l}`);else if("object"==typeof a&&!(0,o.alwaysValidSchema)(s,a)){let a=i.var("valid",(0,r._)`${c} <= ${l}`);i.if((0,r.not)(a),()=>{var n,u;return n=a,u=l,void i.forRange("i",u,c,a=>{t.subschema({keyword:"unevaluatedItems",dataProp:a,dataPropType:o.Type.Num},n),s.allErrors||i.if((0,r.not)(n),()=>i.break())})}),t.ok(a)}s.items=!0}}}),dT=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dk(),o=dx();t.default=[r.default,o.default]}),dO=q((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"}]}}}}}),dC=q((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:"#"}}}}}),dj=q((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:"#"}}}}),dI=q((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:{}}}}}),dN=q((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"}}}}),dA=q((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=q((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:[]}}}}),dq=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dO(),o=dC(),i=dj(),a=dI(),n=dN(),s=dA(),l=dz(),c=["/properties"];t.default=function(t){return[r,o,i,a,u(this,n),s,u(this,l)].forEach(t=>this.addMetaSchema(t,void 0,!1)),this;function u(r,o){return t?r.$dataMetaSchema(o,c):o}}}),dM=q((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 o=uL(),i=dh(),a=dw(),n=dE(),s=dT(),l=df(),c=dq(),u="https://json-schema.org/draft/2019-09/schema";var d=class extends o.default{constructor(t={}){super({...t,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(a.default),i.default.forEach(t=>this.addVocabulary(t)),this.addVocabulary(n.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=uO();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return p.KeywordCxt}});var h=uf();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return h._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return h.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return h.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return h.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return h.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return h.CodeGen}});var m=uC();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return m.default}});var f=uj();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return f.default}})}),dL=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV(),o=u1(),i=dc(),a=dw(),n=dE(),s=dT(),l=dd(),c=dp();t.default=[a.default,r.default,o.default,(0,i.default)(!0),l.default,c.metadataVocabulary,c.contentVocabulary,n.default,s.default]}),dD=q((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}}}}),dU=q((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"}}}}}),dV=q((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"}}}}),dH=q((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"}}}}),dF=q((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"}}}}),dK=q((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"}}}}),dJ=q((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}}}}),dZ=q((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:[]}}}}),dW=q(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dD(),o=dU(),i=dV(),a=dH(),n=dF(),s=dK(),l=dJ(),c=dZ(),u=["/properties"];t.default=function(t){return[r,o,i,a,n,d(this,s),l,d(this,c)].forEach(t=>this.addMetaSchema(t,void 0,!1)),this;function d(r,o){return t?r.$dataMetaSchema(o,u):o}}}),dB=q((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 o=uL(),i=dL(),a=df(),n=dW(),s="https://json-schema.org/draft/2020-12/schema";var l=class extends o.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(a.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:t,meta:r}=this.opts;r&&(n.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=uO();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=uf();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=uC();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.default}});var p=uj();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}),dG=q(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(a,n),time:r(l(!0),c),"date-time":r(p(!0),h),"iso-time":r(l(),u),"iso-date-time":r(p(),m),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$/,n),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,h),"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,m),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},t.formatNames=Object.keys(t.fullFormats);let o=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function a(t){var r;let a=o.exec(t);if(!a)return!1;let n=+a[1],s=+a[2],l=+a[3];return s>=1&&s<=12&&l>=1&&l<=(2===s&&(r=n)%4==0&&(r%100!=0||r%400==0)?29:i[s])}function n(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 o=s.exec(r);if(!o)return!1;let i=+o[1],a=+o[2],n=+o[3],l=o[4],c="-"===o[5]?-1:1,u=+(o[6]||0),d=+(o[7]||0);if(u>23||d>59||t&&!l)return!1;if(i<=23&&a<=59&&n<60)return!0;let p=a-d*c,h=i-u*c-(p<0);return(23===h||-1===h)&&(59===p||-1===p)&&n<61}}function c(t,r){if(!(t&&r))return;let o=new Date("2020-01-01T"+t).valueOf(),i=new Date("2020-01-01T"+r).valueOf();if(o&&i)return o-i}function u(t,r){if(!(t&&r))return;let o=s.exec(t),i=s.exec(r);if(o&&i)return(t=o[1]+o[2]+o[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 o=t.split(d);return 2===o.length&&a(o[0])&&r(o[1])}}function h(t,r){if(!(t&&r))return;let o=new Date(t).valueOf(),i=new Date(r).valueOf();if(o&&i)return o-i}function m(t,r){if(!(t&&r))return;let[o,i]=t.split(d),[a,s]=r.split(d),l=n(o,a);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/}),dX=q(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;let r=dg(),o=uf(),i=o.operators,a={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(a),type:"string",schemaType:"string",$data:!0,error:{message:({keyword:t,schemaCode:r})=>(0,o.str)`should be ${a[t].okStr} ${r}`,params:({keyword:t,schemaCode:r})=>(0,o._)`{comparison: ${a[t].okStr}, limit: ${r}}`},code(t){let i,n,{gen:s,data:l,schemaCode:c,keyword:u,it:d}=t,{opts:p,self:h}=d;if(!p.validateFormats)return;let m=new r.KeywordCxt(d,h.RULES.all.format.definition,"format");function f(t){return(0,o._)`${t}.compare(${l}, ${c}) ${a[u].fail} 0`}m.$data?(i=s.scopeValue("formats",{ref:h.formats,code:p.code.formats}),n=s.const("fmt",(0,o._)`${i}[${m.schemaCode}]`),t.fail$data((0,o.or)((0,o._)`typeof ${n} != "object"`,(0,o._)`${n} instanceof RegExp`,(0,o._)`typeof ${n}.compare != "function"`,f(n)))):function(){let r=m.schema,i=h.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 a=s.scopeValue("formats",{key:r,ref:i,code:p.code.formats?(0,o._)`${p.code.formats}${(0,o.getProperty)(r)}`:void 0});t.fail$data(f(a))}()},dependencies:["format"]},t.default=r=>(r.addKeyword(t.formatLimitDefinition),r)}),dY=q((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});let o=dG(),i=dX(),a=uf(),n=new a.Name("fullFormats"),s=new a.Name("fastFormats"),l=(t,r={keywords:!0})=>{if(Array.isArray(r))return c(t,r,o.fullFormats,n),t;let[a,l]="fast"===r.mode?[o.fastFormats,s]:[o.fullFormats,n];return c(t,r.formats||o.formatNames,a,l),r.keywords&&(0,i.default)(t),t};function c(t,r,o,i){var n;for(let s of(null!=(n=t.opts.code).formats||(n.formats=(0,a._)`require("ajv-formats/dist/formats").${i}`),r))t.addFormat(s,o[s])}l.get=(t,r="full")=>{let i=("fast"===r?o.fastFormats:o.fullFormats)[t];if(!i)throw Error(`Unknown format "${t}"`);return i},r.exports=t=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l}),dQ=dg(),d0=dM(),d1=dB();let d2=M(dY(),1).default;function d9(t){let r=new t({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return d2(r),r}var d4=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(t){this._userAjv=void 0!==t,this._ajv=t}get ajv(){return this._ajv??=d9(d1.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 o=t.$schema.replace(/#$/,"");if(L.has(o))return"2020-12";if(D.has(o))return"2019-09";if(U.has(o)||V.has(o))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??=d9(d0.Ajv2019):this._ajvDraft7??=d9(dQ.Ajv)}getValidator(t){let r=this._engineFor(t),o="$id"in t&&"string"==typeof t.$id?r.getSchema(t.$id)??r.compile(t):r.compile(t);return t=>o(t)?{valid:!0,data:t,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:r.errorsText(o.errors)}}};async function d5(t){return(await u).getRandomValues(new Uint8Array(t))}async function d3(t){let r="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",o=256-256%r.length,i="";for(;i.length<t;)for(let a of(await d5(t-i.length)))a<o&&(i+=r[a%r.length]);return i}async function d6(t){return await d3(t)}async function d8(t){return btoa(String.fromCharCode(...new Uint8Array(await (await u).subtle.digest("SHA-256",new TextEncoder().encode(t))))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function d7(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let r=await d6(t),o=await d8(r);return{code_verifier:r,code_challenge:o}}dQ.Ajv,u=globalThis.crypto?.webcrypto??globalThis.crypto??Promise.resolve().then(a.t.bind(a,7598,19)).then(t=>t.webcrypto);class pe extends Error{constructor(t,r){super(t),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}function pt(t){}function pr(t,r,o){return 100===o&&97===t.charCodeAt(r+1)&&116===t.charCodeAt(r+2)&&97===t.charCodeAt(r+3)&&58===t.charCodeAt(r+4)}function po(t,r,o){return 101===o&&118===t.charCodeAt(r+1)&&101===t.charCodeAt(r+2)&&110===t.charCodeAt(r+3)&&116===t.charCodeAt(r+4)&&58===t.charCodeAt(r+5)}class pi extends TransformStream{constructor({onError:t,onRetry:r,onComment:o,maxBufferSize:i}={}){let a;super({start(n){a=function(t){if("function"==typeof t)throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:r=pt,onError:o=pt,onRetry:i=pt,onComment:a,maxBufferSize:n}=t,s=[],l=0,c=!0,u,d="",p=0,h,m=!1;function f(){void 0!==n&&(l+d.length<=n||(m=!0,s.length=0,l=0,u=void 0,d="",p=0,h=void 0,o(new pe(`Buffered data exceeded max buffer size of ${n} characters`,{type:"max-buffer-size-exceeded"}))))}function y(t){let o=0;if(-1===t.indexOf("\r")){let i=t.indexOf(`
|
|
62
|
+
`,o);for(;-1!==i;){if(o===i){p>0&&r({id:u,event:h,data:d}),u=void 0,d="",p=0,h=void 0,o=i+1,i=t.indexOf(`
|
|
63
|
+
`,o);continue}let a=t.charCodeAt(o);if(pr(t,o,a)){let a=32===t.charCodeAt(o+5)?o+6:o+5,n=t.slice(a,i);if(0===p&&10===t.charCodeAt(i+1)){r({id:u,event:h,data:n}),u=void 0,d="",h=void 0,o=i+2,i=t.indexOf(`
|
|
64
|
+
`,o);continue}d=0===p?n:`${d}
|
|
65
|
+
${n}`,p++}else po(t,o,a)?h=t.slice(32===t.charCodeAt(o+6)?o+7:o+6,i)||void 0:g(t,o,i);o=i+1,i=t.indexOf(`
|
|
66
|
+
`,o)}return t.slice(o)}for(;o<t.length;){let r=t.indexOf("\r",o),i=t.indexOf(`
|
|
67
|
+
`,o),a=-1;if(-1!==r&&-1!==i?a=r<i?r:i:-1!==r?a=r===t.length-1?-1:r:-1!==i&&(a=i),-1===a)break;g(t,o,a),o=a+1,13===t.charCodeAt(o-1)&&10===t.charCodeAt(o)&&o++}return t.slice(o)}function g(t,o,i){if(o===i)return void(p>0&&r({id:u,event:h,data:d}),u=void 0,d="",p=0,h=void 0);let n=t.charCodeAt(o);if(pr(t,o,n)){let r=32===t.charCodeAt(o+5)?o+6:o+5,a=t.slice(r,i);d=0===p?a:`${d}
|
|
68
|
+
${a}`,p++;return}if(po(t,o,n)){h=t.slice(32===t.charCodeAt(o+6)?o+7:o+6,i)||void 0;return}if(105===n&&100===t.charCodeAt(o+1)&&58===t.charCodeAt(o+2)){let r=t.slice(32===t.charCodeAt(o+3)?o+4:o+3,i);u=r.includes("\0")?void 0:r;return}if(58===n){a&&a(t.slice(o,i).slice(32===t.charCodeAt(o+1)?2:1));return}let s=t.slice(o,i),l=s.indexOf(":");if(-1===l)return void v(s,"",s);let c=s.slice(0,l),m=32===s.charCodeAt(l+1)?2:1;v(c,s.slice(l+m),s)}function v(t,r,a){switch(t){case"event":h=r||void 0;break;case"data":d=0===p?r:`${d}
|
|
69
|
+
${r}`,p++;break;case"id":u=r.includes("\0")?void 0:r;break;case"retry":/^\d+$/.test(r)?i(parseInt(r,10)):o(new pe(`Invalid \`retry\` value: "${r}"`,{type:"invalid-retry",value:r,line:a}));break;default:o(new pe(`Unknown field "${t.length>20?`${t.slice(0,20)}\u2026`:t}"`,{type:"unknown-field",field:t,value:r,line:a}))}}return{feed:function(t){if(m)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(c&&(c=!1,239===t.charCodeAt(0)&&187===t.charCodeAt(1)&&191===t.charCodeAt(2)&&(t=t.slice(3))),0===s.length){let r=y(t);""!==r&&(s.push(r),l=r.length),f();return}if(-1===t.indexOf(`
|
|
70
|
+
`)&&-1===t.indexOf("\r")){s.push(t),l+=t.length,f();return}s.push(t);let r=s.join("");s.length=0,l=0;let o=y(r);""!==o&&(s.push(o),l=o.length),f()},reset:function(t={}){if(t.consume&&s.length>0){let t=s.join("");g(t,0,t.length)}c=!0,u=void 0,d="",p=0,h=void 0,s.length=0,l=0,m=!1}}}({onEvent:t=>{n.enqueue(t)},onError(r){"function"==typeof t&&t(r),("terminate"===t||"max-buffer-size-exceeded"===r.type)&&n.error(r)},onRetry:r,onComment:o,maxBufferSize:i})},transform(t){a.feed(t)}})}}var pa=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}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){super(t),this.name=new.target.name,lq(this,new.target)}},pn=class extends pa{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.IssuerMismatchError"})}kind;expected;received;constructor(t,r,o){super(`Issuer mismatch in ${"metadata"===t?"authorization server metadata (RFC 8414 \xa73.3)":"authorization response (RFC 9207)"}: expected ${JSON.stringify(r)}, received ${JSON.stringify(o)}`),this.kind=t,this.expected=r,this.received=o}},ps=class extends pa{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.RegistrationRejectedError"})}status;body;submittedMetadata;constructor(t){super(`Dynamic Client Registration rejected (HTTP ${t.status}): ${t.body}`),this.status=t.status,this.body=t.body,this.submittedMetadata=t.submittedMetadata}},pl=class extends pa{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsecureTokenEndpointError"})}tokenEndpoint;constructor(t){super(`Refusing to send credentials to non-https token endpoint '${t}'. OAuth token requests MUST use TLS (localhost / 127.0.0.1 / ::1 are exempt).`),this.tokenEndpoint=t}},pc=class extends pa{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.AuthorizationServerMismatchError"})}constructor(t,r){super(`Authorization server changed between redirect and callback (redirected to ${JSON.stringify(t)}, callback resolved ${JSON.stringify(r)}); refusing to send authorization_code/code_verifier to a different token endpoint`),this.recordedIssuer=t,this.currentIssuer=r}},pu=class extends pa{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsufficientScopeError"})}requiredScope;resourceMetadataUrl;errorDescription;constructor(t){super(`Insufficient scope${t.requiredScope?`: required "${t.requiredScope}"`:""}`),this.requiredScope=t.requiredScope,this.resourceMetadataUrl=t.resourceMetadataUrl,this.errorDescription=t.errorDescription}};function pd(t,r,o){if(void 0!==t)return void 0===t.issuer?(o?.canPersistStamp!==!1&&console.warn("[mcp-sdk] SEP-2352: stored OAuth credential has no 'issuer' stamp (pre-upgrade storage or provider not round-tripping the value). SEP-2352 isolation is inactive for this read; ensure your provider round-trips the issuer field."),t):pp(t.issuer,r)?t:void 0}function pp(t,r){return t===r||t.endsWith("/")&&t.slice(0,-1)===r||r.endsWith("/")&&r.slice(0,-1)===t}async function ph(t,r,o){let{resourceMetadataUrl:i,scope:a}=pE(r.response);if(await p$(t,{serverUrl:r.serverUrl,resourceMetadataUrl:i,scope:a,fetchFn:r.fetchFn,...o})!=="AUTHORIZED")throw new pm}var pm=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}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){super(t??"Unauthorized"),this.name="UnauthorizedError",lq(this,new.target)}};function pf(t){return t?.authorization_response_iss_parameter_supported===!0}function py({iss:t,expectedIssuer:r,issParameterSupported:o}){if(void 0!==r){if(void 0===t){if(o)throw new pn("authorization_response",r,void 0);return}if(t!==r)throw new pn("authorization_response",r,t)}}function pg(...t){let r=new Set;for(let o of t)if(o)for(let t of o.split(/\s+/))t&&r.add(t);return r.size>0?[...r].join(" "):void 0}async function pv(t,r,o,i,a){if("string"==typeof t)return{authorizationCode:t,iss:r};let n=t.get("iss")??void 0,s=t.get("code");if(s)return{authorizationCode:s,iss:n};let l=(await o.discoveryState?.())?.authorizationServerMetadata;if(!l)try{l=(await pI(i,a)).authorizationServerMetadata}catch{l=void 0}if(!l)throw new pm("Authorization callback failed and the issuer could not be verified");py({iss:n,expectedIssuer:l.issuer,issParameterSupported:pf(l)});let c=t.get("error");if(c)throw new lD(c,t.get("error_description")??c,t.get("error_uri")??void 0);throw new pm("Authorization callback contained neither `code` nor `error`")}let p_="code",pb="S256";function pS(t){return"localhost"===t||"127.0.0.1"===t||"[::1]"===t||"::1"===t}async function pw(t){let r=t instanceof Response?t.status:void 0,o=t instanceof Response?await t.text():t;try{let t=lT.parse(JSON.parse(o));return lD.fromResponse(t)}catch(i){let t=`${r?`HTTP ${r}: `:""}Invalid OAuth error response: ${i}. Raw body: ${o}`;return new lD(lL.ServerError,t)}}async function p$(t,r){try{return await pP(t,r)}catch(o){if(o instanceof lD){if(o.code===lL.InvalidClient||o.code===lL.UnauthorizedClient)return await t.invalidateCredentials?.("client"),await t.invalidateCredentials?.("tokens"),await pP(t,r);else if(o.code===lL.InvalidGrant)return await t.invalidateCredentials?.("tokens"),await pP(t,r)}throw o}}async function pP(t,{serverUrl:r,authorizationCode:o,iss:i,scope:a,resourceMetadataUrl:n,fetchFn:s,skipIssuerMetadataValidation:l,forceReauthorization:c}){var u;let d,p,h,m,f,y={...f=(u=t).clientMetadata,grant_types:f.grant_types??(void 0===u.redirectUrl?void 0:["authorization_code","refresh_token"]),application_type:f.application_type??function(t){for(let r of t??[]){let t;try{t=new URL(r)}catch{continue}if("http:"!==t.protocol&&"https:"!==t.protocol||pS(t.hostname))return"native"}return"web"}(f.redirect_uris)},g=await t.discoveryState?.(),v=n;if(!v&&g?.resourceMetadataUrl&&(v=new URL(g.resourceMetadataUrl)),g?.authorizationServerUrl){if(p=g.authorizationServerUrl,d=g.resourceMetadata,h=g.authorizationServerMetadata??await pj(p,{fetchFn:s,skipIssuerValidation:l}),!d)try{d=await px(r,{resourceMetadataUrl:v},s)}catch(t){if(t instanceof TypeError)throw t}(h!==g.authorizationServerMetadata||d!==g.resourceMetadata)&&await t.saveDiscoveryState?.({authorizationServerUrl:String(p),resourceMetadataUrl:v?.toString(),resourceMetadata:d,authorizationServerMetadata:h})}else{let t=await pI(r,{resourceMetadataUrl:v,fetchFn:s,skipIssuerMetadataValidation:l});p=t.authorizationServerUrl,h=t.authorizationServerMetadata,d=t.resourceMetadata,m={authorizationServerUrl:String(p),resourceMetadataUrl:v?.toString(),resourceMetadata:d,authorizationServerMetadata:h}}let _=h?.issuer??String(p),b={issuer:_};if(await t.saveAuthorizationServerUrl?.(_),void 0!==o){let r=g?.authorizationServerMetadata?.issuer??g?.authorizationServerUrl;if(void 0===r){if(void 0!==t.saveDiscoveryState)throw new pc("discoveryState was not available on the callback leg; ensure your provider persists discoveryState alongside codeVerifier",_);console.warn("[mcp-sdk] OAuthClientProvider does not implement saveDiscoveryState()/discoveryState(); the SEP-2352 callback-leg authorization-server binding cannot be checked. Implement discoveryState (persist alongside codeVerifier) — see docs/migration/upgrade-to-v2.md \xa7SEP-2352.")}else if(!pp(r,_))throw new pc(r,_)}m&&await t.saveDiscoveryState?.(m);let S=await pR(r,t,d);S&&await t.saveResourceUrl?.(String(S));let w=function(t){let{requestedScope:r,resourceMetadata:o,authServerMetadata:i,clientMetadata:a}=t,n=r||o?.scopes_supported?.join(" ")||a.scope;return n&&i?.scopes_supported?.includes("offline_access")&&!n.split(" ").includes("offline_access")&&a.grant_types?.includes("refresh_token")&&(n=`${n} offline_access`),n}({requestedScope:a,resourceMetadata:d,authServerMetadata:h,clientMetadata:t.clientMetadata}),$=await Promise.resolve(t.clientInformation(b)),P=pd($,_,{canPersistStamp:void 0!==t.saveClientInformation});if(void 0===P&&$?.issuer&&void 0===t.saveClientInformation)throw new pc($.issuer,_);if(P&&void 0===P.issuer&&(P={...P,issuer:_},await t.saveClientInformation?.(P,b)),!P){if(void 0!==o)throw Error("Existing OAuth client information is required when exchanging an authorization code");let r=h?.client_id_metadata_document_supported===!0,i=t.clientMetadataUrl;if(i&&!function(t){if(!t)return!1;try{let r=new URL(t);return"https:"===r.protocol&&"/"!==r.pathname}catch{return!1}}(i))throw new lD(lL.InvalidClientMetadata,`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${i}`);if(r&&i)P={client_id:i,issuer:_},await t.saveClientInformation?.(P,b);else{if(!t.saveClientInformation)throw Error("OAuth client information must be saveable for dynamic registration");P={...await pM(p,{metadata:h,clientMetadata:y,scope:w,fetchFn:s}),issuer:_},await t.saveClientInformation(P,b)}}let R=!t.redirectUrl;if(void 0!==o||R){void 0!==o&&py({iss:i,expectedIssuer:h?.issuer,issParameterSupported:pf(h)});let r=await pq(t,p,{metadata:h,resource:S,authorizationCode:o,iss:i,scope:w,fetchFn:s});return await t.saveTokens({...r,issuer:_},b),"AUTHORIZED"}let E=pd(await t.tokens(b),_);if(E&&void 0===E.issuer&&(E={...E,issuer:_},await t.saveTokens(E,b)),E?.refresh_token&&!c)try{let r=await pz(p,{metadata:h,clientInformation:P,refreshToken:E.refresh_token,resource:S,addClientAuthentication:t.addClientAuthentication,fetchFn:s});return await t.saveTokens({...r,issuer:_},b),"AUTHORIZED"}catch(t){if(t instanceof pl||t instanceof lD&&t.code!==lL.ServerError)throw t}let k=t.state?await t.state():void 0,{authorizationUrl:x,codeVerifier:T}=await pN(p,{metadata:h,clientInformation:P,state:k,redirectUrl:t.redirectUrl,scope:w,resource:S});return await t.saveCodeVerifier(T),await t.redirectToAuthorization(x),"REDIRECT"}async function pR(t,r,o){var i;let a,n=((a=new URL("string"==typeof(i=t)?i:i.href)).hash="",a);if(r.validateResourceURL)return await r.validateResourceURL(n,o?.resource);if(o){if(!function({requestedResource:t,configuredResource:r}){let o=new URL("string"==typeof t?t:t.href),i=new URL("string"==typeof r?r:r.href);if(o.origin!==i.origin||o.pathname.length<i.pathname.length)return!1;let a=o.pathname.endsWith("/")?o.pathname:o.pathname+"/",n=i.pathname.endsWith("/")?i.pathname:i.pathname+"/";return a.startsWith(n)}({requestedResource:n,configuredResource:o.resource}))throw Error(`Protected resource ${o.resource} does not match expected ${n} (or origin)`);return new URL(o.resource)}}function pE(t){let r,o=t.headers.get("WWW-Authenticate");if(!o)return{};let[i,a]=o.split(" ");if(i?.toLowerCase()!=="bearer"||!a)return{};let n=pk(t,"resource_metadata")||void 0;if(n)try{r=new URL(n)}catch{}let s=pk(t,"scope")||void 0,l=pk(t,"error")||void 0;return{resourceMetadataUrl:r,scope:s,error:l,errorDescription:pk(t,"error_description")||void 0}}function pk(t,r){let o=t.headers.get("WWW-Authenticate");if(!o)return null;let i=new RegExp(String.raw`${r}=(?:"([^"]+)"|([^\s,]+))`),a=o.match(i);if(a){let t=a[1]||a[2];if(t)return t}return null}async function px(t,r,o=fetch){let i=await pC(t,"oauth-protected-resource",o,{protocolVersion:r?.protocolVersion,metadataUrl:r?.resourceMetadataUrl});if(!i||404===i.status)throw await i?.text?.().catch(()=>{}),Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!i.ok)throw await i.text?.().catch(()=>{}),Error(`HTTP ${i.status} trying to load well-known OAuth protected resource metadata.`);return l$.parse(await i.json())}async function pT(t,r,o=fetch){try{return await o(t,{headers:r})}catch(t){throw t}}async function pO(t,r,o=fetch){return await pT(t,{"MCP-Protocol-Version":r},o)}async function pC(t,r,o,i){var a,n;let s,l=new URL(t),c=i?.protocolVersion??aD;i?.metadataUrl?s=new URL(i.metadataUrl):(s=new URL(function(t,r="",o={}){return r.endsWith("/")&&(r=r.slice(0,-1)),o.prependPathname?`${r}/.well-known/${t}`:`/.well-known/${t}${r}`}(r,l.pathname),i?.metadataServerUrl??l)).search=l.search;let u=await pO(s,c,o);return!i?.metadataUrl&&(a=u,n=l.pathname,!a||"/"!==n&&(a.status>=400&&a.status<500||502===a.status))&&(u=await pO(new URL(`/.well-known/${r}`,l),c,o)),u}async function pj(t,{fetchFn:r=fetch,protocolVersion:o=aD,skipIssuerValidation:i=!1}={}){let a={"MCP-Protocol-Version":o,Accept:"application/json"};for(let{url:o,type:n}of function(t){let r="string"==typeof t?new URL(t):t,o="/"!==r.pathname,i=[];if(!o)return i.push({url:new URL("/.well-known/oauth-authorization-server",r.origin),type:"oauth"},{url:new URL("/.well-known/openid-configuration",r.origin),type:"oidc"}),i;let a=r.pathname;return a.endsWith("/")&&(a=a.slice(0,-1)),i.push({url:new URL(`/.well-known/oauth-authorization-server${a}`,r.origin),type:"oauth"},{url:new URL(`/.well-known/openid-configuration${a}`,r.origin),type:"oidc"},{url:new URL(`${a}/.well-known/openid-configuration`,r.origin),type:"oidc"}),i}(t)){let s=await pT(o,a,r);if(!s)continue;if(!s.ok){if(await s.text?.().catch(()=>{}),s.status>=400&&s.status<500||502===s.status)continue;throw Error(`HTTP ${s.status} trying to load ${"oauth"===n?"OAuth":"OpenID provider"} metadata from ${o}`)}let l="oauth"===n?lP.parse(await s.json()):lE.parse(await s.json());if(!i){let r="string"==typeof t?t:t.href;if(!(l.issuer===r||r.endsWith("/")&&l.issuer===r.slice(0,-1)))throw new pn("metadata",r,l.issuer)}return l}}async function pI(t,r){let o,i;try{(o=await px(t,{resourceMetadataUrl:r?.resourceMetadataUrl},r?.fetchFn)).authorization_servers&&o.authorization_servers.length>0&&(i=o.authorization_servers[0])}catch(t){if(t instanceof TypeError)throw t}i||(i=String(new URL("/",t)));let a=await pj(i,{fetchFn:r?.fetchFn,skipIssuerValidation:r?.skipIssuerMetadataValidation});return{authorizationServerUrl:i,authorizationServerMetadata:a,resourceMetadata:o}}async function pN(t,{metadata:r,clientInformation:o,redirectUrl:i,scope:a,state:n,resource:s}){let l;if(r){if(l=new URL(r.authorization_endpoint),!r.response_types_supported.includes(p_))throw Error(`Incompatible auth server: does not support response type ${p_}`);if(r.code_challenge_methods_supported&&!r.code_challenge_methods_supported.includes(pb))throw Error(`Incompatible auth server: does not support code challenge method ${pb}`)}else l=new URL("/authorize",t);let c=await d7(),u=c.code_verifier,d=c.code_challenge;return l.searchParams.set("response_type",p_),l.searchParams.set("client_id",o.client_id),l.searchParams.set("code_challenge",d),l.searchParams.set("code_challenge_method",pb),l.searchParams.set("redirect_uri",String(i)),n&&l.searchParams.set("state",n),a&&l.searchParams.set("scope",a),a?.split(" ").includes("offline_access")&&l.searchParams.append("prompt","consent"),s&&l.searchParams.set("resource",s.href),{authorizationUrl:l,codeVerifier:u}}async function pA(t,{metadata:r,tokenRequestParams:o,clientInformation:i,addClientAuthentication:a,resource:n,fetchFn:s}){var l,c;let u,d=function(t){let r=new URL(String(t));if("https:"!==r.protocol&&!pS(r.hostname))throw new pl(r.href);return r}(r?.token_endpoint??new URL("/token",t)),p=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});n&&o.set("resource",n.href),a?await a(p,o,d,r):i&&function(t,r,o,i){let{client_id:a,client_secret:n}=r;switch(t){case"client_secret_basic":var s,l,c,u,d=a,p=n,h=o;if(!p)throw Error("client_secret_basic authentication requires a client_secret");let m=btoa(`${d}:${p}`);h.set("Authorization",`Basic ${m}`);return;case"client_secret_post":s=a,l=n,(c=i).set("client_id",s),l&&c.set("client_secret",l);return;case"none":u=a,i.set("client_id",u);return;default:throw Error(`Unsupported client authentication method: ${t}`)}}((l=i,c=r?.token_endpoint_auth_methods_supported??[],u=void 0!==l.client_secret,"token_endpoint_auth_method"in l&&l.token_endpoint_auth_method&&["client_secret_basic","client_secret_post","none"].includes(l.token_endpoint_auth_method)&&(0===c.length||c.includes(l.token_endpoint_auth_method))?l.token_endpoint_auth_method:0===c.length?u?"client_secret_basic":"none":u&&c.includes("client_secret_basic")?"client_secret_basic":u&&c.includes("client_secret_post")?"client_secret_post":c.includes("none")?"none":u?"client_secret_post":"none"),i,p,o);let h=await (s??fetch)(d,{method:"POST",headers:p,body:o});if(!h.ok)throw await pw(h);let m=await h.json();try{return lk.parse(m)}catch(t){if("object"==typeof m&&null!==m&&"error"in m)throw await pw(JSON.stringify(m));throw t}}async function pz(t,{metadata:r,clientInformation:o,refreshToken:i,resource:a,addClientAuthentication:n,fetchFn:s}){return{refresh_token:i,...await pA(t,{metadata:r,tokenRequestParams:new URLSearchParams({grant_type:"refresh_token",refresh_token:i}),clientInformation:o,addClientAuthentication:n,resource:a,fetchFn:s})}}async function pq(t,r,{metadata:o,resource:i,authorizationCode:a,iss:n,scope:s,fetchFn:l}={}){let c;void 0!==a&&py({iss:n,expectedIssuer:o?.issuer,issParameterSupported:pf(o)});let u=s??t.clientMetadata.scope;if(t.prepareTokenRequest&&(c=await t.prepareTokenRequest(u)),!c){var d,p;if(!a)throw Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!t.redirectUrl)throw Error("redirectUrl is required for authorization_code flow");d=a,p=await t.codeVerifier(),c=new URLSearchParams({grant_type:"authorization_code",code:d,code_verifier:p,redirect_uri:String(t.redirectUrl)})}let h=await t.clientInformation({issuer:o?.issuer??String(r)});return pA(r,{metadata:o,tokenRequestParams:c,clientInformation:h??void 0,addClientAuthentication:t.addClientAuthentication,resource:i,fetchFn:l})}async function pM(t,{metadata:r,clientMetadata:o,scope:i,fetchFn:a}){let n;if(r){if(!r.registration_endpoint)throw Error("Incompatible auth server: does not support dynamic client registration");n=new URL(r.registration_endpoint)}else n=new URL("/register",t);let s={...o,...void 0===i?{}:{scope:i}},l=await (a??fetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!l.ok)throw new ps({status:l.status,body:await l.text(),submittedMetadata:s});return lI.parse(await l.json())}let pL=new Set(["tools/list","prompts/list","resources/list","resources/templates/list","server/discover"]);var pD=class{_entries=new Map;_maxEntries;_stamp=0;_cappedSize=0;constructor(t){this._maxEntries=t?.maxEntries??512}get size(){return this._entries.size}get(t){return this._entries.get(pU(t))}set(t,r){let o=pU(t),i=pL.has(t.method),a=!this._entries.has(o);if(!i&&a&&this._maxEntries>0&&this._cappedSize>=this._maxEntries){for(let t of this._entries.keys())if(!pL.has(t.slice(0,t.indexOf("\0")))){this._entries.delete(t),this._cappedSize--;break}}let n=++this._stamp;return this._entries.set(o,{...r,stamp:n}),a&&!i&&this._cappedSize++,n}delete(t){this._entries.delete(pU(t))&&!pL.has(t.method)&&this._cappedSize--}evict(t){let r=`${t}\0`,o=pL.has(t);for(let t of this._entries.keys())t.startsWith(r)&&(this._entries.delete(t),!o&&this._cappedSize--)}clear(){this._entries.clear(),this._cappedSize=0}};function pU(t){return`${t.method}\0${JSON.stringify([t.partition??"",t.params??""])}`}function pV(t,r){return void 0===r?t:`${t}\0${r}`}var pH=class{_evictionGeneration=new Map;_toolIndex;_toolOutputValidatorIndex;_serverIdentity="";constructor(t,r,o=()=>{},i="",a=Date.now){this._store=t,this._isUserSupplied=r,this._reportError=o,this._cachePartition=i,this._now=a}now(){return this._now()}setServerIdentity(t){this._serverIdentity=t}_partitionFor(t){return JSON.stringify([this._serverIdentity,"public"===t?"":this._cachePartition])}async _probe(t,r){let o={method:t,params:r??""},i=this._partitionFor("private"),a=await this._store.get({...o,partition:i});if(void 0!==a)return a;let n=this._partitionFor("public");if(n===i)return;let s=await this._store.get({...o,partition:n});return s?.scope==="public"?s:void 0}async evict(t){this._evictionGeneration.set(t,(this._evictionGeneration.get(t)??0)+1),await this._deleteBoth(t,"")}async _deleteBoth(t,r){let o=this._partitionFor("private"),i=this._partitionFor("public");try{await this._store.delete({method:t,params:r,partition:o})}catch(t){this._reportError(t)}if(i!==o)try{await this._store.delete({method:t,params:r,partition:i})}catch(t){this._reportError(t)}}async evictKey(t,r){let o=pV(t,r),i=this._evictionGeneration.get(o);void 0!==i&&this._evictionGeneration.set(o,i+1),await this._deleteBoth(t,r)}captureGeneration(t,r){let o=pV(t,r),i=this._evictionGeneration.get(o)??0;return this._evictionGeneration.set(o,i),i}async write(t,r,o,i){if((this._evictionGeneration.get(pV(t,i?.params))??0)!==o)return;let a=i?.params??"",n=this._partitionFor("private"),s=this._partitionFor("public"),l=(i?.scope??"private")==="public"?s:n;try{await this._store.set({method:t,params:a,partition:l},{value:function(t){let r;try{r=JSON.stringify(t)}catch(t){throw TypeError(`cache value is not JSON-serializable: ${t instanceof Error?t.message:String(t)}`)}if("string"!=typeof r)throw TypeError("cache value is not JSON-serializable: it has no JSON representation");return r}(r),expiresAt:i?.expiresAt,scope:i?.scope})}catch(t){this._reportError(t)}if(s!==n)try{await this._store.delete({method:t,params:a,partition:l===n?s:n})}catch(t){this._reportError(t)}}async read(t,r){let o=await this._probe(t,r);if(o?.expiresAt!==void 0&&o.expiresAt>this.now())try{let t=JSON.parse(o.value);if("object"!=typeof t||null===t||Array.isArray(t))throw TypeError("cached document is not an object");return{value:t}}catch(o){this._reportError(o),await this._deleteBoth(t,r??"");return}}resetForReconnect(){this._isUserSupplied||this._store.clear(),this._evictionGeneration.clear(),this._toolIndex=void 0,this._toolOutputValidatorIndex=void 0,this._serverIdentity=""}async toolDefinition(t){let r=await this._probe("tools/list");if(void 0===r){this._toolIndex=void 0;return}if(this._toolIndex?.stamp!==r.stamp){let t=this._decodeListTools(r),o=new Map;if(void 0!==t)for(let r of t.tools)o.set(r.name,r);this._toolIndex={stamp:r.stamp,byName:o}}return this._toolIndex.byName.get(t)}async outputValidator(t,r){let o=await this._probe("tools/list");if(void 0===o){this._toolOutputValidatorIndex=void 0;return}if(this._toolOutputValidatorIndex?.stamp!==o.stamp){let t=this._decodeListTools(o)??{tools:[]},i=new Map;for(let o of t.tools){let t=r(o);void 0!==t&&i.set(o.name,t)}this._toolOutputValidatorIndex={stamp:o.stamp,byName:i}}return this._toolOutputValidatorIndex.byName.get(t)}_decodeListTools(t){try{let r=JSON.parse(t.value);if(!Array.isArray(r?.tools)||!r.tools.every(t=>null!==t&&"object"==typeof t))throw TypeError("cached tools/list document has a malformed tools array");return r}catch(t){this._reportError(t);return}}};let pF=Symbol.for("mcp.authSeamEscape");function pK(t){if("object"==typeof t&&null!==t||"function"==typeof t)try{Object.defineProperty(t,pF,{value:!0,configurable:!0})}catch{}return t}let pJ=new Set([-32001,-32020,-32021]);function pZ(t,r){let{code:o,message:i,data:a}=t;if(-32022===o){let t=function(t){if("object"!=typeof t||null===t)return;let r=t.supported;if(Array.isArray(r)&&0!==r.length&&r.every(t=>"string"==typeof t))return r}(a);if(void 0===t)return{kind:"legacy"};let o=new cp({supported:t,requested:function(t){if("object"!=typeof t||null===t)return;let r=t.requested;return"string"==typeof r?r:void 0}(a)??r.requestedVersion},i),n=lZ(t),s=r.clientModernVersions.find(t=>n.includes(t));return void 0!==s?{kind:"corrective",version:s,error:o}:n.length>0?{kind:"error",error:o}:r.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:o}}return pJ.has(o),{kind:"legacy"}}function pW(t,r){var o,i;return"browser"===r.environment&&((o=t)instanceof TypeError||o instanceof Error&&"TypeError"===o.name)?{kind:"legacy"}:{kind:"error",error:new lV(lU.EraNegotiationFailed,`Version negotiation probe failed: ${(i=t)instanceof Error?i.message:String(i)}`,{cause:t})}}function pB(){let t=globalThis;return void 0!==t.window&&void 0!==t.document?"browser":"node"}function pG(t){return"stderr"in t&&"pid"in t?"stdio":"http"}var pX=class t{_pending;_probeCounter=0;_savedOnMessage;_savedOnError;_savedOnClose;_closeDelivered=!1;constructor(t){this._transport=t,this._savedOnMessage=t.onmessage,this._savedOnError=t.onerror,this._savedOnClose=t.onclose}static async open(r){let o=new t(r);r.onmessage=t=>{let r=o._pending;if(void 0!==r&&(cA(t)||cz(t))&&t.id===r.id){o._pending=void 0,cA(t)?r.resolve({kind:"response",result:t.result}):r.resolve({kind:"response",error:t.error});return}},r.onerror=t=>{o._savedOnError?.(t)},r.onclose=()=>{let t=o._pending;void 0!==t&&(o._pending=void 0,t.resolve({kind:"closed"})),o._closeDelivered=!0,o._savedOnClose?.()};try{await r.start()}catch(t){throw o.detach(),t}return o}async exchange(t,r){let o=`server-discover-probe-${++this._probeCounter}`;return new Promise(i=>{let a=!1,n=t=>{a||(a=!0,clearTimeout(s),this._pending?.id===o&&(this._pending=void 0),i(t))},s=setTimeout(()=>n({kind:"timeout"}),r);this._pending={id:o,resolve:n},this._transport.send(t(o)).catch(t=>n({kind:"send-error",error:t}))})}detach(){if(this._pending=void 0,this._transport.onmessage=this._savedOnMessage,this._transport.onerror=this._savedOnError,this._closeDelivered&&void 0!==this._savedOnClose){let t=this._savedOnClose,r=this._transport,o=!1,i=()=>{if(!o){o=!0;return}t()};r.onclose=i,pY.set(r,()=>{r.onclose===i&&(r.onclose=t)})}else this._transport.onclose=this._savedOnClose}release(){this.detach();let t=this._transport,r=t.start,o=!0;t.start=async function(){if(o){o=!1,t.start=r;return}return r.call(t)}}};let pY=new WeakMap;function pQ(t){let r=pY.get(t);pY.delete(t),r?.()}async function p0(t,r){let o,i=t.probe.timeoutMs??r.defaultTimeoutMs,a=Math.max(0,t.probe.maxRetries??0),n="pin"===t.kind?[t.version]:t.modernVersions,s="auto"===t.kind&&t.fallbackAvailable,l=await pX.open(r.transport),c=async()=>{let o=n[0],c=!1,u=a;for(;;){let a=await l.exchange(t=>{var i,a,n,s;return i=t,a=o,n=r.clientInfo,s=r.capabilities,{jsonrpc:"2.0",id:i,method:"server/discover",params:{_meta:cT(a).outboundEnvelope({protocolVersion:a,clientInfo:n,clientCapabilities:s})}}},i);if("timeout"===a.kind&&u>0){u--;continue}let d=function(t,r){switch(t.kind){case"response":return void 0===t.error?{kind:"result",result:t.result}:{kind:"rpc-error",...t.error};case"send-error":{var o;let r=t.error;if(("object"==typeof(o=r)&&null!==o||"function"==typeof o)&&!0===o[pF]||r instanceof pm||r instanceof Error&&"UnauthorizedError"===r.name)return{kind:"auth-required",error:r};if(r instanceof lH){let t=r.data?.text;return{kind:"http-error",status:r.data.status,body:"string"==typeof t?t:void 0,statusText:r.data.statusText}}return{kind:"network-error",error:r}}case"closed":return{kind:"closed"};case"timeout":return{kind:"timeout",timeoutMs:r}}}(a,i),p=function(t,r){switch(t.kind){case"result":return function(t,r){let o=cT(cx).validateResult("server/discover",t);if(!o.ok)return{kind:"legacy"};let i=o.value.supportedVersions,a=r.clientModernVersions.find(t=>i.includes(t));return void 0!==a?{kind:"modern",version:a,discover:o.value}:r.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:new cp({supported:[...i],requested:r.requestedVersion})}}(t.result,r);case"rpc-error":return pZ(t,r);case"http-error":return function(t,r){if(401===t.status||403===t.status){let r=403===t.status;return{kind:"error",error:new lH(r?lU.ClientHttpForbidden:lU.ClientHttpAuthentication,`Version negotiation failed: ${r?"the server denied access (HTTP 403)":"the server requires authorization (HTTP 401)"}`,{status:t.status,statusText:t.statusText,text:t.body})}}if(t.status>=500)return{kind:"error",error:new lH(lU.EraNegotiationFailed,`Version negotiation failed: the server answered the probe with HTTP ${t.status}`,{status:t.status,statusText:t.statusText,text:t.body})};let o=function(t){let r;if(void 0===t||""===t)return;try{r=JSON.parse(t)}catch{return}if("object"!=typeof r||null===r)return;let o=r.error;if("object"!=typeof o||null===o)return;let{code:i,message:a,data:n}=o;if("number"==typeof i)return{code:i,message:"string"==typeof a?a:"",data:n}}(t.body);return void 0!==o?pZ(o,r):{kind:"legacy"}}(t,r);case"network-error":return pW(t.error,r);case"auth-required":return{kind:"error",error:t.error};case"closed":if("stdio"===r.transportKind)return{kind:"legacy"};return pW(Error("Connection closed during the version negotiation probe"),r);case"timeout":if("stdio"===r.transportKind)return{kind:"legacy"};return{kind:"error",error:new lV(lU.RequestTimeout,`Version negotiation probe timed out after ${t.timeoutMs}ms`,{timeout:t.timeoutMs})}}}(d,{clientModernVersions:n,requestedVersion:o,fallbackAvailable:s,environment:r.environment,transportKind:r.transportKind});switch(p.kind){case"modern":return{era:"modern",version:p.version,discover:p.discover};case"corrective":if(c)throw p.error;c=!0,o=p.version;continue;case"legacy":{let o="closed"===d.kind?"the connection closed during the server/discover probe":void 0;if("pin"===t.kind)throw new lV(lU.EraNegotiationFailed,void 0===o?`Version negotiation failed: the server did not offer pinned protocol version ${t.version} via server/discover (no fallback in pin mode)`:`Version negotiation failed: ${o} before the server offered pinned protocol version ${t.version} (no fallback in pin mode)`);if(!t.fallbackAvailable)throw new lV(lU.EraNegotiationFailed,void 0===o?"Version negotiation failed: the server gave no modern evidence and this client supports no pre-2026-07-28 protocol version to fall back to":`Version negotiation failed: ${o} and this client supports no pre-2026-07-28 protocol version to fall back to`);if(void 0!==o&&!0!==r.disposableProbe)throw new lV(lU.EraNegotiationFailed,`Version negotiation failed: ${o} (this transport probed in place — the disposable sibling probe requires the SDK's base StdioClientTransport)`);return{era:"legacy"}}case"error":throw p.error}}};try{o=await c()}catch(t){throw l.detach(),t}return l.release(),o}async function p1(t,r,o,i){let a,n,s=new r.constructor({...o,stderr:"ignore"}),l=r.close,c=!1,u=new Promise((t,r)=>{a=()=>r(p2())});r.close=async function(){return c=!0,a?.(),l.call(r)};try{let r=p0(t,{...i,transport:s,transportKind:"stdio",disposableProbe:!0});r.catch(()=>{}),n=await Promise.race([r,u])}finally{await p9(s),r.close=l}if(c)throw p2();return n}function p2(){return new lV(lU.EraNegotiationFailed,"Version negotiation failed: the transport was closed during the server/discover probe")}async function p9(t){try{let r=t._dispose;await ("function"==typeof r?r.call(t):t.close())}catch{}}function p4(t){let r=t._meta?.[aF];return c7.Implementation(r)?r:void 0}let p5={"notifications/tools/list_changed":["tools/list"],"notifications/prompts/list_changed":["prompts/list"],"notifications/resources/list_changed":["resources/list","resources/templates/list"]};var p3=class extends ua{_serverCapabilities;_serverVersion;_capabilities;_instructions;_jsonSchemaValidator;_cache;_defaultCacheTtlMs;_listMaxPages;_listChangedDebounceTimers=new Map;_listChangedConfig;_enforceStrictCapabilities;_versionNegotiation;_supportedProtocolVersionsOption;_inputRequiredDriverConfig;_listenState=new Map;_nextListenId=0;_autoOpenedSubscription;_discoverResult;_resetConnectionState(){if(this._negotiatedProtocolVersion=void 0,this._serverCapabilities=void 0,this._serverVersion=void 0,this._instructions=void 0,this._discoverResult=void 0,this._autoOpenedSubscription=void 0,this._listenState.size>0){let t=new lV(lU.ConnectionClosed,"subscriptions/listen: client reconnected or closed; subscription state from the previous connection was reset");for(let r of this._listenState.values())r.settle({cause:"remote",error:t})}for(let t of(this._listenState.clear(),this._listChangedDebounceTimers.values()))clearTimeout(t);this._listChangedDebounceTimers.clear(),this._cache.resetForReconnect()}async close(){try{await super.close()}finally{this._resetConnectionState()}}constructor(t,r){super(r),this._clientInfo=t,this._capabilities=r?.capabilities?{...r.capabilities}:{},this._jsonSchemaValidator=r?.jsonSchemaValidator??new d4,this._enforceStrictCapabilities=r?.enforceStrictCapabilities??!1,this._versionNegotiation=r?.versionNegotiation,this._supportedProtocolVersionsOption=r?.supportedProtocolVersions,this._inputRequiredDriverConfig=function(t){return{autoFulfill:t?.autoFulfill??!0,maxRounds:t?.maxRounds??10}}(r?.inputRequired),this._cache=new pH(r?.responseCacheStore??new pD,r?.responseCacheStore!==void 0,t=>this._reportStoreError(t),r?.cachePartition??""),this._defaultCacheTtlMs=r?.defaultCacheTtlMs??0,this._listMaxPages=r?.listMaxPages??64,r?.listChanged&&(this._listChangedConfig=r.listChanged)}buildContext(t,r){return t}_shouldDropInbound(t){let r;if(void 0!==this._negotiatedProtocolVersion&&this._negotiatedProtocolVersion>=lF&&(r=t,ne.safeParse(r).success))return"drop"}_outboundMetaEnvelope(){let t=this._negotiatedProtocolVersion;if(void 0!==t)return this._wireCodec().outboundEnvelope({protocolVersion:t,clientInfo:this._clientInfo,clientCapabilities:this._capabilities})}_resolveNonCompleteResult(t,r){return this._inputRequiredDriverConfig.autoFulfill?function(t,r,o,i){let{codec:a,request:n,options:s,flowStartedAt:l}=i,c={inputRequests:o.inputRequests,...void 0!==o.requestState&&{requestState:o.requestState}};return c5({config:r,method:n.method,originalParams:n.params,firstPayload:c,flowStartedAt:l,signal:s?.signal,requestOptions:{...s?.timeout!==void 0&&{timeout:s.timeout},...s?.maxTotalTimeout!==void 0&&{maxTotalTimeout:s.maxTotalTimeout},...s?.onprogress!==void 0&&{onprogress:s.onprogress}},hooks:{dispatchInputRequest:(r,o,i)=>uc(t,a,r,o,i),retry:(t,r)=>{var o,a;return i.retry(t,(o=s,a=r,{...o?.signal!==void 0&&{signal:o.signal},...o?.onprogress!==void 0&&{onprogress:o.onprogress},...o?.resetTimeoutOnProgress!==void 0&&{resetTimeoutOnProgress:o.resetTimeoutOnProgress},...o?.headers!==void 0&&{headers:o.headers},...void 0!==a.timeout&&{timeout:a.timeout},...void 0!==a.maxTotalTimeout&&{maxTotalTimeout:a.maxTotalTimeout},allowInputRequired:!0}))}}})}({getRequestHandler:t=>this._getRequestHandler(t),buildContext:t=>this.buildContext(t,void 0),sessionId:this.transport?.sessionId},this._inputRequiredDriverConfig,t,r):Promise.reject(new lV(lU.UnsupportedResultType,`Unsupported result type 'input_required' for ${r.request.method}: multi-round-trip auto-fulfilment is not enabled on this instance — pass allowInputRequired: true to handle it manually, or enable inputRequired.autoFulfill`,{resultType:"input_required",method:r.request.method}))}_setupListChangedHandlers(t){t.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools","notifications/tools/list_changed",t.tools,async()=>(await this.listTools(void 0,{cacheMode:"refresh"})).tools),t.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts","notifications/prompts/list_changed",t.prompts,async()=>(await this.listPrompts(void 0,{cacheMode:"refresh"})).prompts),t.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources","notifications/resources/list_changed",t.resources,async()=>(await this.listResources(void 0,{cacheMode:"refresh"})).resources)}registerCapabilities(t){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=function(t,r){let o={...t};for(let t in r){let i=r[t];if(void 0===i)continue;let a=o[t];o[t]=un(a)&&un(i)?{...a,...i}:i}return o}(this._capabilities,t)}setVersionNegotiation(t){if(this.transport)throw Error("Cannot configure version negotiation after connecting to transport");this._versionNegotiation=t}_wrapHandler(t,r){return"elicitation/create"===t?async(t,o)=>{let i=cT(this._negotiatedProtocolVersion),a=i.validateRequest("elicitation/create",t);if(a.ok||"not-in-era"!==a.reason||(a=i.validateInputRequest("elicitation/create",t)),!a.ok)throw new cc("not-in-era"===a.reason?cl.InternalError:cl.InvalidParams,"not-in-era"===a.reason?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation request: ${a.message}`);let{params:n}=a.value;n.mode=n.mode??"form";let{supportsFormMode:s,supportsUrlMode:l}=function(t){if(!t)return{supportsFormMode:!1,supportsUrlMode:!1};let r=void 0!==t.form,o=void 0!==t.url;return{supportsFormMode:r||!r&&!o,supportsUrlMode:o}}(this._capabilities.elicitation);if("form"===n.mode&&!s)throw new cc(cl.InvalidParams,"Client does not support form-mode elicitation requests");if("url"===n.mode&&!l)throw new cc(cl.InvalidParams,"Client does not support URL-mode elicitation requests");let c=await r(t,o),u=i.validateResult("elicitation/create",c);if(u.ok||"not-in-era"!==u.reason||(u=i.validateInputResponse("elicitation/create",c)),!u.ok)throw new cc("not-in-era"===u.reason?cl.InternalError:cl.InvalidParams,"not-in-era"===u.reason?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation result: ${u.message}`);let d=u.value,p="form"===n.mode?n.requestedSchema:void 0;if("form"===n.mode&&"accept"===d.action&&d.content&&p&&this._capabilities.elicitation?.form?.applyDefaults)try{!function t(r,o){if(r&&null!==o&&"object"==typeof o){if("object"===r.type&&r.properties&&"object"==typeof r.properties){let i=r.properties;for(let r of Object.keys(i)){let a=i[r];void 0===o[r]&&Object.prototype.hasOwnProperty.call(a,"default")&&(o[r]=a.default),void 0!==o[r]&&t(a,o[r])}}if(Array.isArray(r.anyOf))for(let i of r.anyOf)"boolean"!=typeof i&&t(i,o);if(Array.isArray(r.oneOf))for(let i of r.oneOf)"boolean"!=typeof i&&t(i,o)}}(p,d.content)}catch{}return d}:"sampling/createMessage"===t?async(t,o)=>{let i=cT(this._negotiatedProtocolVersion),a=i.validateRequest("sampling/createMessage",t);if(a.ok||"not-in-era"!==a.reason||(a=i.validateInputRequest("sampling/createMessage",t)),!a.ok)throw new cc("not-in-era"===a.reason?cl.InternalError:cl.InvalidParams,"not-in-era"===a.reason?"No wire schema for sampling/createMessage in the resolved era":`Invalid sampling request: ${a.message}`);let{params:n}=a.value,s=await r(t,o),l=!!(n.tools||n.toolChoice),c=i.samplingResultVariant(l,s);if(c.ok||"not-in-era"!==c.reason||(c=i.validateInputResponse("sampling/createMessage",s)),!c.ok)throw new cc("not-in-era"===c.reason?cl.InternalError:cl.InvalidParams,"not-in-era"===c.reason?"No result schema for sampling/createMessage in the resolved era":`Invalid sampling result: ${c.message}`);return c.value}:r}assertCapability(t,r){if(!this._serverCapabilities?.[t])throw new lV(lU.CapabilityNotSupported,`Server does not support ${t} (required for ${r})`)}async connect(t,r){if(r?.prior!=null)return this._connectFromPrior(t,function(t){if("object"==typeof t&&null!==t&&("legacy"===t.kind&&!("supportedVersions"in t)&&!("discover"in t)||"modern"===t.kind&&nP.safeParse(t.discover).success))return t;throw new lV(lU.EraNegotiationFailed,"connect({ prior }): unrecognized prior — expected { kind: 'modern', discover } or { kind: 'legacy' }")}(r.prior),r);let o=function(t,r){let o=t?.mode??"legacy";if("legacy"===o)return{kind:"legacy"};let i=t?.probe??{};if("object"==typeof o){if(!(o.pin>=lF))throw TypeError(`versionNegotiation: { pin: '${o.pin}' } is not a modern protocol revision — pinning is for 2026-07-28 and later; omit versionNegotiation (or use mode: 'legacy') for 2025-era servers.`);return{kind:"pin",version:o.pin,probe:i}}let a=r?lZ(r):[];return{kind:"auto",modernVersions:a.length>0?a:[...lK],fallbackAvailable:!r||lJ(r).length>0,probe:i}}(this._versionNegotiation,this._supportedProtocolVersionsOption);return"legacy"!==o.kind?this._connectNegotiated(t,o,r):this._connectPlainLegacy(t,r)}async _connectPlainLegacy(t,r){if(await super.connect(t),void 0!==t.sessionId){let r=this._negotiatedProtocolVersion;void 0!==r&&t.setProtocolVersion?.(r);return}this._resetConnectionState(),await this._legacyHandshake(t,r)}async _legacyHandshake(t,r){let o=lJ(this._supportedProtocolVersions);try{let i=o[0];if(void 0===i)throw new lV(lU.EraNegotiationFailed,"Cannot run the initialize handshake: supportedProtocolVersions contains no pre-2026-07-28 protocol version");let a=await this.request({method:"initialize",params:{protocolVersion:i,capabilities:this._capabilities,clientInfo:this._clientInfo}},r);if(void 0===a)throw Error(`Server sent invalid initialize result: ${a}`);if(!o.includes(a.protocolVersion))throw Error(`Server's protocol version is not supported: ${a.protocolVersion}`);this._serverCapabilities=a.capabilities,this._serverVersion=a.serverInfo,this._cache.setServerIdentity(this._deriveServerIdentity(t)),t.setProtocolVersion&&t.setProtocolVersion(a.protocolVersion),this._instructions=a.instructions,await this.notification({method:"notifications/initialized"}),this._negotiatedProtocolVersion=a.protocolVersion,this._listChangedConfig&&this._setupListChangedHandlers(this._listChangedConfig)}catch(t){throw this.close(),t}}async _connectNegotiated(t,r,o){let i;if(void 0!==t.sessionId){await super.connect(t);let r=this._negotiatedProtocolVersion;void 0!==r&&t.setProtocolVersion&&t.setProtocolVersion(r);return}this._resetConnectionState();try{let a=pG(t),n={clientInfo:this._clientInfo,capabilities:this._capabilities,environment:pB(),defaultTimeoutMs:o?.timeout??6e4},s="stdio"===a?function(t){let r=Object.getPrototypeOf(t);if(null===r||!Object.prototype.hasOwnProperty.call(r,"_dispose"))return;let o=t._serverParams;return"object"==typeof o&&null!==o&&"string"==typeof o.command?o:void 0}(t):void 0;i=void 0===s?await p0(r,{...n,transport:t,transportKind:a}):await p1(r,t,s,n)}catch(r){throw await t.close().catch(()=>{}),pQ(t),r}if(pQ(t),await super.connect(t),"legacy"===i.era)return void await this._legacyHandshake(t,o);if(this._serverCapabilities=i.discover.capabilities,this._serverVersion=p4(i.discover),this._cache.setServerIdentity(this._deriveServerIdentity(t)),this._instructions=i.discover.instructions,this._discoverResult=i.discover,this._negotiatedProtocolVersion=i.version,t.setProtocolVersion&&t.setProtocolVersion(i.version),this._listChangedConfig){let t=this._listChangedConfig,r=this._serverCapabilities,i={...t.tools&&r?.tools?.listChanged&&{tools:t.tools},...t.prompts&&r?.prompts?.listChanged&&{prompts:t.prompts},...t.resources&&r?.resources?.listChanged&&{resources:t.resources}},a=!0;try{this._setupListChangedHandlers(i)}catch(t){a=!1,this.onerror?.(t instanceof Error?t:Error(String(t)))}let n=a?{...i.tools&&{toolsListChanged:!0},...i.prompts&&{promptsListChanged:!0},...i.resources&&{resourcesListChanged:!0}}:{};if(Object.keys(n).length>0){let t=new AbortController,r=()=>t.abort(o?.signal?.reason);o?.signal?.aborted&&r(),o?.signal?.addEventListener("abort",r);try{this._autoOpenedSubscription=await this.listen(n,{timeout:o?.timeout,signal:t.signal})}catch(t){if(o?.signal?.aborted)throw await this.close().catch(()=>{}),t;this.onerror?.(t instanceof Error?t:Error(String(t)))}finally{o?.signal?.removeEventListener("abort",r)}}}}async _connectFromPrior(t,r,o){if("legacy"===r.kind)return this._connectPlainLegacy(t,o);let i=r.discover;this._resetConnectionState();let a=this._supportedProtocolVersionsOption,n=(a&&lZ(a).length>0?lZ(a):lK).find(t=>i.supportedVersions.includes(t));if(void 0===n)throw new lV(lU.EraNegotiationFailed,"connect({ prior }) with a modern verdict requires a 2026-07-28+ mutual protocol version; the supplied DiscoverResult and this client's supportedProtocolVersions have no modern overlap. For a server known to be legacy, pass prior: { kind: 'legacy' } to skip the probe and initialize directly, or use versionNegotiation: { mode: 'auto' } to re-probe with legacy fallback.");if(await super.connect(t),this._discoverResult=i,this._serverCapabilities=i.capabilities,this._serverVersion=p4(i),this._cache.setServerIdentity(this._deriveServerIdentity(t)),this._instructions=i.instructions,this._negotiatedProtocolVersion=n,t.setProtocolVersion?.(n),this._listChangedConfig)try{this._setupListChangedHandlers(this._listChangedConfig)}catch(t){this.onerror?.(t instanceof Error?t:Error(String(t)))}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}_deriveServerIdentity(t){let r=this._serverVersion;return void 0!==r?`${r.name}@${r.version}`:t.sessionId??`anonymous:${Date.now()}-${Math.random().toString(36).slice(2)}`}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}getProtocolEra(){let t=this._negotiatedProtocolVersion;if(void 0!==t)return t>=lF?"modern":"legacy"}getInstructions(){return this._instructions}getDiscoverResult(){return this._discoverResult}assertCapabilityForMethod(t){switch(t){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new lV(lU.CapabilityNotSupported,`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new lV(lU.CapabilityNotSupported,`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new lV(lU.CapabilityNotSupported,`Server does not support resources (required for ${t})`);if("resources/subscribe"===t&&!this._serverCapabilities.resources.subscribe)throw new lV(lU.CapabilityNotSupported,`Server does not support resource subscriptions (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new lV(lU.CapabilityNotSupported,`Server does not support tools (required for ${t})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new lV(lU.CapabilityNotSupported,`Server does not support completions (required for ${t})`)}}assertNotificationCapability(t){if("notifications/roots/list_changed"===t&&!this._capabilities.roots?.listChanged)throw new lV(lU.CapabilityNotSupported,`Client does not support roots list changed notifications (required for ${t})`)}assertRequestHandlerCapability(t){switch(t){case"sampling/createMessage":if(!this._capabilities.sampling)throw new lV(lU.CapabilityNotSupported,`Client does not support sampling capability (required for ${t})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new lV(lU.CapabilityNotSupported,`Client does not support elicitation capability (required for ${t})`);break;case"roots/list":if(!this._capabilities.roots)throw new lV(lU.CapabilityNotSupported,`Client does not support roots capability (required for ${t})`)}}async ping(t){return this.request({method:"ping"},t)}async discover(t){let r=await this._requestWithSchema({method:"server/discover"},nP,t);return this._discoverResult=r,r}async complete(t,r){return this.request({method:"completion/complete",params:t},r)}async setLoggingLevel(t,r){return this.request({method:"logging/setLevel",params:{level:t}},r)}async getPrompt(t,r){return this.request({method:"prompts/get",params:t},r)}async listPrompts(t,r){if(!this._serverCapabilities?.prompts&&!this._enforceStrictCapabilities)return console.debug("Client.listPrompts() called but server does not advertise prompts capability - returning empty list"),{prompts:[]};if(t?.cursor!==void 0)return this.request({method:"prompts/list",params:t},r);let o=await this._serveFromCache("prompts/list",void 0,r);return void 0!==o?o:this._listAllPages("prompts/list",t,r,(t,r)=>t.prompts.push(...r.prompts))}async listResources(t,r){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResources() called but server does not advertise resources capability - returning empty list"),{resources:[]};if(t?.cursor!==void 0)return this.request({method:"resources/list",params:t},r);let o=await this._serveFromCache("resources/list",void 0,r);return void 0!==o?o:this._listAllPages("resources/list",t,r,(t,r)=>t.resources.push(...r.resources))}async listResourceTemplates(t,r){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResourceTemplates() called but server does not advertise resources capability - returning empty list"),{resourceTemplates:[]};if(t?.cursor!==void 0)return this.request({method:"resources/templates/list",params:t},r);let o=await this._serveFromCache("resources/templates/list",void 0,r);return void 0!==o?o:this._listAllPages("resources/templates/list",t,r,(t,r)=>t.resourceTemplates.push(...r.resourceTemplates))}async _listAllPages(t,r,o,i,a){let n=o?.cacheMode==="bypass",s=this._cache.captureGeneration(t),l=await this.request({method:t,...r&&{params:{...r}}},o),c=l.nextCursor,u=new Set,d=1;for(;void 0!==c&&!u.has(c);){if(0!==this._listMaxPages&&d>=this._listMaxPages)throw new lV(lU.ListPaginationExceeded,`${t}: exceeded listMaxPages (${this._listMaxPages}); server pagination did not terminate`,{method:t,listMaxPages:this._listMaxPages});u.add(c);let a=await this.request({method:t,params:{...r,cursor:c}},o);i(l,a),c=a.nextCursor,d++}return delete l.nextCursor,a?.(l),n||await this._cache.write(t,l,s,this._freshness(l)),l}_freshness(t,r){let o="number"==typeof t.ttlMs?t.ttlMs:this._defaultCacheTtlMs,i="public"===t.cacheScope?"public":"private";return{expiresAt:this._cache.now()+Math.min(Math.max(0,o),864e5),scope:i,params:r}}async _serveFromCache(t,r,o){if(o?.cacheMode==="bypass"||o?.cacheMode==="refresh")return;let i=await this._cache.read(t,r).catch(t=>void this._reportStoreError(t));if(void 0!==i){if(o?.signal?.aborted){let t=o.signal.reason;throw t instanceof lV?t:new lV(lU.RequestTimeout,String(t))}return i.value}}_reportStoreError(t){this.onerror?.(t instanceof Error?t:Error(String(t)))}_compileOutputValidator(t){if(t.outputSchema)try{return{ok:!0,validator:this._jsonSchemaValidator.getValidator(t.outputSchema)}}catch(t){return{ok:!1,compileError:t}}}async _resolveXMcpHeaderScan(t,r){let o=r??await this._cache.toolDefinition(t);return void 0===o?void 0:cU(o.inputSchema)}async readResource(t,r){let o=await this._serveFromCache("resources/read",t.uri,r);if(void 0!==o)return o;let i=this._cache.captureGeneration("resources/read",t.uri),a=await this.request({method:"resources/read",params:t},r);if(r?.cacheMode!=="bypass"){let o=this._freshness(a,t.uri);o.expiresAt>this._cache.now()?await this._cache.write("resources/read",a,i,o):r?.cacheMode==="refresh"&&await this._cache.evictKey("resources/read",t.uri)}return a}async subscribeResource(t,r){return this.request({method:"resources/subscribe",params:t},r)}async unsubscribeResource(t,r){return this.request({method:"resources/unsubscribe",params:t},r)}async listen(t,r){let o,i,a,n,s;if(void 0===this.transport)throw new lV(lU.NotConnected,"Not connected");let l=this._negotiatedProtocolVersion;if(void 0===l||!(l>=lF))throw new lV(lU.MethodNotSupportedByProtocolVersion,`subscriptions/listen requires a 2026-07-28-era connection (negotiated: ${l??"none"}). On a 2025-era connection, change notifications are delivered unsolicited: use ClientOptions.listChanged and resources/subscribe instead.`,{method:"subscriptions/listen",protocolVersion:l});if(r?.signal?.aborted){let t=r.signal.reason;throw t instanceof lV?t:new lV(lU.RequestTimeout,String(t))}let c=new AbortController,u=`listen:${this._nextListenId++}`,d="opening",p=new Promise((t,r)=>{a=t,n=r}),h=new Promise(t=>{s=t}),m=t=>{if("closed"===d)return;let l="opening"===d;if(void 0!==o&&(clearTimeout(o),o=void 0),"ack"in t){d="open",a(t.ack);return}d="closed",void 0!==i&&r?.signal?.removeEventListener("abort",i),this._listenState.delete(u),c.abort(),s(t.cause),l&&n(t.error??new lV(lU.ConnectionClosed,"subscriptions/listen closed before the server acknowledged"))},f=async()=>{c.abort(),await this.notification({method:"notifications/cancelled",params:{requestId:u}}).catch(()=>{})},y=async()=>{"closed"!==d&&(m({cause:"local"}),await f())};this._listenState.set(u,{settle:m});let g=r?.timeout??6e4;if(o=setTimeout(()=>{m({cause:"remote",error:new lV(lU.RequestTimeout,"subscriptions/listen ack timed out",{timeout:g})}),f().catch(()=>{})},g),r?.signal){let t=r.signal;i=()=>{if("closed"===d)return;let r=t.reason;m({cause:"local",error:r instanceof Error?r:Error(String(r??"Aborted"))}),f().catch(()=>{})},t.addEventListener("abort",i,{once:!0})}let v={jsonrpc:"2.0",id:u,method:"subscriptions/listen",params:{_meta:{...this._outboundMetaEnvelope()},notifications:t}};try{await this.transport.send(v,{requestSignal:c.signal,onRequestStreamEnd:()=>m({cause:"remote",error:Error("subscriptions/listen: stream ended")})})}catch(t){m({cause:"remote",error:t instanceof Error?t:Error(String(t))})}return{honoredFilter:await p,close:y,closed:h}}get autoOpenedSubscription(){return this._autoOpenedSubscription}_onnotification(t,r){let o=Object.hasOwn(p5,t.method)?p5[t.method]:void 0;if("notifications/resources/updated"===t.method){let r=t.params?.uri;"string"==typeof r&&this._cache.evictKey("resources/read",r)}else if(void 0!==o)for(let t of o)this._cache.evict(t);if("notifications/subscriptions/acknowledged"===t.method){let r=t.params?._meta?.[aJ],o="string"==typeof r?this._listenState.get(r):void 0;if(void 0!==o){let r=this._wireCodec().validateNotification("notifications/subscriptions/acknowledged",t);o.settle({ack:r.ok?r.value.params.notifications:{}});return}}if("notifications/cancelled"===t.method){let r=t.params?.requestId,o="string"==typeof r?this._listenState.get(r):void 0;if(void 0!==o)return void o.settle({cause:"remote",error:Error("subscriptions/listen: server cancelled the subscription")})}super._onnotification(t,r)}_onresponse(t){let r=t.id,o="string"==typeof r?this._listenState.get(r):void 0;void 0!==o?cz(t)?o.settle({cause:"remote",error:cc.fromError(t.error.code,t.error.message,t.error.data)}):o.settle({cause:"graceful",error:new lV(lU.ConnectionClosed,"subscriptions/listen: server closed the subscription gracefully before acknowledging")}):super._onresponse(t)}_onclose(){if(this._listenState.size>0){let t=new lV(lU.ConnectionClosed,"Connection closed");for(let r of this._listenState.values())r.settle({cause:"remote",error:t});this._listenState.clear()}super._onclose()}async callTool(t,r){let o,i="modern"===this.getProtocolEra()&&"browser"!==pB(),a=async()=>{let o;if(!i)return r;try{o=await this._resolveXMcpHeaderScan(t.name,r?.toolDefinition)}catch(t){this._reportStoreError(t)}if(!o?.valid||0===o.declarations.length)return r;let a=function(t,r){let o={};for(let i of t){let t=function(t,r){let o=t;for(let t of r){if(null===o||"object"!=typeof o)return;o=o[t]}return o}(r,i.path);if(null==t)continue;let a=function(t){if("string"==typeof t)return t;if("boolean"==typeof t)return t?"true":"false";if("number"==typeof t){if(!Number.isFinite(t)||Number.isInteger(t)&&!Number.isSafeInteger(t))return;return String(t)}}(t);void 0!==a&&(o[`Mcp-Param-${i.headerName}`]=cJ(a))}return o}(o.declarations,t.arguments);return 0===Object.keys(a).length?r:{...r,headers:{...r?.headers,...a}}},n=r?.toolDefinition===void 0?await this._cache.outputValidator(t.name,t=>this._compileOutputValidator(t)).catch(t=>void this._reportStoreError(t)):this._compileOutputValidator(r.toolDefinition),s=()=>{if(void 0===n||n.ok)return;let r=n.compileError,o=(r instanceof Error?r.message:String(r)).slice(0,200);throw new cc(cl.InvalidParams,`Tool '${t.name}' has an invalid outputSchema: ${o}`)};s();try{o=await this.request({method:"tools/call",params:t},await a())}catch(u){let l=u instanceof cc&&-32020===u.code;if(!i||!l||r?.toolDefinition!==void 0)throw u;let c={signal:r?.signal,timeout:r?.timeout,cacheMode:"refresh"};await this._cache.evict("tools/list"),await this.listTools(void 0,c).catch(t=>this._reportStoreError(t)),n=await this._cache.outputValidator(t.name,t=>this._compileOutputValidator(t)).catch(t=>void this._reportStoreError(t)),s(),o=await this.request({method:"tools/call",params:t},await a())}let l=void 0!==n&&n.ok?n.validator:void 0;if(l){if(void 0===o.structuredContent&&!o.isError)throw new cc(cl.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`);if(void 0!==o.structuredContent&&!o.isError)try{let t=l(o.structuredContent);if(!t.valid)throw new cc(cl.InvalidParams,`Structured content does not match the tool's output schema: ${t.errorMessage}`)}catch(t){if(t instanceof cc)throw t;throw new cc(cl.InvalidParams,`Failed to validate structured content: ${t instanceof Error?t.message:String(t)}`)}}return o}async listTools(t,r){if(!this._serverCapabilities?.tools&&!this._enforceStrictCapabilities)return console.debug("Client.listTools() called but server does not advertise tools capability - returning empty list"),{tools:[]};if(t?.cursor!==void 0){let o=await this.request({method:"tools/list",params:t},r);return this._excludeInvalidXMcpHeaderTools(o),o}let o=await this._serveFromCache("tools/list",void 0,r);return void 0!==o?o:this._listAllPages("tools/list",t,r,(t,r)=>t.tools.push(...r.tools),t=>this._excludeInvalidXMcpHeaderTools(t))}_excludeInvalidXMcpHeaderTools(t){if("modern"!==this.getProtocolEra()||!this.transport||"stdio"===pG(this.transport))return;let r=t.tools.filter(t=>{let r=cU(t.inputSchema);return!!r.valid||(console.warn(`[mcp-sdk] excluding tool '${t.name}' from tools/list: invalid x-mcp-header declaration — ${r.reason}`),!1)});r.length!==t.tools.length&&(t.tools=r)}_setupListChangedHandler(t,r,o,i){let a=im(sS,o);if(!a.success)throw Error(`Invalid ${t} listChanged options: ${a.error.message}`);if("function"!=typeof o.onChanged)throw TypeError(`Invalid ${t} listChanged options: onChanged must be a function`);let{autoRefresh:n,debounceMs:s}=a.data,{onChanged:l}=o,c=async()=>{if(!n)return void l(null,null);try{l(null,await i())}catch(t){l(t instanceof Error?t:Error(String(t)),null)}},u=()=>{if(s){let r=this._listChangedDebounceTimers.get(t);r&&clearTimeout(r);let o=setTimeout(c,s);this._listChangedDebounceTimers.set(t,o)}else c()};this.setNotificationHandler(r,u)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};(class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SseError"})}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,o){super(`SSE error: ${r}`),this.code=t,this.event=o,lq(this,new.target)}});let p6={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},p8=new Set(["authorization","content-type","mcp-protocol-version","mcp-method","mcp-name","mcp-session-id"]);function p7(t,r){if("function"==typeof AbortSignal.any)return AbortSignal.any([t,r]);let o=new AbortController;if(t.aborted)return o.abort(t.reason),o.signal;if(r.aborted)return o.abort(r.reason),o.signal;let i=()=>{t.removeEventListener("abort",a),r.removeEventListener("abort",n)};function a(){i(),o.abort(t.reason)}function n(){i(),o.abort(r.reason)}return t.addEventListener("abort",a,{once:!0}),r.addEventListener("abort",n,{once:!0}),o.signal}var he=class{_abortController;_url;_resourceMetadataUrl;_scope;_requestInit;_authProvider;_oauthProvider;_skipIssuerMetadataValidation;_fetch;_fetchWithInit;_sessionId;_reconnectionOptions;_protocolVersion;_onInsufficientScope;_maxStepUpRetries;_serverRetryMs;_reconnectionScheduler;_cancelReconnection;onclose;onerror;onmessage;hasPerRequestStream=!0;constructor(t,r){this._url=t,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r?.requestInit,this._skipIssuerMetadataValidation=r?.skipIssuerMetadataValidation,function(t){return null!=t&&"function"==typeof t.tokens&&"function"==typeof t.clientInformation}(r?.authProvider)?(this._oauthProvider=r.authProvider,this._authProvider=function(t,r){return{token:async()=>(await t.tokens())?.access_token,onUnauthorized:async o=>ph(t,o,r)}}(r.authProvider,{skipIssuerMetadataValidation:r.skipIssuerMetadataValidation})):this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=function(t=fetch,r){return r?async(o,i)=>t(o,{...r,...i,headers:i?.headers?{...up(r.headers),...up(i.headers)}:r.headers}):t}(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._protocolVersion=r?.protocolVersion,this._reconnectionOptions=r?.reconnectionOptions??p6,this._reconnectionScheduler=r?.reconnectionScheduler,this._onInsufficientScope=r?.onInsufficientScope??"reauthorize",this._maxStepUpRetries=Math.max(0,r?.maxStepUpRetries??1)}async _stepUpAuthorize(t,r){try{return await this._stepUpAuthorizeInner(t,r)}catch(t){throw pK(t)}}async _stepUpAuthorizeInner(t,r){if("throw"===this._onInsufficientScope||!this._oauthProvider)throw new pu({requiredScope:t.scope,resourceMetadataUrl:t.resourceMetadataUrl,errorDescription:t.errorDescription});if(r>=this._maxStepUpRetries)throw new lH(lU.ClientHttpForbidden,`Server returned 403 insufficient_scope after step-up re-authorization (retry limit ${this._maxStepUpRetries} reached)`,{status:403,statusText:t.statusText??"Forbidden",text:t.text});t.resourceMetadataUrl&&(this._resourceMetadataUrl=t.resourceMetadataUrl);let o=await this._oauthProvider.tokens(),i=pg(this._scope,o?.scope,t.scope);this._scope=i;let a=function(t,r){if(!t)return!1;let o=new Set((r??"").split(/\s+/).filter(Boolean));for(let r of t.split(/\s+/))if(r&&!o.has(r))return!0;return!1}(i,o?.scope);return p$(this._oauthProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:i,forceReauthorization:a,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})}async _commonHeaders(){let t,r={};try{t=await this._authProvider?.token()}catch(t){throw pK(t)}t&&(r.Authorization=`Bearer ${t}`),this._sessionId&&(r["mcp-session-id"]=this._sessionId),this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);let o=up(this._requestInit?.headers);return new Headers({...r,...o})}_applyBodyDerivedHeaders(t,r){let o;if(Array.isArray(r)||(o=r,!ne.safeParse(o).success))return;let i=r.params?._meta?.[aV];if("string"!=typeof i)return;t.set("mcp-protocol-version",i),t.set("mcp-method",r.method);let a=r.params,n="resources/read"===r.method?"string"==typeof a?.uri?a.uri:void 0:"string"==typeof a?.name?a.name:void 0;void 0!==n&&t.set("mcp-name",cJ(n))}_isModernEnvelopedRequest(t){let r;if(Array.isArray(t)||(r=t,!ne.safeParse(r).success))return!1;let o=t.params?._meta?.[aV];return"string"==typeof o&&o>=lF}async _startOrAuthSse(t,r=!1,o=0){let{resumptionToken:i,requestSignal:a}=t,n=()=>this._abortController?.signal.aborted===!0||a?.aborted===!0;try{let n=await this._commonHeaders(),s=[...n.get("accept")?.split(",").map(t=>t.trim().toLowerCase())??[],"text/event-stream"];n.set("accept",[...new Set(s)].join(", ")),i&&n.set("last-event-id",i);let l=this._abortController?.signal,c=void 0!==a&&void 0!==l?p7(l,a):a??l,u=await (this._fetch??fetch)(this._url,{...this._requestInit,method:"GET",headers:n,signal:c});if(!u.ok){if(401===u.status&&this._authProvider){if(u.headers.has("www-authenticate")){let{resourceMetadataUrl:t,scope:r}=pE(u);this._resourceMetadataUrl=t,this._scope=pg(this._scope,r)}if(this._authProvider.onUnauthorized&&!r){try{await this._authProvider.onUnauthorized({response:u,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(t){throw pK(t)}return await u.text?.().catch(()=>{}),this._startOrAuthSse(t,!0,o)}if(await u.text?.().catch(()=>{}),r)throw pK(new lH(lU.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:u.statusText}));throw pK(new pm)}if(403===u.status){let{resourceMetadataUrl:i,scope:a,error:n,errorDescription:s}=pE(u);if("insufficient_scope"===n){let n=await u.text?.().catch(()=>null);if(await this._stepUpAuthorize({scope:a,resourceMetadataUrl:i,errorDescription:s,statusText:u.statusText,text:n},o)!=="AUTHORIZED")throw pK(new pm);return this._startOrAuthSse(t,r,o+1)}}if(await u.text?.().catch(()=>{}),405===u.status)return void t.onRequestStreamEnd?.();throw new lH(lU.ClientHttpFailedToOpenStream,`Failed to open SSE stream: ${u.statusText}`,{status:u.status,statusText:u.statusText})}this._handleSseStream(u.body,t,!0)}catch(t){throw n()||this.onerror?.(t),t}}_getNextReconnectionDelay(t){if(void 0!==this._serverRetryMs)return this._serverRetryMs;let r=this._reconnectionOptions.initialReconnectionDelay,o=this._reconnectionOptions.reconnectionDelayGrowFactor;return Math.min(r*Math.pow(o,t),this._reconnectionOptions.maxReconnectionDelay)}_scheduleReconnection(t,r=0){let o=this._reconnectionOptions.maxRetries;if(r>=o){this.onerror?.(Error(`Maximum reconnection attempts (${o}) exceeded.`)),t.onRequestStreamEnd?.();return}let i=this._getNextReconnectionDelay(r),a=()=>{this._cancelReconnection=void 0,this._abortController?.signal.aborted||t.requestSignal?.aborted||this._startOrAuthSse(t).catch(o=>{if(!(this._abortController?.signal.aborted||t.requestSignal?.aborted)){this.onerror?.(Error(`Failed to reconnect SSE stream: ${o instanceof Error?o.message:String(o)}`));try{this._scheduleReconnection(t,r+1)}catch(t){this.onerror?.(t instanceof Error?t:Error(String(t)))}}})};if(this._reconnectionScheduler){let t=this._reconnectionScheduler(a,i,r);this._cancelReconnection="function"==typeof t?t:void 0}else{let t=setTimeout(a,i);this._cancelReconnection=()=>clearTimeout(t)}}_handleSseStream(t,r,o){let i;if(!t)return void r.onRequestStreamEnd?.();let{onresumptiontoken:a,replayMessageId:n,requestSignal:s,onRequestStreamEnd:l}=r,c=()=>this._abortController?.signal.aborted===!0||s?.aborted===!0,u=!1,d=!1;(async()=>{try{let r=t.pipeThrough(new TextDecoderStream).pipeThrough(new pi({onRetry:t=>{this._serverRetryMs=t}})).getReader();for(;;){let{value:t,done:o}=await r.read();if(o)break;if((t.id&&(i=t.id,u=!0,a?.(t.id)),t.data)&&(!t.event||"message"===t.event))try{let r=ni.parse(JSON.parse(t.data));(cA(r)||cz(r))&&(d=!0,void 0!==n&&(r.id=n)),this.onmessage?.(r)}catch(t){this.onerror?.(t)}}(o||u)&&!d&&this._abortController&&!c()?this._scheduleReconnection({resumptionToken:i,onresumptiontoken:a,replayMessageId:n,requestSignal:s,onRequestStreamEnd:l},0):c()||l?.()}catch(t){if(c())return;if(this.onerror?.(Error(`SSE stream disconnected: ${t}`)),(o||u)&&!d&&this._abortController&&!c())try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:a,replayMessageId:n,requestSignal:s,onRequestStreamEnd:l},0)}catch(t){this.onerror?.(Error(`Failed to reconnect: ${t instanceof Error?t.message:String(t)}`)),l?.()}else l?.()}})()}async start(){if(this._abortController)throw Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(t,r){if(!this._oauthProvider)throw new pm("finishAuth requires an OAuthClientProvider");let{authorizationCode:o,iss:i}=await pv(t,r,this._oauthProvider,this._url,{fetchFn:this._fetchWithInit,resourceMetadataUrl:this._resourceMetadataUrl});if(await p$(this._oauthProvider,{serverUrl:this._url,authorizationCode:o,iss:i,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})!=="AUTHORIZED")throw new pm("Failed to authorize")}async close(){try{this._cancelReconnection?.()}finally{this._cancelReconnection=void 0,this._abortController?.abort(),this.onclose?.()}}async send(t,r){return this._send(t,r,!1)}async _send(t,r,o,i=0){try{let a,{resumptionToken:n,onresumptiontoken:s}=r||{};if(n){let o;return void this._startOrAuthSse({resumptionToken:n,replayMessageId:(o=t,ne.safeParse(o).success)?t.id:void 0,requestSignal:r?.requestSignal}).catch(t=>this.onerror?.(t))}let l=await this._commonHeaders();this._applyBodyDerivedHeaders(l,t);let c=Array.isArray(t)?t.some(t=>{let r;return r=t,n_.safeParse(r).success}):(a=t,n_.safeParse(a).success);if(c&&l.delete("mcp-session-id"),r?.headers!==void 0)for(let[t,o]of Object.entries(r.headers))p8.has(t.toLowerCase())||l.set(t,o);l.set("content-type","application/json");let u=[...l.get("accept")?.split(",").map(t=>t.trim().toLowerCase())??[],"application/json","text/event-stream"];l.set("accept",[...new Set(u)].join(", "));let d=this._abortController?.signal,p=r?.requestSignal!==void 0&&void 0!==d?p7(d,r.requestSignal):r?.requestSignal??d,h={...this._requestInit,method:"POST",headers:l,body:JSON.stringify(t),signal:p},m=await (this._fetch??fetch)(this._url,h);if(c&&m.ok&&(this._sessionId=m.headers.get("mcp-session-id")||void 0),!m.ok){if(401===m.status&&this._authProvider){if(m.headers.has("www-authenticate")){let{resourceMetadataUrl:t,scope:r}=pE(m);this._resourceMetadataUrl=t,this._scope=pg(this._scope,r)}if(this._authProvider.onUnauthorized&&!o){try{await this._authProvider.onUnauthorized({response:m,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(t){throw pK(t)}return await m.text?.().catch(()=>{}),this._send(t,r,!0,i)}if(await m.text?.().catch(()=>{}),o)throw pK(new lH(lU.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:m.statusText}));throw pK(new pm)}let a=await m.text?.().catch(()=>null);if(403===m.status){let{resourceMetadataUrl:n,scope:s,error:l,errorDescription:c}=pE(m);if("insufficient_scope"===l){if(await this._stepUpAuthorize({scope:s,resourceMetadataUrl:n,errorDescription:c,statusText:m.statusText,text:a},i)!=="AUTHORIZED")throw pK(new pm);return this._send(t,r,o,i+1)}}if(400===m.status&&"string"==typeof a&&this._isModernEnvelopedRequest(t))try{let r=ni.parse(JSON.parse(a)),o=(Array.isArray(t)?t:[t]).filter(t=>{let r;return r=t,ne.safeParse(r).success});if(cz(r)&&o.some(t=>t.id===r.id))return void this.onmessage?.(r)}catch{}throw new lH(lU.ClientHttpNotImplemented,`Error POSTing to endpoint: ${a}`,{status:m.status,statusText:m.statusText,text:a})}if(202===m.status){let r;await m.text?.().catch(()=>{}),r=t,nw.safeParse(r).success&&this._startOrAuthSse({resumptionToken:void 0}).catch(t=>this.onerror?.(t));return}let f=(Array.isArray(t)?t:[t]).some(t=>"method"in t&&"id"in t&&void 0!==t.id),y=m.headers.get("content-type"),g=function(t){if(t)try{return uu.parse(t).type}catch{let r=(t.split(";",1)[0]??"").trim().toLowerCase();if(""===r||t.slice(r.length).includes(","))return;return r}}(y);if(f)if("text/event-stream"===g)this._handleSseStream(m.body,{onresumptiontoken:s,requestSignal:r?.requestSignal,onRequestStreamEnd:r?.onRequestStreamEnd},!1);else if("application/json"===g){let t=await m.json();for(let r of Array.isArray(t)?t.map(t=>ni.parse(t)):[ni.parse(t)])this.onmessage?.(r)}else throw await m.text?.().catch(()=>{}),new lV(lU.ClientHttpUnexpectedContent,`Unexpected content type: ${y}`,{contentType:y});else await m.text?.().catch(()=>{})}catch(t){throw r?.requestSignal?.aborted!==!0&&this.onerror?.(t),t}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let t=await this._commonHeaders(),r={...this._requestInit,method:"DELETE",headers:t,signal:this._abortController?.signal},o=await (this._fetch??fetch)(this._url,r);if(await o.text?.().catch(()=>{}),!o.ok&&405!==o.status)throw new lH(lU.ClientHttpFailedToTerminateSession,`Failed to terminate session: ${o.statusText}`,{status:o.status,statusText:o.statusText});this._sessionId=void 0}catch(t){throw this.onerror?.(t),t}}setProtocolVersion(t){this._protocolVersion=t}get protocolVersion(){return this._protocolVersion}async resumeStream(t,r){await this._startOrAuthSse({resumptionToken:t,onresumptiontoken:r?.onresumptiontoken})}};let ht=require("node:process"),hr=require("node:stream");var ho=a(6507);let hi="win32"===ht.platform?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];var ha=class{_process;_readBuffer;_serverParams;_stderrStream=null;onclose;onerror;onmessage;constructor(t){this._serverParams=t,this._readBuffer=new ud({maxBufferSize:t.maxBufferSize}),("pipe"===t.stderr||"overlapped"===t.stderr)&&(this._stderrStream=new hr.PassThrough)}async start(){if(this._process)throw Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((t,r)=>{this._process=ho(this._serverParams.command,this._serverParams.args??[],{env:{...function(){let t={};for(let r of hi){let o=ht.env[r];void 0!==o&&(o.startsWith("()")||(t[r]=o))}return t}(),...this._serverParams.env},stdio:["pipe","pipe",this._serverParams.stderr??"inherit"],shell:!1,windowsHide:"win32"===ht.platform,cwd:this._serverParams.cwd}),this._process.on("error",t=>{r(t),this.onerror?.(t)}),this._process.on("spawn",()=>{t()}),this._process.on("close",t=>{this._process=void 0,this.onclose?.()}),this._process.stdin?.on("error",t=>{this.onerror?.(t)}),this._process.stdout?.on("data",t=>{try{this._readBuffer.append(t),this.processReadBuffer()}catch(t){this.onerror?.(t),this.close().catch(()=>{})}}),this._process.stdout?.on("error",t=>{this.onerror?.(t)}),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)})}get stderr(){return this._stderrStream?this._stderrStream:this._process?.stderr??null}get pid(){return this._process?.pid??null}processReadBuffer(){for(;;)try{let t=this._readBuffer.readMessage();if(null===t)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async _dispose(){let t=this._process;if(this._process=void 0,t&&null===t.exitCode&&null===t.signalCode){let r=new Promise(r=>t.once("exit",()=>r()));try{t.stdin?.end()}catch{}try{t.kill("SIGTERM")}catch{}if(await Promise.race([r,new Promise(t=>setTimeout(t,1e3).unref())]),null===t.exitCode&&null===t.signalCode)try{t.kill("SIGKILL")}catch{}await r}try{t?.stdout?.destroy()}catch{}try{t?.stdin?.destroy()}catch{}try{t?.stderr?.destroy()}catch{}this._readBuffer.clear()}async close(){if(this._process){let t=this._process;this._process=void 0;let r=new Promise(r=>{t.once("close",()=>{r()})});try{t.stdin?.end()}catch{}if(await Promise.race([r,new Promise(t=>setTimeout(t,2e3).unref())]),null===t.exitCode){try{t.kill("SIGTERM")}catch{}await Promise.race([r,new Promise(t=>setTimeout(t,2e3).unref())])}if(null===t.exitCode)try{t.kill("SIGKILL")}catch{}}this._readBuffer.clear()}send(t){return new Promise(r=>{if(!this._process?.stdin)throw new lV(lU.NotConnected,"Not connected");let o=JSON.stringify(t)+"\n";this._process.stdin.write(o)?r():this._process.stdin.once("drain",r)})}};let hn=a(8330),hs={name:hn.name,version:hn.version};async function hl(t,r={}){var o;let i,a,{handlers:n={}}=r,s={};n.sampling&&(s.sampling={}),n.elicitation&&(s.elicitation={form:{},url:{}}),n.roots&&(s.roots={});let l=new p3(hs,{capabilities:s,versionNegotiation:r.versionNegotiation??{mode:"auto"}});n.sampling&&l.setRequestHandler("sampling/createMessage",n.sampling),n.elicitation&&l.setRequestHandler("elicitation/create",n.elicitation),n.roots&&l.setRequestHandler("roots/list",n.roots);let c="http"===t.type?new he(new URL(t.url),{requestInit:{headers:(o=t.headers??[],a={},o.forEach(t=>{let r,o=t.name.trim();if("env"in(r=t)&&"string"==typeof r.env){let r=process.env[t.env];if(void 0===r)throw Error(`Environment variable "${t.env}" is not set (required for header "${o}")`);a[o]=r}else a[o]=t.value.trim()}),a)}}):new ha({command:t.command,args:t.args,env:t.env,cwd:t.cwd,stderr:t.stderr??(r.onStderrData?"pipe":"inherit")});c instanceof ha&&c.stderr?.on("data",r.onStderrData??(t=>{process.stderr.write(t)}));let u=c.close.bind(c);c.close=()=>i??(i=u());let d=l.close.bind(l);l.close=async()=>{try{await d()}finally{await c.close()}};let p=r.connect?.signal,h=()=>{c.close().catch(()=>{})};try{return p?.throwIfAborted(),p?.addEventListener("abort",h,{once:!0}),await l.connect(c,r.connect),p?.throwIfAborted(),l}catch(t){try{await l.close()}catch(r){throw AggregateError([t,r],"Client connection and cleanup failed",{cause:t})}throw p?.throwIfAborted(),t}finally{p?.removeEventListener("abort",h)}}async function hc(t,r,o){let i=await hl(t,o);try{return await r(i)}finally{await i.close()}}})(),exports.createClient=n.createClient,exports.withClient=n.withClient,n)-1===["createClient","withClient"].indexOf(s)&&(exports[s]=n[s]);Object.defineProperty(exports,"__esModule",{value:!0})})();
|