steam-games-mcp 0.10.4 → 0.10.5

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/CHANGELOG.md CHANGED
@@ -6,6 +6,13 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.10.5] - 2026-07-28
10
+
11
+ ### Fixed
12
+
13
+ - Fix `get_followed_games` (200-item cap), `get_wishlist`'s light default list (100-item cap), `compare_players` (top-50 cap on returned shared games) and `get_review_histogram` (24/30-entry caps) descriptions not disclosing their own fixed output caps.
14
+ - Fix `get_items`'s description not disclosing that an unknown/invalid appid comes back marked `available:false` instead of being dropped, the same behavior `get_prices`'s description already states.
15
+
9
16
  ## [0.10.4] - 2026-07-26
10
17
 
11
18
  ### Fixed
package/dist/index.js CHANGED
@@ -72,7 +72,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
72
72
  || ${O} === "boolean" || ${y} === null`).assign(L,(0,r._)`[${y}]`)}}}function b({gen:v,parentData:$,parentDataProperty:I},z){v.if((0,r._)`${$} !== undefined`,()=>v.assign((0,r._)`${$}[${I}]`,z))}function g(v,$,I,z=a.Correct){let y=z===a.Correct?r.operators.EQ:r.operators.NEQ,R;switch(v){case"null":return(0,r._)`${$} ${y} null`;case"array":R=(0,r._)`Array.isArray(${$})`;break;case"object":R=(0,r._)`${$} && typeof ${$} == "object" && !Array.isArray(${$})`;break;case"integer":R=O((0,r._)`!(${$} % 1) && !isNaN(${$})`);break;case"number":R=O();break;default:return(0,r._)`typeof ${$} ${y} ${v}`}return z===a.Correct?R:(0,r.not)(R);function O(L=r.nil){return(0,r.and)((0,r._)`typeof ${$} == "number"`,L,I?(0,r._)`isFinite(${$})`:r.nil)}}e.checkDataType=g;function S(v,$,I,z){if(v.length===1)return g(v[0],$,I,z);let y,R=(0,i.toHash)(v);if(R.array&&R.object){let O=(0,r._)`typeof ${$} != "object"`;y=R.null?O:(0,r._)`!${$} || ${O}`,delete R.null,delete R.array,delete R.object}else y=r.nil;R.number&&delete R.integer;for(let O in R)y=(0,r.and)(y,g(O,$,I,z));return y}e.checkDataTypes=S;let _={message:({schema:v})=>`must be ${v}`,params:({schema:v,schemaValue:$})=>typeof v=="string"?(0,r._)`{type: ${v}}`:(0,r._)`{type: ${$}}`};function h(v){let $=w(v);(0,o.reportError)($,_)}e.reportTypeError=h;function w(v){let{gen:$,data:I,schema:z}=v,y=(0,i.schemaRefOrVal)(v,z,"type");return{gen:$,keyword:"type",data:I,schema:z.type,schemaCode:y,schemaValue:y,parentSchema:z,params:{},it:v}}})),Mk=K((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;let t=ve(),n=ze();function o(i,a){let{properties:s,items:c}=i.schema;if(a==="object"&&s)for(let l in s)r(i,l,s[l].default);else a==="array"&&Array.isArray(c)&&c.forEach((l,u)=>r(i,u,l.default))}e.assignDefaults=o;function r(i,a,s){let{gen:c,compositeRule:l,data:u,opts:p}=i;if(s===void 0)return;let f=(0,t._)`${u}${(0,t.getProperty)(a)}`;if(l){(0,n.checkStrictMode)(i,`default is ignored for: ${f}`);return}let b=(0,t._)`${f} === undefined`;p.useDefaults==="empty"&&(b=(0,t._)`${b} || ${f} === null || ${f} === ""`),c.if(b,(0,t._)`${f} = ${(0,t.stringify)(s)}`)}})),Tt=K((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;let t=ve(),n=ze(),o=Pt(),r=ze();function i(v,$){let{gen:I,data:z,it:y}=v;I.if(p(I,z,$,y.opts.ownProperties),()=>{v.setParams({missingProperty:(0,t._)`${$}`},!0),v.error()})}e.checkReportMissingProp=i;function a({gen:v,data:$,it:{opts:I}},z,y){return(0,t.or)(...z.map(R=>(0,t.and)(p(v,$,R,I.ownProperties),(0,t._)`${y} = ${R}`)))}e.checkMissingProp=a;function s(v,$){v.setParams({missingProperty:$},!0),v.error()}e.reportMissingProp=s;function c(v){return v.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}e.hasPropFunc=c;function l(v,$,I){return(0,t._)`${c(v)}.call(${$}, ${I})`}e.isOwnProperty=l;function u(v,$,I,z){let y=(0,t._)`${$}${(0,t.getProperty)(I)} !== undefined`;return z?(0,t._)`${y} && ${l(v,$,I)}`:y}e.propertyInData=u;function p(v,$,I,z){let y=(0,t._)`${$}${(0,t.getProperty)(I)} === undefined`;return z?(0,t.or)(y,(0,t.not)(l(v,$,I))):y}e.noPropertyInData=p;function f(v){return v?Object.keys(v).filter($=>$!=="__proto__"):[]}e.allSchemaProperties=f;function b(v,$){return f($).filter(I=>!(0,n.alwaysValidSchema)(v,$[I]))}e.schemaProperties=b;function g({schemaCode:v,data:$,it:{gen:I,topSchemaRef:z,schemaPath:y,errorPath:R},it:O},L,A,F){let ee=F?(0,t._)`${v}, ${$}, ${z}${y}`:$,ne=[[o.default.instancePath,(0,t.strConcat)(o.default.instancePath,R)],[o.default.parentData,O.parentData],[o.default.parentDataProperty,O.parentDataProperty],[o.default.rootData,o.default.rootData]];O.opts.dynamicRef&&ne.push([o.default.dynamicAnchors,o.default.dynamicAnchors]);let be=(0,t._)`${ee}, ${I.object(...ne)}`;return A!==t.nil?(0,t._)`${L}.call(${A}, ${be})`:(0,t._)`${L}(${be})`}e.callValidateCode=g;let S=(0,t._)`new RegExp`;function _({gen:v,it:{opts:$}},I){let z=$.unicodeRegExp?"u":"",{regExp:y}=$.code,R=y(I,z);return v.scopeValue("pattern",{key:R.toString(),ref:R,code:(0,t._)`${y.code==="new RegExp"?S:(0,r.useFunc)(v,y)}(${I}, ${z})`})}e.usePattern=_;function h(v){let{gen:$,data:I,keyword:z,it:y}=v,R=$.name("valid");if(y.allErrors){let L=$.let("valid",!0);return O(()=>$.assign(L,!1)),L}return $.var(R,!0),O(()=>$.break()),R;function O(L){let A=$.const("len",(0,t._)`${I}.length`);$.forRange("i",0,A,F=>{v.subschema({keyword:z,dataProp:F,dataPropType:n.Type.Num},R),$.if((0,t.not)(R),L)})}}e.validateArray=h;function w(v){let{gen:$,schema:I,keyword:z,it:y}=v;if(!Array.isArray(I))throw new Error("ajv implementation error");if(I.some(L=>(0,n.alwaysValidSchema)(y,L))&&!y.opts.unevaluated)return;let R=$.let("valid",!1),O=$.name("_valid");$.block(()=>I.forEach((L,A)=>{let F=v.subschema({keyword:z,schemaProp:A,compositeRule:!0},O);$.assign(R,(0,t._)`${R} || ${O}`),v.mergeValidEvaluated(F,O)||$.if((0,t.not)(R))})),v.result(R,()=>v.reset(),()=>v.error(!0))}e.validateUnion=w})),qk=K((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;let t=ve(),n=Pt(),o=Tt(),r=Ou();function i(b,g){let{gen:S,keyword:_,schema:h,parentSchema:w,it:v}=b,$=g.macro.call(v.self,h,w,v),I=u(S,_,$);v.opts.validateSchema!==!1&&v.self.validateSchema($,!0);let z=S.name("valid");b.subschema({schema:$,schemaPath:t.nil,errSchemaPath:`${v.errSchemaPath}/${_}`,topSchemaRef:I,compositeRule:!0},z),b.pass(z,()=>b.error(!0))}e.macroKeywordCode=i;function a(b,g){var S;let{gen:_,keyword:h,schema:w,parentSchema:v,$data:$,it:I}=b;l(I,g);let z=u(_,h,!$&&g.compile?g.compile.call(I.self,w,v,I):g.validate),y=_.let("valid");b.block$data(y,R),b.ok((S=g.valid)!==null&&S!==void 0?S:y);function R(){if(g.errors===!1)A(),g.modifying&&s(b),F(()=>b.error());else{let ee=g.async?O():L();g.modifying&&s(b),F(()=>c(b,ee))}}function O(){let ee=_.let("ruleErrs",null);return _.try(()=>A((0,t._)`await `),ne=>_.assign(y,!1).if((0,t._)`${ne} instanceof ${I.ValidationError}`,()=>_.assign(ee,(0,t._)`${ne}.errors`),()=>_.throw(ne))),ee}function L(){let ee=(0,t._)`${z}.errors`;return _.assign(ee,null),A(t.nil),ee}function A(ee=g.async?(0,t._)`await `:t.nil){let ne=I.opts.passContext?n.default.this:n.default.self,be=!("compile"in g&&!$||g.schema===!1);_.assign(y,(0,t._)`${ee}${(0,o.callValidateCode)(b,z,ne,be)}`,g.modifying)}function F(ee){var ne;_.if((0,t.not)((ne=g.valid)!==null&&ne!==void 0?ne:y),ee)}}e.funcKeywordCode=a;function s(b){let{gen:g,data:S,it:_}=b;g.if(_.parentData,()=>g.assign(S,(0,t._)`${_.parentData}[${_.parentDataProperty}]`))}function c(b,g){let{gen:S}=b;S.if((0,t._)`Array.isArray(${g})`,()=>{S.assign(n.default.vErrors,(0,t._)`${n.default.vErrors} === null ? ${g} : ${n.default.vErrors}.concat(${g})`).assign(n.default.errors,(0,t._)`${n.default.vErrors}.length`),(0,r.extendErrors)(b)},()=>b.error())}function l({schemaEnv:b},g){if(g.async&&!b.$async)throw new Error("async keyword in sync schema")}function u(b,g,S){if(S===void 0)throw new Error(`keyword "${g}" failed to compile`);return b.scopeValue("keyword",typeof S=="function"?{ref:S}:{ref:S,code:(0,t.stringify)(S)})}function p(b,g,S=!1){return!g.length||g.some(_=>_==="array"?Array.isArray(b):_==="object"?b&&typeof b=="object"&&!Array.isArray(b):typeof b==_||S&&typeof b>"u")}e.validSchemaType=p;function f({schema:b,opts:g,self:S,errSchemaPath:_},h,w){if(Array.isArray(h.keyword)?!h.keyword.includes(w):h.keyword!==w)throw new Error("ajv implementation error");let v=h.dependencies;if(v?.some($=>!Object.prototype.hasOwnProperty.call(b,$)))throw new Error(`parent schema must have dependencies of ${w}: ${v.join(",")}`);if(h.validateSchema&&!h.validateSchema(b[w])){let $=`keyword "${w}" value is invalid at path "${_}": `+S.errorsText(h.validateSchema.errors);if(g.validateSchema==="log")S.logger.error($);else throw new Error($)}}e.validateKeywordUsage=f})),Dk=K((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;let t=ve(),n=ze();function o(a,{keyword:s,schemaProp:c,schema:l,schemaPath:u,errSchemaPath:p,topSchemaRef:f}){if(s!==void 0&&l!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(s!==void 0){let b=a.schema[s];return c===void 0?{schema:b,schemaPath:(0,t._)`${a.schemaPath}${(0,t.getProperty)(s)}`,errSchemaPath:`${a.errSchemaPath}/${s}`}:{schema:b[c],schemaPath:(0,t._)`${a.schemaPath}${(0,t.getProperty)(s)}${(0,t.getProperty)(c)}`,errSchemaPath:`${a.errSchemaPath}/${s}/${(0,n.escapeFragment)(c)}`}}if(l!==void 0){if(u===void 0||p===void 0||f===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:l,schemaPath:u,topSchemaRef:f,errSchemaPath:p}}throw new Error('either "keyword" or "schema" must be passed')}e.getSubschema=o;function r(a,s,{dataProp:c,dataPropType:l,data:u,dataTypes:p,propertyName:f}){if(u!==void 0&&c!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:b}=s;if(c!==void 0){let{errorPath:S,dataPathArr:_,opts:h}=s;g(b.let("data",(0,t._)`${s.data}${(0,t.getProperty)(c)}`,!0)),a.errorPath=(0,t.str)`${S}${(0,n.getErrorPath)(c,l,h.jsPropertySyntax)}`,a.parentDataProperty=(0,t._)`${c}`,a.dataPathArr=[..._,a.parentDataProperty]}u!==void 0&&(g(u instanceof t.Name?u:b.let("data",u,!0)),f!==void 0&&(a.propertyName=f)),p&&(a.dataTypes=p);function g(S){a.data=S,a.dataLevel=s.dataLevel+1,a.dataTypes=[],s.definedProperties=new Set,a.parentData=s.data,a.dataNames=[...s.dataNames,S]}}e.extendSubschemaData=r;function i(a,{jtdDiscriminator:s,jtdMetadata:c,compositeRule:l,createErrors:u,allErrors:p}){l!==void 0&&(a.compositeRule=l),u!==void 0&&(a.createErrors=u),p!==void 0&&(a.allErrors=p),a.jtdDiscriminator=s,a.jtdMetadata=c}e.extendSubschemaMode=i})),DS=K(((e,t)=>{t.exports=function n(o,r){if(o===r)return!0;if(o&&r&&typeof o=="object"&&typeof r=="object"){if(o.constructor!==r.constructor)return!1;var i,a,s;if(Array.isArray(o)){if(i=o.length,i!=r.length)return!1;for(a=i;a--!==0;)if(!n(o[a],r[a]))return!1;return!0}if(o.constructor===RegExp)return o.source===r.source&&o.flags===r.flags;if(o.valueOf!==Object.prototype.valueOf)return o.valueOf()===r.valueOf();if(o.toString!==Object.prototype.toString)return o.toString()===r.toString();if(s=Object.keys(o),i=s.length,i!==Object.keys(r).length)return!1;for(a=i;a--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[a]))return!1;for(a=i;a--!==0;){var c=s[a];if(!n(o[c],r[c]))return!1}return!0}return o!==o&&r!==r}})),Uk=K(((e,t)=>{var n=t.exports=function(i,a,s){typeof a=="function"&&(s=a,a={}),s=a.cb||s;var c=typeof s=="function"?s:s.pre||function(){},l=s.post||function(){};o(a,c,l,i,"",i)};n.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},n.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},n.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},n.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};function o(i,a,s,c,l,u,p,f,b,g){if(c&&typeof c=="object"&&!Array.isArray(c)){a(c,l,u,p,f,b,g);for(var S in c){var _=c[S];if(Array.isArray(_)){if(S in n.arrayKeywords)for(var h=0;h<_.length;h++)o(i,a,s,_[h],l+"/"+S+"/"+h,u,l,S,c,h)}else if(S in n.propsKeywords){if(_&&typeof _=="object")for(var w in _)o(i,a,s,_[w],l+"/"+S+"/"+r(w),u,l,S,c,w)}else(S in n.keywords||i.allKeys&&!(S in n.skipKeywords))&&o(i,a,s,_,l+"/"+S,u,l,S,c)}s(c,l,u,p,f,b,g)}}function r(i){return i.replace(/~/g,"~0").replace(/\//g,"~1")}})),ju=K((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;let t=ze(),n=DS(),o=Uk(),r=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function i(_,h=!0){return typeof _=="boolean"?!0:h===!0?!s(_):h?c(_)<=h:!1}e.inlineRef=i;let a=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function s(_){for(let h in _){if(a.has(h))return!0;let w=_[h];if(Array.isArray(w)&&w.some(s)||typeof w=="object"&&s(w))return!0}return!1}function c(_){let h=0;for(let w in _){if(w==="$ref")return 1/0;if(h++,!r.has(w)&&(typeof _[w]=="object"&&(0,t.eachItem)(_[w],v=>h+=c(v)),h===1/0))return 1/0}return h}function l(_,h="",w){return w!==!1&&(h=f(h)),u(_,_.parse(h))}e.getFullPath=l;function u(_,h){return _.serialize(h).split("#")[0]+"#"}e._getFullPath=u;let p=/#\/?$/;function f(_){return _?_.replace(p,""):""}e.normalizeId=f;function b(_,h,w){return w=f(w),_.resolve(h,w)}e.resolveUrl=b;let g=/^[a-z_][-a-z0-9._]*$/i;function S(_,h){if(typeof _=="boolean")return{};let{schemaId:w,uriResolver:v}=this.opts,$=f(_[w]||h),I={"":$},z=l(v,$,!1),y={},R=new Set;return o(_,{allKeys:!0},(A,F,ee,ne)=>{if(ne===void 0)return;let be=z+F,je=I[ne];typeof A[w]=="string"&&(je=xe.call(this,A[w])),Le.call(this,A.$anchor),Le.call(this,A.$dynamicAnchor),I[F]=je;function xe(we){let x=this.opts.uriResolver.resolve;if(we=f(je?x(je,we):we),R.has(we))throw L(we);R.add(we);let D=this.refs[we];return typeof D=="string"&&(D=this.refs[D]),typeof D=="object"?O(A,D.schema,we):we!==f(be)&&(we[0]==="#"?(O(A,y[we],we),y[we]=A):this.refs[we]=be),we}function Le(we){if(typeof we=="string"){if(!g.test(we))throw new Error(`invalid anchor "${we}"`);xe.call(this,`#${we}`)}}}),y;function O(A,F,ee){if(F!==void 0&&!n(A,F))throw L(ee)}function L(A){return new Error(`reference "${A}" resolves to more than one schema`)}}e.getSchemaRefs=S})),ca=K((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;let t=Ak(),n=xu(),o=qS(),r=xu(),i=Mk(),a=qk(),s=Dk(),c=ve(),l=Pt(),u=ju(),p=ze(),f=Ou();function b(T){if(z(T)&&(R(T),I(T))){h(T);return}g(T,()=>(0,t.topBoolOrEmptySchema)(T))}e.validateFunctionCode=b;function g({gen:T,validateName:U,schema:V,schemaEnv:ue,opts:de},ge){de.code.es5?T.func(U,(0,c._)`${l.default.data}, ${l.default.valCxt}`,ue.$async,()=>{T.code((0,c._)`"use strict"; ${v(V,de)}`),_(T,de),T.code(ge)}):T.func(U,(0,c._)`${l.default.data}, ${S(de)}`,ue.$async,()=>T.code(v(V,de)).code(ge))}function S(T){return(0,c._)`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${T.dynamicRef?(0,c._)`, ${l.default.dynamicAnchors}={}`:c.nil}}={}`}function _(T,U){T.if(l.default.valCxt,()=>{T.var(l.default.instancePath,(0,c._)`${l.default.valCxt}.${l.default.instancePath}`),T.var(l.default.parentData,(0,c._)`${l.default.valCxt}.${l.default.parentData}`),T.var(l.default.parentDataProperty,(0,c._)`${l.default.valCxt}.${l.default.parentDataProperty}`),T.var(l.default.rootData,(0,c._)`${l.default.valCxt}.${l.default.rootData}`),U.dynamicRef&&T.var(l.default.dynamicAnchors,(0,c._)`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{T.var(l.default.instancePath,(0,c._)`""`),T.var(l.default.parentData,(0,c._)`undefined`),T.var(l.default.parentDataProperty,(0,c._)`undefined`),T.var(l.default.rootData,l.default.data),U.dynamicRef&&T.var(l.default.dynamicAnchors,(0,c._)`{}`)})}function h(T){let{schema:U,opts:V,gen:ue}=T;g(T,()=>{V.$comment&&U.$comment&&ne(T),A(T),ue.let(l.default.vErrors,null),ue.let(l.default.errors,0),V.unevaluated&&w(T),O(T),be(T)})}function w(T){let{gen:U,validateName:V}=T;T.evaluated=U.const("evaluated",(0,c._)`${V}.evaluated`),U.if((0,c._)`${T.evaluated}.dynamicProps`,()=>U.assign((0,c._)`${T.evaluated}.props`,(0,c._)`undefined`)),U.if((0,c._)`${T.evaluated}.dynamicItems`,()=>U.assign((0,c._)`${T.evaluated}.items`,(0,c._)`undefined`))}function v(T,U){let V=typeof T=="object"&&T[U.schemaId];return V&&(U.code.source||U.code.process)?(0,c._)`/*# sourceURL=${V} */`:c.nil}function $(T,U){if(z(T)&&(R(T),I(T))){y(T,U);return}(0,t.boolOrEmptySchema)(T,U)}function I({schema:T,self:U}){if(typeof T=="boolean")return!T;for(let V in T)if(U.RULES.all[V])return!0;return!1}function z(T){return typeof T.schema!="boolean"}function y(T,U){let{schema:V,gen:ue,opts:de}=T;de.$comment&&V.$comment&&ne(T),F(T),ee(T);let ge=ue.const("_errs",l.default.errors);O(T,ge),ue.var(U,(0,c._)`${ge} === ${l.default.errors}`)}function R(T){(0,p.checkUnknownRules)(T),L(T)}function O(T,U){if(T.opts.jtd)return xe(T,[],!1,U);let V=(0,n.getSchemaTypes)(T.schema);xe(T,V,!(0,n.coerceAndCheckDataType)(T,V),U)}function L(T){let{schema:U,errSchemaPath:V,opts:ue,self:de}=T;U.$ref&&ue.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(U,de.RULES)&&de.logger.warn(`$ref: keywords ignored in schema at path "${V}"`)}function A(T){let{schema:U,opts:V}=T;U.default!==void 0&&V.useDefaults&&V.strictSchema&&(0,p.checkStrictMode)(T,"default is ignored in the schema root")}function F(T){let U=T.schema[T.opts.schemaId];U&&(T.baseId=(0,u.resolveUrl)(T.opts.uriResolver,T.baseId,U))}function ee(T){if(T.schema.$async&&!T.schemaEnv.$async)throw new Error("async schema in sync schema")}function ne({gen:T,schemaEnv:U,schema:V,errSchemaPath:ue,opts:de}){let ge=V.$comment;if(de.$comment===!0)T.code((0,c._)`${l.default.self}.logger.log(${ge})`);else if(typeof de.$comment=="function"){let De=(0,c.str)`${ue}/$comment`,Ve=T.scopeValue("root",{ref:U.root});T.code((0,c._)`${l.default.self}.opts.$comment(${ge}, ${De}, ${Ve}.schema)`)}}function be(T){let{gen:U,schemaEnv:V,validateName:ue,ValidationError:de,opts:ge}=T;V.$async?U.if((0,c._)`${l.default.errors} === 0`,()=>U.return(l.default.data),()=>U.throw((0,c._)`new ${de}(${l.default.vErrors})`)):(U.assign((0,c._)`${ue}.errors`,l.default.vErrors),ge.unevaluated&&je(T),U.return((0,c._)`${l.default.errors} === 0`))}function je({gen:T,evaluated:U,props:V,items:ue}){V instanceof c.Name&&T.assign((0,c._)`${U}.props`,V),ue instanceof c.Name&&T.assign((0,c._)`${U}.items`,ue)}function xe(T,U,V,ue){let{gen:de,schema:ge,data:De,allErrors:Ve,opts:Ke,self:Fe}=T,{RULES:Ne}=Fe;if(ge.$ref&&(Ke.ignoreKeywordsWithRef||!(0,p.schemaHasRulesButRef)(ge,Ne))){de.block(()=>_e(T,"$ref",Ne.all.$ref.definition));return}Ke.jtd||we(T,U),de.block(()=>{for(let Ze of Ne.rules)yt(Ze);yt(Ne.post)});function yt(Ze){(0,o.shouldUseGroup)(ge,Ze)&&(Ze.type?(de.if((0,r.checkDataType)(Ze.type,De,Ke.strictNumbers)),Le(T,Ze),U.length===1&&U[0]===Ze.type&&V&&(de.else(),(0,r.reportTypeError)(T)),de.endIf()):Le(T,Ze),Ve||de.if((0,c._)`${l.default.errors} === ${ue||0}`))}}function Le(T,U){let{gen:V,schema:ue,opts:{useDefaults:de}}=T;de&&(0,i.assignDefaults)(T,U.type),V.block(()=>{for(let ge of U.rules)(0,o.shouldUseRule)(ue,ge)&&_e(T,ge.keyword,ge.definition,U.type)})}function we(T,U){T.schemaEnv.meta||!T.opts.strictTypes||(x(T,U),T.opts.allowUnionTypes||D(T,U),G(T,T.dataTypes))}function x(T,U){if(U.length){if(!T.dataTypes.length){T.dataTypes=U;return}U.forEach(V=>{E(T.dataTypes,V)||Y(T,`type "${V}" not allowed by context "${T.dataTypes.join(",")}"`)}),M(T,U)}}function D(T,U){U.length>1&&!(U.length===2&&U.includes("null"))&&Y(T,"use allowUnionTypes to allow union type keyword")}function G(T,U){let V=T.self.RULES.all;for(let ue in V){let de=V[ue];if(typeof de=="object"&&(0,o.shouldUseRule)(T.schema,de)){let{type:ge}=de.definition;ge.length&&!ge.some(De=>k(U,De))&&Y(T,`missing type "${ge.join(",")}" for keyword "${ue}"`)}}}function k(T,U){return T.includes(U)||U==="number"&&T.includes("integer")}function E(T,U){return T.includes(U)||U==="integer"&&T.includes("number")}function M(T,U){let V=[];for(let ue of T.dataTypes)E(U,ue)?V.push(ue):U.includes("integer")&&ue==="number"&&V.push("integer");T.dataTypes=V}function Y(T,U){let V=T.schemaEnv.baseId+T.errSchemaPath;U+=` at "${V}" (strictTypes)`,(0,p.checkStrictMode)(T,U,T.opts.strictTypes)}var se=class{constructor(T,U,V){if((0,a.validateKeywordUsage)(T,U,V),this.gen=T.gen,this.allErrors=T.allErrors,this.keyword=V,this.data=T.data,this.schema=T.schema[V],this.$data=U.$data&&T.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,p.schemaRefOrVal)(T,this.schema,V,this.$data),this.schemaType=U.schemaType,this.parentSchema=T.schema,this.params={},this.it=T,this.def=U,this.$data)this.schemaCode=T.gen.const("vSchema",tt(this.$data,T));else if(this.schemaCode=this.schemaValue,!(0,a.validSchemaType)(this.schema,U.schemaType,U.allowUndefined))throw new Error(`${V} value must be ${JSON.stringify(U.schemaType)}`);("code"in U?U.trackErrors:U.errors!==!1)&&(this.errsCount=T.gen.const("_errs",l.default.errors))}result(T,U,V){this.failResult((0,c.not)(T),U,V)}failResult(T,U,V){this.gen.if(T),V?V():this.error(),U?(this.gen.else(),U(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(T,U){this.failResult((0,c.not)(T),void 0,U)}fail(T){if(T===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(T),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(T){if(!this.$data)return this.fail(T);let{schemaCode:U}=this;this.fail((0,c._)`${U} !== undefined && (${(0,c.or)(this.invalid$data(),T)})`)}error(T,U,V){if(U){this.setParams(U),this._error(T,V),this.setParams({});return}this._error(T,V)}_error(T,U){(T?f.reportExtraError:f.reportError)(this,this.def.error,U)}$dataError(){(0,f.reportError)(this,this.def.$dataError||f.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,f.resetErrorsCount)(this.gen,this.errsCount)}ok(T){this.allErrors||this.gen.if(T)}setParams(T,U){U?Object.assign(this.params,T):this.params=T}block$data(T,U,V=c.nil){this.gen.block(()=>{this.check$data(T,V),U()})}check$data(T=c.nil,U=c.nil){if(!this.$data)return;let{gen:V,schemaCode:ue,schemaType:de,def:ge}=this;V.if((0,c.or)((0,c._)`${ue} === undefined`,U)),T!==c.nil&&V.assign(T,!0),(de.length||ge.validateSchema)&&(V.elseIf(this.invalid$data()),this.$dataError(),T!==c.nil&&V.assign(T,!1)),V.else()}invalid$data(){let{gen:T,schemaCode:U,schemaType:V,def:ue,it:de}=this;return(0,c.or)(ge(),De());function ge(){if(V.length){if(!(U instanceof c.Name))throw new Error("ajv implementation error");let Ve=Array.isArray(V)?V:[V];return(0,c._)`${(0,r.checkDataTypes)(Ve,U,de.opts.strictNumbers,r.DataType.Wrong)}`}return c.nil}function De(){if(ue.validateSchema){let Ve=T.scopeValue("validate$data",{ref:ue.validateSchema});return(0,c._)`!${Ve}(${U})`}return c.nil}}subschema(T,U){let V=(0,s.getSubschema)(this.it,T);(0,s.extendSubschemaData)(V,this.it,T),(0,s.extendSubschemaMode)(V,T);let ue={...this.it,...V,items:void 0,props:void 0};return $(ue,U),ue}mergeEvaluated(T,U){let{it:V,gen:ue}=this;V.opts.unevaluated&&(V.props!==!0&&T.props!==void 0&&(V.props=p.mergeEvaluated.props(ue,T.props,V.props,U)),V.items!==!0&&T.items!==void 0&&(V.items=p.mergeEvaluated.items(ue,T.items,V.items,U)))}mergeValidEvaluated(T,U){let{it:V,gen:ue}=this;if(V.opts.unevaluated&&(V.props!==!0||V.items!==!0))return ue.if(U,()=>this.mergeEvaluated(T,c.Name)),!0}};e.KeywordCxt=se;function _e(T,U,V,ue){let de=new se(T,V,U);"code"in V?V.code(de,ue):de.$data&&V.validate?(0,a.funcKeywordCode)(de,V):"macro"in V?(0,a.macroKeywordCode)(de,V):(V.compile||V.validate)&&(0,a.funcKeywordCode)(de,V)}let me=/^\/(?:[^~]|~0|~1)*$/,Oe=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function tt(T,{dataLevel:U,dataNames:V,dataPathArr:ue}){let de,ge;if(T==="")return l.default.rootData;if(T[0]==="/"){if(!me.test(T))throw new Error(`Invalid JSON-pointer: ${T}`);de=T,ge=l.default.rootData}else{let Fe=Oe.exec(T);if(!Fe)throw new Error(`Invalid JSON-pointer: ${T}`);let Ne=+Fe[1];if(de=Fe[2],de==="#"){if(Ne>=U)throw new Error(Ke("property/index",Ne));return ue[U-Ne]}if(Ne>U)throw new Error(Ke("data",Ne));if(ge=V[U-Ne],!de)return ge}let De=ge,Ve=de.split("/");for(let Fe of Ve)Fe&&(ge=(0,c._)`${ge}${(0,c.getProperty)((0,p.unescapeJsonPointer)(Fe))}`,De=(0,c._)`${De} && ${ge}`);return De;function Ke(Fe,Ne){return`Cannot access ${Fe} ${Ne} levels up, current level is ${U}`}}e.getData=tt})),Nu=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=class extends Error{constructor(n){super("validation failed"),this.errors=n,this.ajv=this.validation=!0}};e.default=t})),la=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ju();var n=class extends Error{constructor(o,r,i,a){super(a||`can't resolve reference ${i} from id ${r}`),this.missingRef=(0,t.resolveUrl)(o,r,i),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(o,this.missingRef))}};e.default=n})),Cu=K((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;let t=ve(),n=Nu(),o=Pt(),r=ju(),i=ze(),a=ca();var s=class{constructor(h){var w;this.refs={},this.dynamicAnchors={};let v;typeof h.schema=="object"&&(v=h.schema),this.schema=h.schema,this.schemaId=h.schemaId,this.root=h.root||this,this.baseId=(w=h.baseId)!==null&&w!==void 0?w:(0,r.normalizeId)(v?.[h.schemaId||"$id"]),this.schemaPath=h.schemaPath,this.localRefs=h.localRefs,this.meta=h.meta,this.$async=v?.$async,this.refs={}}};e.SchemaEnv=s;function c(h){let w=p.call(this,h);if(w)return w;let v=(0,r.getFullPath)(this.opts.uriResolver,h.root.baseId),{es5:$,lines:I}=this.opts.code,{ownProperties:z}=this.opts,y=new t.CodeGen(this.scope,{es5:$,lines:I,ownProperties:z}),R;h.$async&&(R=y.scopeValue("Error",{ref:n.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let O=y.scopeName("validate");h.validateName=O;let L={gen:y,allErrors:this.opts.allErrors,data:o.default.data,parentData:o.default.parentData,parentDataProperty:o.default.parentDataProperty,dataNames:[o.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:y.scopeValue("schema",this.opts.code.source===!0?{ref:h.schema,code:(0,t.stringify)(h.schema)}:{ref:h.schema}),validateName:O,ValidationError:R,schema:h.schema,schemaEnv:h,rootId:v,baseId:h.baseId||v,schemaPath:t.nil,errSchemaPath:h.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,t._)`""`,opts:this.opts,self:this},A;try{this._compilations.add(h),(0,a.validateFunctionCode)(L),y.optimize(this.opts.code.optimize);let F=y.toString();A=`${y.scopeRefs(o.default.scope)}return ${F}`,this.opts.code.process&&(A=this.opts.code.process(A,h));let ee=new Function(`${o.default.self}`,`${o.default.scope}`,A)(this,this.scope.get());if(this.scope.value(O,{ref:ee}),ee.errors=null,ee.schema=h.schema,ee.schemaEnv=h,h.$async&&(ee.$async=!0),this.opts.code.source===!0&&(ee.source={validateName:O,validateCode:F,scopeValues:y._values}),this.opts.unevaluated){let{props:ne,items:be}=L;ee.evaluated={props:ne instanceof t.Name?void 0:ne,items:be instanceof t.Name?void 0:be,dynamicProps:ne instanceof t.Name,dynamicItems:be instanceof t.Name},ee.source&&(ee.source.evaluated=(0,t.stringify)(ee.evaluated))}return h.validate=ee,h}catch(F){throw delete h.validate,delete h.validateName,A&&this.logger.error("Error compiling schema, function code:",A),F}finally{this._compilations.delete(h)}}e.compileSchema=c;function l(h,w,v){var $;v=(0,r.resolveUrl)(this.opts.uriResolver,w,v);let I=h.refs[v];if(I)return I;let z=b.call(this,h,v);if(z===void 0){let y=($=h.localRefs)===null||$===void 0?void 0:$[v],{schemaId:R}=this.opts;y&&(z=new s({schema:y,schemaId:R,root:h,baseId:w}))}if(z!==void 0)return h.refs[v]=u.call(this,z)}e.resolveRef=l;function u(h){return(0,r.inlineRef)(h.schema,this.opts.inlineRefs)?h.schema:h.validate?h:c.call(this,h)}function p(h){for(let w of this._compilations)if(f(w,h))return w}e.getCompilingSchema=p;function f(h,w){return h.schema===w.schema&&h.root===w.root&&h.baseId===w.baseId}function b(h,w){let v;for(;typeof(v=this.refs[w])=="string";)w=v;return v||this.schemas[w]||g.call(this,h,w)}function g(h,w){let v=this.opts.uriResolver.parse(w),$=(0,r._getFullPath)(this.opts.uriResolver,v),I=(0,r.getFullPath)(this.opts.uriResolver,h.baseId,void 0);if(Object.keys(h.schema).length>0&&$===I)return _.call(this,v,h);let z=(0,r.normalizeId)($),y=this.refs[z]||this.schemas[z];if(typeof y=="string"){let R=g.call(this,h,y);return typeof R?.schema!="object"?void 0:_.call(this,v,R)}if(typeof y?.schema=="object"){if(y.validate||c.call(this,y),z===(0,r.normalizeId)(w)){let{schema:R}=y,{schemaId:O}=this.opts,L=R[O];return L&&(I=(0,r.resolveUrl)(this.opts.uriResolver,I,L)),new s({schema:R,schemaId:O,root:h,baseId:I})}return _.call(this,v,y)}}e.resolveSchema=g;let S=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function _(h,{baseId:w,schema:v,root:$}){var I;if(((I=h.fragment)===null||I===void 0?void 0:I[0])!=="/")return;for(let R of h.fragment.slice(1).split("/")){if(typeof v=="boolean")return;let O=v[(0,i.unescapeFragment)(R)];if(O===void 0)return;v=O;let L=typeof v=="object"&&v[this.opts.schemaId];!S.has(R)&&L&&(w=(0,r.resolveUrl)(this.opts.uriResolver,w,L))}let z;if(typeof v!="boolean"&&v.$ref&&!(0,i.schemaHasRulesButRef)(v,this.RULES)){let R=(0,r.resolveUrl)(this.opts.uriResolver,w,v.$ref);z=g.call(this,$,R)}let{schemaId:y}=this.opts;if(z=z||new s({schema:v,schemaId:y,root:$,baseId:w}),z.schema!==z.root.schema)return z}})),Lk=K(((e,t)=>{t.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}})),US=K(((e,t)=>{let n=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),o=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function r(g){let S="",_=0,h=0;for(h=0;h<g.length;h++)if(_=g[h].charCodeAt(0),_!==48){if(!(_>=48&&_<=57||_>=65&&_<=70||_>=97&&_<=102))return"";S+=g[h];break}for(h+=1;h<g.length;h++){if(_=g[h].charCodeAt(0),!(_>=48&&_<=57||_>=65&&_<=70||_>=97&&_<=102))return"";S+=g[h]}return S}let i=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function a(g){return g.length=0,!0}function s(g,S,_){if(g.length){let h=r(g);if(h!=="")S.push(h);else return _.error=!0,!1;g.length=0}return!0}function c(g){let S=0,_={error:!1,address:"",zone:""},h=[],w=[],v=!1,$=!1,I=s;for(let z=0;z<g.length;z++){let y=g[z];if(!(y==="["||y==="]"))if(y===":"){if(v===!0&&($=!0),!I(w,h,_))break;if(++S>7){_.error=!0;break}z>0&&g[z-1]===":"&&(v=!0),h.push(":");continue}else if(y==="%"){if(!I(w,h,_))break;I=a}else{w.push(y);continue}}return w.length&&(I===a?_.zone=w.join(""):$?h.push(w.join("")):h.push(r(w))),_.address=h.join(""),_}function l(g){if(u(g,":")<2)return{host:g,isIPV6:!1};let S=c(g);if(S.error)return{host:g,isIPV6:!1};{let _=S.address,h=S.address;return S.zone&&(_+="%"+S.zone,h+="%25"+S.zone),{host:_,isIPV6:!0,escapedHost:h}}}function u(g,S){let _=0;for(let h=0;h<g.length;h++)g[h]===S&&_++;return _}function p(g){let S=g,_=[],h=-1,w=0;for(;w=S.length;){if(w===1){if(S===".")break;if(S==="/"){_.push("/");break}else{_.push(S);break}}else if(w===2){if(S[0]==="."){if(S[1]===".")break;if(S[1]==="/"){S=S.slice(2);continue}}else if(S[0]==="/"&&(S[1]==="."||S[1]==="/")){_.push("/");break}}else if(w===3&&S==="/.."){_.length!==0&&_.pop(),_.push("/");break}if(S[0]==="."){if(S[1]==="."){if(S[2]==="/"){S=S.slice(3);continue}}else if(S[1]==="/"){S=S.slice(2);continue}}else if(S[0]==="/"&&S[1]==="."){if(S[2]==="/"){S=S.slice(2);continue}else if(S[2]==="."&&S[3]==="/"){S=S.slice(3),_.length!==0&&_.pop();continue}}if((h=S.indexOf("/",1))===-1){_.push(S);break}else _.push(S.slice(0,h)),S=S.slice(h)}return _.join("")}function f(g,S){let _=S!==!0?escape:unescape;return g.scheme!==void 0&&(g.scheme=_(g.scheme)),g.userinfo!==void 0&&(g.userinfo=_(g.userinfo)),g.host!==void 0&&(g.host=_(g.host)),g.path!==void 0&&(g.path=_(g.path)),g.query!==void 0&&(g.query=_(g.query)),g.fragment!==void 0&&(g.fragment=_(g.fragment)),g}function b(g){let S=[];if(g.userinfo!==void 0&&(S.push(g.userinfo),S.push("@")),g.host!==void 0){let _=unescape(g.host);if(!o(_)){let h=l(_);h.isIPV6===!0?_=`[${h.escapedHost}]`:_=g.host}S.push(_)}return(typeof g.port=="number"||typeof g.port=="string")&&(S.push(":"),S.push(String(g.port))),S.length?S.join(""):void 0}t.exports={nonSimpleDomain:i,recomposeAuthority:b,normalizeComponentEncoding:f,removeDotSegments:p,isIPv4:o,isUUID:n,normalizeIPv6:l,stringArrayToHexStripped:r}})),Fk=K(((e,t)=>{let{isUUID:n}=US(),o=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,r=["http","https","ws","wss","urn","urn:uuid"];function i(y){return r.indexOf(y)!==-1}function a(y){return y.secure===!0?!0:y.secure===!1?!1:y.scheme?y.scheme.length===3&&(y.scheme[0]==="w"||y.scheme[0]==="W")&&(y.scheme[1]==="s"||y.scheme[1]==="S")&&(y.scheme[2]==="s"||y.scheme[2]==="S"):!1}function s(y){return y.host||(y.error=y.error||"HTTP URIs must have a host."),y}function c(y){let R=String(y.scheme).toLowerCase()==="https";return(y.port===(R?443:80)||y.port==="")&&(y.port=void 0),y.path||(y.path="/"),y}function l(y){return y.secure=a(y),y.resourceName=(y.path||"/")+(y.query?"?"+y.query:""),y.path=void 0,y.query=void 0,y}function u(y){if((y.port===(a(y)?443:80)||y.port==="")&&(y.port=void 0),typeof y.secure=="boolean"&&(y.scheme=y.secure?"wss":"ws",y.secure=void 0),y.resourceName){let[R,O]=y.resourceName.split("?");y.path=R&&R!=="/"?R:void 0,y.query=O,y.resourceName=void 0}return y.fragment=void 0,y}function p(y,R){if(!y.path)return y.error="URN can not be parsed",y;let O=y.path.match(o);if(O){let L=R.scheme||y.scheme||"urn";y.nid=O[1].toLowerCase(),y.nss=O[2];let A=z(`${L}:${R.nid||y.nid}`);y.path=void 0,A&&(y=A.parse(y,R))}else y.error=y.error||"URN can not be parsed.";return y}function f(y,R){if(y.nid===void 0)throw new Error("URN without nid cannot be serialized");let O=R.scheme||y.scheme||"urn",L=y.nid.toLowerCase(),A=z(`${O}:${R.nid||L}`);A&&(y=A.serialize(y,R));let F=y,ee=y.nss;return F.path=`${L||R.nid}:${ee}`,R.skipEscape=!0,F}function b(y,R){let O=y;return O.uuid=O.nss,O.nss=void 0,!R.tolerant&&(!O.uuid||!n(O.uuid))&&(O.error=O.error||"UUID is not valid."),O}function g(y){let R=y;return R.nss=(y.uuid||"").toLowerCase(),R}let S={scheme:"http",domainHost:!0,parse:s,serialize:c},_={scheme:"https",domainHost:S.domainHost,parse:s,serialize:c},h={scheme:"ws",domainHost:!0,parse:l,serialize:u},w={scheme:"wss",domainHost:h.domainHost,parse:h.parse,serialize:h.serialize},I={http:S,https:_,ws:h,wss:w,urn:{scheme:"urn",parse:p,serialize:f,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:b,serialize:g,skipNormalize:!0}};Object.setPrototypeOf(I,null);function z(y){return y&&(I[y]||I[y.toLowerCase()])||void 0}t.exports={wsIsSecure:a,SCHEMES:I,isValidSchemeName:i,getSchemeHandler:z}})),Vk=K(((e,t)=>{let{normalizeIPv6:n,removeDotSegments:o,recomposeAuthority:r,normalizeComponentEncoding:i,isIPv4:a,nonSimpleDomain:s}=US(),{SCHEMES:c,getSchemeHandler:l}=Fk();function u(w,v){return typeof w=="string"?w=g(_(w,v),v):typeof w=="object"&&(w=_(g(w,v),v)),w}function p(w,v,$){let I=$?Object.assign({scheme:"null"},$):{scheme:"null"},z=f(_(w,I),_(v,I),I,!0);return I.skipEscape=!0,g(z,I)}function f(w,v,$,I){let z={};return I||(w=_(g(w,$),$),v=_(g(v,$),$)),$=$||{},!$.tolerant&&v.scheme?(z.scheme=v.scheme,z.userinfo=v.userinfo,z.host=v.host,z.port=v.port,z.path=o(v.path||""),z.query=v.query):(v.userinfo!==void 0||v.host!==void 0||v.port!==void 0?(z.userinfo=v.userinfo,z.host=v.host,z.port=v.port,z.path=o(v.path||""),z.query=v.query):(v.path?(v.path[0]==="/"?z.path=o(v.path):((w.userinfo!==void 0||w.host!==void 0||w.port!==void 0)&&!w.path?z.path="/"+v.path:w.path?z.path=w.path.slice(0,w.path.lastIndexOf("/")+1)+v.path:z.path=v.path,z.path=o(z.path)),z.query=v.query):(z.path=w.path,v.query!==void 0?z.query=v.query:z.query=w.query),z.userinfo=w.userinfo,z.host=w.host,z.port=w.port),z.scheme=w.scheme),z.fragment=v.fragment,z}function b(w,v,$){return typeof w=="string"?(w=unescape(w),w=g(i(_(w,$),!0),{...$,skipEscape:!0})):typeof w=="object"&&(w=g(i(w,!0),{...$,skipEscape:!0})),typeof v=="string"?(v=unescape(v),v=g(i(_(v,$),!0),{...$,skipEscape:!0})):typeof v=="object"&&(v=g(i(v,!0),{...$,skipEscape:!0})),w.toLowerCase()===v.toLowerCase()}function g(w,v){let $={host:w.host,scheme:w.scheme,userinfo:w.userinfo,port:w.port,path:w.path,query:w.query,nid:w.nid,nss:w.nss,uuid:w.uuid,fragment:w.fragment,reference:w.reference,resourceName:w.resourceName,secure:w.secure,error:""},I=Object.assign({},v),z=[],y=l(I.scheme||$.scheme);y&&y.serialize&&y.serialize($,I),$.path!==void 0&&(I.skipEscape?$.path=unescape($.path):($.path=escape($.path),$.scheme!==void 0&&($.path=$.path.split("%3A").join(":")))),I.reference!=="suffix"&&$.scheme&&z.push($.scheme,":");let R=r($);if(R!==void 0&&(I.reference!=="suffix"&&z.push("//"),z.push(R),$.path&&$.path[0]!=="/"&&z.push("/")),$.path!==void 0){let O=$.path;!I.absolutePath&&(!y||!y.absolutePath)&&(O=o(O)),R===void 0&&O[0]==="/"&&O[1]==="/"&&(O="/%2F"+O.slice(2)),z.push(O)}return $.query!==void 0&&z.push("?",$.query),$.fragment!==void 0&&z.push("#",$.fragment),z.join("")}let S=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function _(w,v){let $=Object.assign({},v),I={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},z=!1;$.reference==="suffix"&&($.scheme?w=$.scheme+":"+w:w="//"+w);let y=w.match(S);if(y){if(I.scheme=y[1],I.userinfo=y[3],I.host=y[4],I.port=parseInt(y[5],10),I.path=y[6]||"",I.query=y[7],I.fragment=y[8],isNaN(I.port)&&(I.port=y[5]),I.host)if(a(I.host)===!1){let O=n(I.host);I.host=O.host.toLowerCase(),z=O.isIPV6}else z=!0;I.scheme===void 0&&I.userinfo===void 0&&I.host===void 0&&I.port===void 0&&I.query===void 0&&!I.path?I.reference="same-document":I.scheme===void 0?I.reference="relative":I.fragment===void 0?I.reference="absolute":I.reference="uri",$.reference&&$.reference!=="suffix"&&$.reference!==I.reference&&(I.error=I.error||"URI is not a "+$.reference+" reference.");let R=l($.scheme||I.scheme);if(!$.unicodeSupport&&(!R||!R.unicodeSupport)&&I.host&&($.domainHost||R&&R.domainHost)&&z===!1&&s(I.host))try{I.host=URL.domainToASCII(I.host.toLowerCase())}catch(O){I.error=I.error||"Host's domain name can not be converted to ASCII: "+O}(!R||R&&!R.skipNormalize)&&(w.indexOf("%")!==-1&&(I.scheme!==void 0&&(I.scheme=unescape(I.scheme)),I.host!==void 0&&(I.host=unescape(I.host))),I.path&&(I.path=escape(unescape(I.path))),I.fragment&&(I.fragment=encodeURI(decodeURIComponent(I.fragment)))),R&&R.parse&&R.parse(I,$)}else I.error=I.error||"URI can not be parsed.";return I}let h={SCHEMES:c,normalize:u,resolve:p,resolveComponent:f,equal:b,serialize:g,parse:_};t.exports=h,t.exports.default=h,t.exports.fastUri=h})),Zk=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Vk();t.code='require("ajv/dist/runtime/uri").default',e.default=t})),LS=K((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=ca();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var n=ve();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return n.CodeGen}});let o=Nu(),r=la(),i=MS(),a=Cu(),s=ve(),c=ju(),l=xu(),u=ze(),p=Lk(),f=Zk(),b=(x,D)=>new RegExp(x,D);b.code="new RegExp";let g=["removeAdditional","useDefaults","coerceTypes"],S=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),_={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."},h={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},w=200;function v(x){var D,G,k,E,M,Y,se,_e,me,Oe,tt,T,U,V,ue,de,ge,De,Ve,Ke,Fe,Ne,yt,Ze,Ft;let wt=x.strict,Vt=(D=x.code)===null||D===void 0?void 0:D.optimize,or=Vt===!0||Vt===void 0?1:Vt||0,ir=(k=(G=x.code)===null||G===void 0?void 0:G.regExp)!==null&&k!==void 0?k:b,Ar=(E=x.uriResolver)!==null&&E!==void 0?E:f.default;return{strictSchema:(Y=(M=x.strictSchema)!==null&&M!==void 0?M:wt)!==null&&Y!==void 0?Y:!0,strictNumbers:(_e=(se=x.strictNumbers)!==null&&se!==void 0?se:wt)!==null&&_e!==void 0?_e:!0,strictTypes:(Oe=(me=x.strictTypes)!==null&&me!==void 0?me:wt)!==null&&Oe!==void 0?Oe:"log",strictTuples:(T=(tt=x.strictTuples)!==null&&tt!==void 0?tt:wt)!==null&&T!==void 0?T:"log",strictRequired:(V=(U=x.strictRequired)!==null&&U!==void 0?U:wt)!==null&&V!==void 0?V:!1,code:x.code?{...x.code,optimize:or,regExp:ir}:{optimize:or,regExp:ir},loopRequired:(ue=x.loopRequired)!==null&&ue!==void 0?ue:w,loopEnum:(de=x.loopEnum)!==null&&de!==void 0?de:w,meta:(ge=x.meta)!==null&&ge!==void 0?ge:!0,messages:(De=x.messages)!==null&&De!==void 0?De:!0,inlineRefs:(Ve=x.inlineRefs)!==null&&Ve!==void 0?Ve:!0,schemaId:(Ke=x.schemaId)!==null&&Ke!==void 0?Ke:"$id",addUsedSchema:(Fe=x.addUsedSchema)!==null&&Fe!==void 0?Fe:!0,validateSchema:(Ne=x.validateSchema)!==null&&Ne!==void 0?Ne:!0,validateFormats:(yt=x.validateFormats)!==null&&yt!==void 0?yt:!0,unicodeRegExp:(Ze=x.unicodeRegExp)!==null&&Ze!==void 0?Ze:!0,int32range:(Ft=x.int32range)!==null&&Ft!==void 0?Ft:!0,uriResolver:Ar}}var $=class{constructor(x={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,x=this.opts={...x,...v(x)};let{es5:D,lines:G}=this.opts.code;this.scope=new s.ValueScope({scope:{},prefixes:S,es5:D,lines:G}),this.logger=F(x.logger);let k=x.validateFormats;x.validateFormats=!1,this.RULES=(0,i.getRules)(),I.call(this,_,x,"NOT SUPPORTED"),I.call(this,h,x,"DEPRECATED","warn"),this._metaOpts=L.call(this),x.formats&&R.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),x.keywords&&O.call(this,x.keywords),typeof x.meta=="object"&&this.addMetaSchema(x.meta),y.call(this),x.validateFormats=k}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:x,meta:D,schemaId:G}=this.opts,k=p;G==="id"&&(k={...p},k.id=k.$id,delete k.$id),D&&x&&this.addMetaSchema(k,k[G],!1)}defaultMeta(){let{meta:x,schemaId:D}=this.opts;return this.opts.defaultMeta=typeof x=="object"?x[D]||x:void 0}validate(x,D){let G;if(typeof x=="string"){if(G=this.getSchema(x),!G)throw new Error(`no schema with key or ref "${x}"`)}else G=this.compile(x);let k=G(D);return"$async"in G||(this.errors=G.errors),k}compile(x,D){let G=this._addSchema(x,D);return G.validate||this._compileSchemaEnv(G)}compileAsync(x,D){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:G}=this.opts;return k.call(this,x,D);async function k(me,Oe){await E.call(this,me.$schema);let tt=this._addSchema(me,Oe);return tt.validate||M.call(this,tt)}async function E(me){me&&!this.getSchema(me)&&await k.call(this,{$ref:me},!0)}async function M(me){try{return this._compileSchemaEnv(me)}catch(Oe){if(!(Oe instanceof r.default))throw Oe;return Y.call(this,Oe),await se.call(this,Oe.missingSchema),M.call(this,me)}}function Y({missingSchema:me,missingRef:Oe}){if(this.refs[me])throw new Error(`AnySchema ${me} is loaded but ${Oe} cannot be resolved`)}async function se(me){let Oe=await _e.call(this,me);this.refs[me]||await E.call(this,Oe.$schema),this.refs[me]||this.addSchema(Oe,me,D)}async function _e(me){let Oe=this._loading[me];if(Oe)return Oe;try{return await(this._loading[me]=G(me))}finally{delete this._loading[me]}}}addSchema(x,D,G,k=this.opts.validateSchema){if(Array.isArray(x)){for(let M of x)this.addSchema(M,void 0,G,k);return this}let E;if(typeof x=="object"){let{schemaId:M}=this.opts;if(E=x[M],E!==void 0&&typeof E!="string")throw new Error(`schema ${M} must be string`)}return D=(0,c.normalizeId)(D||E),this._checkUnique(D),this.schemas[D]=this._addSchema(x,G,D,k,!0),this}addMetaSchema(x,D,G=this.opts.validateSchema){return this.addSchema(x,D,!0,G),this}validateSchema(x,D){if(typeof x=="boolean")return!0;let G;if(G=x.$schema,G!==void 0&&typeof G!="string")throw new Error("$schema must be a string");if(G=G||this.opts.defaultMeta||this.defaultMeta(),!G)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let k=this.validate(G,x);if(!k&&D){let E="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(E);else throw new Error(E)}return k}getSchema(x){let D;for(;typeof(D=z.call(this,x))=="string";)x=D;if(D===void 0){let{schemaId:G}=this.opts,k=new a.SchemaEnv({schema:{},schemaId:G});if(D=a.resolveSchema.call(this,k,x),!D)return;this.refs[x]=D}return D.validate||this._compileSchemaEnv(D)}removeSchema(x){if(x instanceof RegExp)return this._removeAllSchemas(this.schemas,x),this._removeAllSchemas(this.refs,x),this;switch(typeof x){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let D=z.call(this,x);return typeof D=="object"&&this._cache.delete(D.schema),delete this.schemas[x],delete this.refs[x],this}case"object":{let D=x;this._cache.delete(D);let G=x[this.opts.schemaId];return G&&(G=(0,c.normalizeId)(G),delete this.schemas[G],delete this.refs[G]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(x){for(let D of x)this.addKeyword(D);return this}addKeyword(x,D){let G;if(typeof x=="string")G=x,typeof D=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),D.keyword=G);else if(typeof x=="object"&&D===void 0){if(D=x,G=D.keyword,Array.isArray(G)&&!G.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(ne.call(this,G,D),!D)return(0,u.eachItem)(G,E=>be.call(this,E)),this;xe.call(this,D);let k={...D,type:(0,l.getJSONTypes)(D.type),schemaType:(0,l.getJSONTypes)(D.schemaType)};return(0,u.eachItem)(G,k.type.length===0?E=>be.call(this,E,k):E=>k.type.forEach(M=>be.call(this,E,k,M))),this}getKeyword(x){let D=this.RULES.all[x];return typeof D=="object"?D.definition:!!D}removeKeyword(x){let{RULES:D}=this;delete D.keywords[x],delete D.all[x];for(let G of D.rules){let k=G.rules.findIndex(E=>E.keyword===x);k>=0&&G.rules.splice(k,1)}return this}addFormat(x,D){return typeof D=="string"&&(D=new RegExp(D)),this.formats[x]=D,this}errorsText(x=this.errors,{separator:D=", ",dataVar:G="data"}={}){return!x||x.length===0?"No errors":x.map(k=>`${G}${k.instancePath} ${k.message}`).reduce((k,E)=>k+D+E)}$dataMetaSchema(x,D){let G=this.RULES.all;x=JSON.parse(JSON.stringify(x));for(let k of D){let E=k.split("/").slice(1),M=x;for(let Y of E)M=M[Y];for(let Y in G){let se=G[Y];if(typeof se!="object")continue;let{$data:_e}=se.definition,me=M[Y];_e&&me&&(M[Y]=we(me))}}return x}_removeAllSchemas(x,D){for(let G in x){let k=x[G];(!D||D.test(G))&&(typeof k=="string"?delete x[G]:k&&!k.meta&&(this._cache.delete(k.schema),delete x[G]))}}_addSchema(x,D,G,k=this.opts.validateSchema,E=this.opts.addUsedSchema){let M,{schemaId:Y}=this.opts;if(typeof x=="object")M=x[Y];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof x!="boolean")throw new Error("schema must be object or boolean")}let se=this._cache.get(x);if(se!==void 0)return se;G=(0,c.normalizeId)(M||G);let _e=c.getSchemaRefs.call(this,x,G);return se=new a.SchemaEnv({schema:x,schemaId:Y,meta:D,baseId:G,localRefs:_e}),this._cache.set(se.schema,se),E&&!G.startsWith("#")&&(G&&this._checkUnique(G),this.refs[G]=se),k&&this.validateSchema(x,!0),se}_checkUnique(x){if(this.schemas[x]||this.refs[x])throw new Error(`schema with key or id "${x}" already exists`)}_compileSchemaEnv(x){if(x.meta?this._compileMetaSchema(x):a.compileSchema.call(this,x),!x.validate)throw new Error("ajv implementation error");return x.validate}_compileMetaSchema(x){let D=this.opts;this.opts=this._metaOpts;try{a.compileSchema.call(this,x)}finally{this.opts=D}}};$.ValidationError=o.default,$.MissingRefError=r.default,e.default=$;function I(x,D,G,k="error"){for(let E in x){let M=E;M in D&&this.logger[k](`${G}: option ${E}. ${x[M]}`)}}function z(x){return x=(0,c.normalizeId)(x),this.schemas[x]||this.refs[x]}function y(){let x=this.opts.schemas;if(x)if(Array.isArray(x))this.addSchema(x);else for(let D in x)this.addSchema(x[D],D)}function R(){for(let x in this.opts.formats){let D=this.opts.formats[x];D&&this.addFormat(x,D)}}function O(x){if(Array.isArray(x)){this.addVocabulary(x);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let D in x){let G=x[D];G.keyword||(G.keyword=D),this.addKeyword(G)}}function L(){let x={...this.opts};for(let D of g)delete x[D];return x}let A={log(){},warn(){},error(){}};function F(x){if(x===!1)return A;if(x===void 0)return console;if(x.log&&x.warn&&x.error)return x;throw new Error("logger must implement log, warn and error methods")}let ee=/^[a-z_$][a-z0-9_$:-]*$/i;function ne(x,D){let{RULES:G}=this;if((0,u.eachItem)(x,k=>{if(G.keywords[k])throw new Error(`Keyword ${k} is already defined`);if(!ee.test(k))throw new Error(`Keyword ${k} has invalid name`)}),!!D&&D.$data&&!("code"in D||"validate"in D))throw new Error('$data keyword must have "code" or "validate" function')}function be(x,D,G){var k;let E=D?.post;if(G&&E)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:M}=this,Y=E?M.post:M.rules.find(({type:_e})=>_e===G);if(Y||(Y={type:G,rules:[]},M.rules.push(Y)),M.keywords[x]=!0,!D)return;let se={keyword:x,definition:{...D,type:(0,l.getJSONTypes)(D.type),schemaType:(0,l.getJSONTypes)(D.schemaType)}};D.before?je.call(this,Y,se,D.before):Y.rules.push(se),M.all[x]=se,(k=D.implements)===null||k===void 0||k.forEach(_e=>this.addKeyword(_e))}function je(x,D,G){let k=x.rules.findIndex(E=>E.keyword===G);k>=0?x.rules.splice(k,0,D):(x.rules.push(D),this.logger.warn(`rule ${G} is not defined`))}function xe(x){let{metaSchema:D}=x;D!==void 0&&(x.$data&&this.opts.$data&&(D=we(D)),x.validateSchema=this.compile(D,!0))}let Le={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function we(x){return{anyOf:[x,Le]}}})),Gk=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};e.default=t})),gv=K((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;let t=la(),n=Tt(),o=ve(),r=Pt(),i=Cu(),a=ze(),s={keyword:"$ref",schemaType:"string",code(u){let{gen:p,schema:f,it:b}=u,{baseId:g,schemaEnv:S,validateName:_,opts:h,self:w}=b,{root:v}=S;if((f==="#"||f==="#/")&&g===v.baseId)return I();let $=i.resolveRef.call(w,v,g,f);if($===void 0)throw new t.default(b.opts.uriResolver,g,f);if($ instanceof i.SchemaEnv)return z($);return y($);function I(){if(S===v)return l(u,_,S,S.$async);let R=p.scopeValue("root",{ref:v});return l(u,(0,o._)`${R}.validate`,v,v.$async)}function z(R){l(u,c(u,R),R,R.$async)}function y(R){let O=p.scopeValue("schema",h.code.source===!0?{ref:R,code:(0,o.stringify)(R)}:{ref:R}),L=p.name("valid"),A=u.subschema({schema:R,dataTypes:[],schemaPath:o.nil,topSchemaRef:O,errSchemaPath:f},L);u.mergeEvaluated(A),u.ok(L)}}};function c(u,p){let{gen:f}=u;return p.validate?f.scopeValue("validate",{ref:p.validate}):(0,o._)`${f.scopeValue("wrapper",{ref:p})}.validate`}e.getValidate=c;function l(u,p,f,b){let{gen:g,it:S}=u,{allErrors:_,schemaEnv:h,opts:w}=S,v=w.passContext?r.default.this:o.nil;b?$():I();function $(){if(!h.$async)throw new Error("async schema referenced by sync schema");let R=g.let("valid");g.try(()=>{g.code((0,o._)`await ${(0,n.callValidateCode)(u,p,v)}`),y(p),_||g.assign(R,!0)},O=>{g.if((0,o._)`!(${O} instanceof ${S.ValidationError})`,()=>g.throw(O)),z(O),_||g.assign(R,!1)}),u.ok(R)}function I(){u.result((0,n.callValidateCode)(u,p,v),()=>y(p),()=>z(p))}function z(R){let O=(0,o._)`${R}.errors`;g.assign(r.default.vErrors,(0,o._)`${r.default.vErrors} === null ? ${O} : ${r.default.vErrors}.concat(${O})`),g.assign(r.default.errors,(0,o._)`${r.default.vErrors}.length`)}function y(R){var O;if(!S.opts.unevaluated)return;let L=(O=f?.validate)===null||O===void 0?void 0:O.evaluated;if(S.props!==!0)if(L&&!L.dynamicProps)L.props!==void 0&&(S.props=a.mergeEvaluated.props(g,L.props,S.props));else{let A=g.var("props",(0,o._)`${R}.evaluated.props`);S.props=a.mergeEvaluated.props(g,A,S.props,o.Name)}if(S.items!==!0)if(L&&!L.dynamicItems)L.items!==void 0&&(S.items=a.mergeEvaluated.items(g,L.items,S.items));else{let A=g.var("items",(0,o._)`${R}.evaluated.items`);S.items=a.mergeEvaluated.items(g,A,S.items,o.Name)}}}e.callRef=l,e.default=s})),FS=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Gk(),n=gv(),o=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,n.default];e.default=o})),Jk=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ve(),n=t.operators,o={maximum:{okStr:"<=",ok:n.LTE,fail:n.GT},minimum:{okStr:">=",ok:n.GTE,fail:n.LT},exclusiveMaximum:{okStr:"<",ok:n.LT,fail:n.GTE},exclusiveMinimum:{okStr:">",ok:n.GT,fail:n.LTE}},r={keyword:Object.keys(o),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:i,schemaCode:a})=>(0,t.str)`must be ${o[i].okStr} ${a}`,params:({keyword:i,schemaCode:a})=>(0,t._)`{comparison: ${o[i].okStr}, limit: ${a}}`},code(i){let{keyword:a,data:s,schemaCode:c}=i;i.fail$data((0,t._)`${s} ${o[a].fail} ${c} || isNaN(${s})`)}};e.default=r})),Hk=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ve(),n={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:o})=>(0,t.str)`must be multiple of ${o}`,params:({schemaCode:o})=>(0,t._)`{multipleOf: ${o}}`},code(o){let{gen:r,data:i,schemaCode:a,it:s}=o,c=s.opts.multipleOfPrecision,l=r.let("res"),u=c?(0,t._)`Math.abs(Math.round(${l}) - ${l}) > 1e-${c}`:(0,t._)`${l} !== parseInt(${l})`;o.fail$data((0,t._)`(${a} === 0 || (${l} = ${i}/${a}, ${u}))`)}};e.default=n})),Bk=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(n){let o=n.length,r=0,i=0,a;for(;i<o;)r++,a=n.charCodeAt(i++),a>=55296&&a<=56319&&i<o&&(a=n.charCodeAt(i),(a&64512)===56320&&i++);return r}e.default=t,t.code='require("ajv/dist/runtime/ucs2length").default'})),Kk=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ve(),n=ze(),o=Bk(),r={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:i,schemaCode:a}){let s=i==="maxLength"?"more":"fewer";return(0,t.str)`must NOT have ${s} than ${a} characters`},params:({schemaCode:i})=>(0,t._)`{limit: ${i}}`},code(i){let{keyword:a,data:s,schemaCode:c,it:l}=i,u=a==="maxLength"?t.operators.GT:t.operators.LT,p=l.opts.unicode===!1?(0,t._)`${s}.length`:(0,t._)`${(0,n.useFunc)(i.gen,o.default)}(${s})`;i.fail$data((0,t._)`${p} ${u} ${c}`)}};e.default=r})),Wk=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Tt(),n=ze(),o=ve(),r={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:i})=>(0,o.str)`must match pattern "${i}"`,params:({schemaCode:i})=>(0,o._)`{pattern: ${i}}`},code(i){let{gen:a,data:s,$data:c,schema:l,schemaCode:u,it:p}=i,f=p.opts.unicodeRegExp?"u":"";if(c){let{regExp:b}=p.opts.code,g=b.code==="new RegExp"?(0,o._)`new RegExp`:(0,n.useFunc)(a,b),S=a.let("valid");a.try(()=>a.assign(S,(0,o._)`${g}(${u}, ${f}).test(${s})`),()=>a.assign(S,!1)),i.fail$data((0,o._)`!${S}`)}else{let b=(0,t.usePattern)(i,l);i.fail$data((0,o._)`!${b}.test(${s})`)}}};e.default=r})),Yk=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ve(),n={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:o,schemaCode:r}){let i=o==="maxProperties"?"more":"fewer";return(0,t.str)`must NOT have ${i} than ${r} properties`},params:({schemaCode:o})=>(0,t._)`{limit: ${o}}`},code(o){let{keyword:r,data:i,schemaCode:a}=o,s=r==="maxProperties"?t.operators.GT:t.operators.LT;o.fail$data((0,t._)`Object.keys(${i}).length ${s} ${a}`)}};e.default=n})),Xk=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Tt(),n=ve(),o=ze(),r={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:i}})=>(0,n.str)`must have required property '${i}'`,params:({params:{missingProperty:i}})=>(0,n._)`{missingProperty: ${i}}`},code(i){let{gen:a,schema:s,schemaCode:c,data:l,$data:u,it:p}=i,{opts:f}=p;if(!u&&s.length===0)return;let b=s.length>=f.loopRequired;if(p.allErrors?g():S(),f.strictRequired){let w=i.parentSchema.properties,{definedProperties:v}=i.it;for(let $ of s)if(w?.[$]===void 0&&!v.has($)){let I=`required property "${$}" is not defined at "${p.schemaEnv.baseId+p.errSchemaPath}" (strictRequired)`;(0,o.checkStrictMode)(p,I,p.opts.strictRequired)}}function g(){if(b||u)i.block$data(n.nil,_);else for(let w of s)(0,t.checkReportMissingProp)(i,w)}function S(){let w=a.let("missing");if(b||u){let v=a.let("valid",!0);i.block$data(v,()=>h(w,v)),i.ok(v)}else a.if((0,t.checkMissingProp)(i,s,w)),(0,t.reportMissingProp)(i,w),a.else()}function _(){a.forOf("prop",c,w=>{i.setParams({missingProperty:w}),a.if((0,t.noPropertyInData)(a,l,w,f.ownProperties),()=>i.error())})}function h(w,v){i.setParams({missingProperty:w}),a.forOf(w,c,()=>{a.assign(v,(0,t.propertyInData)(a,l,w,f.ownProperties)),a.if((0,n.not)(v),()=>{i.error(),a.break()})},n.nil)}}};e.default=r})),Qk=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ve(),n={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:o,schemaCode:r}){let i=o==="maxItems"?"more":"fewer";return(0,t.str)`must NOT have ${i} than ${r} items`},params:({schemaCode:o})=>(0,t._)`{limit: ${o}}`},code(o){let{keyword:r,data:i,schemaCode:a}=o,s=r==="maxItems"?t.operators.GT:t.operators.LT;o.fail$data((0,t._)`${i}.length ${s} ${a}`)}};e.default=n})),vv=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=DS();t.code='require("ajv/dist/runtime/equal").default',e.default=t})),eI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=xu(),n=ve(),o=ze(),r=vv(),i={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:a,j:s}})=>(0,n.str)`must NOT have duplicate items (items ## ${s} and ${a} are identical)`,params:({params:{i:a,j:s}})=>(0,n._)`{i: ${a}, j: ${s}}`},code(a){let{gen:s,data:c,$data:l,schema:u,parentSchema:p,schemaCode:f,it:b}=a;if(!l&&!u)return;let g=s.let("valid"),S=p.items?(0,t.getSchemaTypes)(p.items):[];a.block$data(g,_,(0,n._)`${f} === false`),a.ok(g);function _(){let $=s.let("i",(0,n._)`${c}.length`),I=s.let("j");a.setParams({i:$,j:I}),s.assign(g,!0),s.if((0,n._)`${$} > 1`,()=>(h()?w:v)($,I))}function h(){return S.length>0&&!S.some($=>$==="object"||$==="array")}function w($,I){let z=s.name("item"),y=(0,t.checkDataTypes)(S,z,b.opts.strictNumbers,t.DataType.Wrong),R=s.const("indices",(0,n._)`{}`);s.for((0,n._)`;${$}--;`,()=>{s.let(z,(0,n._)`${c}[${$}]`),s.if(y,(0,n._)`continue`),S.length>1&&s.if((0,n._)`typeof ${z} == "string"`,(0,n._)`${z} += "_"`),s.if((0,n._)`typeof ${R}[${z}] == "number"`,()=>{s.assign(I,(0,n._)`${R}[${z}]`),a.error(),s.assign(g,!1).break()}).code((0,n._)`${R}[${z}] = ${$}`)})}function v($,I){let z=(0,o.useFunc)(s,r.default),y=s.name("outer");s.label(y).for((0,n._)`;${$}--;`,()=>s.for((0,n._)`${I} = ${$}; ${I}--;`,()=>s.if((0,n._)`${z}(${c}[${$}], ${c}[${I}])`,()=>{a.error(),s.assign(g,!1).break(y)})))}}};e.default=i})),tI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ve(),n=ze(),o=vv(),r={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:i})=>(0,t._)`{allowedValue: ${i}}`},code(i){let{gen:a,data:s,$data:c,schemaCode:l,schema:u}=i;c||u&&typeof u=="object"?i.fail$data((0,t._)`!${(0,n.useFunc)(a,o.default)}(${s}, ${l})`):i.fail((0,t._)`${u} !== ${s}`)}};e.default=r})),rI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ve(),n=ze(),o=vv(),r={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:i})=>(0,t._)`{allowedValues: ${i}}`},code(i){let{gen:a,data:s,$data:c,schema:l,schemaCode:u,it:p}=i;if(!c&&l.length===0)throw new Error("enum must have non-empty array");let f=l.length>=p.opts.loopEnum,b,g=()=>b??(b=(0,n.useFunc)(a,o.default)),S;if(f||c)S=a.let("valid"),i.block$data(S,_);else{if(!Array.isArray(l))throw new Error("ajv implementation error");let w=a.const("vSchema",u);S=(0,t.or)(...l.map((v,$)=>h(w,$)))}i.pass(S);function _(){a.assign(S,!1),a.forOf("v",u,w=>a.if((0,t._)`${g()}(${s}, ${w})`,()=>a.assign(S,!0).break()))}function h(w,v){let $=l[v];return typeof $=="object"&&$!==null?(0,t._)`${g()}(${s}, ${w}[${v}])`:(0,t._)`${s} === ${$}`}}};e.default=r})),VS=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Jk(),n=Hk(),o=Kk(),r=Wk(),i=Yk(),a=Xk(),s=Qk(),c=eI(),l=tI(),u=rI(),p=[t.default,n.default,o.default,r.default,i.default,a.default,s.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},l.default,u.default];e.default=p})),ZS=K((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;let t=ve(),n=ze(),o={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:i}})=>(0,t.str)`must NOT have more than ${i} items`,params:({params:{len:i}})=>(0,t._)`{limit: ${i}}`},code(i){let{parentSchema:a,it:s}=i,{items:c}=a;if(!Array.isArray(c)){(0,n.checkStrictMode)(s,'"additionalItems" is ignored when "items" is not an array of schemas');return}r(i,c)}};function r(i,a){let{gen:s,schema:c,data:l,keyword:u,it:p}=i;p.items=!0;let f=s.const("len",(0,t._)`${l}.length`);if(c===!1)i.setParams({len:a.length}),i.pass((0,t._)`${f} <= ${a.length}`);else if(typeof c=="object"&&!(0,n.alwaysValidSchema)(p,c)){let g=s.var("valid",(0,t._)`${f} <= ${a.length}`);s.if((0,t.not)(g),()=>b(g)),i.ok(g)}function b(g){s.forRange("i",a.length,f,S=>{i.subschema({keyword:u,dataProp:S,dataPropType:n.Type.Num},g),p.allErrors||s.if((0,t.not)(g),()=>s.break())})}}e.validateAdditionalItems=r,e.default=o})),GS=K((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;let t=ve(),n=ze(),o=Tt(),r={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(a){let{schema:s,it:c}=a;if(Array.isArray(s))return i(a,"additionalItems",s);c.items=!0,!(0,n.alwaysValidSchema)(c,s)&&a.ok((0,o.validateArray)(a))}};function i(a,s,c=a.schema){let{gen:l,parentSchema:u,data:p,keyword:f,it:b}=a;_(u),b.opts.unevaluated&&c.length&&b.items!==!0&&(b.items=n.mergeEvaluated.items(l,c.length,b.items));let g=l.name("valid"),S=l.const("len",(0,t._)`${p}.length`);c.forEach((h,w)=>{(0,n.alwaysValidSchema)(b,h)||(l.if((0,t._)`${S} > ${w}`,()=>a.subschema({keyword:f,schemaProp:w,dataProp:w},g)),a.ok(g))});function _(h){let{opts:w,errSchemaPath:v}=b,$=c.length,I=$===h.minItems&&($===h.maxItems||h[s]===!1);if(w.strictTuples&&!I){let z=`"${f}" is ${$}-tuple, but minItems or maxItems/${s} are not specified or different at path "${v}"`;(0,n.checkStrictMode)(b,z,w.strictTuples)}}}e.validateTuple=i,e.default=r})),nI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=GS(),n={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:o=>(0,t.validateTuple)(o,"items")};e.default=n})),oI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ve(),n=ze(),o=Tt(),r=ZS(),i={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:a}})=>(0,t.str)`must NOT have more than ${a} items`,params:({params:{len:a}})=>(0,t._)`{limit: ${a}}`},code(a){let{schema:s,parentSchema:c,it:l}=a,{prefixItems:u}=c;l.items=!0,!(0,n.alwaysValidSchema)(l,s)&&(u?(0,r.validateAdditionalItems)(a,u):a.ok((0,o.validateArray)(a)))}};e.default=i})),iI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ve(),n=ze(),o={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:r,max:i}})=>i===void 0?(0,t.str)`must contain at least ${r} valid item(s)`:(0,t.str)`must contain at least ${r} and no more than ${i} valid item(s)`,params:({params:{min:r,max:i}})=>i===void 0?(0,t._)`{minContains: ${r}}`:(0,t._)`{minContains: ${r}, maxContains: ${i}}`},code(r){let{gen:i,schema:a,parentSchema:s,data:c,it:l}=r,u,p,{minContains:f,maxContains:b}=s;l.opts.next?(u=f===void 0?1:f,p=b):u=1;let g=i.const("len",(0,t._)`${c}.length`);if(r.setParams({min:u,max:p}),p===void 0&&u===0){(0,n.checkStrictMode)(l,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(p!==void 0&&u>p){(0,n.checkStrictMode)(l,'"minContains" > "maxContains" is always invalid'),r.fail();return}if((0,n.alwaysValidSchema)(l,a)){let v=(0,t._)`${g} >= ${u}`;p!==void 0&&(v=(0,t._)`${v} && ${g} <= ${p}`),r.pass(v);return}l.items=!0;let S=i.name("valid");p===void 0&&u===1?h(S,()=>i.if(S,()=>i.break())):u===0?(i.let(S,!0),p!==void 0&&i.if((0,t._)`${c}.length > 0`,_)):(i.let(S,!1),_()),r.result(S,()=>r.reset());function _(){let v=i.name("_valid"),$=i.let("count",0);h(v,()=>i.if(v,()=>w($)))}function h(v,$){i.forRange("i",0,g,I=>{r.subschema({keyword:"contains",dataProp:I,dataPropType:n.Type.Num,compositeRule:!0},v),$()})}function w(v){i.code((0,t._)`${v}++`),p===void 0?i.if((0,t._)`${v} >= ${u}`,()=>i.assign(S,!0).break()):(i.if((0,t._)`${v} > ${p}`,()=>i.assign(S,!1).break()),u===1?i.assign(S,!0):i.if((0,t._)`${v} >= ${u}`,()=>i.assign(S,!0)))}}};e.default=o})),_v=K((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;let t=ve(),n=ze(),o=Tt();e.error={message:({params:{property:c,depsCount:l,deps:u}})=>{let p=l===1?"property":"properties";return(0,t.str)`must have ${p} ${u} when property ${c} is present`},params:({params:{property:c,depsCount:l,deps:u,missingProperty:p}})=>(0,t._)`{property: ${c},
73
73
  missingProperty: ${p},
74
74
  depsCount: ${l},
75
- deps: ${u}}`};let r={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(c){let[l,u]=i(c);a(c,l),s(c,u)}};function i({schema:c}){let l={},u={};for(let p in c){if(p==="__proto__")continue;let f=Array.isArray(c[p])?l:u;f[p]=c[p]}return[l,u]}function a(c,l=c.schema){let{gen:u,data:p,it:f}=c;if(Object.keys(l).length===0)return;let b=u.let("missing");for(let g in l){let S=l[g];if(S.length===0)continue;let _=(0,o.propertyInData)(u,p,g,f.opts.ownProperties);c.setParams({property:g,depsCount:S.length,deps:S.join(", ")}),f.allErrors?u.if(_,()=>{for(let h of S)(0,o.checkReportMissingProp)(c,h)}):(u.if((0,t._)`${_} && (${(0,o.checkMissingProp)(c,S,b)})`),(0,o.reportMissingProp)(c,b),u.else())}}e.validatePropertyDeps=a;function s(c,l=c.schema){let{gen:u,data:p,keyword:f,it:b}=c,g=u.name("valid");for(let S in l)(0,n.alwaysValidSchema)(b,l[S])||(u.if((0,o.propertyInData)(u,p,S,b.opts.ownProperties),()=>{let _=c.subschema({keyword:f,schemaProp:S},g);c.mergeValidEvaluated(_,g)},()=>u.var(g,!0)),c.ok(g))}e.validateSchemaDeps=s,e.default=r})),aI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ve(),n=ze(),o={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:r})=>(0,t._)`{propertyName: ${r.propertyName}}`},code(r){let{gen:i,schema:a,data:s,it:c}=r;if((0,n.alwaysValidSchema)(c,a))return;let l=i.name("valid");i.forIn("key",s,u=>{r.setParams({propertyName:u}),r.subschema({keyword:"propertyNames",data:u,dataTypes:["string"],propertyName:u,compositeRule:!0},l),i.if((0,t.not)(l),()=>{r.error(!0),c.allErrors||i.break()})}),r.ok(l)}};e.default=o})),JS=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Tt(),n=ve(),o=Pt(),r=ze(),i={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:a})=>(0,n._)`{additionalProperty: ${a.additionalProperty}}`},code(a){let{gen:s,schema:c,parentSchema:l,data:u,errsCount:p,it:f}=a;if(!p)throw new Error("ajv implementation error");let{allErrors:b,opts:g}=f;if(f.props=!0,g.removeAdditional!=="all"&&(0,r.alwaysValidSchema)(f,c))return;let S=(0,t.allSchemaProperties)(l.properties),_=(0,t.allSchemaProperties)(l.patternProperties);h(),a.ok((0,n._)`${p} === ${o.default.errors}`);function h(){s.forIn("key",u,z=>{!S.length&&!_.length?$(z):s.if(w(z),()=>$(z))})}function w(z){let y;if(S.length>8){let R=(0,r.schemaRefOrVal)(f,l.properties,"properties");y=(0,t.isOwnProperty)(s,R,z)}else S.length?y=(0,n.or)(...S.map(R=>(0,n._)`${z} === ${R}`)):y=n.nil;return _.length&&(y=(0,n.or)(y,..._.map(R=>(0,n._)`${(0,t.usePattern)(a,R)}.test(${z})`))),(0,n.not)(y)}function v(z){s.code((0,n._)`delete ${u}[${z}]`)}function $(z){if(g.removeAdditional==="all"||g.removeAdditional&&c===!1){v(z);return}if(c===!1){a.setParams({additionalProperty:z}),a.error(),b||s.break();return}if(typeof c=="object"&&!(0,r.alwaysValidSchema)(f,c)){let y=s.name("valid");g.removeAdditional==="failing"?(I(z,y,!1),s.if((0,n.not)(y),()=>{a.reset(),v(z)})):(I(z,y),b||s.if((0,n.not)(y),()=>s.break()))}}function I(z,y,R){let O={keyword:"additionalProperties",dataProp:z,dataPropType:r.Type.Str};R===!1&&Object.assign(O,{compositeRule:!0,createErrors:!1,allErrors:!1}),a.subschema(O,y)}}};e.default=i})),sI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ca(),n=Tt(),o=ze(),r=JS(),i={keyword:"properties",type:"object",schemaType:"object",code(a){let{gen:s,schema:c,parentSchema:l,data:u,it:p}=a;p.opts.removeAdditional==="all"&&l.additionalProperties===void 0&&r.default.code(new t.KeywordCxt(p,r.default,"additionalProperties"));let f=(0,n.allSchemaProperties)(c);for(let h of f)p.definedProperties.add(h);p.opts.unevaluated&&f.length&&p.props!==!0&&(p.props=o.mergeEvaluated.props(s,(0,o.toHash)(f),p.props));let b=f.filter(h=>!(0,o.alwaysValidSchema)(p,c[h]));if(b.length===0)return;let g=s.name("valid");for(let h of b)S(h)?_(h):(s.if((0,n.propertyInData)(s,u,h,p.opts.ownProperties)),_(h),p.allErrors||s.else().var(g,!0),s.endIf()),a.it.definedProperties.add(h),a.ok(g);function S(h){return p.opts.useDefaults&&!p.compositeRule&&c[h].default!==void 0}function _(h){a.subschema({keyword:"properties",schemaProp:h,dataProp:h},g)}}};e.default=i})),cI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Tt(),n=ve(),o=ze(),r=ze(),i={keyword:"patternProperties",type:"object",schemaType:"object",code(a){let{gen:s,schema:c,data:l,parentSchema:u,it:p}=a,{opts:f}=p,b=(0,t.allSchemaProperties)(c),g=b.filter(I=>(0,o.alwaysValidSchema)(p,c[I]));if(b.length===0||g.length===b.length&&(!p.opts.unevaluated||p.props===!0))return;let S=f.strictSchema&&!f.allowMatchingProperties&&u.properties,_=s.name("valid");p.props!==!0&&!(p.props instanceof n.Name)&&(p.props=(0,r.evaluatedPropsToName)(s,p.props));let{props:h}=p;w();function w(){for(let I of b)S&&v(I),p.allErrors?$(I):(s.var(_,!0),$(I),s.if(_))}function v(I){for(let z in S)new RegExp(I).test(z)&&(0,o.checkStrictMode)(p,`property ${z} matches pattern ${I} (use allowMatchingProperties)`)}function $(I){s.forIn("key",l,z=>{s.if((0,n._)`${(0,t.usePattern)(a,I)}.test(${z})`,()=>{let y=g.includes(I);y||a.subschema({keyword:"patternProperties",schemaProp:I,dataProp:z,dataPropType:r.Type.Str},_),p.opts.unevaluated&&h!==!0?s.assign((0,n._)`${h}[${z}]`,!0):!y&&!p.allErrors&&s.if((0,n.not)(_),()=>s.break())})})}}};e.default=i})),lI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ze(),n={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(o){let{gen:r,schema:i,it:a}=o;if((0,t.alwaysValidSchema)(a,i)){o.fail();return}let s=r.name("valid");o.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),o.failResult(s,()=>o.reset(),()=>o.error())},error:{message:"must NOT be valid"}};e.default=n})),uI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Tt().validateUnion,error:{message:"must match a schema in anyOf"}};e.default=t})),dI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ve(),n=ze(),o={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:r})=>(0,t._)`{passingSchemas: ${r.passing}}`},code(r){let{gen:i,schema:a,parentSchema:s,it:c}=r;if(!Array.isArray(a))throw new Error("ajv implementation error");if(c.opts.discriminator&&s.discriminator)return;let l=a,u=i.let("valid",!1),p=i.let("passing",null),f=i.name("_valid");r.setParams({passing:p}),i.block(b),r.result(u,()=>r.reset(),()=>r.error(!0));function b(){l.forEach((g,S)=>{let _;(0,n.alwaysValidSchema)(c,g)?i.var(f,!0):_=r.subschema({keyword:"oneOf",schemaProp:S,compositeRule:!0},f),S>0&&i.if((0,t._)`${f} && ${u}`).assign(u,!1).assign(p,(0,t._)`[${p}, ${S}]`).else(),i.if(f,()=>{i.assign(u,!0),i.assign(p,S),_&&r.mergeEvaluated(_,t.Name)})})}}};e.default=o})),mI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ze(),n={keyword:"allOf",schemaType:"array",code(o){let{gen:r,schema:i,it:a}=o;if(!Array.isArray(i))throw new Error("ajv implementation error");let s=r.name("valid");i.forEach((c,l)=>{if((0,t.alwaysValidSchema)(a,c))return;let u=o.subschema({keyword:"allOf",schemaProp:l},s);o.ok(s),o.mergeEvaluated(u)})}};e.default=n})),pI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ve(),n=ze(),o={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:i})=>(0,t.str)`must match "${i.ifClause}" schema`,params:({params:i})=>(0,t._)`{failingKeyword: ${i.ifClause}}`},code(i){let{gen:a,parentSchema:s,it:c}=i;s.then===void 0&&s.else===void 0&&(0,n.checkStrictMode)(c,'"if" without "then" and "else" is ignored');let l=r(c,"then"),u=r(c,"else");if(!l&&!u)return;let p=a.let("valid",!0),f=a.name("_valid");if(b(),i.reset(),l&&u){let S=a.let("ifClause");i.setParams({ifClause:S}),a.if(f,g("then",S),g("else",S))}else l?a.if(f,g("then")):a.if((0,t.not)(f),g("else"));i.pass(p,()=>i.error(!0));function b(){let S=i.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},f);i.mergeEvaluated(S)}function g(S,_){return()=>{let h=i.subschema({keyword:S},f);a.assign(p,f),i.mergeValidEvaluated(h,p),_?a.assign(_,(0,t._)`${S}`):i.setParams({ifClause:S})}}}};function r(i,a){let s=i.schema[a];return s!==void 0&&!(0,n.alwaysValidSchema)(i,s)}e.default=o})),fI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ze(),n={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:o,parentSchema:r,it:i}){r.if===void 0&&(0,t.checkStrictMode)(i,`"${o}" without "if" is ignored`)}};e.default=n})),HS=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ZS(),n=nI(),o=GS(),r=oI(),i=iI(),a=_v(),s=aI(),c=JS(),l=sI(),u=cI(),p=lI(),f=uI(),b=dI(),g=mI(),S=pI(),_=fI();function h(w=!1){let v=[p.default,f.default,b.default,g.default,S.default,_.default,s.default,c.default,a.default,l.default,u.default];return w?v.push(n.default,r.default):v.push(t.default,o.default),v.push(i.default),v}e.default=h})),hI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ve(),n={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:o})=>(0,t.str)`must match format "${o}"`,params:({schemaCode:o})=>(0,t._)`{format: ${o}}`},code(o,r){let{gen:i,data:a,$data:s,schema:c,schemaCode:l,it:u}=o,{opts:p,errSchemaPath:f,schemaEnv:b,self:g}=u;if(!p.validateFormats)return;s?S():_();function S(){let h=i.scopeValue("formats",{ref:g.formats,code:p.code.formats}),w=i.const("fDef",(0,t._)`${h}[${l}]`),v=i.let("fType"),$=i.let("format");i.if((0,t._)`typeof ${w} == "object" && !(${w} instanceof RegExp)`,()=>i.assign(v,(0,t._)`${w}.type || "string"`).assign($,(0,t._)`${w}.validate`),()=>i.assign(v,(0,t._)`"string"`).assign($,w)),o.fail$data((0,t.or)(I(),z()));function I(){return p.strictSchema===!1?t.nil:(0,t._)`${l} && !${$}`}function z(){let y=b.$async?(0,t._)`(${w}.async ? await ${$}(${a}) : ${$}(${a}))`:(0,t._)`${$}(${a})`,R=(0,t._)`(typeof ${$} == "function" ? ${y} : ${$}.test(${a}))`;return(0,t._)`${$} && ${$} !== true && ${v} === ${r} && !${R}`}}function _(){let h=g.formats[c];if(!h){I();return}if(h===!0)return;let[w,v,$]=z(h);w===r&&o.pass(y());function I(){if(p.strictSchema===!1){g.logger.warn(R());return}throw new Error(R());function R(){return`unknown format "${c}" ignored in schema at path "${f}"`}}function z(R){let O=R instanceof RegExp?(0,t.regexpCode)(R):p.code.formats?(0,t._)`${p.code.formats}${(0,t.getProperty)(c)}`:void 0,L=i.scopeValue("formats",{key:c,ref:R,code:O});return typeof R=="object"&&!(R instanceof RegExp)?[R.type||"string",R.validate,(0,t._)`${L}.validate`]:["string",R,L]}function y(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!b.$async)throw new Error("async format in sync schema");return(0,t._)`await ${$}(${a})`}return typeof v=="function"?(0,t._)`${$}(${a})`:(0,t._)`${$}.test(${a})`}}}};e.default=n})),BS=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=[hI().default];e.default=t})),KS=K((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]})),gI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=FS(),n=VS(),o=HS(),r=BS(),i=KS(),a=[t.default,n.default,(0,o.default)(),r.default,i.metadataVocabulary,i.contentVocabulary];e.default=a})),vI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(n){n.Tag="tag",n.Mapping="mapping"})(t||(e.DiscrError=t={}))})),WS=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ve(),n=vI(),o=Cu(),r=la(),i=ze(),a={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:s,tagName:c}})=>s===n.DiscrError.Tag?`tag "${c}" must be string`:`value of tag "${c}" must be in oneOf`,params:({params:{discrError:s,tag:c,tagName:l}})=>(0,t._)`{error: ${s}, tag: ${l}, tagValue: ${c}}`},code(s){let{gen:c,data:l,schema:u,parentSchema:p,it:f}=s,{oneOf:b}=p;if(!f.opts.discriminator)throw new Error("discriminator: requires discriminator option");let g=u.propertyName;if(typeof g!="string")throw new Error("discriminator: requires propertyName");if(u.mapping)throw new Error("discriminator: mapping is not supported");if(!b)throw new Error("discriminator: requires oneOf keyword");let S=c.let("valid",!1),_=c.const("tag",(0,t._)`${l}${(0,t.getProperty)(g)}`);c.if((0,t._)`typeof ${_} == "string"`,()=>h(),()=>s.error(!1,{discrError:n.DiscrError.Tag,tag:_,tagName:g})),s.ok(S);function h(){let $=v();c.if(!1);for(let I in $)c.elseIf((0,t._)`${_} === ${I}`),c.assign(S,w($[I]));c.else(),s.error(!1,{discrError:n.DiscrError.Mapping,tag:_,tagName:g}),c.endIf()}function w($){let I=c.name("valid"),z=s.subschema({keyword:"oneOf",schemaProp:$},I);return s.mergeEvaluated(z,t.Name),I}function v(){var $;let I={},z=R(p),y=!0;for(let A=0;A<b.length;A++){let F=b[A];if(F?.$ref&&!(0,i.schemaHasRulesButRef)(F,f.self.RULES)){let ne=F.$ref;if(F=o.resolveRef.call(f.self,f.schemaEnv.root,f.baseId,ne),F instanceof o.SchemaEnv&&(F=F.schema),F===void 0)throw new r.default(f.opts.uriResolver,f.baseId,ne)}let ee=($=F?.properties)===null||$===void 0?void 0:$[g];if(typeof ee!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${g}"`);y=y&&(z||R(F)),O(ee,A)}if(!y)throw new Error(`discriminator: "${g}" must be required`);return I;function R({required:A}){return Array.isArray(A)&&A.includes(g)}function O(A,F){if(A.const)L(A.const,F);else if(A.enum)for(let ee of A.enum)L(ee,F);else throw new Error(`discriminator: "properties/${g}" must have "const" or "enum"`)}function L(A,F){if(typeof A!="string"||A in I)throw new Error(`discriminator: "${g}" values must be unique strings`);I[A]=F}}}};e.default=a})),_I=K(((e,t)=>{t.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}})),YS=K(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;let n=LS(),o=gI(),r=WS(),i=_I(),a=["/properties"],s="http://json-schema.org/draft-07/schema";var c=class extends n.default{_addVocabularies(){super._addVocabularies(),o.default.forEach(b=>this.addVocabulary(b)),this.opts.discriminator&&this.addKeyword(r.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let b=this.opts.$data?this.$dataMetaSchema(i,a):i;this.addMetaSchema(b,s,!1),this.refs["http://json-schema.org/schema"]=s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};e.Ajv=c,t.exports=e=c,t.exports.Ajv=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var l=ca();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var u=ve();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var p=Nu();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return p.default}});var f=la();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return f.default}})})),XS=K((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicAnchor=void 0;let t=ve(),n=Pt(),o=Cu(),r=gv(),i={keyword:"$dynamicAnchor",schemaType:"string",code:c=>a(c,c.schema)};function a(c,l){let{gen:u,it:p}=c;p.schemaEnv.root.dynamicAnchors[l]=!0;let f=(0,t._)`${n.default.dynamicAnchors}${(0,t.getProperty)(l)}`,b=p.errSchemaPath==="#"?p.validateName:s(c);u.if((0,t._)`!${f}`,()=>u.assign(f,b))}e.dynamicAnchor=a;function s(c){let{schemaEnv:l,schema:u,self:p}=c.it,{root:f,baseId:b,localRefs:g,meta:S}=l.root,{schemaId:_}=p.opts,h=new o.SchemaEnv({schema:u,schemaId:_,root:f,baseId:b,localRefs:g,meta:S});return o.compileSchema.call(p,h),(0,r.getValidate)(c,h)}e.default=i})),QS=K((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicRef=void 0;let t=ve(),n=Pt(),o=gv(),r={keyword:"$dynamicRef",schemaType:"string",code:a=>i(a,a.schema)};function i(a,s){let{gen:c,keyword:l,it:u}=a;if(s[0]!=="#")throw new Error(`"${l}" only supports hash fragment reference`);let p=s.slice(1);if(u.allErrors)f();else{let g=c.let("valid",!1);f(g),a.ok(g)}function f(g){if(u.schemaEnv.root.dynamicAnchors[p]){let S=c.let("_v",(0,t._)`${n.default.dynamicAnchors}${(0,t.getProperty)(p)}`);c.if(S,b(S,g),b(u.validateName,g))}else b(u.validateName,g)()}function b(g,S){return S?()=>c.block(()=>{(0,o.callRef)(a,g),c.let(S,!0)}):()=>(0,o.callRef)(a,g)}}e.dynamicRef=i,e.default=r})),yI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=XS(),n=ze(),o={keyword:"$recursiveAnchor",schemaType:"boolean",code(r){r.schema?(0,t.dynamicAnchor)(r,""):(0,n.checkStrictMode)(r.it,"$recursiveAnchor: false is ignored")}};e.default=o})),bI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=QS(),n={keyword:"$recursiveRef",schemaType:"string",code:o=>(0,t.dynamicRef)(o,o.schema)};e.default=n})),SI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=XS(),n=QS(),o=yI(),r=bI(),i=[t.default,n.default,o.default,r.default];e.default=i})),$I=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=_v(),n={keyword:"dependentRequired",type:"object",schemaType:"object",error:t.error,code:o=>(0,t.validatePropertyDeps)(o)};e.default=n})),wI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=_v(),n={keyword:"dependentSchemas",type:"object",schemaType:"object",code:o=>(0,t.validateSchemaDeps)(o)};e.default=n})),zI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ze(),n={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:o,parentSchema:r,it:i}){r.contains===void 0&&(0,t.checkStrictMode)(i,`"${o}" without "contains" is ignored`)}};e.default=n})),RI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=$I(),n=wI(),o=zI(),r=[t.default,n.default,o.default];e.default=r})),kI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ve(),n=ze(),o=Pt(),r={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:i})=>(0,t._)`{unevaluatedProperty: ${i.unevaluatedProperty}}`},code(i){let{gen:a,schema:s,data:c,errsCount:l,it:u}=i;if(!l)throw new Error("ajv implementation error");let{allErrors:p,props:f}=u;f instanceof t.Name?a.if((0,t._)`${f} !== true`,()=>a.forIn("key",c,_=>a.if(g(f,_),()=>b(_)))):f!==!0&&a.forIn("key",c,_=>f===void 0?b(_):a.if(S(f,_),()=>b(_))),u.props=!0,i.ok((0,t._)`${l} === ${o.default.errors}`);function b(_){if(s===!1){i.setParams({unevaluatedProperty:_}),i.error(),p||a.break();return}if(!(0,n.alwaysValidSchema)(u,s)){let h=a.name("valid");i.subschema({keyword:"unevaluatedProperties",dataProp:_,dataPropType:n.Type.Str},h),p||a.if((0,t.not)(h),()=>a.break())}}function g(_,h){return(0,t._)`!${_} || !${_}[${h}]`}function S(_,h){let w=[];for(let v in _)_[v]===!0&&w.push((0,t._)`${h} !== ${v}`);return(0,t.and)(...w)}}};e.default=r})),II=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ve(),n=ze(),o={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:r}})=>(0,t.str)`must NOT have more than ${r} items`,params:({params:{len:r}})=>(0,t._)`{limit: ${r}}`},code(r){let{gen:i,schema:a,data:s,it:c}=r,l=c.items||0;if(l===!0)return;let u=i.const("len",(0,t._)`${s}.length`);if(a===!1)r.setParams({len:l}),r.fail((0,t._)`${u} > ${l}`);else if(typeof a=="object"&&!(0,n.alwaysValidSchema)(c,a)){let f=i.var("valid",(0,t._)`${u} <= ${l}`);i.if((0,t.not)(f),()=>p(f,l)),r.ok(f)}c.items=!0;function p(f,b){i.forRange("i",b,u,g=>{r.subschema({keyword:"unevaluatedItems",dataProp:g,dataPropType:n.Type.Num},f),c.allErrors||i.if((0,t.not)(f),()=>i.break())})}}};e.default=o})),PI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=kI(),n=II(),o=[t.default,n.default];e.default=o})),TI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=FS(),n=VS(),o=HS(),r=SI(),i=RI(),a=PI(),s=BS(),c=KS(),l=[r.default,t.default,n.default,(0,o.default)(!0),s.default,c.metadataVocabulary,c.contentVocabulary,i.default,a.default];e.default=l})),EI=K(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}})),xI=K(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}})),OI=K(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}})),jI=K(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}})),NI=K(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}})),CI=K(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}})),AI=K(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}})),MI=K(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}})),qI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=EI(),n=xI(),o=OI(),r=jI(),i=NI(),a=CI(),s=AI(),c=MI(),l=["/properties"];function u(p){return[t,n,o,r,i,f(this,a),s,f(this,c)].forEach(b=>this.addMetaSchema(b,void 0,!1)),this;function f(b,g){return p?b.$dataMetaSchema(g,l):g}}e.default=u})),DI=K(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2020=void 0;let n=LS(),o=TI(),r=WS(),i=qI(),a="https://json-schema.org/draft/2020-12/schema";var s=class extends n.default{constructor(f={}){super({...f,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),o.default.forEach(f=>this.addVocabulary(f)),this.opts.discriminator&&this.addKeyword(r.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:f,meta:b}=this.opts;b&&(i.default.call(this,f),this.refs["http://json-schema.org/schema"]=a)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(a)?a:void 0)}};e.Ajv2020=s,t.exports=e=s,t.exports.Ajv2020=s,Object.defineProperty(e,"__esModule",{value:!0}),e.default=s;var c=ca();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var l=ve();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return l.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return l.CodeGen}});var u=Nu();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return u.default}});var p=la();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return p.default}})})),UI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(A,F){return{validate:A,compare:F}}e.fullFormats={date:t(i,a),time:t(c(!0),l),"date-time":t(f(!0),b),"iso-time":t(c(),u),"iso-date-time":t(f(),g),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:h,"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:L,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:v,int32:{type:"number",validate:z},int64:{type:"number",validate:y},float:{type:"number",validate:R},double:{type:"number",validate:R},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,a),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"date-time":t(/^\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,b),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":t(/^\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,g),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},e.formatNames=Object.keys(e.fullFormats);function n(A){return A%4===0&&(A%100!==0||A%400===0)}let o=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,r=[0,31,28,31,30,31,30,31,31,30,31,30,31];function i(A){let F=o.exec(A);if(!F)return!1;let ee=+F[1],ne=+F[2],be=+F[3];return ne>=1&&ne<=12&&be>=1&&be<=(ne===2&&n(ee)?29:r[ne])}function a(A,F){if(A&&F)return A>F?1:A<F?-1:0}let s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(A){return function(ee){let ne=s.exec(ee);if(!ne)return!1;let be=+ne[1],je=+ne[2],xe=+ne[3],Le=ne[4],we=ne[5]==="-"?-1:1,x=+(ne[6]||0),D=+(ne[7]||0);if(x>23||D>59||A&&!Le)return!1;if(be<=23&&je<=59&&xe<60)return!0;let G=je-D*we,k=be-x*we-(G<0?1:0);return(k===23||k===-1)&&(G===59||G===-1)&&xe<61}}function l(A,F){if(!(A&&F))return;let ee=new Date("2020-01-01T"+A).valueOf(),ne=new Date("2020-01-01T"+F).valueOf();if(ee&&ne)return ee-ne}function u(A,F){if(!(A&&F))return;let ee=s.exec(A),ne=s.exec(F);if(ee&&ne)return A=ee[1]+ee[2]+ee[3],F=ne[1]+ne[2]+ne[3],A>F?1:A<F?-1:0}let p=/t|\s/i;function f(A){let F=c(A);return function(ne){let be=ne.split(p);return be.length===2&&i(be[0])&&F(be[1])}}function b(A,F){if(!(A&&F))return;let ee=new Date(A).valueOf(),ne=new Date(F).valueOf();if(ee&&ne)return ee-ne}function g(A,F){if(!(A&&F))return;let[ee,ne]=A.split(p),[be,je]=F.split(p),xe=a(ee,be);if(xe!==void 0)return xe||l(ne,je)}let S=/\/|:/,_=/^(?:[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;function h(A){return S.test(A)&&_.test(A)}let w=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function v(A){return w.lastIndex=0,w.test(A)}let $=-(2**31),I=2**31-1;function z(A){return Number.isInteger(A)&&A<=I&&A>=$}function y(A){return Number.isInteger(A)}function R(){return!0}let O=/[^\\]\\Z/;function L(A){if(O.test(A))return!1;try{return new RegExp(A),!0}catch{return!1}}})),LI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;let t=YS(),n=ve(),o=n.operators,r={formatMaximum:{okStr:"<=",ok:o.LTE,fail:o.GT},formatMinimum:{okStr:">=",ok:o.GTE,fail:o.LT},formatExclusiveMaximum:{okStr:"<",ok:o.LT,fail:o.GTE},formatExclusiveMinimum:{okStr:">",ok:o.GT,fail:o.LTE}},i={message:({keyword:s,schemaCode:c})=>(0,n.str)`should be ${r[s].okStr} ${c}`,params:({keyword:s,schemaCode:c})=>(0,n._)`{comparison: ${r[s].okStr}, limit: ${c}}`};e.formatLimitDefinition={keyword:Object.keys(r),type:"string",schemaType:"string",$data:!0,error:i,code(s){let{gen:c,data:l,schemaCode:u,keyword:p,it:f}=s,{opts:b,self:g}=f;if(!b.validateFormats)return;let S=new t.KeywordCxt(f,g.RULES.all.format.definition,"format");S.$data?_():h();function _(){let v=c.scopeValue("formats",{ref:g.formats,code:b.code.formats}),$=c.const("fmt",(0,n._)`${v}[${S.schemaCode}]`);s.fail$data((0,n.or)((0,n._)`typeof ${$} != "object"`,(0,n._)`${$} instanceof RegExp`,(0,n._)`typeof ${$}.compare != "function"`,w($)))}function h(){let v=S.schema,$=g.formats[v];if(!$||$===!0)return;if(typeof $!="object"||$ instanceof RegExp||typeof $.compare!="function")throw new Error(`"${p}": format "${v}" does not define "compare" function`);let I=c.scopeValue("formats",{key:v,ref:$,code:b.code.formats?(0,n._)`${b.code.formats}${(0,n.getProperty)(v)}`:void 0});s.fail$data(w(I))}function w(v){return(0,n._)`${v}.compare(${l}, ${u}) ${r[p].fail} 0`}},dependencies:["format"]};let a=s=>(s.addKeyword(e.formatLimitDefinition),s);e.default=a})),FI=K(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});let n=UI(),o=LI(),r=ve(),i=new r.Name("fullFormats"),a=new r.Name("fastFormats"),s=(l,u={keywords:!0})=>{if(Array.isArray(u))return c(l,u,n.fullFormats,i),l;let[p,f]=u.mode==="fast"?[n.fastFormats,a]:[n.fullFormats,i];return c(l,u.formats||n.formatNames,p,f),u.keywords&&(0,o.default)(l),l};s.get=(l,u="full")=>{let p=(u==="fast"?n.fastFormats:n.fullFormats)[l];if(!p)throw new Error(`Unknown format "${l}"`);return p};function c(l,u,p,f){var b,g;(b=(g=l.opts.code).formats)!==null&&b!==void 0||(g.formats=(0,r._)`require("ajv-formats/dist/formats").${f}`);for(let S of u)l.addFormat(S,p[S])}t.exports=e=s,Object.defineProperty(e,"__esModule",{value:!0}),e.default=s})),VI=YS(),ZI=DI(),GI=La(FI(),1),JI=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),HI=GI.default;function BI(){let e=new ZI.Ajv2020({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return HI(e),e}var Au=class{_ajv;_userAjv;constructor(e){this._userAjv=e!==void 0,this._ajv=e}get ajv(){return this._ajv??=BI()}getValidator(e){if(!this._userAjv&&"$schema"in e&&typeof e.$schema=="string"&&!JI.has(e.$schema.replace(/#$/,""))){let o=e.$schema.slice(0,200);throw new Error(`JSON Schema declares an unsupported dialect ("$schema": "${o}"). The default validator supports JSON Schema 2020-12 only; pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.`)}let t=this.ajv,n="$id"in e&&typeof e.$id=="string"?t.getSchema(e.$id)??t.compile(e):t.compile(e);return o=>n(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:t.errorsText(n.errors)}}},vO=VI.Ajv;import yv from"process";var $v=Symbol.for("mcp.completable");function wv(e,t){return Object.defineProperty(e,$v,{value:{complete:t},enumerable:!1,writable:!1,configurable:!1}),e}function Sv(e){return!!e&&typeof e=="object"&&$v in e}function WI(e){return e[$v]?.complete}function YI(e,t){switch(t.kind){case"tools_list_changed":return e.toolsListChanged===!0;case"prompts_list_changed":return e.promptsListChanged===!0;case"resources_list_changed":return e.resourcesListChanged===!0;case"resource_updated":return e.resourceSubscriptions!==void 0&&e.resourceSubscriptions.includes(t.uri)}}function XI(e,t){let n={},o=r=>t===void 0||r===!0;return e.toolsListChanged===!0&&o(t?.tools?.listChanged)&&(n.toolsListChanged=!0),e.promptsListChanged===!0&&o(t?.prompts?.listChanged)&&(n.promptsListChanged=!0),e.resourcesListChanged===!0&&o(t?.resources?.listChanged)&&(n.resourcesListChanged=!0),e.resourceSubscriptions!==void 0&&e.resourceSubscriptions.length>0&&o(t?.resources?.subscribe)&&(n.resourceSubscriptions=[...e.resourceSubscriptions]),n}var Mu=1024;function e$(e,t){return{method:e.method,params:{...e.params,_meta:{...e.params?._meta,[nn]:t}}}}function QI(e){let t=Er(aa).validateRequest("subscriptions/listen",e);return t.ok?t.value.params?.notifications:void 0}var eP=new Set(["notifications/tools/list_changed","notifications/prompts/list_changed","notifications/resources/list_changed","notifications/resources/updated"]),c$=class{_subs=new Map;_serverCapabilities;_serverInfo;constructor(e=Mu,t,n){this._maxSubscriptions=e,this._serverCapabilities=t,this._serverInfo=n}setServerCapabilities(e,t){this._serverCapabilities=e,t!==void 0&&(this._serverInfo=t)}has(e){return this._subs.has(e)}serve(e){if(this._serverCapabilities===void 0)throw new Error("StdioListenRouter.serve() called before setServerCapabilities(); refusing to honor a filter without capabilities");if(this._subs.size>=this._maxSubscriptions)return{jsonrpc:"2.0",id:e.id,error:{code:-32603,message:"Subscription limit reached"}};let t=QI(e);if(t===void 0)return{jsonrpc:"2.0",id:e.id,error:{code:-32602,message:"Invalid params: 'notifications' is required and must be a valid SubscriptionFilter"}};let n=XI(t,this._serverCapabilities);return this._subs.set(e.id,n),e$({method:"notifications/subscriptions/acknowledged",params:{notifications:n}},e.id)}cancel(e){return this._subs.delete(e)}routeOutbound(e){if(!eP.has(e.method))return"passthrough";let t=e.params?.uri,n=typeof t=="string"?t:void 0,o=tP(e.method,n),r=[];for(let[i,a]of this._subs)YI(a,o)&&r.push(e$({method:e.method,params:e.params??{}},i));return r}teardownAll(){let e=[];for(let t of this._subs.keys())e.push({jsonrpc:"2.0",id:t,result:{resultType:"complete",_meta:{[nn]:t,...this._serverInfo!==void 0&&{[Ut]:this._serverInfo}}}});return this._subs.clear(),e}};function tP(e,t){switch(e){case"notifications/tools/list_changed":return{kind:"tools_list_changed"};case"notifications/prompts/list_changed":return{kind:"prompts_list_changed"};case"notifications/resources/list_changed":return{kind:"resources_list_changed"};default:return{kind:"resource_updated",uri:t??""}}}var rP=8,nP=6e5;function oP(e){if(e?.maxRounds!==void 0&&(!Number.isInteger(e.maxRounds)||e.maxRounds<1))throw new RangeError(`inputRequired.maxRounds must be a positive integer (got ${e.maxRounds})`);if(e?.roundTimeoutMs!==void 0&&(!Number.isFinite(e.roundTimeoutMs)||e.roundTimeoutMs<=0))throw new RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${e.roundTimeoutMs})`);return{maxRounds:e?.maxRounds??rP,roundTimeoutMs:e?.roundTimeoutMs??nP,legacyShim:e?.legacyShim??!0}}function l$(e,t,n){if(n===null||typeof n!="object"||typeof n.method!="string")throw new le(X.InternalError,`Handler for ${e} returned an invalid input request '${t}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);let o=n,r=oS(o);if(r===void 0)throw new le(X.InternalError,`Handler for ${e} returned an input request '${t}' of kind '${o.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:o,required:r}}function iP(){let e=globalThis.crypto;if(e?.randomUUID!==void 0)return e.randomUUID();let t=new Uint8Array(16);e.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=[...t].map(o=>o.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}function bv(e,t){if(e==="tools/call")return{content:[{type:"text",text:t}],isError:!0};throw new le(X.InternalError,t)}var aP=class{constructor(e){this._host=e}async fulfill(e,t,n,o,r){let{maxRounds:i,roundTimeoutMs:a}=this._host,s=o.mcpReq.signal,c=r,l=0;for(;;){if(l+=1,l>i)return bv(e,kS(e,i));let u=c.inputRequests,p=u!=null&&Object.keys(u).length>0,f=typeof c.requestState=="string"?c.requestState:void 0;if(!p&&f===void 0)throw new le(X.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);let b;if(p){let _=this._host.resolvedClientCapabilities(o),h=[];for(let[v,$]of Object.entries(u)){let{embedded:I,required:z}=l$(e,v,$);if(I.method!=="roots/list"&&I.params===void 0)throw new le(X.InternalError,`Handler for ${e} returned an input request '${v}' of kind '${I.method}' without params`);if(yu(z,_)!==void 0)return bv(e,`Cannot request input '${v}' (${I.method}): the client on this 2025-era connection did not declare the required capability${_===void 0?" (no client capabilities are available on this connection \u2014 per-request legacy serving cannot receive server-to-client requests)":""}`);h.push([v,I])}let w=PS(s);try{let v={relatedRequestId:o.mcpReq.id,timeout:a,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:w.signal},$=await Promise.all(h.map(async([I,z])=>{try{return[I,await this._dispatchLeg(z,v)]}catch(y){throw w.abort(y),y}}));b=Object.fromEntries($)}catch(v){if(s.aborted)throw v;return bv(e,`Fulfilling input required by '${e}' failed: ${v instanceof Error?v.message:String(v)}`)}finally{w.dispose()}}else await IS(RS,s);let g={...o,mcpReq:{...o.mcpReq,inputResponses:b,droppedInputResponseKeys:void 0,requestState:sa(f)}};if(f!==void 0){let _=await this._host.verifyRequestState(f,g,e);_!==void 0&&(g=lv(g,_))}let S=await t(n,g);if(!Qt(S))return S;c=S}}async _dispatchLeg(e,t){switch(e.method){case"elicitation/create":{let n=e.params;return n.mode==="url"&&n.elicitationId===void 0&&(n={...n,elicitationId:iP()}),await this._host.sendElicitation(n,t)}case"sampling/createMessage":return await this._host.sendSampling(e.params,t);case"roots/list":return await this._host.listRoots(e.params,t)}}},sP=new Set(["tools/call","prompts/get","resources/read"]),cP,u$,d$;function zv(e,t){u$(e,t)}function Rv(e){return d$(e)}var m$=class extends dv{_clientCapabilities;_clientVersion;static{cP=(e,t)=>{t.clientCapabilities!==void 0&&(e._clientCapabilities=t.clientCapabilities),t.clientInfo!==void 0&&(e._clientVersion=t.clientInfo)},u$=(e,t)=>{let n=t.filter(o=>!e._supportedProtocolVersions.includes(o));n.length>0&&(e._supportedProtocolVersions=[...e._supportedProtocolVersions,...n]),e.setRequestHandler("server/discover",()=>e._ondiscover())},d$=e=>e._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new aP({maxRounds:this._inputRequiredServing.maxRounds,roundTimeoutMs:this._inputRequiredServing.roundTimeoutMs,resolvedClientCapabilities:e=>this._inputRequestCapabilityView(e),verifyRequestState:(e,t,n)=>this._verifyRequestState(e,t,n),sendElicitation:(e,t)=>this._sendElicitationLeg(e,t,{validateAcceptedContent:!1}),sendSampling:(e,t)=>this.createMessage(e,t),listRoots:(e,t)=>this.listRoots(e,t)})}oninitialized;constructor(e,t){if(super(t),this._serverInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new Au,this._requestStateVerify=t?.requestState?.verify,this._inputRequiredServing=oP(t?.inputRequired),t?.cacheHints!==void 0){for(let[n,o]of Object.entries(t.cacheHints))o!==void 0&&ev(o,`cacheHints['${n}']`);this._cacheHints=t.cacheHints}this.setRequestHandler("initialize",n=>this._oninitialize(n)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),Bg(this._supportedProtocolVersions).length>0&&this.setRequestHandler("server/discover",()=>this._ondiscover()),this._capabilities.logging&&this._registerLoggingHandler()}_registerLoggingHandler(){this.setRequestHandler("logging/setLevel",async(e,t)=>{let n=t.sessionId||t.http?.req?.headers.get("mcp-session-id")||void 0,{level:o}=e.params,r=Iu(Pr,o);return r.success&&this._loggingLevels.set(n,r.data),{}})}buildContext(e,t){let n=e.http||t?.request||t?.closeSSEStream||t?.closeStandaloneSSEStream;return{...e,mcpReq:{...e.mcpReq,log:(o,r,i)=>{if(!this._capabilities.logging)return Promise.resolve();let a;if(this._servedModernEra()){if(a=e.mcpReq.envelope?.[$r],a===void 0)return Promise.resolve()}else a=this._loggingLevels.get(e.sessionId)??this._loggingLevels.get(void 0);return a!==void 0&&this.LOG_LEVEL_SEVERITY.get(o)<this.LOG_LEVEL_SEVERITY.get(a)?Promise.resolve():e.mcpReq.notify({method:"notifications/message",params:{level:o,data:r,logger:i}})},elicitInput:(o,r)=>this.elicitInput(o,r),requestSampling:(o,r)=>this.createMessage(o,r)},http:n?{...e.http,req:t?.request,closeSSE:t?.closeSSEStream,closeStandaloneSSE:t?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map(Pr.options.map((e,t)=>[e,t]));isMessageIgnored=(e,t)=>{let n=this._loggingLevels.get(t);return n?this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(n):!1};registerCapabilities(e){if(this.transport)throw new he(Se.AlreadyConnected,"Cannot register capabilities after connecting to transport");let t=!!this._capabilities.logging;this._capabilities=mv(this._capabilities,e),!t&&this._capabilities.logging&&this._registerLoggingHandler()}_wrapHandler(e,t){if(e!=="tools/call"){let n=this._cacheHints?.[e],o=sP.has(e);return n===void 0&&!o?async(r,i)=>{let a=await t(r,i);if(Qt(a))throw new le(X.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return a}:async(r,i)=>{let a=o?await this._invokeInputRequiredCapableHandler(e,t,r,i):await t(r,i);if(Qt(a)){if(!o)throw new le(X.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return a}return n===void 0?a:bu(a,n)}}return async(n,o)=>{let r=Er(this._negotiatedProtocolVersion),i=r.validateRequest("tools/call",n);if(!i.ok)throw new le(i.reason==="not-in-era"?X.InternalError:X.InvalidParams,i.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call request: ${i.message}`);let a=await this._invokeInputRequiredCapableHandler("tools/call",t,n,o);if(Qt(a))return a;let s=Kg(a),c=r.validateResult("tools/call",s);if(!c.ok)throw new le(c.reason==="not-in-era"?X.InternalError:X.InvalidParams,c.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call result: ${c.message}`);return c.value}}_servedModernEra(){return this._negotiatedProtocolVersion!==void 0&&go(this._negotiatedProtocolVersion)}async _invokeInputRequiredCapableHandler(e,t,n,o){let r=this._servedModernEra(),i=o.mcpReq.requestState();if(i!==void 0&&typeof i!="string")throw new le(X.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"});let a=o;if(typeof i=="string"){let p=await this._verifyRequestState(i,o,e);p!==void 0&&(a=lv(o,p))}let s;try{s=await t(n,a)}catch(p){throw p instanceof le&&p.code===X.UrlElicitationRequired&&r?new le(X.InternalError,`URL elicitation cannot be signalled by throwing UrlElicitationRequiredError on protocol revision ${this._negotiatedProtocolVersion}: return inputRequired({ inputRequests: { \u2026: inputRequired.elicitUrl(...) } }) from the handler instead. The urlElicitationRequired error (-32042) of earlier revisions is not available on this revision.`):p}if(!Qt(s))return s;if(!r){if(!this._inputRequiredServing.legacyShim)throw new le(X.InternalError,`Handler for ${e} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??rn}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(e,t,n,a,s)}let c=s.inputRequests,l=c!=null&&Object.keys(c).length>0,u=typeof s.requestState=="string";if(!l&&!u)throw new le(X.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(l){let p=this._inputRequestCapabilityView(o);for(let[f,b]of Object.entries(c)){let{embedded:g,required:S}=l$(e,f,b),_=yu(S,p);if(_!==void 0)throw new $u({requiredCapabilities:_},`Cannot request input '${f}' (${g.method}): the request's client capabilities do not declare the required capability`)}}return s}async _verifyRequestState(e,t,n){if(this._requestStateVerify!==void 0)try{return await this._requestStateVerify(e,t)}catch(o){throw this.onerror?.(new Error(`requestState verification rejected ${n}: ${o instanceof Error?o.message:String(o)}`)),new le(X.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(e){return this._servedModernEra()?e.mcpReq.envelope?.[Yt]:this._clientCapabilities}_assertPushApiInServedEra(e){if(this._servedModernEra())throw new he(Se.MethodNotSupportedByProtocolVersion,`Server-to-client requests are not available on protocol revision ${this._negotiatedProtocolVersion}: '${e}' cannot be sent while serving a request on that revision. Return inputRequired({ ... }) from the handler instead \u2014 the client fulfils the embedded requests and retries the original request (multi round-trip requests).`,{method:e,era:"2026-07-28"})}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new he(Se.CapabilityNotSupported,`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new he(Se.CapabilityNotSupported,`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new he(Se.CapabilityNotSupported,`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new he(Se.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new he(Se.CapabilityNotSupported,`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new he(Se.CapabilityNotSupported,`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new he(Se.CapabilityNotSupported,`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new he(Se.CapabilityNotSupported,`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"completion/complete":if(!this._capabilities.completions)throw new he(Se.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new he(Se.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new he(Se.CapabilityNotSupported,`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new he(Se.CapabilityNotSupported,`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new he(Se.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let t=e.params.protocolVersion;this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo;let n=aS(this._supportedProtocolVersions),o=n.includes(t)?t:n[0]??rn;return this._negotiatedProtocolVersion=o,this.transport?.setProtocolVersion?.(o),{protocolVersion:o,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:Bg(this._supportedProtocolVersions),capabilities:lP(this.getCapabilities()),...this._instructions&&{instructions:this._instructions}}}_outboundServerInfo(){return this._serverInfo}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}projectCallToolResult(e,t){return this._wireCodec().projectCallToolResult(e,t)}getCapabilities(){return this._capabilities}async ping(){return this._assertPushApiInServedEra("ping"),this.request({method:"ping"})}async createMessage(e,t){if(this._assertPushApiInServedEra("sampling/createMessage"),(e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new he(Se.CapabilityNotSupported,"Client does not support sampling tools capability.");if(e.messages.length>0){let i=e.messages.at(-1),a=Array.isArray(i.content)?i.content:[i.content],s=a.some(p=>p.type==="tool_result"),c=e.messages.length>1?e.messages.at(-2):void 0,l=c?Array.isArray(c.content)?c.content:[c.content]:[],u=l.some(p=>p.type==="tool_use");if(s){if(a.some(p=>p.type!=="tool_result"))throw new le(X.InvalidParams,"The last message must contain only tool_result content if any is present");if(!u)throw new le(X.InvalidParams,"tool_result blocks are not matching any tool_use from the previous message")}if(u){let p=new Set(l.filter(b=>b.type==="tool_use").map(b=>b.id)),f=new Set(a.filter(b=>b.type==="tool_result").map(b=>b.toolUseId));if(p.size!==f.size||![...p].every(b=>f.has(b)))throw new le(X.InvalidParams,"ids of tool_result blocks and tool_use blocks from previous message do not match")}}let n=!!(e.tools||e.toolChoice),o=await this.request({method:"sampling/createMessage",params:e},t),r=this._wireCodec().samplingResultVariant(n,o);if(!r.ok)throw new he(Se.InvalidResult,`Invalid sampling/createMessage result: ${r.reason==="invalid"?r.message:r.reason}`);return r.value}async elicitInput(e,t){switch(this._assertPushApiInServedEra("elicitation/create"),e.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw new he(Se.CapabilityNotSupported,"Client does not support url elicitation.");break;case"form":if(!this._clientCapabilities?.elicitation?.form)throw new he(Se.CapabilityNotSupported,"Client does not support form elicitation.");break}return this._sendElicitationLeg(e,t)}async _sendElicitationLeg(e,t,n){let o=e.mode??"form",r=n?.validateAcceptedContent??!0;switch(o){case"url":{let i=e;return this.request({method:"elicitation/create",params:i},t)}case"form":{let i=e.mode==="form"?e:{...e,mode:"form"},a=await this.request({method:"elicitation/create",params:i},t);if(r&&a.action==="accept"&&a.content&&i.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(i.requestedSchema)(a.content);if(!s.valid)throw new le(X.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(s){throw s instanceof le?s:new le(X.InternalError,`Error validating elicitation response: ${s instanceof Error?s.message:String(s)}`)}return a}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw new he(Se.CapabilityNotSupported,"Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this._assertPushApiInServedEra("roots/list"),this.request({method:"roots/list",params:e},t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};function lP(e){return{...e}}var da=class{server;_registeredResources={};_registeredResourceTemplates={};_registeredTools={};_registeredPrompts={};_toolInputSchemaJson={};toolInputSchemaJson(e){let t=this._registeredTools[e];if(!(t===void 0||!t.enabled)){if(Object.hasOwn(this._toolInputSchemaJson,e))return this._toolInputSchemaJson[e];if(t.inputSchema===void 0)return r$;try{let n=jr(t.inputSchema,"input");return this._toolInputSchemaJson[e]=n,n}catch{return}}}constructor(e,t){this.server=new m$(e,t),t?.capabilities?.tools&&this.setToolRequestHandlers(),t?.capabilities?.resources&&this.setResourceRequestHandlers(),t?.capabilities?.prompts&&this.setPromptRequestHandlers()}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}_toolHandlersInitialized=!1;setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler("tools/list"),this.server.assertCanSetRequestHandler("tools/call"),this.server.registerCapabilities({tools:{listChanged:this.server.getCapabilities().tools?.listChanged??!0}}),this.server.setRequestHandler("tools/list",()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let n={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?jr(t.inputSchema,"input"):r$,annotations:t.annotations,icons:t.icons,execution:t.execution,_meta:t._meta};return t.outputSchema&&(n.outputSchema=jr(t.outputSchema,"output")),n})})),this.server.setRequestHandler("tools/call",async(e,t)=>{let n=this._registeredTools[e.params.name];if(!n)throw new le(X.InvalidParams,`Tool ${e.params.name} not found`);if(!n.enabled)throw new le(X.InvalidParams,`Tool ${e.params.name} disabled`);try{let o=await this.validateToolInput(n,e.params.arguments,e.params.name),r=await this.executeToolHandler(n,o,t);return await this.validateToolOutput(n,r,e.params.name),Qt(r)?r:this.server.projectCallToolResult(r,n.outputSchemaJson)}catch(o){if(o instanceof le&&o.code===X.UrlElicitationRequired)throw o;return this.createToolError(o instanceof Error?o.message:String(o))}}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,n){if(!e.inputSchema)return;let o=await sn(e.inputSchema,t??{});if(!o.success)throw new le(X.InvalidParams,`Input validation error: Invalid arguments for tool ${n}: ${o.error}`);return o.data}async validateToolOutput(e,t,n){if(!e.outputSchema||Qt(t)||t.isError)return;if(t.structuredContent===void 0)throw new le(X.InvalidParams,`Output validation error: Tool ${n} has an output schema but no structured content was provided`);let o=await sn(e.outputSchema,t.structuredContent);if(!o.success)throw new le(X.InvalidParams,`Output validation error: Invalid structured content for tool ${n}: ${o.error}`)}async executeToolHandler(e,t,n){return e.executor(t,n)}_completionHandlerInitialized=!1;setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler("completion/complete"),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler("completion/complete",async e=>{switch(e.params.ref.type){case"ref/prompt":return nv(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return ov(e),this.handleResourceCompletion(e,e.params.ref);default:throw new le(X.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,t){let n=this._registeredPrompts[t.name];if(!n)throw new le(X.InvalidParams,`Prompt ${t.name} not found`);if(!n.enabled)throw new le(X.InvalidParams,`Prompt ${t.name} disabled`);if(!n.argsSchema)return ua;let o=s$(a$(n.argsSchema)?.[e.params.argument.name]);if(!Sv(o))return ua;let r=WI(o);return r?i$(await r(e.params.argument.value,e.params.context)):ua}async handleResourceCompletion(e,t){let n=Object.values(this._registeredResourceTemplates).find(r=>r.resourceTemplate.uriTemplate.toString()===t.uri);if(!n){if(this._registeredResources[t.uri])return ua;throw new le(X.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let o=n.resourceTemplate.completeCallback(e.params.argument.name);return o?i$(await o(e.params.argument.value,e.params.context)):ua}_resourceHandlersInitialized=!1;setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler("resources/list"),this.server.assertCanSetRequestHandler("resources/templates/list"),this.server.assertCanSetRequestHandler("resources/read"),this.server.registerCapabilities({resources:{listChanged:this.server.getCapabilities().resources?.listChanged??!0}}),this.server.setRequestHandler("resources/list",async(e,t)=>{let n=Object.entries(this._registeredResources).filter(([r,i])=>i.enabled).map(([r,i])=>({uri:r,name:i.name,...i.metadata})),o=[];for(let r of Object.values(this._registeredResourceTemplates)){if(!r.resourceTemplate.listCallback)continue;let i=await r.resourceTemplate.listCallback(t);for(let a of i.resources)o.push({...r.metadata,...a})}return{resources:[...n,...o]}}),this.server.setRequestHandler("resources/templates/list",async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([e,t])=>({name:e,uriTemplate:t.resourceTemplate.uriTemplate.toString(),...t.metadata}))})),this.server.setRequestHandler("resources/read",async(e,t)=>{let n;try{n=new URL(e.params.uri)}catch{throw new le(X.InvalidParams,`Resource URI ${e.params.uri} is invalid`,{uri:e.params.uri,reason:"invalid_uri"})}let o=this._registeredResources[n.toString()];if(o){if(!o.enabled)throw new le(X.InvalidParams,`Resource ${n} disabled`);return bu(await o.readCallback(n,t),o.cacheHint)}for(let r of Object.values(this._registeredResourceTemplates)){let i=r.resourceTemplate.uriTemplate.match(n.toString());if(i)return bu(await r.readCallback(n,i,t),r.cacheHint)}throw new Su(e.params.uri)}),this._resourceHandlersInitialized=!0)}_promptHandlersInitialized=!1;setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler("prompts/list"),this.server.assertCanSetRequestHandler("prompts/get"),this.server.registerCapabilities({prompts:{listChanged:this.server.getCapabilities().prompts?.listChanged??!0}}),this.server.setRequestHandler("prompts/list",()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?zS(t.argsSchema):void 0,icons:t.icons,_meta:t._meta}))})),this.server.setRequestHandler("prompts/get",async(e,t)=>{let n=this._registeredPrompts[e.params.name];if(!n)throw new le(X.InvalidParams,`Prompt ${e.params.name} not found`);if(!n.enabled)throw new le(X.InvalidParams,`Prompt ${e.params.name} disabled`);return n.handler(e.params.arguments,t)}),this._promptHandlersInitialized=!0)}registerResource(e,t,n,o){let r=n.cacheHint,i=n;if(r!==void 0){ev(r,`resource ${e}`);let a={...n};delete a.cacheHint,i=a}if(typeof t=="string"){if(this._registeredResources[t])throw new Error(`Resource ${t} is already registered`);let a=this._createRegisteredResource(e,n.title,t,i,o);return r!==void 0&&(a.cacheHint=r),this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let a=this._createRegisteredResourceTemplate(e,n.title,t,i,o);return r!==void 0&&(a.cacheHint=r),this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}}_createRegisteredResource(e,t,n,o,r){let i={name:e,title:t,metadata:o,readCallback:r,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:a=>{a.uri!==void 0&&a.uri!==n&&(delete this._registeredResources[n],a.uri&&(this._registeredResources[a.uri]=i)),a.name!==void 0&&(i.name=a.name),a.title!==void 0&&(i.title=a.title),a.metadata!==void 0&&(i.metadata=a.metadata),a.callback!==void 0&&(i.readCallback=a.callback),a.enabled!==void 0&&(i.enabled=a.enabled),this.sendResourceListChanged()}};return this._registeredResources[n]=i,i}_createRegisteredResourceTemplate(e,t,n,o,r){let i={resourceTemplate:n,title:t,metadata:o,readCallback:r,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:s=>{s.name!==void 0&&s.name!==e&&(delete this._registeredResourceTemplates[e],s.name&&(this._registeredResourceTemplates[s.name]=i)),s.title!==void 0&&(i.title=s.title),s.template!==void 0&&(i.resourceTemplate=s.template),s.metadata!==void 0&&(i.metadata=s.metadata),s.callback!==void 0&&(i.readCallback=s.callback),s.enabled!==void 0&&(i.enabled=s.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=i;let a=n.uriTemplate.variableNames;return Array.isArray(a)&&a.some(s=>!!n.completeCallback(s))&&this.setCompletionRequestHandler(),i}_createRegisteredPrompt(e,t,n,o,r,i,a){let s=o,c=r,l={title:t,description:n,argsSchema:o,icons:i,_meta:a,handler:o$(e,o,r),enabled:!0,disable:()=>l.update({enabled:!1}),enable:()=>l.update({enabled:!0}),remove:()=>l.update({name:null}),update:u=>{u.name!==void 0&&u.name!==e&&(delete this._registeredPrompts[e],u.name&&(this._registeredPrompts[u.name]=l)),u.title!==void 0&&(l.title=u.title),u.description!==void 0&&(l.description=u.description),u.icons!==void 0&&(l.icons=u.icons),u._meta!==void 0&&(l._meta=u._meta);let p=!1;u.argsSchema!==void 0&&(l.argsSchema=u.argsSchema,s=u.argsSchema,p=!0),u.callback!==void 0&&(c=u.callback,p=!0),p&&(l.handler=o$(e,s,c)),u.enabled!==void 0&&(l.enabled=u.enabled),this.sendPromptListChanged()}};if(this._registeredPrompts[e]=l,o){let u=a$(o);u&&Object.values(u).some(p=>Sv(s$(p)))&&this.setCompletionRequestHandler()}return l}_createRegisteredTool(e,t,n,o,r,i,a,s,c,l){if(hv(e),o!==void 0)try{let f=jr(o,"input");this._toolInputSchemaJson[e]=f;let b=iv(f);b.valid||console.warn(`[mcp-sdk] tool '${e}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${b.reason}`)}catch{}let u=l,p={title:t,description:n,inputSchema:o,outputSchema:r,outputSchemaJson:n$(r),annotations:i,icons:a,execution:s,_meta:c,handler:l,executor:t$(o,l),enabled:!0,disable:()=>p.update({enabled:!1}),enable:()=>p.update({enabled:!0}),remove:()=>p.update({name:null}),update:f=>{f.name!==void 0&&f.name!==e&&(typeof f.name=="string"&&hv(f.name),delete this._registeredTools[e],delete this._toolInputSchemaJson[e],f.name&&(delete this._toolInputSchemaJson[f.name],this._registeredTools[f.name]=p,e=f.name)),f.title!==void 0&&(p.title=f.title),f.description!==void 0&&(p.description=f.description);let b=!1;f.paramsSchema!==void 0&&(p.inputSchema=f.paramsSchema,delete this._toolInputSchemaJson[e],b=!0),f.callback!==void 0&&(p.handler=f.callback,u=f.callback,b=!0),b&&(p.executor=t$(p.inputSchema,u)),f.outputSchema!==void 0&&(p.outputSchema=f.outputSchema,p.outputSchemaJson=n$(f.outputSchema)),f.annotations!==void 0&&(p.annotations=f.annotations),f.icons!==void 0&&(p.icons=f.icons),f._meta!==void 0&&(p._meta=f._meta),f.enabled!==void 0&&(p.enabled=f.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=p,this.setToolRequestHandlers(),this.sendToolListChanged(),p}registerTool(e,t,n){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let{title:o,description:r,inputSchema:i,outputSchema:a,annotations:s,icons:c,_meta:l}=t;return this._createRegisteredTool(e,o,r,Pu(i),Pu(a),s,c,void 0,l,n)}registerPrompt(e,t,n){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let{title:o,description:r,argsSchema:i,icons:a,_meta:s}=t,c=this._createRegisteredPrompt(e,o,r,Pu(i),n,a,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),c}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};function t$(e,t){if(e){let o=t;return async(r,i)=>o(r,i)}let n=t;return async(o,r)=>n(r)}var r$={type:"object",properties:{}};function n$(e){if(e!==void 0)try{return jr(e,"output")}catch{return}}function o$(e,t,n){if(t){let o=n;return async(r,i)=>{let a=await sn(t,r);if(!a.success)throw new le(X.InvalidParams,`Invalid arguments for prompt ${e}: ${a.error}`);return o(a.data,i)}}else{let o=n;return async(r,i)=>o(i)}}function i$(e){return{completion:{values:e.map(String).slice(0,100),total:e.length,hasMore:e.length>100}}}var ua={completion:{values:[],hasMore:!1}};function a$(e){let t=e;if(t.shape&&typeof t.shape=="object")return t.shape}function uP(e){return e?.type==="optional"}function s$(e){return uP(e)?e.def?.innerType??e:e}var dP=class{_readBuffer;_started=!1;_closed=!1;constructor(e=yv.stdin,t=yv.stdout,n){this._stdin=e,this._stdout=t,this._readBuffer=new pv({maxBufferSize:n?.maxBufferSize})}onclose;onerror;onmessage;_ondata=e=>{try{this._readBuffer.append(e),this.processReadBuffer()}catch(t){this.onerror?.(t),this.close().catch(()=>{})}};_onerror=e=>{this.onerror?.(e)};_onstdouterror=e=>{this.onerror?.(e),this.close().catch(()=>{})};async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror),this._stdout.on("error",this._onstdouterror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._closed||(this._closed=!0,this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdout.off("error",this._onstdouterror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.())}send(e){return this._closed?Promise.reject(new Error("StdioServerTransport is closed")):new Promise((t,n)=>{let o=fv(e),r=!1,i=s=>{r||(r=!0,this._stdout.off("error",i),this._stdout.off("drain",a),n(s))},a=()=>{r||(r=!0,this._stdout.off("error",i),this._stdout.off("drain",a),t())};if(this._stdout.once("error",i),this._stdout.write(o)){if(r)return;r=!0,this._stdout.off("error",i),t()}else r||this._stdout.once("drain",a)})}},p$=3e3,mP=class{onclose;onerror;onmessage;_closed=!1;_pendingRequests=new Set;_drainWaiters=[];constructor(e,t,n){this._wire=e,this._onInstanceClose=t,this._outboundIntercept=n}async start(){}async send(e,t){if(oa(e)||ku(e)){let{id:n}=e;n!==void 0&&this._settle(n)}if(!this._closed&&this._outboundIntercept?.(e)!=="handled")return this._wire.send(e,t)}setProtocolVersion=e=>{this._wire.setProtocolVersion?.(e)};deliver(e,t){if(!this._closed){if($t(e))this._pendingRequests.add(e.id);else if(Or(e)&&e.method==="notifications/cancelled"){let n=e.params?.requestId;n!==void 0&&this._settle(n)}this.onmessage?.(e,t)}}async whenRequestsAnswered(e){return this._closed||this._pendingRequests.size===0?!0:await new Promise(t=>{let n=()=>{clearTimeout(o),t(!0)},o=setTimeout(()=>{this._drainWaiters=this._drainWaiters.filter(r=>r!==n),t(!1)},e);this._drainWaiters.push(n)})}async close(){if(!this._closed){this._closed=!0,this._pendingRequests.clear(),this._releaseDrainWaiters();try{this._onInstanceClose()}finally{this.onclose?.()}}}_settle(e){this._pendingRequests.delete(e),this._pendingRequests.size===0&&this._releaseDrainWaiters()}_releaseDrainWaiters(){let e=this._drainWaiters;this._drainWaiters=[];for(let t of e)t()}};function pP(e){let t=e.params;if(e.method==="initialize"&&!av(t)){let i=t!==null&&typeof t=="object"&&typeof t.protocolVersion=="string"?t.protocolVersion:void 0;return{kind:"legacy",reason:"initialize",...i!==void 0&&{requestedVersion:i}}}if(!wu(t))return{kind:"legacy",reason:"no-claim"};let n=ln(t),o=(n===void 0?[]:Ru(n))[0];if(o!==void 0)return{kind:"invalid-envelope",issue:o};let r=zu(t);return r===void 0||!xr.includes(r)?{kind:"unsupported-revision",requested:r??"unknown"}:{kind:"modern",revision:r,classification:{era:"modern",revision:r}}}function f$(e,t={}){let n=t.legacy??"serve",o=t.transport??new dP,r={phase:"opening"},i,a=!1,s=()=>a||r.phase==="closed",c=R=>{try{t.onerror?.(R)}catch{}},l=(R,O,L,A)=>o.send({jsonrpc:"2.0",id:R,error:{code:O,message:L,...A!==void 0&&{data:A}}}).catch(F=>c(Et(F))),u=new c$(t.maxSubscriptions??Mu),p=R=>{if(!Or(R))return;let O=u.routeOutbound(R);if(O!=="passthrough"){for(let L of O)o.send({jsonrpc:"2.0",...L}).catch(A=>c(Et(A)));return"handled"}},f=async R=>{if($t(R)&&R.method==="subscriptions/listen"){let O=ln(R.params),L=wu(R.params)?(O===void 0?[]:Ru(O))[0]:{key:"_meta",problem:"the per-request envelope is required on protocol revision 2026-07-28"},A=zu(R.params),F;if(L!==void 0)F={jsonrpc:"2.0",id:R.id,error:{code:-32602,message:`Invalid _meta envelope: ${L.key}: ${L.problem}`}};else if(A===void 0||!xr.includes(A)){let ee=new vo({supported:[...xr],requested:A??"unknown"});F={jsonrpc:"2.0",id:R.id,error:{code:ee.code,message:ee.message,data:ee.data}}}else F=u.serve(R);return await o.send("error"in F?F:{jsonrpc:"2.0",method:F.method,params:F.params}).catch(ee=>c(Et(ee))),!0}if(Or(R)&&R.method==="notifications/cancelled"){let O=R.params?.requestId;if(O!==void 0&&u.cancel(O))return!0}return!1},b=(R,O,L)=>{let A=sv({kind:"legacy",reason:O,...L!==void 0&&{requestedVersion:L}},xr);return A===void 0?Promise.resolve():(c(new Error(`Rejected 2025-era request on a modern-only stdio connection (${A.cell}): ${A.message}`)),l(R.id,A.code,A.message,A.data))},g=R=>{a||R===i||z()},S=async(R,O)=>{let L=await e({era:R}),A=L instanceof da?L.server:L;R==="modern"&&(uv(A,O),zv(A,xr),u.setServerCapabilities(A.getCapabilities(),Rv(A)));let F=new mP(o,()=>g(F),R==="modern"?p:void 0);return await L.connect(F),{product:L,channel:F}},_=R=>R.product.close().catch(O=>c(Et(O))),h=async R=>{i=R.channel;try{await R.channel.whenRequestsAnswered(p$)||c(new Error(`Discarded the probe instance with requests still unanswered after ${p$}ms; continuing with the fallback`)),await R.product.close()}catch(O){c(Et(O))}finally{i=void 0}},w=async R=>{if(r.phase==="closed")return;if(r.phase==="pinned"){if(r.era==="modern"&&$t(R)&&R.method==="initialize"&&!av(R.params)){await b(R,"initialize",R.params!==null&&typeof R.params=="object"&&typeof R.params.protocolVersion=="string"?R.params.protocolVersion:void 0);return}if(r.era==="modern"&&await f(R))return;r.instance.channel.deliver(R);return}if(!$t(R)&&!Or(R)){c(new Error("Discarded a JSON-RPC response received before the connection negotiated an era"));return}let O=pP(R);switch(O.kind){case"invalid-envelope":{let L=`Invalid _meta envelope for protocol revision 2026-07-28: ${O.issue.key}: ${O.issue.problem}`;$t(R)?await l(R.id,X.InvalidParams,L,{envelope:O.issue}):c(new Error(`Discarded a notification with a malformed envelope: ${L}`));return}case"unsupported-revision":if($t(R)){let L=new vo({supported:[...xr],requested:O.requested});c(L),await l(R.id,L.code,L.message,L.data)}else c(new Error(`Discarded a notification claiming unsupported protocol revision ${O.requested}`));return;case"modern":if($t(R)&&R.method==="server/discover"){if(r.phase==="probe"){r.instance.channel.deliver(R,{classification:O.classification});return}let L=await S("modern",O.revision);if(s()){await _(L);return}r={phase:"probe",instance:L},L.channel.deliver(R,{classification:O.classification});return}if(r.phase==="probe"){if(Or(R)){r.instance.channel.deliver(R,{classification:O.classification});return}r={phase:"pinned",era:"modern",instance:r.instance}}else{let L=await S("modern",O.revision);if(s()){await _(L);return}r={phase:"pinned",era:"modern",instance:L}}if(await f(R))return;r.instance.channel.deliver(R,{classification:O.classification});return;case"legacy":{if(n==="reject"){$t(R)&&await b(R,O.reason,O.requestedVersion);return}if(r.phase==="probe"){if(await h(r.instance),s())return;r={phase:"opening"}}let L=await S("legacy");if(s()){await _(L);return}r={phase:"pinned",era:"legacy",instance:L},r.instance.channel.deliver(R);return}}},v=[],$=!1,I=async()=>{if(!$){$=!0;try{for(;v.length>0;){let R=v.shift();try{await w(R)}catch(O){$t(R)&&await l(R.id,X.InternalError,"Internal server error"),c(Et(O))}}}finally{$=!1}}},z=async()=>{if(a||r.phase==="closed")return;a=!0;let R=r;r={phase:"closed"};for(let O of u.teardownAll())await o.send(O).catch(L=>c(Et(L)));(R.phase==="probe"||R.phase==="pinned")&&await R.instance.product.close().catch(O=>c(Et(O))),await o.close().catch(O=>c(Et(O)))};o.onmessage=R=>{v.push(R),I()},o.onerror=R=>{c(R),(r.phase==="probe"||r.phase==="pinned")&&r.instance.channel.onerror?.(R)},o.onclose=()=>{if(a||r.phase==="closed")return;a=!0;let R=r;r={phase:"closed"},(R.phase==="probe"||R.phase==="pinned")&&R.instance.product.close().catch(O=>c(Et(O)))};let y=o.start().catch(R=>{throw c(Et(R)),R});return y.catch(()=>{}),{close:async()=>{await y.catch(()=>{}),await z()}}}function Et(e){return e instanceof Error?e:new Error(String(e))}var fP=m.object({STEAM_API_KEY:m.string().min(1).optional(),STEAM_API_BASE_URL:m.string().url().default("https://api.steampowered.com"),STEAM_ID:m.string().min(2).optional(),STEAM_STORE_BASE_URL:m.string().url().default("https://store.steampowered.com"),STEAM_COUNTRY:m.string().min(2).max(2).default("US"),STEAM_LANGUAGE:m.string().min(2).default("english"),HTTP_TIMEOUT_MS:m.coerce.number().int().positive().default(15e3),HTTP_RETRIES:m.coerce.number().int().nonnegative().default(2),STEAM_STORE_MIN_INTERVAL_MS:m.coerce.number().int().nonnegative().default(250),STEAM_API_MIN_INTERVAL_MS:m.coerce.number().int().nonnegative().default(0),CACHE_TTL_MS:m.coerce.number().int().nonnegative().default(3e5),LOG_LEVEL:m.enum(["debug","info","warn","error","silent"]).default("info")}),hP=/^\$\{[^}]*\}$/;function h$(e=process.env){let t=Object.fromEntries(Object.entries(e).filter(([,o])=>o!==void 0&&o.trim()!==""&&!hP.test(o))),n=fP.parse(t);return{steamApiBaseUrl:n.STEAM_API_BASE_URL,steamApiKey:n.STEAM_API_KEY,defaultSteamId:n.STEAM_ID,steamStoreBaseUrl:n.STEAM_STORE_BASE_URL,country:n.STEAM_COUNTRY,language:n.STEAM_LANGUAGE,httpTimeoutMs:n.HTTP_TIMEOUT_MS,httpRetries:n.HTTP_RETRIES,storeMinIntervalMs:n.STEAM_STORE_MIN_INTERVAL_MS,apiMinIntervalMs:n.STEAM_API_MIN_INTERVAL_MS,cacheTtlMs:n.CACHE_TTL_MS,logLevel:n.LOG_LEVEL}}var Re=class extends Error{code;status;retryable;hadCredentials;unsafeDetail;constructor(t){super(t.message,t.cause===void 0?void 0:{cause:t.cause}),this.name="ApiError",this.code=t.code,this.status=t.status,this.retryable=t.retryable??!1,this.hadCredentials=t.hadCredentials,this.unsafeDetail=t.unsafeDetail??!1}};async function er(e,t,n){try{return await t()}catch(o){if(o instanceof Re&&o.code===e)return n;throw o}}function g$(e){return e===304?{code:"not_modified",retryable:!1}:e===401?{code:"unauthorized",retryable:!1}:e===403?{code:"forbidden",retryable:!1}:e===404?{code:"not_found",retryable:!1}:e===429?{code:"rate_limited",retryable:!0}:e===400||e===405||e===422?{code:"bad_request",retryable:!1}:e>=500?{code:"server_error",retryable:!0}:{code:"unknown",retryable:!1}}function kv(e){return e.replace(/Bearer\s+[A-Za-z0-9._~+/-]+=*/gi,"Bearer ***").replace(/\b(access_token|refresh_token|client_secret|client_id|api_key|apikey|key)=([^&\s"]+)/gi,"$1=***")}var v$={debug:10,info:20,warn:30,error:40,silent:100};function _$(e,t){let n=v$[e];function o(r,i,a){if(v$[r]<n)return;let s=a.length?" "+kv(a.map(l=>gP(l)).join(" ")):"",c=`${kv(i)}${s}`;if(console.error(`[steam-games-mcp] ${r}: ${c}`),t)try{t(r,c)}catch{}}return{debug:(r,...i)=>o("debug",r,i),info:(r,...i)=>o("info",r,i),warn:(r,...i)=>o("warn",r,i),error:(r,...i)=>o("error",r,i)}}function gP(e){if(typeof e=="string")return e;if(e instanceof Error)return e.message;try{return JSON.stringify(e)}catch{return String(e)}}var qu="0.10.4",y$=`steam-games-mcp/${qu} (+https://github.com/Grinv/steam-games-mcp)`;var b$=8e3,_o=class{#e;constructor(t){this.#e=t}async getJson(t,n={}){return this.requestJson(t,{...n,method:n.method??"GET"})}async requestJson(t,n={}){let o=this.#r(t,n.query),r=n.retries??this.#e.retries??2,i=n.timeoutMs??this.#e.timeoutMs??15e3,a=0;for(;;){this.#e.beforeRequest&&await this.#e.beforeRequest();try{return await this.#n(o,n,i)}catch(s){let c=s instanceof Re?s:S$(s);if(!c.retryable||a>=r)throw c;let l=yP(a,c);this.#e.logger.debug(`retrying ${o} after ${l}ms (attempt ${a+1}/${r}, ${c.code})`),await wP(l),a+=1}}}async#n(t,n,o){let r=new AbortController,i=setTimeout(()=>r.abort(),o),a=()=>r.abort();n.signal?.addEventListener("abort",a,{once:!0});let s;try{s=await fetch(t,{method:n.method??"GET",headers:{"User-Agent":y$,Accept:"application/json",...this.#e.defaultHeaders,...n.headers},...n.body===void 0?{}:{body:n.body},signal:r.signal})}catch(l){throw n.signal?.aborted?new Re({code:"network",message:"Request aborted by caller",cause:l}):r.signal.aborted?new Re({code:"timeout",message:`Request timed out after ${o}ms`,retryable:!0,cause:l}):S$(l)}finally{clearTimeout(i),n.signal?.removeEventListener("abort",a)}if(!s.ok)throw await vP(s,this.#e.hasCredentials);if(s.status===204)return;let c=await s.text();if(c.length!==0)try{return JSON.parse(c)}catch(l){throw new Re({code:"unknown",message:"Upstream returned invalid JSON",cause:l})}}#r(t,n){let o=new URL(t.replace(/^\//,""),$P(this.#e.baseUrl));if(n)for(let[r,i]of Object.entries(n))i!==void 0&&o.searchParams.set(r,String(i));return o.toString()}};async function vP(e,t){let{code:n,retryable:o}=g$(e.status),r="";try{r=await e.text()}catch{}let i=_P(r),a=i??r.slice(0,500),s=SP(e.headers.get("retry-after"));return new Re({code:n,status:e.status,retryable:o,hadCredentials:t,message:`HTTP ${e.status} ${e.statusText}${a?`: ${a}`:""}`,unsafeDetail:i===void 0&&r.length>0,...s===void 0?{}:{cause:{retryAfterMs:s}}})}function _P(e){if(e)try{let t=JSON.parse(e);if(t===null||typeof t!="object")return;let n=t;return typeof n.message=="string"?n.message:typeof n.error=="string"?n.error:void 0}catch{return}}function S$(e){return e instanceof Re?e:new Re({code:"network",message:e instanceof Error?`Network error: ${e.message}`:"Network error",retryable:!0,cause:e})}function yP(e,t){let n=t.cause?.retryAfterMs;if(typeof n=="number"&&n>0)return Math.min(n,b$);let o=Math.min(b$,500*2**e);return o+Math.floor(o*.25*bP(e))}function bP(e){return e*2654435761%1e3/1e3}function SP(e){if(!e)return;let t=Number(e);if(Number.isFinite(t))return t*1e3;let n=Date.parse(e);if(Number.isFinite(n))return Math.max(0,n-Date.now())}function $P(e){return e.endsWith("/")?e:e+"/"}function wP(e){return new Promise(t=>setTimeout(t,e))}var yo=class{#e;#n;#r;#t=[];#i=Promise.resolve();#a=null;constructor(t,n=[]){this.#e=Math.max(0,t),this.#n=n,this.#r=n.reduce((o,r)=>Math.max(o,r.windowMs),0)}acquire(){let t=this.#i,n;return this.#i=new Promise(o=>{n=o}),t.then(async()=>{let o=this.#s();o>0&&await zP(o);let r=Date.now();this.#a=r,this.#c(r),n()})}#s(){let t=Date.now(),n=this.#a!==null?this.#a+this.#e:0;for(let o of this.#n){if(this.#t.length<o.limit)continue;let r=this.#t[this.#t.length-o.limit];n=Math.max(n,r+o.windowMs)}return Math.max(0,n-t)}#c(t){this.#t.push(t);let n=t-this.#r,o=0;for(;o<this.#t.length&&this.#t[o]<=n;)o+=1;o>0&&this.#t.splice(0,o)}};function zP(e){return new Promise(t=>setTimeout(t,e))}var bo=class{#e;#n;#r=new Map;#t=new Map;constructor(t,n=500){this.#e=t,this.#n=n}get(t){let n=this.#r.get(t);if(n)return n.expires>Date.now()?n.value:void 0}getStale(t){return this.#r.get(t)?.value}set(t,n){if(!(this.#e<=0)){if(!this.#r.has(t)&&this.#r.size>=this.#n){let o=this.#r.keys().next().value;o!==void 0&&this.#r.delete(o)}this.#r.set(t,{value:n,expires:Date.now()+this.#e})}}async wrap(t,n){let o=this.get(t);return o!==void 0?o:this.#i(t,n)}async wrapStaleOnError(t,n){let o=this.get(t);if(o!==void 0)return o;try{return await this.#i(t,n)}catch(r){let i=this.getStale(t);if(i!==void 0)return i;throw r}}#i(t,n){let o=this.#t.get(t);if(o)return o;let r=n().then(i=>(this.set(t,i),i)).finally(()=>this.#t.delete(t));return this.#t.set(t,r),r}};var vt=m.object({found:m.literal(!1),reason:m.string()}).strict();function tr(e,...t){return m.union([e,...t])}var So=m.object({found:m.literal(!1),reason:m.string(),total:m.literal(0),items:m.array(m.never())}).strict(),Iv=m.object({found:m.literal(!1),reason:m.string(),total:m.literal(0),games:m.array(m.never())}).strict();function xt(e){return vt.parse({found:!1,reason:e})}var un="Profile or game-details are private. Ask the owner to set Steam \u2192 Privacy \u2192 Game details = Public, or this data can't be read.";function Pv(e){return(e??[]).map(t=>t.description??t.name).filter(t=>!!t)}function Ot(e){return typeof e=="number"?Math.round(e/60*10)/10:null}function ma(e){return e&&e.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim()||null}function pa(e,t){if(typeof e!="number")return null;let n=(e/100).toFixed(2);return t?`${n} ${t}`:n}function jt(e){return e?new Date(e*1e3).toISOString().slice(0,10):null}function $$(e){return e?new Date(e*1e3).toISOString().replace(/\.\d{3}Z$/,"Z"):null}function rr(e){return typeof e=="number"?`https://store.steampowered.com/app/${e}`:null}function dt(e,t){return{included:e.slice(0,t),returned:Math.min(e.length,t)}}var Tv=m.object({currency:m.string().nullable(),final:m.string().nullable(),initial:m.string().nullable(),discount_percent:m.number()}).strict(),RP=m.union([m.object({is_free:m.literal(!0)}).strict(),Tv.extend({is_free:m.literal(!1)})]).nullable(),kP=Tv.nullable(),Du=m.object({total:m.number(),results:m.array(m.object({appid:m.number().optional(),name:m.string().optional(),type:m.string().nullable(),price:kP,metascore:m.string().nullable(),platforms:m.array(m.string()),store_url:m.string().nullable()}).strict())}).strict(),Uu=m.object({appid:m.number().optional(),name:m.string().optional(),type:m.string().nullable(),short_description:m.string().nullable(),is_free:m.boolean(),price:RP,release_date:m.string().nullable(),coming_soon:m.boolean(),developers:m.array(m.string()),publishers:m.array(m.string()),genres:m.array(m.string()),categories:m.array(m.string()),platforms:m.array(m.string()),metacritic:m.number().nullable(),metacritic_url:m.string().nullable(),recommendations:m.number().nullable(),required_age:m.union([m.number(),m.string()]).nullable(),controller_support:m.string().nullable(),achievements_total:m.number().nullable(),achievements_highlighted:m.array(m.string()),supported_languages:m.string().nullable(),dlc:m.array(m.number()),demos:m.array(m.number()),content_descriptors:m.object({ids:m.array(m.number()),notes:m.string().nullable()}).strict(),base_game:m.object({appid:m.number(),name:m.string().nullable()}).strict().nullable(),drm_notice:m.string().nullable(),account_notice:m.string().nullable(),pc_requirements_min:m.string().nullable(),website:m.string().nullable(),header_image:m.string().nullable(),store_url:m.string().nullable()}).strict(),Lu=m.object({summary:m.string().nullable(),total_reviews:m.number().nullable(),total_positive:m.number().nullable(),total_negative:m.number().nullable(),positive_pct:m.number().nullable(),reviews:m.array(m.object({voted_up:m.boolean().nullable(),votes_up:m.number(),author_playtime_hours:m.number().nullable(),text:m.string().nullable()}).strict())}).strict(),Fu=m.object({count:m.number(),prices:m.array(m.union([m.object({appid:m.number(),available:m.literal(!1)}).strict(),m.object({appid:m.number(),available:m.literal(!0),is_free:m.literal(!0)}).strict(),Tv.extend({appid:m.number(),available:m.literal(!0),is_free:m.literal(!1)})]))}).strict(),fa=m.object({appid:m.number().optional(),name:m.string().optional(),discounted:m.boolean(),discount_percent:m.number(),original_price:m.string().nullable(),final_price:m.string().nullable(),store_url:m.string().nullable()}).strict(),Vu=m.object({specials:m.array(fa)}).strict(),Zu=m.object({specials:m.array(fa),top_sellers:m.array(fa),new_releases:m.array(fa),coming_soon:m.array(fa)}).strict(),w$=m.object({date:m.string().nullable(),up:m.number(),down:m.number(),positive_pct:m.number().nullable()}).strict(),Gu=m.object({rollup_type:m.string().nullable().describe("Granularity of each `history` entry's date bucket, e.g. 'week' or 'month' \u2014 chosen server-side by Steam and passed through as a free-form string (not validated or enumerated here), so don't assume a fixed set of possible values."),history:m.array(w$),recent:m.array(w$)}).strict();function R$(e){return{currency:e.currency??null,final:e.final_formatted??null,initial:e.initial_formatted||e.final_formatted||null,discount_percent:e.discount_percent??0}}function IP(e,t){return t?{is_free:!0}:e?{is_free:!1,...R$(e)}:null}function k$(e){return e?Object.entries(e).filter(([,t])=>t).map(([t])=>t):[]}function I$(e){let t=Array.isArray(e.pc_requirements)?void 0:e.pc_requirements;return Uu.parse({appid:e.steam_appid,name:e.name,type:e.type??null,short_description:e.short_description||null,is_free:e.is_free??!1,price:IP(e.price_overview,e.is_free),release_date:e.release_date?.date||null,coming_soon:e.release_date?.coming_soon??!1,developers:e.developers??[],publishers:e.publishers??[],genres:Pv(e.genres),categories:Pv(e.categories),platforms:k$(e.platforms),metacritic:e.metacritic?.score??null,metacritic_url:e.metacritic?.url??null,recommendations:e.recommendations?.total??null,required_age:e.required_age??null,controller_support:e.controller_support??null,achievements_total:e.achievements?.total??null,achievements_highlighted:(e.achievements?.highlighted??[]).map(n=>n.name).filter(n=>!!n),supported_languages:ma(e.supported_languages),dlc:e.dlc??[],demos:(e.demos??[]).map(n=>n.appid).filter(n=>typeof n=="number"),content_descriptors:{ids:e.content_descriptors?.ids??[],notes:e.content_descriptors?.notes??null},base_game:e.fullgame?.appid?{appid:Number(e.fullgame.appid),name:e.fullgame.name??null}:null,drm_notice:e.drm_notice||null,account_notice:e.ext_user_account_notice||null,pc_requirements_min:ma(t?.minimum),website:e.website||null,header_image:e.header_image||null,store_url:rr(e.steam_appid)})}function PP(e){if(!e||typeof e.final!="number")return null;let t=e.initial&&e.final&&e.initial>e.final?Math.round((1-e.final/e.initial)*100):0;return{currency:e.currency??null,final:pa(e.final,e.currency),initial:pa(e.initial,e.currency),discount_percent:t}}function P$(e){return Du.parse({total:e.total??e.items?.length??0,results:(e.items??[]).map(t=>({appid:t.id,name:t.name,type:t.type??null,price:PP(t.price),metascore:t.metascore||null,platforms:k$(t.platforms),store_url:rr(t.id)}))})}function T$(e,t){let n=t.map(o=>{let r=e[String(o)],i=r?.data,a=i&&!Array.isArray(i)?i.price_overview:void 0;return r?.success?a?{appid:o,available:!0,is_free:!1,...R$(a)}:{appid:o,available:!0,is_free:!0}:{appid:o,available:!1}});return Fu.parse({count:n.length,prices:n})}function E$(e,t=5){let n=e.query_summary??{};return Lu.parse({summary:n.review_score_desc??null,total_reviews:n.total_reviews??null,total_positive:n.total_positive??null,total_negative:n.total_negative??null,positive_pct:n.total_reviews&&n.total_positive?Math.round(n.total_positive/n.total_reviews*100):null,reviews:(e.reviews??[]).slice(0,t).map(o=>({voted_up:o.voted_up??null,votes_up:o.votes_up??0,author_playtime_hours:Ot(o.author?.playtime_forever),text:o.review?o.review.length>600?o.review.slice(0,600)+"\u2026":o.review:null}))})}function ha(e){let t=new Set,n=[];for(let o of e??[]){if(o.id!==void 0){if(t.has(o.id))continue;t.add(o.id)}n.push({appid:o.id,name:o.name,discounted:o.discounted??!1,discount_percent:o.discount_percent??0,original_price:pa(o.original_price,o.currency),final_price:pa(o.final_price,o.currency),store_url:rr(o.id)})}return n}function x$(e){return Zu.parse({specials:ha(e.specials?.items),top_sellers:ha(e.top_sellers?.items),new_releases:ha(e.new_releases?.items),coming_soon:ha(e.coming_soon?.items)})}function O$(e){return Vu.parse({specials:ha(e.specials?.items)})}function z$(e){let t=e.recommendations_up??0,n=e.recommendations_down??0,o=t+n;return{date:jt(e.date),up:t,down:n,positive_pct:o?Math.round(t/o*100):null}}function j$(e){let t=e.results??{};return Gu.parse({rollup_type:t.rollup_type??null,history:(t.rollups??[]).slice(-24).map(z$),recent:(t.recent??[]).slice(-30).map(z$)})}var Ju=class{#e;#n;#r;#t;constructor(t,n){this.#r=t.country,this.#t=t.language;let o=new yo(t.storeMinIntervalMs);this.#e=new _o({baseUrl:t.steamStoreBaseUrl,logger:n,timeoutMs:t.httpTimeoutMs,retries:t.httpRetries,beforeRequest:()=>o.acquire(),hasCredentials:!1}),this.#n=new bo(t.cacheTtlMs)}#i(t,n,o){return this.#e.getJson("api/storesearch/",{query:{term:t,l:o??this.#t,cc:n??this.#r}})}async searchGames(t,n,o){return P$(await this.#i(t,n,o))}async resolveAppId(t,n,o){return(await this.#i(t,n,o)).items?.find(i=>typeof i.id=="number")?.id??null}async getGame(t,n,o){let r=n??this.#r,i=o??this.#t;return this.#n.wrapStaleOnError(`app:${t}:${r}:${i}`,async()=>{let s=(await this.#e.getJson("api/appdetails",{query:{appids:t,cc:r,l:i}}))[String(t)];if(!s?.success||!s.data)throw new Re({code:"not_found",message:`No Steam app with id ${t}`});return I$(s.data)})}async getReviews(t,n,o="all",r="all"){let i=await this.#e.getJson(`appreviews/${t}`,{query:{json:1,num_per_page:n,language:o,review_type:r,purchase_type:"all"}});return E$(i,n)}async getPrices(t,n){let o=n??this.#r,r=100,i={};for(let a=0;a<t.length;a+=r){let s=t.slice(a,a+r),c=await this.#e.getJson("api/appdetails",{query:{appids:s.join(","),cc:o,filters:"price_overview"}});Object.assign(i,c)}return T$(i,t)}async getReviewHistogram(t){return this.#n.wrapStaleOnError(`hist:${t}:${this.#t}`,async()=>{let n=await this.#e.getJson(`appreviewhistogram/${t}`,{query:{l:this.#t}});return j$(n)})}#a(t,n){return this.#n.wrapStaleOnError(`featured:${t}:${n}`,()=>this.#e.getJson("api/featuredcategories",{query:{cc:t,l:n}}))}async getFeatured(t,n){return x$(await this.#a(t??this.#r,n??this.#t))}async getSpecials(t,n){return O$(await this.#a(t??this.#r,n??this.#t))}};function Hu(e){return{content:[{type:"text",text:JSON.stringify(e)}],structuredContent:e}}function Nr(e){return{content:[{type:"text",text:e}],isError:!0}}function N$(e){return Nr(xv(e))}function Ev(e){return e.unsafeDetail?".":`: ${e.message}`}function xv(e){switch(e.code){case"unauthorized":return e.hadCredentials===!1?"The upstream service rejected the request (401), but this tool sends no credentials at all, so this isn't a credentials problem \u2014 retry, or check for an upstream outage.":"The upstream service rejected the credentials (401). They may be missing or expired \u2014 check the configured API key / token.";case"forbidden":return e.hadCredentials===!1?"The upstream service denied access (403), but this tool sends no credentials at all, so this isn't a credentials problem \u2014 it's more likely an unrelated upstream security block (e.g. a request that resembles an injection attempt). Try different input.":e.hadCredentials===!0?"The upstream service denied access (403). The configured credentials are likely invalid, expired, or lack permission for this request.":"The upstream service denied access (403). This can be a genuine credentials/permission issue, but many of this server's tools call it without any credentials at all \u2014 a 403 there is more likely an unrelated upstream security block (e.g. a request that resembles an injection attempt). Try different input first, and only suspect the configured API key if this tool actually requires one.";case"not_found":return`No matching resource was found (404)${Ev(e)}`;case"not_modified":return"The content has not changed since the last request (304).";case"rate_limited":return"Upstream rate limit hit (429). Please retry in a few seconds.";case"server_error":return"The upstream service returned an error (5xx). Please retry later.";case"network":return"Could not reach the upstream service (network error). Check connectivity and retry.";case"timeout":return"The upstream request timed out. Please retry.";case"bad_request":return`The request was rejected as invalid${Ev(e)}`;default:return`Unexpected error talking to the upstream service${Ev(e)}`}}var ga=m.union([m.object({found:m.literal(!1)}).strict(),m.object({found:m.literal(!0),steamid:m.string().optional(),name:m.string().nullable(),real_name:m.string().nullable(),state:m.string(),visibility:m.enum(["public","private"]),country:m.string().nullable(),level:m.number().nullable(),created:m.string().nullable(),in_game:m.string().nullable(),profile_url:m.string().nullable(),avatar:m.string().nullable()}).strict()]),C$=m.object({appid:m.number().optional(),name:m.string().nullable(),playtime_hours:m.number().nullable(),playtime_2weeks_hours:m.number().nullable()}).strict(),va=m.union([m.object({found:m.literal(!1),reason:m.string(),game_count:m.null(),games:m.array(m.never()),owns:m.array(m.object({appid:m.number(),owned:m.literal(!1)}).strict()).optional()}).strict(),m.object({found:m.literal(!0),game_count:m.number(),returned:m.number(),games:m.array(C$),owns:m.array(m.object({appid:m.number(),owned:m.boolean(),playtime_hours:m.number().nullable()}).strict()).optional()}).strict()]),Bu=m.object({found:m.literal(!0),shared_count:m.number(),returned:m.number(),games:m.array(m.object({appid:m.number().optional(),name:m.string().nullable(),playtime_hours_a:m.number().nullable(),playtime_hours_b:m.number().nullable()}).strict())}).strict(),_a=m.union([Iv,m.object({found:m.literal(!0),total:m.number(),games:m.array(C$)}).strict()]),Ku=m.object({found:m.literal(!0),game:m.string().nullable(),total:m.number(),unlocked:m.number(),completion_pct:m.number().nullable(),returned:m.number(),achievements:m.array(m.object({name:m.string().optional(),achieved:m.boolean(),unlocked_at:m.string().nullable()}).strict())}).strict(),Wu=m.object({count:m.number(),returned:m.number(),achievements:m.array(m.object({name:m.string().optional(),percent:m.number().nullable()}).strict())}).strict(),Yu=m.object({game:m.string().nullable(),total:m.number(),returned:m.number(),achievements:m.array(m.object({api_name:m.string().optional(),name:m.string().nullable(),description:m.string().nullable(),hidden:m.boolean(),global_unlock_pct:m.number().nullable()}).strict())}).strict(),Xu=m.object({items:m.array(m.object({title:m.string().nullable(),date:m.string().nullable(),author:m.string().nullable(),feed:m.string().nullable(),excerpt:m.string().nullable(),url:m.string().nullable()}).strict())}).strict(),Qu=m.object({found:m.literal(!0),steamid:m.string()}).strict(),ed=m.object({appid:m.number(),player_count:m.number().nullable()}).strict(),td=m.object({found:m.literal(!0),total:m.number(),returned:m.number(),items:m.array(m.object({appid:m.number().optional(),store_url:m.string().nullable(),priority:m.number().nullable(),added:m.string().nullable()}).strict())}).strict(),ya=m.union([m.object({found:m.literal(!1)}).strict(),m.object({found:m.literal(!0),steamid:m.string().optional(),vac_banned:m.boolean(),vac_ban_count:m.number(),game_ban_count:m.number(),community_banned:m.boolean(),economy_ban:m.string().nullable(),days_since_last_ban:m.number().nullable()}).strict()]),ba=m.union([Iv,m.object({found:m.literal(!0),total:m.number(),returned:m.number(),games:m.array(m.object({appid:m.number(),store_url:m.string().nullable()}).strict())}).strict()]),Sa=m.object({found:m.literal(!0),total:m.number(),returned:m.number(),friends:m.array(m.object({steamid:m.string().optional(),name:m.string().nullable(),state:m.string(),in_game:m.string().nullable(),profile_url:m.string().nullable(),friends_since:m.string().nullable()}).strict())}).strict(),Ov=m.object({steamid:m.string(),name:m.string().nullable()}).strict(),rd=m.object({found:m.literal(!0),total_friends:m.number(),matches:m.array(m.object({appid:m.number(),owners:m.array(Ov.extend({playtime_hours:m.number().nullable()})),owners_total:m.number().optional()}).strict()),private_friends:m.array(Ov),private_friends_total:m.number().optional(),unavailable_friends:m.array(Ov.extend({reason:m.string()})),unavailable_friends_total:m.number().optional()}).strict();var A$=["offline","online","busy","away","snooze","looking to trade","looking to play"];function M$(e,t){let n=e.response?.players?.[0];return n?ga.parse({found:!0,steamid:n.steamid,name:n.personaname??null,real_name:n.realname||null,state:A$[n.personastate??0]??"offline",visibility:n.communityvisibilitystate===3?"public":"private",country:n.loccountrycode||null,level:t??null,created:jt(n.timecreated),in_game:n.gameextrainfo||null,profile_url:n.profileurl??null,avatar:n.avatarfull??null}):ga.parse({found:!1})}function nd(e){return e.response?.game_count===void 0&&e.response?.games===void 0}function q$(e,t={}){if(nd(e))return va.parse({found:!1,reason:un,game_count:null,games:[]});let n=e.response?.games??[],o=n.slice().sort((c,l)=>(l.playtime_forever??0)-(c.playtime_forever??0)),r=t.max??50,i=new Map(n.filter(c=>typeof c.appid=="number").map(c=>[c.appid,c])),{included:a,returned:s}=dt(o,r);return va.parse({found:!0,game_count:e.response?.game_count??o.length,returned:s,games:a.map(c=>({appid:c.appid,name:c.name??null,playtime_hours:Ot(c.playtime_forever),playtime_2weeks_hours:Ot(c.playtime_2weeks)})),...t.checkAppids&&{owns:t.checkAppids.map(c=>{let l=i.get(c);return{appid:c,owned:l!==void 0,playtime_hours:l?Ot(l.playtime_forever):null}})}})}var TP="One or both profiles/game-details are private. Ask the owner(s) to set Steam \u2192 Privacy \u2192 Game details = Public.";function D$(e,t,n=50){if(nd(e)||nd(t))return vt.parse({found:!1,reason:TP});let o=new Map((e.response?.games??[]).map(c=>[c.appid,c])),r=new Map((t.response?.games??[]).map(c=>[c.appid,c])),i=[...o.keys()].filter(c=>typeof c=="number"&&r.has(c)).map(c=>{let l=o.get(c),u=r.get(c);return{appid:c,name:l.name??u.name??null,playtime_hours_a:Ot(l.playtime_forever),playtime_hours_b:Ot(u.playtime_forever)}}).sort((c,l)=>(l.playtime_hours_a??0)+(l.playtime_hours_b??0)-((c.playtime_hours_a??0)+(c.playtime_hours_b??0))),{included:a,returned:s}=dt(i,n);return Bu.parse({found:!0,shared_count:i.length,returned:s,games:a})}function U$(e){return nd(e)?_a.parse({found:!1,reason:un,total:0,games:[]}):_a.parse({found:!0,total:e.response?.game_count??e.response?.games?.length??0,games:(e.response?.games??[]).map(t=>({appid:t.appid,name:t.name??null,playtime_2weeks_hours:Ot(t.playtime_2weeks),playtime_hours:Ot(t.playtime_forever)}))})}var Cr=200;function L$(e,t=Cr){let n=e.playerstats;if(!n?.success)return vt.parse({found:!1,reason:n?.error??"No achievement stats"});let o=n.achievements??[],r=o.filter(s=>s.achieved===1),{included:i,returned:a}=dt([...r,...o.filter(s=>s.achieved!==1)],t);return Ku.parse({found:!0,game:n.gameName??null,total:o.length,unlocked:r.length,completion_pct:o.length?Math.round(r.length/o.length*100):null,returned:a,achievements:i.map(s=>({name:s.name||s.apiname,achieved:s.achieved===1,unlocked_at:s.achieved===1?jt(s.unlocktime):null}))})}function jv(e,t=Cr){let n=e.achievementpercentages?.achievements??[],{included:o,returned:r}=dt(n,t);return Wu.parse({count:n.length,returned:r,achievements:o.map(i=>({name:i.name,percent:typeof i.percent=="string"?Number(i.percent):i.percent??null}))})}function Nv(e,t,n=Cr){let o=new Map;for(let s of t.achievementpercentages?.achievements??[])s.name!=null&&o.set(s.name,typeof s.percent=="string"?Number(s.percent):s.percent??0);let r=e.game?.availableGameStats?.achievements??[],{included:i,returned:a}=dt(r,n);return Yu.parse({game:e.game?.gameName??null,total:r.length,returned:a,achievements:i.map(s=>{let c=s.name!=null?o.get(s.name):void 0;return{api_name:s.name,name:s.displayName||s.name||null,description:s.description||null,hidden:s.hidden===1,global_unlock_pct:typeof c=="number"?Math.round(c*10)/10:null}})})}function F$(e){return Xu.parse({items:(e.appnews?.newsitems??[]).map(t=>({title:t.title??null,date:jt(t.date),author:t.author||null,feed:t.feedlabel||null,excerpt:ma(t.contents),url:t.url??null}))})}function V$(e){let t=e.response;return t?.success===1&&t.steamid?Qu.parse({found:!0,steamid:t.steamid}):vt.parse({found:!1,reason:t?.message??"No match for that vanity name"})}function Z$(e,t){return ed.parse({appid:t,player_count:e.response?.player_count??null})}function G$(e,t=100){let n=e.response?.items??[];if(n.length===0)return So.parse({found:!1,reason:"Empty wishlist, or the profile/wishlist is private.",total:0,items:[]});let o=n.toSorted((a,s)=>(a.priority??1e9)-(s.priority??1e9)),{included:r,returned:i}=dt(o,t);return td.parse({found:!0,total:n.length,returned:i,items:r.map(a=>({appid:a.appid,store_url:rr(a.appid),priority:a.priority??null,added:jt(a.date_added)}))})}function J$(e){let t=e.players?.[0];return t?ya.parse({found:!0,steamid:t.SteamId,vac_banned:t.VACBanned??!1,vac_ban_count:t.NumberOfVACBans??0,game_ban_count:t.NumberOfGameBans??0,community_banned:t.CommunityBanned??!1,economy_ban:t.EconomyBan&&t.EconomyBan!=="none"?t.EconomyBan:null,days_since_last_ban:t.DaysSinceLastBan??null}):ya.parse({found:!1})}var EP=200;function H$(e,t,n=EP){let o=e.response?.appids??[];if(o.length===0)return ba.parse({found:!1,reason:"No followed games, or the profile is private.",total:0,games:[]});let{included:r,returned:i}=dt(o,n);return ba.parse({found:!0,total:t.response?.followed_game_count??o.length,returned:i,games:r.map(a=>({appid:a,store_url:rr(a)}))})}function B$(e,t,n=100){let o=e.friendslist?.friends??[];if(o.length===0)return Sa.parse({found:!0,total:0,returned:0,friends:[]});let r=new Map;for(let c of t.response?.players??[])c.steamid&&r.set(c.steamid,c);let i=o.toSorted((c,l)=>(l.friend_since??0)-(c.friend_since??0)),{included:a,returned:s}=dt(i,n);return Sa.parse({found:!0,total:o.length,returned:s,friends:a.map(c=>{let l=c.steamid?r.get(c.steamid):void 0;return{steamid:c.steamid,name:l?.personaname??null,state:A$[l?.personastate??0]??"offline",in_game:l?.gameextrainfo||null,profile_url:l?.profileurl??null,friends_since:jt(c.friend_since)}})})}function Cv(e,t,n,o,r=100){let i=new Map;for(let f of o.response?.players??[])f.steamid&&i.set(f.steamid,f);let a=f=>({steamid:f,name:i.get(f)?.personaname??null}),s=new Map(e.map(f=>[f,[]])),c=[],l=[];t.forEach((f,b)=>{let g=n[b];if(g===null){c.push(a(f));return}if(!(g instanceof Map)){l.push({...a(f),reason:g?.error??"no data returned"});return}for(let S of e)g.has(S)&&s.get(S).push({...a(f),playtime_hours:Ot(g.get(S))})});let u=dt(c,r),p=dt(l,r);return rd.parse({found:!0,total_friends:t.length,matches:e.map(f=>{let b=s.get(f)??[],{included:g,returned:S}=dt(b,r);return{appid:f,owners:g,...S<b.length&&{owners_total:b.length}}}),private_friends:u.included,...u.returned<c.length&&{private_friends_total:c.length},unavailable_friends:p.included,...p.returned<l.length&&{unavailable_friends_total:l.length}})}var od=m.enum(["unknown","unsupported","playable","verified"]),K$=m.object({appid:m.number(),name:m.string().nullable(),store_url:m.string().nullable(),review_percent:m.number().nullable(),review_count:m.number().nullable(),review_label:m.string().nullable(),platforms:m.array(m.string()),steam_deck:od,steam_os:od,steam_machine:od,steam_frame:od,vr_support:m.enum(["none","supported","required"]),tags:m.array(m.string()),release_date:m.string().nullable()}).strict(),Av=K$.extend({discount_pct:m.number(),discount_end:m.string().nullable(),original:m.string().nullable(),price:m.string().nullable()}),id=m.object({count:m.number(),items:m.array(m.union([m.object({appid:m.number(),available:m.literal(!1)}).strict(),K$.extend({is_free:m.boolean(),price:m.union([m.object({discount_pct:m.number(),discount_end:m.string().nullable(),final:m.string().nullable(),original:m.string().nullable()}).strict(),m.object({is_free:m.literal(!0)}).strict()]).nullable(),coming_soon:m.boolean()})]))}).strict(),ad=m.object({total_matching:m.number().nullable().describe("Count from whichever filters Steam actually applies server-side \u2014 min_discount, and (if released_after/released_within_days was set) excluding not-yet-released games \u2014 or the whole catalog's size if neither was given. NOT the number of games matching tags/platform/compat/review/the exact release-date cutoff, which have no server-side filter and this tool applies only over the scanned `count`-sized window below. Don't read this as 'N games match all my filters' \u2014 use `returned` for that instead."),returned:m.number().describe("How many results survived every filter, out of the scanned window (see `count`)."),deals:m.array(Av)}).strict(),sd=m.object({found:m.literal(!0),total:m.number().describe("The player's full wishlist size, including entries Steam never sent store data for (see `enriched`)."),enriched:m.number().describe("How many of `total` Steam actually attached store data to (it caps around the first 100) \u2014 every filter below only runs over these, never the full `total`."),note:m.string().optional(),matched:m.number().describe("How many of the enriched items satisfied the filters, BEFORE the display cap \u2014 a big gap between this and `returned` means results were capped, not that fewer items matched."),returned:m.number().describe("How many items are actually in `items` below, after the display cap."),items:m.array(Av.extend({priority:m.number().nullable(),added:m.string().nullable()}))}).strict(),cd=m.object({found:m.literal(!0),based_on_tags:m.array(m.string()),count:m.number(),recommendations:m.array(Av.extend({matched_tags:m.array(m.string()),match_score:m.number().describe("An internal ranking weight (playtime-on-matched-tags, discounted by review score) \u2014 not a percentage or 0-100 scale. Only meaningful relative to the other scores in this same response, to explain why one pick outranks another.")}))}).strict();function W$(e){return e.related_items?.parent_appid===void 0}function Y$(e){let t={};for(let n of e.response?.tags??[])typeof n.tagid=="number"&&n.name&&(t[n.tagid]=n.name);return t}var xP=8;function Mv(e,t){return!e||!t?[]:e.slice().sort((n,o)=>(o.weight??0)-(n.weight??0)).map(n=>n.tagid!==void 0?t[n.tagid]:void 0).filter(n=>!!n).slice(0,xP)}function X$(e,t){return new Set((e??[]).map(n=>n.tagid!==void 0?t?.[n.tagid]:void 0).filter(n=>!!n).map(n=>n.toLowerCase()))}function OP(e,t,n){let o=X$(e,t);return n.every(r=>o.has(r))}function jP(e,t,n){let o=X$(e,t);return n.some(r=>o.has(r))}var NP={0:"unknown",1:"unsupported",2:"playable",3:"verified"};function ld(e){return NP[e??0]??"unknown"}function CP(e){let t=e?.vr_support;return t?.vrhmd?t.vrhmd_only?"required":"supported":"none"}var AP={verified:3,playable:2},MP={windows:"windows",mac:"mac",linux:"steamos_linux"};function qP(e){if(!e)return[];let t=[];return e.windows&&t.push("windows"),e.mac&&t.push("mac"),e.steamos_linux&&t.push("linux"),t}function DP(e){let t=(e?.active_discounts??[]).map(n=>n.discount_end_date).filter(n=>typeof n=="number"&&n>0);return t.length?$$(Math.min(...t)):null}function Q$(e){return{discount_pct:e?.discount_pct??0,discount_end:DP(e),final:e?.formatted_final_price||null,original:e?.formatted_original_price||e?.formatted_final_price||null}}function ew(e,t){let n=e.reviews?.summary_filtered;return{appid:e.appid,name:e.name??null,store_url:rr(e.appid),review_percent:n?.percent_positive??null,review_count:n?.review_count??null,review_label:n?.review_score_label??null,platforms:qP(e.platforms),steam_deck:ld(e.platforms?.steam_deck_compat_category),steam_os:ld(e.platforms?.steam_os_compat_category),steam_machine:ld(e.platforms?.steam_machine_compat_category),steam_frame:ld(e.platforms?.steam_frame_compat_category),vr_support:CP(e.platforms),tags:Mv(e.tags,t),release_date:jt(e.release?.steam_release_date)}}function qv(e,t){let{final:n,...o}=Q$(e.best_purchase_option);return{...ew(e,t),...o,price:n}}var UP=[["steamDeck","steam_deck_compat_category"],["steamOs","steam_os_compat_category"],["steamMachine","steam_machine_compat_category"],["steamFrame","steam_frame_compat_category"]];function tw(e){let t=UP.map(([r,i])=>{let a=e[r];return[i,a?AP[a]:void 0]}),n=e.platform?MP[e.platform]:void 0,o=e.tags?.length?e.tags.map(r=>r.toLowerCase()):void 0;return r=>{let i=r.platforms;for(let[c,l]of t)if(l!==void 0&&(i?.[c]??0)<l)return!1;if(n&&!i?.[n]||e.releasedAfter!==void 0&&(r.release?.steam_release_date??0)<e.releasedAfter||o&&!OP(r.tags,e.tagMap,o))return!1;let a=r.reviews?.summary_filtered;if(typeof e.minReview=="number"&&(a?.percent_positive??-1)<e.minReview||typeof e.minReviews=="number"&&(a?.review_count??0)<e.minReviews)return!1;let s=r.best_purchase_option?.discount_pct??0;if(typeof e.minDiscount=="number"){if(s<e.minDiscount)return!1}else if(e.onSaleOnly&&s<=0)return!1;return!0}}function rw(e,t){let n=tw(t),o=(e.response?.store_items??[]).filter(r=>r.visible!==!1&&typeof r.appid=="number"&&W$(r)&&n(r)).map(r=>qv(r,t.tagMap)).sort((r,i)=>i.discount_pct-r.discount_pct);return ad.parse({total_matching:e.response?.metadata?.total_matching_records??null,returned:o.length,deals:o})}function nw(e,t,n){let o=new Map;for(let r of e.response?.store_items??[])typeof r.appid=="number"&&o.set(r.appid,{...r,appid:r.appid});return id.parse({count:t.length,items:t.map(r=>{let i=o.get(r);if(!i||!i.name&&!i.best_purchase_option&&!i.reviews&&!i.is_free)return{appid:r,available:!1};let a=i.best_purchase_option;return{...ew(i,n),is_free:i.is_free??!1,price:a?Q$(a):i.is_free?{is_free:!0}:null,coming_soon:i.release?.is_coming_soon??!1}})})}var LP=60;function ow(e,t,n={}){let o=e.response?.items??[];if(o.length===0)return So.parse({found:!1,reason:"Empty wishlist, or the profile/wishlist is private.",total:0,items:[]});let r=o.filter(u=>u.store_item!==void 0),i=tw({...n,tagMap:t}),a=r.filter(u=>typeof u.store_item.appid=="number"&&i(u.store_item)).map(u=>({...qv(u.store_item,t),priority:u.priority??null,added:jt(u.date_added)})),s=n.onSaleOnly||typeof n.minDiscount=="number";a.sort((u,p)=>s?p.discount_pct-u.discount_pct:(u.priority??1e9)-(p.priority??1e9));let{included:c,returned:l}=dt(a,LP);return sd.parse({found:!0,total:o.length,enriched:r.length,note:r.length<o.length?`Steam only returned store data for ${r.length} of ${o.length} wishlist items; filters/matches only cover those ${r.length} \u2014 the rest have no price, reviews or tags to check.`:void 0,matched:a.length,returned:l,items:c})}function iw(e,t,n){let o=new Map;for(let r of e){if(typeof r.appid!="number")continue;let i=(t.get(r.appid)??0)/60;if(!(i<=0))for(let a of Mv(r.tags,n))o.set(a,(o.get(a)??0)+i)}return o}function aw(e,t,n,o,r,i,a=[]){let s=a.map(l=>l.toLowerCase()),c=e.filter(l=>l.visible!==!1&&typeof l.appid=="number"&&W$(l)&&!n.has(l.appid)&&!(s.length&&jP(l.tags,o,s))).map(l=>{let p=Mv(l.tags,o).filter(S=>t.has(S)),f=p.reduce((S,_)=>S+(t.get(_)??0),0),b=l.reviews?.summary_filtered?.percent_positive,g=typeof b=="number"?b/100:1;return{it:l,matchedTags:p,matchScore:f*g}}).filter(l=>l.matchScore>0).sort((l,u)=>u.matchScore-l.matchScore).slice(0,r);return cd.parse({found:!0,based_on_tags:i,count:c.length,recommendations:c.map(({it:l,matchedTags:u,matchScore:p})=>({...qv(l,o),matched_tags:u,match_score:Math.round(p*10)/10}))})}var $a=e=>({include_basic_info:!0,include_reviews:!0,include_release:!0,include_platforms:!0,include_tag_count:e}),FP=30,VP=6,ZP=300,ud=class{#e;#n;#r;#t;constructor(t){this.#e=t.get,this.#n=t.cache,this.#r=t.language,this.#t=t.country}async#i(t){try{return await this.#n.wrapStaleOnError(`tags:${t}`,async()=>{let n=await this.#e("IStoreService/GetTagList/v1/",{language:t});return Y$(n)})}catch{return null}}#a(t,n){if(n!==null)return n;if(t?.length)throw new Re({code:"unknown",message:"could not fetch Steam's tag dictionary right now, so the `tags` filter can't be reliably applied. Retry, or drop `tags` to see unfiltered results.",retryable:!0})}async#s(t,n,o,r){let[i,a]=await Promise.all([this.#e(t,n),this.#i(o)]);return{res:i,tagMap:this.#a(r,a)}}async getItems(t,n,o){let r=o??this.#r,i={ids:t.map(c=>({appid:c})),context:{language:r,country_code:n??this.#t},data_request:$a(15)},{res:a,tagMap:s}=await this.#s("IStoreBrowseService/GetItems/v1/",{input_json:JSON.stringify(i)},r);return nw(a,t,s)}async getRecommendedGames(t,n={}){if(t.length===0)return xt("This player's library has no games to base recommendations on.");let o=n.language??this.#r,r=n.country??this.#t,i=await this.#i(o);if(i===null)throw new Re({code:"unknown",message:"could not fetch Steam's tag dictionary right now, so recommendations can't be computed. Retry shortly.",retryable:!0});let a=t.slice().sort((g,S)=>S.playtimeMinutes-g.playtimeMinutes).slice(0,FP),s=await this.#e("IStoreBrowseService/GetItems/v1/",{input_json:JSON.stringify({ids:a.map(g=>({appid:g.appid})),context:{language:o,country_code:r},data_request:$a(20)})}),c=iw(s.response?.store_items??[],new Map(a.map(g=>[g.appid,g.playtimeMinutes])),i);if(c.size===0)return xt("Not enough played games with resolvable tags to build recommendations.");let l=[...c.entries()].sort((g,S)=>S[1]-g[1]).slice(0,VP).map(([g])=>g),u=Math.min(Math.max(n.count??10,1),25),p={};typeof n.minDiscount=="number"&&(p.price_filters={min_discount_percent:n.minDiscount});let f=await this.#e("IStoreQueryService/Query/v1/",{input_json:JSON.stringify({query:{start:0,count:ZP,sort:10,filters:p},context:{language:o,country_code:r,steam_realm:1},data_request:$a(20)})}),b=new Set(t.map(g=>g.appid));return aw(f.response?.store_items??[],c,b,i,u,l,n.excludeTags)}async#c(t){let n=t.language??this.#r,o={};typeof t.minDiscount=="number"&&(o.price_filters={min_discount_percent:t.minDiscount}),t.releasedOnly&&(o.released_only=!0);let r={query:{start:t.start??0,count:t.count??50,sort:10,filters:o},context:{language:n,country_code:t.country??this.#t,steam_realm:1},data_request:$a(20)},{res:i,tagMap:a}=await this.#s("IStoreQueryService/Query/v1/",{input_json:JSON.stringify(r)},n,t.tags);return rw(i,{minReview:t.minReview,minReviews:t.minReviews,steamDeck:t.steamDeck,steamOs:t.steamOs,steamMachine:t.steamMachine,steamFrame:t.steamFrame,platform:t.platform,releasedAfter:t.releasedAfter,tags:t.tags,tagMap:a})}async discoverGames(t){return this.#c({...t,releasedOnly:t.releasedAfter!==void 0})}async getWishlistDetailed(t,n={}){let o=n.language??this.#r,r={steamid:t,context:{language:o,country_code:n.country??this.#t,steam_realm:1},data_request:$a(20),sort:0},i={onSaleOnly:n.onSaleOnly,tags:n.tags,minReview:n.minReview,minDiscount:n.minDiscount,platform:n.platform,steamDeck:n.steamDeck,steamOs:n.steamOs,steamMachine:n.steamMachine,steamFrame:n.steamFrame},{res:a,tagMap:s}=await er("bad_request",()=>this.#s("IWishlistService/GetWishlistSortedFiltered/v1/",{input_json:JSON.stringify(r)},o,n.tags),{res:{},tagMap:void 0});return ow(a,s,i)}};var sw="Profile or friends list is private. Ask the owner to set Steam \u2192 Privacy \u2192 Friends List = Public.";function cw(e){return(e.friendslist?.friends??[]).map(t=>t.steamid).filter(t=>!!t)}var dd=class{#e;#n;#r;#t;#i;#a;#s;#c;configured;constructor(t,n){this.#r=t.steamApiKey,this.#t=t.language,this.#i=t.country,this.#a=t.defaultSteamId,this.configured=!!t.steamApiKey;let o=new yo(t.apiMinIntervalMs);this.#e=new _o({baseUrl:t.steamApiBaseUrl,logger:n,timeoutMs:t.httpTimeoutMs,retries:t.httpRetries,beforeRequest:()=>o.acquire(),hasCredentials:this.configured}),this.#n=new bo(t.cacheTtlMs),this.#s=new ud({get:this.#o.bind(this),cache:this.#n,language:this.#t,country:this.#i})}#o(t,n){return this.#e.getJson(t,{query:{key:this.#r,...n}})}async requireSteamId(t){if(t)return t;let n=this.#a;if(!n)throw new Re({code:"bad_request",message:"no steamid was given and STEAM_ID is not set. Pass a 17-digit SteamID64, or set STEAM_ID (a SteamID64 or vanity name) in the server config."});if(/^\d{17}$/.test(n))return n;if(this.#c)return this.#c;if(!this.configured)throw new Re({code:"bad_request",message:`STEAM_ID is a vanity name ("${n}") which needs a Steam Web API key to resolve. Set STEAM_API_KEY, or set STEAM_ID to a 17-digit SteamID64 instead.`});let o=await this.#o("ISteamUser/ResolveVanityURL/v1/",{vanityurl:n}),r=o.response?.steamid;if(o.response?.success!==1||!r)throw new Re({code:"bad_request",message:`could not resolve the STEAM_ID vanity name "${n}" to a SteamID64.`});return this.#c=r,r}async getPlayerSummary(t){let[n,o]=await Promise.all([er("bad_request",()=>this.#o("ISteamUser/GetPlayerSummaries/v2/",{steamids:t}),{}),this.#p(t)]);return M$(n,o)}async#p(t){try{return(await this.#n.wrapStaleOnError(`level:${t}`,async()=>({level:(await this.#o("IPlayerService/GetSteamLevel/v1/",{steamid:t})).response?.player_level??null}))).level}catch{return null}}async getPlayerBans(t){let n=await er("bad_request",()=>this.#o("ISteamUser/GetPlayerBans/v1/",{steamids:t}),{});return J$(n)}#l(t,n){return er("bad_request",()=>this.#o("IPlayerService/GetOwnedGames/v1/",{steamid:t,...n}),{})}async getOwnedGames(t,n){let o=await this.#l(t,{include_appinfo:!0,include_played_free_games:!0});return q$(o,{checkAppids:n})}async getRecentlyPlayed(t){let n=await er("bad_request",()=>this.#o("IPlayerService/GetRecentlyPlayedGames/v1/",{steamid:t}),{});return U$(n)}async getRecommendedGames(t,n={}){let o=await this.#l(t,{include_appinfo:!1,include_played_free_games:!0});if(o.response?.games===void 0&&o.response?.game_count===void 0)return xt(un);let r=(o.response?.games??[]).filter(i=>typeof i.appid=="number").map(i=>({appid:i.appid,playtimeMinutes:i.playtime_forever??0}));return this.#s.getRecommendedGames(r,n)}async comparePlayers(t,n){let[o,r]=await Promise.all([this.#l(t,{include_appinfo:!0}),this.#l(n,{include_appinfo:!0})]);return D$(o,r)}async getPlayerAchievements(t,n,o){let r=o??this.#t;try{let i=await this.#o("ISteamUserStats/GetPlayerAchievements/v1/",{steamid:t,appid:n,l:r});return i.playerstats?.success?L$(i):this.#u(n,r,i.playerstats?.error)}catch(i){if(i instanceof Re&&(i.code==="forbidden"||i.code==="unauthorized"))return xt(un);if(i instanceof Re&&(i.code==="bad_request"||i.code==="not_found"))return this.#u(n,r);throw i}}async#u(t,n,o){if(o&&/not public|private/i.test(o))return xt(un);try{let i=((await this.#o("ISteamUserStats/GetSchemaForGame/v2/",{appid:t,l:n})).game?.availableGameStats?.achievements?.length??0)>0;return xt(i?"This game has achievements, but the player's data is hidden (private game-details, or they don't own it).":"This game has no achievements.")}catch{return xt(o||"Achievements unavailable.")}}async resolveVanityUrl(t){let n=await this.#o("ISteamUser/ResolveVanityURL/v1/",{vanityurl:t});return V$(n)}async#d(t){if(t.length===0)return{};let n=[];for(let i=0;i<t.length;i+=100)n.push(t.slice(i,i+100));return{response:{players:(await Promise.allSettled(n.map(i=>this.#o("ISteamUser/GetPlayerSummaries/v2/",{steamids:i.join(",")})))).flatMap(i=>i.status==="fulfilled"?i.value.response?.players??[]:[])}}}async#m(t){try{return await this.#o("ISteamUser/GetFriendList/v1/",{steamid:t,relationship:"friend"})}catch(n){if(n instanceof Re&&(n.code==="forbidden"||n.code==="unauthorized"||n.code==="bad_request"))return null;throw n}}async getFriendList(t){let n=await this.#m(t);return n===null?xt(sw):B$(n,await this.#d(cw(n)))}async findFriendsWhoOwn(t,n){let o=await this.#m(t);if(o===null)return xt(sw);let r=cw(o);if(r.length===0)return Cv(n,[],[],{});let[i,a]=await Promise.all([this.#d(r),Promise.allSettled(r.map(c=>this.#f(c,n)))]),s=a.map(c=>c.status==="fulfilled"?c.value:{error:c.reason instanceof Re?xv(c.reason):"An unexpected error occurred."});return Cv(n,r,s,i)}async#f(t,n){let o=await this.#l(t,{include_appinfo:!1});if(o.response?.games===void 0&&o.response?.game_count===void 0)return null;let r=new Set(n),i=new Map;for(let a of o.response?.games??[])typeof a.appid=="number"&&r.has(a.appid)&&i.set(a.appid,a.playtime_forever??0);return i}async getNews(t,n){let o=await this.#o("ISteamNews/GetNewsForApp/v2/",{appid:t,count:n,maxlength:400});return F$(o)}async getGlobalAchievements(t){return this.#n.wrapStaleOnError(`global-ach:${t}`,async()=>{try{let n=await this.#o("ISteamUserStats/GetGlobalAchievementPercentagesForApp/v2/",{gameid:t});return jv(n)}catch(n){if(n instanceof Re&&(n.code==="forbidden"||n.code==="bad_request"||n.code==="not_found"))return jv({});throw n}})}async getCurrentPlayers(t){let n;try{n=await this.#o("ISteamUserStats/GetNumberOfCurrentPlayers/v1/",{appid:t})}catch(o){throw o instanceof Re&&o.code==="not_found"?new Re({code:"not_found",message:`No Steam app with id ${t}`}):o}if(n.response?.result!==1)throw new Re({code:"not_found",message:`No Steam app with id ${t}`});return Z$(n,t)}get store(){return this.#s}async#h(t){let n=await er("bad_request",()=>this.#o("IWishlistService/GetWishlist/v1/",{steamid:t}),{});return G$(n)}async getFollowedGames(t){let[n,o]=await Promise.all([this.#g(t),this.#v(t)]);return H$(n,o)}#g(t){return er("bad_request",()=>this.#o("IStoreService/GetGamesFollowed/v1/",{steamid:t}),{})}async#v(t){try{return await this.#o("IStoreService/GetGamesFollowedCount/v1/",{steamid:t})}catch{return{}}}#_(t,n){return this.#s.getWishlistDetailed(t,n)}async getWishlist(t,n={}){let{includeDetails:o,onSaleOnly:r,...i}=n;return o||r||Object.values(i).some(s=>s!==void 0)?this.#_(t,{onSaleOnly:r,...i}):this.#h(t)}async getGameAchievements(t,n){let o=n??this.#t;return this.#n.wrapStaleOnError(`schema:${t}:${o}`,async()=>{let[r,i]=await Promise.allSettled([this.#o("ISteamUserStats/GetSchemaForGame/v2/",{appid:t,l:o}),this.#o("ISteamUserStats/GetGlobalAchievementPercentagesForApp/v2/",{gameid:t})]);if(r.status==="fulfilled"){let s=i.status==="fulfilled"?i.value:{};return Nv(r.value,s)}let a=r.reason;if(a instanceof Re&&(a.code==="forbidden"||a.code==="bad_request"||a.code==="not_found")&&i.status==="rejected")return Nv({},{});throw a})}};async function md(e){try{return await e()}catch(t){return t instanceof Re?N$(t):Nr(`Unexpected error: ${t instanceof Error?t.message:String(t)}`)}}var Te={readOnlyHint:!0,openWorldHint:!0},Nt=m.number().int().positive().describe("Steam application id (appid). Get it from search_games."),Lt=m.string().regex(/^[A-Za-z]{2}$/,"Two-letter ISO country code, e.g. US, RU, DE.").describe("Country (cc) for prices/currency; overrides STEAM_COUNTRY for this call.").optional(),nr=m.string().min(2).describe("Store language (e.g. english, russian); overrides STEAM_LANGUAGE for this call.").optional(),Dv=m.enum(["windows","mac","linux"]).describe("NATIVE-build filter: keep only games shipping a native build for this OS (windows/mac/linux). 'linux' = a native Linux/SteamOS port. This is NOT Proton \u2014 for games that run via Proton compatibility use steam_os / steam_deck instead. Each result's `platforms` field lists its native builds, while steam_os/steam_deck report Proton compatibility, so native vs Proton stay distinct.").optional(),Uv=m.enum(["playable","verified"]).describe("Steam Deck compatibility (runs via Proton): 'verified' = Deck-Verified only; 'playable' = Playable or Verified. Not a native Linux build \u2014 see `platform` for that.").optional(),Lv=m.enum(["playable","verified"]).describe("SteamOS compatibility \u2014 how well it runs on SteamOS in general (via Proton): 'verified' = SteamOS-Verified only; 'playable' = Playable or Verified. For a NATIVE Linux build instead, use platform:'linux'; for the Steam Machine console specifically, use steam_machine.").optional(),Fv=m.enum(["playable","verified"]).describe("Steam Machine (Valve's console) compatibility (via Proton): 'verified' = Steam-Machine-Verified only; 'playable' = Playable or Verified. Its own rating, distinct from the general steam_os one.").optional(),Vv=m.enum(["playable","verified"]).describe("Steam Frame (VR headset) compatibility: 'verified' = Frame-Verified only; 'playable' = Playable or Verified.").optional(),Be=e=>md(async()=>Hu(await e()));function lw(e,t){e.registerTool("search_games",{title:"Search games",description:"Search the Steam store by title \u2014 term can be partial or approximate, not an exact match; returns matches with their appid (needed by the other game tools), price, Metacritic score and platforms. No API key required.",inputSchema:m.object({term:m.string().min(1).describe("Game title to search for."),country:Lt,language:nr}),outputSchema:Du,annotations:Te},({term:n,country:o,language:r})=>Be(()=>t.searchGames(n,o,r))),e.registerTool("get_game",{title:"Get game details",description:"Get full store details for one game: description, price/discount, genres, platforms, release date, developers/publishers, Metacritic, age rating, DLC and PC requirements. Identify the game by appid (from search_games) OR by name \u2014 a title is resolved to the closest store match. No API key required.",inputSchema:m.object({appid:Nt.describe("Steam appid (from search_games). Provide appid OR name.").optional(),name:m.string().min(1).describe("Game title to look up instead of an appid \u2014 resolved to the closest store match. Provide appid OR name; appid wins if both are given.").optional(),country:Lt,language:nr}),outputSchema:Uu,annotations:Te},({appid:n,name:o,country:r,language:i})=>md(async()=>{let a=n;if(!a){if(!o)return Nr("Provide either appid or name.");let s=await t.resolveAppId(o,r,i);if(!s)return Nr(`No Steam game found matching "${o}".`);a=s}return Hu(await t.getGame(a,r,i))})),e.registerTool("get_game_reviews",{title:"Get game reviews",description:"Get the review summary (score label, positive/negative counts, %) and a few recent reviews for a game by appid. Review text over 600 characters is truncated. For long-term trend instead of a snapshot, use get_review_histogram. Get the appid from search_games. No API key required.",inputSchema:m.object({appid:Nt,limit:m.number().int().min(1).max(20).describe("How many recent reviews (1-20). Default 5.").optional(),review_language:m.string().describe("Filter reviews by language, e.g. 'english'. Default 'all'.").optional(),type:m.enum(["all","positive","negative"]).describe("Only positive or negative reviews. Default 'all'. Steam only computes the summary (score label, totals, %) for 'all' \u2014 filtering to positive/negative nulls those fields out, leaving only the review excerpts.").optional()}),outputSchema:Lu,annotations:Te},({appid:n,limit:o,review_language:r,type:i})=>Be(()=>t.getReviews(n,o??5,r??"all",i??"all"))),e.registerTool("get_review_histogram",{title:"Get review trend over time",description:"Get how a game's reviews trend over time by appid: a long-term history (rollup_type reports each entry's granularity, e.g. 'week' or 'month', chosen server-side by Steam) and the recent per-day breakdown, each with positive/negative counts and positive %. Good for 'are reviews improving / did an update hurt reception'. For a current summary and example review text instead of a trend, use get_game_reviews. Get the appid from search_games. No key.",inputSchema:m.object({appid:Nt}),outputSchema:Gu,annotations:Te},({appid:n})=>Be(()=>t.getReviewHistogram(n))),e.registerTool("get_prices",{title:"Get prices for many games",description:"Get current price and discount for a batch of games by appid in one call \u2014 efficient for checking a whole list (e.g. a wishlist) for deals. Handles up to 500 appids; if you also need review %, hardware compatibility or tags, use get_items instead (max 100 appids). Rows come back in the same order as the given appids, one per id (unavailable ones marked available:false, never dropped). Each row has the final/initial price and discount_percent (or is_free). No API key required. Get appids from search_games or get_wishlist.",inputSchema:m.object({appids:m.array(m.number().int().positive()).min(1).max(500).describe("Steam appids to price (1-500)."),country:Lt}),outputSchema:Fu,annotations:Te},({appids:n,country:o})=>Be(()=>t.getPrices(n,o))),e.registerTool("get_specials",{title:"Get current discounts",description:"List games currently on special (discounted) on the Steam store front page, with the discount % and original/final price. For ALL catalog discounts (not just the front page), use discover_games with min_discount. No API key required.",inputSchema:m.object({country:Lt,language:nr}),outputSchema:Vu,annotations:Te},({country:n,language:o})=>Be(()=>t.getSpecials(n,o))),e.registerTool("get_featured",{title:"Get featured store sections",description:"Get the Steam store's featured sections: specials, top sellers, new releases and coming soon (each a list of games with appid and price), all in one call \u2014 for a general 'what's on the store front page' overview. For just current discounts use get_specials (lighter), or discover_games for catalog-wide deals with filters. No API key required.",inputSchema:m.object({country:Lt,language:nr}),outputSchema:Zu,annotations:Te},({country:n,language:o})=>Be(()=>t.getFeatured(n,o)))}var _t=m.string().regex(/^\d{17}$/,"A SteamID64 is 17 digits. Use resolve_vanity_url to convert a custom profile name.").describe("17-digit SteamID64. Omit to use the STEAM_ID configured on the server. Convert a vanity/custom URL name with resolve_vanity_url first.").optional(),dn=(e,t,n)=>({steamid:o})=>t(async()=>n(await e.requireSteamId(o)));var GP=tr(So,td,sd);function uw(e,t,n){e.registerTool("get_game_news",{title:"Get game news",description:"Get recent news / patch notes for a game by appid (title, date, author, excerpt, link). Get the appid from search_games. Works without an API key.",inputSchema:m.object({appid:Nt,limit:m.number().int().min(1).max(20).describe("How many news items (1-20). Default 5.").optional()}),outputSchema:Xu,annotations:Te},({appid:o,limit:r})=>Be(()=>t.getNews(o,r??5))),e.registerTool("get_global_achievements",{title:"Get global achievement rates",description:`Get the global unlock percentage of each achievement in a game by appid \u2014 how rare each achievement is across all players. Returns each achievement's internal name and its unlock percent (no display names/descriptions \u2014 for those, use get_game_achievements), most-common first, capped at the first ${Cr} (check \`returned\` vs \`count\` \u2014 most games have far fewer). Get the appid from search_games. Works without a key.`,inputSchema:m.object({appid:Nt}),outputSchema:Wu,annotations:Te},({appid:o})=>Be(()=>t.getGlobalAchievements(o))),e.registerTool("get_items",{title:"Batch store card for many games",description:"Get price/discount, review % (positive), hardware compatibility, popular user tags and release date for a LIST of games by appid in ONE keyless call. The efficient way to price-, rating-, tag- and compat-check a wishlist or library without a request per game. For a bigger batch (up to 500 appids) when you only need price, use get_prices instead. Each item carries four compatibility fields, each verified/playable/unsupported/unknown: steam_deck (Steam Deck), steam_os (SteamOS in general), steam_machine (the Steam Machine console specifically), and steam_frame (Steam Frame VR headset); a `vr_support` flag (none/supported/required \u2014 distinct from steam_frame, which is a Steam Frame HARDWARE compat rating, not whether the game itself has a VR mode); a `tags` list (top user tags like 'Roguelike', 'Souls-like', most-relevant first); a clickable `store_url` to the game's Steam page; and, when on sale, `discount_end` (ISO UTC time the discount expires \u2014 for 'how long is this deal valid'). Get appids from search_games / get_wishlist / get_owned_games.",inputSchema:m.object({appids:m.array(m.number().int().positive()).min(1).max(100).describe("Steam appids (1-100)."),country:Lt,language:nr}),outputSchema:id,annotations:Te},({appids:o,country:r,language:i})=>Be(()=>n.getItems(o,r,i))),e.registerTool("discover_games",{title:"Discover games (deals, new releases, Steam Deck, rating)",description:"Find games across the whole Steam catalog (keyless), filtered by ANY combination of: discount (min_discount \u2014 for 'what's on sale'), release recency (released_after / released_within_days \u2014 for 'new games'), hardware compatibility (steam_deck for Steam Deck, steam_os for SteamOS in general, steam_machine for the Steam Machine console specifically, steam_frame for the Steam Frame VR headset), native OS build (platform \u2014 windows/mac/linux), review quality (min_review / min_reviews), and user tags (tags \u2014 e.g. ['Roguelike', 'Deckbuilding'] for 'games like X'). Each result returns price/discount, review %, all four compat statuses, a vr_support flag (none/supported/required), popular tags, a clickable store_url, discount_end (when a deal expires) and release date in one call. Examples: '>80% off with 90%+ reviews' \u2192 set min_discount + min_review; 'recent well-reviewed games that run on Steam Deck' \u2192 set released_within_days + steam_deck + min_review; 'roguelike deckbuilders on sale' \u2192 tags:['Roguelike','Deckbuilding'] + min_discount; 'games that run on the Steam Machine' \u2192 steam_machine; 'games that run on SteamOS' \u2192 steam_os. No appids needed \u2014 unlike get_items, which prices a list you already have. For 'games like X' from a SINGLE named title, get its tags via get_items and pass them here; for taste inferred from the player's WHOLE library instead, use get_recommended_games (key-gated). Note: min_discount is filtered server-side, and setting released_after/released_within_days also excludes not-yet-released games server-side \u2014 but the actual date cutoff, plus compat, platform, review and tag filtering, have no server-side support in the Steam catalog API, so those are scanned popularity-first and applied afterward over that same window \u2014 great for popular titles; a niche match may fall outside the top `count` (raise count for stricter filters).",inputSchema:m.object({released_after:m.string().regex(/^\d{4}-\d{2}-\d{2}$/,"Use an ISO date, e.g. 2026-03-01.").describe("Keep only games released on/after this date (YYYY-MM-DD).").optional(),released_within_days:m.number().int().min(1).describe("Alternative to released_after: released within the last N days.").optional(),steam_deck:Uv,steam_os:Lv,steam_machine:Fv,steam_frame:Vv,platform:Dv,tags:m.array(m.string().min(1)).min(1).describe("Keep only games carrying ALL of these user tags (case-insensitive), e.g. ['Roguelike','Deckbuilding']. Use exact Steam tag names. Applied over the scanned popularity window, so raise `count` when combining niche tags.").optional(),min_review:m.number().int().min(0).max(100).describe("Minimum positive-review %, e.g. 85. Applied over the returned page.").optional(),min_reviews:m.number().int().min(0).describe("Minimum review count (filters out games with too few reviews).").optional(),min_discount:m.number().int().min(1).max(100).describe("Minimum discount %, e.g. 80 for '80%+ off' \u2014 this is the 'deals' filter. Omit to include full-price games.").optional(),count:m.number().int().min(1).max(200).describe("How many catalog entries to scan (default 50). Raise for stricter filters.").optional(),start:m.number().int().min(0).describe("Pagination offset into the catalog.").optional(),country:Lt,language:nr}),outputSchema:ad,annotations:Te},({released_after:o,released_within_days:r,steam_deck:i,steam_os:a,steam_machine:s,steam_frame:c,platform:l,tags:u,min_review:p,min_reviews:f,min_discount:b,count:g,start:S,country:_,language:h})=>{let w;return o?w=Math.floor(Date.parse(o)/1e3):r&&(w=Math.floor(Date.now()/1e3)-r*86400),Be(()=>n.discoverGames({releasedAfter:w,steamDeck:i,steamOs:a,steamMachine:s,steamFrame:c,platform:l,tags:u,minReview:p,minReviews:f,minDiscount:b,count:g,start:S,country:_,language:h}))}),e.registerTool("get_current_players",{title:"Get current player count",description:"Get how many people are playing a game right now (live concurrent player count) by appid. Get the appid from search_games. Works without a key. Errors clearly if the appid is unknown/invalid rather than returning a null count.",inputSchema:m.object({appid:Nt}),outputSchema:ed,annotations:Te},({appid:o})=>Be(()=>t.getCurrentPlayers(o))),e.registerTool("get_followed_games",{title:"Get a player's followed games",description:"List the games a player 'follows' on the Steam store, by SteamID64 \u2014 a lighter opt-in (get sale/update notifications) that's separate from the wishlist; many players follow more games than they wishlist. Works without a key, but only if that player's follows/profile are public \u2014 otherwise it returns found:false. Returns appids + store_url only (no price/name); pass the appids to get_items for price, review % and compat. Convert a vanity name with resolve_vanity_url first.",inputSchema:m.object({steamid:_t}),outputSchema:ba,annotations:Te},dn(t,Be,o=>t.getFollowedGames(o))),e.registerTool("get_wishlist",{title:"Get a player's wishlist",description:"List a player's Steam wishlist by SteamID64. Works without a key, but only if that player's wishlist/profile is public \u2014 otherwise it returns found:false. By default returns a light list of appids (sorted by priority, no names). Set include_details for full store cards in ONE call (name, price/discount, review %, Deck/SteamOS/Machine/Frame compat, vr_support, tags, release) \u2014 no need to follow up with get_items. Narrow it in the SAME call with tags (e.g. ['Metroidvania']), platform (NATIVE windows/mac/linux build), steam_deck / steam_os / steam_machine / steam_frame (Proton compatibility \u2014 distinct from a native build), min_review and min_discount / on_sale_only, or country / language (the light appid list carries no price, so setting either implies include_details too) \u2014 these are applied before the output cap (the detailed card list returns at most 60 items), so a deeply-discounted niche match past the display cap is never hidden by it (e.g. 'top metroidvanias on my wishlist with a good discount and reviews' \u2192 tags:['Metroidvania'] + min_discount + min_review). Results ranked by discount when a discount filter is set, else by wishlist priority; `matched` reports the pre-cap count. Steam itself only attaches store data to roughly the first 100 wishlist entries per call \u2014 on a bigger wishlist, `enriched` reports how many of `total` got checked, and `note` explains when some were skipped (their filter/price data isn't available at all, not that they don't match). Convert a vanity name with resolve_vanity_url first.",inputSchema:m.object({steamid:_t,include_details:m.boolean().describe("Return full store cards (name, price, discount, reviews, compatibility, tags) per item in one call, instead of just appids. Implied by any filter below.").optional(),on_sale_only:m.boolean().describe("Only wishlist items currently discounted, ranked by discount %. Implies include_details.").optional(),tags:m.array(m.string().min(1)).min(1).describe("Keep only wishlist items carrying ALL of these user tags (case-insensitive), e.g. ['Metroidvania']. Implies include_details.").optional(),min_review:m.number().int().min(0).max(100).describe("Keep only items with at least this positive-review %. Implies include_details.").optional(),min_discount:m.number().int().min(1).max(100).describe("Keep only items discounted at least this %, ranked by discount. Implies include_details.").optional(),platform:Dv,steam_deck:Uv,steam_os:Lv,steam_machine:Fv,steam_frame:Vv,country:Lt.describe("Country (cc) for prices; overrides STEAM_COUNTRY. Only meaningful for store cards, so setting it implies include_details \u2014 the light appid list carries no price."),language:nr.describe("Store language; overrides STEAM_LANGUAGE. Only meaningful for store cards, so setting it implies include_details \u2014 the light appid list carries no price.")}),outputSchema:GP,annotations:Te},({steamid:o,include_details:r,on_sale_only:i,tags:a,min_review:s,min_discount:c,platform:l,steam_deck:u,steam_os:p,steam_machine:f,steam_frame:b,country:g,language:S})=>Be(async()=>{let _=await t.requireSteamId(o);return t.getWishlist(_,{includeDetails:r,onSaleOnly:i,tags:a,minReview:s,minDiscount:c,platform:l,steamDeck:u,steamOs:p,steamMachine:f,steamFrame:b,country:g,language:S})}))}var JP=tr(vt,Bu),HP=tr(vt,rd),BP=tr(vt,Sa),KP=tr(vt,Ku),WP=tr(vt,cd),YP=tr(vt,Qu);function dw(e,t){let n=o=>t.configured?Be(o):Promise.resolve(Nr("This tool needs a Steam Web API key. Set STEAM_API_KEY to a free key from https://steamcommunity.com/dev/apikey. (Note: the target profile must also be public.)"));e.registerTool("get_game_achievements",{title:"Get a game's full achievement list",description:`List a game's achievements by appid with their names, descriptions, hidden flag and global unlock % (rarity), in the game's own definition order (capped at the first ${Cr}; check \`returned\` vs \`total\` \u2014 most games have far fewer). Requires STEAM_API_KEY (the achievement schema needs a key). For just the rarity by internal id without a key, use get_global_achievements; for a few named highlights, see get_game's achievements_highlighted. Get the appid from search_games.`,inputSchema:m.object({appid:Nt,language:m.string().min(2).describe("Language for achievement names/descriptions; overrides STEAM_LANGUAGE.").optional()}),outputSchema:Yu,annotations:Te},({appid:o,language:r})=>n(()=>t.getGameAchievements(o,r))),e.registerTool("resolve_vanity_url",{title:"Resolve vanity URL to SteamID",description:"Convert a Steam custom (vanity) profile name \u2014 the part after /id/ in a profile URL \u2014 into the 17-digit SteamID64 that the player tools need. Requires STEAM_API_KEY. Returns found:false if the name doesn't resolve to a profile.",inputSchema:m.object({vanity:m.string().min(1).describe("Vanity name, e.g. 'gabelogannewell' from steamcommunity.com/id/gabelogannewell.")}),outputSchema:YP,annotations:Te},({vanity:o})=>n(()=>t.resolveVanityUrl(o))),e.registerTool("get_friend_list",{title:"Get a player's friend list",description:"List a player's Steam friends by SteamID64: name, online state, current game and how long they've been friends, most-recently-added first (capped at the 100 most-recently-added; check `returned` vs `total`). Requires STEAM_API_KEY and the friends list to be public \u2014 otherwise it returns found:false. For 'which of my friends own game X', use find_friends_who_own instead \u2014 it checks each friend's full library, not just this list. Get the SteamID64 from resolve_vanity_url.",inputSchema:m.object({steamid:_t}),outputSchema:BP,annotations:Te},dn(t,n,o=>t.getFriendList(o))),e.registerTool("find_friends_who_own",{title:"Find friends who own a game",description:"Check which of a player's Steam friends own one or more games by appid, with each owner's playtime_hours \u2014 'which of my friends have Portal 2 and how long have they played'. Checks each friend's FULL library, unlike get_friend_list which caps at the top 50 games by playtime \u2014 so a friend's rarely-played or unplayed copy is never missed (its playtime_hours may still be low or 0). For the PLAYER'S OWN ownership instead of a friend's, use get_owned_games's check_appids. Requires STEAM_API_KEY and the player's OWN friends list to be public \u2014 otherwise the whole call returns found:false. A friend's individually private library is a different, per-friend case: that friend is listed in private_friends (can't be checked) rather than silently counted as a non-owner. Likewise, a friend whose own library lookup failed (e.g. rate-limited) lands in unavailable_friends with a reason instead of failing the whole call \u2014 every other friend's result still comes through. Each of owners, private_friends and unavailable_friends is capped at 100 entries (a sibling _total field appears only when it was actually truncated). Get appids from search_games.",inputSchema:m.object({appids:m.array(m.number().int().positive()).min(1).max(10).describe("Steam appids to check (1-10)."),steamid:_t}),outputSchema:HP,annotations:Te},({appids:o,steamid:r})=>n(async()=>t.findFriendsWhoOwn(await t.requireSteamId(r),o))),e.registerTool("compare_players",{title:"Compare two players' libraries",description:"Find games two players both own, with each one's playtime \u2014 'what can my friend and I both play', 'do we have anything in common'. Checks each player's FULL library, unlike get_owned_games which caps at the top 50 by playtime. Requires STEAM_API_KEY and both profiles' game-details to be public \u2014 otherwise it returns found:false. Omit steamid to compare against yourself (STEAM_ID).",inputSchema:m.object({steamid:_t,other_steamid:m.string().regex(/^\d{17}$/,"A SteamID64 is 17 digits. Use resolve_vanity_url to convert a custom profile name.").describe("The other player's 17-digit SteamID64 to compare against.")}),outputSchema:JP,annotations:Te},({steamid:o,other_steamid:r})=>n(async()=>t.comparePlayers(await t.requireSteamId(o),r))),e.registerTool("get_player_summary",{title:"Get player profile",description:"Get a player's profile by SteamID64: display name, online state, country, account age, Steam level, and the game they're currently in. Requires STEAM_API_KEY, but works even for a private profile (visibility reports 'private') \u2014 country, account age and the current game only populate when the profile is public. For VAC/game/trade ban status instead, use get_player_bans.",inputSchema:m.object({steamid:_t}),outputSchema:ga,annotations:Te},dn(t,n,o=>t.getPlayerSummary(o))),e.registerTool("get_player_bans",{title:"Get a player's ban status",description:"Check a player's VAC, game, community and economy (trade) ban status by SteamID64 \u2014 'is this player banned', useful before trading or adding a friend. Ban status is always public \u2014 this works even when the rest of the profile is private. Requires STEAM_API_KEY.",inputSchema:m.object({steamid:_t}),outputSchema:ya,annotations:Te},dn(t,n,o=>t.getPlayerBans(o))),e.registerTool("get_owned_games",{title:"Get owned games",description:"List the games a player owns with playtime (hours), most-played first (the `games` list is capped to the top 50 by playtime \u2014 a lightly-played or unplayed game may not appear there). To reliably check whether the player owns one or more SPECIFIC appids regardless of that cap \u2014 'do I own game X' \u2014 pass check_appids; the `owns` field then checks the FULL, uncapped library, with each result's own playtime_hours (null if not owned). For checking a FRIEND's ownership instead of the player's own, use find_friends_who_own. Requires STEAM_API_KEY and a public profile + game-details visibility. Get the SteamID64 from resolve_vanity_url.",inputSchema:m.object({steamid:_t,check_appids:m.array(m.number().int().positive()).min(1).max(50).describe("Steam appids to reliably check ownership of (1-50), regardless of the top-50-by-playtime cap on `games`. Adds an `owns` field: [{appid, owned, playtime_hours}].").optional()}),outputSchema:va,annotations:Te},({steamid:o,check_appids:r})=>n(async()=>t.getOwnedGames(await t.requireSteamId(o),r))),e.registerTool("get_recently_played",{title:"Get recently played games",description:"List the games a player has played in the last two weeks, with recent and total playtime. For all-time top games by playtime instead (capped to the top 50), use get_owned_games. Requires STEAM_API_KEY and a public profile with game-details visibility (same requirement as get_owned_games) \u2014 otherwise it returns found:false.",inputSchema:m.object({steamid:_t}),outputSchema:_a,annotations:Te},dn(t,n,o=>t.getRecentlyPlayed(o))),e.registerTool("get_recommended_games",{title:"Get personalized game recommendations",description:"Recommend unowned Steam catalog games personalized to this player: tags on their own most-played owned games become weighted preferences (more playtime on a tag = more weight), discounted by each candidate's review score so a tag match on a poorly-received game doesn't outrank a better one, then ranked against a broad catalog page, excluding anything already owned. `based_on_tags` shows which of the player's own top tags drove the ranking; each result carries `matched_tags` and `match_score` alongside the usual price/review/compat card. Set exclude_tags to steer away from a genre despite it matching by playtime (e.g. 'recommend me something except Souls-like'), or min_discount for 'recommend something on a good discount' (e.g. 'suggest games on sale, not RPGs or shooters' \u2192 exclude_tags:['RPG','Shooter','FPS'], min_discount:30). Different from discover_games (which needs YOU to name the filters) \u2014 this infers taste from the player's WHOLE library instead, for 'what should I play next' / 'recommend me something'. For 'something like THIS ONE game' (a single named title), get its tags via get_items and call discover_games with them instead. Note: candidates are scored from a large but fixed-size catalog scan, so a heavy exclude_tags/min_discount combination can return fewer than `count` \u2014 there's no larger scan to fall back to. Requires STEAM_API_KEY and a public profile with game-details visible (same requirement as get_owned_games) \u2014 found:false is also returned if the player owns no games at all to base recommendations on.",inputSchema:m.object({steamid:_t,count:m.number().int().min(1).max(25).describe("How many recommendations to return (default 10).").optional(),exclude_tags:m.array(m.string().min(1)).min(1).describe("Drop any candidate carrying ANY of these tags (case-insensitive), e.g. ['Souls-like'] for 'recommend me something except Souls-like'.").optional(),min_discount:m.number().int().min(1).max(100).describe("Minimum discount %, e.g. 30 for '30%+ off'. Omit to include full-price games too.").optional()}),outputSchema:WP,annotations:Te},({steamid:o,count:r,exclude_tags:i,min_discount:a})=>n(async()=>t.getRecommendedGames(await t.requireSteamId(o),{count:r,excludeTags:i,minDiscount:a}))),e.registerTool("get_player_achievements",{title:"Get a player's achievements",description:`Get a player's achievement progress for one game (unlocked count, % complete, per-achievement unlock dates) by SteamID64 + appid \u2014 \`unlocked\`/\`completion_pct\` always reflect the full list, but the per-achievement \`achievements\` array is capped at ${Cr}, unlocked first (check \`returned\` vs \`total\` \u2014 most games have far fewer). For the game's full achievement list (names, descriptions, global rarity) independent of any player, use get_game_achievements instead; for just the rarity without a key, use get_global_achievements. Requires STEAM_API_KEY and a public profile with game-details visibility \u2014 otherwise it returns found:false (also returned if the game has no achievements at all).`,inputSchema:m.object({steamid:_t,appid:Nt,language:m.string().min(2).describe("Language for achievement names/descriptions; overrides STEAM_LANGUAGE.").optional()}),outputSchema:KP,annotations:Te},({steamid:o,appid:r,language:i})=>n(async()=>t.getPlayerAchievements(await t.requireSteamId(o),r,i)))}var XP=8;function Zv(e,t){return{description:e,messages:[{role:"user",content:{type:"text",text:t}}]}}function mw(e,t){e.registerPrompt("what_should_i_play",{title:"What should I play next?",description:"Recommend games from the Steam catalog based on a player's library and taste, excluding what they already own.",argsSchema:m.object({steamid:m.string().describe("SteamID64 whose library to base taste on. Omit to use the configured STEAM_ID.").optional(),budget:m.string().describe("Max price, e.g. '$20' or 'free'. Omit for no limit.").optional(),tags:m.string().describe("Comma-separated tags to steer toward, e.g. 'Roguelike, Deckbuilding'. Omit to infer from the library.").optional()})},({steamid:n,budget:o,tags:r})=>Zv("Recommend games based on library/taste",`Recommend what I should play next.
75
+ deps: ${u}}`};let r={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(c){let[l,u]=i(c);a(c,l),s(c,u)}};function i({schema:c}){let l={},u={};for(let p in c){if(p==="__proto__")continue;let f=Array.isArray(c[p])?l:u;f[p]=c[p]}return[l,u]}function a(c,l=c.schema){let{gen:u,data:p,it:f}=c;if(Object.keys(l).length===0)return;let b=u.let("missing");for(let g in l){let S=l[g];if(S.length===0)continue;let _=(0,o.propertyInData)(u,p,g,f.opts.ownProperties);c.setParams({property:g,depsCount:S.length,deps:S.join(", ")}),f.allErrors?u.if(_,()=>{for(let h of S)(0,o.checkReportMissingProp)(c,h)}):(u.if((0,t._)`${_} && (${(0,o.checkMissingProp)(c,S,b)})`),(0,o.reportMissingProp)(c,b),u.else())}}e.validatePropertyDeps=a;function s(c,l=c.schema){let{gen:u,data:p,keyword:f,it:b}=c,g=u.name("valid");for(let S in l)(0,n.alwaysValidSchema)(b,l[S])||(u.if((0,o.propertyInData)(u,p,S,b.opts.ownProperties),()=>{let _=c.subschema({keyword:f,schemaProp:S},g);c.mergeValidEvaluated(_,g)},()=>u.var(g,!0)),c.ok(g))}e.validateSchemaDeps=s,e.default=r})),aI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ve(),n=ze(),o={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:r})=>(0,t._)`{propertyName: ${r.propertyName}}`},code(r){let{gen:i,schema:a,data:s,it:c}=r;if((0,n.alwaysValidSchema)(c,a))return;let l=i.name("valid");i.forIn("key",s,u=>{r.setParams({propertyName:u}),r.subschema({keyword:"propertyNames",data:u,dataTypes:["string"],propertyName:u,compositeRule:!0},l),i.if((0,t.not)(l),()=>{r.error(!0),c.allErrors||i.break()})}),r.ok(l)}};e.default=o})),JS=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Tt(),n=ve(),o=Pt(),r=ze(),i={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:a})=>(0,n._)`{additionalProperty: ${a.additionalProperty}}`},code(a){let{gen:s,schema:c,parentSchema:l,data:u,errsCount:p,it:f}=a;if(!p)throw new Error("ajv implementation error");let{allErrors:b,opts:g}=f;if(f.props=!0,g.removeAdditional!=="all"&&(0,r.alwaysValidSchema)(f,c))return;let S=(0,t.allSchemaProperties)(l.properties),_=(0,t.allSchemaProperties)(l.patternProperties);h(),a.ok((0,n._)`${p} === ${o.default.errors}`);function h(){s.forIn("key",u,z=>{!S.length&&!_.length?$(z):s.if(w(z),()=>$(z))})}function w(z){let y;if(S.length>8){let R=(0,r.schemaRefOrVal)(f,l.properties,"properties");y=(0,t.isOwnProperty)(s,R,z)}else S.length?y=(0,n.or)(...S.map(R=>(0,n._)`${z} === ${R}`)):y=n.nil;return _.length&&(y=(0,n.or)(y,..._.map(R=>(0,n._)`${(0,t.usePattern)(a,R)}.test(${z})`))),(0,n.not)(y)}function v(z){s.code((0,n._)`delete ${u}[${z}]`)}function $(z){if(g.removeAdditional==="all"||g.removeAdditional&&c===!1){v(z);return}if(c===!1){a.setParams({additionalProperty:z}),a.error(),b||s.break();return}if(typeof c=="object"&&!(0,r.alwaysValidSchema)(f,c)){let y=s.name("valid");g.removeAdditional==="failing"?(I(z,y,!1),s.if((0,n.not)(y),()=>{a.reset(),v(z)})):(I(z,y),b||s.if((0,n.not)(y),()=>s.break()))}}function I(z,y,R){let O={keyword:"additionalProperties",dataProp:z,dataPropType:r.Type.Str};R===!1&&Object.assign(O,{compositeRule:!0,createErrors:!1,allErrors:!1}),a.subschema(O,y)}}};e.default=i})),sI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ca(),n=Tt(),o=ze(),r=JS(),i={keyword:"properties",type:"object",schemaType:"object",code(a){let{gen:s,schema:c,parentSchema:l,data:u,it:p}=a;p.opts.removeAdditional==="all"&&l.additionalProperties===void 0&&r.default.code(new t.KeywordCxt(p,r.default,"additionalProperties"));let f=(0,n.allSchemaProperties)(c);for(let h of f)p.definedProperties.add(h);p.opts.unevaluated&&f.length&&p.props!==!0&&(p.props=o.mergeEvaluated.props(s,(0,o.toHash)(f),p.props));let b=f.filter(h=>!(0,o.alwaysValidSchema)(p,c[h]));if(b.length===0)return;let g=s.name("valid");for(let h of b)S(h)?_(h):(s.if((0,n.propertyInData)(s,u,h,p.opts.ownProperties)),_(h),p.allErrors||s.else().var(g,!0),s.endIf()),a.it.definedProperties.add(h),a.ok(g);function S(h){return p.opts.useDefaults&&!p.compositeRule&&c[h].default!==void 0}function _(h){a.subschema({keyword:"properties",schemaProp:h,dataProp:h},g)}}};e.default=i})),cI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Tt(),n=ve(),o=ze(),r=ze(),i={keyword:"patternProperties",type:"object",schemaType:"object",code(a){let{gen:s,schema:c,data:l,parentSchema:u,it:p}=a,{opts:f}=p,b=(0,t.allSchemaProperties)(c),g=b.filter(I=>(0,o.alwaysValidSchema)(p,c[I]));if(b.length===0||g.length===b.length&&(!p.opts.unevaluated||p.props===!0))return;let S=f.strictSchema&&!f.allowMatchingProperties&&u.properties,_=s.name("valid");p.props!==!0&&!(p.props instanceof n.Name)&&(p.props=(0,r.evaluatedPropsToName)(s,p.props));let{props:h}=p;w();function w(){for(let I of b)S&&v(I),p.allErrors?$(I):(s.var(_,!0),$(I),s.if(_))}function v(I){for(let z in S)new RegExp(I).test(z)&&(0,o.checkStrictMode)(p,`property ${z} matches pattern ${I} (use allowMatchingProperties)`)}function $(I){s.forIn("key",l,z=>{s.if((0,n._)`${(0,t.usePattern)(a,I)}.test(${z})`,()=>{let y=g.includes(I);y||a.subschema({keyword:"patternProperties",schemaProp:I,dataProp:z,dataPropType:r.Type.Str},_),p.opts.unevaluated&&h!==!0?s.assign((0,n._)`${h}[${z}]`,!0):!y&&!p.allErrors&&s.if((0,n.not)(_),()=>s.break())})})}}};e.default=i})),lI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ze(),n={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(o){let{gen:r,schema:i,it:a}=o;if((0,t.alwaysValidSchema)(a,i)){o.fail();return}let s=r.name("valid");o.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),o.failResult(s,()=>o.reset(),()=>o.error())},error:{message:"must NOT be valid"}};e.default=n})),uI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Tt().validateUnion,error:{message:"must match a schema in anyOf"}};e.default=t})),dI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ve(),n=ze(),o={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:r})=>(0,t._)`{passingSchemas: ${r.passing}}`},code(r){let{gen:i,schema:a,parentSchema:s,it:c}=r;if(!Array.isArray(a))throw new Error("ajv implementation error");if(c.opts.discriminator&&s.discriminator)return;let l=a,u=i.let("valid",!1),p=i.let("passing",null),f=i.name("_valid");r.setParams({passing:p}),i.block(b),r.result(u,()=>r.reset(),()=>r.error(!0));function b(){l.forEach((g,S)=>{let _;(0,n.alwaysValidSchema)(c,g)?i.var(f,!0):_=r.subschema({keyword:"oneOf",schemaProp:S,compositeRule:!0},f),S>0&&i.if((0,t._)`${f} && ${u}`).assign(u,!1).assign(p,(0,t._)`[${p}, ${S}]`).else(),i.if(f,()=>{i.assign(u,!0),i.assign(p,S),_&&r.mergeEvaluated(_,t.Name)})})}}};e.default=o})),mI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ze(),n={keyword:"allOf",schemaType:"array",code(o){let{gen:r,schema:i,it:a}=o;if(!Array.isArray(i))throw new Error("ajv implementation error");let s=r.name("valid");i.forEach((c,l)=>{if((0,t.alwaysValidSchema)(a,c))return;let u=o.subschema({keyword:"allOf",schemaProp:l},s);o.ok(s),o.mergeEvaluated(u)})}};e.default=n})),pI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ve(),n=ze(),o={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:i})=>(0,t.str)`must match "${i.ifClause}" schema`,params:({params:i})=>(0,t._)`{failingKeyword: ${i.ifClause}}`},code(i){let{gen:a,parentSchema:s,it:c}=i;s.then===void 0&&s.else===void 0&&(0,n.checkStrictMode)(c,'"if" without "then" and "else" is ignored');let l=r(c,"then"),u=r(c,"else");if(!l&&!u)return;let p=a.let("valid",!0),f=a.name("_valid");if(b(),i.reset(),l&&u){let S=a.let("ifClause");i.setParams({ifClause:S}),a.if(f,g("then",S),g("else",S))}else l?a.if(f,g("then")):a.if((0,t.not)(f),g("else"));i.pass(p,()=>i.error(!0));function b(){let S=i.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},f);i.mergeEvaluated(S)}function g(S,_){return()=>{let h=i.subschema({keyword:S},f);a.assign(p,f),i.mergeValidEvaluated(h,p),_?a.assign(_,(0,t._)`${S}`):i.setParams({ifClause:S})}}}};function r(i,a){let s=i.schema[a];return s!==void 0&&!(0,n.alwaysValidSchema)(i,s)}e.default=o})),fI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ze(),n={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:o,parentSchema:r,it:i}){r.if===void 0&&(0,t.checkStrictMode)(i,`"${o}" without "if" is ignored`)}};e.default=n})),HS=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ZS(),n=nI(),o=GS(),r=oI(),i=iI(),a=_v(),s=aI(),c=JS(),l=sI(),u=cI(),p=lI(),f=uI(),b=dI(),g=mI(),S=pI(),_=fI();function h(w=!1){let v=[p.default,f.default,b.default,g.default,S.default,_.default,s.default,c.default,a.default,l.default,u.default];return w?v.push(n.default,r.default):v.push(t.default,o.default),v.push(i.default),v}e.default=h})),hI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ve(),n={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:o})=>(0,t.str)`must match format "${o}"`,params:({schemaCode:o})=>(0,t._)`{format: ${o}}`},code(o,r){let{gen:i,data:a,$data:s,schema:c,schemaCode:l,it:u}=o,{opts:p,errSchemaPath:f,schemaEnv:b,self:g}=u;if(!p.validateFormats)return;s?S():_();function S(){let h=i.scopeValue("formats",{ref:g.formats,code:p.code.formats}),w=i.const("fDef",(0,t._)`${h}[${l}]`),v=i.let("fType"),$=i.let("format");i.if((0,t._)`typeof ${w} == "object" && !(${w} instanceof RegExp)`,()=>i.assign(v,(0,t._)`${w}.type || "string"`).assign($,(0,t._)`${w}.validate`),()=>i.assign(v,(0,t._)`"string"`).assign($,w)),o.fail$data((0,t.or)(I(),z()));function I(){return p.strictSchema===!1?t.nil:(0,t._)`${l} && !${$}`}function z(){let y=b.$async?(0,t._)`(${w}.async ? await ${$}(${a}) : ${$}(${a}))`:(0,t._)`${$}(${a})`,R=(0,t._)`(typeof ${$} == "function" ? ${y} : ${$}.test(${a}))`;return(0,t._)`${$} && ${$} !== true && ${v} === ${r} && !${R}`}}function _(){let h=g.formats[c];if(!h){I();return}if(h===!0)return;let[w,v,$]=z(h);w===r&&o.pass(y());function I(){if(p.strictSchema===!1){g.logger.warn(R());return}throw new Error(R());function R(){return`unknown format "${c}" ignored in schema at path "${f}"`}}function z(R){let O=R instanceof RegExp?(0,t.regexpCode)(R):p.code.formats?(0,t._)`${p.code.formats}${(0,t.getProperty)(c)}`:void 0,L=i.scopeValue("formats",{key:c,ref:R,code:O});return typeof R=="object"&&!(R instanceof RegExp)?[R.type||"string",R.validate,(0,t._)`${L}.validate`]:["string",R,L]}function y(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!b.$async)throw new Error("async format in sync schema");return(0,t._)`await ${$}(${a})`}return typeof v=="function"?(0,t._)`${$}(${a})`:(0,t._)`${$}.test(${a})`}}}};e.default=n})),BS=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=[hI().default];e.default=t})),KS=K((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]})),gI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=FS(),n=VS(),o=HS(),r=BS(),i=KS(),a=[t.default,n.default,(0,o.default)(),r.default,i.metadataVocabulary,i.contentVocabulary];e.default=a})),vI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(n){n.Tag="tag",n.Mapping="mapping"})(t||(e.DiscrError=t={}))})),WS=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ve(),n=vI(),o=Cu(),r=la(),i=ze(),a={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:s,tagName:c}})=>s===n.DiscrError.Tag?`tag "${c}" must be string`:`value of tag "${c}" must be in oneOf`,params:({params:{discrError:s,tag:c,tagName:l}})=>(0,t._)`{error: ${s}, tag: ${l}, tagValue: ${c}}`},code(s){let{gen:c,data:l,schema:u,parentSchema:p,it:f}=s,{oneOf:b}=p;if(!f.opts.discriminator)throw new Error("discriminator: requires discriminator option");let g=u.propertyName;if(typeof g!="string")throw new Error("discriminator: requires propertyName");if(u.mapping)throw new Error("discriminator: mapping is not supported");if(!b)throw new Error("discriminator: requires oneOf keyword");let S=c.let("valid",!1),_=c.const("tag",(0,t._)`${l}${(0,t.getProperty)(g)}`);c.if((0,t._)`typeof ${_} == "string"`,()=>h(),()=>s.error(!1,{discrError:n.DiscrError.Tag,tag:_,tagName:g})),s.ok(S);function h(){let $=v();c.if(!1);for(let I in $)c.elseIf((0,t._)`${_} === ${I}`),c.assign(S,w($[I]));c.else(),s.error(!1,{discrError:n.DiscrError.Mapping,tag:_,tagName:g}),c.endIf()}function w($){let I=c.name("valid"),z=s.subschema({keyword:"oneOf",schemaProp:$},I);return s.mergeEvaluated(z,t.Name),I}function v(){var $;let I={},z=R(p),y=!0;for(let A=0;A<b.length;A++){let F=b[A];if(F?.$ref&&!(0,i.schemaHasRulesButRef)(F,f.self.RULES)){let ne=F.$ref;if(F=o.resolveRef.call(f.self,f.schemaEnv.root,f.baseId,ne),F instanceof o.SchemaEnv&&(F=F.schema),F===void 0)throw new r.default(f.opts.uriResolver,f.baseId,ne)}let ee=($=F?.properties)===null||$===void 0?void 0:$[g];if(typeof ee!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${g}"`);y=y&&(z||R(F)),O(ee,A)}if(!y)throw new Error(`discriminator: "${g}" must be required`);return I;function R({required:A}){return Array.isArray(A)&&A.includes(g)}function O(A,F){if(A.const)L(A.const,F);else if(A.enum)for(let ee of A.enum)L(ee,F);else throw new Error(`discriminator: "properties/${g}" must have "const" or "enum"`)}function L(A,F){if(typeof A!="string"||A in I)throw new Error(`discriminator: "${g}" values must be unique strings`);I[A]=F}}}};e.default=a})),_I=K(((e,t)=>{t.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}})),YS=K(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;let n=LS(),o=gI(),r=WS(),i=_I(),a=["/properties"],s="http://json-schema.org/draft-07/schema";var c=class extends n.default{_addVocabularies(){super._addVocabularies(),o.default.forEach(b=>this.addVocabulary(b)),this.opts.discriminator&&this.addKeyword(r.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let b=this.opts.$data?this.$dataMetaSchema(i,a):i;this.addMetaSchema(b,s,!1),this.refs["http://json-schema.org/schema"]=s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};e.Ajv=c,t.exports=e=c,t.exports.Ajv=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var l=ca();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var u=ve();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var p=Nu();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return p.default}});var f=la();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return f.default}})})),XS=K((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicAnchor=void 0;let t=ve(),n=Pt(),o=Cu(),r=gv(),i={keyword:"$dynamicAnchor",schemaType:"string",code:c=>a(c,c.schema)};function a(c,l){let{gen:u,it:p}=c;p.schemaEnv.root.dynamicAnchors[l]=!0;let f=(0,t._)`${n.default.dynamicAnchors}${(0,t.getProperty)(l)}`,b=p.errSchemaPath==="#"?p.validateName:s(c);u.if((0,t._)`!${f}`,()=>u.assign(f,b))}e.dynamicAnchor=a;function s(c){let{schemaEnv:l,schema:u,self:p}=c.it,{root:f,baseId:b,localRefs:g,meta:S}=l.root,{schemaId:_}=p.opts,h=new o.SchemaEnv({schema:u,schemaId:_,root:f,baseId:b,localRefs:g,meta:S});return o.compileSchema.call(p,h),(0,r.getValidate)(c,h)}e.default=i})),QS=K((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicRef=void 0;let t=ve(),n=Pt(),o=gv(),r={keyword:"$dynamicRef",schemaType:"string",code:a=>i(a,a.schema)};function i(a,s){let{gen:c,keyword:l,it:u}=a;if(s[0]!=="#")throw new Error(`"${l}" only supports hash fragment reference`);let p=s.slice(1);if(u.allErrors)f();else{let g=c.let("valid",!1);f(g),a.ok(g)}function f(g){if(u.schemaEnv.root.dynamicAnchors[p]){let S=c.let("_v",(0,t._)`${n.default.dynamicAnchors}${(0,t.getProperty)(p)}`);c.if(S,b(S,g),b(u.validateName,g))}else b(u.validateName,g)()}function b(g,S){return S?()=>c.block(()=>{(0,o.callRef)(a,g),c.let(S,!0)}):()=>(0,o.callRef)(a,g)}}e.dynamicRef=i,e.default=r})),yI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=XS(),n=ze(),o={keyword:"$recursiveAnchor",schemaType:"boolean",code(r){r.schema?(0,t.dynamicAnchor)(r,""):(0,n.checkStrictMode)(r.it,"$recursiveAnchor: false is ignored")}};e.default=o})),bI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=QS(),n={keyword:"$recursiveRef",schemaType:"string",code:o=>(0,t.dynamicRef)(o,o.schema)};e.default=n})),SI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=XS(),n=QS(),o=yI(),r=bI(),i=[t.default,n.default,o.default,r.default];e.default=i})),$I=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=_v(),n={keyword:"dependentRequired",type:"object",schemaType:"object",error:t.error,code:o=>(0,t.validatePropertyDeps)(o)};e.default=n})),wI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=_v(),n={keyword:"dependentSchemas",type:"object",schemaType:"object",code:o=>(0,t.validateSchemaDeps)(o)};e.default=n})),zI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ze(),n={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:o,parentSchema:r,it:i}){r.contains===void 0&&(0,t.checkStrictMode)(i,`"${o}" without "contains" is ignored`)}};e.default=n})),RI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=$I(),n=wI(),o=zI(),r=[t.default,n.default,o.default];e.default=r})),kI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ve(),n=ze(),o=Pt(),r={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:i})=>(0,t._)`{unevaluatedProperty: ${i.unevaluatedProperty}}`},code(i){let{gen:a,schema:s,data:c,errsCount:l,it:u}=i;if(!l)throw new Error("ajv implementation error");let{allErrors:p,props:f}=u;f instanceof t.Name?a.if((0,t._)`${f} !== true`,()=>a.forIn("key",c,_=>a.if(g(f,_),()=>b(_)))):f!==!0&&a.forIn("key",c,_=>f===void 0?b(_):a.if(S(f,_),()=>b(_))),u.props=!0,i.ok((0,t._)`${l} === ${o.default.errors}`);function b(_){if(s===!1){i.setParams({unevaluatedProperty:_}),i.error(),p||a.break();return}if(!(0,n.alwaysValidSchema)(u,s)){let h=a.name("valid");i.subschema({keyword:"unevaluatedProperties",dataProp:_,dataPropType:n.Type.Str},h),p||a.if((0,t.not)(h),()=>a.break())}}function g(_,h){return(0,t._)`!${_} || !${_}[${h}]`}function S(_,h){let w=[];for(let v in _)_[v]===!0&&w.push((0,t._)`${h} !== ${v}`);return(0,t.and)(...w)}}};e.default=r})),II=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ve(),n=ze(),o={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:r}})=>(0,t.str)`must NOT have more than ${r} items`,params:({params:{len:r}})=>(0,t._)`{limit: ${r}}`},code(r){let{gen:i,schema:a,data:s,it:c}=r,l=c.items||0;if(l===!0)return;let u=i.const("len",(0,t._)`${s}.length`);if(a===!1)r.setParams({len:l}),r.fail((0,t._)`${u} > ${l}`);else if(typeof a=="object"&&!(0,n.alwaysValidSchema)(c,a)){let f=i.var("valid",(0,t._)`${u} <= ${l}`);i.if((0,t.not)(f),()=>p(f,l)),r.ok(f)}c.items=!0;function p(f,b){i.forRange("i",b,u,g=>{r.subschema({keyword:"unevaluatedItems",dataProp:g,dataPropType:n.Type.Num},f),c.allErrors||i.if((0,t.not)(f),()=>i.break())})}}};e.default=o})),PI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=kI(),n=II(),o=[t.default,n.default];e.default=o})),TI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=FS(),n=VS(),o=HS(),r=SI(),i=RI(),a=PI(),s=BS(),c=KS(),l=[r.default,t.default,n.default,(0,o.default)(!0),s.default,c.metadataVocabulary,c.contentVocabulary,i.default,a.default];e.default=l})),EI=K(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}})),xI=K(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}})),OI=K(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}})),jI=K(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}})),NI=K(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}})),CI=K(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}})),AI=K(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}})),MI=K(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}})),qI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=EI(),n=xI(),o=OI(),r=jI(),i=NI(),a=CI(),s=AI(),c=MI(),l=["/properties"];function u(p){return[t,n,o,r,i,f(this,a),s,f(this,c)].forEach(b=>this.addMetaSchema(b,void 0,!1)),this;function f(b,g){return p?b.$dataMetaSchema(g,l):g}}e.default=u})),DI=K(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2020=void 0;let n=LS(),o=TI(),r=WS(),i=qI(),a="https://json-schema.org/draft/2020-12/schema";var s=class extends n.default{constructor(f={}){super({...f,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),o.default.forEach(f=>this.addVocabulary(f)),this.opts.discriminator&&this.addKeyword(r.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:f,meta:b}=this.opts;b&&(i.default.call(this,f),this.refs["http://json-schema.org/schema"]=a)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(a)?a:void 0)}};e.Ajv2020=s,t.exports=e=s,t.exports.Ajv2020=s,Object.defineProperty(e,"__esModule",{value:!0}),e.default=s;var c=ca();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var l=ve();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return l.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return l.CodeGen}});var u=Nu();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return u.default}});var p=la();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return p.default}})})),UI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(A,F){return{validate:A,compare:F}}e.fullFormats={date:t(i,a),time:t(c(!0),l),"date-time":t(f(!0),b),"iso-time":t(c(),u),"iso-date-time":t(f(),g),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:h,"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:L,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:v,int32:{type:"number",validate:z},int64:{type:"number",validate:y},float:{type:"number",validate:R},double:{type:"number",validate:R},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,a),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"date-time":t(/^\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,b),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":t(/^\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,g),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},e.formatNames=Object.keys(e.fullFormats);function n(A){return A%4===0&&(A%100!==0||A%400===0)}let o=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,r=[0,31,28,31,30,31,30,31,31,30,31,30,31];function i(A){let F=o.exec(A);if(!F)return!1;let ee=+F[1],ne=+F[2],be=+F[3];return ne>=1&&ne<=12&&be>=1&&be<=(ne===2&&n(ee)?29:r[ne])}function a(A,F){if(A&&F)return A>F?1:A<F?-1:0}let s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(A){return function(ee){let ne=s.exec(ee);if(!ne)return!1;let be=+ne[1],je=+ne[2],xe=+ne[3],Le=ne[4],we=ne[5]==="-"?-1:1,x=+(ne[6]||0),D=+(ne[7]||0);if(x>23||D>59||A&&!Le)return!1;if(be<=23&&je<=59&&xe<60)return!0;let G=je-D*we,k=be-x*we-(G<0?1:0);return(k===23||k===-1)&&(G===59||G===-1)&&xe<61}}function l(A,F){if(!(A&&F))return;let ee=new Date("2020-01-01T"+A).valueOf(),ne=new Date("2020-01-01T"+F).valueOf();if(ee&&ne)return ee-ne}function u(A,F){if(!(A&&F))return;let ee=s.exec(A),ne=s.exec(F);if(ee&&ne)return A=ee[1]+ee[2]+ee[3],F=ne[1]+ne[2]+ne[3],A>F?1:A<F?-1:0}let p=/t|\s/i;function f(A){let F=c(A);return function(ne){let be=ne.split(p);return be.length===2&&i(be[0])&&F(be[1])}}function b(A,F){if(!(A&&F))return;let ee=new Date(A).valueOf(),ne=new Date(F).valueOf();if(ee&&ne)return ee-ne}function g(A,F){if(!(A&&F))return;let[ee,ne]=A.split(p),[be,je]=F.split(p),xe=a(ee,be);if(xe!==void 0)return xe||l(ne,je)}let S=/\/|:/,_=/^(?:[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;function h(A){return S.test(A)&&_.test(A)}let w=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function v(A){return w.lastIndex=0,w.test(A)}let $=-(2**31),I=2**31-1;function z(A){return Number.isInteger(A)&&A<=I&&A>=$}function y(A){return Number.isInteger(A)}function R(){return!0}let O=/[^\\]\\Z/;function L(A){if(O.test(A))return!1;try{return new RegExp(A),!0}catch{return!1}}})),LI=K((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;let t=YS(),n=ve(),o=n.operators,r={formatMaximum:{okStr:"<=",ok:o.LTE,fail:o.GT},formatMinimum:{okStr:">=",ok:o.GTE,fail:o.LT},formatExclusiveMaximum:{okStr:"<",ok:o.LT,fail:o.GTE},formatExclusiveMinimum:{okStr:">",ok:o.GT,fail:o.LTE}},i={message:({keyword:s,schemaCode:c})=>(0,n.str)`should be ${r[s].okStr} ${c}`,params:({keyword:s,schemaCode:c})=>(0,n._)`{comparison: ${r[s].okStr}, limit: ${c}}`};e.formatLimitDefinition={keyword:Object.keys(r),type:"string",schemaType:"string",$data:!0,error:i,code(s){let{gen:c,data:l,schemaCode:u,keyword:p,it:f}=s,{opts:b,self:g}=f;if(!b.validateFormats)return;let S=new t.KeywordCxt(f,g.RULES.all.format.definition,"format");S.$data?_():h();function _(){let v=c.scopeValue("formats",{ref:g.formats,code:b.code.formats}),$=c.const("fmt",(0,n._)`${v}[${S.schemaCode}]`);s.fail$data((0,n.or)((0,n._)`typeof ${$} != "object"`,(0,n._)`${$} instanceof RegExp`,(0,n._)`typeof ${$}.compare != "function"`,w($)))}function h(){let v=S.schema,$=g.formats[v];if(!$||$===!0)return;if(typeof $!="object"||$ instanceof RegExp||typeof $.compare!="function")throw new Error(`"${p}": format "${v}" does not define "compare" function`);let I=c.scopeValue("formats",{key:v,ref:$,code:b.code.formats?(0,n._)`${b.code.formats}${(0,n.getProperty)(v)}`:void 0});s.fail$data(w(I))}function w(v){return(0,n._)`${v}.compare(${l}, ${u}) ${r[p].fail} 0`}},dependencies:["format"]};let a=s=>(s.addKeyword(e.formatLimitDefinition),s);e.default=a})),FI=K(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});let n=UI(),o=LI(),r=ve(),i=new r.Name("fullFormats"),a=new r.Name("fastFormats"),s=(l,u={keywords:!0})=>{if(Array.isArray(u))return c(l,u,n.fullFormats,i),l;let[p,f]=u.mode==="fast"?[n.fastFormats,a]:[n.fullFormats,i];return c(l,u.formats||n.formatNames,p,f),u.keywords&&(0,o.default)(l),l};s.get=(l,u="full")=>{let p=(u==="fast"?n.fastFormats:n.fullFormats)[l];if(!p)throw new Error(`Unknown format "${l}"`);return p};function c(l,u,p,f){var b,g;(b=(g=l.opts.code).formats)!==null&&b!==void 0||(g.formats=(0,r._)`require("ajv-formats/dist/formats").${f}`);for(let S of u)l.addFormat(S,p[S])}t.exports=e=s,Object.defineProperty(e,"__esModule",{value:!0}),e.default=s})),VI=YS(),ZI=DI(),GI=La(FI(),1),JI=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),HI=GI.default;function BI(){let e=new ZI.Ajv2020({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return HI(e),e}var Au=class{_ajv;_userAjv;constructor(e){this._userAjv=e!==void 0,this._ajv=e}get ajv(){return this._ajv??=BI()}getValidator(e){if(!this._userAjv&&"$schema"in e&&typeof e.$schema=="string"&&!JI.has(e.$schema.replace(/#$/,""))){let o=e.$schema.slice(0,200);throw new Error(`JSON Schema declares an unsupported dialect ("$schema": "${o}"). The default validator supports JSON Schema 2020-12 only; pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.`)}let t=this.ajv,n="$id"in e&&typeof e.$id=="string"?t.getSchema(e.$id)??t.compile(e):t.compile(e);return o=>n(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:t.errorsText(n.errors)}}},vO=VI.Ajv;import yv from"process";var $v=Symbol.for("mcp.completable");function wv(e,t){return Object.defineProperty(e,$v,{value:{complete:t},enumerable:!1,writable:!1,configurable:!1}),e}function Sv(e){return!!e&&typeof e=="object"&&$v in e}function WI(e){return e[$v]?.complete}function YI(e,t){switch(t.kind){case"tools_list_changed":return e.toolsListChanged===!0;case"prompts_list_changed":return e.promptsListChanged===!0;case"resources_list_changed":return e.resourcesListChanged===!0;case"resource_updated":return e.resourceSubscriptions!==void 0&&e.resourceSubscriptions.includes(t.uri)}}function XI(e,t){let n={},o=r=>t===void 0||r===!0;return e.toolsListChanged===!0&&o(t?.tools?.listChanged)&&(n.toolsListChanged=!0),e.promptsListChanged===!0&&o(t?.prompts?.listChanged)&&(n.promptsListChanged=!0),e.resourcesListChanged===!0&&o(t?.resources?.listChanged)&&(n.resourcesListChanged=!0),e.resourceSubscriptions!==void 0&&e.resourceSubscriptions.length>0&&o(t?.resources?.subscribe)&&(n.resourceSubscriptions=[...e.resourceSubscriptions]),n}var Mu=1024;function e$(e,t){return{method:e.method,params:{...e.params,_meta:{...e.params?._meta,[nn]:t}}}}function QI(e){let t=Er(aa).validateRequest("subscriptions/listen",e);return t.ok?t.value.params?.notifications:void 0}var eP=new Set(["notifications/tools/list_changed","notifications/prompts/list_changed","notifications/resources/list_changed","notifications/resources/updated"]),c$=class{_subs=new Map;_serverCapabilities;_serverInfo;constructor(e=Mu,t,n){this._maxSubscriptions=e,this._serverCapabilities=t,this._serverInfo=n}setServerCapabilities(e,t){this._serverCapabilities=e,t!==void 0&&(this._serverInfo=t)}has(e){return this._subs.has(e)}serve(e){if(this._serverCapabilities===void 0)throw new Error("StdioListenRouter.serve() called before setServerCapabilities(); refusing to honor a filter without capabilities");if(this._subs.size>=this._maxSubscriptions)return{jsonrpc:"2.0",id:e.id,error:{code:-32603,message:"Subscription limit reached"}};let t=QI(e);if(t===void 0)return{jsonrpc:"2.0",id:e.id,error:{code:-32602,message:"Invalid params: 'notifications' is required and must be a valid SubscriptionFilter"}};let n=XI(t,this._serverCapabilities);return this._subs.set(e.id,n),e$({method:"notifications/subscriptions/acknowledged",params:{notifications:n}},e.id)}cancel(e){return this._subs.delete(e)}routeOutbound(e){if(!eP.has(e.method))return"passthrough";let t=e.params?.uri,n=typeof t=="string"?t:void 0,o=tP(e.method,n),r=[];for(let[i,a]of this._subs)YI(a,o)&&r.push(e$({method:e.method,params:e.params??{}},i));return r}teardownAll(){let e=[];for(let t of this._subs.keys())e.push({jsonrpc:"2.0",id:t,result:{resultType:"complete",_meta:{[nn]:t,...this._serverInfo!==void 0&&{[Ut]:this._serverInfo}}}});return this._subs.clear(),e}};function tP(e,t){switch(e){case"notifications/tools/list_changed":return{kind:"tools_list_changed"};case"notifications/prompts/list_changed":return{kind:"prompts_list_changed"};case"notifications/resources/list_changed":return{kind:"resources_list_changed"};default:return{kind:"resource_updated",uri:t??""}}}var rP=8,nP=6e5;function oP(e){if(e?.maxRounds!==void 0&&(!Number.isInteger(e.maxRounds)||e.maxRounds<1))throw new RangeError(`inputRequired.maxRounds must be a positive integer (got ${e.maxRounds})`);if(e?.roundTimeoutMs!==void 0&&(!Number.isFinite(e.roundTimeoutMs)||e.roundTimeoutMs<=0))throw new RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${e.roundTimeoutMs})`);return{maxRounds:e?.maxRounds??rP,roundTimeoutMs:e?.roundTimeoutMs??nP,legacyShim:e?.legacyShim??!0}}function l$(e,t,n){if(n===null||typeof n!="object"||typeof n.method!="string")throw new le(X.InternalError,`Handler for ${e} returned an invalid input request '${t}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);let o=n,r=oS(o);if(r===void 0)throw new le(X.InternalError,`Handler for ${e} returned an input request '${t}' of kind '${o.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:o,required:r}}function iP(){let e=globalThis.crypto;if(e?.randomUUID!==void 0)return e.randomUUID();let t=new Uint8Array(16);e.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=[...t].map(o=>o.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}function bv(e,t){if(e==="tools/call")return{content:[{type:"text",text:t}],isError:!0};throw new le(X.InternalError,t)}var aP=class{constructor(e){this._host=e}async fulfill(e,t,n,o,r){let{maxRounds:i,roundTimeoutMs:a}=this._host,s=o.mcpReq.signal,c=r,l=0;for(;;){if(l+=1,l>i)return bv(e,kS(e,i));let u=c.inputRequests,p=u!=null&&Object.keys(u).length>0,f=typeof c.requestState=="string"?c.requestState:void 0;if(!p&&f===void 0)throw new le(X.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);let b;if(p){let _=this._host.resolvedClientCapabilities(o),h=[];for(let[v,$]of Object.entries(u)){let{embedded:I,required:z}=l$(e,v,$);if(I.method!=="roots/list"&&I.params===void 0)throw new le(X.InternalError,`Handler for ${e} returned an input request '${v}' of kind '${I.method}' without params`);if(yu(z,_)!==void 0)return bv(e,`Cannot request input '${v}' (${I.method}): the client on this 2025-era connection did not declare the required capability${_===void 0?" (no client capabilities are available on this connection \u2014 per-request legacy serving cannot receive server-to-client requests)":""}`);h.push([v,I])}let w=PS(s);try{let v={relatedRequestId:o.mcpReq.id,timeout:a,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:w.signal},$=await Promise.all(h.map(async([I,z])=>{try{return[I,await this._dispatchLeg(z,v)]}catch(y){throw w.abort(y),y}}));b=Object.fromEntries($)}catch(v){if(s.aborted)throw v;return bv(e,`Fulfilling input required by '${e}' failed: ${v instanceof Error?v.message:String(v)}`)}finally{w.dispose()}}else await IS(RS,s);let g={...o,mcpReq:{...o.mcpReq,inputResponses:b,droppedInputResponseKeys:void 0,requestState:sa(f)}};if(f!==void 0){let _=await this._host.verifyRequestState(f,g,e);_!==void 0&&(g=lv(g,_))}let S=await t(n,g);if(!Qt(S))return S;c=S}}async _dispatchLeg(e,t){switch(e.method){case"elicitation/create":{let n=e.params;return n.mode==="url"&&n.elicitationId===void 0&&(n={...n,elicitationId:iP()}),await this._host.sendElicitation(n,t)}case"sampling/createMessage":return await this._host.sendSampling(e.params,t);case"roots/list":return await this._host.listRoots(e.params,t)}}},sP=new Set(["tools/call","prompts/get","resources/read"]),cP,u$,d$;function zv(e,t){u$(e,t)}function Rv(e){return d$(e)}var m$=class extends dv{_clientCapabilities;_clientVersion;static{cP=(e,t)=>{t.clientCapabilities!==void 0&&(e._clientCapabilities=t.clientCapabilities),t.clientInfo!==void 0&&(e._clientVersion=t.clientInfo)},u$=(e,t)=>{let n=t.filter(o=>!e._supportedProtocolVersions.includes(o));n.length>0&&(e._supportedProtocolVersions=[...e._supportedProtocolVersions,...n]),e.setRequestHandler("server/discover",()=>e._ondiscover())},d$=e=>e._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new aP({maxRounds:this._inputRequiredServing.maxRounds,roundTimeoutMs:this._inputRequiredServing.roundTimeoutMs,resolvedClientCapabilities:e=>this._inputRequestCapabilityView(e),verifyRequestState:(e,t,n)=>this._verifyRequestState(e,t,n),sendElicitation:(e,t)=>this._sendElicitationLeg(e,t,{validateAcceptedContent:!1}),sendSampling:(e,t)=>this.createMessage(e,t),listRoots:(e,t)=>this.listRoots(e,t)})}oninitialized;constructor(e,t){if(super(t),this._serverInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new Au,this._requestStateVerify=t?.requestState?.verify,this._inputRequiredServing=oP(t?.inputRequired),t?.cacheHints!==void 0){for(let[n,o]of Object.entries(t.cacheHints))o!==void 0&&ev(o,`cacheHints['${n}']`);this._cacheHints=t.cacheHints}this.setRequestHandler("initialize",n=>this._oninitialize(n)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),Bg(this._supportedProtocolVersions).length>0&&this.setRequestHandler("server/discover",()=>this._ondiscover()),this._capabilities.logging&&this._registerLoggingHandler()}_registerLoggingHandler(){this.setRequestHandler("logging/setLevel",async(e,t)=>{let n=t.sessionId||t.http?.req?.headers.get("mcp-session-id")||void 0,{level:o}=e.params,r=Iu(Pr,o);return r.success&&this._loggingLevels.set(n,r.data),{}})}buildContext(e,t){let n=e.http||t?.request||t?.closeSSEStream||t?.closeStandaloneSSEStream;return{...e,mcpReq:{...e.mcpReq,log:(o,r,i)=>{if(!this._capabilities.logging)return Promise.resolve();let a;if(this._servedModernEra()){if(a=e.mcpReq.envelope?.[$r],a===void 0)return Promise.resolve()}else a=this._loggingLevels.get(e.sessionId)??this._loggingLevels.get(void 0);return a!==void 0&&this.LOG_LEVEL_SEVERITY.get(o)<this.LOG_LEVEL_SEVERITY.get(a)?Promise.resolve():e.mcpReq.notify({method:"notifications/message",params:{level:o,data:r,logger:i}})},elicitInput:(o,r)=>this.elicitInput(o,r),requestSampling:(o,r)=>this.createMessage(o,r)},http:n?{...e.http,req:t?.request,closeSSE:t?.closeSSEStream,closeStandaloneSSE:t?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map(Pr.options.map((e,t)=>[e,t]));isMessageIgnored=(e,t)=>{let n=this._loggingLevels.get(t);return n?this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(n):!1};registerCapabilities(e){if(this.transport)throw new he(Se.AlreadyConnected,"Cannot register capabilities after connecting to transport");let t=!!this._capabilities.logging;this._capabilities=mv(this._capabilities,e),!t&&this._capabilities.logging&&this._registerLoggingHandler()}_wrapHandler(e,t){if(e!=="tools/call"){let n=this._cacheHints?.[e],o=sP.has(e);return n===void 0&&!o?async(r,i)=>{let a=await t(r,i);if(Qt(a))throw new le(X.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return a}:async(r,i)=>{let a=o?await this._invokeInputRequiredCapableHandler(e,t,r,i):await t(r,i);if(Qt(a)){if(!o)throw new le(X.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return a}return n===void 0?a:bu(a,n)}}return async(n,o)=>{let r=Er(this._negotiatedProtocolVersion),i=r.validateRequest("tools/call",n);if(!i.ok)throw new le(i.reason==="not-in-era"?X.InternalError:X.InvalidParams,i.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call request: ${i.message}`);let a=await this._invokeInputRequiredCapableHandler("tools/call",t,n,o);if(Qt(a))return a;let s=Kg(a),c=r.validateResult("tools/call",s);if(!c.ok)throw new le(c.reason==="not-in-era"?X.InternalError:X.InvalidParams,c.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call result: ${c.message}`);return c.value}}_servedModernEra(){return this._negotiatedProtocolVersion!==void 0&&go(this._negotiatedProtocolVersion)}async _invokeInputRequiredCapableHandler(e,t,n,o){let r=this._servedModernEra(),i=o.mcpReq.requestState();if(i!==void 0&&typeof i!="string")throw new le(X.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"});let a=o;if(typeof i=="string"){let p=await this._verifyRequestState(i,o,e);p!==void 0&&(a=lv(o,p))}let s;try{s=await t(n,a)}catch(p){throw p instanceof le&&p.code===X.UrlElicitationRequired&&r?new le(X.InternalError,`URL elicitation cannot be signalled by throwing UrlElicitationRequiredError on protocol revision ${this._negotiatedProtocolVersion}: return inputRequired({ inputRequests: { \u2026: inputRequired.elicitUrl(...) } }) from the handler instead. The urlElicitationRequired error (-32042) of earlier revisions is not available on this revision.`):p}if(!Qt(s))return s;if(!r){if(!this._inputRequiredServing.legacyShim)throw new le(X.InternalError,`Handler for ${e} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??rn}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(e,t,n,a,s)}let c=s.inputRequests,l=c!=null&&Object.keys(c).length>0,u=typeof s.requestState=="string";if(!l&&!u)throw new le(X.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(l){let p=this._inputRequestCapabilityView(o);for(let[f,b]of Object.entries(c)){let{embedded:g,required:S}=l$(e,f,b),_=yu(S,p);if(_!==void 0)throw new $u({requiredCapabilities:_},`Cannot request input '${f}' (${g.method}): the request's client capabilities do not declare the required capability`)}}return s}async _verifyRequestState(e,t,n){if(this._requestStateVerify!==void 0)try{return await this._requestStateVerify(e,t)}catch(o){throw this.onerror?.(new Error(`requestState verification rejected ${n}: ${o instanceof Error?o.message:String(o)}`)),new le(X.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(e){return this._servedModernEra()?e.mcpReq.envelope?.[Yt]:this._clientCapabilities}_assertPushApiInServedEra(e){if(this._servedModernEra())throw new he(Se.MethodNotSupportedByProtocolVersion,`Server-to-client requests are not available on protocol revision ${this._negotiatedProtocolVersion}: '${e}' cannot be sent while serving a request on that revision. Return inputRequired({ ... }) from the handler instead \u2014 the client fulfils the embedded requests and retries the original request (multi round-trip requests).`,{method:e,era:"2026-07-28"})}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new he(Se.CapabilityNotSupported,`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new he(Se.CapabilityNotSupported,`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new he(Se.CapabilityNotSupported,`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new he(Se.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new he(Se.CapabilityNotSupported,`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new he(Se.CapabilityNotSupported,`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new he(Se.CapabilityNotSupported,`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new he(Se.CapabilityNotSupported,`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"completion/complete":if(!this._capabilities.completions)throw new he(Se.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new he(Se.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new he(Se.CapabilityNotSupported,`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new he(Se.CapabilityNotSupported,`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new he(Se.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let t=e.params.protocolVersion;this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo;let n=aS(this._supportedProtocolVersions),o=n.includes(t)?t:n[0]??rn;return this._negotiatedProtocolVersion=o,this.transport?.setProtocolVersion?.(o),{protocolVersion:o,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:Bg(this._supportedProtocolVersions),capabilities:lP(this.getCapabilities()),...this._instructions&&{instructions:this._instructions}}}_outboundServerInfo(){return this._serverInfo}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}projectCallToolResult(e,t){return this._wireCodec().projectCallToolResult(e,t)}getCapabilities(){return this._capabilities}async ping(){return this._assertPushApiInServedEra("ping"),this.request({method:"ping"})}async createMessage(e,t){if(this._assertPushApiInServedEra("sampling/createMessage"),(e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new he(Se.CapabilityNotSupported,"Client does not support sampling tools capability.");if(e.messages.length>0){let i=e.messages.at(-1),a=Array.isArray(i.content)?i.content:[i.content],s=a.some(p=>p.type==="tool_result"),c=e.messages.length>1?e.messages.at(-2):void 0,l=c?Array.isArray(c.content)?c.content:[c.content]:[],u=l.some(p=>p.type==="tool_use");if(s){if(a.some(p=>p.type!=="tool_result"))throw new le(X.InvalidParams,"The last message must contain only tool_result content if any is present");if(!u)throw new le(X.InvalidParams,"tool_result blocks are not matching any tool_use from the previous message")}if(u){let p=new Set(l.filter(b=>b.type==="tool_use").map(b=>b.id)),f=new Set(a.filter(b=>b.type==="tool_result").map(b=>b.toolUseId));if(p.size!==f.size||![...p].every(b=>f.has(b)))throw new le(X.InvalidParams,"ids of tool_result blocks and tool_use blocks from previous message do not match")}}let n=!!(e.tools||e.toolChoice),o=await this.request({method:"sampling/createMessage",params:e},t),r=this._wireCodec().samplingResultVariant(n,o);if(!r.ok)throw new he(Se.InvalidResult,`Invalid sampling/createMessage result: ${r.reason==="invalid"?r.message:r.reason}`);return r.value}async elicitInput(e,t){switch(this._assertPushApiInServedEra("elicitation/create"),e.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw new he(Se.CapabilityNotSupported,"Client does not support url elicitation.");break;case"form":if(!this._clientCapabilities?.elicitation?.form)throw new he(Se.CapabilityNotSupported,"Client does not support form elicitation.");break}return this._sendElicitationLeg(e,t)}async _sendElicitationLeg(e,t,n){let o=e.mode??"form",r=n?.validateAcceptedContent??!0;switch(o){case"url":{let i=e;return this.request({method:"elicitation/create",params:i},t)}case"form":{let i=e.mode==="form"?e:{...e,mode:"form"},a=await this.request({method:"elicitation/create",params:i},t);if(r&&a.action==="accept"&&a.content&&i.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(i.requestedSchema)(a.content);if(!s.valid)throw new le(X.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(s){throw s instanceof le?s:new le(X.InternalError,`Error validating elicitation response: ${s instanceof Error?s.message:String(s)}`)}return a}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw new he(Se.CapabilityNotSupported,"Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this._assertPushApiInServedEra("roots/list"),this.request({method:"roots/list",params:e},t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};function lP(e){return{...e}}var da=class{server;_registeredResources={};_registeredResourceTemplates={};_registeredTools={};_registeredPrompts={};_toolInputSchemaJson={};toolInputSchemaJson(e){let t=this._registeredTools[e];if(!(t===void 0||!t.enabled)){if(Object.hasOwn(this._toolInputSchemaJson,e))return this._toolInputSchemaJson[e];if(t.inputSchema===void 0)return r$;try{let n=jr(t.inputSchema,"input");return this._toolInputSchemaJson[e]=n,n}catch{return}}}constructor(e,t){this.server=new m$(e,t),t?.capabilities?.tools&&this.setToolRequestHandlers(),t?.capabilities?.resources&&this.setResourceRequestHandlers(),t?.capabilities?.prompts&&this.setPromptRequestHandlers()}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}_toolHandlersInitialized=!1;setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler("tools/list"),this.server.assertCanSetRequestHandler("tools/call"),this.server.registerCapabilities({tools:{listChanged:this.server.getCapabilities().tools?.listChanged??!0}}),this.server.setRequestHandler("tools/list",()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let n={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?jr(t.inputSchema,"input"):r$,annotations:t.annotations,icons:t.icons,execution:t.execution,_meta:t._meta};return t.outputSchema&&(n.outputSchema=jr(t.outputSchema,"output")),n})})),this.server.setRequestHandler("tools/call",async(e,t)=>{let n=this._registeredTools[e.params.name];if(!n)throw new le(X.InvalidParams,`Tool ${e.params.name} not found`);if(!n.enabled)throw new le(X.InvalidParams,`Tool ${e.params.name} disabled`);try{let o=await this.validateToolInput(n,e.params.arguments,e.params.name),r=await this.executeToolHandler(n,o,t);return await this.validateToolOutput(n,r,e.params.name),Qt(r)?r:this.server.projectCallToolResult(r,n.outputSchemaJson)}catch(o){if(o instanceof le&&o.code===X.UrlElicitationRequired)throw o;return this.createToolError(o instanceof Error?o.message:String(o))}}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,n){if(!e.inputSchema)return;let o=await sn(e.inputSchema,t??{});if(!o.success)throw new le(X.InvalidParams,`Input validation error: Invalid arguments for tool ${n}: ${o.error}`);return o.data}async validateToolOutput(e,t,n){if(!e.outputSchema||Qt(t)||t.isError)return;if(t.structuredContent===void 0)throw new le(X.InvalidParams,`Output validation error: Tool ${n} has an output schema but no structured content was provided`);let o=await sn(e.outputSchema,t.structuredContent);if(!o.success)throw new le(X.InvalidParams,`Output validation error: Invalid structured content for tool ${n}: ${o.error}`)}async executeToolHandler(e,t,n){return e.executor(t,n)}_completionHandlerInitialized=!1;setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler("completion/complete"),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler("completion/complete",async e=>{switch(e.params.ref.type){case"ref/prompt":return nv(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return ov(e),this.handleResourceCompletion(e,e.params.ref);default:throw new le(X.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,t){let n=this._registeredPrompts[t.name];if(!n)throw new le(X.InvalidParams,`Prompt ${t.name} not found`);if(!n.enabled)throw new le(X.InvalidParams,`Prompt ${t.name} disabled`);if(!n.argsSchema)return ua;let o=s$(a$(n.argsSchema)?.[e.params.argument.name]);if(!Sv(o))return ua;let r=WI(o);return r?i$(await r(e.params.argument.value,e.params.context)):ua}async handleResourceCompletion(e,t){let n=Object.values(this._registeredResourceTemplates).find(r=>r.resourceTemplate.uriTemplate.toString()===t.uri);if(!n){if(this._registeredResources[t.uri])return ua;throw new le(X.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let o=n.resourceTemplate.completeCallback(e.params.argument.name);return o?i$(await o(e.params.argument.value,e.params.context)):ua}_resourceHandlersInitialized=!1;setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler("resources/list"),this.server.assertCanSetRequestHandler("resources/templates/list"),this.server.assertCanSetRequestHandler("resources/read"),this.server.registerCapabilities({resources:{listChanged:this.server.getCapabilities().resources?.listChanged??!0}}),this.server.setRequestHandler("resources/list",async(e,t)=>{let n=Object.entries(this._registeredResources).filter(([r,i])=>i.enabled).map(([r,i])=>({uri:r,name:i.name,...i.metadata})),o=[];for(let r of Object.values(this._registeredResourceTemplates)){if(!r.resourceTemplate.listCallback)continue;let i=await r.resourceTemplate.listCallback(t);for(let a of i.resources)o.push({...r.metadata,...a})}return{resources:[...n,...o]}}),this.server.setRequestHandler("resources/templates/list",async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([e,t])=>({name:e,uriTemplate:t.resourceTemplate.uriTemplate.toString(),...t.metadata}))})),this.server.setRequestHandler("resources/read",async(e,t)=>{let n;try{n=new URL(e.params.uri)}catch{throw new le(X.InvalidParams,`Resource URI ${e.params.uri} is invalid`,{uri:e.params.uri,reason:"invalid_uri"})}let o=this._registeredResources[n.toString()];if(o){if(!o.enabled)throw new le(X.InvalidParams,`Resource ${n} disabled`);return bu(await o.readCallback(n,t),o.cacheHint)}for(let r of Object.values(this._registeredResourceTemplates)){let i=r.resourceTemplate.uriTemplate.match(n.toString());if(i)return bu(await r.readCallback(n,i,t),r.cacheHint)}throw new Su(e.params.uri)}),this._resourceHandlersInitialized=!0)}_promptHandlersInitialized=!1;setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler("prompts/list"),this.server.assertCanSetRequestHandler("prompts/get"),this.server.registerCapabilities({prompts:{listChanged:this.server.getCapabilities().prompts?.listChanged??!0}}),this.server.setRequestHandler("prompts/list",()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?zS(t.argsSchema):void 0,icons:t.icons,_meta:t._meta}))})),this.server.setRequestHandler("prompts/get",async(e,t)=>{let n=this._registeredPrompts[e.params.name];if(!n)throw new le(X.InvalidParams,`Prompt ${e.params.name} not found`);if(!n.enabled)throw new le(X.InvalidParams,`Prompt ${e.params.name} disabled`);return n.handler(e.params.arguments,t)}),this._promptHandlersInitialized=!0)}registerResource(e,t,n,o){let r=n.cacheHint,i=n;if(r!==void 0){ev(r,`resource ${e}`);let a={...n};delete a.cacheHint,i=a}if(typeof t=="string"){if(this._registeredResources[t])throw new Error(`Resource ${t} is already registered`);let a=this._createRegisteredResource(e,n.title,t,i,o);return r!==void 0&&(a.cacheHint=r),this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let a=this._createRegisteredResourceTemplate(e,n.title,t,i,o);return r!==void 0&&(a.cacheHint=r),this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}}_createRegisteredResource(e,t,n,o,r){let i={name:e,title:t,metadata:o,readCallback:r,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:a=>{a.uri!==void 0&&a.uri!==n&&(delete this._registeredResources[n],a.uri&&(this._registeredResources[a.uri]=i)),a.name!==void 0&&(i.name=a.name),a.title!==void 0&&(i.title=a.title),a.metadata!==void 0&&(i.metadata=a.metadata),a.callback!==void 0&&(i.readCallback=a.callback),a.enabled!==void 0&&(i.enabled=a.enabled),this.sendResourceListChanged()}};return this._registeredResources[n]=i,i}_createRegisteredResourceTemplate(e,t,n,o,r){let i={resourceTemplate:n,title:t,metadata:o,readCallback:r,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:s=>{s.name!==void 0&&s.name!==e&&(delete this._registeredResourceTemplates[e],s.name&&(this._registeredResourceTemplates[s.name]=i)),s.title!==void 0&&(i.title=s.title),s.template!==void 0&&(i.resourceTemplate=s.template),s.metadata!==void 0&&(i.metadata=s.metadata),s.callback!==void 0&&(i.readCallback=s.callback),s.enabled!==void 0&&(i.enabled=s.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=i;let a=n.uriTemplate.variableNames;return Array.isArray(a)&&a.some(s=>!!n.completeCallback(s))&&this.setCompletionRequestHandler(),i}_createRegisteredPrompt(e,t,n,o,r,i,a){let s=o,c=r,l={title:t,description:n,argsSchema:o,icons:i,_meta:a,handler:o$(e,o,r),enabled:!0,disable:()=>l.update({enabled:!1}),enable:()=>l.update({enabled:!0}),remove:()=>l.update({name:null}),update:u=>{u.name!==void 0&&u.name!==e&&(delete this._registeredPrompts[e],u.name&&(this._registeredPrompts[u.name]=l)),u.title!==void 0&&(l.title=u.title),u.description!==void 0&&(l.description=u.description),u.icons!==void 0&&(l.icons=u.icons),u._meta!==void 0&&(l._meta=u._meta);let p=!1;u.argsSchema!==void 0&&(l.argsSchema=u.argsSchema,s=u.argsSchema,p=!0),u.callback!==void 0&&(c=u.callback,p=!0),p&&(l.handler=o$(e,s,c)),u.enabled!==void 0&&(l.enabled=u.enabled),this.sendPromptListChanged()}};if(this._registeredPrompts[e]=l,o){let u=a$(o);u&&Object.values(u).some(p=>Sv(s$(p)))&&this.setCompletionRequestHandler()}return l}_createRegisteredTool(e,t,n,o,r,i,a,s,c,l){if(hv(e),o!==void 0)try{let f=jr(o,"input");this._toolInputSchemaJson[e]=f;let b=iv(f);b.valid||console.warn(`[mcp-sdk] tool '${e}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${b.reason}`)}catch{}let u=l,p={title:t,description:n,inputSchema:o,outputSchema:r,outputSchemaJson:n$(r),annotations:i,icons:a,execution:s,_meta:c,handler:l,executor:t$(o,l),enabled:!0,disable:()=>p.update({enabled:!1}),enable:()=>p.update({enabled:!0}),remove:()=>p.update({name:null}),update:f=>{f.name!==void 0&&f.name!==e&&(typeof f.name=="string"&&hv(f.name),delete this._registeredTools[e],delete this._toolInputSchemaJson[e],f.name&&(delete this._toolInputSchemaJson[f.name],this._registeredTools[f.name]=p,e=f.name)),f.title!==void 0&&(p.title=f.title),f.description!==void 0&&(p.description=f.description);let b=!1;f.paramsSchema!==void 0&&(p.inputSchema=f.paramsSchema,delete this._toolInputSchemaJson[e],b=!0),f.callback!==void 0&&(p.handler=f.callback,u=f.callback,b=!0),b&&(p.executor=t$(p.inputSchema,u)),f.outputSchema!==void 0&&(p.outputSchema=f.outputSchema,p.outputSchemaJson=n$(f.outputSchema)),f.annotations!==void 0&&(p.annotations=f.annotations),f.icons!==void 0&&(p.icons=f.icons),f._meta!==void 0&&(p._meta=f._meta),f.enabled!==void 0&&(p.enabled=f.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=p,this.setToolRequestHandlers(),this.sendToolListChanged(),p}registerTool(e,t,n){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let{title:o,description:r,inputSchema:i,outputSchema:a,annotations:s,icons:c,_meta:l}=t;return this._createRegisteredTool(e,o,r,Pu(i),Pu(a),s,c,void 0,l,n)}registerPrompt(e,t,n){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let{title:o,description:r,argsSchema:i,icons:a,_meta:s}=t,c=this._createRegisteredPrompt(e,o,r,Pu(i),n,a,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),c}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};function t$(e,t){if(e){let o=t;return async(r,i)=>o(r,i)}let n=t;return async(o,r)=>n(r)}var r$={type:"object",properties:{}};function n$(e){if(e!==void 0)try{return jr(e,"output")}catch{return}}function o$(e,t,n){if(t){let o=n;return async(r,i)=>{let a=await sn(t,r);if(!a.success)throw new le(X.InvalidParams,`Invalid arguments for prompt ${e}: ${a.error}`);return o(a.data,i)}}else{let o=n;return async(r,i)=>o(i)}}function i$(e){return{completion:{values:e.map(String).slice(0,100),total:e.length,hasMore:e.length>100}}}var ua={completion:{values:[],hasMore:!1}};function a$(e){let t=e;if(t.shape&&typeof t.shape=="object")return t.shape}function uP(e){return e?.type==="optional"}function s$(e){return uP(e)?e.def?.innerType??e:e}var dP=class{_readBuffer;_started=!1;_closed=!1;constructor(e=yv.stdin,t=yv.stdout,n){this._stdin=e,this._stdout=t,this._readBuffer=new pv({maxBufferSize:n?.maxBufferSize})}onclose;onerror;onmessage;_ondata=e=>{try{this._readBuffer.append(e),this.processReadBuffer()}catch(t){this.onerror?.(t),this.close().catch(()=>{})}};_onerror=e=>{this.onerror?.(e)};_onstdouterror=e=>{this.onerror?.(e),this.close().catch(()=>{})};async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror),this._stdout.on("error",this._onstdouterror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._closed||(this._closed=!0,this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdout.off("error",this._onstdouterror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.())}send(e){return this._closed?Promise.reject(new Error("StdioServerTransport is closed")):new Promise((t,n)=>{let o=fv(e),r=!1,i=s=>{r||(r=!0,this._stdout.off("error",i),this._stdout.off("drain",a),n(s))},a=()=>{r||(r=!0,this._stdout.off("error",i),this._stdout.off("drain",a),t())};if(this._stdout.once("error",i),this._stdout.write(o)){if(r)return;r=!0,this._stdout.off("error",i),t()}else r||this._stdout.once("drain",a)})}},p$=3e3,mP=class{onclose;onerror;onmessage;_closed=!1;_pendingRequests=new Set;_drainWaiters=[];constructor(e,t,n){this._wire=e,this._onInstanceClose=t,this._outboundIntercept=n}async start(){}async send(e,t){if(oa(e)||ku(e)){let{id:n}=e;n!==void 0&&this._settle(n)}if(!this._closed&&this._outboundIntercept?.(e)!=="handled")return this._wire.send(e,t)}setProtocolVersion=e=>{this._wire.setProtocolVersion?.(e)};deliver(e,t){if(!this._closed){if($t(e))this._pendingRequests.add(e.id);else if(Or(e)&&e.method==="notifications/cancelled"){let n=e.params?.requestId;n!==void 0&&this._settle(n)}this.onmessage?.(e,t)}}async whenRequestsAnswered(e){return this._closed||this._pendingRequests.size===0?!0:await new Promise(t=>{let n=()=>{clearTimeout(o),t(!0)},o=setTimeout(()=>{this._drainWaiters=this._drainWaiters.filter(r=>r!==n),t(!1)},e);this._drainWaiters.push(n)})}async close(){if(!this._closed){this._closed=!0,this._pendingRequests.clear(),this._releaseDrainWaiters();try{this._onInstanceClose()}finally{this.onclose?.()}}}_settle(e){this._pendingRequests.delete(e),this._pendingRequests.size===0&&this._releaseDrainWaiters()}_releaseDrainWaiters(){let e=this._drainWaiters;this._drainWaiters=[];for(let t of e)t()}};function pP(e){let t=e.params;if(e.method==="initialize"&&!av(t)){let i=t!==null&&typeof t=="object"&&typeof t.protocolVersion=="string"?t.protocolVersion:void 0;return{kind:"legacy",reason:"initialize",...i!==void 0&&{requestedVersion:i}}}if(!wu(t))return{kind:"legacy",reason:"no-claim"};let n=ln(t),o=(n===void 0?[]:Ru(n))[0];if(o!==void 0)return{kind:"invalid-envelope",issue:o};let r=zu(t);return r===void 0||!xr.includes(r)?{kind:"unsupported-revision",requested:r??"unknown"}:{kind:"modern",revision:r,classification:{era:"modern",revision:r}}}function f$(e,t={}){let n=t.legacy??"serve",o=t.transport??new dP,r={phase:"opening"},i,a=!1,s=()=>a||r.phase==="closed",c=R=>{try{t.onerror?.(R)}catch{}},l=(R,O,L,A)=>o.send({jsonrpc:"2.0",id:R,error:{code:O,message:L,...A!==void 0&&{data:A}}}).catch(F=>c(Et(F))),u=new c$(t.maxSubscriptions??Mu),p=R=>{if(!Or(R))return;let O=u.routeOutbound(R);if(O!=="passthrough"){for(let L of O)o.send({jsonrpc:"2.0",...L}).catch(A=>c(Et(A)));return"handled"}},f=async R=>{if($t(R)&&R.method==="subscriptions/listen"){let O=ln(R.params),L=wu(R.params)?(O===void 0?[]:Ru(O))[0]:{key:"_meta",problem:"the per-request envelope is required on protocol revision 2026-07-28"},A=zu(R.params),F;if(L!==void 0)F={jsonrpc:"2.0",id:R.id,error:{code:-32602,message:`Invalid _meta envelope: ${L.key}: ${L.problem}`}};else if(A===void 0||!xr.includes(A)){let ee=new vo({supported:[...xr],requested:A??"unknown"});F={jsonrpc:"2.0",id:R.id,error:{code:ee.code,message:ee.message,data:ee.data}}}else F=u.serve(R);return await o.send("error"in F?F:{jsonrpc:"2.0",method:F.method,params:F.params}).catch(ee=>c(Et(ee))),!0}if(Or(R)&&R.method==="notifications/cancelled"){let O=R.params?.requestId;if(O!==void 0&&u.cancel(O))return!0}return!1},b=(R,O,L)=>{let A=sv({kind:"legacy",reason:O,...L!==void 0&&{requestedVersion:L}},xr);return A===void 0?Promise.resolve():(c(new Error(`Rejected 2025-era request on a modern-only stdio connection (${A.cell}): ${A.message}`)),l(R.id,A.code,A.message,A.data))},g=R=>{a||R===i||z()},S=async(R,O)=>{let L=await e({era:R}),A=L instanceof da?L.server:L;R==="modern"&&(uv(A,O),zv(A,xr),u.setServerCapabilities(A.getCapabilities(),Rv(A)));let F=new mP(o,()=>g(F),R==="modern"?p:void 0);return await L.connect(F),{product:L,channel:F}},_=R=>R.product.close().catch(O=>c(Et(O))),h=async R=>{i=R.channel;try{await R.channel.whenRequestsAnswered(p$)||c(new Error(`Discarded the probe instance with requests still unanswered after ${p$}ms; continuing with the fallback`)),await R.product.close()}catch(O){c(Et(O))}finally{i=void 0}},w=async R=>{if(r.phase==="closed")return;if(r.phase==="pinned"){if(r.era==="modern"&&$t(R)&&R.method==="initialize"&&!av(R.params)){await b(R,"initialize",R.params!==null&&typeof R.params=="object"&&typeof R.params.protocolVersion=="string"?R.params.protocolVersion:void 0);return}if(r.era==="modern"&&await f(R))return;r.instance.channel.deliver(R);return}if(!$t(R)&&!Or(R)){c(new Error("Discarded a JSON-RPC response received before the connection negotiated an era"));return}let O=pP(R);switch(O.kind){case"invalid-envelope":{let L=`Invalid _meta envelope for protocol revision 2026-07-28: ${O.issue.key}: ${O.issue.problem}`;$t(R)?await l(R.id,X.InvalidParams,L,{envelope:O.issue}):c(new Error(`Discarded a notification with a malformed envelope: ${L}`));return}case"unsupported-revision":if($t(R)){let L=new vo({supported:[...xr],requested:O.requested});c(L),await l(R.id,L.code,L.message,L.data)}else c(new Error(`Discarded a notification claiming unsupported protocol revision ${O.requested}`));return;case"modern":if($t(R)&&R.method==="server/discover"){if(r.phase==="probe"){r.instance.channel.deliver(R,{classification:O.classification});return}let L=await S("modern",O.revision);if(s()){await _(L);return}r={phase:"probe",instance:L},L.channel.deliver(R,{classification:O.classification});return}if(r.phase==="probe"){if(Or(R)){r.instance.channel.deliver(R,{classification:O.classification});return}r={phase:"pinned",era:"modern",instance:r.instance}}else{let L=await S("modern",O.revision);if(s()){await _(L);return}r={phase:"pinned",era:"modern",instance:L}}if(await f(R))return;r.instance.channel.deliver(R,{classification:O.classification});return;case"legacy":{if(n==="reject"){$t(R)&&await b(R,O.reason,O.requestedVersion);return}if(r.phase==="probe"){if(await h(r.instance),s())return;r={phase:"opening"}}let L=await S("legacy");if(s()){await _(L);return}r={phase:"pinned",era:"legacy",instance:L},r.instance.channel.deliver(R);return}}},v=[],$=!1,I=async()=>{if(!$){$=!0;try{for(;v.length>0;){let R=v.shift();try{await w(R)}catch(O){$t(R)&&await l(R.id,X.InternalError,"Internal server error"),c(Et(O))}}}finally{$=!1}}},z=async()=>{if(a||r.phase==="closed")return;a=!0;let R=r;r={phase:"closed"};for(let O of u.teardownAll())await o.send(O).catch(L=>c(Et(L)));(R.phase==="probe"||R.phase==="pinned")&&await R.instance.product.close().catch(O=>c(Et(O))),await o.close().catch(O=>c(Et(O)))};o.onmessage=R=>{v.push(R),I()},o.onerror=R=>{c(R),(r.phase==="probe"||r.phase==="pinned")&&r.instance.channel.onerror?.(R)},o.onclose=()=>{if(a||r.phase==="closed")return;a=!0;let R=r;r={phase:"closed"},(R.phase==="probe"||R.phase==="pinned")&&R.instance.product.close().catch(O=>c(Et(O)))};let y=o.start().catch(R=>{throw c(Et(R)),R});return y.catch(()=>{}),{close:async()=>{await y.catch(()=>{}),await z()}}}function Et(e){return e instanceof Error?e:new Error(String(e))}var fP=m.object({STEAM_API_KEY:m.string().min(1).optional(),STEAM_API_BASE_URL:m.string().url().default("https://api.steampowered.com"),STEAM_ID:m.string().min(2).optional(),STEAM_STORE_BASE_URL:m.string().url().default("https://store.steampowered.com"),STEAM_COUNTRY:m.string().min(2).max(2).default("US"),STEAM_LANGUAGE:m.string().min(2).default("english"),HTTP_TIMEOUT_MS:m.coerce.number().int().positive().default(15e3),HTTP_RETRIES:m.coerce.number().int().nonnegative().default(2),STEAM_STORE_MIN_INTERVAL_MS:m.coerce.number().int().nonnegative().default(250),STEAM_API_MIN_INTERVAL_MS:m.coerce.number().int().nonnegative().default(0),CACHE_TTL_MS:m.coerce.number().int().nonnegative().default(3e5),LOG_LEVEL:m.enum(["debug","info","warn","error","silent"]).default("info")}),hP=/^\$\{[^}]*\}$/;function h$(e=process.env){let t=Object.fromEntries(Object.entries(e).filter(([,o])=>o!==void 0&&o.trim()!==""&&!hP.test(o))),n=fP.parse(t);return{steamApiBaseUrl:n.STEAM_API_BASE_URL,steamApiKey:n.STEAM_API_KEY,defaultSteamId:n.STEAM_ID,steamStoreBaseUrl:n.STEAM_STORE_BASE_URL,country:n.STEAM_COUNTRY,language:n.STEAM_LANGUAGE,httpTimeoutMs:n.HTTP_TIMEOUT_MS,httpRetries:n.HTTP_RETRIES,storeMinIntervalMs:n.STEAM_STORE_MIN_INTERVAL_MS,apiMinIntervalMs:n.STEAM_API_MIN_INTERVAL_MS,cacheTtlMs:n.CACHE_TTL_MS,logLevel:n.LOG_LEVEL}}var Re=class extends Error{code;status;retryable;hadCredentials;unsafeDetail;constructor(t){super(t.message,t.cause===void 0?void 0:{cause:t.cause}),this.name="ApiError",this.code=t.code,this.status=t.status,this.retryable=t.retryable??!1,this.hadCredentials=t.hadCredentials,this.unsafeDetail=t.unsafeDetail??!1}};async function er(e,t,n){try{return await t()}catch(o){if(o instanceof Re&&o.code===e)return n;throw o}}function g$(e){return e===304?{code:"not_modified",retryable:!1}:e===401?{code:"unauthorized",retryable:!1}:e===403?{code:"forbidden",retryable:!1}:e===404?{code:"not_found",retryable:!1}:e===429?{code:"rate_limited",retryable:!0}:e===400||e===405||e===422?{code:"bad_request",retryable:!1}:e>=500?{code:"server_error",retryable:!0}:{code:"unknown",retryable:!1}}function kv(e){return e.replace(/Bearer\s+[A-Za-z0-9._~+/-]+=*/gi,"Bearer ***").replace(/\b(access_token|refresh_token|client_secret|client_id|api_key|apikey|key)=([^&\s"]+)/gi,"$1=***")}var v$={debug:10,info:20,warn:30,error:40,silent:100};function _$(e,t){let n=v$[e];function o(r,i,a){if(v$[r]<n)return;let s=a.length?" "+kv(a.map(l=>gP(l)).join(" ")):"",c=`${kv(i)}${s}`;if(console.error(`[steam-games-mcp] ${r}: ${c}`),t)try{t(r,c)}catch{}}return{debug:(r,...i)=>o("debug",r,i),info:(r,...i)=>o("info",r,i),warn:(r,...i)=>o("warn",r,i),error:(r,...i)=>o("error",r,i)}}function gP(e){if(typeof e=="string")return e;if(e instanceof Error)return e.message;try{return JSON.stringify(e)}catch{return String(e)}}var qu="0.10.5",y$=`steam-games-mcp/${qu} (+https://github.com/Grinv/steam-games-mcp)`;var b$=8e3,_o=class{#e;constructor(t){this.#e=t}async getJson(t,n={}){return this.requestJson(t,{...n,method:n.method??"GET"})}async requestJson(t,n={}){let o=this.#r(t,n.query),r=n.retries??this.#e.retries??2,i=n.timeoutMs??this.#e.timeoutMs??15e3,a=0;for(;;){this.#e.beforeRequest&&await this.#e.beforeRequest();try{return await this.#n(o,n,i)}catch(s){let c=s instanceof Re?s:S$(s);if(!c.retryable||a>=r)throw c;let l=yP(a,c);this.#e.logger.debug(`retrying ${o} after ${l}ms (attempt ${a+1}/${r}, ${c.code})`),await wP(l),a+=1}}}async#n(t,n,o){let r=new AbortController,i=setTimeout(()=>r.abort(),o),a=()=>r.abort();n.signal?.addEventListener("abort",a,{once:!0});let s;try{s=await fetch(t,{method:n.method??"GET",headers:{"User-Agent":y$,Accept:"application/json",...this.#e.defaultHeaders,...n.headers},...n.body===void 0?{}:{body:n.body},signal:r.signal})}catch(l){throw n.signal?.aborted?new Re({code:"network",message:"Request aborted by caller",cause:l}):r.signal.aborted?new Re({code:"timeout",message:`Request timed out after ${o}ms`,retryable:!0,cause:l}):S$(l)}finally{clearTimeout(i),n.signal?.removeEventListener("abort",a)}if(!s.ok)throw await vP(s,this.#e.hasCredentials);if(s.status===204)return;let c=await s.text();if(c.length!==0)try{return JSON.parse(c)}catch(l){throw new Re({code:"unknown",message:"Upstream returned invalid JSON",cause:l})}}#r(t,n){let o=new URL(t.replace(/^\//,""),$P(this.#e.baseUrl));if(n)for(let[r,i]of Object.entries(n))i!==void 0&&o.searchParams.set(r,String(i));return o.toString()}};async function vP(e,t){let{code:n,retryable:o}=g$(e.status),r="";try{r=await e.text()}catch{}let i=_P(r),a=i??r.slice(0,500),s=SP(e.headers.get("retry-after"));return new Re({code:n,status:e.status,retryable:o,hadCredentials:t,message:`HTTP ${e.status} ${e.statusText}${a?`: ${a}`:""}`,unsafeDetail:i===void 0&&r.length>0,...s===void 0?{}:{cause:{retryAfterMs:s}}})}function _P(e){if(e)try{let t=JSON.parse(e);if(t===null||typeof t!="object")return;let n=t;return typeof n.message=="string"?n.message:typeof n.error=="string"?n.error:void 0}catch{return}}function S$(e){return e instanceof Re?e:new Re({code:"network",message:e instanceof Error?`Network error: ${e.message}`:"Network error",retryable:!0,cause:e})}function yP(e,t){let n=t.cause?.retryAfterMs;if(typeof n=="number"&&n>0)return Math.min(n,b$);let o=Math.min(b$,500*2**e);return o+Math.floor(o*.25*bP(e))}function bP(e){return e*2654435761%1e3/1e3}function SP(e){if(!e)return;let t=Number(e);if(Number.isFinite(t))return t*1e3;let n=Date.parse(e);if(Number.isFinite(n))return Math.max(0,n-Date.now())}function $P(e){return e.endsWith("/")?e:e+"/"}function wP(e){return new Promise(t=>setTimeout(t,e))}var yo=class{#e;#n;#r;#t=[];#i=Promise.resolve();#a=null;constructor(t,n=[]){this.#e=Math.max(0,t),this.#n=n,this.#r=n.reduce((o,r)=>Math.max(o,r.windowMs),0)}acquire(){let t=this.#i,n;return this.#i=new Promise(o=>{n=o}),t.then(async()=>{let o=this.#s();o>0&&await zP(o);let r=Date.now();this.#a=r,this.#c(r),n()})}#s(){let t=Date.now(),n=this.#a!==null?this.#a+this.#e:0;for(let o of this.#n){if(this.#t.length<o.limit)continue;let r=this.#t[this.#t.length-o.limit];n=Math.max(n,r+o.windowMs)}return Math.max(0,n-t)}#c(t){this.#t.push(t);let n=t-this.#r,o=0;for(;o<this.#t.length&&this.#t[o]<=n;)o+=1;o>0&&this.#t.splice(0,o)}};function zP(e){return new Promise(t=>setTimeout(t,e))}var bo=class{#e;#n;#r=new Map;#t=new Map;constructor(t,n=500){this.#e=t,this.#n=n}get(t){let n=this.#r.get(t);if(n)return n.expires>Date.now()?n.value:void 0}getStale(t){return this.#r.get(t)?.value}set(t,n){if(!(this.#e<=0)){if(!this.#r.has(t)&&this.#r.size>=this.#n){let o=this.#r.keys().next().value;o!==void 0&&this.#r.delete(o)}this.#r.set(t,{value:n,expires:Date.now()+this.#e})}}async wrap(t,n){let o=this.get(t);return o!==void 0?o:this.#i(t,n)}async wrapStaleOnError(t,n){let o=this.get(t);if(o!==void 0)return o;try{return await this.#i(t,n)}catch(r){let i=this.getStale(t);if(i!==void 0)return i;throw r}}#i(t,n){let o=this.#t.get(t);if(o)return o;let r=n().then(i=>(this.set(t,i),i)).finally(()=>this.#t.delete(t));return this.#t.set(t,r),r}};var vt=m.object({found:m.literal(!1),reason:m.string()}).strict();function tr(e,...t){return m.union([e,...t])}var So=m.object({found:m.literal(!1),reason:m.string(),total:m.literal(0),items:m.array(m.never())}).strict(),Iv=m.object({found:m.literal(!1),reason:m.string(),total:m.literal(0),games:m.array(m.never())}).strict();function xt(e){return vt.parse({found:!1,reason:e})}var un="Profile or game-details are private. Ask the owner to set Steam \u2192 Privacy \u2192 Game details = Public, or this data can't be read.";function Pv(e){return(e??[]).map(t=>t.description??t.name).filter(t=>!!t)}function Ot(e){return typeof e=="number"?Math.round(e/60*10)/10:null}function ma(e){return e&&e.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim()||null}function pa(e,t){if(typeof e!="number")return null;let n=(e/100).toFixed(2);return t?`${n} ${t}`:n}function jt(e){return e?new Date(e*1e3).toISOString().slice(0,10):null}function $$(e){return e?new Date(e*1e3).toISOString().replace(/\.\d{3}Z$/,"Z"):null}function rr(e){return typeof e=="number"?`https://store.steampowered.com/app/${e}`:null}function dt(e,t){return{included:e.slice(0,t),returned:Math.min(e.length,t)}}var Tv=m.object({currency:m.string().nullable(),final:m.string().nullable(),initial:m.string().nullable(),discount_percent:m.number()}).strict(),RP=m.union([m.object({is_free:m.literal(!0)}).strict(),Tv.extend({is_free:m.literal(!1)})]).nullable(),kP=Tv.nullable(),Du=m.object({total:m.number(),results:m.array(m.object({appid:m.number().optional(),name:m.string().optional(),type:m.string().nullable(),price:kP,metascore:m.string().nullable(),platforms:m.array(m.string()),store_url:m.string().nullable()}).strict())}).strict(),Uu=m.object({appid:m.number().optional(),name:m.string().optional(),type:m.string().nullable(),short_description:m.string().nullable(),is_free:m.boolean(),price:RP,release_date:m.string().nullable(),coming_soon:m.boolean(),developers:m.array(m.string()),publishers:m.array(m.string()),genres:m.array(m.string()),categories:m.array(m.string()),platforms:m.array(m.string()),metacritic:m.number().nullable(),metacritic_url:m.string().nullable(),recommendations:m.number().nullable(),required_age:m.union([m.number(),m.string()]).nullable(),controller_support:m.string().nullable(),achievements_total:m.number().nullable(),achievements_highlighted:m.array(m.string()),supported_languages:m.string().nullable(),dlc:m.array(m.number()),demos:m.array(m.number()),content_descriptors:m.object({ids:m.array(m.number()),notes:m.string().nullable()}).strict(),base_game:m.object({appid:m.number(),name:m.string().nullable()}).strict().nullable(),drm_notice:m.string().nullable(),account_notice:m.string().nullable(),pc_requirements_min:m.string().nullable(),website:m.string().nullable(),header_image:m.string().nullable(),store_url:m.string().nullable()}).strict(),Lu=m.object({summary:m.string().nullable(),total_reviews:m.number().nullable(),total_positive:m.number().nullable(),total_negative:m.number().nullable(),positive_pct:m.number().nullable(),reviews:m.array(m.object({voted_up:m.boolean().nullable(),votes_up:m.number(),author_playtime_hours:m.number().nullable(),text:m.string().nullable()}).strict())}).strict(),Fu=m.object({count:m.number(),prices:m.array(m.union([m.object({appid:m.number(),available:m.literal(!1)}).strict(),m.object({appid:m.number(),available:m.literal(!0),is_free:m.literal(!0)}).strict(),Tv.extend({appid:m.number(),available:m.literal(!0),is_free:m.literal(!1)})]))}).strict(),fa=m.object({appid:m.number().optional(),name:m.string().optional(),discounted:m.boolean(),discount_percent:m.number(),original_price:m.string().nullable(),final_price:m.string().nullable(),store_url:m.string().nullable()}).strict(),Vu=m.object({specials:m.array(fa)}).strict(),Zu=m.object({specials:m.array(fa),top_sellers:m.array(fa),new_releases:m.array(fa),coming_soon:m.array(fa)}).strict(),w$=m.object({date:m.string().nullable(),up:m.number(),down:m.number(),positive_pct:m.number().nullable()}).strict(),Gu=m.object({rollup_type:m.string().nullable().describe("Granularity of each `history` entry's date bucket, e.g. 'week' or 'month' \u2014 chosen server-side by Steam and passed through as a free-form string (not validated or enumerated here), so don't assume a fixed set of possible values."),history:m.array(w$),recent:m.array(w$)}).strict();function R$(e){return{currency:e.currency??null,final:e.final_formatted??null,initial:e.initial_formatted||e.final_formatted||null,discount_percent:e.discount_percent??0}}function IP(e,t){return t?{is_free:!0}:e?{is_free:!1,...R$(e)}:null}function k$(e){return e?Object.entries(e).filter(([,t])=>t).map(([t])=>t):[]}function I$(e){let t=Array.isArray(e.pc_requirements)?void 0:e.pc_requirements;return Uu.parse({appid:e.steam_appid,name:e.name,type:e.type??null,short_description:e.short_description||null,is_free:e.is_free??!1,price:IP(e.price_overview,e.is_free),release_date:e.release_date?.date||null,coming_soon:e.release_date?.coming_soon??!1,developers:e.developers??[],publishers:e.publishers??[],genres:Pv(e.genres),categories:Pv(e.categories),platforms:k$(e.platforms),metacritic:e.metacritic?.score??null,metacritic_url:e.metacritic?.url??null,recommendations:e.recommendations?.total??null,required_age:e.required_age??null,controller_support:e.controller_support??null,achievements_total:e.achievements?.total??null,achievements_highlighted:(e.achievements?.highlighted??[]).map(n=>n.name).filter(n=>!!n),supported_languages:ma(e.supported_languages),dlc:e.dlc??[],demos:(e.demos??[]).map(n=>n.appid).filter(n=>typeof n=="number"),content_descriptors:{ids:e.content_descriptors?.ids??[],notes:e.content_descriptors?.notes??null},base_game:e.fullgame?.appid?{appid:Number(e.fullgame.appid),name:e.fullgame.name??null}:null,drm_notice:e.drm_notice||null,account_notice:e.ext_user_account_notice||null,pc_requirements_min:ma(t?.minimum),website:e.website||null,header_image:e.header_image||null,store_url:rr(e.steam_appid)})}function PP(e){if(!e||typeof e.final!="number")return null;let t=e.initial&&e.final&&e.initial>e.final?Math.round((1-e.final/e.initial)*100):0;return{currency:e.currency??null,final:pa(e.final,e.currency),initial:pa(e.initial,e.currency),discount_percent:t}}function P$(e){return Du.parse({total:e.total??e.items?.length??0,results:(e.items??[]).map(t=>({appid:t.id,name:t.name,type:t.type??null,price:PP(t.price),metascore:t.metascore||null,platforms:k$(t.platforms),store_url:rr(t.id)}))})}function T$(e,t){let n=t.map(o=>{let r=e[String(o)],i=r?.data,a=i&&!Array.isArray(i)?i.price_overview:void 0;return r?.success?a?{appid:o,available:!0,is_free:!1,...R$(a)}:{appid:o,available:!0,is_free:!0}:{appid:o,available:!1}});return Fu.parse({count:n.length,prices:n})}function E$(e,t=5){let n=e.query_summary??{};return Lu.parse({summary:n.review_score_desc??null,total_reviews:n.total_reviews??null,total_positive:n.total_positive??null,total_negative:n.total_negative??null,positive_pct:n.total_reviews&&n.total_positive?Math.round(n.total_positive/n.total_reviews*100):null,reviews:(e.reviews??[]).slice(0,t).map(o=>({voted_up:o.voted_up??null,votes_up:o.votes_up??0,author_playtime_hours:Ot(o.author?.playtime_forever),text:o.review?o.review.length>600?o.review.slice(0,600)+"\u2026":o.review:null}))})}function ha(e){let t=new Set,n=[];for(let o of e??[]){if(o.id!==void 0){if(t.has(o.id))continue;t.add(o.id)}n.push({appid:o.id,name:o.name,discounted:o.discounted??!1,discount_percent:o.discount_percent??0,original_price:pa(o.original_price,o.currency),final_price:pa(o.final_price,o.currency),store_url:rr(o.id)})}return n}function x$(e){return Zu.parse({specials:ha(e.specials?.items),top_sellers:ha(e.top_sellers?.items),new_releases:ha(e.new_releases?.items),coming_soon:ha(e.coming_soon?.items)})}function O$(e){return Vu.parse({specials:ha(e.specials?.items)})}function z$(e){let t=e.recommendations_up??0,n=e.recommendations_down??0,o=t+n;return{date:jt(e.date),up:t,down:n,positive_pct:o?Math.round(t/o*100):null}}function j$(e){let t=e.results??{};return Gu.parse({rollup_type:t.rollup_type??null,history:(t.rollups??[]).slice(-24).map(z$),recent:(t.recent??[]).slice(-30).map(z$)})}var Ju=class{#e;#n;#r;#t;constructor(t,n){this.#r=t.country,this.#t=t.language;let o=new yo(t.storeMinIntervalMs);this.#e=new _o({baseUrl:t.steamStoreBaseUrl,logger:n,timeoutMs:t.httpTimeoutMs,retries:t.httpRetries,beforeRequest:()=>o.acquire(),hasCredentials:!1}),this.#n=new bo(t.cacheTtlMs)}#i(t,n,o){return this.#e.getJson("api/storesearch/",{query:{term:t,l:o??this.#t,cc:n??this.#r}})}async searchGames(t,n,o){return P$(await this.#i(t,n,o))}async resolveAppId(t,n,o){return(await this.#i(t,n,o)).items?.find(i=>typeof i.id=="number")?.id??null}async getGame(t,n,o){let r=n??this.#r,i=o??this.#t;return this.#n.wrapStaleOnError(`app:${t}:${r}:${i}`,async()=>{let s=(await this.#e.getJson("api/appdetails",{query:{appids:t,cc:r,l:i}}))[String(t)];if(!s?.success||!s.data)throw new Re({code:"not_found",message:`No Steam app with id ${t}`});return I$(s.data)})}async getReviews(t,n,o="all",r="all"){let i=await this.#e.getJson(`appreviews/${t}`,{query:{json:1,num_per_page:n,language:o,review_type:r,purchase_type:"all"}});return E$(i,n)}async getPrices(t,n){let o=n??this.#r,r=100,i={};for(let a=0;a<t.length;a+=r){let s=t.slice(a,a+r),c=await this.#e.getJson("api/appdetails",{query:{appids:s.join(","),cc:o,filters:"price_overview"}});Object.assign(i,c)}return T$(i,t)}async getReviewHistogram(t){return this.#n.wrapStaleOnError(`hist:${t}:${this.#t}`,async()=>{let n=await this.#e.getJson(`appreviewhistogram/${t}`,{query:{l:this.#t}});return j$(n)})}#a(t,n){return this.#n.wrapStaleOnError(`featured:${t}:${n}`,()=>this.#e.getJson("api/featuredcategories",{query:{cc:t,l:n}}))}async getFeatured(t,n){return x$(await this.#a(t??this.#r,n??this.#t))}async getSpecials(t,n){return O$(await this.#a(t??this.#r,n??this.#t))}};function Hu(e){return{content:[{type:"text",text:JSON.stringify(e)}],structuredContent:e}}function Nr(e){return{content:[{type:"text",text:e}],isError:!0}}function N$(e){return Nr(xv(e))}function Ev(e){return e.unsafeDetail?".":`: ${e.message}`}function xv(e){switch(e.code){case"unauthorized":return e.hadCredentials===!1?"The upstream service rejected the request (401), but this tool sends no credentials at all, so this isn't a credentials problem \u2014 retry, or check for an upstream outage.":"The upstream service rejected the credentials (401). They may be missing or expired \u2014 check the configured API key / token.";case"forbidden":return e.hadCredentials===!1?"The upstream service denied access (403), but this tool sends no credentials at all, so this isn't a credentials problem \u2014 it's more likely an unrelated upstream security block (e.g. a request that resembles an injection attempt). Try different input.":e.hadCredentials===!0?"The upstream service denied access (403). The configured credentials are likely invalid, expired, or lack permission for this request.":"The upstream service denied access (403). This can be a genuine credentials/permission issue, but many of this server's tools call it without any credentials at all \u2014 a 403 there is more likely an unrelated upstream security block (e.g. a request that resembles an injection attempt). Try different input first, and only suspect the configured API key if this tool actually requires one.";case"not_found":return`No matching resource was found (404)${Ev(e)}`;case"not_modified":return"The content has not changed since the last request (304).";case"rate_limited":return"Upstream rate limit hit (429). Please retry in a few seconds.";case"server_error":return"The upstream service returned an error (5xx). Please retry later.";case"network":return"Could not reach the upstream service (network error). Check connectivity and retry.";case"timeout":return"The upstream request timed out. Please retry.";case"bad_request":return`The request was rejected as invalid${Ev(e)}`;default:return`Unexpected error talking to the upstream service${Ev(e)}`}}var ga=m.union([m.object({found:m.literal(!1)}).strict(),m.object({found:m.literal(!0),steamid:m.string().optional(),name:m.string().nullable(),real_name:m.string().nullable(),state:m.string(),visibility:m.enum(["public","private"]),country:m.string().nullable(),level:m.number().nullable(),created:m.string().nullable(),in_game:m.string().nullable(),profile_url:m.string().nullable(),avatar:m.string().nullable()}).strict()]),C$=m.object({appid:m.number().optional(),name:m.string().nullable(),playtime_hours:m.number().nullable(),playtime_2weeks_hours:m.number().nullable()}).strict(),va=m.union([m.object({found:m.literal(!1),reason:m.string(),game_count:m.null(),games:m.array(m.never()),owns:m.array(m.object({appid:m.number(),owned:m.literal(!1)}).strict()).optional()}).strict(),m.object({found:m.literal(!0),game_count:m.number(),returned:m.number(),games:m.array(C$),owns:m.array(m.object({appid:m.number(),owned:m.boolean(),playtime_hours:m.number().nullable()}).strict()).optional()}).strict()]),Bu=m.object({found:m.literal(!0),shared_count:m.number(),returned:m.number(),games:m.array(m.object({appid:m.number().optional(),name:m.string().nullable(),playtime_hours_a:m.number().nullable(),playtime_hours_b:m.number().nullable()}).strict())}).strict(),_a=m.union([Iv,m.object({found:m.literal(!0),total:m.number(),games:m.array(C$)}).strict()]),Ku=m.object({found:m.literal(!0),game:m.string().nullable(),total:m.number(),unlocked:m.number(),completion_pct:m.number().nullable(),returned:m.number(),achievements:m.array(m.object({name:m.string().optional(),achieved:m.boolean(),unlocked_at:m.string().nullable()}).strict())}).strict(),Wu=m.object({count:m.number(),returned:m.number(),achievements:m.array(m.object({name:m.string().optional(),percent:m.number().nullable()}).strict())}).strict(),Yu=m.object({game:m.string().nullable(),total:m.number(),returned:m.number(),achievements:m.array(m.object({api_name:m.string().optional(),name:m.string().nullable(),description:m.string().nullable(),hidden:m.boolean(),global_unlock_pct:m.number().nullable()}).strict())}).strict(),Xu=m.object({items:m.array(m.object({title:m.string().nullable(),date:m.string().nullable(),author:m.string().nullable(),feed:m.string().nullable(),excerpt:m.string().nullable(),url:m.string().nullable()}).strict())}).strict(),Qu=m.object({found:m.literal(!0),steamid:m.string()}).strict(),ed=m.object({appid:m.number(),player_count:m.number().nullable()}).strict(),td=m.object({found:m.literal(!0),total:m.number(),returned:m.number(),items:m.array(m.object({appid:m.number().optional(),store_url:m.string().nullable(),priority:m.number().nullable(),added:m.string().nullable()}).strict())}).strict(),ya=m.union([m.object({found:m.literal(!1)}).strict(),m.object({found:m.literal(!0),steamid:m.string().optional(),vac_banned:m.boolean(),vac_ban_count:m.number(),game_ban_count:m.number(),community_banned:m.boolean(),economy_ban:m.string().nullable(),days_since_last_ban:m.number().nullable()}).strict()]),ba=m.union([Iv,m.object({found:m.literal(!0),total:m.number(),returned:m.number(),games:m.array(m.object({appid:m.number(),store_url:m.string().nullable()}).strict())}).strict()]),Sa=m.object({found:m.literal(!0),total:m.number(),returned:m.number(),friends:m.array(m.object({steamid:m.string().optional(),name:m.string().nullable(),state:m.string(),in_game:m.string().nullable(),profile_url:m.string().nullable(),friends_since:m.string().nullable()}).strict())}).strict(),Ov=m.object({steamid:m.string(),name:m.string().nullable()}).strict(),rd=m.object({found:m.literal(!0),total_friends:m.number(),matches:m.array(m.object({appid:m.number(),owners:m.array(Ov.extend({playtime_hours:m.number().nullable()})),owners_total:m.number().optional()}).strict()),private_friends:m.array(Ov),private_friends_total:m.number().optional(),unavailable_friends:m.array(Ov.extend({reason:m.string()})),unavailable_friends_total:m.number().optional()}).strict();var A$=["offline","online","busy","away","snooze","looking to trade","looking to play"];function M$(e,t){let n=e.response?.players?.[0];return n?ga.parse({found:!0,steamid:n.steamid,name:n.personaname??null,real_name:n.realname||null,state:A$[n.personastate??0]??"offline",visibility:n.communityvisibilitystate===3?"public":"private",country:n.loccountrycode||null,level:t??null,created:jt(n.timecreated),in_game:n.gameextrainfo||null,profile_url:n.profileurl??null,avatar:n.avatarfull??null}):ga.parse({found:!1})}function nd(e){return e.response?.game_count===void 0&&e.response?.games===void 0}function q$(e,t={}){if(nd(e))return va.parse({found:!1,reason:un,game_count:null,games:[]});let n=e.response?.games??[],o=n.slice().sort((c,l)=>(l.playtime_forever??0)-(c.playtime_forever??0)),r=t.max??50,i=new Map(n.filter(c=>typeof c.appid=="number").map(c=>[c.appid,c])),{included:a,returned:s}=dt(o,r);return va.parse({found:!0,game_count:e.response?.game_count??o.length,returned:s,games:a.map(c=>({appid:c.appid,name:c.name??null,playtime_hours:Ot(c.playtime_forever),playtime_2weeks_hours:Ot(c.playtime_2weeks)})),...t.checkAppids&&{owns:t.checkAppids.map(c=>{let l=i.get(c);return{appid:c,owned:l!==void 0,playtime_hours:l?Ot(l.playtime_forever):null}})}})}var TP="One or both profiles/game-details are private. Ask the owner(s) to set Steam \u2192 Privacy \u2192 Game details = Public.";function D$(e,t,n=50){if(nd(e)||nd(t))return vt.parse({found:!1,reason:TP});let o=new Map((e.response?.games??[]).map(c=>[c.appid,c])),r=new Map((t.response?.games??[]).map(c=>[c.appid,c])),i=[...o.keys()].filter(c=>typeof c=="number"&&r.has(c)).map(c=>{let l=o.get(c),u=r.get(c);return{appid:c,name:l.name??u.name??null,playtime_hours_a:Ot(l.playtime_forever),playtime_hours_b:Ot(u.playtime_forever)}}).sort((c,l)=>(l.playtime_hours_a??0)+(l.playtime_hours_b??0)-((c.playtime_hours_a??0)+(c.playtime_hours_b??0))),{included:a,returned:s}=dt(i,n);return Bu.parse({found:!0,shared_count:i.length,returned:s,games:a})}function U$(e){return nd(e)?_a.parse({found:!1,reason:un,total:0,games:[]}):_a.parse({found:!0,total:e.response?.game_count??e.response?.games?.length??0,games:(e.response?.games??[]).map(t=>({appid:t.appid,name:t.name??null,playtime_2weeks_hours:Ot(t.playtime_2weeks),playtime_hours:Ot(t.playtime_forever)}))})}var Cr=200;function L$(e,t=Cr){let n=e.playerstats;if(!n?.success)return vt.parse({found:!1,reason:n?.error??"No achievement stats"});let o=n.achievements??[],r=o.filter(s=>s.achieved===1),{included:i,returned:a}=dt([...r,...o.filter(s=>s.achieved!==1)],t);return Ku.parse({found:!0,game:n.gameName??null,total:o.length,unlocked:r.length,completion_pct:o.length?Math.round(r.length/o.length*100):null,returned:a,achievements:i.map(s=>({name:s.name||s.apiname,achieved:s.achieved===1,unlocked_at:s.achieved===1?jt(s.unlocktime):null}))})}function jv(e,t=Cr){let n=e.achievementpercentages?.achievements??[],{included:o,returned:r}=dt(n,t);return Wu.parse({count:n.length,returned:r,achievements:o.map(i=>({name:i.name,percent:typeof i.percent=="string"?Number(i.percent):i.percent??null}))})}function Nv(e,t,n=Cr){let o=new Map;for(let s of t.achievementpercentages?.achievements??[])s.name!=null&&o.set(s.name,typeof s.percent=="string"?Number(s.percent):s.percent??0);let r=e.game?.availableGameStats?.achievements??[],{included:i,returned:a}=dt(r,n);return Yu.parse({game:e.game?.gameName??null,total:r.length,returned:a,achievements:i.map(s=>{let c=s.name!=null?o.get(s.name):void 0;return{api_name:s.name,name:s.displayName||s.name||null,description:s.description||null,hidden:s.hidden===1,global_unlock_pct:typeof c=="number"?Math.round(c*10)/10:null}})})}function F$(e){return Xu.parse({items:(e.appnews?.newsitems??[]).map(t=>({title:t.title??null,date:jt(t.date),author:t.author||null,feed:t.feedlabel||null,excerpt:ma(t.contents),url:t.url??null}))})}function V$(e){let t=e.response;return t?.success===1&&t.steamid?Qu.parse({found:!0,steamid:t.steamid}):vt.parse({found:!1,reason:t?.message??"No match for that vanity name"})}function Z$(e,t){return ed.parse({appid:t,player_count:e.response?.player_count??null})}function G$(e,t=100){let n=e.response?.items??[];if(n.length===0)return So.parse({found:!1,reason:"Empty wishlist, or the profile/wishlist is private.",total:0,items:[]});let o=n.toSorted((a,s)=>(a.priority??1e9)-(s.priority??1e9)),{included:r,returned:i}=dt(o,t);return td.parse({found:!0,total:n.length,returned:i,items:r.map(a=>({appid:a.appid,store_url:rr(a.appid),priority:a.priority??null,added:jt(a.date_added)}))})}function J$(e){let t=e.players?.[0];return t?ya.parse({found:!0,steamid:t.SteamId,vac_banned:t.VACBanned??!1,vac_ban_count:t.NumberOfVACBans??0,game_ban_count:t.NumberOfGameBans??0,community_banned:t.CommunityBanned??!1,economy_ban:t.EconomyBan&&t.EconomyBan!=="none"?t.EconomyBan:null,days_since_last_ban:t.DaysSinceLastBan??null}):ya.parse({found:!1})}var EP=200;function H$(e,t,n=EP){let o=e.response?.appids??[];if(o.length===0)return ba.parse({found:!1,reason:"No followed games, or the profile is private.",total:0,games:[]});let{included:r,returned:i}=dt(o,n);return ba.parse({found:!0,total:t.response?.followed_game_count??o.length,returned:i,games:r.map(a=>({appid:a,store_url:rr(a)}))})}function B$(e,t,n=100){let o=e.friendslist?.friends??[];if(o.length===0)return Sa.parse({found:!0,total:0,returned:0,friends:[]});let r=new Map;for(let c of t.response?.players??[])c.steamid&&r.set(c.steamid,c);let i=o.toSorted((c,l)=>(l.friend_since??0)-(c.friend_since??0)),{included:a,returned:s}=dt(i,n);return Sa.parse({found:!0,total:o.length,returned:s,friends:a.map(c=>{let l=c.steamid?r.get(c.steamid):void 0;return{steamid:c.steamid,name:l?.personaname??null,state:A$[l?.personastate??0]??"offline",in_game:l?.gameextrainfo||null,profile_url:l?.profileurl??null,friends_since:jt(c.friend_since)}})})}function Cv(e,t,n,o,r=100){let i=new Map;for(let f of o.response?.players??[])f.steamid&&i.set(f.steamid,f);let a=f=>({steamid:f,name:i.get(f)?.personaname??null}),s=new Map(e.map(f=>[f,[]])),c=[],l=[];t.forEach((f,b)=>{let g=n[b];if(g===null){c.push(a(f));return}if(!(g instanceof Map)){l.push({...a(f),reason:g?.error??"no data returned"});return}for(let S of e)g.has(S)&&s.get(S).push({...a(f),playtime_hours:Ot(g.get(S))})});let u=dt(c,r),p=dt(l,r);return rd.parse({found:!0,total_friends:t.length,matches:e.map(f=>{let b=s.get(f)??[],{included:g,returned:S}=dt(b,r);return{appid:f,owners:g,...S<b.length&&{owners_total:b.length}}}),private_friends:u.included,...u.returned<c.length&&{private_friends_total:c.length},unavailable_friends:p.included,...p.returned<l.length&&{unavailable_friends_total:l.length}})}var od=m.enum(["unknown","unsupported","playable","verified"]),K$=m.object({appid:m.number(),name:m.string().nullable(),store_url:m.string().nullable(),review_percent:m.number().nullable(),review_count:m.number().nullable(),review_label:m.string().nullable(),platforms:m.array(m.string()),steam_deck:od,steam_os:od,steam_machine:od,steam_frame:od,vr_support:m.enum(["none","supported","required"]),tags:m.array(m.string()),release_date:m.string().nullable()}).strict(),Av=K$.extend({discount_pct:m.number(),discount_end:m.string().nullable(),original:m.string().nullable(),price:m.string().nullable()}),id=m.object({count:m.number(),items:m.array(m.union([m.object({appid:m.number(),available:m.literal(!1)}).strict(),K$.extend({is_free:m.boolean(),price:m.union([m.object({discount_pct:m.number(),discount_end:m.string().nullable(),final:m.string().nullable(),original:m.string().nullable()}).strict(),m.object({is_free:m.literal(!0)}).strict()]).nullable(),coming_soon:m.boolean()})]))}).strict(),ad=m.object({total_matching:m.number().nullable().describe("Count from whichever filters Steam actually applies server-side \u2014 min_discount, and (if released_after/released_within_days was set) excluding not-yet-released games \u2014 or the whole catalog's size if neither was given. NOT the number of games matching tags/platform/compat/review/the exact release-date cutoff, which have no server-side filter and this tool applies only over the scanned `count`-sized window below. Don't read this as 'N games match all my filters' \u2014 use `returned` for that instead."),returned:m.number().describe("How many results survived every filter, out of the scanned window (see `count`)."),deals:m.array(Av)}).strict(),sd=m.object({found:m.literal(!0),total:m.number().describe("The player's full wishlist size, including entries Steam never sent store data for (see `enriched`)."),enriched:m.number().describe("How many of `total` Steam actually attached store data to (it caps around the first 100) \u2014 every filter below only runs over these, never the full `total`."),note:m.string().optional(),matched:m.number().describe("How many of the enriched items satisfied the filters, BEFORE the display cap \u2014 a big gap between this and `returned` means results were capped, not that fewer items matched."),returned:m.number().describe("How many items are actually in `items` below, after the display cap."),items:m.array(Av.extend({priority:m.number().nullable(),added:m.string().nullable()}))}).strict(),cd=m.object({found:m.literal(!0),based_on_tags:m.array(m.string()),count:m.number(),recommendations:m.array(Av.extend({matched_tags:m.array(m.string()),match_score:m.number().describe("An internal ranking weight (playtime-on-matched-tags, discounted by review score) \u2014 not a percentage or 0-100 scale. Only meaningful relative to the other scores in this same response, to explain why one pick outranks another.")}))}).strict();function W$(e){return e.related_items?.parent_appid===void 0}function Y$(e){let t={};for(let n of e.response?.tags??[])typeof n.tagid=="number"&&n.name&&(t[n.tagid]=n.name);return t}var xP=8;function Mv(e,t){return!e||!t?[]:e.slice().sort((n,o)=>(o.weight??0)-(n.weight??0)).map(n=>n.tagid!==void 0?t[n.tagid]:void 0).filter(n=>!!n).slice(0,xP)}function X$(e,t){return new Set((e??[]).map(n=>n.tagid!==void 0?t?.[n.tagid]:void 0).filter(n=>!!n).map(n=>n.toLowerCase()))}function OP(e,t,n){let o=X$(e,t);return n.every(r=>o.has(r))}function jP(e,t,n){let o=X$(e,t);return n.some(r=>o.has(r))}var NP={0:"unknown",1:"unsupported",2:"playable",3:"verified"};function ld(e){return NP[e??0]??"unknown"}function CP(e){let t=e?.vr_support;return t?.vrhmd?t.vrhmd_only?"required":"supported":"none"}var AP={verified:3,playable:2},MP={windows:"windows",mac:"mac",linux:"steamos_linux"};function qP(e){if(!e)return[];let t=[];return e.windows&&t.push("windows"),e.mac&&t.push("mac"),e.steamos_linux&&t.push("linux"),t}function DP(e){let t=(e?.active_discounts??[]).map(n=>n.discount_end_date).filter(n=>typeof n=="number"&&n>0);return t.length?$$(Math.min(...t)):null}function Q$(e){return{discount_pct:e?.discount_pct??0,discount_end:DP(e),final:e?.formatted_final_price||null,original:e?.formatted_original_price||e?.formatted_final_price||null}}function ew(e,t){let n=e.reviews?.summary_filtered;return{appid:e.appid,name:e.name??null,store_url:rr(e.appid),review_percent:n?.percent_positive??null,review_count:n?.review_count??null,review_label:n?.review_score_label??null,platforms:qP(e.platforms),steam_deck:ld(e.platforms?.steam_deck_compat_category),steam_os:ld(e.platforms?.steam_os_compat_category),steam_machine:ld(e.platforms?.steam_machine_compat_category),steam_frame:ld(e.platforms?.steam_frame_compat_category),vr_support:CP(e.platforms),tags:Mv(e.tags,t),release_date:jt(e.release?.steam_release_date)}}function qv(e,t){let{final:n,...o}=Q$(e.best_purchase_option);return{...ew(e,t),...o,price:n}}var UP=[["steamDeck","steam_deck_compat_category"],["steamOs","steam_os_compat_category"],["steamMachine","steam_machine_compat_category"],["steamFrame","steam_frame_compat_category"]];function tw(e){let t=UP.map(([r,i])=>{let a=e[r];return[i,a?AP[a]:void 0]}),n=e.platform?MP[e.platform]:void 0,o=e.tags?.length?e.tags.map(r=>r.toLowerCase()):void 0;return r=>{let i=r.platforms;for(let[c,l]of t)if(l!==void 0&&(i?.[c]??0)<l)return!1;if(n&&!i?.[n]||e.releasedAfter!==void 0&&(r.release?.steam_release_date??0)<e.releasedAfter||o&&!OP(r.tags,e.tagMap,o))return!1;let a=r.reviews?.summary_filtered;if(typeof e.minReview=="number"&&(a?.percent_positive??-1)<e.minReview||typeof e.minReviews=="number"&&(a?.review_count??0)<e.minReviews)return!1;let s=r.best_purchase_option?.discount_pct??0;if(typeof e.minDiscount=="number"){if(s<e.minDiscount)return!1}else if(e.onSaleOnly&&s<=0)return!1;return!0}}function rw(e,t){let n=tw(t),o=(e.response?.store_items??[]).filter(r=>r.visible!==!1&&typeof r.appid=="number"&&W$(r)&&n(r)).map(r=>qv(r,t.tagMap)).sort((r,i)=>i.discount_pct-r.discount_pct);return ad.parse({total_matching:e.response?.metadata?.total_matching_records??null,returned:o.length,deals:o})}function nw(e,t,n){let o=new Map;for(let r of e.response?.store_items??[])typeof r.appid=="number"&&o.set(r.appid,{...r,appid:r.appid});return id.parse({count:t.length,items:t.map(r=>{let i=o.get(r);if(!i||!i.name&&!i.best_purchase_option&&!i.reviews&&!i.is_free)return{appid:r,available:!1};let a=i.best_purchase_option;return{...ew(i,n),is_free:i.is_free??!1,price:a?Q$(a):i.is_free?{is_free:!0}:null,coming_soon:i.release?.is_coming_soon??!1}})})}var LP=60;function ow(e,t,n={}){let o=e.response?.items??[];if(o.length===0)return So.parse({found:!1,reason:"Empty wishlist, or the profile/wishlist is private.",total:0,items:[]});let r=o.filter(u=>u.store_item!==void 0),i=tw({...n,tagMap:t}),a=r.filter(u=>typeof u.store_item.appid=="number"&&i(u.store_item)).map(u=>({...qv(u.store_item,t),priority:u.priority??null,added:jt(u.date_added)})),s=n.onSaleOnly||typeof n.minDiscount=="number";a.sort((u,p)=>s?p.discount_pct-u.discount_pct:(u.priority??1e9)-(p.priority??1e9));let{included:c,returned:l}=dt(a,LP);return sd.parse({found:!0,total:o.length,enriched:r.length,note:r.length<o.length?`Steam only returned store data for ${r.length} of ${o.length} wishlist items; filters/matches only cover those ${r.length} \u2014 the rest have no price, reviews or tags to check.`:void 0,matched:a.length,returned:l,items:c})}function iw(e,t,n){let o=new Map;for(let r of e){if(typeof r.appid!="number")continue;let i=(t.get(r.appid)??0)/60;if(!(i<=0))for(let a of Mv(r.tags,n))o.set(a,(o.get(a)??0)+i)}return o}function aw(e,t,n,o,r,i,a=[]){let s=a.map(l=>l.toLowerCase()),c=e.filter(l=>l.visible!==!1&&typeof l.appid=="number"&&W$(l)&&!n.has(l.appid)&&!(s.length&&jP(l.tags,o,s))).map(l=>{let p=Mv(l.tags,o).filter(S=>t.has(S)),f=p.reduce((S,_)=>S+(t.get(_)??0),0),b=l.reviews?.summary_filtered?.percent_positive,g=typeof b=="number"?b/100:1;return{it:l,matchedTags:p,matchScore:f*g}}).filter(l=>l.matchScore>0).sort((l,u)=>u.matchScore-l.matchScore).slice(0,r);return cd.parse({found:!0,based_on_tags:i,count:c.length,recommendations:c.map(({it:l,matchedTags:u,matchScore:p})=>({...qv(l,o),matched_tags:u,match_score:Math.round(p*10)/10}))})}var $a=e=>({include_basic_info:!0,include_reviews:!0,include_release:!0,include_platforms:!0,include_tag_count:e}),FP=30,VP=6,ZP=300,ud=class{#e;#n;#r;#t;constructor(t){this.#e=t.get,this.#n=t.cache,this.#r=t.language,this.#t=t.country}async#i(t){try{return await this.#n.wrapStaleOnError(`tags:${t}`,async()=>{let n=await this.#e("IStoreService/GetTagList/v1/",{language:t});return Y$(n)})}catch{return null}}#a(t,n){if(n!==null)return n;if(t?.length)throw new Re({code:"unknown",message:"could not fetch Steam's tag dictionary right now, so the `tags` filter can't be reliably applied. Retry, or drop `tags` to see unfiltered results.",retryable:!0})}async#s(t,n,o,r){let[i,a]=await Promise.all([this.#e(t,n),this.#i(o)]);return{res:i,tagMap:this.#a(r,a)}}async getItems(t,n,o){let r=o??this.#r,i={ids:t.map(c=>({appid:c})),context:{language:r,country_code:n??this.#t},data_request:$a(15)},{res:a,tagMap:s}=await this.#s("IStoreBrowseService/GetItems/v1/",{input_json:JSON.stringify(i)},r);return nw(a,t,s)}async getRecommendedGames(t,n={}){if(t.length===0)return xt("This player's library has no games to base recommendations on.");let o=n.language??this.#r,r=n.country??this.#t,i=await this.#i(o);if(i===null)throw new Re({code:"unknown",message:"could not fetch Steam's tag dictionary right now, so recommendations can't be computed. Retry shortly.",retryable:!0});let a=t.slice().sort((g,S)=>S.playtimeMinutes-g.playtimeMinutes).slice(0,FP),s=await this.#e("IStoreBrowseService/GetItems/v1/",{input_json:JSON.stringify({ids:a.map(g=>({appid:g.appid})),context:{language:o,country_code:r},data_request:$a(20)})}),c=iw(s.response?.store_items??[],new Map(a.map(g=>[g.appid,g.playtimeMinutes])),i);if(c.size===0)return xt("Not enough played games with resolvable tags to build recommendations.");let l=[...c.entries()].sort((g,S)=>S[1]-g[1]).slice(0,VP).map(([g])=>g),u=Math.min(Math.max(n.count??10,1),25),p={};typeof n.minDiscount=="number"&&(p.price_filters={min_discount_percent:n.minDiscount});let f=await this.#e("IStoreQueryService/Query/v1/",{input_json:JSON.stringify({query:{start:0,count:ZP,sort:10,filters:p},context:{language:o,country_code:r,steam_realm:1},data_request:$a(20)})}),b=new Set(t.map(g=>g.appid));return aw(f.response?.store_items??[],c,b,i,u,l,n.excludeTags)}async#c(t){let n=t.language??this.#r,o={};typeof t.minDiscount=="number"&&(o.price_filters={min_discount_percent:t.minDiscount}),t.releasedOnly&&(o.released_only=!0);let r={query:{start:t.start??0,count:t.count??50,sort:10,filters:o},context:{language:n,country_code:t.country??this.#t,steam_realm:1},data_request:$a(20)},{res:i,tagMap:a}=await this.#s("IStoreQueryService/Query/v1/",{input_json:JSON.stringify(r)},n,t.tags);return rw(i,{minReview:t.minReview,minReviews:t.minReviews,steamDeck:t.steamDeck,steamOs:t.steamOs,steamMachine:t.steamMachine,steamFrame:t.steamFrame,platform:t.platform,releasedAfter:t.releasedAfter,tags:t.tags,tagMap:a})}async discoverGames(t){return this.#c({...t,releasedOnly:t.releasedAfter!==void 0})}async getWishlistDetailed(t,n={}){let o=n.language??this.#r,r={steamid:t,context:{language:o,country_code:n.country??this.#t,steam_realm:1},data_request:$a(20),sort:0},i={onSaleOnly:n.onSaleOnly,tags:n.tags,minReview:n.minReview,minDiscount:n.minDiscount,platform:n.platform,steamDeck:n.steamDeck,steamOs:n.steamOs,steamMachine:n.steamMachine,steamFrame:n.steamFrame},{res:a,tagMap:s}=await er("bad_request",()=>this.#s("IWishlistService/GetWishlistSortedFiltered/v1/",{input_json:JSON.stringify(r)},o,n.tags),{res:{},tagMap:void 0});return ow(a,s,i)}};var sw="Profile or friends list is private. Ask the owner to set Steam \u2192 Privacy \u2192 Friends List = Public.";function cw(e){return(e.friendslist?.friends??[]).map(t=>t.steamid).filter(t=>!!t)}var dd=class{#e;#n;#r;#t;#i;#a;#s;#c;configured;constructor(t,n){this.#r=t.steamApiKey,this.#t=t.language,this.#i=t.country,this.#a=t.defaultSteamId,this.configured=!!t.steamApiKey;let o=new yo(t.apiMinIntervalMs);this.#e=new _o({baseUrl:t.steamApiBaseUrl,logger:n,timeoutMs:t.httpTimeoutMs,retries:t.httpRetries,beforeRequest:()=>o.acquire(),hasCredentials:this.configured}),this.#n=new bo(t.cacheTtlMs),this.#s=new ud({get:this.#o.bind(this),cache:this.#n,language:this.#t,country:this.#i})}#o(t,n){return this.#e.getJson(t,{query:{key:this.#r,...n}})}async requireSteamId(t){if(t)return t;let n=this.#a;if(!n)throw new Re({code:"bad_request",message:"no steamid was given and STEAM_ID is not set. Pass a 17-digit SteamID64, or set STEAM_ID (a SteamID64 or vanity name) in the server config."});if(/^\d{17}$/.test(n))return n;if(this.#c)return this.#c;if(!this.configured)throw new Re({code:"bad_request",message:`STEAM_ID is a vanity name ("${n}") which needs a Steam Web API key to resolve. Set STEAM_API_KEY, or set STEAM_ID to a 17-digit SteamID64 instead.`});let o=await this.#o("ISteamUser/ResolveVanityURL/v1/",{vanityurl:n}),r=o.response?.steamid;if(o.response?.success!==1||!r)throw new Re({code:"bad_request",message:`could not resolve the STEAM_ID vanity name "${n}" to a SteamID64.`});return this.#c=r,r}async getPlayerSummary(t){let[n,o]=await Promise.all([er("bad_request",()=>this.#o("ISteamUser/GetPlayerSummaries/v2/",{steamids:t}),{}),this.#p(t)]);return M$(n,o)}async#p(t){try{return(await this.#n.wrapStaleOnError(`level:${t}`,async()=>({level:(await this.#o("IPlayerService/GetSteamLevel/v1/",{steamid:t})).response?.player_level??null}))).level}catch{return null}}async getPlayerBans(t){let n=await er("bad_request",()=>this.#o("ISteamUser/GetPlayerBans/v1/",{steamids:t}),{});return J$(n)}#l(t,n){return er("bad_request",()=>this.#o("IPlayerService/GetOwnedGames/v1/",{steamid:t,...n}),{})}async getOwnedGames(t,n){let o=await this.#l(t,{include_appinfo:!0,include_played_free_games:!0});return q$(o,{checkAppids:n})}async getRecentlyPlayed(t){let n=await er("bad_request",()=>this.#o("IPlayerService/GetRecentlyPlayedGames/v1/",{steamid:t}),{});return U$(n)}async getRecommendedGames(t,n={}){let o=await this.#l(t,{include_appinfo:!1,include_played_free_games:!0});if(o.response?.games===void 0&&o.response?.game_count===void 0)return xt(un);let r=(o.response?.games??[]).filter(i=>typeof i.appid=="number").map(i=>({appid:i.appid,playtimeMinutes:i.playtime_forever??0}));return this.#s.getRecommendedGames(r,n)}async comparePlayers(t,n){let[o,r]=await Promise.all([this.#l(t,{include_appinfo:!0}),this.#l(n,{include_appinfo:!0})]);return D$(o,r)}async getPlayerAchievements(t,n,o){let r=o??this.#t;try{let i=await this.#o("ISteamUserStats/GetPlayerAchievements/v1/",{steamid:t,appid:n,l:r});return i.playerstats?.success?L$(i):this.#u(n,r,i.playerstats?.error)}catch(i){if(i instanceof Re&&(i.code==="forbidden"||i.code==="unauthorized"))return xt(un);if(i instanceof Re&&(i.code==="bad_request"||i.code==="not_found"))return this.#u(n,r);throw i}}async#u(t,n,o){if(o&&/not public|private/i.test(o))return xt(un);try{let i=((await this.#o("ISteamUserStats/GetSchemaForGame/v2/",{appid:t,l:n})).game?.availableGameStats?.achievements?.length??0)>0;return xt(i?"This game has achievements, but the player's data is hidden (private game-details, or they don't own it).":"This game has no achievements.")}catch{return xt(o||"Achievements unavailable.")}}async resolveVanityUrl(t){let n=await this.#o("ISteamUser/ResolveVanityURL/v1/",{vanityurl:t});return V$(n)}async#d(t){if(t.length===0)return{};let n=[];for(let i=0;i<t.length;i+=100)n.push(t.slice(i,i+100));return{response:{players:(await Promise.allSettled(n.map(i=>this.#o("ISteamUser/GetPlayerSummaries/v2/",{steamids:i.join(",")})))).flatMap(i=>i.status==="fulfilled"?i.value.response?.players??[]:[])}}}async#m(t){try{return await this.#o("ISteamUser/GetFriendList/v1/",{steamid:t,relationship:"friend"})}catch(n){if(n instanceof Re&&(n.code==="forbidden"||n.code==="unauthorized"||n.code==="bad_request"))return null;throw n}}async getFriendList(t){let n=await this.#m(t);return n===null?xt(sw):B$(n,await this.#d(cw(n)))}async findFriendsWhoOwn(t,n){let o=await this.#m(t);if(o===null)return xt(sw);let r=cw(o);if(r.length===0)return Cv(n,[],[],{});let[i,a]=await Promise.all([this.#d(r),Promise.allSettled(r.map(c=>this.#f(c,n)))]),s=a.map(c=>c.status==="fulfilled"?c.value:{error:c.reason instanceof Re?xv(c.reason):"An unexpected error occurred."});return Cv(n,r,s,i)}async#f(t,n){let o=await this.#l(t,{include_appinfo:!1});if(o.response?.games===void 0&&o.response?.game_count===void 0)return null;let r=new Set(n),i=new Map;for(let a of o.response?.games??[])typeof a.appid=="number"&&r.has(a.appid)&&i.set(a.appid,a.playtime_forever??0);return i}async getNews(t,n){let o=await this.#o("ISteamNews/GetNewsForApp/v2/",{appid:t,count:n,maxlength:400});return F$(o)}async getGlobalAchievements(t){return this.#n.wrapStaleOnError(`global-ach:${t}`,async()=>{try{let n=await this.#o("ISteamUserStats/GetGlobalAchievementPercentagesForApp/v2/",{gameid:t});return jv(n)}catch(n){if(n instanceof Re&&(n.code==="forbidden"||n.code==="bad_request"||n.code==="not_found"))return jv({});throw n}})}async getCurrentPlayers(t){let n;try{n=await this.#o("ISteamUserStats/GetNumberOfCurrentPlayers/v1/",{appid:t})}catch(o){throw o instanceof Re&&o.code==="not_found"?new Re({code:"not_found",message:`No Steam app with id ${t}`}):o}if(n.response?.result!==1)throw new Re({code:"not_found",message:`No Steam app with id ${t}`});return Z$(n,t)}get store(){return this.#s}async#h(t){let n=await er("bad_request",()=>this.#o("IWishlistService/GetWishlist/v1/",{steamid:t}),{});return G$(n)}async getFollowedGames(t){let[n,o]=await Promise.all([this.#g(t),this.#v(t)]);return H$(n,o)}#g(t){return er("bad_request",()=>this.#o("IStoreService/GetGamesFollowed/v1/",{steamid:t}),{})}async#v(t){try{return await this.#o("IStoreService/GetGamesFollowedCount/v1/",{steamid:t})}catch{return{}}}#_(t,n){return this.#s.getWishlistDetailed(t,n)}async getWishlist(t,n={}){let{includeDetails:o,onSaleOnly:r,...i}=n;return o||r||Object.values(i).some(s=>s!==void 0)?this.#_(t,{onSaleOnly:r,...i}):this.#h(t)}async getGameAchievements(t,n){let o=n??this.#t;return this.#n.wrapStaleOnError(`schema:${t}:${o}`,async()=>{let[r,i]=await Promise.allSettled([this.#o("ISteamUserStats/GetSchemaForGame/v2/",{appid:t,l:o}),this.#o("ISteamUserStats/GetGlobalAchievementPercentagesForApp/v2/",{gameid:t})]);if(r.status==="fulfilled"){let s=i.status==="fulfilled"?i.value:{};return Nv(r.value,s)}let a=r.reason;if(a instanceof Re&&(a.code==="forbidden"||a.code==="bad_request"||a.code==="not_found")&&i.status==="rejected")return Nv({},{});throw a})}};async function md(e){try{return await e()}catch(t){return t instanceof Re?N$(t):Nr(`Unexpected error: ${t instanceof Error?t.message:String(t)}`)}}var Te={readOnlyHint:!0,openWorldHint:!0},Nt=m.number().int().positive().describe("Steam application id (appid). Get it from search_games."),Lt=m.string().regex(/^[A-Za-z]{2}$/,"Two-letter ISO country code, e.g. US, RU, DE.").describe("Country (cc) for prices/currency; overrides STEAM_COUNTRY for this call.").optional(),nr=m.string().min(2).describe("Store language (e.g. english, russian); overrides STEAM_LANGUAGE for this call.").optional(),Dv=m.enum(["windows","mac","linux"]).describe("NATIVE-build filter: keep only games shipping a native build for this OS (windows/mac/linux). 'linux' = a native Linux/SteamOS port. This is NOT Proton \u2014 for games that run via Proton compatibility use steam_os / steam_deck instead. Each result's `platforms` field lists its native builds, while steam_os/steam_deck report Proton compatibility, so native vs Proton stay distinct.").optional(),Uv=m.enum(["playable","verified"]).describe("Steam Deck compatibility (runs via Proton): 'verified' = Deck-Verified only; 'playable' = Playable or Verified. Not a native Linux build \u2014 see `platform` for that.").optional(),Lv=m.enum(["playable","verified"]).describe("SteamOS compatibility \u2014 how well it runs on SteamOS in general (via Proton): 'verified' = SteamOS-Verified only; 'playable' = Playable or Verified. For a NATIVE Linux build instead, use platform:'linux'; for the Steam Machine console specifically, use steam_machine.").optional(),Fv=m.enum(["playable","verified"]).describe("Steam Machine (Valve's console) compatibility (via Proton): 'verified' = Steam-Machine-Verified only; 'playable' = Playable or Verified. Its own rating, distinct from the general steam_os one.").optional(),Vv=m.enum(["playable","verified"]).describe("Steam Frame (VR headset) compatibility: 'verified' = Frame-Verified only; 'playable' = Playable or Verified.").optional(),Be=e=>md(async()=>Hu(await e()));function lw(e,t){e.registerTool("search_games",{title:"Search games",description:"Search the Steam store by title \u2014 term can be partial or approximate, not an exact match; returns matches with their appid (needed by the other game tools), price, Metacritic score and platforms. No API key required.",inputSchema:m.object({term:m.string().min(1).describe("Game title to search for."),country:Lt,language:nr}),outputSchema:Du,annotations:Te},({term:n,country:o,language:r})=>Be(()=>t.searchGames(n,o,r))),e.registerTool("get_game",{title:"Get game details",description:"Get full store details for one game: description, price/discount, genres, platforms, release date, developers/publishers, Metacritic, age rating, DLC and PC requirements. Identify the game by appid (from search_games) OR by name \u2014 a title is resolved to the closest store match. No API key required.",inputSchema:m.object({appid:Nt.describe("Steam appid (from search_games). Provide appid OR name.").optional(),name:m.string().min(1).describe("Game title to look up instead of an appid \u2014 resolved to the closest store match. Provide appid OR name; appid wins if both are given.").optional(),country:Lt,language:nr}),outputSchema:Uu,annotations:Te},({appid:n,name:o,country:r,language:i})=>md(async()=>{let a=n;if(!a){if(!o)return Nr("Provide either appid or name.");let s=await t.resolveAppId(o,r,i);if(!s)return Nr(`No Steam game found matching "${o}".`);a=s}return Hu(await t.getGame(a,r,i))})),e.registerTool("get_game_reviews",{title:"Get game reviews",description:"Get the review summary (score label, positive/negative counts, %) and a few recent reviews for a game by appid. Review text over 600 characters is truncated. For long-term trend instead of a snapshot, use get_review_histogram. Get the appid from search_games. No API key required.",inputSchema:m.object({appid:Nt,limit:m.number().int().min(1).max(20).describe("How many recent reviews (1-20). Default 5.").optional(),review_language:m.string().describe("Filter reviews by language, e.g. 'english'. Default 'all'.").optional(),type:m.enum(["all","positive","negative"]).describe("Only positive or negative reviews. Default 'all'. Steam only computes the summary (score label, totals, %) for 'all' \u2014 filtering to positive/negative nulls those fields out, leaving only the review excerpts.").optional()}),outputSchema:Lu,annotations:Te},({appid:n,limit:o,review_language:r,type:i})=>Be(()=>t.getReviews(n,o??5,r??"all",i??"all"))),e.registerTool("get_review_histogram",{title:"Get review trend over time",description:"Get how a game's reviews trend over time by appid: a long-term history (rollup_type reports each entry's granularity, e.g. 'week' or 'month', chosen server-side by Steam; capped at the most recent 24 entries) and the recent per-day breakdown (capped at the most recent 30 days), each with positive/negative counts and positive %. Good for 'are reviews improving / did an update hurt reception'. For a current summary and example review text instead of a trend, use get_game_reviews. Get the appid from search_games. No key.",inputSchema:m.object({appid:Nt}),outputSchema:Gu,annotations:Te},({appid:n})=>Be(()=>t.getReviewHistogram(n))),e.registerTool("get_prices",{title:"Get prices for many games",description:"Get current price and discount for a batch of games by appid in one call \u2014 efficient for checking a whole list (e.g. a wishlist) for deals. Handles up to 500 appids; if you also need review %, hardware compatibility or tags, use get_items instead (max 100 appids). Rows come back in the same order as the given appids, one per id (unavailable ones marked available:false, never dropped). Each row has the final/initial price and discount_percent (or is_free). No API key required. Get appids from search_games or get_wishlist.",inputSchema:m.object({appids:m.array(m.number().int().positive()).min(1).max(500).describe("Steam appids to price (1-500)."),country:Lt}),outputSchema:Fu,annotations:Te},({appids:n,country:o})=>Be(()=>t.getPrices(n,o))),e.registerTool("get_specials",{title:"Get current discounts",description:"List games currently on special (discounted) on the Steam store front page, with the discount % and original/final price. For ALL catalog discounts (not just the front page), use discover_games with min_discount. No API key required.",inputSchema:m.object({country:Lt,language:nr}),outputSchema:Vu,annotations:Te},({country:n,language:o})=>Be(()=>t.getSpecials(n,o))),e.registerTool("get_featured",{title:"Get featured store sections",description:"Get the Steam store's featured sections: specials, top sellers, new releases and coming soon (each a list of games with appid and price), all in one call \u2014 for a general 'what's on the store front page' overview. For just current discounts use get_specials (lighter), or discover_games for catalog-wide deals with filters. No API key required.",inputSchema:m.object({country:Lt,language:nr}),outputSchema:Zu,annotations:Te},({country:n,language:o})=>Be(()=>t.getFeatured(n,o)))}var _t=m.string().regex(/^\d{17}$/,"A SteamID64 is 17 digits. Use resolve_vanity_url to convert a custom profile name.").describe("17-digit SteamID64. Omit to use the STEAM_ID configured on the server. Convert a vanity/custom URL name with resolve_vanity_url first.").optional(),dn=(e,t,n)=>({steamid:o})=>t(async()=>n(await e.requireSteamId(o)));var GP=tr(So,td,sd);function uw(e,t,n){e.registerTool("get_game_news",{title:"Get game news",description:"Get recent news / patch notes for a game by appid (title, date, author, excerpt, link). Get the appid from search_games. Works without an API key.",inputSchema:m.object({appid:Nt,limit:m.number().int().min(1).max(20).describe("How many news items (1-20). Default 5.").optional()}),outputSchema:Xu,annotations:Te},({appid:o,limit:r})=>Be(()=>t.getNews(o,r??5))),e.registerTool("get_global_achievements",{title:"Get global achievement rates",description:`Get the global unlock percentage of each achievement in a game by appid \u2014 how rare each achievement is across all players. Returns each achievement's internal name and its unlock percent (no display names/descriptions \u2014 for those, use get_game_achievements), most-common first, capped at the first ${Cr} (check \`returned\` vs \`count\` \u2014 most games have far fewer). Get the appid from search_games. Works without a key.`,inputSchema:m.object({appid:Nt}),outputSchema:Wu,annotations:Te},({appid:o})=>Be(()=>t.getGlobalAchievements(o))),e.registerTool("get_items",{title:"Batch store card for many games",description:"Get price/discount, review % (positive), hardware compatibility, popular user tags and release date for a LIST of games by appid in ONE keyless call. The efficient way to price-, rating-, tag- and compat-check a wishlist or library without a request per game. For a bigger batch (up to 500 appids) when you only need price, use get_prices instead. An unknown/invalid appid comes back as its own row marked available:false (never dropped from the list), same as get_prices. Each item carries four compatibility fields, each verified/playable/unsupported/unknown: steam_deck (Steam Deck), steam_os (SteamOS in general), steam_machine (the Steam Machine console specifically), and steam_frame (Steam Frame VR headset); a `vr_support` flag (none/supported/required \u2014 distinct from steam_frame, which is a Steam Frame HARDWARE compat rating, not whether the game itself has a VR mode); a `tags` list (top user tags like 'Roguelike', 'Souls-like', most-relevant first); a clickable `store_url` to the game's Steam page; and, when on sale, `discount_end` (ISO UTC time the discount expires \u2014 for 'how long is this deal valid'). Get appids from search_games / get_wishlist / get_owned_games.",inputSchema:m.object({appids:m.array(m.number().int().positive()).min(1).max(100).describe("Steam appids (1-100)."),country:Lt,language:nr}),outputSchema:id,annotations:Te},({appids:o,country:r,language:i})=>Be(()=>n.getItems(o,r,i))),e.registerTool("discover_games",{title:"Discover games (deals, new releases, Steam Deck, rating)",description:"Find games across the whole Steam catalog (keyless), filtered by ANY combination of: discount (min_discount \u2014 for 'what's on sale'), release recency (released_after / released_within_days \u2014 for 'new games'), hardware compatibility (steam_deck for Steam Deck, steam_os for SteamOS in general, steam_machine for the Steam Machine console specifically, steam_frame for the Steam Frame VR headset), native OS build (platform \u2014 windows/mac/linux), review quality (min_review / min_reviews), and user tags (tags \u2014 e.g. ['Roguelike', 'Deckbuilding'] for 'games like X'). Each result returns price/discount, review %, all four compat statuses, a vr_support flag (none/supported/required), popular tags, a clickable store_url, discount_end (when a deal expires) and release date in one call. Examples: '>80% off with 90%+ reviews' \u2192 set min_discount + min_review; 'recent well-reviewed games that run on Steam Deck' \u2192 set released_within_days + steam_deck + min_review; 'roguelike deckbuilders on sale' \u2192 tags:['Roguelike','Deckbuilding'] + min_discount; 'games that run on the Steam Machine' \u2192 steam_machine; 'games that run on SteamOS' \u2192 steam_os. No appids needed \u2014 unlike get_items, which prices a list you already have. For 'games like X' from a SINGLE named title, get its tags via get_items and pass them here; for taste inferred from the player's WHOLE library instead, use get_recommended_games (key-gated). Note: min_discount is filtered server-side, and setting released_after/released_within_days also excludes not-yet-released games server-side \u2014 but the actual date cutoff, plus compat, platform, review and tag filtering, have no server-side support in the Steam catalog API, so those are scanned popularity-first and applied afterward over that same window \u2014 great for popular titles; a niche match may fall outside the top `count` (raise count for stricter filters).",inputSchema:m.object({released_after:m.string().regex(/^\d{4}-\d{2}-\d{2}$/,"Use an ISO date, e.g. 2026-03-01.").describe("Keep only games released on/after this date (YYYY-MM-DD).").optional(),released_within_days:m.number().int().min(1).describe("Alternative to released_after: released within the last N days.").optional(),steam_deck:Uv,steam_os:Lv,steam_machine:Fv,steam_frame:Vv,platform:Dv,tags:m.array(m.string().min(1)).min(1).describe("Keep only games carrying ALL of these user tags (case-insensitive), e.g. ['Roguelike','Deckbuilding']. Use exact Steam tag names. Applied over the scanned popularity window, so raise `count` when combining niche tags.").optional(),min_review:m.number().int().min(0).max(100).describe("Minimum positive-review %, e.g. 85. Applied over the returned page.").optional(),min_reviews:m.number().int().min(0).describe("Minimum review count (filters out games with too few reviews).").optional(),min_discount:m.number().int().min(1).max(100).describe("Minimum discount %, e.g. 80 for '80%+ off' \u2014 this is the 'deals' filter. Omit to include full-price games.").optional(),count:m.number().int().min(1).max(200).describe("How many catalog entries to scan (default 50). Raise for stricter filters.").optional(),start:m.number().int().min(0).describe("Pagination offset into the catalog.").optional(),country:Lt,language:nr}),outputSchema:ad,annotations:Te},({released_after:o,released_within_days:r,steam_deck:i,steam_os:a,steam_machine:s,steam_frame:c,platform:l,tags:u,min_review:p,min_reviews:f,min_discount:b,count:g,start:S,country:_,language:h})=>{let w;return o?w=Math.floor(Date.parse(o)/1e3):r&&(w=Math.floor(Date.now()/1e3)-r*86400),Be(()=>n.discoverGames({releasedAfter:w,steamDeck:i,steamOs:a,steamMachine:s,steamFrame:c,platform:l,tags:u,minReview:p,minReviews:f,minDiscount:b,count:g,start:S,country:_,language:h}))}),e.registerTool("get_current_players",{title:"Get current player count",description:"Get how many people are playing a game right now (live concurrent player count) by appid. Get the appid from search_games. Works without a key. Errors clearly if the appid is unknown/invalid rather than returning a null count.",inputSchema:m.object({appid:Nt}),outputSchema:ed,annotations:Te},({appid:o})=>Be(()=>t.getCurrentPlayers(o))),e.registerTool("get_followed_games",{title:"Get a player's followed games",description:"List the games a player 'follows' on the Steam store, by SteamID64 \u2014 a lighter opt-in (get sale/update notifications) that's separate from the wishlist; many players follow more games than they wishlist. Works without a key, but only if that player's follows/profile are public \u2014 otherwise it returns found:false. Returns appids + store_url only (no price/name), capped at the first 200 (check `returned` vs `total`); pass the appids to get_items for price, review % and compat. Convert a vanity name with resolve_vanity_url first.",inputSchema:m.object({steamid:_t}),outputSchema:ba,annotations:Te},dn(t,Be,o=>t.getFollowedGames(o))),e.registerTool("get_wishlist",{title:"Get a player's wishlist",description:"List a player's Steam wishlist by SteamID64. Works without a key, but only if that player's wishlist/profile is public \u2014 otherwise it returns found:false. By default returns a light list of appids (sorted by priority, no names), capped at the first 100 (check `returned` vs `total`). Set include_details for full store cards in ONE call (name, price/discount, review %, Deck/SteamOS/Machine/Frame compat, vr_support, tags, release) \u2014 no need to follow up with get_items. Narrow it in the SAME call with tags (e.g. ['Metroidvania']), platform (NATIVE windows/mac/linux build), steam_deck / steam_os / steam_machine / steam_frame (Proton compatibility \u2014 distinct from a native build), min_review and min_discount / on_sale_only, or country / language (the light appid list carries no price, so setting either implies include_details too) \u2014 these are applied before the output cap (the detailed card list returns at most 60 items), so a deeply-discounted niche match past the display cap is never hidden by it (e.g. 'top metroidvanias on my wishlist with a good discount and reviews' \u2192 tags:['Metroidvania'] + min_discount + min_review). Results ranked by discount when a discount filter is set, else by wishlist priority; `matched` reports the pre-cap count. Steam itself only attaches store data to roughly the first 100 wishlist entries per call \u2014 on a bigger wishlist, `enriched` reports how many of `total` got checked, and `note` explains when some were skipped (their filter/price data isn't available at all, not that they don't match). Convert a vanity name with resolve_vanity_url first.",inputSchema:m.object({steamid:_t,include_details:m.boolean().describe("Return full store cards (name, price, discount, reviews, compatibility, tags) per item in one call, instead of just appids. Implied by any filter below.").optional(),on_sale_only:m.boolean().describe("Only wishlist items currently discounted, ranked by discount %. Implies include_details.").optional(),tags:m.array(m.string().min(1)).min(1).describe("Keep only wishlist items carrying ALL of these user tags (case-insensitive), e.g. ['Metroidvania']. Implies include_details.").optional(),min_review:m.number().int().min(0).max(100).describe("Keep only items with at least this positive-review %. Implies include_details.").optional(),min_discount:m.number().int().min(1).max(100).describe("Keep only items discounted at least this %, ranked by discount. Implies include_details.").optional(),platform:Dv,steam_deck:Uv,steam_os:Lv,steam_machine:Fv,steam_frame:Vv,country:Lt.describe("Country (cc) for prices; overrides STEAM_COUNTRY. Only meaningful for store cards, so setting it implies include_details \u2014 the light appid list carries no price."),language:nr.describe("Store language; overrides STEAM_LANGUAGE. Only meaningful for store cards, so setting it implies include_details \u2014 the light appid list carries no price.")}),outputSchema:GP,annotations:Te},({steamid:o,include_details:r,on_sale_only:i,tags:a,min_review:s,min_discount:c,platform:l,steam_deck:u,steam_os:p,steam_machine:f,steam_frame:b,country:g,language:S})=>Be(async()=>{let _=await t.requireSteamId(o);return t.getWishlist(_,{includeDetails:r,onSaleOnly:i,tags:a,minReview:s,minDiscount:c,platform:l,steamDeck:u,steamOs:p,steamMachine:f,steamFrame:b,country:g,language:S})}))}var JP=tr(vt,Bu),HP=tr(vt,rd),BP=tr(vt,Sa),KP=tr(vt,Ku),WP=tr(vt,cd),YP=tr(vt,Qu);function dw(e,t){let n=o=>t.configured?Be(o):Promise.resolve(Nr("This tool needs a Steam Web API key. Set STEAM_API_KEY to a free key from https://steamcommunity.com/dev/apikey. (Note: the target profile must also be public.)"));e.registerTool("get_game_achievements",{title:"Get a game's full achievement list",description:`List a game's achievements by appid with their names, descriptions, hidden flag and global unlock % (rarity), in the game's own definition order (capped at the first ${Cr}; check \`returned\` vs \`total\` \u2014 most games have far fewer). Requires STEAM_API_KEY (the achievement schema needs a key). For just the rarity by internal id without a key, use get_global_achievements; for a few named highlights, see get_game's achievements_highlighted. Get the appid from search_games.`,inputSchema:m.object({appid:Nt,language:m.string().min(2).describe("Language for achievement names/descriptions; overrides STEAM_LANGUAGE.").optional()}),outputSchema:Yu,annotations:Te},({appid:o,language:r})=>n(()=>t.getGameAchievements(o,r))),e.registerTool("resolve_vanity_url",{title:"Resolve vanity URL to SteamID",description:"Convert a Steam custom (vanity) profile name \u2014 the part after /id/ in a profile URL \u2014 into the 17-digit SteamID64 that the player tools need. Requires STEAM_API_KEY. Returns found:false if the name doesn't resolve to a profile.",inputSchema:m.object({vanity:m.string().min(1).describe("Vanity name, e.g. 'gabelogannewell' from steamcommunity.com/id/gabelogannewell.")}),outputSchema:YP,annotations:Te},({vanity:o})=>n(()=>t.resolveVanityUrl(o))),e.registerTool("get_friend_list",{title:"Get a player's friend list",description:"List a player's Steam friends by SteamID64: name, online state, current game and how long they've been friends, most-recently-added first (capped at the 100 most-recently-added; check `returned` vs `total`). Requires STEAM_API_KEY and the friends list to be public \u2014 otherwise it returns found:false. For 'which of my friends own game X', use find_friends_who_own instead \u2014 it checks each friend's full library, not just this list. Get the SteamID64 from resolve_vanity_url.",inputSchema:m.object({steamid:_t}),outputSchema:BP,annotations:Te},dn(t,n,o=>t.getFriendList(o))),e.registerTool("find_friends_who_own",{title:"Find friends who own a game",description:"Check which of a player's Steam friends own one or more games by appid, with each owner's playtime_hours \u2014 'which of my friends have Portal 2 and how long have they played'. Checks each friend's FULL library, unlike get_friend_list which caps at the top 50 games by playtime \u2014 so a friend's rarely-played or unplayed copy is never missed (its playtime_hours may still be low or 0). For the PLAYER'S OWN ownership instead of a friend's, use get_owned_games's check_appids. Requires STEAM_API_KEY and the player's OWN friends list to be public \u2014 otherwise the whole call returns found:false. A friend's individually private library is a different, per-friend case: that friend is listed in private_friends (can't be checked) rather than silently counted as a non-owner. Likewise, a friend whose own library lookup failed (e.g. rate-limited) lands in unavailable_friends with a reason instead of failing the whole call \u2014 every other friend's result still comes through. Each of owners, private_friends and unavailable_friends is capped at 100 entries (a sibling _total field appears only when it was actually truncated). Get appids from search_games.",inputSchema:m.object({appids:m.array(m.number().int().positive()).min(1).max(10).describe("Steam appids to check (1-10)."),steamid:_t}),outputSchema:HP,annotations:Te},({appids:o,steamid:r})=>n(async()=>t.findFriendsWhoOwn(await t.requireSteamId(r),o))),e.registerTool("compare_players",{title:"Compare two players' libraries",description:"Find games two players both own, with each one's playtime \u2014 'what can my friend and I both play', 'do we have anything in common'. Checks each player's FULL library to find every shared game, unlike get_owned_games which caps its own list at the top 50 by playtime \u2014 but the returned list here is itself capped at the top 50 shared games by combined playtime (check `returned` vs `shared_count`). Requires STEAM_API_KEY and both profiles' game-details to be public \u2014 otherwise it returns found:false. Omit steamid to compare against yourself (STEAM_ID).",inputSchema:m.object({steamid:_t,other_steamid:m.string().regex(/^\d{17}$/,"A SteamID64 is 17 digits. Use resolve_vanity_url to convert a custom profile name.").describe("The other player's 17-digit SteamID64 to compare against.")}),outputSchema:JP,annotations:Te},({steamid:o,other_steamid:r})=>n(async()=>t.comparePlayers(await t.requireSteamId(o),r))),e.registerTool("get_player_summary",{title:"Get player profile",description:"Get a player's profile by SteamID64: display name, online state, country, account age, Steam level, and the game they're currently in. Requires STEAM_API_KEY, but works even for a private profile (visibility reports 'private') \u2014 country, account age and the current game only populate when the profile is public. For VAC/game/trade ban status instead, use get_player_bans.",inputSchema:m.object({steamid:_t}),outputSchema:ga,annotations:Te},dn(t,n,o=>t.getPlayerSummary(o))),e.registerTool("get_player_bans",{title:"Get a player's ban status",description:"Check a player's VAC, game, community and economy (trade) ban status by SteamID64 \u2014 'is this player banned', useful before trading or adding a friend. Ban status is always public \u2014 this works even when the rest of the profile is private. Requires STEAM_API_KEY.",inputSchema:m.object({steamid:_t}),outputSchema:ya,annotations:Te},dn(t,n,o=>t.getPlayerBans(o))),e.registerTool("get_owned_games",{title:"Get owned games",description:"List the games a player owns with playtime (hours), most-played first (the `games` list is capped to the top 50 by playtime \u2014 a lightly-played or unplayed game may not appear there). To reliably check whether the player owns one or more SPECIFIC appids regardless of that cap \u2014 'do I own game X' \u2014 pass check_appids; the `owns` field then checks the FULL, uncapped library, with each result's own playtime_hours (null if not owned). For checking a FRIEND's ownership instead of the player's own, use find_friends_who_own. Requires STEAM_API_KEY and a public profile + game-details visibility. Get the SteamID64 from resolve_vanity_url.",inputSchema:m.object({steamid:_t,check_appids:m.array(m.number().int().positive()).min(1).max(50).describe("Steam appids to reliably check ownership of (1-50), regardless of the top-50-by-playtime cap on `games`. Adds an `owns` field: [{appid, owned, playtime_hours}].").optional()}),outputSchema:va,annotations:Te},({steamid:o,check_appids:r})=>n(async()=>t.getOwnedGames(await t.requireSteamId(o),r))),e.registerTool("get_recently_played",{title:"Get recently played games",description:"List the games a player has played in the last two weeks, with recent and total playtime. For all-time top games by playtime instead (capped to the top 50), use get_owned_games. Requires STEAM_API_KEY and a public profile with game-details visibility (same requirement as get_owned_games) \u2014 otherwise it returns found:false.",inputSchema:m.object({steamid:_t}),outputSchema:_a,annotations:Te},dn(t,n,o=>t.getRecentlyPlayed(o))),e.registerTool("get_recommended_games",{title:"Get personalized game recommendations",description:"Recommend unowned Steam catalog games personalized to this player: tags on their own most-played owned games become weighted preferences (more playtime on a tag = more weight), discounted by each candidate's review score so a tag match on a poorly-received game doesn't outrank a better one, then ranked against a broad catalog page, excluding anything already owned. `based_on_tags` shows which of the player's own top tags drove the ranking; each result carries `matched_tags` and `match_score` alongside the usual price/review/compat card. Set exclude_tags to steer away from a genre despite it matching by playtime (e.g. 'recommend me something except Souls-like'), or min_discount for 'recommend something on a good discount' (e.g. 'suggest games on sale, not RPGs or shooters' \u2192 exclude_tags:['RPG','Shooter','FPS'], min_discount:30). Different from discover_games (which needs YOU to name the filters) \u2014 this infers taste from the player's WHOLE library instead, for 'what should I play next' / 'recommend me something'. For 'something like THIS ONE game' (a single named title), get its tags via get_items and call discover_games with them instead. Note: candidates are scored from a large but fixed-size catalog scan, so a heavy exclude_tags/min_discount combination can return fewer than `count` \u2014 there's no larger scan to fall back to. Requires STEAM_API_KEY and a public profile with game-details visible (same requirement as get_owned_games) \u2014 found:false is also returned if the player owns no games at all to base recommendations on.",inputSchema:m.object({steamid:_t,count:m.number().int().min(1).max(25).describe("How many recommendations to return (default 10).").optional(),exclude_tags:m.array(m.string().min(1)).min(1).describe("Drop any candidate carrying ANY of these tags (case-insensitive), e.g. ['Souls-like'] for 'recommend me something except Souls-like'.").optional(),min_discount:m.number().int().min(1).max(100).describe("Minimum discount %, e.g. 30 for '30%+ off'. Omit to include full-price games too.").optional()}),outputSchema:WP,annotations:Te},({steamid:o,count:r,exclude_tags:i,min_discount:a})=>n(async()=>t.getRecommendedGames(await t.requireSteamId(o),{count:r,excludeTags:i,minDiscount:a}))),e.registerTool("get_player_achievements",{title:"Get a player's achievements",description:`Get a player's achievement progress for one game (unlocked count, % complete, per-achievement unlock dates) by SteamID64 + appid \u2014 \`unlocked\`/\`completion_pct\` always reflect the full list, but the per-achievement \`achievements\` array is capped at ${Cr}, unlocked first (check \`returned\` vs \`total\` \u2014 most games have far fewer). For the game's full achievement list (names, descriptions, global rarity) independent of any player, use get_game_achievements instead; for just the rarity without a key, use get_global_achievements. Requires STEAM_API_KEY and a public profile with game-details visibility \u2014 otherwise it returns found:false (also returned if the game has no achievements at all).`,inputSchema:m.object({steamid:_t,appid:Nt,language:m.string().min(2).describe("Language for achievement names/descriptions; overrides STEAM_LANGUAGE.").optional()}),outputSchema:KP,annotations:Te},({steamid:o,appid:r,language:i})=>n(async()=>t.getPlayerAchievements(await t.requireSteamId(o),r,i)))}var XP=8;function Zv(e,t){return{description:e,messages:[{role:"user",content:{type:"text",text:t}}]}}function mw(e,t){e.registerPrompt("what_should_i_play",{title:"What should I play next?",description:"Recommend games from the Steam catalog based on a player's library and taste, excluding what they already own.",argsSchema:m.object({steamid:m.string().describe("SteamID64 whose library to base taste on. Omit to use the configured STEAM_ID.").optional(),budget:m.string().describe("Max price, e.g. '$20' or 'free'. Omit for no limit.").optional(),tags:m.string().describe("Comma-separated tags to steer toward, e.g. 'Roguelike, Deckbuilding'. Omit to infer from the library.").optional()})},({steamid:n,budget:o,tags:r})=>Zv("Recommend games based on library/taste",`Recommend what I should play next.
76
76
 
77
77
  `+(r?`1. Call discover_games with tags: ${r} and a good review score (min_review 80+). discover_games has no price filter${o?`, so drop any result priced above ${o} yourself from the results`:""}.
78
78
  2. Call get_owned_games${n?` for steamid ${n}`:""} and drop any result I already own.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steam-games-mcp",
3
- "version": "0.10.4",
3
+ "version": "0.10.5",
4
4
  "mcpName": "io.github.Grinv/steam-games-mcp",
5
5
  "description": "Enables LLMs to search and evaluate Steam games — prices, discounts, reviews and Steam Deck compatibility with no API key, plus a player's library, achievements and friends via the official Steam Web API.",
6
6
  "type": "module",