xmcp 1.7.0 → 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.js CHANGED
@@ -1,6 +1,8 @@
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.7.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(", ")}) {
1
+ (()=>{var t,r,o={6507(t,r,o){"use strict";let a=o(5317),i=o(8388),n=o(442);function s(t,r,o){let s=i(t,r,o),l=a.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=i(t,r,o),l=a.spawnSync(s.command,s.args,s.options);return l.error=l.error||n.verifyENOENTSync(l.status,s),l},t.exports._parse=i,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 a(t,a){return r&&1===t&&!a.file?o(a.original,"spawn"):null}t.exports={hookChildProcess:function(t,o){if(!r)return;let i=t.emit;t.emit=function(r,n){if("exit"===r){let r=a(n,o);if(r)return i.call(t,"error",r)}return i.apply(t,arguments)}},verifyENOENT:a,verifyENOENTSync:function(t,a){return r&&1===t&&!a.file?o(a.original,"spawnSync"):null},notFoundError:o}},8388(t,r,o){"use strict";let a=o(6928),i=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=i(t),(r=t.file&&s(t.file))?(t.args.unshift(t.file),t.command=r,i(t)):t.file),d=!c.test(o);if(t.options.forceShell||d){let r=u.test(o);t.command=a.normalize(t.command),t.command=n.command(t.command),t.args=t.args.map(t=>n.argument(t,r));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],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 a=o(9896),i=o(600);t.exports=function(t){let r,o=Buffer.alloc(150);try{r=a.openSync(t,"r"),a.readSync(r,o,0,150,0),a.closeSync(r)}catch(t){}return i(o.toString())}},3803(t,r,o){"use strict";let a=o(6928),i=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=i.sync(t.command,{path:s[n({env:s})],pathExt:r?a.delimiter:void 0})}catch(t){}finally{u&&process.chdir(l)}return o&&(o=a.resolve(c?t.options.cwd:"",o)),o}t.exports=function(t){return s(t)||s(t,!0)}},9344(t,r,o){var a;function i(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,a){i(t,r||{},function(t,r){t?a(t):o(r)})})}a(t,r||{},function(t,a){t&&("EACCES"===t.code||r&&r.ignoreErrors)&&(t=null,a=!1),o(t,a)})}o(9896),a="win32"===process.platform||global.TESTING_WINDOWS?o(8541):o(709),t.exports=i,i.sync=function(t,r){try{return a.sync(t,r||{})}catch(t){if(r&&r.ignoreErrors||"EACCES"===t.code)return!1;throw t}}},709(t,r,o){t.exports=i,i.sync=function(t,r){return n(a.statSync(t),r)};var a=o(9896);function i(t,r,o){a.stat(t,function(t,a){o(t,!t&&n(a,r))})}function n(t,r){var o,a,i,n,s,l,c,u,d;return t.isFile()&&(o=t,a=r,i=o.mode,n=o.uid,s=o.gid,l=void 0!==a.uid?a.uid:process.getuid&&process.getuid(),c=void 0!==a.gid?a.gid:process.getgid&&process.getgid(),u=parseInt("100",8),d=parseInt("010",8),i&parseInt("001",8)||i&d&&s===c||i&u&&n===l||i&(u|d)&&0===l)}},8541(t,r,o){t.exports=n,n.sync=function(t,r){return i(a.statSync(t),t,r)};var a=o(9896);function i(t,r,o){if(!t.isSymbolicLink()&&!t.isFile())return!1;var a=void 0!==o.pathExt?o.pathExt:process.env.PATHEXT;if(!a||-1!==(a=a.split(";")).indexOf(""))return!0;for(var i=0;i<a.length;i++){var n=a[i].toLowerCase();if(n&&r.substr(-n.length).toLowerCase()===n)return!0}return!1}function n(t,r,o){a.stat(t,function(a,n){o(a,!a&&i(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 a=o(9638);t.exports=(t="")=>{let r=t.match(a);if(!r)return null;let[o,i]=r[0].replace(/#! ?/,"").split(" "),n=o.split("/").pop();return"env"===n?i:i?`${n} ${i}`:n}},9638(t){"use strict";t.exports=/^#!(.*)/},1905(t,r,o){let a="win32"===process.platform||"cygwin"===process.env.OSTYPE||"msys"===process.env.OSTYPE,i=o(6928),n=a?";":":",s=o(9344),l=t=>Object.assign(Error(`not found: ${t}`),{code:"ENOENT"}),c=(t,r)=>{let o=r.colon||n,i=t.match(/\//)||a&&t.match(/\\/)?[""]:[...a?[process.cwd()]:[],...(r.path||process.env.PATH||"").split(o)],s=a?r.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",l=a?s.split(o):[""];return a&&-1!==t.indexOf(".")&&""!==l[0]&&l.unshift(""),{pathEnv:i,pathExt:l,pathExtExe:s}},u=(t,r,o)=>{"function"==typeof r&&(o=r,r={}),r||(r={});let{pathEnv:a,pathExt:n,pathExtExe:u}=c(t,r),d=[],p=o=>new Promise((n,s)=>{if(o===a.length)return r.all&&d.length?n(d):s(l(t));let c=a[o],u=/^".*"$/.test(c)?c.slice(1,-1):c,p=i.join(u,t);n(h(!u&&/^\.[\\\/]/.test(t)?t.slice(0,2)+p:p,o,0))}),h=(t,o,a)=>new Promise((i,l)=>{if(a===n.length)return i(p(o+1));let c=n[a];s(t+c,{pathExt:u},(n,s)=>{if(!n&&s)if(!r.all)return i(t+c);else d.push(t+c);return i(h(t,o,a+1))})});return o?p(0).then(t=>o(null,t),o):p(0)};t.exports=u,u.sync=(t,r)=>{let{pathEnv:o,pathExt:a,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=i.join(d,t),h=!d&&/^\.[\\\/]/.test(t)?t.slice(0,2)+p:p;for(let t=0;t<a.length;t++){let o=h+a[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")},8775(t,r,o){"use strict";let a,i;o.r(r),o.d(r,{jwksCache:()=>tL,FlattenedEncrypt:()=>tu,decodeProtectedHeader:()=>tW,generateSecret:()=>tG,flattenedDecrypt:()=>ts,exportSPKI:()=>e0,flattenedVerify:()=>th,jwtDecrypt:()=>tE,customFetch:()=>tU,importSPKI:()=>eZ,CompactEncrypt:()=>tP,importPKCS8:()=>eX,decodeJwt:()=>tF,errors:()=>s,generalVerify:()=>tm,compactDecrypt:()=>tl,compactVerify:()=>tf,EmbeddedJWK:()=>tN,exportPKCS8:()=>e1,CompactSign:()=>tR,cryptoRuntime:()=>tX,generalDecrypt:()=>tc,createLocalJWKSet:()=>tH,FlattenedSign:()=>tk,jwtVerify:()=>t$,GeneralEncrypt:()=>tp,EncryptJWT:()=>tT,calculateJwkThumbprintUri:()=>tI,SignJWT:()=>tA,exportJWK:()=>e2,importX509:()=>eG,importJWK:()=>eY,GeneralSign:()=>tC,createRemoteJWKSet:()=>tJ,generateKeyPair:()=>tZ,calculateJwkThumbprint:()=>tj,base64url:()=>n,UnsecuredJWT:()=>tV});var n={};o.r(n),o.d(n,{decode:()=>g,encode:()=>v});var s={};o.r(s),o.d(s,{JOSEAlgNotAllowed:()=>C,JOSEError:()=>k,JOSENotSupported:()=>A,JWEDecryptionFailed:()=>T,JWEInvalid:()=>O,JWKInvalid:()=>N,JWKSInvalid:()=>M,JWKSMultipleMatchingKeys:()=>q,JWKSNoMatchingKey:()=>z,JWKSTimeout:()=>H,JWSInvalid:()=>j,JWSSignatureVerificationFailed:()=>U,JWTClaimValidationFailed:()=>R,JWTExpired:()=>x,JWTInvalid:()=>I});let l=new TextEncoder,c=new TextDecoder;function u(...t){let r=new Uint8Array(t.reduce((t,{length:r})=>t+r,0)),o=0;for(let a of t)r.set(a,o),o+=a.length;return r}function d(t,r,o){if(r<0||r>=0x100000000)throw RangeError(`value must be >= 0 and <= ${0x100000000-1}. Received ${r}`);t.set([r>>>24,r>>>16,r>>>8,255&r],o)}function p(t){let r=Math.floor(t/0x100000000),o=new Uint8Array(8);return d(o,r,0),d(o,t%0x100000000,4),o}function h(t){let r=new Uint8Array(4);return d(r,t),r}function f(t){let r=new Uint8Array(t.length);for(let o=0;o<t.length;o++){let a=t.charCodeAt(o);if(a>127)throw TypeError("non-ASCII string encountered in encode()");r[o]=a}return r}function m(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(""))}function y(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 g(t){if(Uint8Array.fromBase64)return Uint8Array.fromBase64("string"==typeof t?t:c.decode(t),{alphabet:"base64url"});let r=t;r instanceof Uint8Array&&(r=c.decode(r)),r=r.replace(/-/g,"+").replace(/_/g,"/");try{return y(r)}catch{throw TypeError("The input to be decoded is not correctly encoded.")}}function v(t){let r=t;return("string"==typeof r&&(r=l.encode(r)),Uint8Array.prototype.toBase64)?r.toBase64({alphabet:"base64url",omitPadding:!0}):m(r).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}let _=(t,r="algorithm.name")=>TypeError(`CryptoKey does not support this operation, its ${r} must be ${t}`);function b(t,r){if(parseInt(t.hash.name.slice(4),10)!==r)throw _(`SHA-${r}`,"algorithm.hash")}function S(t,r){if(r&&!t.usages.includes(r))throw TypeError(`CryptoKey does not support this operation, its usages must include ${r}.`)}function w(t,r,o){switch(r){case"A128GCM":case"A192GCM":case"A256GCM":{if("AES-GCM"!==t.algorithm.name)throw _("AES-GCM");let o=parseInt(r.slice(1,4),10);if(t.algorithm.length!==o)throw _(o,"algorithm.length");break}case"A128KW":case"A192KW":case"A256KW":{if("AES-KW"!==t.algorithm.name)throw _("AES-KW");let o=parseInt(r.slice(1,4),10);if(t.algorithm.length!==o)throw _(o,"algorithm.length");break}case"ECDH":switch(t.algorithm.name){case"ECDH":case"X25519":break;default:throw _("ECDH or X25519")}break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":if("PBKDF2"!==t.algorithm.name)throw _("PBKDF2");break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":if("RSA-OAEP"!==t.algorithm.name)throw _("RSA-OAEP");b(t.algorithm,parseInt(r.slice(9),10)||1);break;default:throw TypeError("CryptoKey does not support this operation")}S(t,o)}function $(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 E=(t,...r)=>$("Key must be ",t,...r),P=(t,r,...o)=>$(`Key for the ${t} algorithm must be `,r,...o);class k 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 R extends k{static code="ERR_JWT_CLAIM_VALIDATION_FAILED";code="ERR_JWT_CLAIM_VALIDATION_FAILED";claim;reason;payload;constructor(t,r,o="unspecified",a="unspecified"){super(t,{cause:{claim:o,reason:a,payload:r}}),this.claim=o,this.reason=a,this.payload=r}}class x extends k{static code="ERR_JWT_EXPIRED";code="ERR_JWT_EXPIRED";claim;reason;payload;constructor(t,r,o="unspecified",a="unspecified"){super(t,{cause:{claim:o,reason:a,payload:r}}),this.claim=o,this.reason=a,this.payload=r}}class C extends k{static code="ERR_JOSE_ALG_NOT_ALLOWED";code="ERR_JOSE_ALG_NOT_ALLOWED"}class A extends k{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"}class T extends k{static code="ERR_JWE_DECRYPTION_FAILED";code="ERR_JWE_DECRYPTION_FAILED";constructor(t="decryption operation failed",r){super(t,r)}}class O extends k{static code="ERR_JWE_INVALID";code="ERR_JWE_INVALID"}class j extends k{static code="ERR_JWS_INVALID";code="ERR_JWS_INVALID"}class I extends k{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"}class N extends k{static code="ERR_JWK_INVALID";code="ERR_JWK_INVALID"}class M extends k{static code="ERR_JWKS_INVALID";code="ERR_JWKS_INVALID"}class z extends k{static code="ERR_JWKS_NO_MATCHING_KEY";code="ERR_JWKS_NO_MATCHING_KEY";constructor(t="no applicable key found in the JSON Web Key Set",r){super(t,r)}}class q extends k{[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)}}class H extends k{static code="ERR_JWKS_TIMEOUT";code="ERR_JWKS_TIMEOUT";constructor(t="request timed out",r){super(t,r)}}class U extends k{static code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";constructor(t="signature verification failed",r){super(t,r)}}function D(t){if(!L(t))throw Error("CryptoKey instance expected")}let L=t=>{if(t?.[Symbol.toStringTag]==="CryptoKey")return!0;try{return t instanceof CryptoKey}catch{return!1}},K=t=>t?.[Symbol.toStringTag]==="KeyObject",J=t=>L(t)||K(t);function V(t){switch(t){case"A128GCM":return 128;case"A192GCM":return 192;case"A256GCM":case"A128CBC-HS256":return 256;case"A192CBC-HS384":return 384;case"A256CBC-HS512":return 512;default:throw new A(`Unsupported JWE Algorithm: ${t}`)}}let W=t=>crypto.getRandomValues(new Uint8Array(V(t)>>3));function F(t,r){let o=t.byteLength<<3;if(o!==r)throw new O(`Invalid Content Encryption Key length. Expected ${r} bits, got ${o} bits`)}function B(t){switch(t){case"A128GCM":case"A128GCMKW":case"A192GCM":case"A192GCMKW":case"A256GCM":case"A256GCMKW":return 96;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return 128;default:throw new A(`Unsupported JWE Algorithm: ${t}`)}}function Z(t,r){if(r.length<<3!==B(t))throw new O("Invalid Initialization Vector length")}async function G(t,r,o){if(!(r instanceof Uint8Array))throw TypeError(E(r,"Uint8Array"));let a=parseInt(t.slice(1,4),10);return{encKey:await crypto.subtle.importKey("raw",r.subarray(a>>3),"AES-CBC",!1,[o]),macKey:await crypto.subtle.importKey("raw",r.subarray(0,a>>3),{hash:`SHA-${a<<1}`,name:"HMAC"},!1,["sign"]),keySize:a}}async function X(t,r,o){return new Uint8Array((await crypto.subtle.sign("HMAC",t,r)).slice(0,o>>3))}async function Y(t,r,o,a,i){let{encKey:n,macKey:s,keySize:l}=await G(t,o,"encrypt"),c=new Uint8Array(await crypto.subtle.encrypt({iv:a,name:"AES-CBC"},n,r)),d=u(i,a,c,p(i.length<<3));return{ciphertext:c,tag:await X(s,d,l),iv:a}}async function Q(t,r){if(!(t instanceof Uint8Array))throw TypeError("First argument must be a buffer");if(!(r instanceof Uint8Array))throw TypeError("Second argument must be a buffer");let o={name:"HMAC",hash:"SHA-256"},a=await crypto.subtle.generateKey(o,!1,["sign"]),i=new Uint8Array(await crypto.subtle.sign(o,a,t)),n=new Uint8Array(await crypto.subtle.sign(o,a,r)),s=0,l=-1;for(;++l<32;)s|=i[l]^n[l];return 0===s}async function ee(t,r,o,a,i,n){let s,l,{encKey:c,macKey:d,keySize:h}=await G(t,r,"decrypt"),f=u(n,a,o,p(n.length<<3)),m=await X(d,f,h);try{s=await Q(i,m)}catch{}if(!s)throw new T;try{l=new Uint8Array(await crypto.subtle.decrypt({iv:a,name:"AES-CBC"},c,o))}catch{}if(!l)throw new T;return l}async function et(t,r,o,a,i){let n;o instanceof Uint8Array?n=await crypto.subtle.importKey("raw",o,"AES-GCM",!1,["encrypt"]):(w(o,t,"encrypt"),n=o);let s=new Uint8Array(await crypto.subtle.encrypt({additionalData:i,iv:a,name:"AES-GCM",tagLength:128},n,r)),l=s.slice(-16);return{ciphertext:s.slice(0,-16),tag:l,iv:a}}async function er(t,r,o,a,i,n){let s;r instanceof Uint8Array?s=await crypto.subtle.importKey("raw",r,"AES-GCM",!1,["decrypt"]):(w(r,t,"decrypt"),s=r);try{return new Uint8Array(await crypto.subtle.decrypt({additionalData:n,iv:a,name:"AES-GCM",tagLength:128},s,u(o,i)))}catch{throw new T}}let eo="Unsupported JWE Content Encryption Algorithm";async function ea(t,r,o,a,i){if(!L(o)&&!(o instanceof Uint8Array))throw TypeError(E(o,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(a)Z(t,a);else a=crypto.getRandomValues(new Uint8Array(B(t)>>3));switch(t){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return o instanceof Uint8Array&&F(o,parseInt(t.slice(-3),10)),Y(t,r,o,a,i);case"A128GCM":case"A192GCM":case"A256GCM":return o instanceof Uint8Array&&F(o,parseInt(t.slice(1,4),10)),et(t,r,o,a,i);default:throw new A(eo)}}async function ei(t,r,o,a,i,n){if(!L(r)&&!(r instanceof Uint8Array))throw TypeError(E(r,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(!a)throw new O("JWE Initialization Vector missing");if(!i)throw new O("JWE Authentication Tag missing");switch(Z(t,a),t){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return r instanceof Uint8Array&&F(r,parseInt(t.slice(-3),10)),ee(t,r,o,a,i,n);case"A128GCM":case"A192GCM":case"A256GCM":return r instanceof Uint8Array&&F(r,parseInt(t.slice(1,4),10)),er(t,r,o,a,i,n);default:throw new A(eo)}}let en=Symbol();function es(t,r){if(t)throw TypeError(`${r} can only be called once`)}function el(t,r,o){try{return g(t)}catch{throw new o(`Failed to base64url decode the ${r}`)}}async function ec(t,r){let o=`SHA-${t.slice(-3)}`;return new Uint8Array(await crypto.subtle.digest(o,r))}function eu(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}function ed(...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}let ep=t=>eu(t)&&"string"==typeof t.kty;function eh(t,r){if(t.algorithm.length!==parseInt(r.slice(1,4),10))throw TypeError(`Invalid key size for alg: ${r}`)}function ef(t,r,o){return t instanceof Uint8Array?crypto.subtle.importKey("raw",t,"AES-KW",!0,[o]):(w(t,r,o),t)}async function em(t,r,o){let a=await ef(r,t,"wrapKey");eh(a,t);let i=await crypto.subtle.importKey("raw",o,{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.wrapKey("raw",i,a,"AES-KW"))}async function ey(t,r,o){let a=await ef(r,t,"unwrapKey");eh(a,t);let i=await crypto.subtle.unwrapKey("raw",o,a,"AES-KW",{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.exportKey("raw",i))}function eg(t){return u(h(t.length),t)}async function ev(t,r,o){let a=r>>3,i=Math.ceil(a/32),n=new Uint8Array(32*i);for(let r=1;r<=i;r++){let a=new Uint8Array(4+t.length+o.length);a.set(h(r),0),a.set(t,4),a.set(o,4+t.length);let i=await ec("sha256",a);n.set(i,(r-1)*32)}return n.slice(0,a)}async function e_(t,r,o,a,i=new Uint8Array,n=new Uint8Array){var s;w(t,"ECDH"),w(r,"ECDH","deriveBits");let l=u(eg(f(o)),eg(i),eg(n),h(a),new Uint8Array);return ev(new Uint8Array(await crypto.subtle.deriveBits({name:t.algorithm.name,public:t},r,"X25519"===(s=t).algorithm.name?256:Math.ceil(parseInt(s.algorithm.namedCurve.slice(-3),10)/8)<<3)),a,l)}function eb(t){switch(t.algorithm.namedCurve){case"P-256":case"P-384":case"P-521":return!0;default:return"X25519"===t.algorithm.name}}async function eS(t,r,o,a){if(!(t instanceof Uint8Array)||t.length<8)throw new O("PBES2 Salt Input must be 8 or more octets");if(!Number.isSafeInteger(o)||1!==Math.sign(o))throw new O("PBES2 Count Input must be a positive integer");let i=u(f(r),Uint8Array.of(0),t),n=parseInt(r.slice(13,16),10),s={hash:`SHA-${r.slice(8,11)}`,iterations:o,name:"PBKDF2",salt:i},l=await (a instanceof Uint8Array?crypto.subtle.importKey("raw",a,"PBKDF2",!1,["deriveBits"]):(w(a,r,"deriveBits"),a));return new Uint8Array(await crypto.subtle.deriveBits(s,l,n))}async function ew(t,r,o,a=2048,i=crypto.getRandomValues(new Uint8Array(16))){let n=await eS(i,t,a,r);return{encryptedKey:await em(t.slice(-6),n,o),p2c:a,p2s:v(i)}}async function e$(t,r,o,a,i){let n=await eS(i,t,a,r);return ey(t.slice(-6),n,o)}function eE(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`)}}function eP(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 A(`alg ${t} is not supported either by JOSE or your javascript runtime`)}}async function ek(t,r,o){if(r instanceof Uint8Array){if(!t.startsWith("HS"))throw TypeError(E(r,"CryptoKey","KeyObject","JSON Web Key"));return crypto.subtle.importKey("raw",r,{hash:`SHA-${t.slice(-3)}`,name:"HMAC"},!1,[o])}switch(t){case"HS256":case"HS384":case"HS512":if("HMAC"!==r.algorithm.name)throw _("HMAC");b(r.algorithm,parseInt(t.slice(2),10));break;case"RS256":case"RS384":case"RS512":if("RSASSA-PKCS1-v1_5"!==r.algorithm.name)throw _("RSASSA-PKCS1-v1_5");b(r.algorithm,parseInt(t.slice(2),10));break;case"PS256":case"PS384":case"PS512":if("RSA-PSS"!==r.algorithm.name)throw _("RSA-PSS");b(r.algorithm,parseInt(t.slice(2),10));break;case"Ed25519":case"EdDSA":if("Ed25519"!==r.algorithm.name)throw _("Ed25519");break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":let a;if(a=r.algorithm,a.name!==t)throw _(t);break;case"ES256":case"ES384":case"ES512":{if("ECDSA"!==r.algorithm.name)throw _("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")}}(t);if(r.algorithm.namedCurve!==o)throw _(o,"algorithm.namedCurve");break}default:throw TypeError("CryptoKey does not support this operation")}return S(r,o),r}async function eR(t,r,o){let a=await ek(t,r,"sign");return eE(t,a),new Uint8Array(await crypto.subtle.sign(eP(t,a.algorithm),a,o))}async function ex(t,r,o,a){let i=await ek(t,r,"verify");eE(t,i);let n=eP(t,i.algorithm);try{return await crypto.subtle.verify(n,i,o,a)}catch{return!1}}let eC=t=>{switch(t){case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return"RSA-OAEP";default:throw new A(`alg ${t} is not supported either by JOSE or your javascript runtime`)}};async function eA(t,r,o){return w(r,t,"encrypt"),eE(t,r),new Uint8Array(await crypto.subtle.encrypt(eC(t),r,o))}async function eT(t,r,o){return w(r,t,"decrypt"),eE(t,r),new Uint8Array(await crypto.subtle.decrypt(eC(t),r,o))}let eO='Invalid or unsupported JWK "alg" (Algorithm) Parameter value';async function ej(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 A(eO)}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 A(eO)}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 A(eO)}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 A(eO)}break;default:throw new A('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:r,keyUsages:o}}(t),a={...t};return"AKP"!==a.kty&&delete a.alg,delete a.use,crypto.subtle.importKey("jwk",a,r,t.ext??(!t.d&&!t.priv),t.key_ops??o)}let eI="given KeyObject instance cannot be used for this algorithm",eN=async(t,r,o,i=!1)=>{let n=(a||=new WeakMap).get(t);if(n?.[o])return n[o];let s=await ej({...r,alg:o});return i&&Object.freeze(t),n?n[o]=s:a.set(t,{[o]:s}),s};async function eM(t,r){if(t instanceof Uint8Array||L(t))return t;if(K(t)){if("secret"===t.type)return t.export();if("toCryptoKey"in t&&"function"==typeof t.toCryptoKey)try{return((t,r)=>{let o,i=(a||=new WeakMap).get(t);if(i?.[r])return i[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(eI)}o=t.toCryptoKey(t.asymmetricKeyType,s,n?[]:["deriveBits"])}if("ed25519"===t.asymmetricKeyType){if("EdDSA"!==r&&"Ed25519"!==r)throw TypeError(eI);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(eI);o=t.toCryptoKey(t.asymmetricKeyType,s,[n?"verify":"sign"])}if("rsa"===t.asymmetricKeyType){let a;switch(r){case"RSA-OAEP":a="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":a="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":a="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":a="SHA-512";break;default:throw TypeError(eI)}if(r.startsWith("RSA-OAEP"))return t.toCryptoKey({name:"RSA-OAEP",hash:a},s,n?["encrypt"]:["decrypt"]);o=t.toCryptoKey({name:r.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:a},s,[n?"verify":"sign"])}if("ec"===t.asymmetricKeyType){let a=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(t.asymmetricKeyDetails?.namedCurve);if(!a)throw TypeError(eI);let i={ES256:"P-256",ES384:"P-384",ES512:"P-521"};i[r]&&a===i[r]&&(o=t.toCryptoKey({name:"ECDSA",namedCurve:a},s,[n?"verify":"sign"])),r.startsWith("ECDH-ES")&&(o=t.toCryptoKey({name:"ECDH",namedCurve:a},s,n?[]:["deriveBits"]))}if(!o)throw TypeError(eI);return i?i[r]=o:a.set(t,{[r]:o}),o})(t,r)}catch(t){if(t instanceof TypeError)throw t}let o=t.export({format:"jwk"});return eN(t,o,r)}if(ep(t))return t.k?g(t.k):eN(t,t,r,!0);throw Error("unreachable")}let ez=(t,r)=>{let o=(t.match(/.{1,64}/g)||[]).join("\n");return`-----BEGIN ${r}-----
2
+ ${o}
3
+ -----END ${r}-----`},eq=async(t,r,o)=>{if(K(o)){if(o.type!==t)throw TypeError(`key is not a ${t} key`);return o.export({format:"pem",type:r})}if(!L(o))throw TypeError(E(o,"CryptoKey","KeyObject"));if(!o.extractable)throw TypeError("CryptoKey is not extractable");if(o.type!==t)throw TypeError(`key is not a ${t} key`);return ez(m(new Uint8Array(await crypto.subtle.exportKey(r,o))),`${t.toUpperCase()} KEY`)},eH=(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},eU=t=>({data:t,pos:0}),eD=t=>{let r=t.data[t.pos++];if(128&r){let o=127&r,a=0;for(let r=0;r<o;r++)a=a<<8|t.data[t.pos++];return a}return r},eL=(t,r=1)=>{if(r<=0)return;t.pos++;let o=eD(t);t.pos+=o,r>1&&eL(t,r-1)},eK=(t,r,o)=>{if(t.data[t.pos++]!==r)throw Error(o)},eJ=(t,r)=>{let o=t.data.subarray(t.pos,t.pos+r);return t.pos+=r,o},eV=t=>{let r,o=(eK(t,6,"Expected algorithm OID"),r=eD(t),eJ(t,r));if(eH(o,[43,101,110]))return"X25519";if(!eH(o,[42,134,72,206,61,2,1]))throw Error("Unsupported key algorithm");eK(t,6,"Expected curve OID");let a=eD(t),i=eJ(t,a);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(eH(i,r))return t;throw Error("Unsupported named curve")},eW=async(t,r,o,a)=>{let i,n,s="spki"===t,l=()=>s?["verify"]:["sign"];switch(o){case"PS256":case"PS384":case"PS512":i={name:"RSA-PSS",hash:`SHA-${o.slice(-3)}`},n=l();break;case"RS256":case"RS384":case"RS512":i={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":i={name:"RSA-OAEP",hash:`SHA-${parseInt(o.slice(-3),10)||1}`},n=s?["encrypt","wrapKey"]:["decrypt","unwrapKey"];break;case"ES256":case"ES384":case"ES512":i={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=a.getNamedCurve(r);i="X25519"===t?{name:"X25519"}:{name:"ECDH",namedCurve:t}}catch(t){throw new A("Invalid or unsupported key format")}n=s?[]:["deriveBits"];break;case"Ed25519":case"EdDSA":i={name:"Ed25519"},n=l();break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":i={name:o},n=l();break;default:throw new A('Invalid or unsupported "alg" (Algorithm) value')}return crypto.subtle.importKey(t,r,i,a?.extractable??!!s,n)},eF=(t,r)=>y(t.replace(r,"")),eB=(t,r,o)=>{let a=eF(t,/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g),i=o;return r?.startsWith?.("ECDH-ES")&&((i||={}).getNamedCurve=t=>{let r=eU(t);return eK(r,48,"Invalid SPKI structure"),eD(r),eK(r,48,"Expected algorithm identifier"),eD(r),r.pos,eV(r)}),eW("spki",a,r,i)};async function eZ(t,r,o){if("string"!=typeof t||0!==t.indexOf("-----BEGIN PUBLIC KEY-----"))throw TypeError('"spki" must be SPKI formatted string');return eB(t,r,o)}async function eG(t,r,o){if("string"!=typeof t||0!==t.indexOf("-----BEGIN CERTIFICATE-----"))throw TypeError('"x509" must be X.509 formatted string');return((t,r,o)=>{let a;try{var i;let r,o,n;r=eU(i=eF(t,/(?:-----(?:BEGIN|END) CERTIFICATE-----|\s)/g)),eK(r,48,"Invalid certificate structure"),eD(r),eK(r,48,"Invalid tbsCertificate structure"),eD(r),160===i[r.pos]?eL(r,6):eL(r,5),o=r.pos,eK(r,48,"Invalid SPKI structure"),n=eD(r),a=i.subarray(o,o+n+(r.pos-o))}catch(t){throw TypeError("Failed to parse the X.509 certificate",{cause:t})}return eB(ez(m(a),"PUBLIC KEY"),r,o)})(t,r,o)}async function eX(t,r,o){let a,i;if("string"!=typeof t||0!==t.indexOf("-----BEGIN PRIVATE KEY-----"))throw TypeError('"pkcs8" must be PKCS#8 formatted string');return a=eF(t,/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g),i=o,r?.startsWith?.("ECDH-ES")&&((i||={}).getNamedCurve=t=>{let r,o=eU(t);return eK(o,48,"Invalid PKCS#8 structure"),eD(o),eK(o,2,"Expected version field"),r=eD(o),o.pos+=r,eK(o,48,"Expected algorithm identifier"),eD(o),o.pos,eV(o)}),eW("pkcs8",a,r,i)}async function eY(t,r,o){let a;if(!eu(t))throw TypeError("JWK must be an object");switch(r??=t.alg,a??=o?.extractable??t.ext,t.kty){case"oct":if("string"!=typeof t.k||!t.k)throw TypeError('missing "k" (Key Value) Parameter value');return g(t.k);case"RSA":if("oth"in t&&void 0!==t.oth)throw new A('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');return ej({...t,alg:r,ext:a});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 ej({...t,ext:a});case"EC":case"OKP":return ej({...t,alg:r,ext:a});default:throw new A('Unsupported "kty" (Key Type) Parameter value')}}async function eQ(t){if(K(t))if("secret"!==t.type)return t.export({format:"jwk"});else t=t.export();if(t instanceof Uint8Array)return{kty:"oct",k:v(t)};if(!L(t))throw TypeError(E(t,"CryptoKey","KeyObject","Uint8Array"));if(!t.extractable)throw TypeError("non-extractable CryptoKey cannot be exported as a JWK");let{ext:r,key_ops:o,alg:a,use:i,...n}=await crypto.subtle.exportKey("jwk",t);return"AKP"===n.kty&&(n.alg=a),n}async function e0(t){return eq("public","spki",t)}async function e1(t){return eq("private","pkcs8",t)}async function e2(t){return eQ(t)}async function e9(t,r,o,a){let i=t.slice(0,7),n=await ea(i,o,r,a,new Uint8Array);return{encryptedKey:n.ciphertext,iv:v(n.iv),tag:v(n.tag)}}async function e4(t,r,o,a,i){return ei(t.slice(0,7),r,o,a,i,new Uint8Array)}let e5='Invalid or unsupported "alg" (JWE Algorithm) header value';function e3(t){if(void 0===t)throw new O("JWE Encrypted Key missing")}async function e6(t,r,o,a,i){switch(t){case"dir":if(void 0!==o)throw new O("Encountered unexpected JWE Encrypted Key");return r;case"ECDH-ES":if(void 0!==o)throw new O("Encountered unexpected JWE Encrypted Key");case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{let i,n;if(!eu(a.epk))throw new O('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');if(D(r),!eb(r))throw new A("ECDH with the provided key is not allowed or not supported by your javascript runtime");let s=await eY(a.epk,t);if(D(s),void 0!==a.apu){if("string"!=typeof a.apu)throw new O('JOSE Header "apu" (Agreement PartyUInfo) invalid');i=el(a.apu,"apu",O)}if(void 0!==a.apv){if("string"!=typeof a.apv)throw new O('JOSE Header "apv" (Agreement PartyVInfo) invalid');n=el(a.apv,"apv",O)}let l=await e_(s,r,"ECDH-ES"===t?a.enc:t,"ECDH-ES"===t?V(a.enc):parseInt(t.slice(-5,-2),10),i,n);if("ECDH-ES"===t)return l;return e3(o),ey(t.slice(-6),l,o)}case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return e3(o),D(r),eT(t,r,o);case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{let n;if(e3(o),"number"!=typeof a.p2c)throw new O('JOSE Header "p2c" (PBES2 Count) missing or invalid');let s=i?.maxPBES2Count||1e4;if(a.p2c>s)throw new O('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if("string"!=typeof a.p2s)throw new O('JOSE Header "p2s" (PBES2 Salt) missing or invalid');return n=el(a.p2s,"p2s",O),e$(t,r,o,a.p2c,n)}case"A128KW":case"A192KW":case"A256KW":return e3(o),ey(t,r,o);case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":if(e3(o),"string"!=typeof a.iv)throw new O('JOSE Header "iv" (Initialization Vector) missing or invalid');if("string"!=typeof a.tag)throw new O('JOSE Header "tag" (Authentication Tag) missing or invalid');return e4(t,r,o,el(a.iv,"iv",O),el(a.tag,"tag",O));default:throw new A(e5)}}async function e8(t,r,o,a,i={}){let n,s,l;switch(t){case"dir":l=o;break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{let c;if(D(o),!eb(o))throw new A("ECDH with the provided key is not allowed or not supported by your javascript runtime");let{apu:u,apv:d}=i;c=i.epk?await eM(i.epk,t):(await crypto.subtle.generateKey(o.algorithm,!0,["deriveBits"])).privateKey;let{x:p,y:h,crv:f,kty:m}=await e2(c),y=await e_(o,c,"ECDH-ES"===t?r:t,"ECDH-ES"===t?V(r):parseInt(t.slice(-5,-2),10),u,d);if(s={epk:{x:p,crv:f,kty:m}},"EC"===m&&(s.epk.y=h),u&&(s.apu=v(u)),d&&(s.apv=v(d)),"ECDH-ES"===t){l=y;break}l=a||W(r);let g=t.slice(-6);n=await em(g,y,l);break}case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":l=a||W(r),D(o),n=await eA(t,o,l);break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{l=a||W(r);let{p2c:c,p2s:u}=i;({encryptedKey:n,...s}=await ew(t,o,l,c,u));break}case"A128KW":case"A192KW":case"A256KW":l=a||W(r),n=await em(t,o,l);break;case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{l=a||W(r);let{iv:c}=i;({encryptedKey:n,...s}=await e9(t,o,l,c));break}default:throw new A(e5)}return{cek:l,encryptedKey:n,parameters:s}}function e7(t,r,o,a,i){let n;if(void 0!==i.crit&&a?.crit===void 0)throw new t('"crit" (Critical) Header Parameter MUST be integrity protected');if(!a||void 0===a.crit)return new Set;if(!Array.isArray(a.crit)||0===a.crit.length||a.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,a.crit)){if(!n.has(s))throw new A(`Extension Header Parameter "${s}" is not recognized`);if(void 0===i[s])throw new t(`Extension Header Parameter "${s}" is missing`);if(n.get(s)&&void 0===a[s])throw new t(`Extension Header Parameter "${s}" MUST be integrity protected`)}return new Set(a.crit)}function te(t,r){if(void 0!==r&&(!Array.isArray(r)||r.some(t=>"string"!=typeof t)))throw TypeError(`"${t}" option must be an array of strings`);if(r)return new Set(r)}let tt=t=>t?.[Symbol.toStringTag],tr=(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 a;switch(!0){case"sign"===o||"verify"===o:case"dir"===t:case t.includes("CBC-HS"):a=o;break;case t.startsWith("PBES2"):a="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(t):a=!t.includes("GCM")&&t.endsWith("KW")?"encrypt"===o?"wrapKey":"unwrapKey":o;break;case"encrypt"===o&&t.startsWith("RSA"):a="wrapKey";break;case"decrypt"===o:a=t.startsWith("RSA")?"unwrapKey":"deriveBits"}if(a&&r.key_ops?.includes?.(a)===!1)throw TypeError(`Invalid key for this operation, its "key_ops" must include "${a}" when present`)}return!0};function to(t,r,o){switch(t.substring(0,2)){case"A1":case"A2":case"di":case"HS":case"PB":((t,r,o)=>{if(!(r instanceof Uint8Array)){if(ep(r)){if("oct"===r.kty&&"string"==typeof r.k&&tr(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(!J(r))throw TypeError(P(t,r,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==r.type)throw TypeError(`${tt(r)} instances for symmetric algorithms must be of type "secret"`)}})(t,r,o);break;default:((t,r,o)=>{if(ep(r))switch(o){case"decrypt":case"sign":if("oct"!==r.kty&&("AKP"===r.kty&&"string"==typeof r.priv||"string"==typeof r.d)&&tr(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&&tr(t,r,o))return;throw TypeError("JSON Web Key for this operation must be a public JWK")}if(!J(r))throw TypeError(P(t,r,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===r.type)throw TypeError(`${tt(r)} instances for asymmetric algorithms must not be of type "secret"`);if("public"===r.type)switch(o){case"sign":throw TypeError(`${tt(r)} instances for asymmetric algorithm signing must be of type "private"`);case"decrypt":throw TypeError(`${tt(r)} instances for asymmetric algorithm decryption must be of type "private"`)}if("private"===r.type)switch(o){case"verify":throw TypeError(`${tt(r)} instances for asymmetric algorithm verifying must be of type "public"`);case"encrypt":throw TypeError(`${tt(r)} instances for asymmetric algorithm encryption must be of type "public"`)}})(t,r,o)}}function ta(t){if(void 0===globalThis[t])throw new A(`JWE "zip" (Compression Algorithm) Header Parameter requires the ${t} API.`)}async function ti(t){ta("CompressionStream");let r=new CompressionStream("deflate-raw"),o=r.writable.getWriter();o.write(t).catch(()=>{}),o.close().catch(()=>{});let a=[],i=r.readable.getReader();for(;;){let{value:t,done:r}=await i.read();if(r)break;a.push(t)}return u(...a)}async function tn(t,r){ta("DecompressionStream");let o=new DecompressionStream("deflate-raw"),a=o.writable.getWriter();a.write(t).catch(()=>{}),a.close().catch(()=>{});let i=[],n=0,s=o.readable.getReader();for(;;){let{value:t,done:o}=await s.read();if(o)break;if(i.push(t),n+=t.byteLength,r!==1/0&&n>r)throw new O("Decompressed plaintext exceeded the configured limit")}return u(...i)}async function ts(t,r,o){let a,i,n,s,l,d;if(!eu(t))throw new O("Flattened JWE must be an object");if(void 0===t.protected&&void 0===t.header&&void 0===t.unprotected)throw new O("JOSE Header missing");if(void 0!==t.iv&&"string"!=typeof t.iv)throw new O("JWE Initialization Vector incorrect type");if("string"!=typeof t.ciphertext)throw new O("JWE Ciphertext missing or incorrect type");if(void 0!==t.tag&&"string"!=typeof t.tag)throw new O("JWE Authentication Tag incorrect type");if(void 0!==t.protected&&"string"!=typeof t.protected)throw new O("JWE Protected Header incorrect type");if(void 0!==t.encrypted_key&&"string"!=typeof t.encrypted_key)throw new O("JWE Encrypted Key incorrect type");if(void 0!==t.aad&&"string"!=typeof t.aad)throw new O("JWE AAD incorrect type");if(void 0!==t.header&&!eu(t.header))throw new O("JWE Shared Unprotected Header incorrect type");if(void 0!==t.unprotected&&!eu(t.unprotected))throw new O("JWE Per-Recipient Unprotected Header incorrect type");if(t.protected)try{let r=g(t.protected);a=JSON.parse(c.decode(r))}catch{throw new O("JWE Protected Header is invalid")}if(!ed(a,t.header,t.unprotected))throw new O("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");let p={...a,...t.header,...t.unprotected};if(e7(O,new Map,o?.crit,a,p),void 0!==p.zip&&"DEF"!==p.zip)throw new A('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(void 0!==p.zip&&!a?.zip)throw new O('JWE "zip" (Compression Algorithm) Header Parameter MUST be in a protected header.');let{alg:h,enc:m}=p;if("string"!=typeof h||!h)throw new O("missing JWE Algorithm (alg) in JWE Header");if("string"!=typeof m||!m)throw new O("missing JWE Encryption Algorithm (enc) in JWE Header");let y=o&&te("keyManagementAlgorithms",o.keyManagementAlgorithms),v=o&&te("contentEncryptionAlgorithms",o.contentEncryptionAlgorithms);if(y&&!y.has(h)||!y&&h.startsWith("PBES2"))throw new C('"alg" (Algorithm) Header Parameter value not allowed');if(v&&!v.has(m))throw new C('"enc" (Encryption Algorithm) Header Parameter value not allowed');void 0!==t.encrypted_key&&(i=el(t.encrypted_key,"encrypted_key",O));let _=!1;"function"==typeof r&&(r=await r(a,t),_=!0),to("dir"===h?m:h,r,"decrypt");let b=await eM(r,h);try{n=await e6(h,b,i,p,o)}catch(t){if(t instanceof TypeError||t instanceof O||t instanceof A)throw t;n=W(m)}void 0!==t.iv&&(s=el(t.iv,"iv",O)),void 0!==t.tag&&(l=el(t.tag,"tag",O));let S=void 0!==t.protected?f(t.protected):new Uint8Array;d=void 0!==t.aad?u(S,f("."),f(t.aad)):S;let w=el(t.ciphertext,"ciphertext",O),$=await ei(m,n,w,s,l,d),E={plaintext:$};if("DEF"===p.zip){let t=o?.maxDecompressedLength??25e4;if(0===t)throw new A('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');if(t!==1/0&&(!Number.isSafeInteger(t)||t<1))throw TypeError("maxDecompressedLength must be 0, a positive safe integer, or Infinity");E.plaintext=await tn($,t).catch(t=>{if(t instanceof O)throw t;throw new O("Failed to decompress plaintext",{cause:t})})}return(void 0!==t.protected&&(E.protectedHeader=a),void 0!==t.aad&&(E.additionalAuthenticatedData=el(t.aad,"aad",O)),void 0!==t.unprotected&&(E.sharedUnprotectedHeader=t.unprotected),void 0!==t.header&&(E.unprotectedHeader=t.header),_)?{...E,key:b}:E}async function tl(t,r,o){if(t instanceof Uint8Array&&(t=c.decode(t)),"string"!=typeof t)throw new O("Compact JWE must be a string or Uint8Array");let{0:a,1:i,2:n,3:s,4:l,length:u}=t.split(".");if(5!==u)throw new O("Invalid Compact JWE");let d=await ts({ciphertext:s,iv:n||void 0,protected:a,tag:l||void 0,encrypted_key:i||void 0},r,o),p={plaintext:d.plaintext,protectedHeader:d.protectedHeader};return"function"==typeof r?{...p,key:d.key}:p}async function tc(t,r,o){if(!eu(t))throw new O("General JWE must be an object");if(!Array.isArray(t.recipients)||!t.recipients.every(eu))throw new O("JWE Recipients missing or incorrect type");if(!t.recipients.length)throw new O("JWE Recipients has no members");for(let a of t.recipients)try{return await ts({aad:t.aad,ciphertext:t.ciphertext,encrypted_key:a.encrypted_key,header:a.header,iv:t.iv,protected:t.protected,tag:t.tag,unprotected:t.unprotected},r,o)}catch{}throw new T}class tu{#e;#t;#r;#o;#a;#i;#n;#s;constructor(t){if(!(t instanceof Uint8Array))throw TypeError("plaintext must be an instance of Uint8Array");this.#e=t}setKeyManagementParameters(t){return es(this.#s,"setKeyManagementParameters"),this.#s=t,this}setProtectedHeader(t){return es(this.#t,"setProtectedHeader"),this.#t=t,this}setSharedUnprotectedHeader(t){return es(this.#r,"setSharedUnprotectedHeader"),this.#r=t,this}setUnprotectedHeader(t){return es(this.#o,"setUnprotectedHeader"),this.#o=t,this}setAdditionalAuthenticatedData(t){return this.#a=t,this}setContentEncryptionKey(t){return es(this.#i,"setContentEncryptionKey"),this.#i=t,this}setInitializationVector(t){return es(this.#n,"setInitializationVector"),this.#n=t,this}async encrypt(t,r){let o,a,i,n,s,l;if(!this.#t&&!this.#o&&!this.#r)throw new O("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(!ed(this.#t,this.#o,this.#r))throw new O("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");let c={...this.#t,...this.#o,...this.#r};if(e7(O,new Map,r?.crit,this.#t,c),void 0!==c.zip&&"DEF"!==c.zip)throw new A('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(void 0!==c.zip&&!this.#t?.zip)throw new O('JWE "zip" (Compression Algorithm) Header Parameter MUST be in a protected header.');let{alg:d,enc:p}=c;if("string"!=typeof d||!d)throw new O('JWE "alg" (Algorithm) Header Parameter missing or invalid');if("string"!=typeof p||!p)throw new O('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');if(this.#i&&("dir"===d||"ECDH-ES"===d))throw TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${d}`);to("dir"===d?p:d,t,"encrypt");{let i,n=await eM(t,d);({cek:a,encryptedKey:o,parameters:i}=await e8(d,p,n,this.#i,this.#s)),i&&(r&&en in r?this.#o?this.#o={...this.#o,...i}:this.setUnprotectedHeader(i):this.#t?this.#t={...this.#t,...i}:this.setProtectedHeader(i))}if(this.#t?s=f(n=v(JSON.stringify(this.#t))):(n="",s=new Uint8Array),this.#a){let t=f(l=v(this.#a));i=u(s,f("."),t)}else i=s;let h=this.#e;"DEF"===c.zip&&(h=await ti(h).catch(t=>{throw new O("Failed to compress plaintext",{cause:t})}));let{ciphertext:m,tag:y,iv:g}=await ea(p,h,a,this.#n,i),_={ciphertext:v(m)};return g&&(_.iv=v(g)),y&&(_.tag=v(y)),o&&(_.encrypted_key=v(o)),l&&(_.aad=l),this.#t&&(_.protected=n),this.#r&&(_.unprotected=this.#r),this.#o&&(_.header=this.#o),_}}class td{#l;unprotectedHeader;keyManagementParameters;key;options;constructor(t,r,o){this.#l=t,this.key=r,this.options=o}setUnprotectedHeader(t){return es(this.unprotectedHeader,"setUnprotectedHeader"),this.unprotectedHeader=t,this}setKeyManagementParameters(t){return es(this.keyManagementParameters,"setKeyManagementParameters"),this.keyManagementParameters=t,this}addRecipient(...t){return this.#l.addRecipient(...t)}encrypt(...t){return this.#l.encrypt(...t)}done(){return this.#l}}class tp{#e;#c=[];#t;#o;#a;constructor(t){this.#e=t}addRecipient(t,r){let o=new td(this,t,{crit:r?.crit});return this.#c.push(o),o}setProtectedHeader(t){return es(this.#t,"setProtectedHeader"),this.#t=t,this}setSharedUnprotectedHeader(t){return es(this.#o,"setSharedUnprotectedHeader"),this.#o=t,this}setAdditionalAuthenticatedData(t){return this.#a=t,this}async encrypt(){let t;if(!this.#c.length)throw new O("at least one recipient must be added");if(1===this.#c.length){let[t]=this.#c,r=await new tu(this.#e).setAdditionalAuthenticatedData(this.#a).setProtectedHeader(this.#t).setSharedUnprotectedHeader(this.#o).setUnprotectedHeader(t.unprotectedHeader).encrypt(t.key,{...t.options}),o={ciphertext:r.ciphertext,iv:r.iv,recipients:[{}],tag:r.tag};return r.aad&&(o.aad=r.aad),r.protected&&(o.protected=r.protected),r.unprotected&&(o.unprotected=r.unprotected),r.encrypted_key&&(o.recipients[0].encrypted_key=r.encrypted_key),r.header&&(o.recipients[0].header=r.header),o}for(let r=0;r<this.#c.length;r++){let o=this.#c[r];if(!ed(this.#t,this.#o,o.unprotectedHeader))throw new O("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");let a={...this.#t,...this.#o,...o.unprotectedHeader},{alg:i}=a;if("string"!=typeof i||!i)throw new O('JWE "alg" (Algorithm) Header Parameter missing or invalid');if("dir"===i||"ECDH-ES"===i)throw new O('"dir" and "ECDH-ES" alg may only be used with a single recipient');if("string"!=typeof a.enc||!a.enc)throw new O('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');if(t){if(t!==a.enc)throw new O('JWE "enc" (Encryption Algorithm) Header Parameter must be the same for all recipients')}else t=a.enc;if(e7(O,new Map,o.options.crit,this.#t,a),void 0!==a.zip&&"DEF"!==a.zip)throw new A('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(void 0!==a.zip&&!this.#t?.zip)throw new O('JWE "zip" (Compression Algorithm) Header Parameter MUST be in a protected header.')}let r=W(t),o={ciphertext:"",recipients:[]};for(let a=0;a<this.#c.length;a++){let i=this.#c[a],n={};if(o.recipients.push(n),0===a){let t=await new tu(this.#e).setAdditionalAuthenticatedData(this.#a).setContentEncryptionKey(r).setProtectedHeader(this.#t).setSharedUnprotectedHeader(this.#o).setUnprotectedHeader(i.unprotectedHeader).setKeyManagementParameters(i.keyManagementParameters).encrypt(i.key,{...i.options,[en]:!0});o.ciphertext=t.ciphertext,o.iv=t.iv,o.tag=t.tag,t.aad&&(o.aad=t.aad),t.protected&&(o.protected=t.protected),t.unprotected&&(o.unprotected=t.unprotected),n.encrypted_key=t.encrypted_key,t.header&&(n.header=t.header);continue}let s=i.unprotectedHeader?.alg||this.#t?.alg||this.#o?.alg;to("dir"===s?t:s,i.key,"encrypt");let l=await eM(i.key,s),{encryptedKey:c,parameters:u}=await e8(s,t,l,r,i.keyManagementParameters);n.encrypted_key=v(c),(i.unprotectedHeader||u)&&(n.header={...i.unprotectedHeader,...u})}return o}}async function th(t,r,o){if(!eu(t))throw new j("Flattened JWS must be an object");if(void 0===t.protected&&void 0===t.header)throw new j('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==t.protected&&"string"!=typeof t.protected)throw new j("JWS Protected Header incorrect type");if(void 0===t.payload)throw new j("JWS Payload missing");if("string"!=typeof t.signature)throw new j("JWS Signature missing or incorrect type");if(void 0!==t.header&&!eu(t.header))throw new j("JWS Unprotected Header incorrect type");let a={};if(t.protected)try{let r=g(t.protected);a=JSON.parse(c.decode(r))}catch{throw new j("JWS Protected Header is invalid")}if(!ed(a,t.header))throw new j("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let i={...a,...t.header},n=e7(j,new Map([["b64",!0]]),o?.crit,a,i),s=!0;if(n.has("b64")&&"boolean"!=typeof(s=a.b64))throw new j('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:d}=i;if("string"!=typeof d||!d)throw new j('JWS "alg" (Algorithm) Header Parameter missing or invalid');let p=o&&te("algorithms",o.algorithms);if(p&&!p.has(d))throw new C('"alg" (Algorithm) Header Parameter value not allowed');if(s){if("string"!=typeof t.payload)throw new j("JWS Payload must be a string")}else if("string"!=typeof t.payload&&!(t.payload instanceof Uint8Array))throw new j("JWS Payload must be a string or an Uint8Array instance");let h=!1;"function"==typeof r&&(r=await r(a,t),h=!0),to(d,r,"verify");let m=u(void 0!==t.protected?f(t.protected):new Uint8Array,f("."),"string"==typeof t.payload?s?f(t.payload):l.encode(t.payload):t.payload),y=el(t.signature,"signature",j),v=await eM(r,d);if(!await ex(d,v,y,m))throw new U;let _={payload:s?el(t.payload,"payload",j):"string"==typeof t.payload?l.encode(t.payload):t.payload};return(void 0!==t.protected&&(_.protectedHeader=a),void 0!==t.header&&(_.unprotectedHeader=t.header),h)?{..._,key:v}:_}async function tf(t,r,o){if(t instanceof Uint8Array&&(t=c.decode(t)),"string"!=typeof t)throw new j("Compact JWS must be a string or Uint8Array");let{0:a,1:i,2:n,length:s}=t.split(".");if(3!==s)throw new j("Invalid Compact JWS");let l=await th({payload:i,protected:a,signature:n},r,o),u={payload:l.payload,protectedHeader:l.protectedHeader};return"function"==typeof r?{...u,key:l.key}:u}async function tm(t,r,o){if(!eu(t))throw new j("General JWS must be an object");if(!Array.isArray(t.signatures)||!t.signatures.every(eu))throw new j("JWS Signatures missing or incorrect type");for(let a of t.signatures)try{return await th({header:a.header,payload:t.payload,protected:a.protected,signature:a.signature},r,o)}catch{}throw new U}let ty=t=>Math.floor(t.getTime()/1e3),tg=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function tv(t){let r,o=tg.exec(t);if(!o||o[4]&&o[1])throw TypeError("Invalid time period format");let a=parseFloat(o[2]);switch(o[3].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":r=Math.round(a);break;case"minute":case"minutes":case"min":case"mins":case"m":r=Math.round(60*a);break;case"hour":case"hours":case"hr":case"hrs":case"h":r=Math.round(3600*a);break;case"day":case"days":case"d":r=Math.round(86400*a);break;case"week":case"weeks":case"w":r=Math.round(604800*a);break;default:r=Math.round(0x1e187e0*a)}return"-"===o[1]||"ago"===o[4]?-r:r}function t_(t,r){if(!Number.isFinite(r))throw TypeError(`Invalid ${t} input`);return r}let tb=t=>t.includes("/")?t.toLowerCase():`application/${t.toLowerCase()}`;function tS(t,r,o={}){var a,i;let n,s;try{n=JSON.parse(c.decode(r))}catch{}if(!eu(n))throw new I("JWT Claims Set must be a top-level JSON object");let{typ:l}=o;if(l&&("string"!=typeof t.typ||tb(t.typ)!==tb(l)))throw new R('unexpected "typ" JWT header value',n,"typ","check_failed");let{requiredClaims:u=[],issuer:d,subject:p,audience:h,maxTokenAge:f}=o,m=[...u];for(let t of(void 0!==f&&m.push("iat"),void 0!==h&&m.push("aud"),void 0!==p&&m.push("sub"),void 0!==d&&m.push("iss"),new Set(m.reverse())))if(!(t in n))throw new R(`missing required "${t}" claim`,n,t,"missing");if(d&&!(Array.isArray(d)?d:[d]).includes(n.iss))throw new R('unexpected "iss" claim value',n,"iss","check_failed");if(p&&n.sub!==p)throw new R('unexpected "sub" claim value',n,"sub","check_failed");if(h&&(a=n.aud,i="string"==typeof h?[h]:h,"string"==typeof a?!i.includes(a):!(Array.isArray(a)&&i.some(Set.prototype.has.bind(new Set(a))))))throw new R('unexpected "aud" claim value',n,"aud","check_failed");switch(typeof o.clockTolerance){case"string":s=tv(o.clockTolerance);break;case"number":s=o.clockTolerance;break;case"undefined":s=0;break;default:throw TypeError("Invalid clockTolerance option type")}let{currentDate:y}=o,g=ty(y||new Date);if((void 0!==n.iat||f)&&"number"!=typeof n.iat)throw new R('"iat" claim must be a number',n,"iat","invalid");if(void 0!==n.nbf){if("number"!=typeof n.nbf)throw new R('"nbf" claim must be a number',n,"nbf","invalid");if(n.nbf>g+s)throw new R('"nbf" claim timestamp check failed',n,"nbf","check_failed")}if(void 0!==n.exp){if("number"!=typeof n.exp)throw new R('"exp" claim must be a number',n,"exp","invalid");if(n.exp<=g-s)throw new x('"exp" claim timestamp check failed',n,"exp","check_failed")}if(f){let t=g-n.iat;if(t-s>("number"==typeof f?f:tv(f)))throw new x('"iat" claim timestamp check failed (too far in the past)',n,"iat","check_failed");if(t<0-s)throw new R('"iat" claim timestamp check failed (it should be in the past)',n,"iat","check_failed")}return n}class tw{#u;constructor(t){if(!eu(t))throw TypeError("JWT Claims Set MUST be an object");this.#u=structuredClone(t)}data(){return l.encode(JSON.stringify(this.#u))}get iss(){return this.#u.iss}set iss(t){this.#u.iss=t}get sub(){return this.#u.sub}set sub(t){this.#u.sub=t}get aud(){return this.#u.aud}set aud(t){this.#u.aud=t}set jti(t){this.#u.jti=t}set nbf(t){"number"==typeof t?this.#u.nbf=t_("setNotBefore",t):t instanceof Date?this.#u.nbf=t_("setNotBefore",ty(t)):this.#u.nbf=ty(new Date)+tv(t)}set exp(t){"number"==typeof t?this.#u.exp=t_("setExpirationTime",t):t instanceof Date?this.#u.exp=t_("setExpirationTime",ty(t)):this.#u.exp=ty(new Date)+tv(t)}set iat(t){void 0===t?this.#u.iat=ty(new Date):t instanceof Date?this.#u.iat=t_("setIssuedAt",ty(t)):"string"==typeof t?this.#u.iat=t_("setIssuedAt",ty(new Date)+tv(t)):this.#u.iat=t_("setIssuedAt",t)}}async function t$(t,r,o){let a=await tf(t,r,o);if(a.protectedHeader.crit?.includes("b64")&&!1===a.protectedHeader.b64)throw new I("JWTs MUST NOT use unencoded payload");let i={payload:tS(a.protectedHeader,a.payload,o),protectedHeader:a.protectedHeader};return"function"==typeof r?{...i,key:a.key}:i}async function tE(t,r,o){let a=await tl(t,r,o),i=tS(a.protectedHeader,a.plaintext,o),{protectedHeader:n}=a;if(void 0!==n.iss&&n.iss!==i.iss)throw new R('replicated "iss" claim header parameter mismatch',i,"iss","mismatch");if(void 0!==n.sub&&n.sub!==i.sub)throw new R('replicated "sub" claim header parameter mismatch',i,"sub","mismatch");if(void 0!==n.aud&&JSON.stringify(n.aud)!==JSON.stringify(i.aud))throw new R('replicated "aud" claim header parameter mismatch',i,"aud","mismatch");let s={payload:i,protectedHeader:n};return"function"==typeof r?{...s,key:a.key}:s}class tP{#d;constructor(t){this.#d=new tu(t)}setContentEncryptionKey(t){return this.#d.setContentEncryptionKey(t),this}setInitializationVector(t){return this.#d.setInitializationVector(t),this}setProtectedHeader(t){return this.#d.setProtectedHeader(t),this}setKeyManagementParameters(t){return this.#d.setKeyManagementParameters(t),this}async encrypt(t,r){let o=await this.#d.encrypt(t,r);return[o.protected,o.encrypted_key,o.iv,o.ciphertext,o.tag].join(".")}}class tk{#u;#t;#o;constructor(t){if(!(t instanceof Uint8Array))throw TypeError("payload must be an instance of Uint8Array");this.#u=t}setProtectedHeader(t){return es(this.#t,"setProtectedHeader"),this.#t=t,this}setUnprotectedHeader(t){return es(this.#o,"setUnprotectedHeader"),this.#o=t,this}async sign(t,r){let o,a,i,n;if(!this.#t&&!this.#o)throw new j("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!ed(this.#t,this.#o))throw new j("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let s={...this.#t,...this.#o},l=e7(j,new Map([["b64",!0]]),r?.crit,this.#t,s),c=!0;if(l.has("b64")&&"boolean"!=typeof(c=this.#t.b64))throw new j('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:d}=s;if("string"!=typeof d||!d)throw new j('JWS "alg" (Algorithm) Header Parameter missing or invalid');to(d,t,"sign"),c?a=f(o=v(this.#u)):(a=this.#u,o=""),this.#t?n=f(i=v(JSON.stringify(this.#t))):(i="",n=new Uint8Array);let p=u(n,f("."),a),h=await eM(t,d),m={signature:v(await eR(d,h,p)),payload:o};return this.#o&&(m.header=this.#o),this.#t&&(m.protected=i),m}}class tR{#d;constructor(t){this.#d=new tk(t)}setProtectedHeader(t){return this.#d.setProtectedHeader(t),this}async sign(t,r){let o=await this.#d.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}`}}class tx{#l;protectedHeader;unprotectedHeader;options;key;constructor(t,r,o){this.#l=t,this.key=r,this.options=o}setProtectedHeader(t){return es(this.protectedHeader,"setProtectedHeader"),this.protectedHeader=t,this}setUnprotectedHeader(t){return es(this.unprotectedHeader,"setUnprotectedHeader"),this.unprotectedHeader=t,this}addSignature(...t){return this.#l.addSignature(...t)}sign(...t){return this.#l.sign(...t)}done(){return this.#l}}class tC{#u;#p=[];constructor(t){this.#u=t}addSignature(t,r){let o=new tx(this,t,r);return this.#p.push(o),o}async sign(){if(!this.#p.length)throw new j("at least one signature must be added");let t={signatures:[],payload:""};for(let r=0;r<this.#p.length;r++){let o=this.#p[r],a=new tk(this.#u);a.setProtectedHeader(o.protectedHeader),a.setUnprotectedHeader(o.unprotectedHeader);let{payload:i,...n}=await a.sign(o.key,o.options);if(0===r)t.payload=i;else if(t.payload!==i)throw new j("inconsistent use of JWS Unencoded Payload (RFC7797)");t.signatures.push(n)}return t}}class tA{#t;#h;constructor(t={}){this.#h=new tw(t)}setIssuer(t){return this.#h.iss=t,this}setSubject(t){return this.#h.sub=t,this}setAudience(t){return this.#h.aud=t,this}setJti(t){return this.#h.jti=t,this}setNotBefore(t){return this.#h.nbf=t,this}setExpirationTime(t){return this.#h.exp=t,this}setIssuedAt(t){return this.#h.iat=t,this}setProtectedHeader(t){return this.#t=t,this}async sign(t,r){let o=new tR(this.#h.data());if(o.setProtectedHeader(this.#t),Array.isArray(this.#t?.crit)&&this.#t.crit.includes("b64")&&!1===this.#t.b64)throw new I("JWTs MUST NOT use unencoded payload");return o.sign(t,r)}}class tT{#i;#n;#s;#t;#f;#m;#y;#h;constructor(t={}){this.#h=new tw(t)}setIssuer(t){return this.#h.iss=t,this}setSubject(t){return this.#h.sub=t,this}setAudience(t){return this.#h.aud=t,this}setJti(t){return this.#h.jti=t,this}setNotBefore(t){return this.#h.nbf=t,this}setExpirationTime(t){return this.#h.exp=t,this}setIssuedAt(t){return this.#h.iat=t,this}setProtectedHeader(t){return es(this.#t,"setProtectedHeader"),this.#t=t,this}setKeyManagementParameters(t){return es(this.#s,"setKeyManagementParameters"),this.#s=t,this}setContentEncryptionKey(t){return es(this.#i,"setContentEncryptionKey"),this.#i=t,this}setInitializationVector(t){return es(this.#n,"setInitializationVector"),this.#n=t,this}replicateIssuerAsHeader(){return this.#f=!0,this}replicateSubjectAsHeader(){return this.#m=!0,this}replicateAudienceAsHeader(){return this.#y=!0,this}async encrypt(t,r){let o=new tP(this.#h.data());return this.#t&&(this.#f||this.#m||this.#y)&&(this.#t={...this.#t,iss:this.#f?this.#h.iss:void 0,sub:this.#m?this.#h.sub:void 0,aud:this.#y?this.#h.aud:void 0}),o.setProtectedHeader(this.#t),this.#n&&o.setInitializationVector(this.#n),this.#i&&o.setContentEncryptionKey(this.#i),this.#s&&o.setKeyManagementParameters(this.#s),o.encrypt(t,r)}}let tO=(t,r)=>{if("string"!=typeof t||!t)throw new N(`${r} missing or invalid`)};async function tj(t,r){let o,a;if(ep(t))o=t;else if(J(t))o=await e2(t);else throw TypeError(E(t,"CryptoKey","KeyObject","JSON Web Key"));if("sha256"!==(r??="sha256")&&"sha384"!==r&&"sha512"!==r)throw TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"');switch(o.kty){case"AKP":tO(o.alg,'"alg" (Algorithm) Parameter'),tO(o.pub,'"pub" (Public key) Parameter'),a={alg:o.alg,kty:o.kty,pub:o.pub};break;case"EC":tO(o.crv,'"crv" (Curve) Parameter'),tO(o.x,'"x" (X Coordinate) Parameter'),tO(o.y,'"y" (Y Coordinate) Parameter'),a={crv:o.crv,kty:o.kty,x:o.x,y:o.y};break;case"OKP":tO(o.crv,'"crv" (Subtype of Key Pair) Parameter'),tO(o.x,'"x" (Public Key) Parameter'),a={crv:o.crv,kty:o.kty,x:o.x};break;case"RSA":tO(o.e,'"e" (Exponent) Parameter'),tO(o.n,'"n" (Modulus) Parameter'),a={e:o.e,kty:o.kty,n:o.n};break;case"oct":tO(o.k,'"k" (Key Value) Parameter'),a={k:o.k,kty:o.kty};break;default:throw new A('"kty" (Key Type) Parameter missing or unsupported')}let i=f(JSON.stringify(a));return v(await ec(r,i))}async function tI(t,r){r??="sha256";let o=await tj(t,r);return`urn:ietf:params:oauth:jwk-thumbprint:sha-${r.slice(-3)}:${o}`}async function tN(t,r){let o={...t,...r?.header};if(!eu(o.jwk))throw new j('"jwk" (JSON Web Key) Header Parameter must be a JSON object');let a=await eY({...o.jwk,ext:!0},o.alg);if(a instanceof Uint8Array||"public"!==a.type)throw new j('"jwk" (JSON Web Key) Header Parameter must be a public key');return a}function tM(t){return eu(t)}class tz{#g;#v=new WeakMap;constructor(t){if(!function(t){return t&&"object"==typeof t&&Array.isArray(t.keys)&&t.keys.every(tM)}(t))throw new M("JSON Web Key Set malformed");this.#g=structuredClone(t)}jwks(){return this.#g}async getKey(t,r){let{alg:o,kid:a}={...t,...r?.header},i=function(t){switch("string"==typeof t&&t.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";case"ML":return"AKP";default:throw new A('Unsupported "alg" value for a JSON Web Key Set')}}(o),n=this.#g.keys.filter(t=>{let r=i===t.kty;if(r&&"string"==typeof a&&(r=a===t.kid),r&&("string"==typeof t.alg||"AKP"===i)&&(r=o===t.alg),r&&"string"==typeof t.use&&(r="sig"===t.use),r&&Array.isArray(t.key_ops)&&(r=t.key_ops.includes("verify")),r)switch(o){case"ES256":r="P-256"===t.crv;break;case"ES384":r="P-384"===t.crv;break;case"ES512":r="P-521"===t.crv;break;case"Ed25519":case"EdDSA":r="Ed25519"===t.crv}return r}),{0:s,length:l}=n;if(0===l)throw new z;if(1!==l){let t=new q,r=this.#v;throw t[Symbol.asyncIterator]=async function*(){for(let t of n)try{yield await tq(r,t,o)}catch{}},t}return tq(this.#v,s,o)}}async function tq(t,r,o){let a=t.get(r)||t.set(r,{}).get(r);if(void 0===a[o]){let t=await eY({...r,ext:!0},o);if(t instanceof Uint8Array||"public"!==t.type)throw new M("JSON Web Key Set members must be public keys");a[o]=t}return a[o]}function tH(t){let r=new tz(t),o=async(t,o)=>r.getKey(t,o);return Object.defineProperties(o,{jwks:{value:()=>structuredClone(r.jwks()),enumerable:!1,configurable:!1,writable:!1}}),o}"undefined"!=typeof navigator&&navigator.userAgent?.startsWith?.("Mozilla/5.0 ")||(i="jose/v6.2.3");let tU=Symbol();async function tD(t,r,o,a=fetch){let i=await a(t,{method:"GET",signal:o,redirect:"manual",headers:r}).catch(t=>{if("TimeoutError"===t.name)throw new H;throw t});if(200!==i.status)throw new k("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await i.json()}catch{throw new k("Failed to parse the JSON Web Key Set HTTP response as JSON")}}let tL=Symbol();class tK{#_;#b;#S;#w;#$;#E;#P;#k;#R;#x;constructor(t,r){if(!(t instanceof URL))throw TypeError("url must be an instance of URL");this.#_=new URL(t.href),this.#b="number"==typeof r?.timeoutDuration?r?.timeoutDuration:5e3,this.#S="number"==typeof r?.cooldownDuration?r?.cooldownDuration:3e4,this.#w="number"==typeof r?.cacheMaxAge?r?.cacheMaxAge:6e5,this.#P=new Headers(r?.headers),i&&!this.#P.has("User-Agent")&&this.#P.set("User-Agent",i),this.#P.has("accept")||(this.#P.set("accept","application/json"),this.#P.append("accept","application/jwk-set+json")),this.#k=r?.[tU],r?.[tL]!==void 0&&(this.#x=r?.[tL],function(t,r){return!("object"!=typeof t||null===t||!("uat"in t)||"number"!=typeof t.uat||Date.now()-t.uat>=r)&&"jwks"in t&&!!eu(t.jwks)&&!!Array.isArray(t.jwks.keys)&&!!Array.prototype.every.call(t.jwks.keys,eu)}(r?.[tL],this.#w)&&(this.#$=this.#x.uat,this.#R=tH(this.#x.jwks)))}pendingFetch(){return!!this.#E}coolingDown(){return"number"==typeof this.#$&&Date.now()<this.#$+this.#S}fresh(){return"number"==typeof this.#$&&Date.now()<this.#$+this.#w}jwks(){return this.#R?.jwks()}async getKey(t,r){this.#R&&this.fresh()||await this.reload();try{return await this.#R(t,r)}catch(o){if(o instanceof z&&!1===this.coolingDown())return await this.reload(),this.#R(t,r);throw o}}async reload(){this.#E&&("undefined"!=typeof WebSocketPair||"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||"undefined"!=typeof EdgeRuntime&&"vercel"===EdgeRuntime)&&(this.#E=void 0),this.#E||=tD(this.#_.href,this.#P,AbortSignal.timeout(this.#b),this.#k).then(t=>{this.#R=tH(t),this.#x&&(this.#x.uat=Date.now(),this.#x.jwks=t),this.#$=Date.now(),this.#E=void 0}).catch(t=>{throw this.#E=void 0,t}),await this.#E}}function tJ(t,r){let o=new tK(t,r),a=async(t,r)=>o.getKey(t,r);return Object.defineProperties(a,{coolingDown:{get:()=>o.coolingDown(),enumerable:!0,configurable:!1},fresh:{get:()=>o.fresh(),enumerable:!0,configurable:!1},reload:{value:()=>o.reload(),enumerable:!0,configurable:!1,writable:!1},reloading:{get:()=>o.pendingFetch(),enumerable:!0,configurable:!1},jwks:{value:()=>o.jwks(),enumerable:!0,configurable:!1,writable:!1}}),a}class tV{#h;constructor(t={}){this.#h=new tw(t)}encode(){let t=v(JSON.stringify({alg:"none"})),r=v(this.#h.data());return`${t}.${r}.`}setIssuer(t){return this.#h.iss=t,this}setSubject(t){return this.#h.sub=t,this}setAudience(t){return this.#h.aud=t,this}setJti(t){return this.#h.jti=t,this}setNotBefore(t){return this.#h.nbf=t,this}setExpirationTime(t){return this.#h.exp=t,this}setIssuedAt(t){return this.#h.iat=t,this}static decode(t,r){let o;if("string"!=typeof t)throw new I("Unsecured JWT must be a string");let{0:a,1:i,2:n,length:s}=t.split(".");if(3!==s||""!==n)throw new I("Invalid Unsecured JWT");try{if(o=JSON.parse(c.decode(g(a))),"none"!==o.alg)throw Error()}catch{throw new I("Invalid Unsecured JWT")}return{payload:tS(o,g(i),r),header:o}}}function tW(t){let r;if("string"==typeof t){let o=t.split(".");(3===o.length||5===o.length)&&([r]=o)}else if("object"==typeof t&&t)if("protected"in t)r=t.protected;else throw TypeError("Token does not contain a Protected Header");try{if("string"!=typeof r||!r)throw Error();let t=JSON.parse(c.decode(g(r)));if(!eu(t))throw Error();return t}catch{throw TypeError("Invalid Token or Protected Header formatting")}}function tF(t){let r,o;if("string"!=typeof t)throw new I("JWTs must use Compact JWS serialization, JWT must be a string");let{1:a,length:i}=t.split(".");if(5===i)throw new I("Only JWTs using Compact JWS serialization can be decoded");if(3!==i)throw new I("Invalid JWT");if(!a)throw new I("JWTs must contain a payload");try{r=g(a)}catch{throw new I("Failed to base64url decode the payload")}try{o=JSON.parse(c.decode(r))}catch{throw new I("Failed to parse the decoded payload as JSON")}if(!eu(o))throw new I("Invalid JWT Claims Set");return o}function tB(t){let r=t?.modulusLength??2048;if("number"!=typeof r||r<2048)throw new A("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");return r}async function tZ(t,r){let o,a;switch(t){case"PS256":case"PS384":case"PS512":o={name:"RSA-PSS",hash:`SHA-${t.slice(-3)}`,publicExponent:Uint8Array.of(1,0,1),modulusLength:tB(r)},a=["sign","verify"];break;case"RS256":case"RS384":case"RS512":o={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${t.slice(-3)}`,publicExponent:Uint8Array.of(1,0,1),modulusLength:tB(r)},a=["sign","verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":o={name:"RSA-OAEP",hash:`SHA-${parseInt(t.slice(-3),10)||1}`,publicExponent:Uint8Array.of(1,0,1),modulusLength:tB(r)},a=["decrypt","unwrapKey","encrypt","wrapKey"];break;case"ES256":o={name:"ECDSA",namedCurve:"P-256"},a=["sign","verify"];break;case"ES384":o={name:"ECDSA",namedCurve:"P-384"},a=["sign","verify"];break;case"ES512":o={name:"ECDSA",namedCurve:"P-521"},a=["sign","verify"];break;case"Ed25519":case"EdDSA":a=["sign","verify"],o={name:"Ed25519"};break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":a=["sign","verify"],o={name:t};break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{a=["deriveBits"];let t=r?.crv??"P-256";switch(t){case"P-256":case"P-384":case"P-521":o={name:"ECDH",namedCurve:t};break;case"X25519":o={name:"X25519"};break;default:throw new A("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, and X25519")}break}default:throw new A('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}return crypto.subtle.generateKey(o,r?.extractable??!1,a)}async function tG(t,r){let o,a,i;switch(t){case"HS256":case"HS384":case"HS512":o=parseInt(t.slice(-3),10),a={name:"HMAC",hash:`SHA-${o}`,length:o},i=["sign","verify"];break;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return o=parseInt(t.slice(-3),10),crypto.getRandomValues(new Uint8Array(o>>3));case"A128KW":case"A192KW":case"A256KW":a={name:"AES-KW",length:o=parseInt(t.slice(1,4),10)},i=["wrapKey","unwrapKey"];break;case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":case"A128GCM":case"A192GCM":case"A256GCM":a={name:"AES-GCM",length:o=parseInt(t.slice(1,4),10)},i=["encrypt","decrypt"];break;default:throw new A('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}return crypto.subtle.generateKey(a,r?.extractable??!1,i)}let tX="WebCryptoAPI"},8330(t){"use strict";t.exports=JSON.parse('{"name":"xmcp","description":"The MCP framework","version":"1.7.1","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.2.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.2.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}}}')}},a={};function i(t){var r=a[t];if(void 0!==r)return r.exports;var n=a[t]={exports:{}};return o[t](n,n.exports,i),n.exports}r=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,i.t=function(o,a){if(1&a&&(o=this(o)),8&a||"object"==typeof o&&o&&(4&a&&o.__esModule||16&a&&"function"==typeof o.then))return o;var n=Object.create(null);i.r(n);var s={};t=t||[null,r({}),r([]),r(r)];for(var l=2&a&&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,i.d(n,s),n},i.d=(t,r)=>{for(var o in r)i.o(r,o)&&!i.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},i.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r),i.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,a,s,l,c,u,d,p,h,f,m,y,g,v,_,b,S,w;i.r(n),i.d(n,{createClient:()=>h$,withClient:()=>hE});var $,E,P,k,R,x,C,A,T=Object.create,O=Object.defineProperty,j=Object.getOwnPropertyDescriptor,I=Object.getOwnPropertyNames,N=Object.getPrototypeOf,M=Object.prototype.hasOwnProperty,z=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports),q=(t,r,o)=>(o=null!=t?T(N(t)):{},((t,r,o,a)=>{if(r&&"object"==typeof r||"function"==typeof r)for(var i,n=I(r),s=0,l=n.length;s<l;s++)i=n[s],M.call(t,i)||i===o||O(t,i,{get:(t=>r[t]).bind(null,i),enumerable:!(a=j(r,i))||a.enumerable});return t})(!r&&t&&t.__esModule?o:O(o,"default",{value:t,enumerable:!0}),t));let H=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),U=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),D=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),L=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function K(t){let r=Object.values(t).filter(t=>"number"==typeof t);return Object.entries(t).filter(([t,o])=>-1===r.indexOf(+t)).map(([t,r])=>r)}function J(t,r="|"){return t.map(t=>ep(t)).join(r)}function V(t,r){return"bigint"==typeof r?r.toString():r}class W{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return void 0!==t&&(this._value=t(),this._getter=void 0),this._value}}function F(t){return new W(t)}function B(t){let r=+!!t.startsWith("^"),o=t.endsWith("$")?t.length-1:t.length;return t.slice(r,o)}let Z=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,a){let i=Y(r);for(let n of o){let o=Object.getOwnPropertyDescriptor(i,n);o.enumerable&&(o.get?Q(t,n,()=>{let t=r._zod.def.shape[n];return a?a(t,n):t}):ee(t,n,a?a(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 ea(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}let ei=F(()=>{if(eq.jitless||"undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(t){return!1}});function en(t){if(!1===ea(t))return!1;let r=t.constructor;if(void 0===r||"function"!=typeof r)return!0;let o=r.prototype;return!1!==ea(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 a=new t._zod.constr(r??t._zod.def);return(!r||o?.parent)&&(a._zod.parent=t),a}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]},ef={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function em(t,r){let o=Y(t),a=[];for(let t of Reflect.ownKeys(r)){if(!Object.getOwnPropertyDescriptor(o,t)?.enumerable)throw Error(`Unrecognized key: "${String(t)}"`);r[t]&&a.push(t)}return a}function ey(t,r){let o={};et(o,t,Reflect.ownKeys(Y(t)));var a=o,i=r;for(let t of Reflect.ownKeys(i)){let r=Object.getOwnPropertyDescriptor(i,t);r.enumerable&&(r.get?Q(a,t,()=>i[t]):ee(a,t,r.value))}return o}function eg(t,r,o,a="partial"){let i=r._zod.def.checks;if(i&&i.length>0)throw Error(`.${a}() cannot be used on object schemas containing refinements`);let n=o?new Set(em(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 a;for(let i=r;i<t.length;i++)(a=t[i]).schema??(a.schema=o)}function ew(t,r,o){let a=t.inst?._zod?.traits;a?.has("$ZodType")&&(a.has("$ZodCheck")?t.schema??(t.schema=t.inst):t.schema=t.inst);let i=t.schema!==t.inst?t.schema?._zod.def?.error:void 0,n=t.message?t.message:eb(t.inst?._zod.def?.error?.(t))??eb(i?.(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 eE(t){let r=t.length;if(!e$.test(t))return r;let o=r;for(let a=0;a<r-1;a++)(64512&t.charCodeAt(a))==55296&&(64512&t.charCodeAt(a+1))==56320&&(o--,a++);return o}function eP(t){return Array.isArray(t)?"array":"string"==typeof t?"string":"unknown"}function ek(...t){let[r,o,a]=t;return"string"==typeof r?{message:r,code:"custom",input:o,inst:a}:{...r}}function eR(t,r,o,a=!0){return Object.defineProperty(t,r,{configurable:!0,writable:!0,enumerable:a,value:o}),o}function ex(t,r){for(let o in t){let a=t[o];Object.defineProperty(r,o,{configurable:!0,enumerable:!0,get(){return eR(this,o,a(this))},set(t){eR(this,o,t)}})}return r}let eC=!1,eA={configurable:!0,get(){eC=!0}};function eT(r,o,a){let i=Object.getPrototypeOf(r._zod);if(o in i&&t!==r._zod){t=void 0;return}t=r._zod,Object.defineProperty(i,o,{configurable:!0,get(){Object.defineProperty(this,o,eA);let t=eC;eC=!1;try{let r=a(this);return eC?delete this[o]:Object.defineProperty(this,o,{configurable:!0,writable:!0,value:r}),eC=eC||t,r}catch(r){throw delete this[o],eC=eC||t,r}},set(t){Object.defineProperty(this,o,{configurable:!0,writable:!0,value:t})}})}let eO=Object.freeze({status:"aborted"}),ej={value:void 0,enumerable:!1},eI="captureStackTrace"in Error?Error:null;function eN(t,r,o,a){function i(t){this.def=t,this.constr=u,this.traits=new Set}i.prototype={};let n=o&&new WeakSet;function s(a,s){if(a._zod){if(a._zod.traits.has(t))return}else{ej.value=new i(s);try{Object.defineProperty(a,"_zod",ej)}finally{ej.value=void 0}}if(a._zod.traits.add(t),r(a,s),n){let t=Object.getPrototypeOf(a),r=a._zod.constr.prototype,i=t;for(;i&&i!==r;)i=Object.getPrototypeOf(i);let s=i??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:eR(this,r,o.bind(this))},set(t){eR(this,r,t)}})}(l,t,r.value)}}}let d=u.prototype;for(let t in d)Object.prototype.hasOwnProperty.call(d,t)&&(t in a||(a[t]=d[t].bind(a)))}let l=a?.Parent??Object;class c extends l{}function u(t){let r=a?.Parent?function(t){let r=eI;if(r){let o=r.stackTraceLimit;if("number"==typeof o){try{r.stackTraceLimit=0}catch{return eI=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 i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(r),r}return Object.defineProperty(c,"name",{value:t}),Object.defineProperty(u,"init",{value:s}),Object.defineProperty(u,Symbol.hasInstance,{value:r=>!!a?.Parent&&r instanceof a.Parent||r?._zod?.traits?.has(t)}),Object.defineProperty(u,"name",{value:t}),u}class eM extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ez extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(x=globalThis).__zod_globalConfig??(x.__zod_globalConfig={});let eq=globalThis.__zod_globalConfig;function eH(t){return t&&Object.assign(eq,t),eq}class eU extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}let eD="~memo",eL=[];function eK(t){return null!==t&&"object"==typeof t}function eJ(t){return t.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}let eV=new WeakMap,eW=[],eF={alloc(t,o,a){let i=r;if(!i)return a;r=void 0;let n={value:a,issues:null};return i.set(o.value,n),eW.push(n),a},guard(t){var r;(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred.push(()=>{let r=t._zod.parse,o=(t,o)=>{var a,i;let n;if("backward"!==o.direction&&(a=o,i=t.value,void 0!==(n=a[eD]?.backEdges)&&eK(i)&&n.has(i)))throw new eU;return r(t,o)};t._zod.parse=o,t._zod.run===r&&(t._zod.run=o)})},attach(t){var o;let a,i,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===a){let r=function t(r,o,a){var i,n;let s=eV.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 i=t(r,o,a);i>l&&(l=i)}},u=t=>{t>l&&(l=t)},d=r._zod.def;switch(d.type){case"object":{let r=X(d);u(r?((r,i)=>{let n=0;for(let s of Reflect.ownKeys(r)){let l=Object.getOwnPropertyDescriptor(r,s);if(i&&!l.enumerable)continue;let c=l.get?1:l.value?._zod?t(l.value,o,a):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 i=d._cachedInner??(a?r._zod.innerType:void 0);u(i?t(i,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),i=r,1!==(n=l)&&eV.set(i,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?a=!0:s=!0}let p=c.value;if(!eK(p))return o(c,u);let h=u[eD];if(h||(h={buckets:new WeakMap,backEdges:void 0},u[eD]=h),i===u)d=n;else{var f,m;let r;f=h,m=t,(r=f.buckets.get(m))||(r=new WeakMap,f.buckets.set(m,r)),d=r,i=u,n=d}let y=d.get(p);if(y)return c.value=y.value,y.issues?y.issues.length&&c.issues.push(...eJ(y.issues)):(c.memo=!0,h.backEdges??(h.backEdges=new WeakSet),h.backEdges.add(y.value)),c;r=d;let g=eW.length,v=o(c,u);r=void 0;let _=eW.length>g?eW.pop():void 0;return v instanceof Promise?v.then(t=>(_&&(_.issues=t.issues.length?eJ(t.issues):eL),t)):(_&&(_.issues=v.issues.length?eJ(v.issues):eL),v)};t._zod.parse=l,t._zod.run===o&&(t._zod.run=l)})}},eB=/^[cC][0-9a-z]{6,}$/,eZ=/^[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 ta=/^[\s\S]{0,}$/,ti=/^-?\d+$/,tn=/^-?\d+(?:\.\d+)?$/,ts=/^(?:true|false)$/i,tl=/^null$/i,tc=/^[^A-Z]*$/,tu=/^[^a-z]*$/,td=eN("$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"},tf=eN("$ZodCheckLessThan",(t,r)=>{td.init(t,r);let o=th[typeof r.value];t._zod.check=a=>{(r.inclusive?a.value<=r.value:a.value<r.value)||a.issues.push({origin:th[typeof a.value]??o,code:"too_big",maximum:"object"==typeof r.value?r.value.getTime():r.value,input:a.value,inclusive:r.inclusive,inst:t,continue:!r.abort})}}),tm=eN("$ZodCheckGreaterThan",(t,r)=>{td.init(t,r);let o=th[typeof r.value];t._zod.check=a=>{(r.inclusive?a.value>=r.value:a.value>r.value)||a.issues.push({origin:th[typeof a.value]??o,code:"too_small",minimum:"object"==typeof r.value?r.value.getTime():r.value,input:a.value,inclusive:r.inclusive,inst:t,continue:!r.abort})}}),ty=eN("$ZodCheckMultipleOf",(t,r)=>{td.init(t,r),t._zod.check=o=>{var a;let i,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(i=(a=o.value)/r.value),s=4*Number.EPSILON*Math.max(Math.abs(i),1),Math.abs(i-n)<s?0:i-n))||o.issues.push({origin:typeof o.value,code:"not_multiple_of",divisor:r.value,input:o.value,inst:t,continue:!r.abort})}}),tg=eN("$ZodCheckNumberFormat",(t,r)=>{td.init(t,r),r.format=r.format||"float64";let o=r.format?.includes("int"),a=o?"int":"number",[i,n]=eh[r.format];t._zod.check=s=>{let l=s.value;if(o){if(!Number.isInteger(l))return void s.issues.push({expected:a,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:a,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:a,inclusive:!0,continue:!r.abort}))}l<i&&s.issues.push({origin:"number",input:l,code:"too_small",minimum:i,inclusive:!0,inst:t,continue:!r.abort}),l>n&&s.issues.push({origin:"number",input:l,code:"too_big",maximum:n,inclusive:!0,inst:t,continue:!r.abort})}}),tv=eN("$ZodCheckMaxLength",(t,r)=>{var o;td.init(t,r),(o=t._zod.def).when??(o.when=tp),t._zod.check=o=>{let a=o.value,i=a.length;if(("string"==typeof a&&i>r.maximum?eE(a):i)<=r.maximum)return;let n=eP(a);o.issues.push({origin:n,code:"too_big",maximum:r.maximum,inclusive:!0,input:a,inst:t,continue:!r.abort})}}),t_=eN("$ZodCheckMinLength",(t,r)=>{var o;td.init(t,r),(o=t._zod.def).when??(o.when=tp),t._zod.check=o=>{let a=o.value,i=a.length;if(("string"==typeof a&&i>=r.minimum&&i<2*r.minimum?eE(a):i)>=r.minimum)return;let n=eP(a);o.issues.push({origin:n,code:"too_small",minimum:r.minimum,inclusive:!0,input:a,inst:t,continue:!r.abort})}}),tb=eN("$ZodCheckLengthEquals",(t,r)=>{var o;td.init(t,r),(o=t._zod.def).when??(o.when=tp),t._zod.check=o=>{let a=o.value,i=a.length,n="string"==typeof a&&i>=r.length&&i<=2*r.length?eE(a):i;if(n===r.length)return;let s=eP(a),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=eN("$ZodCheckStringFormat",(t,r)=>{var o,a;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})}):(a=t._zod).check??(a.check=()=>{})}),tw=eN("$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$=eN("$ZodCheckLowerCase",(t,r)=>{r.pattern??(r.pattern=tc),tS.init(t,r)}),tE=eN("$ZodCheckUpperCase",(t,r)=>{r.pattern??(r.pattern=tu),tS.init(t,r)}),tP=eN("$ZodCheckIncludes",(t,r)=>{td.init(t,r);let o=ec(r.includes),a=new RegExp("number"==typeof r.position?`^.{${r.position},}${o}`:o);r.pattern=a,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})}}),tk=eN("$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})}}),tR=eN("$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=eN("$ZodCheckOverwrite",(t,r)=>{td.init(t,r),t._zod.check=t=>{t.value=r.tx(t.value)}});class tC{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
4
  ${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)=>`
5
+ };`)(...Object.values(this.closed))}}let tA={major:4,minor:6,patch:5},tT=eN("$ZodType",(t,r)=>{var o;t??(t={}),t._zod.def=r,t._zod.bag=t._zod.bag||{},t._zod.version=tA;let a=t._zod.def.checks,i=t._zod.traits.has("$ZodCheck")?[t,...a??[]]:a?.length?[...a]:[];for(let r of i)for(let o of r._zod.onattach)o(t);if(0===i.length)(o=t._zod).deferred??(o.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let r=(r,o,a)=>{let i;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&&a?.async===!1)throw new eM;if(i||l instanceof Promise)i=(i??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 i?i.then(()=>r):r},o=(o,a,n)=>{if(ev(o))return o.aborted=!0,o;let s=r(a,i,n);if(s instanceof Promise){if(!1===n.async)throw new eM;return s.then(r=>t._zod.parse(r,n))}return t._zod.parse(s,n)};t._zod.run=(a,n)=>{if(n.skipChecks)return t._zod.parse(a,n);if("backward"===n.direction){let r=t._zod.parse({value:a.value,issues:[]},{...n,skipChecks:!0});return r instanceof Promise?r.then(t=>o(t,a,n)):o(r,a,n)}let s=t._zod.parse(a,n);if(s instanceof Promise){if(!1===n.async)throw new eM;return s.then(t=>r(t,i,n))}return r(s,i,n)}}},{get"~standard"(){var tO;return tO=this,eR(tO,"~standard",tN(this),!1)},set"~standard"(value){eR(this,"~standard",value)}}),tj=(t,r)=>t.issues.length?{issues:t.issues.map(t=>ew(t,r,eH()))}:{value:t.value};async function tI(t,r){let o={async:!0};return tj(await t._zod.run({value:r,issues:[]},o),o)}function tN(t){return{validate:r=>{let o={async:!1};try{let a=t._zod.run({value:r,issues:[]},o);if(!(a instanceof Promise))return tj(a,o)}catch(t){}return tI(t,r)},vendor:"zod",version:1}}let tM=eN("$ZodString",(t,r)=>{tT.init(t,r),t._zod.pattern=r.pattern??ta,t._zod.parse=(o,a)=>{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}}),tz=eN("$ZodStringFormat",(t,r)=>{tS.init(t,r),tM.init(t,r)}),tq=eN("$ZodGUID",(t,r)=>{r.pattern??(r.pattern=e1),tz.init(t,r)}),tH=eN("$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());tz.init(t,r)}),tU=eN("$ZodEmail",(t,r)=>{r.pattern??(r.pattern=e9),tz.init(t,r)});function tD(t){try{if("undefined"!=typeof URL&&"function"==typeof URL.canParse)return URL.canParse(t);return new URL(t),!0}catch{return!1}}let tL=/[\t\n\r]/g;function tK(t){return t.replace(tL,"")}let tJ=eN("$ZodURL",(t,r)=>{tz.init(t,r),t._zod.check=o=>{try{var a,i,n,s,l,c;let u=o.value.trim(),d=(a=u,i=r,"normalize"in i||"hostname"in i||"protocol"in i?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}}(a,i):tD(a)||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=tK(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:tK(u);return}catch(a){o.issues.push({code:"invalid_format",format:"url",input:o.value,inst:t,continue:!r.abort})}}}),tV=eN("$ZodEmoji",(t,r)=>{r.pattern??(r.pattern=RegExp(e4,"u")),tz.init(t,r)}),tW=eN("$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}}$`))),tz.init(t,r)}),tF=eN("$ZodCUID",(t,r)=>{r.pattern??(r.pattern=eB),tz.init(t,r)}),tB=eN("$ZodCUID2",(t,r)=>{r.pattern??(r.pattern=eZ),tz.init(t,r)}),tZ=eN("$ZodULID",(t,r)=>{r.pattern??(r.pattern=eG),tz.init(t,r)}),tG=eN("$ZodXID",(t,r)=>{r.pattern??(r.pattern=eX),tz.init(t,r)}),tX=eN("$ZodKSUID",(t,r)=>{r.pattern??(r.pattern=eY),tz.init(t,r)}),tY=eN("$ZodISODateTime",(t,r)=>{var o;let a,i,n;r.pattern??(a=["Z"],(o=r).offset&&a.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)"),i=`${to({precision:o.precision,seconds:!0})}(?:${a.join("|")})`,n=o.local?`${i}|${to({precision:o.precision})}`:i,r.pattern=RegExp(`^${tt}T(?:${n})$`)),tz.init(t,r)}),tQ=eN("$ZodISODate",(t,r)=>{r.pattern??(r.pattern=tr),tz.init(t,r)}),t0=eN("$ZodISOTime",(t,r)=>{var o;r.pattern??(o=r,r.pattern=RegExp(`^${to(o)}$`)),tz.init(t,r)}),t1=eN("$ZodISODuration",(t,r)=>{r.pattern??(r.pattern=e0),tz.init(t,r)}),t2=eN("$ZodIPv4",(t,r)=>{r.pattern??(r.pattern=e5),tz.init(t,r)}),t9=/^[0-9a-fA-F:.]+$/;function t4(t){return!!t9.test(t)&&tD(`http://[${t}]`)}let t5=eN("$ZodIPv6",(t,r)=>{r.pattern??(r.pattern=e3),tz.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=eN("$ZodCIDRv4",(t,r)=>{r.pattern??(r.pattern=e6),tz.init(t,r)}),t6=eN("$ZodCIDRv6",(t,r)=>{r.pattern??(r.pattern=e8),tz.init(t,r),t._zod.check=o=>{!function(t){let r=t.split("/");if(2!==r.length)return!1;let[o,a]=r;if(!a)return!1;let i=Number(a);return`${i}`===a&&!(i<0)&&!(i>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=eN("$ZodBase64",(t,r)=>{r.pattern??(r.pattern=t7),tz.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=eN("$ZodBase64URL",(t,r)=>{r.pattern??(r.pattern=rt),tz.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=eN("$ZodE164",(t,r)=>{r.pattern??(r.pattern=te),tz.init(t,r)}),ra=eN("$ZodJWT",(t,r)=>{tz.init(t,r),t._zod.check=o=>{!function(t,r=null){try{let o=t.split(".");if(3!==o.length)return!1;let[a]=o;if(!a)return!1;let i=JSON.parse(atob(a));if("typ"in i&&i?.typ!=="JWT"||!i.alg||r&&(!("alg"in i)||i.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})}}),ri=eN("$ZodNumber",(t,r)=>{tT.init(t,r),t._zod.pattern=tn,t._zod.parse=(o,a)=>{if(r.coerce)try{o.value=Number(o.value)}catch(t){}let i=o.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return o;let n="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:String(i):void 0;return o.issues.push({expected:"number",code:"invalid_type",input:i,inst:t,...n?{received:n}:{}}),o}}),rn=eN("$ZodNumberFormat",(t,r)=>{tg.init(t,r),ri.init(t,r)}),rs=eN("$ZodBoolean",(t,r)=>{tT.init(t,r),t._zod.pattern=ts,t._zod.parse=(o,a)=>{if(r.coerce)try{o.value=!!o.value}catch(t){}let i=o.value;return"boolean"==typeof i||o.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:t}),o}}),rl=eN("$ZodNull",(t,r)=>{tT.init(t,r),t._zod.pattern=tl,t._zod.values=new Set([null]),t._zod.parse=(r,o)=>{let a=r.value;return null===a||r.issues.push({expected:"null",code:"invalid_type",input:a,inst:t}),r}}),rc=eN("$ZodAny",(t,r)=>{tT.init(t,r),t._zod.parse=t=>t}),ru=eN("$ZodUnknown",(t,r)=>{tT.init(t,r),t._zod.parse=t=>t}),rd=eN("$ZodNever",(t,r)=>{tT.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=eN("$ZodArray",(t,r)=>{tT.init(t,r);let o=eq.memoizer;o?.attach(t),t._zod.parse=(a,i)=>{let n=a.value;if(!Array.isArray(n))return a.issues.push({expected:"array",code:"invalid_type",input:n,inst:t}),a;a.value=o?o.alloc(t,a,Array(n.length),i):Array(n.length);let s=[],l=i?.abortEarly;for(let t=0;t<n.length;t++){let o=n[t],c=r.element._zod.run({value:o,issues:[]},i);if(c instanceof Promise)s.push(c.then(r=>rp(r,a,t)));else if(rp(c,a,t),l&&0!==c.issues.length&&ev(c))break}return s.length?Promise.all(s).then(()=>a):a}});function rf(t,r,o,a,i,n){let s=o in a,l="optional"===n;if(s||!l||"optional"!==i){if(t.issues.length){if(void 0!==i&&l&&!s)return;r.issues.push(...e_(o,t.issues))}if(!s&&void 0===i){t.issues.length||r.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[o]});return}void 0===t.value?(s||"defaulted"===i&&!l)&&(r.value[o]=void 0):r.value[o]=t.value}}let rm=[];function ry(t){var r;let o=Object.keys(t.shape),a=Object.getOwnPropertySymbols(t.shape),i=a.length?a:rm,n=i.length?[...o,...i]: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:i,keySet:new Set(o),numKeys:o.length,optionalKeys:new Set(s)}}function rg(t,r,o,a,i,n,s){let l=[],c=i.keySet,u=i.catchall._zod,d=u.def.type,p=u.optin,h=u.optout,f=0;for(let i in r){if(s&&o.issues.length!==f){if(ev(o,f))break;f=o.issues.length}if(c.has(i))continue;if("__proto__"===i){"never"===d&&l.push(i);continue}if("never"===d){l.push(i);continue}let n=u.run({value:r[i],issues:[]},a);n instanceof Promise?t.push(n.then(t=>rf(t,o,i,r,p,h))):rf(n,o,i,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=eN("$ZodObject",(t,r)=>{let o;tT.init(t,r);let a=Object.getOwnPropertyDescriptor(r,"shape"),i=a?.get?a.get.raw:r.shape??{};if(i){let t=()=>{let o={...i};return Object.defineProperty(r,"shape",{value:o}),t.raw=o,o};t.raw=i,Object.defineProperty(r,"shape",{get:t})}let n=F(()=>ry(r));eT(t,"propValues",t=>{let r=t.def.shape,o={};for(let t in r){let a=r[t]._zod;if(a.values){for(let r of(Object.prototype.hasOwnProperty.call(o,t)||G(o,t,new Set),a.values))o[t].add(r);void 0!==a.optin&&o[t].add(void 0)}}return o});let s=r.catchall,l=eq.memoizer;l?.attach(t),t._zod.parse=(r,a)=>{o??(o=n.value);let i=r.value;if(!ea(i))return r.issues.push({expected:"object",code:"invalid_type",input:i,inst:t}),r;r.value=l?l.alloc(t,r,{},a):{};let c=[],u=o.shape,d=a?.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:i[t],issues:[]},a);l instanceof Promise?c.push(l.then(o=>rf(o,r,t,i,n,s))):rf(l,r,t,i,n,s)}return s?rg(c,i,r,a,n.value,t,!0===d):c.length?Promise.all(c).then(()=>r):r}}),r_=eN("$ZodObjectJIT",(t,r)=>{let o,a;rv.init(t,r);let i=t._zod.parse,n=F(()=>ry(r)),s=eq.memoizer,l=!eq.jitless,c=l&&ei.value,u=r.catchall;t._zod.parse=(d,p)=>{a??(a=n.value);let h=d.value;return ea(h)?l&&c&&p?.async===!1&&!0!==p.jitless?(o||(o=(r=>{let o=n.value,a=o.symbolKeys,i=new tC(["payload","ctx"],{shape:r,inst:t,memo:s,syms:a}),l=t=>`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`,c=(t,r)=>`
4
6
  let ${t}_ab = false;
5
7
  for (let i = 0; i < ${t}.issues.length; i++) {
6
8
  const iss = ${t}.issues[i];
@@ -11,7 +13,7 @@ ${r.join("\n")}
11
13
  if (${t}_ab && ctx && ctx.abortEarly) {
12
14
  payload.value = newResult;
13
15
  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(`
16
+ }`;i.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(i.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[${a.indexOf(t)}]`:JSON.stringify(t),s=`${n} in input`,d=r[t],p=d?._zod?.optin,h=void 0!==p,f=d?._zod?.optout==="optional";if(i.write(`const ${o} = ${l(n)};`),h&&f){let t="optional"===p?`${o}_present`:`${o}.value !== undefined || ${o}_present`;i.write(`
15
17
  const ${o}_present = ${s};
16
18
  if (!${o}.issues.length || ${o}_present) {
17
19
  if (${o}.issues.length) {${c(o,n)}
@@ -22,14 +24,14 @@ ${r.join("\n")}
22
24
  }
23
25
  }
24
26
 
25
- `)}else h?(a.write(`
27
+ `)}else h?(i.write(`
26
28
  if (${o}.issues.length) {${c(o,n)}
27
29
  }
28
- `),"defaulted"===p?a.write(`newResult[${n}] = ${o}.value;`):a.write(`
30
+ `),"defaulted"===p?i.write(`newResult[${n}] = ${o}.value;`):i.write(`
29
31
  if (${o}.value !== undefined || ${s}) {
30
32
  newResult[${n}] = ${o}.value;
31
33
  }
32
- `)):a.write(`
34
+ `)):i.write(`
33
35
  const ${o}_present = ${s};
34
36
  if (${o}.issues.length) {${c(o,n)}
35
37
  }
@@ -50,21 +52,21 @@ ${r.join("\n")}
50
52
  newResult[${n}] = ${o}.value;
51
53
  }
52
54
 
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>
55
+ `)}return i.write("payload.value = newResult;"),i.write("return payload;"),i.compile()})(r.shape)),d=o(d,p),u)?rg([],h,d,p,a,t,p?.abortEarly===!0):d:i(d,p):(d.issues.push({expected:"object",code:"invalid_type",input:h,inst:t}),d)}});function rb(t,r,o,a){for(let o of t)if(0===o.issues.length)return r.value=o.value,r;let i=t.filter(t=>!ev(t));return 1===i.length?(r.value=i[0].value,i[0]):(r.issues.push({code:"invalid_union",input:r.value,inst:o,errors:t.map(t=>t.issues.map(t=>ew(t,a,eH())))}),r)}let rS=eN("$ZodUnion",(t,r)=>{tT.init(t,r),eT(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),eT(t,"optout",t=>t.def.options.some(t=>"optional"===t._zod.optout)?"optional":void 0),eT(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)))}),eT(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=>B(t.source)).join("|")})$`)}});let o=1===r.options.length?r.options[0]._zod.run:null;t._zod.parse=(a,i)=>{if(o)return o(a,i);let n=!1,s=[];for(let t of r.options){let r=t._zod.run({value:a.value,issues:[]},i);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,a,t,i)):rb(s,a,t,i)}}),rw=eN("$ZodDiscriminatedUnion",(t,r)=>{r.inclusive=!1,rS.init(t,r);let o=t._zod.parse;eT(t,"propValues",t=>{let r={},o=0;for(let a of t.def.options){let i=a._zod.propValues;if(!i||0===Object.keys(i).length)throw Error(`Invalid discriminated union option at index "${t.def.options.indexOf(a)}"`);for(let[a,n]of(i[t.def.discriminator]?.has(void 0)&&o++,Object.entries(i)))for(let t of(Object.prototype.hasOwnProperty.call(r,a)||G(r,a,new Set),n))r[a].add(t)}return!t.def.unionFallback&&o>1&&r[t.def.discriminator]?.delete(void 0),r}),r.options.forEach((t,o)=>{let a=X(t._zod.def);if(a&&!Object.prototype.hasOwnProperty.call(a,r.discriminator))throw Error(`Invalid discriminated union option at index "${o}"`)});let a=F(()=>(function(t){let r=new Map;for(let o of t.options){let a=o._zod.propValues?.[t.discriminator];if(!a||0===a.size)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(let t of a)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=(i,n)=>{let s=i.value;if(!ea(s))return i.issues.push({code:"invalid_type",expected:"object",input:s,inst:t}),i;let l=s?.[r.discriminator],c=a.value.get(l);return c&&(void 0!==l||"backward"!==n.direction)?c._zod.run(i,n):r.unionFallback||"backward"===n.direction?o(i,n):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:r.discriminator,options:Array.from(a.value.keys()).filter(t=>null!==a.value.get(t)),input:s,path:[r.discriminator],inst:t}),i)}}),r$=eN("$ZodIntersection",(t,r)=>{tT.init(t,r),t._zod.parse=(t,o)=>{let a=t.value,i=r.left._zod.run({value:a,issues:[]},o),n=r.right._zod.run({value:a,issues:[]},o);return i instanceof Promise||n instanceof Promise?Promise.all([i,n]).then(([r,o])=>rE(t,r,o)):rE(t,i,n)}});function rE(t,r,o){let a,i=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 a??(a=t),o=t.keys;for(let t of o)i.has(t)||i.set(t,{}),i.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=[...i].filter(([,t])=>t.l&&t.r).map(([t])=>t);if(l.length){let r=a?l.filter(t=>a.keys.includes(t)):[];for(let o of(r.length&&t.issues.push({...a,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 a=Object.keys(o),i=Object.keys(r).filter(t=>-1!==a.indexOf(t)),n={...r,...o};for(let a of(Object.prototype.hasOwnProperty.call(n,"__proto__")&&delete n.__proto__,i)){if("__proto__"===a)continue;let i=t(r[a],o[a]);if(!i.valid)return{valid:!1,mergeErrorPath:[a,...i.mergeErrorPath]};n[a]=i.data}return{valid:!0,data:n}}if(Array.isArray(r)&&Array.isArray(o)){if(r.length!==o.length)return{valid:!1,mergeErrorPath:[]};let a=[];for(let i=0;i<r.length;i++){let n=r[i],s=t(n,o[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};a.push(s.data)}return{valid:!0,data:a}}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 rP=eN("$ZodRecord",(t,r)=>{tT.init(t,r);let o=eq.memoizer;o?.attach(t),t._zod.parse=(a,i)=>{let n=a.value;if(!en(n))return a.issues.push({expected:"record",code:"invalid_type",input:n,inst:t}),a;let s=[],l=r.keyType._zod.values;if(l&&!r.partial){let c;a.value=o?o.alloc(t,a,{},i):{};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:[]},i);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(l.issues.length){a.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(t=>ew(t,i,eH())),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:[]},i);d instanceof Promise?s.push(d.then(t=>{t.issues.length&&a.issues.push(...e_(o,t.issues)),a.value[c]=t.value})):(d.issues.length&&a.issues.push(...e_(o,d.issues)),a.value[c]=d.value)}for(let t in n)if(!u.has(t))if("loose"===r.mode){if("__proto__"===t)continue;a.value[t]=n[t]}else(c=c??[]).push(t);c&&c.length>0&&a.issues.push({code:"unrecognized_keys",input:n,inst:t,keys:c,continue:!0})}else{let c;for(let u of(a.value=o?o.alloc(t,a,{},i):{},Reflect.ownKeys(n))){if("__proto__"===u||!Object.prototype.propertyIsEnumerable.call(n,u))continue;let o=r.keyType._zod.run({value:u,issues:[]},i);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:[]},i);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?a.value[u]=n[u]:l?(c=c??[]).push(u):a.issues.push({code:"invalid_key",origin:"record",issues:o.issues.map(t=>ew(t,i,eH())),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:[]},i);p instanceof Promise?s.push(p.then(t=>{t.issues.length&&a.issues.push(...e_(u,t.issues)),a.value[d]=t.value})):(p.issues.length&&a.issues.push(...e_(u,p.issues)),a.value[d]=p.value)}c&&c.length>0&&a.issues.push({code:"unrecognized_keys",input:n,inst:t,keys:c,continue:!0})}return s.length?Promise.all(s).then(()=>a):a}}),rk=eN("$ZodEnum",(t,r)=>{tT.init(t,r);let o=K(r.entries),a=new Set(o);t._zod.values=a,eT(t,"pattern",t=>{let r=K(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,i)=>{let n=r.value;return a.has(n)||r.issues.push({code:"invalid_value",values:o,input:n,inst:t}),r}}),rR=eN("$ZodLiteral",(t,r)=>{tT.init(t,r);let o=new Set(r.values);t._zod.values=o,eT(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=(a,i)=>{let n=a.value;return o.has(n)||a.issues.push({code:"invalid_value",values:r.values,input:n,inst:t}),a}}),rx=eN("$ZodTransform",(t,r)=>{tT.init(t,r),t._zod.optin="optional",eq.memoizer?.guard(t),t._zod.parse=(o,a)=>{if("backward"===a.direction)throw new ez(t.constructor.name);let i=r.transform(o.value,o);if(a.async)return(i instanceof Promise?i:Promise.resolve(i)).then(t=>(o.value=t,o));if(i instanceof Promise)throw new eM;return o.value=i,o}});function rC(t,r){return t.value=r.issues.length?void 0:r.value,t}let rA=eN("$ZodOptional",(t,r)=>{tT.init(t,r),eT(t,"optin",t=>"defaulted"===t.def.innerType._zod.optin?"defaulted":"optional"),t._zod.optout="optional",eT(t,"values",t=>{let r=t.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),eT(t,"pattern",t=>{let r=t.def.innerType._zod.pattern;return r?RegExp(`^(${B(r.source)})?$`):void 0}),t._zod.parse=(t,o)=>{if(void 0===t.value){if("defaulted"!==r.innerType._zod.optin)return t;let a=r.innerType._zod.run({value:t.value,issues:[]},o);return a instanceof Promise?a.then(r=>rC(t,r)):rC(t,a)}return r.innerType._zod.run(t,o)}}),rT=eN("$ZodExactOptional",(t,r)=>{rA.init(t,r),eT(t,"values",t=>t.def.innerType._zod.values),eT(t,"pattern",t=>t.def.innerType._zod.pattern),t._zod.parse=(t,o)=>r.innerType._zod.run(t,o)}),rO=eN("$ZodNullable",(t,r)=>{tT.init(t,r),eT(t,"optin",t=>t.def.innerType._zod.optin),eT(t,"optout",t=>t.def.innerType._zod.optout),eT(t,"pattern",t=>{let r=t.def.innerType._zod.pattern;return r?RegExp(`^(${B(r.source)}|null)$`):void 0}),eT(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)}),rj=eN("$ZodDefault",(t,r)=>{tT.init(t,r),t._zod.optin="defaulted",eT(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 a=r.innerType._zod.run(t,o);return a instanceof Promise?a.then(t=>rI(t,r)):rI(a,r)}});function rI(t,r){return void 0===t.value&&(t.value=r.defaultValue),t}let rN=eN("$ZodPrefault",(t,r)=>{tT.init(t,r),t._zod.optin="defaulted",eT(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))}),rM=eN("$ZodNonOptional",(t,r)=>{tT.init(t,r),eT(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,a)=>{let i=r.innerType._zod.run(o,a);return i instanceof Promise?i.then(r=>rz(r,t)):rz(i,t)}});function rz(t,r){return t.issues.length||void 0!==t.value||t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:r}),t}function rq(t,r,o,a){return r.issues.length?t.value=o.catchValue({...r,value:t.value,error:{issues:r.issues.map(t=>ew(t,a,eH()))},input:t.value}):(t.value=r.value,r.memo&&(t.memo=!0)),t}let rH=eN("$ZodCatch",(t,r)=>{tT.init(t,r),eT(t,"optin",t=>"defaulted"===t.def.innerType._zod.optin?"defaulted":"optional"),eT(t,"optout",t=>t.def.innerType._zod.optout),eT(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 a=r.innerType._zod.run({value:t.value,issues:[]},o);return a instanceof Promise?a.then(a=>rq(t,a,r,o)):rq(t,a,r,o)}}),rU=eN("$ZodPipe",(t,r)=>{tT.init(t,r),eT(t,"values",t=>t.def.in._zod.values),eT(t,"optin",t=>t.def.in._zod.optin),eT(t,"optout",t=>t.def.out._zod.optout),eT(t,"propValues",t=>t.def.in._zod.propValues),t._zod.parse=(t,o)=>{if("backward"===o.direction){let a=r.out._zod.run(t,o);return a instanceof Promise?a.then(t=>rD(t,r.in,o)):rD(a,r.in,o)}let a=r.in._zod.run(t,o);return a instanceof Promise?a.then(t=>rD(t,r.out,o)):rD(a,r.out,o)}});function rD(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 rL=eN("$ZodPreprocess",(t,r)=>{rU.init(t,r)}),rK=eN("$ZodReadonly",(t,r)=>{tT.init(t,r),eT(t,"propValues",t=>t.def.innerType._zod.propValues),eT(t,"values",t=>t.def.innerType._zod.values),eT(t,"optin",t=>t.def.innerType?._zod?.optin),eT(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 a=r.innerType._zod.run(t,o);return a instanceof Promise?a.then(rJ):rJ(a)}});function rJ(t){return t.memo||(t.value=Object.freeze(t.value)),t}let rV=eN("$ZodLazy",(t,r)=>{var o,a,i;let n;tT.init(t,r),o=t._zod,a="innerType",i=()=>(r._cachedInner||(r._cachedInner=r.getter()),r._cachedInner),Object.defineProperty(o,a,{get(){if(n!==Z)return void 0===n&&(n=Z,n=i()),n},set(t){Object.defineProperty(o,a,{value:t})},configurable:!0}),eT(t,"pattern",t=>t.innerType?._zod?.pattern),eT(t,"propValues",t=>t.innerType?._zod?.propValues),eT(t,"optin",t=>t.innerType?._zod?.optin??void 0),eT(t,"optout",t=>t.innerType?._zod?.optout??void 0),t._zod.parse=(r,o)=>t._zod.innerType._zod.run(r,o)}),rW=eN("$ZodCustom",(t,r)=>{td.init(t,r),tT.init(t,r),t._zod.parse=(t,r)=>t,t._zod.check=o=>{let a=o.value,i=r.fn(a);if(i instanceof Promise)return i.then(r=>rF(r,o,a,t));rF(i,o,a,t)}});function rF(t,r,o,a){if(!t){let t={code:"custom",input:o,inst:a,path:[...a._zod.def.path??[]],continue:!a._zod.def.abort};a._zod.def.params&&(t.params=a._zod.def.params),r.issues.push(ek(t))}}class rB{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 a={...o,...this._map.get(t)};return Object.keys(a).length?a:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}(C=globalThis).__zod_globalRegistry??(C.__zod_globalRegistry=new rB);let rZ=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 tf({check:"less_than",...ed(r),value:t,inclusive:!1})}function r2(t,r){return new tf({check:"less_than",...ed(r),value:t,inclusive:!0})}function r9(t,r){return new tm({check:"greater_than",...ed(r),value:t,inclusive:!1})}function r4(t,r){return new tm({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??rZ,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,a,i){let n="function"==typeof r.unrepresentable?r.unrepresentable({zodSchema:t,path:a.path,message:i}):r.unrepresentable;if("any"===n)return!1;if(void 0===n||"throw"===n)throw Error(i);return Object.assign(o,n),!0}function oo(t,r,o={path:[],schemaPath:[]}){var a;let i=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 a={...o,schemaPath:[...o.schemaPath,t],path:o.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(r,s.schema,a);else{let o=s.schema,n=r.processors[i.type];if(!n)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);n(t,r,o,a)}let n=t._zod.parent;n&&(s.ref||(s.ref=n),oo(n,r,a),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 a=o??{seen:new Set};if(a.seen.has(r))return!1;a.seen.add(r);let i=r._zod.def;if("transform"===i.type)return!0;if("array"===i.type)return t(i.element,a);if("set"===i.type)return t(i.valueType,a);if("lazy"===i.type)return t(i.getter(),a);if("promise"===i.type||"optional"===i.type||"nonoptional"===i.type||"nullable"===i.type||"readonly"===i.type||"default"===i.type||"prefault"===i.type||"catch"===i.type)return t(i.innerType,a);if("intersection"===i.type)return t(i.left,a)||t(i.right,a);if("record"===i.type||"map"===i.type)return t(i.keyType,a)||t(i.valueType,a);if("pipe"===i.type)return!!r._zod.traits.has("$ZodCodec")||t(i.in,a)||t(i.out,a);if("object"===i.type){for(let r in i.shape)if(t(i.shape[r],a))return!0;return!1}if("union"===i.type){for(let r of i.options)if(t(r,a))return!0;return!1}if("tuple"===i.type){for(let r of i.items)if(t(r,a))return!0;if(i.rest&&t(i.rest,a))return!0}return!1}(t)&&(delete s.schema.examples,delete s.schema.default),"input"===r.io&&"_prefault"in s.schema&&((a=s.schema).default??(a.default=s.schema._prefault)),delete s.schema._prefault,r.seen.get(t).schema}function oa(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function oi(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 a=new Map;for(let r of t.seen.entries()){let o=t.metadataRegistry.get(r[0])?.id;if(o){let t=a.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.`);a.set(o,r[0])}}let i=r=>{if(r[1].schema.$ref)return;let a=r[1],{ref:i,defId:n}=(r=>{let a="draft-2020-12"===t.target?"$defs":"definitions";if(t.external){let o=t.external.registry.get(r[0])?.id,i=t.external.uri??(t=>t);if(o)return{ref:i(o)};let n=r[1].defId??r[1].schema.id??`schema${t.counter++}`;return r[1].defId=n,{defId:n,ref:`${i("__shared")}#/${a}/${oa(n)}`}}let i=`#/${a}/`;if(r[1]===o&&!r[1].schema.id)return{ref:"#"};let n=r[1].schema.id??`__schema${t.counter++}`;return{defId:n,ref:i+oa(n)}})(r);a.def={...a.schema},n&&(a.defId=n);let s=a.schema;for(let t in s)delete s[t];s.$ref=i};if("throw"===t.cycles)for(let r of t.seen.entries()){let t=r[1];if(t.cycle)throw Error(`Cycle detected: #/${t.cycle?.join("/")}/<root>
54
56
 
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},
57
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let o of t.seen.entries()){let a=o[1];if(r===o[0]){i(o);continue}if(t.external){let a=t.external.registry.get(o[0])?.id;if(r!==o[0]&&a){i(o);continue}}if(t.metadataRegistry.get(o[0])?.id||a.cycle){i(o);continue}a.count>1&&"ref"===t.reused&&i(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={},a=new Set;for(let t of r){for(let a in t.properties){if(Object.prototype.hasOwnProperty.call(o,a))continue;let t=[];for(let o of r){let r=o.properties?.[a]??ol(o);null!=r&&(t.some(t=>JSON.stringify(t)===JSON.stringify(r))||t.push(r))}G(o,a,1===t.length?t[0]:oc(t)??{allOf:t})}for(let r of t.required??[])a.add(r)}let i={type:"object",properties:o};if(a.size&&(i.required=[...a]),r.every(t=>!1===t.additionalProperties))i.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?i.additionalProperties=t[0]:t.length>1&&(i.additionalProperties={allOf:t})}return i}function ou(t,r){let o=t.seen.get(r);if(!o)throw Error("Unprocessed schema. This is a bug in Zod.");let a=r=>{let o=t.seen.get(r);if(null===o.ref)return;let i=o.def??o.schema,n={...i},s=o.ref;if(o.ref=null,s){a(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)?(i.allOf=i.allOf??[],i.allOf.push(l)):oe(i,l),oe(i,n),r._zod.parent===s)for(let t in i)"$ref"!==t&&"allOf"!==t&&(t in n||delete i[t]);if(l.$ref&&o.def)for(let t in i)"$ref"!==t&&"allOf"!==t&&t in o.def&&JSON.stringify(i[t])===JSON.stringify(o.def[t])&&delete i[t]}let l=r._zod.parent;if(l&&l!==s){a(l);let r=t.seen.get(l);if(r?.schema.$ref&&(i.$ref=r.schema.$ref,r.def))for(let t in i)"$ref"!==t&&"allOf"!==t&&t in r.def&&JSON.stringify(i[t])===JSON.stringify(r.def[t])&&delete i[t]}t.override({zodSchema:r,jsonSchema:i,path:o.path??[]})};if(!t.external||t.sharedEmitDoneFor!==t.external){for(let r of[...t.seen.entries()].reverse())a(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 a=[];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 i=r.type;for(let t of Array.isArray(i)?i:[i]){if("string"!=typeof t)return;a.includes(t)||a.push(t)}}delete r.anyOf,r.type=1===a.length?a[0]:a}(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 a=r.get(o);a?a.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]))),a=null;if(o.length){let t=o[0],i=os.find(r=>Array.isArray(t[r]));if(1!==Object.keys(t).length)return;let n=r.filter(r=>r!==t),s=t[i].map(t=>oc([...n,t]));if(s.some(t=>!t))return;a={[i]:s}}else a=oc(r);a&&(delete t.allOf,oe(t,a))}(t)}}let i={};if("draft-2020-12"===t.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===t.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===t.target?i.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let o=t.external.registry.get(r)?.id;if(!o)throw Error("Schema is missing an `id` property");i.$id=t.external.uri(o)}oe(i,o.defId?o.schema:o.def??o.schema);let n=t.metadataRegistry.get(r)?.id;void 0!==n&&i.id===n&&delete i.id;let s=t.external?.defs??{};if(!t.external||t.sharedEmitDoneFor!==t.external)for(let r of t.seen.entries()){let t=r[1];t.def&&t.defId&&(t.def.id===t.defId&&delete t.def.id,G(s,t.defId,t.def))}t.external&&(t.sharedEmitDoneFor=t.external),t.external||Object.keys(s).length>0&&("draft-2020-12"===t.target?i.$defs=s:i.definitions=s);try{let o=JSON.parse(JSON.stringify(i));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={})=>a=>{let{libraryOptions:i,target:n}=a??{},s=ot({...i??{},target:n,io:r,processors:o});return oo(t,s),oi(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)},of=(t,r)=>{op(t,"minimum",r),oh(t,"maximum",r)},om=(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[a,i]=t[o.format];op(r,"minimum",a),oh(r,"maximum",i)},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)=>om(t,r.value),number_format:oS(eh),bigint_format:oS(ef),min_length:o_,max_length:ob,length_equals:(t,r)=>of(t,r.length),min_size:o_,max_size:ob,size_equals:(t,r)=>of(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 a of t._zod.traits.has("$ZodCheck")?[t,...o.checks??[]]:o.checks??[])ow[a._zod.def.check]?.(r,a._zod.def);let a=t._zod.bag;for(let t of(void 0!==a.minimum&&op(r,"minimum",a.minimum),void 0!==a.exclusiveMinimum&&op(r,"exclusiveMinimum",a.exclusiveMinimum),void 0!==a.maximum&&oh(r,"maximum",a.maximum),void 0!==a.exclusiveMaximum&&oh(r,"exclusiveMaximum",a.exclusiveMaximum),void 0!==a.multipleOf&&om(r,a.multipleOf),void 0!==a.format&&(r.format??(r.format=a.format),a.format.includes("int")&&(r.isInt=!0)),a.mime&&og(r,a.mime),a.patterns??[]))oy(r,t);return r}let oE={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},oP=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})?$/]]),ok=t=>oP.get(t)??t,oR=(t,r,o,a)=>{o.type="string";let{minimum:i,maximum:n,format:s,patterns:l,contentEncoding:c,laxFormat:u}=o$(t);if("number"==typeof i&&(o.minLength=i),"number"==typeof n&&(o.maxLength=n),s&&(o.format=oE[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(ok);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,a)=>{let{minimum:i,maximum:n,multipleOf:s,exclusiveMaximum:l,exclusiveMinimum:c,isInt:u}=o$(t);o.type=u?"integer":"number";let d="number"==typeof c&&c>=(i??-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 i&&(o.minimum=i),p?h?(o.maximum=l,o.exclusiveMaximum=!0):o.exclusiveMaximum=l:"number"==typeof n&&(o.maximum=n),s){let i=new Set;for(let n of s)Number.isFinite(n)&&0!==n?i.add(Math.abs(n)):or(t,r,o,a,`A multipleOf divisor of ${n} cannot be represented in JSON Schema`);let[n,...l]=i;void 0!==n&&(o.multipleOf=n),l.length&&(o.allOf=[...o.allOf??[],...l.map(t=>({multipleOf:t}))])}},oC=(t,r,o,a)=>{o.type="boolean"},oA=(t,r,o,a)=>{"openapi-3.0"===r.target?(o.type="string",o.nullable=!0,o.enum=[null]):o.type="null"},oT=(t,r,o,a)=>{o.not={}},oO=(t,r,o,a)=>{},oj=(t,r,o,a)=>{},oI=(t,r,o,a)=>{let i=K(t._zod.def.entries);if(0===i.length){o.not={};return}i.every(t=>"number"==typeof t)&&(o.type="number"),i.every(t=>"string"==typeof t)&&(o.type="string"),o.enum=i},oN=(t,r,o,a)=>{let i=t._zod.def;if(0===i.values.length){o.not={};return}let n=[];for(let s of i.values)if(void 0===s){if(or(t,r,o,a,"Literal `undefined` cannot be represented in JSON Schema"))return}else if("bigint"==typeof s){if(or(t,r,o,a,"BigInt literals cannot be represented in JSON Schema"))return;n.push(Number(s))}else n.push(s);if(0===n.length);else if(1===n.length){let 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},oM=(t,r,o,a)=>{or(t,r,o,a,"Custom types cannot be represented in JSON Schema")},oz=(t,r,o,a)=>{or(t,r,o,a,"Transforms cannot be represented in JSON Schema")},oq=(t,r,o,a)=>{let i=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(i.element,r,{...a,path:[...a.path,"items"]})};function oH(t){let r=t._zod.def;return"pipe"===r.type&&r.in._zod.traits.has("$ZodTransform")?oH(r.out):"catch"===r.type?oH(r.innerType):t._zod.optin}let oU=(t,r,o,a)=>{let i=t._zod.def,n=i.shape;if(Object.getOwnPropertySymbols(n).length&&or(t,r,o,a,"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,{...a,path:[...a.path,"properties",t]}));let s=[];for(let t of Object.keys(n)){let o=i.shape[t];("input"===r.io?void 0===oH(o):void 0===o._zod.optout)&&s.push(t)}s.length>0&&(o.required=s),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=oo(i.catchall,r,{...a,path:[...a.path,"additionalProperties"]})):"output"===r.io&&(o.additionalProperties=!1)},oD=(t,r,o,a)=>{let i=t._zod.def,n=!1===i.inclusive,s=i.options.map((t,o)=>oo(t,r,{...a,path:[...a.path,n?"oneOf":"anyOf",o]}));n?o.oneOf=s:o.anyOf=s},oL=(t,r,o,a)=>{let i=t._zod.def,n=oo(i.left,r,{...a,path:[...a.path,"allOf",0]}),s=oo(i.right,r,{...a,path:[...a.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)},oK=new WeakMap,oJ=(t,r,o,a)=>{let i=t._zod.def;o.type="object";let n=i.keyType,s=o$(n).patterns;if("loose"===i.mode&&s&&s.size>0){let t=oo(i.valueType,r,{...a,path:[...a.path,"patternProperties","*"]});for(let r of(o.patternProperties={},s))G(o.patternProperties,ok(r).source,t)}else{if("draft-07"===r.target||"draft-2020-12"===r.target){o.propertyNames=oo(i.keyType,r,{...a,path:[...a.path,"propertyNames"]});let n=oK.get(r);n||(n=[],oK.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 a of oK.get(t)??[]){let i=t.seen.get(a),n=(i?.def??i?.schema)?.propertyNames;if(!n||!0===n||o.has(n))continue;let s=function t(r,o,a){if(o.$ref){if(a.has(o))return o;a.add(o);let i=r.get(o)?.def;if(!i)return o;let n=t(r,i,a);return n===i?o:n}for(let i of["anyOf","oneOf"]){let n=o[i];if(!Array.isArray(n))continue;let s=n.map(o=>t(r,o,a));s.some((t,r)=>t!==n[r])&&(o={...o,[i]:s})}let i=Array.isArray(o.type)?o.type:[o.type],n=!i.includes("string")&&i.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:f,...m}=o;return m.enum?m.enum=m.enum.map(t=>"number"==typeof t?String(t):t):"number"==typeof m.const&&(m.const=String(m.const)),n&&(m.type="string",s||(m.pattern=(i.includes("number")?tn:ti).source)),m}(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(i.valueType,r,{...a,path:[...a.path,"additionalProperties"]})}let l=n._zod.values,c="input"===r.io&&void 0!==oH(i.valueType);if(l&&!i.partial&&!c){let t=[...l].filter(t=>"string"==typeof t||"number"==typeof t);t.length>0&&(o.required=t.map(String))}},oV=(t,r,o,a)=>{let i=t._zod.def,n=oo(i.innerType,r,a),s=r.seen.get(t);"openapi-3.0"===r.target?(s.ref=i.innerType,o.nullable=!0):o.anyOf=[n,{type:"null"}]},oW=(t,r,o,a)=>{let i=t._zod.def;oo(i.innerType,r,a),r.seen.get(t).ref=i.innerType},oF=Symbol();function oB(t,r,o,a,i){let n=!1,s=JSON.stringify(t,(t,r)=>"bigint"!=typeof r?r:(n=!0,null));return n?(or(r,o,a,i,"BigInt defaults cannot be represented in JSON Schema"),oF):JSON.parse(s)}let oZ=(t,r,o,a)=>{let i=t._zod.def;oo(i.innerType,r,a),r.seen.get(t).ref=i.innerType;let n=oB(i.defaultValue,t,r,o,a);n!==oF&&(o.default=n)},oG=(t,r,o,a)=>{let i=t._zod.def;if(oo(i.innerType,r,a),r.seen.get(t).ref=i.innerType,"input"!==r.io)return;let n=oB(i.defaultValue,t,r,o,a);n!==oF&&(o._prefault=n)},oX=(t,r,o,a)=>{let i,n=t._zod.def;oo(n.innerType,r,a),r.seen.get(t).ref=n.innerType;try{i=n.catchValue(void 0)}catch{or(t,r,o,a,"Dynamic catch values are not supported in JSON Schema");return}o.default=i},oY=(t,r,o,a)=>{let i=t._zod.def,n=i.in._zod.traits.has("$ZodTransform"),s="input"===r.io?n?i.out:i.in:i.out;oo(s,r,a),r.seen.get(t).ref=s},oQ=(t,r,o,a)=>{let i=t._zod.def;oo(i.innerType,r,a),r.seen.get(t).ref=i.innerType,o.readOnly=!0},o0=(t,r,o,a)=>{let i=t._zod.def;oo(i.innerType,r,a),r.seen.get(t).ref=i.innerType},o1=(t,r,o,a)=>{let i=t._zod.innerType;oo(i,r,a),r.seen.get(t).ref=i},o2={string:oR,number:ox,boolean:oC,bigint:(t,r,o,a)=>{or(t,r,o,a,"BigInt cannot be represented in JSON Schema")},symbol:(t,r,o,a)=>{or(t,r,o,a,"Symbols cannot be represented in JSON Schema")},null:oA,undefined:(t,r,o,a)=>{or(t,r,o,a,"Undefined cannot be represented in JSON Schema")},void:(t,r,o,a)=>{or(t,r,o,a,"Void cannot be represented in JSON Schema")},never:oT,any:oO,unknown:oj,date:(t,r,o,a)=>{or(t,r,o,a,"Date cannot be represented in JSON Schema")},enum:oI,literal:oN,nan:(t,r,o,a)=>{or(t,r,o,a,"NaN cannot be represented in JSON Schema")},template_literal:(t,r,o,a)=>{let i=t._zod.pattern;if(!i)throw Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},file:(t,r,o,a)=>{o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:n,mime:s}=o$(t);void 0!==i&&(o.minLength=i),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,a)=>{o.type="boolean"},custom:oM,function:(t,r,o,a)=>{or(t,r,o,a,"Function types cannot be represented in JSON Schema")},transform:oz,map:(t,r,o,a)=>{or(t,r,o,a,"Map cannot be represented in JSON Schema")},set:(t,r,o,a)=>{or(t,r,o,a,"Set cannot be represented in JSON Schema")},array:oq,object:oU,union:oD,intersection:oL,tuple:(t,r,o,a)=>{let i=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=i.items.map((t,o)=>oo(t,r,{...a,path:[...a.path,n,o]})),c=i.rest?oo(i.rest,r,{...a,path:[...a.path,s,..."openapi-3.0"===r.target?[i.items.length]:[]]}):null,u=i.items.length;for(;u>0;){let t=i.items[u-1];if(!("input"===r.io?void 0!==oH(t):"optional"===t._zod.optout))break;u--}let d=i.items.length,p=!i.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:f}=o$(t);"number"==typeof h&&(o.minItems=h),"number"==typeof f&&(o.maxItems=f)},record:oJ,nullable:oV,nonoptional:oW,default:oZ,prefault:oG,catch:oX,pipe:oY,readonly:oQ,promise:(t,r,o,a)=>{let i=t._zod.def;oo(i.innerType,r,a),r.seen.get(t).ref=i.innerType},optional:o0,lazy:o1};function o9(t,r){if("_idmap"in t){let o=ot({...r,processors:o2}),a={};for(let r of t._idmap.entries()){let[t,a]=r;oo(a,o)}let i={};for(let n of(o.external={registry:t,uri:r?.uri,defs:a},t._idmap.entries())){let[t,r]=n;oi(o,r),G(i,t,ou(o,r))}return Object.keys(a).length>0&&(i.__shared={["draft-2020-12"===o.target?"$defs":"definitions"]:a}),{schemas:i}}let o=ot({...r,processors:o2});return oo(t,o),oi(o,t),ou(o,t)}let o4={get:function(){let t=this._zod;return t.message??(t.message=JSON.stringify(t.def,V,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=eN("$ZodError",o6);function o7(t,r){return{callee:r?.callee??t,Err:r?.Err}}eN("$ZodError",o6,void 0,{Parent:Error});let ae=t=>{let r=(o,a,i,n)=>{let s=i?{...i,async:!1}:{async:!1},l=o._zod.run({value:a,issues:[]},s);if(l instanceof Promise)throw new eM;if(l.issues.length){let o=new(n?.Err??t)(l.issues.map(t=>ew(t,s,eH())));throw eo(o,n?.callee??r),o}return l.value};return r},at=t=>{let r=async(o,a,i,n)=>{let s=i?{...i,async:!0}:{async:!0},l=o._zod.run({value:a,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,eH())));throw eo(o,n?.callee??r),o}return l.value};return r},ar=t=>(r,o,a)=>{let i=a?{...a,async:!1}:{async:!1},n=r._zod.run({value:o,issues:[]},i);if(n instanceof Promise)throw new eM;return n.issues.length?ao(t,n.issues,i):{success:!0,data:n.value}};function ao(t,r,o){let a;return{success:!1,get error(){return a||(a=new t(r.map(t=>ew(t,o,eH()))),r=void 0,o=void 0),a},set error(e){a=e,r=void 0,o=void 0}}}let aa=t=>async(r,o,a)=>{let i=a?{...a,async:!0}:{async:!0},n=r._zod.run({value:o,issues:[]},i);return n instanceof Promise&&(n=await n),n.issues.length?ao(t,n.issues,i):{success:!0,data:n.value}},ai=Symbol.for("zod.compile.invalid"),an=Symbol.for("zod.compile.fallback"),as=async(t,r,o)=>{let a=o?{...o,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=t._zod.run({value:r,issues:[]},a);return i instanceof Promise&&(i=await i),0===i.issues.length},al=new WeakSet([Object.prototype,Error.prototype]);function ac(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 au=eN("ZodError",(t,r)=>{o8.init(t,r),t.name="ZodError";let o=Object.getPrototypeOf(t);al.has(o)||(al.add(o),ac(o,"format",t=>r=>(function(t,r=t=>t.message){let o={_errors:[]},a=(t,i=[])=>{for(let n of t.issues)if("invalid_union"===n.code&&n.errors.length)n.errors.map(t=>a({issues:t},[...i,...n.path]));else if("invalid_key"===n.code)a({issues:n.issues},[...i,...n.path]);else if("invalid_element"===n.code)a({issues:n.issues},[...i,...n.path]);else{let t=[...i,...n.path];if(0===t.length)o._errors.push(r(n));else{let a=o,i=0;for(;i<t.length;){let o=t[i],s=i===t.length-1;if("_errors"===o){s&&a._errors.push(r(n)),i++;continue}Object.prototype.hasOwnProperty.call(a,o)||Object.defineProperty(a,o,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let l=a[o];s&&l._errors.push(r(n)),a=l,i++}}}};return a(t),o})(t,r)),ac(o,"flatten",t=>r=>(function(t,r=t=>t.message){let o={},a=[];for(let l of t.issues)if(l.path.length>0){var i,n,s;(i=o,n=l.path[0],s=()=>[],!Object.prototype.hasOwnProperty.call(i,n)&&("__proto__"===n?Object.defineProperty(i,n,{value:s(),writable:!0,enumerable:!0,configurable:!0}):i[n]=s()),i[n]).push(r(l))}else a.push(r(l));return{formErrors:a,fieldErrors:o}})(t,r)),ac(o,"addIssue",t=>r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,V,2)}),ac(o,"addIssues",t=>r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,V,2)}),Object.defineProperty(o,"isEmpty",{configurable:!0,enumerable:!1,get(){return 0===this.issues.length}}))},void 0,{Parent:Error}),ad=ae(au),ap=at(au),ah=ar(au),af=aa(au),am=(d=ae(au),p=(t,r,o,a)=>d(t,r,o?{...o,direction:"backward"}:{direction:"backward"},o7(p,a))),ay=(h=ae(au),f=(t,r,o,a)=>h(t,r,o,o7(f,a))),ag=(m=at(au),y=async(t,r,o,a)=>{let i=o?{...o,direction:"backward"}:{direction:"backward"};return await m(t,r,i,o7(y,a))}),av=(g=at(au),v=async(t,r,o,a)=>await g(t,r,o,o7(v,a))),a_=(_=au,(t,r,o)=>{let a=o?{...o,direction:"backward"}:{direction:"backward"};return ar(_)(t,r,a)}),ab=(b=au,(t,r,o)=>ar(b)(t,r,o)),aS=(S=au,async(t,r,o)=>{let a=o?{...o,direction:"backward"}:{direction:"backward"};return aa(S)(t,r,a)}),aw=(w=au,async(t,r,o)=>aa(w)(t,r,o));function a$(){eq.memoizer||eH({memoizer:eF})}let aE=eN("ZodType",(t,r)=>(eq.localeError||eH({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 a(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=a(o.expected),r=a(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 ${J(o.values,"|")}`;case"too_big":{let r=o.exact?"exactly ":o.inclusive?"<=":"<",a=t[o.origin]??null;if(a)return`Too big: expected ${o.origin??"value"} to have ${r}${o.maximum.toString()} ${a.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?">=":">",a=t[o.origin]??null;if(a)return`Too small: expected ${o.origin} to have ${r}${o.minimum.toString()} ${a.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":""}: ${J(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"}}})()}),tT.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 iz({type:"custom",check:"custom",fn:t,...ed(r)})}(t,r))},superRefine(t,r){var o,a,i,n,s;let l,c;return this.check((o=t,a=r,i=o,n=t=>(t.addIssue=r=>{"string"==typeof r?t.issues.push(ek(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(ek(r)))},i(t.value,t)),(c=new td({check:"custom",...ed(s=a)}))._zod.check=n,l=c))},overwrite(t){return this.check(r7(t))},optional(){return i$(this)},exactOptional(){var t;return t=this,new iE({type:"optional",innerType:t})},nullable(){return ik(this)},nullish(){return i$(ik(this))},nonoptional(t){var r,o;return r=this,new iC({type:"nonoptional",innerType:r,...ed(o=t)})},array(){return ir(this)},or(t){return il([this,t])},and(t){return ip(this,t)},transform(t){return iO(this,iS(t))},default(t){var r,o;return r=this,o=t,new iR({type:"default",innerType:r,get defaultValue(){return"function"==typeof o?o():es(o)}})},prefault(t){var r,o;return r=this,o=t,new ix({type:"prefault",innerType:r,get defaultValue(){return"function"==typeof o?o():es(o)}})},catch(t){var r,o,a;let i;return r=this,new iA({type:"catch",innerType:r,catchValue:"function"==typeof(o=t)?o:(a=o,(i=()=>a)["~constantCatch"]=!0,i)})},pipe(t){return iO(this,t)},readonly(){var t;return t=this,new iI({type:"readonly",innerType:t})},describe(t){let r=this.clone();return rZ.add(r,{description:t}),r},meta(...t){if(0===t.length)return rZ.get(this);let r=this.clone();return rZ.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 aP;return aP=this,eR(aP,"~standard",{...tN(this),jsonSchema:{input:od(this,"input"),output:od(this,"output")}},!1)},set"~standard"(value){eR(this,"~standard",value)},parse:function t(r,o){return ad(this,r,o,{callee:t})},parseAsync:async function t(r,o){return await ap(this,r,o,{callee:t})},safeParse(t,r){return ah(this,t,r)},async safeParseAsync(t,r){return af(this,t,r)},get spa(){return this?.safeParseAsync},set spa(value){eR(this,"spa",value)},validate(t,r){var o=this,a=t,i=r;let n=o._zod.bag.validator;if(void 0!==n){if(n(a)!==ai)return!0;if(!0===n.definite&&void 0===i)return!1}var s=o,l=a,c=i;let u,d=c?{...c,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},p=s._zod.bag.fallbackRun;if(p?(d[an]=!0,u=p({value:l,issues:[]},d)):u=s._zod.run({value:l,issues:[]},d),u instanceof Promise)throw new eM;return 0===u.issues.length},validateAsync(t,r){return as(this,t,r)},encode:function t(r,o){return am(this,r,o,{callee:t})},decode:function t(r,o){return ay(this,r,o,{callee:t})},encodeAsync:async function t(r,o){return await ag(this,r,o,{callee:t})},decodeAsync:async function t(r,o){return await av(this,r,o,{callee:t})},safeEncode(t,r){return a_(this,t,r)},safeDecode(t,r){return ab(this,t,r)},async safeEncodeAsync(t,r){return aS(this,t,r)},async safeDecodeAsync(t,r){return aw(this,t,r)},toJSONSchema(t){return((t,r={})=>o=>{let a=ot({...o,processors:r});return oo(t,a),oi(a,t),ou(a,t)})(this,{})(t)},get description(){return rZ.get(this)?.description},get _def(){return this._zod.def}}),ak=eN("_ZodString",(t,r)=>{tM.init(t,r),aE.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oR(t,r,o,a)},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 tP({check:"string_format",format:"includes",...ed(r),includes:t})}(...t))},startsWith(...t){return this.check(function(t,r){return new tk({check:"string_format",format:"starts_with",...ed(r),prefix:t})}(...t))},endsWith(...t){return this.check(function(t,r){return new tR({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 tE({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,"")))}})),aR=eN("ZodString",(t,r)=>{tM.init(t,r),ak.init(t,r)},{email(t){return this.check(rX(aI,t))},url(t){return this.check(rY(az,t))},jwt(t){return this.check(new aY({type:"string",format:"jwt",check:"string_format",abort:!1,...ed(t)}))},emoji(t){return this.check(new aq({type:"string",format:"emoji",check:"string_format",abort:!1,...ed(t)}))},guid(t){return this.check(new aN({type:"string",format:"guid",check:"string_format",abort:!1,...ed(t)}))},uuid(t){return this.check(new aM({type:"string",format:"uuid",check:"string_format",abort:!1,...ed(t)}))},uuidv4(t){return this.check(new aM({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ed(t)}))},uuidv6(t){return this.check(new aM({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ed(t)}))},uuidv7(t){return this.check(new aM({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ed(t)}))},nanoid(t){return this.check(new aH({type:"string",format:"nanoid",check:"string_format",abort:!1,...ed(t)}))},cuid(t){return this.check(new aU({type:"string",format:"cuid",check:"string_format",abort:!1,...ed(t)}))},cuid2(t){return this.check(new aD({type:"string",format:"cuid2",check:"string_format",abort:!1,...ed(t)}))},ulid(t){return this.check(new aL({type:"string",format:"ulid",check:"string_format",abort:!1,...ed(t)}))},base64(t){return this.check(new aZ({type:"string",format:"base64",check:"string_format",abort:!1,...ed(t)}))},base64url(t){return this.check(new aG({type:"string",format:"base64url",check:"string_format",abort:!1,...ed(t)}))},xid(t){return this.check(new aK({type:"string",format:"xid",check:"string_format",abort:!1,...ed(t)}))},ksuid(t){return this.check(new aJ({type:"string",format:"ksuid",check:"string_format",abort:!1,...ed(t)}))},ipv4(t){return this.check(new aV({type:"string",format:"ipv4",check:"string_format",abort:!1,...ed(t)}))},ipv6(t){return this.check(new aW({type:"string",format:"ipv6",check:"string_format",abort:!1,...ed(t)}))},cidrv4(t){return this.check(new aF({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ed(t)}))},cidrv6(t){return this.check(new aB({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ed(t)}))},e164(t){return this.check(new aX({type:"string",format:"e164",check:"string_format",abort:!1,...ed(t)}))},datetime(t){return this.check(rQ(aA,t))},date(t){return this.check(r0(aT,t))},time(t){return this.check(new aO({type:"string",format:"time",check:"string_format",precision:null,...ed(t)}))},duration(t){return this.check(new aj({type:"string",format:"duration",check:"string_format",...ed(t)}))}});function ax(t){return new aR(rG({type:"string",...ed(t)}))}let aC=eN("ZodStringFormat",(t,r)=>{tz.init(t,r),ak.init(t,r)}),aA=eN("ZodISODateTime",(t,r)=>{tY.init(t,r),aC.init(t,r)}),aT=eN("ZodISODate",(t,r)=>{tQ.init(t,r),aC.init(t,r)}),aO=eN("ZodISOTime",(t,r)=>{t0.init(t,r),aC.init(t,r)}),aj=eN("ZodISODuration",(t,r)=>{t1.init(t,r),aC.init(t,r)}),aI=eN("ZodEmail",(t,r)=>{tU.init(t,r),aC.init(t,r)}),aN=eN("ZodGUID",(t,r)=>{tq.init(t,r),aC.init(t,r)}),aM=eN("ZodUUID",(t,r)=>{tH.init(t,r),aC.init(t,r)}),az=eN("ZodURL",(t,r)=>{tJ.init(t,r),aC.init(t,r)}),aq=eN("ZodEmoji",(t,r)=>{tV.init(t,r),aC.init(t,r)}),aH=eN("ZodNanoID",(t,r)=>{tW.init(t,r),aC.init(t,r)}),aU=eN("ZodCUID",(t,r)=>{tF.init(t,r),aC.init(t,r)}),aD=eN("ZodCUID2",(t,r)=>{tB.init(t,r),aC.init(t,r)}),aL=eN("ZodULID",(t,r)=>{tZ.init(t,r),aC.init(t,r)}),aK=eN("ZodXID",(t,r)=>{tG.init(t,r),aC.init(t,r)}),aJ=eN("ZodKSUID",(t,r)=>{tX.init(t,r),aC.init(t,r)}),aV=eN("ZodIPv4",(t,r)=>{t2.init(t,r),aC.init(t,r)}),aW=eN("ZodIPv6",(t,r)=>{t5.init(t,r),aC.init(t,r)}),aF=eN("ZodCIDRv4",(t,r)=>{t3.init(t,r),aC.init(t,r)}),aB=eN("ZodCIDRv6",(t,r)=>{t6.init(t,r),aC.init(t,r)}),aZ=eN("ZodBase64",(t,r)=>{re.init(t,r),aC.init(t,r)}),aG=eN("ZodBase64URL",(t,r)=>{rr.init(t,r),aC.init(t,r)}),aX=eN("ZodE164",(t,r)=>{ro.init(t,r),aC.init(t,r)}),aY=eN("ZodJWT",(t,r)=>{ra.init(t,r),aC.init(t,r)}),aQ=eN("ZodNumber",(t,r)=>{ri.init(t,r),aE.init(t,r),t._zod.processJSONSchema=(r,o,a)=>ox(t,r,o,a),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(a2(t))},safe(t){return this.check(a2(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 a0(t){return new aQ(rG({type:"number",checks:[],...ed(t)}))}let a1=eN("ZodNumberFormat",(t,r)=>{rn.init(t,r),aQ.init(t,r)});function a2(t){return new a1({type:"number",check:"number_format",abort:!1,format:"safeint",...ed(t)})}let a9=eN("ZodBoolean",(t,r)=>{rs.init(t,r),aE.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oC(t,r,o,a)});function a4(t){return new a9({type:"boolean",...ed(t)})}let a5=eN("ZodNull",(t,r)=>{rl.init(t,r),aE.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oA(t,r,o,a)});function a3(t){return new a5({type:"null",...ed(t)})}let a6=eN("ZodAny",(t,r)=>{rc.init(t,r),aE.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oO(t,r,o,a)}),a8=eN("ZodUnknown",(t,r)=>{ru.init(t,r),aE.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oj(t,r,o,a)});function a7(){return new a8({type:"unknown"})}let ie=eN("ZodNever",(t,r)=>{rd.init(t,r),aE.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oT(t,r,o,a)}),it=eN("ZodArray",(t,r)=>{a$(),rh.init(t,r),aE.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oq(t,r,o,a),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 ir(t,r){return new it({type:"array",element:t,...ed(r)})}let io=eN("ZodObject",(t,r)=>{var o,a,i,n,s,l;let c,u;a$(),r_.init(t,r),aE.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oU(t,r,o,a),o=t,a="shape",i=t=>t._zod.def.shape,n=!1,s=o,l=a,c=Object.getPrototypeOf(s),(u=l in c?void 0:c)&&Object.defineProperty(u,a,{configurable:!0,get(){let t={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,a,t),t.value=i(this),Object.defineProperty(this,a,t),t.value},set(t){Object.defineProperty(this,a,{configurable:!0,writable:!0,enumerable:n,value:t})}})},{keyof(){return ig(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:a7()}))},loose(){return this.clone(er(this._zod.def,{catchall:a7()}))},strict(){return this.clone(er(this._zod.def,{catchall:new ie({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 a=r._zod.def.checks;if(a&&a.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 a={};et(a,r,Reflect.ownKeys(Y(r))),et(a,o,Reflect.ownKeys(Y(o)));let i=er(r._zod.def,{shape:a,get catchall(){return o._zod.def.catchall},checks:o._zod.def.checks??[]});return eu(r,i)},pick(t){return function(t,r){let o=t._zod.def,a=o.checks;if(a&&a.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return et(i,t,em(t,r)),eu(t,er(o,{shape:i,checks:[]}))}(this,t)},omit(t){return function(t,r){let o=t._zod.def,a=o.checks;if(a&&a.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(em(t,r)),n={};return et(n,t,Reflect.ownKeys(Y(t)).filter(t=>!i.has(t))),eu(t,er(o,{shape:n,checks:[]}))}(this,t)},partial(...t){return eg(iw,this,t[0])},exactPartial(...t){return eg(iE,this,t[0],"exactPartial")},required(...t){var r,o,a;let i,n;return r=iC,o=this,i=(a=t[0])?new Set(em(o,a)):void 0,et(n={},o,Reflect.ownKeys(Y(o)),(t,o)=>i&&!i.has(o)?t:new r({type:"nonoptional",innerType:t})),eu(o,er(o._zod.def,{shape:n}))}});function ia(t,r){return new io({type:"object",shape:t??{},...ed(r)})}function ii(t,r){return new io({type:"object",shape:t,catchall:a7(),...ed(r)})}let is=eN("ZodUnion",(t,r)=>{rS.init(t,r),aE.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oD(t,r,o,a),t.options=r.options});function il(t,r){return new is({type:"union",options:t,...ed(r)})}let ic=eN("ZodDiscriminatedUnion",(t,r)=>{is.init(t,r),rw.init(t,r)});function iu(t,r,o){return new ic({type:"union",options:r,discriminator:t,...ed(o)})}let id=eN("ZodIntersection",(t,r)=>{r$.init(t,r),aE.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oL(t,r,o,a)});function ip(t,r){return new id({type:"intersection",left:t,right:r})}let ih=eN("ZodRecord",(t,r)=>{a$(),rP.init(t,r),aE.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oJ(t,r,o,a),t.keyType=r.keyType,t.valueType=r.valueType});function im(t,r,o){return new ih(r&&r._zod?{type:"record",keyType:t,valueType:r,...ed(o)}:{type:"record",keyType:ax(),valueType:t,...ed(r)})}let iy=eN("ZodEnum",(t,r)=>{rk.init(t,r),aE.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oI(t,r,o,a),t.enum=r.entries,t.options=[...t._zod.values];let o=new Set(Object.keys(r.entries));t.extract=(t,a)=>{let i={};for(let a of t)if(o.has(a))i[a]=r.entries[a];else throw Error(`Key ${a} not found in enum`);return new iy({...r,checks:[],...ed(a),entries:i})},t.exclude=(t,a)=>{let i={...r.entries};for(let r of t)if(o.has(r))delete i[r];else throw Error(`Key ${r} not found in enum`);return new iy({...r,checks:[],...ed(a),entries:i})}});function ig(t,r){return new iy({type:"enum",entries:Array.isArray(t)?Object.fromEntries(t.map(t=>[t,t])):t,...ed(r)})}let iv=eN("ZodLiteral",(t,r)=>{rR.init(t,r),aE.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oN(t,r,o,a),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 i_(t,r){return new iv({type:"literal",values:Array.isArray(t)?t:[t],...ed(r)})}let ib=eN("ZodTransform",(t,r)=>{a$(),rx.init(t,r),aE.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oz(t,r,o,a),t._zod.parse=(o,a)=>{if("backward"===a.direction)throw new ez(t.constructor.name);o.addIssue=a=>{"string"==typeof a?o.issues.push(ek(a,o.value,r)):(a.fatal&&(a.continue=!1),a.code??(a.code="custom"),"input"in a||(a.input=o.value),a.inst??(a.inst=t),o.issues.push(ek(a)))};let i=r.transform(o.value,o);return i instanceof Promise?i.then(t=>(o.value=t,o)):(o.value=i,o)}});function iS(t){return new ib({type:"transform",transform:t})}let iw=eN("ZodOptional",(t,r)=>{rA.init(t,r),aE.init(t,r),t._zod.processJSONSchema=(r,o,a)=>o0(t,r,o,a),t.unwrap=()=>t._zod.def.innerType});function i$(t){return new iw({type:"optional",innerType:t})}let iE=eN("ZodExactOptional",(t,r)=>{rT.init(t,r),aE.init(t,r),t._zod.processJSONSchema=(r,o,a)=>o0(t,r,o,a),t.unwrap=()=>t._zod.def.innerType}),iP=eN("ZodNullable",(t,r)=>{rO.init(t,r),aE.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oV(t,r,o,a),t.unwrap=()=>t._zod.def.innerType});function ik(t){return new iP({type:"nullable",innerType:t})}let iR=eN("ZodDefault",(t,r)=>{rj.init(t,r),aE.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oZ(t,r,o,a),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap}),ix=eN("ZodPrefault",(t,r)=>{rN.init(t,r),aE.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oG(t,r,o,a),t.unwrap=()=>t._zod.def.innerType}),iC=eN("ZodNonOptional",(t,r)=>{rM.init(t,r),aE.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oW(t,r,o,a),t.unwrap=()=>t._zod.def.innerType}),iA=eN("ZodCatch",(t,r)=>{rH.init(t,r),aE.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oX(t,r,o,a),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap}),iT=eN("ZodPipe",(t,r)=>{rU.init(t,r),aE.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oY(t,r,o,a),t.in=r.in,t.out=r.out});function iO(t,r){return new iT({type:"pipe",in:t,out:r})}let ij=eN("ZodPreprocess",(t,r)=>{iT.init(t,r),rL.init(t,r)}),iI=eN("ZodReadonly",(t,r)=>{rK.init(t,r),aE.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oQ(t,r,o,a),t.unwrap=()=>t._zod.def.innerType}),iN=eN("ZodLazy",(t,r)=>{rV.init(t,r),aE.init(t,r),t._zod.processJSONSchema=(r,o,a)=>o1(t,r,o,a),t.unwrap=()=>t._zod.def.getter()});function iM(t){return new iN({type:"lazy",getter:t})}let iz=eN("ZodCustom",(t,r)=>{rW.init(t,r),aE.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oM(t,r,o,a)});function iq(t,r){return new ij({type:"pipe",in:iS(t),out:r})}let iH="custom";A||(A={});let iU="2025-11-25",iD=[iU,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],iL="io.modelcontextprotocol/protocolVersion",iK="io.modelcontextprotocol/clientInfo",iJ="io.modelcontextprotocol/serverInfo",iV="io.modelcontextprotocol/clientCapabilities",iW="io.modelcontextprotocol/subscriptionId",iF="io.modelcontextprotocol/logLevel",iB=iM(()=>il([ax(),a0(),a4(),a3(),im(ax(),iB),ir(iB)])),iZ=im(ax(),iB),iG=ir(iB),iX=il([ax(),a0().int()]),iY=ax(),iQ=ia({ttl:a0().optional()}),i0=ia({taskId:ax()}),i1=ii({progressToken:iX.optional(),"io.modelcontextprotocol/related-task":i0.optional()}),i2=ia({_meta:i1.optional()}),i9=i2.extend({task:iQ.optional()}),i4=ia({method:ax(),params:i2.loose().optional()}),i5=ia({_meta:i1.optional()}),i3=ia({method:ax(),params:i5.loose().optional()}),i6=ii({get[iJ](){return np.optional().catch(void 0)}}),i8=ii({_meta:i6.optional()}),i7=il([ax(),a0().int()]),ne=ia({jsonrpc:i_("2.0"),id:i7,...i4.shape}).strict(),nt=ia({jsonrpc:i_("2.0"),...i3.shape}).strict(),nr=ia({jsonrpc:i_("2.0"),id:i7,result:i8}).strict(),no=ia({jsonrpc:i_("2.0"),id:i7.optional(),error:ia({code:a0().int(),message:ax(),data:a7().optional()})}).strict(),na=il([ne,nt,nr,no]),ni=il([nr,no]),nn=i8.strict(),ns=i5.extend({requestId:i7.optional(),reason:ax().optional()}),nl=i3.extend({method:i_("notifications/cancelled"),params:ns}),nc=ia({src:ax(),mimeType:ax().optional(),sizes:ir(ax()).optional(),theme:ig(["light","dark"]).optional()}),nu=ia({icons:ir(nc).optional()}),nd=ia({name:ax(),title:ax().optional()}),np=nd.extend({...nd.shape,...nu.shape,version:ax(),websiteUrl:ax().optional(),description:ax().optional()}),nh=ip(ia({applyDefaults:a4().optional()}),iZ),nf=iq(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,ip(ia({form:nh.optional(),url:iZ.optional()}),iZ.optional())),nm=ii({list:iZ.optional(),cancel:iZ.optional(),requests:ii({sampling:ii({createMessage:iZ.optional()}).optional(),elicitation:ii({create:iZ.optional()}).optional()}).optional()}),ny=ii({list:iZ.optional(),cancel:iZ.optional(),requests:ii({tools:ii({call:iZ.optional()}).optional()}).optional()}),ng=ia({experimental:im(ax(),iZ).optional(),sampling:ia({context:iZ.optional(),tools:iZ.optional()}).optional(),elicitation:nf.optional(),roots:ia({listChanged:a4().optional()}).optional(),tasks:nm.optional(),extensions:im(ax(),iZ).optional()}),nv=i2.extend({protocolVersion:ax(),capabilities:ng,clientInfo:np}),n_=i4.extend({method:i_("initialize"),params:nv}),nb=ia({experimental:im(ax(),iZ).optional(),logging:iZ.optional(),completions:iZ.optional(),prompts:ia({listChanged:a4().optional()}).optional(),resources:ia({subscribe:a4().optional(),listChanged:a4().optional()}).optional(),tools:ia({listChanged:a4().optional()}).optional(),tasks:ny.optional(),extensions:im(ax(),iZ).optional()}),nS=i8.extend({protocolVersion:ax(),capabilities:nb,serverInfo:np,instructions:ax().optional()}),nw=i3.extend({method:i_("notifications/initialized"),params:i5.optional()}),n$=i4.extend({method:i_("server/discover"),params:i2.optional()}),nE=i8.extend({supportedVersions:ir(ax()),capabilities:nb,instructions:ax().optional()}),nP=i4.extend({method:i_("ping"),params:i2.optional()}),nk=ia({progress:a0(),total:i$(a0()),message:i$(ax())}),nR=ia({...i5.shape,...nk.shape,progressToken:iX}),nx=i3.extend({method:i_("notifications/progress"),params:nR}),nC=i2.extend({cursor:iY.optional()}),nA=i4.extend({params:nC.optional()}),nT=i8.extend({nextCursor:iY.optional()}),nO=ia({uri:ax(),mimeType:i$(ax()),_meta:im(ax(),a7()).optional()}),nj=nO.extend({text:ax()}),nI=ax().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),nN=nO.extend({blob:nI}),nM=ig(["user","assistant"]),nz=ia({audience:ir(nM).optional(),priority:a0().min(0).max(1).optional(),lastModified:rQ(aA,{offset:!0}).optional()}),nq=ia({...nd.shape,...nu.shape,uri:ax(),description:i$(ax()),mimeType:i$(ax()),size:i$(a0()),annotations:nz.optional(),_meta:i$(ii({}))}),nH=ia({...nd.shape,...nu.shape,uriTemplate:ax(),description:i$(ax()),mimeType:i$(ax()),annotations:nz.optional(),_meta:i$(ii({}))}),nU=nA.extend({method:i_("resources/list")}),nD=nT.extend({resources:ir(nq)}),nL=nA.extend({method:i_("resources/templates/list")}),nK=nT.extend({resourceTemplates:ir(nH)}),nJ=i2.extend({uri:ax()}),nV=i4.extend({method:i_("resources/read"),params:nJ}),nW=i8.extend({contents:ir(il([nj,nN]))}),nF=i3.extend({method:i_("notifications/resources/list_changed"),params:i5.optional()}),nB=i4.extend({method:i_("resources/subscribe"),params:nJ}),nZ=i4.extend({method:i_("resources/unsubscribe"),params:nJ}),nG=ia({toolsListChanged:a4().optional(),promptsListChanged:a4().optional(),resourcesListChanged:a4().optional(),resourceSubscriptions:ir(ax()).optional()}),nX=i2.extend({notifications:nG}),nY=i4.extend({method:i_("subscriptions/listen"),params:nX}),nQ=i5.extend({notifications:nG}),n0=i3.extend({method:i_("notifications/subscriptions/acknowledged"),params:nQ}),n1=i6.extend({[iW]:i7}),n2=i8.extend({_meta:n1}),n9=i5.extend({uri:ax()}),n4=i3.extend({method:i_("notifications/resources/updated"),params:n9}),n5=ia({name:ax(),description:i$(ax()),required:i$(a4())}),n3=ia({...nd.shape,...nu.shape,description:i$(ax()),arguments:i$(ir(n5)),_meta:i$(ii({}))}),n6=nA.extend({method:i_("prompts/list")}),n8=nT.extend({prompts:ir(n3)}),n7=i2.extend({name:ax(),arguments:im(ax(),ax()).optional()}),se=i4.extend({method:i_("prompts/get"),params:n7}),st=ia({type:i_("text"),text:ax(),annotations:nz.optional(),_meta:im(ax(),a7()).optional()}),sr=ia({type:i_("image"),data:nI,mimeType:ax(),annotations:nz.optional(),_meta:im(ax(),a7()).optional()}),so=ia({type:i_("audio"),data:nI,mimeType:ax(),annotations:nz.optional(),_meta:im(ax(),a7()).optional()}),sa=ia({type:i_("tool_use"),name:ax(),id:ax(),input:im(ax(),a7()),_meta:im(ax(),a7()).optional()}),si=ia({type:i_("resource"),resource:il([nj,nN]),annotations:nz.optional(),_meta:im(ax(),a7()).optional()}),sn=nq.extend({type:i_("resource_link")}),ss=il([st,sr,so,sn,si]),sl=ia({role:nM,content:ss}),sc=i8.extend({description:ax().optional(),messages:ir(sl)}),su=i3.extend({method:i_("notifications/prompts/list_changed"),params:i5.optional()}),sd=ia({title:ax().optional(),readOnlyHint:a4().optional(),destructiveHint:a4().optional(),idempotentHint:a4().optional(),openWorldHint:a4().optional()}),sp=ia({taskSupport:ig(["required","optional","forbidden"]).optional()}),sh=ia({...nd.shape,...nu.shape,description:ax().optional(),inputSchema:ia({type:i_("object"),properties:im(ax(),iB).optional(),required:ir(ax()).optional()}).catchall(a7()),outputSchema:ii({$schema:ax().optional()}).optional(),annotations:sd.optional(),execution:sp.optional(),_meta:im(ax(),a7()).optional()}),sf=nA.extend({method:i_("tools/list")}),sm=nT.extend({tools:ir(sh)}),sy=i8.extend({content:ir(ss).default([]),structuredContent:a7().optional(),isError:a4().optional()}),sg=sy.or(i8.extend({toolResult:a7()})),sv=i9.extend({name:ax(),arguments:im(ax(),a7()).optional()}),s_=i4.extend({method:i_("tools/call"),params:sv}),sb=i3.extend({method:i_("notifications/tools/list_changed"),params:i5.optional()}),sS=ia({autoRefresh:a4().default(!0),debounceMs:a0().int().nonnegative().default(300)}),sw=ig(["debug","info","notice","warning","error","critical","alert","emergency"]),s$=i2.extend({level:sw}),sE=i4.extend({method:i_("logging/setLevel"),params:s$}),sP=i5.extend({level:sw,logger:ax().optional(),data:a7()}),sk=i3.extend({method:i_("notifications/message"),params:sP}),sR=ia({name:ax().optional()}),sx=ia({hints:ir(sR).optional(),costPriority:a0().min(0).max(1).optional(),speedPriority:a0().min(0).max(1).optional(),intelligencePriority:a0().min(0).max(1).optional()}),sC=ia({mode:ig(["auto","required","none"]).optional()}),sA=ia({type:i_("tool_result"),toolUseId:ax().describe("The unique identifier for the corresponding tool call."),content:ir(ss),structuredContent:a7().optional(),isError:a4().optional(),_meta:im(ax(),a7()).optional()}),sT=iu("type",[st,sr,so]),sO=iu("type",[st,sr,so,sa,sA]),sj=ia({role:nM,content:il([sO,ir(sO)]),_meta:im(ax(),a7()).optional()}),sI=i9.extend({messages:ir(sj),modelPreferences:sx.optional(),systemPrompt:ax().optional(),includeContext:ig(["none","thisServer","allServers"]).optional(),temperature:a0().optional(),maxTokens:a0().int(),stopSequences:ir(ax()).optional(),metadata:iZ.optional(),tools:ir(sh).optional(),toolChoice:sC.optional()}),sN=i4.extend({method:i_("sampling/createMessage"),params:sI}),sM=i8.extend({model:ax(),stopReason:i$(ig(["endTurn","stopSequence","maxTokens"]).or(ax())),role:nM,content:sT}),sz=i8.extend({model:ax(),stopReason:i$(ig(["endTurn","stopSequence","maxTokens","toolUse"]).or(ax())),role:nM,content:il([sO,ir(sO)])}),sq=ia({type:i_("boolean"),title:ax().optional(),description:ax().optional(),default:a4().optional()}),sH=ia({type:i_("string"),title:ax().optional(),description:ax().optional(),minLength:a0().optional(),maxLength:a0().optional(),format:ig(["email","uri","date","date-time"]).optional(),default:ax().optional()}),sU=ia({type:ig(["number","integer"]),title:ax().optional(),description:ax().optional(),minimum:a0().optional(),maximum:a0().optional(),default:a0().optional()}),sD=ia({type:i_("string"),title:ax().optional(),description:ax().optional(),enum:ir(ax()),default:ax().optional()}),sL=ia({type:i_("string"),title:ax().optional(),description:ax().optional(),oneOf:ir(ia({const:ax(),title:ax()})),default:ax().optional()}),sK=ia({type:i_("string"),title:ax().optional(),description:ax().optional(),enum:ir(ax()),enumNames:ir(ax()).optional(),default:ax().optional()}),sJ=il([sD,sL]),sV=ia({type:i_("array"),title:ax().optional(),description:ax().optional(),minItems:a0().optional(),maxItems:a0().optional(),items:ia({type:i_("string"),enum:ir(ax())}),default:ir(ax()).optional()}),sW=ia({type:i_("array"),title:ax().optional(),description:ax().optional(),minItems:a0().optional(),maxItems:a0().optional(),items:ia({anyOf:ir(ia({const:ax(),title:ax()}))}),default:ir(ax()).optional()}),sF=il([sV,sW]),sB=il([sK,sJ,sF]),sZ=il([sB,sq,sH,sU]),sG=i9.extend({mode:i_("form").optional(),message:ax(),requestedSchema:ia({type:i_("object"),properties:im(ax(),sZ),required:ir(ax()).optional()}).catchall(a7())}),sX=i9.extend({mode:i_("url"),message:ax(),elicitationId:ax(),url:ax().url()}),sY=il([sG,sX]),sQ=i4.extend({method:i_("elicitation/create"),params:sY}),s0=i5.extend({elicitationId:ax()}),s1=i3.extend({method:i_("notifications/elicitation/complete"),params:s0}),s2=i8.extend({action:ig(["accept","decline","cancel"]),content:iq(t=>null===t?void 0:t,im(ax(),il([ax(),a0(),a4(),ir(ax())])).optional())}),s9=ia({type:i_("ref/resource"),uri:ax()}),s4=ia({type:i_("ref/prompt"),name:ax()}),s5=i2.extend({ref:il([s4,s9]),argument:ia({name:ax(),value:ax()}),context:ia({arguments:im(ax(),ax()).optional()}).optional()}),s3=i4.extend({method:i_("completion/complete"),params:s5}),s6=i8.extend({completion:ii({values:ir(ax()).max(100),total:i$(a0().int()),hasMore:i$(a4())})}),s8=ia({uri:ax().startsWith("file://"),name:ax().optional(),_meta:im(ax(),a7()).optional()}),s7=i4.extend({method:i_("roots/list"),params:i2.optional()}),le=i8.extend({roots:ir(s8)}),lt=i3.extend({method:i_("notifications/roots/list_changed"),params:i5.optional()}),lr=ii({ttl:a0().optional(),pollInterval:a0().optional()}),lo=ig(["working","input_required","completed","failed","cancelled"]),la=ia({taskId:ax(),status:lo,ttl:il([a0(),a3()]),createdAt:ax(),lastUpdatedAt:ax(),pollInterval:i$(a0()),statusMessage:i$(ax())}),li=i8.extend({task:la}),ln=i5.merge(la),ls=i3.extend({method:i_("notifications/tasks/status"),params:ln}),ll=i4.extend({method:i_("tasks/get"),params:i2.extend({taskId:ax()})}),lc=i8.merge(la),lu=i4.extend({method:i_("tasks/result"),params:i2.extend({taskId:ax()})}),ld=i8.loose(),lp=nA.extend({method:i_("tasks/list")}),lh=nT.extend({tasks:ir(la)}),lf=i4.extend({method:i_("tasks/cancel"),params:i2.extend({taskId:ax()})}),lm=i8.merge(la),ly=il([nP,n_,n$,s3,sE,se,n6,nU,nL,nV,nB,nZ,nY,s_,sf]),lg=il([nl,nx,nw,lt]),lv=il([nn,sM,sz,s2,le]),l_=il([nP,sN,sQ,s7]),lb=il([nl,nx,sk,n4,nF,sb,su,n0,s1]),lS=il([nn,nS,nE,s6,sc,n8,nD,nK,nW,sy,sm,n2]),lw=rY(az,void 0).superRefine((t,r)=>{if(!URL.canParse(t))return r.addIssue({code:iH,message:"URL must be parseable",fatal:!0}),eO}).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$=ii({resource:ax().url(),authorization_servers:ir(lw).optional(),jwks_uri:ax().url().optional(),scopes_supported:ir(ax()).optional(),bearer_methods_supported:ir(ax()).optional(),resource_signing_alg_values_supported:ir(ax()).optional(),resource_name:ax().optional(),resource_documentation:ax().optional(),resource_policy_uri:ax().url().optional(),resource_tos_uri:ax().url().optional(),tls_client_certificate_bound_access_tokens:a4().optional(),authorization_details_types_supported:ir(ax()).optional(),dpop_signing_alg_values_supported:ir(ax()).optional(),dpop_bound_access_tokens_required:a4().optional()}),lE=ii({issuer:ax(),authorization_endpoint:lw,token_endpoint:lw,registration_endpoint:lw.optional(),scopes_supported:ir(ax()).optional(),response_types_supported:ir(ax()),response_modes_supported:ir(ax()).optional(),grant_types_supported:ir(ax()).optional(),token_endpoint_auth_methods_supported:ir(ax()).optional(),token_endpoint_auth_signing_alg_values_supported:ir(ax()).optional(),service_documentation:lw.optional(),revocation_endpoint:lw.optional(),revocation_endpoint_auth_methods_supported:ir(ax()).optional(),revocation_endpoint_auth_signing_alg_values_supported:ir(ax()).optional(),introspection_endpoint:ax().optional(),introspection_endpoint_auth_methods_supported:ir(ax()).optional(),introspection_endpoint_auth_signing_alg_values_supported:ir(ax()).optional(),code_challenge_methods_supported:ir(ax()).optional(),client_id_metadata_document_supported:a4().optional(),authorization_response_iss_parameter_supported:a4().optional().catch(void 0),dpop_signing_alg_values_supported:ir(ax()).optional()}),lP=ii({issuer:ax(),authorization_endpoint:lw,token_endpoint:lw,userinfo_endpoint:lw.optional(),jwks_uri:lw,registration_endpoint:lw.optional(),scopes_supported:ir(ax()).optional(),response_types_supported:ir(ax()),response_modes_supported:ir(ax()).optional(),grant_types_supported:ir(ax()).optional(),acr_values_supported:ir(ax()).optional(),subject_types_supported:ir(ax()),id_token_signing_alg_values_supported:ir(ax()),id_token_encryption_alg_values_supported:ir(ax()).optional(),id_token_encryption_enc_values_supported:ir(ax()).optional(),userinfo_signing_alg_values_supported:ir(ax()).optional(),userinfo_encryption_alg_values_supported:ir(ax()).optional(),userinfo_encryption_enc_values_supported:ir(ax()).optional(),request_object_signing_alg_values_supported:ir(ax()).optional(),request_object_encryption_alg_values_supported:ir(ax()).optional(),request_object_encryption_enc_values_supported:ir(ax()).optional(),token_endpoint_auth_methods_supported:ir(ax()).optional(),token_endpoint_auth_signing_alg_values_supported:ir(ax()).optional(),display_values_supported:ir(ax()).optional(),claim_types_supported:ir(ax()).optional(),claims_supported:ir(ax()).optional(),service_documentation:ax().optional(),claims_locales_supported:ir(ax()).optional(),ui_locales_supported:ir(ax()).optional(),claims_parameter_supported:a4().optional(),request_parameter_supported:a4().optional(),request_uri_parameter_supported:a4().optional(),require_request_uri_registration:a4().optional(),op_policy_uri:lw.optional(),op_tos_uri:lw.optional(),client_id_metadata_document_supported:a4().optional(),authorization_response_iss_parameter_supported:a4().optional().catch(void 0)}),lk=ia({...lP.shape,...lE.pick({code_challenge_methods_supported:!0}).shape}),lR=ia({access_token:ax(),id_token:ax().optional(),token_type:ax(),expires_in:new aQ(rG({type:"number",coerce:!0,checks:[],...ed(void 0)})).optional(),scope:ax().optional(),refresh_token:ax().optional(),issuer:ax().optional().catch(void 0)}).strip(),lx=ia({issued_token_type:i_("urn:ietf:params:oauth:token-type:id-jag"),access_token:ax(),token_type:ax().optional(),expires_in:a0().optional(),scope:ax().optional()}).strip(),lC=ia({error:ax(),error_description:ax().optional(),error_uri:ax().optional()}),lA=lw.optional().or(i_("").transform(()=>void 0)),lT=ia({redirect_uris:ir(lw),token_endpoint_auth_method:ax().optional(),grant_types:ir(ax()).optional(),response_types:ir(ax()).optional(),application_type:ax().optional(),client_name:ax().optional(),client_uri:lw.optional(),logo_uri:lA,scope:ax().optional(),contacts:ir(ax()).optional(),tos_uri:lA,policy_uri:ax().optional(),jwks_uri:lw.optional(),jwks:new a6({type:"any"}).optional(),software_id:ax().optional(),software_version:ax().optional(),software_statement:ax().optional()}).strip(),lO=ia({client_id:ax(),client_secret:ax().optional(),client_id_issued_at:a0().optional(),client_secret_expires_at:a0().optional(),issuer:ax().optional().catch(void 0)}).strip(),lj=lT.merge(lO),lI=ia({error:ax(),error_description:ax().optional()}).strip(),lN=ia({token:ax(),token_type_hint:ax().optional()}).strip(),lM=Symbol.for("mcp.sdk.errorBrands");function lz(t,r){let o=new Set,a=r;for(;"function"==typeof a;){let t=a.mcpBrand;Object.prototype.hasOwnProperty.call(a,"mcpBrand")&&"string"==typeof t&&o.add(t),a=Object.getPrototypeOf(a)}0!==o.size&&Object.defineProperty(t,lM,{value:o,enumerable:!1,configurable:!0})}function lq(t,r){try{if("object"==typeof r&&null!==r&&Object.prototype.hasOwnProperty.call(t,"mcpBrand")&&"string"==typeof t.mcpBrand&&Object.prototype.hasOwnProperty.call(r,lM)){let o=r[lM];if(o&&"function"==typeof o.has&&o.has(t.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(t,r)}let lH=((E={}).InvalidRequest="invalid_request",E.InvalidClient="invalid_client",E.InvalidGrant="invalid_grant",E.UnauthorizedClient="unauthorized_client",E.UnsupportedGrantType="unsupported_grant_type",E.InvalidScope="invalid_scope",E.AccessDenied="access_denied",E.ServerError="server_error",E.TemporarilyUnavailable="temporarily_unavailable",E.UnsupportedResponseType="unsupported_response_type",E.UnsupportedTokenType="unsupported_token_type",E.InvalidToken="invalid_token",E.MethodNotAllowed="method_not_allowed",E.TooManyRequests="too_many_requests",E.InvalidClientMetadata="invalid_client_metadata",E.InvalidRedirectUri="invalid_redirect_uri",E.InsufficientScope="insufficient_scope",E.InvalidTarget="invalid_target",E.InvalidDpopProof="invalid_dpop_proof",E.UseDpopNonce="use_dpop_nonce",E);var lU=class t extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return lq(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 lq(this,t)}constructor(t,r,o){super(r),this.code=t,this.errorUri=o,this.name="OAuthError",lz(this,new.target)}toResponseObject(){let t={error:this.code,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}static fromResponse(r){return new t(r.error,r.error_description??r.error,r.error_uri)}};let lD=((P={}).NotConnected="NOT_CONNECTED",P.AlreadyConnected="ALREADY_CONNECTED",P.NotInitialized="NOT_INITIALIZED",P.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",P.RequestTimeout="REQUEST_TIMEOUT",P.ConnectionClosed="CONNECTION_CLOSED",P.SendFailed="SEND_FAILED",P.InvalidResult="INVALID_RESULT",P.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",P.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",P.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",P.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",P.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",P.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",P.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",P.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",P.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",P.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",P.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",P);var lL=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](t){return lq(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 lq(this,t)}constructor(t,r,o,a){super(r,a),this.code=t,this.data=o,this.name="SdkError",lz(this,new.target)}},lK=class extends lL{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(t,r,o,a){super(t,r,o,a),this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};function lJ(t){if("object"!=typeof t||null===t||Array.isArray(t))return t;let r={...t};return delete r.issuer,r}let lV="2026-07-28",lW=[lV];function lF(t){return t.filter(t=>!(t>=lV))}function lB(t){return t.filter(t=>t>=lV)}function lZ(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 lG=["task","inputRequests","requestState"];function lX(t){return null===t||"object"!=typeof t||Array.isArray(t)||void 0!==t.content||lG.some(r=>r in t)?t:{...t,content:[]}}function lY(){let t,r,a,i,n,s,l,c,u,d,p,h,f,m,y,g,v,_,b,S,w,$,E,P,k,R,x,C,A,T,O,j,I,N,M,z,q,H,U,D,L,K,J,V,W,F,B,Z,G,X,Y,Q,ee,et,er,eo,ea,ei,en,es,el,ec,eu,ed,ep,eh,ef,em,ey,eg,ev,e_,eb,eS,ew,e$,eE,eP,ek,eR,ex,eC,eA,eT,eO,ej,eI,eN,eM,ez,eq,eH,eU,eD,eL,eK,eJ,eV,eW,eF,eB,eZ,eG,eX,eY,eQ,e0,e1,e2,e9,e4,e5,e3,e6,e8,e7,te,tt,tr,to,ta,ti,tn,ts,tl,tc,tu,td,tp,th,tf,tm,ty,tg,tv,t_,tb,tS,tw,t$;return o??=(t=iM(()=>il([ax(),a0(),a4(),a3(),im(ax(),t),ir(t)])),r=im(ax(),t),a=il([ax(),a0().int()]),i=ax(),n=ia({ttl:a0().optional()}),s=ia({taskId:ax()}),l=ii({progressToken:a.optional(),"io.modelcontextprotocol/related-task":s.optional()}),u=(c=ia({_meta:l.optional()})).extend({task:n.optional()}),d=ia({method:ax(),params:c.loose().optional()}),p=ia({_meta:l.optional()}),h=ia({method:ax(),params:p.loose().optional()}),f=ii({_meta:l.optional()}),m=il([ax(),a0().int()]),y=f.strict(),g=p.extend({requestId:m.optional(),reason:ax().optional()}),v=h.extend({method:i_("notifications/cancelled"),params:g}),_=ia({src:ax(),mimeType:ax().optional(),sizes:ir(ax()).optional(),theme:ig(["light","dark"]).optional()}),b=ia({icons:ir(_).optional()}),w=(S=ia({name:ax(),title:ax().optional()})).extend({...S.shape,...b.shape,version:ax(),websiteUrl:ax().optional(),description:ax().optional()}),$=ip(ia({applyDefaults:a4().optional()}),r),E=iq(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,ip(ia({form:$.optional(),url:r.optional()}),r.optional())),P=ii({list:r.optional(),cancel:r.optional(),requests:ii({sampling:ii({createMessage:r.optional()}).optional(),elicitation:ii({create:r.optional()}).optional()}).optional()}),k=ii({list:r.optional(),cancel:r.optional(),requests:ii({tools:ii({call:r.optional()}).optional()}).optional()}),R=ia({experimental:im(ax(),r).optional(),sampling:ia({context:r.optional(),tools:r.optional()}).optional(),elicitation:E.optional(),roots:ia({listChanged:a4().optional()}).optional(),tasks:P.optional(),extensions:im(ax(),r).optional()}),x=c.extend({protocolVersion:ax(),capabilities:R,clientInfo:w}),C=d.extend({method:i_("initialize"),params:x}),A=ia({experimental:im(ax(),r).optional(),logging:r.optional(),completions:r.optional(),prompts:ia({listChanged:a4().optional()}).optional(),resources:ia({subscribe:a4().optional(),listChanged:a4().optional()}).optional(),tools:ia({listChanged:a4().optional()}).optional(),tasks:k.optional(),extensions:im(ax(),r).optional()}),T=f.extend({protocolVersion:ax(),capabilities:A,serverInfo:w,instructions:ax().optional()}),O=h.extend({method:i_("notifications/initialized"),params:p.optional()}),j=d.extend({method:i_("ping"),params:c.optional()}),I=ia({progress:a0(),total:i$(a0()),message:i$(ax())}),N=ia({...p.shape,...I.shape,progressToken:a}),M=h.extend({method:i_("notifications/progress"),params:N}),z=c.extend({cursor:i.optional()}),q=d.extend({params:z.optional()}),H=f.extend({nextCursor:i.optional()}),D=(U=ia({uri:ax(),mimeType:i$(ax()),_meta:im(ax(),a7()).optional()})).extend({text:ax()}),L=ax().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),K=U.extend({blob:L}),J=ig(["user","assistant"]),V=ia({audience:ir(J).optional(),priority:a0().min(0).max(1).optional(),lastModified:rQ(aA,{offset:!0}).optional()}),W=ia({...S.shape,...b.shape,uri:ax(),description:i$(ax()),mimeType:i$(ax()),size:i$(a0()),annotations:V.optional(),_meta:i$(ii({}))}),F=ia({...S.shape,...b.shape,uriTemplate:ax(),description:i$(ax()),mimeType:i$(ax()),annotations:V.optional(),_meta:i$(ii({}))}),B=q.extend({method:i_("resources/list")}),Z=H.extend({resources:ir(W)}),G=q.extend({method:i_("resources/templates/list")}),X=H.extend({resourceTemplates:ir(F)}),Y=c.extend({uri:ax()}),Q=d.extend({method:i_("resources/read"),params:Y}),ee=f.extend({contents:ir(il([D,K]))}),et=h.extend({method:i_("notifications/resources/list_changed"),params:p.optional()}),er=d.extend({method:i_("resources/subscribe"),params:Y}),eo=d.extend({method:i_("resources/unsubscribe"),params:Y}),ea=p.extend({uri:ax()}),ei=h.extend({method:i_("notifications/resources/updated"),params:ea}),en=ia({name:ax(),description:i$(ax()),required:i$(a4())}),es=ia({...S.shape,...b.shape,description:i$(ax()),arguments:i$(ir(en)),_meta:i$(ii({}))}),el=q.extend({method:i_("prompts/list")}),ec=H.extend({prompts:ir(es)}),eu=c.extend({name:ax(),arguments:im(ax(),ax()).optional()}),ed=d.extend({method:i_("prompts/get"),params:eu}),ep=ia({type:i_("text"),text:ax(),annotations:V.optional(),_meta:im(ax(),a7()).optional()}),eh=ia({type:i_("image"),data:L,mimeType:ax(),annotations:V.optional(),_meta:im(ax(),a7()).optional()}),ef=ia({type:i_("audio"),data:L,mimeType:ax(),annotations:V.optional(),_meta:im(ax(),a7()).optional()}),em=ia({type:i_("tool_use"),name:ax(),id:ax(),input:im(ax(),a7()),_meta:im(ax(),a7()).optional()}),ey=ia({type:i_("resource"),resource:il([D,K]),annotations:V.optional(),_meta:im(ax(),a7()).optional()}),eg=W.extend({type:i_("resource_link")}),ev=il([ep,eh,ef,eg,ey]),e_=ia({role:J,content:ev}),eb=f.extend({description:ax().optional(),messages:ir(e_)}),eS=h.extend({method:i_("notifications/prompts/list_changed"),params:p.optional()}),ew=ia({title:ax().optional(),readOnlyHint:a4().optional(),destructiveHint:a4().optional(),idempotentHint:a4().optional(),openWorldHint:a4().optional()}),e$=ia({taskSupport:ig(["required","optional","forbidden"]).optional()}),eE=ia({...S.shape,...b.shape,description:ax().optional(),inputSchema:ia({type:i_("object"),properties:im(ax(),t).optional(),required:ir(ax()).optional()}).catchall(a7()),outputSchema:ia({type:i_("object"),properties:im(ax(),t).optional(),required:ir(ax()).optional()}).catchall(a7()).optional(),annotations:ew.optional(),execution:e$.optional(),_meta:im(ax(),a7()).optional()}),eP=q.extend({method:i_("tools/list")}),ek=H.extend({tools:ir(eE)}),eR=f.extend({content:ir(ev),structuredContent:im(ax(),a7()).optional(),isError:a4().optional()}),ex=u.extend({name:ax(),arguments:im(ax(),a7()).optional()}),eC=d.extend({method:i_("tools/call"),params:ex}),eA=h.extend({method:i_("notifications/tools/list_changed"),params:p.optional()}),eT=ig(["debug","info","notice","warning","error","critical","alert","emergency"]),eO=c.extend({level:eT}),ej=d.extend({method:i_("logging/setLevel"),params:eO}),eI=p.extend({level:eT,logger:ax().optional(),data:a7()}),eN=h.extend({method:i_("notifications/message"),params:eI}),eM=ia({name:ax().optional()}),ez=ia({hints:ir(eM).optional(),costPriority:a0().min(0).max(1).optional(),speedPriority:a0().min(0).max(1).optional(),intelligencePriority:a0().min(0).max(1).optional()}),eq=ia({mode:ig(["auto","required","none"]).optional()}),eH=ia({type:i_("tool_result"),toolUseId:ax().describe("The unique identifier for the corresponding tool call."),content:ir(ev),structuredContent:ia({}).loose().optional(),isError:a4().optional(),_meta:im(ax(),a7()).optional()}),eU=iu("type",[ep,eh,ef]),eD=iu("type",[ep,eh,ef,em,eH]),eL=ia({role:J,content:il([eD,ir(eD)]),_meta:im(ax(),a7()).optional()}),eK=u.extend({messages:ir(eL),modelPreferences:ez.optional(),systemPrompt:ax().optional(),includeContext:ig(["none","thisServer","allServers"]).optional(),temperature:a0().optional(),maxTokens:a0().int(),stopSequences:ir(ax()).optional(),metadata:r.optional(),tools:ir(eE).optional(),toolChoice:eq.optional()}),eJ=d.extend({method:i_("sampling/createMessage"),params:eK}),eV=f.extend({model:ax(),stopReason:i$(ig(["endTurn","stopSequence","maxTokens"]).or(ax())),role:J,content:eU}),eW=f.extend({model:ax(),stopReason:i$(ig(["endTurn","stopSequence","maxTokens","toolUse"]).or(ax())),role:J,content:il([eD,ir(eD)])}),eF=ia({type:i_("boolean"),title:ax().optional(),description:ax().optional(),default:a4().optional()}),eB=ia({type:i_("string"),title:ax().optional(),description:ax().optional(),minLength:a0().optional(),maxLength:a0().optional(),format:ig(["email","uri","date","date-time"]).optional(),default:ax().optional()}),eZ=ia({type:ig(["number","integer"]),title:ax().optional(),description:ax().optional(),minimum:a0().optional(),maximum:a0().optional(),default:a0().optional()}),eG=ia({type:i_("string"),title:ax().optional(),description:ax().optional(),enum:ir(ax()),default:ax().optional()}),eX=ia({type:i_("string"),title:ax().optional(),description:ax().optional(),oneOf:ir(ia({const:ax(),title:ax()})),default:ax().optional()}),eY=ia({type:i_("string"),title:ax().optional(),description:ax().optional(),enum:ir(ax()),enumNames:ir(ax()).optional(),default:ax().optional()}),eQ=il([eG,eX]),e0=ia({type:i_("array"),title:ax().optional(),description:ax().optional(),minItems:a0().optional(),maxItems:a0().optional(),items:ia({type:i_("string"),enum:ir(ax())}),default:ir(ax()).optional()}),e1=ia({type:i_("array"),title:ax().optional(),description:ax().optional(),minItems:a0().optional(),maxItems:a0().optional(),items:ia({anyOf:ir(ia({const:ax(),title:ax()}))}),default:ir(ax()).optional()}),e2=il([e0,e1]),e9=il([eY,eQ,e2]),e4=il([e9,eF,eB,eZ]),e5=u.extend({mode:i_("form").optional(),message:ax(),requestedSchema:ia({type:i_("object"),properties:im(ax(),e4),required:ir(ax()).optional()}).catchall(a7())}),e3=u.extend({mode:i_("url"),message:ax(),elicitationId:ax(),url:ax().url()}),e6=il([e5,e3]),e8=d.extend({method:i_("elicitation/create"),params:e6}),e7=p.extend({elicitationId:ax()}),te=h.extend({method:i_("notifications/elicitation/complete"),params:e7}),tt=f.extend({action:ig(["accept","decline","cancel"]),content:iq(t=>null===t?void 0:t,im(ax(),il([ax(),a0(),a4(),ir(ax())])).optional())}),tr=ia({type:i_("ref/resource"),uri:ax()}),to=ia({type:i_("ref/prompt"),name:ax()}),ta=c.extend({ref:il([to,tr]),argument:ia({name:ax(),value:ax()}),context:ia({arguments:im(ax(),ax()).optional()}).optional()}),ti=d.extend({method:i_("completion/complete"),params:ta}),tn=f.extend({completion:ii({values:ir(ax()).max(100),total:i$(a0().int()),hasMore:i$(a4())})}),ts=ia({uri:ax().startsWith("file://"),name:ax().optional(),_meta:im(ax(),a7()).optional()}),tl=d.extend({method:i_("roots/list"),params:c.optional()}),tc=f.extend({roots:ir(ts)}),tu=h.extend({method:i_("notifications/roots/list_changed"),params:p.optional()}),td=ii({ttl:a0().optional(),pollInterval:a0().optional()}),tp=ig(["working","input_required","completed","failed","cancelled"]),th=ia({taskId:ax(),status:tp,ttl:il([a0(),a3()]),createdAt:ax(),lastUpdatedAt:ax(),pollInterval:i$(a0()),statusMessage:i$(ax())}),tf=f.extend({task:th}),tm=p.merge(th),ty=h.extend({method:i_("notifications/tasks/status"),params:tm}),tg=d.extend({method:i_("tasks/get"),params:c.extend({taskId:ax()})}),tv=f.merge(th),t_=d.extend({method:i_("tasks/result"),params:c.extend({taskId:ax()})}),tb=f.loose(),tS=q.extend({method:i_("tasks/list")}),tw=H.extend({tasks:ir(th)}),t$=d.extend({method:i_("tasks/cancel"),params:c.extend({taskId:ax()})}),{JSONValueSchema:t,JSONObjectSchema:r,ProgressTokenSchema:a,CursorSchema:i,TaskMetadataSchema:n,RelatedTaskMetadataSchema:s,RequestMetaSchema:l,BaseRequestParamsSchema:c,TaskAugmentedRequestParamsSchema:u,RequestSchema:d,NotificationsParamsSchema:p,NotificationSchema:h,ResultSchema:f,RequestIdSchema:m,EmptyResultSchema:y,CancelledNotificationParamsSchema:g,CancelledNotificationSchema:v,IconSchema:_,IconsSchema:b,BaseMetadataSchema:S,ImplementationSchema:w,ClientTasksCapabilitySchema:P,ServerTasksCapabilitySchema:k,ClientCapabilitiesSchema:R,InitializeRequestParamsSchema:x,InitializeRequestSchema:C,ServerCapabilitiesSchema:A,InitializeResultSchema:T,InitializedNotificationSchema:O,PingRequestSchema:j,ProgressSchema:I,ProgressNotificationParamsSchema:N,ProgressNotificationSchema:M,PaginatedRequestParamsSchema:z,PaginatedRequestSchema:q,PaginatedResultSchema:H,ResourceContentsSchema:U,TextResourceContentsSchema:D,BlobResourceContentsSchema:K,RoleSchema:J,AnnotationsSchema:V,ResourceSchema:W,ResourceTemplateSchema:F,ListResourcesRequestSchema:B,ListResourcesResultSchema:Z,ListResourceTemplatesRequestSchema:G,ListResourceTemplatesResultSchema:X,ResourceRequestParamsSchema:Y,ReadResourceRequestParamsSchema:Y,ReadResourceRequestSchema:Q,ReadResourceResultSchema:ee,ResourceListChangedNotificationSchema:et,SubscribeRequestParamsSchema:Y,SubscribeRequestSchema:er,UnsubscribeRequestParamsSchema:Y,UnsubscribeRequestSchema:eo,ResourceUpdatedNotificationParamsSchema:ea,ResourceUpdatedNotificationSchema:ei,PromptArgumentSchema:en,PromptSchema:es,ListPromptsRequestSchema:el,ListPromptsResultSchema:ec,GetPromptRequestParamsSchema:eu,GetPromptRequestSchema:ed,TextContentSchema:ep,ImageContentSchema:eh,AudioContentSchema:ef,ToolUseContentSchema:em,EmbeddedResourceSchema:ey,ResourceLinkSchema:eg,ContentBlockSchema:ev,PromptMessageSchema:e_,GetPromptResultSchema:eb,PromptListChangedNotificationSchema:eS,ToolAnnotationsSchema:ew,ToolExecutionSchema:e$,ToolSchema:eE,ListToolsRequestSchema:eP,ListToolsResultSchema:ek,CallToolResultSchema:eR,CallToolRequestParamsSchema:ex,CallToolRequestSchema:eC,ToolListChangedNotificationSchema:eA,LoggingLevelSchema:eT,SetLevelRequestParamsSchema:eO,SetLevelRequestSchema:ej,LoggingMessageNotificationParamsSchema:eI,LoggingMessageNotificationSchema:eN,ModelHintSchema:eM,ModelPreferencesSchema:ez,ToolChoiceSchema:eq,ToolResultContentSchema:eH,SamplingContentSchema:eU,SamplingMessageContentBlockSchema:eD,SamplingMessageSchema:eL,CreateMessageRequestParamsSchema:eK,CreateMessageRequestSchema:eJ,CreateMessageResultSchema:eV,CreateMessageResultWithToolsSchema:eW,BooleanSchemaSchema:eF,StringSchemaSchema:eB,NumberSchemaSchema:eZ,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:ta,CompleteRequestSchema:ti,CompleteResultSchema:tn,RootSchema:ts,ListRootsRequestSchema:tl,ListRootsResultSchema:tc,RootsListChangedNotificationSchema:tu,TaskCreationParamsSchema:td,TaskStatusSchema:tp,TaskSchema:th,CreateTaskResultSchema:tf,TaskStatusNotificationParamsSchema:tm,TaskStatusNotificationSchema:ty,GetTaskRequestSchema:tg,GetTaskResultSchema:tv,GetTaskPayloadRequestSchema:t_,GetTaskPayloadResultSchema:tb,ListTasksRequestSchema:tS,ListTasksResultSchema:tw,CancelTaskRequestSchema:t$,CancelTaskResultSchema:f.merge(th),ClientRequestSchema:il([j,C,ti,ej,ed,el,B,G,Q,er,eo,eC,eP,tg,t_,tS,t$]),ClientNotificationSchema:il([v,M,O,tu,ty]),ClientResultSchema:il([y,eV,eW,tt,tc,tv,tw,tf]),ServerRequestSchema:il([j,eJ,e8,tl,tg,t_,tS,t$]),ServerNotificationSchema:il([v,M,eN,ei,et,eA,eS,ty,te]),ServerResultSchema:il([y,T,tn,eb,ec,Z,X,ee,eR,ek,tv,tw,tf]),CallToolResultWireSchema:a7().superRefine((t,r)=>{if(!("object"!=typeof t||null===t||Array.isArray(t))&&void 0===t.content){for(let o of lG)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(lX).pipe(eR)})}function lQ(t){return"object"!==t.type}let l0=new Set(["const","enum","default","examples"]),l1=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function l2(t){return void 0!==t&&!("string"==typeof t&&t.startsWith("#"))}let l9={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},l4={"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},l5={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null};function l3(){if(a)return a;let t=lY();return a={requestSchemas:{ping:t.PingRequestSchema,initialize:t.InitializeRequestSchema,"completion/complete":t.CompleteRequestSchema,"logging/setLevel":t.SetLevelRequestSchema,"prompts/get":t.GetPromptRequestSchema,"prompts/list":t.ListPromptsRequestSchema,"resources/list":t.ListResourcesRequestSchema,"resources/templates/list":t.ListResourceTemplatesRequestSchema,"resources/read":t.ReadResourceRequestSchema,"resources/subscribe":t.SubscribeRequestSchema,"resources/unsubscribe":t.UnsubscribeRequestSchema,"tools/call":t.CallToolRequestSchema,"tools/list":t.ListToolsRequestSchema,"tasks/get":t.GetTaskRequestSchema,"tasks/result":t.GetTaskPayloadRequestSchema,"tasks/list":t.ListTasksRequestSchema,"tasks/cancel":t.CancelTaskRequestSchema,"sampling/createMessage":t.CreateMessageRequestSchema,"elicitation/create":t.ElicitRequestSchema,"roots/list":t.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":t.CancelledNotificationSchema,"notifications/progress":t.ProgressNotificationSchema,"notifications/initialized":t.InitializedNotificationSchema,"notifications/roots/list_changed":t.RootsListChangedNotificationSchema,"notifications/tasks/status":t.TaskStatusNotificationSchema,"notifications/message":t.LoggingMessageNotificationSchema,"notifications/resources/updated":t.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":t.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":t.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":t.PromptListChangedNotificationSchema,"notifications/elicitation/complete":t.ElicitationCompleteNotificationSchema},resultSchemas:{ping:t.EmptyResultSchema,initialize:t.InitializeResultSchema,"completion/complete":t.CompleteResultSchema,"logging/setLevel":t.EmptyResultSchema,"prompts/get":t.GetPromptResultSchema,"prompts/list":t.ListPromptsResultSchema,"resources/list":t.ListResourcesResultSchema,"resources/templates/list":t.ListResourceTemplatesResultSchema,"resources/read":t.ReadResourceResultSchema,"resources/subscribe":t.EmptyResultSchema,"resources/unsubscribe":t.EmptyResultSchema,"tools/call":t.CallToolResultWireSchema,"tools/list":t.ListToolsResultSchema,"sampling/createMessage":t.CreateMessageResultWithToolsSchema,"elicitation/create":t.ElicitResultSchema,"roots/list":t.ListRootsResultSchema}}}function l6(t){return Object.prototype.hasOwnProperty.call(l9,t)}function l8(t){return Object.prototype.hasOwnProperty.call(l4,t)}function l7(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function ce(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(l9),Object.keys(l4);let ct={ok:!1,reason:"not-in-era"};function cr(t){return l7(t)&&l7(t.outputSchema)&&lQ(t.outputSchema)}let co={era:"2025-11-25",hasRequestMethod:l6,hasNotificationMethod:l8,validateRequest:(t,r)=>{var o;return ce(l6(o=t)?l3().requestSchemas[o]:void 0,r)},validateResult:(t,r)=>{var o,a;return ce((a=o=t,Object.prototype.hasOwnProperty.call(l5,a))?l3().resultSchemas[o]:void 0,r)},validateNotification:(t,r)=>{var o;return ce(l8(o=t)?l3().notificationSchemas[o]:void 0,r)},hasInputRequestMethod:()=>!1,validateInputRequest:()=>ct,validateInputResponse:()=>ct,samplingResultVariant:(t,r)=>{let o=lY();return ce(t?o.CreateMessageResultWithToolsSchema:o.CreateMessageResultSchema,r)},outboundEnvelope:t=>void 0,validateEnvelopeMeta:t=>[],projectCallToolResult(t,r){let o=lZ(t),a=o.structuredContent;if(void 0===a)return o;let i="object"!=typeof a||null===a||Array.isArray(a),n=void 0!==r&&lQ(r);return i||n?{...o,structuredContent:{result:a}}:o},decodeResult(t,r){if(l7(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=>cr(t))?{...r,tools:o.map(t=>cr(t)?{...t,outputSchema:function(t){var r;let o="string"==typeof t.$schema?t.$schema:void 0;if(l2(t.$id))return{...void 0!==o&&{$schema:o},type:"object",properties:{result:t},required:["result"]};let a="string"==typeof(r=t.$schema)&&U.has(r.replace(/#$/,""))&&!0!==t.$recursiveAnchor,i=(t,r)=>{if(Array.isArray(t))return t.map(t=>i(t,!1));if(null===t||"object"!=typeof t||!r&&l2(t.$id))return t;let o={},n=!1;for(let[s,l]of Object.entries(t))r?o[s]=i(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&&a?n=!0:l0.has(s)?o[s]=l:l1.has(s)?o[s]=i(l,!0):o[s]=i(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:i(t,!1)},required:["result"]}}(t.outputSchema)}:t)}:r},encodeErrorCode:t=>-32002===t?-32602:t,checkInboundEnvelope:t=>void 0};function ca(){return s??=function(){let t=iM(()=>il([ax(),a0(),a4(),a3(),im(ax(),t),ir(t)])),r=im(ax(),t),o=il([ax(),a0().int()]),a=ax(),i=il([ax(),a0().int()]),n=ig(["user","assistant"]),s=ig(["debug","info","notice","warning","error","critical","alert","emergency"]),l=ax().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),c=ia({ttl:a0().optional()}),u=ia({taskId:ax()}),d=ii({progressToken:o.optional(),"io.modelcontextprotocol/related-task":u.optional()}),p=ia({_meta:d.optional()}),h=p.extend({task:c.optional()}),f=ia({_meta:d.optional()}),m=ia({method:ax(),params:f.loose().optional()}),y=ia({src:ax(),mimeType:ax().optional(),sizes:ir(ax()).optional(),theme:ig(["light","dark"]).optional()}),g=ia({icons:ir(y).optional()}),v=ia({name:ax(),title:ax().optional()}),_=v.extend({...v.shape,...g.shape,version:ax(),websiteUrl:ax().optional(),description:ax().optional()}),b=ip(ia({applyDefaults:a4().optional()}),r),S=iq(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,ip(ia({form:b.optional(),url:r.optional()}),r.optional())),w=ii({list:r.optional(),cancel:r.optional(),requests:ii({sampling:ii({createMessage:r.optional()}).optional(),elicitation:ii({create:r.optional()}).optional()}).optional()}),$=ii({list:r.optional(),cancel:r.optional(),requests:ii({tools:ii({call:r.optional()}).optional()}).optional()}),E=ia({experimental:im(ax(),r).optional(),sampling:ia({context:r.optional(),tools:r.optional()}).optional(),elicitation:S.optional(),roots:ia({listChanged:a4().optional()}).optional(),tasks:w.optional(),extensions:im(ax(),r).optional()}),P=ia({experimental:im(ax(),r).optional(),logging:r.optional(),completions:r.optional(),prompts:ia({listChanged:a4().optional()}).optional(),resources:ia({subscribe:a4().optional(),listChanged:a4().optional()}).optional(),tools:ia({listChanged:a4().optional()}).optional(),tasks:$.optional(),extensions:im(ax(),r).optional()}),k=ia({progress:a0(),total:i$(a0()),message:i$(ax())}),R=ia({...f.shape,...k.shape,progressToken:o}),x=m.extend({method:i_("notifications/progress"),params:R}),C=f.extend({level:s,logger:ax().optional(),data:a7()}),A=m.extend({method:i_("notifications/message"),params:C}),T=ia({uri:ax(),mimeType:i$(ax()),_meta:im(ax(),a7()).optional()}),O=T.extend({text:ax()}),j=T.extend({blob:l}),I=ia({audience:ir(n).optional(),priority:a0().min(0).max(1).optional(),lastModified:rQ(aA,{offset:!0}).optional()}),N=ia({...v.shape,...g.shape,uri:ax(),description:i$(ax()),mimeType:i$(ax()),size:i$(a0()),annotations:I.optional(),_meta:i$(ii({}))}),M=ia({...v.shape,...g.shape,uriTemplate:ax(),description:i$(ax()),mimeType:i$(ax()),annotations:I.optional(),_meta:i$(ii({}))}),z=m.extend({method:i_("notifications/resources/list_changed"),params:f.optional()}),q=f.extend({uri:ax()}),H=m.extend({method:i_("notifications/resources/updated"),params:q}),U=ia({name:ax(),description:i$(ax()),required:i$(a4())}),D=ia({...v.shape,...g.shape,description:i$(ax()),arguments:i$(ir(U)),_meta:i$(ii({}))}),L=m.extend({method:i_("notifications/prompts/list_changed"),params:f.optional()}),K=ia({type:i_("text"),text:ax(),annotations:I.optional(),_meta:im(ax(),a7()).optional()}),J=ia({type:i_("image"),data:l,mimeType:ax(),annotations:I.optional(),_meta:im(ax(),a7()).optional()}),V=ia({type:i_("audio"),data:l,mimeType:ax(),annotations:I.optional(),_meta:im(ax(),a7()).optional()}),W=ia({type:i_("tool_use"),name:ax(),id:ax(),input:im(ax(),a7()),_meta:im(ax(),a7()).optional()}),F=ia({type:i_("resource"),resource:il([O,j]),annotations:I.optional(),_meta:im(ax(),a7()).optional()}),B=N.extend({type:i_("resource_link")}),Z=il([K,J,V,B,F]),G=ia({role:n,content:Z}),X=ia({title:ax().optional(),readOnlyHint:a4().optional(),destructiveHint:a4().optional(),idempotentHint:a4().optional(),openWorldHint:a4().optional()}),Y=m.extend({method:i_("notifications/tools/list_changed"),params:f.optional()}),Q=ia({name:ax().optional()}),ee=ia({hints:ir(Q).optional(),costPriority:a0().min(0).max(1).optional(),speedPriority:a0().min(0).max(1).optional(),intelligencePriority:a0().min(0).max(1).optional()}),et=ia({mode:ig(["auto","required","none"]).optional()}),er=ia({type:i_("boolean"),title:ax().optional(),description:ax().optional(),default:a4().optional()}),eo=ia({type:i_("string"),title:ax().optional(),description:ax().optional(),minLength:a0().optional(),maxLength:a0().optional(),format:ig(["email","uri","date","date-time"]).optional(),default:ax().optional()}),ea=ia({type:ig(["number","integer"]),title:ax().optional(),description:ax().optional(),minimum:a0().optional(),maximum:a0().optional(),default:a0().optional()}),ei=ia({type:i_("string"),title:ax().optional(),description:ax().optional(),enum:ir(ax()),default:ax().optional()}),en=ia({type:i_("string"),title:ax().optional(),description:ax().optional(),oneOf:ir(ia({const:ax(),title:ax()})),default:ax().optional()}),es=ia({type:i_("string"),title:ax().optional(),description:ax().optional(),enum:ir(ax()),enumNames:ir(ax()).optional(),default:ax().optional()}),el=il([ei,en]),ec=ia({type:i_("array"),title:ax().optional(),description:ax().optional(),minItems:a0().optional(),maxItems:a0().optional(),items:ia({type:i_("string"),enum:ir(ax())}),default:ir(ax()).optional()}),eu=ia({type:i_("array"),title:ax().optional(),description:ax().optional(),minItems:a0().optional(),maxItems:a0().optional(),items:ia({anyOf:ir(ia({const:ax(),title:ax()}))}),default:ir(ax()).optional()}),ed=il([ec,eu]),ep=il([es,el,ed]),eh=il([ep,er,eo,ea]),ef=h.extend({mode:i_("form").optional(),message:ax(),requestedSchema:ia({type:i_("object"),properties:im(ax(),eh),required:ir(ax()).optional()}).catchall(a7())}),em=ia({type:i_("ref/resource"),uri:ax()}),ey=ia({type:i_("ref/prompt"),name:ax()}),eg=ia({uri:ax().startsWith("file://"),name:ax().optional(),_meta:im(ax(),a7()).optional()}),ev=E.shape,e_=ia({experimental:ev.experimental,sampling:ev.sampling,elicitation:ev.elicitation,roots:ev.roots,extensions:ev.extensions}),eb=P.shape,eS=ia({experimental:eb.experimental,logging:eb.logging,completions:eb.completions,prompts:eb.prompts,resources:eb.resources,tools:eb.tools,extensions:eb.extensions}),ew=ii({progressToken:o.optional(),[iL]:ax(),[iK]:_.optional(),[iV]:e_,[iF]:s.optional()}),e$=ia({...v.shape,...g.shape,description:ax().optional(),inputSchema:ii({$schema:ax().optional(),type:i_("object")}),outputSchema:ii({$schema:ax().optional()}).optional(),annotations:X.optional(),_meta:im(ax(),a7()).optional()}),eE=ia({type:i_("tool_result"),toolUseId:ax(),content:ir(Z),structuredContent:a7().optional(),isError:a4().optional(),_meta:im(ax(),a7()).optional()}),eP=il([K,J,V,W,eE]),ek=ia({role:n,content:il([eP,ir(eP)]),_meta:im(ax(),a7()).optional()}),eR=ax(),ex=ii({[iJ]:_.optional().catch(void 0)}),eC=ex.optional();function eA(t){return ii({_meta:eC,resultType:eR.default("complete"),...t})}let eT=eA({}),eO=eA({nextCursor:a.optional()}),ej=eA({content:ir(Z),structuredContent:a7().optional(),isError:a4().optional()}),eI=eA({ttlMs:a0().int().min(0),cacheScope:ig(["public","private"]),tools:ir(e$),nextCursor:a.optional()}),eN=eA({ttlMs:a0().int().min(0),cacheScope:ig(["public","private"]),prompts:ir(D),nextCursor:a.optional()}),eM=eA({description:ax().optional(),messages:ir(G)}),ez=eA({ttlMs:a0().int().min(0),cacheScope:ig(["public","private"]),resources:ir(N),nextCursor:a.optional()}),eq=eA({ttlMs:a0().int().min(0),cacheScope:ig(["public","private"]),resourceTemplates:ir(M),nextCursor:a.optional()}),eH=eA({ttlMs:a0().int().min(0),cacheScope:ig(["public","private"]),contents:ir(il([O,j]))}),eU=eA({completion:ia({values:ir(ax()).max(100),total:a0().int().optional(),hasMore:a4().optional()}).loose()}),eD=eA({ttlMs:a0().int().min(0),cacheScope:ig(["public","private"])}),eL=eA({ttlMs:a0().int().min(0).catch(0),cacheScope:ig(["public","private"]).catch("private"),supportedVersions:ir(ax()),capabilities:eS,instructions:ax().optional()}),eK=ia({messages:ir(ek),modelPreferences:ee.optional(),systemPrompt:ax().optional(),includeContext:ig(["none","thisServer","allServers"]).optional(),temperature:a0().optional(),maxTokens:a0().int(),stopSequences:ir(ax()).optional(),metadata:r.optional(),tools:ir(e$).optional(),toolChoice:et.optional()}),eJ=ia({method:i_("sampling/createMessage"),params:eK}),eV=ia({method:i_("roots/list"),params:ia({_meta:im(ax(),a7()).optional()}).optional()}),eW=ia({...ek.shape,model:ax(),stopReason:ax().optional()}),eF=ia({roots:ir(eg)}),eB=ia({action:ig(["accept","decline","cancel"]),content:im(ax(),il([ax(),a0(),a4(),ir(ax())])).optional()}),eZ=ia({mode:i_("url"),message:ax(),url:ax().url()}),eG=il([ef,eZ]),eX=ia({method:i_("elicitation/create"),params:eG}),eY=il([eJ,eV,eX]),eQ=il([eW,eF,eB]),e0=im(ax(),eY),e1=im(ax(),eQ),e2=eA({inputRequests:e0.optional(),requestState:ax().optional()}),e9={inputResponses:e1.optional(),requestState:ax().optional()},e4=ia({_meta:ew,...e9}),e5=ii({progressToken:o.optional()});function e3(t,r){return ia({method:i_(t),params:ia({_meta:ew,...r})})}function e6(t,r){return ia({method:i_(t),params:ia({_meta:e5.optional(),...r}).optional()})}let e8={name:ax(),arguments:im(ax(),a7()).optional(),...e9},e7={cursor:a.optional()},te=e3("tools/call",e8),tt=e3("tools/list",e7),tr=e3("prompts/list",e7),to=e3("prompts/get",{name:ax(),arguments:im(ax(),ax()).optional(),...e9}),ta=e3("resources/list",e7),ti=e3("resources/templates/list",e7),tn=e3("resources/read",{uri:ax(),...e9}),ts={ref:il([ey,em]),argument:ia({name:ax(),value:ax()}),context:ia({arguments:im(ax(),ax()).optional()}).optional()},tl=e3("completion/complete",ts),tc=e3("server/discover",{}),tu=ia({toolsListChanged:a4().optional(),promptsListChanged:a4().optional(),resourcesListChanged:a4().optional(),resourceSubscriptions:ir(ax()).optional()}),td={notifications:tu},tp=e3("subscriptions/listen",td),th=ex.extend({"io.modelcontextprotocol/subscriptionId":i}),tf=ii({_meta:th,resultType:eR.default("complete")}),tm={"tools/call":e6("tools/call",e8),"tools/list":e6("tools/list",e7),"prompts/get":e6("prompts/get",{name:ax(),arguments:im(ax(),ax()).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:ax()}),"completion/complete":e6("completion/complete",ts),"server/discover":e6("server/discover",{}),"subscriptions/listen":e6("subscriptions/listen",td)};function ty(t){return ii({_meta:eC,...t})}let tg={"tools/call":ty({content:ir(Z),structuredContent:a7().optional(),isError:a4().optional()}),"tools/list":ty({ttlMs:a0().int().min(0),cacheScope:ig(["public","private"]),tools:ir(e$),nextCursor:a.optional()}),"prompts/get":ty({description:ax().optional(),messages:ir(G)}),"prompts/list":ty({ttlMs:a0().int().min(0),cacheScope:ig(["public","private"]),prompts:ir(D),nextCursor:a.optional()}),"resources/list":ty({ttlMs:a0().int().min(0),cacheScope:ig(["public","private"]),resources:ir(N),nextCursor:a.optional()}),"resources/templates/list":ty({ttlMs:a0().int().min(0),cacheScope:ig(["public","private"]),resourceTemplates:ir(M),nextCursor:a.optional()}),"resources/read":ty({ttlMs:a0().int().min(0),cacheScope:ig(["public","private"]),contents:ir(il([O,j]))}),"completion/complete":ty({completion:ia({values:ir(ax()).max(100),total:a0().int().optional(),hasMore:a4().optional()}).loose()}),"server/discover":ty({ttlMs:a0().int().min(0).catch(0),cacheScope:ig(["public","private"]).catch("private"),supportedVersions:ir(ax()),capabilities:eS,instructions:ax().optional()}),"subscriptions/listen":ty({})},tv=ii({"io.modelcontextprotocol/subscriptionId":i.optional()}),t_=ia({method:i_("notifications/subscriptions/acknowledged"),params:ia({_meta:tv.optional(),notifications:tu})}),tb=ia({_meta:tv.optional(),requestId:i,reason:ax().optional()}),tS=ia({method:i_("notifications/cancelled"),params:tb}),tw=t=>ia({jsonrpc:i_("2.0"),id:il([ax(),a0().int()]),result:t}).strict();return{JSONValueSchema:t,JSONObjectSchema:r,ProgressTokenSchema:o,CursorSchema:a,RequestIdSchema:i,RoleSchema:n,LoggingLevelSchema:s,TaskMetadataSchema:c,RelatedTaskMetadataSchema:u,RequestMetaSchema:d,BaseRequestParamsSchema:p,TaskAugmentedRequestParamsSchema:h,NotificationsParamsSchema:f,NotificationSchema:m,IconSchema:y,IconsSchema:g,BaseMetadataSchema:v,ImplementationSchema:_,ClientTasksCapabilitySchema:w,ServerTasksCapabilitySchema:$,ClientCapabilitiesSchema:E,ServerCapabilitiesSchema:P,ProgressSchema:k,ProgressNotificationParamsSchema:R,ProgressNotificationSchema:x,LoggingMessageNotificationParamsSchema:C,LoggingMessageNotificationSchema:A,ResourceContentsSchema:T,TextResourceContentsSchema:O,BlobResourceContentsSchema:j,AnnotationsSchema:I,ResourceSchema:N,ResourceTemplateSchema:M,ResourceListChangedNotificationSchema:z,ResourceUpdatedNotificationParamsSchema:q,ResourceUpdatedNotificationSchema:H,PromptArgumentSchema:U,PromptSchema:D,PromptListChangedNotificationSchema:L,TextContentSchema:K,ImageContentSchema:J,AudioContentSchema:V,ToolUseContentSchema:W,EmbeddedResourceSchema:F,ResourceLinkSchema:B,ContentBlockSchema:Z,PromptMessageSchema:G,ToolAnnotationsSchema:X,ToolListChangedNotificationSchema:Y,ModelHintSchema:Q,ModelPreferencesSchema:ee,ToolChoiceSchema:et,BooleanSchemaSchema:er,StringSchemaSchema:eo,NumberSchemaSchema:ea,UntitledSingleSelectEnumSchemaSchema:ei,TitledSingleSelectEnumSchemaSchema:en,LegacyTitledEnumSchemaSchema:es,SingleSelectEnumSchemaSchema:el,UntitledMultiSelectEnumSchemaSchema:ec,TitledMultiSelectEnumSchemaSchema:eu,MultiSelectEnumSchemaSchema:ed,EnumSchemaSchema:ep,PrimitiveSchemaDefinitionSchema:eh,ElicitRequestFormParamsSchema:ef,ResourceTemplateReferenceSchema:em,PromptReferenceSchema:ey,RootSchema:eg,ClientCapabilities2026Schema:e_,ServerCapabilities2026Schema:eS,RequestMetaEnvelopeSchema:ew,ToolSchema:e$,ToolResultContentSchema:eE,SamplingMessageContentBlockSchema:eP,SamplingMessageSchema:ek,ResultTypeSchema:eR,ResultMetaSchema:ex,ResultSchema:eT,PaginatedResultSchema:eO,CallToolResultSchema:ej,ListToolsResultSchema:eI,ListPromptsResultSchema:eN,GetPromptResultSchema:eM,ListResourcesResultSchema:ez,ListResourceTemplatesResultSchema:eq,ReadResourceResultSchema:eH,CompleteResultSchema:eU,CacheableResultSchema:eD,DiscoverResultSchema:eL,CreateMessageRequestParamsSchema:eK,CreateMessageRequestSchema:eJ,ListRootsRequestSchema:eV,CreateMessageResultSchema:eW,ListRootsResultSchema:eF,ElicitResultSchema:eB,ElicitRequestURLParamsSchema:eZ,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:ta,ListResourceTemplatesRequestSchema:ti,ReadResourceRequestSchema:tn,CompleteRequestSchema:tl,DiscoverRequestSchema:tc,SubscriptionFilterSchema:tu,SubscriptionsListenRequestSchema:tp,SubscriptionsListenResultMetaSchema:th,SubscriptionsListenResultSchema:tf,dispatchRequestSchemas:tm,dispatchResultSchemas:tg,NotificationMetaSchema:tv,SubscriptionsAcknowledgedNotificationSchema:t_,CancelledNotificationParamsSchema:tb,CancelledNotificationSchema:tS,notificationSchemas2026:{"notifications/cancelled":tS,"notifications/progress":x,"notifications/message":A,"notifications/resources/updated":H,"notifications/resources/list_changed":z,"notifications/tools/list_changed":Y,"notifications/prompts/list_changed":L,"notifications/subscriptions/acknowledged":t_},JSONRPCResultResponseSchema:tw(eT),CallToolResultResponseSchema:tw(il([ej,e2])),ListToolsResultResponseSchema:tw(eI),ListPromptsResultResponseSchema:tw(eN),GetPromptResultResponseSchema:tw(il([eM,e2])),ListResourcesResultResponseSchema:tw(ez),ListResourceTemplatesResultResponseSchema:tw(eq),ReadResourceResultResponseSchema:tw(il([eH,e2])),CompleteResultResponseSchema:tw(eU),DiscoverResultResponseSchema:tw(eL),SubscriptionsListenResultResponseSchema:tw(tf)}}()}let ci=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"],cn=Symbol("modelcontextprotocol.resultCacheHintFallback");function cs(t){return"number"==typeof t&&Number.isSafeInteger(t)&&t>=0}function cl(t){return"public"===t||"private"===t}let cc=((k={})[k.ParseError=-32700]="ParseError",k[k.InvalidRequest=-32600]="InvalidRequest",k[k.MethodNotFound=-32601]="MethodNotFound",k[k.InvalidParams=-32602]="InvalidParams",k[k.InternalError=-32603]="InternalError",k[k.ResourceNotFound=-32002]="ResourceNotFound",k[k.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",k[k.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",k[k.UrlElicitationRequired=-32042]="UrlElicitationRequired",k);var cu=class t extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return lq(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 lq(this,t)}constructor(t,r,o){super(r),this.code=t,this.data=o,this.name="ProtocolError",lz(this,new.target)}static fromError(r,o,a){return r===cc.UrlElicitationRequired&&a&&a.elicitations?new cp(a.elicitations,o):r===cc.UnsupportedProtocolVersion&&a&&Array.isArray(a.supported)&&"string"==typeof a.requested?new ch({supported:a.supported,requested:a.requested},o):(r===cc.InvalidParams||r===cc.ResourceNotFound)&&"string"==typeof a?.uri&&(r===cc.ResourceNotFound||1===Object.keys(a).length)?new cd(a.uri,o):r===cc.MissingRequiredClientCapability&&a&&null!==a.requiredCapabilities&&"object"==typeof a.requiredCapabilities&&!Array.isArray(a.requiredCapabilities)?new cf({requiredCapabilities:a.requiredCapabilities},o):new t(r,o,a)}},cd=class extends cu{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(t,r=`Resource not found: ${t}`){super(cc.InvalidParams,r,{uri:t})}get uri(){return this.data.uri}},cp=class extends cu{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(cc.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}},ch=class extends cu{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(t,r=`Unsupported protocol version: ${t.requested}`){super(cc.UnsupportedProtocolVersion,r,t)}get supported(){return this.data.supported}get requested(){return this.data.requested}},cf=class extends cu{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(t,r=`Missing required client capabilities: ${Object.keys(t.requiredCapabilities).join(", ")}`){super(cc.MissingRequiredClientCapability,r,t)}get requiredCapabilities(){return this.data.requiredCapabilities}};let cm=["tools/call","prompts/get","resources/read"],cy=["elicitation/create","sampling/createMessage","roots/list"];function cg(){if(l)return l;let t=ca();return l={request:{"elicitation/create":ia({method:i_("elicitation/create"),params:t.ElicitRequestParamsSchema}),"sampling/createMessage":ia({method:i_("sampling/createMessage"),params:t.CreateMessageRequestParamsSchema}),"roots/list":ia({method:i_("roots/list"),params:ii({}).optional()})},response:{"elicitation/create":t.ElicitResultSchema,"sampling/createMessage":t.CreateMessageResultSchema,"roots/list":t.ListRootsResultSchema}}}function cv(t){return cy.includes(t)}function c_(t){return cv(t)?cg().request[t]:void 0}let cb={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},cS={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function cw(t){return Object.prototype.hasOwnProperty.call(cb,t)}function c$(t){return Object.prototype.hasOwnProperty.call(cS,t)}function cE(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(cb),Object.keys(cS);let ck={ok:!1,reason:"not-in-era"},cR=[iL,iV],cx={era:"2026-07-28",hasRequestMethod:cw,hasNotificationMethod:c$,hasInputRequestMethod:t=>void 0!==c_(t),validateRequest:(t,r)=>{var o;return cP(cw(o=t)?ca().dispatchRequestSchemas[o]:void 0,r)},validateResult:(t,r)=>{var o,a;return cP((a=o=t,Object.prototype.hasOwnProperty.call(cb,a))?ca().dispatchResultSchemas[o]:void 0,r)},validateNotification:(t,r)=>{var o;return cP(c$(o=t)?ca().notificationSchemas2026[o]:void 0,r)},validateInputRequest:(t,r)=>cP(c_(t),r),validateInputResponse:(t,r)=>{var o;return cP(cv(o=t)?cg().response[o]:void 0,r)},samplingResultVariant:()=>ck,outboundEnvelope:t=>({[iL]:t.protocolVersion,[iK]:t.clientInfo,[iV]:t.clientCapabilities,...void 0!==t.logLevel&&{[iF]:t.logLevel}}),validateEnvelopeMeta(t){let r=[];for(let o of cR)o in t||r.push({key:o,problem:"missing"});let o=ca().RequestMetaEnvelopeSchema.safeParse(t);if(!o.success)for(let t of o.error.issues){let o=t.path.map(String),a=o.length>0?o.join("."):"_meta";1===o.length&&r.some(t=>t.key===a&&"missing"===t.problem)||r.push({key:a,problem:t.message})}return r},projectCallToolResult:t=>lZ(t),inputRequestSchema:c_,decodeResult(t,r){if(!cE(r))return{kind:"invalid",error:new lL(lD.InvalidResult,`Invalid result for ${t}: not an object`,{method:t})};let o=r.resultType;if(void 0===o)return{kind:"invalid",error:new lL(lD.InvalidResult,`Invalid result for ${t}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:t,violation:"missing-resultType"})};if("string"!=typeof o)return{kind:"invalid",error:new lL(lD.InvalidResult,`Invalid result for ${t}: non-string resultType`,{method:t,resultType:o})};if("input_required"===o){let o=r.inputRequests,a=cE(o)?o:{},i=r.requestState,n=void 0===r._meta?void 0:ca().ResultMetaSchema.safeParse(r._meta),s=n?.success?n.data:void 0;return 0===Object.keys(a).length&&"string"!=typeof i?{kind:"invalid",error:new lL(lD.InvalidResult,`Invalid result for ${t}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:t,violation:"input-required-missing-both"})}:{kind:"input_required",inputRequests:a,..."string"==typeof i&&{requestState:i},...void 0!==s&&{_meta:s}}}if("complete"!==o)return{kind:"invalid",error:new lL(lD.UnsupportedResultType,`Unsupported result type '${o}' for ${t}`,{resultType:o,method:t})};let a=function(){if(c)return c;let t=ca();return c={"tools/call":t.CallToolResultSchema,"tools/list":t.ListToolsResultSchema,"prompts/get":t.GetPromptResultSchema,"prompts/list":t.ListPromptsResultSchema,"resources/list":t.ListResourcesResultSchema,"resources/templates/list":t.ListResourceTemplatesResultSchema,"resources/read":t.ReadResourceResultSchema,"completion/complete":t.CompleteResultSchema,"server/discover":t.DiscoverResultSchema}}(),i=Object.hasOwn(a,t)?a[t]:void 0;if(void 0!==i){let o=i.safeParse(r);if(!o.success)return{kind:"invalid",error:new lL(lD.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 a=t._meta;return void 0===a?{...t,_meta:{[iJ]:r}}:null===(o=a)||"object"!=typeof o||Array.isArray(o)||void 0!==a[iJ]?t:{...t,_meta:{...a,[iJ]:r}}})(function(t,r){var o,a,i,n;let s=r[cn];if("complete"!==r.resultType||(o=t,!ci.includes(o))){let t;return void 0===s?r:(t={...a=r},delete t[cn],t)}let l=cs(r.ttlMs)?r.ttlMs:void 0!==(i=s)&&cs(i.ttlMs)?i.ttlMs:0,c=cl(r.cacheScope)?r.cacheScope:void 0!==(n=s)&&cl(n.cacheScope)?n.cacheScope:"private",u={...r,ttlMs:l,cacheScope:c};return delete u[cn],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 cu(cc.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,a=!1,i=()=>(a||(o={...o},a=!0),o),n=r.tools;"tools/list"===t&&Array.isArray(n)&&n.some(t=>cE(t)&&"execution"in t)&&(i().tools=n.map(t=>{if(!cE(t)||!("execution"in t))return t;let r={...t};return delete r.execution,r}));let s=r.capabilities;if(cE(s)&&"tasks"in s){let t={...s};delete t.tasks,i().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=ca().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("; ")}`}},cC="2026-07-28";function cA(t){return void 0!==t&&t>=lV?cx:co}function cT(t){return void 0!==t.revision?cA(t.revision).era:"modern"===t.era?cx.era:co.era}function cO(t){return cN.some(r=>r.hasRequestMethod(t))}function cj(t){return cN.some(r=>r.hasNotificationMethod(t))}function cI(t){return"tasks/get"===t||"tasks/cancel"===t}let cN=[co,cx];var cM=((t,r)=>{let o={};for(var a in t)O(o,a,{get:t[a],enumerable:!0});return r&&O(o,Symbol.toStringTag,{value:"Module"}),o})({AnnotationsSchema:()=>nz,AudioContentSchema:()=>so,BaseMetadataSchema:()=>nd,BaseRequestParamsSchema:()=>i2,BlobResourceContentsSchema:()=>nN,BooleanSchemaSchema:()=>sq,CallToolRequestParamsSchema:()=>sv,CallToolRequestSchema:()=>s_,CallToolResultSchema:()=>sy,CancelTaskRequestSchema:()=>lf,CancelTaskResultSchema:()=>lm,CancelledNotificationParamsSchema:()=>ns,CancelledNotificationSchema:()=>nl,ClientCapabilitiesSchema:()=>ng,ClientNotificationSchema:()=>lg,ClientRequestSchema:()=>ly,ClientResultSchema:()=>lv,ClientTasksCapabilitySchema:()=>nm,CompatibilityCallToolResultSchema:()=>sg,CompleteRequestParamsSchema:()=>s5,CompleteRequestSchema:()=>s3,CompleteResultSchema:()=>s6,ContentBlockSchema:()=>ss,CreateMessageRequestParamsSchema:()=>sI,CreateMessageRequestSchema:()=>sN,CreateMessageResultSchema:()=>sM,CreateMessageResultWithToolsSchema:()=>sz,CreateTaskResultSchema:()=>li,CursorSchema:()=>iY,DiscoverRequestSchema:()=>n$,DiscoverResultSchema:()=>nE,ElicitRequestFormParamsSchema:()=>sG,ElicitRequestParamsSchema:()=>sY,ElicitRequestSchema:()=>sQ,ElicitRequestURLParamsSchema:()=>sX,ElicitResultSchema:()=>s2,ElicitationCompleteNotificationParamsSchema:()=>s0,ElicitationCompleteNotificationSchema:()=>s1,EmbeddedResourceSchema:()=>si,EmptyResultSchema:()=>nn,EnumSchemaSchema:()=>sB,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:()=>iG,JSONObjectSchema:()=>iZ,JSONRPCErrorResponseSchema:()=>no,JSONRPCMessageSchema:()=>na,JSONRPCNotificationSchema:()=>nt,JSONRPCRequestSchema:()=>ne,JSONRPCResponseSchema:()=>ni,JSONRPCResultResponseSchema:()=>nr,JSONValueSchema:()=>iB,LegacyTitledEnumSchemaSchema:()=>sK,ListChangedOptionsBaseSchema:()=>sS,ListPromptsRequestSchema:()=>n6,ListPromptsResultSchema:()=>n8,ListResourceTemplatesRequestSchema:()=>nL,ListResourceTemplatesResultSchema:()=>nK,ListResourcesRequestSchema:()=>nU,ListResourcesResultSchema:()=>nD,ListRootsRequestSchema:()=>s7,ListRootsResultSchema:()=>le,ListTasksRequestSchema:()=>lp,ListTasksResultSchema:()=>lh,ListToolsRequestSchema:()=>sf,ListToolsResultSchema:()=>sm,LoggingLevelSchema:()=>sw,LoggingMessageNotificationParamsSchema:()=>sP,LoggingMessageNotificationSchema:()=>sk,ModelHintSchema:()=>sR,ModelPreferencesSchema:()=>sx,MultiSelectEnumSchemaSchema:()=>sF,NotificationSchema:()=>i3,NotificationsParamsSchema:()=>i5,NumberSchemaSchema:()=>sU,PaginatedRequestParamsSchema:()=>nC,PaginatedRequestSchema:()=>nA,PaginatedResultSchema:()=>nT,PingRequestSchema:()=>nP,PrimitiveSchemaDefinitionSchema:()=>sZ,ProgressNotificationParamsSchema:()=>nR,ProgressNotificationSchema:()=>nx,ProgressSchema:()=>nk,ProgressTokenSchema:()=>iX,PromptArgumentSchema:()=>n5,PromptListChangedNotificationSchema:()=>su,PromptMessageSchema:()=>sl,PromptReferenceSchema:()=>s4,PromptSchema:()=>n3,ReadResourceRequestParamsSchema:()=>nJ,ReadResourceRequestSchema:()=>nV,ReadResourceResultSchema:()=>nW,RelatedTaskMetadataSchema:()=>i0,RequestIdSchema:()=>i7,RequestMetaSchema:()=>i1,RequestSchema:()=>i4,ResourceContentsSchema:()=>nO,ResourceLinkSchema:()=>sn,ResourceListChangedNotificationSchema:()=>nF,ResourceRequestParamsSchema:()=>nJ,ResourceSchema:()=>nq,ResourceTemplateReferenceSchema:()=>s9,ResourceTemplateSchema:()=>nH,ResourceUpdatedNotificationParamsSchema:()=>n9,ResourceUpdatedNotificationSchema:()=>n4,ResultMetaObjectSchema:()=>i6,ResultSchema:()=>i8,RoleSchema:()=>nM,RootSchema:()=>s8,RootsListChangedNotificationSchema:()=>lt,SamplingContentSchema:()=>sT,SamplingMessageContentBlockSchema:()=>sO,SamplingMessageSchema:()=>sj,ServerCapabilitiesSchema:()=>nb,ServerNotificationSchema:()=>lb,ServerRequestSchema:()=>l_,ServerResultSchema:()=>lS,ServerTasksCapabilitySchema:()=>ny,SetLevelRequestParamsSchema:()=>s$,SetLevelRequestSchema:()=>sE,SingleSelectEnumSchemaSchema:()=>sJ,StringSchemaSchema:()=>sH,SubscribeRequestParamsSchema:()=>nJ,SubscribeRequestSchema:()=>nB,SubscriptionFilterSchema:()=>nG,SubscriptionsAcknowledgedNotificationParamsSchema:()=>nQ,SubscriptionsAcknowledgedNotificationSchema:()=>n0,SubscriptionsListenRequestParamsSchema:()=>nX,SubscriptionsListenRequestSchema:()=>nY,SubscriptionsListenResultMetaSchema:()=>n1,SubscriptionsListenResultSchema:()=>n2,TaskAugmentedRequestParamsSchema:()=>i9,TaskCreationParamsSchema:()=>lr,TaskMetadataSchema:()=>iQ,TaskSchema:()=>la,TaskStatusNotificationParamsSchema:()=>ln,TaskStatusNotificationSchema:()=>ls,TaskStatusSchema:()=>lo,TextContentSchema:()=>st,TextResourceContentsSchema:()=>nj,TitledMultiSelectEnumSchemaSchema:()=>sW,TitledSingleSelectEnumSchemaSchema:()=>sL,ToolAnnotationsSchema:()=>sd,ToolChoiceSchema:()=>sC,ToolExecutionSchema:()=>sp,ToolListChangedNotificationSchema:()=>sb,ToolResultContentSchema:()=>sA,ToolSchema:()=>sh,ToolUseContentSchema:()=>sa,UnsubscribeRequestParamsSchema:()=>nJ,UnsubscribeRequestSchema:()=>nZ,UntitledMultiSelectEnumSchemaSchema:()=>sV,UntitledSingleSelectEnumSchemaSchema:()=>sD});let cz=t=>nr.safeParse(t).success,cq=t=>no.safeParse(t).success,cH=t=>"object"==typeof t&&null!==t&&!Array.isArray(t)&&"input_required"===t.resultType,cU="x-mcp-header",cD=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,cL=new Set(["string","integer","boolean","number"]);function cK(t){let r=[],o=new Map,a=(t,i,n)=>{if(null===t||"object"!=typeof t)return;if(cU in t){if(!n||0===i.length)return`${cW(i)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let a=t[cU];if("string"!=typeof a||0===a.length)return`${cW(i)}: x-mcp-header MUST be a non-empty string`;if(!cD.test(a))return`${cW(i)}: x-mcp-header '${a}' 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||!cL.has(s))return`${cW(i)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${s??"<none>"}`;let l=a.toLowerCase(),c=o.get(l);if(void 0!==c)return`x-mcp-header '${a}' is not case-insensitively unique (also declared as '${c}')`;o.set(l,a),r.push({path:i,headerName:a,type:s})}let s=t.properties;if(null!==s&&"object"==typeof s)for(let[t,r]of Object.entries(s)){let o=a(r,[...i,t],n);if(void 0!==o)return o}for(let r of cJ){let o=t[r];if(void 0!==o)for(let t of Array.isArray(o)?o:null!==o&&"object"==typeof o&&cV.has(r)?Object.values(o):[o]){let o=a(t,[...i,`<${r}>`],!1);if(void 0!==o)return o}}},i=a(t,[],!0);return void 0===i?{valid:!0,declarations:r}:{valid:!1,reason:i}}let cJ=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],cV=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function cW(t){return 0===t.length?"<root>":t.join(".")}let cF="=?base64?";function cB(t){return!function(t){if(0===t.length||t.startsWith(cF)&&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:`${cF}${function(t){let r=new TextEncoder().encode(t),o="";for(let t of r)o+=String.fromCodePoint(t);return btoa(o)}(t)}?=`}cc.InvalidRequest,cc.UnsupportedProtocolVersion,cc.InvalidParams,cc.MethodNotFound,cc.InvalidParams,cc.MissingRequiredClientCapability,cc.ParseError,cc.InvalidRequest,cc.MethodNotFound,cc.UnsupportedProtocolVersion,cc.MissingRequiredClientCapability;let cZ={"tools/call":"name","prompts/get":"name","resources/read":"uri","tasks/get":"taskId","tasks/update":"taskId","tasks/cancel":"taskId"};function cG(t){return new Set(t.flatMap(t=>Object.keys(t.shape)))}function cX(t){if(null==t)return!1;let r=typeof t;return("object"===r||"function"===r)&&"~standard"in t&&"function"==typeof t["~standard"]?.validate}let cY=!1,cQ="draft-2020-12";async function c0(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 c1=/\\\.\\d\{(\d+)\}/;function c2(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}let c9=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function c4(t){return c9.has(t)||t.startsWith("x-")}let c5=new Set(["$schema",...Object.keys(sG.shape.requestedSchema.shape)]),c3={string:cG([sH,sD,sL,sK]),number:cG([sU]),integer:cG([sU]),boolean:cG([sq]),array:cG([sV,sW])},c6=new Set(sH.shape.format.unwrap().options);async function c8(t){let{config:r,method:o,originalParams:a,requestOptions:i,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 lL(lD.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}}})}i.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 lL?r.reason:new lL(lD.RequestTimeout,String(r.reason)));let a=setTimeout(()=>{r?.removeEventListener("abort",i),t()},250),i=()=>{clearTimeout(a),o(r?.reason instanceof lL?r.reason:new lL(lD.RequestTimeout,String(r?.reason)))};r?.addEventListener("abort",i,{once:!0})})}(0,s);let f={...void 0!==i.timeout&&{timeout:i.timeout}};if(void 0!==i.maxTotalTimeout){let t=Date.now()-l,r=i.maxTotalTimeout-t;if(r<=0)throw new lL(lD.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:i.maxTotalTimeout,totalElapsed:t});f.maxTotalTimeout=r}let m=await n.retry(function(t,r,o){let a=void 0!==r&&Object.keys(r).length>0;return a||void 0!==o?{...t,...a&&{inputResponses:r},...void 0!==o&&{requestState:o}}:t}(a,t,c.requestState),f);if(cH(m)){c={inputRequests:m.inputRequests??{},...void 0!==m.requestState&&{requestState:m.requestState}};continue}return m}}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(!cX(t.requestedSchema))return{...t,mode:"form",requestedSchema:t.requestedSchema};let o=t.requestedSchema["~standard"].vendor,a=function(t,r){let o={},a=[];for(let[i,n]of Object.entries(t))"properties"===i&&c2(n)?o[i]=Object.fromEntries(Object.entries(n).map(([t,o])=>[t,function(t,r,o,a){if(!c2(t))return t;let i="string"==typeof t.type&&Object.hasOwn(c3,t.type)?c3[t.type]:void 0;if(void 0===i)return t;let n={};for(let[c,u]of Object.entries(t))if(i.has(c)||c4(c))n[c]=u;else if("pattern"===c&&"string"===t.type&&"string"==typeof t.format)if(c6.has(t.format)){var s,l;"string"==typeof u&&(s=t.format,l=u,"zod"!==o||(function(t,r){var o;let a,i,n;switch(t){case"email":a=[rX(aI,void 0)];break;case"uri":a=[rY(az,void 0)];break;case"date":a=[r0(aT,void 0)];break;case"date-time":o=r,i=c1.exec(o),n=[void 0,-1,0],i&&n.push(Number(i[1])),a=[!1,!0].flatMap(t=>[!1,!0].flatMap(r=>n.map(o=>rQ(aA,{local:t,offset:r,precision:o}))))}return new Set(a.map(t=>{let r;return r=o9(t,{target:cQ,io:"input"}),"string"==typeof r.pattern?r.pattern:void 0}).filter(t=>void 0!==t))})(s,l).has(l))||a.push(`${r}.${c}`)}else n[c]=u;else a.push(`${r}.${c}`);return n}(o,`properties.${t}`,r,a)])):c5.has(i)?o[i]=n:c4(i)||a.push(i);if(a.length>0)throw new cu(cc.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${a.join(", ")}`);return o}(function(t){try{return function(t,r="input"){let o,a=t["~standard"];if(a.jsonSchema)o=a.jsonSchema[r]({target:cQ});else if("zod"===a.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().");cY||(cY=!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:cQ,io:r})}else throw Error(`Schema library "${a.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if("output"===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 a=r[o];if(Array.isArray(a)&&a.length>0)return a.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 cu(cc.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}(t.requestedSchema),o),i=(r=sG.shape.requestedSchema,ah(r,a));if(!i.success)throw new cu(cc.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${function(t,r){if(!c2(t.properties))return r;let o=Object.entries(t.properties).filter(([,t])=>!ah(sZ,t).success).map(([t])=>`properties.${t}`);return o.length>0?o.join(", "):r}(a,i.error.message)}`);let n=function t(r,o,a=""){return Array.isArray(r)&&Array.isArray(o)?r.flatMap((r,i)=>t(r,o[i],`${a}[${i}]`)):c2(r)&&c2(o)?Object.entries(r).flatMap(([r,i])=>{let n=a?`${a}.${r}`:r;return Object.prototype.hasOwnProperty.call(o,r)?t(i,o[r],n):c4(r)?[]:[n]}):[]}(a,i.data);if(n.length>0)throw new cu(cc.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);let s=(i.data.required??[]).filter(t=>!Object.prototype.hasOwnProperty.call(i.data.properties,t));if(s.length>0)throw new cu(cc.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${s.join(", ")}`);return{...t,mode:"form",requestedSchema:i.data}}(t)}}catch(t){throw t instanceof cu?TypeError(t.message,{cause:t}):t}},elicitUrl:t=>({method:"elicitation/create",params:{...t,mode:"url"}}),createMessage:t=>({method:"sampling/createMessage",params:t}),listRoots:()=>({method:"roots/list"})});let c7={},ue={};function ut(t,r){let o=t.slice(0,-6);c7[o]=r,ue[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"])ut(t,cM[t]);for(let[t,r]of Object.entries({IdJagTokenExchangeResponseSchema:lx,OAuthClientInformationFullSchema:lj,OAuthClientInformationSchema:lO,OAuthClientMetadataSchema:lT,OAuthClientRegistrationErrorSchema:lI,OAuthErrorResponseSchema:lC,OAuthMetadataSchema:lE,OAuthProtectedResourceMetadataSchema:l$,OAuthTokenRevocationRequestSchema:lN,OAuthTokensSchema:lR,OpenIdProviderDiscoveryMetadataSchema:lk,OpenIdProviderMetadataSchema:lP}))ut(t,r);Object.freeze(c7);let ur=Object.freeze(ue),uo=[iL,iK,iV,iF],ua=["inputResponses","requestState"];function ui(t,r){let o=t.params;if(!uc(o))return{message:t,lifted:{}};let a=o._meta,i=uc(a)?uo.filter(t=>t in a):[],n="request"===r?ua.filter(t=>t in o):[];if(0===i.length&&0===n.length)return{message:t,lifted:{}};let s={},l={...o};if(i.length>0&&uc(a)){let t={},r={...a};for(let o of i)t[o]=a[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 un(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 a=t.validateResult(r,o);return a.ok?{value:a.value}:{issues:[{message:"invalid"===a.reason?a.message:`not-in-era: ${r}`}]}}}}}let us=(R=void 0,()=>R);var ul=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(t){this._options=t,this._supportedProtocolVersions=t?.supportedProtocolVersions??iD,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 lL(lD.UnsupportedResultType,`Unsupported result type '${t.kind}' for ${r.request.method}`,{resultType:t.kind,method:r.request.method}))}_getRequestHandler(t){return this._requestHandlers.get(t)}async _oncancel(t){void 0!==t.params.requestId&&this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,o,a,i=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(a,r),startTime:Date.now(),timeout:r,maxTotalTimeout:o,resetTimeoutOnProgress:i,onTimeout:a})}_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 lL(lD.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 a=this._transport?.onmessage;this._transport.onmessage=(t,r)=>{if(a?.(t,r),cz(t)||cq(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 lL(lD.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}=ui(t,"notification"),a=this._negotiatedWireCodec();if(r?.classification===void 0&&"drop"===this._shouldDropInbound(t))return;if(r?.classification!==void 0){let t=cT(r.classification);if(t!==a.era)return void this._onerror(Error(`Era mismatch on inbound notification '${o.method}': classified as ${t} but this instance serves ${a.era}`))}if(cj(o.method)&&!a.hasNotificationMethod(o.method))return;let i=this._notificationHandlers.get(o.method),n=this.fallbackNotificationHandler;(void 0!==i||void 0!==n)&&Promise.resolve().then(()=>void 0===i?n(o):i(o,a)).catch(t=>this._onerror(Error(`Uncaught error in notification handler: ${t}`)))}_onrequest(t,r){var o;let{message:a,lifted:i}=ui(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 i={jsonrpc:"2.0",id:a.id,error:{code:t,message:r,...void 0!==o&&{data:o}}};s?.send(i).catch(t=>this._onerror(Error(`Failed to send an error response: ${t}`)))};if(r?.classification!==void 0){let t=cT(r.classification);if(t!==n.era){this._onerror(Error(`Era mismatch on inbound request '${a.method}': classified as ${t} but this instance serves ${n.era}`));let o=r.classification.revision??t;l(cc.UnsupportedProtocolVersion,`Unsupported protocol version: ${o}`,{supported:this._supportedProtocolVersions,requested:o});return}}if(cO(a.method)&&!n.hasRequestMethod(a.method)&&!(cI(a.method)&&this._customSchemaRequestMethods.has(a.method)))return void l(cc.MethodNotFound,"Method not found");let c=this._requestHandlers.get(a.method)??this.fallbackRequestHandler;if(void 0===c)return void l(cc.MethodNotFound,"Method not found");let u=n.checkInboundEnvelope(i);if(void 0!==u)return void l(cc.InvalidParams,u);let d=(t,r)=>this._notificationViaCodec(this._resolveOutboundCodec(t.method),t,{...r,relatedRequestId:a.id}),p=(t,r,o)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(t.method),t,r,{...o,relatedRequestId:a.id}),h=new AbortController;this._requestHandlerAbortControllers.set(a.id,h);let f=void 0===i.inputResponses?void 0:function(t){let r={},o=[];if(!uu(t))return{accepted:r,droppedKeys:o};for(let[a,i]of Object.entries(t)){if(!uu(i)||"method"in i||"result"in i){o.push(a);continue}r[a]=i}return{accepted:r,droppedKeys:o}}(i.inputResponses),m={sessionId:s?.sessionId,mcpReq:{id:a.id,method:a.method,_meta:a.params?._meta,...void 0!==i.envelope&&{envelope:i.envelope},...void 0!==f&&{inputResponses:f.accepted},...void 0!==f&&f.droppedKeys.length>0&&{droppedInputResponseKeys:f.droppedKeys},requestState:void 0===i.requestState?us:(o=i.requestState,()=>o),signal:h.signal,send:(t,r,o)=>{let a=this._resolveOutboundCodec(t.method);if(this._assertOutboundRequestInEra(a,t.method),cX(r))return p(t,r,o);let i=un(a,t.method);if(void 0===i)throw TypeError(`'${t.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return p(t,i,r)},notify:d},http:r?.authInfo?{authInfo:r.authInfo}:void 0},y=this.buildContext(m,r);Promise.resolve().then(()=>c(a,y)).then(async t=>{let r;if(h.signal.aborted)return;try{r=n.encodeResult(a.method,t,this._outboundServerInfo())}catch(t){this._onerror(Error(`Failed to encode result for ${a.method}: ${t}`)),l(cc.InternalError,"Internal error");return}let o={result:r,jsonrpc:"2.0",id:a.id};await s?.send(o)},async t=>{if(h.signal.aborted)return;let r=Number.isSafeInteger(t.code)?t.code:cc.InternalError,o={jsonrpc:"2.0",id:a.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(a.id)===h&&this._requestHandlerAbortControllers.delete(a.id)})}_onprogress(t){let{progressToken:r,...o}=t.params,a=Number(r),i=this._progressHandlers.get(a);if(!i)return void this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));let n=this._responseHandlers.get(a),s=this._timeoutInfo.get(a);if(s&&n&&s.resetTimeoutOnProgress)try{this._resetTimeout(a)}catch(t){this._responseHandlers.delete(a),this._progressHandlers.delete(a),this._cleanupTimeout(a),n(t);return}i(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(cz(t)?t:cu.fromError(t.error.code,t.error.message,t.error.data)))}get transport(){return this._transport}async close(){await this._transport?.close()}request(t,r,o){let a=this._resolveOutboundCodec(t.method);if(cX(r))return cI(t.method)||this._assertOutboundRequestInEra(a,t.method),this._requestWithSchemaViaCodec(a,t,r,o);this._assertOutboundRequestInEra(a,t.method);let i=un(a,t.method);if(void 0===i)throw TypeError(`'${t.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(a,t,i,r)}_negotiatedWireCodec(){return cA(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(t){if(void 0===this._negotiatedProtocolVersion){let r=function(t){switch(t){case"initialize":case"notifications/initialized":return cA(void 0);case"server/discover":return cA(cC);default:return}}(t);if(r)return r}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(t,r){if(cO(r)&&!t.hasRequestMethod(r))throw new lL(lD.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 a=this._resolveOutboundCodec(t.method);return this._assertOutboundRequestInEra(a,t.method),this._requestWithSchemaViaCodec(a,t,r,o)}_requestWithSchemaViaCodec(t,r,o,a){let i,n,{relatedRequestId:s,resumptionToken:l,onresumptiontoken:c,headers:u}=a??{},d=Date.now();return new Promise((p,h)=>{let f=t=>{h(t)};if(!this._transport)return void f(Error("Not connected"));if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(r.method)}catch(t){f(t);return}if(a?.signal?.aborted){let t=a.signal.reason;throw t instanceof lL?t:new lL(lD.RequestTimeout,String(t))}let m=t.era===cC&&!0===this._transport.hasPerRequestStream?new AbortController:void 0,y=this._requestMessageId++;n=y;let g={...r,jsonrpc:"2.0",id:y};a?.onprogress&&(this._progressHandlers.set(y,a.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===m?"initialize"!==r.method&&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}`))):m.abort(),h(t instanceof lL?t:new lL(lD.RequestTimeout,String(t))))};this._responseHandlers.set(y,i=>{let n;if(!a?.signal?.aborted){if(_=!0,i instanceof Error)return h(i);try{n=t.decodeResult(r.method,i.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 a?.allowInputRequired===!0?p({resultType:"input_required",inputRequests:(s=n).inputRequests,...void 0!==s.requestState&&{requestState:s.requestState},...void 0!==s._meta&&{_meta:s._meta}}):p(this._resolveNonCompleteResult(n,{codec:t,request:r,resultSchema:o,options:a,flowStartedAt:d,retry:(a,i)=>this._requestWithSchemaViaCodec(t,void 0===a?{method:r.method}:{method:r.method,params:a},o,i)}))}c0(o,n.result).then(t=>{t.success?p(t.data):h(new lL(lD.InvalidResult,`Invalid result for ${r.method}: ${t.error}`))},h)}}),i=()=>b(a?.signal?.reason),a?.signal?.addEventListener("abort",i,{once:!0});let S=a?.timeout??6e4;this._setupTimeout(y,S,a?.maxTotalTimeout,()=>b(new lL(lD.RequestTimeout,"Request timed out",{timeout:S})),a?.resetTimeoutOnProgress??!1),this._transport.send(v,{relatedRequestId:s,resumptionToken:l,onresumptiontoken:c,headers:u,requestSignal:m?.signal}).catch(t=>{this._progressHandlers.delete(y),h(t)})}).finally(()=>{i&&a?.signal?.removeEventListener("abort",i),void 0!==n&&(this._responseHandlers.delete(n),this._cleanupTimeout(n))})}async notification(t,r){return await this._notificationViaCodec(this._resolveOutboundCodec(t.method),t,r)}async _notificationViaCodec(t,r,o){if(!this._transport)throw new lL(lD.NotConnected,"Not connected");if(cj(r.method)&&!t.hasNotificationMethod(r.method))throw new lL(lD.MethodNotSupportedByProtocolVersion,`Notification '${r.method}' is not supported by the negotiated protocol version (wire era ${t.era})`,{method:r.method,era:t.era});this.assertNotificationCapability(r.method);let a=this._envelopeOutbound({jsonrpc:"2.0",...r});if((this._options?.debouncedNotificationMethods??[]).includes(r.method)&&!r.params&&o?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(r.method))return;this._pendingDebouncedNotifications.add(r.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(r.method),this._transport&&this._transport?.send(a,o).catch(t=>this._onerror(t))});return}await this._transport.send(a,o)}setRequestHandler(t,r,o){let a;if(this.assertRequestHandlerCapability(t),"function"==typeof r){if(!cO(t))throw TypeError(`'${t}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);a=(o,a)=>{let i=this._negotiatedWireCodec(),n=i.validateRequest(t,o);if(n.ok||"not-in-era"!==n.reason||(n=i.validateInputRequest(t,o)),!n.ok){if("not-in-era"===n.reason)throw new cu(cc.InternalError,`No wire schema for ${t} in the resolved era`);throw Error(n.message)}return Promise.resolve(r(n.value,a))}}else if(o)a=async(a,i)=>{let n=await c0(r.params,{...a.params});if(!n.success)throw new cu(cc.InvalidParams,`Invalid params for ${t}: ${n.error}`);return o(n.data,i)};else throw TypeError("setRequestHandler: handler is required");"function"==typeof r?this._customSchemaRequestMethods.delete(t):this._customSchemaRequestMethods.add(t),this._requestHandlers.set(t,this._wrapHandler(t,a))}_wrapHandler(t,r){return r}_outboundServerInfo(){}removeRequestHandler(t){this._requestHandlers.delete(t),this._customSchemaRequestMethods.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r,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,a)=>{let i=a.validateNotification(t,o);if(!i.ok){if("not-in-era"===i.reason)throw new cu(cc.InternalError,`No wire schema for ${t} in the resolved era`);throw Error(i.message)}return Promise.resolve(r(i.value))});return}if(!o)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(t,async a=>{let i=await c0(r.params,{...a.params});if(!i.success)throw new cu(cc.InvalidParams,`Invalid params for notification ${t}: ${i.error}`);await o(i.data,a)})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}};function uc(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function uu(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function ud(t){throw new lL(lD.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 up(t,r,o,a,i){var n,s,l,c,u;if(!uu(a)||"string"!=typeof a.method)throw new lL(lD.InvalidResult,`Invalid input request '${o}': each inputRequests entry must be an embedded request object with a method`,{key:o});let d=a.method;if(!r.hasInputRequestMethod(d))throw new lL(lD.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 lL(lD.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=uu(a.params)?a.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=i,{sessionId:t.sessionId,mcpReq:{id:n,method:s,_meta:l?._meta,requestState:(u=void 0,()=>u),signal:c,send:()=>ud("send"),notify:()=>ud("notify")}})))}var uh=q(z(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,a=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function i(t){this.parameters=Object.create(null),this.type=t}t.parse=function(t){if(!t)throw TypeError("argument string is required");var 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(!a.test(d))throw TypeError("invalid media type");var p=new i(d.toLowerCase());if(-1!==u){for(r.lastIndex=u;s=r.exec(c);){if(s.index!==u)throw TypeError("invalid parameter format");u+=s[0].length,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),uf=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,na.parse(JSON.parse(t))}catch(t){if(t instanceof SyntaxError)continue;throw t}}return null}clear(){this._buffer=void 0}};function um(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):{...t}:{}}let uy=new Set([301,302,303,307,308]);function ug(t,r){let o=uy.has(r.status)?r.headers?.get("location"):void 0;if(o)try{return new URL(o,t)}catch{return}}let uv=new WeakSet;function u_(t){return uv.has(t)?t:async(r,o)=>{if(o?.redirect==="error"||o?.redirect==="manual")return t(r,o);let a=(o?.method??"GET").toUpperCase(),i=r;for(let r=0;;r++){var n,s;let l=await t(i,{...o,redirect:"manual"}),c=ug(i,l);if(!c||5===r)return l;let u=new URL(i),d="GET"===a||307===l.status||308===l.status,p=!(c.username||c.password)||c.username===u.username&&c.password===u.password;if(!d||!p||(n=u,s=c,(n.protocol!==s.protocol||n.host!==s.host)&&("http:"!==n.protocol||"https:"!==s.protocol||n.hostname!==s.hostname||n.port||s.port)))return l;await l.text?.().catch(()=>{}),i=c}}}var ub=z(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 a=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 i(t,...r){let o=[t[0]],n=0;for(;n<r.length;)l(o,r[n]),o.push(t[++n]);return new a(o)}t._Code=a,t.nil=new a(""),t._=i;let n=new a("+");function s(t,...r){let i=[c(t[0])],u=0;for(;u<r.length;)i.push(n),l(i,r[u]),i.push(n,c(t[++u]));return function(t){let r=1;for(;r<t.length-1;){if(t[r]===n){var a,i;let n=(a=t[r-1],'""'===(i=t[r+1])?a:'""'===a?i:"string"==typeof a?i instanceof o||'"'!==a[a.length-1]?void 0:"string"!=typeof i?`${a.slice(0,-1)}${i}"`:'"'===i[0]?a.slice(0,-1)+i.slice(1):void 0:"string"!=typeof i||'"'!==i[0]||a instanceof o?void 0:`"${a}${i.slice(1)}`);if(void 0!==n){t.splice(r-1,3,n);continue}t[r++]="+"}r++}}(i),new a(i)}function l(t,r){var i;r instanceof a?t.push(...r._items):r instanceof o?t.push(r):t.push("number"==typeof(i=r)||"boolean"==typeof i||null===i?i:c(Array.isArray(i)?i.join(","):i))}function c(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.str=s,t.addCodeArg=l,t.strConcat=function(t,r){return r.emptyStr()?t:t.emptyStr()?r:s`${t}${r}`},t.stringify=function(t){return new a(c(t))},t.safeStringify=c,t.getProperty=function(r){return"string"==typeof r&&t.IDENTIFIER.test(r)?new a(`.${r}`):i`[${r}]`},t.getEsmExportName=function(r){if("string"==typeof r&&t.IDENTIFIER.test(r))return new a(`${r}`);throw Error(`CodeGen: invalid export name: ${r}, use explicit $id name mapping`)},t.regexpCode=function(t){return new a(t.toString())}}),uS=z(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;let r=ub();var o,a,i=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}};(o=a||(t.UsedValueState=a={}))[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:a}){this.value=t,this.scopePath=(0,r._)`.${new r.Name(o)}[${a}]`}};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 a=this.toName(t),{prefix:i}=a,n=null!=(o=r.key)?o:r.ref,s=this._values[i];if(s){let t=s.get(n);if(t)return t}else s=this._values[i]=new Map;s.set(n,a);let l=this._scope[i]||(this._scope[i]=[]),c=l.length;return l[c]=r.ref,a.setValue(r,{property:i,itemIndex:c}),a}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,a.Started);let s=n(o);if(s){let a=this.opts.es5?t.varKinds.var:t.varKinds.const;c=(0,r._)`${c}${a} ${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 i(o);p.set(o,a.Completed)})}return c}};t.ValueScope=c}),uw=z(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=ub(),o=uS();var a=ub();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return a._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return a.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return a.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return a.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return a.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return a.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return a.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return a.Name}});var i=uS();Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return i.varKinds}}),t.operators={GT:new r._Code(">"),GTE:new r._Code(">="),LT:new r._Code("<"),LTE:new r._Code("<="),EQ:new r._Code("==="),NEQ:new r._Code("!=="),NOT:new r._Code("!"),OR:new r._Code("||"),AND:new r._Code("&&"),ADD:new r._Code("+")};var 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 a=t?o.varKinds.var:this.varKind,i=void 0===this.rhs?"":` = ${this.rhs}`;return`${a} ${this.name}${i};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=T(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=T(this.rhs,t,o),this}get names(){return A(this.lhs instanceof r.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends l{constructor(t,r,o,a){super(t,o,a),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=T(this.code,t,r),this}get names(){return this.code instanceof r._CodeOrName?this.code.names:{}}},f=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,a=o.length;for(;a--;){let i=o[a];i.optimizeNames(t,r)||(function(t,r){for(let o in r)t[o]=(t[o]||0)-(r[o]||0)}(t,i.names),o.splice(a,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>C(t,r.names),{})}},m=class extends f{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},y=class extends f{},g=class extends m{};g.kind="else";var v=class t extends m{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(O(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=T(this.condition,t,r),this}get names(){let t=super.names;return A(t,this.condition),this.else&&C(t,this.else.names),t}};v.kind="if";var _=class extends m{};_.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=T(this.iteration,t,r),this}get names(){return C(super.names,this.iteration.names)}},S=class extends _{constructor(t,r,o,a){super(),this.varKind=t,this.name=r,this.from=o,this.to=a}render(t){let r=t.es5?o.varKinds.var:this.varKind,{name:a,from:i,to:n}=this;return`for(${r} ${a}=${i}; ${a}<${n}; ${a}++)`+super.render(t)}get names(){return A(A(super.names,this.from),this.to)}},w=class extends _{constructor(t,r,o,a){super(),this.loop=t,this.varKind=r,this.name=o,this.iterable=a}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=T(this.iterable,t,r),this}get names(){return C(super.names,this.iterable.names)}},$=class extends m{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 E=class extends f{render(t){return"return "+super.render(t)}};E.kind="return";var P=class extends m{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,a;return super.optimizeNames(t,r),null==(o=this.catch)||o.optimizeNames(t,r),null==(a=this.finally)||a.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&C(t,this.catch.names),this.finally&&C(t,this.finally.names),t}},k=class extends m{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};k.kind="catch";var R=class extends m{render(t){return"finally"+super.render(t)}};R.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,a){let i=this._scope.toName(r);return void 0!==o&&a&&(this._constants[i.str]=o),this._leafNode(new s(t,i,o)),i}const(t,r,a){return this._def(o.varKinds.const,t,r,a)}let(t,r,a){return this._def(o.varKinds.let,t,r,a)}var(t,r,a){return this._def(o.varKinds.var,t,r,a)}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[a,i]of t)o.length>1&&o.push(","),o.push(a),(a!==i||this.opts.es5)&&(o.push(":"),(0,r.addCodeArg)(o,i));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,a,i,n=this.opts.es5?o.varKinds.var:o.varKinds.let){let s=this._scope.toName(t);return this._for(new S(n,s,r,a),()=>i(s))}forOf(t,a,i,n=o.varKinds.const){let s=this._scope.toName(t);if(this.opts.es5){let t=a instanceof r.Name?a:this.var("_arr",a);return this.forRange("_i",0,(0,r._)`${t}.length`,o=>{this.var(s,(0,r._)`${t}[${o}]`),i(s)})}return this._for(new w("of",n,s,a),()=>i(s))}forIn(t,a,i,n=this.opts.es5?o.varKinds.var:o.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,r._)`Object.keys(${a})`,i);let s=this._scope.toName(t);return this._for(new w("in",n,s,a),()=>i(s))}endFor(){return this._endBlockNode(_)}label(t){return this._leafNode(new u(t))}break(t){return this._leafNode(new d(t))}return(t){let r=new E;if(this._blockNode(r),this.code(t),1!==r.nodes.length)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(E)}try(t,r,o){if(!r&&!o)throw Error('CodeGen: "try" without "catch" and "finally"');let a=new P;if(this._blockNode(a),this.code(t),r){let t=this.name("e");this._currNode=a.catch=new k(t),r(t)}return o&&(this._currNode=a.finally=new R,this.code(o)),this._endBlockNode(k,R)}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,a,i){return this._blockNode(new $(t,o,a)),i&&this.code(i).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 C(t,r){for(let o in r)t[o]=(t[o]||0)+(r[o]||0);return t}function A(t,o){return o instanceof r._CodeOrName?C(t,o.names):t}function T(t,o,a){var i;if(t instanceof r.Name)return n(t);if(!((i=t)instanceof r._Code&&i._items.some(t=>t instanceof r.Name&&1===o[t.str]&&void 0!==a[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=a[t.str];return void 0===r||1!==o[t.str]?t:(delete o[t.str],r)}}function O(t){return"boolean"==typeof t||"number"==typeof t||null===t?!t:(0,r._)`!${M(t)}`}t.CodeGen=x,t.not=O;let j=N(t.operators.AND);t.and=function(...t){return t.reduce(j)};let I=N(t.operators.OR);function N(t){return(o,a)=>o===r.nil?a:a===r.nil?o:(0,r._)`${M(o)} ${t} ${M(a)}`}function M(t){return t instanceof r.Name?t:(0,r._)`(${t})`}t.or=function(...t){return t.reduce(I)}}),u$=z(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 a=uw(),i=ub();function n(t,r=t.schema){let{opts:o,self:a}=t;if(!o.strictSchema||"boolean"==typeof r)return;let i=a.RULES.keywords;for(let o in r)i[o]||f(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:i}){return(n,s,l,c)=>{let u=void 0===l?s:l instanceof a.Name?(s instanceof a.Name?t(n,s,l):r(n,s,l),l):s instanceof a.Name?(r(n,l,s),s):o(s,l);return c!==a.Name||u instanceof a.Name?u:i(n,u)}}function d(t,r){if(!0===r)return t.var("props",!0);let o=t.var("props",(0,a._)`{}`);return void 0!==r&&p(t,o,r),o}function p(t,r,o){Object.keys(o).forEach(o=>t.assign((0,a._)`${r}${(0,a.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,i,n){if(!n){if("number"==typeof o||"boolean"==typeof o)return o;if("string"==typeof o)return(0,a._)`${o}`}return(0,a._)`${t}${r}${(0,a.getProperty)(i)}`},t.unescapeFragment=function(t){return c(decodeURIComponent(t))},t.escapeFragment=function(t){return encodeURIComponent(l(t))},t.escapeJsonPointer=l,t.unescapeJsonPointer=c,t.eachItem=function(t,r){if(Array.isArray(t))for(let o of t)r(o);else r(t)},t.mergeEvaluated={props:u({mergeNames:(t,r,o)=>t.if((0,a._)`${o} !== true && ${r} !== undefined`,()=>{t.if((0,a._)`${r} === true`,()=>t.assign(o,!0),()=>t.assign(o,(0,a._)`${o} || {}`).code((0,a._)`Object.assign(${o}, ${r})`))}),mergeToName:(t,r,o)=>t.if((0,a._)`${o} !== true`,()=>{!0===r?t.assign(o,!0):(t.assign(o,(0,a._)`${o} || {}`),p(t,o,r))}),mergeValues:(t,r)=>!0===t||{...t,...r},resultToName:d}),items:u({mergeNames:(t,r,o)=>t.if((0,a._)`${o} !== true && ${r} !== undefined`,()=>t.assign(o,(0,a._)`${r} === true ? true : ${o} > ${r} ? ${o} : ${r}`)),mergeToName:(t,r,o)=>t.if((0,a._)`${o} !== true`,()=>t.assign(o,!0===r||(0,a._)`${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 f(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 i._Code(r.code))})},(o=r||(t.Type=r={}))[o.Num=0]="Num",o[o.Str=1]="Str",t.getErrorPath=function(t,o,i){if(t instanceof a.Name){let n=o===r.Num;return i?n?(0,a._)`"[" + ${t} + "]"`:(0,a._)`"['" + ${t} + "']"`:n?(0,a._)`"/" + ${t}`:(0,a._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return i?(0,a.getProperty)(t).toString():"/"+l(t)},t.checkStrictMode=f}),uE=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uw();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")}}),uP=z(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;let r=uw(),o=u$(),a=uE();function i(t,o){let i=t.const("err",o);t.if((0,r._)`${a.default.vErrors} === null`,()=>t.assign(a.default.vErrors,(0,r._)`[${i}]`),(0,r._)`${a.default.vErrors}.push(${i})`),t.code((0,r._)`${a.default.errors}++`)}function n(t,o){let{gen:a,validateName:i,schemaEnv:n}=t;n.$async?a.throw((0,r._)`new ${t.ValidationError}(${o})`):(a.assign((0,r._)`${i}.errors`,o),a.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,a=t.keywordError,s,c){let{it:u}=o,{gen:d,compositeRule:p,allErrors:h}=u,f=l(o,a,s);(null!=c?c:p||h)?i(d,f):n(u,(0,r._)`[${f}]`)},t.reportExtraError=function(r,o=t.keywordError,s){let{it:c}=r,{gen:u,compositeRule:d,allErrors:p}=c;i(u,l(r,o,s)),d||p||n(c,a.default.vErrors)},t.resetErrorsCount=function(t,o){t.assign(a.default.errors,o),t.if((0,r._)`${a.default.vErrors} !== null`,()=>t.if(o,()=>t.assign((0,r._)`${a.default.vErrors}.length`,o),()=>t.assign(a.default.vErrors,null)))},t.extendErrors=function({gen:t,keyword:o,schemaValue:i,data:n,errsCount:s,it:l}){if(void 0===s)throw Error("ajv implementation error");let c=t.name("err");t.forRange("i",s,a.default.errors,s=>{t.const(c,(0,r._)`${a.default.vErrors}[${s}]`),t.if((0,r._)`${c}.instancePath === undefined`,()=>t.assign((0,r._)`${c}.instancePath`,(0,r.strConcat)(a.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`,i),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,i,n){let{createErrors:l}=t.it;return!1===l?(0,r._)`{}`:function(t,i,n={}){let{gen:l,it:c}=t,u=[function({errorPath:t},{instancePath:i}){let n=i?(0,r.str)`${t}${(0,o.getErrorPath)(i,o.Type.Str)}`:t;return[a.default.instancePath,(0,r.strConcat)(a.default.instancePath,n)]}(c,n),function({keyword:t,it:{errSchemaPath:a}},{schemaPath:i,parentSchema:n}){let l=n?a:(0,r.str)`${a}/${t}`;return i&&(l=(0,r.str)`${l}${(0,o.getErrorPath)(i,o.Type.Str)}`),[s.schemaPath,l]}(t,n)];return function(t,{params:o,message:i},n){let{keyword:l,data:c,schemaValue:u,it:d}=t,{opts:p,propertyName:h,topSchemaRef:f,schemaPath:m}=d;n.push([s.keyword,l],[s.params,"function"==typeof o?o(t):o||(0,r._)`{}`]),p.messages&&n.push([s.message,"function"==typeof i?i(t):i]),p.verbose&&n.push([s.schema,u],[s.parentSchema,(0,r._)`${f}${m}`],[a.default.data,c]),h&&n.push([s.propertyName,h])}(t,i,u),l.object(...u)}(t,i,n)}}),uk=z(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;let r=uP(),o=uw(),a=uE(),i={message:"boolean schema is false"};function n(t,o){let{gen:a,data:n}=t;(0,r.reportError)({gen:a,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t},i,void 0,o)}t.topBoolOrEmptySchema=function(t){let{gen:r,schema:i,validateName:s}=t;!1===i?n(t,!1):"object"==typeof i&&!0===i.$async?r.return(a.default.data):(r.assign((0,o._)`${s}.errors`,null),r.return(!0))},t.boolOrEmptySchema=function(t,r){let{gen:o,schema:a}=t;!1===a?(o.var(r,!1),n(t)):o.var(r,!0)}}),uR=z(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRules=t.isJSONType=void 0;let r=new Set(["string","number","integer","boolean","null","object","array"]);t.isJSONType=function(t){return"string"==typeof t&&r.has(t)},t.getRules=function(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}}),ux=z(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},a){let i=o.RULES.types[a];return i&&!0!==i&&r(t,i)},t.shouldUseGroup=r,t.shouldUseRule=o}),uC=z(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 a=uR(),i=ux(),n=uP(),s=uw(),l=u$();function c(t){let r=Array.isArray(t)?t:t?[t]:[];if(r.every(a.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 a,n;let{gen:l,data:c,opts:d}=t,h=(a=o,(n=d.coerceTypes)?a.filter(t=>u.has(t)||"array"===n&&"array"===t):[]),m=o.length>0&&!(0===h.length&&1===o.length&&(0,i.schemaHasRulesForType)(t,o[0]));if(m){let a=p(o,c,d.strictNumbers,r.Wrong);l.if(a,()=>{h.length?function(t,r,o){let{gen:a,data:i,opts:n}=t,l=a.let("dataType",(0,s._)`typeof ${i}`),c=a.let("coerced",(0,s._)`undefined`);for(let t of("array"===n.coerceTypes&&a.if((0,s._)`${l} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>a.assign(i,(0,s._)`${i}[0]`).assign(l,(0,s._)`typeof ${i}`).if(p(r,i,n.strictNumbers),()=>a.assign(c,i))),a.if((0,s._)`${c} !== undefined`),o))(u.has(t)||"array"===t&&"array"===n.coerceTypes)&&function(t){switch(t){case"string":a.elseIf((0,s._)`${l} == "number" || ${l} == "boolean"`).assign(c,(0,s._)`"" + ${i}`).elseIf((0,s._)`${i} === null`).assign(c,(0,s._)`""`);return;case"number":a.elseIf((0,s._)`${l} == "boolean" || ${i} === null
58
+ || (${l} == "string" && ${i} && ${i} == +${i})`).assign(c,(0,s._)`+${i}`);return;case"integer":a.elseIf((0,s._)`${l} === "boolean" || ${i} === null
59
+ || (${l} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(c,(0,s._)`+${i}`);return;case"boolean":a.elseIf((0,s._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(c,!1).elseIf((0,s._)`${i} === "true" || ${i} === 1`).assign(c,!0);return;case"null":a.elseIf((0,s._)`${i} === "" || ${i} === 0 || ${i} === false`),a.assign(c,null);return;case"array":a.elseIf((0,s._)`${l} === "string" || ${l} === "number"
60
+ || ${l} === "boolean" || ${i} === null`).assign(c,(0,s._)`[${i}]`)}}(t);a.else(),f(t),a.endIf(),a.if((0,s._)`${c} !== undefined`,()=>{a.assign(i,c),function({gen:t,parentData:r,parentDataProperty:o},a){t.if((0,s._)`${r} !== undefined`,()=>t.assign((0,s._)`${r}[${o}]`,a))}(t,c)})}(t,o,h):f(t)})}return m};let u=new Set(["string","number","integer","boolean","null"]);function d(t,o,a,i=r.Correct){let n,l=i===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 i===r.Correct?n:(0,s.not)(n);function c(t=s.nil){return(0,s.and)((0,s._)`typeof ${o} == "number"`,t,a?(0,s._)`isFinite(${o})`:s.nil)}}function p(t,r,o,a){let i;if(1===t.length)return d(t[0],r,o,a);let n=(0,l.toHash)(t);if(n.array&&n.object){let t=(0,s._)`typeof ${r} != "object"`;i=n.null?t:(0,s._)`!${r} || ${t}`,delete n.null,delete n.array,delete n.object}else i=s.nil;for(let t in n.number&&delete n.integer,n)i=(0,s.and)(i,d(t,r,o,a));return i}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 f(t){let r=function(t){let{gen:r,data:o,schema:a}=t,i=(0,l.schemaRefOrVal)(t,a,"type");return{gen:r,keyword:"type",data:o,schema:a.type,schemaCode:i,schemaValue:i,parentSchema:a,params:{},it:t}}(t);(0,n.reportError)(r,h)}t.reportTypeError=f}),uA=z(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;let r=uw(),o=u$();function a(t,a,i){let{gen:n,compositeRule:s,data:l,opts:c}=t;if(void 0===i)return;let u=(0,r._)`${l}${(0,r.getProperty)(a)}`;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)(i)}`)}t.assignDefaults=function(t,r){let{properties:o,items:i}=t.schema;if("object"===r&&o)for(let r in o)a(t,r,o[r].default);else"array"===r&&Array.isArray(i)&&i.forEach((r,o)=>a(t,o,r.default))}}),uT=z(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=uw(),o=u$(),a=uE(),i=u$();function n(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,r._)`Object.prototype.hasOwnProperty`})}function s(t,o,a){return(0,r._)`${n(t)}.call(${o}, ${a})`}function l(t,o,a,i){let n=(0,r._)`${o}${(0,r.getProperty)(a)} === undefined`;return i?(0,r.or)(n,(0,r.not)(s(t,o,a))):n}function c(t){return t?Object.keys(t).filter(t=>"__proto__"!==t):[]}t.checkReportMissingProp=function(t,o){let{gen:a,data:i,it:n}=t;a.if(l(a,i,o,n.opts.ownProperties),()=>{t.setParams({missingProperty:(0,r._)`${o}`},!0),t.error()})},t.checkMissingProp=function({gen:t,data:o,it:{opts:a}},i,n){return(0,r.or)(...i.map(i=>(0,r.and)(l(t,o,i,a.ownProperties),(0,r._)`${n} = ${i}`)))},t.reportMissingProp=function(t,r){t.setParams({missingProperty:r},!0),t.error()},t.hasPropFunc=n,t.isOwnProperty=s,t.propertyInData=function(t,o,a,i){let n=(0,r._)`${o}${(0,r.getProperty)(a)} !== undefined`;return i?(0,r._)`${n} && ${s(t,o,a)}`:n},t.noPropertyInData=l,t.allSchemaProperties=c,t.schemaProperties=function(t,r){return c(r).filter(a=>!(0,o.alwaysValidSchema)(t,r[a]))},t.callValidateCode=function({schemaCode:t,data:o,it:{gen:i,topSchemaRef:n,schemaPath:s,errorPath:l},it:c},u,d,p){let h=p?(0,r._)`${t}, ${o}, ${n}${s}`:o,f=[[a.default.instancePath,(0,r.strConcat)(a.default.instancePath,l)],[a.default.parentData,c.parentData],[a.default.parentDataProperty,c.parentDataProperty],[a.default.rootData,a.default.rootData]];c.opts.dynamicRef&&f.push([a.default.dynamicAnchors,a.default.dynamicAnchors]);let m=(0,r._)`${h}, ${i.object(...f)}`;return d!==r.nil?(0,r._)`${u}.call(${d}, ${m})`:(0,r._)`${u}(${m})`};let u=(0,r._)`new RegExp`;t.usePattern=function({gen:t,it:{opts:o}},a){let n=o.unicodeRegExp?"u":"",{regExp:s}=o.code,l=s(a,n);return t.scopeValue("pattern",{key:l.toString(),ref:l,code:(0,r._)`${"new RegExp"===s.code?u:(0,i.useFunc)(t,s)}(${a}, ${n})`})},t.validateArray=function(t){let{gen:a,data:i,keyword:n,it:s}=t,l=a.name("valid");if(s.allErrors){let t=a.let("valid",!0);return c(()=>a.assign(t,!1)),t}return a.var(l,!0),c(()=>a.break()),l;function c(s){let c=a.const("len",(0,r._)`${i}.length`);a.forRange("i",0,c,i=>{t.subschema({keyword:n,dataProp:i,dataPropType:o.Type.Num},l),a.if((0,r.not)(l),s)})}},t.validateUnion=function(t){let{gen:a,schema:i,keyword:n,it:s}=t;if(!Array.isArray(i))throw Error("ajv implementation error");if(i.some(t=>(0,o.alwaysValidSchema)(s,t))&&!s.opts.unevaluated)return;let l=a.let("valid",!1),c=a.name("_valid");a.block(()=>i.forEach((o,i)=>{let s=t.subschema({keyword:n,schemaProp:i,compositeRule:!0},c);a.assign(l,(0,r._)`${l} || ${c}`),t.mergeValidEvaluated(s,c)||a.if((0,r.not)(l))})),t.result(l,()=>t.reset(),()=>t.error(!0))}}),uO=z(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;let r=uw(),o=uE(),a=uT(),i=uP();function n(t){let{gen:o,data:a,it:i}=t;o.if(i.parentData,()=>o.assign(a,(0,r._)`${i.parentData}[${i.parentDataProperty}]`))}function s(t,o,a){if(void 0===a)throw Error(`keyword "${o}" failed to compile`);return t.scopeValue("keyword","function"==typeof a?{ref:a}:{ref:a,code:(0,r.stringify)(a)})}t.macroKeywordCode=function(t,o){let{gen:a,keyword:i,schema:n,parentSchema:l,it:c}=t,u=o.macro.call(c.self,n,l,c),d=s(a,i,u);!1!==c.opts.validateSchema&&c.self.validateSchema(u,!0);let p=a.name("valid");t.subschema({schema:u,schemaPath:r.nil,errSchemaPath:`${c.errSchemaPath}/${i}`,topSchemaRef:d,compositeRule:!0},p),t.pass(p,()=>t.error(!0))},t.funcKeywordCode=function(t,l){var c;let{gen:u,keyword:d,schema:p,parentSchema:h,$data:f,it:m}=t;!function({schemaEnv:t},r){if(r.async&&!t.$async)throw Error("async keyword in sync schema")}(m,l);let y=s(u,d,!f&&l.compile?l.compile.call(m.self,p,h,m):l.validate),g=u.let("valid");function v(i=l.async?(0,r._)`await `:r.nil){let n=m.opts.passContext?o.default.this:o.default.self,s=!("compile"in l&&!f||!1===l.schema);u.assign(g,(0,r._)`${i}${(0,a.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 a,s,c=l.async?(a=u.let("ruleErrs",null),u.try(()=>v((0,r._)`await `),t=>u.assign(g,!1).if((0,r._)`${t} instanceof ${m.ValidationError}`,()=>u.assign(a,(0,r._)`${t}.errors`),()=>u.throw(t))),a):(s=(0,r._)`${y}.errors`,u.assign(s,null),v(r.nil),s);l.modifying&&n(t),_(()=>(function(t,a){let{gen:n}=t;n.if((0,r._)`Array.isArray(${a})`,()=>{n.assign(o.default.vErrors,(0,r._)`${o.default.vErrors} === null ? ${a} : ${o.default.vErrors}.concat(${a})`).assign(o.default.errors,(0,r._)`${o.default.vErrors}.length`),(0,i.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:a},i,n){if(Array.isArray(i.keyword)?!i.keyword.includes(n):i.keyword!==n)throw Error("ajv implementation error");let s=i.dependencies;if(null==s?void 0:s.some(r=>!Object.prototype.hasOwnProperty.call(t,r)))throw Error(`parent schema must have dependencies of ${n}: ${s.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[n])){let t=`keyword "${n}" value is invalid at path "${a}": `+o.errorsText(i.validateSchema.errors);if("log"===r.validateSchema)o.logger.error(t);else throw Error(t)}}}),uj=z(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;let r=uw(),o=u$();t.getSubschema=function(t,{keyword:a,schemaProp:i,schema:n,schemaPath:s,errSchemaPath:l,topSchemaRef:c}){if(void 0!==a&&void 0!==n)throw Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==a){let n=t.schema[a];return void 0===i?{schema:n,schemaPath:(0,r._)`${t.schemaPath}${(0,r.getProperty)(a)}`,errSchemaPath:`${t.errSchemaPath}/${a}`}:{schema:n[i],schemaPath:(0,r._)`${t.schemaPath}${(0,r.getProperty)(a)}${(0,r.getProperty)(i)}`,errSchemaPath:`${t.errSchemaPath}/${a}/${(0,o.escapeFragment)(i)}`}}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,a,{dataProp:i,dataPropType:n,data:s,dataTypes:l,propertyName:c}){if(void 0!==s&&void 0!==i)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:u}=a;if(void 0!==i){let{errorPath:s,dataPathArr:l,opts:c}=a;d(u.let("data",(0,r._)`${a.data}${(0,r.getProperty)(i)}`,!0)),t.errorPath=(0,r.str)`${s}${(0,o.getErrorPath)(i,n,c.jsPropertySyntax)}`,t.parentDataProperty=(0,r._)`${i}`,t.dataPathArr=[...l,t.parentDataProperty]}function d(r){t.data=r,t.dataLevel=a.dataLevel+1,t.dataTypes=[],a.definedProperties=new Set,t.parentData=a.data,t.dataNames=[...a.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:a,createErrors:i,allErrors:n}){void 0!==a&&(t.compositeRule=a),void 0!==i&&(t.createErrors=i),void 0!==n&&(t.allErrors=n),t.jtdDiscriminator=r,t.jtdMetadata=o}}),uI=z((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((a=r.length)!=o.length)return!1;for(i=a;0!=i--;)if(!t(r[i],o[i]))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((a=(n=Object.keys(r)).length)!==Object.keys(o).length)return!1;for(i=a;0!=i--;)if(!Object.prototype.hasOwnProperty.call(o,n[i]))return!1;for(i=a;0!=i--;){var a,i,n,s=n[i];if(!t(r[s],o[s]))return!1}return!0}return r!=r&&o!=o}}),uN=z((t,r)=>{var o=r.exports=function(t,r,a){"function"==typeof r&&(a=r,r={});var i="function"==typeof(a=r.cb||a)?a:a.pre||function(){};!function t(r,a,i,n,s,l,c,u,d,p){if(n&&"object"==typeof n&&!Array.isArray(n)){for(var h in a(n,s,l,c,u,d,p),n){var f,m=n[h];if(Array.isArray(m)){if(h in o.arrayKeywords)for(var y=0;y<m.length;y++)t(r,a,i,m[y],s+"/"+h+"/"+y,l,s,h,n,y)}else if(h in o.propsKeywords){if(m&&"object"==typeof m)for(var g in m){t(r,a,i,m[g],s+"/"+h+"/"+(f=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,a,i,m,s+"/"+h,l,s,h,n)}i(n,s,l,c,u,d,p)}}(r,i,a.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}}),uM=z(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;let r=u$(),o=uI(),a=uN(),i=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 a=r[o];if(Array.isArray(a)&&a.some(t)||"object"==typeof a&&t(a))return!0}return!1}(t):!!o&&function t(o){let a=0;for(let n in o)if("$ref"===n||(a++,!i.has(n)&&("object"==typeof o[n]&&(0,r.eachItem)(o[n],r=>a+=t(r)),a===1/0)))return 1/0;return a}(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:i,uriResolver:n}=this.opts,l=u(t[i]||r),c={"":l},p=s(n,l,!1),h={},f=new Set;return a(t,{allKeys:!0},(t,r,o,a)=>{if(void 0===a)return;let n=p+r,s=c[a];function l(r){let o=this.opts.uriResolver.resolve;if(r=u(s?o(s,r):r),f.has(r))throw y(r);f.add(r);let a=this.refs[r];return"string"==typeof a&&(a=this.refs[a]),"object"==typeof a?m(t,a.schema,r):r!==u(n)&&("#"===r[0]?(m(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[i]&&(s=l.call(this,t[i])),g.call(this,t.$anchor),g.call(this,t.$dynamicAnchor),c[r]=s}),h;function m(t,r,a){if(void 0!==r&&!o(t,r))throw y(a)}function y(t){return Error(`reference "${t}" resolves to more than one schema`)}}}),uz=z(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;let r=uk(),o=uC(),a=ux(),i=uC(),n=uA(),s=uO(),l=uj(),c=uw(),u=uE(),d=uM(),p=u$(),h=uP();function f({gen:t,validateName:r,schema:o,schemaEnv:a,opts:i},n){var s;i.code.es5?t.func(r,(0,c._)`${u.default.data}, ${u.default.valCxt}`,a.$async,()=>{var r,a;t.code((0,c._)`"use strict"; ${m(o,i)}`),r=t,a=i,r.if(u.default.valCxt,()=>{r.var(u.default.instancePath,(0,c._)`${u.default.valCxt}.${u.default.instancePath}`),r.var(u.default.parentData,(0,c._)`${u.default.valCxt}.${u.default.parentData}`),r.var(u.default.parentDataProperty,(0,c._)`${u.default.valCxt}.${u.default.parentDataProperty}`),r.var(u.default.rootData,(0,c._)`${u.default.valCxt}.${u.default.rootData}`),a.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),a.dynamicRef&&r.var(u.default.dynamicAnchors,(0,c._)`{}`)}),t.code(n)}):t.func(r,(0,c._)`${u.default.data}, ${(s=i,(0,c._)`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${s.dynamicRef?(0,c._)`, ${u.default.dynamicAnchors}={}`:c.nil}}={}`)}`,a.$async,()=>t.code(m(o,i)).code(n))}function m(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:a,self:i}=t;r.$ref&&a.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(r,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${o}"`)}(t)}function _(t,r){if(t.opts.jtd)return S(t,[],!1,r);let a=(0,o.getSchemaTypes)(t.schema);S(t,a,!(0,o.coerceAndCheckDataType)(t,a),r)}function b({gen:t,schemaEnv:r,schema:o,errSchemaPath:a,opts:i}){let n=o.$comment;if(!0===i.$comment)t.code((0,c._)`${u.default.self}.logger.log(${n})`);else if("function"==typeof i.$comment){let o=(0,c.str)`${a}/$comment`,i=t.scopeValue("root",{ref:r.root});t.code((0,c._)`${u.default.self}.opts.$comment(${n}, ${o}, ${i}.schema)`)}}function S(t,r,o,n){var s,l,d,h;let{gen:f,schema:m,data:y,allErrors:g,opts:v,self:_}=t,{RULES:b}=_;if(m.$ref&&(v.ignoreKeywordsWithRef||!(0,p.schemaHasRulesButRef)(m,b)))return void f.block(()=>k(t,"$ref",b.all.$ref.definition));function S(s){(0,a.shouldUseGroup)(m,s)&&(s.type?(f.if((0,i.checkDataType)(s.type,y,v.strictNumbers)),w(t,s),1===r.length&&r[0]===s.type&&o&&(f.else(),(0,i.reportTypeError)(t)),f.endIf()):w(t,s),g||f.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)||E(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),function(t,r){let o=[];for(let a of t.dataTypes)$(r,a)?o.push(a):r.includes("integer")&&"number"===a&&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"))&&E(d,"use allowUnionTypes to allow union type keyword")),function(t,r){let o=t.self.RULES.all;for(let i in o){let n=o[i];if("object"==typeof n&&(0,a.shouldUseRule)(t.schema,n)){let{type:o}=n.definition;o.length&&!o.some(t=>{var o,a;return o=r,a=t,o.includes(a)||"number"===a&&o.includes("integer")})&&E(t,`missing type "${o.join(",")}" for keyword "${i}"`)}}}(s,s.dataTypes))),f.block(()=>{for(let t of b.rules)S(t);S(b.post)})}function w(t,r){let{gen:o,schema:i,opts:{useDefaults:s}}=t;s&&(0,n.assignDefaults)(t,r.type),o.block(()=>{for(let o of r.rules)(0,a.shouldUseRule)(i,o)&&k(t,o.keyword,o.definition,r.type)})}function $(t,r){return t.includes(r)||"integer"===r&&t.includes("number")}function E(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:a}=t;f(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),a.let(u.default.vErrors,null),a.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:a,ValidationError:i,opts:n}=t;o.$async?r.if((0,c._)`${u.default.errors} === 0`,()=>r.return(u.default.data),()=>r.throw((0,c._)`new ${i}(${u.default.vErrors})`)):(r.assign((0,c._)`${a}.errors`,u.default.vErrors),n.unevaluated&&function({gen:t,evaluated:r,props:o,items:a}){o instanceof c.Name&&t.assign((0,c._)`${r}.props`,o),a instanceof c.Name&&t.assign((0,c._)`${r}.items`,a)}(t),r.return((0,c._)`${u.default.errors} === 0`))}(t)})}(t):f(t,()=>(0,r.topBoolOrEmptySchema)(t))};var P=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",C(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:a,schemaType:i,def:n}=this;o.if((0,c.or)((0,c._)`${a} === undefined`,r)),t!==c.nil&&o.assign(t,!0),(i.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:a,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,i.checkDataTypes)(t,r,n.opts.strictNumbers,i.DataType.Wrong)}`}return c.nil}(),function(){if(a.validateSchema){let o=t.scopeValue("validate$data",{ref:a.validateSchema});return(0,c._)`!${o}(${r})`}return c.nil}())}subschema(t,o){let a=(0,l.getSubschema)(this.it,t);(0,l.extendSubschemaData)(a,this.it,t),(0,l.extendSubschemaMode)(a,t);let i={...this.it,...a,items:void 0,props:void 0};return!function(t,o){if(g(t)&&(v(t),y(t)))return function(t,r){var o;let a,{schema:i,gen:n,opts:s}=t;s.$comment&&i.$comment&&b(t),(a=(o=t).schema[o.opts.schemaId])&&(o.baseId=(0,d.resolveUrl)(o.opts.uriResolver,o.baseId,a)),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)}(i,o),i}mergeEvaluated(t,r){let{it:o,gen:a}=this;o.opts.unevaluated&&(!0!==o.props&&void 0!==t.props&&(o.props=p.mergeEvaluated.props(a,t.props,o.props,r)),!0!==o.items&&void 0!==t.items&&(o.items=p.mergeEvaluated.items(a,t.items,o.items,r)))}mergeValidEvaluated(t,r){let{it:o,gen:a}=this;if(o.opts.unevaluated&&(!0!==o.props||!0!==o.items))return a.if(r,()=>this.mergeEvaluated(t,c.Name)),!0}};function k(t,r,o,a){let i=new P(t,o,r);"code"in o?o.code(i,a):i.$data&&o.validate?(0,s.funcKeywordCode)(i,o):"macro"in o?(0,s.macroKeywordCode)(i,o):(o.compile||o.validate)&&(0,s.funcKeywordCode)(i,o)}t.KeywordCxt=P;let R=/^\/(?:[^~]|~0|~1)*$/,x=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function C(t,{dataLevel:r,dataNames:o,dataPathArr:a}){let i,n;if(""===t)return u.default.rootData;if("/"===t[0]){if(!R.test(t))throw Error(`Invalid JSON-pointer: ${t}`);i=t,n=u.default.rootData}else{let s=x.exec(t);if(!s)throw Error(`Invalid JSON-pointer: ${t}`);let c=+s[1];if("#"===(i=s[2])){if(c>=r)throw Error(l("property/index",c));return a[r-c]}if(c>r)throw Error(l("data",c));if(n=o[r-c],!i)return n}let s=n;for(let t of i.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=C}),uq=z(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}}}),uH=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uM();t.default=class extends Error{constructor(t,o,a,i){super(i||`can't resolve reference ${a} from id ${o}`),this.missingRef=(0,r.resolveUrl)(t,o,a),this.missingSchema=(0,r.normalizeId)((0,r.getFullPath)(t,this.missingRef))}}}),uU=z(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;let r=uw(),o=uq(),a=uE(),i=uM(),n=u$(),s=uz();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,i.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,i.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:p,lines:h}=this.opts.code,{ownProperties:f}=this.opts,m=new r.CodeGen(this.scope,{es5:p,lines:h,ownProperties:f});t.$async&&(n=m.scopeValue("Error",{ref:o.default,code:(0,r._)`require("ajv/dist/runtime/validation_error").default`}));let y=m.scopeName("validate");t.validateName=y;let g={gen:m,allErrors:this.opts.allErrors,data:a.default.data,parentData:a.default.parentData,parentDataProperty:a.default.parentDataProperty,dataNames:[a.default.data],dataPathArr:[r.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:m.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),m.optimize(this.opts.code.optimize);let o=m.toString();l=`${m.scopeRefs(a.default.scope)}return ${o}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let i=Function(`${a.default.self}`,`${a.default.scope}`,l)(this,this.scope.get());if(this.scope.value(y,{ref:i}),i.errors=null,i.schema=t.schema,i.schemaEnv=t,t.$async&&(i.$async=!0),!0===this.opts.code.source&&(i.source={validateName:y,validateCode:o,scopeValues:m._values}),this.opts.unevaluated){let{props:t,items:o}=g;i.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},i.source&&(i.source.evaluated=(0,r.stringify)(i.evaluated))}return t.validate=i,t}catch(r){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),r}finally{this._compilations.delete(t)}}function u(t){return(0,i.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:c.call(this,t)}function d(t){for(let a of this._compilations){var r,o;if(r=a,o=t,r.schema===o.schema&&r.root===o.root&&r.baseId===o.baseId)return a}}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),a=(0,i._getFullPath)(this.opts.uriResolver,o),n=(0,i.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&a===n)return m.call(this,o,t);let s=(0,i.normalizeId)(a),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 m.call(this,o,r)}if("object"==typeof(null==u?void 0:u.schema)){if(u.validate||c.call(this,u),s===(0,i.normalizeId)(r)){let{schema:r}=u,{schemaId:o}=this.opts,a=r[o];return a&&(n=(0,i.resolveUrl)(this.opts.uriResolver,n,a)),new l({schema:r,schemaId:o,root:t,baseId:n})}return m.call(this,o,u)}}t.SchemaEnv=l,t.compileSchema=c,t.resolveRef=function(t,r,o){var a;o=(0,i.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 i=null==(a=t.localRefs)?void 0:a[o],{schemaId:n}=this.opts;i&&(s=new l({schema:i,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 f=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function m(t,{baseId:r,schema:o,root:a}){var s;let c;if((null==(s=t.fragment)?void 0:s[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if("boolean"==typeof o)return;let t=o[(0,n.unescapeFragment)(a)];if(void 0===t)return;let s="object"==typeof(o=t)&&o[this.opts.schemaId];!f.has(a)&&s&&(r=(0,i.resolveUrl)(this.opts.uriResolver,r,s))}if("boolean"!=typeof o&&o.$ref&&!(0,n.schemaHasRulesButRef)(o,this.RULES)){let t=(0,i.resolveUrl)(this.opts.uriResolver,r,o.$ref);c=h.call(this,a,t)}let{schemaId:u}=this.opts;if((c=c||new l({schema:o,schemaId:u,root:a,baseId:r})).schema!==c.root.schema)return c}}),uD=z((t,r)=>{r.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),uL=z((t,r)=>{let o=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),a=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function i(t){let r="",o=0,a=0;for(a=0;a<t.length;a++)if(48!==(o=t[a].charCodeAt(0))){if(!(o>=48&&o<=57||o>=65&&o<=70||o>=97&&o<=102))return"";r+=t[a];break}for(a+=1;a<t.length;a++){if(!((o=t[a].charCodeAt(0))>=48&&o<=57||o>=65&&o<=70||o>=97&&o<=102))return"";r+=t[a]}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 a=i(t);if(""===a)return o.error=!0,!1;r.push(a),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:""},a=[],n=[],c=!1,u=!1,d=l;for(let i=0;i<t.length;i++){let l=t[i];if("["!==l&&"]"!==l)if(":"===l){if(!0===c&&(u=!0),!d(n,a,o))break;if(++r>7){o.error=!0;break}i>0&&":"===t[i-1]&&(c=!0),a.push(":");continue}else if("%"===l){if(!d(n,a,o))break;d=s}else{n.push(l);continue}}return n.length&&(d===s?o.zone=n.join(""):u?a.push(n.join("")):a.push(i(n))),o.address=a.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(!a(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=[],a=-1,i=0;for(;i=r.length;){if(1===i)if("."===r)break;else if("/"===r){o.push("/");break}else{o.push(r);break}if(2===i){if("."===r[0]){if("."===r[1])break;else if("/"===r[1]){r=r.slice(2);continue}}else if("/"===r[0]&&("."===r[1]||"/"===r[1])){o.push("/");break}}else if(3===i&&"/.."===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===(a=r.indexOf("/",1))){o.push(r);break}o.push(r.slice(0,a)),r=r.slice(a)}return o.join("")},isIPv4:a,isUUID:o,normalizeIPv6:c,stringArrayToHexStripped:i}}),uK=z((t,r)=>{let{isUUID:o}=uL(),a=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,i=["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(a);if(o){let a=r.scheme||t.scheme||"urn";t.nid=o[1].toLowerCase(),t.nss=o[2];let i=f(`${a}:${r.nid||t.nid}`);t.path=void 0,i&&(t=i.parse(t,r))}else t.error=t.error||"URN can not be parsed.";return t},serialize:function(t,r){if(void 0===t.nid)throw Error("URN without nid cannot be serialized");let o=r.scheme||t.scheme||"urn",a=t.nid.toLowerCase(),i=f(`${o}:${r.nid||a}`);i&&(t=i.serialize(t,r));let n=t,s=t.nss;return n.path=`${a||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 f(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!==i.indexOf(t)},getSchemeHandler:f}}),uJ=z((t,r)=>{let{normalizeIPv6:o,removeDotSegments:a,recomposeAuthority:i,normalizeComponentEncoding:n,isIPv4:s,nonSimpleDomain:l}=uL(),{SCHEMES:c,getSchemeHandler:u}=uK();function d(t,r,o,i){let n={};return i||(t=f(p(t,o),o),r=f(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=a(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=a(r.path||""),n.query=r.query):(r.path?("/"===r.path[0]?n.path=a(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=a(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=i(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=a(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 f(t,r){let a=Object.assign({},r),i={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1;"suffix"===a.reference&&(t=a.scheme?a.scheme+":"+t:"//"+t);let c=t.match(h);if(c){if(i.scheme=c[1],i.userinfo=c[3],i.host=c[4],i.port=parseInt(c[5],10),i.path=c[6]||"",i.query=c[7],i.fragment=c[8],isNaN(i.port)&&(i.port=c[5]),i.host)if(!1===s(i.host)){let t=o(i.host);i.host=t.host.toLowerCase(),n=t.isIPV6}else n=!0;void 0!==i.scheme||void 0!==i.userinfo||void 0!==i.host||void 0!==i.port||void 0!==i.query||i.path?void 0===i.scheme?i.reference="relative":void 0===i.fragment?i.reference="absolute":i.reference="uri":i.reference="same-document",a.reference&&"suffix"!==a.reference&&a.reference!==i.reference&&(i.error=i.error||"URI is not a "+a.reference+" reference.");let r=u(a.scheme||i.scheme);if(!a.unicodeSupport&&(!r||!r.unicodeSupport)&&i.host&&(a.domainHost||r&&r.domainHost)&&!1===n&&l(i.host))try{i.host=URL.domainToASCII(i.host.toLowerCase())}catch(t){i.error=i.error||"Host's domain name can not be converted to ASCII: "+t}(!r||r&&!r.skipNormalize)&&(-1!==t.indexOf("%")&&(void 0!==i.scheme&&(i.scheme=unescape(i.scheme)),void 0!==i.host&&(i.host=unescape(i.host))),i.path&&(i.path=escape(unescape(i.path))),i.fragment&&(i.fragment=encodeURI(decodeURIComponent(i.fragment)))),r&&r.parse&&r.parse(i,a)}else i.error=i.error||"URI can not be parsed.";return i}let m={SCHEMES:c,normalize:function(t,r){return"string"==typeof t?t=p(f(t,r),r):"object"==typeof t&&(t=f(p(t,r),r)),t},resolve:function(t,r,o){let a=o?Object.assign({scheme:"null"},o):{scheme:"null"},i=d(f(t,a),f(r,a),a,!0);return a.skipEscape=!0,p(i,a)},resolveComponent:d,equal:function(t,r,o){return"string"==typeof t?t=p(n(f(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(f(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:f};r.exports=m,r.exports.default=m,r.exports.fastUri=m}),uV=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uJ();r.code='require("ajv/dist/runtime/uri").default',t.default=r}),uW=z(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var r=uz();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return r.KeywordCxt}});var o=uw();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 a=uq(),i=uH(),n=uR(),s=uU(),l=uw(),c=uM(),u=uC(),d=u$(),p=uD(),h=uV(),f=(t,r)=>new RegExp(t,r);f.code="new RegExp";let m=["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,a,i,n,s,l,c,u,d,p,m,y,g,v,_,b,S,w,$,E,P,k,R,x;let C=t.strict,A=null==(r=t.code)?void 0:r.optimize,T=!0===A||void 0===A?1:A||0,O=null!=(a=null==(o=t.code)?void 0:o.regExp)?a:f,j=null!=(i=t.uriResolver)?i:h.default;return{strictSchema:null==(s=null!=(n=t.strictSchema)?n:C)||s,strictNumbers:null==(c=null!=(l=t.strictNumbers)?l:C)||c,strictTypes:null!=(d=null!=(u=t.strictTypes)?u:C)?d:"log",strictTuples:null!=(m=null!=(p=t.strictTuples)?p:C)?m:"log",strictRequired:null!=(g=null!=(y=t.strictRequired)?y:C)&&g,code:t.code?{...t.code,optimize:T,regExp:O}:{optimize:T,regExp:O},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==(E=t.addUsedSchema)||E,validateSchema:null==(P=t.validateSchema)||P,validateFormats:null==(k=t.validateFormats)||k,unicodeRegExp:null==(R=t.unicodeRegExp)||R,int32range:null==(x=t.int32range)||x,uriResolver:j}}(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 k;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 a=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=P.call(this),t.formats&&$.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&E.call(this,t.keywords),"object"==typeof t.meta&&this.addMetaSchema(t.meta),w.call(this),t.validateFormats=a}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:o}=this.opts,a=p;"id"===o&&((a={...p}).id=a.$id,delete a.$id),r&&t&&this.addMetaSchema(a,a[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 a=o(r);return"$async"in o||(this.errors=o.errors),a}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 a.call(this,t,r);async function a(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 a.call(this,{$ref:t},!0)}async function s(t){try{return this._compileSchemaEnv(t)}catch(r){if(!(r instanceof i.default))throw r;return l.call(this,r),await c.call(this,r.missingSchema),s.call(this,t)}}function l({missingSchema:t,missingRef:r}){if(this.refs[t])throw Error(`AnySchema ${t} is loaded but ${r} cannot be resolved`)}async function c(t){let 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,a=this.opts.validateSchema){let i;if(Array.isArray(t)){for(let r of t)this.addSchema(r,void 0,o,a);return this}if("object"==typeof t){let{schemaId:r}=this.opts;if(void 0!==(i=t[r])&&"string"!=typeof i)throw Error(`schema ${r} must be string`)}return r=(0,c.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(t,o,r,a,!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 a=this.validate(o,t);if(!a&&r){let t="schema is invalid: "+this.errorsText();if("log"===this.opts.validateSchema)this.logger.error(t);else throw Error(t)}return a}getSchema(t){let r;for(;"string"==typeof(r=S.call(this,t));)t=r;if(void 0===r){let{schemaId:o}=this.opts,a=new s.SchemaEnv({schema:{},schemaId:o});if(!(r=s.resolveSchema.call(this,a,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=>C.call(this,t)),this;T.call(this,r);let a={...r,type:(0,u.getJSONTypes)(r.type),schemaType:(0,u.getJSONTypes)(r.schemaType)};return(0,d.eachItem)(o,0===a.type.length?t=>C.call(this,t,a):t=>a.type.forEach(r=>C.call(this,t,a,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 a of(t=JSON.parse(JSON.stringify(t)),r)){let r=a.split("/").slice(1),i=t;for(let t of r)i=i[t];for(let t in o){let r=o[t];if("object"!=typeof r)continue;let{$data:a}=r.definition,n=i[t];a&&n&&(i[t]=j(n))}}return t}_removeAllSchemas(t,r){for(let o in t){let a=t[o];(!r||r.test(o))&&("string"==typeof a?delete t[o]:a&&!a.meta&&(this._cache.delete(a.schema),delete t[o]))}}_addSchema(t,r,o,a=this.opts.validateSchema,i=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),i&&!o.startsWith("#")&&(o&&this._checkUnique(o),this.refs[o]=u),a&&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,a="error"){for(let i in t)i in r&&this.logger[a](`${o}: option ${i}. ${t[i]}`)}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 E(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 P(){let t={...this.opts};for(let r of m)delete t[r];return t}_.ValidationError=a.default,_.MissingRefError=i.default,t.default=_;let k={log(){},warn(){},error(){}},R=/^[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(!R.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 C(t,r,o){var a;let i=null==r?void 0:r.post;if(o&&i)throw Error('keyword with "post" flag cannot have "type"');let{RULES:n}=this,s=i?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?A.call(this,s,l,r.before):s.rules.push(l),n.all[t]=l,null==(a=r.implements)||a.forEach(t=>this.addKeyword(t))}function A(t,r,o){let a=t.rules.findIndex(t=>t.keyword===o);a>=0?t.rules.splice(a,0,r):(t.rules.push(r),this.logger.warn(`rule ${o} is not defined`))}function T(t){let{metaSchema:r}=t;void 0!==r&&(t.$data&&this.opts.$data&&(r=j(r)),t.validateSchema=this.compile(r,!0))}let O={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function j(t){return{anyOf:[t,O]}}}),uF=z(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}}}),uB=z(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;let r=uH(),o=uT(),a=uw(),i=uE(),n=uU(),s=u$();function l(t,r){let{gen:o}=t;return r.validate?o.scopeValue("validate",{ref:r.validate}):(0,a._)`${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,f=h.passContext?i.default.this:a.nil;function m(t){let r=(0,a._)`${t}.errors`;c.assign(i.default.vErrors,(0,a._)`${i.default.vErrors} === null ? ${r} : ${i.default.vErrors}.concat(${r})`),c.assign(i.default.errors,(0,a._)`${i.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,a._)`${t}.evaluated.props`);u.props=s.mergeEvaluated.props(c,r,u.props,a.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,a._)`${t}.evaluated.items`);u.items=s.mergeEvaluated.items(c,r,u.items,a.Name)}}l?function(){if(!p.$async)throw Error("async schema referenced by sync schema");let i=c.let("valid");c.try(()=>{c.code((0,a._)`await ${(0,o.callValidateCode)(t,r,f)}`),y(r),d||c.assign(i,!0)},t=>{c.if((0,a._)`!(${t} instanceof ${u.ValidationError})`,()=>c.throw(t)),m(t),d||c.assign(i,!1)}),t.ok(i)}():t.result((0,o.callValidateCode)(t,r,f),()=>y(r),()=>m(r))}t.getValidate=l,t.callRef=c,t.default={keyword:"$ref",schemaType:"string",code(t){var o,i;let s,u,d,{gen:p,schema:h,it:f}=t,{baseId:m,schemaEnv:y,validateName:g,opts:v,self:_}=f,{root:b}=y;if(("#"===h||"#/"===h)&&m===b.baseId){if(y===b)return c(t,g,y,y.$async);let r=p.scopeValue("root",{ref:b});return c(t,(0,a._)`${r}.validate`,b,b.$async)}let S=n.resolveRef.call(_,b,m,h);if(void 0===S)throw new r.default(f.opts.uriResolver,m,h);return S instanceof n.SchemaEnv?void c(t,l(t,o=S),o,o.$async):(i=S,s=p.scopeValue("schema",!0===v.code.source?{ref:i,code:(0,a.stringify)(i)}:{ref:i}),u=p.name("valid"),d=t.subschema({schema:i,dataTypes:[],schemaPath:a.nil,topSchemaRef:s,errSchemaPath:h},u),void(t.mergeEvaluated(d),t.ok(u)))}}}),uZ=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uF(),o=uB();t.default=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",r.default,o.default]}),uG=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uw(),o=r.operators,a={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(a),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:o})=>(0,r.str)`must be ${a[t].okStr} ${o}`,params:({keyword:t,schemaCode:o})=>(0,r._)`{comparison: ${a[t].okStr}, limit: ${o}}`},code(t){let{keyword:o,data:i,schemaCode:n}=t;t.fail$data((0,r._)`${i} ${a[o].fail} ${n} || isNaN(${i})`)}}}),uX=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uw();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:a,schemaCode:i,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._)`(${i} === 0 || (${l} = ${a}/${i}, ${c}))`)}}}),uY=z(t=>{function r(t){let r,o=t.length,a=0,i=0;for(;i<o;)a++,(r=t.charCodeAt(i++))>=55296&&r<=56319&&i<o&&(64512&(r=t.charCodeAt(i)))==56320&&i++;return a}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,r.code='require("ajv/dist/runtime/ucs2length").default'}),uQ=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uw(),o=u$(),a=uY();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:i,data:n,schemaCode:s,it:l}=t,c="maxLength"===i?r.operators.GT:r.operators.LT,u=!1===l.opts.unicode?(0,r._)`${n}.length`:(0,r._)`${(0,o.useFunc)(t.gen,a.default)}(${n})`;t.fail$data((0,r._)`${u} ${c} ${s}`)}}}),u0=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uT(),o=u$(),a=uw();t.default={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,a.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,a._)`{pattern: ${t}}`},code(t){let{gen:i,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,a._)`new RegExp`:(0,o.useFunc)(i,r),l=i.let("valid");i.try(()=>i.assign(l,(0,a._)`${s}(${c}, ${d}).test(${n})`),()=>i.assign(l,!1)),t.fail$data((0,a._)`!${l}`)}else{let o=(0,r.usePattern)(t,l);t.fail$data((0,a._)`!${o}.test(${n})`)}}}}),u1=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uw();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:a,schemaCode:i}=t,n="maxProperties"===o?r.operators.GT:r.operators.LT;t.fail$data((0,r._)`Object.keys(${a}).length ${n} ${i}`)}}}),u2=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uT(),o=uw(),a=u$();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:i,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 a=i.let("missing");if(p||c){let n=i.let("valid",!0);t.block$data(n,()=>{var c,u;return c=a,u=n,void(t.setParams({missingProperty:c}),i.forOf(c,s,()=>{i.assign(u,(0,r.propertyInData)(i,l,c,d.ownProperties)),i.if((0,o.not)(u),()=>{t.error(),i.break()})},o.nil))}),t.ok(n)}else i.if((0,r.checkMissingProp)(t,n,a)),(0,r.reportMissingProp)(t,a),i.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,a.checkStrictMode)(u,r,u.opts.strictRequired)}}function h(){i.forOf("prop",s,o=>{t.setParams({missingProperty:o}),i.if((0,r.noPropertyInData)(i,l,o,d.ownProperties),()=>t.error())})}}}}),u9=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uw();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:a,schemaCode:i}=t,n="maxItems"===o?r.operators.GT:r.operators.LT;t.fail$data((0,r._)`${a}.length ${n} ${i}`)}}}),u4=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uI();r.code='require("ajv/dist/runtime/equal").default',t.default=r}),u5=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uC(),o=uw(),a=u$(),i=u4();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"),f=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`,()=>(f.length>0&&!f.some(t=>"object"===t||"array"===t)?function(a,i){let l=n.name("item"),c=(0,r.checkDataTypes)(f,l,p.opts.strictNumbers,r.DataType.Wrong),u=n.const("indices",(0,o._)`{}`);n.for((0,o._)`;${a}--;`,()=>{n.let(l,(0,o._)`${s}[${a}]`),n.if(c,(0,o._)`continue`),f.length>1&&n.if((0,o._)`typeof ${l} == "string"`,(0,o._)`${l} += "_"`),n.if((0,o._)`typeof ${u}[${l}] == "number"`,()=>{n.assign(i,(0,o._)`${u}[${l}]`),t.error(),n.assign(h,!1).break()}).code((0,o._)`${u}[${l}] = ${a}`)})}:function(r,l){let c=(0,a.useFunc)(n,i.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)}}}),u3=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uw(),o=u$(),a=u4();t.default={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:t})=>(0,r._)`{allowedValue: ${t}}`},code(t){let{gen:i,data:n,$data:s,schemaCode:l,schema:c}=t;s||c&&"object"==typeof c?t.fail$data((0,r._)`!${(0,o.useFunc)(i,a.default)}(${n}, ${l})`):t.fail((0,r._)`${c} !== ${n}`)}}}),u6=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uw(),o=u$(),a=u4();t.default={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,r._)`{allowedValues: ${t}}`},code(t){let i,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,f=()=>null!=i?i:i=(0,o.useFunc)(s,a.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._)`${f()}(${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,a)=>{var i,n;let s;return i=t,"object"==typeof(s=u[n=a])&&null!==s?(0,r._)`${f()}(${l}, ${i}[${n}])`:(0,r._)`${l} === ${s}`}))}t.pass(n)}}}),u8=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uG(),o=uX(),a=uQ(),i=u0(),n=u1(),s=u2(),l=u9(),c=u5(),u=u3(),d=u6();t.default=[r.default,o.default,a.default,i.default,n.default,s.default,l.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,d.default]}),u7=z(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;let r=uw(),o=u$();function a(t,a){let{gen:i,schema:n,data:s,keyword:l,it:c}=t;c.items=!0;let u=i.const("len",(0,r._)`${s}.length`);if(!1===n)t.setParams({len:a.length}),t.pass((0,r._)`${u} <= ${a.length}`);else if("object"==typeof n&&!(0,o.alwaysValidSchema)(c,n)){let n=i.var("valid",(0,r._)`${u} <= ${a.length}`);i.if((0,r.not)(n),()=>{var s;return s=n,void i.forRange("i",a.length,u,a=>{t.subschema({keyword:l,dataProp:a,dataPropType:o.Type.Num},s),c.allErrors||i.if((0,r.not)(s),()=>i.break())})}),t.ok(n)}}t.validateAdditionalItems=a,t.default={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,r.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,r._)`{limit: ${t}}`},code(t){let{parentSchema:r,it:i}=t,{items:n}=r;Array.isArray(n)?a(t,n):(0,o.checkStrictMode)(i,'"additionalItems" is ignored when "items" is not an array of schemas')}}}),de=z(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;let r=uw(),o=u$(),a=uT();function i(t,a,n=t.schema){let{gen:s,parentSchema:l,data:c,keyword:u,it:d}=t;(function(t){let{opts:r,errSchemaPath:i}=d,s=n.length,l=s===t.minItems&&(s===t.maxItems||!1===t[a]);if(r.strictTuples&&!l){let t=`"${u}" is ${s}-tuple, but minItems or maxItems/${a} are not specified or different at path "${i}"`;(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((a,i)=>{(0,o.alwaysValidSchema)(d,a)||(s.if((0,r._)`${h} > ${i}`,()=>t.subschema({keyword:u,schemaProp:i,dataProp:i},p)),t.ok(p))})}t.validateTuple=i,t.default={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:r,it:n}=t;if(Array.isArray(r))return i(t,"additionalItems",r);n.items=!0,(0,o.alwaysValidSchema)(n,r)||t.ok((0,a.validateArray)(t))}}}),dt=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=de();t.default={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,r.validateTuple)(t,"items")}}),dr=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uw(),o=u$(),a=uT(),i=u7();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,i.validateAdditionalItems)(t,l):t.ok((0,a.validateArray)(t)))}}}),da=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uw(),o=u$();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 a,i,{gen:n,schema:s,parentSchema:l,data:c,it:u}=t,{minContains:d,maxContains:p}=l;u.opts.next?(a=void 0===d?1:d,i=p):a=1;let h=n.const("len",(0,r._)`${c}.length`);if(t.setParams({min:a,max:i}),void 0===i&&0===a)return void(0,o.checkStrictMode)(u,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==i&&a>i){(0,o.checkStrictMode)(u,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,o.alwaysValidSchema)(u,s)){let o=(0,r._)`${h} >= ${a}`;void 0!==i&&(o=(0,r._)`${o} && ${h} <= ${i}`),t.pass(o);return}u.items=!0;let f=n.name("valid");function m(){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===i?n.if((0,r._)`${t} >= ${a}`,()=>n.assign(f,!0).break()):(n.if((0,r._)`${t} > ${i}`,()=>n.assign(f,!1).break()),1===a?n.assign(f,!0):n.if((0,r._)`${t} >= ${a}`,()=>n.assign(f,!0))))}))}function y(r,a){n.forRange("i",0,h,i=>{t.subschema({keyword:"contains",dataProp:i,dataPropType:o.Type.Num,compositeRule:!0},r),a()})}void 0===i&&1===a?y(f,()=>n.if(f,()=>n.break())):0===a?(n.let(f,!0),void 0!==i&&n.if((0,r._)`${c}.length > 0`,m)):(n.let(f,!1),m()),t.result(f,()=>t.reset())}}}),di=z(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;let r=uw(),o=u$(),a=uT();t.error={message:({params:{property:t,depsCount:o,deps:a}})=>(0,r.str)`must have ${1===o?"property":"properties"} ${a} when property ${t} is present`,params:({params:{property:t,depsCount:o,deps:a,missingProperty:i}})=>(0,r._)`{property: ${t},
61
+ missingProperty: ${i},
60
62
  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(`
63
+ deps: ${a}}`};let i={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(t){let[r,o]=function({schema:t}){let r={},o={};for(let a in t)"__proto__"!==a&&((Array.isArray(t[a])?r:o)[a]=t[a]);return[r,o]}(t);n(t,r),s(t,o)}};function n(t,o=t.schema){let{gen:i,data:s,it:l}=t;if(0===Object.keys(o).length)return;let c=i.let("missing");for(let n in o){let u=o[n];if(0===u.length)continue;let d=(0,a.propertyInData)(i,s,n,l.opts.ownProperties);t.setParams({property:n,depsCount:u.length,deps:u.join(", ")}),l.allErrors?i.if(d,()=>{for(let r of u)(0,a.checkReportMissingProp)(t,r)}):(i.if((0,r._)`${d} && (${(0,a.checkMissingProp)(t,u,c)})`),(0,a.reportMissingProp)(t,c),i.else())}}function s(t,r=t.schema){let{gen:i,data:n,keyword:l,it:c}=t,u=i.name("valid");for(let s in r)(0,o.alwaysValidSchema)(c,r[s])||(i.if((0,a.propertyInData)(i,n,s,c.opts.ownProperties),()=>{let r=t.subschema({keyword:l,schemaProp:s},u);t.mergeValidEvaluated(r,u)},()=>i.var(u,!0)),t.ok(u))}t.validatePropertyDeps=n,t.validateSchemaDeps=s,t.default=i}),dn=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uw(),o=u$();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:a,schema:i,data:n,it:s}=t;if((0,o.alwaysValidSchema)(s,i))return;let l=a.name("valid");a.forIn("key",n,o=>{t.setParams({propertyName:o}),t.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},l),a.if((0,r.not)(l),()=>{t.error(!0),s.allErrors||a.break()})}),t.ok(l)}}}),ds=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uT(),o=uw(),a=uE(),i=u$();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,i.alwaysValidSchema)(d,s))return;let f=(0,r.allSchemaProperties)(l.properties),m=(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,i.alwaysValidSchema)(d,s)){let a=n.name("valid");"failing"===h.removeAdditional?(v(r,a,!1),n.if((0,o.not)(a),()=>{t.reset(),y(r)})):(v(r,a),p||n.if((0,o.not)(a),()=>n.break()))}}function v(r,o,a){let n={keyword:"additionalProperties",dataProp:r,dataPropType:i.Type.Str};!1===a&&Object.assign(n,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(n,o)}n.forIn("key",c,a=>{f.length||m.length?n.if(function(a){let s;if(f.length>8){let t=(0,i.schemaRefOrVal)(d,l.properties,"properties");s=(0,r.isOwnProperty)(n,t,a)}else s=f.length?(0,o.or)(...f.map(t=>(0,o._)`${a} === ${t}`)):o.nil;return m.length&&(s=(0,o.or)(s,...m.map(i=>(0,o._)`${(0,r.usePattern)(t,i)}.test(${a})`))),(0,o.not)(s)}(a),()=>g(a)):g(a)}),t.ok((0,o._)`${u} === ${a.default.errors}`)}}}),dl=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uz(),o=uT(),a=u$(),i=ds();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&&i.default.code(new r.KeywordCxt(u,i.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=a.mergeEvaluated.props(n,(0,a.toHash)(d),u.props));let p=d.filter(t=>!(0,a.alwaysValidSchema)(u,s[t]));if(0===p.length)return;let h=n.name("valid");for(let r of p){var f;(f=r,u.opts.useDefaults&&!u.compositeRule&&void 0!==s[f].default)?m(r):(n.if((0,o.propertyInData)(n,c,r,u.opts.ownProperties)),m(r),u.allErrors||n.else().var(h,!0),n.endIf()),t.it.definedProperties.add(r),t.ok(h)}function m(r){t.subschema({keyword:"properties",schemaProp:r,dataProp:r},h)}}}}),dc=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uT(),o=uw(),a=u$(),i=u$();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,a.alwaysValidSchema)(u,s[t]));if(0===p.length||h.length===p.length&&(!u.opts.unevaluated||!0===u.props))return;let f=d.strictSchema&&!d.allowMatchingProperties&&c.properties,m=n.name("valid");!0===u.props||u.props instanceof o.Name||(u.props=(0,i.evaluatedPropsToName)(n,u.props));let{props:y}=u;for(let t of p)f&&function(t){for(let r in f)new RegExp(t).test(r)&&(0,a.checkStrictMode)(u,`property ${r} matches pattern ${t} (use allowMatchingProperties)`)}(t),u.allErrors?g(t):(n.var(m,!0),g(t),n.if(m));function g(a){n.forIn("key",l,s=>{n.if((0,o._)`${(0,r.usePattern)(t,a)}.test(${s})`,()=>{let r=h.includes(a);r||t.subschema({keyword:"patternProperties",schemaProp:a,dataProp:s,dataPropType:i.Type.Str},m),u.opts.unevaluated&&!0!==y?n.assign((0,o._)`${y}[${s}]`,!0):r||u.allErrors||n.if((0,o.not)(m),()=>n.break())})})}}}}),du=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u$();t.default={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:o,schema:a,it:i}=t;if((0,r.alwaysValidSchema)(i,a))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"}}}),dd=z(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:uT().validateUnion,error:{message:"must match a schema in anyOf"}}}),dp=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uw(),o=u$();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:a,schema:i,parentSchema:n,it:s}=t;if(!Array.isArray(i))throw Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;let l=a.let("valid",!1),c=a.let("passing",null),u=a.name("_valid");t.setParams({passing:c}),a.block(function(){i.forEach((i,n)=>{let d;(0,o.alwaysValidSchema)(s,i)?a.var(u,!0):d=t.subschema({keyword:"oneOf",schemaProp:n,compositeRule:!0},u),n>0&&a.if((0,r._)`${u} && ${l}`).assign(l,!1).assign(c,(0,r._)`[${c}, ${n}]`).else(),a.if(u,()=>{a.assign(l,!0),a.assign(c,n),d&&t.mergeEvaluated(d,r.Name)})})}),t.result(l,()=>t.reset(),()=>t.error(!0))}}}),dh=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u$();t.default={keyword:"allOf",schemaType:"array",code(t){let{gen:o,schema:a,it:i}=t;if(!Array.isArray(a))throw Error("ajv implementation error");let n=o.name("valid");a.forEach((o,a)=>{if((0,r.alwaysValidSchema)(i,o))return;let s=t.subschema({keyword:"allOf",schemaProp:a},n);t.ok(n),t.mergeEvaluated(s)})}}}),df=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uw(),o=u$();function a(t,r){let a=t.schema[r];return void 0!==a&&!(0,o.alwaysValidSchema)(t,a)}t.default={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:t})=>(0,r.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,r._)`{failingKeyword: ${t.ifClause}}`},code(t){let i,{gen: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=a(l,"then"),u=a(l,"else");if(!c&&!u)return;let d=n.let("valid",!0),p=n.name("_valid");if(i=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},p),t.mergeEvaluated(i),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,a){return()=>{let i=t.subschema({keyword:o},p);n.assign(d,p),t.mergeValidEvaluated(i,d),a?n.assign(a,(0,r._)`${o}`):t.setParams({ifClause:o})}}t.pass(d,()=>t.error(!0))}}}),dm=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u$();t.default={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:o,it:a}){void 0===o.if&&(0,r.checkStrictMode)(a,`"${t}" without "if" is ignored`)}}}),dy=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u7(),o=dt(),a=de(),i=dr(),n=da(),s=di(),l=dn(),c=ds(),u=dl(),d=dc(),p=du(),h=dd(),f=dp(),m=dh(),y=df(),g=dm();t.default=function(t=!1){let v=[p.default,h.default,f.default,m.default,y.default,g.default,l.default,c.default,s.default,u.default,d.default];return t?v.push(o.default,i.default):v.push(r.default,a.default),v.push(n.default),v}}),dg=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uw();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 a,i,n,s,l,c,{gen:u,data:d,$data:p,schema:h,schemaCode:f,it:m}=t,{opts:y,errSchemaPath:g,schemaEnv:v,self:_}=m;y.validateFormats&&(p?(a=u.scopeValue("formats",{ref:_.formats,code:y.code.formats}),i=u.const("fDef",(0,r._)`${a}[${f}]`),n=u.let("fType"),s=u.let("format"),u.if((0,r._)`typeof ${i} == "object" && !(${i} instanceof RegExp)`,()=>u.assign(n,(0,r._)`${i}.type || "string"`).assign(s,(0,r._)`${i}.validate`),()=>u.assign(n,(0,r._)`"string"`).assign(s,i)),t.fail$data((0,r.or)(!1===y.strictSchema?r.nil:(0,r._)`${f} && !${s}`,(l=v.$async?(0,r._)`(${i}.async ? await ${s}(${d}) : ${s}(${d}))`:(0,r._)`${s}(${d})`,c=(0,r._)`(typeof ${s} == "function" ? ${l} : ${s}.test(${d}))`,(0,r._)`${s} && ${s} !== true && ${n} === ${o} && !${c}`)))):function(){var a;let i,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,f]=(i=(a=s)instanceof RegExp?(0,r.regexpCode)(a):y.code.formats?(0,r._)`${y.code.formats}${(0,r.getProperty)(h)}`:void 0,n=u.scopeValue("formats",{key:h,ref:a,code:i}),"object"!=typeof a||a instanceof RegExp?["string",a,n]:[a.type||"string",a.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 ${f}(${d})`}return"function"==typeof p?(0,r._)`${f}(${d})`:(0,r._)`${f}.test(${d})`}())}())}}}),dv=z(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=[dg().default]}),d_=z(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"]}),db=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uZ(),o=u8(),a=dy(),i=dv(),n=d_();t.default=[r.default,o.default,(0,a.default)(),i.default,n.metadataVocabulary,n.contentVocabulary]}),dS=z(t=>{var r,o;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,(o=r||(t.DiscrError=r={})).Tag="tag",o.Mapping="mapping"}),dw=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uw(),o=dS(),a=uU(),i=uH(),n=u$();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:a}})=>(0,r._)`{error: ${t}, tag: ${a}, 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 f=s.let("valid",!1),m=s.const("tag",(0,r._)`${l}${(0,r.getProperty)(h)}`);s.if((0,r._)`typeof ${m} == "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=a.resolveRef.call(d.self,d.schemaEnv.root,d.baseId,t))instanceof a.SchemaEnv&&(u=u.schema),void 0===u)throw new i.default(d.opts.uriResolver,d.baseId,t)}let f=null==(t=null==u?void 0:u.properties)?void 0:t[h];if("object"!=typeof f)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"`)}(f,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._)`${m} === ${o}`),s.assign(f,function(o){let a=s.name("valid"),i=t.subschema({keyword:"oneOf",schemaProp:o},a);return t.mergeEvaluated(i,r.Name),a}(l[o]));s.else(),t.error(!1,{discrError:o.DiscrError.Mapping,tag:m,tagName:h}),s.endIf()})(),()=>t.error(!1,{discrError:o.DiscrError.Tag,tag:m,tagName:h})),t.ok(f)}}}),d$=z((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}}),dE=z((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=uW(),a=db(),i=dw(),n=d$(),s=["/properties"],l="http://json-schema.org/draft-07/schema";var c=class extends o.default{_addVocabularies(){super._addVocabularies(),a.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(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=uz();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=uw();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var p=uq();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return p.default}});var h=uH();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return h.default}})}),dP=z(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicAnchor=void 0;let r=uw(),o=uE(),a=uU(),i=uB();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 a.SchemaEnv({schema:o,schemaId:d,root:s,baseId:l,localRefs:c,meta:u});return a.compileSchema.call(n,p),(0,i.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)}}),dk=z(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicRef=void 0;let r=uw(),o=uE(),a=uB();function i(t,i){let{gen:n,keyword:s,it:l}=t;if("#"!==i[0])throw Error(`"${s}" only supports hash fragment reference`);let c=i.slice(1);if(l.allErrors)u();else{let r=n.let("valid",!1);u(r),t.ok(r)}function u(t){if(l.schemaEnv.root.dynamicAnchors[c]){let a=n.let("_v",(0,r._)`${o.default.dynamicAnchors}${(0,r.getProperty)(c)}`);n.if(a,d(a,t),d(l.validateName,t))}else d(l.validateName,t)()}function d(r,o){return o?()=>n.block(()=>{(0,a.callRef)(t,r),n.let(o,!0)}):()=>(0,a.callRef)(t,r)}}t.dynamicRef=i,t.default={keyword:"$dynamicRef",schemaType:"string",code:t=>i(t,t.schema)}}),dR=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dP(),o=u$();t.default={keyword:"$recursiveAnchor",schemaType:"boolean",code(t){t.schema?(0,r.dynamicAnchor)(t,""):(0,o.checkStrictMode)(t.it,"$recursiveAnchor: false is ignored")}}}),dx=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dk();t.default={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,r.dynamicRef)(t,t.schema)}}),dC=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dP(),o=dk(),a=dR(),i=dx();t.default=[r.default,o.default,a.default,i.default]}),dA=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=di();t.default={keyword:"dependentRequired",type:"object",schemaType:"object",error:r.error,code:t=>(0,r.validatePropertyDeps)(t)}}),dT=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=di();t.default={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,r.validateSchemaDeps)(t)}}),dO=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u$();t.default={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:t,parentSchema:o,it:a}){void 0===o.contains&&(0,r.checkStrictMode)(a,`"${t}" without "contains" is ignored`)}}}),dj=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dA(),o=dT(),a=dO();t.default=[r.default,o.default,a.default]}),dI=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uw(),o=u$(),a=uE();t.default={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:t})=>(0,r._)`{unevaluatedProperty: ${t.unevaluatedProperty}}`},code(t){let{gen:i,schema:n,data:s,errsCount:l,it:c}=t;if(!l)throw Error("ajv implementation error");let{allErrors:u,props:d}=c;function p(a){if(!1===n){t.setParams({unevaluatedProperty:a}),t.error(),u||i.break();return}if(!(0,o.alwaysValidSchema)(c,n)){let n=i.name("valid");t.subschema({keyword:"unevaluatedProperties",dataProp:a,dataPropType:o.Type.Str},n),u||i.if((0,r.not)(n),()=>i.break())}}d instanceof r.Name?i.if((0,r._)`${d} !== true`,()=>i.forIn("key",s,t=>{var o,a;return i.if((o=d,a=t,(0,r._)`!${o} || !${o}[${a}]`),()=>p(t))})):!0!==d&&i.forIn("key",s,t=>void 0===d?p(t):i.if(function(t,o){let a=[];for(let i in t)!0===t[i]&&a.push((0,r._)`${o} !== ${i}`);return(0,r.and)(...a)}(d,t),()=>p(t))),c.props=!0,t.ok((0,r._)`${l} === ${a.default.errors}`)}}}),dN=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uw(),o=u$();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:a,schema:i,data:n,it:s}=t,l=s.items||0;if(!0===l)return;let c=a.const("len",(0,r._)`${n}.length`);if(!1===i)t.setParams({len:l}),t.fail((0,r._)`${c} > ${l}`);else if("object"==typeof i&&!(0,o.alwaysValidSchema)(s,i)){let i=a.var("valid",(0,r._)`${c} <= ${l}`);a.if((0,r.not)(i),()=>{var n,u;return n=i,u=l,void a.forRange("i",u,c,i=>{t.subschema({keyword:"unevaluatedItems",dataProp:i,dataPropType:o.Type.Num},n),s.allErrors||a.if((0,r.not)(n),()=>a.break())})}),t.ok(i)}s.items=!0}}}),dM=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dI(),o=dN();t.default=[r.default,o.default]}),dz=z((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/schema",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format"},{$ref:"meta/content"}],type:["object","boolean"],properties:{definitions:{$comment:"While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},dependencies:{$comment:'"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"',type:"object",additionalProperties:{anyOf:[{$recursiveRef:"#"},{$ref:"meta/validation#/$defs/stringArray"}]}}}}}),dq=z((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:"#"}}}}}),dH=z((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:"#"}}}}),dU=z((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:{}}}}}),dD=z((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/format",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:"Format vocabulary meta-schema",type:["object","boolean"],properties:{format:{type:"string"}}}}),dL=z((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}}}}),dK=z((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:[]}}}}),dJ=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dz(),o=dq(),a=dH(),i=dU(),n=dD(),s=dL(),l=dK(),c=["/properties"];t.default=function(t){return[r,o,a,i,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}}}),dV=z((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=uW(),a=db(),i=dC(),n=dj(),s=dM(),l=dw(),c=dJ(),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(i.default),a.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=uz();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return p.KeywordCxt}});var h=uw();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 f=uq();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return f.default}});var m=uH();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return m.default}})}),dW=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uZ(),o=u8(),a=dy(),i=dC(),n=dj(),s=dM(),l=dv(),c=d_();t.default=[i.default,r.default,o.default,(0,a.default)(!0),l.default,c.metadataVocabulary,c.contentVocabulary,n.default,s.default]}),dF=z((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}}}}),dB=z((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"}}}}}),dZ=z((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"}}}}),dG=z((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"}}}}),dX=z((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"}}}}),dY=z((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"}}}}),dQ=z((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}}}}),d0=z((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:[]}}}}),d1=z(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dF(),o=dB(),a=dZ(),i=dG(),n=dX(),s=dY(),l=dQ(),c=d0(),u=["/properties"];t.default=function(t){return[r,o,a,i,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}}}),d2=z((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=uW(),a=dW(),i=dw(),n=d1(),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(),a.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(i.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=uz();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=uw();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var d=uq();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.default}});var p=uH();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}),d9=z(t=>{function r(t,r){return{validate:t,compare:r}}Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0,t.fullFormats={date:r(i,n),time:r(l(!0),c),"date-time":r(p(!0),h),"iso-time":r(l(),u),"iso-date-time":r(p(),f),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(t){return m.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,f),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},t.formatNames=Object.keys(t.fullFormats);let o=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,a=[0,31,28,31,30,31,30,31,31,30,31,30,31];function i(t){var r;let i=o.exec(t);if(!i)return!1;let n=+i[1],s=+i[2],l=+i[3];return s>=1&&s<=12&&l>=1&&l<=(2===s&&(r=n)%4==0&&(r%100!=0||r%400==0)?29:a[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 a=+o[1],i=+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(a<=23&&i<=59&&n<60)return!0;let p=i-d*c,h=a-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(),a=new Date("2020-01-01T"+r).valueOf();if(o&&a)return o-a}function u(t,r){if(!(t&&r))return;let o=s.exec(t),a=s.exec(r);if(o&&a)return(t=o[1]+o[2]+o[3])>(r=a[1]+a[2]+a[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&&i(o[0])&&r(o[1])}}function h(t,r){if(!(t&&r))return;let o=new Date(t).valueOf(),a=new Date(r).valueOf();if(o&&a)return o-a}function f(t,r){if(!(t&&r))return;let[o,a]=t.split(d),[i,s]=r.split(d),l=n(o,i);if(void 0!==l)return l||c(a,s)}let m=/\/|:/,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/}),d4=z(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;let r=dE(),o=uw(),a=o.operators,i={formatMaximum:{okStr:"<=",ok:a.LTE,fail:a.GT},formatMinimum:{okStr:">=",ok:a.GTE,fail:a.LT},formatExclusiveMaximum:{okStr:"<",ok:a.LT,fail:a.GTE},formatExclusiveMinimum:{okStr:">",ok:a.GT,fail:a.LTE}};t.formatLimitDefinition={keyword:Object.keys(i),type:"string",schemaType:"string",$data:!0,error:{message:({keyword:t,schemaCode:r})=>(0,o.str)`should be ${i[t].okStr} ${r}`,params:({keyword:t,schemaCode:r})=>(0,o._)`{comparison: ${i[t].okStr}, limit: ${r}}`},code(t){let a,n,{gen:s,data:l,schemaCode:c,keyword:u,it:d}=t,{opts:p,self:h}=d;if(!p.validateFormats)return;let f=new r.KeywordCxt(d,h.RULES.all.format.definition,"format");function m(t){return(0,o._)`${t}.compare(${l}, ${c}) ${i[u].fail} 0`}f.$data?(a=s.scopeValue("formats",{ref:h.formats,code:p.code.formats}),n=s.const("fmt",(0,o._)`${a}[${f.schemaCode}]`),t.fail$data((0,o.or)((0,o._)`typeof ${n} != "object"`,(0,o._)`${n} instanceof RegExp`,(0,o._)`typeof ${n}.compare != "function"`,m(n)))):function(){let r=f.schema,a=h.formats[r];if(!a||!0===a)return;if("object"!=typeof a||a instanceof RegExp||"function"!=typeof a.compare)throw Error(`"${u}": format "${r}" does not define "compare" function`);let i=s.scopeValue("formats",{key:r,ref:a,code:p.code.formats?(0,o._)`${p.code.formats}${(0,o.getProperty)(r)}`:void 0});t.fail$data(m(i))}()},dependencies:["format"]},t.default=r=>(r.addKeyword(t.formatLimitDefinition),r)}),d5=z((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});let o=d9(),a=d4(),i=uw(),n=new i.Name("fullFormats"),s=new i.Name("fastFormats"),l=(t,r={keywords:!0})=>{if(Array.isArray(r))return c(t,r,o.fullFormats,n),t;let[i,l]="fast"===r.mode?[o.fastFormats,s]:[o.fullFormats,n];return c(t,r.formats||o.formatNames,i,l),r.keywords&&(0,a.default)(t),t};function c(t,r,o,a){var n;for(let s of(null!=(n=t.opts.code).formats||(n.formats=(0,i._)`require("ajv-formats/dist/formats").${a}`),r))t.addFormat(s,o[s])}l.get=(t,r="full")=>{let a=("fast"===r?o.fastFormats:o.fullFormats)[t];if(!a)throw Error(`Unknown format "${t}"`);return a},r.exports=t=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l}),d3=dE(),d6=dV(),d8=d2();let d7=q(d5(),1).default;function pe(t){let r=new t({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return d7(r),r}var pt=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(t){this._userAjv=void 0!==t,this._ajv=t}get ajv(){return this._ajv??=pe(d8.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(H.has(o))return"2020-12";if(U.has(o))return"2019-09";if(D.has(o)||L.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??=pe(d6.Ajv2019):this._ajvDraft7??=pe(d3.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 pr(t){return(await u).getRandomValues(new Uint8Array(t))}async function po(t){let r="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",o=256-256%r.length,a="";for(;a.length<t;)for(let i of(await pr(t-a.length)))i<o&&(a+=r[i%r.length]);return a}async function pa(t){return await po(t)}async function pi(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 pn(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let r=await pa(t),o=await pi(r);return{code_verifier:r,code_challenge:o}}d3.Ajv,u=globalThis.crypto?.webcrypto??globalThis.crypto??Promise.resolve().then(i.t.bind(i,7598,19)).then(t=>t.webcrypto);class ps 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 pl(t){}function pc(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 pu(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 pd extends TransformStream{constructor({onError:t,onRetry:r,onComment:o,maxBufferSize:a}={}){let i;super({start(n){i=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=pl,onError:o=pl,onRetry:a=pl,onComment:i,maxBufferSize:n}=t,s=[],l=0,c=!0,u,d="",p=0,h,f=!1;function m(){void 0!==n&&(l+d.length<=n||(f=!0,s.length=0,l=0,u=void 0,d="",p=0,h=void 0,o(new ps(`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 a=t.indexOf(`
64
+ `,o);for(;-1!==a;){if(o===a){p>0&&r({id:u,event:h,data:d}),u=void 0,d="",p=0,h=void 0,o=a+1,a=t.indexOf(`
65
+ `,o);continue}let i=t.charCodeAt(o);if(pc(t,o,i)){let i=32===t.charCodeAt(o+5)?o+6:o+5,n=t.slice(i,a);if(0===p&&10===t.charCodeAt(a+1)){r({id:u,event:h,data:n}),u=void 0,d="",h=void 0,o=a+2,a=t.indexOf(`
64
66
  `,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})})();
67
+ ${n}`,p++}else pu(t,o,i)?h=t.slice(32===t.charCodeAt(o+6)?o+7:o+6,a)||void 0:g(t,o,a);o=a+1,a=t.indexOf(`
68
+ `,o)}return t.slice(o)}for(;o<t.length;){let r=t.indexOf("\r",o),a=t.indexOf(`
69
+ `,o),i=-1;if(-1!==r&&-1!==a?i=r<a?r:a:-1!==r?i=r===t.length-1?-1:r:-1!==a&&(i=a),-1===i)break;g(t,o,i),o=i+1,13===t.charCodeAt(o-1)&&10===t.charCodeAt(o)&&o++}return t.slice(o)}function g(t,o,a){if(o===a)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(pc(t,o,n)){let r=32===t.charCodeAt(o+5)?o+6:o+5,i=t.slice(r,a);d=0===p?i:`${d}
70
+ ${i}`,p++;return}if(pu(t,o,n)){h=t.slice(32===t.charCodeAt(o+6)?o+7:o+6,a)||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,a);u=r.includes("\0")?void 0:r;return}if(58===n){i&&i(t.slice(o,a).slice(32===t.charCodeAt(o+1)?2:1));return}let s=t.slice(o,a),l=s.indexOf(":");if(-1===l)return void v(s,"",s);let c=s.slice(0,l),f=32===s.charCodeAt(l+1)?2:1;v(c,s.slice(l+f),s)}function v(t,r,i){switch(t){case"event":h=r||void 0;break;case"data":d=0===p?r:`${d}
71
+ ${r}`,p++;break;case"id":u=r.includes("\0")?void 0:r;break;case"retry":/^\d+$/.test(r)?a(parseInt(r,10)):o(new ps(`Invalid \`retry\` value: "${r}"`,{type:"invalid-retry",value:r,line:i}));break;default:o(new ps(`Unknown field "${t.length>20?`${t.slice(0,20)}\u2026`:t}"`,{type:"unknown-field",field:t,value:r,line:i}))}}return{feed:function(t){if(f)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),m();return}if(-1===t.indexOf(`
72
+ `)&&-1===t.indexOf("\r")){s.push(t),l+=t.length,m();return}s.push(t);let r=s.join("");s.length=0,l=0;let o=y(r);""!==o&&(s.push(o),l=o.length),m()},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,f=!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:a})},transform(t){i.feed(t)}})}}var pp=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](t){return lq(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 lq(this,t)}constructor(t){super(t),this.name=new.target.name,lz(this,new.target)}},ph=class extends pp{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}},pf=class extends pp{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}},pm=class extends pp{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 / *.localhost / 127.0.0.1 / ::1 are exempt).`),this.tokenEndpoint=t}},py=class extends pp{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.AuthorizationServerMismatchError"})}constructor(t,r){super(`Authorization server mismatch: credentials are bound to ${JSON.stringify(t)} but this call resolved ${JSON.stringify(r)}; refusing to present them to a different authorization server`),this.recordedIssuer=t,this.currentIssuer=r}},pg=class extends pp{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 pv(t,r,o){if(t)return"string"!=typeof 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."),void 0===t.issuer?t:{...t,issuer:void 0}):p_(t.issuer,r)?t:void 0}function p_(t,r){return t===r||t.endsWith("/")&&t.slice(0,-1)===r||r.endsWith("/")&&r.slice(0,-1)===t}async function pb(t,r,o){let{resourceMetadataUrl:a,scope:i}=pN(r.response);if(await pT(t,{serverUrl:r.serverUrl,resourceMetadataUrl:a,scope:i,fetchFn:r.fetchFn,...o})!=="AUTHORIZED")throw new pS}var pS=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](t){return lq(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 lq(this,t)}constructor(t){super(t??"Unauthorized"),this.name="UnauthorizedError",lz(this,new.target)}};function pw(t){return t?.authorization_response_iss_parameter_supported===!0}function p$({iss:t,expectedIssuer:r,issParameterSupported:o}){if(void 0!==r){if(void 0===t){if(o)throw new ph("authorization_response",r,void 0);return}if(t!==r)throw new ph("authorization_response",r,t)}}function pE(...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 pP(t,r,o,a,i){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 pL(a,i)).authorizationServerMetadata}catch{l=void 0}if(!l)throw new pS("Authorization callback failed and the issuer could not be verified");p$({iss:n,expectedIssuer:l.issuer,issParameterSupported:pw(l)});let c=t.get("error");if(c)throw new lU(c,t.get("error_description")??c,t.get("error_uri")??void 0);throw new pS("Authorization callback contained neither `code` nor `error`")}let pk="code",pR="S256";function px(t){return"localhost"===t||t.endsWith(".localhost")||"127.0.0.1"===t||"[::1]"===t||"::1"===t}async function pC(t){let r=t instanceof Response?t.status:void 0,o=t instanceof Response?await t.text():t;try{let t=lC.parse(JSON.parse(o));return lU.fromResponse(t)}catch(a){let t=`${r?`HTTP ${r}: `:""}Invalid OAuth error response: ${a}. Raw body: ${o}`;return new lU(lH.ServerError,t)}}function pA(t,r,o){let a=void 0===t.invalidateCredentials?`retrying authorization without discarding the stored ${o} (provider implements no invalidateCredentials())`:`invalidating the stored ${o} and retrying authorization`;console.warn(`[mcp-sdk] OAuth ${JSON.stringify(r.code)} — ${a}. Cause: ${JSON.stringify(r.message)}`)}async function pT(t,r){try{return await pO(t,r)}catch(o){if(o instanceof lU){if(o.code===lH.InvalidClient||o.code===lH.UnauthorizedClient)return pA(t,o,"client credentials and tokens"),await t.invalidateCredentials?.("client"),await t.invalidateCredentials?.("tokens"),await pO(t,r);else if(o.code===lH.InvalidGrant||o.code===lH.InvalidDpopProof)return pA(t,o,"tokens"),await t.invalidateCredentials?.("tokens"),await pO(t,r)}throw o}}async function pO(t,{serverUrl:r,authorizationCode:o,iss:a,scope:i,resourceMetadataUrl:n,fetchFn:s,skipIssuerMetadataValidation:l,forceReauthorization:c}){var u;let d,p,h,f,m,y={...m=(u=t).clientMetadata,grant_types:m.grant_types??(void 0===u.redirectUrl?void 0:["authorization_code","refresh_token"]),application_type:m.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||px(t.hostname))return"native"}return"web"}(m.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 pD(p,{fetchFn:s,skipIssuerValidation:l}),!d)try{d=await pz(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 pL(r,{resourceMetadataUrl:v,fetchFn:s,skipIssuerMetadataValidation:l});p=t.authorizationServerUrl,h=t.authorizationServerMetadata,d=t.resourceMetadata,f={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 py("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(!p_(r,_))throw new py(r,_)}f&&await t.saveDiscoveryState?.(f);let S=await pj(r,t,d),w=S&&d&&!t.validateResourceURL?d.resource:S;w&&await t.saveResourceUrl?.(pK(w));let $=function(t){let{requestedScope:r,resourceMetadata:o,authServerMetadata:a,clientMetadata:i}=t,n=r||o?.scopes_supported?.join(" ")||i.scope;return n&&a?.scopes_supported?.includes("offline_access")&&!n.split(" ").includes("offline_access")&&i.grant_types?.includes("refresh_token")&&(n=`${n} offline_access`),n}({requestedScope:i,resourceMetadata:d,authServerMetadata:h,clientMetadata:t.clientMetadata}),E=await Promise.resolve(t.clientInformation(b)),P=pv(E,_,{canPersistStamp:void 0!==t.saveClientInformation});if(void 0===P&&E?.issuer&&void 0===t.saveClientInformation)throw new py(E.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,a=t.clientMetadataUrl;if(a&&!function(t){if(!t)return!1;try{let r=new URL(t);return"https:"===r.protocol&&"/"!==r.pathname}catch{return!1}}(a))throw new lU(lH.InvalidClientMetadata,`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${a}`);if(r&&a)P={client_id:a,issuer:_},await t.saveClientInformation?.(P,b);else{if(!t.saveClientInformation)throw Error("OAuth client information must be saveable for dynamic registration");P={...await pB(p,{metadata:h,clientMetadata:y,scope:$,fetchFn:s}),issuer:_},await t.saveClientInformation(P,b)}}let k=!t.redirectUrl;if(void 0!==o||k){void 0!==o&&p$({iss:a,expectedIssuer:h?.issuer,issParameterSupported:pw(h)});let r=await pF(t,p,{metadata:h,resource:w,authorizationCode:o,iss:a,scope:$,fetchFn:s});return await t.saveTokens({...r,issuer:_},b),"AUTHORIZED"}let R=pv(await t.tokens(b),_);if(R&&void 0===R.issuer&&(R={...R,issuer:_},await t.saveTokens(R,b)),R?.refresh_token&&!c){let r;try{r=await pW(p,{metadata:h,clientInformation:P,refreshToken:R.refresh_token,resource:w,addClientAuthentication:t.addClientAuthentication,dpop:await t.dpop?.(),fetchFn:s})}catch(t){if(t instanceof pm||t instanceof lU&&t.code!==lH.ServerError)throw t;console.warn(`[mcp-sdk] Could not refresh OAuth tokens; falling back to a new authorization request. Cause: ${JSON.stringify(t instanceof Error?t.message:String(t))}`)}if(r)return await t.saveTokens({...r,issuer:_},b),"AUTHORIZED"}let x=t.state?await t.state():void 0,{authorizationUrl:C,codeVerifier:A}=await pJ(p,{metadata:h,clientInformation:P,state:x,redirectUrl:t.redirectUrl,scope:$,resource:w});return await t.saveCodeVerifier(A),await t.redirectToAuthorization(C),"REDIRECT"}async function pj(t,r,o){var a;let i,n=((i=new URL("string"==typeof(a=t)?a:a.href)).hash="",i);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),a=new URL("string"==typeof r?r:r.href);if(o.origin!==a.origin||o.pathname.length<a.pathname.length)return!1;let i=o.pathname.endsWith("/")?o.pathname:o.pathname+"/",n=a.pathname.endsWith("/")?a.pathname:a.pathname+"/";return i.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)}}let pI=new Set(["bearer","dpop"]);function pN(t){let r,o=t.headers.get("WWW-Authenticate");if(!o)return{};let[a,i]=o.split(" ");if(!a||!pI.has(a.toLowerCase())||!i)return{};let n=pM(t,"resource_metadata")||void 0;if(n)try{r=new URL(n)}catch{}let s=pM(t,"scope")||void 0,l=pM(t,"error")||void 0;return{resourceMetadataUrl:r,scope:s,error:l,errorDescription:pM(t,"error_description")||void 0}}function pM(t,r){let o=t.headers.get("WWW-Authenticate");if(!o)return null;let a=new RegExp(String.raw`${r}=(?:"([^"]+)"|([^\s,]+))`),i=o.match(a);if(i){let t=i[1]||i[2];if(t)return t}return null}async function pz(t,r,o=fetch){let a=await pU(t,"oauth-protected-resource",o,{protocolVersion:r?.protocolVersion,metadataUrl:r?.resourceMetadataUrl});if(!a||404===a.status)throw await a?.text?.().catch(()=>{}),Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!a.ok)throw await a.text?.().catch(()=>{}),Error(`HTTP ${a.status} trying to load well-known OAuth protected resource metadata.`);return l$.parse(await a.json())}async function pq(t,r,o=fetch){let a=u_(o);try{return await a(t,{headers:r})}catch(t){throw t}}async function pH(t,r,o=fetch){return await pq(t,{"MCP-Protocol-Version":r},o)}async function pU(t,r,o,a){var i,n;let s,l=new URL(t),c=a?.protocolVersion??iU;a?.metadataUrl?s=new URL(a.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),a?.metadataServerUrl??l)).search=l.search;let u=await pH(s,c,o);return a?.metadataUrl||(i=u,n=l.pathname,i&&("/"===n||(i.ok||!(i.status<500))&&502!==i.status))||(u=await pH(new URL(`/.well-known/${r}`,l),c,o)),u}async function pD(t,{fetchFn:r=fetch,protocolVersion:o=iU,skipIssuerValidation:a=!1}={}){let i={"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,a=[];if(!o)return a.push({url:new URL("/.well-known/oauth-authorization-server",r.origin),type:"oauth"},{url:new URL("/.well-known/openid-configuration",r.origin),type:"oidc"}),a;let i=r.pathname;return i.endsWith("/")&&(i=i.slice(0,-1)),a.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,r.origin),type:"oauth"},{url:new URL(`/.well-known/openid-configuration${i}`,r.origin),type:"oidc"},{url:new URL(`${i}/.well-known/openid-configuration`,r.origin),type:"oidc"}),a}(t)){let s=await pq(o,i,r);if(!s)continue;if(!s.ok){if(await s.text?.().catch(()=>{}),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?lE.parse(await s.json()):lk.parse(await s.json());if(!a){let r="string"==typeof t?t:t.href;if(!(l.issuer===r||r.endsWith("/")&&l.issuer===r.slice(0,-1)))throw new ph("metadata",r,l.issuer)}return l}}async function pL(t,r){let o,a;try{(o=await pz(t,{resourceMetadataUrl:r?.resourceMetadataUrl},r?.fetchFn)).authorization_servers&&o.authorization_servers.length>0&&(a=o.authorization_servers[0])}catch(t){if(t instanceof TypeError)throw t}a||(a=String(new URL("/",t)));let i=await pD(a,{fetchFn:r?.fetchFn,skipIssuerValidation:r?.skipIssuerMetadataValidation});return{authorizationServerUrl:a,authorizationServerMetadata:i,resourceMetadata:o}}function pK(t){return"string"==typeof t?t:t.href}async function pJ(t,{metadata:r,clientInformation:o,redirectUrl:a,scope:i,state:n,resource:s}){let l;if(r){if(l=new URL(r.authorization_endpoint),!r.response_types_supported.includes(pk))throw Error(`Incompatible auth server: does not support response type ${pk}`);if(r.code_challenge_methods_supported&&!r.code_challenge_methods_supported.includes(pR))throw Error(`Incompatible auth server: does not support code challenge method ${pR}`)}else l=new URL("/authorize",t);let c=await pn(),u=c.code_verifier,d=c.code_challenge;return l.searchParams.set("response_type",pk),l.searchParams.set("client_id",o.client_id),l.searchParams.set("code_challenge",d),l.searchParams.set("code_challenge_method",pR),l.searchParams.set("redirect_uri",String(a)),n&&l.searchParams.set("state",n),i&&l.searchParams.set("scope",i),i?.split(" ").includes("offline_access")&&l.searchParams.append("prompt","consent"),s&&l.searchParams.set("resource",pK(s)),{authorizationUrl:l,codeVerifier:u}}async function pV(t,{metadata:r,tokenRequestParams:o,clientInformation:a,addClientAuthentication:i,resource:n,dpop:s,fetchFn:l}){var c,u;let d,p=function(t){let r=new URL(String(t));if("https:"!==r.protocol&&!px(r.hostname))throw new pm(r.href);return r}(r?.token_endpoint??new URL("/token",t)),h=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});n&&o.set("resource",pK(n)),!i&&a&&function(t,r,o,a){let{client_id:i,client_secret:n}=r;switch(t){case"client_secret_basic":var s,l,c,u,d=i,p=n,h=o;if(!p)throw Error("client_secret_basic authentication requires a client_secret");let f=btoa(`${d}:${p}`);h.set("Authorization",`Basic ${f}`);return;case"client_secret_post":s=i,l=n,(c=a).set("client_id",s),l&&c.set("client_secret",l);return;case"none":u=i,a.set("client_id",u);return;default:throw Error(`Unsupported client authentication method: ${t}`)}}((c=a,u=r?.token_endpoint_auth_methods_supported??[],d=void 0!==c.client_secret,"token_endpoint_auth_method"in c&&c.token_endpoint_auth_method&&["client_secret_basic","client_secret_post","none"].includes(c.token_endpoint_auth_method)&&(0===u.length||u.includes(c.token_endpoint_auth_method))?c.token_endpoint_auth_method:0===u.length?d?"client_secret_basic":"none":d&&u.includes("client_secret_basic")?"client_secret_basic":d&&u.includes("client_secret_post")?"client_secret_post":u.includes("none")?"none":d?"client_secret_post":"none"),a,h,o);let f=async()=>{let t=new Headers(h);return i&&await i(t,o,p,r),s&&t.set("DPoP",await s.buildProof({htm:"POST",htu:p})),u_(l??fetch)(p,{method:"POST",headers:t,body:o})},m=await f();if(s&&400===m.status&&(await m.clone().json().catch(()=>{}))?.error===lH.UseDpopNonce&&(s.observeNonce(m,p),m=await f()),s?.observeNonce(m,p),!m.ok)throw await pC(m);let y=await m.json();try{return lR.parse(lJ(y))}catch(t){if("object"==typeof y&&null!==y&&"error"in y)throw await pC(JSON.stringify(y));throw t}}async function pW(t,{metadata:r,clientInformation:o,refreshToken:a,resource:i,addClientAuthentication:n,dpop:s,fetchFn:l}){return{refresh_token:a,...await pV(t,{metadata:r,tokenRequestParams:new URLSearchParams({grant_type:"refresh_token",refresh_token:a}),clientInformation:o,addClientAuthentication:n,resource:i,dpop:s,fetchFn:l})}}async function pF(t,r,{metadata:o,resource:a,authorizationCode:i,iss:n,scope:s,fetchFn:l}={}){let c;void 0!==i&&p$({iss:n,expectedIssuer:o?.issuer,issParameterSupported:pw(o)});let u=o?.issuer??String(r),d=async()=>{let r=await t.clientInformation({issuer:u}),o=pv(r,u,{canPersistStamp:!1});if(r&&void 0===o)throw new py(String(r.issuer),u);return o},p=await d(),h=s??t.clientMetadata.scope;if(t.prepareTokenRequest&&(c=await t.prepareTokenRequest(h)),!c){var f,m;if(!i)throw Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!t.redirectUrl)throw Error("redirectUrl is required for authorization_code flow");f=i,m=await t.codeVerifier(),c=new URLSearchParams({grant_type:"authorization_code",code:f,code_verifier:m,redirect_uri:String(t.redirectUrl)})}return pV(r,{metadata:o,tokenRequestParams:c,clientInformation:p??=await d(),addClientAuthentication:t.addClientAuthentication,resource:a,dpop:await t.dpop?.(),fetchFn:l})}async function pB(t,{metadata:r,clientMetadata:o,scope:a,fetchFn:i}){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===a?{}:{scope:a}},l=await u_(i??fetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!l.ok)throw new pf({status:l.status,body:await l.text(),submittedMetadata:s});return lj.parse(lJ(await l.json()))}let pZ=new Set(["tools/list","prompts/list","resources/list","resources/templates/list","server/discover"]);var pG=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(pX(t))}set(t,r){let o=pX(t),a=pZ.has(t.method),i=!this._entries.has(o);if(!a&&i&&this._maxEntries>0&&this._cappedSize>=this._maxEntries){for(let t of this._entries.keys())if(!pZ.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}),i&&!a&&this._cappedSize++,n}delete(t){this._entries.delete(pX(t))&&!pZ.has(t.method)&&this._cappedSize--}evict(t){let r=`${t}\0`,o=pZ.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 pX(t){return`${t.method}\0${JSON.stringify([t.partition??"",t.params??""])}`}function pY(t,r){return void 0===r?t:`${t}\0${r}`}var pQ=class{_evictionGeneration=new Map;_toolIndex;_toolOutputValidatorIndex;_serverIdentity="";constructor(t,r,o=()=>{},a="",i=Date.now){this._store=t,this._isUserSupplied=r,this._reportError=o,this._cachePartition=a,this._now=i}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??""},a=this._partitionFor("private"),i=await this._store.get({...o,partition:a});if(void 0!==i)return i;let n=this._partitionFor("public");if(n===a)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"),a=this._partitionFor("public");try{await this._store.delete({method:t,params:r,partition:o})}catch(t){this._reportError(t)}if(a!==o)try{await this._store.delete({method:t,params:r,partition:a})}catch(t){this._reportError(t)}}async evictKey(t,r){let o=pY(t,r),a=this._evictionGeneration.get(o);void 0!==a&&this._evictionGeneration.set(o,a+1),await this._deleteBoth(t,r)}captureGeneration(t,r){let o=pY(t,r),a=this._evictionGeneration.get(o)??0;return this._evictionGeneration.set(o,a),a}async write(t,r,o,a){if((this._evictionGeneration.get(pY(t,a?.params))??0)!==o)return;let i=a?.params??"",n=this._partitionFor("private"),s=this._partitionFor("public"),l=(a?.scope??"private")==="public"?s:n;try{await this._store.set({method:t,params:i,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:a?.expiresAt,scope:a?.scope})}catch(t){this._reportError(t)}if(s!==n)try{await this._store.delete({method:t,params:i,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:[]},a=new Map;for(let o of t.tools){let t=r(o);void 0!==t&&a.set(o.name,t)}this._toolOutputValidatorIndex={stamp:o.stamp,byName:a}}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 p0=Symbol.for("mcp.authSeamEscape");function p1(t){if("object"==typeof t&&null!==t||"function"==typeof t)try{Object.defineProperty(t,p0,{value:!0,configurable:!0})}catch{}return t}let p2=new Set([-32001,-32020,-32021]);function p9(t,r){let{code:o,message:a,data:i}=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}(i);if(void 0===t)return{kind:"legacy"};let o=new ch({supported:t,requested:function(t){if("object"!=typeof t||null===t)return;let r=t.requested;return"string"==typeof r?r:void 0}(i)??r.requestedVersion},a),n=lB(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 p2.has(o),{kind:"legacy"}}function p4(t,r){var o;return"browser"===r.environment&&((o=t)instanceof TypeError||o instanceof Error&&"TypeError"===o.name)?{kind:"legacy"}:{kind:"error",error:new lL(lD.EraNegotiationFailed,`Version negotiation probe failed: ${p5(t)}`,{cause:t},{cause:t})}}function p5(t){return t instanceof Error?t.message:String(t)}function p3(){let t=globalThis;return void 0!==t.window&&void 0!==t.document?"browser":"node"}function p6(t){return"stderr"in t&&"pid"in t?"stdio":"http"}var p8=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&&(cz(t)||cq(t))&&t.id===r.id){o._pending=void 0,cz(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(a=>{let i=!1,n=t=>{i||(i=!0,clearTimeout(s),this._pending?.id===o&&(this._pending=void 0),a(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,a=()=>{if(!o){o=!0;return}t()};r.onclose=a,p7.set(r,()=>{r.onclose===a&&(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 p7=new WeakMap;function he(t){let r=p7.get(t);p7.delete(t),r?.()}async function ht(t,r){let o,a=t.probe.timeoutMs??r.defaultTimeoutMs,i=Math.max(0,t.probe.maxRetries??0),n="pin"===t.kind?[t.version]:t.modernVersions,s="auto"===t.kind&&t.fallbackAvailable,l=await p8.open(r.transport),c=async()=>{let o=n[0],c=!1,u=i;for(;;){let i=await l.exchange(t=>{var a,i,n,s;return a=t,i=o,n=r.clientInfo,s=r.capabilities,{jsonrpc:"2.0",id:a,method:"server/discover",params:{_meta:cA(i).outboundEnvelope({protocolVersion:i,clientInfo:n,clientCapabilities:s})}}},a);if("timeout"===i.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,a;let r=t.error;if(("object"==typeof(o=r)&&null!==o||"function"==typeof o)&&!0===o[p0]||r instanceof pS||r instanceof Error&&"UnauthorizedError"===r.name)return{kind:"auth-required",error:r};if(r instanceof lK){let t=r.data?.text;return{kind:"http-error",status:r.data.status,body:"string"==typeof t?t:void 0,statusText:r.data.statusText}}if((a=r)instanceof lL&&a.code===lD.ClientHttpUnexpectedContent||a instanceof Error&&"SyntaxError"===a.name)return{kind:"unusable-reply",error:r};return{kind:"network-error",error:r}}case"closed":return{kind:"closed"};case"timeout":return{kind:"timeout",timeoutMs:r}}}(i,a),p=function(t,r){switch(t.kind){case"result":return function(t,r){let o=cA(cC).validateResult("server/discover",t);if(!o.ok)return{kind:"legacy"};let a=o.value.supportedVersions,i=r.clientModernVersions.find(t=>a.includes(t));return void 0!==i?{kind:"modern",version:i,discover:o.value}:r.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:new ch({supported:[...a],requested:r.requestedVersion})}}(t.result,r);case"rpc-error":return p9(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 lK(r?lD.ClientHttpForbidden:lD.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 lK(lD.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:a,message:i,data:n}=o;if("number"==typeof a)return{code:a,message:"string"==typeof i?i:"",data:n}}(t.body);return void 0!==o?p9(o,r):{kind:"legacy"}}(t,r);case"network-error":return p4(t.error,r);case"unusable-reply":return{kind:"error",error:new lL(lD.EraNegotiationFailed,`Version negotiation probe failed: the server answered with an unusable reply (${p5(t.error)})`,{cause:t.error},{cause:t.error})};case"auth-required":return{kind:"error",error:t.error};case"closed":if("stdio"===r.transportKind)return{kind:"legacy"};return p4(Error("Connection closed during the version negotiation probe"),r);case"timeout":if("stdio"===r.transportKind)return{kind:"legacy"};return{kind:"error",error:new lL(lD.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 lL(lD.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 lL(lD.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 lL(lD.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 hr(t,r,o,a){let i,n,s=new r.constructor({...o,stderr:"ignore"}),l=r.close,c=!1,u=new Promise((t,r)=>{i=()=>r(ho())});r.close=async function(){return c=!0,i?.(),l.call(r)};try{let r=ht(t,{...a,transport:s,transportKind:"stdio",disposableProbe:!0});r.catch(()=>{}),n=await Promise.race([r,u])}finally{await ha(s),r.close=l}if(c)throw ho();return n}function ho(){return new lL(lD.EraNegotiationFailed,"Version negotiation failed: the transport was closed during the server/discover probe")}async function ha(t){try{let r=t._dispose;await ("function"==typeof r?r.call(t):t.close())}catch{}}function hi(t){let r=t._meta?.[iJ];return ur.Implementation(r)?r:void 0}let hn={"notifications/tools/list_changed":["tools/list"],"notifications/prompts/list_changed":["prompts/list"],"notifications/resources/list_changed":["resources/list","resources/templates/list"]};var hs=class extends ul{_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 lL(lD.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 pt,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 pQ(r?.responseCacheStore??new pG,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>=lV&&(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,a){let{codec:i,request:n,options:s,flowStartedAt:l}=a,c={inputRequests:o.inputRequests,...void 0!==o.requestState&&{requestState:o.requestState}};return c8({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,a)=>up(t,i,r,o,a),retry:(t,r)=>{var o,i;return a.retry(t,(o=s,i=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!==i.timeout&&{timeout:i.timeout},...void 0!==i.maxTotalTimeout&&{maxTotalTimeout:i.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 lL(lD.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 a=r[t];if(void 0===a)continue;let i=o[t];o[t]=uc(i)&&uc(a)?{...i,...a}:a}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 a=cA(this._negotiatedProtocolVersion),i=a.validateRequest("elicitation/create",t);if(i.ok||"not-in-era"!==i.reason||(i=a.validateInputRequest("elicitation/create",t)),!i.ok)throw new cu("not-in-era"===i.reason?cc.InternalError:cc.InvalidParams,"not-in-era"===i.reason?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation request: ${i.message}`);let{params:n}=i.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 cu(cc.InvalidParams,"Client does not support form-mode elicitation requests");if("url"===n.mode&&!l)throw new cu(cc.InvalidParams,"Client does not support URL-mode elicitation requests");let c=await r(t,o),u=a.validateResult("elicitation/create",c);if(u.ok||"not-in-era"!==u.reason||(u=a.validateInputResponse("elicitation/create",c)),!u.ok)throw new cu("not-in-era"===u.reason?cc.InternalError:cc.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 a=r.properties;for(let r of Object.keys(a)){let i=a[r];void 0===o[r]&&Object.prototype.hasOwnProperty.call(i,"default")&&(o[r]=i.default),void 0!==o[r]&&t(i,o[r])}}if(Array.isArray(r.anyOf))for(let a of r.anyOf)"boolean"!=typeof a&&t(a,o);if(Array.isArray(r.oneOf))for(let a of r.oneOf)"boolean"!=typeof a&&t(a,o)}}(p,d.content)}catch{}return d}:"sampling/createMessage"===t?async(t,o)=>{let a=cA(this._negotiatedProtocolVersion),i=a.validateRequest("sampling/createMessage",t);if(i.ok||"not-in-era"!==i.reason||(i=a.validateInputRequest("sampling/createMessage",t)),!i.ok)throw new cu("not-in-era"===i.reason?cc.InternalError:cc.InvalidParams,"not-in-era"===i.reason?"No wire schema for sampling/createMessage in the resolved era":`Invalid sampling request: ${i.message}`);let{params:n}=i.value,s=await r(t,o),l=!!(n.tools||n.toolChoice),c=a.samplingResultVariant(l,s);if(c.ok||"not-in-era"!==c.reason||(c=a.validateInputResponse("sampling/createMessage",s)),!c.ok)throw new cu("not-in-era"===c.reason?cc.InternalError:cc.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 lL(lD.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&&nE.safeParse(t.discover).success))return t;throw new lL(lD.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 a=t?.probe??{};if("object"==typeof o){if(!(o.pin>=lV))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:a}}let i=r?lB(r):[];return{kind:"auto",modernVersions:i.length>0?i:[...lW],fallbackAvailable:!r||lF(r).length>0,probe:a}}(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=lF(this._supportedProtocolVersions);try{let a=o[0];if(void 0===a)throw new lL(lD.EraNegotiationFailed,"Cannot run the initialize handshake: supportedProtocolVersions contains no pre-2026-07-28 protocol version");let i=await this.request({method:"initialize",params:{protocolVersion:a,capabilities:this._capabilities,clientInfo:this._clientInfo}},r);if(void 0===i)throw Error(`Server sent invalid initialize result: ${i}`);if(!o.includes(i.protocolVersion))throw Error(`Server's protocol version is not supported: ${i.protocolVersion}`);this._serverCapabilities=i.capabilities,this._serverVersion=i.serverInfo,this._cache.setServerIdentity(this._deriveServerIdentity(t)),t.setProtocolVersion&&t.setProtocolVersion(i.protocolVersion),this._instructions=i.instructions,await this.notification({method:"notifications/initialized"}),this._negotiatedProtocolVersion=i.protocolVersion,this._listChangedConfig&&this._setupListChangedHandlers(this._listChangedConfig)}catch(t){throw this.close(),t}}async _connectNegotiated(t,r,o){let a;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 i=p6(t),n={clientInfo:this._clientInfo,capabilities:this._capabilities,environment:p3(),defaultTimeoutMs:o?.timeout??6e4},s="stdio"===i?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;a=void 0===s?await ht(r,{...n,transport:t,transportKind:i}):await hr(r,t,s,n)}catch(r){throw await t.close().catch(()=>{}),he(t),r}if(he(t),await super.connect(t),"legacy"===a.era)return void await this._legacyHandshake(t,o);if(this._serverCapabilities=a.discover.capabilities,this._serverVersion=hi(a.discover),this._cache.setServerIdentity(this._deriveServerIdentity(t)),this._instructions=a.discover.instructions,this._discoverResult=a.discover,this._negotiatedProtocolVersion=a.version,t.setProtocolVersion&&t.setProtocolVersion(a.version),this._listChangedConfig){let t=this._listChangedConfig,r=this._serverCapabilities,a={...t.tools&&r?.tools?.listChanged&&{tools:t.tools},...t.prompts&&r?.prompts?.listChanged&&{prompts:t.prompts},...t.resources&&r?.resources?.listChanged&&{resources:t.resources}},i=!0;try{this._setupListChangedHandlers(a)}catch(t){i=!1,this.onerror?.(t instanceof Error?t:Error(String(t)))}let n=i?{...a.tools&&{toolsListChanged:!0},...a.prompts&&{promptsListChanged:!0},...a.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 a=r.discover;this._resetConnectionState();let i=this._supportedProtocolVersionsOption,n=(i&&lB(i).length>0?lB(i):lW).find(t=>a.supportedVersions.includes(t));if(void 0===n)throw new lL(lD.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=a,this._serverCapabilities=a.capabilities,this._serverVersion=hi(a),this._cache.setServerIdentity(this._deriveServerIdentity(t)),this._instructions=a.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>=lV?"modern":"legacy"}getInstructions(){return this._instructions}getDiscoverResult(){return this._discoverResult}assertCapabilityForMethod(t){switch(t){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new lL(lD.CapabilityNotSupported,`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new lL(lD.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 lL(lD.CapabilityNotSupported,`Server does not support resources (required for ${t})`);if("resources/subscribe"===t&&!this._serverCapabilities.resources.subscribe)throw new lL(lD.CapabilityNotSupported,`Server does not support resource subscriptions (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new lL(lD.CapabilityNotSupported,`Server does not support tools (required for ${t})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new lL(lD.CapabilityNotSupported,`Server does not support completions (required for ${t})`)}}assertNotificationCapability(t){if("notifications/roots/list_changed"===t&&!this._capabilities.roots?.listChanged)throw new lL(lD.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 lL(lD.CapabilityNotSupported,`Client does not support sampling capability (required for ${t})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new lL(lD.CapabilityNotSupported,`Client does not support elicitation capability (required for ${t})`);break;case"roots/list":if(!this._capabilities.roots)throw new lL(lD.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"},nE,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=>t.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=>t.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=>t.resourceTemplates)}async _listAllPages(t,r,o,a,i){let n=o?.cacheMode==="bypass",s=this._cache.captureGeneration(t),l=await this.request({method:t,...r&&{params:{...r}}},o),c=l.nextCursor,u=l,d=1;for(;void 0!==c;){if(0!==this._listMaxPages&&d>=this._listMaxPages)throw new lL(lD.ListPaginationExceeded,`${t}: exceeded listMaxPages (${this._listMaxPages}); server pagination did not terminate`,{method:t,listMaxPages:this._listMaxPages});let i=await this.request({method:t,params:{...r,cursor:c}},o);if(i.nextCursor===c&&JSON.stringify(a(i))===JSON.stringify(a(u)))break;a(l).push(...a(i)),u=i,c=i.nextCursor,d++}return delete l.nextCursor,i?.(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,a="public"===t.cacheScope?"public":"private";return{expiresAt:this._cache.now()+Math.min(Math.max(0,o),864e5),scope:a,params:r}}async _serveFromCache(t,r,o){if(o?.cacheMode==="bypass"||o?.cacheMode==="refresh")return;let a=await this._cache.read(t,r).catch(t=>void this._reportStoreError(t));if(void 0!==a){if(o?.signal?.aborted){let t=o.signal.reason;throw t instanceof lL?t:new lL(lD.RequestTimeout,String(t))}return a.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:cK(o.inputSchema)}async readResource(t,r){let o=await this._serveFromCache("resources/read",t.uri,r);if(void 0!==o)return o;let a=this._cache.captureGeneration("resources/read",t.uri),i=await this.request({method:"resources/read",params:t},r);if(r?.cacheMode!=="bypass"){let o=this._freshness(i,t.uri);o.expiresAt>this._cache.now()?await this._cache.write("resources/read",i,a,o):r?.cacheMode==="refresh"&&await this._cache.evictKey("resources/read",t.uri)}return i}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,a,i,n,s;if(void 0===this.transport)throw new lL(lD.NotConnected,"Not connected");let l=this._negotiatedProtocolVersion;if(void 0===l||!(l>=lV))throw new lL(lD.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 lL?t:new lL(lD.RequestTimeout,String(t))}let c=new AbortController,u=`listen:${this._nextListenId++}`,d="opening",p=new Promise((t,r)=>{i=t,n=r}),h=new Promise(t=>{s=t}),f=t=>{if("closed"===d)return;let l="opening"===d;if(void 0!==o&&(clearTimeout(o),o=void 0),"ack"in t){d="open",i(t.ack);return}d="closed",void 0!==a&&r?.signal?.removeEventListener("abort",a),this._listenState.delete(u),c.abort(),s(t.cause),l&&n(t.error??new lL(lD.ConnectionClosed,"subscriptions/listen closed before the server acknowledged"))},m=async()=>{c.abort(),await this.notification({method:"notifications/cancelled",params:{requestId:u}}).catch(()=>{})},y=async()=>{"closed"!==d&&(f({cause:"local"}),await m())};this._listenState.set(u,{settle:f});let g=r?.timeout??6e4;if(o=setTimeout(()=>{f({cause:"remote",error:new lL(lD.RequestTimeout,"subscriptions/listen ack timed out",{timeout:g})}),m().catch(()=>{})},g),r?.signal){let t=r.signal;a=()=>{if("closed"===d)return;let r=t.reason;f({cause:"local",error:r instanceof Error?r:Error(String(r??"Aborted"))}),m().catch(()=>{})},t.addEventListener("abort",a,{once:!0})}let v={jsonrpc:"2.0",id:u,method:"subscriptions/listen",params:{_meta:{...this._outboundMetaEnvelope()},notifications:t}},_=t=>{f({cause:"remote",error:t instanceof Error?t:Error(String(t))})};try{this.transport.send(v,{requestSignal:c.signal,onRequestStreamEnd:()=>f({cause:"remote",error:Error("subscriptions/listen: stream ended")})}).catch(_)}catch(t){_(t)}return{honoredFilter:await p,close:y,closed:h}}get autoOpenedSubscription(){return this._autoOpenedSubscription}_onnotification(t,r){let o=Object.hasOwn(hn,t.method)?hn[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?.[iW],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?cq(t)?o.settle({cause:"remote",error:cu.fromError(t.error.code,t.error.message,t.error.data)}):o.settle({cause:"graceful",error:new lL(lD.ConnectionClosed,"subscriptions/listen: server closed the subscription gracefully before acknowledging")}):super._onresponse(t)}_onclose(){if(this._listenState.size>0){let t=new lL(lD.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,a="modern"===this.getProtocolEra()&&"browser"!==p3(),i=async()=>{let o;if(!a)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 i=function(t,r){let o={};for(let a 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,a.path);if(null==t)continue;let i=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!==i&&(o[`Mcp-Param-${a.headerName}`]=cB(i))}return o}(o.declarations,t.arguments);return 0===Object.keys(i).length?r:{...r,headers:{...r?.headers,...i}}},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 cu(cc.InvalidParams,`Tool '${t.name}' has an invalid outputSchema: ${o}`)};s();try{o=await this.request({method:"tools/call",params:t},await i())}catch(u){let l=u instanceof cu&&-32020===u.code;if(!a||!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 i())}let l=void 0!==n&&n.ok?n.validator:void 0;if(l){if(void 0===o.structuredContent&&!o.isError)throw new cu(cc.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 cu(cc.InvalidParams,`Structured content does not match the tool's output schema: ${t.errorMessage}`)}catch(t){if(t instanceof cu)throw t;throw new cu(cc.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=>t.tools,t=>this._excludeInvalidXMcpHeaderTools(t))}_excludeInvalidXMcpHeaderTools(t){if("modern"!==this.getProtocolEra()||!this.transport||"stdio"===p6(this.transport))return;let r=t.tools.filter(t=>{let r=cK(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,a){let i=ah(sS,o);if(!i.success)throw Error(`Invalid ${t} listChanged options: ${i.error.message}`);if("function"!=typeof o.onChanged)throw TypeError(`Invalid ${t} listChanged options: onChanged must be a function`);let{autoRefresh:n,debounceMs:s}=i.data,{onChanged:l}=o,c=async()=>{if(!n)return void l(null,null);try{l(null,await a())}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"})}};async function hl(){if(void 0===globalThis.crypto)throw TypeError("crypto is not available, please ensure you have Web Crypto API support for older Node.js versions (see https://github.com/modelcontextprotocol/typescript-sdk#nodejs-web-crypto-globalthiscrypto-compatibility)");return Promise.resolve().then(i.bind(i,8775))}async function hc(t={}){let r=t.alg??"ES256",o=await hl(),{publicKey:a,privateKey:i}=await o.generateKeyPair(r,{extractable:t.extractable??!1}),n=await o.exportJWK(a);return{privateKey:i,publicKey:a,publicJwk:n,thumbprint:await o.calculateJwkThumbprint(n,"sha256"),alg:r}}async function hu(t){if(globalThis.crypto?.subtle===void 0)throw TypeError("crypto.subtle is not available, please ensure you have Web Crypto API support for older Node.js versions (see https://github.com/modelcontextprotocol/typescript-sdk#nodejs-web-crypto-globalthiscrypto-compatibility)");return hd(new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256",new TextEncoder().encode(t))))}function hd(t){let r="";for(let o of t)r+=String.fromCodePoint(o);return btoa(r).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}(class t{nonces=new Map;constructor(t){this.keyPair=t}static async create(r={}){return new t(r.keyPair??await hc({alg:r.alg}))}get thumbprint(){return this.keyPair.thumbprint}get alg(){return this.keyPair.alg}get publicJwk(){return this.keyPair.publicJwk}nonceFor(t){return this.nonces.get(new URL(t.toString()).origin)}rememberNonce(t,r){this.nonces.set(new URL(t.toString()).origin,r)}observeNonce(t,r){let o=t.headers.get("dpop-nonce");o&&this.rememberNonce(r,o)}async buildProof(t){let r,o,a=await hl(),i=(r=new URL(t.htu.toString()),`${r.origin}${r.pathname}`),n=t.nonce??this.nonceFor(t.htu),s={jti:(o=new Uint8Array(16),globalThis.crypto.getRandomValues(o),hd(o)),htm:t.htm.toUpperCase(),htu:i,iat:Math.floor(Date.now()/1e3)};return void 0!==t.accessToken&&(s.ath=await hu(t.accessToken)),void 0!==n&&(s.nonce=n),new a.SignJWT(s).setProtectedHeader({alg:this.keyPair.alg,typ:"dpop+jwt",jwk:this.keyPair.publicJwk}).sign(this.keyPair.privateKey)}}),class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SseError"})}static[Symbol.hasInstance](t){return lq(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 lq(this,t)}constructor(t,r,o){super(`SSE error: ${r}`),this.code=t,this.event=o,lz(this,new.target)}};let hp={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},hh=new Set(["authorization","dpop","content-type","mcp-protocol-version","mcp-method","mcp-name","mcp-session-id"]);function hf(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 a=()=>{t.removeEventListener("abort",i),r.removeEventListener("abort",n)};function i(){a(),o.abort(t.reason)}function n(){a(),o.abort(r.reason)}return t.addEventListener("abort",i,{once:!0}),r.addEventListener("abort",n,{once:!0}),o.signal}var hm=class{_abortController;_url;_resourceMetadataUrl;_scope;_requestInit;_authProvider;_oauthProvider;_skipIssuerMetadataValidation;_fetch;_fetchWithInit;_redirectPolicy;_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,this._fetch=r?.fetch,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=>pb(t,o,r)}}(r.authProvider,{skipIssuerMetadataValidation:r.skipIssuerMetadataValidation}),r.authProvider.dpop&&(this._fetch=(t=>{let r,o;return r=async()=>{try{return await t.dpop?.()}catch(t){throw p1(t)}},o=async()=>{let r;try{r=await t.tokens()}catch(t){throw p1(t)}return r?.token_type?.toLowerCase()==="dpop"?r.access_token:void 0},t=>{let a="function"==typeof r?r:()=>r;return async(r,i)=>{let n=(i?.method??"GET").toUpperCase(),s=new URL(r.toString()),l=await a();if(!l)return t(r,i);let c=async()=>{let a=await o();if(!a)return t(r,i);let c=new Headers(i?.headers),u=await l.buildProof({htm:n,htu:s,accessToken:a});return c.set("Authorization",`DPoP ${a}`),c.set("DPoP",u),t(r,{...i,headers:c})},u=await c();return function(t){var r;if(401!==t.status)return!1;let o=t.headers.get("www-authenticate")??"";return r=o,/(?:^|,)\s*dpop(?:\s|$|,)/i.test(r)&&/use_dpop_nonce/i.test(o)}(u)&&u.headers.has("dpop-nonce")&&(l.observeNonce(u,s),await u.text?.().catch(()=>{}),u=await c()),l.observeNonce(u,s),u}}})(r.authProvider)(r.fetch??fetch))):this._authProvider=r?.authProvider,this._redirectPolicy=r?.redirectPolicy,this._fetchWithInit=function(t=fetch,r){return r?async(o,a)=>t(o,{...r,...a,headers:a?.headers?{...um(r.headers),...um(a.headers)}:r.headers}):t}(r?.fetch,r?.requestInit),"follow"===this._redirectPolicy&&(this._fetchWithInit=function(t){let r=(r,o)=>t(r,o);return uv.add(r),r}(this._fetchWithInit)),this._sessionId=r?.sessionId,this._protocolVersion=r?.protocolVersion,this._reconnectionOptions=r?.reconnectionOptions??hp,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 p1(t)}}async _stepUpAuthorizeInner(t,r){if("throw"===this._onInsufficientScope||!this._oauthProvider)throw new pg({requiredScope:t.scope,resourceMetadataUrl:t.resourceMetadataUrl,errorDescription:t.errorDescription});if(r>=this._maxStepUpRetries)throw new lK(lD.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(),a=pE(this._scope,o?.scope,t.scope);this._scope=a;let i=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}(a,o?.scope);return pT(this._oauthProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:a,forceReauthorization:i,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})}_redirects(t){return"follow"===this._redirectPolicy?t:u_(t)}_unfollowedRedirect(t,r){let o="follow"===this._redirectPolicy?void 0:function(t,r){if("opaqueredirect"===r.type)return"Redirect not followed: this runtime does not expose where it points";let o=ug(r.url||t,r);if(o)return(o.username=o.password=o.search=o.hash="","http:"===o.protocol&&"https:"===new URL(r.url||t).protocol)?(o.protocol="https:",`Redirect from https to plain http not followed; try ${o.href} as the endpoint`):`Redirect to ${o.href} not followed; use that URL as the endpoint if it is the intended server`}(t,r);return o&&`${o} (redirectPolicy: 'same-origin')`}async _commonHeaders(){let t,r=new Headers(this._requestInit?.headers||void 0);try{t=await this._authProvider?.token()}catch(t){throw p1(t)}return t&&r.set("Authorization",`Bearer ${t}`),this._sessionId&&r.set("mcp-session-id",this._sessionId),this._protocolVersion&&r.set("mcp-protocol-version",this._protocolVersion),r}_applyBodyDerivedHeaders(t,r){let o;if(Array.isArray(r)||(o=r,!ne.safeParse(o).success))return;let a=r.params?._meta?.[iL];if("string"!=typeof a)return;t.set("mcp-protocol-version",a),t.set("mcp-method",r.method);let i=function(t,r){var o;let a=Object.hasOwn(cZ,t)?cZ[t]:void 0;if(void 0===a)return;let i=null===(o=r)||"object"!=typeof o||Array.isArray(o)?void 0:r[a];return{field:a,value:"string"==typeof i?i:void 0}}(r.method,r.params);i?.value!==void 0&&t.set("mcp-name",cB(i.value))}_isModernEnvelopedRequest(t){let r;if(Array.isArray(t)||(r=t,!ne.safeParse(r).success))return!1;let o=t.params?._meta?.[iL];return"string"==typeof o&&o>=lV}async _startOrAuthSse(t,r=!1,o=0){let{resumptionToken:a,requestSignal:i}=t,n=()=>this._abortController?.signal.aborted===!0||i?.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(", ")),a&&n.set("last-event-id",a);let l=this._abortController?.signal,c=void 0!==i&&void 0!==l?hf(l,i):i??l,u=await this._redirects(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}=pN(u);this._resourceMetadataUrl=t,this._scope=pE(this._scope,r)}if(this._authProvider.onUnauthorized&&!r){try{await this._authProvider.onUnauthorized({response:u,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(t){throw p1(t)}return await u.text?.().catch(()=>{}),this._startOrAuthSse(t,!0,o)}if(await u.text?.().catch(()=>{}),r)throw p1(new lK(lD.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:u.statusText}));throw p1(new pS)}if(403===u.status){let{resourceMetadataUrl:a,scope:i,error:n,errorDescription:s}=pN(u);if("insufficient_scope"===n){let n=await u.text?.().catch(()=>null);if(await this._stepUpAuthorize({scope:i,resourceMetadataUrl:a,errorDescription:s,statusText:u.statusText,text:n},o)!=="AUTHORIZED")throw p1(new pS);return this._startOrAuthSse(t,r,o+1)}}if(await u.text?.().catch(()=>{}),405===u.status)return void t.onRequestStreamEnd?.();let a=this._unfollowedRedirect(this._url,u)??u.statusText;throw new lK(lD.ClientHttpFailedToOpenStream,`Failed to open SSE stream: ${a}`,{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 a=this._getNextReconnectionDelay(r),i=()=>{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(i,a,r);this._cancelReconnection="function"==typeof t?t:void 0}else{let t=setTimeout(i,a);this._cancelReconnection=()=>clearTimeout(t)}}_handleSseStream(t,r,o){let a;if(!t)return void r.onRequestStreamEnd?.();let{onresumptiontoken:i,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 pd({onRetry:t=>{this._serverRetryMs=t}})).getReader();for(;;){let{value:t,done:o}=await r.read();if(o)break;if((t.id&&(a=t.id,u=!0,i?.(t.id)),t.data)&&(!t.event||"message"===t.event))try{let r=na.parse(JSON.parse(t.data));(cz(r)||cq(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:a,onresumptiontoken:i,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:a,onresumptiontoken:i,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 pS("finishAuth requires an OAuthClientProvider");let{authorizationCode:o,iss:a}=await pP(t,r,this._oauthProvider,this._url,{fetchFn:this._fetchWithInit,resourceMetadataUrl:this._resourceMetadataUrl});if(await pT(this._oauthProvider,{serverUrl:this._url,authorizationCode:o,iss:a,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})!=="AUTHORIZED")throw new pS("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,a=0){try{let i,{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}):(i=t,n_.safeParse(i).success);if(c&&l.delete("mcp-session-id"),r?.headers!==void 0)for(let[t,o]of Object.entries(r.headers))hh.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?hf(d,r.requestSignal):r?.requestSignal??d,h={...this._requestInit,method:"POST",headers:l,body:JSON.stringify(t),signal:p},f=await this._redirects(this._fetch??fetch)(this._url,h);if(c&&f.ok&&(this._sessionId=f.headers.get("mcp-session-id")||void 0),!f.ok){if(401===f.status&&this._authProvider){if(f.headers.has("www-authenticate")){let{resourceMetadataUrl:t,scope:r}=pN(f);this._resourceMetadataUrl=t,this._scope=pE(this._scope,r)}if(this._authProvider.onUnauthorized&&!o){try{await this._authProvider.onUnauthorized({response:f,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(t){throw p1(t)}return await f.text?.().catch(()=>{}),this._send(t,r,!0,a)}if(await f.text?.().catch(()=>{}),o)throw p1(new lK(lD.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:f.statusText}));throw p1(new pS)}let i=await f.text?.().catch(()=>null);if(403===f.status){let{resourceMetadataUrl:n,scope:s,error:l,errorDescription:c}=pN(f);if("insufficient_scope"===l){if(await this._stepUpAuthorize({scope:s,resourceMetadataUrl:n,errorDescription:c,statusText:f.statusText,text:i},a)!=="AUTHORIZED")throw p1(new pS);return this._send(t,r,o,a+1)}}if(400===f.status&&"string"==typeof i&&this._isModernEnvelopedRequest(t))try{let r=na.parse(JSON.parse(i)),o=(Array.isArray(t)?t:[t]).filter(t=>{let r;return r=t,ne.safeParse(r).success});if(cq(r)&&o.some(t=>t.id===r.id))return void this.onmessage?.(r)}catch{}let n=this._unfollowedRedirect(this._url,f)??i;throw new lK(lD.ClientHttpNotImplemented,`Error POSTing to endpoint: ${n}`,{status:f.status,statusText:f.statusText,text:i})}if(202===f.status){let r;await f.text?.().catch(()=>{}),r=t,nw.safeParse(r).success&&this._startOrAuthSse({resumptionToken:void 0}).catch(t=>this.onerror?.(t));return}let m=(Array.isArray(t)?t:[t]).some(t=>"method"in t&&"id"in t&&void 0!==t.id),y=f.headers.get("content-type"),g=function(t){if(t)try{return uh.parse(t).type}catch{let r=(t.split(";",1)[0]??"").trim().toLowerCase();if(""===r||t.slice(r.length).includes(","))return;return r}}(y);if(m)if("text/event-stream"===g)this._handleSseStream(f.body,{onresumptiontoken:s,requestSignal:r?.requestSignal,onRequestStreamEnd:r?.onRequestStreamEnd},!1);else if("application/json"===g){let t=await f.json();for(let r of Array.isArray(t)?t.map(t=>na.parse(t)):[na.parse(t)])this.onmessage?.(r)}else throw await f.text?.().catch(()=>{}),new lL(lD.ClientHttpUnexpectedContent,`Unexpected content type: ${y}`,{contentType:y});else await f.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._redirects(this._fetch??fetch)(this._url,r);if(await o.text?.().catch(()=>{}),!o.ok&&405!==o.status)throw new lK(lD.ClientHttpFailedToTerminateSession,`Failed to terminate session: ${this._unfollowedRedirect(this._url,o)??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 hy=require("node:process"),hg=require("node:stream");var hv=i(6507);let h_="win32"===hy.platform?["APPDATA","COMSPEC","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PATHEXT","PROCESSOR_ARCHITECTURE","PROGRAMDATA","PROGRAMFILES","PROGRAMFILES(X86)","PROGRAMW6432","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","WINDIR"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];var hb=class{_process;_readBuffer;_serverParams;_stderrStream=null;onclose;onerror;onmessage;constructor(t){this._serverParams=t,this._readBuffer=new uf({maxBufferSize:t.maxBufferSize}),("pipe"===t.stderr||"overlapped"===t.stderr)&&(this._stderrStream=new hg.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=hv(this._serverParams.command,this._serverParams.args??[],{env:{...function(){let t={};for(let r of h_){let o=hy.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"===hy.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 lL(lD.NotConnected,"Not connected");let o=JSON.stringify(t)+"\n";this._process.stdin.write(o)?r():this._process.stdin.once("drain",r)})}};let hS=i(8330),hw={name:hS.name,version:hS.version};async function h$(t,r={}){var o;let a,i,{handlers:n={}}=r,s={};n.sampling&&(s.sampling={}),n.elicitation&&(s.elicitation={form:{},url:{}}),n.roots&&(s.roots={});let l=new hs(hw,{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 hm(new URL(t.url),{requestInit:{headers:(o=t.headers??[],i={},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}")`);i[o]=r}else i[o]=t.value.trim()}),i)}}):new hb({command:t.command,args:t.args,env:t.env,cwd:t.cwd,stderr:t.stderr??(r.onStderrData?"pipe":"inherit")});c instanceof hb&&c.stderr?.on("data",r.onStderrData??(t=>{process.stderr.write(t)}));let u=c.close.bind(c);c.close=()=>a??(a=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 hE(t,r,o){let a=await h$(t,o);try{return await r(a)}finally{await a.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})})();