xmcp 1.6.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.js +23 -21
- package/dist/config/index.d.ts +5 -0
- package/dist/config/schemas/experimental/index.d.ts +4 -0
- package/dist/config.js +1 -1
- package/dist/index.js +40 -38
- package/dist/runtime/adapter-express.js +23 -25
- package/dist/runtime/adapter-fastify.js +23 -25
- package/dist/runtime/adapter-fetch-cloudflare.js +22 -24
- package/dist/runtime/adapter-fetch.js +23 -25
- package/dist/runtime/adapter-nestjs.js +23 -25
- package/dist/runtime/adapter-nextjs.js +38 -40
- package/dist/runtime/cloudflare-worker.js +30 -32
- package/dist/runtime/http.js +30 -32
- package/dist/runtime/stdio.js +18 -20
- package/dist/runtime/vercel.js +30 -32
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
!function(t,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r(require("zod/v3"));else if("function"==typeof define&&define.amd)define(["zod/v3"],r);else{var o="object"==typeof exports?r(require("zod/v3")):r(t["zod/v3"]);for(var a in o)("object"==typeof exports?exports:t)[a]=o[a]}}(this,t=>(()=>{var r,o,a={9454(t,r,o){"use strict";var a=o(181).Buffer,i=o(181).SlowBuffer;function s(t,r){if(!a.isBuffer(t)||!a.isBuffer(r)||t.length!==r.length)return!1;for(var o=0,i=0;i<t.length;i++)o|=t[i]^r[i];return 0===o}t.exports=s,s.install=function(){a.prototype.equal=i.prototype.equal=function(t){return s(this,t)}};var n=a.prototype.equal,l=i.prototype.equal;s.restore=function(){a.prototype.equal=n,i.prototype.equal=l}},6507(t,r,o){"use strict";let a=o(5317),i=o(8388),s=o(442);function n(t,r,o){let n=i(t,r,o),l=a.spawn(n.command,n.args,n.options);return s.hookChildProcess(l,n),l}t.exports=n,t.exports.spawn=n,t.exports.sync=function(t,r,o){let n=i(t,r,o),l=a.spawnSync(n.command,n.args,n.options);return l.error=l.error||s.verifyENOENTSync(l.status,n),l},t.exports._parse=i,t.exports._enoent=s},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,s){if("exit"===r){let r=a(s,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),s=o(2077),n=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&&n(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=s.command(t.command),t.args=t.args.map(t=>s.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),s=o(9695);function n(t,r){let o,n=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:n[s({env:n})],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 n(t)||n(t,!0)}},8583(t,r,o){let a=o(9896),i=o(6928),s=o(857),n=o(6982),l=o(4519).version,c=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function u(t){console.log(`[dotenv@${l}][DEBUG] ${t}`)}function d(t){console.log(`[dotenv@${l}] ${t}`)}function p(t){return t&&t.DOTENV_KEY&&t.DOTENV_KEY.length>0?t.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function h(t){let r=null;if(t&&t.path&&t.path.length>0)if(Array.isArray(t.path))for(let o of t.path)a.existsSync(o)&&(r=o.endsWith(".vault")?o:`${o}.vault`);else r=t.path.endsWith(".vault")?t.path:`${t.path}.vault`;else r=i.resolve(process.cwd(),".env.vault");return a.existsSync(r)?r:null}function f(t){return"~"===t[0]?i.join(s.homedir(),t.slice(1)):t}let m={configDotenv:function(t){let r,o=i.resolve(process.cwd(),".env"),s="utf8",n=!!(t&&t.debug),l=!t||!("quiet"in t)||t.quiet;t&&t.encoding?s=t.encoding:n&&u("No encoding is specified. UTF-8 is used by default");let c=[o];if(t&&t.path)if(Array.isArray(t.path))for(let r of(c=[],t.path))c.push(f(r));else c=[f(t.path)];let p={};for(let o of c)try{let r=m.parse(a.readFileSync(o,{encoding:s}));m.populate(p,r,t)}catch(t){n&&u(`Failed to load ${o} ${t.message}`),r=t}let h=process.env;if(t&&null!=t.processEnv&&(h=t.processEnv),m.populate(h,p,t),n||!l){let t=Object.keys(p).length,o=[];for(let t of c)try{let r=i.relative(process.cwd(),t);o.push(r)}catch(o){n&&u(`Failed to load ${t} ${o.message}`),r=o}d(`injecting env (${t}) from ${o.join(",")}`)}return r?{parsed:p,error:r}:{parsed:p}},_configVault:function(t){let r=!!(t&&t.debug),o=!t||!("quiet"in t)||t.quiet;(r||!o)&&d("Loading env from encrypted .env.vault");let a=m._parseVault(t),i=process.env;return t&&null!=t.processEnv&&(i=t.processEnv),m.populate(i,a,t),{parsed:a}},_parseVault:function(t){let r,o=h(t=t||{});t.path=o;let a=m.configDotenv(t);if(!a.parsed){let t=Error(`MISSING_DATA: Cannot parse ${o} for an unknown reason`);throw t.code="MISSING_DATA",t}let i=p(t).split(","),s=i.length;for(let t=0;t<s;t++)try{let o=i[t].trim(),s=function(t,r){let o;try{o=new URL(r)}catch(t){if("ERR_INVALID_URL"===t.code){let t=Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw t.code="INVALID_DOTENV_KEY",t}throw t}let a=o.password;if(!a){let t=Error("INVALID_DOTENV_KEY: Missing key part");throw t.code="INVALID_DOTENV_KEY",t}let i=o.searchParams.get("environment");if(!i){let t=Error("INVALID_DOTENV_KEY: Missing environment part");throw t.code="INVALID_DOTENV_KEY",t}let s=`DOTENV_VAULT_${i.toUpperCase()}`,n=t.parsed[s];if(!n){let t=Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${s} in your .env.vault file.`);throw t.code="NOT_FOUND_DOTENV_ENVIRONMENT",t}return{ciphertext:n,key:a}}(a,o);r=m.decrypt(s.ciphertext,s.key);break}catch(r){if(t+1>=s)throw r}return m.parse(r)},config:function(t){if(0===p(t).length)return m.configDotenv(t);let r=h(t);if(!r){var o;return o=`You set DOTENV_KEY but you are missing a .env.vault file at ${r}. Did you forget to build it?`,console.log(`[dotenv@${l}][WARN] ${o}`),m.configDotenv(t)}return m._configVault(t)},decrypt:function(t,r){let o=Buffer.from(r.slice(-64),"hex"),a=Buffer.from(t,"base64"),i=a.subarray(0,12),s=a.subarray(-16);a=a.subarray(12,-16);try{let t=n.createDecipheriv("aes-256-gcm",o,i);return t.setAuthTag(s),`${t.update(a)}${t.final()}`}catch(a){let t=a instanceof RangeError,r="Invalid key length"===a.message,o="Unsupported state or unable to authenticate data"===a.message;if(t||r){let t=Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw t.code="INVALID_DOTENV_KEY",t}if(o){let t=Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw t.code="DECRYPTION_FAILED",t}throw a}},parse:function(t){let r,o={},a=t.toString();for(a=a.replace(/\r\n?/mg,"\n");null!=(r=c.exec(a));){let t=r[1],a=r[2]||"",i=(a=a.trim())[0];a=a.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),'"'===i&&(a=(a=a.replace(/\\n/g,"\n")).replace(/\\r/g,"\r")),o[t]=a}return o},populate:function(t,r,o={}){let a=!!(o&&o.debug),i=!!(o&&o.override);if("object"!=typeof r){let t=Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw t.code="OBJECT_REQUIRED",t}for(let o of Object.keys(r))Object.prototype.hasOwnProperty.call(t,o)?(!0===i&&(t[o]=r[o]),a&&(!0===i?u(`"${o}" is already defined and WAS overwritten`):u(`"${o}" is already defined and was NOT overwritten`))):t[o]=r[o]}};t.exports.configDotenv=m.configDotenv,t.exports._configVault=m._configVault,t.exports._parseVault=m._parseVault,t.exports.config=m.config,t.exports.decrypt=m.decrypt,t.exports.parse=m.parse,t.exports.populate=m.populate,t.exports=m},9053(t,r,o){"use strict";var a=o(6608).Buffer,i=o(2188);function s(t){if(a.isBuffer(t))return t;if("string"==typeof t)return a.from(t,"base64");throw TypeError("ECDSA signature must be a Base64 string or a Buffer")}function n(t,r,o){for(var a=0;r+a<o&&0===t[r+a];)++a;return t[r+a]>=128&&--a,a}t.exports={derToJose:function(t,r){t=s(t);var o=i(r),n=o+1,l=t.length,c=0;if(48!==t[c++])throw Error('Could not find expected "seq"');var u=t[c++];if(129===u&&(u=t[c++]),l-c<u)throw Error('"seq" specified length of "'+u+'", only "'+(l-c)+'" remaining');if(2!==t[c++])throw Error('Could not find expected "int" for "r"');var d=t[c++];if(l-c-2<d)throw Error('"r" specified length of "'+d+'", only "'+(l-c-2)+'" available');if(n<d)throw Error('"r" specified length of "'+d+'", max of "'+n+'" is acceptable');var p=c;if(c+=d,2!==t[c++])throw Error('Could not find expected "int" for "s"');var h=t[c++];if(l-c!==h)throw Error('"s" specified length of "'+h+'", expected "'+(l-c)+'"');if(n<h)throw Error('"s" specified length of "'+h+'", max of "'+n+'" is acceptable');var f=c;if((c+=h)!==l)throw Error('Expected to consume entire buffer, but "'+(l-c)+'" bytes remain');var m=o-d,y=o-h,g=a.allocUnsafe(m+d+y+h);for(c=0;c<m;++c)g[c]=0;t.copy(g,c,p+Math.max(-m,0),p+d),c=o;for(var v=c;c<v+y;++c)g[c]=0;return t.copy(g,c,f+Math.max(-y,0),f+h),g=(g=g.toString("base64")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},joseToDer:function(t,r){t=s(t);var o=i(r),l=t.length;if(l!==2*o)throw TypeError('"'+r+'" signatures must be "'+2*o+'" bytes, saw "'+l+'"');var c=n(t,0,o),u=n(t,o,t.length),d=o-c,p=o-u,h=2+d+1+1+p,f=h<128,m=a.allocUnsafe((f?2:3)+h),y=0;return m[y++]=48,f?m[y++]=h:(m[y++]=129,m[y++]=255&h),m[y++]=2,m[y++]=d,c<0?(m[y++]=0,y+=t.copy(m,y,0,o)):y+=t.copy(m,y,c,o),m[y++]=2,m[y++]=p,u<0?(m[y++]=0,t.copy(m,y,o)):t.copy(m,y,o+u),m}}},2188(t){"use strict";function r(t){return(t/8|0)+ +(t%8!=0)}var o={ES256:r(256),ES384:r(384),ES512:r(521)};t.exports=function(t){var r=o[t];if(r)return r;throw Error('Unknown algorithm "'+t+'"')}},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 s(a.statSync(t),r)};var a=o(9896);function i(t,r,o){a.stat(t,function(t,a){o(t,!t&&s(a,r))})}function s(t,r){var o,a,i,s,n,l,c,u,d;return t.isFile()&&(o=t,a=r,i=o.mode,s=o.uid,n=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&&n===c||i&u&&s===l||i&(u|d)&&0===l)}},8541(t,r,o){t.exports=s,s.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 s=a[i].toLowerCase();if(s&&r.substr(-s.length).toLowerCase()===s)return!0}return!1}function s(t,r,o){a.stat(t,function(a,s){o(a,!a&&i(s,t,r))})}},2548(t,r,o){var a=o(3263);t.exports=function(t,r){r=r||{};var o=a.decode(t,r);if(!o)return null;var i=o.payload;if("string"==typeof i)try{var s=JSON.parse(i);null!==s&&"object"==typeof s&&(i=s)}catch(t){}return!0===r.complete?{header:o.header,payload:i,signature:o.signature}:i}},8400(t,r,o){t.exports={decode:o(2548),verify:o(6467),sign:o(9147),JsonWebTokenError:o(1957),NotBeforeError:o(4470),TokenExpiredError:o(7788)}},1957(t){var r=function(t,r){Error.call(this,t),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name="JsonWebTokenError",this.message=t,r&&(this.inner=r)};r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,t.exports=r},4470(t,r,o){var a=o(1957),i=function(t,r){a.call(this,t),this.name="NotBeforeError",this.date=r};i.prototype=Object.create(a.prototype),i.prototype.constructor=i,t.exports=i},7788(t,r,o){var a=o(1957),i=function(t,r){a.call(this,t),this.name="TokenExpiredError",this.expiredAt=r};i.prototype=Object.create(a.prototype),i.prototype.constructor=i,t.exports=i},5841(t,r,o){t.exports=o(3895).satisfies(process.version,">=15.7.0")},953(t,r,o){t.exports=o(3895).satisfies(process.version,"^6.12.0 || >=8.0.0")},455(t,r,o){t.exports=o(3895).satisfies(process.version,">=16.9.0")},4559(t,r,o){var a=o(3866);t.exports=function(t,r){var o=r||Math.floor(Date.now()/1e3);if("string"==typeof t){var i=a(t);if(void 0===i)return;return Math.floor(o+i/1e3)}if("number"==typeof t)return o+t}},723(t,r,o){let a=o(5841),i=o(455),s={ec:["ES256","ES384","ES512"],rsa:["RS256","PS256","RS384","PS384","RS512","PS512"],"rsa-pss":["PS256","PS384","PS512"]},n={ES256:"prime256v1",ES384:"secp384r1",ES512:"secp521r1"};t.exports=function(t,r){if(!t||!r)return;let o=r.asymmetricKeyType;if(!o)return;let l=s[o];if(!l)throw Error(`Unknown key type "${o}".`);if(!l.includes(t))throw Error(`"alg" parameter for "${o}" key type must be one of: ${l.join(", ")}.`);if(a)switch(o){case"ec":let c=r.asymmetricKeyDetails.namedCurve,u=n[t];if(c!==u)throw Error(`"alg" parameter "${t}" requires curve "${u}".`);break;case"rsa-pss":if(i){let o=parseInt(t.slice(-3),10),{hashAlgorithm:a,mgf1HashAlgorithm:i,saltLength:s}=r.asymmetricKeyDetails;if(a!==`sha${o}`||i!==a)throw Error(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${t}.`);if(void 0!==s&&s>o>>3)throw Error(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${t}.`)}}}},9147(t,r,o){let a=o(4559),i=o(953),s=o(723),n=o(3263),l=o(5357),c=o(6782),u=o(5250),d=o(8094),p=o(6052),h=o(1251),f=o(8430),{KeyObject:m,createSecretKey:y,createPrivateKey:g}=o(6982),v=["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512","none"];i&&v.splice(3,0,"PS256","PS384","PS512");let b={expiresIn:{isValid:function(t){return u(t)||h(t)&&t},message:'"expiresIn" should be a number of seconds or string representing a timespan'},notBefore:{isValid:function(t){return u(t)||h(t)&&t},message:'"notBefore" should be a number of seconds or string representing a timespan'},audience:{isValid:function(t){return h(t)||Array.isArray(t)},message:'"audience" must be a string or array'},algorithm:{isValid:l.bind(null,v),message:'"algorithm" must be a valid string enum value'},header:{isValid:p,message:'"header" must be an object'},encoding:{isValid:h,message:'"encoding" must be a string'},issuer:{isValid:h,message:'"issuer" must be a string'},subject:{isValid:h,message:'"subject" must be a string'},jwtid:{isValid:h,message:'"jwtid" must be a string'},noTimestamp:{isValid:c,message:'"noTimestamp" must be a boolean'},keyid:{isValid:h,message:'"keyid" must be a string'},mutatePayload:{isValid:c,message:'"mutatePayload" must be a boolean'},allowInsecureKeySizes:{isValid:c,message:'"allowInsecureKeySizes" must be a boolean'},allowInvalidAsymmetricKeyTypes:{isValid:c,message:'"allowInvalidAsymmetricKeyTypes" must be a boolean'}},_={iat:{isValid:d,message:'"iat" should be a number of seconds'},exp:{isValid:d,message:'"exp" should be a number of seconds'},nbf:{isValid:d,message:'"nbf" should be a number of seconds'}};function S(t,r,o,a){if(!p(o))throw Error('Expected "'+a+'" to be a plain object.');Object.keys(o).forEach(function(i){let s=t[i];if(!s){if(!r)throw Error('"'+i+'" is not allowed in "'+a+'"');return}if(!s.isValid(o[i]))throw Error(s.message)})}let $={audience:"aud",issuer:"iss",subject:"sub",jwtid:"jti"},w=["expiresIn","notBefore","noTimestamp","audience","issuer","subject","jwtid"];t.exports=function(t,r,o,i){var l,c;"function"==typeof o?(i=o,o={}):o=o||{};let u="object"==typeof t&&!Buffer.isBuffer(t),d=Object.assign({alg:o.algorithm||"HS256",typ:u?"JWT":void 0,kid:o.keyid},o.header);function p(t){if(i)return i(t);throw t}if(!r&&"none"!==o.algorithm)return p(Error("secretOrPrivateKey must have a value"));if(null!=r&&!(r instanceof m))try{r=g(r)}catch(t){try{r=y("string"==typeof r?Buffer.from(r):r)}catch(t){return p(Error("secretOrPrivateKey is not valid key material"))}}if(d.alg.startsWith("HS")&&"secret"!==r.type)return p(Error(`secretOrPrivateKey must be a symmetric key when using ${d.alg}`));if(/^(?:RS|PS|ES)/.test(d.alg)){if("private"!==r.type)return p(Error(`secretOrPrivateKey must be an asymmetric key when using ${d.alg}`));if(!o.allowInsecureKeySizes&&!d.alg.startsWith("ES")&&void 0!==r.asymmetricKeyDetails&&r.asymmetricKeyDetails.modulusLength<2048)return p(Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${d.alg}`))}if(void 0===t)return p(Error("payload is required"));if(u){try{l=t,S(_,!0,l,"payload")}catch(t){return p(t)}o.mutatePayload||(t=Object.assign({},t))}else{let r=w.filter(function(t){return void 0!==o[t]});if(r.length>0)return p(Error("invalid "+r.join(",")+" option for "+typeof t+" payload"))}if(void 0!==t.exp&&void 0!==o.expiresIn)return p(Error('Bad "options.expiresIn" option the payload already has an "exp" property.'));if(void 0!==t.nbf&&void 0!==o.notBefore)return p(Error('Bad "options.notBefore" option the payload already has an "nbf" property.'));try{c=o,S(b,!1,c,"options")}catch(t){return p(t)}if(!o.allowInvalidAsymmetricKeyTypes)try{s(d.alg,r)}catch(t){return p(t)}let h=t.iat||Math.floor(Date.now()/1e3);if(o.noTimestamp?delete t.iat:u&&(t.iat=h),void 0!==o.notBefore){try{t.nbf=a(o.notBefore,h)}catch(t){return p(t)}if(void 0===t.nbf)return p(Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}if(void 0!==o.expiresIn&&"object"==typeof t){try{t.exp=a(o.expiresIn,h)}catch(t){return p(t)}if(void 0===t.exp)return p(Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}Object.keys($).forEach(function(r){let a=$[r];if(void 0!==o[r]){if(void 0!==t[a])return p(Error('Bad "options.'+r+'" option. The payload already has an "'+a+'" property.'));t[a]=o[r]}});let v=o.encoding||"utf8";if("function"==typeof i)i=i&&f(i),n.createSign({header:d,privateKey:r,payload:t,encoding:v}).once("error",i).once("done",function(t){if(!o.allowInsecureKeySizes&&/^(?:RS|PS)/.test(d.alg)&&t.length<256)return i(Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${d.alg}`));i(null,t)});else{let a=n.sign({header:d,payload:t,secret:r,encoding:v});if(!o.allowInsecureKeySizes&&/^(?:RS|PS)/.test(d.alg)&&a.length<256)throw Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${d.alg}`);return a}}},6467(t,r,o){let a=o(1957),i=o(4470),s=o(7788),n=o(2548),l=o(4559),c=o(723),u=o(953),d=o(3263),{KeyObject:p,createSecretKey:h,createPublicKey:f}=o(6982),m=["RS256","RS384","RS512"],y=["ES256","ES384","ES512"],g=["RS256","RS384","RS512"],v=["HS256","HS384","HS512"];u&&(m.splice(m.length,0,"PS256","PS384","PS512"),g.splice(g.length,0,"PS256","PS384","PS512")),t.exports=function(t,r,o,u){let b,_,S;if("function"!=typeof o||u||(u=o,o={}),o||(o={}),o=Object.assign({},o),b=u||function(t,r){if(t)throw t;return r},o.clockTimestamp&&"number"!=typeof o.clockTimestamp)return b(new a("clockTimestamp must be a number"));if(void 0!==o.nonce&&("string"!=typeof o.nonce||""===o.nonce.trim()))return b(new a("nonce must be a non-empty string"));if(void 0!==o.allowInvalidAsymmetricKeyTypes&&"boolean"!=typeof o.allowInvalidAsymmetricKeyTypes)return b(new a("allowInvalidAsymmetricKeyTypes must be a boolean"));let $=o.clockTimestamp||Math.floor(Date.now()/1e3);if(!t)return b(new a("jwt must be provided"));if("string"!=typeof t)return b(new a("jwt must be a string"));let w=t.split(".");if(3!==w.length)return b(new a("jwt malformed"));try{_=n(t,{complete:!0})}catch(t){return b(t)}if(!_)return b(new a("invalid token"));let E=_.header;if("function"==typeof r){if(!u)return b(new a("verify must be called asynchronous if secret or public key is provided as a callback"));S=r}else S=function(t,o){return o(null,r)};return S(E,function(r,n){let u;if(r)return b(new a("error in secret or public key callback: "+r.message));let S=""!==w[2].trim();if(!S&&n)return b(new a("jwt signature is required"));if(S&&!n)return b(new a("secret or public key must be provided"));if(!S&&!o.algorithms)return b(new a('please specify "none" in "algorithms" to verify unsigned tokens'));if(null!=n&&!(n instanceof p))try{n=f(n)}catch(t){try{n=h("string"==typeof n?Buffer.from(n):n)}catch(t){return b(new a("secretOrPublicKey is not valid key material"))}}if(o.algorithms||("secret"===n.type?o.algorithms=v:["rsa","rsa-pss"].includes(n.asymmetricKeyType)?o.algorithms=g:"ec"===n.asymmetricKeyType?o.algorithms=y:o.algorithms=m),-1===o.algorithms.indexOf(_.header.alg))return b(new a("invalid algorithm"));if(E.alg.startsWith("HS")&&"secret"!==n.type)return b(new a(`secretOrPublicKey must be a symmetric key when using ${E.alg}`));if(/^(?:RS|PS|ES)/.test(E.alg)&&"public"!==n.type)return b(new a(`secretOrPublicKey must be an asymmetric key when using ${E.alg}`));if(!o.allowInvalidAsymmetricKeyTypes)try{c(E.alg,n)}catch(t){return b(t)}try{u=d.verify(t,_.header.alg,n)}catch(t){return b(t)}if(!u)return b(new a("invalid signature"));let R=_.payload;if(void 0!==R.nbf&&!o.ignoreNotBefore){if("number"!=typeof R.nbf)return b(new a("invalid nbf value"));if(R.nbf>$+(o.clockTolerance||0))return b(new i("jwt not active",new Date(1e3*R.nbf)))}if(void 0!==R.exp&&!o.ignoreExpiration){if("number"!=typeof R.exp)return b(new a("invalid exp value"));if($>=R.exp+(o.clockTolerance||0))return b(new s("jwt expired",new Date(1e3*R.exp)))}if(o.audience){let t=Array.isArray(o.audience)?o.audience:[o.audience];if(!(Array.isArray(R.aud)?R.aud:[R.aud]).some(function(r){return t.some(function(t){return t instanceof RegExp?t.test(r):t===r})}))return b(new a("jwt audience invalid. expected: "+t.join(" or ")))}if(o.issuer&&("string"==typeof o.issuer&&R.iss!==o.issuer||Array.isArray(o.issuer)&&-1===o.issuer.indexOf(R.iss)))return b(new a("jwt issuer invalid. expected: "+o.issuer));if(o.subject&&R.sub!==o.subject)return b(new a("jwt subject invalid. expected: "+o.subject));if(o.jwtid&&R.jti!==o.jwtid)return b(new a("jwt jwtid invalid. expected: "+o.jwtid));if(o.nonce&&R.nonce!==o.nonce)return b(new a("jwt nonce invalid. expected: "+o.nonce));if(o.maxAge){if("number"!=typeof R.iat)return b(new a("iat required when maxAge is specified"));let t=l(o.maxAge,R.iat);if(void 0===t)return b(new a('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));if($>=t+(o.clockTolerance||0))return b(new s("maxAge exceeded",new Date(1e3*t)))}return!0===o.complete?b(null,{header:E,payload:R,signature:_.signature}):b(null,R)})}},2357(t,r,o){var a,i=o(6608).Buffer,s=o(6982),n=o(9053),l=o(9023),c="secret must be a string or buffer",u="key must be a string or a buffer",d="function"==typeof s.createPublicKey;function p(t){if(!i.isBuffer(t)&&"string"!=typeof t&&(!d||"object"!=typeof t||"string"!=typeof t.type||"string"!=typeof t.asymmetricKeyType||"function"!=typeof t.export))throw y(u)}function h(t){if(!i.isBuffer(t)&&"string"!=typeof t&&"object"!=typeof t)throw y("key must be a string, a buffer or an object")}function f(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function m(t){var r=4-(t=t.toString()).length%4;if(4!==r)for(var o=0;o<r;++o)t+="=";return t.replace(/\-/g,"+").replace(/_/g,"/")}function y(t){var r=[].slice.call(arguments,1);return TypeError(l.format.bind(l,t).apply(null,r))}function g(t){var r;return r=t,i.isBuffer(r)||"string"==typeof r||(t=JSON.stringify(t)),t}function v(t){return function(r,o){!function(t){if(!i.isBuffer(t)){if("string"!=typeof t){if(!d||"object"!=typeof t||"secret"!==t.type||"function"!=typeof t.export)throw y(c)}}}(o),r=g(r);var a=s.createHmac("sha"+t,o);return f((a.update(r),a.digest("base64")))}}d&&(u+=" or a KeyObject",c+="or a KeyObject");var b="timingSafeEqual"in s?function(t,r){return t.byteLength===r.byteLength&&s.timingSafeEqual(t,r)}:function(t,r){return a||(a=o(9454)),a(t,r)};function _(t){return function(r,o,a){var s=v(t)(r,a);return b(i.from(o),i.from(s))}}function S(t){return function(r,o){h(o),r=g(r);var a=s.createSign("RSA-SHA"+t);return f((a.update(r),a.sign(o,"base64")))}}function $(t){return function(r,o,a){p(a),r=g(r),o=m(o);var i=s.createVerify("RSA-SHA"+t);return i.update(r),i.verify(a,o,"base64")}}function w(t){return function(r,o){h(o),r=g(r);var a=s.createSign("RSA-SHA"+t);return f((a.update(r),a.sign({key:o,padding:s.constants.RSA_PKCS1_PSS_PADDING,saltLength:s.constants.RSA_PSS_SALTLEN_DIGEST},"base64")))}}function E(t){return function(r,o,a){p(a),r=g(r),o=m(o);var i=s.createVerify("RSA-SHA"+t);return i.update(r),i.verify({key:a,padding:s.constants.RSA_PKCS1_PSS_PADDING,saltLength:s.constants.RSA_PSS_SALTLEN_DIGEST},o,"base64")}}function R(t){var r=S(t);return function(){var o=r.apply(null,arguments);return n.derToJose(o,"ES"+t)}}function P(t){var r=$(t);return function(o,a,i){return r(o,a=n.joseToDer(a,"ES"+t).toString("base64"),i)}}function k(){return function(){return""}}function O(){return function(t,r){return""===r}}t.exports=function(t){var r=t.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/);if(!r)throw y('"%s" is not a valid algorithm.\n Supported algorithms are:\n "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".',t);var o=(r[1]||r[3]).toLowerCase(),a=r[2];return{sign:({hs:v,rs:S,ps:w,es:R,none:k})[o](a),verify:({hs:_,rs:$,ps:E,es:P,none:O})[o](a)}}},3263(t,r,o){var a=o(9615),i=o(6747);r.ALGORITHMS=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"],r.sign=a.sign,r.verify=i.verify,r.decode=i.decode,r.isValid=i.isValid,r.createSign=function(t){return new a(t)},r.createVerify=function(t){return new i(t)}},6360(t,r,o){var a=o(6608).Buffer,i=o(2203);function s(t){if(this.buffer=null,this.writable=!0,this.readable=!0,!t)return this.buffer=a.alloc(0),this;if("function"==typeof t.pipe)return this.buffer=a.alloc(0),t.pipe(this),this;if(t.length||"object"==typeof t)return this.buffer=t,this.writable=!1,process.nextTick((function(){this.emit("end",t),this.readable=!1,this.emit("close")}).bind(this)),this;throw TypeError("Unexpected data type ("+typeof t+")")}o(9023).inherits(s,i),s.prototype.write=function(t){this.buffer=a.concat([this.buffer,a.from(t)]),this.emit("data",t)},s.prototype.end=function(t){t&&this.write(t),this.emit("end",t),this.emit("close"),this.writable=!1,this.readable=!1},t.exports=s},9615(t,r,o){var a=o(6608).Buffer,i=o(6360),s=o(2357),n=o(2203),l=o(5911),c=o(9023);function u(t,r){return a.from(t,r).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function d(t){var r,o,a,i=t.header,n=t.payload,d=t.secret||t.privateKey,p=t.encoding,h=s(i.alg),f=(r=(r=p)||"utf8",o=u(l(i),"binary"),a=u(l(n),r),c.format("%s.%s",o,a)),m=h.sign(f,d);return c.format("%s.%s",f,m)}function p(t){var r=t.secret;if(r=null==(r=null==r?t.privateKey:r)?t.key:r,!0===/^hs/i.test(t.header.alg)&&null==r)throw TypeError("secret must be a string or buffer or a KeyObject");var o=new i(r);this.readable=!0,this.header=t.header,this.encoding=t.encoding,this.secret=this.privateKey=this.key=o,this.payload=new i(t.payload),this.secret.once("close",(function(){!this.payload.writable&&this.readable&&this.sign()}).bind(this)),this.payload.once("close",(function(){!this.secret.writable&&this.readable&&this.sign()}).bind(this))}c.inherits(p,n),p.prototype.sign=function(){try{var t=d({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",t),this.emit("data",t),this.emit("end"),this.readable=!1,t}catch(t){this.readable=!1,this.emit("error",t),this.emit("close")}},p.sign=d,t.exports=p},5911(t,r,o){var a=o(181).Buffer;t.exports=function(t){return"string"==typeof t?t:"number"==typeof t||a.isBuffer(t)?t.toString():JSON.stringify(t)}},6747(t,r,o){var a=o(6608).Buffer,i=o(6360),s=o(2357),n=o(2203),l=o(5911),c=o(9023),u=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function d(t){var r=t.split(".",1)[0],o=a.from(r,"base64").toString("binary");if("[object Object]"===Object.prototype.toString.call(o))return o;try{return JSON.parse(o)}catch(t){return}}function p(t){return t.split(".")[2]}function h(t){return u.test(t)&&!!d(t)}function f(t,r,o){if(!r){var a=Error("Missing algorithm parameter for jws.verify");throw a.code="MISSING_ALGORITHM",a}var i=p(t=l(t)),n=t.split(".",2).join(".");return s(r).verify(n,i,o)}function m(t,r){if(r=r||{},!h(t=l(t)))return null;var o,i,s=d(t);if(!s)return null;var n=(o=o||"utf8",i=t.split(".")[1],a.from(i,"base64").toString(o));return("JWT"===s.typ||r.json)&&(n=JSON.parse(n,r.encoding)),{header:s,payload:n,signature:p(t)}}function y(t){var r=(t=t||{}).secret;if(r=null==(r=null==r?t.publicKey:r)?t.key:r,!0===/^hs/i.test(t.algorithm)&&null==r)throw TypeError("secret must be a string or buffer or a KeyObject");var o=new i(r);this.readable=!0,this.algorithm=t.algorithm,this.encoding=t.encoding,this.secret=this.publicKey=this.key=o,this.signature=new i(t.signature),this.secret.once("close",(function(){!this.signature.writable&&this.readable&&this.verify()}).bind(this)),this.signature.once("close",(function(){!this.secret.writable&&this.readable&&this.verify()}).bind(this))}c.inherits(y,n),y.prototype.verify=function(){try{var t=f(this.signature.buffer,this.algorithm,this.key.buffer),r=m(this.signature.buffer,this.encoding);return this.emit("done",t,r),this.emit("data",t),this.emit("end"),this.readable=!1,t}catch(t){this.readable=!1,this.emit("error",t),this.emit("close")}},y.decode=m,y.isValid=h,y.verify=f,t.exports=y},5357(t){var r,o,a=1/0,i=0/0,s=/^\s+|\s+$/g,n=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=/^(?:0|[1-9]\d*)$/,d=parseInt;function p(t){return t!=t}var h=Object.prototype,f=h.hasOwnProperty,m=h.toString,y=h.propertyIsEnumerable,g=(r=Object.keys,o=Object,function(t){return r(o(t))}),v=Math.max,b=Array.isArray;function _(t){var r,o,a;return null!=t&&"number"==typeof(r=t.length)&&r>-1&&r%1==0&&r<=0x1fffffffffffff&&"[object Function]"!=(a=S(o=t)?m.call(o):"")&&"[object GeneratorFunction]"!=a}function S(t){var r=typeof t;return!!t&&("object"==r||"function"==r)}function $(t){return!!t&&"object"==typeof t}t.exports=function(t,r,o,w){t=_(t)?t:function(t){return t?function(t,r){for(var o=-1,a=t?t.length:0,i=Array(a);++o<a;)i[o]=r(t[o],o,t);return i}(_(t)?function(t,r){var o,a,i,s,n=b(t)||$(a=o=t)&&_(a)&&f.call(o,"callee")&&(!y.call(o,"callee")||"[object Arguments]"==m.call(o))?function(t,r){for(var o=-1,a=Array(t);++o<t;)a[o]=r(o);return a}(t.length,String):[],l=n.length,c=!!l;for(var d in t){f.call(t,d)&&!(c&&("length"==d||(i=d,(s=null==(s=l)?0x1fffffffffffff:s)&&("number"==typeof i||u.test(i))&&i>-1&&i%1==0&&i<s)))&&n.push(d)}return n}(t):function(t){if(o=(r=t)&&r.constructor,r!==("function"==typeof o&&o.prototype||h))return g(t);var r,o,a=[];for(var i in Object(t))f.call(t,i)&&"constructor"!=i&&a.push(i);return a}(t),function(r){return t[r]}):[]}(t),o=o&&!w?(P=(R=(E=o)?(E=function(t){if("number"==typeof t)return t;if("symbol"==typeof(r=t)||$(r)&&"[object Symbol]"==m.call(r))return i;if(S(t)){var r,o="function"==typeof t.valueOf?t.valueOf():t;t=S(o)?o+"":o}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(s,"");var a=l.test(t);return a||c.test(t)?d(t.slice(2),a?2:8):n.test(t)?i:+t}(E))===a||E===-a?(E<0?-1:1)*17976931348623157e292:E==E?E:0:0===E?E:0)%1,R==R?P?R-P:R:0):0;var E,R,P,k,O=t.length;return o<0&&(o=v(O+o,0)),"string"==typeof(k=t)||!b(k)&&$(k)&&"[object String]"==m.call(k)?o<=O&&t.indexOf(r,o)>-1:!!O&&function(t,r,o){if(r!=r){for(var a=t.length,i=o+-1;++i<a;)if(p(t[i],i,t))return i;return -1}for(var s=o-1,n=t.length;++s<n;)if(t[s]===r)return s;return -1}(t,r,o)>-1}},6782(t){var r=Object.prototype.toString;t.exports=function(t){var o;return!0===t||!1===t||!!(o=t)&&"object"==typeof o&&"[object Boolean]"==r.call(t)}},5250(t){var r=1/0,o=0/0,a=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,n=/^0o[0-7]+$/i,l=parseInt,c=Object.prototype.toString;function u(t){var r=typeof t;return!!t&&("object"==r||"function"==r)}t.exports=function(t){var d,p,h;return"number"==typeof t&&t==(h=(p=(d=t)?(d=function(t){if("number"==typeof t)return t;if("symbol"==typeof(r=t)||r&&"object"==typeof r&&"[object Symbol]"==c.call(r))return o;if(u(t)){var r,d="function"==typeof t.valueOf?t.valueOf():t;t=u(d)?d+"":d}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(a,"");var p=s.test(t);return p||n.test(t)?l(t.slice(2),p?2:8):i.test(t)?o:+t}(d))===r||d===-r?(d<0?-1:1)*17976931348623157e292:d==d?d:0:0===d?d:0)%1,p==p?h?p-h:p:0)}},8094(t){var r=Object.prototype.toString;t.exports=function(t){return"number"==typeof t||!!t&&"object"==typeof t&&"[object Number]"==r.call(t)}},6052(t){var r,o,a=Object.prototype,i=Function.prototype.toString,s=a.hasOwnProperty,n=i.call(Object),l=a.toString,c=(r=Object.getPrototypeOf,o=Object,function(t){return r(o(t))});t.exports=function(t){if(!(t&&"object"==typeof t)||"[object Object]"!=l.call(t)||function(t){var r=!1;if(null!=t&&"function"!=typeof t.toString)try{r=!!(t+"")}catch(t){}return r}(t))return!1;var r=c(t);if(null===r)return!0;var o=s.call(r,"constructor")&&r.constructor;return"function"==typeof o&&o instanceof o&&i.call(o)==n}},1251(t){var r=Object.prototype.toString,o=Array.isArray;t.exports=function(t){var a;return"string"==typeof t||!o(t)&&!!(a=t)&&"object"==typeof a&&"[object String]"==r.call(t)}},8430(t){var r=1/0,o=0/0,a=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,n=/^0o[0-7]+$/i,l=parseInt,c=Object.prototype.toString;function u(t){var r=typeof t;return!!t&&("object"==r||"function"==r)}t.exports=function(t){var d,p,h,f,m=2,y=t;if("function"!=typeof y)throw TypeError("Expected a function");return h=(p=(d=m)?(d=function(t){if("number"==typeof t)return t;if("symbol"==typeof(r=t)||r&&"object"==typeof r&&"[object Symbol]"==c.call(r))return o;if(u(t)){var r,d="function"==typeof t.valueOf?t.valueOf():t;t=u(d)?d+"":d}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(a,"");var p=s.test(t);return p||n.test(t)?l(t.slice(2),p?2:8):i.test(t)?o:+t}(d))===r||d===-r?(d<0?-1:1)*17976931348623157e292:d==d?d:0:0===d?d:0)%1,m=p==p?h?p-h:p:0,function(){return--m>0&&(f=y.apply(this,arguments)),m<=1&&(y=void 0),f}}},3866(t){function r(t,r,o,a){return Math.round(t/o)+" "+a+(r>=1.5*o?"s":"")}t.exports=function(t,o){o=o||{};var a,i,s,n,l=typeof t;if("string"===l&&t.length>0){var c=t;if(!((c=String(c)).length>100)){var u=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(c);if(u){var d=parseFloat(u[1]);switch((u[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*d;case"weeks":case"week":case"w":return 6048e5*d;case"days":case"day":case"d":return 864e5*d;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*d;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*d;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*d;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return d;default:break}}}return}if("number"===l&&isFinite(t)){return o.long?(i=Math.abs(a=t))>=864e5?r(a,i,864e5,"day"):i>=36e5?r(a,i,36e5,"hour"):i>=6e4?r(a,i,6e4,"minute"):i>=1e3?r(a,i,1e3,"second"):a+" ms":(n=Math.abs(s=t))>=864e5?Math.round(s/864e5)+"d":n>=36e5?Math.round(s/36e5)+"h":n>=6e4?Math.round(s/6e4)+"m":n>=1e3?Math.round(s/1e3)+"s":s+"ms"}throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},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},6608(t,r,o){var a=o(181),i=a.Buffer;function s(t,r){for(var o in t)r[o]=t[o]}function n(t,r,o){return i(t,r,o)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=a:(s(a,r),r.Buffer=n),n.prototype=Object.create(i.prototype),s(i,n),n.from=function(t,r,o){if("number"==typeof t)throw TypeError("Argument must not be a number");return i(t,r,o)},n.alloc=function(t,r,o){if("number"!=typeof t)throw TypeError("Argument must be a number");var a=i(t);return void 0!==r?"string"==typeof o?a.fill(r,o):a.fill(r):a.fill(0),a},n.allocUnsafe=function(t){if("number"!=typeof t)throw TypeError("Argument must be a number");return i(t)},n.allocUnsafeSlow=function(t){if("number"!=typeof t)throw TypeError("Argument must be a number");return a.SlowBuffer(t)}},8610(t,r,o){"use strict";let a=Symbol("SemVer ANY");class i{static get ANY(){return a}constructor(t,r){if(r=s(r),t instanceof i)if(!!r.loose===t.loose)return t;else t=t.value;u("comparator",t=t.trim().split(/\s+/).join(" "),r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===a?this.value="":this.value=this.operator+this.semver.version,u("comp",this)}parse(t){let r=this.options.loose?n[l.COMPARATORLOOSE]:n[l.COMPARATOR],o=t.match(r);if(!o)throw TypeError(`Invalid comparator: ${t}`);this.operator=void 0!==o[1]?o[1]:"","="===this.operator&&(this.operator=""),o[2]?this.semver=new d(o[2],this.options.loose):this.semver=a}toString(){return this.value}test(t){if(u("Comparator.test",t,this.options.loose),this.semver===a||t===a)return!0;if("string"==typeof t)try{t=new d(t,this.options)}catch(t){return!1}return c(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof i))throw TypeError("a Comparator is required");return""===this.operator?""===this.value||new p(t.value,r).test(this.value):""===t.operator?""===t.value||new p(this.value,r).test(t.semver):!((r=s(r)).includePrerelease&&("<0.0.0-0"===this.value||"<0.0.0-0"===t.value)||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0")))&&!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||c(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||c(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">"))}}t.exports=i;let s=o(4621),{safeRe:n,t:l}=o(152),c=o(5461),u=o(674),d=o(2398),p=o(2069)},2069(t,r,o){"use strict";let a=/\s+/g;class i{constructor(t,r){if(r=n(r),t instanceof i)if(!!r.loose===t.loose&&!!r.includePrerelease===t.includePrerelease)return t;else return new i(t.raw,r);if(t instanceof l)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(a," "),this.set=this.raw.split("||").map(t=>this.parseRange(t.trim())).filter(t=>t.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const t=this.set[0];if(this.set=this.set.filter(t=>!v(t[0])),0===this.set.length)this.set=[t];else if(this.set.length>1){for(const t of this.set)if(1===t.length&&b(t[0])){this.set=[t];break}}}this.formatted=void 0}get range(){if(void 0===this.formatted){this.formatted="";for(let t=0;t<this.set.length;t++){t>0&&(this.formatted+="||");let r=this.set[t];for(let t=0;t<r.length;t++)t>0&&(this.formatted+=" "),this.formatted+=r[t].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(t){let r=((this.options.includePrerelease&&y)|(this.options.loose&&g))+":"+t,o=s.get(r);if(o)return o;let a=this.options.loose,i=a?d[p.HYPHENRANGELOOSE]:d[p.HYPHENRANGE];c("hyphen replace",t=t.replace(i,j(this.options.includePrerelease))),c("comparator trim",t=t.replace(d[p.COMPARATORTRIM],h)),c("tilde trim",t=t.replace(d[p.TILDETRIM],f)),c("caret trim",t=t.replace(d[p.CARETTRIM],m));let n=t.split(" ").map(t=>S(t,this.options)).join(" ").split(/\s+/).map(t=>x(t,this.options));a&&(n=n.filter(t=>(c("loose invalid filter",t,this.options),!!t.match(d[p.COMPARATORLOOSE])))),c("range list",n);let u=new Map;for(let t of n.map(t=>new l(t,this.options))){if(v(t))return[t];u.set(t.value,t)}u.size>1&&u.has("")&&u.delete("");let b=[...u.values()];return s.set(r,b),b}intersects(t,r){if(!(t instanceof i))throw TypeError("a Range is required");return this.set.some(o=>_(o,r)&&t.set.some(t=>_(t,r)&&o.every(o=>t.every(t=>o.intersects(t,r)))))}test(t){if(!t)return!1;if("string"==typeof t)try{t=new u(t,this.options)}catch(t){return!1}for(let r=0;r<this.set.length;r++)if(C(this.set[r],t,this.options))return!0;return!1}}t.exports=i;let s=new(o(2044)),n=o(4621),l=o(8610),c=o(674),u=o(2398),{safeRe:d,t:p,comparatorTrimReplace:h,tildeTrimReplace:f,caretTrimReplace:m}=o(152),{FLAG_INCLUDE_PRERELEASE:y,FLAG_LOOSE:g}=o(5076),v=t=>"<0.0.0-0"===t.value,b=t=>""===t.value,_=(t,r)=>{let o=!0,a=t.slice(),i=a.pop();for(;o&&a.length;)o=a.every(t=>i.intersects(t,r)),i=a.pop();return o},S=(t,r)=>(c("comp",t=t.replace(d[p.BUILD],""),r),c("caret",t=R(t,r)),c("tildes",t=w(t,r)),c("xrange",t=k(t,r)),c("stars",t=T(t,r)),t),$=t=>!t||"x"===t.toLowerCase()||"*"===t,w=(t,r)=>t.trim().split(/\s+/).map(t=>E(t,r)).join(" "),E=(t,r)=>{let o=r.loose?d[p.TILDELOOSE]:d[p.TILDE];return t.replace(o,(r,o,a,i,s)=>{let n;return c("tilde",t,r,o,a,i,s),$(o)?n="":$(a)?n=`>=${o}.0.0 <${+o+1}.0.0-0`:$(i)?n=`>=${o}.${a}.0 <${o}.${+a+1}.0-0`:s?(c("replaceTilde pr",s),n=`>=${o}.${a}.${i}-${s} <${o}.${+a+1}.0-0`):n=`>=${o}.${a}.${i} <${o}.${+a+1}.0-0`,c("tilde return",n),n})},R=(t,r)=>t.trim().split(/\s+/).map(t=>P(t,r)).join(" "),P=(t,r)=>{c("caret",t,r);let o=r.loose?d[p.CARETLOOSE]:d[p.CARET],a=r.includePrerelease?"-0":"";return t.replace(o,(r,o,i,s,n)=>{let l;return c("caret",t,r,o,i,s,n),$(o)?l="":$(i)?l=`>=${o}.0.0${a} <${+o+1}.0.0-0`:$(s)?l="0"===o?`>=${o}.${i}.0${a} <${o}.${+i+1}.0-0`:`>=${o}.${i}.0${a} <${+o+1}.0.0-0`:n?(c("replaceCaret pr",n),l="0"===o?"0"===i?`>=${o}.${i}.${s}-${n} <${o}.${i}.${+s+1}-0`:`>=${o}.${i}.${s}-${n} <${o}.${+i+1}.0-0`:`>=${o}.${i}.${s}-${n} <${+o+1}.0.0-0`):(c("no pr"),l="0"===o?"0"===i?`>=${o}.${i}.${s}${a} <${o}.${i}.${+s+1}-0`:`>=${o}.${i}.${s}${a} <${o}.${+i+1}.0-0`:`>=${o}.${i}.${s} <${+o+1}.0.0-0`),c("caret return",l),l})},k=(t,r)=>(c("replaceXRanges",t,r),t.split(/\s+/).map(t=>O(t,r)).join(" ")),O=(t,r)=>{t=t.trim();let o=r.loose?d[p.XRANGELOOSE]:d[p.XRANGE];return t.replace(o,(o,a,i,s,n,l)=>{c("xRange",t,o,a,i,s,n,l);let u=$(i),d=u||$(s),p=d||$(n);return"="===a&&p&&(a=""),l=r.includePrerelease?"-0":"",u?o=">"===a||"<"===a?"<0.0.0-0":"*":a&&p?(d&&(s=0),n=0,">"===a?(a=">=",d?(i=+i+1,s=0):s=+s+1,n=0):"<="===a&&(a="<",d?i=+i+1:s=+s+1),"<"===a&&(l="-0"),o=`${a+i}.${s}.${n}${l}`):d?o=`>=${i}.0.0${l} <${+i+1}.0.0-0`:p&&(o=`>=${i}.${s}.0${l} <${i}.${+s+1}.0-0`),c("xRange return",o),o})},T=(t,r)=>(c("replaceStars",t,r),t.trim().replace(d[p.STAR],"")),x=(t,r)=>(c("replaceGTE0",t,r),t.trim().replace(d[r.includePrerelease?p.GTE0PRE:p.GTE0],"")),j=t=>(r,o,a,i,s,n,l,c,u,d,p,h)=>(o=$(a)?"":$(i)?`>=${a}.0.0${t?"-0":""}`:$(s)?`>=${a}.${i}.0${t?"-0":""}`:n?`>=${o}`:`>=${o}${t?"-0":""}`,c=$(u)?"":$(d)?`<${+u+1}.0.0-0`:$(p)?`<${u}.${+d+1}.0-0`:h?`<=${u}.${d}.${p}-${h}`:t?`<${u}.${d}.${+p+1}-0`:`<=${c}`,`${o} ${c}`.trim()),C=(t,r,o)=>{for(let o=0;o<t.length;o++)if(!t[o].test(r))return!1;if(r.prerelease.length&&!o.includePrerelease){for(let o=0;o<t.length;o++)if(c(t[o].semver),t[o].semver!==l.ANY&&t[o].semver.prerelease.length>0){let a=t[o].semver;if(a.major===r.major&&a.minor===r.minor&&a.patch===r.patch)return!0}return!1}return!0}},2398(t,r,o){"use strict";let a=o(674),{MAX_LENGTH:i,MAX_SAFE_INTEGER:s}=o(5076),{safeRe:n,t:l}=o(152),c=o(4621),{compareIdentifiers:u}=o(9101);class d{constructor(t,r){if(r=c(r),t instanceof d)if(!!r.loose===t.loose&&!!r.includePrerelease===t.includePrerelease)return t;else t=t.version;else if("string"!=typeof t)throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>i)throw TypeError(`version is longer than ${i} characters`);a("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const o=t.trim().match(r.loose?n[l.LOOSE]:n[l.FULL]);if(!o)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+o[1],this.minor=+o[2],this.patch=+o[3],this.major>s||this.major<0)throw TypeError("Invalid major version");if(this.minor>s||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>s||this.patch<0)throw TypeError("Invalid patch version");o[4]?this.prerelease=o[4].split(".").map(t=>{if(/^[0-9]+$/.test(t)){let r=+t;if(r>=0&&r<s)return r}return t}):this.prerelease=[],this.build=o[5]?o[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(a("SemVer.compare",this.version,this.options,t),!(t instanceof d)){if("string"==typeof t&&t===this.version)return 0;t=new d(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return(t instanceof d||(t=new d(t,this.options)),this.major<t.major)?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:+(this.patch>t.patch)}comparePre(t){if(t instanceof d||(t=new d(t,this.options)),this.prerelease.length&&!t.prerelease.length)return -1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let o=this.prerelease[r],i=t.prerelease[r];if(a("prerelease compare",r,o,i),void 0===o&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===o)return -1;else if(o===i)continue;else return u(o,i)}while(++r)}compareBuild(t){t instanceof d||(t=new d(t,this.options));let r=0;do{let o=this.build[r],i=t.build[r];if(a("build compare",r,o,i),void 0===o&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===o)return -1;else if(o===i)continue;else return u(o,i)}while(++r)}inc(t,r,o){if(t.startsWith("pre")){if(!r&&!1===o)throw Error("invalid increment argument: identifier is empty");if(r){let t=`-${r}`.match(this.options.loose?n[l.PRERELEASELOOSE]:n[l.PRERELEASE]);if(!t||t[1]!==r)throw Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,o);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,o);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,o),this.inc("pre",r,o);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",r,o),this.inc("pre",r,o);break;case"release":if(0===this.prerelease.length)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(0!==this.minor||0!==this.patch||0===this.prerelease.length)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(0!==this.patch||0===this.prerelease.length)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{let t=+!!Number(o);if(0===this.prerelease.length)this.prerelease=[t];else{let a=this.prerelease.length;for(;--a>=0;)"number"==typeof this.prerelease[a]&&(this.prerelease[a]++,a=-2);if(-1===a){if(r===this.prerelease.join(".")&&!1===o)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(t)}}if(r){let a=[r,t];!1===o&&(a=[r]),0===u(this.prerelease[0],r)?isNaN(this.prerelease[1])&&(this.prerelease=a):this.prerelease=a}break}default:throw Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}t.exports=d},5608(t,r,o){"use strict";let a=o(6802);t.exports=(t,r)=>{let o=a(t.trim().replace(/^[=v]+/,""),r);return o?o.version:null}},5461(t,r,o){"use strict";let a=o(8271),i=o(733),s=o(1686),n=o(6479),l=o(7257),c=o(5850);t.exports=(t,r,o,u)=>{switch(r){case"===":return"object"==typeof t&&(t=t.version),"object"==typeof o&&(o=o.version),t===o;case"!==":return"object"==typeof t&&(t=t.version),"object"==typeof o&&(o=o.version),t!==o;case"":case"=":case"==":return a(t,o,u);case"!=":return i(t,o,u);case">":return s(t,o,u);case">=":return n(t,o,u);case"<":return l(t,o,u);case"<=":return c(t,o,u);default:throw TypeError(`Invalid operator: ${r}`)}}},7771(t,r,o){"use strict";let a=o(2398),i=o(6802),{safeRe:s,t:n}=o(152);t.exports=(t,r)=>{if(t instanceof a)return t;if("number"==typeof t&&(t=String(t)),"string"!=typeof t)return null;let o=null;if((r=r||{}).rtl){let a,i=r.includePrerelease?s[n.COERCERTLFULL]:s[n.COERCERTL];for(;(a=i.exec(t))&&(!o||o.index+o[0].length!==t.length);)o&&a.index+a[0].length===o.index+o[0].length||(o=a),i.lastIndex=a.index+a[1].length+a[2].length;i.lastIndex=-1}else o=t.match(r.includePrerelease?s[n.COERCEFULL]:s[n.COERCE]);if(null===o)return null;let l=o[2],c=o[3]||"0",u=o[4]||"0",d=r.includePrerelease&&o[5]?`-${o[5]}`:"",p=r.includePrerelease&&o[6]?`+${o[6]}`:"";return i(`${l}.${c}.${u}${d}${p}`,r)}},8767(t,r,o){"use strict";let a=o(2398);t.exports=(t,r,o)=>{let i=new a(t,o),s=new a(r,o);return i.compare(s)||i.compareBuild(s)}},6293(t,r,o){"use strict";let a=o(6958);t.exports=(t,r)=>a(t,r,!0)},6958(t,r,o){"use strict";let a=o(2398);t.exports=(t,r,o)=>new a(t,o).compare(new a(r,o))},3086(t,r,o){"use strict";let a=o(6802);t.exports=(t,r)=>{let o=a(t,null,!0),i=a(r,null,!0),s=o.compare(i);if(0===s)return null;let n=s>0,l=n?o:i,c=n?i:o,u=!!l.prerelease.length;if(c.prerelease.length&&!u){if(!c.patch&&!c.minor)return"major";if(0===c.compareMain(l))return c.minor&&!c.patch?"minor":"patch"}let d=u?"pre":"";return o.major!==i.major?d+"major":o.minor!==i.minor?d+"minor":o.patch!==i.patch?d+"patch":"prerelease"}},8271(t,r,o){"use strict";let a=o(6958);t.exports=(t,r,o)=>0===a(t,r,o)},1686(t,r,o){"use strict";let a=o(6958);t.exports=(t,r,o)=>a(t,r,o)>0},6479(t,r,o){"use strict";let a=o(6958);t.exports=(t,r,o)=>a(t,r,o)>=0},3625(t,r,o){"use strict";let a=o(2398);t.exports=(t,r,o,i,s)=>{"string"==typeof o&&(s=i,i=o,o=void 0);try{return new a(t instanceof a?t.version:t,o).inc(r,i,s).version}catch(t){return null}}},7257(t,r,o){"use strict";let a=o(6958);t.exports=(t,r,o)=>0>a(t,r,o)},5850(t,r,o){"use strict";let a=o(6958);t.exports=(t,r,o)=>0>=a(t,r,o)},7744(t,r,o){"use strict";let a=o(2398);t.exports=(t,r)=>new a(t,r).major},4812(t,r,o){"use strict";let a=o(2398);t.exports=(t,r)=>new a(t,r).minor},733(t,r,o){"use strict";let a=o(6958);t.exports=(t,r,o)=>0!==a(t,r,o)},6802(t,r,o){"use strict";let a=o(2398);t.exports=(t,r,o=!1)=>{if(t instanceof a)return t;try{return new a(t,r)}catch(t){if(!o)return null;throw t}}},8643(t,r,o){"use strict";let a=o(2398);t.exports=(t,r)=>new a(t,r).patch},9283(t,r,o){"use strict";let a=o(6802);t.exports=(t,r)=>{let o=a(t,r);return o&&o.prerelease.length?o.prerelease:null}},7032(t,r,o){"use strict";let a=o(6958);t.exports=(t,r,o)=>a(r,t,o)},9839(t,r,o){"use strict";let a=o(8767);t.exports=(t,r)=>t.sort((t,o)=>a(o,t,r))},4056(t,r,o){"use strict";let a=o(2069);t.exports=(t,r,o)=>{try{r=new a(r,o)}catch(t){return!1}return r.test(t)}},7697(t,r,o){"use strict";let a=o(8767);t.exports=(t,r)=>t.sort((t,o)=>a(t,o,r))},6807(t,r,o){"use strict";let a=o(6802);t.exports=(t,r)=>{let o=a(t,r);return o?o.version:null}},3895(t,r,o){"use strict";let a=o(152),i=o(5076),s=o(2398),n=o(9101),l=o(6802),c=o(6807),u=o(5608),d=o(3625),p=o(3086),h=o(7744),f=o(4812),m=o(8643),y=o(9283),g=o(6958),v=o(7032),b=o(6293),_=o(8767),S=o(7697),$=o(9839),w=o(1686),E=o(7257),R=o(8271),P=o(733),k=o(6479),O=o(5850),T=o(5461),x=o(7771),j=o(8610),C=o(2069),N=o(4056),I=o(6613),A=o(7114),M=o(1008),q=o(203),z=o(5372),L=o(4713),D=o(4497),U=o(9272),V=o(3490);t.exports={parse:l,valid:c,clean:u,inc:d,diff:p,major:h,minor:f,patch:m,prerelease:y,compare:g,rcompare:v,compareLoose:b,compareBuild:_,sort:S,rsort:$,gt:w,lt:E,eq:R,neq:P,gte:k,lte:O,cmp:T,coerce:x,Comparator:j,Range:C,satisfies:N,toComparators:I,maxSatisfying:A,minSatisfying:M,minVersion:q,validRange:z,outside:L,gtr:D,ltr:U,intersects:V,simplifyRange:o(4039),subset:o(22),SemVer:s,re:a.re,src:a.src,tokens:a.t,SEMVER_SPEC_VERSION:i.SEMVER_SPEC_VERSION,RELEASE_TYPES:i.RELEASE_TYPES,compareIdentifiers:n.compareIdentifiers,rcompareIdentifiers:n.rcompareIdentifiers}},5076(t){"use strict";t.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||0x1fffffffffffff,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}},674(t){"use strict";t.exports="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{}},9101(t){"use strict";let r=/^[0-9]+$/,o=(t,o)=>{if("number"==typeof t&&"number"==typeof o)return t===o?0:t<o?-1:1;let a=r.test(t),i=r.test(o);return a&&i&&(t*=1,o*=1),t===o?0:a&&!i?-1:i&&!a?1:t<o?-1:1};t.exports={compareIdentifiers:o,rcompareIdentifiers:(t,r)=>o(r,t)}},2044(t){"use strict";t.exports=class{constructor(){this.max=1e3,this.map=new Map}get(t){let r=this.map.get(t);if(void 0!==r)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&void 0!==r){if(this.map.size>=this.max){let t=this.map.keys().next().value;this.delete(t)}this.map.set(t,r)}return this}}},4621(t){"use strict";let r=Object.freeze({loose:!0}),o=Object.freeze({});t.exports=t=>t?"object"!=typeof t?r:t:o},152(t,r,o){"use strict";let{MAX_SAFE_COMPONENT_LENGTH:a,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:s}=o(5076),n=o(674),l=(r=t.exports={}).re=[],c=r.safeRe=[],u=r.src=[],d=r.safeSrc=[],p=r.t={},h=0,f="[a-zA-Z0-9-]",m=[["\\s",1],["\\d",s],[f,i]],y=(t,r,o)=>{let a=(t=>{for(let[r,o]of m)t=t.split(`${r}*`).join(`${r}{0,${o}}`).split(`${r}+`).join(`${r}{1,${o}}`);return t})(r),i=h++;n(t,i,r),p[t]=i,u[i]=r,d[i]=a,l[i]=new RegExp(r,o?"g":void 0),c[i]=new RegExp(a,o?"g":void 0)};y("NUMERICIDENTIFIER","0|[1-9]\\d*"),y("NUMERICIDENTIFIERLOOSE","\\d+"),y("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f}*`),y("MAINVERSION",`(${u[p.NUMERICIDENTIFIER]})\\.(${u[p.NUMERICIDENTIFIER]})\\.(${u[p.NUMERICIDENTIFIER]})`),y("MAINVERSIONLOOSE",`(${u[p.NUMERICIDENTIFIERLOOSE]})\\.(${u[p.NUMERICIDENTIFIERLOOSE]})\\.(${u[p.NUMERICIDENTIFIERLOOSE]})`),y("PRERELEASEIDENTIFIER",`(?:${u[p.NONNUMERICIDENTIFIER]}|${u[p.NUMERICIDENTIFIER]})`),y("PRERELEASEIDENTIFIERLOOSE",`(?:${u[p.NONNUMERICIDENTIFIER]}|${u[p.NUMERICIDENTIFIERLOOSE]})`),y("PRERELEASE",`(?:-(${u[p.PRERELEASEIDENTIFIER]}(?:\\.${u[p.PRERELEASEIDENTIFIER]})*))`),y("PRERELEASELOOSE",`(?:-?(${u[p.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[p.PRERELEASEIDENTIFIERLOOSE]})*))`),y("BUILDIDENTIFIER",`${f}+`),y("BUILD",`(?:\\+(${u[p.BUILDIDENTIFIER]}(?:\\.${u[p.BUILDIDENTIFIER]})*))`),y("FULLPLAIN",`v?${u[p.MAINVERSION]}${u[p.PRERELEASE]}?${u[p.BUILD]}?`),y("FULL",`^${u[p.FULLPLAIN]}$`),y("LOOSEPLAIN",`[v=\\s]*${u[p.MAINVERSIONLOOSE]}${u[p.PRERELEASELOOSE]}?${u[p.BUILD]}?`),y("LOOSE",`^${u[p.LOOSEPLAIN]}$`),y("GTLT","((?:<|>)?=?)"),y("XRANGEIDENTIFIERLOOSE",`${u[p.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),y("XRANGEIDENTIFIER",`${u[p.NUMERICIDENTIFIER]}|x|X|\\*`),y("XRANGEPLAIN",`[v=\\s]*(${u[p.XRANGEIDENTIFIER]})(?:\\.(${u[p.XRANGEIDENTIFIER]})(?:\\.(${u[p.XRANGEIDENTIFIER]})(?:${u[p.PRERELEASE]})?${u[p.BUILD]}?)?)?`),y("XRANGEPLAINLOOSE",`[v=\\s]*(${u[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[p.XRANGEIDENTIFIERLOOSE]})(?:${u[p.PRERELEASELOOSE]})?${u[p.BUILD]}?)?)?`),y("XRANGE",`^${u[p.GTLT]}\\s*${u[p.XRANGEPLAIN]}$`),y("XRANGELOOSE",`^${u[p.GTLT]}\\s*${u[p.XRANGEPLAINLOOSE]}$`),y("COERCEPLAIN",`(^|[^\\d])(\\d{1,${a}})(?:\\.(\\d{1,${a}}))?(?:\\.(\\d{1,${a}}))?`),y("COERCE",`${u[p.COERCEPLAIN]}(?:$|[^\\d])`),y("COERCEFULL",u[p.COERCEPLAIN]+`(?:${u[p.PRERELEASE]})?`+`(?:${u[p.BUILD]})?`+"(?:$|[^\\d])"),y("COERCERTL",u[p.COERCE],!0),y("COERCERTLFULL",u[p.COERCEFULL],!0),y("LONETILDE","(?:~>?)"),y("TILDETRIM",`(\\s*)${u[p.LONETILDE]}\\s+`,!0),r.tildeTrimReplace="$1~",y("TILDE",`^${u[p.LONETILDE]}${u[p.XRANGEPLAIN]}$`),y("TILDELOOSE",`^${u[p.LONETILDE]}${u[p.XRANGEPLAINLOOSE]}$`),y("LONECARET","(?:\\^)"),y("CARETTRIM",`(\\s*)${u[p.LONECARET]}\\s+`,!0),r.caretTrimReplace="$1^",y("CARET",`^${u[p.LONECARET]}${u[p.XRANGEPLAIN]}$`),y("CARETLOOSE",`^${u[p.LONECARET]}${u[p.XRANGEPLAINLOOSE]}$`),y("COMPARATORLOOSE",`^${u[p.GTLT]}\\s*(${u[p.LOOSEPLAIN]})$|^$`),y("COMPARATOR",`^${u[p.GTLT]}\\s*(${u[p.FULLPLAIN]})$|^$`),y("COMPARATORTRIM",`(\\s*)${u[p.GTLT]}\\s*(${u[p.LOOSEPLAIN]}|${u[p.XRANGEPLAIN]})`,!0),r.comparatorTrimReplace="$1$2$3",y("HYPHENRANGE",`^\\s*(${u[p.XRANGEPLAIN]})\\s+-\\s+(${u[p.XRANGEPLAIN]})\\s*$`),y("HYPHENRANGELOOSE",`^\\s*(${u[p.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[p.XRANGEPLAINLOOSE]})\\s*$`),y("STAR","(<|>)?=?\\s*\\*"),y("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),y("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")},4497(t,r,o){"use strict";let a=o(4713);t.exports=(t,r,o)=>a(t,r,">",o)},3490(t,r,o){"use strict";let a=o(2069);t.exports=(t,r,o)=>(t=new a(t,o),r=new a(r,o),t.intersects(r,o))},9272(t,r,o){"use strict";let a=o(4713);t.exports=(t,r,o)=>a(t,r,"<",o)},7114(t,r,o){"use strict";let a=o(2398),i=o(2069);t.exports=(t,r,o)=>{let s=null,n=null,l=null;try{l=new i(r,o)}catch(t){return null}return t.forEach(t=>{l.test(t)&&(!s||-1===n.compare(t))&&(n=new a(s=t,o))}),s}},1008(t,r,o){"use strict";let a=o(2398),i=o(2069);t.exports=(t,r,o)=>{let s=null,n=null,l=null;try{l=new i(r,o)}catch(t){return null}return t.forEach(t=>{l.test(t)&&(!s||1===n.compare(t))&&(n=new a(s=t,o))}),s}},203(t,r,o){"use strict";let a=o(2398),i=o(2069),s=o(1686);t.exports=(t,r)=>{t=new i(t,r);let o=new a("0.0.0");if(t.test(o)||(o=new a("0.0.0-0"),t.test(o)))return o;o=null;for(let r=0;r<t.set.length;++r){let i=t.set[r],n=null;i.forEach(t=>{let r=new a(t.semver.version);switch(t.operator){case">":0===r.prerelease.length?r.patch++:r.prerelease.push(0),r.raw=r.format();case"":case">=":(!n||s(r,n))&&(n=r);break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${t.operator}`)}}),n&&(!o||s(o,n))&&(o=n)}return o&&t.test(o)?o:null}},4713(t,r,o){"use strict";let a=o(2398),i=o(8610),{ANY:s}=i,n=o(2069),l=o(4056),c=o(1686),u=o(7257),d=o(5850),p=o(6479);t.exports=(t,r,o,h)=>{let f,m,y,g,v;switch(t=new a(t,h),r=new n(r,h),o){case">":f=c,m=d,y=u,g=">",v=">=";break;case"<":f=u,m=p,y=c,g="<",v="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(l(t,r,h))return!1;for(let o=0;o<r.set.length;++o){let a=r.set[o],n=null,l=null;if(a.forEach(t=>{t.semver===s&&(t=new i(">=0.0.0")),n=n||t,l=l||t,f(t.semver,n.semver,h)?n=t:y(t.semver,l.semver,h)&&(l=t)}),n.operator===g||n.operator===v||(!l.operator||l.operator===g)&&m(t,l.semver)||l.operator===v&&y(t,l.semver))return!1}return!0}},4039(t,r,o){"use strict";let a=o(4056),i=o(6958);t.exports=(t,r,o)=>{let s=[],n=null,l=null,c=t.sort((t,r)=>i(t,r,o));for(let t of c)a(t,r,o)?(l=t,n||(n=t)):(l&&s.push([n,l]),l=null,n=null);n&&s.push([n,null]);let u=[];for(let[t,r]of s)t===r?u.push(t):r||t!==c[0]?r?t===c[0]?u.push(`<=${r}`):u.push(`${t} - ${r}`):u.push(`>=${t}`):u.push("*");let d=u.join(" || "),p="string"==typeof r.raw?r.raw:String(r);return d.length<p.length?d:r}},22(t,r,o){"use strict";let a=o(2069),i=o(8610),{ANY:s}=i,n=o(4056),l=o(6958),c=[new i(">=0.0.0-0")],u=[new i(">=0.0.0")],d=(t,r,o)=>{let a,i,d,f,m,y,g;if(t===r)return!0;if(1===t.length&&t[0].semver===s)if(1===r.length&&r[0].semver===s)return!0;else t=o.includePrerelease?c:u;if(1===r.length&&r[0].semver===s)if(o.includePrerelease)return!0;else r=u;let v=new Set;for(let r of t)">"===r.operator||">="===r.operator?a=p(a,r,o):"<"===r.operator||"<="===r.operator?i=h(i,r,o):v.add(r.semver);if(v.size>1)return null;if(a&&i&&((d=l(a.semver,i.semver,o))>0||0===d&&(">="!==a.operator||"<="!==i.operator)))return null;for(let t of v){if(a&&!n(t,String(a),o)||i&&!n(t,String(i),o))return null;for(let a of r)if(!n(t,String(a),o))return!1;return!0}let b=!!i&&!o.includePrerelease&&!!i.semver.prerelease.length&&i.semver,_=!!a&&!o.includePrerelease&&!!a.semver.prerelease.length&&a.semver;for(let t of(b&&1===b.prerelease.length&&"<"===i.operator&&0===b.prerelease[0]&&(b=!1),r)){if(g=g||">"===t.operator||">="===t.operator,y=y||"<"===t.operator||"<="===t.operator,a){if(_&&t.semver.prerelease&&t.semver.prerelease.length&&t.semver.major===_.major&&t.semver.minor===_.minor&&t.semver.patch===_.patch&&(_=!1),">"===t.operator||">="===t.operator){if((f=p(a,t,o))===t&&f!==a)return!1}else if(">="===a.operator&&!n(a.semver,String(t),o))return!1}if(i){if(b&&t.semver.prerelease&&t.semver.prerelease.length&&t.semver.major===b.major&&t.semver.minor===b.minor&&t.semver.patch===b.patch&&(b=!1),"<"===t.operator||"<="===t.operator){if((m=h(i,t,o))===t&&m!==i)return!1}else if("<="===i.operator&&!n(i.semver,String(t),o))return!1}if(!t.operator&&(i||a)&&0!==d)return!1}return(!a||!y||!!i||0===d)&&(!i||!g||!!a||0===d)&&!_&&!b&&!0},p=(t,r,o)=>{if(!t)return r;let a=l(t.semver,r.semver,o);return a>0?t:a<0||">"===r.operator&&">="===t.operator?r:t},h=(t,r,o)=>{if(!t)return r;let a=l(t.semver,r.semver,o);return a<0?t:a>0||"<"===r.operator&&"<="===t.operator?r:t};t.exports=(t,r,o={})=>{if(t===r)return!0;t=new a(t,o),r=new a(r,o);let i=!1;e:for(let a of t.set){for(let t of r.set){let r=d(a,t,o);if(i=i||null!==r,r)continue e}if(i)return!1}return!0}},6613(t,r,o){"use strict";let a=o(2069);t.exports=(t,r)=>new a(t,r).set.map(t=>t.map(t=>t.value).join(" ").trim().split(" "))},5372(t,r,o){"use strict";let a=o(2069);t.exports=(t,r)=>{try{return new a(t,r).range||"*"}catch(t){return null}}},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(" "),s=o.split("/").pop();return"env"===s?i:i?`${s} ${i}`:s}},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),s=a?";":":",n=o(9344),l=t=>Object.assign(Error(`not found: ${t}`),{code:"ENOENT"}),c=(t,r)=>{let o=r.colon||s,i=t.match(/\//)||a&&t.match(/\\/)?[""]:[...a?[process.cwd()]:[],...(r.path||process.env.PATH||"").split(o)],n=a?r.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",l=a?n.split(o):[""];return a&&-1!==t.indexOf(".")&&""!==l[0]&&l.unshift(""),{pathEnv:i,pathExt:l,pathExtExe:n}},u=(t,r,o)=>{"function"==typeof r&&(o=r,r={}),r||(r={});let{pathEnv:a,pathExt:s,pathExtExe:u}=c(t,r),d=[],p=o=>new Promise((s,n)=>{if(o===a.length)return r.all&&d.length?s(d):n(l(t));let c=a[o],u=/^".*"$/.test(c)?c.slice(1,-1):c,p=i.join(u,t);s(h(!u&&/^\.[\\\/]/.test(t)?t.slice(0,2)+p:p,o,0))}),h=(t,o,a)=>new Promise((i,l)=>{if(a===s.length)return i(p(o+1));let c=s[a];n(t+c,{pathExt:u},(s,n)=>{if(!s&&n)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:s}=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(n.sync(o,{pathExt:s}))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)}},181(t){"use strict";t.exports=require("buffer")},5317(t){"use strict";t.exports=require("child_process")},6982(t){"use strict";t.exports=require("crypto")},9896(t){"use strict";t.exports=require("fs")},7598(t){"use strict";t.exports=require("node:crypto")},857(t){"use strict";t.exports=require("os")},6928(t){"use strict";t.exports=require("path")},2203(t){"use strict";t.exports=require("stream")},9023(t){"use strict";t.exports=require("util")},4953(r){"use strict";r.exports=t},4891(t,r,o){"use strict";let a;o.d(r,{importJWK:()=>Z,importPKCS8:()=>G,SignJWT:()=>V});let i=new TextEncoder,s=new TextDecoder;function n(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 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:s.decode(t),{alphabet:"base64url"});let r=t;r instanceof Uint8Array&&(r=s.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=i.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 f extends d{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"}class m 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 b=(t,r,...o)=>v(`Key for the ${t} algorithm must be `,r,...o);async function _(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 a;if(a=t.algorithm,a.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 a=await _(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,a),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,a.algorithm),a,o))}function $(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 w=t=>$(t)&&"string"==typeof t.kty,E=t=>{if(t?.[Symbol.toStringTag]==="CryptoKey")return!0;try{return t instanceof CryptoKey}catch{return!1}},R=t=>t?.[Symbol.toStringTag]==="KeyObject",P=t=>E(t)||R(t),k=t=>t?.[Symbol.toStringTag],O=(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},T='Invalid or unsupported JWK "alg" (Algorithm) Parameter value';async function x(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),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 j="given KeyObject instance cannot be used for this algorithm",C=async(t,r,o,i=!1)=>{let s=(a||=new WeakMap).get(t);if(s?.[o])return s[o];let n=await x({...r,alg:o});return i&&Object.freeze(t),s?s[o]=n:a.set(t,{[o]:n}),n};async function N(t,r){if(t instanceof Uint8Array||E(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,i=(a||=new WeakMap).get(t);if(i?.[r])return i[r];let s="public"===t.type,n=!!s;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(j)}o=t.toCryptoKey(t.asymmetricKeyType,n,s?[]:["deriveBits"])}if("ed25519"===t.asymmetricKeyType){if("EdDSA"!==r&&"Ed25519"!==r)throw TypeError(j);o=t.toCryptoKey(t.asymmetricKeyType,n,[s?"verify":"sign"])}switch(t.asymmetricKeyType){case"ml-dsa-44":case"ml-dsa-65":case"ml-dsa-87":if(r!==t.asymmetricKeyType.toUpperCase())throw TypeError(j);o=t.toCryptoKey(t.asymmetricKeyType,n,[s?"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(j)}if(r.startsWith("RSA-OAEP"))return t.toCryptoKey({name:"RSA-OAEP",hash:a},n,s?["encrypt"]:["decrypt"]);o=t.toCryptoKey({name:r.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:a},n,[s?"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(j);let i={ES256:"P-256",ES384:"P-384",ES512:"P-521"};i[r]&&a===i[r]&&(o=t.toCryptoKey({name:"ECDSA",namedCurve:a},n,[s?"verify":"sign"])),r.startsWith("ECDH-ES")&&(o=t.toCryptoKey({name:"ECDH",namedCurve:a},n,s?[]:["deriveBits"]))}if(!o)throw TypeError(j);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 C(t,o,r)}if(w(t))return t.k?c(t.k):C(t,t,r,!0);throw Error("unreachable")}function I(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 I(this.#t,"setProtectedHeader"),this.#t=t,this}setUnprotectedHeader(t){return I(this.#r,"setUnprotectedHeader"),this.#r=t,this}async sign(t,r){let o,a,i,s;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,a,i){let s;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 n of(s=void 0!==o?new Map([...Object.entries(o),...r.entries()]):r,a.crit)){if(!s.has(n))throw new p(`Extension Header Parameter "${n}" is not recognized`);if(void 0===i[n])throw new t(`Extension Header Parameter "${n}" is missing`);if(s.get(n)&&void 0===a[n])throw new t(`Extension Header Parameter "${n}" MUST be integrity protected`)}return new Set(a.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:f}=l;if("string"!=typeof f||!f)throw new h('JWS "alg" (Algorithm) Header Parameter missing or invalid');var m="sign";switch(f.substring(0,2)){case"A1":case"A2":case"di":case"HS":case"PB":((t,r,o)=>{if(!(r instanceof Uint8Array)){if(w(r)){if("oct"===r.kty&&"string"==typeof r.k&&O(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(!P(r))throw TypeError(b(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"`)}})(f,t,m);break;default:((t,r,o)=>{if(w(r))switch(o){case"decrypt":case"sign":if("oct"!==r.kty&&("AKP"===r.kty&&"string"==typeof r.priv||"string"==typeof r.d)&&O(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&&O(t,r,o))return;throw TypeError("JSON Web Key for this operation must be a public JWK")}if(!P(r))throw TypeError(b(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"`)}})(f,t,m)}d?a=n(o=u(this.#e)):(a=this.#e,o=""),this.#t?s=n(i=u(JSON.stringify(this.#t))):(i="",s=new Uint8Array);let y=function(...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}(s,n("."),a),g=await N(t,f),v={signature:u(await S(f,g,y)),payload:o};return this.#r&&(v.header=this.#r),this.#t&&(v.protected=i),v}}class M{#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),z=/^(\+|\-)? ?(\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=z.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 D(t,r){if(!Number.isFinite(r))throw TypeError(`Invalid ${t} input`);return r}class U{#e;constructor(t){if(!$(t))throw TypeError("JWT Claims Set MUST be an object");this.#e=structuredClone(t)}data(){return i.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;#a;constructor(t={}){this.#a=new U(t)}setIssuer(t){return this.#a.iss=t,this}setSubject(t){return this.#a.sub=t,this}setAudience(t){return this.#a.aud=t,this}setJti(t){return this.#a.jti=t,this}setNotBefore(t){return this.#a.nbf=t,this}setExpirationTime(t){return this.#a.exp=t,this}setIssuedAt(t){return this.#a.iat=t,this}setProtectedHeader(t){return this.#t=t,this}async sign(t,r){let o=new M(this.#a.data());if(o.setProtectedHeader(this.#t),Array.isArray(this.#t?.crit)&&this.#t.crit.includes("b64")&&!1===this.#t.b64)throw new f("JWTs MUST NOT use unencoded payload");return o.sign(t,r)}}let F=(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},H=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},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},B=async(t,r,o,a)=>{let i,s,n="spki"===t,l=()=>n?["verify"]:["sign"];switch(o){case"PS256":case"PS384":case"PS512":i={name:"RSA-PSS",hash:`SHA-${o.slice(-3)}`},s=l();break;case"RS256":case"RS384":case"RS512":i={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${o.slice(-3)}`},s=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}`},s=n?["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]},s=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 p("Invalid or unsupported key format")}s=n?[]:["deriveBits"];break;case"Ed25519":case"EdDSA":i={name:"Ed25519"},s=l();break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":i={name:o},s=l();break;default:throw new p('Invalid or unsupported "alg" (Algorithm) value')}return crypto.subtle.importKey(t,r,i,a?.extractable??!!n,s)};async function G(t,r,o){let a,i,s;if("string"!=typeof t||0!==t.indexOf("-----BEGIN PRIVATE KEY-----"))throw TypeError('"pkcs8" must be PKCS#8 formatted string');return a=/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,i=l(t.replace(a,"")),s=o,r?.startsWith?.("ECDH-ES")&&((s||={}).getNamedCurve=t=>{let r,o={data:t,pos:0};return K(o,48,"Invalid PKCS#8 structure"),H(o),K(o,2,"Expected version field"),r=H(o),o.pos+=r,K(o,48,"Expected algorithm identifier"),H(o),o.pos,(t=>{let r,o=(K(t,6,"Expected algorithm OID"),r=H(t),J(t,r));if(F(o,[43,101,110]))return"X25519";if(!F(o,[42,134,72,206,61,2,1]))throw Error("Unsupported key algorithm");K(t,6,"Expected curve OID");let a=H(t),i=J(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(F(i,r))return t;throw Error("Unsupported named curve")})(o)}),B("pkcs8",i,r,s)}async function Z(t,r,o){let a;if(!$(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 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 x({...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 x({...t,ext:a});case"EC":case"OKP":return x({...t,alg:r,ext:a});default:throw new p('Unsupported "kty" (Key Type) Parameter value')}}},4519(t){"use strict";t.exports=JSON.parse('{"name":"dotenv","version":"16.6.1","description":"Loads environment variables from .env file","main":"lib/main.js","types":"lib/main.d.ts","exports":{".":{"types":"./lib/main.d.ts","require":"./lib/main.js","default":"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},"scripts":{"dts-check":"tsc --project tests/types/tsconfig.json","lint":"standard","pretest":"npm run lint && npm run dts-check","test":"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov","prerelease":"npm test","release":"standard-version"},"repository":{"type":"git","url":"git://github.com/motdotla/dotenv.git"},"homepage":"https://github.com/motdotla/dotenv#readme","funding":"https://dotenvx.com","keywords":["dotenv","env",".env","environment","variables","config","settings"],"readmeFilename":"README.md","license":"BSD-2-Clause","devDependencies":{"@types/node":"^18.11.3","decache":"^4.6.2","sinon":"^14.0.1","standard":"^17.0.0","standard-version":"^9.5.0","tap":"^19.2.0","typescript":"^4.8.4"},"engines":{"node":">=12"},"browser":{"fs":false}}')},8330(t){"use strict";t.exports=JSON.parse('{"name":"xmcp","description":"The MCP framework","version":"1.6.0","author":{"name":"xmcp","email":"support@xmcp.dev","url":"https://xmcp.dev"},"contributors":[{"name":"Valentina Bearzotti","email":"valebearzotti1@gmail.com","url":"https://github.com/valebearzotti"},{"name":"Jose Rago","email":"jose@basement.studio","url":"https://github.com/ragojose"}],"license":"MIT","keywords":["mcp","modelcontextprotocol","http","stdio"],"repository":{"type":"git","url":"https://github.com/basementstudio/xmcp"},"homepage":"https://xmcp.dev","type":"commonjs","main":"./dist/index.js","types":"./dist/index.d.ts","bin":{"xmcp":"dist/cli.js"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js","default":"./dist/index.js"},"./node":{"types":"./dist/node.d.ts","node":"./dist/node.js"},"./host-bridge":{"types":"./dist/host-bridge.d.ts","import":"./dist/host-bridge.js","require":"./dist/host-bridge.js","default":"./dist/host-bridge.js"},"./headers":{"types":"./dist/runtime/headers.d.ts","require":"./dist/runtime/headers.js","default":"./dist/runtime/headers.js"},"./cloudflare":{"types":"./dist/cloudflare.d.ts","import":"./dist/cloudflare.js","require":"./dist/cloudflare.js","default":"./dist/cloudflare.js"},"./config":{"types":"./dist/config/index.d.ts","import":"./dist/config.js","require":"./dist/config.js","default":"./dist/config.js"},"./package.json":"./package.json","./client":{"types":"./dist/client.d.ts","node":"./dist/client.js"}},"typesVersions":{"*":{"node":["dist/node.d.ts"],"host-bridge":["dist/host-bridge.d.ts"],"headers":["dist/runtime/headers.d.ts"],"cloudflare":["dist/cloudflare.d.ts"],"config":["dist/config/index.d.ts"],"client":["dist/client.d.ts"]}},"files":["dist"],"scripts":{"dev":"cross-env NODE_ENV=development tsx --watch --tsconfig ./bundler.tsconfig.json ./bundler/index.ts","build":"cross-env NODE_ENV=production tsx --tsconfig ./bundler.tsconfig.json ./bundler/index.ts","analyze":"cross-env GENERATE_STATS=true pnpm build && pnpm tsx scripts/analyze-rspack-stats.ts","bench":"tsx bench/run.mts","test:config":"pnpm --dir ../compiler test:config","test:adapters":"node --import tsx --test src/runtime/adapters/*/__tests__/*.test.ts","test:runtime":"node --import tsx --test src/runtime/utils/__tests__/*.test.ts src/runtime/utils/ui/__tests__/*.test.ts","test:client":"node --import tsx --test src/client/__tests__/*.test.ts"},"dependencies":{},"devDependencies":{"@modelcontextprotocol/client":"^2.0.0","@modelcontextprotocol/node":"^2.0.0","@modelcontextprotocol/server":"^2.0.0","@nestjs/common":"^11.1.12","@rspack/core":"^1.6.7","@types/async-retry":"^1.4.9","@types/content-type":"^1.1.9","@types/express":"^5.0.6","@types/fs-extra":"^11.0.4","@types/jsonwebtoken":"^9.0.10","@types/node":"^22.19.2","@types/react":"^19.2.7","@types/react-dom":"^19.2.3","async-retry":"^1.3.3","chalk":"^5.6.2","chokidar":"^3.6.0","ci-info":"^4.3.1","commander":"^11.1.0","content-type":"^1.0.5","cross-env":"^7.0.3","del":"^7.1.0","dotenv":"^16.6.1","express":"^4.22.1","fastify":"^5.12.5","fs-extra":"^11.3.2","glob":"^11.1.0","is-docker":"^4.0.0","is-wsl":"^3.1.0","jose":"^6.1.3","json5":"^2.2.3","jsonwebtoken":"^9.0.3","memfs":"^4.51.1","postcss-loader":"^8.2.0","raw-body":"^3.0.2","reflect-metadata":"^0.2.2","rxjs":"^7.8.2","ts-checker-rspack-plugin":"^1.2.1","tsx":"^4.21.0","typescript":"^5.9.3","zod-to-json-schema":"^3.25.0"},"peerDependencies":{"@modelcontextprotocol/client":"^2.0.0","@modelcontextprotocol/server":"^2.0.0","jose":"^6.1.3","react":">=19.0.0","react-dom":">=19.0.0","zod":"^3.25.76 || ^4.0.0"},"peerDependenciesMeta":{"@modelcontextprotocol/client":{"optional":true},"@modelcontextprotocol/server":{"optional":true},"jose":{"optional":true},"react":{"optional":true},"react-dom":{"optional":true}}}')}},i={};function s(t){var r=i[t];if(void 0!==r)return r.exports;var o=i[t]={exports:{}};return a[t](o,o.exports,s),o.exports}s.n=t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return s.d(r,{a:r}),r},o=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,s.t=function(t,a){if(1&a&&(t=this(t)),8&a||"object"==typeof t&&t&&(4&a&&t.__esModule||16&a&&"function"==typeof t.then))return t;var i=Object.create(null);s.r(i);var n={};r=r||[null,o({}),o([]),o(o)];for(var l=2&a&&t;("object"==typeof l||"function"==typeof l)&&!~r.indexOf(l);l=o(l))Object.getOwnPropertyNames(l).forEach(r=>{n[r]=()=>t[r]});return n.default=()=>t,s.d(i,n),i},s.d=(t,r)=>{for(var o in r)s.o(r,o)&&!s.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},s.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r),s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{"use strict";let t,r,o,a,i,l,c,u,d,p,h,f,m,y,g,v,b,_,S;s.r(n),s.d(n,{HOST_CONTEXT_CHANGED_METHOD:()=>yr,isEnvHeader:()=>mJ,createSTDIOClient:()=>mY,INITIALIZE_METHOD:()=>m4,LOG_MESSAGE_METHOD:()=>ye,OPEN_LINK_METHOD:()=>m6,REQUEST_DISPLAY_MODE_METHOD:()=>m3,inputResponse:()=>ch,disconnectSTDIOClient:()=>m1,embeddedResource:()=>G,isInputRequiredResult:()=>l7,callSTDIOClientTool:()=>m0,headersToRecord:()=>mB,MCP_APPS_PROTOCOL_VERSION:()=>m9,extractToolNamesFromRequest:()=>m2,UI_MESSAGE_METHOD:()=>m7,completable:()=>u6,acceptedContent:()=>cp,listSTDIOClientTools:()=>mQ,UPDATE_MODEL_CONTEXT_METHOD:()=>m8,UrlElicitationRequiredError:()=>l9,createRequestStateCodec:()=>de,audio:()=>B,createMcpHostBridge:()=>ys,SIZE_CHANGED_METHOD:()=>yo,image:()=>J,INITIALIZED_METHOD:()=>m5,inputRequired:()=>cd,RESOURCES_READ_METHOD:()=>yt,createContext:()=>H,getRequestContext:()=>X,jwtAuthMiddleware:()=>D,createHTTPClient:()=>mX,apiKeyAuthMiddleware:()=>q});var $,w,E,R,P,k,O,T,x,j,C=s(8583),N=s.n(C),I=s(4953);let A=I.z.object({apiKey:I.z.string().optional(),headerName:I.z.string().optional(),validateApiKey:I.z.function().args(I.z.string()).returns(I.z.promise(I.z.boolean())).optional()}).strict().refine(t=>void 0!==t.apiKey||void 0!==t.validateApiKey,{message:"Either 'apiKey' or 'validateApiKey' must be provided"}).refine(t=>void 0===t.apiKey||void 0===t.validateApiKey,{message:"'apiKey' and 'validateApiKey' are mutually exclusive - provide only one"}),M="Unauthorized: Missing or invalid API key";function q(t){let r=A.safeParse(t);if(!r.success){let o="apiKey"in t,a="validateApiKey"in t;if(o&&a)throw Error("'apiKey' and 'validateApiKey' are mutually exclusive - provide only one");if(o||a)throw Error(`Invalid configuration: ${r.error.message}`);throw Error("Either 'apiKey' or 'validateApiKey' must be provided")}let o=t.headerName??"x-api-key",a="apiKey"in t?t.apiKey:void 0,i="validateApiKey"in t?t.validateApiKey:void 0;return async(r,s,n)=>{let l=r.header(o);!l||"apiKey"in t&&l!==a||i&&!await i(l)?s.status(401).json({error:M}):n()}}var z=s(8400),L=s.n(z);function D(t){return(r,o,a)=>{let i=r.header("Authorization");if(!i||!i.startsWith("Bearer "))return void o.status(401).json({error:"Unauthorized: Missing or malformed Authorization header"});let s=i.slice(7).trim();if(!s)return void o.status(401).json({error:"Unauthorized: Missing access token"});try{let{secret:o,...i}=t;r.user=L().verify(s,o,i),a()}catch(t){o.status(401).json({error:"Unauthorized: Invalid or expired token"})}}}let U=require("async_hooks"),V=(t,r)=>{globalThis[t]=r},F=t=>globalThis[t];function H({name:t,fallback:r=!0}){let o=Symbol.for(`xmcp-context-${t}`),a=Symbol.for(`xmcp-context-${t}-fallback-store`);if(F(o))return F(o);let i=new U.AsyncLocalStorage,s=globalThis[a]??{current:null};V(a,s);let n={provider:(t,o)=>(r&&(s.current=t),i.run(t,o)),getContext:()=>{let o=i.getStore();if(o)return o;if(r&&s.current)return s.current;throw Error(`getContext() can only be used within the ${t} context.`)},setContext:o=>{let a=i.getStore()??(r?s.current:null);if(!a)throw Error(`setContext() can only be used within the ${t} context.`);Object.assign(a,o)}};return V(o,n),n}function K(t){let r;if(t instanceof Uint8Array)r=t;else if(t instanceof ArrayBuffer)r=new Uint8Array(t);else throw TypeError("Expected bytes as a Uint8Array or ArrayBuffer");let o="";for(let t=0;t<r.length;t+=32768)o+=String.fromCharCode(...r.subarray(t,t+32768));return btoa(o)}function J(t,r){return{type:"image",data:K(t),mimeType:r}}function B(t,r){return{type:"audio",data:K(t),mimeType:r}}function G(t,r,o){return{type:"resource",resource:{uri:t,...void 0===o?{}:{mimeType:o},..."string"==typeof r?{text:r}:{blob:K(r)}}}}let Z=H({name:"http-request-context"});Z.setContext,Z.getContext,Z.provider;let W=H({name:"request-context",fallback:!1});function X(){try{return W.getContext()}catch{throw Error("getRequestContext() can only be used while handling an MCP request.")}}var Y=Object.create,Q=Object.defineProperty,ee=Object.getOwnPropertyDescriptor,et=Object.getOwnPropertyNames,er=Object.getPrototypeOf,eo=Object.prototype.hasOwnProperty,ea=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports);function ei(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 es(t,r="|"){return t.map(t=>eO(t)).join(r)}function en(t,r){return"bigint"==typeof r?r.toString():r}class el{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 ec(t){return new el(t)}function eu(t){let r=+!!t.startsWith("^"),o=t.endsWith("$")?t.length-1:t.length;return t.slice(r,o)}let ed=Symbol("evaluating");function ep(t,r,o){Object.defineProperty(t,r,{value:o,writable:!0,enumerable:!0,configurable:!0})}function eh(t){let r=Object.getOwnPropertyDescriptor(t,"shape");return r?.get?r.get.raw:r?.value}function ef(t){return eh(t._zod.def)??t._zod.def.shape}function em(t,r,o){Object.defineProperty(t,r,{get(){let t=o();return ep(this,r,t),t},enumerable:!0,configurable:!0})}function ey(t,r,o){r in t?ep(t,r,o):t[r]=o}function eg(t,r,o,a){let i=ef(r);for(let s of o){let o=Object.getOwnPropertyDescriptor(i,s);o.enumerable&&(o.get?em(t,s,()=>{let t=r._zod.def.shape[s];return a?a(t,s):t}):ey(t,s,a?a(o.value,s):o.value))}}function ev(...t){let r={};for(let o of t)Object.assign(r,Object.getOwnPropertyDescriptors(o));return Object.defineProperties({},r)}let eb="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function e_(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}let eS=ec(()=>{if(e0.jitless||"undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(t){return!1}});function e$(t){if(!1===e_(t))return!1;let r=t.constructor;if(void 0===r||"function"!=typeof r)return!0;let o=r.prototype;return!1!==e_(o)&&!1!==Object.prototype.hasOwnProperty.call(o,"isPrototypeOf")}function ew(t){return e$(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}let eE=new Set(["string","number","symbol"]);function eR(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function eP(t,r,o){let a=new t._zod.constr(r??t._zod.def);return(!r||o?.parent)&&(a._zod.parent=t),a}function ek(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 eO(t){return"bigint"==typeof t?t.toString()+"n":"string"==typeof t?`"${t}"`:`${t}`}let eT={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]},ex={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function ej(t,r){let o=ef(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 eC(t,r){let o={};eg(o,t,Reflect.ownKeys(ef(t)));for(let t of Reflect.ownKeys(r)){let a=Object.getOwnPropertyDescriptor(r,t);a.enumerable&&(a.get?em(o,t,()=>r[t]):ey(o,t,a.value))}return o}function eN(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 s=o?new Set(ej(r,o)):void 0,n={};return eg(n,r,Reflect.ownKeys(ef(r)),t&&((r,o)=>s&&!s.has(o)?r:new t({type:"optional",innerType:r}))),eP(r,ev(r._zod.def,{shape:n,checks:[]}))}function eI(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 eA(t,r){return r.map(r=>(r.path??(r.path=[]),r.path.unshift(t),r))}function eM(t){return"string"==typeof t?t:t?.message}function eq(t,r,o){var a;for(let i=r;i<t.length;i++)(a=t[i]).schema??(a.schema=o)}function ez(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,s=t.message?t.message:eM(t.inst?._zod.def?.error?.(t))??eM(i?.(t))??eM(r?.error?.(t))??eM(o.customError?.(t))??eM(o.localeError?.(t))??"Invalid input",n={};for(let r of Object.keys(t))"inst"!==r&&"schema"!==r&&"continue"!==r&&"input"!==r&&"__proto__"!==r&&(n[r]=t[r]);return n.path??(n.path=[]),n.message=s,r?.reportInput&&(n.input=t.input),n}let eL=/[\uD800-\uDBFF]/;function eD(t){let r=t.length;if(!eL.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 eU(t){return Array.isArray(t)?"array":"string"==typeof t?"string":"unknown"}function eV(...t){let[r,o,a]=t;return"string"==typeof r?{message:r,code:"custom",input:o,inst:a}:{...r}}function eF(t,r,o,a=!0){return Object.defineProperty(t,r,{configurable:!0,writable:!0,enumerable:a,value:o}),o}function eH(t,r){for(let o in t){let a=t[o];Object.defineProperty(r,o,{configurable:!0,enumerable:!0,get(){return eF(this,o,a(this))},set(t){eF(this,o,t)}})}return r}let eK=!1,eJ={configurable:!0,get(){eK=!0}};function eB(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,eJ);let t=eK;eK=!1;try{let r=a(this);return eK?delete this[o]:Object.defineProperty(this,o,{configurable:!0,writable:!0,value:r}),eK=eK||t,r}catch(r){throw delete this[o],eK=eK||t,r}},set(t){Object.defineProperty(this,o,{configurable:!0,writable:!0,value:t})}})}let eG=Object.freeze({status:"aborted"}),eZ={value:void 0,enumerable:!1},eW="captureStackTrace"in Error?Error:null;function eX(t,r,o,a){function i(t){this.def=t,this.constr=u,this.traits=new Set}i.prototype={};let s=o&&new WeakSet;function n(a,n){if(a._zod){if(a._zod.traits.has(t))return}else{eZ.value=new i(n);try{Object.defineProperty(a,"_zod",eZ)}finally{eZ.value=void 0}}if(a._zod.traits.add(t),r(a,n),s){let t=Object.getPrototypeOf(a),r=a._zod.constr.prototype,i=t;for(;i&&i!==r;)i=Object.getPrototypeOf(i);let n=i??t;if(!s.has(n)){s.add(n);for(let t in o){let r=Object.getOwnPropertyDescriptor(o,t);r.get?Object.defineProperty(n,t,{...r,enumerable:!1}):function(t,r,o){Object.defineProperty(t,r,{configurable:!0,get(){return this==null?o:eF(this,r,o.bind(this))},set(t){eF(this,r,t)}})}(n,t,r.value)}}}let l=u.prototype;for(let t in l)Object.prototype.hasOwnProperty.call(l,t)&&(t in a||(a[t]=l[t].bind(a)))}let l=a?.Parent??Object;class c extends l{}function u(t){let r=a?.Parent?function(t){let r=eW;if(r){let o=r.stackTraceLimit;if("number"==typeof o){try{r.stackTraceLimit=0}catch{return eW=null,new t}try{return new t}finally{r.stackTraceLimit=o}}}return new t}(c):this;n(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:n}),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 eY 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"}}(T=globalThis).__zod_globalConfig??(T.__zod_globalConfig={});let e0=globalThis.__zod_globalConfig;function e1(t){return t&&Object.assign(e0,t),e0}class e2 extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}let e9="~memo",e4=[];function e5(t){return null!==t&&"object"==typeof t}function e3(t){return t.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}let e6=new WeakMap,e8=[],e7={alloc(t,o,a){let i=r;if(!i)return a;r=void 0;let s={value:a,issues:null};return i.set(o.value,s),e8.push(s),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 s;if("backward"!==o.direction&&(a=o,i=t.value,void 0!==(s=a[e9]?.backEdges)&&e5(i)&&s.has(i)))throw new e2;return r(t,o)};t._zod.parse=o,t._zod.run===r&&(t._zod.run=o)})},attach(t){var o;let a,i,s,n=!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,s;let n=e6.get(r);if(void 0!==n)return 2*!!n;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=eh(d);u(r?((r,i)=>{let s=0;for(let n of Reflect.ownKeys(r)){let l=Object.getOwnPropertyDescriptor(r,n);if(i&&!l.enumerable)continue;let c=l.get?1:l.value?._zod?t(l.value,o,a):0;c>s&&(s=c)}return s})(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!==(s=l)&&e6.set(i,2===s),s}(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||n?a=!0:n=!0}let p=c.value;if(!e5(p))return o(c,u);let h=u[e9];if(h||(h={buckets:new WeakMap,backEdges:void 0},u[e9]=h),i===u)d=s;else{var f;let r;(r=(f=h).buckets.get(t))||(r=new WeakMap,f.buckets.set(t,r)),d=r,i=u,s=d}let m=d.get(p);if(m)return c.value=m.value,m.issues?m.issues.length&&c.issues.push(...e3(m.issues)):(c.memo=!0,h.backEdges??(h.backEdges=new WeakSet),h.backEdges.add(m.value)),c;r=d;let y=e8.length,g=o(c,u);r=void 0;let v=e8.length>y?e8.pop():void 0;return g instanceof Promise?g.then(t=>(v&&(v.issues=t.issues.length?e3(t.issues):e4),t)):(v&&(v.issues=g.issues.length?e3(g.issues):e4),g)};t._zod.parse=l,t._zod.run===o&&(t._zod.run=l)})}},te=/^[cC][0-9a-z]{6,}$/,tt=/^[0-9a-z]+$/,tr=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,to=/^[0-9a-vA-V]{20}$/,ta=/^[A-Za-z0-9]{27}$/,ti=/^[a-zA-Z0-9_-]{21}$/,ts=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,tn=/^([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})$/,tl=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)$/,tc=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,tu=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,td=/^(?:(?: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])$/,tp=/^(([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}|:))$/,th=/^((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])$/,tf=/^(([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])$/,tm=/^https?$/,ty=/^\+[1-9]\d{6,14}$/,tg="(?:(?:\\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])))",tv=RegExp(`^${tg}$`);function tb(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 t_=/^[\s\S]{0,}$/,tS=/^-?\d+$/,t$=/^-?\d+(?:\.\d+)?$/,tw=/^(?:true|false)$/i,tE=/^null$/i,tR=/^[^A-Z]*$/,tP=/^[^a-z]*$/,tk=eX("$ZodCheck",(t,r)=>{var o;t._zod??(t._zod={}),t._zod.def=r,(o=t._zod).onattach??(o.onattach=[])}),tO=t=>{let r=t.value;return null!=r&&void 0!==r.length},tT={number:"number",bigint:"bigint",object:"date"},tx=eX("$ZodCheckLessThan",(t,r)=>{tk.init(t,r);let o=tT[typeof r.value];t._zod.check=a=>{(r.inclusive?a.value<=r.value:a.value<r.value)||a.issues.push({origin:tT[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})}}),tj=eX("$ZodCheckGreaterThan",(t,r)=>{tk.init(t,r);let o=tT[typeof r.value];t._zod.check=a=>{(r.inclusive?a.value>=r.value:a.value>r.value)||a.issues.push({origin:tT[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})}}),tC=eX("$ZodCheckMultipleOf",(t,r)=>{tk.init(t,r),t._zod.check=o=>{let a,i,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==(i=Math.round(a=o.value/r.value),s=4*Number.EPSILON*Math.max(Math.abs(a),1),Math.abs(a-i)<s?0:a-i))||o.issues.push({origin:typeof o.value,code:"not_multiple_of",divisor:r.value,input:o.value,inst:t,continue:!r.abort})}}),tN=eX("$ZodCheckNumberFormat",(t,r)=>{tk.init(t,r),r.format=r.format||"float64";let o=r.format?.includes("int"),a=o?"int":"number",[i,s]=eT[r.format];t._zod.check=n=>{let l=n.value;if(o){if(!Number.isInteger(l))return void n.issues.push({expected:a,format:r.format,code:"invalid_type",continue:!1,input:l,inst:t});if(!Number.isSafeInteger(l))return void(l>0?n.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}):n.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&&n.issues.push({origin:"number",input:l,code:"too_small",minimum:i,inclusive:!0,inst:t,continue:!r.abort}),l>s&&n.issues.push({origin:"number",input:l,code:"too_big",maximum:s,inclusive:!0,inst:t,continue:!r.abort})}}),tI=eX("$ZodCheckMaxLength",(t,r)=>{var o;tk.init(t,r),(o=t._zod.def).when??(o.when=tO),t._zod.check=o=>{let a=o.value,i=a.length;if(("string"==typeof a&&i>r.maximum?eD(a):i)<=r.maximum)return;let s=eU(a);o.issues.push({origin:s,code:"too_big",maximum:r.maximum,inclusive:!0,input:a,inst:t,continue:!r.abort})}}),tA=eX("$ZodCheckMinLength",(t,r)=>{var o;tk.init(t,r),(o=t._zod.def).when??(o.when=tO),t._zod.check=o=>{let a=o.value,i=a.length;if(("string"==typeof a&&i>=r.minimum&&i<2*r.minimum?eD(a):i)>=r.minimum)return;let s=eU(a);o.issues.push({origin:s,code:"too_small",minimum:r.minimum,inclusive:!0,input:a,inst:t,continue:!r.abort})}}),tM=eX("$ZodCheckLengthEquals",(t,r)=>{var o;tk.init(t,r),(o=t._zod.def).when??(o.when=tO),t._zod.check=o=>{let a=o.value,i=a.length,s="string"==typeof a&&i>=r.length&&i<=2*r.length?eD(a):i;if(s===r.length)return;let n=eU(a),l=s>r.length;o.issues.push({origin:n,...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})}}),tq=eX("$ZodCheckStringFormat",(t,r)=>{var o,a;tk.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=()=>{})}),tz=eX("$ZodCheckRegex",(t,r)=>{tq.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})}}),tL=eX("$ZodCheckLowerCase",(t,r)=>{r.pattern??(r.pattern=tR),tq.init(t,r)}),tD=eX("$ZodCheckUpperCase",(t,r)=>{r.pattern??(r.pattern=tP),tq.init(t,r)}),tU=eX("$ZodCheckIncludes",(t,r)=>{tk.init(t,r);let o=eR(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})}}),tV=eX("$ZodCheckStartsWith",(t,r)=>{tk.init(t,r);let o=RegExp(`^${eR(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})}}),tF=eX("$ZodCheckEndsWith",(t,r)=>{tk.init(t,r);let o=RegExp(`.*${eR(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})}}),tH=eX("$ZodCheckOverwrite",(t,r)=>{tk.init(t,r),t._zod.check=t=>{t.value=r.tx(t.value)}});class tK{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
|
+
!function(t,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r(require("zod/v3"));else if("function"==typeof define&&define.amd)define(["zod/v3"],r);else{var a="object"==typeof exports?r(require("zod/v3")):r(t["zod/v3"]);for(var o in a)("object"==typeof exports?exports:t)[o]=a[o]}}(this,t=>(()=>{var r,a,o={9454(t,r,a){"use strict";var o=a(181).Buffer,i=a(181).SlowBuffer;function n(t,r){if(!o.isBuffer(t)||!o.isBuffer(r)||t.length!==r.length)return!1;for(var a=0,i=0;i<t.length;i++)a|=t[i]^r[i];return 0===a}t.exports=n,n.install=function(){o.prototype.equal=i.prototype.equal=function(t){return n(this,t)}};var s=o.prototype.equal,l=i.prototype.equal;n.restore=function(){o.prototype.equal=s,i.prototype.equal=l}},6507(t,r,a){"use strict";let o=a(5317),i=a(8388),n=a(442);function s(t,r,a){let s=i(t,r,a),l=o.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,a){let s=i(t,r,a),l=o.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 a(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 o(t,o){return r&&1===t&&!o.file?a(o.original,"spawn"):null}t.exports={hookChildProcess:function(t,a){if(!r)return;let i=t.emit;t.emit=function(r,n){if("exit"===r){let r=o(n,a);if(r)return i.call(t,"error",r)}return i.apply(t,arguments)}},verifyENOENT:o,verifyENOENTSync:function(t,o){return r&&1===t&&!o.file?a(o.original,"spawnSync"):null},notFoundError:a}},8388(t,r,a){"use strict";let o=a(6928),i=a(3803),n=a(2077),s=a(1880),l="win32"===process.platform,c=/\.(?:com|exe)$/i,u=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;t.exports=function(t,r,a){r&&!Array.isArray(r)&&(a=r,r=null);let d={command:t,args:r=r?r.slice(0):[],options:a=Object.assign({},a),file:void 0,original:{command:t,args:r}};return a.shell?d:function(t){let r;if(!l)return t;let a=(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(a);if(t.options.forceShell||d){let r=u.test(a);t.command=o.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,a){return t=(t=(t=`${t}`).replace(/(?=(\\+?)?)\1"/g,'$1$1\\"')).replace(/(?=(\\+?)?)\1$/,"$1$1"),t=(t=`"${t}"`).replace(r,"^$1"),a&&(t=t.replace(r,"^$1")),t}},1880(t,r,a){"use strict";let o=a(9896),i=a(600);t.exports=function(t){let r,a=Buffer.alloc(150);try{r=o.openSync(t,"r"),o.readSync(r,a,0,150,0),o.closeSync(r)}catch(t){}return i(a.toString())}},3803(t,r,a){"use strict";let o=a(6928),i=a(1905),n=a(9695);function s(t,r){let a,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{a=i.sync(t.command,{path:s[n({env:s})],pathExt:r?o.delimiter:void 0})}catch(t){}finally{u&&process.chdir(l)}return a&&(a=o.resolve(c?t.options.cwd:"",a)),a}t.exports=function(t){return s(t)||s(t,!0)}},8583(t,r,a){let o=a(9896),i=a(6928),n=a(857),s=a(6982),l=a(4519).version,c=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function u(t){console.log(`[dotenv@${l}][DEBUG] ${t}`)}function d(t){console.log(`[dotenv@${l}] ${t}`)}function p(t){return t&&t.DOTENV_KEY&&t.DOTENV_KEY.length>0?t.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function h(t){let r=null;if(t&&t.path&&t.path.length>0)if(Array.isArray(t.path))for(let a of t.path)o.existsSync(a)&&(r=a.endsWith(".vault")?a:`${a}.vault`);else r=t.path.endsWith(".vault")?t.path:`${t.path}.vault`;else r=i.resolve(process.cwd(),".env.vault");return o.existsSync(r)?r:null}function f(t){return"~"===t[0]?i.join(n.homedir(),t.slice(1)):t}let m={configDotenv:function(t){let r,a=i.resolve(process.cwd(),".env"),n="utf8",s=!!(t&&t.debug),l=!t||!("quiet"in t)||t.quiet;t&&t.encoding?n=t.encoding:s&&u("No encoding is specified. UTF-8 is used by default");let c=[a];if(t&&t.path)if(Array.isArray(t.path))for(let r of(c=[],t.path))c.push(f(r));else c=[f(t.path)];let p={};for(let a of c)try{let r=m.parse(o.readFileSync(a,{encoding:n}));m.populate(p,r,t)}catch(t){s&&u(`Failed to load ${a} ${t.message}`),r=t}let h=process.env;if(t&&null!=t.processEnv&&(h=t.processEnv),m.populate(h,p,t),s||!l){let t=Object.keys(p).length,a=[];for(let t of c)try{let r=i.relative(process.cwd(),t);a.push(r)}catch(a){s&&u(`Failed to load ${t} ${a.message}`),r=a}d(`injecting env (${t}) from ${a.join(",")}`)}return r?{parsed:p,error:r}:{parsed:p}},_configVault:function(t){let r=!!(t&&t.debug),a=!t||!("quiet"in t)||t.quiet;(r||!a)&&d("Loading env from encrypted .env.vault");let o=m._parseVault(t),i=process.env;return t&&null!=t.processEnv&&(i=t.processEnv),m.populate(i,o,t),{parsed:o}},_parseVault:function(t){let r,a=h(t=t||{});t.path=a;let o=m.configDotenv(t);if(!o.parsed){let t=Error(`MISSING_DATA: Cannot parse ${a} for an unknown reason`);throw t.code="MISSING_DATA",t}let i=p(t).split(","),n=i.length;for(let t=0;t<n;t++)try{let a=i[t].trim(),n=function(t,r){let a;try{a=new URL(r)}catch(t){if("ERR_INVALID_URL"===t.code){let t=Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw t.code="INVALID_DOTENV_KEY",t}throw t}let o=a.password;if(!o){let t=Error("INVALID_DOTENV_KEY: Missing key part");throw t.code="INVALID_DOTENV_KEY",t}let i=a.searchParams.get("environment");if(!i){let t=Error("INVALID_DOTENV_KEY: Missing environment part");throw t.code="INVALID_DOTENV_KEY",t}let n=`DOTENV_VAULT_${i.toUpperCase()}`,s=t.parsed[n];if(!s){let t=Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${n} in your .env.vault file.`);throw t.code="NOT_FOUND_DOTENV_ENVIRONMENT",t}return{ciphertext:s,key:o}}(o,a);r=m.decrypt(n.ciphertext,n.key);break}catch(r){if(t+1>=n)throw r}return m.parse(r)},config:function(t){if(0===p(t).length)return m.configDotenv(t);let r=h(t);if(!r){var a;return a=`You set DOTENV_KEY but you are missing a .env.vault file at ${r}. Did you forget to build it?`,console.log(`[dotenv@${l}][WARN] ${a}`),m.configDotenv(t)}return m._configVault(t)},decrypt:function(t,r){let a=Buffer.from(r.slice(-64),"hex"),o=Buffer.from(t,"base64"),i=o.subarray(0,12),n=o.subarray(-16);o=o.subarray(12,-16);try{let t=s.createDecipheriv("aes-256-gcm",a,i);return t.setAuthTag(n),`${t.update(o)}${t.final()}`}catch(o){let t=o instanceof RangeError,r="Invalid key length"===o.message,a="Unsupported state or unable to authenticate data"===o.message;if(t||r){let t=Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw t.code="INVALID_DOTENV_KEY",t}if(a){let t=Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw t.code="DECRYPTION_FAILED",t}throw o}},parse:function(t){let r,a={},o=t.toString();for(o=o.replace(/\r\n?/mg,"\n");null!=(r=c.exec(o));){let t=r[1],o=r[2]||"",i=(o=o.trim())[0];o=o.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),'"'===i&&(o=(o=o.replace(/\\n/g,"\n")).replace(/\\r/g,"\r")),a[t]=o}return a},populate:function(t,r,a={}){let o=!!(a&&a.debug),i=!!(a&&a.override);if("object"!=typeof r){let t=Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw t.code="OBJECT_REQUIRED",t}for(let a of Object.keys(r))Object.prototype.hasOwnProperty.call(t,a)?(!0===i&&(t[a]=r[a]),o&&(!0===i?u(`"${a}" is already defined and WAS overwritten`):u(`"${a}" is already defined and was NOT overwritten`))):t[a]=r[a]}};t.exports.configDotenv=m.configDotenv,t.exports._configVault=m._configVault,t.exports._parseVault=m._parseVault,t.exports.config=m.config,t.exports.decrypt=m.decrypt,t.exports.parse=m.parse,t.exports.populate=m.populate,t.exports=m},9053(t,r,a){"use strict";var o=a(6608).Buffer,i=a(2188);function n(t){if(o.isBuffer(t))return t;if("string"==typeof t)return o.from(t,"base64");throw TypeError("ECDSA signature must be a Base64 string or a Buffer")}function s(t,r,a){for(var o=0;r+o<a&&0===t[r+o];)++o;return t[r+o]>=128&&--o,o}t.exports={derToJose:function(t,r){t=n(t);var a=i(r),s=a+1,l=t.length,c=0;if(48!==t[c++])throw Error('Could not find expected "seq"');var u=t[c++];if(129===u&&(u=t[c++]),l-c<u)throw Error('"seq" specified length of "'+u+'", only "'+(l-c)+'" remaining');if(2!==t[c++])throw Error('Could not find expected "int" for "r"');var d=t[c++];if(l-c-2<d)throw Error('"r" specified length of "'+d+'", only "'+(l-c-2)+'" available');if(s<d)throw Error('"r" specified length of "'+d+'", max of "'+s+'" is acceptable');var p=c;if(c+=d,2!==t[c++])throw Error('Could not find expected "int" for "s"');var h=t[c++];if(l-c!==h)throw Error('"s" specified length of "'+h+'", expected "'+(l-c)+'"');if(s<h)throw Error('"s" specified length of "'+h+'", max of "'+s+'" is acceptable');var f=c;if((c+=h)!==l)throw Error('Expected to consume entire buffer, but "'+(l-c)+'" bytes remain');var m=a-d,y=a-h,g=o.allocUnsafe(m+d+y+h);for(c=0;c<m;++c)g[c]=0;t.copy(g,c,p+Math.max(-m,0),p+d),c=a;for(var v=c;c<v+y;++c)g[c]=0;return t.copy(g,c,f+Math.max(-y,0),f+h),g=(g=g.toString("base64")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},joseToDer:function(t,r){t=n(t);var a=i(r),l=t.length;if(l!==2*a)throw TypeError('"'+r+'" signatures must be "'+2*a+'" bytes, saw "'+l+'"');var c=s(t,0,a),u=s(t,a,t.length),d=a-c,p=a-u,h=2+d+1+1+p,f=h<128,m=o.allocUnsafe((f?2:3)+h),y=0;return m[y++]=48,f?m[y++]=h:(m[y++]=129,m[y++]=255&h),m[y++]=2,m[y++]=d,c<0?(m[y++]=0,y+=t.copy(m,y,0,a)):y+=t.copy(m,y,c,a),m[y++]=2,m[y++]=p,u<0?(m[y++]=0,t.copy(m,y,a)):t.copy(m,y,a+u),m}}},2188(t){"use strict";function r(t){return(t/8|0)+ +(t%8!=0)}var a={ES256:r(256),ES384:r(384),ES512:r(521)};t.exports=function(t){var r=a[t];if(r)return r;throw Error('Unknown algorithm "'+t+'"')}},9344(t,r,a){var o;function i(t,r,a){if("function"==typeof r&&(a=r,r={}),!a){if("function"!=typeof Promise)throw TypeError("callback not provided");return new Promise(function(a,o){i(t,r||{},function(t,r){t?o(t):a(r)})})}o(t,r||{},function(t,o){t&&("EACCES"===t.code||r&&r.ignoreErrors)&&(t=null,o=!1),a(t,o)})}a(9896),o="win32"===process.platform||global.TESTING_WINDOWS?a(8541):a(709),t.exports=i,i.sync=function(t,r){try{return o.sync(t,r||{})}catch(t){if(r&&r.ignoreErrors||"EACCES"===t.code)return!1;throw t}}},709(t,r,a){t.exports=i,i.sync=function(t,r){return n(o.statSync(t),r)};var o=a(9896);function i(t,r,a){o.stat(t,function(t,o){a(t,!t&&n(o,r))})}function n(t,r){var a,o,i,n,s,l,c,u,d;return t.isFile()&&(a=t,o=r,i=a.mode,n=a.uid,s=a.gid,l=void 0!==o.uid?o.uid:process.getuid&&process.getuid(),c=void 0!==o.gid?o.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,a){t.exports=n,n.sync=function(t,r){return i(o.statSync(t),t,r)};var o=a(9896);function i(t,r,a){if(!t.isSymbolicLink()&&!t.isFile())return!1;var o=void 0!==a.pathExt?a.pathExt:process.env.PATHEXT;if(!o||-1!==(o=o.split(";")).indexOf(""))return!0;for(var i=0;i<o.length;i++){var n=o[i].toLowerCase();if(n&&r.substr(-n.length).toLowerCase()===n)return!0}return!1}function n(t,r,a){o.stat(t,function(o,n){a(o,!o&&i(n,t,r))})}},2548(t,r,a){var o=a(3263);t.exports=function(t,r){r=r||{};var a=o.decode(t,r);if(!a)return null;var i=a.payload;if("string"==typeof i)try{var n=JSON.parse(i);null!==n&&"object"==typeof n&&(i=n)}catch(t){}return!0===r.complete?{header:a.header,payload:i,signature:a.signature}:i}},8400(t,r,a){t.exports={decode:a(2548),verify:a(6467),sign:a(9147),JsonWebTokenError:a(1957),NotBeforeError:a(4470),TokenExpiredError:a(7788)}},1957(t){var r=function(t,r){Error.call(this,t),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name="JsonWebTokenError",this.message=t,r&&(this.inner=r)};r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,t.exports=r},4470(t,r,a){var o=a(1957),i=function(t,r){o.call(this,t),this.name="NotBeforeError",this.date=r};i.prototype=Object.create(o.prototype),i.prototype.constructor=i,t.exports=i},7788(t,r,a){var o=a(1957),i=function(t,r){o.call(this,t),this.name="TokenExpiredError",this.expiredAt=r};i.prototype=Object.create(o.prototype),i.prototype.constructor=i,t.exports=i},5841(t,r,a){t.exports=a(3895).satisfies(process.version,">=15.7.0")},953(t,r,a){t.exports=a(3895).satisfies(process.version,"^6.12.0 || >=8.0.0")},455(t,r,a){t.exports=a(3895).satisfies(process.version,">=16.9.0")},4559(t,r,a){var o=a(3866);t.exports=function(t,r){var a=r||Math.floor(Date.now()/1e3);if("string"==typeof t){var i=o(t);if(void 0===i)return;return Math.floor(a+i/1e3)}if("number"==typeof t)return a+t}},723(t,r,a){let o=a(5841),i=a(455),n={ec:["ES256","ES384","ES512"],rsa:["RS256","PS256","RS384","PS384","RS512","PS512"],"rsa-pss":["PS256","PS384","PS512"]},s={ES256:"prime256v1",ES384:"secp384r1",ES512:"secp521r1"};t.exports=function(t,r){if(!t||!r)return;let a=r.asymmetricKeyType;if(!a)return;let l=n[a];if(!l)throw Error(`Unknown key type "${a}".`);if(!l.includes(t))throw Error(`"alg" parameter for "${a}" key type must be one of: ${l.join(", ")}.`);if(o)switch(a){case"ec":let c=r.asymmetricKeyDetails.namedCurve,u=s[t];if(c!==u)throw Error(`"alg" parameter "${t}" requires curve "${u}".`);break;case"rsa-pss":if(i){let a=parseInt(t.slice(-3),10),{hashAlgorithm:o,mgf1HashAlgorithm:i,saltLength:n}=r.asymmetricKeyDetails;if(o!==`sha${a}`||i!==o)throw Error(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${t}.`);if(void 0!==n&&n>a>>3)throw Error(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${t}.`)}}}},9147(t,r,a){let o=a(4559),i=a(953),n=a(723),s=a(3263),l=a(5357),c=a(6782),u=a(5250),d=a(8094),p=a(6052),h=a(1251),f=a(8430),{KeyObject:m,createSecretKey:y,createPrivateKey:g}=a(6982),v=["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512","none"];i&&v.splice(3,0,"PS256","PS384","PS512");let b={expiresIn:{isValid:function(t){return u(t)||h(t)&&t},message:'"expiresIn" should be a number of seconds or string representing a timespan'},notBefore:{isValid:function(t){return u(t)||h(t)&&t},message:'"notBefore" should be a number of seconds or string representing a timespan'},audience:{isValid:function(t){return h(t)||Array.isArray(t)},message:'"audience" must be a string or array'},algorithm:{isValid:l.bind(null,v),message:'"algorithm" must be a valid string enum value'},header:{isValid:p,message:'"header" must be an object'},encoding:{isValid:h,message:'"encoding" must be a string'},issuer:{isValid:h,message:'"issuer" must be a string'},subject:{isValid:h,message:'"subject" must be a string'},jwtid:{isValid:h,message:'"jwtid" must be a string'},noTimestamp:{isValid:c,message:'"noTimestamp" must be a boolean'},keyid:{isValid:h,message:'"keyid" must be a string'},mutatePayload:{isValid:c,message:'"mutatePayload" must be a boolean'},allowInsecureKeySizes:{isValid:c,message:'"allowInsecureKeySizes" must be a boolean'},allowInvalidAsymmetricKeyTypes:{isValid:c,message:'"allowInvalidAsymmetricKeyTypes" must be a boolean'}},_={iat:{isValid:d,message:'"iat" should be a number of seconds'},exp:{isValid:d,message:'"exp" should be a number of seconds'},nbf:{isValid:d,message:'"nbf" should be a number of seconds'}};function S(t,r,a,o){if(!p(a))throw Error('Expected "'+o+'" to be a plain object.');Object.keys(a).forEach(function(i){let n=t[i];if(!n){if(!r)throw Error('"'+i+'" is not allowed in "'+o+'"');return}if(!n.isValid(a[i]))throw Error(n.message)})}let w={audience:"aud",issuer:"iss",subject:"sub",jwtid:"jti"},$=["expiresIn","notBefore","noTimestamp","audience","issuer","subject","jwtid"];t.exports=function(t,r,a,i){var l,c;"function"==typeof a?(i=a,a={}):a=a||{};let u="object"==typeof t&&!Buffer.isBuffer(t),d=Object.assign({alg:a.algorithm||"HS256",typ:u?"JWT":void 0,kid:a.keyid},a.header);function p(t){if(i)return i(t);throw t}if(!r&&"none"!==a.algorithm)return p(Error("secretOrPrivateKey must have a value"));if(null!=r&&!(r instanceof m))try{r=g(r)}catch(t){try{r=y("string"==typeof r?Buffer.from(r):r)}catch(t){return p(Error("secretOrPrivateKey is not valid key material"))}}if(d.alg.startsWith("HS")&&"secret"!==r.type)return p(Error(`secretOrPrivateKey must be a symmetric key when using ${d.alg}`));if(/^(?:RS|PS|ES)/.test(d.alg)){if("private"!==r.type)return p(Error(`secretOrPrivateKey must be an asymmetric key when using ${d.alg}`));if(!a.allowInsecureKeySizes&&!d.alg.startsWith("ES")&&void 0!==r.asymmetricKeyDetails&&r.asymmetricKeyDetails.modulusLength<2048)return p(Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${d.alg}`))}if(void 0===t)return p(Error("payload is required"));if(u){try{l=t,S(_,!0,l,"payload")}catch(t){return p(t)}a.mutatePayload||(t=Object.assign({},t))}else{let r=$.filter(function(t){return void 0!==a[t]});if(r.length>0)return p(Error("invalid "+r.join(",")+" option for "+typeof t+" payload"))}if(void 0!==t.exp&&void 0!==a.expiresIn)return p(Error('Bad "options.expiresIn" option the payload already has an "exp" property.'));if(void 0!==t.nbf&&void 0!==a.notBefore)return p(Error('Bad "options.notBefore" option the payload already has an "nbf" property.'));try{c=a,S(b,!1,c,"options")}catch(t){return p(t)}if(!a.allowInvalidAsymmetricKeyTypes)try{n(d.alg,r)}catch(t){return p(t)}let h=t.iat||Math.floor(Date.now()/1e3);if(a.noTimestamp?delete t.iat:u&&(t.iat=h),void 0!==a.notBefore){try{t.nbf=o(a.notBefore,h)}catch(t){return p(t)}if(void 0===t.nbf)return p(Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}if(void 0!==a.expiresIn&&"object"==typeof t){try{t.exp=o(a.expiresIn,h)}catch(t){return p(t)}if(void 0===t.exp)return p(Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}Object.keys(w).forEach(function(r){let o=w[r];if(void 0!==a[r]){if(void 0!==t[o])return p(Error('Bad "options.'+r+'" option. The payload already has an "'+o+'" property.'));t[o]=a[r]}});let v=a.encoding||"utf8";if("function"==typeof i)i=i&&f(i),s.createSign({header:d,privateKey:r,payload:t,encoding:v}).once("error",i).once("done",function(t){if(!a.allowInsecureKeySizes&&/^(?:RS|PS)/.test(d.alg)&&t.length<256)return i(Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${d.alg}`));i(null,t)});else{let o=s.sign({header:d,payload:t,secret:r,encoding:v});if(!a.allowInsecureKeySizes&&/^(?:RS|PS)/.test(d.alg)&&o.length<256)throw Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${d.alg}`);return o}}},6467(t,r,a){let o=a(1957),i=a(4470),n=a(7788),s=a(2548),l=a(4559),c=a(723),u=a(953),d=a(3263),{KeyObject:p,createSecretKey:h,createPublicKey:f}=a(6982),m=["RS256","RS384","RS512"],y=["ES256","ES384","ES512"],g=["RS256","RS384","RS512"],v=["HS256","HS384","HS512"];u&&(m.splice(m.length,0,"PS256","PS384","PS512"),g.splice(g.length,0,"PS256","PS384","PS512")),t.exports=function(t,r,a,u){let b,_,S;if("function"!=typeof a||u||(u=a,a={}),a||(a={}),a=Object.assign({},a),b=u||function(t,r){if(t)throw t;return r},a.clockTimestamp&&"number"!=typeof a.clockTimestamp)return b(new o("clockTimestamp must be a number"));if(void 0!==a.nonce&&("string"!=typeof a.nonce||""===a.nonce.trim()))return b(new o("nonce must be a non-empty string"));if(void 0!==a.allowInvalidAsymmetricKeyTypes&&"boolean"!=typeof a.allowInvalidAsymmetricKeyTypes)return b(new o("allowInvalidAsymmetricKeyTypes must be a boolean"));let w=a.clockTimestamp||Math.floor(Date.now()/1e3);if(!t)return b(new o("jwt must be provided"));if("string"!=typeof t)return b(new o("jwt must be a string"));let $=t.split(".");if(3!==$.length)return b(new o("jwt malformed"));try{_=s(t,{complete:!0})}catch(t){return b(t)}if(!_)return b(new o("invalid token"));let E=_.header;if("function"==typeof r){if(!u)return b(new o("verify must be called asynchronous if secret or public key is provided as a callback"));S=r}else S=function(t,a){return a(null,r)};return S(E,function(r,s){let u;if(r)return b(new o("error in secret or public key callback: "+r.message));let S=""!==$[2].trim();if(!S&&s)return b(new o("jwt signature is required"));if(S&&!s)return b(new o("secret or public key must be provided"));if(!S&&!a.algorithms)return b(new o('please specify "none" in "algorithms" to verify unsigned tokens'));if(null!=s&&!(s instanceof p))try{s=f(s)}catch(t){try{s=h("string"==typeof s?Buffer.from(s):s)}catch(t){return b(new o("secretOrPublicKey is not valid key material"))}}if(a.algorithms||("secret"===s.type?a.algorithms=v:["rsa","rsa-pss"].includes(s.asymmetricKeyType)?a.algorithms=g:"ec"===s.asymmetricKeyType?a.algorithms=y:a.algorithms=m),-1===a.algorithms.indexOf(_.header.alg))return b(new o("invalid algorithm"));if(E.alg.startsWith("HS")&&"secret"!==s.type)return b(new o(`secretOrPublicKey must be a symmetric key when using ${E.alg}`));if(/^(?:RS|PS|ES)/.test(E.alg)&&"public"!==s.type)return b(new o(`secretOrPublicKey must be an asymmetric key when using ${E.alg}`));if(!a.allowInvalidAsymmetricKeyTypes)try{c(E.alg,s)}catch(t){return b(t)}try{u=d.verify(t,_.header.alg,s)}catch(t){return b(t)}if(!u)return b(new o("invalid signature"));let P=_.payload;if(void 0!==P.nbf&&!a.ignoreNotBefore){if("number"!=typeof P.nbf)return b(new o("invalid nbf value"));if(P.nbf>w+(a.clockTolerance||0))return b(new i("jwt not active",new Date(1e3*P.nbf)))}if(void 0!==P.exp&&!a.ignoreExpiration){if("number"!=typeof P.exp)return b(new o("invalid exp value"));if(w>=P.exp+(a.clockTolerance||0))return b(new n("jwt expired",new Date(1e3*P.exp)))}if(a.audience){let t=Array.isArray(a.audience)?a.audience:[a.audience];if(!(Array.isArray(P.aud)?P.aud:[P.aud]).some(function(r){return t.some(function(t){return t instanceof RegExp?t.test(r):t===r})}))return b(new o("jwt audience invalid. expected: "+t.join(" or ")))}if(a.issuer&&("string"==typeof a.issuer&&P.iss!==a.issuer||Array.isArray(a.issuer)&&-1===a.issuer.indexOf(P.iss)))return b(new o("jwt issuer invalid. expected: "+a.issuer));if(a.subject&&P.sub!==a.subject)return b(new o("jwt subject invalid. expected: "+a.subject));if(a.jwtid&&P.jti!==a.jwtid)return b(new o("jwt jwtid invalid. expected: "+a.jwtid));if(a.nonce&&P.nonce!==a.nonce)return b(new o("jwt nonce invalid. expected: "+a.nonce));if(a.maxAge){if("number"!=typeof P.iat)return b(new o("iat required when maxAge is specified"));let t=l(a.maxAge,P.iat);if(void 0===t)return b(new o('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));if(w>=t+(a.clockTolerance||0))return b(new n("maxAge exceeded",new Date(1e3*t)))}return!0===a.complete?b(null,{header:E,payload:P,signature:_.signature}):b(null,P)})}},2357(t,r,a){var o,i=a(6608).Buffer,n=a(6982),s=a(9053),l=a(9023),c="secret must be a string or buffer",u="key must be a string or a buffer",d="function"==typeof n.createPublicKey;function p(t){if(!i.isBuffer(t)&&"string"!=typeof t&&(!d||"object"!=typeof t||"string"!=typeof t.type||"string"!=typeof t.asymmetricKeyType||"function"!=typeof t.export))throw y(u)}function h(t){if(!i.isBuffer(t)&&"string"!=typeof t&&"object"!=typeof t)throw y("key must be a string, a buffer or an object")}function f(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function m(t){var r=4-(t=t.toString()).length%4;if(4!==r)for(var a=0;a<r;++a)t+="=";return t.replace(/\-/g,"+").replace(/_/g,"/")}function y(t){var r=[].slice.call(arguments,1);return TypeError(l.format.bind(l,t).apply(null,r))}function g(t){var r;return r=t,i.isBuffer(r)||"string"==typeof r||(t=JSON.stringify(t)),t}function v(t){return function(r,a){!function(t){if(!i.isBuffer(t)){if("string"!=typeof t){if(!d||"object"!=typeof t||"secret"!==t.type||"function"!=typeof t.export)throw y(c)}}}(a),r=g(r);var o=n.createHmac("sha"+t,a);return f((o.update(r),o.digest("base64")))}}d&&(u+=" or a KeyObject",c+="or a KeyObject");var b="timingSafeEqual"in n?function(t,r){return t.byteLength===r.byteLength&&n.timingSafeEqual(t,r)}:function(t,r){return o||(o=a(9454)),o(t,r)};function _(t){return function(r,a,o){var n=v(t)(r,o);return b(i.from(a),i.from(n))}}function S(t){return function(r,a){h(a),r=g(r);var o=n.createSign("RSA-SHA"+t);return f((o.update(r),o.sign(a,"base64")))}}function w(t){return function(r,a,o){p(o),r=g(r),a=m(a);var i=n.createVerify("RSA-SHA"+t);return i.update(r),i.verify(o,a,"base64")}}function $(t){return function(r,a){h(a),r=g(r);var o=n.createSign("RSA-SHA"+t);return f((o.update(r),o.sign({key:a,padding:n.constants.RSA_PKCS1_PSS_PADDING,saltLength:n.constants.RSA_PSS_SALTLEN_DIGEST},"base64")))}}function E(t){return function(r,a,o){p(o),r=g(r),a=m(a);var i=n.createVerify("RSA-SHA"+t);return i.update(r),i.verify({key:o,padding:n.constants.RSA_PKCS1_PSS_PADDING,saltLength:n.constants.RSA_PSS_SALTLEN_DIGEST},a,"base64")}}function P(t){var r=S(t);return function(){var a=r.apply(null,arguments);return s.derToJose(a,"ES"+t)}}function R(t){var r=w(t);return function(a,o,i){return r(a,o=s.joseToDer(o,"ES"+t).toString("base64"),i)}}function k(){return function(){return""}}function x(){return function(t,r){return""===r}}t.exports=function(t){var r=t.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/);if(!r)throw y('"%s" is not a valid algorithm.\n Supported algorithms are:\n "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".',t);var a=(r[1]||r[3]).toLowerCase(),o=r[2];return{sign:({hs:v,rs:S,ps:$,es:P,none:k})[a](o),verify:({hs:_,rs:w,ps:E,es:R,none:x})[a](o)}}},3263(t,r,a){var o=a(9615),i=a(6747);r.ALGORITHMS=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"],r.sign=o.sign,r.verify=i.verify,r.decode=i.decode,r.isValid=i.isValid,r.createSign=function(t){return new o(t)},r.createVerify=function(t){return new i(t)}},6360(t,r,a){var o=a(6608).Buffer,i=a(2203);function n(t){if(this.buffer=null,this.writable=!0,this.readable=!0,!t)return this.buffer=o.alloc(0),this;if("function"==typeof t.pipe)return this.buffer=o.alloc(0),t.pipe(this),this;if(t.length||"object"==typeof t)return this.buffer=t,this.writable=!1,process.nextTick((function(){this.emit("end",t),this.readable=!1,this.emit("close")}).bind(this)),this;throw TypeError("Unexpected data type ("+typeof t+")")}a(9023).inherits(n,i),n.prototype.write=function(t){this.buffer=o.concat([this.buffer,o.from(t)]),this.emit("data",t)},n.prototype.end=function(t){t&&this.write(t),this.emit("end",t),this.emit("close"),this.writable=!1,this.readable=!1},t.exports=n},9615(t,r,a){var o=a(6608).Buffer,i=a(6360),n=a(2357),s=a(2203),l=a(5911),c=a(9023);function u(t,r){return o.from(t,r).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function d(t){var r,a,o,i=t.header,s=t.payload,d=t.secret||t.privateKey,p=t.encoding,h=n(i.alg),f=(r=(r=p)||"utf8",a=u(l(i),"binary"),o=u(l(s),r),c.format("%s.%s",a,o)),m=h.sign(f,d);return c.format("%s.%s",f,m)}function p(t){var r=t.secret;if(r=null==(r=null==r?t.privateKey:r)?t.key:r,!0===/^hs/i.test(t.header.alg)&&null==r)throw TypeError("secret must be a string or buffer or a KeyObject");var a=new i(r);this.readable=!0,this.header=t.header,this.encoding=t.encoding,this.secret=this.privateKey=this.key=a,this.payload=new i(t.payload),this.secret.once("close",(function(){!this.payload.writable&&this.readable&&this.sign()}).bind(this)),this.payload.once("close",(function(){!this.secret.writable&&this.readable&&this.sign()}).bind(this))}c.inherits(p,s),p.prototype.sign=function(){try{var t=d({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",t),this.emit("data",t),this.emit("end"),this.readable=!1,t}catch(t){this.readable=!1,this.emit("error",t),this.emit("close")}},p.sign=d,t.exports=p},5911(t,r,a){var o=a(181).Buffer;t.exports=function(t){return"string"==typeof t?t:"number"==typeof t||o.isBuffer(t)?t.toString():JSON.stringify(t)}},6747(t,r,a){var o=a(6608).Buffer,i=a(6360),n=a(2357),s=a(2203),l=a(5911),c=a(9023),u=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function d(t){var r=t.split(".",1)[0],a=o.from(r,"base64").toString("binary");if("[object Object]"===Object.prototype.toString.call(a))return a;try{return JSON.parse(a)}catch(t){return}}function p(t){return t.split(".")[2]}function h(t){return u.test(t)&&!!d(t)}function f(t,r,a){if(!r){var o=Error("Missing algorithm parameter for jws.verify");throw o.code="MISSING_ALGORITHM",o}var i=p(t=l(t)),s=t.split(".",2).join(".");return n(r).verify(s,i,a)}function m(t,r){if(r=r||{},!h(t=l(t)))return null;var a,i,n=d(t);if(!n)return null;var s=(a=a||"utf8",i=t.split(".")[1],o.from(i,"base64").toString(a));return("JWT"===n.typ||r.json)&&(s=JSON.parse(s,r.encoding)),{header:n,payload:s,signature:p(t)}}function y(t){var r=(t=t||{}).secret;if(r=null==(r=null==r?t.publicKey:r)?t.key:r,!0===/^hs/i.test(t.algorithm)&&null==r)throw TypeError("secret must be a string or buffer or a KeyObject");var a=new i(r);this.readable=!0,this.algorithm=t.algorithm,this.encoding=t.encoding,this.secret=this.publicKey=this.key=a,this.signature=new i(t.signature),this.secret.once("close",(function(){!this.signature.writable&&this.readable&&this.verify()}).bind(this)),this.signature.once("close",(function(){!this.secret.writable&&this.readable&&this.verify()}).bind(this))}c.inherits(y,s),y.prototype.verify=function(){try{var t=f(this.signature.buffer,this.algorithm,this.key.buffer),r=m(this.signature.buffer,this.encoding);return this.emit("done",t,r),this.emit("data",t),this.emit("end"),this.readable=!1,t}catch(t){this.readable=!1,this.emit("error",t),this.emit("close")}},y.decode=m,y.isValid=h,y.verify=f,t.exports=y},5357(t){var r,a,o=1/0,i=0/0,n=/^\s+|\s+$/g,s=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=/^(?:0|[1-9]\d*)$/,d=parseInt;function p(t){return t!=t}var h=Object.prototype,f=h.hasOwnProperty,m=h.toString,y=h.propertyIsEnumerable,g=(r=Object.keys,a=Object,function(t){return r(a(t))}),v=Math.max,b=Array.isArray;function _(t){var r,a,o;return null!=t&&"number"==typeof(r=t.length)&&r>-1&&r%1==0&&r<=0x1fffffffffffff&&"[object Function]"!=(o=S(a=t)?m.call(a):"")&&"[object GeneratorFunction]"!=o}function S(t){var r=typeof t;return!!t&&("object"==r||"function"==r)}function w(t){return!!t&&"object"==typeof t}t.exports=function(t,r,a,$){t=_(t)?t:function(t){return t?function(t,r){for(var a=-1,o=t?t.length:0,i=Array(o);++a<o;)i[a]=r(t[a],a,t);return i}(_(t)?function(t,r){var a,o,i,n,s=b(t)||w(o=a=t)&&_(o)&&f.call(a,"callee")&&(!y.call(a,"callee")||"[object Arguments]"==m.call(a))?function(t,r){for(var a=-1,o=Array(t);++a<t;)o[a]=r(a);return o}(t.length,String):[],l=s.length,c=!!l;for(var d in t){f.call(t,d)&&!(c&&("length"==d||(i=d,(n=null==(n=l)?0x1fffffffffffff:n)&&("number"==typeof i||u.test(i))&&i>-1&&i%1==0&&i<n)))&&s.push(d)}return s}(t):function(t){if(a=(r=t)&&r.constructor,r!==("function"==typeof a&&a.prototype||h))return g(t);var r,a,o=[];for(var i in Object(t))f.call(t,i)&&"constructor"!=i&&o.push(i);return o}(t),function(r){return t[r]}):[]}(t),a=a&&!$?(R=(P=(E=a)?(E=function(t){if("number"==typeof t)return t;if("symbol"==typeof(r=t)||w(r)&&"[object Symbol]"==m.call(r))return i;if(S(t)){var r,a="function"==typeof t.valueOf?t.valueOf():t;t=S(a)?a+"":a}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(n,"");var o=l.test(t);return o||c.test(t)?d(t.slice(2),o?2:8):s.test(t)?i:+t}(E))===o||E===-o?(E<0?-1:1)*17976931348623157e292:E==E?E:0:0===E?E:0)%1,P==P?R?P-R:P:0):0;var E,P,R,k,x=t.length;return a<0&&(a=v(x+a,0)),"string"==typeof(k=t)||!b(k)&&w(k)&&"[object String]"==m.call(k)?a<=x&&t.indexOf(r,a)>-1:!!x&&function(t,r,a){if(r!=r){for(var o=t.length,i=a+-1;++i<o;)if(p(t[i],i,t))return i;return -1}for(var n=a-1,s=t.length;++n<s;)if(t[n]===r)return n;return -1}(t,r,a)>-1}},6782(t){var r=Object.prototype.toString;t.exports=function(t){var a;return!0===t||!1===t||!!(a=t)&&"object"==typeof a&&"[object Boolean]"==r.call(t)}},5250(t){var r=1/0,a=0/0,o=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,s=/^0o[0-7]+$/i,l=parseInt,c=Object.prototype.toString;function u(t){var r=typeof t;return!!t&&("object"==r||"function"==r)}t.exports=function(t){var d,p,h;return"number"==typeof t&&t==(h=(p=(d=t)?(d=function(t){if("number"==typeof t)return t;if("symbol"==typeof(r=t)||r&&"object"==typeof r&&"[object Symbol]"==c.call(r))return a;if(u(t)){var r,d="function"==typeof t.valueOf?t.valueOf():t;t=u(d)?d+"":d}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(o,"");var p=n.test(t);return p||s.test(t)?l(t.slice(2),p?2:8):i.test(t)?a:+t}(d))===r||d===-r?(d<0?-1:1)*17976931348623157e292:d==d?d:0:0===d?d:0)%1,p==p?h?p-h:p:0)}},8094(t){var r=Object.prototype.toString;t.exports=function(t){return"number"==typeof t||!!t&&"object"==typeof t&&"[object Number]"==r.call(t)}},6052(t){var r,a,o=Object.prototype,i=Function.prototype.toString,n=o.hasOwnProperty,s=i.call(Object),l=o.toString,c=(r=Object.getPrototypeOf,a=Object,function(t){return r(a(t))});t.exports=function(t){if(!(t&&"object"==typeof t)||"[object Object]"!=l.call(t)||function(t){var r=!1;if(null!=t&&"function"!=typeof t.toString)try{r=!!(t+"")}catch(t){}return r}(t))return!1;var r=c(t);if(null===r)return!0;var a=n.call(r,"constructor")&&r.constructor;return"function"==typeof a&&a instanceof a&&i.call(a)==s}},1251(t){var r=Object.prototype.toString,a=Array.isArray;t.exports=function(t){var o;return"string"==typeof t||!a(t)&&!!(o=t)&&"object"==typeof o&&"[object String]"==r.call(t)}},8430(t){var r=1/0,a=0/0,o=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,s=/^0o[0-7]+$/i,l=parseInt,c=Object.prototype.toString;function u(t){var r=typeof t;return!!t&&("object"==r||"function"==r)}t.exports=function(t){var d,p,h,f,m=2,y=t;if("function"!=typeof y)throw TypeError("Expected a function");return h=(p=(d=m)?(d=function(t){if("number"==typeof t)return t;if("symbol"==typeof(r=t)||r&&"object"==typeof r&&"[object Symbol]"==c.call(r))return a;if(u(t)){var r,d="function"==typeof t.valueOf?t.valueOf():t;t=u(d)?d+"":d}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(o,"");var p=n.test(t);return p||s.test(t)?l(t.slice(2),p?2:8):i.test(t)?a:+t}(d))===r||d===-r?(d<0?-1:1)*17976931348623157e292:d==d?d:0:0===d?d:0)%1,m=p==p?h?p-h:p:0,function(){return--m>0&&(f=y.apply(this,arguments)),m<=1&&(y=void 0),f}}},3866(t){function r(t,r,a,o){return Math.round(t/a)+" "+o+(r>=1.5*a?"s":"")}t.exports=function(t,a){a=a||{};var o,i,n,s,l=typeof t;if("string"===l&&t.length>0){var c=t;if(!((c=String(c)).length>100)){var u=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(c);if(u){var d=parseFloat(u[1]);switch((u[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*d;case"weeks":case"week":case"w":return 6048e5*d;case"days":case"day":case"d":return 864e5*d;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*d;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*d;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*d;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return d;default:break}}}return}if("number"===l&&isFinite(t)){return a.long?(i=Math.abs(o=t))>=864e5?r(o,i,864e5,"day"):i>=36e5?r(o,i,36e5,"hour"):i>=6e4?r(o,i,6e4,"minute"):i>=1e3?r(o,i,1e3,"second"):o+" ms":(s=Math.abs(n=t))>=864e5?Math.round(n/864e5)+"d":s>=36e5?Math.round(n/36e5)+"h":s>=6e4?Math.round(n/6e4)+"m":s>=1e3?Math.round(n/1e3)+"s":n+"ms"}throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},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},6608(t,r,a){var o=a(181),i=o.Buffer;function n(t,r){for(var a in t)r[a]=t[a]}function s(t,r,a){return i(t,r,a)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=o:(n(o,r),r.Buffer=s),s.prototype=Object.create(i.prototype),n(i,s),s.from=function(t,r,a){if("number"==typeof t)throw TypeError("Argument must not be a number");return i(t,r,a)},s.alloc=function(t,r,a){if("number"!=typeof t)throw TypeError("Argument must be a number");var o=i(t);return void 0!==r?"string"==typeof a?o.fill(r,a):o.fill(r):o.fill(0),o},s.allocUnsafe=function(t){if("number"!=typeof t)throw TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw TypeError("Argument must be a number");return o.SlowBuffer(t)}},8610(t,r,a){"use strict";let o=Symbol("SemVer ANY");class i{static get ANY(){return o}constructor(t,r){if(r=n(r),t instanceof i)if(!!r.loose===t.loose)return t;else t=t.value;u("comparator",t=t.trim().split(/\s+/).join(" "),r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===o?this.value="":this.value=this.operator+this.semver.version,u("comp",this)}parse(t){let r=this.options.loose?s[l.COMPARATORLOOSE]:s[l.COMPARATOR],a=t.match(r);if(!a)throw TypeError(`Invalid comparator: ${t}`);this.operator=void 0!==a[1]?a[1]:"","="===this.operator&&(this.operator=""),a[2]?this.semver=new d(a[2],this.options.loose):this.semver=o}toString(){return this.value}test(t){if(u("Comparator.test",t,this.options.loose),this.semver===o||t===o)return!0;if("string"==typeof t)try{t=new d(t,this.options)}catch(t){return!1}return c(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof i))throw TypeError("a Comparator is required");return""===this.operator?""===this.value||new p(t.value,r).test(this.value):""===t.operator?""===t.value||new p(this.value,r).test(t.semver):!((r=n(r)).includePrerelease&&("<0.0.0-0"===this.value||"<0.0.0-0"===t.value)||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0")))&&!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||c(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||c(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">"))}}t.exports=i;let n=a(4621),{safeRe:s,t:l}=a(152),c=a(5461),u=a(674),d=a(2398),p=a(2069)},2069(t,r,a){"use strict";let o=/\s+/g;class i{constructor(t,r){if(r=s(r),t instanceof i)if(!!r.loose===t.loose&&!!r.includePrerelease===t.includePrerelease)return t;else return new i(t.raw,r);if(t instanceof l)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(o," "),this.set=this.raw.split("||").map(t=>this.parseRange(t.trim())).filter(t=>t.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const t=this.set[0];if(this.set=this.set.filter(t=>!v(t[0])),0===this.set.length)this.set=[t];else if(this.set.length>1){for(const t of this.set)if(1===t.length&&b(t[0])){this.set=[t];break}}}this.formatted=void 0}get range(){if(void 0===this.formatted){this.formatted="";for(let t=0;t<this.set.length;t++){t>0&&(this.formatted+="||");let r=this.set[t];for(let t=0;t<r.length;t++)t>0&&(this.formatted+=" "),this.formatted+=r[t].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(t){let r=((this.options.includePrerelease&&y)|(this.options.loose&&g))+":"+t,a=n.get(r);if(a)return a;let o=this.options.loose,i=o?d[p.HYPHENRANGELOOSE]:d[p.HYPHENRANGE];c("hyphen replace",t=t.replace(i,j(this.options.includePrerelease))),c("comparator trim",t=t.replace(d[p.COMPARATORTRIM],h)),c("tilde trim",t=t.replace(d[p.TILDETRIM],f)),c("caret trim",t=t.replace(d[p.CARETTRIM],m));let s=t.split(" ").map(t=>S(t,this.options)).join(" ").split(/\s+/).map(t=>O(t,this.options));o&&(s=s.filter(t=>(c("loose invalid filter",t,this.options),!!t.match(d[p.COMPARATORLOOSE])))),c("range list",s);let u=new Map;for(let t of s.map(t=>new l(t,this.options))){if(v(t))return[t];u.set(t.value,t)}u.size>1&&u.has("")&&u.delete("");let b=[...u.values()];return n.set(r,b),b}intersects(t,r){if(!(t instanceof i))throw TypeError("a Range is required");return this.set.some(a=>_(a,r)&&t.set.some(t=>_(t,r)&&a.every(a=>t.every(t=>a.intersects(t,r)))))}test(t){if(!t)return!1;if("string"==typeof t)try{t=new u(t,this.options)}catch(t){return!1}for(let r=0;r<this.set.length;r++)if(C(this.set[r],t,this.options))return!0;return!1}}t.exports=i;let n=new(a(2044)),s=a(4621),l=a(8610),c=a(674),u=a(2398),{safeRe:d,t:p,comparatorTrimReplace:h,tildeTrimReplace:f,caretTrimReplace:m}=a(152),{FLAG_INCLUDE_PRERELEASE:y,FLAG_LOOSE:g}=a(5076),v=t=>"<0.0.0-0"===t.value,b=t=>""===t.value,_=(t,r)=>{let a=!0,o=t.slice(),i=o.pop();for(;a&&o.length;)a=o.every(t=>i.intersects(t,r)),i=o.pop();return a},S=(t,r)=>(c("comp",t=t.replace(d[p.BUILD],""),r),c("caret",t=P(t,r)),c("tildes",t=$(t,r)),c("xrange",t=k(t,r)),c("stars",t=T(t,r)),t),w=t=>!t||"x"===t.toLowerCase()||"*"===t,$=(t,r)=>t.trim().split(/\s+/).map(t=>E(t,r)).join(" "),E=(t,r)=>{let a=r.loose?d[p.TILDELOOSE]:d[p.TILDE];return t.replace(a,(r,a,o,i,n)=>{let s;return c("tilde",t,r,a,o,i,n),w(a)?s="":w(o)?s=`>=${a}.0.0 <${+a+1}.0.0-0`:w(i)?s=`>=${a}.${o}.0 <${a}.${+o+1}.0-0`:n?(c("replaceTilde pr",n),s=`>=${a}.${o}.${i}-${n} <${a}.${+o+1}.0-0`):s=`>=${a}.${o}.${i} <${a}.${+o+1}.0-0`,c("tilde return",s),s})},P=(t,r)=>t.trim().split(/\s+/).map(t=>R(t,r)).join(" "),R=(t,r)=>{c("caret",t,r);let a=r.loose?d[p.CARETLOOSE]:d[p.CARET],o=r.includePrerelease?"-0":"";return t.replace(a,(r,a,i,n,s)=>{let l;return c("caret",t,r,a,i,n,s),w(a)?l="":w(i)?l=`>=${a}.0.0${o} <${+a+1}.0.0-0`:w(n)?l="0"===a?`>=${a}.${i}.0${o} <${a}.${+i+1}.0-0`:`>=${a}.${i}.0${o} <${+a+1}.0.0-0`:s?(c("replaceCaret pr",s),l="0"===a?"0"===i?`>=${a}.${i}.${n}-${s} <${a}.${i}.${+n+1}-0`:`>=${a}.${i}.${n}-${s} <${a}.${+i+1}.0-0`:`>=${a}.${i}.${n}-${s} <${+a+1}.0.0-0`):(c("no pr"),l="0"===a?"0"===i?`>=${a}.${i}.${n}${o} <${a}.${i}.${+n+1}-0`:`>=${a}.${i}.${n}${o} <${a}.${+i+1}.0-0`:`>=${a}.${i}.${n} <${+a+1}.0.0-0`),c("caret return",l),l})},k=(t,r)=>(c("replaceXRanges",t,r),t.split(/\s+/).map(t=>x(t,r)).join(" ")),x=(t,r)=>{t=t.trim();let a=r.loose?d[p.XRANGELOOSE]:d[p.XRANGE];return t.replace(a,(a,o,i,n,s,l)=>{c("xRange",t,a,o,i,n,s,l);let u=w(i),d=u||w(n),p=d||w(s);return"="===o&&p&&(o=""),l=r.includePrerelease?"-0":"",u?a=">"===o||"<"===o?"<0.0.0-0":"*":o&&p?(d&&(n=0),s=0,">"===o?(o=">=",d?(i=+i+1,n=0):n=+n+1,s=0):"<="===o&&(o="<",d?i=+i+1:n=+n+1),"<"===o&&(l="-0"),a=`${o+i}.${n}.${s}${l}`):d?a=`>=${i}.0.0${l} <${+i+1}.0.0-0`:p&&(a=`>=${i}.${n}.0${l} <${i}.${+n+1}.0-0`),c("xRange return",a),a})},T=(t,r)=>(c("replaceStars",t,r),t.trim().replace(d[p.STAR],"")),O=(t,r)=>(c("replaceGTE0",t,r),t.trim().replace(d[r.includePrerelease?p.GTE0PRE:p.GTE0],"")),j=t=>(r,a,o,i,n,s,l,c,u,d,p,h)=>(a=w(o)?"":w(i)?`>=${o}.0.0${t?"-0":""}`:w(n)?`>=${o}.${i}.0${t?"-0":""}`:s?`>=${a}`:`>=${a}${t?"-0":""}`,c=w(u)?"":w(d)?`<${+u+1}.0.0-0`:w(p)?`<${u}.${+d+1}.0-0`:h?`<=${u}.${d}.${p}-${h}`:t?`<${u}.${d}.${+p+1}-0`:`<=${c}`,`${a} ${c}`.trim()),C=(t,r,a)=>{for(let a=0;a<t.length;a++)if(!t[a].test(r))return!1;if(r.prerelease.length&&!a.includePrerelease){for(let a=0;a<t.length;a++)if(c(t[a].semver),t[a].semver!==l.ANY&&t[a].semver.prerelease.length>0){let o=t[a].semver;if(o.major===r.major&&o.minor===r.minor&&o.patch===r.patch)return!0}return!1}return!0}},2398(t,r,a){"use strict";let o=a(674),{MAX_LENGTH:i,MAX_SAFE_INTEGER:n}=a(5076),{safeRe:s,t:l}=a(152),c=a(4621),{compareIdentifiers:u}=a(9101);class d{constructor(t,r){if(r=c(r),t instanceof d)if(!!r.loose===t.loose&&!!r.includePrerelease===t.includePrerelease)return t;else t=t.version;else if("string"!=typeof t)throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>i)throw TypeError(`version is longer than ${i} characters`);o("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const a=t.trim().match(r.loose?s[l.LOOSE]:s[l.FULL]);if(!a)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+a[1],this.minor=+a[2],this.patch=+a[3],this.major>n||this.major<0)throw TypeError("Invalid major version");if(this.minor>n||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>n||this.patch<0)throw TypeError("Invalid patch version");a[4]?this.prerelease=a[4].split(".").map(t=>{if(/^[0-9]+$/.test(t)){let r=+t;if(r>=0&&r<n)return r}return t}):this.prerelease=[],this.build=a[5]?a[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(o("SemVer.compare",this.version,this.options,t),!(t instanceof d)){if("string"==typeof t&&t===this.version)return 0;t=new d(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return(t instanceof d||(t=new d(t,this.options)),this.major<t.major)?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:+(this.patch>t.patch)}comparePre(t){if(t instanceof d||(t=new d(t,this.options)),this.prerelease.length&&!t.prerelease.length)return -1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let a=this.prerelease[r],i=t.prerelease[r];if(o("prerelease compare",r,a,i),void 0===a&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===a)return -1;else if(a===i)continue;else return u(a,i)}while(++r)}compareBuild(t){t instanceof d||(t=new d(t,this.options));let r=0;do{let a=this.build[r],i=t.build[r];if(o("build compare",r,a,i),void 0===a&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===a)return -1;else if(a===i)continue;else return u(a,i)}while(++r)}inc(t,r,a){if(t.startsWith("pre")){if(!r&&!1===a)throw Error("invalid increment argument: identifier is empty");if(r){let t=`-${r}`.match(this.options.loose?s[l.PRERELEASELOOSE]:s[l.PRERELEASE]);if(!t||t[1]!==r)throw Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,a);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,a);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,a),this.inc("pre",r,a);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",r,a),this.inc("pre",r,a);break;case"release":if(0===this.prerelease.length)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(0!==this.minor||0!==this.patch||0===this.prerelease.length)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(0!==this.patch||0===this.prerelease.length)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{let t=+!!Number(a);if(0===this.prerelease.length)this.prerelease=[t];else{let o=this.prerelease.length;for(;--o>=0;)"number"==typeof this.prerelease[o]&&(this.prerelease[o]++,o=-2);if(-1===o){if(r===this.prerelease.join(".")&&!1===a)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(t)}}if(r){let o=[r,t];!1===a&&(o=[r]),0===u(this.prerelease[0],r)?isNaN(this.prerelease[1])&&(this.prerelease=o):this.prerelease=o}break}default:throw Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}t.exports=d},5608(t,r,a){"use strict";let o=a(6802);t.exports=(t,r)=>{let a=o(t.trim().replace(/^[=v]+/,""),r);return a?a.version:null}},5461(t,r,a){"use strict";let o=a(8271),i=a(733),n=a(1686),s=a(6479),l=a(7257),c=a(5850);t.exports=(t,r,a,u)=>{switch(r){case"===":return"object"==typeof t&&(t=t.version),"object"==typeof a&&(a=a.version),t===a;case"!==":return"object"==typeof t&&(t=t.version),"object"==typeof a&&(a=a.version),t!==a;case"":case"=":case"==":return o(t,a,u);case"!=":return i(t,a,u);case">":return n(t,a,u);case">=":return s(t,a,u);case"<":return l(t,a,u);case"<=":return c(t,a,u);default:throw TypeError(`Invalid operator: ${r}`)}}},7771(t,r,a){"use strict";let o=a(2398),i=a(6802),{safeRe:n,t:s}=a(152);t.exports=(t,r)=>{if(t instanceof o)return t;if("number"==typeof t&&(t=String(t)),"string"!=typeof t)return null;let a=null;if((r=r||{}).rtl){let o,i=r.includePrerelease?n[s.COERCERTLFULL]:n[s.COERCERTL];for(;(o=i.exec(t))&&(!a||a.index+a[0].length!==t.length);)a&&o.index+o[0].length===a.index+a[0].length||(a=o),i.lastIndex=o.index+o[1].length+o[2].length;i.lastIndex=-1}else a=t.match(r.includePrerelease?n[s.COERCEFULL]:n[s.COERCE]);if(null===a)return null;let l=a[2],c=a[3]||"0",u=a[4]||"0",d=r.includePrerelease&&a[5]?`-${a[5]}`:"",p=r.includePrerelease&&a[6]?`+${a[6]}`:"";return i(`${l}.${c}.${u}${d}${p}`,r)}},8767(t,r,a){"use strict";let o=a(2398);t.exports=(t,r,a)=>{let i=new o(t,a),n=new o(r,a);return i.compare(n)||i.compareBuild(n)}},6293(t,r,a){"use strict";let o=a(6958);t.exports=(t,r)=>o(t,r,!0)},6958(t,r,a){"use strict";let o=a(2398);t.exports=(t,r,a)=>new o(t,a).compare(new o(r,a))},3086(t,r,a){"use strict";let o=a(6802);t.exports=(t,r)=>{let a=o(t,null,!0),i=o(r,null,!0),n=a.compare(i);if(0===n)return null;let s=n>0,l=s?a:i,c=s?i:a,u=!!l.prerelease.length;if(c.prerelease.length&&!u){if(!c.patch&&!c.minor)return"major";if(0===c.compareMain(l))return c.minor&&!c.patch?"minor":"patch"}let d=u?"pre":"";return a.major!==i.major?d+"major":a.minor!==i.minor?d+"minor":a.patch!==i.patch?d+"patch":"prerelease"}},8271(t,r,a){"use strict";let o=a(6958);t.exports=(t,r,a)=>0===o(t,r,a)},1686(t,r,a){"use strict";let o=a(6958);t.exports=(t,r,a)=>o(t,r,a)>0},6479(t,r,a){"use strict";let o=a(6958);t.exports=(t,r,a)=>o(t,r,a)>=0},3625(t,r,a){"use strict";let o=a(2398);t.exports=(t,r,a,i,n)=>{"string"==typeof a&&(n=i,i=a,a=void 0);try{return new o(t instanceof o?t.version:t,a).inc(r,i,n).version}catch(t){return null}}},7257(t,r,a){"use strict";let o=a(6958);t.exports=(t,r,a)=>0>o(t,r,a)},5850(t,r,a){"use strict";let o=a(6958);t.exports=(t,r,a)=>0>=o(t,r,a)},7744(t,r,a){"use strict";let o=a(2398);t.exports=(t,r)=>new o(t,r).major},4812(t,r,a){"use strict";let o=a(2398);t.exports=(t,r)=>new o(t,r).minor},733(t,r,a){"use strict";let o=a(6958);t.exports=(t,r,a)=>0!==o(t,r,a)},6802(t,r,a){"use strict";let o=a(2398);t.exports=(t,r,a=!1)=>{if(t instanceof o)return t;try{return new o(t,r)}catch(t){if(!a)return null;throw t}}},8643(t,r,a){"use strict";let o=a(2398);t.exports=(t,r)=>new o(t,r).patch},9283(t,r,a){"use strict";let o=a(6802);t.exports=(t,r)=>{let a=o(t,r);return a&&a.prerelease.length?a.prerelease:null}},7032(t,r,a){"use strict";let o=a(6958);t.exports=(t,r,a)=>o(r,t,a)},9839(t,r,a){"use strict";let o=a(8767);t.exports=(t,r)=>t.sort((t,a)=>o(a,t,r))},4056(t,r,a){"use strict";let o=a(2069);t.exports=(t,r,a)=>{try{r=new o(r,a)}catch(t){return!1}return r.test(t)}},7697(t,r,a){"use strict";let o=a(8767);t.exports=(t,r)=>t.sort((t,a)=>o(t,a,r))},6807(t,r,a){"use strict";let o=a(6802);t.exports=(t,r)=>{let a=o(t,r);return a?a.version:null}},3895(t,r,a){"use strict";let o=a(152),i=a(5076),n=a(2398),s=a(9101),l=a(6802),c=a(6807),u=a(5608),d=a(3625),p=a(3086),h=a(7744),f=a(4812),m=a(8643),y=a(9283),g=a(6958),v=a(7032),b=a(6293),_=a(8767),S=a(7697),w=a(9839),$=a(1686),E=a(7257),P=a(8271),R=a(733),k=a(6479),x=a(5850),T=a(5461),O=a(7771),j=a(8610),C=a(2069),A=a(4056),I=a(6613),N=a(7114),M=a(1008),q=a(203),z=a(5372),D=a(4713),L=a(4497),U=a(9272),H=a(3490);t.exports={parse:l,valid:c,clean:u,inc:d,diff:p,major:h,minor:f,patch:m,prerelease:y,compare:g,rcompare:v,compareLoose:b,compareBuild:_,sort:S,rsort:w,gt:$,lt:E,eq:P,neq:R,gte:k,lte:x,cmp:T,coerce:O,Comparator:j,Range:C,satisfies:A,toComparators:I,maxSatisfying:N,minSatisfying:M,minVersion:q,validRange:z,outside:D,gtr:L,ltr:U,intersects:H,simplifyRange:a(4039),subset:a(22),SemVer:n,re:o.re,src:o.src,tokens:o.t,SEMVER_SPEC_VERSION:i.SEMVER_SPEC_VERSION,RELEASE_TYPES:i.RELEASE_TYPES,compareIdentifiers:s.compareIdentifiers,rcompareIdentifiers:s.rcompareIdentifiers}},5076(t){"use strict";t.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||0x1fffffffffffff,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}},674(t){"use strict";t.exports="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{}},9101(t){"use strict";let r=/^[0-9]+$/,a=(t,a)=>{if("number"==typeof t&&"number"==typeof a)return t===a?0:t<a?-1:1;let o=r.test(t),i=r.test(a);return o&&i&&(t*=1,a*=1),t===a?0:o&&!i?-1:i&&!o?1:t<a?-1:1};t.exports={compareIdentifiers:a,rcompareIdentifiers:(t,r)=>a(r,t)}},2044(t){"use strict";t.exports=class{constructor(){this.max=1e3,this.map=new Map}get(t){let r=this.map.get(t);if(void 0!==r)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&void 0!==r){if(this.map.size>=this.max){let t=this.map.keys().next().value;this.delete(t)}this.map.set(t,r)}return this}}},4621(t){"use strict";let r=Object.freeze({loose:!0}),a=Object.freeze({});t.exports=t=>t?"object"!=typeof t?r:t:a},152(t,r,a){"use strict";let{MAX_SAFE_COMPONENT_LENGTH:o,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:n}=a(5076),s=a(674),l=(r=t.exports={}).re=[],c=r.safeRe=[],u=r.src=[],d=r.safeSrc=[],p=r.t={},h=0,f="[a-zA-Z0-9-]",m=[["\\s",1],["\\d",n],[f,i]],y=(t,r,a)=>{let o=(t=>{for(let[r,a]of m)t=t.split(`${r}*`).join(`${r}{0,${a}}`).split(`${r}+`).join(`${r}{1,${a}}`);return t})(r),i=h++;s(t,i,r),p[t]=i,u[i]=r,d[i]=o,l[i]=new RegExp(r,a?"g":void 0),c[i]=new RegExp(o,a?"g":void 0)};y("NUMERICIDENTIFIER","0|[1-9]\\d*"),y("NUMERICIDENTIFIERLOOSE","\\d+"),y("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f}*`),y("MAINVERSION",`(${u[p.NUMERICIDENTIFIER]})\\.(${u[p.NUMERICIDENTIFIER]})\\.(${u[p.NUMERICIDENTIFIER]})`),y("MAINVERSIONLOOSE",`(${u[p.NUMERICIDENTIFIERLOOSE]})\\.(${u[p.NUMERICIDENTIFIERLOOSE]})\\.(${u[p.NUMERICIDENTIFIERLOOSE]})`),y("PRERELEASEIDENTIFIER",`(?:${u[p.NONNUMERICIDENTIFIER]}|${u[p.NUMERICIDENTIFIER]})`),y("PRERELEASEIDENTIFIERLOOSE",`(?:${u[p.NONNUMERICIDENTIFIER]}|${u[p.NUMERICIDENTIFIERLOOSE]})`),y("PRERELEASE",`(?:-(${u[p.PRERELEASEIDENTIFIER]}(?:\\.${u[p.PRERELEASEIDENTIFIER]})*))`),y("PRERELEASELOOSE",`(?:-?(${u[p.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[p.PRERELEASEIDENTIFIERLOOSE]})*))`),y("BUILDIDENTIFIER",`${f}+`),y("BUILD",`(?:\\+(${u[p.BUILDIDENTIFIER]}(?:\\.${u[p.BUILDIDENTIFIER]})*))`),y("FULLPLAIN",`v?${u[p.MAINVERSION]}${u[p.PRERELEASE]}?${u[p.BUILD]}?`),y("FULL",`^${u[p.FULLPLAIN]}$`),y("LOOSEPLAIN",`[v=\\s]*${u[p.MAINVERSIONLOOSE]}${u[p.PRERELEASELOOSE]}?${u[p.BUILD]}?`),y("LOOSE",`^${u[p.LOOSEPLAIN]}$`),y("GTLT","((?:<|>)?=?)"),y("XRANGEIDENTIFIERLOOSE",`${u[p.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),y("XRANGEIDENTIFIER",`${u[p.NUMERICIDENTIFIER]}|x|X|\\*`),y("XRANGEPLAIN",`[v=\\s]*(${u[p.XRANGEIDENTIFIER]})(?:\\.(${u[p.XRANGEIDENTIFIER]})(?:\\.(${u[p.XRANGEIDENTIFIER]})(?:${u[p.PRERELEASE]})?${u[p.BUILD]}?)?)?`),y("XRANGEPLAINLOOSE",`[v=\\s]*(${u[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[p.XRANGEIDENTIFIERLOOSE]})(?:${u[p.PRERELEASELOOSE]})?${u[p.BUILD]}?)?)?`),y("XRANGE",`^${u[p.GTLT]}\\s*${u[p.XRANGEPLAIN]}$`),y("XRANGELOOSE",`^${u[p.GTLT]}\\s*${u[p.XRANGEPLAINLOOSE]}$`),y("COERCEPLAIN",`(^|[^\\d])(\\d{1,${o}})(?:\\.(\\d{1,${o}}))?(?:\\.(\\d{1,${o}}))?`),y("COERCE",`${u[p.COERCEPLAIN]}(?:$|[^\\d])`),y("COERCEFULL",u[p.COERCEPLAIN]+`(?:${u[p.PRERELEASE]})?`+`(?:${u[p.BUILD]})?`+"(?:$|[^\\d])"),y("COERCERTL",u[p.COERCE],!0),y("COERCERTLFULL",u[p.COERCEFULL],!0),y("LONETILDE","(?:~>?)"),y("TILDETRIM",`(\\s*)${u[p.LONETILDE]}\\s+`,!0),r.tildeTrimReplace="$1~",y("TILDE",`^${u[p.LONETILDE]}${u[p.XRANGEPLAIN]}$`),y("TILDELOOSE",`^${u[p.LONETILDE]}${u[p.XRANGEPLAINLOOSE]}$`),y("LONECARET","(?:\\^)"),y("CARETTRIM",`(\\s*)${u[p.LONECARET]}\\s+`,!0),r.caretTrimReplace="$1^",y("CARET",`^${u[p.LONECARET]}${u[p.XRANGEPLAIN]}$`),y("CARETLOOSE",`^${u[p.LONECARET]}${u[p.XRANGEPLAINLOOSE]}$`),y("COMPARATORLOOSE",`^${u[p.GTLT]}\\s*(${u[p.LOOSEPLAIN]})$|^$`),y("COMPARATOR",`^${u[p.GTLT]}\\s*(${u[p.FULLPLAIN]})$|^$`),y("COMPARATORTRIM",`(\\s*)${u[p.GTLT]}\\s*(${u[p.LOOSEPLAIN]}|${u[p.XRANGEPLAIN]})`,!0),r.comparatorTrimReplace="$1$2$3",y("HYPHENRANGE",`^\\s*(${u[p.XRANGEPLAIN]})\\s+-\\s+(${u[p.XRANGEPLAIN]})\\s*$`),y("HYPHENRANGELOOSE",`^\\s*(${u[p.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[p.XRANGEPLAINLOOSE]})\\s*$`),y("STAR","(<|>)?=?\\s*\\*"),y("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),y("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")},4497(t,r,a){"use strict";let o=a(4713);t.exports=(t,r,a)=>o(t,r,">",a)},3490(t,r,a){"use strict";let o=a(2069);t.exports=(t,r,a)=>(t=new o(t,a),r=new o(r,a),t.intersects(r,a))},9272(t,r,a){"use strict";let o=a(4713);t.exports=(t,r,a)=>o(t,r,"<",a)},7114(t,r,a){"use strict";let o=a(2398),i=a(2069);t.exports=(t,r,a)=>{let n=null,s=null,l=null;try{l=new i(r,a)}catch(t){return null}return t.forEach(t=>{l.test(t)&&(!n||-1===s.compare(t))&&(s=new o(n=t,a))}),n}},1008(t,r,a){"use strict";let o=a(2398),i=a(2069);t.exports=(t,r,a)=>{let n=null,s=null,l=null;try{l=new i(r,a)}catch(t){return null}return t.forEach(t=>{l.test(t)&&(!n||1===s.compare(t))&&(s=new o(n=t,a))}),n}},203(t,r,a){"use strict";let o=a(2398),i=a(2069),n=a(1686);t.exports=(t,r)=>{t=new i(t,r);let a=new o("0.0.0");if(t.test(a)||(a=new o("0.0.0-0"),t.test(a)))return a;a=null;for(let r=0;r<t.set.length;++r){let i=t.set[r],s=null;i.forEach(t=>{let r=new o(t.semver.version);switch(t.operator){case">":0===r.prerelease.length?r.patch++:r.prerelease.push(0),r.raw=r.format();case"":case">=":(!s||n(r,s))&&(s=r);break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${t.operator}`)}}),s&&(!a||n(a,s))&&(a=s)}return a&&t.test(a)?a:null}},4713(t,r,a){"use strict";let o=a(2398),i=a(8610),{ANY:n}=i,s=a(2069),l=a(4056),c=a(1686),u=a(7257),d=a(5850),p=a(6479);t.exports=(t,r,a,h)=>{let f,m,y,g,v;switch(t=new o(t,h),r=new s(r,h),a){case">":f=c,m=d,y=u,g=">",v=">=";break;case"<":f=u,m=p,y=c,g="<",v="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(l(t,r,h))return!1;for(let a=0;a<r.set.length;++a){let o=r.set[a],s=null,l=null;if(o.forEach(t=>{t.semver===n&&(t=new i(">=0.0.0")),s=s||t,l=l||t,f(t.semver,s.semver,h)?s=t:y(t.semver,l.semver,h)&&(l=t)}),s.operator===g||s.operator===v||(!l.operator||l.operator===g)&&m(t,l.semver)||l.operator===v&&y(t,l.semver))return!1}return!0}},4039(t,r,a){"use strict";let o=a(4056),i=a(6958);t.exports=(t,r,a)=>{let n=[],s=null,l=null,c=t.sort((t,r)=>i(t,r,a));for(let t of c)o(t,r,a)?(l=t,s||(s=t)):(l&&n.push([s,l]),l=null,s=null);s&&n.push([s,null]);let u=[];for(let[t,r]of n)t===r?u.push(t):r||t!==c[0]?r?t===c[0]?u.push(`<=${r}`):u.push(`${t} - ${r}`):u.push(`>=${t}`):u.push("*");let d=u.join(" || "),p="string"==typeof r.raw?r.raw:String(r);return d.length<p.length?d:r}},22(t,r,a){"use strict";let o=a(2069),i=a(8610),{ANY:n}=i,s=a(4056),l=a(6958),c=[new i(">=0.0.0-0")],u=[new i(">=0.0.0")],d=(t,r,a)=>{let o,i,d,f,m,y,g;if(t===r)return!0;if(1===t.length&&t[0].semver===n)if(1===r.length&&r[0].semver===n)return!0;else t=a.includePrerelease?c:u;if(1===r.length&&r[0].semver===n)if(a.includePrerelease)return!0;else r=u;let v=new Set;for(let r of t)">"===r.operator||">="===r.operator?o=p(o,r,a):"<"===r.operator||"<="===r.operator?i=h(i,r,a):v.add(r.semver);if(v.size>1)return null;if(o&&i&&((d=l(o.semver,i.semver,a))>0||0===d&&(">="!==o.operator||"<="!==i.operator)))return null;for(let t of v){if(o&&!s(t,String(o),a)||i&&!s(t,String(i),a))return null;for(let o of r)if(!s(t,String(o),a))return!1;return!0}let b=!!i&&!a.includePrerelease&&!!i.semver.prerelease.length&&i.semver,_=!!o&&!a.includePrerelease&&!!o.semver.prerelease.length&&o.semver;for(let t of(b&&1===b.prerelease.length&&"<"===i.operator&&0===b.prerelease[0]&&(b=!1),r)){if(g=g||">"===t.operator||">="===t.operator,y=y||"<"===t.operator||"<="===t.operator,o){if(_&&t.semver.prerelease&&t.semver.prerelease.length&&t.semver.major===_.major&&t.semver.minor===_.minor&&t.semver.patch===_.patch&&(_=!1),">"===t.operator||">="===t.operator){if((f=p(o,t,a))===t&&f!==o)return!1}else if(">="===o.operator&&!s(o.semver,String(t),a))return!1}if(i){if(b&&t.semver.prerelease&&t.semver.prerelease.length&&t.semver.major===b.major&&t.semver.minor===b.minor&&t.semver.patch===b.patch&&(b=!1),"<"===t.operator||"<="===t.operator){if((m=h(i,t,a))===t&&m!==i)return!1}else if("<="===i.operator&&!s(i.semver,String(t),a))return!1}if(!t.operator&&(i||o)&&0!==d)return!1}return(!o||!y||!!i||0===d)&&(!i||!g||!!o||0===d)&&!_&&!b&&!0},p=(t,r,a)=>{if(!t)return r;let o=l(t.semver,r.semver,a);return o>0?t:o<0||">"===r.operator&&">="===t.operator?r:t},h=(t,r,a)=>{if(!t)return r;let o=l(t.semver,r.semver,a);return o<0?t:o>0||"<"===r.operator&&"<="===t.operator?r:t};t.exports=(t,r,a={})=>{if(t===r)return!0;t=new o(t,a),r=new o(r,a);let i=!1;e:for(let o of t.set){for(let t of r.set){let r=d(o,t,a);if(i=i||null!==r,r)continue e}if(i)return!1}return!0}},6613(t,r,a){"use strict";let o=a(2069);t.exports=(t,r)=>new o(t,r).set.map(t=>t.map(t=>t.value).join(" ").trim().split(" "))},5372(t,r,a){"use strict";let o=a(2069);t.exports=(t,r)=>{try{return new o(t,r).range||"*"}catch(t){return null}}},600(t,r,a){"use strict";let o=a(9638);t.exports=(t="")=>{let r=t.match(o);if(!r)return null;let[a,i]=r[0].replace(/#! ?/,"").split(" "),n=a.split("/").pop();return"env"===n?i:i?`${n} ${i}`:n}},9638(t){"use strict";t.exports=/^#!(.*)/},1905(t,r,a){let o="win32"===process.platform||"cygwin"===process.env.OSTYPE||"msys"===process.env.OSTYPE,i=a(6928),n=o?";":":",s=a(9344),l=t=>Object.assign(Error(`not found: ${t}`),{code:"ENOENT"}),c=(t,r)=>{let a=r.colon||n,i=t.match(/\//)||o&&t.match(/\\/)?[""]:[...o?[process.cwd()]:[],...(r.path||process.env.PATH||"").split(a)],s=o?r.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",l=o?s.split(a):[""];return o&&-1!==t.indexOf(".")&&""!==l[0]&&l.unshift(""),{pathEnv:i,pathExt:l,pathExtExe:s}},u=(t,r,a)=>{"function"==typeof r&&(a=r,r={}),r||(r={});let{pathEnv:o,pathExt:n,pathExtExe:u}=c(t,r),d=[],p=a=>new Promise((n,s)=>{if(a===o.length)return r.all&&d.length?n(d):s(l(t));let c=o[a],u=/^".*"$/.test(c)?c.slice(1,-1):c,p=i.join(u,t);n(h(!u&&/^\.[\\\/]/.test(t)?t.slice(0,2)+p:p,a,0))}),h=(t,a,o)=>new Promise((i,l)=>{if(o===n.length)return i(p(a+1));let c=n[o];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,a,o+1))})});return a?p(0).then(t=>a(null,t),a):p(0)};t.exports=u,u.sync=(t,r)=>{let{pathEnv:a,pathExt:o,pathExtExe:n}=c(t,r=r||{}),u=[];for(let l=0;l<a.length;l++){let c=a[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<o.length;t++){let a=h+o[t];try{if(s.sync(a,{pathExt:n}))if(!r.all)return a;else u.push(a)}catch(t){}}}if(r.all&&u.length)return u;if(r.nothrow)return null;throw l(t)}},181(t){"use strict";t.exports=require("buffer")},5317(t){"use strict";t.exports=require("child_process")},6982(t){"use strict";t.exports=require("crypto")},9896(t){"use strict";t.exports=require("fs")},7598(t){"use strict";t.exports=require("node:crypto")},857(t){"use strict";t.exports=require("os")},6928(t){"use strict";t.exports=require("path")},2203(t){"use strict";t.exports=require("stream")},9023(t){"use strict";t.exports=require("util")},4953(r){"use strict";r.exports=t},8775(t,r,a){"use strict";let o,i;a.r(r),a.d(r,{jwksCache:()=>tH,FlattenedEncrypt:()=>tu,decodeProtectedHeader:()=>tJ,generateSecret:()=>tZ,flattenedDecrypt:()=>ts,exportSPKI:()=>e0,flattenedVerify:()=>th,jwtDecrypt:()=>tE,customFetch:()=>tL,importSPKI:()=>eG,CompactEncrypt:()=>tP,importPKCS8:()=>eX,decodeJwt:()=>tW,errors:()=>s,generalVerify:()=>tm,compactDecrypt:()=>tl,compactVerify:()=>tf,EmbeddedJWK:()=>tN,exportPKCS8:()=>e1,CompactSign:()=>tk,cryptoRuntime:()=>tX,generalDecrypt:()=>tc,createLocalJWKSet:()=>tD,FlattenedSign:()=>tR,jwtVerify:()=>t$,GeneralEncrypt:()=>tp,EncryptJWT:()=>tj,calculateJwkThumbprintUri:()=>tI,SignJWT:()=>tO,exportJWK:()=>e2,importX509:()=>eZ,importJWK:()=>eY,GeneralSign:()=>tT,createRemoteJWKSet:()=>tK,generateKeyPair:()=>tG,calculateJwkThumbprint:()=>tA,base64url:()=>n,UnsecuredJWT:()=>tF});var n={};a.r(n),a.d(n,{decode:()=>g,encode:()=>v});var s={};a.r(s),a.d(s,{JOSEAlgNotAllowed:()=>T,JOSEError:()=>R,JOSENotSupported:()=>O,JWEDecryptionFailed:()=>j,JWEInvalid:()=>C,JWKInvalid:()=>N,JWKSInvalid:()=>M,JWKSMultipleMatchingKeys:()=>z,JWKSNoMatchingKey:()=>q,JWKSTimeout:()=>D,JWSInvalid:()=>A,JWSSignatureVerificationFailed:()=>L,JWTClaimValidationFailed:()=>k,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)),a=0;for(let o of t)r.set(o,a),a+=o.length;return r}function d(t,r,a){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],a)}function p(t){let r=Math.floor(t/0x100000000),a=new Uint8Array(8);return d(a,r,0),d(a,t%0x100000000,4),a}function h(t){let r=new Uint8Array(4);return d(r,t),r}function f(t){let r=new Uint8Array(t.length);for(let a=0;a<t.length;a++){let o=t.charCodeAt(a);if(o>127)throw TypeError("non-ASCII string encountered in encode()");r[a]=o}return r}function m(t){if(Uint8Array.prototype.toBase64)return t.toBase64();let r=[];for(let a=0;a<t.length;a+=32768)r.push(String.fromCharCode.apply(null,t.subarray(a,a+32768)));return btoa(r.join(""))}function y(t){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(t);let r=atob(t),a=new Uint8Array(r.length);for(let t=0;t<r.length;t++)a[t]=r.charCodeAt(t);return a}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 b=(t,r="algorithm.name")=>TypeError(`CryptoKey does not support this operation, its ${r} must be ${t}`);function _(t,r){if(parseInt(t.hash.name.slice(4),10)!==r)throw b(`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,a){switch(r){case"A128GCM":case"A192GCM":case"A256GCM":{if("AES-GCM"!==t.algorithm.name)throw b("AES-GCM");let a=parseInt(r.slice(1,4),10);if(t.algorithm.length!==a)throw b(a,"algorithm.length");break}case"A128KW":case"A192KW":case"A256KW":{if("AES-KW"!==t.algorithm.name)throw b("AES-KW");let a=parseInt(r.slice(1,4),10);if(t.algorithm.length!==a)throw b(a,"algorithm.length");break}case"ECDH":switch(t.algorithm.name){case"ECDH":case"X25519":break;default:throw b("ECDH or X25519")}break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":if("PBKDF2"!==t.algorithm.name)throw b("PBKDF2");break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":if("RSA-OAEP"!==t.algorithm.name)throw b("RSA-OAEP");_(t.algorithm,parseInt(r.slice(9),10)||1);break;default:throw TypeError("CryptoKey does not support this operation")}S(t,a)}function $(t,r,...a){if((a=a.filter(Boolean)).length>2){let r=a.pop();t+=`one of type ${a.join(", ")}, or ${r}.`}else 2===a.length?t+=`one of type ${a[0]} or ${a[1]}.`:t+=`of type ${a[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,...a)=>$(`Key for the ${t} algorithm must be `,r,...a);class R 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 k extends R{static code="ERR_JWT_CLAIM_VALIDATION_FAILED";code="ERR_JWT_CLAIM_VALIDATION_FAILED";claim;reason;payload;constructor(t,r,a="unspecified",o="unspecified"){super(t,{cause:{claim:a,reason:o,payload:r}}),this.claim=a,this.reason=o,this.payload=r}}class x extends R{static code="ERR_JWT_EXPIRED";code="ERR_JWT_EXPIRED";claim;reason;payload;constructor(t,r,a="unspecified",o="unspecified"){super(t,{cause:{claim:a,reason:o,payload:r}}),this.claim=a,this.reason=o,this.payload=r}}class T extends R{static code="ERR_JOSE_ALG_NOT_ALLOWED";code="ERR_JOSE_ALG_NOT_ALLOWED"}class O extends R{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"}class j extends R{static code="ERR_JWE_DECRYPTION_FAILED";code="ERR_JWE_DECRYPTION_FAILED";constructor(t="decryption operation failed",r){super(t,r)}}class C extends R{static code="ERR_JWE_INVALID";code="ERR_JWE_INVALID"}class A extends R{static code="ERR_JWS_INVALID";code="ERR_JWS_INVALID"}class I extends R{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"}class N extends R{static code="ERR_JWK_INVALID";code="ERR_JWK_INVALID"}class M extends R{static code="ERR_JWKS_INVALID";code="ERR_JWKS_INVALID"}class q extends R{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 z extends R{[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 D extends R{static code="ERR_JWKS_TIMEOUT";code="ERR_JWKS_TIMEOUT";constructor(t="request timed out",r){super(t,r)}}class L extends R{static code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";constructor(t="signature verification failed",r){super(t,r)}}function U(t){if(!H(t))throw Error("CryptoKey instance expected")}let H=t=>{if(t?.[Symbol.toStringTag]==="CryptoKey")return!0;try{return t instanceof CryptoKey}catch{return!1}},V=t=>t?.[Symbol.toStringTag]==="KeyObject",K=t=>H(t)||V(t);function F(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 O(`Unsupported JWE Algorithm: ${t}`)}}let J=t=>crypto.getRandomValues(new Uint8Array(F(t)>>3));function W(t,r){let a=t.byteLength<<3;if(a!==r)throw new C(`Invalid Content Encryption Key length. Expected ${r} bits, got ${a} 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 O(`Unsupported JWE Algorithm: ${t}`)}}function G(t,r){if(r.length<<3!==B(t))throw new C("Invalid Initialization Vector length")}async function Z(t,r,a){if(!(r instanceof Uint8Array))throw TypeError(E(r,"Uint8Array"));let o=parseInt(t.slice(1,4),10);return{encKey:await crypto.subtle.importKey("raw",r.subarray(o>>3),"AES-CBC",!1,[a]),macKey:await crypto.subtle.importKey("raw",r.subarray(0,o>>3),{hash:`SHA-${o<<1}`,name:"HMAC"},!1,["sign"]),keySize:o}}async function X(t,r,a){return new Uint8Array((await crypto.subtle.sign("HMAC",t,r)).slice(0,a>>3))}async function Y(t,r,a,o,i){let{encKey:n,macKey:s,keySize:l}=await Z(t,a,"encrypt"),c=new Uint8Array(await crypto.subtle.encrypt({iv:o,name:"AES-CBC"},n,r)),d=u(i,o,c,p(i.length<<3));return{ciphertext:c,tag:await X(s,d,l),iv:o}}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 a={name:"HMAC",hash:"SHA-256"},o=await crypto.subtle.generateKey(a,!1,["sign"]),i=new Uint8Array(await crypto.subtle.sign(a,o,t)),n=new Uint8Array(await crypto.subtle.sign(a,o,r)),s=0,l=-1;for(;++l<32;)s|=i[l]^n[l];return 0===s}async function ee(t,r,a,o,i,n){let s,l,{encKey:c,macKey:d,keySize:h}=await Z(t,r,"decrypt"),f=u(n,o,a,p(n.length<<3)),m=await X(d,f,h);try{s=await Q(i,m)}catch{}if(!s)throw new j;try{l=new Uint8Array(await crypto.subtle.decrypt({iv:o,name:"AES-CBC"},c,a))}catch{}if(!l)throw new j;return l}async function et(t,r,a,o,i){let n;a instanceof Uint8Array?n=await crypto.subtle.importKey("raw",a,"AES-GCM",!1,["encrypt"]):(w(a,t,"encrypt"),n=a);let s=new Uint8Array(await crypto.subtle.encrypt({additionalData:i,iv:o,name:"AES-GCM",tagLength:128},n,r)),l=s.slice(-16);return{ciphertext:s.slice(0,-16),tag:l,iv:o}}async function er(t,r,a,o,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:o,name:"AES-GCM",tagLength:128},s,u(a,i)))}catch{throw new j}}let ea="Unsupported JWE Content Encryption Algorithm";async function eo(t,r,a,o,i){if(!H(a)&&!(a instanceof Uint8Array))throw TypeError(E(a,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(o)G(t,o);else o=crypto.getRandomValues(new Uint8Array(B(t)>>3));switch(t){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return a instanceof Uint8Array&&W(a,parseInt(t.slice(-3),10)),Y(t,r,a,o,i);case"A128GCM":case"A192GCM":case"A256GCM":return a instanceof Uint8Array&&W(a,parseInt(t.slice(1,4),10)),et(t,r,a,o,i);default:throw new O(ea)}}async function ei(t,r,a,o,i,n){if(!H(r)&&!(r instanceof Uint8Array))throw TypeError(E(r,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(!o)throw new C("JWE Initialization Vector missing");if(!i)throw new C("JWE Authentication Tag missing");switch(G(t,o),t){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return r instanceof Uint8Array&&W(r,parseInt(t.slice(-3),10)),ee(t,r,a,o,i,n);case"A128GCM":case"A192GCM":case"A256GCM":return r instanceof Uint8Array&&W(r,parseInt(t.slice(1,4),10)),er(t,r,a,o,i,n);default:throw new O(ea)}}let en=Symbol();function es(t,r){if(t)throw TypeError(`${r} can only be called once`)}function el(t,r,a){try{return g(t)}catch{throw new a(`Failed to base64url decode the ${r}`)}}async function ec(t,r){let a=`SHA-${t.slice(-3)}`;return new Uint8Array(await crypto.subtle.digest(a,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,a=t.filter(Boolean);if(0===a.length||1===a.length)return!0;for(let t of a){let a=Object.keys(t);if(!r||0===r.size){r=new Set(a);continue}for(let t of a){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,a){return t instanceof Uint8Array?crypto.subtle.importKey("raw",t,"AES-KW",!0,[a]):(w(t,r,a),t)}async function em(t,r,a){let o=await ef(r,t,"wrapKey");eh(o,t);let i=await crypto.subtle.importKey("raw",a,{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.wrapKey("raw",i,o,"AES-KW"))}async function ey(t,r,a){let o=await ef(r,t,"unwrapKey");eh(o,t);let i=await crypto.subtle.unwrapKey("raw",a,o,"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,a){let o=r>>3,i=Math.ceil(o/32),n=new Uint8Array(32*i);for(let r=1;r<=i;r++){let o=new Uint8Array(4+t.length+a.length);o.set(h(r),0),o.set(t,4),o.set(a,4+t.length);let i=await ec("sha256",o);n.set(i,(r-1)*32)}return n.slice(0,o)}async function eb(t,r,a,o,i=new Uint8Array,n=new Uint8Array){var s;w(t,"ECDH"),w(r,"ECDH","deriveBits");let l=u(eg(f(a)),eg(i),eg(n),h(o),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)),o,l)}function e_(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,a,o){if(!(t instanceof Uint8Array)||t.length<8)throw new C("PBES2 Salt Input must be 8 or more octets");if(!Number.isSafeInteger(a)||1!==Math.sign(a))throw new C("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:a,name:"PBKDF2",salt:i},l=await (o instanceof Uint8Array?crypto.subtle.importKey("raw",o,"PBKDF2",!1,["deriveBits"]):(w(o,r,"deriveBits"),o));return new Uint8Array(await crypto.subtle.deriveBits(s,l,n))}async function ew(t,r,a,o=2048,i=crypto.getRandomValues(new Uint8Array(16))){let n=await eS(i,t,o,r);return{encryptedKey:await em(t.slice(-6),n,a),p2c:o,p2s:v(i)}}async function e$(t,r,a,o,i){let n=await eS(i,t,o,r);return ey(t.slice(-6),n,a)}function eE(t,r){if(t.startsWith("RS")||t.startsWith("PS")){let{modulusLength:a}=r.algorithm;if("number"!=typeof a||a<2048)throw TypeError(`${t} requires key modulusLength to be 2048 bits or larger`)}}function eP(t,r){let a=`SHA-${t.slice(-3)}`;switch(t){case"HS256":case"HS384":case"HS512":return{hash:a,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:a,name:"RSA-PSS",saltLength:parseInt(t.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:a,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:a,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 O(`alg ${t} is not supported either by JOSE or your javascript runtime`)}}async function eR(t,r,a){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,[a])}switch(t){case"HS256":case"HS384":case"HS512":if("HMAC"!==r.algorithm.name)throw b("HMAC");_(r.algorithm,parseInt(t.slice(2),10));break;case"RS256":case"RS384":case"RS512":if("RSASSA-PKCS1-v1_5"!==r.algorithm.name)throw b("RSASSA-PKCS1-v1_5");_(r.algorithm,parseInt(t.slice(2),10));break;case"PS256":case"PS384":case"PS512":if("RSA-PSS"!==r.algorithm.name)throw b("RSA-PSS");_(r.algorithm,parseInt(t.slice(2),10));break;case"Ed25519":case"EdDSA":if("Ed25519"!==r.algorithm.name)throw b("Ed25519");break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":let o;if(o=r.algorithm,o.name!==t)throw b(t);break;case"ES256":case"ES384":case"ES512":{if("ECDSA"!==r.algorithm.name)throw b("ECDSA");let a=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!==a)throw b(a,"algorithm.namedCurve");break}default:throw TypeError("CryptoKey does not support this operation")}return S(r,a),r}async function ek(t,r,a){let o=await eR(t,r,"sign");return eE(t,o),new Uint8Array(await crypto.subtle.sign(eP(t,o.algorithm),o,a))}async function ex(t,r,a,o){let i=await eR(t,r,"verify");eE(t,i);let n=eP(t,i.algorithm);try{return await crypto.subtle.verify(n,i,a,o)}catch{return!1}}let eT=t=>{switch(t){case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return"RSA-OAEP";default:throw new O(`alg ${t} is not supported either by JOSE or your javascript runtime`)}};async function eO(t,r,a){return w(r,t,"encrypt"),eE(t,r),new Uint8Array(await crypto.subtle.encrypt(eT(t),r,a))}async function ej(t,r,a){return w(r,t,"decrypt"),eE(t,r),new Uint8Array(await crypto.subtle.decrypt(eT(t),r,a))}let eC='Invalid or unsupported JWK "alg" (Algorithm) Parameter value';async function eA(t){if(!t.alg)throw TypeError('"alg" argument is required when "jwk.alg" is not present');let{algorithm:r,keyUsages:a}=function(t){let r,a;switch(t.kty){case"AKP":switch(t.alg){case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":r={name:t.alg},a=t.priv?["sign"]:["verify"];break;default:throw new O(eC)}break;case"RSA":switch(t.alg){case"PS256":case"PS384":case"PS512":r={name:"RSA-PSS",hash:`SHA-${t.alg.slice(-3)}`},a=t.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":r={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${t.alg.slice(-3)}`},a=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}`},a=t.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new O(eC)}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]},a=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},a=t.d?["deriveBits"]:[];break;default:throw new O(eC)}break;case"OKP":switch(t.alg){case"Ed25519":case"EdDSA":r={name:"Ed25519"},a=t.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":r={name:t.crv},a=t.d?["deriveBits"]:[];break;default:throw new O(eC)}break;default:throw new O('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:r,keyUsages:a}}(t),o={...t};return"AKP"!==o.kty&&delete o.alg,delete o.use,crypto.subtle.importKey("jwk",o,r,t.ext??(!t.d&&!t.priv),t.key_ops??a)}let eI="given KeyObject instance cannot be used for this algorithm",eN=async(t,r,a,i=!1)=>{let n=(o||=new WeakMap).get(t);if(n?.[a])return n[a];let s=await eA({...r,alg:a});return i&&Object.freeze(t),n?n[a]=s:o.set(t,{[a]:s}),s};async function eM(t,r){if(t instanceof Uint8Array||H(t))return t;if(V(t)){if("secret"===t.type)return t.export();if("toCryptoKey"in t&&"function"==typeof t.toCryptoKey)try{return((t,r)=>{let a,i=(o||=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)}a=t.toCryptoKey(t.asymmetricKeyType,s,n?[]:["deriveBits"])}if("ed25519"===t.asymmetricKeyType){if("EdDSA"!==r&&"Ed25519"!==r)throw TypeError(eI);a=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);a=t.toCryptoKey(t.asymmetricKeyType,s,[n?"verify":"sign"])}if("rsa"===t.asymmetricKeyType){let o;switch(r){case"RSA-OAEP":o="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":o="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":o="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":o="SHA-512";break;default:throw TypeError(eI)}if(r.startsWith("RSA-OAEP"))return t.toCryptoKey({name:"RSA-OAEP",hash:o},s,n?["encrypt"]:["decrypt"]);a=t.toCryptoKey({name:r.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:o},s,[n?"verify":"sign"])}if("ec"===t.asymmetricKeyType){let o=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(t.asymmetricKeyDetails?.namedCurve);if(!o)throw TypeError(eI);let i={ES256:"P-256",ES384:"P-384",ES512:"P-521"};i[r]&&o===i[r]&&(a=t.toCryptoKey({name:"ECDSA",namedCurve:o},s,[n?"verify":"sign"])),r.startsWith("ECDH-ES")&&(a=t.toCryptoKey({name:"ECDH",namedCurve:o},s,n?[]:["deriveBits"]))}if(!a)throw TypeError(eI);return i?i[r]=a:o.set(t,{[r]:a}),a})(t,r)}catch(t){if(t instanceof TypeError)throw t}let a=t.export({format:"jwk"});return eN(t,a,r)}if(ep(t))return t.k?g(t.k):eN(t,t,r,!0);throw Error("unreachable")}let eq=(t,r)=>{let a=(t.match(/.{1,64}/g)||[]).join("\n");return`-----BEGIN ${r}-----
|
|
2
|
+
${a}
|
|
3
|
+
-----END ${r}-----`},ez=async(t,r,a)=>{if(V(a)){if(a.type!==t)throw TypeError(`key is not a ${t} key`);return a.export({format:"pem",type:r})}if(!H(a))throw TypeError(E(a,"CryptoKey","KeyObject"));if(!a.extractable)throw TypeError("CryptoKey is not extractable");if(a.type!==t)throw TypeError(`key is not a ${t} key`);return eq(m(new Uint8Array(await crypto.subtle.exportKey(r,a))),`${t.toUpperCase()} KEY`)},eD=(t,r)=>{if(t.byteLength!==r.length)return!1;for(let a=0;a<t.byteLength;a++)if(t[a]!==r[a])return!1;return!0},eL=t=>({data:t,pos:0}),eU=t=>{let r=t.data[t.pos++];if(128&r){let a=127&r,o=0;for(let r=0;r<a;r++)o=o<<8|t.data[t.pos++];return o}return r},eH=(t,r=1)=>{if(r<=0)return;t.pos++;let a=eU(t);t.pos+=a,r>1&&eH(t,r-1)},eV=(t,r,a)=>{if(t.data[t.pos++]!==r)throw Error(a)},eK=(t,r)=>{let a=t.data.subarray(t.pos,t.pos+r);return t.pos+=r,a},eF=t=>{let r,a=(eV(t,6,"Expected algorithm OID"),r=eU(t),eK(t,r));if(eD(a,[43,101,110]))return"X25519";if(!eD(a,[42,134,72,206,61,2,1]))throw Error("Unsupported key algorithm");eV(t,6,"Expected curve OID");let o=eU(t),i=eK(t,o);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(eD(i,r))return t;throw Error("Unsupported named curve")},eJ=async(t,r,a,o)=>{let i,n,s="spki"===t,l=()=>s?["verify"]:["sign"];switch(a){case"PS256":case"PS384":case"PS512":i={name:"RSA-PSS",hash:`SHA-${a.slice(-3)}`},n=l();break;case"RS256":case"RS384":case"RS512":i={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${a.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(a.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"})[a]},n=l();break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":try{let t=o.getNamedCurve(r);i="X25519"===t?{name:"X25519"}:{name:"ECDH",namedCurve:t}}catch(t){throw new O("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:a},n=l();break;default:throw new O('Invalid or unsupported "alg" (Algorithm) value')}return crypto.subtle.importKey(t,r,i,o?.extractable??!!s,n)},eW=(t,r)=>y(t.replace(r,"")),eB=(t,r,a)=>{let o=eW(t,/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g),i=a;return r?.startsWith?.("ECDH-ES")&&((i||={}).getNamedCurve=t=>{let r=eL(t);return eV(r,48,"Invalid SPKI structure"),eU(r),eV(r,48,"Expected algorithm identifier"),eU(r),r.pos,eF(r)}),eJ("spki",o,r,i)};async function eG(t,r,a){if("string"!=typeof t||0!==t.indexOf("-----BEGIN PUBLIC KEY-----"))throw TypeError('"spki" must be SPKI formatted string');return eB(t,r,a)}async function eZ(t,r,a){if("string"!=typeof t||0!==t.indexOf("-----BEGIN CERTIFICATE-----"))throw TypeError('"x509" must be X.509 formatted string');return((t,r,a)=>{let o;try{var i;let r,a,n;r=eL(i=eW(t,/(?:-----(?:BEGIN|END) CERTIFICATE-----|\s)/g)),eV(r,48,"Invalid certificate structure"),eU(r),eV(r,48,"Invalid tbsCertificate structure"),eU(r),160===i[r.pos]?eH(r,6):eH(r,5),a=r.pos,eV(r,48,"Invalid SPKI structure"),n=eU(r),o=i.subarray(a,a+n+(r.pos-a))}catch(t){throw TypeError("Failed to parse the X.509 certificate",{cause:t})}return eB(eq(m(o),"PUBLIC KEY"),r,a)})(t,r,a)}async function eX(t,r,a){let o,i;if("string"!=typeof t||0!==t.indexOf("-----BEGIN PRIVATE KEY-----"))throw TypeError('"pkcs8" must be PKCS#8 formatted string');return o=eW(t,/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g),i=a,r?.startsWith?.("ECDH-ES")&&((i||={}).getNamedCurve=t=>{let r,a=eL(t);return eV(a,48,"Invalid PKCS#8 structure"),eU(a),eV(a,2,"Expected version field"),r=eU(a),a.pos+=r,eV(a,48,"Expected algorithm identifier"),eU(a),a.pos,eF(a)}),eJ("pkcs8",o,r,i)}async function eY(t,r,a){let o;if(!eu(t))throw TypeError("JWK must be an object");switch(r??=t.alg,o??=a?.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 O('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');return eA({...t,alg:r,ext:o});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 eA({...t,ext:o});case"EC":case"OKP":return eA({...t,alg:r,ext:o});default:throw new O('Unsupported "kty" (Key Type) Parameter value')}}async function eQ(t){if(V(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(!H(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:a,alg:o,use:i,...n}=await crypto.subtle.exportKey("jwk",t);return"AKP"===n.kty&&(n.alg=o),n}async function e0(t){return ez("public","spki",t)}async function e1(t){return ez("private","pkcs8",t)}async function e2(t){return eQ(t)}async function e9(t,r,a,o){let i=t.slice(0,7),n=await eo(i,a,r,o,new Uint8Array);return{encryptedKey:n.ciphertext,iv:v(n.iv),tag:v(n.tag)}}async function e4(t,r,a,o,i){return ei(t.slice(0,7),r,a,o,i,new Uint8Array)}let e5='Invalid or unsupported "alg" (JWE Algorithm) header value';function e6(t){if(void 0===t)throw new C("JWE Encrypted Key missing")}async function e3(t,r,a,o,i){switch(t){case"dir":if(void 0!==a)throw new C("Encountered unexpected JWE Encrypted Key");return r;case"ECDH-ES":if(void 0!==a)throw new C("Encountered unexpected JWE Encrypted Key");case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{let i,n;if(!eu(o.epk))throw new C('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');if(U(r),!e_(r))throw new O("ECDH with the provided key is not allowed or not supported by your javascript runtime");let s=await eY(o.epk,t);if(U(s),void 0!==o.apu){if("string"!=typeof o.apu)throw new C('JOSE Header "apu" (Agreement PartyUInfo) invalid');i=el(o.apu,"apu",C)}if(void 0!==o.apv){if("string"!=typeof o.apv)throw new C('JOSE Header "apv" (Agreement PartyVInfo) invalid');n=el(o.apv,"apv",C)}let l=await eb(s,r,"ECDH-ES"===t?o.enc:t,"ECDH-ES"===t?F(o.enc):parseInt(t.slice(-5,-2),10),i,n);if("ECDH-ES"===t)return l;return e6(a),ey(t.slice(-6),l,a)}case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return e6(a),U(r),ej(t,r,a);case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{let n;if(e6(a),"number"!=typeof o.p2c)throw new C('JOSE Header "p2c" (PBES2 Count) missing or invalid');let s=i?.maxPBES2Count||1e4;if(o.p2c>s)throw new C('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if("string"!=typeof o.p2s)throw new C('JOSE Header "p2s" (PBES2 Salt) missing or invalid');return n=el(o.p2s,"p2s",C),e$(t,r,a,o.p2c,n)}case"A128KW":case"A192KW":case"A256KW":return e6(a),ey(t,r,a);case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":if(e6(a),"string"!=typeof o.iv)throw new C('JOSE Header "iv" (Initialization Vector) missing or invalid');if("string"!=typeof o.tag)throw new C('JOSE Header "tag" (Authentication Tag) missing or invalid');return e4(t,r,a,el(o.iv,"iv",C),el(o.tag,"tag",C));default:throw new O(e5)}}async function e8(t,r,a,o,i={}){let n,s,l;switch(t){case"dir":l=a;break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{let c;if(U(a),!e_(a))throw new O("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(a.algorithm,!0,["deriveBits"])).privateKey;let{x:p,y:h,crv:f,kty:m}=await e2(c),y=await eb(a,c,"ECDH-ES"===t?r:t,"ECDH-ES"===t?F(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=o||J(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=o||J(r),U(a),n=await eO(t,a,l);break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{l=o||J(r);let{p2c:c,p2s:u}=i;({encryptedKey:n,...s}=await ew(t,a,l,c,u));break}case"A128KW":case"A192KW":case"A256KW":l=o||J(r),n=await em(t,a,l);break;case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{l=o||J(r);let{iv:c}=i;({encryptedKey:n,...s}=await e9(t,a,l,c));break}default:throw new O(e5)}return{cek:l,encryptedKey:n,parameters:s}}function e7(t,r,a,o,i){let n;if(void 0!==i.crit&&o?.crit===void 0)throw new t('"crit" (Critical) Header Parameter MUST be integrity protected');if(!o||void 0===o.crit)return new Set;if(!Array.isArray(o.crit)||0===o.crit.length||o.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!==a?new Map([...Object.entries(a),...r.entries()]):r,o.crit)){if(!n.has(s))throw new O(`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===o[s])throw new t(`Extension Header Parameter "${s}" MUST be integrity protected`)}return new Set(o.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,a)=>{if(void 0!==r.use){let t;switch(a){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 o;switch(!0){case"sign"===a||"verify"===a:case"dir"===t:case t.includes("CBC-HS"):o=a;break;case t.startsWith("PBES2"):o="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(t):o=!t.includes("GCM")&&t.endsWith("KW")?"encrypt"===a?"wrapKey":"unwrapKey":a;break;case"encrypt"===a&&t.startsWith("RSA"):o="wrapKey";break;case"decrypt"===a:o=t.startsWith("RSA")?"unwrapKey":"deriveBits"}if(o&&r.key_ops?.includes?.(o)===!1)throw TypeError(`Invalid key for this operation, its "key_ops" must include "${o}" when present`)}return!0};function ta(t,r,a){switch(t.substring(0,2)){case"A1":case"A2":case"di":case"HS":case"PB":((t,r,a)=>{if(!(r instanceof Uint8Array)){if(ep(r)){if("oct"===r.kty&&"string"==typeof r.k&&tr(t,r,a))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(!K(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,a);break;default:((t,r,a)=>{if(ep(r))switch(a){case"decrypt":case"sign":if("oct"!==r.kty&&("AKP"===r.kty&&"string"==typeof r.priv||"string"==typeof r.d)&&tr(t,r,a))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,a))return;throw TypeError("JSON Web Key for this operation must be a public JWK")}if(!K(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(a){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(a){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,a)}}function to(t){if(void 0===globalThis[t])throw new O(`JWE "zip" (Compression Algorithm) Header Parameter requires the ${t} API.`)}async function ti(t){to("CompressionStream");let r=new CompressionStream("deflate-raw"),a=r.writable.getWriter();a.write(t).catch(()=>{}),a.close().catch(()=>{});let o=[],i=r.readable.getReader();for(;;){let{value:t,done:r}=await i.read();if(r)break;o.push(t)}return u(...o)}async function tn(t,r){to("DecompressionStream");let a=new DecompressionStream("deflate-raw"),o=a.writable.getWriter();o.write(t).catch(()=>{}),o.close().catch(()=>{});let i=[],n=0,s=a.readable.getReader();for(;;){let{value:t,done:a}=await s.read();if(a)break;if(i.push(t),n+=t.byteLength,r!==1/0&&n>r)throw new C("Decompressed plaintext exceeded the configured limit")}return u(...i)}async function ts(t,r,a){let o,i,n,s,l,d;if(!eu(t))throw new C("Flattened JWE must be an object");if(void 0===t.protected&&void 0===t.header&&void 0===t.unprotected)throw new C("JOSE Header missing");if(void 0!==t.iv&&"string"!=typeof t.iv)throw new C("JWE Initialization Vector incorrect type");if("string"!=typeof t.ciphertext)throw new C("JWE Ciphertext missing or incorrect type");if(void 0!==t.tag&&"string"!=typeof t.tag)throw new C("JWE Authentication Tag incorrect type");if(void 0!==t.protected&&"string"!=typeof t.protected)throw new C("JWE Protected Header incorrect type");if(void 0!==t.encrypted_key&&"string"!=typeof t.encrypted_key)throw new C("JWE Encrypted Key incorrect type");if(void 0!==t.aad&&"string"!=typeof t.aad)throw new C("JWE AAD incorrect type");if(void 0!==t.header&&!eu(t.header))throw new C("JWE Shared Unprotected Header incorrect type");if(void 0!==t.unprotected&&!eu(t.unprotected))throw new C("JWE Per-Recipient Unprotected Header incorrect type");if(t.protected)try{let r=g(t.protected);o=JSON.parse(c.decode(r))}catch{throw new C("JWE Protected Header is invalid")}if(!ed(o,t.header,t.unprotected))throw new C("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");let p={...o,...t.header,...t.unprotected};if(e7(C,new Map,a?.crit,o,p),void 0!==p.zip&&"DEF"!==p.zip)throw new O('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(void 0!==p.zip&&!o?.zip)throw new C('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 C("missing JWE Algorithm (alg) in JWE Header");if("string"!=typeof m||!m)throw new C("missing JWE Encryption Algorithm (enc) in JWE Header");let y=a&&te("keyManagementAlgorithms",a.keyManagementAlgorithms),v=a&&te("contentEncryptionAlgorithms",a.contentEncryptionAlgorithms);if(y&&!y.has(h)||!y&&h.startsWith("PBES2"))throw new T('"alg" (Algorithm) Header Parameter value not allowed');if(v&&!v.has(m))throw new T('"enc" (Encryption Algorithm) Header Parameter value not allowed');void 0!==t.encrypted_key&&(i=el(t.encrypted_key,"encrypted_key",C));let b=!1;"function"==typeof r&&(r=await r(o,t),b=!0),ta("dir"===h?m:h,r,"decrypt");let _=await eM(r,h);try{n=await e3(h,_,i,p,a)}catch(t){if(t instanceof TypeError||t instanceof C||t instanceof O)throw t;n=J(m)}void 0!==t.iv&&(s=el(t.iv,"iv",C)),void 0!==t.tag&&(l=el(t.tag,"tag",C));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",C),$=await ei(m,n,w,s,l,d),E={plaintext:$};if("DEF"===p.zip){let t=a?.maxDecompressedLength??25e4;if(0===t)throw new O('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 C)throw t;throw new C("Failed to decompress plaintext",{cause:t})})}return(void 0!==t.protected&&(E.protectedHeader=o),void 0!==t.aad&&(E.additionalAuthenticatedData=el(t.aad,"aad",C)),void 0!==t.unprotected&&(E.sharedUnprotectedHeader=t.unprotected),void 0!==t.header&&(E.unprotectedHeader=t.header),b)?{...E,key:_}:E}async function tl(t,r,a){if(t instanceof Uint8Array&&(t=c.decode(t)),"string"!=typeof t)throw new C("Compact JWE must be a string or Uint8Array");let{0:o,1:i,2:n,3:s,4:l,length:u}=t.split(".");if(5!==u)throw new C("Invalid Compact JWE");let d=await ts({ciphertext:s,iv:n||void 0,protected:o,tag:l||void 0,encrypted_key:i||void 0},r,a),p={plaintext:d.plaintext,protectedHeader:d.protectedHeader};return"function"==typeof r?{...p,key:d.key}:p}async function tc(t,r,a){if(!eu(t))throw new C("General JWE must be an object");if(!Array.isArray(t.recipients)||!t.recipients.every(eu))throw new C("JWE Recipients missing or incorrect type");if(!t.recipients.length)throw new C("JWE Recipients has no members");for(let o of t.recipients)try{return await ts({aad:t.aad,ciphertext:t.ciphertext,encrypted_key:o.encrypted_key,header:o.header,iv:t.iv,protected:t.protected,tag:t.tag,unprotected:t.unprotected},r,a)}catch{}throw new j}class tu{#e;#t;#r;#a;#o;#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.#a,"setUnprotectedHeader"),this.#a=t,this}setAdditionalAuthenticatedData(t){return this.#o=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 a,o,i,n,s,l;if(!this.#t&&!this.#a&&!this.#r)throw new C("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(!ed(this.#t,this.#a,this.#r))throw new C("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");let c={...this.#t,...this.#a,...this.#r};if(e7(C,new Map,r?.crit,this.#t,c),void 0!==c.zip&&"DEF"!==c.zip)throw new O('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(void 0!==c.zip&&!this.#t?.zip)throw new C('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 C('JWE "alg" (Algorithm) Header Parameter missing or invalid');if("string"!=typeof p||!p)throw new C('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}`);ta("dir"===d?p:d,t,"encrypt");{let i,n=await eM(t,d);({cek:o,encryptedKey:a,parameters:i}=await e8(d,p,n,this.#i,this.#s)),i&&(r&&en in r?this.#a?this.#a={...this.#a,...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.#o){let t=f(l=v(this.#o));i=u(s,f("."),t)}else i=s;let h=this.#e;"DEF"===c.zip&&(h=await ti(h).catch(t=>{throw new C("Failed to compress plaintext",{cause:t})}));let{ciphertext:m,tag:y,iv:g}=await eo(p,h,o,this.#n,i),b={ciphertext:v(m)};return g&&(b.iv=v(g)),y&&(b.tag=v(y)),a&&(b.encrypted_key=v(a)),l&&(b.aad=l),this.#t&&(b.protected=n),this.#r&&(b.unprotected=this.#r),this.#a&&(b.header=this.#a),b}}class td{#l;unprotectedHeader;keyManagementParameters;key;options;constructor(t,r,a){this.#l=t,this.key=r,this.options=a}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;#a;#o;constructor(t){this.#e=t}addRecipient(t,r){let a=new td(this,t,{crit:r?.crit});return this.#c.push(a),a}setProtectedHeader(t){return es(this.#t,"setProtectedHeader"),this.#t=t,this}setSharedUnprotectedHeader(t){return es(this.#a,"setSharedUnprotectedHeader"),this.#a=t,this}setAdditionalAuthenticatedData(t){return this.#o=t,this}async encrypt(){let t;if(!this.#c.length)throw new C("at least one recipient must be added");if(1===this.#c.length){let[t]=this.#c,r=await new tu(this.#e).setAdditionalAuthenticatedData(this.#o).setProtectedHeader(this.#t).setSharedUnprotectedHeader(this.#a).setUnprotectedHeader(t.unprotectedHeader).encrypt(t.key,{...t.options}),a={ciphertext:r.ciphertext,iv:r.iv,recipients:[{}],tag:r.tag};return r.aad&&(a.aad=r.aad),r.protected&&(a.protected=r.protected),r.unprotected&&(a.unprotected=r.unprotected),r.encrypted_key&&(a.recipients[0].encrypted_key=r.encrypted_key),r.header&&(a.recipients[0].header=r.header),a}for(let r=0;r<this.#c.length;r++){let a=this.#c[r];if(!ed(this.#t,this.#a,a.unprotectedHeader))throw new C("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");let o={...this.#t,...this.#a,...a.unprotectedHeader},{alg:i}=o;if("string"!=typeof i||!i)throw new C('JWE "alg" (Algorithm) Header Parameter missing or invalid');if("dir"===i||"ECDH-ES"===i)throw new C('"dir" and "ECDH-ES" alg may only be used with a single recipient');if("string"!=typeof o.enc||!o.enc)throw new C('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');if(t){if(t!==o.enc)throw new C('JWE "enc" (Encryption Algorithm) Header Parameter must be the same for all recipients')}else t=o.enc;if(e7(C,new Map,a.options.crit,this.#t,o),void 0!==o.zip&&"DEF"!==o.zip)throw new O('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(void 0!==o.zip&&!this.#t?.zip)throw new C('JWE "zip" (Compression Algorithm) Header Parameter MUST be in a protected header.')}let r=J(t),a={ciphertext:"",recipients:[]};for(let o=0;o<this.#c.length;o++){let i=this.#c[o],n={};if(a.recipients.push(n),0===o){let t=await new tu(this.#e).setAdditionalAuthenticatedData(this.#o).setContentEncryptionKey(r).setProtectedHeader(this.#t).setSharedUnprotectedHeader(this.#a).setUnprotectedHeader(i.unprotectedHeader).setKeyManagementParameters(i.keyManagementParameters).encrypt(i.key,{...i.options,[en]:!0});a.ciphertext=t.ciphertext,a.iv=t.iv,a.tag=t.tag,t.aad&&(a.aad=t.aad),t.protected&&(a.protected=t.protected),t.unprotected&&(a.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.#a?.alg;ta("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 a}}async function th(t,r,a){if(!eu(t))throw new A("Flattened JWS must be an object");if(void 0===t.protected&&void 0===t.header)throw new A('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==t.protected&&"string"!=typeof t.protected)throw new A("JWS Protected Header incorrect type");if(void 0===t.payload)throw new A("JWS Payload missing");if("string"!=typeof t.signature)throw new A("JWS Signature missing or incorrect type");if(void 0!==t.header&&!eu(t.header))throw new A("JWS Unprotected Header incorrect type");let o={};if(t.protected)try{let r=g(t.protected);o=JSON.parse(c.decode(r))}catch{throw new A("JWS Protected Header is invalid")}if(!ed(o,t.header))throw new A("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let i={...o,...t.header},n=e7(A,new Map([["b64",!0]]),a?.crit,o,i),s=!0;if(n.has("b64")&&"boolean"!=typeof(s=o.b64))throw new A('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:d}=i;if("string"!=typeof d||!d)throw new A('JWS "alg" (Algorithm) Header Parameter missing or invalid');let p=a&&te("algorithms",a.algorithms);if(p&&!p.has(d))throw new T('"alg" (Algorithm) Header Parameter value not allowed');if(s){if("string"!=typeof t.payload)throw new A("JWS Payload must be a string")}else if("string"!=typeof t.payload&&!(t.payload instanceof Uint8Array))throw new A("JWS Payload must be a string or an Uint8Array instance");let h=!1;"function"==typeof r&&(r=await r(o,t),h=!0),ta(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",A),v=await eM(r,d);if(!await ex(d,v,y,m))throw new L;let b={payload:s?el(t.payload,"payload",A):"string"==typeof t.payload?l.encode(t.payload):t.payload};return(void 0!==t.protected&&(b.protectedHeader=o),void 0!==t.header&&(b.unprotectedHeader=t.header),h)?{...b,key:v}:b}async function tf(t,r,a){if(t instanceof Uint8Array&&(t=c.decode(t)),"string"!=typeof t)throw new A("Compact JWS must be a string or Uint8Array");let{0:o,1:i,2:n,length:s}=t.split(".");if(3!==s)throw new A("Invalid Compact JWS");let l=await th({payload:i,protected:o,signature:n},r,a),u={payload:l.payload,protectedHeader:l.protectedHeader};return"function"==typeof r?{...u,key:l.key}:u}async function tm(t,r,a){if(!eu(t))throw new A("General JWS must be an object");if(!Array.isArray(t.signatures)||!t.signatures.every(eu))throw new A("JWS Signatures missing or incorrect type");for(let o of t.signatures)try{return await th({header:o.header,payload:t.payload,protected:o.protected,signature:o.signature},r,a)}catch{}throw new L}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,a=tg.exec(t);if(!a||a[4]&&a[1])throw TypeError("Invalid time period format");let o=parseFloat(a[2]);switch(a[3].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":r=Math.round(o);break;case"minute":case"minutes":case"min":case"mins":case"m":r=Math.round(60*o);break;case"hour":case"hours":case"hr":case"hrs":case"h":r=Math.round(3600*o);break;case"day":case"days":case"d":r=Math.round(86400*o);break;case"week":case"weeks":case"w":r=Math.round(604800*o);break;default:r=Math.round(0x1e187e0*o)}return"-"===a[1]||"ago"===a[4]?-r:r}function tb(t,r){if(!Number.isFinite(r))throw TypeError(`Invalid ${t} input`);return r}let t_=t=>t.includes("/")?t.toLowerCase():`application/${t.toLowerCase()}`;function tS(t,r,a={}){var o,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}=a;if(l&&("string"!=typeof t.typ||t_(t.typ)!==t_(l)))throw new k('unexpected "typ" JWT header value',n,"typ","check_failed");let{requiredClaims:u=[],issuer:d,subject:p,audience:h,maxTokenAge:f}=a,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 k(`missing required "${t}" claim`,n,t,"missing");if(d&&!(Array.isArray(d)?d:[d]).includes(n.iss))throw new k('unexpected "iss" claim value',n,"iss","check_failed");if(p&&n.sub!==p)throw new k('unexpected "sub" claim value',n,"sub","check_failed");if(h&&(o=n.aud,i="string"==typeof h?[h]:h,"string"==typeof o?!i.includes(o):!(Array.isArray(o)&&i.some(Set.prototype.has.bind(new Set(o))))))throw new k('unexpected "aud" claim value',n,"aud","check_failed");switch(typeof a.clockTolerance){case"string":s=tv(a.clockTolerance);break;case"number":s=a.clockTolerance;break;case"undefined":s=0;break;default:throw TypeError("Invalid clockTolerance option type")}let{currentDate:y}=a,g=ty(y||new Date);if((void 0!==n.iat||f)&&"number"!=typeof n.iat)throw new k('"iat" claim must be a number',n,"iat","invalid");if(void 0!==n.nbf){if("number"!=typeof n.nbf)throw new k('"nbf" claim must be a number',n,"nbf","invalid");if(n.nbf>g+s)throw new k('"nbf" claim timestamp check failed',n,"nbf","check_failed")}if(void 0!==n.exp){if("number"!=typeof n.exp)throw new k('"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 k('"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=tb("setNotBefore",t):t instanceof Date?this.#u.nbf=tb("setNotBefore",ty(t)):this.#u.nbf=ty(new Date)+tv(t)}set exp(t){"number"==typeof t?this.#u.exp=tb("setExpirationTime",t):t instanceof Date?this.#u.exp=tb("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=tb("setIssuedAt",ty(t)):"string"==typeof t?this.#u.iat=tb("setIssuedAt",ty(new Date)+tv(t)):this.#u.iat=tb("setIssuedAt",t)}}async function t$(t,r,a){let o=await tf(t,r,a);if(o.protectedHeader.crit?.includes("b64")&&!1===o.protectedHeader.b64)throw new I("JWTs MUST NOT use unencoded payload");let i={payload:tS(o.protectedHeader,o.payload,a),protectedHeader:o.protectedHeader};return"function"==typeof r?{...i,key:o.key}:i}async function tE(t,r,a){let o=await tl(t,r,a),i=tS(o.protectedHeader,o.plaintext,a),{protectedHeader:n}=o;if(void 0!==n.iss&&n.iss!==i.iss)throw new k('replicated "iss" claim header parameter mismatch',i,"iss","mismatch");if(void 0!==n.sub&&n.sub!==i.sub)throw new k('replicated "sub" claim header parameter mismatch',i,"sub","mismatch");if(void 0!==n.aud&&JSON.stringify(n.aud)!==JSON.stringify(i.aud))throw new k('replicated "aud" claim header parameter mismatch',i,"aud","mismatch");let s={payload:i,protectedHeader:n};return"function"==typeof r?{...s,key:o.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 a=await this.#d.encrypt(t,r);return[a.protected,a.encrypted_key,a.iv,a.ciphertext,a.tag].join(".")}}class tR{#u;#t;#a;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.#a,"setUnprotectedHeader"),this.#a=t,this}async sign(t,r){let a,o,i,n;if(!this.#t&&!this.#a)throw new A("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!ed(this.#t,this.#a))throw new A("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let s={...this.#t,...this.#a},l=e7(A,new Map([["b64",!0]]),r?.crit,this.#t,s),c=!0;if(l.has("b64")&&"boolean"!=typeof(c=this.#t.b64))throw new A('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:d}=s;if("string"!=typeof d||!d)throw new A('JWS "alg" (Algorithm) Header Parameter missing or invalid');ta(d,t,"sign"),c?o=f(a=v(this.#u)):(o=this.#u,a=""),this.#t?n=f(i=v(JSON.stringify(this.#t))):(i="",n=new Uint8Array);let p=u(n,f("."),o),h=await eM(t,d),m={signature:v(await ek(d,h,p)),payload:a};return this.#a&&(m.header=this.#a),this.#t&&(m.protected=i),m}}class tk{#d;constructor(t){this.#d=new tR(t)}setProtectedHeader(t){return this.#d.setProtectedHeader(t),this}async sign(t,r){let a=await this.#d.sign(t,r);if(void 0===a.payload)throw TypeError("use the flattened module for creating JWS with b64: false");return`${a.protected}.${a.payload}.${a.signature}`}}class tx{#l;protectedHeader;unprotectedHeader;options;key;constructor(t,r,a){this.#l=t,this.key=r,this.options=a}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 tT{#u;#p=[];constructor(t){this.#u=t}addSignature(t,r){let a=new tx(this,t,r);return this.#p.push(a),a}async sign(){if(!this.#p.length)throw new A("at least one signature must be added");let t={signatures:[],payload:""};for(let r=0;r<this.#p.length;r++){let a=this.#p[r],o=new tR(this.#u);o.setProtectedHeader(a.protectedHeader),o.setUnprotectedHeader(a.unprotectedHeader);let{payload:i,...n}=await o.sign(a.key,a.options);if(0===r)t.payload=i;else if(t.payload!==i)throw new A("inconsistent use of JWS Unencoded Payload (RFC7797)");t.signatures.push(n)}return t}}class tO{#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 a=new tk(this.#h.data());if(a.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 a.sign(t,r)}}class tj{#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 a=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}),a.setProtectedHeader(this.#t),this.#n&&a.setInitializationVector(this.#n),this.#i&&a.setContentEncryptionKey(this.#i),this.#s&&a.setKeyManagementParameters(this.#s),a.encrypt(t,r)}}let tC=(t,r)=>{if("string"!=typeof t||!t)throw new N(`${r} missing or invalid`)};async function tA(t,r){let a,o;if(ep(t))a=t;else if(K(t))a=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(a.kty){case"AKP":tC(a.alg,'"alg" (Algorithm) Parameter'),tC(a.pub,'"pub" (Public key) Parameter'),o={alg:a.alg,kty:a.kty,pub:a.pub};break;case"EC":tC(a.crv,'"crv" (Curve) Parameter'),tC(a.x,'"x" (X Coordinate) Parameter'),tC(a.y,'"y" (Y Coordinate) Parameter'),o={crv:a.crv,kty:a.kty,x:a.x,y:a.y};break;case"OKP":tC(a.crv,'"crv" (Subtype of Key Pair) Parameter'),tC(a.x,'"x" (Public Key) Parameter'),o={crv:a.crv,kty:a.kty,x:a.x};break;case"RSA":tC(a.e,'"e" (Exponent) Parameter'),tC(a.n,'"n" (Modulus) Parameter'),o={e:a.e,kty:a.kty,n:a.n};break;case"oct":tC(a.k,'"k" (Key Value) Parameter'),o={k:a.k,kty:a.kty};break;default:throw new O('"kty" (Key Type) Parameter missing or unsupported')}let i=f(JSON.stringify(o));return v(await ec(r,i))}async function tI(t,r){r??="sha256";let a=await tA(t,r);return`urn:ietf:params:oauth:jwk-thumbprint:sha-${r.slice(-3)}:${a}`}async function tN(t,r){let a={...t,...r?.header};if(!eu(a.jwk))throw new A('"jwk" (JSON Web Key) Header Parameter must be a JSON object');let o=await eY({...a.jwk,ext:!0},a.alg);if(o instanceof Uint8Array||"public"!==o.type)throw new A('"jwk" (JSON Web Key) Header Parameter must be a public key');return o}function tM(t){return eu(t)}class tq{#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:a,kid:o}={...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 O('Unsupported "alg" value for a JSON Web Key Set')}}(a),n=this.#g.keys.filter(t=>{let r=i===t.kty;if(r&&"string"==typeof o&&(r=o===t.kid),r&&("string"==typeof t.alg||"AKP"===i)&&(r=a===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(a){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 q;if(1!==l){let t=new z,r=this.#v;throw t[Symbol.asyncIterator]=async function*(){for(let t of n)try{yield await tz(r,t,a)}catch{}},t}return tz(this.#v,s,a)}}async function tz(t,r,a){let o=t.get(r)||t.set(r,{}).get(r);if(void 0===o[a]){let t=await eY({...r,ext:!0},a);if(t instanceof Uint8Array||"public"!==t.type)throw new M("JSON Web Key Set members must be public keys");o[a]=t}return o[a]}function tD(t){let r=new tq(t),a=async(t,a)=>r.getKey(t,a);return Object.defineProperties(a,{jwks:{value:()=>structuredClone(r.jwks()),enumerable:!1,configurable:!1,writable:!1}}),a}"undefined"!=typeof navigator&&navigator.userAgent?.startsWith?.("Mozilla/5.0 ")||(i="jose/v6.2.3");let tL=Symbol();async function tU(t,r,a,o=fetch){let i=await o(t,{method:"GET",signal:a,redirect:"manual",headers:r}).catch(t=>{if("TimeoutError"===t.name)throw new D;throw t});if(200!==i.status)throw new R("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await i.json()}catch{throw new R("Failed to parse the JSON Web Key Set HTTP response as JSON")}}let tH=Symbol();class tV{#b;#_;#S;#w;#$;#E;#P;#R;#k;#x;constructor(t,r){if(!(t instanceof URL))throw TypeError("url must be an instance of URL");this.#b=new URL(t.href),this.#_="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.#R=r?.[tL],r?.[tH]!==void 0&&(this.#x=r?.[tH],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?.[tH],this.#w)&&(this.#$=this.#x.uat,this.#k=tD(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.#k?.jwks()}async getKey(t,r){this.#k&&this.fresh()||await this.reload();try{return await this.#k(t,r)}catch(a){if(a instanceof q&&!1===this.coolingDown())return await this.reload(),this.#k(t,r);throw a}}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||=tU(this.#b.href,this.#P,AbortSignal.timeout(this.#_),this.#R).then(t=>{this.#k=tD(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 tK(t,r){let a=new tV(t,r),o=async(t,r)=>a.getKey(t,r);return Object.defineProperties(o,{coolingDown:{get:()=>a.coolingDown(),enumerable:!0,configurable:!1},fresh:{get:()=>a.fresh(),enumerable:!0,configurable:!1},reload:{value:()=>a.reload(),enumerable:!0,configurable:!1,writable:!1},reloading:{get:()=>a.pendingFetch(),enumerable:!0,configurable:!1},jwks:{value:()=>a.jwks(),enumerable:!0,configurable:!1,writable:!1}}),o}class tF{#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 a;if("string"!=typeof t)throw new I("Unsecured JWT must be a string");let{0:o,1:i,2:n,length:s}=t.split(".");if(3!==s||""!==n)throw new I("Invalid Unsecured JWT");try{if(a=JSON.parse(c.decode(g(o))),"none"!==a.alg)throw Error()}catch{throw new I("Invalid Unsecured JWT")}return{payload:tS(a,g(i),r),header:a}}}function tJ(t){let r;if("string"==typeof t){let a=t.split(".");(3===a.length||5===a.length)&&([r]=a)}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 tW(t){let r,a;if("string"!=typeof t)throw new I("JWTs must use Compact JWS serialization, JWT must be a string");let{1:o,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(!o)throw new I("JWTs must contain a payload");try{r=g(o)}catch{throw new I("Failed to base64url decode the payload")}try{a=JSON.parse(c.decode(r))}catch{throw new I("Failed to parse the decoded payload as JSON")}if(!eu(a))throw new I("Invalid JWT Claims Set");return a}function tB(t){let r=t?.modulusLength??2048;if("number"!=typeof r||r<2048)throw new O("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");return r}async function tG(t,r){let a,o;switch(t){case"PS256":case"PS384":case"PS512":a={name:"RSA-PSS",hash:`SHA-${t.slice(-3)}`,publicExponent:Uint8Array.of(1,0,1),modulusLength:tB(r)},o=["sign","verify"];break;case"RS256":case"RS384":case"RS512":a={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${t.slice(-3)}`,publicExponent:Uint8Array.of(1,0,1),modulusLength:tB(r)},o=["sign","verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":a={name:"RSA-OAEP",hash:`SHA-${parseInt(t.slice(-3),10)||1}`,publicExponent:Uint8Array.of(1,0,1),modulusLength:tB(r)},o=["decrypt","unwrapKey","encrypt","wrapKey"];break;case"ES256":a={name:"ECDSA",namedCurve:"P-256"},o=["sign","verify"];break;case"ES384":a={name:"ECDSA",namedCurve:"P-384"},o=["sign","verify"];break;case"ES512":a={name:"ECDSA",namedCurve:"P-521"},o=["sign","verify"];break;case"Ed25519":case"EdDSA":o=["sign","verify"],a={name:"Ed25519"};break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":o=["sign","verify"],a={name:t};break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{o=["deriveBits"];let t=r?.crv??"P-256";switch(t){case"P-256":case"P-384":case"P-521":a={name:"ECDH",namedCurve:t};break;case"X25519":a={name:"X25519"};break;default:throw new O("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, and X25519")}break}default:throw new O('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}return crypto.subtle.generateKey(a,r?.extractable??!1,o)}async function tZ(t,r){let a,o,i;switch(t){case"HS256":case"HS384":case"HS512":a=parseInt(t.slice(-3),10),o={name:"HMAC",hash:`SHA-${a}`,length:a},i=["sign","verify"];break;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return a=parseInt(t.slice(-3),10),crypto.getRandomValues(new Uint8Array(a>>3));case"A128KW":case"A192KW":case"A256KW":o={name:"AES-KW",length:a=parseInt(t.slice(1,4),10)},i=["wrapKey","unwrapKey"];break;case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":case"A128GCM":case"A192GCM":case"A256GCM":o={name:"AES-GCM",length:a=parseInt(t.slice(1,4),10)},i=["encrypt","decrypt"];break;default:throw new O('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}return crypto.subtle.generateKey(o,r?.extractable??!1,i)}let tX="WebCryptoAPI"},4519(t){"use strict";t.exports=JSON.parse('{"name":"dotenv","version":"16.6.1","description":"Loads environment variables from .env file","main":"lib/main.js","types":"lib/main.d.ts","exports":{".":{"types":"./lib/main.d.ts","require":"./lib/main.js","default":"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},"scripts":{"dts-check":"tsc --project tests/types/tsconfig.json","lint":"standard","pretest":"npm run lint && npm run dts-check","test":"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov","prerelease":"npm test","release":"standard-version"},"repository":{"type":"git","url":"git://github.com/motdotla/dotenv.git"},"homepage":"https://github.com/motdotla/dotenv#readme","funding":"https://dotenvx.com","keywords":["dotenv","env",".env","environment","variables","config","settings"],"readmeFilename":"README.md","license":"BSD-2-Clause","devDependencies":{"@types/node":"^18.11.3","decache":"^4.6.2","sinon":"^14.0.1","standard":"^17.0.0","standard-version":"^9.5.0","tap":"^19.2.0","typescript":"^4.8.4"},"engines":{"node":">=12"},"browser":{"fs":false}}')},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}}}')}},i={};function n(t){var r=i[t];if(void 0!==r)return r.exports;var a=i[t]={exports:{}};return o[t](a,a.exports,n),a.exports}n.n=t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return n.d(r,{a:r}),r},a=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,n.t=function(t,o){if(1&o&&(t=this(t)),8&o||"object"==typeof t&&t&&(4&o&&t.__esModule||16&o&&"function"==typeof t.then))return t;var i=Object.create(null);n.r(i);var s={};r=r||[null,a({}),a([]),a(a)];for(var l=2&o&&t;("object"==typeof l||"function"==typeof l)&&!~r.indexOf(l);l=a(l))Object.getOwnPropertyNames(l).forEach(r=>{s[r]=()=>t[r]});return s.default=()=>t,n.d(i,s),i},n.d=(t,r)=>{for(var a in r)n.o(r,a)&&!n.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:r[a]})},n.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var s={};return(()=>{"use strict";let t,r,a,o,i,l,c,u,d,p,h,f,m,y,g,v,b,_,S;n.r(s),n.d(s,{HOST_CONTEXT_CHANGED_METHOD:()=>bp,isEnvHeader:()=>v2,createSTDIOClient:()=>v8,INITIALIZE_METHOD:()=>bo,LOG_MESSAGE_METHOD:()=>bu,OPEN_LINK_METHOD:()=>bs,REQUEST_DISPLAY_MODE_METHOD:()=>bn,inputResponse:()=>cp,disconnectSTDIOClient:()=>bt,embeddedResource:()=>B,isInputRequiredResult:()=>l8,callSTDIOClientTool:()=>be,headersToRecord:()=>v9,MCP_APPS_PROTOCOL_VERSION:()=>ba,extractToolNamesFromRequest:()=>br,UI_MESSAGE_METHOD:()=>bc,completable:()=>u6,acceptedContent:()=>cd,listSTDIOClientTools:()=>v7,UPDATE_MODEL_CONTEXT_METHOD:()=>bl,UrlElicitationRequiredError:()=>l2,createRequestStateCodec:()=>u7,audio:()=>W,createMcpHostBridge:()=>by,SIZE_CHANGED_METHOD:()=>bh,image:()=>J,INITIALIZED_METHOD:()=>bi,inputRequired:()=>cu,RESOURCES_READ_METHOD:()=>bd,createContext:()=>K,getRequestContext:()=>X,jwtAuthMiddleware:()=>L,createHTTPClient:()=>v3,apiKeyAuthMiddleware:()=>q});var w,$,E,P,R,k,x,T,O,j,C=n(8583),A=n.n(C),I=n(4953);let N=I.z.object({apiKey:I.z.string().optional(),headerName:I.z.string().optional(),validateApiKey:I.z.function().args(I.z.string()).returns(I.z.promise(I.z.boolean())).optional()}).strict().refine(t=>void 0!==t.apiKey||void 0!==t.validateApiKey,{message:"Either 'apiKey' or 'validateApiKey' must be provided"}).refine(t=>void 0===t.apiKey||void 0===t.validateApiKey,{message:"'apiKey' and 'validateApiKey' are mutually exclusive - provide only one"}),M="Unauthorized: Missing or invalid API key";function q(t){let r=N.safeParse(t);if(!r.success){let a="apiKey"in t,o="validateApiKey"in t;if(a&&o)throw Error("'apiKey' and 'validateApiKey' are mutually exclusive - provide only one");if(a||o)throw Error(`Invalid configuration: ${r.error.message}`);throw Error("Either 'apiKey' or 'validateApiKey' must be provided")}let a=t.headerName??"x-api-key",o="apiKey"in t?t.apiKey:void 0,i="validateApiKey"in t?t.validateApiKey:void 0;return async(r,n,s)=>{let l=r.header(a);!l||"apiKey"in t&&l!==o||i&&!await i(l)?n.status(401).json({error:M}):s()}}var z=n(8400),D=n.n(z);function L(t){return(r,a,o)=>{let i=r.header("Authorization");if(!i||!i.startsWith("Bearer "))return void a.status(401).json({error:"Unauthorized: Missing or malformed Authorization header"});let n=i.slice(7).trim();if(!n)return void a.status(401).json({error:"Unauthorized: Missing access token"});try{let{secret:a,...i}=t;r.user=D().verify(n,a,i),o()}catch(t){a.status(401).json({error:"Unauthorized: Invalid or expired token"})}}}let U=require("async_hooks"),H=(t,r)=>{globalThis[t]=r},V=t=>globalThis[t];function K({name:t,fallback:r=!0}){let a=Symbol.for(`xmcp-context-${t}`),o=Symbol.for(`xmcp-context-${t}-fallback-store`);if(V(a))return V(a);let i=new U.AsyncLocalStorage,n=globalThis[o]??{current:null};H(o,n);let s={provider:(t,a)=>(r&&(n.current=t),i.run(t,a)),getContext:()=>{let a=i.getStore();if(a)return a;if(r&&n.current)return n.current;throw Error(`getContext() can only be used within the ${t} context.`)},setContext:a=>{let o=i.getStore()??(r?n.current:null);if(!o)throw Error(`setContext() can only be used within the ${t} context.`);Object.assign(o,a)}};return H(a,s),s}function F(t){let r;if(t instanceof Uint8Array)r=t;else if(t instanceof ArrayBuffer)r=new Uint8Array(t);else throw TypeError("Expected bytes as a Uint8Array or ArrayBuffer");let a="";for(let t=0;t<r.length;t+=32768)a+=String.fromCharCode(...r.subarray(t,t+32768));return btoa(a)}function J(t,r){return{type:"image",data:F(t),mimeType:r}}function W(t,r){return{type:"audio",data:F(t),mimeType:r}}function B(t,r,a){return{type:"resource",resource:{uri:t,...void 0===a?{}:{mimeType:a},..."string"==typeof r?{text:r}:{blob:F(r)}}}}let G=K({name:"http-request-context"});G.setContext,G.getContext,G.provider;let Z=K({name:"request-context",fallback:!1});function X(){try{return Z.getContext()}catch{throw Error("getRequestContext() can only be used while handling an MCP request.")}}var Y=Object.create,Q=Object.defineProperty,ee=Object.getOwnPropertyDescriptor,et=Object.getOwnPropertyNames,er=Object.getPrototypeOf,ea=Object.prototype.hasOwnProperty,eo=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports);function ei(t){let r=Object.values(t).filter(t=>"number"==typeof t);return Object.entries(t).filter(([t,a])=>-1===r.indexOf(+t)).map(([t,r])=>r)}function en(t,r="|"){return t.map(t=>ex(t)).join(r)}function es(t,r){return"bigint"==typeof r?r.toString():r}class el{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 ec(t){return new el(t)}function eu(t){let r=+!!t.startsWith("^"),a=t.endsWith("$")?t.length-1:t.length;return t.slice(r,a)}let ed=Symbol("evaluating");function ep(t,r,a){Object.defineProperty(t,r,{value:a,writable:!0,enumerable:!0,configurable:!0})}function eh(t){let r=Object.getOwnPropertyDescriptor(t,"shape");return r?.get?r.get.raw:r?.value}function ef(t){return eh(t._zod.def)??t._zod.def.shape}function em(t,r,a){Object.defineProperty(t,r,{get(){let t=a();return ep(this,r,t),t},enumerable:!0,configurable:!0})}function ey(t,r,a){r in t?ep(t,r,a):t[r]=a}function eg(t,r,a,o){let i=ef(r);for(let n of a){let a=Object.getOwnPropertyDescriptor(i,n);a.enumerable&&(a.get?em(t,n,()=>{let t=r._zod.def.shape[n];return o?o(t,n):t}):ey(t,n,o?o(a.value,n):a.value))}}function ev(...t){let r={};for(let a of t)Object.assign(r,Object.getOwnPropertyDescriptors(a));return Object.defineProperties({},r)}let eb="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function e_(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}let eS=ec(()=>{if(e0.jitless||"undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(t){return!1}});function ew(t){if(!1===e_(t))return!1;let r=t.constructor;if(void 0===r||"function"!=typeof r)return!0;let a=r.prototype;return!1!==e_(a)&&!1!==Object.prototype.hasOwnProperty.call(a,"isPrototypeOf")}function e$(t){return ew(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}let eE=new Set(["string","number","symbol"]);function eP(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function eR(t,r,a){let o=new t._zod.constr(r??t._zod.def);return(!r||a?.parent)&&(o._zod.parent=t),o}function ek(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 ex(t){return"bigint"==typeof t?t.toString()+"n":"string"==typeof t?`"${t}"`:`${t}`}let eT={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]},eO={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function ej(t,r){let a=ef(t),o=[];for(let t of Reflect.ownKeys(r)){if(!Object.getOwnPropertyDescriptor(a,t)?.enumerable)throw Error(`Unrecognized key: "${String(t)}"`);r[t]&&o.push(t)}return o}function eC(t,r){let a={};eg(a,t,Reflect.ownKeys(ef(t)));for(let t of Reflect.ownKeys(r)){let o=Object.getOwnPropertyDescriptor(r,t);o.enumerable&&(o.get?em(a,t,()=>r[t]):ey(a,t,o.value))}return a}function eA(t,r,a,o="partial"){let i=r._zod.def.checks;if(i&&i.length>0)throw Error(`.${o}() cannot be used on object schemas containing refinements`);let n=a?new Set(ej(r,a)):void 0,s={};return eg(s,r,Reflect.ownKeys(ef(r)),t&&((r,a)=>n&&!n.has(a)?r:new t({type:"optional",innerType:r}))),eR(r,ev(r._zod.def,{shape:s,checks:[]}))}function eI(t,r=0){if(!0===t.aborted)return!0;for(let a=r;a<t.issues.length;a++)if(t.issues[a]?.continue!==!0)return!0;return!1}function eN(t,r){return r.map(r=>(r.path??(r.path=[]),r.path.unshift(t),r))}function eM(t){return"string"==typeof t?t:t?.message}function eq(t,r,a){var o;for(let i=r;i<t.length;i++)(o=t[i]).schema??(o.schema=a)}function ez(t,r,a){let o=t.inst?._zod?.traits;o?.has("$ZodType")&&(o.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:eM(t.inst?._zod.def?.error?.(t))??eM(i?.(t))??eM(r?.error?.(t))??eM(a.customError?.(t))??eM(a.localeError?.(t))??"Invalid input",s={};for(let r of Object.keys(t))"inst"!==r&&"schema"!==r&&"continue"!==r&&"input"!==r&&"__proto__"!==r&&(s[r]=t[r]);return s.path??(s.path=[]),s.message=n,r?.reportInput&&(s.input=t.input),s}let eD=/[\uD800-\uDBFF]/;function eL(t){let r=t.length;if(!eD.test(t))return r;let a=r;for(let o=0;o<r-1;o++)(64512&t.charCodeAt(o))==55296&&(64512&t.charCodeAt(o+1))==56320&&(a--,o++);return a}function eU(t){return Array.isArray(t)?"array":"string"==typeof t?"string":"unknown"}function eH(...t){let[r,a,o]=t;return"string"==typeof r?{message:r,code:"custom",input:a,inst:o}:{...r}}function eV(t,r,a,o=!0){return Object.defineProperty(t,r,{configurable:!0,writable:!0,enumerable:o,value:a}),a}function eK(t,r){for(let a in t){let o=t[a];Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get(){return eV(this,a,o(this))},set(t){eV(this,a,t)}})}return r}let eF=!1,eJ={configurable:!0,get(){eF=!0}};function eW(r,a,o){let i=Object.getPrototypeOf(r._zod);if(a in i&&t!==r._zod){t=void 0;return}t=r._zod,Object.defineProperty(i,a,{configurable:!0,get(){Object.defineProperty(this,a,eJ);let t=eF;eF=!1;try{let r=o(this);return eF?delete this[a]:Object.defineProperty(this,a,{configurable:!0,writable:!0,value:r}),eF=eF||t,r}catch(r){throw delete this[a],eF=eF||t,r}},set(t){Object.defineProperty(this,a,{configurable:!0,writable:!0,value:t})}})}let eB=Object.freeze({status:"aborted"}),eG={value:void 0,enumerable:!1},eZ="captureStackTrace"in Error?Error:null;function eX(t,r,a,o){function i(t){this.def=t,this.constr=u,this.traits=new Set}i.prototype={};let n=a&&new WeakSet;function s(o,s){if(o._zod){if(o._zod.traits.has(t))return}else{eG.value=new i(s);try{Object.defineProperty(o,"_zod",eG)}finally{eG.value=void 0}}if(o._zod.traits.add(t),r(o,s),n){let t=Object.getPrototypeOf(o),r=o._zod.constr.prototype,i=t;for(;i&&i!==r;)i=Object.getPrototypeOf(i);let s=i??t;if(!n.has(s)){n.add(s);for(let t in a){let r=Object.getOwnPropertyDescriptor(a,t);r.get?Object.defineProperty(s,t,{...r,enumerable:!1}):function(t,r,a){Object.defineProperty(t,r,{configurable:!0,get(){return this==null?a:eV(this,r,a.bind(this))},set(t){eV(this,r,t)}})}(s,t,r.value)}}}let l=u.prototype;for(let t in l)Object.prototype.hasOwnProperty.call(l,t)&&(t in o||(o[t]=l[t].bind(o)))}let l=o?.Parent??Object;class c extends l{}function u(t){let r=o?.Parent?function(t){let r=eZ;if(r){let a=r.stackTraceLimit;if("number"==typeof a){try{r.stackTraceLimit=0}catch{return eZ=null,new t}try{return new t}finally{r.stackTraceLimit=a}}}return new t}(c):this;s(r,t);let a=r._zod.deferred;if(a){for(let t of a)t();r._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(r),r}return Object.defineProperty(c,"name",{value:t}),Object.defineProperty(u,"init",{value:s}),Object.defineProperty(u,Symbol.hasInstance,{value:r=>!!o?.Parent&&r instanceof o.Parent||r?._zod?.traits?.has(t)}),Object.defineProperty(u,"name",{value:t}),u}class eY 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"}}(T=globalThis).__zod_globalConfig??(T.__zod_globalConfig={});let e0=globalThis.__zod_globalConfig;function e1(t){return t&&Object.assign(e0,t),e0}class e2 extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}let e9="~memo",e4=[];function e5(t){return null!==t&&"object"==typeof t}function e6(t){return t.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}let e3=new WeakMap,e8=[],e7={alloc(t,a,o){let i=r;if(!i)return o;r=void 0;let n={value:o,issues:null};return i.set(a.value,n),e8.push(n),o},guard(t){var r;(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred.push(()=>{let r=t._zod.parse,a=(t,a)=>{var o,i;let n;if("backward"!==a.direction&&(o=a,i=t.value,void 0!==(n=o[e9]?.backEdges)&&e5(i)&&n.has(i)))throw new e2;return r(t,a)};t._zod.parse=a,t._zod.run===r&&(t._zod.run=a)})},attach(t){var a;let o,i,n,s=!1;(a=t._zod).deferred??(a.deferred=[]),t._zod.deferred.push(()=>{let a=t._zod.parse,l=(c,u)=>{let d;if(void 0===o){let r=function t(r,a,o){var i,n;let s=e3.get(r);if(void 0!==s)return 2*!!s;if(a.has(r))return 2;a.add(r);let l=0,c=r=>{if(2!==l&&r?._zod){let i=t(r,a,o);i>l&&(l=i)}},u=t=>{t>l&&(l=t)},d=r._zod.def;switch(d.type){case"object":{let r=eh(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,a,o):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??(o?r._zod.innerType:void 0);u(i?t(i,a,!1):1);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let t in d){let r=Object.getOwnPropertyDescriptor(d,t);if(!r||r.get)continue;let a=r.value;if(a&&"object"==typeof a){if(a._zod)c(a);else if(Array.isArray(a))for(let t of a)c(t)}}}return a.delete(r),i=r,1!==(n=l)&&e3.set(i,2===n),n}(t,new Set,!1);if(0===r)return t._zod.parse=a,t._zod.run===l&&(t._zod.run=a),a(c,u);2===r||s?o=!0:s=!0}let p=c.value;if(!e5(p))return a(c,u);let h=u[e9];if(h||(h={buckets:new WeakMap,backEdges:void 0},u[e9]=h),i===u)d=n;else{var f;let r;(r=(f=h).buckets.get(t))||(r=new WeakMap,f.buckets.set(t,r)),d=r,i=u,n=d}let m=d.get(p);if(m)return c.value=m.value,m.issues?m.issues.length&&c.issues.push(...e6(m.issues)):(c.memo=!0,h.backEdges??(h.backEdges=new WeakSet),h.backEdges.add(m.value)),c;r=d;let y=e8.length,g=a(c,u);r=void 0;let v=e8.length>y?e8.pop():void 0;return g instanceof Promise?g.then(t=>(v&&(v.issues=t.issues.length?e6(t.issues):e4),t)):(v&&(v.issues=g.issues.length?e6(g.issues):e4),g)};t._zod.parse=l,t._zod.run===a&&(t._zod.run=l)})}},te=/^[cC][0-9a-z]{6,}$/,tt=/^[0-9a-z]+$/,tr=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,ta=/^[0-9a-vA-V]{20}$/,to=/^[A-Za-z0-9]{27}$/,ti=/^[a-zA-Z0-9_-]{21}$/,tn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ts=/^([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})$/,tl=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)$/,tc=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,tu=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,td=/^(?:(?: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])$/,tp=/^(([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}|:))$/,th=/^((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])$/,tf=/^(([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])$/,tm=/^https?$/,ty=/^\+[1-9]\d{6,14}$/,tg="(?:(?:\\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])))",tv=RegExp(`^${tg}$`);function tb(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 t_=/^[\s\S]{0,}$/,tS=/^-?\d+$/,tw=/^-?\d+(?:\.\d+)?$/,t$=/^(?:true|false)$/i,tE=/^null$/i,tP=/^[^A-Z]*$/,tR=/^[^a-z]*$/,tk=eX("$ZodCheck",(t,r)=>{var a;t._zod??(t._zod={}),t._zod.def=r,(a=t._zod).onattach??(a.onattach=[])}),tx=t=>{let r=t.value;return null!=r&&void 0!==r.length},tT={number:"number",bigint:"bigint",object:"date"},tO=eX("$ZodCheckLessThan",(t,r)=>{tk.init(t,r);let a=tT[typeof r.value];t._zod.check=o=>{(r.inclusive?o.value<=r.value:o.value<r.value)||o.issues.push({origin:tT[typeof o.value]??a,code:"too_big",maximum:"object"==typeof r.value?r.value.getTime():r.value,input:o.value,inclusive:r.inclusive,inst:t,continue:!r.abort})}}),tj=eX("$ZodCheckGreaterThan",(t,r)=>{tk.init(t,r);let a=tT[typeof r.value];t._zod.check=o=>{(r.inclusive?o.value>=r.value:o.value>r.value)||o.issues.push({origin:tT[typeof o.value]??a,code:"too_small",minimum:"object"==typeof r.value?r.value.getTime():r.value,input:o.value,inclusive:r.inclusive,inst:t,continue:!r.abort})}}),tC=eX("$ZodCheckMultipleOf",(t,r)=>{tk.init(t,r),t._zod.check=a=>{let o,i,n;if(typeof a.value!=typeof r.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof a.value?r.value!==BigInt(0)&&a.value%r.value===BigInt(0):0==(i=Math.round(o=a.value/r.value),n=4*Number.EPSILON*Math.max(Math.abs(o),1),Math.abs(o-i)<n?0:o-i))||a.issues.push({origin:typeof a.value,code:"not_multiple_of",divisor:r.value,input:a.value,inst:t,continue:!r.abort})}}),tA=eX("$ZodCheckNumberFormat",(t,r)=>{tk.init(t,r),r.format=r.format||"float64";let a=r.format?.includes("int"),o=a?"int":"number",[i,n]=eT[r.format];t._zod.check=s=>{let l=s.value;if(a){if(!Number.isInteger(l))return void s.issues.push({expected:o,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:o,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:o,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})}}),tI=eX("$ZodCheckMaxLength",(t,r)=>{var a;tk.init(t,r),(a=t._zod.def).when??(a.when=tx),t._zod.check=a=>{let o=a.value,i=o.length;if(("string"==typeof o&&i>r.maximum?eL(o):i)<=r.maximum)return;let n=eU(o);a.issues.push({origin:n,code:"too_big",maximum:r.maximum,inclusive:!0,input:o,inst:t,continue:!r.abort})}}),tN=eX("$ZodCheckMinLength",(t,r)=>{var a;tk.init(t,r),(a=t._zod.def).when??(a.when=tx),t._zod.check=a=>{let o=a.value,i=o.length;if(("string"==typeof o&&i>=r.minimum&&i<2*r.minimum?eL(o):i)>=r.minimum)return;let n=eU(o);a.issues.push({origin:n,code:"too_small",minimum:r.minimum,inclusive:!0,input:o,inst:t,continue:!r.abort})}}),tM=eX("$ZodCheckLengthEquals",(t,r)=>{var a;tk.init(t,r),(a=t._zod.def).when??(a.when=tx),t._zod.check=a=>{let o=a.value,i=o.length,n="string"==typeof o&&i>=r.length&&i<=2*r.length?eL(o):i;if(n===r.length)return;let s=eU(o),l=n>r.length;a.issues.push({origin:s,...l?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length},inclusive:!0,exact:!0,input:a.value,inst:t,continue:!r.abort})}}),tq=eX("$ZodCheckStringFormat",(t,r)=>{var a,o;tk.init(t,r),r.pattern?(a=t._zod).check??(a.check=a=>{r.pattern.lastIndex=0,r.pattern.test(a.value)||a.issues.push({origin:"string",code:"invalid_format",format:r.format,input:a.value,...r.pattern?{pattern:r.pattern.toString()}:{},inst:t,continue:!r.abort})}):(o=t._zod).check??(o.check=()=>{})}),tz=eX("$ZodCheckRegex",(t,r)=>{tq.init(t,r),t._zod.check=a=>{r.pattern.lastIndex=0,r.pattern.test(a.value)||a.issues.push({origin:"string",code:"invalid_format",format:"regex",input:a.value,pattern:r.pattern.toString(),inst:t,continue:!r.abort})}}),tD=eX("$ZodCheckLowerCase",(t,r)=>{r.pattern??(r.pattern=tP),tq.init(t,r)}),tL=eX("$ZodCheckUpperCase",(t,r)=>{r.pattern??(r.pattern=tR),tq.init(t,r)}),tU=eX("$ZodCheckIncludes",(t,r)=>{tk.init(t,r);let a=eP(r.includes),o=new RegExp("number"==typeof r.position?`^.{${r.position},}${a}`:a);r.pattern=o,t._zod.check=a=>{a.value.includes(r.includes,r.position)||a.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:r.includes,input:a.value,inst:t,continue:!r.abort})}}),tH=eX("$ZodCheckStartsWith",(t,r)=>{tk.init(t,r);let a=RegExp(`^${eP(r.prefix)}.*`);r.pattern??(r.pattern=a),t._zod.check=a=>{a.value.startsWith(r.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:r.prefix,input:a.value,inst:t,continue:!r.abort})}}),tV=eX("$ZodCheckEndsWith",(t,r)=>{tk.init(t,r);let a=RegExp(`.*${eP(r.suffix)}$`);r.pattern??(r.pattern=a),t._zod.check=a=>{a.value.endsWith(r.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:r.suffix,input:a.value,inst:t,continue:!r.abort})}}),tK=eX("$ZodCheckOverwrite",(t,r)=>{tk.init(t,r),t._zod.check=t=>{t.value=r.tx(t.value)}});class tF{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if("function"==typeof t){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let r=t.split("\n").filter(t=>t),a=Math.min(...r.map(t=>t.length-t.trimStart().length));for(let t of r.map(t=>t.slice(a)).map(t=>" ".repeat(2*this.indent)+t))this.content.push(t)}compile(){let t=Function,r=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
2
4
|
${r.join("\n")}
|
|
3
|
-
};`)(...Object.values(this.closed))}}let tJ={major:4,minor:6,patch:5},tB=eX("$ZodType",(t,r)=>{var o;t??(t={}),t._zod.def=r,t._zod.bag=t._zod.bag||{},t._zod.version=tJ;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 s=eI(r);for(let n of o){if(n._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)||!n._zod.def.when(r))continue}else if(s)continue;let o=r.issues.length,l=n._zod.check(r);if(l instanceof Promise&&a?.async===!1)throw new eY;if(i||l instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await l,r.issues.length!==o&&(eq(r.issues,o,t),s||(s=eI(r,o)))});else{if(r.issues.length===o)continue;eq(r.issues,o,t),s||(s=eI(r,o))}}return i?i.then(()=>r):r},o=(o,a,s)=>{if(eI(o))return o.aborted=!0,o;let n=r(a,i,s);if(n instanceof Promise){if(!1===s.async)throw new eY;return n.then(r=>t._zod.parse(r,s))}return t._zod.parse(n,s)};t._zod.run=(a,s)=>{if(s.skipChecks)return t._zod.parse(a,s);if("backward"===s.direction){let r=t._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return r instanceof Promise?r.then(t=>o(t,a,s)):o(r,a,s)}let n=t._zod.parse(a,s);if(n instanceof Promise){if(!1===s.async)throw new eY;return n.then(t=>r(t,i,s))}return r(n,i,s)}}},{get"~standard"(){return eF(this,"~standard",tW(this),!1)},set"~standard"(value){eF(this,"~standard",value)}}),tG=(t,r)=>t.issues.length?{issues:t.issues.map(t=>ez(t,r,e1()))}:{value:t.value};async function tZ(t,r){let o={async:!0};return tG(await t._zod.run({value:r,issues:[]},o),o)}function tW(t){return{validate:r=>{let o={async:!1};try{let a=t._zod.run({value:r,issues:[]},o);if(!(a instanceof Promise))return tG(a,o)}catch(t){}return tZ(t,r)},vendor:"zod",version:1}}let tX=eX("$ZodString",(t,r)=>{tB.init(t,r),t._zod.pattern=r.pattern??t_,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}}),tY=eX("$ZodStringFormat",(t,r)=>{tq.init(t,r),tX.init(t,r)}),tQ=eX("$ZodGUID",(t,r)=>{r.pattern??(r.pattern=tn),tY.init(t,r)}),t0=eX("$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=tl(t))}else r.pattern??(r.pattern=tl());tY.init(t,r)}),t1=eX("$ZodEmail",(t,r)=>{r.pattern??(r.pattern=tc),tY.init(t,r)});function t2(t){try{if("undefined"!=typeof URL&&"function"==typeof URL.canParse)return URL.canParse(t);return new URL(t),!0}catch{return!1}}let t9=/[\t\n\r]/g;function t4(t){return t.replace(t9,"")}let t5=eX("$ZodURL",(t,r)=>{tY.init(t,r),t._zod.check=o=>{try{var a,i;let s=o.value.trim(),n="normalize"in r||"hostname"in r||"protocol"in r?function(t,r){if(!r.normalize&&r.protocol?.source===tm.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}}(s,r):t2(s)||2;if(1===n)return void o.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:o.value,inst:t,continue:!r.abort});if(2===n)return void o.issues.push({code:"invalid_format",format:"url",input:o.value,inst:t,continue:!r.abort});if(!0===n){o.value=t4(s);return}r.hostname&&((a=r.hostname).lastIndex=0,!a.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&&((i=r.protocol).lastIndex=0,!i.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.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?n.href:t4(s);return}catch(a){o.issues.push({code:"invalid_format",format:"url",input:o.value,inst:t,continue:!r.abort})}}}),t3=eX("$ZodEmoji",(t,r)=>{r.pattern??(r.pattern=RegExp(tu,"u")),tY.init(t,r)}),t6=eX("$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?ti:(o=r.length,RegExp(`^[a-zA-Z0-9_-]{${o}}$`))),tY.init(t,r)}),t8=eX("$ZodCUID",(t,r)=>{r.pattern??(r.pattern=te),tY.init(t,r)}),t7=eX("$ZodCUID2",(t,r)=>{r.pattern??(r.pattern=tt),tY.init(t,r)}),re=eX("$ZodULID",(t,r)=>{r.pattern??(r.pattern=tr),tY.init(t,r)}),rt=eX("$ZodXID",(t,r)=>{r.pattern??(r.pattern=to),tY.init(t,r)}),rr=eX("$ZodKSUID",(t,r)=>{r.pattern??(r.pattern=ta),tY.init(t,r)}),ro=eX("$ZodISODateTime",(t,r)=>{let o,a,i;r.pattern??(o=["Z"],r.offset&&o.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)"),a=`${tb({precision:r.precision,seconds:!0})}(?:${o.join("|")})`,i=r.local?`${a}|${tb({precision:r.precision})}`:a,r.pattern=RegExp(`^${tg}T(?:${i})$`)),tY.init(t,r)}),ra=eX("$ZodISODate",(t,r)=>{r.pattern??(r.pattern=tv),tY.init(t,r)}),ri=eX("$ZodISOTime",(t,r)=>{r.pattern??(r.pattern=RegExp(`^${tb(r)}$`)),tY.init(t,r)}),rs=eX("$ZodISODuration",(t,r)=>{r.pattern??(r.pattern=ts),tY.init(t,r)}),rn=eX("$ZodIPv4",(t,r)=>{r.pattern??(r.pattern=td),tY.init(t,r)}),rl=/^[0-9a-fA-F:.]+$/;function rc(t){return!!rl.test(t)&&t2(`http://[${t}]`)}let ru=eX("$ZodIPv6",(t,r)=>{r.pattern??(r.pattern=tp),tY.init(t,r),t._zod.check=o=>{rc(o.value)||o.issues.push({code:"invalid_format",format:"ipv6",input:o.value,inst:t,continue:!r.abort})}}),rd=eX("$ZodCIDRv4",(t,r)=>{r.pattern??(r.pattern=th),tY.init(t,r)}),rp=eX("$ZodCIDRv6",(t,r)=>{r.pattern??(r.pattern=tf),tY.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)&&rc(o)}(o.value)&&o.issues.push({code:"invalid_format",format:"cidrv6",input:o.value,inst:t,continue:!r.abort})}});function rh(t){if(""===t)return!0;if(/\s/.test(t)||t.length%4!=0)return!1;try{return atob(t),!0}catch{return!1}}let rf=/^[0-9a-zA-Z+/]*={0,2}$/,rm=eX("$ZodBase64",(t,r)=>{r.pattern??(r.pattern=rf),tY.init(t,r),t._zod.check=o=>{rh(o.value)||o.issues.push({code:"invalid_format",format:"base64",input:o.value,inst:t,continue:!r.abort})}}),ry=/^[A-Za-z0-9_-]*$/,rg=eX("$ZodBase64URL",(t,r)=>{r.pattern??(r.pattern=ry),tY.init(t,r),t._zod.check=o=>{!function(t){if(!ry.test(t))return!1;let r=t.replace(/[-_]/g,t=>"-"===t?"+":"/");return rh(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})}}),rv=eX("$ZodE164",(t,r)=>{r.pattern??(r.pattern=ty),tY.init(t,r)}),rb=eX("$ZodJWT",(t,r)=>{tY.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})}}),r_=eX("$ZodNumber",(t,r)=>{tB.init(t,r),t._zod.pattern=t$,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 s="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,...s?{received:s}:{}}),o}}),rS=eX("$ZodNumberFormat",(t,r)=>{tN.init(t,r),r_.init(t,r)}),r$=eX("$ZodBoolean",(t,r)=>{tB.init(t,r),t._zod.pattern=tw,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}}),rw=eX("$ZodNull",(t,r)=>{tB.init(t,r),t._zod.pattern=tE,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}}),rE=eX("$ZodAny",(t,r)=>{tB.init(t,r),t._zod.parse=t=>t}),rR=eX("$ZodUnknown",(t,r)=>{tB.init(t,r),t._zod.parse=t=>t}),rP=eX("$ZodNever",(t,r)=>{tB.init(t,r),t._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function rk(t,r,o){t.issues.length&&r.issues.push(...eA(o,t.issues)),r.value[o]=t.value}let rO=eX("$ZodArray",(t,r)=>{tB.init(t,r);let o=e0.memoizer;o?.attach(t),t._zod.parse=(a,i)=>{let s=a.value;if(!Array.isArray(s))return a.issues.push({expected:"array",code:"invalid_type",input:s,inst:t}),a;a.value=o?o.alloc(t,a,Array(s.length),i):Array(s.length);let n=[],l=i?.abortEarly;for(let t=0;t<s.length;t++){let o=s[t],c=r.element._zod.run({value:o,issues:[]},i);if(c instanceof Promise)n.push(c.then(r=>rk(r,a,t)));else if(rk(c,a,t),l&&0!==c.issues.length&&eI(c))break}return n.length?Promise.all(n).then(()=>a):a}});function rT(t,r,o,a,i,s){let n=o in a,l="optional"===s;if(n||!l||"optional"!==i){if(t.issues.length){if(void 0!==i&&l&&!n)return;r.issues.push(...eA(o,t.issues))}if(!n&&void 0===i){t.issues.length||r.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[o]});return}void 0===t.value?(n||"defaulted"===i&&!l)&&(r.value[o]=void 0):r.value[o]=t.value}}let rx=[];function rj(t){var r;let o=Object.keys(t.shape),a=Object.getOwnPropertySymbols(t.shape),i=a.length?a:rx,s=i.length?[...o,...i]:o;for(let r of s)if(!t.shape?.[r]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(r)}": expected a Zod schema`);let n=Object.keys(r=t.shape).filter(t=>void 0!==r[t]._zod.optin&&"optional"===r[t]._zod.optout);return{...t,allKeys:s,symbolKeys:i,keySet:new Set(o),numKeys:o.length,optionalKeys:new Set(n)}}function rC(t,r,o,a,i,s,n){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(n&&o.issues.length!==f){if(eI(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 s=u.run({value:r[i],issues:[]},a);s instanceof Promise?t.push(s.then(t=>rT(t,o,i,r,p,h))):rT(s,o,i,r,p,h)}return(l.length&&o.issues.push({code:"unrecognized_keys",keys:l,input:r,inst:s,continue:!0}),t.length)?Promise.all(t).then(()=>o):o}let rN=eX("$ZodObject",(t,r)=>{let o;tB.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 s=ec(()=>rj(r));eB(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)||ep(o,t,new Set),a.values))o[t].add(r);void 0!==a.optin&&o[t].add(void 0)}}return o});let n=r.catchall,l=e0.memoizer;l?.attach(t),t._zod.parse=(r,a)=>{o??(o=s.value);let i=r.value;if(!e_(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(eI(r,p))break;p=r.issues.length}if("__proto__"===t)continue;let o=u[t],s=o._zod.optin,n=o._zod.optout,l=o._zod.run({value:i[t],issues:[]},a);l instanceof Promise?c.push(l.then(o=>rT(o,r,t,i,s,n))):rT(l,r,t,i,s,n)}return n?rC(c,i,r,a,s.value,t,!0===d):c.length?Promise.all(c).then(()=>r):r}}),rI=eX("$ZodObjectJIT",(t,r)=>{let o,a;rN.init(t,r);let i=t._zod.parse,s=ec(()=>rj(r)),n=e0.memoizer,l=!e0.jitless,c=l&&eS.value,u=r.catchall;t._zod.parse=(d,p)=>{a??(a=s.value);let h=d.value;return e_(h)?l&&c&&p?.async===!1&&!0!==p.jitless?(o||(o=(r=>{let o=s.value,a=o.symbolKeys,i=new tK(["payload","ctx"],{shape:r,inst:t,memo:n,syms:a}),l=t=>`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`,c=(t,r)=>`
|
|
5
|
+
};`)(...Object.values(this.closed))}}let tJ={major:4,minor:6,patch:5},tW=eX("$ZodType",(t,r)=>{var a;t??(t={}),t._zod.def=r,t._zod.bag=t._zod.bag||{},t._zod.version=tJ;let o=t._zod.def.checks,i=t._zod.traits.has("$ZodCheck")?[t,...o??[]]:o?.length?[...o]:[];for(let r of i)for(let a of r._zod.onattach)a(t);if(0===i.length)(a=t._zod).deferred??(a.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let r=(r,a,o)=>{let i;if(r.memo)return r;let n=eI(r);for(let s of a){if(s._zod.def.when){if(function(t,r=0){if(!0===t.aborted)return!0;for(let a=r;a<t.issues.length;a++)if(t.issues[a]?.continue===!1)return!0;return!1}(r)||!s._zod.def.when(r))continue}else if(n)continue;let a=r.issues.length,l=s._zod.check(r);if(l instanceof Promise&&o?.async===!1)throw new eY;if(i||l instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await l,r.issues.length!==a&&(eq(r.issues,a,t),n||(n=eI(r,a)))});else{if(r.issues.length===a)continue;eq(r.issues,a,t),n||(n=eI(r,a))}}return i?i.then(()=>r):r},a=(a,o,n)=>{if(eI(a))return a.aborted=!0,a;let s=r(o,i,n);if(s instanceof Promise){if(!1===n.async)throw new eY;return s.then(r=>t._zod.parse(r,n))}return t._zod.parse(s,n)};t._zod.run=(o,n)=>{if(n.skipChecks)return t._zod.parse(o,n);if("backward"===n.direction){let r=t._zod.parse({value:o.value,issues:[]},{...n,skipChecks:!0});return r instanceof Promise?r.then(t=>a(t,o,n)):a(r,o,n)}let s=t._zod.parse(o,n);if(s instanceof Promise){if(!1===n.async)throw new eY;return s.then(t=>r(t,i,n))}return r(s,i,n)}}},{get"~standard"(){return eV(this,"~standard",tZ(this),!1)},set"~standard"(value){eV(this,"~standard",value)}}),tB=(t,r)=>t.issues.length?{issues:t.issues.map(t=>ez(t,r,e1()))}:{value:t.value};async function tG(t,r){let a={async:!0};return tB(await t._zod.run({value:r,issues:[]},a),a)}function tZ(t){return{validate:r=>{let a={async:!1};try{let o=t._zod.run({value:r,issues:[]},a);if(!(o instanceof Promise))return tB(o,a)}catch(t){}return tG(t,r)},vendor:"zod",version:1}}let tX=eX("$ZodString",(t,r)=>{tW.init(t,r),t._zod.pattern=r.pattern??t_,t._zod.parse=(a,o)=>{if(r.coerce)try{a.value=String(a.value)}catch(t){}return"string"==typeof a.value||a.issues.push({expected:"string",code:"invalid_type",input:a.value,inst:t}),a}}),tY=eX("$ZodStringFormat",(t,r)=>{tq.init(t,r),tX.init(t,r)}),tQ=eX("$ZodGUID",(t,r)=>{r.pattern??(r.pattern=ts),tY.init(t,r)}),t0=eX("$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=tl(t))}else r.pattern??(r.pattern=tl());tY.init(t,r)}),t1=eX("$ZodEmail",(t,r)=>{r.pattern??(r.pattern=tc),tY.init(t,r)});function t2(t){try{if("undefined"!=typeof URL&&"function"==typeof URL.canParse)return URL.canParse(t);return new URL(t),!0}catch{return!1}}let t9=/[\t\n\r]/g;function t4(t){return t.replace(t9,"")}let t5=eX("$ZodURL",(t,r)=>{tY.init(t,r),t._zod.check=a=>{try{var o,i;let n=a.value.trim(),s="normalize"in r||"hostname"in r||"protocol"in r?function(t,r){if(!r.normalize&&r.protocol?.source===tm.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}}(n,r):t2(n)||2;if(1===s)return void a.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:a.value,inst:t,continue:!r.abort});if(2===s)return void a.issues.push({code:"invalid_format",format:"url",input:a.value,inst:t,continue:!r.abort});if(!0===s){a.value=t4(n);return}r.hostname&&((o=r.hostname).lastIndex=0,!o.test(s.hostname))&&a.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:r.hostname.source,input:a.value,inst:t,continue:!r.abort}),r.protocol&&((i=r.protocol).lastIndex=0,!i.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol))&&a.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:r.protocol.source,input:a.value,inst:t,continue:!r.abort}),a.value=r.normalize?s.href:t4(n);return}catch(o){a.issues.push({code:"invalid_format",format:"url",input:a.value,inst:t,continue:!r.abort})}}}),t6=eX("$ZodEmoji",(t,r)=>{r.pattern??(r.pattern=RegExp(tu,"u")),tY.init(t,r)}),t3=eX("$ZodNanoID",(t,r)=>{var a;if(void 0!==r.length&&(!Number.isInteger(r.length)||r.length<1))throw Error(`Invalid nanoid length: ${r.length}`);r.pattern??(r.pattern=void 0===r.length?ti:(a=r.length,RegExp(`^[a-zA-Z0-9_-]{${a}}$`))),tY.init(t,r)}),t8=eX("$ZodCUID",(t,r)=>{r.pattern??(r.pattern=te),tY.init(t,r)}),t7=eX("$ZodCUID2",(t,r)=>{r.pattern??(r.pattern=tt),tY.init(t,r)}),re=eX("$ZodULID",(t,r)=>{r.pattern??(r.pattern=tr),tY.init(t,r)}),rt=eX("$ZodXID",(t,r)=>{r.pattern??(r.pattern=ta),tY.init(t,r)}),rr=eX("$ZodKSUID",(t,r)=>{r.pattern??(r.pattern=to),tY.init(t,r)}),ra=eX("$ZodISODateTime",(t,r)=>{let a,o,i;r.pattern??(a=["Z"],r.offset&&a.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)"),o=`${tb({precision:r.precision,seconds:!0})}(?:${a.join("|")})`,i=r.local?`${o}|${tb({precision:r.precision})}`:o,r.pattern=RegExp(`^${tg}T(?:${i})$`)),tY.init(t,r)}),ro=eX("$ZodISODate",(t,r)=>{r.pattern??(r.pattern=tv),tY.init(t,r)}),ri=eX("$ZodISOTime",(t,r)=>{r.pattern??(r.pattern=RegExp(`^${tb(r)}$`)),tY.init(t,r)}),rn=eX("$ZodISODuration",(t,r)=>{r.pattern??(r.pattern=tn),tY.init(t,r)}),rs=eX("$ZodIPv4",(t,r)=>{r.pattern??(r.pattern=td),tY.init(t,r)}),rl=/^[0-9a-fA-F:.]+$/;function rc(t){return!!rl.test(t)&&t2(`http://[${t}]`)}let ru=eX("$ZodIPv6",(t,r)=>{r.pattern??(r.pattern=tp),tY.init(t,r),t._zod.check=a=>{rc(a.value)||a.issues.push({code:"invalid_format",format:"ipv6",input:a.value,inst:t,continue:!r.abort})}}),rd=eX("$ZodCIDRv4",(t,r)=>{r.pattern??(r.pattern=th),tY.init(t,r)}),rp=eX("$ZodCIDRv6",(t,r)=>{r.pattern??(r.pattern=tf),tY.init(t,r),t._zod.check=a=>{!function(t){let r=t.split("/");if(2!==r.length)return!1;let[a,o]=r;if(!o)return!1;let i=Number(o);return`${i}`===o&&!(i<0)&&!(i>128)&&rc(a)}(a.value)&&a.issues.push({code:"invalid_format",format:"cidrv6",input:a.value,inst:t,continue:!r.abort})}});function rh(t){if(""===t)return!0;if(/\s/.test(t)||t.length%4!=0)return!1;try{return atob(t),!0}catch{return!1}}let rf=/^[0-9a-zA-Z+/]*={0,2}$/,rm=eX("$ZodBase64",(t,r)=>{r.pattern??(r.pattern=rf),tY.init(t,r),t._zod.check=a=>{rh(a.value)||a.issues.push({code:"invalid_format",format:"base64",input:a.value,inst:t,continue:!r.abort})}}),ry=/^[A-Za-z0-9_-]*$/,rg=eX("$ZodBase64URL",(t,r)=>{r.pattern??(r.pattern=ry),tY.init(t,r),t._zod.check=a=>{!function(t){if(!ry.test(t))return!1;let r=t.replace(/[-_]/g,t=>"-"===t?"+":"/");return rh(r.padEnd(4*Math.ceil(r.length/4),"="))}(a.value)&&a.issues.push({code:"invalid_format",format:"base64url",input:a.value,inst:t,continue:!r.abort})}}),rv=eX("$ZodE164",(t,r)=>{r.pattern??(r.pattern=ty),tY.init(t,r)}),rb=eX("$ZodJWT",(t,r)=>{tY.init(t,r),t._zod.check=a=>{!function(t,r=null){try{let a=t.split(".");if(3!==a.length)return!1;let[o]=a;if(!o)return!1;let i=JSON.parse(atob(o));if("typ"in i&&i?.typ!=="JWT"||!i.alg||r&&(!("alg"in i)||i.alg!==r))return!1;return!0}catch{return!1}}(a.value,r.alg)&&a.issues.push({code:"invalid_format",format:"jwt",input:a.value,inst:t,continue:!r.abort})}}),r_=eX("$ZodNumber",(t,r)=>{tW.init(t,r),t._zod.pattern=tw,t._zod.parse=(a,o)=>{if(r.coerce)try{a.value=Number(a.value)}catch(t){}let i=a.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return a;let n="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:String(i):void 0;return a.issues.push({expected:"number",code:"invalid_type",input:i,inst:t,...n?{received:n}:{}}),a}}),rS=eX("$ZodNumberFormat",(t,r)=>{tA.init(t,r),r_.init(t,r)}),rw=eX("$ZodBoolean",(t,r)=>{tW.init(t,r),t._zod.pattern=t$,t._zod.parse=(a,o)=>{if(r.coerce)try{a.value=!!a.value}catch(t){}let i=a.value;return"boolean"==typeof i||a.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:t}),a}}),r$=eX("$ZodNull",(t,r)=>{tW.init(t,r),t._zod.pattern=tE,t._zod.values=new Set([null]),t._zod.parse=(r,a)=>{let o=r.value;return null===o||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:t}),r}}),rE=eX("$ZodAny",(t,r)=>{tW.init(t,r),t._zod.parse=t=>t}),rP=eX("$ZodUnknown",(t,r)=>{tW.init(t,r),t._zod.parse=t=>t}),rR=eX("$ZodNever",(t,r)=>{tW.init(t,r),t._zod.parse=(r,a)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function rk(t,r,a){t.issues.length&&r.issues.push(...eN(a,t.issues)),r.value[a]=t.value}let rx=eX("$ZodArray",(t,r)=>{tW.init(t,r);let a=e0.memoizer;a?.attach(t),t._zod.parse=(o,i)=>{let n=o.value;if(!Array.isArray(n))return o.issues.push({expected:"array",code:"invalid_type",input:n,inst:t}),o;o.value=a?a.alloc(t,o,Array(n.length),i):Array(n.length);let s=[],l=i?.abortEarly;for(let t=0;t<n.length;t++){let a=n[t],c=r.element._zod.run({value:a,issues:[]},i);if(c instanceof Promise)s.push(c.then(r=>rk(r,o,t)));else if(rk(c,o,t),l&&0!==c.issues.length&&eI(c))break}return s.length?Promise.all(s).then(()=>o):o}});function rT(t,r,a,o,i,n){let s=a in o,l="optional"===n;if(s||!l||"optional"!==i){if(t.issues.length){if(void 0!==i&&l&&!s)return;r.issues.push(...eN(a,t.issues))}if(!s&&void 0===i){t.issues.length||r.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[a]});return}void 0===t.value?(s||"defaulted"===i&&!l)&&(r.value[a]=void 0):r.value[a]=t.value}}let rO=[];function rj(t){var r;let a=Object.keys(t.shape),o=Object.getOwnPropertySymbols(t.shape),i=o.length?o:rO,n=i.length?[...a,...i]:a;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(a),numKeys:a.length,optionalKeys:new Set(s)}}function rC(t,r,a,o,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&&a.issues.length!==f){if(eI(a,f))break;f=a.issues.length}if(c.has(i))continue;if("__proto__"===i){"never"===d&&l.push(i);continue}if("never"===d){l.push(i);continue}let n=u.run({value:r[i],issues:[]},o);n instanceof Promise?t.push(n.then(t=>rT(t,a,i,r,p,h))):rT(n,a,i,r,p,h)}return(l.length&&a.issues.push({code:"unrecognized_keys",keys:l,input:r,inst:n,continue:!0}),t.length)?Promise.all(t).then(()=>a):a}let rA=eX("$ZodObject",(t,r)=>{let a;tW.init(t,r);let o=Object.getOwnPropertyDescriptor(r,"shape"),i=o?.get?o.get.raw:r.shape??{};if(i){let t=()=>{let a={...i};return Object.defineProperty(r,"shape",{value:a}),t.raw=a,a};t.raw=i,Object.defineProperty(r,"shape",{get:t})}let n=ec(()=>rj(r));eW(t,"propValues",t=>{let r=t.def.shape,a={};for(let t in r){let o=r[t]._zod;if(o.values){for(let r of(Object.prototype.hasOwnProperty.call(a,t)||ep(a,t,new Set),o.values))a[t].add(r);void 0!==o.optin&&a[t].add(void 0)}}return a});let s=r.catchall,l=e0.memoizer;l?.attach(t),t._zod.parse=(r,o)=>{a??(a=n.value);let i=r.value;if(!e_(i))return r.issues.push({expected:"object",code:"invalid_type",input:i,inst:t}),r;r.value=l?l.alloc(t,r,{},o):{};let c=[],u=a.shape,d=o?.abortEarly,p=r.issues.length;for(let t of a.allKeys){if(d&&r.issues.length!==p){if(eI(r,p))break;p=r.issues.length}if("__proto__"===t)continue;let a=u[t],n=a._zod.optin,s=a._zod.optout,l=a._zod.run({value:i[t],issues:[]},o);l instanceof Promise?c.push(l.then(a=>rT(a,r,t,i,n,s))):rT(l,r,t,i,n,s)}return s?rC(c,i,r,o,n.value,t,!0===d):c.length?Promise.all(c).then(()=>r):r}}),rI=eX("$ZodObjectJIT",(t,r)=>{let a,o;rA.init(t,r);let i=t._zod.parse,n=ec(()=>rj(r)),s=e0.memoizer,l=!e0.jitless,c=l&&eS.value,u=r.catchall;t._zod.parse=(d,p)=>{o??(o=n.value);let h=d.value;return e_(h)?l&&c&&p?.async===!1&&!0!==p.jitless?(a||(a=(r=>{let a=n.value,o=a.symbolKeys,i=new tF(["payload","ctx"],{shape:r,inst:t,memo:s,syms:o}),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,34 +13,34 @@ ${r.join("\n")}
|
|
|
11
13
|
if (${t}_ab && ctx && ctx.abortEarly) {
|
|
12
14
|
payload.value = newResult;
|
|
13
15
|
return payload;
|
|
14
|
-
}`;i.write("const input = payload.value;");let u=Object.create(null),d=0;for(let t of
|
|
15
|
-
const ${
|
|
16
|
-
if (!${
|
|
17
|
-
if (${
|
|
16
|
+
}`;i.write("const input = payload.value;");let u=Object.create(null),d=0;for(let t of a.allKeys)u[t]=`key_${d++}`;for(let t of(i.write(s?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};"),a.allKeys)){if("__proto__"===t)continue;let a=u[t],n="symbol"==typeof t?`syms[${o.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 ${a} = ${l(n)};`),h&&f){let t="optional"===p?`${a}_present`:`${a}.value !== undefined || ${a}_present`;i.write(`
|
|
17
|
+
const ${a}_present = ${s};
|
|
18
|
+
if (!${a}.issues.length || ${a}_present) {
|
|
19
|
+
if (${a}.issues.length) {${c(a,n)}
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
if (${t}) {
|
|
21
|
-
newResult[${
|
|
23
|
+
newResult[${n}] = ${a}.value;
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
`)}else h?(i.write(`
|
|
26
|
-
if (${
|
|
28
|
+
if (${a}.issues.length) {${c(a,n)}
|
|
27
29
|
}
|
|
28
|
-
`),"defaulted"===p?i.write(`newResult[${
|
|
29
|
-
if (${
|
|
30
|
-
newResult[${
|
|
30
|
+
`),"defaulted"===p?i.write(`newResult[${n}] = ${a}.value;`):i.write(`
|
|
31
|
+
if (${a}.value !== undefined || ${s}) {
|
|
32
|
+
newResult[${n}] = ${a}.value;
|
|
31
33
|
}
|
|
32
34
|
`)):i.write(`
|
|
33
|
-
const ${
|
|
34
|
-
if (${
|
|
35
|
+
const ${a}_present = ${s};
|
|
36
|
+
if (${a}.issues.length) {${c(a,n)}
|
|
35
37
|
}
|
|
36
|
-
if (!${
|
|
38
|
+
if (!${a}_present && !${a}.issues.length) {
|
|
37
39
|
payload.issues.push({
|
|
38
40
|
code: "invalid_type",
|
|
39
41
|
expected: "nonoptional",
|
|
40
42
|
input: undefined,
|
|
41
|
-
path: [${
|
|
43
|
+
path: [${n}]
|
|
42
44
|
});
|
|
43
45
|
if (ctx && ctx.abortEarly) {
|
|
44
46
|
payload.value = newResult;
|
|
@@ -46,31 +48,31 @@ ${r.join("\n")}
|
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
if (${
|
|
50
|
-
newResult[${
|
|
51
|
+
if (${a}_present) {
|
|
52
|
+
newResult[${n}] = ${a}.value;
|
|
51
53
|
}
|
|
52
54
|
|
|
53
|
-
`)}return i.write("payload.value = newResult;"),i.write("return payload;"),i.compile()})(r.shape)),d=o(d,p),u)?rC([],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 rA(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=>!eI(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=>ez(t,a,e1())))}),r)}let rM=eX("$ZodUnion",(t,r)=>{tB.init(t,r),eB(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),eB(t,"optout",t=>t.def.options.some(t=>"optional"===t._zod.optout)?"optional":void 0),eB(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)))}),eB(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=>eu(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 s=!1,n=[];for(let t of r.options){let r=t._zod.run({value:a.value,issues:[]},i);if(r instanceof Promise)n.push(r),s=!0;else{if(0===r.issues.length)return r;n.push(r)}}return s?Promise.all(n).then(r=>rA(r,a,t,i)):rA(n,a,t,i)}}),rq=eX("$ZodDiscriminatedUnion",(t,r)=>{r.inclusive=!1,rM.init(t,r);let o=t._zod.parse;eB(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,s]of(i[t.def.discriminator]?.has(void 0)&&o++,Object.entries(i)))for(let t of(Object.prototype.hasOwnProperty.call(r,a)||ep(r,a,new Set),s))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=eh(t._zod.def);if(a&&!Object.prototype.hasOwnProperty.call(a,r.discriminator))throw Error(`Invalid discriminated union option at index "${o}"`)});let a=ec(()=>(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,s)=>{let n=i.value;if(!e_(n))return i.issues.push({code:"invalid_type",expected:"object",input:n,inst:t}),i;let l=n?.[r.discriminator],c=a.value.get(l);return c&&(void 0!==l||"backward"!==s.direction)?c._zod.run(i,s):r.unionFallback||"backward"===s.direction?o(i,s):(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:n,path:[r.discriminator],inst:t}),i)}}),rz=eX("$ZodIntersection",(t,r)=>{tB.init(t,r),t._zod.parse=(t,o)=>{let a=t.value,i=r.left._zod.run({value:a,issues:[]},o),s=r.right._zod.run({value:a,issues:[]},o);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([r,o])=>rL(t,r,o)):rL(t,i,s)}});function rL(t,r,o){let a,i=new Map,s=new Map,n=(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]);s.has(r)||s.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)n(o,"l")||t.issues.push(o);for(let r of o.issues)n(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)&&s.has(o)&&t.issues.push(s.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(e$(r)&&e$(o)){let a=Object.keys(o),i=Object.keys(r).filter(t=>-1!==a.indexOf(t)),s={...r,...o};for(let a of(Object.prototype.hasOwnProperty.call(s,"__proto__")&&delete s.__proto__,i)){if("__proto__"===a)continue;let i=t(r[a],o[a]);if(!i.valid)return{valid:!1,mergeErrorPath:[a,...i.mergeErrorPath]};s[a]=i.data}return{valid:!0,data:s}}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 s=t(r[i],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(eI(t))return t;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return t.value=c.data,t}let rD=eX("$ZodRecord",(t,r)=>{tB.init(t,r);let o=e0.memoizer;o?.attach(t),t._zod.parse=(a,i)=>{let s=a.value;if(!e$(s))return a.issues.push({expected:"record",code:"invalid_type",input:s,inst:t}),a;let n=[],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=>ez(t,i,e1())),input:o,path:[o],inst:t});continue}let c=l.value;if("__proto__"===c)continue;let d=r.valueType._zod.run({value:s[o],issues:[]},i);d instanceof Promise?n.push(d.then(t=>{t.issues.length&&a.issues.push(...eA(o,t.issues)),a.value[c]=t.value})):(d.issues.length&&a.issues.push(...eA(o,d.issues)),a.value[c]=d.value)}for(let t in s)if(!u.has(t))if("loose"===r.mode){if("__proto__"===t)continue;a.value[t]=s[t]}else(c=c??[]).push(t);c&&c.length>0&&a.issues.push({code:"unrecognized_keys",input:s,inst:t,keys:c,continue:!0})}else{let c;for(let u of(a.value=o?o.alloc(t,a,{},i):{},Reflect.ownKeys(s))){if("__proto__"===u||!Object.prototype.propertyIsEnumerable.call(s,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&&t$.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]=s[u]:l?(c=c??[]).push(u):a.issues.push({code:"invalid_key",origin:"record",issues:o.issues.map(t=>ez(t,i,e1())),input:u,path:[u],inst:t});continue}let d=o.value;if("__proto__"===d)continue;let p=r.valueType._zod.run({value:s[u],issues:[]},i);p instanceof Promise?n.push(p.then(t=>{t.issues.length&&a.issues.push(...eA(u,t.issues)),a.value[d]=t.value})):(p.issues.length&&a.issues.push(...eA(u,p.issues)),a.value[d]=p.value)}c&&c.length>0&&a.issues.push({code:"unrecognized_keys",input:s,inst:t,keys:c,continue:!0})}return n.length?Promise.all(n).then(()=>a):a}}),rU=eX("$ZodEnum",(t,r)=>{tB.init(t,r);let o=ei(r.entries),a=new Set(o);t._zod.values=a,eB(t,"pattern",t=>{let r=ei(t.def.entries).filter(t=>eE.has(typeof t));return new RegExp(r.length?`^(${r.map(t=>eR(t.toString())).join("|")})$`:"^[^\\s\\S]$")}),t._zod.parse=(r,i)=>{let s=r.value;return a.has(s)||r.issues.push({code:"invalid_value",values:o,input:s,inst:t}),r}}),rV=eX("$ZodLiteral",(t,r)=>{tB.init(t,r);let o=new Set(r.values);t._zod.values=o,eB(t,"pattern",t=>{let r=t.def.values;return new RegExp(r.length?`^(${r.map(t=>"string"==typeof t?eR(t):t?eR(t.toString()):String(t)).join("|")})$`:"^[^\\s\\S]$")}),t._zod.parse=(a,i)=>{let s=a.value;return o.has(s)||a.issues.push({code:"invalid_value",values:r.values,input:s,inst:t}),a}}),rF=eX("$ZodTransform",(t,r)=>{tB.init(t,r),t._zod.optin="optional",e0.memoizer?.guard(t),t._zod.parse=(o,a)=>{if("backward"===a.direction)throw new eQ(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 eY;return o.value=i,o}});function rH(t,r){return t.value=r.issues.length?void 0:r.value,t}let rK=eX("$ZodOptional",(t,r)=>{tB.init(t,r),eB(t,"optin",t=>"defaulted"===t.def.innerType._zod.optin?"defaulted":"optional"),t._zod.optout="optional",eB(t,"values",t=>{let r=t.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),eB(t,"pattern",t=>{let r=t.def.innerType._zod.pattern;return r?RegExp(`^(${eu(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=>rH(t,r)):rH(t,a)}return r.innerType._zod.run(t,o)}}),rJ=eX("$ZodExactOptional",(t,r)=>{rK.init(t,r),eB(t,"values",t=>t.def.innerType._zod.values),eB(t,"pattern",t=>t.def.innerType._zod.pattern),t._zod.parse=(t,o)=>r.innerType._zod.run(t,o)}),rB=eX("$ZodNullable",(t,r)=>{tB.init(t,r),eB(t,"optin",t=>t.def.innerType._zod.optin),eB(t,"optout",t=>t.def.innerType._zod.optout),eB(t,"pattern",t=>{let r=t.def.innerType._zod.pattern;return r?RegExp(`^(${eu(r.source)}|null)$`):void 0}),eB(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)}),rG=eX("$ZodDefault",(t,r)=>{tB.init(t,r),t._zod.optin="defaulted",eB(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=>rZ(t,r)):rZ(a,r)}});function rZ(t,r){return void 0===t.value&&(t.value=r.defaultValue),t}let rW=eX("$ZodPrefault",(t,r)=>{tB.init(t,r),t._zod.optin="defaulted",eB(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))}),rX=eX("$ZodNonOptional",(t,r)=>{tB.init(t,r),eB(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=>rY(r,t)):rY(i,t)}});function rY(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=>ez(t,a,e1()))},input:t.value}):(t.value=r.value,r.memo&&(t.memo=!0)),t}let r0=eX("$ZodCatch",(t,r)=>{tB.init(t,r),eB(t,"optin",t=>"defaulted"===t.def.innerType._zod.optin?"defaulted":"optional"),eB(t,"optout",t=>t.def.innerType._zod.optout),eB(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)}}),r1=eX("$ZodPipe",(t,r)=>{tB.init(t,r),eB(t,"values",t=>t.def.in._zod.values),eB(t,"optin",t=>t.def.in._zod.optin),eB(t,"optout",t=>t.def.out._zod.optout),eB(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=>r2(t,r.in,o)):r2(a,r.in,o)}let a=r.in._zod.run(t,o);return a instanceof Promise?a.then(t=>r2(t,r.out,o)):r2(a,r.out,o)}});function r2(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 r9=eX("$ZodPreprocess",(t,r)=>{r1.init(t,r)}),r4=eX("$ZodReadonly",(t,r)=>{tB.init(t,r),eB(t,"propValues",t=>t.def.innerType._zod.propValues),eB(t,"values",t=>t.def.innerType._zod.values),eB(t,"optin",t=>t.def.innerType?._zod?.optin),eB(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(r5):r5(a)}});function r5(t){return t.memo||(t.value=Object.freeze(t.value)),t}let r3=eX("$ZodLazy",(t,r)=>{var o;let a;tB.init(t,r),o=t._zod,Object.defineProperty(o,"innerType",{get(){if(a!==ed)return void 0===a&&(a=ed,a=(()=>(r._cachedInner||(r._cachedInner=r.getter()),r._cachedInner))()),a},set(t){Object.defineProperty(o,"innerType",{value:t})},configurable:!0}),eB(t,"pattern",t=>t.innerType?._zod?.pattern),eB(t,"propValues",t=>t.innerType?._zod?.propValues),eB(t,"optin",t=>t.innerType?._zod?.optin??void 0),eB(t,"optout",t=>t.innerType?._zod?.optout??void 0),t._zod.parse=(r,o)=>t._zod.innerType._zod.run(r,o)}),r6=eX("$ZodCustom",(t,r)=>{tk.init(t,r),tB.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=>r8(r,o,a,t));r8(i,o,a,t)}});function r8(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(eV(t))}}(x=globalThis).__zod_globalRegistry??(x.__zod_globalRegistry=new class t{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)}});let r7=globalThis.__zod_globalRegistry;function oe(t){return t.checks&&(t.checks=[...t.checks]),t}function ot(t,r){return new t({type:"string",format:"email",check:"string_format",abort:!1,...ek(r)})}function or(t,r){return new t({type:"string",format:"url",check:"string_format",abort:!1,...ek(r)})}function oo(t,r){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ek(r)})}function oa(t,r){return new t({type:"string",format:"date",check:"string_format",...ek(r)})}function oi(t,r){return new tx({check:"less_than",...ek(r),value:t,inclusive:!1})}function os(t,r){return new tx({check:"less_than",...ek(r),value:t,inclusive:!0})}function on(t,r){return new tj({check:"greater_than",...ek(r),value:t,inclusive:!1})}function ol(t,r){return new tj({check:"greater_than",...ek(r),value:t,inclusive:!0})}function oc(t,r){return new tC({check:"multiple_of",...ek(r),value:t})}function ou(t,r){return new tI({check:"max_length",...ek(r),maximum:t})}function od(t,r){return new tA({check:"min_length",...ek(r),minimum:t})}function op(t,r){return new tM({check:"length_equals",...ek(r),length:t})}function oh(t){return new tH({check:"overwrite",tx:t})}function of(t,...r){for(let o of r)for(let r of Reflect.ownKeys(o))Object.prototype.propertyIsEnumerable.call(o,r)&&ep(t,r,o[r]);return t}function om(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??r7,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 oy(t,r,o,a,i){let s="function"==typeof r.unrepresentable?r.unrepresentable({zodSchema:t,path:a.path,message:i}):r.unrepresentable;if("any"===s)return!1;if(void 0===s||"throw"===s)throw Error(i);return Object.assign(o,s),!0}function og(t,r,o={path:[],schemaPath:[]}){var a;let i=t._zod.def,s=r.seen.get(t);if(s)return s.count++,o.schemaPath.includes(t)&&(s.cycle=o.path),s.schema;let n={schema:{},count:1,cycle:void 0,path:o.path};r.seen.set(t,n),r.sharedDefsExtractedFor=void 0,r.sharedEmitDoneFor=void 0;let l=t._zod.toJSONSchema?.();if(l)n.schema=l;else{let a={...o,schemaPath:[...o.schemaPath,t],path:o.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(r,n.schema,a);else{let o=n.schema,s=r.processors[i.type];if(!s)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);s(t,r,o,a)}let s=t._zod.parent;s&&(n.ref||(n.ref=s),og(s,r,a),r.seen.get(s).isParent=!0)}let c=r.metadataRegistry.get(t);return c&&of(n.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 n.schema.examples,delete n.schema.default),"input"===r.io&&"_prefault"in n.schema&&((a=n.schema).default??(a.default=n.schema._prefault)),delete n.schema._prefault,r.seen.get(t).schema}function ov(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function ob(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:s}=(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 s=r[1].defId??r[1].schema.id??`schema${t.counter++}`;return r[1].defId=s,{defId:s,ref:`${i("__shared")}#/${a}/${ov(s)}`}}let i=`#/${a}/`;if(r[1]===o&&!r[1].schema.id)return{ref:"#"};let s=r[1].schema.id??`__schema${t.counter++}`;return{defId:s,ref:i+ov(s)}})(r);a.def={...a.schema},s&&(a.defId=s);let n=a.schema;for(let t in n)delete n[t];n.$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>
|
|
55
|
+
`)}return i.write("payload.value = newResult;"),i.write("return payload;"),i.compile()})(r.shape)),d=a(d,p),u)?rC([],h,d,p,o,t,p?.abortEarly===!0):d:i(d,p):(d.issues.push({expected:"object",code:"invalid_type",input:h,inst:t}),d)}});function rN(t,r,a,o){for(let a of t)if(0===a.issues.length)return r.value=a.value,r;let i=t.filter(t=>!eI(t));return 1===i.length?(r.value=i[0].value,i[0]):(r.issues.push({code:"invalid_union",input:r.value,inst:a,errors:t.map(t=>t.issues.map(t=>ez(t,o,e1())))}),r)}let rM=eX("$ZodUnion",(t,r)=>{tW.init(t,r),eW(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),eW(t,"optout",t=>t.def.options.some(t=>"optional"===t._zod.optout)?"optional":void 0),eW(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)))}),eW(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=>eu(t.source)).join("|")})$`)}});let a=1===r.options.length?r.options[0]._zod.run:null;t._zod.parse=(o,i)=>{if(a)return a(o,i);let n=!1,s=[];for(let t of r.options){let r=t._zod.run({value:o.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=>rN(r,o,t,i)):rN(s,o,t,i)}}),rq=eX("$ZodDiscriminatedUnion",(t,r)=>{r.inclusive=!1,rM.init(t,r);let a=t._zod.parse;eW(t,"propValues",t=>{let r={},a=0;for(let o of t.def.options){let i=o._zod.propValues;if(!i||0===Object.keys(i).length)throw Error(`Invalid discriminated union option at index "${t.def.options.indexOf(o)}"`);for(let[o,n]of(i[t.def.discriminator]?.has(void 0)&&a++,Object.entries(i)))for(let t of(Object.prototype.hasOwnProperty.call(r,o)||ep(r,o,new Set),n))r[o].add(t)}return!t.def.unionFallback&&a>1&&r[t.def.discriminator]?.delete(void 0),r}),r.options.forEach((t,a)=>{let o=eh(t._zod.def);if(o&&!Object.prototype.hasOwnProperty.call(o,r.discriminator))throw Error(`Invalid discriminated union option at index "${a}"`)});let o=ec(()=>(function(t){let r=new Map;for(let a of t.options){let o=a._zod.propValues?.[t.discriminator];if(!o||0===o.size)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let t of o)if(r.has(t)){if(void 0!==t)throw Error(`Duplicate discriminator value "${String(t)}"`);r.set(t,null)}else r.set(t,a)}return r})(r));t._zod.parse=(i,n)=>{let s=i.value;if(!e_(s))return i.issues.push({code:"invalid_type",expected:"object",input:s,inst:t}),i;let l=s?.[r.discriminator],c=o.value.get(l);return c&&(void 0!==l||"backward"!==n.direction)?c._zod.run(i,n):r.unionFallback||"backward"===n.direction?a(i,n):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:r.discriminator,options:Array.from(o.value.keys()).filter(t=>null!==o.value.get(t)),input:s,path:[r.discriminator],inst:t}),i)}}),rz=eX("$ZodIntersection",(t,r)=>{tW.init(t,r),t._zod.parse=(t,a)=>{let o=t.value,i=r.left._zod.run({value:o,issues:[]},a),n=r.right._zod.run({value:o,issues:[]},a);return i instanceof Promise||n instanceof Promise?Promise.all([i,n]).then(([r,a])=>rD(t,r,a)):rD(t,i,n)}});function rD(t,r,a){let o,i=new Map,n=new Map,s=(t,r)=>{let a;if("unrecognized_keys"!==t.code||t.path?.length)if("invalid_key"!==t.code||"record"!==t.origin||t.path?.length!==1)return!1;else{let r=String(t.path[0]);n.has(r)||n.set(r,t),a=[r]}else o??(o=t),a=t.keys;for(let t of a)i.has(t)||i.set(t,{}),i.get(t)[r]=!0;return!0};for(let a of r.issues)s(a,"l")||t.issues.push(a);for(let r of a.issues)s(r,"r")||t.issues.push(r);let l=[...i].filter(([,t])=>t.l&&t.r).map(([t])=>t);if(l.length){let r=o?l.filter(t=>o.keys.includes(t)):[];for(let a of(r.length&&t.issues.push({...o,keys:r}),l))!r.includes(a)&&n.has(a)&&t.issues.push(n.get(a))}let c=function t(r,a){if(r===a||r instanceof Date&&a instanceof Date&&+r==+a)return{valid:!0,data:r};if(ew(r)&&ew(a)){let o=Object.keys(a),i=Object.keys(r).filter(t=>-1!==o.indexOf(t)),n={...r,...a};for(let o of(Object.prototype.hasOwnProperty.call(n,"__proto__")&&delete n.__proto__,i)){if("__proto__"===o)continue;let i=t(r[o],a[o]);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};n[o]=i.data}return{valid:!0,data:n}}if(Array.isArray(r)&&Array.isArray(a)){if(r.length!==a.length)return{valid:!1,mergeErrorPath:[]};let o=[];for(let i=0;i<r.length;i++){let n=t(r[i],a[i]);if(!n.valid)return{valid:!1,mergeErrorPath:[i,...n.mergeErrorPath]};o.push(n.data)}return{valid:!0,data:o}}return{valid:!1,mergeErrorPath:[]}}(r.value,a.value);if(!c.valid){if(eI(t))return t;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return t.value=c.data,t}let rL=eX("$ZodRecord",(t,r)=>{tW.init(t,r);let a=e0.memoizer;a?.attach(t),t._zod.parse=(o,i)=>{let n=o.value;if(!ew(n))return o.issues.push({expected:"record",code:"invalid_type",input:n,inst:t}),o;let s=[],l=r.keyType._zod.values;if(l&&!r.partial){let c;o.value=a?a.alloc(t,o,{},i):{};let u=new Set;for(let a of l)if("string"==typeof a||"number"==typeof a||"symbol"==typeof a){if(u.add("number"==typeof a?a.toString():a),"__proto__"===a)continue;let l=r.keyType._zod.run({value:a,issues:[]},i);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(l.issues.length){o.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(t=>ez(t,i,e1())),input:a,path:[a],inst:t});continue}let c=l.value;if("__proto__"===c)continue;let d=r.valueType._zod.run({value:n[a],issues:[]},i);d instanceof Promise?s.push(d.then(t=>{t.issues.length&&o.issues.push(...eN(a,t.issues)),o.value[c]=t.value})):(d.issues.length&&o.issues.push(...eN(a,d.issues)),o.value[c]=d.value)}for(let t in n)if(!u.has(t))if("loose"===r.mode){if("__proto__"===t)continue;o.value[t]=n[t]}else(c=c??[]).push(t);c&&c.length>0&&o.issues.push({code:"unrecognized_keys",input:n,inst:t,keys:c,continue:!0})}else{let c;for(let u of(o.value=a?a.alloc(t,o,{},i):{},Reflect.ownKeys(n))){if("__proto__"===u||!Object.prototype.propertyIsEnumerable.call(n,u))continue;let a=r.keyType._zod.run({value:u,issues:[]},i);if(a instanceof Promise)throw Error("Async schemas not supported in object keys currently");if("string"==typeof u&&tw.test(u)&&a.issues.length){let t=r.keyType._zod.run({value:Number(u),issues:[]},i);if(t instanceof Promise)throw Error("Async schemas not supported in object keys currently");0===t.issues.length&&(a=t)}if(a.issues.length){"loose"===r.mode?o.value[u]=n[u]:l?(c=c??[]).push(u):o.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(t=>ez(t,i,e1())),input:u,path:[u],inst:t});continue}let d=a.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&&o.issues.push(...eN(u,t.issues)),o.value[d]=t.value})):(p.issues.length&&o.issues.push(...eN(u,p.issues)),o.value[d]=p.value)}c&&c.length>0&&o.issues.push({code:"unrecognized_keys",input:n,inst:t,keys:c,continue:!0})}return s.length?Promise.all(s).then(()=>o):o}}),rU=eX("$ZodEnum",(t,r)=>{tW.init(t,r);let a=ei(r.entries),o=new Set(a);t._zod.values=o,eW(t,"pattern",t=>{let r=ei(t.def.entries).filter(t=>eE.has(typeof t));return new RegExp(r.length?`^(${r.map(t=>eP(t.toString())).join("|")})$`:"^[^\\s\\S]$")}),t._zod.parse=(r,i)=>{let n=r.value;return o.has(n)||r.issues.push({code:"invalid_value",values:a,input:n,inst:t}),r}}),rH=eX("$ZodLiteral",(t,r)=>{tW.init(t,r);let a=new Set(r.values);t._zod.values=a,eW(t,"pattern",t=>{let r=t.def.values;return new RegExp(r.length?`^(${r.map(t=>"string"==typeof t?eP(t):t?eP(t.toString()):String(t)).join("|")})$`:"^[^\\s\\S]$")}),t._zod.parse=(o,i)=>{let n=o.value;return a.has(n)||o.issues.push({code:"invalid_value",values:r.values,input:n,inst:t}),o}}),rV=eX("$ZodTransform",(t,r)=>{tW.init(t,r),t._zod.optin="optional",e0.memoizer?.guard(t),t._zod.parse=(a,o)=>{if("backward"===o.direction)throw new eQ(t.constructor.name);let i=r.transform(a.value,a);if(o.async)return(i instanceof Promise?i:Promise.resolve(i)).then(t=>(a.value=t,a));if(i instanceof Promise)throw new eY;return a.value=i,a}});function rK(t,r){return t.value=r.issues.length?void 0:r.value,t}let rF=eX("$ZodOptional",(t,r)=>{tW.init(t,r),eW(t,"optin",t=>"defaulted"===t.def.innerType._zod.optin?"defaulted":"optional"),t._zod.optout="optional",eW(t,"values",t=>{let r=t.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),eW(t,"pattern",t=>{let r=t.def.innerType._zod.pattern;return r?RegExp(`^(${eu(r.source)})?$`):void 0}),t._zod.parse=(t,a)=>{if(void 0===t.value){if("defaulted"!==r.innerType._zod.optin)return t;let o=r.innerType._zod.run({value:t.value,issues:[]},a);return o instanceof Promise?o.then(r=>rK(t,r)):rK(t,o)}return r.innerType._zod.run(t,a)}}),rJ=eX("$ZodExactOptional",(t,r)=>{rF.init(t,r),eW(t,"values",t=>t.def.innerType._zod.values),eW(t,"pattern",t=>t.def.innerType._zod.pattern),t._zod.parse=(t,a)=>r.innerType._zod.run(t,a)}),rW=eX("$ZodNullable",(t,r)=>{tW.init(t,r),eW(t,"optin",t=>t.def.innerType._zod.optin),eW(t,"optout",t=>t.def.innerType._zod.optout),eW(t,"pattern",t=>{let r=t.def.innerType._zod.pattern;return r?RegExp(`^(${eu(r.source)}|null)$`):void 0}),eW(t,"values",t=>t.def.innerType._zod.values?new Set([...t.def.innerType._zod.values,null]):void 0),t._zod.parse=(t,a)=>null===t.value?t:r.innerType._zod.run(t,a)}),rB=eX("$ZodDefault",(t,r)=>{tW.init(t,r),t._zod.optin="defaulted",eW(t,"values",t=>t.def.innerType._zod.values),t._zod.parse=(t,a)=>{if("backward"===a.direction)return r.innerType._zod.run(t,a);if(void 0===t.value)return t.value=r.defaultValue,t;let o=r.innerType._zod.run(t,a);return o instanceof Promise?o.then(t=>rG(t,r)):rG(o,r)}});function rG(t,r){return void 0===t.value&&(t.value=r.defaultValue),t}let rZ=eX("$ZodPrefault",(t,r)=>{tW.init(t,r),t._zod.optin="defaulted",eW(t,"values",t=>t.def.innerType._zod.values),t._zod.parse=(t,a)=>("backward"===a.direction||void 0===t.value&&(t.value=r.defaultValue),r.innerType._zod.run(t,a))}),rX=eX("$ZodNonOptional",(t,r)=>{tW.init(t,r),eW(t,"values",t=>{let r=t.def.innerType._zod.values;return r?new Set([...r].filter(t=>void 0!==t)):void 0}),t._zod.parse=(a,o)=>{let i=r.innerType._zod.run(a,o);return i instanceof Promise?i.then(r=>rY(r,t)):rY(i,t)}});function rY(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,a,o){return r.issues.length?t.value=a.catchValue({...r,value:t.value,error:{issues:r.issues.map(t=>ez(t,o,e1()))},input:t.value}):(t.value=r.value,r.memo&&(t.memo=!0)),t}let r0=eX("$ZodCatch",(t,r)=>{tW.init(t,r),eW(t,"optin",t=>"defaulted"===t.def.innerType._zod.optin?"defaulted":"optional"),eW(t,"optout",t=>t.def.innerType._zod.optout),eW(t,"values",t=>t.def.innerType._zod.values),t._zod.parse=(t,a)=>{if("backward"===a.direction)return r.innerType._zod.run(t,a);let o=r.innerType._zod.run({value:t.value,issues:[]},a);return o instanceof Promise?o.then(o=>rQ(t,o,r,a)):rQ(t,o,r,a)}}),r1=eX("$ZodPipe",(t,r)=>{tW.init(t,r),eW(t,"values",t=>t.def.in._zod.values),eW(t,"optin",t=>t.def.in._zod.optin),eW(t,"optout",t=>t.def.out._zod.optout),eW(t,"propValues",t=>t.def.in._zod.propValues),t._zod.parse=(t,a)=>{if("backward"===a.direction){let o=r.out._zod.run(t,a);return o instanceof Promise?o.then(t=>r2(t,r.in,a)):r2(o,r.in,a)}let o=r.in._zod.run(t,a);return o instanceof Promise?o.then(t=>r2(t,r.out,a)):r2(o,r.out,a)}});function r2(t,r,a){return t.issues.some(t=>"unrecognized_keys"!==t.code)?(t.aborted=!0,t):r._zod.run({value:t.value,issues:t.issues},a)}let r9=eX("$ZodPreprocess",(t,r)=>{r1.init(t,r)}),r4=eX("$ZodReadonly",(t,r)=>{tW.init(t,r),eW(t,"propValues",t=>t.def.innerType._zod.propValues),eW(t,"values",t=>t.def.innerType._zod.values),eW(t,"optin",t=>t.def.innerType?._zod?.optin),eW(t,"optout",t=>t.def.innerType?._zod?.optout),t._zod.parse=(t,a)=>{if("backward"===a.direction)return r.innerType._zod.run(t,a);let o=r.innerType._zod.run(t,a);return o instanceof Promise?o.then(r5):r5(o)}});function r5(t){return t.memo||(t.value=Object.freeze(t.value)),t}let r6=eX("$ZodLazy",(t,r)=>{var a;let o;tW.init(t,r),a=t._zod,Object.defineProperty(a,"innerType",{get(){if(o!==ed)return void 0===o&&(o=ed,o=(()=>(r._cachedInner||(r._cachedInner=r.getter()),r._cachedInner))()),o},set(t){Object.defineProperty(a,"innerType",{value:t})},configurable:!0}),eW(t,"pattern",t=>t.innerType?._zod?.pattern),eW(t,"propValues",t=>t.innerType?._zod?.propValues),eW(t,"optin",t=>t.innerType?._zod?.optin??void 0),eW(t,"optout",t=>t.innerType?._zod?.optout??void 0),t._zod.parse=(r,a)=>t._zod.innerType._zod.run(r,a)}),r3=eX("$ZodCustom",(t,r)=>{tk.init(t,r),tW.init(t,r),t._zod.parse=(t,r)=>t,t._zod.check=a=>{let o=a.value,i=r.fn(o);if(i instanceof Promise)return i.then(r=>r8(r,a,o,t));r8(i,a,o,t)}});function r8(t,r,a,o){if(!t){let t={code:"custom",input:a,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(t.params=o._zod.def.params),r.issues.push(eH(t))}}(O=globalThis).__zod_globalRegistry??(O.__zod_globalRegistry=new class t{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let a=r[0];return this._map.set(t,a),a&&"object"==typeof a&&"id"in a&&this._idmap.set(a.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&"object"==typeof r&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let a={...this.get(r)??{}};delete a.id;let o={...a,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}});let r7=globalThis.__zod_globalRegistry;function ae(t){return t.checks&&(t.checks=[...t.checks]),t}function at(t,r){return new t({type:"string",format:"email",check:"string_format",abort:!1,...ek(r)})}function ar(t,r){return new t({type:"string",format:"url",check:"string_format",abort:!1,...ek(r)})}function aa(t,r){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ek(r)})}function ao(t,r){return new t({type:"string",format:"date",check:"string_format",...ek(r)})}function ai(t,r){return new tO({check:"less_than",...ek(r),value:t,inclusive:!1})}function an(t,r){return new tO({check:"less_than",...ek(r),value:t,inclusive:!0})}function as(t,r){return new tj({check:"greater_than",...ek(r),value:t,inclusive:!1})}function al(t,r){return new tj({check:"greater_than",...ek(r),value:t,inclusive:!0})}function ac(t,r){return new tC({check:"multiple_of",...ek(r),value:t})}function au(t,r){return new tI({check:"max_length",...ek(r),maximum:t})}function ad(t,r){return new tN({check:"min_length",...ek(r),minimum:t})}function ap(t,r){return new tM({check:"length_equals",...ek(r),length:t})}function ah(t){return new tK({check:"overwrite",tx:t})}function af(t,...r){for(let a of r)for(let r of Reflect.ownKeys(a))Object.prototype.propertyIsEnumerable.call(a,r)&&ep(t,r,a[r]);return t}function am(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??r7,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 ay(t,r,a,o,i){let n="function"==typeof r.unrepresentable?r.unrepresentable({zodSchema:t,path:o.path,message:i}):r.unrepresentable;if("any"===n)return!1;if(void 0===n||"throw"===n)throw Error(i);return Object.assign(a,n),!0}function ag(t,r,a={path:[],schemaPath:[]}){var o;let i=t._zod.def,n=r.seen.get(t);if(n)return n.count++,a.schemaPath.includes(t)&&(n.cycle=a.path),n.schema;let s={schema:{},count:1,cycle:void 0,path:a.path};r.seen.set(t,s),r.sharedDefsExtractedFor=void 0,r.sharedEmitDoneFor=void 0;let l=t._zod.toJSONSchema?.();if(l)s.schema=l;else{let o={...a,schemaPath:[...a.schemaPath,t],path:a.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(r,s.schema,o);else{let a=s.schema,n=r.processors[i.type];if(!n)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);n(t,r,a,o)}let n=t._zod.parent;n&&(s.ref||(s.ref=n),ag(n,r,o),r.seen.get(n).isParent=!0)}let c=r.metadataRegistry.get(t);return c&&af(s.schema,c),"input"===r.io&&function t(r,a){let o=a??{seen:new Set};if(o.seen.has(r))return!1;o.seen.add(r);let i=r._zod.def;if("transform"===i.type)return!0;if("array"===i.type)return t(i.element,o);if("set"===i.type)return t(i.valueType,o);if("lazy"===i.type)return t(i.getter(),o);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,o);if("intersection"===i.type)return t(i.left,o)||t(i.right,o);if("record"===i.type||"map"===i.type)return t(i.keyType,o)||t(i.valueType,o);if("pipe"===i.type)return!!r._zod.traits.has("$ZodCodec")||t(i.in,o)||t(i.out,o);if("object"===i.type){for(let r in i.shape)if(t(i.shape[r],o))return!0;return!1}if("union"===i.type){for(let r of i.options)if(t(r,o))return!0;return!1}if("tuple"===i.type){for(let r of i.items)if(t(r,o))return!0;if(i.rest&&t(i.rest,o))return!0}return!1}(t)&&(delete s.schema.examples,delete s.schema.default),"input"===r.io&&"_prefault"in s.schema&&((o=s.schema).default??(o.default=s.schema._prefault)),delete s.schema._prefault,r.seen.get(t).schema}function av(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function ab(t,r){let a=t.seen.get(r);if(!a)throw Error("Unprocessed schema. This is a bug in Zod.");if(t.external&&t.sharedDefsExtractedFor===t.external)return;let o=new Map;for(let r of t.seen.entries()){let a=t.metadataRegistry.get(r[0])?.id;if(a){let t=o.get(a);if(t&&t!==r[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,r[0])}}let i=r=>{if(r[1].schema.$ref)return;let o=r[1],{ref:i,defId:n}=(r=>{let o="draft-2020-12"===t.target?"$defs":"definitions";if(t.external){let a=t.external.registry.get(r[0])?.id,i=t.external.uri??(t=>t);if(a)return{ref:i(a)};let n=r[1].defId??r[1].schema.id??`schema${t.counter++}`;return r[1].defId=n,{defId:n,ref:`${i("__shared")}#/${o}/${av(n)}`}}let i=`#/${o}/`;if(r[1]===a&&!r[1].schema.id)return{ref:"#"};let n=r[1].schema.id??`__schema${t.counter++}`;return{defId:n,ref:i+av(n)}})(r);o.def={...o.schema},n&&(o.defId=n);let s=o.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 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 o_=new Set(["type","properties","required","additionalProperties"]),oS=["oneOf","anyOf"];function o$(t){let r=t.additionalProperties;return void 0===r||!1===r||"object"!=typeof r||null===r?null:Object.keys(r).length?r:null}function ow(t){let r=[];for(let o of t){if("object"!=typeof o||"object"!==o.type)return null;for(let t in o)if(!o_.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]??o$(o);null!=r&&(t.some(t=>JSON.stringify(t)===JSON.stringify(r))||t.push(r))}ep(o,a,1===t.length?t[0]:ow(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=o$(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 oE(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,s={...i},n=o.ref;if(o.ref=null,n){a(n);let o=t.seen.get(n),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)):of(i,l),of(i,s),r._zod.parent===n)for(let t in i)"$ref"!==t&&"allOf"!==t&&(t in s||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!==n){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 o_)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 s=r.filter(r=>r!==t),n=t[i].map(t=>ow([...s,t]));if(n.some(t=>!t))return;a={[i]:n}}else a=ow(r);a&&(delete t.allOf,of(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)}of(i,o.defId?o.schema:o.def??o.schema);let s=t.metadataRegistry.get(r)?.id;void 0!==s&&i.id===s&&delete i.id;let n=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,ep(n,t.defId,t.def))}t.external&&(t.sharedEmitDoneFor=t.external),t.external||Object.keys(n).length>0&&("draft-2020-12"===t.target?i.$defs=n:i.definitions=n);try{let o=JSON.parse(JSON.stringify(i));return Object.defineProperty(o,"~standard",{value:{...r["~standard"],jsonSchema:{input:oR(r,"input",t.processors),output:oR(r,"output",t.processors)}},enumerable:!1,writable:!1}),o}catch(t){throw Error("Error converting schema to JSON.")}}let oR=(t,r,o={})=>a=>{let{libraryOptions:i,target:s}=a??{},n=om({...i??{},target:s,io:r,processors:o});return og(t,n),ob(n,t),oE(n,t)},oP=(t,r,o)=>{(void 0===t[r]||o>t[r])&&(t[r]=o)},ok=(t,r,o)=>{(void 0===t[r]||o<t[r])&&(t[r]=o)},oO=(t,r)=>{oP(t,"minimum",r),ok(t,"maximum",r)},oT=(t,r)=>{t.multipleOf??(t.multipleOf=[]),t.multipleOf.includes(r)||t.multipleOf.push(r)},ox=(t,r)=>{t.patterns??(t.patterns=new Set),t.patterns.add(r)},oj=(t,r)=>{t.mime=t.mime?t.mime.filter(t=>r.includes(t)):[...r]},oC=(t,r)=>{t.format=r,r.includes("int")&&(t.isInt=!0)},oN=(t,r)=>oP(t,"minimum",r.minimum),oI=(t,r)=>ok(t,"maximum",r.maximum),oA=t=>(r,o)=>{oC(r,o.format);let[a,i]=t[o.format];oP(r,"minimum",a),ok(r,"maximum",i)},oM={greater_than:(t,r)=>oP(t,r.inclusive?"minimum":"exclusiveMinimum",r.value),less_than:(t,r)=>ok(t,r.inclusive?"maximum":"exclusiveMaximum",r.value),multiple_of:(t,r)=>oT(t,r.value),number_format:oA(eT),bigint_format:oA(ex),min_length:oN,max_length:oI,length_equals:(t,r)=>oO(t,r.length),min_size:oN,max_size:oI,size_equals:(t,r)=>oO(t,r.size),string_format:(t,r)=>{oC(t,r.format),r.pattern&&ox(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)=>oj(t,r.mime)};function oq(t){let r={},o=t._zod.def;for(let a of t._zod.traits.has("$ZodCheck")?[t,...o.checks??[]]:o.checks??[])oM[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&&ok(r,"maximum",a.maximum),void 0!==a.exclusiveMaximum&&ok(r,"exclusiveMaximum",a.exclusiveMaximum),void 0!==a.multipleOf&&oT(r,a.multipleOf),void 0!==a.format&&(r.format??(r.format=a.format),a.format.includes("int")&&(r.isInt=!0)),a.mime&&oj(r,a.mime),a.patterns??[]))ox(r,t);return r}let oz={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},oL=new Map([[rf,/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/],[ry,/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/]]),oD=t=>oL.get(t)??t,oU=(t,r,o,a)=>{o.type="string";let{minimum:i,maximum:s,format:n,patterns:l,contentEncoding:c,laxFormat:u}=oq(t);if("number"==typeof i&&(o.minLength=i),"number"==typeof s&&(o.maxLength=s),n&&(o.format=oz[n]??n,""===o.format&&delete o.format,("time"===n||u)&&delete o.format),c&&(o.contentEncoding=c),l&&l.size>0){let t=[...l].map(oD);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}))])}},oV=(t,r,o,a)=>{let{minimum:i,maximum:s,multipleOf:n,exclusiveMaximum:l,exclusiveMinimum:c,isInt:u}=oq(t);o.type=u?"integer":"number";let d="number"==typeof c&&c>=(i??-1/0),p="number"==typeof l&&l<=(s??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 s&&(o.maximum=s),n){let i=new Set;for(let s of n)Number.isFinite(s)&&0!==s?i.add(Math.abs(s)):oy(t,r,o,a,`A multipleOf divisor of ${s} cannot be represented in JSON Schema`);let[s,...l]=i;void 0!==s&&(o.multipleOf=s),l.length&&(o.allOf=[...o.allOf??[],...l.map(t=>({multipleOf:t}))])}},oF=(t,r,o,a)=>{o.type="boolean"},oH=(t,r,o,a)=>{"openapi-3.0"===r.target?(o.type="string",o.nullable=!0,o.enum=[null]):o.type="null"},oK=(t,r,o,a)=>{o.not={}},oJ=(t,r,o,a)=>{},oB=(t,r,o,a)=>{},oG=(t,r,o,a)=>{let i=ei(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},oZ=(t,r,o,a)=>{let i=t._zod.def;if(0===i.values.length){o.not={};return}let s=[];for(let n of i.values)if(void 0===n){if(oy(t,r,o,a,"Literal `undefined` cannot be represented in JSON Schema"))return}else if("bigint"==typeof n){if(oy(t,r,o,a,"BigInt literals cannot be represented in JSON Schema"))return;s.push(Number(n))}else s.push(n);if(0===s.length);else if(1===s.length){let t=s[0];o.type=null===t?"null":typeof t,"draft-04"===r.target||"openapi-3.0"===r.target?o.enum=[t]:o.const=t}else s.every(t=>"number"==typeof t)&&(o.type="number"),s.every(t=>"string"==typeof t)&&(o.type="string"),s.every(t=>"boolean"==typeof t)&&(o.type="boolean"),s.every(t=>null===t)&&(o.type="null"),o.enum=s},oW=(t,r,o,a)=>{oy(t,r,o,a,"Custom types cannot be represented in JSON Schema")},oX=(t,r,o,a)=>{oy(t,r,o,a,"Transforms cannot be represented in JSON Schema")},oY=(t,r,o,a)=>{let i=t._zod.def,{minimum:s,maximum:n}=oq(t);"number"==typeof s&&(o.minItems=s),"number"==typeof n&&(o.maxItems=n),o.type="array",o.items=og(i.element,r,{...a,path:[...a.path,"items"]})};function oQ(t){let r=t._zod.def;return"pipe"===r.type&&r.in._zod.traits.has("$ZodTransform")?oQ(r.out):"catch"===r.type?oQ(r.innerType):t._zod.optin}let o0=(t,r,o,a)=>{let i=t._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&oy(t,r,o,a,"Symbol keys cannot be represented in JSON Schema"))return;for(let t in o.type="object",o.properties={},s)ep(o.properties,t,og(s[t],r,{...a,path:[...a.path,"properties",t]}));let n=[];for(let t of Object.keys(s)){let o=i.shape[t];("input"===r.io?void 0===oQ(o):void 0===o._zod.optout)&&n.push(t)}n.length>0&&(o.required=n),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=og(i.catchall,r,{...a,path:[...a.path,"additionalProperties"]})):"output"===r.io&&(o.additionalProperties=!1)},o1=(t,r,o,a)=>{let i=t._zod.def,s=!1===i.inclusive,n=i.options.map((t,o)=>og(t,r,{...a,path:[...a.path,s?"oneOf":"anyOf",o]}));s?o.oneOf=n:o.anyOf=n},o2=(t,r,o,a)=>{let i=t._zod.def,s=og(i.left,r,{...a,path:[...a.path,"allOf",0]}),n=og(i.right,r,{...a,path:[...a.path,"allOf",1]}),l=t=>"allOf"in t&&1===Object.keys(t).length,c=[...l(s)?s.allOf:[s],...l(n)?n.allOf:[n]];o.allOf=c,r.intersections.push(c)},o9=new WeakMap,o4=(t,r,o,a)=>{let i=t._zod.def;o.type="object";let s=i.keyType,n=oq(s).patterns;if("loose"===i.mode&&n&&n.size>0){let t=og(i.valueType,r,{...a,path:[...a.path,"patternProperties","*"]});for(let r of(o.patternProperties={},n))ep(o.patternProperties,oD(r).source,t)}else{if("draft-07"===r.target||"draft-2020-12"===r.target){o.propertyNames=og(i.keyType,r,{...a,path:[...a.path,"propertyNames"]});let s=o9.get(r);s||(s=[],o9.set(r,s),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 o9.get(t)??[]){let i=t.seen.get(a),s=(i?.def??i?.schema)?.propertyNames;if(!s||!0===s||o.has(s))continue;let n=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 s=t(r,i,a);return s===i?o:s}for(let i of["anyOf","oneOf"]){let s=o[i];if(!Array.isArray(s))continue;let n=s.map(o=>t(r,o,a));n.some((t,r)=>t!==s[r])&&(o={...o,[i]:n})}let i=Array.isArray(o.type)?o.type:[o.type],s=!i.includes("string")&&i.some(t=>"number"===t||"integer"===t),n=o.enum??(void 0!==o.const?[o.const]:void 0);if(!s&&!n?.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)),s&&(m.type="string",n||(m.pattern=(i.includes("number")?t$:tS).source)),m}(r,s,new Set);n!==s&&o.set(s,n)}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))),s.push(t)}o.additionalProperties=og(i.valueType,r,{...a,path:[...a.path,"additionalProperties"]})}let l=s._zod.values,c="input"===r.io&&void 0!==oQ(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))}},o5=(t,r,o,a)=>{let i=t._zod.def,s=og(i.innerType,r,a),n=r.seen.get(t);"openapi-3.0"===r.target?(n.ref=i.innerType,o.nullable=!0):o.anyOf=[s,{type:"null"}]},o3=(t,r,o,a)=>{let i=t._zod.def;og(i.innerType,r,a),r.seen.get(t).ref=i.innerType},o6=Symbol();function o8(t,r,o,a,i){let s=!1,n=JSON.stringify(t,(t,r)=>"bigint"!=typeof r?r:(s=!0,null));return s?(oy(r,o,a,i,"BigInt defaults cannot be represented in JSON Schema"),o6):JSON.parse(n)}let o7=(t,r,o,a)=>{let i=t._zod.def;og(i.innerType,r,a),r.seen.get(t).ref=i.innerType;let s=o8(i.defaultValue,t,r,o,a);s!==o6&&(o.default=s)},ae=(t,r,o,a)=>{let i=t._zod.def;if(og(i.innerType,r,a),r.seen.get(t).ref=i.innerType,"input"!==r.io)return;let s=o8(i.defaultValue,t,r,o,a);s!==o6&&(o._prefault=s)},at=(t,r,o,a)=>{let i,s=t._zod.def;og(s.innerType,r,a),r.seen.get(t).ref=s.innerType;try{i=s.catchValue(void 0)}catch{oy(t,r,o,a,"Dynamic catch values are not supported in JSON Schema");return}o.default=i},ar=(t,r,o,a)=>{let i=t._zod.def,s=i.in._zod.traits.has("$ZodTransform"),n="input"===r.io?s?i.out:i.in:i.out;og(n,r,a),r.seen.get(t).ref=n},ao=(t,r,o,a)=>{let i=t._zod.def;og(i.innerType,r,a),r.seen.get(t).ref=i.innerType,o.readOnly=!0},aa=(t,r,o,a)=>{let i=t._zod.def;og(i.innerType,r,a),r.seen.get(t).ref=i.innerType},ai=(t,r,o,a)=>{let i=t._zod.innerType;og(i,r,a),r.seen.get(t).ref=i},as={string:oU,number:oV,boolean:oF,bigint:(t,r,o,a)=>{oy(t,r,o,a,"BigInt cannot be represented in JSON Schema")},symbol:(t,r,o,a)=>{oy(t,r,o,a,"Symbols cannot be represented in JSON Schema")},null:oH,undefined:(t,r,o,a)=>{oy(t,r,o,a,"Undefined cannot be represented in JSON Schema")},void:(t,r,o,a)=>{oy(t,r,o,a,"Void cannot be represented in JSON Schema")},never:oK,any:oJ,unknown:oB,date:(t,r,o,a)=>{oy(t,r,o,a,"Date cannot be represented in JSON Schema")},enum:oG,literal:oZ,nan:(t,r,o,a)=>{oy(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:s,mime:n}=oq(t);void 0!==i&&(o.minLength=i),void 0!==s&&(o.maxLength=s),n&&(0===n.length?o.not={}:1===n.length?o.contentMediaType=n[0]:o.anyOf=n.map(t=>({contentMediaType:t})))},success:(t,r,o,a)=>{o.type="boolean"},custom:oW,function:(t,r,o,a)=>{oy(t,r,o,a,"Function types cannot be represented in JSON Schema")},transform:oX,map:(t,r,o,a)=>{oy(t,r,o,a,"Map cannot be represented in JSON Schema")},set:(t,r,o,a)=>{oy(t,r,o,a,"Set cannot be represented in JSON Schema")},array:oY,object:o0,union:o1,intersection:o2,tuple:(t,r,o,a)=>{let i=t._zod.def;o.type="array";let s="draft-2020-12"===r.target?"prefixItems":"items",n="draft-2020-12"===r.target||"openapi-3.0"===r.target?"items":"additionalItems",l=i.items.map((t,o)=>og(t,r,{...a,path:[...a.path,s,o]})),c=i.rest?og(i.rest,r,{...a,path:[...a.path,n,..."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!==oQ(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}=oq(t);"number"==typeof h&&(o.minItems=h),"number"==typeof f&&(o.maxItems=f)},record:o4,nullable:o5,nonoptional:o3,default:o7,prefault:ae,catch:at,pipe:ar,readonly:ao,promise:(t,r,o,a)=>{let i=t._zod.def;og(i.innerType,r,a),r.seen.get(t).ref=i.innerType},optional:aa,lazy:ai};function an(t,r){if("_idmap"in t){let o=om({...r,processors:as}),a={};for(let r of t._idmap.entries()){let[t,a]=r;og(a,o)}let i={};for(let s of(o.external={registry:t,uri:r?.uri,defs:a},t._idmap.entries())){let[t,r]=s;ob(o,r),ep(i,t,oE(o,r))}return Object.keys(a).length>0&&(i.__shared={["draft-2020-12"===o.target?"$defs":"definitions"]:a}),{schemas:i}}let o=om({...r,processors:as});return og(t,o),ob(o,t),oE(o,t)}let al={get:function(){let t=this._zod;return t.message??(t.message=JSON.stringify(t.def,en,2)),t.message},set:function(t){this._zod.message=t},enumerable:!0,configurable:!0},ac={value:void 0,enumerable:!1},au=new WeakSet([Object.prototype,Error.prototype]),ad=(t,r)=>{t.name="$ZodError",ac.value=r,Object.defineProperty(t,"issues",ac),ac.value=void 0,Object.defineProperty(t,"message",al);let o=Object.getPrototypeOf(t);au.has(o)||(au.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})}}))},ap=eX("$ZodError",ad);function ah(t,r){return{callee:r?.callee??t,Err:r?.Err}}eX("$ZodError",ad,void 0,{Parent:Error});let af=t=>{let r=(o,a,i,s)=>{let n=i?{...i,async:!1}:{async:!1},l=o._zod.run({value:a,issues:[]},n);if(l instanceof Promise)throw new eY;if(l.issues.length){let o=new(s?.Err??t)(l.issues.map(t=>ez(t,n,e1())));throw eb(o,s?.callee??r),o}return l.value};return r},am=t=>{let r=async(o,a,i,s)=>{let n=i?{...i,async:!0}:{async:!0},l=o._zod.run({value:a,issues:[]},n);if(l instanceof Promise&&(l=await l),l.issues.length){let o=new(s?.Err??t)(l.issues.map(t=>ez(t,n,e1())));throw eb(o,s?.callee??r),o}return l.value};return r},ay=t=>(r,o,a)=>{let i=a?{...a,async:!1}:{async:!1},s=r._zod.run({value:o,issues:[]},i);if(s instanceof Promise)throw new eY;return s.issues.length?ag(t,s.issues,i):{success:!0,data:s.value}};function ag(t,r,o){let a;return{success:!1,get error(){return a||(a=new t(r.map(t=>ez(t,o,e1()))),r=void 0,o=void 0),a},set error(e){a=e,r=void 0,o=void 0}}}let av=t=>async(r,o,a)=>{let i=a?{...a,async:!0}:{async:!0},s=r._zod.run({value:o,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?ag(t,s.issues,i):{success:!0,data:s.value}},ab=Symbol.for("zod.compile.invalid"),a_=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},a$=new WeakSet([Object.prototype,Error.prototype]);function aw(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 aE=eX("ZodError",(t,r)=>{ap.init(t,r),t.name="ZodError";let o=Object.getPrototypeOf(t);a$.has(o)||(a$.add(o),aw(o,"format",t=>r=>(function(t,r=t=>t.message){let o={_errors:[]},a=(t,i=[])=>{for(let s of t.issues)if("invalid_union"===s.code&&s.errors.length)s.errors.map(t=>a({issues:t},[...i,...s.path]));else if("invalid_key"===s.code)a({issues:s.issues},[...i,...s.path]);else if("invalid_element"===s.code)a({issues:s.issues},[...i,...s.path]);else{let t=[...i,...s.path];if(0===t.length)o._errors.push(r(s));else{let a=o,i=0;for(;i<t.length;){let o=t[i],n=i===t.length-1;if("_errors"===o){n&&a._errors.push(r(s)),i++;continue}Object.prototype.hasOwnProperty.call(a,o)||Object.defineProperty(a,o,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let l=a[o];n&&l._errors.push(r(s)),a=l,i++}}}};return a(t),o})(t,r)),aw(o,"flatten",t=>r=>(function(t,r=t=>t.message){let o={},a=[];for(let n of t.issues)if(n.path.length>0){var i,s;(i=n.path[0],s=()=>[],!Object.prototype.hasOwnProperty.call(o,i)&&("__proto__"===i?Object.defineProperty(o,i,{value:s(),writable:!0,enumerable:!0,configurable:!0}):o[i]=s()),o[i]).push(r(n))}else a.push(r(n));return{formErrors:a,fieldErrors:o}})(t,r)),aw(o,"addIssue",t=>r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,en,2)}),aw(o,"addIssues",t=>r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,en,2)}),Object.defineProperty(o,"isEmpty",{configurable:!0,enumerable:!1,get(){return 0===this.issues.length}}))},void 0,{Parent:Error}),aR=af(aE),aP=am(aE),ak=ay(aE),aO=av(aE),aT=(h=af(aE),f=(t,r,o,a)=>h(t,r,o?{...o,direction:"backward"}:{direction:"backward"},ah(f,a))),ax=(m=af(aE),y=(t,r,o,a)=>m(t,r,o,ah(y,a))),aj=(g=am(aE),v=async(t,r,o,a)=>{let i=o?{...o,direction:"backward"}:{direction:"backward"};return await g(t,r,i,ah(v,a))}),aC=(b=am(aE),_=async(t,r,o,a)=>await b(t,r,o,ah(_,a))),aN=(t,r,o)=>{let a=o?{...o,direction:"backward"}:{direction:"backward"};return ay(aE)(t,r,a)},aI=(t,r,o)=>ay(aE)(t,r,o),aA=async(t,r,o)=>{let a=o?{...o,direction:"backward"}:{direction:"backward"};return av(aE)(t,r,a)},aM=async(t,r,o)=>av(aE)(t,r,o);function aq(){e0.memoizer||e1({memoizer:e7})}let az=eX("ZodType",(t,r)=>(e0.localeError||e1({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 ${eO(o.values[0])}`;return`Invalid option: expected one of ${es(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":""}: ${es(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"}}})()}),tB.init(t,r),t.def=r,t.type=r.type,t),{check(...t){let r=this.def;return this.clone(ev(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 eP(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 iW({type:"custom",check:"custom",fn:t,...ek(r)})}(t,r))},superRefine(t,r){return this.check(function(t,r){var o;let a,i;return o=r=>(r.addIssue=t=>{"string"==typeof t?r.issues.push(eV(t,r.value,a._zod.def)):(t.fatal&&(t.continue=!1),t.code??(t.code="custom"),"input"in t||(t.input=r.value),t.inst??(t.inst=a),t.continue??(t.continue=!a._zod.def.abort),r.issues.push(eV(t)))},t(r.value,r)),(i=new tk({check:"custom",...ek(r)}))._zod.check=o,a=i}(t,r))},overwrite(t){return this.check(oh(t))},optional(){return iM(this)},exactOptional(){var t;return t=this,new iq({type:"optional",innerType:t})},nullable(){return iL(this)},nullish(){return iM(iL(this))},nonoptional(t){var r;return r=this,new iV({type:"nonoptional",innerType:r,...ek(t)})},array(){return ig(this)},or(t){return i$([this,t])},and(t){return iP(this,t)},transform(t){return iK(this,iI(t))},default(t){var r,o;return r=this,o=t,new iD({type:"default",innerType:r,get defaultValue(){return"function"==typeof o?o():ew(o)}})},prefault(t){var r,o;return r=this,o=t,new iU({type:"prefault",innerType:r,get defaultValue(){return"function"==typeof o?o():ew(o)}})},catch(t){return function(t,r){let o;return new iF({type:"catch",innerType:t,catchValue:"function"==typeof r?r:((o=()=>r)["~constantCatch"]=!0,o)})}(this,t)},pipe(t){return iK(this,t)},readonly(){var t;return t=this,new iB({type:"readonly",innerType:t})},describe(t){let r=this.clone();return r7.add(r,{description:t}),r},meta(...t){if(0===t.length)return r7.get(this);let r=this.clone();return r7.add(r,t[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(t,...r){return 0===r.length?t(this):t(this,...r)},get"~standard"(){return eF(this,"~standard",{...tW(this),jsonSchema:{input:oR(this,"input"),output:oR(this,"output")}},!1)},set"~standard"(value){eF(this,"~standard",value)},parse:function t(r,o){return aR(this,r,o,{callee:t})},parseAsync:async function t(r,o){return await aP(this,r,o,{callee:t})},safeParse(t,r){return ak(this,t,r)},async safeParseAsync(t,r){return aO(this,t,r)},get spa(){return this?.safeParseAsync},set spa(value){eF(this,"spa",value)},validate(t,r){let o=this._zod.bag.validator;if(void 0!==o){if(o(t)!==ab)return!0;if(!0===o.definite&&void 0===r)return!1}return function(t,r,o){let a,i=o?{...o,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},s=t._zod.bag.fallbackRun;if(s?(i[a_]=!0,a=s({value:r,issues:[]},i)):a=t._zod.run({value:r,issues:[]},i),a instanceof Promise)throw new eY;return 0===a.issues.length}(this,t,r)},validateAsync(t,r){return aS(this,t,r)},encode:function t(r,o){return aT(this,r,o,{callee:t})},decode:function t(r,o){return ax(this,r,o,{callee:t})},encodeAsync:async function t(r,o){return await aj(this,r,o,{callee:t})},decodeAsync:async function t(r,o){return await aC(this,r,o,{callee:t})},safeEncode(t,r){return aN(this,t,r)},safeDecode(t,r){return aI(this,t,r)},async safeEncodeAsync(t,r){return aA(this,t,r)},async safeDecodeAsync(t,r){return aM(this,t,r)},toJSONSchema(t){return((t,r={})=>o=>{let a=om({...o,processors:r});return og(t,a),ob(a,t),oE(a,t)})(this,{})(t)},get description(){return r7.get(this)?.description},get _def(){return this._zod.def}}),aL=eX("_ZodString",(t,r)=>{tX.init(t,r),az.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oU(t,r,o,a)},eH({format:t=>oq(t).format??null,minLength:t=>oq(t).minimum??null,maxLength:t=>oq(t).maximum??null},{regex(...t){return this.check(function(t,r){return new tz({check:"string_format",format:"regex",...ek(r),pattern:t})}(...t))},includes(...t){return this.check(function(t,r){return new tU({check:"string_format",format:"includes",...ek(r),includes:t})}(...t))},startsWith(...t){return this.check(function(t,r){return new tV({check:"string_format",format:"starts_with",...ek(r),prefix:t})}(...t))},endsWith(...t){return this.check(function(t,r){return new tF({check:"string_format",format:"ends_with",...ek(r),suffix:t})}(...t))},min(...t){return this.check(od(...t))},max(...t){return this.check(ou(...t))},length(...t){return this.check(op(...t))},nonempty(...t){return this.check(od(1,...t))},lowercase(t){return this.check(new tL({check:"string_format",format:"lowercase",...ek(t)}))},uppercase(t){return this.check(new tD({check:"string_format",format:"uppercase",...ek(t)}))},trim(){return this.check(oh(t=>t.trim()))},normalize(...t){return this.check(function(t){return oh(r=>r.normalize(t))}(...t))},toLowerCase(){return this.check(oh(t=>t.toLowerCase()))},toUpperCase(){return this.check(oh(t=>t.toUpperCase()))},slugify(){return this.check(oh(t=>t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")))}})),aD=eX("ZodString",(t,r)=>{tX.init(t,r),aL.init(t,r)},{email(t){return this.check(ot(aB,t))},url(t){return this.check(or(aW,t))},jwt(t){return this.check(new it({type:"string",format:"jwt",check:"string_format",abort:!1,...ek(t)}))},emoji(t){return this.check(new aX({type:"string",format:"emoji",check:"string_format",abort:!1,...ek(t)}))},guid(t){return this.check(new aG({type:"string",format:"guid",check:"string_format",abort:!1,...ek(t)}))},uuid(t){return this.check(new aZ({type:"string",format:"uuid",check:"string_format",abort:!1,...ek(t)}))},uuidv4(t){return this.check(new aZ({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ek(t)}))},uuidv6(t){return this.check(new aZ({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ek(t)}))},uuidv7(t){return this.check(new aZ({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ek(t)}))},nanoid(t){return this.check(new aY({type:"string",format:"nanoid",check:"string_format",abort:!1,...ek(t)}))},cuid(t){return this.check(new aQ({type:"string",format:"cuid",check:"string_format",abort:!1,...ek(t)}))},cuid2(t){return this.check(new a0({type:"string",format:"cuid2",check:"string_format",abort:!1,...ek(t)}))},ulid(t){return this.check(new a1({type:"string",format:"ulid",check:"string_format",abort:!1,...ek(t)}))},base64(t){return this.check(new a8({type:"string",format:"base64",check:"string_format",abort:!1,...ek(t)}))},base64url(t){return this.check(new a7({type:"string",format:"base64url",check:"string_format",abort:!1,...ek(t)}))},xid(t){return this.check(new a2({type:"string",format:"xid",check:"string_format",abort:!1,...ek(t)}))},ksuid(t){return this.check(new a9({type:"string",format:"ksuid",check:"string_format",abort:!1,...ek(t)}))},ipv4(t){return this.check(new a4({type:"string",format:"ipv4",check:"string_format",abort:!1,...ek(t)}))},ipv6(t){return this.check(new a5({type:"string",format:"ipv6",check:"string_format",abort:!1,...ek(t)}))},cidrv4(t){return this.check(new a3({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ek(t)}))},cidrv6(t){return this.check(new a6({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ek(t)}))},e164(t){return this.check(new ie({type:"string",format:"e164",check:"string_format",abort:!1,...ek(t)}))},datetime(t){return this.check(oo(aF,t))},date(t){return this.check(oa(aH,t))},time(t){return this.check(new aK({type:"string",format:"time",check:"string_format",precision:null,...ek(t)}))},duration(t){return this.check(new aJ({type:"string",format:"duration",check:"string_format",...ek(t)}))}});function aU(t){return new aD(oe({type:"string",...ek(t)}))}let aV=eX("ZodStringFormat",(t,r)=>{tY.init(t,r),aL.init(t,r)}),aF=eX("ZodISODateTime",(t,r)=>{ro.init(t,r),aV.init(t,r)}),aH=eX("ZodISODate",(t,r)=>{ra.init(t,r),aV.init(t,r)}),aK=eX("ZodISOTime",(t,r)=>{ri.init(t,r),aV.init(t,r)}),aJ=eX("ZodISODuration",(t,r)=>{rs.init(t,r),aV.init(t,r)}),aB=eX("ZodEmail",(t,r)=>{t1.init(t,r),aV.init(t,r)}),aG=eX("ZodGUID",(t,r)=>{tQ.init(t,r),aV.init(t,r)}),aZ=eX("ZodUUID",(t,r)=>{t0.init(t,r),aV.init(t,r)}),aW=eX("ZodURL",(t,r)=>{t5.init(t,r),aV.init(t,r)}),aX=eX("ZodEmoji",(t,r)=>{t3.init(t,r),aV.init(t,r)}),aY=eX("ZodNanoID",(t,r)=>{t6.init(t,r),aV.init(t,r)}),aQ=eX("ZodCUID",(t,r)=>{t8.init(t,r),aV.init(t,r)}),a0=eX("ZodCUID2",(t,r)=>{t7.init(t,r),aV.init(t,r)}),a1=eX("ZodULID",(t,r)=>{re.init(t,r),aV.init(t,r)}),a2=eX("ZodXID",(t,r)=>{rt.init(t,r),aV.init(t,r)}),a9=eX("ZodKSUID",(t,r)=>{rr.init(t,r),aV.init(t,r)}),a4=eX("ZodIPv4",(t,r)=>{rn.init(t,r),aV.init(t,r)}),a5=eX("ZodIPv6",(t,r)=>{ru.init(t,r),aV.init(t,r)}),a3=eX("ZodCIDRv4",(t,r)=>{rd.init(t,r),aV.init(t,r)}),a6=eX("ZodCIDRv6",(t,r)=>{rp.init(t,r),aV.init(t,r)}),a8=eX("ZodBase64",(t,r)=>{rm.init(t,r),aV.init(t,r)}),a7=eX("ZodBase64URL",(t,r)=>{rg.init(t,r),aV.init(t,r)}),ie=eX("ZodE164",(t,r)=>{rv.init(t,r),aV.init(t,r)}),it=eX("ZodJWT",(t,r)=>{rb.init(t,r),aV.init(t,r)}),ir=eX("ZodNumber",(t,r)=>{r_.init(t,r),az.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oV(t,r,o,a),t.isFinite=!0},eH({minValue:t=>{let{minimum:r,exclusiveMinimum:o}=oq(t);return Math.max(r??-1/0,o??-1/0)},maxValue:t=>{let{maximum:r,exclusiveMaximum:o}=oq(t);return Math.min(r??1/0,o??1/0)},isInt:t=>{let{isInt:r,multipleOf:o}=oq(t);return!!r||!!o?.some(Number.isSafeInteger)},format:t=>oq(t).format??null},{gt(t,r){return this.check(on(t,r))},gte(t,r){return this.check(ol(t,r))},min(t,r){return this.check(ol(t,r))},lt(t,r){return this.check(oi(t,r))},lte(t,r){return this.check(os(t,r))},max(t,r){return this.check(os(t,r))},int(t){return this.check(ii(t))},safe(t){return this.check(ii(t))},positive(t){return this.check(on(0,t))},nonnegative(t){return this.check(ol(0,t))},negative(t){return this.check(oi(0,t))},nonpositive(t){return this.check(os(0,t))},multipleOf(t,r){return this.check(oc(t,r))},step(t,r){return this.check(oc(t,r))},finite(){return this}}));function io(t){return new ir(oe({type:"number",checks:[],...ek(t)}))}let ia=eX("ZodNumberFormat",(t,r)=>{rS.init(t,r),ir.init(t,r)});function ii(t){return new ia({type:"number",check:"number_format",abort:!1,format:"safeint",...ek(t)})}let is=eX("ZodBoolean",(t,r)=>{r$.init(t,r),az.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oF(t,r,o,a)});function il(t){return new is({type:"boolean",...ek(t)})}let ic=eX("ZodNull",(t,r)=>{rw.init(t,r),az.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oH(t,r,o,a)});function iu(t){return new ic({type:"null",...ek(t)})}let id=eX("ZodAny",(t,r)=>{rE.init(t,r),az.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oJ(t,r,o,a)}),ip=eX("ZodUnknown",(t,r)=>{rR.init(t,r),az.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oB(t,r,o,a)});function ih(){return new ip({type:"unknown"})}let im=eX("ZodNever",(t,r)=>{rP.init(t,r),az.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oK(t,r,o,a)}),iy=eX("ZodArray",(t,r)=>{aq(),rO.init(t,r),az.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oY(t,r,o,a),t.element=r.element},{min(t,r){return this.check(od(t,r))},nonempty(t){return this.check(od(1,t))},max(t,r){return this.check(ou(t,r))},length(t,r){return this.check(op(t,r))},unwrap(){return this.element}});function ig(t,r){return new iy({type:"array",element:t,...ek(r)})}let iv=eX("ZodObject",(t,r)=>{var o;let a,i;aq(),rI.init(t,r),az.init(t,r),t._zod.processJSONSchema=(r,o,a)=>o0(t,r,o,a),o="shape",(i=o in(a=Object.getPrototypeOf(t))?void 0:a)&&Object.defineProperty(i,o,{configurable:!0,get(){let t={configurable:!0,writable:!0,enumerable:!1,value:void 0};return Object.defineProperty(this,o,t),t.value=(t=>t._zod.def.shape)(this),Object.defineProperty(this,o,t),t.value},set(t){Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!1,value:t})}})},{keyof(){return ix(Object.keys(this._zod.def.shape))},catchall(t){return this.clone(ev(this._zod.def,{catchall:t}))},passthrough(){return this.clone(ev(this._zod.def,{catchall:ih()}))},loose(){return this.clone(ev(this._zod.def,{catchall:ih()}))},strict(){return this.clone(ev(this._zod.def,{catchall:new im({type:"never",...ek(void 0)})}))},strip(){return this.clone(ev(this._zod.def,{catchall:void 0}))},extend(t){if(!e$(t))throw Error("Invalid input to extend: expected a plain object");let r=this._zod.def.checks;if(r&&r.length>0){let r=ef(this);for(let o of Reflect.ownKeys(t))if(void 0!==Object.getOwnPropertyDescriptor(r,o))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return eP(this,ev(this._zod.def,{shape:eC(this,t)}))},safeExtend(t){if(!e$(t))throw Error("Invalid input to safeExtend: expected a plain object");return eP(this,ev(this._zod.def,{shape:eC(this,t)}))},merge(t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(this._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};return eg(r,this,Reflect.ownKeys(ef(this))),eg(r,t,Reflect.ownKeys(ef(t))),eP(this,ev(this._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))},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 eg(i,t,ej(t,r)),eP(t,ev(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(ej(t,r)),s={};return eg(s,t,Reflect.ownKeys(ef(t)).filter(t=>!i.has(t))),eP(t,ev(o,{shape:s,checks:[]}))}(this,t)},partial(...t){return eN(iA,this,t[0])},exactPartial(...t){return eN(iq,this,t[0],"exactPartial")},required(...t){var r;let o,a;return o=(r=t[0])?new Set(ej(this,r)):void 0,eg(a={},this,Reflect.ownKeys(ef(this)),(t,r)=>o&&!o.has(r)?t:new iV({type:"nonoptional",innerType:t})),eP(this,ev(this._zod.def,{shape:a}))}});function ib(t,r){return new iv({type:"object",shape:t??{},...ek(r)})}function i_(t,r){return new iv({type:"object",shape:t,catchall:ih(),...ek(r)})}let iS=eX("ZodUnion",(t,r)=>{rM.init(t,r),az.init(t,r),t._zod.processJSONSchema=(r,o,a)=>o1(t,r,o,a),t.options=r.options});function i$(t,r){return new iS({type:"union",options:t,...ek(r)})}let iw=eX("ZodDiscriminatedUnion",(t,r)=>{iS.init(t,r),rq.init(t,r)});function iE(t,r,o){return new iw({type:"union",options:r,discriminator:t,...ek(o)})}let iR=eX("ZodIntersection",(t,r)=>{rz.init(t,r),az.init(t,r),t._zod.processJSONSchema=(r,o,a)=>o2(t,r,o,a)});function iP(t,r){return new iR({type:"intersection",left:t,right:r})}let ik=eX("ZodRecord",(t,r)=>{aq(),rD.init(t,r),az.init(t,r),t._zod.processJSONSchema=(r,o,a)=>o4(t,r,o,a),t.keyType=r.keyType,t.valueType=r.valueType});function iO(t,r,o){return new ik(r&&r._zod?{type:"record",keyType:t,valueType:r,...ek(o)}:{type:"record",keyType:aU(),valueType:t,...ek(r)})}let iT=eX("ZodEnum",(t,r)=>{rU.init(t,r),az.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oG(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 iT({...r,checks:[],...ek(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 iT({...r,checks:[],...ek(a),entries:i})}});function ix(t,r){return new iT({type:"enum",entries:Array.isArray(t)?Object.fromEntries(t.map(t=>[t,t])):t,...ek(r)})}let ij=eX("ZodLiteral",(t,r)=>{rV.init(t,r),az.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oZ(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 iC(t,r){return new ij({type:"literal",values:Array.isArray(t)?t:[t],...ek(r)})}let iN=eX("ZodTransform",(t,r)=>{aq(),rF.init(t,r),az.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oX(t,r,o,a),t._zod.parse=(o,a)=>{if("backward"===a.direction)throw new eQ(t.constructor.name);o.addIssue=a=>{"string"==typeof a?o.issues.push(eV(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(eV(a)))};let i=r.transform(o.value,o);return i instanceof Promise?i.then(t=>(o.value=t,o)):(o.value=i,o)}});function iI(t){return new iN({type:"transform",transform:t})}let iA=eX("ZodOptional",(t,r)=>{rK.init(t,r),az.init(t,r),t._zod.processJSONSchema=(r,o,a)=>aa(t,r,o,a),t.unwrap=()=>t._zod.def.innerType});function iM(t){return new iA({type:"optional",innerType:t})}let iq=eX("ZodExactOptional",(t,r)=>{rJ.init(t,r),az.init(t,r),t._zod.processJSONSchema=(r,o,a)=>aa(t,r,o,a),t.unwrap=()=>t._zod.def.innerType}),iz=eX("ZodNullable",(t,r)=>{rB.init(t,r),az.init(t,r),t._zod.processJSONSchema=(r,o,a)=>o5(t,r,o,a),t.unwrap=()=>t._zod.def.innerType});function iL(t){return new iz({type:"nullable",innerType:t})}let iD=eX("ZodDefault",(t,r)=>{rG.init(t,r),az.init(t,r),t._zod.processJSONSchema=(r,o,a)=>o7(t,r,o,a),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap}),iU=eX("ZodPrefault",(t,r)=>{rW.init(t,r),az.init(t,r),t._zod.processJSONSchema=(r,o,a)=>ae(t,r,o,a),t.unwrap=()=>t._zod.def.innerType}),iV=eX("ZodNonOptional",(t,r)=>{rX.init(t,r),az.init(t,r),t._zod.processJSONSchema=(r,o,a)=>o3(t,r,o,a),t.unwrap=()=>t._zod.def.innerType}),iF=eX("ZodCatch",(t,r)=>{r0.init(t,r),az.init(t,r),t._zod.processJSONSchema=(r,o,a)=>at(t,r,o,a),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap}),iH=eX("ZodPipe",(t,r)=>{r1.init(t,r),az.init(t,r),t._zod.processJSONSchema=(r,o,a)=>ar(t,r,o,a),t.in=r.in,t.out=r.out});function iK(t,r){return new iH({type:"pipe",in:t,out:r})}let iJ=eX("ZodPreprocess",(t,r)=>{iH.init(t,r),r9.init(t,r)}),iB=eX("ZodReadonly",(t,r)=>{r4.init(t,r),az.init(t,r),t._zod.processJSONSchema=(r,o,a)=>ao(t,r,o,a),t.unwrap=()=>t._zod.def.innerType}),iG=eX("ZodLazy",(t,r)=>{r3.init(t,r),az.init(t,r),t._zod.processJSONSchema=(r,o,a)=>ai(t,r,o,a),t.unwrap=()=>t._zod.def.getter()});function iZ(t){return new iG({type:"lazy",getter:t})}let iW=eX("ZodCustom",(t,r)=>{r6.init(t,r),az.init(t,r),t._zod.processJSONSchema=(r,o,a)=>oW(t,r,o,a)});function iX(t,r){return new iJ({type:"pipe",in:iI(t),out:r})}j||(j={});let iY="2025-11-25",iQ=[iY,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],i0="io.modelcontextprotocol/protocolVersion",i1="io.modelcontextprotocol/clientInfo",i2="io.modelcontextprotocol/serverInfo",i9="io.modelcontextprotocol/clientCapabilities",i4="io.modelcontextprotocol/subscriptionId",i5="io.modelcontextprotocol/logLevel",i3=iZ(()=>i$([aU(),io(),il(),iu(),iO(aU(),i3),ig(i3)])),i6=iO(aU(),i3),i8=ig(i3),i7=i$([aU(),io().int()]),se=aU(),st=ib({ttl:io().optional()}),sr=ib({taskId:aU()}),so=i_({progressToken:i7.optional(),"io.modelcontextprotocol/related-task":sr.optional()}),sa=ib({_meta:so.optional()}),si=sa.extend({task:st.optional()}),ss=ib({method:aU(),params:sa.loose().optional()}),sn=ib({_meta:so.optional()}),sl=ib({method:aU(),params:sn.loose().optional()}),sc=i_({get[i2](){return sE.optional().catch(void 0)}}),su=i_({_meta:sc.optional()}),sd=i$([aU(),io().int()]),sp=ib({jsonrpc:iC("2.0"),id:sd,...ss.shape}).strict(),sh=ib({jsonrpc:iC("2.0"),...sl.shape}).strict(),sf=ib({jsonrpc:iC("2.0"),id:sd,result:su}).strict(),sm=ib({jsonrpc:iC("2.0"),id:sd.optional(),error:ib({code:io().int(),message:aU(),data:ih().optional()})}).strict(),sy=i$([sp,sh,sf,sm]),sg=i$([sf,sm]),sv=su.strict(),sb=sn.extend({requestId:sd.optional(),reason:aU().optional()}),s_=sl.extend({method:iC("notifications/cancelled"),params:sb}),sS=ib({src:aU(),mimeType:aU().optional(),sizes:ig(aU()).optional(),theme:ix(["light","dark"]).optional()}),s$=ib({icons:ig(sS).optional()}),sw=ib({name:aU(),title:aU().optional()}),sE=sw.extend({...sw.shape,...s$.shape,version:aU(),websiteUrl:aU().optional(),description:aU().optional()}),sR=iP(ib({applyDefaults:il().optional()}),i6),sP=iX(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,iP(ib({form:sR.optional(),url:i6.optional()}),i6.optional())),sk=i_({list:i6.optional(),cancel:i6.optional(),requests:i_({sampling:i_({createMessage:i6.optional()}).optional(),elicitation:i_({create:i6.optional()}).optional()}).optional()}),sO=i_({list:i6.optional(),cancel:i6.optional(),requests:i_({tools:i_({call:i6.optional()}).optional()}).optional()}),sT=ib({experimental:iO(aU(),i6).optional(),sampling:ib({context:i6.optional(),tools:i6.optional()}).optional(),elicitation:sP.optional(),roots:ib({listChanged:il().optional()}).optional(),tasks:sk.optional(),extensions:iO(aU(),i6).optional()}),sx=sa.extend({protocolVersion:aU(),capabilities:sT,clientInfo:sE}),sj=ss.extend({method:iC("initialize"),params:sx}),sC=ib({experimental:iO(aU(),i6).optional(),logging:i6.optional(),completions:i6.optional(),prompts:ib({listChanged:il().optional()}).optional(),resources:ib({subscribe:il().optional(),listChanged:il().optional()}).optional(),tools:ib({listChanged:il().optional()}).optional(),tasks:sO.optional(),extensions:iO(aU(),i6).optional()}),sN=su.extend({protocolVersion:aU(),capabilities:sC,serverInfo:sE,instructions:aU().optional()}),sI=sl.extend({method:iC("notifications/initialized"),params:sn.optional()}),sA=ss.extend({method:iC("server/discover"),params:sa.optional()}),sM=su.extend({supportedVersions:ig(aU()),capabilities:sC,instructions:aU().optional()}),sq=ss.extend({method:iC("ping"),params:sa.optional()}),sz=ib({progress:io(),total:iM(io()),message:iM(aU())}),sL=ib({...sn.shape,...sz.shape,progressToken:i7}),sD=sl.extend({method:iC("notifications/progress"),params:sL}),sU=sa.extend({cursor:se.optional()}),sV=ss.extend({params:sU.optional()}),sF=su.extend({nextCursor:se.optional()}),sH=ib({uri:aU(),mimeType:iM(aU()),_meta:iO(aU(),ih()).optional()}),sK=sH.extend({text:aU()}),sJ=aU().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),sB=sH.extend({blob:sJ}),sG=ix(["user","assistant"]),sZ=ib({audience:ig(sG).optional(),priority:io().min(0).max(1).optional(),lastModified:oo(aF,{offset:!0}).optional()}),sW=ib({...sw.shape,...s$.shape,uri:aU(),description:iM(aU()),mimeType:iM(aU()),size:iM(io()),annotations:sZ.optional(),_meta:iM(i_({}))}),sX=ib({...sw.shape,...s$.shape,uriTemplate:aU(),description:iM(aU()),mimeType:iM(aU()),annotations:sZ.optional(),_meta:iM(i_({}))}),sY=sV.extend({method:iC("resources/list")}),sQ=sF.extend({resources:ig(sW)}),s0=sV.extend({method:iC("resources/templates/list")}),s1=sF.extend({resourceTemplates:ig(sX)}),s2=sa.extend({uri:aU()}),s9=ss.extend({method:iC("resources/read"),params:s2}),s4=su.extend({contents:ig(i$([sK,sB]))}),s5=sl.extend({method:iC("notifications/resources/list_changed"),params:sn.optional()}),s3=ss.extend({method:iC("resources/subscribe"),params:s2}),s6=ss.extend({method:iC("resources/unsubscribe"),params:s2}),s8=ib({toolsListChanged:il().optional(),promptsListChanged:il().optional(),resourcesListChanged:il().optional(),resourceSubscriptions:ig(aU()).optional()}),s7=sa.extend({notifications:s8}),ne=ss.extend({method:iC("subscriptions/listen"),params:s7}),nt=sn.extend({notifications:s8}),nr=sl.extend({method:iC("notifications/subscriptions/acknowledged"),params:nt}),no=sc.extend({[i4]:sd}),na=su.extend({_meta:no}),ni=sn.extend({uri:aU()}),ns=sl.extend({method:iC("notifications/resources/updated"),params:ni}),nn=ib({name:aU(),description:iM(aU()),required:iM(il())}),nl=ib({...sw.shape,...s$.shape,description:iM(aU()),arguments:iM(ig(nn)),_meta:iM(i_({}))}),nc=sV.extend({method:iC("prompts/list")}),nu=sF.extend({prompts:ig(nl)}),nd=sa.extend({name:aU(),arguments:iO(aU(),aU()).optional()}),np=ss.extend({method:iC("prompts/get"),params:nd}),nh=ib({type:iC("text"),text:aU(),annotations:sZ.optional(),_meta:iO(aU(),ih()).optional()}),nf=ib({type:iC("image"),data:sJ,mimeType:aU(),annotations:sZ.optional(),_meta:iO(aU(),ih()).optional()}),nm=ib({type:iC("audio"),data:sJ,mimeType:aU(),annotations:sZ.optional(),_meta:iO(aU(),ih()).optional()}),ny=ib({type:iC("tool_use"),name:aU(),id:aU(),input:iO(aU(),ih()),_meta:iO(aU(),ih()).optional()}),ng=ib({type:iC("resource"),resource:i$([sK,sB]),annotations:sZ.optional(),_meta:iO(aU(),ih()).optional()}),nv=sW.extend({type:iC("resource_link")}),nb=i$([nh,nf,nm,nv,ng]),n_=ib({role:sG,content:nb}),nS=su.extend({description:aU().optional(),messages:ig(n_)}),n$=sl.extend({method:iC("notifications/prompts/list_changed"),params:sn.optional()}),nw=ib({title:aU().optional(),readOnlyHint:il().optional(),destructiveHint:il().optional(),idempotentHint:il().optional(),openWorldHint:il().optional()}),nE=ib({taskSupport:ix(["required","optional","forbidden"]).optional()}),nR=ib({...sw.shape,...s$.shape,description:aU().optional(),inputSchema:ib({type:iC("object"),properties:iO(aU(),i3).optional(),required:ig(aU()).optional()}).catchall(ih()),outputSchema:i_({$schema:aU().optional()}).optional(),annotations:nw.optional(),execution:nE.optional(),_meta:iO(aU(),ih()).optional()}),nP=sV.extend({method:iC("tools/list")}),nk=sF.extend({tools:ig(nR)}),nO=su.extend({content:ig(nb).default([]),structuredContent:ih().optional(),isError:il().optional()}),nT=nO.or(su.extend({toolResult:ih()})),nx=si.extend({name:aU(),arguments:iO(aU(),ih()).optional()}),nj=ss.extend({method:iC("tools/call"),params:nx}),nC=sl.extend({method:iC("notifications/tools/list_changed"),params:sn.optional()}),nN=ib({autoRefresh:il().default(!0),debounceMs:io().int().nonnegative().default(300)}),nI=ix(["debug","info","notice","warning","error","critical","alert","emergency"]),nA=sa.extend({level:nI}),nM=ss.extend({method:iC("logging/setLevel"),params:nA}),nq=sn.extend({level:nI,logger:aU().optional(),data:ih()}),nz=sl.extend({method:iC("notifications/message"),params:nq}),nL=ib({name:aU().optional()}),nD=ib({hints:ig(nL).optional(),costPriority:io().min(0).max(1).optional(),speedPriority:io().min(0).max(1).optional(),intelligencePriority:io().min(0).max(1).optional()}),nU=ib({mode:ix(["auto","required","none"]).optional()}),nV=ib({type:iC("tool_result"),toolUseId:aU().describe("The unique identifier for the corresponding tool call."),content:ig(nb),structuredContent:ih().optional(),isError:il().optional(),_meta:iO(aU(),ih()).optional()}),nF=iE("type",[nh,nf,nm]),nH=iE("type",[nh,nf,nm,ny,nV]),nK=ib({role:sG,content:i$([nH,ig(nH)]),_meta:iO(aU(),ih()).optional()}),nJ=si.extend({messages:ig(nK),modelPreferences:nD.optional(),systemPrompt:aU().optional(),includeContext:ix(["none","thisServer","allServers"]).optional(),temperature:io().optional(),maxTokens:io().int(),stopSequences:ig(aU()).optional(),metadata:i6.optional(),tools:ig(nR).optional(),toolChoice:nU.optional()}),nB=ss.extend({method:iC("sampling/createMessage"),params:nJ}),nG=su.extend({model:aU(),stopReason:iM(ix(["endTurn","stopSequence","maxTokens"]).or(aU())),role:sG,content:nF}),nZ=su.extend({model:aU(),stopReason:iM(ix(["endTurn","stopSequence","maxTokens","toolUse"]).or(aU())),role:sG,content:i$([nH,ig(nH)])}),nW=ib({type:iC("boolean"),title:aU().optional(),description:aU().optional(),default:il().optional()}),nX=ib({type:iC("string"),title:aU().optional(),description:aU().optional(),minLength:io().optional(),maxLength:io().optional(),format:ix(["email","uri","date","date-time"]).optional(),default:aU().optional()}),nY=ib({type:ix(["number","integer"]),title:aU().optional(),description:aU().optional(),minimum:io().optional(),maximum:io().optional(),default:io().optional()}),nQ=ib({type:iC("string"),title:aU().optional(),description:aU().optional(),enum:ig(aU()),default:aU().optional()}),n0=ib({type:iC("string"),title:aU().optional(),description:aU().optional(),oneOf:ig(ib({const:aU(),title:aU()})),default:aU().optional()}),n1=ib({type:iC("string"),title:aU().optional(),description:aU().optional(),enum:ig(aU()),enumNames:ig(aU()).optional(),default:aU().optional()}),n2=i$([nQ,n0]),n9=ib({type:iC("array"),title:aU().optional(),description:aU().optional(),minItems:io().optional(),maxItems:io().optional(),items:ib({type:iC("string"),enum:ig(aU())}),default:ig(aU()).optional()}),n4=ib({type:iC("array"),title:aU().optional(),description:aU().optional(),minItems:io().optional(),maxItems:io().optional(),items:ib({anyOf:ig(ib({const:aU(),title:aU()}))}),default:ig(aU()).optional()}),n5=i$([n9,n4]),n3=i$([n1,n2,n5]),n6=i$([n3,nW,nX,nY]),n8=si.extend({mode:iC("form").optional(),message:aU(),requestedSchema:ib({type:iC("object"),properties:iO(aU(),n6),required:ig(aU()).optional()}).catchall(ih())}),n7=si.extend({mode:iC("url"),message:aU(),elicitationId:aU(),url:aU().url()}),le=i$([n8,n7]),lt=ss.extend({method:iC("elicitation/create"),params:le}),lr=sn.extend({elicitationId:aU()}),lo=sl.extend({method:iC("notifications/elicitation/complete"),params:lr}),la=su.extend({action:ix(["accept","decline","cancel"]),content:iX(t=>null===t?void 0:t,iO(aU(),i$([aU(),io(),il(),ig(aU())])).optional())}),li=ib({type:iC("ref/resource"),uri:aU()}),ls=ib({type:iC("ref/prompt"),name:aU()}),ln=sa.extend({ref:i$([ls,li]),argument:ib({name:aU(),value:aU()}),context:ib({arguments:iO(aU(),aU()).optional()}).optional()}),ll=ss.extend({method:iC("completion/complete"),params:ln}),lc=su.extend({completion:i_({values:ig(aU()).max(100),total:iM(io().int()),hasMore:iM(il())})}),lu=ib({uri:aU().startsWith("file://"),name:aU().optional(),_meta:iO(aU(),ih()).optional()}),ld=ss.extend({method:iC("roots/list"),params:sa.optional()}),lp=su.extend({roots:ig(lu)}),lh=sl.extend({method:iC("notifications/roots/list_changed"),params:sn.optional()}),lf=i_({ttl:io().optional(),pollInterval:io().optional()}),lm=ix(["working","input_required","completed","failed","cancelled"]),ly=ib({taskId:aU(),status:lm,ttl:i$([io(),iu()]),createdAt:aU(),lastUpdatedAt:aU(),pollInterval:iM(io()),statusMessage:iM(aU())}),lg=su.extend({task:ly}),lv=sn.merge(ly),lb=sl.extend({method:iC("notifications/tasks/status"),params:lv}),l_=ss.extend({method:iC("tasks/get"),params:sa.extend({taskId:aU()})}),lS=su.merge(ly),l$=ss.extend({method:iC("tasks/result"),params:sa.extend({taskId:aU()})}),lw=su.loose(),lE=sV.extend({method:iC("tasks/list")}),lR=sF.extend({tasks:ig(ly)}),lP=ss.extend({method:iC("tasks/cancel"),params:sa.extend({taskId:aU()})}),lk=su.merge(ly),lO=i$([sq,sj,sA,ll,nM,np,nc,sY,s0,s9,s3,s6,ne,nj,nP]),lT=i$([s_,sD,sI,lh]),lx=i$([sv,nG,nZ,la,lp]),lj=i$([sq,nB,lt,ld]),lC=i$([s_,sD,nz,ns,s5,nC,n$,nr,lo]),lN=i$([sv,sN,sM,lc,nS,nu,sQ,s1,s4,nO,nk,na]),lI=or(aW,void 0).superRefine((t,r)=>{if(!URL.canParse(t))return r.addIssue({code:"custom",message:"URL must be parseable",fatal:!0}),eG}).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"}),lA=i_({resource:aU().url(),authorization_servers:ig(lI).optional(),jwks_uri:aU().url().optional(),scopes_supported:ig(aU()).optional(),bearer_methods_supported:ig(aU()).optional(),resource_signing_alg_values_supported:ig(aU()).optional(),resource_name:aU().optional(),resource_documentation:aU().optional(),resource_policy_uri:aU().url().optional(),resource_tos_uri:aU().url().optional(),tls_client_certificate_bound_access_tokens:il().optional(),authorization_details_types_supported:ig(aU()).optional(),dpop_signing_alg_values_supported:ig(aU()).optional(),dpop_bound_access_tokens_required:il().optional()}),lM=i_({issuer:aU(),authorization_endpoint:lI,token_endpoint:lI,registration_endpoint:lI.optional(),scopes_supported:ig(aU()).optional(),response_types_supported:ig(aU()),response_modes_supported:ig(aU()).optional(),grant_types_supported:ig(aU()).optional(),token_endpoint_auth_methods_supported:ig(aU()).optional(),token_endpoint_auth_signing_alg_values_supported:ig(aU()).optional(),service_documentation:lI.optional(),revocation_endpoint:lI.optional(),revocation_endpoint_auth_methods_supported:ig(aU()).optional(),revocation_endpoint_auth_signing_alg_values_supported:ig(aU()).optional(),introspection_endpoint:aU().optional(),introspection_endpoint_auth_methods_supported:ig(aU()).optional(),introspection_endpoint_auth_signing_alg_values_supported:ig(aU()).optional(),code_challenge_methods_supported:ig(aU()).optional(),client_id_metadata_document_supported:il().optional(),authorization_response_iss_parameter_supported:il().optional().catch(void 0)}),lq=i_({issuer:aU(),authorization_endpoint:lI,token_endpoint:lI,userinfo_endpoint:lI.optional(),jwks_uri:lI,registration_endpoint:lI.optional(),scopes_supported:ig(aU()).optional(),response_types_supported:ig(aU()),response_modes_supported:ig(aU()).optional(),grant_types_supported:ig(aU()).optional(),acr_values_supported:ig(aU()).optional(),subject_types_supported:ig(aU()),id_token_signing_alg_values_supported:ig(aU()),id_token_encryption_alg_values_supported:ig(aU()).optional(),id_token_encryption_enc_values_supported:ig(aU()).optional(),userinfo_signing_alg_values_supported:ig(aU()).optional(),userinfo_encryption_alg_values_supported:ig(aU()).optional(),userinfo_encryption_enc_values_supported:ig(aU()).optional(),request_object_signing_alg_values_supported:ig(aU()).optional(),request_object_encryption_alg_values_supported:ig(aU()).optional(),request_object_encryption_enc_values_supported:ig(aU()).optional(),token_endpoint_auth_methods_supported:ig(aU()).optional(),token_endpoint_auth_signing_alg_values_supported:ig(aU()).optional(),display_values_supported:ig(aU()).optional(),claim_types_supported:ig(aU()).optional(),claims_supported:ig(aU()).optional(),service_documentation:aU().optional(),claims_locales_supported:ig(aU()).optional(),ui_locales_supported:ig(aU()).optional(),claims_parameter_supported:il().optional(),request_parameter_supported:il().optional(),request_uri_parameter_supported:il().optional(),require_request_uri_registration:il().optional(),op_policy_uri:lI.optional(),op_tos_uri:lI.optional(),client_id_metadata_document_supported:il().optional(),authorization_response_iss_parameter_supported:il().optional().catch(void 0)}),lz=ib({...lq.shape,...lM.pick({code_challenge_methods_supported:!0}).shape}),lL=ib({access_token:aU(),id_token:aU().optional(),token_type:aU(),expires_in:new ir(oe({type:"number",coerce:!0,checks:[],...ek(void 0)})).optional(),scope:aU().optional(),refresh_token:aU().optional()}).strip(),lD=ib({issued_token_type:iC("urn:ietf:params:oauth:token-type:id-jag"),access_token:aU(),token_type:aU().optional(),expires_in:io().optional(),scope:aU().optional()}).strip(),lU=ib({error:aU(),error_description:aU().optional(),error_uri:aU().optional()}),lV=lI.optional().or(iC("").transform(()=>void 0)),lF=ib({redirect_uris:ig(lI),token_endpoint_auth_method:aU().optional(),grant_types:ig(aU()).optional(),response_types:ig(aU()).optional(),application_type:aU().optional(),client_name:aU().optional(),client_uri:lI.optional(),logo_uri:lV,scope:aU().optional(),contacts:ig(aU()).optional(),tos_uri:lV,policy_uri:aU().optional(),jwks_uri:lI.optional(),jwks:new id({type:"any"}).optional(),software_id:aU().optional(),software_version:aU().optional(),software_statement:aU().optional()}).strip(),lH=ib({client_id:aU(),client_secret:aU().optional(),client_id_issued_at:io().optional(),client_secret_expires_at:io().optional()}).strip(),lK=lF.merge(lH),lJ=ib({error:aU(),error_description:aU().optional()}).strip(),lB=ib({token:aU(),token_type_hint:aU().optional()}).strip(),lG=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,lG,{value:o,enumerable:!1,configurable:!0})}function lW(t,r){try{if("object"==typeof r&&null!==r&&Object.prototype.hasOwnProperty.call(t,"mcpBrand")&&"string"==typeof t.mcpBrand&&Object.prototype.hasOwnProperty.call(r,lG)){let o=r[lG];if(o&&"function"==typeof o.has&&o.has(t.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(t,r)}(class t extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return lW(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 lW(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)}});($={}).NotConnected="NOT_CONNECTED",$.AlreadyConnected="ALREADY_CONNECTED",$.NotInitialized="NOT_INITIALIZED",$.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",$.RequestTimeout="REQUEST_TIMEOUT",$.ConnectionClosed="CONNECTION_CLOSED",$.SendFailed="SEND_FAILED",$.InvalidResult="INVALID_RESULT",$.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",$.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",$.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",$.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",$.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",$.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",$.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",$.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",$.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",$.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",$.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION";var lX=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](t){return lW(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 lW(this,t)}constructor(t,r,o){super(r),this.code=t,this.data=o,this.name="SdkError",lZ(this,new.target)}};(class extends lX{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 lY={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},lQ={"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};Object.keys(lY),Object.keys(lQ);Symbol("modelcontextprotocol.resultCacheHintFallback");let l0=((w={})[w.ParseError=-32700]="ParseError",w[w.InvalidRequest=-32600]="InvalidRequest",w[w.MethodNotFound=-32601]="MethodNotFound",w[w.InvalidParams=-32602]="InvalidParams",w[w.InternalError=-32603]="InternalError",w[w.ResourceNotFound=-32002]="ResourceNotFound",w[w.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",w[w.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",w[w.UrlElicitationRequired=-32042]="UrlElicitationRequired",w);var l1=class t extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return lW(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 lW(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===l0.UrlElicitationRequired&&a&&a.elicitations?new l9(a.elicitations,o):r===l0.UnsupportedProtocolVersion&&a&&Array.isArray(a.supported)&&"string"==typeof a.requested?new l4({supported:a.supported,requested:a.requested},o):(r===l0.InvalidParams||r===l0.ResourceNotFound)&&"string"==typeof a?.uri&&(r===l0.ResourceNotFound||1===Object.keys(a).length)?new l2(a.uri,o):r===l0.MissingRequiredClientCapability&&a&&null!==a.requiredCapabilities&&"object"==typeof a.requiredCapabilities&&!Array.isArray(a.requiredCapabilities)?new l5({requiredCapabilities:a.requiredCapabilities},o):new t(r,o,a)}},l2=class extends l1{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(t,r=`Resource not found: ${t}`){super(l0.InvalidParams,r,{uri:t})}get uri(){return this.data.uri}},l9=class extends l1{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(l0.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}},l4=class extends l1{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(t,r=`Unsupported protocol version: ${t.requested}`){super(l0.UnsupportedProtocolVersion,r,t)}get supported(){return this.data.supported}get requested(){return this.data.requested}},l5=class extends l1{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(t,r=`Missing required client capabilities: ${Object.keys(t.requiredCapabilities).join(", ")}`){super(l0.MissingRequiredClientCapability,r,t)}get requiredCapabilities(){return this.data.requiredCapabilities}};let l3={"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},l6={"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};Object.keys(l3),Object.keys(l6);var l8=((t,r)=>{let o={};for(var a in t)Q(o,a,{get:t[a],enumerable:!0});return r&&Q(o,Symbol.toStringTag,{value:"Module"}),o})({AnnotationsSchema:()=>sZ,AudioContentSchema:()=>nm,BaseMetadataSchema:()=>sw,BaseRequestParamsSchema:()=>sa,BlobResourceContentsSchema:()=>sB,BooleanSchemaSchema:()=>nW,CallToolRequestParamsSchema:()=>nx,CallToolRequestSchema:()=>nj,CallToolResultSchema:()=>nO,CancelTaskRequestSchema:()=>lP,CancelTaskResultSchema:()=>lk,CancelledNotificationParamsSchema:()=>sb,CancelledNotificationSchema:()=>s_,ClientCapabilitiesSchema:()=>sT,ClientNotificationSchema:()=>lT,ClientRequestSchema:()=>lO,ClientResultSchema:()=>lx,ClientTasksCapabilitySchema:()=>sk,CompatibilityCallToolResultSchema:()=>nT,CompleteRequestParamsSchema:()=>ln,CompleteRequestSchema:()=>ll,CompleteResultSchema:()=>lc,ContentBlockSchema:()=>nb,CreateMessageRequestParamsSchema:()=>nJ,CreateMessageRequestSchema:()=>nB,CreateMessageResultSchema:()=>nG,CreateMessageResultWithToolsSchema:()=>nZ,CreateTaskResultSchema:()=>lg,CursorSchema:()=>se,DiscoverRequestSchema:()=>sA,DiscoverResultSchema:()=>sM,ElicitRequestFormParamsSchema:()=>n8,ElicitRequestParamsSchema:()=>le,ElicitRequestSchema:()=>lt,ElicitRequestURLParamsSchema:()=>n7,ElicitResultSchema:()=>la,ElicitationCompleteNotificationParamsSchema:()=>lr,ElicitationCompleteNotificationSchema:()=>lo,EmbeddedResourceSchema:()=>ng,EmptyResultSchema:()=>sv,EnumSchemaSchema:()=>n3,GetPromptRequestParamsSchema:()=>nd,GetPromptRequestSchema:()=>np,GetPromptResultSchema:()=>nS,GetTaskPayloadRequestSchema:()=>l$,GetTaskPayloadResultSchema:()=>lw,GetTaskRequestSchema:()=>l_,GetTaskResultSchema:()=>lS,IconSchema:()=>sS,IconsSchema:()=>s$,ImageContentSchema:()=>nf,ImplementationSchema:()=>sE,InitializeRequestParamsSchema:()=>sx,InitializeRequestSchema:()=>sj,InitializeResultSchema:()=>sN,InitializedNotificationSchema:()=>sI,JSONArraySchema:()=>i8,JSONObjectSchema:()=>i6,JSONRPCErrorResponseSchema:()=>sm,JSONRPCMessageSchema:()=>sy,JSONRPCNotificationSchema:()=>sh,JSONRPCRequestSchema:()=>sp,JSONRPCResponseSchema:()=>sg,JSONRPCResultResponseSchema:()=>sf,JSONValueSchema:()=>i3,LegacyTitledEnumSchemaSchema:()=>n1,ListChangedOptionsBaseSchema:()=>nN,ListPromptsRequestSchema:()=>nc,ListPromptsResultSchema:()=>nu,ListResourceTemplatesRequestSchema:()=>s0,ListResourceTemplatesResultSchema:()=>s1,ListResourcesRequestSchema:()=>sY,ListResourcesResultSchema:()=>sQ,ListRootsRequestSchema:()=>ld,ListRootsResultSchema:()=>lp,ListTasksRequestSchema:()=>lE,ListTasksResultSchema:()=>lR,ListToolsRequestSchema:()=>nP,ListToolsResultSchema:()=>nk,LoggingLevelSchema:()=>nI,LoggingMessageNotificationParamsSchema:()=>nq,LoggingMessageNotificationSchema:()=>nz,ModelHintSchema:()=>nL,ModelPreferencesSchema:()=>nD,MultiSelectEnumSchemaSchema:()=>n5,NotificationSchema:()=>sl,NotificationsParamsSchema:()=>sn,NumberSchemaSchema:()=>nY,PaginatedRequestParamsSchema:()=>sU,PaginatedRequestSchema:()=>sV,PaginatedResultSchema:()=>sF,PingRequestSchema:()=>sq,PrimitiveSchemaDefinitionSchema:()=>n6,ProgressNotificationParamsSchema:()=>sL,ProgressNotificationSchema:()=>sD,ProgressSchema:()=>sz,ProgressTokenSchema:()=>i7,PromptArgumentSchema:()=>nn,PromptListChangedNotificationSchema:()=>n$,PromptMessageSchema:()=>n_,PromptReferenceSchema:()=>ls,PromptSchema:()=>nl,ReadResourceRequestParamsSchema:()=>s2,ReadResourceRequestSchema:()=>s9,ReadResourceResultSchema:()=>s4,RelatedTaskMetadataSchema:()=>sr,RequestIdSchema:()=>sd,RequestMetaSchema:()=>so,RequestSchema:()=>ss,ResourceContentsSchema:()=>sH,ResourceLinkSchema:()=>nv,ResourceListChangedNotificationSchema:()=>s5,ResourceRequestParamsSchema:()=>s2,ResourceSchema:()=>sW,ResourceTemplateReferenceSchema:()=>li,ResourceTemplateSchema:()=>sX,ResourceUpdatedNotificationParamsSchema:()=>ni,ResourceUpdatedNotificationSchema:()=>ns,ResultMetaObjectSchema:()=>sc,ResultSchema:()=>su,RoleSchema:()=>sG,RootSchema:()=>lu,RootsListChangedNotificationSchema:()=>lh,SamplingContentSchema:()=>nF,SamplingMessageContentBlockSchema:()=>nH,SamplingMessageSchema:()=>nK,ServerCapabilitiesSchema:()=>sC,ServerNotificationSchema:()=>lC,ServerRequestSchema:()=>lj,ServerResultSchema:()=>lN,ServerTasksCapabilitySchema:()=>sO,SetLevelRequestParamsSchema:()=>nA,SetLevelRequestSchema:()=>nM,SingleSelectEnumSchemaSchema:()=>n2,StringSchemaSchema:()=>nX,SubscribeRequestParamsSchema:()=>s2,SubscribeRequestSchema:()=>s3,SubscriptionFilterSchema:()=>s8,SubscriptionsAcknowledgedNotificationParamsSchema:()=>nt,SubscriptionsAcknowledgedNotificationSchema:()=>nr,SubscriptionsListenRequestParamsSchema:()=>s7,SubscriptionsListenRequestSchema:()=>ne,SubscriptionsListenResultMetaSchema:()=>no,SubscriptionsListenResultSchema:()=>na,TaskAugmentedRequestParamsSchema:()=>si,TaskCreationParamsSchema:()=>lf,TaskMetadataSchema:()=>st,TaskSchema:()=>ly,TaskStatusNotificationParamsSchema:()=>lv,TaskStatusNotificationSchema:()=>lb,TaskStatusSchema:()=>lm,TextContentSchema:()=>nh,TextResourceContentsSchema:()=>sK,TitledMultiSelectEnumSchemaSchema:()=>n4,TitledSingleSelectEnumSchemaSchema:()=>n0,ToolAnnotationsSchema:()=>nw,ToolChoiceSchema:()=>nU,ToolExecutionSchema:()=>nE,ToolListChangedNotificationSchema:()=>nC,ToolResultContentSchema:()=>nV,ToolSchema:()=>nR,ToolUseContentSchema:()=>ny,UnsubscribeRequestParamsSchema:()=>s2,UnsubscribeRequestSchema:()=>s6,UntitledMultiSelectEnumSchemaSchema:()=>n9,UntitledSingleSelectEnumSchemaSchema:()=>nQ});let l7=t=>"object"==typeof t&&null!==t&&!Array.isArray(t)&&"input_required"===t.resultType;function ce(t){return new Set(t.flatMap(t=>Object.keys(t.shape)))}function ct(t){if(null==t)return!1;let r=typeof t;return("object"===r||"function"===r)&&"~standard"in t&&"function"==typeof t["~standard"]?.validate}l0.InvalidRequest,l0.UnsupportedProtocolVersion,l0.InvalidParams,l0.MethodNotFound,l0.InvalidParams,l0.MissingRequiredClientCapability,l0.ParseError,l0.InvalidRequest,l0.MethodNotFound,l0.UnsupportedProtocolVersion,l0.MissingRequiredClientCapability;let cr=!1,co="draft-2020-12",ca=/\\\.\\d\{(\d+)\}/;function ci(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}let cs=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function cn(t){return cs.has(t)||t.startsWith("x-")}let cl=new Set(["$schema",...Object.keys(n8.shape.requestedSchema.shape)]),cc={string:ce([nX,nQ,n0,n1]),number:ce([nY]),integer:ce([nY]),boolean:ce([nW]),array:ce([n9,n4])},cu=new Set(nX.shape.format.unwrap().options),cd=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(!ct(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,s]of Object.entries(t))"properties"===i&&ci(s)?o[i]=Object.fromEntries(Object.entries(s).map(([t,o])=>[t,function(t,r,o,a){if(!ci(t))return t;let i="string"==typeof t.type&&Object.hasOwn(cc,t.type)?cc[t.type]:void 0;if(void 0===i)return t;let s={};for(let[l,c]of Object.entries(t))if(i.has(l)||cn(l))s[l]=c;else if("pattern"===l&&"string"===t.type&&"string"==typeof t.format)if(cu.has(t.format)){var n;"string"==typeof c&&(n=t.format,"zod"!==o||(function(t,r){let o;switch(t){case"email":o=[ot(aB,void 0)];break;case"uri":o=[or(aW,void 0)];break;case"date":o=[oa(aH,void 0)];break;case"date-time":let a,i;a=ca.exec(r),i=[void 0,-1,0],a&&i.push(Number(a[1])),o=[!1,!0].flatMap(t=>[!1,!0].flatMap(r=>i.map(o=>oo(aF,{local:t,offset:r,precision:o}))))}return new Set(o.map(t=>{let r;return r=an(t,{target:co,io:"input"}),"string"==typeof r.pattern?r.pattern:void 0}).filter(t=>void 0!==t))})(n,c).has(c))||a.push(`${r}.${l}`)}else s[l]=c;else a.push(`${r}.${l}`);return s}(o,`properties.${t}`,r,a)])):cl.has(i)?o[i]=s:cn(i)||a.push(i);if(a.length>0)throw new l1(l0.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:co});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().");cr||(cr=!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=an(t,{target:co,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 l1(l0.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}(t.requestedSchema),o),i=(r=n8.shape.requestedSchema,ak(r,a));if(!i.success)throw new l1(l0.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${function(t,r){if(!ci(t.properties))return r;let o=Object.entries(t.properties).filter(([,t])=>!ak(n6,t).success).map(([t])=>`properties.${t}`);return o.length>0?o.join(", "):r}(a,i.error.message)}`);let s=function t(r,o,a=""){return Array.isArray(r)&&Array.isArray(o)?r.flatMap((r,i)=>t(r,o[i],`${a}[${i}]`)):ci(r)&&ci(o)?Object.entries(r).flatMap(([r,i])=>{let s=a?`${a}.${r}`:r;return Object.prototype.hasOwnProperty.call(o,r)?t(i,o[r],s):cn(r)?[]:[s]}):[]}(a,i.data);if(s.length>0)throw new l1(l0.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${s.join(", ")}`);let n=(i.data.required??[]).filter(t=>!Object.prototype.hasOwnProperty.call(i.data.properties,t));if(n.length>0)throw new l1(l0.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${n.join(", ")}`);return{...t,mode:"form",requestedSchema:i.data}}(t)}}catch(t){throw t instanceof l1?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"})});function cp(t,r,o){let a=ch(t,r);if("elicit"!==a.kind||"accept"!==a.action||void 0===a.content)return;if(void 0===o)return a.content;let i=o["~standard"].validate(a.content);if(i instanceof Promise)throw TypeError("acceptedContent(responses, key, schema) requires a synchronously-validating schema");return void 0===i.issues?i.value:void 0}function ch(t,r){if(void 0===t||"object"!=typeof t||null===t)return{kind:"missing"};let o=t[r];if(null===o||"object"!=typeof o||Array.isArray(o))return{kind:"missing"};if("accept"===o.action||"decline"===o.action||"cancel"===o.action){let t=o.content;return{kind:"elicit",action:o.action,...null!==t&&"object"==typeof t&&!Array.isArray(t)&&{content:t}}}return Array.isArray(o.roots)?{kind:"roots",roots:o.roots}:"string"==typeof o.role&&void 0!==o.content?{kind:"sampling",result:o}:{kind:"missing"}}let cf={},cm={};function cy(t,r){let o=t.slice(0,-6);cf[o]=r,cm[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"])cy(t,l8[t]);for(let[t,r]of Object.entries({IdJagTokenExchangeResponseSchema:lD,OAuthClientInformationFullSchema:lK,OAuthClientInformationSchema:lH,OAuthClientMetadataSchema:lF,OAuthClientRegistrationErrorSchema:lJ,OAuthErrorResponseSchema:lU,OAuthMetadataSchema:lM,OAuthProtectedResourceMetadataSchema:lA,OAuthTokenRevocationRequestSchema:lB,OAuthTokensSchema:lL,OpenIdProviderDiscoveryMetadataSchema:lz,OpenIdProviderMetadataSchema:lq}))cy(t,r);Object.freeze(cf),Object.freeze(cm);E=void 0,()=>E;ea(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 s,n,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;n=r.exec(c);){if(n.index!==u)throw TypeError("invalid parameter format");u+=n[0].length,s=n[1].toLowerCase(),34===(l=n[2]).charCodeAt(0)&&-1!==(l=l.slice(1,-1)).indexOf("\\")&&(l=l.replace(o,"$1")),p.parameters[s]=l}if(u!==c.length)throw TypeError("invalid parameter format")}return p}})();var cg=ea(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]],s=0;for(;s<r.length;)l(o,r[s]),o.push(t[++s]);return new a(o)}t._Code=a,t.nil=new a(""),t._=i;let s=new a("+");function n(t,...r){let i=[c(t[0])],u=0;for(;u<r.length;)i.push(s),l(i,r[u]),i.push(s,c(t[++u]));return function(t){let r=1;for(;r<t.length-1;){if(t[r]===s){var a,i;let s=(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!==s){t.splice(r-1,3,s);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=n,t.addCodeArg=l,t.strConcat=function(t,r){return r.emptyStr()?t:t.emptyStr()?r:n`${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())}}),cv=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;let r=cg();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 s=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=s;var n=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=n;let l=(0,r._)`\n`;var c=class extends s{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 n(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,s=null!=(o=r.key)?o:r.ref,n=this._values[i];if(n){let t=n.get(s);if(t)return t}else n=this._values[i]=new Map;n.set(s,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,s,n={},l){let c=r.nil;for(let u in o){let d=o[u];if(!d)continue;let p=n[u]=n[u]||new Map;d.forEach(o=>{if(p.has(o))return;p.set(o,a.Started);let n=s(o);if(n){let a=this.opts.es5?t.varKinds.var:t.varKinds.const;c=(0,r._)`${c}${a} ${o} = ${n};${this.opts._n}`}else if(n=null==l?void 0:l(o))c=(0,r._)`${c}${n}${this.opts._n}`;else throw new i(o);p.set(o,a.Completed)})}return c}};t.ValueScope=c}),cb=ea(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=cg(),o=cv();var a=cg();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=cv();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 s=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},n=class extends s{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=j(this.rhs,t,r)),this}get names(){return this.rhs instanceof r._CodeOrName?this.rhs.names:{}}},l=class extends s{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=j(this.rhs,t,o),this}get names(){return x(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 s{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},d=class extends s{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},p=class extends s{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},h=class extends s{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=j(this.code,t,r),this}get names(){return this.code instanceof r._CodeOrName?this.code.names:{}}},f=class extends s{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)=>T(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(C(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=j(this.condition,t,r),this}get names(){let t=super.names;return x(t,this.condition),this.else&&T(t,this.else.names),t}};v.kind="if";var b=class extends m{};b.kind="for";var _=class extends b{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=j(this.iteration,t,r),this}get names(){return T(super.names,this.iteration.names)}},S=class extends b{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:s}=this;return`for(${r} ${a}=${i}; ${a}<${s}; ${a}++)`+super.render(t)}get names(){return x(x(super.names,this.from),this.to)}},$=class extends b{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=j(this.iterable,t,r),this}get names(){return T(super.names,this.iterable.names)}},w=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)}};w.kind="func";var E=class extends f{render(t){return"return "+super.render(t)}};E.kind="return";var R=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&&T(t,this.catch.names),this.finally&&T(t,this.finally.names),t}},P=class extends m{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};P.kind="catch";var k=class extends m{render(t){return"finally"+super.render(t)}};k.kind="finally";var O=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 n(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 _(t),r)}forRange(t,r,a,i,s=this.opts.es5?o.varKinds.var:o.varKinds.let){let n=this._scope.toName(t);return this._for(new S(s,n,r,a),()=>i(n))}forOf(t,a,i,s=o.varKinds.const){let n=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(n,(0,r._)`${t}[${o}]`),i(n)})}return this._for(new $("of",s,n,a),()=>i(n))}forIn(t,a,i,s=this.opts.es5?o.varKinds.var:o.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,r._)`Object.keys(${a})`,i);let n=this._scope.toName(t);return this._for(new $("in",s,n,a),()=>i(n))}endFor(){return this._endBlockNode(b)}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 R;if(this._blockNode(a),this.code(t),r){let t=this.name("e");this._currNode=a.catch=new P(t),r(t)}return o&&(this._currNode=a.finally=new k,this.code(o)),this._endBlockNode(P,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,a,i){return this._blockNode(new w(t,o,a)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(w)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let 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 x(t,o){return o instanceof r._CodeOrName?T(t,o.names):t}function j(t,o,a){var i;if(t instanceof r.Name)return s(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=s(o)),o instanceof r._Code?t.push(...o._items):t.push(o),t),[]));function s(t){let r=a[t.str];return void 0===r||1!==o[t.str]?t:(delete o[t.str],r)}}function C(t){return"boolean"==typeof t||"number"==typeof t||null===t?!t:(0,r._)`!${M(t)}`}t.CodeGen=O,t.not=C;let N=A(t.operators.AND);t.and=function(...t){return t.reduce(N)};let I=A(t.operators.OR);function A(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)}}),c_=ea(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=cb(),i=cg();function s(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 n(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(s,n,l,c)=>{let u=void 0===l?n:l instanceof a.Name?(n instanceof a.Name?t(s,n,l):r(s,n,l),l):n instanceof a.Name?(r(s,l,n),n):o(n,l);return c!==a.Name||u instanceof a.Name?u:i(s,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||(s(t,r),!n(r,t.self.RULES.all))},t.checkUnknownRules=s,t.schemaHasRules=n,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,s){if(!s){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 s=o===r.Num;return i?s?(0,a._)`"[" + ${t} + "]"`:(0,a._)`"['" + ${t} + "']"`:s?(0,a._)`"/" + ${t}`:(0,a._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return i?(0,a.getProperty)(t).toString():"/"+l(t)},t.checkStrictMode=f}),cS=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb();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")}}),c$=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;let r=cb(),o=c_(),a=cS();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 s(t,o){let{gen:a,validateName:i,schemaEnv:s}=t;s.$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,n,c){let{it:u}=o,{gen:d,compositeRule:p,allErrors:h}=u,f=l(o,a,n);(null!=c?c:p||h)?i(d,f):s(u,(0,r._)`[${f}]`)},t.reportExtraError=function(r,o=t.keywordError,n){let{it:c}=r,{gen:u,compositeRule:d,allErrors:p}=c;i(u,l(r,o,n)),d||p||s(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:s,errsCount:n,it:l}){if(void 0===n)throw Error("ajv implementation error");let c=t.name("err");t.forRange("i",n,a.default.errors,n=>{t.const(c,(0,r._)`${a.default.vErrors}[${n}]`),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`,s))})};let n={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,s){let{createErrors:l}=t.it;return!1===l?(0,r._)`{}`:function(t,i,s={}){let{gen:l,it:c}=t,u=[function({errorPath:t},{instancePath:i}){let s=i?(0,r.str)`${t}${(0,o.getErrorPath)(i,o.Type.Str)}`:t;return[a.default.instancePath,(0,r.strConcat)(a.default.instancePath,s)]}(c,s),function({keyword:t,it:{errSchemaPath:a}},{schemaPath:i,parentSchema:s}){let l=s?a:(0,r.str)`${a}/${t}`;return i&&(l=(0,r.str)`${l}${(0,o.getErrorPath)(i,o.Type.Str)}`),[n.schemaPath,l]}(t,s)];return function(t,{params:o,message:i},s){let{keyword:l,data:c,schemaValue:u,it:d}=t,{opts:p,propertyName:h,topSchemaRef:f,schemaPath:m}=d;s.push([n.keyword,l],[n.params,"function"==typeof o?o(t):o||(0,r._)`{}`]),p.messages&&s.push([n.message,"function"==typeof i?i(t):i]),p.verbose&&s.push([n.schema,u],[n.parentSchema,(0,r._)`${f}${m}`],[a.default.data,c]),h&&s.push([n.propertyName,h])}(t,i,u),l.object(...u)}(t,i,s)}}),cw=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;let r=c$(),o=cb(),a=cS(),i={message:"boolean schema is false"};function s(t,o){let{gen:a,data:s}=t;(0,r.reportError)({gen:a,keyword:"false schema",data:s,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t},i,void 0,o)}t.topBoolOrEmptySchema=function(t){let{gen:r,schema:i,validateName:n}=t;!1===i?s(t,!1):"object"==typeof i&&!0===i.$async?r.return(a.default.data):(r.assign((0,o._)`${n}.errors`,null),r.return(!0))},t.boolOrEmptySchema=function(t,r){let{gen:o,schema:a}=t;!1===a?(o.var(r,!1),s(t)):o.var(r,!0)}}),cE=ea(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:{}}}}),cR=ea(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}),cP=ea(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=cE(),i=cR(),s=c$(),n=cb(),l=c_();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,s;let{gen:l,data:c,opts:d}=t,h=(a=o,(s=d.coerceTypes)?a.filter(t=>u.has(t)||"array"===s&&"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:s}=t,l=a.let("dataType",(0,n._)`typeof ${i}`),c=a.let("coerced",(0,n._)`undefined`);for(let t of("array"===s.coerceTypes&&a.if((0,n._)`${l} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>a.assign(i,(0,n._)`${i}[0]`).assign(l,(0,n._)`typeof ${i}`).if(p(r,i,s.strictNumbers),()=>a.assign(c,i))),a.if((0,n._)`${c} !== undefined`),o))(u.has(t)||"array"===t&&"array"===s.coerceTypes)&&function(t){switch(t){case"string":a.elseIf((0,n._)`${l} == "number" || ${l} == "boolean"`).assign(c,(0,n._)`"" + ${i}`).elseIf((0,n._)`${i} === null`).assign(c,(0,n._)`""`);return;case"number":a.elseIf((0,n._)`${l} == "boolean" || ${i} === null
|
|
56
|
-
|| (${l} == "string" && ${i} && ${i} == +${i})`).assign(c,(0,
|
|
57
|
-
|| (${l} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(c,(0,
|
|
58
|
-
|| ${l} === "boolean" || ${i} === null`).assign(c,(0,n._)`[${i}]`)}}(t);a.else(),f(t),a.endIf(),a.if((0,n._)`${c} !== undefined`,()=>{a.assign(i,c),function({gen:t,parentData:r,parentDataProperty:o},a){t.if((0,n._)`${r} !== undefined`,()=>t.assign((0,n._)`${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 s,l=i===r.Correct?n.operators.EQ:n.operators.NEQ;switch(t){case"null":return(0,n._)`${o} ${l} null`;case"array":s=(0,n._)`Array.isArray(${o})`;break;case"object":s=(0,n._)`${o} && typeof ${o} == "object" && !Array.isArray(${o})`;break;case"integer":s=c((0,n._)`!(${o} % 1) && !isNaN(${o})`);break;case"number":s=c();break;default:return(0,n._)`typeof ${o} ${l} ${t}`}return i===r.Correct?s:(0,n.not)(s);function c(t=n.nil){return(0,n.and)((0,n._)`typeof ${o} == "number"`,t,a?(0,n._)`isFinite(${o})`:n.nil)}}function p(t,r,o,a){let i;if(1===t.length)return d(t[0],r,o,a);let s=(0,l.toHash)(t);if(s.array&&s.object){let t=(0,n._)`typeof ${r} != "object"`;i=s.null?t:(0,n._)`!${r} || ${t}`,delete s.null,delete s.array,delete s.object}else i=n.nil;for(let t in s.number&&delete s.integer,s)i=(0,n.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,n._)`{type: ${t}}`:(0,n._)`{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,s.reportError)(r,h)}t.reportTypeError=f}),ck=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;let r=cb(),o=c_();function a(t,a,i){let{gen:s,compositeRule:n,data:l,opts:c}=t;if(void 0===i)return;let u=(0,r._)`${l}${(0,r.getProperty)(a)}`;if(n)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} === ""`),s.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))}}),cO=ea(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=cb(),o=c_(),a=cS(),i=c_();function s(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,r._)`Object.prototype.hasOwnProperty`})}function n(t,o,a){return(0,r._)`${s(t)}.call(${o}, ${a})`}function l(t,o,a,i){let s=(0,r._)`${o}${(0,r.getProperty)(a)} === undefined`;return i?(0,r.or)(s,(0,r.not)(n(t,o,a))):s}function c(t){return t?Object.keys(t).filter(t=>"__proto__"!==t):[]}t.checkReportMissingProp=function(t,o){let{gen:a,data:i,it:s}=t;a.if(l(a,i,o,s.opts.ownProperties),()=>{t.setParams({missingProperty:(0,r._)`${o}`},!0),t.error()})},t.checkMissingProp=function({gen:t,data:o,it:{opts:a}},i,s){return(0,r.or)(...i.map(i=>(0,r.and)(l(t,o,i,a.ownProperties),(0,r._)`${s} = ${i}`)))},t.reportMissingProp=function(t,r){t.setParams({missingProperty:r},!0),t.error()},t.hasPropFunc=s,t.isOwnProperty=n,t.propertyInData=function(t,o,a,i){let s=(0,r._)`${o}${(0,r.getProperty)(a)} !== undefined`;return i?(0,r._)`${s} && ${n(t,o,a)}`:s},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:s,schemaPath:n,errorPath:l},it:c},u,d,p){let h=p?(0,r._)`${t}, ${o}, ${s}${n}`: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 s=o.unicodeRegExp?"u":"",{regExp:n}=o.code,l=n(a,s);return t.scopeValue("pattern",{key:l.toString(),ref:l,code:(0,r._)`${"new RegExp"===n.code?u:(0,i.useFunc)(t,n)}(${a}, ${s})`})},t.validateArray=function(t){let{gen:a,data:i,keyword:s,it:n}=t,l=a.name("valid");if(n.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(n){let c=a.const("len",(0,r._)`${i}.length`);a.forRange("i",0,c,i=>{t.subschema({keyword:s,dataProp:i,dataPropType:o.Type.Num},l),a.if((0,r.not)(l),n)})}},t.validateUnion=function(t){let{gen:a,schema:i,keyword:s,it:n}=t;if(!Array.isArray(i))throw Error("ajv implementation error");if(i.some(t=>(0,o.alwaysValidSchema)(n,t))&&!n.opts.unevaluated)return;let l=a.let("valid",!1),c=a.name("_valid");a.block(()=>i.forEach((o,i)=>{let n=t.subschema({keyword:s,schemaProp:i,compositeRule:!0},c);a.assign(l,(0,r._)`${l} || ${c}`),t.mergeValidEvaluated(n,c)||a.if((0,r.not)(l))})),t.result(l,()=>t.reset(),()=>t.error(!0))}}),cT=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;let r=cb(),o=cS(),a=cO(),i=c$();function s(t){let{gen:o,data:a,it:i}=t;o.if(i.parentData,()=>o.assign(a,(0,r._)`${i.parentData}[${i.parentDataProperty}]`))}function n(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:s,parentSchema:l,it:c}=t,u=o.macro.call(c.self,s,l,c),d=n(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=n(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 s=m.opts.passContext?o.default.this:o.default.self,n=!("compile"in l&&!f||!1===l.schema);u.assign(g,(0,r._)`${i}${(0,a.callValidateCode)(t,y,s,n)}`,l.modifying)}function b(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&&s(t),b(()=>t.error());else{let a,n,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):(n=(0,r._)`${y}.errors`,u.assign(n,null),v(r.nil),n);l.modifying&&s(t),b(()=>(function(t,a){let{gen:s}=t;s.if((0,r._)`Array.isArray(${a})`,()=>{s.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,s){if(Array.isArray(i.keyword)?!i.keyword.includes(s):i.keyword!==s)throw Error("ajv implementation error");let n=i.dependencies;if(null==n?void 0:n.some(r=>!Object.prototype.hasOwnProperty.call(t,r)))throw Error(`parent schema must have dependencies of ${s}: ${n.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[s])){let t=`keyword "${s}" value is invalid at path "${a}": `+o.errorsText(i.validateSchema.errors);if("log"===r.validateSchema)o.logger.error(t);else throw Error(t)}}}),cx=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;let r=cb(),o=c_();t.getSubschema=function(t,{keyword:a,schemaProp:i,schema:s,schemaPath:n,errSchemaPath:l,topSchemaRef:c}){if(void 0!==a&&void 0!==s)throw Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==a){let s=t.schema[a];return void 0===i?{schema:s,schemaPath:(0,r._)`${t.schemaPath}${(0,r.getProperty)(a)}`,errSchemaPath:`${t.errSchemaPath}/${a}`}:{schema:s[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!==s){if(void 0===n||void 0===l||void 0===c)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:s,schemaPath:n,topSchemaRef:c,errSchemaPath:l}}throw Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(t,a,{dataProp:i,dataPropType:s,data:n,dataTypes:l,propertyName:c}){if(void 0!==n&&void 0!==i)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:u}=a;if(void 0!==i){let{errorPath:n,dataPathArr:l,opts:c}=a;d(u.let("data",(0,r._)`${a.data}${(0,r.getProperty)(i)}`,!0)),t.errorPath=(0,r.str)`${n}${(0,o.getErrorPath)(i,s,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!==n&&(d(n instanceof r.Name?n:u.let("data",n,!0)),void 0!==c&&(t.propertyName=c)),l&&(t.dataTypes=l)},t.extendSubschemaMode=function(t,{jtdDiscriminator:r,jtdMetadata:o,compositeRule:a,createErrors:i,allErrors:s}){void 0!==a&&(t.compositeRule=a),void 0!==i&&(t.createErrors=i),void 0!==s&&(t.allErrors=s),t.jtdDiscriminator=r,t.jtdMetadata=o}}),cj=ea((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=(s=Object.keys(r)).length)!==Object.keys(o).length)return!1;for(i=a;0!=i--;)if(!Object.prototype.hasOwnProperty.call(o,s[i]))return!1;for(i=a;0!=i--;){var a,i,s,n=s[i];if(!t(r[n],o[n]))return!1}return!0}return r!=r&&o!=o}}),cC=ea((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,s,n,l,c,u,d,p){if(s&&"object"==typeof s&&!Array.isArray(s)){for(var h in a(s,n,l,c,u,d,p),s){var f=s[h];if(Array.isArray(f)){if(h in o.arrayKeywords)for(var m=0;m<f.length;m++)t(r,a,i,f[m],n+"/"+h+"/"+m,l,n,h,s,m)}else if(h in o.propsKeywords){if(f&&"object"==typeof f)for(var y in f)t(r,a,i,f[y],n+"/"+h+"/"+y.replace(/~/g,"~0").replace(/\//g,"~1"),l,n,h,s,y)}else(h in o.keywords||r.allKeys&&!(h in o.skipKeywords))&&t(r,a,i,f,n+"/"+h,l,n,h,s)}i(s,n,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}}),cN=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;let r=c_(),o=cj(),a=cC(),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(s.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 s in o)if("$ref"===s||(a++,!i.has(s)&&("object"==typeof o[s]&&(0,r.eachItem)(o[s],r=>a+=t(r)),a===1/0)))return 1/0;return a}(t)<=o)};let s=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function n(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=n,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:s}=this.opts,l=u(t[i]||r),c={"":l},p=n(s,l,!1),h={},f=new Set;return a(t,{allKeys:!0},(t,r,o,a)=>{if(void 0===a)return;let s=p+r,n=c[a];function l(r){let o=this.opts.uriResolver.resolve;if(r=u(n?o(n,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(s)&&("#"===r[0]?(m(t,h[r],r),h[r]=t):this.refs[r]=s),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]&&(n=l.call(this,t[i])),g.call(this,t.$anchor),g.call(this,t.$dynamicAnchor),c[r]=n}),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`)}}}),cI=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;let r=cw(),o=cP(),a=cR(),i=cP(),s=ck(),n=cT(),l=cx(),c=cb(),u=cS(),d=cN(),p=c_(),h=c$();function f({gen:t,validateName:r,schema:o,schemaEnv:a,opts:i},s){var n;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(s)}):t.func(r,(0,c._)`${u.default.data}, ${(n=i,(0,c._)`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${n.dynamicRef?(0,c._)`, ${u.default.dynamicAnchors}={}`:c.nil}}={}`)}`,a.$async,()=>t.code(m(o,i)).code(s))}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 b(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 _({gen:t,schemaEnv:r,schema:o,errSchemaPath:a,opts:i}){let s=o.$comment;if(!0===i.$comment)t.code((0,c._)`${u.default.self}.logger.log(${s})`);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(${s}, ${o}, ${i}.schema)`)}}function S(t,r,o,s){var n,l,d,h;let{gen:f,schema:m,data:y,allErrors:g,opts:v,self:b}=t,{RULES:_}=b;if(m.$ref&&(v.ignoreKeywordsWithRef||!(0,p.schemaHasRulesButRef)(m,_)))return void f.block(()=>P(t,"$ref",_.all.$ref.definition));function S(n){(0,a.shouldUseGroup)(m,n)&&(n.type?(f.if((0,i.checkDataType)(n.type,y,v.strictNumbers)),$(t,n),1===r.length&&r[0]===n.type&&o&&(f.else(),(0,i.reportTypeError)(t)),f.endIf()):$(t,n),g||f.if((0,c._)`${u.default.errors} === ${s||0}`))}v.jtd||(n=t,l=r,!n.schemaEnv.meta&&n.opts.strictTypes&&(function(t,r){if(r.length){if(!t.dataTypes.length){t.dataTypes=r;return}r.forEach(r=>{w(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)w(r,a)?o.push(a):r.includes("integer")&&"number"===a&&o.push("integer");t.dataTypes=o}(t,r)}}(n,l),n.opts.allowUnionTypes||(d=n,(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 s=o[i];if("object"==typeof s&&(0,a.shouldUseRule)(t.schema,s)){let{type:o}=s.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}"`)}}}(n,n.dataTypes))),f.block(()=>{for(let t of _.rules)S(t);S(_.post)})}function $(t,r){let{gen:o,schema:i,opts:{useDefaults:n}}=t;n&&(0,s.assignDefaults)(t,r.type),o.block(()=>{for(let o of r.rules)(0,a.shouldUseRule)(i,o)&&P(t,o.keyword,o.definition,r.type)})}function w(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&&_(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),b(t),function(t){let{gen:r,schemaEnv:o,validateName:a,ValidationError:i,opts:s}=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),s.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 R=class{constructor(t,r,o){if((0,n.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,n.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:s}=this;o.if((0,c.or)((0,c._)`${a} === undefined`,r)),t!==c.nil&&o.assign(t,!0),(i.length||s.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:s}=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,s.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:s,opts:n}=t;n.$comment&&i.$comment&&_(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=s.const("_errs",u.default.errors);b(t,l),s.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 P(t,r,o,a){let i=new R(t,o,r);"code"in o?o.code(i,a):i.$data&&o.validate?(0,n.funcKeywordCode)(i,o):"macro"in o?(0,n.macroKeywordCode)(i,o):(o.compile||o.validate)&&(0,n.funcKeywordCode)(i,o)}t.KeywordCxt=R;let k=/^\/(?:[^~]|~0|~1)*$/,O=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function T(t,{dataLevel:r,dataNames:o,dataPathArr:a}){let i,s;if(""===t)return u.default.rootData;if("/"===t[0]){if(!k.test(t))throw Error(`Invalid JSON-pointer: ${t}`);i=t,s=u.default.rootData}else{let n=O.exec(t);if(!n)throw Error(`Invalid JSON-pointer: ${t}`);let c=+n[1];if("#"===(i=n[2])){if(c>=r)throw Error(l("property/index",c));return a[r-c]}if(c>r)throw Error(l("data",c));if(s=o[r-c],!i)return s}let n=s;for(let t of i.split("/"))t&&(s=(0,c._)`${s}${(0,c.getProperty)((0,p.unescapeJsonPointer)(t))}`,n=(0,c._)`${n} && ${s}`);return n;function l(t,o){return`Cannot access ${t} ${o} levels up, current level is ${r}`}}t.getData=T}),cA=ea(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}}}),cM=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cN();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))}}}),cq=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;let r=cb(),o=cA(),a=cS(),i=cN(),s=c_(),n=cI();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 s,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&&(s=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:s,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,n.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),s=(0,i.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&a===s)return m.call(this,o,t);let n=(0,i.normalizeId)(a),u=this.refs[n]||this.schemas[n];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),n===(0,i.normalizeId)(r)){let{schema:r}=u,{schemaId:o}=this.opts,a=r[o];return a&&(s=(0,i.resolveUrl)(this.opts.uriResolver,s,a)),new l({schema:r,schemaId:o,root:t,baseId:s})}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 s=t.refs[o];if(s)return s;let n=p.call(this,t,o);if(void 0===n){let i=null==(a=t.localRefs)?void 0:a[o],{schemaId:s}=this.opts;i&&(n=new l({schema:i,schemaId:s,root:t,baseId:r}))}if(void 0!==n)return t.refs[o]=u.call(this,n)},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 n;let c;if((null==(n=t.fragment)?void 0:n[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if("boolean"==typeof o)return;let t=o[(0,s.unescapeFragment)(a)];if(void 0===t)return;let n="object"==typeof(o=t)&&o[this.opts.schemaId];!f.has(a)&&n&&(r=(0,i.resolveUrl)(this.opts.uriResolver,r,n))}if("boolean"!=typeof o&&o.$ref&&!(0,s.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}}),cz=ea((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}}),cL=ea((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}function s(t){return t.length=0,!0}function n(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 l(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=[],l=[],c=!1,u=!1,d=n;for(let i=0;i<t.length;i++){let n=t[i];if("["!==n&&"]"!==n)if(":"===n){if(!0===c&&(u=!0),!d(l,a,o))break;if(++r>7){o.error=!0;break}i>0&&":"===t[i-1]&&(c=!0),a.push(":");continue}else if("%"===n){if(!d(l,a,o))break;d=s}else{l.push(n);continue}}return l.length&&(d===s?o.zone=l.join(""):u?a.push(l.join("")):a.push(i(l))),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:RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u),recomposeAuthority:function(t){let r=[];if(void 0!==t.userinfo&&(r.push(t.userinfo),r.push("@")),void 0!==t.host){let o=unescape(t.host);if(!a(o)){let r=l(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:l,stringArrayToHexStripped:i}}),cD=ea((t,r)=>{let{isUUID:o}=cL(),a=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,i=["http","https","ws","wss","urn","urn:uuid"];function s(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 n(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:n,serialize:l},u={scheme:"https",domainHost:c.domainHost,parse:n,serialize:l},d={scheme:"ws",domainHost:!0,parse:function(t){return t.secure=s(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t},serialize:function(t){if((t.port===(s(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 s=t,n=t.nss;return s.path=`${a||r.nid}:${n}`,r.skipEscape=!0,s},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:s,SCHEMES:h,isValidSchemeName:function(t){return -1!==i.indexOf(t)},getSchemeHandler:f}}),cU=ea((t,r)=>{let{normalizeIPv6:o,removeDotSegments:a,recomposeAuthority:i,normalizeComponentEncoding:s,isIPv4:n,nonSimpleDomain:l}=cL(),{SCHEMES:c,getSchemeHandler:u}=cD();function d(t,r,o,i){let s={};return i||(t=f(p(t,o),o),r=f(p(r,o),o)),!(o=o||{}).tolerant&&r.scheme?(s.scheme=r.scheme,s.userinfo=r.userinfo,s.host=r.host,s.port=r.port,s.path=a(r.path||""),s.query=r.query):(void 0!==r.userinfo||void 0!==r.host||void 0!==r.port?(s.userinfo=r.userinfo,s.host=r.host,s.port=r.port,s.path=a(r.path||""),s.query=r.query):(r.path?("/"===r.path[0]?s.path=a(r.path):(void 0===t.userinfo&&void 0===t.host&&void 0===t.port||t.path?t.path?s.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+r.path:s.path=r.path:s.path="/"+r.path,s.path=a(s.path)),s.query=r.query):(s.path=t.path,void 0!==r.query?s.query=r.query:s.query=t.query),s.userinfo=t.userinfo,s.host=t.host,s.port=t.port),s.scheme=t.scheme),s.fragment=r.fragment,s}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:""},s=Object.assign({},r),n=[],l=u(s.scheme||o.scheme);l&&l.serialize&&l.serialize(o,s),void 0!==o.path&&(s.skipEscape?o.path=unescape(o.path):(o.path=escape(o.path),void 0!==o.scheme&&(o.path=o.path.split("%3A").join(":")))),"suffix"!==s.reference&&o.scheme&&n.push(o.scheme,":");let c=i(o);if(void 0!==c&&("suffix"!==s.reference&&n.push("//"),n.push(c),o.path&&"/"!==o.path[0]&&n.push("/")),void 0!==o.path){let t=o.path;s.absolutePath||l&&l.absolutePath||(t=a(t)),void 0===c&&"/"===t[0]&&"/"===t[1]&&(t="/%2F"+t.slice(2)),n.push(t)}return void 0!==o.query&&n.push("?",o.query),void 0!==o.fragment&&n.push("#",o.fragment),n.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},s=!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===n(i.host)){let t=o(i.host);i.host=t.host.toLowerCase(),s=t.isIPV6}else s=!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===s&&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(s(f(t=unescape(t),o),!0),{...o,skipEscape:!0}):"object"==typeof t&&(t=p(s(t,!0),{...o,skipEscape:!0})),"string"==typeof r?r=p(s(f(r=unescape(r),o),!0),{...o,skipEscape:!0}):"object"==typeof r&&(r=p(s(r,!0),{...o,skipEscape:!0})),t.toLowerCase()===r.toLowerCase()},serialize:p,parse:f};r.exports=m,r.exports.default=m,r.exports.fastUri=m}),cV=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cU();r.code='require("ajv/dist/runtime/uri").default',t.default=r}),cF=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var r=cI();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return r.KeywordCxt}});var o=cb();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=cA(),i=cM(),s=cE(),n=cq(),l=cb(),c=cN(),u=cP(),d=c_(),p=cz(),h=cV(),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 b=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,s,n,l,c,u,d,p,m,y,g,v,b,_,S,$,w,E,R,P,k,O;let T=t.strict,x=null==(r=t.code)?void 0:r.optimize,j=!0===x||void 0===x?1:x||0,C=null!=(a=null==(o=t.code)?void 0:o.regExp)?a:f,N=null!=(i=t.uriResolver)?i:h.default;return{strictSchema:null==(n=null!=(s=t.strictSchema)?s:T)||n,strictNumbers:null==(c=null!=(l=t.strictNumbers)?l:T)||c,strictTypes:null!=(d=null!=(u=t.strictTypes)?u:T)?d:"log",strictTuples:null!=(m=null!=(p=t.strictTuples)?p:T)?m:"log",strictRequired:null!=(g=null!=(y=t.strictRequired)?y:T)&&g,code:t.code?{...t.code,optimize:j,regExp:C}:{optimize:j,regExp:C},loopRequired:null!=(v=t.loopRequired)?v:200,loopEnum:null!=(b=t.loopEnum)?b:200,meta:null==(_=t.meta)||_,messages:null==(S=t.messages)||S,inlineRefs:null==($=t.inlineRefs)||$,schemaId:null!=(w=t.schemaId)?w:"$id",addUsedSchema:null==(E=t.addUsedSchema)||E,validateSchema:null==(R=t.validateSchema)||R,validateFormats:null==(P=t.validateFormats)||P,unicodeRegExp:null==(k=t.unicodeRegExp)||k,int32range:null==(O=t.int32range)||O,uriResolver:N}}(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 P;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,s.getRules)(),_.call(this,g,t,"NOT SUPPORTED"),_.call(this,v,t,"DEPRECATED","warn"),this._metaOpts=R.call(this),t.formats&&w.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&E.call(this,t.keywords),"object"==typeof t.meta&&this.addMetaSchema(t.meta),$.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 s.call(this,t.$schema);let o=this._addSchema(t,r);return o.validate||n.call(this,o)}async function s(t){t&&!this.getSchema(t)&&await a.call(this,{$ref:t},!0)}async function n(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),n.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 s.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 n.SchemaEnv({schema:{},schemaId:o});if(!(r=n.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(O.call(this,o,r),!r)return(0,d.eachItem)(o,t=>T.call(this,t)),this;j.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=>T.call(this,t,a):t=>a.type.forEach(r=>T.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,s=i[t];a&&s&&(i[t]=N(s))}}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 s,{schemaId:l}=this.opts;if("object"==typeof t)s=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)(s||o);let d=c.getSchemaRefs.call(this,t,o);return u=new n.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):n.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{n.compileSchema.call(this,t)}finally{this.opts=r}}};function _(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 $(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let r in t)this.addSchema(t[r],r)}function w(){for(let t in this.opts.formats){let r=this.opts.formats[t];r&&this.addFormat(t,r)}}function 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 R(){let t={...this.opts};for(let r of m)delete t[r];return t}b.ValidationError=a.default,b.MissingRefError=i.default,t.default=b;let P={log(){},warn(){},error(){}},k=/^[a-z_$][a-z0-9_$:-]*$/i;function O(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 a;let i=null==r?void 0:r.post;if(o&&i)throw Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,n=i?s.post:s.rules.find(({type:t})=>t===o);if(n||(n={type:o,rules:[]},s.rules.push(n)),s.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?x.call(this,n,l,r.before):n.rules.push(l),s.all[t]=l,null==(a=r.implements)||a.forEach(t=>this.addKeyword(t))}function x(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 j(t){let{metaSchema:r}=t;void 0!==r&&(t.$data&&this.opts.$data&&(r=N(r)),t.validateSchema=this.compile(r,!0))}let C={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function N(t){return{anyOf:[t,C]}}}),cH=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}}}),cK=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;let r=cM(),o=cO(),a=cb(),i=cS(),s=cq(),n=c_();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,s,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==s?void 0:s.validate)?void 0:r.evaluated;if(!0!==u.props)if(o&&!o.dynamicProps)void 0!==o.props&&(u.props=n.mergeEvaluated.props(c,o.props,u.props));else{let r=c.var("props",(0,a._)`${t}.evaluated.props`);u.props=n.mergeEvaluated.props(c,r,u.props,a.Name)}if(!0!==u.items)if(o&&!o.dynamicItems)void 0!==o.items&&(u.items=n.mergeEvaluated.items(c,o.items,u.items));else{let r=c.var("items",(0,a._)`${t}.evaluated.items`);u.items=n.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 n,u,d,{gen:p,schema:h,it:f}=t,{baseId:m,schemaEnv:y,validateName:g,opts:v,self:b}=f,{root:_}=y;if(("#"===h||"#/"===h)&&m===_.baseId){if(y===_)return c(t,g,y,y.$async);let r=p.scopeValue("root",{ref:_});return c(t,(0,a._)`${r}.validate`,_,_.$async)}let S=s.resolveRef.call(b,_,m,h);if(void 0===S)throw new r.default(f.opts.uriResolver,m,h);return S instanceof s.SchemaEnv?void c(t,l(t,o=S),o,o.$async):(i=S,n=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:n,errSchemaPath:h},u),void(t.mergeEvaluated(d),t.ok(u)))}}}),cJ=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cH(),o=cK();t.default=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",r.default,o.default]}),cB=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb(),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:s}=t;t.fail$data((0,r._)`${i} ${a[o].fail} ${s} || isNaN(${i})`)}}}),cG=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb();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:s}=t,n=s.opts.multipleOfPrecision,l=o.let("res"),c=n?(0,r._)`Math.abs(Math.round(${l}) - ${l}) > 1e-${n}`:(0,r._)`${l} !== parseInt(${l})`;t.fail$data((0,r._)`(${i} === 0 || (${l} = ${a}/${i}, ${c}))`)}}}),cZ=ea(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'}),cW=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb(),o=c_(),a=cZ();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:s,schemaCode:n,it:l}=t,c="maxLength"===i?r.operators.GT:r.operators.LT,u=!1===l.opts.unicode?(0,r._)`${s}.length`:(0,r._)`${(0,o.useFunc)(t.gen,a.default)}(${s})`;t.fail$data((0,r._)`${u} ${c} ${n}`)}}}),cX=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cO(),o=c_(),a=cb();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:s,$data:n,schema:l,schemaCode:c,it:u}=t,d=u.opts.unicodeRegExp?"u":"";if(n){let{regExp:r}=u.opts.code,n="new RegExp"===r.code?(0,a._)`new RegExp`:(0,o.useFunc)(i,r),l=i.let("valid");i.try(()=>i.assign(l,(0,a._)`${n}(${c}, ${d}).test(${s})`),()=>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(${s})`)}}}}),cY=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb();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,s="maxProperties"===o?r.operators.GT:r.operators.LT;t.fail$data((0,r._)`Object.keys(${a}).length ${s} ${i}`)}}}),cQ=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cO(),o=cb(),a=c_();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:s,schemaCode:n,data:l,$data:c,it:u}=t,{opts:d}=u;if(!c&&0===s.length)return;let p=s.length>=d.loopRequired;if(u.allErrors?function(){if(p||c)t.block$data(o.nil,h);else for(let o of s)(0,r.checkReportMissingProp)(t,o)}():function(){let a=i.let("missing");if(p||c){let s=i.let("valid",!0);t.block$data(s,()=>{var c,u;return c=a,u=s,void(t.setParams({missingProperty:c}),i.forOf(c,n,()=>{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(s)}else i.if((0,r.checkMissingProp)(t,s,a)),(0,r.reportMissingProp)(t,a),i.else()}(),d.strictRequired){let r=t.parentSchema.properties,{definedProperties:o}=t.it;for(let t of s)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",n,o=>{t.setParams({missingProperty:o}),i.if((0,r.noPropertyInData)(i,l,o,d.ownProperties),()=>t.error())})}}}}),c0=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb();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,s="maxItems"===o?r.operators.GT:r.operators.LT;t.fail$data((0,r._)`${a}.length ${s} ${i}`)}}}),c1=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cj();r.code='require("ajv/dist/runtime/equal").default',t.default=r}),c2=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cP(),o=cb(),a=c_(),i=c1();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:s,data:n,$data:l,schema:c,parentSchema:u,schemaCode:d,it:p}=t;if(!l&&!c)return;let h=s.let("valid"),f=u.items?(0,r.getSchemaTypes)(u.items):[];t.block$data(h,function(){let l=s.let("i",(0,o._)`${n}.length`),c=s.let("j");t.setParams({i:l,j:c}),s.assign(h,!0),s.if((0,o._)`${l} > 1`,()=>(f.length>0&&!f.some(t=>"object"===t||"array"===t)?function(a,i){let l=s.name("item"),c=(0,r.checkDataTypes)(f,l,p.opts.strictNumbers,r.DataType.Wrong),u=s.const("indices",(0,o._)`{}`);s.for((0,o._)`;${a}--;`,()=>{s.let(l,(0,o._)`${n}[${a}]`),s.if(c,(0,o._)`continue`),f.length>1&&s.if((0,o._)`typeof ${l} == "string"`,(0,o._)`${l} += "_"`),s.if((0,o._)`typeof ${u}[${l}] == "number"`,()=>{s.assign(i,(0,o._)`${u}[${l}]`),t.error(),s.assign(h,!1).break()}).code((0,o._)`${u}[${l}] = ${a}`)})}:function(r,l){let c=(0,a.useFunc)(s,i.default),u=s.name("outer");s.label(u).for((0,o._)`;${r}--;`,()=>s.for((0,o._)`${l} = ${r}; ${l}--;`,()=>s.if((0,o._)`${c}(${n}[${r}], ${n}[${l}])`,()=>{t.error(),s.assign(h,!1).break(u)})))})(l,c))},(0,o._)`${d} === false`),t.ok(h)}}}),c9=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb(),o=c_(),a=c1();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:s,$data:n,schemaCode:l,schema:c}=t;n||c&&"object"==typeof c?t.fail$data((0,r._)`!${(0,o.useFunc)(i,a.default)}(${s}, ${l})`):t.fail((0,r._)`${c} !== ${s}`)}}}),c4=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb(),o=c_(),a=c1();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,s,{gen:n,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)(n,a.default);if(h||c)s=n.let("valid"),t.block$data(s,function(){n.assign(s,!1),n.forOf("v",d,t=>n.if((0,r._)`${f()}(${l}, ${t})`,()=>n.assign(s,!0).break()))});else{if(!Array.isArray(u))throw Error("ajv implementation error");let t=n.const("vSchema",d);s=(0,r.or)(...u.map((o,a)=>{var i,s;let n;return i=t,"object"==typeof(n=u[s=a])&&null!==n?(0,r._)`${f()}(${l}, ${i}[${s}])`:(0,r._)`${l} === ${n}`}))}t.pass(s)}}}),c5=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cB(),o=cG(),a=cW(),i=cX(),s=cY(),n=cQ(),l=c0(),c=c2(),u=c9(),d=c4();t.default=[r.default,o.default,a.default,i.default,s.default,n.default,l.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,d.default]}),c3=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;let r=cb(),o=c_();function a(t,a){let{gen:i,schema:s,data:n,keyword:l,it:c}=t;c.items=!0;let u=i.const("len",(0,r._)`${n}.length`);if(!1===s)t.setParams({len:a.length}),t.pass((0,r._)`${u} <= ${a.length}`);else if("object"==typeof s&&!(0,o.alwaysValidSchema)(c,s)){let s=i.var("valid",(0,r._)`${u} <= ${a.length}`);i.if((0,r.not)(s),()=>{var n;return n=s,void i.forRange("i",a.length,u,a=>{t.subschema({keyword:l,dataProp:a,dataPropType:o.Type.Num},n),c.allErrors||i.if((0,r.not)(n),()=>i.break())})}),t.ok(s)}}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:s}=r;Array.isArray(s)?a(t,s):(0,o.checkStrictMode)(i,'"additionalItems" is ignored when "items" is not an array of schemas')}}}),c6=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;let r=cb(),o=c_(),a=cO();function i(t,a,s=t.schema){let{gen:n,parentSchema:l,data:c,keyword:u,it:d}=t;(function(t){let{opts:r,errSchemaPath:i}=d,n=s.length,l=n===t.minItems&&(n===t.maxItems||!1===t[a]);if(r.strictTuples&&!l){let t=`"${u}" is ${n}-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&&s.length&&!0!==d.items&&(d.items=o.mergeEvaluated.items(n,s.length,d.items));let p=n.name("valid"),h=n.const("len",(0,r._)`${c}.length`);s.forEach((a,i)=>{(0,o.alwaysValidSchema)(d,a)||(n.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:s}=t;if(Array.isArray(r))return i(t,"additionalItems",r);s.items=!0,(0,o.alwaysValidSchema)(s,r)||t.ok((0,a.validateArray)(t))}}}),c8=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=c6();t.default={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,r.validateTuple)(t,"items")}}),c7=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb(),o=c_(),a=cO(),i=c3();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:s,it:n}=t,{prefixItems:l}=s;n.items=!0,(0,o.alwaysValidSchema)(n,r)||(l?(0,i.validateAdditionalItems)(t,l):t.ok((0,a.validateArray)(t)))}}}),ue=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb(),o=c_();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:s,schema:n,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=s.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,n)){let o=(0,r._)`${h} >= ${a}`;void 0!==i&&(o=(0,r._)`${o} && ${h} <= ${i}`),t.pass(o);return}u.items=!0;let f=s.name("valid");function m(){let t=s.name("_valid"),o=s.let("count",0);y(t,()=>s.if(t,()=>{var t;return t=o,void(s.code((0,r._)`${t}++`),void 0===i?s.if((0,r._)`${t} >= ${a}`,()=>s.assign(f,!0).break()):(s.if((0,r._)`${t} > ${i}`,()=>s.assign(f,!1).break()),1===a?s.assign(f,!0):s.if((0,r._)`${t} >= ${a}`,()=>s.assign(f,!0))))}))}function y(r,a){s.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,()=>s.if(f,()=>s.break())):0===a?(s.let(f,!0),void 0!==i&&s.if((0,r._)`${c}.length > 0`,m)):(s.let(f,!1),m()),t.result(f,()=>t.reset())}}}),ut=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;let r=cb(),o=c_(),a=cO();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},
|
|
57
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of t.seen.entries()){let o=a[1];if(r===a[0]){i(a);continue}if(t.external){let o=t.external.registry.get(a[0])?.id;if(r!==a[0]&&o){i(a);continue}}if(t.metadataRegistry.get(a[0])?.id||o.cycle){i(a);continue}o.count>1&&"ref"===t.reused&&i(a)}t.external&&(t.sharedDefsExtractedFor=t.external)}let a_=new Set(["type","properties","required","additionalProperties"]),aS=["oneOf","anyOf"];function aw(t){let r=t.additionalProperties;return void 0===r||!1===r||"object"!=typeof r||null===r?null:Object.keys(r).length?r:null}function a$(t){let r=[];for(let a of t){if("object"!=typeof a||"object"!==a.type)return null;for(let t in a)if(!a_.has(t))return null;r.push(a)}let a={},o=new Set;for(let t of r){for(let o in t.properties){if(Object.prototype.hasOwnProperty.call(a,o))continue;let t=[];for(let a of r){let r=a.properties?.[o]??aw(a);null!=r&&(t.some(t=>JSON.stringify(t)===JSON.stringify(r))||t.push(r))}ep(a,o,1===t.length?t[0]:a$(t)??{allOf:t})}for(let r of t.required??[])o.add(r)}let i={type:"object",properties:a};if(o.size&&(i.required=[...o]),r.every(t=>!1===t.additionalProperties))i.additionalProperties=!1;else{let t=[];for(let a of r){let r=aw(a);r&&!t.some(t=>JSON.stringify(t)===JSON.stringify(r))&&t.push(r)}1===t.length?i.additionalProperties=t[0]:t.length>1&&(i.additionalProperties={allOf:t})}return i}function aE(t,r){let a=t.seen.get(r);if(!a)throw Error("Unprocessed schema. This is a bug in Zod.");let o=r=>{let a=t.seen.get(r);if(null===a.ref)return;let i=a.def??a.schema,n={...i},s=a.ref;if(a.ref=null,s){o(s);let a=t.seen.get(s),l=a.schema;if(l.$ref&&("draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target)?(i.allOf=i.allOf??[],i.allOf.push(l)):af(i,l),af(i,n),r._zod.parent===s)for(let t in i)"$ref"!==t&&"allOf"!==t&&(t in n||delete i[t]);if(l.$ref&&a.def)for(let t in i)"$ref"!==t&&"allOf"!==t&&t in a.def&&JSON.stringify(i[t])===JSON.stringify(a.def[t])&&delete i[t]}let l=r._zod.parent;if(l&&l!==s){o(l);let r=t.seen.get(l);if(r?.schema.$ref&&(i.$ref=r.schema.$ref,r.def))for(let t in i)"$ref"!==t&&"allOf"!==t&&t in r.def&&JSON.stringify(i[t])===JSON.stringify(r.def[t])&&delete i[t]}t.override({zodSchema:r,jsonSchema:i,path:a.path??[]})};if(!t.external||t.sharedEmitDoneFor!==t.external){for(let r of[...t.seen.entries()].reverse())o(r[0]);if("openapi-3.0"!==t.target)for(let r of t.seen.entries())!function t(r){let a=r.anyOf;if(!Array.isArray(a)||0===a.length||void 0!==r.type)return;let o=[];for(let r of a){if(!r||"object"!=typeof r)return;t(r);let a=Object.keys(r);if(1!==a.length||"type"!==a[0])return;let i=r.type;for(let t of Array.isArray(i)?i:[i]){if("string"!=typeof t)return;o.includes(t)||o.push(t)}}delete r.anyOf,r.type=1===o.length?o[0]:o}(r[1].def??r[1].schema);for(let r of t.deferred)r();if(t.intersections.length){let r=new Map;for(let a of t.seen.values())for(let t of[a.schema,a.def]){let a=t?.allOf;if(!Array.isArray(a))continue;let o=r.get(a);o?o.push(t):r.set(a,[t])}for(let a of t.intersections)for(let t of r.get(a)??[])!function(t){let r=t.allOf;if(!Array.isArray(r)||r.length<2)return;for(let r of a_)if(r in t)return;let a=r.filter(t=>aS.some(r=>Array.isArray(t[r]))),o=null;if(a.length){let t=a[0],i=aS.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=>a$([...n,t]));if(s.some(t=>!t))return;o={[i]:s}}else o=a$(r);o&&(delete t.allOf,af(t,o))}(t)}}let i={};if("draft-2020-12"===t.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===t.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===t.target?i.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let a=t.external.registry.get(r)?.id;if(!a)throw Error("Schema is missing an `id` property");i.$id=t.external.uri(a)}af(i,a.defId?a.schema:a.def??a.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,ep(s,t.defId,t.def))}t.external&&(t.sharedEmitDoneFor=t.external),t.external||Object.keys(s).length>0&&("draft-2020-12"===t.target?i.$defs=s:i.definitions=s);try{let a=JSON.parse(JSON.stringify(i));return Object.defineProperty(a,"~standard",{value:{...r["~standard"],jsonSchema:{input:aP(r,"input",t.processors),output:aP(r,"output",t.processors)}},enumerable:!1,writable:!1}),a}catch(t){throw Error("Error converting schema to JSON.")}}let aP=(t,r,a={})=>o=>{let{libraryOptions:i,target:n}=o??{},s=am({...i??{},target:n,io:r,processors:a});return ag(t,s),ab(s,t),aE(s,t)},aR=(t,r,a)=>{(void 0===t[r]||a>t[r])&&(t[r]=a)},ak=(t,r,a)=>{(void 0===t[r]||a<t[r])&&(t[r]=a)},ax=(t,r)=>{aR(t,"minimum",r),ak(t,"maximum",r)},aT=(t,r)=>{t.multipleOf??(t.multipleOf=[]),t.multipleOf.includes(r)||t.multipleOf.push(r)},aO=(t,r)=>{t.patterns??(t.patterns=new Set),t.patterns.add(r)},aj=(t,r)=>{t.mime=t.mime?t.mime.filter(t=>r.includes(t)):[...r]},aC=(t,r)=>{t.format=r,r.includes("int")&&(t.isInt=!0)},aA=(t,r)=>aR(t,"minimum",r.minimum),aI=(t,r)=>ak(t,"maximum",r.maximum),aN=t=>(r,a)=>{aC(r,a.format);let[o,i]=t[a.format];aR(r,"minimum",o),ak(r,"maximum",i)},aM={greater_than:(t,r)=>aR(t,r.inclusive?"minimum":"exclusiveMinimum",r.value),less_than:(t,r)=>ak(t,r.inclusive?"maximum":"exclusiveMaximum",r.value),multiple_of:(t,r)=>aT(t,r.value),number_format:aN(eT),bigint_format:aN(eO),min_length:aA,max_length:aI,length_equals:(t,r)=>ax(t,r.length),min_size:aA,max_size:aI,size_equals:(t,r)=>ax(t,r.size),string_format:(t,r)=>{aC(t,r.format),r.pattern&&aO(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)=>aj(t,r.mime)};function aq(t){let r={},a=t._zod.def;for(let o of t._zod.traits.has("$ZodCheck")?[t,...a.checks??[]]:a.checks??[])aM[o._zod.def.check]?.(r,o._zod.def);let o=t._zod.bag;for(let t of(void 0!==o.minimum&&aR(r,"minimum",o.minimum),void 0!==o.exclusiveMinimum&&aR(r,"exclusiveMinimum",o.exclusiveMinimum),void 0!==o.maximum&&ak(r,"maximum",o.maximum),void 0!==o.exclusiveMaximum&&ak(r,"exclusiveMaximum",o.exclusiveMaximum),void 0!==o.multipleOf&&aT(r,o.multipleOf),void 0!==o.format&&(r.format??(r.format=o.format),o.format.includes("int")&&(r.isInt=!0)),o.mime&&aj(r,o.mime),o.patterns??[]))aO(r,t);return r}let az={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},aD=new Map([[rf,/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/],[ry,/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/]]),aL=t=>aD.get(t)??t,aU=(t,r,a,o)=>{a.type="string";let{minimum:i,maximum:n,format:s,patterns:l,contentEncoding:c,laxFormat:u}=aq(t);if("number"==typeof i&&(a.minLength=i),"number"==typeof n&&(a.maxLength=n),s&&(a.format=az[s]??s,""===a.format&&delete a.format,("time"===s||u)&&delete a.format),c&&(a.contentEncoding=c),l&&l.size>0){let t=[...l].map(aL);1===t.length?a.pattern=t[0].source:t.length>1&&(a.allOf=[...t.map(t=>({..."draft-07"===r.target||"draft-04"===r.target||"openapi-3.0"===r.target?{type:"string"}:{},pattern:t.source}))])}},aH=(t,r,a,o)=>{let{minimum:i,maximum:n,multipleOf:s,exclusiveMaximum:l,exclusiveMinimum:c,isInt:u}=aq(t);a.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?(a.minimum=c,a.exclusiveMinimum=!0):a.exclusiveMinimum=c:"number"==typeof i&&(a.minimum=i),p?h?(a.maximum=l,a.exclusiveMaximum=!0):a.exclusiveMaximum=l:"number"==typeof n&&(a.maximum=n),s){let i=new Set;for(let n of s)Number.isFinite(n)&&0!==n?i.add(Math.abs(n)):ay(t,r,a,o,`A multipleOf divisor of ${n} cannot be represented in JSON Schema`);let[n,...l]=i;void 0!==n&&(a.multipleOf=n),l.length&&(a.allOf=[...a.allOf??[],...l.map(t=>({multipleOf:t}))])}},aV=(t,r,a,o)=>{a.type="boolean"},aK=(t,r,a,o)=>{"openapi-3.0"===r.target?(a.type="string",a.nullable=!0,a.enum=[null]):a.type="null"},aF=(t,r,a,o)=>{a.not={}},aJ=(t,r,a,o)=>{},aW=(t,r,a,o)=>{},aB=(t,r,a,o)=>{let i=ei(t._zod.def.entries);if(0===i.length){a.not={};return}i.every(t=>"number"==typeof t)&&(a.type="number"),i.every(t=>"string"==typeof t)&&(a.type="string"),a.enum=i},aG=(t,r,a,o)=>{let i=t._zod.def;if(0===i.values.length){a.not={};return}let n=[];for(let s of i.values)if(void 0===s){if(ay(t,r,a,o,"Literal `undefined` cannot be represented in JSON Schema"))return}else if("bigint"==typeof s){if(ay(t,r,a,o,"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];a.type=null===t?"null":typeof t,"draft-04"===r.target||"openapi-3.0"===r.target?a.enum=[t]:a.const=t}else n.every(t=>"number"==typeof t)&&(a.type="number"),n.every(t=>"string"==typeof t)&&(a.type="string"),n.every(t=>"boolean"==typeof t)&&(a.type="boolean"),n.every(t=>null===t)&&(a.type="null"),a.enum=n},aZ=(t,r,a,o)=>{ay(t,r,a,o,"Custom types cannot be represented in JSON Schema")},aX=(t,r,a,o)=>{ay(t,r,a,o,"Transforms cannot be represented in JSON Schema")},aY=(t,r,a,o)=>{let i=t._zod.def,{minimum:n,maximum:s}=aq(t);"number"==typeof n&&(a.minItems=n),"number"==typeof s&&(a.maxItems=s),a.type="array",a.items=ag(i.element,r,{...o,path:[...o.path,"items"]})};function aQ(t){let r=t._zod.def;return"pipe"===r.type&&r.in._zod.traits.has("$ZodTransform")?aQ(r.out):"catch"===r.type?aQ(r.innerType):t._zod.optin}let a0=(t,r,a,o)=>{let i=t._zod.def,n=i.shape;if(Object.getOwnPropertySymbols(n).length&&ay(t,r,a,o,"Symbol keys cannot be represented in JSON Schema"))return;for(let t in a.type="object",a.properties={},n)ep(a.properties,t,ag(n[t],r,{...o,path:[...o.path,"properties",t]}));let s=[];for(let t of Object.keys(n)){let a=i.shape[t];("input"===r.io?void 0===aQ(a):void 0===a._zod.optout)&&s.push(t)}s.length>0&&(a.required=s),i.catchall?._zod.def.type==="never"?a.additionalProperties=!1:i.catchall?i.catchall&&(a.additionalProperties=ag(i.catchall,r,{...o,path:[...o.path,"additionalProperties"]})):"output"===r.io&&(a.additionalProperties=!1)},a1=(t,r,a,o)=>{let i=t._zod.def,n=!1===i.inclusive,s=i.options.map((t,a)=>ag(t,r,{...o,path:[...o.path,n?"oneOf":"anyOf",a]}));n?a.oneOf=s:a.anyOf=s},a2=(t,r,a,o)=>{let i=t._zod.def,n=ag(i.left,r,{...o,path:[...o.path,"allOf",0]}),s=ag(i.right,r,{...o,path:[...o.path,"allOf",1]}),l=t=>"allOf"in t&&1===Object.keys(t).length,c=[...l(n)?n.allOf:[n],...l(s)?s.allOf:[s]];a.allOf=c,r.intersections.push(c)},a9=new WeakMap,a4=(t,r,a,o)=>{let i=t._zod.def;a.type="object";let n=i.keyType,s=aq(n).patterns;if("loose"===i.mode&&s&&s.size>0){let t=ag(i.valueType,r,{...o,path:[...o.path,"patternProperties","*"]});for(let r of(a.patternProperties={},s))ep(a.patternProperties,aL(r).source,t)}else{if("draft-07"===r.target||"draft-2020-12"===r.target){a.propertyNames=ag(i.keyType,r,{...o,path:[...o.path,"propertyNames"]});let n=a9.get(r);n||(n=[],a9.set(r,n),r.deferred.push(()=>(function(t){let r=new Map;for(let a of t.seen.values())a.def&&!r.has(a.schema)&&r.set(a.schema,a);let a=new Map;for(let o of a9.get(t)??[]){let i=t.seen.get(o),n=(i?.def??i?.schema)?.propertyNames;if(!n||!0===n||a.has(n))continue;let s=function t(r,a,o){if(a.$ref){if(o.has(a))return a;o.add(a);let i=r.get(a)?.def;if(!i)return a;let n=t(r,i,o);return n===i?a:n}for(let i of["anyOf","oneOf"]){let n=a[i];if(!Array.isArray(n))continue;let s=n.map(a=>t(r,a,o));s.some((t,r)=>t!==n[r])&&(a={...a,[i]:s})}let i=Array.isArray(a.type)?a.type:[a.type],n=!i.includes("string")&&i.some(t=>"number"===t||"integer"===t),s=a.enum??(void 0!==a.const?[a.const]:void 0);if(!n&&!s?.some(t=>"number"==typeof t))return a;let{minimum:l,maximum:c,exclusiveMinimum:u,exclusiveMaximum:d,multipleOf:p,format:h,id:f,...m}=a;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")?tw:tS).source)),m}(r,n,new Set);s!==n&&a.set(n,s)}if(a.size)for(let r of t.seen.values())for(let t of[r.schema,r.def]){let r=t&&a.get(t.propertyNames);r&&(t.propertyNames=r)}})(r))),n.push(t)}a.additionalProperties=ag(i.valueType,r,{...o,path:[...o.path,"additionalProperties"]})}let l=n._zod.values,c="input"===r.io&&void 0!==aQ(i.valueType);if(l&&!i.partial&&!c){let t=[...l].filter(t=>"string"==typeof t||"number"==typeof t);t.length>0&&(a.required=t.map(String))}},a5=(t,r,a,o)=>{let i=t._zod.def,n=ag(i.innerType,r,o),s=r.seen.get(t);"openapi-3.0"===r.target?(s.ref=i.innerType,a.nullable=!0):a.anyOf=[n,{type:"null"}]},a6=(t,r,a,o)=>{let i=t._zod.def;ag(i.innerType,r,o),r.seen.get(t).ref=i.innerType},a3=Symbol();function a8(t,r,a,o,i){let n=!1,s=JSON.stringify(t,(t,r)=>"bigint"!=typeof r?r:(n=!0,null));return n?(ay(r,a,o,i,"BigInt defaults cannot be represented in JSON Schema"),a3):JSON.parse(s)}let a7=(t,r,a,o)=>{let i=t._zod.def;ag(i.innerType,r,o),r.seen.get(t).ref=i.innerType;let n=a8(i.defaultValue,t,r,a,o);n!==a3&&(a.default=n)},oe=(t,r,a,o)=>{let i=t._zod.def;if(ag(i.innerType,r,o),r.seen.get(t).ref=i.innerType,"input"!==r.io)return;let n=a8(i.defaultValue,t,r,a,o);n!==a3&&(a._prefault=n)},ot=(t,r,a,o)=>{let i,n=t._zod.def;ag(n.innerType,r,o),r.seen.get(t).ref=n.innerType;try{i=n.catchValue(void 0)}catch{ay(t,r,a,o,"Dynamic catch values are not supported in JSON Schema");return}a.default=i},or=(t,r,a,o)=>{let i=t._zod.def,n=i.in._zod.traits.has("$ZodTransform"),s="input"===r.io?n?i.out:i.in:i.out;ag(s,r,o),r.seen.get(t).ref=s},oa=(t,r,a,o)=>{let i=t._zod.def;ag(i.innerType,r,o),r.seen.get(t).ref=i.innerType,a.readOnly=!0},oo=(t,r,a,o)=>{let i=t._zod.def;ag(i.innerType,r,o),r.seen.get(t).ref=i.innerType},oi=(t,r,a,o)=>{let i=t._zod.innerType;ag(i,r,o),r.seen.get(t).ref=i},on={string:aU,number:aH,boolean:aV,bigint:(t,r,a,o)=>{ay(t,r,a,o,"BigInt cannot be represented in JSON Schema")},symbol:(t,r,a,o)=>{ay(t,r,a,o,"Symbols cannot be represented in JSON Schema")},null:aK,undefined:(t,r,a,o)=>{ay(t,r,a,o,"Undefined cannot be represented in JSON Schema")},void:(t,r,a,o)=>{ay(t,r,a,o,"Void cannot be represented in JSON Schema")},never:aF,any:aJ,unknown:aW,date:(t,r,a,o)=>{ay(t,r,a,o,"Date cannot be represented in JSON Schema")},enum:aB,literal:aG,nan:(t,r,a,o)=>{ay(t,r,a,o,"NaN cannot be represented in JSON Schema")},template_literal:(t,r,a,o)=>{let i=t._zod.pattern;if(!i)throw Error("Pattern not found in template literal");a.type="string",a.pattern=i.source},file:(t,r,a,o)=>{a.type="string",a.format="binary",a.contentEncoding="binary";let{minimum:i,maximum:n,mime:s}=aq(t);void 0!==i&&(a.minLength=i),void 0!==n&&(a.maxLength=n),s&&(0===s.length?a.not={}:1===s.length?a.contentMediaType=s[0]:a.anyOf=s.map(t=>({contentMediaType:t})))},success:(t,r,a,o)=>{a.type="boolean"},custom:aZ,function:(t,r,a,o)=>{ay(t,r,a,o,"Function types cannot be represented in JSON Schema")},transform:aX,map:(t,r,a,o)=>{ay(t,r,a,o,"Map cannot be represented in JSON Schema")},set:(t,r,a,o)=>{ay(t,r,a,o,"Set cannot be represented in JSON Schema")},array:aY,object:a0,union:a1,intersection:a2,tuple:(t,r,a,o)=>{let i=t._zod.def;a.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,a)=>ag(t,r,{...o,path:[...o.path,n,a]})),c=i.rest?ag(i.rest,r,{...o,path:[...o.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!==aQ(t):"optional"===t._zod.optout))break;u--}let d=i.items.length,p=!i.rest;"draft-2020-12"===r.target?(a.prefixItems=l,p?a.items=!1:c&&(a.items=c)):"openapi-3.0"===r.target?(a.items={anyOf:l},c&&a.items.anyOf.push(c)):(a.items=l,p?a.additionalItems=!1:c&&(a.additionalItems=c)),u>0&&(a.minItems=u),p&&(a.maxItems=d);let{minimum:h,maximum:f}=aq(t);"number"==typeof h&&(a.minItems=h),"number"==typeof f&&(a.maxItems=f)},record:a4,nullable:a5,nonoptional:a6,default:a7,prefault:oe,catch:ot,pipe:or,readonly:oa,promise:(t,r,a,o)=>{let i=t._zod.def;ag(i.innerType,r,o),r.seen.get(t).ref=i.innerType},optional:oo,lazy:oi};function os(t,r){if("_idmap"in t){let a=am({...r,processors:on}),o={};for(let r of t._idmap.entries()){let[t,o]=r;ag(o,a)}let i={};for(let n of(a.external={registry:t,uri:r?.uri,defs:o},t._idmap.entries())){let[t,r]=n;ab(a,r),ep(i,t,aE(a,r))}return Object.keys(o).length>0&&(i.__shared={["draft-2020-12"===a.target?"$defs":"definitions"]:o}),{schemas:i}}let a=am({...r,processors:on});return ag(t,a),ab(a,t),aE(a,t)}let ol={get:function(){let t=this._zod;return t.message??(t.message=JSON.stringify(t.def,es,2)),t.message},set:function(t){this._zod.message=t},enumerable:!0,configurable:!0},oc={value:void 0,enumerable:!1},ou=new WeakSet([Object.prototype,Error.prototype]),od=(t,r)=>{t.name="$ZodError",oc.value=r,Object.defineProperty(t,"issues",oc),oc.value=void 0,Object.defineProperty(t,"message",ol);let a=Object.getPrototypeOf(t);ou.has(a)||(ou.add(a),Object.defineProperty(a,"toString",{configurable:!0,enumerable:!1,get(){let t=()=>this.message;return Object.defineProperty(this,"toString",{value:t,configurable:!0,writable:!0}),t},set(t){Object.defineProperty(this,"toString",{value:t,configurable:!0,writable:!0})}}))},op=eX("$ZodError",od);function oh(t,r){return{callee:r?.callee??t,Err:r?.Err}}eX("$ZodError",od,void 0,{Parent:Error});let of=t=>{let r=(a,o,i,n)=>{let s=i?{...i,async:!1}:{async:!1},l=a._zod.run({value:o,issues:[]},s);if(l instanceof Promise)throw new eY;if(l.issues.length){let a=new(n?.Err??t)(l.issues.map(t=>ez(t,s,e1())));throw eb(a,n?.callee??r),a}return l.value};return r},om=t=>{let r=async(a,o,i,n)=>{let s=i?{...i,async:!0}:{async:!0},l=a._zod.run({value:o,issues:[]},s);if(l instanceof Promise&&(l=await l),l.issues.length){let a=new(n?.Err??t)(l.issues.map(t=>ez(t,s,e1())));throw eb(a,n?.callee??r),a}return l.value};return r},oy=t=>(r,a,o)=>{let i=o?{...o,async:!1}:{async:!1},n=r._zod.run({value:a,issues:[]},i);if(n instanceof Promise)throw new eY;return n.issues.length?og(t,n.issues,i):{success:!0,data:n.value}};function og(t,r,a){let o;return{success:!1,get error(){return o||(o=new t(r.map(t=>ez(t,a,e1()))),r=void 0,a=void 0),o},set error(e){o=e,r=void 0,a=void 0}}}let ov=t=>async(r,a,o)=>{let i=o?{...o,async:!0}:{async:!0},n=r._zod.run({value:a,issues:[]},i);return n instanceof Promise&&(n=await n),n.issues.length?og(t,n.issues,i):{success:!0,data:n.value}},ob=Symbol.for("zod.compile.invalid"),o_=Symbol.for("zod.compile.fallback"),oS=async(t,r,a)=>{let o=a?{...a,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),0===i.issues.length},ow=new WeakSet([Object.prototype,Error.prototype]);function o$(t,r,a){Object.defineProperty(t,r,{configurable:!0,enumerable:!1,get(){let t=a(this);return Object.defineProperty(this,r,{value:t,configurable:!0,writable:!0}),t},set(t){Object.defineProperty(this,r,{value:t,configurable:!0,writable:!0})}})}let oE=eX("ZodError",(t,r)=>{op.init(t,r),t.name="ZodError";let a=Object.getPrototypeOf(t);ow.has(a)||(ow.add(a),o$(a,"format",t=>r=>(function(t,r=t=>t.message){let a={_errors:[]},o=(t,i=[])=>{for(let n of t.issues)if("invalid_union"===n.code&&n.errors.length)n.errors.map(t=>o({issues:t},[...i,...n.path]));else if("invalid_key"===n.code)o({issues:n.issues},[...i,...n.path]);else if("invalid_element"===n.code)o({issues:n.issues},[...i,...n.path]);else{let t=[...i,...n.path];if(0===t.length)a._errors.push(r(n));else{let o=a,i=0;for(;i<t.length;){let a=t[i],s=i===t.length-1;if("_errors"===a){s&&o._errors.push(r(n)),i++;continue}Object.prototype.hasOwnProperty.call(o,a)||Object.defineProperty(o,a,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let l=o[a];s&&l._errors.push(r(n)),o=l,i++}}}};return o(t),a})(t,r)),o$(a,"flatten",t=>r=>(function(t,r=t=>t.message){let a={},o=[];for(let s of t.issues)if(s.path.length>0){var i,n;(i=s.path[0],n=()=>[],!Object.prototype.hasOwnProperty.call(a,i)&&("__proto__"===i?Object.defineProperty(a,i,{value:n(),writable:!0,enumerable:!0,configurable:!0}):a[i]=n()),a[i]).push(r(s))}else o.push(r(s));return{formErrors:o,fieldErrors:a}})(t,r)),o$(a,"addIssue",t=>r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,es,2)}),o$(a,"addIssues",t=>r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,es,2)}),Object.defineProperty(a,"isEmpty",{configurable:!0,enumerable:!1,get(){return 0===this.issues.length}}))},void 0,{Parent:Error}),oP=of(oE),oR=om(oE),ok=oy(oE),ox=ov(oE),oT=(h=of(oE),f=(t,r,a,o)=>h(t,r,a?{...a,direction:"backward"}:{direction:"backward"},oh(f,o))),oO=(m=of(oE),y=(t,r,a,o)=>m(t,r,a,oh(y,o))),oj=(g=om(oE),v=async(t,r,a,o)=>{let i=a?{...a,direction:"backward"}:{direction:"backward"};return await g(t,r,i,oh(v,o))}),oC=(b=om(oE),_=async(t,r,a,o)=>await b(t,r,a,oh(_,o))),oA=(t,r,a)=>{let o=a?{...a,direction:"backward"}:{direction:"backward"};return oy(oE)(t,r,o)},oI=(t,r,a)=>oy(oE)(t,r,a),oN=async(t,r,a)=>{let o=a?{...a,direction:"backward"}:{direction:"backward"};return ov(oE)(t,r,o)},oM=async(t,r,a)=>ov(oE)(t,r,a);function oq(){e0.memoizer||e1({memoizer:e7})}let oz=eX("ZodType",(t,r)=>(e0.localeError||e1({localeError:(()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}},r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},a={nan:"NaN"};function o(t,r){return"number"!==t||"number"!=typeof r||Number.isFinite(r)?a[t]??t:String(r)}return a=>{switch(a.code){case"invalid_type":{let t=o(a.expected),r=o(function(t){let r=typeof t;switch(r){case"number":return Number.isNaN(t)?"nan":"number";case"object":if(null===t)return"null";if(Array.isArray(t))return"array";if(t&&Object.getPrototypeOf(t)!==Object.prototype&&"constructor"in t&&t.constructor)return t.constructor.name}return r}(a.input),a.input);return`Invalid input: expected ${t}, received ${r}`}case"invalid_value":if(1===a.values.length)return`Invalid input: expected ${ex(a.values[0])}`;return`Invalid option: expected one of ${en(a.values,"|")}`;case"too_big":{let r=a.exact?"exactly ":a.inclusive?"<=":"<",o=t[a.origin]??null;if(o)return`Too big: expected ${a.origin??"value"} to have ${r}${a.maximum.toString()} ${o.unit??"elements"}`;return`Too big: expected ${a.origin??"value"} to be ${r}${a.maximum.toString()}`}case"too_small":{let r=a.exact?"exactly ":a.inclusive?">=":">",o=t[a.origin]??null;if(o)return`Too small: expected ${a.origin} to have ${r}${a.minimum.toString()} ${o.unit}`;return`Too small: expected ${a.origin} to be ${r}${a.minimum.toString()}`}case"invalid_format":if("starts_with"===a.format)return`Invalid string: must start with "${a.prefix}"`;if("ends_with"===a.format)return`Invalid string: must end with "${a.suffix}"`;if("includes"===a.format)return`Invalid string: must include "${a.includes}"`;if("regex"===a.format)return`Invalid string: must match pattern ${a.pattern}`;return`Invalid ${r[a.format]??a.format}`;case"not_multiple_of":return`Invalid number: must be a multiple of ${a.divisor}`;case"unrecognized_keys":return`Unrecognized key${a.keys.length>1?"s":""}: ${en(a.keys,", ")}`;case"invalid_key":return`Invalid key in ${a.origin}`;case"invalid_union":if(a.options&&Array.isArray(a.options)&&a.options.length>0){let t=a.options.map(t=>`'${t}'`).join(" | ");return`Invalid discriminator value. Expected ${t}`}if(!1===a.inclusive)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${a.origin}`;default:return"Invalid input"}}})()}),tW.init(t,r),t.def=r,t.type=r.type,t),{check(...t){let r=this.def;return this.clone(ev(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 eR(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 iX({type:"custom",check:"custom",fn:t,...ek(r)})}(t,r))},superRefine(t,r){return this.check(function(t,r){var a;let o,i;return a=r=>(r.addIssue=t=>{"string"==typeof t?r.issues.push(eH(t,r.value,o._zod.def)):(t.fatal&&(t.continue=!1),t.code??(t.code="custom"),"input"in t||(t.input=r.value),t.inst??(t.inst=o),t.continue??(t.continue=!o._zod.def.abort),r.issues.push(eH(t)))},t(r.value,r)),(i=new tk({check:"custom",...ek(r)}))._zod.check=a,o=i}(t,r))},overwrite(t){return this.check(ah(t))},optional(){return iq(this)},exactOptional(){var t;return t=this,new iz({type:"optional",innerType:t})},nullable(){return iL(this)},nullish(){return iq(iL(this))},nonoptional(t){var r;return r=this,new iV({type:"nonoptional",innerType:r,...ek(t)})},array(){return iv(this)},or(t){return i$([this,t])},and(t){return ik(this,t)},transform(t){return iJ(this,iN(t))},default(t){var r,a;return r=this,a=t,new iU({type:"default",innerType:r,get defaultValue(){return"function"==typeof a?a():e$(a)}})},prefault(t){var r,a;return r=this,a=t,new iH({type:"prefault",innerType:r,get defaultValue(){return"function"==typeof a?a():e$(a)}})},catch(t){return function(t,r){let a;return new iK({type:"catch",innerType:t,catchValue:"function"==typeof r?r:((a=()=>r)["~constantCatch"]=!0,a)})}(this,t)},pipe(t){return iJ(this,t)},readonly(){var t;return t=this,new iB({type:"readonly",innerType:t})},describe(t){let r=this.clone();return r7.add(r,{description:t}),r},meta(...t){if(0===t.length)return r7.get(this);let r=this.clone();return r7.add(r,t[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(t,...r){return 0===r.length?t(this):t(this,...r)},get"~standard"(){return eV(this,"~standard",{...tZ(this),jsonSchema:{input:aP(this,"input"),output:aP(this,"output")}},!1)},set"~standard"(value){eV(this,"~standard",value)},parse:function t(r,a){return oP(this,r,a,{callee:t})},parseAsync:async function t(r,a){return await oR(this,r,a,{callee:t})},safeParse(t,r){return ok(this,t,r)},async safeParseAsync(t,r){return ox(this,t,r)},get spa(){return this?.safeParseAsync},set spa(value){eV(this,"spa",value)},validate(t,r){let a=this._zod.bag.validator;if(void 0!==a){if(a(t)!==ob)return!0;if(!0===a.definite&&void 0===r)return!1}return function(t,r,a){let o,i=a?{...a,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},n=t._zod.bag.fallbackRun;if(n?(i[o_]=!0,o=n({value:r,issues:[]},i)):o=t._zod.run({value:r,issues:[]},i),o instanceof Promise)throw new eY;return 0===o.issues.length}(this,t,r)},validateAsync(t,r){return oS(this,t,r)},encode:function t(r,a){return oT(this,r,a,{callee:t})},decode:function t(r,a){return oO(this,r,a,{callee:t})},encodeAsync:async function t(r,a){return await oj(this,r,a,{callee:t})},decodeAsync:async function t(r,a){return await oC(this,r,a,{callee:t})},safeEncode(t,r){return oA(this,t,r)},safeDecode(t,r){return oI(this,t,r)},async safeEncodeAsync(t,r){return oN(this,t,r)},async safeDecodeAsync(t,r){return oM(this,t,r)},toJSONSchema(t){return((t,r={})=>a=>{let o=am({...a,processors:r});return ag(t,o),ab(o,t),aE(o,t)})(this,{})(t)},get description(){return r7.get(this)?.description},get _def(){return this._zod.def}}),oD=eX("_ZodString",(t,r)=>{tX.init(t,r),oz.init(t,r),t._zod.processJSONSchema=(r,a,o)=>aU(t,r,a,o)},eK({format:t=>aq(t).format??null,minLength:t=>aq(t).minimum??null,maxLength:t=>aq(t).maximum??null},{regex(...t){return this.check(function(t,r){return new tz({check:"string_format",format:"regex",...ek(r),pattern:t})}(...t))},includes(...t){return this.check(function(t,r){return new tU({check:"string_format",format:"includes",...ek(r),includes:t})}(...t))},startsWith(...t){return this.check(function(t,r){return new tH({check:"string_format",format:"starts_with",...ek(r),prefix:t})}(...t))},endsWith(...t){return this.check(function(t,r){return new tV({check:"string_format",format:"ends_with",...ek(r),suffix:t})}(...t))},min(...t){return this.check(ad(...t))},max(...t){return this.check(au(...t))},length(...t){return this.check(ap(...t))},nonempty(...t){return this.check(ad(1,...t))},lowercase(t){return this.check(new tD({check:"string_format",format:"lowercase",...ek(t)}))},uppercase(t){return this.check(new tL({check:"string_format",format:"uppercase",...ek(t)}))},trim(){return this.check(ah(t=>t.trim()))},normalize(...t){return this.check(function(t){return ah(r=>r.normalize(t))}(...t))},toLowerCase(){return this.check(ah(t=>t.toLowerCase()))},toUpperCase(){return this.check(ah(t=>t.toUpperCase()))},slugify(){return this.check(ah(t=>t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")))}})),oL=eX("ZodString",(t,r)=>{tX.init(t,r),oD.init(t,r)},{email(t){return this.check(at(oW,t))},url(t){return this.check(ar(oZ,t))},jwt(t){return this.check(new it({type:"string",format:"jwt",check:"string_format",abort:!1,...ek(t)}))},emoji(t){return this.check(new oX({type:"string",format:"emoji",check:"string_format",abort:!1,...ek(t)}))},guid(t){return this.check(new oB({type:"string",format:"guid",check:"string_format",abort:!1,...ek(t)}))},uuid(t){return this.check(new oG({type:"string",format:"uuid",check:"string_format",abort:!1,...ek(t)}))},uuidv4(t){return this.check(new oG({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ek(t)}))},uuidv6(t){return this.check(new oG({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ek(t)}))},uuidv7(t){return this.check(new oG({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ek(t)}))},nanoid(t){return this.check(new oY({type:"string",format:"nanoid",check:"string_format",abort:!1,...ek(t)}))},cuid(t){return this.check(new oQ({type:"string",format:"cuid",check:"string_format",abort:!1,...ek(t)}))},cuid2(t){return this.check(new o0({type:"string",format:"cuid2",check:"string_format",abort:!1,...ek(t)}))},ulid(t){return this.check(new o1({type:"string",format:"ulid",check:"string_format",abort:!1,...ek(t)}))},base64(t){return this.check(new o8({type:"string",format:"base64",check:"string_format",abort:!1,...ek(t)}))},base64url(t){return this.check(new o7({type:"string",format:"base64url",check:"string_format",abort:!1,...ek(t)}))},xid(t){return this.check(new o2({type:"string",format:"xid",check:"string_format",abort:!1,...ek(t)}))},ksuid(t){return this.check(new o9({type:"string",format:"ksuid",check:"string_format",abort:!1,...ek(t)}))},ipv4(t){return this.check(new o4({type:"string",format:"ipv4",check:"string_format",abort:!1,...ek(t)}))},ipv6(t){return this.check(new o5({type:"string",format:"ipv6",check:"string_format",abort:!1,...ek(t)}))},cidrv4(t){return this.check(new o6({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ek(t)}))},cidrv6(t){return this.check(new o3({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ek(t)}))},e164(t){return this.check(new ie({type:"string",format:"e164",check:"string_format",abort:!1,...ek(t)}))},datetime(t){return this.check(aa(oV,t))},date(t){return this.check(ao(oK,t))},time(t){return this.check(new oF({type:"string",format:"time",check:"string_format",precision:null,...ek(t)}))},duration(t){return this.check(new oJ({type:"string",format:"duration",check:"string_format",...ek(t)}))}});function oU(t){return new oL(ae({type:"string",...ek(t)}))}let oH=eX("ZodStringFormat",(t,r)=>{tY.init(t,r),oD.init(t,r)}),oV=eX("ZodISODateTime",(t,r)=>{ra.init(t,r),oH.init(t,r)}),oK=eX("ZodISODate",(t,r)=>{ro.init(t,r),oH.init(t,r)}),oF=eX("ZodISOTime",(t,r)=>{ri.init(t,r),oH.init(t,r)}),oJ=eX("ZodISODuration",(t,r)=>{rn.init(t,r),oH.init(t,r)}),oW=eX("ZodEmail",(t,r)=>{t1.init(t,r),oH.init(t,r)}),oB=eX("ZodGUID",(t,r)=>{tQ.init(t,r),oH.init(t,r)}),oG=eX("ZodUUID",(t,r)=>{t0.init(t,r),oH.init(t,r)}),oZ=eX("ZodURL",(t,r)=>{t5.init(t,r),oH.init(t,r)}),oX=eX("ZodEmoji",(t,r)=>{t6.init(t,r),oH.init(t,r)}),oY=eX("ZodNanoID",(t,r)=>{t3.init(t,r),oH.init(t,r)}),oQ=eX("ZodCUID",(t,r)=>{t8.init(t,r),oH.init(t,r)}),o0=eX("ZodCUID2",(t,r)=>{t7.init(t,r),oH.init(t,r)}),o1=eX("ZodULID",(t,r)=>{re.init(t,r),oH.init(t,r)}),o2=eX("ZodXID",(t,r)=>{rt.init(t,r),oH.init(t,r)}),o9=eX("ZodKSUID",(t,r)=>{rr.init(t,r),oH.init(t,r)}),o4=eX("ZodIPv4",(t,r)=>{rs.init(t,r),oH.init(t,r)}),o5=eX("ZodIPv6",(t,r)=>{ru.init(t,r),oH.init(t,r)}),o6=eX("ZodCIDRv4",(t,r)=>{rd.init(t,r),oH.init(t,r)}),o3=eX("ZodCIDRv6",(t,r)=>{rp.init(t,r),oH.init(t,r)}),o8=eX("ZodBase64",(t,r)=>{rm.init(t,r),oH.init(t,r)}),o7=eX("ZodBase64URL",(t,r)=>{rg.init(t,r),oH.init(t,r)}),ie=eX("ZodE164",(t,r)=>{rv.init(t,r),oH.init(t,r)}),it=eX("ZodJWT",(t,r)=>{rb.init(t,r),oH.init(t,r)}),ir=eX("ZodNumber",(t,r)=>{r_.init(t,r),oz.init(t,r),t._zod.processJSONSchema=(r,a,o)=>aH(t,r,a,o),t.isFinite=!0},eK({minValue:t=>{let{minimum:r,exclusiveMinimum:a}=aq(t);return Math.max(r??-1/0,a??-1/0)},maxValue:t=>{let{maximum:r,exclusiveMaximum:a}=aq(t);return Math.min(r??1/0,a??1/0)},isInt:t=>{let{isInt:r,multipleOf:a}=aq(t);return!!r||!!a?.some(Number.isSafeInteger)},format:t=>aq(t).format??null},{gt(t,r){return this.check(as(t,r))},gte(t,r){return this.check(al(t,r))},min(t,r){return this.check(al(t,r))},lt(t,r){return this.check(ai(t,r))},lte(t,r){return this.check(an(t,r))},max(t,r){return this.check(an(t,r))},int(t){return this.check(ii(t))},safe(t){return this.check(ii(t))},positive(t){return this.check(as(0,t))},nonnegative(t){return this.check(al(0,t))},negative(t){return this.check(ai(0,t))},nonpositive(t){return this.check(an(0,t))},multipleOf(t,r){return this.check(ac(t,r))},step(t,r){return this.check(ac(t,r))},finite(){return this}}));function ia(t){return new ir(ae({type:"number",checks:[],...ek(t)}))}let io=eX("ZodNumberFormat",(t,r)=>{rS.init(t,r),ir.init(t,r)});function ii(t){return new io({type:"number",check:"number_format",abort:!1,format:"safeint",...ek(t)})}let is=eX("ZodBoolean",(t,r)=>{rw.init(t,r),oz.init(t,r),t._zod.processJSONSchema=(r,a,o)=>aV(t,r,a,o)});function il(t){return new is({type:"boolean",...ek(t)})}let ic=eX("ZodNull",(t,r)=>{r$.init(t,r),oz.init(t,r),t._zod.processJSONSchema=(r,a,o)=>aK(t,r,a,o)});function iu(t){return new ic({type:"null",...ek(t)})}let id=eX("ZodAny",(t,r)=>{rE.init(t,r),oz.init(t,r),t._zod.processJSONSchema=(r,a,o)=>aJ(t,r,a,o)});function ip(){return new id({type:"any"})}let ih=eX("ZodUnknown",(t,r)=>{rP.init(t,r),oz.init(t,r),t._zod.processJSONSchema=(r,a,o)=>aW(t,r,a,o)});function im(){return new ih({type:"unknown"})}let iy=eX("ZodNever",(t,r)=>{rR.init(t,r),oz.init(t,r),t._zod.processJSONSchema=(r,a,o)=>aF(t,r,a,o)}),ig=eX("ZodArray",(t,r)=>{oq(),rx.init(t,r),oz.init(t,r),t._zod.processJSONSchema=(r,a,o)=>aY(t,r,a,o),t.element=r.element},{min(t,r){return this.check(ad(t,r))},nonempty(t){return this.check(ad(1,t))},max(t,r){return this.check(au(t,r))},length(t,r){return this.check(ap(t,r))},unwrap(){return this.element}});function iv(t,r){return new ig({type:"array",element:t,...ek(r)})}let ib=eX("ZodObject",(t,r)=>{var a;let o,i;oq(),rI.init(t,r),oz.init(t,r),t._zod.processJSONSchema=(r,a,o)=>a0(t,r,a,o),a="shape",(i=a in(o=Object.getPrototypeOf(t))?void 0:o)&&Object.defineProperty(i,a,{configurable:!0,get(){let t={configurable:!0,writable:!0,enumerable:!1,value:void 0};return Object.defineProperty(this,a,t),t.value=(t=>t._zod.def.shape)(this),Object.defineProperty(this,a,t),t.value},set(t){Object.defineProperty(this,a,{configurable:!0,writable:!0,enumerable:!1,value:t})}})},{keyof(){return ij(Object.keys(this._zod.def.shape))},catchall(t){return this.clone(ev(this._zod.def,{catchall:t}))},passthrough(){return this.clone(ev(this._zod.def,{catchall:im()}))},loose(){return this.clone(ev(this._zod.def,{catchall:im()}))},strict(){return this.clone(ev(this._zod.def,{catchall:new iy({type:"never",...ek(void 0)})}))},strip(){return this.clone(ev(this._zod.def,{catchall:void 0}))},extend(t){if(!ew(t))throw Error("Invalid input to extend: expected a plain object");let r=this._zod.def.checks;if(r&&r.length>0){let r=ef(this);for(let a of Reflect.ownKeys(t))if(void 0!==Object.getOwnPropertyDescriptor(r,a))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return eR(this,ev(this._zod.def,{shape:eC(this,t)}))},safeExtend(t){if(!ew(t))throw Error("Invalid input to safeExtend: expected a plain object");return eR(this,ev(this._zod.def,{shape:eC(this,t)}))},merge(t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(this._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};return eg(r,this,Reflect.ownKeys(ef(this))),eg(r,t,Reflect.ownKeys(ef(t))),eR(this,ev(this._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))},pick(t){return function(t,r){let a=t._zod.def,o=a.checks;if(o&&o.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return eg(i,t,ej(t,r)),eR(t,ev(a,{shape:i,checks:[]}))}(this,t)},omit(t){return function(t,r){let a=t._zod.def,o=a.checks;if(o&&o.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(ej(t,r)),n={};return eg(n,t,Reflect.ownKeys(ef(t)).filter(t=>!i.has(t))),eR(t,ev(a,{shape:n,checks:[]}))}(this,t)},partial(...t){return eA(iM,this,t[0])},exactPartial(...t){return eA(iz,this,t[0],"exactPartial")},required(...t){var r;let a,o;return a=(r=t[0])?new Set(ej(this,r)):void 0,eg(o={},this,Reflect.ownKeys(ef(this)),(t,r)=>a&&!a.has(r)?t:new iV({type:"nonoptional",innerType:t})),eR(this,ev(this._zod.def,{shape:o}))}});function i_(t,r){return new ib({type:"object",shape:t??{},...ek(r)})}function iS(t,r){return new ib({type:"object",shape:t,catchall:im(),...ek(r)})}let iw=eX("ZodUnion",(t,r)=>{rM.init(t,r),oz.init(t,r),t._zod.processJSONSchema=(r,a,o)=>a1(t,r,a,o),t.options=r.options});function i$(t,r){return new iw({type:"union",options:t,...ek(r)})}let iE=eX("ZodDiscriminatedUnion",(t,r)=>{iw.init(t,r),rq.init(t,r)});function iP(t,r,a){return new iE({type:"union",options:r,discriminator:t,...ek(a)})}let iR=eX("ZodIntersection",(t,r)=>{rz.init(t,r),oz.init(t,r),t._zod.processJSONSchema=(r,a,o)=>a2(t,r,a,o)});function ik(t,r){return new iR({type:"intersection",left:t,right:r})}let ix=eX("ZodRecord",(t,r)=>{oq(),rL.init(t,r),oz.init(t,r),t._zod.processJSONSchema=(r,a,o)=>a4(t,r,a,o),t.keyType=r.keyType,t.valueType=r.valueType});function iT(t,r,a){return new ix(r&&r._zod?{type:"record",keyType:t,valueType:r,...ek(a)}:{type:"record",keyType:oU(),valueType:t,...ek(r)})}let iO=eX("ZodEnum",(t,r)=>{rU.init(t,r),oz.init(t,r),t._zod.processJSONSchema=(r,a,o)=>aB(t,r,a,o),t.enum=r.entries,t.options=[...t._zod.values];let a=new Set(Object.keys(r.entries));t.extract=(t,o)=>{let i={};for(let o of t)if(a.has(o))i[o]=r.entries[o];else throw Error(`Key ${o} not found in enum`);return new iO({...r,checks:[],...ek(o),entries:i})},t.exclude=(t,o)=>{let i={...r.entries};for(let r of t)if(a.has(r))delete i[r];else throw Error(`Key ${r} not found in enum`);return new iO({...r,checks:[],...ek(o),entries:i})}});function ij(t,r){return new iO({type:"enum",entries:Array.isArray(t)?Object.fromEntries(t.map(t=>[t,t])):t,...ek(r)})}let iC=eX("ZodLiteral",(t,r)=>{rH.init(t,r),oz.init(t,r),t._zod.processJSONSchema=(r,a,o)=>aG(t,r,a,o),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 iA(t,r){return new iC({type:"literal",values:Array.isArray(t)?t:[t],...ek(r)})}let iI=eX("ZodTransform",(t,r)=>{oq(),rV.init(t,r),oz.init(t,r),t._zod.processJSONSchema=(r,a,o)=>aX(t,r,a,o),t._zod.parse=(a,o)=>{if("backward"===o.direction)throw new eQ(t.constructor.name);a.addIssue=o=>{"string"==typeof o?a.issues.push(eH(o,a.value,r)):(o.fatal&&(o.continue=!1),o.code??(o.code="custom"),"input"in o||(o.input=a.value),o.inst??(o.inst=t),a.issues.push(eH(o)))};let i=r.transform(a.value,a);return i instanceof Promise?i.then(t=>(a.value=t,a)):(a.value=i,a)}});function iN(t){return new iI({type:"transform",transform:t})}let iM=eX("ZodOptional",(t,r)=>{rF.init(t,r),oz.init(t,r),t._zod.processJSONSchema=(r,a,o)=>oo(t,r,a,o),t.unwrap=()=>t._zod.def.innerType});function iq(t){return new iM({type:"optional",innerType:t})}let iz=eX("ZodExactOptional",(t,r)=>{rJ.init(t,r),oz.init(t,r),t._zod.processJSONSchema=(r,a,o)=>oo(t,r,a,o),t.unwrap=()=>t._zod.def.innerType}),iD=eX("ZodNullable",(t,r)=>{rW.init(t,r),oz.init(t,r),t._zod.processJSONSchema=(r,a,o)=>a5(t,r,a,o),t.unwrap=()=>t._zod.def.innerType});function iL(t){return new iD({type:"nullable",innerType:t})}let iU=eX("ZodDefault",(t,r)=>{rB.init(t,r),oz.init(t,r),t._zod.processJSONSchema=(r,a,o)=>a7(t,r,a,o),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap}),iH=eX("ZodPrefault",(t,r)=>{rZ.init(t,r),oz.init(t,r),t._zod.processJSONSchema=(r,a,o)=>oe(t,r,a,o),t.unwrap=()=>t._zod.def.innerType}),iV=eX("ZodNonOptional",(t,r)=>{rX.init(t,r),oz.init(t,r),t._zod.processJSONSchema=(r,a,o)=>a6(t,r,a,o),t.unwrap=()=>t._zod.def.innerType}),iK=eX("ZodCatch",(t,r)=>{r0.init(t,r),oz.init(t,r),t._zod.processJSONSchema=(r,a,o)=>ot(t,r,a,o),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap}),iF=eX("ZodPipe",(t,r)=>{r1.init(t,r),oz.init(t,r),t._zod.processJSONSchema=(r,a,o)=>or(t,r,a,o),t.in=r.in,t.out=r.out});function iJ(t,r){return new iF({type:"pipe",in:t,out:r})}let iW=eX("ZodPreprocess",(t,r)=>{iF.init(t,r),r9.init(t,r)}),iB=eX("ZodReadonly",(t,r)=>{r4.init(t,r),oz.init(t,r),t._zod.processJSONSchema=(r,a,o)=>oa(t,r,a,o),t.unwrap=()=>t._zod.def.innerType}),iG=eX("ZodLazy",(t,r)=>{r6.init(t,r),oz.init(t,r),t._zod.processJSONSchema=(r,a,o)=>oi(t,r,a,o),t.unwrap=()=>t._zod.def.getter()});function iZ(t){return new iG({type:"lazy",getter:t})}let iX=eX("ZodCustom",(t,r)=>{r3.init(t,r),oz.init(t,r),t._zod.processJSONSchema=(r,a,o)=>aZ(t,r,a,o)});function iY(t,r){return new iW({type:"pipe",in:iN(t),out:r})}function iQ(t){return aa(oV,t)}let i0="custom";function i1(t){return new ir(ae({type:"number",coerce:!0,checks:[],...ek(t)}))}j||(j={});let i2="io.modelcontextprotocol/protocolVersion",i9="io.modelcontextprotocol/serverInfo",i4="io.modelcontextprotocol/clientCapabilities",i5=iZ(()=>i$([oU(),ia(),il(),iu(),iT(oU(),i5),iv(i5)])),i6=iT(oU(),i5),i3=iv(i5),i8=i$([oU(),ia().int()]),i7=oU(),ne=i_({ttl:ia().optional()}),nt=i_({taskId:oU()}),nr=iS({progressToken:i8.optional(),"io.modelcontextprotocol/related-task":nt.optional()}),na=i_({_meta:nr.optional()}),no=na.extend({task:ne.optional()}),ni=i_({method:oU(),params:na.loose().optional()}),nn=i_({_meta:nr.optional()}),ns=i_({method:oU(),params:nn.loose().optional()}),nl=iS({get[i9](){return n$.optional().catch(void 0)}}),nc=iS({_meta:nl.optional()}),nu=i$([oU(),ia().int()]),nd=i_({jsonrpc:iA("2.0"),id:nu,...ni.shape}).strict(),np=i_({jsonrpc:iA("2.0"),...ns.shape}).strict(),nh=i_({jsonrpc:iA("2.0"),id:nu,result:nc}).strict(),nf=i_({jsonrpc:iA("2.0"),id:nu.optional(),error:i_({code:ia().int(),message:oU(),data:im().optional()})}).strict(),nm=i$([nd,np,nh,nf]),ny=i$([nh,nf]),ng=nc.strict(),nv=nn.extend({requestId:nu.optional(),reason:oU().optional()}),nb=ns.extend({method:iA("notifications/cancelled"),params:nv}),n_=i_({src:oU(),mimeType:oU().optional(),sizes:iv(oU()).optional(),theme:ij(["light","dark"]).optional()}),nS=i_({icons:iv(n_).optional()}),nw=i_({name:oU(),title:oU().optional()}),n$=nw.extend({...nw.shape,...nS.shape,version:oU(),websiteUrl:oU().optional(),description:oU().optional()}),nE=ik(i_({applyDefaults:il().optional()}),i6),nP=iY(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,ik(i_({form:nE.optional(),url:i6.optional()}),i6.optional())),nR=iS({list:i6.optional(),cancel:i6.optional(),requests:iS({sampling:iS({createMessage:i6.optional()}).optional(),elicitation:iS({create:i6.optional()}).optional()}).optional()}),nk=iS({list:i6.optional(),cancel:i6.optional(),requests:iS({tools:iS({call:i6.optional()}).optional()}).optional()}),nx=i_({experimental:iT(oU(),i6).optional(),sampling:i_({context:i6.optional(),tools:i6.optional()}).optional(),elicitation:nP.optional(),roots:i_({listChanged:il().optional()}).optional(),tasks:nR.optional(),extensions:iT(oU(),i6).optional()}),nT=na.extend({protocolVersion:oU(),capabilities:nx,clientInfo:n$}),nO=ni.extend({method:iA("initialize"),params:nT}),nj=i_({experimental:iT(oU(),i6).optional(),logging:i6.optional(),completions:i6.optional(),prompts:i_({listChanged:il().optional()}).optional(),resources:i_({subscribe:il().optional(),listChanged:il().optional()}).optional(),tools:i_({listChanged:il().optional()}).optional(),tasks:nk.optional(),extensions:iT(oU(),i6).optional()}),nC=nc.extend({protocolVersion:oU(),capabilities:nj,serverInfo:n$,instructions:oU().optional()}),nA=ns.extend({method:iA("notifications/initialized"),params:nn.optional()}),nI=ni.extend({method:iA("server/discover"),params:na.optional()}),nN=nc.extend({supportedVersions:iv(oU()),capabilities:nj,instructions:oU().optional()}),nM=ni.extend({method:iA("ping"),params:na.optional()}),nq=i_({progress:ia(),total:iq(ia()),message:iq(oU())}),nz=i_({...nn.shape,...nq.shape,progressToken:i8}),nD=ns.extend({method:iA("notifications/progress"),params:nz}),nL=na.extend({cursor:i7.optional()}),nU=ni.extend({params:nL.optional()}),nH=nc.extend({nextCursor:i7.optional()}),nV=i_({uri:oU(),mimeType:iq(oU()),_meta:iT(oU(),im()).optional()}),nK=nV.extend({text:oU()}),nF=oU().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),nJ=nV.extend({blob:nF}),nW=ij(["user","assistant"]),nB=i_({audience:iv(nW).optional(),priority:ia().min(0).max(1).optional(),lastModified:iQ({offset:!0}).optional()}),nG=i_({...nw.shape,...nS.shape,uri:oU(),description:iq(oU()),mimeType:iq(oU()),size:iq(ia()),annotations:nB.optional(),_meta:iq(iS({}))}),nZ=i_({...nw.shape,...nS.shape,uriTemplate:oU(),description:iq(oU()),mimeType:iq(oU()),annotations:nB.optional(),_meta:iq(iS({}))}),nX=nU.extend({method:iA("resources/list")}),nY=nH.extend({resources:iv(nG)}),nQ=nU.extend({method:iA("resources/templates/list")}),n0=nH.extend({resourceTemplates:iv(nZ)}),n1=na.extend({uri:oU()}),n2=ni.extend({method:iA("resources/read"),params:n1}),n9=nc.extend({contents:iv(i$([nK,nJ]))}),n4=ns.extend({method:iA("notifications/resources/list_changed"),params:nn.optional()}),n5=ni.extend({method:iA("resources/subscribe"),params:n1}),n6=ni.extend({method:iA("resources/unsubscribe"),params:n1}),n3=i_({toolsListChanged:il().optional(),promptsListChanged:il().optional(),resourcesListChanged:il().optional(),resourceSubscriptions:iv(oU()).optional()}),n8=na.extend({notifications:n3}),n7=ni.extend({method:iA("subscriptions/listen"),params:n8}),se=nn.extend({notifications:n3}),st=ns.extend({method:iA("notifications/subscriptions/acknowledged"),params:se}),sr=nl.extend({"io.modelcontextprotocol/subscriptionId":nu}),sa=nc.extend({_meta:sr}),so=nn.extend({uri:oU()}),si=ns.extend({method:iA("notifications/resources/updated"),params:so}),sn=i_({name:oU(),description:iq(oU()),required:iq(il())}),ss=i_({...nw.shape,...nS.shape,description:iq(oU()),arguments:iq(iv(sn)),_meta:iq(iS({}))}),sl=nU.extend({method:iA("prompts/list")}),sc=nH.extend({prompts:iv(ss)}),su=na.extend({name:oU(),arguments:iT(oU(),oU()).optional()}),sd=ni.extend({method:iA("prompts/get"),params:su}),sp=i_({type:iA("text"),text:oU(),annotations:nB.optional(),_meta:iT(oU(),im()).optional()}),sh=i_({type:iA("image"),data:nF,mimeType:oU(),annotations:nB.optional(),_meta:iT(oU(),im()).optional()}),sf=i_({type:iA("audio"),data:nF,mimeType:oU(),annotations:nB.optional(),_meta:iT(oU(),im()).optional()}),sm=i_({type:iA("tool_use"),name:oU(),id:oU(),input:iT(oU(),im()),_meta:iT(oU(),im()).optional()}),sy=i_({type:iA("resource"),resource:i$([nK,nJ]),annotations:nB.optional(),_meta:iT(oU(),im()).optional()}),sg=nG.extend({type:iA("resource_link")}),sv=i$([sp,sh,sf,sg,sy]),sb=i_({role:nW,content:sv}),s_=nc.extend({description:oU().optional(),messages:iv(sb)}),sS=ns.extend({method:iA("notifications/prompts/list_changed"),params:nn.optional()}),sw=i_({title:oU().optional(),readOnlyHint:il().optional(),destructiveHint:il().optional(),idempotentHint:il().optional(),openWorldHint:il().optional()}),s$=i_({taskSupport:ij(["required","optional","forbidden"]).optional()}),sE=i_({...nw.shape,...nS.shape,description:oU().optional(),inputSchema:i_({type:iA("object"),properties:iT(oU(),i5).optional(),required:iv(oU()).optional()}).catchall(im()),outputSchema:iS({$schema:oU().optional()}).optional(),annotations:sw.optional(),execution:s$.optional(),_meta:iT(oU(),im()).optional()}),sP=nU.extend({method:iA("tools/list")}),sR=nH.extend({tools:iv(sE)}),sk=nc.extend({content:iv(sv).default([]),structuredContent:im().optional(),isError:il().optional()}),sx=sk.or(nc.extend({toolResult:im()})),sT=no.extend({name:oU(),arguments:iT(oU(),im()).optional()}),sO=ni.extend({method:iA("tools/call"),params:sT}),sj=ns.extend({method:iA("notifications/tools/list_changed"),params:nn.optional()}),sC=i_({autoRefresh:il().default(!0),debounceMs:ia().int().nonnegative().default(300)}),sA=ij(["debug","info","notice","warning","error","critical","alert","emergency"]),sI=na.extend({level:sA}),sN=ni.extend({method:iA("logging/setLevel"),params:sI}),sM=nn.extend({level:sA,logger:oU().optional(),data:im()}),sq=ns.extend({method:iA("notifications/message"),params:sM}),sz=i_({name:oU().optional()}),sD=i_({hints:iv(sz).optional(),costPriority:ia().min(0).max(1).optional(),speedPriority:ia().min(0).max(1).optional(),intelligencePriority:ia().min(0).max(1).optional()}),sL=i_({mode:ij(["auto","required","none"]).optional()}),sU=i_({type:iA("tool_result"),toolUseId:oU().describe("The unique identifier for the corresponding tool call."),content:iv(sv),structuredContent:im().optional(),isError:il().optional(),_meta:iT(oU(),im()).optional()}),sH=iP("type",[sp,sh,sf]),sV=iP("type",[sp,sh,sf,sm,sU]),sK=i_({role:nW,content:i$([sV,iv(sV)]),_meta:iT(oU(),im()).optional()}),sF=no.extend({messages:iv(sK),modelPreferences:sD.optional(),systemPrompt:oU().optional(),includeContext:ij(["none","thisServer","allServers"]).optional(),temperature:ia().optional(),maxTokens:ia().int(),stopSequences:iv(oU()).optional(),metadata:i6.optional(),tools:iv(sE).optional(),toolChoice:sL.optional()}),sJ=ni.extend({method:iA("sampling/createMessage"),params:sF}),sW=nc.extend({model:oU(),stopReason:iq(ij(["endTurn","stopSequence","maxTokens"]).or(oU())),role:nW,content:sH}),sB=nc.extend({model:oU(),stopReason:iq(ij(["endTurn","stopSequence","maxTokens","toolUse"]).or(oU())),role:nW,content:i$([sV,iv(sV)])}),sG=i_({type:iA("boolean"),title:oU().optional(),description:oU().optional(),default:il().optional()}),sZ=i_({type:iA("string"),title:oU().optional(),description:oU().optional(),minLength:ia().optional(),maxLength:ia().optional(),format:ij(["email","uri","date","date-time"]).optional(),default:oU().optional()}),sX=i_({type:ij(["number","integer"]),title:oU().optional(),description:oU().optional(),minimum:ia().optional(),maximum:ia().optional(),default:ia().optional()}),sY=i_({type:iA("string"),title:oU().optional(),description:oU().optional(),enum:iv(oU()),default:oU().optional()}),sQ=i_({type:iA("string"),title:oU().optional(),description:oU().optional(),oneOf:iv(i_({const:oU(),title:oU()})),default:oU().optional()}),s0=i_({type:iA("string"),title:oU().optional(),description:oU().optional(),enum:iv(oU()),enumNames:iv(oU()).optional(),default:oU().optional()}),s1=i$([sY,sQ]),s2=i_({type:iA("array"),title:oU().optional(),description:oU().optional(),minItems:ia().optional(),maxItems:ia().optional(),items:i_({type:iA("string"),enum:iv(oU())}),default:iv(oU()).optional()}),s9=i_({type:iA("array"),title:oU().optional(),description:oU().optional(),minItems:ia().optional(),maxItems:ia().optional(),items:i_({anyOf:iv(i_({const:oU(),title:oU()}))}),default:iv(oU()).optional()}),s4=i$([s2,s9]),s5=i$([s0,s1,s4]),s6=i$([s5,sG,sZ,sX]),s3=no.extend({mode:iA("form").optional(),message:oU(),requestedSchema:i_({type:iA("object"),properties:iT(oU(),s6),required:iv(oU()).optional()}).catchall(im())}),s8=no.extend({mode:iA("url"),message:oU(),elicitationId:oU(),url:oU().url()}),s7=i$([s3,s8]),le=ni.extend({method:iA("elicitation/create"),params:s7}),lt=nn.extend({elicitationId:oU()}),lr=ns.extend({method:iA("notifications/elicitation/complete"),params:lt}),la=nc.extend({action:ij(["accept","decline","cancel"]),content:iY(t=>null===t?void 0:t,iT(oU(),i$([oU(),ia(),il(),iv(oU())])).optional())}),lo=i_({type:iA("ref/resource"),uri:oU()}),li=i_({type:iA("ref/prompt"),name:oU()}),ln=na.extend({ref:i$([li,lo]),argument:i_({name:oU(),value:oU()}),context:i_({arguments:iT(oU(),oU()).optional()}).optional()}),ls=ni.extend({method:iA("completion/complete"),params:ln}),ll=nc.extend({completion:iS({values:iv(oU()).max(100),total:iq(ia().int()),hasMore:iq(il())})}),lc=i_({uri:oU().startsWith("file://"),name:oU().optional(),_meta:iT(oU(),im()).optional()}),lu=ni.extend({method:iA("roots/list"),params:na.optional()}),ld=nc.extend({roots:iv(lc)}),lp=ns.extend({method:iA("notifications/roots/list_changed"),params:nn.optional()}),lh=iS({ttl:ia().optional(),pollInterval:ia().optional()}),lf=ij(["working","input_required","completed","failed","cancelled"]),lm=i_({taskId:oU(),status:lf,ttl:i$([ia(),iu()]),createdAt:oU(),lastUpdatedAt:oU(),pollInterval:iq(ia()),statusMessage:iq(oU())}),ly=nc.extend({task:lm}),lg=nn.merge(lm),lv=ns.extend({method:iA("notifications/tasks/status"),params:lg}),lb=ni.extend({method:iA("tasks/get"),params:na.extend({taskId:oU()})}),l_=nc.merge(lm),lS=ni.extend({method:iA("tasks/result"),params:na.extend({taskId:oU()})}),lw=nc.loose(),l$=nU.extend({method:iA("tasks/list")}),lE=nH.extend({tasks:iv(lm)}),lP=ni.extend({method:iA("tasks/cancel"),params:na.extend({taskId:oU()})}),lR=nc.merge(lm),lk=i$([nM,nO,nI,ls,sN,sd,sl,nX,nQ,n2,n5,n6,n7,sO,sP]),lx=i$([nb,nD,nA,lp]),lT=i$([ng,sW,sB,la,ld]),lO=i$([nM,sJ,le,lu]),lj=i$([nb,nD,sq,si,n4,sj,sS,st,lr]),lC=i$([ng,nC,nN,ll,s_,sc,nY,n0,n9,sk,sR,sa]),lA=ar(oZ,void 0).superRefine((t,r)=>{if(!URL.canParse(t))return r.addIssue({code:i0,message:"URL must be parseable",fatal:!0}),eB}).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"}),lI=iS({resource:oU().url(),authorization_servers:iv(lA).optional(),jwks_uri:oU().url().optional(),scopes_supported:iv(oU()).optional(),bearer_methods_supported:iv(oU()).optional(),resource_signing_alg_values_supported:iv(oU()).optional(),resource_name:oU().optional(),resource_documentation:oU().optional(),resource_policy_uri:oU().url().optional(),resource_tos_uri:oU().url().optional(),tls_client_certificate_bound_access_tokens:il().optional(),authorization_details_types_supported:iv(oU()).optional(),dpop_signing_alg_values_supported:iv(oU()).optional(),dpop_bound_access_tokens_required:il().optional()}),lN=iS({issuer:oU(),authorization_endpoint:lA,token_endpoint:lA,registration_endpoint:lA.optional(),scopes_supported:iv(oU()).optional(),response_types_supported:iv(oU()),response_modes_supported:iv(oU()).optional(),grant_types_supported:iv(oU()).optional(),token_endpoint_auth_methods_supported:iv(oU()).optional(),token_endpoint_auth_signing_alg_values_supported:iv(oU()).optional(),service_documentation:lA.optional(),revocation_endpoint:lA.optional(),revocation_endpoint_auth_methods_supported:iv(oU()).optional(),revocation_endpoint_auth_signing_alg_values_supported:iv(oU()).optional(),introspection_endpoint:oU().optional(),introspection_endpoint_auth_methods_supported:iv(oU()).optional(),introspection_endpoint_auth_signing_alg_values_supported:iv(oU()).optional(),code_challenge_methods_supported:iv(oU()).optional(),client_id_metadata_document_supported:il().optional(),authorization_response_iss_parameter_supported:il().optional().catch(void 0)}),lM=iS({issuer:oU(),authorization_endpoint:lA,token_endpoint:lA,userinfo_endpoint:lA.optional(),jwks_uri:lA,registration_endpoint:lA.optional(),scopes_supported:iv(oU()).optional(),response_types_supported:iv(oU()),response_modes_supported:iv(oU()).optional(),grant_types_supported:iv(oU()).optional(),acr_values_supported:iv(oU()).optional(),subject_types_supported:iv(oU()),id_token_signing_alg_values_supported:iv(oU()),id_token_encryption_alg_values_supported:iv(oU()).optional(),id_token_encryption_enc_values_supported:iv(oU()).optional(),userinfo_signing_alg_values_supported:iv(oU()).optional(),userinfo_encryption_alg_values_supported:iv(oU()).optional(),userinfo_encryption_enc_values_supported:iv(oU()).optional(),request_object_signing_alg_values_supported:iv(oU()).optional(),request_object_encryption_alg_values_supported:iv(oU()).optional(),request_object_encryption_enc_values_supported:iv(oU()).optional(),token_endpoint_auth_methods_supported:iv(oU()).optional(),token_endpoint_auth_signing_alg_values_supported:iv(oU()).optional(),display_values_supported:iv(oU()).optional(),claim_types_supported:iv(oU()).optional(),claims_supported:iv(oU()).optional(),service_documentation:oU().optional(),claims_locales_supported:iv(oU()).optional(),ui_locales_supported:iv(oU()).optional(),claims_parameter_supported:il().optional(),request_parameter_supported:il().optional(),request_uri_parameter_supported:il().optional(),require_request_uri_registration:il().optional(),op_policy_uri:lA.optional(),op_tos_uri:lA.optional(),client_id_metadata_document_supported:il().optional(),authorization_response_iss_parameter_supported:il().optional().catch(void 0)}),lq=i_({...lM.shape,...lN.pick({code_challenge_methods_supported:!0}).shape}),lz=i_({access_token:oU(),id_token:oU().optional(),token_type:oU(),expires_in:i1().optional(),scope:oU().optional(),refresh_token:oU().optional()}).strip(),lD=i_({issued_token_type:iA("urn:ietf:params:oauth:token-type:id-jag"),access_token:oU(),token_type:oU().optional(),expires_in:ia().optional(),scope:oU().optional()}).strip(),lL=i_({error:oU(),error_description:oU().optional(),error_uri:oU().optional()}),lU=lA.optional().or(iA("").transform(()=>void 0)),lH=i_({redirect_uris:iv(lA),token_endpoint_auth_method:oU().optional(),grant_types:iv(oU()).optional(),response_types:iv(oU()).optional(),application_type:oU().optional(),client_name:oU().optional(),client_uri:lA.optional(),logo_uri:lU,scope:oU().optional(),contacts:iv(oU()).optional(),tos_uri:lU,policy_uri:oU().optional(),jwks_uri:lA.optional(),jwks:ip().optional(),software_id:oU().optional(),software_version:oU().optional(),software_statement:oU().optional()}).strip(),lV=i_({client_id:oU(),client_secret:oU().optional(),client_id_issued_at:ia().optional(),client_secret_expires_at:ia().optional()}).strip(),lK=lH.merge(lV),lF=i_({error:oU(),error_description:oU().optional()}).strip(),lJ=i_({token:oU(),token_type_hint:oU().optional()}).strip(),lW=Symbol.for("mcp.sdk.errorBrands");function lB(t,r){let a=new Set,o=r;for(;"function"==typeof o;){let t=o.mcpBrand;Object.prototype.hasOwnProperty.call(o,"mcpBrand")&&"string"==typeof t&&a.add(t),o=Object.getPrototypeOf(o)}0!==a.size&&Object.defineProperty(t,lW,{value:a,enumerable:!1,configurable:!0})}function lG(t,r){try{if("object"==typeof r&&null!==r&&Object.prototype.hasOwnProperty.call(t,"mcpBrand")&&"string"==typeof t.mcpBrand&&Object.prototype.hasOwnProperty.call(r,lW)){let a=r[lW];if(a&&"function"==typeof a.has&&a.has(t.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(t,r)}(class t extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return lG(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 lG(this,t)}constructor(t,r,a){super(r),this.code=t,this.errorUri=a,this.name="OAuthError",lB(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)}});(w={}).NotConnected="NOT_CONNECTED",w.AlreadyConnected="ALREADY_CONNECTED",w.NotInitialized="NOT_INITIALIZED",w.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",w.RequestTimeout="REQUEST_TIMEOUT",w.ConnectionClosed="CONNECTION_CLOSED",w.SendFailed="SEND_FAILED",w.InvalidResult="INVALID_RESULT",w.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",w.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",w.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",w.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",w.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",w.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",w.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",w.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",w.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",w.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",w.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION";var lZ=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](t){return lG(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 lG(this,t)}constructor(t,r,a){super(r),this.code=t,this.data=a,this.name="SdkError",lB(this,new.target)}};(class extends lZ{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(t,r,a){super(t,r,a),this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}});let lX={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},lY={"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};Object.keys(lX),Object.keys(lY);Symbol("modelcontextprotocol.resultCacheHintFallback");let lQ=(($={})[$.ParseError=-32700]="ParseError",$[$.InvalidRequest=-32600]="InvalidRequest",$[$.MethodNotFound=-32601]="MethodNotFound",$[$.InvalidParams=-32602]="InvalidParams",$[$.InternalError=-32603]="InternalError",$[$.ResourceNotFound=-32002]="ResourceNotFound",$[$.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",$[$.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",$[$.UrlElicitationRequired=-32042]="UrlElicitationRequired",$);var l0=class t extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return lG(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 lG(this,t)}constructor(t,r,a){super(r),this.code=t,this.data=a,this.name="ProtocolError",lB(this,new.target)}static fromError(r,a,o){return r===lQ.UrlElicitationRequired&&o&&o.elicitations?new l2(o.elicitations,a):r===lQ.UnsupportedProtocolVersion&&o&&Array.isArray(o.supported)&&"string"==typeof o.requested?new l9({supported:o.supported,requested:o.requested},a):(r===lQ.InvalidParams||r===lQ.ResourceNotFound)&&"string"==typeof o?.uri&&(r===lQ.ResourceNotFound||1===Object.keys(o).length)?new l1(o.uri,a):r===lQ.MissingRequiredClientCapability&&o&&null!==o.requiredCapabilities&&"object"==typeof o.requiredCapabilities&&!Array.isArray(o.requiredCapabilities)?new l4({requiredCapabilities:o.requiredCapabilities},a):new t(r,a,o)}},l1=class extends l0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(t,r=`Resource not found: ${t}`){super(lQ.InvalidParams,r,{uri:t})}get uri(){return this.data.uri}},l2=class extends l0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(lQ.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}},l9=class extends l0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(t,r=`Unsupported protocol version: ${t.requested}`){super(lQ.UnsupportedProtocolVersion,r,t)}get supported(){return this.data.supported}get requested(){return this.data.requested}},l4=class extends l0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(t,r=`Missing required client capabilities: ${Object.keys(t.requiredCapabilities).join(", ")}`){super(lQ.MissingRequiredClientCapability,r,t)}get requiredCapabilities(){return this.data.requiredCapabilities}};let l5={"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},l6={"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};Object.keys(l5),Object.keys(l6);var l3=((t,r)=>{let a={};for(var o in t)Q(a,o,{get:t[o],enumerable:!0});return r&&Q(a,Symbol.toStringTag,{value:"Module"}),a})({AnnotationsSchema:()=>nB,AudioContentSchema:()=>sf,BaseMetadataSchema:()=>nw,BaseRequestParamsSchema:()=>na,BlobResourceContentsSchema:()=>nJ,BooleanSchemaSchema:()=>sG,CallToolRequestParamsSchema:()=>sT,CallToolRequestSchema:()=>sO,CallToolResultSchema:()=>sk,CancelTaskRequestSchema:()=>lP,CancelTaskResultSchema:()=>lR,CancelledNotificationParamsSchema:()=>nv,CancelledNotificationSchema:()=>nb,ClientCapabilitiesSchema:()=>nx,ClientNotificationSchema:()=>lx,ClientRequestSchema:()=>lk,ClientResultSchema:()=>lT,ClientTasksCapabilitySchema:()=>nR,CompatibilityCallToolResultSchema:()=>sx,CompleteRequestParamsSchema:()=>ln,CompleteRequestSchema:()=>ls,CompleteResultSchema:()=>ll,ContentBlockSchema:()=>sv,CreateMessageRequestParamsSchema:()=>sF,CreateMessageRequestSchema:()=>sJ,CreateMessageResultSchema:()=>sW,CreateMessageResultWithToolsSchema:()=>sB,CreateTaskResultSchema:()=>ly,CursorSchema:()=>i7,DiscoverRequestSchema:()=>nI,DiscoverResultSchema:()=>nN,ElicitRequestFormParamsSchema:()=>s3,ElicitRequestParamsSchema:()=>s7,ElicitRequestSchema:()=>le,ElicitRequestURLParamsSchema:()=>s8,ElicitResultSchema:()=>la,ElicitationCompleteNotificationParamsSchema:()=>lt,ElicitationCompleteNotificationSchema:()=>lr,EmbeddedResourceSchema:()=>sy,EmptyResultSchema:()=>ng,EnumSchemaSchema:()=>s5,GetPromptRequestParamsSchema:()=>su,GetPromptRequestSchema:()=>sd,GetPromptResultSchema:()=>s_,GetTaskPayloadRequestSchema:()=>lS,GetTaskPayloadResultSchema:()=>lw,GetTaskRequestSchema:()=>lb,GetTaskResultSchema:()=>l_,IconSchema:()=>n_,IconsSchema:()=>nS,ImageContentSchema:()=>sh,ImplementationSchema:()=>n$,InitializeRequestParamsSchema:()=>nT,InitializeRequestSchema:()=>nO,InitializeResultSchema:()=>nC,InitializedNotificationSchema:()=>nA,JSONArraySchema:()=>i3,JSONObjectSchema:()=>i6,JSONRPCErrorResponseSchema:()=>nf,JSONRPCMessageSchema:()=>nm,JSONRPCNotificationSchema:()=>np,JSONRPCRequestSchema:()=>nd,JSONRPCResponseSchema:()=>ny,JSONRPCResultResponseSchema:()=>nh,JSONValueSchema:()=>i5,LegacyTitledEnumSchemaSchema:()=>s0,ListChangedOptionsBaseSchema:()=>sC,ListPromptsRequestSchema:()=>sl,ListPromptsResultSchema:()=>sc,ListResourceTemplatesRequestSchema:()=>nQ,ListResourceTemplatesResultSchema:()=>n0,ListResourcesRequestSchema:()=>nX,ListResourcesResultSchema:()=>nY,ListRootsRequestSchema:()=>lu,ListRootsResultSchema:()=>ld,ListTasksRequestSchema:()=>l$,ListTasksResultSchema:()=>lE,ListToolsRequestSchema:()=>sP,ListToolsResultSchema:()=>sR,LoggingLevelSchema:()=>sA,LoggingMessageNotificationParamsSchema:()=>sM,LoggingMessageNotificationSchema:()=>sq,ModelHintSchema:()=>sz,ModelPreferencesSchema:()=>sD,MultiSelectEnumSchemaSchema:()=>s4,NotificationSchema:()=>ns,NotificationsParamsSchema:()=>nn,NumberSchemaSchema:()=>sX,PaginatedRequestParamsSchema:()=>nL,PaginatedRequestSchema:()=>nU,PaginatedResultSchema:()=>nH,PingRequestSchema:()=>nM,PrimitiveSchemaDefinitionSchema:()=>s6,ProgressNotificationParamsSchema:()=>nz,ProgressNotificationSchema:()=>nD,ProgressSchema:()=>nq,ProgressTokenSchema:()=>i8,PromptArgumentSchema:()=>sn,PromptListChangedNotificationSchema:()=>sS,PromptMessageSchema:()=>sb,PromptReferenceSchema:()=>li,PromptSchema:()=>ss,ReadResourceRequestParamsSchema:()=>n1,ReadResourceRequestSchema:()=>n2,ReadResourceResultSchema:()=>n9,RelatedTaskMetadataSchema:()=>nt,RequestIdSchema:()=>nu,RequestMetaSchema:()=>nr,RequestSchema:()=>ni,ResourceContentsSchema:()=>nV,ResourceLinkSchema:()=>sg,ResourceListChangedNotificationSchema:()=>n4,ResourceRequestParamsSchema:()=>n1,ResourceSchema:()=>nG,ResourceTemplateReferenceSchema:()=>lo,ResourceTemplateSchema:()=>nZ,ResourceUpdatedNotificationParamsSchema:()=>so,ResourceUpdatedNotificationSchema:()=>si,ResultMetaObjectSchema:()=>nl,ResultSchema:()=>nc,RoleSchema:()=>nW,RootSchema:()=>lc,RootsListChangedNotificationSchema:()=>lp,SamplingContentSchema:()=>sH,SamplingMessageContentBlockSchema:()=>sV,SamplingMessageSchema:()=>sK,ServerCapabilitiesSchema:()=>nj,ServerNotificationSchema:()=>lj,ServerRequestSchema:()=>lO,ServerResultSchema:()=>lC,ServerTasksCapabilitySchema:()=>nk,SetLevelRequestParamsSchema:()=>sI,SetLevelRequestSchema:()=>sN,SingleSelectEnumSchemaSchema:()=>s1,StringSchemaSchema:()=>sZ,SubscribeRequestParamsSchema:()=>n1,SubscribeRequestSchema:()=>n5,SubscriptionFilterSchema:()=>n3,SubscriptionsAcknowledgedNotificationParamsSchema:()=>se,SubscriptionsAcknowledgedNotificationSchema:()=>st,SubscriptionsListenRequestParamsSchema:()=>n8,SubscriptionsListenRequestSchema:()=>n7,SubscriptionsListenResultMetaSchema:()=>sr,SubscriptionsListenResultSchema:()=>sa,TaskAugmentedRequestParamsSchema:()=>no,TaskCreationParamsSchema:()=>lh,TaskMetadataSchema:()=>ne,TaskSchema:()=>lm,TaskStatusNotificationParamsSchema:()=>lg,TaskStatusNotificationSchema:()=>lv,TaskStatusSchema:()=>lf,TextContentSchema:()=>sp,TextResourceContentsSchema:()=>nK,TitledMultiSelectEnumSchemaSchema:()=>s9,TitledSingleSelectEnumSchemaSchema:()=>sQ,ToolAnnotationsSchema:()=>sw,ToolChoiceSchema:()=>sL,ToolExecutionSchema:()=>s$,ToolListChangedNotificationSchema:()=>sj,ToolResultContentSchema:()=>sU,ToolSchema:()=>sE,ToolUseContentSchema:()=>sm,UnsubscribeRequestParamsSchema:()=>n1,UnsubscribeRequestSchema:()=>n6,UntitledMultiSelectEnumSchemaSchema:()=>s2,UntitledSingleSelectEnumSchemaSchema:()=>sY});let l8=t=>"object"==typeof t&&null!==t&&!Array.isArray(t)&&"input_required"===t.resultType;function l7(t){return new Set(t.flatMap(t=>Object.keys(t.shape)))}function ce(t){if(null==t)return!1;let r=typeof t;return("object"===r||"function"===r)&&"~standard"in t&&"function"==typeof t["~standard"]?.validate}lQ.InvalidRequest,lQ.UnsupportedProtocolVersion,lQ.InvalidParams,lQ.MethodNotFound,lQ.InvalidParams,lQ.MissingRequiredClientCapability,lQ.ParseError,lQ.InvalidRequest,lQ.MethodNotFound,lQ.UnsupportedProtocolVersion,lQ.MissingRequiredClientCapability;let ct=!1,cr="draft-2020-12",ca=/\\\.\\d\{(\d+)\}/;function co(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}let ci=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function cn(t){return ci.has(t)||t.startsWith("x-")}let cs=new Set(["$schema",...Object.keys(s3.shape.requestedSchema.shape)]),cl={string:l7([sZ,sY,sQ,s0]),number:l7([sX]),integer:l7([sX]),boolean:l7([sG]),array:l7([s2,s9])},cc=new Set(sZ.shape.format.unwrap().options),cu=Object.assign(function(t){let r=void 0!==t.inputRequests&&Object.keys(t.inputRequests).length>0,a="string"==typeof t.requestState;if(!r&&!a)throw TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...void 0!==t.inputRequests&&{inputRequests:t.inputRequests},...void 0!==t.requestState&&{requestState:t.requestState}}},{elicit(t){try{return{method:"elicitation/create",params:function(t){var r;if(!ce(t.requestedSchema))return{...t,mode:"form",requestedSchema:t.requestedSchema};let a=t.requestedSchema["~standard"].vendor,o=function(t,r){let a={},o=[];for(let[i,n]of Object.entries(t))"properties"===i&&co(n)?a[i]=Object.fromEntries(Object.entries(n).map(([t,a])=>[t,function(t,r,a,o){if(!co(t))return t;let i="string"==typeof t.type&&Object.hasOwn(cl,t.type)?cl[t.type]:void 0;if(void 0===i)return t;let n={};for(let[l,c]of Object.entries(t))if(i.has(l)||cn(l))n[l]=c;else if("pattern"===l&&"string"===t.type&&"string"==typeof t.format)if(cc.has(t.format)){var s;"string"==typeof c&&(s=t.format,"zod"!==a||(function(t,r){let a;switch(t){case"email":a=[at(oW,void 0)];break;case"uri":a=[ar(oZ,void 0)];break;case"date":a=[ao(oK,void 0)];break;case"date-time":let o,i;o=ca.exec(r),i=[void 0,-1,0],o&&i.push(Number(o[1])),a=[!1,!0].flatMap(t=>[!1,!0].flatMap(r=>i.map(a=>iQ({local:t,offset:r,precision:a}))))}return new Set(a.map(t=>{let r;return r=os(t,{target:cr,io:"input"}),"string"==typeof r.pattern?r.pattern:void 0}).filter(t=>void 0!==t))})(s,c).has(c))||o.push(`${r}.${l}`)}else n[l]=c;else o.push(`${r}.${l}`);return n}(a,`properties.${t}`,r,o)])):cs.has(i)?a[i]=n:cn(i)||o.push(i);if(o.length>0)throw new l0(lQ.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${o.join(", ")}`);return a}(function(t){try{return function(t,r="input"){let a,o=t["~standard"];if(o.jsonSchema)a=o.jsonSchema[r]({target:cr});else if("zod"===o.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().");ct||(ct=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),a=os(t,{target:cr,io:r})}else throw Error(`Schema library "${o.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if("output"===r)return void 0!==a.type||!function t(r){if("properties"in r||"patternProperties"in r||"additionalProperties"in r||"required"in r)return!0;for(let a of["oneOf","anyOf","allOf"]){let o=r[a];if(Array.isArray(o)&&o.length>0)return o.every(r=>null!==r&&"object"==typeof r&&("object"===r.type||t(r)))}return!1}(a)?a:{type:"object",...a};if(void 0!==a.type&&"object"!==a.type)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(a.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...a}}(t,"input")}catch(r){let t=r instanceof Error?r.message:String(r);throw new l0(lQ.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}(t.requestedSchema),a),i=(r=s3.shape.requestedSchema,ok(r,o));if(!i.success)throw new l0(lQ.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${function(t,r){if(!co(t.properties))return r;let a=Object.entries(t.properties).filter(([,t])=>!ok(s6,t).success).map(([t])=>`properties.${t}`);return a.length>0?a.join(", "):r}(o,i.error.message)}`);let n=function t(r,a,o=""){return Array.isArray(r)&&Array.isArray(a)?r.flatMap((r,i)=>t(r,a[i],`${o}[${i}]`)):co(r)&&co(a)?Object.entries(r).flatMap(([r,i])=>{let n=o?`${o}.${r}`:r;return Object.prototype.hasOwnProperty.call(a,r)?t(i,a[r],n):cn(r)?[]:[n]}):[]}(o,i.data);if(n.length>0)throw new l0(lQ.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 l0(lQ.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 l0?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"})});function cd(t,r,a){let o=cp(t,r);if("elicit"!==o.kind||"accept"!==o.action||void 0===o.content)return;if(void 0===a)return o.content;let i=a["~standard"].validate(o.content);if(i instanceof Promise)throw TypeError("acceptedContent(responses, key, schema) requires a synchronously-validating schema");return void 0===i.issues?i.value:void 0}function cp(t,r){if(void 0===t||"object"!=typeof t||null===t)return{kind:"missing"};let a=t[r];if(null===a||"object"!=typeof a||Array.isArray(a))return{kind:"missing"};if("accept"===a.action||"decline"===a.action||"cancel"===a.action){let t=a.content;return{kind:"elicit",action:a.action,...null!==t&&"object"==typeof t&&!Array.isArray(t)&&{content:t}}}return Array.isArray(a.roots)?{kind:"roots",roots:a.roots}:"string"==typeof a.role&&void 0!==a.content?{kind:"sampling",result:a}:{kind:"missing"}}let ch={},cf={};function cm(t,r){let a=t.slice(0,-6);ch[a]=r,cf[a]=t=>r.safeParse(t).success}for(let t of["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"])cm(t,l3[t]);for(let[t,r]of Object.entries({IdJagTokenExchangeResponseSchema:lD,OAuthClientInformationFullSchema:lK,OAuthClientInformationSchema:lV,OAuthClientMetadataSchema:lH,OAuthClientRegistrationErrorSchema:lF,OAuthErrorResponseSchema:lL,OAuthMetadataSchema:lN,OAuthProtectedResourceMetadataSchema:lI,OAuthTokenRevocationRequestSchema:lJ,OAuthTokensSchema:lz,OpenIdProviderDiscoveryMetadataSchema:lq,OpenIdProviderMetadataSchema:lM}))cm(t,r);Object.freeze(ch),Object.freeze(cf);E=void 0,()=>E;eo(t=>{var r=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,a=/\\([\u000b\u0020-\u00ff])/g,o=/^[!#$%&'*+.^_`|~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(!o.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(a,"$1")),p.parameters[n]=l}if(u!==c.length)throw TypeError("invalid parameter format")}return p}})();var cy=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;var r=class{};t._CodeOrName=r,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var a=class extends r{constructor(r){if(super(),!t.IDENTIFIER.test(r))throw Error("CodeGen: name must be a valid identifier");this.str=r}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};t.Name=a;var o=class extends r{constructor(t){super(),this._items="string"==typeof t?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return""===t||'""'===t}get str(){var t;return null!=(t=this._str)?t:this._str=this._items.reduce((t,r)=>`${t}${r}`,"")}get names(){var t;return null!=(t=this._names)?t:this._names=this._items.reduce((t,r)=>(r instanceof a&&(t[r.str]=(t[r.str]||0)+1),t),{})}};function i(t,...r){let a=[t[0]],n=0;for(;n<r.length;)l(a,r[n]),a.push(t[++n]);return new o(a)}t._Code=o,t.nil=new o(""),t._=i;let n=new o("+");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 o,i;let n=(o=t[r-1],'""'===(i=t[r+1])?o:'""'===o?i:"string"==typeof o?i instanceof a||'"'!==o[o.length-1]?void 0:"string"!=typeof i?`${o.slice(0,-1)}${i}"`:'"'===i[0]?o.slice(0,-1)+i.slice(1):void 0:"string"!=typeof i||'"'!==i[0]||o instanceof a?void 0:`"${o}${i.slice(1)}`);if(void 0!==n){t.splice(r-1,3,n);continue}t[r++]="+"}r++}}(i),new o(i)}function l(t,r){var i;r instanceof o?t.push(...r._items):r instanceof a?t.push(r):t.push("number"==typeof(i=r)||"boolean"==typeof i||null===i?i:c(Array.isArray(i)?i.join(","):i))}function c(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.str=s,t.addCodeArg=l,t.strConcat=function(t,r){return r.emptyStr()?t:t.emptyStr()?r:s`${t}${r}`},t.stringify=function(t){return new o(c(t))},t.safeStringify=c,t.getProperty=function(r){return"string"==typeof r&&t.IDENTIFIER.test(r)?new o(`.${r}`):i`[${r}]`},t.getEsmExportName=function(r){if("string"==typeof r&&t.IDENTIFIER.test(r))return new o(`${r}`);throw Error(`CodeGen: invalid export name: ${r}, use explicit $id name mapping`)},t.regexpCode=function(t){return new o(t.toString())}}),cg=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;let r=cy();var a,o,i=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}};(a=o||(t.UsedValueState=o={}))[a.Started=0]="Started",a[a.Completed=1]="Completed",t.varKinds={const:new r.Name("const"),let:new r.Name("let"),var:new r.Name("var")};var 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,a;if((null==(a=null==(r=this._parent)?void 0:r._prefixes)?void 0:a.has(t))||this._prefixes&&!this._prefixes.has(t))throw Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};t.Scope=n;var s=class extends r.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:a,itemIndex:o}){this.value=t,this.scopePath=(0,r._)`.${new r.Name(a)}[${o}]`}};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 a;if(void 0===r.ref)throw Error("CodeGen: ref must be passed in value");let o=this.toName(t),{prefix:i}=o,n=null!=(a=r.key)?a: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,o);let l=this._scope[i]||(this._scope[i]=[]),c=l.length;return l[c]=r.ref,o.setValue(r,{property:i,itemIndex:c}),o}getValue(t,r){let a=this._values[t];if(a)return a.get(r)}scopeRefs(t,a=this._values){return this._reduceValues(a,a=>{if(void 0===a.scopePath)throw Error(`CodeGen: name "${a}" has no value`);return(0,r._)`${t}${a.scopePath}`})}scopeCode(t=this._values,r,a){return this._reduceValues(t,t=>{if(void 0===t.value)throw Error(`CodeGen: name "${t}" has no value`);return t.value.code},r,a)}_reduceValues(a,n,s={},l){let c=r.nil;for(let u in a){let d=a[u];if(!d)continue;let p=s[u]=s[u]||new Map;d.forEach(a=>{if(p.has(a))return;p.set(a,o.Started);let s=n(a);if(s){let o=this.opts.es5?t.varKinds.var:t.varKinds.const;c=(0,r._)`${c}${o} ${a} = ${s};${this.opts._n}`}else if(s=null==l?void 0:l(a))c=(0,r._)`${c}${s}${this.opts._n}`;else throw new i(a);p.set(a,o.Completed)})}return c}};t.ValueScope=c}),cv=eo(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=cy(),a=cg();var o=cy();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return o._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return o.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return o.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return o.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return o.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return o.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return o.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return o.Name}});var i=cg();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,a){super(),this.varKind=t,this.name=r,this.rhs=a}render({es5:t,_n:r}){let o=t?a.varKinds.var:this.varKind,i=void 0===this.rhs?"":` = ${this.rhs}`;return`${o} ${this.name}${i};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=j(this.rhs,t,r)),this}get names(){return this.rhs instanceof r._CodeOrName?this.rhs.names:{}}},l=class extends n{constructor(t,r,a){super(),this.lhs=t,this.rhs=r,this.sideEffects=a}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,a){if(!(this.lhs instanceof r.Name)||t[this.lhs.str]||this.sideEffects)return this.rhs=j(this.rhs,t,a),this}get names(){return O(this.lhs instanceof r.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends l{constructor(t,r,a,o){super(t,a,o),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=j(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,a)=>r+a.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let a=t[r].optimizeNodes();Array.isArray(a)?t.splice(r,1,...a):a?t[r]=a:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:a}=this,o=a.length;for(;o--;){let i=a[o];i.optimizeNames(t,r)||(function(t,r){for(let a in r)t[a]=(t[a]||0)-(r[a]||0)}(t,i.names),a.splice(o,1))}return a.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>T(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 a=this.else;if(a){let t=a.optimizeNodes();a=this.else=Array.isArray(t)?new g(t):t}return a?!1===r?a instanceof t?a:a.nodes:this.nodes.length?this:new t(C(r),a instanceof t?[a]:a.nodes):!1!==r&&this.nodes.length?this:void 0}optimizeNames(t,r){var a;if(this.else=null==(a=this.else)?void 0:a.optimizeNames(t,r),super.optimizeNames(t,r)||this.else)return this.condition=j(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 b=class extends m{};b.kind="for";var _=class extends b{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=j(this.iteration,t,r),this}get names(){return T(super.names,this.iteration.names)}},S=class extends b{constructor(t,r,a,o){super(),this.varKind=t,this.name=r,this.from=a,this.to=o}render(t){let r=t.es5?a.varKinds.var:this.varKind,{name:o,from:i,to:n}=this;return`for(${r} ${o}=${i}; ${o}<${n}; ${o}++)`+super.render(t)}get names(){return O(O(super.names,this.from),this.to)}},w=class extends b{constructor(t,r,a,o){super(),this.loop=t,this.varKind=r,this.name=a,this.iterable=o}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=j(this.iterable,t,r),this}get names(){return T(super.names,this.iterable.names)}},$=class extends m{constructor(t,r,a){super(),this.name=t,this.args=r,this.async=a}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};$.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 a,o;return super.optimizeNames(t,r),null==(a=this.catch)||a.optimizeNames(t,r),null==(o=this.finally)||o.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}},R=class extends m{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};R.kind="catch";var k=class extends m{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 a.Scope({parent:t}),this._nodes=[new y]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let a=this._extScope.value(t,r);return(this._values[a.prefix]||(this._values[a.prefix]=new Set)).add(a),a}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,a,o){let i=this._scope.toName(r);return void 0!==a&&o&&(this._constants[i.str]=a),this._leafNode(new s(t,i,a)),i}const(t,r,o){return this._def(a.varKinds.const,t,r,o)}let(t,r,o){return this._def(a.varKinds.let,t,r,o)}var(t,r,o){return this._def(a.varKinds.var,t,r,o)}assign(t,r,a){return this._leafNode(new l(t,r,a))}add(r,a){return this._leafNode(new c(r,t.operators.ADD,a))}code(t){return"function"==typeof t?t():t!==r.nil&&this._leafNode(new h(t)),this}object(...t){let a=["{"];for(let[o,i]of t)a.length>1&&a.push(","),a.push(o),(o!==i||this.opts.es5)&&(a.push(":"),(0,r.addCodeArg)(a,i));return a.push("}"),new r._Code(a)}if(t,r,a){if(this._blockNode(new v(t)),r&&a)this.code(r).else().code(a).endIf();else if(r)this.code(r).endIf();else if(a)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new v(t))}else(){return this._elseNode(new 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 _(t),r)}forRange(t,r,o,i,n=this.opts.es5?a.varKinds.var:a.varKinds.let){let s=this._scope.toName(t);return this._for(new S(n,s,r,o),()=>i(s))}forOf(t,o,i,n=a.varKinds.const){let s=this._scope.toName(t);if(this.opts.es5){let t=o instanceof r.Name?o:this.var("_arr",o);return this.forRange("_i",0,(0,r._)`${t}.length`,a=>{this.var(s,(0,r._)`${t}[${a}]`),i(s)})}return this._for(new w("of",n,s,o),()=>i(s))}forIn(t,o,i,n=this.opts.es5?a.varKinds.var:a.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,r._)`Object.keys(${o})`,i);let s=this._scope.toName(t);return this._for(new w("in",n,s,o),()=>i(s))}endFor(){return this._endBlockNode(b)}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,a){if(!r&&!a)throw Error('CodeGen: "try" without "catch" and "finally"');let o=new P;if(this._blockNode(o),this.code(t),r){let t=this.name("e");this._currNode=o.catch=new R(t),r(t)}return a&&(this._currNode=o.finally=new k,this.code(a)),this._endBlockNode(R,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 a=this._nodes.length-r;if(a<0||void 0!==t&&a!==t)throw Error(`CodeGen: wrong number of nodes: ${a} vs ${t} expected`);return this._nodes.length=r,this}func(t,a=r.nil,o,i){return this._blockNode(new $(t,a,o)),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 a=this._currNode;if(a instanceof t||r&&a instanceof r)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof v))throw Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};function T(t,r){for(let a in r)t[a]=(t[a]||0)+(r[a]||0);return t}function O(t,a){return a instanceof r._CodeOrName?T(t,a.names):t}function j(t,a,o){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===a[t.str]&&void 0!==o[t.str])))return t;return new r._Code(t._items.reduce((t,a)=>(a instanceof r.Name&&(a=n(a)),a instanceof r._Code?t.push(...a._items):t.push(a),t),[]));function n(t){let r=o[t.str];return void 0===r||1!==a[t.str]?t:(delete a[t.str],r)}}function C(t){return"boolean"==typeof t||"number"==typeof t||null===t?!t:(0,r._)`!${M(t)}`}t.CodeGen=x,t.not=C;let A=N(t.operators.AND);t.and=function(...t){return t.reduce(A)};let I=N(t.operators.OR);function N(t){return(a,o)=>a===r.nil?o:o===r.nil?a:(0,r._)`${M(a)} ${t} ${M(o)}`}function M(t){return t instanceof r.Name?t:(0,r._)`(${t})`}t.or=function(...t){return t.reduce(I)}}),cb=eo(t=>{var r,a;Object.defineProperty(t,"__esModule",{value:!0}),t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.setEvaluated=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.schemaHasRules=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;let o=cv(),i=cy();function n(t,r=t.schema){let{opts:a,self:o}=t;if(!a.strictSchema||"boolean"==typeof r)return;let i=o.RULES.keywords;for(let a in r)i[a]||f(t,`unknown keyword: "${a}"`)}function s(t,r){if("boolean"==typeof t)return!t;for(let a in t)if(r[a])return!0;return!1}function l(t){return"number"==typeof t?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}function c(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function u({mergeNames:t,mergeToName:r,mergeValues:a,resultToName:i}){return(n,s,l,c)=>{let u=void 0===l?s:l instanceof o.Name?(s instanceof o.Name?t(n,s,l):r(n,s,l),l):s instanceof o.Name?(r(n,l,s),s):a(s,l);return c!==o.Name||u instanceof o.Name?u:i(n,u)}}function d(t,r){if(!0===r)return t.var("props",!0);let a=t.var("props",(0,o._)`{}`);return void 0!==r&&p(t,a,r),a}function p(t,r,a){Object.keys(a).forEach(a=>t.assign((0,o._)`${r}${(0,o.getProperty)(a)}`,!0))}t.toHash=function(t){let r={};for(let a of t)r[a]=!0;return r},t.alwaysValidSchema=function(t,r){return"boolean"==typeof r?r:0===Object.keys(r).length||(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 a in t)if("$ref"!==a&&r.all[a])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:t,schemaPath:r},a,i,n){if(!n){if("number"==typeof a||"boolean"==typeof a)return a;if("string"==typeof a)return(0,o._)`${a}`}return(0,o._)`${t}${r}${(0,o.getProperty)(i)}`},t.unescapeFragment=function(t){return c(decodeURIComponent(t))},t.escapeFragment=function(t){return encodeURIComponent(l(t))},t.escapeJsonPointer=l,t.unescapeJsonPointer=c,t.eachItem=function(t,r){if(Array.isArray(t))for(let a of t)r(a);else r(t)},t.mergeEvaluated={props:u({mergeNames:(t,r,a)=>t.if((0,o._)`${a} !== true && ${r} !== undefined`,()=>{t.if((0,o._)`${r} === true`,()=>t.assign(a,!0),()=>t.assign(a,(0,o._)`${a} || {}`).code((0,o._)`Object.assign(${a}, ${r})`))}),mergeToName:(t,r,a)=>t.if((0,o._)`${a} !== true`,()=>{!0===r?t.assign(a,!0):(t.assign(a,(0,o._)`${a} || {}`),p(t,a,r))}),mergeValues:(t,r)=>!0===t||{...t,...r},resultToName:d}),items:u({mergeNames:(t,r,a)=>t.if((0,o._)`${a} !== true && ${r} !== undefined`,()=>t.assign(a,(0,o._)`${r} === true ? true : ${a} > ${r} ? ${a} : ${r}`)),mergeToName:(t,r,a)=>t.if((0,o._)`${a} !== true`,()=>t.assign(a,!0===r||(0,o._)`${a} > ${r} ? ${a} : ${r}`)),mergeValues:(t,r)=>!0===t||Math.max(t,r),resultToName:(t,r)=>t.var("items",r)})},t.evaluatedPropsToName=d,t.setEvaluated=p;let h={};function f(t,r,a=t.opts.strictSchema){if(a){if(r=`strict mode: ${r}`,!0===a)throw Error(r);t.self.logger.warn(r)}}t.useFunc=function(t,r){return t.scopeValue("func",{ref:r,code:h[r.code]||(h[r.code]=new i._Code(r.code))})},(a=r||(t.Type=r={}))[a.Num=0]="Num",a[a.Str=1]="Str",t.getErrorPath=function(t,a,i){if(t instanceof o.Name){let n=a===r.Num;return i?n?(0,o._)`"[" + ${t} + "]"`:(0,o._)`"['" + ${t} + "']"`:n?(0,o._)`"/" + ${t}`:(0,o._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return i?(0,o.getProperty)(t).toString():"/"+l(t)},t.checkStrictMode=f}),c_=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cv();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")}}),cS=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;let r=cv(),a=cb(),o=c_();function i(t,a){let i=t.const("err",a);t.if((0,r._)`${o.default.vErrors} === null`,()=>t.assign(o.default.vErrors,(0,r._)`[${i}]`),(0,r._)`${o.default.vErrors}.push(${i})`),t.code((0,r._)`${o.default.errors}++`)}function n(t,a){let{gen:o,validateName:i,schemaEnv:n}=t;n.$async?o.throw((0,r._)`new ${t.ValidationError}(${a})`):(o.assign((0,r._)`${i}.errors`,a),o.return(!1))}t.keywordError={message:({keyword:t})=>(0,r.str)`must pass "${t}" keyword validation`},t.keyword$DataError={message:({keyword:t,schemaType:a})=>a?(0,r.str)`"${t}" keyword must be ${a} ($data)`:(0,r.str)`"${t}" keyword is invalid ($data)`},t.reportError=function(a,o=t.keywordError,s,c){let{it:u}=a,{gen:d,compositeRule:p,allErrors:h}=u,f=l(a,o,s);(null!=c?c:p||h)?i(d,f):n(u,(0,r._)`[${f}]`)},t.reportExtraError=function(r,a=t.keywordError,s){let{it:c}=r,{gen:u,compositeRule:d,allErrors:p}=c;i(u,l(r,a,s)),d||p||n(c,o.default.vErrors)},t.resetErrorsCount=function(t,a){t.assign(o.default.errors,a),t.if((0,r._)`${o.default.vErrors} !== null`,()=>t.if(a,()=>t.assign((0,r._)`${o.default.vErrors}.length`,a),()=>t.assign(o.default.vErrors,null)))},t.extendErrors=function({gen:t,keyword:a,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,o.default.errors,s=>{t.const(c,(0,r._)`${o.default.vErrors}[${s}]`),t.if((0,r._)`${c}.instancePath === undefined`,()=>t.assign((0,r._)`${c}.instancePath`,(0,r.strConcat)(o.default.instancePath,l.errorPath))),t.assign((0,r._)`${c}.schemaPath`,(0,r.str)`${l.errSchemaPath}/${a}`),l.opts.verbose&&(t.assign((0,r._)`${c}.schema`,i),t.assign((0,r._)`${c}.data`,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,a.getErrorPath)(i,a.Type.Str)}`:t;return[o.default.instancePath,(0,r.strConcat)(o.default.instancePath,n)]}(c,n),function({keyword:t,it:{errSchemaPath:o}},{schemaPath:i,parentSchema:n}){let l=n?o:(0,r.str)`${o}/${t}`;return i&&(l=(0,r.str)`${l}${(0,a.getErrorPath)(i,a.Type.Str)}`),[s.schemaPath,l]}(t,n)];return function(t,{params:a,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 a?a(t):a||(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}`],[o.default.data,c]),h&&n.push([s.propertyName,h])}(t,i,u),l.object(...u)}(t,i,n)}}),cw=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;let r=cS(),a=cv(),o=c_(),i={message:"boolean schema is false"};function n(t,a){let{gen:o,data:n}=t;(0,r.reportError)({gen:o,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t},i,void 0,a)}t.topBoolOrEmptySchema=function(t){let{gen:r,schema:i,validateName:s}=t;!1===i?n(t,!1):"object"==typeof i&&!0===i.$async?r.return(o.default.data):(r.assign((0,a._)`${s}.errors`,null),r.return(!0))},t.boolOrEmptySchema=function(t,r){let{gen:a,schema:o}=t;!1===o?(a.var(r,!1),n(t)):a.var(r,!0)}}),c$=eo(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:{}}}}),cE=eo(t=>{function r(t,r){return r.rules.some(r=>a(t,r))}function a(t,r){var a;return void 0!==t[r.keyword]||(null==(a=r.definition.implements)?void 0:a.some(r=>void 0!==t[r]))}Object.defineProperty(t,"__esModule",{value:!0}),t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0,t.schemaHasRulesForType=function({schema:t,self:a},o){let i=a.RULES.types[o];return i&&!0!==i&&r(t,i)},t.shouldUseGroup=r,t.shouldUseRule=a}),cP=eo(t=>{var r,a;Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;let o=c$(),i=cE(),n=cS(),s=cv(),l=cb();function c(t){let r=Array.isArray(t)?t:t?[t]:[];if(r.every(o.isJSONType))return r;throw Error("type must be JSONType or JSONType[]: "+r.join(","))}(a=r||(t.DataType=r={}))[a.Correct=0]="Correct",a[a.Wrong=1]="Wrong",t.getSchemaTypes=function(t){let r=c(t.type);if(r.includes("null")){if(!1===t.nullable)throw Error("type: null contradicts nullable: false")}else{if(!r.length&&void 0!==t.nullable)throw Error('"nullable" cannot be used without "type"');!0===t.nullable&&r.push("null")}return r},t.getJSONTypes=c,t.coerceAndCheckDataType=function(t,a){var o,n;let{gen:l,data:c,opts:d}=t,h=(o=a,(n=d.coerceTypes)?o.filter(t=>u.has(t)||"array"===n&&"array"===t):[]),m=a.length>0&&!(0===h.length&&1===a.length&&(0,i.schemaHasRulesForType)(t,a[0]));if(m){let o=p(a,c,d.strictNumbers,r.Wrong);l.if(o,()=>{h.length?function(t,r,a){let{gen:o,data:i,opts:n}=t,l=o.let("dataType",(0,s._)`typeof ${i}`),c=o.let("coerced",(0,s._)`undefined`);for(let t of("array"===n.coerceTypes&&o.if((0,s._)`${l} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>o.assign(i,(0,s._)`${i}[0]`).assign(l,(0,s._)`typeof ${i}`).if(p(r,i,n.strictNumbers),()=>o.assign(c,i))),o.if((0,s._)`${c} !== undefined`),a))(u.has(t)||"array"===t&&"array"===n.coerceTypes)&&function(t){switch(t){case"string":o.elseIf((0,s._)`${l} == "number" || ${l} == "boolean"`).assign(c,(0,s._)`"" + ${i}`).elseIf((0,s._)`${i} === null`).assign(c,(0,s._)`""`);return;case"number":o.elseIf((0,s._)`${l} == "boolean" || ${i} === null
|
|
58
|
+
|| (${l} == "string" && ${i} && ${i} == +${i})`).assign(c,(0,s._)`+${i}`);return;case"integer":o.elseIf((0,s._)`${l} === "boolean" || ${i} === null
|
|
59
|
+
|| (${l} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(c,(0,s._)`+${i}`);return;case"boolean":o.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":o.elseIf((0,s._)`${i} === "" || ${i} === 0 || ${i} === false`),o.assign(c,null);return;case"array":o.elseIf((0,s._)`${l} === "string" || ${l} === "number"
|
|
60
|
+
|| ${l} === "boolean" || ${i} === null`).assign(c,(0,s._)`[${i}]`)}}(t);o.else(),f(t),o.endIf(),o.if((0,s._)`${c} !== undefined`,()=>{o.assign(i,c),function({gen:t,parentData:r,parentDataProperty:a},o){t.if((0,s._)`${r} !== undefined`,()=>t.assign((0,s._)`${r}[${a}]`,o))}(t,c)})}(t,a,h):f(t)})}return m};let u=new Set(["string","number","integer","boolean","null"]);function d(t,a,o,i=r.Correct){let n,l=i===r.Correct?s.operators.EQ:s.operators.NEQ;switch(t){case"null":return(0,s._)`${a} ${l} null`;case"array":n=(0,s._)`Array.isArray(${a})`;break;case"object":n=(0,s._)`${a} && typeof ${a} == "object" && !Array.isArray(${a})`;break;case"integer":n=c((0,s._)`!(${a} % 1) && !isNaN(${a})`);break;case"number":n=c();break;default:return(0,s._)`typeof ${a} ${l} ${t}`}return i===r.Correct?n:(0,s.not)(n);function c(t=s.nil){return(0,s.and)((0,s._)`typeof ${a} == "number"`,t,o?(0,s._)`isFinite(${a})`:s.nil)}}function p(t,r,a,o){let i;if(1===t.length)return d(t[0],r,a,o);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,a,o));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:a,schema:o}=t,i=(0,l.schemaRefOrVal)(t,o,"type");return{gen:r,keyword:"type",data:a,schema:o.type,schemaCode:i,schemaValue:i,parentSchema:o,params:{},it:t}}(t);(0,n.reportError)(r,h)}t.reportTypeError=f}),cR=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;let r=cv(),a=cb();function o(t,o,i){let{gen:n,compositeRule:s,data:l,opts:c}=t;if(void 0===i)return;let u=(0,r._)`${l}${(0,r.getProperty)(o)}`;if(s)return void(0,a.checkStrictMode)(t,`default is ignored for: ${u}`);let d=(0,r._)`${u} === undefined`;"empty"===c.useDefaults&&(d=(0,r._)`${d} || ${u} === null || ${u} === ""`),n.if(d,(0,r._)`${u} = ${(0,r.stringify)(i)}`)}t.assignDefaults=function(t,r){let{properties:a,items:i}=t.schema;if("object"===r&&a)for(let r in a)o(t,r,a[r].default);else"array"===r&&Array.isArray(i)&&i.forEach((r,a)=>o(t,a,r.default))}}),ck=eo(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=cv(),a=cb(),o=c_(),i=cb();function n(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,r._)`Object.prototype.hasOwnProperty`})}function s(t,a,o){return(0,r._)`${n(t)}.call(${a}, ${o})`}function l(t,a,o,i){let n=(0,r._)`${a}${(0,r.getProperty)(o)} === undefined`;return i?(0,r.or)(n,(0,r.not)(s(t,a,o))):n}function c(t){return t?Object.keys(t).filter(t=>"__proto__"!==t):[]}t.checkReportMissingProp=function(t,a){let{gen:o,data:i,it:n}=t;o.if(l(o,i,a,n.opts.ownProperties),()=>{t.setParams({missingProperty:(0,r._)`${a}`},!0),t.error()})},t.checkMissingProp=function({gen:t,data:a,it:{opts:o}},i,n){return(0,r.or)(...i.map(i=>(0,r.and)(l(t,a,i,o.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,a,o,i){let n=(0,r._)`${a}${(0,r.getProperty)(o)} !== undefined`;return i?(0,r._)`${n} && ${s(t,a,o)}`:n},t.noPropertyInData=l,t.allSchemaProperties=c,t.schemaProperties=function(t,r){return c(r).filter(o=>!(0,a.alwaysValidSchema)(t,r[o]))},t.callValidateCode=function({schemaCode:t,data:a,it:{gen:i,topSchemaRef:n,schemaPath:s,errorPath:l},it:c},u,d,p){let h=p?(0,r._)`${t}, ${a}, ${n}${s}`:a,f=[[o.default.instancePath,(0,r.strConcat)(o.default.instancePath,l)],[o.default.parentData,c.parentData],[o.default.parentDataProperty,c.parentDataProperty],[o.default.rootData,o.default.rootData]];c.opts.dynamicRef&&f.push([o.default.dynamicAnchors,o.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:a}},o){let n=a.unicodeRegExp?"u":"",{regExp:s}=a.code,l=s(o,n);return t.scopeValue("pattern",{key:l.toString(),ref:l,code:(0,r._)`${"new RegExp"===s.code?u:(0,i.useFunc)(t,s)}(${o}, ${n})`})},t.validateArray=function(t){let{gen:o,data:i,keyword:n,it:s}=t,l=o.name("valid");if(s.allErrors){let t=o.let("valid",!0);return c(()=>o.assign(t,!1)),t}return o.var(l,!0),c(()=>o.break()),l;function c(s){let c=o.const("len",(0,r._)`${i}.length`);o.forRange("i",0,c,i=>{t.subschema({keyword:n,dataProp:i,dataPropType:a.Type.Num},l),o.if((0,r.not)(l),s)})}},t.validateUnion=function(t){let{gen:o,schema:i,keyword:n,it:s}=t;if(!Array.isArray(i))throw Error("ajv implementation error");if(i.some(t=>(0,a.alwaysValidSchema)(s,t))&&!s.opts.unevaluated)return;let l=o.let("valid",!1),c=o.name("_valid");o.block(()=>i.forEach((a,i)=>{let s=t.subschema({keyword:n,schemaProp:i,compositeRule:!0},c);o.assign(l,(0,r._)`${l} || ${c}`),t.mergeValidEvaluated(s,c)||o.if((0,r.not)(l))})),t.result(l,()=>t.reset(),()=>t.error(!0))}}),cx=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;let r=cv(),a=c_(),o=ck(),i=cS();function n(t){let{gen:a,data:o,it:i}=t;a.if(i.parentData,()=>a.assign(o,(0,r._)`${i.parentData}[${i.parentDataProperty}]`))}function s(t,a,o){if(void 0===o)throw Error(`keyword "${a}" failed to compile`);return t.scopeValue("keyword","function"==typeof o?{ref:o}:{ref:o,code:(0,r.stringify)(o)})}t.macroKeywordCode=function(t,a){let{gen:o,keyword:i,schema:n,parentSchema:l,it:c}=t,u=a.macro.call(c.self,n,l,c),d=s(o,i,u);!1!==c.opts.validateSchema&&c.self.validateSchema(u,!0);let p=o.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?a.default.this:a.default.self,s=!("compile"in l&&!f||!1===l.schema);u.assign(g,(0,r._)`${i}${(0,o.callValidateCode)(t,y,n,s)}`,l.modifying)}function b(t){var a;u.if((0,r.not)(null!=(a=l.valid)?a:g),t)}t.block$data(g,function(){if(!1===l.errors)v(),l.modifying&&n(t),b(()=>t.error());else{let o,s,c=l.async?(o=u.let("ruleErrs",null),u.try(()=>v((0,r._)`await `),t=>u.assign(g,!1).if((0,r._)`${t} instanceof ${m.ValidationError}`,()=>u.assign(o,(0,r._)`${t}.errors`),()=>u.throw(t))),o):(s=(0,r._)`${y}.errors`,u.assign(s,null),v(r.nil),s);l.modifying&&n(t),b(()=>(function(t,o){let{gen:n}=t;n.if((0,r._)`Array.isArray(${o})`,()=>{n.assign(a.default.vErrors,(0,r._)`${a.default.vErrors} === null ? ${o} : ${a.default.vErrors}.concat(${o})`).assign(a.default.errors,(0,r._)`${a.default.vErrors}.length`),(0,i.extendErrors)(t)},()=>t.error())})(t,c))}}),t.ok(null!=(c=l.valid)?c:g)},t.validSchemaType=function(t,r,a=!1){return!r.length||r.some(r=>"array"===r?Array.isArray(t):"object"===r?t&&"object"==typeof t&&!Array.isArray(t):typeof t==r||a&&void 0===t)},t.validateKeywordUsage=function({schema:t,opts:r,self:a,errSchemaPath:o},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 "${o}": `+a.errorsText(i.validateSchema.errors);if("log"===r.validateSchema)a.logger.error(t);else throw Error(t)}}}),cT=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;let r=cv(),a=cb();t.getSubschema=function(t,{keyword:o,schemaProp:i,schema:n,schemaPath:s,errSchemaPath:l,topSchemaRef:c}){if(void 0!==o&&void 0!==n)throw Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==o){let n=t.schema[o];return void 0===i?{schema:n,schemaPath:(0,r._)`${t.schemaPath}${(0,r.getProperty)(o)}`,errSchemaPath:`${t.errSchemaPath}/${o}`}:{schema:n[i],schemaPath:(0,r._)`${t.schemaPath}${(0,r.getProperty)(o)}${(0,r.getProperty)(i)}`,errSchemaPath:`${t.errSchemaPath}/${o}/${(0,a.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,o,{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}=o;if(void 0!==i){let{errorPath:s,dataPathArr:l,opts:c}=o;d(u.let("data",(0,r._)`${o.data}${(0,r.getProperty)(i)}`,!0)),t.errorPath=(0,r.str)`${s}${(0,a.getErrorPath)(i,n,c.jsPropertySyntax)}`,t.parentDataProperty=(0,r._)`${i}`,t.dataPathArr=[...l,t.parentDataProperty]}function d(r){t.data=r,t.dataLevel=o.dataLevel+1,t.dataTypes=[],o.definedProperties=new Set,t.parentData=o.data,t.dataNames=[...o.dataNames,r]}void 0!==s&&(d(s instanceof r.Name?s:u.let("data",s,!0)),void 0!==c&&(t.propertyName=c)),l&&(t.dataTypes=l)},t.extendSubschemaMode=function(t,{jtdDiscriminator:r,jtdMetadata:a,compositeRule:o,createErrors:i,allErrors:n}){void 0!==o&&(t.compositeRule=o),void 0!==i&&(t.createErrors=i),void 0!==n&&(t.allErrors=n),t.jtdDiscriminator=r,t.jtdMetadata=a}}),cO=eo((t,r)=>{r.exports=function t(r,a){if(r===a)return!0;if(r&&a&&"object"==typeof r&&"object"==typeof a){if(r.constructor!==a.constructor)return!1;if(Array.isArray(r)){if((o=r.length)!=a.length)return!1;for(i=o;0!=i--;)if(!t(r[i],a[i]))return!1;return!0}if(r.constructor===RegExp)return r.source===a.source&&r.flags===a.flags;if(r.valueOf!==Object.prototype.valueOf)return r.valueOf()===a.valueOf();if(r.toString!==Object.prototype.toString)return r.toString()===a.toString();if((o=(n=Object.keys(r)).length)!==Object.keys(a).length)return!1;for(i=o;0!=i--;)if(!Object.prototype.hasOwnProperty.call(a,n[i]))return!1;for(i=o;0!=i--;){var o,i,n,s=n[i];if(!t(r[s],a[s]))return!1}return!0}return r!=r&&a!=a}}),cj=eo((t,r)=>{var a=r.exports=function(t,r,o){"function"==typeof r&&(o=r,r={});var i="function"==typeof(o=r.cb||o)?o:o.pre||function(){};!function t(r,o,i,n,s,l,c,u,d,p){if(n&&"object"==typeof n&&!Array.isArray(n)){for(var h in o(n,s,l,c,u,d,p),n){var f=n[h];if(Array.isArray(f)){if(h in a.arrayKeywords)for(var m=0;m<f.length;m++)t(r,o,i,f[m],s+"/"+h+"/"+m,l,s,h,n,m)}else if(h in a.propsKeywords){if(f&&"object"==typeof f)for(var y in f)t(r,o,i,f[y],s+"/"+h+"/"+y.replace(/~/g,"~0").replace(/\//g,"~1"),l,s,h,n,y)}else(h in a.keywords||r.allKeys&&!(h in a.skipKeywords))&&t(r,o,i,f,s+"/"+h,l,s,h,n)}i(n,s,l,c,u,d,p)}}(r,i,o.post||function(){},t,"",t)};a.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},a.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},a.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},a.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0}}),cC=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;let r=cb(),a=cO(),o=cj(),i=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);t.inlineRef=function(t,a=!0){return"boolean"==typeof t||(!0===a?!function t(r){for(let a in r){if(n.has(a))return!0;let o=r[a];if(Array.isArray(o)&&o.some(t)||"object"==typeof o&&t(o))return!0}return!1}(t):!!a&&function t(a){let o=0;for(let n in a)if("$ref"===n||(o++,!i.has(n)&&("object"==typeof a[n]&&(0,r.eachItem)(a[n],r=>o+=t(r)),o===1/0)))return 1/0;return o}(t)<=a)};let n=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function s(t,r="",a){return!1!==a&&(r=u(r)),l(t,t.parse(r))}function l(t,r){return t.serialize(r).split("#")[0]+"#"}t.getFullPath=s,t._getFullPath=l;let c=/#\/?$/;function u(t){return t?t.replace(c,""):""}t.normalizeId=u,t.resolveUrl=function(t,r,a){return a=u(a),t.resolve(r,a)};let d=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(t,r){if("boolean"==typeof t)return{};let{schemaId:i,uriResolver:n}=this.opts,l=u(t[i]||r),c={"":l},p=s(n,l,!1),h={},f=new Set;return o(t,{allKeys:!0},(t,r,a,o)=>{if(void 0===o)return;let n=p+r,s=c[o];function l(r){let a=this.opts.uriResolver.resolve;if(r=u(s?a(s,r):r),f.has(r))throw y(r);f.add(r);let o=this.refs[r];return"string"==typeof o&&(o=this.refs[o]),"object"==typeof o?m(t,o.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,o){if(void 0!==r&&!a(t,r))throw y(o)}function y(t){return Error(`reference "${t}" resolves to more than one schema`)}}}),cA=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;let r=cw(),a=cP(),o=cE(),i=cP(),n=cR(),s=cx(),l=cT(),c=cv(),u=c_(),d=cC(),p=cb(),h=cS();function f({gen:t,validateName:r,schema:a,schemaEnv:o,opts:i},n){var s;i.code.es5?t.func(r,(0,c._)`${u.default.data}, ${u.default.valCxt}`,o.$async,()=>{var r,o;t.code((0,c._)`"use strict"; ${m(a,i)}`),r=t,o=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}`),o.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),o.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}}={}`)}`,o.$async,()=>t.code(m(a,i)).code(n))}function m(t,r){let a="object"==typeof t&&t[r.schemaId];return a&&(r.code.source||r.code.process)?(0,c._)`/*# sourceURL=${a} */`:c.nil}function y({schema:t,self:r}){if("boolean"==typeof t)return!t;for(let a in t)if(r.RULES.all[a])return!0;return!1}function g(t){return"boolean"!=typeof t.schema}function v(t){(0,p.checkUnknownRules)(t),function(t){let{schema:r,errSchemaPath:a,opts:o,self:i}=t;r.$ref&&o.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(r,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${a}"`)}(t)}function b(t,r){if(t.opts.jtd)return S(t,[],!1,r);let o=(0,a.getSchemaTypes)(t.schema);S(t,o,!(0,a.coerceAndCheckDataType)(t,o),r)}function _({gen:t,schemaEnv:r,schema:a,errSchemaPath:o,opts:i}){let n=a.$comment;if(!0===i.$comment)t.code((0,c._)`${u.default.self}.logger.log(${n})`);else if("function"==typeof i.$comment){let a=(0,c.str)`${o}/$comment`,i=t.scopeValue("root",{ref:r.root});t.code((0,c._)`${u.default.self}.opts.$comment(${n}, ${a}, ${i}.schema)`)}}function S(t,r,a,n){var s,l,d,h;let{gen:f,schema:m,data:y,allErrors:g,opts:v,self:b}=t,{RULES:_}=b;if(m.$ref&&(v.ignoreKeywordsWithRef||!(0,p.schemaHasRulesButRef)(m,_)))return void f.block(()=>R(t,"$ref",_.all.$ref.definition));function S(s){(0,o.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&&a&&(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 a=[];for(let o of t.dataTypes)$(r,o)?a.push(o):r.includes("integer")&&"number"===o&&a.push("integer");t.dataTypes=a}(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 a=t.self.RULES.all;for(let i in a){let n=a[i];if("object"==typeof n&&(0,o.shouldUseRule)(t.schema,n)){let{type:a}=n.definition;a.length&&!a.some(t=>{var a,o;return a=r,o=t,a.includes(o)||"number"===o&&a.includes("integer")})&&E(t,`missing type "${a.join(",")}" for keyword "${i}"`)}}}(s,s.dataTypes))),f.block(()=>{for(let t of _.rules)S(t);S(_.post)})}function w(t,r){let{gen:a,schema:i,opts:{useDefaults:s}}=t;s&&(0,n.assignDefaults)(t,r.type),a.block(()=>{for(let a of r.rules)(0,o.shouldUseRule)(i,a)&&R(t,a.keyword,a.definition,r.type)})}function $(t,r){return t.includes(r)||"integer"===r&&t.includes("number")}function E(t,r){let a=t.schemaEnv.baseId+t.errSchemaPath;r+=` at "${a}" (strictTypes)`,(0,p.checkStrictMode)(t,r,t.opts.strictTypes)}t.validateFunctionCode=function(t){g(t)&&(v(t),y(t))?function(t){let{schema:r,opts:a,gen:o}=t;f(t,()=>{a.$comment&&r.$comment&&_(t),function(t){let{schema:r,opts:a}=t;void 0!==r.default&&a.useDefaults&&a.strictSchema&&(0,p.checkStrictMode)(t,"default is ignored in the schema root")}(t),o.let(u.default.vErrors,null),o.let(u.default.errors,0),a.unevaluated&&function(t){let{gen:r,validateName:a}=t;t.evaluated=r.const("evaluated",(0,c._)`${a}.evaluated`),r.if((0,c._)`${t.evaluated}.dynamicProps`,()=>r.assign((0,c._)`${t.evaluated}.props`,(0,c._)`undefined`)),r.if((0,c._)`${t.evaluated}.dynamicItems`,()=>r.assign((0,c._)`${t.evaluated}.items`,(0,c._)`undefined`))}(t),b(t),function(t){let{gen:r,schemaEnv:a,validateName:o,ValidationError:i,opts:n}=t;a.$async?r.if((0,c._)`${u.default.errors} === 0`,()=>r.return(u.default.data),()=>r.throw((0,c._)`new ${i}(${u.default.vErrors})`)):(r.assign((0,c._)`${o}.errors`,u.default.vErrors),n.unevaluated&&function({gen:t,evaluated:r,props:a,items:o}){a instanceof c.Name&&t.assign((0,c._)`${r}.props`,a),o instanceof c.Name&&t.assign((0,c._)`${r}.items`,o)}(t),r.return((0,c._)`${u.default.errors} === 0`))}(t)})}(t):f(t,()=>(0,r.topBoolOrEmptySchema)(t))};var P=class{constructor(t,r,a){if((0,s.validateKeywordUsage)(t,r,a),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=a,this.data=t.data,this.schema=t.schema[a],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,p.schemaRefOrVal)(t,this.schema,a,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",T(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,s.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw Error(`${a} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:!1!==r.errors)&&(this.errsCount=t.gen.const("_errs",u.default.errors))}result(t,r,a){this.failResult((0,c.not)(t),r,a)}failResult(t,r,a){this.gen.if(t),a?a():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,c.not)(t),void 0,r)}fail(t){if(void 0===t){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,c._)`${r} !== undefined && (${(0,c.or)(this.invalid$data(),t)})`)}error(t,r,a){if(r){this.setParams(r),this._error(t,a),this.setParams({});return}this._error(t,a)}_error(t,r){(t?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,a=c.nil){this.gen.block(()=>{this.check$data(t,a),r()})}check$data(t=c.nil,r=c.nil){if(!this.$data)return;let{gen:a,schemaCode:o,schemaType:i,def:n}=this;a.if((0,c.or)((0,c._)`${o} === undefined`,r)),t!==c.nil&&a.assign(t,!0),(i.length||n.validateSchema)&&(a.elseIf(this.invalid$data()),this.$dataError(),t!==c.nil&&a.assign(t,!1)),a.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:a,def:o,it:n}=this;return(0,c.or)(function(){if(a.length){if(!(r instanceof c.Name))throw Error("ajv implementation error");let t=Array.isArray(a)?a:[a];return(0,c._)`${(0,i.checkDataTypes)(t,r,n.opts.strictNumbers,i.DataType.Wrong)}`}return c.nil}(),function(){if(o.validateSchema){let a=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,c._)`!${a}(${r})`}return c.nil}())}subschema(t,a){let o=(0,l.getSubschema)(this.it,t);(0,l.extendSubschemaData)(o,this.it,t),(0,l.extendSubschemaMode)(o,t);let i={...this.it,...o,items:void 0,props:void 0};return!function(t,a){if(g(t)&&(v(t),y(t)))return function(t,r){var a;let o,{schema:i,gen:n,opts:s}=t;s.$comment&&i.$comment&&_(t),(o=(a=t).schema[a.opts.schemaId])&&(a.baseId=(0,d.resolveUrl)(a.opts.uriResolver,a.baseId,o)),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);b(t,l),n.var(r,(0,c._)`${l} === ${u.default.errors}`)}(t,a);(0,r.boolOrEmptySchema)(t,a)}(i,a),i}mergeEvaluated(t,r){let{it:a,gen:o}=this;a.opts.unevaluated&&(!0!==a.props&&void 0!==t.props&&(a.props=p.mergeEvaluated.props(o,t.props,a.props,r)),!0!==a.items&&void 0!==t.items&&(a.items=p.mergeEvaluated.items(o,t.items,a.items,r)))}mergeValidEvaluated(t,r){let{it:a,gen:o}=this;if(a.opts.unevaluated&&(!0!==a.props||!0!==a.items))return o.if(r,()=>this.mergeEvaluated(t,c.Name)),!0}};function R(t,r,a,o){let i=new P(t,a,r);"code"in a?a.code(i,o):i.$data&&a.validate?(0,s.funcKeywordCode)(i,a):"macro"in a?(0,s.macroKeywordCode)(i,a):(a.compile||a.validate)&&(0,s.funcKeywordCode)(i,a)}t.KeywordCxt=P;let k=/^\/(?:[^~]|~0|~1)*$/,x=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function T(t,{dataLevel:r,dataNames:a,dataPathArr:o}){let i,n;if(""===t)return u.default.rootData;if("/"===t[0]){if(!k.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 o[r-c]}if(c>r)throw Error(l("data",c));if(n=a[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,a){return`Cannot access ${t} ${a} levels up, current level is ${r}`}}t.getData=T}),cI=eo(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}}}),cN=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cC();t.default=class extends Error{constructor(t,a,o,i){super(i||`can't resolve reference ${o} from id ${a}`),this.missingRef=(0,r.resolveUrl)(t,a,o),this.missingSchema=(0,r.normalizeId)((0,r.getFullPath)(t,this.missingRef))}}}),cM=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;let r=cv(),a=cI(),o=c_(),i=cC(),n=cb(),s=cA();var l=class{constructor(t){var r;let a;this.refs={},this.dynamicAnchors={},"object"==typeof t.schema&&(a=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=null!=(r=t.baseId)?r:(0,i.normalizeId)(null==a?void 0:a[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=null==a?void 0:a.$async,this.refs={}}};function c(t){let 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:a.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:o.default.data,parentData:o.default.parentData,parentDataProperty:o.default.parentDataProperty,dataNames:[o.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 a=m.toString();l=`${m.scopeRefs(o.default.scope)}return ${a}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let i=Function(`${o.default.self}`,`${o.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:a,scopeValues:m._values}),this.opts.unevaluated){let{props:t,items:a}=g;i.evaluated={props:t instanceof r.Name?void 0:t,items:a instanceof r.Name?void 0:a,dynamicProps:t instanceof r.Name,dynamicItems:a instanceof r.Name},i.source&&(i.source.evaluated=(0,r.stringify)(i.evaluated))}return t.validate=i,t}catch(r){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),r}finally{this._compilations.delete(t)}}function u(t){return(0,i.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:c.call(this,t)}function d(t){for(let o of this._compilations){var r,a;if(r=o,a=t,r.schema===a.schema&&r.root===a.root&&r.baseId===a.baseId)return o}}function p(t,r){let a;for(;"string"==typeof(a=this.refs[r]);)r=a;return a||this.schemas[r]||h.call(this,t,r)}function h(t,r){let a=this.opts.uriResolver.parse(r),o=(0,i._getFullPath)(this.opts.uriResolver,a),n=(0,i.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&o===n)return m.call(this,a,t);let s=(0,i.normalizeId)(o),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,a,r)}if("object"==typeof(null==u?void 0:u.schema)){if(u.validate||c.call(this,u),s===(0,i.normalizeId)(r)){let{schema:r}=u,{schemaId:a}=this.opts,o=r[a];return o&&(n=(0,i.resolveUrl)(this.opts.uriResolver,n,o)),new l({schema:r,schemaId:a,root:t,baseId:n})}return m.call(this,a,u)}}t.SchemaEnv=l,t.compileSchema=c,t.resolveRef=function(t,r,a){var o;a=(0,i.resolveUrl)(this.opts.uriResolver,r,a);let n=t.refs[a];if(n)return n;let s=p.call(this,t,a);if(void 0===s){let i=null==(o=t.localRefs)?void 0:o[a],{schemaId:n}=this.opts;i&&(s=new l({schema:i,schemaId:n,root:t,baseId:r}))}if(void 0!==s)return t.refs[a]=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:a,root:o}){var s;let c;if((null==(s=t.fragment)?void 0:s[0])!=="/")return;for(let o of t.fragment.slice(1).split("/")){if("boolean"==typeof a)return;let t=a[(0,n.unescapeFragment)(o)];if(void 0===t)return;let s="object"==typeof(a=t)&&a[this.opts.schemaId];!f.has(o)&&s&&(r=(0,i.resolveUrl)(this.opts.uriResolver,r,s))}if("boolean"!=typeof a&&a.$ref&&!(0,n.schemaHasRulesButRef)(a,this.RULES)){let t=(0,i.resolveUrl)(this.opts.uriResolver,r,a.$ref);c=h.call(this,o,t)}let{schemaId:u}=this.opts;if((c=c||new l({schema:a,schemaId:u,root:o,baseId:r})).schema!==c.root.schema)return c}}),cq=eo((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}}),cz=eo((t,r)=>{let a=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),o=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function i(t){let r="",a=0,o=0;for(o=0;o<t.length;o++)if(48!==(a=t[o].charCodeAt(0))){if(!(a>=48&&a<=57||a>=65&&a<=70||a>=97&&a<=102))return"";r+=t[o];break}for(o+=1;o<t.length;o++){if(!((a=t[o].charCodeAt(0))>=48&&a<=57||a>=65&&a<=70||a>=97&&a<=102))return"";r+=t[o]}return r}function n(t){return t.length=0,!0}function s(t,r,a){if(t.length){let o=i(t);if(""===o)return a.error=!0,!1;r.push(o),t.length=0}return!0}function l(t){if(2>function(t,r){let a=0;for(let r=0;r<t.length;r++)":"===t[r]&&a++;return a}(t,":"))return{host:t,isIPV6:!1};let r=function(t){let r=0,a={error:!1,address:"",zone:""},o=[],l=[],c=!1,u=!1,d=s;for(let i=0;i<t.length;i++){let s=t[i];if("["!==s&&"]"!==s)if(":"===s){if(!0===c&&(u=!0),!d(l,o,a))break;if(++r>7){a.error=!0;break}i>0&&":"===t[i-1]&&(c=!0),o.push(":");continue}else if("%"===s){if(!d(l,o,a))break;d=n}else{l.push(s);continue}}return l.length&&(d===n?a.zone=l.join(""):u?o.push(l.join("")):o.push(i(l))),a.address=o.join(""),a}(t);if(r.error)return{host:t,isIPV6:!1};{let t=r.address,a=r.address;return r.zone&&(t+="%"+r.zone,a+="%25"+r.zone),{host:t,isIPV6:!0,escapedHost:a}}}r.exports={nonSimpleDomain:RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u),recomposeAuthority:function(t){let r=[];if(void 0!==t.userinfo&&(r.push(t.userinfo),r.push("@")),void 0!==t.host){let a=unescape(t.host);if(!o(a)){let r=l(a);a=!0===r.isIPV6?`[${r.escapedHost}]`:t.host}r.push(a)}return("number"==typeof t.port||"string"==typeof t.port)&&(r.push(":"),r.push(String(t.port))),r.length?r.join(""):void 0},normalizeComponentEncoding:function(t,r){let a=!0!==r?escape:unescape;return void 0!==t.scheme&&(t.scheme=a(t.scheme)),void 0!==t.userinfo&&(t.userinfo=a(t.userinfo)),void 0!==t.host&&(t.host=a(t.host)),void 0!==t.path&&(t.path=a(t.path)),void 0!==t.query&&(t.query=a(t.query)),void 0!==t.fragment&&(t.fragment=a(t.fragment)),t},removeDotSegments:function(t){let r=t,a=[],o=-1,i=0;for(;i=r.length;){if(1===i)if("."===r)break;else if("/"===r){a.push("/");break}else{a.push(r);break}if(2===i){if("."===r[0]){if("."===r[1])break;else if("/"===r[1]){r=r.slice(2);continue}}else if("/"===r[0]&&("."===r[1]||"/"===r[1])){a.push("/");break}}else if(3===i&&"/.."===r){0!==a.length&&a.pop(),a.push("/");break}if("."===r[0]){if("."===r[1]){if("/"===r[2]){r=r.slice(3);continue}}else if("/"===r[1]){r=r.slice(2);continue}}else if("/"===r[0]&&"."===r[1]){if("/"===r[2]){r=r.slice(2);continue}else if("."===r[2]&&"/"===r[3]){r=r.slice(3),0!==a.length&&a.pop();continue}}if(-1===(o=r.indexOf("/",1))){a.push(r);break}a.push(r.slice(0,o)),r=r.slice(o)}return a.join("")},isIPv4:o,isUUID:a,normalizeIPv6:l,stringArrayToHexStripped:i}}),cD=eo((t,r)=>{let{isUUID:a}=cz(),o=/([\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,a]=t.resourceName.split("?");t.path=r&&"/"!==r?r:void 0,t.query=a,t.resourceName=void 0}return t.fragment=void 0,t}},p={scheme:"wss",domainHost:d.domainHost,parse:d.parse,serialize:d.serialize},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 a=t.path.match(o);if(a){let o=r.scheme||t.scheme||"urn";t.nid=a[1].toLowerCase(),t.nss=a[2];let i=f(`${o}:${r.nid||t.nid}`);t.path=void 0,i&&(t=i.parse(t,r))}else t.error=t.error||"URN can not be parsed.";return t},serialize:function(t,r){if(void 0===t.nid)throw Error("URN without nid cannot be serialized");let a=r.scheme||t.scheme||"urn",o=t.nid.toLowerCase(),i=f(`${a}:${r.nid||o}`);i&&(t=i.serialize(t,r));let n=t,s=t.nss;return n.path=`${o||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&&a(t.uuid)||(t.error=t.error||"UUID is not valid."),t},serialize:function(t){return t.nss=(t.uuid||"").toLowerCase(),t},skipNormalize:!0}};function 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}}),cL=eo((t,r)=>{let{normalizeIPv6:a,removeDotSegments:o,recomposeAuthority:i,normalizeComponentEncoding:n,isIPv4:s,nonSimpleDomain:l}=cz(),{SCHEMES:c,getSchemeHandler:u}=cD();function d(t,r,a,i){let n={};return i||(t=f(p(t,a),a),r=f(p(r,a),a)),!(a=a||{}).tolerant&&r.scheme?(n.scheme=r.scheme,n.userinfo=r.userinfo,n.host=r.host,n.port=r.port,n.path=o(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=o(r.path||""),n.query=r.query):(r.path?("/"===r.path[0]?n.path=o(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=o(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 a={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},r),s=[],l=u(n.scheme||a.scheme);l&&l.serialize&&l.serialize(a,n),void 0!==a.path&&(n.skipEscape?a.path=unescape(a.path):(a.path=escape(a.path),void 0!==a.scheme&&(a.path=a.path.split("%3A").join(":")))),"suffix"!==n.reference&&a.scheme&&s.push(a.scheme,":");let c=i(a);if(void 0!==c&&("suffix"!==n.reference&&s.push("//"),s.push(c),a.path&&"/"!==a.path[0]&&s.push("/")),void 0!==a.path){let t=a.path;n.absolutePath||l&&l.absolutePath||(t=o(t)),void 0===c&&"/"===t[0]&&"/"===t[1]&&(t="/%2F"+t.slice(2)),s.push(t)}return void 0!==a.query&&s.push("?",a.query),void 0!==a.fragment&&s.push("#",a.fragment),s.join("")}let h=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function f(t,r){let o=Object.assign({},r),i={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1;"suffix"===o.reference&&(t=o.scheme?o.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=a(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",o.reference&&"suffix"!==o.reference&&o.reference!==i.reference&&(i.error=i.error||"URI is not a "+o.reference+" reference.");let r=u(o.scheme||i.scheme);if(!o.unicodeSupport&&(!r||!r.unicodeSupport)&&i.host&&(o.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,o)}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,a){let o=a?Object.assign({scheme:"null"},a):{scheme:"null"},i=d(f(t,o),f(r,o),o,!0);return o.skipEscape=!0,p(i,o)},resolveComponent:d,equal:function(t,r,a){return"string"==typeof t?t=p(n(f(t=unescape(t),a),!0),{...a,skipEscape:!0}):"object"==typeof t&&(t=p(n(t,!0),{...a,skipEscape:!0})),"string"==typeof r?r=p(n(f(r=unescape(r),a),!0),{...a,skipEscape:!0}):"object"==typeof r&&(r=p(n(r,!0),{...a,skipEscape:!0})),t.toLowerCase()===r.toLowerCase()},serialize:p,parse:f};r.exports=m,r.exports.default=m,r.exports.fastUri=m}),cU=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cL();r.code='require("ajv/dist/runtime/uri").default',t.default=r}),cH=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var r=cA();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return r.KeywordCxt}});var a=cv();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return a._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return a.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return a.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return a.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return a.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return a.CodeGen}});let o=cI(),i=cN(),n=c$(),s=cM(),l=cv(),c=cC(),u=cP(),d=cb(),p=cq(),h=cU(),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 b=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...function(t){var r,a,o,i,n,s,l,c,u,d,p,m,y,g,v,b,_,S,w,$,E,P,R,k,x;let T=t.strict,O=null==(r=t.code)?void 0:r.optimize,j=!0===O||void 0===O?1:O||0,C=null!=(o=null==(a=t.code)?void 0:a.regExp)?o:f,A=null!=(i=t.uriResolver)?i: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!=(m=null!=(p=t.strictTuples)?p:T)?m:"log",strictRequired:null!=(g=null!=(y=t.strictRequired)?y:T)&&g,code:t.code?{...t.code,optimize:j,regExp:C}:{optimize:j,regExp:C},loopRequired:null!=(v=t.loopRequired)?v:200,loopEnum:null!=(b=t.loopEnum)?b:200,meta:null==(_=t.meta)||_,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==(R=t.validateFormats)||R,unicodeRegExp:null==(k=t.unicodeRegExp)||k,int32range:null==(x=t.int32range)||x,uriResolver:A}}(t)};const{es5:r,lines:a}=this.opts.code;this.scope=new l.ValueScope({scope:{},prefixes:y,es5:r,lines:a}),this.logger=function(t){if(!1===t)return R;if(void 0===t)return console;if(t.log&&t.warn&&t.error)return t;throw Error("logger must implement log, warn and error methods")}(t.logger);const o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,n.getRules)(),_.call(this,g,t,"NOT SUPPORTED"),_.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=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:a}=this.opts,o=p;"id"===a&&((o={...p}).id=o.$id,delete o.$id),r&&t&&this.addMetaSchema(o,o[a],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta="object"==typeof t?t[r]||t:void 0}validate(t,r){let a;if("string"==typeof t){if(!(a=this.getSchema(t)))throw Error(`no schema with key or ref "${t}"`)}else a=this.compile(t);let o=a(r);return"$async"in a||(this.errors=a.errors),o}compile(t,r){let a=this._addSchema(t,r);return a.validate||this._compileSchemaEnv(a)}compileAsync(t,r){if("function"!=typeof this.opts.loadSchema)throw Error("options.loadSchema should be a function");let{loadSchema:a}=this.opts;return o.call(this,t,r);async function o(t,r){await n.call(this,t.$schema);let a=this._addSchema(t,r);return a.validate||s.call(this,a)}async function n(t){t&&!this.getSchema(t)&&await o.call(this,{$ref:t},!0)}async function s(t){try{return this._compileSchemaEnv(t)}catch(r){if(!(r instanceof i.default))throw r;return l.call(this,r),await c.call(this,r.missingSchema),s.call(this,t)}}function l({missingSchema:t,missingRef:r}){if(this.refs[t])throw Error(`AnySchema ${t} is loaded but ${r} cannot be resolved`)}async function c(t){let a=await u.call(this,t);this.refs[t]||await n.call(this,a.$schema),this.refs[t]||this.addSchema(a,t,r)}async function u(t){let r=this._loading[t];if(r)return r;try{return await (this._loading[t]=a(t))}finally{delete this._loading[t]}}}addSchema(t,r,a,o=this.opts.validateSchema){let i;if(Array.isArray(t)){for(let r of t)this.addSchema(r,void 0,a,o);return this}if("object"==typeof t){let{schemaId:r}=this.opts;if(void 0!==(i=t[r])&&"string"!=typeof i)throw Error(`schema ${r} must be string`)}return r=(0,c.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(t,a,r,o,!0),this}addMetaSchema(t,r,a=this.opts.validateSchema){return this.addSchema(t,r,!0,a),this}validateSchema(t,r){let a;if("boolean"==typeof t)return!0;if(void 0!==(a=t.$schema)&&"string"!=typeof a)throw Error("$schema must be a string");if(!(a=a||this.opts.defaultMeta||this.defaultMeta()))return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(a,t);if(!o&&r){let t="schema is invalid: "+this.errorsText();if("log"===this.opts.validateSchema)this.logger.error(t);else throw Error(t)}return o}getSchema(t){let r;for(;"string"==typeof(r=S.call(this,t));)t=r;if(void 0===r){let{schemaId:a}=this.opts,o=new s.SchemaEnv({schema:{},schemaId:a});if(!(r=s.resolveSchema.call(this,o,t)))return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=S.call(this,t);return"object"==typeof r&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{this._cache.delete(t);let r=t[this.opts.schemaId];return r&&(r=(0,c.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let a;if("string"==typeof t)a=t,"object"==typeof r&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=a);else if("object"==typeof t&&void 0===r){if(Array.isArray(a=(r=t).keyword)&&!a.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(x.call(this,a,r),!r)return(0,d.eachItem)(a,t=>T.call(this,t)),this;j.call(this,r);let o={...r,type:(0,u.getJSONTypes)(r.type),schemaType:(0,u.getJSONTypes)(r.schemaType)};return(0,d.eachItem)(a,0===o.type.length?t=>T.call(this,t,o):t=>o.type.forEach(r=>T.call(this,t,o,r))),this}getKeyword(t){let r=this.RULES.all[t];return"object"==typeof r?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;for(let a of(delete r.keywords[t],delete r.all[t],r.rules)){let r=a.rules.findIndex(r=>r.keyword===t);r>=0&&a.rules.splice(r,1)}return this}addFormat(t,r){return"string"==typeof r&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:a="data"}={}){return t&&0!==t.length?t.map(t=>`${a}${t.instancePath} ${t.message}`).reduce((t,a)=>t+r+a):"No errors"}$dataMetaSchema(t,r){let a=this.RULES.all;for(let o of(t=JSON.parse(JSON.stringify(t)),r)){let r=o.split("/").slice(1),i=t;for(let t of r)i=i[t];for(let t in a){let r=a[t];if("object"!=typeof r)continue;let{$data:o}=r.definition,n=i[t];o&&n&&(i[t]=A(n))}}return t}_removeAllSchemas(t,r){for(let a in t){let o=t[a];(!r||r.test(a))&&("string"==typeof o?delete t[a]:o&&!o.meta&&(this._cache.delete(o.schema),delete t[a]))}}_addSchema(t,r,a,o=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;a=(0,c.normalizeId)(n||a);let d=c.getSchemaRefs.call(this,t,a);return u=new s.SchemaEnv({schema:t,schemaId:l,meta:r,baseId:a,localRefs:d}),this._cache.set(u.schema,u),i&&!a.startsWith("#")&&(a&&this._checkUnique(a),this.refs[a]=u),o&&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 _(t,r,a,o="error"){for(let i in t)i in r&&this.logger[o](`${a}: 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 a=t[r];a.keyword||(a.keyword=r),this.addKeyword(a)}}function P(){let t={...this.opts};for(let r of m)delete t[r];return t}b.ValidationError=o.default,b.MissingRefError=i.default,t.default=b;let R={log(){},warn(){},error(){}},k=/^[a-z_$][a-z0-9_$:-]*$/i;function x(t,r){let{RULES:a}=this;if((0,d.eachItem)(t,t=>{if(a.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,a){var o;let i=null==r?void 0:r.post;if(a&&i)throw Error('keyword with "post" flag cannot have "type"');let{RULES:n}=this,s=i?n.post:n.rules.find(({type:t})=>t===a);if(s||(s={type:a,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==(o=r.implements)||o.forEach(t=>this.addKeyword(t))}function O(t,r,a){let o=t.rules.findIndex(t=>t.keyword===a);o>=0?t.rules.splice(o,0,r):(t.rules.push(r),this.logger.warn(`rule ${a} is not defined`))}function j(t){let{metaSchema:r}=t;void 0!==r&&(t.$data&&this.opts.$data&&(r=A(r)),t.validateSchema=this.compile(r,!0))}let C={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function A(t){return{anyOf:[t,C]}}}),cV=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}}}),cK=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;let r=cN(),a=ck(),o=cv(),i=c_(),n=cM(),s=cb();function l(t,r){let{gen:a}=t;return r.validate?a.scopeValue("validate",{ref:r.validate}):(0,o._)`${a.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:o.nil;function m(t){let r=(0,o._)`${t}.errors`;c.assign(i.default.vErrors,(0,o._)`${i.default.vErrors} === null ? ${r} : ${i.default.vErrors}.concat(${r})`),c.assign(i.default.errors,(0,o._)`${i.default.vErrors}.length`)}function y(t){var r;if(!u.opts.unevaluated)return;let a=null==(r=null==n?void 0:n.validate)?void 0:r.evaluated;if(!0!==u.props)if(a&&!a.dynamicProps)void 0!==a.props&&(u.props=s.mergeEvaluated.props(c,a.props,u.props));else{let r=c.var("props",(0,o._)`${t}.evaluated.props`);u.props=s.mergeEvaluated.props(c,r,u.props,o.Name)}if(!0!==u.items)if(a&&!a.dynamicItems)void 0!==a.items&&(u.items=s.mergeEvaluated.items(c,a.items,u.items));else{let r=c.var("items",(0,o._)`${t}.evaluated.items`);u.items=s.mergeEvaluated.items(c,r,u.items,o.Name)}}l?function(){if(!p.$async)throw Error("async schema referenced by sync schema");let i=c.let("valid");c.try(()=>{c.code((0,o._)`await ${(0,a.callValidateCode)(t,r,f)}`),y(r),d||c.assign(i,!0)},t=>{c.if((0,o._)`!(${t} instanceof ${u.ValidationError})`,()=>c.throw(t)),m(t),d||c.assign(i,!1)}),t.ok(i)}():t.result((0,a.callValidateCode)(t,r,f),()=>y(r),()=>m(r))}t.getValidate=l,t.callRef=c,t.default={keyword:"$ref",schemaType:"string",code(t){var a,i;let s,u,d,{gen:p,schema:h,it:f}=t,{baseId:m,schemaEnv:y,validateName:g,opts:v,self:b}=f,{root:_}=y;if(("#"===h||"#/"===h)&&m===_.baseId){if(y===_)return c(t,g,y,y.$async);let r=p.scopeValue("root",{ref:_});return c(t,(0,o._)`${r}.validate`,_,_.$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,a=S),a,a.$async):(i=S,s=p.scopeValue("schema",!0===v.code.source?{ref:i,code:(0,o.stringify)(i)}:{ref:i}),u=p.name("valid"),d=t.subschema({schema:i,dataTypes:[],schemaPath:o.nil,topSchemaRef:s,errSchemaPath:h},u),void(t.mergeEvaluated(d),t.ok(u)))}}}),cF=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cV(),a=cK();t.default=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",r.default,a.default]}),cJ=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cv(),a=r.operators,o={maximum:{okStr:"<=",ok:a.LTE,fail:a.GT},minimum:{okStr:">=",ok:a.GTE,fail:a.LT},exclusiveMaximum:{okStr:"<",ok:a.LT,fail:a.GTE},exclusiveMinimum:{okStr:">",ok:a.GT,fail:a.LTE}};t.default={keyword:Object.keys(o),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:a})=>(0,r.str)`must be ${o[t].okStr} ${a}`,params:({keyword:t,schemaCode:a})=>(0,r._)`{comparison: ${o[t].okStr}, limit: ${a}}`},code(t){let{keyword:a,data:i,schemaCode:n}=t;t.fail$data((0,r._)`${i} ${o[a].fail} ${n} || isNaN(${i})`)}}}),cW=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cv();t.default={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:t})=>(0,r.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,r._)`{multipleOf: ${t}}`},code(t){let{gen:a,data:o,schemaCode:i,it:n}=t,s=n.opts.multipleOfPrecision,l=a.let("res"),c=s?(0,r._)`Math.abs(Math.round(${l}) - ${l}) > 1e-${s}`:(0,r._)`${l} !== parseInt(${l})`;t.fail$data((0,r._)`(${i} === 0 || (${l} = ${o}/${i}, ${c}))`)}}}),cB=eo(t=>{function r(t){let r,a=t.length,o=0,i=0;for(;i<a;)o++,(r=t.charCodeAt(i++))>=55296&&r<=56319&&i<a&&(64512&(r=t.charCodeAt(i)))==56320&&i++;return o}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,r.code='require("ajv/dist/runtime/ucs2length").default'}),cG=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cv(),a=cb(),o=cB();t.default={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:a})=>(0,r.str)`must NOT have ${"maxLength"===t?"more":"fewer"} than ${a} characters`,params:({schemaCode:t})=>(0,r._)`{limit: ${t}}`},code(t){let{keyword:i,data: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,a.useFunc)(t.gen,o.default)}(${n})`;t.fail$data((0,r._)`${u} ${c} ${s}`)}}}),cZ=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ck(),a=cb(),o=cv();t.default={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,o.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,o._)`{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,o._)`new RegExp`:(0,a.useFunc)(i,r),l=i.let("valid");i.try(()=>i.assign(l,(0,o._)`${s}(${c}, ${d}).test(${n})`),()=>i.assign(l,!1)),t.fail$data((0,o._)`!${l}`)}else{let a=(0,r.usePattern)(t,l);t.fail$data((0,o._)`!${a}.test(${n})`)}}}}),cX=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cv();t.default={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:a})=>(0,r.str)`must NOT have ${"maxProperties"===t?"more":"fewer"} than ${a} properties`,params:({schemaCode:t})=>(0,r._)`{limit: ${t}}`},code(t){let{keyword:a,data:o,schemaCode:i}=t,n="maxProperties"===a?r.operators.GT:r.operators.LT;t.fail$data((0,r._)`Object.keys(${o}).length ${n} ${i}`)}}}),cY=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ck(),a=cv(),o=cb();t.default={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:t}})=>(0,a.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,a._)`{missingProperty: ${t}}`},code(t){let{gen:i,schema: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(a.nil,h);else for(let a of n)(0,r.checkReportMissingProp)(t,a)}():function(){let o=i.let("missing");if(p||c){let n=i.let("valid",!0);t.block$data(n,()=>{var c,u;return c=o,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,a.not)(u),()=>{t.error(),i.break()})},a.nil))}),t.ok(n)}else i.if((0,r.checkMissingProp)(t,n,o)),(0,r.reportMissingProp)(t,o),i.else()}(),d.strictRequired){let r=t.parentSchema.properties,{definedProperties:a}=t.it;for(let t of n)if((null==r?void 0:r[t])===void 0&&!a.has(t)){let r=`required property "${t}" is not defined at "${u.schemaEnv.baseId+u.errSchemaPath}" (strictRequired)`;(0,o.checkStrictMode)(u,r,u.opts.strictRequired)}}function h(){i.forOf("prop",s,a=>{t.setParams({missingProperty:a}),i.if((0,r.noPropertyInData)(i,l,a,d.ownProperties),()=>t.error())})}}}}),cQ=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cv();t.default={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:a})=>(0,r.str)`must NOT have ${"maxItems"===t?"more":"fewer"} than ${a} items`,params:({schemaCode:t})=>(0,r._)`{limit: ${t}}`},code(t){let{keyword:a,data:o,schemaCode:i}=t,n="maxItems"===a?r.operators.GT:r.operators.LT;t.fail$data((0,r._)`${o}.length ${n} ${i}`)}}}),c0=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cO();r.code='require("ajv/dist/runtime/equal").default',t.default=r}),c1=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cP(),a=cv(),o=cb(),i=c0();t.default={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:t,j:r}})=>(0,a.str)`must NOT have duplicate items (items ## ${r} and ${t} are identical)`,params:({params:{i:t,j:r}})=>(0,a._)`{i: ${t}, j: ${r}}`},code(t){let{gen: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,a._)`${s}.length`),c=n.let("j");t.setParams({i:l,j:c}),n.assign(h,!0),n.if((0,a._)`${l} > 1`,()=>(f.length>0&&!f.some(t=>"object"===t||"array"===t)?function(o,i){let l=n.name("item"),c=(0,r.checkDataTypes)(f,l,p.opts.strictNumbers,r.DataType.Wrong),u=n.const("indices",(0,a._)`{}`);n.for((0,a._)`;${o}--;`,()=>{n.let(l,(0,a._)`${s}[${o}]`),n.if(c,(0,a._)`continue`),f.length>1&&n.if((0,a._)`typeof ${l} == "string"`,(0,a._)`${l} += "_"`),n.if((0,a._)`typeof ${u}[${l}] == "number"`,()=>{n.assign(i,(0,a._)`${u}[${l}]`),t.error(),n.assign(h,!1).break()}).code((0,a._)`${u}[${l}] = ${o}`)})}:function(r,l){let c=(0,o.useFunc)(n,i.default),u=n.name("outer");n.label(u).for((0,a._)`;${r}--;`,()=>n.for((0,a._)`${l} = ${r}; ${l}--;`,()=>n.if((0,a._)`${c}(${s}[${r}], ${s}[${l}])`,()=>{t.error(),n.assign(h,!1).break(u)})))})(l,c))},(0,a._)`${d} === false`),t.ok(h)}}}),c2=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cv(),a=cb(),o=c0();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,a.useFunc)(i,o.default)}(${n}, ${l})`):t.fail((0,r._)`${c} !== ${n}`)}}}),c9=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cv(),a=cb(),o=c0();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,a.useFunc)(s,o.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((a,o)=>{var i,n;let s;return i=t,"object"==typeof(s=u[n=o])&&null!==s?(0,r._)`${f()}(${l}, ${i}[${n}])`:(0,r._)`${l} === ${s}`}))}t.pass(n)}}}),c4=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cJ(),a=cW(),o=cG(),i=cZ(),n=cX(),s=cY(),l=cQ(),c=c1(),u=c2(),d=c9();t.default=[r.default,a.default,o.default,i.default,n.default,s.default,l.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,d.default]}),c5=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;let r=cv(),a=cb();function o(t,o){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:o.length}),t.pass((0,r._)`${u} <= ${o.length}`);else if("object"==typeof n&&!(0,a.alwaysValidSchema)(c,n)){let n=i.var("valid",(0,r._)`${u} <= ${o.length}`);i.if((0,r.not)(n),()=>{var s;return s=n,void i.forRange("i",o.length,u,o=>{t.subschema({keyword:l,dataProp:o,dataPropType:a.Type.Num},s),c.allErrors||i.if((0,r.not)(s),()=>i.break())})}),t.ok(n)}}t.validateAdditionalItems=o,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)?o(t,n):(0,a.checkStrictMode)(i,'"additionalItems" is ignored when "items" is not an array of schemas')}}}),c6=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;let r=cv(),a=cb(),o=ck();function i(t,o,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[o]);if(r.strictTuples&&!l){let t=`"${u}" is ${s}-tuple, but minItems or maxItems/${o} are not specified or different at path "${i}"`;(0,a.checkStrictMode)(d,t,r.strictTuples)}})(l),d.opts.unevaluated&&n.length&&!0!==d.items&&(d.items=a.mergeEvaluated.items(s,n.length,d.items));let p=s.name("valid"),h=s.const("len",(0,r._)`${c}.length`);n.forEach((o,i)=>{(0,a.alwaysValidSchema)(d,o)||(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,a.alwaysValidSchema)(n,r)||t.ok((0,o.validateArray)(t))}}}),c3=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=c6();t.default={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,r.validateTuple)(t,"items")}}),c8=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cv(),a=cb(),o=ck(),i=c5();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,a.alwaysValidSchema)(s,r)||(l?(0,i.validateAdditionalItems)(t,l):t.ok((0,o.validateArray)(t)))}}}),c7=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cv(),a=cb();t.default={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:t,max:a}})=>void 0===a?(0,r.str)`must contain at least ${t} valid item(s)`:(0,r.str)`must contain at least ${t} and no more than ${a} valid item(s)`,params:({params:{min:t,max:a}})=>void 0===a?(0,r._)`{minContains: ${t}}`:(0,r._)`{minContains: ${t}, maxContains: ${a}}`},code(t){let o,i,{gen:n,schema:s,parentSchema:l,data:c,it:u}=t,{minContains:d,maxContains:p}=l;u.opts.next?(o=void 0===d?1:d,i=p):o=1;let h=n.const("len",(0,r._)`${c}.length`);if(t.setParams({min:o,max:i}),void 0===i&&0===o)return void(0,a.checkStrictMode)(u,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==i&&o>i){(0,a.checkStrictMode)(u,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,a.alwaysValidSchema)(u,s)){let a=(0,r._)`${h} >= ${o}`;void 0!==i&&(a=(0,r._)`${a} && ${h} <= ${i}`),t.pass(a);return}u.items=!0;let f=n.name("valid");function m(){let t=n.name("_valid"),a=n.let("count",0);y(t,()=>n.if(t,()=>{var t;return t=a,void(n.code((0,r._)`${t}++`),void 0===i?n.if((0,r._)`${t} >= ${o}`,()=>n.assign(f,!0).break()):(n.if((0,r._)`${t} > ${i}`,()=>n.assign(f,!1).break()),1===o?n.assign(f,!0):n.if((0,r._)`${t} >= ${o}`,()=>n.assign(f,!0))))}))}function y(r,o){n.forRange("i",0,h,i=>{t.subschema({keyword:"contains",dataProp:i,dataPropType:a.Type.Num,compositeRule:!0},r),o()})}void 0===i&&1===o?y(f,()=>n.if(f,()=>n.break())):0===o?(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())}}}),ue=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;let r=cv(),a=cb(),o=ck();t.error={message:({params:{property:t,depsCount:a,deps:o}})=>(0,r.str)`must have ${1===a?"property":"properties"} ${o} when property ${t} is present`,params:({params:{property:t,depsCount:a,deps:o,missingProperty:i}})=>(0,r._)`{property: ${t},
|
|
59
61
|
missingProperty: ${i},
|
|
60
|
-
depsCount: ${
|
|
61
|
-
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);s(t,r),n(t,o)}};function s(t,o=t.schema){let{gen:i,data:n,it:l}=t;if(0===Object.keys(o).length)return;let c=i.let("missing");for(let s in o){let u=o[s];if(0===u.length)continue;let d=(0,a.propertyInData)(i,n,s,l.opts.ownProperties);t.setParams({property:s,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 n(t,r=t.schema){let{gen:i,data:s,keyword:l,it:c}=t,u=i.name("valid");for(let n in r)(0,o.alwaysValidSchema)(c,r[n])||(i.if((0,a.propertyInData)(i,s,n,c.opts.ownProperties),()=>{let r=t.subschema({keyword:l,schemaProp:n},u);t.mergeValidEvaluated(r,u)},()=>i.var(u,!0)),t.ok(u))}t.validatePropertyDeps=s,t.validateSchemaDeps=n,t.default=i}),ur=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb(),o=c_();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:s,it:n}=t;if((0,o.alwaysValidSchema)(n,i))return;let l=a.name("valid");a.forIn("key",s,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),n.allErrors||a.break()})}),t.ok(l)}}}),uo=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cO(),o=cb(),a=cS(),i=c_();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:s,schema:n,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,n))return;let f=(0,r.allSchemaProperties)(l.properties),m=(0,r.allSchemaProperties)(l.patternProperties);function y(t){s.code((0,o._)`delete ${c}[${t}]`)}function g(r){if("all"===h.removeAdditional||h.removeAdditional&&!1===n)return void y(r);if(!1===n){t.setParams({additionalProperty:r}),t.error(),p||s.break();return}if("object"==typeof n&&!(0,i.alwaysValidSchema)(d,n)){let a=s.name("valid");"failing"===h.removeAdditional?(v(r,a,!1),s.if((0,o.not)(a),()=>{t.reset(),y(r)})):(v(r,a),p||s.if((0,o.not)(a),()=>s.break()))}}function v(r,o,a){let s={keyword:"additionalProperties",dataProp:r,dataPropType:i.Type.Str};!1===a&&Object.assign(s,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(s,o)}s.forIn("key",c,a=>{f.length||m.length?s.if(function(a){let n;if(f.length>8){let t=(0,i.schemaRefOrVal)(d,l.properties,"properties");n=(0,r.isOwnProperty)(s,t,a)}else n=f.length?(0,o.or)(...f.map(t=>(0,o._)`${a} === ${t}`)):o.nil;return m.length&&(n=(0,o.or)(n,...m.map(i=>(0,o._)`${(0,r.usePattern)(t,i)}.test(${a})`))),(0,o.not)(n)}(a),()=>g(a)):g(a)}),t.ok((0,o._)`${u} === ${a.default.errors}`)}}}),ua=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cI(),o=cO(),a=c_(),i=uo();t.default={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:s,schema:n,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)(n);for(let t of d)u.definedProperties.add(t);u.opts.unevaluated&&d.length&&!0!==u.props&&(u.props=a.mergeEvaluated.props(s,(0,a.toHash)(d),u.props));let p=d.filter(t=>!(0,a.alwaysValidSchema)(u,n[t]));if(0===p.length)return;let h=s.name("valid");for(let r of p){var f;(f=r,u.opts.useDefaults&&!u.compositeRule&&void 0!==n[f].default)?m(r):(s.if((0,o.propertyInData)(s,c,r,u.opts.ownProperties)),m(r),u.allErrors||s.else().var(h,!0),s.endIf()),t.it.definedProperties.add(r),t.ok(h)}function m(r){t.subschema({keyword:"properties",schemaProp:r,dataProp:r},h)}}}}),ui=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cO(),o=cb(),a=c_(),i=c_();t.default={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:s,schema:n,data:l,parentSchema:c,it:u}=t,{opts:d}=u,p=(0,r.allSchemaProperties)(n),h=p.filter(t=>(0,a.alwaysValidSchema)(u,n[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=s.name("valid");!0===u.props||u.props instanceof o.Name||(u.props=(0,i.evaluatedPropsToName)(s,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):(s.var(m,!0),g(t),s.if(m));function g(a){s.forIn("key",l,n=>{s.if((0,o._)`${(0,r.usePattern)(t,a)}.test(${n})`,()=>{let r=h.includes(a);r||t.subschema({keyword:"patternProperties",schemaProp:a,dataProp:n,dataPropType:i.Type.Str},m),u.opts.unevaluated&&!0!==y?s.assign((0,o._)`${y}[${n}]`,!0):r||u.allErrors||s.if((0,o.not)(m),()=>s.break())})})}}}}),us=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=c_();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 s=o.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),t.failResult(s,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}}}),un=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:cO().validateUnion,error:{message:"must match a schema in anyOf"}}}),ul=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb(),o=c_();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:s,it:n}=t;if(!Array.isArray(i))throw Error("ajv implementation error");if(n.opts.discriminator&&s.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,s)=>{let d;(0,o.alwaysValidSchema)(n,i)?a.var(u,!0):d=t.subschema({keyword:"oneOf",schemaProp:s,compositeRule:!0},u),s>0&&a.if((0,r._)`${u} && ${l}`).assign(l,!1).assign(c,(0,r._)`[${c}, ${s}]`).else(),a.if(u,()=>{a.assign(l,!0),a.assign(c,s),d&&t.mergeEvaluated(d,r.Name)})})}),t.result(l,()=>t.reset(),()=>t.error(!0))}}}),uc=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=c_();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 s=o.name("valid");a.forEach((o,a)=>{if((0,r.alwaysValidSchema)(i,o))return;let n=t.subschema({keyword:"allOf",schemaProp:a},s);t.ok(s),t.mergeEvaluated(n)})}}}),uu=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb(),o=c_();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:s,parentSchema:n,it:l}=t;void 0===n.then&&void 0===n.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=s.let("valid",!0),p=s.name("_valid");if(i=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},p),t.mergeEvaluated(i),t.reset(),c&&u){let r=s.let("ifClause");t.setParams({ifClause:r}),s.if(p,h("then",r),h("else",r))}else c?s.if(p,h("then")):s.if((0,r.not)(p),h("else"));function h(o,a){return()=>{let i=t.subschema({keyword:o},p);s.assign(d,p),t.mergeValidEvaluated(i,d),a?s.assign(a,(0,r._)`${o}`):t.setParams({ifClause:o})}}t.pass(d,()=>t.error(!0))}}}),ud=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=c_();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`)}}}),up=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=c3(),o=c8(),a=c6(),i=c7(),s=ue(),n=ut(),l=ur(),c=uo(),u=ua(),d=ui(),p=us(),h=un(),f=ul(),m=uc(),y=uu(),g=ud();t.default=function(t=!1){let v=[p.default,h.default,f.default,m.default,y.default,g.default,l.default,c.default,n.default,u.default,d.default];return t?v.push(o.default,i.default):v.push(r.default,a.default),v.push(s.default),v}}),uh=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb();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,s,n,l,c,{gen:u,data:d,$data:p,schema:h,schemaCode:f,it:m}=t,{opts:y,errSchemaPath:g,schemaEnv:v,self:b}=m;y.validateFormats&&(p?(a=u.scopeValue("formats",{ref:b.formats,code:y.code.formats}),i=u.const("fDef",(0,r._)`${a}[${f}]`),s=u.let("fType"),n=u.let("format"),u.if((0,r._)`typeof ${i} == "object" && !(${i} instanceof RegExp)`,()=>u.assign(s,(0,r._)`${i}.type || "string"`).assign(n,(0,r._)`${i}.validate`),()=>u.assign(s,(0,r._)`"string"`).assign(n,i)),t.fail$data((0,r.or)(!1===y.strictSchema?r.nil:(0,r._)`${f} && !${n}`,(l=v.$async?(0,r._)`(${i}.async ? await ${n}(${d}) : ${n}(${d}))`:(0,r._)`${n}(${d})`,c=(0,r._)`(typeof ${n} == "function" ? ${l} : ${n}.test(${d}))`,(0,r._)`${n} && ${n} !== true && ${s} === ${o} && !${c}`)))):function(){var a;let i,s,n=b.formats[h];if(!n){if(!1===y.strictSchema)return b.logger.warn(l());throw Error(l());function l(){return`unknown format "${h}" ignored in schema at path "${g}"`}}if(!0===n)return;let[c,p,f]=(i=(a=n)instanceof RegExp?(0,r.regexpCode)(a):y.code.formats?(0,r._)`${y.code.formats}${(0,r.getProperty)(h)}`:void 0,s=u.scopeValue("formats",{key:h,ref:a,code:i}),"object"!=typeof a||a instanceof RegExp?["string",a,s]:[a.type||"string",a.validate,(0,r._)`${s}.validate`]);c===o&&t.pass(function(){if("object"==typeof n&&!(n instanceof RegExp)&&n.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})`}())}())}}}),uf=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=[uh().default]}),um=ea(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"]}),uy=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cJ(),o=c5(),a=up(),i=uf(),s=um();t.default=[r.default,o.default,(0,a.default)(),i.default,s.metadataVocabulary,s.contentVocabulary]}),ug=ea(t=>{var r,o;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,(o=r||(t.DiscrError=r={})).Tag="tag",o.Mapping="mapping"}),uv=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb(),o=ug(),a=cq(),i=cM(),s=c_();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:n,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=n.let("valid",!1),m=n.const("tag",(0,r._)`${l}${(0,r.getProperty)(h)}`);n.if((0,r._)`typeof ${m} == "string"`,()=>(function(){let l=function(){var t;let r={},o=l(u),n=!0;for(let r=0;r<p.length;r++){let u=p[r];if((null==u?void 0:u.$ref)&&!(0,s.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}"`);n=n&&(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(!n)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 n.if(!1),l)n.elseIf((0,r._)`${m} === ${o}`),n.assign(f,function(o){let a=n.name("valid"),i=t.subschema({keyword:"oneOf",schemaProp:o},a);return t.mergeEvaluated(i,r.Name),a}(l[o]));n.else(),t.error(!1,{discrError:o.DiscrError.Mapping,tag:m,tagName:h}),n.endIf()})(),()=>t.error(!1,{discrError:o.DiscrError.Tag,tag:m,tagName:h})),t.ok(f)}}}),ub=ea((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}}),u_=ea((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=cF(),a=uy(),i=uv(),s=ub(),n=["/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(s,n):s;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=cI();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=cb();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=cA();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return p.default}});var h=cM();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return h.default}})}),uS=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicAnchor=void 0;let r=cb(),o=cS(),a=cq(),i=cK();function s(t,s){let{gen:n,it:l}=t;l.schemaEnv.root.dynamicAnchors[s]=!0;let c=(0,r._)`${o.default.dynamicAnchors}${(0,r.getProperty)(s)}`,u="#"===l.errSchemaPath?l.validateName:function(t){let{schemaEnv:r,schema:o,self:s}=t.it,{root:n,baseId:l,localRefs:c,meta:u}=r.root,{schemaId:d}=s.opts,p=new a.SchemaEnv({schema:o,schemaId:d,root:n,baseId:l,localRefs:c,meta:u});return a.compileSchema.call(s,p),(0,i.getValidate)(t,p)}(t);n.if((0,r._)`!${c}`,()=>n.assign(c,u))}t.dynamicAnchor=s,t.default={keyword:"$dynamicAnchor",schemaType:"string",code:t=>s(t,t.schema)}}),u$=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicRef=void 0;let r=cb(),o=cS(),a=cK();function i(t,i){let{gen:s,keyword:n,it:l}=t;if("#"!==i[0])throw Error(`"${n}" only supports hash fragment reference`);let c=i.slice(1);if(l.allErrors)u();else{let r=s.let("valid",!1);u(r),t.ok(r)}function u(t){if(l.schemaEnv.root.dynamicAnchors[c]){let a=s.let("_v",(0,r._)`${o.default.dynamicAnchors}${(0,r.getProperty)(c)}`);s.if(a,d(a,t),d(l.validateName,t))}else d(l.validateName,t)()}function d(r,o){return o?()=>s.block(()=>{(0,a.callRef)(t,r),s.let(o,!0)}):()=>(0,a.callRef)(t,r)}}t.dynamicRef=i,t.default={keyword:"$dynamicRef",schemaType:"string",code:t=>i(t,t.schema)}}),uw=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uS(),o=c_();t.default={keyword:"$recursiveAnchor",schemaType:"boolean",code(t){t.schema?(0,r.dynamicAnchor)(t,""):(0,o.checkStrictMode)(t.it,"$recursiveAnchor: false is ignored")}}}),uE=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u$();t.default={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,r.dynamicRef)(t,t.schema)}}),uR=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uS(),o=u$(),a=uw(),i=uE();t.default=[r.default,o.default,a.default,i.default]}),uP=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ut();t.default={keyword:"dependentRequired",type:"object",schemaType:"object",error:r.error,code:t=>(0,r.validatePropertyDeps)(t)}}),uk=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ut();t.default={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,r.validateSchemaDeps)(t)}}),uO=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=c_();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`)}}}),uT=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uP(),o=uk(),a=uO();t.default=[r.default,o.default,a.default]}),ux=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb(),o=c_(),a=cS();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:s,data:n,errsCount:l,it:c}=t;if(!l)throw Error("ajv implementation error");let{allErrors:u,props:d}=c;function p(a){if(!1===s){t.setParams({unevaluatedProperty:a}),t.error(),u||i.break();return}if(!(0,o.alwaysValidSchema)(c,s)){let s=i.name("valid");t.subschema({keyword:"unevaluatedProperties",dataProp:a,dataPropType:o.Type.Str},s),u||i.if((0,r.not)(s),()=>i.break())}}d instanceof r.Name?i.if((0,r._)`${d} !== true`,()=>i.forIn("key",n,t=>{var o,a;return i.if((o=d,a=t,(0,r._)`!${o} || !${o}[${a}]`),()=>p(t))})):!0!==d&&i.forIn("key",n,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}`)}}}),uj=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb(),o=c_();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:s,it:n}=t,l=n.items||0;if(!0===l)return;let c=a.const("len",(0,r._)`${s}.length`);if(!1===i)t.setParams({len:l}),t.fail((0,r._)`${c} > ${l}`);else if("object"==typeof i&&!(0,o.alwaysValidSchema)(n,i)){let i=a.var("valid",(0,r._)`${c} <= ${l}`);a.if((0,r.not)(i),()=>{var s,u;return s=i,u=l,void a.forRange("i",u,c,i=>{t.subschema({keyword:"unevaluatedItems",dataProp:i,dataPropType:o.Type.Num},s),n.allErrors||a.if((0,r.not)(s),()=>a.break())})}),t.ok(i)}n.items=!0}}}),uC=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ux(),o=uj();t.default=[r.default,o.default]}),uN=ea((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"}]}}}}}),uI=ea((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:"#"}}}}}),uA=ea((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:"#"}}}}),uM=ea((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:{}}}}}),uq=ea((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"}}}}),uz=ea((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}}}}),uL=ea((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:[]}}}}),uD=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uN(),o=uI(),a=uA(),i=uM(),s=uq(),n=uz(),l=uL(),c=["/properties"];t.default=function(t){return[r,o,a,i,u(this,s),n,u(this,l)].forEach(t=>this.addMetaSchema(t,void 0,!1)),this;function u(r,o){return t?r.$dataMetaSchema(o,c):o}}}),uU=ea((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=cF(),a=uy(),i=uR(),s=uT(),n=uC(),l=uv(),c=uD(),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(s.default),this.addVocabulary(n.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=cI();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return p.KeywordCxt}});var h=cb();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=cA();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return f.default}});var m=cM();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return m.default}})}),uV=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cJ(),o=c5(),a=up(),i=uR(),s=uT(),n=uC(),l=uf(),c=um();t.default=[i.default,r.default,o.default,(0,a.default)(!0),l.default,c.metadataVocabulary,c.contentVocabulary,s.default,n.default]}),uF=ea((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}}}}),uH=ea((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"}}}}}),uK=ea((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"}}}}),uJ=ea((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"}}}}),uB=ea((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"}}}}),uG=ea((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"}}}}),uZ=ea((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}}}}),uW=ea((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:[]}}}}),uX=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uF(),o=uH(),a=uK(),i=uJ(),s=uB(),n=uG(),l=uZ(),c=uW(),u=["/properties"];t.default=function(t){return[r,o,a,i,s,d(this,n),l,d(this,c)].forEach(t=>this.addMetaSchema(t,void 0,!1)),this;function d(r,o){return t?r.$dataMetaSchema(o,u):o}}}),uY=ea((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=cF(),a=uV(),i=uv(),s=uX(),n="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&&(s.default.call(this,t),this.refs["http://json-schema.org/schema"]=n)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(n)?n:void 0)}};t.Ajv2020=l,r.exports=t=l,r.exports.Ajv2020=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var c=cI();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=cb();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=cA();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.default}});var p=cM();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}),uQ=ea(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,s),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<=b&&t>=v}},int64:{type:"number",validate:function(t){return Number.isInteger(t)}},float:{type:"number",validate:_},double:{type:"number",validate:_},password:!0,binary:!0},t.fastFormats={...t.fullFormats,date:r(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,s),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 s=+i[1],n=+i[2],l=+i[3];return n>=1&&n<=12&&l>=1&&l<=(2===n&&(r=s)%4==0&&(r%100!=0||r%400==0)?29:a[n])}function s(t,r){if(t&&r)return t>r?1:t<r?-1:0}let n=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function l(t){return function(r){let o=n.exec(r);if(!o)return!1;let a=+o[1],i=+o[2],s=+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&&s<60)return!0;let p=i-d*c,h=a-u*c-(p<0);return(23===h||-1===h)&&(59===p||-1===p)&&s<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=n.exec(t),a=n.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,n]=r.split(d),l=s(o,i);if(void 0!==l)return l||c(a,n)}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,b=0x80000000-1;function _(){return!0}let S=/[^\\]\\Z/}),u0=ea(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;let r=u_(),o=cb(),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,s,{gen:n,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=n.scopeValue("formats",{ref:h.formats,code:p.code.formats}),s=n.const("fmt",(0,o._)`${a}[${f.schemaCode}]`),t.fail$data((0,o.or)((0,o._)`typeof ${s} != "object"`,(0,o._)`${s} instanceof RegExp`,(0,o._)`typeof ${s}.compare != "function"`,m(s)))):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=n.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)}),u1=ea((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});let o=uQ(),a=u0(),i=cb(),s=new i.Name("fullFormats"),n=new i.Name("fastFormats"),l=(t,r={keywords:!0})=>{if(Array.isArray(r))return c(t,r,o.fullFormats,s),t;let[i,l]="fast"===r.mode?[o.fastFormats,n]:[o.fullFormats,s];return c(t,r.formats||o.formatNames,i,l),r.keywords&&(0,a.default)(t),t};function c(t,r,o,a){var s;for(let n of(null!=(s=t.opts.code).formats||(s.formats=(0,i._)`require("ajv-formats/dist/formats").${a}`),r))t.addFormat(n,o[n])}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}),u2=u_(),u9=uU(),u4=uY();((t,r,o,a)=>{if(r&&"object"==typeof r||"function"==typeof r)for(var i,s=et(r),n=0,l=s.length;n<l;n++)i=s[n],eo.call(t,i)||i===o||Q(t,i,{get:(t=>r[t]).bind(null,i),enumerable:!(a=ee(r,i))||a.enumerable});return t})(Q(null!=(S=u1())?Y(er(S)):{},"default",{value:S,enumerable:!0}),S).default;u2.Ajv;let u5=require("node:process"),u3=Symbol.for("mcp.completable");function u6(t,r){return Object.defineProperty(t,u3,{value:{complete:r},enumerable:!1,writable:!1,configurable:!1}),t}function u8(t){let r="";for(let o of t)r+=String.fromCodePoint(o);return btoa(r).replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}function u7(t){let r=atob(t.replaceAll("-","+").replaceAll("_","/")),o=new Uint8Array(r.length);for(let t=0;t<r.length;t++)o[t]=r.codePointAt(t);return o}function de(t){let r,o=globalThis.crypto?.subtle;if(void 0===o)throw TypeError("createRequestStateCodec requires the Web Crypto API (globalThis.crypto.subtle); see https://ts.sdk.modelcontextprotocol.io/v2/troubleshooting for the Node.js polyfill instructions");let a="string"==typeof t.key?new TextEncoder().encode(t.key):Uint8Array.from(t.key);if(a.byteLength<32)throw RangeError(`createRequestStateCodec: key must be at least 32 bytes (got ${a.byteLength})`);let i=t.ttlSeconds??600;if(!Number.isFinite(i))throw RangeError("createRequestStateCodec: ttlSeconds must be a finite number");let s=t.bind,n=()=>r??=o.importKey("raw",a,{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]),l=new TextEncoder,c=async t=>u8(new Uint8Array(await o.sign("HMAC",await n(),l.encode("mcp.requestState.bind:"+t))).slice(0,16));return{async mint(t,r){let a={p:t,exp:Math.floor(Date.now()/1e3)+i};if(void 0!==s){if(void 0===r)throw TypeError("createRequestStateCodec: mint() requires ctx when a bind callback is configured");a.b=await c(s(r))}let u=u8(l.encode(JSON.stringify(a)));return`v1.${u}.${u8(new Uint8Array(await o.sign("HMAC",await n(),l.encode("v1."+u))))}`},async verify(t,r){let a,i,u=t.lastIndexOf(".");if(!t.startsWith("v1.")||u<=3)throw Error("malformed");let d=t.slice(3,u);try{a=u7(t.slice(u+1))}catch{throw Error("malformed")}if(!await o.verify("HMAC",await n(),a,l.encode("v1."+d)))throw Error("mac");try{i=JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(u7(d)))}catch{throw Error("malformed")}if("number"!=typeof i.exp||i.exp<Math.floor(Date.now()/1e3))throw Error("expired");if(void 0!==s){let t=await c(s(r));if(void 0===i.b||!function(t,r){if(t.length!==r.length)return!1;let o=0;for(let a=0;a<t.length;a++)o|=t.codePointAt(a)^r.codePointAt(a);return 0===o}(i.b,t))throw Error("bind")}else if(void 0!==i.b)throw Error("bind");return i.p}}}var dt=Object.create,dr=Object.defineProperty,da=Object.getOwnPropertyDescriptor,di=Object.getOwnPropertyNames,ds=Object.getPrototypeOf,dn=Object.prototype.hasOwnProperty,dl=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports),dc=(t,r,o)=>(o=null!=t?dt(ds(t)):{},((t,r,o,a)=>{if(r&&"object"==typeof r||"function"==typeof r)for(var i,s=di(r),n=0,l=s.length;n<l;n++)i=s[n],dn.call(t,i)||i===o||dr(t,i,{get:(t=>r[t]).bind(null,i),enumerable:!(a=da(r,i))||a.enumerable});return t})(!r&&t&&t.__esModule?o:dr(o,"default",{value:t,enumerable:!0}),t));let du=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),dd=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),dp=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),dh=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]),df=Symbol.for("mcp.sdk.errorBrands");function dm(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,df,{value:o,enumerable:!1,configurable:!0})}function dy(t,r){try{if("object"==typeof r&&null!==r&&Object.prototype.hasOwnProperty.call(t,"mcpBrand")&&"string"==typeof t.mcpBrand&&Object.prototype.hasOwnProperty.call(r,df)){let o=r[df];if(o&&"function"==typeof o.has&&o.has(t.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(t,r)}let dg=((R={}).InvalidRequest="invalid_request",R.InvalidClient="invalid_client",R.InvalidGrant="invalid_grant",R.UnauthorizedClient="unauthorized_client",R.UnsupportedGrantType="unsupported_grant_type",R.InvalidScope="invalid_scope",R.AccessDenied="access_denied",R.ServerError="server_error",R.TemporarilyUnavailable="temporarily_unavailable",R.UnsupportedResponseType="unsupported_response_type",R.UnsupportedTokenType="unsupported_token_type",R.InvalidToken="invalid_token",R.MethodNotAllowed="method_not_allowed",R.TooManyRequests="too_many_requests",R.InvalidClientMetadata="invalid_client_metadata",R.InvalidRedirectUri="invalid_redirect_uri",R.InsufficientScope="insufficient_scope",R.InvalidTarget="invalid_target",R);var dv=class t extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return dy(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 dy(this,t)}constructor(t,r,o){super(r),this.code=t,this.errorUri=o,this.name="OAuthError",dm(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 db=((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 d_=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](t){return dy(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 dy(this,t)}constructor(t,r,o){super(r),this.code=t,this.data=o,this.name="SdkError",dm(this,new.target)}},dS=class extends d_{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 d$="2026-07-28",dw=[d$];function dE(t){return t.filter(t=>!(t>=d$))}function dR(t){return t.filter(t=>t>=d$)}function dP(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 dk=["task","inputRequests","requestState"];function dO(t){return null===t||"object"!=typeof t||Array.isArray(t)||void 0!==t.content||dk.some(r=>r in t)?t:{...t,content:[]}}function dT(){let t,r,o,a,s,n,l,c,u,d,p,h,f,m,y,g,v,b,_,S,$,w,E,R,P,k,O,T,x,j,C,N,I,A,M,q,z,L,D,U,V,F,H,K,J,B,G,Z,W,X,Y,Q,ee,et,er,eo,ea,ei,es,en,el,ec,eu,ed,ep,eh,ef,em,ey,eg,ev,eb,e_,eS,e$,ew,eE,eR,eP,ek,eO,eT,ex,ej,eC,eN,eI,eA,eM,eq,ez,eL,eD,eU,eV,eF,eH,eK,eJ,eB,eG,eZ,eW,eX,eY,eQ,e0,e1,e2,e9,e4,e5,e3,e6,e8,e7,te,tt,tr,to,ta,ti,ts,tn,tl,tc,tu,td,tp,th,tf,tm,ty,tg,tv,tb,t_,tS,t$,tw;return i??=(t=iZ(()=>i$([aU(),io(),il(),iu(),iO(aU(),t),ig(t)])),r=iO(aU(),t),o=i$([aU(),io().int()]),a=aU(),s=ib({ttl:io().optional()}),n=ib({taskId:aU()}),u=(c=ib({_meta:(l=i_({progressToken:o.optional(),"io.modelcontextprotocol/related-task":n.optional()})).optional()})).extend({task:s.optional()}),d=ib({method:aU(),params:c.loose().optional()}),p=ib({_meta:l.optional()}),h=ib({method:aU(),params:p.loose().optional()}),f=i_({_meta:l.optional()}),m=i$([aU(),io().int()]),y=f.strict(),g=p.extend({requestId:m.optional(),reason:aU().optional()}),v=h.extend({method:iC("notifications/cancelled"),params:g}),b=ib({src:aU(),mimeType:aU().optional(),sizes:ig(aU()).optional(),theme:ix(["light","dark"]).optional()}),_=ib({icons:ig(b).optional()}),$=(S=ib({name:aU(),title:aU().optional()})).extend({...S.shape,..._.shape,version:aU(),websiteUrl:aU().optional(),description:aU().optional()}),w=iP(ib({applyDefaults:il().optional()}),r),E=iX(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,iP(ib({form:w.optional(),url:r.optional()}),r.optional())),R=i_({list:r.optional(),cancel:r.optional(),requests:i_({sampling:i_({createMessage:r.optional()}).optional(),elicitation:i_({create:r.optional()}).optional()}).optional()}),P=i_({list:r.optional(),cancel:r.optional(),requests:i_({tools:i_({call:r.optional()}).optional()}).optional()}),k=ib({experimental:iO(aU(),r).optional(),sampling:ib({context:r.optional(),tools:r.optional()}).optional(),elicitation:E.optional(),roots:ib({listChanged:il().optional()}).optional(),tasks:R.optional(),extensions:iO(aU(),r).optional()}),O=c.extend({protocolVersion:aU(),capabilities:k,clientInfo:$}),T=d.extend({method:iC("initialize"),params:O}),x=ib({experimental:iO(aU(),r).optional(),logging:r.optional(),completions:r.optional(),prompts:ib({listChanged:il().optional()}).optional(),resources:ib({subscribe:il().optional(),listChanged:il().optional()}).optional(),tools:ib({listChanged:il().optional()}).optional(),tasks:P.optional(),extensions:iO(aU(),r).optional()}),j=f.extend({protocolVersion:aU(),capabilities:x,serverInfo:$,instructions:aU().optional()}),C=h.extend({method:iC("notifications/initialized"),params:p.optional()}),N=d.extend({method:iC("ping"),params:c.optional()}),I=ib({progress:io(),total:iM(io()),message:iM(aU())}),A=ib({...p.shape,...I.shape,progressToken:o}),M=h.extend({method:iC("notifications/progress"),params:A}),q=c.extend({cursor:a.optional()}),z=d.extend({params:q.optional()}),L=f.extend({nextCursor:a.optional()}),U=(D=ib({uri:aU(),mimeType:iM(aU()),_meta:iO(aU(),ih()).optional()})).extend({text:aU()}),V=aU().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),F=D.extend({blob:V}),K=ib({audience:ig(H=ix(["user","assistant"])).optional(),priority:io().min(0).max(1).optional(),lastModified:oo(aF,{offset:!0}).optional()}),J=ib({...S.shape,..._.shape,uri:aU(),description:iM(aU()),mimeType:iM(aU()),size:iM(io()),annotations:K.optional(),_meta:iM(i_({}))}),B=ib({...S.shape,..._.shape,uriTemplate:aU(),description:iM(aU()),mimeType:iM(aU()),annotations:K.optional(),_meta:iM(i_({}))}),G=z.extend({method:iC("resources/list")}),Z=L.extend({resources:ig(J)}),W=z.extend({method:iC("resources/templates/list")}),X=L.extend({resourceTemplates:ig(B)}),Y=c.extend({uri:aU()}),Q=d.extend({method:iC("resources/read"),params:Y}),ee=f.extend({contents:ig(i$([U,F]))}),et=h.extend({method:iC("notifications/resources/list_changed"),params:p.optional()}),er=d.extend({method:iC("resources/subscribe"),params:Y}),eo=d.extend({method:iC("resources/unsubscribe"),params:Y}),ea=p.extend({uri:aU()}),ei=h.extend({method:iC("notifications/resources/updated"),params:ea}),es=ib({name:aU(),description:iM(aU()),required:iM(il())}),en=ib({...S.shape,..._.shape,description:iM(aU()),arguments:iM(ig(es)),_meta:iM(i_({}))}),el=z.extend({method:iC("prompts/list")}),ec=L.extend({prompts:ig(en)}),eu=c.extend({name:aU(),arguments:iO(aU(),aU()).optional()}),ed=d.extend({method:iC("prompts/get"),params:eu}),ep=ib({type:iC("text"),text:aU(),annotations:K.optional(),_meta:iO(aU(),ih()).optional()}),eh=ib({type:iC("image"),data:V,mimeType:aU(),annotations:K.optional(),_meta:iO(aU(),ih()).optional()}),ef=ib({type:iC("audio"),data:V,mimeType:aU(),annotations:K.optional(),_meta:iO(aU(),ih()).optional()}),em=ib({type:iC("tool_use"),name:aU(),id:aU(),input:iO(aU(),ih()),_meta:iO(aU(),ih()).optional()}),ey=ib({type:iC("resource"),resource:i$([U,F]),annotations:K.optional(),_meta:iO(aU(),ih()).optional()}),eb=ib({role:H,content:ev=i$([ep,eh,ef,eg=J.extend({type:iC("resource_link")}),ey])}),e_=f.extend({description:aU().optional(),messages:ig(eb)}),eS=h.extend({method:iC("notifications/prompts/list_changed"),params:p.optional()}),e$=ib({title:aU().optional(),readOnlyHint:il().optional(),destructiveHint:il().optional(),idempotentHint:il().optional(),openWorldHint:il().optional()}),ew=ib({taskSupport:ix(["required","optional","forbidden"]).optional()}),eE=ib({...S.shape,..._.shape,description:aU().optional(),inputSchema:ib({type:iC("object"),properties:iO(aU(),t).optional(),required:ig(aU()).optional()}).catchall(ih()),outputSchema:ib({type:iC("object"),properties:iO(aU(),t).optional(),required:ig(aU()).optional()}).catchall(ih()).optional(),annotations:e$.optional(),execution:ew.optional(),_meta:iO(aU(),ih()).optional()}),eR=z.extend({method:iC("tools/list")}),eP=L.extend({tools:ig(eE)}),ek=f.extend({content:ig(ev),structuredContent:iO(aU(),ih()).optional(),isError:il().optional()}),eO=u.extend({name:aU(),arguments:iO(aU(),ih()).optional()}),eT=d.extend({method:iC("tools/call"),params:eO}),ex=h.extend({method:iC("notifications/tools/list_changed"),params:p.optional()}),ej=ix(["debug","info","notice","warning","error","critical","alert","emergency"]),eC=c.extend({level:ej}),eN=d.extend({method:iC("logging/setLevel"),params:eC}),eI=p.extend({level:ej,logger:aU().optional(),data:ih()}),eA=h.extend({method:iC("notifications/message"),params:eI}),eM=ib({name:aU().optional()}),eq=ib({hints:ig(eM).optional(),costPriority:io().min(0).max(1).optional(),speedPriority:io().min(0).max(1).optional(),intelligencePriority:io().min(0).max(1).optional()}),ez=ib({mode:ix(["auto","required","none"]).optional()}),eL=ib({type:iC("tool_result"),toolUseId:aU().describe("The unique identifier for the corresponding tool call."),content:ig(ev),structuredContent:ib({}).loose().optional(),isError:il().optional(),_meta:iO(aU(),ih()).optional()}),eD=iE("type",[ep,eh,ef]),eV=ib({role:H,content:i$([eU=iE("type",[ep,eh,ef,em,eL]),ig(eU)]),_meta:iO(aU(),ih()).optional()}),eF=u.extend({messages:ig(eV),modelPreferences:eq.optional(),systemPrompt:aU().optional(),includeContext:ix(["none","thisServer","allServers"]).optional(),temperature:io().optional(),maxTokens:io().int(),stopSequences:ig(aU()).optional(),metadata:r.optional(),tools:ig(eE).optional(),toolChoice:ez.optional()}),eH=d.extend({method:iC("sampling/createMessage"),params:eF}),eK=f.extend({model:aU(),stopReason:iM(ix(["endTurn","stopSequence","maxTokens"]).or(aU())),role:H,content:eD}),eJ=f.extend({model:aU(),stopReason:iM(ix(["endTurn","stopSequence","maxTokens","toolUse"]).or(aU())),role:H,content:i$([eU,ig(eU)])}),eB=ib({type:iC("boolean"),title:aU().optional(),description:aU().optional(),default:il().optional()}),eG=ib({type:iC("string"),title:aU().optional(),description:aU().optional(),minLength:io().optional(),maxLength:io().optional(),format:ix(["email","uri","date","date-time"]).optional(),default:aU().optional()}),eZ=ib({type:ix(["number","integer"]),title:aU().optional(),description:aU().optional(),minimum:io().optional(),maximum:io().optional(),default:io().optional()}),eW=ib({type:iC("string"),title:aU().optional(),description:aU().optional(),enum:ig(aU()),default:aU().optional()}),eX=ib({type:iC("string"),title:aU().optional(),description:aU().optional(),oneOf:ig(ib({const:aU(),title:aU()})),default:aU().optional()}),eY=ib({type:iC("string"),title:aU().optional(),description:aU().optional(),enum:ig(aU()),enumNames:ig(aU()).optional(),default:aU().optional()}),eQ=i$([eW,eX]),e0=ib({type:iC("array"),title:aU().optional(),description:aU().optional(),minItems:io().optional(),maxItems:io().optional(),items:ib({type:iC("string"),enum:ig(aU())}),default:ig(aU()).optional()}),e2=i$([e0,e1=ib({type:iC("array"),title:aU().optional(),description:aU().optional(),minItems:io().optional(),maxItems:io().optional(),items:ib({anyOf:ig(ib({const:aU(),title:aU()}))}),default:ig(aU()).optional()})]),e9=i$([eY,eQ,e2]),e4=i$([e9,eB,eG,eZ]),e5=u.extend({mode:iC("form").optional(),message:aU(),requestedSchema:ib({type:iC("object"),properties:iO(aU(),e4),required:ig(aU()).optional()}).catchall(ih())}),e6=i$([e5,e3=u.extend({mode:iC("url"),message:aU(),elicitationId:aU(),url:aU().url()})]),e8=d.extend({method:iC("elicitation/create"),params:e6}),e7=p.extend({elicitationId:aU()}),te=h.extend({method:iC("notifications/elicitation/complete"),params:e7}),tt=f.extend({action:ix(["accept","decline","cancel"]),content:iX(t=>null===t?void 0:t,iO(aU(),i$([aU(),io(),il(),ig(aU())])).optional())}),tr=ib({type:iC("ref/resource"),uri:aU()}),to=ib({type:iC("ref/prompt"),name:aU()}),ta=c.extend({ref:i$([to,tr]),argument:ib({name:aU(),value:aU()}),context:ib({arguments:iO(aU(),aU()).optional()}).optional()}),ti=d.extend({method:iC("completion/complete"),params:ta}),ts=f.extend({completion:i_({values:ig(aU()).max(100),total:iM(io().int()),hasMore:iM(il())})}),tn=ib({uri:aU().startsWith("file://"),name:aU().optional(),_meta:iO(aU(),ih()).optional()}),tl=d.extend({method:iC("roots/list"),params:c.optional()}),tc=f.extend({roots:ig(tn)}),tu=h.extend({method:iC("notifications/roots/list_changed"),params:p.optional()}),td=i_({ttl:io().optional(),pollInterval:io().optional()}),tp=ix(["working","input_required","completed","failed","cancelled"]),th=ib({taskId:aU(),status:tp,ttl:i$([io(),iu()]),createdAt:aU(),lastUpdatedAt:aU(),pollInterval:iM(io()),statusMessage:iM(aU())}),tf=f.extend({task:th}),tm=p.merge(th),ty=h.extend({method:iC("notifications/tasks/status"),params:tm}),tg=d.extend({method:iC("tasks/get"),params:c.extend({taskId:aU()})}),tv=f.merge(th),tb=d.extend({method:iC("tasks/result"),params:c.extend({taskId:aU()})}),t_=f.loose(),tS=z.extend({method:iC("tasks/list")}),t$=L.extend({tasks:ig(th)}),tw=d.extend({method:iC("tasks/cancel"),params:c.extend({taskId:aU()})}),{JSONValueSchema:t,JSONObjectSchema:r,ProgressTokenSchema:o,CursorSchema:a,TaskMetadataSchema:s,RelatedTaskMetadataSchema:n,RequestMetaSchema:l,BaseRequestParamsSchema:c,TaskAugmentedRequestParamsSchema:u,RequestSchema:d,NotificationsParamsSchema:p,NotificationSchema:h,ResultSchema:f,RequestIdSchema:m,EmptyResultSchema:y,CancelledNotificationParamsSchema:g,CancelledNotificationSchema:v,IconSchema:b,IconsSchema:_,BaseMetadataSchema:S,ImplementationSchema:$,ClientTasksCapabilitySchema:R,ServerTasksCapabilitySchema:P,ClientCapabilitiesSchema:k,InitializeRequestParamsSchema:O,InitializeRequestSchema:T,ServerCapabilitiesSchema:x,InitializeResultSchema:j,InitializedNotificationSchema:C,PingRequestSchema:N,ProgressSchema:I,ProgressNotificationParamsSchema:A,ProgressNotificationSchema:M,PaginatedRequestParamsSchema:q,PaginatedRequestSchema:z,PaginatedResultSchema:L,ResourceContentsSchema:D,TextResourceContentsSchema:U,BlobResourceContentsSchema:F,RoleSchema:H,AnnotationsSchema:K,ResourceSchema:J,ResourceTemplateSchema:B,ListResourcesRequestSchema:G,ListResourcesResultSchema:Z,ListResourceTemplatesRequestSchema:W,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:es,PromptSchema:en,ListPromptsRequestSchema:el,ListPromptsResultSchema:ec,GetPromptRequestParamsSchema:eu,GetPromptRequestSchema:ed,TextContentSchema:ep,ImageContentSchema:eh,AudioContentSchema:ef,ToolUseContentSchema:em,EmbeddedResourceSchema:ey,ResourceLinkSchema:eg,ContentBlockSchema:ev,PromptMessageSchema:eb,GetPromptResultSchema:e_,PromptListChangedNotificationSchema:eS,ToolAnnotationsSchema:e$,ToolExecutionSchema:ew,ToolSchema:eE,ListToolsRequestSchema:eR,ListToolsResultSchema:eP,CallToolResultSchema:ek,CallToolRequestParamsSchema:eO,CallToolRequestSchema:eT,ToolListChangedNotificationSchema:ex,LoggingLevelSchema:ej,SetLevelRequestParamsSchema:eC,SetLevelRequestSchema:eN,LoggingMessageNotificationParamsSchema:eI,LoggingMessageNotificationSchema:eA,ModelHintSchema:eM,ModelPreferencesSchema:eq,ToolChoiceSchema:ez,ToolResultContentSchema:eL,SamplingContentSchema:eD,SamplingMessageContentBlockSchema:eU,SamplingMessageSchema:eV,CreateMessageRequestParamsSchema:eF,CreateMessageRequestSchema:eH,CreateMessageResultSchema:eK,CreateMessageResultWithToolsSchema:eJ,BooleanSchemaSchema:eB,StringSchemaSchema:eG,NumberSchemaSchema:eZ,UntitledSingleSelectEnumSchemaSchema:eW,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:ts,RootSchema:tn,ListRootsRequestSchema:tl,ListRootsResultSchema:tc,RootsListChangedNotificationSchema:tu,TaskCreationParamsSchema:td,TaskStatusSchema:tp,TaskSchema:th,CreateTaskResultSchema:tf,TaskStatusNotificationParamsSchema:tm,TaskStatusNotificationSchema:ty,GetTaskRequestSchema:tg,GetTaskResultSchema:tv,GetTaskPayloadRequestSchema:tb,GetTaskPayloadResultSchema:t_,ListTasksRequestSchema:tS,ListTasksResultSchema:t$,CancelTaskRequestSchema:tw,CancelTaskResultSchema:f.merge(th),ClientRequestSchema:i$([N,T,ti,eN,ed,el,G,W,Q,er,eo,eT,eR,tg,tb,tS,tw]),ClientNotificationSchema:i$([v,M,C,tu,ty]),ClientResultSchema:i$([y,eK,eJ,tt,tc,tv,t$,tf]),ServerRequestSchema:i$([N,eH,e8,tl,tg,tb,tS,tw]),ServerNotificationSchema:i$([v,M,eA,ei,et,ex,eS,ty,te]),ServerResultSchema:i$([y,j,ts,e_,ec,Z,X,ee,ek,eP,tv,t$,tf]),CallToolResultWireSchema:ih().superRefine((t,r)=>{if(!("object"!=typeof t||null===t||Array.isArray(t))&&void 0===t.content){for(let o of dk)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(dO).pipe(ek)})}function dx(t){return"object"!==t.type}let dj=new Set(["const","enum","default","examples"]),dC=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function dN(t){return void 0!==t&&!("string"==typeof t&&t.startsWith("#"))}let dI={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},dA={"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},dM={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 dq(){if(l)return l;let t=dT();return l={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 dz(t){return Object.prototype.hasOwnProperty.call(dI,t)}function dL(t){return Object.prototype.hasOwnProperty.call(dA,t)}function dD(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function dU(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(dI),Object.keys(dA);let dV={ok:!1,reason:"not-in-era"};function dF(t){return dD(t)&&dD(t.outputSchema)&&dx(t.outputSchema)}let dH={era:"2025-11-25",hasRequestMethod:dz,hasNotificationMethod:dL,validateRequest:(t,r)=>dU(dz(t)?dq().requestSchemas[t]:void 0,r),validateResult:(t,r)=>dU(Object.prototype.hasOwnProperty.call(dM,t)?dq().resultSchemas[t]:void 0,r),validateNotification:(t,r)=>dU(dL(t)?dq().notificationSchemas[t]:void 0,r),hasInputRequestMethod:()=>!1,validateInputRequest:()=>dV,validateInputResponse:()=>dV,samplingResultVariant:(t,r)=>{let o=dT();return dU(t?o.CreateMessageResultWithToolsSchema:o.CreateMessageResultSchema,r)},outboundEnvelope:t=>void 0,validateEnvelopeMeta:t=>[],projectCallToolResult(t,r){let o=dP(t),a=o.structuredContent;if(void 0===a)return o;let i="object"!=typeof a||null===a||Array.isArray(a),s=void 0!==r&&dx(r);return i||s?{...o,structuredContent:{result:a}}:o},decodeResult(t,r){if(dD(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=>dF(t))?{...r,tools:o.map(t=>dF(t)?{...t,outputSchema:function(t){var r;let o="string"==typeof t.$schema?t.$schema:void 0;if(dN(t.$id))return{...void 0!==o&&{$schema:o},type:"object",properties:{result:t},required:["result"]};let a="string"==typeof(r=t.$schema)&&dd.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&&dN(t.$id))return t;let o={},s=!1;for(let[n,l]of Object.entries(t))r?o[n]=i(l,!1):("$ref"===n||"$dynamicRef"===n)&&"string"==typeof l?o[n]="#"===l?"#/properties/result":l.startsWith("#/")?`#/properties/result${l.slice(1)}`:l:"$recursiveRef"===n&&"#"===l&&a?s=!0:dj.has(n)?o[n]=l:dC.has(n)?o[n]=i(l,!0):o[n]=i(l,!1);return s&&("$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 dK(){return c??=function(){let t=iZ(()=>i$([aU(),io(),il(),iu(),iO(aU(),t),ig(t)])),r=iO(aU(),t),o=i$([aU(),io().int()]),a=aU(),i=i$([aU(),io().int()]),s=ix(["user","assistant"]),n=ix(["debug","info","notice","warning","error","critical","alert","emergency"]),l=aU().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),c=ib({ttl:io().optional()}),u=ib({taskId:aU()}),d=i_({progressToken:o.optional(),"io.modelcontextprotocol/related-task":u.optional()}),p=ib({_meta:d.optional()}),h=p.extend({task:c.optional()}),f=ib({_meta:d.optional()}),m=ib({method:aU(),params:f.loose().optional()}),y=ib({src:aU(),mimeType:aU().optional(),sizes:ig(aU()).optional(),theme:ix(["light","dark"]).optional()}),g=ib({icons:ig(y).optional()}),v=ib({name:aU(),title:aU().optional()}),b=v.extend({...v.shape,...g.shape,version:aU(),websiteUrl:aU().optional(),description:aU().optional()}),_=iP(ib({applyDefaults:il().optional()}),r),S=iX(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,iP(ib({form:_.optional(),url:r.optional()}),r.optional())),$=i_({list:r.optional(),cancel:r.optional(),requests:i_({sampling:i_({createMessage:r.optional()}).optional(),elicitation:i_({create:r.optional()}).optional()}).optional()}),w=i_({list:r.optional(),cancel:r.optional(),requests:i_({tools:i_({call:r.optional()}).optional()}).optional()}),E=ib({experimental:iO(aU(),r).optional(),sampling:ib({context:r.optional(),tools:r.optional()}).optional(),elicitation:S.optional(),roots:ib({listChanged:il().optional()}).optional(),tasks:$.optional(),extensions:iO(aU(),r).optional()}),R=ib({experimental:iO(aU(),r).optional(),logging:r.optional(),completions:r.optional(),prompts:ib({listChanged:il().optional()}).optional(),resources:ib({subscribe:il().optional(),listChanged:il().optional()}).optional(),tools:ib({listChanged:il().optional()}).optional(),tasks:w.optional(),extensions:iO(aU(),r).optional()}),P=ib({progress:io(),total:iM(io()),message:iM(aU())}),k=ib({...f.shape,...P.shape,progressToken:o}),O=m.extend({method:iC("notifications/progress"),params:k}),T=f.extend({level:n,logger:aU().optional(),data:ih()}),x=m.extend({method:iC("notifications/message"),params:T}),j=ib({uri:aU(),mimeType:iM(aU()),_meta:iO(aU(),ih()).optional()}),C=j.extend({text:aU()}),N=j.extend({blob:l}),I=ib({audience:ig(s).optional(),priority:io().min(0).max(1).optional(),lastModified:oo(aF,{offset:!0}).optional()}),A=ib({...v.shape,...g.shape,uri:aU(),description:iM(aU()),mimeType:iM(aU()),size:iM(io()),annotations:I.optional(),_meta:iM(i_({}))}),M=ib({...v.shape,...g.shape,uriTemplate:aU(),description:iM(aU()),mimeType:iM(aU()),annotations:I.optional(),_meta:iM(i_({}))}),q=m.extend({method:iC("notifications/resources/list_changed"),params:f.optional()}),z=f.extend({uri:aU()}),L=m.extend({method:iC("notifications/resources/updated"),params:z}),D=ib({name:aU(),description:iM(aU()),required:iM(il())}),U=ib({...v.shape,...g.shape,description:iM(aU()),arguments:iM(ig(D)),_meta:iM(i_({}))}),V=m.extend({method:iC("notifications/prompts/list_changed"),params:f.optional()}),F=ib({type:iC("text"),text:aU(),annotations:I.optional(),_meta:iO(aU(),ih()).optional()}),H=ib({type:iC("image"),data:l,mimeType:aU(),annotations:I.optional(),_meta:iO(aU(),ih()).optional()}),K=ib({type:iC("audio"),data:l,mimeType:aU(),annotations:I.optional(),_meta:iO(aU(),ih()).optional()}),J=ib({type:iC("tool_use"),name:aU(),id:aU(),input:iO(aU(),ih()),_meta:iO(aU(),ih()).optional()}),B=ib({type:iC("resource"),resource:i$([C,N]),annotations:I.optional(),_meta:iO(aU(),ih()).optional()}),G=A.extend({type:iC("resource_link")}),Z=i$([F,H,K,G,B]),W=ib({role:s,content:Z}),X=ib({title:aU().optional(),readOnlyHint:il().optional(),destructiveHint:il().optional(),idempotentHint:il().optional(),openWorldHint:il().optional()}),Y=m.extend({method:iC("notifications/tools/list_changed"),params:f.optional()}),Q=ib({name:aU().optional()}),ee=ib({hints:ig(Q).optional(),costPriority:io().min(0).max(1).optional(),speedPriority:io().min(0).max(1).optional(),intelligencePriority:io().min(0).max(1).optional()}),et=ib({mode:ix(["auto","required","none"]).optional()}),er=ib({type:iC("boolean"),title:aU().optional(),description:aU().optional(),default:il().optional()}),eo=ib({type:iC("string"),title:aU().optional(),description:aU().optional(),minLength:io().optional(),maxLength:io().optional(),format:ix(["email","uri","date","date-time"]).optional(),default:aU().optional()}),ea=ib({type:ix(["number","integer"]),title:aU().optional(),description:aU().optional(),minimum:io().optional(),maximum:io().optional(),default:io().optional()}),ei=ib({type:iC("string"),title:aU().optional(),description:aU().optional(),enum:ig(aU()),default:aU().optional()}),es=ib({type:iC("string"),title:aU().optional(),description:aU().optional(),oneOf:ig(ib({const:aU(),title:aU()})),default:aU().optional()}),en=ib({type:iC("string"),title:aU().optional(),description:aU().optional(),enum:ig(aU()),enumNames:ig(aU()).optional(),default:aU().optional()}),el=i$([ei,es]),ec=ib({type:iC("array"),title:aU().optional(),description:aU().optional(),minItems:io().optional(),maxItems:io().optional(),items:ib({type:iC("string"),enum:ig(aU())}),default:ig(aU()).optional()}),eu=ib({type:iC("array"),title:aU().optional(),description:aU().optional(),minItems:io().optional(),maxItems:io().optional(),items:ib({anyOf:ig(ib({const:aU(),title:aU()}))}),default:ig(aU()).optional()}),ed=i$([ec,eu]),ep=i$([en,el,ed]),eh=i$([ep,er,eo,ea]),ef=h.extend({mode:iC("form").optional(),message:aU(),requestedSchema:ib({type:iC("object"),properties:iO(aU(),eh),required:ig(aU()).optional()}).catchall(ih())}),em=ib({type:iC("ref/resource"),uri:aU()}),ey=ib({type:iC("ref/prompt"),name:aU()}),eg=ib({uri:aU().startsWith("file://"),name:aU().optional(),_meta:iO(aU(),ih()).optional()}),ev=E.shape,eb=ib({experimental:ev.experimental,sampling:ev.sampling,elicitation:ev.elicitation,roots:ev.roots,extensions:ev.extensions}),e_=R.shape,eS=ib({experimental:e_.experimental,logging:e_.logging,completions:e_.completions,prompts:e_.prompts,resources:e_.resources,tools:e_.tools,extensions:e_.extensions}),e$=i_({progressToken:o.optional(),[i0]:aU(),[i1]:b.optional(),[i9]:eb,[i5]:n.optional()}),ew=ib({...v.shape,...g.shape,description:aU().optional(),inputSchema:i_({$schema:aU().optional(),type:iC("object")}),outputSchema:i_({$schema:aU().optional()}).optional(),annotations:X.optional(),_meta:iO(aU(),ih()).optional()}),eE=ib({type:iC("tool_result"),toolUseId:aU(),content:ig(Z),structuredContent:ih().optional(),isError:il().optional(),_meta:iO(aU(),ih()).optional()}),eR=i$([F,H,K,J,eE]),eP=ib({role:s,content:i$([eR,ig(eR)]),_meta:iO(aU(),ih()).optional()}),ek=aU(),eO=i_({[i2]:b.optional().catch(void 0)}),eT=eO.optional();function ex(t){return i_({_meta:eT,resultType:ek.default("complete"),...t})}let ej=ex({}),eC=ex({nextCursor:a.optional()}),eN=ex({content:ig(Z),structuredContent:ih().optional(),isError:il().optional()}),eI=ex({ttlMs:io().int().min(0),cacheScope:ix(["public","private"]),tools:ig(ew),nextCursor:a.optional()}),eA=ex({ttlMs:io().int().min(0),cacheScope:ix(["public","private"]),prompts:ig(U),nextCursor:a.optional()}),eM=ex({description:aU().optional(),messages:ig(W)}),eq=ex({ttlMs:io().int().min(0),cacheScope:ix(["public","private"]),resources:ig(A),nextCursor:a.optional()}),ez=ex({ttlMs:io().int().min(0),cacheScope:ix(["public","private"]),resourceTemplates:ig(M),nextCursor:a.optional()}),eL=ex({ttlMs:io().int().min(0),cacheScope:ix(["public","private"]),contents:ig(i$([C,N]))}),eD=ex({completion:ib({values:ig(aU()).max(100),total:io().int().optional(),hasMore:il().optional()}).loose()}),eU=ex({ttlMs:io().int().min(0),cacheScope:ix(["public","private"])}),eV=ex({ttlMs:io().int().min(0).catch(0),cacheScope:ix(["public","private"]).catch("private"),supportedVersions:ig(aU()),capabilities:eS,instructions:aU().optional()}),eF=ib({messages:ig(eP),modelPreferences:ee.optional(),systemPrompt:aU().optional(),includeContext:ix(["none","thisServer","allServers"]).optional(),temperature:io().optional(),maxTokens:io().int(),stopSequences:ig(aU()).optional(),metadata:r.optional(),tools:ig(ew).optional(),toolChoice:et.optional()}),eH=ib({method:iC("sampling/createMessage"),params:eF}),eK=ib({method:iC("roots/list"),params:ib({_meta:iO(aU(),ih()).optional()}).optional()}),eJ=ib({...eP.shape,model:aU(),stopReason:aU().optional()}),eB=ib({roots:ig(eg)}),eG=ib({action:ix(["accept","decline","cancel"]),content:iO(aU(),i$([aU(),io(),il(),ig(aU())])).optional()}),eZ=ib({mode:iC("url"),message:aU(),url:aU().url()}),eW=i$([ef,eZ]),eX=ib({method:iC("elicitation/create"),params:eW}),eY=i$([eH,eK,eX]),eQ=i$([eJ,eB,eG]),e0=iO(aU(),eY),e1=iO(aU(),eQ),e2=ex({inputRequests:e0.optional(),requestState:aU().optional()}),e9={inputResponses:e1.optional(),requestState:aU().optional()},e4=ib({_meta:e$,...e9}),e5=i_({progressToken:o.optional()});function e3(t,r){return ib({method:iC(t),params:ib({_meta:e$,...r})})}function e6(t,r){return ib({method:iC(t),params:ib({_meta:e5.optional(),...r}).optional()})}let e8={name:aU(),arguments:iO(aU(),ih()).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:aU(),arguments:iO(aU(),aU()).optional(),...e9}),ta=e3("resources/list",e7),ti=e3("resources/templates/list",e7),ts=e3("resources/read",{uri:aU(),...e9}),tn={ref:i$([ey,em]),argument:ib({name:aU(),value:aU()}),context:ib({arguments:iO(aU(),aU()).optional()}).optional()},tl=e3("completion/complete",tn),tc=e3("server/discover",{}),tu=ib({toolsListChanged:il().optional(),promptsListChanged:il().optional(),resourcesListChanged:il().optional(),resourceSubscriptions:ig(aU()).optional()}),td={notifications:tu},tp=e3("subscriptions/listen",td),th=eO.extend({"io.modelcontextprotocol/subscriptionId":i}),tf=i_({_meta:th,resultType:ek.default("complete")}),tm={"tools/call":e6("tools/call",e8),"tools/list":e6("tools/list",e7),"prompts/get":e6("prompts/get",{name:aU(),arguments:iO(aU(),aU()).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:aU()}),"completion/complete":e6("completion/complete",tn),"server/discover":e6("server/discover",{}),"subscriptions/listen":e6("subscriptions/listen",td)};function ty(t){return i_({_meta:eT,...t})}let tg={"tools/call":ty({content:ig(Z),structuredContent:ih().optional(),isError:il().optional()}),"tools/list":ty({ttlMs:io().int().min(0),cacheScope:ix(["public","private"]),tools:ig(ew),nextCursor:a.optional()}),"prompts/get":ty({description:aU().optional(),messages:ig(W)}),"prompts/list":ty({ttlMs:io().int().min(0),cacheScope:ix(["public","private"]),prompts:ig(U),nextCursor:a.optional()}),"resources/list":ty({ttlMs:io().int().min(0),cacheScope:ix(["public","private"]),resources:ig(A),nextCursor:a.optional()}),"resources/templates/list":ty({ttlMs:io().int().min(0),cacheScope:ix(["public","private"]),resourceTemplates:ig(M),nextCursor:a.optional()}),"resources/read":ty({ttlMs:io().int().min(0),cacheScope:ix(["public","private"]),contents:ig(i$([C,N]))}),"completion/complete":ty({completion:ib({values:ig(aU()).max(100),total:io().int().optional(),hasMore:il().optional()}).loose()}),"server/discover":ty({ttlMs:io().int().min(0).catch(0),cacheScope:ix(["public","private"]).catch("private"),supportedVersions:ig(aU()),capabilities:eS,instructions:aU().optional()}),"subscriptions/listen":ty({})},tv=i_({"io.modelcontextprotocol/subscriptionId":i.optional()}),tb=ib({method:iC("notifications/subscriptions/acknowledged"),params:ib({_meta:tv.optional(),notifications:tu})}),t_=ib({_meta:tv.optional(),requestId:i,reason:aU().optional()}),tS=ib({method:iC("notifications/cancelled"),params:t_}),t$=t=>ib({jsonrpc:iC("2.0"),id:i$([aU(),io().int()]),result:t}).strict();return{JSONValueSchema:t,JSONObjectSchema:r,ProgressTokenSchema:o,CursorSchema:a,RequestIdSchema:i,RoleSchema:s,LoggingLevelSchema:n,TaskMetadataSchema:c,RelatedTaskMetadataSchema:u,RequestMetaSchema:d,BaseRequestParamsSchema:p,TaskAugmentedRequestParamsSchema:h,NotificationsParamsSchema:f,NotificationSchema:m,IconSchema:y,IconsSchema:g,BaseMetadataSchema:v,ImplementationSchema:b,ClientTasksCapabilitySchema:$,ServerTasksCapabilitySchema:w,ClientCapabilitiesSchema:E,ServerCapabilitiesSchema:R,ProgressSchema:P,ProgressNotificationParamsSchema:k,ProgressNotificationSchema:O,LoggingMessageNotificationParamsSchema:T,LoggingMessageNotificationSchema:x,ResourceContentsSchema:j,TextResourceContentsSchema:C,BlobResourceContentsSchema:N,AnnotationsSchema:I,ResourceSchema:A,ResourceTemplateSchema:M,ResourceListChangedNotificationSchema:q,ResourceUpdatedNotificationParamsSchema:z,ResourceUpdatedNotificationSchema:L,PromptArgumentSchema:D,PromptSchema:U,PromptListChangedNotificationSchema:V,TextContentSchema:F,ImageContentSchema:H,AudioContentSchema:K,ToolUseContentSchema:J,EmbeddedResourceSchema:B,ResourceLinkSchema:G,ContentBlockSchema:Z,PromptMessageSchema:W,ToolAnnotationsSchema:X,ToolListChangedNotificationSchema:Y,ModelHintSchema:Q,ModelPreferencesSchema:ee,ToolChoiceSchema:et,BooleanSchemaSchema:er,StringSchemaSchema:eo,NumberSchemaSchema:ea,UntitledSingleSelectEnumSchemaSchema:ei,TitledSingleSelectEnumSchemaSchema:es,LegacyTitledEnumSchemaSchema:en,SingleSelectEnumSchemaSchema:el,UntitledMultiSelectEnumSchemaSchema:ec,TitledMultiSelectEnumSchemaSchema:eu,MultiSelectEnumSchemaSchema:ed,EnumSchemaSchema:ep,PrimitiveSchemaDefinitionSchema:eh,ElicitRequestFormParamsSchema:ef,ResourceTemplateReferenceSchema:em,PromptReferenceSchema:ey,RootSchema:eg,ClientCapabilities2026Schema:eb,ServerCapabilities2026Schema:eS,RequestMetaEnvelopeSchema:e$,ToolSchema:ew,ToolResultContentSchema:eE,SamplingMessageContentBlockSchema:eR,SamplingMessageSchema:eP,ResultTypeSchema:ek,ResultMetaSchema:eO,ResultSchema:ej,PaginatedResultSchema:eC,CallToolResultSchema:eN,ListToolsResultSchema:eI,ListPromptsResultSchema:eA,GetPromptResultSchema:eM,ListResourcesResultSchema:eq,ListResourceTemplatesResultSchema:ez,ReadResourceResultSchema:eL,CompleteResultSchema:eD,CacheableResultSchema:eU,DiscoverResultSchema:eV,CreateMessageRequestParamsSchema:eF,CreateMessageRequestSchema:eH,ListRootsRequestSchema:eK,CreateMessageResultSchema:eJ,ListRootsResultSchema:eB,ElicitResultSchema:eG,ElicitRequestURLParamsSchema:eZ,ElicitRequestParamsSchema:eW,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:ts,CompleteRequestSchema:tl,DiscoverRequestSchema:tc,SubscriptionFilterSchema:tu,SubscriptionsListenRequestSchema:tp,SubscriptionsListenResultMetaSchema:th,SubscriptionsListenResultSchema:tf,dispatchRequestSchemas:tm,dispatchResultSchemas:tg,NotificationMetaSchema:tv,SubscriptionsAcknowledgedNotificationSchema:tb,CancelledNotificationParamsSchema:t_,CancelledNotificationSchema:tS,notificationSchemas2026:{"notifications/cancelled":tS,"notifications/progress":O,"notifications/message":x,"notifications/resources/updated":L,"notifications/resources/list_changed":q,"notifications/tools/list_changed":Y,"notifications/prompts/list_changed":V,"notifications/subscriptions/acknowledged":tb},JSONRPCResultResponseSchema:t$(ej),CallToolResultResponseSchema:t$(i$([eN,e2])),ListToolsResultResponseSchema:t$(eI),ListPromptsResultResponseSchema:t$(eA),GetPromptResultResponseSchema:t$(i$([eM,e2])),ListResourcesResultResponseSchema:t$(eq),ListResourceTemplatesResultResponseSchema:t$(ez),ReadResourceResultResponseSchema:t$(i$([eL,e2])),CompleteResultResponseSchema:t$(eD),DiscoverResultResponseSchema:t$(eV)}}()}let dJ=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"],dB=Symbol("modelcontextprotocol.resultCacheHintFallback");function dG(t){return"number"==typeof t&&Number.isSafeInteger(t)&&t>=0}function dZ(t){return"public"===t||"private"===t}let dW=((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 dX=class t extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return dy(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 dy(this,t)}constructor(t,r,o){super(r),this.code=t,this.data=o,this.name="ProtocolError",dm(this,new.target)}static fromError(r,o,a){return r===dW.UrlElicitationRequired&&a&&a.elicitations?new dQ(a.elicitations,o):r===dW.UnsupportedProtocolVersion&&a&&Array.isArray(a.supported)&&"string"==typeof a.requested?new d0({supported:a.supported,requested:a.requested},o):(r===dW.InvalidParams||r===dW.ResourceNotFound)&&"string"==typeof a?.uri&&(r===dW.ResourceNotFound||1===Object.keys(a).length)?new dY(a.uri,o):r===dW.MissingRequiredClientCapability&&a&&null!==a.requiredCapabilities&&"object"==typeof a.requiredCapabilities&&!Array.isArray(a.requiredCapabilities)?new d1({requiredCapabilities:a.requiredCapabilities},o):new t(r,o,a)}},dY=class extends dX{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(t,r=`Resource not found: ${t}`){super(dW.InvalidParams,r,{uri:t})}get uri(){return this.data.uri}},dQ=class extends dX{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(dW.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}},d0=class extends dX{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(t,r=`Unsupported protocol version: ${t.requested}`){super(dW.UnsupportedProtocolVersion,r,t)}get supported(){return this.data.supported}get requested(){return this.data.requested}},d1=class extends dX{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(t,r=`Missing required client capabilities: ${Object.keys(t.requiredCapabilities).join(", ")}`){super(dW.MissingRequiredClientCapability,r,t)}get requiredCapabilities(){return this.data.requiredCapabilities}};let d2=["tools/call","prompts/get","resources/read"],d9=["elicitation/create","sampling/createMessage","roots/list"];function d4(){if(u)return u;let t=dK();return u={request:{"elicitation/create":ib({method:iC("elicitation/create"),params:t.ElicitRequestParamsSchema}),"sampling/createMessage":ib({method:iC("sampling/createMessage"),params:t.CreateMessageRequestParamsSchema}),"roots/list":ib({method:iC("roots/list"),params:i_({}).optional()})},response:{"elicitation/create":t.ElicitResultSchema,"sampling/createMessage":t.CreateMessageResultSchema,"roots/list":t.ListRootsResultSchema}}}function d5(t){return d9.includes(t)}function d3(t){return d5(t)?d4().request[t]:void 0}let d6={"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},d8={"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 d7(t){return Object.prototype.hasOwnProperty.call(d6,t)}function pe(t){return Object.prototype.hasOwnProperty.call(d8,t)}function pt(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function pr(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(d6),Object.keys(d8);let po={ok:!1,reason:"not-in-era"},pa=[i0,i9],pi={era:"2026-07-28",hasRequestMethod:d7,hasNotificationMethod:pe,hasInputRequestMethod:t=>void 0!==d3(t),validateRequest:(t,r)=>pr(d7(t)?dK().dispatchRequestSchemas[t]:void 0,r),validateResult:(t,r)=>pr(Object.prototype.hasOwnProperty.call(d6,t)?dK().dispatchResultSchemas[t]:void 0,r),validateNotification:(t,r)=>pr(pe(t)?dK().notificationSchemas2026[t]:void 0,r),validateInputRequest:(t,r)=>pr(d3(t),r),validateInputResponse:(t,r)=>pr(d5(t)?d4().response[t]:void 0,r),samplingResultVariant:()=>po,outboundEnvelope:t=>({[i0]:t.protocolVersion,[i1]:t.clientInfo,[i9]:t.clientCapabilities,...void 0!==t.logLevel&&{[i5]:t.logLevel}}),validateEnvelopeMeta(t){let r=[];for(let o of pa)o in t||r.push({key:o,problem:"missing"});let o=dK().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=>dP(t),inputRequestSchema:d3,decodeResult(t,r){if(!pt(r))return{kind:"invalid",error:new d_(db.InvalidResult,`Invalid result for ${t}: not an object`,{method:t})};let o=r.resultType;if(void 0===o)return{kind:"invalid",error:new d_(db.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 d_(db.InvalidResult,`Invalid result for ${t}: non-string resultType`,{method:t,resultType:o})};if("input_required"===o){let o=r.inputRequests,a=pt(o)?o:{},i=r.requestState;return 0===Object.keys(a).length&&"string"!=typeof i?{kind:"invalid",error:new d_(db.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}}}if("complete"!==o)return{kind:"invalid",error:new d_(db.UnsupportedResultType,`Unsupported result type '${o}' for ${t}`,{resultType:o,method:t})};let a=function(){if(d)return d;let t=dK();return d={"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 d_(db.InvalidResult,`Invalid result for ${t}: ${o.error}`,{method:t})}}let s={...r};return delete s.resultType,{kind:"complete",result:s}},encodeResult:(t,r,o)=>(function(t,r){if(void 0===r)return t;let o=t._meta;return void 0===o?{...t,_meta:{[i2]:r}}:null===o||"object"!=typeof o||Array.isArray(o)||void 0!==o[i2]?t:{...t,_meta:{...o,[i2]:r}}})(function(t,r){var o,a;let i=r[dB];if("complete"!==r.resultType||!dJ.includes(t)){let t;return void 0===i?r:(t={...r},delete t[dB],t)}let s=dG(r.ttlMs)?r.ttlMs:void 0!==(o=i)&&dG(o.ttlMs)?o.ttlMs:0,n=dZ(r.cacheScope)?r.cacheScope:void 0!==(a=i)&&dZ(a.cacheScope)?a.cacheScope:"private",l={...r,ttlMs:s,cacheScope:n};return delete l[dB],l}(t,function(t,r){let o=r.resultType;if(void 0===o)return{...r,resultType:"complete"};if("complete"===o||d2.includes(t))return r;throw new dX(dW.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),s=r.tools;"tools/list"===t&&Array.isArray(s)&&s.some(t=>pt(t)&&"execution"in t)&&(i().tools=s.map(t=>{if(!pt(t)||!("execution"in t))return t;let r={...t};return delete r.execution,r}));let n=r.capabilities;if(pt(n)&&"tasks"in n){let t={...n};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=dK().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("; ")}`}},ps="2026-07-28";function pn(t){return void 0!==t&&t>=d$?pi:dH}function pl(t){return void 0!==t.revision?pn(t.revision).era:"modern"===t.era?pi.era:dH.era}function pc(t){return pd.some(r=>r.hasRequestMethod(t))}function pu(t){return pd.some(r=>r.hasNotificationMethod(t))}let pd=[dH,pi];var pp=((t,r)=>{let o={};for(var a in t)dr(o,a,{get:t[a],enumerable:!0});return r&&dr(o,Symbol.toStringTag,{value:"Module"}),o})({AnnotationsSchema:()=>sZ,AudioContentSchema:()=>nm,BaseMetadataSchema:()=>sw,BaseRequestParamsSchema:()=>sa,BlobResourceContentsSchema:()=>sB,BooleanSchemaSchema:()=>nW,CallToolRequestParamsSchema:()=>nx,CallToolRequestSchema:()=>nj,CallToolResultSchema:()=>nO,CancelTaskRequestSchema:()=>lP,CancelTaskResultSchema:()=>lk,CancelledNotificationParamsSchema:()=>sb,CancelledNotificationSchema:()=>s_,ClientCapabilitiesSchema:()=>sT,ClientNotificationSchema:()=>lT,ClientRequestSchema:()=>lO,ClientResultSchema:()=>lx,ClientTasksCapabilitySchema:()=>sk,CompatibilityCallToolResultSchema:()=>nT,CompleteRequestParamsSchema:()=>ln,CompleteRequestSchema:()=>ll,CompleteResultSchema:()=>lc,ContentBlockSchema:()=>nb,CreateMessageRequestParamsSchema:()=>nJ,CreateMessageRequestSchema:()=>nB,CreateMessageResultSchema:()=>nG,CreateMessageResultWithToolsSchema:()=>nZ,CreateTaskResultSchema:()=>lg,CursorSchema:()=>se,DiscoverRequestSchema:()=>sA,DiscoverResultSchema:()=>sM,ElicitRequestFormParamsSchema:()=>n8,ElicitRequestParamsSchema:()=>le,ElicitRequestSchema:()=>lt,ElicitRequestURLParamsSchema:()=>n7,ElicitResultSchema:()=>la,ElicitationCompleteNotificationParamsSchema:()=>lr,ElicitationCompleteNotificationSchema:()=>lo,EmbeddedResourceSchema:()=>ng,EmptyResultSchema:()=>sv,EnumSchemaSchema:()=>n3,GetPromptRequestParamsSchema:()=>nd,GetPromptRequestSchema:()=>np,GetPromptResultSchema:()=>nS,GetTaskPayloadRequestSchema:()=>l$,GetTaskPayloadResultSchema:()=>lw,GetTaskRequestSchema:()=>l_,GetTaskResultSchema:()=>lS,IconSchema:()=>sS,IconsSchema:()=>s$,ImageContentSchema:()=>nf,ImplementationSchema:()=>sE,InitializeRequestParamsSchema:()=>sx,InitializeRequestSchema:()=>sj,InitializeResultSchema:()=>sN,InitializedNotificationSchema:()=>sI,JSONArraySchema:()=>i8,JSONObjectSchema:()=>i6,JSONRPCErrorResponseSchema:()=>sm,JSONRPCMessageSchema:()=>sy,JSONRPCNotificationSchema:()=>sh,JSONRPCRequestSchema:()=>sp,JSONRPCResponseSchema:()=>sg,JSONRPCResultResponseSchema:()=>sf,JSONValueSchema:()=>i3,LegacyTitledEnumSchemaSchema:()=>n1,ListChangedOptionsBaseSchema:()=>nN,ListPromptsRequestSchema:()=>nc,ListPromptsResultSchema:()=>nu,ListResourceTemplatesRequestSchema:()=>s0,ListResourceTemplatesResultSchema:()=>s1,ListResourcesRequestSchema:()=>sY,ListResourcesResultSchema:()=>sQ,ListRootsRequestSchema:()=>ld,ListRootsResultSchema:()=>lp,ListTasksRequestSchema:()=>lE,ListTasksResultSchema:()=>lR,ListToolsRequestSchema:()=>nP,ListToolsResultSchema:()=>nk,LoggingLevelSchema:()=>nI,LoggingMessageNotificationParamsSchema:()=>nq,LoggingMessageNotificationSchema:()=>nz,ModelHintSchema:()=>nL,ModelPreferencesSchema:()=>nD,MultiSelectEnumSchemaSchema:()=>n5,NotificationSchema:()=>sl,NotificationsParamsSchema:()=>sn,NumberSchemaSchema:()=>nY,PaginatedRequestParamsSchema:()=>sU,PaginatedRequestSchema:()=>sV,PaginatedResultSchema:()=>sF,PingRequestSchema:()=>sq,PrimitiveSchemaDefinitionSchema:()=>n6,ProgressNotificationParamsSchema:()=>sL,ProgressNotificationSchema:()=>sD,ProgressSchema:()=>sz,ProgressTokenSchema:()=>i7,PromptArgumentSchema:()=>nn,PromptListChangedNotificationSchema:()=>n$,PromptMessageSchema:()=>n_,PromptReferenceSchema:()=>ls,PromptSchema:()=>nl,ReadResourceRequestParamsSchema:()=>s2,ReadResourceRequestSchema:()=>s9,ReadResourceResultSchema:()=>s4,RelatedTaskMetadataSchema:()=>sr,RequestIdSchema:()=>sd,RequestMetaSchema:()=>so,RequestSchema:()=>ss,ResourceContentsSchema:()=>sH,ResourceLinkSchema:()=>nv,ResourceListChangedNotificationSchema:()=>s5,ResourceRequestParamsSchema:()=>s2,ResourceSchema:()=>sW,ResourceTemplateReferenceSchema:()=>li,ResourceTemplateSchema:()=>sX,ResourceUpdatedNotificationParamsSchema:()=>ni,ResourceUpdatedNotificationSchema:()=>ns,ResultMetaObjectSchema:()=>sc,ResultSchema:()=>su,RoleSchema:()=>sG,RootSchema:()=>lu,RootsListChangedNotificationSchema:()=>lh,SamplingContentSchema:()=>nF,SamplingMessageContentBlockSchema:()=>nH,SamplingMessageSchema:()=>nK,ServerCapabilitiesSchema:()=>sC,ServerNotificationSchema:()=>lC,ServerRequestSchema:()=>lj,ServerResultSchema:()=>lN,ServerTasksCapabilitySchema:()=>sO,SetLevelRequestParamsSchema:()=>nA,SetLevelRequestSchema:()=>nM,SingleSelectEnumSchemaSchema:()=>n2,StringSchemaSchema:()=>nX,SubscribeRequestParamsSchema:()=>s2,SubscribeRequestSchema:()=>s3,SubscriptionFilterSchema:()=>s8,SubscriptionsAcknowledgedNotificationParamsSchema:()=>nt,SubscriptionsAcknowledgedNotificationSchema:()=>nr,SubscriptionsListenRequestParamsSchema:()=>s7,SubscriptionsListenRequestSchema:()=>ne,SubscriptionsListenResultMetaSchema:()=>no,SubscriptionsListenResultSchema:()=>na,TaskAugmentedRequestParamsSchema:()=>si,TaskCreationParamsSchema:()=>lf,TaskMetadataSchema:()=>st,TaskSchema:()=>ly,TaskStatusNotificationParamsSchema:()=>lv,TaskStatusNotificationSchema:()=>lb,TaskStatusSchema:()=>lm,TextContentSchema:()=>nh,TextResourceContentsSchema:()=>sK,TitledMultiSelectEnumSchemaSchema:()=>n4,TitledSingleSelectEnumSchemaSchema:()=>n0,ToolAnnotationsSchema:()=>nw,ToolChoiceSchema:()=>nU,ToolExecutionSchema:()=>nE,ToolListChangedNotificationSchema:()=>nC,ToolResultContentSchema:()=>nV,ToolSchema:()=>nR,ToolUseContentSchema:()=>ny,UnsubscribeRequestParamsSchema:()=>s2,UnsubscribeRequestSchema:()=>s6,UntitledMultiSelectEnumSchemaSchema:()=>n9,UntitledSingleSelectEnumSchemaSchema:()=>nQ});let ph=t=>sf.safeParse(t).success,pf=t=>sm.safeParse(t).success,pm=t=>"object"==typeof t&&null!==t&&!Array.isArray(t)&&"input_required"===t.resultType,py="x-mcp-header",pg=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,pv=new Set(["string","integer","boolean","number"]);function pb(t){let r=[],o=new Map,a=(t,i,s)=>{if(null===t||"object"!=typeof t)return;if(py in t){if(!s||0===i.length)return`${p$(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[py];if("string"!=typeof a||0===a.length)return`${p$(i)}: x-mcp-header MUST be a non-empty string`;if(!pg.test(a))return`${p$(i)}: x-mcp-header '${a}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let n="string"==typeof t.type?t.type:void 0;if(void 0===n||!pv.has(n))return`${p$(i)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${n??"<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:n})}let n=t.properties;if(null!==n&&"object"==typeof n)for(let[t,r]of Object.entries(n)){let o=a(r,[...i,t],s);if(void 0!==o)return o}for(let r of p_){let o=t[r];if(void 0!==o)for(let t of Array.isArray(o)?o:null!==o&&"object"==typeof o&&pS.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 p_=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],pS=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function p$(t){return 0===t.length?"<root>":t.join(".")}let pw="=?base64?";function pE(t){return!function(t){if(0===t.length||t.startsWith(pw)&&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:`${pw}${function(t){let r=new TextEncoder().encode(t),o="";for(let t of r)o+=String.fromCodePoint(t);return btoa(o)}(t)}?=`}function pR(t){return new Set(t.flatMap(t=>Object.keys(t.shape)))}function pP(t){if(null==t)return!1;let r=typeof t;return("object"===r||"function"===r)&&"~standard"in t&&"function"==typeof t["~standard"]?.validate}dW.InvalidRequest,dW.UnsupportedProtocolVersion,dW.InvalidParams,dW.MethodNotFound,dW.InvalidParams,dW.MissingRequiredClientCapability,dW.ParseError,dW.InvalidRequest,dW.MethodNotFound,dW.UnsupportedProtocolVersion,dW.MissingRequiredClientCapability;let pk=!1,pO="draft-2020-12";async function pT(t,r){let o=await t["~standard"].validate(r);return o.issues&&o.issues.length>0?{success:!1,error:o.issues.map(t=>t.path?.length?`${t.path.map(t=>String("object"==typeof t?t.key:t)).join(".")}: ${t.message}`:t.message).join(", ")}:{success:!0,data:o.value}}let px=/\\\.\\d\{(\d+)\}/;function pj(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}let pC=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function pN(t){return pC.has(t)||t.startsWith("x-")}let pI=new Set(["$schema",...Object.keys(n8.shape.requestedSchema.shape)]),pA={string:pR([nX,nQ,n0,n1]),number:pR([nY]),integer:pR([nY]),boolean:pR([nW]),array:pR([n9,n4])},pM=new Set(nX.shape.format.unwrap().options);async function pq(t){let{config:r,method:o,originalParams:a,requestOptions:i,hooks:s,signal:n}=t,l=t.flowStartedAt??Date.now(),c=t.firstPayload,u=0;for(;;){let t;if((u+=1)>r.maxRounds){var d;throw new d_(db.InputRequiredRoundsExceeded,(d=r.maxRounds,`Multi-round-trip request '${o}' still required input after ${d} 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 p=Object.entries(c.inputRequests??{});if(p.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)}}(n);try{let o=await Promise.all(p.map(async([t,o])=>{try{return[t,await s.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 d_?r.reason:new d_(db.RequestTimeout,String(r.reason)));let a=setTimeout(()=>{r?.removeEventListener("abort",i),t()},250),i=()=>{clearTimeout(a),o(r?.reason instanceof d_?r.reason:new d_(db.RequestTimeout,String(r?.reason)))};r?.addEventListener("abort",i,{once:!0})})}(0,n);let h={...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 d_(db.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:i.maxTotalTimeout,totalElapsed:t});h.maxTotalTimeout=r}let f=await s.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),h);if(pm(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(!pP(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,s]of Object.entries(t))"properties"===i&&pj(s)?o[i]=Object.fromEntries(Object.entries(s).map(([t,o])=>[t,function(t,r,o,a){if(!pj(t))return t;let i="string"==typeof t.type&&Object.hasOwn(pA,t.type)?pA[t.type]:void 0;if(void 0===i)return t;let s={};for(let[l,c]of Object.entries(t))if(i.has(l)||pN(l))s[l]=c;else if("pattern"===l&&"string"===t.type&&"string"==typeof t.format)if(pM.has(t.format)){var n;"string"==typeof c&&(n=t.format,"zod"!==o||(function(t,r){let o;switch(t){case"email":o=[ot(aB,void 0)];break;case"uri":o=[or(aW,void 0)];break;case"date":o=[oa(aH,void 0)];break;case"date-time":let a,i;a=px.exec(r),i=[void 0,-1,0],a&&i.push(Number(a[1])),o=[!1,!0].flatMap(t=>[!1,!0].flatMap(r=>i.map(o=>oo(aF,{local:t,offset:r,precision:o}))))}return new Set(o.map(t=>{let r;return r=an(t,{target:pO,io:"input"}),"string"==typeof r.pattern?r.pattern:void 0}).filter(t=>void 0!==t))})(n,c).has(c))||a.push(`${r}.${l}`)}else s[l]=c;else a.push(`${r}.${l}`);return s}(o,`properties.${t}`,r,a)])):pI.has(i)?o[i]=s:pN(i)||a.push(i);if(a.length>0)throw new dX(dW.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:pO});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().");pk||(pk=!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=an(t,{target:pO,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 dX(dW.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}(t.requestedSchema),o),i=(r=n8.shape.requestedSchema,ak(r,a));if(!i.success)throw new dX(dW.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${function(t,r){if(!pj(t.properties))return r;let o=Object.entries(t.properties).filter(([,t])=>!ak(n6,t).success).map(([t])=>`properties.${t}`);return o.length>0?o.join(", "):r}(a,i.error.message)}`);let s=function t(r,o,a=""){return Array.isArray(r)&&Array.isArray(o)?r.flatMap((r,i)=>t(r,o[i],`${a}[${i}]`)):pj(r)&&pj(o)?Object.entries(r).flatMap(([r,i])=>{let s=a?`${a}.${r}`:r;return Object.prototype.hasOwnProperty.call(o,r)?t(i,o[r],s):pN(r)?[]:[s]}):[]}(a,i.data);if(s.length>0)throw new dX(dW.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${s.join(", ")}`);let n=(i.data.required??[]).filter(t=>!Object.prototype.hasOwnProperty.call(i.data.properties,t));if(n.length>0)throw new dX(dW.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${n.join(", ")}`);return{...t,mode:"form",requestedSchema:i.data}}(t)}}catch(t){throw t instanceof dX?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 pz={},pL={};function pD(t,r){let o=t.slice(0,-6);pz[o]=r,pL[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"])pD(t,pp[t]);for(let[t,r]of Object.entries({IdJagTokenExchangeResponseSchema:lD,OAuthClientInformationFullSchema:lK,OAuthClientInformationSchema:lH,OAuthClientMetadataSchema:lF,OAuthClientRegistrationErrorSchema:lJ,OAuthErrorResponseSchema:lU,OAuthMetadataSchema:lM,OAuthProtectedResourceMetadataSchema:lA,OAuthTokenRevocationRequestSchema:lB,OAuthTokensSchema:lL,OpenIdProviderDiscoveryMetadataSchema:lz,OpenIdProviderMetadataSchema:lq}))pD(t,r);Object.freeze(pz);let pU=Object.freeze(pL),pV=[i0,i1,i9,i5],pF=["inputResponses","requestState"];function pH(t,r){let o=t.params;if(!pG(o))return{message:t,lifted:{}};let a=o._meta,i=pG(a)?pV.filter(t=>t in a):[],s="request"===r?pF.filter(t=>t in o):[];if(0===i.length&&0===s.length)return{message:t,lifted:{}};let n={},l={...o};if(i.length>0&&pG(a)){let t={},r={...a};for(let o of i)t[o]=a[o],delete r[o];n.envelope=t,Object.keys(r).length>0?l._meta=r:delete l._meta}for(let t of s)"inputResponses"===t&&(n.inputResponses=l[t]),"requestState"===t&&(n.requestState=l[t]),delete l[t];return{message:{...t,params:l},lifted:n}}function pK(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 pJ=(O=void 0,()=>O);var pB=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??iQ,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 d_(db.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,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 d_(db.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),ph(t)||pf(t))this._onresponse(t);else if(sp.safeParse(t).success)this._onrequest(t,r);else sh.safeParse(t).success?this._onnotification(t,r):this._onerror(Error(`Unknown message type: ${JSON.stringify(t)}`))},t.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let t=this._responseHandlers;for(let t of(this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._timeoutInfo.values()))clearTimeout(t.timeoutId);this._timeoutInfo.clear();let r=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let o=new d_(db.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}=pH(t,"notification"),a=this._negotiatedWireCodec();if(r?.classification===void 0&&"drop"===this._shouldDropInbound(t))return;if(r?.classification!==void 0){let t=pl(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(pu(o.method)&&!a.hasNotificationMethod(o.method))return;let i=this._notificationHandlers.get(o.method),s=this.fallbackNotificationHandler;(void 0!==i||void 0!==s)&&Promise.resolve().then(()=>void 0===i?s(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}=pH(t,"request"),s=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 n=this._transport,l=(t,r,o)=>{let i={jsonrpc:"2.0",id:a.id,error:{code:t,message:r,...void 0!==o&&{data:o}}};n?.send(i).catch(t=>this._onerror(Error(`Failed to send an error response: ${t}`)))};if(r?.classification!==void 0){let t=pl(r.classification);if(t!==s.era){this._onerror(Error(`Era mismatch on inbound request '${a.method}': classified as ${t} but this instance serves ${s.era}`));let o=r.classification.revision??t;l(dW.UnsupportedProtocolVersion,`Unsupported protocol version: ${o}`,{supported:this._supportedProtocolVersions,requested:o});return}}if(pc(a.method)&&!s.hasRequestMethod(a.method))return void l(dW.MethodNotFound,"Method not found");let c=this._requestHandlers.get(a.method)??this.fallbackRequestHandler;if(void 0===c)return void l(dW.MethodNotFound,"Method not found");let u=s.checkInboundEnvelope(i);if(void 0!==u)return void l(dW.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(!pZ(t))return{accepted:r,droppedKeys:o};for(let[a,i]of Object.entries(t)){if(!pZ(i)||"method"in i||"result"in i){o.push(a);continue}r[a]=i}return{accepted:r,droppedKeys:o}}(i.inputResponses),m={sessionId:n?.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?pJ:(o=i.requestState,()=>o),signal:h.signal,send:(t,r,o)=>{let a=this._resolveOutboundCodec(t.method);if(this._assertOutboundRequestInEra(a,t.method),pP(r))return p(t,r,o);let i=pK(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=s.encodeResult(a.method,t,this._outboundServerInfo())}catch(t){this._onerror(Error(`Failed to encode result for ${a.method}: ${t}`)),l(dW.InternalError,"Internal error");return}let o={result:r,jsonrpc:"2.0",id:a.id};await n?.send(o)},async t=>{if(h.signal.aborted)return;let r=Number.isSafeInteger(t.code)?t.code:dW.InternalError,o={jsonrpc:"2.0",id:a.id,error:{code:s.encodeErrorCode(r),message:t.message??"Internal error",...void 0!==t.data&&{data:t.data}}};await n?.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 s=this._responseHandlers.get(a),n=this._timeoutInfo.get(a);if(n&&s&&n.resetTimeoutOnProgress)try{this._resetTimeout(a)}catch(t){this._responseHandlers.delete(a),this._progressHandlers.delete(a),this._cleanupTimeout(a),s(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(ph(t)?t:dX.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(this._assertOutboundRequestInEra(a,t.method),pP(r))return this._requestWithSchemaViaCodec(a,t,r,o);let i=pK(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 pn(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 pn(void 0);case"server/discover":return pn(ps);default:return}}(t);if(r)return r}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(t,r){if(pc(r)&&!t.hasRequestMethod(r))throw new d_(db.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,s,{relatedRequestId:n,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 d_?t:new d_(db.RequestTimeout,String(t))}let m=t.era===ps&&!0===this._transport.hasPerRequestStream?new AbortController:void 0,y=this._requestMessageId++;s=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),b=!1,_=t=>{b||(this._progressHandlers.delete(y),void 0===m?this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:y,reason:String(t)}}),{relatedRequestId:n,resumptionToken:l,onresumptiontoken:c}).catch(t=>this._onerror(Error(`Failed to send cancellation: ${t}`))):m.abort(),h(t instanceof d_?t:new d_(db.RequestTimeout,String(t))))};this._responseHandlers.set(y,i=>{let s;if(!a?.signal?.aborted){if(b=!0,i instanceof Error)return h(i);try{s=t.decodeResult(r.method,i.result)}catch(t){return h(t instanceof Error?t:Error(String(t)))}if("invalid"===s.kind)return h(s.error);if("input_required"===s.kind){var n;return a?.allowInputRequired===!0?p({resultType:"input_required",inputRequests:(n=s).inputRequests,...void 0!==n.requestState&&{requestState:n.requestState}}):p(this._resolveNonCompleteResult(s,{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)}))}pT(o,s.result).then(t=>{t.success?p(t.data):h(new d_(db.InvalidResult,`Invalid result for ${r.method}: ${t.error}`))},h)}}),i=()=>_(a?.signal?.reason),a?.signal?.addEventListener("abort",i,{once:!0});let S=a?.timeout??6e4;this._setupTimeout(y,S,a?.maxTotalTimeout,()=>_(new d_(db.RequestTimeout,"Request timed out",{timeout:S})),a?.resetTimeoutOnProgress??!1),this._transport.send(v,{relatedRequestId:n,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!==s&&(this._responseHandlers.delete(s),this._cleanupTimeout(s))})}async notification(t,r){return this._notificationViaCodec(this._resolveOutboundCodec(t.method),t,r)}async _notificationViaCodec(t,r,o){if(!this._transport)throw new d_(db.NotConnected,"Not connected");if(pu(r.method)&&!t.hasNotificationMethod(r.method))throw new d_(db.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){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(!pc(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(),s=i.validateRequest(t,o);if(s.ok||"not-in-era"!==s.reason||(s=i.validateInputRequest(t,o)),!s.ok){if("not-in-era"===s.reason)throw new dX(dW.InternalError,`No wire schema for ${t} in the resolved era`);throw Error(s.message)}return Promise.resolve(r(s.value,a))}}else if(o)a=async(a,i)=>{let s=await pT(r.params,{...a.params});if(!s.success)throw new dX(dW.InvalidParams,`Invalid params for ${t}: ${s.error}`);return o(s.data,i)};else throw TypeError("setRequestHandler: handler is required");this._requestHandlers.set(t,this._wrapHandler(t,a))}_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(!pu(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 dX(dW.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 pT(r.params,{...a.params});if(!i.success)throw new dX(dW.InvalidParams,`Invalid params for notification ${t}: ${i.error}`);await o(i.data,a)})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}};function pG(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function pZ(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function pW(t){throw new d_(db.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 pX(t,r,o,a,i){var s;if(!pZ(a)||"string"!=typeof a.method)throw new d_(db.InvalidResult,`Invalid input request '${o}': each inputRequests entry must be an embedded request object with a method`,{key:o});let n=a.method;if(!r.hasInputRequestMethod(n))throw new d_(db.InvalidResult,`Invalid input request '${o}': '${n}' is not an embedded request the ${r.era} revision defines (expected elicitation/create, sampling/createMessage, or roots/list)`,{key:o,method:n});let l=t.getRequestHandler(n);if(void 0===l)throw new d_(db.CapabilityNotSupported,`Cannot fulfil input request '${o}': no handler is registered for '${n}' on this client. Declare the corresponding capability and register a handler, or handle input_required results manually.`,{key:o,method:n});let c=pZ(a.params)?a.params:void 0;return await l({jsonrpc:"2.0",id:o,method:n,...void 0!==c&&{params:c}},t.buildContext({sessionId:t.sessionId,mcpReq:{id:o,method:n,_meta:c?._meta,requestState:(s=void 0,()=>s),signal:i,send:()=>pW("send"),notify:()=>pW("notify")}}))}var pY=dc(dl(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 s,n,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;n=r.exec(c);){if(n.index!==u)throw TypeError("invalid parameter format");u+=n[0].length,s=n[1].toLowerCase(),34===(l=n[2]).charCodeAt(0)&&-1!==(l=l.slice(1,-1)).indexOf("\\")&&(l=l.replace(o,"$1")),p.parameters[s]=l}if(u!==c.length)throw TypeError("invalid parameter format")}return p}})(),1),pQ=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,sy.parse(JSON.parse(t))}catch(t){if(t instanceof SyntaxError)continue;throw t}}return null}clear(){this._buffer=void 0}};function p0(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):{...t}:{}}var p1=dl(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]],s=0;for(;s<r.length;)l(o,r[s]),o.push(t[++s]);return new a(o)}t._Code=a,t.nil=new a(""),t._=i;let s=new a("+");function n(t,...r){let i=[c(t[0])],u=0;for(;u<r.length;)i.push(s),l(i,r[u]),i.push(s,c(t[++u]));return function(t){let r=1;for(;r<t.length-1;){if(t[r]===s){var a,i;let s=(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!==s){t.splice(r-1,3,s);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=n,t.addCodeArg=l,t.strConcat=function(t,r){return r.emptyStr()?t:t.emptyStr()?r:n`${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())}}),p2=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;let r=p1();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 s=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=s;var n=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=n;let l=(0,r._)`\n`;var c=class extends s{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 n(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,s=null!=(o=r.key)?o:r.ref,n=this._values[i];if(n){let t=n.get(s);if(t)return t}else n=this._values[i]=new Map;n.set(s,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,s,n={},l){let c=r.nil;for(let u in o){let d=o[u];if(!d)continue;let p=n[u]=n[u]||new Map;d.forEach(o=>{if(p.has(o))return;p.set(o,a.Started);let n=s(o);if(n){let a=this.opts.es5?t.varKinds.var:t.varKinds.const;c=(0,r._)`${c}${a} ${o} = ${n};${this.opts._n}`}else if(n=null==l?void 0:l(o))c=(0,r._)`${c}${n}${this.opts._n}`;else throw new i(o);p.set(o,a.Completed)})}return c}};t.ValueScope=c}),p9=dl(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=p1(),o=p2();var a=p1();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=p2();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 s=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},n=class extends s{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=j(this.rhs,t,r)),this}get names(){return this.rhs instanceof r._CodeOrName?this.rhs.names:{}}},l=class extends s{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=j(this.rhs,t,o),this}get names(){return x(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 s{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},d=class extends s{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},p=class extends s{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},h=class extends s{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=j(this.code,t,r),this}get names(){return this.code instanceof r._CodeOrName?this.code.names:{}}},f=class extends s{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)=>T(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(C(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=j(this.condition,t,r),this}get names(){let t=super.names;return x(t,this.condition),this.else&&T(t,this.else.names),t}};v.kind="if";var b=class extends m{};b.kind="for";var _=class extends b{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=j(this.iteration,t,r),this}get names(){return T(super.names,this.iteration.names)}},S=class extends b{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:s}=this;return`for(${r} ${a}=${i}; ${a}<${s}; ${a}++)`+super.render(t)}get names(){return x(x(super.names,this.from),this.to)}},$=class extends b{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=j(this.iterable,t,r),this}get names(){return T(super.names,this.iterable.names)}},w=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)}};w.kind="func";var E=class extends f{render(t){return"return "+super.render(t)}};E.kind="return";var R=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&&T(t,this.catch.names),this.finally&&T(t,this.finally.names),t}},P=class extends m{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};P.kind="catch";var k=class extends m{render(t){return"finally"+super.render(t)}};k.kind="finally";var O=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 n(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 _(t),r)}forRange(t,r,a,i,s=this.opts.es5?o.varKinds.var:o.varKinds.let){let n=this._scope.toName(t);return this._for(new S(s,n,r,a),()=>i(n))}forOf(t,a,i,s=o.varKinds.const){let n=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(n,(0,r._)`${t}[${o}]`),i(n)})}return this._for(new $("of",s,n,a),()=>i(n))}forIn(t,a,i,s=this.opts.es5?o.varKinds.var:o.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,r._)`Object.keys(${a})`,i);let n=this._scope.toName(t);return this._for(new $("in",s,n,a),()=>i(n))}endFor(){return this._endBlockNode(b)}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 R;if(this._blockNode(a),this.code(t),r){let t=this.name("e");this._currNode=a.catch=new P(t),r(t)}return o&&(this._currNode=a.finally=new k,this.code(o)),this._endBlockNode(P,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,a,i){return this._blockNode(new w(t,o,a)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(w)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let 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 x(t,o){return o instanceof r._CodeOrName?T(t,o.names):t}function j(t,o,a){var i;if(t instanceof r.Name)return s(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=s(o)),o instanceof r._Code?t.push(...o._items):t.push(o),t),[]));function s(t){let r=a[t.str];return void 0===r||1!==o[t.str]?t:(delete o[t.str],r)}}function C(t){return"boolean"==typeof t||"number"==typeof t||null===t?!t:(0,r._)`!${M(t)}`}t.CodeGen=O,t.not=C;let N=A(t.operators.AND);t.and=function(...t){return t.reduce(N)};let I=A(t.operators.OR);function A(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)}}),p4=dl(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=p9(),i=p1();function s(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 n(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(s,n,l,c)=>{let u=void 0===l?n:l instanceof a.Name?(n instanceof a.Name?t(s,n,l):r(s,n,l),l):n instanceof a.Name?(r(s,l,n),n):o(n,l);return c!==a.Name||u instanceof a.Name?u:i(s,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||(s(t,r),!n(r,t.self.RULES.all))},t.checkUnknownRules=s,t.schemaHasRules=n,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,s){if(!s){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 s=o===r.Num;return i?s?(0,a._)`"[" + ${t} + "]"`:(0,a._)`"['" + ${t} + "']"`:s?(0,a._)`"/" + ${t}`:(0,a._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return i?(0,a.getProperty)(t).toString():"/"+l(t)},t.checkStrictMode=f}),p5=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=p9();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")}}),p3=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;let r=p9(),o=p4(),a=p5();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 s(t,o){let{gen:a,validateName:i,schemaEnv:s}=t;s.$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,n,c){let{it:u}=o,{gen:d,compositeRule:p,allErrors:h}=u,f=l(o,a,n);(null!=c?c:p||h)?i(d,f):s(u,(0,r._)`[${f}]`)},t.reportExtraError=function(r,o=t.keywordError,n){let{it:c}=r,{gen:u,compositeRule:d,allErrors:p}=c;i(u,l(r,o,n)),d||p||s(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:s,errsCount:n,it:l}){if(void 0===n)throw Error("ajv implementation error");let c=t.name("err");t.forRange("i",n,a.default.errors,n=>{t.const(c,(0,r._)`${a.default.vErrors}[${n}]`),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`,s))})};let n={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,s){let{createErrors:l}=t.it;return!1===l?(0,r._)`{}`:function(t,i,s={}){let{gen:l,it:c}=t,u=[function({errorPath:t},{instancePath:i}){let s=i?(0,r.str)`${t}${(0,o.getErrorPath)(i,o.Type.Str)}`:t;return[a.default.instancePath,(0,r.strConcat)(a.default.instancePath,s)]}(c,s),function({keyword:t,it:{errSchemaPath:a}},{schemaPath:i,parentSchema:s}){let l=s?a:(0,r.str)`${a}/${t}`;return i&&(l=(0,r.str)`${l}${(0,o.getErrorPath)(i,o.Type.Str)}`),[n.schemaPath,l]}(t,s)];return function(t,{params:o,message:i},s){let{keyword:l,data:c,schemaValue:u,it:d}=t,{opts:p,propertyName:h,topSchemaRef:f,schemaPath:m}=d;s.push([n.keyword,l],[n.params,"function"==typeof o?o(t):o||(0,r._)`{}`]),p.messages&&s.push([n.message,"function"==typeof i?i(t):i]),p.verbose&&s.push([n.schema,u],[n.parentSchema,(0,r._)`${f}${m}`],[a.default.data,c]),h&&s.push([n.propertyName,h])}(t,i,u),l.object(...u)}(t,i,s)}}),p6=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;let r=p3(),o=p9(),a=p5(),i={message:"boolean schema is false"};function s(t,o){let{gen:a,data:s}=t;(0,r.reportError)({gen:a,keyword:"false schema",data:s,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t},i,void 0,o)}t.topBoolOrEmptySchema=function(t){let{gen:r,schema:i,validateName:n}=t;!1===i?s(t,!1):"object"==typeof i&&!0===i.$async?r.return(a.default.data):(r.assign((0,o._)`${n}.errors`,null),r.return(!0))},t.boolOrEmptySchema=function(t,r){let{gen:o,schema:a}=t;!1===a?(o.var(r,!1),s(t)):o.var(r,!0)}}),p8=dl(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:{}}}}),p7=dl(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}),he=dl(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=p8(),i=p7(),s=p3(),n=p9(),l=p4();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,s;let{gen:l,data:c,opts:d}=t,h=(a=o,(s=d.coerceTypes)?a.filter(t=>u.has(t)||"array"===s&&"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:s}=t,l=a.let("dataType",(0,n._)`typeof ${i}`),c=a.let("coerced",(0,n._)`undefined`);for(let t of("array"===s.coerceTypes&&a.if((0,n._)`${l} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>a.assign(i,(0,n._)`${i}[0]`).assign(l,(0,n._)`typeof ${i}`).if(p(r,i,s.strictNumbers),()=>a.assign(c,i))),a.if((0,n._)`${c} !== undefined`),o))(u.has(t)||"array"===t&&"array"===s.coerceTypes)&&function(t){switch(t){case"string":a.elseIf((0,n._)`${l} == "number" || ${l} == "boolean"`).assign(c,(0,n._)`"" + ${i}`).elseIf((0,n._)`${i} === null`).assign(c,(0,n._)`""`);return;case"number":a.elseIf((0,n._)`${l} == "boolean" || ${i} === null
|
|
62
|
-
|| (${l} == "string" && ${i} && ${i} == +${i})`).assign(c,(0,
|
|
63
|
-
|| (${l} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(c,(0,
|
|
64
|
-
|| ${l} === "boolean" || ${i} === null`).assign(c,(0,n._)`[${i}]`)}}(t);a.else(),f(t),a.endIf(),a.if((0,n._)`${c} !== undefined`,()=>{a.assign(i,c),function({gen:t,parentData:r,parentDataProperty:o},a){t.if((0,n._)`${r} !== undefined`,()=>t.assign((0,n._)`${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 s,l=i===r.Correct?n.operators.EQ:n.operators.NEQ;switch(t){case"null":return(0,n._)`${o} ${l} null`;case"array":s=(0,n._)`Array.isArray(${o})`;break;case"object":s=(0,n._)`${o} && typeof ${o} == "object" && !Array.isArray(${o})`;break;case"integer":s=c((0,n._)`!(${o} % 1) && !isNaN(${o})`);break;case"number":s=c();break;default:return(0,n._)`typeof ${o} ${l} ${t}`}return i===r.Correct?s:(0,n.not)(s);function c(t=n.nil){return(0,n.and)((0,n._)`typeof ${o} == "number"`,t,a?(0,n._)`isFinite(${o})`:n.nil)}}function p(t,r,o,a){let i;if(1===t.length)return d(t[0],r,o,a);let s=(0,l.toHash)(t);if(s.array&&s.object){let t=(0,n._)`typeof ${r} != "object"`;i=s.null?t:(0,n._)`!${r} || ${t}`,delete s.null,delete s.array,delete s.object}else i=n.nil;for(let t in s.number&&delete s.integer,s)i=(0,n.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,n._)`{type: ${t}}`:(0,n._)`{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,s.reportError)(r,h)}t.reportTypeError=f}),ht=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;let r=p9(),o=p4();function a(t,a,i){let{gen:s,compositeRule:n,data:l,opts:c}=t;if(void 0===i)return;let u=(0,r._)`${l}${(0,r.getProperty)(a)}`;if(n)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} === ""`),s.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))}}),hr=dl(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=p9(),o=p4(),a=p5(),i=p4();function s(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,r._)`Object.prototype.hasOwnProperty`})}function n(t,o,a){return(0,r._)`${s(t)}.call(${o}, ${a})`}function l(t,o,a,i){let s=(0,r._)`${o}${(0,r.getProperty)(a)} === undefined`;return i?(0,r.or)(s,(0,r.not)(n(t,o,a))):s}function c(t){return t?Object.keys(t).filter(t=>"__proto__"!==t):[]}t.checkReportMissingProp=function(t,o){let{gen:a,data:i,it:s}=t;a.if(l(a,i,o,s.opts.ownProperties),()=>{t.setParams({missingProperty:(0,r._)`${o}`},!0),t.error()})},t.checkMissingProp=function({gen:t,data:o,it:{opts:a}},i,s){return(0,r.or)(...i.map(i=>(0,r.and)(l(t,o,i,a.ownProperties),(0,r._)`${s} = ${i}`)))},t.reportMissingProp=function(t,r){t.setParams({missingProperty:r},!0),t.error()},t.hasPropFunc=s,t.isOwnProperty=n,t.propertyInData=function(t,o,a,i){let s=(0,r._)`${o}${(0,r.getProperty)(a)} !== undefined`;return i?(0,r._)`${s} && ${n(t,o,a)}`:s},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:s,schemaPath:n,errorPath:l},it:c},u,d,p){let h=p?(0,r._)`${t}, ${o}, ${s}${n}`: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 s=o.unicodeRegExp?"u":"",{regExp:n}=o.code,l=n(a,s);return t.scopeValue("pattern",{key:l.toString(),ref:l,code:(0,r._)`${"new RegExp"===n.code?u:(0,i.useFunc)(t,n)}(${a}, ${s})`})},t.validateArray=function(t){let{gen:a,data:i,keyword:s,it:n}=t,l=a.name("valid");if(n.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(n){let c=a.const("len",(0,r._)`${i}.length`);a.forRange("i",0,c,i=>{t.subschema({keyword:s,dataProp:i,dataPropType:o.Type.Num},l),a.if((0,r.not)(l),n)})}},t.validateUnion=function(t){let{gen:a,schema:i,keyword:s,it:n}=t;if(!Array.isArray(i))throw Error("ajv implementation error");if(i.some(t=>(0,o.alwaysValidSchema)(n,t))&&!n.opts.unevaluated)return;let l=a.let("valid",!1),c=a.name("_valid");a.block(()=>i.forEach((o,i)=>{let n=t.subschema({keyword:s,schemaProp:i,compositeRule:!0},c);a.assign(l,(0,r._)`${l} || ${c}`),t.mergeValidEvaluated(n,c)||a.if((0,r.not)(l))})),t.result(l,()=>t.reset(),()=>t.error(!0))}}),ho=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;let r=p9(),o=p5(),a=hr(),i=p3();function s(t){let{gen:o,data:a,it:i}=t;o.if(i.parentData,()=>o.assign(a,(0,r._)`${i.parentData}[${i.parentDataProperty}]`))}function n(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:s,parentSchema:l,it:c}=t,u=o.macro.call(c.self,s,l,c),d=n(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=n(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 s=m.opts.passContext?o.default.this:o.default.self,n=!("compile"in l&&!f||!1===l.schema);u.assign(g,(0,r._)`${i}${(0,a.callValidateCode)(t,y,s,n)}`,l.modifying)}function b(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&&s(t),b(()=>t.error());else{let a,n,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):(n=(0,r._)`${y}.errors`,u.assign(n,null),v(r.nil),n);l.modifying&&s(t),b(()=>(function(t,a){let{gen:s}=t;s.if((0,r._)`Array.isArray(${a})`,()=>{s.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,s){if(Array.isArray(i.keyword)?!i.keyword.includes(s):i.keyword!==s)throw Error("ajv implementation error");let n=i.dependencies;if(null==n?void 0:n.some(r=>!Object.prototype.hasOwnProperty.call(t,r)))throw Error(`parent schema must have dependencies of ${s}: ${n.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[s])){let t=`keyword "${s}" value is invalid at path "${a}": `+o.errorsText(i.validateSchema.errors);if("log"===r.validateSchema)o.logger.error(t);else throw Error(t)}}}),ha=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;let r=p9(),o=p4();t.getSubschema=function(t,{keyword:a,schemaProp:i,schema:s,schemaPath:n,errSchemaPath:l,topSchemaRef:c}){if(void 0!==a&&void 0!==s)throw Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==a){let s=t.schema[a];return void 0===i?{schema:s,schemaPath:(0,r._)`${t.schemaPath}${(0,r.getProperty)(a)}`,errSchemaPath:`${t.errSchemaPath}/${a}`}:{schema:s[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!==s){if(void 0===n||void 0===l||void 0===c)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:s,schemaPath:n,topSchemaRef:c,errSchemaPath:l}}throw Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(t,a,{dataProp:i,dataPropType:s,data:n,dataTypes:l,propertyName:c}){if(void 0!==n&&void 0!==i)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:u}=a;if(void 0!==i){let{errorPath:n,dataPathArr:l,opts:c}=a;d(u.let("data",(0,r._)`${a.data}${(0,r.getProperty)(i)}`,!0)),t.errorPath=(0,r.str)`${n}${(0,o.getErrorPath)(i,s,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!==n&&(d(n instanceof r.Name?n:u.let("data",n,!0)),void 0!==c&&(t.propertyName=c)),l&&(t.dataTypes=l)},t.extendSubschemaMode=function(t,{jtdDiscriminator:r,jtdMetadata:o,compositeRule:a,createErrors:i,allErrors:s}){void 0!==a&&(t.compositeRule=a),void 0!==i&&(t.createErrors=i),void 0!==s&&(t.allErrors=s),t.jtdDiscriminator=r,t.jtdMetadata=o}}),hi=dl((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=(s=Object.keys(r)).length)!==Object.keys(o).length)return!1;for(i=a;0!=i--;)if(!Object.prototype.hasOwnProperty.call(o,s[i]))return!1;for(i=a;0!=i--;){var a,i,s,n=s[i];if(!t(r[n],o[n]))return!1}return!0}return r!=r&&o!=o}}),hs=dl((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,s,n,l,c,u,d,p){if(s&&"object"==typeof s&&!Array.isArray(s)){for(var h in a(s,n,l,c,u,d,p),s){var f=s[h];if(Array.isArray(f)){if(h in o.arrayKeywords)for(var m=0;m<f.length;m++)t(r,a,i,f[m],n+"/"+h+"/"+m,l,n,h,s,m)}else if(h in o.propsKeywords){if(f&&"object"==typeof f)for(var y in f)t(r,a,i,f[y],n+"/"+h+"/"+y.replace(/~/g,"~0").replace(/\//g,"~1"),l,n,h,s,y)}else(h in o.keywords||r.allKeys&&!(h in o.skipKeywords))&&t(r,a,i,f,n+"/"+h,l,n,h,s)}i(s,n,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}}),hn=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;let r=p4(),o=hi(),a=hs(),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(s.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 s in o)if("$ref"===s||(a++,!i.has(s)&&("object"==typeof o[s]&&(0,r.eachItem)(o[s],r=>a+=t(r)),a===1/0)))return 1/0;return a}(t)<=o)};let s=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function n(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=n,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:s}=this.opts,l=u(t[i]||r),c={"":l},p=n(s,l,!1),h={},f=new Set;return a(t,{allKeys:!0},(t,r,o,a)=>{if(void 0===a)return;let s=p+r,n=c[a];function l(r){let o=this.opts.uriResolver.resolve;if(r=u(n?o(n,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(s)&&("#"===r[0]?(m(t,h[r],r),h[r]=t):this.refs[r]=s),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]&&(n=l.call(this,t[i])),g.call(this,t.$anchor),g.call(this,t.$dynamicAnchor),c[r]=n}),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`)}}}),hl=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;let r=p6(),o=he(),a=p7(),i=he(),s=ht(),n=ho(),l=ha(),c=p9(),u=p5(),d=hn(),p=p4(),h=p3();function f({gen:t,validateName:r,schema:o,schemaEnv:a,opts:i},s){var n;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(s)}):t.func(r,(0,c._)`${u.default.data}, ${(n=i,(0,c._)`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${n.dynamicRef?(0,c._)`, ${u.default.dynamicAnchors}={}`:c.nil}}={}`)}`,a.$async,()=>t.code(m(o,i)).code(s))}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 b(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 _({gen:t,schemaEnv:r,schema:o,errSchemaPath:a,opts:i}){let s=o.$comment;if(!0===i.$comment)t.code((0,c._)`${u.default.self}.logger.log(${s})`);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(${s}, ${o}, ${i}.schema)`)}}function S(t,r,o,s){var n,l,d,h;let{gen:f,schema:m,data:y,allErrors:g,opts:v,self:b}=t,{RULES:_}=b;if(m.$ref&&(v.ignoreKeywordsWithRef||!(0,p.schemaHasRulesButRef)(m,_)))return void f.block(()=>P(t,"$ref",_.all.$ref.definition));function S(n){(0,a.shouldUseGroup)(m,n)&&(n.type?(f.if((0,i.checkDataType)(n.type,y,v.strictNumbers)),$(t,n),1===r.length&&r[0]===n.type&&o&&(f.else(),(0,i.reportTypeError)(t)),f.endIf()):$(t,n),g||f.if((0,c._)`${u.default.errors} === ${s||0}`))}v.jtd||(n=t,l=r,!n.schemaEnv.meta&&n.opts.strictTypes&&(function(t,r){if(r.length){if(!t.dataTypes.length){t.dataTypes=r;return}r.forEach(r=>{w(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)w(r,a)?o.push(a):r.includes("integer")&&"number"===a&&o.push("integer");t.dataTypes=o}(t,r)}}(n,l),n.opts.allowUnionTypes||(d=n,(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 s=o[i];if("object"==typeof s&&(0,a.shouldUseRule)(t.schema,s)){let{type:o}=s.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}"`)}}}(n,n.dataTypes))),f.block(()=>{for(let t of _.rules)S(t);S(_.post)})}function $(t,r){let{gen:o,schema:i,opts:{useDefaults:n}}=t;n&&(0,s.assignDefaults)(t,r.type),o.block(()=>{for(let o of r.rules)(0,a.shouldUseRule)(i,o)&&P(t,o.keyword,o.definition,r.type)})}function w(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&&_(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),b(t),function(t){let{gen:r,schemaEnv:o,validateName:a,ValidationError:i,opts:s}=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),s.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 R=class{constructor(t,r,o){if((0,n.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,n.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:s}=this;o.if((0,c.or)((0,c._)`${a} === undefined`,r)),t!==c.nil&&o.assign(t,!0),(i.length||s.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:s}=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,s.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:s,opts:n}=t;n.$comment&&i.$comment&&_(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=s.const("_errs",u.default.errors);b(t,l),s.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 P(t,r,o,a){let i=new R(t,o,r);"code"in o?o.code(i,a):i.$data&&o.validate?(0,n.funcKeywordCode)(i,o):"macro"in o?(0,n.macroKeywordCode)(i,o):(o.compile||o.validate)&&(0,n.funcKeywordCode)(i,o)}t.KeywordCxt=R;let k=/^\/(?:[^~]|~0|~1)*$/,O=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function T(t,{dataLevel:r,dataNames:o,dataPathArr:a}){let i,s;if(""===t)return u.default.rootData;if("/"===t[0]){if(!k.test(t))throw Error(`Invalid JSON-pointer: ${t}`);i=t,s=u.default.rootData}else{let n=O.exec(t);if(!n)throw Error(`Invalid JSON-pointer: ${t}`);let c=+n[1];if("#"===(i=n[2])){if(c>=r)throw Error(l("property/index",c));return a[r-c]}if(c>r)throw Error(l("data",c));if(s=o[r-c],!i)return s}let n=s;for(let t of i.split("/"))t&&(s=(0,c._)`${s}${(0,c.getProperty)((0,p.unescapeJsonPointer)(t))}`,n=(0,c._)`${n} && ${s}`);return n;function l(t,o){return`Cannot access ${t} ${o} levels up, current level is ${r}`}}t.getData=T}),hc=dl(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}}}),hu=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hn();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))}}}),hd=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;let r=p9(),o=hc(),a=p5(),i=hn(),s=p4(),n=hl();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 s,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&&(s=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:s,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,n.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),s=(0,i.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&a===s)return m.call(this,o,t);let n=(0,i.normalizeId)(a),u=this.refs[n]||this.schemas[n];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),n===(0,i.normalizeId)(r)){let{schema:r}=u,{schemaId:o}=this.opts,a=r[o];return a&&(s=(0,i.resolveUrl)(this.opts.uriResolver,s,a)),new l({schema:r,schemaId:o,root:t,baseId:s})}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 s=t.refs[o];if(s)return s;let n=p.call(this,t,o);if(void 0===n){let i=null==(a=t.localRefs)?void 0:a[o],{schemaId:s}=this.opts;i&&(n=new l({schema:i,schemaId:s,root:t,baseId:r}))}if(void 0!==n)return t.refs[o]=u.call(this,n)},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 n;let c;if((null==(n=t.fragment)?void 0:n[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if("boolean"==typeof o)return;let t=o[(0,s.unescapeFragment)(a)];if(void 0===t)return;let n="object"==typeof(o=t)&&o[this.opts.schemaId];!f.has(a)&&n&&(r=(0,i.resolveUrl)(this.opts.uriResolver,r,n))}if("boolean"!=typeof o&&o.$ref&&!(0,s.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}}),hp=dl((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}}),hh=dl((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}function s(t){return t.length=0,!0}function n(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 l(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=[],l=[],c=!1,u=!1,d=n;for(let i=0;i<t.length;i++){let n=t[i];if("["!==n&&"]"!==n)if(":"===n){if(!0===c&&(u=!0),!d(l,a,o))break;if(++r>7){o.error=!0;break}i>0&&":"===t[i-1]&&(c=!0),a.push(":");continue}else if("%"===n){if(!d(l,a,o))break;d=s}else{l.push(n);continue}}return l.length&&(d===s?o.zone=l.join(""):u?a.push(l.join("")):a.push(i(l))),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:RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u),recomposeAuthority:function(t){let r=[];if(void 0!==t.userinfo&&(r.push(t.userinfo),r.push("@")),void 0!==t.host){let o=unescape(t.host);if(!a(o)){let r=l(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:l,stringArrayToHexStripped:i}}),hf=dl((t,r)=>{let{isUUID:o}=hh(),a=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,i=["http","https","ws","wss","urn","urn:uuid"];function s(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 n(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:n,serialize:l},u={scheme:"https",domainHost:c.domainHost,parse:n,serialize:l},d={scheme:"ws",domainHost:!0,parse:function(t){return t.secure=s(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t},serialize:function(t){if((t.port===(s(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 s=t,n=t.nss;return s.path=`${a||r.nid}:${n}`,r.skipEscape=!0,s},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:s,SCHEMES:h,isValidSchemeName:function(t){return -1!==i.indexOf(t)},getSchemeHandler:f}}),hm=dl((t,r)=>{let{normalizeIPv6:o,removeDotSegments:a,recomposeAuthority:i,normalizeComponentEncoding:s,isIPv4:n,nonSimpleDomain:l}=hh(),{SCHEMES:c,getSchemeHandler:u}=hf();function d(t,r,o,i){let s={};return i||(t=f(p(t,o),o),r=f(p(r,o),o)),!(o=o||{}).tolerant&&r.scheme?(s.scheme=r.scheme,s.userinfo=r.userinfo,s.host=r.host,s.port=r.port,s.path=a(r.path||""),s.query=r.query):(void 0!==r.userinfo||void 0!==r.host||void 0!==r.port?(s.userinfo=r.userinfo,s.host=r.host,s.port=r.port,s.path=a(r.path||""),s.query=r.query):(r.path?("/"===r.path[0]?s.path=a(r.path):(void 0===t.userinfo&&void 0===t.host&&void 0===t.port||t.path?t.path?s.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+r.path:s.path=r.path:s.path="/"+r.path,s.path=a(s.path)),s.query=r.query):(s.path=t.path,void 0!==r.query?s.query=r.query:s.query=t.query),s.userinfo=t.userinfo,s.host=t.host,s.port=t.port),s.scheme=t.scheme),s.fragment=r.fragment,s}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:""},s=Object.assign({},r),n=[],l=u(s.scheme||o.scheme);l&&l.serialize&&l.serialize(o,s),void 0!==o.path&&(s.skipEscape?o.path=unescape(o.path):(o.path=escape(o.path),void 0!==o.scheme&&(o.path=o.path.split("%3A").join(":")))),"suffix"!==s.reference&&o.scheme&&n.push(o.scheme,":");let c=i(o);if(void 0!==c&&("suffix"!==s.reference&&n.push("//"),n.push(c),o.path&&"/"!==o.path[0]&&n.push("/")),void 0!==o.path){let t=o.path;s.absolutePath||l&&l.absolutePath||(t=a(t)),void 0===c&&"/"===t[0]&&"/"===t[1]&&(t="/%2F"+t.slice(2)),n.push(t)}return void 0!==o.query&&n.push("?",o.query),void 0!==o.fragment&&n.push("#",o.fragment),n.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},s=!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===n(i.host)){let t=o(i.host);i.host=t.host.toLowerCase(),s=t.isIPV6}else s=!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===s&&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(s(f(t=unescape(t),o),!0),{...o,skipEscape:!0}):"object"==typeof t&&(t=p(s(t,!0),{...o,skipEscape:!0})),"string"==typeof r?r=p(s(f(r=unescape(r),o),!0),{...o,skipEscape:!0}):"object"==typeof r&&(r=p(s(r,!0),{...o,skipEscape:!0})),t.toLowerCase()===r.toLowerCase()},serialize:p,parse:f};r.exports=m,r.exports.default=m,r.exports.fastUri=m}),hy=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hm();r.code='require("ajv/dist/runtime/uri").default',t.default=r}),hg=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var r=hl();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return r.KeywordCxt}});var o=p9();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=hc(),i=hu(),s=p8(),n=hd(),l=p9(),c=hn(),u=he(),d=p4(),p=hp(),h=hy(),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 b=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,s,n,l,c,u,d,p,m,y,g,v,b,_,S,$,w,E,R,P,k,O;let T=t.strict,x=null==(r=t.code)?void 0:r.optimize,j=!0===x||void 0===x?1:x||0,C=null!=(a=null==(o=t.code)?void 0:o.regExp)?a:f,N=null!=(i=t.uriResolver)?i:h.default;return{strictSchema:null==(n=null!=(s=t.strictSchema)?s:T)||n,strictNumbers:null==(c=null!=(l=t.strictNumbers)?l:T)||c,strictTypes:null!=(d=null!=(u=t.strictTypes)?u:T)?d:"log",strictTuples:null!=(m=null!=(p=t.strictTuples)?p:T)?m:"log",strictRequired:null!=(g=null!=(y=t.strictRequired)?y:T)&&g,code:t.code?{...t.code,optimize:j,regExp:C}:{optimize:j,regExp:C},loopRequired:null!=(v=t.loopRequired)?v:200,loopEnum:null!=(b=t.loopEnum)?b:200,meta:null==(_=t.meta)||_,messages:null==(S=t.messages)||S,inlineRefs:null==($=t.inlineRefs)||$,schemaId:null!=(w=t.schemaId)?w:"$id",addUsedSchema:null==(E=t.addUsedSchema)||E,validateSchema:null==(R=t.validateSchema)||R,validateFormats:null==(P=t.validateFormats)||P,unicodeRegExp:null==(k=t.unicodeRegExp)||k,int32range:null==(O=t.int32range)||O,uriResolver:N}}(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 P;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,s.getRules)(),_.call(this,g,t,"NOT SUPPORTED"),_.call(this,v,t,"DEPRECATED","warn"),this._metaOpts=R.call(this),t.formats&&w.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&E.call(this,t.keywords),"object"==typeof t.meta&&this.addMetaSchema(t.meta),$.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 s.call(this,t.$schema);let o=this._addSchema(t,r);return o.validate||n.call(this,o)}async function s(t){t&&!this.getSchema(t)&&await a.call(this,{$ref:t},!0)}async function n(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),n.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 s.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 n.SchemaEnv({schema:{},schemaId:o});if(!(r=n.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(O.call(this,o,r),!r)return(0,d.eachItem)(o,t=>T.call(this,t)),this;j.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=>T.call(this,t,a):t=>a.type.forEach(r=>T.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,s=i[t];a&&s&&(i[t]=N(s))}}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 s,{schemaId:l}=this.opts;if("object"==typeof t)s=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)(s||o);let d=c.getSchemaRefs.call(this,t,o);return u=new n.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):n.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{n.compileSchema.call(this,t)}finally{this.opts=r}}};function _(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 $(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let r in t)this.addSchema(t[r],r)}function w(){for(let t in this.opts.formats){let r=this.opts.formats[t];r&&this.addFormat(t,r)}}function 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 R(){let t={...this.opts};for(let r of m)delete t[r];return t}b.ValidationError=a.default,b.MissingRefError=i.default,t.default=b;let P={log(){},warn(){},error(){}},k=/^[a-z_$][a-z0-9_$:-]*$/i;function O(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 a;let i=null==r?void 0:r.post;if(o&&i)throw Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,n=i?s.post:s.rules.find(({type:t})=>t===o);if(n||(n={type:o,rules:[]},s.rules.push(n)),s.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?x.call(this,n,l,r.before):n.rules.push(l),s.all[t]=l,null==(a=r.implements)||a.forEach(t=>this.addKeyword(t))}function x(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 j(t){let{metaSchema:r}=t;void 0!==r&&(t.$data&&this.opts.$data&&(r=N(r)),t.validateSchema=this.compile(r,!0))}let C={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function N(t){return{anyOf:[t,C]}}}),hv=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}}}),hb=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;let r=hu(),o=hr(),a=p9(),i=p5(),s=hd(),n=p4();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,s,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==s?void 0:s.validate)?void 0:r.evaluated;if(!0!==u.props)if(o&&!o.dynamicProps)void 0!==o.props&&(u.props=n.mergeEvaluated.props(c,o.props,u.props));else{let r=c.var("props",(0,a._)`${t}.evaluated.props`);u.props=n.mergeEvaluated.props(c,r,u.props,a.Name)}if(!0!==u.items)if(o&&!o.dynamicItems)void 0!==o.items&&(u.items=n.mergeEvaluated.items(c,o.items,u.items));else{let r=c.var("items",(0,a._)`${t}.evaluated.items`);u.items=n.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 n,u,d,{gen:p,schema:h,it:f}=t,{baseId:m,schemaEnv:y,validateName:g,opts:v,self:b}=f,{root:_}=y;if(("#"===h||"#/"===h)&&m===_.baseId){if(y===_)return c(t,g,y,y.$async);let r=p.scopeValue("root",{ref:_});return c(t,(0,a._)`${r}.validate`,_,_.$async)}let S=s.resolveRef.call(b,_,m,h);if(void 0===S)throw new r.default(f.opts.uriResolver,m,h);return S instanceof s.SchemaEnv?void c(t,l(t,o=S),o,o.$async):(i=S,n=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:n,errSchemaPath:h},u),void(t.mergeEvaluated(d),t.ok(u)))}}}),h_=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hv(),o=hb();t.default=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",r.default,o.default]}),hS=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=p9(),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:s}=t;t.fail$data((0,r._)`${i} ${a[o].fail} ${s} || isNaN(${i})`)}}}),h$=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=p9();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:s}=t,n=s.opts.multipleOfPrecision,l=o.let("res"),c=n?(0,r._)`Math.abs(Math.round(${l}) - ${l}) > 1e-${n}`:(0,r._)`${l} !== parseInt(${l})`;t.fail$data((0,r._)`(${i} === 0 || (${l} = ${a}/${i}, ${c}))`)}}}),hw=dl(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'}),hE=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=p9(),o=p4(),a=hw();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:s,schemaCode:n,it:l}=t,c="maxLength"===i?r.operators.GT:r.operators.LT,u=!1===l.opts.unicode?(0,r._)`${s}.length`:(0,r._)`${(0,o.useFunc)(t.gen,a.default)}(${s})`;t.fail$data((0,r._)`${u} ${c} ${n}`)}}}),hR=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hr(),o=p4(),a=p9();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:s,$data:n,schema:l,schemaCode:c,it:u}=t,d=u.opts.unicodeRegExp?"u":"";if(n){let{regExp:r}=u.opts.code,n="new RegExp"===r.code?(0,a._)`new RegExp`:(0,o.useFunc)(i,r),l=i.let("valid");i.try(()=>i.assign(l,(0,a._)`${n}(${c}, ${d}).test(${s})`),()=>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(${s})`)}}}}),hP=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=p9();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,s="maxProperties"===o?r.operators.GT:r.operators.LT;t.fail$data((0,r._)`Object.keys(${a}).length ${s} ${i}`)}}}),hk=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hr(),o=p9(),a=p4();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:s,schemaCode:n,data:l,$data:c,it:u}=t,{opts:d}=u;if(!c&&0===s.length)return;let p=s.length>=d.loopRequired;if(u.allErrors?function(){if(p||c)t.block$data(o.nil,h);else for(let o of s)(0,r.checkReportMissingProp)(t,o)}():function(){let a=i.let("missing");if(p||c){let s=i.let("valid",!0);t.block$data(s,()=>{var c,u;return c=a,u=s,void(t.setParams({missingProperty:c}),i.forOf(c,n,()=>{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(s)}else i.if((0,r.checkMissingProp)(t,s,a)),(0,r.reportMissingProp)(t,a),i.else()}(),d.strictRequired){let r=t.parentSchema.properties,{definedProperties:o}=t.it;for(let t of s)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",n,o=>{t.setParams({missingProperty:o}),i.if((0,r.noPropertyInData)(i,l,o,d.ownProperties),()=>t.error())})}}}}),hO=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=p9();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,s="maxItems"===o?r.operators.GT:r.operators.LT;t.fail$data((0,r._)`${a}.length ${s} ${i}`)}}}),hT=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hi();r.code='require("ajv/dist/runtime/equal").default',t.default=r}),hx=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=he(),o=p9(),a=p4(),i=hT();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:s,data:n,$data:l,schema:c,parentSchema:u,schemaCode:d,it:p}=t;if(!l&&!c)return;let h=s.let("valid"),f=u.items?(0,r.getSchemaTypes)(u.items):[];t.block$data(h,function(){let l=s.let("i",(0,o._)`${n}.length`),c=s.let("j");t.setParams({i:l,j:c}),s.assign(h,!0),s.if((0,o._)`${l} > 1`,()=>(f.length>0&&!f.some(t=>"object"===t||"array"===t)?function(a,i){let l=s.name("item"),c=(0,r.checkDataTypes)(f,l,p.opts.strictNumbers,r.DataType.Wrong),u=s.const("indices",(0,o._)`{}`);s.for((0,o._)`;${a}--;`,()=>{s.let(l,(0,o._)`${n}[${a}]`),s.if(c,(0,o._)`continue`),f.length>1&&s.if((0,o._)`typeof ${l} == "string"`,(0,o._)`${l} += "_"`),s.if((0,o._)`typeof ${u}[${l}] == "number"`,()=>{s.assign(i,(0,o._)`${u}[${l}]`),t.error(),s.assign(h,!1).break()}).code((0,o._)`${u}[${l}] = ${a}`)})}:function(r,l){let c=(0,a.useFunc)(s,i.default),u=s.name("outer");s.label(u).for((0,o._)`;${r}--;`,()=>s.for((0,o._)`${l} = ${r}; ${l}--;`,()=>s.if((0,o._)`${c}(${n}[${r}], ${n}[${l}])`,()=>{t.error(),s.assign(h,!1).break(u)})))})(l,c))},(0,o._)`${d} === false`),t.ok(h)}}}),hj=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=p9(),o=p4(),a=hT();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:s,$data:n,schemaCode:l,schema:c}=t;n||c&&"object"==typeof c?t.fail$data((0,r._)`!${(0,o.useFunc)(i,a.default)}(${s}, ${l})`):t.fail((0,r._)`${c} !== ${s}`)}}}),hC=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=p9(),o=p4(),a=hT();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,s,{gen:n,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)(n,a.default);if(h||c)s=n.let("valid"),t.block$data(s,function(){n.assign(s,!1),n.forOf("v",d,t=>n.if((0,r._)`${f()}(${l}, ${t})`,()=>n.assign(s,!0).break()))});else{if(!Array.isArray(u))throw Error("ajv implementation error");let t=n.const("vSchema",d);s=(0,r.or)(...u.map((o,a)=>{var i,s;let n;return i=t,"object"==typeof(n=u[s=a])&&null!==n?(0,r._)`${f()}(${l}, ${i}[${s}])`:(0,r._)`${l} === ${n}`}))}t.pass(s)}}}),hN=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hS(),o=h$(),a=hE(),i=hR(),s=hP(),n=hk(),l=hO(),c=hx(),u=hj(),d=hC();t.default=[r.default,o.default,a.default,i.default,s.default,n.default,l.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,d.default]}),hI=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;let r=p9(),o=p4();function a(t,a){let{gen:i,schema:s,data:n,keyword:l,it:c}=t;c.items=!0;let u=i.const("len",(0,r._)`${n}.length`);if(!1===s)t.setParams({len:a.length}),t.pass((0,r._)`${u} <= ${a.length}`);else if("object"==typeof s&&!(0,o.alwaysValidSchema)(c,s)){let s=i.var("valid",(0,r._)`${u} <= ${a.length}`);i.if((0,r.not)(s),()=>{var n;return n=s,void i.forRange("i",a.length,u,a=>{t.subschema({keyword:l,dataProp:a,dataPropType:o.Type.Num},n),c.allErrors||i.if((0,r.not)(n),()=>i.break())})}),t.ok(s)}}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:s}=r;Array.isArray(s)?a(t,s):(0,o.checkStrictMode)(i,'"additionalItems" is ignored when "items" is not an array of schemas')}}}),hA=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;let r=p9(),o=p4(),a=hr();function i(t,a,s=t.schema){let{gen:n,parentSchema:l,data:c,keyword:u,it:d}=t;(function(t){let{opts:r,errSchemaPath:i}=d,n=s.length,l=n===t.minItems&&(n===t.maxItems||!1===t[a]);if(r.strictTuples&&!l){let t=`"${u}" is ${n}-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&&s.length&&!0!==d.items&&(d.items=o.mergeEvaluated.items(n,s.length,d.items));let p=n.name("valid"),h=n.const("len",(0,r._)`${c}.length`);s.forEach((a,i)=>{(0,o.alwaysValidSchema)(d,a)||(n.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:s}=t;if(Array.isArray(r))return i(t,"additionalItems",r);s.items=!0,(0,o.alwaysValidSchema)(s,r)||t.ok((0,a.validateArray)(t))}}}),hM=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hA();t.default={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,r.validateTuple)(t,"items")}}),hq=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=p9(),o=p4(),a=hr(),i=hI();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:s,it:n}=t,{prefixItems:l}=s;n.items=!0,(0,o.alwaysValidSchema)(n,r)||(l?(0,i.validateAdditionalItems)(t,l):t.ok((0,a.validateArray)(t)))}}}),hz=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=p9(),o=p4();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:s,schema:n,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=s.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,n)){let o=(0,r._)`${h} >= ${a}`;void 0!==i&&(o=(0,r._)`${o} && ${h} <= ${i}`),t.pass(o);return}u.items=!0;let f=s.name("valid");function m(){let t=s.name("_valid"),o=s.let("count",0);y(t,()=>s.if(t,()=>{var t;return t=o,void(s.code((0,r._)`${t}++`),void 0===i?s.if((0,r._)`${t} >= ${a}`,()=>s.assign(f,!0).break()):(s.if((0,r._)`${t} > ${i}`,()=>s.assign(f,!1).break()),1===a?s.assign(f,!0):s.if((0,r._)`${t} >= ${a}`,()=>s.assign(f,!0))))}))}function y(r,a){s.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,()=>s.if(f,()=>s.break())):0===a?(s.let(f,!0),void 0!==i&&s.if((0,r._)`${c}.length > 0`,m)):(s.let(f,!1),m()),t.result(f,()=>t.reset())}}}),hL=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;let r=p9(),o=p4(),a=hr();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},
|
|
62
|
+
depsCount: ${a},
|
|
63
|
+
deps: ${o}}`};let i={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(t){let[r,a]=function({schema:t}){let r={},a={};for(let o in t)"__proto__"!==o&&((Array.isArray(t[o])?r:a)[o]=t[o]);return[r,a]}(t);n(t,r),s(t,a)}};function n(t,a=t.schema){let{gen:i,data:s,it:l}=t;if(0===Object.keys(a).length)return;let c=i.let("missing");for(let n in a){let u=a[n];if(0===u.length)continue;let d=(0,o.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,o.checkReportMissingProp)(t,r)}):(i.if((0,r._)`${d} && (${(0,o.checkMissingProp)(t,u,c)})`),(0,o.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,a.alwaysValidSchema)(c,r[s])||(i.if((0,o.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}),ut=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cv(),a=cb();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:o,schema:i,data:n,it:s}=t;if((0,a.alwaysValidSchema)(s,i))return;let l=o.name("valid");o.forIn("key",n,a=>{t.setParams({propertyName:a}),t.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},l),o.if((0,r.not)(l),()=>{t.error(!0),s.allErrors||o.break()})}),t.ok(l)}}}),ur=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ck(),a=cv(),o=c_(),i=cb();t.default={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:t})=>(0,a._)`{additionalProperty: ${t.additionalProperty}}`},code(t){let{gen: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,a._)`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 o=n.name("valid");"failing"===h.removeAdditional?(v(r,o,!1),n.if((0,a.not)(o),()=>{t.reset(),y(r)})):(v(r,o),p||n.if((0,a.not)(o),()=>n.break()))}}function v(r,a,o){let n={keyword:"additionalProperties",dataProp:r,dataPropType:i.Type.Str};!1===o&&Object.assign(n,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(n,a)}n.forIn("key",c,o=>{f.length||m.length?n.if(function(o){let s;if(f.length>8){let t=(0,i.schemaRefOrVal)(d,l.properties,"properties");s=(0,r.isOwnProperty)(n,t,o)}else s=f.length?(0,a.or)(...f.map(t=>(0,a._)`${o} === ${t}`)):a.nil;return m.length&&(s=(0,a.or)(s,...m.map(i=>(0,a._)`${(0,r.usePattern)(t,i)}.test(${o})`))),(0,a.not)(s)}(o),()=>g(o)):g(o)}),t.ok((0,a._)`${u} === ${o.default.errors}`)}}}),ua=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cA(),a=ck(),o=cb(),i=ur();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,a.allSchemaProperties)(s);for(let t of d)u.definedProperties.add(t);u.opts.unevaluated&&d.length&&!0!==u.props&&(u.props=o.mergeEvaluated.props(n,(0,o.toHash)(d),u.props));let p=d.filter(t=>!(0,o.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,a.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)}}}}),uo=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ck(),a=cv(),o=cb(),i=cb();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,o.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 a.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,o.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(o){n.forIn("key",l,s=>{n.if((0,a._)`${(0,r.usePattern)(t,o)}.test(${s})`,()=>{let r=h.includes(o);r||t.subschema({keyword:"patternProperties",schemaProp:o,dataProp:s,dataPropType:i.Type.Str},m),u.opts.unevaluated&&!0!==y?n.assign((0,a._)`${y}[${s}]`,!0):r||u.allErrors||n.if((0,a.not)(m),()=>n.break())})})}}}}),ui=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb();t.default={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:a,schema:o,it:i}=t;if((0,r.alwaysValidSchema)(i,o))return void t.fail();let n=a.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"}}}),un=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:ck().validateUnion,error:{message:"must match a schema in anyOf"}}}),us=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cv(),a=cb();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:o,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=o.let("valid",!1),c=o.let("passing",null),u=o.name("_valid");t.setParams({passing:c}),o.block(function(){i.forEach((i,n)=>{let d;(0,a.alwaysValidSchema)(s,i)?o.var(u,!0):d=t.subschema({keyword:"oneOf",schemaProp:n,compositeRule:!0},u),n>0&&o.if((0,r._)`${u} && ${l}`).assign(l,!1).assign(c,(0,r._)`[${c}, ${n}]`).else(),o.if(u,()=>{o.assign(l,!0),o.assign(c,n),d&&t.mergeEvaluated(d,r.Name)})})}),t.result(l,()=>t.reset(),()=>t.error(!0))}}}),ul=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb();t.default={keyword:"allOf",schemaType:"array",code(t){let{gen:a,schema:o,it:i}=t;if(!Array.isArray(o))throw Error("ajv implementation error");let n=a.name("valid");o.forEach((a,o)=>{if((0,r.alwaysValidSchema)(i,a))return;let s=t.subschema({keyword:"allOf",schemaProp:o},n);t.ok(n),t.mergeEvaluated(s)})}}}),uc=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cv(),a=cb();function o(t,r){let o=t.schema[r];return void 0!==o&&!(0,a.alwaysValidSchema)(t,o)}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,a.checkStrictMode)(l,'"if" without "then" and "else" is ignored');let c=o(l,"then"),u=o(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(a,o){return()=>{let i=t.subschema({keyword:a},p);n.assign(d,p),t.mergeValidEvaluated(i,d),o?n.assign(o,(0,r._)`${a}`):t.setParams({ifClause:a})}}t.pass(d,()=>t.error(!0))}}}),uu=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb();t.default={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:a,it:o}){void 0===a.if&&(0,r.checkStrictMode)(o,`"${t}" without "if" is ignored`)}}}),ud=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=c5(),a=c3(),o=c6(),i=c8(),n=c7(),s=ue(),l=ut(),c=ur(),u=ua(),d=uo(),p=ui(),h=un(),f=us(),m=ul(),y=uc(),g=uu();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(a.default,i.default):v.push(r.default,o.default),v.push(n.default),v}}),up=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cv();t.default={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,r.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,r._)`{format: ${t}}`},code(t,a){let o,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:b}=m;y.validateFormats&&(p?(o=u.scopeValue("formats",{ref:b.formats,code:y.code.formats}),i=u.const("fDef",(0,r._)`${o}[${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} === ${a} && !${c}`)))):function(){var o;let i,n,s=b.formats[h];if(!s){if(!1===y.strictSchema)return b.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=(o=s)instanceof RegExp?(0,r.regexpCode)(o):y.code.formats?(0,r._)`${y.code.formats}${(0,r.getProperty)(h)}`:void 0,n=u.scopeValue("formats",{key:h,ref:o,code:i}),"object"!=typeof o||o instanceof RegExp?["string",o,n]:[o.type||"string",o.validate,(0,r._)`${n}.validate`]);c===a&&t.pass(function(){if("object"==typeof s&&!(s instanceof RegExp)&&s.async){if(!v.$async)throw Error("async format in sync schema");return(0,r._)`await ${f}(${d})`}return"function"==typeof p?(0,r._)`${f}(${d})`:(0,r._)`${f}.test(${d})`}())}())}}}),uh=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=[up().default]}),uf=eo(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"]}),um=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cF(),a=c4(),o=ud(),i=uh(),n=uf();t.default=[r.default,a.default,(0,o.default)(),i.default,n.metadataVocabulary,n.contentVocabulary]}),uy=eo(t=>{var r,a;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,(a=r||(t.DiscrError=r={})).Tag="tag",a.Mapping="mapping"}),ug=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cv(),a=uy(),o=cM(),i=cN(),n=cb();t.default={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:t,tagName:r}})=>t===a.DiscrError.Tag?`tag "${r}" must be string`:`value of tag "${r}" must be in oneOf`,params:({params:{discrError:t,tag:a,tagName:o}})=>(0,r._)`{error: ${t}, tag: ${o}, tagValue: ${a}}`},code(t){let{gen:s,data:l,schema:c,parentSchema:u,it:d}=t,{oneOf:p}=u;if(!d.opts.discriminator)throw Error("discriminator: requires discriminator option");let 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={},a=l(u),s=!0;for(let r=0;r<p.length;r++){let u=p[r];if((null==u?void 0:u.$ref)&&!(0,n.schemaHasRulesButRef)(u,d.self.RULES)){let t=u.$ref;if((u=o.resolveRef.call(d.self,d.schemaEnv.root,d.baseId,t))instanceof o.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&&(a||l(u)),function(t,r){if(t.const)c(t.const,r);else if(t.enum)for(let a of t.enum)c(a,r);else throw Error(`discriminator: "properties/${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,a){if("string"!=typeof t||t in r)throw Error(`discriminator: "${h}" values must be unique strings`);r[t]=a}}();for(let a in s.if(!1),l)s.elseIf((0,r._)`${m} === ${a}`),s.assign(f,function(a){let o=s.name("valid"),i=t.subschema({keyword:"oneOf",schemaProp:a},o);return t.mergeEvaluated(i,r.Name),o}(l[a]));s.else(),t.error(!1,{discrError:a.DiscrError.Mapping,tag:m,tagName:h}),s.endIf()})(),()=>t.error(!1,{discrError:a.DiscrError.Tag,tag:m,tagName:h})),t.ok(f)}}}),uv=eo((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}}),ub=eo((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv=void 0;let a=cH(),o=um(),i=ug(),n=uv(),s=["/properties"],l="http://json-schema.org/draft-07/schema";var c=class extends a.default{_addVocabularies(){super._addVocabularies(),o.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=cA();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=cv();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=cI();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return p.default}});var h=cN();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return h.default}})}),u_=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicAnchor=void 0;let r=cv(),a=c_(),o=cM(),i=cK();function n(t,n){let{gen:s,it:l}=t;l.schemaEnv.root.dynamicAnchors[n]=!0;let c=(0,r._)`${a.default.dynamicAnchors}${(0,r.getProperty)(n)}`,u="#"===l.errSchemaPath?l.validateName:function(t){let{schemaEnv:r,schema:a,self:n}=t.it,{root:s,baseId:l,localRefs:c,meta:u}=r.root,{schemaId:d}=n.opts,p=new o.SchemaEnv({schema:a,schemaId:d,root:s,baseId:l,localRefs:c,meta:u});return o.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)}}),uS=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicRef=void 0;let r=cv(),a=c_(),o=cK();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 o=n.let("_v",(0,r._)`${a.default.dynamicAnchors}${(0,r.getProperty)(c)}`);n.if(o,d(o,t),d(l.validateName,t))}else d(l.validateName,t)()}function d(r,a){return a?()=>n.block(()=>{(0,o.callRef)(t,r),n.let(a,!0)}):()=>(0,o.callRef)(t,r)}}t.dynamicRef=i,t.default={keyword:"$dynamicRef",schemaType:"string",code:t=>i(t,t.schema)}}),uw=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u_(),a=cb();t.default={keyword:"$recursiveAnchor",schemaType:"boolean",code(t){t.schema?(0,r.dynamicAnchor)(t,""):(0,a.checkStrictMode)(t.it,"$recursiveAnchor: false is ignored")}}}),u$=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uS();t.default={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,r.dynamicRef)(t,t.schema)}}),uE=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u_(),a=uS(),o=uw(),i=u$();t.default=[r.default,a.default,o.default,i.default]}),uP=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ue();t.default={keyword:"dependentRequired",type:"object",schemaType:"object",error:r.error,code:t=>(0,r.validatePropertyDeps)(t)}}),uR=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ue();t.default={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,r.validateSchemaDeps)(t)}}),uk=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb();t.default={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:t,parentSchema:a,it:o}){void 0===a.contains&&(0,r.checkStrictMode)(o,`"${t}" without "contains" is ignored`)}}}),ux=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uP(),a=uR(),o=uk();t.default=[r.default,a.default,o.default]}),uT=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cv(),a=cb(),o=c_();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(o){if(!1===n){t.setParams({unevaluatedProperty:o}),t.error(),u||i.break();return}if(!(0,a.alwaysValidSchema)(c,n)){let n=i.name("valid");t.subschema({keyword:"unevaluatedProperties",dataProp:o,dataPropType:a.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 a,o;return i.if((a=d,o=t,(0,r._)`!${a} || !${a}[${o}]`),()=>p(t))})):!0!==d&&i.forIn("key",s,t=>void 0===d?p(t):i.if(function(t,a){let o=[];for(let i in t)!0===t[i]&&o.push((0,r._)`${a} !== ${i}`);return(0,r.and)(...o)}(d,t),()=>p(t))),c.props=!0,t.ok((0,r._)`${l} === ${o.default.errors}`)}}}),uO=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cv(),a=cb();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:o,schema:i,data:n,it:s}=t,l=s.items||0;if(!0===l)return;let c=o.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,a.alwaysValidSchema)(s,i)){let i=o.var("valid",(0,r._)`${c} <= ${l}`);o.if((0,r.not)(i),()=>{var n,u;return n=i,u=l,void o.forRange("i",u,c,i=>{t.subschema({keyword:"unevaluatedItems",dataProp:i,dataPropType:a.Type.Num},n),s.allErrors||o.if((0,r.not)(n),()=>o.break())})}),t.ok(i)}s.items=!0}}}),uj=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uT(),a=uO();t.default=[r.default,a.default]}),uC=eo((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"}]}}}}}),uA=eo((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:"#"}}}}}),uI=eo((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:"#"}}}}),uN=eo((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:{}}}}}),uM=eo((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"}}}}),uq=eo((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}}}}),uz=eo((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:[]}}}}),uD=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uC(),a=uA(),o=uI(),i=uN(),n=uM(),s=uq(),l=uz(),c=["/properties"];t.default=function(t){return[r,a,o,i,u(this,n),s,u(this,l)].forEach(t=>this.addMetaSchema(t,void 0,!1)),this;function u(r,a){return t?r.$dataMetaSchema(a,c):a}}}),uL=eo((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv2019=void 0;let a=cH(),o=um(),i=uE(),n=ux(),s=uj(),l=ug(),c=uD(),u="https://json-schema.org/draft/2019-09/schema";var d=class extends a.default{constructor(t={}){super({...t,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(i.default),o.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=cA();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return p.KeywordCxt}});var h=cv();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=cI();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return f.default}});var m=cN();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return m.default}})}),uU=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cF(),a=c4(),o=ud(),i=uE(),n=ux(),s=uj(),l=uh(),c=uf();t.default=[i.default,r.default,a.default,(0,o.default)(!0),l.default,c.metadataVocabulary,c.contentVocabulary,n.default,s.default]}),uH=eo((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}}}}),uV=eo((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"}}}}}),uK=eo((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"}}}}),uF=eo((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"}}}}),uJ=eo((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"}}}}),uW=eo((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"}}}}),uB=eo((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}}}}),uG=eo((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:[]}}}}),uZ=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uH(),a=uV(),o=uK(),i=uF(),n=uJ(),s=uW(),l=uB(),c=uG(),u=["/properties"];t.default=function(t){return[r,a,o,i,n,d(this,s),l,d(this,c)].forEach(t=>this.addMetaSchema(t,void 0,!1)),this;function d(r,a){return t?r.$dataMetaSchema(a,u):a}}}),uX=eo((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv2020=void 0;let a=cH(),o=uU(),i=ug(),n=uZ(),s="https://json-schema.org/draft/2020-12/schema";var l=class extends a.default{constructor(t={}){super({...t,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),o.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=cA();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=cv();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=cI();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.default}});var p=cN();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}),uY=eo(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<=b&&t>=v}},int64:{type:"number",validate:function(t){return Number.isInteger(t)}},float:{type:"number",validate:_},double:{type:"number",validate:_},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 a=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,o=[0,31,28,31,30,31,30,31,31,30,31,30,31];function i(t){var r;let i=a.exec(t);if(!i)return!1;let 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:o[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 a=s.exec(r);if(!a)return!1;let o=+a[1],i=+a[2],n=+a[3],l=a[4],c="-"===a[5]?-1:1,u=+(a[6]||0),d=+(a[7]||0);if(u>23||d>59||t&&!l)return!1;if(o<=23&&i<=59&&n<60)return!0;let p=i-d*c,h=o-u*c-(p<0);return(23===h||-1===h)&&(59===p||-1===p)&&n<61}}function c(t,r){if(!(t&&r))return;let a=new Date("2020-01-01T"+t).valueOf(),o=new Date("2020-01-01T"+r).valueOf();if(a&&o)return a-o}function u(t,r){if(!(t&&r))return;let a=s.exec(t),o=s.exec(r);if(a&&o)return(t=a[1]+a[2]+a[3])>(r=o[1]+o[2]+o[3])?1:t<r?-1:0}let d=/t|\s/i;function p(t){let r=l(t);return function(t){let a=t.split(d);return 2===a.length&&i(a[0])&&r(a[1])}}function h(t,r){if(!(t&&r))return;let a=new Date(t).valueOf(),o=new Date(r).valueOf();if(a&&o)return a-o}function f(t,r){if(!(t&&r))return;let[a,o]=t.split(d),[i,s]=r.split(d),l=n(a,i);if(void 0!==l)return l||c(o,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,b=0x80000000-1;function _(){return!0}let S=/[^\\]\\Z/}),uQ=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;let r=ub(),a=cv(),o=a.operators,i={formatMaximum:{okStr:"<=",ok:o.LTE,fail:o.GT},formatMinimum:{okStr:">=",ok:o.GTE,fail:o.LT},formatExclusiveMaximum:{okStr:"<",ok:o.LT,fail:o.GTE},formatExclusiveMinimum:{okStr:">",ok:o.GT,fail:o.LTE}};t.formatLimitDefinition={keyword:Object.keys(i),type:"string",schemaType:"string",$data:!0,error:{message:({keyword:t,schemaCode:r})=>(0,a.str)`should be ${i[t].okStr} ${r}`,params:({keyword:t,schemaCode:r})=>(0,a._)`{comparison: ${i[t].okStr}, limit: ${r}}`},code(t){let o,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,a._)`${t}.compare(${l}, ${c}) ${i[u].fail} 0`}f.$data?(o=s.scopeValue("formats",{ref:h.formats,code:p.code.formats}),n=s.const("fmt",(0,a._)`${o}[${f.schemaCode}]`),t.fail$data((0,a.or)((0,a._)`typeof ${n} != "object"`,(0,a._)`${n} instanceof RegExp`,(0,a._)`typeof ${n}.compare != "function"`,m(n)))):function(){let r=f.schema,o=h.formats[r];if(!o||!0===o)return;if("object"!=typeof o||o instanceof RegExp||"function"!=typeof o.compare)throw Error(`"${u}": format "${r}" does not define "compare" function`);let i=s.scopeValue("formats",{key:r,ref:o,code:p.code.formats?(0,a._)`${p.code.formats}${(0,a.getProperty)(r)}`:void 0});t.fail$data(m(i))}()},dependencies:["format"]},t.default=r=>(r.addKeyword(t.formatLimitDefinition),r)}),u0=eo((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});let a=uY(),o=uQ(),i=cv(),n=new i.Name("fullFormats"),s=new i.Name("fastFormats"),l=(t,r={keywords:!0})=>{if(Array.isArray(r))return c(t,r,a.fullFormats,n),t;let[i,l]="fast"===r.mode?[a.fastFormats,s]:[a.fullFormats,n];return c(t,r.formats||a.formatNames,i,l),r.keywords&&(0,o.default)(t),t};function c(t,r,a,o){var n;for(let s of(null!=(n=t.opts.code).formats||(n.formats=(0,i._)`require("ajv-formats/dist/formats").${o}`),r))t.addFormat(s,a[s])}l.get=(t,r="full")=>{let o=("fast"===r?a.fastFormats:a.fullFormats)[t];if(!o)throw Error(`Unknown format "${t}"`);return o},r.exports=t=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l}),u1=ub(),u2=uL(),u9=uX();((t,r,a,o)=>{if(r&&"object"==typeof r||"function"==typeof r)for(var i,n=et(r),s=0,l=n.length;s<l;s++)i=n[s],ea.call(t,i)||i===a||Q(t,i,{get:(t=>r[t]).bind(null,i),enumerable:!(o=ee(r,i))||o.enumerable});return t})(Q(null!=(S=u0())?Y(er(S)):{},"default",{value:S,enumerable:!0}),S).default;u1.Ajv;let u4=require("node:process"),u5=Symbol.for("mcp.completable");function u6(t,r){return Object.defineProperty(t,u5,{value:{complete:r},enumerable:!1,writable:!1,configurable:!1}),t}function u3(t){let r="";for(let a of t)r+=String.fromCodePoint(a);return btoa(r).replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}function u8(t){let r=atob(t.replaceAll("-","+").replaceAll("_","/")),a=new Uint8Array(r.length);for(let t=0;t<r.length;t++)a[t]=r.codePointAt(t);return a}function u7(t){let r,a=globalThis.crypto?.subtle;if(void 0===a)throw TypeError("createRequestStateCodec requires the Web Crypto API (globalThis.crypto.subtle); see https://ts.sdk.modelcontextprotocol.io/v2/troubleshooting for the Node.js polyfill instructions");let o="string"==typeof t.key?new TextEncoder().encode(t.key):Uint8Array.from(t.key);if(o.byteLength<32)throw RangeError(`createRequestStateCodec: key must be at least 32 bytes (got ${o.byteLength})`);let i=t.ttlSeconds??600;if(!Number.isFinite(i))throw RangeError("createRequestStateCodec: ttlSeconds must be a finite number");let n=t.bind,s=()=>r??=a.importKey("raw",o,{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]),l=new TextEncoder,c=async t=>u3(new Uint8Array(await a.sign("HMAC",await s(),l.encode("mcp.requestState.bind:"+t))).slice(0,16));return{async mint(t,r){let o={p:t,exp:Math.floor(Date.now()/1e3)+i};if(void 0!==n){if(void 0===r)throw TypeError("createRequestStateCodec: mint() requires ctx when a bind callback is configured");o.b=await c(n(r))}let u=u3(l.encode(JSON.stringify(o)));return`v1.${u}.${u3(new Uint8Array(await a.sign("HMAC",await s(),l.encode("v1."+u))))}`},async verify(t,r){let o,i,u=t.lastIndexOf(".");if(!t.startsWith("v1.")||u<=3)throw Error("malformed");let d=t.slice(3,u);try{o=u8(t.slice(u+1))}catch{throw Error("malformed")}if(!await a.verify("HMAC",await s(),o,l.encode("v1."+d)))throw Error("mac");try{i=JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(u8(d)))}catch{throw Error("malformed")}if("number"!=typeof i.exp||i.exp<Math.floor(Date.now()/1e3))throw Error("expired");if(void 0!==n){let t=await c(n(r));if(void 0===i.b||!function(t,r){if(t.length!==r.length)return!1;let a=0;for(let o=0;o<t.length;o++)a|=t.codePointAt(o)^r.codePointAt(o);return 0===a}(i.b,t))throw Error("bind")}else if(void 0!==i.b)throw Error("bind");return i.p}}}var de=Object.create,dt=Object.defineProperty,dr=Object.getOwnPropertyDescriptor,da=Object.getOwnPropertyNames,di=Object.getPrototypeOf,dn=Object.prototype.hasOwnProperty,ds=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports),dl=(t,r,a)=>(a=null!=t?de(di(t)):{},((t,r,a,o)=>{if(r&&"object"==typeof r||"function"==typeof r)for(var i,n=da(r),s=0,l=n.length;s<l;s++)i=n[s],dn.call(t,i)||i===a||dt(t,i,{get:(t=>r[t]).bind(null,i),enumerable:!(o=dr(r,i))||o.enumerable});return t})(!r&&t&&t.__esModule?a:dt(a,"default",{value:t,enumerable:!0}),t));let dc=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),du=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),dd=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),dp=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]),dh="2025-11-25",df=[dh,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],dm="io.modelcontextprotocol/protocolVersion",dy="io.modelcontextprotocol/clientInfo",dg="io.modelcontextprotocol/serverInfo",dv="io.modelcontextprotocol/clientCapabilities",db="io.modelcontextprotocol/subscriptionId",d_="io.modelcontextprotocol/logLevel",dS=iZ(()=>i$([oU(),ia(),il(),iu(),iT(oU(),dS),iv(dS)])),dw=iT(oU(),dS),d$=iv(dS),dE=i$([oU(),ia().int()]),dP=oU(),dR=i_({ttl:ia().optional()}),dk=i_({taskId:oU()}),dx=iS({progressToken:dE.optional(),"io.modelcontextprotocol/related-task":dk.optional()}),dT=i_({_meta:dx.optional()}),dO=dT.extend({task:dR.optional()}),dj=i_({method:oU(),params:dT.loose().optional()}),dC=i_({_meta:dx.optional()}),dA=i_({method:oU(),params:dC.loose().optional()}),dI=iS({get[dg](){return dG.optional().catch(void 0)}}),dN=iS({_meta:dI.optional()}),dM=i$([oU(),ia().int()]),dq=i_({jsonrpc:iA("2.0"),id:dM,...dj.shape}).strict(),dz=i_({jsonrpc:iA("2.0"),...dA.shape}).strict(),dD=i_({jsonrpc:iA("2.0"),id:dM,result:dN}).strict(),dL=i_({jsonrpc:iA("2.0"),id:dM.optional(),error:i_({code:ia().int(),message:oU(),data:im().optional()})}).strict(),dU=i$([dq,dz,dD,dL]),dH=i$([dD,dL]),dV=dN.strict(),dK=dC.extend({requestId:dM.optional(),reason:oU().optional()}),dF=dA.extend({method:iA("notifications/cancelled"),params:dK}),dJ=i_({src:oU(),mimeType:oU().optional(),sizes:iv(oU()).optional(),theme:ij(["light","dark"]).optional()}),dW=i_({icons:iv(dJ).optional()}),dB=i_({name:oU(),title:oU().optional()}),dG=dB.extend({...dB.shape,...dW.shape,version:oU(),websiteUrl:oU().optional(),description:oU().optional()}),dZ=ik(i_({applyDefaults:il().optional()}),dw),dX=iY(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,ik(i_({form:dZ.optional(),url:dw.optional()}),dw.optional())),dY=iS({list:dw.optional(),cancel:dw.optional(),requests:iS({sampling:iS({createMessage:dw.optional()}).optional(),elicitation:iS({create:dw.optional()}).optional()}).optional()}),dQ=iS({list:dw.optional(),cancel:dw.optional(),requests:iS({tools:iS({call:dw.optional()}).optional()}).optional()}),d0=i_({experimental:iT(oU(),dw).optional(),sampling:i_({context:dw.optional(),tools:dw.optional()}).optional(),elicitation:dX.optional(),roots:i_({listChanged:il().optional()}).optional(),tasks:dY.optional(),extensions:iT(oU(),dw).optional()}),d1=dT.extend({protocolVersion:oU(),capabilities:d0,clientInfo:dG}),d2=dj.extend({method:iA("initialize"),params:d1}),d9=i_({experimental:iT(oU(),dw).optional(),logging:dw.optional(),completions:dw.optional(),prompts:i_({listChanged:il().optional()}).optional(),resources:i_({subscribe:il().optional(),listChanged:il().optional()}).optional(),tools:i_({listChanged:il().optional()}).optional(),tasks:dQ.optional(),extensions:iT(oU(),dw).optional()}),d4=dN.extend({protocolVersion:oU(),capabilities:d9,serverInfo:dG,instructions:oU().optional()}),d5=dA.extend({method:iA("notifications/initialized"),params:dC.optional()}),d6=dj.extend({method:iA("server/discover"),params:dT.optional()}),d3=dN.extend({supportedVersions:iv(oU()),capabilities:d9,instructions:oU().optional()}),d8=dj.extend({method:iA("ping"),params:dT.optional()}),d7=i_({progress:ia(),total:iq(ia()),message:iq(oU())}),pe=i_({...dC.shape,...d7.shape,progressToken:dE}),pt=dA.extend({method:iA("notifications/progress"),params:pe}),pr=dT.extend({cursor:dP.optional()}),pa=dj.extend({params:pr.optional()}),po=dN.extend({nextCursor:dP.optional()}),pi=i_({uri:oU(),mimeType:iq(oU()),_meta:iT(oU(),im()).optional()}),pn=pi.extend({text:oU()}),ps=oU().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),pl=pi.extend({blob:ps}),pc=ij(["user","assistant"]),pu=i_({audience:iv(pc).optional(),priority:ia().min(0).max(1).optional(),lastModified:iQ({offset:!0}).optional()}),pd=i_({...dB.shape,...dW.shape,uri:oU(),description:iq(oU()),mimeType:iq(oU()),size:iq(ia()),annotations:pu.optional(),_meta:iq(iS({}))}),pp=i_({...dB.shape,...dW.shape,uriTemplate:oU(),description:iq(oU()),mimeType:iq(oU()),annotations:pu.optional(),_meta:iq(iS({}))}),ph=pa.extend({method:iA("resources/list")}),pf=po.extend({resources:iv(pd)}),pm=pa.extend({method:iA("resources/templates/list")}),py=po.extend({resourceTemplates:iv(pp)}),pg=dT.extend({uri:oU()}),pv=dj.extend({method:iA("resources/read"),params:pg}),pb=dN.extend({contents:iv(i$([pn,pl]))}),p_=dA.extend({method:iA("notifications/resources/list_changed"),params:dC.optional()}),pS=dj.extend({method:iA("resources/subscribe"),params:pg}),pw=dj.extend({method:iA("resources/unsubscribe"),params:pg}),p$=i_({toolsListChanged:il().optional(),promptsListChanged:il().optional(),resourcesListChanged:il().optional(),resourceSubscriptions:iv(oU()).optional()}),pE=dT.extend({notifications:p$}),pP=dj.extend({method:iA("subscriptions/listen"),params:pE}),pR=dC.extend({notifications:p$}),pk=dA.extend({method:iA("notifications/subscriptions/acknowledged"),params:pR}),px=dI.extend({[db]:dM}),pT=dN.extend({_meta:px}),pO=dC.extend({uri:oU()}),pj=dA.extend({method:iA("notifications/resources/updated"),params:pO}),pC=i_({name:oU(),description:iq(oU()),required:iq(il())}),pA=i_({...dB.shape,...dW.shape,description:iq(oU()),arguments:iq(iv(pC)),_meta:iq(iS({}))}),pI=pa.extend({method:iA("prompts/list")}),pN=po.extend({prompts:iv(pA)}),pM=dT.extend({name:oU(),arguments:iT(oU(),oU()).optional()}),pq=dj.extend({method:iA("prompts/get"),params:pM}),pz=i_({type:iA("text"),text:oU(),annotations:pu.optional(),_meta:iT(oU(),im()).optional()}),pD=i_({type:iA("image"),data:ps,mimeType:oU(),annotations:pu.optional(),_meta:iT(oU(),im()).optional()}),pL=i_({type:iA("audio"),data:ps,mimeType:oU(),annotations:pu.optional(),_meta:iT(oU(),im()).optional()}),pU=i_({type:iA("tool_use"),name:oU(),id:oU(),input:iT(oU(),im()),_meta:iT(oU(),im()).optional()}),pH=i_({type:iA("resource"),resource:i$([pn,pl]),annotations:pu.optional(),_meta:iT(oU(),im()).optional()}),pV=pd.extend({type:iA("resource_link")}),pK=i$([pz,pD,pL,pV,pH]),pF=i_({role:pc,content:pK}),pJ=dN.extend({description:oU().optional(),messages:iv(pF)}),pW=dA.extend({method:iA("notifications/prompts/list_changed"),params:dC.optional()}),pB=i_({title:oU().optional(),readOnlyHint:il().optional(),destructiveHint:il().optional(),idempotentHint:il().optional(),openWorldHint:il().optional()}),pG=i_({taskSupport:ij(["required","optional","forbidden"]).optional()}),pZ=i_({...dB.shape,...dW.shape,description:oU().optional(),inputSchema:i_({type:iA("object"),properties:iT(oU(),dS).optional(),required:iv(oU()).optional()}).catchall(im()),outputSchema:iS({$schema:oU().optional()}).optional(),annotations:pB.optional(),execution:pG.optional(),_meta:iT(oU(),im()).optional()}),pX=pa.extend({method:iA("tools/list")}),pY=po.extend({tools:iv(pZ)}),pQ=dN.extend({content:iv(pK).default([]),structuredContent:im().optional(),isError:il().optional()}),p0=pQ.or(dN.extend({toolResult:im()})),p1=dO.extend({name:oU(),arguments:iT(oU(),im()).optional()}),p2=dj.extend({method:iA("tools/call"),params:p1}),p9=dA.extend({method:iA("notifications/tools/list_changed"),params:dC.optional()}),p4=i_({autoRefresh:il().default(!0),debounceMs:ia().int().nonnegative().default(300)}),p5=ij(["debug","info","notice","warning","error","critical","alert","emergency"]),p6=dT.extend({level:p5}),p3=dj.extend({method:iA("logging/setLevel"),params:p6}),p8=dC.extend({level:p5,logger:oU().optional(),data:im()}),p7=dA.extend({method:iA("notifications/message"),params:p8}),he=i_({name:oU().optional()}),ht=i_({hints:iv(he).optional(),costPriority:ia().min(0).max(1).optional(),speedPriority:ia().min(0).max(1).optional(),intelligencePriority:ia().min(0).max(1).optional()}),hr=i_({mode:ij(["auto","required","none"]).optional()}),ha=i_({type:iA("tool_result"),toolUseId:oU().describe("The unique identifier for the corresponding tool call."),content:iv(pK),structuredContent:im().optional(),isError:il().optional(),_meta:iT(oU(),im()).optional()}),ho=iP("type",[pz,pD,pL]),hi=iP("type",[pz,pD,pL,pU,ha]),hn=i_({role:pc,content:i$([hi,iv(hi)]),_meta:iT(oU(),im()).optional()}),hs=dO.extend({messages:iv(hn),modelPreferences:ht.optional(),systemPrompt:oU().optional(),includeContext:ij(["none","thisServer","allServers"]).optional(),temperature:ia().optional(),maxTokens:ia().int(),stopSequences:iv(oU()).optional(),metadata:dw.optional(),tools:iv(pZ).optional(),toolChoice:hr.optional()}),hl=dj.extend({method:iA("sampling/createMessage"),params:hs}),hc=dN.extend({model:oU(),stopReason:iq(ij(["endTurn","stopSequence","maxTokens"]).or(oU())),role:pc,content:ho}),hu=dN.extend({model:oU(),stopReason:iq(ij(["endTurn","stopSequence","maxTokens","toolUse"]).or(oU())),role:pc,content:i$([hi,iv(hi)])}),hd=i_({type:iA("boolean"),title:oU().optional(),description:oU().optional(),default:il().optional()}),hp=i_({type:iA("string"),title:oU().optional(),description:oU().optional(),minLength:ia().optional(),maxLength:ia().optional(),format:ij(["email","uri","date","date-time"]).optional(),default:oU().optional()}),hh=i_({type:ij(["number","integer"]),title:oU().optional(),description:oU().optional(),minimum:ia().optional(),maximum:ia().optional(),default:ia().optional()}),hf=i_({type:iA("string"),title:oU().optional(),description:oU().optional(),enum:iv(oU()),default:oU().optional()}),hm=i_({type:iA("string"),title:oU().optional(),description:oU().optional(),oneOf:iv(i_({const:oU(),title:oU()})),default:oU().optional()}),hy=i_({type:iA("string"),title:oU().optional(),description:oU().optional(),enum:iv(oU()),enumNames:iv(oU()).optional(),default:oU().optional()}),hg=i$([hf,hm]),hv=i_({type:iA("array"),title:oU().optional(),description:oU().optional(),minItems:ia().optional(),maxItems:ia().optional(),items:i_({type:iA("string"),enum:iv(oU())}),default:iv(oU()).optional()}),hb=i_({type:iA("array"),title:oU().optional(),description:oU().optional(),minItems:ia().optional(),maxItems:ia().optional(),items:i_({anyOf:iv(i_({const:oU(),title:oU()}))}),default:iv(oU()).optional()}),h_=i$([hv,hb]),hS=i$([hy,hg,h_]),hw=i$([hS,hd,hp,hh]),h$=dO.extend({mode:iA("form").optional(),message:oU(),requestedSchema:i_({type:iA("object"),properties:iT(oU(),hw),required:iv(oU()).optional()}).catchall(im())}),hE=dO.extend({mode:iA("url"),message:oU(),elicitationId:oU(),url:oU().url()}),hP=i$([h$,hE]),hR=dj.extend({method:iA("elicitation/create"),params:hP}),hk=dC.extend({elicitationId:oU()}),hx=dA.extend({method:iA("notifications/elicitation/complete"),params:hk}),hT=dN.extend({action:ij(["accept","decline","cancel"]),content:iY(t=>null===t?void 0:t,iT(oU(),i$([oU(),ia(),il(),iv(oU())])).optional())}),hO=i_({type:iA("ref/resource"),uri:oU()}),hj=i_({type:iA("ref/prompt"),name:oU()}),hC=dT.extend({ref:i$([hj,hO]),argument:i_({name:oU(),value:oU()}),context:i_({arguments:iT(oU(),oU()).optional()}).optional()}),hA=dj.extend({method:iA("completion/complete"),params:hC}),hI=dN.extend({completion:iS({values:iv(oU()).max(100),total:iq(ia().int()),hasMore:iq(il())})}),hN=i_({uri:oU().startsWith("file://"),name:oU().optional(),_meta:iT(oU(),im()).optional()}),hM=dj.extend({method:iA("roots/list"),params:dT.optional()}),hq=dN.extend({roots:iv(hN)}),hz=dA.extend({method:iA("notifications/roots/list_changed"),params:dC.optional()}),hD=iS({ttl:ia().optional(),pollInterval:ia().optional()}),hL=ij(["working","input_required","completed","failed","cancelled"]),hU=i_({taskId:oU(),status:hL,ttl:i$([ia(),iu()]),createdAt:oU(),lastUpdatedAt:oU(),pollInterval:iq(ia()),statusMessage:iq(oU())}),hH=dN.extend({task:hU}),hV=dC.merge(hU),hK=dA.extend({method:iA("notifications/tasks/status"),params:hV}),hF=dj.extend({method:iA("tasks/get"),params:dT.extend({taskId:oU()})}),hJ=dN.merge(hU),hW=dj.extend({method:iA("tasks/result"),params:dT.extend({taskId:oU()})}),hB=dN.loose(),hG=pa.extend({method:iA("tasks/list")}),hZ=po.extend({tasks:iv(hU)}),hX=dj.extend({method:iA("tasks/cancel"),params:dT.extend({taskId:oU()})}),hY=dN.merge(hU),hQ=i$([d8,d2,d6,hA,p3,pq,pI,ph,pm,pv,pS,pw,pP,p2,pX]),h0=i$([dF,pt,d5,hz]),h1=i$([dV,hc,hu,hT,hq]),h2=i$([d8,hl,hR,hM]),h9=i$([dF,pt,p7,pj,p_,p9,pW,pk,hx]),h4=i$([dV,d4,d3,hI,pJ,pN,pf,py,pb,pQ,pY,pT]),h5=ar(oZ,void 0).superRefine((t,r)=>{if(!URL.canParse(t))return r.addIssue({code:i0,message:"URL must be parseable",fatal:!0}),eB}).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"}),h6=iS({resource:oU().url(),authorization_servers:iv(h5).optional(),jwks_uri:oU().url().optional(),scopes_supported:iv(oU()).optional(),bearer_methods_supported:iv(oU()).optional(),resource_signing_alg_values_supported:iv(oU()).optional(),resource_name:oU().optional(),resource_documentation:oU().optional(),resource_policy_uri:oU().url().optional(),resource_tos_uri:oU().url().optional(),tls_client_certificate_bound_access_tokens:il().optional(),authorization_details_types_supported:iv(oU()).optional(),dpop_signing_alg_values_supported:iv(oU()).optional(),dpop_bound_access_tokens_required:il().optional()}),h3=iS({issuer:oU(),authorization_endpoint:h5,token_endpoint:h5,registration_endpoint:h5.optional(),scopes_supported:iv(oU()).optional(),response_types_supported:iv(oU()),response_modes_supported:iv(oU()).optional(),grant_types_supported:iv(oU()).optional(),token_endpoint_auth_methods_supported:iv(oU()).optional(),token_endpoint_auth_signing_alg_values_supported:iv(oU()).optional(),service_documentation:h5.optional(),revocation_endpoint:h5.optional(),revocation_endpoint_auth_methods_supported:iv(oU()).optional(),revocation_endpoint_auth_signing_alg_values_supported:iv(oU()).optional(),introspection_endpoint:oU().optional(),introspection_endpoint_auth_methods_supported:iv(oU()).optional(),introspection_endpoint_auth_signing_alg_values_supported:iv(oU()).optional(),code_challenge_methods_supported:iv(oU()).optional(),client_id_metadata_document_supported:il().optional(),authorization_response_iss_parameter_supported:il().optional().catch(void 0),dpop_signing_alg_values_supported:iv(oU()).optional()}),h8=iS({issuer:oU(),authorization_endpoint:h5,token_endpoint:h5,userinfo_endpoint:h5.optional(),jwks_uri:h5,registration_endpoint:h5.optional(),scopes_supported:iv(oU()).optional(),response_types_supported:iv(oU()),response_modes_supported:iv(oU()).optional(),grant_types_supported:iv(oU()).optional(),acr_values_supported:iv(oU()).optional(),subject_types_supported:iv(oU()),id_token_signing_alg_values_supported:iv(oU()),id_token_encryption_alg_values_supported:iv(oU()).optional(),id_token_encryption_enc_values_supported:iv(oU()).optional(),userinfo_signing_alg_values_supported:iv(oU()).optional(),userinfo_encryption_alg_values_supported:iv(oU()).optional(),userinfo_encryption_enc_values_supported:iv(oU()).optional(),request_object_signing_alg_values_supported:iv(oU()).optional(),request_object_encryption_alg_values_supported:iv(oU()).optional(),request_object_encryption_enc_values_supported:iv(oU()).optional(),token_endpoint_auth_methods_supported:iv(oU()).optional(),token_endpoint_auth_signing_alg_values_supported:iv(oU()).optional(),display_values_supported:iv(oU()).optional(),claim_types_supported:iv(oU()).optional(),claims_supported:iv(oU()).optional(),service_documentation:oU().optional(),claims_locales_supported:iv(oU()).optional(),ui_locales_supported:iv(oU()).optional(),claims_parameter_supported:il().optional(),request_parameter_supported:il().optional(),request_uri_parameter_supported:il().optional(),require_request_uri_registration:il().optional(),op_policy_uri:h5.optional(),op_tos_uri:h5.optional(),client_id_metadata_document_supported:il().optional(),authorization_response_iss_parameter_supported:il().optional().catch(void 0)}),h7=i_({...h8.shape,...h3.pick({code_challenge_methods_supported:!0}).shape}),fe=i_({access_token:oU(),id_token:oU().optional(),token_type:oU(),expires_in:i1().optional(),scope:oU().optional(),refresh_token:oU().optional(),issuer:oU().optional().catch(void 0)}).strip(),ft=i_({issued_token_type:iA("urn:ietf:params:oauth:token-type:id-jag"),access_token:oU(),token_type:oU().optional(),expires_in:ia().optional(),scope:oU().optional()}).strip(),fr=i_({error:oU(),error_description:oU().optional(),error_uri:oU().optional()}),fa=h5.optional().or(iA("").transform(()=>void 0)),fo=i_({redirect_uris:iv(h5),token_endpoint_auth_method:oU().optional(),grant_types:iv(oU()).optional(),response_types:iv(oU()).optional(),application_type:oU().optional(),client_name:oU().optional(),client_uri:h5.optional(),logo_uri:fa,scope:oU().optional(),contacts:iv(oU()).optional(),tos_uri:fa,policy_uri:oU().optional(),jwks_uri:h5.optional(),jwks:ip().optional(),software_id:oU().optional(),software_version:oU().optional(),software_statement:oU().optional()}).strip(),fi=i_({client_id:oU(),client_secret:oU().optional(),client_id_issued_at:ia().optional(),client_secret_expires_at:ia().optional(),issuer:oU().optional().catch(void 0)}).strip(),fn=fo.merge(fi),fs=i_({error:oU(),error_description:oU().optional()}).strip(),fl=i_({token:oU(),token_type_hint:oU().optional()}).strip(),fc=Symbol.for("mcp.sdk.errorBrands");function fu(t,r){let a=new Set,o=r;for(;"function"==typeof o;){let t=o.mcpBrand;Object.prototype.hasOwnProperty.call(o,"mcpBrand")&&"string"==typeof t&&a.add(t),o=Object.getPrototypeOf(o)}0!==a.size&&Object.defineProperty(t,fc,{value:a,enumerable:!1,configurable:!0})}function fd(t,r){try{if("object"==typeof r&&null!==r&&Object.prototype.hasOwnProperty.call(t,"mcpBrand")&&"string"==typeof t.mcpBrand&&Object.prototype.hasOwnProperty.call(r,fc)){let a=r[fc];if(a&&"function"==typeof a.has&&a.has(t.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(t,r)}let fp=((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.InvalidDpopProof="invalid_dpop_proof",P.UseDpopNonce="use_dpop_nonce",P);var fh=class t extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return fd(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 fd(this,t)}constructor(t,r,a){super(r),this.code=t,this.errorUri=a,this.name="OAuthError",fu(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 ff=((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 fm=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](t){return fd(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 fd(this,t)}constructor(t,r,a,o){super(r,o),this.code=t,this.data=a,this.name="SdkError",fu(this,new.target)}},fy=class extends fm{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(t,r,a,o){super(t,r,a,o),this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};function fg(t){if("object"!=typeof t||null===t||Array.isArray(t))return t;let r={...t};return delete r.issuer,r}let fv="2026-07-28",fb=[fv];function f_(t){return t.filter(t=>!(t>=fv))}function fS(t){return t.filter(t=>t>=fv)}function fw(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 f$=["task","inputRequests","requestState"];function fE(t){return null===t||"object"!=typeof t||Array.isArray(t)||void 0!==t.content||f$.some(r=>r in t)?t:{...t,content:[]}}function fP(){let t,r,a,o,n,s,l,c,u,d,p,h,f,m,y,g,v,b,_,S,w,$,E,P,R,k,x,T,O,j,C,A,I,N,M,q,z,D,L,U,H,V,K,F,J,W,B,G,Z,X,Y,Q,ee,et,er,ea,eo,ei,en,es,el,ec,eu,ed,ep,eh,ef,em,ey,eg,ev,eb,e_,eS,ew,e$,eE,eP,eR,ek,ex,eT,eO,ej,eC,eA,eI,eN,eM,eq,ez,eD,eL,eU,eH,eV,eK,eF,eJ,eW,eB,eG,eZ,eX,eY,eQ,e0,e1,e2,e9,e4,e5,e6,e3,e8,e7,te,tt,tr,ta,to,ti,tn,ts,tl,tc,tu,td,tp,th,tf,tm,ty,tg,tv,tb,t_,tS,tw,t$;return i??=(t=iZ(()=>i$([oU(),ia(),il(),iu(),iT(oU(),t),iv(t)])),r=iT(oU(),t),a=i$([oU(),ia().int()]),o=oU(),n=i_({ttl:ia().optional()}),s=i_({taskId:oU()}),u=(c=i_({_meta:(l=iS({progressToken:a.optional(),"io.modelcontextprotocol/related-task":s.optional()})).optional()})).extend({task:n.optional()}),d=i_({method:oU(),params:c.loose().optional()}),p=i_({_meta:l.optional()}),h=i_({method:oU(),params:p.loose().optional()}),f=iS({_meta:l.optional()}),m=i$([oU(),ia().int()]),y=f.strict(),g=p.extend({requestId:m.optional(),reason:oU().optional()}),v=h.extend({method:iA("notifications/cancelled"),params:g}),b=i_({src:oU(),mimeType:oU().optional(),sizes:iv(oU()).optional(),theme:ij(["light","dark"]).optional()}),_=i_({icons:iv(b).optional()}),w=(S=i_({name:oU(),title:oU().optional()})).extend({...S.shape,..._.shape,version:oU(),websiteUrl:oU().optional(),description:oU().optional()}),$=ik(i_({applyDefaults:il().optional()}),r),E=iY(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,ik(i_({form:$.optional(),url:r.optional()}),r.optional())),P=iS({list:r.optional(),cancel:r.optional(),requests:iS({sampling:iS({createMessage:r.optional()}).optional(),elicitation:iS({create:r.optional()}).optional()}).optional()}),R=iS({list:r.optional(),cancel:r.optional(),requests:iS({tools:iS({call:r.optional()}).optional()}).optional()}),k=i_({experimental:iT(oU(),r).optional(),sampling:i_({context:r.optional(),tools:r.optional()}).optional(),elicitation:E.optional(),roots:i_({listChanged:il().optional()}).optional(),tasks:P.optional(),extensions:iT(oU(),r).optional()}),x=c.extend({protocolVersion:oU(),capabilities:k,clientInfo:w}),T=d.extend({method:iA("initialize"),params:x}),O=i_({experimental:iT(oU(),r).optional(),logging:r.optional(),completions:r.optional(),prompts:i_({listChanged:il().optional()}).optional(),resources:i_({subscribe:il().optional(),listChanged:il().optional()}).optional(),tools:i_({listChanged:il().optional()}).optional(),tasks:R.optional(),extensions:iT(oU(),r).optional()}),j=f.extend({protocolVersion:oU(),capabilities:O,serverInfo:w,instructions:oU().optional()}),C=h.extend({method:iA("notifications/initialized"),params:p.optional()}),A=d.extend({method:iA("ping"),params:c.optional()}),I=i_({progress:ia(),total:iq(ia()),message:iq(oU())}),N=i_({...p.shape,...I.shape,progressToken:a}),M=h.extend({method:iA("notifications/progress"),params:N}),q=c.extend({cursor:o.optional()}),z=d.extend({params:q.optional()}),D=f.extend({nextCursor:o.optional()}),U=(L=i_({uri:oU(),mimeType:iq(oU()),_meta:iT(oU(),im()).optional()})).extend({text:oU()}),H=oU().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),V=L.extend({blob:H}),F=i_({audience:iv(K=ij(["user","assistant"])).optional(),priority:ia().min(0).max(1).optional(),lastModified:iQ({offset:!0}).optional()}),J=i_({...S.shape,..._.shape,uri:oU(),description:iq(oU()),mimeType:iq(oU()),size:iq(ia()),annotations:F.optional(),_meta:iq(iS({}))}),W=i_({...S.shape,..._.shape,uriTemplate:oU(),description:iq(oU()),mimeType:iq(oU()),annotations:F.optional(),_meta:iq(iS({}))}),B=z.extend({method:iA("resources/list")}),G=D.extend({resources:iv(J)}),Z=z.extend({method:iA("resources/templates/list")}),X=D.extend({resourceTemplates:iv(W)}),Y=c.extend({uri:oU()}),Q=d.extend({method:iA("resources/read"),params:Y}),ee=f.extend({contents:iv(i$([U,V]))}),et=h.extend({method:iA("notifications/resources/list_changed"),params:p.optional()}),er=d.extend({method:iA("resources/subscribe"),params:Y}),ea=d.extend({method:iA("resources/unsubscribe"),params:Y}),eo=p.extend({uri:oU()}),ei=h.extend({method:iA("notifications/resources/updated"),params:eo}),en=i_({name:oU(),description:iq(oU()),required:iq(il())}),es=i_({...S.shape,..._.shape,description:iq(oU()),arguments:iq(iv(en)),_meta:iq(iS({}))}),el=z.extend({method:iA("prompts/list")}),ec=D.extend({prompts:iv(es)}),eu=c.extend({name:oU(),arguments:iT(oU(),oU()).optional()}),ed=d.extend({method:iA("prompts/get"),params:eu}),ep=i_({type:iA("text"),text:oU(),annotations:F.optional(),_meta:iT(oU(),im()).optional()}),eh=i_({type:iA("image"),data:H,mimeType:oU(),annotations:F.optional(),_meta:iT(oU(),im()).optional()}),ef=i_({type:iA("audio"),data:H,mimeType:oU(),annotations:F.optional(),_meta:iT(oU(),im()).optional()}),em=i_({type:iA("tool_use"),name:oU(),id:oU(),input:iT(oU(),im()),_meta:iT(oU(),im()).optional()}),ey=i_({type:iA("resource"),resource:i$([U,V]),annotations:F.optional(),_meta:iT(oU(),im()).optional()}),eb=i_({role:K,content:ev=i$([ep,eh,ef,eg=J.extend({type:iA("resource_link")}),ey])}),e_=f.extend({description:oU().optional(),messages:iv(eb)}),eS=h.extend({method:iA("notifications/prompts/list_changed"),params:p.optional()}),ew=i_({title:oU().optional(),readOnlyHint:il().optional(),destructiveHint:il().optional(),idempotentHint:il().optional(),openWorldHint:il().optional()}),e$=i_({taskSupport:ij(["required","optional","forbidden"]).optional()}),eE=i_({...S.shape,..._.shape,description:oU().optional(),inputSchema:i_({type:iA("object"),properties:iT(oU(),t).optional(),required:iv(oU()).optional()}).catchall(im()),outputSchema:i_({type:iA("object"),properties:iT(oU(),t).optional(),required:iv(oU()).optional()}).catchall(im()).optional(),annotations:ew.optional(),execution:e$.optional(),_meta:iT(oU(),im()).optional()}),eP=z.extend({method:iA("tools/list")}),eR=D.extend({tools:iv(eE)}),ek=f.extend({content:iv(ev),structuredContent:iT(oU(),im()).optional(),isError:il().optional()}),ex=u.extend({name:oU(),arguments:iT(oU(),im()).optional()}),eT=d.extend({method:iA("tools/call"),params:ex}),eO=h.extend({method:iA("notifications/tools/list_changed"),params:p.optional()}),ej=ij(["debug","info","notice","warning","error","critical","alert","emergency"]),eC=c.extend({level:ej}),eA=d.extend({method:iA("logging/setLevel"),params:eC}),eI=p.extend({level:ej,logger:oU().optional(),data:im()}),eN=h.extend({method:iA("notifications/message"),params:eI}),eM=i_({name:oU().optional()}),eq=i_({hints:iv(eM).optional(),costPriority:ia().min(0).max(1).optional(),speedPriority:ia().min(0).max(1).optional(),intelligencePriority:ia().min(0).max(1).optional()}),ez=i_({mode:ij(["auto","required","none"]).optional()}),eD=i_({type:iA("tool_result"),toolUseId:oU().describe("The unique identifier for the corresponding tool call."),content:iv(ev),structuredContent:i_({}).loose().optional(),isError:il().optional(),_meta:iT(oU(),im()).optional()}),eL=iP("type",[ep,eh,ef]),eH=i_({role:K,content:i$([eU=iP("type",[ep,eh,ef,em,eD]),iv(eU)]),_meta:iT(oU(),im()).optional()}),eV=u.extend({messages:iv(eH),modelPreferences:eq.optional(),systemPrompt:oU().optional(),includeContext:ij(["none","thisServer","allServers"]).optional(),temperature:ia().optional(),maxTokens:ia().int(),stopSequences:iv(oU()).optional(),metadata:r.optional(),tools:iv(eE).optional(),toolChoice:ez.optional()}),eK=d.extend({method:iA("sampling/createMessage"),params:eV}),eF=f.extend({model:oU(),stopReason:iq(ij(["endTurn","stopSequence","maxTokens"]).or(oU())),role:K,content:eL}),eJ=f.extend({model:oU(),stopReason:iq(ij(["endTurn","stopSequence","maxTokens","toolUse"]).or(oU())),role:K,content:i$([eU,iv(eU)])}),eW=i_({type:iA("boolean"),title:oU().optional(),description:oU().optional(),default:il().optional()}),eB=i_({type:iA("string"),title:oU().optional(),description:oU().optional(),minLength:ia().optional(),maxLength:ia().optional(),format:ij(["email","uri","date","date-time"]).optional(),default:oU().optional()}),eG=i_({type:ij(["number","integer"]),title:oU().optional(),description:oU().optional(),minimum:ia().optional(),maximum:ia().optional(),default:ia().optional()}),eZ=i_({type:iA("string"),title:oU().optional(),description:oU().optional(),enum:iv(oU()),default:oU().optional()}),eX=i_({type:iA("string"),title:oU().optional(),description:oU().optional(),oneOf:iv(i_({const:oU(),title:oU()})),default:oU().optional()}),eY=i_({type:iA("string"),title:oU().optional(),description:oU().optional(),enum:iv(oU()),enumNames:iv(oU()).optional(),default:oU().optional()}),eQ=i$([eZ,eX]),e0=i_({type:iA("array"),title:oU().optional(),description:oU().optional(),minItems:ia().optional(),maxItems:ia().optional(),items:i_({type:iA("string"),enum:iv(oU())}),default:iv(oU()).optional()}),e2=i$([e0,e1=i_({type:iA("array"),title:oU().optional(),description:oU().optional(),minItems:ia().optional(),maxItems:ia().optional(),items:i_({anyOf:iv(i_({const:oU(),title:oU()}))}),default:iv(oU()).optional()})]),e9=i$([eY,eQ,e2]),e4=i$([e9,eW,eB,eG]),e5=u.extend({mode:iA("form").optional(),message:oU(),requestedSchema:i_({type:iA("object"),properties:iT(oU(),e4),required:iv(oU()).optional()}).catchall(im())}),e3=i$([e5,e6=u.extend({mode:iA("url"),message:oU(),elicitationId:oU(),url:oU().url()})]),e8=d.extend({method:iA("elicitation/create"),params:e3}),e7=p.extend({elicitationId:oU()}),te=h.extend({method:iA("notifications/elicitation/complete"),params:e7}),tt=f.extend({action:ij(["accept","decline","cancel"]),content:iY(t=>null===t?void 0:t,iT(oU(),i$([oU(),ia(),il(),iv(oU())])).optional())}),tr=i_({type:iA("ref/resource"),uri:oU()}),ta=i_({type:iA("ref/prompt"),name:oU()}),to=c.extend({ref:i$([ta,tr]),argument:i_({name:oU(),value:oU()}),context:i_({arguments:iT(oU(),oU()).optional()}).optional()}),ti=d.extend({method:iA("completion/complete"),params:to}),tn=f.extend({completion:iS({values:iv(oU()).max(100),total:iq(ia().int()),hasMore:iq(il())})}),ts=i_({uri:oU().startsWith("file://"),name:oU().optional(),_meta:iT(oU(),im()).optional()}),tl=d.extend({method:iA("roots/list"),params:c.optional()}),tc=f.extend({roots:iv(ts)}),tu=h.extend({method:iA("notifications/roots/list_changed"),params:p.optional()}),td=iS({ttl:ia().optional(),pollInterval:ia().optional()}),tp=ij(["working","input_required","completed","failed","cancelled"]),th=i_({taskId:oU(),status:tp,ttl:i$([ia(),iu()]),createdAt:oU(),lastUpdatedAt:oU(),pollInterval:iq(ia()),statusMessage:iq(oU())}),tf=f.extend({task:th}),tm=p.merge(th),ty=h.extend({method:iA("notifications/tasks/status"),params:tm}),tg=d.extend({method:iA("tasks/get"),params:c.extend({taskId:oU()})}),tv=f.merge(th),tb=d.extend({method:iA("tasks/result"),params:c.extend({taskId:oU()})}),t_=f.loose(),tS=z.extend({method:iA("tasks/list")}),tw=D.extend({tasks:iv(th)}),t$=d.extend({method:iA("tasks/cancel"),params:c.extend({taskId:oU()})}),{JSONValueSchema:t,JSONObjectSchema:r,ProgressTokenSchema:a,CursorSchema:o,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:b,IconsSchema:_,BaseMetadataSchema:S,ImplementationSchema:w,ClientTasksCapabilitySchema:P,ServerTasksCapabilitySchema:R,ClientCapabilitiesSchema:k,InitializeRequestParamsSchema:x,InitializeRequestSchema:T,ServerCapabilitiesSchema:O,InitializeResultSchema:j,InitializedNotificationSchema:C,PingRequestSchema:A,ProgressSchema:I,ProgressNotificationParamsSchema:N,ProgressNotificationSchema:M,PaginatedRequestParamsSchema:q,PaginatedRequestSchema:z,PaginatedResultSchema:D,ResourceContentsSchema:L,TextResourceContentsSchema:U,BlobResourceContentsSchema:V,RoleSchema:K,AnnotationsSchema:F,ResourceSchema:J,ResourceTemplateSchema:W,ListResourcesRequestSchema:B,ListResourcesResultSchema:G,ListResourceTemplatesRequestSchema:Z,ListResourceTemplatesResultSchema:X,ResourceRequestParamsSchema:Y,ReadResourceRequestParamsSchema:Y,ReadResourceRequestSchema:Q,ReadResourceResultSchema:ee,ResourceListChangedNotificationSchema:et,SubscribeRequestParamsSchema:Y,SubscribeRequestSchema:er,UnsubscribeRequestParamsSchema:Y,UnsubscribeRequestSchema:ea,ResourceUpdatedNotificationParamsSchema:eo,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:eb,GetPromptResultSchema:e_,PromptListChangedNotificationSchema:eS,ToolAnnotationsSchema:ew,ToolExecutionSchema:e$,ToolSchema:eE,ListToolsRequestSchema:eP,ListToolsResultSchema:eR,CallToolResultSchema:ek,CallToolRequestParamsSchema:ex,CallToolRequestSchema:eT,ToolListChangedNotificationSchema:eO,LoggingLevelSchema:ej,SetLevelRequestParamsSchema:eC,SetLevelRequestSchema:eA,LoggingMessageNotificationParamsSchema:eI,LoggingMessageNotificationSchema:eN,ModelHintSchema:eM,ModelPreferencesSchema:eq,ToolChoiceSchema:ez,ToolResultContentSchema:eD,SamplingContentSchema:eL,SamplingMessageContentBlockSchema:eU,SamplingMessageSchema:eH,CreateMessageRequestParamsSchema:eV,CreateMessageRequestSchema:eK,CreateMessageResultSchema:eF,CreateMessageResultWithToolsSchema:eJ,BooleanSchemaSchema:eW,StringSchemaSchema:eB,NumberSchemaSchema:eG,UntitledSingleSelectEnumSchemaSchema:eZ,TitledSingleSelectEnumSchemaSchema:eX,LegacyTitledEnumSchemaSchema:eY,SingleSelectEnumSchemaSchema:eQ,UntitledMultiSelectEnumSchemaSchema:e0,TitledMultiSelectEnumSchemaSchema:e1,MultiSelectEnumSchemaSchema:e2,EnumSchemaSchema:e9,PrimitiveSchemaDefinitionSchema:e4,ElicitRequestFormParamsSchema:e5,ElicitRequestURLParamsSchema:e6,ElicitRequestParamsSchema:e3,ElicitRequestSchema:e8,ElicitationCompleteNotificationParamsSchema:e7,ElicitationCompleteNotificationSchema:te,ElicitResultSchema:tt,ResourceTemplateReferenceSchema:tr,PromptReferenceSchema:ta,CompleteRequestParamsSchema:to,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:tb,GetTaskPayloadResultSchema:t_,ListTasksRequestSchema:tS,ListTasksResultSchema:tw,CancelTaskRequestSchema:t$,CancelTaskResultSchema:f.merge(th),ClientRequestSchema:i$([A,T,ti,eA,ed,el,B,Z,Q,er,ea,eT,eP,tg,tb,tS,t$]),ClientNotificationSchema:i$([v,M,C,tu,ty]),ClientResultSchema:i$([y,eF,eJ,tt,tc,tv,tw,tf]),ServerRequestSchema:i$([A,eK,e8,tl,tg,tb,tS,t$]),ServerNotificationSchema:i$([v,M,eN,ei,et,eO,eS,ty,te]),ServerResultSchema:i$([y,j,tn,e_,ec,G,X,ee,ek,eR,tv,tw,tf]),CallToolResultWireSchema:im().superRefine((t,r)=>{if(!("object"!=typeof t||null===t||Array.isArray(t))&&void 0===t.content){for(let a of f$)if(a in t)return void r.addIssue({code:"custom",message:`content is required when the body carries '${a}' — another result family cannot default into an empty tools/call success`})}}).transform(fE).pipe(ek)})}function fR(t){return"object"!==t.type}let fk=new Set(["const","enum","default","examples"]),fx=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function fT(t){return void 0!==t&&!("string"==typeof t&&t.startsWith("#"))}let fO={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},fj={"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},fC={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 fA(){if(l)return l;let t=fP();return l={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 fI(t){return Object.prototype.hasOwnProperty.call(fO,t)}function fN(t){return Object.prototype.hasOwnProperty.call(fj,t)}function fM(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function fq(t,r){if(void 0===t)return{ok:!1,reason:"not-in-era"};let a=t.safeParse(r);return a.success?{ok:!0,value:a.data}:{ok:!1,reason:"invalid",message:String(a.error)}}Object.keys(fO),Object.keys(fj);let fz={ok:!1,reason:"not-in-era"};function fD(t){return fM(t)&&fM(t.outputSchema)&&fR(t.outputSchema)}let fL={era:"2025-11-25",hasRequestMethod:fI,hasNotificationMethod:fN,validateRequest:(t,r)=>fq(fI(t)?fA().requestSchemas[t]:void 0,r),validateResult:(t,r)=>fq(Object.prototype.hasOwnProperty.call(fC,t)?fA().resultSchemas[t]:void 0,r),validateNotification:(t,r)=>fq(fN(t)?fA().notificationSchemas[t]:void 0,r),hasInputRequestMethod:()=>!1,validateInputRequest:()=>fz,validateInputResponse:()=>fz,samplingResultVariant:(t,r)=>{let a=fP();return fq(t?a.CreateMessageResultWithToolsSchema:a.CreateMessageResultSchema,r)},outboundEnvelope:t=>void 0,validateEnvelopeMeta:t=>[],projectCallToolResult(t,r){let a=fw(t),o=a.structuredContent;if(void 0===o)return a;let i="object"!=typeof o||null===o||Array.isArray(o),n=void 0!==r&&fR(r);return i||n?{...a,structuredContent:{result:o}}:a},decodeResult(t,r){if(fM(r)&&"resultType"in r){let t={...r};return delete t.resultType,{kind:"complete",result:t}}return{kind:"complete",result:r}},encodeResult(t,r){if("tools/list"!==t)return r;let a=r.tools;return Array.isArray(a)&&a.some(t=>fD(t))?{...r,tools:a.map(t=>fD(t)?{...t,outputSchema:function(t){var r;let a="string"==typeof t.$schema?t.$schema:void 0;if(fT(t.$id))return{...void 0!==a&&{$schema:a},type:"object",properties:{result:t},required:["result"]};let o="string"==typeof(r=t.$schema)&&du.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&&fT(t.$id))return t;let a={},n=!1;for(let[s,l]of Object.entries(t))r?a[s]=i(l,!1):("$ref"===s||"$dynamicRef"===s)&&"string"==typeof l?a[s]="#"===l?"#/properties/result":l.startsWith("#/")?`#/properties/result${l.slice(1)}`:l:"$recursiveRef"===s&&"#"===l&&o?n=!0:fk.has(s)?a[s]=l:fx.has(s)?a[s]=i(l,!0):a[s]=i(l,!1);return n&&("$ref"in a?a.allOf=[...Array.isArray(a.allOf)?a.allOf:[],{$ref:"#/properties/result"}]:a.$ref="#/properties/result"),a};return{...void 0!==a&&{$schema:a},type:"object",properties:{result:i(t,!1)},required:["result"]}}(t.outputSchema)}:t)}:r},encodeErrorCode:t=>-32002===t?-32602:t,checkInboundEnvelope:t=>void 0};function fU(){return c??=function(){let t=iZ(()=>i$([oU(),ia(),il(),iu(),iT(oU(),t),iv(t)])),r=iT(oU(),t),a=i$([oU(),ia().int()]),o=oU(),i=i$([oU(),ia().int()]),n=ij(["user","assistant"]),s=ij(["debug","info","notice","warning","error","critical","alert","emergency"]),l=oU().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),c=i_({ttl:ia().optional()}),u=i_({taskId:oU()}),d=iS({progressToken:a.optional(),"io.modelcontextprotocol/related-task":u.optional()}),p=i_({_meta:d.optional()}),h=p.extend({task:c.optional()}),f=i_({_meta:d.optional()}),m=i_({method:oU(),params:f.loose().optional()}),y=i_({src:oU(),mimeType:oU().optional(),sizes:iv(oU()).optional(),theme:ij(["light","dark"]).optional()}),g=i_({icons:iv(y).optional()}),v=i_({name:oU(),title:oU().optional()}),b=v.extend({...v.shape,...g.shape,version:oU(),websiteUrl:oU().optional(),description:oU().optional()}),_=ik(i_({applyDefaults:il().optional()}),r),S=iY(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,ik(i_({form:_.optional(),url:r.optional()}),r.optional())),w=iS({list:r.optional(),cancel:r.optional(),requests:iS({sampling:iS({createMessage:r.optional()}).optional(),elicitation:iS({create:r.optional()}).optional()}).optional()}),$=iS({list:r.optional(),cancel:r.optional(),requests:iS({tools:iS({call:r.optional()}).optional()}).optional()}),E=i_({experimental:iT(oU(),r).optional(),sampling:i_({context:r.optional(),tools:r.optional()}).optional(),elicitation:S.optional(),roots:i_({listChanged:il().optional()}).optional(),tasks:w.optional(),extensions:iT(oU(),r).optional()}),P=i_({experimental:iT(oU(),r).optional(),logging:r.optional(),completions:r.optional(),prompts:i_({listChanged:il().optional()}).optional(),resources:i_({subscribe:il().optional(),listChanged:il().optional()}).optional(),tools:i_({listChanged:il().optional()}).optional(),tasks:$.optional(),extensions:iT(oU(),r).optional()}),R=i_({progress:ia(),total:iq(ia()),message:iq(oU())}),k=i_({...f.shape,...R.shape,progressToken:a}),x=m.extend({method:iA("notifications/progress"),params:k}),T=f.extend({level:s,logger:oU().optional(),data:im()}),O=m.extend({method:iA("notifications/message"),params:T}),j=i_({uri:oU(),mimeType:iq(oU()),_meta:iT(oU(),im()).optional()}),C=j.extend({text:oU()}),A=j.extend({blob:l}),I=i_({audience:iv(n).optional(),priority:ia().min(0).max(1).optional(),lastModified:iQ({offset:!0}).optional()}),N=i_({...v.shape,...g.shape,uri:oU(),description:iq(oU()),mimeType:iq(oU()),size:iq(ia()),annotations:I.optional(),_meta:iq(iS({}))}),M=i_({...v.shape,...g.shape,uriTemplate:oU(),description:iq(oU()),mimeType:iq(oU()),annotations:I.optional(),_meta:iq(iS({}))}),q=m.extend({method:iA("notifications/resources/list_changed"),params:f.optional()}),z=f.extend({uri:oU()}),D=m.extend({method:iA("notifications/resources/updated"),params:z}),L=i_({name:oU(),description:iq(oU()),required:iq(il())}),U=i_({...v.shape,...g.shape,description:iq(oU()),arguments:iq(iv(L)),_meta:iq(iS({}))}),H=m.extend({method:iA("notifications/prompts/list_changed"),params:f.optional()}),V=i_({type:iA("text"),text:oU(),annotations:I.optional(),_meta:iT(oU(),im()).optional()}),K=i_({type:iA("image"),data:l,mimeType:oU(),annotations:I.optional(),_meta:iT(oU(),im()).optional()}),F=i_({type:iA("audio"),data:l,mimeType:oU(),annotations:I.optional(),_meta:iT(oU(),im()).optional()}),J=i_({type:iA("tool_use"),name:oU(),id:oU(),input:iT(oU(),im()),_meta:iT(oU(),im()).optional()}),W=i_({type:iA("resource"),resource:i$([C,A]),annotations:I.optional(),_meta:iT(oU(),im()).optional()}),B=N.extend({type:iA("resource_link")}),G=i$([V,K,F,B,W]),Z=i_({role:n,content:G}),X=i_({title:oU().optional(),readOnlyHint:il().optional(),destructiveHint:il().optional(),idempotentHint:il().optional(),openWorldHint:il().optional()}),Y=m.extend({method:iA("notifications/tools/list_changed"),params:f.optional()}),Q=i_({name:oU().optional()}),ee=i_({hints:iv(Q).optional(),costPriority:ia().min(0).max(1).optional(),speedPriority:ia().min(0).max(1).optional(),intelligencePriority:ia().min(0).max(1).optional()}),et=i_({mode:ij(["auto","required","none"]).optional()}),er=i_({type:iA("boolean"),title:oU().optional(),description:oU().optional(),default:il().optional()}),ea=i_({type:iA("string"),title:oU().optional(),description:oU().optional(),minLength:ia().optional(),maxLength:ia().optional(),format:ij(["email","uri","date","date-time"]).optional(),default:oU().optional()}),eo=i_({type:ij(["number","integer"]),title:oU().optional(),description:oU().optional(),minimum:ia().optional(),maximum:ia().optional(),default:ia().optional()}),ei=i_({type:iA("string"),title:oU().optional(),description:oU().optional(),enum:iv(oU()),default:oU().optional()}),en=i_({type:iA("string"),title:oU().optional(),description:oU().optional(),oneOf:iv(i_({const:oU(),title:oU()})),default:oU().optional()}),es=i_({type:iA("string"),title:oU().optional(),description:oU().optional(),enum:iv(oU()),enumNames:iv(oU()).optional(),default:oU().optional()}),el=i$([ei,en]),ec=i_({type:iA("array"),title:oU().optional(),description:oU().optional(),minItems:ia().optional(),maxItems:ia().optional(),items:i_({type:iA("string"),enum:iv(oU())}),default:iv(oU()).optional()}),eu=i_({type:iA("array"),title:oU().optional(),description:oU().optional(),minItems:ia().optional(),maxItems:ia().optional(),items:i_({anyOf:iv(i_({const:oU(),title:oU()}))}),default:iv(oU()).optional()}),ed=i$([ec,eu]),ep=i$([es,el,ed]),eh=i$([ep,er,ea,eo]),ef=h.extend({mode:iA("form").optional(),message:oU(),requestedSchema:i_({type:iA("object"),properties:iT(oU(),eh),required:iv(oU()).optional()}).catchall(im())}),em=i_({type:iA("ref/resource"),uri:oU()}),ey=i_({type:iA("ref/prompt"),name:oU()}),eg=i_({uri:oU().startsWith("file://"),name:oU().optional(),_meta:iT(oU(),im()).optional()}),ev=E.shape,eb=i_({experimental:ev.experimental,sampling:ev.sampling,elicitation:ev.elicitation,roots:ev.roots,extensions:ev.extensions}),e_=P.shape,eS=i_({experimental:e_.experimental,logging:e_.logging,completions:e_.completions,prompts:e_.prompts,resources:e_.resources,tools:e_.tools,extensions:e_.extensions}),ew=iS({progressToken:a.optional(),[dm]:oU(),[dy]:b.optional(),[dv]:eb,[d_]:s.optional()}),e$=i_({...v.shape,...g.shape,description:oU().optional(),inputSchema:iS({$schema:oU().optional(),type:iA("object")}),outputSchema:iS({$schema:oU().optional()}).optional(),annotations:X.optional(),_meta:iT(oU(),im()).optional()}),eE=i_({type:iA("tool_result"),toolUseId:oU(),content:iv(G),structuredContent:im().optional(),isError:il().optional(),_meta:iT(oU(),im()).optional()}),eP=i$([V,K,F,J,eE]),eR=i_({role:n,content:i$([eP,iv(eP)]),_meta:iT(oU(),im()).optional()}),ek=oU(),ex=iS({[dg]:b.optional().catch(void 0)}),eT=ex.optional();function eO(t){return iS({_meta:eT,resultType:ek.default("complete"),...t})}let ej=eO({}),eC=eO({nextCursor:o.optional()}),eA=eO({content:iv(G),structuredContent:im().optional(),isError:il().optional()}),eI=eO({ttlMs:ia().int().min(0),cacheScope:ij(["public","private"]),tools:iv(e$),nextCursor:o.optional()}),eN=eO({ttlMs:ia().int().min(0),cacheScope:ij(["public","private"]),prompts:iv(U),nextCursor:o.optional()}),eM=eO({description:oU().optional(),messages:iv(Z)}),eq=eO({ttlMs:ia().int().min(0),cacheScope:ij(["public","private"]),resources:iv(N),nextCursor:o.optional()}),ez=eO({ttlMs:ia().int().min(0),cacheScope:ij(["public","private"]),resourceTemplates:iv(M),nextCursor:o.optional()}),eD=eO({ttlMs:ia().int().min(0),cacheScope:ij(["public","private"]),contents:iv(i$([C,A]))}),eL=eO({completion:i_({values:iv(oU()).max(100),total:ia().int().optional(),hasMore:il().optional()}).loose()}),eU=eO({ttlMs:ia().int().min(0),cacheScope:ij(["public","private"])}),eH=eO({ttlMs:ia().int().min(0).catch(0),cacheScope:ij(["public","private"]).catch("private"),supportedVersions:iv(oU()),capabilities:eS,instructions:oU().optional()}),eV=i_({messages:iv(eR),modelPreferences:ee.optional(),systemPrompt:oU().optional(),includeContext:ij(["none","thisServer","allServers"]).optional(),temperature:ia().optional(),maxTokens:ia().int(),stopSequences:iv(oU()).optional(),metadata:r.optional(),tools:iv(e$).optional(),toolChoice:et.optional()}),eK=i_({method:iA("sampling/createMessage"),params:eV}),eF=i_({method:iA("roots/list"),params:i_({_meta:iT(oU(),im()).optional()}).optional()}),eJ=i_({...eR.shape,model:oU(),stopReason:oU().optional()}),eW=i_({roots:iv(eg)}),eB=i_({action:ij(["accept","decline","cancel"]),content:iT(oU(),i$([oU(),ia(),il(),iv(oU())])).optional()}),eG=i_({mode:iA("url"),message:oU(),url:oU().url()}),eZ=i$([ef,eG]),eX=i_({method:iA("elicitation/create"),params:eZ}),eY=i$([eK,eF,eX]),eQ=i$([eJ,eW,eB]),e0=iT(oU(),eY),e1=iT(oU(),eQ),e2=eO({inputRequests:e0.optional(),requestState:oU().optional()}),e9={inputResponses:e1.optional(),requestState:oU().optional()},e4=i_({_meta:ew,...e9}),e5=iS({progressToken:a.optional()});function e6(t,r){return i_({method:iA(t),params:i_({_meta:ew,...r})})}function e3(t,r){return i_({method:iA(t),params:i_({_meta:e5.optional(),...r}).optional()})}let e8={name:oU(),arguments:iT(oU(),im()).optional(),...e9},e7={cursor:o.optional()},te=e6("tools/call",e8),tt=e6("tools/list",e7),tr=e6("prompts/list",e7),ta=e6("prompts/get",{name:oU(),arguments:iT(oU(),oU()).optional(),...e9}),to=e6("resources/list",e7),ti=e6("resources/templates/list",e7),tn=e6("resources/read",{uri:oU(),...e9}),ts={ref:i$([ey,em]),argument:i_({name:oU(),value:oU()}),context:i_({arguments:iT(oU(),oU()).optional()}).optional()},tl=e6("completion/complete",ts),tc=e6("server/discover",{}),tu=i_({toolsListChanged:il().optional(),promptsListChanged:il().optional(),resourcesListChanged:il().optional(),resourceSubscriptions:iv(oU()).optional()}),td={notifications:tu},tp=e6("subscriptions/listen",td),th=ex.extend({"io.modelcontextprotocol/subscriptionId":i}),tf=iS({_meta:th,resultType:ek.default("complete")}),tm={"tools/call":e3("tools/call",e8),"tools/list":e3("tools/list",e7),"prompts/get":e3("prompts/get",{name:oU(),arguments:iT(oU(),oU()).optional()}),"prompts/list":e3("prompts/list",e7),"resources/list":e3("resources/list",e7),"resources/templates/list":e3("resources/templates/list",e7),"resources/read":e3("resources/read",{uri:oU()}),"completion/complete":e3("completion/complete",ts),"server/discover":e3("server/discover",{}),"subscriptions/listen":e3("subscriptions/listen",td)};function ty(t){return iS({_meta:eT,...t})}let tg={"tools/call":ty({content:iv(G),structuredContent:im().optional(),isError:il().optional()}),"tools/list":ty({ttlMs:ia().int().min(0),cacheScope:ij(["public","private"]),tools:iv(e$),nextCursor:o.optional()}),"prompts/get":ty({description:oU().optional(),messages:iv(Z)}),"prompts/list":ty({ttlMs:ia().int().min(0),cacheScope:ij(["public","private"]),prompts:iv(U),nextCursor:o.optional()}),"resources/list":ty({ttlMs:ia().int().min(0),cacheScope:ij(["public","private"]),resources:iv(N),nextCursor:o.optional()}),"resources/templates/list":ty({ttlMs:ia().int().min(0),cacheScope:ij(["public","private"]),resourceTemplates:iv(M),nextCursor:o.optional()}),"resources/read":ty({ttlMs:ia().int().min(0),cacheScope:ij(["public","private"]),contents:iv(i$([C,A]))}),"completion/complete":ty({completion:i_({values:iv(oU()).max(100),total:ia().int().optional(),hasMore:il().optional()}).loose()}),"server/discover":ty({ttlMs:ia().int().min(0).catch(0),cacheScope:ij(["public","private"]).catch("private"),supportedVersions:iv(oU()),capabilities:eS,instructions:oU().optional()}),"subscriptions/listen":ty({})},tv=iS({"io.modelcontextprotocol/subscriptionId":i.optional()}),tb=i_({method:iA("notifications/subscriptions/acknowledged"),params:i_({_meta:tv.optional(),notifications:tu})}),t_=i_({_meta:tv.optional(),requestId:i,reason:oU().optional()}),tS=i_({method:iA("notifications/cancelled"),params:t_}),tw=t=>i_({jsonrpc:iA("2.0"),id:i$([oU(),ia().int()]),result:t}).strict();return{JSONValueSchema:t,JSONObjectSchema:r,ProgressTokenSchema:a,CursorSchema:o,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:b,ClientTasksCapabilitySchema:w,ServerTasksCapabilitySchema:$,ClientCapabilitiesSchema:E,ServerCapabilitiesSchema:P,ProgressSchema:R,ProgressNotificationParamsSchema:k,ProgressNotificationSchema:x,LoggingMessageNotificationParamsSchema:T,LoggingMessageNotificationSchema:O,ResourceContentsSchema:j,TextResourceContentsSchema:C,BlobResourceContentsSchema:A,AnnotationsSchema:I,ResourceSchema:N,ResourceTemplateSchema:M,ResourceListChangedNotificationSchema:q,ResourceUpdatedNotificationParamsSchema:z,ResourceUpdatedNotificationSchema:D,PromptArgumentSchema:L,PromptSchema:U,PromptListChangedNotificationSchema:H,TextContentSchema:V,ImageContentSchema:K,AudioContentSchema:F,ToolUseContentSchema:J,EmbeddedResourceSchema:W,ResourceLinkSchema:B,ContentBlockSchema:G,PromptMessageSchema:Z,ToolAnnotationsSchema:X,ToolListChangedNotificationSchema:Y,ModelHintSchema:Q,ModelPreferencesSchema:ee,ToolChoiceSchema:et,BooleanSchemaSchema:er,StringSchemaSchema:ea,NumberSchemaSchema:eo,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:eb,ServerCapabilities2026Schema:eS,RequestMetaEnvelopeSchema:ew,ToolSchema:e$,ToolResultContentSchema:eE,SamplingMessageContentBlockSchema:eP,SamplingMessageSchema:eR,ResultTypeSchema:ek,ResultMetaSchema:ex,ResultSchema:ej,PaginatedResultSchema:eC,CallToolResultSchema:eA,ListToolsResultSchema:eI,ListPromptsResultSchema:eN,GetPromptResultSchema:eM,ListResourcesResultSchema:eq,ListResourceTemplatesResultSchema:ez,ReadResourceResultSchema:eD,CompleteResultSchema:eL,CacheableResultSchema:eU,DiscoverResultSchema:eH,CreateMessageRequestParamsSchema:eV,CreateMessageRequestSchema:eK,ListRootsRequestSchema:eF,CreateMessageResultSchema:eJ,ListRootsResultSchema:eW,ElicitResultSchema:eB,ElicitRequestURLParamsSchema:eG,ElicitRequestParamsSchema:eZ,ElicitRequestSchema:eX,InputRequestSchema:eY,InputResponseSchema:eQ,InputRequestsSchema:e0,InputResponsesSchema:e1,InputRequiredResultSchema:e2,InputResponseRequestParamsSchema:e4,CallToolRequestSchema:te,ListToolsRequestSchema:tt,ListPromptsRequestSchema:tr,GetPromptRequestSchema:ta,ListResourcesRequestSchema:to,ListResourceTemplatesRequestSchema:ti,ReadResourceRequestSchema:tn,CompleteRequestSchema:tl,DiscoverRequestSchema:tc,SubscriptionFilterSchema:tu,SubscriptionsListenRequestSchema:tp,SubscriptionsListenResultMetaSchema:th,SubscriptionsListenResultSchema:tf,dispatchRequestSchemas:tm,dispatchResultSchemas:tg,NotificationMetaSchema:tv,SubscriptionsAcknowledgedNotificationSchema:tb,CancelledNotificationParamsSchema:t_,CancelledNotificationSchema:tS,notificationSchemas2026:{"notifications/cancelled":tS,"notifications/progress":x,"notifications/message":O,"notifications/resources/updated":D,"notifications/resources/list_changed":q,"notifications/tools/list_changed":Y,"notifications/prompts/list_changed":H,"notifications/subscriptions/acknowledged":tb},JSONRPCResultResponseSchema:tw(ej),CallToolResultResponseSchema:tw(i$([eA,e2])),ListToolsResultResponseSchema:tw(eI),ListPromptsResultResponseSchema:tw(eN),GetPromptResultResponseSchema:tw(i$([eM,e2])),ListResourcesResultResponseSchema:tw(eq),ListResourceTemplatesResultResponseSchema:tw(ez),ReadResourceResultResponseSchema:tw(i$([eD,e2])),CompleteResultResponseSchema:tw(eL),DiscoverResultResponseSchema:tw(eH),SubscriptionsListenResultResponseSchema:tw(tf)}}()}let fH=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"],fV=Symbol("modelcontextprotocol.resultCacheHintFallback");function fK(t){return"number"==typeof t&&Number.isSafeInteger(t)&&t>=0}function fF(t){return"public"===t||"private"===t}let fJ=((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 fW=class t extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return fd(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 fd(this,t)}constructor(t,r,a){super(r),this.code=t,this.data=a,this.name="ProtocolError",fu(this,new.target)}static fromError(r,a,o){return r===fJ.UrlElicitationRequired&&o&&o.elicitations?new fG(o.elicitations,a):r===fJ.UnsupportedProtocolVersion&&o&&Array.isArray(o.supported)&&"string"==typeof o.requested?new fZ({supported:o.supported,requested:o.requested},a):(r===fJ.InvalidParams||r===fJ.ResourceNotFound)&&"string"==typeof o?.uri&&(r===fJ.ResourceNotFound||1===Object.keys(o).length)?new fB(o.uri,a):r===fJ.MissingRequiredClientCapability&&o&&null!==o.requiredCapabilities&&"object"==typeof o.requiredCapabilities&&!Array.isArray(o.requiredCapabilities)?new fX({requiredCapabilities:o.requiredCapabilities},a):new t(r,a,o)}},fB=class extends fW{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(t,r=`Resource not found: ${t}`){super(fJ.InvalidParams,r,{uri:t})}get uri(){return this.data.uri}},fG=class extends fW{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(fJ.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}},fZ=class extends fW{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(t,r=`Unsupported protocol version: ${t.requested}`){super(fJ.UnsupportedProtocolVersion,r,t)}get supported(){return this.data.supported}get requested(){return this.data.requested}},fX=class extends fW{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(t,r=`Missing required client capabilities: ${Object.keys(t.requiredCapabilities).join(", ")}`){super(fJ.MissingRequiredClientCapability,r,t)}get requiredCapabilities(){return this.data.requiredCapabilities}};let fY=["tools/call","prompts/get","resources/read"],fQ=["elicitation/create","sampling/createMessage","roots/list"];function f0(){if(u)return u;let t=fU();return u={request:{"elicitation/create":i_({method:iA("elicitation/create"),params:t.ElicitRequestParamsSchema}),"sampling/createMessage":i_({method:iA("sampling/createMessage"),params:t.CreateMessageRequestParamsSchema}),"roots/list":i_({method:iA("roots/list"),params:iS({}).optional()})},response:{"elicitation/create":t.ElicitResultSchema,"sampling/createMessage":t.CreateMessageResultSchema,"roots/list":t.ListRootsResultSchema}}}function f1(t){return fQ.includes(t)}function f2(t){return f1(t)?f0().request[t]:void 0}let f9={"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},f4={"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 f5(t){return Object.prototype.hasOwnProperty.call(f9,t)}function f6(t){return Object.prototype.hasOwnProperty.call(f4,t)}function f3(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function f8(t,r){if(void 0===t)return{ok:!1,reason:"not-in-era"};let a=t.safeParse(r);return a.success?{ok:!0,value:a.data}:{ok:!1,reason:"invalid",message:String(a.error)}}Object.keys(f9),Object.keys(f4);let f7={ok:!1,reason:"not-in-era"},me=[dm,dv],mt={era:"2026-07-28",hasRequestMethod:f5,hasNotificationMethod:f6,hasInputRequestMethod:t=>void 0!==f2(t),validateRequest:(t,r)=>f8(f5(t)?fU().dispatchRequestSchemas[t]:void 0,r),validateResult:(t,r)=>f8(Object.prototype.hasOwnProperty.call(f9,t)?fU().dispatchResultSchemas[t]:void 0,r),validateNotification:(t,r)=>f8(f6(t)?fU().notificationSchemas2026[t]:void 0,r),validateInputRequest:(t,r)=>f8(f2(t),r),validateInputResponse:(t,r)=>f8(f1(t)?f0().response[t]:void 0,r),samplingResultVariant:()=>f7,outboundEnvelope:t=>({[dm]:t.protocolVersion,[dy]:t.clientInfo,[dv]:t.clientCapabilities,...void 0!==t.logLevel&&{[d_]:t.logLevel}}),validateEnvelopeMeta(t){let r=[];for(let a of me)a in t||r.push({key:a,problem:"missing"});let a=fU().RequestMetaEnvelopeSchema.safeParse(t);if(!a.success)for(let t of a.error.issues){let a=t.path.map(String),o=a.length>0?a.join("."):"_meta";1===a.length&&r.some(t=>t.key===o&&"missing"===t.problem)||r.push({key:o,problem:t.message})}return r},projectCallToolResult:t=>fw(t),inputRequestSchema:f2,decodeResult(t,r){if(!f3(r))return{kind:"invalid",error:new fm(ff.InvalidResult,`Invalid result for ${t}: not an object`,{method:t})};let a=r.resultType;if(void 0===a)return{kind:"invalid",error:new fm(ff.InvalidResult,`Invalid result for ${t}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:t,violation:"missing-resultType"})};if("string"!=typeof a)return{kind:"invalid",error:new fm(ff.InvalidResult,`Invalid result for ${t}: non-string resultType`,{method:t,resultType:a})};if("input_required"===a){let a=r.inputRequests,o=f3(a)?a:{},i=r.requestState,n=void 0===r._meta?void 0:fU().ResultMetaSchema.safeParse(r._meta),s=n?.success?n.data:void 0;return 0===Object.keys(o).length&&"string"!=typeof i?{kind:"invalid",error:new fm(ff.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:o,..."string"==typeof i&&{requestState:i},...void 0!==s&&{_meta:s}}}if("complete"!==a)return{kind:"invalid",error:new fm(ff.UnsupportedResultType,`Unsupported result type '${a}' for ${t}`,{resultType:a,method:t})};let o=function(){if(d)return d;let t=fU();return d={"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(o,t)?o[t]:void 0;if(void 0!==i){let a=i.safeParse(r);if(!a.success)return{kind:"invalid",error:new fm(ff.InvalidResult,`Invalid result for ${t}: ${a.error}`,{method:t})}}let n={...r};return delete n.resultType,{kind:"complete",result:n}},encodeResult:(t,r,a)=>(function(t,r){if(void 0===r)return t;let a=t._meta;return void 0===a?{...t,_meta:{[dg]:r}}:null===a||"object"!=typeof a||Array.isArray(a)||void 0!==a[dg]?t:{...t,_meta:{...a,[dg]:r}}})(function(t,r){var a,o;let i=r[fV];if("complete"!==r.resultType||!fH.includes(t)){let t;return void 0===i?r:(t={...r},delete t[fV],t)}let n=fK(r.ttlMs)?r.ttlMs:void 0!==(a=i)&&fK(a.ttlMs)?a.ttlMs:0,s=fF(r.cacheScope)?r.cacheScope:void 0!==(o=i)&&fF(o.cacheScope)?o.cacheScope:"private",l={...r,ttlMs:n,cacheScope:s};return delete l[fV],l}(t,function(t,r){let a=r.resultType;if(void 0===a)return{...r,resultType:"complete"};if("complete"===a||fY.includes(t))return r;throw new fW(fJ.InternalError,`Handler for ${t} returned resultType '${String(a)}', but results of ${t} only support 'complete' on protocol revision 2026-07-28`)}(t,function(t,r){let a=r,o=!1,i=()=>(o||(a={...a},o=!0),a),n=r.tools;"tools/list"===t&&Array.isArray(n)&&n.some(t=>f3(t)&&"execution"in t)&&(i().tools=n.map(t=>{if(!f3(t)||!("execution"in t))return t;let r={...t};return delete r.execution,r}));let s=r.capabilities;if(f3(s)&&"tasks"in s){let t={...s};delete t.tasks,i().capabilities=t}return a}(t,r))),a),encodeErrorCode:t=>-32002===t?-32602:t,checkInboundEnvelope(t){if(void 0===t.envelope)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let r=fU().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("; ")}`}},mr="2026-07-28";function ma(t){return void 0!==t&&t>=fv?mt:fL}function mo(t){return void 0!==t.revision?ma(t.revision).era:"modern"===t.era?mt.era:fL.era}function mi(t){return ml.some(r=>r.hasRequestMethod(t))}function mn(t){return ml.some(r=>r.hasNotificationMethod(t))}function ms(t){return"tasks/get"===t||"tasks/cancel"===t}let ml=[fL,mt];var mc=((t,r)=>{let a={};for(var o in t)dt(a,o,{get:t[o],enumerable:!0});return r&&dt(a,Symbol.toStringTag,{value:"Module"}),a})({AnnotationsSchema:()=>pu,AudioContentSchema:()=>pL,BaseMetadataSchema:()=>dB,BaseRequestParamsSchema:()=>dT,BlobResourceContentsSchema:()=>pl,BooleanSchemaSchema:()=>hd,CallToolRequestParamsSchema:()=>p1,CallToolRequestSchema:()=>p2,CallToolResultSchema:()=>pQ,CancelTaskRequestSchema:()=>hX,CancelTaskResultSchema:()=>hY,CancelledNotificationParamsSchema:()=>dK,CancelledNotificationSchema:()=>dF,ClientCapabilitiesSchema:()=>d0,ClientNotificationSchema:()=>h0,ClientRequestSchema:()=>hQ,ClientResultSchema:()=>h1,ClientTasksCapabilitySchema:()=>dY,CompatibilityCallToolResultSchema:()=>p0,CompleteRequestParamsSchema:()=>hC,CompleteRequestSchema:()=>hA,CompleteResultSchema:()=>hI,ContentBlockSchema:()=>pK,CreateMessageRequestParamsSchema:()=>hs,CreateMessageRequestSchema:()=>hl,CreateMessageResultSchema:()=>hc,CreateMessageResultWithToolsSchema:()=>hu,CreateTaskResultSchema:()=>hH,CursorSchema:()=>dP,DiscoverRequestSchema:()=>d6,DiscoverResultSchema:()=>d3,ElicitRequestFormParamsSchema:()=>h$,ElicitRequestParamsSchema:()=>hP,ElicitRequestSchema:()=>hR,ElicitRequestURLParamsSchema:()=>hE,ElicitResultSchema:()=>hT,ElicitationCompleteNotificationParamsSchema:()=>hk,ElicitationCompleteNotificationSchema:()=>hx,EmbeddedResourceSchema:()=>pH,EmptyResultSchema:()=>dV,EnumSchemaSchema:()=>hS,GetPromptRequestParamsSchema:()=>pM,GetPromptRequestSchema:()=>pq,GetPromptResultSchema:()=>pJ,GetTaskPayloadRequestSchema:()=>hW,GetTaskPayloadResultSchema:()=>hB,GetTaskRequestSchema:()=>hF,GetTaskResultSchema:()=>hJ,IconSchema:()=>dJ,IconsSchema:()=>dW,ImageContentSchema:()=>pD,ImplementationSchema:()=>dG,InitializeRequestParamsSchema:()=>d1,InitializeRequestSchema:()=>d2,InitializeResultSchema:()=>d4,InitializedNotificationSchema:()=>d5,JSONArraySchema:()=>d$,JSONObjectSchema:()=>dw,JSONRPCErrorResponseSchema:()=>dL,JSONRPCMessageSchema:()=>dU,JSONRPCNotificationSchema:()=>dz,JSONRPCRequestSchema:()=>dq,JSONRPCResponseSchema:()=>dH,JSONRPCResultResponseSchema:()=>dD,JSONValueSchema:()=>dS,LegacyTitledEnumSchemaSchema:()=>hy,ListChangedOptionsBaseSchema:()=>p4,ListPromptsRequestSchema:()=>pI,ListPromptsResultSchema:()=>pN,ListResourceTemplatesRequestSchema:()=>pm,ListResourceTemplatesResultSchema:()=>py,ListResourcesRequestSchema:()=>ph,ListResourcesResultSchema:()=>pf,ListRootsRequestSchema:()=>hM,ListRootsResultSchema:()=>hq,ListTasksRequestSchema:()=>hG,ListTasksResultSchema:()=>hZ,ListToolsRequestSchema:()=>pX,ListToolsResultSchema:()=>pY,LoggingLevelSchema:()=>p5,LoggingMessageNotificationParamsSchema:()=>p8,LoggingMessageNotificationSchema:()=>p7,ModelHintSchema:()=>he,ModelPreferencesSchema:()=>ht,MultiSelectEnumSchemaSchema:()=>h_,NotificationSchema:()=>dA,NotificationsParamsSchema:()=>dC,NumberSchemaSchema:()=>hh,PaginatedRequestParamsSchema:()=>pr,PaginatedRequestSchema:()=>pa,PaginatedResultSchema:()=>po,PingRequestSchema:()=>d8,PrimitiveSchemaDefinitionSchema:()=>hw,ProgressNotificationParamsSchema:()=>pe,ProgressNotificationSchema:()=>pt,ProgressSchema:()=>d7,ProgressTokenSchema:()=>dE,PromptArgumentSchema:()=>pC,PromptListChangedNotificationSchema:()=>pW,PromptMessageSchema:()=>pF,PromptReferenceSchema:()=>hj,PromptSchema:()=>pA,ReadResourceRequestParamsSchema:()=>pg,ReadResourceRequestSchema:()=>pv,ReadResourceResultSchema:()=>pb,RelatedTaskMetadataSchema:()=>dk,RequestIdSchema:()=>dM,RequestMetaSchema:()=>dx,RequestSchema:()=>dj,ResourceContentsSchema:()=>pi,ResourceLinkSchema:()=>pV,ResourceListChangedNotificationSchema:()=>p_,ResourceRequestParamsSchema:()=>pg,ResourceSchema:()=>pd,ResourceTemplateReferenceSchema:()=>hO,ResourceTemplateSchema:()=>pp,ResourceUpdatedNotificationParamsSchema:()=>pO,ResourceUpdatedNotificationSchema:()=>pj,ResultMetaObjectSchema:()=>dI,ResultSchema:()=>dN,RoleSchema:()=>pc,RootSchema:()=>hN,RootsListChangedNotificationSchema:()=>hz,SamplingContentSchema:()=>ho,SamplingMessageContentBlockSchema:()=>hi,SamplingMessageSchema:()=>hn,ServerCapabilitiesSchema:()=>d9,ServerNotificationSchema:()=>h9,ServerRequestSchema:()=>h2,ServerResultSchema:()=>h4,ServerTasksCapabilitySchema:()=>dQ,SetLevelRequestParamsSchema:()=>p6,SetLevelRequestSchema:()=>p3,SingleSelectEnumSchemaSchema:()=>hg,StringSchemaSchema:()=>hp,SubscribeRequestParamsSchema:()=>pg,SubscribeRequestSchema:()=>pS,SubscriptionFilterSchema:()=>p$,SubscriptionsAcknowledgedNotificationParamsSchema:()=>pR,SubscriptionsAcknowledgedNotificationSchema:()=>pk,SubscriptionsListenRequestParamsSchema:()=>pE,SubscriptionsListenRequestSchema:()=>pP,SubscriptionsListenResultMetaSchema:()=>px,SubscriptionsListenResultSchema:()=>pT,TaskAugmentedRequestParamsSchema:()=>dO,TaskCreationParamsSchema:()=>hD,TaskMetadataSchema:()=>dR,TaskSchema:()=>hU,TaskStatusNotificationParamsSchema:()=>hV,TaskStatusNotificationSchema:()=>hK,TaskStatusSchema:()=>hL,TextContentSchema:()=>pz,TextResourceContentsSchema:()=>pn,TitledMultiSelectEnumSchemaSchema:()=>hb,TitledSingleSelectEnumSchemaSchema:()=>hm,ToolAnnotationsSchema:()=>pB,ToolChoiceSchema:()=>hr,ToolExecutionSchema:()=>pG,ToolListChangedNotificationSchema:()=>p9,ToolResultContentSchema:()=>ha,ToolSchema:()=>pZ,ToolUseContentSchema:()=>pU,UnsubscribeRequestParamsSchema:()=>pg,UnsubscribeRequestSchema:()=>pw,UntitledMultiSelectEnumSchemaSchema:()=>hv,UntitledSingleSelectEnumSchemaSchema:()=>hf});let mu=t=>dD.safeParse(t).success,md=t=>dL.safeParse(t).success,mp=t=>"object"==typeof t&&null!==t&&!Array.isArray(t)&&"input_required"===t.resultType,mh="x-mcp-header",mf=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,mm=new Set(["string","integer","boolean","number"]);function my(t){let r=[],a=new Map,o=(t,i,n)=>{if(null===t||"object"!=typeof t)return;if(mh in t){if(!n||0===i.length)return`${mb(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 o=t[mh];if("string"!=typeof o||0===o.length)return`${mb(i)}: x-mcp-header MUST be a non-empty string`;if(!mf.test(o))return`${mb(i)}: x-mcp-header '${o}' 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||!mm.has(s))return`${mb(i)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${s??"<none>"}`;let l=o.toLowerCase(),c=a.get(l);if(void 0!==c)return`x-mcp-header '${o}' is not case-insensitively unique (also declared as '${c}')`;a.set(l,o),r.push({path:i,headerName:o,type:s})}let s=t.properties;if(null!==s&&"object"==typeof s)for(let[t,r]of Object.entries(s)){let a=o(r,[...i,t],n);if(void 0!==a)return a}for(let r of mg){let a=t[r];if(void 0!==a)for(let t of Array.isArray(a)?a:null!==a&&"object"==typeof a&&mv.has(r)?Object.values(a):[a]){let a=o(t,[...i,`<${r}>`],!1);if(void 0!==a)return a}}},i=o(t,[],!0);return void 0===i?{valid:!0,declarations:r}:{valid:!1,reason:i}}let mg=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],mv=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function mb(t){return 0===t.length?"<root>":t.join(".")}let m_="=?base64?";function mS(t){return!function(t){if(0===t.length||t.startsWith(m_)&&t.endsWith("?=")||t!==t.trim())return!0;for(let r=0;r<t.length;r++){let a=t.codePointAt(r);if(9!==a&&(!(a>=32)||!(a<=126)))return!0}return!1}(t)?t:`${m_}${function(t){let r=new TextEncoder().encode(t),a="";for(let t of r)a+=String.fromCodePoint(t);return btoa(a)}(t)}?=`}fJ.InvalidRequest,fJ.UnsupportedProtocolVersion,fJ.InvalidParams,fJ.MethodNotFound,fJ.InvalidParams,fJ.MissingRequiredClientCapability,fJ.ParseError,fJ.InvalidRequest,fJ.MethodNotFound,fJ.UnsupportedProtocolVersion,fJ.MissingRequiredClientCapability;let mw={"tools/call":"name","prompts/get":"name","resources/read":"uri","tasks/get":"taskId","tasks/update":"taskId","tasks/cancel":"taskId"};function m$(t){return new Set(t.flatMap(t=>Object.keys(t.shape)))}function mE(t){if(null==t)return!1;let r=typeof t;return("object"===r||"function"===r)&&"~standard"in t&&"function"==typeof t["~standard"]?.validate}let mP=!1,mR="draft-2020-12";async function mk(t,r){let a=await t["~standard"].validate(r);return a.issues&&a.issues.length>0?{success:!1,error:a.issues.map(t=>t.path?.length?`${t.path.map(t=>String("object"==typeof t?t.key:t)).join(".")}: ${t.message}`:t.message).join(", ")}:{success:!0,data:a.value}}let mx=/\\\.\\d\{(\d+)\}/;function mT(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}let mO=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function mj(t){return mO.has(t)||t.startsWith("x-")}let mC=new Set(["$schema",...Object.keys(h$.shape.requestedSchema.shape)]),mA={string:m$([hp,hf,hm,hy]),number:m$([hh]),integer:m$([hh]),boolean:m$([hd]),array:m$([hv,hb])},mI=new Set(hp.shape.format.unwrap().options);async function mN(t){let{config:r,method:a,originalParams:o,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;throw new fm(ff.InputRequiredRoundsExceeded,(d=r.maxRounds,`Multi-round-trip request '${a}' still required input after ${d} 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 '${a}' (round ${u})`});let p=Object.entries(c.inputRequests??{});if(p.length>0){let r=function(t){let r=new AbortController,a=()=>r.abort(t?.reason);return t?.addEventListener("abort",a,{once:!0}),t?.aborted&&r.abort(t.reason),{signal:r.signal,abort:t=>r.abort(t),dispose:()=>t?.removeEventListener("abort",a)}}(s);try{let a=await Promise.all(p.map(async([t,a])=>{try{return[t,await n.dispatchInputRequest(t,a,r.signal)]}catch(t){throw r.abort(t),t}}));t=Object.fromEntries(a)}finally{r.dispose()}}else await function(t,r){return new Promise((t,a)=>{if(r?.aborted)return void a(r.reason instanceof fm?r.reason:new fm(ff.RequestTimeout,String(r.reason)));let o=setTimeout(()=>{r?.removeEventListener("abort",i),t()},250),i=()=>{clearTimeout(o),a(r?.reason instanceof fm?r.reason:new fm(ff.RequestTimeout,String(r?.reason)))};r?.addEventListener("abort",i,{once:!0})})}(0,s);let h={...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 fm(ff.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:i.maxTotalTimeout,totalElapsed:t});h.maxTotalTimeout=r}let f=await n.retry(function(t,r,a){let o=void 0!==r&&Object.keys(r).length>0;return o||void 0!==a?{...t,...o&&{inputResponses:r},...void 0!==a&&{requestState:a}}:t}(o,t,c.requestState),h);if(mp(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,a="string"==typeof t.requestState;if(!r&&!a)throw TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...void 0!==t.inputRequests&&{inputRequests:t.inputRequests},...void 0!==t.requestState&&{requestState:t.requestState}}},{elicit(t){try{return{method:"elicitation/create",params:function(t){var r;if(!mE(t.requestedSchema))return{...t,mode:"form",requestedSchema:t.requestedSchema};let a=t.requestedSchema["~standard"].vendor,o=function(t,r){let a={},o=[];for(let[i,n]of Object.entries(t))"properties"===i&&mT(n)?a[i]=Object.fromEntries(Object.entries(n).map(([t,a])=>[t,function(t,r,a,o){if(!mT(t))return t;let i="string"==typeof t.type&&Object.hasOwn(mA,t.type)?mA[t.type]:void 0;if(void 0===i)return t;let n={};for(let[l,c]of Object.entries(t))if(i.has(l)||mj(l))n[l]=c;else if("pattern"===l&&"string"===t.type&&"string"==typeof t.format)if(mI.has(t.format)){var s;"string"==typeof c&&(s=t.format,"zod"!==a||(function(t,r){let a;switch(t){case"email":a=[at(oW,void 0)];break;case"uri":a=[ar(oZ,void 0)];break;case"date":a=[ao(oK,void 0)];break;case"date-time":let o,i;o=mx.exec(r),i=[void 0,-1,0],o&&i.push(Number(o[1])),a=[!1,!0].flatMap(t=>[!1,!0].flatMap(r=>i.map(a=>iQ({local:t,offset:r,precision:a}))))}return new Set(a.map(t=>{let r;return r=os(t,{target:mR,io:"input"}),"string"==typeof r.pattern?r.pattern:void 0}).filter(t=>void 0!==t))})(s,c).has(c))||o.push(`${r}.${l}`)}else n[l]=c;else o.push(`${r}.${l}`);return n}(a,`properties.${t}`,r,o)])):mC.has(i)?a[i]=n:mj(i)||o.push(i);if(o.length>0)throw new fW(fJ.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${o.join(", ")}`);return a}(function(t){try{return function(t,r="input"){let a,o=t["~standard"];if(o.jsonSchema)a=o.jsonSchema[r]({target:mR});else if("zod"===o.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().");mP||(mP=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),a=os(t,{target:mR,io:r})}else throw Error(`Schema library "${o.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if("output"===r)return void 0!==a.type||!function t(r){if("properties"in r||"patternProperties"in r||"additionalProperties"in r||"required"in r)return!0;for(let a of["oneOf","anyOf","allOf"]){let o=r[a];if(Array.isArray(o)&&o.length>0)return o.every(r=>null!==r&&"object"==typeof r&&("object"===r.type||t(r)))}return!1}(a)?a:{type:"object",...a};if(void 0!==a.type&&"object"!==a.type)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(a.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...a}}(t,"input")}catch(r){let t=r instanceof Error?r.message:String(r);throw new fW(fJ.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}(t.requestedSchema),a),i=(r=h$.shape.requestedSchema,ok(r,o));if(!i.success)throw new fW(fJ.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${function(t,r){if(!mT(t.properties))return r;let a=Object.entries(t.properties).filter(([,t])=>!ok(hw,t).success).map(([t])=>`properties.${t}`);return a.length>0?a.join(", "):r}(o,i.error.message)}`);let n=function t(r,a,o=""){return Array.isArray(r)&&Array.isArray(a)?r.flatMap((r,i)=>t(r,a[i],`${o}[${i}]`)):mT(r)&&mT(a)?Object.entries(r).flatMap(([r,i])=>{let n=o?`${o}.${r}`:r;return Object.prototype.hasOwnProperty.call(a,r)?t(i,a[r],n):mj(r)?[]:[n]}):[]}(o,i.data);if(n.length>0)throw new fW(fJ.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 fW(fJ.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 fW?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 mM={},mq={};function mz(t,r){let a=t.slice(0,-6);mM[a]=r,mq[a]=t=>r.safeParse(t).success}for(let t of["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"])mz(t,mc[t]);for(let[t,r]of Object.entries({IdJagTokenExchangeResponseSchema:ft,OAuthClientInformationFullSchema:fn,OAuthClientInformationSchema:fi,OAuthClientMetadataSchema:fo,OAuthClientRegistrationErrorSchema:fs,OAuthErrorResponseSchema:fr,OAuthMetadataSchema:h3,OAuthProtectedResourceMetadataSchema:h6,OAuthTokenRevocationRequestSchema:fl,OAuthTokensSchema:fe,OpenIdProviderDiscoveryMetadataSchema:h7,OpenIdProviderMetadataSchema:h8}))mz(t,r);Object.freeze(mM);let mD=Object.freeze(mq),mL=[dm,dy,dv,d_],mU=["inputResponses","requestState"];function mH(t,r){let a=t.params;if(!mJ(a))return{message:t,lifted:{}};let o=a._meta,i=mJ(o)?mL.filter(t=>t in o):[],n="request"===r?mU.filter(t=>t in a):[];if(0===i.length&&0===n.length)return{message:t,lifted:{}};let s={},l={...a};if(i.length>0&&mJ(o)){let t={},r={...o};for(let a of i)t[a]=o[a],delete r[a];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 mV(t,r){let a=t.validateResult(r,void 0);if(a.ok||"not-in-era"!==a.reason)return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(a){let o=t.validateResult(r,a);return o.ok?{value:o.value}:{issues:[{message:"invalid"===o.reason?o.message:`not-in-era: ${r}`}]}}}}}let mK=(x=void 0,()=>x);var mF=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??df,this.setNotificationHandler("notifications/cancelled",t=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",t=>{this._onprogress(t)}),this.setRequestHandler("ping",t=>({}))}_shouldDropInbound(t){}_outboundMetaEnvelope(){}_envelopeOutbound(t){let r=this._outboundMetaEnvelope();if(void 0===r)return t;let a=t.params??{};return{...t,params:{...a,_meta:{...r,...a._meta}}}}_resolveNonCompleteResult(t,r){return Promise.reject(new fm(ff.UnsupportedResultType,`Unsupported result type '${t.kind}' for ${r.request.method}`,{resultType:t.kind,method:r.request.method}))}_getRequestHandler(t){return this._requestHandlers.get(t)}async _oncancel(t){void 0!==t.params.requestId&&this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,a,o,i=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:a,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let a=Date.now()-r.startTime;if(r.maxTotalTimeout&&a>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),new fm(ff.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:a});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{try{r?.()}finally{this._onclose()}};let a=this.transport?.onerror;this._transport.onerror=t=>{a?.(t),this._onerror(t)};let o=this._transport?.onmessage;this._transport.onmessage=(t,r)=>{if(o?.(t,r),mu(t)||md(t))this._onresponse(t);else if(dq.safeParse(t).success)this._onrequest(t,r);else dz.safeParse(t).success?this._onnotification(t,r):this._onerror(Error(`Unknown message type: ${JSON.stringify(t)}`))},t.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let t=this._responseHandlers;for(let t of(this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._timeoutInfo.values()))clearTimeout(t.timeoutId);this._timeoutInfo.clear();let r=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let a=new fm(ff.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let r of t.values())r(a);for(let t of r.values())t.abort(a)}}_onerror(t){this.onerror?.(t)}_onnotification(t,r){let{message:a}=mH(t,"notification"),o=this._negotiatedWireCodec();if(r?.classification===void 0&&"drop"===this._shouldDropInbound(t))return;if(r?.classification!==void 0){let t=mo(r.classification);if(t!==o.era)return void this._onerror(Error(`Era mismatch on inbound notification '${a.method}': classified as ${t} but this instance serves ${o.era}`))}if(mn(a.method)&&!o.hasNotificationMethod(a.method))return;let i=this._notificationHandlers.get(a.method),n=this.fallbackNotificationHandler;(void 0!==i||void 0!==n)&&Promise.resolve().then(()=>void 0===i?n(a):i(a,o)).catch(t=>this._onerror(Error(`Uncaught error in notification handler: ${t}`)))}_onrequest(t,r){var a;let{message:o,lifted:i}=mH(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,a)=>{let i={jsonrpc:"2.0",id:o.id,error:{code:t,message:r,...void 0!==a&&{data:a}}};s?.send(i).catch(t=>this._onerror(Error(`Failed to send an error response: ${t}`)))};if(r?.classification!==void 0){let t=mo(r.classification);if(t!==n.era){this._onerror(Error(`Era mismatch on inbound request '${o.method}': classified as ${t} but this instance serves ${n.era}`));let a=r.classification.revision??t;l(fJ.UnsupportedProtocolVersion,`Unsupported protocol version: ${a}`,{supported:this._supportedProtocolVersions,requested:a});return}}if(mi(o.method)&&!n.hasRequestMethod(o.method)&&!(ms(o.method)&&this._customSchemaRequestMethods.has(o.method)))return void l(fJ.MethodNotFound,"Method not found");let c=this._requestHandlers.get(o.method)??this.fallbackRequestHandler;if(void 0===c)return void l(fJ.MethodNotFound,"Method not found");let u=n.checkInboundEnvelope(i);if(void 0!==u)return void l(fJ.InvalidParams,u);let d=(t,r)=>this._notificationViaCodec(this._resolveOutboundCodec(t.method),t,{...r,relatedRequestId:o.id}),p=(t,r,a)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(t.method),t,r,{...a,relatedRequestId:o.id}),h=new AbortController;this._requestHandlerAbortControllers.set(o.id,h);let f=void 0===i.inputResponses?void 0:function(t){let r={},a=[];if(!mW(t))return{accepted:r,droppedKeys:a};for(let[o,i]of Object.entries(t)){if(!mW(i)||"method"in i||"result"in i){a.push(o);continue}r[o]=i}return{accepted:r,droppedKeys:a}}(i.inputResponses),m={sessionId:s?.sessionId,mcpReq:{id:o.id,method:o.method,_meta:o.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?mK:(a=i.requestState,()=>a),signal:h.signal,send:(t,r,a)=>{let o=this._resolveOutboundCodec(t.method);if(this._assertOutboundRequestInEra(o,t.method),mE(r))return p(t,r,a);let i=mV(o,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(o,y)).then(async t=>{let r;if(h.signal.aborted)return;try{r=n.encodeResult(o.method,t,this._outboundServerInfo())}catch(t){this._onerror(Error(`Failed to encode result for ${o.method}: ${t}`)),l(fJ.InternalError,"Internal error");return}let a={result:r,jsonrpc:"2.0",id:o.id};await s?.send(a)},async t=>{if(h.signal.aborted)return;let r=Number.isSafeInteger(t.code)?t.code:fJ.InternalError,a={jsonrpc:"2.0",id:o.id,error:{code:n.encodeErrorCode(r),message:t.message??"Internal error",...void 0!==t.data&&{data:t.data}}};await s?.send(a)}).catch(t=>this._onerror(Error(`Failed to send response: ${t}`))).finally(()=>{this._requestHandlerAbortControllers.get(o.id)===h&&this._requestHandlerAbortControllers.delete(o.id)})}_onprogress(t){let{progressToken:r,...a}=t.params,o=Number(r),i=this._progressHandlers.get(o);if(!i)return void this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));let n=this._responseHandlers.get(o),s=this._timeoutInfo.get(o);if(s&&n&&s.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(t){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),n(t);return}i(a)}_onresponse(t){let r=Number(t.id),a=this._responseHandlers.get(r);void 0===a?this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`)):(this._responseHandlers.delete(r),this._cleanupTimeout(r),this._progressHandlers.delete(r),a(mu(t)?t:fW.fromError(t.error.code,t.error.message,t.error.data)))}get transport(){return this._transport}async close(){await this._transport?.close()}request(t,r,a){let o=this._resolveOutboundCodec(t.method);if(mE(r))return ms(t.method)||this._assertOutboundRequestInEra(o,t.method),this._requestWithSchemaViaCodec(o,t,r,a);this._assertOutboundRequestInEra(o,t.method);let i=mV(o,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(o,t,i,r)}_negotiatedWireCodec(){return ma(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 ma(void 0);case"server/discover":return ma(mr);default:return}}(t);if(r)return r}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(t,r){if(mi(r)&&!t.hasRequestMethod(r))throw new fm(ff.MethodNotSupportedByProtocolVersion,`Method '${r}' is not supported by the negotiated protocol version (wire era ${t.era})`,{method:r,era:t.era})}_requestWithSchema(t,r,a){let o=this._resolveOutboundCodec(t.method);return this._assertOutboundRequestInEra(o,t.method),this._requestWithSchemaViaCodec(o,t,r,a)}_requestWithSchemaViaCodec(t,r,a,o){let i,n,{relatedRequestId:s,resumptionToken:l,onresumptiontoken:c,headers:u}=o??{},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(o?.signal?.aborted){let t=o.signal.reason;throw t instanceof fm?t:new fm(ff.RequestTimeout,String(t))}let m=t.era===mr&&!0===this._transport.hasPerRequestStream?new AbortController:void 0,y=this._requestMessageId++;n=y;let g={...r,jsonrpc:"2.0",id:y};o?.onprogress&&(this._progressHandlers.set(y,o.onprogress),g.params={...r.params,_meta:{...r.params?._meta,progressToken:y}});let v=this._envelopeOutbound(g),b=!1,_=t=>{b||(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 fm?t:new fm(ff.RequestTimeout,String(t))))};this._responseHandlers.set(y,i=>{let n;if(!o?.signal?.aborted){if(b=!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 o?.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:a,options:o,flowStartedAt:d,retry:(o,i)=>this._requestWithSchemaViaCodec(t,void 0===o?{method:r.method}:{method:r.method,params:o},a,i)}))}mk(a,n.result).then(t=>{t.success?p(t.data):h(new fm(ff.InvalidResult,`Invalid result for ${r.method}: ${t.error}`))},h)}}),i=()=>_(o?.signal?.reason),o?.signal?.addEventListener("abort",i,{once:!0});let S=o?.timeout??6e4;this._setupTimeout(y,S,o?.maxTotalTimeout,()=>_(new fm(ff.RequestTimeout,"Request timed out",{timeout:S})),o?.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&&o?.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,a){if(!this._transport)throw new fm(ff.NotConnected,"Not connected");if(mn(r.method)&&!t.hasNotificationMethod(r.method))throw new fm(ff.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 o=this._envelopeOutbound({jsonrpc:"2.0",...r});if((this._options?.debouncedNotificationMethods??[]).includes(r.method)&&!r.params&&a?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(r.method))return;this._pendingDebouncedNotifications.add(r.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(r.method),this._transport&&this._transport?.send(o,a).catch(t=>this._onerror(t))});return}await this._transport.send(o,a)}setRequestHandler(t,r,a){let o;if(this.assertRequestHandlerCapability(t),"function"==typeof r){if(!mi(t))throw TypeError(`'${t}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);o=(a,o)=>{let i=this._negotiatedWireCodec(),n=i.validateRequest(t,a);if(n.ok||"not-in-era"!==n.reason||(n=i.validateInputRequest(t,a)),!n.ok){if("not-in-era"===n.reason)throw new fW(fJ.InternalError,`No wire schema for ${t} in the resolved era`);throw Error(n.message)}return Promise.resolve(r(n.value,o))}}else if(a)o=async(o,i)=>{let n=await mk(r.params,{...o.params});if(!n.success)throw new fW(fJ.InvalidParams,`Invalid params for ${t}: ${n.error}`);return a(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,o))}_wrapHandler(t,r){return r}_outboundServerInfo(){}removeRequestHandler(t){this._requestHandlers.delete(t),this._customSchemaRequestMethods.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r,a){if("function"==typeof r){if(!mn(t))throw TypeError(`'${t}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(t,(a,o)=>{let i=o.validateNotification(t,a);if(!i.ok){if("not-in-era"===i.reason)throw new fW(fJ.InternalError,`No wire schema for ${t} in the resolved era`);throw Error(i.message)}return Promise.resolve(r(i.value))});return}if(!a)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(t,async o=>{let i=await mk(r.params,{...o.params});if(!i.success)throw new fW(fJ.InvalidParams,`Invalid params for notification ${t}: ${i.error}`);await a(i.data,o)})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}};function mJ(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function mW(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function mB(t){throw new fm(ff.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 mG(t,r,a,o,i){var n;if(!mW(o)||"string"!=typeof o.method)throw new fm(ff.InvalidResult,`Invalid input request '${a}': each inputRequests entry must be an embedded request object with a method`,{key:a});let s=o.method;if(!r.hasInputRequestMethod(s))throw new fm(ff.InvalidResult,`Invalid input request '${a}': '${s}' is not an embedded request the ${r.era} revision defines (expected elicitation/create, sampling/createMessage, or roots/list)`,{key:a,method:s});let l=t.getRequestHandler(s);if(void 0===l)throw new fm(ff.CapabilityNotSupported,`Cannot fulfil input request '${a}': no handler is registered for '${s}' on this client. Declare the corresponding capability and register a handler, or handle input_required results manually.`,{key:a,method:s});let c=mW(o.params)?o.params:void 0;return await l({jsonrpc:"2.0",id:a,method:s,...void 0!==c&&{params:c}},t.buildContext({sessionId:t.sessionId,mcpReq:{id:a,method:s,_meta:c?._meta,requestState:(n=void 0,()=>n),signal:i,send:()=>mB("send"),notify:()=>mB("notify")}}))}var mZ=dl(ds(t=>{var r=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,a=/\\([\u000b\u0020-\u00ff])/g,o=/^[!#$%&'*+.^_`|~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(!o.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(a,"$1")),p.parameters[n]=l}if(u!==c.length)throw TypeError("invalid parameter format")}return p}})(),1),mX=class{_buffer;_maxBufferSize;constructor(t){this._maxBufferSize=t?.maxBufferSize??0xa00000}append(t){if((this._buffer?.length??0)+t.length>this._maxBufferSize)throw this.clear(),Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){for(;this._buffer;){let r=this._buffer.indexOf("\n");if(-1===r)break;let a=this._buffer.toString("utf8",0,r).replace(/\r$/,"");this._buffer=this._buffer.subarray(r+1);try{var t;return t=a,dU.parse(JSON.parse(t))}catch(t){if(t instanceof SyntaxError)continue;throw t}}return null}clear(){this._buffer=void 0}};function mY(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):{...t}:{}}let mQ=new Set([301,302,303,307,308]);function m0(t,r){let a=mQ.has(r.status)?r.headers?.get("location"):void 0;if(a)try{return new URL(a,t)}catch{return}}let m1=new WeakSet;function m2(t){return m1.has(t)?t:async(r,a)=>{if(a?.redirect==="error"||a?.redirect==="manual")return t(r,a);let o=(a?.method??"GET").toUpperCase(),i=r;for(let r=0;;r++){let n=await t(i,{...a,redirect:"manual"}),s=m0(i,n);if(!s||5===r)return n;let l=new URL(i),c="GET"===o||307===n.status||308===n.status,u=!(s.username||s.password)||s.username===l.username&&s.password===l.password;if(!c||!u||(l.protocol!==s.protocol||l.host!==s.host)&&("http:"!==l.protocol||"https:"!==s.protocol||l.hostname!==s.hostname||l.port||s.port))return n;await n.text?.().catch(()=>{}),i=s}}}var m9=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;var r=class{};t._CodeOrName=r,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var a=class extends r{constructor(r){if(super(),!t.IDENTIFIER.test(r))throw Error("CodeGen: name must be a valid identifier");this.str=r}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};t.Name=a;var o=class extends r{constructor(t){super(),this._items="string"==typeof t?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return""===t||'""'===t}get str(){var t;return null!=(t=this._str)?t:this._str=this._items.reduce((t,r)=>`${t}${r}`,"")}get names(){var t;return null!=(t=this._names)?t:this._names=this._items.reduce((t,r)=>(r instanceof a&&(t[r.str]=(t[r.str]||0)+1),t),{})}};function i(t,...r){let a=[t[0]],n=0;for(;n<r.length;)l(a,r[n]),a.push(t[++n]);return new o(a)}t._Code=o,t.nil=new o(""),t._=i;let n=new o("+");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 o,i;let n=(o=t[r-1],'""'===(i=t[r+1])?o:'""'===o?i:"string"==typeof o?i instanceof a||'"'!==o[o.length-1]?void 0:"string"!=typeof i?`${o.slice(0,-1)}${i}"`:'"'===i[0]?o.slice(0,-1)+i.slice(1):void 0:"string"!=typeof i||'"'!==i[0]||o instanceof a?void 0:`"${o}${i.slice(1)}`);if(void 0!==n){t.splice(r-1,3,n);continue}t[r++]="+"}r++}}(i),new o(i)}function l(t,r){var i;r instanceof o?t.push(...r._items):r instanceof a?t.push(r):t.push("number"==typeof(i=r)||"boolean"==typeof i||null===i?i:c(Array.isArray(i)?i.join(","):i))}function c(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.str=s,t.addCodeArg=l,t.strConcat=function(t,r){return r.emptyStr()?t:t.emptyStr()?r:s`${t}${r}`},t.stringify=function(t){return new o(c(t))},t.safeStringify=c,t.getProperty=function(r){return"string"==typeof r&&t.IDENTIFIER.test(r)?new o(`.${r}`):i`[${r}]`},t.getEsmExportName=function(r){if("string"==typeof r&&t.IDENTIFIER.test(r))return new o(`${r}`);throw Error(`CodeGen: invalid export name: ${r}, use explicit $id name mapping`)},t.regexpCode=function(t){return new o(t.toString())}}),m4=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;let r=m9();var a,o,i=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}};(a=o||(t.UsedValueState=o={}))[a.Started=0]="Started",a[a.Completed=1]="Completed",t.varKinds={const:new r.Name("const"),let:new r.Name("let"),var:new r.Name("var")};var 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,a;if((null==(a=null==(r=this._parent)?void 0:r._prefixes)?void 0:a.has(t))||this._prefixes&&!this._prefixes.has(t))throw Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};t.Scope=n;var s=class extends r.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:a,itemIndex:o}){this.value=t,this.scopePath=(0,r._)`.${new r.Name(a)}[${o}]`}};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 a;if(void 0===r.ref)throw Error("CodeGen: ref must be passed in value");let o=this.toName(t),{prefix:i}=o,n=null!=(a=r.key)?a: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,o);let l=this._scope[i]||(this._scope[i]=[]),c=l.length;return l[c]=r.ref,o.setValue(r,{property:i,itemIndex:c}),o}getValue(t,r){let a=this._values[t];if(a)return a.get(r)}scopeRefs(t,a=this._values){return this._reduceValues(a,a=>{if(void 0===a.scopePath)throw Error(`CodeGen: name "${a}" has no value`);return(0,r._)`${t}${a.scopePath}`})}scopeCode(t=this._values,r,a){return this._reduceValues(t,t=>{if(void 0===t.value)throw Error(`CodeGen: name "${t}" has no value`);return t.value.code},r,a)}_reduceValues(a,n,s={},l){let c=r.nil;for(let u in a){let d=a[u];if(!d)continue;let p=s[u]=s[u]||new Map;d.forEach(a=>{if(p.has(a))return;p.set(a,o.Started);let s=n(a);if(s){let o=this.opts.es5?t.varKinds.var:t.varKinds.const;c=(0,r._)`${c}${o} ${a} = ${s};${this.opts._n}`}else if(s=null==l?void 0:l(a))c=(0,r._)`${c}${s}${this.opts._n}`;else throw new i(a);p.set(a,o.Completed)})}return c}};t.ValueScope=c}),m5=ds(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=m9(),a=m4();var o=m9();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return o._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return o.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return o.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return o.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return o.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return o.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return o.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return o.Name}});var i=m4();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,a){super(),this.varKind=t,this.name=r,this.rhs=a}render({es5:t,_n:r}){let o=t?a.varKinds.var:this.varKind,i=void 0===this.rhs?"":` = ${this.rhs}`;return`${o} ${this.name}${i};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=j(this.rhs,t,r)),this}get names(){return this.rhs instanceof r._CodeOrName?this.rhs.names:{}}},l=class extends n{constructor(t,r,a){super(),this.lhs=t,this.rhs=r,this.sideEffects=a}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,a){if(!(this.lhs instanceof r.Name)||t[this.lhs.str]||this.sideEffects)return this.rhs=j(this.rhs,t,a),this}get names(){return O(this.lhs instanceof r.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends l{constructor(t,r,a,o){super(t,a,o),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=j(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,a)=>r+a.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let a=t[r].optimizeNodes();Array.isArray(a)?t.splice(r,1,...a):a?t[r]=a:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:a}=this,o=a.length;for(;o--;){let i=a[o];i.optimizeNames(t,r)||(function(t,r){for(let a in r)t[a]=(t[a]||0)-(r[a]||0)}(t,i.names),a.splice(o,1))}return a.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>T(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 a=this.else;if(a){let t=a.optimizeNodes();a=this.else=Array.isArray(t)?new g(t):t}return a?!1===r?a instanceof t?a:a.nodes:this.nodes.length?this:new t(C(r),a instanceof t?[a]:a.nodes):!1!==r&&this.nodes.length?this:void 0}optimizeNames(t,r){var a;if(this.else=null==(a=this.else)?void 0:a.optimizeNames(t,r),super.optimizeNames(t,r)||this.else)return this.condition=j(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 b=class extends m{};b.kind="for";var _=class extends b{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=j(this.iteration,t,r),this}get names(){return T(super.names,this.iteration.names)}},S=class extends b{constructor(t,r,a,o){super(),this.varKind=t,this.name=r,this.from=a,this.to=o}render(t){let r=t.es5?a.varKinds.var:this.varKind,{name:o,from:i,to:n}=this;return`for(${r} ${o}=${i}; ${o}<${n}; ${o}++)`+super.render(t)}get names(){return O(O(super.names,this.from),this.to)}},w=class extends b{constructor(t,r,a,o){super(),this.loop=t,this.varKind=r,this.name=a,this.iterable=o}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=j(this.iterable,t,r),this}get names(){return T(super.names,this.iterable.names)}},$=class extends m{constructor(t,r,a){super(),this.name=t,this.args=r,this.async=a}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};$.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 a,o;return super.optimizeNames(t,r),null==(a=this.catch)||a.optimizeNames(t,r),null==(o=this.finally)||o.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}},R=class extends m{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};R.kind="catch";var k=class extends m{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 a.Scope({parent:t}),this._nodes=[new y]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let a=this._extScope.value(t,r);return(this._values[a.prefix]||(this._values[a.prefix]=new Set)).add(a),a}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,a,o){let i=this._scope.toName(r);return void 0!==a&&o&&(this._constants[i.str]=a),this._leafNode(new s(t,i,a)),i}const(t,r,o){return this._def(a.varKinds.const,t,r,o)}let(t,r,o){return this._def(a.varKinds.let,t,r,o)}var(t,r,o){return this._def(a.varKinds.var,t,r,o)}assign(t,r,a){return this._leafNode(new l(t,r,a))}add(r,a){return this._leafNode(new c(r,t.operators.ADD,a))}code(t){return"function"==typeof t?t():t!==r.nil&&this._leafNode(new h(t)),this}object(...t){let a=["{"];for(let[o,i]of t)a.length>1&&a.push(","),a.push(o),(o!==i||this.opts.es5)&&(a.push(":"),(0,r.addCodeArg)(a,i));return a.push("}"),new r._Code(a)}if(t,r,a){if(this._blockNode(new v(t)),r&&a)this.code(r).else().code(a).endIf();else if(r)this.code(r).endIf();else if(a)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new v(t))}else(){return this._elseNode(new 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 _(t),r)}forRange(t,r,o,i,n=this.opts.es5?a.varKinds.var:a.varKinds.let){let s=this._scope.toName(t);return this._for(new S(n,s,r,o),()=>i(s))}forOf(t,o,i,n=a.varKinds.const){let s=this._scope.toName(t);if(this.opts.es5){let t=o instanceof r.Name?o:this.var("_arr",o);return this.forRange("_i",0,(0,r._)`${t}.length`,a=>{this.var(s,(0,r._)`${t}[${a}]`),i(s)})}return this._for(new w("of",n,s,o),()=>i(s))}forIn(t,o,i,n=this.opts.es5?a.varKinds.var:a.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,r._)`Object.keys(${o})`,i);let s=this._scope.toName(t);return this._for(new w("in",n,s,o),()=>i(s))}endFor(){return this._endBlockNode(b)}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,a){if(!r&&!a)throw Error('CodeGen: "try" without "catch" and "finally"');let o=new P;if(this._blockNode(o),this.code(t),r){let t=this.name("e");this._currNode=o.catch=new R(t),r(t)}return a&&(this._currNode=o.finally=new k,this.code(a)),this._endBlockNode(R,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 a=this._nodes.length-r;if(a<0||void 0!==t&&a!==t)throw Error(`CodeGen: wrong number of nodes: ${a} vs ${t} expected`);return this._nodes.length=r,this}func(t,a=r.nil,o,i){return this._blockNode(new $(t,a,o)),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 a=this._currNode;if(a instanceof t||r&&a instanceof r)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof v))throw Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};function T(t,r){for(let a in r)t[a]=(t[a]||0)+(r[a]||0);return t}function O(t,a){return a instanceof r._CodeOrName?T(t,a.names):t}function j(t,a,o){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===a[t.str]&&void 0!==o[t.str])))return t;return new r._Code(t._items.reduce((t,a)=>(a instanceof r.Name&&(a=n(a)),a instanceof r._Code?t.push(...a._items):t.push(a),t),[]));function n(t){let r=o[t.str];return void 0===r||1!==a[t.str]?t:(delete a[t.str],r)}}function C(t){return"boolean"==typeof t||"number"==typeof t||null===t?!t:(0,r._)`!${M(t)}`}t.CodeGen=x,t.not=C;let A=N(t.operators.AND);t.and=function(...t){return t.reduce(A)};let I=N(t.operators.OR);function N(t){return(a,o)=>a===r.nil?o:o===r.nil?a:(0,r._)`${M(a)} ${t} ${M(o)}`}function M(t){return t instanceof r.Name?t:(0,r._)`(${t})`}t.or=function(...t){return t.reduce(I)}}),m6=ds(t=>{var r,a;Object.defineProperty(t,"__esModule",{value:!0}),t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.setEvaluated=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.schemaHasRules=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;let o=m5(),i=m9();function n(t,r=t.schema){let{opts:a,self:o}=t;if(!a.strictSchema||"boolean"==typeof r)return;let i=o.RULES.keywords;for(let a in r)i[a]||f(t,`unknown keyword: "${a}"`)}function s(t,r){if("boolean"==typeof t)return!t;for(let a in t)if(r[a])return!0;return!1}function l(t){return"number"==typeof t?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}function c(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function u({mergeNames:t,mergeToName:r,mergeValues:a,resultToName:i}){return(n,s,l,c)=>{let u=void 0===l?s:l instanceof o.Name?(s instanceof o.Name?t(n,s,l):r(n,s,l),l):s instanceof o.Name?(r(n,l,s),s):a(s,l);return c!==o.Name||u instanceof o.Name?u:i(n,u)}}function d(t,r){if(!0===r)return t.var("props",!0);let a=t.var("props",(0,o._)`{}`);return void 0!==r&&p(t,a,r),a}function p(t,r,a){Object.keys(a).forEach(a=>t.assign((0,o._)`${r}${(0,o.getProperty)(a)}`,!0))}t.toHash=function(t){let r={};for(let a of t)r[a]=!0;return r},t.alwaysValidSchema=function(t,r){return"boolean"==typeof r?r:0===Object.keys(r).length||(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 a in t)if("$ref"!==a&&r.all[a])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:t,schemaPath:r},a,i,n){if(!n){if("number"==typeof a||"boolean"==typeof a)return a;if("string"==typeof a)return(0,o._)`${a}`}return(0,o._)`${t}${r}${(0,o.getProperty)(i)}`},t.unescapeFragment=function(t){return c(decodeURIComponent(t))},t.escapeFragment=function(t){return encodeURIComponent(l(t))},t.escapeJsonPointer=l,t.unescapeJsonPointer=c,t.eachItem=function(t,r){if(Array.isArray(t))for(let a of t)r(a);else r(t)},t.mergeEvaluated={props:u({mergeNames:(t,r,a)=>t.if((0,o._)`${a} !== true && ${r} !== undefined`,()=>{t.if((0,o._)`${r} === true`,()=>t.assign(a,!0),()=>t.assign(a,(0,o._)`${a} || {}`).code((0,o._)`Object.assign(${a}, ${r})`))}),mergeToName:(t,r,a)=>t.if((0,o._)`${a} !== true`,()=>{!0===r?t.assign(a,!0):(t.assign(a,(0,o._)`${a} || {}`),p(t,a,r))}),mergeValues:(t,r)=>!0===t||{...t,...r},resultToName:d}),items:u({mergeNames:(t,r,a)=>t.if((0,o._)`${a} !== true && ${r} !== undefined`,()=>t.assign(a,(0,o._)`${r} === true ? true : ${a} > ${r} ? ${a} : ${r}`)),mergeToName:(t,r,a)=>t.if((0,o._)`${a} !== true`,()=>t.assign(a,!0===r||(0,o._)`${a} > ${r} ? ${a} : ${r}`)),mergeValues:(t,r)=>!0===t||Math.max(t,r),resultToName:(t,r)=>t.var("items",r)})},t.evaluatedPropsToName=d,t.setEvaluated=p;let h={};function f(t,r,a=t.opts.strictSchema){if(a){if(r=`strict mode: ${r}`,!0===a)throw Error(r);t.self.logger.warn(r)}}t.useFunc=function(t,r){return t.scopeValue("func",{ref:r,code:h[r.code]||(h[r.code]=new i._Code(r.code))})},(a=r||(t.Type=r={}))[a.Num=0]="Num",a[a.Str=1]="Str",t.getErrorPath=function(t,a,i){if(t instanceof o.Name){let n=a===r.Num;return i?n?(0,o._)`"[" + ${t} + "]"`:(0,o._)`"['" + ${t} + "']"`:n?(0,o._)`"/" + ${t}`:(0,o._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return i?(0,o.getProperty)(t).toString():"/"+l(t)},t.checkStrictMode=f}),m3=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=m5();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")}}),m8=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;let r=m5(),a=m6(),o=m3();function i(t,a){let i=t.const("err",a);t.if((0,r._)`${o.default.vErrors} === null`,()=>t.assign(o.default.vErrors,(0,r._)`[${i}]`),(0,r._)`${o.default.vErrors}.push(${i})`),t.code((0,r._)`${o.default.errors}++`)}function n(t,a){let{gen:o,validateName:i,schemaEnv:n}=t;n.$async?o.throw((0,r._)`new ${t.ValidationError}(${a})`):(o.assign((0,r._)`${i}.errors`,a),o.return(!1))}t.keywordError={message:({keyword:t})=>(0,r.str)`must pass "${t}" keyword validation`},t.keyword$DataError={message:({keyword:t,schemaType:a})=>a?(0,r.str)`"${t}" keyword must be ${a} ($data)`:(0,r.str)`"${t}" keyword is invalid ($data)`},t.reportError=function(a,o=t.keywordError,s,c){let{it:u}=a,{gen:d,compositeRule:p,allErrors:h}=u,f=l(a,o,s);(null!=c?c:p||h)?i(d,f):n(u,(0,r._)`[${f}]`)},t.reportExtraError=function(r,a=t.keywordError,s){let{it:c}=r,{gen:u,compositeRule:d,allErrors:p}=c;i(u,l(r,a,s)),d||p||n(c,o.default.vErrors)},t.resetErrorsCount=function(t,a){t.assign(o.default.errors,a),t.if((0,r._)`${o.default.vErrors} !== null`,()=>t.if(a,()=>t.assign((0,r._)`${o.default.vErrors}.length`,a),()=>t.assign(o.default.vErrors,null)))},t.extendErrors=function({gen:t,keyword:a,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,o.default.errors,s=>{t.const(c,(0,r._)`${o.default.vErrors}[${s}]`),t.if((0,r._)`${c}.instancePath === undefined`,()=>t.assign((0,r._)`${c}.instancePath`,(0,r.strConcat)(o.default.instancePath,l.errorPath))),t.assign((0,r._)`${c}.schemaPath`,(0,r.str)`${l.errSchemaPath}/${a}`),l.opts.verbose&&(t.assign((0,r._)`${c}.schema`,i),t.assign((0,r._)`${c}.data`,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,a.getErrorPath)(i,a.Type.Str)}`:t;return[o.default.instancePath,(0,r.strConcat)(o.default.instancePath,n)]}(c,n),function({keyword:t,it:{errSchemaPath:o}},{schemaPath:i,parentSchema:n}){let l=n?o:(0,r.str)`${o}/${t}`;return i&&(l=(0,r.str)`${l}${(0,a.getErrorPath)(i,a.Type.Str)}`),[s.schemaPath,l]}(t,n)];return function(t,{params:a,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 a?a(t):a||(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}`],[o.default.data,c]),h&&n.push([s.propertyName,h])}(t,i,u),l.object(...u)}(t,i,n)}}),m7=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;let r=m8(),a=m5(),o=m3(),i={message:"boolean schema is false"};function n(t,a){let{gen:o,data:n}=t;(0,r.reportError)({gen:o,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t},i,void 0,a)}t.topBoolOrEmptySchema=function(t){let{gen:r,schema:i,validateName:s}=t;!1===i?n(t,!1):"object"==typeof i&&!0===i.$async?r.return(o.default.data):(r.assign((0,a._)`${s}.errors`,null),r.return(!0))},t.boolOrEmptySchema=function(t,r){let{gen:a,schema:o}=t;!1===o?(a.var(r,!1),n(t)):a.var(r,!0)}}),ye=ds(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:{}}}}),yt=ds(t=>{function r(t,r){return r.rules.some(r=>a(t,r))}function a(t,r){var a;return void 0!==t[r.keyword]||(null==(a=r.definition.implements)?void 0:a.some(r=>void 0!==t[r]))}Object.defineProperty(t,"__esModule",{value:!0}),t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0,t.schemaHasRulesForType=function({schema:t,self:a},o){let i=a.RULES.types[o];return i&&!0!==i&&r(t,i)},t.shouldUseGroup=r,t.shouldUseRule=a}),yr=ds(t=>{var r,a;Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;let o=ye(),i=yt(),n=m8(),s=m5(),l=m6();function c(t){let r=Array.isArray(t)?t:t?[t]:[];if(r.every(o.isJSONType))return r;throw Error("type must be JSONType or JSONType[]: "+r.join(","))}(a=r||(t.DataType=r={}))[a.Correct=0]="Correct",a[a.Wrong=1]="Wrong",t.getSchemaTypes=function(t){let r=c(t.type);if(r.includes("null")){if(!1===t.nullable)throw Error("type: null contradicts nullable: false")}else{if(!r.length&&void 0!==t.nullable)throw Error('"nullable" cannot be used without "type"');!0===t.nullable&&r.push("null")}return r},t.getJSONTypes=c,t.coerceAndCheckDataType=function(t,a){var o,n;let{gen:l,data:c,opts:d}=t,h=(o=a,(n=d.coerceTypes)?o.filter(t=>u.has(t)||"array"===n&&"array"===t):[]),m=a.length>0&&!(0===h.length&&1===a.length&&(0,i.schemaHasRulesForType)(t,a[0]));if(m){let o=p(a,c,d.strictNumbers,r.Wrong);l.if(o,()=>{h.length?function(t,r,a){let{gen:o,data:i,opts:n}=t,l=o.let("dataType",(0,s._)`typeof ${i}`),c=o.let("coerced",(0,s._)`undefined`);for(let t of("array"===n.coerceTypes&&o.if((0,s._)`${l} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>o.assign(i,(0,s._)`${i}[0]`).assign(l,(0,s._)`typeof ${i}`).if(p(r,i,n.strictNumbers),()=>o.assign(c,i))),o.if((0,s._)`${c} !== undefined`),a))(u.has(t)||"array"===t&&"array"===n.coerceTypes)&&function(t){switch(t){case"string":o.elseIf((0,s._)`${l} == "number" || ${l} == "boolean"`).assign(c,(0,s._)`"" + ${i}`).elseIf((0,s._)`${i} === null`).assign(c,(0,s._)`""`);return;case"number":o.elseIf((0,s._)`${l} == "boolean" || ${i} === null
|
|
64
|
+
|| (${l} == "string" && ${i} && ${i} == +${i})`).assign(c,(0,s._)`+${i}`);return;case"integer":o.elseIf((0,s._)`${l} === "boolean" || ${i} === null
|
|
65
|
+
|| (${l} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(c,(0,s._)`+${i}`);return;case"boolean":o.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":o.elseIf((0,s._)`${i} === "" || ${i} === 0 || ${i} === false`),o.assign(c,null);return;case"array":o.elseIf((0,s._)`${l} === "string" || ${l} === "number"
|
|
66
|
+
|| ${l} === "boolean" || ${i} === null`).assign(c,(0,s._)`[${i}]`)}}(t);o.else(),f(t),o.endIf(),o.if((0,s._)`${c} !== undefined`,()=>{o.assign(i,c),function({gen:t,parentData:r,parentDataProperty:a},o){t.if((0,s._)`${r} !== undefined`,()=>t.assign((0,s._)`${r}[${a}]`,o))}(t,c)})}(t,a,h):f(t)})}return m};let u=new Set(["string","number","integer","boolean","null"]);function d(t,a,o,i=r.Correct){let n,l=i===r.Correct?s.operators.EQ:s.operators.NEQ;switch(t){case"null":return(0,s._)`${a} ${l} null`;case"array":n=(0,s._)`Array.isArray(${a})`;break;case"object":n=(0,s._)`${a} && typeof ${a} == "object" && !Array.isArray(${a})`;break;case"integer":n=c((0,s._)`!(${a} % 1) && !isNaN(${a})`);break;case"number":n=c();break;default:return(0,s._)`typeof ${a} ${l} ${t}`}return i===r.Correct?n:(0,s.not)(n);function c(t=s.nil){return(0,s.and)((0,s._)`typeof ${a} == "number"`,t,o?(0,s._)`isFinite(${a})`:s.nil)}}function p(t,r,a,o){let i;if(1===t.length)return d(t[0],r,a,o);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,a,o));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:a,schema:o}=t,i=(0,l.schemaRefOrVal)(t,o,"type");return{gen:r,keyword:"type",data:a,schema:o.type,schemaCode:i,schemaValue:i,parentSchema:o,params:{},it:t}}(t);(0,n.reportError)(r,h)}t.reportTypeError=f}),ya=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;let r=m5(),a=m6();function o(t,o,i){let{gen:n,compositeRule:s,data:l,opts:c}=t;if(void 0===i)return;let u=(0,r._)`${l}${(0,r.getProperty)(o)}`;if(s)return void(0,a.checkStrictMode)(t,`default is ignored for: ${u}`);let d=(0,r._)`${u} === undefined`;"empty"===c.useDefaults&&(d=(0,r._)`${d} || ${u} === null || ${u} === ""`),n.if(d,(0,r._)`${u} = ${(0,r.stringify)(i)}`)}t.assignDefaults=function(t,r){let{properties:a,items:i}=t.schema;if("object"===r&&a)for(let r in a)o(t,r,a[r].default);else"array"===r&&Array.isArray(i)&&i.forEach((r,a)=>o(t,a,r.default))}}),yo=ds(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=m5(),a=m6(),o=m3(),i=m6();function n(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,r._)`Object.prototype.hasOwnProperty`})}function s(t,a,o){return(0,r._)`${n(t)}.call(${a}, ${o})`}function l(t,a,o,i){let n=(0,r._)`${a}${(0,r.getProperty)(o)} === undefined`;return i?(0,r.or)(n,(0,r.not)(s(t,a,o))):n}function c(t){return t?Object.keys(t).filter(t=>"__proto__"!==t):[]}t.checkReportMissingProp=function(t,a){let{gen:o,data:i,it:n}=t;o.if(l(o,i,a,n.opts.ownProperties),()=>{t.setParams({missingProperty:(0,r._)`${a}`},!0),t.error()})},t.checkMissingProp=function({gen:t,data:a,it:{opts:o}},i,n){return(0,r.or)(...i.map(i=>(0,r.and)(l(t,a,i,o.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,a,o,i){let n=(0,r._)`${a}${(0,r.getProperty)(o)} !== undefined`;return i?(0,r._)`${n} && ${s(t,a,o)}`:n},t.noPropertyInData=l,t.allSchemaProperties=c,t.schemaProperties=function(t,r){return c(r).filter(o=>!(0,a.alwaysValidSchema)(t,r[o]))},t.callValidateCode=function({schemaCode:t,data:a,it:{gen:i,topSchemaRef:n,schemaPath:s,errorPath:l},it:c},u,d,p){let h=p?(0,r._)`${t}, ${a}, ${n}${s}`:a,f=[[o.default.instancePath,(0,r.strConcat)(o.default.instancePath,l)],[o.default.parentData,c.parentData],[o.default.parentDataProperty,c.parentDataProperty],[o.default.rootData,o.default.rootData]];c.opts.dynamicRef&&f.push([o.default.dynamicAnchors,o.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:a}},o){let n=a.unicodeRegExp?"u":"",{regExp:s}=a.code,l=s(o,n);return t.scopeValue("pattern",{key:l.toString(),ref:l,code:(0,r._)`${"new RegExp"===s.code?u:(0,i.useFunc)(t,s)}(${o}, ${n})`})},t.validateArray=function(t){let{gen:o,data:i,keyword:n,it:s}=t,l=o.name("valid");if(s.allErrors){let t=o.let("valid",!0);return c(()=>o.assign(t,!1)),t}return o.var(l,!0),c(()=>o.break()),l;function c(s){let c=o.const("len",(0,r._)`${i}.length`);o.forRange("i",0,c,i=>{t.subschema({keyword:n,dataProp:i,dataPropType:a.Type.Num},l),o.if((0,r.not)(l),s)})}},t.validateUnion=function(t){let{gen:o,schema:i,keyword:n,it:s}=t;if(!Array.isArray(i))throw Error("ajv implementation error");if(i.some(t=>(0,a.alwaysValidSchema)(s,t))&&!s.opts.unevaluated)return;let l=o.let("valid",!1),c=o.name("_valid");o.block(()=>i.forEach((a,i)=>{let s=t.subschema({keyword:n,schemaProp:i,compositeRule:!0},c);o.assign(l,(0,r._)`${l} || ${c}`),t.mergeValidEvaluated(s,c)||o.if((0,r.not)(l))})),t.result(l,()=>t.reset(),()=>t.error(!0))}}),yi=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;let r=m5(),a=m3(),o=yo(),i=m8();function n(t){let{gen:a,data:o,it:i}=t;a.if(i.parentData,()=>a.assign(o,(0,r._)`${i.parentData}[${i.parentDataProperty}]`))}function s(t,a,o){if(void 0===o)throw Error(`keyword "${a}" failed to compile`);return t.scopeValue("keyword","function"==typeof o?{ref:o}:{ref:o,code:(0,r.stringify)(o)})}t.macroKeywordCode=function(t,a){let{gen:o,keyword:i,schema:n,parentSchema:l,it:c}=t,u=a.macro.call(c.self,n,l,c),d=s(o,i,u);!1!==c.opts.validateSchema&&c.self.validateSchema(u,!0);let p=o.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?a.default.this:a.default.self,s=!("compile"in l&&!f||!1===l.schema);u.assign(g,(0,r._)`${i}${(0,o.callValidateCode)(t,y,n,s)}`,l.modifying)}function b(t){var a;u.if((0,r.not)(null!=(a=l.valid)?a:g),t)}t.block$data(g,function(){if(!1===l.errors)v(),l.modifying&&n(t),b(()=>t.error());else{let o,s,c=l.async?(o=u.let("ruleErrs",null),u.try(()=>v((0,r._)`await `),t=>u.assign(g,!1).if((0,r._)`${t} instanceof ${m.ValidationError}`,()=>u.assign(o,(0,r._)`${t}.errors`),()=>u.throw(t))),o):(s=(0,r._)`${y}.errors`,u.assign(s,null),v(r.nil),s);l.modifying&&n(t),b(()=>(function(t,o){let{gen:n}=t;n.if((0,r._)`Array.isArray(${o})`,()=>{n.assign(a.default.vErrors,(0,r._)`${a.default.vErrors} === null ? ${o} : ${a.default.vErrors}.concat(${o})`).assign(a.default.errors,(0,r._)`${a.default.vErrors}.length`),(0,i.extendErrors)(t)},()=>t.error())})(t,c))}}),t.ok(null!=(c=l.valid)?c:g)},t.validSchemaType=function(t,r,a=!1){return!r.length||r.some(r=>"array"===r?Array.isArray(t):"object"===r?t&&"object"==typeof t&&!Array.isArray(t):typeof t==r||a&&void 0===t)},t.validateKeywordUsage=function({schema:t,opts:r,self:a,errSchemaPath:o},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 "${o}": `+a.errorsText(i.validateSchema.errors);if("log"===r.validateSchema)a.logger.error(t);else throw Error(t)}}}),yn=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;let r=m5(),a=m6();t.getSubschema=function(t,{keyword:o,schemaProp:i,schema:n,schemaPath:s,errSchemaPath:l,topSchemaRef:c}){if(void 0!==o&&void 0!==n)throw Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==o){let n=t.schema[o];return void 0===i?{schema:n,schemaPath:(0,r._)`${t.schemaPath}${(0,r.getProperty)(o)}`,errSchemaPath:`${t.errSchemaPath}/${o}`}:{schema:n[i],schemaPath:(0,r._)`${t.schemaPath}${(0,r.getProperty)(o)}${(0,r.getProperty)(i)}`,errSchemaPath:`${t.errSchemaPath}/${o}/${(0,a.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,o,{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}=o;if(void 0!==i){let{errorPath:s,dataPathArr:l,opts:c}=o;d(u.let("data",(0,r._)`${o.data}${(0,r.getProperty)(i)}`,!0)),t.errorPath=(0,r.str)`${s}${(0,a.getErrorPath)(i,n,c.jsPropertySyntax)}`,t.parentDataProperty=(0,r._)`${i}`,t.dataPathArr=[...l,t.parentDataProperty]}function d(r){t.data=r,t.dataLevel=o.dataLevel+1,t.dataTypes=[],o.definedProperties=new Set,t.parentData=o.data,t.dataNames=[...o.dataNames,r]}void 0!==s&&(d(s instanceof r.Name?s:u.let("data",s,!0)),void 0!==c&&(t.propertyName=c)),l&&(t.dataTypes=l)},t.extendSubschemaMode=function(t,{jtdDiscriminator:r,jtdMetadata:a,compositeRule:o,createErrors:i,allErrors:n}){void 0!==o&&(t.compositeRule=o),void 0!==i&&(t.createErrors=i),void 0!==n&&(t.allErrors=n),t.jtdDiscriminator=r,t.jtdMetadata=a}}),ys=ds((t,r)=>{r.exports=function t(r,a){if(r===a)return!0;if(r&&a&&"object"==typeof r&&"object"==typeof a){if(r.constructor!==a.constructor)return!1;if(Array.isArray(r)){if((o=r.length)!=a.length)return!1;for(i=o;0!=i--;)if(!t(r[i],a[i]))return!1;return!0}if(r.constructor===RegExp)return r.source===a.source&&r.flags===a.flags;if(r.valueOf!==Object.prototype.valueOf)return r.valueOf()===a.valueOf();if(r.toString!==Object.prototype.toString)return r.toString()===a.toString();if((o=(n=Object.keys(r)).length)!==Object.keys(a).length)return!1;for(i=o;0!=i--;)if(!Object.prototype.hasOwnProperty.call(a,n[i]))return!1;for(i=o;0!=i--;){var o,i,n,s=n[i];if(!t(r[s],a[s]))return!1}return!0}return r!=r&&a!=a}}),yl=ds((t,r)=>{var a=r.exports=function(t,r,o){"function"==typeof r&&(o=r,r={});var i="function"==typeof(o=r.cb||o)?o:o.pre||function(){};!function t(r,o,i,n,s,l,c,u,d,p){if(n&&"object"==typeof n&&!Array.isArray(n)){for(var h in o(n,s,l,c,u,d,p),n){var f=n[h];if(Array.isArray(f)){if(h in a.arrayKeywords)for(var m=0;m<f.length;m++)t(r,o,i,f[m],s+"/"+h+"/"+m,l,s,h,n,m)}else if(h in a.propsKeywords){if(f&&"object"==typeof f)for(var y in f)t(r,o,i,f[y],s+"/"+h+"/"+y.replace(/~/g,"~0").replace(/\//g,"~1"),l,s,h,n,y)}else(h in a.keywords||r.allKeys&&!(h in a.skipKeywords))&&t(r,o,i,f,s+"/"+h,l,s,h,n)}i(n,s,l,c,u,d,p)}}(r,i,o.post||function(){},t,"",t)};a.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},a.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},a.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},a.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0}}),yc=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;let r=m6(),a=ys(),o=yl(),i=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);t.inlineRef=function(t,a=!0){return"boolean"==typeof t||(!0===a?!function t(r){for(let a in r){if(n.has(a))return!0;let o=r[a];if(Array.isArray(o)&&o.some(t)||"object"==typeof o&&t(o))return!0}return!1}(t):!!a&&function t(a){let o=0;for(let n in a)if("$ref"===n||(o++,!i.has(n)&&("object"==typeof a[n]&&(0,r.eachItem)(a[n],r=>o+=t(r)),o===1/0)))return 1/0;return o}(t)<=a)};let n=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function s(t,r="",a){return!1!==a&&(r=u(r)),l(t,t.parse(r))}function l(t,r){return t.serialize(r).split("#")[0]+"#"}t.getFullPath=s,t._getFullPath=l;let c=/#\/?$/;function u(t){return t?t.replace(c,""):""}t.normalizeId=u,t.resolveUrl=function(t,r,a){return a=u(a),t.resolve(r,a)};let d=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(t,r){if("boolean"==typeof t)return{};let{schemaId:i,uriResolver:n}=this.opts,l=u(t[i]||r),c={"":l},p=s(n,l,!1),h={},f=new Set;return o(t,{allKeys:!0},(t,r,a,o)=>{if(void 0===o)return;let n=p+r,s=c[o];function l(r){let a=this.opts.uriResolver.resolve;if(r=u(s?a(s,r):r),f.has(r))throw y(r);f.add(r);let o=this.refs[r];return"string"==typeof o&&(o=this.refs[o]),"object"==typeof o?m(t,o.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,o){if(void 0!==r&&!a(t,r))throw y(o)}function y(t){return Error(`reference "${t}" resolves to more than one schema`)}}}),yu=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;let r=m7(),a=yr(),o=yt(),i=yr(),n=ya(),s=yi(),l=yn(),c=m5(),u=m3(),d=yc(),p=m6(),h=m8();function f({gen:t,validateName:r,schema:a,schemaEnv:o,opts:i},n){var s;i.code.es5?t.func(r,(0,c._)`${u.default.data}, ${u.default.valCxt}`,o.$async,()=>{var r,o;t.code((0,c._)`"use strict"; ${m(a,i)}`),r=t,o=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}`),o.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),o.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}}={}`)}`,o.$async,()=>t.code(m(a,i)).code(n))}function m(t,r){let a="object"==typeof t&&t[r.schemaId];return a&&(r.code.source||r.code.process)?(0,c._)`/*# sourceURL=${a} */`:c.nil}function y({schema:t,self:r}){if("boolean"==typeof t)return!t;for(let a in t)if(r.RULES.all[a])return!0;return!1}function g(t){return"boolean"!=typeof t.schema}function v(t){(0,p.checkUnknownRules)(t),function(t){let{schema:r,errSchemaPath:a,opts:o,self:i}=t;r.$ref&&o.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(r,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${a}"`)}(t)}function b(t,r){if(t.opts.jtd)return S(t,[],!1,r);let o=(0,a.getSchemaTypes)(t.schema);S(t,o,!(0,a.coerceAndCheckDataType)(t,o),r)}function _({gen:t,schemaEnv:r,schema:a,errSchemaPath:o,opts:i}){let n=a.$comment;if(!0===i.$comment)t.code((0,c._)`${u.default.self}.logger.log(${n})`);else if("function"==typeof i.$comment){let a=(0,c.str)`${o}/$comment`,i=t.scopeValue("root",{ref:r.root});t.code((0,c._)`${u.default.self}.opts.$comment(${n}, ${a}, ${i}.schema)`)}}function S(t,r,a,n){var s,l,d,h;let{gen:f,schema:m,data:y,allErrors:g,opts:v,self:b}=t,{RULES:_}=b;if(m.$ref&&(v.ignoreKeywordsWithRef||!(0,p.schemaHasRulesButRef)(m,_)))return void f.block(()=>R(t,"$ref",_.all.$ref.definition));function S(s){(0,o.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&&a&&(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 a=[];for(let o of t.dataTypes)$(r,o)?a.push(o):r.includes("integer")&&"number"===o&&a.push("integer");t.dataTypes=a}(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 a=t.self.RULES.all;for(let i in a){let n=a[i];if("object"==typeof n&&(0,o.shouldUseRule)(t.schema,n)){let{type:a}=n.definition;a.length&&!a.some(t=>{var a,o;return a=r,o=t,a.includes(o)||"number"===o&&a.includes("integer")})&&E(t,`missing type "${a.join(",")}" for keyword "${i}"`)}}}(s,s.dataTypes))),f.block(()=>{for(let t of _.rules)S(t);S(_.post)})}function w(t,r){let{gen:a,schema:i,opts:{useDefaults:s}}=t;s&&(0,n.assignDefaults)(t,r.type),a.block(()=>{for(let a of r.rules)(0,o.shouldUseRule)(i,a)&&R(t,a.keyword,a.definition,r.type)})}function $(t,r){return t.includes(r)||"integer"===r&&t.includes("number")}function E(t,r){let a=t.schemaEnv.baseId+t.errSchemaPath;r+=` at "${a}" (strictTypes)`,(0,p.checkStrictMode)(t,r,t.opts.strictTypes)}t.validateFunctionCode=function(t){g(t)&&(v(t),y(t))?function(t){let{schema:r,opts:a,gen:o}=t;f(t,()=>{a.$comment&&r.$comment&&_(t),function(t){let{schema:r,opts:a}=t;void 0!==r.default&&a.useDefaults&&a.strictSchema&&(0,p.checkStrictMode)(t,"default is ignored in the schema root")}(t),o.let(u.default.vErrors,null),o.let(u.default.errors,0),a.unevaluated&&function(t){let{gen:r,validateName:a}=t;t.evaluated=r.const("evaluated",(0,c._)`${a}.evaluated`),r.if((0,c._)`${t.evaluated}.dynamicProps`,()=>r.assign((0,c._)`${t.evaluated}.props`,(0,c._)`undefined`)),r.if((0,c._)`${t.evaluated}.dynamicItems`,()=>r.assign((0,c._)`${t.evaluated}.items`,(0,c._)`undefined`))}(t),b(t),function(t){let{gen:r,schemaEnv:a,validateName:o,ValidationError:i,opts:n}=t;a.$async?r.if((0,c._)`${u.default.errors} === 0`,()=>r.return(u.default.data),()=>r.throw((0,c._)`new ${i}(${u.default.vErrors})`)):(r.assign((0,c._)`${o}.errors`,u.default.vErrors),n.unevaluated&&function({gen:t,evaluated:r,props:a,items:o}){a instanceof c.Name&&t.assign((0,c._)`${r}.props`,a),o instanceof c.Name&&t.assign((0,c._)`${r}.items`,o)}(t),r.return((0,c._)`${u.default.errors} === 0`))}(t)})}(t):f(t,()=>(0,r.topBoolOrEmptySchema)(t))};var P=class{constructor(t,r,a){if((0,s.validateKeywordUsage)(t,r,a),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=a,this.data=t.data,this.schema=t.schema[a],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,p.schemaRefOrVal)(t,this.schema,a,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",T(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,s.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw Error(`${a} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:!1!==r.errors)&&(this.errsCount=t.gen.const("_errs",u.default.errors))}result(t,r,a){this.failResult((0,c.not)(t),r,a)}failResult(t,r,a){this.gen.if(t),a?a():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,c.not)(t),void 0,r)}fail(t){if(void 0===t){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,c._)`${r} !== undefined && (${(0,c.or)(this.invalid$data(),t)})`)}error(t,r,a){if(r){this.setParams(r),this._error(t,a),this.setParams({});return}this._error(t,a)}_error(t,r){(t?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,a=c.nil){this.gen.block(()=>{this.check$data(t,a),r()})}check$data(t=c.nil,r=c.nil){if(!this.$data)return;let{gen:a,schemaCode:o,schemaType:i,def:n}=this;a.if((0,c.or)((0,c._)`${o} === undefined`,r)),t!==c.nil&&a.assign(t,!0),(i.length||n.validateSchema)&&(a.elseIf(this.invalid$data()),this.$dataError(),t!==c.nil&&a.assign(t,!1)),a.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:a,def:o,it:n}=this;return(0,c.or)(function(){if(a.length){if(!(r instanceof c.Name))throw Error("ajv implementation error");let t=Array.isArray(a)?a:[a];return(0,c._)`${(0,i.checkDataTypes)(t,r,n.opts.strictNumbers,i.DataType.Wrong)}`}return c.nil}(),function(){if(o.validateSchema){let a=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,c._)`!${a}(${r})`}return c.nil}())}subschema(t,a){let o=(0,l.getSubschema)(this.it,t);(0,l.extendSubschemaData)(o,this.it,t),(0,l.extendSubschemaMode)(o,t);let i={...this.it,...o,items:void 0,props:void 0};return!function(t,a){if(g(t)&&(v(t),y(t)))return function(t,r){var a;let o,{schema:i,gen:n,opts:s}=t;s.$comment&&i.$comment&&_(t),(o=(a=t).schema[a.opts.schemaId])&&(a.baseId=(0,d.resolveUrl)(a.opts.uriResolver,a.baseId,o)),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);b(t,l),n.var(r,(0,c._)`${l} === ${u.default.errors}`)}(t,a);(0,r.boolOrEmptySchema)(t,a)}(i,a),i}mergeEvaluated(t,r){let{it:a,gen:o}=this;a.opts.unevaluated&&(!0!==a.props&&void 0!==t.props&&(a.props=p.mergeEvaluated.props(o,t.props,a.props,r)),!0!==a.items&&void 0!==t.items&&(a.items=p.mergeEvaluated.items(o,t.items,a.items,r)))}mergeValidEvaluated(t,r){let{it:a,gen:o}=this;if(a.opts.unevaluated&&(!0!==a.props||!0!==a.items))return o.if(r,()=>this.mergeEvaluated(t,c.Name)),!0}};function R(t,r,a,o){let i=new P(t,a,r);"code"in a?a.code(i,o):i.$data&&a.validate?(0,s.funcKeywordCode)(i,a):"macro"in a?(0,s.macroKeywordCode)(i,a):(a.compile||a.validate)&&(0,s.funcKeywordCode)(i,a)}t.KeywordCxt=P;let k=/^\/(?:[^~]|~0|~1)*$/,x=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function T(t,{dataLevel:r,dataNames:a,dataPathArr:o}){let i,n;if(""===t)return u.default.rootData;if("/"===t[0]){if(!k.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 o[r-c]}if(c>r)throw Error(l("data",c));if(n=a[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,a){return`Cannot access ${t} ${a} levels up, current level is ${r}`}}t.getData=T}),yd=ds(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}}}),yp=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=yc();t.default=class extends Error{constructor(t,a,o,i){super(i||`can't resolve reference ${o} from id ${a}`),this.missingRef=(0,r.resolveUrl)(t,a,o),this.missingSchema=(0,r.normalizeId)((0,r.getFullPath)(t,this.missingRef))}}}),yh=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;let r=m5(),a=yd(),o=m3(),i=yc(),n=m6(),s=yu();var l=class{constructor(t){var r;let a;this.refs={},this.dynamicAnchors={},"object"==typeof t.schema&&(a=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=null!=(r=t.baseId)?r:(0,i.normalizeId)(null==a?void 0:a[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=null==a?void 0:a.$async,this.refs={}}};function c(t){let 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:a.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:o.default.data,parentData:o.default.parentData,parentDataProperty:o.default.parentDataProperty,dataNames:[o.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 a=m.toString();l=`${m.scopeRefs(o.default.scope)}return ${a}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let i=Function(`${o.default.self}`,`${o.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:a,scopeValues:m._values}),this.opts.unevaluated){let{props:t,items:a}=g;i.evaluated={props:t instanceof r.Name?void 0:t,items:a instanceof r.Name?void 0:a,dynamicProps:t instanceof r.Name,dynamicItems:a instanceof r.Name},i.source&&(i.source.evaluated=(0,r.stringify)(i.evaluated))}return t.validate=i,t}catch(r){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),r}finally{this._compilations.delete(t)}}function u(t){return(0,i.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:c.call(this,t)}function d(t){for(let o of this._compilations){var r,a;if(r=o,a=t,r.schema===a.schema&&r.root===a.root&&r.baseId===a.baseId)return o}}function p(t,r){let a;for(;"string"==typeof(a=this.refs[r]);)r=a;return a||this.schemas[r]||h.call(this,t,r)}function h(t,r){let a=this.opts.uriResolver.parse(r),o=(0,i._getFullPath)(this.opts.uriResolver,a),n=(0,i.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&o===n)return m.call(this,a,t);let s=(0,i.normalizeId)(o),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,a,r)}if("object"==typeof(null==u?void 0:u.schema)){if(u.validate||c.call(this,u),s===(0,i.normalizeId)(r)){let{schema:r}=u,{schemaId:a}=this.opts,o=r[a];return o&&(n=(0,i.resolveUrl)(this.opts.uriResolver,n,o)),new l({schema:r,schemaId:a,root:t,baseId:n})}return m.call(this,a,u)}}t.SchemaEnv=l,t.compileSchema=c,t.resolveRef=function(t,r,a){var o;a=(0,i.resolveUrl)(this.opts.uriResolver,r,a);let n=t.refs[a];if(n)return n;let s=p.call(this,t,a);if(void 0===s){let i=null==(o=t.localRefs)?void 0:o[a],{schemaId:n}=this.opts;i&&(s=new l({schema:i,schemaId:n,root:t,baseId:r}))}if(void 0!==s)return t.refs[a]=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:a,root:o}){var s;let c;if((null==(s=t.fragment)?void 0:s[0])!=="/")return;for(let o of t.fragment.slice(1).split("/")){if("boolean"==typeof a)return;let t=a[(0,n.unescapeFragment)(o)];if(void 0===t)return;let s="object"==typeof(a=t)&&a[this.opts.schemaId];!f.has(o)&&s&&(r=(0,i.resolveUrl)(this.opts.uriResolver,r,s))}if("boolean"!=typeof a&&a.$ref&&!(0,n.schemaHasRulesButRef)(a,this.RULES)){let t=(0,i.resolveUrl)(this.opts.uriResolver,r,a.$ref);c=h.call(this,o,t)}let{schemaId:u}=this.opts;if((c=c||new l({schema:a,schemaId:u,root:o,baseId:r})).schema!==c.root.schema)return c}}),yf=ds((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}}),ym=ds((t,r)=>{let a=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),o=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function i(t){let r="",a=0,o=0;for(o=0;o<t.length;o++)if(48!==(a=t[o].charCodeAt(0))){if(!(a>=48&&a<=57||a>=65&&a<=70||a>=97&&a<=102))return"";r+=t[o];break}for(o+=1;o<t.length;o++){if(!((a=t[o].charCodeAt(0))>=48&&a<=57||a>=65&&a<=70||a>=97&&a<=102))return"";r+=t[o]}return r}function n(t){return t.length=0,!0}function s(t,r,a){if(t.length){let o=i(t);if(""===o)return a.error=!0,!1;r.push(o),t.length=0}return!0}function l(t){if(2>function(t,r){let a=0;for(let r=0;r<t.length;r++)":"===t[r]&&a++;return a}(t,":"))return{host:t,isIPV6:!1};let r=function(t){let r=0,a={error:!1,address:"",zone:""},o=[],l=[],c=!1,u=!1,d=s;for(let i=0;i<t.length;i++){let s=t[i];if("["!==s&&"]"!==s)if(":"===s){if(!0===c&&(u=!0),!d(l,o,a))break;if(++r>7){a.error=!0;break}i>0&&":"===t[i-1]&&(c=!0),o.push(":");continue}else if("%"===s){if(!d(l,o,a))break;d=n}else{l.push(s);continue}}return l.length&&(d===n?a.zone=l.join(""):u?o.push(l.join("")):o.push(i(l))),a.address=o.join(""),a}(t);if(r.error)return{host:t,isIPV6:!1};{let t=r.address,a=r.address;return r.zone&&(t+="%"+r.zone,a+="%25"+r.zone),{host:t,isIPV6:!0,escapedHost:a}}}r.exports={nonSimpleDomain:RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u),recomposeAuthority:function(t){let r=[];if(void 0!==t.userinfo&&(r.push(t.userinfo),r.push("@")),void 0!==t.host){let a=unescape(t.host);if(!o(a)){let r=l(a);a=!0===r.isIPV6?`[${r.escapedHost}]`:t.host}r.push(a)}return("number"==typeof t.port||"string"==typeof t.port)&&(r.push(":"),r.push(String(t.port))),r.length?r.join(""):void 0},normalizeComponentEncoding:function(t,r){let a=!0!==r?escape:unescape;return void 0!==t.scheme&&(t.scheme=a(t.scheme)),void 0!==t.userinfo&&(t.userinfo=a(t.userinfo)),void 0!==t.host&&(t.host=a(t.host)),void 0!==t.path&&(t.path=a(t.path)),void 0!==t.query&&(t.query=a(t.query)),void 0!==t.fragment&&(t.fragment=a(t.fragment)),t},removeDotSegments:function(t){let r=t,a=[],o=-1,i=0;for(;i=r.length;){if(1===i)if("."===r)break;else if("/"===r){a.push("/");break}else{a.push(r);break}if(2===i){if("."===r[0]){if("."===r[1])break;else if("/"===r[1]){r=r.slice(2);continue}}else if("/"===r[0]&&("."===r[1]||"/"===r[1])){a.push("/");break}}else if(3===i&&"/.."===r){0!==a.length&&a.pop(),a.push("/");break}if("."===r[0]){if("."===r[1]){if("/"===r[2]){r=r.slice(3);continue}}else if("/"===r[1]){r=r.slice(2);continue}}else if("/"===r[0]&&"."===r[1]){if("/"===r[2]){r=r.slice(2);continue}else if("."===r[2]&&"/"===r[3]){r=r.slice(3),0!==a.length&&a.pop();continue}}if(-1===(o=r.indexOf("/",1))){a.push(r);break}a.push(r.slice(0,o)),r=r.slice(o)}return a.join("")},isIPv4:o,isUUID:a,normalizeIPv6:l,stringArrayToHexStripped:i}}),yy=ds((t,r)=>{let{isUUID:a}=ym(),o=/([\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,a]=t.resourceName.split("?");t.path=r&&"/"!==r?r:void 0,t.query=a,t.resourceName=void 0}return t.fragment=void 0,t}},p={scheme:"wss",domainHost:d.domainHost,parse:d.parse,serialize:d.serialize},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 a=t.path.match(o);if(a){let o=r.scheme||t.scheme||"urn";t.nid=a[1].toLowerCase(),t.nss=a[2];let i=f(`${o}:${r.nid||t.nid}`);t.path=void 0,i&&(t=i.parse(t,r))}else t.error=t.error||"URN can not be parsed.";return t},serialize:function(t,r){if(void 0===t.nid)throw Error("URN without nid cannot be serialized");let a=r.scheme||t.scheme||"urn",o=t.nid.toLowerCase(),i=f(`${a}:${r.nid||o}`);i&&(t=i.serialize(t,r));let n=t,s=t.nss;return n.path=`${o||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&&a(t.uuid)||(t.error=t.error||"UUID is not valid."),t},serialize:function(t){return t.nss=(t.uuid||"").toLowerCase(),t},skipNormalize:!0}};function 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}}),yg=ds((t,r)=>{let{normalizeIPv6:a,removeDotSegments:o,recomposeAuthority:i,normalizeComponentEncoding:n,isIPv4:s,nonSimpleDomain:l}=ym(),{SCHEMES:c,getSchemeHandler:u}=yy();function d(t,r,a,i){let n={};return i||(t=f(p(t,a),a),r=f(p(r,a),a)),!(a=a||{}).tolerant&&r.scheme?(n.scheme=r.scheme,n.userinfo=r.userinfo,n.host=r.host,n.port=r.port,n.path=o(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=o(r.path||""),n.query=r.query):(r.path?("/"===r.path[0]?n.path=o(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=o(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 a={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},r),s=[],l=u(n.scheme||a.scheme);l&&l.serialize&&l.serialize(a,n),void 0!==a.path&&(n.skipEscape?a.path=unescape(a.path):(a.path=escape(a.path),void 0!==a.scheme&&(a.path=a.path.split("%3A").join(":")))),"suffix"!==n.reference&&a.scheme&&s.push(a.scheme,":");let c=i(a);if(void 0!==c&&("suffix"!==n.reference&&s.push("//"),s.push(c),a.path&&"/"!==a.path[0]&&s.push("/")),void 0!==a.path){let t=a.path;n.absolutePath||l&&l.absolutePath||(t=o(t)),void 0===c&&"/"===t[0]&&"/"===t[1]&&(t="/%2F"+t.slice(2)),s.push(t)}return void 0!==a.query&&s.push("?",a.query),void 0!==a.fragment&&s.push("#",a.fragment),s.join("")}let h=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function f(t,r){let o=Object.assign({},r),i={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1;"suffix"===o.reference&&(t=o.scheme?o.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=a(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",o.reference&&"suffix"!==o.reference&&o.reference!==i.reference&&(i.error=i.error||"URI is not a "+o.reference+" reference.");let r=u(o.scheme||i.scheme);if(!o.unicodeSupport&&(!r||!r.unicodeSupport)&&i.host&&(o.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,o)}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,a){let o=a?Object.assign({scheme:"null"},a):{scheme:"null"},i=d(f(t,o),f(r,o),o,!0);return o.skipEscape=!0,p(i,o)},resolveComponent:d,equal:function(t,r,a){return"string"==typeof t?t=p(n(f(t=unescape(t),a),!0),{...a,skipEscape:!0}):"object"==typeof t&&(t=p(n(t,!0),{...a,skipEscape:!0})),"string"==typeof r?r=p(n(f(r=unescape(r),a),!0),{...a,skipEscape:!0}):"object"==typeof r&&(r=p(n(r,!0),{...a,skipEscape:!0})),t.toLowerCase()===r.toLowerCase()},serialize:p,parse:f};r.exports=m,r.exports.default=m,r.exports.fastUri=m}),yv=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=yg();r.code='require("ajv/dist/runtime/uri").default',t.default=r}),yb=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var r=yu();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return r.KeywordCxt}});var a=m5();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return a._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return a.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return a.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return a.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return a.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return a.CodeGen}});let o=yd(),i=yp(),n=ye(),s=yh(),l=m5(),c=yc(),u=yr(),d=m6(),p=yf(),h=yv(),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 b=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...function(t){var r,a,o,i,n,s,l,c,u,d,p,m,y,g,v,b,_,S,w,$,E,P,R,k,x;let T=t.strict,O=null==(r=t.code)?void 0:r.optimize,j=!0===O||void 0===O?1:O||0,C=null!=(o=null==(a=t.code)?void 0:a.regExp)?o:f,A=null!=(i=t.uriResolver)?i: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!=(m=null!=(p=t.strictTuples)?p:T)?m:"log",strictRequired:null!=(g=null!=(y=t.strictRequired)?y:T)&&g,code:t.code?{...t.code,optimize:j,regExp:C}:{optimize:j,regExp:C},loopRequired:null!=(v=t.loopRequired)?v:200,loopEnum:null!=(b=t.loopEnum)?b:200,meta:null==(_=t.meta)||_,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==(R=t.validateFormats)||R,unicodeRegExp:null==(k=t.unicodeRegExp)||k,int32range:null==(x=t.int32range)||x,uriResolver:A}}(t)};const{es5:r,lines:a}=this.opts.code;this.scope=new l.ValueScope({scope:{},prefixes:y,es5:r,lines:a}),this.logger=function(t){if(!1===t)return R;if(void 0===t)return console;if(t.log&&t.warn&&t.error)return t;throw Error("logger must implement log, warn and error methods")}(t.logger);const o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,n.getRules)(),_.call(this,g,t,"NOT SUPPORTED"),_.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=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:a}=this.opts,o=p;"id"===a&&((o={...p}).id=o.$id,delete o.$id),r&&t&&this.addMetaSchema(o,o[a],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta="object"==typeof t?t[r]||t:void 0}validate(t,r){let a;if("string"==typeof t){if(!(a=this.getSchema(t)))throw Error(`no schema with key or ref "${t}"`)}else a=this.compile(t);let o=a(r);return"$async"in a||(this.errors=a.errors),o}compile(t,r){let a=this._addSchema(t,r);return a.validate||this._compileSchemaEnv(a)}compileAsync(t,r){if("function"!=typeof this.opts.loadSchema)throw Error("options.loadSchema should be a function");let{loadSchema:a}=this.opts;return o.call(this,t,r);async function o(t,r){await n.call(this,t.$schema);let a=this._addSchema(t,r);return a.validate||s.call(this,a)}async function n(t){t&&!this.getSchema(t)&&await o.call(this,{$ref:t},!0)}async function s(t){try{return this._compileSchemaEnv(t)}catch(r){if(!(r instanceof i.default))throw r;return l.call(this,r),await c.call(this,r.missingSchema),s.call(this,t)}}function l({missingSchema:t,missingRef:r}){if(this.refs[t])throw Error(`AnySchema ${t} is loaded but ${r} cannot be resolved`)}async function c(t){let a=await u.call(this,t);this.refs[t]||await n.call(this,a.$schema),this.refs[t]||this.addSchema(a,t,r)}async function u(t){let r=this._loading[t];if(r)return r;try{return await (this._loading[t]=a(t))}finally{delete this._loading[t]}}}addSchema(t,r,a,o=this.opts.validateSchema){let i;if(Array.isArray(t)){for(let r of t)this.addSchema(r,void 0,a,o);return this}if("object"==typeof t){let{schemaId:r}=this.opts;if(void 0!==(i=t[r])&&"string"!=typeof i)throw Error(`schema ${r} must be string`)}return r=(0,c.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(t,a,r,o,!0),this}addMetaSchema(t,r,a=this.opts.validateSchema){return this.addSchema(t,r,!0,a),this}validateSchema(t,r){let a;if("boolean"==typeof t)return!0;if(void 0!==(a=t.$schema)&&"string"!=typeof a)throw Error("$schema must be a string");if(!(a=a||this.opts.defaultMeta||this.defaultMeta()))return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(a,t);if(!o&&r){let t="schema is invalid: "+this.errorsText();if("log"===this.opts.validateSchema)this.logger.error(t);else throw Error(t)}return o}getSchema(t){let r;for(;"string"==typeof(r=S.call(this,t));)t=r;if(void 0===r){let{schemaId:a}=this.opts,o=new s.SchemaEnv({schema:{},schemaId:a});if(!(r=s.resolveSchema.call(this,o,t)))return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=S.call(this,t);return"object"==typeof r&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{this._cache.delete(t);let r=t[this.opts.schemaId];return r&&(r=(0,c.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let a;if("string"==typeof t)a=t,"object"==typeof r&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=a);else if("object"==typeof t&&void 0===r){if(Array.isArray(a=(r=t).keyword)&&!a.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(x.call(this,a,r),!r)return(0,d.eachItem)(a,t=>T.call(this,t)),this;j.call(this,r);let o={...r,type:(0,u.getJSONTypes)(r.type),schemaType:(0,u.getJSONTypes)(r.schemaType)};return(0,d.eachItem)(a,0===o.type.length?t=>T.call(this,t,o):t=>o.type.forEach(r=>T.call(this,t,o,r))),this}getKeyword(t){let r=this.RULES.all[t];return"object"==typeof r?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;for(let a of(delete r.keywords[t],delete r.all[t],r.rules)){let r=a.rules.findIndex(r=>r.keyword===t);r>=0&&a.rules.splice(r,1)}return this}addFormat(t,r){return"string"==typeof r&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:a="data"}={}){return t&&0!==t.length?t.map(t=>`${a}${t.instancePath} ${t.message}`).reduce((t,a)=>t+r+a):"No errors"}$dataMetaSchema(t,r){let a=this.RULES.all;for(let o of(t=JSON.parse(JSON.stringify(t)),r)){let r=o.split("/").slice(1),i=t;for(let t of r)i=i[t];for(let t in a){let r=a[t];if("object"!=typeof r)continue;let{$data:o}=r.definition,n=i[t];o&&n&&(i[t]=A(n))}}return t}_removeAllSchemas(t,r){for(let a in t){let o=t[a];(!r||r.test(a))&&("string"==typeof o?delete t[a]:o&&!o.meta&&(this._cache.delete(o.schema),delete t[a]))}}_addSchema(t,r,a,o=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;a=(0,c.normalizeId)(n||a);let d=c.getSchemaRefs.call(this,t,a);return u=new s.SchemaEnv({schema:t,schemaId:l,meta:r,baseId:a,localRefs:d}),this._cache.set(u.schema,u),i&&!a.startsWith("#")&&(a&&this._checkUnique(a),this.refs[a]=u),o&&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 _(t,r,a,o="error"){for(let i in t)i in r&&this.logger[o](`${a}: 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 a=t[r];a.keyword||(a.keyword=r),this.addKeyword(a)}}function P(){let t={...this.opts};for(let r of m)delete t[r];return t}b.ValidationError=o.default,b.MissingRefError=i.default,t.default=b;let R={log(){},warn(){},error(){}},k=/^[a-z_$][a-z0-9_$:-]*$/i;function x(t,r){let{RULES:a}=this;if((0,d.eachItem)(t,t=>{if(a.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,a){var o;let i=null==r?void 0:r.post;if(a&&i)throw Error('keyword with "post" flag cannot have "type"');let{RULES:n}=this,s=i?n.post:n.rules.find(({type:t})=>t===a);if(s||(s={type:a,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==(o=r.implements)||o.forEach(t=>this.addKeyword(t))}function O(t,r,a){let o=t.rules.findIndex(t=>t.keyword===a);o>=0?t.rules.splice(o,0,r):(t.rules.push(r),this.logger.warn(`rule ${a} is not defined`))}function j(t){let{metaSchema:r}=t;void 0!==r&&(t.$data&&this.opts.$data&&(r=A(r)),t.validateSchema=this.compile(r,!0))}let C={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function A(t){return{anyOf:[t,C]}}}),y_=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}}}),yS=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;let r=yp(),a=yo(),o=m5(),i=m3(),n=yh(),s=m6();function l(t,r){let{gen:a}=t;return r.validate?a.scopeValue("validate",{ref:r.validate}):(0,o._)`${a.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:o.nil;function m(t){let r=(0,o._)`${t}.errors`;c.assign(i.default.vErrors,(0,o._)`${i.default.vErrors} === null ? ${r} : ${i.default.vErrors}.concat(${r})`),c.assign(i.default.errors,(0,o._)`${i.default.vErrors}.length`)}function y(t){var r;if(!u.opts.unevaluated)return;let a=null==(r=null==n?void 0:n.validate)?void 0:r.evaluated;if(!0!==u.props)if(a&&!a.dynamicProps)void 0!==a.props&&(u.props=s.mergeEvaluated.props(c,a.props,u.props));else{let r=c.var("props",(0,o._)`${t}.evaluated.props`);u.props=s.mergeEvaluated.props(c,r,u.props,o.Name)}if(!0!==u.items)if(a&&!a.dynamicItems)void 0!==a.items&&(u.items=s.mergeEvaluated.items(c,a.items,u.items));else{let r=c.var("items",(0,o._)`${t}.evaluated.items`);u.items=s.mergeEvaluated.items(c,r,u.items,o.Name)}}l?function(){if(!p.$async)throw Error("async schema referenced by sync schema");let i=c.let("valid");c.try(()=>{c.code((0,o._)`await ${(0,a.callValidateCode)(t,r,f)}`),y(r),d||c.assign(i,!0)},t=>{c.if((0,o._)`!(${t} instanceof ${u.ValidationError})`,()=>c.throw(t)),m(t),d||c.assign(i,!1)}),t.ok(i)}():t.result((0,a.callValidateCode)(t,r,f),()=>y(r),()=>m(r))}t.getValidate=l,t.callRef=c,t.default={keyword:"$ref",schemaType:"string",code(t){var a,i;let s,u,d,{gen:p,schema:h,it:f}=t,{baseId:m,schemaEnv:y,validateName:g,opts:v,self:b}=f,{root:_}=y;if(("#"===h||"#/"===h)&&m===_.baseId){if(y===_)return c(t,g,y,y.$async);let r=p.scopeValue("root",{ref:_});return c(t,(0,o._)`${r}.validate`,_,_.$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,a=S),a,a.$async):(i=S,s=p.scopeValue("schema",!0===v.code.source?{ref:i,code:(0,o.stringify)(i)}:{ref:i}),u=p.name("valid"),d=t.subschema({schema:i,dataTypes:[],schemaPath:o.nil,topSchemaRef:s,errSchemaPath:h},u),void(t.mergeEvaluated(d),t.ok(u)))}}}),yw=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=y_(),a=yS();t.default=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",r.default,a.default]}),y$=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=m5(),a=r.operators,o={maximum:{okStr:"<=",ok:a.LTE,fail:a.GT},minimum:{okStr:">=",ok:a.GTE,fail:a.LT},exclusiveMaximum:{okStr:"<",ok:a.LT,fail:a.GTE},exclusiveMinimum:{okStr:">",ok:a.GT,fail:a.LTE}};t.default={keyword:Object.keys(o),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:a})=>(0,r.str)`must be ${o[t].okStr} ${a}`,params:({keyword:t,schemaCode:a})=>(0,r._)`{comparison: ${o[t].okStr}, limit: ${a}}`},code(t){let{keyword:a,data:i,schemaCode:n}=t;t.fail$data((0,r._)`${i} ${o[a].fail} ${n} || isNaN(${i})`)}}}),yE=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=m5();t.default={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:t})=>(0,r.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,r._)`{multipleOf: ${t}}`},code(t){let{gen:a,data:o,schemaCode:i,it:n}=t,s=n.opts.multipleOfPrecision,l=a.let("res"),c=s?(0,r._)`Math.abs(Math.round(${l}) - ${l}) > 1e-${s}`:(0,r._)`${l} !== parseInt(${l})`;t.fail$data((0,r._)`(${i} === 0 || (${l} = ${o}/${i}, ${c}))`)}}}),yP=ds(t=>{function r(t){let r,a=t.length,o=0,i=0;for(;i<a;)o++,(r=t.charCodeAt(i++))>=55296&&r<=56319&&i<a&&(64512&(r=t.charCodeAt(i)))==56320&&i++;return o}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,r.code='require("ajv/dist/runtime/ucs2length").default'}),yR=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=m5(),a=m6(),o=yP();t.default={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:a})=>(0,r.str)`must NOT have ${"maxLength"===t?"more":"fewer"} than ${a} characters`,params:({schemaCode:t})=>(0,r._)`{limit: ${t}}`},code(t){let{keyword:i,data: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,a.useFunc)(t.gen,o.default)}(${n})`;t.fail$data((0,r._)`${u} ${c} ${s}`)}}}),yk=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=yo(),a=m6(),o=m5();t.default={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,o.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,o._)`{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,o._)`new RegExp`:(0,a.useFunc)(i,r),l=i.let("valid");i.try(()=>i.assign(l,(0,o._)`${s}(${c}, ${d}).test(${n})`),()=>i.assign(l,!1)),t.fail$data((0,o._)`!${l}`)}else{let a=(0,r.usePattern)(t,l);t.fail$data((0,o._)`!${a}.test(${n})`)}}}}),yx=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=m5();t.default={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:a})=>(0,r.str)`must NOT have ${"maxProperties"===t?"more":"fewer"} than ${a} properties`,params:({schemaCode:t})=>(0,r._)`{limit: ${t}}`},code(t){let{keyword:a,data:o,schemaCode:i}=t,n="maxProperties"===a?r.operators.GT:r.operators.LT;t.fail$data((0,r._)`Object.keys(${o}).length ${n} ${i}`)}}}),yT=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=yo(),a=m5(),o=m6();t.default={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:t}})=>(0,a.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,a._)`{missingProperty: ${t}}`},code(t){let{gen:i,schema: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(a.nil,h);else for(let a of n)(0,r.checkReportMissingProp)(t,a)}():function(){let o=i.let("missing");if(p||c){let n=i.let("valid",!0);t.block$data(n,()=>{var c,u;return c=o,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,a.not)(u),()=>{t.error(),i.break()})},a.nil))}),t.ok(n)}else i.if((0,r.checkMissingProp)(t,n,o)),(0,r.reportMissingProp)(t,o),i.else()}(),d.strictRequired){let r=t.parentSchema.properties,{definedProperties:a}=t.it;for(let t of n)if((null==r?void 0:r[t])===void 0&&!a.has(t)){let r=`required property "${t}" is not defined at "${u.schemaEnv.baseId+u.errSchemaPath}" (strictRequired)`;(0,o.checkStrictMode)(u,r,u.opts.strictRequired)}}function h(){i.forOf("prop",s,a=>{t.setParams({missingProperty:a}),i.if((0,r.noPropertyInData)(i,l,a,d.ownProperties),()=>t.error())})}}}}),yO=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=m5();t.default={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:a})=>(0,r.str)`must NOT have ${"maxItems"===t?"more":"fewer"} than ${a} items`,params:({schemaCode:t})=>(0,r._)`{limit: ${t}}`},code(t){let{keyword:a,data:o,schemaCode:i}=t,n="maxItems"===a?r.operators.GT:r.operators.LT;t.fail$data((0,r._)`${o}.length ${n} ${i}`)}}}),yj=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ys();r.code='require("ajv/dist/runtime/equal").default',t.default=r}),yC=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=yr(),a=m5(),o=m6(),i=yj();t.default={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:t,j:r}})=>(0,a.str)`must NOT have duplicate items (items ## ${r} and ${t} are identical)`,params:({params:{i:t,j:r}})=>(0,a._)`{i: ${t}, j: ${r}}`},code(t){let{gen: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,a._)`${s}.length`),c=n.let("j");t.setParams({i:l,j:c}),n.assign(h,!0),n.if((0,a._)`${l} > 1`,()=>(f.length>0&&!f.some(t=>"object"===t||"array"===t)?function(o,i){let l=n.name("item"),c=(0,r.checkDataTypes)(f,l,p.opts.strictNumbers,r.DataType.Wrong),u=n.const("indices",(0,a._)`{}`);n.for((0,a._)`;${o}--;`,()=>{n.let(l,(0,a._)`${s}[${o}]`),n.if(c,(0,a._)`continue`),f.length>1&&n.if((0,a._)`typeof ${l} == "string"`,(0,a._)`${l} += "_"`),n.if((0,a._)`typeof ${u}[${l}] == "number"`,()=>{n.assign(i,(0,a._)`${u}[${l}]`),t.error(),n.assign(h,!1).break()}).code((0,a._)`${u}[${l}] = ${o}`)})}:function(r,l){let c=(0,o.useFunc)(n,i.default),u=n.name("outer");n.label(u).for((0,a._)`;${r}--;`,()=>n.for((0,a._)`${l} = ${r}; ${l}--;`,()=>n.if((0,a._)`${c}(${s}[${r}], ${s}[${l}])`,()=>{t.error(),n.assign(h,!1).break(u)})))})(l,c))},(0,a._)`${d} === false`),t.ok(h)}}}),yA=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=m5(),a=m6(),o=yj();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,a.useFunc)(i,o.default)}(${n}, ${l})`):t.fail((0,r._)`${c} !== ${n}`)}}}),yI=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=m5(),a=m6(),o=yj();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,a.useFunc)(s,o.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((a,o)=>{var i,n;let s;return i=t,"object"==typeof(s=u[n=o])&&null!==s?(0,r._)`${f()}(${l}, ${i}[${n}])`:(0,r._)`${l} === ${s}`}))}t.pass(n)}}}),yN=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=y$(),a=yE(),o=yR(),i=yk(),n=yx(),s=yT(),l=yO(),c=yC(),u=yA(),d=yI();t.default=[r.default,a.default,o.default,i.default,n.default,s.default,l.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,d.default]}),yM=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;let r=m5(),a=m6();function o(t,o){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:o.length}),t.pass((0,r._)`${u} <= ${o.length}`);else if("object"==typeof n&&!(0,a.alwaysValidSchema)(c,n)){let n=i.var("valid",(0,r._)`${u} <= ${o.length}`);i.if((0,r.not)(n),()=>{var s;return s=n,void i.forRange("i",o.length,u,o=>{t.subschema({keyword:l,dataProp:o,dataPropType:a.Type.Num},s),c.allErrors||i.if((0,r.not)(s),()=>i.break())})}),t.ok(n)}}t.validateAdditionalItems=o,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)?o(t,n):(0,a.checkStrictMode)(i,'"additionalItems" is ignored when "items" is not an array of schemas')}}}),yq=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;let r=m5(),a=m6(),o=yo();function i(t,o,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[o]);if(r.strictTuples&&!l){let t=`"${u}" is ${s}-tuple, but minItems or maxItems/${o} are not specified or different at path "${i}"`;(0,a.checkStrictMode)(d,t,r.strictTuples)}})(l),d.opts.unevaluated&&n.length&&!0!==d.items&&(d.items=a.mergeEvaluated.items(s,n.length,d.items));let p=s.name("valid"),h=s.const("len",(0,r._)`${c}.length`);n.forEach((o,i)=>{(0,a.alwaysValidSchema)(d,o)||(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,a.alwaysValidSchema)(n,r)||t.ok((0,o.validateArray)(t))}}}),yz=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=yq();t.default={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,r.validateTuple)(t,"items")}}),yD=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=m5(),a=m6(),o=yo(),i=yM();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,a.alwaysValidSchema)(s,r)||(l?(0,i.validateAdditionalItems)(t,l):t.ok((0,o.validateArray)(t)))}}}),yL=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=m5(),a=m6();t.default={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:t,max:a}})=>void 0===a?(0,r.str)`must contain at least ${t} valid item(s)`:(0,r.str)`must contain at least ${t} and no more than ${a} valid item(s)`,params:({params:{min:t,max:a}})=>void 0===a?(0,r._)`{minContains: ${t}}`:(0,r._)`{minContains: ${t}, maxContains: ${a}}`},code(t){let o,i,{gen:n,schema:s,parentSchema:l,data:c,it:u}=t,{minContains:d,maxContains:p}=l;u.opts.next?(o=void 0===d?1:d,i=p):o=1;let h=n.const("len",(0,r._)`${c}.length`);if(t.setParams({min:o,max:i}),void 0===i&&0===o)return void(0,a.checkStrictMode)(u,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==i&&o>i){(0,a.checkStrictMode)(u,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,a.alwaysValidSchema)(u,s)){let a=(0,r._)`${h} >= ${o}`;void 0!==i&&(a=(0,r._)`${a} && ${h} <= ${i}`),t.pass(a);return}u.items=!0;let f=n.name("valid");function m(){let t=n.name("_valid"),a=n.let("count",0);y(t,()=>n.if(t,()=>{var t;return t=a,void(n.code((0,r._)`${t}++`),void 0===i?n.if((0,r._)`${t} >= ${o}`,()=>n.assign(f,!0).break()):(n.if((0,r._)`${t} > ${i}`,()=>n.assign(f,!1).break()),1===o?n.assign(f,!0):n.if((0,r._)`${t} >= ${o}`,()=>n.assign(f,!0))))}))}function y(r,o){n.forRange("i",0,h,i=>{t.subschema({keyword:"contains",dataProp:i,dataPropType:a.Type.Num,compositeRule:!0},r),o()})}void 0===i&&1===o?y(f,()=>n.if(f,()=>n.break())):0===o?(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())}}}),yU=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;let r=m5(),a=m6(),o=yo();t.error={message:({params:{property:t,depsCount:a,deps:o}})=>(0,r.str)`must have ${1===a?"property":"properties"} ${o} when property ${t} is present`,params:({params:{property:t,depsCount:a,deps:o,missingProperty:i}})=>(0,r._)`{property: ${t},
|
|
65
67
|
missingProperty: ${i},
|
|
66
|
-
depsCount: ${
|
|
67
|
-
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);s(t,r),n(t,o)}};function s(t,o=t.schema){let{gen:i,data:n,it:l}=t;if(0===Object.keys(o).length)return;let c=i.let("missing");for(let s in o){let u=o[s];if(0===u.length)continue;let d=(0,a.propertyInData)(i,n,s,l.opts.ownProperties);t.setParams({property:s,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 n(t,r=t.schema){let{gen:i,data:s,keyword:l,it:c}=t,u=i.name("valid");for(let n in r)(0,o.alwaysValidSchema)(c,r[n])||(i.if((0,a.propertyInData)(i,s,n,c.opts.ownProperties),()=>{let r=t.subschema({keyword:l,schemaProp:n},u);t.mergeValidEvaluated(r,u)},()=>i.var(u,!0)),t.ok(u))}t.validatePropertyDeps=s,t.validateSchemaDeps=n,t.default=i}),hD=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=p9(),o=p4();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:s,it:n}=t;if((0,o.alwaysValidSchema)(n,i))return;let l=a.name("valid");a.forIn("key",s,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),n.allErrors||a.break()})}),t.ok(l)}}}),hU=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hr(),o=p9(),a=p5(),i=p4();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:s,schema:n,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,n))return;let f=(0,r.allSchemaProperties)(l.properties),m=(0,r.allSchemaProperties)(l.patternProperties);function y(t){s.code((0,o._)`delete ${c}[${t}]`)}function g(r){if("all"===h.removeAdditional||h.removeAdditional&&!1===n)return void y(r);if(!1===n){t.setParams({additionalProperty:r}),t.error(),p||s.break();return}if("object"==typeof n&&!(0,i.alwaysValidSchema)(d,n)){let a=s.name("valid");"failing"===h.removeAdditional?(v(r,a,!1),s.if((0,o.not)(a),()=>{t.reset(),y(r)})):(v(r,a),p||s.if((0,o.not)(a),()=>s.break()))}}function v(r,o,a){let s={keyword:"additionalProperties",dataProp:r,dataPropType:i.Type.Str};!1===a&&Object.assign(s,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(s,o)}s.forIn("key",c,a=>{f.length||m.length?s.if(function(a){let n;if(f.length>8){let t=(0,i.schemaRefOrVal)(d,l.properties,"properties");n=(0,r.isOwnProperty)(s,t,a)}else n=f.length?(0,o.or)(...f.map(t=>(0,o._)`${a} === ${t}`)):o.nil;return m.length&&(n=(0,o.or)(n,...m.map(i=>(0,o._)`${(0,r.usePattern)(t,i)}.test(${a})`))),(0,o.not)(n)}(a),()=>g(a)):g(a)}),t.ok((0,o._)`${u} === ${a.default.errors}`)}}}),hV=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hl(),o=hr(),a=p4(),i=hU();t.default={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:s,schema:n,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)(n);for(let t of d)u.definedProperties.add(t);u.opts.unevaluated&&d.length&&!0!==u.props&&(u.props=a.mergeEvaluated.props(s,(0,a.toHash)(d),u.props));let p=d.filter(t=>!(0,a.alwaysValidSchema)(u,n[t]));if(0===p.length)return;let h=s.name("valid");for(let r of p){var f;(f=r,u.opts.useDefaults&&!u.compositeRule&&void 0!==n[f].default)?m(r):(s.if((0,o.propertyInData)(s,c,r,u.opts.ownProperties)),m(r),u.allErrors||s.else().var(h,!0),s.endIf()),t.it.definedProperties.add(r),t.ok(h)}function m(r){t.subschema({keyword:"properties",schemaProp:r,dataProp:r},h)}}}}),hF=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hr(),o=p9(),a=p4(),i=p4();t.default={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:s,schema:n,data:l,parentSchema:c,it:u}=t,{opts:d}=u,p=(0,r.allSchemaProperties)(n),h=p.filter(t=>(0,a.alwaysValidSchema)(u,n[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=s.name("valid");!0===u.props||u.props instanceof o.Name||(u.props=(0,i.evaluatedPropsToName)(s,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):(s.var(m,!0),g(t),s.if(m));function g(a){s.forIn("key",l,n=>{s.if((0,o._)`${(0,r.usePattern)(t,a)}.test(${n})`,()=>{let r=h.includes(a);r||t.subschema({keyword:"patternProperties",schemaProp:a,dataProp:n,dataPropType:i.Type.Str},m),u.opts.unevaluated&&!0!==y?s.assign((0,o._)`${y}[${n}]`,!0):r||u.allErrors||s.if((0,o.not)(m),()=>s.break())})})}}}}),hH=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=p4();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 s=o.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),t.failResult(s,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}}}),hK=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:hr().validateUnion,error:{message:"must match a schema in anyOf"}}}),hJ=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=p9(),o=p4();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:s,it:n}=t;if(!Array.isArray(i))throw Error("ajv implementation error");if(n.opts.discriminator&&s.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,s)=>{let d;(0,o.alwaysValidSchema)(n,i)?a.var(u,!0):d=t.subschema({keyword:"oneOf",schemaProp:s,compositeRule:!0},u),s>0&&a.if((0,r._)`${u} && ${l}`).assign(l,!1).assign(c,(0,r._)`[${c}, ${s}]`).else(),a.if(u,()=>{a.assign(l,!0),a.assign(c,s),d&&t.mergeEvaluated(d,r.Name)})})}),t.result(l,()=>t.reset(),()=>t.error(!0))}}}),hB=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=p4();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 s=o.name("valid");a.forEach((o,a)=>{if((0,r.alwaysValidSchema)(i,o))return;let n=t.subschema({keyword:"allOf",schemaProp:a},s);t.ok(s),t.mergeEvaluated(n)})}}}),hG=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=p9(),o=p4();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:s,parentSchema:n,it:l}=t;void 0===n.then&&void 0===n.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=s.let("valid",!0),p=s.name("_valid");if(i=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},p),t.mergeEvaluated(i),t.reset(),c&&u){let r=s.let("ifClause");t.setParams({ifClause:r}),s.if(p,h("then",r),h("else",r))}else c?s.if(p,h("then")):s.if((0,r.not)(p),h("else"));function h(o,a){return()=>{let i=t.subschema({keyword:o},p);s.assign(d,p),t.mergeValidEvaluated(i,d),a?s.assign(a,(0,r._)`${o}`):t.setParams({ifClause:o})}}t.pass(d,()=>t.error(!0))}}}),hZ=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=p4();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`)}}}),hW=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hI(),o=hM(),a=hA(),i=hq(),s=hz(),n=hL(),l=hD(),c=hU(),u=hV(),d=hF(),p=hH(),h=hK(),f=hJ(),m=hB(),y=hG(),g=hZ();t.default=function(t=!1){let v=[p.default,h.default,f.default,m.default,y.default,g.default,l.default,c.default,n.default,u.default,d.default];return t?v.push(o.default,i.default):v.push(r.default,a.default),v.push(s.default),v}}),hX=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=p9();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,s,n,l,c,{gen:u,data:d,$data:p,schema:h,schemaCode:f,it:m}=t,{opts:y,errSchemaPath:g,schemaEnv:v,self:b}=m;y.validateFormats&&(p?(a=u.scopeValue("formats",{ref:b.formats,code:y.code.formats}),i=u.const("fDef",(0,r._)`${a}[${f}]`),s=u.let("fType"),n=u.let("format"),u.if((0,r._)`typeof ${i} == "object" && !(${i} instanceof RegExp)`,()=>u.assign(s,(0,r._)`${i}.type || "string"`).assign(n,(0,r._)`${i}.validate`),()=>u.assign(s,(0,r._)`"string"`).assign(n,i)),t.fail$data((0,r.or)(!1===y.strictSchema?r.nil:(0,r._)`${f} && !${n}`,(l=v.$async?(0,r._)`(${i}.async ? await ${n}(${d}) : ${n}(${d}))`:(0,r._)`${n}(${d})`,c=(0,r._)`(typeof ${n} == "function" ? ${l} : ${n}.test(${d}))`,(0,r._)`${n} && ${n} !== true && ${s} === ${o} && !${c}`)))):function(){var a;let i,s,n=b.formats[h];if(!n){if(!1===y.strictSchema)return b.logger.warn(l());throw Error(l());function l(){return`unknown format "${h}" ignored in schema at path "${g}"`}}if(!0===n)return;let[c,p,f]=(i=(a=n)instanceof RegExp?(0,r.regexpCode)(a):y.code.formats?(0,r._)`${y.code.formats}${(0,r.getProperty)(h)}`:void 0,s=u.scopeValue("formats",{key:h,ref:a,code:i}),"object"!=typeof a||a instanceof RegExp?["string",a,s]:[a.type||"string",a.validate,(0,r._)`${s}.validate`]);c===o&&t.pass(function(){if("object"==typeof n&&!(n instanceof RegExp)&&n.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})`}())}())}}}),hY=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=[hX().default]}),hQ=dl(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"]}),h0=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=h_(),o=hN(),a=hW(),i=hY(),s=hQ();t.default=[r.default,o.default,(0,a.default)(),i.default,s.metadataVocabulary,s.contentVocabulary]}),h1=dl(t=>{var r,o;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,(o=r||(t.DiscrError=r={})).Tag="tag",o.Mapping="mapping"}),h2=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=p9(),o=h1(),a=hd(),i=hu(),s=p4();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:n,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=n.let("valid",!1),m=n.const("tag",(0,r._)`${l}${(0,r.getProperty)(h)}`);n.if((0,r._)`typeof ${m} == "string"`,()=>(function(){let l=function(){var t;let r={},o=l(u),n=!0;for(let r=0;r<p.length;r++){let u=p[r];if((null==u?void 0:u.$ref)&&!(0,s.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}"`);n=n&&(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(!n)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 n.if(!1),l)n.elseIf((0,r._)`${m} === ${o}`),n.assign(f,function(o){let a=n.name("valid"),i=t.subschema({keyword:"oneOf",schemaProp:o},a);return t.mergeEvaluated(i,r.Name),a}(l[o]));n.else(),t.error(!1,{discrError:o.DiscrError.Mapping,tag:m,tagName:h}),n.endIf()})(),()=>t.error(!1,{discrError:o.DiscrError.Tag,tag:m,tagName:h})),t.ok(f)}}}),h9=dl((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}}),h4=dl((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=hg(),a=h0(),i=h2(),s=h9(),n=["/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(s,n):s;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=hl();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=p9();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=hc();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return p.default}});var h=hu();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return h.default}})}),h5=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicAnchor=void 0;let r=p9(),o=p5(),a=hd(),i=hb();function s(t,s){let{gen:n,it:l}=t;l.schemaEnv.root.dynamicAnchors[s]=!0;let c=(0,r._)`${o.default.dynamicAnchors}${(0,r.getProperty)(s)}`,u="#"===l.errSchemaPath?l.validateName:function(t){let{schemaEnv:r,schema:o,self:s}=t.it,{root:n,baseId:l,localRefs:c,meta:u}=r.root,{schemaId:d}=s.opts,p=new a.SchemaEnv({schema:o,schemaId:d,root:n,baseId:l,localRefs:c,meta:u});return a.compileSchema.call(s,p),(0,i.getValidate)(t,p)}(t);n.if((0,r._)`!${c}`,()=>n.assign(c,u))}t.dynamicAnchor=s,t.default={keyword:"$dynamicAnchor",schemaType:"string",code:t=>s(t,t.schema)}}),h3=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicRef=void 0;let r=p9(),o=p5(),a=hb();function i(t,i){let{gen:s,keyword:n,it:l}=t;if("#"!==i[0])throw Error(`"${n}" only supports hash fragment reference`);let c=i.slice(1);if(l.allErrors)u();else{let r=s.let("valid",!1);u(r),t.ok(r)}function u(t){if(l.schemaEnv.root.dynamicAnchors[c]){let a=s.let("_v",(0,r._)`${o.default.dynamicAnchors}${(0,r.getProperty)(c)}`);s.if(a,d(a,t),d(l.validateName,t))}else d(l.validateName,t)()}function d(r,o){return o?()=>s.block(()=>{(0,a.callRef)(t,r),s.let(o,!0)}):()=>(0,a.callRef)(t,r)}}t.dynamicRef=i,t.default={keyword:"$dynamicRef",schemaType:"string",code:t=>i(t,t.schema)}}),h6=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=h5(),o=p4();t.default={keyword:"$recursiveAnchor",schemaType:"boolean",code(t){t.schema?(0,r.dynamicAnchor)(t,""):(0,o.checkStrictMode)(t.it,"$recursiveAnchor: false is ignored")}}}),h8=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=h3();t.default={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,r.dynamicRef)(t,t.schema)}}),h7=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=h5(),o=h3(),a=h6(),i=h8();t.default=[r.default,o.default,a.default,i.default]}),fe=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hL();t.default={keyword:"dependentRequired",type:"object",schemaType:"object",error:r.error,code:t=>(0,r.validatePropertyDeps)(t)}}),ft=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hL();t.default={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,r.validateSchemaDeps)(t)}}),fr=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=p4();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`)}}}),fo=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=fe(),o=ft(),a=fr();t.default=[r.default,o.default,a.default]}),fa=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=p9(),o=p4(),a=p5();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:s,data:n,errsCount:l,it:c}=t;if(!l)throw Error("ajv implementation error");let{allErrors:u,props:d}=c;function p(a){if(!1===s){t.setParams({unevaluatedProperty:a}),t.error(),u||i.break();return}if(!(0,o.alwaysValidSchema)(c,s)){let s=i.name("valid");t.subschema({keyword:"unevaluatedProperties",dataProp:a,dataPropType:o.Type.Str},s),u||i.if((0,r.not)(s),()=>i.break())}}d instanceof r.Name?i.if((0,r._)`${d} !== true`,()=>i.forIn("key",n,t=>{var o,a;return i.if((o=d,a=t,(0,r._)`!${o} || !${o}[${a}]`),()=>p(t))})):!0!==d&&i.forIn("key",n,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}`)}}}),fi=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=p9(),o=p4();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:s,it:n}=t,l=n.items||0;if(!0===l)return;let c=a.const("len",(0,r._)`${s}.length`);if(!1===i)t.setParams({len:l}),t.fail((0,r._)`${c} > ${l}`);else if("object"==typeof i&&!(0,o.alwaysValidSchema)(n,i)){let i=a.var("valid",(0,r._)`${c} <= ${l}`);a.if((0,r.not)(i),()=>{var s,u;return s=i,u=l,void a.forRange("i",u,c,i=>{t.subschema({keyword:"unevaluatedItems",dataProp:i,dataPropType:o.Type.Num},s),n.allErrors||a.if((0,r.not)(s),()=>a.break())})}),t.ok(i)}n.items=!0}}}),fs=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=fa(),o=fi();t.default=[r.default,o.default]}),fn=dl((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"}]}}}}}),fl=dl((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:"#"}}}}}),fc=dl((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:"#"}}}}),fu=dl((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:{}}}}}),fd=dl((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"}}}}),fp=dl((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}}}}),fh=dl((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:[]}}}}),ff=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=fn(),o=fl(),a=fc(),i=fu(),s=fd(),n=fp(),l=fh(),c=["/properties"];t.default=function(t){return[r,o,a,i,u(this,s),n,u(this,l)].forEach(t=>this.addMetaSchema(t,void 0,!1)),this;function u(r,o){return t?r.$dataMetaSchema(o,c):o}}}),fm=dl((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=hg(),a=h0(),i=h7(),s=fo(),n=fs(),l=h2(),c=ff(),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(s.default),this.addVocabulary(n.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=hl();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return p.KeywordCxt}});var h=p9();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=hc();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return f.default}});var m=hu();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return m.default}})}),fy=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=h_(),o=hN(),a=hW(),i=h7(),s=fo(),n=fs(),l=hY(),c=hQ();t.default=[i.default,r.default,o.default,(0,a.default)(!0),l.default,c.metadataVocabulary,c.contentVocabulary,s.default,n.default]}),fg=dl((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}}}}),fv=dl((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"}}}}}),fb=dl((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"}}}}),f_=dl((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"}}}}),fS=dl((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"}}}}),f$=dl((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"}}}}),fw=dl((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}}}}),fE=dl((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:[]}}}}),fR=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=fg(),o=fv(),a=fb(),i=f_(),s=fS(),n=f$(),l=fw(),c=fE(),u=["/properties"];t.default=function(t){return[r,o,a,i,s,d(this,n),l,d(this,c)].forEach(t=>this.addMetaSchema(t,void 0,!1)),this;function d(r,o){return t?r.$dataMetaSchema(o,u):o}}}),fP=dl((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=hg(),a=fy(),i=h2(),s=fR(),n="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&&(s.default.call(this,t),this.refs["http://json-schema.org/schema"]=n)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(n)?n:void 0)}};t.Ajv2020=l,r.exports=t=l,r.exports.Ajv2020=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var c=hl();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=p9();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=hc();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.default}});var p=hu();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}),fk=dl(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,s),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<=b&&t>=v}},int64:{type:"number",validate:function(t){return Number.isInteger(t)}},float:{type:"number",validate:_},double:{type:"number",validate:_},password:!0,binary:!0},t.fastFormats={...t.fullFormats,date:r(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,s),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 s=+i[1],n=+i[2],l=+i[3];return n>=1&&n<=12&&l>=1&&l<=(2===n&&(r=s)%4==0&&(r%100!=0||r%400==0)?29:a[n])}function s(t,r){if(t&&r)return t>r?1:t<r?-1:0}let n=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function l(t){return function(r){let o=n.exec(r);if(!o)return!1;let a=+o[1],i=+o[2],s=+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&&s<60)return!0;let p=i-d*c,h=a-u*c-(p<0);return(23===h||-1===h)&&(59===p||-1===p)&&s<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=n.exec(t),a=n.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,n]=r.split(d),l=s(o,i);if(void 0!==l)return l||c(a,n)}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,b=0x80000000-1;function _(){return!0}let S=/[^\\]\\Z/}),fO=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;let r=h4(),o=p9(),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,s,{gen:n,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=n.scopeValue("formats",{ref:h.formats,code:p.code.formats}),s=n.const("fmt",(0,o._)`${a}[${f.schemaCode}]`),t.fail$data((0,o.or)((0,o._)`typeof ${s} != "object"`,(0,o._)`${s} instanceof RegExp`,(0,o._)`typeof ${s}.compare != "function"`,m(s)))):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=n.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)}),fT=dl((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});let o=fk(),a=fO(),i=p9(),s=new i.Name("fullFormats"),n=new i.Name("fastFormats"),l=(t,r={keywords:!0})=>{if(Array.isArray(r))return c(t,r,o.fullFormats,s),t;let[i,l]="fast"===r.mode?[o.fastFormats,n]:[o.fullFormats,s];return c(t,r.formats||o.formatNames,i,l),r.keywords&&(0,a.default)(t),t};function c(t,r,o,a){var s;for(let n of(null!=(s=t.opts.code).formats||(s.formats=(0,i._)`require("ajv-formats/dist/formats").${a}`),r))t.addFormat(n,o[n])}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}),fx=h4(),fj=fm(),fC=fP();let fN=dc(fT(),1).default;function fI(t){let r=new t({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return fN(r),r}var fA=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(t){this._userAjv=void 0!==t,this._ajv=t}get ajv(){return this._ajv??=fI(fC.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(du.has(o))return"2020-12";if(dd.has(o))return"2019-09";if(dp.has(o)||dh.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??=fI(fj.Ajv2019):this._ajvDraft7??=fI(fx.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 fM(t){return(await p).getRandomValues(new Uint8Array(t))}async function fq(t){let r="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",o=256-256%r.length,a="";for(;a.length<t;)for(let i of(await fM(t-a.length)))i<o&&(a+=r[i%r.length]);return a}async function fz(t){return await fq(t)}async function fL(t){return btoa(String.fromCharCode(...new Uint8Array(await (await p).subtle.digest("SHA-256",new TextEncoder().encode(t))))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function fD(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let r=await fz(t),o=await fL(r);return{code_verifier:r,code_challenge:o}}fx.Ajv,p=globalThis.crypto?.webcrypto??globalThis.crypto??Promise.resolve().then(s.t.bind(s,7598,19)).then(t=>t.webcrypto);class fU 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 fV(t){}function fF(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 fH(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 fK extends TransformStream{constructor({onError:t,onRetry:r,onComment:o,maxBufferSize:a}={}){let i;super({start(s){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=fV,onError:o=fV,onRetry:a=fV,onComment:i,maxBufferSize:s}=t,n=[],l=0,c=!0,u,d="",p=0,h,f=!1;function m(){void 0!==s&&(l+d.length<=s||(f=!0,n.length=0,l=0,u=void 0,d="",p=0,h=void 0,o(new fU(`Buffered data exceeded max buffer size of ${s} characters`,{type:"max-buffer-size-exceeded"}))))}function y(t){let o=0;if(-1===t.indexOf("\r")){let a=t.indexOf(`
|
|
68
|
-
`,
|
|
69
|
-
`,
|
|
70
|
-
`,
|
|
71
|
-
${
|
|
72
|
-
`,
|
|
73
|
-
`,
|
|
74
|
-
${i}`,p++;return}if(
|
|
75
|
-
${r}`,p++;break;case"id":u=r.includes("\0")?void 0:r;break;case"retry":/^\d+$/.test(r)?
|
|
76
|
-
`)&&-1===t.indexOf("\r")){n.push(t),l+=t.length,m();return}n.push(t);let r=n.join("");n.length=0,l=0;let o=y(r);""!==o&&(n.push(o),l=o.length),m()},reset:function(t={}){if(t.consume&&n.length>0){let t=n.join("");g(t,0,t.length)}c=!0,u=void 0,d="",p=0,h=void 0,n.length=0,l=0,f=!1}}}({onEvent:t=>{s.enqueue(t)},onError(r){"function"==typeof t&&t(r),("terminate"===t||"max-buffer-size-exceeded"===r.type)&&s.error(r)},onRetry:r,onComment:o,maxBufferSize:a})},transform(t){i.feed(t)}})}}var fJ=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](t){return dy(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 dy(this,t)}constructor(t){super(t),this.name=new.target.name,dm(this,new.target)}},fB=class extends fJ{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}},fG=class extends fJ{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}},fZ=class extends fJ{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}},fW=class extends fJ{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}},fX=class extends fJ{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 fY(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):fQ(t.issuer,r)?t:void 0}function fQ(t,r){return t===r||t.endsWith("/")&&t.slice(0,-1)===r||r.endsWith("/")&&r.slice(0,-1)===t}async function f0(t,r,o){let{resourceMetadataUrl:a,scope:i}=mo(r.response);if(await me(t,{serverUrl:r.serverUrl,resourceMetadataUrl:a,scope:i,fetchFn:r.fetchFn,...o})!=="AUTHORIZED")throw new f1}var f1=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](t){return dy(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 dy(this,t)}constructor(t){super(t??"Unauthorized"),this.name="UnauthorizedError",dm(this,new.target)}};function f2(t){return t?.authorization_response_iss_parameter_supported===!0}function f9({iss:t,expectedIssuer:r,issParameterSupported:o}){if(void 0!==r){if(void 0===t){if(o)throw new fB("authorization_response",r,void 0);return}if(t!==r)throw new fB("authorization_response",r,t)}}function f4(...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 f5(t,r,o,a,i){if("string"==typeof t)return{authorizationCode:t,iss:r};let s=t.get("iss")??void 0,n=t.get("code");if(n)return{authorizationCode:n,iss:s};let l=(await o.discoveryState?.())?.authorizationServerMetadata;if(!l)try{l=(await mu(a,i)).authorizationServerMetadata}catch{l=void 0}if(!l)throw new f1("Authorization callback failed and the issuer could not be verified");f9({iss:s,expectedIssuer:l.issuer,issParameterSupported:f2(l)});let c=t.get("error");if(c)throw new dv(c,t.get("error_description")??c,t.get("error_uri")??void 0);throw new f1("Authorization callback contained neither `code` nor `error`")}let f3="code",f6="S256";function f8(t){return"localhost"===t||"127.0.0.1"===t||"[::1]"===t||"::1"===t}async function f7(t){let r=t instanceof Response?t.status:void 0,o=t instanceof Response?await t.text():t;try{let t=lU.parse(JSON.parse(o));return dv.fromResponse(t)}catch(a){let t=`${r?`HTTP ${r}: `:""}Invalid OAuth error response: ${a}. Raw body: ${o}`;return new dv(dg.ServerError,t)}}async function me(t,r){try{return await mt(t,r)}catch(o){if(o instanceof dv){if(o.code===dg.InvalidClient||o.code===dg.UnauthorizedClient)return await t.invalidateCredentials?.("client"),await t.invalidateCredentials?.("tokens"),await mt(t,r);else if(o.code===dg.InvalidGrant)return await t.invalidateCredentials?.("tokens"),await mt(t,r)}throw o}}async function mt(t,{serverUrl:r,authorizationCode:o,iss:a,scope:i,resourceMetadataUrl:s,fetchFn:n,skipIssuerMetadataValidation:l,forceReauthorization:c}){let u,d,p,h,f,m={...f=t.clientMetadata,grant_types:f.grant_types??(void 0===t.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||f8(t.hostname))return"native"}return"web"}(f.redirect_uris)},y=await t.discoveryState?.(),g=s;if(!g&&y?.resourceMetadataUrl&&(g=new URL(y.resourceMetadataUrl)),y?.authorizationServerUrl){if(d=y.authorizationServerUrl,u=y.resourceMetadata,p=y.authorizationServerMetadata??await mc(d,{fetchFn:n,skipIssuerValidation:l}),!u)try{u=await mi(r,{resourceMetadataUrl:g},n)}catch(t){if(t instanceof TypeError)throw t}(p!==y.authorizationServerMetadata||u!==y.resourceMetadata)&&await t.saveDiscoveryState?.({authorizationServerUrl:String(d),resourceMetadataUrl:g?.toString(),resourceMetadata:u,authorizationServerMetadata:p})}else{let t=await mu(r,{resourceMetadataUrl:g,fetchFn:n,skipIssuerMetadataValidation:l});d=t.authorizationServerUrl,p=t.authorizationServerMetadata,u=t.resourceMetadata,h={authorizationServerUrl:String(d),resourceMetadataUrl:g?.toString(),resourceMetadata:u,authorizationServerMetadata:p}}let v=p?.issuer??String(d),b={issuer:v};if(await t.saveAuthorizationServerUrl?.(v),void 0!==o){let r=y?.authorizationServerMetadata?.issuer??y?.authorizationServerUrl;if(void 0===r){if(void 0!==t.saveDiscoveryState)throw new fW("discoveryState was not available on the callback leg; ensure your provider persists discoveryState alongside codeVerifier",v);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(!fQ(r,v))throw new fW(r,v)}h&&await t.saveDiscoveryState?.(h);let _=await mr(r,t,u);_&&await t.saveResourceUrl?.(String(_));let S=function(t){let{requestedScope:r,resourceMetadata:o,authServerMetadata:a,clientMetadata:i}=t,s=r||o?.scopes_supported?.join(" ")||i.scope;return s&&a?.scopes_supported?.includes("offline_access")&&!s.split(" ").includes("offline_access")&&i.grant_types?.includes("refresh_token")&&(s=`${s} offline_access`),s}({requestedScope:i,resourceMetadata:u,authServerMetadata:p,clientMetadata:t.clientMetadata}),$=await Promise.resolve(t.clientInformation(b)),w=fY($,v,{canPersistStamp:void 0!==t.saveClientInformation});if(void 0===w&&$?.issuer&&void 0===t.saveClientInformation)throw new fW($.issuer,v);if(w&&void 0===w.issuer&&(w={...w,issuer:v},await t.saveClientInformation?.(w,b)),!w){if(void 0!==o)throw Error("Existing OAuth client information is required when exchanging an authorization code");let r=p?.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 dv(dg.InvalidClientMetadata,`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${a}`);if(r&&a)w={client_id:a,issuer:v},await t.saveClientInformation?.(w,b);else{if(!t.saveClientInformation)throw Error("OAuth client information must be saveable for dynamic registration");w={...await mm(d,{metadata:p,clientMetadata:m,scope:S,fetchFn:n}),issuer:v},await t.saveClientInformation(w,b)}}let E=!t.redirectUrl;if(void 0!==o||E){void 0!==o&&f9({iss:a,expectedIssuer:p?.issuer,issParameterSupported:f2(p)});let r=await mf(t,d,{metadata:p,resource:_,authorizationCode:o,iss:a,scope:S,fetchFn:n});return await t.saveTokens({...r,issuer:v},b),"AUTHORIZED"}let R=fY(await t.tokens(b),v);if(R&&void 0===R.issuer&&(R={...R,issuer:v},await t.saveTokens(R,b)),R?.refresh_token&&!c)try{let r=await mh(d,{metadata:p,clientInformation:w,refreshToken:R.refresh_token,resource:_,addClientAuthentication:t.addClientAuthentication,fetchFn:n});return await t.saveTokens({...r,issuer:v},b),"AUTHORIZED"}catch(t){if(t instanceof fZ||t instanceof dv&&t.code!==dg.ServerError)throw t}let P=t.state?await t.state():void 0,{authorizationUrl:k,codeVerifier:O}=await md(d,{metadata:p,clientInformation:w,state:P,redirectUrl:t.redirectUrl,scope:S,resource:_});return await t.saveCodeVerifier(O),await t.redirectToAuthorization(k),"REDIRECT"}async function mr(t,r,o){let a,i=((a=new URL("string"==typeof t?t:t.href)).hash="",a);if(r.validateResourceURL)return await r.validateResourceURL(i,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+"/",s=a.pathname.endsWith("/")?a.pathname:a.pathname+"/";return i.startsWith(s)}({requestedResource:i,configuredResource:o.resource}))throw Error(`Protected resource ${o.resource} does not match expected ${i} (or origin)`);return new URL(o.resource)}}function mo(t){let r,o=t.headers.get("WWW-Authenticate");if(!o)return{};let[a,i]=o.split(" ");if(a?.toLowerCase()!=="bearer"||!i)return{};let s=ma(t,"resource_metadata")||void 0;if(s)try{r=new URL(s)}catch{}let n=ma(t,"scope")||void 0;return{resourceMetadataUrl:r,scope:n,error:ma(t,"error")||void 0,errorDescription:ma(t,"error_description")||void 0}}function ma(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 mi(t,r,o=fetch){let a=await ml(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 lA.parse(await a.json())}async function ms(t,r,o=fetch){try{return await o(t,{headers:r})}catch(t){throw t}}async function mn(t,r,o=fetch){return await ms(t,{"MCP-Protocol-Version":r},o)}async function ml(t,r,o,a){var i,s;let n,l=new URL(t),c=a?.protocolVersion??iY;a?.metadataUrl?n=new URL(a.metadataUrl):(n=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 mn(n,c,o);return!a?.metadataUrl&&(i=u,s=l.pathname,!i||"/"!==s&&(i.status>=400&&i.status<500||502===i.status))&&(u=await mn(new URL(`/.well-known/${r}`,l),c,o)),u}async function mc(t,{fetchFn:r=fetch,protocolVersion:o=iY,skipIssuerValidation:a=!1}={}){let i={"MCP-Protocol-Version":o,Accept:"application/json"};for(let{url:o,type:s}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 n=await ms(o,i,r);if(!n)continue;if(!n.ok){if(await n.text?.().catch(()=>{}),n.status>=400&&n.status<500||502===n.status)continue;throw Error(`HTTP ${n.status} trying to load ${"oauth"===s?"OAuth":"OpenID provider"} metadata from ${o}`)}let l="oauth"===s?lM.parse(await n.json()):lz.parse(await n.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 fB("metadata",r,l.issuer)}return l}}async function mu(t,r){let o,a;try{(o=await mi(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 mc(a,{fetchFn:r?.fetchFn,skipIssuerValidation:r?.skipIssuerMetadataValidation});return{authorizationServerUrl:a,authorizationServerMetadata:i,resourceMetadata:o}}async function md(t,{metadata:r,clientInformation:o,redirectUrl:a,scope:i,state:s,resource:n}){let l;if(r){if(l=new URL(r.authorization_endpoint),!r.response_types_supported.includes(f3))throw Error(`Incompatible auth server: does not support response type ${f3}`);if(r.code_challenge_methods_supported&&!r.code_challenge_methods_supported.includes(f6))throw Error(`Incompatible auth server: does not support code challenge method ${f6}`)}else l=new URL("/authorize",t);let c=await fD(),u=c.code_verifier,d=c.code_challenge;return l.searchParams.set("response_type",f3),l.searchParams.set("client_id",o.client_id),l.searchParams.set("code_challenge",d),l.searchParams.set("code_challenge_method",f6),l.searchParams.set("redirect_uri",String(a)),s&&l.searchParams.set("state",s),i&&l.searchParams.set("scope",i),i?.split(" ").includes("offline_access")&&l.searchParams.append("prompt","consent"),n&&l.searchParams.set("resource",n.href),{authorizationUrl:l,codeVerifier:u}}async function mp(t,{metadata:r,tokenRequestParams:o,clientInformation:a,addClientAuthentication:i,resource:s,fetchFn:n}){var l,c;let u,d=function(t){let r=new URL(String(t));if("https:"!==r.protocol&&!f8(r.hostname))throw new fZ(r.href);return r}(r?.token_endpoint??new URL("/token",t)),p=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});s&&o.set("resource",s.href),i?await i(p,o,d,r):a&&function(t,r,o,a){let{client_id:i,client_secret:s}=r;switch(t){case"client_secret_basic":var n,l,c,u,d=i,p=s,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":n=i,l=s,(c=a).set("client_id",n),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}`)}}((l=a,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"),a,p,o);let h=await (n??fetch)(d,{method:"POST",headers:p,body:o});if(!h.ok)throw await f7(h);let f=await h.json();try{return lL.parse(f)}catch(t){if("object"==typeof f&&null!==f&&"error"in f)throw await f7(JSON.stringify(f));throw t}}async function mh(t,{metadata:r,clientInformation:o,refreshToken:a,resource:i,addClientAuthentication:s,fetchFn:n}){return{refresh_token:a,...await mp(t,{metadata:r,tokenRequestParams:new URLSearchParams({grant_type:"refresh_token",refresh_token:a}),clientInformation:o,addClientAuthentication:s,resource:i,fetchFn:n})}}async function mf(t,r,{metadata:o,resource:a,authorizationCode:i,iss:s,scope:n,fetchFn:l}={}){let c;void 0!==i&&f9({iss:s,expectedIssuer:o?.issuer,issParameterSupported:f2(o)});let u=n??t.clientMetadata.scope;if(t.prepareTokenRequest&&(c=await t.prepareTokenRequest(u)),!c){if(!i)throw Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!t.redirectUrl)throw Error("redirectUrl is required for authorization_code flow");c=new URLSearchParams({grant_type:"authorization_code",code:i,code_verifier:await t.codeVerifier(),redirect_uri:String(t.redirectUrl)})}let d=await t.clientInformation({issuer:o?.issuer??String(r)});return mp(r,{metadata:o,tokenRequestParams:c,clientInformation:d??void 0,addClientAuthentication:t.addClientAuthentication,resource:a,fetchFn:l})}async function mm(t,{metadata:r,clientMetadata:o,scope:a,fetchFn:i}){let s;if(r){if(!r.registration_endpoint)throw Error("Incompatible auth server: does not support dynamic client registration");s=new URL(r.registration_endpoint)}else s=new URL("/register",t);let n={...o,...void 0===a?{}:{scope:a}},l=await (i??fetch)(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!l.ok)throw new fG({status:l.status,body:await l.text(),submittedMetadata:n});return lK.parse(await l.json())}let my=new Set(["tools/list","prompts/list","resources/list","resources/templates/list","server/discover"]);var mg=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(mv(t))}set(t,r){let o=mv(t),a=my.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(!my.has(t.slice(0,t.indexOf("\0")))){this._entries.delete(t),this._cappedSize--;break}}let s=++this._stamp;return this._entries.set(o,{...r,stamp:s}),i&&!a&&this._cappedSize++,s}delete(t){this._entries.delete(mv(t))&&!my.has(t.method)&&this._cappedSize--}evict(t){let r=`${t}\0`,o=my.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 mv(t){return`${t.method}\0${JSON.stringify([t.partition??"",t.params??""])}`}function mb(t,r){return void 0===r?t:`${t}\0${r}`}var m_=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 s=this._partitionFor("public");if(s===a)return;let n=await this._store.get({...o,partition:s});return n?.scope==="public"?n: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=mb(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=mb(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(mb(t,a?.params))??0)!==o)return;let i=a?.params??"",s=this._partitionFor("private"),n=this._partitionFor("public"),l=(a?.scope??"private")==="public"?n:s;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(n!==s)try{await this._store.delete({method:t,params:i,partition:l===s?n:s})}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 mS=Symbol.for("mcp.authSeamEscape");function m$(t){if("object"==typeof t&&null!==t||"function"==typeof t)try{Object.defineProperty(t,mS,{value:!0,configurable:!0})}catch{}return t}let mw=new Set([-32001,-32020,-32021]);function mE(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 d0({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),s=dR(t),n=r.clientModernVersions.find(t=>s.includes(t));return void 0!==n?{kind:"corrective",version:n,error:o}:s.length>0?{kind:"error",error:o}:r.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:o}}return mw.has(o),{kind:"legacy"}}function mR(t,r){var o,a;return"browser"===r.environment&&((o=t)instanceof TypeError||o instanceof Error&&"TypeError"===o.name)?{kind:"legacy"}:{kind:"error",error:new d_(db.EraNegotiationFailed,`Version negotiation probe failed: ${(a=t)instanceof Error?a.message:String(a)}`,{cause:t})}}function mP(){let t=globalThis;return void 0!==t.window&&void 0!==t.document?"browser":"node"}function mk(t){return"stderr"in t&&"pid"in t?"stdio":"http"}var mO=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&&(ph(t)||pf(t))&&t.id===r.id){o._pending=void 0,ph(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,s=t=>{i||(i=!0,clearTimeout(n),this._pending?.id===o&&(this._pending=void 0),a(t))},n=setTimeout(()=>s({kind:"timeout"}),r);this._pending={id:o,resolve:s},this._transport.send(t(o)).catch(t=>s({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,mT.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 mT=new WeakMap;function mx(t){let r=mT.get(t);mT.delete(t),r?.()}async function mj(t,r){let o,a=t.probe.timeoutMs??r.defaultTimeoutMs,i=Math.max(0,t.probe.maxRetries??0),s="pin"===t.kind?[t.version]:t.modernVersions,n="auto"===t.kind&&t.fallbackAvailable,l=await mO.open(r.transport),c=async()=>{let o=s[0],c=!1,u=i;for(;;){let i=await l.exchange(t=>{var a,i,s;return a=o,i=r.clientInfo,s=r.capabilities,{jsonrpc:"2.0",id:t,method:"server/discover",params:{_meta:pn(a).outboundEnvelope({protocolVersion:a,clientInfo:i,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":{let r=t.error;if(("object"==typeof r&&null!==r||"function"==typeof r)&&!0===r[mS]||r instanceof f1||r instanceof Error&&"UnauthorizedError"===r.name)return{kind:"auth-required",error:r};if(r instanceof dS){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}}}(i,a),p=function(t,r){switch(t.kind){case"result":return function(t,r){let o=pn(ps).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 d0({supported:[...a],requested:r.requestedVersion})}}(t.result,r);case"rpc-error":return mE(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 dS(r?db.ClientHttpForbidden:db.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 dS(db.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:s}=o;if("number"==typeof a)return{code:a,message:"string"==typeof i?i:"",data:s}}(t.body);return void 0!==o?mE(o,r):{kind:"legacy"}}(t,r);case"network-error":return mR(t.error,r);case"auth-required":return{kind:"error",error:t.error};case"closed":if("stdio"===r.transportKind)return{kind:"legacy"};return mR(Error("Connection closed during the version negotiation probe"),r);case"timeout":if("stdio"===r.transportKind)return{kind:"legacy"};return{kind:"error",error:new d_(db.RequestTimeout,`Version negotiation probe timed out after ${t.timeoutMs}ms`,{timeout:t.timeoutMs})}}}(d,{clientModernVersions:s,requestedVersion:o,fallbackAvailable:n,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 d_(db.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 d_(db.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 d_(db.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 mC(t,r,o,a){let i,s,n=new r.constructor({...o,stderr:"ignore"}),l=r.close,c=!1,u=new Promise((t,r)=>{i=()=>r(mN())});r.close=async function(){return c=!0,i?.(),l.call(r)};try{let r=mj(t,{...a,transport:n,transportKind:"stdio",disposableProbe:!0});r.catch(()=>{}),s=await Promise.race([r,u])}finally{await mI(n),r.close=l}if(c)throw mN();return s}function mN(){return new d_(db.EraNegotiationFailed,"Version negotiation failed: the transport was closed during the server/discover probe")}async function mI(t){try{let r=t._dispose;await ("function"==typeof r?r.call(t):t.close())}catch{}}function mA(t){let r=t._meta?.[i2];return pU.Implementation(r)?r:void 0}let mM={"notifications/tools/list_changed":["tools/list"],"notifications/prompts/list_changed":["prompts/list"],"notifications/resources/list_changed":["resources/list","resources/templates/list"]};var mq=class extends pB{_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 d_(db.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 fA,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 m_(r?.responseCacheStore??new mg,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){if(void 0!==this._negotiatedProtocolVersion&&this._negotiatedProtocolVersion>=d$&&sp.safeParse(t).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:s,options:n,flowStartedAt:l}=a,c={inputRequests:o.inputRequests,...void 0!==o.requestState&&{requestState:o.requestState}};return pq({config:r,method:s.method,originalParams:s.params,firstPayload:c,flowStartedAt:l,signal:n?.signal,requestOptions:{...n?.timeout!==void 0&&{timeout:n.timeout},...n?.maxTotalTimeout!==void 0&&{maxTotalTimeout:n.maxTotalTimeout},...n?.onprogress!==void 0&&{onprogress:n.onprogress}},hooks:{dispatchInputRequest:(r,o,a)=>pX(t,i,r,o,a),retry:(t,r)=>a.retry(t,{...n?.signal!==void 0&&{signal:n.signal},...n?.onprogress!==void 0&&{onprogress:n.onprogress},...n?.resetTimeoutOnProgress!==void 0&&{resetTimeoutOnProgress:n.resetTimeoutOnProgress},...n?.headers!==void 0&&{headers:n.headers},...void 0!==r.timeout&&{timeout:r.timeout},...void 0!==r.maxTotalTimeout&&{maxTotalTimeout:r.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 d_(db.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]=pG(i)&&pG(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=pn(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 dX("not-in-era"===i.reason?dW.InternalError:dW.InvalidParams,"not-in-era"===i.reason?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation request: ${i.message}`);let{params:s}=i.value;s.mode=s.mode??"form";let{supportsFormMode:n,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"===s.mode&&!n)throw new dX(dW.InvalidParams,"Client does not support form-mode elicitation requests");if("url"===s.mode&&!l)throw new dX(dW.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 dX("not-in-era"===u.reason?dW.InternalError:dW.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"===s.mode?s.requestedSchema:void 0;if("form"===s.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=pn(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 dX("not-in-era"===i.reason?dW.InternalError:dW.InvalidParams,"not-in-era"===i.reason?"No wire schema for sampling/createMessage in the resolved era":`Invalid sampling request: ${i.message}`);let{params:s}=i.value,n=await r(t,o),l=!!(s.tools||s.toolChoice),c=a.samplingResultVariant(l,n);if(c.ok||"not-in-era"!==c.reason||(c=a.validateInputResponse("sampling/createMessage",n)),!c.ok)throw new dX("not-in-era"===c.reason?dW.InternalError:dW.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 d_(db.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&&sM.safeParse(t.discover).success))return t;throw new d_(db.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>=d$))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?dR(r):[];return{kind:"auto",modernVersions:i.length>0?i:[...dw],fallbackAvailable:!r||dE(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=dE(this._supportedProtocolVersions);try{let a=o[0];if(void 0===a)throw new d_(db.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=mk(t),s={clientInfo:this._clientInfo,capabilities:this._capabilities,environment:mP(),defaultTimeoutMs:o?.timeout??6e4},n="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===n?await mj(r,{...s,transport:t,transportKind:i}):await mC(r,t,n,s)}catch(r){throw await t.close().catch(()=>{}),mx(t),r}if(mx(t),await super.connect(t),"legacy"===a.era)return void await this._legacyHandshake(t,o);if(this._serverCapabilities=a.discover.capabilities,this._serverVersion=mA(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 s=i?{...a.tools&&{toolsListChanged:!0},...a.prompts&&{promptsListChanged:!0},...a.resources&&{resourcesListChanged:!0}}:{};if(Object.keys(s).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(s,{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,s=(i&&dR(i).length>0?dR(i):dw).find(t=>a.supportedVersions.includes(t));if(void 0===s)throw new d_(db.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=mA(a),this._cache.setServerIdentity(this._deriveServerIdentity(t)),this._instructions=a.instructions,this._negotiatedProtocolVersion=s,t.setProtocolVersion?.(s),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>=d$?"modern":"legacy"}getInstructions(){return this._instructions}getDiscoverResult(){return this._discoverResult}assertCapabilityForMethod(t){switch(t){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new d_(db.CapabilityNotSupported,`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new d_(db.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 d_(db.CapabilityNotSupported,`Server does not support resources (required for ${t})`);if("resources/subscribe"===t&&!this._serverCapabilities.resources.subscribe)throw new d_(db.CapabilityNotSupported,`Server does not support resource subscriptions (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new d_(db.CapabilityNotSupported,`Server does not support tools (required for ${t})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new d_(db.CapabilityNotSupported,`Server does not support completions (required for ${t})`)}}assertNotificationCapability(t){if("notifications/roots/list_changed"===t&&!this._capabilities.roots?.listChanged)throw new d_(db.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 d_(db.CapabilityNotSupported,`Client does not support sampling capability (required for ${t})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new d_(db.CapabilityNotSupported,`Client does not support elicitation capability (required for ${t})`);break;case"roots/list":if(!this._capabilities.roots)throw new d_(db.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"},sM,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,a,i){let s=o?.cacheMode==="bypass",n=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 d_(db.ListPaginationExceeded,`${t}: exceeded listMaxPages (${this._listMaxPages}); server pagination did not terminate`,{method:t,listMaxPages:this._listMaxPages});u.add(c);let i=await this.request({method:t,params:{...r,cursor:c}},o);a(l,i),c=i.nextCursor,d++}return delete l.nextCursor,i?.(l),s||await this._cache.write(t,l,n,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 d_?t:new d_(db.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:pb(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,s,n;if(void 0===this.transport)throw new d_(db.NotConnected,"Not connected");let l=this._negotiatedProtocolVersion;if(void 0===l||!(l>=d$))throw new d_(db.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 d_?t:new d_(db.RequestTimeout,String(t))}let c=new AbortController,u=`listen:${this._nextListenId++}`,d="opening",p=new Promise((t,r)=>{i=t,s=r}),h=new Promise(t=>{n=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(),n(t.cause),l&&s(t.error??new d_(db.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 d_(db.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}};try{await this.transport.send(v,{requestSignal:c.signal,onRequestStreamEnd:()=>f({cause:"remote",error:Error("subscriptions/listen: stream ended")})})}catch(t){f({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(mM,t.method)?mM[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?.[i4],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?pf(t)?o.settle({cause:"remote",error:dX.fromError(t.error.code,t.error.message,t.error.data)}):o.settle({cause:"graceful",error:new d_(db.ConnectionClosed,"subscriptions/listen: server closed the subscription gracefully before acknowledging")}):super._onresponse(t)}_onclose(){if(this._listenState.size>0){let t=new d_(db.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"!==mP(),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}`]=pE(i))}return o}(o.declarations,t.arguments);return 0===Object.keys(i).length?r:{...r,headers:{...r?.headers,...i}}},s=r?.toolDefinition===void 0?await this._cache.outputValidator(t.name,t=>this._compileOutputValidator(t)).catch(t=>void this._reportStoreError(t)):this._compileOutputValidator(r.toolDefinition),n=()=>{if(void 0===s||s.ok)return;let r=s.compileError,o=(r instanceof Error?r.message:String(r)).slice(0,200);throw new dX(dW.InvalidParams,`Tool '${t.name}' has an invalid outputSchema: ${o}`)};n();try{o=await this.request({method:"tools/call",params:t},await i())}catch(u){let l=u instanceof dX&&-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)),s=await this._cache.outputValidator(t.name,t=>this._compileOutputValidator(t)).catch(t=>void this._reportStoreError(t)),n(),o=await this.request({method:"tools/call",params:t},await i())}let l=void 0!==s&&s.ok?s.validator:void 0;if(l){if(void 0===o.structuredContent&&!o.isError)throw new dX(dW.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 dX(dW.InvalidParams,`Structured content does not match the tool's output schema: ${t.errorMessage}`)}catch(t){if(t instanceof dX)throw t;throw new dX(dW.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"===mk(this.transport))return;let r=t.tools.filter(t=>{let r=pb(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=ak(nN,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:s,debounceMs:n}=i.data,{onChanged:l}=o,c=async()=>{if(!s)return void l(null,null);try{l(null,await a())}catch(t){l(t instanceof Error?t:Error(String(t)),null)}},u=()=>{if(n){let r=this._listChangedDebounceTimers.get(t);r&&clearTimeout(r);let o=setTimeout(c,n);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 dy(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 dy(this,t)}constructor(t,r,o){super(`SSE error: ${r}`),this.code=t,this.event=o,dm(this,new.target)}});let mz={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},mL=new Set(["authorization","content-type","mcp-protocol-version","mcp-method","mcp-name","mcp-session-id"]);function mD(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",s)};function i(){a(),o.abort(t.reason)}function s(){a(),o.abort(r.reason)}return t.addEventListener("abort",i,{once:!0}),r.addEventListener("abort",s,{once:!0}),o.signal}var mU=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=>f0(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,a)=>t(o,{...r,...a,headers:a?.headers?{...p0(r.headers),...p0(a.headers)}:r.headers}):t}(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._protocolVersion=r?.protocolVersion,this._reconnectionOptions=r?.reconnectionOptions??mz,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 m$(t)}}async _stepUpAuthorizeInner(t,r){if("throw"===this._onInsufficientScope||!this._oauthProvider)throw new fX({requiredScope:t.scope,resourceMetadataUrl:t.resourceMetadataUrl,errorDescription:t.errorDescription});if(r>=this._maxStepUpRetries)throw new dS(db.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=f4(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 me(this._oauthProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:a,forceReauthorization:i,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})}async _commonHeaders(){let t,r={};try{t=await this._authProvider?.token()}catch(t){throw m$(t)}t&&(r.Authorization=`Bearer ${t}`),this._sessionId&&(r["mcp-session-id"]=this._sessionId),this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);let o=p0(this._requestInit?.headers);return new Headers({...r,...o})}_applyBodyDerivedHeaders(t,r){if(Array.isArray(r)||!sp.safeParse(r).success)return;let o=r.params?._meta?.[i0];if("string"!=typeof o)return;t.set("mcp-protocol-version",o),t.set("mcp-method",r.method);let a=r.params,i="resources/read"===r.method?"string"==typeof a?.uri?a.uri:void 0:"string"==typeof a?.name?a.name:void 0;void 0!==i&&t.set("mcp-name",pE(i))}_isModernEnvelopedRequest(t){if(Array.isArray(t)||!sp.safeParse(t).success)return!1;let r=t.params?._meta?.[i0];return"string"==typeof r&&r>=d$}async _startOrAuthSse(t,r=!1,o=0){let{resumptionToken:a,requestSignal:i}=t,s=()=>this._abortController?.signal.aborted===!0||i?.aborted===!0;try{let s=await this._commonHeaders(),n=[...s.get("accept")?.split(",").map(t=>t.trim().toLowerCase())??[],"text/event-stream"];s.set("accept",[...new Set(n)].join(", ")),a&&s.set("last-event-id",a);let l=this._abortController?.signal,c=void 0!==i&&void 0!==l?mD(l,i):i??l,u=await (this._fetch??fetch)(this._url,{...this._requestInit,method:"GET",headers:s,signal:c});if(!u.ok){if(401===u.status&&this._authProvider){if(u.headers.has("www-authenticate")){let{resourceMetadataUrl:t,scope:r}=mo(u);this._resourceMetadataUrl=t,this._scope=f4(this._scope,r)}if(this._authProvider.onUnauthorized&&!r){try{await this._authProvider.onUnauthorized({response:u,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(t){throw m$(t)}return await u.text?.().catch(()=>{}),this._startOrAuthSse(t,!0,o)}if(await u.text?.().catch(()=>{}),r)throw m$(new dS(db.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:u.statusText}));throw m$(new f1)}if(403===u.status){let{resourceMetadataUrl:a,scope:i,error:s,errorDescription:n}=mo(u);if("insufficient_scope"===s){let s=await u.text?.().catch(()=>null);if(await this._stepUpAuthorize({scope:i,resourceMetadataUrl:a,errorDescription:n,statusText:u.statusText,text:s},o)!=="AUTHORIZED")throw m$(new f1);return this._startOrAuthSse(t,r,o+1)}}if(await u.text?.().catch(()=>{}),405===u.status)return void t.onRequestStreamEnd?.();throw new dS(db.ClientHttpFailedToOpenStream,`Failed to open SSE stream: ${u.statusText}`,{status:u.status,statusText:u.statusText})}this._handleSseStream(u.body,t,!0)}catch(t){throw s()||this.onerror?.(t),t}}_getNextReconnectionDelay(t){return void 0!==this._serverRetryMs?this._serverRetryMs:Math.min(this._reconnectionOptions.initialReconnectionDelay*Math.pow(this._reconnectionOptions.reconnectionDelayGrowFactor,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:s,requestSignal:n,onRequestStreamEnd:l}=r,c=()=>this._abortController?.signal.aborted===!0||n?.aborted===!0,u=!1,d=!1;(async()=>{try{let r=t.pipeThrough(new TextDecoderStream).pipeThrough(new fK({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=sy.parse(JSON.parse(t.data));(ph(r)||pf(r))&&(d=!0,void 0!==s&&(r.id=s)),this.onmessage?.(r)}catch(t){this.onerror?.(t)}}(o||u)&&!d&&this._abortController&&!c()?this._scheduleReconnection({resumptionToken:a,onresumptiontoken:i,replayMessageId:s,requestSignal:n,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:s,requestSignal:n,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 f1("finishAuth requires an OAuthClientProvider");let{authorizationCode:o,iss:a}=await f5(t,r,this._oauthProvider,this._url,{fetchFn:this._fetchWithInit,resourceMetadataUrl:this._resourceMetadataUrl});if(await me(this._oauthProvider,{serverUrl:this._url,authorizationCode:o,iss:a,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})!=="AUTHORIZED")throw new f1("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{resumptionToken:i,onresumptiontoken:s}=r||{};if(i)return void this._startOrAuthSse({resumptionToken:i,replayMessageId:sp.safeParse(t).success?t.id:void 0,requestSignal:r?.requestSignal}).catch(t=>this.onerror?.(t));let n=await this._commonHeaders();this._applyBodyDerivedHeaders(n,t);let l=Array.isArray(t)?t.some(t=>sj.safeParse(t).success):sj.safeParse(t).success;if(l&&n.delete("mcp-session-id"),r?.headers!==void 0)for(let[t,o]of Object.entries(r.headers))mL.has(t.toLowerCase())||n.set(t,o);n.set("content-type","application/json");let c=[...n.get("accept")?.split(",").map(t=>t.trim().toLowerCase())??[],"application/json","text/event-stream"];n.set("accept",[...new Set(c)].join(", "));let u=this._abortController?.signal,d=r?.requestSignal!==void 0&&void 0!==u?mD(u,r.requestSignal):r?.requestSignal??u,p={...this._requestInit,method:"POST",headers:n,body:JSON.stringify(t),signal:d},h=await (this._fetch??fetch)(this._url,p);if(l&&h.ok&&(this._sessionId=h.headers.get("mcp-session-id")||void 0),!h.ok){if(401===h.status&&this._authProvider){if(h.headers.has("www-authenticate")){let{resourceMetadataUrl:t,scope:r}=mo(h);this._resourceMetadataUrl=t,this._scope=f4(this._scope,r)}if(this._authProvider.onUnauthorized&&!o){try{await this._authProvider.onUnauthorized({response:h,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(t){throw m$(t)}return await h.text?.().catch(()=>{}),this._send(t,r,!0,a)}if(await h.text?.().catch(()=>{}),o)throw m$(new dS(db.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:h.statusText}));throw m$(new f1)}let i=await h.text?.().catch(()=>null);if(403===h.status){let{resourceMetadataUrl:s,scope:n,error:l,errorDescription:c}=mo(h);if("insufficient_scope"===l){if(await this._stepUpAuthorize({scope:n,resourceMetadataUrl:s,errorDescription:c,statusText:h.statusText,text:i},a)!=="AUTHORIZED")throw m$(new f1);return this._send(t,r,o,a+1)}}if(400===h.status&&"string"==typeof i&&this._isModernEnvelopedRequest(t))try{let r=sy.parse(JSON.parse(i)),o=(Array.isArray(t)?t:[t]).filter(t=>sp.safeParse(t).success);if(pf(r)&&o.some(t=>t.id===r.id))return void this.onmessage?.(r)}catch{}throw new dS(db.ClientHttpNotImplemented,`Error POSTing to endpoint: ${i}`,{status:h.status,statusText:h.statusText,text:i})}if(202===h.status){await h.text?.().catch(()=>{}),sI.safeParse(t).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),m=h.headers.get("content-type"),y=function(t){if(t)try{return pY.parse(t).type}catch{let r=(t.split(";",1)[0]??"").trim().toLowerCase();if(""===r||t.slice(r.length).includes(","))return;return r}}(m);if(f)if("text/event-stream"===y)this._handleSseStream(h.body,{onresumptiontoken:s,requestSignal:r?.requestSignal,onRequestStreamEnd:r?.onRequestStreamEnd},!1);else if("application/json"===y){let t=await h.json();for(let r of Array.isArray(t)?t.map(t=>sy.parse(t)):[sy.parse(t)])this.onmessage?.(r)}else throw await h.text?.().catch(()=>{}),new d_(db.ClientHttpUnexpectedContent,`Unexpected content type: ${m}`,{contentType:m});else await h.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 dS(db.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 mV=require("node:stream");var mF=s(6507);let mH="win32"===u5.platform?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];var mK=class{_process;_readBuffer;_serverParams;_stderrStream=null;onclose;onerror;onmessage;constructor(t){this._serverParams=t,this._readBuffer=new pQ({maxBufferSize:t.maxBufferSize}),("pipe"===t.stderr||"overlapped"===t.stderr)&&(this._stderrStream=new mV.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=mF(this._serverParams.command,this._serverParams.args??[],{env:{...function(){let t={};for(let r of mH){let o=u5.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"===u5.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 d_(db.NotConnected,"Not connected");let o=JSON.stringify(t)+"\n";this._process.stdin.write(o)?r():this._process.stdin.once("drain",r)})}};let mJ=t=>"env"in t&&"string"==typeof t.env,mB=t=>{let r={};return t.forEach(t=>{let o=t.name.trim();if(mJ(t)){let a=process.env[t.env];if(void 0===a)throw Error(`Environment variable "${t.env}" is not set (required for header "${o}")`);r[o]=a}else r[o]=t.value.trim()}),r},mG=s(8330),mZ={name:mG.name,version:mG.version},mW={capabilities:{sampling:{},elicitation:{form:{},url:{}},roots:{listChanged:!0}},versionNegotiation:{mode:"auto"}};async function mX({url:t,headers:r}){let o=new mq(mZ,mW),a=r?mB(r):{},i=new mU(new URL(t),{...r?{requestInit:{headers:a}}:{},reconnectionOptions:{maxReconnectionDelay:3e4,initialReconnectionDelay:1e3,reconnectionDelayGrowFactor:1.5,maxRetries:2}});return await o.connect(i),o}async function mY(t){let{onStderrData:r,...o}=t,a=new mq(mZ,mW),i=new mK({...o,stderr:o.stderr??"pipe"}),s=i.stderr;if(s){let t=r??(t=>{console.error(`[STDIO MCP Server stderr]: ${t}`)});s.on("data",t)}return await a.connect(i),{client:a,transport:i}}async function mQ(t){try{return(await t.client.listTools()).tools.map(t=>t.name)}catch(t){return console.error("Failed to list stdio MCP tools:",t),[]}}async function m0(t,r,o){try{return await t.client.callTool({name:r,arguments:o})}catch(t){throw console.error(`Failed to call stdio MCP tool "${r}":`,t),t}}async function m1(t){try{await t.transport.close(),await t.client.close()}catch(t){throw console.error("Error disconnecting from stdio MCP server:",t),t}}function m2(t){if(t?.body===void 0||null===t.body)return[];let r=Array.isArray(t.body)?t.body:[t.body],o=[];for(let t of r)if("object"==typeof t&&null!==t&&"method"in t&&"tools/call"===t.method){let r=t.params;r&&"object"==typeof r&&"name"in r&&"string"==typeof r.name&&o.push(r.name)}return o}let m9="2026-01-26",m4="ui/initialize",m5="ui/notifications/initialized",m3="ui/request-display-mode",m6="ui/open-link",m8="ui/update-model-context",m7="ui/message",ye="notifications/message",yt="resources/read",yr="ui/notifications/host-context-changed",yo="ui/notifications/size-changed";function ya(t){return!!t&&"object"==typeof t}function yi(t,r){return t instanceof Error&&t.message?t.message:r}function ys(t={}){let r=t.targetWindow??("undefined"==typeof window?null:window),o=t.requestTimeoutMs??15e3,a=t.connectionTimeoutMs??2e3,i=100,s=!1,n=!1,l={isConnected:!!r&&r.parent!==r,hostContext:null,hostCapabilities:null},c=new Set,u=new Map,d=t=>{if(t.isConnected!==l.isConnected||t.hostContext!==l.hostContext||t.hostCapabilities!==l.hostCapabilities)for(let r of(l=t,c))r(l)},p=t=>{var r,o;let a;d({isConnected:!0,hostContext:t.hostContext?(r=l.hostContext,o=t.hostContext,a={...r??{},...o},(r?.safeAreaInsets||o.safeAreaInsets)&&(a.safeAreaInsets={...r?.safeAreaInsets??{},...o.safeAreaInsets??{}}),(r?.containerDimensions||o.containerDimensions)&&(a.containerDimensions={...r?.containerDimensions??{},...o.containerDimensions??{}}),(r?.styles||o.styles)&&(a.styles={...r?.styles??{},...o.styles??{},variables:r?.styles?.variables||o.styles?.variables?{...r?.styles?.variables??{},...o.styles?.variables??{}}:void 0,css:r?.styles?.css||o.styles?.css?{...r?.styles?.css??{},...o.styles?.css??{}}:void 0}),a):l.hostContext,hostCapabilities:t.hostCapabilities?{...l.hostCapabilities??{},...t.hostCapabilities}:l.hostCapabilities})},h=t=>{if(!r||t.source!==r.parent||!ya(t.data))return;n=!0,l.isConnected||d({...l,isConnected:!0});let o=t.data;if("id"in o&&null!=o.id&&"number"==typeof o.id){let t=u.get(o.id);t&&(clearTimeout(t.timeoutId),u.delete(o.id),ya(o.error)?t.reject(Error("string"==typeof o.error.message?o.error.message:"MCP request failed")):t.resolve(o.result))}1===o.id&&ya(o.result)&&p({hostContext:ya(o.result.hostContext)?o.result.hostContext:void 0,hostCapabilities:ya(o.result.hostCapabilities)?o.result.hostCapabilities:void 0}),o.method===yr&&ya(o.params)&&p({hostContext:o.params}),"ui/hostContextChanged"===o.method&&ya(o.params)&&ya(o.params.hostContext)&&p({hostContext:o.params.hostContext})};r&&(r.addEventListener("message",h),r.parent!==r&&setTimeout(()=>{s||n||l.hostContext||d({...l,isConnected:!1})},a));let f=()=>{if(s)throw Error("MCP host bridge has been disposed");if(!r)throw Error("MCP host bridge requires a browser window");return r},m=(t,r)=>{f().parent.postMessage({jsonrpc:"2.0",method:t,params:r},"*")},y=(t,r={})=>{let a=f();return new Promise((s,n)=>{let l=i++,c=setTimeout(()=>{u.has(l)&&(u.delete(l),n(Error(`MCP request timed out: ${t}`)))},o);u.set(l,{resolve:s,reject:n,timeoutId:c}),a.parent.postMessage({jsonrpc:"2.0",id:l,method:t,params:r},"*")})},g=async(t,r)=>{let o;for(let a of t)try{return await y(a,r)}catch(r){o=r;let t=yi(r,"MCP request failed");if(!/method not found|unknown method/i.test(t))throw r}throw o instanceof Error?o:Error("MCP request failed")},v=async t=>{if(r?.open)return void r.open(t,"_blank","noopener,noreferrer");throw Error("Unable to open link without a browser window")};return{callTool:(t,r)=>y("tools/call",{name:t,arguments:r??{}}),requestDisplayMode:t=>g([m3,"ui/requestDisplayMode"],{mode:t}),async openLink(t){try{await g([m6,"ui/openLink"],{url:t})}catch(o){if(!l.isConnected||!r)return void await v(t);throw Error(yi(o,"Failed to open link"))}},readResource:t=>y(yt,{uri:t}),sendMessage:t=>y(m7,t),updateModelContext:t=>y(m8,t),async logMessage(t){m(ye,t)},async notifySizeChanged(t){m(yo,t)},getState:()=>l,getHostContext:()=>l.hostContext,getHostCapabilities:()=>l.hostCapabilities,isConnected:()=>l.isConnected,subscribe:t=>(c.add(t),()=>{c.delete(t)}),dispose(){if(!s){for(let[t,o]of(s=!0,r&&r.removeEventListener("message",h),u.entries()))clearTimeout(o.timeoutId),o.reject(Error("MCP host bridge has been disposed")),u.delete(t);c.clear()}}}}N().config()})(),n})());
|
|
68
|
+
depsCount: ${a},
|
|
69
|
+
deps: ${o}}`};let i={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(t){let[r,a]=function({schema:t}){let r={},a={};for(let o in t)"__proto__"!==o&&((Array.isArray(t[o])?r:a)[o]=t[o]);return[r,a]}(t);n(t,r),s(t,a)}};function n(t,a=t.schema){let{gen:i,data:s,it:l}=t;if(0===Object.keys(a).length)return;let c=i.let("missing");for(let n in a){let u=a[n];if(0===u.length)continue;let d=(0,o.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,o.checkReportMissingProp)(t,r)}):(i.if((0,r._)`${d} && (${(0,o.checkMissingProp)(t,u,c)})`),(0,o.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,a.alwaysValidSchema)(c,r[s])||(i.if((0,o.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}),yH=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=m5(),a=m6();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:o,schema:i,data:n,it:s}=t;if((0,a.alwaysValidSchema)(s,i))return;let l=o.name("valid");o.forIn("key",n,a=>{t.setParams({propertyName:a}),t.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},l),o.if((0,r.not)(l),()=>{t.error(!0),s.allErrors||o.break()})}),t.ok(l)}}}),yV=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=yo(),a=m5(),o=m3(),i=m6();t.default={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:t})=>(0,a._)`{additionalProperty: ${t.additionalProperty}}`},code(t){let{gen: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,a._)`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 o=n.name("valid");"failing"===h.removeAdditional?(v(r,o,!1),n.if((0,a.not)(o),()=>{t.reset(),y(r)})):(v(r,o),p||n.if((0,a.not)(o),()=>n.break()))}}function v(r,a,o){let n={keyword:"additionalProperties",dataProp:r,dataPropType:i.Type.Str};!1===o&&Object.assign(n,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(n,a)}n.forIn("key",c,o=>{f.length||m.length?n.if(function(o){let s;if(f.length>8){let t=(0,i.schemaRefOrVal)(d,l.properties,"properties");s=(0,r.isOwnProperty)(n,t,o)}else s=f.length?(0,a.or)(...f.map(t=>(0,a._)`${o} === ${t}`)):a.nil;return m.length&&(s=(0,a.or)(s,...m.map(i=>(0,a._)`${(0,r.usePattern)(t,i)}.test(${o})`))),(0,a.not)(s)}(o),()=>g(o)):g(o)}),t.ok((0,a._)`${u} === ${o.default.errors}`)}}}),yK=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=yu(),a=yo(),o=m6(),i=yV();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,a.allSchemaProperties)(s);for(let t of d)u.definedProperties.add(t);u.opts.unevaluated&&d.length&&!0!==u.props&&(u.props=o.mergeEvaluated.props(n,(0,o.toHash)(d),u.props));let p=d.filter(t=>!(0,o.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,a.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)}}}}),yF=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=yo(),a=m5(),o=m6(),i=m6();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,o.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 a.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,o.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(o){n.forIn("key",l,s=>{n.if((0,a._)`${(0,r.usePattern)(t,o)}.test(${s})`,()=>{let r=h.includes(o);r||t.subschema({keyword:"patternProperties",schemaProp:o,dataProp:s,dataPropType:i.Type.Str},m),u.opts.unevaluated&&!0!==y?n.assign((0,a._)`${y}[${s}]`,!0):r||u.allErrors||n.if((0,a.not)(m),()=>n.break())})})}}}}),yJ=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=m6();t.default={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:a,schema:o,it:i}=t;if((0,r.alwaysValidSchema)(i,o))return void t.fail();let n=a.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"}}}),yW=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:yo().validateUnion,error:{message:"must match a schema in anyOf"}}}),yB=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=m5(),a=m6();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:o,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=o.let("valid",!1),c=o.let("passing",null),u=o.name("_valid");t.setParams({passing:c}),o.block(function(){i.forEach((i,n)=>{let d;(0,a.alwaysValidSchema)(s,i)?o.var(u,!0):d=t.subschema({keyword:"oneOf",schemaProp:n,compositeRule:!0},u),n>0&&o.if((0,r._)`${u} && ${l}`).assign(l,!1).assign(c,(0,r._)`[${c}, ${n}]`).else(),o.if(u,()=>{o.assign(l,!0),o.assign(c,n),d&&t.mergeEvaluated(d,r.Name)})})}),t.result(l,()=>t.reset(),()=>t.error(!0))}}}),yG=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=m6();t.default={keyword:"allOf",schemaType:"array",code(t){let{gen:a,schema:o,it:i}=t;if(!Array.isArray(o))throw Error("ajv implementation error");let n=a.name("valid");o.forEach((a,o)=>{if((0,r.alwaysValidSchema)(i,a))return;let s=t.subschema({keyword:"allOf",schemaProp:o},n);t.ok(n),t.mergeEvaluated(s)})}}}),yZ=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=m5(),a=m6();function o(t,r){let o=t.schema[r];return void 0!==o&&!(0,a.alwaysValidSchema)(t,o)}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,a.checkStrictMode)(l,'"if" without "then" and "else" is ignored');let c=o(l,"then"),u=o(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(a,o){return()=>{let i=t.subschema({keyword:a},p);n.assign(d,p),t.mergeValidEvaluated(i,d),o?n.assign(o,(0,r._)`${a}`):t.setParams({ifClause:a})}}t.pass(d,()=>t.error(!0))}}}),yX=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=m6();t.default={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:a,it:o}){void 0===a.if&&(0,r.checkStrictMode)(o,`"${t}" without "if" is ignored`)}}}),yY=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=yM(),a=yz(),o=yq(),i=yD(),n=yL(),s=yU(),l=yH(),c=yV(),u=yK(),d=yF(),p=yJ(),h=yW(),f=yB(),m=yG(),y=yZ(),g=yX();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(a.default,i.default):v.push(r.default,o.default),v.push(n.default),v}}),yQ=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=m5();t.default={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,r.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,r._)`{format: ${t}}`},code(t,a){let o,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:b}=m;y.validateFormats&&(p?(o=u.scopeValue("formats",{ref:b.formats,code:y.code.formats}),i=u.const("fDef",(0,r._)`${o}[${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} === ${a} && !${c}`)))):function(){var o;let i,n,s=b.formats[h];if(!s){if(!1===y.strictSchema)return b.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=(o=s)instanceof RegExp?(0,r.regexpCode)(o):y.code.formats?(0,r._)`${y.code.formats}${(0,r.getProperty)(h)}`:void 0,n=u.scopeValue("formats",{key:h,ref:o,code:i}),"object"!=typeof o||o instanceof RegExp?["string",o,n]:[o.type||"string",o.validate,(0,r._)`${n}.validate`]);c===a&&t.pass(function(){if("object"==typeof s&&!(s instanceof RegExp)&&s.async){if(!v.$async)throw Error("async format in sync schema");return(0,r._)`await ${f}(${d})`}return"function"==typeof p?(0,r._)`${f}(${d})`:(0,r._)`${f}.test(${d})`}())}())}}}),y0=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=[yQ().default]}),y1=ds(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"]}),y2=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=yw(),a=yN(),o=yY(),i=y0(),n=y1();t.default=[r.default,a.default,(0,o.default)(),i.default,n.metadataVocabulary,n.contentVocabulary]}),y9=ds(t=>{var r,a;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,(a=r||(t.DiscrError=r={})).Tag="tag",a.Mapping="mapping"}),y4=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=m5(),a=y9(),o=yh(),i=yp(),n=m6();t.default={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:t,tagName:r}})=>t===a.DiscrError.Tag?`tag "${r}" must be string`:`value of tag "${r}" must be in oneOf`,params:({params:{discrError:t,tag:a,tagName:o}})=>(0,r._)`{error: ${t}, tag: ${o}, tagValue: ${a}}`},code(t){let{gen:s,data:l,schema:c,parentSchema:u,it:d}=t,{oneOf:p}=u;if(!d.opts.discriminator)throw Error("discriminator: requires discriminator option");let 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={},a=l(u),s=!0;for(let r=0;r<p.length;r++){let u=p[r];if((null==u?void 0:u.$ref)&&!(0,n.schemaHasRulesButRef)(u,d.self.RULES)){let t=u.$ref;if((u=o.resolveRef.call(d.self,d.schemaEnv.root,d.baseId,t))instanceof o.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&&(a||l(u)),function(t,r){if(t.const)c(t.const,r);else if(t.enum)for(let a of t.enum)c(a,r);else throw Error(`discriminator: "properties/${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,a){if("string"!=typeof t||t in r)throw Error(`discriminator: "${h}" values must be unique strings`);r[t]=a}}();for(let a in s.if(!1),l)s.elseIf((0,r._)`${m} === ${a}`),s.assign(f,function(a){let o=s.name("valid"),i=t.subschema({keyword:"oneOf",schemaProp:a},o);return t.mergeEvaluated(i,r.Name),o}(l[a]));s.else(),t.error(!1,{discrError:a.DiscrError.Mapping,tag:m,tagName:h}),s.endIf()})(),()=>t.error(!1,{discrError:a.DiscrError.Tag,tag:m,tagName:h})),t.ok(f)}}}),y5=ds((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}}),y6=ds((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv=void 0;let a=yb(),o=y2(),i=y4(),n=y5(),s=["/properties"],l="http://json-schema.org/draft-07/schema";var c=class extends a.default{_addVocabularies(){super._addVocabularies(),o.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=yu();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=m5();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=yd();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return p.default}});var h=yp();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return h.default}})}),y3=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicAnchor=void 0;let r=m5(),a=m3(),o=yh(),i=yS();function n(t,n){let{gen:s,it:l}=t;l.schemaEnv.root.dynamicAnchors[n]=!0;let c=(0,r._)`${a.default.dynamicAnchors}${(0,r.getProperty)(n)}`,u="#"===l.errSchemaPath?l.validateName:function(t){let{schemaEnv:r,schema:a,self:n}=t.it,{root:s,baseId:l,localRefs:c,meta:u}=r.root,{schemaId:d}=n.opts,p=new o.SchemaEnv({schema:a,schemaId:d,root:s,baseId:l,localRefs:c,meta:u});return o.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)}}),y8=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicRef=void 0;let r=m5(),a=m3(),o=yS();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 o=n.let("_v",(0,r._)`${a.default.dynamicAnchors}${(0,r.getProperty)(c)}`);n.if(o,d(o,t),d(l.validateName,t))}else d(l.validateName,t)()}function d(r,a){return a?()=>n.block(()=>{(0,o.callRef)(t,r),n.let(a,!0)}):()=>(0,o.callRef)(t,r)}}t.dynamicRef=i,t.default={keyword:"$dynamicRef",schemaType:"string",code:t=>i(t,t.schema)}}),y7=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=y3(),a=m6();t.default={keyword:"$recursiveAnchor",schemaType:"boolean",code(t){t.schema?(0,r.dynamicAnchor)(t,""):(0,a.checkStrictMode)(t.it,"$recursiveAnchor: false is ignored")}}}),ge=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=y8();t.default={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,r.dynamicRef)(t,t.schema)}}),gt=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=y3(),a=y8(),o=y7(),i=ge();t.default=[r.default,a.default,o.default,i.default]}),gr=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=yU();t.default={keyword:"dependentRequired",type:"object",schemaType:"object",error:r.error,code:t=>(0,r.validatePropertyDeps)(t)}}),ga=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=yU();t.default={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,r.validateSchemaDeps)(t)}}),go=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=m6();t.default={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:t,parentSchema:a,it:o}){void 0===a.contains&&(0,r.checkStrictMode)(o,`"${t}" without "contains" is ignored`)}}}),gi=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=gr(),a=ga(),o=go();t.default=[r.default,a.default,o.default]}),gn=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=m5(),a=m6(),o=m3();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(o){if(!1===n){t.setParams({unevaluatedProperty:o}),t.error(),u||i.break();return}if(!(0,a.alwaysValidSchema)(c,n)){let n=i.name("valid");t.subschema({keyword:"unevaluatedProperties",dataProp:o,dataPropType:a.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 a,o;return i.if((a=d,o=t,(0,r._)`!${a} || !${a}[${o}]`),()=>p(t))})):!0!==d&&i.forIn("key",s,t=>void 0===d?p(t):i.if(function(t,a){let o=[];for(let i in t)!0===t[i]&&o.push((0,r._)`${a} !== ${i}`);return(0,r.and)(...o)}(d,t),()=>p(t))),c.props=!0,t.ok((0,r._)`${l} === ${o.default.errors}`)}}}),gs=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=m5(),a=m6();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:o,schema:i,data:n,it:s}=t,l=s.items||0;if(!0===l)return;let c=o.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,a.alwaysValidSchema)(s,i)){let i=o.var("valid",(0,r._)`${c} <= ${l}`);o.if((0,r.not)(i),()=>{var n,u;return n=i,u=l,void o.forRange("i",u,c,i=>{t.subschema({keyword:"unevaluatedItems",dataProp:i,dataPropType:a.Type.Num},n),s.allErrors||o.if((0,r.not)(n),()=>o.break())})}),t.ok(i)}s.items=!0}}}),gl=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=gn(),a=gs();t.default=[r.default,a.default]}),gc=ds((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"}]}}}}}),gu=ds((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:"#"}}}}}),gd=ds((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:"#"}}}}),gp=ds((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:{}}}}}),gh=ds((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"}}}}),gf=ds((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}}}}),gm=ds((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:[]}}}}),gy=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=gc(),a=gu(),o=gd(),i=gp(),n=gh(),s=gf(),l=gm(),c=["/properties"];t.default=function(t){return[r,a,o,i,u(this,n),s,u(this,l)].forEach(t=>this.addMetaSchema(t,void 0,!1)),this;function u(r,a){return t?r.$dataMetaSchema(a,c):a}}}),gg=ds((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv2019=void 0;let a=yb(),o=y2(),i=gt(),n=gi(),s=gl(),l=y4(),c=gy(),u="https://json-schema.org/draft/2019-09/schema";var d=class extends a.default{constructor(t={}){super({...t,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(i.default),o.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=yu();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return p.KeywordCxt}});var h=m5();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=yd();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return f.default}});var m=yp();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return m.default}})}),gv=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=yw(),a=yN(),o=yY(),i=gt(),n=gi(),s=gl(),l=y0(),c=y1();t.default=[i.default,r.default,a.default,(0,o.default)(!0),l.default,c.metadataVocabulary,c.contentVocabulary,n.default,s.default]}),gb=ds((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}}}}),g_=ds((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"}}}}}),gS=ds((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"}}}}),gw=ds((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"}}}}),g$=ds((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"}}}}),gE=ds((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"}}}}),gP=ds((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}}}}),gR=ds((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:[]}}}}),gk=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=gb(),a=g_(),o=gS(),i=gw(),n=g$(),s=gE(),l=gP(),c=gR(),u=["/properties"];t.default=function(t){return[r,a,o,i,n,d(this,s),l,d(this,c)].forEach(t=>this.addMetaSchema(t,void 0,!1)),this;function d(r,a){return t?r.$dataMetaSchema(a,u):a}}}),gx=ds((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv2020=void 0;let a=yb(),o=gv(),i=y4(),n=gk(),s="https://json-schema.org/draft/2020-12/schema";var l=class extends a.default{constructor(t={}){super({...t,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),o.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=yu();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=m5();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=yd();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.default}});var p=yp();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}),gT=ds(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<=b&&t>=v}},int64:{type:"number",validate:function(t){return Number.isInteger(t)}},float:{type:"number",validate:_},double:{type:"number",validate:_},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 a=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,o=[0,31,28,31,30,31,30,31,31,30,31,30,31];function i(t){var r;let i=a.exec(t);if(!i)return!1;let 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:o[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 a=s.exec(r);if(!a)return!1;let o=+a[1],i=+a[2],n=+a[3],l=a[4],c="-"===a[5]?-1:1,u=+(a[6]||0),d=+(a[7]||0);if(u>23||d>59||t&&!l)return!1;if(o<=23&&i<=59&&n<60)return!0;let p=i-d*c,h=o-u*c-(p<0);return(23===h||-1===h)&&(59===p||-1===p)&&n<61}}function c(t,r){if(!(t&&r))return;let a=new Date("2020-01-01T"+t).valueOf(),o=new Date("2020-01-01T"+r).valueOf();if(a&&o)return a-o}function u(t,r){if(!(t&&r))return;let a=s.exec(t),o=s.exec(r);if(a&&o)return(t=a[1]+a[2]+a[3])>(r=o[1]+o[2]+o[3])?1:t<r?-1:0}let d=/t|\s/i;function p(t){let r=l(t);return function(t){let a=t.split(d);return 2===a.length&&i(a[0])&&r(a[1])}}function h(t,r){if(!(t&&r))return;let a=new Date(t).valueOf(),o=new Date(r).valueOf();if(a&&o)return a-o}function f(t,r){if(!(t&&r))return;let[a,o]=t.split(d),[i,s]=r.split(d),l=n(a,i);if(void 0!==l)return l||c(o,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,b=0x80000000-1;function _(){return!0}let S=/[^\\]\\Z/}),gO=ds(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;let r=y6(),a=m5(),o=a.operators,i={formatMaximum:{okStr:"<=",ok:o.LTE,fail:o.GT},formatMinimum:{okStr:">=",ok:o.GTE,fail:o.LT},formatExclusiveMaximum:{okStr:"<",ok:o.LT,fail:o.GTE},formatExclusiveMinimum:{okStr:">",ok:o.GT,fail:o.LTE}};t.formatLimitDefinition={keyword:Object.keys(i),type:"string",schemaType:"string",$data:!0,error:{message:({keyword:t,schemaCode:r})=>(0,a.str)`should be ${i[t].okStr} ${r}`,params:({keyword:t,schemaCode:r})=>(0,a._)`{comparison: ${i[t].okStr}, limit: ${r}}`},code(t){let o,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,a._)`${t}.compare(${l}, ${c}) ${i[u].fail} 0`}f.$data?(o=s.scopeValue("formats",{ref:h.formats,code:p.code.formats}),n=s.const("fmt",(0,a._)`${o}[${f.schemaCode}]`),t.fail$data((0,a.or)((0,a._)`typeof ${n} != "object"`,(0,a._)`${n} instanceof RegExp`,(0,a._)`typeof ${n}.compare != "function"`,m(n)))):function(){let r=f.schema,o=h.formats[r];if(!o||!0===o)return;if("object"!=typeof o||o instanceof RegExp||"function"!=typeof o.compare)throw Error(`"${u}": format "${r}" does not define "compare" function`);let i=s.scopeValue("formats",{key:r,ref:o,code:p.code.formats?(0,a._)`${p.code.formats}${(0,a.getProperty)(r)}`:void 0});t.fail$data(m(i))}()},dependencies:["format"]},t.default=r=>(r.addKeyword(t.formatLimitDefinition),r)}),gj=ds((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});let a=gT(),o=gO(),i=m5(),n=new i.Name("fullFormats"),s=new i.Name("fastFormats"),l=(t,r={keywords:!0})=>{if(Array.isArray(r))return c(t,r,a.fullFormats,n),t;let[i,l]="fast"===r.mode?[a.fastFormats,s]:[a.fullFormats,n];return c(t,r.formats||a.formatNames,i,l),r.keywords&&(0,o.default)(t),t};function c(t,r,a,o){var n;for(let s of(null!=(n=t.opts.code).formats||(n.formats=(0,i._)`require("ajv-formats/dist/formats").${o}`),r))t.addFormat(s,a[s])}l.get=(t,r="full")=>{let o=("fast"===r?a.fastFormats:a.fullFormats)[t];if(!o)throw Error(`Unknown format "${t}"`);return o},r.exports=t=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l}),gC=y6(),gA=gg(),gI=gx();let gN=dl(gj(),1).default;function gM(t){let r=new t({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return gN(r),r}var gq=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(t){this._userAjv=void 0!==t,this._ajv=t}get ajv(){return this._ajv??=gM(gI.Ajv2020)}_engineFor(t){if(this._userAjv)return this.ajv;let r=function(t,r){if(!("$schema"in t)||"string"!=typeof t.$schema)return"2020-12";let a=t.$schema.replace(/#$/,"");if(dc.has(a))return"2020-12";if(du.has(a))return"2019-09";if(dd.has(a)||dp.has(a))return"draft-7";throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${t.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${r}`)}(t,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");return"2020-12"===r?this.ajv:"2019-09"===r?this._ajv2019??=gM(gA.Ajv2019):this._ajvDraft7??=gM(gC.Ajv)}getValidator(t){let r=this._engineFor(t),a="$id"in t&&"string"==typeof t.$id?r.getSchema(t.$id)??r.compile(t):r.compile(t);return t=>a(t)?{valid:!0,data:t,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:r.errorsText(a.errors)}}};async function gz(t){return(await p).getRandomValues(new Uint8Array(t))}async function gD(t){let r="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",a=256-256%r.length,o="";for(;o.length<t;)for(let i of(await gz(t-o.length)))i<a&&(o+=r[i%r.length]);return o}async function gL(t){return await gD(t)}async function gU(t){return btoa(String.fromCharCode(...new Uint8Array(await (await p).subtle.digest("SHA-256",new TextEncoder().encode(t))))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function gH(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let r=await gL(t),a=await gU(r);return{code_verifier:r,code_challenge:a}}gC.Ajv,p=globalThis.crypto?.webcrypto??globalThis.crypto??Promise.resolve().then(n.t.bind(n,7598,19)).then(t=>t.webcrypto);class gV 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 gK(t){}function gF(t,r,a){return 100===a&&97===t.charCodeAt(r+1)&&116===t.charCodeAt(r+2)&&97===t.charCodeAt(r+3)&&58===t.charCodeAt(r+4)}function gJ(t,r,a){return 101===a&&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 gW extends TransformStream{constructor({onError:t,onRetry:r,onComment:a,maxBufferSize:o}={}){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=gK,onError:a=gK,onRetry:o=gK,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,a(new gV(`Buffered data exceeded max buffer size of ${n} characters`,{type:"max-buffer-size-exceeded"}))))}function y(t){let a=0;if(-1===t.indexOf("\r")){let o=t.indexOf(`
|
|
70
|
+
`,a);for(;-1!==o;){if(a===o){p>0&&r({id:u,event:h,data:d}),u=void 0,d="",p=0,h=void 0,a=o+1,o=t.indexOf(`
|
|
71
|
+
`,a);continue}let i=t.charCodeAt(a);if(gF(t,a,i)){let i=32===t.charCodeAt(a+5)?a+6:a+5,n=t.slice(i,o);if(0===p&&10===t.charCodeAt(o+1)){r({id:u,event:h,data:n}),u=void 0,d="",h=void 0,a=o+2,o=t.indexOf(`
|
|
72
|
+
`,a);continue}d=0===p?n:`${d}
|
|
73
|
+
${n}`,p++}else gJ(t,a,i)?h=t.slice(32===t.charCodeAt(a+6)?a+7:a+6,o)||void 0:g(t,a,o);a=o+1,o=t.indexOf(`
|
|
74
|
+
`,a)}return t.slice(a)}for(;a<t.length;){let r=t.indexOf("\r",a),o=t.indexOf(`
|
|
75
|
+
`,a),i=-1;if(-1!==r&&-1!==o?i=r<o?r:o:-1!==r?i=r===t.length-1?-1:r:-1!==o&&(i=o),-1===i)break;g(t,a,i),a=i+1,13===t.charCodeAt(a-1)&&10===t.charCodeAt(a)&&a++}return t.slice(a)}function g(t,a,o){if(a===o)return void(p>0&&r({id:u,event:h,data:d}),u=void 0,d="",p=0,h=void 0);let n=t.charCodeAt(a);if(gF(t,a,n)){let r=32===t.charCodeAt(a+5)?a+6:a+5,i=t.slice(r,o);d=0===p?i:`${d}
|
|
76
|
+
${i}`,p++;return}if(gJ(t,a,n)){h=t.slice(32===t.charCodeAt(a+6)?a+7:a+6,o)||void 0;return}if(105===n&&100===t.charCodeAt(a+1)&&58===t.charCodeAt(a+2)){let r=t.slice(32===t.charCodeAt(a+3)?a+4:a+3,o);u=r.includes("\0")?void 0:r;return}if(58===n){i&&i(t.slice(a,o).slice(32===t.charCodeAt(a+1)?2:1));return}let s=t.slice(a,o),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}
|
|
77
|
+
${r}`,p++;break;case"id":u=r.includes("\0")?void 0:r;break;case"retry":/^\d+$/.test(r)?o(parseInt(r,10)):a(new gV(`Invalid \`retry\` value: "${r}"`,{type:"invalid-retry",value:r,line:i}));break;default:a(new gV(`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(`
|
|
78
|
+
`)&&-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 a=y(r);""!==a&&(s.push(a),l=a.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:a,maxBufferSize:o})},transform(t){i.feed(t)}})}}var gB=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](t){return fd(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 fd(this,t)}constructor(t){super(t),this.name=new.target.name,fu(this,new.target)}},gG=class extends gB{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.IssuerMismatchError"})}kind;expected;received;constructor(t,r,a){super(`Issuer mismatch in ${"metadata"===t?"authorization server metadata (RFC 8414 \xa73.3)":"authorization response (RFC 9207)"}: expected ${JSON.stringify(r)}, received ${JSON.stringify(a)}`),this.kind=t,this.expected=r,this.received=a}},gZ=class extends gB{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}},gX=class extends gB{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}},gY=class extends gB{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}},gQ=class extends gB{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 g0(t,r,a){if(t)return"string"!=typeof t.issuer?(a?.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}):g1(t.issuer,r)?t:void 0}function g1(t,r){return t===r||t.endsWith("/")&&t.slice(0,-1)===r||r.endsWith("/")&&r.slice(0,-1)===t}async function g2(t,r,a){let{resourceMetadataUrl:o,scope:i}=vs(r.response);if(await va(t,{serverUrl:r.serverUrl,resourceMetadataUrl:o,scope:i,fetchFn:r.fetchFn,...a})!=="AUTHORIZED")throw new g9}var g9=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](t){return fd(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 fd(this,t)}constructor(t){super(t??"Unauthorized"),this.name="UnauthorizedError",fu(this,new.target)}};function g4(t){return t?.authorization_response_iss_parameter_supported===!0}function g5({iss:t,expectedIssuer:r,issParameterSupported:a}){if(void 0!==r){if(void 0===t){if(a)throw new gG("authorization_response",r,void 0);return}if(t!==r)throw new gG("authorization_response",r,t)}}function g6(...t){let r=new Set;for(let a of t)if(a)for(let t of a.split(/\s+/))t&&r.add(t);return r.size>0?[...r].join(" "):void 0}async function g3(t,r,a,o,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 a.discoveryState?.())?.authorizationServerMetadata;if(!l)try{l=(await vf(o,i)).authorizationServerMetadata}catch{l=void 0}if(!l)throw new g9("Authorization callback failed and the issuer could not be verified");g5({iss:n,expectedIssuer:l.issuer,issParameterSupported:g4(l)});let c=t.get("error");if(c)throw new fh(c,t.get("error_description")??c,t.get("error_uri")??void 0);throw new g9("Authorization callback contained neither `code` nor `error`")}let g8="code",g7="S256";function ve(t){return"localhost"===t||t.endsWith(".localhost")||"127.0.0.1"===t||"[::1]"===t||"::1"===t}async function vt(t){let r=t instanceof Response?t.status:void 0,a=t instanceof Response?await t.text():t;try{let t=fr.parse(JSON.parse(a));return fh.fromResponse(t)}catch(o){let t=`${r?`HTTP ${r}: `:""}Invalid OAuth error response: ${o}. Raw body: ${a}`;return new fh(fp.ServerError,t)}}function vr(t,r,a){let o=void 0===t.invalidateCredentials?`retrying authorization without discarding the stored ${a} (provider implements no invalidateCredentials())`:`invalidating the stored ${a} and retrying authorization`;console.warn(`[mcp-sdk] OAuth ${JSON.stringify(r.code)} — ${o}. Cause: ${JSON.stringify(r.message)}`)}async function va(t,r){try{return await vo(t,r)}catch(a){if(a instanceof fh){if(a.code===fp.InvalidClient||a.code===fp.UnauthorizedClient)return vr(t,a,"client credentials and tokens"),await t.invalidateCredentials?.("client"),await t.invalidateCredentials?.("tokens"),await vo(t,r);else if(a.code===fp.InvalidGrant||a.code===fp.InvalidDpopProof)return vr(t,a,"tokens"),await t.invalidateCredentials?.("tokens"),await vo(t,r)}throw a}}async function vo(t,{serverUrl:r,authorizationCode:a,iss:o,scope:i,resourceMetadataUrl:n,fetchFn:s,skipIssuerMetadataValidation:l,forceReauthorization:c}){let u,d,p,h,f,m={...f=t.clientMetadata,grant_types:f.grant_types??(void 0===t.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||ve(t.hostname))return"native"}return"web"}(f.redirect_uris)},y=await t.discoveryState?.(),g=n;if(!g&&y?.resourceMetadataUrl&&(g=new URL(y.resourceMetadataUrl)),y?.authorizationServerUrl){if(d=y.authorizationServerUrl,u=y.resourceMetadata,p=y.authorizationServerMetadata??await vh(d,{fetchFn:s,skipIssuerValidation:l}),!u)try{u=await vc(r,{resourceMetadataUrl:g},s)}catch(t){if(t instanceof TypeError)throw t}(p!==y.authorizationServerMetadata||u!==y.resourceMetadata)&&await t.saveDiscoveryState?.({authorizationServerUrl:String(d),resourceMetadataUrl:g?.toString(),resourceMetadata:u,authorizationServerMetadata:p})}else{let t=await vf(r,{resourceMetadataUrl:g,fetchFn:s,skipIssuerMetadataValidation:l});d=t.authorizationServerUrl,p=t.authorizationServerMetadata,u=t.resourceMetadata,h={authorizationServerUrl:String(d),resourceMetadataUrl:g?.toString(),resourceMetadata:u,authorizationServerMetadata:p}}let v=p?.issuer??String(d),b={issuer:v};if(await t.saveAuthorizationServerUrl?.(v),void 0!==a){let r=y?.authorizationServerMetadata?.issuer??y?.authorizationServerUrl;if(void 0===r){if(void 0!==t.saveDiscoveryState)throw new gY("discoveryState was not available on the callback leg; ensure your provider persists discoveryState alongside codeVerifier",v);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(!g1(r,v))throw new gY(r,v)}h&&await t.saveDiscoveryState?.(h);let _=await vi(r,t,u),S=_&&u&&!t.validateResourceURL?u.resource:_;S&&await t.saveResourceUrl?.(vm(S));let w=function(t){let{requestedScope:r,resourceMetadata:a,authServerMetadata:o,clientMetadata:i}=t,n=r||a?.scopes_supported?.join(" ")||i.scope;return n&&o?.scopes_supported?.includes("offline_access")&&!n.split(" ").includes("offline_access")&&i.grant_types?.includes("refresh_token")&&(n=`${n} offline_access`),n}({requestedScope:i,resourceMetadata:u,authServerMetadata:p,clientMetadata:t.clientMetadata}),$=await Promise.resolve(t.clientInformation(b)),E=g0($,v,{canPersistStamp:void 0!==t.saveClientInformation});if(void 0===E&&$?.issuer&&void 0===t.saveClientInformation)throw new gY($.issuer,v);if(E&&void 0===E.issuer&&(E={...E,issuer:v},await t.saveClientInformation?.(E,b)),!E){if(void 0!==a)throw Error("Existing OAuth client information is required when exchanging an authorization code");let r=p?.client_id_metadata_document_supported===!0,o=t.clientMetadataUrl;if(o&&!function(t){if(!t)return!1;try{let r=new URL(t);return"https:"===r.protocol&&"/"!==r.pathname}catch{return!1}}(o))throw new fh(fp.InvalidClientMetadata,`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${o}`);if(r&&o)E={client_id:o,issuer:v},await t.saveClientInformation?.(E,b);else{if(!t.saveClientInformation)throw Error("OAuth client information must be saveable for dynamic registration");E={...await v_(d,{metadata:p,clientMetadata:m,scope:w,fetchFn:s}),issuer:v},await t.saveClientInformation(E,b)}}let P=!t.redirectUrl;if(void 0!==a||P){void 0!==a&&g5({iss:o,expectedIssuer:p?.issuer,issParameterSupported:g4(p)});let r=await vb(t,d,{metadata:p,resource:S,authorizationCode:a,iss:o,scope:w,fetchFn:s});return await t.saveTokens({...r,issuer:v},b),"AUTHORIZED"}let R=g0(await t.tokens(b),v);if(R&&void 0===R.issuer&&(R={...R,issuer:v},await t.saveTokens(R,b)),R?.refresh_token&&!c){let r;try{r=await vv(d,{metadata:p,clientInformation:E,refreshToken:R.refresh_token,resource:S,addClientAuthentication:t.addClientAuthentication,dpop:await t.dpop?.(),fetchFn:s})}catch(t){if(t instanceof gX||t instanceof fh&&t.code!==fp.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:v},b),"AUTHORIZED"}let k=t.state?await t.state():void 0,{authorizationUrl:x,codeVerifier:T}=await vy(d,{metadata:p,clientInformation:E,state:k,redirectUrl:t.redirectUrl,scope:w,resource:S});return await t.saveCodeVerifier(T),await t.redirectToAuthorization(x),"REDIRECT"}async function vi(t,r,a){let o,i=((o=new URL("string"==typeof t?t:t.href)).hash="",o);if(r.validateResourceURL)return await r.validateResourceURL(i,a?.resource);if(a){if(!function({requestedResource:t,configuredResource:r}){let a=new URL("string"==typeof t?t:t.href),o=new URL("string"==typeof r?r:r.href);if(a.origin!==o.origin||a.pathname.length<o.pathname.length)return!1;let i=a.pathname.endsWith("/")?a.pathname:a.pathname+"/",n=o.pathname.endsWith("/")?o.pathname:o.pathname+"/";return i.startsWith(n)}({requestedResource:i,configuredResource:a.resource}))throw Error(`Protected resource ${a.resource} does not match expected ${i} (or origin)`);return new URL(a.resource)}}let vn=new Set(["bearer","dpop"]);function vs(t){let r,a=t.headers.get("WWW-Authenticate");if(!a)return{};let[o,i]=a.split(" ");if(!o||!vn.has(o.toLowerCase())||!i)return{};let n=vl(t,"resource_metadata")||void 0;if(n)try{r=new URL(n)}catch{}let s=vl(t,"scope")||void 0;return{resourceMetadataUrl:r,scope:s,error:vl(t,"error")||void 0,errorDescription:vl(t,"error_description")||void 0}}function vl(t,r){let a=t.headers.get("WWW-Authenticate");if(!a)return null;let o=new RegExp(String.raw`${r}=(?:"([^"]+)"|([^\s,]+))`),i=a.match(o);if(i){let t=i[1]||i[2];if(t)return t}return null}async function vc(t,r,a=fetch){let o=await vp(t,"oauth-protected-resource",a,{protocolVersion:r?.protocolVersion,metadataUrl:r?.resourceMetadataUrl});if(!o||404===o.status)throw await o?.text?.().catch(()=>{}),Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!o.ok)throw await o.text?.().catch(()=>{}),Error(`HTTP ${o.status} trying to load well-known OAuth protected resource metadata.`);return h6.parse(await o.json())}async function vu(t,r,a=fetch){let o=m2(a);try{return await o(t,{headers:r})}catch(t){throw t}}async function vd(t,r,a=fetch){return await vu(t,{"MCP-Protocol-Version":r},a)}async function vp(t,r,a,o){var i,n;let s,l=new URL(t),c=o?.protocolVersion??dh;o?.metadataUrl?s=new URL(o.metadataUrl):(s=new URL(function(t,r="",a={}){return r.endsWith("/")&&(r=r.slice(0,-1)),a.prependPathname?`${r}/.well-known/${t}`:`/.well-known/${t}${r}`}(r,l.pathname),o?.metadataServerUrl??l)).search=l.search;let u=await vd(s,c,a);return o?.metadataUrl||(i=u,n=l.pathname,i&&("/"===n||(i.ok||!(i.status<500))&&502!==i.status))||(u=await vd(new URL(`/.well-known/${r}`,l),c,a)),u}async function vh(t,{fetchFn:r=fetch,protocolVersion:a=dh,skipIssuerValidation:o=!1}={}){let i={"MCP-Protocol-Version":a,Accept:"application/json"};for(let{url:a,type:n}of function(t){let r="string"==typeof t?new URL(t):t,a="/"!==r.pathname,o=[];if(!a)return o.push({url:new URL("/.well-known/oauth-authorization-server",r.origin),type:"oauth"},{url:new URL("/.well-known/openid-configuration",r.origin),type:"oidc"}),o;let i=r.pathname;return i.endsWith("/")&&(i=i.slice(0,-1)),o.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"}),o}(t)){let s=await vu(a,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 ${a}`)}let l="oauth"===n?h3.parse(await s.json()):h7.parse(await s.json());if(!o){let r="string"==typeof t?t:t.href;if(!(l.issuer===r||r.endsWith("/")&&l.issuer===r.slice(0,-1)))throw new gG("metadata",r,l.issuer)}return l}}async function vf(t,r){let a,o;try{(a=await vc(t,{resourceMetadataUrl:r?.resourceMetadataUrl},r?.fetchFn)).authorization_servers&&a.authorization_servers.length>0&&(o=a.authorization_servers[0])}catch(t){if(t instanceof TypeError)throw t}o||(o=String(new URL("/",t)));let i=await vh(o,{fetchFn:r?.fetchFn,skipIssuerValidation:r?.skipIssuerMetadataValidation});return{authorizationServerUrl:o,authorizationServerMetadata:i,resourceMetadata:a}}function vm(t){return"string"==typeof t?t:t.href}async function vy(t,{metadata:r,clientInformation:a,redirectUrl:o,scope:i,state:n,resource:s}){let l;if(r){if(l=new URL(r.authorization_endpoint),!r.response_types_supported.includes(g8))throw Error(`Incompatible auth server: does not support response type ${g8}`);if(r.code_challenge_methods_supported&&!r.code_challenge_methods_supported.includes(g7))throw Error(`Incompatible auth server: does not support code challenge method ${g7}`)}else l=new URL("/authorize",t);let c=await gH(),u=c.code_verifier,d=c.code_challenge;return l.searchParams.set("response_type",g8),l.searchParams.set("client_id",a.client_id),l.searchParams.set("code_challenge",d),l.searchParams.set("code_challenge_method",g7),l.searchParams.set("redirect_uri",String(o)),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",vm(s)),{authorizationUrl:l,codeVerifier:u}}async function vg(t,{metadata:r,tokenRequestParams:a,clientInformation:o,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&&!ve(r.hostname))throw new gX(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&&a.set("resource",vm(n)),!i&&o&&function(t,r,a,o){let{client_id:i,client_secret:n}=r;switch(t){case"client_secret_basic":var s,l,c,u,d=i,p=n,h=a;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=o).set("client_id",s),l&&c.set("client_secret",l);return;case"none":u=i,o.set("client_id",u);return;default:throw Error(`Unsupported client authentication method: ${t}`)}}((c=o,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"),o,h,a);let f=async()=>{let t=new Headers(h);return i&&await i(t,a,p,r),s&&t.set("DPoP",await s.buildProof({htm:"POST",htu:p})),m2(l??fetch)(p,{method:"POST",headers:t,body:a})},m=await f();if(s&&400===m.status&&(await m.clone().json().catch(()=>{}))?.error===fp.UseDpopNonce&&(s.observeNonce(m,p),m=await f()),s?.observeNonce(m,p),!m.ok)throw await vt(m);let y=await m.json();try{return fe.parse(fg(y))}catch(t){if("object"==typeof y&&null!==y&&"error"in y)throw await vt(JSON.stringify(y));throw t}}async function vv(t,{metadata:r,clientInformation:a,refreshToken:o,resource:i,addClientAuthentication:n,dpop:s,fetchFn:l}){return{refresh_token:o,...await vg(t,{metadata:r,tokenRequestParams:new URLSearchParams({grant_type:"refresh_token",refresh_token:o}),clientInformation:a,addClientAuthentication:n,resource:i,dpop:s,fetchFn:l})}}async function vb(t,r,{metadata:a,resource:o,authorizationCode:i,iss:n,scope:s,fetchFn:l}={}){let c;void 0!==i&&g5({iss:n,expectedIssuer:a?.issuer,issParameterSupported:g4(a)});let u=a?.issuer??String(r),d=async()=>{let r=await t.clientInformation({issuer:u}),a=g0(r,u,{canPersistStamp:!1});if(r&&void 0===a)throw new gY(String(r.issuer),u);return a},p=await d(),h=s??t.clientMetadata.scope;if(t.prepareTokenRequest&&(c=await t.prepareTokenRequest(h)),!c){if(!i)throw Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!t.redirectUrl)throw Error("redirectUrl is required for authorization_code flow");c=new URLSearchParams({grant_type:"authorization_code",code:i,code_verifier:await t.codeVerifier(),redirect_uri:String(t.redirectUrl)})}return vg(r,{metadata:a,tokenRequestParams:c,clientInformation:p??=await d(),addClientAuthentication:t.addClientAuthentication,resource:o,dpop:await t.dpop?.(),fetchFn:l})}async function v_(t,{metadata:r,clientMetadata:a,scope:o,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={...a,...void 0===o?{}:{scope:o}},l=await m2(i??fetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!l.ok)throw new gZ({status:l.status,body:await l.text(),submittedMetadata:s});return fn.parse(fg(await l.json()))}let vS=new Set(["tools/list","prompts/list","resources/list","resources/templates/list","server/discover"]);var vw=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(v$(t))}set(t,r){let a=v$(t),o=vS.has(t.method),i=!this._entries.has(a);if(!o&&i&&this._maxEntries>0&&this._cappedSize>=this._maxEntries){for(let t of this._entries.keys())if(!vS.has(t.slice(0,t.indexOf("\0")))){this._entries.delete(t),this._cappedSize--;break}}let n=++this._stamp;return this._entries.set(a,{...r,stamp:n}),i&&!o&&this._cappedSize++,n}delete(t){this._entries.delete(v$(t))&&!vS.has(t.method)&&this._cappedSize--}evict(t){let r=`${t}\0`,a=vS.has(t);for(let t of this._entries.keys())t.startsWith(r)&&(this._entries.delete(t),!a&&this._cappedSize--)}clear(){this._entries.clear(),this._cappedSize=0}};function v$(t){return`${t.method}\0${JSON.stringify([t.partition??"",t.params??""])}`}function vE(t,r){return void 0===r?t:`${t}\0${r}`}var vP=class{_evictionGeneration=new Map;_toolIndex;_toolOutputValidatorIndex;_serverIdentity="";constructor(t,r,a=()=>{},o="",i=Date.now){this._store=t,this._isUserSupplied=r,this._reportError=a,this._cachePartition=o,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 a={method:t,params:r??""},o=this._partitionFor("private"),i=await this._store.get({...a,partition:o});if(void 0!==i)return i;let n=this._partitionFor("public");if(n===o)return;let s=await this._store.get({...a,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 a=this._partitionFor("private"),o=this._partitionFor("public");try{await this._store.delete({method:t,params:r,partition:a})}catch(t){this._reportError(t)}if(o!==a)try{await this._store.delete({method:t,params:r,partition:o})}catch(t){this._reportError(t)}}async evictKey(t,r){let a=vE(t,r),o=this._evictionGeneration.get(a);void 0!==o&&this._evictionGeneration.set(a,o+1),await this._deleteBoth(t,r)}captureGeneration(t,r){let a=vE(t,r),o=this._evictionGeneration.get(a)??0;return this._evictionGeneration.set(a,o),o}async write(t,r,a,o){if((this._evictionGeneration.get(vE(t,o?.params))??0)!==a)return;let i=o?.params??"",n=this._partitionFor("private"),s=this._partitionFor("public"),l=(o?.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:o?.expiresAt,scope:o?.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 a=await this._probe(t,r);if(a?.expiresAt!==void 0&&a.expiresAt>this.now())try{let t=JSON.parse(a.value);if("object"!=typeof t||null===t||Array.isArray(t))throw TypeError("cached document is not an object");return{value:t}}catch(a){this._reportError(a),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),a=new Map;if(void 0!==t)for(let r of t.tools)a.set(r.name,r);this._toolIndex={stamp:r.stamp,byName:a}}return this._toolIndex.byName.get(t)}async outputValidator(t,r){let a=await this._probe("tools/list");if(void 0===a){this._toolOutputValidatorIndex=void 0;return}if(this._toolOutputValidatorIndex?.stamp!==a.stamp){let t=this._decodeListTools(a)??{tools:[]},o=new Map;for(let a of t.tools){let t=r(a);void 0!==t&&o.set(a.name,t)}this._toolOutputValidatorIndex={stamp:a.stamp,byName:o}}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 vR=Symbol.for("mcp.authSeamEscape");function vk(t){if("object"==typeof t&&null!==t||"function"==typeof t)try{Object.defineProperty(t,vR,{value:!0,configurable:!0})}catch{}return t}let vx=new Set([-32001,-32020,-32021]);function vT(t,r){let{code:a,message:o,data:i}=t;if(-32022===a){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 a=new fZ({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},o),n=fS(t),s=r.clientModernVersions.find(t=>n.includes(t));return void 0!==s?{kind:"corrective",version:s,error:a}:n.length>0?{kind:"error",error:a}:r.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:a}}return vx.has(a),{kind:"legacy"}}function vO(t,r){var a;return"browser"===r.environment&&((a=t)instanceof TypeError||a instanceof Error&&"TypeError"===a.name)?{kind:"legacy"}:{kind:"error",error:new fm(ff.EraNegotiationFailed,`Version negotiation probe failed: ${vj(t)}`,{cause:t},{cause:t})}}function vj(t){return t instanceof Error?t.message:String(t)}function vC(){let t=globalThis;return void 0!==t.window&&void 0!==t.document?"browser":"node"}function vA(t){return"stderr"in t&&"pid"in t?"stdio":"http"}var vI=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 a=new t(r);r.onmessage=t=>{let r=a._pending;if(void 0!==r&&(mu(t)||md(t))&&t.id===r.id){a._pending=void 0,mu(t)?r.resolve({kind:"response",result:t.result}):r.resolve({kind:"response",error:t.error});return}},r.onerror=t=>{a._savedOnError?.(t)},r.onclose=()=>{let t=a._pending;void 0!==t&&(a._pending=void 0,t.resolve({kind:"closed"})),a._closeDelivered=!0,a._savedOnClose?.()};try{await r.start()}catch(t){throw a.detach(),t}return a}async exchange(t,r){let a=`server-discover-probe-${++this._probeCounter}`;return new Promise(o=>{let i=!1,n=t=>{i||(i=!0,clearTimeout(s),this._pending?.id===a&&(this._pending=void 0),o(t))},s=setTimeout(()=>n({kind:"timeout"}),r);this._pending={id:a,resolve:n},this._transport.send(t(a)).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,a=!1,o=()=>{if(!a){a=!0;return}t()};r.onclose=o,vN.set(r,()=>{r.onclose===o&&(r.onclose=t)})}else this._transport.onclose=this._savedOnClose}release(){this.detach();let t=this._transport,r=t.start,a=!0;t.start=async function(){if(a){a=!1,t.start=r;return}return r.call(t)}}};let vN=new WeakMap;function vM(t){let r=vN.get(t);vN.delete(t),r?.()}async function vq(t,r){let a,o=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 vI.open(r.transport),c=async()=>{let a=n[0],c=!1,u=i;for(;;){let i=await l.exchange(t=>{var o,i,n;return o=a,i=r.clientInfo,n=r.capabilities,{jsonrpc:"2.0",id:t,method:"server/discover",params:{_meta:ma(o).outboundEnvelope({protocolVersion:o,clientInfo:i,clientCapabilities:n})}}},o);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":{let r=t.error;if(("object"==typeof r&&null!==r||"function"==typeof r)&&!0===r[vR]||r instanceof g9||r instanceof Error&&"UnauthorizedError"===r.name)return{kind:"auth-required",error:r};if(r instanceof fy){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(r instanceof fm&&r.code===ff.ClientHttpUnexpectedContent||r instanceof Error&&"SyntaxError"===r.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,o),p=function(t,r){switch(t.kind){case"result":return function(t,r){let a=ma(mr).validateResult("server/discover",t);if(!a.ok)return{kind:"legacy"};let o=a.value.supportedVersions,i=r.clientModernVersions.find(t=>o.includes(t));return void 0!==i?{kind:"modern",version:i,discover:a.value}:r.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:new fZ({supported:[...o],requested:r.requestedVersion})}}(t.result,r);case"rpc-error":return vT(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 fy(r?ff.ClientHttpForbidden:ff.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 fy(ff.EraNegotiationFailed,`Version negotiation failed: the server answered the probe with HTTP ${t.status}`,{status:t.status,statusText:t.statusText,text:t.body})};let a=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 a=r.error;if("object"!=typeof a||null===a)return;let{code:o,message:i,data:n}=a;if("number"==typeof o)return{code:o,message:"string"==typeof i?i:"",data:n}}(t.body);return void 0!==a?vT(a,r):{kind:"legacy"}}(t,r);case"network-error":return vO(t.error,r);case"unusable-reply":return{kind:"error",error:new fm(ff.EraNegotiationFailed,`Version negotiation probe failed: the server answered with an unusable reply (${vj(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 vO(Error("Connection closed during the version negotiation probe"),r);case"timeout":if("stdio"===r.transportKind)return{kind:"legacy"};return{kind:"error",error:new fm(ff.RequestTimeout,`Version negotiation probe timed out after ${t.timeoutMs}ms`,{timeout:t.timeoutMs})}}}(d,{clientModernVersions:n,requestedVersion:a,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,a=p.version;continue;case"legacy":{let a="closed"===d.kind?"the connection closed during the server/discover probe":void 0;if("pin"===t.kind)throw new fm(ff.EraNegotiationFailed,void 0===a?`Version negotiation failed: the server did not offer pinned protocol version ${t.version} via server/discover (no fallback in pin mode)`:`Version negotiation failed: ${a} before the server offered pinned protocol version ${t.version} (no fallback in pin mode)`);if(!t.fallbackAvailable)throw new fm(ff.EraNegotiationFailed,void 0===a?"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: ${a} and this client supports no pre-2026-07-28 protocol version to fall back to`);if(void 0!==a&&!0!==r.disposableProbe)throw new fm(ff.EraNegotiationFailed,`Version negotiation failed: ${a} (this transport probed in place — the disposable sibling probe requires the SDK's base StdioClientTransport)`);return{era:"legacy"}}case"error":throw p.error}}};try{a=await c()}catch(t){throw l.detach(),t}return l.release(),a}async function vz(t,r,a,o){let i,n,s=new r.constructor({...a,stderr:"ignore"}),l=r.close,c=!1,u=new Promise((t,r)=>{i=()=>r(vD())});r.close=async function(){return c=!0,i?.(),l.call(r)};try{let r=vq(t,{...o,transport:s,transportKind:"stdio",disposableProbe:!0});r.catch(()=>{}),n=await Promise.race([r,u])}finally{await vL(s),r.close=l}if(c)throw vD();return n}function vD(){return new fm(ff.EraNegotiationFailed,"Version negotiation failed: the transport was closed during the server/discover probe")}async function vL(t){try{let r=t._dispose;await ("function"==typeof r?r.call(t):t.close())}catch{}}function vU(t){let r=t._meta?.[dg];return mD.Implementation(r)?r:void 0}let vH={"notifications/tools/list_changed":["tools/list"],"notifications/prompts/list_changed":["prompts/list"],"notifications/resources/list_changed":["resources/list","resources/templates/list"]};var vV=class extends mF{_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 fm(ff.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 gq,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 vP(r?.responseCacheStore??new vw,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){if(void 0!==this._negotiatedProtocolVersion&&this._negotiatedProtocolVersion>=fv&&dq.safeParse(t).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,a,o){let{codec:i,request:n,options:s,flowStartedAt:l}=o,c={inputRequests:a.inputRequests,...void 0!==a.requestState&&{requestState:a.requestState}};return mN({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,a,o)=>mG(t,i,r,a,o),retry:(t,r)=>o.retry(t,{...s?.signal!==void 0&&{signal:s.signal},...s?.onprogress!==void 0&&{onprogress:s.onprogress},...s?.resetTimeoutOnProgress!==void 0&&{resetTimeoutOnProgress:s.resetTimeoutOnProgress},...s?.headers!==void 0&&{headers:s.headers},...void 0!==r.timeout&&{timeout:r.timeout},...void 0!==r.maxTotalTimeout&&{maxTotalTimeout:r.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 fm(ff.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 a={...t};for(let t in r){let o=r[t];if(void 0===o)continue;let i=a[t];a[t]=mJ(i)&&mJ(o)?{...i,...o}:o}return a}(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,a)=>{let o=ma(this._negotiatedProtocolVersion),i=o.validateRequest("elicitation/create",t);if(i.ok||"not-in-era"!==i.reason||(i=o.validateInputRequest("elicitation/create",t)),!i.ok)throw new fW("not-in-era"===i.reason?fJ.InternalError:fJ.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,a=void 0!==t.url;return{supportsFormMode:r||!r&&!a,supportsUrlMode:a}}(this._capabilities.elicitation);if("form"===n.mode&&!s)throw new fW(fJ.InvalidParams,"Client does not support form-mode elicitation requests");if("url"===n.mode&&!l)throw new fW(fJ.InvalidParams,"Client does not support URL-mode elicitation requests");let c=await r(t,a),u=o.validateResult("elicitation/create",c);if(u.ok||"not-in-era"!==u.reason||(u=o.validateInputResponse("elicitation/create",c)),!u.ok)throw new fW("not-in-era"===u.reason?fJ.InternalError:fJ.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,a){if(r&&null!==a&&"object"==typeof a){if("object"===r.type&&r.properties&&"object"==typeof r.properties){let o=r.properties;for(let r of Object.keys(o)){let i=o[r];void 0===a[r]&&Object.prototype.hasOwnProperty.call(i,"default")&&(a[r]=i.default),void 0!==a[r]&&t(i,a[r])}}if(Array.isArray(r.anyOf))for(let o of r.anyOf)"boolean"!=typeof o&&t(o,a);if(Array.isArray(r.oneOf))for(let o of r.oneOf)"boolean"!=typeof o&&t(o,a)}}(p,d.content)}catch{}return d}:"sampling/createMessage"===t?async(t,a)=>{let o=ma(this._negotiatedProtocolVersion),i=o.validateRequest("sampling/createMessage",t);if(i.ok||"not-in-era"!==i.reason||(i=o.validateInputRequest("sampling/createMessage",t)),!i.ok)throw new fW("not-in-era"===i.reason?fJ.InternalError:fJ.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,a),l=!!(n.tools||n.toolChoice),c=o.samplingResultVariant(l,s);if(c.ok||"not-in-era"!==c.reason||(c=o.validateInputResponse("sampling/createMessage",s)),!c.ok)throw new fW("not-in-era"===c.reason?fJ.InternalError:fJ.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 fm(ff.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&&d3.safeParse(t.discover).success))return t;throw new fm(ff.EraNegotiationFailed,"connect({ prior }): unrecognized prior — expected { kind: 'modern', discover } or { kind: 'legacy' }")}(r.prior),r);let a=function(t,r){let a=t?.mode??"legacy";if("legacy"===a)return{kind:"legacy"};let o=t?.probe??{};if("object"==typeof a){if(!(a.pin>=fv))throw TypeError(`versionNegotiation: { pin: '${a.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:a.pin,probe:o}}let i=r?fS(r):[];return{kind:"auto",modernVersions:i.length>0?i:[...fb],fallbackAvailable:!r||f_(r).length>0,probe:o}}(this._versionNegotiation,this._supportedProtocolVersionsOption);return"legacy"!==a.kind?this._connectNegotiated(t,a,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 a=f_(this._supportedProtocolVersions);try{let o=a[0];if(void 0===o)throw new fm(ff.EraNegotiationFailed,"Cannot run the initialize handshake: supportedProtocolVersions contains no pre-2026-07-28 protocol version");let i=await this.request({method:"initialize",params:{protocolVersion:o,capabilities:this._capabilities,clientInfo:this._clientInfo}},r);if(void 0===i)throw Error(`Server sent invalid initialize result: ${i}`);if(!a.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,a){let o;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=vA(t),n={clientInfo:this._clientInfo,capabilities:this._capabilities,environment:vC(),defaultTimeoutMs:a?.timeout??6e4},s="stdio"===i?function(t){let r=Object.getPrototypeOf(t);if(null===r||!Object.prototype.hasOwnProperty.call(r,"_dispose"))return;let a=t._serverParams;return"object"==typeof a&&null!==a&&"string"==typeof a.command?a:void 0}(t):void 0;o=void 0===s?await vq(r,{...n,transport:t,transportKind:i}):await vz(r,t,s,n)}catch(r){throw await t.close().catch(()=>{}),vM(t),r}if(vM(t),await super.connect(t),"legacy"===o.era)return void await this._legacyHandshake(t,a);if(this._serverCapabilities=o.discover.capabilities,this._serverVersion=vU(o.discover),this._cache.setServerIdentity(this._deriveServerIdentity(t)),this._instructions=o.discover.instructions,this._discoverResult=o.discover,this._negotiatedProtocolVersion=o.version,t.setProtocolVersion&&t.setProtocolVersion(o.version),this._listChangedConfig){let t=this._listChangedConfig,r=this._serverCapabilities,o={...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(o)}catch(t){i=!1,this.onerror?.(t instanceof Error?t:Error(String(t)))}let n=i?{...o.tools&&{toolsListChanged:!0},...o.prompts&&{promptsListChanged:!0},...o.resources&&{resourcesListChanged:!0}}:{};if(Object.keys(n).length>0){let t=new AbortController,r=()=>t.abort(a?.signal?.reason);a?.signal?.aborted&&r(),a?.signal?.addEventListener("abort",r);try{this._autoOpenedSubscription=await this.listen(n,{timeout:a?.timeout,signal:t.signal})}catch(t){if(a?.signal?.aborted)throw await this.close().catch(()=>{}),t;this.onerror?.(t instanceof Error?t:Error(String(t)))}finally{a?.signal?.removeEventListener("abort",r)}}}}async _connectFromPrior(t,r,a){if("legacy"===r.kind)return this._connectPlainLegacy(t,a);let o=r.discover;this._resetConnectionState();let i=this._supportedProtocolVersionsOption,n=(i&&fS(i).length>0?fS(i):fb).find(t=>o.supportedVersions.includes(t));if(void 0===n)throw new fm(ff.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=o,this._serverCapabilities=o.capabilities,this._serverVersion=vU(o),this._cache.setServerIdentity(this._deriveServerIdentity(t)),this._instructions=o.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>=fv?"modern":"legacy"}getInstructions(){return this._instructions}getDiscoverResult(){return this._discoverResult}assertCapabilityForMethod(t){switch(t){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new fm(ff.CapabilityNotSupported,`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new fm(ff.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 fm(ff.CapabilityNotSupported,`Server does not support resources (required for ${t})`);if("resources/subscribe"===t&&!this._serverCapabilities.resources.subscribe)throw new fm(ff.CapabilityNotSupported,`Server does not support resource subscriptions (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new fm(ff.CapabilityNotSupported,`Server does not support tools (required for ${t})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new fm(ff.CapabilityNotSupported,`Server does not support completions (required for ${t})`)}}assertNotificationCapability(t){if("notifications/roots/list_changed"===t&&!this._capabilities.roots?.listChanged)throw new fm(ff.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 fm(ff.CapabilityNotSupported,`Client does not support sampling capability (required for ${t})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new fm(ff.CapabilityNotSupported,`Client does not support elicitation capability (required for ${t})`);break;case"roots/list":if(!this._capabilities.roots)throw new fm(ff.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"},d3,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 a=await this._serveFromCache("prompts/list",void 0,r);return void 0!==a?a: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 a=await this._serveFromCache("resources/list",void 0,r);return void 0!==a?a: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 a=await this._serveFromCache("resources/templates/list",void 0,r);return void 0!==a?a:this._listAllPages("resources/templates/list",t,r,t=>t.resourceTemplates)}async _listAllPages(t,r,a,o,i){let n=a?.cacheMode==="bypass",s=this._cache.captureGeneration(t),l=await this.request({method:t,...r&&{params:{...r}}},a),c=l.nextCursor,u=l,d=1;for(;void 0!==c;){if(0!==this._listMaxPages&&d>=this._listMaxPages)throw new fm(ff.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}},a);if(i.nextCursor===c&&JSON.stringify(o(i))===JSON.stringify(o(u)))break;o(l).push(...o(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 a="number"==typeof t.ttlMs?t.ttlMs:this._defaultCacheTtlMs,o="public"===t.cacheScope?"public":"private";return{expiresAt:this._cache.now()+Math.min(Math.max(0,a),864e5),scope:o,params:r}}async _serveFromCache(t,r,a){if(a?.cacheMode==="bypass"||a?.cacheMode==="refresh")return;let o=await this._cache.read(t,r).catch(t=>void this._reportStoreError(t));if(void 0!==o){if(a?.signal?.aborted){let t=a.signal.reason;throw t instanceof fm?t:new fm(ff.RequestTimeout,String(t))}return o.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 a=r??await this._cache.toolDefinition(t);return void 0===a?void 0:my(a.inputSchema)}async readResource(t,r){let a=await this._serveFromCache("resources/read",t.uri,r);if(void 0!==a)return a;let o=this._cache.captureGeneration("resources/read",t.uri),i=await this.request({method:"resources/read",params:t},r);if(r?.cacheMode!=="bypass"){let a=this._freshness(i,t.uri);a.expiresAt>this._cache.now()?await this._cache.write("resources/read",i,o,a):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 a,o,i,n,s;if(void 0===this.transport)throw new fm(ff.NotConnected,"Not connected");let l=this._negotiatedProtocolVersion;if(void 0===l||!(l>=fv))throw new fm(ff.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 fm?t:new fm(ff.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!==a&&(clearTimeout(a),a=void 0),"ack"in t){d="open",i(t.ack);return}d="closed",void 0!==o&&r?.signal?.removeEventListener("abort",o),this._listenState.delete(u),c.abort(),s(t.cause),l&&n(t.error??new fm(ff.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(a=setTimeout(()=>{f({cause:"remote",error:new fm(ff.RequestTimeout,"subscriptions/listen ack timed out",{timeout:g})}),m().catch(()=>{})},g),r?.signal){let t=r.signal;o=()=>{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",o,{once:!0})}let v={jsonrpc:"2.0",id:u,method:"subscriptions/listen",params:{_meta:{...this._outboundMetaEnvelope()},notifications:t}},b=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(b)}catch(t){b(t)}return{honoredFilter:await p,close:y,closed:h}}get autoOpenedSubscription(){return this._autoOpenedSubscription}_onnotification(t,r){let a=Object.hasOwn(vH,t.method)?vH[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!==a)for(let t of a)this._cache.evict(t);if("notifications/subscriptions/acknowledged"===t.method){let r=t.params?._meta?.[db],a="string"==typeof r?this._listenState.get(r):void 0;if(void 0!==a){let r=this._wireCodec().validateNotification("notifications/subscriptions/acknowledged",t);a.settle({ack:r.ok?r.value.params.notifications:{}});return}}if("notifications/cancelled"===t.method){let r=t.params?.requestId,a="string"==typeof r?this._listenState.get(r):void 0;if(void 0!==a)return void a.settle({cause:"remote",error:Error("subscriptions/listen: server cancelled the subscription")})}super._onnotification(t,r)}_onresponse(t){let r=t.id,a="string"==typeof r?this._listenState.get(r):void 0;void 0!==a?md(t)?a.settle({cause:"remote",error:fW.fromError(t.error.code,t.error.message,t.error.data)}):a.settle({cause:"graceful",error:new fm(ff.ConnectionClosed,"subscriptions/listen: server closed the subscription gracefully before acknowledging")}):super._onresponse(t)}_onclose(){if(this._listenState.size>0){let t=new fm(ff.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 a,o="modern"===this.getProtocolEra()&&"browser"!==vC(),i=async()=>{let a;if(!o)return r;try{a=await this._resolveXMcpHeaderScan(t.name,r?.toolDefinition)}catch(t){this._reportStoreError(t)}if(!a?.valid||0===a.declarations.length)return r;let i=function(t,r){let a={};for(let o of t){let t=function(t,r){let a=t;for(let t of r){if(null===a||"object"!=typeof a)return;a=a[t]}return a}(r,o.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&&(a[`Mcp-Param-${o.headerName}`]=mS(i))}return a}(a.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,a=(r instanceof Error?r.message:String(r)).slice(0,200);throw new fW(fJ.InvalidParams,`Tool '${t.name}' has an invalid outputSchema: ${a}`)};s();try{a=await this.request({method:"tools/call",params:t},await i())}catch(u){let l=u instanceof fW&&-32020===u.code;if(!o||!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(),a=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===a.structuredContent&&!a.isError)throw new fW(fJ.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`);if(void 0!==a.structuredContent&&!a.isError)try{let t=l(a.structuredContent);if(!t.valid)throw new fW(fJ.InvalidParams,`Structured content does not match the tool's output schema: ${t.errorMessage}`)}catch(t){if(t instanceof fW)throw t;throw new fW(fJ.InvalidParams,`Failed to validate structured content: ${t instanceof Error?t.message:String(t)}`)}}return a}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 a=await this.request({method:"tools/list",params:t},r);return this._excludeInvalidXMcpHeaderTools(a),a}let a=await this._serveFromCache("tools/list",void 0,r);return void 0!==a?a:this._listAllPages("tools/list",t,r,t=>t.tools,t=>this._excludeInvalidXMcpHeaderTools(t))}_excludeInvalidXMcpHeaderTools(t){if("modern"!==this.getProtocolEra()||!this.transport||"stdio"===vA(this.transport))return;let r=t.tools.filter(t=>{let r=my(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,a,o){let i=ok(p4,a);if(!i.success)throw Error(`Invalid ${t} listChanged options: ${i.error.message}`);if("function"!=typeof a.onChanged)throw TypeError(`Invalid ${t} listChanged options: onChanged must be a function`);let{autoRefresh:n,debounceMs:s}=i.data,{onChanged:l}=a,c=async()=>{if(!n)return void l(null,null);try{l(null,await o())}catch(t){l(t instanceof Error?t:Error(String(t)),null)}},u=()=>{if(s){let r=this._listChangedDebounceTimers.get(t);r&&clearTimeout(r);let a=setTimeout(c,s);this._listChangedDebounceTimers.set(t,a)}else c()};this.setNotificationHandler(r,u)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};async function vK(){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(n.bind(n,8775))}async function vF(t={}){let r=t.alg??"ES256",a=await vK(),{publicKey:o,privateKey:i}=await a.generateKeyPair(r,{extractable:t.extractable??!1}),n=await a.exportJWK(o);return{privateKey:i,publicKey:o,publicJwk:n,thumbprint:await a.calculateJwkThumbprint(n,"sha256"),alg:r}}async function vJ(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 vW(new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256",new TextEncoder().encode(t))))}function vW(t){let r="";for(let a of t)r+=String.fromCodePoint(a);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 vF({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 a=t.headers.get("dpop-nonce");a&&this.rememberNonce(r,a)}async buildProof(t){let r,a,o=await vK(),i=(r=new URL(t.htu.toString()),`${r.origin}${r.pathname}`),n=t.nonce??this.nonceFor(t.htu),s={jti:(a=new Uint8Array(16),globalThis.crypto.getRandomValues(a),vW(a)),htm:t.htm.toUpperCase(),htu:i,iat:Math.floor(Date.now()/1e3)};return void 0!==t.accessToken&&(s.ath=await vJ(t.accessToken)),void 0!==n&&(s.nonce=n),new o.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 fd(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 fd(this,t)}constructor(t,r,a){super(`SSE error: ${r}`),this.code=t,this.event=a,fu(this,new.target)}};let vB={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},vG=new Set(["authorization","dpop","content-type","mcp-protocol-version","mcp-method","mcp-name","mcp-session-id"]);function vZ(t,r){if("function"==typeof AbortSignal.any)return AbortSignal.any([t,r]);let a=new AbortController;if(t.aborted)return a.abort(t.reason),a.signal;if(r.aborted)return a.abort(r.reason),a.signal;let o=()=>{t.removeEventListener("abort",i),r.removeEventListener("abort",n)};function i(){o(),a.abort(t.reason)}function n(){o(),a.abort(r.reason)}return t.addEventListener("abort",i,{once:!0}),r.addEventListener("abort",n,{once:!0}),a.signal}var vX=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 a=>g2(t,a,r)}}(r.authProvider,{skipIssuerMetadataValidation:r.skipIssuerMetadataValidation}),r.authProvider.dpop&&(this._fetch=(t=>{let r,a;return r=async()=>{try{return await t.dpop?.()}catch(t){throw vk(t)}},a=async()=>{let r;try{r=await t.tokens()}catch(t){throw vk(t)}return r?.token_type?.toLowerCase()==="dpop"?r.access_token:void 0},t=>{let o=r;return async(r,i)=>{let n=(i?.method??"GET").toUpperCase(),s=new URL(r.toString()),l=await o();if(!l)return t(r,i);let c=async()=>{let o=await a();if(!o)return t(r,i);let c=new Headers(i?.headers),u=await l.buildProof({htm:n,htu:s,accessToken:o});return c.set("Authorization",`DPoP ${o}`),c.set("DPoP",u),t(r,{...i,headers:c})},u=await c();return function(t){if(401!==t.status)return!1;let r=t.headers.get("www-authenticate")??"";return/(?:^|,)\s*dpop(?:\s|$|,)/i.test(r)&&/use_dpop_nonce/i.test(r)}(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(a,o)=>t(a,{...r,...o,headers:o?.headers?{...mY(r.headers),...mY(o.headers)}:r.headers}):t}(r?.fetch,r?.requestInit),"follow"===this._redirectPolicy&&(this._fetchWithInit=function(t){let r=(r,a)=>t(r,a);return m1.add(r),r}(this._fetchWithInit)),this._sessionId=r?.sessionId,this._protocolVersion=r?.protocolVersion,this._reconnectionOptions=r?.reconnectionOptions??vB,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 vk(t)}}async _stepUpAuthorizeInner(t,r){if("throw"===this._onInsufficientScope||!this._oauthProvider)throw new gQ({requiredScope:t.scope,resourceMetadataUrl:t.resourceMetadataUrl,errorDescription:t.errorDescription});if(r>=this._maxStepUpRetries)throw new fy(ff.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 a=await this._oauthProvider.tokens(),o=g6(this._scope,a?.scope,t.scope);this._scope=o;let i=function(t,r){if(!t)return!1;let a=new Set((r??"").split(/\s+/).filter(Boolean));for(let r of t.split(/\s+/))if(r&&!a.has(r))return!0;return!1}(o,a?.scope);return va(this._oauthProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:o,forceReauthorization:i,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})}_redirects(t){return"follow"===this._redirectPolicy?t:m2(t)}_unfollowedRedirect(t,r){let a="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 a=m0(r.url||t,r);if(a)return(a.username=a.password=a.search=a.hash="","http:"===a.protocol&&"https:"===new URL(r.url||t).protocol)?(a.protocol="https:",`Redirect from https to plain http not followed; try ${a.href} as the endpoint`):`Redirect to ${a.href} not followed; use that URL as the endpoint if it is the intended server`}(t,r);return a&&`${a} (redirectPolicy: 'same-origin')`}async _commonHeaders(){let t,r=new Headers(this._requestInit?.headers||void 0);try{t=await this._authProvider?.token()}catch(t){throw vk(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){if(Array.isArray(r)||!dq.safeParse(r).success)return;let a=r.params?._meta?.[dm];if("string"!=typeof a)return;t.set("mcp-protocol-version",a),t.set("mcp-method",r.method);let o=function(t,r){var a;let o=Object.hasOwn(mw,t)?mw[t]:void 0;if(void 0===o)return;let i=null===(a=r)||"object"!=typeof a||Array.isArray(a)?void 0:r[o];return{field:o,value:"string"==typeof i?i:void 0}}(r.method,r.params);o?.value!==void 0&&t.set("mcp-name",mS(o.value))}_isModernEnvelopedRequest(t){if(Array.isArray(t)||!dq.safeParse(t).success)return!1;let r=t.params?._meta?.[dm];return"string"==typeof r&&r>=fv}async _startOrAuthSse(t,r=!1,a=0){let{resumptionToken:o,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(", ")),o&&n.set("last-event-id",o);let l=this._abortController?.signal,c=void 0!==i&&void 0!==l?vZ(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}=vs(u);this._resourceMetadataUrl=t,this._scope=g6(this._scope,r)}if(this._authProvider.onUnauthorized&&!r){try{await this._authProvider.onUnauthorized({response:u,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(t){throw vk(t)}return await u.text?.().catch(()=>{}),this._startOrAuthSse(t,!0,a)}if(await u.text?.().catch(()=>{}),r)throw vk(new fy(ff.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:u.statusText}));throw vk(new g9)}if(403===u.status){let{resourceMetadataUrl:o,scope:i,error:n,errorDescription:s}=vs(u);if("insufficient_scope"===n){let n=await u.text?.().catch(()=>null);if(await this._stepUpAuthorize({scope:i,resourceMetadataUrl:o,errorDescription:s,statusText:u.statusText,text:n},a)!=="AUTHORIZED")throw vk(new g9);return this._startOrAuthSse(t,r,a+1)}}if(await u.text?.().catch(()=>{}),405===u.status)return void t.onRequestStreamEnd?.();let o=this._unfollowedRedirect(this._url,u)??u.statusText;throw new fy(ff.ClientHttpFailedToOpenStream,`Failed to open SSE stream: ${o}`,{status:u.status,statusText:u.statusText})}this._handleSseStream(u.body,t,!0)}catch(t){throw n()||this.onerror?.(t),t}}_getNextReconnectionDelay(t){return void 0!==this._serverRetryMs?this._serverRetryMs:Math.min(this._reconnectionOptions.initialReconnectionDelay*Math.pow(this._reconnectionOptions.reconnectionDelayGrowFactor,t),this._reconnectionOptions.maxReconnectionDelay)}_scheduleReconnection(t,r=0){let a=this._reconnectionOptions.maxRetries;if(r>=a){this.onerror?.(Error(`Maximum reconnection attempts (${a}) exceeded.`)),t.onRequestStreamEnd?.();return}let o=this._getNextReconnectionDelay(r),i=()=>{this._cancelReconnection=void 0,this._abortController?.signal.aborted||t.requestSignal?.aborted||this._startOrAuthSse(t).catch(a=>{if(!(this._abortController?.signal.aborted||t.requestSignal?.aborted)){this.onerror?.(Error(`Failed to reconnect SSE stream: ${a instanceof Error?a.message:String(a)}`));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,o,r);this._cancelReconnection="function"==typeof t?t:void 0}else{let t=setTimeout(i,o);this._cancelReconnection=()=>clearTimeout(t)}}_handleSseStream(t,r,a){let o;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 gW({onRetry:t=>{this._serverRetryMs=t}})).getReader();for(;;){let{value:t,done:a}=await r.read();if(a)break;if((t.id&&(o=t.id,u=!0,i?.(t.id)),t.data)&&(!t.event||"message"===t.event))try{let r=dU.parse(JSON.parse(t.data));(mu(r)||md(r))&&(d=!0,void 0!==n&&(r.id=n)),this.onmessage?.(r)}catch(t){this.onerror?.(t)}}(a||u)&&!d&&this._abortController&&!c()?this._scheduleReconnection({resumptionToken:o,onresumptiontoken:i,replayMessageId:n,requestSignal:s,onRequestStreamEnd:l},0):c()||l?.()}catch(t){if(c())return;if(this.onerror?.(Error(`SSE stream disconnected: ${t}`)),(a||u)&&!d&&this._abortController&&!c())try{this._scheduleReconnection({resumptionToken:o,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 g9("finishAuth requires an OAuthClientProvider");let{authorizationCode:a,iss:o}=await g3(t,r,this._oauthProvider,this._url,{fetchFn:this._fetchWithInit,resourceMetadataUrl:this._resourceMetadataUrl});if(await va(this._oauthProvider,{serverUrl:this._url,authorizationCode:a,iss:o,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})!=="AUTHORIZED")throw new g9("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,a,o=0){try{let{resumptionToken:i,onresumptiontoken:n}=r||{};if(i)return void this._startOrAuthSse({resumptionToken:i,replayMessageId:dq.safeParse(t).success?t.id:void 0,requestSignal:r?.requestSignal}).catch(t=>this.onerror?.(t));let s=await this._commonHeaders();this._applyBodyDerivedHeaders(s,t);let l=Array.isArray(t)?t.some(t=>d2.safeParse(t).success):d2.safeParse(t).success;if(l&&s.delete("mcp-session-id"),r?.headers!==void 0)for(let[t,a]of Object.entries(r.headers))vG.has(t.toLowerCase())||s.set(t,a);s.set("content-type","application/json");let c=[...s.get("accept")?.split(",").map(t=>t.trim().toLowerCase())??[],"application/json","text/event-stream"];s.set("accept",[...new Set(c)].join(", "));let u=this._abortController?.signal,d=r?.requestSignal!==void 0&&void 0!==u?vZ(u,r.requestSignal):r?.requestSignal??u,p={...this._requestInit,method:"POST",headers:s,body:JSON.stringify(t),signal:d},h=await this._redirects(this._fetch??fetch)(this._url,p);if(l&&h.ok&&(this._sessionId=h.headers.get("mcp-session-id")||void 0),!h.ok){if(401===h.status&&this._authProvider){if(h.headers.has("www-authenticate")){let{resourceMetadataUrl:t,scope:r}=vs(h);this._resourceMetadataUrl=t,this._scope=g6(this._scope,r)}if(this._authProvider.onUnauthorized&&!a){try{await this._authProvider.onUnauthorized({response:h,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(t){throw vk(t)}return await h.text?.().catch(()=>{}),this._send(t,r,!0,o)}if(await h.text?.().catch(()=>{}),a)throw vk(new fy(ff.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:h.statusText}));throw vk(new g9)}let i=await h.text?.().catch(()=>null);if(403===h.status){let{resourceMetadataUrl:n,scope:s,error:l,errorDescription:c}=vs(h);if("insufficient_scope"===l){if(await this._stepUpAuthorize({scope:s,resourceMetadataUrl:n,errorDescription:c,statusText:h.statusText,text:i},o)!=="AUTHORIZED")throw vk(new g9);return this._send(t,r,a,o+1)}}if(400===h.status&&"string"==typeof i&&this._isModernEnvelopedRequest(t))try{let r=dU.parse(JSON.parse(i)),a=(Array.isArray(t)?t:[t]).filter(t=>dq.safeParse(t).success);if(md(r)&&a.some(t=>t.id===r.id))return void this.onmessage?.(r)}catch{}let n=this._unfollowedRedirect(this._url,h)??i;throw new fy(ff.ClientHttpNotImplemented,`Error POSTing to endpoint: ${n}`,{status:h.status,statusText:h.statusText,text:i})}if(202===h.status){await h.text?.().catch(()=>{}),d5.safeParse(t).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),m=h.headers.get("content-type"),y=function(t){if(t)try{return mZ.parse(t).type}catch{let r=(t.split(";",1)[0]??"").trim().toLowerCase();if(""===r||t.slice(r.length).includes(","))return;return r}}(m);if(f)if("text/event-stream"===y)this._handleSseStream(h.body,{onresumptiontoken:n,requestSignal:r?.requestSignal,onRequestStreamEnd:r?.onRequestStreamEnd},!1);else if("application/json"===y){let t=await h.json();for(let r of Array.isArray(t)?t.map(t=>dU.parse(t)):[dU.parse(t)])this.onmessage?.(r)}else throw await h.text?.().catch(()=>{}),new fm(ff.ClientHttpUnexpectedContent,`Unexpected content type: ${m}`,{contentType:m});else await h.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},a=await this._redirects(this._fetch??fetch)(this._url,r);if(await a.text?.().catch(()=>{}),!a.ok&&405!==a.status)throw new fy(ff.ClientHttpFailedToTerminateSession,`Failed to terminate session: ${this._unfollowedRedirect(this._url,a)??a.statusText}`,{status:a.status,statusText:a.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 vY=require("node:stream");var vQ=n(6507);let v0="win32"===u4.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 v1=class{_process;_readBuffer;_serverParams;_stderrStream=null;onclose;onerror;onmessage;constructor(t){this._serverParams=t,this._readBuffer=new mX({maxBufferSize:t.maxBufferSize}),("pipe"===t.stderr||"overlapped"===t.stderr)&&(this._stderrStream=new vY.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=vQ(this._serverParams.command,this._serverParams.args??[],{env:{...function(){let t={};for(let r of v0){let a=u4.env[r];void 0!==a&&(a.startsWith("()")||(t[r]=a))}return t}(),...this._serverParams.env},stdio:["pipe","pipe",this._serverParams.stderr??"inherit"],shell:!1,windowsHide:"win32"===u4.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 fm(ff.NotConnected,"Not connected");let a=JSON.stringify(t)+"\n";this._process.stdin.write(a)?r():this._process.stdin.once("drain",r)})}};let v2=t=>"env"in t&&"string"==typeof t.env,v9=t=>{let r={};return t.forEach(t=>{let a=t.name.trim();if(v2(t)){let o=process.env[t.env];if(void 0===o)throw Error(`Environment variable "${t.env}" is not set (required for header "${a}")`);r[a]=o}else r[a]=t.value.trim()}),r},v4=n(8330),v5={name:v4.name,version:v4.version},v6={capabilities:{sampling:{},elicitation:{form:{},url:{}},roots:{listChanged:!0}},versionNegotiation:{mode:"auto"}};async function v3({url:t,headers:r}){let a=new vV(v5,v6),o=r?v9(r):{},i=new vX(new URL(t),{...r?{requestInit:{headers:o}}:{},reconnectionOptions:{maxReconnectionDelay:3e4,initialReconnectionDelay:1e3,reconnectionDelayGrowFactor:1.5,maxRetries:2}});return await a.connect(i),a}async function v8(t){let{onStderrData:r,...a}=t,o=new vV(v5,v6),i=new v1({...a,stderr:a.stderr??"pipe"}),n=i.stderr;if(n){let t=r??(t=>{console.error(`[STDIO MCP Server stderr]: ${t}`)});n.on("data",t)}return await o.connect(i),{client:o,transport:i}}async function v7(t){try{return(await t.client.listTools()).tools.map(t=>t.name)}catch(t){return console.error("Failed to list stdio MCP tools:",t),[]}}async function be(t,r,a){try{return await t.client.callTool({name:r,arguments:a})}catch(t){throw console.error(`Failed to call stdio MCP tool "${r}":`,t),t}}async function bt(t){try{await t.transport.close(),await t.client.close()}catch(t){throw console.error("Error disconnecting from stdio MCP server:",t),t}}function br(t){if(t?.body===void 0||null===t.body)return[];let r=Array.isArray(t.body)?t.body:[t.body],a=[];for(let t of r)if("object"==typeof t&&null!==t&&"method"in t&&"tools/call"===t.method){let r=t.params;r&&"object"==typeof r&&"name"in r&&"string"==typeof r.name&&a.push(r.name)}return a}let ba="2026-01-26",bo="ui/initialize",bi="ui/notifications/initialized",bn="ui/request-display-mode",bs="ui/open-link",bl="ui/update-model-context",bc="ui/message",bu="notifications/message",bd="resources/read",bp="ui/notifications/host-context-changed",bh="ui/notifications/size-changed";function bf(t){return!!t&&"object"==typeof t}function bm(t,r){return t instanceof Error&&t.message?t.message:r}function by(t={}){let r=t.targetWindow??("undefined"==typeof window?null:window),a=t.requestTimeoutMs??15e3,o=t.connectionTimeoutMs??2e3,i=100,n=!1,s=!1,l={isConnected:!!r&&r.parent!==r,hostContext:null,hostCapabilities:null},c=new Set,u=new Map,d=t=>{if(t.isConnected!==l.isConnected||t.hostContext!==l.hostContext||t.hostCapabilities!==l.hostCapabilities)for(let r of(l=t,c))r(l)},p=t=>{var r,a;let o;d({isConnected:!0,hostContext:t.hostContext?(r=l.hostContext,a=t.hostContext,o={...r??{},...a},(r?.safeAreaInsets||a.safeAreaInsets)&&(o.safeAreaInsets={...r?.safeAreaInsets??{},...a.safeAreaInsets??{}}),(r?.containerDimensions||a.containerDimensions)&&(o.containerDimensions={...r?.containerDimensions??{},...a.containerDimensions??{}}),(r?.styles||a.styles)&&(o.styles={...r?.styles??{},...a.styles??{},variables:r?.styles?.variables||a.styles?.variables?{...r?.styles?.variables??{},...a.styles?.variables??{}}:void 0,css:r?.styles?.css||a.styles?.css?{...r?.styles?.css??{},...a.styles?.css??{}}:void 0}),o):l.hostContext,hostCapabilities:t.hostCapabilities?{...l.hostCapabilities??{},...t.hostCapabilities}:l.hostCapabilities})},h=t=>{if(!r||t.source!==r.parent||!bf(t.data))return;s=!0,l.isConnected||d({...l,isConnected:!0});let a=t.data;if("id"in a&&null!=a.id&&"number"==typeof a.id){let t=u.get(a.id);t&&(clearTimeout(t.timeoutId),u.delete(a.id),bf(a.error)?t.reject(Error("string"==typeof a.error.message?a.error.message:"MCP request failed")):t.resolve(a.result))}1===a.id&&bf(a.result)&&p({hostContext:bf(a.result.hostContext)?a.result.hostContext:void 0,hostCapabilities:bf(a.result.hostCapabilities)?a.result.hostCapabilities:void 0}),a.method===bp&&bf(a.params)&&p({hostContext:a.params}),"ui/hostContextChanged"===a.method&&bf(a.params)&&bf(a.params.hostContext)&&p({hostContext:a.params.hostContext})};r&&(r.addEventListener("message",h),r.parent!==r&&setTimeout(()=>{n||s||l.hostContext||d({...l,isConnected:!1})},o));let f=()=>{if(n)throw Error("MCP host bridge has been disposed");if(!r)throw Error("MCP host bridge requires a browser window");return r},m=(t,r)=>{f().parent.postMessage({jsonrpc:"2.0",method:t,params:r},"*")},y=(t,r={})=>{let o=f();return new Promise((n,s)=>{let l=i++,c=setTimeout(()=>{u.has(l)&&(u.delete(l),s(Error(`MCP request timed out: ${t}`)))},a);u.set(l,{resolve:n,reject:s,timeoutId:c}),o.parent.postMessage({jsonrpc:"2.0",id:l,method:t,params:r},"*")})},g=async(t,r)=>{let a;for(let o of t)try{return await y(o,r)}catch(r){a=r;let t=bm(r,"MCP request failed");if(!/method not found|unknown method/i.test(t))throw r}throw a instanceof Error?a:Error("MCP request failed")},v=async t=>{if(r?.open)return void r.open(t,"_blank","noopener,noreferrer");throw Error("Unable to open link without a browser window")};return{callTool:(t,r)=>y("tools/call",{name:t,arguments:r??{}}),requestDisplayMode:t=>g([bn,"ui/requestDisplayMode"],{mode:t}),async openLink(t){try{await g([bs,"ui/openLink"],{url:t})}catch(a){if(!l.isConnected||!r)return void await v(t);throw Error(bm(a,"Failed to open link"))}},readResource:t=>y(bd,{uri:t}),sendMessage:t=>y(bc,t),updateModelContext:t=>y(bl,t),async logMessage(t){m(bu,t)},async notifySizeChanged(t){m(bh,t)},getState:()=>l,getHostContext:()=>l.hostContext,getHostCapabilities:()=>l.hostCapabilities,isConnected:()=>l.isConnected,subscribe:t=>(c.add(t),()=>{c.delete(t)}),dispose(){if(!n){for(let[t,a]of(n=!0,r&&r.removeEventListener("message",h),u.entries()))clearTimeout(a.timeoutId),a.reject(Error("MCP host bridge has been disposed")),u.delete(t);c.clear()}}}}A().config()})(),s})());
|