xmcp
Version:
The TypeScript MCP framework
78 lines • 749 kB
JavaScript
!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'}},S={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 _(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,_(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=s(t,{complete:!0})}catch(t){return b(t)}if(!S)return b(new o("invalid token"));let E=S.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"));_=r}else _=function(t,a){return a(null,r)};return _(E,function(r,s){let u;if(r)return b(new o("error in secret or public key callback: "+r.message));let _=""!==$[2].trim();if(!_&&s)return b(new o("jwt signature is required"));if(_&&!s)return b(new o("secret or public key must be provided"));if(!_&&!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(S.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,S.header.alg,s)}catch(t){return b(t)}if(!u)return b(new o("invalid signature"));let P=S.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:S.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 S(t){return function(r,a,o){var n=v(t)(r,o);return b(i.from(a),i.from(n))}}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(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=_(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 T(){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:_,ps:$,es:P,none:k})[a](o),verify:({hs:S,rs:w,ps:E,es:R,none:T})[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 S(t){var r,a,o;return null!=t&&"number"==typeof(r=t.length)&&r>-1&&r%1==0&&r<=0x1fffffffffffff&&"[object Function]"!=(o=_(a=t)?m.call(a):"")&&"[object GeneratorFunction]"!=o}function _(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=S(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}(S(t)?function(t,r){var a,o,i,n,s=b(t)||w(o=a=t)&&S(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(_(t)){var r,a="function"==typeof t.valueOf?t.valueOf():t;t=_(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,T=t.length;return a<0&&(a=v(T+a,0)),"string"==typeof(k=t)||!b(k)&&w(k)&&"[object String]"==m.call(k)?a<=T&&t.indexOf(r,a)>-1:!!T&&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,C(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=>_(t,this.options)).join(" ").split(/\s+/).map(t=>x(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=>S(a,r)&&t.set.some(t=>S(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(j(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,S=(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},_=(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=O(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=>T(t,r)).join(" ")),T=(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})},O=(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],"")),C=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()),j=(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),S=a(8767),_=a(7697),w=a(9839),$=a(1686),E=a(7257),P=a(8271),R=a(733),k=a(6479),T=a(5850),O=a(5461),x=a(7771),C=a(8610),j=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:S,sort:_,rsort:w,gt:$,lt:E,eq:P,neq:R,gte:k,lte:T,cmp:O,coerce:x,Comparator:C,Range:j,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,S=!!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(S&&t.semver.prerelease&&t.semver.prerelease.length&&t.semver.major===S.major&&t.semver.minor===S.minor&&t.semver.patch===S.patch&&(S=!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)&&!S&&!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:()=>tC,calculateJwkThumbprintUri:()=>tI,SignJWT:()=>tx,exportJWK:()=>e2,importX509:()=>eZ,importJWK:()=>eY,GeneralSign:()=>tO,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:()=>O,JOSEError:()=>R,JOSENotSupported:()=>x,JWEDecryptionFailed:()=>C,JWEInvalid:()=>j,JWKInvalid:()=>N,JWKSInvalid:()=>M,JWKSMultipleMatchingKeys:()=>z,JWKSNoMatchingKey:()=>q,JWKSTimeout:()=>D,JWSInvalid:()=>A,JWSSignatureVerificationFailed:()=>L,JWTClaimValidationFailed:()=>k,JWTExpired:()=>T,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 S(t,r){if(parseInt(t.hash.name.slice(4),10)!==r)throw b(`SHA-${r}`,"algorithm.hash")}function _(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");S(t.algorithm,parseInt(r.slice(9),10)||1);break;default:throw TypeError("CryptoKey does not support this operation")}_(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 T 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 O extends R{static code="ERR_JOSE_ALG_NOT_ALLOWED";code="ERR_JOSE_ALG_NOT_ALLOWED"}class x extends R{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"}class C extends R{static code="ERR_JWE_DECRYPTION_FAILED";code="ERR_JWE_DECRYPTION_FAILED";constructor(t="decryption operation failed",r){super(t,r)}}class j 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 x(`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 j(`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 x(`Unsupported JWE Algorithm: ${t}`)}}function G(t,r){if(r.length<<3!==B(t))throw new j("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 C;try{l=new Uint8Array(await crypto.subtle.decrypt({iv:o,name:"AES-CBC"},c,a))}catch{}if(!l)throw new C;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 C}}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 x(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 j("JWE Initialization Vector missing");if(!i)throw new j("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 x(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 eS(t){switch(t.algorithm.namedCurve){case"P-256":case"P-384":case"P-521":return!0;default:return"X25519"===t.algorithm.name}}async function e_(t,r,a,o){if(!(t instanceof Uint8Array)||t.length<8)throw new j("PBES2 Salt Input must be 8 or more octets");if(!Number.isSafeInteger(a)||1!==Math.sign(a))throw new j("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 e_(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 e_(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 x(`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");S(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");S(r.algorithm,parseInt(t.slice(2),10));break;case"PS256":case"PS384":case"PS512":if("RSA-PSS"!==r.algorithm.name)throw b("RSA-PSS");S(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 _(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 eT(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 eO=t=>{switch(t){case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return"RSA-OAEP";default:throw new x(`alg ${t} is not supported either by JOSE or your javascript runtime`)}};async function ex(t,r,a){return w(r,t,"encrypt"),eE(t,r),new Uint8Array(await crypto.subtle.encrypt(eO(t),r,a))}async function eC(t,r,a){return w(r,t,"decrypt"),eE(t,r),new Uint8Array(await crypto.subtle.decrypt(eO(t),r,a))}let ej='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 x(ej)}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 x(ej)}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 x(ej)}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 x(ej)}break;default:throw new x('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}-----
${a}
-----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 x("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 x('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 x('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 x('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 j("JWE Encrypted Key missing")}async function e3(t,r,a,o,i){switch(t){case"dir":if(void 0!==a)throw new j("Encountered unexpected JWE Encrypted Key");return r;case"ECDH-ES":if(void 0!==a)throw new j("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 j('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');if(U(r),!eS(r))throw new x("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 j('JOSE Header "apu" (Agreement PartyUInfo) invalid');i=el(o.apu,"apu",j)}if(void 0!==o.apv){if("string"!=typeof o.apv)throw new j('JOSE Header "apv" (Agreement PartyVInfo) invalid');n=el(o.apv,"apv",j)}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),eC(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 j('JOSE Header "p2c" (PBES2 Count) missing or invalid');let s=i?.maxPBES2Count||1e4;if(o.p2c>s)throw new j('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if("string"!=typeof o.p2s)throw new j('JOSE Header "p2s" (PBES2 Salt) missing or invalid');return n=el(o.p2s,"p2s",j),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 j('JOSE Header "iv" (Initialization Vector) missing or invalid');if("string"!=typeof o.tag)throw new j('JOSE Header "tag" (Authentication Tag) missing or invalid');return e4(t,r,a,el(o.iv,"iv",j),el(o.tag,"tag",j));default:throw new x(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),!eS(a))throw new x("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 ex(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 x(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 x(`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 x(`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 j("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 j("Flattened JWE must be an object");if(void 0===t.protected&&void 0===t.header&&void 0===t.unprotected)throw new j("JOSE Header missing");if(void 0!==t.iv&&"string"!=typeof t.iv)throw new j("JWE Initialization Vector incorrect type");if("string"!=typeof t.ciphertext)throw new j("JWE Ciphertext missing or incorrect type");if(void 0!==t.tag&&"string"!=typeof t.tag)throw new j("JWE Authentication Tag incorrect type");if(void 0!==t.protected&&"string"!=typeof t.protected)throw new j("JWE Protected Header incorrect type");if(void 0!==t.encrypted_key&&"string"!=typeof t.encrypted_key)throw new j("JWE Encrypted Key incorrect type");if(void 0!==t.aad&&"string"!=typeof t.aad)throw new j("JWE AAD incorrect type");if(void 0!==t.header&&!eu(t.header))throw new j("JWE Shared Unprotected Header incorrect type");if(void 0!==t.unprotected&&!eu(t.unprotected))throw new j("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 j("JWE Protected Header is invalid")}if(!ed(o,t.header,t.unprotected))throw new j("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(j,new Map,a?.crit,o,p),void 0!==p.zip&&"DEF"!==p.zip)throw new x('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(void 0!==p.zip&&!o?.zip)throw new j('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 j("missing JWE Algorithm (alg) in JWE Header");if("string"!=typeof m||!m)throw new j("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 O('"alg" (Algorithm) Header Parameter value not allowed');if(v&&!v.has(m))throw new O('"enc" (Encryption Algorithm) Header Parameter value not allowed');void 0!==t.encrypted_key&&(i=el(t.encrypted_key,"encrypted_key",j));let b=!1;"function"==typeof r&&(r=await r(o,t),b=!0),ta("dir"===h?m:h,r,"decrypt");let S=await eM(r,h);try{n=await e3(h,S,i,p,a)}catch(t){if(t instanceof TypeError||t instanceof j||t instanceof x)throw t;n=J(m)}void 0!==t.iv&&(s=el(t.iv,"iv",j)),void 0!==t.tag&&(l=el(t.tag,"tag",j));let _=void 0!==t.protected?f(t.protected):new Uint8Array;d=void 0!==t.aad?u(_,f("."),f(t.aad)):_;let w=el(t.ciphertext,"ciphertext",j),$=await ei(m,n,w,s,l,d),E={plaintext:$};if("DEF"===p.zip){let t=a?.maxDecompressedLength??25e4;if(0===t)throw new x('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 j)throw t;throw new j("Failed to decompress plaintext",{cause:t})})}return(void 0!==t.protected&&(E.protectedHeader=o),void 0!==t.aad&&(E.additionalAuthenticatedData=el(t.aad,"aad",j)),void 0!==t.unprotected&&(E.sharedUnprotectedHeader=t.unprotected),void 0!==t.header&&(E.unprotectedHeader=t.header),b)?{...E,key:S}:E}async function tl(t,r,a){if(t instanceof Uint8Array&&(t=c.decode(t)),"string"!=typeof t)throw new j("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 j("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 j("General JWE must be an object");if(!Array.isArray(t.recipients)||!t.recipients.every(eu))throw new j("JWE Recipients missing or incorrect type");if(!t.recipients.length)throw new j("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 C}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 j("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(!ed(this.#t,this.#a,this.#r))throw new j("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(j,new Map,r?.crit,this.#t,c),void 0!==c.zip&&"DEF"!==c.zip)throw new x('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(void 0!==c.zip&&!this.#t?.zip)throw new j('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 j('JWE "alg" (Algorithm) Header Parameter missing or invalid');if("string"!=typeof p||!p)throw new j('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 j("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 j("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 j("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 j('JWE "alg" (Algorithm) Header Parameter missing or invalid');if("dir"===i||"ECDH-ES"===i)throw new j('"dir" and "ECDH-ES" alg may only be used with a single recipient');if("string"!=typeof o.enc||!o.enc)throw new j('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');if(t){if(t!==o.enc)throw new j('JWE "enc" (Encryption Algorithm) Header Parameter must be the same for all recipients')}else t=o.enc;if(e7(j,new Map,a.options.crit,this.#t,o),void 0!==o.zip&&"DEF"!==o.zip)throw new x('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(void 0!==o.zip&&!this.#t?.zip)throw new j('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 O('"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 eT(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 tS=t=>t.includes("/")?t.toLowerCase():`application/${t.toLowerCase()}`;function t_(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||tS(t.typ)!==tS(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 T('"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 T('"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:t_(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=t_(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 tT{#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 tO{#u;#p=[];constructor(t){this.#u=t}addSignature(t,r){let a=new tT(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 tx{#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 tC{#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 tj=(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":tj(a.alg,'"alg" (Algorithm) Parameter'),tj(a.pub,'"pub" (Public key) Parameter'),o={alg:a.alg,kty:a.kty,pub:a.pub};break;case"EC":tj(a.crv,'"crv" (Curve) Parameter'),tj(a.x,'"x" (X Coordinate) Parameter'),tj(a.y,'"y" (Y Coordinate) Parameter'),o={crv:a.crv,kty:a.kty,x:a.x,y:a.y};break;case"OKP":tj(a.crv,'"crv" (Subtype of Key Pair) Parameter'),tj(a.x,'"x" (Public Key) Parameter'),o={crv:a.crv,kty:a.kty,x:a.x};break;case"RSA":tj(a.e,'"e" (Exponent) Parameter'),tj(a.n,'"n" (Modulus) Parameter'),o={e:a.e,kty:a.kty,n:a.n};break;case"oct":tj(a.k,'"k" (Key Value) Parameter'),o={k:a.k,kty:a.kty};break;default:throw new x('"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 x('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;#T;constructor(t,r){if(!(t instanceof URL))throw TypeError("url must be an instance of URL");this.#b=new URL(t.href),this.#S="number"==typeof r?.timeoutDuration?r?.timeoutDuration:5e3,this.#_="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.#T=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.#T.uat,this.#k=tD(this.#T.jwks)))}pendingFetch(){return!!this.#E}coolingDown(){return"number"==typeof this.#$&&Date.now()<this.#$+this.#_}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.#S),this.#R).then(t=>{this.#k=tD(t),this.#T&&(this.#T.uat=Date.now(),this.#T.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:t_(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 x("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 x("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, and X25519")}break}default:throw new x('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 x('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 TypeScript MCP framework","version":"1.9.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.2.0","@modelcontextprotocol/node":"^2.0.0","@modelcontextprotocol/server":"^2.3.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.6","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.3.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:()=>yg,isEnvHeader:()=>m3,createSTDIOClient:()=>ya,INITIALIZE_METHOD:()=>yc,LOG_MESSAGE_METHOD:()=>ym,OPEN_LINK_METHOD:()=>yp,REQUEST_DISPLAY_MODE_METHOD:()=>yd,inputResponse:()=>ch,disconnectSTDIOClient:()=>yn,embeddedResource:()=>B,isInputRequiredResult:()=>l7,callSTDIOClientTool:()=>yi,headersToRecord:()=>m8,MCP_APPS_PROTOCOL_VERSION:()=>yl,extractToolNamesFromRequest:()=>ys,UI_MESSAGE_METHOD:()=>yf,completable:()=>u3,acceptedContent:()=>cp,listSTDIOClientTools:()=>yo,UPDATE_MODEL_CONTEXT_METHOD:()=>yh,UrlElicitationRequiredError:()=>l9,createRequestStateCodec:()=>de,audio:()=>W,createMcpHostBridge:()=>y_,SIZE_CHANGED_METHOD:()=>yv,image:()=>J,INITIALIZED_METHOD:()=>yu,inputRequired:()=>cd,RESOURCES_READ_METHOD:()=>yy,createContext:()=>K,getRequestContext:()=>X,jwtAuthMiddleware:()=>L,createHTTPClient:()=>yr,apiKeyAuthMiddleware:()=>q});var w,$,E,P,R,k,T,O,x,C,j=n(8583),A=n.n(j),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=>eT(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 eS(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}let e_=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===eS(t))return!1;let r=t.constructor;if(void 0===r||"function"!=typeof r)return!0;let a=r.prototype;return!1!==eS(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 eT(t){return"bigint"==typeof t?t.toString()+"n":"string"==typeof t?`"${t}"`:`${t}`}let eO={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 eC(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 ej(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(eC(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"}}(O=globalThis).__zod_globalConfig??(O.__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 tS=/^[\s\S]{0,}$/,t_=/^-?\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=[])}),tT=t=>{let r=t.value;return null!=r&&void 0!==r.length},tO={number:"number",bigint:"bigint",object:"date"},tx=eX("$ZodCheckLessThan",(t,r)=>{tk.init(t,r);let a=tO[typeof r.value];t._zod.check=o=>{(r.inclusive?o.value<=r.value:o.value<r.value)||o.issues.push({origin:tO[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})}}),tC=eX("$ZodCheckGreaterThan",(t,r)=>{tk.init(t,r);let a=tO[typeof r.value];t._zod.check=o=>{(r.inclusive?o.value>=r.value:o.value>r.value)||o.issues.push({origin:tO[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})}}),tj=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]=eO[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=tT),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=tT),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=tT),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(", ")}) {
${r.join("\n")}
};`)(...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??tS,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})}}),rS=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}}),r_=eX("$ZodNumberFormat",(t,r)=>{tA.init(t,r),rS.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 rT=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 rO(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 rx=[];function rC(t){var r;let a=Object.keys(t.shape),o=Object.getOwnPropertySymbols(t.shape),i=o.length?o:rx,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 rj(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=>rO(t,a,i,r,p,h))):rO(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(()=>rC(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(!eS(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=>rO(a,r,t,i,n,s))):rO(l,r,t,i,n,s)}return s?rj(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(()=>rC(r)),s=e0.memoizer,l=!e0.jitless,c=l&&e_.value,u=r.catchall;t._zod.parse=(d,p)=>{o??(o=n.value);let h=d.value;return eS(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)=>`
let ${t}_ab = false;
for (let i = 0; i < ${t}.issues.length; i++) {
const iss = ${t}.issues[i];
iss.path = iss.path ? [${r}, ...iss.path] : [${r}];
payload.issues.push(iss);
if (iss.continue !== true) ${t}_ab = true;
}
if (${t}_ab && ctx && ctx.abortEarly) {
payload.value = newResult;
return payload;
}`;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(`
const ${a}_present = ${s};
if (!${a}.issues.length || ${a}_present) {
if (${a}.issues.length) {${c(a,n)}
}
if (${t}) {
newResult[${n}] = ${a}.value;
}
}
`)}else h?(i.write(`
if (${a}.issues.length) {${c(a,n)}
}
`),"defaulted"===p?i.write(`newResult[${n}] = ${a}.value;`):i.write(`
if (${a}.value !== undefined || ${s}) {
newResult[${n}] = ${a}.value;
}
`)):i.write(`
const ${a}_present = ${s};
if (${a}.issues.length) {${c(a,n)}
}
if (!${a}_present && !${a}.issues.length) {
payload.issues.push({
code: "invalid_type",
expected: "nonoptional",
input: undefined,
path: [${n}]
});
if (ctx && ctx.abortEarly) {
payload.value = newResult;
return payload;
}
}
if (${a}_present) {
newResult[${n}] = ${a}.value;
}
`)}return i.write("payload.value = newResult;"),i.write("return payload;"),i.compile()})(r.shape)),d=a(d,p),u)?rj([],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(!eS(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))}}(x=globalThis).__zod_globalRegistry??(x.__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 tx({check:"less_than",...ek(r),value:t,inclusive:!1})}function an(t,r){return new tx({check:"less_than",...ek(r),value:t,inclusive:!0})}function as(t,r){return new tC({check:"greater_than",...ek(r),value:t,inclusive:!1})}function al(t,r){return new tC({check:"greater_than",...ek(r),value:t,inclusive:!0})}function ac(t,r){return new tj({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>
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 aS=new Set(["type","properties","required","additionalProperties"]),a_=["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(!aS.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 aS)if(r in t)return;let a=r.filter(t=>a_.some(r=>Array.isArray(t[r]))),o=null;if(a.length){let t=a[0],i=a_.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)},aT=(t,r)=>{aR(t,"minimum",r),ak(t,"maximum",r)},aO=(t,r)=>{t.multipleOf??(t.multipleOf=[]),t.multipleOf.includes(r)||t.multipleOf.push(r)},ax=(t,r)=>{t.patterns??(t.patterns=new Set),t.patterns.add(r)},aC=(t,r)=>{t.mime=t.mime?t.mime.filter(t=>r.includes(t)):[...r]},aj=(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)=>{aj(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)=>aO(t,r.value),number_format:aN(eO),bigint_format:aN(ex),min_length:aA,max_length:aI,length_equals:(t,r)=>aT(t,r.length),min_size:aA,max_size:aI,size_equals:(t,r)=>aT(t,r.size),string_format:(t,r)=>{aj(t,r.format),r.pattern&&ax(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)=>aC(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&&aO(r,o.multipleOf),void 0!==o.format&&(r.format??(r.format=o.format),o.format.includes("int")&&(r.isInt=!0)),o.mime&&aC(r,o.mime),o.patterns??[]))ax(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:t_).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"),oS=Symbol.for("zod.compile.fallback"),o_=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),oT=ov(oE),oO=(h=of(oE),f=(t,r,a,o)=>h(t,r,a?{...a,direction:"backward"}:{direction:"backward"},oh(f,o))),ox=(m=of(oE),y=(t,r,a,o)=>m(t,r,a,oh(y,o))),oC=(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))}),oj=(b=om(oE),S=async(t,r,a,o)=>await b(t,r,a,oh(S,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 ${eT(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 iZ({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 iM(this)},exactOptional(){var t;return t=this,new iq({type:"optional",innerType:t})},nullable(){return iD(this)},nullish(){return iM(iD(this))},nonoptional(t){var r;return r=this,new iH({type:"nonoptional",innerType:r,...ek(t)})},array(){return ig(this)},or(t){return iw([this,t])},and(t){return iR(this,t)},transform(t){return iF(this,iI(t))},default(t){var r,a;return r=this,a=t,new iL({type:"default",innerType:r,get defaultValue(){return"function"==typeof a?a():e$(a)}})},prefault(t){var r,a;return r=this,a=t,new iU({type:"prefault",innerType:r,get defaultValue(){return"function"==typeof a?a():e$(a)}})},catch(t){return function(t,r){let a;return new iV({type:"catch",innerType:t,catchValue:"function"==typeof r?r:((a=()=>r)["~constantCatch"]=!0,a)})}(this,t)},pipe(t){return iF(this,t)},readonly(){var t;return t=this,new iW({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 oT(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[oS]=!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 o_(this,t,r)},encode:function t(r,a){return oO(this,r,a,{callee:t})},decode:function t(r,a){return ox(this,r,a,{callee:t})},encodeAsync:async function t(r,a){return await oC(this,r,a,{callee:t})},decodeAsync:async function t(r,a){return await oj(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)=>{rS.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)=>{r_.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)}),ip=eX("ZodUnknown",(t,r)=>{rP.init(t,r),oz.init(t,r),t._zod.processJSONSchema=(r,a,o)=>aW(t,r,a,o)});function ih(){return new ip({type:"unknown"})}let im=eX("ZodNever",(t,r)=>{rR.init(t,r),oz.init(t,r),t._zod.processJSONSchema=(r,a,o)=>aF(t,r,a,o)}),iy=eX("ZodArray",(t,r)=>{oq(),rT.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 ig(t,r){return new iy({type:"array",element:t,...ek(r)})}let iv=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 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(!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:ej(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:ej(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,eC(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(eC(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(iN,this,t[0])},exactPartial(...t){return eA(iq,this,t[0],"exactPartial")},required(...t){var r;let a,o;return a=(r=t[0])?new Set(eC(this,r)):void 0,eg(o={},this,Reflect.ownKeys(ef(this)),(t,r)=>a&&!a.has(r)?t:new iH({type:"nonoptional",innerType:t})),eR(this,ev(this._zod.def,{shape:o}))}});function ib(t,r){return new iv({type:"object",shape:t??{},...ek(r)})}function iS(t,r){return new iv({type:"object",shape:t,catchall:ih(),...ek(r)})}let i_=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 iw(t,r){return new i_({type:"union",options:t,...ek(r)})}let i$=eX("ZodDiscriminatedUnion",(t,r)=>{i_.init(t,r),rq.init(t,r)});function iE(t,r,a){return new i$({type:"union",options:r,discriminator:t,...ek(a)})}let iP=eX("ZodIntersection",(t,r)=>{rz.init(t,r),oz.init(t,r),t._zod.processJSONSchema=(r,a,o)=>a2(t,r,a,o)});function iR(t,r){return new iP({type:"intersection",left:t,right:r})}let ik=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 ik(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 ix(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 ij(t,r){return new iC({type:"literal",values:Array.isArray(t)?t:[t],...ek(r)})}let iA=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 iI(t){return new iA({type:"transform",transform:t})}let iN=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 iM(t){return new iN({type:"optional",innerType:t})}let iq=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}),iz=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 iD(t){return new iz({type:"nullable",innerType:t})}let iL=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}),iU=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}),iH=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}),iV=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}),iK=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 iF(t,r){return new iK({type:"pipe",in:t,out:r})}let iJ=eX("ZodPreprocess",(t,r)=>{iK.init(t,r),r9.init(t,r)}),iW=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}),iB=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 iG(t){return new iB({type:"lazy",getter:t})}let iZ=eX("ZodCustom",(t,r)=>{r3.init(t,r),oz.init(t,r),t._zod.processJSONSchema=(r,a,o)=>aZ(t,r,a,o)});function iX(t,r){return new iJ({type:"pipe",in:iI(t),out:r})}C||(C={});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",i6=iG(()=>iw([oU(),ia(),il(),iu(),iT(oU(),i6),ig(i6)])),i3=iT(oU(),i6),i8=ig(i6),i7=iw([oU(),ia().int()]),ne=oU(),nt=ib({ttl:ia().optional()}),nr=ib({taskId:oU()}),na=iS({progressToken:i7.optional(),"io.modelcontextprotocol/related-task":nr.optional()}),no=ib({_meta:na.optional()}),ni=no.extend({task:nt.optional()}),nn=ib({method:oU(),params:no.loose().optional()}),ns=ib({_meta:na.optional()}),nl=ib({method:oU(),params:ns.loose().optional()}),nc=iS({get[i2](){return nE.optional().catch(void 0)}}),nu=iS({_meta:nc.optional()}),nd=iw([oU(),ia().int()]),np=ib({jsonrpc:ij("2.0"),id:nd,...nn.shape}).strict(),nh=ib({jsonrpc:ij("2.0"),...nl.shape}).strict(),nf=ib({jsonrpc:ij("2.0"),id:nd,result:nu}).strict(),nm=ib({jsonrpc:ij("2.0"),id:nd.optional(),error:ib({code:ia().int(),message:oU(),data:ih().optional()})}).strict(),ny=iw([np,nh,nf,nm]),ng=iw([nf,nm]),nv=nu.strict(),nb=ns.extend({requestId:nd.optional(),reason:oU().optional()}),nS=nl.extend({method:ij("notifications/cancelled"),params:nb}),n_=ib({src:oU(),mimeType:oU().optional(),sizes:ig(oU()).optional(),theme:ix(["light","dark"]).optional()}),nw=ib({icons:ig(n_).optional()}),n$=ib({name:oU(),title:oU().optional()}),nE=n$.extend({...n$.shape,...nw.shape,version:oU(),websiteUrl:oU().optional(),description:oU().optional()}),nP=iR(ib({applyDefaults:il().optional()}),i3),nR=iX(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,iR(ib({form:nP.optional(),url:i3.optional()}),i3.optional())),nk=iS({list:i3.optional(),cancel:i3.optional(),requests:iS({sampling:iS({createMessage:i3.optional()}).optional(),elicitation:iS({create:i3.optional()}).optional()}).optional()}),nT=iS({list:i3.optional(),cancel:i3.optional(),requests:iS({tools:iS({call:i3.optional()}).optional()}).optional()}),nO=ib({experimental:iT(oU(),i3).optional(),sampling:ib({context:i3.optional(),tools:i3.optional()}).optional(),elicitation:nR.optional(),roots:ib({listChanged:il().optional()}).optional(),tasks:nk.optional(),extensions:iT(oU(),i3).optional()}),nx=no.extend({protocolVersion:oU(),capabilities:nO,clientInfo:nE}),nC=nn.extend({method:ij("initialize"),params:nx}),nj=ib({experimental:iT(oU(),i3).optional(),logging:i3.optional(),completions:i3.optional(),prompts:ib({listChanged:il().optional()}).optional(),resources:ib({subscribe:il().optional(),listChanged:il().optional()}).optional(),tools:ib({listChanged:il().optional()}).optional(),tasks:nT.optional(),extensions:iT(oU(),i3).optional()}),nA=nu.extend({protocolVersion:oU(),capabilities:nj,serverInfo:nE,instructions:oU().optional()}),nI=nl.extend({method:ij("notifications/initialized"),params:ns.optional()}),nN=nn.extend({method:ij("server/discover"),params:no.optional()}),nM=nu.extend({supportedVersions:ig(oU()),capabilities:nj,instructions:oU().optional()}),nq=nn.extend({method:ij("ping"),params:no.optional()}),nz=ib({progress:ia(),total:iM(ia()),message:iM(oU())}),nD=ib({...ns.shape,...nz.shape,progressToken:i7}),nL=nl.extend({method:ij("notifications/progress"),params:nD}),nU=no.extend({cursor:ne.optional()}),nH=nn.extend({params:nU.optional()}),nV=nu.extend({nextCursor:ne.optional()}),nK=ib({uri:oU(),mimeType:iM(oU()),_meta:iT(oU(),ih()).optional()}),nF=nK.extend({text:oU()}),nJ=oU().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),nW=nK.extend({blob:nJ}),nB=ix(["user","assistant"]),nG=ib({audience:ig(nB).optional(),priority:ia().min(0).max(1).optional(),lastModified:aa(oV,{offset:!0}).optional()}),nZ=ib({...n$.shape,...nw.shape,uri:oU(),description:iM(oU()),mimeType:iM(oU()),size:iM(ia()),annotations:nG.optional(),_meta:iM(iS({}))}),nX=ib({...n$.shape,...nw.shape,uriTemplate:oU(),description:iM(oU()),mimeType:iM(oU()),annotations:nG.optional(),_meta:iM(iS({}))}),nY=nH.extend({method:ij("resources/list")}),nQ=nV.extend({resources:ig(nZ)}),n0=nH.extend({method:ij("resources/templates/list")}),n1=nV.extend({resourceTemplates:ig(nX)}),n2=no.extend({uri:oU()}),n9=nn.extend({method:ij("resources/read"),params:n2}),n4=nu.extend({contents:ig(iw([nF,nW]))}),n5=nl.extend({method:ij("notifications/resources/list_changed"),params:ns.optional()}),n6=nn.extend({method:ij("resources/subscribe"),params:n2}),n3=nn.extend({method:ij("resources/unsubscribe"),params:n2}),n8=ib({toolsListChanged:il().optional(),promptsListChanged:il().optional(),resourcesListChanged:il().optional(),resourceSubscriptions:ig(oU()).optional()}),n7=no.extend({notifications:n8}),se=nn.extend({method:ij("subscriptions/listen"),params:n7}),st=ns.extend({notifications:n8}),sr=nl.extend({method:ij("notifications/subscriptions/acknowledged"),params:st}),sa=nc.extend({[i4]:nd}),so=nu.extend({_meta:sa}),si=ns.extend({uri:oU()}),sn=nl.extend({method:ij("notifications/resources/updated"),params:si}),ss=ib({name:oU(),description:iM(oU()),required:iM(il())}),sl=ib({...n$.shape,...nw.shape,description:iM(oU()),arguments:iM(ig(ss)),_meta:iM(iS({}))}),sc=nH.extend({method:ij("prompts/list")}),su=nV.extend({prompts:ig(sl)}),sd=no.extend({name:oU(),arguments:iT(oU(),oU()).optional()}),sp=nn.extend({method:ij("prompts/get"),params:sd}),sh=ib({type:ij("text"),text:oU(),annotations:nG.optional(),_meta:iT(oU(),ih()).optional()}),sf=ib({type:ij("image"),data:nJ,mimeType:oU(),annotations:nG.optional(),_meta:iT(oU(),ih()).optional()}),sm=ib({type:ij("audio"),data:nJ,mimeType:oU(),annotations:nG.optional(),_meta:iT(oU(),ih()).optional()}),sy=ib({type:ij("tool_use"),name:oU(),id:oU(),input:iT(oU(),ih()),_meta:iT(oU(),ih()).optional()}),sg=ib({type:ij("resource"),resource:iw([nF,nW]),annotations:nG.optional(),_meta:iT(oU(),ih()).optional()}),sv=nZ.extend({type:ij("resource_link")}),sb=iw([sh,sf,sm,sv,sg]),sS=ib({role:nB,content:sb}),s_=nu.extend({description:oU().optional(),messages:ig(sS)}),sw=nl.extend({method:ij("notifications/prompts/list_changed"),params:ns.optional()}),s$=ib({title:oU().optional(),readOnlyHint:il().optional(),destructiveHint:il().optional(),idempotentHint:il().optional(),openWorldHint:il().optional()}),sE=ib({taskSupport:ix(["required","optional","forbidden"]).optional()}),sP=ib({...n$.shape,...nw.shape,description:oU().optional(),inputSchema:ib({type:ij("object"),properties:iT(oU(),i6).optional(),required:ig(oU()).optional()}).catchall(ih()),outputSchema:iS({$schema:oU().optional()}).optional(),annotations:s$.optional(),execution:sE.optional(),_meta:iT(oU(),ih()).optional()}),sR=nH.extend({method:ij("tools/list")}),sk=nV.extend({tools:ig(sP)}),sT=nu.extend({content:ig(sb).default([]),structuredContent:ih().optional(),isError:il().optional()}),sO=sT.or(nu.extend({toolResult:ih()})),sx=ni.extend({name:oU(),arguments:iT(oU(),ih()).optional()}),sC=nn.extend({method:ij("tools/call"),params:sx}),sj=nl.extend({method:ij("notifications/tools/list_changed"),params:ns.optional()}),sA=ib({autoRefresh:il().default(!0),debounceMs:ia().int().nonnegative().default(300)}),sI=ix(["debug","info","notice","warning","error","critical","alert","emergency"]),sN=no.extend({level:sI}),sM=nn.extend({method:ij("logging/setLevel"),params:sN}),sq=ns.extend({level:sI,logger:oU().optional(),data:ih()}),sz=nl.extend({method:ij("notifications/message"),params:sq}),sD=ib({name:oU().optional()}),sL=ib({hints:ig(sD).optional(),costPriority:ia().min(0).max(1).optional(),speedPriority:ia().min(0).max(1).optional(),intelligencePriority:ia().min(0).max(1).optional()}),sU=ib({mode:ix(["auto","required","none"]).optional()}),sH=ib({type:ij("tool_result"),toolUseId:oU().describe("The unique identifier for the corresponding tool call."),content:ig(sb),structuredContent:ih().optional(),isError:il().optional(),_meta:iT(oU(),ih()).optional()}),sV=iE("type",[sh,sf,sm]),sK=iE("type",[sh,sf,sm,sy,sH]),sF=ib({role:nB,content:iw([sK,ig(sK)]),_meta:iT(oU(),ih()).optional()}),sJ=ni.extend({messages:ig(sF),modelPreferences:sL.optional(),systemPrompt:oU().optional(),includeContext:ix(["none","thisServer","allServers"]).optional(),temperature:ia().optional(),maxTokens:ia().int(),stopSequences:ig(oU()).optional(),metadata:i3.optional(),tools:ig(sP).optional(),toolChoice:sU.optional()}),sW=nn.extend({method:ij("sampling/createMessage"),params:sJ}),sB=nu.extend({model:oU(),stopReason:iM(ix(["endTurn","stopSequence","maxTokens"]).or(oU())),role:nB,content:sV}),sG=nu.extend({model:oU(),stopReason:iM(ix(["endTurn","stopSequence","maxTokens","toolUse"]).or(oU())),role:nB,content:iw([sK,ig(sK)])}),sZ=ib({type:ij("boolean"),title:oU().optional(),description:oU().optional(),default:il().optional()}),sX=ib({type:ij("string"),title:oU().optional(),description:oU().optional(),minLength:ia().optional(),maxLength:ia().optional(),format:ix(["email","uri","date","date-time"]).optional(),default:oU().optional()}),sY=ib({type:ix(["number","integer"]),title:oU().optional(),description:oU().optional(),minimum:ia().optional(),maximum:ia().optional(),default:ia().optional()}),sQ=ib({type:ij("string"),title:oU().optional(),description:oU().optional(),enum:ig(oU()),default:oU().optional()}),s0=ib({type:ij("string"),title:oU().optional(),description:oU().optional(),oneOf:ig(ib({const:oU(),title:oU()})),default:oU().optional()}),s1=ib({type:ij("string"),title:oU().optional(),description:oU().optional(),enum:ig(oU()),enumNames:ig(oU()).optional(),default:oU().optional()}),s2=iw([sQ,s0]),s9=ib({type:ij("array"),title:oU().optional(),description:oU().optional(),minItems:ia().optional(),maxItems:ia().optional(),items:ib({type:ij("string"),enum:ig(oU())}),default:ig(oU()).optional()}),s4=ib({type:ij("array"),title:oU().optional(),description:oU().optional(),minItems:ia().optional(),maxItems:ia().optional(),items:ib({anyOf:ig(ib({const:oU(),title:oU()}))}),default:ig(oU()).optional()}),s5=iw([s9,s4]),s6=iw([s1,s2,s5]),s3=iw([s6,sZ,sX,sY]),s8=ni.extend({mode:ij("form").optional(),message:oU(),requestedSchema:ib({type:ij("object"),properties:iT(oU(),s3),required:ig(oU()).optional()}).catchall(ih())}),s7=ni.extend({mode:ij("url"),message:oU(),elicitationId:oU(),url:oU().url()}),le=iw([s8,s7]),lt=nn.extend({method:ij("elicitation/create"),params:le}),lr=ns.extend({elicitationId:oU()}),la=nl.extend({method:ij("notifications/elicitation/complete"),params:lr}),lo=nu.extend({action:ix(["accept","decline","cancel"]),content:iX(t=>null===t?void 0:t,iT(oU(),iw([oU(),ia(),il(),ig(oU())])).optional())}),li=ib({type:ij("ref/resource"),uri:oU()}),ln=ib({type:ij("ref/prompt"),name:oU()}),ls=no.extend({ref:iw([ln,li]),argument:ib({name:oU(),value:oU()}),context:ib({arguments:iT(oU(),oU()).optional()}).optional()}),ll=nn.extend({method:ij("completion/complete"),params:ls}),lc=nu.extend({completion:iS({values:ig(oU()).max(100),total:iM(ia().int()),hasMore:iM(il())})}),lu=ib({uri:oU().startsWith("file://"),name:oU().optional(),_meta:iT(oU(),ih()).optional()}),ld=nn.extend({method:ij("roots/list"),params:no.optional()}),lp=nu.extend({roots:ig(lu)}),lh=nl.extend({method:ij("notifications/roots/list_changed"),params:ns.optional()}),lf=iS({ttl:ia().optional(),pollInterval:ia().optional()}),lm=ix(["working","input_required","completed","failed","cancelled"]),ly=ib({taskId:oU(),status:lm,ttl:iw([ia(),iu()]),createdAt:oU(),lastUpdatedAt:oU(),pollInterval:iM(ia()),statusMessage:iM(oU())}),lg=nu.extend({task:ly}),lv=ns.merge(ly),lb=nl.extend({method:ij("notifications/tasks/status"),params:lv}),lS=nn.extend({method:ij("tasks/get"),params:no.extend({taskId:oU()})}),l_=nu.merge(ly),lw=nn.extend({method:ij("tasks/result"),params:no.extend({taskId:oU()})}),l$=nu.loose(),lE=nH.extend({method:ij("tasks/list")}),lP=nV.extend({tasks:ig(ly)}),lR=nn.extend({method:ij("tasks/cancel"),params:no.extend({taskId:oU()})}),lk=nu.merge(ly),lT=iw([nq,nC,nN,ll,sM,sp,sc,nY,n0,n9,n6,n3,se,sC,sR]),lO=iw([nS,nL,nI,lh]),lx=iw([nv,sB,sG,lo,lp]),lC=iw([nq,sW,lt,ld]),lj=iw([nS,nL,sz,sn,n5,sj,sw,sr,la]),lA=iw([nv,nA,nM,lc,s_,su,nQ,n1,n4,sT,sk,so]),lI=ar(oZ,void 0).superRefine((t,r)=>{if(!URL.canParse(t))return r.addIssue({code:"custom",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"}),lN=iS({resource:oU().url(),authorization_servers:ig(lI).optional(),jwks_uri:oU().url().optional(),scopes_supported:ig(oU()).optional(),bearer_methods_supported:ig(oU()).optional(),resource_signing_alg_values_supported:ig(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:ig(oU()).optional(),dpop_signing_alg_values_supported:ig(oU()).optional(),dpop_bound_access_tokens_required:il().optional()}),lM=iS({issuer:oU(),authorization_endpoint:lI,token_endpoint:lI,registration_endpoint:lI.optional(),scopes_supported:ig(oU()).optional(),response_types_supported:ig(oU()),response_modes_supported:ig(oU()).optional(),grant_types_supported:ig(oU()).optional(),token_endpoint_auth_methods_supported:ig(oU()).optional(),token_endpoint_auth_signing_alg_values_supported:ig(oU()).optional(),service_documentation:lI.optional(),revocation_endpoint:lI.optional(),revocation_endpoint_auth_methods_supported:ig(oU()).optional(),revocation_endpoint_auth_signing_alg_values_supported:ig(oU()).optional(),introspection_endpoint:oU().optional(),introspection_endpoint_auth_methods_supported:ig(oU()).optional(),introspection_endpoint_auth_signing_alg_values_supported:ig(oU()).optional(),code_challenge_methods_supported:ig(oU()).optional(),client_id_metadata_document_supported:il().optional(),authorization_response_iss_parameter_supported:il().optional().catch(void 0),dpop_signing_alg_values_supported:ig(oU()).optional()}),lq=iS({issuer:oU(),authorization_endpoint:lI,token_endpoint:lI,userinfo_endpoint:lI.optional(),jwks_uri:lI,registration_endpoint:lI.optional(),scopes_supported:ig(oU()).optional(),response_types_supported:ig(oU()),response_modes_supported:ig(oU()).optional(),grant_types_supported:ig(oU()).optional(),acr_values_supported:ig(oU()).optional(),subject_types_supported:ig(oU()),id_token_signing_alg_values_supported:ig(oU()),id_token_encryption_alg_values_supported:ig(oU()).optional(),id_token_encryption_enc_values_supported:ig(oU()).optional(),userinfo_signing_alg_values_supported:ig(oU()).optional(),userinfo_encryption_alg_values_supported:ig(oU()).optional(),userinfo_encryption_enc_values_supported:ig(oU()).optional(),request_object_signing_alg_values_supported:ig(oU()).optional(),request_object_encryption_alg_values_supported:ig(oU()).optional(),request_object_encryption_enc_values_supported:ig(oU()).optional(),token_endpoint_auth_methods_supported:ig(oU()).optional(),token_endpoint_auth_signing_alg_values_supported:ig(oU()).optional(),display_values_supported:ig(oU()).optional(),claim_types_supported:ig(oU()).optional(),claims_supported:ig(oU()).optional(),service_documentation:oU().optional(),claims_locales_supported:ig(oU()).optional(),ui_locales_supported:ig(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: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}),lD=ib({access_token:oU(),id_token:oU().optional(),token_type:oU(),expires_in:new ir(ae({type:"number",coerce:!0,checks:[],...ek(void 0)})).optional(),scope:oU().optional(),refresh_token:oU().optional(),issuer:oU().optional().catch(void 0)}).strip(),lL=ib({issued_token_type:ij("urn:ietf:params:oauth:token-type:id-jag"),access_token:oU(),token_type:oU().optional(),expires_in:ia().optional(),scope:oU().optional()}).strip(),lU=ib({error:oU(),error_description:oU().optional(),error_uri:oU().optional()}),lH=lI.optional().or(ij("").transform(()=>void 0)),lV=ib({redirect_uris:ig(lI),token_endpoint_auth_method:oU().optional(),grant_types:ig(oU()).optional(),response_types:ig(oU()).optional(),application_type:oU().optional(),client_name:oU().optional(),client_uri:lI.optional(),logo_uri:lH,scope:oU().optional(),contacts:ig(oU()).optional(),tos_uri:lH,policy_uri:oU().optional(),jwks_uri:lI.optional(),jwks:new id({type:"any"}).optional(),software_id:oU().optional(),software_version:oU().optional(),software_statement:oU().optional()}).strip(),lK=ib({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(),lF=lV.merge(lK),lJ=ib({error:oU(),error_description:oU().optional()}).strip(),lW=ib({token:oU(),token_type_hint:oU().optional()}).strip(),lB=Symbol.for("mcp.sdk.errorBrands");function lG(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,lB,{value:a,enumerable:!1,configurable:!0})}function lZ(t,r){try{if("object"==typeof r&&null!==r&&Object.prototype.hasOwnProperty.call(t,"mcpBrand")&&"string"==typeof t.mcpBrand&&Object.prototype.hasOwnProperty.call(r,lB)){let a=r[lB];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 lZ(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 lZ(this,t)}constructor(t,r,a){super(r),this.code=t,this.errorUri=a,this.name="OAuthError",lG(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 lX=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](t){return lZ(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 lZ(this,t)}constructor(t,r,a,o){super(r,o),this.code=t,this.data=a,this.name="SdkError",lG(this,new.target)}};(class extends lX{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}});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=(($={})[$.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 l1=class t extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return lZ(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 lZ(this,t)}constructor(t,r,a){super(r),this.code=t,this.data=a,this.name="ProtocolError",lG(this,new.target)}static fromError(r,a,o){return r===l0.UrlElicitationRequired&&o&&o.elicitations?new l9(o.elicitations,a):r===l0.UnsupportedProtocolVersion&&o&&Array.isArray(o.supported)&&"string"==typeof o.requested?new l4({supported:o.supported,requested:o.requested},a):(r===l0.InvalidParams||r===l0.ResourceNotFound)&&"string"==typeof o?.uri&&(r===l0.ResourceNotFound||1===Object.keys(o).length)?new l2(o.uri,a):r===l0.MissingRequiredClientCapability&&o&&null!==o.requiredCapabilities&&"object"==typeof o.requiredCapabilities&&!Array.isArray(o.requiredCapabilities)?new l5({requiredCapabilities:o.requiredCapabilities},a):new t(r,a,o)}},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 l6={"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},l3={"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(l6),Object.keys(l3);var l8=((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:()=>nG,AudioContentSchema:()=>sm,BaseMetadataSchema:()=>n$,BaseRequestParamsSchema:()=>no,BlobResourceContentsSchema:()=>nW,BooleanSchemaSchema:()=>sZ,CallToolRequestParamsSchema:()=>sx,CallToolRequestSchema:()=>sC,CallToolResultSchema:()=>sT,CancelTaskRequestSchema:()=>lR,CancelTaskResultSchema:()=>lk,CancelledNotificationParamsSchema:()=>nb,CancelledNotificationSchema:()=>nS,ClientCapabilitiesSchema:()=>nO,ClientNotificationSchema:()=>lO,ClientRequestSchema:()=>lT,ClientResultSchema:()=>lx,ClientTasksCapabilitySchema:()=>nk,CompatibilityCallToolResultSchema:()=>sO,CompleteRequestParamsSchema:()=>ls,CompleteRequestSchema:()=>ll,CompleteResultSchema:()=>lc,ContentBlockSchema:()=>sb,CreateMessageRequestParamsSchema:()=>sJ,CreateMessageRequestSchema:()=>sW,CreateMessageResultSchema:()=>sB,CreateMessageResultWithToolsSchema:()=>sG,CreateTaskResultSchema:()=>lg,CursorSchema:()=>ne,DiscoverRequestSchema:()=>nN,DiscoverResultSchema:()=>nM,ElicitRequestFormParamsSchema:()=>s8,ElicitRequestParamsSchema:()=>le,ElicitRequestSchema:()=>lt,ElicitRequestURLParamsSchema:()=>s7,ElicitResultSchema:()=>lo,ElicitationCompleteNotificationParamsSchema:()=>lr,ElicitationCompleteNotificationSchema:()=>la,EmbeddedResourceSchema:()=>sg,EmptyResultSchema:()=>nv,EnumSchemaSchema:()=>s6,GetPromptRequestParamsSchema:()=>sd,GetPromptRequestSchema:()=>sp,GetPromptResultSchema:()=>s_,GetTaskPayloadRequestSchema:()=>lw,GetTaskPayloadResultSchema:()=>l$,GetTaskRequestSchema:()=>lS,GetTaskResultSchema:()=>l_,IconSchema:()=>n_,IconsSchema:()=>nw,ImageContentSchema:()=>sf,ImplementationSchema:()=>nE,InitializeRequestParamsSchema:()=>nx,InitializeRequestSchema:()=>nC,InitializeResultSchema:()=>nA,InitializedNotificationSchema:()=>nI,JSONArraySchema:()=>i8,JSONObjectSchema:()=>i3,JSONRPCErrorResponseSchema:()=>nm,JSONRPCMessageSchema:()=>ny,JSONRPCNotificationSchema:()=>nh,JSONRPCRequestSchema:()=>np,JSONRPCResponseSchema:()=>ng,JSONRPCResultResponseSchema:()=>nf,JSONValueSchema:()=>i6,LegacyTitledEnumSchemaSchema:()=>s1,ListChangedOptionsBaseSchema:()=>sA,ListPromptsRequestSchema:()=>sc,ListPromptsResultSchema:()=>su,ListResourceTemplatesRequestSchema:()=>n0,ListResourceTemplatesResultSchema:()=>n1,ListResourcesRequestSchema:()=>nY,ListResourcesResultSchema:()=>nQ,ListRootsRequestSchema:()=>ld,ListRootsResultSchema:()=>lp,ListTasksRequestSchema:()=>lE,ListTasksResultSchema:()=>lP,ListToolsRequestSchema:()=>sR,ListToolsResultSchema:()=>sk,LoggingLevelSchema:()=>sI,LoggingMessageNotificationParamsSchema:()=>sq,LoggingMessageNotificationSchema:()=>sz,ModelHintSchema:()=>sD,ModelPreferencesSchema:()=>sL,MultiSelectEnumSchemaSchema:()=>s5,NotificationSchema:()=>nl,NotificationsParamsSchema:()=>ns,NumberSchemaSchema:()=>sY,PaginatedRequestParamsSchema:()=>nU,PaginatedRequestSchema:()=>nH,PaginatedResultSchema:()=>nV,PingRequestSchema:()=>nq,PrimitiveSchemaDefinitionSchema:()=>s3,ProgressNotificationParamsSchema:()=>nD,ProgressNotificationSchema:()=>nL,ProgressSchema:()=>nz,ProgressTokenSchema:()=>i7,PromptArgumentSchema:()=>ss,PromptListChangedNotificationSchema:()=>sw,PromptMessageSchema:()=>sS,PromptReferenceSchema:()=>ln,PromptSchema:()=>sl,ReadResourceRequestParamsSchema:()=>n2,ReadResourceRequestSchema:()=>n9,ReadResourceResultSchema:()=>n4,RelatedTaskMetadataSchema:()=>nr,RequestIdSchema:()=>nd,RequestMetaSchema:()=>na,RequestSchema:()=>nn,ResourceContentsSchema:()=>nK,ResourceLinkSchema:()=>sv,ResourceListChangedNotificationSchema:()=>n5,ResourceRequestParamsSchema:()=>n2,ResourceSchema:()=>nZ,ResourceTemplateReferenceSchema:()=>li,ResourceTemplateSchema:()=>nX,ResourceUpdatedNotificationParamsSchema:()=>si,ResourceUpdatedNotificationSchema:()=>sn,ResultMetaObjectSchema:()=>nc,ResultSchema:()=>nu,RoleSchema:()=>nB,RootSchema:()=>lu,RootsListChangedNotificationSchema:()=>lh,SamplingContentSchema:()=>sV,SamplingMessageContentBlockSchema:()=>sK,SamplingMessageSchema:()=>sF,ServerCapabilitiesSchema:()=>nj,ServerNotificationSchema:()=>lj,ServerRequestSchema:()=>lC,ServerResultSchema:()=>lA,ServerTasksCapabilitySchema:()=>nT,SetLevelRequestParamsSchema:()=>sN,SetLevelRequestSchema:()=>sM,SingleSelectEnumSchemaSchema:()=>s2,StringSchemaSchema:()=>sX,SubscribeRequestParamsSchema:()=>n2,SubscribeRequestSchema:()=>n6,SubscriptionFilterSchema:()=>n8,SubscriptionsAcknowledgedNotificationParamsSchema:()=>st,SubscriptionsAcknowledgedNotificationSchema:()=>sr,SubscriptionsListenRequestParamsSchema:()=>n7,SubscriptionsListenRequestSchema:()=>se,SubscriptionsListenResultMetaSchema:()=>sa,SubscriptionsListenResultSchema:()=>so,TaskAugmentedRequestParamsSchema:()=>ni,TaskCreationParamsSchema:()=>lf,TaskMetadataSchema:()=>nt,TaskSchema:()=>ly,TaskStatusNotificationParamsSchema:()=>lv,TaskStatusNotificationSchema:()=>lb,TaskStatusSchema:()=>lm,TextContentSchema:()=>sh,TextResourceContentsSchema:()=>nF,TitledMultiSelectEnumSchemaSchema:()=>s4,TitledSingleSelectEnumSchemaSchema:()=>s0,ToolAnnotationsSchema:()=>s$,ToolChoiceSchema:()=>sU,ToolExecutionSchema:()=>sE,ToolListChangedNotificationSchema:()=>sj,ToolResultContentSchema:()=>sH,ToolSchema:()=>sP,ToolUseContentSchema:()=>sy,UnsubscribeRequestParamsSchema:()=>n2,UnsubscribeRequestSchema:()=>n3,UntitledMultiSelectEnumSchemaSchema:()=>s9,UntitledSingleSelectEnumSchemaSchema:()=>sQ});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,ca="draft-2020-12",co=/\\\.\\d\{(\d+)\}/;function ci(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}let cn=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function cs(t){return cn.has(t)||t.startsWith("x-")}let cl=new Set(["$schema",...Object.keys(s8.shape.requestedSchema.shape)]),cc={string:ce([sX,sQ,s0,s1]),number:ce([sY]),integer:ce([sY]),boolean:ce([sZ]),array:ce([s9,s4])},cu=new Set(sX.shape.format.unwrap().options),cd=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(!ct(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&&ci(n)?a[i]=Object.fromEntries(Object.entries(n).map(([t,a])=>[t,function(t,r,a,o){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 n={};for(let[l,c]of Object.entries(t))if(i.has(l)||cs(l))n[l]=c;else if("pattern"===l&&"string"===t.type&&"string"==typeof t.format)if(cu.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=co.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=>aa(oV,{local:t,offset:r,precision:a}))))}return new Set(a.map(t=>{let r;return r=os(t,{target:ca,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)])):cl.has(i)?a[i]=n:cs(i)||o.push(i);if(o.length>0)throw new l1(l0.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:ca});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().");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.")),a=os(t,{target:ca,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 l1(l0.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}(t.requestedSchema),a),i=(r=s8.shape.requestedSchema,ok(r,o));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 a=Object.entries(t.properties).filter(([,t])=>!ok(s3,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}]`)):ci(r)&&ci(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):cs(r)?[]:[n]}):[]}(o,i.data);if(n.length>0)throw new l1(l0.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 l1(l0.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 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,a){let o=ch(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 ch(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 cf={},cm={};function cy(t,r){let a=t.slice(0,-6);cf[a]=r,cm[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"])cy(t,l8[t]);for(let[t,r]of Object.entries({IdJagTokenExchangeResponseSchema:lL,OAuthClientInformationFullSchema:lF,OAuthClientInformationSchema:lK,OAuthClientMetadataSchema:lV,OAuthClientRegistrationErrorSchema:lJ,OAuthErrorResponseSchema:lU,OAuthMetadataSchema:lM,OAuthProtectedResourceMetadataSchema:lN,OAuthTokenRevocationRequestSchema:lW,OAuthTokensSchema:lD,OpenIdProviderDiscoveryMetadataSchema:lz,OpenIdProviderMetadataSchema:lq}))cy(t,r);Object.freeze(cf),Object.freeze(cm);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 cg=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())}}),cv=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;let r=cg();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}),cb=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=cg(),a=cv();var o=cg();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=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 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=C(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=C(this.rhs,t,a),this}get names(){return x(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=C(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)=>O(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(j(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=C(this.condition,t,r),this}get names(){let t=super.names;return x(t,this.condition),this.else&&O(t,this.else.names),t}};v.kind="if";var b=class extends m{};b.kind="for";var S=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=C(this.iteration,t,r),this}get names(){return O(super.names,this.iteration.names)}},_=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 x(x(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=C(this.iterable,t,r),this}get names(){return O(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&&O(t,this.catch.names),this.finally&&O(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 T=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 S(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 _(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 O(t,r){for(let a in r)t[a]=(t[a]||0)+(r[a]||0);return t}function x(t,a){return a instanceof r._CodeOrName?O(t,a.names):t}function C(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 j(t){return"boolean"==typeof t||"number"==typeof t||null===t?!t:(0,r._)`!${M(t)}`}t.CodeGen=T,t.not=j;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)}}),cS=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=cb(),i=cg();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=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")}}),cw=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=cb(),a=cS(),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)}}),c$=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;let r=cw(),a=cb(),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)}}),cE=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:{}}}}),cP=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}),cR=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=cE(),i=cP(),n=cw(),s=cb(),l=cS();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
|| (${l} == "string" && ${i} && ${i} == +${i})`).assign(c,(0,s._)`+${i}`);return;case"integer":o.elseIf((0,s._)`${l} === "boolean" || ${i} === null
|| (${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"
|| ${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}),ck=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;let r=cb(),a=cS();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))}}),cT=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=cb(),a=cS(),o=c_(),i=cS();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))}}),cO=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;let r=cb(),a=c_(),o=cT(),i=cw();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)}}}),cx=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;let r=cb(),a=cS();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}}),cC=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}}),cA=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;let r=cS(),a=cC(),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`)}}}),cI=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;let r=c$(),a=cR(),o=cP(),i=cR(),n=ck(),s=cO(),l=cx(),c=cb(),u=c_(),d=cA(),p=cS(),h=cw();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 _(t,[],!1,r);let o=(0,a.getSchemaTypes)(t.schema);_(t,o,!(0,a.coerceAndCheckDataType)(t,o),r)}function S({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 _(t,r,a,n){var s,l,d,h;let{gen:f,schema:m,data:y,allErrors:g,opts:v,self:b}=t,{RULES:S}=b;if(m.$ref&&(v.ignoreKeywordsWithRef||!(0,p.schemaHasRulesButRef)(m,S)))return void f.block(()=>R(t,"$ref",S.all.$ref.definition));function _(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 S.rules)_(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&&S(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",O(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,s.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw Error(`${a} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:!1!==r.errors)&&(this.errsCount=t.gen.const("_errs",u.default.errors))}result(t,r,a){this.failResult((0,c.not)(t),r,a)}failResult(t,r,a){this.gen.if(t),a?a():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,c.not)(t),void 0,r)}fail(t){if(void 0===t){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,c._)`${r} !== undefined && (${(0,c.or)(this.invalid$data(),t)})`)}error(t,r,a){if(r){this.setParams(r),this._error(t,a),this.setParams({});return}this._error(t,a)}_error(t,r){(t?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&&S(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)*$/,T=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function O(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=T.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=O}),cN=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}}}),cM=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cA();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))}}}),cq=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;let r=cb(),a=cN(),o=c_(),i=cA(),n=cS(),s=cI();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}}),cz=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}}),cD=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}}),cL=eo((t,r)=>{let{isUUID:a}=cD(),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}}),cU=eo((t,r)=>{let{normalizeIPv6:a,removeDotSegments:o,recomposeAuthority:i,normalizeComponentEncoding:n,isIPv4:s,nonSimpleDomain:l}=cD(),{SCHEMES:c,getSchemeHandler:u}=cL();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}),cH=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cU();r.code='require("ajv/dist/runtime/uri").default',t.default=r}),cV=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=cI();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return r.KeywordCxt}});var a=cb();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=cN(),i=cM(),n=cE(),s=cq(),l=cb(),c=cA(),u=cR(),d=cS(),p=cz(),h=cH(),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,T;let O=t.strict,x=null==(r=t.code)?void 0:r.optimize,C=!0===x||void 0===x?1:x||0,j=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:O)||s,strictNumbers:null==(c=null!=(l=t.strictNumbers)?l:O)||c,strictTypes:null!=(d=null!=(u=t.strictTypes)?u:O)?d:"log",strictTuples:null!=(m=null!=(p=t.strictTuples)?p:O)?m:"log",strictRequired:null!=(g=null!=(y=t.strictRequired)?y:O)&&g,code:t.code?{...t.code,optimize:C,regExp:j}:{optimize:C,regExp:j},loopRequired:null!=(v=t.loopRequired)?v:200,loopEnum:null!=(b=t.loopEnum)?b:200,meta:null==(S=t.meta)||S,messages:null==(_=t.messages)||_,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==(T=t.int32range)||T,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)(),S.call(this,g,t,"NOT SUPPORTED"),S.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=_.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=_.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(T.call(this,a,r),!r)return(0,d.eachItem)(a,t=>O.call(this,t)),this;C.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=>O.call(this,t,o):t=>o.type.forEach(r=>O.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 S(t,r,a,o="error"){for(let i in t)i in r&&this.logger[o](`${a}: option ${i}. ${t[i]}`)}function _(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 T(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 O(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?x.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 x(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 C(t){let{metaSchema:r}=t;void 0!==r&&(t.$data&&this.opts.$data&&(r=A(r)),t.validateSchema=this.compile(r,!0))}let j={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function A(t){return{anyOf:[t,j]}}}),cK=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}}}),cF=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;let r=cM(),a=cT(),o=cb(),i=c_(),n=cq(),s=cS();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:S}=y;if(("#"===h||"#/"===h)&&m===S.baseId){if(y===S)return c(t,g,y,y.$async);let r=p.scopeValue("root",{ref:S});return c(t,(0,o._)`${r}.validate`,S,S.$async)}let _=n.resolveRef.call(b,S,m,h);if(void 0===_)throw new r.default(f.opts.uriResolver,m,h);return _ instanceof n.SchemaEnv?void c(t,l(t,a=_),a,a.$async):(i=_,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)))}}}),cJ=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cK(),a=cF();t.default=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",r.default,a.default]}),cW=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb(),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})`)}}}),cB=eo(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: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}))`)}}}),cG=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'}),cZ=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb(),a=cS(),o=cG();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}`)}}}),cX=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cT(),a=cS(),o=cb();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})`)}}}}),cY=eo(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: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}`)}}}),cQ=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cT(),a=cb(),o=cS();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())})}}}}),c0=eo(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: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}`)}}}),c1=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cC();r.code='require("ajv/dist/runtime/equal").default',t.default=r}),c2=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cR(),a=cb(),o=cS(),i=c1();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)}}}),c9=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb(),a=cS(),o=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: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}`)}}}),c4=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb(),a=cS(),o=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,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)}}}),c5=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cW(),a=cB(),o=cZ(),i=cX(),n=cY(),s=cQ(),l=c0(),c=c2(),u=c9(),d=c4();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]}),c6=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;let r=cb(),a=cS();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')}}}),c3=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;let r=cb(),a=cS(),o=cT();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))}}}),c8=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=c3();t.default={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,r.validateTuple)(t,"items")}}),c7=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb(),a=cS(),o=cT(),i=c6();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)))}}}),ue=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb(),a=cS();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())}}}),ut=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;let r=cb(),a=cS(),o=cT();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},
missingProperty: ${i},
depsCount: ${a},
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}),ur=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb(),a=cS();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)}}}),ua=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cT(),a=cb(),o=c_(),i=cS();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}`)}}}),uo=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cI(),a=cT(),o=cS(),i=ua();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)}}}}),ui=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cT(),a=cb(),o=cS(),i=cS();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())})})}}}}),un=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cS();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"}}}),us=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:cT().validateUnion,error:{message:"must match a schema in anyOf"}}}),ul=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb(),a=cS();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))}}}),uc=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cS();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)})}}}),uu=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb(),a=cS();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))}}}),ud=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cS();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`)}}}),up=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=c6(),a=c8(),o=c3(),i=c7(),n=ue(),s=ut(),l=ur(),c=ua(),u=uo(),d=ui(),p=un(),h=us(),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,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}}),uh=eo(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,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})`}())}())}}}),uf=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=[uh().default]}),um=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"]}),uy=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cJ(),a=c5(),o=up(),i=uf(),n=um();t.default=[r.default,a.default,(0,o.default)(),i.default,n.metadataVocabulary,n.contentVocabulary]}),ug=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"}),uv=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb(),a=ug(),o=cq(),i=cM(),n=cS();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)}}}),ub=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}}),uS=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=cV(),o=uy(),i=uv(),n=ub(),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=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=cN();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}})}),u_=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicAnchor=void 0;let r=cb(),a=c_(),o=cq(),i=cF();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)}}),uw=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicRef=void 0;let r=cb(),a=c_(),o=cF();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)}}),u$=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u_(),a=cS();t.default={keyword:"$recursiveAnchor",schemaType:"boolean",code(t){t.schema?(0,r.dynamicAnchor)(t,""):(0,a.checkStrictMode)(t.it,"$recursiveAnchor: false is ignored")}}}),uE=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uw();t.default={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,r.dynamicRef)(t,t.schema)}}),uP=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u_(),a=uw(),o=u$(),i=uE();t.default=[r.default,a.default,o.default,i.default]}),uR=eo(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=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ut();t.default={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,r.validateSchemaDeps)(t)}}),uT=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cS();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`)}}}),uO=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uR(),a=uk(),o=uT();t.default=[r.default,a.default,o.default]}),ux=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb(),a=cS(),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}`)}}}),uC=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cb(),a=cS();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=ux(),a=uC();t.default=[r.default,a.default]}),uA=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"}]}}}}}),uI=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:"#"}}}}}),uN=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:"#"}}}}),uM=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:{}}}}}),uq=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"}}}}),uz=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}}}}),uD=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:[]}}}}),uL=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uA(),a=uI(),o=uN(),i=uM(),n=uq(),s=uz(),l=uD(),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}}}),uU=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=cV(),o=uy(),i=uP(),n=uO(),s=uj(),l=uv(),c=uL(),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=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=cN();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}})}),uH=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=cJ(),a=c5(),o=up(),i=uP(),n=uO(),s=uj(),l=uf(),c=um();t.default=[i.default,r.default,a.default,(0,o.default)(!0),l.default,c.metadataVocabulary,c.contentVocabulary,n.default,s.default]}),uV=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}}}}),uK=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"}}}}}),uF=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"}}}}),uJ=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"}}}}),uW=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"}}}}),uB=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"}}}}),uG=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}}}}),uZ=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:[]}}}}),uX=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV(),a=uK(),o=uF(),i=uJ(),n=uW(),s=uB(),l=uG(),c=uZ(),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}}}),uY=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=cV(),o=uH(),i=uv(),n=uX(),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=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=cN();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=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(_.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:S},double:{type:"number",validate:S},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 S(){return!0}let _=/[^\\]\\Z/}),u0=eo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;let r=uS(),a=cb(),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)}),u1=eo((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});let a=uQ(),o=u0(),i=cb(),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}),u2=uS(),u9=uU(),u4=uY();((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!=(_=u1())?Y(er(_)):{},"default",{value:_,enumerable:!0}),_).default;u2.Ajv;let u5=require("node:process"),u6=Symbol.for("mcp.completable");function u3(t,r){return Object.defineProperty(t,u6,{value:{complete:r},enumerable:!1,writable:!1,configurable:!1}),t}function u8(t){let r="";for(let a of t)r+=String.fromCodePoint(a);return btoa(r).replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}function u7(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 de(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=>u8(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=u8(l.encode(JSON.stringify(o)));return`v1.${u}.${u8(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=u7(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(u7(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 dt=Object.create,dr=Object.defineProperty,da=Object.getOwnPropertyDescriptor,di=Object.getOwnPropertyNames,dn=Object.getPrototypeOf,ds=Object.prototype.hasOwnProperty,dl=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports),dc=(t,r,a)=>(a=null!=t?dt(dn(t)):{},((t,r,a,o)=>{if(r&&"object"==typeof r||"function"==typeof r)for(var i,n=di(r),s=0,l=n.length;s<l;s++)i=n[s],ds.call(t,i)||i===a||dr(t,i,{get:(t=>r[t]).bind(null,i),enumerable:!(o=da(r,i))||o.enumerable});return t})(!r&&t&&t.__esModule?a:dr(a,"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 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,df,{value:a,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 a=r[df];if(a&&"function"==typeof a.has&&a.has(t.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(t,r)}let dg=((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 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,a){super(r),this.code=t,this.errorUri=a,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=((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 dS=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,a,o){super(r,o),this.code=t,this.data=a,this.name="SdkError",dm(this,new.target)}},d_=class extends dS{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 dw(t){if("object"!=typeof t||null===t||Array.isArray(t))return t;let r={...t};return delete r.issuer,r}let d$="2026-07-28",dE=[d$];function dP(t){return t.filter(t=>!(t>=d$))}function dR(t){return t.filter(t=>t>=d$)}function dk(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 dT=["task","inputRequests","requestState"];function dO(t){return null===t||"object"!=typeof t||Array.isArray(t)||void 0!==t.content||dT.some(r=>r in t)?t:{...t,content:[]}}function dx(){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,T,O,x,C,j,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,eS,e_,ew,e$,eE,eP,eR,ek,eT,eO,ex,eC,ej,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,tS,t_,tw,t$;return i??=(t=iG(()=>iw([oU(),ia(),il(),iu(),iT(oU(),t),ig(t)])),r=iT(oU(),t),a=iw([oU(),ia().int()]),o=oU(),n=ib({ttl:ia().optional()}),s=ib({taskId:oU()}),u=(c=ib({_meta:(l=iS({progressToken:a.optional(),"io.modelcontextprotocol/related-task":s.optional()})).optional()})).extend({task:n.optional()}),d=ib({method:oU(),params:c.loose().optional()}),p=ib({_meta:l.optional()}),h=ib({method:oU(),params:p.loose().optional()}),f=iS({_meta:l.optional()}),m=iw([oU(),ia().int()]),y=f.strict(),g=p.extend({requestId:m.optional(),reason:oU().optional()}),v=h.extend({method:ij("notifications/cancelled"),params:g}),b=ib({src:oU(),mimeType:oU().optional(),sizes:ig(oU()).optional(),theme:ix(["light","dark"]).optional()}),S=ib({icons:ig(b).optional()}),w=(_=ib({name:oU(),title:oU().optional()})).extend({..._.shape,...S.shape,version:oU(),websiteUrl:oU().optional(),description:oU().optional()}),$=iR(ib({applyDefaults:il().optional()}),r),E=iX(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,iR(ib({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=ib({experimental:iT(oU(),r).optional(),sampling:ib({context:r.optional(),tools:r.optional()}).optional(),elicitation:E.optional(),roots:ib({listChanged:il().optional()}).optional(),tasks:P.optional(),extensions:iT(oU(),r).optional()}),T=c.extend({protocolVersion:oU(),capabilities:k,clientInfo:w}),O=d.extend({method:ij("initialize"),params:T}),x=ib({experimental:iT(oU(),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:R.optional(),extensions:iT(oU(),r).optional()}),C=f.extend({protocolVersion:oU(),capabilities:x,serverInfo:w,instructions:oU().optional()}),j=h.extend({method:ij("notifications/initialized"),params:p.optional()}),A=d.extend({method:ij("ping"),params:c.optional()}),I=ib({progress:ia(),total:iM(ia()),message:iM(oU())}),N=ib({...p.shape,...I.shape,progressToken:a}),M=h.extend({method:ij("notifications/progress"),params:N}),q=c.extend({cursor:o.optional()}),z=d.extend({params:q.optional()}),D=f.extend({nextCursor:o.optional()}),U=(L=ib({uri:oU(),mimeType:iM(oU()),_meta:iT(oU(),ih()).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=ib({audience:ig(K=ix(["user","assistant"])).optional(),priority:ia().min(0).max(1).optional(),lastModified:aa(oV,{offset:!0}).optional()}),J=ib({..._.shape,...S.shape,uri:oU(),description:iM(oU()),mimeType:iM(oU()),size:iM(ia()),annotations:F.optional(),_meta:iM(iS({}))}),W=ib({..._.shape,...S.shape,uriTemplate:oU(),description:iM(oU()),mimeType:iM(oU()),annotations:F.optional(),_meta:iM(iS({}))}),B=z.extend({method:ij("resources/list")}),G=D.extend({resources:ig(J)}),Z=z.extend({method:ij("resources/templates/list")}),X=D.extend({resourceTemplates:ig(W)}),Y=c.extend({uri:oU()}),Q=d.extend({method:ij("resources/read"),params:Y}),ee=f.extend({contents:ig(iw([U,V]))}),et=h.extend({method:ij("notifications/resources/list_changed"),params:p.optional()}),er=d.extend({method:ij("resources/subscribe"),params:Y}),ea=d.extend({method:ij("resources/unsubscribe"),params:Y}),eo=p.extend({uri:oU()}),ei=h.extend({method:ij("notifications/resources/updated"),params:eo}),en=ib({name:oU(),description:iM(oU()),required:iM(il())}),es=ib({..._.shape,...S.shape,description:iM(oU()),arguments:iM(ig(en)),_meta:iM(iS({}))}),el=z.extend({method:ij("prompts/list")}),ec=D.extend({prompts:ig(es)}),eu=c.extend({name:oU(),arguments:iT(oU(),oU()).optional()}),ed=d.extend({method:ij("prompts/get"),params:eu}),ep=ib({type:ij("text"),text:oU(),annotations:F.optional(),_meta:iT(oU(),ih()).optional()}),eh=ib({type:ij("image"),data:H,mimeType:oU(),annotations:F.optional(),_meta:iT(oU(),ih()).optional()}),ef=ib({type:ij("audio"),data:H,mimeType:oU(),annotations:F.optional(),_meta:iT(oU(),ih()).optional()}),em=ib({type:ij("tool_use"),name:oU(),id:oU(),input:iT(oU(),ih()),_meta:iT(oU(),ih()).optional()}),ey=ib({type:ij("resource"),resource:iw([U,V]),annotations:F.optional(),_meta:iT(oU(),ih()).optional()}),eb=ib({role:K,content:ev=iw([ep,eh,ef,eg=J.extend({type:ij("resource_link")}),ey])}),eS=f.extend({description:oU().optional(),messages:ig(eb)}),e_=h.extend({method:ij("notifications/prompts/list_changed"),params:p.optional()}),ew=ib({title:oU().optional(),readOnlyHint:il().optional(),destructiveHint:il().optional(),idempotentHint:il().optional(),openWorldHint:il().optional()}),e$=ib({taskSupport:ix(["required","optional","forbidden"]).optional()}),eE=ib({..._.shape,...S.shape,description:oU().optional(),inputSchema:ib({type:ij("object"),properties:iT(oU(),t).optional(),required:ig(oU()).optional()}).catchall(ih()),outputSchema:ib({type:ij("object"),properties:iT(oU(),t).optional(),required:ig(oU()).optional()}).catchall(ih()).optional(),annotations:ew.optional(),execution:e$.optional(),_meta:iT(oU(),ih()).optional()}),eP=z.extend({method:ij("tools/list")}),eR=D.extend({tools:ig(eE)}),ek=f.extend({content:ig(ev),structuredContent:iT(oU(),ih()).optional(),isError:il().optional()}),eT=u.extend({name:oU(),arguments:iT(oU(),ih()).optional()}),eO=d.extend({method:ij("tools/call"),params:eT}),ex=h.extend({method:ij("notifications/tools/list_changed"),params:p.optional()}),eC=ix(["debug","info","notice","warning","error","critical","alert","emergency"]),ej=c.extend({level:eC}),eA=d.extend({method:ij("logging/setLevel"),params:ej}),eI=p.extend({level:eC,logger:oU().optional(),data:ih()}),eN=h.extend({method:ij("notifications/message"),params:eI}),eM=ib({name:oU().optional()}),eq=ib({hints:ig(eM).optional(),costPriority:ia().min(0).max(1).optional(),speedPriority:ia().min(0).max(1).optional(),intelligencePriority:ia().min(0).max(1).optional()}),ez=ib({mode:ix(["auto","required","none"]).optional()}),eD=ib({type:ij("tool_result"),toolUseId:oU().describe("The unique identifier for the corresponding tool call."),content:ig(ev),structuredContent:ib({}).loose().optional(),isError:il().optional(),_meta:iT(oU(),ih()).optional()}),eL=iE("type",[ep,eh,ef]),eH=ib({role:K,content:iw([eU=iE("type",[ep,eh,ef,em,eD]),ig(eU)]),_meta:iT(oU(),ih()).optional()}),eV=u.extend({messages:ig(eH),modelPreferences:eq.optional(),systemPrompt:oU().optional(),includeContext:ix(["none","thisServer","allServers"]).optional(),temperature:ia().optional(),maxTokens:ia().int(),stopSequences:ig(oU()).optional(),metadata:r.optional(),tools:ig(eE).optional(),toolChoice:ez.optional()}),eK=d.extend({method:ij("sampling/createMessage"),params:eV}),eF=f.extend({model:oU(),stopReason:iM(ix(["endTurn","stopSequence","maxTokens"]).or(oU())),role:K,content:eL}),eJ=f.extend({model:oU(),stopReason:iM(ix(["endTurn","stopSequence","maxTokens","toolUse"]).or(oU())),role:K,content:iw([eU,ig(eU)])}),eW=ib({type:ij("boolean"),title:oU().optional(),description:oU().optional(),default:il().optional()}),eB=ib({type:ij("string"),title:oU().optional(),description:oU().optional(),minLength:ia().optional(),maxLength:ia().optional(),format:ix(["email","uri","date","date-time"]).optional(),default:oU().optional()}),eG=ib({type:ix(["number","integer"]),title:oU().optional(),description:oU().optional(),minimum:ia().optional(),maximum:ia().optional(),default:ia().optional()}),eZ=ib({type:ij("string"),title:oU().optional(),description:oU().optional(),enum:ig(oU()),default:oU().optional()}),eX=ib({type:ij("string"),title:oU().optional(),description:oU().optional(),oneOf:ig(ib({const:oU(),title:oU()})),default:oU().optional()}),eY=ib({type:ij("string"),title:oU().optional(),description:oU().optional(),enum:ig(oU()),enumNames:ig(oU()).optional(),default:oU().optional()}),eQ=iw([eZ,eX]),e0=ib({type:ij("array"),title:oU().optional(),description:oU().optional(),minItems:ia().optional(),maxItems:ia().optional(),items:ib({type:ij("string"),enum:ig(oU())}),default:ig(oU()).optional()}),e2=iw([e0,e1=ib({type:ij("array"),title:oU().optional(),description:oU().optional(),minItems:ia().optional(),maxItems:ia().optional(),items:ib({anyOf:ig(ib({const:oU(),title:oU()}))}),default:ig(oU()).optional()})]),e9=iw([eY,eQ,e2]),e4=iw([e9,eW,eB,eG]),e5=u.extend({mode:ij("form").optional(),message:oU(),requestedSchema:ib({type:ij("object"),properties:iT(oU(),e4),required:ig(oU()).optional()}).catchall(ih())}),e3=iw([e5,e6=u.extend({mode:ij("url"),message:oU(),elicitationId:oU(),url:oU().url()})]),e8=d.extend({method:ij("elicitation/create"),params:e3}),e7=p.extend({elicitationId:oU()}),te=h.extend({method:ij("notifications/elicitation/complete"),params:e7}),tt=f.extend({action:ix(["accept","decline","cancel"]),content:iX(t=>null===t?void 0:t,iT(oU(),iw([oU(),ia(),il(),ig(oU())])).optional())}),tr=ib({type:ij("ref/resource"),uri:oU()}),ta=ib({type:ij("ref/prompt"),name:oU()}),to=c.extend({ref:iw([ta,tr]),argument:ib({name:oU(),value:oU()}),context:ib({arguments:iT(oU(),oU()).optional()}).optional()}),ti=d.extend({method:ij("completion/complete"),params:to}),tn=f.extend({completion:iS({values:ig(oU()).max(100),total:iM(ia().int()),hasMore:iM(il())})}),ts=ib({uri:oU().startsWith("file://"),name:oU().optional(),_meta:iT(oU(),ih()).optional()}),tl=d.extend({method:ij("roots/list"),params:c.optional()}),tc=f.extend({roots:ig(ts)}),tu=h.extend({method:ij("notifications/roots/list_changed"),params:p.optional()}),td=iS({ttl:ia().optional(),pollInterval:ia().optional()}),tp=ix(["working","input_required","completed","failed","cancelled"]),th=ib({taskId:oU(),status:tp,ttl:iw([ia(),iu()]),createdAt:oU(),lastUpdatedAt:oU(),pollInterval:iM(ia()),statusMessage:iM(oU())}),tf=f.extend({task:th}),tm=p.merge(th),ty=h.extend({method:ij("notifications/tasks/status"),params:tm}),tg=d.extend({method:ij("tasks/get"),params:c.extend({taskId:oU()})}),tv=f.merge(th),tb=d.extend({method:ij("tasks/result"),params:c.extend({taskId:oU()})}),tS=f.loose(),t_=z.extend({method:ij("tasks/list")}),tw=D.extend({tasks:ig(th)}),t$=d.extend({method:ij("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:S,BaseMetadataSchema:_,ImplementationSchema:w,ClientTasksCapabilitySchema:P,ServerTasksCapabilitySchema:R,ClientCapabilitiesSchema:k,InitializeRequestParamsSchema:T,InitializeRequestSchema:O,ServerCapabilitiesSchema:x,InitializeResultSchema:C,InitializedNotificationSchema:j,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:eS,PromptListChangedNotificationSchema:e_,ToolAnnotationsSchema:ew,ToolExecutionSchema:e$,ToolSchema:eE,ListToolsRequestSchema:eP,ListToolsResultSchema:eR,CallToolResultSchema:ek,CallToolRequestParamsSchema:eT,CallToolRequestSchema:eO,ToolListChangedNotificationSchema:ex,LoggingLevelSchema:eC,SetLevelRequestParamsSchema:ej,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:tS,ListTasksRequestSchema:t_,ListTasksResultSchema:tw,CancelTaskRequestSchema:t$,CancelTaskResultSchema:f.merge(th),ClientRequestSchema:iw([A,O,ti,eA,ed,el,B,Z,Q,er,ea,eO,eP,tg,tb,t_,t$]),ClientNotificationSchema:iw([v,M,j,tu,ty]),ClientResultSchema:iw([y,eF,eJ,tt,tc,tv,tw,tf]),ServerRequestSchema:iw([A,eK,e8,tl,tg,tb,t_,t$]),ServerNotificationSchema:iw([v,M,eN,ei,et,ex,e_,ty,te]),ServerResultSchema:iw([y,C,tn,eS,ec,G,X,ee,ek,eR,tv,tw,tf]),CallToolResultWireSchema:ih().superRefine((t,r)=>{if(!("object"!=typeof t||null===t||Array.isArray(t))&&void 0===t.content){for(let a of dT)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(dO).pipe(ek)})}function dC(t){return"object"!==t.type}let dj=new Set(["const","enum","default","examples"]),dA=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function dI(t){return void 0!==t&&!("string"==typeof t&&t.startsWith("#"))}let dN={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},dM={"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},dq={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 dz(){if(l)return l;let t=dx();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 dD(t){return Object.prototype.hasOwnProperty.call(dN,t)}function dL(t){return Object.prototype.hasOwnProperty.call(dM,t)}function dU(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function dH(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(dN),Object.keys(dM);let dV={ok:!1,reason:"not-in-era"};function dK(t){return dU(t)&&dU(t.outputSchema)&&dC(t.outputSchema)}let dF={era:"2025-11-25",hasRequestMethod:dD,hasNotificationMethod:dL,validateRequest:(t,r)=>dH(dD(t)?dz().requestSchemas[t]:void 0,r),validateResult:(t,r)=>dH(Object.prototype.hasOwnProperty.call(dq,t)?dz().resultSchemas[t]:void 0,r),validateNotification:(t,r)=>dH(dL(t)?dz().notificationSchemas[t]:void 0,r),hasInputRequestMethod:()=>!1,validateInputRequest:()=>dV,validateInputResponse:()=>dV,samplingResultVariant:(t,r)=>{let a=dx();return dH(t?a.CreateMessageResultWithToolsSchema:a.CreateMessageResultSchema,r)},outboundEnvelope:t=>void 0,validateEnvelopeMeta:t=>[],projectCallToolResult(t,r){let a=dk(t),o=a.structuredContent;if(void 0===o)return a;let i="object"!=typeof o||null===o||Array.isArray(o),n=void 0!==r&&dC(r);return i||n?{...a,structuredContent:{result:o}}:a},decodeResult(t,r){if(dU(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=>dK(t))?{...r,tools:a.map(t=>dK(t)?{...t,outputSchema:function(t){var r;let a="string"==typeof t.$schema?t.$schema:void 0;if(dI(t.$id))return{...void 0!==a&&{$schema:a},type:"object",properties:{result:t},required:["result"]};let o="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&&dI(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:dj.has(s)?a[s]=l:dA.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 dJ(){return c??=function(){let t=iG(()=>iw([oU(),ia(),il(),iu(),iT(oU(),t),ig(t)])),r=iT(oU(),t),a=iw([oU(),ia().int()]),o=oU(),i=iw([oU(),ia().int()]),n=ix(["user","assistant"]),s=ix(["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=ib({ttl:ia().optional()}),u=ib({taskId:oU()}),d=iS({progressToken:a.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:oU(),params:f.loose().optional()}),y=ib({src:oU(),mimeType:oU().optional(),sizes:ig(oU()).optional(),theme:ix(["light","dark"]).optional()}),g=ib({icons:ig(y).optional()}),v=ib({name:oU(),title:oU().optional()}),b=v.extend({...v.shape,...g.shape,version:oU(),websiteUrl:oU().optional(),description:oU().optional()}),S=iR(ib({applyDefaults:il().optional()}),r),_=iX(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,iR(ib({form:S.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=ib({experimental:iT(oU(),r).optional(),sampling:ib({context:r.optional(),tools:r.optional()}).optional(),elicitation:_.optional(),roots:ib({listChanged:il().optional()}).optional(),tasks:w.optional(),extensions:iT(oU(),r).optional()}),P=ib({experimental:iT(oU(),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:$.optional(),extensions:iT(oU(),r).optional()}),R=ib({progress:ia(),total:iM(ia()),message:iM(oU())}),k=ib({...f.shape,...R.shape,progressToken:a}),T=m.extend({method:ij("notifications/progress"),params:k}),O=f.extend({level:s,logger:oU().optional(),data:ih()}),x=m.extend({method:ij("notifications/message"),params:O}),C=ib({uri:oU(),mimeType:iM(oU()),_meta:iT(oU(),ih()).optional()}),j=C.extend({text:oU()}),A=C.extend({blob:l}),I=ib({audience:ig(n).optional(),priority:ia().min(0).max(1).optional(),lastModified:aa(oV,{offset:!0}).optional()}),N=ib({...v.shape,...g.shape,uri:oU(),description:iM(oU()),mimeType:iM(oU()),size:iM(ia()),annotations:I.optional(),_meta:iM(iS({}))}),M=ib({...v.shape,...g.shape,uriTemplate:oU(),description:iM(oU()),mimeType:iM(oU()),annotations:I.optional(),_meta:iM(iS({}))}),q=m.extend({method:ij("notifications/resources/list_changed"),params:f.optional()}),z=f.extend({uri:oU()}),D=m.extend({method:ij("notifications/resources/updated"),params:z}),L=ib({name:oU(),description:iM(oU()),required:iM(il())}),U=ib({...v.shape,...g.shape,description:iM(oU()),arguments:iM(ig(L)),_meta:iM(iS({}))}),H=m.extend({method:ij("notifications/prompts/list_changed"),params:f.optional()}),V=ib({type:ij("text"),text:oU(),annotations:I.optional(),_meta:iT(oU(),ih()).optional()}),K=ib({type:ij("image"),data:l,mimeType:oU(),annotations:I.optional(),_meta:iT(oU(),ih()).optional()}),F=ib({type:ij("audio"),data:l,mimeType:oU(),annotations:I.optional(),_meta:iT(oU(),ih()).optional()}),J=ib({type:ij("tool_use"),name:oU(),id:oU(),input:iT(oU(),ih()),_meta:iT(oU(),ih()).optional()}),W=ib({type:ij("resource"),resource:iw([j,A]),annotations:I.optional(),_meta:iT(oU(),ih()).optional()}),B=N.extend({type:ij("resource_link")}),G=iw([V,K,F,B,W]),Z=ib({role:n,content:G}),X=ib({title:oU().optional(),readOnlyHint:il().optional(),destructiveHint:il().optional(),idempotentHint:il().optional(),openWorldHint:il().optional()}),Y=m.extend({method:ij("notifications/tools/list_changed"),params:f.optional()}),Q=ib({name:oU().optional()}),ee=ib({hints:ig(Q).optional(),costPriority:ia().min(0).max(1).optional(),speedPriority:ia().min(0).max(1).optional(),intelligencePriority:ia().min(0).max(1).optional()}),et=ib({mode:ix(["auto","required","none"]).optional()}),er=ib({type:ij("boolean"),title:oU().optional(),description:oU().optional(),default:il().optional()}),ea=ib({type:ij("string"),title:oU().optional(),description:oU().optional(),minLength:ia().optional(),maxLength:ia().optional(),format:ix(["email","uri","date","date-time"]).optional(),default:oU().optional()}),eo=ib({type:ix(["number","integer"]),title:oU().optional(),description:oU().optional(),minimum:ia().optional(),maximum:ia().optional(),default:ia().optional()}),ei=ib({type:ij("string"),title:oU().optional(),description:oU().optional(),enum:ig(oU()),default:oU().optional()}),en=ib({type:ij("string"),title:oU().optional(),description:oU().optional(),oneOf:ig(ib({const:oU(),title:oU()})),default:oU().optional()}),es=ib({type:ij("string"),title:oU().optional(),description:oU().optional(),enum:ig(oU()),enumNames:ig(oU()).optional(),default:oU().optional()}),el=iw([ei,en]),ec=ib({type:ij("array"),title:oU().optional(),description:oU().optional(),minItems:ia().optional(),maxItems:ia().optional(),items:ib({type:ij("string"),enum:ig(oU())}),default:ig(oU()).optional()}),eu=ib({type:ij("array"),title:oU().optional(),description:oU().optional(),minItems:ia().optional(),maxItems:ia().optional(),items:ib({anyOf:ig(ib({const:oU(),title:oU()}))}),default:ig(oU()).optional()}),ed=iw([ec,eu]),ep=iw([es,el,ed]),eh=iw([ep,er,ea,eo]),ef=h.extend({mode:ij("form").optional(),message:oU(),requestedSchema:ib({type:ij("object"),properties:iT(oU(),eh),required:ig(oU()).optional()}).catchall(ih())}),em=ib({type:ij("ref/resource"),uri:oU()}),ey=ib({type:ij("ref/prompt"),name:oU()}),eg=ib({uri:oU().startsWith("file://"),name:oU().optional(),_meta:iT(oU(),ih()).optional()}),ev=E.shape,eb=ib({experimental:ev.experimental,sampling:ev.sampling,elicitation:ev.elicitation,roots:ev.roots,extensions:ev.extensions}),eS=P.shape,e_=ib({experimental:eS.experimental,logging:eS.logging,completions:eS.completions,prompts:eS.prompts,resources:eS.resources,tools:eS.tools,extensions:eS.extensions}),ew=iS({progressToken:a.optional(),[i0]:oU(),[i1]:b.optional(),[i9]:eb,[i5]:s.optional()}),e$=ib({...v.shape,...g.shape,description:oU().optional(),inputSchema:iS({$schema:oU().optional(),type:ij("object")}),outputSchema:iS({$schema:oU().optional()}).optional(),annotations:X.optional(),_meta:iT(oU(),ih()).optional()}),eE=ib({type:ij("tool_result"),toolUseId:oU(),content:ig(G),structuredContent:ih().optional(),isError:il().optional(),_meta:iT(oU(),ih()).optional()}),eP=iw([V,K,F,J,eE]),eR=ib({role:n,content:iw([eP,ig(eP)]),_meta:iT(oU(),ih()).optional()}),ek=oU(),eT=iS({[i2]:b.optional().catch(void 0)}),eO=eT.optional();function ex(t){return iS({_meta:eO,resultType:ek.default("complete"),...t})}let eC=ex({}),ej=ex({nextCursor:o.optional()}),eA=ex({content:ig(G),structuredContent:ih().optional(),isError:il().optional()}),eI=ex({ttlMs:ia().int().min(0),cacheScope:ix(["public","private"]),tools:ig(e$),nextCursor:o.optional()}),eN=ex({ttlMs:ia().int().min(0),cacheScope:ix(["public","private"]),prompts:ig(U),nextCursor:o.optional()}),eM=ex({description:oU().optional(),messages:ig(Z)}),eq=ex({ttlMs:ia().int().min(0),cacheScope:ix(["public","private"]),resources:ig(N),nextCursor:o.optional()}),ez=ex({ttlMs:ia().int().min(0),cacheScope:ix(["public","private"]),resourceTemplates:ig(M),nextCursor:o.optional()}),eD=ex({ttlMs:ia().int().min(0),cacheScope:ix(["public","private"]),contents:ig(iw([j,A]))}),eL=ex({completion:ib({values:ig(oU()).max(100),total:ia().int().optional(),hasMore:il().optional()}).loose()}),eU=ex({ttlMs:ia().int().min(0),cacheScope:ix(["public","private"])}),eH=ex({ttlMs:ia().int().min(0).catch(0),cacheScope:ix(["public","private"]).catch("private"),supportedVersions:ig(oU()),capabilities:e_,instructions:oU().optional()}),eV=ib({messages:ig(eR),modelPreferences:ee.optional(),systemPrompt:oU().optional(),includeContext:ix(["none","thisServer","allServers"]).optional(),temperature:ia().optional(),maxTokens:ia().int(),stopSequences:ig(oU()).optional(),metadata:r.optional(),tools:ig(e$).optional(),toolChoice:et.optional()}),eK=ib({method:ij("sampling/createMessage"),params:eV}),eF=ib({method:ij("roots/list"),params:ib({_meta:iT(oU(),ih()).optional()}).optional()}),eJ=ib({...eR.shape,model:oU(),stopReason:oU().optional()}),eW=ib({roots:ig(eg)}),eB=ib({action:ix(["accept","decline","cancel"]),content:iT(oU(),iw([oU(),ia(),il(),ig(oU())])).optional()}),eG=ib({mode:ij("url"),message:oU(),url:oU().url()}),eZ=iw([ef,eG]),eX=ib({method:ij("elicitation/create"),params:eZ}),eY=iw([eK,eF,eX]),eQ=iw([eJ,eW,eB]),e0=iT(oU(),eY),e1=iT(oU(),eQ),e2=ex({inputRequests:e0.optional(),requestState:oU().optional()}),e9={inputResponses:e1.optional(),requestState:oU().optional()},e4=ib({_meta:ew,...e9}),e5=iS({progressToken:a.optional()});function e6(t,r){return ib({method:ij(t),params:ib({_meta:ew,...r})})}function e3(t,r){return ib({method:ij(t),params:ib({_meta:e5.optional(),...r}).optional()})}let e8={name:oU(),arguments:iT(oU(),ih()).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:iw([ey,em]),argument:ib({name:oU(),value:oU()}),context:ib({arguments:iT(oU(),oU()).optional()}).optional()},tl=e6("completion/complete",ts),tc=e6("server/discover",{}),tu=ib({toolsListChanged:il().optional(),promptsListChanged:il().optional(),resourcesListChanged:il().optional(),resourceSubscriptions:ig(oU()).optional()}),td={notifications:tu},tp=e6("subscriptions/listen",td),th=eT.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:eO,...t})}let tg={"tools/call":ty({content:ig(G),structuredContent:ih().optional(),isError:il().optional()}),"tools/list":ty({ttlMs:ia().int().min(0),cacheScope:ix(["public","private"]),tools:ig(e$),nextCursor:o.optional()}),"prompts/get":ty({description:oU().optional(),messages:ig(Z)}),"prompts/list":ty({ttlMs:ia().int().min(0),cacheScope:ix(["public","private"]),prompts:ig(U),nextCursor:o.optional()}),"resources/list":ty({ttlMs:ia().int().min(0),cacheScope:ix(["public","private"]),resources:ig(N),nextCursor:o.optional()}),"resources/templates/list":ty({ttlMs:ia().int().min(0),cacheScope:ix(["public","private"]),resourceTemplates:ig(M),nextCursor:o.optional()}),"resources/read":ty({ttlMs:ia().int().min(0),cacheScope:ix(["public","private"]),contents:ig(iw([j,A]))}),"completion/complete":ty({completion:ib({values:ig(oU()).max(100),total:ia().int().optional(),hasMore:il().optional()}).loose()}),"server/discover":ty({ttlMs:ia().int().min(0).catch(0),cacheScope:ix(["public","private"]).catch("private"),supportedVersions:ig(oU()),capabilities:e_,instructions:oU().optional()}),"subscriptions/listen":ty({})},tv=iS({"io.modelcontextprotocol/subscriptionId":i.optional()}),tb=ib({method:ij("notifications/subscriptions/acknowledged"),params:ib({_meta:tv.optional(),notifications:tu})}),tS=ib({_meta:tv.optional(),requestId:i,reason:oU().optional()}),t_=ib({method:ij("notifications/cancelled"),params:tS}),tw=t=>ib({jsonrpc:ij("2.0"),id:iw([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:T,LoggingMessageNotificationParamsSchema:O,LoggingMessageNotificationSchema:x,ResourceContentsSchema:C,TextResourceContentsSchema:j,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:e_,RequestMetaEnvelopeSchema:ew,ToolSchema:e$,ToolResultContentSchema:eE,SamplingMessageContentBlockSchema:eP,SamplingMessageSchema:eR,ResultTypeSchema:ek,ResultMetaSchema:eT,ResultSchema:eC,PaginatedResultSchema:ej,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:tS,CancelledNotificationSchema:t_,notificationSchemas2026:{"notifications/cancelled":t_,"notifications/progress":T,"notifications/message":x,"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(eC),CallToolResultResponseSchema:tw(iw([eA,e2])),ListToolsResultResponseSchema:tw(eI),ListPromptsResultResponseSchema:tw(eN),GetPromptResultResponseSchema:tw(iw([eM,e2])),ListResourcesResultResponseSchema:tw(eq),ListResourceTemplatesResultResponseSchema:tw(ez),ReadResourceResultResponseSchema:tw(iw([eD,e2])),CompleteResultResponseSchema:tw(eL),DiscoverResultResponseSchema:tw(eH),SubscriptionsListenResultResponseSchema:tw(tf)}}()}let dW=["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 dX=((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 dY=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,a){super(r),this.code=t,this.data=a,this.name="ProtocolError",dm(this,new.target)}static fromError(r,a,o){return r===dX.UrlElicitationRequired&&o&&o.elicitations?new d0(o.elicitations,a):r===dX.UnsupportedProtocolVersion&&o&&Array.isArray(o.supported)&&"string"==typeof o.requested?new d1({supported:o.supported,requested:o.requested},a):(r===dX.InvalidParams||r===dX.ResourceNotFound)&&"string"==typeof o?.uri&&(r===dX.ResourceNotFound||1===Object.keys(o).length)?new dQ(o.uri,a):r===dX.MissingRequiredClientCapability&&o&&null!==o.requiredCapabilities&&"object"==typeof o.requiredCapabilities&&!Array.isArray(o.requiredCapabilities)?new d2({requiredCapabilities:o.requiredCapabilities},a):new t(r,a,o)}},dQ=class extends dY{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(t,r=`Resource not found: ${t}`){super(dX.InvalidParams,r,{uri:t})}get uri(){return this.data.uri}},d0=class extends dY{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(dX.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}},d1=class extends dY{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(t,r=`Unsupported protocol version: ${t.requested}`){super(dX.UnsupportedProtocolVersion,r,t)}get supported(){return this.data.supported}get requested(){return this.data.requested}},d2=class extends dY{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(t,r=`Missing required client capabilities: ${Object.keys(t.requiredCapabilities).join(", ")}`){super(dX.MissingRequiredClientCapability,r,t)}get requiredCapabilities(){return this.data.requiredCapabilities}};let d9=["tools/call","prompts/get","resources/read"],d4=["elicitation/create","sampling/createMessage","roots/list"];function d5(){if(u)return u;let t=dJ();return u={request:{"elicitation/create":ib({method:ij("elicitation/create"),params:t.ElicitRequestParamsSchema}),"sampling/createMessage":ib({method:ij("sampling/createMessage"),params:t.CreateMessageRequestParamsSchema}),"roots/list":ib({method:ij("roots/list"),params:iS({}).optional()})},response:{"elicitation/create":t.ElicitResultSchema,"sampling/createMessage":t.CreateMessageResultSchema,"roots/list":t.ListRootsResultSchema}}}function d6(t){return d4.includes(t)}function d3(t){return d6(t)?d5().request[t]:void 0}let d8={"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},d7={"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 pe(t){return Object.prototype.hasOwnProperty.call(d8,t)}function pt(t){return Object.prototype.hasOwnProperty.call(d7,t)}function pr(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function pa(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(d8),Object.keys(d7);let po={ok:!1,reason:"not-in-era"},pi=[i0,i9],pn={era:"2026-07-28",hasRequestMethod:pe,hasNotificationMethod:pt,hasInputRequestMethod:t=>void 0!==d3(t),validateRequest:(t,r)=>pa(pe(t)?dJ().dispatchRequestSchemas[t]:void 0,r),validateResult:(t,r)=>pa(Object.prototype.hasOwnProperty.call(d8,t)?dJ().dispatchResultSchemas[t]:void 0,r),validateNotification:(t,r)=>pa(pt(t)?dJ().notificationSchemas2026[t]:void 0,r),validateInputRequest:(t,r)=>pa(d3(t),r),validateInputResponse:(t,r)=>pa(d6(t)?d5().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 a of pi)a in t||r.push({key:a,problem:"missing"});let a=dJ().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=>dk(t),inputRequestSchema:d3,decodeResult(t,r){if(!pr(r))return{kind:"invalid",error:new dS(db.InvalidResult,`Invalid result for ${t}: not an object`,{method:t})};let a=r.resultType;if(void 0===a)return{kind:"invalid",error:new dS(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 a)return{kind:"invalid",error:new dS(db.InvalidResult,`Invalid result for ${t}: non-string resultType`,{method:t,resultType:a})};if("input_required"===a){let a=r.inputRequests,o=pr(a)?a:{},i=r.requestState,n=void 0===r._meta?void 0:dJ().ResultMetaSchema.safeParse(r._meta),s=n?.success?n.data:void 0;return 0===Object.keys(o).length&&"string"!=typeof i?{kind:"invalid",error:new dS(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:o,..."string"==typeof i&&{requestState:i},...void 0!==s&&{_meta:s}}}if("complete"!==a)return{kind:"invalid",error:new dS(db.UnsupportedResultType,`Unsupported result type '${a}' for ${t}`,{resultType:a,method:t})};let o=function(){if(d)return d;let t=dJ();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 dS(db.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:{[i2]:r}}:null===a||"object"!=typeof a||Array.isArray(a)||void 0!==a[i2]?t:{...t,_meta:{...a,[i2]:r}}})(function(t,r){var a,o;let i=r[dB];if("complete"!==r.resultType||!dW.includes(t)){let t;return void 0===i?r:(t={...r},delete t[dB],t)}let n=dG(r.ttlMs)?r.ttlMs:void 0!==(a=i)&&dG(a.ttlMs)?a.ttlMs:0,s=dZ(r.cacheScope)?r.cacheScope:void 0!==(o=i)&&dZ(o.cacheScope)?o.cacheScope:"private",l={...r,ttlMs:n,cacheScope:s};return delete l[dB],l}(t,function(t,r){let a=r.resultType;if(void 0===a)return{...r,resultType:"complete"};if("complete"===a||d9.includes(t))return r;throw new dY(dX.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=>pr(t)&&"execution"in t)&&(i().tools=n.map(t=>{if(!pr(t)||!("execution"in t))return t;let r={...t};return delete r.execution,r}));let s=r.capabilities;if(pr(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=dJ().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 pl(t){return void 0!==t&&t>=d$?pn:dF}function pc(t){return void 0!==t.revision?pl(t.revision).era:"modern"===t.era?pn.era:dF.era}function pu(t){return ph.some(r=>r.hasRequestMethod(t))}function pd(t){return ph.some(r=>r.hasNotificationMethod(t))}function pp(t){return"tasks/get"===t||"tasks/cancel"===t}let ph=[dF,pn];var pf=((t,r)=>{let a={};for(var o in t)dr(a,o,{get:t[o],enumerable:!0});return r&&dr(a,Symbol.toStringTag,{value:"Module"}),a})({AnnotationsSchema:()=>nG,AudioContentSchema:()=>sm,BaseMetadataSchema:()=>n$,BaseRequestParamsSchema:()=>no,BlobResourceContentsSchema:()=>nW,BooleanSchemaSchema:()=>sZ,CallToolRequestParamsSchema:()=>sx,CallToolRequestSchema:()=>sC,CallToolResultSchema:()=>sT,CancelTaskRequestSchema:()=>lR,CancelTaskResultSchema:()=>lk,CancelledNotificationParamsSchema:()=>nb,CancelledNotificationSchema:()=>nS,ClientCapabilitiesSchema:()=>nO,ClientNotificationSchema:()=>lO,ClientRequestSchema:()=>lT,ClientResultSchema:()=>lx,ClientTasksCapabilitySchema:()=>nk,CompatibilityCallToolResultSchema:()=>sO,CompleteRequestParamsSchema:()=>ls,CompleteRequestSchema:()=>ll,CompleteResultSchema:()=>lc,ContentBlockSchema:()=>sb,CreateMessageRequestParamsSchema:()=>sJ,CreateMessageRequestSchema:()=>sW,CreateMessageResultSchema:()=>sB,CreateMessageResultWithToolsSchema:()=>sG,CreateTaskResultSchema:()=>lg,CursorSchema:()=>ne,DiscoverRequestSchema:()=>nN,DiscoverResultSchema:()=>nM,ElicitRequestFormParamsSchema:()=>s8,ElicitRequestParamsSchema:()=>le,ElicitRequestSchema:()=>lt,ElicitRequestURLParamsSchema:()=>s7,ElicitResultSchema:()=>lo,ElicitationCompleteNotificationParamsSchema:()=>lr,ElicitationCompleteNotificationSchema:()=>la,EmbeddedResourceSchema:()=>sg,EmptyResultSchema:()=>nv,EnumSchemaSchema:()=>s6,GetPromptRequestParamsSchema:()=>sd,GetPromptRequestSchema:()=>sp,GetPromptResultSchema:()=>s_,GetTaskPayloadRequestSchema:()=>lw,GetTaskPayloadResultSchema:()=>l$,GetTaskRequestSchema:()=>lS,GetTaskResultSchema:()=>l_,IconSchema:()=>n_,IconsSchema:()=>nw,ImageContentSchema:()=>sf,ImplementationSchema:()=>nE,InitializeRequestParamsSchema:()=>nx,InitializeRequestSchema:()=>nC,InitializeResultSchema:()=>nA,InitializedNotificationSchema:()=>nI,JSONArraySchema:()=>i8,JSONObjectSchema:()=>i3,JSONRPCErrorResponseSchema:()=>nm,JSONRPCMessageSchema:()=>ny,JSONRPCNotificationSchema:()=>nh,JSONRPCRequestSchema:()=>np,JSONRPCResponseSchema:()=>ng,JSONRPCResultResponseSchema:()=>nf,JSONValueSchema:()=>i6,LegacyTitledEnumSchemaSchema:()=>s1,ListChangedOptionsBaseSchema:()=>sA,ListPromptsRequestSchema:()=>sc,ListPromptsResultSchema:()=>su,ListResourceTemplatesRequestSchema:()=>n0,ListResourceTemplatesResultSchema:()=>n1,ListResourcesRequestSchema:()=>nY,ListResourcesResultSchema:()=>nQ,ListRootsRequestSchema:()=>ld,ListRootsResultSchema:()=>lp,ListTasksRequestSchema:()=>lE,ListTasksResultSchema:()=>lP,ListToolsRequestSchema:()=>sR,ListToolsResultSchema:()=>sk,LoggingLevelSchema:()=>sI,LoggingMessageNotificationParamsSchema:()=>sq,LoggingMessageNotificationSchema:()=>sz,ModelHintSchema:()=>sD,ModelPreferencesSchema:()=>sL,MultiSelectEnumSchemaSchema:()=>s5,NotificationSchema:()=>nl,NotificationsParamsSchema:()=>ns,NumberSchemaSchema:()=>sY,PaginatedRequestParamsSchema:()=>nU,PaginatedRequestSchema:()=>nH,PaginatedResultSchema:()=>nV,PingRequestSchema:()=>nq,PrimitiveSchemaDefinitionSchema:()=>s3,ProgressNotificationParamsSchema:()=>nD,ProgressNotificationSchema:()=>nL,ProgressSchema:()=>nz,ProgressTokenSchema:()=>i7,PromptArgumentSchema:()=>ss,PromptListChangedNotificationSchema:()=>sw,PromptMessageSchema:()=>sS,PromptReferenceSchema:()=>ln,PromptSchema:()=>sl,ReadResourceRequestParamsSchema:()=>n2,ReadResourceRequestSchema:()=>n9,ReadResourceResultSchema:()=>n4,RelatedTaskMetadataSchema:()=>nr,RequestIdSchema:()=>nd,RequestMetaSchema:()=>na,RequestSchema:()=>nn,ResourceContentsSchema:()=>nK,ResourceLinkSchema:()=>sv,ResourceListChangedNotificationSchema:()=>n5,ResourceRequestParamsSchema:()=>n2,ResourceSchema:()=>nZ,ResourceTemplateReferenceSchema:()=>li,ResourceTemplateSchema:()=>nX,ResourceUpdatedNotificationParamsSchema:()=>si,ResourceUpdatedNotificationSchema:()=>sn,ResultMetaObjectSchema:()=>nc,ResultSchema:()=>nu,RoleSchema:()=>nB,RootSchema:()=>lu,RootsListChangedNotificationSchema:()=>lh,SamplingContentSchema:()=>sV,SamplingMessageContentBlockSchema:()=>sK,SamplingMessageSchema:()=>sF,ServerCapabilitiesSchema:()=>nj,ServerNotificationSchema:()=>lj,ServerRequestSchema:()=>lC,ServerResultSchema:()=>lA,ServerTasksCapabilitySchema:()=>nT,SetLevelRequestParamsSchema:()=>sN,SetLevelRequestSchema:()=>sM,SingleSelectEnumSchemaSchema:()=>s2,StringSchemaSchema:()=>sX,SubscribeRequestParamsSchema:()=>n2,SubscribeRequestSchema:()=>n6,SubscriptionFilterSchema:()=>n8,SubscriptionsAcknowledgedNotificationParamsSchema:()=>st,SubscriptionsAcknowledgedNotificationSchema:()=>sr,SubscriptionsListenRequestParamsSchema:()=>n7,SubscriptionsListenRequestSchema:()=>se,SubscriptionsListenResultMetaSchema:()=>sa,SubscriptionsListenResultSchema:()=>so,TaskAugmentedRequestParamsSchema:()=>ni,TaskCreationParamsSchema:()=>lf,TaskMetadataSchema:()=>nt,TaskSchema:()=>ly,TaskStatusNotificationParamsSchema:()=>lv,TaskStatusNotificationSchema:()=>lb,TaskStatusSchema:()=>lm,TextContentSchema:()=>sh,TextResourceContentsSchema:()=>nF,TitledMultiSelectEnumSchemaSchema:()=>s4,TitledSingleSelectEnumSchemaSchema:()=>s0,ToolAnnotationsSchema:()=>s$,ToolChoiceSchema:()=>sU,ToolExecutionSchema:()=>sE,ToolListChangedNotificationSchema:()=>sj,ToolResultContentSchema:()=>sH,ToolSchema:()=>sP,ToolUseContentSchema:()=>sy,UnsubscribeRequestParamsSchema:()=>n2,UnsubscribeRequestSchema:()=>n3,UntitledMultiSelectEnumSchemaSchema:()=>s9,UntitledSingleSelectEnumSchemaSchema:()=>sQ});let pm=t=>nf.safeParse(t).success,py=t=>nm.safeParse(t).success,pg=t=>"object"==typeof t&&null!==t&&!Array.isArray(t)&&"input_required"===t.resultType,pv="x-mcp-header",pb=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,pS=new Set(["string","integer","boolean","number"]);function p_(t){let r=[],a=new Map,o=(t,i,n)=>{if(null===t||"object"!=typeof t)return;if(pv in t){if(!n||0===i.length)return`${pE(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[pv];if("string"!=typeof o||0===o.length)return`${pE(i)}: x-mcp-header MUST be a non-empty string`;if(!pb.test(o))return`${pE(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||!pS.has(s))return`${pE(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 pw){let a=t[r];if(void 0!==a)for(let t of Array.isArray(a)?a:null!==a&&"object"==typeof a&&p$.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 pw=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],p$=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function pE(t){return 0===t.length?"<root>":t.join(".")}let pP="=?base64?";function pR(t){return!function(t){if(0===t.length||t.startsWith(pP)&&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:`${pP}${function(t){let r=new TextEncoder().encode(t),a="";for(let t of r)a+=String.fromCodePoint(t);return btoa(a)}(t)}?=`}dX.InvalidRequest,dX.UnsupportedProtocolVersion,dX.InvalidParams,dX.MethodNotFound,dX.InvalidParams,dX.MissingRequiredClientCapability,dX.ParseError,dX.InvalidRequest,dX.MethodNotFound,dX.UnsupportedProtocolVersion,dX.MissingRequiredClientCapability;let pk={"tools/call":"name","prompts/get":"name","resources/read":"uri","tasks/get":"taskId","tasks/update":"taskId","tasks/cancel":"taskId"};function pT(t){return new Set(t.flatMap(t=>Object.keys(t.shape)))}function pO(t){if(null==t)return!1;let r=typeof t;return("object"===r||"function"===r)&&"~standard"in t&&"function"==typeof t["~standard"]?.validate}let px=!1,pC="draft-2020-12";async function pj(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 pA=/\\\.\\d\{(\d+)\}/;function pI(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}let pN=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function pM(t){return pN.has(t)||t.startsWith("x-")}let pq=new Set(["$schema",...Object.keys(s8.shape.requestedSchema.shape)]),pz={string:pT([sX,sQ,s0,s1]),number:pT([sY]),integer:pT([sY]),boolean:pT([sZ]),array:pT([s9,s4])},pD=new Set(sX.shape.format.unwrap().options);async function pL(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 dS(db.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 dS?r.reason:new dS(db.RequestTimeout,String(r.reason)));let o=setTimeout(()=>{r?.removeEventListener("abort",i),t()},250),i=()=>{clearTimeout(o),a(r?.reason instanceof dS?r.reason:new dS(db.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 dS(db.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(pg(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(!pO(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&&pI(n)?a[i]=Object.fromEntries(Object.entries(n).map(([t,a])=>[t,function(t,r,a,o){if(!pI(t))return t;let i="string"==typeof t.type&&Object.hasOwn(pz,t.type)?pz[t.type]:void 0;if(void 0===i)return t;let n={};for(let[l,c]of Object.entries(t))if(i.has(l)||pM(l))n[l]=c;else if("pattern"===l&&"string"===t.type&&"string"==typeof t.format)if(pD.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=pA.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=>aa(oV,{local:t,offset:r,precision:a}))))}return new Set(a.map(t=>{let r;return r=os(t,{target:pC,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)])):pq.has(i)?a[i]=n:pM(i)||o.push(i);if(o.length>0)throw new dY(dX.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:pC});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().");px||(px=!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:pC,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 dY(dX.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}(t.requestedSchema),a),i=(r=s8.shape.requestedSchema,ok(r,o));if(!i.success)throw new dY(dX.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${function(t,r){if(!pI(t.properties))return r;let a=Object.entries(t.properties).filter(([,t])=>!ok(s3,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}]`)):pI(r)&&pI(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):pM(r)?[]:[n]}):[]}(o,i.data);if(n.length>0)throw new dY(dX.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 dY(dX.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 dY?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 pU={},pH={};function pV(t,r){let a=t.slice(0,-6);pU[a]=r,pH[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"])pV(t,pf[t]);for(let[t,r]of Object.entries({IdJagTokenExchangeResponseSchema:lL,OAuthClientInformationFullSchema:lF,OAuthClientInformationSchema:lK,OAuthClientMetadataSchema:lV,OAuthClientRegistrationErrorSchema:lJ,OAuthErrorResponseSchema:lU,OAuthMetadataSchema:lM,OAuthProtectedResourceMetadataSchema:lN,OAuthTokenRevocationRequestSchema:lW,OAuthTokensSchema:lD,OpenIdProviderDiscoveryMetadataSchema:lz,OpenIdProviderMetadataSchema:lq}))pV(t,r);Object.freeze(pU);let pK=Object.freeze(pH),pF=[i0,i1,i9,i5],pJ=["inputResponses","requestState"];function pW(t,r){let a=t.params;if(!pX(a))return{message:t,lifted:{}};let o=a._meta,i=pX(o)?pF.filter(t=>t in o):[],n="request"===r?pJ.filter(t=>t in a):[];if(0===i.length&&0===n.length)return{message:t,lifted:{}};let s={},l={...a};if(i.length>0&&pX(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 pB(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 pG=(T=void 0,()=>T);var pZ=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??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 a=t.params??{};return{...t,params:{...a,_meta:{...r,...a._meta}}}}_resolveNonCompleteResult(t,r){return Promise.reject(new dS(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){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 dS(db.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),pm(t)||py(t))this._onresponse(t);else if(np.safeParse(t).success)this._onrequest(t,r);else nh.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 dS(db.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}=pW(t,"notification"),o=this._negotiatedWireCodec();if(r?.classification===void 0&&"drop"===this._shouldDropInbound(t))return;if(r?.classification!==void 0){let t=pc(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(pd(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}=pW(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=pc(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(dX.UnsupportedProtocolVersion,`Unsupported protocol version: ${a}`,{supported:this._supportedProtocolVersions,requested:a});return}}if(pu(o.method)&&!n.hasRequestMethod(o.method)&&!(pp(o.method)&&this._customSchemaRequestMethods.has(o.method)))return void l(dX.MethodNotFound,"Method not found");let c=this._requestHandlers.get(o.method)??this.fallbackRequestHandler;if(void 0===c)return void l(dX.MethodNotFound,"Method not found");let u=n.checkInboundEnvelope(i);if(void 0!==u)return void l(dX.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(!pY(t))return{accepted:r,droppedKeys:a};for(let[o,i]of Object.entries(t)){if(!pY(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?pG:(a=i.requestState,()=>a),signal:h.signal,send:(t,r,a)=>{let o=this._resolveOutboundCodec(t.method);if(this._assertOutboundRequestInEra(o,t.method),pO(r))return p(t,r,a);let i=pB(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(dX.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:dX.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(pm(t)?t:dY.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(pO(r))return pp(t.method)||this._assertOutboundRequestInEra(o,t.method),this._requestWithSchemaViaCodec(o,t,r,a);this._assertOutboundRequestInEra(o,t.method);let i=pB(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 pl(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 pl(void 0);case"server/discover":return pl(ps);default:return}}(t);if(r)return r}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(t,r){if(pu(r)&&!t.hasRequestMethod(r))throw new dS(db.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 dS?t:new dS(db.RequestTimeout,String(t))}let m=t.era===ps&&!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,S=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 dS?t:new dS(db.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)}))}pj(a,n.result).then(t=>{t.success?p(t.data):h(new dS(db.InvalidResult,`Invalid result for ${r.method}: ${t.error}`))},h)}}),i=()=>S(o?.signal?.reason),o?.signal?.addEventListener("abort",i,{once:!0});let _=o?.timeout??6e4;this._setupTimeout(y,_,o?.maxTotalTimeout,()=>S(new dS(db.RequestTimeout,"Request timed out",{timeout:_})),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 dS(db.NotConnected,"Not connected");if(pd(r.method)&&!t.hasNotificationMethod(r.method))throw new dS(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 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(!pu(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 dY(dX.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 pj(r.params,{...o.params});if(!n.success)throw new dY(dX.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(!pd(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 dY(dX.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 pj(r.params,{...o.params});if(!i.success)throw new dY(dX.InvalidParams,`Invalid params for notification ${t}: ${i.error}`);await a(i.data,o)})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}};function pX(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function pY(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function pQ(t){throw new dS(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 p0(t,r,a,o,i){var n;if(!pY(o)||"string"!=typeof o.method)throw new dS(db.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 dS(db.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 dS(db.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=pY(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:()=>pQ("send"),notify:()=>pQ("notify")}}))}var p1=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,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),p2=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,ny.parse(JSON.parse(t))}catch(t){if(t instanceof SyntaxError)continue;throw t}}return null}clear(){this._buffer=void 0}};function p9(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):{...t}:{}}let p4=new Set([301,302,303,307,308]);function p5(t,r){let a=p4.has(r.status)?r.headers?.get("location"):void 0;if(a)try{return new URL(a,t)}catch{return}}let p6=new WeakSet;function p3(t){return p6.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=p5(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 p8=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 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())}}),p7=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;let r=p8();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}),he=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=p8(),a=p7();var o=p8();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=p7();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=C(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=C(this.rhs,t,a),this}get names(){return x(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=C(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)=>O(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(j(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=C(this.condition,t,r),this}get names(){let t=super.names;return x(t,this.condition),this.else&&O(t,this.else.names),t}};v.kind="if";var b=class extends m{};b.kind="for";var S=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=C(this.iteration,t,r),this}get names(){return O(super.names,this.iteration.names)}},_=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 x(x(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=C(this.iterable,t,r),this}get names(){return O(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&&O(t,this.catch.names),this.finally&&O(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 T=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 S(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 _(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 O(t,r){for(let a in r)t[a]=(t[a]||0)+(r[a]||0);return t}function x(t,a){return a instanceof r._CodeOrName?O(t,a.names):t}function C(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 j(t){return"boolean"==typeof t||"number"==typeof t||null===t?!t:(0,r._)`!${M(t)}`}t.CodeGen=T,t.not=j;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)}}),ht=dl(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=he(),i=p8();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}),hr=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=he();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")}}),ha=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=he(),a=ht(),o=hr();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)}}),ho=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;let r=ha(),a=he(),o=hr(),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)}}),hi=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:{}}}}),hn=dl(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}),hs=dl(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=hi(),i=hn(),n=ha(),s=he(),l=ht();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
|| (${l} == "string" && ${i} && ${i} == +${i})`).assign(c,(0,s._)`+${i}`);return;case"integer":o.elseIf((0,s._)`${l} === "boolean" || ${i} === null
|| (${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"
|| ${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}),hl=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;let r=he(),a=ht();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))}}),hc=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=he(),a=ht(),o=hr(),i=ht();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))}}),hu=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;let r=he(),a=hr(),o=hc(),i=ha();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)}}}),hd=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;let r=he(),a=ht();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}}),hp=dl((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}}),hh=dl((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}}),hf=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;let r=ht(),a=hp(),o=hh(),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`)}}}),hm=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;let r=ho(),a=hs(),o=hn(),i=hs(),n=hl(),s=hu(),l=hd(),c=he(),u=hr(),d=hf(),p=ht(),h=ha();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 _(t,[],!1,r);let o=(0,a.getSchemaTypes)(t.schema);_(t,o,!(0,a.coerceAndCheckDataType)(t,o),r)}function S({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 _(t,r,a,n){var s,l,d,h;let{gen:f,schema:m,data:y,allErrors:g,opts:v,self:b}=t,{RULES:S}=b;if(m.$ref&&(v.ignoreKeywordsWithRef||!(0,p.schemaHasRulesButRef)(m,S)))return void f.block(()=>R(t,"$ref",S.all.$ref.definition));function _(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 S.rules)_(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&&S(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",O(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,s.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw Error(`${a} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:!1!==r.errors)&&(this.errsCount=t.gen.const("_errs",u.default.errors))}result(t,r,a){this.failResult((0,c.not)(t),r,a)}failResult(t,r,a){this.gen.if(t),a?a():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,c.not)(t),void 0,r)}fail(t){if(void 0===t){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,c._)`${r} !== undefined && (${(0,c.or)(this.invalid$data(),t)})`)}error(t,r,a){if(r){this.setParams(r),this._error(t,a),this.setParams({});return}this._error(t,a)}_error(t,r){(t?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&&S(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)*$/,T=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function O(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=T.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=O}),hy=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}}}),hg=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hf();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))}}}),hv=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;let r=he(),a=hy(),o=hr(),i=hf(),n=ht(),s=hm();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}}),hb=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}}),hS=dl((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}}),h_=dl((t,r)=>{let{isUUID:a}=hS(),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}}),hw=dl((t,r)=>{let{normalizeIPv6:a,removeDotSegments:o,recomposeAuthority:i,normalizeComponentEncoding:n,isIPv4:s,nonSimpleDomain:l}=hS(),{SCHEMES:c,getSchemeHandler:u}=h_();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}),h$=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hw();r.code='require("ajv/dist/runtime/uri").default',t.default=r}),hE=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=hm();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return r.KeywordCxt}});var a=he();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=hy(),i=hg(),n=hi(),s=hv(),l=he(),c=hf(),u=hs(),d=ht(),p=hb(),h=h$(),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,T;let O=t.strict,x=null==(r=t.code)?void 0:r.optimize,C=!0===x||void 0===x?1:x||0,j=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:O)||s,strictNumbers:null==(c=null!=(l=t.strictNumbers)?l:O)||c,strictTypes:null!=(d=null!=(u=t.strictTypes)?u:O)?d:"log",strictTuples:null!=(m=null!=(p=t.strictTuples)?p:O)?m:"log",strictRequired:null!=(g=null!=(y=t.strictRequired)?y:O)&&g,code:t.code?{...t.code,optimize:C,regExp:j}:{optimize:C,regExp:j},loopRequired:null!=(v=t.loopRequired)?v:200,loopEnum:null!=(b=t.loopEnum)?b:200,meta:null==(S=t.meta)||S,messages:null==(_=t.messages)||_,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==(T=t.int32range)||T,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)(),S.call(this,g,t,"NOT SUPPORTED"),S.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=_.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=_.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(T.call(this,a,r),!r)return(0,d.eachItem)(a,t=>O.call(this,t)),this;C.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=>O.call(this,t,o):t=>o.type.forEach(r=>O.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 S(t,r,a,o="error"){for(let i in t)i in r&&this.logger[o](`${a}: option ${i}. ${t[i]}`)}function _(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 T(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 O(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?x.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 x(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 C(t){let{metaSchema:r}=t;void 0!==r&&(t.$data&&this.opts.$data&&(r=A(r)),t.validateSchema=this.compile(r,!0))}let j={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function A(t){return{anyOf:[t,j]}}}),hP=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}}}),hR=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;let r=hg(),a=hc(),o=he(),i=hr(),n=hv(),s=ht();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:S}=y;if(("#"===h||"#/"===h)&&m===S.baseId){if(y===S)return c(t,g,y,y.$async);let r=p.scopeValue("root",{ref:S});return c(t,(0,o._)`${r}.validate`,S,S.$async)}let _=n.resolveRef.call(b,S,m,h);if(void 0===_)throw new r.default(f.opts.uriResolver,m,h);return _ instanceof n.SchemaEnv?void c(t,l(t,a=_),a,a.$async):(i=_,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)))}}}),hk=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hP(),a=hR();t.default=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",r.default,a.default]}),hT=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=he(),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})`)}}}),hO=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=he();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}))`)}}}),hx=dl(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'}),hC=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=he(),a=ht(),o=hx();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}`)}}}),hj=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hc(),a=ht(),o=he();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})`)}}}}),hA=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=he();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}`)}}}),hI=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hc(),a=he(),o=ht();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())})}}}}),hN=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=he();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}`)}}}),hM=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hp();r.code='require("ajv/dist/runtime/equal").default',t.default=r}),hq=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hs(),a=he(),o=ht(),i=hM();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)}}}),hz=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=he(),a=ht(),o=hM();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}`)}}}),hD=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=he(),a=ht(),o=hM();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)}}}),hL=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hT(),a=hO(),o=hC(),i=hj(),n=hA(),s=hI(),l=hN(),c=hq(),u=hz(),d=hD();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]}),hU=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;let r=he(),a=ht();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')}}}),hH=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;let r=he(),a=ht(),o=hc();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))}}}),hV=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hH();t.default={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,r.validateTuple)(t,"items")}}),hK=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=he(),a=ht(),o=hc(),i=hU();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)))}}}),hF=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=he(),a=ht();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())}}}),hJ=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;let r=he(),a=ht(),o=hc();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},
missingProperty: ${i},
depsCount: ${a},
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}),hW=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=he(),a=ht();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)}}}),hB=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hc(),a=he(),o=hr(),i=ht();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}`)}}}),hG=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hm(),a=hc(),o=ht(),i=hB();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)}}}}),hZ=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hc(),a=he(),o=ht(),i=ht();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())})})}}}}),hX=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ht();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"}}}),hY=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:hc().validateUnion,error:{message:"must match a schema in anyOf"}}}),hQ=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=he(),a=ht();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))}}}),h0=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ht();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)})}}}),h1=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=he(),a=ht();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))}}}),h2=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ht();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`)}}}),h9=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hU(),a=hV(),o=hH(),i=hK(),n=hF(),s=hJ(),l=hW(),c=hB(),u=hG(),d=hZ(),p=hX(),h=hY(),f=hQ(),m=h0(),y=h1(),g=h2();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}}),h4=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=he();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})`}())}())}}}),h5=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=[h4().default]}),h6=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"]}),h3=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hk(),a=hL(),o=h9(),i=h5(),n=h6();t.default=[r.default,a.default,(0,o.default)(),i.default,n.metadataVocabulary,n.contentVocabulary]}),h8=dl(t=>{var r,a;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,(a=r||(t.DiscrError=r={})).Tag="tag",a.Mapping="mapping"}),h7=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=he(),a=h8(),o=hv(),i=hg(),n=ht();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)}}}),fe=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}}),ft=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 a=hE(),o=h3(),i=h7(),n=fe(),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=hm();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=he();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=hy();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return p.default}});var h=hg();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return h.default}})}),fr=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicAnchor=void 0;let r=he(),a=hr(),o=hv(),i=hR();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)}}),fa=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicRef=void 0;let r=he(),a=hr(),o=hR();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)}}),fo=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=fr(),a=ht();t.default={keyword:"$recursiveAnchor",schemaType:"boolean",code(t){t.schema?(0,r.dynamicAnchor)(t,""):(0,a.checkStrictMode)(t.it,"$recursiveAnchor: false is ignored")}}}),fi=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=fa();t.default={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,r.dynamicRef)(t,t.schema)}}),fn=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=fr(),a=fa(),o=fo(),i=fi();t.default=[r.default,a.default,o.default,i.default]}),fs=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hJ();t.default={keyword:"dependentRequired",type:"object",schemaType:"object",error:r.error,code:t=>(0,r.validatePropertyDeps)(t)}}),fl=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hJ();t.default={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,r.validateSchemaDeps)(t)}}),fc=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ht();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`)}}}),fu=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=fs(),a=fl(),o=fc();t.default=[r.default,a.default,o.default]}),fd=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=he(),a=ht(),o=hr();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}`)}}}),fp=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=he(),a=ht();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}}}),fh=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=fd(),a=fp();t.default=[r.default,a.default]}),ff=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"}]}}}}}),fm=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:"#"}}}}}),fy=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:"#"}}}}),fg=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:{}}}}}),fv=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"}}}}),fb=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}}}}),fS=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:[]}}}}),f_=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ff(),a=fm(),o=fy(),i=fg(),n=fv(),s=fb(),l=fS(),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}}}),fw=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 a=hE(),o=h3(),i=fn(),n=fu(),s=fh(),l=h7(),c=f_(),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=hm();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return p.KeywordCxt}});var h=he();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=hy();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return f.default}});var m=hg();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return m.default}})}),f$=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=hk(),a=hL(),o=h9(),i=fn(),n=fu(),s=fh(),l=h5(),c=h6();t.default=[i.default,r.default,a.default,(0,o.default)(!0),l.default,c.metadataVocabulary,c.contentVocabulary,n.default,s.default]}),fE=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}}}}),fP=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"}}}}}),fR=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"}}}}),fk=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"}}}}),fT=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"}}}}),fO=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"}}}}),fx=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}}}}),fC=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:[]}}}}),fj=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=fE(),a=fP(),o=fR(),i=fk(),n=fT(),s=fO(),l=fx(),c=fC(),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}}}),fA=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 a=hE(),o=f$(),i=h7(),n=fj(),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=hm();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=he();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=hy();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.default}});var p=hg();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}),fI=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,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(_.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:S},double:{type:"number",validate:S},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 S(){return!0}let _=/[^\\]\\Z/}),fN=dl(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;let r=ft(),a=he(),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)}),fM=dl((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});let a=fI(),o=fN(),i=he(),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}),fq=ft(),fz=fw(),fD=fA();let fL=dc(fM(),1).default;function fU(t){let r=new t({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return fL(r),r}var fH=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(t){this._userAjv=void 0!==t,this._ajv=t}get ajv(){return this._ajv??=fU(fD.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(du.has(a))return"2020-12";if(dd.has(a))return"2019-09";if(dp.has(a)||dh.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??=fU(fz.Ajv2019):this._ajvDraft7??=fU(fq.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 fV(t){return(await p).getRandomValues(new Uint8Array(t))}async function fK(t){let r="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",a=256-256%r.length,o="";for(;o.length<t;)for(let i of(await fV(t-o.length)))i<a&&(o+=r[i%r.length]);return o}async function fF(t){return await fK(t)}async function fJ(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 fW(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let r=await fF(t),a=await fJ(r);return{code_verifier:r,code_challenge:a}}fq.Ajv,p=globalThis.crypto?.webcrypto??globalThis.crypto??Promise.resolve().then(n.t.bind(n,7598,19)).then(t=>t.webcrypto);class fB 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 fG(t){}function fZ(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 fX(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 fY 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=fG,onError:a=fG,onRetry:o=fG,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 fB(`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(`
`,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(`
`,a);continue}let i=t.charCodeAt(a);if(fZ(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(`
`,a);continue}d=0===p?n:`${d}
${n}`,p++}else fX(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(`
`,a)}return t.slice(a)}for(;a<t.length;){let r=t.indexOf("\r",a),o=t.indexOf(`
`,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(fZ(t,a,n)){let r=32===t.charCodeAt(a+5)?a+6:a+5,i=t.slice(r,o);d=0===p?i:`${d}
${i}`,p++;return}if(fX(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}
${r}`,p++;break;case"id":u=r.includes("\0")?void 0:r;break;case"retry":/^\d+$/.test(r)?o(parseInt(r,10)):a(new fB(`Invalid \`retry\` value: "${r}"`,{type:"invalid-retry",value:r,line:i}));break;default:a(new fB(`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(`
`)&&-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 fQ=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)}},f0=class extends fQ{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}},f1=class extends fQ{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}},f2=class extends fQ{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}},f9=class extends fQ{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}},f4=class extends fQ{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 f5(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}):f6(t.issuer,r)?t:void 0}function f6(t,r){return t===r||t.endsWith("/")&&t.slice(0,-1)===r||r.endsWith("/")&&r.slice(0,-1)===t}async function f3(t,r,a){let{resourceMetadataUrl:o,scope:i}=mp(r.response);if(await ml(t,{serverUrl:r.serverUrl,resourceMetadataUrl:o,scope:i,fetchFn:r.fetchFn,...a})!=="AUTHORIZED")throw new f8}var f8=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 f7(t){return t?.authorization_response_iss_parameter_supported===!0}function me({iss:t,expectedIssuer:r,issParameterSupported:a}){if(void 0!==r){if(void 0===t){if(a)throw new f0("authorization_response",r,void 0);return}if(t!==r)throw new f0("authorization_response",r,t)}}function mt(...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 mr(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 mb(o,i)).authorizationServerMetadata}catch{l=void 0}if(!l)throw new f8("Authorization callback failed and the issuer could not be verified");me({iss:n,expectedIssuer:l.issuer,issParameterSupported:f7(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 f8("Authorization callback contained neither `code` nor `error`")}let ma="code",mo="S256";function mi(t){return"localhost"===t||t.endsWith(".localhost")||"127.0.0.1"===t||"[::1]"===t||"::1"===t}async function mn(t){let r=t instanceof Response?t.status:void 0,a=t instanceof Response?await t.text():t;try{let t=lU.parse(JSON.parse(a));return dv.fromResponse(t)}catch(o){let t=`${r?`HTTP ${r}: `:""}Invalid OAuth error response: ${o}. Raw body: ${a}`;return new dv(dg.ServerError,t)}}function ms(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 ml(t,r){try{return await mc(t,r)}catch(a){if(a instanceof dv){if(a.code===dg.InvalidClient||a.code===dg.UnauthorizedClient)return ms(t,a,"client credentials and tokens"),await t.invalidateCredentials?.("client"),await t.invalidateCredentials?.("tokens"),await mc(t,r);else if(a.code===dg.InvalidGrant||a.code===dg.InvalidDpopProof)return ms(t,a,"tokens"),await t.invalidateCredentials?.("tokens"),await mc(t,r)}throw a}}async function mc(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||mi(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 mv(d,{fetchFn:s,skipIssuerValidation:l}),!u)try{u=await mf(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 mb(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 f9("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(!f6(r,v))throw new f9(r,v)}h&&await t.saveDiscoveryState?.(h);let S=await mu(r,t,u),_=S&&u&&!t.validateResourceURL?u.resource:S;_&&await t.saveResourceUrl?.(mS(_));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=f5($,v,{canPersistStamp:void 0!==t.saveClientInformation});if(void 0===E&&$?.issuer&&void 0===t.saveClientInformation)throw new f9($.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 dv(dg.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 mP(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&&me({iss:o,expectedIssuer:p?.issuer,issParameterSupported:f7(p)});let r=await mE(t,d,{metadata:p,resource:_,authorizationCode:a,iss:o,scope:w,fetchFn:s});return await t.saveTokens({...r,issuer:v},b),"AUTHORIZED"}let R=f5(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 m$(d,{metadata:p,clientInformation:E,refreshToken:R.refresh_token,resource:_,addClientAuthentication:t.addClientAuthentication,dpop:await t.dpop?.(),fetchFn:s})}catch(t){if(t instanceof f2||t instanceof dv&&t.code!==dg.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:T,codeVerifier:O}=await m_(d,{metadata:p,clientInformation:E,state:k,redirectUrl:t.redirectUrl,scope:w,resource:_});return await t.saveCodeVerifier(O),await t.redirectToAuthorization(T),"REDIRECT"}async function mu(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 md=new Set(["bearer","dpop"]);function mp(t){let r,a=t.headers.get("WWW-Authenticate");if(!a)return{};let[o,i]=a.split(" ");if(!o||!md.has(o.toLowerCase())||!i)return{};let n=mh(t,"resource_metadata")||void 0;if(n)try{r=new URL(n)}catch{}let s=mh(t,"scope")||void 0;return{resourceMetadataUrl:r,scope:s,error:mh(t,"error")||void 0,errorDescription:mh(t,"error_description")||void 0}}function mh(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 mf(t,r,a=fetch){let o=await mg(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 lN.parse(await o.json())}async function mm(t,r,a=fetch){let o=p3(a);try{return await o(t,{headers:r})}catch(t){throw t}}async function my(t,r,a=fetch){return await mm(t,{"MCP-Protocol-Version":r},a)}async function mg(t,r,a,o){var i,n;let s,l=new URL(t),c=o?.protocolVersion??iY;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 my(s,c,a);return o?.metadataUrl||(i=u,n=l.pathname,i&&("/"===n||(i.ok||!(i.status<500))&&502!==i.status))||(u=await my(new URL(`/.well-known/${r}`,l),c,a)),u}async function mv(t,{fetchFn:r=fetch,protocolVersion:a=iY,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 mm(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?lM.parse(await s.json()):lz.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 f0("metadata",r,l.issuer)}return l}}async function mb(t,r){let a,o;try{(a=await mf(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 mv(o,{fetchFn:r?.fetchFn,skipIssuerValidation:r?.skipIssuerMetadataValidation});return{authorizationServerUrl:o,authorizationServerMetadata:i,resourceMetadata:a}}function mS(t){return"string"==typeof t?t:t.href}async function m_(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(ma))throw Error(`Incompatible auth server: does not support response type ${ma}`);if(r.code_challenge_methods_supported&&!r.code_challenge_methods_supported.includes(mo))throw Error(`Incompatible auth server: does not support code challenge method ${mo}`)}else l=new URL("/authorize",t);let c=await fW(),u=c.code_verifier,d=c.code_challenge;return l.searchParams.set("response_type",ma),l.searchParams.set("client_id",a.client_id),l.searchParams.set("code_challenge",d),l.searchParams.set("code_challenge_method",mo),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",mS(s)),{authorizationUrl:l,codeVerifier:u}}async function mw(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&&!mi(r.hostname))throw new f2(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",mS(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})),p3(l??fetch)(p,{method:"POST",headers:t,body:a})},m=await f();if(s&&400===m.status&&(await m.clone().json().catch(()=>{}))?.error===dg.UseDpopNonce&&(s.observeNonce(m,p),m=await f()),s?.observeNonce(m,p),!m.ok)throw await mn(m);let y=await m.json();try{return lD.parse(dw(y))}catch(t){if("object"==typeof y&&null!==y&&"error"in y)throw await mn(JSON.stringify(y));throw t}}async function m$(t,{metadata:r,clientInformation:a,refreshToken:o,resource:i,addClientAuthentication:n,dpop:s,fetchFn:l}){return{refresh_token:o,...await mw(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 mE(t,r,{metadata:a,resource:o,authorizationCode:i,iss:n,scope:s,fetchFn:l}={}){let c;void 0!==i&&me({iss:n,expectedIssuer:a?.issuer,issParameterSupported:f7(a)});let u=a?.issuer??String(r),d=async()=>{let r=await t.clientInformation({issuer:u}),a=f5(r,u,{canPersistStamp:!1});if(r&&void 0===a)throw new f9(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 mw(r,{metadata:a,tokenRequestParams:c,clientInformation:p??=await d(),addClientAuthentication:t.addClientAuthentication,resource:o,dpop:await t.dpop?.(),fetchFn:l})}async function mP(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 p3(i??fetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!l.ok)throw new f1({status:l.status,body:await l.text(),submittedMetadata:s});return lF.parse(dw(await l.json()))}let mR=new Set(["tools/list","prompts/list","resources/list","resources/templates/list","server/discover"]);var mk=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(mT(t))}set(t,r){let a=mT(t),o=mR.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(!mR.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(mT(t))&&!mR.has(t.method)&&this._cappedSize--}evict(t){let r=`${t}\0`,a=mR.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 mT(t){return`${t.method}\0${JSON.stringify([t.partition??"",t.params??""])}`}function mO(t,r){return void 0===r?t:`${t}\0${r}`}var mx=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=mO(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=mO(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(mO(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 mC=Symbol.for("mcp.authSeamEscape");function mj(t){if("object"==typeof t&&null!==t||"function"==typeof t)try{Object.defineProperty(t,mC,{value:!0,configurable:!0})}catch{}return t}let mA=new Set([-32001,-32020,-32021]);function mI(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 d1({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=dR(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 mA.has(a),{kind:"legacy"}}function mN(t,r){var a;return"browser"===r.environment&&((a=t)instanceof TypeError||a instanceof Error&&"TypeError"===a.name)?{kind:"legacy"}:{kind:"error",error:new dS(db.EraNegotiationFailed,`Version negotiation probe failed: ${mM(t)}`,{cause:t},{cause:t})}}function mM(t){return t instanceof Error?t.message:String(t)}function mq(){let t=globalThis;return void 0!==t.window&&void 0!==t.document?"browser":"node"}function mz(t){return"stderr"in t&&"pid"in t?"stdio":"http"}var mD=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&&(pm(t)||py(t))&&t.id===r.id){a._pending=void 0,pm(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,mL.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 mL=new WeakMap;function mU(t){let r=mL.get(t);mL.delete(t),r?.()}async function mH(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 mD.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:pl(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[mC]||r instanceof f8||r instanceof Error&&"UnauthorizedError"===r.name)return{kind:"auth-required",error:r};if(r instanceof d_){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 dS&&r.code===db.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=pl(ps).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 d1({supported:[...o],requested:r.requestedVersion})}}(t.result,r);case"rpc-error":return mI(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 d_(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 d_(db.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?mI(a,r):{kind:"legacy"}}(t,r);case"network-error":return mN(t.error,r);case"unusable-reply":return{kind:"error",error:new dS(db.EraNegotiationFailed,`Version negotiation probe failed: the server answered with an unusable reply (${mM(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 mN(Error("Connection closed during the version negotiation probe"),r);case"timeout":if("stdio"===r.transportKind)return{kind:"legacy"};return{kind:"error",error:new dS(db.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 dS(db.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 dS(db.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 dS(db.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 mV(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(mK())});r.close=async function(){return c=!0,i?.(),l.call(r)};try{let r=mH(t,{...o,transport:s,transportKind:"stdio",disposableProbe:!0});r.catch(()=>{}),n=await Promise.race([r,u])}finally{await mF(s),r.close=l}if(c)throw mK();return n}function mK(){return new dS(db.EraNegotiationFailed,"Version negotiation failed: the transport was closed during the server/discover probe")}async function mF(t){try{let r=t._dispose;await ("function"==typeof r?r.call(t):t.close())}catch{}}function mJ(t){let r=t._meta?.[i2];return pK.Implementation(r)?r:void 0}let mW={"notifications/tools/list_changed":["tools/list"],"notifications/prompts/list_changed":["prompts/list"],"notifications/resources/list_changed":["resources/list","resources/templates/list"]};var mB=class extends pZ{_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 dS(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 fH,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 mx(r?.responseCacheStore??new mk,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$&&np.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 pL({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)=>p0(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 dS(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 a={...t};for(let t in r){let o=r[t];if(void 0===o)continue;let i=a[t];a[t]=pX(i)&&pX(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=pl(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 dY("not-in-era"===i.reason?dX.InternalError:dX.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 dY(dX.InvalidParams,"Client does not support form-mode elicitation requests");if("url"===n.mode&&!l)throw new dY(dX.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 dY("not-in-era"===u.reason?dX.InternalError:dX.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=pl(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 dY("not-in-era"===i.reason?dX.InternalError:dX.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 dY("not-in-era"===c.reason?dX.InternalError:dX.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 dS(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&&nM.safeParse(t.discover).success))return t;throw new dS(db.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>=d$))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?dR(r):[];return{kind:"auto",modernVersions:i.length>0?i:[...dE],fallbackAvailable:!r||dP(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=dP(this._supportedProtocolVersions);try{let o=a[0];if(void 0===o)throw new dS(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: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=mz(t),n={clientInfo:this._clientInfo,capabilities:this._capabilities,environment:mq(),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 mH(r,{...n,transport:t,transportKind:i}):await mV(r,t,s,n)}catch(r){throw await t.close().catch(()=>{}),mU(t),r}if(mU(t),await super.connect(t),"legacy"===o.era)return void await this._legacyHandshake(t,a);if(this._serverCapabilities=o.discover.capabilities,this._serverVersion=mJ(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&&dR(i).length>0?dR(i):dE).find(t=>o.supportedVersions.includes(t));if(void 0===n)throw new dS(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=o,this._serverCapabilities=o.capabilities,this._serverVersion=mJ(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>=d$?"modern":"legacy"}getInstructions(){return this._instructions}getDiscoverResult(){return this._discoverResult}assertCapabilityForMethod(t){switch(t){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new dS(db.CapabilityNotSupported,`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new dS(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 dS(db.CapabilityNotSupported,`Server does not support resources (required for ${t})`);if("resources/subscribe"===t&&!this._serverCapabilities.resources.subscribe)throw new dS(db.CapabilityNotSupported,`Server does not support resource subscriptions (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new dS(db.CapabilityNotSupported,`Server does not support tools (required for ${t})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new dS(db.CapabilityNotSupported,`Server does not support completions (required for ${t})`)}}assertNotificationCapability(t){if("notifications/roots/list_changed"===t&&!this._capabilities.roots?.listChanged)throw new dS(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 dS(db.CapabilityNotSupported,`Client does not support sampling capability (required for ${t})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new dS(db.CapabilityNotSupported,`Client does not support elicitation capability (required for ${t})`);break;case"roots/list":if(!this._capabilities.roots)throw new dS(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"},nM,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 dS(db.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 dS?t:new dS(db.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:p_(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 dS(db.NotConnected,"Not connected");let l=this._negotiatedProtocolVersion;if(void 0===l||!(l>=d$))throw new dS(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 dS?t:new dS(db.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 dS(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(a=setTimeout(()=>{f({cause:"remote",error:new dS(db.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(mW,t.method)?mW[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?.[i4],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?py(t)?a.settle({cause:"remote",error:dY.fromError(t.error.code,t.error.message,t.error.data)}):a.settle({cause:"graceful",error:new dS(db.ConnectionClosed,"subscriptions/listen: server closed the subscription gracefully before acknowledging")}):super._onresponse(t)}_onclose(){if(this._listenState.size>0){let t=new dS(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 a,o="modern"===this.getProtocolEra()&&"browser"!==mq(),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}`]=pR(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 dY(dX.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 dY&&-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 dY(dX.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 dY(dX.InvalidParams,`Structured content does not match the tool's output schema: ${t.errorMessage}`)}catch(t){if(t instanceof dY)throw t;throw new dY(dX.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"===mz(this.transport))return;let r=t.tools.filter(t=>{let r=p_(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(sA,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 mG(){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 mZ(t={}){let r=t.alg??"ES256",a=await mG(),{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 mX(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 mY(new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256",new TextEncoder().encode(t))))}function mY(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 mZ({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 mG(),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),mY(a)),htm:t.htm.toUpperCase(),htu:i,iat:Math.floor(Date.now()/1e3)};return void 0!==t.accessToken&&(s.ath=await mX(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 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,a){super(`SSE error: ${r}`),this.code=t,this.event=a,dm(this,new.target)}};let mQ={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},m0=new Set(["authorization","dpop","content-type","mcp-protocol-version","mcp-method","mcp-name","mcp-session-id"]);function m1(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 m2=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=>f3(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 mj(t)}},a=async()=>{let r;try{r=await t.tokens()}catch(t){throw mj(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?{...p9(r.headers),...p9(o.headers)}:r.headers}):t}(r?.fetch,r?.requestInit),"follow"===this._redirectPolicy&&(this._fetchWithInit=function(t){let r=(r,a)=>t(r,a);return p6.add(r),r}(this._fetchWithInit)),this._sessionId=r?.sessionId,this._protocolVersion=r?.protocolVersion,this._reconnectionOptions=r?.reconnectionOptions??mQ,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 mj(t)}}async _stepUpAuthorizeInner(t,r){if("throw"===this._onInsufficientScope||!this._oauthProvider)throw new f4({requiredScope:t.scope,resourceMetadataUrl:t.resourceMetadataUrl,errorDescription:t.errorDescription});if(r>=this._maxStepUpRetries)throw new d_(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 a=await this._oauthProvider.tokens(),o=mt(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 ml(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:p3(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=p5(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 mj(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)||!np.safeParse(r).success)return;let a=r.params?._meta?.[i0];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(pk,t)?pk[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",pR(o.value))}_isModernEnvelopedRequest(t){if(Array.isArray(t)||!np.safeParse(t).success)return!1;let r=t.params?._meta?.[i0];return"string"==typeof r&&r>=d$}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?m1(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}=mp(u);this._resourceMetadataUrl=t,this._scope=mt(this._scope,r)}if(this._authProvider.onUnauthorized&&!r){try{await this._authProvider.onUnauthorized({response:u,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(t){throw mj(t)}return await u.text?.().catch(()=>{}),this._startOrAuthSse(t,!0,a)}if(await u.text?.().catch(()=>{}),r)throw mj(new d_(db.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:u.statusText}));throw mj(new f8)}if(403===u.status){let{resourceMetadataUrl:o,scope:i,error:n,errorDescription:s}=mp(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 mj(new f8);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 d_(db.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 fY({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=ny.parse(JSON.parse(t.data));(pm(r)||py(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 f8("finishAuth requires an OAuthClientProvider");let{authorizationCode:a,iss:o}=await mr(t,r,this._oauthProvider,this._url,{fetchFn:this._fetchWithInit,resourceMetadataUrl:this._resourceMetadataUrl});if(await ml(this._oauthProvider,{serverUrl:this._url,authorizationCode:a,iss:o,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})!=="AUTHORIZED")throw new f8("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:np.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=>nC.safeParse(t).success):nC.safeParse(t).success;if(l&&s.delete("mcp-session-id"),r?.headers!==void 0)for(let[t,a]of Object.entries(r.headers))m0.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?m1(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}=mp(h);this._resourceMetadataUrl=t,this._scope=mt(this._scope,r)}if(this._authProvider.onUnauthorized&&!a){try{await this._authProvider.onUnauthorized({response:h,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(t){throw mj(t)}return await h.text?.().catch(()=>{}),this._send(t,r,!0,o)}if(await h.text?.().catch(()=>{}),a)throw mj(new d_(db.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:h.statusText}));throw mj(new f8)}let i=await h.text?.().catch(()=>null);if(403===h.status){let{resourceMetadataUrl:n,scope:s,error:l,errorDescription:c}=mp(h);if("insufficient_scope"===l){if(await this._stepUpAuthorize({scope:s,resourceMetadataUrl:n,errorDescription:c,statusText:h.statusText,text:i},o)!=="AUTHORIZED")throw mj(new f8);return this._send(t,r,a,o+1)}}if(400===h.status&&"string"==typeof i&&this._isModernEnvelopedRequest(t))try{let r=ny.parse(JSON.parse(i)),a=(Array.isArray(t)?t:[t]).filter(t=>np.safeParse(t).success);if(py(r)&&a.some(t=>t.id===r.id))return void this.onmessage?.(r)}catch{}let n=this._unfollowedRedirect(this._url,h)??i;throw new d_(db.ClientHttpNotImplemented,`Error POSTing to endpoint: ${n}`,{status:h.status,statusText:h.statusText,text:i})}if(202===h.status){await h.text?.().catch(()=>{}),nI.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 p1.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=>ny.parse(t)):[ny.parse(t)])this.onmessage?.(r)}else throw await h.text?.().catch(()=>{}),new dS(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},a=await this._redirects(this._fetch??fetch)(this._url,r);if(await a.text?.().catch(()=>{}),!a.ok&&405!==a.status)throw new d_(db.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 m9=require("node:stream");var m4=n(6507);let m5="win32"===u5.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 m6=class{_process;_readBuffer;_serverParams;_stderrStream=null;onclose;onerror;onmessage;constructor(t){this._serverParams=t,this._readBuffer=new p2({maxBufferSize:t.maxBufferSize}),("pipe"===t.stderr||"overlapped"===t.stderr)&&(this._stderrStream=new m9.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=m4(this._serverParams.command,this._serverParams.args??[],{env:{...function(){let t={};for(let r of m5){let a=u5.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"===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 dS(db.NotConnected,"Not connected");let a=JSON.stringify(t)+"\n";this._process.stdin.write(a)?r():this._process.stdin.once("drain",r)})}};let m3=t=>"env"in t&&"string"==typeof t.env,m8=t=>{let r={};return t.forEach(t=>{let a=t.name.trim();if(m3(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},m7=n(8330),ye={name:m7.name,version:m7.version},yt={capabilities:{sampling:{},elicitation:{form:{},url:{}},roots:{listChanged:!0}},versionNegotiation:{mode:"auto"}};async function yr({url:t,headers:r}){let a=new mB(ye,yt),o=r?m8(r):{},i=new m2(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 ya(t){let{onStderrData:r,...a}=t,o=new mB(ye,yt),i=new m6({...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 yo(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 yi(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 yn(t){try{await t.transport.close(),await t.client.close()}catch(t){throw console.error("Error disconnecting from stdio MCP server:",t),t}}function ys(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 yl="2026-01-26",yc="ui/initialize",yu="ui/notifications/initialized",yd="ui/request-display-mode",yp="ui/open-link",yh="ui/update-model-context",yf="ui/message",ym="notifications/message",yy="resources/read",yg="ui/notifications/host-context-changed",yv="ui/notifications/size-changed";function yb(t){return!!t&&"object"==typeof t}function yS(t,r){return t instanceof Error&&t.message?t.message:r}function y_(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||!yb(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),yb(a.error)?t.reject(Error("string"==typeof a.error.message?a.error.message:"MCP request failed")):t.resolve(a.result))}1===a.id&&yb(a.result)&&p({hostContext:yb(a.result.hostContext)?a.result.hostContext:void 0,hostCapabilities:yb(a.result.hostCapabilities)?a.result.hostCapabilities:void 0}),a.method===yg&&yb(a.params)&&p({hostContext:a.params}),"ui/hostContextChanged"===a.method&&yb(a.params)&&yb(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=yS(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([yd,"ui/requestDisplayMode"],{mode:t}),async openLink(t){try{await g([yp,"ui/openLink"],{url:t})}catch(a){if(!l.isConnected||!r)return void await v(t);throw Error(yS(a,"Failed to open link"))}},readResource:t=>y(yy,{uri:t}),sendMessage:t=>y(yf,t),updateModelContext:t=>y(yh,t),async logMessage(t){m(ym,t)},async notifySizeChanged(t){m(yv,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})());