xmcp 0.7.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1 -484
- package/dist/cloudflare.js +3 -3
- package/dist/{compiler/config → config}/index.d.ts +1 -0
- package/dist/config.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +26 -26
- package/dist/runtime/adapter-express.js +17 -17
- package/dist/runtime/adapter-fastify.js +17 -17
- package/dist/runtime/adapter-nestjs.js +19 -19
- package/dist/runtime/adapter-nextjs.js +17 -17
- package/dist/runtime/http.js +25 -25
- package/dist/runtime/transports/http/base-streamable-http.d.ts +1 -1
- package/dist/runtime/transports/http/cors/defaults.d.ts +8 -0
- package/package.json +28 -11
- package/dist/detached-flush.js +0 -1
- /package/dist/{compiler/config → config}/schemas/bundler.d.ts +0 -0
- /package/dist/{compiler/config → config}/schemas/experimental/index.d.ts +0 -0
- /package/dist/{compiler/config → config}/schemas/index.d.ts +0 -0
- /package/dist/{compiler/config → config}/schemas/paths.d.ts +0 -0
- /package/dist/{compiler/config → config}/schemas/template.d.ts +0 -0
- /package/dist/{compiler/config → config}/schemas/transport/http.d.ts +0 -0
- /package/dist/{compiler/config → config}/schemas/transport/stdio.d.ts +0 -0
- /package/dist/{compiler/config → config}/schemas/typescript.d.ts +0 -0
- /package/dist/{compiler/config → config}/utils.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var s in r)("object"==typeof exports?exports:e)[s]=r[s]}}(this,()=>(()=>{var e,t,r={5888(e,t){"use strict";function r(e,t){return{validate:e,compare:t}}Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0,t.fullFormats={date:r(n,a),time:r(l(!0),u),"date-time":r(p(!0),f),"iso-time":r(l(),c),"iso-date-time":r(p(),h),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(e){return m.test(e)&&y.test(e)},"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(e){if(w.test(e))return!1;try{return new RegExp(e),!0}catch(e){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(e){return g.lastIndex=0,g.test(e)},int32:{type:"number",validate:function(e){return Number.isInteger(e)&&e<=_&&e>=v}},int64:{type:"number",validate:function(e){return Number.isInteger(e)}},float:{type:"number",validate:b},double:{type:"number",validate:b},password:!0,binary:!0},t.fastFormats={...t.fullFormats,date:r(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,a),time:r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,u),"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,f),"iso-time":r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,c),"iso-date-time":r(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,h),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},t.formatNames=Object.keys(t.fullFormats);let s=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function n(e){var t;let r=s.exec(e);if(!r)return!1;let n=+r[1],a=+r[2],o=+r[3];return a>=1&&a<=12&&o>=1&&o<=(2===a&&(t=n)%4==0&&(t%100!=0||t%400==0)?29:i[a])}function a(e,t){if(e&&t)return e>t?1:e<t?-1:0}let o=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function l(e){return function(t){let r=o.exec(t);if(!r)return!1;let s=+r[1],i=+r[2],n=+r[3],a=r[4],l="-"===r[5]?-1:1,u=+(r[6]||0),c=+(r[7]||0);if(u>23||c>59||e&&!a)return!1;if(s<=23&&i<=59&&n<60)return!0;let d=i-c*l,p=s-u*l-(d<0);return(23===p||-1===p)&&(59===d||-1===d)&&n<61}}function u(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),s=new Date("2020-01-01T"+t).valueOf();if(r&&s)return r-s}function c(e,t){if(!(e&&t))return;let r=o.exec(e),s=o.exec(t);if(r&&s)return(e=r[1]+r[2]+r[3])>(t=s[1]+s[2]+s[3])?1:e<t?-1:0}let d=/t|\s/i;function p(e){let t=l(e);return function(e){let r=e.split(d);return 2===r.length&&n(r[0])&&t(r[1])}}function f(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),s=new Date(t).valueOf();if(r&&s)return r-s}function h(e,t){if(!(e&&t))return;let[r,s]=e.split(d),[i,n]=t.split(d),o=a(r,i);if(void 0!==o)return o||u(s,n)}let m=/\/|:/,y=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,g=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm,v=-0x80000000,_=0x80000000-1;function b(){return!0}let w=/[^\\]\\Z/},1712(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(5888),i=r(9035),n=r(8994),a=new n.Name("fullFormats"),o=new n.Name("fastFormats"),l=(e,t={keywords:!0})=>{if(Array.isArray(t))return u(e,t,s.fullFormats,a),e;let[r,n]="fast"===t.mode?[s.fastFormats,o]:[s.fullFormats,a];return u(e,t.formats||s.formatNames,r,n),t.keywords&&(0,i.default)(e),e};function u(e,t,r,s){var i;for(let a of(null!=(i=e.opts.code).formats||(i.formats=(0,n._)`require("ajv-formats/dist/formats").${s}`),t))e.addFormat(a,r[a])}l.get=(e,t="full")=>{let r=("fast"===t?s.fastFormats:s.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r},e.exports=t=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l},9035(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;let s=r(8825),i=r(8994),n=i.operators,a={formatMaximum:{okStr:"<=",ok:n.LTE,fail:n.GT},formatMinimum:{okStr:">=",ok:n.GTE,fail:n.LT},formatExclusiveMaximum:{okStr:"<",ok:n.LT,fail:n.GTE},formatExclusiveMinimum:{okStr:">",ok:n.GT,fail:n.LTE}};t.formatLimitDefinition={keyword:Object.keys(a),type:"string",schemaType:"string",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,i.str)`should be ${a[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,i._)`{comparison: ${a[e].okStr}, limit: ${t}}`},code(e){let t,r,{gen:n,data:o,schemaCode:l,keyword:u,it:c}=e,{opts:d,self:p}=c;if(!d.validateFormats)return;let f=new s.KeywordCxt(c,p.RULES.all.format.definition,"format");function h(e){return(0,i._)`${e}.compare(${o}, ${l}) ${a[u].fail} 0`}f.$data?(t=n.scopeValue("formats",{ref:p.formats,code:d.code.formats}),r=n.const("fmt",(0,i._)`${t}[${f.schemaCode}]`),e.fail$data((0,i.or)((0,i._)`typeof ${r} != "object"`,(0,i._)`${r} instanceof RegExp`,(0,i._)`typeof ${r}.compare != "function"`,h(r)))):function(){let t=f.schema,r=p.formats[t];if(!r||!0===r)return;if("object"!=typeof r||r instanceof RegExp||"function"!=typeof r.compare)throw Error(`"${u}": format "${t}" does not define "compare" function`);let s=n.scopeValue("formats",{key:t,ref:r,code:d.code.formats?(0,i._)`${d.code.formats}${(0,i.getProperty)(t)}`:void 0});e.fail$data(h(s))}()},dependencies:["format"]},t.default=e=>(e.addKeyword(t.formatLimitDefinition),e)},8825(e,t,r){"use strict";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 s=r(1967),i=r(3959),n=r(9376),a=r(7456),o=["/properties"],l="http://json-schema.org/draft-07/schema";class u extends s.default{_addVocabularies(){super._addVocabularies(),i.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(n.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(a,o):a;this.addMetaSchema(e,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=u,e.exports=t=u,e.exports.Ajv=u,Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var c=r(6023);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var d=r(8994);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=r(4383);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return p.default}});var f=r(4220);Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return f.default}})},8261(e,t){"use strict";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;class r{}t._CodeOrName=r,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class s extends r{constructor(e){if(super(),!t.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=s;class i extends r{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return""===e||'""'===e}get str(){var e;return null!=(e=this._str)?e:this._str=this._items.reduce((e,t)=>`${e}${t}`,"")}get names(){var e;return null!=(e=this._names)?e:this._names=this._items.reduce((e,t)=>(t instanceof s&&(e[t.str]=(e[t.str]||0)+1),e),{})}}function n(e,...t){let r=[e[0]],s=0;for(;s<t.length;)l(r,t[s]),r.push(e[++s]);return new i(r)}t._Code=i,t.nil=new i(""),t._=n;let a=new i("+");function o(e,...t){let r=[u(e[0])],n=0;for(;n<t.length;)r.push(a),l(r,t[n]),r.push(a,u(e[++n]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===a){var r,i;let n=(r=e[t-1],'""'===(i=e[t+1])?r:'""'===r?i:"string"==typeof r?i instanceof s||'"'!==r[r.length-1]?void 0:"string"!=typeof i?`${r.slice(0,-1)}${i}"`:'"'===i[0]?r.slice(0,-1)+i.slice(1):void 0:"string"!=typeof i||'"'!==i[0]||r instanceof s?void 0:`"${r}${i.slice(1)}`);if(void 0!==n){e.splice(t-1,3,n);continue}e[t++]="+"}t++}}(r),new i(r)}function l(e,t){var r;t instanceof i?e.push(...t._items):t instanceof s?e.push(t):e.push("number"==typeof(r=t)||"boolean"==typeof r||null===r?r:u(Array.isArray(r)?r.join(","):r))}function u(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.str=o,t.addCodeArg=l,t.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`},t.stringify=function(e){return new i(u(e))},t.safeStringify=u,t.getProperty=function(e){return"string"==typeof e&&t.IDENTIFIER.test(e)?new i(`.${e}`):n`[${e}]`},t.getEsmExportName=function(e){if("string"==typeof e&&t.IDENTIFIER.test(e))return new i(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)},t.regexpCode=function(e){return new i(e.toString())}},8994(e,t,r){"use strict";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 s=r(8261),i=r(4490);var n=r(8261);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return n.Name}});var a=r(4490);Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return a.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return a.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return a.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return a.varKinds}}),t.operators={GT:new s._Code(">"),GTE:new s._Code(">="),LT:new s._Code("<"),LTE:new s._Code("<="),EQ:new s._Code("==="),NEQ:new s._Code("!=="),NOT:new s._Code("!"),OR:new s._Code("||"),AND:new s._Code("&&"),ADD:new s._Code("+")};class o{optimizeNodes(){return this}optimizeNames(e,t){return this}}class l extends o{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?i.varKinds.var:this.varKind,s=void 0===this.rhs?"":` = ${this.rhs}`;return`${r} ${this.name}${s};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=j(this.rhs,e,t)),this}get names(){return this.rhs instanceof s._CodeOrName?this.rhs.names:{}}}class u extends o{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(!(this.lhs instanceof s.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=j(this.rhs,e,t),this}get names(){return I(this.lhs instanceof s.Name?{}:{...this.lhs.names},this.rhs)}}class c extends u{constructor(e,t,r,s){super(e,r,s),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class d extends o{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class p extends o{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){let t=this.label?` ${this.label}`:"";return`break${t};`+e}}class f extends o{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class h extends o{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=j(this.code,e,t),this}get names(){return this.code instanceof s._CodeOrName?this.code.names:{}}}class m extends o{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,s=r.length;for(;s--;){let i=r[s];i.optimizeNames(e,t)||(function(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}(e,i.names),r.splice(s,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>P(e,t.names),{})}}class y extends m{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class g extends m{}class v extends y{}v.kind="else";class _ extends y{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){let e=t.optimizeNodes();t=this.else=Array.isArray(e)?new v(e):e}return t?!1===e?t instanceof _?t:t.nodes:this.nodes.length?this:new _(N(e),t instanceof _?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var r;if(this.else=null==(r=this.else)?void 0:r.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=j(this.condition,e,t),this}get names(){let e=super.names;return I(e,this.condition),this.else&&P(e,this.else.names),e}}_.kind="if";class b extends y{}b.kind="for";class w extends b{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=j(this.iteration,e,t),this}get names(){return P(super.names,this.iteration.names)}}class $ extends b{constructor(e,t,r,s){super(),this.varKind=e,this.name=t,this.from=r,this.to=s}render(e){let t=e.es5?i.varKinds.var:this.varKind,{name:r,from:s,to:n}=this;return`for(${t} ${r}=${s}; ${r}<${n}; ${r}++)`+super.render(e)}get names(){let e=I(super.names,this.from);return I(e,this.to)}}class E extends b{constructor(e,t,r,s){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=s}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=j(this.iterable,e,t),this}get names(){return P(super.names,this.iterable.names)}}class k extends y{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){let t=this.async?"async ":"";return`${t}function ${this.name}(${this.args})`+super.render(e)}}k.kind="func";class S extends m{render(e){return"return "+super.render(e)}}S.kind="return";class x extends y{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null==(e=this.catch)||e.optimizeNodes(),null==(t=this.finally)||t.optimizeNodes(),this}optimizeNames(e,t){var r,s;return super.optimizeNames(e,t),null==(r=this.catch)||r.optimizeNames(e,t),null==(s=this.finally)||s.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&P(e,this.catch.names),this.finally&&P(e,this.finally.names),e}}class T extends y{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}T.kind="catch";class O extends y{render(e){return"finally"+super.render(e)}}function P(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function I(e,t){return t instanceof s._CodeOrName?P(e,t.names):e}function j(e,t,r){var i;if(e instanceof s.Name)return n(e);if(!((i=e)instanceof s._Code&&i._items.some(e=>e instanceof s.Name&&1===t[e.str]&&void 0!==r[e.str])))return e;return new s._Code(e._items.reduce((e,t)=>(t instanceof s.Name&&(t=n(t)),t instanceof s._Code?e.push(...t._items):e.push(t),e),[]));function n(e){let s=r[e.str];return void 0===s||1!==t[e.str]?e:(delete t[e.str],s)}}function N(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:(0,s._)`!${z(e)}`}O.kind="finally",t.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new i.Scope({parent:e}),this._nodes=[new g]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,s){let i=this._scope.toName(t);return void 0!==r&&s&&(this._constants[i.str]=r),this._leafNode(new l(e,i,r)),i}const(e,t,r){return this._def(i.varKinds.const,e,t,r)}let(e,t,r){return this._def(i.varKinds.let,e,t,r)}var(e,t,r){return this._def(i.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new u(e,t,r))}add(e,r){return this._leafNode(new c(e,t.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==s.nil&&this._leafNode(new h(e)),this}object(...e){let t=["{"];for(let[r,i]of e)t.length>1&&t.push(","),t.push(r),(r!==i||this.opts.es5)&&(t.push(":"),(0,s.addCodeArg)(t,i));return t.push("}"),new s._Code(t)}if(e,t,r){if(this._blockNode(new _(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new _(e))}else(){return this._elseNode(new v)}endIf(){return this._endBlockNode(_,v)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new w(e),t)}forRange(e,t,r,s,n=this.opts.es5?i.varKinds.var:i.varKinds.let){let a=this._scope.toName(e);return this._for(new $(n,a,t,r),()=>s(a))}forOf(e,t,r,n=i.varKinds.const){let a=this._scope.toName(e);if(this.opts.es5){let e=t instanceof s.Name?t:this.var("_arr",t);return this.forRange("_i",0,(0,s._)`${e}.length`,t=>{this.var(a,(0,s._)`${e}[${t}]`),r(a)})}return this._for(new E("of",n,a,t),()=>r(a))}forIn(e,t,r,n=this.opts.es5?i.varKinds.var:i.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,s._)`Object.keys(${t})`,r);let a=this._scope.toName(e);return this._for(new E("in",n,a,t),()=>r(a))}endFor(){return this._endBlockNode(b)}label(e){return this._leafNode(new d(e))}break(e){return this._leafNode(new p(e))}return(e){let t=new S;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(S)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let s=new x;if(this._blockNode(s),this.code(e),t){let e=this.name("e");this._currNode=s.catch=new T(e),t(e)}return r&&(this._currNode=s.finally=new O,this.code(r)),this._endBlockNode(T,O)}throw(e){return this._leafNode(new f(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(void 0===t)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=s.nil,r,i){return this._blockNode(new k(e,t,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(k)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof _))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}},t.not=N;let R=A(t.operators.AND);t.and=function(...e){return e.reduce(R)};let C=A(t.operators.OR);function A(e){return(t,r)=>t===s.nil?r:r===s.nil?t:(0,s._)`${z(t)} ${e} ${z(r)}`}function z(e){return e instanceof s.Name?e:(0,s._)`(${e})`}t.or=function(...e){return e.reduce(C)}},4490(e,t,r){"use strict";var s,i;Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;let n=r(8261);class a extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}(i=s||(t.UsedValueState=s={}))[i.Started=0]="Started",i[i.Completed=1]="Completed",t.varKinds={const:new n.Name("const"),let:new n.Name("let"),var:new n.Name("var")};class o{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof n.Name?e:this.name(e)}name(e){return new n.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if((null==(r=null==(t=this._parent)?void 0:t._prefixes)?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}t.Scope=o;class l extends n.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=(0,n._)`.${new n.Name(t)}[${r}]`}}t.ValueScopeName=l;let u=(0,n._)`\n`;t.ValueScope=class extends o{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?u:n.nil}}get(){return this._scope}name(e){return new l(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw Error("CodeGen: ref must be passed in value");let s=this.toName(e),{prefix:i}=s,n=null!=(r=t.key)?r:t.ref,a=this._values[i];if(a){let e=a.get(n);if(e)return e}else a=this._values[i]=new Map;a.set(n,s);let o=this._scope[i]||(this._scope[i]=[]),l=o.length;return o[l]=t.ref,s.setValue(t,{property:i,itemIndex:l}),s}getValue(e,t){let r=this._values[e];if(r)return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,t=>{if(void 0===t.scopePath)throw Error(`CodeGen: name "${t}" has no value`);return(0,n._)`${e}${t.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,e=>{if(void 0===e.value)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,r)}_reduceValues(e,r,i={},o){let l=n.nil;for(let u in e){let c=e[u];if(!c)continue;let d=i[u]=i[u]||new Map;c.forEach(e=>{if(d.has(e))return;d.set(e,s.Started);let i=r(e);if(i){let r=this.opts.es5?t.varKinds.var:t.varKinds.const;l=(0,n._)`${l}${r} ${e} = ${i};${this.opts._n}`}else if(i=null==o?void 0:o(e))l=(0,n._)`${l}${i}${this.opts._n}`;else throw new a(e);d.set(e,s.Completed)})}return l}}},8425(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;let s=r(8994),i=r(7218),n=r(6660);function a(e,t){let r=e.const("err",t);e.if((0,s._)`${n.default.vErrors} === null`,()=>e.assign(n.default.vErrors,(0,s._)`[${r}]`),(0,s._)`${n.default.vErrors}.push(${r})`),e.code((0,s._)`${n.default.errors}++`)}function o(e,t){let{gen:r,validateName:i,schemaEnv:n}=e;n.$async?r.throw((0,s._)`new ${e.ValidationError}(${t})`):(r.assign((0,s._)`${i}.errors`,t),r.return(!1))}t.keywordError={message:({keyword:e})=>(0,s.str)`must pass "${e}" keyword validation`},t.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,s.str)`"${e}" keyword must be ${t} ($data)`:(0,s.str)`"${e}" keyword is invalid ($data)`},t.reportError=function(e,r=t.keywordError,i,n){let{it:l}=e,{gen:c,compositeRule:d,allErrors:p}=l,f=u(e,r,i);(null!=n?n:d||p)?a(c,f):o(l,(0,s._)`[${f}]`)},t.reportExtraError=function(e,r=t.keywordError,s){let{it:i}=e,{gen:l,compositeRule:c,allErrors:d}=i;a(l,u(e,r,s)),c||d||o(i,n.default.vErrors)},t.resetErrorsCount=function(e,t){e.assign(n.default.errors,t),e.if((0,s._)`${n.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,s._)`${n.default.vErrors}.length`,t),()=>e.assign(n.default.vErrors,null)))},t.extendErrors=function({gen:e,keyword:t,schemaValue:r,data:i,errsCount:a,it:o}){if(void 0===a)throw Error("ajv implementation error");let l=e.name("err");e.forRange("i",a,n.default.errors,a=>{e.const(l,(0,s._)`${n.default.vErrors}[${a}]`),e.if((0,s._)`${l}.instancePath === undefined`,()=>e.assign((0,s._)`${l}.instancePath`,(0,s.strConcat)(n.default.instancePath,o.errorPath))),e.assign((0,s._)`${l}.schemaPath`,(0,s.str)`${o.errSchemaPath}/${t}`),o.opts.verbose&&(e.assign((0,s._)`${l}.schema`,r),e.assign((0,s._)`${l}.data`,i))})};let l={keyword:new s.Name("keyword"),schemaPath:new s.Name("schemaPath"),params:new s.Name("params"),propertyName:new s.Name("propertyName"),message:new s.Name("message"),schema:new s.Name("schema"),parentSchema:new s.Name("parentSchema")};function u(e,t,r){let{createErrors:a}=e.it;return!1===a?(0,s._)`{}`:function(e,t,r={}){let{gen:a,it:o}=e,u=[function({errorPath:e},{instancePath:t}){let r=t?(0,s.str)`${e}${(0,i.getErrorPath)(t,i.Type.Str)}`:e;return[n.default.instancePath,(0,s.strConcat)(n.default.instancePath,r)]}(o,r),function({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let a=n?t:(0,s.str)`${t}/${e}`;return r&&(a=(0,s.str)`${a}${(0,i.getErrorPath)(r,i.Type.Str)}`),[l.schemaPath,a]}(e,r)];return function(e,{params:t,message:r},i){let{keyword:a,data:o,schemaValue:u,it:c}=e,{opts:d,propertyName:p,topSchemaRef:f,schemaPath:h}=c;i.push([l.keyword,a],[l.params,"function"==typeof t?t(e):t||(0,s._)`{}`]),d.messages&&i.push([l.message,"function"==typeof r?r(e):r]),d.verbose&&i.push([l.schema,u],[l.parentSchema,(0,s._)`${f}${h}`],[n.default.data,o]),p&&i.push([l.propertyName,p])}(e,t,u),a.object(...u)}(e,t,r)}},1688(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;let s=r(8994),i=r(4383),n=r(6660),a=r(9008),o=r(7218),l=r(6023);class u{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!=(t=e.baseId)?t:(0,a.normalizeId)(null==r?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}}function c(e){let t,r,o=p.call(this,e);if(o)return o;let u=(0,a.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:c,lines:d}=this.opts.code,{ownProperties:f}=this.opts,h=new s.CodeGen(this.scope,{es5:c,lines:d,ownProperties:f});e.$async&&(t=h.scopeValue("Error",{ref:i.default,code:(0,s._)`require("ajv/dist/runtime/validation_error").default`}));let m=h.scopeName("validate");e.validateName=m;let y={gen:h,allErrors:this.opts.allErrors,data:n.default.data,parentData:n.default.parentData,parentDataProperty:n.default.parentDataProperty,dataNames:[n.default.data],dataPathArr:[s.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:h.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,s.stringify)(e.schema)}:{ref:e.schema}),validateName:m,ValidationError:t,schema:e.schema,schemaEnv:e,rootId:u,baseId:e.baseId||u,schemaPath:s.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,s._)`""`,opts:this.opts,self:this};try{this._compilations.add(e),(0,l.validateFunctionCode)(y),h.optimize(this.opts.code.optimize);let t=h.toString();r=`${h.scopeRefs(n.default.scope)}return ${t}`,this.opts.code.process&&(r=this.opts.code.process(r,e));let i=Function(`${n.default.self}`,`${n.default.scope}`,r)(this,this.scope.get());if(this.scope.value(m,{ref:i}),i.errors=null,i.schema=e.schema,i.schemaEnv=e,e.$async&&(i.$async=!0),!0===this.opts.code.source&&(i.source={validateName:m,validateCode:t,scopeValues:h._values}),this.opts.unevaluated){let{props:e,items:t}=y;i.evaluated={props:e instanceof s.Name?void 0:e,items:t instanceof s.Name?void 0:t,dynamicProps:e instanceof s.Name,dynamicItems:t instanceof s.Name},i.source&&(i.source.evaluated=(0,s.stringify)(i.evaluated))}return e.validate=i,e}catch(t){throw delete e.validate,delete e.validateName,r&&this.logger.error("Error compiling schema, function code:",r),t}finally{this._compilations.delete(e)}}function d(e){return(0,a.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:c.call(this,e)}function p(e){for(let s of this._compilations){var t,r;if(t=s,r=e,t.schema===r.schema&&t.root===r.root&&t.baseId===r.baseId)return s}}function f(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||h.call(this,e,t)}function h(e,t){let r=this.opts.uriResolver.parse(t),s=(0,a._getFullPath)(this.opts.uriResolver,r),i=(0,a.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&s===i)return y.call(this,r,e);let n=(0,a.normalizeId)(s),o=this.refs[n]||this.schemas[n];if("string"==typeof o){let t=h.call(this,e,o);if("object"!=typeof(null==t?void 0:t.schema))return;return y.call(this,r,t)}if("object"==typeof(null==o?void 0:o.schema)){if(o.validate||c.call(this,o),n===(0,a.normalizeId)(t)){let{schema:t}=o,{schemaId:r}=this.opts,s=t[r];return s&&(i=(0,a.resolveUrl)(this.opts.uriResolver,i,s)),new u({schema:t,schemaId:r,root:e,baseId:i})}return y.call(this,r,o)}}t.SchemaEnv=u,t.compileSchema=c,t.resolveRef=function(e,t,r){var s;r=(0,a.resolveUrl)(this.opts.uriResolver,t,r);let i=e.refs[r];if(i)return i;let n=f.call(this,e,r);if(void 0===n){let i=null==(s=e.localRefs)?void 0:s[r],{schemaId:a}=this.opts;i&&(n=new u({schema:i,schemaId:a,root:e,baseId:t}))}if(void 0!==n)return e.refs[r]=d.call(this,n)},t.getCompilingSchema=p,t.resolveSchema=h;let m=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function y(e,{baseId:t,schema:r,root:s}){var i;let n;if((null==(i=e.fragment)?void 0:i[0])!=="/")return;for(let s of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;let e=r[(0,o.unescapeFragment)(s)];if(void 0===e)return;let i="object"==typeof(r=e)&&r[this.opts.schemaId];!m.has(s)&&i&&(t=(0,a.resolveUrl)(this.opts.uriResolver,t,i))}if("boolean"!=typeof r&&r.$ref&&!(0,o.schemaHasRulesButRef)(r,this.RULES)){let e=(0,a.resolveUrl)(this.opts.uriResolver,t,r.$ref);n=h.call(this,s,e)}let{schemaId:l}=this.opts;if((n=n||new u({schema:r,schemaId:l,root:s,baseId:t})).schema!==n.root.schema)return n}},6660(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994);t.default={data:new s.Name("data"),valCxt:new s.Name("valCxt"),instancePath:new s.Name("instancePath"),parentData:new s.Name("parentData"),parentDataProperty:new s.Name("parentDataProperty"),rootData:new s.Name("rootData"),dynamicAnchors:new s.Name("dynamicAnchors"),vErrors:new s.Name("vErrors"),errors:new s.Name("errors"),this:new s.Name("this"),self:new s.Name("self"),scope:new s.Name("scope"),json:new s.Name("json"),jsonPos:new s.Name("jsonPos"),jsonLen:new s.Name("jsonLen"),jsonPart:new s.Name("jsonPart")}},4220(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(9008);t.default=class extends Error{constructor(e,t,r,i){super(i||`can't resolve reference ${r} from id ${t}`),this.missingRef=(0,s.resolveUrl)(e,t,r),this.missingSchema=(0,s.normalizeId)((0,s.getFullPath)(e,this.missingRef))}}},9008(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;let s=r(7218),i=r(7371),n=r(205),a=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);t.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!function e(t){for(let r in t){if(o.has(r))return!0;let s=t[r];if(Array.isArray(s)&&s.some(e)||"object"==typeof s&&e(s))return!0}return!1}(e):!!t&&function e(t){let r=0;for(let i in t)if("$ref"===i||(r++,!a.has(i)&&("object"==typeof t[i]&&(0,s.eachItem)(t[i],t=>r+=e(t)),r===1/0)))return 1/0;return r}(e)<=t)};let o=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function l(e,t="",r){!1!==r&&(t=d(t));let s=e.parse(t);return u(e,s)}function u(e,t){return e.serialize(t).split("#")[0]+"#"}t.getFullPath=l,t._getFullPath=u;let c=/#\/?$/;function d(e){return e?e.replace(c,""):""}t.normalizeId=d,t.resolveUrl=function(e,t,r){return r=d(r),e.resolve(t,r)};let p=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};let{schemaId:r,uriResolver:s}=this.opts,a=d(e[r]||t),o={"":a},u=l(s,a,!1),c={},f=new Set;return n(e,{allKeys:!0},(e,t,s,i)=>{if(void 0===i)return;let n=u+t,a=o[i];function l(t){let r=this.opts.uriResolver.resolve;if(t=d(a?r(a,t):t),f.has(t))throw m(t);f.add(t);let s=this.refs[t];return"string"==typeof s&&(s=this.refs[s]),"object"==typeof s?h(e,s.schema,t):t!==d(n)&&("#"===t[0]?(h(e,c[t],t),c[t]=e):this.refs[t]=n),t}function y(e){if("string"==typeof e){if(!p.test(e))throw Error(`invalid anchor "${e}"`);l.call(this,`#${e}`)}}"string"==typeof e[r]&&(a=l.call(this,e[r])),y.call(this,e.$anchor),y.call(this,e.$dynamicAnchor),o[t]=a}),c;function h(e,t,r){if(void 0!==t&&!i(e,t))throw m(r)}function m(e){return Error(`reference "${e}" resolves to more than one schema`)}}},6247(e,t){"use strict";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(e){return"string"==typeof e&&r.has(e)},t.getRules=function(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}},7218(e,t,r){"use strict";var s,i;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 n=r(8994),a=r(8261);function o(e,t=e.schema){let{opts:r,self:s}=e;if(!r.strictSchema||"boolean"==typeof t)return;let i=s.RULES.keywords;for(let r in t)i[r]||m(e,`unknown keyword: "${r}"`)}function l(e,t){if("boolean"==typeof e)return!e;for(let r in e)if(t[r])return!0;return!1}function u(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function c(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function d({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:s}){return(i,a,o,l)=>{let u=void 0===o?a:o instanceof n.Name?(a instanceof n.Name?e(i,a,o):t(i,a,o),o):a instanceof n.Name?(t(i,o,a),a):r(a,o);return l!==n.Name||u instanceof n.Name?u:s(i,u)}}function p(e,t){if(!0===t)return e.var("props",!0);let r=e.var("props",(0,n._)`{}`);return void 0!==t&&f(e,r,t),r}function f(e,t,r){Object.keys(r).forEach(r=>e.assign((0,n._)`${t}${(0,n.getProperty)(r)}`,!0))}t.toHash=function(e){let t={};for(let r of e)t[r]=!0;return t},t.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(o(e,t),!l(t,e.self.RULES.all))},t.checkUnknownRules=o,t.schemaHasRules=l,t.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(let r in e)if("$ref"!==r&&t.all[r])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:e,schemaPath:t},r,s,i){if(!i){if("number"==typeof r||"boolean"==typeof r)return r;if("string"==typeof r)return(0,n._)`${r}`}return(0,n._)`${e}${t}${(0,n.getProperty)(s)}`},t.unescapeFragment=function(e){return c(decodeURIComponent(e))},t.escapeFragment=function(e){return encodeURIComponent(u(e))},t.escapeJsonPointer=u,t.unescapeJsonPointer=c,t.eachItem=function(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)},t.mergeEvaluated={props:d({mergeNames:(e,t,r)=>e.if((0,n._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,n._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,n._)`${r} || {}`).code((0,n._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,n._)`${r} !== true`,()=>{!0===t?e.assign(r,!0):(e.assign(r,(0,n._)`${r} || {}`),f(e,r,t))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:p}),items:d({mergeNames:(e,t,r)=>e.if((0,n._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,n._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,n._)`${r} !== true`,()=>e.assign(r,!0===t||(0,n._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},t.evaluatedPropsToName=p,t.setEvaluated=f;let h={};function m(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw Error(t);e.self.logger.warn(t)}}t.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:h[t.code]||(h[t.code]=new a._Code(t.code))})},(i=s||(t.Type=s={}))[i.Num=0]="Num",i[i.Str=1]="Str",t.getErrorPath=function(e,t,r){if(e instanceof n.Name){let i=t===s.Num;return r?i?(0,n._)`"[" + ${e} + "]"`:(0,n._)`"['" + ${e} + "']"`:i?(0,n._)`"/" + ${e}`:(0,n._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,n.getProperty)(e).toString():"/"+u(e)},t.checkStrictMode=m},238(e,t){"use strict";function r(e,t){return t.rules.some(t=>s(e,t))}function s(e,t){var r;return void 0!==e[t.keyword]||(null==(r=t.definition.implements)?void 0:r.some(t=>void 0!==e[t]))}Object.defineProperty(t,"__esModule",{value:!0}),t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0,t.schemaHasRulesForType=function({schema:e,self:t},s){let i=t.RULES.types[s];return i&&!0!==i&&r(e,i)},t.shouldUseGroup=r,t.shouldUseRule=s},564(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;let s=r(8425),i=r(8994),n=r(6660),a={message:"boolean schema is false"};function o(e,t){let{gen:r,data:i}=e;(0,s.reportError)({gen:r,keyword:"false schema",data:i,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},a,void 0,t)}t.topBoolOrEmptySchema=function(e){let{gen:t,schema:r,validateName:s}=e;!1===r?o(e,!1):"object"==typeof r&&!0===r.$async?t.return(n.default.data):(t.assign((0,i._)`${s}.errors`,null),t.return(!0))},t.boolOrEmptySchema=function(e,t){let{gen:r,schema:s}=e;!1===s?(r.var(t,!1),o(e)):r.var(t,!0)}},6419(e,t,r){"use strict";var s,i;Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;let n=r(6247),a=r(238),o=r(8425),l=r(8994),u=r(7218);function c(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(n.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}(i=s||(t.DataType=s={}))[i.Correct=0]="Correct",i[i.Wrong=1]="Wrong",t.getSchemaTypes=function(e){let t=c(e.type);if(t.includes("null")){if(!1===e.nullable)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},t.getJSONTypes=c,t.coerceAndCheckDataType=function(e,t){var r,i;let{gen:n,data:o,opts:u}=e,c=(r=t,(i=u.coerceTypes)?r.filter(e=>d.has(e)||"array"===i&&"array"===e):[]),p=t.length>0&&!(0===c.length&&1===t.length&&(0,a.schemaHasRulesForType)(e,t[0]));if(p){let r=f(t,o,u.strictNumbers,s.Wrong);n.if(r,()=>{c.length?function(e,t,r){let{gen:s,data:i,opts:n}=e,a=s.let("dataType",(0,l._)`typeof ${i}`),o=s.let("coerced",(0,l._)`undefined`);for(let e of("array"===n.coerceTypes&&s.if((0,l._)`${a} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>s.assign(i,(0,l._)`${i}[0]`).assign(a,(0,l._)`typeof ${i}`).if(f(t,i,n.strictNumbers),()=>s.assign(o,i))),s.if((0,l._)`${o} !== undefined`),r))(d.has(e)||"array"===e&&"array"===n.coerceTypes)&&function(e){switch(e){case"string":s.elseIf((0,l._)`${a} == "number" || ${a} == "boolean"`).assign(o,(0,l._)`"" + ${i}`).elseIf((0,l._)`${i} === null`).assign(o,(0,l._)`""`);return;case"number":s.elseIf((0,l._)`${a} == "boolean" || ${i} === null
|
|
2
|
-
|| (${
|
|
3
|
-
|| (${
|
|
4
|
-
|| ${a} === "boolean" || ${i} === null`).assign(o,(0,l._)`[${i}]`)}}(e);s.else(),m(e),s.endIf(),s.if((0,l._)`${o} !== undefined`,()=>{s.assign(i,o),function({gen:e,parentData:t,parentDataProperty:r},s){e.if((0,l._)`${t} !== undefined`,()=>e.assign((0,l._)`${t}[${r}]`,s))}(e,o)})}(e,t,c):m(e)})}return p};let d=new Set(["string","number","integer","boolean","null"]);function p(e,t,r,i=s.Correct){let n,a=i===s.Correct?l.operators.EQ:l.operators.NEQ;switch(e){case"null":return(0,l._)`${t} ${a} null`;case"array":n=(0,l._)`Array.isArray(${t})`;break;case"object":n=(0,l._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":n=o((0,l._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":n=o();break;default:return(0,l._)`typeof ${t} ${a} ${e}`}return i===s.Correct?n:(0,l.not)(n);function o(e=l.nil){return(0,l.and)((0,l._)`typeof ${t} == "number"`,e,r?(0,l._)`isFinite(${t})`:l.nil)}}function f(e,t,r,s){let i;if(1===e.length)return p(e[0],t,r,s);let n=(0,u.toHash)(e);if(n.array&&n.object){let e=(0,l._)`typeof ${t} != "object"`;i=n.null?e:(0,l._)`!${t} || ${e}`,delete n.null,delete n.array,delete n.object}else i=l.nil;for(let e in n.number&&delete n.integer,n)i=(0,l.and)(i,p(e,t,r,s));return i}t.checkDataType=p,t.checkDataTypes=f;let h={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?(0,l._)`{type: ${e}}`:(0,l._)`{type: ${t}}`};function m(e){let t=function(e){let{gen:t,data:r,schema:s}=e,i=(0,u.schemaRefOrVal)(e,s,"type");return{gen:t,keyword:"type",data:r,schema:s.type,schemaCode:i,schemaValue:i,parentSchema:s,params:{},it:e}}(e);(0,o.reportError)(t,h)}t.reportTypeError=m},6593(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;let s=r(8994),i=r(7218);function n(e,t,r){let{gen:n,compositeRule:a,data:o,opts:l}=e;if(void 0===r)return;let u=(0,s._)`${o}${(0,s.getProperty)(t)}`;if(a)return void(0,i.checkStrictMode)(e,`default is ignored for: ${u}`);let c=(0,s._)`${u} === undefined`;"empty"===l.useDefaults&&(c=(0,s._)`${c} || ${u} === null || ${u} === ""`),n.if(c,(0,s._)`${u} = ${(0,s.stringify)(r)}`)}t.assignDefaults=function(e,t){let{properties:r,items:s}=e.schema;if("object"===t&&r)for(let t in r)n(e,t,r[t].default);else"array"===t&&Array.isArray(s)&&s.forEach((t,r)=>n(e,r,t.default))}},6023(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;let s=r(564),i=r(6419),n=r(238),a=r(6419),o=r(6593),l=r(9820),u=r(3826),c=r(8994),d=r(6660),p=r(9008),f=r(7218),h=r(8425);function m({gen:e,validateName:t,schema:r,schemaEnv:s,opts:i},n){var a;i.code.es5?e.func(t,(0,c._)`${d.default.data}, ${d.default.valCxt}`,s.$async,()=>{var t,s;e.code((0,c._)`"use strict"; ${y(r,i)}`),t=e,s=i,t.if(d.default.valCxt,()=>{t.var(d.default.instancePath,(0,c._)`${d.default.valCxt}.${d.default.instancePath}`),t.var(d.default.parentData,(0,c._)`${d.default.valCxt}.${d.default.parentData}`),t.var(d.default.parentDataProperty,(0,c._)`${d.default.valCxt}.${d.default.parentDataProperty}`),t.var(d.default.rootData,(0,c._)`${d.default.valCxt}.${d.default.rootData}`),s.dynamicRef&&t.var(d.default.dynamicAnchors,(0,c._)`${d.default.valCxt}.${d.default.dynamicAnchors}`)},()=>{t.var(d.default.instancePath,(0,c._)`""`),t.var(d.default.parentData,(0,c._)`undefined`),t.var(d.default.parentDataProperty,(0,c._)`undefined`),t.var(d.default.rootData,d.default.data),s.dynamicRef&&t.var(d.default.dynamicAnchors,(0,c._)`{}`)}),e.code(n)}):e.func(t,(0,c._)`${d.default.data}, ${(a=i,(0,c._)`{${d.default.instancePath}="", ${d.default.parentData}, ${d.default.parentDataProperty}, ${d.default.rootData}=${d.default.data}${a.dynamicRef?(0,c._)`, ${d.default.dynamicAnchors}={}`:c.nil}}={}`)}`,s.$async,()=>e.code(y(r,i)).code(n))}function y(e,t){let r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,c._)`/*# sourceURL=${r} */`:c.nil}function g({schema:e,self:t}){if("boolean"==typeof e)return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function v(e){return"boolean"!=typeof e.schema}function _(e){(0,f.checkUnknownRules)(e),function(e){let{schema:t,errSchemaPath:r,opts:s,self:i}=e;t.$ref&&s.ignoreKeywordsWithRef&&(0,f.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function b(e,t){if(e.opts.jtd)return $(e,[],!1,t);let r=(0,i.getSchemaTypes)(e.schema),s=(0,i.coerceAndCheckDataType)(e,r);$(e,r,!s,t)}function w({gen:e,schemaEnv:t,schema:r,errSchemaPath:s,opts:i}){let n=r.$comment;if(!0===i.$comment)e.code((0,c._)`${d.default.self}.logger.log(${n})`);else if("function"==typeof i.$comment){let r=(0,c.str)`${s}/$comment`,i=e.scopeValue("root",{ref:t.root});e.code((0,c._)`${d.default.self}.opts.$comment(${n}, ${r}, ${i}.schema)`)}}function $(e,t,r,s){var i,o,l,u;let{gen:p,schema:h,data:m,allErrors:y,opts:g,self:v}=e,{RULES:_}=v;if(h.$ref&&(g.ignoreKeywordsWithRef||!(0,f.schemaHasRulesButRef)(h,_)))return void p.block(()=>T(e,"$ref",_.all.$ref.definition));function b(i){(0,n.shouldUseGroup)(h,i)&&(i.type?(p.if((0,a.checkDataType)(i.type,m,g.strictNumbers)),E(e,i),1===t.length&&t[0]===i.type&&r&&(p.else(),(0,a.reportTypeError)(e)),p.endIf()):E(e,i),y||p.if((0,c._)`${d.default.errors} === ${s||0}`))}g.jtd||(i=e,o=t,!i.schemaEnv.meta&&i.opts.strictTypes&&(function(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(t=>{k(e.dataTypes,t)||S(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}),function(e,t){let r=[];for(let s of e.dataTypes)k(t,s)?r.push(s):t.includes("integer")&&"number"===s&&r.push("integer");e.dataTypes=r}(e,t)}}(i,o),i.opts.allowUnionTypes||(l=i,(u=o).length>1&&!(2===u.length&&u.includes("null"))&&S(l,"use allowUnionTypes to allow union type keyword")),function(e,t){let r=e.self.RULES.all;for(let s in r){let i=r[s];if("object"==typeof i&&(0,n.shouldUseRule)(e.schema,i)){let{type:r}=i.definition;r.length&&!r.some(e=>{var r,s;return r=t,s=e,r.includes(s)||"number"===s&&r.includes("integer")})&&S(e,`missing type "${r.join(",")}" for keyword "${s}"`)}}}(i,i.dataTypes))),p.block(()=>{for(let e of _.rules)b(e);b(_.post)})}function E(e,t){let{gen:r,schema:s,opts:{useDefaults:i}}=e;i&&(0,o.assignDefaults)(e,t.type),r.block(()=>{for(let r of t.rules)(0,n.shouldUseRule)(s,r)&&T(e,r.keyword,r.definition,t.type)})}function k(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function S(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,f.checkStrictMode)(e,t,e.opts.strictTypes)}t.validateFunctionCode=function(e){v(e)&&(_(e),g(e))?function(e){let{schema:t,opts:r,gen:s}=e;m(e,()=>{r.$comment&&t.$comment&&w(e),function(e){let{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&(0,f.checkStrictMode)(e,"default is ignored in the schema root")}(e),s.let(d.default.vErrors,null),s.let(d.default.errors,0),r.unevaluated&&function(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,c._)`${r}.evaluated`),t.if((0,c._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,c._)`${e.evaluated}.props`,(0,c._)`undefined`)),t.if((0,c._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,c._)`${e.evaluated}.items`,(0,c._)`undefined`))}(e),b(e),function(e){let{gen:t,schemaEnv:r,validateName:s,ValidationError:i,opts:n}=e;r.$async?t.if((0,c._)`${d.default.errors} === 0`,()=>t.return(d.default.data),()=>t.throw((0,c._)`new ${i}(${d.default.vErrors})`)):(t.assign((0,c._)`${s}.errors`,d.default.vErrors),n.unevaluated&&function({gen:e,evaluated:t,props:r,items:s}){r instanceof c.Name&&e.assign((0,c._)`${t}.props`,r),s instanceof c.Name&&e.assign((0,c._)`${t}.items`,s)}(e),t.return((0,c._)`${d.default.errors} === 0`))}(e)})}(e):m(e,()=>(0,s.topBoolOrEmptySchema)(e))};class x{constructor(e,t,r){if((0,l.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,f.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",I(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,l.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",d.default.errors))}result(e,t,r){this.failResult((0,c.not)(e),t,r)}failResult(e,t,r){this.gen.if(e),r?r():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,c.not)(e),void 0,t)}fail(e){if(void 0===e){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail((0,c._)`${t} !== undefined && (${(0,c.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?h.reportExtraError:h.reportError)(this,this.def.error,t)}$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(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,r=c.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=c.nil,t=c.nil){if(!this.$data)return;let{gen:r,schemaCode:s,schemaType:i,def:n}=this;r.if((0,c.or)((0,c._)`${s} === undefined`,t)),e!==c.nil&&r.assign(e,!0),(i.length||n.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==c.nil&&r.assign(e,!1)),r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:s,it:i}=this;return(0,c.or)(function(){if(r.length){if(!(t instanceof c.Name))throw Error("ajv implementation error");let e=Array.isArray(r)?r:[r];return(0,c._)`${(0,a.checkDataTypes)(e,t,i.opts.strictNumbers,a.DataType.Wrong)}`}return c.nil}(),function(){if(s.validateSchema){let r=e.scopeValue("validate$data",{ref:s.validateSchema});return(0,c._)`!${r}(${t})`}return c.nil}())}subschema(e,t){let r=(0,u.getSubschema)(this.it,e);(0,u.extendSubschemaData)(r,this.it,e),(0,u.extendSubschemaMode)(r,e);let i={...this.it,...r,items:void 0,props:void 0};return!function(e,t){if(v(e)&&(_(e),g(e)))return function(e,t){var r;let s,{schema:i,gen:n,opts:a}=e;a.$comment&&i.$comment&&w(e),(s=(r=e).schema[r.opts.schemaId])&&(r.baseId=(0,p.resolveUrl)(r.opts.uriResolver,r.baseId,s)),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}(e);let o=n.const("_errs",d.default.errors);b(e,o),n.var(t,(0,c._)`${o} === ${d.default.errors}`)}(e,t);(0,s.boolOrEmptySchema)(e,t)}(i,t),i}mergeEvaluated(e,t){let{it:r,gen:s}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=f.mergeEvaluated.props(s,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=f.mergeEvaluated.items(s,e.items,r.items,t)))}mergeValidEvaluated(e,t){let{it:r,gen:s}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return s.if(t,()=>this.mergeEvaluated(e,c.Name)),!0}}function T(e,t,r,s){let i=new x(e,r,t);"code"in r?r.code(i,s):i.$data&&r.validate?(0,l.funcKeywordCode)(i,r):"macro"in r?(0,l.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,l.funcKeywordCode)(i,r)}t.KeywordCxt=x;let O=/^\/(?:[^~]|~0|~1)*$/,P=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function I(e,{dataLevel:t,dataNames:r,dataPathArr:s}){let i,n;if(""===e)return d.default.rootData;if("/"===e[0]){if(!O.test(e))throw Error(`Invalid JSON-pointer: ${e}`);i=e,n=d.default.rootData}else{let a=P.exec(e);if(!a)throw Error(`Invalid JSON-pointer: ${e}`);let l=+a[1];if("#"===(i=a[2])){if(l>=t)throw Error(o("property/index",l));return s[t-l]}if(l>t)throw Error(o("data",l));if(n=r[t-l],!i)return n}let a=n;for(let e of i.split("/"))e&&(n=(0,c._)`${n}${(0,c.getProperty)((0,f.unescapeJsonPointer)(e))}`,a=(0,c._)`${a} && ${n}`);return a;function o(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}t.getData=I},9820(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;let s=r(8994),i=r(6660),n=r(4954),a=r(8425);function o(e){let{gen:t,data:r,it:i}=e;t.if(i.parentData,()=>t.assign(r,(0,s._)`${i.parentData}[${i.parentDataProperty}]`))}function l(e,t,r){if(void 0===r)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword","function"==typeof r?{ref:r}:{ref:r,code:(0,s.stringify)(r)})}t.macroKeywordCode=function(e,t){let{gen:r,keyword:i,schema:n,parentSchema:a,it:o}=e,u=t.macro.call(o.self,n,a,o),c=l(r,i,u);!1!==o.opts.validateSchema&&o.self.validateSchema(u,!0);let d=r.name("valid");e.subschema({schema:u,schemaPath:s.nil,errSchemaPath:`${o.errSchemaPath}/${i}`,topSchemaRef:c,compositeRule:!0},d),e.pass(d,()=>e.error(!0))},t.funcKeywordCode=function(e,t){var r;let{gen:u,keyword:c,schema:d,parentSchema:p,$data:f,it:h}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}(h,t);let m=l(u,c,!f&&t.compile?t.compile.call(h.self,d,p,h):t.validate),y=u.let("valid");function g(r=t.async?(0,s._)`await `:s.nil){let a=h.opts.passContext?i.default.this:i.default.self,o=!("compile"in t&&!f||!1===t.schema);u.assign(y,(0,s._)`${r}${(0,n.callValidateCode)(e,m,a,o)}`,t.modifying)}function v(e){var r;u.if((0,s.not)(null!=(r=t.valid)?r:y),e)}e.block$data(y,function(){if(!1===t.errors)g(),t.modifying&&o(e),v(()=>e.error());else{let r,n,l=t.async?(r=u.let("ruleErrs",null),u.try(()=>g((0,s._)`await `),e=>u.assign(y,!1).if((0,s._)`${e} instanceof ${h.ValidationError}`,()=>u.assign(r,(0,s._)`${e}.errors`),()=>u.throw(e))),r):(n=(0,s._)`${m}.errors`,u.assign(n,null),g(s.nil),n);t.modifying&&o(e),v(()=>(function(e,t){let{gen:r}=e;r.if((0,s._)`Array.isArray(${t})`,()=>{r.assign(i.default.vErrors,(0,s._)`${i.default.vErrors} === null ? ${t} : ${i.default.vErrors}.concat(${t})`).assign(i.default.errors,(0,s._)`${i.default.vErrors}.length`),(0,a.extendErrors)(e)},()=>e.error())})(e,l))}}),e.ok(null!=(r=t.valid)?r:y)},t.validSchemaType=function(e,t,r=!1){return!t.length||t.some(t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||r&&void 0===e)},t.validateKeywordUsage=function({schema:e,opts:t,self:r,errSchemaPath:s},i,n){if(Array.isArray(i.keyword)?!i.keyword.includes(n):i.keyword!==n)throw Error("ajv implementation error");let a=i.dependencies;if(null==a?void 0:a.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw Error(`parent schema must have dependencies of ${n}: ${a.join(",")}`);if(i.validateSchema&&!i.validateSchema(e[n])){let e=`keyword "${n}" value is invalid at path "${s}": `+r.errorsText(i.validateSchema.errors);if("log"===t.validateSchema)r.logger.error(e);else throw Error(e)}}},3826(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;let s=r(8994),i=r(7218);t.getSubschema=function(e,{keyword:t,schemaProp:r,schema:n,schemaPath:a,errSchemaPath:o,topSchemaRef:l}){if(void 0!==t&&void 0!==n)throw Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==t){let n=e.schema[t];return void 0===r?{schema:n,schemaPath:(0,s._)`${e.schemaPath}${(0,s.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:n[r],schemaPath:(0,s._)`${e.schemaPath}${(0,s.getProperty)(t)}${(0,s.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,i.escapeFragment)(r)}`}}if(void 0!==n){if(void 0===a||void 0===o||void 0===l)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:a,topSchemaRef:l,errSchemaPath:o}}throw Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(e,t,{dataProp:r,dataPropType:n,data:a,dataTypes:o,propertyName:l}){if(void 0!==a&&void 0!==r)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:u}=t;if(void 0!==r){let{errorPath:a,dataPathArr:o,opts:l}=t;c(u.let("data",(0,s._)`${t.data}${(0,s.getProperty)(r)}`,!0)),e.errorPath=(0,s.str)`${a}${(0,i.getErrorPath)(r,n,l.jsPropertySyntax)}`,e.parentDataProperty=(0,s._)`${r}`,e.dataPathArr=[...o,e.parentDataProperty]}function c(r){e.data=r,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,r]}void 0!==a&&(c(a instanceof s.Name?a:u.let("data",a,!0)),void 0!==l&&(e.propertyName=l)),o&&(e.dataTypes=o)},t.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:s,createErrors:i,allErrors:n}){void 0!==s&&(e.compositeRule=s),void 0!==i&&(e.createErrors=i),void 0!==n&&(e.allErrors=n),e.jtdDiscriminator=t,e.jtdMetadata=r}},1967(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var s=r(6023);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return s.KeywordCxt}});var i=r(8994);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return i._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return i.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return i.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return i.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return i.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return i.CodeGen}});let n=r(4383),a=r(4220),o=r(6247),l=r(1688),u=r(8994),c=r(9008),d=r(6419),p=r(7218),f=r(114),h=r(8951),m=(e,t)=>new RegExp(e,t);m.code="new RegExp";let y=["removeAdditional","useDefaults","coerceTypes"],g=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),v={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."},_={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};class b{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...function(e){var t,r,s,i,n,a,o,l,u,c,d,p,f,y,g,v,_,b,w,$,E,k,S,x,T;let O=e.strict,P=null==(t=e.code)?void 0:t.optimize,I=!0===P||void 0===P?1:P||0,j=null!=(s=null==(r=e.code)?void 0:r.regExp)?s:m,N=null!=(i=e.uriResolver)?i:h.default;return{strictSchema:null==(a=null!=(n=e.strictSchema)?n:O)||a,strictNumbers:null==(l=null!=(o=e.strictNumbers)?o:O)||l,strictTypes:null!=(c=null!=(u=e.strictTypes)?u:O)?c:"log",strictTuples:null!=(p=null!=(d=e.strictTuples)?d:O)?p:"log",strictRequired:null!=(y=null!=(f=e.strictRequired)?f:O)&&y,code:e.code?{...e.code,optimize:I,regExp:j}:{optimize:I,regExp:j},loopRequired:null!=(g=e.loopRequired)?g:200,loopEnum:null!=(v=e.loopEnum)?v:200,meta:null==(_=e.meta)||_,messages:null==(b=e.messages)||b,inlineRefs:null==(w=e.inlineRefs)||w,schemaId:null!=($=e.schemaId)?$:"$id",addUsedSchema:null==(E=e.addUsedSchema)||E,validateSchema:null==(k=e.validateSchema)||k,validateFormats:null==(S=e.validateFormats)||S,unicodeRegExp:null==(x=e.unicodeRegExp)||x,int32range:null==(T=e.int32range)||T,uriResolver:N}}(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new u.ValueScope({scope:{},prefixes:g,es5:t,lines:r}),this.logger=function(e){if(!1===e)return T;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}(e.logger);const s=e.validateFormats;e.validateFormats=!1,this.RULES=(0,o.getRules)(),w.call(this,v,e,"NOT SUPPORTED"),w.call(this,_,e,"DEPRECATED","warn"),this._metaOpts=x.call(this),e.formats&&k.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&S.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),E.call(this),e.validateFormats=s}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,s=f;"id"===r&&((s={...f}).id=s.$id,delete s.$id),t&&e&&this.addMetaSchema(s,s[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let r;if("string"==typeof e){if(!(r=this.getSchema(e)))throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let s=r(t);return"$async"in r||(this.errors=r.errors),s}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return s.call(this,e,t);async function s(e,t){await i.call(this,e.$schema);let r=this._addSchema(e,t);return r.validate||n.call(this,r)}async function i(e){e&&!this.getSchema(e)&&await s.call(this,{$ref:e},!0)}async function n(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof a.default))throw t;return o.call(this,t),await l.call(this,t.missingSchema),n.call(this,e)}}function o({missingSchema:e,missingRef:t}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function l(e){let r=await u.call(this,e);this.refs[e]||await i.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function u(e){let t=this._loading[e];if(t)return t;try{return await (this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,s=this.opts.validateSchema){let i;if(Array.isArray(e)){for(let t of e)this.addSchema(t,void 0,r,s);return this}if("object"==typeof e){let{schemaId:t}=this.opts;if(void 0!==(i=e[t])&&"string"!=typeof i)throw Error(`schema ${t} must be string`)}return t=(0,c.normalizeId)(t||i),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,s,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){let r;if("boolean"==typeof e)return!0;if(void 0!==(r=e.$schema)&&"string"!=typeof r)throw Error("$schema must be a string");if(!(r=r||this.opts.defaultMeta||this.defaultMeta()))return this.logger.warn("meta-schema not available"),this.errors=null,!0;let s=this.validate(r,e);if(!s&&t){let e="schema is invalid: "+this.errorsText();if("log"===this.opts.validateSchema)this.logger.error(e);else throw Error(e)}return s}getSchema(e){let t;for(;"string"==typeof(t=$.call(this,e));)e=t;if(void 0===t){let{schemaId:r}=this.opts,s=new l.SchemaEnv({schema:{},schemaId:r});if(!(t=l.resolveSchema.call(this,s,e)))return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=$.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{this._cache.delete(e);let t=e[this.opts.schemaId];return t&&(t=(0,c.normalizeId)(t),delete this.schemas[t],delete this.refs[t]),this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if("string"==typeof e)r=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r);else if("object"==typeof e&&void 0===t){if(Array.isArray(r=(t=e).keyword)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(P.call(this,r,t),!t)return(0,p.eachItem)(r,e=>I.call(this,e)),this;N.call(this,t);let s={...t,type:(0,d.getJSONTypes)(t.type),schemaType:(0,d.getJSONTypes)(t.schemaType)};return(0,p.eachItem)(r,0===s.type.length?e=>I.call(this,e,s):e=>s.type.forEach(t=>I.call(this,e,s,t))),this}getKeyword(e){let t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;for(let r of(delete t.keywords[e],delete t.all[e],t.rules)){let t=r.rules.findIndex(t=>t.keyword===e);t>=0&&r.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){return e&&0!==e.length?e.map(e=>`${r}${e.instancePath} ${e.message}`).reduce((e,r)=>e+t+r):"No errors"}$dataMetaSchema(e,t){let r=this.RULES.all;for(let s of(e=JSON.parse(JSON.stringify(e)),t)){let t=s.split("/").slice(1),i=e;for(let e of t)i=i[e];for(let e in r){let t=r[e];if("object"!=typeof t)continue;let{$data:s}=t.definition,n=i[e];s&&n&&(i[e]=C(n))}}return e}_removeAllSchemas(e,t){for(let r in e){let s=e[r];(!t||t.test(r))&&("string"==typeof s?delete e[r]:s&&!s.meta&&(this._cache.delete(s.schema),delete e[r]))}}_addSchema(e,t,r,s=this.opts.validateSchema,i=this.opts.addUsedSchema){let n,{schemaId:a}=this.opts;if("object"==typeof e)n=e[a];else if(this.opts.jtd)throw Error("schema must be object");else if("boolean"!=typeof e)throw Error("schema must be object or boolean");let o=this._cache.get(e);if(void 0!==o)return o;r=(0,c.normalizeId)(n||r);let u=c.getSchemaRefs.call(this,e,r);return o=new l.SchemaEnv({schema:e,schemaId:a,meta:t,baseId:r,localRefs:u}),this._cache.set(o.schema,o),i&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=o),s&&this.validateSchema(e,!0),o}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):l.compileSchema.call(this,e),!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{l.compileSchema.call(this,e)}finally{this.opts=t}}}function w(e,t,r,s="error"){for(let i in e)i in t&&this.logger[s](`${r}: option ${i}. ${e[i]}`)}function $(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function E(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function k(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function S(e){if(Array.isArray(e))return void this.addVocabulary(e);for(let t in this.logger.warn("keywords option as map is deprecated, pass array"),e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function x(){let e={...this.opts};for(let t of y)delete e[t];return e}b.ValidationError=n.default,b.MissingRefError=a.default,t.default=b;let T={log(){},warn(){},error(){}},O=/^[a-z_$][a-z0-9_$:-]*$/i;function P(e,t){let{RULES:r}=this;if((0,p.eachItem)(e,e=>{if(r.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!O.test(e))throw Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!("code"in t||"validate"in t))throw Error('$data keyword must have "code" or "validate" function')}function I(e,t,r){var s;let i=null==t?void 0:t.post;if(r&&i)throw Error('keyword with "post" flag cannot have "type"');let{RULES:n}=this,a=i?n.post:n.rules.find(({type:e})=>e===r);if(a||(a={type:r,rules:[]},n.rules.push(a)),n.keywords[e]=!0,!t)return;let o={keyword:e,definition:{...t,type:(0,d.getJSONTypes)(t.type),schemaType:(0,d.getJSONTypes)(t.schemaType)}};t.before?j.call(this,a,o,t.before):a.rules.push(o),n.all[e]=o,null==(s=t.implements)||s.forEach(e=>this.addKeyword(e))}function j(e,t,r){let s=e.rules.findIndex(e=>e.keyword===r);s>=0?e.rules.splice(s,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function N(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=C(t)),e.validateSchema=this.compile(t,!0))}let R={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function C(e){return{anyOf:[e,R]}}},6013(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(7371);s.code='require("ajv/dist/runtime/equal").default',t.default=s},5532(e,t){"use strict";function r(e){let t,r=e.length,s=0,i=0;for(;i<r;)s++,(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<r&&(64512&(t=e.charCodeAt(i)))==56320&&i++;return s}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,r.code='require("ajv/dist/runtime/ucs2length").default'},8951(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(7980);s.code='require("ajv/dist/runtime/uri").default',t.default=s},4383(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}},714(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;let s=r(8994),i=r(7218);function n(e,t){let{gen:r,schema:n,data:a,keyword:o,it:l}=e;l.items=!0;let u=r.const("len",(0,s._)`${a}.length`);if(!1===n)e.setParams({len:t.length}),e.pass((0,s._)`${u} <= ${t.length}`);else if("object"==typeof n&&!(0,i.alwaysValidSchema)(l,n)){let n=r.var("valid",(0,s._)`${u} <= ${t.length}`);r.if((0,s.not)(n),()=>{var a;return a=n,void r.forRange("i",t.length,u,t=>{e.subschema({keyword:o,dataProp:t,dataPropType:i.Type.Num},a),l.allErrors||r.if((0,s.not)(a),()=>r.break())})}),e.ok(n)}}t.validateAdditionalItems=n,t.default={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,s.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,s._)`{limit: ${e}}`},code(e){let{parentSchema:t,it:r}=e,{items:s}=t;Array.isArray(s)?n(e,s):(0,i.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas')}}},8401(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(4954),i=r(8994),n=r(6660),a=r(7218);t.default={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>(0,i._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:t,schema:r,parentSchema:o,data:l,errsCount:u,it:c}=e;if(!u)throw Error("ajv implementation error");let{allErrors:d,opts:p}=c;if(c.props=!0,"all"!==p.removeAdditional&&(0,a.alwaysValidSchema)(c,r))return;let f=(0,s.allSchemaProperties)(o.properties),h=(0,s.allSchemaProperties)(o.patternProperties);function m(e){t.code((0,i._)`delete ${l}[${e}]`)}function y(s){if("all"===p.removeAdditional||p.removeAdditional&&!1===r)return void m(s);if(!1===r){e.setParams({additionalProperty:s}),e.error(),d||t.break();return}if("object"==typeof r&&!(0,a.alwaysValidSchema)(c,r)){let r=t.name("valid");"failing"===p.removeAdditional?(g(s,r,!1),t.if((0,i.not)(r),()=>{e.reset(),m(s)})):(g(s,r),d||t.if((0,i.not)(r),()=>t.break()))}}function g(t,r,s){let i={keyword:"additionalProperties",dataProp:t,dataPropType:a.Type.Str};!1===s&&Object.assign(i,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(i,r)}t.forIn("key",l,r=>{f.length||h.length?t.if(function(r){let n;if(f.length>8){let e=(0,a.schemaRefOrVal)(c,o.properties,"properties");n=(0,s.isOwnProperty)(t,e,r)}else n=f.length?(0,i.or)(...f.map(e=>(0,i._)`${r} === ${e}`)):i.nil;return h.length&&(n=(0,i.or)(n,...h.map(t=>(0,i._)`${(0,s.usePattern)(e,t)}.test(${r})`))),(0,i.not)(n)}(r),()=>y(r)):y(r)}),e.ok((0,i._)`${u} === ${n.default.errors}`)}}},2003(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(7218);t.default={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:i}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let n=t.name("valid");r.forEach((t,r)=>{if((0,s.alwaysValidSchema)(i,t))return;let a=e.subschema({keyword:"allOf",schemaProp:r},n);e.ok(n),e.mergeEvaluated(a)})}}},1070(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:r(4954).validateUnion,error:{message:"must match a schema in anyOf"}}},2692(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994),i=r(7218);t.default={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>void 0===t?(0,s.str)`must contain at least ${e} valid item(s)`:(0,s.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?(0,s._)`{minContains: ${e}}`:(0,s._)`{minContains: ${e}, maxContains: ${t}}`},code(e){let t,r,{gen:n,schema:a,parentSchema:o,data:l,it:u}=e,{minContains:c,maxContains:d}=o;u.opts.next?(t=void 0===c?1:c,r=d):t=1;let p=n.const("len",(0,s._)`${l}.length`);if(e.setParams({min:t,max:r}),void 0===r&&0===t)return void(0,i.checkStrictMode)(u,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==r&&t>r){(0,i.checkStrictMode)(u,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,i.alwaysValidSchema)(u,a)){let i=(0,s._)`${p} >= ${t}`;void 0!==r&&(i=(0,s._)`${i} && ${p} <= ${r}`),e.pass(i);return}u.items=!0;let f=n.name("valid");function h(){let e=n.name("_valid"),i=n.let("count",0);m(e,()=>n.if(e,()=>{var e;return e=i,void(n.code((0,s._)`${e}++`),void 0===r?n.if((0,s._)`${e} >= ${t}`,()=>n.assign(f,!0).break()):(n.if((0,s._)`${e} > ${r}`,()=>n.assign(f,!1).break()),1===t?n.assign(f,!0):n.if((0,s._)`${e} >= ${t}`,()=>n.assign(f,!0))))}))}function m(t,r){n.forRange("i",0,p,s=>{e.subschema({keyword:"contains",dataProp:s,dataPropType:i.Type.Num,compositeRule:!0},t),r()})}void 0===r&&1===t?m(f,()=>n.if(f,()=>n.break())):0===t?(n.let(f,!0),void 0!==r&&n.if((0,s._)`${l}.length > 0`,h)):(n.let(f,!1),h()),e.result(f,()=>e.reset())}}},5860(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;let s=r(8994),i=r(7218),n=r(4954);t.error={message:({params:{property:e,depsCount:t,deps:r}})=>(0,s.str)`must have ${1===t?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:i}})=>(0,s._)`{property: ${e},
|
|
5
|
-
missingProperty: ${
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("zod/v3"));else if("function"==typeof define&&define.amd)define(["zod/v3"],t);else{var r="object"==typeof exports?t(require("zod/v3")):t(e["zod/v3"]);for(var s in r)("object"==typeof exports?exports:e)[s]=r[s]}}(this,e=>(()=>{var t,r,s={5888(e,t){"use strict";function r(e,t){return{validate:e,compare:t}}Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0,t.fullFormats={date:r(i,n),time:r(l(!0),u),"date-time":r(p(!0),f),"iso-time":r(l(),c),"iso-date-time":r(p(),h),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(e){return m.test(e)&&y.test(e)},"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(e){if(w.test(e))return!1;try{return new RegExp(e),!0}catch(e){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(e){return g.lastIndex=0,g.test(e)},int32:{type:"number",validate:function(e){return Number.isInteger(e)&&e<=_&&e>=v}},int64:{type:"number",validate:function(e){return Number.isInteger(e)}},float:{type:"number",validate:b},double:{type:"number",validate:b},password:!0,binary:!0},t.fastFormats={...t.fullFormats,date:r(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,n),time:r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,u),"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,f),"iso-time":r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,c),"iso-date-time":r(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,h),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},t.formatNames=Object.keys(t.fullFormats);let s=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,o=[0,31,28,31,30,31,30,31,31,30,31,30,31];function i(e){var t;let r=s.exec(e);if(!r)return!1;let i=+r[1],n=+r[2],a=+r[3];return n>=1&&n<=12&&a>=1&&a<=(2===n&&(t=i)%4==0&&(t%100!=0||t%400==0)?29:o[n])}function n(e,t){if(e&&t)return e>t?1:e<t?-1:0}let a=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function l(e){return function(t){let r=a.exec(t);if(!r)return!1;let s=+r[1],o=+r[2],i=+r[3],n=r[4],l="-"===r[5]?-1:1,u=+(r[6]||0),c=+(r[7]||0);if(u>23||c>59||e&&!n)return!1;if(s<=23&&o<=59&&i<60)return!0;let d=o-c*l,p=s-u*l-(d<0);return(23===p||-1===p)&&(59===d||-1===d)&&i<61}}function u(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),s=new Date("2020-01-01T"+t).valueOf();if(r&&s)return r-s}function c(e,t){if(!(e&&t))return;let r=a.exec(e),s=a.exec(t);if(r&&s)return(e=r[1]+r[2]+r[3])>(t=s[1]+s[2]+s[3])?1:e<t?-1:0}let d=/t|\s/i;function p(e){let t=l(e);return function(e){let r=e.split(d);return 2===r.length&&i(r[0])&&t(r[1])}}function f(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),s=new Date(t).valueOf();if(r&&s)return r-s}function h(e,t){if(!(e&&t))return;let[r,s]=e.split(d),[o,i]=t.split(d),a=n(r,o);if(void 0!==a)return a||u(s,i)}let m=/\/|:/,y=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,g=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm,v=-0x80000000,_=0x80000000-1;function b(){return!0}let w=/[^\\]\\Z/},1712(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(5888),o=r(9035),i=r(8994),n=new i.Name("fullFormats"),a=new i.Name("fastFormats"),l=(e,t={keywords:!0})=>{if(Array.isArray(t))return u(e,t,s.fullFormats,n),e;let[r,i]="fast"===t.mode?[s.fastFormats,a]:[s.fullFormats,n];return u(e,t.formats||s.formatNames,r,i),t.keywords&&(0,o.default)(e),e};function u(e,t,r,s){var o;for(let n of(null!=(o=e.opts.code).formats||(o.formats=(0,i._)`require("ajv-formats/dist/formats").${s}`),t))e.addFormat(n,r[n])}l.get=(e,t="full")=>{let r=("fast"===t?s.fastFormats:s.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r},e.exports=t=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l},9035(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;let s=r(8825),o=r(8994),i=o.operators,n={formatMaximum:{okStr:"<=",ok:i.LTE,fail:i.GT},formatMinimum:{okStr:">=",ok:i.GTE,fail:i.LT},formatExclusiveMaximum:{okStr:"<",ok:i.LT,fail:i.GTE},formatExclusiveMinimum:{okStr:">",ok:i.GT,fail:i.LTE}};t.formatLimitDefinition={keyword:Object.keys(n),type:"string",schemaType:"string",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,o.str)`should be ${n[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,o._)`{comparison: ${n[e].okStr}, limit: ${t}}`},code(e){let t,r,{gen:i,data:a,schemaCode:l,keyword:u,it:c}=e,{opts:d,self:p}=c;if(!d.validateFormats)return;let f=new s.KeywordCxt(c,p.RULES.all.format.definition,"format");function h(e){return(0,o._)`${e}.compare(${a}, ${l}) ${n[u].fail} 0`}f.$data?(t=i.scopeValue("formats",{ref:p.formats,code:d.code.formats}),r=i.const("fmt",(0,o._)`${t}[${f.schemaCode}]`),e.fail$data((0,o.or)((0,o._)`typeof ${r} != "object"`,(0,o._)`${r} instanceof RegExp`,(0,o._)`typeof ${r}.compare != "function"`,h(r)))):function(){let t=f.schema,r=p.formats[t];if(!r||!0===r)return;if("object"!=typeof r||r instanceof RegExp||"function"!=typeof r.compare)throw Error(`"${u}": format "${t}" does not define "compare" function`);let s=i.scopeValue("formats",{key:t,ref:r,code:d.code.formats?(0,o._)`${d.code.formats}${(0,o.getProperty)(t)}`:void 0});e.fail$data(h(s))}()},dependencies:["format"]},t.default=e=>(e.addKeyword(t.formatLimitDefinition),e)},8825(e,t,r){"use strict";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 s=r(1967),o=r(3959),i=r(9376),n=r(7456),a=["/properties"],l="http://json-schema.org/draft-07/schema";class u extends s.default{_addVocabularies(){super._addVocabularies(),o.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(n,a):n;this.addMetaSchema(e,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=u,e.exports=t=u,e.exports.Ajv=u,Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var c=r(6023);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var d=r(8994);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=r(4383);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return p.default}});var f=r(4220);Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return f.default}})},8261(e,t){"use strict";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;class r{}t._CodeOrName=r,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class s extends r{constructor(e){if(super(),!t.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=s;class o extends r{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return""===e||'""'===e}get str(){var e;return null!=(e=this._str)?e:this._str=this._items.reduce((e,t)=>`${e}${t}`,"")}get names(){var e;return null!=(e=this._names)?e:this._names=this._items.reduce((e,t)=>(t instanceof s&&(e[t.str]=(e[t.str]||0)+1),e),{})}}function i(e,...t){let r=[e[0]],s=0;for(;s<t.length;)l(r,t[s]),r.push(e[++s]);return new o(r)}t._Code=o,t.nil=new o(""),t._=i;let n=new o("+");function a(e,...t){let r=[u(e[0])],i=0;for(;i<t.length;)r.push(n),l(r,t[i]),r.push(n,u(e[++i]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===n){var r,o;let i=(r=e[t-1],'""'===(o=e[t+1])?r:'""'===r?o:"string"==typeof r?o instanceof s||'"'!==r[r.length-1]?void 0:"string"!=typeof o?`${r.slice(0,-1)}${o}"`:'"'===o[0]?r.slice(0,-1)+o.slice(1):void 0:"string"!=typeof o||'"'!==o[0]||r instanceof s?void 0:`"${r}${o.slice(1)}`);if(void 0!==i){e.splice(t-1,3,i);continue}e[t++]="+"}t++}}(r),new o(r)}function l(e,t){var r;t instanceof o?e.push(...t._items):t instanceof s?e.push(t):e.push("number"==typeof(r=t)||"boolean"==typeof r||null===r?r:u(Array.isArray(r)?r.join(","):r))}function u(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.str=a,t.addCodeArg=l,t.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:a`${e}${t}`},t.stringify=function(e){return new o(u(e))},t.safeStringify=u,t.getProperty=function(e){return"string"==typeof e&&t.IDENTIFIER.test(e)?new o(`.${e}`):i`[${e}]`},t.getEsmExportName=function(e){if("string"==typeof e&&t.IDENTIFIER.test(e))return new o(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)},t.regexpCode=function(e){return new o(e.toString())}},8994(e,t,r){"use strict";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 s=r(8261),o=r(4490);var i=r(8261);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return i._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return i.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return i.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return i.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return i.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return i.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return i.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return i.Name}});var n=r(4490);Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return n.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return n.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return n.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return n.varKinds}}),t.operators={GT:new s._Code(">"),GTE:new s._Code(">="),LT:new s._Code("<"),LTE:new s._Code("<="),EQ:new s._Code("==="),NEQ:new s._Code("!=="),NOT:new s._Code("!"),OR:new s._Code("||"),AND:new s._Code("&&"),ADD:new s._Code("+")};class a{optimizeNodes(){return this}optimizeNames(e,t){return this}}class l extends a{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?o.varKinds.var:this.varKind,s=void 0===this.rhs?"":` = ${this.rhs}`;return`${r} ${this.name}${s};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=j(this.rhs,e,t)),this}get names(){return this.rhs instanceof s._CodeOrName?this.rhs.names:{}}}class u extends a{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(!(this.lhs instanceof s.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=j(this.rhs,e,t),this}get names(){return I(this.lhs instanceof s.Name?{}:{...this.lhs.names},this.rhs)}}class c extends u{constructor(e,t,r,s){super(e,r,s),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class d extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class p extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){let t=this.label?` ${this.label}`:"";return`break${t};`+e}}class f extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class h extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=j(this.code,e,t),this}get names(){return this.code instanceof s._CodeOrName?this.code.names:{}}}class m extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,s=r.length;for(;s--;){let o=r[s];o.optimizeNames(e,t)||(function(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}(e,o.names),r.splice(s,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>O(e,t.names),{})}}class y extends m{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class g extends m{}class v extends y{}v.kind="else";class _ extends y{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){let e=t.optimizeNodes();t=this.else=Array.isArray(e)?new v(e):e}return t?!1===e?t instanceof _?t:t.nodes:this.nodes.length?this:new _(R(e),t instanceof _?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var r;if(this.else=null==(r=this.else)?void 0:r.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=j(this.condition,e,t),this}get names(){let e=super.names;return I(e,this.condition),this.else&&O(e,this.else.names),e}}_.kind="if";class b extends y{}b.kind="for";class w extends b{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=j(this.iteration,e,t),this}get names(){return O(super.names,this.iteration.names)}}class $ extends b{constructor(e,t,r,s){super(),this.varKind=e,this.name=t,this.from=r,this.to=s}render(e){let t=e.es5?o.varKinds.var:this.varKind,{name:r,from:s,to:i}=this;return`for(${t} ${r}=${s}; ${r}<${i}; ${r}++)`+super.render(e)}get names(){let e=I(super.names,this.from);return I(e,this.to)}}class E extends b{constructor(e,t,r,s){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=s}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=j(this.iterable,e,t),this}get names(){return O(super.names,this.iterable.names)}}class k extends y{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){let t=this.async?"async ":"";return`${t}function ${this.name}(${this.args})`+super.render(e)}}k.kind="func";class S extends m{render(e){return"return "+super.render(e)}}S.kind="return";class T extends y{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null==(e=this.catch)||e.optimizeNodes(),null==(t=this.finally)||t.optimizeNodes(),this}optimizeNames(e,t){var r,s;return super.optimizeNames(e,t),null==(r=this.catch)||r.optimizeNames(e,t),null==(s=this.finally)||s.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&O(e,this.catch.names),this.finally&&O(e,this.finally.names),e}}class x extends y{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}x.kind="catch";class P extends y{render(e){return"finally"+super.render(e)}}function O(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function I(e,t){return t instanceof s._CodeOrName?O(e,t.names):e}function j(e,t,r){var o;if(e instanceof s.Name)return i(e);if(!((o=e)instanceof s._Code&&o._items.some(e=>e instanceof s.Name&&1===t[e.str]&&void 0!==r[e.str])))return e;return new s._Code(e._items.reduce((e,t)=>(t instanceof s.Name&&(t=i(t)),t instanceof s._Code?e.push(...t._items):e.push(t),e),[]));function i(e){let s=r[e.str];return void 0===s||1!==t[e.str]?e:(delete t[e.str],s)}}function R(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:(0,s._)`!${A(e)}`}P.kind="finally",t.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new o.Scope({parent:e}),this._nodes=[new g]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,s){let o=this._scope.toName(t);return void 0!==r&&s&&(this._constants[o.str]=r),this._leafNode(new l(e,o,r)),o}const(e,t,r){return this._def(o.varKinds.const,e,t,r)}let(e,t,r){return this._def(o.varKinds.let,e,t,r)}var(e,t,r){return this._def(o.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new u(e,t,r))}add(e,r){return this._leafNode(new c(e,t.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==s.nil&&this._leafNode(new h(e)),this}object(...e){let t=["{"];for(let[r,o]of e)t.length>1&&t.push(","),t.push(r),(r!==o||this.opts.es5)&&(t.push(":"),(0,s.addCodeArg)(t,o));return t.push("}"),new s._Code(t)}if(e,t,r){if(this._blockNode(new _(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new _(e))}else(){return this._elseNode(new v)}endIf(){return this._endBlockNode(_,v)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new w(e),t)}forRange(e,t,r,s,i=this.opts.es5?o.varKinds.var:o.varKinds.let){let n=this._scope.toName(e);return this._for(new $(i,n,t,r),()=>s(n))}forOf(e,t,r,i=o.varKinds.const){let n=this._scope.toName(e);if(this.opts.es5){let e=t instanceof s.Name?t:this.var("_arr",t);return this.forRange("_i",0,(0,s._)`${e}.length`,t=>{this.var(n,(0,s._)`${e}[${t}]`),r(n)})}return this._for(new E("of",i,n,t),()=>r(n))}forIn(e,t,r,i=this.opts.es5?o.varKinds.var:o.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,s._)`Object.keys(${t})`,r);let n=this._scope.toName(e);return this._for(new E("in",i,n,t),()=>r(n))}endFor(){return this._endBlockNode(b)}label(e){return this._leafNode(new d(e))}break(e){return this._leafNode(new p(e))}return(e){let t=new S;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(S)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let s=new T;if(this._blockNode(s),this.code(e),t){let e=this.name("e");this._currNode=s.catch=new x(e),t(e)}return r&&(this._currNode=s.finally=new P,this.code(r)),this._endBlockNode(x,P)}throw(e){return this._leafNode(new f(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(void 0===t)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=s.nil,r,o){return this._blockNode(new k(e,t,r)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(k)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof _))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}},t.not=R;let N=C(t.operators.AND);t.and=function(...e){return e.reduce(N)};let z=C(t.operators.OR);function C(e){return(t,r)=>t===s.nil?r:r===s.nil?t:(0,s._)`${A(t)} ${e} ${A(r)}`}function A(e){return e instanceof s.Name?e:(0,s._)`(${e})`}t.or=function(...e){return e.reduce(z)}},4490(e,t,r){"use strict";var s,o;Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;let i=r(8261);class n extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}(o=s||(t.UsedValueState=s={}))[o.Started=0]="Started",o[o.Completed=1]="Completed",t.varKinds={const:new i.Name("const"),let:new i.Name("let"),var:new i.Name("var")};class a{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof i.Name?e:this.name(e)}name(e){return new i.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if((null==(r=null==(t=this._parent)?void 0:t._prefixes)?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}t.Scope=a;class l extends i.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=(0,i._)`.${new i.Name(t)}[${r}]`}}t.ValueScopeName=l;let u=(0,i._)`\n`;t.ValueScope=class extends a{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?u:i.nil}}get(){return this._scope}name(e){return new l(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw Error("CodeGen: ref must be passed in value");let s=this.toName(e),{prefix:o}=s,i=null!=(r=t.key)?r:t.ref,n=this._values[o];if(n){let e=n.get(i);if(e)return e}else n=this._values[o]=new Map;n.set(i,s);let a=this._scope[o]||(this._scope[o]=[]),l=a.length;return a[l]=t.ref,s.setValue(t,{property:o,itemIndex:l}),s}getValue(e,t){let r=this._values[e];if(r)return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,t=>{if(void 0===t.scopePath)throw Error(`CodeGen: name "${t}" has no value`);return(0,i._)`${e}${t.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,e=>{if(void 0===e.value)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,r)}_reduceValues(e,r,o={},a){let l=i.nil;for(let u in e){let c=e[u];if(!c)continue;let d=o[u]=o[u]||new Map;c.forEach(e=>{if(d.has(e))return;d.set(e,s.Started);let o=r(e);if(o){let r=this.opts.es5?t.varKinds.var:t.varKinds.const;l=(0,i._)`${l}${r} ${e} = ${o};${this.opts._n}`}else if(o=null==a?void 0:a(e))l=(0,i._)`${l}${o}${this.opts._n}`;else throw new n(e);d.set(e,s.Completed)})}return l}}},8425(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;let s=r(8994),o=r(7218),i=r(6660);function n(e,t){let r=e.const("err",t);e.if((0,s._)`${i.default.vErrors} === null`,()=>e.assign(i.default.vErrors,(0,s._)`[${r}]`),(0,s._)`${i.default.vErrors}.push(${r})`),e.code((0,s._)`${i.default.errors}++`)}function a(e,t){let{gen:r,validateName:o,schemaEnv:i}=e;i.$async?r.throw((0,s._)`new ${e.ValidationError}(${t})`):(r.assign((0,s._)`${o}.errors`,t),r.return(!1))}t.keywordError={message:({keyword:e})=>(0,s.str)`must pass "${e}" keyword validation`},t.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,s.str)`"${e}" keyword must be ${t} ($data)`:(0,s.str)`"${e}" keyword is invalid ($data)`},t.reportError=function(e,r=t.keywordError,o,i){let{it:l}=e,{gen:c,compositeRule:d,allErrors:p}=l,f=u(e,r,o);(null!=i?i:d||p)?n(c,f):a(l,(0,s._)`[${f}]`)},t.reportExtraError=function(e,r=t.keywordError,s){let{it:o}=e,{gen:l,compositeRule:c,allErrors:d}=o;n(l,u(e,r,s)),c||d||a(o,i.default.vErrors)},t.resetErrorsCount=function(e,t){e.assign(i.default.errors,t),e.if((0,s._)`${i.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,s._)`${i.default.vErrors}.length`,t),()=>e.assign(i.default.vErrors,null)))},t.extendErrors=function({gen:e,keyword:t,schemaValue:r,data:o,errsCount:n,it:a}){if(void 0===n)throw Error("ajv implementation error");let l=e.name("err");e.forRange("i",n,i.default.errors,n=>{e.const(l,(0,s._)`${i.default.vErrors}[${n}]`),e.if((0,s._)`${l}.instancePath === undefined`,()=>e.assign((0,s._)`${l}.instancePath`,(0,s.strConcat)(i.default.instancePath,a.errorPath))),e.assign((0,s._)`${l}.schemaPath`,(0,s.str)`${a.errSchemaPath}/${t}`),a.opts.verbose&&(e.assign((0,s._)`${l}.schema`,r),e.assign((0,s._)`${l}.data`,o))})};let l={keyword:new s.Name("keyword"),schemaPath:new s.Name("schemaPath"),params:new s.Name("params"),propertyName:new s.Name("propertyName"),message:new s.Name("message"),schema:new s.Name("schema"),parentSchema:new s.Name("parentSchema")};function u(e,t,r){let{createErrors:n}=e.it;return!1===n?(0,s._)`{}`:function(e,t,r={}){let{gen:n,it:a}=e,u=[function({errorPath:e},{instancePath:t}){let r=t?(0,s.str)`${e}${(0,o.getErrorPath)(t,o.Type.Str)}`:e;return[i.default.instancePath,(0,s.strConcat)(i.default.instancePath,r)]}(a,r),function({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:i}){let n=i?t:(0,s.str)`${t}/${e}`;return r&&(n=(0,s.str)`${n}${(0,o.getErrorPath)(r,o.Type.Str)}`),[l.schemaPath,n]}(e,r)];return function(e,{params:t,message:r},o){let{keyword:n,data:a,schemaValue:u,it:c}=e,{opts:d,propertyName:p,topSchemaRef:f,schemaPath:h}=c;o.push([l.keyword,n],[l.params,"function"==typeof t?t(e):t||(0,s._)`{}`]),d.messages&&o.push([l.message,"function"==typeof r?r(e):r]),d.verbose&&o.push([l.schema,u],[l.parentSchema,(0,s._)`${f}${h}`],[i.default.data,a]),p&&o.push([l.propertyName,p])}(e,t,u),n.object(...u)}(e,t,r)}},1688(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;let s=r(8994),o=r(4383),i=r(6660),n=r(9008),a=r(7218),l=r(6023);class u{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!=(t=e.baseId)?t:(0,n.normalizeId)(null==r?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}}function c(e){let t,r,a=p.call(this,e);if(a)return a;let u=(0,n.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:c,lines:d}=this.opts.code,{ownProperties:f}=this.opts,h=new s.CodeGen(this.scope,{es5:c,lines:d,ownProperties:f});e.$async&&(t=h.scopeValue("Error",{ref:o.default,code:(0,s._)`require("ajv/dist/runtime/validation_error").default`}));let m=h.scopeName("validate");e.validateName=m;let y={gen:h,allErrors:this.opts.allErrors,data:i.default.data,parentData:i.default.parentData,parentDataProperty:i.default.parentDataProperty,dataNames:[i.default.data],dataPathArr:[s.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:h.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,s.stringify)(e.schema)}:{ref:e.schema}),validateName:m,ValidationError:t,schema:e.schema,schemaEnv:e,rootId:u,baseId:e.baseId||u,schemaPath:s.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,s._)`""`,opts:this.opts,self:this};try{this._compilations.add(e),(0,l.validateFunctionCode)(y),h.optimize(this.opts.code.optimize);let t=h.toString();r=`${h.scopeRefs(i.default.scope)}return ${t}`,this.opts.code.process&&(r=this.opts.code.process(r,e));let o=Function(`${i.default.self}`,`${i.default.scope}`,r)(this,this.scope.get());if(this.scope.value(m,{ref:o}),o.errors=null,o.schema=e.schema,o.schemaEnv=e,e.$async&&(o.$async=!0),!0===this.opts.code.source&&(o.source={validateName:m,validateCode:t,scopeValues:h._values}),this.opts.unevaluated){let{props:e,items:t}=y;o.evaluated={props:e instanceof s.Name?void 0:e,items:t instanceof s.Name?void 0:t,dynamicProps:e instanceof s.Name,dynamicItems:t instanceof s.Name},o.source&&(o.source.evaluated=(0,s.stringify)(o.evaluated))}return e.validate=o,e}catch(t){throw delete e.validate,delete e.validateName,r&&this.logger.error("Error compiling schema, function code:",r),t}finally{this._compilations.delete(e)}}function d(e){return(0,n.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:c.call(this,e)}function p(e){for(let s of this._compilations){var t,r;if(t=s,r=e,t.schema===r.schema&&t.root===r.root&&t.baseId===r.baseId)return s}}function f(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||h.call(this,e,t)}function h(e,t){let r=this.opts.uriResolver.parse(t),s=(0,n._getFullPath)(this.opts.uriResolver,r),o=(0,n.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&s===o)return y.call(this,r,e);let i=(0,n.normalizeId)(s),a=this.refs[i]||this.schemas[i];if("string"==typeof a){let t=h.call(this,e,a);if("object"!=typeof(null==t?void 0:t.schema))return;return y.call(this,r,t)}if("object"==typeof(null==a?void 0:a.schema)){if(a.validate||c.call(this,a),i===(0,n.normalizeId)(t)){let{schema:t}=a,{schemaId:r}=this.opts,s=t[r];return s&&(o=(0,n.resolveUrl)(this.opts.uriResolver,o,s)),new u({schema:t,schemaId:r,root:e,baseId:o})}return y.call(this,r,a)}}t.SchemaEnv=u,t.compileSchema=c,t.resolveRef=function(e,t,r){var s;r=(0,n.resolveUrl)(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let i=f.call(this,e,r);if(void 0===i){let o=null==(s=e.localRefs)?void 0:s[r],{schemaId:n}=this.opts;o&&(i=new u({schema:o,schemaId:n,root:e,baseId:t}))}if(void 0!==i)return e.refs[r]=d.call(this,i)},t.getCompilingSchema=p,t.resolveSchema=h;let m=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function y(e,{baseId:t,schema:r,root:s}){var o;let i;if((null==(o=e.fragment)?void 0:o[0])!=="/")return;for(let s of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;let e=r[(0,a.unescapeFragment)(s)];if(void 0===e)return;let o="object"==typeof(r=e)&&r[this.opts.schemaId];!m.has(s)&&o&&(t=(0,n.resolveUrl)(this.opts.uriResolver,t,o))}if("boolean"!=typeof r&&r.$ref&&!(0,a.schemaHasRulesButRef)(r,this.RULES)){let e=(0,n.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=h.call(this,s,e)}let{schemaId:l}=this.opts;if((i=i||new u({schema:r,schemaId:l,root:s,baseId:t})).schema!==i.root.schema)return i}},6660(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994);t.default={data:new s.Name("data"),valCxt:new s.Name("valCxt"),instancePath:new s.Name("instancePath"),parentData:new s.Name("parentData"),parentDataProperty:new s.Name("parentDataProperty"),rootData:new s.Name("rootData"),dynamicAnchors:new s.Name("dynamicAnchors"),vErrors:new s.Name("vErrors"),errors:new s.Name("errors"),this:new s.Name("this"),self:new s.Name("self"),scope:new s.Name("scope"),json:new s.Name("json"),jsonPos:new s.Name("jsonPos"),jsonLen:new s.Name("jsonLen"),jsonPart:new s.Name("jsonPart")}},4220(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(9008);t.default=class extends Error{constructor(e,t,r,o){super(o||`can't resolve reference ${r} from id ${t}`),this.missingRef=(0,s.resolveUrl)(e,t,r),this.missingSchema=(0,s.normalizeId)((0,s.getFullPath)(e,this.missingRef))}}},9008(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;let s=r(7218),o=r(7371),i=r(205),n=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);t.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!function e(t){for(let r in t){if(a.has(r))return!0;let s=t[r];if(Array.isArray(s)&&s.some(e)||"object"==typeof s&&e(s))return!0}return!1}(e):!!t&&function e(t){let r=0;for(let o in t)if("$ref"===o||(r++,!n.has(o)&&("object"==typeof t[o]&&(0,s.eachItem)(t[o],t=>r+=e(t)),r===1/0)))return 1/0;return r}(e)<=t)};let a=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function l(e,t="",r){!1!==r&&(t=d(t));let s=e.parse(t);return u(e,s)}function u(e,t){return e.serialize(t).split("#")[0]+"#"}t.getFullPath=l,t._getFullPath=u;let c=/#\/?$/;function d(e){return e?e.replace(c,""):""}t.normalizeId=d,t.resolveUrl=function(e,t,r){return r=d(r),e.resolve(t,r)};let p=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};let{schemaId:r,uriResolver:s}=this.opts,n=d(e[r]||t),a={"":n},u=l(s,n,!1),c={},f=new Set;return i(e,{allKeys:!0},(e,t,s,o)=>{if(void 0===o)return;let i=u+t,n=a[o];function l(t){let r=this.opts.uriResolver.resolve;if(t=d(n?r(n,t):t),f.has(t))throw m(t);f.add(t);let s=this.refs[t];return"string"==typeof s&&(s=this.refs[s]),"object"==typeof s?h(e,s.schema,t):t!==d(i)&&("#"===t[0]?(h(e,c[t],t),c[t]=e):this.refs[t]=i),t}function y(e){if("string"==typeof e){if(!p.test(e))throw Error(`invalid anchor "${e}"`);l.call(this,`#${e}`)}}"string"==typeof e[r]&&(n=l.call(this,e[r])),y.call(this,e.$anchor),y.call(this,e.$dynamicAnchor),a[t]=n}),c;function h(e,t,r){if(void 0!==t&&!o(e,t))throw m(r)}function m(e){return Error(`reference "${e}" resolves to more than one schema`)}}},6247(e,t){"use strict";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(e){return"string"==typeof e&&r.has(e)},t.getRules=function(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}},7218(e,t,r){"use strict";var s,o;Object.defineProperty(t,"__esModule",{value:!0}),t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.setEvaluated=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.schemaHasRules=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;let i=r(8994),n=r(8261);function a(e,t=e.schema){let{opts:r,self:s}=e;if(!r.strictSchema||"boolean"==typeof t)return;let o=s.RULES.keywords;for(let r in t)o[r]||m(e,`unknown keyword: "${r}"`)}function l(e,t){if("boolean"==typeof e)return!e;for(let r in e)if(t[r])return!0;return!1}function u(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function c(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function d({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:s}){return(o,n,a,l)=>{let u=void 0===a?n:a instanceof i.Name?(n instanceof i.Name?e(o,n,a):t(o,n,a),a):n instanceof i.Name?(t(o,a,n),n):r(n,a);return l!==i.Name||u instanceof i.Name?u:s(o,u)}}function p(e,t){if(!0===t)return e.var("props",!0);let r=e.var("props",(0,i._)`{}`);return void 0!==t&&f(e,r,t),r}function f(e,t,r){Object.keys(r).forEach(r=>e.assign((0,i._)`${t}${(0,i.getProperty)(r)}`,!0))}t.toHash=function(e){let t={};for(let r of e)t[r]=!0;return t},t.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(a(e,t),!l(t,e.self.RULES.all))},t.checkUnknownRules=a,t.schemaHasRules=l,t.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(let r in e)if("$ref"!==r&&t.all[r])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:e,schemaPath:t},r,s,o){if(!o){if("number"==typeof r||"boolean"==typeof r)return r;if("string"==typeof r)return(0,i._)`${r}`}return(0,i._)`${e}${t}${(0,i.getProperty)(s)}`},t.unescapeFragment=function(e){return c(decodeURIComponent(e))},t.escapeFragment=function(e){return encodeURIComponent(u(e))},t.escapeJsonPointer=u,t.unescapeJsonPointer=c,t.eachItem=function(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)},t.mergeEvaluated={props:d({mergeNames:(e,t,r)=>e.if((0,i._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,i._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,i._)`${r} || {}`).code((0,i._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,i._)`${r} !== true`,()=>{!0===t?e.assign(r,!0):(e.assign(r,(0,i._)`${r} || {}`),f(e,r,t))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:p}),items:d({mergeNames:(e,t,r)=>e.if((0,i._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,i._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,i._)`${r} !== true`,()=>e.assign(r,!0===t||(0,i._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},t.evaluatedPropsToName=p,t.setEvaluated=f;let h={};function m(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw Error(t);e.self.logger.warn(t)}}t.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:h[t.code]||(h[t.code]=new n._Code(t.code))})},(o=s||(t.Type=s={}))[o.Num=0]="Num",o[o.Str=1]="Str",t.getErrorPath=function(e,t,r){if(e instanceof i.Name){let o=t===s.Num;return r?o?(0,i._)`"[" + ${e} + "]"`:(0,i._)`"['" + ${e} + "']"`:o?(0,i._)`"/" + ${e}`:(0,i._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,i.getProperty)(e).toString():"/"+u(e)},t.checkStrictMode=m},238(e,t){"use strict";function r(e,t){return t.rules.some(t=>s(e,t))}function s(e,t){var r;return void 0!==e[t.keyword]||(null==(r=t.definition.implements)?void 0:r.some(t=>void 0!==e[t]))}Object.defineProperty(t,"__esModule",{value:!0}),t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0,t.schemaHasRulesForType=function({schema:e,self:t},s){let o=t.RULES.types[s];return o&&!0!==o&&r(e,o)},t.shouldUseGroup=r,t.shouldUseRule=s},564(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;let s=r(8425),o=r(8994),i=r(6660),n={message:"boolean schema is false"};function a(e,t){let{gen:r,data:o}=e;(0,s.reportError)({gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},n,void 0,t)}t.topBoolOrEmptySchema=function(e){let{gen:t,schema:r,validateName:s}=e;!1===r?a(e,!1):"object"==typeof r&&!0===r.$async?t.return(i.default.data):(t.assign((0,o._)`${s}.errors`,null),t.return(!0))},t.boolOrEmptySchema=function(e,t){let{gen:r,schema:s}=e;!1===s?(r.var(t,!1),a(e)):r.var(t,!0)}},6419(e,t,r){"use strict";var s,o;Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;let i=r(6247),n=r(238),a=r(8425),l=r(8994),u=r(7218);function c(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(i.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}(o=s||(t.DataType=s={}))[o.Correct=0]="Correct",o[o.Wrong=1]="Wrong",t.getSchemaTypes=function(e){let t=c(e.type);if(t.includes("null")){if(!1===e.nullable)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},t.getJSONTypes=c,t.coerceAndCheckDataType=function(e,t){var r,o;let{gen:i,data:a,opts:u}=e,c=(r=t,(o=u.coerceTypes)?r.filter(e=>d.has(e)||"array"===o&&"array"===e):[]),p=t.length>0&&!(0===c.length&&1===t.length&&(0,n.schemaHasRulesForType)(e,t[0]));if(p){let r=f(t,a,u.strictNumbers,s.Wrong);i.if(r,()=>{c.length?function(e,t,r){let{gen:s,data:o,opts:i}=e,n=s.let("dataType",(0,l._)`typeof ${o}`),a=s.let("coerced",(0,l._)`undefined`);for(let e of("array"===i.coerceTypes&&s.if((0,l._)`${n} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>s.assign(o,(0,l._)`${o}[0]`).assign(n,(0,l._)`typeof ${o}`).if(f(t,o,i.strictNumbers),()=>s.assign(a,o))),s.if((0,l._)`${a} !== undefined`),r))(d.has(e)||"array"===e&&"array"===i.coerceTypes)&&function(e){switch(e){case"string":s.elseIf((0,l._)`${n} == "number" || ${n} == "boolean"`).assign(a,(0,l._)`"" + ${o}`).elseIf((0,l._)`${o} === null`).assign(a,(0,l._)`""`);return;case"number":s.elseIf((0,l._)`${n} == "boolean" || ${o} === null
|
|
2
|
+
|| (${n} == "string" && ${o} && ${o} == +${o})`).assign(a,(0,l._)`+${o}`);return;case"integer":s.elseIf((0,l._)`${n} === "boolean" || ${o} === null
|
|
3
|
+
|| (${n} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,(0,l._)`+${o}`);return;case"boolean":s.elseIf((0,l._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf((0,l._)`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":s.elseIf((0,l._)`${o} === "" || ${o} === 0 || ${o} === false`),s.assign(a,null);return;case"array":s.elseIf((0,l._)`${n} === "string" || ${n} === "number"
|
|
4
|
+
|| ${n} === "boolean" || ${o} === null`).assign(a,(0,l._)`[${o}]`)}}(e);s.else(),m(e),s.endIf(),s.if((0,l._)`${a} !== undefined`,()=>{s.assign(o,a),function({gen:e,parentData:t,parentDataProperty:r},s){e.if((0,l._)`${t} !== undefined`,()=>e.assign((0,l._)`${t}[${r}]`,s))}(e,a)})}(e,t,c):m(e)})}return p};let d=new Set(["string","number","integer","boolean","null"]);function p(e,t,r,o=s.Correct){let i,n=o===s.Correct?l.operators.EQ:l.operators.NEQ;switch(e){case"null":return(0,l._)`${t} ${n} null`;case"array":i=(0,l._)`Array.isArray(${t})`;break;case"object":i=(0,l._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=a((0,l._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=a();break;default:return(0,l._)`typeof ${t} ${n} ${e}`}return o===s.Correct?i:(0,l.not)(i);function a(e=l.nil){return(0,l.and)((0,l._)`typeof ${t} == "number"`,e,r?(0,l._)`isFinite(${t})`:l.nil)}}function f(e,t,r,s){let o;if(1===e.length)return p(e[0],t,r,s);let i=(0,u.toHash)(e);if(i.array&&i.object){let e=(0,l._)`typeof ${t} != "object"`;o=i.null?e:(0,l._)`!${t} || ${e}`,delete i.null,delete i.array,delete i.object}else o=l.nil;for(let e in i.number&&delete i.integer,i)o=(0,l.and)(o,p(e,t,r,s));return o}t.checkDataType=p,t.checkDataTypes=f;let h={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?(0,l._)`{type: ${e}}`:(0,l._)`{type: ${t}}`};function m(e){let t=function(e){let{gen:t,data:r,schema:s}=e,o=(0,u.schemaRefOrVal)(e,s,"type");return{gen:t,keyword:"type",data:r,schema:s.type,schemaCode:o,schemaValue:o,parentSchema:s,params:{},it:e}}(e);(0,a.reportError)(t,h)}t.reportTypeError=m},6593(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;let s=r(8994),o=r(7218);function i(e,t,r){let{gen:i,compositeRule:n,data:a,opts:l}=e;if(void 0===r)return;let u=(0,s._)`${a}${(0,s.getProperty)(t)}`;if(n)return void(0,o.checkStrictMode)(e,`default is ignored for: ${u}`);let c=(0,s._)`${u} === undefined`;"empty"===l.useDefaults&&(c=(0,s._)`${c} || ${u} === null || ${u} === ""`),i.if(c,(0,s._)`${u} = ${(0,s.stringify)(r)}`)}t.assignDefaults=function(e,t){let{properties:r,items:s}=e.schema;if("object"===t&&r)for(let t in r)i(e,t,r[t].default);else"array"===t&&Array.isArray(s)&&s.forEach((t,r)=>i(e,r,t.default))}},6023(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;let s=r(564),o=r(6419),i=r(238),n=r(6419),a=r(6593),l=r(9820),u=r(3826),c=r(8994),d=r(6660),p=r(9008),f=r(7218),h=r(8425);function m({gen:e,validateName:t,schema:r,schemaEnv:s,opts:o},i){var n;o.code.es5?e.func(t,(0,c._)`${d.default.data}, ${d.default.valCxt}`,s.$async,()=>{var t,s;e.code((0,c._)`"use strict"; ${y(r,o)}`),t=e,s=o,t.if(d.default.valCxt,()=>{t.var(d.default.instancePath,(0,c._)`${d.default.valCxt}.${d.default.instancePath}`),t.var(d.default.parentData,(0,c._)`${d.default.valCxt}.${d.default.parentData}`),t.var(d.default.parentDataProperty,(0,c._)`${d.default.valCxt}.${d.default.parentDataProperty}`),t.var(d.default.rootData,(0,c._)`${d.default.valCxt}.${d.default.rootData}`),s.dynamicRef&&t.var(d.default.dynamicAnchors,(0,c._)`${d.default.valCxt}.${d.default.dynamicAnchors}`)},()=>{t.var(d.default.instancePath,(0,c._)`""`),t.var(d.default.parentData,(0,c._)`undefined`),t.var(d.default.parentDataProperty,(0,c._)`undefined`),t.var(d.default.rootData,d.default.data),s.dynamicRef&&t.var(d.default.dynamicAnchors,(0,c._)`{}`)}),e.code(i)}):e.func(t,(0,c._)`${d.default.data}, ${(n=o,(0,c._)`{${d.default.instancePath}="", ${d.default.parentData}, ${d.default.parentDataProperty}, ${d.default.rootData}=${d.default.data}${n.dynamicRef?(0,c._)`, ${d.default.dynamicAnchors}={}`:c.nil}}={}`)}`,s.$async,()=>e.code(y(r,o)).code(i))}function y(e,t){let r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,c._)`/*# sourceURL=${r} */`:c.nil}function g({schema:e,self:t}){if("boolean"==typeof e)return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function v(e){return"boolean"!=typeof e.schema}function _(e){(0,f.checkUnknownRules)(e),function(e){let{schema:t,errSchemaPath:r,opts:s,self:o}=e;t.$ref&&s.ignoreKeywordsWithRef&&(0,f.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function b(e,t){if(e.opts.jtd)return $(e,[],!1,t);let r=(0,o.getSchemaTypes)(e.schema),s=(0,o.coerceAndCheckDataType)(e,r);$(e,r,!s,t)}function w({gen:e,schemaEnv:t,schema:r,errSchemaPath:s,opts:o}){let i=r.$comment;if(!0===o.$comment)e.code((0,c._)`${d.default.self}.logger.log(${i})`);else if("function"==typeof o.$comment){let r=(0,c.str)`${s}/$comment`,o=e.scopeValue("root",{ref:t.root});e.code((0,c._)`${d.default.self}.opts.$comment(${i}, ${r}, ${o}.schema)`)}}function $(e,t,r,s){var o,a,l,u;let{gen:p,schema:h,data:m,allErrors:y,opts:g,self:v}=e,{RULES:_}=v;if(h.$ref&&(g.ignoreKeywordsWithRef||!(0,f.schemaHasRulesButRef)(h,_)))return void p.block(()=>x(e,"$ref",_.all.$ref.definition));function b(o){(0,i.shouldUseGroup)(h,o)&&(o.type?(p.if((0,n.checkDataType)(o.type,m,g.strictNumbers)),E(e,o),1===t.length&&t[0]===o.type&&r&&(p.else(),(0,n.reportTypeError)(e)),p.endIf()):E(e,o),y||p.if((0,c._)`${d.default.errors} === ${s||0}`))}g.jtd||(o=e,a=t,!o.schemaEnv.meta&&o.opts.strictTypes&&(function(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(t=>{k(e.dataTypes,t)||S(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}),function(e,t){let r=[];for(let s of e.dataTypes)k(t,s)?r.push(s):t.includes("integer")&&"number"===s&&r.push("integer");e.dataTypes=r}(e,t)}}(o,a),o.opts.allowUnionTypes||(l=o,(u=a).length>1&&!(2===u.length&&u.includes("null"))&&S(l,"use allowUnionTypes to allow union type keyword")),function(e,t){let r=e.self.RULES.all;for(let s in r){let o=r[s];if("object"==typeof o&&(0,i.shouldUseRule)(e.schema,o)){let{type:r}=o.definition;r.length&&!r.some(e=>{var r,s;return r=t,s=e,r.includes(s)||"number"===s&&r.includes("integer")})&&S(e,`missing type "${r.join(",")}" for keyword "${s}"`)}}}(o,o.dataTypes))),p.block(()=>{for(let e of _.rules)b(e);b(_.post)})}function E(e,t){let{gen:r,schema:s,opts:{useDefaults:o}}=e;o&&(0,a.assignDefaults)(e,t.type),r.block(()=>{for(let r of t.rules)(0,i.shouldUseRule)(s,r)&&x(e,r.keyword,r.definition,t.type)})}function k(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function S(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,f.checkStrictMode)(e,t,e.opts.strictTypes)}t.validateFunctionCode=function(e){v(e)&&(_(e),g(e))?function(e){let{schema:t,opts:r,gen:s}=e;m(e,()=>{r.$comment&&t.$comment&&w(e),function(e){let{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&(0,f.checkStrictMode)(e,"default is ignored in the schema root")}(e),s.let(d.default.vErrors,null),s.let(d.default.errors,0),r.unevaluated&&function(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,c._)`${r}.evaluated`),t.if((0,c._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,c._)`${e.evaluated}.props`,(0,c._)`undefined`)),t.if((0,c._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,c._)`${e.evaluated}.items`,(0,c._)`undefined`))}(e),b(e),function(e){let{gen:t,schemaEnv:r,validateName:s,ValidationError:o,opts:i}=e;r.$async?t.if((0,c._)`${d.default.errors} === 0`,()=>t.return(d.default.data),()=>t.throw((0,c._)`new ${o}(${d.default.vErrors})`)):(t.assign((0,c._)`${s}.errors`,d.default.vErrors),i.unevaluated&&function({gen:e,evaluated:t,props:r,items:s}){r instanceof c.Name&&e.assign((0,c._)`${t}.props`,r),s instanceof c.Name&&e.assign((0,c._)`${t}.items`,s)}(e),t.return((0,c._)`${d.default.errors} === 0`))}(e)})}(e):m(e,()=>(0,s.topBoolOrEmptySchema)(e))};class T{constructor(e,t,r){if((0,l.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,f.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",I(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,l.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",d.default.errors))}result(e,t,r){this.failResult((0,c.not)(e),t,r)}failResult(e,t,r){this.gen.if(e),r?r():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,c.not)(e),void 0,t)}fail(e){if(void 0===e){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail((0,c._)`${t} !== undefined && (${(0,c.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?h.reportExtraError:h.reportError)(this,this.def.error,t)}$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(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,r=c.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=c.nil,t=c.nil){if(!this.$data)return;let{gen:r,schemaCode:s,schemaType:o,def:i}=this;r.if((0,c.or)((0,c._)`${s} === undefined`,t)),e!==c.nil&&r.assign(e,!0),(o.length||i.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==c.nil&&r.assign(e,!1)),r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:s,it:o}=this;return(0,c.or)(function(){if(r.length){if(!(t instanceof c.Name))throw Error("ajv implementation error");let e=Array.isArray(r)?r:[r];return(0,c._)`${(0,n.checkDataTypes)(e,t,o.opts.strictNumbers,n.DataType.Wrong)}`}return c.nil}(),function(){if(s.validateSchema){let r=e.scopeValue("validate$data",{ref:s.validateSchema});return(0,c._)`!${r}(${t})`}return c.nil}())}subschema(e,t){let r=(0,u.getSubschema)(this.it,e);(0,u.extendSubschemaData)(r,this.it,e),(0,u.extendSubschemaMode)(r,e);let o={...this.it,...r,items:void 0,props:void 0};return!function(e,t){if(v(e)&&(_(e),g(e)))return function(e,t){var r;let s,{schema:o,gen:i,opts:n}=e;n.$comment&&o.$comment&&w(e),(s=(r=e).schema[r.opts.schemaId])&&(r.baseId=(0,p.resolveUrl)(r.opts.uriResolver,r.baseId,s)),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}(e);let a=i.const("_errs",d.default.errors);b(e,a),i.var(t,(0,c._)`${a} === ${d.default.errors}`)}(e,t);(0,s.boolOrEmptySchema)(e,t)}(o,t),o}mergeEvaluated(e,t){let{it:r,gen:s}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=f.mergeEvaluated.props(s,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=f.mergeEvaluated.items(s,e.items,r.items,t)))}mergeValidEvaluated(e,t){let{it:r,gen:s}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return s.if(t,()=>this.mergeEvaluated(e,c.Name)),!0}}function x(e,t,r,s){let o=new T(e,r,t);"code"in r?r.code(o,s):o.$data&&r.validate?(0,l.funcKeywordCode)(o,r):"macro"in r?(0,l.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,l.funcKeywordCode)(o,r)}t.KeywordCxt=T;let P=/^\/(?:[^~]|~0|~1)*$/,O=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function I(e,{dataLevel:t,dataNames:r,dataPathArr:s}){let o,i;if(""===e)return d.default.rootData;if("/"===e[0]){if(!P.test(e))throw Error(`Invalid JSON-pointer: ${e}`);o=e,i=d.default.rootData}else{let n=O.exec(e);if(!n)throw Error(`Invalid JSON-pointer: ${e}`);let l=+n[1];if("#"===(o=n[2])){if(l>=t)throw Error(a("property/index",l));return s[t-l]}if(l>t)throw Error(a("data",l));if(i=r[t-l],!o)return i}let n=i;for(let e of o.split("/"))e&&(i=(0,c._)`${i}${(0,c.getProperty)((0,f.unescapeJsonPointer)(e))}`,n=(0,c._)`${n} && ${i}`);return n;function a(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}t.getData=I},9820(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;let s=r(8994),o=r(6660),i=r(4954),n=r(8425);function a(e){let{gen:t,data:r,it:o}=e;t.if(o.parentData,()=>t.assign(r,(0,s._)`${o.parentData}[${o.parentDataProperty}]`))}function l(e,t,r){if(void 0===r)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword","function"==typeof r?{ref:r}:{ref:r,code:(0,s.stringify)(r)})}t.macroKeywordCode=function(e,t){let{gen:r,keyword:o,schema:i,parentSchema:n,it:a}=e,u=t.macro.call(a.self,i,n,a),c=l(r,o,u);!1!==a.opts.validateSchema&&a.self.validateSchema(u,!0);let d=r.name("valid");e.subschema({schema:u,schemaPath:s.nil,errSchemaPath:`${a.errSchemaPath}/${o}`,topSchemaRef:c,compositeRule:!0},d),e.pass(d,()=>e.error(!0))},t.funcKeywordCode=function(e,t){var r;let{gen:u,keyword:c,schema:d,parentSchema:p,$data:f,it:h}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}(h,t);let m=l(u,c,!f&&t.compile?t.compile.call(h.self,d,p,h):t.validate),y=u.let("valid");function g(r=t.async?(0,s._)`await `:s.nil){let n=h.opts.passContext?o.default.this:o.default.self,a=!("compile"in t&&!f||!1===t.schema);u.assign(y,(0,s._)`${r}${(0,i.callValidateCode)(e,m,n,a)}`,t.modifying)}function v(e){var r;u.if((0,s.not)(null!=(r=t.valid)?r:y),e)}e.block$data(y,function(){if(!1===t.errors)g(),t.modifying&&a(e),v(()=>e.error());else{let r,i,l=t.async?(r=u.let("ruleErrs",null),u.try(()=>g((0,s._)`await `),e=>u.assign(y,!1).if((0,s._)`${e} instanceof ${h.ValidationError}`,()=>u.assign(r,(0,s._)`${e}.errors`),()=>u.throw(e))),r):(i=(0,s._)`${m}.errors`,u.assign(i,null),g(s.nil),i);t.modifying&&a(e),v(()=>(function(e,t){let{gen:r}=e;r.if((0,s._)`Array.isArray(${t})`,()=>{r.assign(o.default.vErrors,(0,s._)`${o.default.vErrors} === null ? ${t} : ${o.default.vErrors}.concat(${t})`).assign(o.default.errors,(0,s._)`${o.default.vErrors}.length`),(0,n.extendErrors)(e)},()=>e.error())})(e,l))}}),e.ok(null!=(r=t.valid)?r:y)},t.validSchemaType=function(e,t,r=!1){return!t.length||t.some(t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||r&&void 0===e)},t.validateKeywordUsage=function({schema:e,opts:t,self:r,errSchemaPath:s},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw Error("ajv implementation error");let n=o.dependencies;if(null==n?void 0:n.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw Error(`parent schema must have dependencies of ${i}: ${n.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[i])){let e=`keyword "${i}" value is invalid at path "${s}": `+r.errorsText(o.validateSchema.errors);if("log"===t.validateSchema)r.logger.error(e);else throw Error(e)}}},3826(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;let s=r(8994),o=r(7218);t.getSubschema=function(e,{keyword:t,schemaProp:r,schema:i,schemaPath:n,errSchemaPath:a,topSchemaRef:l}){if(void 0!==t&&void 0!==i)throw Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==t){let i=e.schema[t];return void 0===r?{schema:i,schemaPath:(0,s._)`${e.schemaPath}${(0,s.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:i[r],schemaPath:(0,s._)`${e.schemaPath}${(0,s.getProperty)(t)}${(0,s.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,o.escapeFragment)(r)}`}}if(void 0!==i){if(void 0===n||void 0===a||void 0===l)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:i,schemaPath:n,topSchemaRef:l,errSchemaPath:a}}throw Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(e,t,{dataProp:r,dataPropType:i,data:n,dataTypes:a,propertyName:l}){if(void 0!==n&&void 0!==r)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:u}=t;if(void 0!==r){let{errorPath:n,dataPathArr:a,opts:l}=t;c(u.let("data",(0,s._)`${t.data}${(0,s.getProperty)(r)}`,!0)),e.errorPath=(0,s.str)`${n}${(0,o.getErrorPath)(r,i,l.jsPropertySyntax)}`,e.parentDataProperty=(0,s._)`${r}`,e.dataPathArr=[...a,e.parentDataProperty]}function c(r){e.data=r,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,r]}void 0!==n&&(c(n instanceof s.Name?n:u.let("data",n,!0)),void 0!==l&&(e.propertyName=l)),a&&(e.dataTypes=a)},t.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:s,createErrors:o,allErrors:i}){void 0!==s&&(e.compositeRule=s),void 0!==o&&(e.createErrors=o),void 0!==i&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=r}},1967(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var s=r(6023);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return s.KeywordCxt}});var o=r(8994);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return o._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return o.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return o.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return o.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return o.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return o.CodeGen}});let i=r(4383),n=r(4220),a=r(6247),l=r(1688),u=r(8994),c=r(9008),d=r(6419),p=r(7218),f=r(114),h=r(8951),m=(e,t)=>new RegExp(e,t);m.code="new RegExp";let y=["removeAdditional","useDefaults","coerceTypes"],g=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),v={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."},_={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};class b{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...function(e){var t,r,s,o,i,n,a,l,u,c,d,p,f,y,g,v,_,b,w,$,E,k,S,T,x;let P=e.strict,O=null==(t=e.code)?void 0:t.optimize,I=!0===O||void 0===O?1:O||0,j=null!=(s=null==(r=e.code)?void 0:r.regExp)?s:m,R=null!=(o=e.uriResolver)?o:h.default;return{strictSchema:null==(n=null!=(i=e.strictSchema)?i:P)||n,strictNumbers:null==(l=null!=(a=e.strictNumbers)?a:P)||l,strictTypes:null!=(c=null!=(u=e.strictTypes)?u:P)?c:"log",strictTuples:null!=(p=null!=(d=e.strictTuples)?d:P)?p:"log",strictRequired:null!=(y=null!=(f=e.strictRequired)?f:P)&&y,code:e.code?{...e.code,optimize:I,regExp:j}:{optimize:I,regExp:j},loopRequired:null!=(g=e.loopRequired)?g:200,loopEnum:null!=(v=e.loopEnum)?v:200,meta:null==(_=e.meta)||_,messages:null==(b=e.messages)||b,inlineRefs:null==(w=e.inlineRefs)||w,schemaId:null!=($=e.schemaId)?$:"$id",addUsedSchema:null==(E=e.addUsedSchema)||E,validateSchema:null==(k=e.validateSchema)||k,validateFormats:null==(S=e.validateFormats)||S,unicodeRegExp:null==(T=e.unicodeRegExp)||T,int32range:null==(x=e.int32range)||x,uriResolver:R}}(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new u.ValueScope({scope:{},prefixes:g,es5:t,lines:r}),this.logger=function(e){if(!1===e)return x;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}(e.logger);const s=e.validateFormats;e.validateFormats=!1,this.RULES=(0,a.getRules)(),w.call(this,v,e,"NOT SUPPORTED"),w.call(this,_,e,"DEPRECATED","warn"),this._metaOpts=T.call(this),e.formats&&k.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&S.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),E.call(this),e.validateFormats=s}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,s=f;"id"===r&&((s={...f}).id=s.$id,delete s.$id),t&&e&&this.addMetaSchema(s,s[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let r;if("string"==typeof e){if(!(r=this.getSchema(e)))throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let s=r(t);return"$async"in r||(this.errors=r.errors),s}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return s.call(this,e,t);async function s(e,t){await o.call(this,e.$schema);let r=this._addSchema(e,t);return r.validate||i.call(this,r)}async function o(e){e&&!this.getSchema(e)&&await s.call(this,{$ref:e},!0)}async function i(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof n.default))throw t;return a.call(this,t),await l.call(this,t.missingSchema),i.call(this,e)}}function a({missingSchema:e,missingRef:t}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function l(e){let r=await u.call(this,e);this.refs[e]||await o.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function u(e){let t=this._loading[e];if(t)return t;try{return await (this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,s=this.opts.validateSchema){let o;if(Array.isArray(e)){for(let t of e)this.addSchema(t,void 0,r,s);return this}if("object"==typeof e){let{schemaId:t}=this.opts;if(void 0!==(o=e[t])&&"string"!=typeof o)throw Error(`schema ${t} must be string`)}return t=(0,c.normalizeId)(t||o),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,s,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){let r;if("boolean"==typeof e)return!0;if(void 0!==(r=e.$schema)&&"string"!=typeof r)throw Error("$schema must be a string");if(!(r=r||this.opts.defaultMeta||this.defaultMeta()))return this.logger.warn("meta-schema not available"),this.errors=null,!0;let s=this.validate(r,e);if(!s&&t){let e="schema is invalid: "+this.errorsText();if("log"===this.opts.validateSchema)this.logger.error(e);else throw Error(e)}return s}getSchema(e){let t;for(;"string"==typeof(t=$.call(this,e));)e=t;if(void 0===t){let{schemaId:r}=this.opts,s=new l.SchemaEnv({schema:{},schemaId:r});if(!(t=l.resolveSchema.call(this,s,e)))return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=$.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{this._cache.delete(e);let t=e[this.opts.schemaId];return t&&(t=(0,c.normalizeId)(t),delete this.schemas[t],delete this.refs[t]),this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if("string"==typeof e)r=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r);else if("object"==typeof e&&void 0===t){if(Array.isArray(r=(t=e).keyword)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(O.call(this,r,t),!t)return(0,p.eachItem)(r,e=>I.call(this,e)),this;R.call(this,t);let s={...t,type:(0,d.getJSONTypes)(t.type),schemaType:(0,d.getJSONTypes)(t.schemaType)};return(0,p.eachItem)(r,0===s.type.length?e=>I.call(this,e,s):e=>s.type.forEach(t=>I.call(this,e,s,t))),this}getKeyword(e){let t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;for(let r of(delete t.keywords[e],delete t.all[e],t.rules)){let t=r.rules.findIndex(t=>t.keyword===e);t>=0&&r.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){return e&&0!==e.length?e.map(e=>`${r}${e.instancePath} ${e.message}`).reduce((e,r)=>e+t+r):"No errors"}$dataMetaSchema(e,t){let r=this.RULES.all;for(let s of(e=JSON.parse(JSON.stringify(e)),t)){let t=s.split("/").slice(1),o=e;for(let e of t)o=o[e];for(let e in r){let t=r[e];if("object"!=typeof t)continue;let{$data:s}=t.definition,i=o[e];s&&i&&(o[e]=z(i))}}return e}_removeAllSchemas(e,t){for(let r in e){let s=e[r];(!t||t.test(r))&&("string"==typeof s?delete e[r]:s&&!s.meta&&(this._cache.delete(s.schema),delete e[r]))}}_addSchema(e,t,r,s=this.opts.validateSchema,o=this.opts.addUsedSchema){let i,{schemaId:n}=this.opts;if("object"==typeof e)i=e[n];else if(this.opts.jtd)throw Error("schema must be object");else if("boolean"!=typeof e)throw Error("schema must be object or boolean");let a=this._cache.get(e);if(void 0!==a)return a;r=(0,c.normalizeId)(i||r);let u=c.getSchemaRefs.call(this,e,r);return a=new l.SchemaEnv({schema:e,schemaId:n,meta:t,baseId:r,localRefs:u}),this._cache.set(a.schema,a),o&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=a),s&&this.validateSchema(e,!0),a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):l.compileSchema.call(this,e),!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{l.compileSchema.call(this,e)}finally{this.opts=t}}}function w(e,t,r,s="error"){for(let o in e)o in t&&this.logger[s](`${r}: option ${o}. ${e[o]}`)}function $(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function E(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function k(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function S(e){if(Array.isArray(e))return void this.addVocabulary(e);for(let t in this.logger.warn("keywords option as map is deprecated, pass array"),e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function T(){let e={...this.opts};for(let t of y)delete e[t];return e}b.ValidationError=i.default,b.MissingRefError=n.default,t.default=b;let x={log(){},warn(){},error(){}},P=/^[a-z_$][a-z0-9_$:-]*$/i;function O(e,t){let{RULES:r}=this;if((0,p.eachItem)(e,e=>{if(r.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!P.test(e))throw Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!("code"in t||"validate"in t))throw Error('$data keyword must have "code" or "validate" function')}function I(e,t,r){var s;let o=null==t?void 0:t.post;if(r&&o)throw Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,n=o?i.post:i.rules.find(({type:e})=>e===r);if(n||(n={type:r,rules:[]},i.rules.push(n)),i.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:(0,d.getJSONTypes)(t.type),schemaType:(0,d.getJSONTypes)(t.schemaType)}};t.before?j.call(this,n,a,t.before):n.rules.push(a),i.all[e]=a,null==(s=t.implements)||s.forEach(e=>this.addKeyword(e))}function j(e,t,r){let s=e.rules.findIndex(e=>e.keyword===r);s>=0?e.rules.splice(s,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function R(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=z(t)),e.validateSchema=this.compile(t,!0))}let N={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function z(e){return{anyOf:[e,N]}}},6013(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(7371);s.code='require("ajv/dist/runtime/equal").default',t.default=s},5532(e,t){"use strict";function r(e){let t,r=e.length,s=0,o=0;for(;o<r;)s++,(t=e.charCodeAt(o++))>=55296&&t<=56319&&o<r&&(64512&(t=e.charCodeAt(o)))==56320&&o++;return s}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,r.code='require("ajv/dist/runtime/ucs2length").default'},8951(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(7980);s.code='require("ajv/dist/runtime/uri").default',t.default=s},4383(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}},714(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;let s=r(8994),o=r(7218);function i(e,t){let{gen:r,schema:i,data:n,keyword:a,it:l}=e;l.items=!0;let u=r.const("len",(0,s._)`${n}.length`);if(!1===i)e.setParams({len:t.length}),e.pass((0,s._)`${u} <= ${t.length}`);else if("object"==typeof i&&!(0,o.alwaysValidSchema)(l,i)){let i=r.var("valid",(0,s._)`${u} <= ${t.length}`);r.if((0,s.not)(i),()=>{var n;return n=i,void r.forRange("i",t.length,u,t=>{e.subschema({keyword:a,dataProp:t,dataPropType:o.Type.Num},n),l.allErrors||r.if((0,s.not)(n),()=>r.break())})}),e.ok(i)}}t.validateAdditionalItems=i,t.default={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,s.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,s._)`{limit: ${e}}`},code(e){let{parentSchema:t,it:r}=e,{items:s}=t;Array.isArray(s)?i(e,s):(0,o.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas')}}},8401(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(4954),o=r(8994),i=r(6660),n=r(7218);t.default={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>(0,o._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:t,schema:r,parentSchema:a,data:l,errsCount:u,it:c}=e;if(!u)throw Error("ajv implementation error");let{allErrors:d,opts:p}=c;if(c.props=!0,"all"!==p.removeAdditional&&(0,n.alwaysValidSchema)(c,r))return;let f=(0,s.allSchemaProperties)(a.properties),h=(0,s.allSchemaProperties)(a.patternProperties);function m(e){t.code((0,o._)`delete ${l}[${e}]`)}function y(s){if("all"===p.removeAdditional||p.removeAdditional&&!1===r)return void m(s);if(!1===r){e.setParams({additionalProperty:s}),e.error(),d||t.break();return}if("object"==typeof r&&!(0,n.alwaysValidSchema)(c,r)){let r=t.name("valid");"failing"===p.removeAdditional?(g(s,r,!1),t.if((0,o.not)(r),()=>{e.reset(),m(s)})):(g(s,r),d||t.if((0,o.not)(r),()=>t.break()))}}function g(t,r,s){let o={keyword:"additionalProperties",dataProp:t,dataPropType:n.Type.Str};!1===s&&Object.assign(o,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(o,r)}t.forIn("key",l,r=>{f.length||h.length?t.if(function(r){let i;if(f.length>8){let e=(0,n.schemaRefOrVal)(c,a.properties,"properties");i=(0,s.isOwnProperty)(t,e,r)}else i=f.length?(0,o.or)(...f.map(e=>(0,o._)`${r} === ${e}`)):o.nil;return h.length&&(i=(0,o.or)(i,...h.map(t=>(0,o._)`${(0,s.usePattern)(e,t)}.test(${r})`))),(0,o.not)(i)}(r),()=>y(r)):y(r)}),e.ok((0,o._)`${u} === ${i.default.errors}`)}}},2003(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(7218);t.default={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:o}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let i=t.name("valid");r.forEach((t,r)=>{if((0,s.alwaysValidSchema)(o,t))return;let n=e.subschema({keyword:"allOf",schemaProp:r},i);e.ok(i),e.mergeEvaluated(n)})}}},1070(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:r(4954).validateUnion,error:{message:"must match a schema in anyOf"}}},2692(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994),o=r(7218);t.default={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>void 0===t?(0,s.str)`must contain at least ${e} valid item(s)`:(0,s.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?(0,s._)`{minContains: ${e}}`:(0,s._)`{minContains: ${e}, maxContains: ${t}}`},code(e){let t,r,{gen:i,schema:n,parentSchema:a,data:l,it:u}=e,{minContains:c,maxContains:d}=a;u.opts.next?(t=void 0===c?1:c,r=d):t=1;let p=i.const("len",(0,s._)`${l}.length`);if(e.setParams({min:t,max:r}),void 0===r&&0===t)return void(0,o.checkStrictMode)(u,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==r&&t>r){(0,o.checkStrictMode)(u,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,o.alwaysValidSchema)(u,n)){let o=(0,s._)`${p} >= ${t}`;void 0!==r&&(o=(0,s._)`${o} && ${p} <= ${r}`),e.pass(o);return}u.items=!0;let f=i.name("valid");function h(){let e=i.name("_valid"),o=i.let("count",0);m(e,()=>i.if(e,()=>{var e;return e=o,void(i.code((0,s._)`${e}++`),void 0===r?i.if((0,s._)`${e} >= ${t}`,()=>i.assign(f,!0).break()):(i.if((0,s._)`${e} > ${r}`,()=>i.assign(f,!1).break()),1===t?i.assign(f,!0):i.if((0,s._)`${e} >= ${t}`,()=>i.assign(f,!0))))}))}function m(t,r){i.forRange("i",0,p,s=>{e.subschema({keyword:"contains",dataProp:s,dataPropType:o.Type.Num,compositeRule:!0},t),r()})}void 0===r&&1===t?m(f,()=>i.if(f,()=>i.break())):0===t?(i.let(f,!0),void 0!==r&&i.if((0,s._)`${l}.length > 0`,h)):(i.let(f,!1),h()),e.result(f,()=>e.reset())}}},5860(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;let s=r(8994),o=r(7218),i=r(4954);t.error={message:({params:{property:e,depsCount:t,deps:r}})=>(0,s.str)`must have ${1===t?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:o}})=>(0,s._)`{property: ${e},
|
|
5
|
+
missingProperty: ${o},
|
|
6
6
|
depsCount: ${t},
|
|
7
|
-
deps: ${r}}`};let a={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(e){let[t,r]=function({schema:e}){let t={},r={};for(let s in e)"__proto__"!==s&&((Array.isArray(e[s])?t:r)[s]=e[s]);return[t,r]}(e);o(e,t),l(e,r)}};function o(e,t=e.schema){let{gen:r,data:i,it:a}=e;if(0===Object.keys(t).length)return;let l=r.let("missing");for(let o in t){let u=t[o];if(0===u.length)continue;let c=(0,n.propertyInData)(r,i,o,a.opts.ownProperties);e.setParams({property:o,depsCount:u.length,deps:u.join(", ")}),a.allErrors?r.if(c,()=>{for(let t of u)(0,n.checkReportMissingProp)(e,t)}):(r.if((0,s._)`${c} && (${(0,n.checkMissingProp)(e,u,l)})`),(0,n.reportMissingProp)(e,l),r.else())}}function l(e,t=e.schema){let{gen:r,data:s,keyword:a,it:o}=e,u=r.name("valid");for(let l in t)(0,i.alwaysValidSchema)(o,t[l])||(r.if((0,n.propertyInData)(r,s,l,o.opts.ownProperties),()=>{let t=e.subschema({keyword:a,schemaProp:l},u);e.mergeValidEvaluated(t,u)},()=>r.var(u,!0)),e.ok(u))}t.validatePropertyDeps=o,t.validateSchemaDeps=l,t.default=a},8102(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994),i=r(7218);function n(e,t){let r=e.schema[t];return void 0!==r&&!(0,i.alwaysValidSchema)(e,r)}t.default={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>(0,s.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,s._)`{failingKeyword: ${e.ifClause}}`},code(e){let t,{gen:r,parentSchema:a,it:o}=e;void 0===a.then&&void 0===a.else&&(0,i.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let l=n(o,"then"),u=n(o,"else");if(!l&&!u)return;let c=r.let("valid",!0),d=r.name("_valid");if(t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},d),e.mergeEvaluated(t),e.reset(),l&&u){let t=r.let("ifClause");e.setParams({ifClause:t}),r.if(d,p("then",t),p("else",t))}else l?r.if(d,p("then")):r.if((0,s.not)(d),p("else"));function p(t,i){return()=>{let n=e.subschema({keyword:t},d);r.assign(c,d),e.mergeValidEvaluated(n,c),i?r.assign(i,(0,s._)`${t}`):e.setParams({ifClause:t})}}e.pass(c,()=>e.error(!0))}}},8313(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(714),i=r(1997),n=r(3665),a=r(5153),o=r(2692),l=r(5860),u=r(374),c=r(8401),d=r(3252),p=r(6398),f=r(4948),h=r(1070),m=r(5368),y=r(2003),g=r(8102),v=r(1871);t.default=function(e=!1){let t=[f.default,h.default,m.default,y.default,g.default,v.default,u.default,c.default,l.default,d.default,p.default];return e?t.push(i.default,a.default):t.push(s.default,n.default),t.push(o.default),t}},3665(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;let s=r(8994),i=r(7218),n=r(4954);function a(e,t,r=e.schema){let{gen:n,parentSchema:o,data:l,keyword:u,it:c}=e;(function(e){let{opts:s,errSchemaPath:n}=c,a=r.length,o=a===e.minItems&&(a===e.maxItems||!1===e[t]);if(s.strictTuples&&!o){let e=`"${u}" is ${a}-tuple, but minItems or maxItems/${t} are not specified or different at path "${n}"`;(0,i.checkStrictMode)(c,e,s.strictTuples)}})(o),c.opts.unevaluated&&r.length&&!0!==c.items&&(c.items=i.mergeEvaluated.items(n,r.length,c.items));let d=n.name("valid"),p=n.const("len",(0,s._)`${l}.length`);r.forEach((t,r)=>{(0,i.alwaysValidSchema)(c,t)||(n.if((0,s._)`${p} > ${r}`,()=>e.subschema({keyword:u,schemaProp:r,dataProp:r},d)),e.ok(d))})}t.validateTuple=a,t.default={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return a(e,"additionalItems",t);r.items=!0,(0,i.alwaysValidSchema)(r,t)||e.ok((0,n.validateArray)(e))}}},5153(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994),i=r(7218),n=r(4954),a=r(714);t.default={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,s.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,s._)`{limit: ${e}}`},code(e){let{schema:t,parentSchema:r,it:s}=e,{prefixItems:o}=r;s.items=!0,(0,i.alwaysValidSchema)(s,t)||(o?(0,a.validateAdditionalItems)(e,o):e.ok((0,n.validateArray)(e)))}}},4948(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(7218);t.default={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:i}=e;if((0,s.alwaysValidSchema)(i,r))return void e.fail();let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}}},5368(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994),i=r(7218);t.default={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>(0,s._)`{passingSchemas: ${e.passing}}`},code(e){let{gen:t,schema:r,parentSchema:n,it:a}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(a.opts.discriminator&&n.discriminator)return;let o=t.let("valid",!1),l=t.let("passing",null),u=t.name("_valid");e.setParams({passing:l}),t.block(function(){r.forEach((r,n)=>{let c;(0,i.alwaysValidSchema)(a,r)?t.var(u,!0):c=e.subschema({keyword:"oneOf",schemaProp:n,compositeRule:!0},u),n>0&&t.if((0,s._)`${u} && ${o}`).assign(o,!1).assign(l,(0,s._)`[${l}, ${n}]`).else(),t.if(u,()=>{t.assign(o,!0),t.assign(l,n),c&&e.mergeEvaluated(c,s.Name)})})}),e.result(o,()=>e.reset(),()=>e.error(!0))}}},6398(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(4954),i=r(8994),n=r(7218),a=r(7218);t.default={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:o,parentSchema:l,it:u}=e,{opts:c}=u,d=(0,s.allSchemaProperties)(r),p=d.filter(e=>(0,n.alwaysValidSchema)(u,r[e]));if(0===d.length||p.length===d.length&&(!u.opts.unevaluated||!0===u.props))return;let f=c.strictSchema&&!c.allowMatchingProperties&&l.properties,h=t.name("valid");!0===u.props||u.props instanceof i.Name||(u.props=(0,a.evaluatedPropsToName)(t,u.props));let{props:m}=u;for(let e of d)f&&function(e){for(let t in f)new RegExp(e).test(t)&&(0,n.checkStrictMode)(u,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}(e),u.allErrors?y(e):(t.var(h,!0),y(e),t.if(h));function y(r){t.forIn("key",o,n=>{t.if((0,i._)`${(0,s.usePattern)(e,r)}.test(${n})`,()=>{let s=p.includes(r);s||e.subschema({keyword:"patternProperties",schemaProp:r,dataProp:n,dataPropType:a.Type.Str},h),u.opts.unevaluated&&!0!==m?t.assign((0,i._)`${m}[${n}]`,!0):s||u.allErrors||t.if((0,i.not)(h),()=>t.break())})})}}}},1997(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(3665);t.default={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,s.validateTuple)(e,"items")}},3252(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(6023),i=r(4954),n=r(7218),a=r(8401);t.default={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:o,data:l,it:u}=e;"all"===u.opts.removeAdditional&&void 0===o.additionalProperties&&a.default.code(new s.KeywordCxt(u,a.default,"additionalProperties"));let c=(0,i.allSchemaProperties)(r);for(let e of c)u.definedProperties.add(e);u.opts.unevaluated&&c.length&&!0!==u.props&&(u.props=n.mergeEvaluated.props(t,(0,n.toHash)(c),u.props));let d=c.filter(e=>!(0,n.alwaysValidSchema)(u,r[e]));if(0===d.length)return;let p=t.name("valid");for(let s of d){var f;(f=s,u.opts.useDefaults&&!u.compositeRule&&void 0!==r[f].default)?h(s):(t.if((0,i.propertyInData)(t,l,s,u.opts.ownProperties)),h(s),u.allErrors||t.else().var(p,!0),t.endIf()),e.it.definedProperties.add(s),e.ok(p)}function h(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},p)}}}},374(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994),i=r(7218);t.default={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>(0,s._)`{propertyName: ${e.propertyName}}`},code(e){let{gen:t,schema:r,data:n,it:a}=e;if((0,i.alwaysValidSchema)(a,r))return;let o=t.name("valid");t.forIn("key",n,r=>{e.setParams({propertyName:r}),e.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:!0},o),t.if((0,s.not)(o),()=>{e.error(!0),a.allErrors||t.break()})}),e.ok(o)}}},1871(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(7218);t.default={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){void 0===t.if&&(0,s.checkStrictMode)(r,`"${e}" without "if" is ignored`)}}},4954(e,t,r){"use strict";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 s=r(8994),i=r(7218),n=r(6660),a=r(7218);function o(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,s._)`Object.prototype.hasOwnProperty`})}function l(e,t,r){return(0,s._)`${o(e)}.call(${t}, ${r})`}function u(e,t,r,i){let n=(0,s._)`${t}${(0,s.getProperty)(r)} === undefined`;return i?(0,s.or)(n,(0,s.not)(l(e,t,r))):n}function c(e){return e?Object.keys(e).filter(e=>"__proto__"!==e):[]}t.checkReportMissingProp=function(e,t){let{gen:r,data:i,it:n}=e;r.if(u(r,i,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:(0,s._)`${t}`},!0),e.error()})},t.checkMissingProp=function({gen:e,data:t,it:{opts:r}},i,n){return(0,s.or)(...i.map(i=>(0,s.and)(u(e,t,i,r.ownProperties),(0,s._)`${n} = ${i}`)))},t.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},t.hasPropFunc=o,t.isOwnProperty=l,t.propertyInData=function(e,t,r,i){let n=(0,s._)`${t}${(0,s.getProperty)(r)} !== undefined`;return i?(0,s._)`${n} && ${l(e,t,r)}`:n},t.noPropertyInData=u,t.allSchemaProperties=c,t.schemaProperties=function(e,t){return c(t).filter(r=>!(0,i.alwaysValidSchema)(e,t[r]))},t.callValidateCode=function({schemaCode:e,data:t,it:{gen:r,topSchemaRef:i,schemaPath:a,errorPath:o},it:l},u,c,d){let p=d?(0,s._)`${e}, ${t}, ${i}${a}`:t,f=[[n.default.instancePath,(0,s.strConcat)(n.default.instancePath,o)],[n.default.parentData,l.parentData],[n.default.parentDataProperty,l.parentDataProperty],[n.default.rootData,n.default.rootData]];l.opts.dynamicRef&&f.push([n.default.dynamicAnchors,n.default.dynamicAnchors]);let h=(0,s._)`${p}, ${r.object(...f)}`;return c!==s.nil?(0,s._)`${u}.call(${c}, ${h})`:(0,s._)`${u}(${h})`};let d=(0,s._)`new RegExp`;t.usePattern=function({gen:e,it:{opts:t}},r){let i=t.unicodeRegExp?"u":"",{regExp:n}=t.code,o=n(r,i);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,s._)`${"new RegExp"===n.code?d:(0,a.useFunc)(e,n)}(${r}, ${i})`})},t.validateArray=function(e){let{gen:t,data:r,keyword:n,it:a}=e,o=t.name("valid");if(a.allErrors){let e=t.let("valid",!0);return l(()=>t.assign(e,!1)),e}return t.var(o,!0),l(()=>t.break()),o;function l(a){let l=t.const("len",(0,s._)`${r}.length`);t.forRange("i",0,l,r=>{e.subschema({keyword:n,dataProp:r,dataPropType:i.Type.Num},o),t.if((0,s.not)(o),a)})}},t.validateUnion=function(e){let{gen:t,schema:r,keyword:n,it:a}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some(e=>(0,i.alwaysValidSchema)(a,e))&&!a.opts.unevaluated)return;let o=t.let("valid",!1),l=t.name("_valid");t.block(()=>r.forEach((r,i)=>{let a=e.subschema({keyword:n,schemaProp:i,compositeRule:!0},l);t.assign(o,(0,s._)`${o} || ${l}`),e.mergeValidEvaluated(a,l)||t.if((0,s.not)(o))})),e.result(o,()=>e.reset(),()=>e.error(!0))}},3330(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}}},8119(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(3330),i=r(930);t.default=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",s.default,i.default]},930(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;let s=r(4220),i=r(4954),n=r(8994),a=r(6660),o=r(1688),l=r(7218);function u(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,n._)`${r.scopeValue("wrapper",{ref:t})}.validate`}function c(e,t,r,s){let{gen:o,it:u}=e,{allErrors:c,schemaEnv:d,opts:p}=u,f=p.passContext?a.default.this:n.nil;function h(e){let t=(0,n._)`${e}.errors`;o.assign(a.default.vErrors,(0,n._)`${a.default.vErrors} === null ? ${t} : ${a.default.vErrors}.concat(${t})`),o.assign(a.default.errors,(0,n._)`${a.default.vErrors}.length`)}function m(e){var t;if(!u.opts.unevaluated)return;let s=null==(t=null==r?void 0:r.validate)?void 0:t.evaluated;if(!0!==u.props)if(s&&!s.dynamicProps)void 0!==s.props&&(u.props=l.mergeEvaluated.props(o,s.props,u.props));else{let t=o.var("props",(0,n._)`${e}.evaluated.props`);u.props=l.mergeEvaluated.props(o,t,u.props,n.Name)}if(!0!==u.items)if(s&&!s.dynamicItems)void 0!==s.items&&(u.items=l.mergeEvaluated.items(o,s.items,u.items));else{let t=o.var("items",(0,n._)`${e}.evaluated.items`);u.items=l.mergeEvaluated.items(o,t,u.items,n.Name)}}s?function(){if(!d.$async)throw Error("async schema referenced by sync schema");let r=o.let("valid");o.try(()=>{o.code((0,n._)`await ${(0,i.callValidateCode)(e,t,f)}`),m(t),c||o.assign(r,!0)},e=>{o.if((0,n._)`!(${e} instanceof ${u.ValidationError})`,()=>o.throw(e)),h(e),c||o.assign(r,!1)}),e.ok(r)}():e.result((0,i.callValidateCode)(e,t,f),()=>m(t),()=>h(t))}t.getValidate=u,t.callRef=c,t.default={keyword:"$ref",schemaType:"string",code(e){var t,r;let i,a,l,d,{gen:p,schema:f,it:h}=e,{baseId:m,schemaEnv:y,validateName:g,opts:v,self:_}=h,{root:b}=y;if(("#"===f||"#/"===f)&&m===b.baseId){if(y===b)return c(e,g,y,y.$async);let t=p.scopeValue("root",{ref:b});return c(e,(0,n._)`${t}.validate`,b,b.$async)}let w=o.resolveRef.call(_,b,m,f);if(void 0===w)throw new s.default(h.opts.uriResolver,m,f);return w instanceof o.SchemaEnv?(i=u(e,t=w),void c(e,i,t,t.$async)):(r=w,a=p.scopeValue("schema",!0===v.code.source?{ref:r,code:(0,n.stringify)(r)}:{ref:r}),l=p.name("valid"),d=e.subschema({schema:r,dataTypes:[],schemaPath:n.nil,topSchemaRef:a,errSchemaPath:f},l),void(e.mergeEvaluated(d),e.ok(l)))}}},9376(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994),i=r(5141),n=r(1688),a=r(4220),o=r(7218);t.default={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===i.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,s._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},code(e){let{gen:t,data:r,schema:l,parentSchema:u,it:c}=e,{oneOf:d}=u;if(!c.opts.discriminator)throw Error("discriminator: requires discriminator option");let p=l.propertyName;if("string"!=typeof p)throw Error("discriminator: requires propertyName");if(l.mapping)throw Error("discriminator: mapping is not supported");if(!d)throw Error("discriminator: requires oneOf keyword");let f=t.let("valid",!1),h=t.const("tag",(0,s._)`${r}${(0,s.getProperty)(p)}`);t.if((0,s._)`typeof ${h} == "string"`,()=>(function(){let r=function(){var e;let t={},r=i(u),s=!0;for(let t=0;t<d.length;t++){let u=d[t];if((null==u?void 0:u.$ref)&&!(0,o.schemaHasRulesButRef)(u,c.self.RULES)){let e=u.$ref;if((u=n.resolveRef.call(c.self,c.schemaEnv.root,c.baseId,e))instanceof n.SchemaEnv&&(u=u.schema),void 0===u)throw new a.default(c.opts.uriResolver,c.baseId,e)}let f=null==(e=null==u?void 0:u.properties)?void 0:e[p];if("object"!=typeof f)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${p}"`);s=s&&(r||i(u)),function(e,t){if(e.const)l(e.const,t);else if(e.enum)for(let r of e.enum)l(r,t);else throw Error(`discriminator: "properties/${p}" must have "const" or "enum"`)}(f,t)}if(!s)throw Error(`discriminator: "${p}" must be required`);return t;function i({required:e}){return Array.isArray(e)&&e.includes(p)}function l(e,r){if("string"!=typeof e||e in t)throw Error(`discriminator: "${p}" values must be unique strings`);t[e]=r}}();for(let i in t.if(!1),r)t.elseIf((0,s._)`${h} === ${i}`),t.assign(f,function(r){let i=t.name("valid"),n=e.subschema({keyword:"oneOf",schemaProp:r},i);return e.mergeEvaluated(n,s.Name),i}(r[i]));t.else(),e.error(!1,{discrError:i.DiscrError.Mapping,tag:h,tagName:p}),t.endIf()})(),()=>e.error(!1,{discrError:i.DiscrError.Tag,tag:h,tagName:p})),e.ok(f)}}},5141(e,t){"use strict";var r,s;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,(s=r||(t.DiscrError=r={})).Tag="tag",s.Mapping="mapping"},3959(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8119),i=r(659),n=r(8313),a=r(8563),o=r(4618);t.default=[s.default,i.default,(0,n.default)(),a.default,o.metadataVocabulary,o.contentVocabulary]},424(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994);t.default={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>(0,s.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,s._)`{format: ${e}}`},code(e,t){let r,i,n,a,o,l,{gen:u,data:c,$data:d,schema:p,schemaCode:f,it:h}=e,{opts:m,errSchemaPath:y,schemaEnv:g,self:v}=h;m.validateFormats&&(d?(r=u.scopeValue("formats",{ref:v.formats,code:m.code.formats}),i=u.const("fDef",(0,s._)`${r}[${f}]`),n=u.let("fType"),a=u.let("format"),u.if((0,s._)`typeof ${i} == "object" && !(${i} instanceof RegExp)`,()=>u.assign(n,(0,s._)`${i}.type || "string"`).assign(a,(0,s._)`${i}.validate`),()=>u.assign(n,(0,s._)`"string"`).assign(a,i)),e.fail$data((0,s.or)(!1===m.strictSchema?s.nil:(0,s._)`${f} && !${a}`,(o=g.$async?(0,s._)`(${i}.async ? await ${a}(${c}) : ${a}(${c}))`:(0,s._)`${a}(${c})`,l=(0,s._)`(typeof ${a} == "function" ? ${o} : ${a}.test(${c}))`,(0,s._)`${a} && ${a} !== true && ${n} === ${t} && !${l}`)))):function(){var r;let i,n,a=v.formats[p];if(!a){if(!1===m.strictSchema)return v.logger.warn(o());throw Error(o());function o(){return`unknown format "${p}" ignored in schema at path "${y}"`}}if(!0===a)return;let[l,d,f]=(i=(r=a)instanceof RegExp?(0,s.regexpCode)(r):m.code.formats?(0,s._)`${m.code.formats}${(0,s.getProperty)(p)}`:void 0,n=u.scopeValue("formats",{key:p,ref:r,code:i}),"object"!=typeof r||r instanceof RegExp?["string",r,n]:[r.type||"string",r.validate,(0,s._)`${n}.validate`]);l===t&&e.pass(function(){if("object"==typeof a&&!(a instanceof RegExp)&&a.async){if(!g.$async)throw Error("async format in sync schema");return(0,s._)`await ${f}(${c})`}return"function"==typeof d?(0,s._)`${f}(${c})`:(0,s._)`${f}.test(${c})`}())}())}}},8563(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=[r(424).default]},4618(e,t){"use strict";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"]},7080(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994),i=r(7218),n=r(6013);t.default={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>(0,s._)`{allowedValue: ${e}}`},code(e){let{gen:t,data:r,$data:a,schemaCode:o,schema:l}=e;a||l&&"object"==typeof l?e.fail$data((0,s._)`!${(0,i.useFunc)(t,n.default)}(${r}, ${o})`):e.fail((0,s._)`${l} !== ${r}`)}}},5358(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994),i=r(7218),n=r(6013);t.default={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,s._)`{allowedValues: ${e}}`},code(e){let t,r,{gen:a,data:o,$data:l,schema:u,schemaCode:c,it:d}=e;if(!l&&0===u.length)throw Error("enum must have non-empty array");let p=u.length>=d.opts.loopEnum,f=()=>null!=t?t:t=(0,i.useFunc)(a,n.default);if(p||l)r=a.let("valid"),e.block$data(r,function(){a.assign(r,!1),a.forOf("v",c,e=>a.if((0,s._)`${f()}(${o}, ${e})`,()=>a.assign(r,!0).break()))});else{if(!Array.isArray(u))throw Error("ajv implementation error");let e=a.const("vSchema",c);r=(0,s.or)(...u.map((t,r)=>{var i,n;let a;return i=e,"object"==typeof(a=u[n=r])&&null!==a?(0,s._)`${f()}(${o}, ${i}[${n}])`:(0,s._)`${o} === ${a}`}))}e.pass(r)}}},659(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8997),i=r(9190),n=r(4280),a=r(8805),o=r(2189),l=r(3138),u=r(8870),c=r(1858),d=r(7080),p=r(5358);t.default=[s.default,i.default,n.default,a.default,o.default,l.default,u.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},d.default,p.default]},8870(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994);t.default={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,s.str)`must NOT have ${"maxItems"===e?"more":"fewer"} than ${t} items`,params:({schemaCode:e})=>(0,s._)`{limit: ${e}}`},code(e){let{keyword:t,data:r,schemaCode:i}=e,n="maxItems"===t?s.operators.GT:s.operators.LT;e.fail$data((0,s._)`${r}.length ${n} ${i}`)}}},4280(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994),i=r(7218),n=r(5532);t.default={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,s.str)`must NOT have ${"maxLength"===e?"more":"fewer"} than ${t} characters`,params:({schemaCode:e})=>(0,s._)`{limit: ${e}}`},code(e){let{keyword:t,data:r,schemaCode:a,it:o}=e,l="maxLength"===t?s.operators.GT:s.operators.LT,u=!1===o.opts.unicode?(0,s._)`${r}.length`:(0,s._)`${(0,i.useFunc)(e.gen,n.default)}(${r})`;e.fail$data((0,s._)`${u} ${l} ${a}`)}}},8997(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994),i=s.operators,n={maximum:{okStr:"<=",ok:i.LTE,fail:i.GT},minimum:{okStr:">=",ok:i.GTE,fail:i.LT},exclusiveMaximum:{okStr:"<",ok:i.LT,fail:i.GTE},exclusiveMinimum:{okStr:">",ok:i.GT,fail:i.LTE}};t.default={keyword:Object.keys(n),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,s.str)`must be ${n[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,s._)`{comparison: ${n[e].okStr}, limit: ${t}}`},code(e){let{keyword:t,data:r,schemaCode:i}=e;e.fail$data((0,s._)`${r} ${n[t].fail} ${i} || isNaN(${r})`)}}},2189(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994);t.default={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,s.str)`must NOT have ${"maxProperties"===e?"more":"fewer"} than ${t} properties`,params:({schemaCode:e})=>(0,s._)`{limit: ${e}}`},code(e){let{keyword:t,data:r,schemaCode:i}=e,n="maxProperties"===t?s.operators.GT:s.operators.LT;e.fail$data((0,s._)`Object.keys(${r}).length ${n} ${i}`)}}},9190(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994);t.default={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>(0,s.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,s._)`{multipleOf: ${e}}`},code(e){let{gen:t,data:r,schemaCode:i,it:n}=e,a=n.opts.multipleOfPrecision,o=t.let("res"),l=a?(0,s._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${a}`:(0,s._)`${o} !== parseInt(${o})`;e.fail$data((0,s._)`(${i} === 0 || (${o} = ${r}/${i}, ${l}))`)}}},8805(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(4954),i=r(7218),n=r(8994);t.default={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>(0,n.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,n._)`{pattern: ${e}}`},code(e){let{gen:t,data:r,$data:a,schema:o,schemaCode:l,it:u}=e,c=u.opts.unicodeRegExp?"u":"";if(a){let{regExp:s}=u.opts.code,a="new RegExp"===s.code?(0,n._)`new RegExp`:(0,i.useFunc)(t,s),o=t.let("valid");t.try(()=>t.assign(o,(0,n._)`${a}(${l}, ${c}).test(${r})`),()=>t.assign(o,!1)),e.fail$data((0,n._)`!${o}`)}else{let t=(0,s.usePattern)(e,o);e.fail$data((0,n._)`!${t}.test(${r})`)}}}},3138(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(4954),i=r(8994),n=r(7218);t.default={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>(0,i.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,i._)`{missingProperty: ${e}}`},code(e){let{gen:t,schema:r,schemaCode:a,data:o,$data:l,it:u}=e,{opts:c}=u;if(!l&&0===r.length)return;let d=r.length>=c.loopRequired;if(u.allErrors?function(){if(d||l)e.block$data(i.nil,p);else for(let t of r)(0,s.checkReportMissingProp)(e,t)}():function(){let n=t.let("missing");if(d||l){let r=t.let("valid",!0);e.block$data(r,()=>{var l,u;return l=n,u=r,void(e.setParams({missingProperty:l}),t.forOf(l,a,()=>{t.assign(u,(0,s.propertyInData)(t,o,l,c.ownProperties)),t.if((0,i.not)(u),()=>{e.error(),t.break()})},i.nil))}),e.ok(r)}else t.if((0,s.checkMissingProp)(e,r,n)),(0,s.reportMissingProp)(e,n),t.else()}(),c.strictRequired){let t=e.parentSchema.properties,{definedProperties:s}=e.it;for(let e of r)if((null==t?void 0:t[e])===void 0&&!s.has(e)){let t=u.schemaEnv.baseId+u.errSchemaPath,r=`required property "${e}" is not defined at "${t}" (strictRequired)`;(0,n.checkStrictMode)(u,r,u.opts.strictRequired)}}function p(){t.forOf("prop",a,r=>{e.setParams({missingProperty:r}),t.if((0,s.noPropertyInData)(t,o,r,c.ownProperties),()=>e.error())})}}}},1858(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(6419),i=r(8994),n=r(7218),a=r(6013);t.default={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>(0,i.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,i._)`{i: ${e}, j: ${t}}`},code(e){let{gen:t,data:r,$data:o,schema:l,parentSchema:u,schemaCode:c,it:d}=e;if(!o&&!l)return;let p=t.let("valid"),f=u.items?(0,s.getSchemaTypes)(u.items):[];e.block$data(p,function(){let o=t.let("i",(0,i._)`${r}.length`),l=t.let("j");e.setParams({i:o,j:l}),t.assign(p,!0),t.if((0,i._)`${o} > 1`,()=>(f.length>0&&!f.some(e=>"object"===e||"array"===e)?function(n,a){let o=t.name("item"),l=(0,s.checkDataTypes)(f,o,d.opts.strictNumbers,s.DataType.Wrong),u=t.const("indices",(0,i._)`{}`);t.for((0,i._)`;${n}--;`,()=>{t.let(o,(0,i._)`${r}[${n}]`),t.if(l,(0,i._)`continue`),f.length>1&&t.if((0,i._)`typeof ${o} == "string"`,(0,i._)`${o} += "_"`),t.if((0,i._)`typeof ${u}[${o}] == "number"`,()=>{t.assign(a,(0,i._)`${u}[${o}]`),e.error(),t.assign(p,!1).break()}).code((0,i._)`${u}[${o}] = ${n}`)})}:function(s,o){let l=(0,n.useFunc)(t,a.default),u=t.name("outer");t.label(u).for((0,i._)`;${s}--;`,()=>t.for((0,i._)`${o} = ${s}; ${o}--;`,()=>t.if((0,i._)`${l}(${r}[${s}], ${r}[${o}])`,()=>{e.error(),t.assign(p,!1).break(u)})))})(o,l))},(0,i._)`${c} === false`),e.ok(p)}}},9454(e,t,r){"use strict";var s=r(181).Buffer,i=r(181).SlowBuffer;function n(e,t){if(!s.isBuffer(e)||!s.isBuffer(t)||e.length!==t.length)return!1;for(var r=0,i=0;i<e.length;i++)r|=e[i]^t[i];return 0===r}e.exports=n,n.install=function(){s.prototype.equal=i.prototype.equal=function(e){return n(this,e)}};var a=s.prototype.equal,o=i.prototype.equal;n.restore=function(){s.prototype.equal=a,i.prototype.equal=o}},6507(e,t,r){"use strict";let s=r(5317),i=r(8388),n=r(442);function a(e,t,r){let a=i(e,t,r),o=s.spawn(a.command,a.args,a.options);return n.hookChildProcess(o,a),o}e.exports=a,e.exports.spawn=a,e.exports.sync=function(e,t,r){let a=i(e,t,r),o=s.spawnSync(a.command,a.args,a.options);return o.error=o.error||n.verifyENOENTSync(o.status,a),o},e.exports._parse=i,e.exports._enoent=n},442(e){"use strict";let t="win32"===process.platform;function r(e,t){return Object.assign(Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function s(e,s){return t&&1===e&&!s.file?r(s.original,"spawn"):null}e.exports={hookChildProcess:function(e,r){if(!t)return;let i=e.emit;e.emit=function(t,n){if("exit"===t){let t=s(n,r);if(t)return i.call(e,"error",t)}return i.apply(e,arguments)}},verifyENOENT:s,verifyENOENTSync:function(e,s){return t&&1===e&&!s.file?r(s.original,"spawnSync"):null},notFoundError:r}},8388(e,t,r){"use strict";let s=r(6928),i=r(3803),n=r(2077),a=r(1880),o="win32"===process.platform,l=/\.(?:com|exe)$/i,u=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;e.exports=function(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null);let c={command:e,args:t=t?t.slice(0):[],options:r=Object.assign({},r),file:void 0,original:{command:e,args:t}};return r.shell?c:function(e){let t;if(!o)return e;let r=(e.file=i(e),(t=e.file&&a(e.file))?(e.args.unshift(e.file),e.command=t,i(e)):e.file),c=!l.test(r);if(e.options.forceShell||c){let t=u.test(r);e.command=s.normalize(e.command),e.command=n.command(e.command),e.args=e.args.map(e=>n.argument(e,t));let i=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${i}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}(c)}},2077(e){"use strict";let t=/([()\][%!^"`<>&|;, *?])/g;e.exports.command=function(e){return e.replace(t,"^$1")},e.exports.argument=function(e,r){return e=(e=(e=`${e}`).replace(/(?=(\\+?)?)\1"/g,'$1$1\\"')).replace(/(?=(\\+?)?)\1$/,"$1$1"),e=(e=`"${e}"`).replace(t,"^$1"),r&&(e=e.replace(t,"^$1")),e}},1880(e,t,r){"use strict";let s=r(9896),i=r(600);e.exports=function(e){let t,r=Buffer.alloc(150);try{t=s.openSync(e,"r"),s.readSync(t,r,0,150,0),s.closeSync(t)}catch(e){}return i(r.toString())}},3803(e,t,r){"use strict";let s=r(6928),i=r(1905),n=r(9695);function a(e,t){let r,a=e.options.env||process.env,o=process.cwd(),l=null!=e.options.cwd,u=l&&void 0!==process.chdir&&!process.chdir.disabled;if(u)try{process.chdir(e.options.cwd)}catch(e){}try{r=i.sync(e.command,{path:a[n({env:a})],pathExt:t?s.delimiter:void 0})}catch(e){}finally{u&&process.chdir(o)}return r&&(r=s.resolve(l?e.options.cwd:"",r)),r}e.exports=function(e){return a(e)||a(e,!0)}},8583(e,t,r){let s=r(9896),i=r(6928),n=r(857),a=r(6982),o=r(4519).version,l=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function u(e){console.log(`[dotenv@${o}][DEBUG] ${e}`)}function c(e){console.log(`[dotenv@${o}] ${e}`)}function d(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function p(e){let t=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(let r of e.path)s.existsSync(r)&&(t=r.endsWith(".vault")?r:`${r}.vault`);else t=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else t=i.resolve(process.cwd(),".env.vault");return s.existsSync(t)?t:null}function f(e){return"~"===e[0]?i.join(n.homedir(),e.slice(1)):e}let h={configDotenv:function(e){let t,r=i.resolve(process.cwd(),".env"),n="utf8",a=!!(e&&e.debug),o=!e||!("quiet"in e)||e.quiet;e&&e.encoding?n=e.encoding:a&&u("No encoding is specified. UTF-8 is used by default");let l=[r];if(e&&e.path)if(Array.isArray(e.path))for(let t of(l=[],e.path))l.push(f(t));else l=[f(e.path)];let d={};for(let r of l)try{let t=h.parse(s.readFileSync(r,{encoding:n}));h.populate(d,t,e)}catch(e){a&&u(`Failed to load ${r} ${e.message}`),t=e}let p=process.env;if(e&&null!=e.processEnv&&(p=e.processEnv),h.populate(p,d,e),a||!o){let e=Object.keys(d).length,r=[];for(let e of l)try{let t=i.relative(process.cwd(),e);r.push(t)}catch(r){a&&u(`Failed to load ${e} ${r.message}`),t=r}c(`injecting env (${e}) from ${r.join(",")}`)}return t?{parsed:d,error:t}:{parsed:d}},_configVault:function(e){let t=!!(e&&e.debug),r=!e||!("quiet"in e)||e.quiet;(t||!r)&&c("Loading env from encrypted .env.vault");let s=h._parseVault(e),i=process.env;return e&&null!=e.processEnv&&(i=e.processEnv),h.populate(i,s,e),{parsed:s}},_parseVault:function(e){let t,r=p(e=e||{});e.path=r;let s=h.configDotenv(e);if(!s.parsed){let e=Error(`MISSING_DATA: Cannot parse ${r} for an unknown reason`);throw e.code="MISSING_DATA",e}let i=d(e).split(","),n=i.length;for(let e=0;e<n;e++)try{let r=i[e].trim(),n=function(e,t){let r;try{r=new URL(t)}catch(e){if("ERR_INVALID_URL"===e.code){let e=Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw e.code="INVALID_DOTENV_KEY",e}throw e}let s=r.password;if(!s){let e=Error("INVALID_DOTENV_KEY: Missing key part");throw e.code="INVALID_DOTENV_KEY",e}let i=r.searchParams.get("environment");if(!i){let e=Error("INVALID_DOTENV_KEY: Missing environment part");throw e.code="INVALID_DOTENV_KEY",e}let n=`DOTENV_VAULT_${i.toUpperCase()}`,a=e.parsed[n];if(!a){let e=Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${n} in your .env.vault file.`);throw e.code="NOT_FOUND_DOTENV_ENVIRONMENT",e}return{ciphertext:a,key:s}}(s,r);t=h.decrypt(n.ciphertext,n.key);break}catch(t){if(e+1>=n)throw t}return h.parse(t)},config:function(e){if(0===d(e).length)return h.configDotenv(e);let t=p(e);if(!t){var r;return r=`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`,console.log(`[dotenv@${o}][WARN] ${r}`),h.configDotenv(e)}return h._configVault(e)},decrypt:function(e,t){let r=Buffer.from(t.slice(-64),"hex"),s=Buffer.from(e,"base64"),i=s.subarray(0,12),n=s.subarray(-16);s=s.subarray(12,-16);try{let e=a.createDecipheriv("aes-256-gcm",r,i);return e.setAuthTag(n),`${e.update(s)}${e.final()}`}catch(s){let e=s instanceof RangeError,t="Invalid key length"===s.message,r="Unsupported state or unable to authenticate data"===s.message;if(e||t){let e=Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw e.code="INVALID_DOTENV_KEY",e}if(r){let e=Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw e.code="DECRYPTION_FAILED",e}throw s}},parse:function(e){let t,r={},s=e.toString();for(s=s.replace(/\r\n?/mg,"\n");null!=(t=l.exec(s));){let e=t[1],s=t[2]||"",i=(s=s.trim())[0];s=s.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),'"'===i&&(s=(s=s.replace(/\\n/g,"\n")).replace(/\\r/g,"\r")),r[e]=s}return r},populate:function(e,t,r={}){let s=!!(r&&r.debug),i=!!(r&&r.override);if("object"!=typeof t){let e=Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw e.code="OBJECT_REQUIRED",e}for(let r of Object.keys(t))Object.prototype.hasOwnProperty.call(e,r)?(!0===i&&(e[r]=t[r]),s&&(!0===i?u(`"${r}" is already defined and WAS overwritten`):u(`"${r}" is already defined and was NOT overwritten`))):e[r]=t[r]}};e.exports.configDotenv=h.configDotenv,e.exports._configVault=h._configVault,e.exports._parseVault=h._parseVault,e.exports.config=h.config,e.exports.decrypt=h.decrypt,e.exports.parse=h.parse,e.exports.populate=h.populate,e.exports=h},9053(e,t,r){"use strict";var s=r(6608).Buffer,i=r(2188);function n(e){if(s.isBuffer(e))return e;if("string"==typeof e)return s.from(e,"base64");throw TypeError("ECDSA signature must be a Base64 string or a Buffer")}function a(e,t,r){for(var s=0;t+s<r&&0===e[t+s];)++s;return e[t+s]>=128&&--s,s}e.exports={derToJose:function(e,t){e=n(e);var r=i(t),a=r+1,o=e.length,l=0;if(48!==e[l++])throw Error('Could not find expected "seq"');var u=e[l++];if(129===u&&(u=e[l++]),o-l<u)throw Error('"seq" specified length of "'+u+'", only "'+(o-l)+'" remaining');if(2!==e[l++])throw Error('Could not find expected "int" for "r"');var c=e[l++];if(o-l-2<c)throw Error('"r" specified length of "'+c+'", only "'+(o-l-2)+'" available');if(a<c)throw Error('"r" specified length of "'+c+'", max of "'+a+'" is acceptable');var d=l;if(l+=c,2!==e[l++])throw Error('Could not find expected "int" for "s"');var p=e[l++];if(o-l!==p)throw Error('"s" specified length of "'+p+'", expected "'+(o-l)+'"');if(a<p)throw Error('"s" specified length of "'+p+'", max of "'+a+'" is acceptable');var f=l;if((l+=p)!==o)throw Error('Expected to consume entire buffer, but "'+(o-l)+'" bytes remain');var h=r-c,m=r-p,y=s.allocUnsafe(h+c+m+p);for(l=0;l<h;++l)y[l]=0;e.copy(y,l,d+Math.max(-h,0),d+c),l=r;for(var g=l;l<g+m;++l)y[l]=0;return e.copy(y,l,f+Math.max(-m,0),f+p),y=(y=y.toString("base64")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},joseToDer:function(e,t){e=n(e);var r=i(t),o=e.length;if(o!==2*r)throw TypeError('"'+t+'" signatures must be "'+2*r+'" bytes, saw "'+o+'"');var l=a(e,0,r),u=a(e,r,e.length),c=r-l,d=r-u,p=2+c+1+1+d,f=p<128,h=s.allocUnsafe((f?2:3)+p),m=0;return h[m++]=48,f?h[m++]=p:(h[m++]=129,h[m++]=255&p),h[m++]=2,h[m++]=c,l<0?(h[m++]=0,m+=e.copy(h,m,0,r)):m+=e.copy(h,m,l,r),h[m++]=2,h[m++]=d,u<0?(h[m++]=0,e.copy(h,m,r)):e.copy(h,m,r+u),h}}},2188(e){"use strict";function t(e){return(e/8|0)+ +(e%8!=0)}var r={ES256:t(256),ES384:t(384),ES512:t(521)};e.exports=function(e){var t=r[e];if(t)return t;throw Error('Unknown algorithm "'+e+'"')}},7371(e){"use strict";e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;if(Array.isArray(t)){if((s=t.length)!=r.length)return!1;for(i=s;0!=i--;)if(!e(t[i],r[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((s=(n=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(i=s;0!=i--;)if(!Object.prototype.hasOwnProperty.call(r,n[i]))return!1;for(i=s;0!=i--;){var s,i,n,a=n[i];if(!e(t[a],r[a]))return!1}return!0}return t!=t&&r!=r}},9344(e,t,r){var s;function i(e,t,r){if("function"==typeof t&&(r=t,t={}),!r){if("function"!=typeof Promise)throw TypeError("callback not provided");return new Promise(function(r,s){i(e,t||{},function(e,t){e?s(e):r(t)})})}s(e,t||{},function(e,s){e&&("EACCES"===e.code||t&&t.ignoreErrors)&&(e=null,s=!1),r(e,s)})}r(9896),s="win32"===process.platform||global.TESTING_WINDOWS?r(8541):r(709),e.exports=i,i.sync=function(e,t){try{return s.sync(e,t||{})}catch(e){if(t&&t.ignoreErrors||"EACCES"===e.code)return!1;throw e}}},709(e,t,r){e.exports=i,i.sync=function(e,t){return n(s.statSync(e),t)};var s=r(9896);function i(e,t,r){s.stat(e,function(e,s){r(e,!e&&n(s,t))})}function n(e,t){var r,s,i,n,a,o,l,u,c;return e.isFile()&&(r=e,s=t,i=r.mode,n=r.uid,a=r.gid,o=void 0!==s.uid?s.uid:process.getuid&&process.getuid(),l=void 0!==s.gid?s.gid:process.getgid&&process.getgid(),u=parseInt("100",8),c=parseInt("010",8),i&parseInt("001",8)||i&c&&a===l||i&u&&n===o||i&(u|c)&&0===o)}},8541(e,t,r){e.exports=n,n.sync=function(e,t){return i(s.statSync(e),e,t)};var s=r(9896);function i(e,t,r){if(!e.isSymbolicLink()&&!e.isFile())return!1;var s=void 0!==r.pathExt?r.pathExt:process.env.PATHEXT;if(!s||-1!==(s=s.split(";")).indexOf(""))return!0;for(var i=0;i<s.length;i++){var n=s[i].toLowerCase();if(n&&t.substr(-n.length).toLowerCase()===n)return!0}return!1}function n(e,t,r){s.stat(e,function(s,n){r(s,!s&&i(n,e,t))})}},205(e){"use strict";var t=e.exports=function(e,r,s){"function"==typeof r&&(s=r,r={});var i="function"==typeof(s=r.cb||s)?s:s.pre||function(){};!function e(r,s,i,n,a,o,l,u,c,d){if(n&&"object"==typeof n&&!Array.isArray(n)){for(var p in s(n,a,o,l,u,c,d),n){var f=n[p];if(Array.isArray(f)){if(p in t.arrayKeywords)for(var h=0;h<f.length;h++)e(r,s,i,f[h],a+"/"+p+"/"+h,o,a,p,n,h)}else if(p in t.propsKeywords){if(f&&"object"==typeof f)for(var m in f)e(r,s,i,f[m],a+"/"+p+"/"+m.replace(/~/g,"~0").replace(/\//g,"~1"),o,a,p,n,m)}else(p in t.keywords||r.allKeys&&!(p in t.skipKeywords))&&e(r,s,i,f,a+"/"+p,o,a,p,n)}i(n,a,o,l,u,c,d)}}(r,i,s.post||function(){},e,"",e)};t.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},t.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},t.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},t.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}},2548(e,t,r){var s=r(3263);e.exports=function(e,t){t=t||{};var r=s.decode(e,t);if(!r)return null;var i=r.payload;if("string"==typeof i)try{var n=JSON.parse(i);null!==n&&"object"==typeof n&&(i=n)}catch(e){}return!0===t.complete?{header:r.header,payload:i,signature:r.signature}:i}},8400(e,t,r){e.exports={decode:r(2548),verify:r(6467),sign:r(9147),JsonWebTokenError:r(1957),NotBeforeError:r(4470),TokenExpiredError:r(7788)}},1957(e){var t=function(e,t){Error.call(this,e),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name="JsonWebTokenError",this.message=e,t&&(this.inner=t)};t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,e.exports=t},4470(e,t,r){var s=r(1957),i=function(e,t){s.call(this,e),this.name="NotBeforeError",this.date=t};i.prototype=Object.create(s.prototype),i.prototype.constructor=i,e.exports=i},7788(e,t,r){var s=r(1957),i=function(e,t){s.call(this,e),this.name="TokenExpiredError",this.expiredAt=t};i.prototype=Object.create(s.prototype),i.prototype.constructor=i,e.exports=i},5841(e,t,r){e.exports=r(3895).satisfies(process.version,">=15.7.0")},953(e,t,r){e.exports=r(3895).satisfies(process.version,"^6.12.0 || >=8.0.0")},455(e,t,r){e.exports=r(3895).satisfies(process.version,">=16.9.0")},4559(e,t,r){var s=r(3866);e.exports=function(e,t){var r=t||Math.floor(Date.now()/1e3);if("string"==typeof e){var i=s(e);if(void 0===i)return;return Math.floor(r+i/1e3)}if("number"==typeof e)return r+e}},723(e,t,r){let s=r(5841),i=r(455),n={ec:["ES256","ES384","ES512"],rsa:["RS256","PS256","RS384","PS384","RS512","PS512"],"rsa-pss":["PS256","PS384","PS512"]},a={ES256:"prime256v1",ES384:"secp384r1",ES512:"secp521r1"};e.exports=function(e,t){if(!e||!t)return;let r=t.asymmetricKeyType;if(!r)return;let o=n[r];if(!o)throw Error(`Unknown key type "${r}".`);if(!o.includes(e))throw Error(`"alg" parameter for "${r}" key type must be one of: ${o.join(", ")}.`);if(s)switch(r){case"ec":let l=t.asymmetricKeyDetails.namedCurve,u=a[e];if(l!==u)throw Error(`"alg" parameter "${e}" requires curve "${u}".`);break;case"rsa-pss":if(i){let r=parseInt(e.slice(-3),10),{hashAlgorithm:s,mgf1HashAlgorithm:i,saltLength:n}=t.asymmetricKeyDetails;if(s!==`sha${r}`||i!==s)throw Error(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${e}.`);if(void 0!==n&&n>r>>3)throw Error(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${e}.`)}}}},9147(e,t,r){let s=r(4559),i=r(953),n=r(723),a=r(3263),o=r(5357),l=r(6782),u=r(5250),c=r(8094),d=r(6052),p=r(1251),f=r(8430),{KeyObject:h,createSecretKey:m,createPrivateKey:y}=r(6982),g=["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512","none"];i&&g.splice(3,0,"PS256","PS384","PS512");let v={expiresIn:{isValid:function(e){return u(e)||p(e)&&e},message:'"expiresIn" should be a number of seconds or string representing a timespan'},notBefore:{isValid:function(e){return u(e)||p(e)&&e},message:'"notBefore" should be a number of seconds or string representing a timespan'},audience:{isValid:function(e){return p(e)||Array.isArray(e)},message:'"audience" must be a string or array'},algorithm:{isValid:o.bind(null,g),message:'"algorithm" must be a valid string enum value'},header:{isValid:d,message:'"header" must be an object'},encoding:{isValid:p,message:'"encoding" must be a string'},issuer:{isValid:p,message:'"issuer" must be a string'},subject:{isValid:p,message:'"subject" must be a string'},jwtid:{isValid:p,message:'"jwtid" must be a string'},noTimestamp:{isValid:l,message:'"noTimestamp" must be a boolean'},keyid:{isValid:p,message:'"keyid" must be a string'},mutatePayload:{isValid:l,message:'"mutatePayload" must be a boolean'},allowInsecureKeySizes:{isValid:l,message:'"allowInsecureKeySizes" must be a boolean'},allowInvalidAsymmetricKeyTypes:{isValid:l,message:'"allowInvalidAsymmetricKeyTypes" must be a boolean'}},_={iat:{isValid:c,message:'"iat" should be a number of seconds'},exp:{isValid:c,message:'"exp" should be a number of seconds'},nbf:{isValid:c,message:'"nbf" should be a number of seconds'}};function b(e,t,r,s){if(!d(r))throw Error('Expected "'+s+'" to be a plain object.');Object.keys(r).forEach(function(i){let n=e[i];if(!n){if(!t)throw Error('"'+i+'" is not allowed in "'+s+'"');return}if(!n.isValid(r[i]))throw Error(n.message)})}let w={audience:"aud",issuer:"iss",subject:"sub",jwtid:"jti"},$=["expiresIn","notBefore","noTimestamp","audience","issuer","subject","jwtid"];e.exports=function(e,t,r,i){var o,l;"function"==typeof r?(i=r,r={}):r=r||{};let u="object"==typeof e&&!Buffer.isBuffer(e),c=Object.assign({alg:r.algorithm||"HS256",typ:u?"JWT":void 0,kid:r.keyid},r.header);function d(e){if(i)return i(e);throw e}if(!t&&"none"!==r.algorithm)return d(Error("secretOrPrivateKey must have a value"));if(null!=t&&!(t instanceof h))try{t=y(t)}catch(e){try{t=m("string"==typeof t?Buffer.from(t):t)}catch(e){return d(Error("secretOrPrivateKey is not valid key material"))}}if(c.alg.startsWith("HS")&&"secret"!==t.type)return d(Error(`secretOrPrivateKey must be a symmetric key when using ${c.alg}`));if(/^(?:RS|PS|ES)/.test(c.alg)){if("private"!==t.type)return d(Error(`secretOrPrivateKey must be an asymmetric key when using ${c.alg}`));if(!r.allowInsecureKeySizes&&!c.alg.startsWith("ES")&&void 0!==t.asymmetricKeyDetails&&t.asymmetricKeyDetails.modulusLength<2048)return d(Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${c.alg}`))}if(void 0===e)return d(Error("payload is required"));if(u){try{o=e,b(_,!0,o,"payload")}catch(e){return d(e)}r.mutatePayload||(e=Object.assign({},e))}else{let t=$.filter(function(e){return void 0!==r[e]});if(t.length>0)return d(Error("invalid "+t.join(",")+" option for "+typeof e+" payload"))}if(void 0!==e.exp&&void 0!==r.expiresIn)return d(Error('Bad "options.expiresIn" option the payload already has an "exp" property.'));if(void 0!==e.nbf&&void 0!==r.notBefore)return d(Error('Bad "options.notBefore" option the payload already has an "nbf" property.'));try{l=r,b(v,!1,l,"options")}catch(e){return d(e)}if(!r.allowInvalidAsymmetricKeyTypes)try{n(c.alg,t)}catch(e){return d(e)}let p=e.iat||Math.floor(Date.now()/1e3);if(r.noTimestamp?delete e.iat:u&&(e.iat=p),void 0!==r.notBefore){try{e.nbf=s(r.notBefore,p)}catch(e){return d(e)}if(void 0===e.nbf)return d(Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}if(void 0!==r.expiresIn&&"object"==typeof e){try{e.exp=s(r.expiresIn,p)}catch(e){return d(e)}if(void 0===e.exp)return d(Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}Object.keys(w).forEach(function(t){let s=w[t];if(void 0!==r[t]){if(void 0!==e[s])return d(Error('Bad "options.'+t+'" option. The payload already has an "'+s+'" property.'));e[s]=r[t]}});let g=r.encoding||"utf8";if("function"==typeof i)i=i&&f(i),a.createSign({header:c,privateKey:t,payload:e,encoding:g}).once("error",i).once("done",function(e){if(!r.allowInsecureKeySizes&&/^(?:RS|PS)/.test(c.alg)&&e.length<256)return i(Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${c.alg}`));i(null,e)});else{let s=a.sign({header:c,payload:e,secret:t,encoding:g});if(!r.allowInsecureKeySizes&&/^(?:RS|PS)/.test(c.alg)&&s.length<256)throw Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${c.alg}`);return s}}},6467(e,t,r){let s=r(1957),i=r(4470),n=r(7788),a=r(2548),o=r(4559),l=r(723),u=r(953),c=r(3263),{KeyObject:d,createSecretKey:p,createPublicKey:f}=r(6982),h=["RS256","RS384","RS512"],m=["ES256","ES384","ES512"],y=["RS256","RS384","RS512"],g=["HS256","HS384","HS512"];u&&(h.splice(h.length,0,"PS256","PS384","PS512"),y.splice(y.length,0,"PS256","PS384","PS512")),e.exports=function(e,t,r,u){let v,_,b;if("function"!=typeof r||u||(u=r,r={}),r||(r={}),r=Object.assign({},r),v=u||function(e,t){if(e)throw e;return t},r.clockTimestamp&&"number"!=typeof r.clockTimestamp)return v(new s("clockTimestamp must be a number"));if(void 0!==r.nonce&&("string"!=typeof r.nonce||""===r.nonce.trim()))return v(new s("nonce must be a non-empty string"));if(void 0!==r.allowInvalidAsymmetricKeyTypes&&"boolean"!=typeof r.allowInvalidAsymmetricKeyTypes)return v(new s("allowInvalidAsymmetricKeyTypes must be a boolean"));let w=r.clockTimestamp||Math.floor(Date.now()/1e3);if(!e)return v(new s("jwt must be provided"));if("string"!=typeof e)return v(new s("jwt must be a string"));let $=e.split(".");if(3!==$.length)return v(new s("jwt malformed"));try{_=a(e,{complete:!0})}catch(e){return v(e)}if(!_)return v(new s("invalid token"));let E=_.header;if("function"==typeof t){if(!u)return v(new s("verify must be called asynchronous if secret or public key is provided as a callback"));b=t}else b=function(e,r){return r(null,t)};return b(E,function(t,a){let u;if(t)return v(new s("error in secret or public key callback: "+t.message));let b=""!==$[2].trim();if(!b&&a)return v(new s("jwt signature is required"));if(b&&!a)return v(new s("secret or public key must be provided"));if(!b&&!r.algorithms)return v(new s('please specify "none" in "algorithms" to verify unsigned tokens'));if(null!=a&&!(a instanceof d))try{a=f(a)}catch(e){try{a=p("string"==typeof a?Buffer.from(a):a)}catch(e){return v(new s("secretOrPublicKey is not valid key material"))}}if(r.algorithms||("secret"===a.type?r.algorithms=g:["rsa","rsa-pss"].includes(a.asymmetricKeyType)?r.algorithms=y:"ec"===a.asymmetricKeyType?r.algorithms=m:r.algorithms=h),-1===r.algorithms.indexOf(_.header.alg))return v(new s("invalid algorithm"));if(E.alg.startsWith("HS")&&"secret"!==a.type)return v(new s(`secretOrPublicKey must be a symmetric key when using ${E.alg}`));if(/^(?:RS|PS|ES)/.test(E.alg)&&"public"!==a.type)return v(new s(`secretOrPublicKey must be an asymmetric key when using ${E.alg}`));if(!r.allowInvalidAsymmetricKeyTypes)try{l(E.alg,a)}catch(e){return v(e)}try{u=c.verify(e,_.header.alg,a)}catch(e){return v(e)}if(!u)return v(new s("invalid signature"));let k=_.payload;if(void 0!==k.nbf&&!r.ignoreNotBefore){if("number"!=typeof k.nbf)return v(new s("invalid nbf value"));if(k.nbf>w+(r.clockTolerance||0))return v(new i("jwt not active",new Date(1e3*k.nbf)))}if(void 0!==k.exp&&!r.ignoreExpiration){if("number"!=typeof k.exp)return v(new s("invalid exp value"));if(w>=k.exp+(r.clockTolerance||0))return v(new n("jwt expired",new Date(1e3*k.exp)))}if(r.audience){let e=Array.isArray(r.audience)?r.audience:[r.audience];if(!(Array.isArray(k.aud)?k.aud:[k.aud]).some(function(t){return e.some(function(e){return e instanceof RegExp?e.test(t):e===t})}))return v(new s("jwt audience invalid. expected: "+e.join(" or ")))}if(r.issuer&&("string"==typeof r.issuer&&k.iss!==r.issuer||Array.isArray(r.issuer)&&-1===r.issuer.indexOf(k.iss)))return v(new s("jwt issuer invalid. expected: "+r.issuer));if(r.subject&&k.sub!==r.subject)return v(new s("jwt subject invalid. expected: "+r.subject));if(r.jwtid&&k.jti!==r.jwtid)return v(new s("jwt jwtid invalid. expected: "+r.jwtid));if(r.nonce&&k.nonce!==r.nonce)return v(new s("jwt nonce invalid. expected: "+r.nonce));if(r.maxAge){if("number"!=typeof k.iat)return v(new s("iat required when maxAge is specified"));let e=o(r.maxAge,k.iat);if(void 0===e)return v(new s('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));if(w>=e+(r.clockTolerance||0))return v(new n("maxAge exceeded",new Date(1e3*e)))}return!0===r.complete?v(null,{header:E,payload:k,signature:_.signature}):v(null,k)})}},2357(e,t,r){var s,i=r(6608).Buffer,n=r(6982),a=r(9053),o=r(9023),l="secret must be a string or buffer",u="key must be a string or a buffer",c="function"==typeof n.createPublicKey;function d(e){if(!i.isBuffer(e)&&"string"!=typeof e&&(!c||"object"!=typeof e||"string"!=typeof e.type||"string"!=typeof e.asymmetricKeyType||"function"!=typeof e.export))throw m(u)}function p(e){if(!i.isBuffer(e)&&"string"!=typeof e&&"object"!=typeof e)throw m("key must be a string, a buffer or an object")}function f(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function h(e){var t=4-(e=e.toString()).length%4;if(4!==t)for(var r=0;r<t;++r)e+="=";return e.replace(/\-/g,"+").replace(/_/g,"/")}function m(e){var t=[].slice.call(arguments,1);return TypeError(o.format.bind(o,e).apply(null,t))}function y(e){var t;return t=e,i.isBuffer(t)||"string"==typeof t||(e=JSON.stringify(e)),e}function g(e){return function(t,r){!function(e){if(!i.isBuffer(e)){if("string"!=typeof e){if(!c||"object"!=typeof e||"secret"!==e.type||"function"!=typeof e.export)throw m(l)}}}(r),t=y(t);var s=n.createHmac("sha"+e,r);return f((s.update(t),s.digest("base64")))}}c&&(u+=" or a KeyObject",l+="or a KeyObject");var v="timingSafeEqual"in n?function(e,t){return e.byteLength===t.byteLength&&n.timingSafeEqual(e,t)}:function(e,t){return s||(s=r(9454)),s(e,t)};function _(e){return function(t,r,s){var n=g(e)(t,s);return v(i.from(r),i.from(n))}}function b(e){return function(t,r){p(r),t=y(t);var s=n.createSign("RSA-SHA"+e);return f((s.update(t),s.sign(r,"base64")))}}function w(e){return function(t,r,s){d(s),t=y(t),r=h(r);var i=n.createVerify("RSA-SHA"+e);return i.update(t),i.verify(s,r,"base64")}}function $(e){return function(t,r){p(r),t=y(t);var s=n.createSign("RSA-SHA"+e);return f((s.update(t),s.sign({key:r,padding:n.constants.RSA_PKCS1_PSS_PADDING,saltLength:n.constants.RSA_PSS_SALTLEN_DIGEST},"base64")))}}function E(e){return function(t,r,s){d(s),t=y(t),r=h(r);var i=n.createVerify("RSA-SHA"+e);return i.update(t),i.verify({key:s,padding:n.constants.RSA_PKCS1_PSS_PADDING,saltLength:n.constants.RSA_PSS_SALTLEN_DIGEST},r,"base64")}}function k(e){var t=b(e);return function(){var r=t.apply(null,arguments);return a.derToJose(r,"ES"+e)}}function S(e){var t=w(e);return function(r,s,i){return t(r,s=a.joseToDer(s,"ES"+e).toString("base64"),i)}}function x(){return function(){return""}}function T(){return function(e,t){return""===t}}e.exports=function(e){var t=e.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/);if(!t)throw m('"%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".',e);var r=(t[1]||t[3]).toLowerCase(),s=t[2];return{sign:({hs:g,rs:b,ps:$,es:k,none:x})[r](s),verify:({hs:_,rs:w,ps:E,es:S,none:T})[r](s)}}},3263(e,t,r){var s=r(9615),i=r(6747);t.ALGORITHMS=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"],t.sign=s.sign,t.verify=i.verify,t.decode=i.decode,t.isValid=i.isValid,t.createSign=function(e){return new s(e)},t.createVerify=function(e){return new i(e)}},6360(e,t,r){var s=r(6608).Buffer,i=r(2203);function n(e){if(this.buffer=null,this.writable=!0,this.readable=!0,!e)return this.buffer=s.alloc(0),this;if("function"==typeof e.pipe)return this.buffer=s.alloc(0),e.pipe(this),this;if(e.length||"object"==typeof e)return this.buffer=e,this.writable=!1,process.nextTick((function(){this.emit("end",e),this.readable=!1,this.emit("close")}).bind(this)),this;throw TypeError("Unexpected data type ("+typeof e+")")}r(9023).inherits(n,i),n.prototype.write=function(e){this.buffer=s.concat([this.buffer,s.from(e)]),this.emit("data",e)},n.prototype.end=function(e){e&&this.write(e),this.emit("end",e),this.emit("close"),this.writable=!1,this.readable=!1},e.exports=n},9615(e,t,r){var s=r(6608).Buffer,i=r(6360),n=r(2357),a=r(2203),o=r(5911),l=r(9023);function u(e,t){return s.from(e,t).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function c(e){var t,r,s,i=e.header,a=e.payload,c=e.secret||e.privateKey,d=e.encoding,p=n(i.alg),f=(t=(t=d)||"utf8",r=u(o(i),"binary"),s=u(o(a),t),l.format("%s.%s",r,s)),h=p.sign(f,c);return l.format("%s.%s",f,h)}function d(e){var t=e.secret;if(t=null==(t=null==t?e.privateKey:t)?e.key:t,!0===/^hs/i.test(e.header.alg)&&null==t)throw TypeError("secret must be a string or buffer or a KeyObject");var r=new i(t);this.readable=!0,this.header=e.header,this.encoding=e.encoding,this.secret=this.privateKey=this.key=r,this.payload=new i(e.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))}l.inherits(d,a),d.prototype.sign=function(){try{var e=c({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",e),this.emit("data",e),this.emit("end"),this.readable=!1,e}catch(e){this.readable=!1,this.emit("error",e),this.emit("close")}},d.sign=c,e.exports=d},5911(e,t,r){var s=r(181).Buffer;e.exports=function(e){return"string"==typeof e?e:"number"==typeof e||s.isBuffer(e)?e.toString():JSON.stringify(e)}},6747(e,t,r){var s=r(6608).Buffer,i=r(6360),n=r(2357),a=r(2203),o=r(5911),l=r(9023),u=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function c(e){var t=e.split(".",1)[0],r=s.from(t,"base64").toString("binary");if("[object Object]"===Object.prototype.toString.call(r))return r;try{return JSON.parse(r)}catch(e){return}}function d(e){return e.split(".")[2]}function p(e){return u.test(e)&&!!c(e)}function f(e,t,r){if(!t){var s=Error("Missing algorithm parameter for jws.verify");throw s.code="MISSING_ALGORITHM",s}var i=d(e=o(e)),a=e.split(".",2).join(".");return n(t).verify(a,i,r)}function h(e,t){if(t=t||{},!p(e=o(e)))return null;var r,i,n=c(e);if(!n)return null;var a=(r=r||"utf8",i=e.split(".")[1],s.from(i,"base64").toString(r));return("JWT"===n.typ||t.json)&&(a=JSON.parse(a,t.encoding)),{header:n,payload:a,signature:d(e)}}function m(e){var t=(e=e||{}).secret;if(t=null==(t=null==t?e.publicKey:t)?e.key:t,!0===/^hs/i.test(e.algorithm)&&null==t)throw TypeError("secret must be a string or buffer or a KeyObject");var r=new i(t);this.readable=!0,this.algorithm=e.algorithm,this.encoding=e.encoding,this.secret=this.publicKey=this.key=r,this.signature=new i(e.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))}l.inherits(m,a),m.prototype.verify=function(){try{var e=f(this.signature.buffer,this.algorithm,this.key.buffer),t=h(this.signature.buffer,this.encoding);return this.emit("done",e,t),this.emit("data",e),this.emit("end"),this.readable=!1,e}catch(e){this.readable=!1,this.emit("error",e),this.emit("close")}},m.decode=h,m.isValid=p,m.verify=f,e.exports=m},5357(e){var t,r,s=1/0,i=0/0,n=/^\s+|\s+$/g,a=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=/^(?:0|[1-9]\d*)$/,c=parseInt;function d(e){return e!=e}var p=Object.prototype,f=p.hasOwnProperty,h=p.toString,m=p.propertyIsEnumerable,y=(t=Object.keys,r=Object,function(e){return t(r(e))}),g=Math.max,v=Array.isArray;function _(e){var t,r,s;return null!=e&&"number"==typeof(t=e.length)&&t>-1&&t%1==0&&t<=0x1fffffffffffff&&"[object Function]"!=(s=b(r=e)?h.call(r):"")&&"[object GeneratorFunction]"!=s}function b(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function w(e){return!!e&&"object"==typeof e}e.exports=function(e,t,r,$){e=_(e)?e:function(e){return e?function(e,t){for(var r=-1,s=e?e.length:0,i=Array(s);++r<s;)i[r]=t(e[r],r,e);return i}(_(e)?function(e,t){var r,s,i,n,a=v(e)||w(s=r=e)&&_(s)&&f.call(r,"callee")&&(!m.call(r,"callee")||"[object Arguments]"==h.call(r))?function(e,t){for(var r=-1,s=Array(e);++r<e;)s[r]=t(r);return s}(e.length,String):[],o=a.length,l=!!o;for(var c in e){f.call(e,c)&&!(l&&("length"==c||(i=c,(n=null==(n=o)?0x1fffffffffffff:n)&&("number"==typeof i||u.test(i))&&i>-1&&i%1==0&&i<n)))&&a.push(c)}return a}(e):function(e){if(r=(t=e)&&t.constructor,t!==("function"==typeof r&&r.prototype||p))return y(e);var t,r,s=[];for(var i in Object(e))f.call(e,i)&&"constructor"!=i&&s.push(i);return s}(e),function(t){return e[t]}):[]}(e),r=r&&!$?(S=(k=(E=r)?(E=function(e){if("number"==typeof e)return e;if("symbol"==typeof(t=e)||w(t)&&"[object Symbol]"==h.call(t))return i;if(b(e)){var t,r="function"==typeof e.valueOf?e.valueOf():e;e=b(r)?r+"":r}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(n,"");var s=o.test(e);return s||l.test(e)?c(e.slice(2),s?2:8):a.test(e)?i:+e}(E))===s||E===-s?(E<0?-1:1)*17976931348623157e292:E==E?E:0:0===E?E:0)%1,k==k?S?k-S:k:0):0;var E,k,S,x,T=e.length;return r<0&&(r=g(T+r,0)),"string"==typeof(x=e)||!v(x)&&w(x)&&"[object String]"==h.call(x)?r<=T&&e.indexOf(t,r)>-1:!!T&&function(e,t,r){if(t!=t){for(var s=e.length,i=r+-1;++i<s;)if(d(e[i],i,e))return i;return -1}for(var n=r-1,a=e.length;++n<a;)if(e[n]===t)return n;return -1}(e,t,r)>-1}},6782(e){var t=Object.prototype.toString;e.exports=function(e){var r;return!0===e||!1===e||!!(r=e)&&"object"==typeof r&&"[object Boolean]"==t.call(e)}},5250(e){var t=1/0,r=0/0,s=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,a=/^0o[0-7]+$/i,o=parseInt,l=Object.prototype.toString;function u(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}e.exports=function(e){var c,d,p;return"number"==typeof e&&e==(p=(d=(c=e)?(c=function(e){if("number"==typeof e)return e;if("symbol"==typeof(t=e)||t&&"object"==typeof t&&"[object Symbol]"==l.call(t))return r;if(u(e)){var t,c="function"==typeof e.valueOf?e.valueOf():e;e=u(c)?c+"":c}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(s,"");var d=n.test(e);return d||a.test(e)?o(e.slice(2),d?2:8):i.test(e)?r:+e}(c))===t||c===-t?(c<0?-1:1)*17976931348623157e292:c==c?c:0:0===c?c:0)%1,d==d?p?d-p:d:0)}},8094(e){var t=Object.prototype.toString;e.exports=function(e){return"number"==typeof e||!!e&&"object"==typeof e&&"[object Number]"==t.call(e)}},6052(e){var t,r,s=Object.prototype,i=Function.prototype.toString,n=s.hasOwnProperty,a=i.call(Object),o=s.toString,l=(t=Object.getPrototypeOf,r=Object,function(e){return t(r(e))});e.exports=function(e){if(!(e&&"object"==typeof e)||"[object Object]"!=o.call(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e))return!1;var t=l(e);if(null===t)return!0;var r=n.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&i.call(r)==a}},1251(e){var t=Object.prototype.toString,r=Array.isArray;e.exports=function(e){var s;return"string"==typeof e||!r(e)&&!!(s=e)&&"object"==typeof s&&"[object String]"==t.call(e)}},8430(e){var t=1/0,r=0/0,s=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,a=/^0o[0-7]+$/i,o=parseInt,l=Object.prototype.toString;function u(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}e.exports=function(e){var c,d,p,f,h=2,m=e;if("function"!=typeof m)throw TypeError("Expected a function");return p=(d=(c=h)?(c=function(e){if("number"==typeof e)return e;if("symbol"==typeof(t=e)||t&&"object"==typeof t&&"[object Symbol]"==l.call(t))return r;if(u(e)){var t,c="function"==typeof e.valueOf?e.valueOf():e;e=u(c)?c+"":c}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(s,"");var d=n.test(e);return d||a.test(e)?o(e.slice(2),d?2:8):i.test(e)?r:+e}(c))===t||c===-t?(c<0?-1:1)*17976931348623157e292:c==c?c:0:0===c?c:0)%1,h=d==d?p?d-p:d:0,function(){return--h>0&&(f=m.apply(this,arguments)),h<=1&&(m=void 0),f}}},3866(e){function t(e,t,r,s){return Math.round(e/r)+" "+s+(t>=1.5*r?"s":"")}e.exports=function(e,r){r=r||{};var s,i,n,a,o=typeof e;if("string"===o&&e.length>0){var l=e;if(!((l=String(l)).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(l);if(u){var c=parseFloat(u[1]);switch((u[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*c;case"weeks":case"week":case"w":return 6048e5*c;case"days":case"day":case"d":return 864e5*c;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*c;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*c;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*c;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:break}}}return}if("number"===o&&isFinite(e)){return r.long?(i=Math.abs(s=e))>=864e5?t(s,i,864e5,"day"):i>=36e5?t(s,i,36e5,"hour"):i>=6e4?t(s,i,6e4,"minute"):i>=1e3?t(s,i,1e3,"second"):s+" ms":(a=Math.abs(n=e))>=864e5?Math.round(n/864e5)+"d":a>=36e5?Math.round(n/36e5)+"h":a>=6e4?Math.round(n/6e4)+"m":a>=1e3?Math.round(n/1e3)+"s":n+"ms"}throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},9695(e){"use strict";let t=(e={})=>{let t=e.env||process.env;return"win32"!==(e.platform||process.platform)?"PATH":Object.keys(t).reverse().find(e=>"PATH"===e.toUpperCase())||"Path"};e.exports=t,e.exports.default=t},6608(e,t,r){var s=r(181),i=s.Buffer;function n(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=s:(n(s,t),t.Buffer=a),a.prototype=Object.create(i.prototype),n(i,a),a.from=function(e,t,r){if("number"==typeof e)throw TypeError("Argument must not be a number");return i(e,t,r)},a.alloc=function(e,t,r){if("number"!=typeof e)throw TypeError("Argument must be a number");var s=i(e);return void 0!==t?"string"==typeof r?s.fill(t,r):s.fill(t):s.fill(0),s},a.allocUnsafe=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return i(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return s.SlowBuffer(e)}},8610(e,t,r){"use strict";let s=Symbol("SemVer ANY");class i{static get ANY(){return s}constructor(e,t){if(t=n(t),e instanceof i)if(!!t.loose===e.loose)return e;else e=e.value;u("comparator",e=e.trim().split(/\s+/).join(" "),t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===s?this.value="":this.value=this.operator+this.semver.version,u("comp",this)}parse(e){let t=this.options.loose?a[o.COMPARATORLOOSE]:a[o.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new c(r[2],this.options.loose):this.semver=s}toString(){return this.value}test(e){if(u("Comparator.test",e,this.options.loose),this.semver===s||e===s)return!0;if("string"==typeof e)try{e=new c(e,this.options)}catch(e){return!1}return l(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof i))throw TypeError("a Comparator is required");return""===this.operator?""===this.value||new d(e.value,t).test(this.value):""===e.operator?""===e.value||new d(this.value,t).test(e.semver):!((t=n(t)).includePrerelease&&("<0.0.0-0"===this.value||"<0.0.0-0"===e.value)||!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))&&!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||l(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||l(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">"))}}e.exports=i;let n=r(4621),{safeRe:a,t:o}=r(152),l=r(5461),u=r(674),c=r(2398),d=r(2069)},2069(e,t,r){"use strict";let s=/\s+/g;class i{constructor(e,t){if(t=a(t),e instanceof i)if(!!t.loose===e.loose&&!!t.includePrerelease===e.includePrerelease)return e;else return new i(e.raw,t);if(e instanceof o)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(s," "),this.set=this.raw.split("||").map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter(e=>!g(e[0])),0===this.set.length)this.set=[e];else if(this.set.length>1){for(const e of this.set)if(1===e.length&&v(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(void 0===this.formatted){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=" "),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=((this.options.includePrerelease&&m)|(this.options.loose&&y))+":"+e,r=n.get(t);if(r)return r;let s=this.options.loose,i=s?c[d.HYPHENRANGELOOSE]:c[d.HYPHENRANGE];l("hyphen replace",e=e.replace(i,I(this.options.includePrerelease))),l("comparator trim",e=e.replace(c[d.COMPARATORTRIM],p)),l("tilde trim",e=e.replace(c[d.TILDETRIM],f)),l("caret trim",e=e.replace(c[d.CARETTRIM],h));let a=e.split(" ").map(e=>b(e,this.options)).join(" ").split(/\s+/).map(e=>P(e,this.options));s&&(a=a.filter(e=>(l("loose invalid filter",e,this.options),!!e.match(c[d.COMPARATORLOOSE])))),l("range list",a);let u=new Map;for(let e of a.map(e=>new o(e,this.options))){if(g(e))return[e];u.set(e.value,e)}u.size>1&&u.has("")&&u.delete("");let v=[...u.values()];return n.set(t,v),v}intersects(e,t){if(!(e instanceof i))throw TypeError("a Range is required");return this.set.some(r=>_(r,t)&&e.set.some(e=>_(e,t)&&r.every(r=>e.every(e=>r.intersects(e,t)))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new u(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(j(this.set[t],e,this.options))return!0;return!1}}e.exports=i;let n=new(r(2044)),a=r(4621),o=r(8610),l=r(674),u=r(2398),{safeRe:c,t:d,comparatorTrimReplace:p,tildeTrimReplace:f,caretTrimReplace:h}=r(152),{FLAG_INCLUDE_PRERELEASE:m,FLAG_LOOSE:y}=r(5076),g=e=>"<0.0.0-0"===e.value,v=e=>""===e.value,_=(e,t)=>{let r=!0,s=e.slice(),i=s.pop();for(;r&&s.length;)r=s.every(e=>i.intersects(e,t)),i=s.pop();return r},b=(e,t)=>(l("comp",e=e.replace(c[d.BUILD],""),t),l("caret",e=k(e,t)),l("tildes",e=$(e,t)),l("xrange",e=x(e,t)),l("stars",e=O(e,t)),e),w=e=>!e||"x"===e.toLowerCase()||"*"===e,$=(e,t)=>e.trim().split(/\s+/).map(e=>E(e,t)).join(" "),E=(e,t)=>{let r=t.loose?c[d.TILDELOOSE]:c[d.TILDE];return e.replace(r,(t,r,s,i,n)=>{let a;return l("tilde",e,t,r,s,i,n),w(r)?a="":w(s)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:w(i)?a=`>=${r}.${s}.0 <${r}.${+s+1}.0-0`:n?(l("replaceTilde pr",n),a=`>=${r}.${s}.${i}-${n} <${r}.${+s+1}.0-0`):a=`>=${r}.${s}.${i} <${r}.${+s+1}.0-0`,l("tilde return",a),a})},k=(e,t)=>e.trim().split(/\s+/).map(e=>S(e,t)).join(" "),S=(e,t)=>{l("caret",e,t);let r=t.loose?c[d.CARETLOOSE]:c[d.CARET],s=t.includePrerelease?"-0":"";return e.replace(r,(t,r,i,n,a)=>{let o;return l("caret",e,t,r,i,n,a),w(r)?o="":w(i)?o=`>=${r}.0.0${s} <${+r+1}.0.0-0`:w(n)?o="0"===r?`>=${r}.${i}.0${s} <${r}.${+i+1}.0-0`:`>=${r}.${i}.0${s} <${+r+1}.0.0-0`:a?(l("replaceCaret pr",a),o="0"===r?"0"===i?`>=${r}.${i}.${n}-${a} <${r}.${i}.${+n+1}-0`:`>=${r}.${i}.${n}-${a} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${n}-${a} <${+r+1}.0.0-0`):(l("no pr"),o="0"===r?"0"===i?`>=${r}.${i}.${n}${s} <${r}.${i}.${+n+1}-0`:`>=${r}.${i}.${n}${s} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${n} <${+r+1}.0.0-0`),l("caret return",o),o})},x=(e,t)=>(l("replaceXRanges",e,t),e.split(/\s+/).map(e=>T(e,t)).join(" ")),T=(e,t)=>{e=e.trim();let r=t.loose?c[d.XRANGELOOSE]:c[d.XRANGE];return e.replace(r,(r,s,i,n,a,o)=>{l("xRange",e,r,s,i,n,a,o);let u=w(i),c=u||w(n),d=c||w(a);return"="===s&&d&&(s=""),o=t.includePrerelease?"-0":"",u?r=">"===s||"<"===s?"<0.0.0-0":"*":s&&d?(c&&(n=0),a=0,">"===s?(s=">=",c?(i=+i+1,n=0):n=+n+1,a=0):"<="===s&&(s="<",c?i=+i+1:n=+n+1),"<"===s&&(o="-0"),r=`${s+i}.${n}.${a}${o}`):c?r=`>=${i}.0.0${o} <${+i+1}.0.0-0`:d&&(r=`>=${i}.${n}.0${o} <${i}.${+n+1}.0-0`),l("xRange return",r),r})},O=(e,t)=>(l("replaceStars",e,t),e.trim().replace(c[d.STAR],"")),P=(e,t)=>(l("replaceGTE0",e,t),e.trim().replace(c[t.includePrerelease?d.GTE0PRE:d.GTE0],"")),I=e=>(t,r,s,i,n,a,o,l,u,c,d,p)=>(r=w(s)?"":w(i)?`>=${s}.0.0${e?"-0":""}`:w(n)?`>=${s}.${i}.0${e?"-0":""}`:a?`>=${r}`:`>=${r}${e?"-0":""}`,l=w(u)?"":w(c)?`<${+u+1}.0.0-0`:w(d)?`<${u}.${+c+1}.0-0`:p?`<=${u}.${c}.${d}-${p}`:e?`<${u}.${c}.${+d+1}-0`:`<=${l}`,`${r} ${l}`.trim()),j=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(l(e[r].semver),e[r].semver!==o.ANY&&e[r].semver.prerelease.length>0){let s=e[r].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}return!1}return!0}},2398(e,t,r){"use strict";let s=r(674),{MAX_LENGTH:i,MAX_SAFE_INTEGER:n}=r(5076),{safeRe:a,t:o}=r(152),l=r(4621),{compareIdentifiers:u}=r(9101);class c{constructor(e,t){if(t=l(t),e instanceof c)if(!!t.loose===e.loose&&!!t.includePrerelease===e.includePrerelease)return e;else e=e.version;else if("string"!=typeof e)throw TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>i)throw TypeError(`version is longer than ${i} characters`);s("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const r=e.trim().match(t.loose?a[o.LOOSE]:a[o.FULL]);if(!r)throw TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[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");r[4]?this.prerelease=r[4].split(".").map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<n)return t}return e}):this.prerelease=[],this.build=r[5]?r[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(e){if(s("SemVer.compare",this.version,this.options,e),!(e instanceof c)){if("string"==typeof e&&e===this.version)return 0;e=new c(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return(e instanceof c||(e=new c(e,this.options)),this.major<e.major)?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:+(this.patch>e.patch)}comparePre(e){if(e instanceof c||(e=new c(e,this.options)),this.prerelease.length&&!e.prerelease.length)return -1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],i=e.prerelease[t];if(s("prerelease compare",t,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return -1;else if(r===i)continue;else return u(r,i)}while(++t)}compareBuild(e){e instanceof c||(e=new c(e,this.options));let t=0;do{let r=this.build[t],i=e.build[t];if(s("build compare",t,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return -1;else if(r===i)continue;else return u(r,i)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&!1===r)throw Error("invalid increment argument: identifier is empty");if(t){let e=`-${t}`.match(this.options.loose?a[o.PRERELEASELOOSE]:a[o.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,r),this.inc("pre",t,r);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 e=+!!Number(r);if(0===this.prerelease.length)this.prerelease=[e];else{let s=this.prerelease.length;for(;--s>=0;)"number"==typeof this.prerelease[s]&&(this.prerelease[s]++,s=-2);if(-1===s){if(t===this.prerelease.join(".")&&!1===r)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let s=[t,e];!1===r&&(s=[t]),0===u(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}e.exports=c},5608(e,t,r){"use strict";let s=r(6802);e.exports=(e,t)=>{let r=s(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null}},5461(e,t,r){"use strict";let s=r(8271),i=r(733),n=r(1686),a=r(6479),o=r(7257),l=r(5850);e.exports=(e,t,r,u)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return s(e,r,u);case"!=":return i(e,r,u);case">":return n(e,r,u);case">=":return a(e,r,u);case"<":return o(e,r,u);case"<=":return l(e,r,u);default:throw TypeError(`Invalid operator: ${t}`)}}},7771(e,t,r){"use strict";let s=r(2398),i=r(6802),{safeRe:n,t:a}=r(152);e.exports=(e,t)=>{if(e instanceof s)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){let s,i=t.includePrerelease?n[a.COERCERTLFULL]:n[a.COERCERTL];for(;(s=i.exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&s.index+s[0].length===r.index+r[0].length||(r=s),i.lastIndex=s.index+s[1].length+s[2].length;i.lastIndex=-1}else r=e.match(t.includePrerelease?n[a.COERCEFULL]:n[a.COERCE]);if(null===r)return null;let o=r[2],l=r[3]||"0",u=r[4]||"0",c=t.includePrerelease&&r[5]?`-${r[5]}`:"",d=t.includePrerelease&&r[6]?`+${r[6]}`:"";return i(`${o}.${l}.${u}${c}${d}`,t)}},8767(e,t,r){"use strict";let s=r(2398);e.exports=(e,t,r)=>{let i=new s(e,r),n=new s(t,r);return i.compare(n)||i.compareBuild(n)}},6293(e,t,r){"use strict";let s=r(6958);e.exports=(e,t)=>s(e,t,!0)},6958(e,t,r){"use strict";let s=r(2398);e.exports=(e,t,r)=>new s(e,r).compare(new s(t,r))},3086(e,t,r){"use strict";let s=r(6802);e.exports=(e,t)=>{let r=s(e,null,!0),i=s(t,null,!0),n=r.compare(i);if(0===n)return null;let a=n>0,o=a?r:i,l=a?i:r,u=!!o.prerelease.length;if(l.prerelease.length&&!u){if(!l.patch&&!l.minor)return"major";if(0===l.compareMain(o))return l.minor&&!l.patch?"minor":"patch"}let c=u?"pre":"";return r.major!==i.major?c+"major":r.minor!==i.minor?c+"minor":r.patch!==i.patch?c+"patch":"prerelease"}},8271(e,t,r){"use strict";let s=r(6958);e.exports=(e,t,r)=>0===s(e,t,r)},1686(e,t,r){"use strict";let s=r(6958);e.exports=(e,t,r)=>s(e,t,r)>0},6479(e,t,r){"use strict";let s=r(6958);e.exports=(e,t,r)=>s(e,t,r)>=0},3625(e,t,r){"use strict";let s=r(2398);e.exports=(e,t,r,i,n)=>{"string"==typeof r&&(n=i,i=r,r=void 0);try{return new s(e instanceof s?e.version:e,r).inc(t,i,n).version}catch(e){return null}}},7257(e,t,r){"use strict";let s=r(6958);e.exports=(e,t,r)=>0>s(e,t,r)},5850(e,t,r){"use strict";let s=r(6958);e.exports=(e,t,r)=>0>=s(e,t,r)},7744(e,t,r){"use strict";let s=r(2398);e.exports=(e,t)=>new s(e,t).major},4812(e,t,r){"use strict";let s=r(2398);e.exports=(e,t)=>new s(e,t).minor},733(e,t,r){"use strict";let s=r(6958);e.exports=(e,t,r)=>0!==s(e,t,r)},6802(e,t,r){"use strict";let s=r(2398);e.exports=(e,t,r=!1)=>{if(e instanceof s)return e;try{return new s(e,t)}catch(e){if(!r)return null;throw e}}},8643(e,t,r){"use strict";let s=r(2398);e.exports=(e,t)=>new s(e,t).patch},9283(e,t,r){"use strict";let s=r(6802);e.exports=(e,t)=>{let r=s(e,t);return r&&r.prerelease.length?r.prerelease:null}},7032(e,t,r){"use strict";let s=r(6958);e.exports=(e,t,r)=>s(t,e,r)},9839(e,t,r){"use strict";let s=r(8767);e.exports=(e,t)=>e.sort((e,r)=>s(r,e,t))},4056(e,t,r){"use strict";let s=r(2069);e.exports=(e,t,r)=>{try{t=new s(t,r)}catch(e){return!1}return t.test(e)}},7697(e,t,r){"use strict";let s=r(8767);e.exports=(e,t)=>e.sort((e,r)=>s(e,r,t))},6807(e,t,r){"use strict";let s=r(6802);e.exports=(e,t)=>{let r=s(e,t);return r?r.version:null}},3895(e,t,r){"use strict";let s=r(152),i=r(5076),n=r(2398),a=r(9101),o=r(6802),l=r(6807),u=r(5608),c=r(3625),d=r(3086),p=r(7744),f=r(4812),h=r(8643),m=r(9283),y=r(6958),g=r(7032),v=r(6293),_=r(8767),b=r(7697),w=r(9839),$=r(1686),E=r(7257),k=r(8271),S=r(733),x=r(6479),T=r(5850),O=r(5461),P=r(7771),I=r(8610),j=r(2069),N=r(4056),R=r(6613),C=r(7114),A=r(1008),z=r(203),M=r(5372),D=r(4713),L=r(4497),q=r(9272),U=r(3490);e.exports={parse:o,valid:l,clean:u,inc:c,diff:d,major:p,minor:f,patch:h,prerelease:m,compare:y,rcompare:g,compareLoose:v,compareBuild:_,sort:b,rsort:w,gt:$,lt:E,eq:k,neq:S,gte:x,lte:T,cmp:O,coerce:P,Comparator:I,Range:j,satisfies:N,toComparators:R,maxSatisfying:C,minSatisfying:A,minVersion:z,validRange:M,outside:D,gtr:L,ltr:q,intersects:U,simplifyRange:r(4039),subset:r(22),SemVer:n,re:s.re,src:s.src,tokens:s.t,SEMVER_SPEC_VERSION:i.SEMVER_SPEC_VERSION,RELEASE_TYPES:i.RELEASE_TYPES,compareIdentifiers:a.compareIdentifiers,rcompareIdentifiers:a.rcompareIdentifiers}},5076(e){"use strict";e.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(e){"use strict";e.exports="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{}},9101(e){"use strict";let t=/^[0-9]+$/,r=(e,r)=>{if("number"==typeof e&&"number"==typeof r)return e===r?0:e<r?-1:1;let s=t.test(e),i=t.test(r);return s&&i&&(e*=1,r*=1),e===r?0:s&&!i?-1:i&&!s?1:e<r?-1:1};e.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}},2044(e){"use strict";e.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(void 0!==t)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&void 0!==t){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}},4621(e){"use strict";let t=Object.freeze({loose:!0}),r=Object.freeze({});e.exports=e=>e?"object"!=typeof e?t:e:r},152(e,t,r){"use strict";let{MAX_SAFE_COMPONENT_LENGTH:s,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:n}=r(5076),a=r(674),o=(t=e.exports={}).re=[],l=t.safeRe=[],u=t.src=[],c=t.safeSrc=[],d=t.t={},p=0,f="[a-zA-Z0-9-]",h=[["\\s",1],["\\d",n],[f,i]],m=(e,t,r)=>{let s=(e=>{for(let[t,r]of h)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),i=p++;a(e,i,t),d[e]=i,u[i]=t,c[i]=s,o[i]=new RegExp(t,r?"g":void 0),l[i]=new RegExp(s,r?"g":void 0)};m("NUMERICIDENTIFIER","0|[1-9]\\d*"),m("NUMERICIDENTIFIERLOOSE","\\d+"),m("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f}*`),m("MAINVERSION",`(${u[d.NUMERICIDENTIFIER]})\\.(${u[d.NUMERICIDENTIFIER]})\\.(${u[d.NUMERICIDENTIFIER]})`),m("MAINVERSIONLOOSE",`(${u[d.NUMERICIDENTIFIERLOOSE]})\\.(${u[d.NUMERICIDENTIFIERLOOSE]})\\.(${u[d.NUMERICIDENTIFIERLOOSE]})`),m("PRERELEASEIDENTIFIER",`(?:${u[d.NONNUMERICIDENTIFIER]}|${u[d.NUMERICIDENTIFIER]})`),m("PRERELEASEIDENTIFIERLOOSE",`(?:${u[d.NONNUMERICIDENTIFIER]}|${u[d.NUMERICIDENTIFIERLOOSE]})`),m("PRERELEASE",`(?:-(${u[d.PRERELEASEIDENTIFIER]}(?:\\.${u[d.PRERELEASEIDENTIFIER]})*))`),m("PRERELEASELOOSE",`(?:-?(${u[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[d.PRERELEASEIDENTIFIERLOOSE]})*))`),m("BUILDIDENTIFIER",`${f}+`),m("BUILD",`(?:\\+(${u[d.BUILDIDENTIFIER]}(?:\\.${u[d.BUILDIDENTIFIER]})*))`),m("FULLPLAIN",`v?${u[d.MAINVERSION]}${u[d.PRERELEASE]}?${u[d.BUILD]}?`),m("FULL",`^${u[d.FULLPLAIN]}$`),m("LOOSEPLAIN",`[v=\\s]*${u[d.MAINVERSIONLOOSE]}${u[d.PRERELEASELOOSE]}?${u[d.BUILD]}?`),m("LOOSE",`^${u[d.LOOSEPLAIN]}$`),m("GTLT","((?:<|>)?=?)"),m("XRANGEIDENTIFIERLOOSE",`${u[d.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),m("XRANGEIDENTIFIER",`${u[d.NUMERICIDENTIFIER]}|x|X|\\*`),m("XRANGEPLAIN",`[v=\\s]*(${u[d.XRANGEIDENTIFIER]})(?:\\.(${u[d.XRANGEIDENTIFIER]})(?:\\.(${u[d.XRANGEIDENTIFIER]})(?:${u[d.PRERELEASE]})?${u[d.BUILD]}?)?)?`),m("XRANGEPLAINLOOSE",`[v=\\s]*(${u[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[d.XRANGEIDENTIFIERLOOSE]})(?:${u[d.PRERELEASELOOSE]})?${u[d.BUILD]}?)?)?`),m("XRANGE",`^${u[d.GTLT]}\\s*${u[d.XRANGEPLAIN]}$`),m("XRANGELOOSE",`^${u[d.GTLT]}\\s*${u[d.XRANGEPLAINLOOSE]}$`),m("COERCEPLAIN",`(^|[^\\d])(\\d{1,${s}})(?:\\.(\\d{1,${s}}))?(?:\\.(\\d{1,${s}}))?`),m("COERCE",`${u[d.COERCEPLAIN]}(?:$|[^\\d])`),m("COERCEFULL",u[d.COERCEPLAIN]+`(?:${u[d.PRERELEASE]})?`+`(?:${u[d.BUILD]})?`+"(?:$|[^\\d])"),m("COERCERTL",u[d.COERCE],!0),m("COERCERTLFULL",u[d.COERCEFULL],!0),m("LONETILDE","(?:~>?)"),m("TILDETRIM",`(\\s*)${u[d.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",m("TILDE",`^${u[d.LONETILDE]}${u[d.XRANGEPLAIN]}$`),m("TILDELOOSE",`^${u[d.LONETILDE]}${u[d.XRANGEPLAINLOOSE]}$`),m("LONECARET","(?:\\^)"),m("CARETTRIM",`(\\s*)${u[d.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",m("CARET",`^${u[d.LONECARET]}${u[d.XRANGEPLAIN]}$`),m("CARETLOOSE",`^${u[d.LONECARET]}${u[d.XRANGEPLAINLOOSE]}$`),m("COMPARATORLOOSE",`^${u[d.GTLT]}\\s*(${u[d.LOOSEPLAIN]})$|^$`),m("COMPARATOR",`^${u[d.GTLT]}\\s*(${u[d.FULLPLAIN]})$|^$`),m("COMPARATORTRIM",`(\\s*)${u[d.GTLT]}\\s*(${u[d.LOOSEPLAIN]}|${u[d.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",m("HYPHENRANGE",`^\\s*(${u[d.XRANGEPLAIN]})\\s+-\\s+(${u[d.XRANGEPLAIN]})\\s*$`),m("HYPHENRANGELOOSE",`^\\s*(${u[d.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[d.XRANGEPLAINLOOSE]})\\s*$`),m("STAR","(<|>)?=?\\s*\\*"),m("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),m("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")},4497(e,t,r){"use strict";let s=r(4713);e.exports=(e,t,r)=>s(e,t,">",r)},3490(e,t,r){"use strict";let s=r(2069);e.exports=(e,t,r)=>(e=new s(e,r),t=new s(t,r),e.intersects(t,r))},9272(e,t,r){"use strict";let s=r(4713);e.exports=(e,t,r)=>s(e,t,"<",r)},7114(e,t,r){"use strict";let s=r(2398),i=r(2069);e.exports=(e,t,r)=>{let n=null,a=null,o=null;try{o=new i(t,r)}catch(e){return null}return e.forEach(e=>{o.test(e)&&(!n||-1===a.compare(e))&&(a=new s(n=e,r))}),n}},1008(e,t,r){"use strict";let s=r(2398),i=r(2069);e.exports=(e,t,r)=>{let n=null,a=null,o=null;try{o=new i(t,r)}catch(e){return null}return e.forEach(e=>{o.test(e)&&(!n||1===a.compare(e))&&(a=new s(n=e,r))}),n}},203(e,t,r){"use strict";let s=r(2398),i=r(2069),n=r(1686);e.exports=(e,t)=>{e=new i(e,t);let r=new s("0.0.0");if(e.test(r)||(r=new s("0.0.0-0"),e.test(r)))return r;r=null;for(let t=0;t<e.set.length;++t){let i=e.set[t],a=null;i.forEach(e=>{let t=new s(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":(!a||n(t,a))&&(a=t);break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${e.operator}`)}}),a&&(!r||n(r,a))&&(r=a)}return r&&e.test(r)?r:null}},4713(e,t,r){"use strict";let s=r(2398),i=r(8610),{ANY:n}=i,a=r(2069),o=r(4056),l=r(1686),u=r(7257),c=r(5850),d=r(6479);e.exports=(e,t,r,p)=>{let f,h,m,y,g;switch(e=new s(e,p),t=new a(t,p),r){case">":f=l,h=c,m=u,y=">",g=">=";break;case"<":f=u,h=d,m=l,y="<",g="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(o(e,t,p))return!1;for(let r=0;r<t.set.length;++r){let s=t.set[r],a=null,o=null;if(s.forEach(e=>{e.semver===n&&(e=new i(">=0.0.0")),a=a||e,o=o||e,f(e.semver,a.semver,p)?a=e:m(e.semver,o.semver,p)&&(o=e)}),a.operator===y||a.operator===g||(!o.operator||o.operator===y)&&h(e,o.semver)||o.operator===g&&m(e,o.semver))return!1}return!0}},4039(e,t,r){"use strict";let s=r(4056),i=r(6958);e.exports=(e,t,r)=>{let n=[],a=null,o=null,l=e.sort((e,t)=>i(e,t,r));for(let e of l)s(e,t,r)?(o=e,a||(a=e)):(o&&n.push([a,o]),o=null,a=null);a&&n.push([a,null]);let u=[];for(let[e,t]of n)e===t?u.push(e):t||e!==l[0]?t?e===l[0]?u.push(`<=${t}`):u.push(`${e} - ${t}`):u.push(`>=${e}`):u.push("*");let c=u.join(" || "),d="string"==typeof t.raw?t.raw:String(t);return c.length<d.length?c:t}},22(e,t,r){"use strict";let s=r(2069),i=r(8610),{ANY:n}=i,a=r(4056),o=r(6958),l=[new i(">=0.0.0-0")],u=[new i(">=0.0.0")],c=(e,t,r)=>{let s,i,c,f,h,m,y;if(e===t)return!0;if(1===e.length&&e[0].semver===n)if(1===t.length&&t[0].semver===n)return!0;else e=r.includePrerelease?l:u;if(1===t.length&&t[0].semver===n)if(r.includePrerelease)return!0;else t=u;let g=new Set;for(let t of e)">"===t.operator||">="===t.operator?s=d(s,t,r):"<"===t.operator||"<="===t.operator?i=p(i,t,r):g.add(t.semver);if(g.size>1)return null;if(s&&i&&((c=o(s.semver,i.semver,r))>0||0===c&&(">="!==s.operator||"<="!==i.operator)))return null;for(let e of g){if(s&&!a(e,String(s),r)||i&&!a(e,String(i),r))return null;for(let s of t)if(!a(e,String(s),r))return!1;return!0}let v=!!i&&!r.includePrerelease&&!!i.semver.prerelease.length&&i.semver,_=!!s&&!r.includePrerelease&&!!s.semver.prerelease.length&&s.semver;for(let e of(v&&1===v.prerelease.length&&"<"===i.operator&&0===v.prerelease[0]&&(v=!1),t)){if(y=y||">"===e.operator||">="===e.operator,m=m||"<"===e.operator||"<="===e.operator,s){if(_&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===_.major&&e.semver.minor===_.minor&&e.semver.patch===_.patch&&(_=!1),">"===e.operator||">="===e.operator){if((f=d(s,e,r))===e&&f!==s)return!1}else if(">="===s.operator&&!a(s.semver,String(e),r))return!1}if(i){if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),"<"===e.operator||"<="===e.operator){if((h=p(i,e,r))===e&&h!==i)return!1}else if("<="===i.operator&&!a(i.semver,String(e),r))return!1}if(!e.operator&&(i||s)&&0!==c)return!1}return(!s||!m||!!i||0===c)&&(!i||!y||!!s||0===c)&&!_&&!v&&!0},d=(e,t,r)=>{if(!e)return t;let s=o(e.semver,t.semver,r);return s>0?e:s<0||">"===t.operator&&">="===e.operator?t:e},p=(e,t,r)=>{if(!e)return t;let s=o(e.semver,t.semver,r);return s<0?e:s>0||"<"===t.operator&&"<="===e.operator?t:e};e.exports=(e,t,r={})=>{if(e===t)return!0;e=new s(e,r),t=new s(t,r);let i=!1;e:for(let s of e.set){for(let e of t.set){let t=c(s,e,r);if(i=i||null!==t,t)continue e}if(i)return!1}return!0}},6613(e,t,r){"use strict";let s=r(2069);e.exports=(e,t)=>new s(e,t).set.map(e=>e.map(e=>e.value).join(" ").trim().split(" "))},5372(e,t,r){"use strict";let s=r(2069);e.exports=(e,t)=>{try{return new s(e,t).range||"*"}catch(e){return null}}},600(e,t,r){"use strict";let s=r(9638);e.exports=(e="")=>{let t=e.match(s);if(!t)return null;let[r,i]=t[0].replace(/#! ?/,"").split(" "),n=r.split("/").pop();return"env"===n?i:i?`${n} ${i}`:n}},9638(e){"use strict";e.exports=/^#!(.*)/},1905(e,t,r){let s="win32"===process.platform||"cygwin"===process.env.OSTYPE||"msys"===process.env.OSTYPE,i=r(6928),n=s?";":":",a=r(9344),o=e=>Object.assign(Error(`not found: ${e}`),{code:"ENOENT"}),l=(e,t)=>{let r=t.colon||n,i=e.match(/\//)||s&&e.match(/\\/)?[""]:[...s?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],a=s?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=s?a.split(r):[""];return s&&-1!==e.indexOf(".")&&""!==o[0]&&o.unshift(""),{pathEnv:i,pathExt:o,pathExtExe:a}},u=(e,t,r)=>{"function"==typeof t&&(r=t,t={}),t||(t={});let{pathEnv:s,pathExt:n,pathExtExe:u}=l(e,t),c=[],d=r=>new Promise((n,a)=>{if(r===s.length)return t.all&&c.length?n(c):a(o(e));let l=s[r],u=/^".*"$/.test(l)?l.slice(1,-1):l,d=i.join(u,e);n(p(!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d,r,0))}),p=(e,r,s)=>new Promise((i,o)=>{if(s===n.length)return i(d(r+1));let l=n[s];a(e+l,{pathExt:u},(n,a)=>{if(!n&&a)if(!t.all)return i(e+l);else c.push(e+l);return i(p(e,r,s+1))})});return r?d(0).then(e=>r(null,e),r):d(0)};e.exports=u,u.sync=(e,t)=>{let{pathEnv:r,pathExt:s,pathExtExe:n}=l(e,t=t||{}),u=[];for(let o=0;o<r.length;o++){let l=r[o],c=/^".*"$/.test(l)?l.slice(1,-1):l,d=i.join(c,e),p=!c&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d;for(let e=0;e<s.length;e++){let r=p+s[e];try{if(a.sync(r,{pathExt:n}))if(!t.all)return r;else u.push(r)}catch(e){}}}if(t.all&&u.length)return u;if(t.nothrow)return null;throw o(e)}},181(e){"use strict";e.exports=require("buffer")},5317(e){"use strict";e.exports=require("child_process")},6982(e){"use strict";e.exports=require("crypto")},9896(e){"use strict";e.exports=require("fs")},7598(e){"use strict";e.exports=require("node:crypto")},857(e){"use strict";e.exports=require("os")},6928(e){"use strict";e.exports=require("path")},2203(e){"use strict";e.exports=require("stream")},9023(e){"use strict";e.exports=require("util")},7980(e,t,r){"use strict";let{normalizeIPv6:s,removeDotSegments:i,recomposeAuthority:n,normalizePercentEncoding:a,normalizePathEncoding:o,escapePreservingEscapes:l,reescapeHostDelimiters:u,isIPv4:c,nonSimpleDomain:d}=r(609),{SCHEMES:p,getSchemeHandler:f}=r(4848);function h(e,t,r,s){let n={};return s||(e=b(m(e,r),r),t=b(m(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=i(t.path||""),n.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=i(t.path||""),n.query=t.query):(t.path?("/"===t.path[0]?n.path=i(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:n.path=t.path:n.path="/"+t.path,n.path=i(n.path)),n.query=t.query):(n.path=e.path,void 0!==t.query?n.query=t.query:n.query=e.query),n.userinfo=e.userinfo,n.host=e.host,n.port=e.port),n.scheme=e.scheme),n.fragment=t.fragment,n}function m(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},s=Object.assign({},t),o=[],u=f(s.scheme||r.scheme);u&&u.serialize&&u.serialize(r,s),void 0!==r.path&&(s.skipEscape?r.path=a(r.path):(r.path=l(r.path),void 0!==r.scheme&&(r.path=r.path.split("%3A").join(":")))),"suffix"!==s.reference&&r.scheme&&o.push(r.scheme,":");let c=n(r);if(void 0!==c&&("suffix"!==s.reference&&o.push("//"),o.push(c),r.path&&"/"!==r.path[0]&&o.push("/")),void 0!==r.path){let e=r.path;s.absolutePath||u&&u.absolutePath||(e=i(e)),void 0===c&&"/"===e[0]&&"/"===e[1]&&(e="/%2F"+e.slice(2)),o.push(e)}return void 0!==r.query&&o.push("?",r.query),void 0!==r.fragment&&o.push("#",r.fragment),o.join("")}let y=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,g=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,v=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function _(e,t){let r=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,a=!1;"suffix"===r.reference&&(e=r.scheme?r.scheme+":"+e:"//"+e);let l=e.match(g);null!==l&&-1!==l[1].indexOf("\\")&&(i.error="URI authority must not contain a literal backslash.",n=!0);let p=e.match(v);if(null!==p){let e=p[1],t=e.replace(/[\t\n\r]/g,"");t.length>=2&&("//"!==t.slice(0,2)?(i.error=i.error||"URI authority must not contain a literal backslash.",n=!0):e.length!==t.length&&(i.error=i.error||"URI authority introducer must not contain whitespace.",n=!0))}let h=e.match(y);if(h){i.scheme=h[1],i.userinfo=h[3],i.host=h[4],i.port=parseInt(h[5],10),i.path=h[6]||"",i.query=h[7],i.fragment=h[8],isNaN(i.port)&&(i.port=h[5]);let t=void 0!==h[2]&&i.path&&"/"!==i.path[0]?'URI path must start with "/" when authority is present.':"number"==typeof i.port&&(i.port<0||i.port>65535)?"URI port is malformed.":void 0;if(void 0!==t&&(i.error=i.error||t,n=!0),i.host)if(!1===c(i.host)){let e=s(i.host);i.host=e.host.toLowerCase(),a=e.isIPV6}else a=!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",r.reference&&"suffix"!==r.reference&&r.reference!==i.reference&&(i.error=i.error||"URI is not a "+r.reference+" reference.");let l=f(r.scheme||i.scheme);if(!r.unicodeSupport&&(!l||!l.unicodeSupport)&&i.host&&(r.domainHost||l&&l.domainHost)&&!1===a&&d(i.host))try{i.host=new URL("http://"+i.host).hostname}catch(e){i.error=i.error||"Host's domain name can not be converted to ASCII: "+e}if((!l||l&&!l.skipNormalize)&&(-1!==e.indexOf("%")&&(void 0!==i.scheme&&(i.scheme=unescape(i.scheme)),void 0!==i.host&&(i.host=u(unescape(i.host),a))),i.path&&(i.path=o(i.path)),i.fragment))try{i.fragment=encodeURI(decodeURIComponent(i.fragment))}catch{i.error=i.error||"URI malformed"}l&&l.parse&&l.parse(i,r)}else i.error=i.error||"URI can not be parsed.";return{parsed:i,malformedAuthorityOrPort:n}}function b(e,t){return _(e,t).parsed}function w(e,t){let{parsed:r,malformedAuthorityOrPort:s}=_(e,t);return{normalized:s?e:m(r,t),malformedAuthorityOrPort:s}}function $(e,t){if("string"==typeof e){let{normalized:r,malformedAuthorityOrPort:s}=w(e,t);return s?void 0:r}if("object"==typeof e)return m(e,t)}let E={SCHEMES:p,normalize:function(e,t){return"string"==typeof e?e=w(e,t).normalized:"object"==typeof e&&(e=b(m(e,t),t)),e},resolve:function(e,t,r){let s=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:i,malformedAuthorityOrPort:n}=_(e,s),{parsed:a,malformedAuthorityOrPort:o}=_(t,s);if(n||o)throw Error(i.error||a.error||"URI is malformed.");let l=h(i,a,s,!0);return s.skipEscape=!0,m(l,s)},resolveComponent:h,equal:function(e,t,r){let s=$(e,r),i=$(t,r);return void 0!==s&&void 0!==i&&s.toLowerCase()===i.toLowerCase()},serialize:m,parse:b};e.exports=E,e.exports.default=E,e.exports.fastUri=E},4848(e,t,r){"use strict";let{isUUID:s}=r(609),i=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,n=["http","https","ws","wss","urn","urn:uuid"];function a(e){return!0===e.secure||!1!==e.secure&&!!e.scheme&&3===e.scheme.length&&("w"===e.scheme[0]||"W"===e.scheme[0])&&("s"===e.scheme[1]||"S"===e.scheme[1])&&("s"===e.scheme[2]||"S"===e.scheme[2])}function o(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function l(e){let t="https"===String(e.scheme).toLowerCase();return(e.port===(t?443:80)||""===e.port)&&(e.port=void 0),e.path||(e.path="/"),e}let u={scheme:"http",domainHost:!0,parse:o,serialize:l},c={scheme:"https",domainHost:u.domainHost,parse:o,serialize:l},d={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=a(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if((e.port===(a(e)?443:80)||""===e.port)&&(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&"/"!==t?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}},p={scheme:"wss",domainHost:d.domainHost,parse:d.parse,serialize:d.serialize},f={http:u,https:c,ws:d,wss:p,urn:{scheme:"urn",parse:function(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(i);if(r){let s=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let i=h(`${s}:${t.nid||e.nid}`);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e},serialize:function(e,t){if(void 0===e.nid)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",s=e.nid.toLowerCase(),i=h(`${r}:${t.nid||s}`);i&&(e=i.serialize(e,t));let n=e,a=e.nss;return n.path=`${s||t.nid}:${a}`,t.skipEscape=!0,n},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(e,t){return e.uuid=e.nss,e.nss=void 0,t.tolerant||e.uuid&&s(e.uuid)||(e.error=e.error||"UUID is not valid."),e},serialize:function(e){return e.nss=(e.uuid||"").toLowerCase(),e},skipNormalize:!0}};function h(e){return e&&(f[e]||f[e.toLowerCase()])||void 0}Object.setPrototypeOf(f,null),e.exports={wsIsSecure:a,SCHEMES:f,isValidSchemeName:function(e){return -1!==n.indexOf(e)},getSchemeHandler:h}},609(e){"use strict";let t=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),r=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),s=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),i=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),n=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function a(e){let t="",r=0,s=0;for(s=0;s<e.length;s++)if(48!==(r=e[s].charCodeAt(0))){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[s];break}for(s+=1;s<e.length;s++){if(!((r=e[s].charCodeAt(0))>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[s]}return t}let o=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function l(e){return e.length=0,!0}function u(e,t,r){if(e.length){let s=a(e);if(""===s)return r.error=!0,!1;t.push(s),e.length=0}return!0}function c(e){if(2>function(e,t){let r=0;for(let t=0;t<e.length;t++)":"===e[t]&&r++;return r}(e,":"))return{host:e,isIPV6:!1};let t=function(e){let t=0,r={error:!1,address:"",zone:""},s=[],i=[],n=!1,o=!1,c=u;for(let a=0;a<e.length;a++){let u=e[a];if("["!==u&&"]"!==u)if(":"===u){if(!0===n&&(o=!0),!c(i,s,r))break;if(++t>7){r.error=!0;break}a>0&&":"===e[a-1]&&(n=!0),s.push(":");continue}else if("%"===u){if(!c(i,s,r))break;c=l}else{i.push(u);continue}}return i.length&&(c===l?r.zone=i.join(""):o?s.push(i.join("")):s.push(a(i))),r.address=s.join(""),r}(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,r=t.address;return t.zone&&(e+="%"+t.zone,r+="%25"+t.zone),{host:e,isIPV6:!0,escapedHost:r}}}let d={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},p=/[@/?#:]/g,f=/[@/?#]/g;function h(e,t){let r=t?f:p;return r.lastIndex=0,e.replace(r,e=>d[e])}e.exports={nonSimpleDomain:o,recomposeAuthority:function(e){let t=[];if(void 0!==e.userinfo&&(t.push(e.userinfo),t.push("@")),void 0!==e.host){let s=unescape(e.host);if(!r(s)){let e=c(s);s=!0===e.isIPV6?`[${e.escapedHost}]`:h(s,!1)}t.push(s)}return("number"==typeof e.port||"string"==typeof e.port)&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0},reescapeHostDelimiters:h,normalizePercentEncoding:function(e,t=!1){if(-1===e.indexOf("%"))return e;let r="";for(let n=0;n<e.length;n++){if("%"===e[n]&&n+2<e.length){let a=e.slice(n+1,n+3);if(s(a)){let e=a.toUpperCase(),s=String.fromCharCode(parseInt(e,16));t&&i(s)?r+=s:r+="%"+e,n+=2;continue}}r+=e[n]}return r},normalizePathEncoding:function(e){let t="";for(let r=0;r<e.length;r++){if("%"===e[r]&&r+2<e.length){let n=e.slice(r+1,r+3);if(s(n)){let e=n.toUpperCase(),s=String.fromCharCode(parseInt(e,16));"."!==s&&i(s)?t+=s:t+="%"+e,r+=2;continue}}n(e[r])?t+=e[r]:t+=escape(e[r])}return t},escapePreservingEscapes:function(e){let t="";for(let r=0;r<e.length;r++){if("%"===e[r]&&r+2<e.length){let i=e.slice(r+1,r+3);if(s(i)){t+="%"+i.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t},removeDotSegments:function(e){let t=e,r=[],s=-1,i=0;for(;i=t.length;){if(1===i)if("."===t)break;else if("/"===t){r.push("/");break}else{r.push(t);break}if(2===i){if("."===t[0]){if("."===t[1])break;else if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&("."===t[1]||"/"===t[1])){r.push("/");break}}else if(3===i&&"/.."===t){0!==r.length&&r.pop(),r.push("/");break}if("."===t[0]){if("."===t[1]){if("/"===t[2]){t=t.slice(3);continue}}else if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&"."===t[1]){if("/"===t[2]){t=t.slice(2);continue}else if("."===t[2]&&"/"===t[3]){t=t.slice(3),0!==r.length&&r.pop();continue}}if(-1===(s=t.indexOf("/",1))){r.push(t);break}r.push(t.slice(0,s)),t=t.slice(s)}return r.join("")},isIPv4:r,isUUID:t,normalizeIPv6:c,stringArrayToHexStripped:a}},114(e){"use strict";e.exports=JSON.parse('{"$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":false}')},7456(e){"use strict";e.exports=JSON.parse('{"$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":true,"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":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"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":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"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":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"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":true}')},4519(e){"use strict";e.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(e){"use strict";e.exports=JSON.parse('{"name":"xmcp","description":"The MCP framework","version":"0.7.1","author":{"name":"xmcp","email":"support@xmcp.dev","url":"https://xmcp.dev"},"contributors":[{"name":"Valentina Bearzotti","email":"valebearzotti1@gmail.com","url":"https://github.com/valebearzotti"},{"name":"Jose Rago","email":"jose@basement.studio","url":"https://github.com/ragojose"}],"license":"MIT","keywords":["mcp","modelcontextprotocol","http","stdio"],"repository":{"type":"git","url":"https://github.com/basementstudio/xmcp"},"homepage":"https://xmcp.dev","type":"commonjs","main":"./dist/index.js","types":"./dist/index.d.ts","bin":{"xmcp":"dist/cli.js"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js","default":"./dist/index.js"},"./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"},"./package.json":"./package.json"},"typesVersions":{"*":{"host-bridge":["dist/host-bridge.d.ts"],"headers":["dist/runtime/headers.d.ts"],"cloudflare":["dist/cloudflare.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","test:config":"node --import tsx --test src/compiler/config/__tests__/*.test.ts","test:adapters":"node --import tsx --test src/runtime/adapters/fastify/__tests__/*.test.ts"},"dependencies":{"@modelcontextprotocol/sdk":"^1.26.0","@rspack/core":"^1.6.7","jose":"^6.1.3","postcss-loader":"^8.2.0","ts-checker-rspack-plugin":"^1.2.1","typescript":"^5.9.3"},"devDependencies":{"@nestjs/common":"^11.1.12","@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.0.0","fs-extra":"^11.3.2","glob":"^11.1.0","is-docker":"^4.0.0","is-wsl":"^3.1.0","json5":"^2.2.3","jsonwebtoken":"^9.0.3","memfs":"^4.51.1","raw-body":"^3.0.2","reflect-metadata":"^0.2.2","rxjs":"^7.8.2","tsx":"^4.21.0"},"peerDependencies":{"react":">=19.0.0","react-dom":">=19.0.0","zod":"^3.25.76 || ^4.0.0"},"peerDependenciesMeta":{"react":{"optional":true},"react-dom":{"optional":true}}}')}},s={};function i(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={exports:{}};return r[e](n,n.exports,i),n.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(r,s){if(1&s&&(r=this(r)),8&s||"object"==typeof r&&r&&(4&s&&r.__esModule||16&s&&"function"==typeof r.then))return r;var n=Object.create(null);i.r(n);var a={};e=e||[null,t({}),t([]),t(t)];for(var o=2&s&&r;("object"==typeof o||"function"==typeof o)&&!~e.indexOf(o);o=t(o))Object.getOwnPropertyNames(o).forEach(e=>{a[e]=()=>r[e]});return a.default=()=>r,i.d(n,a),n},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";let e,t,r;i.r(n),i.d(n,{createHTTPClient:()=>lM,HOST_CONTEXT_CHANGED_METHOD:()=>lY,UPDATE_MODEL_CONTEXT_METHOD:()=>lB,UrlElicitationRequiredError:()=>oy,isEnvHeader:()=>lN,createSTDIOClient:()=>lD,jwtAuthMiddleware:()=>eB,listSTDIOClientTools:()=>lL,createMcpHostBridge:()=>l2,SIZE_CHANGED_METHOD:()=>lQ,INITIALIZE_METHOD:()=>lF,LOG_MESSAGE_METHOD:()=>lW,INITIALIZED_METHOD:()=>lH,OPEN_LINK_METHOD:()=>lG,REQUEST_DISPLAY_MODE_METHOD:()=>lK,disconnectSTDIOClient:()=>lU,RESOURCES_READ_METHOD:()=>lX,createContext:()=>eY,callSTDIOClientTool:()=>lq,headersToRecord:()=>lR,MCP_APPS_PROTOCOL_VERSION:()=>lV,extractToolNamesFromRequest:()=>lZ,UI_MESSAGE_METHOD:()=>lJ,apiKeyAuthMiddleware:()=>eH,completable:()=>e0});var s,a,o,l,u,c,d,p,f,h,m,y,g,v,_=i(8583),b=i.n(_);(s=c||(c={})).assertEqual=e=>{},s.assertIs=function(e){},s.assertNever=function(e){throw Error()},s.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},s.getValidEnumValues=e=>{let t=s.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(let s of t)r[s]=e[s];return s.objectValues(r)},s.objectValues=e=>s.objectKeys(e).map(function(t){return e[t]}),s.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{let t=[];for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},s.find=(e,t)=>{for(let r of e)if(t(r))return r},s.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,s.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},s.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(d||(d={})).mergeShapes=(e,t)=>({...e,...t});let w=c.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$=e=>{switch(typeof e){case"undefined":return w.undefined;case"string":return w.string;case"number":return Number.isNaN(e)?w.nan:w.number;case"boolean":return w.boolean;case"function":return w.function;case"bigint":return w.bigint;case"symbol":return w.symbol;case"object":if(Array.isArray(e))return w.array;if(null===e)return w.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return w.promise;if("undefined"!=typeof Map&&e instanceof Map)return w.map;if("undefined"!=typeof Set&&e instanceof Set)return w.set;if("undefined"!=typeof Date&&e instanceof Date)return w.date;return w.object;default:return w.unknown}},E=c.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class k extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(e){return e.message},r={_errors:[]},s=e=>{for(let i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(s);else if("invalid_return_type"===i.code)s(i.returnTypeError);else if("invalid_arguments"===i.code)s(i.argumentsError);else if(0===i.path.length)r._errors.push(t(i));else{let e=r,s=0;for(;s<i.path.length;){let r=i.path[s];s===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],s++}}};return s(this),r}static assert(e){if(!(e instanceof k))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,c.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t=Object.create(null),r=[];for(let s of this.issues)if(s.path.length>0){let r=s.path[0];t[r]=t[r]||[],t[r].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}k.create=e=>new k(e);let S=(e,t)=>{let r;switch(e.code){case E.invalid_type:r=e.received===w.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case E.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,c.jsonStringifyReplacer)}`;break;case E.unrecognized_keys:r=`Unrecognized key(s) in object: ${c.joinValues(e.keys,", ")}`;break;case E.invalid_union:r="Invalid input";break;case E.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${c.joinValues(e.options)}`;break;case E.invalid_enum_value:r=`Invalid enum value. Expected ${c.joinValues(e.options)}, received '${e.received}'`;break;case E.invalid_arguments:r="Invalid function arguments";break;case E.invalid_return_type:r="Invalid function return type";break;case E.invalid_date:r="Invalid date";break;case E.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:c.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case E.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case E.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case E.custom:r="Invalid input";break;case E.invalid_intersection_types:r="Intersection results could not be merged";break;case E.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case E.not_finite:r="Number must be finite";break;default:r=t.defaultError,c.assertNever(e)}return{message:r}};(a=p||(p={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},a.toString=e=>"string"==typeof e?e:e?.message;let x=e=>{let{data:t,path:r,errorMaps:s,issueData:i}=e,n=[...r,...i.path||[]],a={...i,path:n};if(void 0!==i.message)return{...i,path:n,message:i.message};let o="";for(let e of s.filter(e=>!!e).slice().reverse())o=e(a,{data:t,defaultError:o}).message;return{...i,path:n,message:o}};function T(e,t){let r=x({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,S,void 0].filter(e=>!!e)});e.common.issues.push(r)}class O{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let s of t){if("aborted"===s.status)return P;"dirty"===s.status&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let e of t){let t=await e.key,s=await e.value;r.push({key:t,value:s})}return O.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let s of t){let{key:t,value:i}=s;if("aborted"===t.status||"aborted"===i.status)return P;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==i.value||s.alwaysSet)&&(r[t.value]=i.value)}return{status:e.value,value:r}}}let P=Object.freeze({status:"aborted"}),I=e=>({status:"dirty",value:e}),j=e=>({status:"valid",value:e}),N=e=>"undefined"!=typeof Promise&&e instanceof Promise;class R{constructor(e,t,r,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}let C=(e,t)=>{if("valid"===t.status)return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new k(e.common.issues);return this._error=t,this._error}}};function A(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:s,description:i}=e;if(t&&(r||s))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:n}=e;return"invalid_enum_value"===t.code?{message:n??i.defaultError}:void 0===i.data?{message:n??s??i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:n??r??i.defaultError}},description:i}}class z{get description(){return this._def.description}_getType(e){return $(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:$(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new O,ctx:{common:e.parent.common,data:e.data,parsedType:$(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(N(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){return Promise.resolve(this._parse(e))}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$(e)},s=this._parseSync({data:e,path:r.path,parent:r});return C(r,s)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return"valid"===r.status?{value:r.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>"valid"===e.status?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$(e)},s=this._parse({data:e,path:r.path,parent:r});return C(r,await (N(s)?s:Promise.resolve(s)))}refine(e,t){return this._refinement((r,s)=>{let i=e(r),n=()=>s.addIssue({code:E.custom,..."string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(r):t});return"undefined"!=typeof Promise&&i instanceof Promise?i.then(e=>!!e||(n(),!1)):!!i||(n(),!1)})}refinement(e,t){return this._refinement((r,s)=>!!e(r)||(s.addIssue("function"==typeof t?t(r,s):t),!1))}_refinement(e){return new eP({schema:this,typeName:f.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return eI.create(this,this._def)}nullable(){return ej.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ep.create(this)}promise(){return eO.create(this,this._def)}or(e){return eh.create([this,e],this._def)}and(e){return eg.create(this,e,this._def)}transform(e){return new eP({...A(this._def),schema:this,typeName:f.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new eN({...A(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:f.ZodDefault})}brand(){return new eA({typeName:f.ZodBranded,type:this,...A(this._def)})}catch(e){return new eR({...A(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:f.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return ez.create(this,e)}readonly(){return eM.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let M=/^c[^\s-]{8,}$/i,D=/^[0-9a-z]+$/,L=/^[0-9A-HJKMNP-TV-Z]{26}$/i,q=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,U=/^[a-z0-9_-]{21}$/i,Z=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,V=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,F=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,H=/^(?:(?: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])$/,K=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,G=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,B=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,J=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,W=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,X="((\\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])))",Y=RegExp(`^${X}$`);function Q(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}class ee extends z{_parse(t){var r,s,i,n;let a;if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==w.string){let e=this._getOrReturnCtx(t);return T(e,{code:E.invalid_type,expected:w.string,received:e.parsedType}),P}let o=new O;for(let l of this._def.checks)if("min"===l.kind)t.data.length<l.value&&(T(a=this._getOrReturnCtx(t,a),{code:E.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),o.dirty());else if("max"===l.kind)t.data.length>l.value&&(T(a=this._getOrReturnCtx(t,a),{code:E.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),o.dirty());else if("length"===l.kind){let e=t.data.length>l.value,r=t.data.length<l.value;(e||r)&&(a=this._getOrReturnCtx(t,a),e?T(a,{code:E.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}):r&&T(a,{code:E.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}),o.dirty())}else if("email"===l.kind)F.test(t.data)||(T(a=this._getOrReturnCtx(t,a),{validation:"email",code:E.invalid_string,message:l.message}),o.dirty());else if("emoji"===l.kind)e||(e=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),e.test(t.data)||(T(a=this._getOrReturnCtx(t,a),{validation:"emoji",code:E.invalid_string,message:l.message}),o.dirty());else if("uuid"===l.kind)q.test(t.data)||(T(a=this._getOrReturnCtx(t,a),{validation:"uuid",code:E.invalid_string,message:l.message}),o.dirty());else if("nanoid"===l.kind)U.test(t.data)||(T(a=this._getOrReturnCtx(t,a),{validation:"nanoid",code:E.invalid_string,message:l.message}),o.dirty());else if("cuid"===l.kind)M.test(t.data)||(T(a=this._getOrReturnCtx(t,a),{validation:"cuid",code:E.invalid_string,message:l.message}),o.dirty());else if("cuid2"===l.kind)D.test(t.data)||(T(a=this._getOrReturnCtx(t,a),{validation:"cuid2",code:E.invalid_string,message:l.message}),o.dirty());else if("ulid"===l.kind)L.test(t.data)||(T(a=this._getOrReturnCtx(t,a),{validation:"ulid",code:E.invalid_string,message:l.message}),o.dirty());else if("url"===l.kind)try{new URL(t.data)}catch{T(a=this._getOrReturnCtx(t,a),{validation:"url",code:E.invalid_string,message:l.message}),o.dirty()}else"regex"===l.kind?(l.regex.lastIndex=0,l.regex.test(t.data)||(T(a=this._getOrReturnCtx(t,a),{validation:"regex",code:E.invalid_string,message:l.message}),o.dirty())):"trim"===l.kind?t.data=t.data.trim():"includes"===l.kind?t.data.includes(l.value,l.position)||(T(a=this._getOrReturnCtx(t,a),{code:E.invalid_string,validation:{includes:l.value,position:l.position},message:l.message}),o.dirty()):"toLowerCase"===l.kind?t.data=t.data.toLowerCase():"toUpperCase"===l.kind?t.data=t.data.toUpperCase():"startsWith"===l.kind?t.data.startsWith(l.value)||(T(a=this._getOrReturnCtx(t,a),{code:E.invalid_string,validation:{startsWith:l.value},message:l.message}),o.dirty()):"endsWith"===l.kind?t.data.endsWith(l.value)||(T(a=this._getOrReturnCtx(t,a),{code:E.invalid_string,validation:{endsWith:l.value},message:l.message}),o.dirty()):"datetime"===l.kind?(function(e){let t=`${X}T${Q(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,RegExp(`^${t}$`)})(l).test(t.data)||(T(a=this._getOrReturnCtx(t,a),{code:E.invalid_string,validation:"datetime",message:l.message}),o.dirty()):"date"===l.kind?Y.test(t.data)||(T(a=this._getOrReturnCtx(t,a),{code:E.invalid_string,validation:"date",message:l.message}),o.dirty()):"time"===l.kind?RegExp(`^${Q(l)}$`).test(t.data)||(T(a=this._getOrReturnCtx(t,a),{code:E.invalid_string,validation:"time",message:l.message}),o.dirty()):"duration"===l.kind?V.test(t.data)||(T(a=this._getOrReturnCtx(t,a),{validation:"duration",code:E.invalid_string,message:l.message}),o.dirty()):"ip"===l.kind?(r=t.data,!(("v4"===(s=l.version)||!s)&&H.test(r)||("v6"===s||!s)&&G.test(r))&&1&&(T(a=this._getOrReturnCtx(t,a),{validation:"ip",code:E.invalid_string,message:l.message}),o.dirty())):"jwt"===l.kind?!function(e,t){if(!Z.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let s=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(s));if("object"!=typeof i||null===i||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)return!1;return!0}catch{return!1}}(t.data,l.alg)&&(T(a=this._getOrReturnCtx(t,a),{validation:"jwt",code:E.invalid_string,message:l.message}),o.dirty()):"cidr"===l.kind?(i=t.data,!(("v4"===(n=l.version)||!n)&&K.test(i)||("v6"===n||!n)&&B.test(i))&&1&&(T(a=this._getOrReturnCtx(t,a),{validation:"cidr",code:E.invalid_string,message:l.message}),o.dirty())):"base64"===l.kind?J.test(t.data)||(T(a=this._getOrReturnCtx(t,a),{validation:"base64",code:E.invalid_string,message:l.message}),o.dirty()):"base64url"===l.kind?W.test(t.data)||(T(a=this._getOrReturnCtx(t,a),{validation:"base64url",code:E.invalid_string,message:l.message}),o.dirty()):c.assertNever(l);return{status:o.value,value:t.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:E.invalid_string,...p.errToObj(r)})}_addCheck(e){return new ee({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...p.errToObj(e)})}url(e){return this._addCheck({kind:"url",...p.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...p.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...p.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...p.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...p.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...p.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...p.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...p.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...p.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...p.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...p.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...p.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...p.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...p.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...p.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...p.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...p.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...p.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...p.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...p.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...p.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...p.errToObj(t)})}nonempty(e){return this.min(1,p.errToObj(e))}trim(){return new ee({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ee({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ee({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ee.create=e=>new ee({checks:[],typeName:f.ZodString,coerce:e?.coerce??!1,...A(e)});class et extends z{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){let t;if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==w.number){let t=this._getOrReturnCtx(e);return T(t,{code:E.invalid_type,expected:w.number,received:t.parsedType}),P}let r=new O;for(let s of this._def.checks)"int"===s.kind?c.isInteger(e.data)||(T(t=this._getOrReturnCtx(e,t),{code:E.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):"min"===s.kind?(s.inclusive?e.data<s.value:e.data<=s.value)&&(T(t=this._getOrReturnCtx(e,t),{code:E.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):"max"===s.kind?(s.inclusive?e.data>s.value:e.data>=s.value)&&(T(t=this._getOrReturnCtx(e,t),{code:E.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):"multipleOf"===s.kind?0!==function(e,t){let r=(e.toString().split(".")[1]||"").length,s=(t.toString().split(".")[1]||"").length,i=r>s?r:s;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}(e.data,s.value)&&(T(t=this._getOrReturnCtx(e,t),{code:E.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):"finite"===s.kind?Number.isFinite(e.data)||(T(t=this._getOrReturnCtx(e,t),{code:E.not_finite,message:s.message}),r.dirty()):c.assertNever(s);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,r,s){return new et({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:p.toString(s)}]})}_addCheck(e){return new et({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:p.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:p.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:p.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:p.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&c.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;else"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value);return Number.isFinite(t)&&Number.isFinite(e)}}et.create=e=>new et({checks:[],typeName:f.ZodNumber,coerce:e?.coerce||!1,...A(e)});class er extends z{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){let t;if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==w.bigint)return this._getInvalidInput(e);let r=new O;for(let s of this._def.checks)"min"===s.kind?(s.inclusive?e.data<s.value:e.data<=s.value)&&(T(t=this._getOrReturnCtx(e,t),{code:E.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):"max"===s.kind?(s.inclusive?e.data>s.value:e.data>=s.value)&&(T(t=this._getOrReturnCtx(e,t),{code:E.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):"multipleOf"===s.kind?e.data%s.value!==BigInt(0)&&(T(t=this._getOrReturnCtx(e,t),{code:E.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):c.assertNever(s);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return T(t,{code:E.invalid_type,expected:w.bigint,received:t.parsedType}),P}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,r,s){return new er({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:p.toString(s)}]})}_addCheck(e){return new er({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}er.create=e=>new er({checks:[],typeName:f.ZodBigInt,coerce:e?.coerce??!1,...A(e)});class es extends z{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==w.boolean){let t=this._getOrReturnCtx(e);return T(t,{code:E.invalid_type,expected:w.boolean,received:t.parsedType}),P}return j(e.data)}}es.create=e=>new es({typeName:f.ZodBoolean,coerce:e?.coerce||!1,...A(e)});class ei extends z{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==w.date){let t=this._getOrReturnCtx(e);return T(t,{code:E.invalid_type,expected:w.date,received:t.parsedType}),P}if(Number.isNaN(e.data.getTime()))return T(this._getOrReturnCtx(e),{code:E.invalid_date}),P;let r=new O;for(let s of this._def.checks)"min"===s.kind?e.data.getTime()<s.value&&(T(t=this._getOrReturnCtx(e,t),{code:E.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):"max"===s.kind?e.data.getTime()>s.value&&(T(t=this._getOrReturnCtx(e,t),{code:E.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):c.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ei({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:p.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:p.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}ei.create=e=>new ei({checks:[],coerce:e?.coerce||!1,typeName:f.ZodDate,...A(e)});class en extends z{_parse(e){if(this._getType(e)!==w.symbol){let t=this._getOrReturnCtx(e);return T(t,{code:E.invalid_type,expected:w.symbol,received:t.parsedType}),P}return j(e.data)}}en.create=e=>new en({typeName:f.ZodSymbol,...A(e)});class ea extends z{_parse(e){if(this._getType(e)!==w.undefined){let t=this._getOrReturnCtx(e);return T(t,{code:E.invalid_type,expected:w.undefined,received:t.parsedType}),P}return j(e.data)}}ea.create=e=>new ea({typeName:f.ZodUndefined,...A(e)});class eo extends z{_parse(e){if(this._getType(e)!==w.null){let t=this._getOrReturnCtx(e);return T(t,{code:E.invalid_type,expected:w.null,received:t.parsedType}),P}return j(e.data)}}eo.create=e=>new eo({typeName:f.ZodNull,...A(e)});class el extends z{constructor(){super(...arguments),this._any=!0}_parse(e){return j(e.data)}}el.create=e=>new el({typeName:f.ZodAny,...A(e)});class eu extends z{constructor(){super(...arguments),this._unknown=!0}_parse(e){return j(e.data)}}eu.create=e=>new eu({typeName:f.ZodUnknown,...A(e)});class ec extends z{_parse(e){let t=this._getOrReturnCtx(e);return T(t,{code:E.invalid_type,expected:w.never,received:t.parsedType}),P}}ec.create=e=>new ec({typeName:f.ZodNever,...A(e)});class ed extends z{_parse(e){if(this._getType(e)!==w.undefined){let t=this._getOrReturnCtx(e);return T(t,{code:E.invalid_type,expected:w.void,received:t.parsedType}),P}return j(e.data)}}ed.create=e=>new ed({typeName:f.ZodVoid,...A(e)});class ep extends z{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),s=this._def;if(t.parsedType!==w.array)return T(t,{code:E.invalid_type,expected:w.array,received:t.parsedType}),P;if(null!==s.exactLength){let e=t.data.length>s.exactLength.value,i=t.data.length<s.exactLength.value;(e||i)&&(T(t,{code:e?E.too_big:E.too_small,minimum:i?s.exactLength.value:void 0,maximum:e?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(null!==s.minLength&&t.data.length<s.minLength.value&&(T(t,{code:E.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),null!==s.maxLength&&t.data.length>s.maxLength.value&&(T(t,{code:E.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>s.type._parseAsync(new R(t,e,t.path,r)))).then(e=>O.mergeArray(r,e));let i=[...t.data].map((e,r)=>s.type._parseSync(new R(t,e,t.path,r)));return O.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new ep({...this._def,minLength:{value:e,message:p.toString(t)}})}max(e,t){return new ep({...this._def,maxLength:{value:e,message:p.toString(t)}})}length(e,t){return new ep({...this._def,exactLength:{value:e,message:p.toString(t)}})}nonempty(e){return this.min(1,e)}}ep.create=(e,t)=>new ep({type:e,minLength:null,maxLength:null,exactLength:null,typeName:f.ZodArray,...A(t)});class ef extends z{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let e=this._def.shape(),t=c.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==w.object){let t=this._getOrReturnCtx(e);return T(t,{code:E.invalid_type,expected:w.object,received:t.parsedType}),P}let{status:t,ctx:r}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),n=[];if(!(this._def.catchall instanceof ec&&"strip"===this._def.unknownKeys))for(let e in r.data)i.includes(e)||n.push(e);let a=[];for(let e of i){let t=s[e],i=r.data[e];a.push({key:{status:"valid",value:e},value:t._parse(new R(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof ec){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of n)a.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)n.length>0&&(T(r,{code:E.unrecognized_keys,keys:n}),t.dirty());else if("strip"===e);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let e=this._def.catchall;for(let t of n){let s=r.data[t];a.push({key:{status:"valid",value:t},value:e._parse(new R(r,s,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of a){let r=await t.key,s=await t.value;e.push({key:r,value:s,alwaysSet:t.alwaysSet})}return e}).then(e=>O.mergeObjectSync(t,e)):O.mergeObjectSync(t,a)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new ef({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{let s=this._def.errorMap?.(t,r).message??r.defaultError;return"unrecognized_keys"===t.code?{message:p.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new ef({...this._def,unknownKeys:"strip"})}passthrough(){return new ef({...this._def,unknownKeys:"passthrough"})}extend(e){return new ef({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ef({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:f.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ef({...this._def,catchall:e})}pick(e){let t={};for(let r of c.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new ef({...this._def,shape:()=>t})}omit(e){let t={};for(let r of c.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new ef({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof ef){let r={};for(let s in t.shape){let i=t.shape[s];r[s]=eI.create(e(i))}return new ef({...t._def,shape:()=>r})}if(t instanceof ep)return new ep({...t._def,type:e(t.element)});if(t instanceof eI)return eI.create(e(t.unwrap()));if(t instanceof ej)return ej.create(e(t.unwrap()));if(t instanceof ev)return ev.create(t.items.map(t=>e(t)));else return t}(this)}partial(e){let t={};for(let r of c.objectKeys(this.shape)){let s=this.shape[r];e&&!e[r]?t[r]=s:t[r]=s.optional()}return new ef({...this._def,shape:()=>t})}required(e){let t={};for(let r of c.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof eI;)e=e._def.innerType;t[r]=e}return new ef({...this._def,shape:()=>t})}keyof(){return eS(c.objectKeys(this.shape))}}ef.create=(e,t)=>new ef({shape:()=>e,unknownKeys:"strip",catchall:ec.create(),typeName:f.ZodObject,...A(t)}),ef.strictCreate=(e,t)=>new ef({shape:()=>e,unknownKeys:"strict",catchall:ec.create(),typeName:f.ZodObject,...A(t)}),ef.lazycreate=(e,t)=>new ef({shape:e,unknownKeys:"strip",catchall:ec.create(),typeName:f.ZodObject,...A(t)});class eh extends z{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{let r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(let t of e)if("valid"===t.result.status)return t.result;for(let r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;let r=e.map(e=>new k(e.ctx.common.issues));return T(t,{code:E.invalid_union,unionErrors:r}),P});{let e,s=[];for(let i of r){let r={...t,common:{...t.common,issues:[]},parent:null},n=i._parseSync({data:t.data,path:t.path,parent:r});if("valid"===n.status)return n;"dirty"!==n.status||e||(e={result:n,ctx:r}),r.common.issues.length&&s.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=s.map(e=>new k(e));return T(t,{code:E.invalid_union,unionErrors:i}),P}}get options(){return this._def.options}}eh.create=(e,t)=>new eh({options:e,typeName:f.ZodUnion,...A(t)});let em=e=>{if(e instanceof eE)return em(e.schema);if(e instanceof eP)return em(e.innerType());if(e instanceof ek)return[e.value];if(e instanceof ex)return e.options;if(e instanceof eT)return c.objectValues(e.enum);else if(e instanceof eN)return em(e._def.innerType);else if(e instanceof ea)return[void 0];else if(e instanceof eo)return[null];else if(e instanceof eI)return[void 0,...em(e.unwrap())];else if(e instanceof ej)return[null,...em(e.unwrap())];else if(e instanceof eA)return em(e.unwrap());else if(e instanceof eM)return em(e.unwrap());else if(e instanceof eR)return em(e._def.innerType);else return[]};class ey extends z{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==w.object)return T(t,{code:E.invalid_type,expected:w.object,received:t.parsedType}),P;let r=this.discriminator,s=t.data[r],i=this.optionsMap.get(s);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(T(t,{code:E.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),P)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let s=new Map;for(let r of t){let t=em(r.shape[e]);if(!t.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of t){if(s.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);s.set(i,r)}}return new ey({typeName:f.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...A(r)})}}class eg extends z{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),s=(e,s)=>{if("aborted"===e.status||"aborted"===s.status)return P;let i=function e(t,r){let s=$(t),i=$(r);if(t===r)return{valid:!0,data:t};if(s===w.object&&i===w.object){let s=c.objectKeys(r),i=c.objectKeys(t).filter(e=>-1!==s.indexOf(e)),n={...t,...r};for(let s of i){let i=e(t[s],r[s]);if(!i.valid)return{valid:!1};n[s]=i.data}return{valid:!0,data:n}}if(s===w.array&&i===w.array){if(t.length!==r.length)return{valid:!1};let s=[];for(let i=0;i<t.length;i++){let n=e(t[i],r[i]);if(!n.valid)return{valid:!1};s.push(n.data)}return{valid:!0,data:s}}if(s===w.date&&i===w.date&&+t==+r)return{valid:!0,data:t};return{valid:!1}}(e.value,s.value);return i.valid?(("dirty"===e.status||"dirty"===s.status)&&t.dirty(),{status:t.value,value:i.data}):(T(r,{code:E.invalid_intersection_types}),P)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([e,t])=>s(e,t)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}eg.create=(e,t,r)=>new eg({left:e,right:t,typeName:f.ZodIntersection,...A(r)});class ev extends z{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==w.array)return T(r,{code:E.invalid_type,expected:w.array,received:r.parsedType}),P;if(r.data.length<this._def.items.length)return T(r,{code:E.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),P;!this._def.rest&&r.data.length>this._def.items.length&&(T(r,{code:E.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let s=[...r.data].map((e,t)=>{let s=this._def.items[t]||this._def.rest;return s?s._parse(new R(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(s).then(e=>O.mergeArray(t,e)):O.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new ev({...this._def,rest:e})}}ev.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new ev({items:e,typeName:f.ZodTuple,rest:null,...A(t)})};class e_ extends z{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==w.object)return T(r,{code:E.invalid_type,expected:w.object,received:r.parsedType}),P;let s=[],i=this._def.keyType,n=this._def.valueType;for(let e in r.data)s.push({key:i._parse(new R(r,e,r.path,e)),value:n._parse(new R(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?O.mergeObjectAsync(t,s):O.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,r){return new e_(t instanceof z?{keyType:e,valueType:t,typeName:f.ZodRecord,...A(r)}:{keyType:ee.create(),valueType:e,typeName:f.ZodRecord,...A(t)})}}class eb extends z{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==w.map)return T(r,{code:E.invalid_type,expected:w.map,received:r.parsedType}),P;let s=this._def.keyType,i=this._def.valueType,n=[...r.data.entries()].map(([e,t],n)=>({key:s._parse(new R(r,e,r.path,[n,"key"])),value:i._parse(new R(r,t,r.path,[n,"value"]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let r of n){let s=await r.key,i=await r.value;if("aborted"===s.status||"aborted"===i.status)return P;("dirty"===s.status||"dirty"===i.status)&&t.dirty(),e.set(s.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let r of n){let s=r.key,i=r.value;if("aborted"===s.status||"aborted"===i.status)return P;("dirty"===s.status||"dirty"===i.status)&&t.dirty(),e.set(s.value,i.value)}return{status:t.value,value:e}}}}eb.create=(e,t,r)=>new eb({valueType:t,keyType:e,typeName:f.ZodMap,...A(r)});class ew extends z{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==w.set)return T(r,{code:E.invalid_type,expected:w.set,received:r.parsedType}),P;let s=this._def;null!==s.minSize&&r.data.size<s.minSize.value&&(T(r,{code:E.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),null!==s.maxSize&&r.data.size>s.maxSize.value&&(T(r,{code:E.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());let i=this._def.valueType;function n(e){let r=new Set;for(let s of e){if("aborted"===s.status)return P;"dirty"===s.status&&t.dirty(),r.add(s.value)}return{status:t.value,value:r}}let a=[...r.data.values()].map((e,t)=>i._parse(new R(r,e,r.path,t)));return r.common.async?Promise.all(a).then(e=>n(e)):n(a)}min(e,t){return new ew({...this._def,minSize:{value:e,message:p.toString(t)}})}max(e,t){return new ew({...this._def,maxSize:{value:e,message:p.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ew.create=(e,t)=>new ew({valueType:e,minSize:null,maxSize:null,typeName:f.ZodSet,...A(t)});class e$ extends z{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==w.function)return T(t,{code:E.invalid_type,expected:w.function,received:t.parsedType}),P;function r(e,r){return x({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,S,S].filter(e=>!!e),issueData:{code:E.invalid_arguments,argumentsError:r}})}function s(e,r){return x({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,S,S].filter(e=>!!e),issueData:{code:E.invalid_return_type,returnTypeError:r}})}let i={errorMap:t.common.contextualErrorMap},n=t.data;if(this._def.returns instanceof eO){let e=this;return j(async function(...t){let a=new k([]),o=await e._def.args.parseAsync(t,i).catch(e=>{throw a.addIssue(r(t,e)),a}),l=await Reflect.apply(n,this,o);return await e._def.returns._def.type.parseAsync(l,i).catch(e=>{throw a.addIssue(s(l,e)),a})})}{let e=this;return j(function(...t){let a=e._def.args.safeParse(t,i);if(!a.success)throw new k([r(t,a.error)]);let o=Reflect.apply(n,this,a.data),l=e._def.returns.safeParse(o,i);if(!l.success)throw new k([s(o,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new e$({...this._def,args:ev.create(e).rest(eu.create())})}returns(e){return new e$({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new e$({args:e||ev.create([]).rest(eu.create()),returns:t||eu.create(),typeName:f.ZodFunction,...A(r)})}}class eE extends z{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}eE.create=(e,t)=>new eE({getter:e,typeName:f.ZodLazy,...A(t)});class ek extends z{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return T(t,{received:t.data,code:E.invalid_literal,expected:this._def.value}),P}return{status:"valid",value:e.data}}get value(){return this._def.value}}function eS(e,t){return new ex({values:e,typeName:f.ZodEnum,...A(t)})}ek.create=(e,t)=>new ek({value:e,typeName:f.ZodLiteral,...A(t)});class ex extends z{_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return T(t,{expected:c.joinValues(r),received:t.parsedType,code:E.invalid_type}),P}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return T(t,{received:t.data,code:E.invalid_enum_value,options:r}),P}return j(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ex.create(e,{...this._def,...t})}exclude(e,t=this._def){return ex.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}ex.create=eS;class eT extends z{_parse(e){let t=c.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==w.string&&r.parsedType!==w.number){let e=c.objectValues(t);return T(r,{expected:c.joinValues(e),received:r.parsedType,code:E.invalid_type}),P}if(this._cache||(this._cache=new Set(c.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let e=c.objectValues(t);return T(r,{received:r.data,code:E.invalid_enum_value,options:e}),P}return j(e.data)}get enum(){return this._def.values}}eT.create=(e,t)=>new eT({values:e,typeName:f.ZodNativeEnum,...A(t)});class eO extends z{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==w.promise&&!1===t.common.async?(T(t,{code:E.invalid_type,expected:w.promise,received:t.parsedType}),P):j((t.parsedType===w.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}eO.create=(e,t)=>new eO({type:e,typeName:f.ZodPromise,...A(t)});class eP extends z{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===f.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:e=>{T(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===s.type){let e=s.transform(r.data,i);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return P;let s=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===s.status?P:"dirty"===s.status||"dirty"===t.value?I(s.value):s});{if("aborted"===t.value)return P;let s=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===s.status?P:"dirty"===s.status||"dirty"===t.value?I(s.value):s}}if("refinement"===s.type){let e=e=>{let t=s.refinement(e,i);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(r=>"aborted"===r.status?P:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))));{let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===s.status?P:("dirty"===s.status&&t.dirty(),e(s.value),{status:t.value,value:s.value})}}if("transform"===s.type)if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>"valid"!==e.status?P:Promise.resolve(s.transform(e.value,i)).then(e=>({status:t.value,value:e})));else{let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if("valid"!==e.status)return P;let n=s.transform(e.value,i);if(n instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:n}}c.assertNever(s)}}eP.create=(e,t,r)=>new eP({schema:e,typeName:f.ZodEffects,effect:t,...A(r)}),eP.createWithPreprocess=(e,t,r)=>new eP({schema:t,effect:{type:"preprocess",transform:e},typeName:f.ZodEffects,...A(r)});class eI extends z{_parse(e){return this._getType(e)===w.undefined?j(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}eI.create=(e,t)=>new eI({innerType:e,typeName:f.ZodOptional,...A(t)});class ej extends z{_parse(e){return this._getType(e)===w.null?j(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ej.create=(e,t)=>new ej({innerType:e,typeName:f.ZodNullable,...A(t)});class eN extends z{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===w.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}eN.create=(e,t)=>new eN({innerType:e,typeName:f.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...A(t)});class eR extends z{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return N(s)?s.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new k(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===s.status?s.value:this._def.catchValue({get error(){return new k(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}eR.create=(e,t)=>new eR({innerType:e,typeName:f.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...A(t)});class eC extends z{_parse(e){if(this._getType(e)!==w.nan){let t=this._getOrReturnCtx(e);return T(t,{code:E.invalid_type,expected:w.nan,received:t.parsedType}),P}return{status:"valid",value:e.data}}}eC.create=e=>new eC({typeName:f.ZodNaN,...A(e)}),Symbol("zod_brand");class eA extends z{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class ez extends z{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?P:"dirty"===e.status?(t.dirty(),I(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{let e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?P:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new ez({in:e,out:t,typeName:f.ZodPipeline})}}class eM extends z{_parse(e){let t=this._def.innerType._parse(e),r=e=>("valid"===e.status&&(e.value=Object.freeze(e.value)),e);return N(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}eM.create=(e,t)=>new eM({innerType:e,typeName:f.ZodReadonly,...A(t)}),ef.lazycreate,(o=f||(f={})).ZodString="ZodString",o.ZodNumber="ZodNumber",o.ZodNaN="ZodNaN",o.ZodBigInt="ZodBigInt",o.ZodBoolean="ZodBoolean",o.ZodDate="ZodDate",o.ZodSymbol="ZodSymbol",o.ZodUndefined="ZodUndefined",o.ZodNull="ZodNull",o.ZodAny="ZodAny",o.ZodUnknown="ZodUnknown",o.ZodNever="ZodNever",o.ZodVoid="ZodVoid",o.ZodArray="ZodArray",o.ZodObject="ZodObject",o.ZodUnion="ZodUnion",o.ZodDiscriminatedUnion="ZodDiscriminatedUnion",o.ZodIntersection="ZodIntersection",o.ZodTuple="ZodTuple",o.ZodRecord="ZodRecord",o.ZodMap="ZodMap",o.ZodSet="ZodSet",o.ZodFunction="ZodFunction",o.ZodLazy="ZodLazy",o.ZodLiteral="ZodLiteral",o.ZodEnum="ZodEnum",o.ZodEffects="ZodEffects",o.ZodNativeEnum="ZodNativeEnum",o.ZodOptional="ZodOptional",o.ZodNullable="ZodNullable",o.ZodDefault="ZodDefault",o.ZodCatch="ZodCatch",o.ZodPromise="ZodPromise",o.ZodBranded="ZodBranded",o.ZodPipeline="ZodPipeline",o.ZodReadonly="ZodReadonly";let eD=ee.create;et.create,eC.create,er.create;let eL=es.create;ei.create,en.create,ea.create,eo.create,el.create,eu.create,ec.create,ed.create,ep.create;let eq=ef.create;ef.strictCreate,eh.create,ey.create,eg.create,ev.create,e_.create,eb.create,ew.create;let eU=e$.create;eE.create,ek.create,ex.create,eT.create;let eZ=eO.create;eP.create,eI.create,ej.create,eP.createWithPreprocess,ez.create;let eV=eq({apiKey:eD().optional(),headerName:eD().optional(),validateApiKey:eU().args(eD()).returns(eZ(eL())).optional()}).strict().refine(e=>void 0!==e.apiKey||void 0!==e.validateApiKey,{message:"Either 'apiKey' or 'validateApiKey' must be provided"}).refine(e=>void 0===e.apiKey||void 0===e.validateApiKey,{message:"'apiKey' and 'validateApiKey' are mutually exclusive - provide only one"}),eF="Unauthorized: Missing or invalid API key";function eH(e){let t=eV.safeParse(e);if(!t.success){let r="apiKey"in e,s="validateApiKey"in e;if(r&&s)throw Error("'apiKey' and 'validateApiKey' are mutually exclusive - provide only one");if(r||s)throw Error(`Invalid configuration: ${t.error.message}`);throw Error("Either 'apiKey' or 'validateApiKey' must be provided")}let r=e.headerName??"x-api-key",s="apiKey"in e?e.apiKey:void 0,i="validateApiKey"in e?e.validateApiKey:void 0;return async(t,n,a)=>{let o=t.header(r);!o||"apiKey"in e&&o!==s||i&&!await i(o)?n.status(401).json({error:eF}):a()}}var eK=i(8400),eG=i.n(eK);function eB(e){return(t,r,s)=>{let i=t.header("Authorization");if(!i||!i.startsWith("Bearer "))return void r.status(401).json({error:"Unauthorized: Missing or malformed Authorization header"});let n=i.slice(7).trim();if(!n)return void r.status(401).json({error:"Unauthorized: Missing access token"});try{let{secret:r,...i}=e;t.user=eG().verify(n,r,i),s()}catch(e){r.status(401).json({error:"Unauthorized: Invalid or expired token"})}}}let eJ=require("async_hooks"),eW=(e,t)=>{globalThis[e]=t},eX=e=>globalThis[e];function eY({name:e}){let t=Symbol.for(`xmcp-context-${e}`),r=Symbol.for(`xmcp-context-${e}-fallback-store`);if(eX(t))return eX(t);let s=new eJ.AsyncLocalStorage,i=globalThis[r]??{current:null};eW(r,i);let n={provider:(e,t)=>(i.current=e,s.run(e,t)),getContext:()=>{let t=s.getStore();if(t)return t;if(i.current)return i.current;throw Error(`getContext() can only be used within the ${e} context.`)},setContext:t=>{let r=s.getStore()??i.current;if(!r)throw Error(`setContext() can only be used within the ${e} context.`);Object.assign(r,t)}};return eW(t,n),n}let eQ=Symbol.for("mcp.completable");function e0(e,t){return Object.defineProperty(e,eQ,{value:{complete:t},enumerable:!1,writable:!1,configurable:!1}),e}(h||(h={})).Completable="McpCompletable";let e1=Object.freeze({status:"aborted"});function e2(e,t,r){function s(r,s){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:s,constr:a,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,s);let i=a.prototype,n=Object.keys(i);for(let e=0;e<n.length;e++){let t=n[e];t in r||(r[t]=i[t].bind(r))}}let i=r?.Parent??Object;class n extends i{}function a(e){var t;let i=r?.Parent?new n:this;for(let r of(s(i,e),(t=i._zod).deferred??(t.deferred=[]),i._zod.deferred))r();return i}return Object.defineProperty(n,"name",{value:e}),Object.defineProperty(a,"init",{value:s}),Object.defineProperty(a,Symbol.hasInstance,{value:t=>!!r?.Parent&&t instanceof r.Parent||t?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}Symbol("zod_brand");class e9 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class e4 extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(m=globalThis).__zod_globalConfig??(m.__zod_globalConfig={});let e6=globalThis.__zod_globalConfig;function e5(e){return e&&Object.assign(e6,e),e6}let e8=/^[cC][0-9a-z]{6,}$/,e3=/^[0-9a-z]+$/,e7=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,te=/^[0-9a-vA-V]{20}$/,tt=/^[A-Za-z0-9]{27}$/,tr=/^[a-zA-Z0-9_-]{21}$/,ts=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ti=/^([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})$/,tn=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[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)$/,ta=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,to=/^(?:(?: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])$/,tl=/^(([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}|:))$/,tu=/^((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])$/,tc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,td=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,tp=/^[A-Za-z0-9_-]*$/,tf=/^https?$/,th=/^\+[1-9]\d{6,14}$/,tm="(?:(?:\\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])))",ty=RegExp(`^${tm}$`);function tg(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}let tv=/^-?\d+$/,t_=/^-?\d+(?:\.\d+)?$/,tb=/^(?:true|false)$/i,tw=/^null$/i,t$=/^[^A-Z]*$/,tE=/^[^a-z]*$/;function tk(e){let t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function tS(e,t){return"bigint"==typeof t?t.toString():t}function tx(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function tT(e){let t=+!!e.startsWith("^"),r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}let tO=Symbol("evaluating");function tP(e,t,r){let s;Object.defineProperty(e,t,{get(){if(s!==tO)return void 0===s&&(s=tO,s=r()),s},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function tI(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function tj(...e){let t={};for(let r of e)Object.assign(t,Object.getOwnPropertyDescriptors(r));return Object.defineProperties({},t)}function tN(e){return JSON.stringify(e)}let tR="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function tC(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let tA=tx(()=>{if(e6.jitless||"undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function tz(e){if(!1===tC(e))return!1;let t=e.constructor;if(void 0===t||"function"!=typeof t)return!0;let r=t.prototype;return!1!==tC(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function tM(e){return tz(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}let tD=new Set(["string","number","symbol"]);function tL(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function tq(e,t,r){let s=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(s._zod.parent=e),s}function tU(e){if(!e)return{};if("string"==typeof e)return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");e.error=e.message}return(delete e.message,"string"==typeof e.error)?{...e,error:()=>e.error}:e}let tZ={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]};function tV(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function tF(e,t){return t.map(t=>(t.path??(t.path=[]),t.path.unshift(e),t))}function tH(e){return"string"==typeof e?e:e?.message}function tK(e,t,r){let s=e.message?e.message:tH(e.inst?._zod.def?.error?.(e))??tH(t?.error?.(e))??tH(r.customError?.(e))??tH(r.localeError?.(e))??"Invalid input",{inst:i,continue:n,input:a,...o}=e;return o.path??(o.path=[]),o.message=s,t?.reportInput&&(o.input=a),o}function tG(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function tB(...e){let[t,r,s]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:s}:{...t}}let tJ=e2("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),tW={number:"number",bigint:"bigint",object:"date"},tX=e2("$ZodCheckLessThan",(e,t)=>{tJ.init(e,t);let r=tW[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,s=(t.inclusive?r.maximum:r.exclusiveMaximum)??1/0;t.value<s&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=s=>{(t.inclusive?s.value<=t.value:s.value<t.value)||s.issues.push({origin:r,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),tY=e2("$ZodCheckGreaterThan",(e,t)=>{tJ.init(e,t);let r=tW[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,s=(t.inclusive?r.minimum:r.exclusiveMinimum)??-1/0;t.value>s&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=s=>{(t.inclusive?s.value>=t.value:s.value>t.value)||s.issues.push({origin:r,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),tQ=e2("$ZodCheckMultipleOf",(e,t)=>{tJ.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{let s,i,n;if(typeof r.value!=typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?r.value%t.value===BigInt(0):0==(i=Math.round(s=r.value/t.value),n=Number.EPSILON*Math.max(Math.abs(s),1),Math.abs(s-i)<n?0:s-i))||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),t0=e2("$ZodCheckNumberFormat",(e,t)=>{tJ.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),s=r?"int":"number",[i,n]=tZ[t.format];e._zod.onattach.push(e=>{let s=e._zod.bag;s.format=t.format,s.minimum=i,s.maximum=n,r&&(s.pattern=tv)}),e._zod.check=a=>{let o=a.value;if(r){if(!Number.isInteger(o))return void a.issues.push({expected:s,format:t.format,code:"invalid_type",continue:!1,input:o,inst:e});if(!Number.isSafeInteger(o))return void(o>0?a.issues.push({input:o,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:s,inclusive:!0,continue:!t.abort}):a.issues.push({input:o,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:s,inclusive:!0,continue:!t.abort}))}o<i&&a.issues.push({origin:"number",input:o,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),o>n&&a.issues.push({origin:"number",input:o,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),t1=e2("$ZodCheckMaxLength",(e,t)=>{var r;tJ.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return null!=t&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.maximum??1/0;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let s=r.value;if(s.length<=t.maximum)return;let i=tG(s);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),t2=e2("$ZodCheckMinLength",(e,t)=>{var r;tJ.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return null!=t&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.minimum??-1/0;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let s=r.value;if(s.length>=t.minimum)return;let i=tG(s);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),t9=e2("$ZodCheckLengthEquals",(e,t)=>{var r;tJ.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return null!=t&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{let s=r.value,i=s.length;if(i===t.length)return;let n=tG(s),a=i>t.length;r.issues.push({origin:n,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),t4=e2("$ZodCheckStringFormat",(e,t)=>{var r,s;tJ.init(e,t),e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(s=e._zod).check??(s.check=()=>{})}),t6=e2("$ZodCheckRegex",(e,t)=>{t4.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),t5=e2("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=t$),t4.init(e,t)}),t8=e2("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=tE),t4.init(e,t)}),t3=e2("$ZodCheckIncludes",(e,t)=>{tJ.init(e,t);let r=tL(t.includes),s=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=s,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(s)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),t7=e2("$ZodCheckStartsWith",(e,t)=>{tJ.init(e,t);let r=RegExp(`^${tL(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),re=e2("$ZodCheckEndsWith",(e,t)=>{tJ.init(e,t);let r=RegExp(`.*${tL(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),rt=e2("$ZodCheckOverwrite",(e,t)=>{tJ.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class rr{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length));for(let e of t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e))this.content.push(e)}compile(){return Function(...this?.args,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}let rs=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,tS,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ri=e2("$ZodError",rs),rn=e2("$ZodError",rs,{Parent:Error}),ra=e=>(t,r,s,i)=>{let n=s?{...s,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},n);if(a instanceof Promise)throw new e9;if(a.issues.length){let t=new(i?.Err??e)(a.issues.map(e=>tK(e,n,e5())));throw tR(t,i?.callee),t}return a.value},ro=e=>async(t,r,s,i)=>{let n=s?{...s,async:!0}:{async:!0},a=t._zod.run({value:r,issues:[]},n);if(a instanceof Promise&&(a=await a),a.issues.length){let t=new(i?.Err??e)(a.issues.map(e=>tK(e,n,e5())));throw tR(t,i?.callee),t}return a.value},rl=e=>(t,r,s)=>{let i=s?{...s,async:!1}:{async:!1},n=t._zod.run({value:r,issues:[]},i);if(n instanceof Promise)throw new e9;return n.issues.length?{success:!1,error:new(e??ri)(n.issues.map(e=>tK(e,i,e5())))}:{success:!0,data:n.value}},ru=rl(rn),rc=e=>async(t,r,s)=>{let i=s?{...s,async:!0}:{async:!0},n=t._zod.run({value:r,issues:[]},i);return n instanceof Promise&&(n=await n),n.issues.length?{success:!1,error:new e(n.issues.map(e=>tK(e,i,e5())))}:{success:!0,data:n.value}},rd=rc(rn),rp={major:4,minor:4,patch:3},rf=e2("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=rp;let s=[...e._zod.def.checks??[]];for(let t of(e._zod.traits.has("$ZodCheck")&&s.unshift(e),s))for(let r of t._zod.onattach)r(e);if(0===s.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,r)=>{let s,i=tV(e);for(let n of t){if(n._zod.def.when){if(function(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}(e)||!n._zod.def.when(e))continue}else if(i)continue;let t=e.issues.length,a=n._zod.check(e);if(a instanceof Promise&&r?.async===!1)throw new e9;if(s||a instanceof Promise)s=(s??Promise.resolve()).then(async()=>{await a,e.issues.length!==t&&(i||(i=tV(e,t)))});else{if(e.issues.length===t)continue;i||(i=tV(e,t))}}return s?s.then(()=>e):e},r=(r,i,n)=>{if(tV(r))return r.aborted=!0,r;let a=t(i,s,n);if(a instanceof Promise){if(!1===n.async)throw new e9;return a.then(t=>e._zod.parse(t,n))}return e._zod.parse(a,n)};e._zod.run=(i,n)=>{if(n.skipChecks)return e._zod.parse(i,n);if("backward"===n.direction){let t=e._zod.parse({value:i.value,issues:[]},{...n,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,i,n)):r(t,i,n)}let a=e._zod.parse(i,n);if(a instanceof Promise){if(!1===n.async)throw new e9;return a.then(e=>t(e,s,n))}return t(a,s,n)}}tP(e,"~standard",()=>({validate:t=>{try{let r=ru(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return rd(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),rh=e2("$ZodString",(e,t)=>{var r;let s;rf.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(s=(r=e._zod.bag)?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*",RegExp(`^${s}$`)),e._zod.parse=(r,s)=>{if(t.coerce)try{r.value=String(r.value)}catch(e){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),rm=e2("$ZodStringFormat",(e,t)=>{t4.init(e,t),rh.init(e,t)}),ry=e2("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ti),rm.init(e,t)}),rg=e2("$ZodUUID",(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=tn(e))}else t.pattern??(t.pattern=tn());rm.init(e,t)}),rv=e2("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ta),rm.init(e,t)}),r_=e2("$ZodURL",(e,t)=>{rm.init(e,t),e._zod.check=r=>{try{let s=r.value.trim();if(!t.normalize&&t.protocol?.source===tf.source&&!/^https?:\/\//i.test(s))return void r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});let i=new URL(s);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=i.href:r.value=s;return}catch(s){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),rb=e2("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),rm.init(e,t)}),rw=e2("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=tr),rm.init(e,t)}),r$=e2("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=e8),rm.init(e,t)}),rE=e2("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=e3),rm.init(e,t)}),rk=e2("$ZodULID",(e,t)=>{t.pattern??(t.pattern=e7),rm.init(e,t)}),rS=e2("$ZodXID",(e,t)=>{t.pattern??(t.pattern=te),rm.init(e,t)}),rx=e2("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=tt),rm.init(e,t)}),rT=e2("$ZodISODateTime",(e,t)=>{let r,s,i;t.pattern??(r=tg({precision:t.precision}),s=["Z"],t.local&&s.push(""),t.offset&&s.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)"),i=`${r}(?:${s.join("|")})`,t.pattern=RegExp(`^${tm}T(?:${i})$`)),rm.init(e,t)}),rO=e2("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ty),rm.init(e,t)}),rP=e2("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=RegExp(`^${tg(t)}$`)),rm.init(e,t)}),rI=e2("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ts),rm.init(e,t)}),rj=e2("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=to),rm.init(e,t),e._zod.bag.format="ipv4"}),rN=e2("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=tl),rm.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),rR=e2("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=tu),rm.init(e,t)}),rC=e2("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=tc),rm.init(e,t),e._zod.check=r=>{let s=r.value.split("/");try{if(2!==s.length)throw Error();let[e,t]=s;if(!t)throw Error();let r=Number(t);if(`${r}`!==t||r<0||r>128)throw Error();new URL(`http://[${e}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function rA(e){if(""===e)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let rz=e2("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=td),rm.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{rA(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),rM=e2("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=tp),rm.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{!function(e){if(!tp.test(e))return!1;let t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return rA(t.padEnd(4*Math.ceil(t.length/4),"="))}(r.value)&&r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),rD=e2("$ZodE164",(e,t)=>{t.pattern??(t.pattern=th),rm.init(e,t)}),rL=e2("$ZodJWT",(e,t)=>{rm.init(e,t),e._zod.check=r=>{!function(e,t=null){try{let r=e.split(".");if(3!==r.length)return!1;let[s]=r;if(!s)return!1;let i=JSON.parse(atob(s));if("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))return!1;return!0}catch{return!1}}(r.value,t.alg)&&r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),rq=e2("$ZodNumber",(e,t)=>{rf.init(e,t),e._zod.pattern=e._zod.bag.pattern??t_,e._zod.parse=(r,s)=>{if(t.coerce)try{r.value=Number(r.value)}catch(e){}let i=r.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return r;let n="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...n?{received:n}:{}}),r}}),rU=e2("$ZodNumberFormat",(e,t)=>{t0.init(e,t),rq.init(e,t)}),rZ=e2("$ZodBoolean",(e,t)=>{rf.init(e,t),e._zod.pattern=tb,e._zod.parse=(r,s)=>{if(t.coerce)try{r.value=!!r.value}catch(e){}let i=r.value;return"boolean"==typeof i||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),rV=e2("$ZodNull",(e,t)=>{rf.init(e,t),e._zod.pattern=tw,e._zod.values=new Set([null]),e._zod.parse=(t,r)=>{let s=t.value;return null===s||t.issues.push({expected:"null",code:"invalid_type",input:s,inst:e}),t}}),rF=e2("$ZodAny",(e,t)=>{rf.init(e,t),e._zod.parse=e=>e}),rH=e2("$ZodUnknown",(e,t)=>{rf.init(e,t),e._zod.parse=e=>e}),rK=e2("$ZodNever",(e,t)=>{rf.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function rG(e,t,r){e.issues.length&&t.issues.push(...tF(r,e.issues)),t.value[r]=e.value}let rB=e2("$ZodArray",(e,t)=>{rf.init(e,t),e._zod.parse=(r,s)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let n=[];for(let e=0;e<i.length;e++){let a=i[e],o=t.element._zod.run({value:a,issues:[]},s);o instanceof Promise?n.push(o.then(t=>rG(t,r,e))):rG(o,r,e)}return n.length?Promise.all(n).then(()=>r):r}});function rJ(e,t,r,s,i,n){let a=r in s;if(e.issues.length){if(i&&n&&!a)return;t.issues.push(...tF(r,e.issues))}if(!a&&!i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}void 0===e.value?a&&(t.value[r]=void 0):t.value[r]=e.value}function rW(e){var t;let r=Object.keys(e.shape);for(let t of r)if(!e.shape?.[t]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${t}": expected a Zod schema`);let s=Object.keys(t=e.shape).filter(e=>"optional"===t[e]._zod.optin&&"optional"===t[e]._zod.optout);return{...e,keys:r,keySet:new Set(r),numKeys:r.length,optionalKeys:new Set(s)}}function rX(e,t,r,s,i,n){let a=[],o=i.keySet,l=i.catchall._zod,u=l.def.type,c="optional"===l.optin,d="optional"===l.optout;for(let i in t){if("__proto__"===i||o.has(i))continue;if("never"===u){a.push(i);continue}let n=l.run({value:t[i],issues:[]},s);n instanceof Promise?e.push(n.then(e=>rJ(e,r,i,t,c,d))):rJ(n,r,i,t,c,d)}return(a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:n}),e.length)?Promise.all(e).then(()=>r):r}let rY=e2("$ZodObject",(e,t)=>{let r;rf.init(e,t);let s=Object.getOwnPropertyDescriptor(t,"shape");if(!s?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let r={...e};return Object.defineProperty(t,"shape",{value:r}),r}})}let i=tx(()=>rW(t));tP(e._zod,"propValues",()=>{let e=t.shape,r={};for(let t in e){let s=e[t]._zod;if(s.values)for(let e of(r[t]??(r[t]=new Set),s.values))r[t].add(e)}return r});let n=t.catchall;e._zod.parse=(t,s)=>{r??(r=i.value);let a=t.value;if(!tC(a))return t.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),t;t.value={};let o=[],l=r.shape;for(let e of r.keys){let r=l[e],i="optional"===r._zod.optin,n="optional"===r._zod.optout,u=r._zod.run({value:a[e],issues:[]},s);u instanceof Promise?o.push(u.then(r=>rJ(r,t,e,a,i,n))):rJ(u,t,e,a,i,n)}return n?rX(o,a,t,s,i.value,e):o.length?Promise.all(o).then(()=>t):t}}),rQ=e2("$ZodObjectJIT",(e,t)=>{let r,s;rY.init(e,t);let i=e._zod.parse,n=tx(()=>rW(t)),a=!e6.jitless,o=a&&tA.value,l=t.catchall;e._zod.parse=(u,c)=>{s??(s=n.value);let d=u.value;return tC(d)?a&&o&&c?.async===!1&&!0!==c.jitless?(r||(r=(e=>{let t=new rr(["shape","payload","ctx"]),r=n.value,s=e=>{let t=tN(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");let i=Object.create(null),a=0;for(let e of r.keys)i[e]=`key_${a++}`;for(let n of(t.write("const newResult = {};"),r.keys)){let r=i[n],a=tN(n),o=e[n],l=o?._zod?.optin==="optional",u=o?._zod?.optout==="optional";t.write(`const ${r} = ${s(n)};`),l&&u?t.write(`
|
|
7
|
+
deps: ${r}}`};let n={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(e){let[t,r]=function({schema:e}){let t={},r={};for(let s in e)"__proto__"!==s&&((Array.isArray(e[s])?t:r)[s]=e[s]);return[t,r]}(e);a(e,t),l(e,r)}};function a(e,t=e.schema){let{gen:r,data:o,it:n}=e;if(0===Object.keys(t).length)return;let l=r.let("missing");for(let a in t){let u=t[a];if(0===u.length)continue;let c=(0,i.propertyInData)(r,o,a,n.opts.ownProperties);e.setParams({property:a,depsCount:u.length,deps:u.join(", ")}),n.allErrors?r.if(c,()=>{for(let t of u)(0,i.checkReportMissingProp)(e,t)}):(r.if((0,s._)`${c} && (${(0,i.checkMissingProp)(e,u,l)})`),(0,i.reportMissingProp)(e,l),r.else())}}function l(e,t=e.schema){let{gen:r,data:s,keyword:n,it:a}=e,u=r.name("valid");for(let l in t)(0,o.alwaysValidSchema)(a,t[l])||(r.if((0,i.propertyInData)(r,s,l,a.opts.ownProperties),()=>{let t=e.subschema({keyword:n,schemaProp:l},u);e.mergeValidEvaluated(t,u)},()=>r.var(u,!0)),e.ok(u))}t.validatePropertyDeps=a,t.validateSchemaDeps=l,t.default=n},8102(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994),o=r(7218);function i(e,t){let r=e.schema[t];return void 0!==r&&!(0,o.alwaysValidSchema)(e,r)}t.default={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>(0,s.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,s._)`{failingKeyword: ${e.ifClause}}`},code(e){let t,{gen:r,parentSchema:n,it:a}=e;void 0===n.then&&void 0===n.else&&(0,o.checkStrictMode)(a,'"if" without "then" and "else" is ignored');let l=i(a,"then"),u=i(a,"else");if(!l&&!u)return;let c=r.let("valid",!0),d=r.name("_valid");if(t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},d),e.mergeEvaluated(t),e.reset(),l&&u){let t=r.let("ifClause");e.setParams({ifClause:t}),r.if(d,p("then",t),p("else",t))}else l?r.if(d,p("then")):r.if((0,s.not)(d),p("else"));function p(t,o){return()=>{let i=e.subschema({keyword:t},d);r.assign(c,d),e.mergeValidEvaluated(i,c),o?r.assign(o,(0,s._)`${t}`):e.setParams({ifClause:t})}}e.pass(c,()=>e.error(!0))}}},8313(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(714),o=r(1997),i=r(3665),n=r(5153),a=r(2692),l=r(5860),u=r(374),c=r(8401),d=r(3252),p=r(6398),f=r(4948),h=r(1070),m=r(5368),y=r(2003),g=r(8102),v=r(1871);t.default=function(e=!1){let t=[f.default,h.default,m.default,y.default,g.default,v.default,u.default,c.default,l.default,d.default,p.default];return e?t.push(o.default,n.default):t.push(s.default,i.default),t.push(a.default),t}},3665(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;let s=r(8994),o=r(7218),i=r(4954);function n(e,t,r=e.schema){let{gen:i,parentSchema:a,data:l,keyword:u,it:c}=e;(function(e){let{opts:s,errSchemaPath:i}=c,n=r.length,a=n===e.minItems&&(n===e.maxItems||!1===e[t]);if(s.strictTuples&&!a){let e=`"${u}" is ${n}-tuple, but minItems or maxItems/${t} are not specified or different at path "${i}"`;(0,o.checkStrictMode)(c,e,s.strictTuples)}})(a),c.opts.unevaluated&&r.length&&!0!==c.items&&(c.items=o.mergeEvaluated.items(i,r.length,c.items));let d=i.name("valid"),p=i.const("len",(0,s._)`${l}.length`);r.forEach((t,r)=>{(0,o.alwaysValidSchema)(c,t)||(i.if((0,s._)`${p} > ${r}`,()=>e.subschema({keyword:u,schemaProp:r,dataProp:r},d)),e.ok(d))})}t.validateTuple=n,t.default={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return n(e,"additionalItems",t);r.items=!0,(0,o.alwaysValidSchema)(r,t)||e.ok((0,i.validateArray)(e))}}},5153(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994),o=r(7218),i=r(4954),n=r(714);t.default={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,s.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,s._)`{limit: ${e}}`},code(e){let{schema:t,parentSchema:r,it:s}=e,{prefixItems:a}=r;s.items=!0,(0,o.alwaysValidSchema)(s,t)||(a?(0,n.validateAdditionalItems)(e,a):e.ok((0,i.validateArray)(e)))}}},4948(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(7218);t.default={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:o}=e;if((0,s.alwaysValidSchema)(o,r))return void e.fail();let i=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),e.failResult(i,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}}},5368(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994),o=r(7218);t.default={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>(0,s._)`{passingSchemas: ${e.passing}}`},code(e){let{gen:t,schema:r,parentSchema:i,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(n.opts.discriminator&&i.discriminator)return;let a=t.let("valid",!1),l=t.let("passing",null),u=t.name("_valid");e.setParams({passing:l}),t.block(function(){r.forEach((r,i)=>{let c;(0,o.alwaysValidSchema)(n,r)?t.var(u,!0):c=e.subschema({keyword:"oneOf",schemaProp:i,compositeRule:!0},u),i>0&&t.if((0,s._)`${u} && ${a}`).assign(a,!1).assign(l,(0,s._)`[${l}, ${i}]`).else(),t.if(u,()=>{t.assign(a,!0),t.assign(l,i),c&&e.mergeEvaluated(c,s.Name)})})}),e.result(a,()=>e.reset(),()=>e.error(!0))}}},6398(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(4954),o=r(8994),i=r(7218),n=r(7218);t.default={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:a,parentSchema:l,it:u}=e,{opts:c}=u,d=(0,s.allSchemaProperties)(r),p=d.filter(e=>(0,i.alwaysValidSchema)(u,r[e]));if(0===d.length||p.length===d.length&&(!u.opts.unevaluated||!0===u.props))return;let f=c.strictSchema&&!c.allowMatchingProperties&&l.properties,h=t.name("valid");!0===u.props||u.props instanceof o.Name||(u.props=(0,n.evaluatedPropsToName)(t,u.props));let{props:m}=u;for(let e of d)f&&function(e){for(let t in f)new RegExp(e).test(t)&&(0,i.checkStrictMode)(u,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}(e),u.allErrors?y(e):(t.var(h,!0),y(e),t.if(h));function y(r){t.forIn("key",a,i=>{t.if((0,o._)`${(0,s.usePattern)(e,r)}.test(${i})`,()=>{let s=p.includes(r);s||e.subschema({keyword:"patternProperties",schemaProp:r,dataProp:i,dataPropType:n.Type.Str},h),u.opts.unevaluated&&!0!==m?t.assign((0,o._)`${m}[${i}]`,!0):s||u.allErrors||t.if((0,o.not)(h),()=>t.break())})})}}}},1997(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(3665);t.default={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,s.validateTuple)(e,"items")}},3252(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(6023),o=r(4954),i=r(7218),n=r(8401);t.default={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:a,data:l,it:u}=e;"all"===u.opts.removeAdditional&&void 0===a.additionalProperties&&n.default.code(new s.KeywordCxt(u,n.default,"additionalProperties"));let c=(0,o.allSchemaProperties)(r);for(let e of c)u.definedProperties.add(e);u.opts.unevaluated&&c.length&&!0!==u.props&&(u.props=i.mergeEvaluated.props(t,(0,i.toHash)(c),u.props));let d=c.filter(e=>!(0,i.alwaysValidSchema)(u,r[e]));if(0===d.length)return;let p=t.name("valid");for(let s of d){var f;(f=s,u.opts.useDefaults&&!u.compositeRule&&void 0!==r[f].default)?h(s):(t.if((0,o.propertyInData)(t,l,s,u.opts.ownProperties)),h(s),u.allErrors||t.else().var(p,!0),t.endIf()),e.it.definedProperties.add(s),e.ok(p)}function h(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},p)}}}},374(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994),o=r(7218);t.default={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>(0,s._)`{propertyName: ${e.propertyName}}`},code(e){let{gen:t,schema:r,data:i,it:n}=e;if((0,o.alwaysValidSchema)(n,r))return;let a=t.name("valid");t.forIn("key",i,r=>{e.setParams({propertyName:r}),e.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:!0},a),t.if((0,s.not)(a),()=>{e.error(!0),n.allErrors||t.break()})}),e.ok(a)}}},1871(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(7218);t.default={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){void 0===t.if&&(0,s.checkStrictMode)(r,`"${e}" without "if" is ignored`)}}},4954(e,t,r){"use strict";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 s=r(8994),o=r(7218),i=r(6660),n=r(7218);function a(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,s._)`Object.prototype.hasOwnProperty`})}function l(e,t,r){return(0,s._)`${a(e)}.call(${t}, ${r})`}function u(e,t,r,o){let i=(0,s._)`${t}${(0,s.getProperty)(r)} === undefined`;return o?(0,s.or)(i,(0,s.not)(l(e,t,r))):i}function c(e){return e?Object.keys(e).filter(e=>"__proto__"!==e):[]}t.checkReportMissingProp=function(e,t){let{gen:r,data:o,it:i}=e;r.if(u(r,o,t,i.opts.ownProperties),()=>{e.setParams({missingProperty:(0,s._)`${t}`},!0),e.error()})},t.checkMissingProp=function({gen:e,data:t,it:{opts:r}},o,i){return(0,s.or)(...o.map(o=>(0,s.and)(u(e,t,o,r.ownProperties),(0,s._)`${i} = ${o}`)))},t.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},t.hasPropFunc=a,t.isOwnProperty=l,t.propertyInData=function(e,t,r,o){let i=(0,s._)`${t}${(0,s.getProperty)(r)} !== undefined`;return o?(0,s._)`${i} && ${l(e,t,r)}`:i},t.noPropertyInData=u,t.allSchemaProperties=c,t.schemaProperties=function(e,t){return c(t).filter(r=>!(0,o.alwaysValidSchema)(e,t[r]))},t.callValidateCode=function({schemaCode:e,data:t,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:a},it:l},u,c,d){let p=d?(0,s._)`${e}, ${t}, ${o}${n}`:t,f=[[i.default.instancePath,(0,s.strConcat)(i.default.instancePath,a)],[i.default.parentData,l.parentData],[i.default.parentDataProperty,l.parentDataProperty],[i.default.rootData,i.default.rootData]];l.opts.dynamicRef&&f.push([i.default.dynamicAnchors,i.default.dynamicAnchors]);let h=(0,s._)`${p}, ${r.object(...f)}`;return c!==s.nil?(0,s._)`${u}.call(${c}, ${h})`:(0,s._)`${u}(${h})`};let d=(0,s._)`new RegExp`;t.usePattern=function({gen:e,it:{opts:t}},r){let o=t.unicodeRegExp?"u":"",{regExp:i}=t.code,a=i(r,o);return e.scopeValue("pattern",{key:a.toString(),ref:a,code:(0,s._)`${"new RegExp"===i.code?d:(0,n.useFunc)(e,i)}(${r}, ${o})`})},t.validateArray=function(e){let{gen:t,data:r,keyword:i,it:n}=e,a=t.name("valid");if(n.allErrors){let e=t.let("valid",!0);return l(()=>t.assign(e,!1)),e}return t.var(a,!0),l(()=>t.break()),a;function l(n){let l=t.const("len",(0,s._)`${r}.length`);t.forRange("i",0,l,r=>{e.subschema({keyword:i,dataProp:r,dataPropType:o.Type.Num},a),t.if((0,s.not)(a),n)})}},t.validateUnion=function(e){let{gen:t,schema:r,keyword:i,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some(e=>(0,o.alwaysValidSchema)(n,e))&&!n.opts.unevaluated)return;let a=t.let("valid",!1),l=t.name("_valid");t.block(()=>r.forEach((r,o)=>{let n=e.subschema({keyword:i,schemaProp:o,compositeRule:!0},l);t.assign(a,(0,s._)`${a} || ${l}`),e.mergeValidEvaluated(n,l)||t.if((0,s.not)(a))})),e.result(a,()=>e.reset(),()=>e.error(!0))}},3330(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}}},8119(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(3330),o=r(930);t.default=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",s.default,o.default]},930(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;let s=r(4220),o=r(4954),i=r(8994),n=r(6660),a=r(1688),l=r(7218);function u(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,i._)`${r.scopeValue("wrapper",{ref:t})}.validate`}function c(e,t,r,s){let{gen:a,it:u}=e,{allErrors:c,schemaEnv:d,opts:p}=u,f=p.passContext?n.default.this:i.nil;function h(e){let t=(0,i._)`${e}.errors`;a.assign(n.default.vErrors,(0,i._)`${n.default.vErrors} === null ? ${t} : ${n.default.vErrors}.concat(${t})`),a.assign(n.default.errors,(0,i._)`${n.default.vErrors}.length`)}function m(e){var t;if(!u.opts.unevaluated)return;let s=null==(t=null==r?void 0:r.validate)?void 0:t.evaluated;if(!0!==u.props)if(s&&!s.dynamicProps)void 0!==s.props&&(u.props=l.mergeEvaluated.props(a,s.props,u.props));else{let t=a.var("props",(0,i._)`${e}.evaluated.props`);u.props=l.mergeEvaluated.props(a,t,u.props,i.Name)}if(!0!==u.items)if(s&&!s.dynamicItems)void 0!==s.items&&(u.items=l.mergeEvaluated.items(a,s.items,u.items));else{let t=a.var("items",(0,i._)`${e}.evaluated.items`);u.items=l.mergeEvaluated.items(a,t,u.items,i.Name)}}s?function(){if(!d.$async)throw Error("async schema referenced by sync schema");let r=a.let("valid");a.try(()=>{a.code((0,i._)`await ${(0,o.callValidateCode)(e,t,f)}`),m(t),c||a.assign(r,!0)},e=>{a.if((0,i._)`!(${e} instanceof ${u.ValidationError})`,()=>a.throw(e)),h(e),c||a.assign(r,!1)}),e.ok(r)}():e.result((0,o.callValidateCode)(e,t,f),()=>m(t),()=>h(t))}t.getValidate=u,t.callRef=c,t.default={keyword:"$ref",schemaType:"string",code(e){var t,r;let o,n,l,d,{gen:p,schema:f,it:h}=e,{baseId:m,schemaEnv:y,validateName:g,opts:v,self:_}=h,{root:b}=y;if(("#"===f||"#/"===f)&&m===b.baseId){if(y===b)return c(e,g,y,y.$async);let t=p.scopeValue("root",{ref:b});return c(e,(0,i._)`${t}.validate`,b,b.$async)}let w=a.resolveRef.call(_,b,m,f);if(void 0===w)throw new s.default(h.opts.uriResolver,m,f);return w instanceof a.SchemaEnv?(o=u(e,t=w),void c(e,o,t,t.$async)):(r=w,n=p.scopeValue("schema",!0===v.code.source?{ref:r,code:(0,i.stringify)(r)}:{ref:r}),l=p.name("valid"),d=e.subschema({schema:r,dataTypes:[],schemaPath:i.nil,topSchemaRef:n,errSchemaPath:f},l),void(e.mergeEvaluated(d),e.ok(l)))}}},9376(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994),o=r(5141),i=r(1688),n=r(4220),a=r(7218);t.default={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===o.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,s._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},code(e){let{gen:t,data:r,schema:l,parentSchema:u,it:c}=e,{oneOf:d}=u;if(!c.opts.discriminator)throw Error("discriminator: requires discriminator option");let p=l.propertyName;if("string"!=typeof p)throw Error("discriminator: requires propertyName");if(l.mapping)throw Error("discriminator: mapping is not supported");if(!d)throw Error("discriminator: requires oneOf keyword");let f=t.let("valid",!1),h=t.const("tag",(0,s._)`${r}${(0,s.getProperty)(p)}`);t.if((0,s._)`typeof ${h} == "string"`,()=>(function(){let r=function(){var e;let t={},r=o(u),s=!0;for(let t=0;t<d.length;t++){let u=d[t];if((null==u?void 0:u.$ref)&&!(0,a.schemaHasRulesButRef)(u,c.self.RULES)){let e=u.$ref;if((u=i.resolveRef.call(c.self,c.schemaEnv.root,c.baseId,e))instanceof i.SchemaEnv&&(u=u.schema),void 0===u)throw new n.default(c.opts.uriResolver,c.baseId,e)}let f=null==(e=null==u?void 0:u.properties)?void 0:e[p];if("object"!=typeof f)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${p}"`);s=s&&(r||o(u)),function(e,t){if(e.const)l(e.const,t);else if(e.enum)for(let r of e.enum)l(r,t);else throw Error(`discriminator: "properties/${p}" must have "const" or "enum"`)}(f,t)}if(!s)throw Error(`discriminator: "${p}" must be required`);return t;function o({required:e}){return Array.isArray(e)&&e.includes(p)}function l(e,r){if("string"!=typeof e||e in t)throw Error(`discriminator: "${p}" values must be unique strings`);t[e]=r}}();for(let o in t.if(!1),r)t.elseIf((0,s._)`${h} === ${o}`),t.assign(f,function(r){let o=t.name("valid"),i=e.subschema({keyword:"oneOf",schemaProp:r},o);return e.mergeEvaluated(i,s.Name),o}(r[o]));t.else(),e.error(!1,{discrError:o.DiscrError.Mapping,tag:h,tagName:p}),t.endIf()})(),()=>e.error(!1,{discrError:o.DiscrError.Tag,tag:h,tagName:p})),e.ok(f)}}},5141(e,t){"use strict";var r,s;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,(s=r||(t.DiscrError=r={})).Tag="tag",s.Mapping="mapping"},3959(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8119),o=r(659),i=r(8313),n=r(8563),a=r(4618);t.default=[s.default,o.default,(0,i.default)(),n.default,a.metadataVocabulary,a.contentVocabulary]},424(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994);t.default={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>(0,s.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,s._)`{format: ${e}}`},code(e,t){let r,o,i,n,a,l,{gen:u,data:c,$data:d,schema:p,schemaCode:f,it:h}=e,{opts:m,errSchemaPath:y,schemaEnv:g,self:v}=h;m.validateFormats&&(d?(r=u.scopeValue("formats",{ref:v.formats,code:m.code.formats}),o=u.const("fDef",(0,s._)`${r}[${f}]`),i=u.let("fType"),n=u.let("format"),u.if((0,s._)`typeof ${o} == "object" && !(${o} instanceof RegExp)`,()=>u.assign(i,(0,s._)`${o}.type || "string"`).assign(n,(0,s._)`${o}.validate`),()=>u.assign(i,(0,s._)`"string"`).assign(n,o)),e.fail$data((0,s.or)(!1===m.strictSchema?s.nil:(0,s._)`${f} && !${n}`,(a=g.$async?(0,s._)`(${o}.async ? await ${n}(${c}) : ${n}(${c}))`:(0,s._)`${n}(${c})`,l=(0,s._)`(typeof ${n} == "function" ? ${a} : ${n}.test(${c}))`,(0,s._)`${n} && ${n} !== true && ${i} === ${t} && !${l}`)))):function(){var r;let o,i,n=v.formats[p];if(!n){if(!1===m.strictSchema)return v.logger.warn(a());throw Error(a());function a(){return`unknown format "${p}" ignored in schema at path "${y}"`}}if(!0===n)return;let[l,d,f]=(o=(r=n)instanceof RegExp?(0,s.regexpCode)(r):m.code.formats?(0,s._)`${m.code.formats}${(0,s.getProperty)(p)}`:void 0,i=u.scopeValue("formats",{key:p,ref:r,code:o}),"object"!=typeof r||r instanceof RegExp?["string",r,i]:[r.type||"string",r.validate,(0,s._)`${i}.validate`]);l===t&&e.pass(function(){if("object"==typeof n&&!(n instanceof RegExp)&&n.async){if(!g.$async)throw Error("async format in sync schema");return(0,s._)`await ${f}(${c})`}return"function"==typeof d?(0,s._)`${f}(${c})`:(0,s._)`${f}.test(${c})`}())}())}}},8563(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=[r(424).default]},4618(e,t){"use strict";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"]},7080(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994),o=r(7218),i=r(6013);t.default={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>(0,s._)`{allowedValue: ${e}}`},code(e){let{gen:t,data:r,$data:n,schemaCode:a,schema:l}=e;n||l&&"object"==typeof l?e.fail$data((0,s._)`!${(0,o.useFunc)(t,i.default)}(${r}, ${a})`):e.fail((0,s._)`${l} !== ${r}`)}}},5358(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994),o=r(7218),i=r(6013);t.default={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,s._)`{allowedValues: ${e}}`},code(e){let t,r,{gen:n,data:a,$data:l,schema:u,schemaCode:c,it:d}=e;if(!l&&0===u.length)throw Error("enum must have non-empty array");let p=u.length>=d.opts.loopEnum,f=()=>null!=t?t:t=(0,o.useFunc)(n,i.default);if(p||l)r=n.let("valid"),e.block$data(r,function(){n.assign(r,!1),n.forOf("v",c,e=>n.if((0,s._)`${f()}(${a}, ${e})`,()=>n.assign(r,!0).break()))});else{if(!Array.isArray(u))throw Error("ajv implementation error");let e=n.const("vSchema",c);r=(0,s.or)(...u.map((t,r)=>{var o,i;let n;return o=e,"object"==typeof(n=u[i=r])&&null!==n?(0,s._)`${f()}(${a}, ${o}[${i}])`:(0,s._)`${a} === ${n}`}))}e.pass(r)}}},659(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8997),o=r(9190),i=r(4280),n=r(8805),a=r(2189),l=r(3138),u=r(8870),c=r(1858),d=r(7080),p=r(5358);t.default=[s.default,o.default,i.default,n.default,a.default,l.default,u.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},d.default,p.default]},8870(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994);t.default={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,s.str)`must NOT have ${"maxItems"===e?"more":"fewer"} than ${t} items`,params:({schemaCode:e})=>(0,s._)`{limit: ${e}}`},code(e){let{keyword:t,data:r,schemaCode:o}=e,i="maxItems"===t?s.operators.GT:s.operators.LT;e.fail$data((0,s._)`${r}.length ${i} ${o}`)}}},4280(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994),o=r(7218),i=r(5532);t.default={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,s.str)`must NOT have ${"maxLength"===e?"more":"fewer"} than ${t} characters`,params:({schemaCode:e})=>(0,s._)`{limit: ${e}}`},code(e){let{keyword:t,data:r,schemaCode:n,it:a}=e,l="maxLength"===t?s.operators.GT:s.operators.LT,u=!1===a.opts.unicode?(0,s._)`${r}.length`:(0,s._)`${(0,o.useFunc)(e.gen,i.default)}(${r})`;e.fail$data((0,s._)`${u} ${l} ${n}`)}}},8997(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994),o=s.operators,i={maximum:{okStr:"<=",ok:o.LTE,fail:o.GT},minimum:{okStr:">=",ok:o.GTE,fail:o.LT},exclusiveMaximum:{okStr:"<",ok:o.LT,fail:o.GTE},exclusiveMinimum:{okStr:">",ok:o.GT,fail:o.LTE}};t.default={keyword:Object.keys(i),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,s.str)`must be ${i[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,s._)`{comparison: ${i[e].okStr}, limit: ${t}}`},code(e){let{keyword:t,data:r,schemaCode:o}=e;e.fail$data((0,s._)`${r} ${i[t].fail} ${o} || isNaN(${r})`)}}},2189(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994);t.default={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,s.str)`must NOT have ${"maxProperties"===e?"more":"fewer"} than ${t} properties`,params:({schemaCode:e})=>(0,s._)`{limit: ${e}}`},code(e){let{keyword:t,data:r,schemaCode:o}=e,i="maxProperties"===t?s.operators.GT:s.operators.LT;e.fail$data((0,s._)`Object.keys(${r}).length ${i} ${o}`)}}},9190(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994);t.default={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>(0,s.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,s._)`{multipleOf: ${e}}`},code(e){let{gen:t,data:r,schemaCode:o,it:i}=e,n=i.opts.multipleOfPrecision,a=t.let("res"),l=n?(0,s._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${n}`:(0,s._)`${a} !== parseInt(${a})`;e.fail$data((0,s._)`(${o} === 0 || (${a} = ${r}/${o}, ${l}))`)}}},8805(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(4954),o=r(7218),i=r(8994);t.default={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>(0,i.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,i._)`{pattern: ${e}}`},code(e){let{gen:t,data:r,$data:n,schema:a,schemaCode:l,it:u}=e,c=u.opts.unicodeRegExp?"u":"";if(n){let{regExp:s}=u.opts.code,n="new RegExp"===s.code?(0,i._)`new RegExp`:(0,o.useFunc)(t,s),a=t.let("valid");t.try(()=>t.assign(a,(0,i._)`${n}(${l}, ${c}).test(${r})`),()=>t.assign(a,!1)),e.fail$data((0,i._)`!${a}`)}else{let t=(0,s.usePattern)(e,a);e.fail$data((0,i._)`!${t}.test(${r})`)}}}},3138(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(4954),o=r(8994),i=r(7218);t.default={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>(0,o.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,o._)`{missingProperty: ${e}}`},code(e){let{gen:t,schema:r,schemaCode:n,data:a,$data:l,it:u}=e,{opts:c}=u;if(!l&&0===r.length)return;let d=r.length>=c.loopRequired;if(u.allErrors?function(){if(d||l)e.block$data(o.nil,p);else for(let t of r)(0,s.checkReportMissingProp)(e,t)}():function(){let i=t.let("missing");if(d||l){let r=t.let("valid",!0);e.block$data(r,()=>{var l,u;return l=i,u=r,void(e.setParams({missingProperty:l}),t.forOf(l,n,()=>{t.assign(u,(0,s.propertyInData)(t,a,l,c.ownProperties)),t.if((0,o.not)(u),()=>{e.error(),t.break()})},o.nil))}),e.ok(r)}else t.if((0,s.checkMissingProp)(e,r,i)),(0,s.reportMissingProp)(e,i),t.else()}(),c.strictRequired){let t=e.parentSchema.properties,{definedProperties:s}=e.it;for(let e of r)if((null==t?void 0:t[e])===void 0&&!s.has(e)){let t=u.schemaEnv.baseId+u.errSchemaPath,r=`required property "${e}" is not defined at "${t}" (strictRequired)`;(0,i.checkStrictMode)(u,r,u.opts.strictRequired)}}function p(){t.forOf("prop",n,r=>{e.setParams({missingProperty:r}),t.if((0,s.noPropertyInData)(t,a,r,c.ownProperties),()=>e.error())})}}}},1858(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(6419),o=r(8994),i=r(7218),n=r(6013);t.default={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>(0,o.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,o._)`{i: ${e}, j: ${t}}`},code(e){let{gen:t,data:r,$data:a,schema:l,parentSchema:u,schemaCode:c,it:d}=e;if(!a&&!l)return;let p=t.let("valid"),f=u.items?(0,s.getSchemaTypes)(u.items):[];e.block$data(p,function(){let a=t.let("i",(0,o._)`${r}.length`),l=t.let("j");e.setParams({i:a,j:l}),t.assign(p,!0),t.if((0,o._)`${a} > 1`,()=>(f.length>0&&!f.some(e=>"object"===e||"array"===e)?function(i,n){let a=t.name("item"),l=(0,s.checkDataTypes)(f,a,d.opts.strictNumbers,s.DataType.Wrong),u=t.const("indices",(0,o._)`{}`);t.for((0,o._)`;${i}--;`,()=>{t.let(a,(0,o._)`${r}[${i}]`),t.if(l,(0,o._)`continue`),f.length>1&&t.if((0,o._)`typeof ${a} == "string"`,(0,o._)`${a} += "_"`),t.if((0,o._)`typeof ${u}[${a}] == "number"`,()=>{t.assign(n,(0,o._)`${u}[${a}]`),e.error(),t.assign(p,!1).break()}).code((0,o._)`${u}[${a}] = ${i}`)})}:function(s,a){let l=(0,i.useFunc)(t,n.default),u=t.name("outer");t.label(u).for((0,o._)`;${s}--;`,()=>t.for((0,o._)`${a} = ${s}; ${a}--;`,()=>t.if((0,o._)`${l}(${r}[${s}], ${r}[${a}])`,()=>{e.error(),t.assign(p,!1).break(u)})))})(a,l))},(0,o._)`${c} === false`),e.ok(p)}}},9454(e,t,r){"use strict";var s=r(181).Buffer,o=r(181).SlowBuffer;function i(e,t){if(!s.isBuffer(e)||!s.isBuffer(t)||e.length!==t.length)return!1;for(var r=0,o=0;o<e.length;o++)r|=e[o]^t[o];return 0===r}e.exports=i,i.install=function(){s.prototype.equal=o.prototype.equal=function(e){return i(this,e)}};var n=s.prototype.equal,a=o.prototype.equal;i.restore=function(){s.prototype.equal=n,o.prototype.equal=a}},6507(e,t,r){"use strict";let s=r(5317),o=r(8388),i=r(442);function n(e,t,r){let n=o(e,t,r),a=s.spawn(n.command,n.args,n.options);return i.hookChildProcess(a,n),a}e.exports=n,e.exports.spawn=n,e.exports.sync=function(e,t,r){let n=o(e,t,r),a=s.spawnSync(n.command,n.args,n.options);return a.error=a.error||i.verifyENOENTSync(a.status,n),a},e.exports._parse=o,e.exports._enoent=i},442(e){"use strict";let t="win32"===process.platform;function r(e,t){return Object.assign(Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function s(e,s){return t&&1===e&&!s.file?r(s.original,"spawn"):null}e.exports={hookChildProcess:function(e,r){if(!t)return;let o=e.emit;e.emit=function(t,i){if("exit"===t){let t=s(i,r);if(t)return o.call(e,"error",t)}return o.apply(e,arguments)}},verifyENOENT:s,verifyENOENTSync:function(e,s){return t&&1===e&&!s.file?r(s.original,"spawnSync"):null},notFoundError:r}},8388(e,t,r){"use strict";let s=r(6928),o=r(3803),i=r(2077),n=r(1880),a="win32"===process.platform,l=/\.(?:com|exe)$/i,u=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;e.exports=function(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null);let c={command:e,args:t=t?t.slice(0):[],options:r=Object.assign({},r),file:void 0,original:{command:e,args:t}};return r.shell?c:function(e){let t;if(!a)return e;let r=(e.file=o(e),(t=e.file&&n(e.file))?(e.args.unshift(e.file),e.command=t,o(e)):e.file),c=!l.test(r);if(e.options.forceShell||c){let t=u.test(r);e.command=s.normalize(e.command),e.command=i.command(e.command),e.args=e.args.map(e=>i.argument(e,t));let o=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${o}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}(c)}},2077(e){"use strict";let t=/([()\][%!^"`<>&|;, *?])/g;e.exports.command=function(e){return e.replace(t,"^$1")},e.exports.argument=function(e,r){return e=(e=(e=`${e}`).replace(/(?=(\\+?)?)\1"/g,'$1$1\\"')).replace(/(?=(\\+?)?)\1$/,"$1$1"),e=(e=`"${e}"`).replace(t,"^$1"),r&&(e=e.replace(t,"^$1")),e}},1880(e,t,r){"use strict";let s=r(9896),o=r(600);e.exports=function(e){let t,r=Buffer.alloc(150);try{t=s.openSync(e,"r"),s.readSync(t,r,0,150,0),s.closeSync(t)}catch(e){}return o(r.toString())}},3803(e,t,r){"use strict";let s=r(6928),o=r(1905),i=r(9695);function n(e,t){let r,n=e.options.env||process.env,a=process.cwd(),l=null!=e.options.cwd,u=l&&void 0!==process.chdir&&!process.chdir.disabled;if(u)try{process.chdir(e.options.cwd)}catch(e){}try{r=o.sync(e.command,{path:n[i({env:n})],pathExt:t?s.delimiter:void 0})}catch(e){}finally{u&&process.chdir(a)}return r&&(r=s.resolve(l?e.options.cwd:"",r)),r}e.exports=function(e){return n(e)||n(e,!0)}},8583(e,t,r){let s=r(9896),o=r(6928),i=r(857),n=r(6982),a=r(4519).version,l=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function u(e){console.log(`[dotenv@${a}][DEBUG] ${e}`)}function c(e){console.log(`[dotenv@${a}] ${e}`)}function d(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function p(e){let t=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(let r of e.path)s.existsSync(r)&&(t=r.endsWith(".vault")?r:`${r}.vault`);else t=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else t=o.resolve(process.cwd(),".env.vault");return s.existsSync(t)?t:null}function f(e){return"~"===e[0]?o.join(i.homedir(),e.slice(1)):e}let h={configDotenv:function(e){let t,r=o.resolve(process.cwd(),".env"),i="utf8",n=!!(e&&e.debug),a=!e||!("quiet"in e)||e.quiet;e&&e.encoding?i=e.encoding:n&&u("No encoding is specified. UTF-8 is used by default");let l=[r];if(e&&e.path)if(Array.isArray(e.path))for(let t of(l=[],e.path))l.push(f(t));else l=[f(e.path)];let d={};for(let r of l)try{let t=h.parse(s.readFileSync(r,{encoding:i}));h.populate(d,t,e)}catch(e){n&&u(`Failed to load ${r} ${e.message}`),t=e}let p=process.env;if(e&&null!=e.processEnv&&(p=e.processEnv),h.populate(p,d,e),n||!a){let e=Object.keys(d).length,r=[];for(let e of l)try{let t=o.relative(process.cwd(),e);r.push(t)}catch(r){n&&u(`Failed to load ${e} ${r.message}`),t=r}c(`injecting env (${e}) from ${r.join(",")}`)}return t?{parsed:d,error:t}:{parsed:d}},_configVault:function(e){let t=!!(e&&e.debug),r=!e||!("quiet"in e)||e.quiet;(t||!r)&&c("Loading env from encrypted .env.vault");let s=h._parseVault(e),o=process.env;return e&&null!=e.processEnv&&(o=e.processEnv),h.populate(o,s,e),{parsed:s}},_parseVault:function(e){let t,r=p(e=e||{});e.path=r;let s=h.configDotenv(e);if(!s.parsed){let e=Error(`MISSING_DATA: Cannot parse ${r} for an unknown reason`);throw e.code="MISSING_DATA",e}let o=d(e).split(","),i=o.length;for(let e=0;e<i;e++)try{let r=o[e].trim(),i=function(e,t){let r;try{r=new URL(t)}catch(e){if("ERR_INVALID_URL"===e.code){let e=Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw e.code="INVALID_DOTENV_KEY",e}throw e}let s=r.password;if(!s){let e=Error("INVALID_DOTENV_KEY: Missing key part");throw e.code="INVALID_DOTENV_KEY",e}let o=r.searchParams.get("environment");if(!o){let e=Error("INVALID_DOTENV_KEY: Missing environment part");throw e.code="INVALID_DOTENV_KEY",e}let i=`DOTENV_VAULT_${o.toUpperCase()}`,n=e.parsed[i];if(!n){let e=Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${i} in your .env.vault file.`);throw e.code="NOT_FOUND_DOTENV_ENVIRONMENT",e}return{ciphertext:n,key:s}}(s,r);t=h.decrypt(i.ciphertext,i.key);break}catch(t){if(e+1>=i)throw t}return h.parse(t)},config:function(e){if(0===d(e).length)return h.configDotenv(e);let t=p(e);if(!t){var r;return r=`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`,console.log(`[dotenv@${a}][WARN] ${r}`),h.configDotenv(e)}return h._configVault(e)},decrypt:function(e,t){let r=Buffer.from(t.slice(-64),"hex"),s=Buffer.from(e,"base64"),o=s.subarray(0,12),i=s.subarray(-16);s=s.subarray(12,-16);try{let e=n.createDecipheriv("aes-256-gcm",r,o);return e.setAuthTag(i),`${e.update(s)}${e.final()}`}catch(s){let e=s instanceof RangeError,t="Invalid key length"===s.message,r="Unsupported state or unable to authenticate data"===s.message;if(e||t){let e=Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw e.code="INVALID_DOTENV_KEY",e}if(r){let e=Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw e.code="DECRYPTION_FAILED",e}throw s}},parse:function(e){let t,r={},s=e.toString();for(s=s.replace(/\r\n?/mg,"\n");null!=(t=l.exec(s));){let e=t[1],s=t[2]||"",o=(s=s.trim())[0];s=s.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),'"'===o&&(s=(s=s.replace(/\\n/g,"\n")).replace(/\\r/g,"\r")),r[e]=s}return r},populate:function(e,t,r={}){let s=!!(r&&r.debug),o=!!(r&&r.override);if("object"!=typeof t){let e=Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw e.code="OBJECT_REQUIRED",e}for(let r of Object.keys(t))Object.prototype.hasOwnProperty.call(e,r)?(!0===o&&(e[r]=t[r]),s&&(!0===o?u(`"${r}" is already defined and WAS overwritten`):u(`"${r}" is already defined and was NOT overwritten`))):e[r]=t[r]}};e.exports.configDotenv=h.configDotenv,e.exports._configVault=h._configVault,e.exports._parseVault=h._parseVault,e.exports.config=h.config,e.exports.decrypt=h.decrypt,e.exports.parse=h.parse,e.exports.populate=h.populate,e.exports=h},9053(e,t,r){"use strict";var s=r(6608).Buffer,o=r(2188);function i(e){if(s.isBuffer(e))return e;if("string"==typeof e)return s.from(e,"base64");throw TypeError("ECDSA signature must be a Base64 string or a Buffer")}function n(e,t,r){for(var s=0;t+s<r&&0===e[t+s];)++s;return e[t+s]>=128&&--s,s}e.exports={derToJose:function(e,t){e=i(e);var r=o(t),n=r+1,a=e.length,l=0;if(48!==e[l++])throw Error('Could not find expected "seq"');var u=e[l++];if(129===u&&(u=e[l++]),a-l<u)throw Error('"seq" specified length of "'+u+'", only "'+(a-l)+'" remaining');if(2!==e[l++])throw Error('Could not find expected "int" for "r"');var c=e[l++];if(a-l-2<c)throw Error('"r" specified length of "'+c+'", only "'+(a-l-2)+'" available');if(n<c)throw Error('"r" specified length of "'+c+'", max of "'+n+'" is acceptable');var d=l;if(l+=c,2!==e[l++])throw Error('Could not find expected "int" for "s"');var p=e[l++];if(a-l!==p)throw Error('"s" specified length of "'+p+'", expected "'+(a-l)+'"');if(n<p)throw Error('"s" specified length of "'+p+'", max of "'+n+'" is acceptable');var f=l;if((l+=p)!==a)throw Error('Expected to consume entire buffer, but "'+(a-l)+'" bytes remain');var h=r-c,m=r-p,y=s.allocUnsafe(h+c+m+p);for(l=0;l<h;++l)y[l]=0;e.copy(y,l,d+Math.max(-h,0),d+c),l=r;for(var g=l;l<g+m;++l)y[l]=0;return e.copy(y,l,f+Math.max(-m,0),f+p),y=(y=y.toString("base64")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},joseToDer:function(e,t){e=i(e);var r=o(t),a=e.length;if(a!==2*r)throw TypeError('"'+t+'" signatures must be "'+2*r+'" bytes, saw "'+a+'"');var l=n(e,0,r),u=n(e,r,e.length),c=r-l,d=r-u,p=2+c+1+1+d,f=p<128,h=s.allocUnsafe((f?2:3)+p),m=0;return h[m++]=48,f?h[m++]=p:(h[m++]=129,h[m++]=255&p),h[m++]=2,h[m++]=c,l<0?(h[m++]=0,m+=e.copy(h,m,0,r)):m+=e.copy(h,m,l,r),h[m++]=2,h[m++]=d,u<0?(h[m++]=0,e.copy(h,m,r)):e.copy(h,m,r+u),h}}},2188(e){"use strict";function t(e){return(e/8|0)+ +(e%8!=0)}var r={ES256:t(256),ES384:t(384),ES512:t(521)};e.exports=function(e){var t=r[e];if(t)return t;throw Error('Unknown algorithm "'+e+'"')}},7371(e){"use strict";e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;if(Array.isArray(t)){if((s=t.length)!=r.length)return!1;for(o=s;0!=o--;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((s=(i=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(o=s;0!=o--;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=s;0!=o--;){var s,o,i,n=i[o];if(!e(t[n],r[n]))return!1}return!0}return t!=t&&r!=r}},9344(e,t,r){var s;function o(e,t,r){if("function"==typeof t&&(r=t,t={}),!r){if("function"!=typeof Promise)throw TypeError("callback not provided");return new Promise(function(r,s){o(e,t||{},function(e,t){e?s(e):r(t)})})}s(e,t||{},function(e,s){e&&("EACCES"===e.code||t&&t.ignoreErrors)&&(e=null,s=!1),r(e,s)})}r(9896),s="win32"===process.platform||global.TESTING_WINDOWS?r(8541):r(709),e.exports=o,o.sync=function(e,t){try{return s.sync(e,t||{})}catch(e){if(t&&t.ignoreErrors||"EACCES"===e.code)return!1;throw e}}},709(e,t,r){e.exports=o,o.sync=function(e,t){return i(s.statSync(e),t)};var s=r(9896);function o(e,t,r){s.stat(e,function(e,s){r(e,!e&&i(s,t))})}function i(e,t){var r,s,o,i,n,a,l,u,c;return e.isFile()&&(r=e,s=t,o=r.mode,i=r.uid,n=r.gid,a=void 0!==s.uid?s.uid:process.getuid&&process.getuid(),l=void 0!==s.gid?s.gid:process.getgid&&process.getgid(),u=parseInt("100",8),c=parseInt("010",8),o&parseInt("001",8)||o&c&&n===l||o&u&&i===a||o&(u|c)&&0===a)}},8541(e,t,r){e.exports=i,i.sync=function(e,t){return o(s.statSync(e),e,t)};var s=r(9896);function o(e,t,r){if(!e.isSymbolicLink()&&!e.isFile())return!1;var s=void 0!==r.pathExt?r.pathExt:process.env.PATHEXT;if(!s||-1!==(s=s.split(";")).indexOf(""))return!0;for(var o=0;o<s.length;o++){var i=s[o].toLowerCase();if(i&&t.substr(-i.length).toLowerCase()===i)return!0}return!1}function i(e,t,r){s.stat(e,function(s,i){r(s,!s&&o(i,e,t))})}},205(e){"use strict";var t=e.exports=function(e,r,s){"function"==typeof r&&(s=r,r={});var o="function"==typeof(s=r.cb||s)?s:s.pre||function(){};!function e(r,s,o,i,n,a,l,u,c,d){if(i&&"object"==typeof i&&!Array.isArray(i)){for(var p in s(i,n,a,l,u,c,d),i){var f=i[p];if(Array.isArray(f)){if(p in t.arrayKeywords)for(var h=0;h<f.length;h++)e(r,s,o,f[h],n+"/"+p+"/"+h,a,n,p,i,h)}else if(p in t.propsKeywords){if(f&&"object"==typeof f)for(var m in f)e(r,s,o,f[m],n+"/"+p+"/"+m.replace(/~/g,"~0").replace(/\//g,"~1"),a,n,p,i,m)}else(p in t.keywords||r.allKeys&&!(p in t.skipKeywords))&&e(r,s,o,f,n+"/"+p,a,n,p,i)}o(i,n,a,l,u,c,d)}}(r,o,s.post||function(){},e,"",e)};t.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},t.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},t.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},t.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}},2548(e,t,r){var s=r(3263);e.exports=function(e,t){t=t||{};var r=s.decode(e,t);if(!r)return null;var o=r.payload;if("string"==typeof o)try{var i=JSON.parse(o);null!==i&&"object"==typeof i&&(o=i)}catch(e){}return!0===t.complete?{header:r.header,payload:o,signature:r.signature}:o}},8400(e,t,r){e.exports={decode:r(2548),verify:r(6467),sign:r(9147),JsonWebTokenError:r(1957),NotBeforeError:r(4470),TokenExpiredError:r(7788)}},1957(e){var t=function(e,t){Error.call(this,e),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name="JsonWebTokenError",this.message=e,t&&(this.inner=t)};t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,e.exports=t},4470(e,t,r){var s=r(1957),o=function(e,t){s.call(this,e),this.name="NotBeforeError",this.date=t};o.prototype=Object.create(s.prototype),o.prototype.constructor=o,e.exports=o},7788(e,t,r){var s=r(1957),o=function(e,t){s.call(this,e),this.name="TokenExpiredError",this.expiredAt=t};o.prototype=Object.create(s.prototype),o.prototype.constructor=o,e.exports=o},5841(e,t,r){e.exports=r(3895).satisfies(process.version,">=15.7.0")},953(e,t,r){e.exports=r(3895).satisfies(process.version,"^6.12.0 || >=8.0.0")},455(e,t,r){e.exports=r(3895).satisfies(process.version,">=16.9.0")},4559(e,t,r){var s=r(3866);e.exports=function(e,t){var r=t||Math.floor(Date.now()/1e3);if("string"==typeof e){var o=s(e);if(void 0===o)return;return Math.floor(r+o/1e3)}if("number"==typeof e)return r+e}},723(e,t,r){let s=r(5841),o=r(455),i={ec:["ES256","ES384","ES512"],rsa:["RS256","PS256","RS384","PS384","RS512","PS512"],"rsa-pss":["PS256","PS384","PS512"]},n={ES256:"prime256v1",ES384:"secp384r1",ES512:"secp521r1"};e.exports=function(e,t){if(!e||!t)return;let r=t.asymmetricKeyType;if(!r)return;let a=i[r];if(!a)throw Error(`Unknown key type "${r}".`);if(!a.includes(e))throw Error(`"alg" parameter for "${r}" key type must be one of: ${a.join(", ")}.`);if(s)switch(r){case"ec":let l=t.asymmetricKeyDetails.namedCurve,u=n[e];if(l!==u)throw Error(`"alg" parameter "${e}" requires curve "${u}".`);break;case"rsa-pss":if(o){let r=parseInt(e.slice(-3),10),{hashAlgorithm:s,mgf1HashAlgorithm:o,saltLength:i}=t.asymmetricKeyDetails;if(s!==`sha${r}`||o!==s)throw Error(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${e}.`);if(void 0!==i&&i>r>>3)throw Error(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${e}.`)}}}},9147(e,t,r){let s=r(4559),o=r(953),i=r(723),n=r(3263),a=r(5357),l=r(6782),u=r(5250),c=r(8094),d=r(6052),p=r(1251),f=r(8430),{KeyObject:h,createSecretKey:m,createPrivateKey:y}=r(6982),g=["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512","none"];o&&g.splice(3,0,"PS256","PS384","PS512");let v={expiresIn:{isValid:function(e){return u(e)||p(e)&&e},message:'"expiresIn" should be a number of seconds or string representing a timespan'},notBefore:{isValid:function(e){return u(e)||p(e)&&e},message:'"notBefore" should be a number of seconds or string representing a timespan'},audience:{isValid:function(e){return p(e)||Array.isArray(e)},message:'"audience" must be a string or array'},algorithm:{isValid:a.bind(null,g),message:'"algorithm" must be a valid string enum value'},header:{isValid:d,message:'"header" must be an object'},encoding:{isValid:p,message:'"encoding" must be a string'},issuer:{isValid:p,message:'"issuer" must be a string'},subject:{isValid:p,message:'"subject" must be a string'},jwtid:{isValid:p,message:'"jwtid" must be a string'},noTimestamp:{isValid:l,message:'"noTimestamp" must be a boolean'},keyid:{isValid:p,message:'"keyid" must be a string'},mutatePayload:{isValid:l,message:'"mutatePayload" must be a boolean'},allowInsecureKeySizes:{isValid:l,message:'"allowInsecureKeySizes" must be a boolean'},allowInvalidAsymmetricKeyTypes:{isValid:l,message:'"allowInvalidAsymmetricKeyTypes" must be a boolean'}},_={iat:{isValid:c,message:'"iat" should be a number of seconds'},exp:{isValid:c,message:'"exp" should be a number of seconds'},nbf:{isValid:c,message:'"nbf" should be a number of seconds'}};function b(e,t,r,s){if(!d(r))throw Error('Expected "'+s+'" to be a plain object.');Object.keys(r).forEach(function(o){let i=e[o];if(!i){if(!t)throw Error('"'+o+'" is not allowed in "'+s+'"');return}if(!i.isValid(r[o]))throw Error(i.message)})}let w={audience:"aud",issuer:"iss",subject:"sub",jwtid:"jti"},$=["expiresIn","notBefore","noTimestamp","audience","issuer","subject","jwtid"];e.exports=function(e,t,r,o){var a,l;"function"==typeof r?(o=r,r={}):r=r||{};let u="object"==typeof e&&!Buffer.isBuffer(e),c=Object.assign({alg:r.algorithm||"HS256",typ:u?"JWT":void 0,kid:r.keyid},r.header);function d(e){if(o)return o(e);throw e}if(!t&&"none"!==r.algorithm)return d(Error("secretOrPrivateKey must have a value"));if(null!=t&&!(t instanceof h))try{t=y(t)}catch(e){try{t=m("string"==typeof t?Buffer.from(t):t)}catch(e){return d(Error("secretOrPrivateKey is not valid key material"))}}if(c.alg.startsWith("HS")&&"secret"!==t.type)return d(Error(`secretOrPrivateKey must be a symmetric key when using ${c.alg}`));if(/^(?:RS|PS|ES)/.test(c.alg)){if("private"!==t.type)return d(Error(`secretOrPrivateKey must be an asymmetric key when using ${c.alg}`));if(!r.allowInsecureKeySizes&&!c.alg.startsWith("ES")&&void 0!==t.asymmetricKeyDetails&&t.asymmetricKeyDetails.modulusLength<2048)return d(Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${c.alg}`))}if(void 0===e)return d(Error("payload is required"));if(u){try{a=e,b(_,!0,a,"payload")}catch(e){return d(e)}r.mutatePayload||(e=Object.assign({},e))}else{let t=$.filter(function(e){return void 0!==r[e]});if(t.length>0)return d(Error("invalid "+t.join(",")+" option for "+typeof e+" payload"))}if(void 0!==e.exp&&void 0!==r.expiresIn)return d(Error('Bad "options.expiresIn" option the payload already has an "exp" property.'));if(void 0!==e.nbf&&void 0!==r.notBefore)return d(Error('Bad "options.notBefore" option the payload already has an "nbf" property.'));try{l=r,b(v,!1,l,"options")}catch(e){return d(e)}if(!r.allowInvalidAsymmetricKeyTypes)try{i(c.alg,t)}catch(e){return d(e)}let p=e.iat||Math.floor(Date.now()/1e3);if(r.noTimestamp?delete e.iat:u&&(e.iat=p),void 0!==r.notBefore){try{e.nbf=s(r.notBefore,p)}catch(e){return d(e)}if(void 0===e.nbf)return d(Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}if(void 0!==r.expiresIn&&"object"==typeof e){try{e.exp=s(r.expiresIn,p)}catch(e){return d(e)}if(void 0===e.exp)return d(Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}Object.keys(w).forEach(function(t){let s=w[t];if(void 0!==r[t]){if(void 0!==e[s])return d(Error('Bad "options.'+t+'" option. The payload already has an "'+s+'" property.'));e[s]=r[t]}});let g=r.encoding||"utf8";if("function"==typeof o)o=o&&f(o),n.createSign({header:c,privateKey:t,payload:e,encoding:g}).once("error",o).once("done",function(e){if(!r.allowInsecureKeySizes&&/^(?:RS|PS)/.test(c.alg)&&e.length<256)return o(Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${c.alg}`));o(null,e)});else{let s=n.sign({header:c,payload:e,secret:t,encoding:g});if(!r.allowInsecureKeySizes&&/^(?:RS|PS)/.test(c.alg)&&s.length<256)throw Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${c.alg}`);return s}}},6467(e,t,r){let s=r(1957),o=r(4470),i=r(7788),n=r(2548),a=r(4559),l=r(723),u=r(953),c=r(3263),{KeyObject:d,createSecretKey:p,createPublicKey:f}=r(6982),h=["RS256","RS384","RS512"],m=["ES256","ES384","ES512"],y=["RS256","RS384","RS512"],g=["HS256","HS384","HS512"];u&&(h.splice(h.length,0,"PS256","PS384","PS512"),y.splice(y.length,0,"PS256","PS384","PS512")),e.exports=function(e,t,r,u){let v,_,b;if("function"!=typeof r||u||(u=r,r={}),r||(r={}),r=Object.assign({},r),v=u||function(e,t){if(e)throw e;return t},r.clockTimestamp&&"number"!=typeof r.clockTimestamp)return v(new s("clockTimestamp must be a number"));if(void 0!==r.nonce&&("string"!=typeof r.nonce||""===r.nonce.trim()))return v(new s("nonce must be a non-empty string"));if(void 0!==r.allowInvalidAsymmetricKeyTypes&&"boolean"!=typeof r.allowInvalidAsymmetricKeyTypes)return v(new s("allowInvalidAsymmetricKeyTypes must be a boolean"));let w=r.clockTimestamp||Math.floor(Date.now()/1e3);if(!e)return v(new s("jwt must be provided"));if("string"!=typeof e)return v(new s("jwt must be a string"));let $=e.split(".");if(3!==$.length)return v(new s("jwt malformed"));try{_=n(e,{complete:!0})}catch(e){return v(e)}if(!_)return v(new s("invalid token"));let E=_.header;if("function"==typeof t){if(!u)return v(new s("verify must be called asynchronous if secret or public key is provided as a callback"));b=t}else b=function(e,r){return r(null,t)};return b(E,function(t,n){let u;if(t)return v(new s("error in secret or public key callback: "+t.message));let b=""!==$[2].trim();if(!b&&n)return v(new s("jwt signature is required"));if(b&&!n)return v(new s("secret or public key must be provided"));if(!b&&!r.algorithms)return v(new s('please specify "none" in "algorithms" to verify unsigned tokens'));if(null!=n&&!(n instanceof d))try{n=f(n)}catch(e){try{n=p("string"==typeof n?Buffer.from(n):n)}catch(e){return v(new s("secretOrPublicKey is not valid key material"))}}if(r.algorithms||("secret"===n.type?r.algorithms=g:["rsa","rsa-pss"].includes(n.asymmetricKeyType)?r.algorithms=y:"ec"===n.asymmetricKeyType?r.algorithms=m:r.algorithms=h),-1===r.algorithms.indexOf(_.header.alg))return v(new s("invalid algorithm"));if(E.alg.startsWith("HS")&&"secret"!==n.type)return v(new s(`secretOrPublicKey must be a symmetric key when using ${E.alg}`));if(/^(?:RS|PS|ES)/.test(E.alg)&&"public"!==n.type)return v(new s(`secretOrPublicKey must be an asymmetric key when using ${E.alg}`));if(!r.allowInvalidAsymmetricKeyTypes)try{l(E.alg,n)}catch(e){return v(e)}try{u=c.verify(e,_.header.alg,n)}catch(e){return v(e)}if(!u)return v(new s("invalid signature"));let k=_.payload;if(void 0!==k.nbf&&!r.ignoreNotBefore){if("number"!=typeof k.nbf)return v(new s("invalid nbf value"));if(k.nbf>w+(r.clockTolerance||0))return v(new o("jwt not active",new Date(1e3*k.nbf)))}if(void 0!==k.exp&&!r.ignoreExpiration){if("number"!=typeof k.exp)return v(new s("invalid exp value"));if(w>=k.exp+(r.clockTolerance||0))return v(new i("jwt expired",new Date(1e3*k.exp)))}if(r.audience){let e=Array.isArray(r.audience)?r.audience:[r.audience];if(!(Array.isArray(k.aud)?k.aud:[k.aud]).some(function(t){return e.some(function(e){return e instanceof RegExp?e.test(t):e===t})}))return v(new s("jwt audience invalid. expected: "+e.join(" or ")))}if(r.issuer&&("string"==typeof r.issuer&&k.iss!==r.issuer||Array.isArray(r.issuer)&&-1===r.issuer.indexOf(k.iss)))return v(new s("jwt issuer invalid. expected: "+r.issuer));if(r.subject&&k.sub!==r.subject)return v(new s("jwt subject invalid. expected: "+r.subject));if(r.jwtid&&k.jti!==r.jwtid)return v(new s("jwt jwtid invalid. expected: "+r.jwtid));if(r.nonce&&k.nonce!==r.nonce)return v(new s("jwt nonce invalid. expected: "+r.nonce));if(r.maxAge){if("number"!=typeof k.iat)return v(new s("iat required when maxAge is specified"));let e=a(r.maxAge,k.iat);if(void 0===e)return v(new s('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));if(w>=e+(r.clockTolerance||0))return v(new i("maxAge exceeded",new Date(1e3*e)))}return!0===r.complete?v(null,{header:E,payload:k,signature:_.signature}):v(null,k)})}},2357(e,t,r){var s,o=r(6608).Buffer,i=r(6982),n=r(9053),a=r(9023),l="secret must be a string or buffer",u="key must be a string or a buffer",c="function"==typeof i.createPublicKey;function d(e){if(!o.isBuffer(e)&&"string"!=typeof e&&(!c||"object"!=typeof e||"string"!=typeof e.type||"string"!=typeof e.asymmetricKeyType||"function"!=typeof e.export))throw m(u)}function p(e){if(!o.isBuffer(e)&&"string"!=typeof e&&"object"!=typeof e)throw m("key must be a string, a buffer or an object")}function f(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function h(e){var t=4-(e=e.toString()).length%4;if(4!==t)for(var r=0;r<t;++r)e+="=";return e.replace(/\-/g,"+").replace(/_/g,"/")}function m(e){var t=[].slice.call(arguments,1);return TypeError(a.format.bind(a,e).apply(null,t))}function y(e){var t;return t=e,o.isBuffer(t)||"string"==typeof t||(e=JSON.stringify(e)),e}function g(e){return function(t,r){!function(e){if(!o.isBuffer(e)){if("string"!=typeof e){if(!c||"object"!=typeof e||"secret"!==e.type||"function"!=typeof e.export)throw m(l)}}}(r),t=y(t);var s=i.createHmac("sha"+e,r);return f((s.update(t),s.digest("base64")))}}c&&(u+=" or a KeyObject",l+="or a KeyObject");var v="timingSafeEqual"in i?function(e,t){return e.byteLength===t.byteLength&&i.timingSafeEqual(e,t)}:function(e,t){return s||(s=r(9454)),s(e,t)};function _(e){return function(t,r,s){var i=g(e)(t,s);return v(o.from(r),o.from(i))}}function b(e){return function(t,r){p(r),t=y(t);var s=i.createSign("RSA-SHA"+e);return f((s.update(t),s.sign(r,"base64")))}}function w(e){return function(t,r,s){d(s),t=y(t),r=h(r);var o=i.createVerify("RSA-SHA"+e);return o.update(t),o.verify(s,r,"base64")}}function $(e){return function(t,r){p(r),t=y(t);var s=i.createSign("RSA-SHA"+e);return f((s.update(t),s.sign({key:r,padding:i.constants.RSA_PKCS1_PSS_PADDING,saltLength:i.constants.RSA_PSS_SALTLEN_DIGEST},"base64")))}}function E(e){return function(t,r,s){d(s),t=y(t),r=h(r);var o=i.createVerify("RSA-SHA"+e);return o.update(t),o.verify({key:s,padding:i.constants.RSA_PKCS1_PSS_PADDING,saltLength:i.constants.RSA_PSS_SALTLEN_DIGEST},r,"base64")}}function k(e){var t=b(e);return function(){var r=t.apply(null,arguments);return n.derToJose(r,"ES"+e)}}function S(e){var t=w(e);return function(r,s,o){return t(r,s=n.joseToDer(s,"ES"+e).toString("base64"),o)}}function T(){return function(){return""}}function x(){return function(e,t){return""===t}}e.exports=function(e){var t=e.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/);if(!t)throw m('"%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".',e);var r=(t[1]||t[3]).toLowerCase(),s=t[2];return{sign:({hs:g,rs:b,ps:$,es:k,none:T})[r](s),verify:({hs:_,rs:w,ps:E,es:S,none:x})[r](s)}}},3263(e,t,r){var s=r(9615),o=r(6747);t.ALGORITHMS=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"],t.sign=s.sign,t.verify=o.verify,t.decode=o.decode,t.isValid=o.isValid,t.createSign=function(e){return new s(e)},t.createVerify=function(e){return new o(e)}},6360(e,t,r){var s=r(6608).Buffer,o=r(2203);function i(e){if(this.buffer=null,this.writable=!0,this.readable=!0,!e)return this.buffer=s.alloc(0),this;if("function"==typeof e.pipe)return this.buffer=s.alloc(0),e.pipe(this),this;if(e.length||"object"==typeof e)return this.buffer=e,this.writable=!1,process.nextTick((function(){this.emit("end",e),this.readable=!1,this.emit("close")}).bind(this)),this;throw TypeError("Unexpected data type ("+typeof e+")")}r(9023).inherits(i,o),i.prototype.write=function(e){this.buffer=s.concat([this.buffer,s.from(e)]),this.emit("data",e)},i.prototype.end=function(e){e&&this.write(e),this.emit("end",e),this.emit("close"),this.writable=!1,this.readable=!1},e.exports=i},9615(e,t,r){var s=r(6608).Buffer,o=r(6360),i=r(2357),n=r(2203),a=r(5911),l=r(9023);function u(e,t){return s.from(e,t).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function c(e){var t,r,s,o=e.header,n=e.payload,c=e.secret||e.privateKey,d=e.encoding,p=i(o.alg),f=(t=(t=d)||"utf8",r=u(a(o),"binary"),s=u(a(n),t),l.format("%s.%s",r,s)),h=p.sign(f,c);return l.format("%s.%s",f,h)}function d(e){var t=e.secret;if(t=null==(t=null==t?e.privateKey:t)?e.key:t,!0===/^hs/i.test(e.header.alg)&&null==t)throw TypeError("secret must be a string or buffer or a KeyObject");var r=new o(t);this.readable=!0,this.header=e.header,this.encoding=e.encoding,this.secret=this.privateKey=this.key=r,this.payload=new o(e.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))}l.inherits(d,n),d.prototype.sign=function(){try{var e=c({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",e),this.emit("data",e),this.emit("end"),this.readable=!1,e}catch(e){this.readable=!1,this.emit("error",e),this.emit("close")}},d.sign=c,e.exports=d},5911(e,t,r){var s=r(181).Buffer;e.exports=function(e){return"string"==typeof e?e:"number"==typeof e||s.isBuffer(e)?e.toString():JSON.stringify(e)}},6747(e,t,r){var s=r(6608).Buffer,o=r(6360),i=r(2357),n=r(2203),a=r(5911),l=r(9023),u=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function c(e){var t=e.split(".",1)[0],r=s.from(t,"base64").toString("binary");if("[object Object]"===Object.prototype.toString.call(r))return r;try{return JSON.parse(r)}catch(e){return}}function d(e){return e.split(".")[2]}function p(e){return u.test(e)&&!!c(e)}function f(e,t,r){if(!t){var s=Error("Missing algorithm parameter for jws.verify");throw s.code="MISSING_ALGORITHM",s}var o=d(e=a(e)),n=e.split(".",2).join(".");return i(t).verify(n,o,r)}function h(e,t){if(t=t||{},!p(e=a(e)))return null;var r,o,i=c(e);if(!i)return null;var n=(r=r||"utf8",o=e.split(".")[1],s.from(o,"base64").toString(r));return("JWT"===i.typ||t.json)&&(n=JSON.parse(n,t.encoding)),{header:i,payload:n,signature:d(e)}}function m(e){var t=(e=e||{}).secret;if(t=null==(t=null==t?e.publicKey:t)?e.key:t,!0===/^hs/i.test(e.algorithm)&&null==t)throw TypeError("secret must be a string or buffer or a KeyObject");var r=new o(t);this.readable=!0,this.algorithm=e.algorithm,this.encoding=e.encoding,this.secret=this.publicKey=this.key=r,this.signature=new o(e.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))}l.inherits(m,n),m.prototype.verify=function(){try{var e=f(this.signature.buffer,this.algorithm,this.key.buffer),t=h(this.signature.buffer,this.encoding);return this.emit("done",e,t),this.emit("data",e),this.emit("end"),this.readable=!1,e}catch(e){this.readable=!1,this.emit("error",e),this.emit("close")}},m.decode=h,m.isValid=p,m.verify=f,e.exports=m},5357(e){var t,r,s=1/0,o=0/0,i=/^\s+|\s+$/g,n=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=/^(?:0|[1-9]\d*)$/,c=parseInt;function d(e){return e!=e}var p=Object.prototype,f=p.hasOwnProperty,h=p.toString,m=p.propertyIsEnumerable,y=(t=Object.keys,r=Object,function(e){return t(r(e))}),g=Math.max,v=Array.isArray;function _(e){var t,r,s;return null!=e&&"number"==typeof(t=e.length)&&t>-1&&t%1==0&&t<=0x1fffffffffffff&&"[object Function]"!=(s=b(r=e)?h.call(r):"")&&"[object GeneratorFunction]"!=s}function b(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function w(e){return!!e&&"object"==typeof e}e.exports=function(e,t,r,$){e=_(e)?e:function(e){return e?function(e,t){for(var r=-1,s=e?e.length:0,o=Array(s);++r<s;)o[r]=t(e[r],r,e);return o}(_(e)?function(e,t){var r,s,o,i,n=v(e)||w(s=r=e)&&_(s)&&f.call(r,"callee")&&(!m.call(r,"callee")||"[object Arguments]"==h.call(r))?function(e,t){for(var r=-1,s=Array(e);++r<e;)s[r]=t(r);return s}(e.length,String):[],a=n.length,l=!!a;for(var c in e){f.call(e,c)&&!(l&&("length"==c||(o=c,(i=null==(i=a)?0x1fffffffffffff:i)&&("number"==typeof o||u.test(o))&&o>-1&&o%1==0&&o<i)))&&n.push(c)}return n}(e):function(e){if(r=(t=e)&&t.constructor,t!==("function"==typeof r&&r.prototype||p))return y(e);var t,r,s=[];for(var o in Object(e))f.call(e,o)&&"constructor"!=o&&s.push(o);return s}(e),function(t){return e[t]}):[]}(e),r=r&&!$?(S=(k=(E=r)?(E=function(e){if("number"==typeof e)return e;if("symbol"==typeof(t=e)||w(t)&&"[object Symbol]"==h.call(t))return o;if(b(e)){var t,r="function"==typeof e.valueOf?e.valueOf():e;e=b(r)?r+"":r}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(i,"");var s=a.test(e);return s||l.test(e)?c(e.slice(2),s?2:8):n.test(e)?o:+e}(E))===s||E===-s?(E<0?-1:1)*17976931348623157e292:E==E?E:0:0===E?E:0)%1,k==k?S?k-S:k:0):0;var E,k,S,T,x=e.length;return r<0&&(r=g(x+r,0)),"string"==typeof(T=e)||!v(T)&&w(T)&&"[object String]"==h.call(T)?r<=x&&e.indexOf(t,r)>-1:!!x&&function(e,t,r){if(t!=t){for(var s=e.length,o=r+-1;++o<s;)if(d(e[o],o,e))return o;return -1}for(var i=r-1,n=e.length;++i<n;)if(e[i]===t)return i;return -1}(e,t,r)>-1}},6782(e){var t=Object.prototype.toString;e.exports=function(e){var r;return!0===e||!1===e||!!(r=e)&&"object"==typeof r&&"[object Boolean]"==t.call(e)}},5250(e){var t=1/0,r=0/0,s=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,n=/^0o[0-7]+$/i,a=parseInt,l=Object.prototype.toString;function u(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}e.exports=function(e){var c,d,p;return"number"==typeof e&&e==(p=(d=(c=e)?(c=function(e){if("number"==typeof e)return e;if("symbol"==typeof(t=e)||t&&"object"==typeof t&&"[object Symbol]"==l.call(t))return r;if(u(e)){var t,c="function"==typeof e.valueOf?e.valueOf():e;e=u(c)?c+"":c}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(s,"");var d=i.test(e);return d||n.test(e)?a(e.slice(2),d?2:8):o.test(e)?r:+e}(c))===t||c===-t?(c<0?-1:1)*17976931348623157e292:c==c?c:0:0===c?c:0)%1,d==d?p?d-p:d:0)}},8094(e){var t=Object.prototype.toString;e.exports=function(e){return"number"==typeof e||!!e&&"object"==typeof e&&"[object Number]"==t.call(e)}},6052(e){var t,r,s=Object.prototype,o=Function.prototype.toString,i=s.hasOwnProperty,n=o.call(Object),a=s.toString,l=(t=Object.getPrototypeOf,r=Object,function(e){return t(r(e))});e.exports=function(e){if(!(e&&"object"==typeof e)||"[object Object]"!=a.call(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e))return!1;var t=l(e);if(null===t)return!0;var r=i.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&o.call(r)==n}},1251(e){var t=Object.prototype.toString,r=Array.isArray;e.exports=function(e){var s;return"string"==typeof e||!r(e)&&!!(s=e)&&"object"==typeof s&&"[object String]"==t.call(e)}},8430(e){var t=1/0,r=0/0,s=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,n=/^0o[0-7]+$/i,a=parseInt,l=Object.prototype.toString;function u(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}e.exports=function(e){var c,d,p,f,h=2,m=e;if("function"!=typeof m)throw TypeError("Expected a function");return p=(d=(c=h)?(c=function(e){if("number"==typeof e)return e;if("symbol"==typeof(t=e)||t&&"object"==typeof t&&"[object Symbol]"==l.call(t))return r;if(u(e)){var t,c="function"==typeof e.valueOf?e.valueOf():e;e=u(c)?c+"":c}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(s,"");var d=i.test(e);return d||n.test(e)?a(e.slice(2),d?2:8):o.test(e)?r:+e}(c))===t||c===-t?(c<0?-1:1)*17976931348623157e292:c==c?c:0:0===c?c:0)%1,h=d==d?p?d-p:d:0,function(){return--h>0&&(f=m.apply(this,arguments)),h<=1&&(m=void 0),f}}},3866(e){function t(e,t,r,s){return Math.round(e/r)+" "+s+(t>=1.5*r?"s":"")}e.exports=function(e,r){r=r||{};var s,o,i,n,a=typeof e;if("string"===a&&e.length>0){var l=e;if(!((l=String(l)).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(l);if(u){var c=parseFloat(u[1]);switch((u[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*c;case"weeks":case"week":case"w":return 6048e5*c;case"days":case"day":case"d":return 864e5*c;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*c;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*c;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*c;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:break}}}return}if("number"===a&&isFinite(e)){return r.long?(o=Math.abs(s=e))>=864e5?t(s,o,864e5,"day"):o>=36e5?t(s,o,36e5,"hour"):o>=6e4?t(s,o,6e4,"minute"):o>=1e3?t(s,o,1e3,"second"):s+" ms":(n=Math.abs(i=e))>=864e5?Math.round(i/864e5)+"d":n>=36e5?Math.round(i/36e5)+"h":n>=6e4?Math.round(i/6e4)+"m":n>=1e3?Math.round(i/1e3)+"s":i+"ms"}throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},9695(e){"use strict";let t=(e={})=>{let t=e.env||process.env;return"win32"!==(e.platform||process.platform)?"PATH":Object.keys(t).reverse().find(e=>"PATH"===e.toUpperCase())||"Path"};e.exports=t,e.exports.default=t},6608(e,t,r){var s=r(181),o=s.Buffer;function i(e,t){for(var r in e)t[r]=e[r]}function n(e,t,r){return o(e,t,r)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=s:(i(s,t),t.Buffer=n),n.prototype=Object.create(o.prototype),i(o,n),n.from=function(e,t,r){if("number"==typeof e)throw TypeError("Argument must not be a number");return o(e,t,r)},n.alloc=function(e,t,r){if("number"!=typeof e)throw TypeError("Argument must be a number");var s=o(e);return void 0!==t?"string"==typeof r?s.fill(t,r):s.fill(t):s.fill(0),s},n.allocUnsafe=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return o(e)},n.allocUnsafeSlow=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return s.SlowBuffer(e)}},8610(e,t,r){"use strict";let s=Symbol("SemVer ANY");class o{static get ANY(){return s}constructor(e,t){if(t=i(t),e instanceof o)if(!!t.loose===e.loose)return e;else e=e.value;u("comparator",e=e.trim().split(/\s+/).join(" "),t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===s?this.value="":this.value=this.operator+this.semver.version,u("comp",this)}parse(e){let t=this.options.loose?n[a.COMPARATORLOOSE]:n[a.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new c(r[2],this.options.loose):this.semver=s}toString(){return this.value}test(e){if(u("Comparator.test",e,this.options.loose),this.semver===s||e===s)return!0;if("string"==typeof e)try{e=new c(e,this.options)}catch(e){return!1}return l(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof o))throw TypeError("a Comparator is required");return""===this.operator?""===this.value||new d(e.value,t).test(this.value):""===e.operator?""===e.value||new d(this.value,t).test(e.semver):!((t=i(t)).includePrerelease&&("<0.0.0-0"===this.value||"<0.0.0-0"===e.value)||!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))&&!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||l(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||l(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">"))}}e.exports=o;let i=r(4621),{safeRe:n,t:a}=r(152),l=r(5461),u=r(674),c=r(2398),d=r(2069)},2069(e,t,r){"use strict";let s=/\s+/g;class o{constructor(e,t){if(t=n(t),e instanceof o)if(!!t.loose===e.loose&&!!t.includePrerelease===e.includePrerelease)return e;else return new o(e.raw,t);if(e instanceof a)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(s," "),this.set=this.raw.split("||").map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter(e=>!g(e[0])),0===this.set.length)this.set=[e];else if(this.set.length>1){for(const e of this.set)if(1===e.length&&v(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(void 0===this.formatted){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=" "),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=((this.options.includePrerelease&&m)|(this.options.loose&&y))+":"+e,r=i.get(t);if(r)return r;let s=this.options.loose,o=s?c[d.HYPHENRANGELOOSE]:c[d.HYPHENRANGE];l("hyphen replace",e=e.replace(o,I(this.options.includePrerelease))),l("comparator trim",e=e.replace(c[d.COMPARATORTRIM],p)),l("tilde trim",e=e.replace(c[d.TILDETRIM],f)),l("caret trim",e=e.replace(c[d.CARETTRIM],h));let n=e.split(" ").map(e=>b(e,this.options)).join(" ").split(/\s+/).map(e=>O(e,this.options));s&&(n=n.filter(e=>(l("loose invalid filter",e,this.options),!!e.match(c[d.COMPARATORLOOSE])))),l("range list",n);let u=new Map;for(let e of n.map(e=>new a(e,this.options))){if(g(e))return[e];u.set(e.value,e)}u.size>1&&u.has("")&&u.delete("");let v=[...u.values()];return i.set(t,v),v}intersects(e,t){if(!(e instanceof o))throw TypeError("a Range is required");return this.set.some(r=>_(r,t)&&e.set.some(e=>_(e,t)&&r.every(r=>e.every(e=>r.intersects(e,t)))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new u(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(j(this.set[t],e,this.options))return!0;return!1}}e.exports=o;let i=new(r(2044)),n=r(4621),a=r(8610),l=r(674),u=r(2398),{safeRe:c,t:d,comparatorTrimReplace:p,tildeTrimReplace:f,caretTrimReplace:h}=r(152),{FLAG_INCLUDE_PRERELEASE:m,FLAG_LOOSE:y}=r(5076),g=e=>"<0.0.0-0"===e.value,v=e=>""===e.value,_=(e,t)=>{let r=!0,s=e.slice(),o=s.pop();for(;r&&s.length;)r=s.every(e=>o.intersects(e,t)),o=s.pop();return r},b=(e,t)=>(l("comp",e=e.replace(c[d.BUILD],""),t),l("caret",e=k(e,t)),l("tildes",e=$(e,t)),l("xrange",e=T(e,t)),l("stars",e=P(e,t)),e),w=e=>!e||"x"===e.toLowerCase()||"*"===e,$=(e,t)=>e.trim().split(/\s+/).map(e=>E(e,t)).join(" "),E=(e,t)=>{let r=t.loose?c[d.TILDELOOSE]:c[d.TILDE];return e.replace(r,(t,r,s,o,i)=>{let n;return l("tilde",e,t,r,s,o,i),w(r)?n="":w(s)?n=`>=${r}.0.0 <${+r+1}.0.0-0`:w(o)?n=`>=${r}.${s}.0 <${r}.${+s+1}.0-0`:i?(l("replaceTilde pr",i),n=`>=${r}.${s}.${o}-${i} <${r}.${+s+1}.0-0`):n=`>=${r}.${s}.${o} <${r}.${+s+1}.0-0`,l("tilde return",n),n})},k=(e,t)=>e.trim().split(/\s+/).map(e=>S(e,t)).join(" "),S=(e,t)=>{l("caret",e,t);let r=t.loose?c[d.CARETLOOSE]:c[d.CARET],s=t.includePrerelease?"-0":"";return e.replace(r,(t,r,o,i,n)=>{let a;return l("caret",e,t,r,o,i,n),w(r)?a="":w(o)?a=`>=${r}.0.0${s} <${+r+1}.0.0-0`:w(i)?a="0"===r?`>=${r}.${o}.0${s} <${r}.${+o+1}.0-0`:`>=${r}.${o}.0${s} <${+r+1}.0.0-0`:n?(l("replaceCaret pr",n),a="0"===r?"0"===o?`>=${r}.${o}.${i}-${n} <${r}.${o}.${+i+1}-0`:`>=${r}.${o}.${i}-${n} <${r}.${+o+1}.0-0`:`>=${r}.${o}.${i}-${n} <${+r+1}.0.0-0`):(l("no pr"),a="0"===r?"0"===o?`>=${r}.${o}.${i}${s} <${r}.${o}.${+i+1}-0`:`>=${r}.${o}.${i}${s} <${r}.${+o+1}.0-0`:`>=${r}.${o}.${i} <${+r+1}.0.0-0`),l("caret return",a),a})},T=(e,t)=>(l("replaceXRanges",e,t),e.split(/\s+/).map(e=>x(e,t)).join(" ")),x=(e,t)=>{e=e.trim();let r=t.loose?c[d.XRANGELOOSE]:c[d.XRANGE];return e.replace(r,(r,s,o,i,n,a)=>{l("xRange",e,r,s,o,i,n,a);let u=w(o),c=u||w(i),d=c||w(n);return"="===s&&d&&(s=""),a=t.includePrerelease?"-0":"",u?r=">"===s||"<"===s?"<0.0.0-0":"*":s&&d?(c&&(i=0),n=0,">"===s?(s=">=",c?(o=+o+1,i=0):i=+i+1,n=0):"<="===s&&(s="<",c?o=+o+1:i=+i+1),"<"===s&&(a="-0"),r=`${s+o}.${i}.${n}${a}`):c?r=`>=${o}.0.0${a} <${+o+1}.0.0-0`:d&&(r=`>=${o}.${i}.0${a} <${o}.${+i+1}.0-0`),l("xRange return",r),r})},P=(e,t)=>(l("replaceStars",e,t),e.trim().replace(c[d.STAR],"")),O=(e,t)=>(l("replaceGTE0",e,t),e.trim().replace(c[t.includePrerelease?d.GTE0PRE:d.GTE0],"")),I=e=>(t,r,s,o,i,n,a,l,u,c,d,p)=>(r=w(s)?"":w(o)?`>=${s}.0.0${e?"-0":""}`:w(i)?`>=${s}.${o}.0${e?"-0":""}`:n?`>=${r}`:`>=${r}${e?"-0":""}`,l=w(u)?"":w(c)?`<${+u+1}.0.0-0`:w(d)?`<${u}.${+c+1}.0-0`:p?`<=${u}.${c}.${d}-${p}`:e?`<${u}.${c}.${+d+1}-0`:`<=${l}`,`${r} ${l}`.trim()),j=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(l(e[r].semver),e[r].semver!==a.ANY&&e[r].semver.prerelease.length>0){let s=e[r].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}return!1}return!0}},2398(e,t,r){"use strict";let s=r(674),{MAX_LENGTH:o,MAX_SAFE_INTEGER:i}=r(5076),{safeRe:n,t:a}=r(152),l=r(4621),{compareIdentifiers:u}=r(9101);class c{constructor(e,t){if(t=l(t),e instanceof c)if(!!t.loose===e.loose&&!!t.includePrerelease===e.includePrerelease)return e;else e=e.version;else if("string"!=typeof e)throw TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>o)throw TypeError(`version is longer than ${o} characters`);s("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const r=e.trim().match(t.loose?n[a.LOOSE]:n[a.FULL]);if(!r)throw TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>i||this.major<0)throw TypeError("Invalid major version");if(this.minor>i||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>i||this.patch<0)throw TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<i)return t}return e}):this.prerelease=[],this.build=r[5]?r[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(e){if(s("SemVer.compare",this.version,this.options,e),!(e instanceof c)){if("string"==typeof e&&e===this.version)return 0;e=new c(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return(e instanceof c||(e=new c(e,this.options)),this.major<e.major)?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:+(this.patch>e.patch)}comparePre(e){if(e instanceof c||(e=new c(e,this.options)),this.prerelease.length&&!e.prerelease.length)return -1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],o=e.prerelease[t];if(s("prerelease compare",t,r,o),void 0===r&&void 0===o)return 0;if(void 0===o)return 1;if(void 0===r)return -1;else if(r===o)continue;else return u(r,o)}while(++t)}compareBuild(e){e instanceof c||(e=new c(e,this.options));let t=0;do{let r=this.build[t],o=e.build[t];if(s("build compare",t,r,o),void 0===r&&void 0===o)return 0;if(void 0===o)return 1;if(void 0===r)return -1;else if(r===o)continue;else return u(r,o)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&!1===r)throw Error("invalid increment argument: identifier is empty");if(t){let e=`-${t}`.match(this.options.loose?n[a.PRERELEASELOOSE]:n[a.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,r),this.inc("pre",t,r);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 e=+!!Number(r);if(0===this.prerelease.length)this.prerelease=[e];else{let s=this.prerelease.length;for(;--s>=0;)"number"==typeof this.prerelease[s]&&(this.prerelease[s]++,s=-2);if(-1===s){if(t===this.prerelease.join(".")&&!1===r)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let s=[t,e];!1===r&&(s=[t]),0===u(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}e.exports=c},5608(e,t,r){"use strict";let s=r(6802);e.exports=(e,t)=>{let r=s(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null}},5461(e,t,r){"use strict";let s=r(8271),o=r(733),i=r(1686),n=r(6479),a=r(7257),l=r(5850);e.exports=(e,t,r,u)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return s(e,r,u);case"!=":return o(e,r,u);case">":return i(e,r,u);case">=":return n(e,r,u);case"<":return a(e,r,u);case"<=":return l(e,r,u);default:throw TypeError(`Invalid operator: ${t}`)}}},7771(e,t,r){"use strict";let s=r(2398),o=r(6802),{safeRe:i,t:n}=r(152);e.exports=(e,t)=>{if(e instanceof s)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){let s,o=t.includePrerelease?i[n.COERCERTLFULL]:i[n.COERCERTL];for(;(s=o.exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&s.index+s[0].length===r.index+r[0].length||(r=s),o.lastIndex=s.index+s[1].length+s[2].length;o.lastIndex=-1}else r=e.match(t.includePrerelease?i[n.COERCEFULL]:i[n.COERCE]);if(null===r)return null;let a=r[2],l=r[3]||"0",u=r[4]||"0",c=t.includePrerelease&&r[5]?`-${r[5]}`:"",d=t.includePrerelease&&r[6]?`+${r[6]}`:"";return o(`${a}.${l}.${u}${c}${d}`,t)}},8767(e,t,r){"use strict";let s=r(2398);e.exports=(e,t,r)=>{let o=new s(e,r),i=new s(t,r);return o.compare(i)||o.compareBuild(i)}},6293(e,t,r){"use strict";let s=r(6958);e.exports=(e,t)=>s(e,t,!0)},6958(e,t,r){"use strict";let s=r(2398);e.exports=(e,t,r)=>new s(e,r).compare(new s(t,r))},3086(e,t,r){"use strict";let s=r(6802);e.exports=(e,t)=>{let r=s(e,null,!0),o=s(t,null,!0),i=r.compare(o);if(0===i)return null;let n=i>0,a=n?r:o,l=n?o:r,u=!!a.prerelease.length;if(l.prerelease.length&&!u){if(!l.patch&&!l.minor)return"major";if(0===l.compareMain(a))return l.minor&&!l.patch?"minor":"patch"}let c=u?"pre":"";return r.major!==o.major?c+"major":r.minor!==o.minor?c+"minor":r.patch!==o.patch?c+"patch":"prerelease"}},8271(e,t,r){"use strict";let s=r(6958);e.exports=(e,t,r)=>0===s(e,t,r)},1686(e,t,r){"use strict";let s=r(6958);e.exports=(e,t,r)=>s(e,t,r)>0},6479(e,t,r){"use strict";let s=r(6958);e.exports=(e,t,r)=>s(e,t,r)>=0},3625(e,t,r){"use strict";let s=r(2398);e.exports=(e,t,r,o,i)=>{"string"==typeof r&&(i=o,o=r,r=void 0);try{return new s(e instanceof s?e.version:e,r).inc(t,o,i).version}catch(e){return null}}},7257(e,t,r){"use strict";let s=r(6958);e.exports=(e,t,r)=>0>s(e,t,r)},5850(e,t,r){"use strict";let s=r(6958);e.exports=(e,t,r)=>0>=s(e,t,r)},7744(e,t,r){"use strict";let s=r(2398);e.exports=(e,t)=>new s(e,t).major},4812(e,t,r){"use strict";let s=r(2398);e.exports=(e,t)=>new s(e,t).minor},733(e,t,r){"use strict";let s=r(6958);e.exports=(e,t,r)=>0!==s(e,t,r)},6802(e,t,r){"use strict";let s=r(2398);e.exports=(e,t,r=!1)=>{if(e instanceof s)return e;try{return new s(e,t)}catch(e){if(!r)return null;throw e}}},8643(e,t,r){"use strict";let s=r(2398);e.exports=(e,t)=>new s(e,t).patch},9283(e,t,r){"use strict";let s=r(6802);e.exports=(e,t)=>{let r=s(e,t);return r&&r.prerelease.length?r.prerelease:null}},7032(e,t,r){"use strict";let s=r(6958);e.exports=(e,t,r)=>s(t,e,r)},9839(e,t,r){"use strict";let s=r(8767);e.exports=(e,t)=>e.sort((e,r)=>s(r,e,t))},4056(e,t,r){"use strict";let s=r(2069);e.exports=(e,t,r)=>{try{t=new s(t,r)}catch(e){return!1}return t.test(e)}},7697(e,t,r){"use strict";let s=r(8767);e.exports=(e,t)=>e.sort((e,r)=>s(e,r,t))},6807(e,t,r){"use strict";let s=r(6802);e.exports=(e,t)=>{let r=s(e,t);return r?r.version:null}},3895(e,t,r){"use strict";let s=r(152),o=r(5076),i=r(2398),n=r(9101),a=r(6802),l=r(6807),u=r(5608),c=r(3625),d=r(3086),p=r(7744),f=r(4812),h=r(8643),m=r(9283),y=r(6958),g=r(7032),v=r(6293),_=r(8767),b=r(7697),w=r(9839),$=r(1686),E=r(7257),k=r(8271),S=r(733),T=r(6479),x=r(5850),P=r(5461),O=r(7771),I=r(8610),j=r(2069),R=r(4056),N=r(6613),z=r(7114),C=r(1008),A=r(203),M=r(5372),D=r(4713),L=r(4497),q=r(9272),U=r(3490);e.exports={parse:a,valid:l,clean:u,inc:c,diff:d,major:p,minor:f,patch:h,prerelease:m,compare:y,rcompare:g,compareLoose:v,compareBuild:_,sort:b,rsort:w,gt:$,lt:E,eq:k,neq:S,gte:T,lte:x,cmp:P,coerce:O,Comparator:I,Range:j,satisfies:R,toComparators:N,maxSatisfying:z,minSatisfying:C,minVersion:A,validRange:M,outside:D,gtr:L,ltr:q,intersects:U,simplifyRange:r(4039),subset:r(22),SemVer:i,re:s.re,src:s.src,tokens:s.t,SEMVER_SPEC_VERSION:o.SEMVER_SPEC_VERSION,RELEASE_TYPES:o.RELEASE_TYPES,compareIdentifiers:n.compareIdentifiers,rcompareIdentifiers:n.rcompareIdentifiers}},5076(e){"use strict";e.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(e){"use strict";e.exports="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{}},9101(e){"use strict";let t=/^[0-9]+$/,r=(e,r)=>{if("number"==typeof e&&"number"==typeof r)return e===r?0:e<r?-1:1;let s=t.test(e),o=t.test(r);return s&&o&&(e*=1,r*=1),e===r?0:s&&!o?-1:o&&!s?1:e<r?-1:1};e.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}},2044(e){"use strict";e.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(void 0!==t)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&void 0!==t){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}},4621(e){"use strict";let t=Object.freeze({loose:!0}),r=Object.freeze({});e.exports=e=>e?"object"!=typeof e?t:e:r},152(e,t,r){"use strict";let{MAX_SAFE_COMPONENT_LENGTH:s,MAX_SAFE_BUILD_LENGTH:o,MAX_LENGTH:i}=r(5076),n=r(674),a=(t=e.exports={}).re=[],l=t.safeRe=[],u=t.src=[],c=t.safeSrc=[],d=t.t={},p=0,f="[a-zA-Z0-9-]",h=[["\\s",1],["\\d",i],[f,o]],m=(e,t,r)=>{let s=(e=>{for(let[t,r]of h)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),o=p++;n(e,o,t),d[e]=o,u[o]=t,c[o]=s,a[o]=new RegExp(t,r?"g":void 0),l[o]=new RegExp(s,r?"g":void 0)};m("NUMERICIDENTIFIER","0|[1-9]\\d*"),m("NUMERICIDENTIFIERLOOSE","\\d+"),m("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f}*`),m("MAINVERSION",`(${u[d.NUMERICIDENTIFIER]})\\.(${u[d.NUMERICIDENTIFIER]})\\.(${u[d.NUMERICIDENTIFIER]})`),m("MAINVERSIONLOOSE",`(${u[d.NUMERICIDENTIFIERLOOSE]})\\.(${u[d.NUMERICIDENTIFIERLOOSE]})\\.(${u[d.NUMERICIDENTIFIERLOOSE]})`),m("PRERELEASEIDENTIFIER",`(?:${u[d.NONNUMERICIDENTIFIER]}|${u[d.NUMERICIDENTIFIER]})`),m("PRERELEASEIDENTIFIERLOOSE",`(?:${u[d.NONNUMERICIDENTIFIER]}|${u[d.NUMERICIDENTIFIERLOOSE]})`),m("PRERELEASE",`(?:-(${u[d.PRERELEASEIDENTIFIER]}(?:\\.${u[d.PRERELEASEIDENTIFIER]})*))`),m("PRERELEASELOOSE",`(?:-?(${u[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[d.PRERELEASEIDENTIFIERLOOSE]})*))`),m("BUILDIDENTIFIER",`${f}+`),m("BUILD",`(?:\\+(${u[d.BUILDIDENTIFIER]}(?:\\.${u[d.BUILDIDENTIFIER]})*))`),m("FULLPLAIN",`v?${u[d.MAINVERSION]}${u[d.PRERELEASE]}?${u[d.BUILD]}?`),m("FULL",`^${u[d.FULLPLAIN]}$`),m("LOOSEPLAIN",`[v=\\s]*${u[d.MAINVERSIONLOOSE]}${u[d.PRERELEASELOOSE]}?${u[d.BUILD]}?`),m("LOOSE",`^${u[d.LOOSEPLAIN]}$`),m("GTLT","((?:<|>)?=?)"),m("XRANGEIDENTIFIERLOOSE",`${u[d.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),m("XRANGEIDENTIFIER",`${u[d.NUMERICIDENTIFIER]}|x|X|\\*`),m("XRANGEPLAIN",`[v=\\s]*(${u[d.XRANGEIDENTIFIER]})(?:\\.(${u[d.XRANGEIDENTIFIER]})(?:\\.(${u[d.XRANGEIDENTIFIER]})(?:${u[d.PRERELEASE]})?${u[d.BUILD]}?)?)?`),m("XRANGEPLAINLOOSE",`[v=\\s]*(${u[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[d.XRANGEIDENTIFIERLOOSE]})(?:${u[d.PRERELEASELOOSE]})?${u[d.BUILD]}?)?)?`),m("XRANGE",`^${u[d.GTLT]}\\s*${u[d.XRANGEPLAIN]}$`),m("XRANGELOOSE",`^${u[d.GTLT]}\\s*${u[d.XRANGEPLAINLOOSE]}$`),m("COERCEPLAIN",`(^|[^\\d])(\\d{1,${s}})(?:\\.(\\d{1,${s}}))?(?:\\.(\\d{1,${s}}))?`),m("COERCE",`${u[d.COERCEPLAIN]}(?:$|[^\\d])`),m("COERCEFULL",u[d.COERCEPLAIN]+`(?:${u[d.PRERELEASE]})?`+`(?:${u[d.BUILD]})?`+"(?:$|[^\\d])"),m("COERCERTL",u[d.COERCE],!0),m("COERCERTLFULL",u[d.COERCEFULL],!0),m("LONETILDE","(?:~>?)"),m("TILDETRIM",`(\\s*)${u[d.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",m("TILDE",`^${u[d.LONETILDE]}${u[d.XRANGEPLAIN]}$`),m("TILDELOOSE",`^${u[d.LONETILDE]}${u[d.XRANGEPLAINLOOSE]}$`),m("LONECARET","(?:\\^)"),m("CARETTRIM",`(\\s*)${u[d.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",m("CARET",`^${u[d.LONECARET]}${u[d.XRANGEPLAIN]}$`),m("CARETLOOSE",`^${u[d.LONECARET]}${u[d.XRANGEPLAINLOOSE]}$`),m("COMPARATORLOOSE",`^${u[d.GTLT]}\\s*(${u[d.LOOSEPLAIN]})$|^$`),m("COMPARATOR",`^${u[d.GTLT]}\\s*(${u[d.FULLPLAIN]})$|^$`),m("COMPARATORTRIM",`(\\s*)${u[d.GTLT]}\\s*(${u[d.LOOSEPLAIN]}|${u[d.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",m("HYPHENRANGE",`^\\s*(${u[d.XRANGEPLAIN]})\\s+-\\s+(${u[d.XRANGEPLAIN]})\\s*$`),m("HYPHENRANGELOOSE",`^\\s*(${u[d.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[d.XRANGEPLAINLOOSE]})\\s*$`),m("STAR","(<|>)?=?\\s*\\*"),m("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),m("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")},4497(e,t,r){"use strict";let s=r(4713);e.exports=(e,t,r)=>s(e,t,">",r)},3490(e,t,r){"use strict";let s=r(2069);e.exports=(e,t,r)=>(e=new s(e,r),t=new s(t,r),e.intersects(t,r))},9272(e,t,r){"use strict";let s=r(4713);e.exports=(e,t,r)=>s(e,t,"<",r)},7114(e,t,r){"use strict";let s=r(2398),o=r(2069);e.exports=(e,t,r)=>{let i=null,n=null,a=null;try{a=new o(t,r)}catch(e){return null}return e.forEach(e=>{a.test(e)&&(!i||-1===n.compare(e))&&(n=new s(i=e,r))}),i}},1008(e,t,r){"use strict";let s=r(2398),o=r(2069);e.exports=(e,t,r)=>{let i=null,n=null,a=null;try{a=new o(t,r)}catch(e){return null}return e.forEach(e=>{a.test(e)&&(!i||1===n.compare(e))&&(n=new s(i=e,r))}),i}},203(e,t,r){"use strict";let s=r(2398),o=r(2069),i=r(1686);e.exports=(e,t)=>{e=new o(e,t);let r=new s("0.0.0");if(e.test(r)||(r=new s("0.0.0-0"),e.test(r)))return r;r=null;for(let t=0;t<e.set.length;++t){let o=e.set[t],n=null;o.forEach(e=>{let t=new s(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":(!n||i(t,n))&&(n=t);break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${e.operator}`)}}),n&&(!r||i(r,n))&&(r=n)}return r&&e.test(r)?r:null}},4713(e,t,r){"use strict";let s=r(2398),o=r(8610),{ANY:i}=o,n=r(2069),a=r(4056),l=r(1686),u=r(7257),c=r(5850),d=r(6479);e.exports=(e,t,r,p)=>{let f,h,m,y,g;switch(e=new s(e,p),t=new n(t,p),r){case">":f=l,h=c,m=u,y=">",g=">=";break;case"<":f=u,h=d,m=l,y="<",g="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(a(e,t,p))return!1;for(let r=0;r<t.set.length;++r){let s=t.set[r],n=null,a=null;if(s.forEach(e=>{e.semver===i&&(e=new o(">=0.0.0")),n=n||e,a=a||e,f(e.semver,n.semver,p)?n=e:m(e.semver,a.semver,p)&&(a=e)}),n.operator===y||n.operator===g||(!a.operator||a.operator===y)&&h(e,a.semver)||a.operator===g&&m(e,a.semver))return!1}return!0}},4039(e,t,r){"use strict";let s=r(4056),o=r(6958);e.exports=(e,t,r)=>{let i=[],n=null,a=null,l=e.sort((e,t)=>o(e,t,r));for(let e of l)s(e,t,r)?(a=e,n||(n=e)):(a&&i.push([n,a]),a=null,n=null);n&&i.push([n,null]);let u=[];for(let[e,t]of i)e===t?u.push(e):t||e!==l[0]?t?e===l[0]?u.push(`<=${t}`):u.push(`${e} - ${t}`):u.push(`>=${e}`):u.push("*");let c=u.join(" || "),d="string"==typeof t.raw?t.raw:String(t);return c.length<d.length?c:t}},22(e,t,r){"use strict";let s=r(2069),o=r(8610),{ANY:i}=o,n=r(4056),a=r(6958),l=[new o(">=0.0.0-0")],u=[new o(">=0.0.0")],c=(e,t,r)=>{let s,o,c,f,h,m,y;if(e===t)return!0;if(1===e.length&&e[0].semver===i)if(1===t.length&&t[0].semver===i)return!0;else e=r.includePrerelease?l:u;if(1===t.length&&t[0].semver===i)if(r.includePrerelease)return!0;else t=u;let g=new Set;for(let t of e)">"===t.operator||">="===t.operator?s=d(s,t,r):"<"===t.operator||"<="===t.operator?o=p(o,t,r):g.add(t.semver);if(g.size>1)return null;if(s&&o&&((c=a(s.semver,o.semver,r))>0||0===c&&(">="!==s.operator||"<="!==o.operator)))return null;for(let e of g){if(s&&!n(e,String(s),r)||o&&!n(e,String(o),r))return null;for(let s of t)if(!n(e,String(s),r))return!1;return!0}let v=!!o&&!r.includePrerelease&&!!o.semver.prerelease.length&&o.semver,_=!!s&&!r.includePrerelease&&!!s.semver.prerelease.length&&s.semver;for(let e of(v&&1===v.prerelease.length&&"<"===o.operator&&0===v.prerelease[0]&&(v=!1),t)){if(y=y||">"===e.operator||">="===e.operator,m=m||"<"===e.operator||"<="===e.operator,s){if(_&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===_.major&&e.semver.minor===_.minor&&e.semver.patch===_.patch&&(_=!1),">"===e.operator||">="===e.operator){if((f=d(s,e,r))===e&&f!==s)return!1}else if(">="===s.operator&&!n(s.semver,String(e),r))return!1}if(o){if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),"<"===e.operator||"<="===e.operator){if((h=p(o,e,r))===e&&h!==o)return!1}else if("<="===o.operator&&!n(o.semver,String(e),r))return!1}if(!e.operator&&(o||s)&&0!==c)return!1}return(!s||!m||!!o||0===c)&&(!o||!y||!!s||0===c)&&!_&&!v&&!0},d=(e,t,r)=>{if(!e)return t;let s=a(e.semver,t.semver,r);return s>0?e:s<0||">"===t.operator&&">="===e.operator?t:e},p=(e,t,r)=>{if(!e)return t;let s=a(e.semver,t.semver,r);return s<0?e:s>0||"<"===t.operator&&"<="===e.operator?t:e};e.exports=(e,t,r={})=>{if(e===t)return!0;e=new s(e,r),t=new s(t,r);let o=!1;e:for(let s of e.set){for(let e of t.set){let t=c(s,e,r);if(o=o||null!==t,t)continue e}if(o)return!1}return!0}},6613(e,t,r){"use strict";let s=r(2069);e.exports=(e,t)=>new s(e,t).set.map(e=>e.map(e=>e.value).join(" ").trim().split(" "))},5372(e,t,r){"use strict";let s=r(2069);e.exports=(e,t)=>{try{return new s(e,t).range||"*"}catch(e){return null}}},600(e,t,r){"use strict";let s=r(9638);e.exports=(e="")=>{let t=e.match(s);if(!t)return null;let[r,o]=t[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return"env"===i?o:o?`${i} ${o}`:i}},9638(e){"use strict";e.exports=/^#!(.*)/},1905(e,t,r){let s="win32"===process.platform||"cygwin"===process.env.OSTYPE||"msys"===process.env.OSTYPE,o=r(6928),i=s?";":":",n=r(9344),a=e=>Object.assign(Error(`not found: ${e}`),{code:"ENOENT"}),l=(e,t)=>{let r=t.colon||i,o=e.match(/\//)||s&&e.match(/\\/)?[""]:[...s?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],n=s?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",a=s?n.split(r):[""];return s&&-1!==e.indexOf(".")&&""!==a[0]&&a.unshift(""),{pathEnv:o,pathExt:a,pathExtExe:n}},u=(e,t,r)=>{"function"==typeof t&&(r=t,t={}),t||(t={});let{pathEnv:s,pathExt:i,pathExtExe:u}=l(e,t),c=[],d=r=>new Promise((i,n)=>{if(r===s.length)return t.all&&c.length?i(c):n(a(e));let l=s[r],u=/^".*"$/.test(l)?l.slice(1,-1):l,d=o.join(u,e);i(p(!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d,r,0))}),p=(e,r,s)=>new Promise((o,a)=>{if(s===i.length)return o(d(r+1));let l=i[s];n(e+l,{pathExt:u},(i,n)=>{if(!i&&n)if(!t.all)return o(e+l);else c.push(e+l);return o(p(e,r,s+1))})});return r?d(0).then(e=>r(null,e),r):d(0)};e.exports=u,u.sync=(e,t)=>{let{pathEnv:r,pathExt:s,pathExtExe:i}=l(e,t=t||{}),u=[];for(let a=0;a<r.length;a++){let l=r[a],c=/^".*"$/.test(l)?l.slice(1,-1):l,d=o.join(c,e),p=!c&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d;for(let e=0;e<s.length;e++){let r=p+s[e];try{if(n.sync(r,{pathExt:i}))if(!t.all)return r;else u.push(r)}catch(e){}}}if(t.all&&u.length)return u;if(t.nothrow)return null;throw a(e)}},181(e){"use strict";e.exports=require("buffer")},5317(e){"use strict";e.exports=require("child_process")},6982(e){"use strict";e.exports=require("crypto")},9896(e){"use strict";e.exports=require("fs")},7598(e){"use strict";e.exports=require("node:crypto")},857(e){"use strict";e.exports=require("os")},6928(e){"use strict";e.exports=require("path")},2203(e){"use strict";e.exports=require("stream")},9023(e){"use strict";e.exports=require("util")},4953(t){"use strict";t.exports=e},7980(e,t,r){"use strict";let{normalizeIPv6:s,removeDotSegments:o,recomposeAuthority:i,normalizePercentEncoding:n,normalizePathEncoding:a,escapePreservingEscapes:l,reescapeHostDelimiters:u,isIPv4:c,nonSimpleDomain:d}=r(609),{SCHEMES:p,getSchemeHandler:f}=r(4848);function h(e,t,r,s){let i={};return s||(e=b(m(e,r),r),t=b(m(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(i.scheme=t.scheme,i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=o(t.path||""),i.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=o(t.path||""),i.query=t.query):(t.path?("/"===t.path[0]?i.path=o(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?i.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:i.path=t.path:i.path="/"+t.path,i.path=o(i.path)),i.query=t.query):(i.path=e.path,void 0!==t.query?i.query=t.query:i.query=e.query),i.userinfo=e.userinfo,i.host=e.host,i.port=e.port),i.scheme=e.scheme),i.fragment=t.fragment,i}function m(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},s=Object.assign({},t),a=[],u=f(s.scheme||r.scheme);u&&u.serialize&&u.serialize(r,s),void 0!==r.path&&(s.skipEscape?r.path=n(r.path):(r.path=l(r.path),void 0!==r.scheme&&(r.path=r.path.split("%3A").join(":")))),"suffix"!==s.reference&&r.scheme&&a.push(r.scheme,":");let c=i(r);if(void 0!==c&&("suffix"!==s.reference&&a.push("//"),a.push(c),r.path&&"/"!==r.path[0]&&a.push("/")),void 0!==r.path){let e=r.path;s.absolutePath||u&&u.absolutePath||(e=o(e)),void 0===c&&"/"===e[0]&&"/"===e[1]&&(e="/%2F"+e.slice(2)),a.push(e)}return void 0!==r.query&&a.push("?",r.query),void 0!==r.fragment&&a.push("#",r.fragment),a.join("")}let y=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,g=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,v=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function _(e,t){let r=Object.assign({},t),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=!1,n=!1;"suffix"===r.reference&&(e=r.scheme?r.scheme+":"+e:"//"+e);let l=e.match(g);null!==l&&-1!==l[1].indexOf("\\")&&(o.error="URI authority must not contain a literal backslash.",i=!0);let p=e.match(v);if(null!==p){let e=p[1],t=e.replace(/[\t\n\r]/g,"");t.length>=2&&("//"!==t.slice(0,2)?(o.error=o.error||"URI authority must not contain a literal backslash.",i=!0):e.length!==t.length&&(o.error=o.error||"URI authority introducer must not contain whitespace.",i=!0))}let h=e.match(y);if(h){o.scheme=h[1],o.userinfo=h[3],o.host=h[4],o.port=parseInt(h[5],10),o.path=h[6]||"",o.query=h[7],o.fragment=h[8],isNaN(o.port)&&(o.port=h[5]);let t=void 0!==h[2]&&o.path&&"/"!==o.path[0]?'URI path must start with "/" when authority is present.':"number"==typeof o.port&&(o.port<0||o.port>65535)?"URI port is malformed.":void 0;if(void 0!==t&&(o.error=o.error||t,i=!0),o.host)if(!1===c(o.host)){let e=s(o.host);o.host=e.host.toLowerCase(),n=e.isIPV6}else n=!0;void 0!==o.scheme||void 0!==o.userinfo||void 0!==o.host||void 0!==o.port||void 0!==o.query||o.path?void 0===o.scheme?o.reference="relative":void 0===o.fragment?o.reference="absolute":o.reference="uri":o.reference="same-document",r.reference&&"suffix"!==r.reference&&r.reference!==o.reference&&(o.error=o.error||"URI is not a "+r.reference+" reference.");let l=f(r.scheme||o.scheme);if(!r.unicodeSupport&&(!l||!l.unicodeSupport)&&o.host&&(r.domainHost||l&&l.domainHost)&&!1===n&&d(o.host))try{o.host=new URL("http://"+o.host).hostname}catch(e){o.error=o.error||"Host's domain name can not be converted to ASCII: "+e}if((!l||l&&!l.skipNormalize)&&(-1!==e.indexOf("%")&&(void 0!==o.scheme&&(o.scheme=unescape(o.scheme)),void 0!==o.host&&(o.host=u(unescape(o.host),n))),o.path&&(o.path=a(o.path)),o.fragment))try{o.fragment=encodeURI(decodeURIComponent(o.fragment))}catch{o.error=o.error||"URI malformed"}l&&l.parse&&l.parse(o,r)}else o.error=o.error||"URI can not be parsed.";return{parsed:o,malformedAuthorityOrPort:i}}function b(e,t){return _(e,t).parsed}function w(e,t){let{parsed:r,malformedAuthorityOrPort:s}=_(e,t);return{normalized:s?e:m(r,t),malformedAuthorityOrPort:s}}function $(e,t){if("string"==typeof e){let{normalized:r,malformedAuthorityOrPort:s}=w(e,t);return s?void 0:r}if("object"==typeof e)return m(e,t)}let E={SCHEMES:p,normalize:function(e,t){return"string"==typeof e?e=w(e,t).normalized:"object"==typeof e&&(e=b(m(e,t),t)),e},resolve:function(e,t,r){let s=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:o,malformedAuthorityOrPort:i}=_(e,s),{parsed:n,malformedAuthorityOrPort:a}=_(t,s);if(i||a)throw Error(o.error||n.error||"URI is malformed.");let l=h(o,n,s,!0);return s.skipEscape=!0,m(l,s)},resolveComponent:h,equal:function(e,t,r){let s=$(e,r),o=$(t,r);return void 0!==s&&void 0!==o&&s.toLowerCase()===o.toLowerCase()},serialize:m,parse:b};e.exports=E,e.exports.default=E,e.exports.fastUri=E},4848(e,t,r){"use strict";let{isUUID:s}=r(609),o=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,i=["http","https","ws","wss","urn","urn:uuid"];function n(e){return!0===e.secure||!1!==e.secure&&!!e.scheme&&3===e.scheme.length&&("w"===e.scheme[0]||"W"===e.scheme[0])&&("s"===e.scheme[1]||"S"===e.scheme[1])&&("s"===e.scheme[2]||"S"===e.scheme[2])}function a(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function l(e){let t="https"===String(e.scheme).toLowerCase();return(e.port===(t?443:80)||""===e.port)&&(e.port=void 0),e.path||(e.path="/"),e}let u={scheme:"http",domainHost:!0,parse:a,serialize:l},c={scheme:"https",domainHost:u.domainHost,parse:a,serialize:l},d={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=n(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if((e.port===(n(e)?443:80)||""===e.port)&&(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&"/"!==t?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}},p={scheme:"wss",domainHost:d.domainHost,parse:d.parse,serialize:d.serialize},f={http:u,https:c,ws:d,wss:p,urn:{scheme:"urn",parse:function(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(o);if(r){let s=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let o=h(`${s}:${t.nid||e.nid}`);e.path=void 0,o&&(e=o.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e},serialize:function(e,t){if(void 0===e.nid)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",s=e.nid.toLowerCase(),o=h(`${r}:${t.nid||s}`);o&&(e=o.serialize(e,t));let i=e,n=e.nss;return i.path=`${s||t.nid}:${n}`,t.skipEscape=!0,i},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(e,t){return e.uuid=e.nss,e.nss=void 0,t.tolerant||e.uuid&&s(e.uuid)||(e.error=e.error||"UUID is not valid."),e},serialize:function(e){return e.nss=(e.uuid||"").toLowerCase(),e},skipNormalize:!0}};function h(e){return e&&(f[e]||f[e.toLowerCase()])||void 0}Object.setPrototypeOf(f,null),e.exports={wsIsSecure:n,SCHEMES:f,isValidSchemeName:function(e){return -1!==i.indexOf(e)},getSchemeHandler:h}},609(e){"use strict";let t=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),r=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),s=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),o=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),i=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function n(e){let t="",r=0,s=0;for(s=0;s<e.length;s++)if(48!==(r=e[s].charCodeAt(0))){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[s];break}for(s+=1;s<e.length;s++){if(!((r=e[s].charCodeAt(0))>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[s]}return t}let a=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function l(e){return e.length=0,!0}function u(e,t,r){if(e.length){let s=n(e);if(""===s)return r.error=!0,!1;t.push(s),e.length=0}return!0}function c(e){if(2>function(e,t){let r=0;for(let t=0;t<e.length;t++)":"===e[t]&&r++;return r}(e,":"))return{host:e,isIPV6:!1};let t=function(e){let t=0,r={error:!1,address:"",zone:""},s=[],o=[],i=!1,a=!1,c=u;for(let n=0;n<e.length;n++){let u=e[n];if("["!==u&&"]"!==u)if(":"===u){if(!0===i&&(a=!0),!c(o,s,r))break;if(++t>7){r.error=!0;break}n>0&&":"===e[n-1]&&(i=!0),s.push(":");continue}else if("%"===u){if(!c(o,s,r))break;c=l}else{o.push(u);continue}}return o.length&&(c===l?r.zone=o.join(""):a?s.push(o.join("")):s.push(n(o))),r.address=s.join(""),r}(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,r=t.address;return t.zone&&(e+="%"+t.zone,r+="%25"+t.zone),{host:e,isIPV6:!0,escapedHost:r}}}let d={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},p=/[@/?#:]/g,f=/[@/?#]/g;function h(e,t){let r=t?f:p;return r.lastIndex=0,e.replace(r,e=>d[e])}e.exports={nonSimpleDomain:a,recomposeAuthority:function(e){let t=[];if(void 0!==e.userinfo&&(t.push(e.userinfo),t.push("@")),void 0!==e.host){let s=unescape(e.host);if(!r(s)){let e=c(s);s=!0===e.isIPV6?`[${e.escapedHost}]`:h(s,!1)}t.push(s)}return("number"==typeof e.port||"string"==typeof e.port)&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0},reescapeHostDelimiters:h,normalizePercentEncoding:function(e,t=!1){if(-1===e.indexOf("%"))return e;let r="";for(let i=0;i<e.length;i++){if("%"===e[i]&&i+2<e.length){let n=e.slice(i+1,i+3);if(s(n)){let e=n.toUpperCase(),s=String.fromCharCode(parseInt(e,16));t&&o(s)?r+=s:r+="%"+e,i+=2;continue}}r+=e[i]}return r},normalizePathEncoding:function(e){let t="";for(let r=0;r<e.length;r++){if("%"===e[r]&&r+2<e.length){let i=e.slice(r+1,r+3);if(s(i)){let e=i.toUpperCase(),s=String.fromCharCode(parseInt(e,16));"."!==s&&o(s)?t+=s:t+="%"+e,r+=2;continue}}i(e[r])?t+=e[r]:t+=escape(e[r])}return t},escapePreservingEscapes:function(e){let t="";for(let r=0;r<e.length;r++){if("%"===e[r]&&r+2<e.length){let o=e.slice(r+1,r+3);if(s(o)){t+="%"+o.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t},removeDotSegments:function(e){let t=e,r=[],s=-1,o=0;for(;o=t.length;){if(1===o)if("."===t)break;else if("/"===t){r.push("/");break}else{r.push(t);break}if(2===o){if("."===t[0]){if("."===t[1])break;else if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&("."===t[1]||"/"===t[1])){r.push("/");break}}else if(3===o&&"/.."===t){0!==r.length&&r.pop(),r.push("/");break}if("."===t[0]){if("."===t[1]){if("/"===t[2]){t=t.slice(3);continue}}else if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&"."===t[1]){if("/"===t[2]){t=t.slice(2);continue}else if("."===t[2]&&"/"===t[3]){t=t.slice(3),0!==r.length&&r.pop();continue}}if(-1===(s=t.indexOf("/",1))){r.push(t);break}r.push(t.slice(0,s)),t=t.slice(s)}return r.join("")},isIPv4:r,isUUID:t,normalizeIPv6:c,stringArrayToHexStripped:n}},114(e){"use strict";e.exports=JSON.parse('{"$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":false}')},7456(e){"use strict";e.exports=JSON.parse('{"$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":true,"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":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"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":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"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":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"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":true}')},4519(e){"use strict";e.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(e){"use strict";e.exports=JSON.parse('{"name":"xmcp","description":"The MCP framework","version":"0.8.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"},"./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"},"typesVersions":{"*":{"host-bridge":["dist/host-bridge.d.ts"],"headers":["dist/runtime/headers.d.ts"],"cloudflare":["dist/cloudflare.d.ts"],"config":["dist/config/index.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/fastify/__tests__/*.test.ts"},"dependencies":{},"devDependencies":{"@nestjs/common":"^11.1.12","@modelcontextprotocol/sdk":"^1.26.0","@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.0.0","fs-extra":"^11.3.2","glob":"^11.1.0","is-docker":"^4.0.0","is-wsl":"^3.1.0","json5":"^2.2.3","jsonwebtoken":"^9.0.3","jose":"^6.1.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"},"peerDependencies":{"@modelcontextprotocol/sdk":"^1.26.0","jose":"^6.1.3","react":">=19.0.0","react-dom":">=19.0.0","zod":"^3.25.76 || ^4.0.0"},"peerDependenciesMeta":{"@modelcontextprotocol/sdk":{"optional":true},"jose":{"optional":true},"react":{"optional":true},"react-dom":{"optional":true}}}')}},o={};function i(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}};return s[e](r,r.exports,i),r.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(e,s){if(1&s&&(e=this(e)),8&s||"object"==typeof e&&e&&(4&s&&e.__esModule||16&s&&"function"==typeof e.then))return e;var o=Object.create(null);i.r(o);var n={};t=t||[null,r({}),r([]),r(r)];for(var a=2&s&&e;("object"==typeof a||"function"==typeof a)&&!~t.indexOf(a);a=r(a))Object.getOwnPropertyNames(a).forEach(t=>{n[t]=()=>e[t]});return n.default=()=>e,i.d(o,n),o},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";let e,t;i.r(n),i.d(n,{createHTTPClient:()=>av,HOST_CONTEXT_CHANGED_METHOD:()=>aN,UPDATE_MODEL_CONTEXT_METHOD:()=>aO,UrlElicitationRequiredError:()=>i5,isEnvHeader:()=>af,createSTDIOClient:()=>a_,jwtAuthMiddleware:()=>_,listSTDIOClientTools:()=>ab,createMcpHostBridge:()=>aM,SIZE_CHANGED_METHOD:()=>az,INITIALIZE_METHOD:()=>aS,LOG_MESSAGE_METHOD:()=>aj,INITIALIZED_METHOD:()=>aT,OPEN_LINK_METHOD:()=>aP,REQUEST_DISPLAY_MODE_METHOD:()=>ax,disconnectSTDIOClient:()=>a$,RESOURCES_READ_METHOD:()=>aR,createContext:()=>E,callSTDIOClientTool:()=>aw,headersToRecord:()=>ah,MCP_APPS_PROTOCOL_VERSION:()=>ak,extractToolNamesFromRequest:()=>aE,UI_MESSAGE_METHOD:()=>aI,apiKeyAuthMiddleware:()=>y,completable:()=>S});var r,s,o,a,l,u,c,d=i(8583),p=i.n(d),f=i(4953);let h=f.z.object({apiKey:f.z.string().optional(),headerName:f.z.string().optional(),validateApiKey:f.z.function().args(f.z.string()).returns(f.z.promise(f.z.boolean())).optional()}).strict().refine(e=>void 0!==e.apiKey||void 0!==e.validateApiKey,{message:"Either 'apiKey' or 'validateApiKey' must be provided"}).refine(e=>void 0===e.apiKey||void 0===e.validateApiKey,{message:"'apiKey' and 'validateApiKey' are mutually exclusive - provide only one"}),m="Unauthorized: Missing or invalid API key";function y(e){let t=h.safeParse(e);if(!t.success){let r="apiKey"in e,s="validateApiKey"in e;if(r&&s)throw Error("'apiKey' and 'validateApiKey' are mutually exclusive - provide only one");if(r||s)throw Error(`Invalid configuration: ${t.error.message}`);throw Error("Either 'apiKey' or 'validateApiKey' must be provided")}let r=e.headerName??"x-api-key",s="apiKey"in e?e.apiKey:void 0,o="validateApiKey"in e?e.validateApiKey:void 0;return async(t,i,n)=>{let a=t.header(r);!a||"apiKey"in e&&a!==s||o&&!await o(a)?i.status(401).json({error:m}):n()}}var g=i(8400),v=i.n(g);function _(e){return(t,r,s)=>{let o=t.header("Authorization");if(!o||!o.startsWith("Bearer "))return void r.status(401).json({error:"Unauthorized: Missing or malformed Authorization header"});let i=o.slice(7).trim();if(!i)return void r.status(401).json({error:"Unauthorized: Missing access token"});try{let{secret:r,...o}=e;t.user=v().verify(i,r,o),s()}catch(e){r.status(401).json({error:"Unauthorized: Invalid or expired token"})}}}let b=require("async_hooks"),w=(e,t)=>{globalThis[e]=t},$=e=>globalThis[e];function E({name:e}){let t=Symbol.for(`xmcp-context-${e}`),r=Symbol.for(`xmcp-context-${e}-fallback-store`);if($(t))return $(t);let s=new b.AsyncLocalStorage,o=globalThis[r]??{current:null};w(r,o);let i={provider:(e,t)=>(o.current=e,s.run(e,t)),getContext:()=>{let t=s.getStore();if(t)return t;if(o.current)return o.current;throw Error(`getContext() can only be used within the ${e} context.`)},setContext:t=>{let r=s.getStore()??o.current;if(!r)throw Error(`setContext() can only be used within the ${e} context.`);Object.assign(r,t)}};return w(t,i),i}let k=Symbol.for("mcp.completable");function S(e,t){return Object.defineProperty(e,k,{value:{complete:t},enumerable:!1,writable:!1,configurable:!1}),e}(o||(o={})).Completable="McpCompletable";let T=Object.freeze({status:"aborted"});function x(e,t,r){function s(r,s){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:s,constr:n,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,s);let o=n.prototype,i=Object.keys(o);for(let e=0;e<i.length;e++){let t=i[e];t in r||(r[t]=o[t].bind(r))}}let o=r?.Parent??Object;class i extends o{}function n(e){var t;let o=r?.Parent?new i:this;for(let r of(s(o,e),(t=o._zod).deferred??(t.deferred=[]),o._zod.deferred))r();return o}return Object.defineProperty(i,"name",{value:e}),Object.defineProperty(n,"init",{value:s}),Object.defineProperty(n,Symbol.hasInstance,{value:t=>!!r?.Parent&&t instanceof r.Parent||t?._zod?.traits?.has(e)}),Object.defineProperty(n,"name",{value:e}),n}Symbol("zod_brand");class P extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class O extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(a=globalThis).__zod_globalConfig??(a.__zod_globalConfig={});let I=globalThis.__zod_globalConfig;function j(e){return e&&Object.assign(I,e),I}let R=/^[cC][0-9a-z]{6,}$/,N=/^[0-9a-z]+$/,z=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,C=/^[0-9a-vA-V]{20}$/,A=/^[A-Za-z0-9]{27}$/,M=/^[a-zA-Z0-9_-]{21}$/,D=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,L=/^([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})$/,q=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[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)$/,U=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,V=/^(?:(?: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])$/,F=/^(([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}|:))$/,H=/^((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])$/,Z=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,K=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,G=/^[A-Za-z0-9_-]*$/,J=/^https?$/,B=/^\+[1-9]\d{6,14}$/,W="(?:(?:\\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])))",X=RegExp(`^${W}$`);function Y(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}let Q=/^-?\d+$/,ee=/^-?\d+(?:\.\d+)?$/,et=/^(?:true|false)$/i,er=/^null$/i,es=/^[^A-Z]*$/,eo=/^[^a-z]*$/;function ei(e){let t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function en(e,t){return"bigint"==typeof t?t.toString():t}function ea(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function el(e){let t=+!!e.startsWith("^"),r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}let eu=Symbol("evaluating");function ec(e,t,r){let s;Object.defineProperty(e,t,{get(){if(s!==eu)return void 0===s&&(s=eu,s=r()),s},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function ed(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ep(...e){let t={};for(let r of e)Object.assign(t,Object.getOwnPropertyDescriptors(r));return Object.defineProperties({},t)}function ef(e){return JSON.stringify(e)}let eh="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function em(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let ey=ea(()=>{if(I.jitless||"undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function eg(e){if(!1===em(e))return!1;let t=e.constructor;if(void 0===t||"function"!=typeof t)return!0;let r=t.prototype;return!1!==em(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function ev(e){return eg(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}let e_=new Set(["string","number","symbol"]);function eb(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ew(e,t,r){let s=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(s._zod.parent=e),s}function e$(e){if(!e)return{};if("string"==typeof e)return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");e.error=e.message}return(delete e.message,"string"==typeof e.error)?{...e,error:()=>e.error}:e}let eE={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]};function ek(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function eS(e,t){return t.map(t=>(t.path??(t.path=[]),t.path.unshift(e),t))}function eT(e){return"string"==typeof e?e:e?.message}function ex(e,t,r){let s=e.message?e.message:eT(e.inst?._zod.def?.error?.(e))??eT(t?.error?.(e))??eT(r.customError?.(e))??eT(r.localeError?.(e))??"Invalid input",{inst:o,continue:i,input:n,...a}=e;return a.path??(a.path=[]),a.message=s,t?.reportInput&&(a.input=n),a}function eP(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function eO(...e){let[t,r,s]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:s}:{...t}}let eI=x("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),ej={number:"number",bigint:"bigint",object:"date"},eR=x("$ZodCheckLessThan",(e,t)=>{eI.init(e,t);let r=ej[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,s=(t.inclusive?r.maximum:r.exclusiveMaximum)??1/0;t.value<s&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=s=>{(t.inclusive?s.value<=t.value:s.value<t.value)||s.issues.push({origin:r,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),eN=x("$ZodCheckGreaterThan",(e,t)=>{eI.init(e,t);let r=ej[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,s=(t.inclusive?r.minimum:r.exclusiveMinimum)??-1/0;t.value>s&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=s=>{(t.inclusive?s.value>=t.value:s.value>t.value)||s.issues.push({origin:r,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ez=x("$ZodCheckMultipleOf",(e,t)=>{eI.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{let s,o,i;if(typeof r.value!=typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?r.value%t.value===BigInt(0):0==(o=Math.round(s=r.value/t.value),i=Number.EPSILON*Math.max(Math.abs(s),1),Math.abs(s-o)<i?0:s-o))||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),eC=x("$ZodCheckNumberFormat",(e,t)=>{eI.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),s=r?"int":"number",[o,i]=eE[t.format];e._zod.onattach.push(e=>{let s=e._zod.bag;s.format=t.format,s.minimum=o,s.maximum=i,r&&(s.pattern=Q)}),e._zod.check=n=>{let a=n.value;if(r){if(!Number.isInteger(a))return void n.issues.push({expected:s,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});if(!Number.isSafeInteger(a))return void(a>0?n.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:s,inclusive:!0,continue:!t.abort}):n.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:s,inclusive:!0,continue:!t.abort}))}a<o&&n.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>i&&n.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),eA=x("$ZodCheckMaxLength",(e,t)=>{var r;eI.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return null!=t&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.maximum??1/0;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let s=r.value;if(s.length<=t.maximum)return;let o=eP(s);r.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),eM=x("$ZodCheckMinLength",(e,t)=>{var r;eI.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return null!=t&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.minimum??-1/0;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let s=r.value;if(s.length>=t.minimum)return;let o=eP(s);r.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),eD=x("$ZodCheckLengthEquals",(e,t)=>{var r;eI.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return null!=t&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{let s=r.value,o=s.length;if(o===t.length)return;let i=eP(s),n=o>t.length;r.issues.push({origin:i,...n?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),eL=x("$ZodCheckStringFormat",(e,t)=>{var r,s;eI.init(e,t),e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(s=e._zod).check??(s.check=()=>{})}),eq=x("$ZodCheckRegex",(e,t)=>{eL.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),eU=x("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=es),eL.init(e,t)}),eV=x("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=eo),eL.init(e,t)}),eF=x("$ZodCheckIncludes",(e,t)=>{eI.init(e,t);let r=eb(t.includes),s=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=s,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(s)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),eH=x("$ZodCheckStartsWith",(e,t)=>{eI.init(e,t);let r=RegExp(`^${eb(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),eZ=x("$ZodCheckEndsWith",(e,t)=>{eI.init(e,t);let r=RegExp(`.*${eb(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),eK=x("$ZodCheckOverwrite",(e,t)=>{eI.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class eG{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length));for(let e of t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e))this.content.push(e)}compile(){return Function(...this?.args,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}let eJ=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,en,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},eB=x("$ZodError",eJ),eW=x("$ZodError",eJ,{Parent:Error}),eX=e=>(t,r,s,o)=>{let i=s?{...s,async:!1}:{async:!1},n=t._zod.run({value:r,issues:[]},i);if(n instanceof Promise)throw new P;if(n.issues.length){let t=new(o?.Err??e)(n.issues.map(e=>ex(e,i,j())));throw eh(t,o?.callee),t}return n.value},eY=e=>async(t,r,s,o)=>{let i=s?{...s,async:!0}:{async:!0},n=t._zod.run({value:r,issues:[]},i);if(n instanceof Promise&&(n=await n),n.issues.length){let t=new(o?.Err??e)(n.issues.map(e=>ex(e,i,j())));throw eh(t,o?.callee),t}return n.value},eQ=e=>(t,r,s)=>{let o=s?{...s,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new P;return i.issues.length?{success:!1,error:new(e??eB)(i.issues.map(e=>ex(e,o,j())))}:{success:!0,data:i.value}},e0=eQ(eW),e1=e=>async(t,r,s)=>{let o=s?{...s,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(e=>ex(e,o,j())))}:{success:!0,data:i.value}},e2=e1(eW),e9={major:4,minor:4,patch:3},e4=x("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=e9;let s=[...e._zod.def.checks??[]];for(let t of(e._zod.traits.has("$ZodCheck")&&s.unshift(e),s))for(let r of t._zod.onattach)r(e);if(0===s.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,r)=>{let s,o=ek(e);for(let i of t){if(i._zod.def.when){if(function(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}(e)||!i._zod.def.when(e))continue}else if(o)continue;let t=e.issues.length,n=i._zod.check(e);if(n instanceof Promise&&r?.async===!1)throw new P;if(s||n instanceof Promise)s=(s??Promise.resolve()).then(async()=>{await n,e.issues.length!==t&&(o||(o=ek(e,t)))});else{if(e.issues.length===t)continue;o||(o=ek(e,t))}}return s?s.then(()=>e):e},r=(r,o,i)=>{if(ek(r))return r.aborted=!0,r;let n=t(o,s,i);if(n instanceof Promise){if(!1===i.async)throw new P;return n.then(t=>e._zod.parse(t,i))}return e._zod.parse(n,i)};e._zod.run=(o,i)=>{if(i.skipChecks)return e._zod.parse(o,i);if("backward"===i.direction){let t=e._zod.parse({value:o.value,issues:[]},{...i,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,o,i)):r(t,o,i)}let n=e._zod.parse(o,i);if(n instanceof Promise){if(!1===i.async)throw new P;return n.then(e=>t(e,s,i))}return t(n,s,i)}}ec(e,"~standard",()=>({validate:t=>{try{let r=e0(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return e2(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),e6=x("$ZodString",(e,t)=>{var r;let s;e4.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(s=(r=e._zod.bag)?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*",RegExp(`^${s}$`)),e._zod.parse=(r,s)=>{if(t.coerce)try{r.value=String(r.value)}catch(e){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),e8=x("$ZodStringFormat",(e,t)=>{eL.init(e,t),e6.init(e,t)}),e5=x("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=L),e8.init(e,t)}),e3=x("$ZodUUID",(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=q(e))}else t.pattern??(t.pattern=q());e8.init(e,t)}),e7=x("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=U),e8.init(e,t)}),te=x("$ZodURL",(e,t)=>{e8.init(e,t),e._zod.check=r=>{try{let s=r.value.trim();if(!t.normalize&&t.protocol?.source===J.source&&!/^https?:\/\//i.test(s))return void r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});let o=new URL(s);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=s;return}catch(s){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),tt=x("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),e8.init(e,t)}),tr=x("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=M),e8.init(e,t)}),ts=x("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=R),e8.init(e,t)}),to=x("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=N),e8.init(e,t)}),ti=x("$ZodULID",(e,t)=>{t.pattern??(t.pattern=z),e8.init(e,t)}),tn=x("$ZodXID",(e,t)=>{t.pattern??(t.pattern=C),e8.init(e,t)}),ta=x("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=A),e8.init(e,t)}),tl=x("$ZodISODateTime",(e,t)=>{let r,s,o;t.pattern??(r=Y({precision:t.precision}),s=["Z"],t.local&&s.push(""),t.offset&&s.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)"),o=`${r}(?:${s.join("|")})`,t.pattern=RegExp(`^${W}T(?:${o})$`)),e8.init(e,t)}),tu=x("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=X),e8.init(e,t)}),tc=x("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=RegExp(`^${Y(t)}$`)),e8.init(e,t)}),td=x("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=D),e8.init(e,t)}),tp=x("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=V),e8.init(e,t),e._zod.bag.format="ipv4"}),tf=x("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=F),e8.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),th=x("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=H),e8.init(e,t)}),tm=x("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Z),e8.init(e,t),e._zod.check=r=>{let s=r.value.split("/");try{if(2!==s.length)throw Error();let[e,t]=s;if(!t)throw Error();let r=Number(t);if(`${r}`!==t||r<0||r>128)throw Error();new URL(`http://[${e}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function ty(e){if(""===e)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let tg=x("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=K),e8.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{ty(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),tv=x("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=G),e8.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{!function(e){if(!G.test(e))return!1;let t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return ty(t.padEnd(4*Math.ceil(t.length/4),"="))}(r.value)&&r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),t_=x("$ZodE164",(e,t)=>{t.pattern??(t.pattern=B),e8.init(e,t)}),tb=x("$ZodJWT",(e,t)=>{e8.init(e,t),e._zod.check=r=>{!function(e,t=null){try{let r=e.split(".");if(3!==r.length)return!1;let[s]=r;if(!s)return!1;let o=JSON.parse(atob(s));if("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}(r.value,t.alg)&&r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),tw=x("$ZodNumber",(e,t)=>{e4.init(e,t),e._zod.pattern=e._zod.bag.pattern??ee,e._zod.parse=(r,s)=>{if(t.coerce)try{r.value=Number(r.value)}catch(e){}let o=r.value;if("number"==typeof o&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i="number"==typeof o?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),t$=x("$ZodNumberFormat",(e,t)=>{eC.init(e,t),tw.init(e,t)}),tE=x("$ZodBoolean",(e,t)=>{e4.init(e,t),e._zod.pattern=et,e._zod.parse=(r,s)=>{if(t.coerce)try{r.value=!!r.value}catch(e){}let o=r.value;return"boolean"==typeof o||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),tk=x("$ZodNull",(e,t)=>{e4.init(e,t),e._zod.pattern=er,e._zod.values=new Set([null]),e._zod.parse=(t,r)=>{let s=t.value;return null===s||t.issues.push({expected:"null",code:"invalid_type",input:s,inst:e}),t}}),tS=x("$ZodAny",(e,t)=>{e4.init(e,t),e._zod.parse=e=>e}),tT=x("$ZodUnknown",(e,t)=>{e4.init(e,t),e._zod.parse=e=>e}),tx=x("$ZodNever",(e,t)=>{e4.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function tP(e,t,r){e.issues.length&&t.issues.push(...eS(r,e.issues)),t.value[r]=e.value}let tO=x("$ZodArray",(e,t)=>{e4.init(e,t),e._zod.parse=(r,s)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);let i=[];for(let e=0;e<o.length;e++){let n=o[e],a=t.element._zod.run({value:n,issues:[]},s);a instanceof Promise?i.push(a.then(t=>tP(t,r,e))):tP(a,r,e)}return i.length?Promise.all(i).then(()=>r):r}});function tI(e,t,r,s,o,i){let n=r in s;if(e.issues.length){if(o&&i&&!n)return;t.issues.push(...eS(r,e.issues))}if(!n&&!o){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}void 0===e.value?n&&(t.value[r]=void 0):t.value[r]=e.value}function tj(e){var t;let r=Object.keys(e.shape);for(let t of r)if(!e.shape?.[t]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${t}": expected a Zod schema`);let s=Object.keys(t=e.shape).filter(e=>"optional"===t[e]._zod.optin&&"optional"===t[e]._zod.optout);return{...e,keys:r,keySet:new Set(r),numKeys:r.length,optionalKeys:new Set(s)}}function tR(e,t,r,s,o,i){let n=[],a=o.keySet,l=o.catchall._zod,u=l.def.type,c="optional"===l.optin,d="optional"===l.optout;for(let o in t){if("__proto__"===o||a.has(o))continue;if("never"===u){n.push(o);continue}let i=l.run({value:t[o],issues:[]},s);i instanceof Promise?e.push(i.then(e=>tI(e,r,o,t,c,d))):tI(i,r,o,t,c,d)}return(n.length&&r.issues.push({code:"unrecognized_keys",keys:n,input:t,inst:i}),e.length)?Promise.all(e).then(()=>r):r}let tN=x("$ZodObject",(e,t)=>{let r;e4.init(e,t);let s=Object.getOwnPropertyDescriptor(t,"shape");if(!s?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let r={...e};return Object.defineProperty(t,"shape",{value:r}),r}})}let o=ea(()=>tj(t));ec(e._zod,"propValues",()=>{let e=t.shape,r={};for(let t in e){let s=e[t]._zod;if(s.values)for(let e of(r[t]??(r[t]=new Set),s.values))r[t].add(e)}return r});let i=t.catchall;e._zod.parse=(t,s)=>{r??(r=o.value);let n=t.value;if(!em(n))return t.issues.push({expected:"object",code:"invalid_type",input:n,inst:e}),t;t.value={};let a=[],l=r.shape;for(let e of r.keys){let r=l[e],o="optional"===r._zod.optin,i="optional"===r._zod.optout,u=r._zod.run({value:n[e],issues:[]},s);u instanceof Promise?a.push(u.then(r=>tI(r,t,e,n,o,i))):tI(u,t,e,n,o,i)}return i?tR(a,n,t,s,o.value,e):a.length?Promise.all(a).then(()=>t):t}}),tz=x("$ZodObjectJIT",(e,t)=>{let r,s;tN.init(e,t);let o=e._zod.parse,i=ea(()=>tj(t)),n=!I.jitless,a=n&&ey.value,l=t.catchall;e._zod.parse=(u,c)=>{s??(s=i.value);let d=u.value;return em(d)?n&&a&&c?.async===!1&&!0!==c.jitless?(r||(r=(e=>{let t=new eG(["shape","payload","ctx"]),r=i.value,s=e=>{let t=ef(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");let o=Object.create(null),n=0;for(let e of r.keys)o[e]=`key_${n++}`;for(let i of(t.write("const newResult = {};"),r.keys)){let r=o[i],n=ef(i),a=e[i],l=a?._zod?.optin==="optional",u=a?._zod?.optout==="optional";t.write(`const ${r} = ${s(i)};`),l&&u?t.write(`
|
|
8
8
|
if (${r}.issues.length) {
|
|
9
|
-
if (${
|
|
9
|
+
if (${n} in input) {
|
|
10
10
|
payload.issues = payload.issues.concat(${r}.issues.map(iss => ({
|
|
11
11
|
...iss,
|
|
12
|
-
path: iss.path ? [${
|
|
12
|
+
path: iss.path ? [${n}, ...iss.path] : [${n}]
|
|
13
13
|
})));
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
if (${r}.value === undefined) {
|
|
18
|
-
if (${
|
|
19
|
-
newResult[${
|
|
18
|
+
if (${n} in input) {
|
|
19
|
+
newResult[${n}] = undefined;
|
|
20
20
|
}
|
|
21
21
|
} else {
|
|
22
|
-
newResult[${
|
|
22
|
+
newResult[${n}] = ${r}.value;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
`):l?t.write(`
|
|
26
26
|
if (${r}.issues.length) {
|
|
27
27
|
payload.issues = payload.issues.concat(${r}.issues.map(iss => ({
|
|
28
28
|
...iss,
|
|
29
|
-
path: iss.path ? [${
|
|
29
|
+
path: iss.path ? [${n}, ...iss.path] : [${n}]
|
|
30
30
|
})));
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
if (${r}.value === undefined) {
|
|
34
|
-
if (${
|
|
35
|
-
newResult[${
|
|
34
|
+
if (${n} in input) {
|
|
35
|
+
newResult[${n}] = undefined;
|
|
36
36
|
}
|
|
37
37
|
} else {
|
|
38
|
-
newResult[${
|
|
38
|
+
newResult[${n}] = ${r}.value;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
`):t.write(`
|
|
42
|
-
const ${r}_present = ${
|
|
42
|
+
const ${r}_present = ${n} in input;
|
|
43
43
|
if (${r}.issues.length) {
|
|
44
44
|
payload.issues = payload.issues.concat(${r}.issues.map(iss => ({
|
|
45
45
|
...iss,
|
|
46
|
-
path: iss.path ? [${
|
|
46
|
+
path: iss.path ? [${n}, ...iss.path] : [${n}]
|
|
47
47
|
})));
|
|
48
48
|
}
|
|
49
49
|
if (!${r}_present && !${r}.issues.length) {
|
|
@@ -51,22 +51,22 @@
|
|
|
51
51
|
code: "invalid_type",
|
|
52
52
|
expected: "nonoptional",
|
|
53
53
|
input: undefined,
|
|
54
|
-
path: [${
|
|
54
|
+
path: [${n}]
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
if (${r}_present) {
|
|
59
59
|
if (${r}.value === undefined) {
|
|
60
|
-
newResult[${
|
|
60
|
+
newResult[${n}] = undefined;
|
|
61
61
|
} else {
|
|
62
|
-
newResult[${
|
|
62
|
+
newResult[${n}] = ${r}.value;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
`)}t.write("payload.value = newResult;"),t.write("return payload;");let o=t.compile();return(t,r)=>o(e,t,r)})(t.shape)),u=r(u,c),l)?rX([],d,u,c,s,e):u:i(u,c):(u.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),u)}});function r0(e,t,r,s){for(let r of e)if(0===r.issues.length)return t.value=r.value,t;let i=e.filter(e=>!tV(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>tK(e,s,e5())))}),t)}let r1=e2("$ZodUnion",(e,t)=>{rf.init(e,t),tP(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),tP(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),tP(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),tP(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>tT(e.source)).join("|")})$`)}});let r=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(s,i)=>{if(r)return r(s,i);let n=!1,a=[];for(let e of t.options){let t=e._zod.run({value:s.value,issues:[]},i);if(t instanceof Promise)a.push(t),n=!0;else{if(0===t.issues.length)return t;a.push(t)}}return n?Promise.all(a).then(t=>r0(t,s,e,i)):r0(a,s,e,i)}}),r2=e2("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,r1.init(e,t);let r=e._zod.parse;tP(e._zod,"propValues",()=>{let e={};for(let r of t.options){let s=r._zod.propValues;if(!s||0===Object.keys(s).length)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let[t,r]of Object.entries(s))for(let s of(e[t]||(e[t]=new Set),r))e[t].add(s)}return e});let s=tx(()=>{let e=t.options,r=new Map;for(let s of e){let e=s._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let t of e){if(r.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);r.set(t,s)}}return r});e._zod.parse=(i,n)=>{let a=i.value;if(!tC(a))return i.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),i;let o=s.value.get(a?.[t.discriminator]);return o?o._zod.run(i,n):t.unionFallback||"backward"===n.direction?r(i,n):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(s.value.keys()),input:a,path:[t.discriminator],inst:e}),i)}}),r9=e2("$ZodIntersection",(e,t)=>{rf.init(e,t),e._zod.parse=(e,r)=>{let s=e.value,i=t.left._zod.run({value:s,issues:[]},r),n=t.right._zod.run({value:s,issues:[]},r);return i instanceof Promise||n instanceof Promise?Promise.all([i,n]).then(([t,r])=>r4(e,t,r)):r4(e,i,n)}});function r4(e,t,r){let s,i=new Map;for(let r of t.issues)if("unrecognized_keys"===r.code)for(let e of(s??(s=r),r.keys))i.has(e)||i.set(e,{}),i.get(e).l=!0;else e.issues.push(r);for(let t of r.issues)if("unrecognized_keys"===t.code)for(let e of t.keys)i.has(e)||i.set(e,{}),i.get(e).r=!0;else e.issues.push(t);let n=[...i].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(n.length&&s&&e.issues.push({...s,keys:n}),tV(e))return e;let a=function e(t,r){if(t===r||t instanceof Date&&r instanceof Date&&+t==+r)return{valid:!0,data:t};if(tz(t)&&tz(r)){let s=Object.keys(r),i=Object.keys(t).filter(e=>-1!==s.indexOf(e)),n={...t,...r};for(let s of i){let i=e(t[s],r[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(t)&&Array.isArray(r)){if(t.length!==r.length)return{valid:!1,mergeErrorPath:[]};let s=[];for(let i=0;i<t.length;i++){let n=e(t[i],r[i]);if(!n.valid)return{valid:!1,mergeErrorPath:[i,...n.mergeErrorPath]};s.push(n.data)}return{valid:!0,data:s}}return{valid:!1,mergeErrorPath:[]}}(t.value,r.value);if(!a.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}let r6=e2("$ZodRecord",(e,t)=>{rf.init(e,t),e._zod.parse=(r,s)=>{let i=r.value;if(!tz(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let n=[],a=t.keyType._zod.values;if(a){let o;r.value={};let l=new Set;for(let o of a)if("string"==typeof o||"number"==typeof o||"symbol"==typeof o){l.add("number"==typeof o?o.toString():o);let a=t.keyType._zod.run({value:o,issues:[]},s);if(a instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(a.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(e=>tK(e,s,e5())),input:o,path:[o],inst:e});continue}let u=a.value,c=t.valueType._zod.run({value:i[o],issues:[]},s);c instanceof Promise?n.push(c.then(e=>{e.issues.length&&r.issues.push(...tF(o,e.issues)),r.value[u]=e.value})):(c.issues.length&&r.issues.push(...tF(o,c.issues)),r.value[u]=c.value)}for(let e in i)l.has(e)||(o=o??[]).push(e);o&&o.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:o})}else for(let a of(r.value={},Reflect.ownKeys(i))){if("__proto__"===a||!Object.prototype.propertyIsEnumerable.call(i,a))continue;let o=t.keyType._zod.run({value:a,issues:[]},s);if(o instanceof Promise)throw Error("Async schemas not supported in object keys currently");if("string"==typeof a&&t_.test(a)&&o.issues.length){let e=t.keyType._zod.run({value:Number(a),issues:[]},s);if(e instanceof Promise)throw Error("Async schemas not supported in object keys currently");0===e.issues.length&&(o=e)}if(o.issues.length){"loose"===t.mode?r.value[a]=i[a]:r.issues.push({code:"invalid_key",origin:"record",issues:o.issues.map(e=>tK(e,s,e5())),input:a,path:[a],inst:e});continue}let l=t.valueType._zod.run({value:i[a],issues:[]},s);l instanceof Promise?n.push(l.then(e=>{e.issues.length&&r.issues.push(...tF(a,e.issues)),r.value[o.value]=e.value})):(l.issues.length&&r.issues.push(...tF(a,l.issues)),r.value[o.value]=l.value)}return n.length?Promise.all(n).then(()=>r):r}}),r5=e2("$ZodEnum",(e,t)=>{rf.init(e,t);let r=tk(t.entries),s=new Set(r);e._zod.values=s,e._zod.pattern=RegExp(`^(${r.filter(e=>tD.has(typeof e)).map(e=>"string"==typeof e?tL(e):e.toString()).join("|")})$`),e._zod.parse=(t,i)=>{let n=t.value;return s.has(n)||t.issues.push({code:"invalid_value",values:r,input:n,inst:e}),t}}),r8=e2("$ZodLiteral",(e,t)=>{if(rf.init(e,t),0===t.values.length)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=RegExp(`^(${t.values.map(e=>"string"==typeof e?tL(e):e?tL(e.toString()):String(e)).join("|")})$`),e._zod.parse=(s,i)=>{let n=s.value;return r.has(n)||s.issues.push({code:"invalid_value",values:t.values,input:n,inst:e}),s}}),r3=e2("$ZodTransform",(e,t)=>{rf.init(e,t),e._zod.optin="optional",e._zod.parse=(r,s)=>{if("backward"===s.direction)throw new e4(e.constructor.name);let i=t.transform(r.value,r);if(s.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(r.value=e,r.fallback=!0,r));if(i instanceof Promise)throw new e9;return r.value=i,r.fallback=!0,r}});function r7(e,t){return void 0===t&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}let se=e2("$ZodOptional",(e,t)=>{rf.init(e,t),e._zod.optin="optional",e._zod.optout="optional",tP(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),tP(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${tT(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){let s=e.value,i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(e=>r7(e,s)):r7(i,s)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),st=e2("$ZodExactOptional",(e,t)=>{se.init(e,t),tP(e._zod,"values",()=>t.innerType._zod.values),tP(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),sr=e2("$ZodNullable",(e,t)=>{rf.init(e,t),tP(e._zod,"optin",()=>t.innerType._zod.optin),tP(e._zod,"optout",()=>t.innerType._zod.optout),tP(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${tT(e.source)}|null)$`):void 0}),tP(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),ss=e2("$ZodDefault",(e,t)=>{rf.init(e,t),e._zod.optin="optional",tP(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);if(void 0===e.value)return e.value=t.defaultValue,e;let s=t.innerType._zod.run(e,r);return s instanceof Promise?s.then(e=>si(e,t)):si(s,t)}});function si(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}let sn=e2("$ZodPrefault",(e,t)=>{rf.init(e,t),e._zod.optin="optional",tP(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>("backward"===r.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),sa=e2("$ZodNonOptional",(e,t)=>{rf.init(e,t),tP(e._zod,"values",()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,s)=>{let i=t.innerType._zod.run(r,s);return i instanceof Promise?i.then(t=>so(t,e)):so(i,e)}});function so(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}let sl=e2("$ZodCatch",(e,t)=>{rf.init(e,t),e._zod.optin="optional",tP(e._zod,"optout",()=>t.innerType._zod.optout),tP(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let s=t.innerType._zod.run(e,r);return s instanceof Promise?s.then(s=>(e.value=s.value,s.issues.length&&(e.value=t.catchValue({...e,error:{issues:s.issues.map(e=>tK(e,r,e5()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=s.value,s.issues.length&&(e.value=t.catchValue({...e,error:{issues:s.issues.map(e=>tK(e,r,e5()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),su=e2("$ZodPipe",(e,t)=>{rf.init(e,t),tP(e._zod,"values",()=>t.in._zod.values),tP(e._zod,"optin",()=>t.in._zod.optin),tP(e._zod,"optout",()=>t.out._zod.optout),tP(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("backward"===r.direction){let s=t.out._zod.run(e,r);return s instanceof Promise?s.then(e=>sc(e,t.in,r)):sc(s,t.in,r)}let s=t.in._zod.run(e,r);return s instanceof Promise?s.then(e=>sc(e,t.out,r)):sc(s,t.out,r)}});function sc(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}let sd=e2("$ZodPreprocess",(e,t)=>{su.init(e,t)}),sp=e2("$ZodReadonly",(e,t)=>{rf.init(e,t),tP(e._zod,"propValues",()=>t.innerType._zod.propValues),tP(e._zod,"values",()=>t.innerType._zod.values),tP(e._zod,"optin",()=>t.innerType?._zod?.optin),tP(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let s=t.innerType._zod.run(e,r);return s instanceof Promise?s.then(sf):sf(s)}});function sf(e){return e.value=Object.freeze(e.value),e}let sh=e2("$ZodCustom",(e,t)=>{tJ.init(e,t),rf.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{let s=r.value,i=t.fn(s);if(i instanceof Promise)return i.then(t=>sm(t,r,s,e));sm(i,r,s,e)}});function sm(e,t,r,s){if(!e){let e={code:"custom",input:r,inst:s,path:[...s._zod.def.path??[]],continue:!s._zod.def.abort};s._zod.def.params&&(e.params=s._zod.def.params),t.issues.push(tB(e))}}Symbol("ZodOutput"),Symbol("ZodInput");(y=globalThis).__zod_globalRegistry??(y.__zod_globalRegistry=new class e{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];return this._map.set(e,r),r&&"object"==typeof r&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let s={...r,...this._map.get(e)};return Object.keys(s).length?s:void 0}return this._map.get(e)}has(e){return this._map.has(e)}});let sy=globalThis.__zod_globalRegistry;function sg(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...tU(t)})}function sv(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...tU(t)})}function s_(e,t){return new tX({check:"less_than",...tU(t),value:e,inclusive:!1})}function sb(e,t){return new tX({check:"less_than",...tU(t),value:e,inclusive:!0})}function sw(e,t){return new tY({check:"greater_than",...tU(t),value:e,inclusive:!1})}function s$(e,t){return new tY({check:"greater_than",...tU(t),value:e,inclusive:!0})}function sE(e,t){return new tQ({check:"multiple_of",...tU(t),value:e})}function sk(e,t){return new t1({check:"max_length",...tU(t),maximum:e})}function sS(e,t){return new t2({check:"min_length",...tU(t),minimum:e})}function sx(e,t){return new t9({check:"length_equals",...tU(t),length:e})}function sT(e){return new rt({check:"overwrite",tx:e})}function sO(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??sy,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function sP(e,t,r={path:[],schemaPath:[]}){var s;let i=e._zod.def,n=t.seen.get(e);if(n)return n.count++,r.schemaPath.includes(e)&&(n.cycle=r.path),n.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);let o=e._zod.toJSONSchema?.();if(o)a.schema=o;else{let s={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,s);else{let r=a.schema,n=t.processors[i.type];if(!n)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);n(e,t,r,s)}let n=e._zod.parent;n&&(a.ref||(a.ref=n),sP(n,t,s),t.seen.get(n).isParent=!0)}let l=t.metadataRegistry.get(e);return l&&Object.assign(a.schema,l),"input"===t.io&&function e(t,r){let s=r??{seen:new Set};if(s.seen.has(t))return!1;s.seen.add(t);let i=t._zod.def;if("transform"===i.type)return!0;if("array"===i.type)return e(i.element,s);if("set"===i.type)return e(i.valueType,s);if("lazy"===i.type)return e(i.getter(),s);if("promise"===i.type||"optional"===i.type||"nonoptional"===i.type||"nullable"===i.type||"readonly"===i.type||"default"===i.type||"prefault"===i.type)return e(i.innerType,s);if("intersection"===i.type)return e(i.left,s)||e(i.right,s);if("record"===i.type||"map"===i.type)return e(i.keyType,s)||e(i.valueType,s);if("pipe"===i.type)return!!t._zod.traits.has("$ZodCodec")||e(i.in,s)||e(i.out,s);if("object"===i.type){for(let t in i.shape)if(e(i.shape[t],s))return!0;return!1}if("union"===i.type){for(let t of i.options)if(e(t,s))return!0;return!1}if("tuple"===i.type){for(let t of i.items)if(e(t,s))return!0;if(i.rest&&e(i.rest,s))return!0}return!1}(e)&&(delete a.schema.examples,delete a.schema.default),"input"===t.io&&"_prefault"in a.schema&&((s=a.schema).default??(s.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function sI(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let s=new Map;for(let t of e.seen.entries()){let r=e.metadataRegistry.get(t[0])?.id;if(r){let e=s.get(r);if(e&&e!==t[0])throw Error(`Duplicate schema id "${r}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);s.set(r,t[0])}}let i=t=>{if(t[1].schema.$ref)return;let s=t[1],{ref:i,defId:n}=(t=>{let s="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){let r=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(r)return{ref:i(r)};let n=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=n,{defId:n,ref:`${i("__shared")}#/${s}/${n}`}}if(t[1]===r)return{ref:"#"};let i=`#/${s}/`,n=t[1].schema.id??`__schema${e.counter++}`;return{defId:n,ref:i+n}})(t);s.def={...s.schema},n&&(s.defId=n);let a=s.schema;for(let e in a)delete a[e];a.$ref=i};if("throw"===e.cycles)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>
|
|
66
|
+
`)}t.write("payload.value = newResult;"),t.write("return payload;");let a=t.compile();return(t,r)=>a(e,t,r)})(t.shape)),u=r(u,c),l)?tR([],d,u,c,s,e):u:o(u,c):(u.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),u)}});function tC(e,t,r,s){for(let r of e)if(0===r.issues.length)return t.value=r.value,t;let o=e.filter(e=>!ek(e));return 1===o.length?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>ex(e,s,j())))}),t)}let tA=x("$ZodUnion",(e,t)=>{e4.init(e,t),ec(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),ec(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),ec(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),ec(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>el(e.source)).join("|")})$`)}});let r=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(s,o)=>{if(r)return r(s,o);let i=!1,n=[];for(let e of t.options){let t=e._zod.run({value:s.value,issues:[]},o);if(t instanceof Promise)n.push(t),i=!0;else{if(0===t.issues.length)return t;n.push(t)}}return i?Promise.all(n).then(t=>tC(t,s,e,o)):tC(n,s,e,o)}}),tM=x("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,tA.init(e,t);let r=e._zod.parse;ec(e._zod,"propValues",()=>{let e={};for(let r of t.options){let s=r._zod.propValues;if(!s||0===Object.keys(s).length)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let[t,r]of Object.entries(s))for(let s of(e[t]||(e[t]=new Set),r))e[t].add(s)}return e});let s=ea(()=>{let e=t.options,r=new Map;for(let s of e){let e=s._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let t of e){if(r.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);r.set(t,s)}}return r});e._zod.parse=(o,i)=>{let n=o.value;if(!em(n))return o.issues.push({code:"invalid_type",expected:"object",input:n,inst:e}),o;let a=s.value.get(n?.[t.discriminator]);return a?a._zod.run(o,i):t.unionFallback||"backward"===i.direction?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(s.value.keys()),input:n,path:[t.discriminator],inst:e}),o)}}),tD=x("$ZodIntersection",(e,t)=>{e4.init(e,t),e._zod.parse=(e,r)=>{let s=e.value,o=t.left._zod.run({value:s,issues:[]},r),i=t.right._zod.run({value:s,issues:[]},r);return o instanceof Promise||i instanceof Promise?Promise.all([o,i]).then(([t,r])=>tL(e,t,r)):tL(e,o,i)}});function tL(e,t,r){let s,o=new Map;for(let r of t.issues)if("unrecognized_keys"===r.code)for(let e of(s??(s=r),r.keys))o.has(e)||o.set(e,{}),o.get(e).l=!0;else e.issues.push(r);for(let t of r.issues)if("unrecognized_keys"===t.code)for(let e of t.keys)o.has(e)||o.set(e,{}),o.get(e).r=!0;else e.issues.push(t);let i=[...o].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(i.length&&s&&e.issues.push({...s,keys:i}),ek(e))return e;let n=function e(t,r){if(t===r||t instanceof Date&&r instanceof Date&&+t==+r)return{valid:!0,data:t};if(eg(t)&&eg(r)){let s=Object.keys(r),o=Object.keys(t).filter(e=>-1!==s.indexOf(e)),i={...t,...r};for(let s of o){let o=e(t[s],r[s]);if(!o.valid)return{valid:!1,mergeErrorPath:[s,...o.mergeErrorPath]};i[s]=o.data}return{valid:!0,data:i}}if(Array.isArray(t)&&Array.isArray(r)){if(t.length!==r.length)return{valid:!1,mergeErrorPath:[]};let s=[];for(let o=0;o<t.length;o++){let i=e(t[o],r[o]);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};s.push(i.data)}return{valid:!0,data:s}}return{valid:!1,mergeErrorPath:[]}}(t.value,r.value);if(!n.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}let tq=x("$ZodRecord",(e,t)=>{e4.init(e,t),e._zod.parse=(r,s)=>{let o=r.value;if(!eg(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let i=[],n=t.keyType._zod.values;if(n){let a;r.value={};let l=new Set;for(let a of n)if("string"==typeof a||"number"==typeof a||"symbol"==typeof a){l.add("number"==typeof a?a.toString():a);let n=t.keyType._zod.run({value:a,issues:[]},s);if(n instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(n.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:n.issues.map(e=>ex(e,s,j())),input:a,path:[a],inst:e});continue}let u=n.value,c=t.valueType._zod.run({value:o[a],issues:[]},s);c instanceof Promise?i.push(c.then(e=>{e.issues.length&&r.issues.push(...eS(a,e.issues)),r.value[u]=e.value})):(c.issues.length&&r.issues.push(...eS(a,c.issues)),r.value[u]=c.value)}for(let e in o)l.has(e)||(a=a??[]).push(e);a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:a})}else for(let n of(r.value={},Reflect.ownKeys(o))){if("__proto__"===n||!Object.prototype.propertyIsEnumerable.call(o,n))continue;let a=t.keyType._zod.run({value:n,issues:[]},s);if(a instanceof Promise)throw Error("Async schemas not supported in object keys currently");if("string"==typeof n&&ee.test(n)&&a.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},s);if(e instanceof Promise)throw Error("Async schemas not supported in object keys currently");0===e.issues.length&&(a=e)}if(a.issues.length){"loose"===t.mode?r.value[n]=o[n]:r.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(e=>ex(e,s,j())),input:n,path:[n],inst:e});continue}let l=t.valueType._zod.run({value:o[n],issues:[]},s);l instanceof Promise?i.push(l.then(e=>{e.issues.length&&r.issues.push(...eS(n,e.issues)),r.value[a.value]=e.value})):(l.issues.length&&r.issues.push(...eS(n,l.issues)),r.value[a.value]=l.value)}return i.length?Promise.all(i).then(()=>r):r}}),tU=x("$ZodEnum",(e,t)=>{e4.init(e,t);let r=ei(t.entries),s=new Set(r);e._zod.values=s,e._zod.pattern=RegExp(`^(${r.filter(e=>e_.has(typeof e)).map(e=>"string"==typeof e?eb(e):e.toString()).join("|")})$`),e._zod.parse=(t,o)=>{let i=t.value;return s.has(i)||t.issues.push({code:"invalid_value",values:r,input:i,inst:e}),t}}),tV=x("$ZodLiteral",(e,t)=>{if(e4.init(e,t),0===t.values.length)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=RegExp(`^(${t.values.map(e=>"string"==typeof e?eb(e):e?eb(e.toString()):String(e)).join("|")})$`),e._zod.parse=(s,o)=>{let i=s.value;return r.has(i)||s.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),s}}),tF=x("$ZodTransform",(e,t)=>{e4.init(e,t),e._zod.optin="optional",e._zod.parse=(r,s)=>{if("backward"===s.direction)throw new O(e.constructor.name);let o=t.transform(r.value,r);if(s.async)return(o instanceof Promise?o:Promise.resolve(o)).then(e=>(r.value=e,r.fallback=!0,r));if(o instanceof Promise)throw new P;return r.value=o,r.fallback=!0,r}});function tH(e,t){return void 0===t&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}let tZ=x("$ZodOptional",(e,t)=>{e4.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ec(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ec(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${el(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){let s=e.value,o=t.innerType._zod.run(e,r);return o instanceof Promise?o.then(e=>tH(e,s)):tH(o,s)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),tK=x("$ZodExactOptional",(e,t)=>{tZ.init(e,t),ec(e._zod,"values",()=>t.innerType._zod.values),ec(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),tG=x("$ZodNullable",(e,t)=>{e4.init(e,t),ec(e._zod,"optin",()=>t.innerType._zod.optin),ec(e._zod,"optout",()=>t.innerType._zod.optout),ec(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${el(e.source)}|null)$`):void 0}),ec(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),tJ=x("$ZodDefault",(e,t)=>{e4.init(e,t),e._zod.optin="optional",ec(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);if(void 0===e.value)return e.value=t.defaultValue,e;let s=t.innerType._zod.run(e,r);return s instanceof Promise?s.then(e=>tB(e,t)):tB(s,t)}});function tB(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}let tW=x("$ZodPrefault",(e,t)=>{e4.init(e,t),e._zod.optin="optional",ec(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>("backward"===r.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),tX=x("$ZodNonOptional",(e,t)=>{e4.init(e,t),ec(e._zod,"values",()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,s)=>{let o=t.innerType._zod.run(r,s);return o instanceof Promise?o.then(t=>tY(t,e)):tY(o,e)}});function tY(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}let tQ=x("$ZodCatch",(e,t)=>{e4.init(e,t),e._zod.optin="optional",ec(e._zod,"optout",()=>t.innerType._zod.optout),ec(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let s=t.innerType._zod.run(e,r);return s instanceof Promise?s.then(s=>(e.value=s.value,s.issues.length&&(e.value=t.catchValue({...e,error:{issues:s.issues.map(e=>ex(e,r,j()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=s.value,s.issues.length&&(e.value=t.catchValue({...e,error:{issues:s.issues.map(e=>ex(e,r,j()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),t0=x("$ZodPipe",(e,t)=>{e4.init(e,t),ec(e._zod,"values",()=>t.in._zod.values),ec(e._zod,"optin",()=>t.in._zod.optin),ec(e._zod,"optout",()=>t.out._zod.optout),ec(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("backward"===r.direction){let s=t.out._zod.run(e,r);return s instanceof Promise?s.then(e=>t1(e,t.in,r)):t1(s,t.in,r)}let s=t.in._zod.run(e,r);return s instanceof Promise?s.then(e=>t1(e,t.out,r)):t1(s,t.out,r)}});function t1(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}let t2=x("$ZodPreprocess",(e,t)=>{t0.init(e,t)}),t9=x("$ZodReadonly",(e,t)=>{e4.init(e,t),ec(e._zod,"propValues",()=>t.innerType._zod.propValues),ec(e._zod,"values",()=>t.innerType._zod.values),ec(e._zod,"optin",()=>t.innerType?._zod?.optin),ec(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let s=t.innerType._zod.run(e,r);return s instanceof Promise?s.then(t4):t4(s)}});function t4(e){return e.value=Object.freeze(e.value),e}let t6=x("$ZodCustom",(e,t)=>{eI.init(e,t),e4.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{let s=r.value,o=t.fn(s);if(o instanceof Promise)return o.then(t=>t8(t,r,s,e));t8(o,r,s,e)}});function t8(e,t,r,s){if(!e){let e={code:"custom",input:r,inst:s,path:[...s._zod.def.path??[]],continue:!s._zod.def.abort};s._zod.def.params&&(e.params=s._zod.def.params),t.issues.push(eO(e))}}Symbol("ZodOutput"),Symbol("ZodInput");(l=globalThis).__zod_globalRegistry??(l.__zod_globalRegistry=new class e{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];return this._map.set(e,r),r&&"object"==typeof r&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let s={...r,...this._map.get(e)};return Object.keys(s).length?s:void 0}return this._map.get(e)}has(e){return this._map.has(e)}});let t5=globalThis.__zod_globalRegistry;function t3(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...e$(t)})}function t7(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...e$(t)})}function re(e,t){return new eR({check:"less_than",...e$(t),value:e,inclusive:!1})}function rt(e,t){return new eR({check:"less_than",...e$(t),value:e,inclusive:!0})}function rr(e,t){return new eN({check:"greater_than",...e$(t),value:e,inclusive:!1})}function rs(e,t){return new eN({check:"greater_than",...e$(t),value:e,inclusive:!0})}function ro(e,t){return new ez({check:"multiple_of",...e$(t),value:e})}function ri(e,t){return new eA({check:"max_length",...e$(t),maximum:e})}function rn(e,t){return new eM({check:"min_length",...e$(t),minimum:e})}function ra(e,t){return new eD({check:"length_equals",...e$(t),length:e})}function rl(e){return new eK({check:"overwrite",tx:e})}function ru(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??t5,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function rc(e,t,r={path:[],schemaPath:[]}){var s;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let n={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,n);let a=e._zod.toJSONSchema?.();if(a)n.schema=a;else{let s={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,n.schema,s);else{let r=n.schema,i=t.processors[o.type];if(!i)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);i(e,t,r,s)}let i=e._zod.parent;i&&(n.ref||(n.ref=i),rc(i,t,s),t.seen.get(i).isParent=!0)}let l=t.metadataRegistry.get(e);return l&&Object.assign(n.schema,l),"input"===t.io&&function e(t,r){let s=r??{seen:new Set};if(s.seen.has(t))return!1;s.seen.add(t);let o=t._zod.def;if("transform"===o.type)return!0;if("array"===o.type)return e(o.element,s);if("set"===o.type)return e(o.valueType,s);if("lazy"===o.type)return e(o.getter(),s);if("promise"===o.type||"optional"===o.type||"nonoptional"===o.type||"nullable"===o.type||"readonly"===o.type||"default"===o.type||"prefault"===o.type)return e(o.innerType,s);if("intersection"===o.type)return e(o.left,s)||e(o.right,s);if("record"===o.type||"map"===o.type)return e(o.keyType,s)||e(o.valueType,s);if("pipe"===o.type)return!!t._zod.traits.has("$ZodCodec")||e(o.in,s)||e(o.out,s);if("object"===o.type){for(let t in o.shape)if(e(o.shape[t],s))return!0;return!1}if("union"===o.type){for(let t of o.options)if(e(t,s))return!0;return!1}if("tuple"===o.type){for(let t of o.items)if(e(t,s))return!0;if(o.rest&&e(o.rest,s))return!0}return!1}(e)&&(delete n.schema.examples,delete n.schema.default),"input"===t.io&&"_prefault"in n.schema&&((s=n.schema).default??(s.default=n.schema._prefault)),delete n.schema._prefault,t.seen.get(e).schema}function rd(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let s=new Map;for(let t of e.seen.entries()){let r=e.metadataRegistry.get(t[0])?.id;if(r){let e=s.get(r);if(e&&e!==t[0])throw Error(`Duplicate schema id "${r}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);s.set(r,t[0])}}let o=t=>{if(t[1].schema.$ref)return;let s=t[1],{ref:o,defId:i}=(t=>{let s="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){let r=e.external.registry.get(t[0])?.id,o=e.external.uri??(e=>e);if(r)return{ref:o(r)};let i=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=i,{defId:i,ref:`${o("__shared")}#/${s}/${i}`}}if(t[1]===r)return{ref:"#"};let o=`#/${s}/`,i=t[1].schema.id??`__schema${e.counter++}`;return{defId:i,ref:o+i}})(t);s.def={...s.schema},i&&(s.defId=i);let n=s.schema;for(let e in n)delete n[e];n.$ref=o};if("throw"===e.cycles)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>
|
|
67
67
|
|
|
68
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let r of e.seen.entries()){let s=r[1];if(t===r[0]){i(r);continue}if(e.external){let s=e.external.registry.get(r[0])?.id;if(t!==r[0]&&s){i(r);continue}}if(e.metadataRegistry.get(r[0])?.id||s.cycle||s.count>1&&"ref"===e.reused){i(r);continue}}}function sj(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let s=t=>{let r=e.seen.get(t);if(null===r.ref)return;let i=r.def??r.schema,n={...i},a=r.ref;if(r.ref=null,a){s(a);let r=e.seen.get(a),o=r.schema;if(o.$ref&&("draft-07"===e.target||"draft-04"===e.target||"openapi-3.0"===e.target)?(i.allOf=i.allOf??[],i.allOf.push(o)):Object.assign(i,o),Object.assign(i,n),t._zod.parent===a)for(let e in i)"$ref"!==e&&"allOf"!==e&&(e in n||delete i[e]);if(o.$ref&&r.def)for(let e in i)"$ref"!==e&&"allOf"!==e&&e in r.def&&JSON.stringify(i[e])===JSON.stringify(r.def[e])&&delete i[e]}let o=t._zod.parent;if(o&&o!==a){s(o);let t=e.seen.get(o);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:r.path??[]})};for(let t of[...e.seen.entries()].reverse())s(t[0]);let i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let r=e.external.registry.get(t)?.id;if(!r)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(r)}Object.assign(i,r.def??r.schema);let n=e.metadataRegistry.get(t)?.id;void 0!==n&&i.id===n&&delete i.id;let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&("draft-2020-12"===e.target?i.$defs=a:i.definitions=a);try{let r=JSON.parse(JSON.stringify(i));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:sN(t,"input",e.processors),output:sN(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw Error("Error converting schema to JSON.")}}let sN=(e,t,r={})=>s=>{let{libraryOptions:i,target:n}=s??{},a=sO({...i??{},target:n,io:t,processors:r});return sP(e,a),sI(a,e),sj(a,e)},sR={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},sC=(e,t,r,s)=>{let i=e._zod.def;sP(i.innerType,t,s),t.seen.get(e).ref=i.innerType},sA=e2("ZodISODateTime",(e,t)=>{rT.init(e,t),s6.init(e,t)});function sz(e){return new sA({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...tU(e)})}let sM=e2("ZodISODate",(e,t)=>{rO.init(e,t),s6.init(e,t)}),sD=e2("ZodISOTime",(e,t)=>{rP.init(e,t),s6.init(e,t)}),sL=e2("ZodISODuration",(e,t)=>{rI.init(e,t),s6.init(e,t)}),sq=e2("ZodError",(e,t)=>{ri.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>(function(e,t=e=>e.message){let r={_errors:[]},s=(e,i=[])=>{for(let n of e.issues)if("invalid_union"===n.code&&n.errors.length)n.errors.map(e=>s({issues:e},[...i,...n.path]));else if("invalid_key"===n.code)s({issues:n.issues},[...i,...n.path]);else if("invalid_element"===n.code)s({issues:n.issues},[...i,...n.path]);else{let e=[...i,...n.path];if(0===e.length)r._errors.push(t(n));else{let s=r,i=0;for(;i<e.length;){let r=e[i];i===e.length-1?(s[r]=s[r]||{_errors:[]},s[r]._errors.push(t(n))):s[r]=s[r]||{_errors:[]},s=s[r],i++}}}};return s(e),r})(e,t)},flatten:{value:t=>(function(e,t=e=>e.message){let r={},s=[];for(let i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):s.push(t(i));return{formErrors:s,fieldErrors:r}})(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,tS,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,tS,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),sU=ra(sq),sZ=ro(sq),sV=rl(sq),sF=rc(sq),sH=(e,t,r)=>{let s=r?{...r,direction:"backward"}:{direction:"backward"};return ra(sq)(e,t,s)},sK=(e,t,r)=>ra(sq)(e,t,r),sG=async(e,t,r)=>{let s=r?{...r,direction:"backward"}:{direction:"backward"};return ro(sq)(e,t,s)},sB=async(e,t,r)=>ro(sq)(e,t,r),sJ=(e,t,r)=>{let s=r?{...r,direction:"backward"}:{direction:"backward"};return rl(sq)(e,t,s)},sW=(e,t,r)=>rl(sq)(e,t,r),sX=async(e,t,r)=>{let s=r?{...r,direction:"backward"}:{direction:"backward"};return rc(sq)(e,t,s)},sY=async(e,t,r)=>rc(sq)(e,t,r),sQ=new WeakMap;function s0(e,t,r){let s=Object.getPrototypeOf(e),i=sQ.get(s);if(i||(i=new Set,sQ.set(s,i)),!i.has(t))for(let e in i.add(t),r){let t=r[e];Object.defineProperty(s,e,{configurable:!0,enumerable:!1,get(){let r=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:r}),r},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}let s1=e2("ZodType",(e,t)=>(rf.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:sN(e,"input"),output:sN(e,"output")}}),e.toJSONSchema=((e,t={})=>r=>{let s=sO({...r,processors:t});return sP(e,s),sI(s,e),sj(s,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,r)=>sU(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>sV(e,t,r),e.parseAsync=async(t,r)=>sZ(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>sF(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>sH(e,t,r),e.decode=(t,r)=>sK(e,t,r),e.encodeAsync=async(t,r)=>sG(e,t,r),e.decodeAsync=async(t,r)=>sB(e,t,r),e.safeEncode=(t,r)=>sJ(e,t,r),e.safeDecode=(t,r)=>sW(e,t,r),e.safeEncodeAsync=async(t,r)=>sX(e,t,r),e.safeDecodeAsync=async(t,r)=>sY(e,t,r),s0(e,"ZodType",{check(...e){let t=this.def;return this.clone(tj(t,{checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return tq(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(function(e,t={}){return new i8({type:"custom",check:"custom",fn:e,...tU(t)})}(e,t))},superRefine(e,t){return this.check(function(e,t){var r;let s,i;return r=t=>(t.addIssue=e=>{"string"==typeof e?t.issues.push(tB(e,t.value,s._zod.def)):(e.fatal&&(e.continue=!1),e.code??(e.code="custom"),e.input??(e.input=t.value),e.inst??(e.inst=s),e.continue??(e.continue=!s._zod.def.abort),t.issues.push(tB(e)))},e(t.value,t)),(i=new tJ({check:"custom",...tU(t)}))._zod.check=r,s=i}(e,t))},overwrite(e){return this.check(sT(e))},optional(){return iJ(this)},exactOptional(){var e;return e=this,new iW({type:"optional",innerType:e})},nullable(){return iY(this)},nullish(){return iJ(iY(this))},nonoptional(e){var t;return t=this,new i1({type:"nonoptional",innerType:t,...tU(e)})},array(){return iI(this)},or(e){return iA([this,e])},and(e){return iL(this,e)},transform(e){return i4(this,iG(e))},default(e){var t,r;return t=this,r=e,new iQ({type:"default",innerType:t,get defaultValue(){return"function"==typeof r?r():tM(r)}})},prefault(e){var t,r;return t=this,r=e,new i0({type:"prefault",innerType:t,get defaultValue(){return"function"==typeof r?r():tM(r)}})},catch(e){var t,r;return t=this,new i2({type:"catch",innerType:t,catchValue:"function"==typeof(r=e)?r:()=>r})},pipe(e){return i4(this,e)},readonly(){var e;return e=this,new i5({type:"readonly",innerType:e})},describe(e){let t=this.clone();return sy.add(t,{description:e}),t},meta(...e){if(0===e.length)return sy.get(this);let t=this.clone();return sy.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get:()=>sy.get(e)?.description,configurable:!0}),e)),s2=e2("_ZodString",(e,t)=>{rh.init(e,t),s1.init(e,t),e._zod.processJSONSchema=(t,r,s)=>((e,t,r,s)=>{r.type="string";let{minimum:i,maximum:n,format:a,patterns:o,contentEncoding:l}=e._zod.bag;if("number"==typeof i&&(r.minLength=i),"number"==typeof n&&(r.maxLength=n),a&&(r.format=sR[a]??a,""===r.format&&delete r.format,"time"===a&&delete r.format),l&&(r.contentEncoding=l),o&&o.size>0){let e=[...o];1===e.length?r.pattern=e[0].source:e.length>1&&(r.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,r,0);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,s0(e,"_ZodString",{regex(...e){return this.check(function(e,t){return new t6({check:"string_format",format:"regex",...tU(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new t3({check:"string_format",format:"includes",...tU(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new t7({check:"string_format",format:"starts_with",...tU(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new re({check:"string_format",format:"ends_with",...tU(t),suffix:e})}(...e))},min(...e){return this.check(sS(...e))},max(...e){return this.check(sk(...e))},length(...e){return this.check(sx(...e))},nonempty(...e){return this.check(sS(1,...e))},lowercase(e){return this.check(new t5({check:"string_format",format:"lowercase",...tU(e)}))},uppercase(e){return this.check(new t8({check:"string_format",format:"uppercase",...tU(e)}))},trim(){return this.check(sT(e=>e.trim()))},normalize(...e){return this.check(function(e){return sT(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(sT(e=>e.toLowerCase()))},toUpperCase(){return this.check(sT(e=>e.toUpperCase()))},slugify(){return this.check(sT(e=>e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")))}})}),s9=e2("ZodString",(e,t)=>{rh.init(e,t),s2.init(e,t),e.email=t=>e.check(new s5({type:"string",format:"email",check:"string_format",abort:!1,...tU(t)})),e.url=t=>e.check(sv(s7,t)),e.jwt=t=>e.check(new iy({type:"string",format:"jwt",check:"string_format",abort:!1,...tU(t)})),e.emoji=t=>e.check(new ie({type:"string",format:"emoji",check:"string_format",abort:!1,...tU(t)})),e.guid=t=>e.check(sg(s8,t)),e.uuid=t=>e.check(new s3({type:"string",format:"uuid",check:"string_format",abort:!1,...tU(t)})),e.uuidv4=t=>e.check(new s3({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...tU(t)})),e.uuidv6=t=>e.check(new s3({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...tU(t)})),e.uuidv7=t=>e.check(new s3({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...tU(t)})),e.nanoid=t=>e.check(new it({type:"string",format:"nanoid",check:"string_format",abort:!1,...tU(t)})),e.guid=t=>e.check(sg(s8,t)),e.cuid=t=>e.check(new ir({type:"string",format:"cuid",check:"string_format",abort:!1,...tU(t)})),e.cuid2=t=>e.check(new is({type:"string",format:"cuid2",check:"string_format",abort:!1,...tU(t)})),e.ulid=t=>e.check(new ii({type:"string",format:"ulid",check:"string_format",abort:!1,...tU(t)})),e.base64=t=>e.check(new ip({type:"string",format:"base64",check:"string_format",abort:!1,...tU(t)})),e.base64url=t=>e.check(new ih({type:"string",format:"base64url",check:"string_format",abort:!1,...tU(t)})),e.xid=t=>e.check(new ia({type:"string",format:"xid",check:"string_format",abort:!1,...tU(t)})),e.ksuid=t=>e.check(new io({type:"string",format:"ksuid",check:"string_format",abort:!1,...tU(t)})),e.ipv4=t=>e.check(new il({type:"string",format:"ipv4",check:"string_format",abort:!1,...tU(t)})),e.ipv6=t=>e.check(new iu({type:"string",format:"ipv6",check:"string_format",abort:!1,...tU(t)})),e.cidrv4=t=>e.check(new ic({type:"string",format:"cidrv4",check:"string_format",abort:!1,...tU(t)})),e.cidrv6=t=>e.check(new id({type:"string",format:"cidrv6",check:"string_format",abort:!1,...tU(t)})),e.e164=t=>e.check(new im({type:"string",format:"e164",check:"string_format",abort:!1,...tU(t)})),e.datetime=t=>e.check(sz(t)),e.date=t=>e.check(new sM({type:"string",format:"date",check:"string_format",...tU(t)})),e.time=t=>e.check(new sD({type:"string",format:"time",check:"string_format",precision:null,...tU(t)})),e.duration=t=>e.check(new sL({type:"string",format:"duration",check:"string_format",...tU(t)}))});function s4(e){return new s9({type:"string",...tU(e)})}let s6=e2("ZodStringFormat",(e,t)=>{rm.init(e,t),s2.init(e,t)}),s5=e2("ZodEmail",(e,t)=>{rv.init(e,t),s6.init(e,t)}),s8=e2("ZodGUID",(e,t)=>{ry.init(e,t),s6.init(e,t)}),s3=e2("ZodUUID",(e,t)=>{rg.init(e,t),s6.init(e,t)}),s7=e2("ZodURL",(e,t)=>{r_.init(e,t),s6.init(e,t)}),ie=e2("ZodEmoji",(e,t)=>{rb.init(e,t),s6.init(e,t)}),it=e2("ZodNanoID",(e,t)=>{rw.init(e,t),s6.init(e,t)}),ir=e2("ZodCUID",(e,t)=>{r$.init(e,t),s6.init(e,t)}),is=e2("ZodCUID2",(e,t)=>{rE.init(e,t),s6.init(e,t)}),ii=e2("ZodULID",(e,t)=>{rk.init(e,t),s6.init(e,t)}),ia=e2("ZodXID",(e,t)=>{rS.init(e,t),s6.init(e,t)}),io=e2("ZodKSUID",(e,t)=>{rx.init(e,t),s6.init(e,t)}),il=e2("ZodIPv4",(e,t)=>{rj.init(e,t),s6.init(e,t)}),iu=e2("ZodIPv6",(e,t)=>{rN.init(e,t),s6.init(e,t)}),ic=e2("ZodCIDRv4",(e,t)=>{rR.init(e,t),s6.init(e,t)}),id=e2("ZodCIDRv6",(e,t)=>{rC.init(e,t),s6.init(e,t)}),ip=e2("ZodBase64",(e,t)=>{rz.init(e,t),s6.init(e,t)}),ih=e2("ZodBase64URL",(e,t)=>{rM.init(e,t),s6.init(e,t)}),im=e2("ZodE164",(e,t)=>{rD.init(e,t),s6.init(e,t)}),iy=e2("ZodJWT",(e,t)=>{rL.init(e,t),s6.init(e,t)}),ig=e2("ZodNumber",(e,t)=>{rq.init(e,t),s1.init(e,t),e._zod.processJSONSchema=(t,r,s)=>((e,t,r,s)=>{let{minimum:i,maximum:n,format:a,multipleOf:o,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;"string"==typeof a&&a.includes("int")?r.type="integer":r.type="number";let c="number"==typeof u&&u>=(i??-1/0),d="number"==typeof l&&l<=(n??1/0),p="draft-04"===t.target||"openapi-3.0"===t.target;c?p?(r.minimum=u,r.exclusiveMinimum=!0):r.exclusiveMinimum=u:"number"==typeof i&&(r.minimum=i),d?p?(r.maximum=l,r.exclusiveMaximum=!0):r.exclusiveMaximum=l:"number"==typeof n&&(r.maximum=n),"number"==typeof o&&(r.multipleOf=o)})(e,t,r,0),s0(e,"ZodNumber",{gt(e,t){return this.check(sw(e,t))},gte(e,t){return this.check(s$(e,t))},min(e,t){return this.check(s$(e,t))},lt(e,t){return this.check(s_(e,t))},lte(e,t){return this.check(sb(e,t))},max(e,t){return this.check(sb(e,t))},int(e){return this.check(ib(e))},safe(e){return this.check(ib(e))},positive(e){return this.check(sw(0,e))},nonnegative(e){return this.check(s$(0,e))},negative(e){return this.check(s_(0,e))},nonpositive(e){return this.check(sb(0,e))},multipleOf(e,t){return this.check(sE(e,t))},step(e,t){return this.check(sE(e,t))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??-1/0,r.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(r.maximum??1/0,r.exclusiveMaximum??1/0)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function iv(e){return new ig({type:"number",checks:[],...tU(e)})}let i_=e2("ZodNumberFormat",(e,t)=>{rU.init(e,t),ig.init(e,t)});function ib(e){return new i_({type:"number",check:"number_format",abort:!1,format:"safeint",...tU(e)})}let iw=e2("ZodBoolean",(e,t)=>{rZ.init(e,t),s1.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{t.type="boolean"}});function i$(e){return new iw({type:"boolean",...tU(e)})}let iE=e2("ZodNull",(e,t)=>{rV.init(e,t),s1.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{"openapi-3.0"===e.target?(t.type="string",t.nullable=!0,t.enum=[null]):t.type="null"}});function ik(e){return new iE({type:"null",...tU(e)})}let iS=e2("ZodAny",(e,t)=>{rF.init(e,t),s1.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}}),ix=e2("ZodUnknown",(e,t)=>{rH.init(e,t),s1.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}});function iT(){return new ix({type:"unknown"})}let iO=e2("ZodNever",(e,t)=>{rK.init(e,t),s1.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{t.not={}}}),iP=e2("ZodArray",(e,t)=>{rB.init(e,t),s1.init(e,t),e._zod.processJSONSchema=(t,r,s)=>((e,t,r,s)=>{let i=e._zod.def,{minimum:n,maximum:a}=e._zod.bag;"number"==typeof n&&(r.minItems=n),"number"==typeof a&&(r.maxItems=a),r.type="array",r.items=sP(i.element,t,{...s,path:[...s.path,"items"]})})(e,t,r,s),e.element=t.element,s0(e,"ZodArray",{min(e,t){return this.check(sS(e,t))},nonempty(e){return this.check(sS(1,e))},max(e,t){return this.check(sk(e,t))},length(e,t){return this.check(sx(e,t))},unwrap(){return this.element}})});function iI(e,t){return new iP({type:"array",element:e,...tU(t)})}let ij=e2("ZodObject",(e,t)=>{rQ.init(e,t),s1.init(e,t),e._zod.processJSONSchema=(t,r,s)=>((e,t,r,s)=>{let i=e._zod.def;r.type="object",r.properties={};let n=i.shape;for(let e in n)r.properties[e]=sP(n[e],t,{...s,path:[...s.path,"properties",e]});let a=new Set([...new Set(Object.keys(n))].filter(e=>{let r=i.shape[e]._zod;return"input"===t.io?void 0===r.optin:void 0===r.optout}));a.size>0&&(r.required=Array.from(a)),i.catchall?._zod.def.type==="never"?r.additionalProperties=!1:i.catchall?i.catchall&&(r.additionalProperties=sP(i.catchall,t,{...s,path:[...s.path,"additionalProperties"]})):"output"===t.io&&(r.additionalProperties=!1)})(e,t,r,s),tP(e,"shape",()=>t.shape),s0(e,"ZodObject",{keyof(){return iV(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:iT()})},loose(){return this.clone({...this._zod.def,catchall:iT()})},strict(){return this.clone({...this._zod.def,catchall:new iO({type:"never",...tU(void 0)})})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return function(e,t){if(!tz(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let r=e._zod.def.shape;for(let e in t)if(void 0!==Object.getOwnPropertyDescriptor(r,e))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let s=tj(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return tI(this,"shape",r),r}});return tq(e,s)}(this,e)},safeExtend(e){var t=this;if(!tz(e))throw Error("Invalid input to safeExtend: expected a plain object");let r=tj(t._zod.def,{get shape(){let r={...t._zod.def.shape,...e};return tI(this,"shape",r),r}});return tq(t,r)},merge(e){var t=this;if(t._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=tj(t._zod.def,{get shape(){let r={...t._zod.def.shape,...e._zod.def.shape};return tI(this,"shape",r),r},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return tq(t,r)},pick(e){return function(e,t){let r=e._zod.def,s=r.checks;if(s&&s.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i=tj(e._zod.def,{get shape(){let e={};for(let s in t){if(!(s in r.shape))throw Error(`Unrecognized key: "${s}"`);t[s]&&(e[s]=r.shape[s])}return tI(this,"shape",e),e},checks:[]});return tq(e,i)}(this,e)},omit(e){return function(e,t){let r=e._zod.def,s=r.checks;if(s&&s.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=tj(e._zod.def,{get shape(){let s={...e._zod.def.shape};for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete s[e]}return tI(this,"shape",s),s},checks:[]});return tq(e,i)}(this,e)},partial(...e){return function(e,t,r){let s=t._zod.def.checks;if(s&&s.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let i=tj(t._zod.def,{get shape(){let s=t._zod.def.shape,i={...s};if(r)for(let t in r){if(!(t in s))throw Error(`Unrecognized key: "${t}"`);r[t]&&(i[t]=e?new e({type:"optional",innerType:s[t]}):s[t])}else for(let t in s)i[t]=e?new e({type:"optional",innerType:s[t]}):s[t];return tI(this,"shape",i),i},checks:[]});return tq(t,i)}(iB,this,e[0])},required(...e){var t,r;let s;return t=this,r=e[0],s=tj(t._zod.def,{get shape(){let e=t._zod.def.shape,s={...e};if(r)for(let t in r){if(!(t in s))throw Error(`Unrecognized key: "${t}"`);r[t]&&(s[t]=new i1({type:"nonoptional",innerType:e[t]}))}else for(let t in e)s[t]=new i1({type:"nonoptional",innerType:e[t]});return tI(this,"shape",s),s}}),tq(t,s)}})});function iN(e,t){return new ij({type:"object",shape:e??{},...tU(t)})}function iR(e,t){return new ij({type:"object",shape:e,catchall:iT(),...tU(t)})}let iC=e2("ZodUnion",(e,t)=>{r1.init(e,t),s1.init(e,t),e._zod.processJSONSchema=(t,r,s)=>{let i,n,a;return n=!1===(i=e._zod.def).inclusive,a=i.options.map((e,r)=>sP(e,t,{...s,path:[...s.path,n?"oneOf":"anyOf",r]})),void(n?r.oneOf=a:r.anyOf=a)},e.options=t.options});function iA(e,t){return new iC({type:"union",options:e,...tU(t)})}let iz=e2("ZodDiscriminatedUnion",(e,t)=>{iC.init(e,t),r2.init(e,t)});function iM(e,t,r){return new iz({type:"union",options:t,discriminator:e,...tU(r)})}let iD=e2("ZodIntersection",(e,t)=>{r9.init(e,t),s1.init(e,t),e._zod.processJSONSchema=(t,r,s)=>{let i,n,a,o;return n=sP((i=e._zod.def).left,t,{...s,path:[...s.path,"allOf",0]}),a=sP(i.right,t,{...s,path:[...s.path,"allOf",1]}),void(r.allOf=[...(o=e=>"allOf"in e&&1===Object.keys(e).length)(n)?n.allOf:[n],...o(a)?a.allOf:[a]])}});function iL(e,t){return new iD({type:"intersection",left:e,right:t})}let iq=e2("ZodRecord",(e,t)=>{r6.init(e,t),s1.init(e,t),e._zod.processJSONSchema=(t,r,s)=>((e,t,r,s)=>{let i=e._zod.def;r.type="object";let n=i.keyType,a=n._zod.bag,o=a?.patterns;if("loose"===i.mode&&o&&o.size>0){let e=sP(i.valueType,t,{...s,path:[...s.path,"patternProperties","*"]});for(let t of(r.patternProperties={},o))r.patternProperties[t.source]=e}else("draft-07"===t.target||"draft-2020-12"===t.target)&&(r.propertyNames=sP(i.keyType,t,{...s,path:[...s.path,"propertyNames"]})),r.additionalProperties=sP(i.valueType,t,{...s,path:[...s.path,"additionalProperties"]});let l=n._zod.values;if(l){let e=[...l].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(r.required=e)}})(e,t,r,s),e.keyType=t.keyType,e.valueType=t.valueType});function iU(e,t,r){return new iq(t&&t._zod?{type:"record",keyType:e,valueType:t,...tU(r)}:{type:"record",keyType:s4(),valueType:e,...tU(t)})}let iZ=e2("ZodEnum",(e,t)=>{r5.init(e,t),s1.init(e,t),e._zod.processJSONSchema=(t,r,s)=>{let i;(i=tk(e._zod.def.entries)).every(e=>"number"==typeof e)&&(r.type="number"),i.every(e=>"string"==typeof e)&&(r.type="string"),r.enum=i},e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(e,s)=>{let i={};for(let s of e)if(r.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new iZ({...t,checks:[],...tU(s),entries:i})},e.exclude=(e,s)=>{let i={...t.entries};for(let t of e)if(r.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new iZ({...t,checks:[],...tU(s),entries:i})}});function iV(e,t){return new iZ({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...tU(t)})}let iF=e2("ZodLiteral",(e,t)=>{r8.init(e,t),s1.init(e,t),e._zod.processJSONSchema=(t,r,s)=>((e,t,r,s)=>{let i=e._zod.def,n=[];for(let e of i.values)if(void 0===e){if("throw"===t.unrepresentable)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof e)if("throw"===t.unrepresentable)throw Error("BigInt literals cannot be represented in JSON Schema");else n.push(Number(e));else n.push(e);if(0===n.length);else if(1===n.length){let e=n[0];r.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?r.enum=[e]:r.const=e}else n.every(e=>"number"==typeof e)&&(r.type="number"),n.every(e=>"string"==typeof e)&&(r.type="string"),n.every(e=>"boolean"==typeof e)&&(r.type="boolean"),n.every(e=>null===e)&&(r.type="null"),r.enum=n})(e,t,r,0),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function iH(e,t){return new iF({type:"literal",values:Array.isArray(e)?e:[e],...tU(t)})}let iK=e2("ZodTransform",(e,t)=>{r3.init(e,t),s1.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r,s)=>{if("throw"===t.unrepresentable)throw Error("Transforms cannot be represented in JSON Schema")})(0,e,0,0),e._zod.parse=(r,s)=>{if("backward"===s.direction)throw new e4(e.constructor.name);r.addIssue=s=>{"string"==typeof s?r.issues.push(tB(s,r.value,t)):(s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),r.issues.push(tB(s)))};let i=t.transform(r.value,r);return i instanceof Promise?i.then(e=>(r.value=e,r.fallback=!0,r)):(r.value=i,r.fallback=!0,r)}});function iG(e){return new iK({type:"transform",transform:e})}let iB=e2("ZodOptional",(e,t)=>{se.init(e,t),s1.init(e,t),e._zod.processJSONSchema=(t,r,s)=>sC(e,t,r,s),e.unwrap=()=>e._zod.def.innerType});function iJ(e){return new iB({type:"optional",innerType:e})}let iW=e2("ZodExactOptional",(e,t)=>{st.init(e,t),s1.init(e,t),e._zod.processJSONSchema=(t,r,s)=>sC(e,t,r,s),e.unwrap=()=>e._zod.def.innerType}),iX=e2("ZodNullable",(e,t)=>{sr.init(e,t),s1.init(e,t),e._zod.processJSONSchema=(t,r,s)=>{let i,n,a;return n=sP((i=e._zod.def).innerType,t,s),a=t.seen.get(e),void("openapi-3.0"===t.target?(a.ref=i.innerType,r.nullable=!0):r.anyOf=[n,{type:"null"}])},e.unwrap=()=>e._zod.def.innerType});function iY(e){return new iX({type:"nullable",innerType:e})}let iQ=e2("ZodDefault",(e,t)=>{ss.init(e,t),s1.init(e,t),e._zod.processJSONSchema=(t,r,s)=>{let i;sP((i=e._zod.def).innerType,t,s),t.seen.get(e).ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),i0=e2("ZodPrefault",(e,t)=>{sn.init(e,t),s1.init(e,t),e._zod.processJSONSchema=(t,r,s)=>{let i;sP((i=e._zod.def).innerType,t,s),t.seen.get(e).ref=i.innerType,"input"===t.io&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},e.unwrap=()=>e._zod.def.innerType}),i1=e2("ZodNonOptional",(e,t)=>{sa.init(e,t),s1.init(e,t),e._zod.processJSONSchema=(t,r,s)=>{let i;sP((i=e._zod.def).innerType,t,s),t.seen.get(e).ref=i.innerType},e.unwrap=()=>e._zod.def.innerType}),i2=e2("ZodCatch",(e,t)=>{sl.init(e,t),s1.init(e,t),e._zod.processJSONSchema=(t,r,s)=>((e,t,r,s)=>{let i,n=e._zod.def;sP(n.innerType,t,s),t.seen.get(e).ref=n.innerType;try{i=n.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=i})(e,t,r,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),i9=e2("ZodPipe",(e,t)=>{su.init(e,t),s1.init(e,t),e._zod.processJSONSchema=(t,r,s)=>{let i,n,a;return n=(i=e._zod.def).in._zod.traits.has("$ZodTransform"),void(sP(a="input"===t.io?n?i.out:i.in:i.out,t,s),t.seen.get(e).ref=a)},e.in=t.in,e.out=t.out});function i4(e,t){return new i9({type:"pipe",in:e,out:t})}let i6=e2("ZodPreprocess",(e,t)=>{i9.init(e,t),sd.init(e,t)}),i5=e2("ZodReadonly",(e,t)=>{sp.init(e,t),s1.init(e,t),e._zod.processJSONSchema=(t,r,s)=>{let i;sP((i=e._zod.def).innerType,t,s),t.seen.get(e).ref=i.innerType,r.readOnly=!0},e.unwrap=()=>e._zod.def.innerType}),i8=e2("ZodCustom",(e,t)=>{sh.init(e,t),s1.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r,s)=>{if("throw"===t.unrepresentable)throw Error("Custom types cannot be represented in JSON Schema")})(0,e,0,0)});function i3(e,t){return new i6({type:"pipe",in:iG(e),out:t})}let i7="2025-11-25",ne=[i7,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],nt="io.modelcontextprotocol/related-task",nr=(l=(e=>null!==e&&("object"==typeof e||"function"==typeof e))??(()=>!0),(r=tU(void 0)).abort??(r.abort=!0),new i8({type:"custom",check:"custom",fn:l,...r})),ns=iA([s4(),iv().int()]),ni=s4();iR({ttl:iA([iv(),ik()]).optional(),pollInterval:iv().optional()});let nn=iN({ttl:iv().optional()}),na=iN({taskId:s4()}),no=iR({progressToken:ns.optional(),[nt]:na.optional()}),nl=iN({_meta:no.optional()}),nu=nl.extend({task:nn.optional()}),nc=iN({method:s4(),params:nl.loose().optional()}),nd=iN({_meta:no.optional()}),np=iN({method:s4(),params:nd.loose().optional()}),nf=iR({_meta:no.optional()}),nh=iA([s4(),iv().int()]),nm=iN({jsonrpc:iH("2.0"),id:nh,...nc.shape}).strict(),ny=e=>nm.safeParse(e).success,ng=iN({jsonrpc:iH("2.0"),...np.shape}).strict(),nv=iN({jsonrpc:iH("2.0"),id:nh,result:nf}).strict(),n_=e=>nv.safeParse(e).success;(u=g||(g={}))[u.ConnectionClosed=-32e3]="ConnectionClosed",u[u.RequestTimeout=-32001]="RequestTimeout",u[u.ParseError=-32700]="ParseError",u[u.InvalidRequest=-32600]="InvalidRequest",u[u.MethodNotFound=-32601]="MethodNotFound",u[u.InvalidParams=-32602]="InvalidParams",u[u.InternalError=-32603]="InternalError",u[u.UrlElicitationRequired=-32042]="UrlElicitationRequired";let nb=iN({jsonrpc:iH("2.0"),id:nh.optional(),error:iN({code:iv().int(),message:s4(),data:iT().optional()})}).strict(),nw=iA([nm,ng,nv,nb]);iA([nv,nb]);let n$=nf.strict(),nE=nd.extend({requestId:nh.optional(),reason:s4().optional()}),nk=np.extend({method:iH("notifications/cancelled"),params:nE}),nS=iN({src:s4(),mimeType:s4().optional(),sizes:iI(s4()).optional(),theme:iV(["light","dark"]).optional()}),nx=iN({icons:iI(nS).optional()}),nT=iN({name:s4(),title:s4().optional()}),nO=nT.extend({...nT.shape,...nx.shape,version:s4(),websiteUrl:s4().optional(),description:s4().optional()}),nP=iL(iN({applyDefaults:i$().optional()}),iU(s4(),iT())),nI=i3(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,iL(iN({form:nP.optional(),url:nr.optional()}),iU(s4(),iT()).optional())),nj=iR({list:nr.optional(),cancel:nr.optional(),requests:iR({sampling:iR({createMessage:nr.optional()}).optional(),elicitation:iR({create:nr.optional()}).optional()}).optional()}),nN=iR({list:nr.optional(),cancel:nr.optional(),requests:iR({tools:iR({call:nr.optional()}).optional()}).optional()}),nR=iN({experimental:iU(s4(),nr).optional(),sampling:iN({context:nr.optional(),tools:nr.optional()}).optional(),elicitation:nI.optional(),roots:iN({listChanged:i$().optional()}).optional(),tasks:nj.optional()}),nC=nl.extend({protocolVersion:s4(),capabilities:nR,clientInfo:nO}),nA=nc.extend({method:iH("initialize"),params:nC}),nz=iN({experimental:iU(s4(),nr).optional(),logging:nr.optional(),completions:nr.optional(),prompts:iN({listChanged:i$().optional()}).optional(),resources:iN({subscribe:i$().optional(),listChanged:i$().optional()}).optional(),tools:iN({listChanged:i$().optional()}).optional(),tasks:nN.optional()}),nM=nf.extend({protocolVersion:s4(),capabilities:nz,serverInfo:nO,instructions:s4().optional()}),nD=np.extend({method:iH("notifications/initialized"),params:nd.optional()}),nL=nc.extend({method:iH("ping"),params:nl.optional()}),nq=iN({progress:iv(),total:iJ(iv()),message:iJ(s4())}),nU=iN({...nd.shape,...nq.shape,progressToken:ns}),nZ=np.extend({method:iH("notifications/progress"),params:nU}),nV=nl.extend({cursor:ni.optional()}),nF=nc.extend({params:nV.optional()}),nH=nf.extend({nextCursor:ni.optional()}),nK=iV(["working","input_required","completed","failed","cancelled"]),nG=iN({taskId:s4(),status:nK,ttl:iA([iv(),ik()]),createdAt:s4(),lastUpdatedAt:s4(),pollInterval:iJ(iv()),statusMessage:iJ(s4())}),nB=nf.extend({task:nG}),nJ=nd.merge(nG),nW=np.extend({method:iH("notifications/tasks/status"),params:nJ}),nX=nc.extend({method:iH("tasks/get"),params:nl.extend({taskId:s4()})}),nY=nf.merge(nG),nQ=nc.extend({method:iH("tasks/result"),params:nl.extend({taskId:s4()})});nf.loose();let n0=nF.extend({method:iH("tasks/list")}),n1=nH.extend({tasks:iI(nG)}),n2=nc.extend({method:iH("tasks/cancel"),params:nl.extend({taskId:s4()})}),n9=nf.merge(nG),n4=iN({uri:s4(),mimeType:iJ(s4()),_meta:iU(s4(),iT()).optional()}),n6=n4.extend({text:s4()}),n5=s4().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),n8=n4.extend({blob:n5}),n3=iV(["user","assistant"]),n7=iN({audience:iI(n3).optional(),priority:iv().min(0).max(1).optional(),lastModified:sz({offset:!0}).optional()}),ae=iN({...nT.shape,...nx.shape,uri:s4(),description:iJ(s4()),mimeType:iJ(s4()),annotations:n7.optional(),_meta:iJ(iR({}))}),at=iN({...nT.shape,...nx.shape,uriTemplate:s4(),description:iJ(s4()),mimeType:iJ(s4()),annotations:n7.optional(),_meta:iJ(iR({}))}),ar=nF.extend({method:iH("resources/list")}),as=nH.extend({resources:iI(ae)}),ai=nF.extend({method:iH("resources/templates/list")}),an=nH.extend({resourceTemplates:iI(at)}),aa=nl.extend({uri:s4()}),ao=nc.extend({method:iH("resources/read"),params:aa}),al=nf.extend({contents:iI(iA([n6,n8]))}),au=np.extend({method:iH("notifications/resources/list_changed"),params:nd.optional()}),ac=nc.extend({method:iH("resources/subscribe"),params:aa}),ad=nc.extend({method:iH("resources/unsubscribe"),params:aa}),ap=nd.extend({uri:s4()}),af=np.extend({method:iH("notifications/resources/updated"),params:ap}),ah=iN({name:s4(),description:iJ(s4()),required:iJ(i$())}),am=iN({...nT.shape,...nx.shape,description:iJ(s4()),arguments:iJ(iI(ah)),_meta:iJ(iR({}))}),ay=nF.extend({method:iH("prompts/list")}),ag=nH.extend({prompts:iI(am)}),av=nl.extend({name:s4(),arguments:iU(s4(),s4()).optional()}),a_=nc.extend({method:iH("prompts/get"),params:av}),ab=iN({type:iH("text"),text:s4(),annotations:n7.optional(),_meta:iU(s4(),iT()).optional()}),aw=iN({type:iH("image"),data:n5,mimeType:s4(),annotations:n7.optional(),_meta:iU(s4(),iT()).optional()}),a$=iN({type:iH("audio"),data:n5,mimeType:s4(),annotations:n7.optional(),_meta:iU(s4(),iT()).optional()}),aE=iN({type:iH("tool_use"),name:s4(),id:s4(),input:iU(s4(),iT()),_meta:iU(s4(),iT()).optional()}),ak=iN({type:iH("resource"),resource:iA([n6,n8]),annotations:n7.optional(),_meta:iU(s4(),iT()).optional()}),aS=iA([ab,aw,a$,ae.extend({type:iH("resource_link")}),ak]),ax=iN({role:n3,content:aS}),aT=nf.extend({description:s4().optional(),messages:iI(ax)}),aO=np.extend({method:iH("notifications/prompts/list_changed"),params:nd.optional()}),aP=iN({title:s4().optional(),readOnlyHint:i$().optional(),destructiveHint:i$().optional(),idempotentHint:i$().optional(),openWorldHint:i$().optional()}),aI=iN({taskSupport:iV(["required","optional","forbidden"]).optional()}),aj=iN({...nT.shape,...nx.shape,description:s4().optional(),inputSchema:iN({type:iH("object"),properties:iU(s4(),nr).optional(),required:iI(s4()).optional()}).catchall(iT()),outputSchema:iN({type:iH("object"),properties:iU(s4(),nr).optional(),required:iI(s4()).optional()}).catchall(iT()).optional(),annotations:aP.optional(),execution:aI.optional(),_meta:iU(s4(),iT()).optional()}),aN=nF.extend({method:iH("tools/list")}),aR=nH.extend({tools:iI(aj)}),aC=nf.extend({content:iI(aS).default([]),structuredContent:iU(s4(),iT()).optional(),isError:i$().optional()});aC.or(nf.extend({toolResult:iT()}));let aA=nu.extend({name:s4(),arguments:iU(s4(),iT()).optional()}),az=nc.extend({method:iH("tools/call"),params:aA}),aM=np.extend({method:iH("notifications/tools/list_changed"),params:nd.optional()}),aD=iN({autoRefresh:i$().default(!0),debounceMs:iv().int().nonnegative().default(300)}),aL=iV(["debug","info","notice","warning","error","critical","alert","emergency"]),aq=nl.extend({level:aL}),aU=nc.extend({method:iH("logging/setLevel"),params:aq}),aZ=nd.extend({level:aL,logger:s4().optional(),data:iT()}),aV=np.extend({method:iH("notifications/message"),params:aZ}),aF=iN({name:s4().optional()}),aH=iN({hints:iI(aF).optional(),costPriority:iv().min(0).max(1).optional(),speedPriority:iv().min(0).max(1).optional(),intelligencePriority:iv().min(0).max(1).optional()}),aK=iN({mode:iV(["auto","required","none"]).optional()}),aG=iN({type:iH("tool_result"),toolUseId:s4().describe("The unique identifier for the corresponding tool call."),content:iI(aS).default([]),structuredContent:iN({}).loose().optional(),isError:i$().optional(),_meta:iU(s4(),iT()).optional()}),aB=iM("type",[ab,aw,a$]),aJ=iM("type",[ab,aw,a$,aE,aG]),aW=iN({role:n3,content:iA([aJ,iI(aJ)]),_meta:iU(s4(),iT()).optional()}),aX=nu.extend({messages:iI(aW),modelPreferences:aH.optional(),systemPrompt:s4().optional(),includeContext:iV(["none","thisServer","allServers"]).optional(),temperature:iv().optional(),maxTokens:iv().int(),stopSequences:iI(s4()).optional(),metadata:nr.optional(),tools:iI(aj).optional(),toolChoice:aK.optional()}),aY=nc.extend({method:iH("sampling/createMessage"),params:aX}),aQ=nf.extend({model:s4(),stopReason:iJ(iV(["endTurn","stopSequence","maxTokens"]).or(s4())),role:n3,content:aB}),a0=nf.extend({model:s4(),stopReason:iJ(iV(["endTurn","stopSequence","maxTokens","toolUse"]).or(s4())),role:n3,content:iA([aJ,iI(aJ)])}),a1=iN({type:iH("boolean"),title:s4().optional(),description:s4().optional(),default:i$().optional()}),a2=iN({type:iH("string"),title:s4().optional(),description:s4().optional(),minLength:iv().optional(),maxLength:iv().optional(),format:iV(["email","uri","date","date-time"]).optional(),default:s4().optional()}),a9=iN({type:iV(["number","integer"]),title:s4().optional(),description:s4().optional(),minimum:iv().optional(),maximum:iv().optional(),default:iv().optional()}),a4=iN({type:iH("string"),title:s4().optional(),description:s4().optional(),enum:iI(s4()),default:s4().optional()}),a6=iN({type:iH("string"),title:s4().optional(),description:s4().optional(),oneOf:iI(iN({const:s4(),title:s4()})),default:s4().optional()}),a5=iN({type:iH("string"),title:s4().optional(),description:s4().optional(),enum:iI(s4()),enumNames:iI(s4()).optional(),default:s4().optional()}),a8=iA([a4,a6]),a3=iA([iN({type:iH("array"),title:s4().optional(),description:s4().optional(),minItems:iv().optional(),maxItems:iv().optional(),items:iN({type:iH("string"),enum:iI(s4())}),default:iI(s4()).optional()}),iN({type:iH("array"),title:s4().optional(),description:s4().optional(),minItems:iv().optional(),maxItems:iv().optional(),items:iN({anyOf:iI(iN({const:s4(),title:s4()}))}),default:iI(s4()).optional()})]),a7=iA([a5,a8,a3]),oe=iA([a7,a1,a2,a9]),ot=iA([nu.extend({mode:iH("form").optional(),message:s4(),requestedSchema:iN({type:iH("object"),properties:iU(s4(),oe),required:iI(s4()).optional()})}),nu.extend({mode:iH("url"),message:s4(),elicitationId:s4(),url:s4().url()})]),or=nc.extend({method:iH("elicitation/create"),params:ot}),os=nd.extend({elicitationId:s4()}),oi=np.extend({method:iH("notifications/elicitation/complete"),params:os}),on=nf.extend({action:iV(["accept","decline","cancel"]),content:i3(e=>null===e?void 0:e,iU(s4(),iA([s4(),iv(),i$(),iI(s4())])).optional())}),oa=iN({type:iH("ref/resource"),uri:s4()}),oo=iN({type:iH("ref/prompt"),name:s4()}),ol=nl.extend({ref:iA([oo,oa]),argument:iN({name:s4(),value:s4()}),context:iN({arguments:iU(s4(),s4()).optional()}).optional()}),ou=nc.extend({method:iH("completion/complete"),params:ol}),oc=nf.extend({completion:iR({values:iI(s4()).max(100),total:iJ(iv().int()),hasMore:iJ(i$())})}),od=iN({uri:s4().startsWith("file://"),name:s4().optional(),_meta:iU(s4(),iT()).optional()}),op=nc.extend({method:iH("roots/list"),params:nl.optional()}),of=nf.extend({roots:iI(od)}),oh=np.extend({method:iH("notifications/roots/list_changed"),params:nd.optional()});iA([nL,nA,ou,aU,a_,ay,ar,ai,ao,ac,ad,az,aN,nX,nQ,n0,n2]),iA([nk,nZ,nD,oh,nW]),iA([n$,aQ,a0,on,of,nY,n1,nB]),iA([nL,aY,or,op,nX,nQ,n0,n2]),iA([nk,nZ,aV,af,au,aM,aO,nW,oi]),iA([n$,nM,oc,aT,ag,as,an,al,aC,aR,nY,n1,nB]);class om extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`),this.code=e,this.data=r,this.name="McpError"}static fromError(e,t,r){return e===g.UrlElicitationRequired&&r&&r.elicitations?new oy(r.elicitations,t):new om(e,t,r)}}class oy extends om{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(g.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}function og(e){return!!e._zod}function ov(e,t){return og(e)?ru(e,t):e.safeParse(t)}function o_(e){let t;if(e&&(t=og(e)?e._zod?.def?.shape:e.shape)){if("function"==typeof t)try{return t()}catch{return}return t}}function ob(e){return"completed"===e||"failed"===e||"cancelled"===e}function ow(e){let t=o_(e),r=t?.method;if(!r)throw Error("Schema is missing a method literal");let s=function(e){if(og(e)){let t=e._zod?.def;if(t){if(void 0!==t.value)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}}let t=e._def;if(t){if(void 0!==t.value)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}let r=e.value;if(void 0!==r)return r}(r);if("string"!=typeof s)throw Error("Schema method literal must be a string");return s}function o$(e,t){let r=ov(e,t);if(!r.success)throw r.error;return r.data}Symbol("Let zodToJsonSchema decide on which parser to use");class oE{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(nk,e=>{this._oncancel(e)}),this.setNotificationHandler(nZ,e=>{this._onprogress(e)}),this.setRequestHandler(nL,e=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(nX,async(e,t)=>{let r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new om(g.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(nQ,async(e,t)=>{let r=async()=>{let s=e.params.taskId;if(this._taskMessageQueue){let e;for(;e=await this._taskMessageQueue.dequeue(s,t.sessionId);){if("response"===e.type||"error"===e.type){let t=e.message,r=t.id,s=this._requestResolvers.get(r);if(s)this._requestResolvers.delete(r),s("response"===e.type?t:new om(t.error.code,t.error.message,t.error.data));else{let t="response"===e.type?"Response":"Error";this._onerror(Error(`${t} handler missing for request ${r}`))}continue}await this._transport?.send(e.message,{relatedRequestId:t.requestId})}}let i=await this._taskStore.getTask(s,t.sessionId);if(!i)throw new om(g.InvalidParams,`Task not found: ${s}`);if(!ob(i.status))return await this._waitForTaskUpdate(s,t.signal),await r();if(ob(i.status)){let e=await this._taskStore.getTaskResult(s,t.sessionId);return this._clearTaskQueue(s),{...e,_meta:{...e._meta,[nt]:{taskId:s}}}}return await r()};return await r()}),this.setRequestHandler(n0,async(e,t)=>{try{let{tasks:r,nextCursor:s}=await this._taskStore.listTasks(e.params?.cursor,t.sessionId);return{tasks:r,nextCursor:s,_meta:{}}}catch(e){throw new om(g.InvalidParams,`Failed to list tasks: ${e instanceof Error?e.message:String(e)}`)}}),this.setRequestHandler(n2,async(e,t)=>{try{let r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new om(g.InvalidParams,`Task not found: ${e.params.taskId}`);if(ob(r.status))throw new om(g.InvalidParams,`Cannot cancel task in terminal status: ${r.status}`);await this._taskStore.updateTaskStatus(e.params.taskId,"cancelled","Client cancelled task execution.",t.sessionId),this._clearTaskQueue(e.params.taskId);let s=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!s)throw new om(g.InvalidParams,`Task not found after cancellation: ${e.params.taskId}`);return{_meta:{},...s}}catch(e){if(e instanceof om)throw e;throw new om(g.InvalidRequest,`Failed to cancel task: ${e instanceof Error?e.message:String(e)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;let t=this._requestHandlerAbortControllers.get(e.params.requestId);t?.abort(e.params.reason)}_setupTimeout(e,t,r,s,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(s,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:i,onTimeout:s})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),om.fromError(g.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let r=this.transport?.onerror;this._transport.onerror=e=>{r?.(e),this._onerror(e)};let s=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{if(s?.(e,t),n_(e)||nb.safeParse(e).success)this._onresponse(e);else if(ny(e))this._onrequest(e,t);else ng.safeParse(e).success?this._onnotification(e):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;for(let e of(this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear(),this._requestHandlerAbortControllers.values()))e.abort();this._requestHandlerAbortControllers.clear();let t=om.fromError(g.ConnectionClosed,"Connection closed");for(let r of(this._transport=void 0,this.onclose?.(),e.values()))r(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;void 0!==t&&Promise.resolve().then(()=>t(e)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let r,s=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,i=this._transport,n=e.params?._meta?.[nt]?.taskId;if(void 0===s){let t={jsonrpc:"2.0",id:e.id,error:{code:g.MethodNotFound,message:"Method not found"}};n&&this._taskMessageQueue?this._enqueueTaskMessage(n,{type:"error",message:t,timestamp:Date.now()},i?.sessionId).catch(e=>this._onerror(Error(`Failed to enqueue error response: ${e}`))):i?.send(t).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(e.id,a);let o=(r=e.params,nu.safeParse(r).success)?e.params.task:void 0,l=this._taskStore?this.requestTaskStore(e,i?.sessionId):void 0,u={signal:a.signal,sessionId:i?.sessionId,_meta:e.params?._meta,sendNotification:async t=>{if(a.signal.aborted)return;let r={relatedRequestId:e.id};n&&(r.relatedTask={taskId:n}),await this.notification(t,r)},sendRequest:async(t,r,s)=>{if(a.signal.aborted)throw new om(g.ConnectionClosed,"Request was cancelled");let i={...s,relatedRequestId:e.id};n&&!i.relatedTask&&(i.relatedTask={taskId:n});let o=i.relatedTask?.taskId??n;return o&&l&&await l.updateTaskStatus(o,"input_required"),await this.request(t,r,i)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:n,taskStore:l,taskRequestedTtl:o?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{o&&this.assertTaskHandlerCapability(e.method)}).then(()=>s(e,u)).then(async t=>{if(a.signal.aborted)return;let r={result:t,jsonrpc:"2.0",id:e.id};n&&this._taskMessageQueue?await this._enqueueTaskMessage(n,{type:"response",message:r,timestamp:Date.now()},i?.sessionId):await i?.send(r)},async t=>{if(a.signal.aborted)return;let r={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:g.InternalError,message:t.message??"Internal error",...void 0!==t.data&&{data:t.data}}};n&&this._taskMessageQueue?await this._enqueueTaskMessage(n,{type:"error",message:r,timestamp:Date.now()},i?.sessionId):await i?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,s=Number(t),i=this._progressHandlers.get(s);if(!i)return void this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));let n=this._responseHandlers.get(s),a=this._timeoutInfo.get(s);if(a&&n&&a.resetTimeoutOnProgress)try{this._resetTimeout(s)}catch(e){this._responseHandlers.delete(s),this._progressHandlers.delete(s),this._cleanupTimeout(s),n(e);return}i(r)}_onresponse(e){let t=Number(e.id),r=this._requestResolvers.get(t);if(r){this._requestResolvers.delete(t),r(n_(e)?e:new om(e.error.code,e.error.message,e.error.data));return}let s=this._responseHandlers.get(t);if(void 0===s)return void this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));this._responseHandlers.delete(t),this._cleanupTimeout(t);let i=!1;if(n_(e)&&e.result&&"object"==typeof e.result){let r=e.result;if(r.task&&"object"==typeof r.task){let e=r.task;"string"==typeof e.taskId&&(i=!0,this._taskProgressTokens.set(e.taskId,t))}}i||this._progressHandlers.delete(t),s(n_(e)?e:om.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}async *requestStream(e,t,r){let s,{task:i}=r??{};if(!i){try{let s=await this.request(e,t,r);yield{type:"result",result:s}}catch(e){yield{type:"error",error:e instanceof om?e:new om(g.InternalError,String(e))}}return}try{let i=await this.request(e,nB,r);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new om(g.InternalError,"Task creation did not return a task");for(;;){let e=await this.getTask({taskId:s},r);if(yield{type:"taskStatus",task:e},ob(e.status)){if("completed"===e.status){let e=await this.getTaskResult({taskId:s},t,r);yield{type:"result",result:e}}else"failed"===e.status?yield{type:"error",error:new om(g.InternalError,`Task ${s} failed`)}:"cancelled"===e.status&&(yield{type:"error",error:new om(g.InternalError,`Task ${s} was cancelled`)});return}if("input_required"===e.status){let e=await this.getTaskResult({taskId:s},t,r);yield{type:"result",result:e};return}let i=e.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(e=>setTimeout(e,i)),r?.signal?.throwIfAborted()}}catch(e){yield{type:"error",error:e instanceof om?e:new om(g.InternalError,String(e))}}}request(e,t,r){let{relatedRequestId:s,resumptionToken:i,onresumptiontoken:n,task:a,relatedTask:o}=r??{};return new Promise((l,u)=>{let c=e=>{u(e)};if(!this._transport)return void c(Error("Not connected"));if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(e){c(e);return}r?.signal?.throwIfAborted();let d=this._requestMessageId++,p={...e,jsonrpc:"2.0",id:d};r?.onprogress&&(this._progressHandlers.set(d,r.onprogress),p.params={...e.params,_meta:{...e.params?._meta||{},progressToken:d}}),a&&(p.params={...p.params,task:a}),o&&(p.params={...p.params,_meta:{...p.params?._meta||{},[nt]:o}});let f=e=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:d,reason:String(e)}},{relatedRequestId:s,resumptionToken:i,onresumptiontoken:n}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))),u(e instanceof om?e:new om(g.RequestTimeout,String(e)))};this._responseHandlers.set(d,e=>{if(!r?.signal?.aborted){if(e instanceof Error)return u(e);try{let r=ov(t,e.result);r.success?l(r.data):u(r.error)}catch(e){u(e)}}}),r?.signal?.addEventListener("abort",()=>{f(r?.signal?.reason)});let h=r?.timeout??6e4;this._setupTimeout(d,h,r?.maxTotalTimeout,()=>f(om.fromError(g.RequestTimeout,"Request timed out",{timeout:h})),r?.resetTimeoutOnProgress??!1);let m=o?.taskId;if(m){let e=e=>{let t=this._responseHandlers.get(d);t?t(e):this._onerror(Error(`Response handler missing for side-channeled request ${d}`))};this._requestResolvers.set(d,e),this._enqueueTaskMessage(m,{type:"request",message:p,timestamp:Date.now()}).catch(e=>{this._cleanupTimeout(d),u(e)})}else this._transport.send(p,{relatedRequestId:s,resumptionToken:i,onresumptiontoken:n}).catch(e=>{this._cleanupTimeout(d),u(e)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},nY,t)}async getTaskResult(e,t,r){return this.request({method:"tasks/result",params:e},t,r)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},n1,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},n9,t)}async notification(e,t){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(e.method);let r=t?.relatedTask?.taskId;if(r){let s={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[nt]:t.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let r={...e,jsonrpc:"2.0"};t?.relatedTask&&(r={...r,params:{...r.params,_meta:{...r.params?._meta||{},[nt]:t.relatedTask}}}),this._transport?.send(r,t).catch(e=>this._onerror(e))});return}let s={...e,jsonrpc:"2.0"};t?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[nt]:t.relatedTask}}}),await this._transport.send(s,t)}setRequestHandler(e,t){let r=ow(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(r,s)=>Promise.resolve(t(o$(e,r),s)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let r=ow(e);this._notificationHandlers.set(r,r=>Promise.resolve(t(o$(e,r))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);void 0!==t&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,r){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let s=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,r,s)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){for(let r of(await this._taskMessageQueue.dequeueAll(e,t)))if("request"===r.type&&ny(r.message)){let t=r.message.id,s=this._requestResolvers.get(t);s?(s(new om(g.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(t)):this._onerror(Error(`Resolver missing for request ${t} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let r=this._options?.defaultTaskPollInterval??1e3;try{let t=await this._taskStore?.getTask(e);t?.pollInterval&&(r=t.pollInterval)}catch{}return new Promise((e,s)=>{if(t.aborted)return void s(new om(g.InvalidRequest,"Request cancelled"));let i=setTimeout(e,r);t.addEventListener("abort",()=>{clearTimeout(i),s(new om(g.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){let r=this._taskStore;if(!r)throw Error("No task store configured");return{createTask:async s=>{if(!e)throw Error("No request provided");return await r.createTask(s,e.id,{method:e.method,params:e.params},t)},getTask:async e=>{let s=await r.getTask(e,t);if(!s)throw new om(g.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(e,s,i)=>{await r.storeTaskResult(e,s,i,t);let n=await r.getTask(e,t);if(n){let t=nW.parse({method:"notifications/tasks/status",params:n});await this.notification(t),ob(n.status)&&this._cleanupTaskProgressHandler(e)}},getTaskResult:e=>r.getTaskResult(e,t),updateTaskStatus:async(e,s,i)=>{let n=await r.getTask(e,t);if(!n)throw new om(g.InvalidParams,`Task "${e}" not found - it may have been cleaned up`);if(ob(n.status))throw new om(g.InvalidParams,`Cannot update task "${e}" from terminal status "${n.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(e,s,i,t);let a=await r.getTask(e,t);if(a){let t=nW.parse({method:"notifications/tasks/status",params:a});await this.notification(t),ob(a.status)&&this._cleanupTaskProgressHandler(e)}},listTasks:e=>r.listTasks(e,t)}}}function ok(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}var oS=i(8825),ox=i(1712);class oT{constructor(e){this._ajv=e??function(){let e=new oS({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return ox(e),e}()}getValidator(e){let t="$id"in e&&"string"==typeof e.$id?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return e=>t(e)?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}class oO{constructor(e){this._client=e}async *callToolStream(e,t=aC,r){let s=this._client,i={...r,task:r?.task??(s.isToolTask(e.name)?{}:void 0)},n=s.requestStream({method:"tools/call",params:e},t,i),a=s.getToolOutputValidator(e.name);for await(let t of n){if("result"===t.type&&a){let r=t.result;if(!r.structuredContent&&!r.isError)return void(yield{type:"error",error:new om(g.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)});if(r.structuredContent)try{let e=a(r.structuredContent);if(!e.valid)return void(yield{type:"error",error:new om(g.InvalidParams,`Structured content does not match the tool's output schema: ${e.errorMessage}`)})}catch(e){if(e instanceof om)return void(yield{type:"error",error:e});yield{type:"error",error:new om(g.InvalidParams,`Failed to validate structured content: ${e instanceof Error?e.message:String(e)}`)};return}}yield t}}async getTask(e,t){return this._client.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._client.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._client.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._client.cancelTask({taskId:e},t)}requestStream(e,t,r){return this._client.requestStream(e,t,r)}}class oP extends oE{constructor(e,t){super(t),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=t?.capabilities??{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new oT,t?.listChanged&&(this._pendingListChangedConfig=t.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",aM,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",aO,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",au,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new oO(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=function(e,t){let r={...e};for(let e in t){let s=t[e];if(void 0===s)continue;let i=r[e];ok(i)&&ok(s)?r[e]={...i,...s}:r[e]=s}return r}(this._capabilities,e)}setRequestHandler(e,t){let r,s=o_(e),i=s?.method;if(!i)throw Error("Schema is missing a method literal");if(og(i)){let e=i._zod?.def;r=e?.value??i.value}else{let e=i._def;r=e?.value??i.value}if("string"!=typeof r)throw Error("Schema method literal must be a string");let n=r;if("elicitation/create"===n){let r=async(e,r)=>{let s=ov(or,e);if(!s.success){let e=s.error instanceof Error?s.error.message:String(s.error);throw new om(g.InvalidParams,`Invalid elicitation request: ${e}`)}let{params:i}=s.data;i.mode=i.mode??"form";let{supportsFormMode:n,supportsUrlMode:a}=function(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=void 0!==e.form,r=void 0!==e.url;return{supportsFormMode:t||!t&&!r,supportsUrlMode:r}}(this._capabilities.elicitation);if("form"===i.mode&&!n)throw new om(g.InvalidParams,"Client does not support form-mode elicitation requests");if("url"===i.mode&&!a)throw new om(g.InvalidParams,"Client does not support URL-mode elicitation requests");let o=await Promise.resolve(t(e,r));if(i.task){let e=ov(nB,o);if(!e.success){let t=e.error instanceof Error?e.error.message:String(e.error);throw new om(g.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}let l=ov(on,o);if(!l.success){let e=l.error instanceof Error?l.error.message:String(l.error);throw new om(g.InvalidParams,`Invalid elicitation result: ${e}`)}let u=l.data,c="form"===i.mode?i.requestedSchema:void 0;if("form"===i.mode&&"accept"===u.action&&u.content&&c&&this._capabilities.elicitation?.form?.applyDefaults)try{!function e(t,r){if(t&&null!==r&&"object"==typeof r){if("object"===t.type&&t.properties&&"object"==typeof t.properties){let s=t.properties;for(let t of Object.keys(s)){let i=s[t];void 0===r[t]&&Object.prototype.hasOwnProperty.call(i,"default")&&(r[t]=i.default),void 0!==r[t]&&e(i,r[t])}}if(Array.isArray(t.anyOf))for(let s of t.anyOf)"boolean"!=typeof s&&e(s,r);if(Array.isArray(t.oneOf))for(let s of t.oneOf)"boolean"!=typeof s&&e(s,r)}}(c,u.content)}catch{}return u};return super.setRequestHandler(e,r)}if("sampling/createMessage"===n){let r=async(e,r)=>{let s=ov(aY,e);if(!s.success){let e=s.error instanceof Error?s.error.message:String(s.error);throw new om(g.InvalidParams,`Invalid sampling request: ${e}`)}let{params:i}=s.data,n=await Promise.resolve(t(e,r));if(i.task){let e=ov(nB,n);if(!e.success){let t=e.error instanceof Error?e.error.message:String(e.error);throw new om(g.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}let a=ov(i.tools||i.toolChoice?a0:aQ,n);if(!a.success){let e=a.error instanceof Error?a.error.message:String(a.error);throw new om(g.InvalidParams,`Invalid sampling result: ${e}`)}return a.data};return super.setRequestHandler(e,r)}return super.setRequestHandler(e,t)}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),void 0===e.sessionId)try{let r=await this.request({method:"initialize",params:{protocolVersion:i7,capabilities:this._capabilities,clientInfo:this._clientInfo}},nM,t);if(void 0===r)throw Error(`Server sent invalid initialize result: ${r}`);if(!ne.includes(r.protocolVersion))throw Error(`Server's protocol version is not supported: ${r.protocolVersion}`);this._serverCapabilities=r.capabilities,this._serverVersion=r.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(r.protocolVersion),this._instructions=r.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(e){throw this.close(),e}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw Error(`Server does not support resources (required for ${e})`);if("resources/subscribe"===e&&!this._serverCapabilities.resources.subscribe)throw Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw Error(`Server does not support completions (required for ${e})`)}}assertNotificationCapability(e){if("notifications/roots/list_changed"===e&&!this._capabilities.roots?.listChanged)throw Error(`Client does not support roots list changed notifications (required for ${e})`)}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Client does not support tasks capability (required for ${e})`)}}assertTaskCapability(e){var t=this._serverCapabilities?.tasks?.requests,r="Server";if(!t)throw Error(`${r} does not support task creation (required for ${e})`);if("tools/call"===e&&!t.tools?.call)throw Error(`${r} does not support task creation for tools/call (required for ${e})`)}assertTaskHandlerCapability(e){if(this._capabilities){var t=this._capabilities.tasks?.requests,r="Client";if(!t)throw Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw Error(`${r} does not support task creation for elicitation/create (required for ${e})`)}}}async ping(e){return this.request({method:"ping"},n$,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},oc,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},n$,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},aT,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},ag,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},as,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},an,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},al,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},n$,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},n$,t)}async callTool(e,t=aC,r){if(this.isToolTaskRequired(e.name))throw new om(g.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let s=await this.request({method:"tools/call",params:e},t,r),i=this.getToolOutputValidator(e.name);if(i){if(!s.structuredContent&&!s.isError)throw new om(g.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(s.structuredContent)try{let e=i(s.structuredContent);if(!e.valid)throw new om(g.InvalidParams,`Structured content does not match the tool's output schema: ${e.errorMessage}`)}catch(e){if(e instanceof om)throw e;throw new om(g.InvalidParams,`Failed to validate structured content: ${e instanceof Error?e.message:String(e)}`)}}return s}isToolTask(e){return!!this._serverCapabilities?.tasks?.requests?.tools?.call&&this._cachedKnownTaskTools.has(e)}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){for(let t of(this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear(),e)){if(t.outputSchema){let e=this._jsonSchemaValidator.getValidator(t.outputSchema);this._cachedToolOutputValidators.set(t.name,e)}let e=t.execution?.taskSupport;("required"===e||"optional"===e)&&this._cachedKnownTaskTools.add(t.name),"required"===e&&this._cachedRequiredTaskTools.add(t.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){let r=await this.request({method:"tools/list",params:e},aR,t);return this.cacheToolMetadata(r.tools),r}_setupListChangedHandler(e,t,r,s){let i=aD.safeParse(r);if(!i.success)throw Error(`Invalid ${e} listChanged options: ${i.error.message}`);if("function"!=typeof r.onChanged)throw Error(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:n,debounceMs:a}=i.data,{onChanged:o}=r,l=async()=>{if(!n)return void o(null,null);try{let e=await s();o(null,e)}catch(e){o(e instanceof Error?e:Error(String(e)),null)}},u=()=>{if(a){let t=this._listChangedDebounceTimers.get(e);t&&clearTimeout(t);let r=setTimeout(l,a);this._listChangedDebounceTimers.set(e,r)}else l()};this.setNotificationHandler(t,u)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}var oI=i(6507);let oj=require("node:process"),oN=require("node:stream");class oR{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){var e;if(!this._buffer)return null;let t=this._buffer.indexOf("\n");if(-1===t)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),e=r,nw.parse(JSON.parse(e))}clear(){this._buffer=void 0}}let oC="win32"===oj.platform?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];class oA{constructor(e){this._readBuffer=new oR,this._stderrStream=null,this._serverParams=e,("pipe"===e.stderr||"overlapped"===e.stderr)&&(this._stderrStream=new oN.PassThrough)}async start(){if(this._process)throw Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,t)=>{this._process=oI(this._serverParams.command,this._serverParams.args??[],{env:{...function(){let e={};for(let t of oC){let r=oj.env[t];void 0!==r&&(r.startsWith("()")||(e[t]=r))}return e}(),...this._serverParams.env},stdio:["pipe","pipe",this._serverParams.stderr??"inherit"],shell:!1,windowsHide:"win32"===oj.platform&&"type"in process,cwd:this._serverParams.cwd}),this._process.on("error",e=>{t(e),this.onerror?.(e)}),this._process.on("spawn",()=>{e()}),this._process.on("close",e=>{this._process=void 0,this.onclose?.()}),this._process.stdin?.on("error",e=>{this.onerror?.(e)}),this._process.stdout?.on("data",e=>{this._readBuffer.append(e),this.processReadBuffer()}),this._process.stdout?.on("error",e=>{this.onerror?.(e)}),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 e=this._readBuffer.readMessage();if(null===e)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){if(this._process){let e=this._process;this._process=void 0;let t=new Promise(t=>{e.once("close",()=>{t()})});try{e.stdin?.end()}catch{}if(await Promise.race([t,new Promise(e=>setTimeout(e,2e3).unref())]),null===e.exitCode){try{e.kill("SIGTERM")}catch{}await Promise.race([t,new Promise(e=>setTimeout(e,2e3).unref())])}if(null===e.exitCode)try{e.kill("SIGKILL")}catch{}}this._readBuffer.clear()}send(e){return new Promise(t=>{if(!this._process?.stdin)throw Error("Not connected");let r=JSON.stringify(e)+"\n";this._process.stdin.write(r)?t():this._process.stdin.once("drain",t)})}}function oz(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}async function oM(e){return(await t).getRandomValues(new Uint8Array(e))}async function oD(e){let t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r=256-256%t.length,s="";for(;s.length<e;)for(let i of(await oM(e-s.length)))i<r&&(s+=t[i%t.length]);return s}async function oL(e){return await oD(e)}async function oq(e){return btoa(String.fromCharCode(...new Uint8Array(await (await t).subtle.digest("SHA-256",new TextEncoder().encode(e))))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function oU(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await oL(e),r=await oq(t);return{code_verifier:t,code_challenge:r}}t=globalThis.crypto?.webcrypto??globalThis.crypto??Promise.resolve().then(i.t.bind(i,7598,19)).then(e=>e.webcrypto);v||(v={});let oZ=sv(s7,void 0).superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:"custom",message:"URL must be parseable",fatal:!0}),e1}).refine(e=>{let t=new URL(e);return"javascript:"!==t.protocol&&"data:"!==t.protocol&&"vbscript:"!==t.protocol},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),oV=iR({resource:s4().url(),authorization_servers:iI(oZ).optional(),jwks_uri:s4().url().optional(),scopes_supported:iI(s4()).optional(),bearer_methods_supported:iI(s4()).optional(),resource_signing_alg_values_supported:iI(s4()).optional(),resource_name:s4().optional(),resource_documentation:s4().optional(),resource_policy_uri:s4().url().optional(),resource_tos_uri:s4().url().optional(),tls_client_certificate_bound_access_tokens:i$().optional(),authorization_details_types_supported:iI(s4()).optional(),dpop_signing_alg_values_supported:iI(s4()).optional(),dpop_bound_access_tokens_required:i$().optional()}),oF=iR({issuer:s4(),authorization_endpoint:oZ,token_endpoint:oZ,registration_endpoint:oZ.optional(),scopes_supported:iI(s4()).optional(),response_types_supported:iI(s4()),response_modes_supported:iI(s4()).optional(),grant_types_supported:iI(s4()).optional(),token_endpoint_auth_methods_supported:iI(s4()).optional(),token_endpoint_auth_signing_alg_values_supported:iI(s4()).optional(),service_documentation:oZ.optional(),revocation_endpoint:oZ.optional(),revocation_endpoint_auth_methods_supported:iI(s4()).optional(),revocation_endpoint_auth_signing_alg_values_supported:iI(s4()).optional(),introspection_endpoint:s4().optional(),introspection_endpoint_auth_methods_supported:iI(s4()).optional(),introspection_endpoint_auth_signing_alg_values_supported:iI(s4()).optional(),code_challenge_methods_supported:iI(s4()).optional(),client_id_metadata_document_supported:i$().optional()}),oH=iN({...iR({issuer:s4(),authorization_endpoint:oZ,token_endpoint:oZ,userinfo_endpoint:oZ.optional(),jwks_uri:oZ,registration_endpoint:oZ.optional(),scopes_supported:iI(s4()).optional(),response_types_supported:iI(s4()),response_modes_supported:iI(s4()).optional(),grant_types_supported:iI(s4()).optional(),acr_values_supported:iI(s4()).optional(),subject_types_supported:iI(s4()),id_token_signing_alg_values_supported:iI(s4()),id_token_encryption_alg_values_supported:iI(s4()).optional(),id_token_encryption_enc_values_supported:iI(s4()).optional(),userinfo_signing_alg_values_supported:iI(s4()).optional(),userinfo_encryption_alg_values_supported:iI(s4()).optional(),userinfo_encryption_enc_values_supported:iI(s4()).optional(),request_object_signing_alg_values_supported:iI(s4()).optional(),request_object_encryption_alg_values_supported:iI(s4()).optional(),request_object_encryption_enc_values_supported:iI(s4()).optional(),token_endpoint_auth_methods_supported:iI(s4()).optional(),token_endpoint_auth_signing_alg_values_supported:iI(s4()).optional(),display_values_supported:iI(s4()).optional(),claim_types_supported:iI(s4()).optional(),claims_supported:iI(s4()).optional(),service_documentation:s4().optional(),claims_locales_supported:iI(s4()).optional(),ui_locales_supported:iI(s4()).optional(),claims_parameter_supported:i$().optional(),request_parameter_supported:i$().optional(),request_uri_parameter_supported:i$().optional(),require_request_uri_registration:i$().optional(),op_policy_uri:oZ.optional(),op_tos_uri:oZ.optional(),client_id_metadata_document_supported:i$().optional()}).shape,...oF.pick({code_challenge_methods_supported:!0}).shape}),oK=iN({access_token:s4(),id_token:s4().optional(),token_type:s4(),expires_in:new ig({type:"number",coerce:!0,checks:[],...tU(void 0)}).optional(),scope:s4().optional(),refresh_token:s4().optional()}).strip(),oG=iN({error:s4(),error_description:s4().optional(),error_uri:s4().optional()}),oB=oZ.optional().or(iH("").transform(()=>void 0)),oJ=iN({redirect_uris:iI(oZ),token_endpoint_auth_method:s4().optional(),grant_types:iI(s4()).optional(),response_types:iI(s4()).optional(),client_name:s4().optional(),client_uri:oZ.optional(),logo_uri:oB,scope:s4().optional(),contacts:iI(s4()).optional(),tos_uri:oB,policy_uri:s4().optional(),jwks_uri:oZ.optional(),jwks:new iS({type:"any"}).optional(),software_id:s4().optional(),software_version:s4().optional(),software_statement:s4().optional()}).strip(),oW=iN({client_id:s4(),client_secret:s4().optional(),client_id_issued_at:iv().optional(),client_secret_expires_at:iv().optional()}).strip(),oX=oJ.merge(oW);iN({error:s4(),error_description:s4().optional()}).strip(),iN({token:s4(),token_type_hint:s4().optional()}).strip();class oY extends Error{constructor(e,t){super(e),this.errorUri=t,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}}class oQ extends oY{}oQ.errorCode="invalid_request";class o0 extends oY{}o0.errorCode="invalid_client";class o1 extends oY{}o1.errorCode="invalid_grant";class o2 extends oY{}o2.errorCode="unauthorized_client";class o9 extends oY{}o9.errorCode="unsupported_grant_type";class o4 extends oY{}o4.errorCode="invalid_scope";class o6 extends oY{}o6.errorCode="access_denied";class o5 extends oY{}o5.errorCode="server_error";class o8 extends oY{}o8.errorCode="temporarily_unavailable";class o3 extends oY{}o3.errorCode="unsupported_response_type";class o7 extends oY{}o7.errorCode="unsupported_token_type";class le extends oY{}le.errorCode="invalid_token";class lt extends oY{}lt.errorCode="method_not_allowed";class lr extends oY{}lr.errorCode="too_many_requests";class ls extends oY{}ls.errorCode="invalid_client_metadata";class li extends oY{}li.errorCode="insufficient_scope";class ln extends oY{}ln.errorCode="invalid_target";let la={[oQ.errorCode]:oQ,[o0.errorCode]:o0,[o1.errorCode]:o1,[o2.errorCode]:o2,[o9.errorCode]:o9,[o4.errorCode]:o4,[o6.errorCode]:o6,[o5.errorCode]:o5,[o8.errorCode]:o8,[o3.errorCode]:o3,[o7.errorCode]:o7,[le.errorCode]:le,[lt.errorCode]:lt,[lr.errorCode]:lr,[ls.errorCode]:ls,[li.errorCode]:li,[ln.errorCode]:ln};class lo extends Error{constructor(e){super(e??"Unauthorized")}}let ll="code",lu="S256";async function lc(e){let t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{let{error:e,error_description:t,error_uri:s}=oG.parse(JSON.parse(r));return new(la[e]||o5)(t||"",s)}catch(e){return new o5(`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${e}. Raw body: ${r}`)}}async function ld(e,t){try{return await lp(e,t)}catch(r){if(r instanceof o0||r instanceof o2)return await e.invalidateCredentials?.("all"),await lp(e,t);if(r instanceof o1)return await e.invalidateCredentials?.("tokens"),await lp(e,t);throw r}}async function lp(e,{serverUrl:t,authorizationCode:r,scope:s,resourceMetadataUrl:i,fetchFn:n}){let a,o;try{(a=await ly(t,{resourceMetadataUrl:i},n)).authorization_servers&&a.authorization_servers.length>0&&(o=a.authorization_servers[0])}catch{}o||(o=new URL("/",t));let l=await lf(t,e,a),u=await lb(o,{fetchFn:n}),c=await Promise.resolve(e.clientInformation());if(!c){if(void 0!==r)throw Error("Existing OAuth client information is required when exchanging an authorization code");let t=u?.client_id_metadata_document_supported===!0,s=e.clientMetadataUrl;if(s&&!function(e){if(!e)return!1;try{let t=new URL(e);return"https:"===t.protocol&&"/"!==t.pathname}catch{return!1}}(s))throw new ls(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${s}`);if(t&&s)c={client_id:s},await e.saveClientInformation?.(c);else{if(!e.saveClientInformation)throw Error("OAuth client information must be saveable for dynamic registration");let t=await lS(o,{metadata:u,clientMetadata:e.clientMetadata,fetchFn:n});await e.saveClientInformation(t),c=t}}let d=!e.redirectUrl;if(void 0!==r||d){let t=await lk(e,o,{metadata:u,resource:l,authorizationCode:r,fetchFn:n});return await e.saveTokens(t),"AUTHORIZED"}let p=await e.tokens();if(p?.refresh_token)try{let t=await lE(o,{metadata:u,clientInformation:c,refreshToken:p.refresh_token,resource:l,addClientAuthentication:e.addClientAuthentication,fetchFn:n});return await e.saveTokens(t),"AUTHORIZED"}catch(e){if(!(e instanceof oY)||e instanceof o5);else throw e}let f=e.state?await e.state():void 0,{authorizationUrl:h,codeVerifier:m}=await lw(o,{metadata:u,clientInformation:c,state:f,redirectUrl:e.redirectUrl,scope:s||a?.scopes_supported?.join(" ")||e.clientMetadata.scope,resource:l});return await e.saveCodeVerifier(m),await e.redirectToAuthorization(h),"REDIRECT"}async function lf(e,t,r){let s,i=((s=new URL("string"==typeof e?e:e.href)).hash="",s);if(t.validateResourceURL)return await t.validateResourceURL(i,r?.resource);if(r){if(!function({requestedResource:e,configuredResource:t}){let r=new URL("string"==typeof e?e:e.href),s=new URL("string"==typeof t?t:t.href);if(r.origin!==s.origin||r.pathname.length<s.pathname.length)return!1;let i=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",n=s.pathname.endsWith("/")?s.pathname:s.pathname+"/";return i.startsWith(n)}({requestedResource:i,configuredResource:r.resource}))throw Error(`Protected resource ${r.resource} does not match expected ${i} (or origin)`);return new URL(r.resource)}}function lh(e){let t,r=e.headers.get("WWW-Authenticate");if(!r)return{};let[s,i]=r.split(" ");if("bearer"!==s.toLowerCase()||!i)return{};let n=lm(e,"resource_metadata")||void 0;if(n)try{t=new URL(n)}catch{}return{resourceMetadataUrl:t,scope:lm(e,"scope")||void 0,error:lm(e,"error")||void 0}}function lm(e,t){let r=e.headers.get("WWW-Authenticate");if(!r)return null;let s=RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),i=r.match(s);return i?i[1]||i[2]:null}async function ly(e,t,r=fetch){let s=await l_(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!s||404===s.status)throw await s?.body?.cancel(),Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!s.ok)throw await s.body?.cancel(),Error(`HTTP ${s.status} trying to load well-known OAuth protected resource metadata.`);return oV.parse(await s.json())}async function lg(e,t,r=fetch){try{return await r(e,{headers:t})}catch(s){if(s instanceof TypeError)if(t)return lg(e,void 0,r);else return;throw s}}async function lv(e,t,r=fetch){return await lg(e,{"MCP-Protocol-Version":t},r)}async function l_(e,t,r,s){var i,n;let a,o=new URL(e),l=s?.protocolVersion??i7;s?.metadataUrl?a=new URL(s.metadataUrl):(a=new URL(function(e,t="",r={}){return t.endsWith("/")&&(t=t.slice(0,-1)),r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}(t,o.pathname),s?.metadataServerUrl??o)).search=o.search;let u=await lv(a,l,r);if(!s?.metadataUrl&&(i=u,n=o.pathname,!i||i.status>=400&&i.status<500&&"/"!==n)){let e=new URL(`/.well-known/${t}`,o);u=await lv(e,l,r)}return u}async function lb(e,{fetchFn:t=fetch,protocolVersion:r=i7}={}){let s={"MCP-Protocol-Version":r,Accept:"application/json"};for(let{url:r,type:i}of function(e){let t="string"==typeof e?new URL(e):e,r="/"!==t.pathname,s=[];if(!r)return s.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),s.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),s;let i=t.pathname;return i.endsWith("/")&&(i=i.slice(0,-1)),s.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,t.origin),type:"oauth"}),s.push({url:new URL(`/.well-known/openid-configuration${i}`,t.origin),type:"oidc"}),s.push({url:new URL(`${i}/.well-known/openid-configuration`,t.origin),type:"oidc"}),s}(e)){let e=await lg(r,s,t);if(e){if(!e.ok){if(await e.body?.cancel(),e.status>=400&&e.status<500)continue;throw Error(`HTTP ${e.status} trying to load ${"oauth"===i?"OAuth":"OpenID provider"} metadata from ${r}`)}if("oauth"===i)return oF.parse(await e.json());return oH.parse(await e.json())}}}async function lw(e,{metadata:t,clientInformation:r,redirectUrl:s,scope:i,state:n,resource:a}){let o;if(t){if(o=new URL(t.authorization_endpoint),!t.response_types_supported.includes(ll))throw Error(`Incompatible auth server: does not support response type ${ll}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(lu))throw Error(`Incompatible auth server: does not support code challenge method ${lu}`)}else o=new URL("/authorize",e);let l=await oU(),u=l.code_verifier,c=l.code_challenge;return o.searchParams.set("response_type",ll),o.searchParams.set("client_id",r.client_id),o.searchParams.set("code_challenge",c),o.searchParams.set("code_challenge_method",lu),o.searchParams.set("redirect_uri",String(s)),n&&o.searchParams.set("state",n),i&&o.searchParams.set("scope",i),i?.includes("offline_access")&&o.searchParams.append("prompt","consent"),a&&o.searchParams.set("resource",a.href),{authorizationUrl:o,codeVerifier:u}}async function l$(e,{metadata:t,tokenRequestParams:r,clientInformation:s,addClientAuthentication:i,resource:n,fetchFn:a}){var o,l;let u,c=t?.token_endpoint?new URL(t.token_endpoint):new URL("/token",e),d=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});n&&r.set("resource",n.href),i?await i(d,r,c,t):s&&function(e,t,r,s){let{client_id:i,client_secret:n}=t;switch(e){case"client_secret_basic":var a,o,l,u,c=i,d=n,p=r;if(!d)throw Error("client_secret_basic authentication requires a client_secret");let f=btoa(`${c}:${d}`);p.set("Authorization",`Basic ${f}`);return;case"client_secret_post":a=i,o=n,(l=s).set("client_id",a),o&&l.set("client_secret",o);return;case"none":u=i,s.set("client_id",u);return;default:throw Error(`Unsupported client authentication method: ${e}`)}}((o=s,l=t?.token_endpoint_auth_methods_supported??[],u=void 0!==o.client_secret,0===l.length?u?"client_secret_post":"none":"token_endpoint_auth_method"in o&&o.token_endpoint_auth_method&&["client_secret_basic","client_secret_post","none"].includes(o.token_endpoint_auth_method)&&l.includes(o.token_endpoint_auth_method)?o.token_endpoint_auth_method:u&&l.includes("client_secret_basic")?"client_secret_basic":u&&l.includes("client_secret_post")?"client_secret_post":l.includes("none")?"none":u?"client_secret_post":"none"),s,d,r);let p=await (a??fetch)(c,{method:"POST",headers:d,body:r});if(!p.ok)throw await lc(p);return oK.parse(await p.json())}async function lE(e,{metadata:t,clientInformation:r,refreshToken:s,resource:i,addClientAuthentication:n,fetchFn:a}){let o=new URLSearchParams({grant_type:"refresh_token",refresh_token:s});return{refresh_token:s,...await l$(e,{metadata:t,tokenRequestParams:o,clientInformation:r,addClientAuthentication:n,resource:i,fetchFn:a})}}async function lk(e,t,{metadata:r,resource:s,authorizationCode:i,fetchFn:n}={}){let a,o=e.clientMetadata.scope;if(e.prepareTokenRequest&&(a=await e.prepareTokenRequest(o)),!a){if(!i)throw Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw Error("redirectUrl is required for authorization_code flow");a=new URLSearchParams({grant_type:"authorization_code",code:i,code_verifier:await e.codeVerifier(),redirect_uri:String(e.redirectUrl)})}return l$(t,{metadata:r,tokenRequestParams:a,clientInformation:await e.clientInformation()??void 0,addClientAuthentication:e.addClientAuthentication,resource:s,fetchFn:n})}async function lS(e,{metadata:t,clientMetadata:r,fetchFn:s}){let i;if(t){if(!t.registration_endpoint)throw Error("Incompatible auth server: does not support dynamic client registration");i=new URL(t.registration_endpoint)}else i=new URL("/register",e);let n=await (s??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!n.ok)throw await lc(n);return oX.parse(await n.json())}class lx extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}function lT(e){}class lO extends TransformStream{constructor({onError:e,onRetry:t,onComment:r}={}){let s;super({start(i){s=function(e){if("function"==typeof e)throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:t=lT,onError:r=lT,onRetry:s=lT,onComment:i}=e,n="",a=!0,o,l="",u="";function c(e){if(""===e)return void(l.length>0&&t({id:o,event:u||void 0,data:l.endsWith(`
|
|
69
|
-
`)?l.slice(0,-1):l}),
|
|
70
|
-
`;break;case"id":
|
|
71
|
-
`,s),
|
|
72
|
-
`&&s++}}return[t,r]}(`${n}${t}`);for(let e of r)c(e);n=s,a=!1},reset:function(e={}){n&&e.consume&&c(n),a=!0,o=void 0,l="",u="",n=""}}}({onEvent:e=>{i.enqueue(e)},onError(t){"terminate"===e?i.error(t):"function"==typeof e&&e(t)},onRetry:t,onComment:r})},transform(e){s.feed(e)}})}}let lP={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class lI extends Error{constructor(e,t){super(`Streamable HTTP error: ${t}`),this.code=e}}class lj{constructor(e,t){this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=t?.requestInit,this._authProvider=t?.authProvider,this._fetch=t?.fetch,this._fetchWithInit=function(e=fetch,t){return t?async(r,s)=>e(r,{...t,...s,headers:s?.headers?{...oz(t.headers),...oz(s.headers)}:t.headers}):e}(t?.fetch,t?.requestInit),this._sessionId=t?.sessionId,this._reconnectionOptions=t?.reconnectionOptions??lP}async _authThenStart(){let e;if(!this._authProvider)throw new lo("No auth provider");try{e=await ld(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(e){throw this.onerror?.(e),e}if("AUTHORIZED"!==e)throw new lo;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let e={};if(this._authProvider){let t=await this._authProvider.tokens();t&&(e.Authorization=`Bearer ${t.access_token}`)}this._sessionId&&(e["mcp-session-id"]=this._sessionId),this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);let t=oz(this._requestInit?.headers);return new Headers({...e,...t})}async _startOrAuthSse(e){let{resumptionToken:t}=e;try{let r=await this._commonHeaders();r.set("Accept","text/event-stream"),t&&r.set("last-event-id",t);let s=await (this._fetch??fetch)(this._url,{method:"GET",headers:r,signal:this._abortController?.signal});if(!s.ok){if(await s.body?.cancel(),401===s.status&&this._authProvider)return await this._authThenStart();if(405===s.status)return;throw new lI(s.status,`Failed to open SSE stream: ${s.statusText}`)}this._handleSseStream(s.body,e,!0)}catch(e){throw this.onerror?.(e),e}}_getNextReconnectionDelay(e){return void 0!==this._serverRetryMs?this._serverRetryMs:Math.min(this._reconnectionOptions.initialReconnectionDelay*Math.pow(this._reconnectionOptions.reconnectionDelayGrowFactor,e),this._reconnectionOptions.maxReconnectionDelay)}_scheduleReconnection(e,t=0){let r=this._reconnectionOptions.maxRetries;if(t>=r)return void this.onerror?.(Error(`Maximum reconnection attempts (${r}) exceeded.`));let s=this._getNextReconnectionDelay(t);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(r=>{this.onerror?.(Error(`Failed to reconnect SSE stream: ${r instanceof Error?r.message:String(r)}`)),this._scheduleReconnection(e,t+1)})},s)}_handleSseStream(e,t,r){let s;if(!e)return;let{onresumptiontoken:i,replayMessageId:n}=t,a=!1,o=!1;(async()=>{try{let t=e.pipeThrough(new TextDecoderStream).pipeThrough(new lO({onRetry:e=>{this._serverRetryMs=e}})).getReader();for(;;){let{value:e,done:r}=await t.read();if(r)break;if((e.id&&(s=e.id,a=!0,i?.(e.id)),e.data)&&(!e.event||"message"===e.event))try{let t=nw.parse(JSON.parse(e.data));n_(t)&&(o=!0,void 0!==n&&(t.id=n)),this.onmessage?.(t)}catch(e){this.onerror?.(e)}}(r||a)&&!o&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:s,onresumptiontoken:i,replayMessageId:n},0)}catch(e){if(this.onerror?.(Error(`SSE stream disconnected: ${e}`)),(r||a)&&!o&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:s,onresumptiontoken:i,replayMessageId:n},0)}catch(e){this.onerror?.(Error(`Failed to reconnect: ${e instanceof Error?e.message:String(e)}`))}}})()}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(e){if(!this._authProvider)throw new lo("No auth provider");if("AUTHORIZED"!==await ld(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit}))throw new lo("Failed to authorize")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(e,t){try{let{resumptionToken:r,onresumptiontoken:s}=t||{};if(r)return void this._startOrAuthSse({resumptionToken:r,replayMessageId:ny(e)?e.id:void 0}).catch(e=>this.onerror?.(e));let i=await this._commonHeaders();i.set("content-type","application/json"),i.set("accept","application/json, text/event-stream");let n={...this._requestInit,method:"POST",headers:i,body:JSON.stringify(e),signal:this._abortController?.signal},a=await (this._fetch??fetch)(this._url,n),o=a.headers.get("mcp-session-id");if(o&&(this._sessionId=o),!a.ok){let t=await a.text().catch(()=>null);if(401===a.status&&this._authProvider){if(this._hasCompletedAuthFlow)throw new lI(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:t,scope:r}=lh(a);this._resourceMetadataUrl=t,this._scope=r;let s=await ld(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit});if("AUTHORIZED"!==s)throw new lo;return this._hasCompletedAuthFlow=!0,this.send(e)}if(403===a.status&&this._authProvider){let{resourceMetadataUrl:t,scope:r,error:s}=lh(a);if("insufficient_scope"===s){let s=a.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===s)throw new lI(403,"Server returned 403 after trying upscoping");r&&(this._scope=r),t&&(this._resourceMetadataUrl=t),this._lastUpscopingHeader=s??void 0;let i=await ld(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch});if("AUTHORIZED"!==i)throw new lo;return this.send(e)}}throw new lI(a.status,`Error POSTing to endpoint: ${t}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,202===a.status){await a.body?.cancel(),nD.safeParse(e).success&&this._startOrAuthSse({resumptionToken:void 0}).catch(e=>this.onerror?.(e));return}let l=(Array.isArray(e)?e:[e]).filter(e=>"method"in e&&"id"in e&&void 0!==e.id).length>0,u=a.headers.get("content-type");if(l)if(u?.includes("text/event-stream"))this._handleSseStream(a.body,{onresumptiontoken:s},!1);else if(u?.includes("application/json")){let e=await a.json();for(let t of Array.isArray(e)?e.map(e=>nw.parse(e)):[nw.parse(e)])this.onmessage?.(t)}else throw await a.body?.cancel(),new lI(-1,`Unexpected content type: ${u}`);else await a.body?.cancel()}catch(e){throw this.onerror?.(e),e}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let e=await this._commonHeaders(),t={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},r=await (this._fetch??fetch)(this._url,t);if(await r.body?.cancel(),!r.ok&&405!==r.status)throw new lI(r.status,`Failed to terminate session: ${r.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,t){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:t?.onresumptiontoken})}}let lN=e=>"env"in e&&"string"==typeof e.env,lR=e=>{let t={};return e.forEach(e=>{let r=e.name.trim();if(lN(e)){let s=process.env[e.env];if(void 0===s)throw Error(`Environment variable "${e.env}" is not set (required for header "${r}")`);t[r]=s}else t[r]=e.value.trim()}),t},lC=i(8330),lA={name:lC.name,version:lC.version},lz={capabilities:{sampling:{},elicitation:{form:{},url:{}},roots:{listChanged:!0}}};async function lM({url:e,headers:t}){let r=new oP(lA,lz),s=t?lR(t):{},i=new lj(new URL(e),{...t?{requestInit:{headers:s}}:{},reconnectionOptions:{maxReconnectionDelay:3e4,initialReconnectionDelay:1e3,reconnectionDelayGrowFactor:1.5,maxRetries:2}});return await r.connect(i),r}async function lD(e){let{onStderrData:t,...r}=e,s=new oP(lA,lz),i=new oA({...r,stderr:r.stderr??"pipe"}),n=i.stderr;if(n){let e=t??(e=>{console.error(`[STDIO MCP Server stderr]: ${e}`)});n.on("data",e)}return await s.connect(i),{client:s,transport:i}}async function lL(e){try{return(await e.client.listTools()).tools.map(e=>e.name)}catch(e){return console.error("Failed to list stdio MCP tools:",e),[]}}async function lq(e,t,r){try{return await e.client.callTool({name:t,arguments:r})}catch(e){throw console.error(`Failed to call stdio MCP tool "${t}":`,e),e}}async function lU(e){try{await e.transport.close(),await e.client.close()}catch(e){throw console.error("Error disconnecting from stdio MCP server:",e),e}}function lZ(e){if(e?.body===void 0||null===e.body)return[];let t=Array.isArray(e.body)?e.body:[e.body],r=[];for(let e of t)if("object"==typeof e&&null!==e&&"method"in e&&"tools/call"===e.method){let t=e.params;t&&"object"==typeof t&&"name"in t&&"string"==typeof t.name&&r.push(t.name)}return r}let lV="2026-01-26",lF="ui/initialize",lH="ui/notifications/initialized",lK="ui/request-display-mode",lG="ui/open-link",lB="ui/update-model-context",lJ="ui/message",lW="notifications/message",lX="resources/read",lY="ui/notifications/host-context-changed",lQ="ui/notifications/size-changed";function l0(e){return!!e&&"object"==typeof e}function l1(e,t){return e instanceof Error&&e.message?e.message:t}function l2(e={}){let t=e.targetWindow??("undefined"==typeof window?null:window),r=e.requestTimeoutMs??15e3,s=e.connectionTimeoutMs??2e3,i=100,n=!1,a=!1,o={isConnected:!!t&&t.parent!==t,hostContext:null,hostCapabilities:null},l=new Set,u=new Map,c=e=>{if(e.isConnected!==o.isConnected||e.hostContext!==o.hostContext||e.hostCapabilities!==o.hostCapabilities)for(let t of(o=e,l))t(o)},d=e=>{var t,r;let s;c({isConnected:!0,hostContext:e.hostContext?(t=o.hostContext,r=e.hostContext,s={...t??{},...r},(t?.safeAreaInsets||r.safeAreaInsets)&&(s.safeAreaInsets={...t?.safeAreaInsets??{},...r.safeAreaInsets??{}}),(t?.containerDimensions||r.containerDimensions)&&(s.containerDimensions={...t?.containerDimensions??{},...r.containerDimensions??{}}),(t?.styles||r.styles)&&(s.styles={...t?.styles??{},...r.styles??{},variables:t?.styles?.variables||r.styles?.variables?{...t?.styles?.variables??{},...r.styles?.variables??{}}:void 0,css:t?.styles?.css||r.styles?.css?{...t?.styles?.css??{},...r.styles?.css??{}}:void 0}),s):o.hostContext,hostCapabilities:e.hostCapabilities?{...o.hostCapabilities??{},...e.hostCapabilities}:o.hostCapabilities})},p=e=>{if(!t||e.source!==t.parent||!l0(e.data))return;a=!0,o.isConnected||c({...o,isConnected:!0});let r=e.data;if("id"in r&&null!=r.id&&"number"==typeof r.id){let e=u.get(r.id);e&&(clearTimeout(e.timeoutId),u.delete(r.id),l0(r.error)?e.reject(Error("string"==typeof r.error.message?r.error.message:"MCP request failed")):e.resolve(r.result))}1===r.id&&l0(r.result)&&d({hostContext:l0(r.result.hostContext)?r.result.hostContext:void 0,hostCapabilities:l0(r.result.hostCapabilities)?r.result.hostCapabilities:void 0}),r.method===lY&&l0(r.params)&&d({hostContext:r.params}),"ui/hostContextChanged"===r.method&&l0(r.params)&&l0(r.params.hostContext)&&d({hostContext:r.params.hostContext})};t&&(t.addEventListener("message",p),t.parent!==t&&setTimeout(()=>{n||a||o.hostContext||c({...o,isConnected:!1})},s));let f=()=>{if(n)throw Error("MCP host bridge has been disposed");if(!t)throw Error("MCP host bridge requires a browser window");return t},h=(e,t)=>{f().parent.postMessage({jsonrpc:"2.0",method:e,params:t},"*")},m=(e,t={})=>{let s=f();return new Promise((n,a)=>{let o=i++,l=setTimeout(()=>{u.has(o)&&(u.delete(o),a(Error(`MCP request timed out: ${e}`)))},r);u.set(o,{resolve:n,reject:a,timeoutId:l}),s.parent.postMessage({jsonrpc:"2.0",id:o,method:e,params:t},"*")})},y=async(e,t)=>{let r;for(let s of e)try{return await m(s,t)}catch(t){r=t;let e=l1(t,"MCP request failed");if(!/method not found|unknown method/i.test(e))throw t}throw r instanceof Error?r:Error("MCP request failed")},g=async e=>{if(t?.open)return void t.open(e,"_blank","noopener,noreferrer");throw Error("Unable to open link without a browser window")};return{callTool:(e,t)=>m("tools/call",{name:e,arguments:t??{}}),requestDisplayMode:e=>y([lK,"ui/requestDisplayMode"],{mode:e}),async openLink(e){try{await y([lG,"ui/openLink"],{url:e})}catch(r){if(!o.isConnected||!t)return void await g(e);throw Error(l1(r,"Failed to open link"))}},readResource:e=>m(lX,{uri:e}),sendMessage:e=>m(lJ,e),updateModelContext:e=>m(lB,e),async logMessage(e){h(lW,e)},async notifySizeChanged(e){h(lQ,e)},getState:()=>o,getHostContext:()=>o.hostContext,getHostCapabilities:()=>o.hostCapabilities,isConnected:()=>o.isConnected,subscribe:e=>(l.add(e),()=>{l.delete(e)}),dispose(){if(!n){for(let[e,r]of(n=!0,t&&t.removeEventListener("message",p),u.entries()))clearTimeout(r.timeoutId),r.reject(Error("MCP host bridge has been disposed")),u.delete(e);l.clear()}}}}b().config()})(),n})());
|
|
68
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let r of e.seen.entries()){let s=r[1];if(t===r[0]){o(r);continue}if(e.external){let s=e.external.registry.get(r[0])?.id;if(t!==r[0]&&s){o(r);continue}}if(e.metadataRegistry.get(r[0])?.id||s.cycle||s.count>1&&"ref"===e.reused){o(r);continue}}}function rp(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let s=t=>{let r=e.seen.get(t);if(null===r.ref)return;let o=r.def??r.schema,i={...o},n=r.ref;if(r.ref=null,n){s(n);let r=e.seen.get(n),a=r.schema;if(a.$ref&&("draft-07"===e.target||"draft-04"===e.target||"openapi-3.0"===e.target)?(o.allOf=o.allOf??[],o.allOf.push(a)):Object.assign(o,a),Object.assign(o,i),t._zod.parent===n)for(let e in o)"$ref"!==e&&"allOf"!==e&&(e in i||delete o[e]);if(a.$ref&&r.def)for(let e in o)"$ref"!==e&&"allOf"!==e&&e in r.def&&JSON.stringify(o[e])===JSON.stringify(r.def[e])&&delete o[e]}let a=t._zod.parent;if(a&&a!==n){s(a);let t=e.seen.get(a);if(t?.schema.$ref&&(o.$ref=t.schema.$ref,t.def))for(let e in o)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(o[e])===JSON.stringify(t.def[e])&&delete o[e]}e.override({zodSchema:t,jsonSchema:o,path:r.path??[]})};for(let t of[...e.seen.entries()].reverse())s(t[0]);let o={};if("draft-2020-12"===e.target?o.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?o.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let r=e.external.registry.get(t)?.id;if(!r)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(r)}Object.assign(o,r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;void 0!==i&&o.id===i&&delete o.id;let n=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,n[e.defId]=e.def)}e.external||Object.keys(n).length>0&&("draft-2020-12"===e.target?o.$defs=n:o.definitions=n);try{let r=JSON.parse(JSON.stringify(o));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:rf(t,"input",e.processors),output:rf(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw Error("Error converting schema to JSON.")}}let rf=(e,t,r={})=>s=>{let{libraryOptions:o,target:i}=s??{},n=ru({...o??{},target:i,io:t,processors:r});return rc(e,n),rd(n,e),rp(n,e)},rh={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},rm=(e,t,r,s)=>{let o=e._zod.def;rc(o.innerType,t,s),t.seen.get(e).ref=o.innerType},ry=x("ZodISODateTime",(e,t)=>{tl.init(e,t),rq.init(e,t)});function rg(e){return new ry({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...e$(e)})}let rv=x("ZodISODate",(e,t)=>{tu.init(e,t),rq.init(e,t)}),r_=x("ZodISOTime",(e,t)=>{tc.init(e,t),rq.init(e,t)}),rb=x("ZodISODuration",(e,t)=>{td.init(e,t),rq.init(e,t)}),rw=x("ZodError",(e,t)=>{eB.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>(function(e,t=e=>e.message){let r={_errors:[]},s=(e,o=[])=>{for(let i of e.issues)if("invalid_union"===i.code&&i.errors.length)i.errors.map(e=>s({issues:e},[...o,...i.path]));else if("invalid_key"===i.code)s({issues:i.issues},[...o,...i.path]);else if("invalid_element"===i.code)s({issues:i.issues},[...o,...i.path]);else{let e=[...o,...i.path];if(0===e.length)r._errors.push(t(i));else{let s=r,o=0;for(;o<e.length;){let r=e[o];o===e.length-1?(s[r]=s[r]||{_errors:[]},s[r]._errors.push(t(i))):s[r]=s[r]||{_errors:[]},s=s[r],o++}}}};return s(e),r})(e,t)},flatten:{value:t=>(function(e,t=e=>e.message){let r={},s=[];for(let o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):s.push(t(o));return{formErrors:s,fieldErrors:r}})(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,en,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,en,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),r$=eX(rw),rE=eY(rw),rk=eQ(rw),rS=e1(rw),rT=(e,t,r)=>{let s=r?{...r,direction:"backward"}:{direction:"backward"};return eX(rw)(e,t,s)},rx=(e,t,r)=>eX(rw)(e,t,r),rP=async(e,t,r)=>{let s=r?{...r,direction:"backward"}:{direction:"backward"};return eY(rw)(e,t,s)},rO=async(e,t,r)=>eY(rw)(e,t,r),rI=(e,t,r)=>{let s=r?{...r,direction:"backward"}:{direction:"backward"};return eQ(rw)(e,t,s)},rj=(e,t,r)=>eQ(rw)(e,t,r),rR=async(e,t,r)=>{let s=r?{...r,direction:"backward"}:{direction:"backward"};return e1(rw)(e,t,s)},rN=async(e,t,r)=>e1(rw)(e,t,r),rz=new WeakMap;function rC(e,t,r){let s=Object.getPrototypeOf(e),o=rz.get(s);if(o||(o=new Set,rz.set(s,o)),!o.has(t))for(let e in o.add(t),r){let t=r[e];Object.defineProperty(s,e,{configurable:!0,enumerable:!1,get(){let r=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:r}),r},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}let rA=x("ZodType",(e,t)=>(e4.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:rf(e,"input"),output:rf(e,"output")}}),e.toJSONSchema=((e,t={})=>r=>{let s=ru({...r,processors:t});return rc(e,s),rd(s,e),rp(s,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,r)=>r$(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>rk(e,t,r),e.parseAsync=async(t,r)=>rE(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>rS(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>rT(e,t,r),e.decode=(t,r)=>rx(e,t,r),e.encodeAsync=async(t,r)=>rP(e,t,r),e.decodeAsync=async(t,r)=>rO(e,t,r),e.safeEncode=(t,r)=>rI(e,t,r),e.safeDecode=(t,r)=>rj(e,t,r),e.safeEncodeAsync=async(t,r)=>rR(e,t,r),e.safeDecodeAsync=async(t,r)=>rN(e,t,r),rC(e,"ZodType",{check(...e){let t=this.def;return this.clone(ep(t,{checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ew(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(function(e,t={}){return new sq({type:"custom",check:"custom",fn:e,...e$(t)})}(e,t))},superRefine(e,t){return this.check(function(e,t){var r;let s,o;return r=t=>(t.addIssue=e=>{"string"==typeof e?t.issues.push(eO(e,t.value,s._zod.def)):(e.fatal&&(e.continue=!1),e.code??(e.code="custom"),e.input??(e.input=t.value),e.inst??(e.inst=s),e.continue??(e.continue=!s._zod.def.abort),t.issues.push(eO(e)))},e(t.value,t)),(o=new eI({check:"custom",...e$(t)}))._zod.check=r,s=o}(e,t))},overwrite(e){return this.check(rl(e))},optional(){return sP(this)},exactOptional(){var e;return e=this,new sO({type:"optional",innerType:e})},nullable(){return sj(this)},nullish(){return sP(sj(this))},nonoptional(e){var t;return t=this,new sz({type:"nonoptional",innerType:t,...e$(e)})},array(){return su(this)},or(e){return sh([this,e])},and(e){return sv(this,e)},transform(e){return sM(this,sT(e))},default(e){var t,r;return t=this,r=e,new sR({type:"default",innerType:t,get defaultValue(){return"function"==typeof r?r():ev(r)}})},prefault(e){var t,r;return t=this,r=e,new sN({type:"prefault",innerType:t,get defaultValue(){return"function"==typeof r?r():ev(r)}})},catch(e){var t,r;return t=this,new sC({type:"catch",innerType:t,catchValue:"function"==typeof(r=e)?r:()=>r})},pipe(e){return sM(this,e)},readonly(){var e;return e=this,new sL({type:"readonly",innerType:e})},describe(e){let t=this.clone();return t5.add(t,{description:e}),t},meta(...e){if(0===e.length)return t5.get(this);let t=this.clone();return t5.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get:()=>t5.get(e)?.description,configurable:!0}),e)),rM=x("_ZodString",(e,t)=>{e6.init(e,t),rA.init(e,t),e._zod.processJSONSchema=(t,r,s)=>((e,t,r,s)=>{r.type="string";let{minimum:o,maximum:i,format:n,patterns:a,contentEncoding:l}=e._zod.bag;if("number"==typeof o&&(r.minLength=o),"number"==typeof i&&(r.maxLength=i),n&&(r.format=rh[n]??n,""===r.format&&delete r.format,"time"===n&&delete r.format),l&&(r.contentEncoding=l),a&&a.size>0){let e=[...a];1===e.length?r.pattern=e[0].source:e.length>1&&(r.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,r,0);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,rC(e,"_ZodString",{regex(...e){return this.check(function(e,t){return new eq({check:"string_format",format:"regex",...e$(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new eF({check:"string_format",format:"includes",...e$(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new eH({check:"string_format",format:"starts_with",...e$(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new eZ({check:"string_format",format:"ends_with",...e$(t),suffix:e})}(...e))},min(...e){return this.check(rn(...e))},max(...e){return this.check(ri(...e))},length(...e){return this.check(ra(...e))},nonempty(...e){return this.check(rn(1,...e))},lowercase(e){return this.check(new eU({check:"string_format",format:"lowercase",...e$(e)}))},uppercase(e){return this.check(new eV({check:"string_format",format:"uppercase",...e$(e)}))},trim(){return this.check(rl(e=>e.trim()))},normalize(...e){return this.check(function(e){return rl(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(rl(e=>e.toLowerCase()))},toUpperCase(){return this.check(rl(e=>e.toUpperCase()))},slugify(){return this.check(rl(e=>e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")))}})}),rD=x("ZodString",(e,t)=>{e6.init(e,t),rM.init(e,t),e.email=t=>e.check(new rU({type:"string",format:"email",check:"string_format",abort:!1,...e$(t)})),e.url=t=>e.check(t7(rH,t)),e.jwt=t=>e.check(new r6({type:"string",format:"jwt",check:"string_format",abort:!1,...e$(t)})),e.emoji=t=>e.check(new rZ({type:"string",format:"emoji",check:"string_format",abort:!1,...e$(t)})),e.guid=t=>e.check(t3(rV,t)),e.uuid=t=>e.check(new rF({type:"string",format:"uuid",check:"string_format",abort:!1,...e$(t)})),e.uuidv4=t=>e.check(new rF({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...e$(t)})),e.uuidv6=t=>e.check(new rF({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...e$(t)})),e.uuidv7=t=>e.check(new rF({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...e$(t)})),e.nanoid=t=>e.check(new rK({type:"string",format:"nanoid",check:"string_format",abort:!1,...e$(t)})),e.guid=t=>e.check(t3(rV,t)),e.cuid=t=>e.check(new rG({type:"string",format:"cuid",check:"string_format",abort:!1,...e$(t)})),e.cuid2=t=>e.check(new rJ({type:"string",format:"cuid2",check:"string_format",abort:!1,...e$(t)})),e.ulid=t=>e.check(new rB({type:"string",format:"ulid",check:"string_format",abort:!1,...e$(t)})),e.base64=t=>e.check(new r2({type:"string",format:"base64",check:"string_format",abort:!1,...e$(t)})),e.base64url=t=>e.check(new r9({type:"string",format:"base64url",check:"string_format",abort:!1,...e$(t)})),e.xid=t=>e.check(new rW({type:"string",format:"xid",check:"string_format",abort:!1,...e$(t)})),e.ksuid=t=>e.check(new rX({type:"string",format:"ksuid",check:"string_format",abort:!1,...e$(t)})),e.ipv4=t=>e.check(new rY({type:"string",format:"ipv4",check:"string_format",abort:!1,...e$(t)})),e.ipv6=t=>e.check(new rQ({type:"string",format:"ipv6",check:"string_format",abort:!1,...e$(t)})),e.cidrv4=t=>e.check(new r0({type:"string",format:"cidrv4",check:"string_format",abort:!1,...e$(t)})),e.cidrv6=t=>e.check(new r1({type:"string",format:"cidrv6",check:"string_format",abort:!1,...e$(t)})),e.e164=t=>e.check(new r4({type:"string",format:"e164",check:"string_format",abort:!1,...e$(t)})),e.datetime=t=>e.check(rg(t)),e.date=t=>e.check(new rv({type:"string",format:"date",check:"string_format",...e$(t)})),e.time=t=>e.check(new r_({type:"string",format:"time",check:"string_format",precision:null,...e$(t)})),e.duration=t=>e.check(new rb({type:"string",format:"duration",check:"string_format",...e$(t)}))});function rL(e){return new rD({type:"string",...e$(e)})}let rq=x("ZodStringFormat",(e,t)=>{e8.init(e,t),rM.init(e,t)}),rU=x("ZodEmail",(e,t)=>{e7.init(e,t),rq.init(e,t)}),rV=x("ZodGUID",(e,t)=>{e5.init(e,t),rq.init(e,t)}),rF=x("ZodUUID",(e,t)=>{e3.init(e,t),rq.init(e,t)}),rH=x("ZodURL",(e,t)=>{te.init(e,t),rq.init(e,t)}),rZ=x("ZodEmoji",(e,t)=>{tt.init(e,t),rq.init(e,t)}),rK=x("ZodNanoID",(e,t)=>{tr.init(e,t),rq.init(e,t)}),rG=x("ZodCUID",(e,t)=>{ts.init(e,t),rq.init(e,t)}),rJ=x("ZodCUID2",(e,t)=>{to.init(e,t),rq.init(e,t)}),rB=x("ZodULID",(e,t)=>{ti.init(e,t),rq.init(e,t)}),rW=x("ZodXID",(e,t)=>{tn.init(e,t),rq.init(e,t)}),rX=x("ZodKSUID",(e,t)=>{ta.init(e,t),rq.init(e,t)}),rY=x("ZodIPv4",(e,t)=>{tp.init(e,t),rq.init(e,t)}),rQ=x("ZodIPv6",(e,t)=>{tf.init(e,t),rq.init(e,t)}),r0=x("ZodCIDRv4",(e,t)=>{th.init(e,t),rq.init(e,t)}),r1=x("ZodCIDRv6",(e,t)=>{tm.init(e,t),rq.init(e,t)}),r2=x("ZodBase64",(e,t)=>{tg.init(e,t),rq.init(e,t)}),r9=x("ZodBase64URL",(e,t)=>{tv.init(e,t),rq.init(e,t)}),r4=x("ZodE164",(e,t)=>{t_.init(e,t),rq.init(e,t)}),r6=x("ZodJWT",(e,t)=>{tb.init(e,t),rq.init(e,t)}),r8=x("ZodNumber",(e,t)=>{tw.init(e,t),rA.init(e,t),e._zod.processJSONSchema=(t,r,s)=>((e,t,r,s)=>{let{minimum:o,maximum:i,format:n,multipleOf:a,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;"string"==typeof n&&n.includes("int")?r.type="integer":r.type="number";let c="number"==typeof u&&u>=(o??-1/0),d="number"==typeof l&&l<=(i??1/0),p="draft-04"===t.target||"openapi-3.0"===t.target;c?p?(r.minimum=u,r.exclusiveMinimum=!0):r.exclusiveMinimum=u:"number"==typeof o&&(r.minimum=o),d?p?(r.maximum=l,r.exclusiveMaximum=!0):r.exclusiveMaximum=l:"number"==typeof i&&(r.maximum=i),"number"==typeof a&&(r.multipleOf=a)})(e,t,r,0),rC(e,"ZodNumber",{gt(e,t){return this.check(rr(e,t))},gte(e,t){return this.check(rs(e,t))},min(e,t){return this.check(rs(e,t))},lt(e,t){return this.check(re(e,t))},lte(e,t){return this.check(rt(e,t))},max(e,t){return this.check(rt(e,t))},int(e){return this.check(r7(e))},safe(e){return this.check(r7(e))},positive(e){return this.check(rr(0,e))},nonnegative(e){return this.check(rs(0,e))},negative(e){return this.check(re(0,e))},nonpositive(e){return this.check(rt(0,e))},multipleOf(e,t){return this.check(ro(e,t))},step(e,t){return this.check(ro(e,t))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??-1/0,r.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(r.maximum??1/0,r.exclusiveMaximum??1/0)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function r5(e){return new r8({type:"number",checks:[],...e$(e)})}let r3=x("ZodNumberFormat",(e,t)=>{t$.init(e,t),r8.init(e,t)});function r7(e){return new r3({type:"number",check:"number_format",abort:!1,format:"safeint",...e$(e)})}let se=x("ZodBoolean",(e,t)=>{tE.init(e,t),rA.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{t.type="boolean"}});function st(e){return new se({type:"boolean",...e$(e)})}let sr=x("ZodNull",(e,t)=>{tk.init(e,t),rA.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{"openapi-3.0"===e.target?(t.type="string",t.nullable=!0,t.enum=[null]):t.type="null"}});function ss(e){return new sr({type:"null",...e$(e)})}let so=x("ZodAny",(e,t)=>{tS.init(e,t),rA.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}}),si=x("ZodUnknown",(e,t)=>{tT.init(e,t),rA.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}});function sn(){return new si({type:"unknown"})}let sa=x("ZodNever",(e,t)=>{tx.init(e,t),rA.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{t.not={}}}),sl=x("ZodArray",(e,t)=>{tO.init(e,t),rA.init(e,t),e._zod.processJSONSchema=(t,r,s)=>((e,t,r,s)=>{let o=e._zod.def,{minimum:i,maximum:n}=e._zod.bag;"number"==typeof i&&(r.minItems=i),"number"==typeof n&&(r.maxItems=n),r.type="array",r.items=rc(o.element,t,{...s,path:[...s.path,"items"]})})(e,t,r,s),e.element=t.element,rC(e,"ZodArray",{min(e,t){return this.check(rn(e,t))},nonempty(e){return this.check(rn(1,e))},max(e,t){return this.check(ri(e,t))},length(e,t){return this.check(ra(e,t))},unwrap(){return this.element}})});function su(e,t){return new sl({type:"array",element:e,...e$(t)})}let sc=x("ZodObject",(e,t)=>{tz.init(e,t),rA.init(e,t),e._zod.processJSONSchema=(t,r,s)=>((e,t,r,s)=>{let o=e._zod.def;r.type="object",r.properties={};let i=o.shape;for(let e in i)r.properties[e]=rc(i[e],t,{...s,path:[...s.path,"properties",e]});let n=new Set([...new Set(Object.keys(i))].filter(e=>{let r=o.shape[e]._zod;return"input"===t.io?void 0===r.optin:void 0===r.optout}));n.size>0&&(r.required=Array.from(n)),o.catchall?._zod.def.type==="never"?r.additionalProperties=!1:o.catchall?o.catchall&&(r.additionalProperties=rc(o.catchall,t,{...s,path:[...s.path,"additionalProperties"]})):"output"===t.io&&(r.additionalProperties=!1)})(e,t,r,s),ec(e,"shape",()=>t.shape),rC(e,"ZodObject",{keyof(){return s$(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:sn()})},loose(){return this.clone({...this._zod.def,catchall:sn()})},strict(){return this.clone({...this._zod.def,catchall:new sa({type:"never",...e$(void 0)})})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return function(e,t){if(!eg(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let r=e._zod.def.shape;for(let e in t)if(void 0!==Object.getOwnPropertyDescriptor(r,e))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let s=ep(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return ed(this,"shape",r),r}});return ew(e,s)}(this,e)},safeExtend(e){var t=this;if(!eg(e))throw Error("Invalid input to safeExtend: expected a plain object");let r=ep(t._zod.def,{get shape(){let r={...t._zod.def.shape,...e};return ed(this,"shape",r),r}});return ew(t,r)},merge(e){var t=this;if(t._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=ep(t._zod.def,{get shape(){let r={...t._zod.def.shape,...e._zod.def.shape};return ed(this,"shape",r),r},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return ew(t,r)},pick(e){return function(e,t){let r=e._zod.def,s=r.checks;if(s&&s.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let o=ep(e._zod.def,{get shape(){let e={};for(let s in t){if(!(s in r.shape))throw Error(`Unrecognized key: "${s}"`);t[s]&&(e[s]=r.shape[s])}return ed(this,"shape",e),e},checks:[]});return ew(e,o)}(this,e)},omit(e){return function(e,t){let r=e._zod.def,s=r.checks;if(s&&s.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let o=ep(e._zod.def,{get shape(){let s={...e._zod.def.shape};for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete s[e]}return ed(this,"shape",s),s},checks:[]});return ew(e,o)}(this,e)},partial(...e){return function(e,t,r){let s=t._zod.def.checks;if(s&&s.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let o=ep(t._zod.def,{get shape(){let s=t._zod.def.shape,o={...s};if(r)for(let t in r){if(!(t in s))throw Error(`Unrecognized key: "${t}"`);r[t]&&(o[t]=e?new e({type:"optional",innerType:s[t]}):s[t])}else for(let t in s)o[t]=e?new e({type:"optional",innerType:s[t]}):s[t];return ed(this,"shape",o),o},checks:[]});return ew(t,o)}(sx,this,e[0])},required(...e){var t,r;let s;return t=this,r=e[0],s=ep(t._zod.def,{get shape(){let e=t._zod.def.shape,s={...e};if(r)for(let t in r){if(!(t in s))throw Error(`Unrecognized key: "${t}"`);r[t]&&(s[t]=new sz({type:"nonoptional",innerType:e[t]}))}else for(let t in e)s[t]=new sz({type:"nonoptional",innerType:e[t]});return ed(this,"shape",s),s}}),ew(t,s)}})});function sd(e,t){return new sc({type:"object",shape:e??{},...e$(t)})}function sp(e,t){return new sc({type:"object",shape:e,catchall:sn(),...e$(t)})}let sf=x("ZodUnion",(e,t)=>{tA.init(e,t),rA.init(e,t),e._zod.processJSONSchema=(t,r,s)=>{let o,i,n;return i=!1===(o=e._zod.def).inclusive,n=o.options.map((e,r)=>rc(e,t,{...s,path:[...s.path,i?"oneOf":"anyOf",r]})),void(i?r.oneOf=n:r.anyOf=n)},e.options=t.options});function sh(e,t){return new sf({type:"union",options:e,...e$(t)})}let sm=x("ZodDiscriminatedUnion",(e,t)=>{sf.init(e,t),tM.init(e,t)});function sy(e,t,r){return new sm({type:"union",options:t,discriminator:e,...e$(r)})}let sg=x("ZodIntersection",(e,t)=>{tD.init(e,t),rA.init(e,t),e._zod.processJSONSchema=(t,r,s)=>{let o,i,n,a;return i=rc((o=e._zod.def).left,t,{...s,path:[...s.path,"allOf",0]}),n=rc(o.right,t,{...s,path:[...s.path,"allOf",1]}),void(r.allOf=[...(a=e=>"allOf"in e&&1===Object.keys(e).length)(i)?i.allOf:[i],...a(n)?n.allOf:[n]])}});function sv(e,t){return new sg({type:"intersection",left:e,right:t})}let s_=x("ZodRecord",(e,t)=>{tq.init(e,t),rA.init(e,t),e._zod.processJSONSchema=(t,r,s)=>((e,t,r,s)=>{let o=e._zod.def;r.type="object";let i=o.keyType,n=i._zod.bag,a=n?.patterns;if("loose"===o.mode&&a&&a.size>0){let e=rc(o.valueType,t,{...s,path:[...s.path,"patternProperties","*"]});for(let t of(r.patternProperties={},a))r.patternProperties[t.source]=e}else("draft-07"===t.target||"draft-2020-12"===t.target)&&(r.propertyNames=rc(o.keyType,t,{...s,path:[...s.path,"propertyNames"]})),r.additionalProperties=rc(o.valueType,t,{...s,path:[...s.path,"additionalProperties"]});let l=i._zod.values;if(l){let e=[...l].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(r.required=e)}})(e,t,r,s),e.keyType=t.keyType,e.valueType=t.valueType});function sb(e,t,r){return new s_(t&&t._zod?{type:"record",keyType:e,valueType:t,...e$(r)}:{type:"record",keyType:rL(),valueType:e,...e$(t)})}let sw=x("ZodEnum",(e,t)=>{tU.init(e,t),rA.init(e,t),e._zod.processJSONSchema=(t,r,s)=>{let o;(o=ei(e._zod.def.entries)).every(e=>"number"==typeof e)&&(r.type="number"),o.every(e=>"string"==typeof e)&&(r.type="string"),r.enum=o},e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(e,s)=>{let o={};for(let s of e)if(r.has(s))o[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new sw({...t,checks:[],...e$(s),entries:o})},e.exclude=(e,s)=>{let o={...t.entries};for(let t of e)if(r.has(t))delete o[t];else throw Error(`Key ${t} not found in enum`);return new sw({...t,checks:[],...e$(s),entries:o})}});function s$(e,t){return new sw({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...e$(t)})}let sE=x("ZodLiteral",(e,t)=>{tV.init(e,t),rA.init(e,t),e._zod.processJSONSchema=(t,r,s)=>((e,t,r,s)=>{let o=e._zod.def,i=[];for(let e of o.values)if(void 0===e){if("throw"===t.unrepresentable)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof e)if("throw"===t.unrepresentable)throw Error("BigInt literals cannot be represented in JSON Schema");else i.push(Number(e));else i.push(e);if(0===i.length);else if(1===i.length){let e=i[0];r.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?r.enum=[e]:r.const=e}else i.every(e=>"number"==typeof e)&&(r.type="number"),i.every(e=>"string"==typeof e)&&(r.type="string"),i.every(e=>"boolean"==typeof e)&&(r.type="boolean"),i.every(e=>null===e)&&(r.type="null"),r.enum=i})(e,t,r,0),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function sk(e,t){return new sE({type:"literal",values:Array.isArray(e)?e:[e],...e$(t)})}let sS=x("ZodTransform",(e,t)=>{tF.init(e,t),rA.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r,s)=>{if("throw"===t.unrepresentable)throw Error("Transforms cannot be represented in JSON Schema")})(0,e,0,0),e._zod.parse=(r,s)=>{if("backward"===s.direction)throw new O(e.constructor.name);r.addIssue=s=>{"string"==typeof s?r.issues.push(eO(s,r.value,t)):(s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),r.issues.push(eO(s)))};let o=t.transform(r.value,r);return o instanceof Promise?o.then(e=>(r.value=e,r.fallback=!0,r)):(r.value=o,r.fallback=!0,r)}});function sT(e){return new sS({type:"transform",transform:e})}let sx=x("ZodOptional",(e,t)=>{tZ.init(e,t),rA.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rm(e,t,r,s),e.unwrap=()=>e._zod.def.innerType});function sP(e){return new sx({type:"optional",innerType:e})}let sO=x("ZodExactOptional",(e,t)=>{tK.init(e,t),rA.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rm(e,t,r,s),e.unwrap=()=>e._zod.def.innerType}),sI=x("ZodNullable",(e,t)=>{tG.init(e,t),rA.init(e,t),e._zod.processJSONSchema=(t,r,s)=>{let o,i,n;return i=rc((o=e._zod.def).innerType,t,s),n=t.seen.get(e),void("openapi-3.0"===t.target?(n.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}])},e.unwrap=()=>e._zod.def.innerType});function sj(e){return new sI({type:"nullable",innerType:e})}let sR=x("ZodDefault",(e,t)=>{tJ.init(e,t),rA.init(e,t),e._zod.processJSONSchema=(t,r,s)=>{let o;rc((o=e._zod.def).innerType,t,s),t.seen.get(e).ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),sN=x("ZodPrefault",(e,t)=>{tW.init(e,t),rA.init(e,t),e._zod.processJSONSchema=(t,r,s)=>{let o;rc((o=e._zod.def).innerType,t,s),t.seen.get(e).ref=o.innerType,"input"===t.io&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},e.unwrap=()=>e._zod.def.innerType}),sz=x("ZodNonOptional",(e,t)=>{tX.init(e,t),rA.init(e,t),e._zod.processJSONSchema=(t,r,s)=>{let o;rc((o=e._zod.def).innerType,t,s),t.seen.get(e).ref=o.innerType},e.unwrap=()=>e._zod.def.innerType}),sC=x("ZodCatch",(e,t)=>{tQ.init(e,t),rA.init(e,t),e._zod.processJSONSchema=(t,r,s)=>((e,t,r,s)=>{let o,i=e._zod.def;rc(i.innerType,t,s),t.seen.get(e).ref=i.innerType;try{o=i.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=o})(e,t,r,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),sA=x("ZodPipe",(e,t)=>{t0.init(e,t),rA.init(e,t),e._zod.processJSONSchema=(t,r,s)=>{let o,i,n;return i=(o=e._zod.def).in._zod.traits.has("$ZodTransform"),void(rc(n="input"===t.io?i?o.out:o.in:o.out,t,s),t.seen.get(e).ref=n)},e.in=t.in,e.out=t.out});function sM(e,t){return new sA({type:"pipe",in:e,out:t})}let sD=x("ZodPreprocess",(e,t)=>{sA.init(e,t),t2.init(e,t)}),sL=x("ZodReadonly",(e,t)=>{t9.init(e,t),rA.init(e,t),e._zod.processJSONSchema=(t,r,s)=>{let o;rc((o=e._zod.def).innerType,t,s),t.seen.get(e).ref=o.innerType,r.readOnly=!0},e.unwrap=()=>e._zod.def.innerType}),sq=x("ZodCustom",(e,t)=>{t6.init(e,t),rA.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r,s)=>{if("throw"===t.unrepresentable)throw Error("Custom types cannot be represented in JSON Schema")})(0,e,0,0)});function sU(e,t){return new sD({type:"pipe",in:sT(e),out:t})}let sV="2025-11-25",sF=[sV,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],sH="io.modelcontextprotocol/related-task",sZ=(r=(e=>null!==e&&("object"==typeof e||"function"==typeof e))??(()=>!0),(t=e$(void 0)).abort??(t.abort=!0),new sq({type:"custom",check:"custom",fn:r,...t})),sK=sh([rL(),r5().int()]),sG=rL();sp({ttl:sh([r5(),ss()]).optional(),pollInterval:r5().optional()});let sJ=sd({ttl:r5().optional()}),sB=sd({taskId:rL()}),sW=sp({progressToken:sK.optional(),[sH]:sB.optional()}),sX=sd({_meta:sW.optional()}),sY=sX.extend({task:sJ.optional()}),sQ=sd({method:rL(),params:sX.loose().optional()}),s0=sd({_meta:sW.optional()}),s1=sd({method:rL(),params:s0.loose().optional()}),s2=sp({_meta:sW.optional()}),s9=sh([rL(),r5().int()]),s4=sd({jsonrpc:sk("2.0"),id:s9,...sQ.shape}).strict(),s6=e=>s4.safeParse(e).success,s8=sd({jsonrpc:sk("2.0"),...s1.shape}).strict(),s5=sd({jsonrpc:sk("2.0"),id:s9,result:s2}).strict(),s3=e=>s5.safeParse(e).success;(s=u||(u={}))[s.ConnectionClosed=-32e3]="ConnectionClosed",s[s.RequestTimeout=-32001]="RequestTimeout",s[s.ParseError=-32700]="ParseError",s[s.InvalidRequest=-32600]="InvalidRequest",s[s.MethodNotFound=-32601]="MethodNotFound",s[s.InvalidParams=-32602]="InvalidParams",s[s.InternalError=-32603]="InternalError",s[s.UrlElicitationRequired=-32042]="UrlElicitationRequired";let s7=sd({jsonrpc:sk("2.0"),id:s9.optional(),error:sd({code:r5().int(),message:rL(),data:sn().optional()})}).strict(),oe=sh([s4,s8,s5,s7]);sh([s5,s7]);let ot=s2.strict(),or=s0.extend({requestId:s9.optional(),reason:rL().optional()}),os=s1.extend({method:sk("notifications/cancelled"),params:or}),oo=sd({src:rL(),mimeType:rL().optional(),sizes:su(rL()).optional(),theme:s$(["light","dark"]).optional()}),oi=sd({icons:su(oo).optional()}),on=sd({name:rL(),title:rL().optional()}),oa=on.extend({...on.shape,...oi.shape,version:rL(),websiteUrl:rL().optional(),description:rL().optional()}),ol=sv(sd({applyDefaults:st().optional()}),sb(rL(),sn())),ou=sU(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,sv(sd({form:ol.optional(),url:sZ.optional()}),sb(rL(),sn()).optional())),oc=sp({list:sZ.optional(),cancel:sZ.optional(),requests:sp({sampling:sp({createMessage:sZ.optional()}).optional(),elicitation:sp({create:sZ.optional()}).optional()}).optional()}),od=sp({list:sZ.optional(),cancel:sZ.optional(),requests:sp({tools:sp({call:sZ.optional()}).optional()}).optional()}),op=sd({experimental:sb(rL(),sZ).optional(),sampling:sd({context:sZ.optional(),tools:sZ.optional()}).optional(),elicitation:ou.optional(),roots:sd({listChanged:st().optional()}).optional(),tasks:oc.optional()}),of=sX.extend({protocolVersion:rL(),capabilities:op,clientInfo:oa}),oh=sQ.extend({method:sk("initialize"),params:of}),om=sd({experimental:sb(rL(),sZ).optional(),logging:sZ.optional(),completions:sZ.optional(),prompts:sd({listChanged:st().optional()}).optional(),resources:sd({subscribe:st().optional(),listChanged:st().optional()}).optional(),tools:sd({listChanged:st().optional()}).optional(),tasks:od.optional()}),oy=s2.extend({protocolVersion:rL(),capabilities:om,serverInfo:oa,instructions:rL().optional()}),og=s1.extend({method:sk("notifications/initialized"),params:s0.optional()}),ov=sQ.extend({method:sk("ping"),params:sX.optional()}),o_=sd({progress:r5(),total:sP(r5()),message:sP(rL())}),ob=sd({...s0.shape,...o_.shape,progressToken:sK}),ow=s1.extend({method:sk("notifications/progress"),params:ob}),o$=sX.extend({cursor:sG.optional()}),oE=sQ.extend({params:o$.optional()}),ok=s2.extend({nextCursor:sG.optional()}),oS=s$(["working","input_required","completed","failed","cancelled"]),oT=sd({taskId:rL(),status:oS,ttl:sh([r5(),ss()]),createdAt:rL(),lastUpdatedAt:rL(),pollInterval:sP(r5()),statusMessage:sP(rL())}),ox=s2.extend({task:oT}),oP=s0.merge(oT),oO=s1.extend({method:sk("notifications/tasks/status"),params:oP}),oI=sQ.extend({method:sk("tasks/get"),params:sX.extend({taskId:rL()})}),oj=s2.merge(oT),oR=sQ.extend({method:sk("tasks/result"),params:sX.extend({taskId:rL()})});s2.loose();let oN=oE.extend({method:sk("tasks/list")}),oz=ok.extend({tasks:su(oT)}),oC=sQ.extend({method:sk("tasks/cancel"),params:sX.extend({taskId:rL()})}),oA=s2.merge(oT),oM=sd({uri:rL(),mimeType:sP(rL()),_meta:sb(rL(),sn()).optional()}),oD=oM.extend({text:rL()}),oL=rL().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),oq=oM.extend({blob:oL}),oU=s$(["user","assistant"]),oV=sd({audience:su(oU).optional(),priority:r5().min(0).max(1).optional(),lastModified:rg({offset:!0}).optional()}),oF=sd({...on.shape,...oi.shape,uri:rL(),description:sP(rL()),mimeType:sP(rL()),annotations:oV.optional(),_meta:sP(sp({}))}),oH=sd({...on.shape,...oi.shape,uriTemplate:rL(),description:sP(rL()),mimeType:sP(rL()),annotations:oV.optional(),_meta:sP(sp({}))}),oZ=oE.extend({method:sk("resources/list")}),oK=ok.extend({resources:su(oF)}),oG=oE.extend({method:sk("resources/templates/list")}),oJ=ok.extend({resourceTemplates:su(oH)}),oB=sX.extend({uri:rL()}),oW=sQ.extend({method:sk("resources/read"),params:oB}),oX=s2.extend({contents:su(sh([oD,oq]))}),oY=s1.extend({method:sk("notifications/resources/list_changed"),params:s0.optional()}),oQ=sQ.extend({method:sk("resources/subscribe"),params:oB}),o0=sQ.extend({method:sk("resources/unsubscribe"),params:oB}),o1=s0.extend({uri:rL()}),o2=s1.extend({method:sk("notifications/resources/updated"),params:o1}),o9=sd({name:rL(),description:sP(rL()),required:sP(st())}),o4=sd({...on.shape,...oi.shape,description:sP(rL()),arguments:sP(su(o9)),_meta:sP(sp({}))}),o6=oE.extend({method:sk("prompts/list")}),o8=ok.extend({prompts:su(o4)}),o5=sX.extend({name:rL(),arguments:sb(rL(),rL()).optional()}),o3=sQ.extend({method:sk("prompts/get"),params:o5}),o7=sd({type:sk("text"),text:rL(),annotations:oV.optional(),_meta:sb(rL(),sn()).optional()}),ie=sd({type:sk("image"),data:oL,mimeType:rL(),annotations:oV.optional(),_meta:sb(rL(),sn()).optional()}),it=sd({type:sk("audio"),data:oL,mimeType:rL(),annotations:oV.optional(),_meta:sb(rL(),sn()).optional()}),ir=sd({type:sk("tool_use"),name:rL(),id:rL(),input:sb(rL(),sn()),_meta:sb(rL(),sn()).optional()}),is=sd({type:sk("resource"),resource:sh([oD,oq]),annotations:oV.optional(),_meta:sb(rL(),sn()).optional()}),io=sh([o7,ie,it,oF.extend({type:sk("resource_link")}),is]),ii=sd({role:oU,content:io}),ia=s2.extend({description:rL().optional(),messages:su(ii)}),il=s1.extend({method:sk("notifications/prompts/list_changed"),params:s0.optional()}),iu=sd({title:rL().optional(),readOnlyHint:st().optional(),destructiveHint:st().optional(),idempotentHint:st().optional(),openWorldHint:st().optional()}),ic=sd({taskSupport:s$(["required","optional","forbidden"]).optional()}),id=sd({...on.shape,...oi.shape,description:rL().optional(),inputSchema:sd({type:sk("object"),properties:sb(rL(),sZ).optional(),required:su(rL()).optional()}).catchall(sn()),outputSchema:sd({type:sk("object"),properties:sb(rL(),sZ).optional(),required:su(rL()).optional()}).catchall(sn()).optional(),annotations:iu.optional(),execution:ic.optional(),_meta:sb(rL(),sn()).optional()}),ip=oE.extend({method:sk("tools/list")}),ih=ok.extend({tools:su(id)}),im=s2.extend({content:su(io).default([]),structuredContent:sb(rL(),sn()).optional(),isError:st().optional()});im.or(s2.extend({toolResult:sn()}));let iy=sY.extend({name:rL(),arguments:sb(rL(),sn()).optional()}),ig=sQ.extend({method:sk("tools/call"),params:iy}),iv=s1.extend({method:sk("notifications/tools/list_changed"),params:s0.optional()}),i_=sd({autoRefresh:st().default(!0),debounceMs:r5().int().nonnegative().default(300)}),ib=s$(["debug","info","notice","warning","error","critical","alert","emergency"]),iw=sX.extend({level:ib}),i$=sQ.extend({method:sk("logging/setLevel"),params:iw}),iE=s0.extend({level:ib,logger:rL().optional(),data:sn()}),ik=s1.extend({method:sk("notifications/message"),params:iE}),iS=sd({name:rL().optional()}),iT=sd({hints:su(iS).optional(),costPriority:r5().min(0).max(1).optional(),speedPriority:r5().min(0).max(1).optional(),intelligencePriority:r5().min(0).max(1).optional()}),ix=sd({mode:s$(["auto","required","none"]).optional()}),iP=sd({type:sk("tool_result"),toolUseId:rL().describe("The unique identifier for the corresponding tool call."),content:su(io).default([]),structuredContent:sd({}).loose().optional(),isError:st().optional(),_meta:sb(rL(),sn()).optional()}),iO=sy("type",[o7,ie,it]),iI=sy("type",[o7,ie,it,ir,iP]),ij=sd({role:oU,content:sh([iI,su(iI)]),_meta:sb(rL(),sn()).optional()}),iR=sY.extend({messages:su(ij),modelPreferences:iT.optional(),systemPrompt:rL().optional(),includeContext:s$(["none","thisServer","allServers"]).optional(),temperature:r5().optional(),maxTokens:r5().int(),stopSequences:su(rL()).optional(),metadata:sZ.optional(),tools:su(id).optional(),toolChoice:ix.optional()}),iN=sQ.extend({method:sk("sampling/createMessage"),params:iR}),iz=s2.extend({model:rL(),stopReason:sP(s$(["endTurn","stopSequence","maxTokens"]).or(rL())),role:oU,content:iO}),iC=s2.extend({model:rL(),stopReason:sP(s$(["endTurn","stopSequence","maxTokens","toolUse"]).or(rL())),role:oU,content:sh([iI,su(iI)])}),iA=sd({type:sk("boolean"),title:rL().optional(),description:rL().optional(),default:st().optional()}),iM=sd({type:sk("string"),title:rL().optional(),description:rL().optional(),minLength:r5().optional(),maxLength:r5().optional(),format:s$(["email","uri","date","date-time"]).optional(),default:rL().optional()}),iD=sd({type:s$(["number","integer"]),title:rL().optional(),description:rL().optional(),minimum:r5().optional(),maximum:r5().optional(),default:r5().optional()}),iL=sd({type:sk("string"),title:rL().optional(),description:rL().optional(),enum:su(rL()),default:rL().optional()}),iq=sd({type:sk("string"),title:rL().optional(),description:rL().optional(),oneOf:su(sd({const:rL(),title:rL()})),default:rL().optional()}),iU=sd({type:sk("string"),title:rL().optional(),description:rL().optional(),enum:su(rL()),enumNames:su(rL()).optional(),default:rL().optional()}),iV=sh([iL,iq]),iF=sh([sd({type:sk("array"),title:rL().optional(),description:rL().optional(),minItems:r5().optional(),maxItems:r5().optional(),items:sd({type:sk("string"),enum:su(rL())}),default:su(rL()).optional()}),sd({type:sk("array"),title:rL().optional(),description:rL().optional(),minItems:r5().optional(),maxItems:r5().optional(),items:sd({anyOf:su(sd({const:rL(),title:rL()}))}),default:su(rL()).optional()})]),iH=sh([iU,iV,iF]),iZ=sh([iH,iA,iM,iD]),iK=sh([sY.extend({mode:sk("form").optional(),message:rL(),requestedSchema:sd({type:sk("object"),properties:sb(rL(),iZ),required:su(rL()).optional()})}),sY.extend({mode:sk("url"),message:rL(),elicitationId:rL(),url:rL().url()})]),iG=sQ.extend({method:sk("elicitation/create"),params:iK}),iJ=s0.extend({elicitationId:rL()}),iB=s1.extend({method:sk("notifications/elicitation/complete"),params:iJ}),iW=s2.extend({action:s$(["accept","decline","cancel"]),content:sU(e=>null===e?void 0:e,sb(rL(),sh([rL(),r5(),st(),su(rL())])).optional())}),iX=sd({type:sk("ref/resource"),uri:rL()}),iY=sd({type:sk("ref/prompt"),name:rL()}),iQ=sX.extend({ref:sh([iY,iX]),argument:sd({name:rL(),value:rL()}),context:sd({arguments:sb(rL(),rL()).optional()}).optional()}),i0=sQ.extend({method:sk("completion/complete"),params:iQ}),i1=s2.extend({completion:sp({values:su(rL()).max(100),total:sP(r5().int()),hasMore:sP(st())})}),i2=sd({uri:rL().startsWith("file://"),name:rL().optional(),_meta:sb(rL(),sn()).optional()}),i9=sQ.extend({method:sk("roots/list"),params:sX.optional()}),i4=s2.extend({roots:su(i2)}),i6=s1.extend({method:sk("notifications/roots/list_changed"),params:s0.optional()});sh([ov,oh,i0,i$,o3,o6,oZ,oG,oW,oQ,o0,ig,ip,oI,oR,oN,oC]),sh([os,ow,og,i6,oO]),sh([ot,iz,iC,iW,i4,oj,oz,ox]),sh([ov,iN,iG,i9,oI,oR,oN,oC]),sh([os,ow,ik,o2,oY,iv,il,oO,iB]),sh([ot,oy,i1,ia,o8,oK,oJ,oX,im,ih,oj,oz,ox]);class i8 extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`),this.code=e,this.data=r,this.name="McpError"}static fromError(e,t,r){return e===u.UrlElicitationRequired&&r&&r.elicitations?new i5(r.elicitations,t):new i8(e,t,r)}}class i5 extends i8{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(u.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}function i3(e){return!!e._zod}function i7(e,t){return i3(e)?e0(e,t):e.safeParse(t)}function ne(e){let t;if(e&&(t=i3(e)?e._zod?.def?.shape:e.shape)){if("function"==typeof t)try{return t()}catch{return}return t}}function nt(e){return"completed"===e||"failed"===e||"cancelled"===e}function nr(e){let t=ne(e),r=t?.method;if(!r)throw Error("Schema is missing a method literal");let s=function(e){if(i3(e)){let t=e._zod?.def;if(t){if(void 0!==t.value)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}}let t=e._def;if(t){if(void 0!==t.value)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}let r=e.value;if(void 0!==r)return r}(r);if("string"!=typeof s)throw Error("Schema method literal must be a string");return s}function ns(e,t){let r=i7(e,t);if(!r.success)throw r.error;return r.data}Symbol("Let zodToJsonSchema decide on which parser to use");class no{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(os,e=>{this._oncancel(e)}),this.setNotificationHandler(ow,e=>{this._onprogress(e)}),this.setRequestHandler(ov,e=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(oI,async(e,t)=>{let r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new i8(u.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(oR,async(e,t)=>{let r=async()=>{let s=e.params.taskId;if(this._taskMessageQueue){let e;for(;e=await this._taskMessageQueue.dequeue(s,t.sessionId);){if("response"===e.type||"error"===e.type){let t=e.message,r=t.id,s=this._requestResolvers.get(r);if(s)this._requestResolvers.delete(r),s("response"===e.type?t:new i8(t.error.code,t.error.message,t.error.data));else{let t="response"===e.type?"Response":"Error";this._onerror(Error(`${t} handler missing for request ${r}`))}continue}await this._transport?.send(e.message,{relatedRequestId:t.requestId})}}let o=await this._taskStore.getTask(s,t.sessionId);if(!o)throw new i8(u.InvalidParams,`Task not found: ${s}`);if(!nt(o.status))return await this._waitForTaskUpdate(s,t.signal),await r();if(nt(o.status)){let e=await this._taskStore.getTaskResult(s,t.sessionId);return this._clearTaskQueue(s),{...e,_meta:{...e._meta,[sH]:{taskId:s}}}}return await r()};return await r()}),this.setRequestHandler(oN,async(e,t)=>{try{let{tasks:r,nextCursor:s}=await this._taskStore.listTasks(e.params?.cursor,t.sessionId);return{tasks:r,nextCursor:s,_meta:{}}}catch(e){throw new i8(u.InvalidParams,`Failed to list tasks: ${e instanceof Error?e.message:String(e)}`)}}),this.setRequestHandler(oC,async(e,t)=>{try{let r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new i8(u.InvalidParams,`Task not found: ${e.params.taskId}`);if(nt(r.status))throw new i8(u.InvalidParams,`Cannot cancel task in terminal status: ${r.status}`);await this._taskStore.updateTaskStatus(e.params.taskId,"cancelled","Client cancelled task execution.",t.sessionId),this._clearTaskQueue(e.params.taskId);let s=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!s)throw new i8(u.InvalidParams,`Task not found after cancellation: ${e.params.taskId}`);return{_meta:{},...s}}catch(e){if(e instanceof i8)throw e;throw new i8(u.InvalidRequest,`Failed to cancel task: ${e instanceof Error?e.message:String(e)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;let t=this._requestHandlerAbortControllers.get(e.params.requestId);t?.abort(e.params.reason)}_setupTimeout(e,t,r,s,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(s,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:o,onTimeout:s})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),i8.fromError(u.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let r=this.transport?.onerror;this._transport.onerror=e=>{r?.(e),this._onerror(e)};let s=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{if(s?.(e,t),s3(e)||s7.safeParse(e).success)this._onresponse(e);else if(s6(e))this._onrequest(e,t);else s8.safeParse(e).success?this._onnotification(e):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;for(let e of(this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear(),this._requestHandlerAbortControllers.values()))e.abort();this._requestHandlerAbortControllers.clear();let t=i8.fromError(u.ConnectionClosed,"Connection closed");for(let r of(this._transport=void 0,this.onclose?.(),e.values()))r(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;void 0!==t&&Promise.resolve().then(()=>t(e)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let r,s=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,o=this._transport,i=e.params?._meta?.[sH]?.taskId;if(void 0===s){let t={jsonrpc:"2.0",id:e.id,error:{code:u.MethodNotFound,message:"Method not found"}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:"error",message:t,timestamp:Date.now()},o?.sessionId).catch(e=>this._onerror(Error(`Failed to enqueue error response: ${e}`))):o?.send(t).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)));return}let n=new AbortController;this._requestHandlerAbortControllers.set(e.id,n);let a=(r=e.params,sY.safeParse(r).success)?e.params.task:void 0,l=this._taskStore?this.requestTaskStore(e,o?.sessionId):void 0,c={signal:n.signal,sessionId:o?.sessionId,_meta:e.params?._meta,sendNotification:async t=>{if(n.signal.aborted)return;let r={relatedRequestId:e.id};i&&(r.relatedTask={taskId:i}),await this.notification(t,r)},sendRequest:async(t,r,s)=>{if(n.signal.aborted)throw new i8(u.ConnectionClosed,"Request was cancelled");let o={...s,relatedRequestId:e.id};i&&!o.relatedTask&&(o.relatedTask={taskId:i});let a=o.relatedTask?.taskId??i;return a&&l&&await l.updateTaskStatus(a,"input_required"),await this.request(t,r,o)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:i,taskStore:l,taskRequestedTtl:a?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(e.method)}).then(()=>s(e,c)).then(async t=>{if(n.signal.aborted)return;let r={result:t,jsonrpc:"2.0",id:e.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:r,timestamp:Date.now()},o?.sessionId):await o?.send(r)},async t=>{if(n.signal.aborted)return;let r={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:u.InternalError,message:t.message??"Internal error",...void 0!==t.data&&{data:t.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"error",message:r,timestamp:Date.now()},o?.sessionId):await o?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,s=Number(t),o=this._progressHandlers.get(s);if(!o)return void this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));let i=this._responseHandlers.get(s),n=this._timeoutInfo.get(s);if(n&&i&&n.resetTimeoutOnProgress)try{this._resetTimeout(s)}catch(e){this._responseHandlers.delete(s),this._progressHandlers.delete(s),this._cleanupTimeout(s),i(e);return}o(r)}_onresponse(e){let t=Number(e.id),r=this._requestResolvers.get(t);if(r){this._requestResolvers.delete(t),r(s3(e)?e:new i8(e.error.code,e.error.message,e.error.data));return}let s=this._responseHandlers.get(t);if(void 0===s)return void this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));this._responseHandlers.delete(t),this._cleanupTimeout(t);let o=!1;if(s3(e)&&e.result&&"object"==typeof e.result){let r=e.result;if(r.task&&"object"==typeof r.task){let e=r.task;"string"==typeof e.taskId&&(o=!0,this._taskProgressTokens.set(e.taskId,t))}}o||this._progressHandlers.delete(t),s(s3(e)?e:i8.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}async *requestStream(e,t,r){let s,{task:o}=r??{};if(!o){try{let s=await this.request(e,t,r);yield{type:"result",result:s}}catch(e){yield{type:"error",error:e instanceof i8?e:new i8(u.InternalError,String(e))}}return}try{let o=await this.request(e,ox,r);if(o.task)s=o.task.taskId,yield{type:"taskCreated",task:o.task};else throw new i8(u.InternalError,"Task creation did not return a task");for(;;){let e=await this.getTask({taskId:s},r);if(yield{type:"taskStatus",task:e},nt(e.status)){if("completed"===e.status){let e=await this.getTaskResult({taskId:s},t,r);yield{type:"result",result:e}}else"failed"===e.status?yield{type:"error",error:new i8(u.InternalError,`Task ${s} failed`)}:"cancelled"===e.status&&(yield{type:"error",error:new i8(u.InternalError,`Task ${s} was cancelled`)});return}if("input_required"===e.status){let e=await this.getTaskResult({taskId:s},t,r);yield{type:"result",result:e};return}let o=e.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(e=>setTimeout(e,o)),r?.signal?.throwIfAborted()}}catch(e){yield{type:"error",error:e instanceof i8?e:new i8(u.InternalError,String(e))}}}request(e,t,r){let{relatedRequestId:s,resumptionToken:o,onresumptiontoken:i,task:n,relatedTask:a}=r??{};return new Promise((l,c)=>{let d=e=>{c(e)};if(!this._transport)return void d(Error("Not connected"));if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),n&&this.assertTaskCapability(e.method)}catch(e){d(e);return}r?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:p};r?.onprogress&&(this._progressHandlers.set(p,r.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),n&&(f.params={...f.params,task:n}),a&&(f.params={...f.params,_meta:{...f.params?._meta||{},[sH]:a}});let h=e=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(e)}},{relatedRequestId:s,resumptionToken:o,onresumptiontoken:i}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))),c(e instanceof i8?e:new i8(u.RequestTimeout,String(e)))};this._responseHandlers.set(p,e=>{if(!r?.signal?.aborted){if(e instanceof Error)return c(e);try{let r=i7(t,e.result);r.success?l(r.data):c(r.error)}catch(e){c(e)}}}),r?.signal?.addEventListener("abort",()=>{h(r?.signal?.reason)});let m=r?.timeout??6e4;this._setupTimeout(p,m,r?.maxTotalTimeout,()=>h(i8.fromError(u.RequestTimeout,"Request timed out",{timeout:m})),r?.resetTimeoutOnProgress??!1);let y=a?.taskId;if(y){let e=e=>{let t=this._responseHandlers.get(p);t?t(e):this._onerror(Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,e),this._enqueueTaskMessage(y,{type:"request",message:f,timestamp:Date.now()}).catch(e=>{this._cleanupTimeout(p),c(e)})}else this._transport.send(f,{relatedRequestId:s,resumptionToken:o,onresumptiontoken:i}).catch(e=>{this._cleanupTimeout(p),c(e)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},oj,t)}async getTaskResult(e,t,r){return this.request({method:"tasks/result",params:e},t,r)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},oz,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},oA,t)}async notification(e,t){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(e.method);let r=t?.relatedTask?.taskId;if(r){let s={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[sH]:t.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let r={...e,jsonrpc:"2.0"};t?.relatedTask&&(r={...r,params:{...r.params,_meta:{...r.params?._meta||{},[sH]:t.relatedTask}}}),this._transport?.send(r,t).catch(e=>this._onerror(e))});return}let s={...e,jsonrpc:"2.0"};t?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[sH]:t.relatedTask}}}),await this._transport.send(s,t)}setRequestHandler(e,t){let r=nr(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(r,s)=>Promise.resolve(t(ns(e,r),s)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let r=nr(e);this._notificationHandlers.set(r,r=>Promise.resolve(t(ns(e,r))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);void 0!==t&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,r){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let s=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,r,s)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){for(let r of(await this._taskMessageQueue.dequeueAll(e,t)))if("request"===r.type&&s6(r.message)){let t=r.message.id,s=this._requestResolvers.get(t);s?(s(new i8(u.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(t)):this._onerror(Error(`Resolver missing for request ${t} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let r=this._options?.defaultTaskPollInterval??1e3;try{let t=await this._taskStore?.getTask(e);t?.pollInterval&&(r=t.pollInterval)}catch{}return new Promise((e,s)=>{if(t.aborted)return void s(new i8(u.InvalidRequest,"Request cancelled"));let o=setTimeout(e,r);t.addEventListener("abort",()=>{clearTimeout(o),s(new i8(u.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){let r=this._taskStore;if(!r)throw Error("No task store configured");return{createTask:async s=>{if(!e)throw Error("No request provided");return await r.createTask(s,e.id,{method:e.method,params:e.params},t)},getTask:async e=>{let s=await r.getTask(e,t);if(!s)throw new i8(u.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(e,s,o)=>{await r.storeTaskResult(e,s,o,t);let i=await r.getTask(e,t);if(i){let t=oO.parse({method:"notifications/tasks/status",params:i});await this.notification(t),nt(i.status)&&this._cleanupTaskProgressHandler(e)}},getTaskResult:e=>r.getTaskResult(e,t),updateTaskStatus:async(e,s,o)=>{let i=await r.getTask(e,t);if(!i)throw new i8(u.InvalidParams,`Task "${e}" not found - it may have been cleaned up`);if(nt(i.status))throw new i8(u.InvalidParams,`Cannot update task "${e}" from terminal status "${i.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(e,s,o,t);let n=await r.getTask(e,t);if(n){let t=oO.parse({method:"notifications/tasks/status",params:n});await this.notification(t),nt(n.status)&&this._cleanupTaskProgressHandler(e)}},listTasks:e=>r.listTasks(e,t)}}}function ni(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}var nn=i(8825),na=i(1712);class nl{constructor(e){this._ajv=e??function(){let e=new nn({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return na(e),e}()}getValidator(e){let t="$id"in e&&"string"==typeof e.$id?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return e=>t(e)?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}class nu{constructor(e){this._client=e}async *callToolStream(e,t=im,r){let s=this._client,o={...r,task:r?.task??(s.isToolTask(e.name)?{}:void 0)},i=s.requestStream({method:"tools/call",params:e},t,o),n=s.getToolOutputValidator(e.name);for await(let t of i){if("result"===t.type&&n){let r=t.result;if(!r.structuredContent&&!r.isError)return void(yield{type:"error",error:new i8(u.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)});if(r.structuredContent)try{let e=n(r.structuredContent);if(!e.valid)return void(yield{type:"error",error:new i8(u.InvalidParams,`Structured content does not match the tool's output schema: ${e.errorMessage}`)})}catch(e){if(e instanceof i8)return void(yield{type:"error",error:e});yield{type:"error",error:new i8(u.InvalidParams,`Failed to validate structured content: ${e instanceof Error?e.message:String(e)}`)};return}}yield t}}async getTask(e,t){return this._client.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._client.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._client.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._client.cancelTask({taskId:e},t)}requestStream(e,t,r){return this._client.requestStream(e,t,r)}}class nc extends no{constructor(e,t){super(t),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=t?.capabilities??{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new nl,t?.listChanged&&(this._pendingListChangedConfig=t.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",iv,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",il,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",oY,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new nu(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=function(e,t){let r={...e};for(let e in t){let s=t[e];if(void 0===s)continue;let o=r[e];ni(o)&&ni(s)?r[e]={...o,...s}:r[e]=s}return r}(this._capabilities,e)}setRequestHandler(e,t){let r,s=ne(e),o=s?.method;if(!o)throw Error("Schema is missing a method literal");if(i3(o)){let e=o._zod?.def;r=e?.value??o.value}else{let e=o._def;r=e?.value??o.value}if("string"!=typeof r)throw Error("Schema method literal must be a string");let i=r;if("elicitation/create"===i){let r=async(e,r)=>{let s=i7(iG,e);if(!s.success){let e=s.error instanceof Error?s.error.message:String(s.error);throw new i8(u.InvalidParams,`Invalid elicitation request: ${e}`)}let{params:o}=s.data;o.mode=o.mode??"form";let{supportsFormMode:i,supportsUrlMode:n}=function(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=void 0!==e.form,r=void 0!==e.url;return{supportsFormMode:t||!t&&!r,supportsUrlMode:r}}(this._capabilities.elicitation);if("form"===o.mode&&!i)throw new i8(u.InvalidParams,"Client does not support form-mode elicitation requests");if("url"===o.mode&&!n)throw new i8(u.InvalidParams,"Client does not support URL-mode elicitation requests");let a=await Promise.resolve(t(e,r));if(o.task){let e=i7(ox,a);if(!e.success){let t=e.error instanceof Error?e.error.message:String(e.error);throw new i8(u.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}let l=i7(iW,a);if(!l.success){let e=l.error instanceof Error?l.error.message:String(l.error);throw new i8(u.InvalidParams,`Invalid elicitation result: ${e}`)}let c=l.data,d="form"===o.mode?o.requestedSchema:void 0;if("form"===o.mode&&"accept"===c.action&&c.content&&d&&this._capabilities.elicitation?.form?.applyDefaults)try{!function e(t,r){if(t&&null!==r&&"object"==typeof r){if("object"===t.type&&t.properties&&"object"==typeof t.properties){let s=t.properties;for(let t of Object.keys(s)){let o=s[t];void 0===r[t]&&Object.prototype.hasOwnProperty.call(o,"default")&&(r[t]=o.default),void 0!==r[t]&&e(o,r[t])}}if(Array.isArray(t.anyOf))for(let s of t.anyOf)"boolean"!=typeof s&&e(s,r);if(Array.isArray(t.oneOf))for(let s of t.oneOf)"boolean"!=typeof s&&e(s,r)}}(d,c.content)}catch{}return c};return super.setRequestHandler(e,r)}if("sampling/createMessage"===i){let r=async(e,r)=>{let s=i7(iN,e);if(!s.success){let e=s.error instanceof Error?s.error.message:String(s.error);throw new i8(u.InvalidParams,`Invalid sampling request: ${e}`)}let{params:o}=s.data,i=await Promise.resolve(t(e,r));if(o.task){let e=i7(ox,i);if(!e.success){let t=e.error instanceof Error?e.error.message:String(e.error);throw new i8(u.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}let n=i7(o.tools||o.toolChoice?iC:iz,i);if(!n.success){let e=n.error instanceof Error?n.error.message:String(n.error);throw new i8(u.InvalidParams,`Invalid sampling result: ${e}`)}return n.data};return super.setRequestHandler(e,r)}return super.setRequestHandler(e,t)}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),void 0===e.sessionId)try{let r=await this.request({method:"initialize",params:{protocolVersion:sV,capabilities:this._capabilities,clientInfo:this._clientInfo}},oy,t);if(void 0===r)throw Error(`Server sent invalid initialize result: ${r}`);if(!sF.includes(r.protocolVersion))throw Error(`Server's protocol version is not supported: ${r.protocolVersion}`);this._serverCapabilities=r.capabilities,this._serverVersion=r.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(r.protocolVersion),this._instructions=r.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(e){throw this.close(),e}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw Error(`Server does not support resources (required for ${e})`);if("resources/subscribe"===e&&!this._serverCapabilities.resources.subscribe)throw Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw Error(`Server does not support completions (required for ${e})`)}}assertNotificationCapability(e){if("notifications/roots/list_changed"===e&&!this._capabilities.roots?.listChanged)throw Error(`Client does not support roots list changed notifications (required for ${e})`)}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Client does not support tasks capability (required for ${e})`)}}assertTaskCapability(e){var t=this._serverCapabilities?.tasks?.requests,r="Server";if(!t)throw Error(`${r} does not support task creation (required for ${e})`);if("tools/call"===e&&!t.tools?.call)throw Error(`${r} does not support task creation for tools/call (required for ${e})`)}assertTaskHandlerCapability(e){if(this._capabilities){var t=this._capabilities.tasks?.requests,r="Client";if(!t)throw Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw Error(`${r} does not support task creation for elicitation/create (required for ${e})`)}}}async ping(e){return this.request({method:"ping"},ot,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},i1,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},ot,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},ia,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},o8,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},oK,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},oJ,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},oX,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},ot,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},ot,t)}async callTool(e,t=im,r){if(this.isToolTaskRequired(e.name))throw new i8(u.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let s=await this.request({method:"tools/call",params:e},t,r),o=this.getToolOutputValidator(e.name);if(o){if(!s.structuredContent&&!s.isError)throw new i8(u.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(s.structuredContent)try{let e=o(s.structuredContent);if(!e.valid)throw new i8(u.InvalidParams,`Structured content does not match the tool's output schema: ${e.errorMessage}`)}catch(e){if(e instanceof i8)throw e;throw new i8(u.InvalidParams,`Failed to validate structured content: ${e instanceof Error?e.message:String(e)}`)}}return s}isToolTask(e){return!!this._serverCapabilities?.tasks?.requests?.tools?.call&&this._cachedKnownTaskTools.has(e)}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){for(let t of(this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear(),e)){if(t.outputSchema){let e=this._jsonSchemaValidator.getValidator(t.outputSchema);this._cachedToolOutputValidators.set(t.name,e)}let e=t.execution?.taskSupport;("required"===e||"optional"===e)&&this._cachedKnownTaskTools.add(t.name),"required"===e&&this._cachedRequiredTaskTools.add(t.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){let r=await this.request({method:"tools/list",params:e},ih,t);return this.cacheToolMetadata(r.tools),r}_setupListChangedHandler(e,t,r,s){let o=i_.safeParse(r);if(!o.success)throw Error(`Invalid ${e} listChanged options: ${o.error.message}`);if("function"!=typeof r.onChanged)throw Error(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:i,debounceMs:n}=o.data,{onChanged:a}=r,l=async()=>{if(!i)return void a(null,null);try{let e=await s();a(null,e)}catch(e){a(e instanceof Error?e:Error(String(e)),null)}},u=()=>{if(n){let t=this._listChangedDebounceTimers.get(e);t&&clearTimeout(t);let r=setTimeout(l,n);this._listChangedDebounceTimers.set(e,r)}else l()};this.setNotificationHandler(t,u)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}var nd=i(6507);let np=require("node:process"),nf=require("node:stream");class nh{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){var e;if(!this._buffer)return null;let t=this._buffer.indexOf("\n");if(-1===t)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),e=r,oe.parse(JSON.parse(e))}clear(){this._buffer=void 0}}let nm="win32"===np.platform?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];class ny{constructor(e){this._readBuffer=new nh,this._stderrStream=null,this._serverParams=e,("pipe"===e.stderr||"overlapped"===e.stderr)&&(this._stderrStream=new nf.PassThrough)}async start(){if(this._process)throw Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,t)=>{this._process=nd(this._serverParams.command,this._serverParams.args??[],{env:{...function(){let e={};for(let t of nm){let r=np.env[t];void 0!==r&&(r.startsWith("()")||(e[t]=r))}return e}(),...this._serverParams.env},stdio:["pipe","pipe",this._serverParams.stderr??"inherit"],shell:!1,windowsHide:"win32"===np.platform&&"type"in process,cwd:this._serverParams.cwd}),this._process.on("error",e=>{t(e),this.onerror?.(e)}),this._process.on("spawn",()=>{e()}),this._process.on("close",e=>{this._process=void 0,this.onclose?.()}),this._process.stdin?.on("error",e=>{this.onerror?.(e)}),this._process.stdout?.on("data",e=>{this._readBuffer.append(e),this.processReadBuffer()}),this._process.stdout?.on("error",e=>{this.onerror?.(e)}),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 e=this._readBuffer.readMessage();if(null===e)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){if(this._process){let e=this._process;this._process=void 0;let t=new Promise(t=>{e.once("close",()=>{t()})});try{e.stdin?.end()}catch{}if(await Promise.race([t,new Promise(e=>setTimeout(e,2e3).unref())]),null===e.exitCode){try{e.kill("SIGTERM")}catch{}await Promise.race([t,new Promise(e=>setTimeout(e,2e3).unref())])}if(null===e.exitCode)try{e.kill("SIGKILL")}catch{}}this._readBuffer.clear()}send(e){return new Promise(t=>{if(!this._process?.stdin)throw Error("Not connected");let r=JSON.stringify(e)+"\n";this._process.stdin.write(r)?t():this._process.stdin.once("drain",t)})}}function ng(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}async function nv(t){return(await e).getRandomValues(new Uint8Array(t))}async function n_(e){let t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r=256-256%t.length,s="";for(;s.length<e;)for(let o of(await nv(e-s.length)))o<r&&(s+=t[o%t.length]);return s}async function nb(e){return await n_(e)}async function nw(t){return btoa(String.fromCharCode(...new Uint8Array(await (await e).subtle.digest("SHA-256",new TextEncoder().encode(t))))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function n$(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await nb(e),r=await nw(t);return{code_verifier:t,code_challenge:r}}e=globalThis.crypto?.webcrypto??globalThis.crypto??Promise.resolve().then(i.t.bind(i,7598,19)).then(e=>e.webcrypto);c||(c={});let nE=t7(rH,void 0).superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:"custom",message:"URL must be parseable",fatal:!0}),T}).refine(e=>{let t=new URL(e);return"javascript:"!==t.protocol&&"data:"!==t.protocol&&"vbscript:"!==t.protocol},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),nk=sp({resource:rL().url(),authorization_servers:su(nE).optional(),jwks_uri:rL().url().optional(),scopes_supported:su(rL()).optional(),bearer_methods_supported:su(rL()).optional(),resource_signing_alg_values_supported:su(rL()).optional(),resource_name:rL().optional(),resource_documentation:rL().optional(),resource_policy_uri:rL().url().optional(),resource_tos_uri:rL().url().optional(),tls_client_certificate_bound_access_tokens:st().optional(),authorization_details_types_supported:su(rL()).optional(),dpop_signing_alg_values_supported:su(rL()).optional(),dpop_bound_access_tokens_required:st().optional()}),nS=sp({issuer:rL(),authorization_endpoint:nE,token_endpoint:nE,registration_endpoint:nE.optional(),scopes_supported:su(rL()).optional(),response_types_supported:su(rL()),response_modes_supported:su(rL()).optional(),grant_types_supported:su(rL()).optional(),token_endpoint_auth_methods_supported:su(rL()).optional(),token_endpoint_auth_signing_alg_values_supported:su(rL()).optional(),service_documentation:nE.optional(),revocation_endpoint:nE.optional(),revocation_endpoint_auth_methods_supported:su(rL()).optional(),revocation_endpoint_auth_signing_alg_values_supported:su(rL()).optional(),introspection_endpoint:rL().optional(),introspection_endpoint_auth_methods_supported:su(rL()).optional(),introspection_endpoint_auth_signing_alg_values_supported:su(rL()).optional(),code_challenge_methods_supported:su(rL()).optional(),client_id_metadata_document_supported:st().optional()}),nT=sd({...sp({issuer:rL(),authorization_endpoint:nE,token_endpoint:nE,userinfo_endpoint:nE.optional(),jwks_uri:nE,registration_endpoint:nE.optional(),scopes_supported:su(rL()).optional(),response_types_supported:su(rL()),response_modes_supported:su(rL()).optional(),grant_types_supported:su(rL()).optional(),acr_values_supported:su(rL()).optional(),subject_types_supported:su(rL()),id_token_signing_alg_values_supported:su(rL()),id_token_encryption_alg_values_supported:su(rL()).optional(),id_token_encryption_enc_values_supported:su(rL()).optional(),userinfo_signing_alg_values_supported:su(rL()).optional(),userinfo_encryption_alg_values_supported:su(rL()).optional(),userinfo_encryption_enc_values_supported:su(rL()).optional(),request_object_signing_alg_values_supported:su(rL()).optional(),request_object_encryption_alg_values_supported:su(rL()).optional(),request_object_encryption_enc_values_supported:su(rL()).optional(),token_endpoint_auth_methods_supported:su(rL()).optional(),token_endpoint_auth_signing_alg_values_supported:su(rL()).optional(),display_values_supported:su(rL()).optional(),claim_types_supported:su(rL()).optional(),claims_supported:su(rL()).optional(),service_documentation:rL().optional(),claims_locales_supported:su(rL()).optional(),ui_locales_supported:su(rL()).optional(),claims_parameter_supported:st().optional(),request_parameter_supported:st().optional(),request_uri_parameter_supported:st().optional(),require_request_uri_registration:st().optional(),op_policy_uri:nE.optional(),op_tos_uri:nE.optional(),client_id_metadata_document_supported:st().optional()}).shape,...nS.pick({code_challenge_methods_supported:!0}).shape}),nx=sd({access_token:rL(),id_token:rL().optional(),token_type:rL(),expires_in:new r8({type:"number",coerce:!0,checks:[],...e$(void 0)}).optional(),scope:rL().optional(),refresh_token:rL().optional()}).strip(),nP=sd({error:rL(),error_description:rL().optional(),error_uri:rL().optional()}),nO=nE.optional().or(sk("").transform(()=>void 0)),nI=sd({redirect_uris:su(nE),token_endpoint_auth_method:rL().optional(),grant_types:su(rL()).optional(),response_types:su(rL()).optional(),client_name:rL().optional(),client_uri:nE.optional(),logo_uri:nO,scope:rL().optional(),contacts:su(rL()).optional(),tos_uri:nO,policy_uri:rL().optional(),jwks_uri:nE.optional(),jwks:new so({type:"any"}).optional(),software_id:rL().optional(),software_version:rL().optional(),software_statement:rL().optional()}).strip(),nj=sd({client_id:rL(),client_secret:rL().optional(),client_id_issued_at:r5().optional(),client_secret_expires_at:r5().optional()}).strip(),nR=nI.merge(nj);sd({error:rL(),error_description:rL().optional()}).strip(),sd({token:rL(),token_type_hint:rL().optional()}).strip();class nN extends Error{constructor(e,t){super(e),this.errorUri=t,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}}class nz extends nN{}nz.errorCode="invalid_request";class nC extends nN{}nC.errorCode="invalid_client";class nA extends nN{}nA.errorCode="invalid_grant";class nM extends nN{}nM.errorCode="unauthorized_client";class nD extends nN{}nD.errorCode="unsupported_grant_type";class nL extends nN{}nL.errorCode="invalid_scope";class nq extends nN{}nq.errorCode="access_denied";class nU extends nN{}nU.errorCode="server_error";class nV extends nN{}nV.errorCode="temporarily_unavailable";class nF extends nN{}nF.errorCode="unsupported_response_type";class nH extends nN{}nH.errorCode="unsupported_token_type";class nZ extends nN{}nZ.errorCode="invalid_token";class nK extends nN{}nK.errorCode="method_not_allowed";class nG extends nN{}nG.errorCode="too_many_requests";class nJ extends nN{}nJ.errorCode="invalid_client_metadata";class nB extends nN{}nB.errorCode="insufficient_scope";class nW extends nN{}nW.errorCode="invalid_target";let nX={[nz.errorCode]:nz,[nC.errorCode]:nC,[nA.errorCode]:nA,[nM.errorCode]:nM,[nD.errorCode]:nD,[nL.errorCode]:nL,[nq.errorCode]:nq,[nU.errorCode]:nU,[nV.errorCode]:nV,[nF.errorCode]:nF,[nH.errorCode]:nH,[nZ.errorCode]:nZ,[nK.errorCode]:nK,[nG.errorCode]:nG,[nJ.errorCode]:nJ,[nB.errorCode]:nB,[nW.errorCode]:nW};class nY extends Error{constructor(e){super(e??"Unauthorized")}}let nQ="code",n0="S256";async function n1(e){let t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{let{error:e,error_description:t,error_uri:s}=nP.parse(JSON.parse(r));return new(nX[e]||nU)(t||"",s)}catch(e){return new nU(`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${e}. Raw body: ${r}`)}}async function n2(e,t){try{return await n9(e,t)}catch(r){if(r instanceof nC||r instanceof nM)return await e.invalidateCredentials?.("all"),await n9(e,t);if(r instanceof nA)return await e.invalidateCredentials?.("tokens"),await n9(e,t);throw r}}async function n9(e,{serverUrl:t,authorizationCode:r,scope:s,resourceMetadataUrl:o,fetchFn:i}){let n,a;try{(n=await n5(t,{resourceMetadataUrl:o},i)).authorization_servers&&n.authorization_servers.length>0&&(a=n.authorization_servers[0])}catch{}a||(a=new URL("/",t));let l=await n4(t,e,n),u=await at(a,{fetchFn:i}),c=await Promise.resolve(e.clientInformation());if(!c){if(void 0!==r)throw Error("Existing OAuth client information is required when exchanging an authorization code");let t=u?.client_id_metadata_document_supported===!0,s=e.clientMetadataUrl;if(s&&!function(e){if(!e)return!1;try{let t=new URL(e);return"https:"===t.protocol&&"/"!==t.pathname}catch{return!1}}(s))throw new nJ(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${s}`);if(t&&s)c={client_id:s},await e.saveClientInformation?.(c);else{if(!e.saveClientInformation)throw Error("OAuth client information must be saveable for dynamic registration");let t=await an(a,{metadata:u,clientMetadata:e.clientMetadata,fetchFn:i});await e.saveClientInformation(t),c=t}}let d=!e.redirectUrl;if(void 0!==r||d){let t=await ai(e,a,{metadata:u,resource:l,authorizationCode:r,fetchFn:i});return await e.saveTokens(t),"AUTHORIZED"}let p=await e.tokens();if(p?.refresh_token)try{let t=await ao(a,{metadata:u,clientInformation:c,refreshToken:p.refresh_token,resource:l,addClientAuthentication:e.addClientAuthentication,fetchFn:i});return await e.saveTokens(t),"AUTHORIZED"}catch(e){if(!(e instanceof nN)||e instanceof nU);else throw e}let f=e.state?await e.state():void 0,{authorizationUrl:h,codeVerifier:m}=await ar(a,{metadata:u,clientInformation:c,state:f,redirectUrl:e.redirectUrl,scope:s||n?.scopes_supported?.join(" ")||e.clientMetadata.scope,resource:l});return await e.saveCodeVerifier(m),await e.redirectToAuthorization(h),"REDIRECT"}async function n4(e,t,r){let s,o=((s=new URL("string"==typeof e?e:e.href)).hash="",s);if(t.validateResourceURL)return await t.validateResourceURL(o,r?.resource);if(r){if(!function({requestedResource:e,configuredResource:t}){let r=new URL("string"==typeof e?e:e.href),s=new URL("string"==typeof t?t:t.href);if(r.origin!==s.origin||r.pathname.length<s.pathname.length)return!1;let o=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",i=s.pathname.endsWith("/")?s.pathname:s.pathname+"/";return o.startsWith(i)}({requestedResource:o,configuredResource:r.resource}))throw Error(`Protected resource ${r.resource} does not match expected ${o} (or origin)`);return new URL(r.resource)}}function n6(e){let t,r=e.headers.get("WWW-Authenticate");if(!r)return{};let[s,o]=r.split(" ");if("bearer"!==s.toLowerCase()||!o)return{};let i=n8(e,"resource_metadata")||void 0;if(i)try{t=new URL(i)}catch{}return{resourceMetadataUrl:t,scope:n8(e,"scope")||void 0,error:n8(e,"error")||void 0}}function n8(e,t){let r=e.headers.get("WWW-Authenticate");if(!r)return null;let s=RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),o=r.match(s);return o?o[1]||o[2]:null}async function n5(e,t,r=fetch){let s=await ae(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!s||404===s.status)throw await s?.body?.cancel(),Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!s.ok)throw await s.body?.cancel(),Error(`HTTP ${s.status} trying to load well-known OAuth protected resource metadata.`);return nk.parse(await s.json())}async function n3(e,t,r=fetch){try{return await r(e,{headers:t})}catch(s){if(s instanceof TypeError)if(t)return n3(e,void 0,r);else return;throw s}}async function n7(e,t,r=fetch){return await n3(e,{"MCP-Protocol-Version":t},r)}async function ae(e,t,r,s){var o,i;let n,a=new URL(e),l=s?.protocolVersion??sV;s?.metadataUrl?n=new URL(s.metadataUrl):(n=new URL(function(e,t="",r={}){return t.endsWith("/")&&(t=t.slice(0,-1)),r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}(t,a.pathname),s?.metadataServerUrl??a)).search=a.search;let u=await n7(n,l,r);if(!s?.metadataUrl&&(o=u,i=a.pathname,!o||o.status>=400&&o.status<500&&"/"!==i)){let e=new URL(`/.well-known/${t}`,a);u=await n7(e,l,r)}return u}async function at(e,{fetchFn:t=fetch,protocolVersion:r=sV}={}){let s={"MCP-Protocol-Version":r,Accept:"application/json"};for(let{url:r,type:o}of function(e){let t="string"==typeof e?new URL(e):e,r="/"!==t.pathname,s=[];if(!r)return s.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),s.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),s;let o=t.pathname;return o.endsWith("/")&&(o=o.slice(0,-1)),s.push({url:new URL(`/.well-known/oauth-authorization-server${o}`,t.origin),type:"oauth"}),s.push({url:new URL(`/.well-known/openid-configuration${o}`,t.origin),type:"oidc"}),s.push({url:new URL(`${o}/.well-known/openid-configuration`,t.origin),type:"oidc"}),s}(e)){let e=await n3(r,s,t);if(e){if(!e.ok){if(await e.body?.cancel(),e.status>=400&&e.status<500)continue;throw Error(`HTTP ${e.status} trying to load ${"oauth"===o?"OAuth":"OpenID provider"} metadata from ${r}`)}if("oauth"===o)return nS.parse(await e.json());return nT.parse(await e.json())}}}async function ar(e,{metadata:t,clientInformation:r,redirectUrl:s,scope:o,state:i,resource:n}){let a;if(t){if(a=new URL(t.authorization_endpoint),!t.response_types_supported.includes(nQ))throw Error(`Incompatible auth server: does not support response type ${nQ}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(n0))throw Error(`Incompatible auth server: does not support code challenge method ${n0}`)}else a=new URL("/authorize",e);let l=await n$(),u=l.code_verifier,c=l.code_challenge;return a.searchParams.set("response_type",nQ),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",c),a.searchParams.set("code_challenge_method",n0),a.searchParams.set("redirect_uri",String(s)),i&&a.searchParams.set("state",i),o&&a.searchParams.set("scope",o),o?.includes("offline_access")&&a.searchParams.append("prompt","consent"),n&&a.searchParams.set("resource",n.href),{authorizationUrl:a,codeVerifier:u}}async function as(e,{metadata:t,tokenRequestParams:r,clientInformation:s,addClientAuthentication:o,resource:i,fetchFn:n}){var a,l;let u,c=t?.token_endpoint?new URL(t.token_endpoint):new URL("/token",e),d=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});i&&r.set("resource",i.href),o?await o(d,r,c,t):s&&function(e,t,r,s){let{client_id:o,client_secret:i}=t;switch(e){case"client_secret_basic":var n,a,l,u,c=o,d=i,p=r;if(!d)throw Error("client_secret_basic authentication requires a client_secret");let f=btoa(`${c}:${d}`);p.set("Authorization",`Basic ${f}`);return;case"client_secret_post":n=o,a=i,(l=s).set("client_id",n),a&&l.set("client_secret",a);return;case"none":u=o,s.set("client_id",u);return;default:throw Error(`Unsupported client authentication method: ${e}`)}}((a=s,l=t?.token_endpoint_auth_methods_supported??[],u=void 0!==a.client_secret,0===l.length?u?"client_secret_post":"none":"token_endpoint_auth_method"in a&&a.token_endpoint_auth_method&&["client_secret_basic","client_secret_post","none"].includes(a.token_endpoint_auth_method)&&l.includes(a.token_endpoint_auth_method)?a.token_endpoint_auth_method:u&&l.includes("client_secret_basic")?"client_secret_basic":u&&l.includes("client_secret_post")?"client_secret_post":l.includes("none")?"none":u?"client_secret_post":"none"),s,d,r);let p=await (n??fetch)(c,{method:"POST",headers:d,body:r});if(!p.ok)throw await n1(p);return nx.parse(await p.json())}async function ao(e,{metadata:t,clientInformation:r,refreshToken:s,resource:o,addClientAuthentication:i,fetchFn:n}){let a=new URLSearchParams({grant_type:"refresh_token",refresh_token:s});return{refresh_token:s,...await as(e,{metadata:t,tokenRequestParams:a,clientInformation:r,addClientAuthentication:i,resource:o,fetchFn:n})}}async function ai(e,t,{metadata:r,resource:s,authorizationCode:o,fetchFn:i}={}){let n,a=e.clientMetadata.scope;if(e.prepareTokenRequest&&(n=await e.prepareTokenRequest(a)),!n){if(!o)throw Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw Error("redirectUrl is required for authorization_code flow");n=new URLSearchParams({grant_type:"authorization_code",code:o,code_verifier:await e.codeVerifier(),redirect_uri:String(e.redirectUrl)})}return as(t,{metadata:r,tokenRequestParams:n,clientInformation:await e.clientInformation()??void 0,addClientAuthentication:e.addClientAuthentication,resource:s,fetchFn:i})}async function an(e,{metadata:t,clientMetadata:r,fetchFn:s}){let o;if(t){if(!t.registration_endpoint)throw Error("Incompatible auth server: does not support dynamic client registration");o=new URL(t.registration_endpoint)}else o=new URL("/register",e);let i=await (s??fetch)(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!i.ok)throw await n1(i);return nR.parse(await i.json())}class aa extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}function al(e){}class au extends TransformStream{constructor({onError:e,onRetry:t,onComment:r}={}){let s;super({start(o){s=function(e){if("function"==typeof e)throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:t=al,onError:r=al,onRetry:s=al,onComment:o}=e,i="",n=!0,a,l="",u="";function c(e){if(""===e)return void(l.length>0&&t({id:a,event:u||void 0,data:l.endsWith(`
|
|
69
|
+
`)?l.slice(0,-1):l}),a=void 0,l="",u="");if(e.startsWith(":")){o&&o(e.slice(e.startsWith(": ")?2:1));return}let r=e.indexOf(":");if(-1!==r){let t=e.slice(0,r),s=" "===e[r+1]?2:1;d(t,e.slice(r+s),e);return}d(e,"",e)}function d(e,t,o){switch(e){case"event":u=t;break;case"data":l=`${l}${t}
|
|
70
|
+
`;break;case"id":a=t.includes("\0")?void 0:t;break;case"retry":/^\d+$/.test(t)?s(parseInt(t,10)):r(new aa(`Invalid \`retry\` value: "${t}"`,{type:"invalid-retry",value:t,line:o}));break;default:r(new aa(`Unknown field "${e.length>20?`${e.slice(0,20)}\u2026`:e}"`,{type:"unknown-field",field:e,value:t,line:o}))}}return{feed:function(e){let t=n?e.replace(/^\xEF\xBB\xBF/,""):e,[r,s]=function(e){let t=[],r="",s=0;for(;s<e.length;){let o=e.indexOf("\r",s),i=e.indexOf(`
|
|
71
|
+
`,s),n=-1;if(-1!==o&&-1!==i?n=Math.min(o,i):-1!==o?n=o===e.length-1?-1:o:-1!==i&&(n=i),-1===n){r=e.slice(s);break}{let r=e.slice(s,n);t.push(r),"\r"===e[(s=n+1)-1]&&e[s]===`
|
|
72
|
+
`&&s++}}return[t,r]}(`${i}${t}`);for(let e of r)c(e);i=s,n=!1},reset:function(e={}){i&&e.consume&&c(i),n=!0,a=void 0,l="",u="",i=""}}}({onEvent:e=>{o.enqueue(e)},onError(t){"terminate"===e?o.error(t):"function"==typeof e&&e(t)},onRetry:t,onComment:r})},transform(e){s.feed(e)}})}}let ac={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class ad extends Error{constructor(e,t){super(`Streamable HTTP error: ${t}`),this.code=e}}class ap{constructor(e,t){this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=t?.requestInit,this._authProvider=t?.authProvider,this._fetch=t?.fetch,this._fetchWithInit=function(e=fetch,t){return t?async(r,s)=>e(r,{...t,...s,headers:s?.headers?{...ng(t.headers),...ng(s.headers)}:t.headers}):e}(t?.fetch,t?.requestInit),this._sessionId=t?.sessionId,this._reconnectionOptions=t?.reconnectionOptions??ac}async _authThenStart(){let e;if(!this._authProvider)throw new nY("No auth provider");try{e=await n2(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(e){throw this.onerror?.(e),e}if("AUTHORIZED"!==e)throw new nY;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let e={};if(this._authProvider){let t=await this._authProvider.tokens();t&&(e.Authorization=`Bearer ${t.access_token}`)}this._sessionId&&(e["mcp-session-id"]=this._sessionId),this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);let t=ng(this._requestInit?.headers);return new Headers({...e,...t})}async _startOrAuthSse(e){let{resumptionToken:t}=e;try{let r=await this._commonHeaders();r.set("Accept","text/event-stream"),t&&r.set("last-event-id",t);let s=await (this._fetch??fetch)(this._url,{method:"GET",headers:r,signal:this._abortController?.signal});if(!s.ok){if(await s.body?.cancel(),401===s.status&&this._authProvider)return await this._authThenStart();if(405===s.status)return;throw new ad(s.status,`Failed to open SSE stream: ${s.statusText}`)}this._handleSseStream(s.body,e,!0)}catch(e){throw this.onerror?.(e),e}}_getNextReconnectionDelay(e){return void 0!==this._serverRetryMs?this._serverRetryMs:Math.min(this._reconnectionOptions.initialReconnectionDelay*Math.pow(this._reconnectionOptions.reconnectionDelayGrowFactor,e),this._reconnectionOptions.maxReconnectionDelay)}_scheduleReconnection(e,t=0){let r=this._reconnectionOptions.maxRetries;if(t>=r)return void this.onerror?.(Error(`Maximum reconnection attempts (${r}) exceeded.`));let s=this._getNextReconnectionDelay(t);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(r=>{this.onerror?.(Error(`Failed to reconnect SSE stream: ${r instanceof Error?r.message:String(r)}`)),this._scheduleReconnection(e,t+1)})},s)}_handleSseStream(e,t,r){let s;if(!e)return;let{onresumptiontoken:o,replayMessageId:i}=t,n=!1,a=!1;(async()=>{try{let t=e.pipeThrough(new TextDecoderStream).pipeThrough(new au({onRetry:e=>{this._serverRetryMs=e}})).getReader();for(;;){let{value:e,done:r}=await t.read();if(r)break;if((e.id&&(s=e.id,n=!0,o?.(e.id)),e.data)&&(!e.event||"message"===e.event))try{let t=oe.parse(JSON.parse(e.data));s3(t)&&(a=!0,void 0!==i&&(t.id=i)),this.onmessage?.(t)}catch(e){this.onerror?.(e)}}(r||n)&&!a&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:s,onresumptiontoken:o,replayMessageId:i},0)}catch(e){if(this.onerror?.(Error(`SSE stream disconnected: ${e}`)),(r||n)&&!a&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:s,onresumptiontoken:o,replayMessageId:i},0)}catch(e){this.onerror?.(Error(`Failed to reconnect: ${e instanceof Error?e.message:String(e)}`))}}})()}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(e){if(!this._authProvider)throw new nY("No auth provider");if("AUTHORIZED"!==await n2(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit}))throw new nY("Failed to authorize")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(e,t){try{let{resumptionToken:r,onresumptiontoken:s}=t||{};if(r)return void this._startOrAuthSse({resumptionToken:r,replayMessageId:s6(e)?e.id:void 0}).catch(e=>this.onerror?.(e));let o=await this._commonHeaders();o.set("content-type","application/json"),o.set("accept","application/json, text/event-stream");let i={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:this._abortController?.signal},n=await (this._fetch??fetch)(this._url,i),a=n.headers.get("mcp-session-id");if(a&&(this._sessionId=a),!n.ok){let t=await n.text().catch(()=>null);if(401===n.status&&this._authProvider){if(this._hasCompletedAuthFlow)throw new ad(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:t,scope:r}=n6(n);this._resourceMetadataUrl=t,this._scope=r;let s=await n2(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit});if("AUTHORIZED"!==s)throw new nY;return this._hasCompletedAuthFlow=!0,this.send(e)}if(403===n.status&&this._authProvider){let{resourceMetadataUrl:t,scope:r,error:s}=n6(n);if("insufficient_scope"===s){let s=n.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===s)throw new ad(403,"Server returned 403 after trying upscoping");r&&(this._scope=r),t&&(this._resourceMetadataUrl=t),this._lastUpscopingHeader=s??void 0;let o=await n2(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch});if("AUTHORIZED"!==o)throw new nY;return this.send(e)}}throw new ad(n.status,`Error POSTing to endpoint: ${t}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,202===n.status){await n.body?.cancel(),og.safeParse(e).success&&this._startOrAuthSse({resumptionToken:void 0}).catch(e=>this.onerror?.(e));return}let l=(Array.isArray(e)?e:[e]).filter(e=>"method"in e&&"id"in e&&void 0!==e.id).length>0,u=n.headers.get("content-type");if(l)if(u?.includes("text/event-stream"))this._handleSseStream(n.body,{onresumptiontoken:s},!1);else if(u?.includes("application/json")){let e=await n.json();for(let t of Array.isArray(e)?e.map(e=>oe.parse(e)):[oe.parse(e)])this.onmessage?.(t)}else throw await n.body?.cancel(),new ad(-1,`Unexpected content type: ${u}`);else await n.body?.cancel()}catch(e){throw this.onerror?.(e),e}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let e=await this._commonHeaders(),t={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},r=await (this._fetch??fetch)(this._url,t);if(await r.body?.cancel(),!r.ok&&405!==r.status)throw new ad(r.status,`Failed to terminate session: ${r.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,t){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:t?.onresumptiontoken})}}let af=e=>"env"in e&&"string"==typeof e.env,ah=e=>{let t={};return e.forEach(e=>{let r=e.name.trim();if(af(e)){let s=process.env[e.env];if(void 0===s)throw Error(`Environment variable "${e.env}" is not set (required for header "${r}")`);t[r]=s}else t[r]=e.value.trim()}),t},am=i(8330),ay={name:am.name,version:am.version},ag={capabilities:{sampling:{},elicitation:{form:{},url:{}},roots:{listChanged:!0}}};async function av({url:e,headers:t}){let r=new nc(ay,ag),s=t?ah(t):{},o=new ap(new URL(e),{...t?{requestInit:{headers:s}}:{},reconnectionOptions:{maxReconnectionDelay:3e4,initialReconnectionDelay:1e3,reconnectionDelayGrowFactor:1.5,maxRetries:2}});return await r.connect(o),r}async function a_(e){let{onStderrData:t,...r}=e,s=new nc(ay,ag),o=new ny({...r,stderr:r.stderr??"pipe"}),i=o.stderr;if(i){let e=t??(e=>{console.error(`[STDIO MCP Server stderr]: ${e}`)});i.on("data",e)}return await s.connect(o),{client:s,transport:o}}async function ab(e){try{return(await e.client.listTools()).tools.map(e=>e.name)}catch(e){return console.error("Failed to list stdio MCP tools:",e),[]}}async function aw(e,t,r){try{return await e.client.callTool({name:t,arguments:r})}catch(e){throw console.error(`Failed to call stdio MCP tool "${t}":`,e),e}}async function a$(e){try{await e.transport.close(),await e.client.close()}catch(e){throw console.error("Error disconnecting from stdio MCP server:",e),e}}function aE(e){if(e?.body===void 0||null===e.body)return[];let t=Array.isArray(e.body)?e.body:[e.body],r=[];for(let e of t)if("object"==typeof e&&null!==e&&"method"in e&&"tools/call"===e.method){let t=e.params;t&&"object"==typeof t&&"name"in t&&"string"==typeof t.name&&r.push(t.name)}return r}let ak="2026-01-26",aS="ui/initialize",aT="ui/notifications/initialized",ax="ui/request-display-mode",aP="ui/open-link",aO="ui/update-model-context",aI="ui/message",aj="notifications/message",aR="resources/read",aN="ui/notifications/host-context-changed",az="ui/notifications/size-changed";function aC(e){return!!e&&"object"==typeof e}function aA(e,t){return e instanceof Error&&e.message?e.message:t}function aM(e={}){let t=e.targetWindow??("undefined"==typeof window?null:window),r=e.requestTimeoutMs??15e3,s=e.connectionTimeoutMs??2e3,o=100,i=!1,n=!1,a={isConnected:!!t&&t.parent!==t,hostContext:null,hostCapabilities:null},l=new Set,u=new Map,c=e=>{if(e.isConnected!==a.isConnected||e.hostContext!==a.hostContext||e.hostCapabilities!==a.hostCapabilities)for(let t of(a=e,l))t(a)},d=e=>{var t,r;let s;c({isConnected:!0,hostContext:e.hostContext?(t=a.hostContext,r=e.hostContext,s={...t??{},...r},(t?.safeAreaInsets||r.safeAreaInsets)&&(s.safeAreaInsets={...t?.safeAreaInsets??{},...r.safeAreaInsets??{}}),(t?.containerDimensions||r.containerDimensions)&&(s.containerDimensions={...t?.containerDimensions??{},...r.containerDimensions??{}}),(t?.styles||r.styles)&&(s.styles={...t?.styles??{},...r.styles??{},variables:t?.styles?.variables||r.styles?.variables?{...t?.styles?.variables??{},...r.styles?.variables??{}}:void 0,css:t?.styles?.css||r.styles?.css?{...t?.styles?.css??{},...r.styles?.css??{}}:void 0}),s):a.hostContext,hostCapabilities:e.hostCapabilities?{...a.hostCapabilities??{},...e.hostCapabilities}:a.hostCapabilities})},p=e=>{if(!t||e.source!==t.parent||!aC(e.data))return;n=!0,a.isConnected||c({...a,isConnected:!0});let r=e.data;if("id"in r&&null!=r.id&&"number"==typeof r.id){let e=u.get(r.id);e&&(clearTimeout(e.timeoutId),u.delete(r.id),aC(r.error)?e.reject(Error("string"==typeof r.error.message?r.error.message:"MCP request failed")):e.resolve(r.result))}1===r.id&&aC(r.result)&&d({hostContext:aC(r.result.hostContext)?r.result.hostContext:void 0,hostCapabilities:aC(r.result.hostCapabilities)?r.result.hostCapabilities:void 0}),r.method===aN&&aC(r.params)&&d({hostContext:r.params}),"ui/hostContextChanged"===r.method&&aC(r.params)&&aC(r.params.hostContext)&&d({hostContext:r.params.hostContext})};t&&(t.addEventListener("message",p),t.parent!==t&&setTimeout(()=>{i||n||a.hostContext||c({...a,isConnected:!1})},s));let f=()=>{if(i)throw Error("MCP host bridge has been disposed");if(!t)throw Error("MCP host bridge requires a browser window");return t},h=(e,t)=>{f().parent.postMessage({jsonrpc:"2.0",method:e,params:t},"*")},m=(e,t={})=>{let s=f();return new Promise((i,n)=>{let a=o++,l=setTimeout(()=>{u.has(a)&&(u.delete(a),n(Error(`MCP request timed out: ${e}`)))},r);u.set(a,{resolve:i,reject:n,timeoutId:l}),s.parent.postMessage({jsonrpc:"2.0",id:a,method:e,params:t},"*")})},y=async(e,t)=>{let r;for(let s of e)try{return await m(s,t)}catch(t){r=t;let e=aA(t,"MCP request failed");if(!/method not found|unknown method/i.test(e))throw t}throw r instanceof Error?r:Error("MCP request failed")},g=async e=>{if(t?.open)return void t.open(e,"_blank","noopener,noreferrer");throw Error("Unable to open link without a browser window")};return{callTool:(e,t)=>m("tools/call",{name:e,arguments:t??{}}),requestDisplayMode:e=>y([ax,"ui/requestDisplayMode"],{mode:e}),async openLink(e){try{await y([aP,"ui/openLink"],{url:e})}catch(r){if(!a.isConnected||!t)return void await g(e);throw Error(aA(r,"Failed to open link"))}},readResource:e=>m(aR,{uri:e}),sendMessage:e=>m(aI,e),updateModelContext:e=>m(aO,e),async logMessage(e){h(aj,e)},async notifySizeChanged(e){h(az,e)},getState:()=>a,getHostContext:()=>a.hostContext,getHostCapabilities:()=>a.hostCapabilities,isConnected:()=>a.isConnected,subscribe:e=>(l.add(e),()=>{l.delete(e)}),dispose(){if(!i){for(let[e,r]of(i=!0,t&&t.removeEventListener("message",p),u.entries()))clearTimeout(r.timeoutId),r.reject(Error("MCP host bridge has been disposed")),u.delete(e);l.clear()}}}}p().config()})(),n})());
|