conformtools 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -0
- package/dist/browser/timeline_core_bg.wasm +0 -0
- package/dist/chunk-6TM32YIJ.js +7 -0
- package/dist/chunk-7XTBFOUJ.js +3 -0
- package/dist/chunk-E6YXZIJS.js +230 -0
- package/dist/chunk-GXEVALBL.js +3 -0
- package/dist/{chunk-YPRTUS5W.js → chunk-N43NAG5E.js} +1 -1
- package/dist/chunk-PSMXHDMX.js +3 -0
- package/dist/chunk-PZFWQJCF.js +3 -0
- package/dist/chunk-R6WJ6JIQ.js +3 -0
- package/dist/chunk-UUDNNFU7.js +3 -0
- package/dist/chunk-XDHIIZ6A.js +3 -0
- package/dist/chunk-Y2BEEOPB.js +3 -0
- package/dist/chunk-ZAHP3ES5.js +3 -0
- package/dist/cli.js +5 -4
- package/dist/cr3-wasm-CWKEOCYH.js +3 -0
- package/dist/dng-wasm-JNFS44V5.js +3 -0
- package/dist/dpx-wasm-VNJRFPYY.js +3 -0
- package/dist/exr-wasm-5D66YR7A.js +3 -0
- package/dist/{h264-JHQCJTWP.js → h264-ZB5DJSNV.js} +1 -1
- package/dist/{h264-mxf-4M63NBQK.js → h264-mxf-NVBLGU3V.js} +1 -1
- package/dist/http.js +2 -2
- package/dist/{inspect-6OM4FTVW.js → inspect-MGSZRRAF.js} +2 -2
- package/dist/isobmff-7G55HKDG.js +3 -0
- package/dist/mcp.js +11 -9
- package/dist/media_core-AISE7FMT.js +9 -0
- package/dist/{media_core_bg-XIM7Y4R3.js → media_core_bg-FGAR5KA5.js} +1 -1
- package/dist/mxf-YH2A2XLW.js +3 -0
- package/dist/{ops-7HVBBXUQ.js → ops-BQDPU4M6.js} +1 -1
- package/dist/premiere-uxp/icons/panel.png +0 -0
- package/dist/premiere-uxp/icons/panel@2x.png +0 -0
- package/dist/premiere-uxp/icons/plugin.png +0 -0
- package/dist/premiere-uxp/icons/plugin@2x.png +0 -0
- package/dist/premiere-uxp/index.html +38 -0
- package/dist/premiere-uxp/index.js +93 -0
- package/dist/premiere-uxp/lib/clipmeta.js +170 -0
- package/dist/premiere-uxp/lib/ctx.js +62 -0
- package/dist/premiere-uxp/lib/handles.js +57 -0
- package/dist/premiere-uxp/lib/markers.js +198 -0
- package/dist/premiere-uxp/lib/pairing.js +58 -0
- package/dist/premiere-uxp/lib/premiere.js +82 -0
- package/dist/premiere-uxp/lib/probe.js +139 -0
- package/dist/premiere-uxp/lib/protocol.js +165 -0
- package/dist/premiere-uxp/lib/render.js +38 -0
- package/dist/premiere-uxp/lib/session.js +85 -0
- package/dist/premiere-uxp/lib/sizing.js +312 -0
- package/dist/premiere-uxp/lib/time.js +82 -0
- package/dist/premiere-uxp/lib/timeline.js +336 -0
- package/dist/premiere-uxp/lib/verbs.js +20 -0
- package/dist/premiere-uxp/lib/write.js +97 -0
- package/dist/premiere-uxp/manifest.json +102 -0
- package/dist/r3d-T6D3M2XJ.js +3 -0
- package/dist/{r3d-AT6NNIY3.js → r3d-U4XTQJXQ.js} +1 -1
- package/dist/resolve-bridge.py +551 -0
- package/dist/resolve-presets/conform.tools.xml +127 -0
- package/dist/skills/auto-conform/SKILL.md +87 -0
- package/dist/skills/conform-artist/SKILL.md +68 -0
- package/dist/skills/conform-artist/references/avid.md +19 -0
- package/dist/skills/conform-artist/references/other-hosts.md +23 -0
- package/dist/skills/conform-artist/references/premiere.md +18 -0
- package/dist/skills/conform-artist/references/resolve.md +19 -0
- package/dist/skills/conform-artist/references/troubleshooting.md +33 -0
- package/dist/skills/conform-artist/references/turnover-checklist.md +37 -0
- package/dist/skills/delivery-qc/SKILL.md +48 -0
- package/dist/sscd-embed-DHFTEIOC.js +3 -0
- package/dist/sscd-sweep-OYS4XAID.js +3 -0
- package/dist/{still-E4HLCCST.js → still-UFLOAEM4.js} +1 -1
- package/dist/tiff-wasm-2CEABW6L.js +3 -0
- package/dist/wasm/media_core_bg.wasm +0 -0
- package/dist/wasm/udf_bg.wasm +0 -0
- package/dist/wasm-threads/media_core_bg.wasm +0 -0
- package/dist/{wav-DXF73Y56.js → wav-KNJZMOGX.js} +1 -1
- package/package.json +1 -1
- package/dist/chunk-35U7WGES.js +0 -3
- package/dist/chunk-3XTUTEKJ.js +0 -102
- package/dist/chunk-HJXRLQOI.js +0 -3
- package/dist/chunk-IDDQR56R.js +0 -7
- package/dist/chunk-UUMHVA7R.js +0 -3
- package/dist/chunk-WWGQFOB2.js +0 -64
- package/dist/cr3-wasm-X6Q4YMUU.js +0 -3
- package/dist/dng-wasm-EAB24KDN.js +0 -3
- package/dist/dpx-wasm-OX2D24ZB.js +0 -3
- package/dist/exr-wasm-Z6BBPJSN.js +0 -3
- package/dist/isobmff-XL33CVJR.js +0 -3
- package/dist/media_core-VSTO6CS4.js +0 -9
- package/dist/mxf-VIANACTI.js +0 -3
- package/dist/r3d-2QCFX7UX.js +0 -3
- package/dist/sscd-sweep-IXM4OD7O.js +0 -3
- package/dist/tiff-wasm-XYTQNL2F.js +0 -3
- package/dist/zod-IPSV75LP.js +0 -3
- /package/dist/{arriraw-Y5VXHXNX.js → arriraw-3GKCR6K2.js} +0 -0
- /package/dist/{chunk-NYB4ISL3.js → chunk-WHY3DVXS.js} +0 -0
- /package/dist/{media_core_bg-BKXQLNFA.js → media_core_bg-YK63OUDM.js} +0 -0
- /package/dist/{prores-TQEZ3KFH.js → prores-L4JZZWGH.js} +0 -0
- /package/dist/{timeline_core_bg-QEOVAIWP.js → timeline_core_bg-2TYWZ35G.js} +0 -0
- /package/dist/{udf_bg-UTQ6BVXX.js → udf_bg-A4WEMSAX.js} +0 -0
package/dist/mcp.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{a as Si,b as xi,c as qi}from"./chunk-IDDQR56R.js";import{i as Ni,j as Jo}from"./chunk-3XTUTEKJ.js";import"./chunk-HJXRLQOI.js";import"./chunk-DRHOPOC7.js";import"./chunk-35U7WGES.js";import"./chunk-P7OVDUA5.js";import"./chunk-RXHNBSER.js";import"./chunk-UCMNH6Q6.js";import"./chunk-QDWB7QU7.js";import"./chunk-AHNDJFQR.js";import"./chunk-TK55FA56.js";import"./chunk-JEMLKBH2.js";import"./chunk-YPRTUS5W.js";import"./chunk-UUMHVA7R.js";import{Ac as Ko,Cc as Go,Fa as f,Fd as Ci,Gc as F,Mb as D,Oc as pe,Od as Bo,Rc as S,Td as Mi,Ub as W,Wc as Ii,Xc as K,b as Lo,c as Ei,d as zi,dc as Ti,e as ki,h as Fo,hc as G,ma as Vo,o as Uo,p as Ho,pc as q,q as Nt,r as jt,sc as v,uc as se,v as Pi,w as Ri,wc as V}from"./chunk-WWGQFOB2.js";import"./chunk-C2ESM27Z.js";import"./chunk-NYB4ISL3.js";import{c as $,f as bi}from"./chunk-PSANHDZM.js";var Jt=$(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.regexpCode=A.getEsmExportName=A.getProperty=A.safeStringify=A.stringify=A.strConcat=A.addCodeArg=A.str=A._=A.nil=A._Code=A.Name=A.IDENTIFIER=A._CodeOrName=void 0;var Gt=class{};A._CodeOrName=Gt;A.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Qe=class extends Gt{constructor(e){if(super(),!A.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};A.Name=Qe;var ye=class extends Gt{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,o)=>`${r}${o}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,o)=>(o instanceof Qe&&(r[o.str]=(r[o.str]||0)+1),r),{})}};A._Code=ye;A.nil=new ye("");function na(t,...e){let r=[t[0]],o=0;for(;o<e.length;)$n(r,e[o]),r.push(t[++o]);return new ye(r)}A._=na;var _n=new ye("+");function sa(t,...e){let r=[Bt(t[0])],o=0;for(;o<e.length;)r.push(_n),$n(r,e[o]),r.push(_n,Bt(t[++o]));return Qd(r),new ye(r)}A.str=sa;function $n(t,e){e instanceof ye?t.push(...e._items):e instanceof Qe?t.push(e):t.push(tf(e))}A.addCodeArg=$n;function Qd(t){let e=1;for(;e<t.length-1;){if(t[e]===_n){let r=Yd(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function Yd(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Qe||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Qe))return`"${t}${e.slice(1)}`}function ef(t,e){return e.emptyStr()?t:t.emptyStr()?e:sa`${t}${e}`}A.strConcat=ef;function tf(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Bt(Array.isArray(t)?t.join(","):t)}function rf(t){return new ye(Bt(t))}A.stringify=rf;function Bt(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}A.safeStringify=Bt;function of(t){return typeof t=="string"&&A.IDENTIFIER.test(t)?new ye(`.${t}`):na`[${t}]`}A.getProperty=of;function nf(t){if(typeof t=="string"&&A.IDENTIFIER.test(t))return new ye(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}A.getEsmExportName=nf;function sf(t){return new ye(t.toString())}A.regexpCode=sf});var bn=$(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.ValueScope=le.ValueScopeName=le.Scope=le.varKinds=le.UsedValueState=void 0;var ce=Jt(),vn=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Br;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Br||(le.UsedValueState=Br={}));le.varKinds={const:new ce.Name("const"),let:new ce.Name("let"),var:new ce.Name("var")};var Jr=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof ce.Name?e:this.name(e)}name(e){return new ce.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,o;if(!((o=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||o===void 0)&&o.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};le.Scope=Jr;var Wr=class extends ce.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:o}){this.value=e,this.scopePath=(0,ce._)`.${new ce.Name(r)}[${o}]`}};le.ValueScopeName=Wr;var af=(0,ce._)`\n`,wn=class extends Jr{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?af:ce.nil}}get(){return this._scope}name(e){return new Wr(e,this._newName(e))}value(e,r){var o;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:s}=n,i=(o=r.key)!==null&&o!==void 0?o:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,n);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,n.setValue(r,{property:s,itemIndex:u}),n}getValue(e,r){let o=this._values[e];if(o)return o.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,o=>{if(o.scopePath===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return(0,ce._)`${e}${o.scopePath}`})}scopeCode(e=this._values,r,o){return this._reduceValues(e,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,o)}_reduceValues(e,r,o={},n){let s=ce.nil;for(let i in e){let a=e[i];if(!a)continue;let c=o[i]=o[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Br.Started);let l=r(u);if(l){let d=this.opts.es5?le.varKinds.var:le.varKinds.const;s=(0,ce._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=n?.(u))s=(0,ce._)`${s}${l}${this.opts._n}`;else throw new vn(u);c.set(u,Br.Completed)})}return s}};le.ValueScope=wn});var T=$(I=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0});I.or=I.and=I.not=I.CodeGen=I.operators=I.varKinds=I.ValueScopeName=I.ValueScope=I.Scope=I.Name=I.regexpCode=I.stringify=I.getProperty=I.nil=I.strConcat=I.str=I._=void 0;var M=Jt(),we=bn(),Fe=Jt();Object.defineProperty(I,"_",{enumerable:!0,get:function(){return Fe._}});Object.defineProperty(I,"str",{enumerable:!0,get:function(){return Fe.str}});Object.defineProperty(I,"strConcat",{enumerable:!0,get:function(){return Fe.strConcat}});Object.defineProperty(I,"nil",{enumerable:!0,get:function(){return Fe.nil}});Object.defineProperty(I,"getProperty",{enumerable:!0,get:function(){return Fe.getProperty}});Object.defineProperty(I,"stringify",{enumerable:!0,get:function(){return Fe.stringify}});Object.defineProperty(I,"regexpCode",{enumerable:!0,get:function(){return Fe.regexpCode}});Object.defineProperty(I,"Name",{enumerable:!0,get:function(){return Fe.Name}});var eo=bn();Object.defineProperty(I,"Scope",{enumerable:!0,get:function(){return eo.Scope}});Object.defineProperty(I,"ValueScope",{enumerable:!0,get:function(){return eo.ValueScope}});Object.defineProperty(I,"ValueScopeName",{enumerable:!0,get:function(){return eo.ValueScopeName}});Object.defineProperty(I,"varKinds",{enumerable:!0,get:function(){return eo.varKinds}});I.operators={GT:new M._Code(">"),GTE:new M._Code(">="),LT:new M._Code("<"),LTE:new M._Code("<="),EQ:new M._Code("==="),NEQ:new M._Code("!=="),NOT:new M._Code("!"),OR:new M._Code("||"),AND:new M._Code("&&"),ADD:new M._Code("+")};var qe=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},Sn=class extends qe{constructor(e,r,o){super(),this.varKind=e,this.name=r,this.rhs=o}render({es5:e,_n:r}){let o=e?we.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${o} ${this.name}${n};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=_t(this.rhs,e,r)),this}get names(){return this.rhs instanceof M._CodeOrName?this.rhs.names:{}}},Xr=class extends qe{constructor(e,r,o){super(),this.lhs=e,this.rhs=r,this.sideEffects=o}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof M.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=_t(this.rhs,e,r),this}get names(){let e=this.lhs instanceof M.Name?{}:{...this.lhs.names};return Yr(e,this.rhs)}},xn=class extends Xr{constructor(e,r,o,n){super(e,o,n),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},En=class extends qe{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},zn=class extends qe{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},kn=class extends qe{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},Pn=class extends qe{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=_t(this.code,e,r),this}get names(){return this.code instanceof M._CodeOrName?this.code.names:{}}},Wt=class extends qe{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,o)=>r+o.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let o=e[r].optimizeNodes();Array.isArray(o)?e.splice(r,1,...o):o?e[r]=o:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:o}=this,n=o.length;for(;n--;){let s=o[n];s.optimizeNames(e,r)||(cf(e,s.names),o.splice(n,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>tt(e,r.names),{})}},Ne=class extends Wt{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},Rn=class extends Wt{},yt=class extends Ne{};yt.kind="else";var Ye=class t extends Ne{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let o=r.optimizeNodes();r=this.else=Array.isArray(o)?new yt(o):o}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(ia(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var o;if(this.else=(o=this.else)===null||o===void 0?void 0:o.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=_t(this.condition,e,r),this}get names(){let e=super.names;return Yr(e,this.condition),this.else&&tt(e,this.else.names),e}};Ye.kind="if";var et=class extends Ne{};et.kind="for";var Tn=class extends et{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=_t(this.iteration,e,r),this}get names(){return tt(super.names,this.iteration.names)}},In=class extends et{constructor(e,r,o,n){super(),this.varKind=e,this.name=r,this.from=o,this.to=n}render(e){let r=e.es5?we.varKinds.var:this.varKind,{name:o,from:n,to:s}=this;return`for(${r} ${o}=${n}; ${o}<${s}; ${o}++)`+super.render(e)}get names(){let e=Yr(super.names,this.from);return Yr(e,this.to)}},Qr=class extends et{constructor(e,r,o,n){super(),this.loop=e,this.varKind=r,this.name=o,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=_t(this.iterable,e,r),this}get names(){return tt(super.names,this.iterable.names)}},Xt=class extends Ne{constructor(e,r,o){super(),this.name=e,this.args=r,this.async=o}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Xt.kind="func";var Qt=class extends Wt{render(e){return"return "+super.render(e)}};Qt.kind="return";var Cn=class extends Ne{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var o,n;return super.optimizeNames(e,r),(o=this.catch)===null||o===void 0||o.optimizeNames(e,r),(n=this.finally)===null||n===void 0||n.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&tt(e,this.catch.names),this.finally&&tt(e,this.finally.names),e}},Yt=class extends Ne{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Yt.kind="catch";var er=class extends Ne{render(e){return"finally"+super.render(e)}};er.kind="finally";var Mn=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
4
|
-
`:""},this._extScope=e,this._scope=new we.Scope({parent:e}),this._nodes=[new Rn]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let o=this._extScope.value(e,r);return(this._values[o.prefix]||(this._values[o.prefix]=new Set)).add(o),o}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,o,n){let s=this._scope.toName(r);return o!==void 0&&n&&(this._constants[s.str]=o),this._leafNode(new Sn(e,s,o)),s}const(e,r,o){return this._def(we.varKinds.const,e,r,o)}let(e,r,o){return this._def(we.varKinds.let,e,r,o)}var(e,r,o){return this._def(we.varKinds.var,e,r,o)}assign(e,r,o){return this._leafNode(new Xr(e,r,o))}add(e,r){return this._leafNode(new xn(e,I.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==M.nil&&this._leafNode(new Pn(e)),this}object(...e){let r=["{"];for(let[o,n]of e)r.length>1&&r.push(","),r.push(o),(o!==n||this.opts.es5)&&(r.push(":"),(0,M.addCodeArg)(r,n));return r.push("}"),new M._Code(r)}if(e,r,o){if(this._blockNode(new Ye(e)),r&&o)this.code(r).else().code(o).endIf();else if(r)this.code(r).endIf();else if(o)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new Ye(e))}else(){return this._elseNode(new yt)}endIf(){return this._endBlockNode(Ye,yt)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new Tn(e),r)}forRange(e,r,o,n,s=this.opts.es5?we.varKinds.var:we.varKinds.let){let i=this._scope.toName(e);return this._for(new In(s,i,r,o),()=>n(i))}forOf(e,r,o,n=we.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=r instanceof M.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,M._)`${i}.length`,a=>{this.var(s,(0,M._)`${i}[${a}]`),o(s)})}return this._for(new Qr("of",n,s,r),()=>o(s))}forIn(e,r,o,n=this.opts.es5?we.varKinds.var:we.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,M._)`Object.keys(${r})`,o);let s=this._scope.toName(e);return this._for(new Qr("in",n,s,r),()=>o(s))}endFor(){return this._endBlockNode(et)}label(e){return this._leafNode(new En(e))}break(e){return this._leafNode(new zn(e))}return(e){let r=new Qt;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Qt)}try(e,r,o){if(!r&&!o)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new Cn;if(this._blockNode(n),this.code(e),r){let s=this.name("e");this._currNode=n.catch=new Yt(s),r(s)}return o&&(this._currNode=n.finally=new er,this.code(o)),this._endBlockNode(Yt,er)}throw(e){return this._leafNode(new kn(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let o=this._nodes.length-r;if(o<0||e!==void 0&&o!==e)throw new Error(`CodeGen: wrong number of nodes: ${o} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=M.nil,o,n){return this._blockNode(new Xt(e,r,o)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(Xt)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let o=this._currNode;if(o instanceof e||r&&o instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof Ye))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};I.CodeGen=Mn;function tt(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Yr(t,e){return e instanceof M._CodeOrName?tt(t,e.names):t}function _t(t,e,r){if(t instanceof M.Name)return o(t);if(!n(t))return t;return new M._Code(t._items.reduce((s,i)=>(i instanceof M.Name&&(i=o(i)),i instanceof M._Code?s.push(...i._items):s.push(i),s),[]));function o(s){let i=r[s.str];return i===void 0||e[s.str]!==1?s:(delete e[s.str],i)}function n(s){return s instanceof M._Code&&s._items.some(i=>i instanceof M.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function cf(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function ia(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,M._)`!${qn(t)}`}I.not=ia;var lf=aa(I.operators.AND);function uf(...t){return t.reduce(lf)}I.and=uf;var df=aa(I.operators.OR);function ff(...t){return t.reduce(df)}I.or=ff;function aa(t){return(e,r)=>e===M.nil?r:r===M.nil?e:(0,M._)`${qn(e)} ${t} ${qn(r)}`}function qn(t){return t instanceof M.Name?t:(0,M._)`(${t})`}});var N=$(C=>{"use strict";Object.defineProperty(C,"__esModule",{value:!0});C.checkStrictMode=C.getErrorPath=C.Type=C.useFunc=C.setEvaluated=C.evaluatedPropsToName=C.mergeEvaluated=C.eachItem=C.unescapeJsonPointer=C.escapeJsonPointer=C.escapeFragment=C.unescapeFragment=C.schemaRefOrVal=C.schemaHasRulesButRef=C.schemaHasRules=C.checkUnknownRules=C.alwaysValidSchema=C.toHash=void 0;var L=T(),pf=Jt();function mf(t){let e={};for(let r of t)e[r]=!0;return e}C.toHash=mf;function hf(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(ua(t,e),!da(e,t.self.RULES.all))}C.alwaysValidSchema=hf;function ua(t,e=t.schema){let{opts:r,self:o}=t;if(!r.strictSchema||typeof e=="boolean")return;let n=o.RULES.keywords;for(let s in e)n[s]||ma(t,`unknown keyword: "${s}"`)}C.checkUnknownRules=ua;function da(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}C.schemaHasRules=da;function gf(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}C.schemaHasRulesButRef=gf;function yf({topSchemaRef:t,schemaPath:e},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,L._)`${r}`}return(0,L._)`${t}${e}${(0,L.getProperty)(o)}`}C.schemaRefOrVal=yf;function _f(t){return fa(decodeURIComponent(t))}C.unescapeFragment=_f;function $f(t){return encodeURIComponent(jn(t))}C.escapeFragment=$f;function jn(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}C.escapeJsonPointer=jn;function fa(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}C.unescapeJsonPointer=fa;function vf(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}C.eachItem=vf;function ca({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:o}){return(n,s,i,a)=>{let c=i===void 0?s:i instanceof L.Name?(s instanceof L.Name?t(n,s,i):e(n,s,i),i):s instanceof L.Name?(e(n,i,s),s):r(s,i);return a===L.Name&&!(c instanceof L.Name)?o(n,c):c}}C.mergeEvaluated={props:ca({mergeNames:(t,e,r)=>t.if((0,L._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,L._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,L._)`${r} || {}`).code((0,L._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,L._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,L._)`${r} || {}`),On(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:pa}),items:ca({mergeNames:(t,e,r)=>t.if((0,L._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,L._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,L._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,L._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function pa(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,L._)`{}`);return e!==void 0&&On(t,r,e),r}C.evaluatedPropsToName=pa;function On(t,e,r){Object.keys(r).forEach(o=>t.assign((0,L._)`${e}${(0,L.getProperty)(o)}`,!0))}C.setEvaluated=On;var la={};function wf(t,e){return t.scopeValue("func",{ref:e,code:la[e.code]||(la[e.code]=new pf._Code(e.code))})}C.useFunc=wf;var Nn;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Nn||(C.Type=Nn={}));function bf(t,e,r){if(t instanceof L.Name){let o=e===Nn.Num;return r?o?(0,L._)`"[" + ${t} + "]"`:(0,L._)`"['" + ${t} + "']"`:o?(0,L._)`"/" + ${t}`:(0,L._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,L.getProperty)(t).toString():"/"+jn(t)}C.getErrorPath=bf;function ma(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}C.checkStrictMode=ma});var je=$(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});var te=T(),Sf={data:new te.Name("data"),valCxt:new te.Name("valCxt"),instancePath:new te.Name("instancePath"),parentData:new te.Name("parentData"),parentDataProperty:new te.Name("parentDataProperty"),rootData:new te.Name("rootData"),dynamicAnchors:new te.Name("dynamicAnchors"),vErrors:new te.Name("vErrors"),errors:new te.Name("errors"),this:new te.Name("this"),self:new te.Name("self"),scope:new te.Name("scope"),json:new te.Name("json"),jsonPos:new te.Name("jsonPos"),jsonLen:new te.Name("jsonLen"),jsonPart:new te.Name("jsonPart")};An.default=Sf});var tr=$(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.extendErrors=re.resetErrorsCount=re.reportExtraError=re.reportError=re.keyword$DataError=re.keywordError=void 0;var j=T(),to=N(),ie=je();re.keywordError={message:({keyword:t})=>(0,j.str)`must pass "${t}" keyword validation`};re.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,j.str)`"${t}" keyword must be ${e} ($data)`:(0,j.str)`"${t}" keyword is invalid ($data)`};function xf(t,e=re.keywordError,r,o){let{it:n}=t,{gen:s,compositeRule:i,allErrors:a}=n,c=ya(t,e,r);o??(i||a)?ha(s,c):ga(n,(0,j._)`[${c}]`)}re.reportError=xf;function Ef(t,e=re.keywordError,r){let{it:o}=t,{gen:n,compositeRule:s,allErrors:i}=o,a=ya(t,e,r);ha(n,a),s||i||ga(o,ie.default.vErrors)}re.reportExtraError=Ef;function zf(t,e){t.assign(ie.default.errors,e),t.if((0,j._)`${ie.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,j._)`${ie.default.vErrors}.length`,e),()=>t.assign(ie.default.vErrors,null)))}re.resetErrorsCount=zf;function kf({gen:t,keyword:e,schemaValue:r,data:o,errsCount:n,it:s}){if(n===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",n,ie.default.errors,a=>{t.const(i,(0,j._)`${ie.default.vErrors}[${a}]`),t.if((0,j._)`${i}.instancePath === undefined`,()=>t.assign((0,j._)`${i}.instancePath`,(0,j.strConcat)(ie.default.instancePath,s.errorPath))),t.assign((0,j._)`${i}.schemaPath`,(0,j.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,j._)`${i}.schema`,r),t.assign((0,j._)`${i}.data`,o))})}re.extendErrors=kf;function ha(t,e){let r=t.const("err",e);t.if((0,j._)`${ie.default.vErrors} === null`,()=>t.assign(ie.default.vErrors,(0,j._)`[${r}]`),(0,j._)`${ie.default.vErrors}.push(${r})`),t.code((0,j._)`${ie.default.errors}++`)}function ga(t,e){let{gen:r,validateName:o,schemaEnv:n}=t;n.$async?r.throw((0,j._)`new ${t.ValidationError}(${e})`):(r.assign((0,j._)`${o}.errors`,e),r.return(!1))}var rt={keyword:new j.Name("keyword"),schemaPath:new j.Name("schemaPath"),params:new j.Name("params"),propertyName:new j.Name("propertyName"),message:new j.Name("message"),schema:new j.Name("schema"),parentSchema:new j.Name("parentSchema")};function ya(t,e,r){let{createErrors:o}=t.it;return o===!1?(0,j._)`{}`:Pf(t,e,r)}function Pf(t,e,r={}){let{gen:o,it:n}=t,s=[Rf(n,r),Tf(t,r)];return If(t,e,s),o.object(...s)}function Rf({errorPath:t},{instancePath:e}){let r=e?(0,j.str)`${t}${(0,to.getErrorPath)(e,to.Type.Str)}`:t;return[ie.default.instancePath,(0,j.strConcat)(ie.default.instancePath,r)]}function Tf({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:o}){let n=o?e:(0,j.str)`${e}/${t}`;return r&&(n=(0,j.str)`${n}${(0,to.getErrorPath)(r,to.Type.Str)}`),[rt.schemaPath,n]}function If(t,{params:e,message:r},o){let{keyword:n,data:s,schemaValue:i,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;o.push([rt.keyword,n],[rt.params,typeof e=="function"?e(t):e||(0,j._)`{}`]),c.messages&&o.push([rt.message,typeof r=="function"?r(t):r]),c.verbose&&o.push([rt.schema,i],[rt.parentSchema,(0,j._)`${l}${d}`],[ie.default.data,s]),u&&o.push([rt.propertyName,u])}});var $a=$($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.boolOrEmptySchema=$t.topBoolOrEmptySchema=void 0;var Cf=tr(),Mf=T(),qf=je(),Nf={message:"boolean schema is false"};function jf(t){let{gen:e,schema:r,validateName:o}=t;r===!1?_a(t,!1):typeof r=="object"&&r.$async===!0?e.return(qf.default.data):(e.assign((0,Mf._)`${o}.errors`,null),e.return(!0))}$t.topBoolOrEmptySchema=jf;function Of(t,e){let{gen:r,schema:o}=t;o===!1?(r.var(e,!1),_a(t)):r.var(e,!0)}$t.boolOrEmptySchema=Of;function _a(t,e){let{gen:r,data:o}=t,n={gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,Cf.reportError)(n,Nf,void 0,e)}});var Dn=$(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.getRules=vt.isJSONType=void 0;var Af=["string","number","integer","boolean","null","object","array"],Df=new Set(Af);function Zf(t){return typeof t=="string"&&Df.has(t)}vt.isJSONType=Zf;function Lf(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}vt.getRules=Lf});var Zn=$(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.shouldUseRule=Ue.shouldUseGroup=Ue.schemaHasRulesForType=void 0;function Ff({schema:t,self:e},r){let o=e.RULES.types[r];return o&&o!==!0&&va(t,o)}Ue.schemaHasRulesForType=Ff;function va(t,e){return e.rules.some(r=>wa(t,r))}Ue.shouldUseGroup=va;function wa(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(o=>t[o]!==void 0))}Ue.shouldUseRule=wa});var rr=$(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.reportTypeError=oe.checkDataTypes=oe.checkDataType=oe.coerceAndCheckDataType=oe.getJSONTypes=oe.getSchemaTypes=oe.DataType=void 0;var Uf=Dn(),Hf=Zn(),Vf=tr(),R=T(),ba=N(),wt;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(wt||(oe.DataType=wt={}));function Kf(t){let e=Sa(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}oe.getSchemaTypes=Kf;function Sa(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(Uf.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}oe.getJSONTypes=Sa;function Gf(t,e){let{gen:r,data:o,opts:n}=t,s=Bf(e,n.coerceTypes),i=e.length>0&&!(s.length===0&&e.length===1&&(0,Hf.schemaHasRulesForType)(t,e[0]));if(i){let a=Fn(e,o,n.strictNumbers,wt.Wrong);r.if(a,()=>{s.length?Jf(t,e,s):Un(t)})}return i}oe.coerceAndCheckDataType=Gf;var xa=new Set(["string","number","integer","boolean","null"]);function Bf(t,e){return e?t.filter(r=>xa.has(r)||e==="array"&&r==="array"):[]}function Jf(t,e,r){let{gen:o,data:n,opts:s}=t,i=o.let("dataType",(0,R._)`typeof ${n}`),a=o.let("coerced",(0,R._)`undefined`);s.coerceTypes==="array"&&o.if((0,R._)`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,(0,R._)`${n}[0]`).assign(i,(0,R._)`typeof ${n}`).if(Fn(e,n,s.strictNumbers),()=>o.assign(a,n))),o.if((0,R._)`${a} !== undefined`);for(let u of r)(xa.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);o.else(),Un(t),o.endIf(),o.if((0,R._)`${a} !== undefined`,()=>{o.assign(n,a),Wf(t,a)});function c(u){switch(u){case"string":o.elseIf((0,R._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,R._)`"" + ${n}`).elseIf((0,R._)`${n} === null`).assign(a,(0,R._)`""`);return;case"number":o.elseIf((0,R._)`${i} == "boolean" || ${n} === null
|
|
5
|
-
|| (${i} == "string" && ${n} && ${n} == +${n})`).assign(a,(0,
|
|
6
|
-
|| (${i} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,(0,
|
|
7
|
-
|| ${i} === "boolean" || ${n} === null`).assign(a,(0,R._)`[${n}]`)}}}function Wf({gen:t,parentData:e,parentDataProperty:r},o){t.if((0,R._)`${e} !== undefined`,()=>t.assign((0,R._)`${e}[${r}]`,o))}function Ln(t,e,r,o=wt.Correct){let n=o===wt.Correct?R.operators.EQ:R.operators.NEQ,s;switch(t){case"null":return(0,R._)`${e} ${n} null`;case"array":s=(0,R._)`Array.isArray(${e})`;break;case"object":s=(0,R._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=i((0,R._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=i();break;default:return(0,R._)`typeof ${e} ${n} ${t}`}return o===wt.Correct?s:(0,R.not)(s);function i(a=R.nil){return(0,R.and)((0,R._)`typeof ${e} == "number"`,a,r?(0,R._)`isFinite(${e})`:R.nil)}}oe.checkDataType=Ln;function Fn(t,e,r,o){if(t.length===1)return Ln(t[0],e,r,o);let n,s=(0,ba.toHash)(t);if(s.array&&s.object){let i=(0,R._)`typeof ${e} != "object"`;n=s.null?i:(0,R._)`!${e} || ${i}`,delete s.null,delete s.array,delete s.object}else n=R.nil;s.number&&delete s.integer;for(let i in s)n=(0,R.and)(n,Ln(i,e,r,o));return n}oe.checkDataTypes=Fn;var Xf={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,R._)`{type: ${t}}`:(0,R._)`{type: ${e}}`};function Un(t){let e=Qf(t);(0,Vf.reportError)(e,Xf)}oe.reportTypeError=Un;function Qf(t){let{gen:e,data:r,schema:o}=t,n=(0,ba.schemaRefOrVal)(t,o,"type");return{gen:e,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:t}}});var za=$(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});ro.assignDefaults=void 0;var bt=T(),Yf=N();function ep(t,e){let{properties:r,items:o}=t.schema;if(e==="object"&&r)for(let n in r)Ea(t,n,r[n].default);else e==="array"&&Array.isArray(o)&&o.forEach((n,s)=>Ea(t,s,n.default))}ro.assignDefaults=ep;function Ea(t,e,r){let{gen:o,compositeRule:n,data:s,opts:i}=t;if(r===void 0)return;let a=(0,bt._)`${s}${(0,bt.getProperty)(e)}`;if(n){(0,Yf.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,bt._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,bt._)`${c} || ${a} === null || ${a} === ""`),o.if(c,(0,bt._)`${a} = ${(0,bt.stringify)(r)}`)}});var _e=$(Z=>{"use strict";Object.defineProperty(Z,"__esModule",{value:!0});Z.validateUnion=Z.validateArray=Z.usePattern=Z.callValidateCode=Z.schemaProperties=Z.allSchemaProperties=Z.noPropertyInData=Z.propertyInData=Z.isOwnProperty=Z.hasPropFunc=Z.reportMissingProp=Z.checkMissingProp=Z.checkReportMissingProp=void 0;var U=T(),Hn=N(),He=je(),tp=N();function rp(t,e){let{gen:r,data:o,it:n}=t;r.if(Kn(r,o,e,n.opts.ownProperties),()=>{t.setParams({missingProperty:(0,U._)`${e}`},!0),t.error()})}Z.checkReportMissingProp=rp;function op({gen:t,data:e,it:{opts:r}},o,n){return(0,U.or)(...o.map(s=>(0,U.and)(Kn(t,e,s,r.ownProperties),(0,U._)`${n} = ${s}`)))}Z.checkMissingProp=op;function np(t,e){t.setParams({missingProperty:e},!0),t.error()}Z.reportMissingProp=np;function ka(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,U._)`Object.prototype.hasOwnProperty`})}Z.hasPropFunc=ka;function Vn(t,e,r){return(0,U._)`${ka(t)}.call(${e}, ${r})`}Z.isOwnProperty=Vn;function sp(t,e,r,o){let n=(0,U._)`${e}${(0,U.getProperty)(r)} !== undefined`;return o?(0,U._)`${n} && ${Vn(t,e,r)}`:n}Z.propertyInData=sp;function Kn(t,e,r,o){let n=(0,U._)`${e}${(0,U.getProperty)(r)} === undefined`;return o?(0,U.or)(n,(0,U.not)(Vn(t,e,r))):n}Z.noPropertyInData=Kn;function Pa(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}Z.allSchemaProperties=Pa;function ip(t,e){return Pa(e).filter(r=>!(0,Hn.alwaysValidSchema)(t,e[r]))}Z.schemaProperties=ip;function ap({schemaCode:t,data:e,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:s},it:i},a,c,u){let l=u?(0,U._)`${t}, ${e}, ${o}${n}`:e,d=[[He.default.instancePath,(0,U.strConcat)(He.default.instancePath,s)],[He.default.parentData,i.parentData],[He.default.parentDataProperty,i.parentDataProperty],[He.default.rootData,He.default.rootData]];i.opts.dynamicRef&&d.push([He.default.dynamicAnchors,He.default.dynamicAnchors]);let p=(0,U._)`${l}, ${r.object(...d)}`;return c!==U.nil?(0,U._)`${a}.call(${c}, ${p})`:(0,U._)`${a}(${p})`}Z.callValidateCode=ap;var cp=(0,U._)`new RegExp`;function lp({gen:t,it:{opts:e}},r){let o=e.unicodeRegExp?"u":"",{regExp:n}=e.code,s=n(r,o);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,U._)`${n.code==="new RegExp"?cp:(0,tp.useFunc)(t,n)}(${r}, ${o})`})}Z.usePattern=lp;function up(t){let{gen:e,data:r,keyword:o,it:n}=t,s=e.name("valid");if(n.allErrors){let a=e.let("valid",!0);return i(()=>e.assign(a,!1)),a}return e.var(s,!0),i(()=>e.break()),s;function i(a){let c=e.const("len",(0,U._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:o,dataProp:u,dataPropType:Hn.Type.Num},s),e.if((0,U.not)(s),a)})}}Z.validateArray=up;function dp(t){let{gen:e,schema:r,keyword:o,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Hn.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let i=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:o,schemaProp:u,compositeRule:!0},a);e.assign(i,(0,U._)`${i} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,U.not)(i))})),t.result(i,()=>t.reset(),()=>t.error(!0))}Z.validateUnion=dp});var Ia=$(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.validateKeywordUsage=Pe.validSchemaType=Pe.funcKeywordCode=Pe.macroKeywordCode=void 0;var ae=T(),ot=je(),fp=_e(),pp=tr();function mp(t,e){let{gen:r,keyword:o,schema:n,parentSchema:s,it:i}=t,a=e.macro.call(i.self,n,s,i),c=Ta(r,o,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:ae.nil,errSchemaPath:`${i.errSchemaPath}/${o}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}Pe.macroKeywordCode=mp;function hp(t,e){var r;let{gen:o,keyword:n,schema:s,parentSchema:i,$data:a,it:c}=t;yp(c,e);let u=!a&&e.compile?e.compile.call(c.self,s,i,c):e.validate,l=Ta(o,n,u),d=o.let("valid");t.block$data(d,p),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function p(){if(e.errors===!1)g(),e.modifying&&Ra(t),y(()=>t.error());else{let _=e.async?m():h();e.modifying&&Ra(t),y(()=>gp(t,_))}}function m(){let _=o.let("ruleErrs",null);return o.try(()=>g((0,ae._)`await `),w=>o.assign(d,!1).if((0,ae._)`${w} instanceof ${c.ValidationError}`,()=>o.assign(_,(0,ae._)`${w}.errors`),()=>o.throw(w))),_}function h(){let _=(0,ae._)`${l}.errors`;return o.assign(_,null),g(ae.nil),_}function g(_=e.async?(0,ae._)`await `:ae.nil){let w=c.opts.passContext?ot.default.this:ot.default.self,E=!("compile"in e&&!a||e.schema===!1);o.assign(d,(0,ae._)`${_}${(0,fp.callValidateCode)(t,l,w,E)}`,e.modifying)}function y(_){var w;o.if((0,ae.not)((w=e.valid)!==null&&w!==void 0?w:d),_)}}Pe.funcKeywordCode=hp;function Ra(t){let{gen:e,data:r,it:o}=t;e.if(o.parentData,()=>e.assign(r,(0,ae._)`${o.parentData}[${o.parentDataProperty}]`))}function gp(t,e){let{gen:r}=t;r.if((0,ae._)`Array.isArray(${e})`,()=>{r.assign(ot.default.vErrors,(0,ae._)`${ot.default.vErrors} === null ? ${e} : ${ot.default.vErrors}.concat(${e})`).assign(ot.default.errors,(0,ae._)`${ot.default.vErrors}.length`),(0,pp.extendErrors)(t)},()=>t.error())}function yp({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function Ta(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,ae.stringify)(r)})}function _p(t,e,r=!1){return!e.length||e.some(o=>o==="array"?Array.isArray(t):o==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==o||r&&typeof t>"u")}Pe.validSchemaType=_p;function $p({schema:t,opts:e,self:r,errSchemaPath:o},n,s){if(Array.isArray(n.keyword)?!n.keyword.includes(s):n.keyword!==s)throw new Error("ajv implementation error");let i=n.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(n.validateSchema&&!n.validateSchema(t[s])){let c=`keyword "${s}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Pe.validateKeywordUsage=$p});var Ma=$(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.extendSubschemaMode=Ve.extendSubschemaData=Ve.getSubschema=void 0;var Re=T(),Ca=N();function vp(t,{keyword:e,schemaProp:r,schema:o,schemaPath:n,errSchemaPath:s,topSchemaRef:i}){if(e!==void 0&&o!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Re._)`${t.schemaPath}${(0,Re.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Re._)`${t.schemaPath}${(0,Re.getProperty)(e)}${(0,Re.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Ca.escapeFragment)(r)}`}}if(o!==void 0){if(n===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:n,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}Ve.getSubschema=vp;function wp(t,e,{dataProp:r,dataPropType:o,data:n,dataTypes:s,propertyName:i}){if(n!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,p=a.let("data",(0,Re._)`${e.data}${(0,Re.getProperty)(r)}`,!0);c(p),t.errorPath=(0,Re.str)`${u}${(0,Ca.getErrorPath)(r,o,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Re._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(n!==void 0){let u=n instanceof Re.Name?n:a.let("data",n,!0);c(u),i!==void 0&&(t.propertyName=i)}s&&(t.dataTypes=s);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}Ve.extendSubschemaData=wp;function bp(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:s}){o!==void 0&&(t.compositeRule=o),n!==void 0&&(t.createErrors=n),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=r}Ve.extendSubschemaMode=bp});var Gn=$((Vv,qa)=>{"use strict";qa.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var o,n,s;if(Array.isArray(e)){if(o=e.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!t(e[n],r[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),o=s.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=o;n--!==0;){var i=s[n];if(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r}});var ja=$((Kv,Na)=>{"use strict";var Ke=Na.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var o=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};oo(e,o,n,t,"",t)};Ke.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Ke.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Ke.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Ke.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 oo(t,e,r,o,n,s,i,a,c,u){if(o&&typeof o=="object"&&!Array.isArray(o)){e(o,n,s,i,a,c,u);for(var l in o){var d=o[l];if(Array.isArray(d)){if(l in Ke.arrayKeywords)for(var p=0;p<d.length;p++)oo(t,e,r,d[p],n+"/"+l+"/"+p,s,n,l,o,p)}else if(l in Ke.propsKeywords){if(d&&typeof d=="object")for(var m in d)oo(t,e,r,d[m],n+"/"+l+"/"+Sp(m),s,n,l,o,m)}else(l in Ke.keywords||t.allKeys&&!(l in Ke.skipKeywords))&&oo(t,e,r,d,n+"/"+l,s,n,l,o)}r(o,n,s,i,a,c,u)}}function Sp(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var or=$(ue=>{"use strict";Object.defineProperty(ue,"__esModule",{value:!0});ue.getSchemaRefs=ue.resolveUrl=ue.normalizeId=ue._getFullPath=ue.getFullPath=ue.inlineRef=void 0;var xp=N(),Ep=Gn(),zp=ja(),kp=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Pp(t,e=!0){return typeof t=="boolean"?!0:e===!0?!Bn(t):e?Oa(t)<=e:!1}ue.inlineRef=Pp;var Rp=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Bn(t){for(let e in t){if(Rp.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(Bn)||typeof r=="object"&&Bn(r))return!0}return!1}function Oa(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!kp.has(r)&&(typeof t[r]=="object"&&(0,xp.eachItem)(t[r],o=>e+=Oa(o)),e===1/0))return 1/0}return e}function Aa(t,e="",r){r!==!1&&(e=St(e));let o=t.parse(e);return Da(t,o)}ue.getFullPath=Aa;function Da(t,e){return t.serialize(e).split("#")[0]+"#"}ue._getFullPath=Da;var Tp=/#\/?$/;function St(t){return t?t.replace(Tp,""):""}ue.normalizeId=St;function Ip(t,e,r){return r=St(r),t.resolve(e,r)}ue.resolveUrl=Ip;var Cp=/^[a-z_][-a-z0-9._]*$/i;function Mp(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=St(t[r]||e),s={"":n},i=Aa(o,n,!1),a={},c=new Set;return zp(t,{allKeys:!0},(d,p,m,h)=>{if(h===void 0)return;let g=i+p,y=s[h];typeof d[r]=="string"&&(y=_.call(this,d[r])),w.call(this,d.$anchor),w.call(this,d.$dynamicAnchor),s[p]=y;function _(E){let O=this.opts.uriResolver.resolve;if(E=St(y?O(y,E):E),c.has(E))throw l(E);c.add(E);let P=this.refs[E];return typeof P=="string"&&(P=this.refs[P]),typeof P=="object"?u(d,P.schema,E):E!==St(g)&&(E[0]==="#"?(u(d,a[E],E),a[E]=d):this.refs[E]=g),E}function w(E){if(typeof E=="string"){if(!Cp.test(E))throw new Error(`invalid anchor "${E}"`);_.call(this,`#${E}`)}}}),a;function u(d,p,m){if(p!==void 0&&!Ep(d,p))throw l(m)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}ue.getSchemaRefs=Mp});var ir=$(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.getData=Ge.KeywordCxt=Ge.validateFunctionCode=void 0;var Ha=$a(),Za=rr(),Wn=Zn(),no=rr(),qp=za(),sr=Ia(),Jn=Ma(),x=T(),k=je(),Np=or(),Oe=N(),nr=tr();function jp(t){if(Ga(t)&&(Ba(t),Ka(t))){Dp(t);return}Va(t,()=>(0,Ha.topBoolOrEmptySchema)(t))}Ge.validateFunctionCode=jp;function Va({gen:t,validateName:e,schema:r,schemaEnv:o,opts:n},s){n.code.es5?t.func(e,(0,x._)`${k.default.data}, ${k.default.valCxt}`,o.$async,()=>{t.code((0,x._)`"use strict"; ${La(r,n)}`),Ap(t,n),t.code(s)}):t.func(e,(0,x._)`${k.default.data}, ${Op(n)}`,o.$async,()=>t.code(La(r,n)).code(s))}function Op(t){return(0,x._)`{${k.default.instancePath}="", ${k.default.parentData}, ${k.default.parentDataProperty}, ${k.default.rootData}=${k.default.data}${t.dynamicRef?(0,x._)`, ${k.default.dynamicAnchors}={}`:x.nil}}={}`}function Ap(t,e){t.if(k.default.valCxt,()=>{t.var(k.default.instancePath,(0,x._)`${k.default.valCxt}.${k.default.instancePath}`),t.var(k.default.parentData,(0,x._)`${k.default.valCxt}.${k.default.parentData}`),t.var(k.default.parentDataProperty,(0,x._)`${k.default.valCxt}.${k.default.parentDataProperty}`),t.var(k.default.rootData,(0,x._)`${k.default.valCxt}.${k.default.rootData}`),e.dynamicRef&&t.var(k.default.dynamicAnchors,(0,x._)`${k.default.valCxt}.${k.default.dynamicAnchors}`)},()=>{t.var(k.default.instancePath,(0,x._)`""`),t.var(k.default.parentData,(0,x._)`undefined`),t.var(k.default.parentDataProperty,(0,x._)`undefined`),t.var(k.default.rootData,k.default.data),e.dynamicRef&&t.var(k.default.dynamicAnchors,(0,x._)`{}`)})}function Dp(t){let{schema:e,opts:r,gen:o}=t;Va(t,()=>{r.$comment&&e.$comment&&Wa(t),Hp(t),o.let(k.default.vErrors,null),o.let(k.default.errors,0),r.unevaluated&&Zp(t),Ja(t),Gp(t)})}function Zp(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,x._)`${r}.evaluated`),e.if((0,x._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,x._)`${t.evaluated}.props`,(0,x._)`undefined`)),e.if((0,x._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,x._)`${t.evaluated}.items`,(0,x._)`undefined`))}function La(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,x._)`/*# sourceURL=${r} */`:x.nil}function Lp(t,e){if(Ga(t)&&(Ba(t),Ka(t))){Fp(t,e);return}(0,Ha.boolOrEmptySchema)(t,e)}function Ka({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function Ga(t){return typeof t.schema!="boolean"}function Fp(t,e){let{schema:r,gen:o,opts:n}=t;n.$comment&&r.$comment&&Wa(t),Vp(t),Kp(t);let s=o.const("_errs",k.default.errors);Ja(t,s),o.var(e,(0,x._)`${s} === ${k.default.errors}`)}function Ba(t){(0,Oe.checkUnknownRules)(t),Up(t)}function Ja(t,e){if(t.opts.jtd)return Fa(t,[],!1,e);let r=(0,Za.getSchemaTypes)(t.schema),o=(0,Za.coerceAndCheckDataType)(t,r);Fa(t,r,!o,e)}function Up(t){let{schema:e,errSchemaPath:r,opts:o,self:n}=t;e.$ref&&o.ignoreKeywordsWithRef&&(0,Oe.schemaHasRulesButRef)(e,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function Hp(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Oe.checkStrictMode)(t,"default is ignored in the schema root")}function Vp(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,Np.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function Kp(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function Wa({gen:t,schemaEnv:e,schema:r,errSchemaPath:o,opts:n}){let s=r.$comment;if(n.$comment===!0)t.code((0,x._)`${k.default.self}.logger.log(${s})`);else if(typeof n.$comment=="function"){let i=(0,x.str)`${o}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,x._)`${k.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function Gp(t){let{gen:e,schemaEnv:r,validateName:o,ValidationError:n,opts:s}=t;r.$async?e.if((0,x._)`${k.default.errors} === 0`,()=>e.return(k.default.data),()=>e.throw((0,x._)`new ${n}(${k.default.vErrors})`)):(e.assign((0,x._)`${o}.errors`,k.default.vErrors),s.unevaluated&&Bp(t),e.return((0,x._)`${k.default.errors} === 0`))}function Bp({gen:t,evaluated:e,props:r,items:o}){r instanceof x.Name&&t.assign((0,x._)`${e}.props`,r),o instanceof x.Name&&t.assign((0,x._)`${e}.items`,o)}function Fa(t,e,r,o){let{gen:n,schema:s,data:i,allErrors:a,opts:c,self:u}=t,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,Oe.schemaHasRulesButRef)(s,l))){n.block(()=>Qa(t,"$ref",l.all.$ref.definition));return}c.jtd||Jp(t,e),n.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){(0,Wn.shouldUseGroup)(s,p)&&(p.type?(n.if((0,no.checkDataType)(p.type,i,c.strictNumbers)),Ua(t,p),e.length===1&&e[0]===p.type&&r&&(n.else(),(0,no.reportTypeError)(t)),n.endIf()):Ua(t,p),a||n.if((0,x._)`${k.default.errors} === ${o||0}`))}}function Ua(t,e){let{gen:r,schema:o,opts:{useDefaults:n}}=t;n&&(0,qp.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,Wn.shouldUseRule)(o,s)&&Qa(t,s.keyword,s.definition,e.type)})}function Jp(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(Wp(t,e),t.opts.allowUnionTypes||Xp(t,e),Qp(t,t.dataTypes))}function Wp(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{Xa(t.dataTypes,r)||Xn(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),em(t,e)}}function Xp(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Xn(t,"use allowUnionTypes to allow union type keyword")}function Qp(t,e){let r=t.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&(0,Wn.shouldUseRule)(t.schema,n)){let{type:s}=n.definition;s.length&&!s.some(i=>Yp(e,i))&&Xn(t,`missing type "${s.join(",")}" for keyword "${o}"`)}}}function Yp(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function Xa(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function em(t,e){let r=[];for(let o of t.dataTypes)Xa(e,o)?r.push(o):e.includes("integer")&&o==="number"&&r.push("integer");t.dataTypes=r}function Xn(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Oe.checkStrictMode)(t,e,t.opts.strictTypes)}var so=class{constructor(e,r,o){if((0,sr.validateKeywordUsage)(e,r,o),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=o,this.data=e.data,this.schema=e.schema[o],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Oe.schemaRefOrVal)(e,this.schema,o,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",Ya(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,sr.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${o} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",k.default.errors))}result(e,r,o){this.failResult((0,x.not)(e),r,o)}failResult(e,r,o){this.gen.if(e),o?o():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,x.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,x._)`${r} !== undefined && (${(0,x.or)(this.invalid$data(),e)})`)}error(e,r,o){if(r){this.setParams(r),this._error(e,o),this.setParams({});return}this._error(e,o)}_error(e,r){(e?nr.reportExtraError:nr.reportError)(this,this.def.error,r)}$dataError(){(0,nr.reportError)(this,this.def.$dataError||nr.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,nr.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,o=x.nil){this.gen.block(()=>{this.check$data(e,o),r()})}check$data(e=x.nil,r=x.nil){if(!this.$data)return;let{gen:o,schemaCode:n,schemaType:s,def:i}=this;o.if((0,x.or)((0,x._)`${n} === undefined`,r)),e!==x.nil&&o.assign(e,!0),(s.length||i.validateSchema)&&(o.elseIf(this.invalid$data()),this.$dataError(),e!==x.nil&&o.assign(e,!1)),o.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:o,def:n,it:s}=this;return(0,x.or)(i(),a());function i(){if(o.length){if(!(r instanceof x.Name))throw new Error("ajv implementation error");let c=Array.isArray(o)?o:[o];return(0,x._)`${(0,no.checkDataTypes)(c,r,s.opts.strictNumbers,no.DataType.Wrong)}`}return x.nil}function a(){if(n.validateSchema){let c=e.scopeValue("validate$data",{ref:n.validateSchema});return(0,x._)`!${c}(${r})`}return x.nil}}subschema(e,r){let o=(0,Jn.getSubschema)(this.it,e);(0,Jn.extendSubschemaData)(o,this.it,e),(0,Jn.extendSubschemaMode)(o,e);let n={...this.it,...o,items:void 0,props:void 0};return Lp(n,r),n}mergeEvaluated(e,r){let{it:o,gen:n}=this;o.opts.unevaluated&&(o.props!==!0&&e.props!==void 0&&(o.props=Oe.mergeEvaluated.props(n,e.props,o.props,r)),o.items!==!0&&e.items!==void 0&&(o.items=Oe.mergeEvaluated.items(n,e.items,o.items,r)))}mergeValidEvaluated(e,r){let{it:o,gen:n}=this;if(o.opts.unevaluated&&(o.props!==!0||o.items!==!0))return n.if(r,()=>this.mergeEvaluated(e,x.Name)),!0}};Ge.KeywordCxt=so;function Qa(t,e,r,o){let n=new so(t,r,e);"code"in r?r.code(n,o):n.$data&&r.validate?(0,sr.funcKeywordCode)(n,r):"macro"in r?(0,sr.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,sr.funcKeywordCode)(n,r)}var tm=/^\/(?:[^~]|~0|~1)*$/,rm=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Ya(t,{dataLevel:e,dataNames:r,dataPathArr:o}){let n,s;if(t==="")return k.default.rootData;if(t[0]==="/"){if(!tm.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);n=t,s=k.default.rootData}else{let u=rm.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(n=u[2],n==="#"){if(l>=e)throw new Error(c("property/index",l));return o[e-l]}if(l>e)throw new Error(c("data",l));if(s=r[e-l],!n)return s}let i=s,a=n.split("/");for(let u of a)u&&(s=(0,x._)`${s}${(0,x.getProperty)((0,Oe.unescapeJsonPointer)(u))}`,i=(0,x._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}Ge.getData=Ya});var io=$(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});var Qn=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};Yn.default=Qn});var ar=$(rs=>{"use strict";Object.defineProperty(rs,"__esModule",{value:!0});var es=or(),ts=class extends Error{constructor(e,r,o,n){super(n||`can't resolve reference ${o} from id ${r}`),this.missingRef=(0,es.resolveUrl)(e,r,o),this.missingSchema=(0,es.normalizeId)((0,es.getFullPath)(e,this.missingRef))}};rs.default=ts});var co=$($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.resolveSchema=$e.getCompilingSchema=$e.resolveRef=$e.compileSchema=$e.SchemaEnv=void 0;var be=T(),om=io(),nt=je(),Se=or(),ec=N(),nm=ir(),xt=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let o;typeof e.schema=="object"&&(o=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,Se.normalizeId)(o?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=o?.$async,this.refs={}}};$e.SchemaEnv=xt;function ns(t){let e=tc.call(this,t);if(e)return e;let r=(0,Se.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:s}=this.opts,i=new be.CodeGen(this.scope,{es5:o,lines:n,ownProperties:s}),a;t.$async&&(a=i.scopeValue("Error",{ref:om.default,code:(0,be._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");t.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:nt.default.data,parentData:nt.default.parentData,parentDataProperty:nt.default.parentDataProperty,dataNames:[nt.default.data],dataPathArr:[be.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,be.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:be.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,be._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,nm.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let d=i.toString();l=`${i.scopeRefs(nt.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let m=new Function(`${nt.default.self}`,`${nt.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:m}),m.errors=null,m.schema=t.schema,m.schemaEnv=t,t.$async&&(m.$async=!0),this.opts.code.source===!0&&(m.source={validateName:c,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){let{props:h,items:g}=u;m.evaluated={props:h instanceof be.Name?void 0:h,items:g instanceof be.Name?void 0:g,dynamicProps:h instanceof be.Name,dynamicItems:g instanceof be.Name},m.source&&(m.source.evaluated=(0,be.stringify)(m.evaluated))}return t.validate=m,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}$e.compileSchema=ns;function sm(t,e,r){var o;r=(0,Se.resolveUrl)(this.opts.uriResolver,e,r);let n=t.refs[r];if(n)return n;let s=cm.call(this,t,r);if(s===void 0){let i=(o=t.localRefs)===null||o===void 0?void 0:o[r],{schemaId:a}=this.opts;i&&(s=new xt({schema:i,schemaId:a,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=im.call(this,s)}$e.resolveRef=sm;function im(t){return(0,Se.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:ns.call(this,t)}function tc(t){for(let e of this._compilations)if(am(e,t))return e}$e.getCompilingSchema=tc;function am(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function cm(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||ao.call(this,t,e)}function ao(t,e){let r=this.opts.uriResolver.parse(e),o=(0,Se._getFullPath)(this.opts.uriResolver,r),n=(0,Se.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&o===n)return os.call(this,r,t);let s=(0,Se.normalizeId)(o),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=ao.call(this,t,i);return typeof a?.schema!="object"?void 0:os.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||ns.call(this,i),s===(0,Se.normalizeId)(e)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(n=(0,Se.resolveUrl)(this.opts.uriResolver,n,u)),new xt({schema:a,schemaId:c,root:t,baseId:n})}return os.call(this,r,i)}}$e.resolveSchema=ao;var lm=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function os(t,{baseId:e,schema:r,root:o}){var n;if(((n=t.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,ec.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!lm.has(a)&&u&&(e=(0,Se.resolveUrl)(this.opts.uriResolver,e,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,ec.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Se.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=ao.call(this,o,a)}let{schemaId:i}=this.opts;if(s=s||new xt({schema:r,schemaId:i,root:o,baseId:e}),s.schema!==s.root.schema)return s}});var rc=$((Qv,um)=>{um.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}});var us=$((Yv,lc)=>{"use strict";var dm=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),is=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),fm=RegExp.prototype.test.bind(/^\d*$/u),st=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),as=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),nc=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),cs=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),pm=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),de=new Array(256);{let t="0123456789ABCDEF";for(let e=0;e<256;e++)de[e]="%"+t[e>>4]+t[e&15]}function ne(t){return t<2048?de[192|t>>6]+de[128|t&63]:t<65536?de[224|t>>12]+de[128|t>>6&63]+de[128|t&63]:de[240|t>>18]+de[128|t>>12&63]+de[128|t>>6&63]+de[128|t&63]}function mm(t){let e="",r=0,o=0;for(o=0;o<t.length;o++)if(r=t[o].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[o];break}for(o+=1;o<t.length;o++){if(r=t[o].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[o]}return e}var hm=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),gm=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),ym=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),_m=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function $m(t){if(t.length===0)return!1;for(let e=0;e<t.length;e++)if(!ym(t[e])){if(t[e]==="%"&&e+2<t.length&&st(t.slice(e+1,e+3))){e+=2;continue}return!1}return!0}function oc(t){let e=-1,r=0,o=-1,n=0;for(let a=0;a<t.length;a++)t[a]==="0"?(o===-1&&(o=a),n++,n>r&&(r=n,e=o)):(o=-1,n=0);if(r<2)return t.join(":");let s=t.slice(0,e).join(":"),i=t.slice(e+r).join(":");return s+"::"+i}function vm(t){let e=t.indexOf("::");if(e!==-1&&t.indexOf("::",e+1)!==-1)return;let r=e===-1?t.split(":"):t.slice(0,e).split(":"),o=e===-1?[]:t.slice(e+2).split(":");e!==-1&&(r.length===1&&r[0]===""&&(r.length=0),o.length===1&&o[0]===""&&(o.length=0));let n=r.concat(o),s=0;for(let a=0;a<n.length;a++){let c=n[a];if(c==="")return;if(c.indexOf(".")!==-1){if(a!==n.length-1||e!==-1&&o.length===0||!is(c))return;s+=2;continue}if(!hm(c))return;n[a]=parseInt(c,16).toString(16),s++}if(e===-1)return s!==8?void 0:oc(n);if(s>=8)return;let i=n.slice(0,r.length);for(let a=s;a<8;a++)i.push("0");for(let a=r.length;a<n.length;a++)i.push(n[a]);return oc(i)}function ss(t){let e=t[0]==="["&&t[t.length-1]==="]";if((t[0]==="["||t[t.length-1]==="]")&&!e)return{host:t,isIPV6:!1,error:!0};let o=e?t.slice(1,-1):t;if(e&&gm(o))return o=o.toLowerCase(),{host:`[${o}]`,escapedHost:o,isIPV6:!1,isIPVFuture:!0};if(wm(o,":")<2)return{host:t,isIPV6:!1,error:e};let n="",s=o.indexOf("%");if(s!==-1){let a=o.slice(s,s+3).toLowerCase()==="%25"?3:1;if(n=o.slice(s+a),!$m(n))return{host:t,isIPV6:!1,error:!0};o=o.slice(0,s)}let i=vm(o);return i===void 0?{host:t,isIPV6:!1,error:!0}:{host:i+(n?"%"+n:""),escapedHost:i+(n?"%25"+n:""),isIPV6:!0}}function wm(t,e){let r=0;for(let o=0;o<t.length;o++)t[o]===e&&r++;return r}function bm(t){let e=t,r=[],o=-1,n=0;for(;n=e.length;){if(n===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(n===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(n===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((o=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,o)),e=e.slice(o)}return r.join("")}var Sm={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},xm=/[@/?#:]/g,Em=/[@/?#]/g;function sc(t,e){let r=e?Em:xm;return r.lastIndex=0,t.replace(r,o=>Sm[o])}function ic(t,e=!1){if(t.indexOf("%")===-1)return t;let r="";for(let o=0;o<t.length;o++){if(t[o]==="%"&&o+2<t.length){let n=t.slice(o+1,o+3);if(st(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));e&&as(i)?r+=i:r+="%"+s,o+=2;continue}}r+=t[o]}return r}function zm(t){let e="";for(let r=0;r<t.length;r++){let o=t[r];if(o==="%"&&r+2<t.length){let n=t.slice(r+1,r+3);if(st(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));i!=="."&&as(i)?e+=i:e+="%"+s,r+=2;continue}}if(nc(o))e+=o;else{let n=t.charCodeAt(r);if(n<128)e+=cc(n)?o:de[n];else if(n<55296||n>57343)e+=ne(n);else if(n<=56319&&r+1<t.length){let s=t.charCodeAt(r+1);s>=56320&&s<=57343?(e+=ne(65536+(n-55296<<10)+(s-56320)),r++):e+=ne(65533)}else e+=ne(65533)}}return e}function km(t,e=!1){let r="",o=e&&t[0]!=="/";for(let n=0;n<t.length;n++){let s=t[n];if(s==="%"&&n+2<t.length){let i=t.slice(n+1,n+3);if(st(i)){r+="%"+i.toUpperCase(),n+=2;continue}}if(s==="/"&&(o=!1),nc(s)&&(s!==":"||!o))r+=s;else{let i=t.charCodeAt(n);if(i<128)r+=de[i];else if(i<55296||i>57343)r+=ne(i);else if(i<=56319&&n+1<t.length){let a=t.charCodeAt(n+1);a>=56320&&a<=57343?(r+=ne(65536+(i-55296<<10)+(a-56320)),n++):r+=ne(65533)}else r+=ne(65533)}}return r}function ls(t,e){let r="";for(let o=0;o<t.length;o++){let n=t[o];if(n==="%"&&o+2<t.length){let s=t.slice(o+1,o+3);if(st(s)){r+="%"+s.toUpperCase(),o+=2;continue}}if(e(n))r+=n;else{let s=t.charCodeAt(o);if(s<128)r+=de[s];else if(s<55296||s>57343)r+=ne(s);else if(s<=56319&&o+1<t.length){let i=t.charCodeAt(o+1);i>=56320&&i<=57343?(r+=ne(65536+(s-55296<<10)+(i-56320)),o++):r+=ne(65533)}else r+=ne(65533)}}return r}function ac(t){return ls(t,pm)}function Pm(t){return ls(t,cs)}function Rm(t){return ls(t,cs)}function cc(t){return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t===42||t===43||t===45||t===46||t===47||t===64||t===95}function Tm(t){let e="";for(let r=0;r<t.length;r++){let o=t[r];if(o==="%"&&r+2<t.length){let n=t.slice(r+1,r+3);if(st(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));as(i)?e+=i:e+="%"+s,r+=2;continue}}if(cs(o))e+=o;else{let n=t.charCodeAt(r);if(n<128)e+=cc(n)?o:de[n];else if(n<55296||n>57343)e+=ne(n);else if(n<=56319&&r+1<t.length){let s=t.charCodeAt(r+1);s>=56320&&s<=57343?(e+=ne(65536+(n-55296<<10)+(s-56320)),r++):e+=ne(65533)}else e+=ne(65533)}}return e}function Im(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let o=t.slice(r+1,r+3);if(st(o)){e+="%"+o.toUpperCase(),r+=2;continue}}e+=escape(t[r])}return e}function Cm(t){let e=[];if(t.userinfo!==void 0&&(e.push(ac(t.userinfo)),e.push("@")),t.host!==void 0){let r=t.host;if(!is(r)){let o=ss(r);o.isIPV6!==!0&&o.isIPVFuture!==!0&&(r=ic(r,!0),o=ss(r)),o.isIPV6===!0||o.isIPVFuture===!0?r=`[${o.escapedHost}]`:r=sc(r,!1)}e.push(r)}if(typeof t.port=="number"||typeof t.port=="string"){let r=String(t.port);if(!fm(r))throw new TypeError("URI port is malformed.");e.push(":"),e.push(r)}return e.length?e.join(""):void 0}lc.exports={nonSimpleDomain:_m,recomposeAuthority:Cm,reescapeHostDelimiters:sc,normalizePercentEncoding:ic,normalizePathEncoding:zm,serializePathEncoding:km,normalizeQueryFragmentEncoding:Tm,encodeUserinfo:ac,encodeQuery:Pm,encodeFragment:Rm,escapePreservingEscapes:Im,removeDotSegments:bm,isIPv4:is,isUUID:dm,normalizeIPv6:ss,stringArrayToHexStripped:mm}});var mc=$((ew,pc)=>{"use strict";var{isUUID:Mm}=us(),qm=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,Nm=["http","https","ws","wss","urn","urn:uuid"];function jm(t){return Nm.indexOf(t)!==-1}function ds(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function uc(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function dc(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function Om(t){return t.secure=ds(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function Am(t){if((t.port===(ds(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let e=t.resourceName.indexOf("?"),r=e===-1?t.resourceName:t.resourceName.slice(0,e);t.path=r&&r!=="/"?r:void 0,t.query=e===-1?void 0:t.resourceName.slice(e+1),t.resourceName=void 0}return t.fragment=void 0,t}function Dm(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(qm);if(r&&r[0]===t.path){let o=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let n=`${o}:${e.nid||t.nid}`,s=fs(n);t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function Zm(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",o=t.nid.toLowerCase(),n=`${r}:${e.nid||o}`,s=fs(n);s&&(t=s.serialize(t,e));let i=t,a=t.nss;return i.path=`${o||e.nid}:${a}`,e.skipEscape=!0,i}function Lm(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!Mm(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function Fm(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var fc={scheme:"http",domainHost:!0,parse:uc,serialize:dc},Um={scheme:"https",domainHost:fc.domainHost,parse:uc,serialize:dc},lo={scheme:"ws",domainHost:!0,parse:Om,serialize:Am},Hm={scheme:"wss",domainHost:lo.domainHost,parse:lo.parse,serialize:lo.serialize},Vm={scheme:"urn",parse:Dm,serialize:Zm,skipNormalize:!0},Km={scheme:"urn:uuid",parse:Lm,serialize:Fm,skipNormalize:!0},uo={http:fc,https:Um,ws:lo,wss:Hm,urn:Vm,"urn:uuid":Km};Object.setPrototypeOf(uo,null);function fs(t){return t&&(uo[t]||uo[t.toLowerCase()])||void 0}pc.exports={wsIsSecure:ds,SCHEMES:uo,isValidSchemeName:jm,getSchemeHandler:fs}});var kc=$((tw,mo)=>{"use strict";var{normalizeIPv6:$c,removeDotSegments:lr,recomposeAuthority:Gm,normalizePercentEncoding:ps,normalizePathEncoding:Bm,serializePathEncoding:hc,normalizeQueryFragmentEncoding:gc,encodeQuery:Jm,encodeFragment:Wm,reescapeHostDelimiters:Xm,isIPv4:vc,nonSimpleDomain:Qm}=us(),{SCHEMES:wc,getSchemeHandler:ms}=mc(),bc=/^[A-Za-z][A-Za-z0-9+.-]*$/u,Sc="URI scheme is malformed.";function yc(t){let e=unescape(String(t));if(!bc.test(e))throw new TypeError(Sc);return e}function Ym(t,e){return typeof t=="string"?t=ah(t,e):typeof t=="object"&&(t=po(it(t,e),e)),t}function eh(t,e,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:n,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:c,malformedScheme:u}=fo(t,o),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:p,malformedSchemeSpecific:m,malformedHost:h,malformedScheme:g}=fo(e,o);if(s||d||i||p||a||m||c||h||u||g)throw new Error(n.error||l.error||"URI is malformed.");let y=xc(n,l,o,!0),_=ms(r&&r.scheme||y.scheme),w=y.host,E=w!==void 0&&w!==""&&(vc(w)||$c(w).isIPV6);Ec(y,r||{},_,E);let O=w&&w.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test(w);if(y.error&&!O)throw new Error(y.error);return o.skipEscape=!0,it(y,o)}function xc(t,e,r,o){let n={};return o||(t=po(it(t,r),r),e=po(it(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(n.scheme=e.scheme,n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=lr(e.path||""),n.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=lr(e.path||""),n.query=e.query):(e.path?(e.path[0]==="/"?n.path=lr(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?n.path="/"+e.path:t.path?n.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:n.path=e.path,n.path=lr(n.path)),n.query=e.query):(n.path=t.path,e.query!==void 0?n.query=e.query:n.query=t.query),n.userinfo=t.userinfo,n.host=t.host,n.port=t.port),n.scheme=t.scheme),n.fragment=e.fragment,n}function th(t,e,r){let o=_c(t,r),n=_c(e,r);return o!==void 0&&n!==void 0&&o===n}function it(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},o=Object.assign({},e),n=[];r.scheme&&(r.scheme=yc(r.scheme));let s=ms(o.scheme||r.scheme);s&&s.serialize&&s.serialize(r,o);let i=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=!o.skipEscape&&r.scheme===void 0&&!i;r.path!==void 0&&(o.skipEscape?r.path=ps(r.path):r.path=hc(r.path,a)),o.reference!=="suffix"&&r.scheme&&(r.scheme=yc(r.scheme),n.push(r.scheme,":"));let c=Gm(r);if(c!==void 0&&(o.reference!=="suffix"&&n.push("//"),n.push(c),r.path&&r.path[0]!=="/"&&n.push("/")),r.path!==void 0){let u=r.path;!o.absolutePath&&(!s||!s.absolutePath)&&(u=lr(u)),a&&(u=hc(u,!0)),c===void 0&&u[0]==="/"&&u[1]==="/"&&(u="/%2F"+u.slice(2)),n.push(u)}return r.query!==void 0&&n.push("?",Jm(r.query)),r.fragment!==void 0&&n.push("#",Wm(r.fragment)),n.join("")}var rh=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,oh=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,nh=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function sh(t,e){if(e[2]!==void 0&&t.path&&t.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof t.port=="number"&&(t.port<0||t.port>65535))return"URI port is malformed."}function cr(t){if(t===void 0)return!1;let e=t.indexOf("%");for(;e!==-1;){if(e+2>=t.length||!/^[\da-f]{2}$/iu.test(t.slice(e+1,e+3)))return!0;e=t.indexOf("%",e+3)}return!1}function hs(t){return t[0]==="["&&t[t.length-1]==="]"}function ih(t){let e=t[4];return cr(t[3])||e!==void 0&&!hs(e)&&cr(e)||cr(t[6])||cr(t[7])||cr(t[8])}function Ec(t,e,r,o){if(!e.unicodeSupport&&(!r||!r.unicodeSupport)&&t.host&&!hs(t.host)&&(e.domainHost||r&&r.domainHost)&&o===!1&&Qm(t.host))try{t.host=new URL("http://"+t.host).hostname}catch(n){return t.error=t.error||"Host's domain name can not be converted to ASCII: "+n,!0}return!1}function fo(t,e){let r=Object.assign({},e),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,s=!1,i=!1,a=!1,c=!1,u=!1,l=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let d=t.match(oh);d!==null&&d[1].indexOf("\\")!==-1&&(o.error="URI authority must not contain a literal backslash.",n=!0);let p=t.match(nh);if(p!==null){let h=p[1],g=h.replace(/[\t\n\r]/g,"");g.length>=2&&(g.slice(0,2)!=="//"?(o.error=o.error||"URI authority must not contain a literal backslash.",n=!0):h.length!==g.length&&(o.error=o.error||"URI authority introducer must not contain whitespace.",n=!0))}let m=t.match(rh);if(m){if(o.scheme=m[1],o.userinfo=m[3],o.host=m[4],o.port=parseInt(m[5],10),o.path=m[6]||"",o.query=m[7],o.fragment=m[8],o.scheme!==void 0){let y=unescape(o.scheme);bc.test(y)?o.scheme=y.toLowerCase():(o.error=o.error||Sc,u=!0)}s=ih(m),s&&(o.error=o.error||"URI contains malformed percent-encoding."),isNaN(o.port)&&(o.port=m[5]);let h=sh(o,m);if(h!==void 0&&(o.error=o.error||h,n=!0),o.host)if(vc(o.host)===!1){let _=hs(o.host),w=o.host.indexOf("[")!==-1||o.host.indexOf("]")!==-1,E=$c(o.host);l=E.isIPV6||E.isIPVFuture===!0,c=w&&(!_||E.error===!0),o.host=l?E.host:E.host.toLowerCase(),c&&(o.error=o.error||"URI host is malformed.",n=!0)}else l=!0;o.scheme===void 0&&o.userinfo===void 0&&o.host===void 0&&o.port===void 0&&o.query===void 0&&!o.path?o.reference="same-document":o.scheme===void 0?o.reference="relative":o.fragment===void 0?o.reference="absolute":o.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==o.reference&&(o.error=o.error||"URI is not a "+r.reference+" reference.");let g=ms(r.scheme||o.scheme);if(c||(a=Ec(o,r,g,l)),t.indexOf("%")!==-1&&o.host!==void 0&&!c){let y=l?o.host:ps(o.host,!0);l||(y=ps(y.toLowerCase())),o.host=Xm(y,l)}(!g||g&&!g.skipNormalize)&&(o.path&&(o.path=Bm(o.path)),o.query&&(o.query=gc(o.query)),o.fragment&&(o.fragment=gc(o.fragment))),g&&g.parse&&(g.parse(o,r),g===wc.urn&&o.nid===void 0&&(i=!0))}else o.error=o.error||"URI can not be parsed.";return{parsed:o,malformedAuthorityOrPort:n,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:u}}function po(t,e){return fo(t,e).parsed}function ah(t,e){return zc(t,e).normalized}function zc(t,e){let{parsed:r,malformedAuthorityOrPort:o,malformedPercentEncoding:n,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}=fo(t,e);return{normalized:o||n||s||i||a?t:it(r,e),malformedAuthorityOrPort:o,malformedPercentEncoding:n,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}}function _c(t,e){if(typeof t!="string"&&typeof t!="object")return;let r;try{r=typeof t=="string"?t:it(t,e)}catch{return}let{normalized:o,malformedAuthorityOrPort:n,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:c}=zc(r,e);return n||s||i||a||c?void 0:o}var gs={SCHEMES:wc,normalize:Ym,resolve:eh,resolveComponent:xc,equal:th,serialize:it,parse:po};mo.exports=gs;mo.exports.default=gs;mo.exports.fastUri=gs});var Rc=$(ys=>{"use strict";Object.defineProperty(ys,"__esModule",{value:!0});var Pc=kc();Pc.code='require("ajv/dist/runtime/uri").default';ys.default=Pc});var Oc=$(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.CodeGen=Y.Name=Y.nil=Y.stringify=Y.str=Y._=Y.KeywordCxt=void 0;var ch=ir();Object.defineProperty(Y,"KeywordCxt",{enumerable:!0,get:function(){return ch.KeywordCxt}});var Et=T();Object.defineProperty(Y,"_",{enumerable:!0,get:function(){return Et._}});Object.defineProperty(Y,"str",{enumerable:!0,get:function(){return Et.str}});Object.defineProperty(Y,"stringify",{enumerable:!0,get:function(){return Et.stringify}});Object.defineProperty(Y,"nil",{enumerable:!0,get:function(){return Et.nil}});Object.defineProperty(Y,"Name",{enumerable:!0,get:function(){return Et.Name}});Object.defineProperty(Y,"CodeGen",{enumerable:!0,get:function(){return Et.CodeGen}});var lh=io(),qc=ar(),uh=Dn(),ur=co(),dh=T(),dr=or(),ho=rr(),$s=N(),Tc=rc(),fh=Rc(),Nc=(t,e)=>new RegExp(t,e);Nc.code="new RegExp";var ph=["removeAdditional","useDefaults","coerceTypes"],mh=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),hh={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."},gh={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Ic=200;function yh(t){var e,r,o,n,s,i,a,c,u,l,d,p,m,h,g,y,_,w,E,O,P,ze,Me,Ao,Do;let qt=t.strict,Zo=(e=t.code)===null||e===void 0?void 0:e.optimize,vi=Zo===!0||Zo===void 0?1:Zo||0,wi=(o=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:Nc,gu=(n=t.uriResolver)!==null&&n!==void 0?n:fh.default;return{strictSchema:(i=(s=t.strictSchema)!==null&&s!==void 0?s:qt)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:qt)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:qt)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=t.strictTuples)!==null&&d!==void 0?d:qt)!==null&&p!==void 0?p:"log",strictRequired:(h=(m=t.strictRequired)!==null&&m!==void 0?m:qt)!==null&&h!==void 0?h:!1,code:t.code?{...t.code,optimize:vi,regExp:wi}:{optimize:vi,regExp:wi},loopRequired:(g=t.loopRequired)!==null&&g!==void 0?g:Ic,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:Ic,meta:(_=t.meta)!==null&&_!==void 0?_:!0,messages:(w=t.messages)!==null&&w!==void 0?w:!0,inlineRefs:(E=t.inlineRefs)!==null&&E!==void 0?E:!0,schemaId:(O=t.schemaId)!==null&&O!==void 0?O:"$id",addUsedSchema:(P=t.addUsedSchema)!==null&&P!==void 0?P:!0,validateSchema:(ze=t.validateSchema)!==null&&ze!==void 0?ze:!0,validateFormats:(Me=t.validateFormats)!==null&&Me!==void 0?Me:!0,unicodeRegExp:(Ao=t.unicodeRegExp)!==null&&Ao!==void 0?Ao:!0,int32range:(Do=t.int32range)!==null&&Do!==void 0?Do:!0,uriResolver:gu}}var fr=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...yh(e)};let{es5:r,lines:o}=this.opts.code;this.scope=new dh.ValueScope({scope:{},prefixes:mh,es5:r,lines:o}),this.logger=Sh(e.logger);let n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,uh.getRules)(),Cc.call(this,hh,e,"NOT SUPPORTED"),Cc.call(this,gh,e,"DEPRECATED","warn"),this._metaOpts=wh.call(this),e.formats&&$h.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&vh.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),_h.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:o}=this.opts,n=Tc;o==="id"&&(n={...Tc},n.id=n.$id,delete n.$id),r&&e&&this.addMetaSchema(n,n[o],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let o;if(typeof e=="string"){if(o=this.getSchema(e),!o)throw new Error(`no schema with key or ref "${e}"`)}else o=this.compile(e);let n=o(r);return"$async"in o||(this.errors=o.errors),n}compile(e,r){let o=this._addSchema(e,r);return o.validate||this._compileSchemaEnv(o)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:o}=this.opts;return n.call(this,e,r);async function n(l,d){await s.call(this,l.$schema);let p=this._addSchema(l,d);return p.validate||i.call(this,p)}async function s(l){l&&!this.getSchema(l)&&await n.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof qc.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await s.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=o(l))}finally{delete this._loading[l]}}}addSchema(e,r,o,n=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,o,n);return this}let s;if(typeof e=="object"){let{schemaId:i}=this.opts;if(s=e[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,dr.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(e,o,r,n,!0),this}addMetaSchema(e,r,o=this.opts.validateSchema){return this.addSchema(e,r,!0,o),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let o;if(o=e.$schema,o!==void 0&&typeof o!="string")throw new Error("$schema must be a string");if(o=o||this.opts.defaultMeta||this.defaultMeta(),!o)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(o,e);if(!n&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return n}getSchema(e){let r;for(;typeof(r=Mc.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:o}=this.opts,n=new ur.SchemaEnv({schema:{},schemaId:o});if(r=ur.resolveSchema.call(this,n,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=Mc.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let o=e[this.opts.schemaId];return o&&(o=(0,dr.normalizeId)(o),delete this.schemas[o],delete this.refs[o]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let o;if(typeof e=="string")o=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=o);else if(typeof e=="object"&&r===void 0){if(r=e,o=r.keyword,Array.isArray(o)&&!o.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(Eh.call(this,o,r),!r)return(0,$s.eachItem)(o,s=>_s.call(this,s)),this;kh.call(this,r);let n={...r,type:(0,ho.getJSONTypes)(r.type),schemaType:(0,ho.getJSONTypes)(r.schemaType)};return(0,$s.eachItem)(o,n.type.length===0?s=>_s.call(this,s,n):s=>n.type.forEach(i=>_s.call(this,s,n,i))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let o of r.rules){let n=o.rules.findIndex(s=>s.keyword===e);n>=0&&o.rules.splice(n,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:o="data"}={}){return!e||e.length===0?"No errors":e.map(n=>`${o}${n.instancePath} ${n.message}`).reduce((n,s)=>n+r+s)}$dataMetaSchema(e,r){let o=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let n of r){let s=n.split("/").slice(1),i=e;for(let a of s)i=i[a];for(let a in o){let c=o[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=jc(l))}}return e}_removeAllSchemas(e,r){for(let o in e){let n=e[o];(!r||r.test(o))&&(typeof n=="string"?delete e[o]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[o]))}}_addSchema(e,r,o,n=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof e=="object")i=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;o=(0,dr.normalizeId)(i||o);let u=dr.getSchemaRefs.call(this,e,o);return c=new ur.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:o,localRefs:u}),this._cache.set(c.schema,c),s&&!o.startsWith("#")&&(o&&this._checkUnique(o),this.refs[o]=c),n&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):ur.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{ur.compileSchema.call(this,e)}finally{this.opts=r}}};fr.ValidationError=lh.default;fr.MissingRefError=qc.default;Y.default=fr;function Cc(t,e,r,o="error"){for(let n in t){let s=n;s in e&&this.logger[o](`${r}: option ${n}. ${t[s]}`)}}function Mc(t){return t=(0,dr.normalizeId)(t),this.schemas[t]||this.refs[t]}function _h(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function $h(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function vh(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function wh(){let t={...this.opts};for(let e of ph)delete t[e];return t}var bh={log(){},warn(){},error(){}};function Sh(t){if(t===!1)return bh;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var xh=/^[a-z_$][a-z0-9_$:-]*$/i;function Eh(t,e){let{RULES:r}=this;if((0,$s.eachItem)(t,o=>{if(r.keywords[o])throw new Error(`Keyword ${o} is already defined`);if(!xh.test(o))throw new Error(`Keyword ${o} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function _s(t,e,r){var o;let n=e?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=n?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,ho.getJSONTypes)(e.type),schemaType:(0,ho.getJSONTypes)(e.schemaType)}};e.before?zh.call(this,i,a,e.before):i.rules.push(a),s.all[t]=a,(o=e.implements)===null||o===void 0||o.forEach(c=>this.addKeyword(c))}function zh(t,e,r){let o=t.rules.findIndex(n=>n.keyword===r);o>=0?t.rules.splice(o,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function kh(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=jc(e)),t.validateSchema=this.compile(e,!0))}var Ph={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function jc(t){return{anyOf:[t,Ph]}}});var Ac=$(vs=>{"use strict";Object.defineProperty(vs,"__esModule",{value:!0});var Rh={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};vs.default=Rh});var Fc=$(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.callRef=at.getValidate=void 0;var Th=ar(),Dc=_e(),fe=T(),zt=je(),Zc=co(),go=N(),Ih={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:o}=t,{baseId:n,schemaEnv:s,validateName:i,opts:a,self:c}=o,{root:u}=s;if((r==="#"||r==="#/")&&n===u.baseId)return d();let l=Zc.resolveRef.call(c,u,n,r);if(l===void 0)throw new Th.default(o.opts.uriResolver,n,r);if(l instanceof Zc.SchemaEnv)return p(l);return m(l);function d(){if(s===u)return yo(t,i,s,s.$async);let h=e.scopeValue("root",{ref:u});return yo(t,(0,fe._)`${h}.validate`,u,u.$async)}function p(h){let g=Lc(t,h);yo(t,g,h,h.$async)}function m(h){let g=e.scopeValue("schema",a.code.source===!0?{ref:h,code:(0,fe.stringify)(h)}:{ref:h}),y=e.name("valid"),_=t.subschema({schema:h,dataTypes:[],schemaPath:fe.nil,topSchemaRef:g,errSchemaPath:r},y);t.mergeEvaluated(_),t.ok(y)}}};function Lc(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,fe._)`${r.scopeValue("wrapper",{ref:e})}.validate`}at.getValidate=Lc;function yo(t,e,r,o){let{gen:n,it:s}=t,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?zt.default.this:fe.nil;o?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let h=n.let("valid");n.try(()=>{n.code((0,fe._)`await ${(0,Dc.callValidateCode)(t,e,u)}`),m(e),i||n.assign(h,!0)},g=>{n.if((0,fe._)`!(${g} instanceof ${s.ValidationError})`,()=>n.throw(g)),p(g),i||n.assign(h,!1)}),t.ok(h)}function d(){t.result((0,Dc.callValidateCode)(t,e,u),()=>m(e),()=>p(e))}function p(h){let g=(0,fe._)`${h}.errors`;n.assign(zt.default.vErrors,(0,fe._)`${zt.default.vErrors} === null ? ${g} : ${zt.default.vErrors}.concat(${g})`),n.assign(zt.default.errors,(0,fe._)`${zt.default.vErrors}.length`)}function m(h){var g;if(!s.opts.unevaluated)return;let y=(g=r?.validate)===null||g===void 0?void 0:g.evaluated;if(s.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(s.props=go.mergeEvaluated.props(n,y.props,s.props));else{let _=n.var("props",(0,fe._)`${h}.evaluated.props`);s.props=go.mergeEvaluated.props(n,_,s.props,fe.Name)}if(s.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(s.items=go.mergeEvaluated.items(n,y.items,s.items));else{let _=n.var("items",(0,fe._)`${h}.evaluated.items`);s.items=go.mergeEvaluated.items(n,_,s.items,fe.Name)}}}at.callRef=yo;at.default=Ih});var Uc=$(ws=>{"use strict";Object.defineProperty(ws,"__esModule",{value:!0});var Ch=Ac(),Mh=Fc(),qh=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Ch.default,Mh.default];ws.default=qh});var Hc=$(bs=>{"use strict";Object.defineProperty(bs,"__esModule",{value:!0});var _o=T(),Be=_o.operators,$o={maximum:{okStr:"<=",ok:Be.LTE,fail:Be.GT},minimum:{okStr:">=",ok:Be.GTE,fail:Be.LT},exclusiveMaximum:{okStr:"<",ok:Be.LT,fail:Be.GTE},exclusiveMinimum:{okStr:">",ok:Be.GT,fail:Be.LTE}},Nh={message:({keyword:t,schemaCode:e})=>(0,_o.str)`must be ${$o[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,_o._)`{comparison: ${$o[t].okStr}, limit: ${e}}`},jh={keyword:Object.keys($o),type:"number",schemaType:"number",$data:!0,error:Nh,code(t){let{keyword:e,data:r,schemaCode:o}=t;t.fail$data((0,_o._)`${r} ${$o[e].fail} ${o} || isNaN(${r})`)}};bs.default=jh});var Vc=$(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});var pr=T(),Oh={message:({schemaCode:t})=>(0,pr.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,pr._)`{multipleOf: ${t}}`},Ah={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Oh,code(t){let{gen:e,data:r,schemaCode:o,it:n}=t,s=n.opts.multipleOfPrecision,i=e.let("res"),a=s?(0,pr._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,pr._)`${i} !== parseInt(${i})`;t.fail$data((0,pr._)`(${o} === 0 || (${i} = ${r}/${o}, ${a}))`)}};Ss.default=Ah});var Gc=$(xs=>{"use strict";Object.defineProperty(xs,"__esModule",{value:!0});function Kc(t){let e=t.length,r=0,o=0,n;for(;o<e;)r++,n=t.charCodeAt(o++),n>=55296&&n<=56319&&o<e&&(n=t.charCodeAt(o),(n&64512)===56320&&o++);return r}xs.default=Kc;Kc.code='require("ajv/dist/runtime/ucs2length").default'});var Bc=$(Es=>{"use strict";Object.defineProperty(Es,"__esModule",{value:!0});var ct=T(),Dh=N(),Zh=Gc(),Lh={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,ct.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,ct._)`{limit: ${t}}`},Fh={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Lh,code(t){let{keyword:e,data:r,schemaCode:o,it:n}=t,s=e==="maxLength"?ct.operators.GT:ct.operators.LT,i=n.opts.unicode===!1?(0,ct._)`${r}.length`:(0,ct._)`${(0,Dh.useFunc)(t.gen,Zh.default)}(${r})`;t.fail$data((0,ct._)`${i} ${s} ${o}`)}};Es.default=Fh});var Jc=$(zs=>{"use strict";Object.defineProperty(zs,"__esModule",{value:!0});var Uh=_e(),Hh=N(),kt=T(),Vh={message:({schemaCode:t})=>(0,kt.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,kt._)`{pattern: ${t}}`},Kh={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Vh,code(t){let{gen:e,data:r,$data:o,schema:n,schemaCode:s,it:i}=t,a=i.opts.unicodeRegExp?"u":"";if(o){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?(0,kt._)`new RegExp`:(0,Hh.useFunc)(e,c),l=e.let("valid");e.try(()=>e.assign(l,(0,kt._)`${u}(${s}, ${a}).test(${r})`),()=>e.assign(l,!1)),t.fail$data((0,kt._)`!${l}`)}else{let c=(0,Uh.usePattern)(t,n);t.fail$data((0,kt._)`!${c}.test(${r})`)}}};zs.default=Kh});var Wc=$(ks=>{"use strict";Object.defineProperty(ks,"__esModule",{value:!0});var mr=T(),Gh={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,mr.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,mr._)`{limit: ${t}}`},Bh={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Gh,code(t){let{keyword:e,data:r,schemaCode:o}=t,n=e==="maxProperties"?mr.operators.GT:mr.operators.LT;t.fail$data((0,mr._)`Object.keys(${r}).length ${n} ${o}`)}};ks.default=Bh});var Xc=$(Ps=>{"use strict";Object.defineProperty(Ps,"__esModule",{value:!0});var hr=_e(),gr=T(),Jh=N(),Wh={message:({params:{missingProperty:t}})=>(0,gr.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,gr._)`{missingProperty: ${t}}`},Xh={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Wh,code(t){let{gen:e,schema:r,schemaCode:o,data:n,$data:s,it:i}=t,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let m=t.parentSchema.properties,{definedProperties:h}=t.it;for(let g of r)if(m?.[g]===void 0&&!h.has(g)){let y=i.schemaEnv.baseId+i.errSchemaPath,_=`required property "${g}" is not defined at "${y}" (strictRequired)`;(0,Jh.checkStrictMode)(i,_,i.opts.strictRequired)}}function u(){if(c||s)t.block$data(gr.nil,d);else for(let m of r)(0,hr.checkReportMissingProp)(t,m)}function l(){let m=e.let("missing");if(c||s){let h=e.let("valid",!0);t.block$data(h,()=>p(m,h)),t.ok(h)}else e.if((0,hr.checkMissingProp)(t,r,m)),(0,hr.reportMissingProp)(t,m),e.else()}function d(){e.forOf("prop",o,m=>{t.setParams({missingProperty:m}),e.if((0,hr.noPropertyInData)(e,n,m,a.ownProperties),()=>t.error())})}function p(m,h){t.setParams({missingProperty:m}),e.forOf(m,o,()=>{e.assign(h,(0,hr.propertyInData)(e,n,m,a.ownProperties)),e.if((0,gr.not)(h),()=>{t.error(),e.break()})},gr.nil)}}};Ps.default=Xh});var Qc=$(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});var yr=T(),Qh={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,yr.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,yr._)`{limit: ${t}}`},Yh={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Qh,code(t){let{keyword:e,data:r,schemaCode:o}=t,n=e==="maxItems"?yr.operators.GT:yr.operators.LT;t.fail$data((0,yr._)`${r}.length ${n} ${o}`)}};Rs.default=Yh});var vo=$(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});var Yc=Gn();Yc.code='require("ajv/dist/runtime/equal").default';Ts.default=Yc});var el=$(Cs=>{"use strict";Object.defineProperty(Cs,"__esModule",{value:!0});var Is=rr(),ee=T(),eg=N(),tg=vo(),rg={message:({params:{i:t,j:e}})=>(0,ee.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,ee._)`{i: ${t}, j: ${e}}`},og={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:rg,code(t){let{gen:e,data:r,$data:o,schema:n,parentSchema:s,schemaCode:i,it:a}=t;if(!o&&!n)return;let c=e.let("valid"),u=s.items?(0,Is.getSchemaTypes)(s.items):[];t.block$data(c,l,(0,ee._)`${i} === false`),t.ok(c);function l(){let h=e.let("i",(0,ee._)`${r}.length`),g=e.let("j");t.setParams({i:h,j:g}),e.assign(c,!0),e.if((0,ee._)`${h} > 1`,()=>(d()?p:m)(h,g))}function d(){return u.length>0&&!u.some(h=>h==="object"||h==="array")}function p(h,g){let y=e.name("item"),_=(0,Is.checkDataTypes)(u,y,a.opts.strictNumbers,Is.DataType.Wrong),w=e.const("indices",(0,ee._)`{}`);e.for((0,ee._)`;${h}--;`,()=>{e.let(y,(0,ee._)`${r}[${h}]`),e.if(_,(0,ee._)`continue`),u.length>1&&e.if((0,ee._)`typeof ${y} == "string"`,(0,ee._)`${y} += "_"`),e.if((0,ee._)`typeof ${w}[${y}] == "number"`,()=>{e.assign(g,(0,ee._)`${w}[${y}]`),t.error(),e.assign(c,!1).break()}).code((0,ee._)`${w}[${y}] = ${h}`)})}function m(h,g){let y=(0,eg.useFunc)(e,tg.default),_=e.name("outer");e.label(_).for((0,ee._)`;${h}--;`,()=>e.for((0,ee._)`${g} = ${h}; ${g}--;`,()=>e.if((0,ee._)`${y}(${r}[${h}], ${r}[${g}])`,()=>{t.error(),e.assign(c,!1).break(_)})))}}};Cs.default=og});var tl=$(qs=>{"use strict";Object.defineProperty(qs,"__esModule",{value:!0});var Ms=T(),ng=N(),sg=vo(),ig={message:"must be equal to constant",params:({schemaCode:t})=>(0,Ms._)`{allowedValue: ${t}}`},ag={keyword:"const",$data:!0,error:ig,code(t){let{gen:e,data:r,$data:o,schemaCode:n,schema:s}=t;o||s&&typeof s=="object"?t.fail$data((0,Ms._)`!${(0,ng.useFunc)(e,sg.default)}(${r}, ${n})`):t.fail((0,Ms._)`${s} !== ${r}`)}};qs.default=ag});var rl=$(Ns=>{"use strict";Object.defineProperty(Ns,"__esModule",{value:!0});var _r=T(),cg=N(),lg=vo(),ug={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,_r._)`{allowedValues: ${t}}`},dg={keyword:"enum",schemaType:"array",$data:!0,error:ug,code(t){let{gen:e,data:r,$data:o,schema:n,schemaCode:s,it:i}=t;if(!o&&n.length===0)throw new Error("enum must have non-empty array");let a=n.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,cg.useFunc)(e,lg.default)),l;if(a||o)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let m=e.const("vSchema",s);l=(0,_r.or)(...n.map((h,g)=>p(m,g)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",s,m=>e.if((0,_r._)`${u()}(${r}, ${m})`,()=>e.assign(l,!0).break()))}function p(m,h){let g=n[h];return typeof g=="object"&&g!==null?(0,_r._)`${u()}(${r}, ${m}[${h}])`:(0,_r._)`${r} === ${g}`}}};Ns.default=dg});var ol=$(js=>{"use strict";Object.defineProperty(js,"__esModule",{value:!0});var fg=Hc(),pg=Vc(),mg=Bc(),hg=Jc(),gg=Wc(),yg=Xc(),_g=Qc(),$g=el(),vg=tl(),wg=rl(),bg=[fg.default,pg.default,mg.default,hg.default,gg.default,yg.default,_g.default,$g.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},vg.default,wg.default];js.default=bg});var As=$($r=>{"use strict";Object.defineProperty($r,"__esModule",{value:!0});$r.validateAdditionalItems=void 0;var lt=T(),Os=N(),Sg={message:({params:{len:t}})=>(0,lt.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,lt._)`{limit: ${t}}`},xg={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Sg,code(t){let{parentSchema:e,it:r}=t,{items:o}=e;if(!Array.isArray(o)){(0,Os.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}nl(t,o)}};function nl(t,e){let{gen:r,schema:o,data:n,keyword:s,it:i}=t;i.items=!0;let a=r.const("len",(0,lt._)`${n}.length`);if(o===!1)t.setParams({len:e.length}),t.pass((0,lt._)`${a} <= ${e.length}`);else if(typeof o=="object"&&!(0,Os.alwaysValidSchema)(i,o)){let u=r.var("valid",(0,lt._)`${a} <= ${e.length}`);r.if((0,lt.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:s,dataProp:l,dataPropType:Os.Type.Num},u),i.allErrors||r.if((0,lt.not)(u),()=>r.break())})}}$r.validateAdditionalItems=nl;$r.default=xg});var Ds=$(vr=>{"use strict";Object.defineProperty(vr,"__esModule",{value:!0});vr.validateTuple=void 0;var sl=T(),wo=N(),Eg=_e(),zg={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return il(t,"additionalItems",e);r.items=!0,!(0,wo.alwaysValidSchema)(r,e)&&t.ok((0,Eg.validateArray)(t))}};function il(t,e,r=t.schema){let{gen:o,parentSchema:n,data:s,keyword:i,it:a}=t;l(n),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=wo.mergeEvaluated.items(o,r.length,a.items));let c=o.name("valid"),u=o.const("len",(0,sl._)`${s}.length`);r.forEach((d,p)=>{(0,wo.alwaysValidSchema)(a,d)||(o.if((0,sl._)`${u} > ${p}`,()=>t.subschema({keyword:i,schemaProp:p,dataProp:p},c)),t.ok(c))});function l(d){let{opts:p,errSchemaPath:m}=a,h=r.length,g=h===d.minItems&&(h===d.maxItems||d[e]===!1);if(p.strictTuples&&!g){let y=`"${i}" is ${h}-tuple, but minItems or maxItems/${e} are not specified or different at path "${m}"`;(0,wo.checkStrictMode)(a,y,p.strictTuples)}}}vr.validateTuple=il;vr.default=zg});var al=$(Zs=>{"use strict";Object.defineProperty(Zs,"__esModule",{value:!0});var kg=Ds(),Pg={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,kg.validateTuple)(t,"items")};Zs.default=Pg});var ll=$(Ls=>{"use strict";Object.defineProperty(Ls,"__esModule",{value:!0});var cl=T(),Rg=N(),Tg=_e(),Ig=As(),Cg={message:({params:{len:t}})=>(0,cl.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,cl._)`{limit: ${t}}`},Mg={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Cg,code(t){let{schema:e,parentSchema:r,it:o}=t,{prefixItems:n}=r;o.items=!0,!(0,Rg.alwaysValidSchema)(o,e)&&(n?(0,Ig.validateAdditionalItems)(t,n):t.ok((0,Tg.validateArray)(t)))}};Ls.default=Mg});var ul=$(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});var ve=T(),bo=N(),qg={message:({params:{min:t,max:e}})=>e===void 0?(0,ve.str)`must contain at least ${t} valid item(s)`:(0,ve.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,ve._)`{minContains: ${t}}`:(0,ve._)`{minContains: ${t}, maxContains: ${e}}`},Ng={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:qg,code(t){let{gen:e,schema:r,parentSchema:o,data:n,it:s}=t,i,a,{minContains:c,maxContains:u}=o;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=e.const("len",(0,ve._)`${n}.length`);if(t.setParams({min:i,max:a}),a===void 0&&i===0){(0,bo.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,bo.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,bo.alwaysValidSchema)(s,r)){let g=(0,ve._)`${l} >= ${i}`;a!==void 0&&(g=(0,ve._)`${g} && ${l} <= ${a}`),t.pass(g);return}s.items=!0;let d=e.name("valid");a===void 0&&i===1?m(d,()=>e.if(d,()=>e.break())):i===0?(e.let(d,!0),a!==void 0&&e.if((0,ve._)`${n}.length > 0`,p)):(e.let(d,!1),p()),t.result(d,()=>t.reset());function p(){let g=e.name("_valid"),y=e.let("count",0);m(g,()=>e.if(g,()=>h(y)))}function m(g,y){e.forRange("i",0,l,_=>{t.subschema({keyword:"contains",dataProp:_,dataPropType:bo.Type.Num,compositeRule:!0},g),y()})}function h(g){e.code((0,ve._)`${g}++`),a===void 0?e.if((0,ve._)`${g} >= ${i}`,()=>e.assign(d,!0).break()):(e.if((0,ve._)`${g} > ${a}`,()=>e.assign(d,!1).break()),i===1?e.assign(d,!0):e.if((0,ve._)`${g} >= ${i}`,()=>e.assign(d,!0)))}}};Fs.default=Ng});var pl=$(Te=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.validateSchemaDeps=Te.validatePropertyDeps=Te.error=void 0;var Us=T(),jg=N(),wr=_e();Te.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let o=e===1?"property":"properties";return(0,Us.str)`must have ${o} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:o}})=>(0,Us._)`{property: ${t},
|
|
3
|
+
import{a as Ii,b as Zi}from"./chunk-6TM32YIJ.js";import{A as S,B as Ai,C as K,D as Di,E as Yo,F as Li,G as dt,K as Fi,L as Ui,M as Hi,N as en,P as Pr,Q as Vi,V as Ki,X as Gi,Z as Bi,_ as tn,a as Ri,b as Ko,c as Ci,d as Mi,e as qi,f as Go,g as Bo,h as Jo,i as Dt,j as Lt,k as ji,l as Ni,m as Wo,n as f,o as D,p as W,q as Oi,r as G,s as q,t as v,u as se,v as V,w as Xo,x as Qo,y as F,z as pe}from"./chunk-E6YXZIJS.js";import"./chunk-DRHOPOC7.js";import"./chunk-GXEVALBL.js";import"./chunk-Y2BEEOPB.js";import"./chunk-PSMXHDMX.js";import"./chunk-P7OVDUA5.js";import"./chunk-XDHIIZ6A.js";import"./chunk-ZAHP3ES5.js";import"./chunk-PZFWQJCF.js";import"./chunk-UUDNNFU7.js";import"./chunk-RXHNBSER.js";import"./chunk-UCMNH6Q6.js";import"./chunk-QDWB7QU7.js";import"./chunk-AHNDJFQR.js";import"./chunk-TK55FA56.js";import"./chunk-JEMLKBH2.js";import"./chunk-N43NAG5E.js";import"./chunk-7XTBFOUJ.js";import"./chunk-DKGGJM6Z.js";import"./chunk-R6WJ6JIQ.js";import"./chunk-C2ESM27Z.js";import"./chunk-WHY3DVXS.js";import{c as $,f as Ti}from"./chunk-PSANHDZM.js";var Yt=$(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.regexpCode=A.getEsmExportName=A.getProperty=A.safeStringify=A.stringify=A.strConcat=A.addCodeArg=A.str=A._=A.nil=A._Code=A.Name=A.IDENTIFIER=A._CodeOrName=void 0;var Xt=class{};A._CodeOrName=Xt;A.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Ye=class extends Xt{constructor(e){if(super(),!A.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};A.Name=Ye;var ye=class extends Xt{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,o)=>`${r}${o}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,o)=>(o instanceof Ye&&(r[o.str]=(r[o.str]||0)+1),r),{})}};A._Code=ye;A.nil=new ye("");function ya(t,...e){let r=[t[0]],o=0;for(;o<e.length;)kn(r,e[o]),r.push(t[++o]);return new ye(r)}A._=ya;var xn=new ye("+");function _a(t,...e){let r=[Qt(t[0])],o=0;for(;o<e.length;)r.push(xn),kn(r,e[o]),r.push(xn,Qt(t[++o]));return Sf(r),new ye(r)}A.str=_a;function kn(t,e){e instanceof ye?t.push(...e._items):e instanceof Ye?t.push(e):t.push(Ef(e))}A.addCodeArg=kn;function Sf(t){let e=1;for(;e<t.length-1;){if(t[e]===xn){let r=xf(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function xf(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Ye||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Ye))return`"${t}${e.slice(1)}`}function kf(t,e){return e.emptyStr()?t:t.emptyStr()?e:_a`${t}${e}`}A.strConcat=kf;function Ef(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Qt(Array.isArray(t)?t.join(","):t)}function zf(t){return new ye(Qt(t))}A.stringify=zf;function Qt(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}A.safeStringify=Qt;function Pf(t){return typeof t=="string"&&A.IDENTIFIER.test(t)?new ye(`.${t}`):ya`[${t}]`}A.getProperty=Pf;function Tf(t){if(typeof t=="string"&&A.IDENTIFIER.test(t))return new ye(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}A.getEsmExportName=Tf;function Rf(t){return new ye(t.toString())}A.regexpCode=Rf});var Pn=$(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.ValueScope=le.ValueScopeName=le.Scope=le.varKinds=le.UsedValueState=void 0;var ce=Yt(),En=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Yr;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Yr||(le.UsedValueState=Yr={}));le.varKinds={const:new ce.Name("const"),let:new ce.Name("let"),var:new ce.Name("var")};var eo=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof ce.Name?e:this.name(e)}name(e){return new ce.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,o;if(!((o=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||o===void 0)&&o.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};le.Scope=eo;var to=class extends ce.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:o}){this.value=e,this.scopePath=(0,ce._)`.${new ce.Name(r)}[${o}]`}};le.ValueScopeName=to;var If=(0,ce._)`\n`,zn=class extends eo{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?If:ce.nil}}get(){return this._scope}name(e){return new to(e,this._newName(e))}value(e,r){var o;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:s}=n,i=(o=r.key)!==null&&o!==void 0?o:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,n);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,n.setValue(r,{property:s,itemIndex:u}),n}getValue(e,r){let o=this._values[e];if(o)return o.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,o=>{if(o.scopePath===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return(0,ce._)`${e}${o.scopePath}`})}scopeCode(e=this._values,r,o){return this._reduceValues(e,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,o)}_reduceValues(e,r,o={},n){let s=ce.nil;for(let i in e){let a=e[i];if(!a)continue;let c=o[i]=o[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Yr.Started);let l=r(u);if(l){let d=this.opts.es5?le.varKinds.var:le.varKinds.const;s=(0,ce._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=n?.(u))s=(0,ce._)`${s}${l}${this.opts._n}`;else throw new En(u);c.set(u,Yr.Completed)})}return s}};le.ValueScope=zn});var R=$(I=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0});I.or=I.and=I.not=I.CodeGen=I.operators=I.varKinds=I.ValueScopeName=I.ValueScope=I.Scope=I.Name=I.regexpCode=I.stringify=I.getProperty=I.nil=I.strConcat=I.str=I._=void 0;var M=Yt(),we=Pn(),Ue=Yt();Object.defineProperty(I,"_",{enumerable:!0,get:function(){return Ue._}});Object.defineProperty(I,"str",{enumerable:!0,get:function(){return Ue.str}});Object.defineProperty(I,"strConcat",{enumerable:!0,get:function(){return Ue.strConcat}});Object.defineProperty(I,"nil",{enumerable:!0,get:function(){return Ue.nil}});Object.defineProperty(I,"getProperty",{enumerable:!0,get:function(){return Ue.getProperty}});Object.defineProperty(I,"stringify",{enumerable:!0,get:function(){return Ue.stringify}});Object.defineProperty(I,"regexpCode",{enumerable:!0,get:function(){return Ue.regexpCode}});Object.defineProperty(I,"Name",{enumerable:!0,get:function(){return Ue.Name}});var so=Pn();Object.defineProperty(I,"Scope",{enumerable:!0,get:function(){return so.Scope}});Object.defineProperty(I,"ValueScope",{enumerable:!0,get:function(){return so.ValueScope}});Object.defineProperty(I,"ValueScopeName",{enumerable:!0,get:function(){return so.ValueScopeName}});Object.defineProperty(I,"varKinds",{enumerable:!0,get:function(){return so.varKinds}});I.operators={GT:new M._Code(">"),GTE:new M._Code(">="),LT:new M._Code("<"),LTE:new M._Code("<="),EQ:new M._Code("==="),NEQ:new M._Code("!=="),NOT:new M._Code("!"),OR:new M._Code("||"),AND:new M._Code("&&"),ADD:new M._Code("+")};var qe=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},Tn=class extends qe{constructor(e,r,o){super(),this.varKind=e,this.name=r,this.rhs=o}render({es5:e,_n:r}){let o=e?we.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${o} ${this.name}${n};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=vt(this.rhs,e,r)),this}get names(){return this.rhs instanceof M._CodeOrName?this.rhs.names:{}}},ro=class extends qe{constructor(e,r,o){super(),this.lhs=e,this.rhs=r,this.sideEffects=o}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof M.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=vt(this.rhs,e,r),this}get names(){let e=this.lhs instanceof M.Name?{}:{...this.lhs.names};return no(e,this.rhs)}},Rn=class extends ro{constructor(e,r,o,n){super(e,o,n),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},In=class extends qe{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Cn=class extends qe{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Mn=class extends qe{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},qn=class extends qe{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=vt(this.code,e,r),this}get names(){return this.code instanceof M._CodeOrName?this.code.names:{}}},er=class extends qe{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,o)=>r+o.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let o=e[r].optimizeNodes();Array.isArray(o)?e.splice(r,1,...o):o?e[r]=o:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:o}=this,n=o.length;for(;n--;){let s=o[n];s.optimizeNames(e,r)||(Cf(e,s.names),o.splice(n,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>rt(e,r.names),{})}},je=class extends er{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},jn=class extends er{},$t=class extends je{};$t.kind="else";var et=class t extends je{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let o=r.optimizeNodes();r=this.else=Array.isArray(o)?new $t(o):o}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t($a(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var o;if(this.else=(o=this.else)===null||o===void 0?void 0:o.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=vt(this.condition,e,r),this}get names(){let e=super.names;return no(e,this.condition),this.else&&rt(e,this.else.names),e}};et.kind="if";var tt=class extends je{};tt.kind="for";var Nn=class extends tt{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=vt(this.iteration,e,r),this}get names(){return rt(super.names,this.iteration.names)}},On=class extends tt{constructor(e,r,o,n){super(),this.varKind=e,this.name=r,this.from=o,this.to=n}render(e){let r=e.es5?we.varKinds.var:this.varKind,{name:o,from:n,to:s}=this;return`for(${r} ${o}=${n}; ${o}<${s}; ${o}++)`+super.render(e)}get names(){let e=no(super.names,this.from);return no(e,this.to)}},oo=class extends tt{constructor(e,r,o,n){super(),this.loop=e,this.varKind=r,this.name=o,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=vt(this.iterable,e,r),this}get names(){return rt(super.names,this.iterable.names)}},tr=class extends je{constructor(e,r,o){super(),this.name=e,this.args=r,this.async=o}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};tr.kind="func";var rr=class extends er{render(e){return"return "+super.render(e)}};rr.kind="return";var An=class extends je{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var o,n;return super.optimizeNames(e,r),(o=this.catch)===null||o===void 0||o.optimizeNames(e,r),(n=this.finally)===null||n===void 0||n.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&rt(e,this.catch.names),this.finally&&rt(e,this.finally.names),e}},or=class extends je{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};or.kind="catch";var nr=class extends je{render(e){return"finally"+super.render(e)}};nr.kind="finally";var Dn=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
4
|
+
`:""},this._extScope=e,this._scope=new we.Scope({parent:e}),this._nodes=[new jn]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let o=this._extScope.value(e,r);return(this._values[o.prefix]||(this._values[o.prefix]=new Set)).add(o),o}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,o,n){let s=this._scope.toName(r);return o!==void 0&&n&&(this._constants[s.str]=o),this._leafNode(new Tn(e,s,o)),s}const(e,r,o){return this._def(we.varKinds.const,e,r,o)}let(e,r,o){return this._def(we.varKinds.let,e,r,o)}var(e,r,o){return this._def(we.varKinds.var,e,r,o)}assign(e,r,o){return this._leafNode(new ro(e,r,o))}add(e,r){return this._leafNode(new Rn(e,I.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==M.nil&&this._leafNode(new qn(e)),this}object(...e){let r=["{"];for(let[o,n]of e)r.length>1&&r.push(","),r.push(o),(o!==n||this.opts.es5)&&(r.push(":"),(0,M.addCodeArg)(r,n));return r.push("}"),new M._Code(r)}if(e,r,o){if(this._blockNode(new et(e)),r&&o)this.code(r).else().code(o).endIf();else if(r)this.code(r).endIf();else if(o)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new et(e))}else(){return this._elseNode(new $t)}endIf(){return this._endBlockNode(et,$t)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new Nn(e),r)}forRange(e,r,o,n,s=this.opts.es5?we.varKinds.var:we.varKinds.let){let i=this._scope.toName(e);return this._for(new On(s,i,r,o),()=>n(i))}forOf(e,r,o,n=we.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=r instanceof M.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,M._)`${i}.length`,a=>{this.var(s,(0,M._)`${i}[${a}]`),o(s)})}return this._for(new oo("of",n,s,r),()=>o(s))}forIn(e,r,o,n=this.opts.es5?we.varKinds.var:we.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,M._)`Object.keys(${r})`,o);let s=this._scope.toName(e);return this._for(new oo("in",n,s,r),()=>o(s))}endFor(){return this._endBlockNode(tt)}label(e){return this._leafNode(new In(e))}break(e){return this._leafNode(new Cn(e))}return(e){let r=new rr;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(rr)}try(e,r,o){if(!r&&!o)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new An;if(this._blockNode(n),this.code(e),r){let s=this.name("e");this._currNode=n.catch=new or(s),r(s)}return o&&(this._currNode=n.finally=new nr,this.code(o)),this._endBlockNode(or,nr)}throw(e){return this._leafNode(new Mn(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let o=this._nodes.length-r;if(o<0||e!==void 0&&o!==e)throw new Error(`CodeGen: wrong number of nodes: ${o} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=M.nil,o,n){return this._blockNode(new tr(e,r,o)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(tr)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let o=this._currNode;if(o instanceof e||r&&o instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof et))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};I.CodeGen=Dn;function rt(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function no(t,e){return e instanceof M._CodeOrName?rt(t,e.names):t}function vt(t,e,r){if(t instanceof M.Name)return o(t);if(!n(t))return t;return new M._Code(t._items.reduce((s,i)=>(i instanceof M.Name&&(i=o(i)),i instanceof M._Code?s.push(...i._items):s.push(i),s),[]));function o(s){let i=r[s.str];return i===void 0||e[s.str]!==1?s:(delete e[s.str],i)}function n(s){return s instanceof M._Code&&s._items.some(i=>i instanceof M.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function Cf(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function $a(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,M._)`!${Ln(t)}`}I.not=$a;var Mf=va(I.operators.AND);function qf(...t){return t.reduce(Mf)}I.and=qf;var jf=va(I.operators.OR);function Nf(...t){return t.reduce(jf)}I.or=Nf;function va(t){return(e,r)=>e===M.nil?r:r===M.nil?e:(0,M._)`${Ln(e)} ${t} ${Ln(r)}`}function Ln(t){return t instanceof M.Name?t:(0,M._)`(${t})`}});var j=$(C=>{"use strict";Object.defineProperty(C,"__esModule",{value:!0});C.checkStrictMode=C.getErrorPath=C.Type=C.useFunc=C.setEvaluated=C.evaluatedPropsToName=C.mergeEvaluated=C.eachItem=C.unescapeJsonPointer=C.escapeJsonPointer=C.escapeFragment=C.unescapeFragment=C.schemaRefOrVal=C.schemaHasRulesButRef=C.schemaHasRules=C.checkUnknownRules=C.alwaysValidSchema=C.toHash=void 0;var Z=R(),Of=Yt();function Af(t){let e={};for(let r of t)e[r]=!0;return e}C.toHash=Af;function Df(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Sa(t,e),!xa(e,t.self.RULES.all))}C.alwaysValidSchema=Df;function Sa(t,e=t.schema){let{opts:r,self:o}=t;if(!r.strictSchema||typeof e=="boolean")return;let n=o.RULES.keywords;for(let s in e)n[s]||za(t,`unknown keyword: "${s}"`)}C.checkUnknownRules=Sa;function xa(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}C.schemaHasRules=xa;function Lf(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}C.schemaHasRulesButRef=Lf;function Zf({topSchemaRef:t,schemaPath:e},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,Z._)`${r}`}return(0,Z._)`${t}${e}${(0,Z.getProperty)(o)}`}C.schemaRefOrVal=Zf;function Ff(t){return ka(decodeURIComponent(t))}C.unescapeFragment=Ff;function Uf(t){return encodeURIComponent(Fn(t))}C.escapeFragment=Uf;function Fn(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}C.escapeJsonPointer=Fn;function ka(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}C.unescapeJsonPointer=ka;function Hf(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}C.eachItem=Hf;function wa({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:o}){return(n,s,i,a)=>{let c=i===void 0?s:i instanceof Z.Name?(s instanceof Z.Name?t(n,s,i):e(n,s,i),i):s instanceof Z.Name?(e(n,i,s),s):r(s,i);return a===Z.Name&&!(c instanceof Z.Name)?o(n,c):c}}C.mergeEvaluated={props:wa({mergeNames:(t,e,r)=>t.if((0,Z._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,Z._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,Z._)`${r} || {}`).code((0,Z._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,Z._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,Z._)`${r} || {}`),Un(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Ea}),items:wa({mergeNames:(t,e,r)=>t.if((0,Z._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,Z._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,Z._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,Z._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Ea(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,Z._)`{}`);return e!==void 0&&Un(t,r,e),r}C.evaluatedPropsToName=Ea;function Un(t,e,r){Object.keys(r).forEach(o=>t.assign((0,Z._)`${e}${(0,Z.getProperty)(o)}`,!0))}C.setEvaluated=Un;var ba={};function Vf(t,e){return t.scopeValue("func",{ref:e,code:ba[e.code]||(ba[e.code]=new Of._Code(e.code))})}C.useFunc=Vf;var Zn;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Zn||(C.Type=Zn={}));function Kf(t,e,r){if(t instanceof Z.Name){let o=e===Zn.Num;return r?o?(0,Z._)`"[" + ${t} + "]"`:(0,Z._)`"['" + ${t} + "']"`:o?(0,Z._)`"/" + ${t}`:(0,Z._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Z.getProperty)(t).toString():"/"+Fn(t)}C.getErrorPath=Kf;function za(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}C.checkStrictMode=za});var Ne=$(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});var te=R(),Gf={data:new te.Name("data"),valCxt:new te.Name("valCxt"),instancePath:new te.Name("instancePath"),parentData:new te.Name("parentData"),parentDataProperty:new te.Name("parentDataProperty"),rootData:new te.Name("rootData"),dynamicAnchors:new te.Name("dynamicAnchors"),vErrors:new te.Name("vErrors"),errors:new te.Name("errors"),this:new te.Name("this"),self:new te.Name("self"),scope:new te.Name("scope"),json:new te.Name("json"),jsonPos:new te.Name("jsonPos"),jsonLen:new te.Name("jsonLen"),jsonPart:new te.Name("jsonPart")};Hn.default=Gf});var sr=$(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.extendErrors=re.resetErrorsCount=re.reportExtraError=re.reportError=re.keyword$DataError=re.keywordError=void 0;var N=R(),io=j(),ie=Ne();re.keywordError={message:({keyword:t})=>(0,N.str)`must pass "${t}" keyword validation`};re.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,N.str)`"${t}" keyword must be ${e} ($data)`:(0,N.str)`"${t}" keyword is invalid ($data)`};function Bf(t,e=re.keywordError,r,o){let{it:n}=t,{gen:s,compositeRule:i,allErrors:a}=n,c=Ra(t,e,r);o??(i||a)?Pa(s,c):Ta(n,(0,N._)`[${c}]`)}re.reportError=Bf;function Jf(t,e=re.keywordError,r){let{it:o}=t,{gen:n,compositeRule:s,allErrors:i}=o,a=Ra(t,e,r);Pa(n,a),s||i||Ta(o,ie.default.vErrors)}re.reportExtraError=Jf;function Wf(t,e){t.assign(ie.default.errors,e),t.if((0,N._)`${ie.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,N._)`${ie.default.vErrors}.length`,e),()=>t.assign(ie.default.vErrors,null)))}re.resetErrorsCount=Wf;function Xf({gen:t,keyword:e,schemaValue:r,data:o,errsCount:n,it:s}){if(n===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",n,ie.default.errors,a=>{t.const(i,(0,N._)`${ie.default.vErrors}[${a}]`),t.if((0,N._)`${i}.instancePath === undefined`,()=>t.assign((0,N._)`${i}.instancePath`,(0,N.strConcat)(ie.default.instancePath,s.errorPath))),t.assign((0,N._)`${i}.schemaPath`,(0,N.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,N._)`${i}.schema`,r),t.assign((0,N._)`${i}.data`,o))})}re.extendErrors=Xf;function Pa(t,e){let r=t.const("err",e);t.if((0,N._)`${ie.default.vErrors} === null`,()=>t.assign(ie.default.vErrors,(0,N._)`[${r}]`),(0,N._)`${ie.default.vErrors}.push(${r})`),t.code((0,N._)`${ie.default.errors}++`)}function Ta(t,e){let{gen:r,validateName:o,schemaEnv:n}=t;n.$async?r.throw((0,N._)`new ${t.ValidationError}(${e})`):(r.assign((0,N._)`${o}.errors`,e),r.return(!1))}var ot={keyword:new N.Name("keyword"),schemaPath:new N.Name("schemaPath"),params:new N.Name("params"),propertyName:new N.Name("propertyName"),message:new N.Name("message"),schema:new N.Name("schema"),parentSchema:new N.Name("parentSchema")};function Ra(t,e,r){let{createErrors:o}=t.it;return o===!1?(0,N._)`{}`:Qf(t,e,r)}function Qf(t,e,r={}){let{gen:o,it:n}=t,s=[Yf(n,r),ep(t,r)];return tp(t,e,s),o.object(...s)}function Yf({errorPath:t},{instancePath:e}){let r=e?(0,N.str)`${t}${(0,io.getErrorPath)(e,io.Type.Str)}`:t;return[ie.default.instancePath,(0,N.strConcat)(ie.default.instancePath,r)]}function ep({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:o}){let n=o?e:(0,N.str)`${e}/${t}`;return r&&(n=(0,N.str)`${n}${(0,io.getErrorPath)(r,io.Type.Str)}`),[ot.schemaPath,n]}function tp(t,{params:e,message:r},o){let{keyword:n,data:s,schemaValue:i,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;o.push([ot.keyword,n],[ot.params,typeof e=="function"?e(t):e||(0,N._)`{}`]),c.messages&&o.push([ot.message,typeof r=="function"?r(t):r]),c.verbose&&o.push([ot.schema,i],[ot.parentSchema,(0,N._)`${l}${d}`],[ie.default.data,s]),u&&o.push([ot.propertyName,u])}});var Ca=$(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.boolOrEmptySchema=wt.topBoolOrEmptySchema=void 0;var rp=sr(),op=R(),np=Ne(),sp={message:"boolean schema is false"};function ip(t){let{gen:e,schema:r,validateName:o}=t;r===!1?Ia(t,!1):typeof r=="object"&&r.$async===!0?e.return(np.default.data):(e.assign((0,op._)`${o}.errors`,null),e.return(!0))}wt.topBoolOrEmptySchema=ip;function ap(t,e){let{gen:r,schema:o}=t;o===!1?(r.var(e,!1),Ia(t)):r.var(e,!0)}wt.boolOrEmptySchema=ap;function Ia(t,e){let{gen:r,data:o}=t,n={gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,rp.reportError)(n,sp,void 0,e)}});var Vn=$(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.getRules=bt.isJSONType=void 0;var cp=["string","number","integer","boolean","null","object","array"],lp=new Set(cp);function up(t){return typeof t=="string"&&lp.has(t)}bt.isJSONType=up;function dp(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}bt.getRules=dp});var Kn=$(He=>{"use strict";Object.defineProperty(He,"__esModule",{value:!0});He.shouldUseRule=He.shouldUseGroup=He.schemaHasRulesForType=void 0;function fp({schema:t,self:e},r){let o=e.RULES.types[r];return o&&o!==!0&&Ma(t,o)}He.schemaHasRulesForType=fp;function Ma(t,e){return e.rules.some(r=>qa(t,r))}He.shouldUseGroup=Ma;function qa(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(o=>t[o]!==void 0))}He.shouldUseRule=qa});var ir=$(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.reportTypeError=oe.checkDataTypes=oe.checkDataType=oe.coerceAndCheckDataType=oe.getJSONTypes=oe.getSchemaTypes=oe.DataType=void 0;var pp=Vn(),mp=Kn(),hp=sr(),T=R(),ja=j(),St;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(St||(oe.DataType=St={}));function gp(t){let e=Na(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}oe.getSchemaTypes=gp;function Na(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(pp.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}oe.getJSONTypes=Na;function yp(t,e){let{gen:r,data:o,opts:n}=t,s=_p(e,n.coerceTypes),i=e.length>0&&!(s.length===0&&e.length===1&&(0,mp.schemaHasRulesForType)(t,e[0]));if(i){let a=Bn(e,o,n.strictNumbers,St.Wrong);r.if(a,()=>{s.length?$p(t,e,s):Jn(t)})}return i}oe.coerceAndCheckDataType=yp;var Oa=new Set(["string","number","integer","boolean","null"]);function _p(t,e){return e?t.filter(r=>Oa.has(r)||e==="array"&&r==="array"):[]}function $p(t,e,r){let{gen:o,data:n,opts:s}=t,i=o.let("dataType",(0,T._)`typeof ${n}`),a=o.let("coerced",(0,T._)`undefined`);s.coerceTypes==="array"&&o.if((0,T._)`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,(0,T._)`${n}[0]`).assign(i,(0,T._)`typeof ${n}`).if(Bn(e,n,s.strictNumbers),()=>o.assign(a,n))),o.if((0,T._)`${a} !== undefined`);for(let u of r)(Oa.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);o.else(),Jn(t),o.endIf(),o.if((0,T._)`${a} !== undefined`,()=>{o.assign(n,a),vp(t,a)});function c(u){switch(u){case"string":o.elseIf((0,T._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,T._)`"" + ${n}`).elseIf((0,T._)`${n} === null`).assign(a,(0,T._)`""`);return;case"number":o.elseIf((0,T._)`${i} == "boolean" || ${n} === null
|
|
5
|
+
|| (${i} == "string" && ${n} && ${n} == +${n})`).assign(a,(0,T._)`+${n}`);return;case"integer":o.elseIf((0,T._)`${i} === "boolean" || ${n} === null
|
|
6
|
+
|| (${i} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,(0,T._)`+${n}`);return;case"boolean":o.elseIf((0,T._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(a,!1).elseIf((0,T._)`${n} === "true" || ${n} === 1`).assign(a,!0);return;case"null":o.elseIf((0,T._)`${n} === "" || ${n} === 0 || ${n} === false`),o.assign(a,null);return;case"array":o.elseIf((0,T._)`${i} === "string" || ${i} === "number"
|
|
7
|
+
|| ${i} === "boolean" || ${n} === null`).assign(a,(0,T._)`[${n}]`)}}}function vp({gen:t,parentData:e,parentDataProperty:r},o){t.if((0,T._)`${e} !== undefined`,()=>t.assign((0,T._)`${e}[${r}]`,o))}function Gn(t,e,r,o=St.Correct){let n=o===St.Correct?T.operators.EQ:T.operators.NEQ,s;switch(t){case"null":return(0,T._)`${e} ${n} null`;case"array":s=(0,T._)`Array.isArray(${e})`;break;case"object":s=(0,T._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=i((0,T._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=i();break;default:return(0,T._)`typeof ${e} ${n} ${t}`}return o===St.Correct?s:(0,T.not)(s);function i(a=T.nil){return(0,T.and)((0,T._)`typeof ${e} == "number"`,a,r?(0,T._)`isFinite(${e})`:T.nil)}}oe.checkDataType=Gn;function Bn(t,e,r,o){if(t.length===1)return Gn(t[0],e,r,o);let n,s=(0,ja.toHash)(t);if(s.array&&s.object){let i=(0,T._)`typeof ${e} != "object"`;n=s.null?i:(0,T._)`!${e} || ${i}`,delete s.null,delete s.array,delete s.object}else n=T.nil;s.number&&delete s.integer;for(let i in s)n=(0,T.and)(n,Gn(i,e,r,o));return n}oe.checkDataTypes=Bn;var wp={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,T._)`{type: ${t}}`:(0,T._)`{type: ${e}}`};function Jn(t){let e=bp(t);(0,hp.reportError)(e,wp)}oe.reportTypeError=Jn;function bp(t){let{gen:e,data:r,schema:o}=t,n=(0,ja.schemaRefOrVal)(t,o,"type");return{gen:e,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:t}}});var Da=$(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.assignDefaults=void 0;var xt=R(),Sp=j();function xp(t,e){let{properties:r,items:o}=t.schema;if(e==="object"&&r)for(let n in r)Aa(t,n,r[n].default);else e==="array"&&Array.isArray(o)&&o.forEach((n,s)=>Aa(t,s,n.default))}ao.assignDefaults=xp;function Aa(t,e,r){let{gen:o,compositeRule:n,data:s,opts:i}=t;if(r===void 0)return;let a=(0,xt._)`${s}${(0,xt.getProperty)(e)}`;if(n){(0,Sp.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,xt._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,xt._)`${c} || ${a} === null || ${a} === ""`),o.if(c,(0,xt._)`${a} = ${(0,xt.stringify)(r)}`)}});var _e=$(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.validateUnion=L.validateArray=L.usePattern=L.callValidateCode=L.schemaProperties=L.allSchemaProperties=L.noPropertyInData=L.propertyInData=L.isOwnProperty=L.hasPropFunc=L.reportMissingProp=L.checkMissingProp=L.checkReportMissingProp=void 0;var U=R(),Wn=j(),Ve=Ne(),kp=j();function Ep(t,e){let{gen:r,data:o,it:n}=t;r.if(Qn(r,o,e,n.opts.ownProperties),()=>{t.setParams({missingProperty:(0,U._)`${e}`},!0),t.error()})}L.checkReportMissingProp=Ep;function zp({gen:t,data:e,it:{opts:r}},o,n){return(0,U.or)(...o.map(s=>(0,U.and)(Qn(t,e,s,r.ownProperties),(0,U._)`${n} = ${s}`)))}L.checkMissingProp=zp;function Pp(t,e){t.setParams({missingProperty:e},!0),t.error()}L.reportMissingProp=Pp;function La(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,U._)`Object.prototype.hasOwnProperty`})}L.hasPropFunc=La;function Xn(t,e,r){return(0,U._)`${La(t)}.call(${e}, ${r})`}L.isOwnProperty=Xn;function Tp(t,e,r,o){let n=(0,U._)`${e}${(0,U.getProperty)(r)} !== undefined`;return o?(0,U._)`${n} && ${Xn(t,e,r)}`:n}L.propertyInData=Tp;function Qn(t,e,r,o){let n=(0,U._)`${e}${(0,U.getProperty)(r)} === undefined`;return o?(0,U.or)(n,(0,U.not)(Xn(t,e,r))):n}L.noPropertyInData=Qn;function Za(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}L.allSchemaProperties=Za;function Rp(t,e){return Za(e).filter(r=>!(0,Wn.alwaysValidSchema)(t,e[r]))}L.schemaProperties=Rp;function Ip({schemaCode:t,data:e,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:s},it:i},a,c,u){let l=u?(0,U._)`${t}, ${e}, ${o}${n}`:e,d=[[Ve.default.instancePath,(0,U.strConcat)(Ve.default.instancePath,s)],[Ve.default.parentData,i.parentData],[Ve.default.parentDataProperty,i.parentDataProperty],[Ve.default.rootData,Ve.default.rootData]];i.opts.dynamicRef&&d.push([Ve.default.dynamicAnchors,Ve.default.dynamicAnchors]);let p=(0,U._)`${l}, ${r.object(...d)}`;return c!==U.nil?(0,U._)`${a}.call(${c}, ${p})`:(0,U._)`${a}(${p})`}L.callValidateCode=Ip;var Cp=(0,U._)`new RegExp`;function Mp({gen:t,it:{opts:e}},r){let o=e.unicodeRegExp?"u":"",{regExp:n}=e.code,s=n(r,o);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,U._)`${n.code==="new RegExp"?Cp:(0,kp.useFunc)(t,n)}(${r}, ${o})`})}L.usePattern=Mp;function qp(t){let{gen:e,data:r,keyword:o,it:n}=t,s=e.name("valid");if(n.allErrors){let a=e.let("valid",!0);return i(()=>e.assign(a,!1)),a}return e.var(s,!0),i(()=>e.break()),s;function i(a){let c=e.const("len",(0,U._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:o,dataProp:u,dataPropType:Wn.Type.Num},s),e.if((0,U.not)(s),a)})}}L.validateArray=qp;function jp(t){let{gen:e,schema:r,keyword:o,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Wn.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let i=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:o,schemaProp:u,compositeRule:!0},a);e.assign(i,(0,U._)`${i} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,U.not)(i))})),t.result(i,()=>t.reset(),()=>t.error(!0))}L.validateUnion=jp});var Ha=$(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.validateKeywordUsage=Pe.validSchemaType=Pe.funcKeywordCode=Pe.macroKeywordCode=void 0;var ae=R(),nt=Ne(),Np=_e(),Op=sr();function Ap(t,e){let{gen:r,keyword:o,schema:n,parentSchema:s,it:i}=t,a=e.macro.call(i.self,n,s,i),c=Ua(r,o,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:ae.nil,errSchemaPath:`${i.errSchemaPath}/${o}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}Pe.macroKeywordCode=Ap;function Dp(t,e){var r;let{gen:o,keyword:n,schema:s,parentSchema:i,$data:a,it:c}=t;Zp(c,e);let u=!a&&e.compile?e.compile.call(c.self,s,i,c):e.validate,l=Ua(o,n,u),d=o.let("valid");t.block$data(d,p),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function p(){if(e.errors===!1)g(),e.modifying&&Fa(t),y(()=>t.error());else{let _=e.async?m():h();e.modifying&&Fa(t),y(()=>Lp(t,_))}}function m(){let _=o.let("ruleErrs",null);return o.try(()=>g((0,ae._)`await `),w=>o.assign(d,!1).if((0,ae._)`${w} instanceof ${c.ValidationError}`,()=>o.assign(_,(0,ae._)`${w}.errors`),()=>o.throw(w))),_}function h(){let _=(0,ae._)`${l}.errors`;return o.assign(_,null),g(ae.nil),_}function g(_=e.async?(0,ae._)`await `:ae.nil){let w=c.opts.passContext?nt.default.this:nt.default.self,k=!("compile"in e&&!a||e.schema===!1);o.assign(d,(0,ae._)`${_}${(0,Np.callValidateCode)(t,l,w,k)}`,e.modifying)}function y(_){var w;o.if((0,ae.not)((w=e.valid)!==null&&w!==void 0?w:d),_)}}Pe.funcKeywordCode=Dp;function Fa(t){let{gen:e,data:r,it:o}=t;e.if(o.parentData,()=>e.assign(r,(0,ae._)`${o.parentData}[${o.parentDataProperty}]`))}function Lp(t,e){let{gen:r}=t;r.if((0,ae._)`Array.isArray(${e})`,()=>{r.assign(nt.default.vErrors,(0,ae._)`${nt.default.vErrors} === null ? ${e} : ${nt.default.vErrors}.concat(${e})`).assign(nt.default.errors,(0,ae._)`${nt.default.vErrors}.length`),(0,Op.extendErrors)(t)},()=>t.error())}function Zp({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function Ua(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,ae.stringify)(r)})}function Fp(t,e,r=!1){return!e.length||e.some(o=>o==="array"?Array.isArray(t):o==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==o||r&&typeof t>"u")}Pe.validSchemaType=Fp;function Up({schema:t,opts:e,self:r,errSchemaPath:o},n,s){if(Array.isArray(n.keyword)?!n.keyword.includes(s):n.keyword!==s)throw new Error("ajv implementation error");let i=n.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(n.validateSchema&&!n.validateSchema(t[s])){let c=`keyword "${s}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Pe.validateKeywordUsage=Up});var Ka=$(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.extendSubschemaMode=Ke.extendSubschemaData=Ke.getSubschema=void 0;var Te=R(),Va=j();function Hp(t,{keyword:e,schemaProp:r,schema:o,schemaPath:n,errSchemaPath:s,topSchemaRef:i}){if(e!==void 0&&o!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Te._)`${t.schemaPath}${(0,Te.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Te._)`${t.schemaPath}${(0,Te.getProperty)(e)}${(0,Te.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Va.escapeFragment)(r)}`}}if(o!==void 0){if(n===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:n,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}Ke.getSubschema=Hp;function Vp(t,e,{dataProp:r,dataPropType:o,data:n,dataTypes:s,propertyName:i}){if(n!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,p=a.let("data",(0,Te._)`${e.data}${(0,Te.getProperty)(r)}`,!0);c(p),t.errorPath=(0,Te.str)`${u}${(0,Va.getErrorPath)(r,o,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Te._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(n!==void 0){let u=n instanceof Te.Name?n:a.let("data",n,!0);c(u),i!==void 0&&(t.propertyName=i)}s&&(t.dataTypes=s);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}Ke.extendSubschemaData=Vp;function Kp(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:s}){o!==void 0&&(t.compositeRule=o),n!==void 0&&(t.createErrors=n),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=r}Ke.extendSubschemaMode=Kp});var Yn=$((Sw,Ga)=>{"use strict";Ga.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var o,n,s;if(Array.isArray(e)){if(o=e.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!t(e[n],r[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),o=s.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=o;n--!==0;){var i=s[n];if(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r}});var Ja=$((xw,Ba)=>{"use strict";var Ge=Ba.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var o=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};co(e,o,n,t,"",t)};Ge.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Ge.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Ge.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Ge.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 co(t,e,r,o,n,s,i,a,c,u){if(o&&typeof o=="object"&&!Array.isArray(o)){e(o,n,s,i,a,c,u);for(var l in o){var d=o[l];if(Array.isArray(d)){if(l in Ge.arrayKeywords)for(var p=0;p<d.length;p++)co(t,e,r,d[p],n+"/"+l+"/"+p,s,n,l,o,p)}else if(l in Ge.propsKeywords){if(d&&typeof d=="object")for(var m in d)co(t,e,r,d[m],n+"/"+l+"/"+Gp(m),s,n,l,o,m)}else(l in Ge.keywords||t.allKeys&&!(l in Ge.skipKeywords))&&co(t,e,r,d,n+"/"+l,s,n,l,o)}r(o,n,s,i,a,c,u)}}function Gp(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var ar=$(ue=>{"use strict";Object.defineProperty(ue,"__esModule",{value:!0});ue.getSchemaRefs=ue.resolveUrl=ue.normalizeId=ue._getFullPath=ue.getFullPath=ue.inlineRef=void 0;var Bp=j(),Jp=Yn(),Wp=Ja(),Xp=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Qp(t,e=!0){return typeof t=="boolean"?!0:e===!0?!es(t):e?Wa(t)<=e:!1}ue.inlineRef=Qp;var Yp=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function es(t){for(let e in t){if(Yp.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(es)||typeof r=="object"&&es(r))return!0}return!1}function Wa(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!Xp.has(r)&&(typeof t[r]=="object"&&(0,Bp.eachItem)(t[r],o=>e+=Wa(o)),e===1/0))return 1/0}return e}function Xa(t,e="",r){r!==!1&&(e=kt(e));let o=t.parse(e);return Qa(t,o)}ue.getFullPath=Xa;function Qa(t,e){return t.serialize(e).split("#")[0]+"#"}ue._getFullPath=Qa;var em=/#\/?$/;function kt(t){return t?t.replace(em,""):""}ue.normalizeId=kt;function tm(t,e,r){return r=kt(r),t.resolve(e,r)}ue.resolveUrl=tm;var rm=/^[a-z_][-a-z0-9._]*$/i;function om(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=kt(t[r]||e),s={"":n},i=Xa(o,n,!1),a={},c=new Set;return Wp(t,{allKeys:!0},(d,p,m,h)=>{if(h===void 0)return;let g=i+p,y=s[h];typeof d[r]=="string"&&(y=_.call(this,d[r])),w.call(this,d.$anchor),w.call(this,d.$dynamicAnchor),s[p]=y;function _(k){let O=this.opts.uriResolver.resolve;if(k=kt(y?O(y,k):k),c.has(k))throw l(k);c.add(k);let P=this.refs[k];return typeof P=="string"&&(P=this.refs[P]),typeof P=="object"?u(d,P.schema,k):k!==kt(g)&&(k[0]==="#"?(u(d,a[k],k),a[k]=d):this.refs[k]=g),k}function w(k){if(typeof k=="string"){if(!rm.test(k))throw new Error(`invalid anchor "${k}"`);_.call(this,`#${k}`)}}}),a;function u(d,p,m){if(p!==void 0&&!Jp(d,p))throw l(m)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}ue.getSchemaRefs=om});var ur=$(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.getData=Be.KeywordCxt=Be.validateFunctionCode=void 0;var oc=Ca(),Ya=ir(),rs=Kn(),lo=ir(),nm=Da(),lr=Ha(),ts=Ka(),x=R(),z=Ne(),sm=ar(),Oe=j(),cr=sr();function im(t){if(ic(t)&&(ac(t),sc(t))){lm(t);return}nc(t,()=>(0,oc.topBoolOrEmptySchema)(t))}Be.validateFunctionCode=im;function nc({gen:t,validateName:e,schema:r,schemaEnv:o,opts:n},s){n.code.es5?t.func(e,(0,x._)`${z.default.data}, ${z.default.valCxt}`,o.$async,()=>{t.code((0,x._)`"use strict"; ${ec(r,n)}`),cm(t,n),t.code(s)}):t.func(e,(0,x._)`${z.default.data}, ${am(n)}`,o.$async,()=>t.code(ec(r,n)).code(s))}function am(t){return(0,x._)`{${z.default.instancePath}="", ${z.default.parentData}, ${z.default.parentDataProperty}, ${z.default.rootData}=${z.default.data}${t.dynamicRef?(0,x._)`, ${z.default.dynamicAnchors}={}`:x.nil}}={}`}function cm(t,e){t.if(z.default.valCxt,()=>{t.var(z.default.instancePath,(0,x._)`${z.default.valCxt}.${z.default.instancePath}`),t.var(z.default.parentData,(0,x._)`${z.default.valCxt}.${z.default.parentData}`),t.var(z.default.parentDataProperty,(0,x._)`${z.default.valCxt}.${z.default.parentDataProperty}`),t.var(z.default.rootData,(0,x._)`${z.default.valCxt}.${z.default.rootData}`),e.dynamicRef&&t.var(z.default.dynamicAnchors,(0,x._)`${z.default.valCxt}.${z.default.dynamicAnchors}`)},()=>{t.var(z.default.instancePath,(0,x._)`""`),t.var(z.default.parentData,(0,x._)`undefined`),t.var(z.default.parentDataProperty,(0,x._)`undefined`),t.var(z.default.rootData,z.default.data),e.dynamicRef&&t.var(z.default.dynamicAnchors,(0,x._)`{}`)})}function lm(t){let{schema:e,opts:r,gen:o}=t;nc(t,()=>{r.$comment&&e.$comment&&lc(t),mm(t),o.let(z.default.vErrors,null),o.let(z.default.errors,0),r.unevaluated&&um(t),cc(t),ym(t)})}function um(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,x._)`${r}.evaluated`),e.if((0,x._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,x._)`${t.evaluated}.props`,(0,x._)`undefined`)),e.if((0,x._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,x._)`${t.evaluated}.items`,(0,x._)`undefined`))}function ec(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,x._)`/*# sourceURL=${r} */`:x.nil}function dm(t,e){if(ic(t)&&(ac(t),sc(t))){fm(t,e);return}(0,oc.boolOrEmptySchema)(t,e)}function sc({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function ic(t){return typeof t.schema!="boolean"}function fm(t,e){let{schema:r,gen:o,opts:n}=t;n.$comment&&r.$comment&&lc(t),hm(t),gm(t);let s=o.const("_errs",z.default.errors);cc(t,s),o.var(e,(0,x._)`${s} === ${z.default.errors}`)}function ac(t){(0,Oe.checkUnknownRules)(t),pm(t)}function cc(t,e){if(t.opts.jtd)return tc(t,[],!1,e);let r=(0,Ya.getSchemaTypes)(t.schema),o=(0,Ya.coerceAndCheckDataType)(t,r);tc(t,r,!o,e)}function pm(t){let{schema:e,errSchemaPath:r,opts:o,self:n}=t;e.$ref&&o.ignoreKeywordsWithRef&&(0,Oe.schemaHasRulesButRef)(e,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function mm(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Oe.checkStrictMode)(t,"default is ignored in the schema root")}function hm(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,sm.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function gm(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function lc({gen:t,schemaEnv:e,schema:r,errSchemaPath:o,opts:n}){let s=r.$comment;if(n.$comment===!0)t.code((0,x._)`${z.default.self}.logger.log(${s})`);else if(typeof n.$comment=="function"){let i=(0,x.str)`${o}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,x._)`${z.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function ym(t){let{gen:e,schemaEnv:r,validateName:o,ValidationError:n,opts:s}=t;r.$async?e.if((0,x._)`${z.default.errors} === 0`,()=>e.return(z.default.data),()=>e.throw((0,x._)`new ${n}(${z.default.vErrors})`)):(e.assign((0,x._)`${o}.errors`,z.default.vErrors),s.unevaluated&&_m(t),e.return((0,x._)`${z.default.errors} === 0`))}function _m({gen:t,evaluated:e,props:r,items:o}){r instanceof x.Name&&t.assign((0,x._)`${e}.props`,r),o instanceof x.Name&&t.assign((0,x._)`${e}.items`,o)}function tc(t,e,r,o){let{gen:n,schema:s,data:i,allErrors:a,opts:c,self:u}=t,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,Oe.schemaHasRulesButRef)(s,l))){n.block(()=>dc(t,"$ref",l.all.$ref.definition));return}c.jtd||$m(t,e),n.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){(0,rs.shouldUseGroup)(s,p)&&(p.type?(n.if((0,lo.checkDataType)(p.type,i,c.strictNumbers)),rc(t,p),e.length===1&&e[0]===p.type&&r&&(n.else(),(0,lo.reportTypeError)(t)),n.endIf()):rc(t,p),a||n.if((0,x._)`${z.default.errors} === ${o||0}`))}}function rc(t,e){let{gen:r,schema:o,opts:{useDefaults:n}}=t;n&&(0,nm.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,rs.shouldUseRule)(o,s)&&dc(t,s.keyword,s.definition,e.type)})}function $m(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(vm(t,e),t.opts.allowUnionTypes||wm(t,e),bm(t,t.dataTypes))}function vm(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{uc(t.dataTypes,r)||os(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),xm(t,e)}}function wm(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&os(t,"use allowUnionTypes to allow union type keyword")}function bm(t,e){let r=t.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&(0,rs.shouldUseRule)(t.schema,n)){let{type:s}=n.definition;s.length&&!s.some(i=>Sm(e,i))&&os(t,`missing type "${s.join(",")}" for keyword "${o}"`)}}}function Sm(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function uc(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function xm(t,e){let r=[];for(let o of t.dataTypes)uc(e,o)?r.push(o):e.includes("integer")&&o==="number"&&r.push("integer");t.dataTypes=r}function os(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Oe.checkStrictMode)(t,e,t.opts.strictTypes)}var uo=class{constructor(e,r,o){if((0,lr.validateKeywordUsage)(e,r,o),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=o,this.data=e.data,this.schema=e.schema[o],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Oe.schemaRefOrVal)(e,this.schema,o,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",fc(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,lr.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${o} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",z.default.errors))}result(e,r,o){this.failResult((0,x.not)(e),r,o)}failResult(e,r,o){this.gen.if(e),o?o():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,x.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,x._)`${r} !== undefined && (${(0,x.or)(this.invalid$data(),e)})`)}error(e,r,o){if(r){this.setParams(r),this._error(e,o),this.setParams({});return}this._error(e,o)}_error(e,r){(e?cr.reportExtraError:cr.reportError)(this,this.def.error,r)}$dataError(){(0,cr.reportError)(this,this.def.$dataError||cr.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,cr.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,o=x.nil){this.gen.block(()=>{this.check$data(e,o),r()})}check$data(e=x.nil,r=x.nil){if(!this.$data)return;let{gen:o,schemaCode:n,schemaType:s,def:i}=this;o.if((0,x.or)((0,x._)`${n} === undefined`,r)),e!==x.nil&&o.assign(e,!0),(s.length||i.validateSchema)&&(o.elseIf(this.invalid$data()),this.$dataError(),e!==x.nil&&o.assign(e,!1)),o.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:o,def:n,it:s}=this;return(0,x.or)(i(),a());function i(){if(o.length){if(!(r instanceof x.Name))throw new Error("ajv implementation error");let c=Array.isArray(o)?o:[o];return(0,x._)`${(0,lo.checkDataTypes)(c,r,s.opts.strictNumbers,lo.DataType.Wrong)}`}return x.nil}function a(){if(n.validateSchema){let c=e.scopeValue("validate$data",{ref:n.validateSchema});return(0,x._)`!${c}(${r})`}return x.nil}}subschema(e,r){let o=(0,ts.getSubschema)(this.it,e);(0,ts.extendSubschemaData)(o,this.it,e),(0,ts.extendSubschemaMode)(o,e);let n={...this.it,...o,items:void 0,props:void 0};return dm(n,r),n}mergeEvaluated(e,r){let{it:o,gen:n}=this;o.opts.unevaluated&&(o.props!==!0&&e.props!==void 0&&(o.props=Oe.mergeEvaluated.props(n,e.props,o.props,r)),o.items!==!0&&e.items!==void 0&&(o.items=Oe.mergeEvaluated.items(n,e.items,o.items,r)))}mergeValidEvaluated(e,r){let{it:o,gen:n}=this;if(o.opts.unevaluated&&(o.props!==!0||o.items!==!0))return n.if(r,()=>this.mergeEvaluated(e,x.Name)),!0}};Be.KeywordCxt=uo;function dc(t,e,r,o){let n=new uo(t,r,e);"code"in r?r.code(n,o):n.$data&&r.validate?(0,lr.funcKeywordCode)(n,r):"macro"in r?(0,lr.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,lr.funcKeywordCode)(n,r)}var km=/^\/(?:[^~]|~0|~1)*$/,Em=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function fc(t,{dataLevel:e,dataNames:r,dataPathArr:o}){let n,s;if(t==="")return z.default.rootData;if(t[0]==="/"){if(!km.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);n=t,s=z.default.rootData}else{let u=Em.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(n=u[2],n==="#"){if(l>=e)throw new Error(c("property/index",l));return o[e-l]}if(l>e)throw new Error(c("data",l));if(s=r[e-l],!n)return s}let i=s,a=n.split("/");for(let u of a)u&&(s=(0,x._)`${s}${(0,x.getProperty)((0,Oe.unescapeJsonPointer)(u))}`,i=(0,x._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}Be.getData=fc});var fo=$(ss=>{"use strict";Object.defineProperty(ss,"__esModule",{value:!0});var ns=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};ss.default=ns});var dr=$(cs=>{"use strict";Object.defineProperty(cs,"__esModule",{value:!0});var is=ar(),as=class extends Error{constructor(e,r,o,n){super(n||`can't resolve reference ${o} from id ${r}`),this.missingRef=(0,is.resolveUrl)(e,r,o),this.missingSchema=(0,is.normalizeId)((0,is.getFullPath)(e,this.missingRef))}};cs.default=as});var mo=$($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.resolveSchema=$e.getCompilingSchema=$e.resolveRef=$e.compileSchema=$e.SchemaEnv=void 0;var be=R(),zm=fo(),st=Ne(),Se=ar(),pc=j(),Pm=ur(),Et=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let o;typeof e.schema=="object"&&(o=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,Se.normalizeId)(o?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=o?.$async,this.refs={}}};$e.SchemaEnv=Et;function us(t){let e=mc.call(this,t);if(e)return e;let r=(0,Se.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:s}=this.opts,i=new be.CodeGen(this.scope,{es5:o,lines:n,ownProperties:s}),a;t.$async&&(a=i.scopeValue("Error",{ref:zm.default,code:(0,be._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");t.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:st.default.data,parentData:st.default.parentData,parentDataProperty:st.default.parentDataProperty,dataNames:[st.default.data],dataPathArr:[be.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,be.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:be.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,be._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,Pm.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let d=i.toString();l=`${i.scopeRefs(st.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let m=new Function(`${st.default.self}`,`${st.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:m}),m.errors=null,m.schema=t.schema,m.schemaEnv=t,t.$async&&(m.$async=!0),this.opts.code.source===!0&&(m.source={validateName:c,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){let{props:h,items:g}=u;m.evaluated={props:h instanceof be.Name?void 0:h,items:g instanceof be.Name?void 0:g,dynamicProps:h instanceof be.Name,dynamicItems:g instanceof be.Name},m.source&&(m.source.evaluated=(0,be.stringify)(m.evaluated))}return t.validate=m,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}$e.compileSchema=us;function Tm(t,e,r){var o;r=(0,Se.resolveUrl)(this.opts.uriResolver,e,r);let n=t.refs[r];if(n)return n;let s=Cm.call(this,t,r);if(s===void 0){let i=(o=t.localRefs)===null||o===void 0?void 0:o[r],{schemaId:a}=this.opts;i&&(s=new Et({schema:i,schemaId:a,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=Rm.call(this,s)}$e.resolveRef=Tm;function Rm(t){return(0,Se.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:us.call(this,t)}function mc(t){for(let e of this._compilations)if(Im(e,t))return e}$e.getCompilingSchema=mc;function Im(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function Cm(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||po.call(this,t,e)}function po(t,e){let r=this.opts.uriResolver.parse(e),o=(0,Se._getFullPath)(this.opts.uriResolver,r),n=(0,Se.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&o===n)return ls.call(this,r,t);let s=(0,Se.normalizeId)(o),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=po.call(this,t,i);return typeof a?.schema!="object"?void 0:ls.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||us.call(this,i),s===(0,Se.normalizeId)(e)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(n=(0,Se.resolveUrl)(this.opts.uriResolver,n,u)),new Et({schema:a,schemaId:c,root:t,baseId:n})}return ls.call(this,r,i)}}$e.resolveSchema=po;var Mm=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function ls(t,{baseId:e,schema:r,root:o}){var n;if(((n=t.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,pc.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!Mm.has(a)&&u&&(e=(0,Se.resolveUrl)(this.opts.uriResolver,e,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,pc.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Se.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=po.call(this,o,a)}let{schemaId:i}=this.opts;if(s=s||new Et({schema:r,schemaId:i,root:o,baseId:e}),s.schema!==s.root.schema)return s}});var hc=$((Rw,qm)=>{qm.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}});var gs=$((Iw,bc)=>{"use strict";var jm=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),fs=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),Nm=RegExp.prototype.test.bind(/^\d*$/u),it=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),ps=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),yc=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),ms=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),Om=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),de=new Array(256);{let t="0123456789ABCDEF";for(let e=0;e<256;e++)de[e]="%"+t[e>>4]+t[e&15]}function ne(t){return t<2048?de[192|t>>6]+de[128|t&63]:t<65536?de[224|t>>12]+de[128|t>>6&63]+de[128|t&63]:de[240|t>>18]+de[128|t>>12&63]+de[128|t>>6&63]+de[128|t&63]}function Am(t){let e="",r=0,o=0;for(o=0;o<t.length;o++)if(r=t[o].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[o];break}for(o+=1;o<t.length;o++){if(r=t[o].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[o]}return e}var Dm=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),Lm=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),Zm=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),Fm=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Um(t){if(t.length===0)return!1;for(let e=0;e<t.length;e++)if(!Zm(t[e])){if(t[e]==="%"&&e+2<t.length&&it(t.slice(e+1,e+3))){e+=2;continue}return!1}return!0}function gc(t){let e=-1,r=0,o=-1,n=0;for(let a=0;a<t.length;a++)t[a]==="0"?(o===-1&&(o=a),n++,n>r&&(r=n,e=o)):(o=-1,n=0);if(r<2)return t.join(":");let s=t.slice(0,e).join(":"),i=t.slice(e+r).join(":");return s+"::"+i}function Hm(t){let e=t.indexOf("::");if(e!==-1&&t.indexOf("::",e+1)!==-1)return;let r=e===-1?t.split(":"):t.slice(0,e).split(":"),o=e===-1?[]:t.slice(e+2).split(":");e!==-1&&(r.length===1&&r[0]===""&&(r.length=0),o.length===1&&o[0]===""&&(o.length=0));let n=r.concat(o),s=0;for(let a=0;a<n.length;a++){let c=n[a];if(c==="")return;if(c.indexOf(".")!==-1){if(a!==n.length-1||e!==-1&&o.length===0||!fs(c))return;s+=2;continue}if(!Dm(c))return;n[a]=parseInt(c,16).toString(16),s++}if(e===-1)return s!==8?void 0:gc(n);if(s>=8)return;let i=n.slice(0,r.length);for(let a=s;a<8;a++)i.push("0");for(let a=r.length;a<n.length;a++)i.push(n[a]);return gc(i)}function ds(t){let e=t[0]==="["&&t[t.length-1]==="]";if((t[0]==="["||t[t.length-1]==="]")&&!e)return{host:t,isIPV6:!1,error:!0};let o=e?t.slice(1,-1):t;if(e&&Lm(o))return o=o.toLowerCase(),{host:`[${o}]`,escapedHost:o,isIPV6:!1,isIPVFuture:!0};if(Vm(o,":")<2)return{host:t,isIPV6:!1,error:e};let n="",s=o.indexOf("%");if(s!==-1){let a=o.slice(s,s+3).toLowerCase()==="%25"?3:1;if(n=o.slice(s+a),!Um(n))return{host:t,isIPV6:!1,error:!0};o=o.slice(0,s)}let i=Hm(o);return i===void 0?{host:t,isIPV6:!1,error:!0}:{host:i+(n?"%"+n:""),escapedHost:i+(n?"%25"+n:""),isIPV6:!0}}function Vm(t,e){let r=0;for(let o=0;o<t.length;o++)t[o]===e&&r++;return r}function Km(t){let e=t,r=[],o=-1,n=0;for(;n=e.length;){if(n===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(n===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(n===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((o=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,o)),e=e.slice(o)}return r.join("")}var Gm={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},Bm=/[@/?#:]/g,Jm=/[@/?#]/g;function _c(t,e){let r=e?Jm:Bm;return r.lastIndex=0,t.replace(r,o=>Gm[o])}function $c(t,e=!1){if(t.indexOf("%")===-1)return t;let r="";for(let o=0;o<t.length;o++){if(t[o]==="%"&&o+2<t.length){let n=t.slice(o+1,o+3);if(it(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));e&&ps(i)?r+=i:r+="%"+s,o+=2;continue}}r+=t[o]}return r}function Wm(t){let e="";for(let r=0;r<t.length;r++){let o=t[r];if(o==="%"&&r+2<t.length){let n=t.slice(r+1,r+3);if(it(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));i!=="."&&ps(i)?e+=i:e+="%"+s,r+=2;continue}}if(yc(o))e+=o;else{let n=t.charCodeAt(r);if(n<128)e+=wc(n)?o:de[n];else if(n<55296||n>57343)e+=ne(n);else if(n<=56319&&r+1<t.length){let s=t.charCodeAt(r+1);s>=56320&&s<=57343?(e+=ne(65536+(n-55296<<10)+(s-56320)),r++):e+=ne(65533)}else e+=ne(65533)}}return e}function Xm(t,e=!1){let r="",o=e&&t[0]!=="/";for(let n=0;n<t.length;n++){let s=t[n];if(s==="%"&&n+2<t.length){let i=t.slice(n+1,n+3);if(it(i)){r+="%"+i.toUpperCase(),n+=2;continue}}if(s==="/"&&(o=!1),yc(s)&&(s!==":"||!o))r+=s;else{let i=t.charCodeAt(n);if(i<128)r+=de[i];else if(i<55296||i>57343)r+=ne(i);else if(i<=56319&&n+1<t.length){let a=t.charCodeAt(n+1);a>=56320&&a<=57343?(r+=ne(65536+(i-55296<<10)+(a-56320)),n++):r+=ne(65533)}else r+=ne(65533)}}return r}function hs(t,e){let r="";for(let o=0;o<t.length;o++){let n=t[o];if(n==="%"&&o+2<t.length){let s=t.slice(o+1,o+3);if(it(s)){r+="%"+s.toUpperCase(),o+=2;continue}}if(e(n))r+=n;else{let s=t.charCodeAt(o);if(s<128)r+=de[s];else if(s<55296||s>57343)r+=ne(s);else if(s<=56319&&o+1<t.length){let i=t.charCodeAt(o+1);i>=56320&&i<=57343?(r+=ne(65536+(s-55296<<10)+(i-56320)),o++):r+=ne(65533)}else r+=ne(65533)}}return r}function vc(t){return hs(t,Om)}function Qm(t){return hs(t,ms)}function Ym(t){return hs(t,ms)}function wc(t){return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t===42||t===43||t===45||t===46||t===47||t===64||t===95}function eh(t){let e="";for(let r=0;r<t.length;r++){let o=t[r];if(o==="%"&&r+2<t.length){let n=t.slice(r+1,r+3);if(it(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));ps(i)?e+=i:e+="%"+s,r+=2;continue}}if(ms(o))e+=o;else{let n=t.charCodeAt(r);if(n<128)e+=wc(n)?o:de[n];else if(n<55296||n>57343)e+=ne(n);else if(n<=56319&&r+1<t.length){let s=t.charCodeAt(r+1);s>=56320&&s<=57343?(e+=ne(65536+(n-55296<<10)+(s-56320)),r++):e+=ne(65533)}else e+=ne(65533)}}return e}function th(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let o=t.slice(r+1,r+3);if(it(o)){e+="%"+o.toUpperCase(),r+=2;continue}}e+=escape(t[r])}return e}function rh(t){let e=[];if(t.userinfo!==void 0&&(e.push(vc(t.userinfo)),e.push("@")),t.host!==void 0){let r=t.host;if(!fs(r)){let o=ds(r);o.isIPV6!==!0&&o.isIPVFuture!==!0&&(r=$c(r,!0),o=ds(r)),o.isIPV6===!0||o.isIPVFuture===!0?r=`[${o.escapedHost}]`:r=_c(r,!1)}e.push(r)}if(typeof t.port=="number"||typeof t.port=="string"){let r=String(t.port);if(!Nm(r))throw new TypeError("URI port is malformed.");e.push(":"),e.push(r)}return e.length?e.join(""):void 0}bc.exports={nonSimpleDomain:Fm,recomposeAuthority:rh,reescapeHostDelimiters:_c,normalizePercentEncoding:$c,normalizePathEncoding:Wm,serializePathEncoding:Xm,normalizeQueryFragmentEncoding:eh,encodeUserinfo:vc,encodeQuery:Qm,encodeFragment:Ym,escapePreservingEscapes:th,removeDotSegments:Km,isIPv4:fs,isUUID:jm,normalizeIPv6:ds,stringArrayToHexStripped:Am}});var zc=$((Cw,Ec)=>{"use strict";var{isUUID:oh}=gs(),nh=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,sh=["http","https","ws","wss","urn","urn:uuid"];function ih(t){return sh.indexOf(t)!==-1}function ys(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function Sc(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function xc(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function ah(t){return t.secure=ys(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function ch(t){if((t.port===(ys(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let e=t.resourceName.indexOf("?"),r=e===-1?t.resourceName:t.resourceName.slice(0,e);t.path=r&&r!=="/"?r:void 0,t.query=e===-1?void 0:t.resourceName.slice(e+1),t.resourceName=void 0}return t.fragment=void 0,t}function lh(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(nh);if(r&&r[0]===t.path){let o=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let n=`${o}:${e.nid||t.nid}`,s=_s(n);t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function uh(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",o=t.nid.toLowerCase(),n=`${r}:${e.nid||o}`,s=_s(n);s&&(t=s.serialize(t,e));let i=t,a=t.nss;return i.path=`${o||e.nid}:${a}`,e.skipEscape=!0,i}function dh(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!oh(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function fh(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var kc={scheme:"http",domainHost:!0,parse:Sc,serialize:xc},ph={scheme:"https",domainHost:kc.domainHost,parse:Sc,serialize:xc},ho={scheme:"ws",domainHost:!0,parse:ah,serialize:ch},mh={scheme:"wss",domainHost:ho.domainHost,parse:ho.parse,serialize:ho.serialize},hh={scheme:"urn",parse:lh,serialize:uh,skipNormalize:!0},gh={scheme:"urn:uuid",parse:dh,serialize:fh,skipNormalize:!0},go={http:kc,https:ph,ws:ho,wss:mh,urn:hh,"urn:uuid":gh};Object.setPrototypeOf(go,null);function _s(t){return t&&(go[t]||go[t.toLowerCase()])||void 0}Ec.exports={wsIsSecure:ys,SCHEMES:go,isValidSchemeName:ih,getSchemeHandler:_s}});var Lc=$((Mw,$o)=>{"use strict";var{normalizeIPv6:Cc,removeDotSegments:pr,recomposeAuthority:yh,normalizePercentEncoding:$s,normalizePathEncoding:_h,serializePathEncoding:Pc,normalizeQueryFragmentEncoding:Tc,encodeQuery:$h,encodeFragment:vh,reescapeHostDelimiters:wh,isIPv4:Mc,nonSimpleDomain:bh}=gs(),{SCHEMES:qc,getSchemeHandler:vs}=zc(),jc=/^[A-Za-z][A-Za-z0-9+.-]*$/u,Nc="URI scheme is malformed.";function Rc(t){let e=unescape(String(t));if(!jc.test(e))throw new TypeError(Nc);return e}function Sh(t,e){return typeof t=="string"?t=Ih(t,e):typeof t=="object"&&(t=_o(at(t,e),e)),t}function xh(t,e,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:n,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:c,malformedScheme:u}=yo(t,o),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:p,malformedSchemeSpecific:m,malformedHost:h,malformedScheme:g}=yo(e,o);if(s||d||i||p||a||m||c||h||u||g)throw new Error(n.error||l.error||"URI is malformed.");let y=Oc(n,l,o,!0),_=vs(r&&r.scheme||y.scheme),w=y.host,k=w!==void 0&&w!==""&&(Mc(w)||Cc(w).isIPV6);Ac(y,r||{},_,k);let O=w&&w.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test(w);if(y.error&&!O)throw new Error(y.error);return o.skipEscape=!0,at(y,o)}function Oc(t,e,r,o){let n={};return o||(t=_o(at(t,r),r),e=_o(at(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(n.scheme=e.scheme,n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=pr(e.path||""),n.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=pr(e.path||""),n.query=e.query):(e.path?(e.path[0]==="/"?n.path=pr(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?n.path="/"+e.path:t.path?n.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:n.path=e.path,n.path=pr(n.path)),n.query=e.query):(n.path=t.path,e.query!==void 0?n.query=e.query:n.query=t.query),n.userinfo=t.userinfo,n.host=t.host,n.port=t.port),n.scheme=t.scheme),n.fragment=e.fragment,n}function kh(t,e,r){let o=Ic(t,r),n=Ic(e,r);return o!==void 0&&n!==void 0&&o===n}function at(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},o=Object.assign({},e),n=[];r.scheme&&(r.scheme=Rc(r.scheme));let s=vs(o.scheme||r.scheme);s&&s.serialize&&s.serialize(r,o);let i=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=!o.skipEscape&&r.scheme===void 0&&!i;r.path!==void 0&&(o.skipEscape?r.path=$s(r.path):r.path=Pc(r.path,a)),o.reference!=="suffix"&&r.scheme&&(r.scheme=Rc(r.scheme),n.push(r.scheme,":"));let c=yh(r);if(c!==void 0&&(o.reference!=="suffix"&&n.push("//"),n.push(c),r.path&&r.path[0]!=="/"&&n.push("/")),r.path!==void 0){let u=r.path;!o.absolutePath&&(!s||!s.absolutePath)&&(u=pr(u)),a&&(u=Pc(u,!0)),c===void 0&&u[0]==="/"&&u[1]==="/"&&(u="/%2F"+u.slice(2)),n.push(u)}return r.query!==void 0&&n.push("?",$h(r.query)),r.fragment!==void 0&&n.push("#",vh(r.fragment)),n.join("")}var Eh=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,zh=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,Ph=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function Th(t,e){if(e[2]!==void 0&&t.path&&t.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof t.port=="number"&&(t.port<0||t.port>65535))return"URI port is malformed."}function fr(t){if(t===void 0)return!1;let e=t.indexOf("%");for(;e!==-1;){if(e+2>=t.length||!/^[\da-f]{2}$/iu.test(t.slice(e+1,e+3)))return!0;e=t.indexOf("%",e+3)}return!1}function ws(t){return t[0]==="["&&t[t.length-1]==="]"}function Rh(t){let e=t[4];return fr(t[3])||e!==void 0&&!ws(e)&&fr(e)||fr(t[6])||fr(t[7])||fr(t[8])}function Ac(t,e,r,o){if(!e.unicodeSupport&&(!r||!r.unicodeSupport)&&t.host&&!ws(t.host)&&(e.domainHost||r&&r.domainHost)&&o===!1&&bh(t.host))try{t.host=new URL("http://"+t.host).hostname}catch(n){return t.error=t.error||"Host's domain name can not be converted to ASCII: "+n,!0}return!1}function yo(t,e){let r=Object.assign({},e),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,s=!1,i=!1,a=!1,c=!1,u=!1,l=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let d=t.match(zh);d!==null&&d[1].indexOf("\\")!==-1&&(o.error="URI authority must not contain a literal backslash.",n=!0);let p=t.match(Ph);if(p!==null){let h=p[1],g=h.replace(/[\t\n\r]/g,"");g.length>=2&&(g.slice(0,2)!=="//"?(o.error=o.error||"URI authority must not contain a literal backslash.",n=!0):h.length!==g.length&&(o.error=o.error||"URI authority introducer must not contain whitespace.",n=!0))}let m=t.match(Eh);if(m){if(o.scheme=m[1],o.userinfo=m[3],o.host=m[4],o.port=parseInt(m[5],10),o.path=m[6]||"",o.query=m[7],o.fragment=m[8],o.scheme!==void 0){let y=unescape(o.scheme);jc.test(y)?o.scheme=y.toLowerCase():(o.error=o.error||Nc,u=!0)}s=Rh(m),s&&(o.error=o.error||"URI contains malformed percent-encoding."),isNaN(o.port)&&(o.port=m[5]);let h=Th(o,m);if(h!==void 0&&(o.error=o.error||h,n=!0),o.host)if(Mc(o.host)===!1){let _=ws(o.host),w=o.host.indexOf("[")!==-1||o.host.indexOf("]")!==-1,k=Cc(o.host);l=k.isIPV6||k.isIPVFuture===!0,c=w&&(!_||k.error===!0),o.host=l?k.host:k.host.toLowerCase(),c&&(o.error=o.error||"URI host is malformed.",n=!0)}else l=!0;o.scheme===void 0&&o.userinfo===void 0&&o.host===void 0&&o.port===void 0&&o.query===void 0&&!o.path?o.reference="same-document":o.scheme===void 0?o.reference="relative":o.fragment===void 0?o.reference="absolute":o.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==o.reference&&(o.error=o.error||"URI is not a "+r.reference+" reference.");let g=vs(r.scheme||o.scheme);if(c||(a=Ac(o,r,g,l)),t.indexOf("%")!==-1&&o.host!==void 0&&!c){let y=l?o.host:$s(o.host,!0);l||(y=$s(y.toLowerCase())),o.host=wh(y,l)}(!g||g&&!g.skipNormalize)&&(o.path&&(o.path=_h(o.path)),o.query&&(o.query=Tc(o.query)),o.fragment&&(o.fragment=Tc(o.fragment))),g&&g.parse&&(g.parse(o,r),g===qc.urn&&o.nid===void 0&&(i=!0))}else o.error=o.error||"URI can not be parsed.";return{parsed:o,malformedAuthorityOrPort:n,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:u}}function _o(t,e){return yo(t,e).parsed}function Ih(t,e){return Dc(t,e).normalized}function Dc(t,e){let{parsed:r,malformedAuthorityOrPort:o,malformedPercentEncoding:n,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}=yo(t,e);return{normalized:o||n||s||i||a?t:at(r,e),malformedAuthorityOrPort:o,malformedPercentEncoding:n,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}}function Ic(t,e){if(typeof t!="string"&&typeof t!="object")return;let r;try{r=typeof t=="string"?t:at(t,e)}catch{return}let{normalized:o,malformedAuthorityOrPort:n,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:c}=Dc(r,e);return n||s||i||a||c?void 0:o}var bs={SCHEMES:qc,normalize:Sh,resolve:xh,resolveComponent:Oc,equal:kh,serialize:at,parse:_o};$o.exports=bs;$o.exports.default=bs;$o.exports.fastUri=bs});var Fc=$(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});var Zc=Lc();Zc.code='require("ajv/dist/runtime/uri").default';Ss.default=Zc});var Wc=$(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.CodeGen=Y.Name=Y.nil=Y.stringify=Y.str=Y._=Y.KeywordCxt=void 0;var Ch=ur();Object.defineProperty(Y,"KeywordCxt",{enumerable:!0,get:function(){return Ch.KeywordCxt}});var zt=R();Object.defineProperty(Y,"_",{enumerable:!0,get:function(){return zt._}});Object.defineProperty(Y,"str",{enumerable:!0,get:function(){return zt.str}});Object.defineProperty(Y,"stringify",{enumerable:!0,get:function(){return zt.stringify}});Object.defineProperty(Y,"nil",{enumerable:!0,get:function(){return zt.nil}});Object.defineProperty(Y,"Name",{enumerable:!0,get:function(){return zt.Name}});Object.defineProperty(Y,"CodeGen",{enumerable:!0,get:function(){return zt.CodeGen}});var Mh=fo(),Gc=dr(),qh=Vn(),mr=mo(),jh=R(),hr=ar(),vo=ir(),ks=j(),Uc=hc(),Nh=Fc(),Bc=(t,e)=>new RegExp(t,e);Bc.code="new RegExp";var Oh=["removeAdditional","useDefaults","coerceTypes"],Ah=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Dh={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."},Lh={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Hc=200;function Zh(t){var e,r,o,n,s,i,a,c,u,l,d,p,m,h,g,y,_,w,k,O,P,Ee,Me,Uo,Ho;let At=t.strict,Vo=(e=t.code)===null||e===void 0?void 0:e.optimize,zi=Vo===!0||Vo===void 0?1:Vo||0,Pi=(o=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:Bc,Lu=(n=t.uriResolver)!==null&&n!==void 0?n:Nh.default;return{strictSchema:(i=(s=t.strictSchema)!==null&&s!==void 0?s:At)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:At)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:At)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=t.strictTuples)!==null&&d!==void 0?d:At)!==null&&p!==void 0?p:"log",strictRequired:(h=(m=t.strictRequired)!==null&&m!==void 0?m:At)!==null&&h!==void 0?h:!1,code:t.code?{...t.code,optimize:zi,regExp:Pi}:{optimize:zi,regExp:Pi},loopRequired:(g=t.loopRequired)!==null&&g!==void 0?g:Hc,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:Hc,meta:(_=t.meta)!==null&&_!==void 0?_:!0,messages:(w=t.messages)!==null&&w!==void 0?w:!0,inlineRefs:(k=t.inlineRefs)!==null&&k!==void 0?k:!0,schemaId:(O=t.schemaId)!==null&&O!==void 0?O:"$id",addUsedSchema:(P=t.addUsedSchema)!==null&&P!==void 0?P:!0,validateSchema:(Ee=t.validateSchema)!==null&&Ee!==void 0?Ee:!0,validateFormats:(Me=t.validateFormats)!==null&&Me!==void 0?Me:!0,unicodeRegExp:(Uo=t.unicodeRegExp)!==null&&Uo!==void 0?Uo:!0,int32range:(Ho=t.int32range)!==null&&Ho!==void 0?Ho:!0,uriResolver:Lu}}var gr=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...Zh(e)};let{es5:r,lines:o}=this.opts.code;this.scope=new jh.ValueScope({scope:{},prefixes:Ah,es5:r,lines:o}),this.logger=Gh(e.logger);let n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,qh.getRules)(),Vc.call(this,Dh,e,"NOT SUPPORTED"),Vc.call(this,Lh,e,"DEPRECATED","warn"),this._metaOpts=Vh.call(this),e.formats&&Uh.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&Hh.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),Fh.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:o}=this.opts,n=Uc;o==="id"&&(n={...Uc},n.id=n.$id,delete n.$id),r&&e&&this.addMetaSchema(n,n[o],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let o;if(typeof e=="string"){if(o=this.getSchema(e),!o)throw new Error(`no schema with key or ref "${e}"`)}else o=this.compile(e);let n=o(r);return"$async"in o||(this.errors=o.errors),n}compile(e,r){let o=this._addSchema(e,r);return o.validate||this._compileSchemaEnv(o)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:o}=this.opts;return n.call(this,e,r);async function n(l,d){await s.call(this,l.$schema);let p=this._addSchema(l,d);return p.validate||i.call(this,p)}async function s(l){l&&!this.getSchema(l)&&await n.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof Gc.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await s.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=o(l))}finally{delete this._loading[l]}}}addSchema(e,r,o,n=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,o,n);return this}let s;if(typeof e=="object"){let{schemaId:i}=this.opts;if(s=e[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,hr.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(e,o,r,n,!0),this}addMetaSchema(e,r,o=this.opts.validateSchema){return this.addSchema(e,r,!0,o),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let o;if(o=e.$schema,o!==void 0&&typeof o!="string")throw new Error("$schema must be a string");if(o=o||this.opts.defaultMeta||this.defaultMeta(),!o)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(o,e);if(!n&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return n}getSchema(e){let r;for(;typeof(r=Kc.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:o}=this.opts,n=new mr.SchemaEnv({schema:{},schemaId:o});if(r=mr.resolveSchema.call(this,n,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=Kc.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let o=e[this.opts.schemaId];return o&&(o=(0,hr.normalizeId)(o),delete this.schemas[o],delete this.refs[o]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let o;if(typeof e=="string")o=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=o);else if(typeof e=="object"&&r===void 0){if(r=e,o=r.keyword,Array.isArray(o)&&!o.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(Jh.call(this,o,r),!r)return(0,ks.eachItem)(o,s=>xs.call(this,s)),this;Xh.call(this,r);let n={...r,type:(0,vo.getJSONTypes)(r.type),schemaType:(0,vo.getJSONTypes)(r.schemaType)};return(0,ks.eachItem)(o,n.type.length===0?s=>xs.call(this,s,n):s=>n.type.forEach(i=>xs.call(this,s,n,i))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let o of r.rules){let n=o.rules.findIndex(s=>s.keyword===e);n>=0&&o.rules.splice(n,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:o="data"}={}){return!e||e.length===0?"No errors":e.map(n=>`${o}${n.instancePath} ${n.message}`).reduce((n,s)=>n+r+s)}$dataMetaSchema(e,r){let o=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let n of r){let s=n.split("/").slice(1),i=e;for(let a of s)i=i[a];for(let a in o){let c=o[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=Jc(l))}}return e}_removeAllSchemas(e,r){for(let o in e){let n=e[o];(!r||r.test(o))&&(typeof n=="string"?delete e[o]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[o]))}}_addSchema(e,r,o,n=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof e=="object")i=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;o=(0,hr.normalizeId)(i||o);let u=hr.getSchemaRefs.call(this,e,o);return c=new mr.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:o,localRefs:u}),this._cache.set(c.schema,c),s&&!o.startsWith("#")&&(o&&this._checkUnique(o),this.refs[o]=c),n&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):mr.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{mr.compileSchema.call(this,e)}finally{this.opts=r}}};gr.ValidationError=Mh.default;gr.MissingRefError=Gc.default;Y.default=gr;function Vc(t,e,r,o="error"){for(let n in t){let s=n;s in e&&this.logger[o](`${r}: option ${n}. ${t[s]}`)}}function Kc(t){return t=(0,hr.normalizeId)(t),this.schemas[t]||this.refs[t]}function Fh(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function Uh(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function Hh(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function Vh(){let t={...this.opts};for(let e of Oh)delete t[e];return t}var Kh={log(){},warn(){},error(){}};function Gh(t){if(t===!1)return Kh;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var Bh=/^[a-z_$][a-z0-9_$:-]*$/i;function Jh(t,e){let{RULES:r}=this;if((0,ks.eachItem)(t,o=>{if(r.keywords[o])throw new Error(`Keyword ${o} is already defined`);if(!Bh.test(o))throw new Error(`Keyword ${o} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function xs(t,e,r){var o;let n=e?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=n?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,vo.getJSONTypes)(e.type),schemaType:(0,vo.getJSONTypes)(e.schemaType)}};e.before?Wh.call(this,i,a,e.before):i.rules.push(a),s.all[t]=a,(o=e.implements)===null||o===void 0||o.forEach(c=>this.addKeyword(c))}function Wh(t,e,r){let o=t.rules.findIndex(n=>n.keyword===r);o>=0?t.rules.splice(o,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function Xh(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=Jc(e)),t.validateSchema=this.compile(e,!0))}var Qh={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Jc(t){return{anyOf:[t,Qh]}}});var Xc=$(Es=>{"use strict";Object.defineProperty(Es,"__esModule",{value:!0});var Yh={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Es.default=Yh});var tl=$(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.callRef=ct.getValidate=void 0;var eg=dr(),Qc=_e(),fe=R(),Pt=Ne(),Yc=mo(),wo=j(),tg={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:o}=t,{baseId:n,schemaEnv:s,validateName:i,opts:a,self:c}=o,{root:u}=s;if((r==="#"||r==="#/")&&n===u.baseId)return d();let l=Yc.resolveRef.call(c,u,n,r);if(l===void 0)throw new eg.default(o.opts.uriResolver,n,r);if(l instanceof Yc.SchemaEnv)return p(l);return m(l);function d(){if(s===u)return bo(t,i,s,s.$async);let h=e.scopeValue("root",{ref:u});return bo(t,(0,fe._)`${h}.validate`,u,u.$async)}function p(h){let g=el(t,h);bo(t,g,h,h.$async)}function m(h){let g=e.scopeValue("schema",a.code.source===!0?{ref:h,code:(0,fe.stringify)(h)}:{ref:h}),y=e.name("valid"),_=t.subschema({schema:h,dataTypes:[],schemaPath:fe.nil,topSchemaRef:g,errSchemaPath:r},y);t.mergeEvaluated(_),t.ok(y)}}};function el(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,fe._)`${r.scopeValue("wrapper",{ref:e})}.validate`}ct.getValidate=el;function bo(t,e,r,o){let{gen:n,it:s}=t,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?Pt.default.this:fe.nil;o?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let h=n.let("valid");n.try(()=>{n.code((0,fe._)`await ${(0,Qc.callValidateCode)(t,e,u)}`),m(e),i||n.assign(h,!0)},g=>{n.if((0,fe._)`!(${g} instanceof ${s.ValidationError})`,()=>n.throw(g)),p(g),i||n.assign(h,!1)}),t.ok(h)}function d(){t.result((0,Qc.callValidateCode)(t,e,u),()=>m(e),()=>p(e))}function p(h){let g=(0,fe._)`${h}.errors`;n.assign(Pt.default.vErrors,(0,fe._)`${Pt.default.vErrors} === null ? ${g} : ${Pt.default.vErrors}.concat(${g})`),n.assign(Pt.default.errors,(0,fe._)`${Pt.default.vErrors}.length`)}function m(h){var g;if(!s.opts.unevaluated)return;let y=(g=r?.validate)===null||g===void 0?void 0:g.evaluated;if(s.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(s.props=wo.mergeEvaluated.props(n,y.props,s.props));else{let _=n.var("props",(0,fe._)`${h}.evaluated.props`);s.props=wo.mergeEvaluated.props(n,_,s.props,fe.Name)}if(s.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(s.items=wo.mergeEvaluated.items(n,y.items,s.items));else{let _=n.var("items",(0,fe._)`${h}.evaluated.items`);s.items=wo.mergeEvaluated.items(n,_,s.items,fe.Name)}}}ct.callRef=bo;ct.default=tg});var rl=$(zs=>{"use strict";Object.defineProperty(zs,"__esModule",{value:!0});var rg=Xc(),og=tl(),ng=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",rg.default,og.default];zs.default=ng});var ol=$(Ps=>{"use strict";Object.defineProperty(Ps,"__esModule",{value:!0});var So=R(),Je=So.operators,xo={maximum:{okStr:"<=",ok:Je.LTE,fail:Je.GT},minimum:{okStr:">=",ok:Je.GTE,fail:Je.LT},exclusiveMaximum:{okStr:"<",ok:Je.LT,fail:Je.GTE},exclusiveMinimum:{okStr:">",ok:Je.GT,fail:Je.LTE}},sg={message:({keyword:t,schemaCode:e})=>(0,So.str)`must be ${xo[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,So._)`{comparison: ${xo[t].okStr}, limit: ${e}}`},ig={keyword:Object.keys(xo),type:"number",schemaType:"number",$data:!0,error:sg,code(t){let{keyword:e,data:r,schemaCode:o}=t;t.fail$data((0,So._)`${r} ${xo[e].fail} ${o} || isNaN(${r})`)}};Ps.default=ig});var nl=$(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});var yr=R(),ag={message:({schemaCode:t})=>(0,yr.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,yr._)`{multipleOf: ${t}}`},cg={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:ag,code(t){let{gen:e,data:r,schemaCode:o,it:n}=t,s=n.opts.multipleOfPrecision,i=e.let("res"),a=s?(0,yr._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,yr._)`${i} !== parseInt(${i})`;t.fail$data((0,yr._)`(${o} === 0 || (${i} = ${r}/${o}, ${a}))`)}};Ts.default=cg});var il=$(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});function sl(t){let e=t.length,r=0,o=0,n;for(;o<e;)r++,n=t.charCodeAt(o++),n>=55296&&n<=56319&&o<e&&(n=t.charCodeAt(o),(n&64512)===56320&&o++);return r}Rs.default=sl;sl.code='require("ajv/dist/runtime/ucs2length").default'});var al=$(Is=>{"use strict";Object.defineProperty(Is,"__esModule",{value:!0});var lt=R(),lg=j(),ug=il(),dg={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,lt.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,lt._)`{limit: ${t}}`},fg={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:dg,code(t){let{keyword:e,data:r,schemaCode:o,it:n}=t,s=e==="maxLength"?lt.operators.GT:lt.operators.LT,i=n.opts.unicode===!1?(0,lt._)`${r}.length`:(0,lt._)`${(0,lg.useFunc)(t.gen,ug.default)}(${r})`;t.fail$data((0,lt._)`${i} ${s} ${o}`)}};Is.default=fg});var cl=$(Cs=>{"use strict";Object.defineProperty(Cs,"__esModule",{value:!0});var pg=_e(),mg=j(),Tt=R(),hg={message:({schemaCode:t})=>(0,Tt.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Tt._)`{pattern: ${t}}`},gg={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:hg,code(t){let{gen:e,data:r,$data:o,schema:n,schemaCode:s,it:i}=t,a=i.opts.unicodeRegExp?"u":"";if(o){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?(0,Tt._)`new RegExp`:(0,mg.useFunc)(e,c),l=e.let("valid");e.try(()=>e.assign(l,(0,Tt._)`${u}(${s}, ${a}).test(${r})`),()=>e.assign(l,!1)),t.fail$data((0,Tt._)`!${l}`)}else{let c=(0,pg.usePattern)(t,n);t.fail$data((0,Tt._)`!${c}.test(${r})`)}}};Cs.default=gg});var ll=$(Ms=>{"use strict";Object.defineProperty(Ms,"__esModule",{value:!0});var _r=R(),yg={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,_r.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,_r._)`{limit: ${t}}`},_g={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:yg,code(t){let{keyword:e,data:r,schemaCode:o}=t,n=e==="maxProperties"?_r.operators.GT:_r.operators.LT;t.fail$data((0,_r._)`Object.keys(${r}).length ${n} ${o}`)}};Ms.default=_g});var ul=$(qs=>{"use strict";Object.defineProperty(qs,"__esModule",{value:!0});var $r=_e(),vr=R(),$g=j(),vg={message:({params:{missingProperty:t}})=>(0,vr.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,vr._)`{missingProperty: ${t}}`},wg={keyword:"required",type:"object",schemaType:"array",$data:!0,error:vg,code(t){let{gen:e,schema:r,schemaCode:o,data:n,$data:s,it:i}=t,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let m=t.parentSchema.properties,{definedProperties:h}=t.it;for(let g of r)if(m?.[g]===void 0&&!h.has(g)){let y=i.schemaEnv.baseId+i.errSchemaPath,_=`required property "${g}" is not defined at "${y}" (strictRequired)`;(0,$g.checkStrictMode)(i,_,i.opts.strictRequired)}}function u(){if(c||s)t.block$data(vr.nil,d);else for(let m of r)(0,$r.checkReportMissingProp)(t,m)}function l(){let m=e.let("missing");if(c||s){let h=e.let("valid",!0);t.block$data(h,()=>p(m,h)),t.ok(h)}else e.if((0,$r.checkMissingProp)(t,r,m)),(0,$r.reportMissingProp)(t,m),e.else()}function d(){e.forOf("prop",o,m=>{t.setParams({missingProperty:m}),e.if((0,$r.noPropertyInData)(e,n,m,a.ownProperties),()=>t.error())})}function p(m,h){t.setParams({missingProperty:m}),e.forOf(m,o,()=>{e.assign(h,(0,$r.propertyInData)(e,n,m,a.ownProperties)),e.if((0,vr.not)(h),()=>{t.error(),e.break()})},vr.nil)}}};qs.default=wg});var dl=$(js=>{"use strict";Object.defineProperty(js,"__esModule",{value:!0});var wr=R(),bg={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,wr.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,wr._)`{limit: ${t}}`},Sg={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:bg,code(t){let{keyword:e,data:r,schemaCode:o}=t,n=e==="maxItems"?wr.operators.GT:wr.operators.LT;t.fail$data((0,wr._)`${r}.length ${n} ${o}`)}};js.default=Sg});var ko=$(Ns=>{"use strict";Object.defineProperty(Ns,"__esModule",{value:!0});var fl=Yn();fl.code='require("ajv/dist/runtime/equal").default';Ns.default=fl});var pl=$(As=>{"use strict";Object.defineProperty(As,"__esModule",{value:!0});var Os=ir(),ee=R(),xg=j(),kg=ko(),Eg={message:({params:{i:t,j:e}})=>(0,ee.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,ee._)`{i: ${t}, j: ${e}}`},zg={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:Eg,code(t){let{gen:e,data:r,$data:o,schema:n,parentSchema:s,schemaCode:i,it:a}=t;if(!o&&!n)return;let c=e.let("valid"),u=s.items?(0,Os.getSchemaTypes)(s.items):[];t.block$data(c,l,(0,ee._)`${i} === false`),t.ok(c);function l(){let h=e.let("i",(0,ee._)`${r}.length`),g=e.let("j");t.setParams({i:h,j:g}),e.assign(c,!0),e.if((0,ee._)`${h} > 1`,()=>(d()?p:m)(h,g))}function d(){return u.length>0&&!u.some(h=>h==="object"||h==="array")}function p(h,g){let y=e.name("item"),_=(0,Os.checkDataTypes)(u,y,a.opts.strictNumbers,Os.DataType.Wrong),w=e.const("indices",(0,ee._)`{}`);e.for((0,ee._)`;${h}--;`,()=>{e.let(y,(0,ee._)`${r}[${h}]`),e.if(_,(0,ee._)`continue`),u.length>1&&e.if((0,ee._)`typeof ${y} == "string"`,(0,ee._)`${y} += "_"`),e.if((0,ee._)`typeof ${w}[${y}] == "number"`,()=>{e.assign(g,(0,ee._)`${w}[${y}]`),t.error(),e.assign(c,!1).break()}).code((0,ee._)`${w}[${y}] = ${h}`)})}function m(h,g){let y=(0,xg.useFunc)(e,kg.default),_=e.name("outer");e.label(_).for((0,ee._)`;${h}--;`,()=>e.for((0,ee._)`${g} = ${h}; ${g}--;`,()=>e.if((0,ee._)`${y}(${r}[${h}], ${r}[${g}])`,()=>{t.error(),e.assign(c,!1).break(_)})))}}};As.default=zg});var ml=$(Ls=>{"use strict";Object.defineProperty(Ls,"__esModule",{value:!0});var Ds=R(),Pg=j(),Tg=ko(),Rg={message:"must be equal to constant",params:({schemaCode:t})=>(0,Ds._)`{allowedValue: ${t}}`},Ig={keyword:"const",$data:!0,error:Rg,code(t){let{gen:e,data:r,$data:o,schemaCode:n,schema:s}=t;o||s&&typeof s=="object"?t.fail$data((0,Ds._)`!${(0,Pg.useFunc)(e,Tg.default)}(${r}, ${n})`):t.fail((0,Ds._)`${s} !== ${r}`)}};Ls.default=Ig});var hl=$(Zs=>{"use strict";Object.defineProperty(Zs,"__esModule",{value:!0});var br=R(),Cg=j(),Mg=ko(),qg={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,br._)`{allowedValues: ${t}}`},jg={keyword:"enum",schemaType:"array",$data:!0,error:qg,code(t){let{gen:e,data:r,$data:o,schema:n,schemaCode:s,it:i}=t;if(!o&&n.length===0)throw new Error("enum must have non-empty array");let a=n.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,Cg.useFunc)(e,Mg.default)),l;if(a||o)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let m=e.const("vSchema",s);l=(0,br.or)(...n.map((h,g)=>p(m,g)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",s,m=>e.if((0,br._)`${u()}(${r}, ${m})`,()=>e.assign(l,!0).break()))}function p(m,h){let g=n[h];return typeof g=="object"&&g!==null?(0,br._)`${u()}(${r}, ${m}[${h}])`:(0,br._)`${r} === ${g}`}}};Zs.default=jg});var gl=$(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});var Ng=ol(),Og=nl(),Ag=al(),Dg=cl(),Lg=ll(),Zg=ul(),Fg=dl(),Ug=pl(),Hg=ml(),Vg=hl(),Kg=[Ng.default,Og.default,Ag.default,Dg.default,Lg.default,Zg.default,Fg.default,Ug.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Hg.default,Vg.default];Fs.default=Kg});var Hs=$(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.validateAdditionalItems=void 0;var ut=R(),Us=j(),Gg={message:({params:{len:t}})=>(0,ut.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,ut._)`{limit: ${t}}`},Bg={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Gg,code(t){let{parentSchema:e,it:r}=t,{items:o}=e;if(!Array.isArray(o)){(0,Us.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}yl(t,o)}};function yl(t,e){let{gen:r,schema:o,data:n,keyword:s,it:i}=t;i.items=!0;let a=r.const("len",(0,ut._)`${n}.length`);if(o===!1)t.setParams({len:e.length}),t.pass((0,ut._)`${a} <= ${e.length}`);else if(typeof o=="object"&&!(0,Us.alwaysValidSchema)(i,o)){let u=r.var("valid",(0,ut._)`${a} <= ${e.length}`);r.if((0,ut.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:s,dataProp:l,dataPropType:Us.Type.Num},u),i.allErrors||r.if((0,ut.not)(u),()=>r.break())})}}Sr.validateAdditionalItems=yl;Sr.default=Bg});var Vs=$(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0});xr.validateTuple=void 0;var _l=R(),Eo=j(),Jg=_e(),Wg={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return $l(t,"additionalItems",e);r.items=!0,!(0,Eo.alwaysValidSchema)(r,e)&&t.ok((0,Jg.validateArray)(t))}};function $l(t,e,r=t.schema){let{gen:o,parentSchema:n,data:s,keyword:i,it:a}=t;l(n),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=Eo.mergeEvaluated.items(o,r.length,a.items));let c=o.name("valid"),u=o.const("len",(0,_l._)`${s}.length`);r.forEach((d,p)=>{(0,Eo.alwaysValidSchema)(a,d)||(o.if((0,_l._)`${u} > ${p}`,()=>t.subschema({keyword:i,schemaProp:p,dataProp:p},c)),t.ok(c))});function l(d){let{opts:p,errSchemaPath:m}=a,h=r.length,g=h===d.minItems&&(h===d.maxItems||d[e]===!1);if(p.strictTuples&&!g){let y=`"${i}" is ${h}-tuple, but minItems or maxItems/${e} are not specified or different at path "${m}"`;(0,Eo.checkStrictMode)(a,y,p.strictTuples)}}}xr.validateTuple=$l;xr.default=Wg});var vl=$(Ks=>{"use strict";Object.defineProperty(Ks,"__esModule",{value:!0});var Xg=Vs(),Qg={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,Xg.validateTuple)(t,"items")};Ks.default=Qg});var bl=$(Gs=>{"use strict";Object.defineProperty(Gs,"__esModule",{value:!0});var wl=R(),Yg=j(),ey=_e(),ty=Hs(),ry={message:({params:{len:t}})=>(0,wl.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,wl._)`{limit: ${t}}`},oy={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:ry,code(t){let{schema:e,parentSchema:r,it:o}=t,{prefixItems:n}=r;o.items=!0,!(0,Yg.alwaysValidSchema)(o,e)&&(n?(0,ty.validateAdditionalItems)(t,n):t.ok((0,ey.validateArray)(t)))}};Gs.default=oy});var Sl=$(Bs=>{"use strict";Object.defineProperty(Bs,"__esModule",{value:!0});var ve=R(),zo=j(),ny={message:({params:{min:t,max:e}})=>e===void 0?(0,ve.str)`must contain at least ${t} valid item(s)`:(0,ve.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,ve._)`{minContains: ${t}}`:(0,ve._)`{minContains: ${t}, maxContains: ${e}}`},sy={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:ny,code(t){let{gen:e,schema:r,parentSchema:o,data:n,it:s}=t,i,a,{minContains:c,maxContains:u}=o;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=e.const("len",(0,ve._)`${n}.length`);if(t.setParams({min:i,max:a}),a===void 0&&i===0){(0,zo.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,zo.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,zo.alwaysValidSchema)(s,r)){let g=(0,ve._)`${l} >= ${i}`;a!==void 0&&(g=(0,ve._)`${g} && ${l} <= ${a}`),t.pass(g);return}s.items=!0;let d=e.name("valid");a===void 0&&i===1?m(d,()=>e.if(d,()=>e.break())):i===0?(e.let(d,!0),a!==void 0&&e.if((0,ve._)`${n}.length > 0`,p)):(e.let(d,!1),p()),t.result(d,()=>t.reset());function p(){let g=e.name("_valid"),y=e.let("count",0);m(g,()=>e.if(g,()=>h(y)))}function m(g,y){e.forRange("i",0,l,_=>{t.subschema({keyword:"contains",dataProp:_,dataPropType:zo.Type.Num,compositeRule:!0},g),y()})}function h(g){e.code((0,ve._)`${g}++`),a===void 0?e.if((0,ve._)`${g} >= ${i}`,()=>e.assign(d,!0).break()):(e.if((0,ve._)`${g} > ${a}`,()=>e.assign(d,!1).break()),i===1?e.assign(d,!0):e.if((0,ve._)`${g} >= ${i}`,()=>e.assign(d,!0)))}}};Bs.default=sy});var El=$(Re=>{"use strict";Object.defineProperty(Re,"__esModule",{value:!0});Re.validateSchemaDeps=Re.validatePropertyDeps=Re.error=void 0;var Js=R(),iy=j(),kr=_e();Re.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let o=e===1?"property":"properties";return(0,Js.str)`must have ${o} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:o}})=>(0,Js._)`{property: ${t},
|
|
8
8
|
missingProperty: ${o},
|
|
9
9
|
depsCount: ${e},
|
|
10
|
-
deps: ${r}}`};var Og={keyword:"dependencies",type:"object",schemaType:"object",error:Te.error,code(t){let[e,r]=Ag(t);dl(t,e),fl(t,r)}};function Ag({schema:t}){let e={},r={};for(let o in t){if(o==="__proto__")continue;let n=Array.isArray(t[o])?e:r;n[o]=t[o]}return[e,r]}function dl(t,e=t.schema){let{gen:r,data:o,it:n}=t;if(Object.keys(e).length===0)return;let s=r.let("missing");for(let i in e){let a=e[i];if(a.length===0)continue;let c=(0,wr.propertyInData)(r,o,i,n.opts.ownProperties);t.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(c,()=>{for(let u of a)(0,wr.checkReportMissingProp)(t,u)}):(r.if((0,Us._)`${c} && (${(0,wr.checkMissingProp)(t,a,s)})`),(0,wr.reportMissingProp)(t,s),r.else())}}Te.validatePropertyDeps=dl;function fl(t,e=t.schema){let{gen:r,data:o,keyword:n,it:s}=t,i=r.name("valid");for(let a in e)(0,jg.alwaysValidSchema)(s,e[a])||(r.if((0,wr.propertyInData)(r,o,a,s.opts.ownProperties),()=>{let c=t.subschema({keyword:n,schemaProp:a},i);t.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),t.ok(i))}Te.validateSchemaDeps=fl;Te.default=Og});var hl=$(Hs=>{"use strict";Object.defineProperty(Hs,"__esModule",{value:!0});var ml=T(),Dg=N(),Zg={message:"property name must be valid",params:({params:t})=>(0,ml._)`{propertyName: ${t.propertyName}}`},Lg={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Zg,code(t){let{gen:e,schema:r,data:o,it:n}=t;if((0,Dg.alwaysValidSchema)(n,r))return;let s=e.name("valid");e.forIn("key",o,i=>{t.setParams({propertyName:i}),t.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),e.if((0,ml.not)(s),()=>{t.error(!0),n.allErrors||e.break()})}),t.ok(s)}};Hs.default=Lg});var Ks=$(Vs=>{"use strict";Object.defineProperty(Vs,"__esModule",{value:!0});var So=_e(),xe=T(),Fg=je(),xo=N(),Ug={message:"must NOT have additional properties",params:({params:t})=>(0,xe._)`{additionalProperty: ${t.additionalProperty}}`},Hg={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Ug,code(t){let{gen:e,schema:r,parentSchema:o,data:n,errsCount:s,it:i}=t;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,xo.alwaysValidSchema)(i,r))return;let u=(0,So.allSchemaProperties)(o.properties),l=(0,So.allSchemaProperties)(o.patternProperties);d(),t.ok((0,xe._)`${s} === ${Fg.default.errors}`);function d(){e.forIn("key",n,y=>{!u.length&&!l.length?h(y):e.if(p(y),()=>h(y))})}function p(y){let _;if(u.length>8){let w=(0,xo.schemaRefOrVal)(i,o.properties,"properties");_=(0,So.isOwnProperty)(e,w,y)}else u.length?_=(0,xe.or)(...u.map(w=>(0,xe._)`${y} === ${w}`)):_=xe.nil;return l.length&&(_=(0,xe.or)(_,...l.map(w=>(0,xe._)`${(0,So.usePattern)(t,w)}.test(${y})`))),(0,xe.not)(_)}function m(y){e.code((0,xe._)`delete ${n}[${y}]`)}function h(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){m(y);return}if(r===!1){t.setParams({additionalProperty:y}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,xo.alwaysValidSchema)(i,r)){let _=e.name("valid");c.removeAdditional==="failing"?(g(y,_,!1),e.if((0,xe.not)(_),()=>{t.reset(),m(y)})):(g(y,_),a||e.if((0,xe.not)(_),()=>e.break()))}}function g(y,_,w){let E={keyword:"additionalProperties",dataProp:y,dataPropType:xo.Type.Str};w===!1&&Object.assign(E,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(E,_)}}};Vs.default=Hg});var _l=$(Bs=>{"use strict";Object.defineProperty(Bs,"__esModule",{value:!0});var Vg=ir(),gl=_e(),Gs=N(),yl=Ks(),Kg={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:o,data:n,it:s}=t;s.opts.removeAdditional==="all"&&o.additionalProperties===void 0&&yl.default.code(new Vg.KeywordCxt(s,yl.default,"additionalProperties"));let i=(0,gl.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=Gs.mergeEvaluated.props(e,(0,Gs.toHash)(i),s.props));let a=i.filter(d=>!(0,Gs.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)u(d)?l(d):(e.if((0,gl.propertyInData)(e,n,d,s.opts.ownProperties)),l(d),s.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};Bs.default=Kg});var bl=$(Js=>{"use strict";Object.defineProperty(Js,"__esModule",{value:!0});var $l=_e(),Eo=T(),vl=N(),wl=N(),Gg={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:o,parentSchema:n,it:s}=t,{opts:i}=s,a=(0,$l.allSchemaProperties)(r),c=a.filter(g=>(0,vl.alwaysValidSchema)(s,r[g]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&n.properties,l=e.name("valid");s.props!==!0&&!(s.props instanceof Eo.Name)&&(s.props=(0,wl.evaluatedPropsToName)(e,s.props));let{props:d}=s;p();function p(){for(let g of a)u&&m(g),s.allErrors?h(g):(e.var(l,!0),h(g),e.if(l))}function m(g){for(let y in u)new RegExp(g).test(y)&&(0,vl.checkStrictMode)(s,`property ${y} matches pattern ${g} (use allowMatchingProperties)`)}function h(g){e.forIn("key",o,y=>{e.if((0,Eo._)`${(0,$l.usePattern)(t,g)}.test(${y})`,()=>{let _=c.includes(g);_||t.subschema({keyword:"patternProperties",schemaProp:g,dataProp:y,dataPropType:wl.Type.Str},l),s.opts.unevaluated&&d!==!0?e.assign((0,Eo._)`${d}[${y}]`,!0):!_&&!s.allErrors&&e.if((0,Eo.not)(l),()=>e.break())})})}}};Js.default=Gg});var Sl=$(Ws=>{"use strict";Object.defineProperty(Ws,"__esModule",{value:!0});var Bg=N(),Jg={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:o}=t;if((0,Bg.alwaysValidSchema)(o,r)){t.fail();return}let n=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),t.failResult(n,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};Ws.default=Jg});var xl=$(Xs=>{"use strict";Object.defineProperty(Xs,"__esModule",{value:!0});var Wg=_e(),Xg={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Wg.validateUnion,error:{message:"must match a schema in anyOf"}};Xs.default=Xg});var El=$(Qs=>{"use strict";Object.defineProperty(Qs,"__esModule",{value:!0});var zo=T(),Qg=N(),Yg={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,zo._)`{passingSchemas: ${t.passing}}`},ey={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Yg,code(t){let{gen:e,schema:r,parentSchema:o,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let s=r,i=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(i,()=>t.reset(),()=>t.error(!0));function u(){s.forEach((l,d)=>{let p;(0,Qg.alwaysValidSchema)(n,l)?e.var(c,!0):p=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,zo._)`${c} && ${i}`).assign(i,!1).assign(a,(0,zo._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(i,!0),e.assign(a,d),p&&t.mergeEvaluated(p,zo.Name)})})}}};Qs.default=ey});var zl=$(Ys=>{"use strict";Object.defineProperty(Ys,"__esModule",{value:!0});var ty=N(),ry={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=e.name("valid");r.forEach((s,i)=>{if((0,ty.alwaysValidSchema)(o,s))return;let a=t.subschema({keyword:"allOf",schemaProp:i},n);t.ok(n),t.mergeEvaluated(a)})}};Ys.default=ry});var Rl=$(ei=>{"use strict";Object.defineProperty(ei,"__esModule",{value:!0});var ko=T(),Pl=N(),oy={message:({params:t})=>(0,ko.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,ko._)`{failingKeyword: ${t.ifClause}}`},ny={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:oy,code(t){let{gen:e,parentSchema:r,it:o}=t;r.then===void 0&&r.else===void 0&&(0,Pl.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let n=kl(o,"then"),s=kl(o,"else");if(!n&&!s)return;let i=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),n&&s){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(a,u("then",l),u("else",l))}else n?e.if(a,u("then")):e.if((0,ko.not)(a),u("else"));t.pass(i,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(l)}function u(l,d){return()=>{let p=t.subschema({keyword:l},a);e.assign(i,a),t.mergeValidEvaluated(p,i),d?e.assign(d,(0,ko._)`${l}`):t.setParams({ifClause:l})}}}};function kl(t,e){let r=t.schema[e];return r!==void 0&&!(0,Pl.alwaysValidSchema)(t,r)}ei.default=ny});var Tl=$(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});var sy=N(),iy={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,sy.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};ti.default=iy});var Il=$(ri=>{"use strict";Object.defineProperty(ri,"__esModule",{value:!0});var ay=As(),cy=al(),ly=Ds(),uy=ll(),dy=ul(),fy=pl(),py=hl(),my=Ks(),hy=_l(),gy=bl(),yy=Sl(),_y=xl(),$y=El(),vy=zl(),wy=Rl(),by=Tl();function Sy(t=!1){let e=[yy.default,_y.default,$y.default,vy.default,wy.default,by.default,py.default,my.default,fy.default,hy.default,gy.default];return t?e.push(cy.default,uy.default):e.push(ay.default,ly.default),e.push(dy.default),e}ri.default=Sy});var Cl=$(oi=>{"use strict";Object.defineProperty(oi,"__esModule",{value:!0});var B=T(),xy={message:({schemaCode:t})=>(0,B.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,B._)`{format: ${t}}`},Ey={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:xy,code(t,e){let{gen:r,data:o,$data:n,schema:s,schemaCode:i,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;n?p():m();function p(){let h=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),g=r.const("fDef",(0,B._)`${h}[${i}]`),y=r.let("fType"),_=r.let("format");r.if((0,B._)`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(y,(0,B._)`${g}.type || "string"`).assign(_,(0,B._)`${g}.validate`),()=>r.assign(y,(0,B._)`"string"`).assign(_,g)),t.fail$data((0,B.or)(w(),E()));function w(){return c.strictSchema===!1?B.nil:(0,B._)`${i} && !${_}`}function E(){let O=l.$async?(0,B._)`(${g}.async ? await ${_}(${o}) : ${_}(${o}))`:(0,B._)`${_}(${o})`,P=(0,B._)`(typeof ${_} == "function" ? ${O} : ${_}.test(${o}))`;return(0,B._)`${_} && ${_} !== true && ${y} === ${e} && !${P}`}}function m(){let h=d.formats[s];if(!h){w();return}if(h===!0)return;let[g,y,_]=E(h);g===e&&t.pass(O());function w(){if(c.strictSchema===!1){d.logger.warn(P());return}throw new Error(P());function P(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function E(P){let ze=P instanceof RegExp?(0,B.regexpCode)(P):c.code.formats?(0,B._)`${c.code.formats}${(0,B.getProperty)(s)}`:void 0,Me=r.scopeValue("formats",{key:s,ref:P,code:ze});return typeof P=="object"&&!(P instanceof RegExp)?[P.type||"string",P.validate,(0,B._)`${Me}.validate`]:["string",P,Me]}function O(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw new Error("async format in sync schema");return(0,B._)`await ${_}(${o})`}return typeof y=="function"?(0,B._)`${_}(${o})`:(0,B._)`${_}.test(${o})`}}}};oi.default=Ey});var Ml=$(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});var zy=Cl(),ky=[zy.default];ni.default=ky});var ql=$(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.contentVocabulary=Pt.metadataVocabulary=void 0;Pt.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Pt.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var jl=$(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});var Py=Uc(),Ry=ol(),Ty=Il(),Iy=Ml(),Nl=ql(),Cy=[Py.default,Ry.default,(0,Ty.default)(),Iy.default,Nl.metadataVocabulary,Nl.contentVocabulary];si.default=Cy});var Al=$(Po=>{"use strict";Object.defineProperty(Po,"__esModule",{value:!0});Po.DiscrError=void 0;var Ol;(function(t){t.Tag="tag",t.Mapping="mapping"})(Ol||(Po.DiscrError=Ol={}))});var Zl=$(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});var Rt=T(),ii=Al(),Dl=co(),My=ar(),qy=N(),Ny={message:({params:{discrError:t,tagName:e}})=>t===ii.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,Rt._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},jy={keyword:"discriminator",type:"object",schemaType:"object",error:Ny,code(t){let{gen:e,data:r,schema:o,parentSchema:n,it:s}=t,{oneOf:i}=n;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=o.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(o.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,Rt._)`${r}${(0,Rt.getProperty)(a)}`);e.if((0,Rt._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:ii.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){let m=p();e.if(!1);for(let h in m)e.elseIf((0,Rt._)`${u} === ${h}`),e.assign(c,d(m[h]));e.else(),t.error(!1,{discrError:ii.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function d(m){let h=e.name("valid"),g=t.subschema({keyword:"oneOf",schemaProp:m},h);return t.mergeEvaluated(g,Rt.Name),h}function p(){var m;let h={},g=_(n),y=!0;for(let O=0;O<i.length;O++){let P=i[O];if(P?.$ref&&!(0,qy.schemaHasRulesButRef)(P,s.self.RULES)){let Me=P.$ref;if(P=Dl.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,Me),P instanceof Dl.SchemaEnv&&(P=P.schema),P===void 0)throw new My.default(s.opts.uriResolver,s.baseId,Me)}let ze=(m=P?.properties)===null||m===void 0?void 0:m[a];if(typeof ze!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(g||_(P)),w(ze,O)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return h;function _({required:O}){return Array.isArray(O)&&O.includes(a)}function w(O,P){if(O.const)E(O.const,P);else if(O.enum)for(let ze of O.enum)E(ze,P);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function E(O,P){if(typeof O!="string"||O in h)throw new Error(`discriminator: "${a}" values must be unique strings`);h[O]=P}}}};ai.default=jy});var Ll=$((Uw,Oy)=>{Oy.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}});var li=$((H,ci)=>{"use strict";Object.defineProperty(H,"__esModule",{value:!0});H.MissingRefError=H.ValidationError=H.CodeGen=H.Name=H.nil=H.stringify=H.str=H._=H.KeywordCxt=H.Ajv=void 0;var Ay=Oc(),Dy=jl(),Zy=Zl(),Fl=Ll(),Ly=["/properties"],Ro="http://json-schema.org/draft-07/schema",Tt=class extends Ay.default{_addVocabularies(){super._addVocabularies(),Dy.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(Zy.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(Fl,Ly):Fl;this.addMetaSchema(e,Ro,!1),this.refs["http://json-schema.org/schema"]=Ro}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Ro)?Ro:void 0)}};H.Ajv=Tt;ci.exports=H=Tt;ci.exports.Ajv=Tt;Object.defineProperty(H,"__esModule",{value:!0});H.default=Tt;var Fy=ir();Object.defineProperty(H,"KeywordCxt",{enumerable:!0,get:function(){return Fy.KeywordCxt}});var It=T();Object.defineProperty(H,"_",{enumerable:!0,get:function(){return It._}});Object.defineProperty(H,"str",{enumerable:!0,get:function(){return It.str}});Object.defineProperty(H,"stringify",{enumerable:!0,get:function(){return It.stringify}});Object.defineProperty(H,"nil",{enumerable:!0,get:function(){return It.nil}});Object.defineProperty(H,"Name",{enumerable:!0,get:function(){return It.Name}});Object.defineProperty(H,"CodeGen",{enumerable:!0,get:function(){return It.CodeGen}});var Uy=io();Object.defineProperty(H,"ValidationError",{enumerable:!0,get:function(){return Uy.default}});var Hy=ar();Object.defineProperty(H,"MissingRefError",{enumerable:!0,get:function(){return Hy.default}})});var Wl=$(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.formatNames=Ce.fastFormats=Ce.fullFormats=void 0;function Ie(t,e){return{validate:t,compare:e}}Ce.fullFormats={date:Ie(Kl,pi),time:Ie(di(!0),mi),"date-time":Ie(Ul(!0),Bl),"iso-time":Ie(di(),Gl),"iso-date-time":Ie(Ul(),Jl),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:Wy,"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:o_,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:Xy,int32:{type:"number",validate:e_},int64:{type:"number",validate:t_},float:{type:"number",validate:Vl},double:{type:"number",validate:Vl},password:!0,binary:!0};Ce.fastFormats={...Ce.fullFormats,date:Ie(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,pi),time:Ie(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,mi),"date-time":Ie(/^\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,Bl),"iso-time":Ie(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Gl),"iso-date-time":Ie(/^\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,Jl),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};Ce.formatNames=Object.keys(Ce.fullFormats);function Vy(t){return t%4===0&&(t%100!==0||t%400===0)}var Ky=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Gy=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Kl(t){let e=Ky.exec(t);if(!e)return!1;let r=+e[1],o=+e[2],n=+e[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&Vy(r)?29:Gy[o])}function pi(t,e){if(t&&e)return t>e?1:t<e?-1:0}var ui=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function di(t){return function(r){let o=ui.exec(r);if(!o)return!1;let n=+o[1],s=+o[2],i=+o[3],a=o[4],c=o[5]==="-"?-1:1,u=+(o[6]||0),l=+(o[7]||0);if(u>23||l>59||t&&!a)return!1;if(n<=23&&s<=59&&i<60)return!0;let d=s-l*c,p=n-u*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&i<61}}function mi(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),o=new Date("2020-01-01T"+e).valueOf();if(r&&o)return r-o}function Gl(t,e){if(!(t&&e))return;let r=ui.exec(t),o=ui.exec(e);if(r&&o)return t=r[1]+r[2]+r[3],e=o[1]+o[2]+o[3],t>e?1:t<e?-1:0}var fi=/t|\s/i;function Ul(t){let e=di(t);return function(o){let n=o.split(fi);return n.length===2&&Kl(n[0])&&e(n[1])}}function Bl(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),o=new Date(e).valueOf();if(r&&o)return r-o}function Jl(t,e){if(!(t&&e))return;let[r,o]=t.split(fi),[n,s]=e.split(fi),i=pi(r,n);if(i!==void 0)return i||mi(o,s)}var By=/\/|:/,Jy=/^(?:[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 Wy(t){return By.test(t)&&Jy.test(t)}var Hl=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function Xy(t){return Hl.lastIndex=0,Hl.test(t)}var Qy=-(2**31),Yy=2**31-1;function e_(t){return Number.isInteger(t)&&t<=Yy&&t>=Qy}function t_(t){return Number.isInteger(t)}function Vl(){return!0}var r_=/[^\\]\\Z/;function o_(t){if(r_.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var Xl=$(Ct=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.formatLimitDefinition=void 0;var n_=li(),Ee=T(),Je=Ee.operators,To={formatMaximum:{okStr:"<=",ok:Je.LTE,fail:Je.GT},formatMinimum:{okStr:">=",ok:Je.GTE,fail:Je.LT},formatExclusiveMaximum:{okStr:"<",ok:Je.LT,fail:Je.GTE},formatExclusiveMinimum:{okStr:">",ok:Je.GT,fail:Je.LTE}},s_={message:({keyword:t,schemaCode:e})=>(0,Ee.str)`should be ${To[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Ee._)`{comparison: ${To[t].okStr}, limit: ${e}}`};Ct.formatLimitDefinition={keyword:Object.keys(To),type:"string",schemaType:"string",$data:!0,error:s_,code(t){let{gen:e,data:r,schemaCode:o,keyword:n,it:s}=t,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new n_.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let p=e.scopeValue("formats",{ref:a.formats,code:i.code.formats}),m=e.const("fmt",(0,Ee._)`${p}[${c.schemaCode}]`);t.fail$data((0,Ee.or)((0,Ee._)`typeof ${m} != "object"`,(0,Ee._)`${m} instanceof RegExp`,(0,Ee._)`typeof ${m}.compare != "function"`,d(m)))}function l(){let p=c.schema,m=a.formats[p];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw new Error(`"${n}": format "${p}" does not define "compare" function`);let h=e.scopeValue("formats",{key:p,ref:m,code:i.code.formats?(0,Ee._)`${i.code.formats}${(0,Ee.getProperty)(p)}`:void 0});t.fail$data(d(h))}function d(p){return(0,Ee._)`${p}.compare(${r}, ${o}) ${To[n].fail} 0`}},dependencies:["format"]};var i_=t=>(t.addKeyword(Ct.formatLimitDefinition),t);Ct.default=i_});var tu=$((br,eu)=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});var Mt=Wl(),a_=Xl(),hi=T(),Ql=new hi.Name("fullFormats"),c_=new hi.Name("fastFormats"),gi=(t,e={keywords:!0})=>{if(Array.isArray(e))return Yl(t,e,Mt.fullFormats,Ql),t;let[r,o]=e.mode==="fast"?[Mt.fastFormats,c_]:[Mt.fullFormats,Ql],n=e.formats||Mt.formatNames;return Yl(t,n,r,o),e.keywords&&(0,a_.default)(t),t};gi.get=(t,e="full")=>{let o=(e==="fast"?Mt.fastFormats:Mt.fullFormats)[t];if(!o)throw new Error(`Unknown format "${t}"`);return o};function Yl(t,e,r,o){var n,s;(n=(s=t.opts.code).formats)!==null&&n!==void 0||(s.formats=(0,hi._)`require("ajv-formats/dist/formats").${o}`);for(let i of e)t.addFormat(i,r[i])}eu.exports=br=gi;Object.defineProperty(br,"__esModule",{value:!0});br.default=gi});var vu=Fo("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");Pi.init(t,e),t.def=e,t.type=e.type},{get with(){return this.check},set with(t){zi(this,"with",t)},parse(t,e){return Uo(this,t,e,{callee:this.parse})},parseAsync(t,e){return Ho(this,t,e,{callee:this.parseAsync})},safeParse(t,e){return Nt(this,t,e)},safeParseAsync(t,e){return jt(this,t,e)},check(...t){let e=this.def;return this.clone({...e,checks:[...e.checks??[],...t.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]},{parent:!0})},clone(t,e){return Lo(this,t,e)},brand(){return this},register(t,e){return t.add(this,e),this},apply(t,...e){return e.length===0?t(this):t(this,...e)}});var wu=Fo("ZodMiniObject",(t,e)=>{Ri.init(t,e),vu.init(t,e),ki(t,"shape",r=>r._zod.def.shape,!1)});function Wo(t,e){let r={type:"object",shape:t??{},...Ei(e)};return new wu(r)}function ke(t){return!!t._zod}function Xe(t){let e=Object.values(t);if(e.length===0)return Wo({});let r=e.every(ke),o=e.every(n=>!ke(n));if(r)return Wo(t);if(o)return xi(t);throw new Error("Mixed Zod versions detected in object shape.")}function Ae(t,e){return ke(t)?Nt(t,e):t.safeParse(e)}async function xr(t,e){return ke(t)?await jt(t,e):await t.safeParseAsync(e)}function De(t){if(!t)return;let e;if(ke(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function ut(t){if(t){if(typeof t=="object"){let e=t,r=t;if(!e._def&&!r._zod){let o=Object.values(t);if(o.length>0&&o.every(n=>typeof n=="object"&&n!==null&&(n._def!==void 0||n._zod!==void 0||typeof n.parse=="function")))return Xe(t)}}if(ke(t)){let r=t._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return t}else if(t.shape!==void 0)return t}}function Su(t){return t.length===0?"object root":t.reduce((e,r,o)=>o===0?String(r):typeof r=="number"?`${e}[${r}]`:`${e}.${r}`,"")}function Er(t){if(t&&typeof t=="object"){if("issues"in t&&Array.isArray(t.issues)&&t.issues.length>0)return t.issues.map(e=>e.path?.length?`${e.message} at ${Su(e.path)}`:e.message).join(`
|
|
11
|
-
`);if("message"in t&&typeof t.message=="string")return t.message;try{return JSON.stringify(t)}catch{return String(t)}}return String(t)}function ji(t){return t.description}function Oi(t){if(ke(t))return t._zod?.def?.type==="optional";let e=t;return typeof t.isOptional=="function"?t.isOptional():e._def?.typeName==="ZodOptional"}function dt(t){if(ke(t)){let s=t._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let o=t.value;if(o!==void 0)return o}var Qo="2025-11-25";var Ai=[Qo,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Ze="io.modelcontextprotocol/related-task",kr="2.0",J=Ci(t=>t!==null&&(typeof t=="object"||typeof t=="function")),Di=V([f(),D().int()]),Zi=f(),uv=se({ttl:D().optional(),pollInterval:D().optional()}),xu=v({ttl:D().optional()}),Eu=v({taskId:f()}),Yo=se({progressToken:Di.optional(),[Ze]:Eu.optional()}),me=v({_meta:Yo.optional()}),Ot=me.extend({task:xu.optional()}),Li=t=>Ot.safeParse(t).success,X=v({method:f(),params:me.loose().optional()}),he=v({_meta:Yo.optional()}),ge=v({method:f(),params:he.loose().optional()}),Q=se({_meta:Yo.optional()}),Pr=V([f(),D().int()]),Fi=v({jsonrpc:S(kr),id:Pr,...X.shape}).strict(),en=t=>Fi.safeParse(t).success,Ui=v({jsonrpc:S(kr),...ge.shape}).strict(),Hi=t=>Ui.safeParse(t).success,tn=v({jsonrpc:S(kr),id:Pr,result:Q}).strict(),At=t=>tn.safeParse(t).success;var z;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(z||(z={}));var rn=v({jsonrpc:S(kr),id:Pr.optional(),error:v({code:D().int(),message:f(),data:G().optional()})}).strict();var Vi=t=>rn.safeParse(t).success;var Ki=V([Fi,Ui,tn,rn]),dv=V([tn,rn]),Rr=Q.strict(),zu=he.extend({requestId:Pr.optional(),reason:f().optional()}),Tr=ge.extend({method:S("notifications/cancelled"),params:zu}),ku=v({src:f(),mimeType:f().optional(),sizes:q(f()).optional(),theme:pe(["light","dark"]).optional()}),Dt=v({icons:q(ku).optional()}),ft=v({name:f(),title:f().optional()}),Gi=ft.extend({...ft.shape,...Dt.shape,version:f(),websiteUrl:f().optional(),description:f().optional()}),Pu=Go(v({applyDefaults:W().optional()}),F(f(),G())),Ru=Bo(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Go(v({form:Pu.optional(),url:J.optional()}),F(f(),G()).optional())),Tu=se({list:J.optional(),cancel:J.optional(),requests:se({sampling:se({createMessage:J.optional()}).optional(),elicitation:se({create:J.optional()}).optional()}).optional()}),Iu=se({list:J.optional(),cancel:J.optional(),requests:se({tools:se({call:J.optional()}).optional()}).optional()}),Cu=v({experimental:F(f(),J).optional(),sampling:v({context:J.optional(),tools:J.optional()}).optional(),elicitation:Ru.optional(),roots:v({listChanged:W().optional()}).optional(),tasks:Tu.optional(),extensions:F(f(),J).optional()}),Mu=me.extend({protocolVersion:f(),capabilities:Cu,clientInfo:Gi}),on=X.extend({method:S("initialize"),params:Mu});var qu=v({experimental:F(f(),J).optional(),logging:J.optional(),completions:J.optional(),prompts:v({listChanged:W().optional()}).optional(),resources:v({subscribe:W().optional(),listChanged:W().optional()}).optional(),tools:v({listChanged:W().optional()}).optional(),tasks:Iu.optional(),extensions:F(f(),J).optional()}),Nu=Q.extend({protocolVersion:f(),capabilities:qu,serverInfo:Gi,instructions:f().optional()}),nn=ge.extend({method:S("notifications/initialized"),params:he.optional()});var Ir=X.extend({method:S("ping"),params:me.optional()}),ju=v({progress:D(),total:K(D()),message:K(f())}),Ou=v({...he.shape,...ju.shape,progressToken:Di}),Cr=ge.extend({method:S("notifications/progress"),params:Ou}),Au=me.extend({cursor:Zi.optional()}),Zt=X.extend({params:Au.optional()}),Lt=Q.extend({nextCursor:Zi.optional()}),Du=pe(["working","input_required","completed","failed","cancelled"]),Ft=v({taskId:f(),status:Du,ttl:V([D(),Ti()]),createdAt:f(),lastUpdatedAt:f(),pollInterval:K(D()),statusMessage:K(f())}),pt=Q.extend({task:Ft}),Zu=he.merge(Ft),Ut=ge.extend({method:S("notifications/tasks/status"),params:Zu}),Mr=X.extend({method:S("tasks/get"),params:me.extend({taskId:f()})}),qr=Q.merge(Ft),Nr=X.extend({method:S("tasks/result"),params:me.extend({taskId:f()})}),fv=Q.loose(),jr=Zt.extend({method:S("tasks/list")}),Or=Lt.extend({tasks:q(Ft)}),Ar=X.extend({method:S("tasks/cancel"),params:me.extend({taskId:f()})}),Bi=Q.merge(Ft),Ji=v({uri:f(),mimeType:K(f()),_meta:F(f(),G()).optional()}),Wi=Ji.extend({text:f()}),sn=f().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Xi=Ji.extend({blob:sn}),Ht=pe(["user","assistant"]),mt=v({audience:q(Ht).optional(),priority:D().min(0).max(1).optional(),lastModified:Mi.datetime({offset:!0}).optional()}),Qi=v({...ft.shape,...Dt.shape,uri:f(),description:K(f()),mimeType:K(f()),size:K(D()),annotations:mt.optional(),_meta:K(se({}))}),Lu=v({...ft.shape,...Dt.shape,uriTemplate:f(),description:K(f()),mimeType:K(f()),annotations:mt.optional(),_meta:K(se({}))}),Dr=Zt.extend({method:S("resources/list")}),Fu=Lt.extend({resources:q(Qi)}),Zr=Zt.extend({method:S("resources/templates/list")}),Uu=Lt.extend({resourceTemplates:q(Lu)}),an=me.extend({uri:f()}),Hu=an,Lr=X.extend({method:S("resources/read"),params:Hu}),Vu=Q.extend({contents:q(V([Wi,Xi]))}),Ku=ge.extend({method:S("notifications/resources/list_changed"),params:he.optional()}),Gu=an,Bu=X.extend({method:S("resources/subscribe"),params:Gu}),Ju=an,Wu=X.extend({method:S("resources/unsubscribe"),params:Ju}),Xu=he.extend({uri:f()}),Qu=ge.extend({method:S("notifications/resources/updated"),params:Xu}),Yu=v({name:f(),description:K(f()),required:K(W())}),ed=v({...ft.shape,...Dt.shape,description:K(f()),arguments:K(q(Yu)),_meta:K(se({}))}),Fr=Zt.extend({method:S("prompts/list")}),td=Lt.extend({prompts:q(ed)}),rd=me.extend({name:f(),arguments:F(f(),f()).optional()}),Ur=X.extend({method:S("prompts/get"),params:rd}),cn=v({type:S("text"),text:f(),annotations:mt.optional(),_meta:F(f(),G()).optional()}),ln=v({type:S("image"),data:sn,mimeType:f(),annotations:mt.optional(),_meta:F(f(),G()).optional()}),un=v({type:S("audio"),data:sn,mimeType:f(),annotations:mt.optional(),_meta:F(f(),G()).optional()}),od=v({type:S("tool_use"),name:f(),id:f(),input:F(f(),G()),_meta:F(f(),G()).optional()}),nd=v({type:S("resource"),resource:V([Wi,Xi]),annotations:mt.optional(),_meta:F(f(),G()).optional()}),sd=Qi.extend({type:S("resource_link")}),dn=V([cn,ln,un,sd,nd]),id=v({role:Ht,content:dn}),ad=Q.extend({description:f().optional(),messages:q(id)}),cd=ge.extend({method:S("notifications/prompts/list_changed"),params:he.optional()}),ld=v({title:f().optional(),readOnlyHint:W().optional(),destructiveHint:W().optional(),idempotentHint:W().optional(),openWorldHint:W().optional()}),ud=v({taskSupport:pe(["required","optional","forbidden"]).optional()}),Yi=v({...ft.shape,...Dt.shape,description:f().optional(),inputSchema:v({type:S("object"),properties:F(f(),J).optional(),required:q(f()).optional()}).catchall(G()),outputSchema:v({type:S("object"),properties:F(f(),J).optional(),required:q(f()).optional()}).catchall(G()).optional(),annotations:ld.optional(),execution:ud.optional(),_meta:F(f(),G()).optional()}),Hr=Zt.extend({method:S("tools/list")}),dd=Lt.extend({tools:q(Yi)}),Vr=Q.extend({content:q(dn).default([]),structuredContent:F(f(),G()).optional(),isError:W().optional()}),pv=Vr.or(Q.extend({toolResult:G()})),fd=Ot.extend({name:f(),arguments:F(f(),G()).optional()}),ht=X.extend({method:S("tools/call"),params:fd}),pd=ge.extend({method:S("notifications/tools/list_changed"),params:he.optional()}),mv=v({autoRefresh:W().default(!0),debounceMs:D().int().nonnegative().default(300)}),Vt=pe(["debug","info","notice","warning","error","critical","alert","emergency"]),md=me.extend({level:Vt}),fn=X.extend({method:S("logging/setLevel"),params:md}),hd=he.extend({level:Vt,logger:f().optional(),data:G()}),gd=ge.extend({method:S("notifications/message"),params:hd}),yd=v({name:f().optional()}),_d=v({hints:q(yd).optional(),costPriority:D().min(0).max(1).optional(),speedPriority:D().min(0).max(1).optional(),intelligencePriority:D().min(0).max(1).optional()}),$d=v({mode:pe(["auto","required","none"]).optional()}),vd=v({type:S("tool_result"),toolUseId:f().describe("The unique identifier for the corresponding tool call."),content:q(dn).default([]),structuredContent:v({}).loose().optional(),isError:W().optional(),_meta:F(f(),G()).optional()}),wd=Ko("type",[cn,ln,un]),zr=Ko("type",[cn,ln,un,od,vd]),bd=v({role:Ht,content:V([zr,q(zr)]),_meta:F(f(),G()).optional()}),Sd=Ot.extend({messages:q(bd),modelPreferences:_d.optional(),systemPrompt:f().optional(),includeContext:pe(["none","thisServer","allServers"]).optional(),temperature:D().optional(),maxTokens:D().int(),stopSequences:q(f()).optional(),metadata:J.optional(),tools:q(Yi).optional(),toolChoice:$d.optional()}),xd=X.extend({method:S("sampling/createMessage"),params:Sd}),Kt=Q.extend({model:f(),stopReason:K(pe(["endTurn","stopSequence","maxTokens"]).or(f())),role:Ht,content:wd}),pn=Q.extend({model:f(),stopReason:K(pe(["endTurn","stopSequence","maxTokens","toolUse"]).or(f())),role:Ht,content:V([zr,q(zr)])}),Ed=v({type:S("boolean"),title:f().optional(),description:f().optional(),default:W().optional()}),zd=v({type:S("string"),title:f().optional(),description:f().optional(),minLength:D().optional(),maxLength:D().optional(),format:pe(["email","uri","date","date-time"]).optional(),default:f().optional()}),kd=v({type:pe(["number","integer"]),title:f().optional(),description:f().optional(),minimum:D().optional(),maximum:D().optional(),default:D().optional()}),Pd=v({type:S("string"),title:f().optional(),description:f().optional(),enum:q(f()),default:f().optional()}),Rd=v({type:S("string"),title:f().optional(),description:f().optional(),oneOf:q(v({const:f(),title:f()})),default:f().optional()}),Td=v({type:S("string"),title:f().optional(),description:f().optional(),enum:q(f()),enumNames:q(f()).optional(),default:f().optional()}),Id=V([Pd,Rd]),Cd=v({type:S("array"),title:f().optional(),description:f().optional(),minItems:D().optional(),maxItems:D().optional(),items:v({type:S("string"),enum:q(f())}),default:q(f()).optional()}),Md=v({type:S("array"),title:f().optional(),description:f().optional(),minItems:D().optional(),maxItems:D().optional(),items:v({anyOf:q(v({const:f(),title:f()}))}),default:q(f()).optional()}),qd=V([Cd,Md]),Nd=V([Td,Id,qd]),jd=V([Nd,Ed,zd,kd]),Od=Ot.extend({mode:S("form").optional(),message:f(),requestedSchema:v({type:S("object"),properties:F(f(),jd),required:q(f()).optional()})}),Ad=Ot.extend({mode:S("url"),message:f(),elicitationId:f(),url:f().url()}),Dd=V([Od,Ad]),Zd=X.extend({method:S("elicitation/create"),params:Dd}),Ld=he.extend({elicitationId:f()}),Fd=ge.extend({method:S("notifications/elicitation/complete"),params:Ld}),gt=Q.extend({action:pe(["accept","decline","cancel"]),content:Bo(t=>t===null?void 0:t,F(f(),V([f(),D(),W(),q(f())])).optional())}),Ud=v({type:S("ref/resource"),uri:f()});var Hd=v({type:S("ref/prompt"),name:f()}),Vd=me.extend({ref:V([Hd,Ud]),argument:v({name:f(),value:f()}),context:v({arguments:F(f(),f()).optional()}).optional()}),Kr=X.extend({method:S("completion/complete"),params:Vd});function ea(t){if(t.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`)}function ta(t){if(t.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`)}var Kd=Q.extend({completion:se({values:q(f()).max(100),total:K(D().int()),hasMore:K(W())})}),Gd=v({uri:f().startsWith("file://"),name:f().optional(),_meta:F(f(),G()).optional()}),Bd=X.extend({method:S("roots/list"),params:me.optional()}),mn=Q.extend({roots:q(Gd)}),Jd=ge.extend({method:S("notifications/roots/list_changed"),params:he.optional()}),hv=V([Ir,on,Kr,fn,Ur,Fr,Dr,Zr,Lr,Bu,Wu,ht,Hr,Mr,Nr,jr,Ar]),gv=V([Tr,Cr,nn,Jd,Ut]),yv=V([Rr,Kt,pn,gt,mn,qr,Or,pt]),_v=V([Ir,xd,Zd,Bd,Mr,Nr,jr,Ar]),$v=V([Tr,Cr,gd,Qu,Ku,pd,cd,Ut,Fd]),vv=V([Rr,Nu,Kd,ad,td,Fu,Uu,Vu,Vr,dd,qr,Or,pt]),b=class t extends Error{constructor(e,r,o){super(`MCP error ${e}: ${r}`),this.code=e,this.data=o,this.name="McpError"}static fromError(e,r,o){if(e===z.UrlElicitationRequired&&o){let n=o;if(n.elicitations)return new Xo(n.elicitations,r)}return new t(e,r,o)}},Xo=class extends b{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(z.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function Le(t){return t==="completed"||t==="failed"||t==="cancelled"}function Wd(t){return!t||t==="jsonSchema7"||t==="draft-7"?"draft-7":t==="jsonSchema2019-09"||t==="draft-2020-12"?"draft-2020-12":"draft-7"}function hn(t,e){return ke(t)?Vo(t,{target:Wd(e?.target),io:e?.pipeStrategy??"input"}):qi(t,{strictUnions:e?.strictUnions??!0,pipeStrategy:e?.pipeStrategy??"input"})}function gn(t){let r=De(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let o=dt(r);if(typeof o!="string")throw new Error("Schema method literal must be a string");return o}function yn(t,e){let r=Ae(t,e);if(!r.success)throw r.error;return r.data}var Xd=6e4,Gr=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Tr,r=>{this._oncancel(r)}),this.setNotificationHandler(Cr,r=>{this._onprogress(r)}),this.setRequestHandler(Ir,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Mr,async(r,o)=>{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new b(z.InvalidParams,"Failed to retrieve task: Task not found");return{...n}}),this.setRequestHandler(Nr,async(r,o)=>{let n=async()=>{let s=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,o.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),a.type==="response")l(c);else{let d=c,p=new b(d.error.code,d.error.message,d.error.data);l(p)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:o.requestId})}}let i=await this._taskStore.getTask(s,o.sessionId);if(!i)throw new b(z.InvalidParams,`Task not found: ${s}`);if(!Le(i.status))return await this._waitForTaskUpdate(s,o.signal),await n();if(Le(i.status)){let a=await this._taskStore.getTaskResult(s,o.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[Ze]:{taskId:s}}}}return await n()};return await n()}),this.setRequestHandler(jr,async(r,o)=>{try{let{tasks:n,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,o.sessionId);return{tasks:n,nextCursor:s,_meta:{}}}catch(n){throw new b(z.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(Ar,async(r,o)=>{try{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new b(z.InvalidParams,`Task not found: ${r.params.taskId}`);if(Le(n.status))throw new b(z.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",o.sessionId),this._clearTaskQueue(r.params.taskId);let s=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!s)throw new b(z.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(n){throw n instanceof b?n:new b(z.InvalidRequest,`Failed to cancel task: ${n instanceof Error?n.message:String(n)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,o,n,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,r),startTime:Date.now(),timeout:r,maxTotalTimeout:o,resetTimeoutOnProgress:s,onTimeout:n})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let o=Date.now()-r.startTime;if(r.maxTotalTimeout&&o>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),b.fromError(z.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:o});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let o=this.transport?.onerror;this._transport.onerror=s=>{o?.(s),this._onerror(s)};let n=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{n?.(s,i),At(s)||Vi(s)?this._onresponse(s):en(s)?this._onrequest(s,i):Hi(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();for(let o of this._requestHandlerAbortControllers.values())o.abort();this._requestHandlerAbortControllers.clear();let r=b.fromError(z.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let o of e.values())o(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(o=>this._onerror(new Error(`Uncaught error in notification handler: ${o}`)))}_onrequest(e,r){let o=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,n=this._transport,s=e.params?._meta?.[Ze]?.taskId;if(o===void 0){let l={jsonrpc:"2.0",id:e.id,error:{code:z.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:l,timestamp:Date.now()},n?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):n?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let a=Li(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,n?.sessionId):void 0,u={signal:i.signal,sessionId:n?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{if(i.signal.aborted)return;let d={relatedRequestId:e.id};s&&(d.relatedTask={taskId:s}),await this.notification(l,d)},sendRequest:async(l,d,p)=>{if(i.signal.aborted)throw new b(z.ConnectionClosed,"Request was cancelled");let m={...p,relatedRequestId:e.id};s&&!m.relatedTask&&(m.relatedTask={taskId:s});let h=m.relatedTask?.taskId??s;return h&&c&&await c.updateTaskStatus(h,"input_required"),await this.request(l,d,m)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:s,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(e.method)}).then(()=>o(e,u)).then(async l=>{if(i.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:e.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)},async l=>{if(i.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:z.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===i&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...o}=e.params,n=Number(r),s=this._progressHandlers.get(n);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(n),a=this._timeoutInfo.get(n);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(c){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),i(c);return}s(o)}_onresponse(e){let r=Number(e.id),o=this._requestResolvers.get(r);if(o){if(this._requestResolvers.delete(r),At(e))o(e);else{let i=new b(e.error.code,e.error.message,e.error.data);o(i)}return}let n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let s=!1;if(At(e)&&e.result&&typeof e.result=="object"){let i=e.result;if(i.task&&typeof i.task=="object"){let a=i.task;typeof a.taskId=="string"&&(s=!0,this._taskProgressTokens.set(a.taskId,r))}}if(s||this._progressHandlers.delete(r),At(e))n(e);else{let i=b.fromError(e.error.code,e.error.message,e.error.data);n(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,o){let{task:n}=o??{};if(!n){try{yield{type:"result",result:await this.request(e,r,o)}}catch(i){yield{type:"error",error:i instanceof b?i:new b(z.InternalError,String(i))}}return}let s;try{let i=await this.request(e,pt,o);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new b(z.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},o);if(yield{type:"taskStatus",task:a},Le(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)}:a.status==="failed"?yield{type:"error",error:new b(z.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new b(z.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),o?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof b?i:new b(z.InternalError,String(i))}}}request(e,r,o){let{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=o??{};return new Promise((u,l)=>{let d=w=>{l(w)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(w){d(w);return}o?.signal?.throwIfAborted();let p=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:p};o?.onprogress&&(this._progressHandlers.set(p,o.onprogress),m.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),a&&(m.params={...m.params,task:a}),c&&(m.params={...m.params,_meta:{...m.params?._meta||{},[Ze]:c}});let h=w=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(w)}},{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(O=>this._onerror(new Error(`Failed to send cancellation: ${O}`)));let E=w instanceof b?w:new b(z.RequestTimeout,String(w));l(E)};this._responseHandlers.set(p,w=>{if(!o?.signal?.aborted){if(w instanceof Error)return l(w);try{let E=Ae(r,w.result);E.success?u(E.data):l(E.error)}catch(E){l(E)}}}),o?.signal?.addEventListener("abort",()=>{h(o?.signal?.reason)});let g=o?.timeout??Xd,y=()=>h(b.fromError(z.RequestTimeout,"Request timed out",{timeout:g}));this._setupTimeout(p,g,o?.maxTotalTimeout,y,o?.resetTimeoutOnProgress??!1);let _=c?.taskId;if(_){let w=E=>{let O=this._responseHandlers.get(p);O?O(E):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,w),this._enqueueTaskMessage(_,{type:"request",message:m,timestamp:Date.now()}).catch(E=>{this._cleanupTimeout(p),l(E)})}else this._transport.send(m,{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(w=>{this._cleanupTimeout(p),l(w)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},qr,r)}async getTaskResult(e,r,o){return this.request({method:"tasks/result",params:e},r,o)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Or,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},Bi,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let o=r?.relatedTask?.taskId;if(o){let a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[Ze]:r.relatedTask}}};await this._enqueueTaskMessage(o,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[Ze]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let i={...e,jsonrpc:"2.0"};r?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[Ze]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(e,r){let o=gn(e);this.assertRequestHandlerCapability(o),this._requestHandlers.set(o,(n,s)=>{let i=yn(e,n);return Promise.resolve(r(i,s))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let o=gn(e);this._notificationHandlers.set(o,n=>{let s=yn(e,n);return Promise.resolve(r(s))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,o){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let n=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,o,n)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let o=await this._taskMessageQueue.dequeueAll(e,r);for(let n of o)if(n.type==="request"&&en(n.message)){let s=n.message.id,i=this._requestResolvers.get(s);i?(i(new b(z.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let o=this._options?.defaultTaskPollInterval??1e3;try{let n=await this._taskStore?.getTask(e);n?.pollInterval&&(o=n.pollInterval)}catch{}return new Promise((n,s)=>{if(r.aborted){s(new b(z.InvalidRequest,"Request cancelled"));return}let i=setTimeout(n,o);r.addEventListener("abort",()=>{clearTimeout(i),s(new b(z.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let o=this._taskStore;if(!o)throw new Error("No task store configured");return{createTask:async n=>{if(!e)throw new Error("No request provided");return await o.createTask(n,e.id,{method:e.method,params:e.params},r)},getTask:async n=>{let s=await o.getTask(n,r);if(!s)throw new b(z.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(n,s,i)=>{await o.storeTaskResult(n,s,i,r);let a=await o.getTask(n,r);if(a){let c=Ut.parse({method:"notifications/tasks/status",params:a});await this.notification(c),Le(a.status)&&this._cleanupTaskProgressHandler(n)}},getTaskResult:n=>o.getTaskResult(n,r),updateTaskStatus:async(n,s,i)=>{let a=await o.getTask(n,r);if(!a)throw new b(z.InvalidParams,`Task "${n}" not found - it may have been cleaned up`);if(Le(a.status))throw new b(z.InvalidParams,`Cannot update task "${n}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await o.updateTaskStatus(n,s,i,r);let c=await o.getTask(n,r);if(c){let u=Ut.parse({method:"notifications/tasks/status",params:c});await this.notification(u),Le(c.status)&&this._cleanupTaskProgressHandler(n)}},listTasks:n=>o.listTasks(n,r)}}};function ra(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function oa(t,e){let r={...t};for(let o in e){let n=o,s=e[n];if(s===void 0)continue;let i=r[n];ra(i)&&ra(s)?r[n]={...i,...s}:r[n]=s}return r}var ru=bi(li(),1),ou=bi(tu(),1);function l_(){let t=new ru.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,ou.default)(t),t}var Io=class{constructor(e){this._ajv=e??l_()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return o=>r(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var Co=class{constructor(e){this._server=e}requestStream(e,r,o){return this._server.requestStream(e,r,o)}createMessageStream(e,r){let o=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!o?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let n=e.messages[e.messages.length-1],s=Array.isArray(n.content)?n.content:[n.content],i=s.some(l=>l.type==="tool_result"),a=e.messages.length>1?e.messages[e.messages.length-2]:void 0,c=a?Array.isArray(a.content)?a.content:[a.content]:[],u=c.some(l=>l.type==="tool_use");if(i){if(s.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let l=new Set(c.filter(p=>p.type==="tool_use").map(p=>p.id)),d=new Set(s.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(l.size!==d.size||![...l].every(p=>d.has(p)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},Kt,r)}elicitInputStream(e,r){let o=this._server.getClientCapabilities(),n=e.mode??"form";switch(n){case"url":{if(!o?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!o?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let s=n==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:s},gt,r)}async getTask(e,r){return this._server.getTask({taskId:e},r)}async getTaskResult(e,r,o){return this._server.getTaskResult({taskId:e},r,o)}async listTasks(e,r){return this._server.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._server.cancelTask({taskId:e},r)}};function nu(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function su(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}var Mo=class extends Gr{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Vt.options.map((o,n)=>[o,n])),this.isMessageIgnored=(o,n)=>{let s=this._loggingLevels.get(n);return s?this.LOG_LEVEL_SEVERITY.get(o)<this.LOG_LEVEL_SEVERITY.get(s):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new Io,this.setRequestHandler(on,o=>this._oninitialize(o)),this.setNotificationHandler(nn,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(fn,async(o,n)=>{let s=n.sessionId||n.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=o.params,a=Vt.safeParse(i);return a.success&&this._loggingLevels.set(s,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Co(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=oa(this._capabilities,e)}setRequestHandler(e,r){let n=De(e)?.method;if(!n)throw new Error("Schema is missing a method literal");let s=dt(n);if(typeof s!="string")throw new Error("Schema method literal must be a string");if(s==="tools/call"){let a=async(c,u)=>{let l=Ae(ht,c);if(!l.success){let h=l.error instanceof Error?l.error.message:String(l.error);throw new b(z.InvalidParams,`Invalid tools/call request: ${h}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let h=Ae(pt,p);if(!h.success){let g=h.error instanceof Error?h.error.message:String(h.error);throw new b(z.InvalidParams,`Invalid task creation result: ${g}`)}return h.data}let m=Ae(Vr,p);if(!m.success){let h=m.error instanceof Error?m.error.message:String(m.error);throw new b(z.InvalidParams,`Invalid tools/call result: ${h}`)}return m.data};return super.setRequestHandler(e,a)}return super.setRequestHandler(e,r)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`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 Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`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 Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){su(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&nu(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Ai.includes(r)?r:Qo,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Rr)}async createMessage(e,r){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let o=e.messages[e.messages.length-1],n=Array.isArray(o.content)?o.content:[o.content],s=n.some(u=>u.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],c=a.some(u=>u.type==="tool_use");if(s){if(n.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(a.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(n.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},pn,r):this.request({method:"sampling/createMessage",params:e},Kt,r)}async elicitInput(e,r){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let n=e;return this.request({method:"elicitation/create",params:n},gt,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let n=e.mode==="form"?e:{...e,mode:"form"},s=await this.request({method:"elicitation/create",params:n},gt,r);if(s.action==="accept"&&s.content&&n.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(n.requestedSchema)(s.content);if(!a.valid)throw new b(z.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(i){throw i instanceof b?i:new b(z.InternalError,`Error validating elicitation response: ${i instanceof Error?i.message:String(i)}`)}return s}}}createElicitationCompletionNotifier(e,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},mn,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))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"})}};var au=Symbol.for("mcp.completable");function yi(t){return!!t&&typeof t=="object"&&au in t}function cu(t){return t[au]?.complete}var iu;(function(t){t.Completable="McpCompletable"})(iu||(iu={}));var u_=/^[A-Za-z0-9._-]{1,128}$/;function d_(t){let e=[];if(t.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(t.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${t.length})`]};if(t.includes(" ")&&e.push("Tool name contains spaces, which may cause parsing issues"),t.includes(",")&&e.push("Tool name contains commas, which may cause parsing issues"),(t.startsWith("-")||t.endsWith("-"))&&e.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(t.startsWith(".")||t.endsWith("."))&&e.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!u_.test(t)){let r=t.split("").filter(o=>!/[A-Za-z0-9._-]/.test(o)).filter((o,n,s)=>s.indexOf(o)===n);return e.push(`Tool name contains invalid characters: ${r.map(o=>`"${o}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:e}}return{isValid:!0,warnings:e}}function f_(t,e){if(e.length>0){console.warn(`Tool name validation warning for "${t}":`);for(let r of e)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function _i(t){let e=d_(t);return f_(t,e.warnings),e.isValid}var qo=class{constructor(e){this._mcpServer=e}registerToolTask(e,r,o){let n={taskSupport:"required",...r.execution};if(n.taskSupport==="forbidden")throw new Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,r.title,r.description,r.inputSchema,r.outputSchema,r.annotations,n,r._meta,o)}};var No=class{constructor(e,r){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new Mo(e,r)}get experimental(){return this._experimental||(this._experimental={tasks:new qo(this)}),this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(We(Hr)),this.server.assertCanSetRequestHandler(We(ht)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Hr,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,r])=>{let o={name:e,title:r.title,description:r.description,inputSchema:(()=>{let n=ut(r.inputSchema);return n?hn(n,{strictUnions:!0,pipeStrategy:"input"}):p_})(),annotations:r.annotations,execution:r.execution,_meta:r._meta};if(r.outputSchema){let n=ut(r.outputSchema);n&&(o.outputSchema=hn(n,{strictUnions:!0,pipeStrategy:"output"}))}return o})})),this.server.setRequestHandler(ht,async(e,r)=>{try{let o=this._registeredTools[e.params.name];if(!o)throw new b(z.InvalidParams,`Tool ${e.params.name} not found`);if(!o.enabled)throw new b(z.InvalidParams,`Tool ${e.params.name} disabled`);let n=!!e.params.task,s=o.execution?.taskSupport,i="createTask"in o.handler;if((s==="required"||s==="optional")&&!i)throw new b(z.InternalError,`Tool ${e.params.name} has taskSupport '${s}' but was not registered with registerToolTask`);if(s==="required"&&!n)throw new b(z.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(s==="optional"&&!n&&i)return await this.handleAutomaticTaskPolling(o,e,r);let a=await this.validateToolInput(o,e.params.arguments,e.params.name),c=await this.executeToolHandler(o,a,r);return n||await this.validateToolOutput(o,c,e.params.name),c}catch(o){if(o instanceof b&&o.code===z.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,r,o){if(!e.inputSchema)return;let s=ut(e.inputSchema)??e.inputSchema,i=await xr(s,r);if(!i.success){let a="error"in i?i.error:"Unknown error",c=Er(a);throw new b(z.InvalidParams,`Input validation error: Invalid arguments for tool ${o}: ${c}`)}return i.data}async validateToolOutput(e,r,o){if(!e.outputSchema||!("content"in r)||r.isError)return;if(!r.structuredContent)throw new b(z.InvalidParams,`Output validation error: Tool ${o} has an output schema but no structured content was provided`);let n=ut(e.outputSchema),s=await xr(n,r.structuredContent);if(!s.success){let i="error"in s?s.error:"Unknown error",a=Er(i);throw new b(z.InvalidParams,`Output validation error: Invalid structured content for tool ${o}: ${a}`)}}async executeToolHandler(e,r,o){let n=e.handler;if("createTask"in n){if(!o.taskStore)throw new Error("No task store provided.");let i={...o,taskStore:o.taskStore};if(e.inputSchema){let a=n;return await Promise.resolve(a.createTask(r,i))}else{let a=n;return await Promise.resolve(a.createTask(i))}}if(e.inputSchema){let i=n;return await Promise.resolve(i(r,o))}else{let i=n;return await Promise.resolve(i(o))}}async handleAutomaticTaskPolling(e,r,o){if(!o.taskStore)throw new Error("No task store provided for task-capable tool.");let n=await this.validateToolInput(e,r.params.arguments,r.params.name),s=e.handler,i={...o,taskStore:o.taskStore},a=n?await Promise.resolve(s.createTask(n,i)):await Promise.resolve(s.createTask(i)),c=a.task.taskId,u=a.task,l=u.pollInterval??5e3;for(;u.status!=="completed"&&u.status!=="failed"&&u.status!=="cancelled";){await new Promise(p=>setTimeout(p,l));let d=await o.taskStore.getTask(c);if(!d)throw new b(z.InternalError,`Task ${c} not found during polling`);u=d}return await o.taskStore.getTaskResult(c)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(We(Kr)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(Kr,async e=>{switch(e.params.ref.type){case"ref/prompt":return ea(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return ta(e),this.handleResourceCompletion(e,e.params.ref);default:throw new b(z.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,r){let o=this._registeredPrompts[r.name];if(!o)throw new b(z.InvalidParams,`Prompt ${r.name} not found`);if(!o.enabled)throw new b(z.InvalidParams,`Prompt ${r.name} disabled`);if(!o.argsSchema)return Sr;let s=De(o.argsSchema)?.[e.params.argument.name];if(!yi(s))return Sr;let i=cu(s);if(!i)return Sr;let a=await i(e.params.argument.value,e.params.context);return uu(a)}async handleResourceCompletion(e,r){let o=Object.values(this._registeredResourceTemplates).find(i=>i.resourceTemplate.uriTemplate.toString()===r.uri);if(!o){if(this._registeredResources[r.uri])return Sr;throw new b(z.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let n=o.resourceTemplate.completeCallback(e.params.argument.name);if(!n)return Sr;let s=await n(e.params.argument.value,e.params.context);return uu(s)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(We(Dr)),this.server.assertCanSetRequestHandler(We(Zr)),this.server.assertCanSetRequestHandler(We(Lr)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Dr,async(e,r)=>{let o=Object.entries(this._registeredResources).filter(([s,i])=>i.enabled).map(([s,i])=>({uri:s,name:i.name,...i.metadata})),n=[];for(let s of Object.values(this._registeredResourceTemplates)){if(!s.resourceTemplate.listCallback)continue;let i=await s.resourceTemplate.listCallback(r);for(let a of i.resources)n.push({...s.metadata,...a})}return{resources:[...o,...n]}}),this.server.setRequestHandler(Zr,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,o])=>({name:r,uriTemplate:o.resourceTemplate.uriTemplate.toString(),...o.metadata}))})),this.server.setRequestHandler(Lr,async(e,r)=>{let o=new URL(e.params.uri),n=this._registeredResources[o.toString()];if(n){if(!n.enabled)throw new b(z.InvalidParams,`Resource ${o} disabled`);return n.readCallback(o,r)}for(let s of Object.values(this._registeredResourceTemplates)){let i=s.resourceTemplate.uriTemplate.match(o.toString());if(i)return s.readCallback(o,i,r)}throw new b(z.InvalidParams,`Resource ${o} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(We(Fr)),this.server.assertCanSetRequestHandler(We(Ur)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Fr,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,r])=>({name:e,title:r.title,description:r.description,arguments:r.argsSchema?m_(r.argsSchema):void 0}))})),this.server.setRequestHandler(Ur,async(e,r)=>{let o=this._registeredPrompts[e.params.name];if(!o)throw new b(z.InvalidParams,`Prompt ${e.params.name} not found`);if(!o.enabled)throw new b(z.InvalidParams,`Prompt ${e.params.name} disabled`);if(o.argsSchema){let n=ut(o.argsSchema),s=await xr(n,e.params.arguments);if(!s.success){let c="error"in s?s.error:"Unknown error",u=Er(c);throw new b(z.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${u}`)}let i=s.data,a=o.callback;return await Promise.resolve(a(i,r))}else{let n=o.callback;return await Promise.resolve(n(r))}}),this._promptHandlersInitialized=!0)}resource(e,r,...o){let n;typeof o[0]=="object"&&(n=o.shift());let s=o[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let i=this._createRegisteredResource(e,void 0,r,n,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let i=this._createRegisteredResourceTemplate(e,void 0,r,n,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}registerResource(e,r,o,n){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let s=this._createRegisteredResource(e,o.title,r,o,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let s=this._createRegisteredResourceTemplate(e,o.title,r,o,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}_createRegisteredResource(e,r,o,n,s){let i={name:e,title:r,metadata:n,readCallback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:a=>{typeof a.uri<"u"&&a.uri!==o&&(delete this._registeredResources[o],a.uri&&(this._registeredResources[a.uri]=i)),typeof a.name<"u"&&(i.name=a.name),typeof a.title<"u"&&(i.title=a.title),typeof a.metadata<"u"&&(i.metadata=a.metadata),typeof a.callback<"u"&&(i.readCallback=a.callback),typeof a.enabled<"u"&&(i.enabled=a.enabled),this.sendResourceListChanged()}};return this._registeredResources[o]=i,i}_createRegisteredResourceTemplate(e,r,o,n,s){let i={resourceTemplate:o,title:r,metadata:n,readCallback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:u=>{typeof u.name<"u"&&u.name!==e&&(delete this._registeredResourceTemplates[e],u.name&&(this._registeredResourceTemplates[u.name]=i)),typeof u.title<"u"&&(i.title=u.title),typeof u.template<"u"&&(i.resourceTemplate=u.template),typeof u.metadata<"u"&&(i.metadata=u.metadata),typeof u.callback<"u"&&(i.readCallback=u.callback),typeof u.enabled<"u"&&(i.enabled=u.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=i;let a=o.uriTemplate.variableNames;return Array.isArray(a)&&a.some(u=>!!o.completeCallback(u))&&this.setCompletionRequestHandler(),i}_createRegisteredPrompt(e,r,o,n,s){let i={title:r,description:o,argsSchema:n===void 0?void 0:Xe(n),callback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:a=>{typeof a.name<"u"&&a.name!==e&&(delete this._registeredPrompts[e],a.name&&(this._registeredPrompts[a.name]=i)),typeof a.title<"u"&&(i.title=a.title),typeof a.description<"u"&&(i.description=a.description),typeof a.argsSchema<"u"&&(i.argsSchema=Xe(a.argsSchema)),typeof a.callback<"u"&&(i.callback=a.callback),typeof a.enabled<"u"&&(i.enabled=a.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=i,n&&Object.values(n).some(c=>{let u=c instanceof Ii?c._def?.innerType:c;return yi(u)})&&this.setCompletionRequestHandler(),i}_createRegisteredTool(e,r,o,n,s,i,a,c,u){_i(e);let l={title:r,description:o,inputSchema:lu(n),outputSchema:lu(s),annotations:i,execution:a,_meta:c,handler:u,enabled:!0,disable:()=>l.update({enabled:!1}),enable:()=>l.update({enabled:!0}),remove:()=>l.update({name:null}),update:d=>{typeof d.name<"u"&&d.name!==e&&(typeof d.name=="string"&&_i(d.name),delete this._registeredTools[e],d.name&&(this._registeredTools[d.name]=l)),typeof d.title<"u"&&(l.title=d.title),typeof d.description<"u"&&(l.description=d.description),typeof d.paramsSchema<"u"&&(l.inputSchema=Xe(d.paramsSchema)),typeof d.outputSchema<"u"&&(l.outputSchema=Xe(d.outputSchema)),typeof d.callback<"u"&&(l.handler=d.callback),typeof d.annotations<"u"&&(l.annotations=d.annotations),typeof d._meta<"u"&&(l._meta=d._meta),typeof d.enabled<"u"&&(l.enabled=d.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=l,this.setToolRequestHandlers(),this.sendToolListChanged(),l}tool(e,...r){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let o,n,s,i;if(typeof r[0]=="string"&&(o=r.shift()),r.length>1){let c=r[0];if($i(c))n=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!$i(r[0])&&(i=r.shift());else if(typeof c=="object"&&c!==null){if(Object.values(c).some(u=>typeof u=="object"&&u!==null))throw new Error(`Tool ${e} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);i=r.shift()}}let a=r[0];return this._createRegisteredTool(e,void 0,o,n,s,i,{taskSupport:"forbidden"},void 0,a)}registerTool(e,r,o){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let{title:n,description:s,inputSchema:i,outputSchema:a,annotations:c,_meta:u}=r;return this._createRegisteredTool(e,n,s,i,a,c,{taskSupport:"forbidden"},u,o)}prompt(e,...r){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let o;typeof r[0]=="string"&&(o=r.shift());let n;r.length>1&&(n=r.shift());let s=r[0],i=this._createRegisteredPrompt(e,void 0,o,n,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}registerPrompt(e,r,o){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let{title:n,description:s,argsSchema:i}=r,a=this._createRegisteredPrompt(e,n,s,i,o);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,r){return this.server.sendLoggingMessage(e,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};var p_={type:"object",properties:{}};function du(t){return t!==null&&typeof t=="object"&&"parse"in t&&typeof t.parse=="function"&&"safeParse"in t&&typeof t.safeParse=="function"}function fu(t){return"_def"in t||"_zod"in t||du(t)}function $i(t){return typeof t!="object"||t===null||fu(t)?!1:Object.keys(t).length===0?!0:Object.values(t).some(du)}function lu(t){if(t){if($i(t))return Xe(t);if(!fu(t))throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return t}}function m_(t){let e=De(t);return e?Object.entries(e).map(([r,o])=>{let n=ji(o),s=Oi(o);return{name:r,description:n,required:!s}}):[]}function We(t){let r=De(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let o=dt(r);if(typeof o=="string")return o;throw new Error("Schema method literal must be a string")}function uu(t){return{completion:{values:t.slice(0,100),total:t.length,hasMore:t.length>100}}}var Sr={completion:{values:[],hasMore:!1}};import mu from"node:process";var h_=10*1024*1024,jo=class{constructor(e){this._maxBufferSize=e?.maxBufferSize??h_}append(e){if((this._buffer?.length??0)+e.length>this._maxBufferSize)throw this.clear(),new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
12
|
-
`);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),
|
|
13
|
-
`}var
|
|
10
|
+
deps: ${r}}`};var ay={keyword:"dependencies",type:"object",schemaType:"object",error:Re.error,code(t){let[e,r]=cy(t);xl(t,e),kl(t,r)}};function cy({schema:t}){let e={},r={};for(let o in t){if(o==="__proto__")continue;let n=Array.isArray(t[o])?e:r;n[o]=t[o]}return[e,r]}function xl(t,e=t.schema){let{gen:r,data:o,it:n}=t;if(Object.keys(e).length===0)return;let s=r.let("missing");for(let i in e){let a=e[i];if(a.length===0)continue;let c=(0,kr.propertyInData)(r,o,i,n.opts.ownProperties);t.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(c,()=>{for(let u of a)(0,kr.checkReportMissingProp)(t,u)}):(r.if((0,Js._)`${c} && (${(0,kr.checkMissingProp)(t,a,s)})`),(0,kr.reportMissingProp)(t,s),r.else())}}Re.validatePropertyDeps=xl;function kl(t,e=t.schema){let{gen:r,data:o,keyword:n,it:s}=t,i=r.name("valid");for(let a in e)(0,iy.alwaysValidSchema)(s,e[a])||(r.if((0,kr.propertyInData)(r,o,a,s.opts.ownProperties),()=>{let c=t.subschema({keyword:n,schemaProp:a},i);t.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),t.ok(i))}Re.validateSchemaDeps=kl;Re.default=ay});var Pl=$(Ws=>{"use strict";Object.defineProperty(Ws,"__esModule",{value:!0});var zl=R(),ly=j(),uy={message:"property name must be valid",params:({params:t})=>(0,zl._)`{propertyName: ${t.propertyName}}`},dy={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:uy,code(t){let{gen:e,schema:r,data:o,it:n}=t;if((0,ly.alwaysValidSchema)(n,r))return;let s=e.name("valid");e.forIn("key",o,i=>{t.setParams({propertyName:i}),t.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),e.if((0,zl.not)(s),()=>{t.error(!0),n.allErrors||e.break()})}),t.ok(s)}};Ws.default=dy});var Qs=$(Xs=>{"use strict";Object.defineProperty(Xs,"__esModule",{value:!0});var Po=_e(),xe=R(),fy=Ne(),To=j(),py={message:"must NOT have additional properties",params:({params:t})=>(0,xe._)`{additionalProperty: ${t.additionalProperty}}`},my={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:py,code(t){let{gen:e,schema:r,parentSchema:o,data:n,errsCount:s,it:i}=t;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,To.alwaysValidSchema)(i,r))return;let u=(0,Po.allSchemaProperties)(o.properties),l=(0,Po.allSchemaProperties)(o.patternProperties);d(),t.ok((0,xe._)`${s} === ${fy.default.errors}`);function d(){e.forIn("key",n,y=>{!u.length&&!l.length?h(y):e.if(p(y),()=>h(y))})}function p(y){let _;if(u.length>8){let w=(0,To.schemaRefOrVal)(i,o.properties,"properties");_=(0,Po.isOwnProperty)(e,w,y)}else u.length?_=(0,xe.or)(...u.map(w=>(0,xe._)`${y} === ${w}`)):_=xe.nil;return l.length&&(_=(0,xe.or)(_,...l.map(w=>(0,xe._)`${(0,Po.usePattern)(t,w)}.test(${y})`))),(0,xe.not)(_)}function m(y){e.code((0,xe._)`delete ${n}[${y}]`)}function h(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){m(y);return}if(r===!1){t.setParams({additionalProperty:y}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,To.alwaysValidSchema)(i,r)){let _=e.name("valid");c.removeAdditional==="failing"?(g(y,_,!1),e.if((0,xe.not)(_),()=>{t.reset(),m(y)})):(g(y,_),a||e.if((0,xe.not)(_),()=>e.break()))}}function g(y,_,w){let k={keyword:"additionalProperties",dataProp:y,dataPropType:To.Type.Str};w===!1&&Object.assign(k,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(k,_)}}};Xs.default=my});var Il=$(ei=>{"use strict";Object.defineProperty(ei,"__esModule",{value:!0});var hy=ur(),Tl=_e(),Ys=j(),Rl=Qs(),gy={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:o,data:n,it:s}=t;s.opts.removeAdditional==="all"&&o.additionalProperties===void 0&&Rl.default.code(new hy.KeywordCxt(s,Rl.default,"additionalProperties"));let i=(0,Tl.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=Ys.mergeEvaluated.props(e,(0,Ys.toHash)(i),s.props));let a=i.filter(d=>!(0,Ys.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)u(d)?l(d):(e.if((0,Tl.propertyInData)(e,n,d,s.opts.ownProperties)),l(d),s.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};ei.default=gy});var jl=$(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});var Cl=_e(),Ro=R(),Ml=j(),ql=j(),yy={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:o,parentSchema:n,it:s}=t,{opts:i}=s,a=(0,Cl.allSchemaProperties)(r),c=a.filter(g=>(0,Ml.alwaysValidSchema)(s,r[g]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&n.properties,l=e.name("valid");s.props!==!0&&!(s.props instanceof Ro.Name)&&(s.props=(0,ql.evaluatedPropsToName)(e,s.props));let{props:d}=s;p();function p(){for(let g of a)u&&m(g),s.allErrors?h(g):(e.var(l,!0),h(g),e.if(l))}function m(g){for(let y in u)new RegExp(g).test(y)&&(0,Ml.checkStrictMode)(s,`property ${y} matches pattern ${g} (use allowMatchingProperties)`)}function h(g){e.forIn("key",o,y=>{e.if((0,Ro._)`${(0,Cl.usePattern)(t,g)}.test(${y})`,()=>{let _=c.includes(g);_||t.subschema({keyword:"patternProperties",schemaProp:g,dataProp:y,dataPropType:ql.Type.Str},l),s.opts.unevaluated&&d!==!0?e.assign((0,Ro._)`${d}[${y}]`,!0):!_&&!s.allErrors&&e.if((0,Ro.not)(l),()=>e.break())})})}}};ti.default=yy});var Nl=$(ri=>{"use strict";Object.defineProperty(ri,"__esModule",{value:!0});var _y=j(),$y={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:o}=t;if((0,_y.alwaysValidSchema)(o,r)){t.fail();return}let n=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),t.failResult(n,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};ri.default=$y});var Ol=$(oi=>{"use strict";Object.defineProperty(oi,"__esModule",{value:!0});var vy=_e(),wy={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:vy.validateUnion,error:{message:"must match a schema in anyOf"}};oi.default=wy});var Al=$(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});var Io=R(),by=j(),Sy={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Io._)`{passingSchemas: ${t.passing}}`},xy={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Sy,code(t){let{gen:e,schema:r,parentSchema:o,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let s=r,i=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(i,()=>t.reset(),()=>t.error(!0));function u(){s.forEach((l,d)=>{let p;(0,by.alwaysValidSchema)(n,l)?e.var(c,!0):p=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,Io._)`${c} && ${i}`).assign(i,!1).assign(a,(0,Io._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(i,!0),e.assign(a,d),p&&t.mergeEvaluated(p,Io.Name)})})}}};ni.default=xy});var Dl=$(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});var ky=j(),Ey={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=e.name("valid");r.forEach((s,i)=>{if((0,ky.alwaysValidSchema)(o,s))return;let a=t.subschema({keyword:"allOf",schemaProp:i},n);t.ok(n),t.mergeEvaluated(a)})}};si.default=Ey});var Fl=$(ii=>{"use strict";Object.defineProperty(ii,"__esModule",{value:!0});var Co=R(),Zl=j(),zy={message:({params:t})=>(0,Co.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Co._)`{failingKeyword: ${t.ifClause}}`},Py={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:zy,code(t){let{gen:e,parentSchema:r,it:o}=t;r.then===void 0&&r.else===void 0&&(0,Zl.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let n=Ll(o,"then"),s=Ll(o,"else");if(!n&&!s)return;let i=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),n&&s){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(a,u("then",l),u("else",l))}else n?e.if(a,u("then")):e.if((0,Co.not)(a),u("else"));t.pass(i,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(l)}function u(l,d){return()=>{let p=t.subschema({keyword:l},a);e.assign(i,a),t.mergeValidEvaluated(p,i),d?e.assign(d,(0,Co._)`${l}`):t.setParams({ifClause:l})}}}};function Ll(t,e){let r=t.schema[e];return r!==void 0&&!(0,Zl.alwaysValidSchema)(t,r)}ii.default=Py});var Ul=$(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});var Ty=j(),Ry={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,Ty.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};ai.default=Ry});var Hl=$(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});var Iy=Hs(),Cy=vl(),My=Vs(),qy=bl(),jy=Sl(),Ny=El(),Oy=Pl(),Ay=Qs(),Dy=Il(),Ly=jl(),Zy=Nl(),Fy=Ol(),Uy=Al(),Hy=Dl(),Vy=Fl(),Ky=Ul();function Gy(t=!1){let e=[Zy.default,Fy.default,Uy.default,Hy.default,Vy.default,Ky.default,Oy.default,Ay.default,Ny.default,Dy.default,Ly.default];return t?e.push(Cy.default,qy.default):e.push(Iy.default,My.default),e.push(jy.default),e}ci.default=Gy});var Vl=$(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});var B=R(),By={message:({schemaCode:t})=>(0,B.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,B._)`{format: ${t}}`},Jy={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:By,code(t,e){let{gen:r,data:o,$data:n,schema:s,schemaCode:i,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;n?p():m();function p(){let h=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),g=r.const("fDef",(0,B._)`${h}[${i}]`),y=r.let("fType"),_=r.let("format");r.if((0,B._)`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(y,(0,B._)`${g}.type || "string"`).assign(_,(0,B._)`${g}.validate`),()=>r.assign(y,(0,B._)`"string"`).assign(_,g)),t.fail$data((0,B.or)(w(),k()));function w(){return c.strictSchema===!1?B.nil:(0,B._)`${i} && !${_}`}function k(){let O=l.$async?(0,B._)`(${g}.async ? await ${_}(${o}) : ${_}(${o}))`:(0,B._)`${_}(${o})`,P=(0,B._)`(typeof ${_} == "function" ? ${O} : ${_}.test(${o}))`;return(0,B._)`${_} && ${_} !== true && ${y} === ${e} && !${P}`}}function m(){let h=d.formats[s];if(!h){w();return}if(h===!0)return;let[g,y,_]=k(h);g===e&&t.pass(O());function w(){if(c.strictSchema===!1){d.logger.warn(P());return}throw new Error(P());function P(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function k(P){let Ee=P instanceof RegExp?(0,B.regexpCode)(P):c.code.formats?(0,B._)`${c.code.formats}${(0,B.getProperty)(s)}`:void 0,Me=r.scopeValue("formats",{key:s,ref:P,code:Ee});return typeof P=="object"&&!(P instanceof RegExp)?[P.type||"string",P.validate,(0,B._)`${Me}.validate`]:["string",P,Me]}function O(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw new Error("async format in sync schema");return(0,B._)`await ${_}(${o})`}return typeof y=="function"?(0,B._)`${_}(${o})`:(0,B._)`${_}.test(${o})`}}}};li.default=Jy});var Kl=$(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});var Wy=Vl(),Xy=[Wy.default];ui.default=Xy});var Gl=$(Rt=>{"use strict";Object.defineProperty(Rt,"__esModule",{value:!0});Rt.contentVocabulary=Rt.metadataVocabulary=void 0;Rt.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Rt.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Jl=$(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});var Qy=rl(),Yy=gl(),e_=Hl(),t_=Kl(),Bl=Gl(),r_=[Qy.default,Yy.default,(0,e_.default)(),t_.default,Bl.metadataVocabulary,Bl.contentVocabulary];di.default=r_});var Xl=$(Mo=>{"use strict";Object.defineProperty(Mo,"__esModule",{value:!0});Mo.DiscrError=void 0;var Wl;(function(t){t.Tag="tag",t.Mapping="mapping"})(Wl||(Mo.DiscrError=Wl={}))});var Yl=$(pi=>{"use strict";Object.defineProperty(pi,"__esModule",{value:!0});var It=R(),fi=Xl(),Ql=mo(),o_=dr(),n_=j(),s_={message:({params:{discrError:t,tagName:e}})=>t===fi.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,It._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},i_={keyword:"discriminator",type:"object",schemaType:"object",error:s_,code(t){let{gen:e,data:r,schema:o,parentSchema:n,it:s}=t,{oneOf:i}=n;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=o.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(o.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,It._)`${r}${(0,It.getProperty)(a)}`);e.if((0,It._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:fi.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){let m=p();e.if(!1);for(let h in m)e.elseIf((0,It._)`${u} === ${h}`),e.assign(c,d(m[h]));e.else(),t.error(!1,{discrError:fi.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function d(m){let h=e.name("valid"),g=t.subschema({keyword:"oneOf",schemaProp:m},h);return t.mergeEvaluated(g,It.Name),h}function p(){var m;let h={},g=_(n),y=!0;for(let O=0;O<i.length;O++){let P=i[O];if(P?.$ref&&!(0,n_.schemaHasRulesButRef)(P,s.self.RULES)){let Me=P.$ref;if(P=Ql.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,Me),P instanceof Ql.SchemaEnv&&(P=P.schema),P===void 0)throw new o_.default(s.opts.uriResolver,s.baseId,Me)}let Ee=(m=P?.properties)===null||m===void 0?void 0:m[a];if(typeof Ee!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(g||_(P)),w(Ee,O)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return h;function _({required:O}){return Array.isArray(O)&&O.includes(a)}function w(O,P){if(O.const)k(O.const,P);else if(O.enum)for(let Ee of O.enum)k(Ee,P);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function k(O,P){if(typeof O!="string"||O in h)throw new Error(`discriminator: "${a}" values must be unique strings`);h[O]=P}}}};pi.default=i_});var eu=$((wb,a_)=>{a_.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}});var hi=$((H,mi)=>{"use strict";Object.defineProperty(H,"__esModule",{value:!0});H.MissingRefError=H.ValidationError=H.CodeGen=H.Name=H.nil=H.stringify=H.str=H._=H.KeywordCxt=H.Ajv=void 0;var c_=Wc(),l_=Jl(),u_=Yl(),tu=eu(),d_=["/properties"],qo="http://json-schema.org/draft-07/schema",Ct=class extends c_.default{_addVocabularies(){super._addVocabularies(),l_.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(u_.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(tu,d_):tu;this.addMetaSchema(e,qo,!1),this.refs["http://json-schema.org/schema"]=qo}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(qo)?qo:void 0)}};H.Ajv=Ct;mi.exports=H=Ct;mi.exports.Ajv=Ct;Object.defineProperty(H,"__esModule",{value:!0});H.default=Ct;var f_=ur();Object.defineProperty(H,"KeywordCxt",{enumerable:!0,get:function(){return f_.KeywordCxt}});var Mt=R();Object.defineProperty(H,"_",{enumerable:!0,get:function(){return Mt._}});Object.defineProperty(H,"str",{enumerable:!0,get:function(){return Mt.str}});Object.defineProperty(H,"stringify",{enumerable:!0,get:function(){return Mt.stringify}});Object.defineProperty(H,"nil",{enumerable:!0,get:function(){return Mt.nil}});Object.defineProperty(H,"Name",{enumerable:!0,get:function(){return Mt.Name}});Object.defineProperty(H,"CodeGen",{enumerable:!0,get:function(){return Mt.CodeGen}});var p_=fo();Object.defineProperty(H,"ValidationError",{enumerable:!0,get:function(){return p_.default}});var m_=dr();Object.defineProperty(H,"MissingRefError",{enumerable:!0,get:function(){return m_.default}})});var lu=$(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.formatNames=Ce.fastFormats=Ce.fullFormats=void 0;function Ie(t,e){return{validate:t,compare:e}}Ce.fullFormats={date:Ie(su,$i),time:Ie(yi(!0),vi),"date-time":Ie(ru(!0),au),"iso-time":Ie(yi(),iu),"iso-date-time":Ie(ru(),cu),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:v_,"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:z_,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:w_,int32:{type:"number",validate:x_},int64:{type:"number",validate:k_},float:{type:"number",validate:nu},double:{type:"number",validate:nu},password:!0,binary:!0};Ce.fastFormats={...Ce.fullFormats,date:Ie(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,$i),time:Ie(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,vi),"date-time":Ie(/^\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,au),"iso-time":Ie(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,iu),"iso-date-time":Ie(/^\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,cu),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};Ce.formatNames=Object.keys(Ce.fullFormats);function h_(t){return t%4===0&&(t%100!==0||t%400===0)}var g_=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,y_=[0,31,28,31,30,31,30,31,31,30,31,30,31];function su(t){let e=g_.exec(t);if(!e)return!1;let r=+e[1],o=+e[2],n=+e[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&h_(r)?29:y_[o])}function $i(t,e){if(t&&e)return t>e?1:t<e?-1:0}var gi=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function yi(t){return function(r){let o=gi.exec(r);if(!o)return!1;let n=+o[1],s=+o[2],i=+o[3],a=o[4],c=o[5]==="-"?-1:1,u=+(o[6]||0),l=+(o[7]||0);if(u>23||l>59||t&&!a)return!1;if(n<=23&&s<=59&&i<60)return!0;let d=s-l*c,p=n-u*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&i<61}}function vi(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),o=new Date("2020-01-01T"+e).valueOf();if(r&&o)return r-o}function iu(t,e){if(!(t&&e))return;let r=gi.exec(t),o=gi.exec(e);if(r&&o)return t=r[1]+r[2]+r[3],e=o[1]+o[2]+o[3],t>e?1:t<e?-1:0}var _i=/t|\s/i;function ru(t){let e=yi(t);return function(o){let n=o.split(_i);return n.length===2&&su(n[0])&&e(n[1])}}function au(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),o=new Date(e).valueOf();if(r&&o)return r-o}function cu(t,e){if(!(t&&e))return;let[r,o]=t.split(_i),[n,s]=e.split(_i),i=$i(r,n);if(i!==void 0)return i||vi(o,s)}var __=/\/|:/,$_=/^(?:[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 v_(t){return __.test(t)&&$_.test(t)}var ou=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function w_(t){return ou.lastIndex=0,ou.test(t)}var b_=-(2**31),S_=2**31-1;function x_(t){return Number.isInteger(t)&&t<=S_&&t>=b_}function k_(t){return Number.isInteger(t)}function nu(){return!0}var E_=/[^\\]\\Z/;function z_(t){if(E_.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var uu=$(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.formatLimitDefinition=void 0;var P_=hi(),ke=R(),We=ke.operators,jo={formatMaximum:{okStr:"<=",ok:We.LTE,fail:We.GT},formatMinimum:{okStr:">=",ok:We.GTE,fail:We.LT},formatExclusiveMaximum:{okStr:"<",ok:We.LT,fail:We.GTE},formatExclusiveMinimum:{okStr:">",ok:We.GT,fail:We.LTE}},T_={message:({keyword:t,schemaCode:e})=>(0,ke.str)`should be ${jo[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,ke._)`{comparison: ${jo[t].okStr}, limit: ${e}}`};qt.formatLimitDefinition={keyword:Object.keys(jo),type:"string",schemaType:"string",$data:!0,error:T_,code(t){let{gen:e,data:r,schemaCode:o,keyword:n,it:s}=t,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new P_.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let p=e.scopeValue("formats",{ref:a.formats,code:i.code.formats}),m=e.const("fmt",(0,ke._)`${p}[${c.schemaCode}]`);t.fail$data((0,ke.or)((0,ke._)`typeof ${m} != "object"`,(0,ke._)`${m} instanceof RegExp`,(0,ke._)`typeof ${m}.compare != "function"`,d(m)))}function l(){let p=c.schema,m=a.formats[p];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw new Error(`"${n}": format "${p}" does not define "compare" function`);let h=e.scopeValue("formats",{key:p,ref:m,code:i.code.formats?(0,ke._)`${i.code.formats}${(0,ke.getProperty)(p)}`:void 0});t.fail$data(d(h))}function d(p){return(0,ke._)`${p}.compare(${r}, ${o}) ${jo[n].fail} 0`}},dependencies:["format"]};var R_=t=>(t.addKeyword(qt.formatLimitDefinition),t);qt.default=R_});var mu=$((Er,pu)=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});var jt=lu(),I_=uu(),wi=R(),du=new wi.Name("fullFormats"),C_=new wi.Name("fastFormats"),bi=(t,e={keywords:!0})=>{if(Array.isArray(e))return fu(t,e,jt.fullFormats,du),t;let[r,o]=e.mode==="fast"?[jt.fastFormats,C_]:[jt.fullFormats,du],n=e.formats||jt.formatNames;return fu(t,n,r,o),e.keywords&&(0,I_.default)(t),t};bi.get=(t,e="full")=>{let o=(e==="fast"?jt.fastFormats:jt.fullFormats)[t];if(!o)throw new Error(`Unknown format "${t}"`);return o};function fu(t,e,r,o){var n,s;(n=(s=t.opts.code).formats)!==null&&n!==void 0||(s.formats=(0,wi._)`require("ajv-formats/dist/formats").${o}`);for(let i of e)t.addFormat(i,r[i])}pu.exports=Er=bi;Object.defineProperty(Er,"__esModule",{value:!0});Er.default=bi});var Hu=Go("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");ji.init(t,e),t.def=e,t.type=e.type},{get with(){return this.check},set with(t){Mi(this,"with",t)},parse(t,e){return Bo(this,t,e,{callee:this.parse})},parseAsync(t,e){return Jo(this,t,e,{callee:this.parseAsync})},safeParse(t,e){return Dt(this,t,e)},safeParseAsync(t,e){return Lt(this,t,e)},check(...t){let e=this.def;return this.clone({...e,checks:[...e.checks??[],...t.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]},{parent:!0})},clone(t,e){return Ko(this,t,e)},brand(){return this},register(t,e){return t.add(this,e),this},apply(t,...e){return e.length===0?t(this):t(this,...e)}});var Vu=Go("ZodMiniObject",(t,e)=>{Ni.init(t,e),Hu.init(t,e),qi(t,"shape",r=>r._zod.def.shape,!1)});function rn(t,e){let r={type:"object",shape:t??{},...Ci(e)};return new Vu(r)}function ze(t){return!!t._zod}function Qe(t){let e=Object.values(t);if(e.length===0)return rn({});let r=e.every(ze),o=e.every(n=>!ze(n));if(r)return rn(t);if(o)return Ii(t);throw new Error("Mixed Zod versions detected in object shape.")}function De(t,e){return ze(t)?Dt(t,e):t.safeParse(e)}async function Tr(t,e){return ze(t)?await Lt(t,e):await t.safeParseAsync(e)}function Le(t){if(!t)return;let e;if(ze(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function ft(t){if(t){if(typeof t=="object"){let e=t,r=t;if(!e._def&&!r._zod){let o=Object.values(t);if(o.length>0&&o.every(n=>typeof n=="object"&&n!==null&&(n._def!==void 0||n._zod!==void 0||typeof n.parse=="function")))return Qe(t)}}if(ze(t)){let r=t._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return t}else if(t.shape!==void 0)return t}}function Gu(t){return t.length===0?"object root":t.reduce((e,r,o)=>o===0?String(r):typeof r=="number"?`${e}[${r}]`:`${e}.${r}`,"")}function Rr(t){if(t&&typeof t=="object"){if("issues"in t&&Array.isArray(t.issues)&&t.issues.length>0)return t.issues.map(e=>e.path?.length?`${e.message} at ${Gu(e.path)}`:e.message).join(`
|
|
11
|
+
`);if("message"in t&&typeof t.message=="string")return t.message;try{return JSON.stringify(t)}catch{return String(t)}}return String(t)}function Ji(t){return t.description}function Wi(t){if(ze(t))return t._zod?.def?.type==="optional";let e=t;return typeof t.isOptional=="function"?t.isOptional():e._def?.typeName==="ZodOptional"}function pt(t){if(ze(t)){let s=t._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let o=t.value;if(o!==void 0)return o}var nn="2025-11-25";var Xi=[nn,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Ze="io.modelcontextprotocol/related-task",Cr="2.0",J=Di(t=>t!==null&&(typeof t=="object"||typeof t=="function")),Qi=V([f(),D().int()]),Yi=f(),Fv=se({ttl:D().optional(),pollInterval:D().optional()}),Bu=v({ttl:D().optional()}),Ju=v({taskId:f()}),sn=se({progressToken:Qi.optional(),[Ze]:Ju.optional()}),me=v({_meta:sn.optional()}),Zt=me.extend({task:Bu.optional()}),ea=t=>Zt.safeParse(t).success,X=v({method:f(),params:me.loose().optional()}),he=v({_meta:sn.optional()}),ge=v({method:f(),params:he.loose().optional()}),Q=se({_meta:sn.optional()}),Mr=V([f(),D().int()]),ta=v({jsonrpc:S(Cr),id:Mr,...X.shape}).strict(),an=t=>ta.safeParse(t).success,ra=v({jsonrpc:S(Cr),...ge.shape}).strict(),oa=t=>ra.safeParse(t).success,cn=v({jsonrpc:S(Cr),id:Mr,result:Q}).strict(),Ft=t=>cn.safeParse(t).success;var E;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(E||(E={}));var ln=v({jsonrpc:S(Cr),id:Mr.optional(),error:v({code:D().int(),message:f(),data:G().optional()})}).strict();var na=t=>ln.safeParse(t).success;var sa=V([ta,ra,cn,ln]),Uv=V([cn,ln]),qr=Q.strict(),Wu=he.extend({requestId:Mr.optional(),reason:f().optional()}),jr=ge.extend({method:S("notifications/cancelled"),params:Wu}),Xu=v({src:f(),mimeType:f().optional(),sizes:q(f()).optional(),theme:pe(["light","dark"]).optional()}),Ut=v({icons:q(Xu).optional()}),mt=v({name:f(),title:f().optional()}),ia=mt.extend({...mt.shape,...Ut.shape,version:f(),websiteUrl:f().optional(),description:f().optional()}),Qu=Qo(v({applyDefaults:W().optional()}),F(f(),G())),Yu=Yo(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Qo(v({form:Qu.optional(),url:J.optional()}),F(f(),G()).optional())),ed=se({list:J.optional(),cancel:J.optional(),requests:se({sampling:se({createMessage:J.optional()}).optional(),elicitation:se({create:J.optional()}).optional()}).optional()}),td=se({list:J.optional(),cancel:J.optional(),requests:se({tools:se({call:J.optional()}).optional()}).optional()}),rd=v({experimental:F(f(),J).optional(),sampling:v({context:J.optional(),tools:J.optional()}).optional(),elicitation:Yu.optional(),roots:v({listChanged:W().optional()}).optional(),tasks:ed.optional(),extensions:F(f(),J).optional()}),od=me.extend({protocolVersion:f(),capabilities:rd,clientInfo:ia}),un=X.extend({method:S("initialize"),params:od});var nd=v({experimental:F(f(),J).optional(),logging:J.optional(),completions:J.optional(),prompts:v({listChanged:W().optional()}).optional(),resources:v({subscribe:W().optional(),listChanged:W().optional()}).optional(),tools:v({listChanged:W().optional()}).optional(),tasks:td.optional(),extensions:F(f(),J).optional()}),sd=Q.extend({protocolVersion:f(),capabilities:nd,serverInfo:ia,instructions:f().optional()}),dn=ge.extend({method:S("notifications/initialized"),params:he.optional()});var Nr=X.extend({method:S("ping"),params:me.optional()}),id=v({progress:D(),total:K(D()),message:K(f())}),ad=v({...he.shape,...id.shape,progressToken:Qi}),Or=ge.extend({method:S("notifications/progress"),params:ad}),cd=me.extend({cursor:Yi.optional()}),Ht=X.extend({params:cd.optional()}),Vt=Q.extend({nextCursor:Yi.optional()}),ld=pe(["working","input_required","completed","failed","cancelled"]),Kt=v({taskId:f(),status:ld,ttl:V([D(),Oi()]),createdAt:f(),lastUpdatedAt:f(),pollInterval:K(D()),statusMessage:K(f())}),ht=Q.extend({task:Kt}),ud=he.merge(Kt),Gt=ge.extend({method:S("notifications/tasks/status"),params:ud}),Ar=X.extend({method:S("tasks/get"),params:me.extend({taskId:f()})}),Dr=Q.merge(Kt),Lr=X.extend({method:S("tasks/result"),params:me.extend({taskId:f()})}),Hv=Q.loose(),Zr=Ht.extend({method:S("tasks/list")}),Fr=Vt.extend({tasks:q(Kt)}),Ur=X.extend({method:S("tasks/cancel"),params:me.extend({taskId:f()})}),aa=Q.merge(Kt),ca=v({uri:f(),mimeType:K(f()),_meta:F(f(),G()).optional()}),la=ca.extend({text:f()}),fn=f().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),ua=ca.extend({blob:fn}),Bt=pe(["user","assistant"]),gt=v({audience:q(Bt).optional(),priority:D().min(0).max(1).optional(),lastModified:Li.datetime({offset:!0}).optional()}),da=v({...mt.shape,...Ut.shape,uri:f(),description:K(f()),mimeType:K(f()),size:K(D()),annotations:gt.optional(),_meta:K(se({}))}),dd=v({...mt.shape,...Ut.shape,uriTemplate:f(),description:K(f()),mimeType:K(f()),annotations:gt.optional(),_meta:K(se({}))}),Hr=Ht.extend({method:S("resources/list")}),fd=Vt.extend({resources:q(da)}),Vr=Ht.extend({method:S("resources/templates/list")}),pd=Vt.extend({resourceTemplates:q(dd)}),pn=me.extend({uri:f()}),md=pn,Kr=X.extend({method:S("resources/read"),params:md}),hd=Q.extend({contents:q(V([la,ua]))}),gd=ge.extend({method:S("notifications/resources/list_changed"),params:he.optional()}),yd=pn,_d=X.extend({method:S("resources/subscribe"),params:yd}),$d=pn,vd=X.extend({method:S("resources/unsubscribe"),params:$d}),wd=he.extend({uri:f()}),bd=ge.extend({method:S("notifications/resources/updated"),params:wd}),Sd=v({name:f(),description:K(f()),required:K(W())}),xd=v({...mt.shape,...Ut.shape,description:K(f()),arguments:K(q(Sd)),_meta:K(se({}))}),Gr=Ht.extend({method:S("prompts/list")}),kd=Vt.extend({prompts:q(xd)}),Ed=me.extend({name:f(),arguments:F(f(),f()).optional()}),Br=X.extend({method:S("prompts/get"),params:Ed}),mn=v({type:S("text"),text:f(),annotations:gt.optional(),_meta:F(f(),G()).optional()}),hn=v({type:S("image"),data:fn,mimeType:f(),annotations:gt.optional(),_meta:F(f(),G()).optional()}),gn=v({type:S("audio"),data:fn,mimeType:f(),annotations:gt.optional(),_meta:F(f(),G()).optional()}),zd=v({type:S("tool_use"),name:f(),id:f(),input:F(f(),G()),_meta:F(f(),G()).optional()}),Pd=v({type:S("resource"),resource:V([la,ua]),annotations:gt.optional(),_meta:F(f(),G()).optional()}),Td=da.extend({type:S("resource_link")}),yn=V([mn,hn,gn,Td,Pd]),Rd=v({role:Bt,content:yn}),Id=Q.extend({description:f().optional(),messages:q(Rd)}),Cd=ge.extend({method:S("notifications/prompts/list_changed"),params:he.optional()}),Md=v({title:f().optional(),readOnlyHint:W().optional(),destructiveHint:W().optional(),idempotentHint:W().optional(),openWorldHint:W().optional()}),qd=v({taskSupport:pe(["required","optional","forbidden"]).optional()}),fa=v({...mt.shape,...Ut.shape,description:f().optional(),inputSchema:v({type:S("object"),properties:F(f(),J).optional(),required:q(f()).optional()}).catchall(G()),outputSchema:v({type:S("object"),properties:F(f(),J).optional(),required:q(f()).optional()}).catchall(G()).optional(),annotations:Md.optional(),execution:qd.optional(),_meta:F(f(),G()).optional()}),Jr=Ht.extend({method:S("tools/list")}),jd=Vt.extend({tools:q(fa)}),Wr=Q.extend({content:q(yn).default([]),structuredContent:F(f(),G()).optional(),isError:W().optional()}),Vv=Wr.or(Q.extend({toolResult:G()})),Nd=Zt.extend({name:f(),arguments:F(f(),G()).optional()}),yt=X.extend({method:S("tools/call"),params:Nd}),Od=ge.extend({method:S("notifications/tools/list_changed"),params:he.optional()}),Kv=v({autoRefresh:W().default(!0),debounceMs:D().int().nonnegative().default(300)}),Jt=pe(["debug","info","notice","warning","error","critical","alert","emergency"]),Ad=me.extend({level:Jt}),_n=X.extend({method:S("logging/setLevel"),params:Ad}),Dd=he.extend({level:Jt,logger:f().optional(),data:G()}),Ld=ge.extend({method:S("notifications/message"),params:Dd}),Zd=v({name:f().optional()}),Fd=v({hints:q(Zd).optional(),costPriority:D().min(0).max(1).optional(),speedPriority:D().min(0).max(1).optional(),intelligencePriority:D().min(0).max(1).optional()}),Ud=v({mode:pe(["auto","required","none"]).optional()}),Hd=v({type:S("tool_result"),toolUseId:f().describe("The unique identifier for the corresponding tool call."),content:q(yn).default([]),structuredContent:v({}).loose().optional(),isError:W().optional(),_meta:F(f(),G()).optional()}),Vd=Xo("type",[mn,hn,gn]),Ir=Xo("type",[mn,hn,gn,zd,Hd]),Kd=v({role:Bt,content:V([Ir,q(Ir)]),_meta:F(f(),G()).optional()}),Gd=Zt.extend({messages:q(Kd),modelPreferences:Fd.optional(),systemPrompt:f().optional(),includeContext:pe(["none","thisServer","allServers"]).optional(),temperature:D().optional(),maxTokens:D().int(),stopSequences:q(f()).optional(),metadata:J.optional(),tools:q(fa).optional(),toolChoice:Ud.optional()}),Bd=X.extend({method:S("sampling/createMessage"),params:Gd}),Wt=Q.extend({model:f(),stopReason:K(pe(["endTurn","stopSequence","maxTokens"]).or(f())),role:Bt,content:Vd}),$n=Q.extend({model:f(),stopReason:K(pe(["endTurn","stopSequence","maxTokens","toolUse"]).or(f())),role:Bt,content:V([Ir,q(Ir)])}),Jd=v({type:S("boolean"),title:f().optional(),description:f().optional(),default:W().optional()}),Wd=v({type:S("string"),title:f().optional(),description:f().optional(),minLength:D().optional(),maxLength:D().optional(),format:pe(["email","uri","date","date-time"]).optional(),default:f().optional()}),Xd=v({type:pe(["number","integer"]),title:f().optional(),description:f().optional(),minimum:D().optional(),maximum:D().optional(),default:D().optional()}),Qd=v({type:S("string"),title:f().optional(),description:f().optional(),enum:q(f()),default:f().optional()}),Yd=v({type:S("string"),title:f().optional(),description:f().optional(),oneOf:q(v({const:f(),title:f()})),default:f().optional()}),ef=v({type:S("string"),title:f().optional(),description:f().optional(),enum:q(f()),enumNames:q(f()).optional(),default:f().optional()}),tf=V([Qd,Yd]),rf=v({type:S("array"),title:f().optional(),description:f().optional(),minItems:D().optional(),maxItems:D().optional(),items:v({type:S("string"),enum:q(f())}),default:q(f()).optional()}),of=v({type:S("array"),title:f().optional(),description:f().optional(),minItems:D().optional(),maxItems:D().optional(),items:v({anyOf:q(v({const:f(),title:f()}))}),default:q(f()).optional()}),nf=V([rf,of]),sf=V([ef,tf,nf]),af=V([sf,Jd,Wd,Xd]),cf=Zt.extend({mode:S("form").optional(),message:f(),requestedSchema:v({type:S("object"),properties:F(f(),af),required:q(f()).optional()})}),lf=Zt.extend({mode:S("url"),message:f(),elicitationId:f(),url:f().url()}),uf=V([cf,lf]),df=X.extend({method:S("elicitation/create"),params:uf}),ff=he.extend({elicitationId:f()}),pf=ge.extend({method:S("notifications/elicitation/complete"),params:ff}),_t=Q.extend({action:pe(["accept","decline","cancel"]),content:Yo(t=>t===null?void 0:t,F(f(),V([f(),D(),W(),q(f())])).optional())}),mf=v({type:S("ref/resource"),uri:f()});var hf=v({type:S("ref/prompt"),name:f()}),gf=me.extend({ref:V([hf,mf]),argument:v({name:f(),value:f()}),context:v({arguments:F(f(),f()).optional()}).optional()}),Xr=X.extend({method:S("completion/complete"),params:gf});function pa(t){if(t.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`)}function ma(t){if(t.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`)}var yf=Q.extend({completion:se({values:q(f()).max(100),total:K(D().int()),hasMore:K(W())})}),_f=v({uri:f().startsWith("file://"),name:f().optional(),_meta:F(f(),G()).optional()}),$f=X.extend({method:S("roots/list"),params:me.optional()}),vn=Q.extend({roots:q(_f)}),vf=ge.extend({method:S("notifications/roots/list_changed"),params:he.optional()}),Gv=V([Nr,un,Xr,_n,Br,Gr,Hr,Vr,Kr,_d,vd,yt,Jr,Ar,Lr,Zr,Ur]),Bv=V([jr,Or,dn,vf,Gt]),Jv=V([qr,Wt,$n,_t,vn,Dr,Fr,ht]),Wv=V([Nr,Bd,df,$f,Ar,Lr,Zr,Ur]),Xv=V([jr,Or,Ld,bd,gd,Od,Cd,Gt,pf]),Qv=V([qr,sd,yf,Id,kd,fd,pd,hd,Wr,jd,Dr,Fr,ht]),b=class t extends Error{constructor(e,r,o){super(`MCP error ${e}: ${r}`),this.code=e,this.data=o,this.name="McpError"}static fromError(e,r,o){if(e===E.UrlElicitationRequired&&o){let n=o;if(n.elicitations)return new on(n.elicitations,r)}return new t(e,r,o)}},on=class extends b{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(E.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function Fe(t){return t==="completed"||t==="failed"||t==="cancelled"}function wf(t){return!t||t==="jsonSchema7"||t==="draft-7"?"draft-7":t==="jsonSchema2019-09"||t==="draft-2020-12"?"draft-2020-12":"draft-7"}function wn(t,e){return ze(t)?Wo(t,{target:wf(e?.target),io:e?.pipeStrategy??"input"}):Zi(t,{strictUnions:e?.strictUnions??!0,pipeStrategy:e?.pipeStrategy??"input"})}function bn(t){let r=Le(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let o=pt(r);if(typeof o!="string")throw new Error("Schema method literal must be a string");return o}function Sn(t,e){let r=De(t,e);if(!r.success)throw r.error;return r.data}var bf=6e4,Qr=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(jr,r=>{this._oncancel(r)}),this.setNotificationHandler(Or,r=>{this._onprogress(r)}),this.setRequestHandler(Nr,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Ar,async(r,o)=>{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new b(E.InvalidParams,"Failed to retrieve task: Task not found");return{...n}}),this.setRequestHandler(Lr,async(r,o)=>{let n=async()=>{let s=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,o.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),a.type==="response")l(c);else{let d=c,p=new b(d.error.code,d.error.message,d.error.data);l(p)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:o.requestId})}}let i=await this._taskStore.getTask(s,o.sessionId);if(!i)throw new b(E.InvalidParams,`Task not found: ${s}`);if(!Fe(i.status))return await this._waitForTaskUpdate(s,o.signal),await n();if(Fe(i.status)){let a=await this._taskStore.getTaskResult(s,o.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[Ze]:{taskId:s}}}}return await n()};return await n()}),this.setRequestHandler(Zr,async(r,o)=>{try{let{tasks:n,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,o.sessionId);return{tasks:n,nextCursor:s,_meta:{}}}catch(n){throw new b(E.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(Ur,async(r,o)=>{try{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new b(E.InvalidParams,`Task not found: ${r.params.taskId}`);if(Fe(n.status))throw new b(E.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",o.sessionId),this._clearTaskQueue(r.params.taskId);let s=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!s)throw new b(E.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(n){throw n instanceof b?n:new b(E.InvalidRequest,`Failed to cancel task: ${n instanceof Error?n.message:String(n)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,o,n,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,r),startTime:Date.now(),timeout:r,maxTotalTimeout:o,resetTimeoutOnProgress:s,onTimeout:n})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let o=Date.now()-r.startTime;if(r.maxTotalTimeout&&o>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),b.fromError(E.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:o});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let o=this.transport?.onerror;this._transport.onerror=s=>{o?.(s),this._onerror(s)};let n=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{n?.(s,i),Ft(s)||na(s)?this._onresponse(s):an(s)?this._onrequest(s,i):oa(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();for(let o of this._requestHandlerAbortControllers.values())o.abort();this._requestHandlerAbortControllers.clear();let r=b.fromError(E.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let o of e.values())o(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(o=>this._onerror(new Error(`Uncaught error in notification handler: ${o}`)))}_onrequest(e,r){let o=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,n=this._transport,s=e.params?._meta?.[Ze]?.taskId;if(o===void 0){let l={jsonrpc:"2.0",id:e.id,error:{code:E.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:l,timestamp:Date.now()},n?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):n?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let a=ea(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,n?.sessionId):void 0,u={signal:i.signal,sessionId:n?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{if(i.signal.aborted)return;let d={relatedRequestId:e.id};s&&(d.relatedTask={taskId:s}),await this.notification(l,d)},sendRequest:async(l,d,p)=>{if(i.signal.aborted)throw new b(E.ConnectionClosed,"Request was cancelled");let m={...p,relatedRequestId:e.id};s&&!m.relatedTask&&(m.relatedTask={taskId:s});let h=m.relatedTask?.taskId??s;return h&&c&&await c.updateTaskStatus(h,"input_required"),await this.request(l,d,m)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:s,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(e.method)}).then(()=>o(e,u)).then(async l=>{if(i.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:e.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)},async l=>{if(i.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:E.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===i&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...o}=e.params,n=Number(r),s=this._progressHandlers.get(n);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(n),a=this._timeoutInfo.get(n);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(c){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),i(c);return}s(o)}_onresponse(e){let r=Number(e.id),o=this._requestResolvers.get(r);if(o){if(this._requestResolvers.delete(r),Ft(e))o(e);else{let i=new b(e.error.code,e.error.message,e.error.data);o(i)}return}let n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let s=!1;if(Ft(e)&&e.result&&typeof e.result=="object"){let i=e.result;if(i.task&&typeof i.task=="object"){let a=i.task;typeof a.taskId=="string"&&(s=!0,this._taskProgressTokens.set(a.taskId,r))}}if(s||this._progressHandlers.delete(r),Ft(e))n(e);else{let i=b.fromError(e.error.code,e.error.message,e.error.data);n(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,o){let{task:n}=o??{};if(!n){try{yield{type:"result",result:await this.request(e,r,o)}}catch(i){yield{type:"error",error:i instanceof b?i:new b(E.InternalError,String(i))}}return}let s;try{let i=await this.request(e,ht,o);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new b(E.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},o);if(yield{type:"taskStatus",task:a},Fe(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)}:a.status==="failed"?yield{type:"error",error:new b(E.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new b(E.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),o?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof b?i:new b(E.InternalError,String(i))}}}request(e,r,o){let{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=o??{};return new Promise((u,l)=>{let d=w=>{l(w)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(w){d(w);return}o?.signal?.throwIfAborted();let p=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:p};o?.onprogress&&(this._progressHandlers.set(p,o.onprogress),m.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),a&&(m.params={...m.params,task:a}),c&&(m.params={...m.params,_meta:{...m.params?._meta||{},[Ze]:c}});let h=w=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(w)}},{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(O=>this._onerror(new Error(`Failed to send cancellation: ${O}`)));let k=w instanceof b?w:new b(E.RequestTimeout,String(w));l(k)};this._responseHandlers.set(p,w=>{if(!o?.signal?.aborted){if(w instanceof Error)return l(w);try{let k=De(r,w.result);k.success?u(k.data):l(k.error)}catch(k){l(k)}}}),o?.signal?.addEventListener("abort",()=>{h(o?.signal?.reason)});let g=o?.timeout??bf,y=()=>h(b.fromError(E.RequestTimeout,"Request timed out",{timeout:g}));this._setupTimeout(p,g,o?.maxTotalTimeout,y,o?.resetTimeoutOnProgress??!1);let _=c?.taskId;if(_){let w=k=>{let O=this._responseHandlers.get(p);O?O(k):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,w),this._enqueueTaskMessage(_,{type:"request",message:m,timestamp:Date.now()}).catch(k=>{this._cleanupTimeout(p),l(k)})}else this._transport.send(m,{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(w=>{this._cleanupTimeout(p),l(w)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Dr,r)}async getTaskResult(e,r,o){return this.request({method:"tasks/result",params:e},r,o)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Fr,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},aa,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let o=r?.relatedTask?.taskId;if(o){let a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[Ze]:r.relatedTask}}};await this._enqueueTaskMessage(o,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[Ze]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let i={...e,jsonrpc:"2.0"};r?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[Ze]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(e,r){let o=bn(e);this.assertRequestHandlerCapability(o),this._requestHandlers.set(o,(n,s)=>{let i=Sn(e,n);return Promise.resolve(r(i,s))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let o=bn(e);this._notificationHandlers.set(o,n=>{let s=Sn(e,n);return Promise.resolve(r(s))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,o){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let n=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,o,n)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let o=await this._taskMessageQueue.dequeueAll(e,r);for(let n of o)if(n.type==="request"&&an(n.message)){let s=n.message.id,i=this._requestResolvers.get(s);i?(i(new b(E.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let o=this._options?.defaultTaskPollInterval??1e3;try{let n=await this._taskStore?.getTask(e);n?.pollInterval&&(o=n.pollInterval)}catch{}return new Promise((n,s)=>{if(r.aborted){s(new b(E.InvalidRequest,"Request cancelled"));return}let i=setTimeout(n,o);r.addEventListener("abort",()=>{clearTimeout(i),s(new b(E.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let o=this._taskStore;if(!o)throw new Error("No task store configured");return{createTask:async n=>{if(!e)throw new Error("No request provided");return await o.createTask(n,e.id,{method:e.method,params:e.params},r)},getTask:async n=>{let s=await o.getTask(n,r);if(!s)throw new b(E.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(n,s,i)=>{await o.storeTaskResult(n,s,i,r);let a=await o.getTask(n,r);if(a){let c=Gt.parse({method:"notifications/tasks/status",params:a});await this.notification(c),Fe(a.status)&&this._cleanupTaskProgressHandler(n)}},getTaskResult:n=>o.getTaskResult(n,r),updateTaskStatus:async(n,s,i)=>{let a=await o.getTask(n,r);if(!a)throw new b(E.InvalidParams,`Task "${n}" not found - it may have been cleaned up`);if(Fe(a.status))throw new b(E.InvalidParams,`Cannot update task "${n}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await o.updateTaskStatus(n,s,i,r);let c=await o.getTask(n,r);if(c){let u=Gt.parse({method:"notifications/tasks/status",params:c});await this.notification(u),Fe(c.status)&&this._cleanupTaskProgressHandler(n)}},listTasks:n=>o.listTasks(n,r)}}};function ha(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function ga(t,e){let r={...t};for(let o in e){let n=o,s=e[n];if(s===void 0)continue;let i=r[n];ha(i)&&ha(s)?r[n]={...i,...s}:r[n]=s}return r}var hu=Ti(hi(),1),gu=Ti(mu(),1);function M_(){let t=new hu.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,gu.default)(t),t}var No=class{constructor(e){this._ajv=e??M_()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return o=>r(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var Oo=class{constructor(e){this._server=e}requestStream(e,r,o){return this._server.requestStream(e,r,o)}createMessageStream(e,r){let o=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!o?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let n=e.messages[e.messages.length-1],s=Array.isArray(n.content)?n.content:[n.content],i=s.some(l=>l.type==="tool_result"),a=e.messages.length>1?e.messages[e.messages.length-2]:void 0,c=a?Array.isArray(a.content)?a.content:[a.content]:[],u=c.some(l=>l.type==="tool_use");if(i){if(s.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let l=new Set(c.filter(p=>p.type==="tool_use").map(p=>p.id)),d=new Set(s.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(l.size!==d.size||![...l].every(p=>d.has(p)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},Wt,r)}elicitInputStream(e,r){let o=this._server.getClientCapabilities(),n=e.mode??"form";switch(n){case"url":{if(!o?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!o?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let s=n==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:s},_t,r)}async getTask(e,r){return this._server.getTask({taskId:e},r)}async getTaskResult(e,r,o){return this._server.getTaskResult({taskId:e},r,o)}async listTasks(e,r){return this._server.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._server.cancelTask({taskId:e},r)}};function yu(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function _u(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}var Ao=class extends Qr{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Jt.options.map((o,n)=>[o,n])),this.isMessageIgnored=(o,n)=>{let s=this._loggingLevels.get(n);return s?this.LOG_LEVEL_SEVERITY.get(o)<this.LOG_LEVEL_SEVERITY.get(s):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new No,this.setRequestHandler(un,o=>this._oninitialize(o)),this.setNotificationHandler(dn,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(_n,async(o,n)=>{let s=n.sessionId||n.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=o.params,a=Jt.safeParse(i);return a.success&&this._loggingLevels.set(s,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Oo(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=ga(this._capabilities,e)}setRequestHandler(e,r){let n=Le(e)?.method;if(!n)throw new Error("Schema is missing a method literal");let s=pt(n);if(typeof s!="string")throw new Error("Schema method literal must be a string");if(s==="tools/call"){let a=async(c,u)=>{let l=De(yt,c);if(!l.success){let h=l.error instanceof Error?l.error.message:String(l.error);throw new b(E.InvalidParams,`Invalid tools/call request: ${h}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let h=De(ht,p);if(!h.success){let g=h.error instanceof Error?h.error.message:String(h.error);throw new b(E.InvalidParams,`Invalid task creation result: ${g}`)}return h.data}let m=De(Wr,p);if(!m.success){let h=m.error instanceof Error?m.error.message:String(m.error);throw new b(E.InvalidParams,`Invalid tools/call result: ${h}`)}return m.data};return super.setRequestHandler(e,a)}return super.setRequestHandler(e,r)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`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 Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`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 Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){_u(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&yu(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Xi.includes(r)?r:nn,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},qr)}async createMessage(e,r){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let o=e.messages[e.messages.length-1],n=Array.isArray(o.content)?o.content:[o.content],s=n.some(u=>u.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],c=a.some(u=>u.type==="tool_use");if(s){if(n.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(a.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(n.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},$n,r):this.request({method:"sampling/createMessage",params:e},Wt,r)}async elicitInput(e,r){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let n=e;return this.request({method:"elicitation/create",params:n},_t,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let n=e.mode==="form"?e:{...e,mode:"form"},s=await this.request({method:"elicitation/create",params:n},_t,r);if(s.action==="accept"&&s.content&&n.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(n.requestedSchema)(s.content);if(!a.valid)throw new b(E.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(i){throw i instanceof b?i:new b(E.InternalError,`Error validating elicitation response: ${i instanceof Error?i.message:String(i)}`)}return s}}}createElicitationCompletionNotifier(e,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},vn,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))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"})}};var vu=Symbol.for("mcp.completable");function Si(t){return!!t&&typeof t=="object"&&vu in t}function wu(t){return t[vu]?.complete}var $u;(function(t){t.Completable="McpCompletable"})($u||($u={}));var q_=/^[A-Za-z0-9._-]{1,128}$/;function j_(t){let e=[];if(t.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(t.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${t.length})`]};if(t.includes(" ")&&e.push("Tool name contains spaces, which may cause parsing issues"),t.includes(",")&&e.push("Tool name contains commas, which may cause parsing issues"),(t.startsWith("-")||t.endsWith("-"))&&e.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(t.startsWith(".")||t.endsWith("."))&&e.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!q_.test(t)){let r=t.split("").filter(o=>!/[A-Za-z0-9._-]/.test(o)).filter((o,n,s)=>s.indexOf(o)===n);return e.push(`Tool name contains invalid characters: ${r.map(o=>`"${o}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:e}}return{isValid:!0,warnings:e}}function N_(t,e){if(e.length>0){console.warn(`Tool name validation warning for "${t}":`);for(let r of e)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function xi(t){let e=j_(t);return N_(t,e.warnings),e.isValid}var Do=class{constructor(e){this._mcpServer=e}registerToolTask(e,r,o){let n={taskSupport:"required",...r.execution};if(n.taskSupport==="forbidden")throw new Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,r.title,r.description,r.inputSchema,r.outputSchema,r.annotations,n,r._meta,o)}};var Lo=class{constructor(e,r){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new Ao(e,r)}get experimental(){return this._experimental||(this._experimental={tasks:new Do(this)}),this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Xe(Jr)),this.server.assertCanSetRequestHandler(Xe(yt)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Jr,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,r])=>{let o={name:e,title:r.title,description:r.description,inputSchema:(()=>{let n=ft(r.inputSchema);return n?wn(n,{strictUnions:!0,pipeStrategy:"input"}):O_})(),annotations:r.annotations,execution:r.execution,_meta:r._meta};if(r.outputSchema){let n=ft(r.outputSchema);n&&(o.outputSchema=wn(n,{strictUnions:!0,pipeStrategy:"output"}))}return o})})),this.server.setRequestHandler(yt,async(e,r)=>{try{let o=this._registeredTools[e.params.name];if(!o)throw new b(E.InvalidParams,`Tool ${e.params.name} not found`);if(!o.enabled)throw new b(E.InvalidParams,`Tool ${e.params.name} disabled`);let n=!!e.params.task,s=o.execution?.taskSupport,i="createTask"in o.handler;if((s==="required"||s==="optional")&&!i)throw new b(E.InternalError,`Tool ${e.params.name} has taskSupport '${s}' but was not registered with registerToolTask`);if(s==="required"&&!n)throw new b(E.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(s==="optional"&&!n&&i)return await this.handleAutomaticTaskPolling(o,e,r);let a=await this.validateToolInput(o,e.params.arguments,e.params.name),c=await this.executeToolHandler(o,a,r);return n||await this.validateToolOutput(o,c,e.params.name),c}catch(o){if(o instanceof b&&o.code===E.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,r,o){if(!e.inputSchema)return;let s=ft(e.inputSchema)??e.inputSchema,i=await Tr(s,r);if(!i.success){let a="error"in i?i.error:"Unknown error",c=Rr(a);throw new b(E.InvalidParams,`Input validation error: Invalid arguments for tool ${o}: ${c}`)}return i.data}async validateToolOutput(e,r,o){if(!e.outputSchema||!("content"in r)||r.isError)return;if(!r.structuredContent)throw new b(E.InvalidParams,`Output validation error: Tool ${o} has an output schema but no structured content was provided`);let n=ft(e.outputSchema),s=await Tr(n,r.structuredContent);if(!s.success){let i="error"in s?s.error:"Unknown error",a=Rr(i);throw new b(E.InvalidParams,`Output validation error: Invalid structured content for tool ${o}: ${a}`)}}async executeToolHandler(e,r,o){let n=e.handler;if("createTask"in n){if(!o.taskStore)throw new Error("No task store provided.");let i={...o,taskStore:o.taskStore};if(e.inputSchema){let a=n;return await Promise.resolve(a.createTask(r,i))}else{let a=n;return await Promise.resolve(a.createTask(i))}}if(e.inputSchema){let i=n;return await Promise.resolve(i(r,o))}else{let i=n;return await Promise.resolve(i(o))}}async handleAutomaticTaskPolling(e,r,o){if(!o.taskStore)throw new Error("No task store provided for task-capable tool.");let n=await this.validateToolInput(e,r.params.arguments,r.params.name),s=e.handler,i={...o,taskStore:o.taskStore},a=n?await Promise.resolve(s.createTask(n,i)):await Promise.resolve(s.createTask(i)),c=a.task.taskId,u=a.task,l=u.pollInterval??5e3;for(;u.status!=="completed"&&u.status!=="failed"&&u.status!=="cancelled";){await new Promise(p=>setTimeout(p,l));let d=await o.taskStore.getTask(c);if(!d)throw new b(E.InternalError,`Task ${c} not found during polling`);u=d}return await o.taskStore.getTaskResult(c)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(Xe(Xr)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(Xr,async e=>{switch(e.params.ref.type){case"ref/prompt":return pa(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return ma(e),this.handleResourceCompletion(e,e.params.ref);default:throw new b(E.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,r){let o=this._registeredPrompts[r.name];if(!o)throw new b(E.InvalidParams,`Prompt ${r.name} not found`);if(!o.enabled)throw new b(E.InvalidParams,`Prompt ${r.name} disabled`);if(!o.argsSchema)return zr;let s=Le(o.argsSchema)?.[e.params.argument.name];if(!Si(s))return zr;let i=wu(s);if(!i)return zr;let a=await i(e.params.argument.value,e.params.context);return Su(a)}async handleResourceCompletion(e,r){let o=Object.values(this._registeredResourceTemplates).find(i=>i.resourceTemplate.uriTemplate.toString()===r.uri);if(!o){if(this._registeredResources[r.uri])return zr;throw new b(E.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let n=o.resourceTemplate.completeCallback(e.params.argument.name);if(!n)return zr;let s=await n(e.params.argument.value,e.params.context);return Su(s)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(Xe(Hr)),this.server.assertCanSetRequestHandler(Xe(Vr)),this.server.assertCanSetRequestHandler(Xe(Kr)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Hr,async(e,r)=>{let o=Object.entries(this._registeredResources).filter(([s,i])=>i.enabled).map(([s,i])=>({uri:s,name:i.name,...i.metadata})),n=[];for(let s of Object.values(this._registeredResourceTemplates)){if(!s.resourceTemplate.listCallback)continue;let i=await s.resourceTemplate.listCallback(r);for(let a of i.resources)n.push({...s.metadata,...a})}return{resources:[...o,...n]}}),this.server.setRequestHandler(Vr,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,o])=>({name:r,uriTemplate:o.resourceTemplate.uriTemplate.toString(),...o.metadata}))})),this.server.setRequestHandler(Kr,async(e,r)=>{let o=new URL(e.params.uri),n=this._registeredResources[o.toString()];if(n){if(!n.enabled)throw new b(E.InvalidParams,`Resource ${o} disabled`);return n.readCallback(o,r)}for(let s of Object.values(this._registeredResourceTemplates)){let i=s.resourceTemplate.uriTemplate.match(o.toString());if(i)return s.readCallback(o,i,r)}throw new b(E.InvalidParams,`Resource ${o} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(Xe(Gr)),this.server.assertCanSetRequestHandler(Xe(Br)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Gr,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,r])=>({name:e,title:r.title,description:r.description,arguments:r.argsSchema?A_(r.argsSchema):void 0}))})),this.server.setRequestHandler(Br,async(e,r)=>{let o=this._registeredPrompts[e.params.name];if(!o)throw new b(E.InvalidParams,`Prompt ${e.params.name} not found`);if(!o.enabled)throw new b(E.InvalidParams,`Prompt ${e.params.name} disabled`);if(o.argsSchema){let n=ft(o.argsSchema),s=await Tr(n,e.params.arguments);if(!s.success){let c="error"in s?s.error:"Unknown error",u=Rr(c);throw new b(E.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${u}`)}let i=s.data,a=o.callback;return await Promise.resolve(a(i,r))}else{let n=o.callback;return await Promise.resolve(n(r))}}),this._promptHandlersInitialized=!0)}resource(e,r,...o){let n;typeof o[0]=="object"&&(n=o.shift());let s=o[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let i=this._createRegisteredResource(e,void 0,r,n,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let i=this._createRegisteredResourceTemplate(e,void 0,r,n,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}registerResource(e,r,o,n){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let s=this._createRegisteredResource(e,o.title,r,o,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let s=this._createRegisteredResourceTemplate(e,o.title,r,o,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}_createRegisteredResource(e,r,o,n,s){let i={name:e,title:r,metadata:n,readCallback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:a=>{typeof a.uri<"u"&&a.uri!==o&&(delete this._registeredResources[o],a.uri&&(this._registeredResources[a.uri]=i)),typeof a.name<"u"&&(i.name=a.name),typeof a.title<"u"&&(i.title=a.title),typeof a.metadata<"u"&&(i.metadata=a.metadata),typeof a.callback<"u"&&(i.readCallback=a.callback),typeof a.enabled<"u"&&(i.enabled=a.enabled),this.sendResourceListChanged()}};return this._registeredResources[o]=i,i}_createRegisteredResourceTemplate(e,r,o,n,s){let i={resourceTemplate:o,title:r,metadata:n,readCallback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:u=>{typeof u.name<"u"&&u.name!==e&&(delete this._registeredResourceTemplates[e],u.name&&(this._registeredResourceTemplates[u.name]=i)),typeof u.title<"u"&&(i.title=u.title),typeof u.template<"u"&&(i.resourceTemplate=u.template),typeof u.metadata<"u"&&(i.metadata=u.metadata),typeof u.callback<"u"&&(i.readCallback=u.callback),typeof u.enabled<"u"&&(i.enabled=u.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=i;let a=o.uriTemplate.variableNames;return Array.isArray(a)&&a.some(u=>!!o.completeCallback(u))&&this.setCompletionRequestHandler(),i}_createRegisteredPrompt(e,r,o,n,s){let i={title:r,description:o,argsSchema:n===void 0?void 0:Qe(n),callback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:a=>{typeof a.name<"u"&&a.name!==e&&(delete this._registeredPrompts[e],a.name&&(this._registeredPrompts[a.name]=i)),typeof a.title<"u"&&(i.title=a.title),typeof a.description<"u"&&(i.description=a.description),typeof a.argsSchema<"u"&&(i.argsSchema=Qe(a.argsSchema)),typeof a.callback<"u"&&(i.callback=a.callback),typeof a.enabled<"u"&&(i.enabled=a.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=i,n&&Object.values(n).some(c=>{let u=c instanceof Ai?c._def?.innerType:c;return Si(u)})&&this.setCompletionRequestHandler(),i}_createRegisteredTool(e,r,o,n,s,i,a,c,u){xi(e);let l={title:r,description:o,inputSchema:bu(n),outputSchema:bu(s),annotations:i,execution:a,_meta:c,handler:u,enabled:!0,disable:()=>l.update({enabled:!1}),enable:()=>l.update({enabled:!0}),remove:()=>l.update({name:null}),update:d=>{typeof d.name<"u"&&d.name!==e&&(typeof d.name=="string"&&xi(d.name),delete this._registeredTools[e],d.name&&(this._registeredTools[d.name]=l)),typeof d.title<"u"&&(l.title=d.title),typeof d.description<"u"&&(l.description=d.description),typeof d.paramsSchema<"u"&&(l.inputSchema=Qe(d.paramsSchema)),typeof d.outputSchema<"u"&&(l.outputSchema=Qe(d.outputSchema)),typeof d.callback<"u"&&(l.handler=d.callback),typeof d.annotations<"u"&&(l.annotations=d.annotations),typeof d._meta<"u"&&(l._meta=d._meta),typeof d.enabled<"u"&&(l.enabled=d.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=l,this.setToolRequestHandlers(),this.sendToolListChanged(),l}tool(e,...r){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let o,n,s,i;if(typeof r[0]=="string"&&(o=r.shift()),r.length>1){let c=r[0];if(ki(c))n=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!ki(r[0])&&(i=r.shift());else if(typeof c=="object"&&c!==null){if(Object.values(c).some(u=>typeof u=="object"&&u!==null))throw new Error(`Tool ${e} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);i=r.shift()}}let a=r[0];return this._createRegisteredTool(e,void 0,o,n,s,i,{taskSupport:"forbidden"},void 0,a)}registerTool(e,r,o){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let{title:n,description:s,inputSchema:i,outputSchema:a,annotations:c,_meta:u}=r;return this._createRegisteredTool(e,n,s,i,a,c,{taskSupport:"forbidden"},u,o)}prompt(e,...r){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let o;typeof r[0]=="string"&&(o=r.shift());let n;r.length>1&&(n=r.shift());let s=r[0],i=this._createRegisteredPrompt(e,void 0,o,n,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}registerPrompt(e,r,o){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let{title:n,description:s,argsSchema:i}=r,a=this._createRegisteredPrompt(e,n,s,i,o);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,r){return this.server.sendLoggingMessage(e,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};var O_={type:"object",properties:{}};function xu(t){return t!==null&&typeof t=="object"&&"parse"in t&&typeof t.parse=="function"&&"safeParse"in t&&typeof t.safeParse=="function"}function ku(t){return"_def"in t||"_zod"in t||xu(t)}function ki(t){return typeof t!="object"||t===null||ku(t)?!1:Object.keys(t).length===0?!0:Object.values(t).some(xu)}function bu(t){if(t){if(ki(t))return Qe(t);if(!ku(t))throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return t}}function A_(t){let e=Le(t);return e?Object.entries(e).map(([r,o])=>{let n=Ji(o),s=Wi(o);return{name:r,description:n,required:!s}}):[]}function Xe(t){let r=Le(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let o=pt(r);if(typeof o=="string")return o;throw new Error("Schema method literal must be a string")}function Su(t){return{completion:{values:t.slice(0,100),total:t.length,hasMore:t.length>100}}}var zr={completion:{values:[],hasMore:!1}};import zu from"node:process";var D_=10*1024*1024,Zo=class{constructor(e){this._maxBufferSize=e?.maxBufferSize??D_}append(e){if((this._buffer?.length??0)+e.length>this._maxBufferSize)throw this.clear(),new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
12
|
+
`);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),L_(r)}clear(){this._buffer=void 0}};function L_(t){return sa.parse(JSON.parse(t))}function Eu(t){return JSON.stringify(t)+`
|
|
13
|
+
`}var Fo=class{constructor(e=zu.stdin,r=zu.stdout,o){this._stdin=e,this._stdout=r,this._started=!1,this._ondata=n=>{try{this._readBuffer.append(n),this.processReadBuffer()}catch(s){this.onerror?.(s),this.close().catch(()=>{})}},this._onerror=n=>{this.onerror?.(n)},this._readBuffer=new Zo({maxBufferSize:o?.maxBufferSize})}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)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(r=>{let o=Eu(e);this._stdout.write(o)?r():this._stdout.once("drain",r)})}};var Tu="io.modelcontextprotocol/skills",Ru=3e5,Z_=512,F_=16*1024*1024;async function U_(){for(let t of["../skills/","./skills/"]){let e=Fi(new URL(t,import.meta.url));if(await Ui(e))return e}return null}var H_={md:"text/markdown",txt:"text/plain",json:"application/json",yaml:"application/yaml",yml:"application/yaml",py:"text/x-python",ts:"text/typescript",js:"text/javascript",sh:"text/x-shellscript",csv:"text/csv",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",svg:"image/svg+xml",pdf:"application/pdf"},V_=t=>H_[t.split(".").pop()?.toLowerCase()??""]??"application/octet-stream";async function K_(t){let e=new Uint8Array(await crypto.subtle.digest("SHA-256",t));return"sha256:"+Array.from(e,r=>r.toString(16).padStart(2,"0")).join("")}function G_(t){let e=/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/.exec(t);if(!e)return null;let r={};for(let o of e[1].split(/\r?\n/)){let n=/^([A-Za-z0-9_-]+):\s*(.*)$/.exec(o);if(!n)continue;let s=n[2].trim();(s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'"))&&(s=s.slice(1,-1)),r[n[1]]=s}return r}async function Iu(t,e,r,o){let n=[];for await(let s of en(t))n.push(s);n.sort((s,i)=>s.name.localeCompare(i.name));for(let s of n){if(s.name.startsWith("."))continue;let i=e?`${e}/${s.name}`:s.name;s.isDirectory?(o.push(i),await Iu(Pr(t,s.name),i,r,o)):s.isFile&&r.push({rel:i,abs:Pr(t,s.name)})}}var Pu=null;function Ot(){return Pu??=(async()=>{let t=await U_();if(!t)return[];let e=[],r=[];for await(let o of en(t))o.isDirectory&&!o.name.startsWith(".")&&r.push(o.name);for(let o of r.sort()){let n=[],s=[];if(await Iu(Pr(t,o),"",n,s),!n.some(u=>u.rel==="SKILL.md"))continue;let i=`skill://${o}`,a=[];for(let u of n){let l=await Hi(u.abs);a.push({uri:`${i}/${u.rel}`,path:u.rel,name:u.rel.split("/").pop(),bytes:l,digest:await K_(l),mimeType:V_(u.rel)})}let c=G_(new TextDecoder().decode(a.find(u=>u.path==="SKILL.md").bytes));!c||c.name!==o||typeof c.description!="string"||a.length>Z_||a.reduce((u,l)=>u+l.bytes.length,0)>F_||e.push({name:o,uri:`${i}/SKILL.md`,root:i,frontmatter:c,files:a,dirs:new Set(["",...s])})}return e})(),Pu}function Cu(t){return{uri:t.uri,frontmatter:t.frontmatter,resources:t.files.map(e=>({uri:e.uri,digest:e.digest,size:e.bytes.length}))}}var Nt=class extends Error{constructor(r,o){super(o);this.code=r}},Mu=-32602;async function qu(){return{resultType:"complete",skills:(await Ot()).map(Cu),ttlMs:Ru,cacheScope:"public"}}async function ju(t){let e=(await Ot()).find(r=>r.uri===t);if(!e)throw new Nt(Mu,`No skill is served at ${String(t)}`);return{resultType:"complete",skill:Cu(e),ttlMs:Ru,cacheScope:"public"}}async function Nu(t){let e=String(t??"").replace(/\/$/,"");for(let r of await Ot()){if(e!==r.root&&!e.startsWith(r.root+"/"))continue;let o=e===r.root?"":e.slice(r.root.length+1);if(!r.dirs.has(o))break;let n=o?o+"/":"",s=[];for(let i of[...r.dirs].sort())i&&i.startsWith(n)&&!i.slice(n.length).includes("/")&&s.push({uri:`${r.root}/${i}`,name:i.slice(n.length),mimeType:"inode/directory"});for(let i of r.files)i.path.startsWith(n)&&!i.path.slice(n.length).includes("/")&&s.push({uri:i.uri,name:i.name,mimeType:i.mimeType});return{resultType:"complete",resources:s}}throw new Nt(Mu,`No skill directory at ${e}`)}async function Ou(){let t=await Ot();return t.length?["Skills: this server ships Agent Skills that say how a conform artist uses these tools. Load the one that fits the task:",...t.map(e=>`- ${e.uri} \u2014 ${e.frontmatter.description}`)].join(`
|
|
14
|
+
`):""}var Ei=await Ot(),B_=[Ki,await Ou()].filter(Boolean).join(`
|
|
15
|
+
`),Ae=new Lo({name:"conformtools",version:Ri},{instructions:B_});for(let t of tn)Ae.registerTool(t.name,{title:t.title,description:t.description,inputSchema:t.inputSchema},async e=>Vi(t.name,await Gi(t.name,e)));if(Ei.length){for(let r of Ei)for(let o of r.files)Ae.registerResource(`${r.name}/${o.path}`,o.uri,{mimeType:o.mimeType,description:o.path==="SKILL.md"?String(r.frontmatter.description):void 0},async()=>o.mimeType.startsWith("text/")||o.mimeType.endsWith("json")||o.mimeType.endsWith("yaml")?{contents:[{uri:o.uri,mimeType:o.mimeType,text:new TextDecoder().decode(o.bytes)}]}:{contents:[{uri:o.uri,mimeType:o.mimeType,blob:btoa(String.fromCharCode(...o.bytes))}]});Ae.server.registerCapabilities({extensions:{[Tu]:{directoryRead:!0}}});let t=async r=>{try{return await r()}catch(o){throw o instanceof Nt?Object.assign(new Error(o.message),{code:o.code}):o}},e=r=>dt.object({method:dt.literal(r),params:dt.object({uri:dt.string().optional(),cursor:dt.string().optional()}).passthrough().optional()});Ae.server.setRequestHandler(e("skills/list"),()=>t(qu)),Ae.server.setRequestHandler(e("skills/get"),r=>t(()=>ju(r.params?.uri))),Ae.server.setRequestHandler(e("resources/directory/read"),r=>t(()=>Nu(r.params?.uri)))}var Du=Ae,Au=Du.validateToolInput?.bind(Ae);Au&&(Du.validateToolInput=async(t,e,r)=>{try{return await Au(t,e,r)}catch(o){throw Bi(r,e),o}});await Ae.connect(new Fo);console.error(`conformtools MCP ready (${tn.length} verbs, ${Ei.length} skills, stdio)`);
|