@sybelblue/prairielearn-navigator 1.2.0 → 1.2.2
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 +37 -1
- package/dist/cli.js +3 -3
- package/dist/shared.js +1 -1
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{styleText as e}from"node:util";import*as t from"node:fs";import*as r from"node:path";var s={3282(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv=void 0;const s=r(4042),n=r(6144),o=r(6653),a=r(2079),i=["/properties"],c="http://json-schema.org/draft-07/schema";class l extends s.default{_addVocabularies(){super._addVocabularies(),n.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const e=this.opts.$data?this.$dataMetaSchema(a,i):a;this.addMetaSchema(e,c,!1),this.refs["http://json-schema.org/schema"]=c}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:void 0)}}t.Ajv=l,e.exports=t=l,e.exports.Ajv=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var d=r(2586);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return d.KeywordCxt}});var u=r(9029);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var f=r(3558);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return f.default}});var h=r(4551);Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return h.default}})},1520(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class r{}t._CodeOrName=r,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class s extends r{constructor(e){if(super(),!t.IDENTIFIER.test(e))throw 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}}}t.Name=s;class n extends r{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const e=this._items[0];return""===e||'""'===e}get str(){var e;return null!==(e=this._str)&&void 0!==e?e:this._str=this._items.reduce((e,t)=>`${e}${t}`,"")}get names(){var e;return null!==(e=this._names)&&void 0!==e?e:this._names=this._items.reduce((e,t)=>(t instanceof s&&(e[t.str]=(e[t.str]||0)+1),e),{})}}function o(e,...t){const r=[e[0]];let s=0;for(;s<t.length;)c(r,t[s]),r.push(e[++s]);return new n(r)}t._Code=n,t.nil=new n(""),t._=o;const a=new n("+");function i(e,...t){const r=[d(e[0])];let s=0;for(;s<t.length;)r.push(a),c(r,t[s]),r.push(a,d(e[++s]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===a){const r=l(e[t-1],e[t+1]);if(void 0!==r){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}(r),new n(r)}function c(e,t){var r;t instanceof n?e.push(...t._items):t instanceof s?e.push(t):e.push("number"==typeof(r=t)||"boolean"==typeof r||null===r?r:d(Array.isArray(r)?r.join(","):r))}function l(e,t){if('""'===t)return e;if('""'===e)return t;if("string"==typeof e){if(t instanceof s||'"'!==e[e.length-1])return;return"string"!=typeof t?`${e.slice(0,-1)}${t}"`:'"'===t[0]?e.slice(0,-1)+t.slice(1):void 0}return"string"!=typeof t||'"'!==t[0]||e instanceof s?void 0:`"${e}${t.slice(1)}`}function d(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.str=i,t.addCodeArg=c,t.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:i`${e}${t}`},t.stringify=function(e){return new n(d(e))},t.safeStringify=d,t.getProperty=function(e){return"string"==typeof e&&t.IDENTIFIER.test(e)?new n(`.${e}`):o`[${e}]`},t.getEsmExportName=function(e){if("string"==typeof e&&t.IDENTIFIER.test(e))return new n(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)},t.regexpCode=function(e){return new n(e.toString())}},9029(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;const s=r(1520),n=r(7845);var o=r(1520);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return o._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return o.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return o.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return o.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return o.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return o.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return o.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return o.Name}});var a=r(7845);Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return a.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return a.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return a.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return a.varKinds}}),t.operators={GT:new s._Code(">"),GTE:new s._Code(">="),LT:new s._Code("<"),LTE:new s._Code("<="),EQ:new s._Code("==="),NEQ:new s._Code("!=="),NOT:new s._Code("!"),OR:new s._Code("||"),AND:new s._Code("&&"),ADD:new s._Code("+")};class i{optimizeNodes(){return this}optimizeNames(e,t){return this}}class c extends i{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){const r=e?n.varKinds.var:this.varKind,s=void 0===this.rhs?"":` = ${this.rhs}`;return`${r} ${this.name}${s};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=C(this.rhs,e,t)),this}get names(){return this.rhs instanceof s._CodeOrName?this.rhs.names:{}}}class l extends i{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(!(this.lhs instanceof s.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=C(this.rhs,e,t),this}get names(){return O(this.lhs instanceof s.Name?{}:{...this.lhs.names},this.rhs)}}class d extends l{constructor(e,t,r,s){super(e,r,s),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class u extends i{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class f extends i{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class h extends i{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class m extends i{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=C(this.code,e,t),this}get names(){return this.code instanceof s._CodeOrName?this.code.names:{}}}class p extends i{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;for(;t--;){const r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){const{nodes:r}=this;let s=r.length;for(;s--;){const n=r[s];n.optimizeNames(e,t)||(I(e,n.names),r.splice(s,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>x(e,t.names),{})}}class y extends p{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class g extends p{}class v extends y{}v.kind="else";class $ extends y{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new v(e):e}return t?!1===e?t instanceof $?t:t.nodes:this.nodes.length?this:new $(R(e),t instanceof $?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var r;if(this.else=null===(r=this.else)||void 0===r?void 0:r.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=C(this.condition,e,t),this}get names(){const e=super.names;return O(e,this.condition),this.else&&x(e,this.else.names),e}}$.kind="if";class w extends y{}w.kind="for";class b extends w{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=C(this.iteration,e,t),this}get names(){return x(super.names,this.iteration.names)}}class _ extends w{constructor(e,t,r,s){super(),this.varKind=e,this.name=t,this.from=r,this.to=s}render(e){const t=e.es5?n.varKinds.var:this.varKind,{name:r,from:s,to:o}=this;return`for(${t} ${r}=${s}; ${r}<${o}; ${r}++)`+super.render(e)}get names(){const e=O(super.names,this.from);return O(e,this.to)}}class S extends w{constructor(e,t,r,s){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=s}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=C(this.iterable,e,t),this}get names(){return x(super.names,this.iterable.names)}}class E extends y{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}E.kind="func";class k extends p{render(e){return"return "+super.render(e)}}k.kind="return";class P extends y{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null===(e=this.catch)||void 0===e||e.optimizeNodes(),null===(t=this.finally)||void 0===t||t.optimizeNodes(),this}optimizeNames(e,t){var r,s;return super.optimizeNames(e,t),null===(r=this.catch)||void 0===r||r.optimizeNames(e,t),null===(s=this.finally)||void 0===s||s.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&x(e,this.catch.names),this.finally&&x(e,this.finally.names),e}}class N extends y{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}N.kind="catch";class j extends y{render(e){return"finally"+super.render(e)}}function x(e,t){for(const r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function O(e,t){return t instanceof s._CodeOrName?x(e,t.names):e}function C(e,t,r){return e instanceof s.Name?o(e):(n=e)instanceof s._Code&&n._items.some(e=>e instanceof s.Name&&1===t[e.str]&&void 0!==r[e.str])?new s._Code(e._items.reduce((e,t)=>(t instanceof s.Name&&(t=o(t)),t instanceof s._Code?e.push(...t._items):e.push(t),e),[])):e;var n;function o(e){const s=r[e.str];return void 0===s||1!==t[e.str]?e:(delete t[e.str],s)}}function I(e,t){for(const r in t)e[r]=(e[r]||0)-(t[r]||0)}function R(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:s._`!${V(e)}`}j.kind="finally",t.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new n.Scope({parent:e}),this._nodes=[new g]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,s){const n=this._scope.toName(t);return void 0!==r&&s&&(this._constants[n.str]=r),this._leafNode(new c(e,n,r)),n}const(e,t,r){return this._def(n.varKinds.const,e,t,r)}let(e,t,r){return this._def(n.varKinds.let,e,t,r)}var(e,t,r){return this._def(n.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new l(e,t,r))}add(e,r){return this._leafNode(new d(e,t.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==s.nil&&this._leafNode(new m(e)),this}object(...e){const t=["{"];for(const[r,n]of e)t.length>1&&t.push(","),t.push(r),(r!==n||this.opts.es5)&&(t.push(":"),(0,s.addCodeArg)(t,n));return t.push("}"),new s._Code(t)}if(e,t,r){if(this._blockNode(new $(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new $(e))}else(){return this._elseNode(new v)}endIf(){return this._endBlockNode($,v)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new b(e),t)}forRange(e,t,r,s,o=(this.opts.es5?n.varKinds.var:n.varKinds.let)){const a=this._scope.toName(e);return this._for(new _(o,a,t,r),()=>s(a))}forOf(e,t,r,o=n.varKinds.const){const a=this._scope.toName(e);if(this.opts.es5){const e=t instanceof s.Name?t:this.var("_arr",t);return this.forRange("_i",0,s._`${e}.length`,t=>{this.var(a,s._`${e}[${t}]`),r(a)})}return this._for(new S("of",o,a,t),()=>r(a))}forIn(e,t,r,o=(this.opts.es5?n.varKinds.var:n.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,s._`Object.keys(${t})`,r);const a=this._scope.toName(e);return this._for(new S("in",o,a,t),()=>r(a))}endFor(){return this._endBlockNode(w)}label(e){return this._leafNode(new u(e))}break(e){return this._leafNode(new f(e))}return(e){const t=new k;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(k)}try(e,t,r){if(!t&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');const s=new P;if(this._blockNode(s),this.code(e),t){const e=this.name("e");this._currNode=s.catch=new N(e),t(e)}return r&&(this._currNode=s.finally=new j,this.code(r)),this._endBlockNode(N,j)}throw(e){return this._leafNode(new h(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){const t=this._blockStarts.pop();if(void 0===t)throw new Error("CodeGen: not in self-balancing block");const r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=s.nil,r,n){return this._blockNode(new E(e,t,r)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(E)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){const r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){const t=this._currNode;if(!(t instanceof $))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){const e=this._nodes;return e[e.length-1]}set _currNode(e){const t=this._nodes;t[t.length-1]=e}},t.not=R;const T=A(t.operators.AND);t.and=function(...e){return e.reduce(T)};const D=A(t.operators.OR);function A(e){return(t,r)=>t===s.nil?r:r===s.nil?t:s._`${V(t)} ${e} ${V(r)}`}function V(e){return e instanceof s.Name?e:s._`(${e})`}t.or=function(...e){return e.reduce(D)}},7845(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const s=r(1520);class n extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}var o;!function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"}(o||(t.UsedValueState=o={})),t.varKinds={const:new s.Name("const"),let:new s.Name("let"),var:new s.Name("var")};class a{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof s.Name?e:this.name(e)}name(e){return new s.Name(this._newName(e))}_newName(e){return`${e}${(this._names[e]||this._nameGroup(e)).index++}`}_nameGroup(e){var t,r;if((null===(r=null===(t=this._parent)||void 0===t?void 0:t._prefixes)||void 0===r?void 0:r.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}}}t.Scope=a;class i extends s.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=s._`.${new s.Name(t)}[${r}]`}}t.ValueScopeName=i;const c=s._`\n`;t.ValueScope=class extends a{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?c:s.nil}}get(){return this._scope}name(e){return new i(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw new Error("CodeGen: ref must be passed in value");const s=this.toName(e),{prefix:n}=s,o=null!==(r=t.key)&&void 0!==r?r:t.ref;let a=this._values[n];if(a){const e=a.get(o);if(e)return e}else a=this._values[n]=new Map;a.set(o,s);const i=this._scope[n]||(this._scope[n]=[]),c=i.length;return i[c]=t.ref,s.setValue(t,{property:n,itemIndex:c}),s}getValue(e,t){const r=this._values[e];if(r)return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,t=>{if(void 0===t.scopePath)throw new Error(`CodeGen: name "${t}" has no value`);return s._`${e}${t.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,e=>{if(void 0===e.value)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,r)}_reduceValues(e,r,a={},i){let c=s.nil;for(const l in e){const d=e[l];if(!d)continue;const u=a[l]=a[l]||new Map;d.forEach(e=>{if(u.has(e))return;u.set(e,o.Started);let a=r(e);if(a){const r=this.opts.es5?t.varKinds.var:t.varKinds.const;c=s._`${c}${r} ${e} = ${a};${this.opts._n}`}else{if(!(a=null==i?void 0:i(e)))throw new n(e);c=s._`${c}${a}${this.opts._n}`}u.set(e,o.Completed)})}return c}}},8708(e,t,r){t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.y=void 0;const s=r(9029),n=r(4227),o=r(2023);function a(e,t){const r=e.const("err",t);e.if(s._`${o.default.vErrors} === null`,()=>e.assign(o.default.vErrors,s._`[${r}]`),s._`${o.default.vErrors}.push(${r})`),e.code(s._`${o.default.errors}++`)}function i(e,t){const{gen:r,validateName:n,schemaEnv:o}=e;o.$async?r.throw(s._`new ${e.ValidationError}(${t})`):(r.assign(s._`${n}.errors`,t),r.return(!1))}t.y={message:({keyword:e})=>s.str`must pass "${e}" keyword validation`},t.keyword$DataError={message:({keyword:e,schemaType:t})=>t?s.str`"${e}" keyword must be ${t} ($data)`:s.str`"${e}" keyword is invalid ($data)`},t.reportError=function(e,r=t.y,n,o){const{it:c}=e,{gen:d,compositeRule:u,allErrors:f}=c,h=l(e,r,n);(null!=o?o:u||f)?a(d,h):i(c,s._`[${h}]`)},t.reportExtraError=function(e,r=t.y,s){const{it:n}=e,{gen:c,compositeRule:d,allErrors:u}=n;a(c,l(e,r,s)),d||u||i(n,o.default.vErrors)},t.resetErrorsCount=function(e,t){e.assign(o.default.errors,t),e.if(s._`${o.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(s._`${o.default.vErrors}.length`,t),()=>e.assign(o.default.vErrors,null)))},t.extendErrors=function({gen:e,keyword:t,schemaValue:r,data:n,errsCount:a,it:i}){if(void 0===a)throw new Error("ajv implementation error");const c=e.name("err");e.forRange("i",a,o.default.errors,a=>{e.const(c,s._`${o.default.vErrors}[${a}]`),e.if(s._`${c}.instancePath === undefined`,()=>e.assign(s._`${c}.instancePath`,(0,s.strConcat)(o.default.instancePath,i.errorPath))),e.assign(s._`${c}.schemaPath`,s.str`${i.errSchemaPath}/${t}`),i.opts.verbose&&(e.assign(s._`${c}.schema`,r),e.assign(s._`${c}.data`,n))})};const c={keyword:new s.Name("keyword"),schemaPath:new s.Name("schemaPath"),params:new s.Name("params"),propertyName:new s.Name("propertyName"),message:new s.Name("message"),schema:new s.Name("schema"),parentSchema:new s.Name("parentSchema")};function l(e,t,r){const{createErrors:n}=e.it;return!1===n?s._`{}`:function(e,t,r={}){const{gen:n,it:a}=e,i=[d(a,r),u(e,r)];return function(e,{params:t,message:r},n){const{keyword:a,data:i,schemaValue:l,it:d}=e,{opts:u,propertyName:f,topSchemaRef:h,schemaPath:m}=d;n.push([c.keyword,a],[c.params,"function"==typeof t?t(e):t||s._`{}`]),u.messages&&n.push([c.message,"function"==typeof r?r(e):r]),u.verbose&&n.push([c.schema,l],[c.parentSchema,s._`${h}${m}`],[o.default.data,i]),f&&n.push([c.propertyName,f])}(e,t,i),n.object(...i)}(e,t,r)}function d({errorPath:e},{instancePath:t}){const r=t?s.str`${e}${(0,n.getErrorPath)(t,n.Type.Str)}`:e;return[o.default.instancePath,(0,s.strConcat)(o.default.instancePath,r)]}function u({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:o}){let a=o?t:s.str`${t}/${e}`;return r&&(a=s.str`${a}${(0,n.getErrorPath)(r,n.Type.Str)}`),[c.schemaPath,a]}},3835(e,t,r){t.resolveSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;const s=r(9029),n=r(3558),o=r(2023),a=r(6939),i=r(4227),c=r(2586);class l{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!==(t=e.baseId)&&void 0!==t?t:(0,a.normalizeId)(null==r?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}}function d(e){const t=f.call(this,e);if(t)return t;const r=(0,a.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:i,lines:l}=this.opts.code,{ownProperties:d}=this.opts,u=new s.CodeGen(this.scope,{es5:i,lines:l,ownProperties:d});let h;e.$async&&(h=u.scopeValue("Error",{ref:n.default,code:s._`require("ajv/dist/runtime/validation_error").default`}));const m=u.scopeName("validate");e.validateName=m;const p={gen:u,allErrors:this.opts.allErrors,data:o.default.data,parentData:o.default.parentData,parentDataProperty:o.default.parentDataProperty,dataNames:[o.default.data],dataPathArr:[s.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:u.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,s.stringify)(e.schema)}:{ref:e.schema}),validateName:m,ValidationError:h,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:s.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:s._`""`,opts:this.opts,self:this};let y;try{this._compilations.add(e),(0,c.validateFunctionCode)(p),u.optimize(this.opts.code.optimize);const t=u.toString();y=`${u.scopeRefs(o.default.scope)}return ${t}`,this.opts.code.process&&(y=this.opts.code.process(y,e));const r=new Function(`${o.default.self}`,`${o.default.scope}`,y)(this,this.scope.get());if(this.scope.value(m,{ref:r}),r.errors=null,r.schema=e.schema,r.schemaEnv=e,e.$async&&(r.$async=!0),!0===this.opts.code.source&&(r.source={validateName:m,validateCode:t,scopeValues:u._values}),this.opts.unevaluated){const{props:e,items:t}=p;r.evaluated={props:e instanceof s.Name?void 0:e,items:t instanceof s.Name?void 0:t,dynamicProps:e instanceof s.Name,dynamicItems:t instanceof s.Name},r.source&&(r.source.evaluated=(0,s.stringify)(r.evaluated))}return e.validate=r,e}catch(t){throw delete e.validate,delete e.validateName,y&&this.logger.error("Error compiling schema, function code:",y),t}finally{this._compilations.delete(e)}}function u(e){return(0,a.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:d.call(this,e)}function f(e){for(const t of this._compilations)if(h(t,e))return t}function h(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function m(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||p.call(this,e,t)}function p(e,t){const r=this.opts.uriResolver.parse(t),s=(0,a._getFullPath)(this.opts.uriResolver,r);let n=(0,a.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&s===n)return g.call(this,r,e);const o=(0,a.normalizeId)(s),i=this.refs[o]||this.schemas[o];if("string"==typeof i){const t=p.call(this,e,i);if("object"!=typeof(null==t?void 0:t.schema))return;return g.call(this,r,t)}if("object"==typeof(null==i?void 0:i.schema)){if(i.validate||d.call(this,i),o===(0,a.normalizeId)(t)){const{schema:t}=i,{schemaId:r}=this.opts,s=t[r];return s&&(n=(0,a.resolveUrl)(this.opts.uriResolver,n,s)),new l({schema:t,schemaId:r,root:e,baseId:n})}return g.call(this,r,i)}}t.SchemaEnv=l,t.compileSchema=d,t.resolveRef=function(e,t,r){var s;r=(0,a.resolveUrl)(this.opts.uriResolver,t,r);const n=e.refs[r];if(n)return n;let o=m.call(this,e,r);if(void 0===o){const n=null===(s=e.localRefs)||void 0===s?void 0:s[r],{schemaId:a}=this.opts;n&&(o=new l({schema:n,schemaId:a,root:e,baseId:t}))}return void 0!==o?e.refs[r]=u.call(this,o):void 0},t.resolveSchema=p;const y=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function g(e,{baseId:t,schema:r,root:s}){var n;if("/"!==(null===(n=e.fragment)||void 0===n?void 0:n[0]))return;for(const s of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;const e=r[(0,i.unescapeFragment)(s)];if(void 0===e)return;const n="object"==typeof(r=e)&&r[this.opts.schemaId];!y.has(s)&&n&&(t=(0,a.resolveUrl)(this.opts.uriResolver,t,n))}let o;if("boolean"!=typeof r&&r.$ref&&!(0,i.schemaHasRulesButRef)(r,this.RULES)){const e=(0,a.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=p.call(this,s,e)}const{schemaId:c}=this.opts;return o=o||new l({schema:r,schemaId:c,root:s,baseId:t}),o.schema!==o.root.schema?o:void 0}},2023(e,t,r){const s=r(9029),n={data:new s.Name("data"),valCxt:new s.Name("valCxt"),instancePath:new s.Name("instancePath"),parentData:new s.Name("parentData"),parentDataProperty:new s.Name("parentDataProperty"),rootData:new s.Name("rootData"),dynamicAnchors:new s.Name("dynamicAnchors"),vErrors:new s.Name("vErrors"),errors:new s.Name("errors"),this:new s.Name("this"),self:new s.Name("self"),scope:new s.Name("scope"),json:new s.Name("json"),jsonPos:new s.Name("jsonPos"),jsonLen:new s.Name("jsonLen"),jsonPart:new s.Name("jsonPart")};t.default=n},4551(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});const s=r(6939);class n extends Error{constructor(e,t,r,n){super(n||`can't resolve reference ${r} from id ${t}`),this.missingRef=(0,s.resolveUrl)(e,t,r),this.missingSchema=(0,s.normalizeId)((0,s.getFullPath)(e,this.missingRef))}}t.default=n},6939(e,t,r){t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;const s=r(4227),n=r(2017),o=r(7106),a=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);t.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!c(e):!!t&&l(e)<=t)};const i=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function c(e){for(const t in e){if(i.has(t))return!0;const r=e[t];if(Array.isArray(r)&&r.some(c))return!0;if("object"==typeof r&&c(r))return!0}return!1}function l(e){let t=0;for(const r in e){if("$ref"===r)return 1/0;if(t++,!a.has(r)&&("object"==typeof e[r]&&(0,s.eachItem)(e[r],e=>t+=l(e)),t===1/0))return 1/0}return t}function d(e,t="",r){!1!==r&&(t=h(t));const s=e.parse(t);return u(e,s)}function u(e,t){return e.serialize(t).split("#")[0]+"#"}t.getFullPath=d,t._getFullPath=u;const f=/#\/?$/;function h(e){return e?e.replace(f,""):""}t.normalizeId=h,t.resolveUrl=function(e,t,r){return r=h(r),e.resolve(t,r)};const m=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};const{schemaId:r,uriResolver:s}=this.opts,a=h(e[r]||t),i={"":a},c=d(s,a,!1),l={},u=new Set;return o(e,{allKeys:!0},(e,t,s,n)=>{if(void 0===n)return;const o=c+t;let a=i[n];function d(t){const r=this.opts.uriResolver.resolve;if(t=h(a?r(a,t):t),u.has(t))throw p(t);u.add(t);let s=this.refs[t];return"string"==typeof s&&(s=this.refs[s]),"object"==typeof s?f(e,s.schema,t):t!==h(o)&&("#"===t[0]?(f(e,l[t],t),l[t]=e):this.refs[t]=o),t}function y(e){if("string"==typeof e){if(!m.test(e))throw new Error(`invalid anchor "${e}"`);d.call(this,`#${e}`)}}"string"==typeof e[r]&&(a=d.call(this,e[r])),y.call(this,e.$anchor),y.call(this,e.$dynamicAnchor),i[t]=a}),l;function f(e,t,r){if(void 0!==t&&!n(e,t))throw p(r)}function p(e){return new Error(`reference "${e}" resolves to more than one schema`)}}},396(e,t){t.getRules=t.isJSONType=void 0;const r=new Set(["string","number","integer","boolean","null","object","array"]);t.isJSONType=function(e){return"string"==typeof e&&r.has(e)},t.getRules=function(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}},4227(e,t,r){t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;const s=r(9029),n=r(1520);function o(e,t=e.schema){const{opts:r,self:s}=e;if(!r.strictSchema)return;if("boolean"==typeof t)return;const n=s.RULES.keywords;for(const r in t)n[r]||h(e,`unknown keyword: "${r}"`)}function a(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function i(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function c({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,a,i,c)=>{const l=void 0===i?a:i instanceof s.Name?(a instanceof s.Name?e(o,a,i):t(o,a,i),i):a instanceof s.Name?(t(o,i,a),a):r(a,i);return c!==s.Name||l instanceof s.Name?l:n(o,l)}}function l(e,t){if(!0===t)return e.var("props",!0);const r=e.var("props",s._`{}`);return void 0!==t&&d(e,r,t),r}function d(e,t,r){Object.keys(r).forEach(r=>e.assign(s._`${t}${(0,s.getProperty)(r)}`,!0))}t.toHash=function(e){const t={};for(const r of e)t[r]=!0;return t},t.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(o(e,t),!function(e,t){if("boolean"==typeof e)return!e;for(const r in e)if(t[r])return!0;return!1}(t,e.self.RULES.all))},t.checkUnknownRules=o,t.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(const r in e)if("$ref"!==r&&t.all[r])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if("number"==typeof r||"boolean"==typeof r)return r;if("string"==typeof r)return s._`${r}`}return s._`${e}${t}${(0,s.getProperty)(n)}`},t.unescapeFragment=function(e){return i(decodeURIComponent(e))},t.escapeFragment=function(e){return encodeURIComponent(a(e))},t.unescapeJsonPointer=i,t.eachItem=function(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)},t.mergeEvaluated={props:c({mergeNames:(e,t,r)=>e.if(s._`${r} !== true && ${t} !== undefined`,()=>{e.if(s._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,s._`${r} || {}`).code(s._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(s._`${r} !== true`,()=>{!0===t?e.assign(r,!0):(e.assign(r,s._`${r} || {}`),d(e,r,t))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:l}),items:c({mergeNames:(e,t,r)=>e.if(s._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,s._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(s._`${r} !== true`,()=>e.assign(r,!0===t||s._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},t.evaluatedPropsToName=l;const u={};var f;function h(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw new Error(t);e.self.logger.warn(t)}}t.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:u[t.code]||(u[t.code]=new n._Code(t.code))})},function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(f||(t.Type=f={})),t.getErrorPath=function(e,t,r){if(e instanceof s.Name){const n=t===f.Num;return r?n?s._`"[" + ${e} + "]"`:s._`"['" + ${e} + "']"`:n?s._`"/" + ${e}`:s._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,s.getProperty)(e).toString():"/"+a(e)},t.checkStrictMode=h},7887(e,t){function r(e,t){return t.rules.some(t=>s(e,t))}function s(e,t){var r;return void 0!==e[t.keyword]||(null===(r=t.definition.implements)||void 0===r?void 0:r.some(t=>void 0!==e[t]))}t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0,t.schemaHasRulesForType=function({schema:e,self:t},s){const n=t.RULES.types[s];return n&&!0!==n&&r(e,n)},t.shouldUseGroup=r,t.shouldUseRule=s},8727(e,t,r){t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;const s=r(8708),n=r(9029),o=r(2023),a={message:"boolean schema is false"};function i(e,t){const{gen:r,data:n}=e,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,s.reportError)(o,a,void 0,t)}t.topBoolOrEmptySchema=function(e){const{gen:t,schema:r,validateName:s}=e;!1===r?i(e,!1):"object"==typeof r&&!0===r.$async?t.return(o.default.data):(t.assign(n._`${s}.errors`,null),t.return(!0))},t.boolOrEmptySchema=function(e,t){const{gen:r,schema:s}=e;!1===s?(r.var(t,!1),i(e)):r.var(t,!0)}},208(e,t,r){t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;const s=r(396),n=r(7887),o=r(8708),a=r(9029),i=r(4227);var c;function l(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(s.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}!function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"}(c||(t.DataType=c={})),t.getSchemaTypes=function(e){const t=l(e.type);if(t.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},t.getJSONTypes=l,t.coerceAndCheckDataType=function(e,t){const{gen:r,data:s,opts:o}=e,i=function(e,t){return t?e.filter(e=>d.has(e)||"array"===t&&"array"===e):[]}(t,o.coerceTypes),l=t.length>0&&!(0===i.length&&1===t.length&&(0,n.schemaHasRulesForType)(e,t[0]));if(l){const n=f(t,s,o.strictNumbers,c.Wrong);r.if(n,()=>{i.length?function(e,t,r){const{gen:s,data:n,opts:o}=e,i=s.let("dataType",a._`typeof ${n}`),c=s.let("coerced",a._`undefined`);"array"===o.coerceTypes&&s.if(a._`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>s.assign(n,a._`${n}[0]`).assign(i,a._`typeof ${n}`).if(f(t,n,o.strictNumbers),()=>s.assign(c,n))),s.if(a._`${c} !== undefined`);for(const e of r)(d.has(e)||"array"===e&&"array"===o.coerceTypes)&&l(e);function l(e){switch(e){case"string":return void s.elseIf(a._`${i} == "number" || ${i} == "boolean"`).assign(c,a._`"" + ${n}`).elseIf(a._`${n} === null`).assign(c,a._`""`);case"number":return void s.elseIf(a._`${i} == "boolean" || ${n} === null
|
|
2
|
+
import{styleText as e}from"node:util";import*as t from"node:fs";import*as r from"node:path";var s={3282(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv=void 0;const s=r(4042),n=r(6144),o=r(6653),a=r(2079),i=["/properties"],c="http://json-schema.org/draft-07/schema";class l extends s.default{_addVocabularies(){super._addVocabularies(),n.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const e=this.opts.$data?this.$dataMetaSchema(a,i):a;this.addMetaSchema(e,c,!1),this.refs["http://json-schema.org/schema"]=c}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:void 0)}}t.Ajv=l,e.exports=t=l,e.exports.Ajv=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var d=r(2586);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return d.KeywordCxt}});var u=r(9029);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var f=r(3558);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return f.default}});var h=r(4551);Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return h.default}})},1520(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class r{}t._CodeOrName=r,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class s extends r{constructor(e){if(super(),!t.IDENTIFIER.test(e))throw 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}}}t.Name=s;class n extends r{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const e=this._items[0];return""===e||'""'===e}get str(){var e;return null!==(e=this._str)&&void 0!==e?e:this._str=this._items.reduce((e,t)=>`${e}${t}`,"")}get names(){var e;return null!==(e=this._names)&&void 0!==e?e:this._names=this._items.reduce((e,t)=>(t instanceof s&&(e[t.str]=(e[t.str]||0)+1),e),{})}}function o(e,...t){const r=[e[0]];let s=0;for(;s<t.length;)c(r,t[s]),r.push(e[++s]);return new n(r)}t._Code=n,t.nil=new n(""),t._=o;const a=new n("+");function i(e,...t){const r=[d(e[0])];let s=0;for(;s<t.length;)r.push(a),c(r,t[s]),r.push(a,d(e[++s]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===a){const r=l(e[t-1],e[t+1]);if(void 0!==r){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}(r),new n(r)}function c(e,t){var r;t instanceof n?e.push(...t._items):t instanceof s?e.push(t):e.push("number"==typeof(r=t)||"boolean"==typeof r||null===r?r:d(Array.isArray(r)?r.join(","):r))}function l(e,t){if('""'===t)return e;if('""'===e)return t;if("string"==typeof e){if(t instanceof s||'"'!==e[e.length-1])return;return"string"!=typeof t?`${e.slice(0,-1)}${t}"`:'"'===t[0]?e.slice(0,-1)+t.slice(1):void 0}return"string"!=typeof t||'"'!==t[0]||e instanceof s?void 0:`"${e}${t.slice(1)}`}function d(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.str=i,t.addCodeArg=c,t.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:i`${e}${t}`},t.stringify=function(e){return new n(d(e))},t.safeStringify=d,t.getProperty=function(e){return"string"==typeof e&&t.IDENTIFIER.test(e)?new n(`.${e}`):o`[${e}]`},t.getEsmExportName=function(e){if("string"==typeof e&&t.IDENTIFIER.test(e))return new n(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)},t.regexpCode=function(e){return new n(e.toString())}},9029(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;const s=r(1520),n=r(7845);var o=r(1520);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return o._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return o.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return o.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return o.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return o.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return o.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return o.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return o.Name}});var a=r(7845);Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return a.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return a.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return a.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return a.varKinds}}),t.operators={GT:new s._Code(">"),GTE:new s._Code(">="),LT:new s._Code("<"),LTE:new s._Code("<="),EQ:new s._Code("==="),NEQ:new s._Code("!=="),NOT:new s._Code("!"),OR:new s._Code("||"),AND:new s._Code("&&"),ADD:new s._Code("+")};class i{optimizeNodes(){return this}optimizeNames(e,t){return this}}class c extends i{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){const r=e?n.varKinds.var:this.varKind,s=void 0===this.rhs?"":` = ${this.rhs}`;return`${r} ${this.name}${s};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=I(this.rhs,e,t)),this}get names(){return this.rhs instanceof s._CodeOrName?this.rhs.names:{}}}class l extends i{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(!(this.lhs instanceof s.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=I(this.rhs,e,t),this}get names(){return x(this.lhs instanceof s.Name?{}:{...this.lhs.names},this.rhs)}}class d extends l{constructor(e,t,r,s){super(e,r,s),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class u extends i{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class f extends i{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class h extends i{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class m extends i{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=I(this.code,e,t),this}get names(){return this.code instanceof s._CodeOrName?this.code.names:{}}}class p extends i{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;for(;t--;){const r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){const{nodes:r}=this;let s=r.length;for(;s--;){const n=r[s];n.optimizeNames(e,t)||(C(e,n.names),r.splice(s,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>O(e,t.names),{})}}class y extends p{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class g extends p{}class $ extends y{}$.kind="else";class v extends y{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new $(e):e}return t?!1===e?t instanceof v?t:t.nodes:this.nodes.length?this:new v(R(e),t instanceof v?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var r;if(this.else=null===(r=this.else)||void 0===r?void 0:r.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=I(this.condition,e,t),this}get names(){const e=super.names;return x(e,this.condition),this.else&&O(e,this.else.names),e}}v.kind="if";class w extends y{}w.kind="for";class b extends w{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=I(this.iteration,e,t),this}get names(){return O(super.names,this.iteration.names)}}class _ extends w{constructor(e,t,r,s){super(),this.varKind=e,this.name=t,this.from=r,this.to=s}render(e){const t=e.es5?n.varKinds.var:this.varKind,{name:r,from:s,to:o}=this;return`for(${t} ${r}=${s}; ${r}<${o}; ${r}++)`+super.render(e)}get names(){const e=x(super.names,this.from);return x(e,this.to)}}class S extends w{constructor(e,t,r,s){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=s}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=I(this.iterable,e,t),this}get names(){return O(super.names,this.iterable.names)}}class E extends y{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}E.kind="func";class k extends p{render(e){return"return "+super.render(e)}}k.kind="return";class P extends y{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null===(e=this.catch)||void 0===e||e.optimizeNodes(),null===(t=this.finally)||void 0===t||t.optimizeNodes(),this}optimizeNames(e,t){var r,s;return super.optimizeNames(e,t),null===(r=this.catch)||void 0===r||r.optimizeNames(e,t),null===(s=this.finally)||void 0===s||s.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&O(e,this.catch.names),this.finally&&O(e,this.finally.names),e}}class N extends y{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}N.kind="catch";class j extends y{render(e){return"finally"+super.render(e)}}function O(e,t){for(const r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function x(e,t){return t instanceof s._CodeOrName?O(e,t.names):e}function I(e,t,r){return e instanceof s.Name?o(e):(n=e)instanceof s._Code&&n._items.some(e=>e instanceof s.Name&&1===t[e.str]&&void 0!==r[e.str])?new s._Code(e._items.reduce((e,t)=>(t instanceof s.Name&&(t=o(t)),t instanceof s._Code?e.push(...t._items):e.push(t),e),[])):e;var n;function o(e){const s=r[e.str];return void 0===s||1!==t[e.str]?e:(delete t[e.str],s)}}function C(e,t){for(const r in t)e[r]=(e[r]||0)-(t[r]||0)}function R(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:s._`!${q(e)}`}j.kind="finally",t.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new n.Scope({parent:e}),this._nodes=[new g]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,s){const n=this._scope.toName(t);return void 0!==r&&s&&(this._constants[n.str]=r),this._leafNode(new c(e,n,r)),n}const(e,t,r){return this._def(n.varKinds.const,e,t,r)}let(e,t,r){return this._def(n.varKinds.let,e,t,r)}var(e,t,r){return this._def(n.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new l(e,t,r))}add(e,r){return this._leafNode(new d(e,t.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==s.nil&&this._leafNode(new m(e)),this}object(...e){const t=["{"];for(const[r,n]of e)t.length>1&&t.push(","),t.push(r),(r!==n||this.opts.es5)&&(t.push(":"),(0,s.addCodeArg)(t,n));return t.push("}"),new s._Code(t)}if(e,t,r){if(this._blockNode(new v(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new v(e))}else(){return this._elseNode(new $)}endIf(){return this._endBlockNode(v,$)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new b(e),t)}forRange(e,t,r,s,o=(this.opts.es5?n.varKinds.var:n.varKinds.let)){const a=this._scope.toName(e);return this._for(new _(o,a,t,r),()=>s(a))}forOf(e,t,r,o=n.varKinds.const){const a=this._scope.toName(e);if(this.opts.es5){const e=t instanceof s.Name?t:this.var("_arr",t);return this.forRange("_i",0,s._`${e}.length`,t=>{this.var(a,s._`${e}[${t}]`),r(a)})}return this._for(new S("of",o,a,t),()=>r(a))}forIn(e,t,r,o=(this.opts.es5?n.varKinds.var:n.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,s._`Object.keys(${t})`,r);const a=this._scope.toName(e);return this._for(new S("in",o,a,t),()=>r(a))}endFor(){return this._endBlockNode(w)}label(e){return this._leafNode(new u(e))}break(e){return this._leafNode(new f(e))}return(e){const t=new k;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(k)}try(e,t,r){if(!t&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');const s=new P;if(this._blockNode(s),this.code(e),t){const e=this.name("e");this._currNode=s.catch=new N(e),t(e)}return r&&(this._currNode=s.finally=new j,this.code(r)),this._endBlockNode(N,j)}throw(e){return this._leafNode(new h(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){const t=this._blockStarts.pop();if(void 0===t)throw new Error("CodeGen: not in self-balancing block");const r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=s.nil,r,n){return this._blockNode(new E(e,t,r)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(E)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){const r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){const t=this._currNode;if(!(t instanceof v))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){const e=this._nodes;return e[e.length-1]}set _currNode(e){const t=this._nodes;t[t.length-1]=e}},t.not=R;const T=A(t.operators.AND);t.and=function(...e){return e.reduce(T)};const D=A(t.operators.OR);function A(e){return(t,r)=>t===s.nil?r:r===s.nil?t:s._`${q(t)} ${e} ${q(r)}`}function q(e){return e instanceof s.Name?e:s._`(${e})`}t.or=function(...e){return e.reduce(D)}},7845(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const s=r(1520);class n extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}var o;!function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"}(o||(t.UsedValueState=o={})),t.varKinds={const:new s.Name("const"),let:new s.Name("let"),var:new s.Name("var")};class a{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof s.Name?e:this.name(e)}name(e){return new s.Name(this._newName(e))}_newName(e){return`${e}${(this._names[e]||this._nameGroup(e)).index++}`}_nameGroup(e){var t,r;if((null===(r=null===(t=this._parent)||void 0===t?void 0:t._prefixes)||void 0===r?void 0:r.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}}}t.Scope=a;class i extends s.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=s._`.${new s.Name(t)}[${r}]`}}t.ValueScopeName=i;const c=s._`\n`;t.ValueScope=class extends a{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?c:s.nil}}get(){return this._scope}name(e){return new i(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw new Error("CodeGen: ref must be passed in value");const s=this.toName(e),{prefix:n}=s,o=null!==(r=t.key)&&void 0!==r?r:t.ref;let a=this._values[n];if(a){const e=a.get(o);if(e)return e}else a=this._values[n]=new Map;a.set(o,s);const i=this._scope[n]||(this._scope[n]=[]),c=i.length;return i[c]=t.ref,s.setValue(t,{property:n,itemIndex:c}),s}getValue(e,t){const r=this._values[e];if(r)return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,t=>{if(void 0===t.scopePath)throw new Error(`CodeGen: name "${t}" has no value`);return s._`${e}${t.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,e=>{if(void 0===e.value)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,r)}_reduceValues(e,r,a={},i){let c=s.nil;for(const l in e){const d=e[l];if(!d)continue;const u=a[l]=a[l]||new Map;d.forEach(e=>{if(u.has(e))return;u.set(e,o.Started);let a=r(e);if(a){const r=this.opts.es5?t.varKinds.var:t.varKinds.const;c=s._`${c}${r} ${e} = ${a};${this.opts._n}`}else{if(!(a=null==i?void 0:i(e)))throw new n(e);c=s._`${c}${a}${this.opts._n}`}u.set(e,o.Completed)})}return c}}},8708(e,t,r){t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.y=void 0;const s=r(9029),n=r(4227),o=r(2023);function a(e,t){const r=e.const("err",t);e.if(s._`${o.default.vErrors} === null`,()=>e.assign(o.default.vErrors,s._`[${r}]`),s._`${o.default.vErrors}.push(${r})`),e.code(s._`${o.default.errors}++`)}function i(e,t){const{gen:r,validateName:n,schemaEnv:o}=e;o.$async?r.throw(s._`new ${e.ValidationError}(${t})`):(r.assign(s._`${n}.errors`,t),r.return(!1))}t.y={message:({keyword:e})=>s.str`must pass "${e}" keyword validation`},t.keyword$DataError={message:({keyword:e,schemaType:t})=>t?s.str`"${e}" keyword must be ${t} ($data)`:s.str`"${e}" keyword is invalid ($data)`},t.reportError=function(e,r=t.y,n,o){const{it:c}=e,{gen:d,compositeRule:u,allErrors:f}=c,h=l(e,r,n);(null!=o?o:u||f)?a(d,h):i(c,s._`[${h}]`)},t.reportExtraError=function(e,r=t.y,s){const{it:n}=e,{gen:c,compositeRule:d,allErrors:u}=n;a(c,l(e,r,s)),d||u||i(n,o.default.vErrors)},t.resetErrorsCount=function(e,t){e.assign(o.default.errors,t),e.if(s._`${o.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(s._`${o.default.vErrors}.length`,t),()=>e.assign(o.default.vErrors,null)))},t.extendErrors=function({gen:e,keyword:t,schemaValue:r,data:n,errsCount:a,it:i}){if(void 0===a)throw new Error("ajv implementation error");const c=e.name("err");e.forRange("i",a,o.default.errors,a=>{e.const(c,s._`${o.default.vErrors}[${a}]`),e.if(s._`${c}.instancePath === undefined`,()=>e.assign(s._`${c}.instancePath`,(0,s.strConcat)(o.default.instancePath,i.errorPath))),e.assign(s._`${c}.schemaPath`,s.str`${i.errSchemaPath}/${t}`),i.opts.verbose&&(e.assign(s._`${c}.schema`,r),e.assign(s._`${c}.data`,n))})};const c={keyword:new s.Name("keyword"),schemaPath:new s.Name("schemaPath"),params:new s.Name("params"),propertyName:new s.Name("propertyName"),message:new s.Name("message"),schema:new s.Name("schema"),parentSchema:new s.Name("parentSchema")};function l(e,t,r){const{createErrors:n}=e.it;return!1===n?s._`{}`:function(e,t,r={}){const{gen:n,it:a}=e,i=[d(a,r),u(e,r)];return function(e,{params:t,message:r},n){const{keyword:a,data:i,schemaValue:l,it:d}=e,{opts:u,propertyName:f,topSchemaRef:h,schemaPath:m}=d;n.push([c.keyword,a],[c.params,"function"==typeof t?t(e):t||s._`{}`]),u.messages&&n.push([c.message,"function"==typeof r?r(e):r]),u.verbose&&n.push([c.schema,l],[c.parentSchema,s._`${h}${m}`],[o.default.data,i]),f&&n.push([c.propertyName,f])}(e,t,i),n.object(...i)}(e,t,r)}function d({errorPath:e},{instancePath:t}){const r=t?s.str`${e}${(0,n.getErrorPath)(t,n.Type.Str)}`:e;return[o.default.instancePath,(0,s.strConcat)(o.default.instancePath,r)]}function u({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:o}){let a=o?t:s.str`${t}/${e}`;return r&&(a=s.str`${a}${(0,n.getErrorPath)(r,n.Type.Str)}`),[c.schemaPath,a]}},3835(e,t,r){t.resolveSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;const s=r(9029),n=r(3558),o=r(2023),a=r(6939),i=r(4227),c=r(2586);class l{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!==(t=e.baseId)&&void 0!==t?t:(0,a.normalizeId)(null==r?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}}function d(e){const t=f.call(this,e);if(t)return t;const r=(0,a.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:i,lines:l}=this.opts.code,{ownProperties:d}=this.opts,u=new s.CodeGen(this.scope,{es5:i,lines:l,ownProperties:d});let h;e.$async&&(h=u.scopeValue("Error",{ref:n.default,code:s._`require("ajv/dist/runtime/validation_error").default`}));const m=u.scopeName("validate");e.validateName=m;const p={gen:u,allErrors:this.opts.allErrors,data:o.default.data,parentData:o.default.parentData,parentDataProperty:o.default.parentDataProperty,dataNames:[o.default.data],dataPathArr:[s.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:u.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,s.stringify)(e.schema)}:{ref:e.schema}),validateName:m,ValidationError:h,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:s.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:s._`""`,opts:this.opts,self:this};let y;try{this._compilations.add(e),(0,c.validateFunctionCode)(p),u.optimize(this.opts.code.optimize);const t=u.toString();y=`${u.scopeRefs(o.default.scope)}return ${t}`,this.opts.code.process&&(y=this.opts.code.process(y,e));const r=new Function(`${o.default.self}`,`${o.default.scope}`,y)(this,this.scope.get());if(this.scope.value(m,{ref:r}),r.errors=null,r.schema=e.schema,r.schemaEnv=e,e.$async&&(r.$async=!0),!0===this.opts.code.source&&(r.source={validateName:m,validateCode:t,scopeValues:u._values}),this.opts.unevaluated){const{props:e,items:t}=p;r.evaluated={props:e instanceof s.Name?void 0:e,items:t instanceof s.Name?void 0:t,dynamicProps:e instanceof s.Name,dynamicItems:t instanceof s.Name},r.source&&(r.source.evaluated=(0,s.stringify)(r.evaluated))}return e.validate=r,e}catch(t){throw delete e.validate,delete e.validateName,y&&this.logger.error("Error compiling schema, function code:",y),t}finally{this._compilations.delete(e)}}function u(e){return(0,a.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:d.call(this,e)}function f(e){for(const t of this._compilations)if(h(t,e))return t}function h(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function m(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||p.call(this,e,t)}function p(e,t){const r=this.opts.uriResolver.parse(t),s=(0,a._getFullPath)(this.opts.uriResolver,r);let n=(0,a.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&s===n)return g.call(this,r,e);const o=(0,a.normalizeId)(s),i=this.refs[o]||this.schemas[o];if("string"==typeof i){const t=p.call(this,e,i);if("object"!=typeof(null==t?void 0:t.schema))return;return g.call(this,r,t)}if("object"==typeof(null==i?void 0:i.schema)){if(i.validate||d.call(this,i),o===(0,a.normalizeId)(t)){const{schema:t}=i,{schemaId:r}=this.opts,s=t[r];return s&&(n=(0,a.resolveUrl)(this.opts.uriResolver,n,s)),new l({schema:t,schemaId:r,root:e,baseId:n})}return g.call(this,r,i)}}t.SchemaEnv=l,t.compileSchema=d,t.resolveRef=function(e,t,r){var s;r=(0,a.resolveUrl)(this.opts.uriResolver,t,r);const n=e.refs[r];if(n)return n;let o=m.call(this,e,r);if(void 0===o){const n=null===(s=e.localRefs)||void 0===s?void 0:s[r],{schemaId:a}=this.opts;n&&(o=new l({schema:n,schemaId:a,root:e,baseId:t}))}return void 0!==o?e.refs[r]=u.call(this,o):void 0},t.resolveSchema=p;const y=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function g(e,{baseId:t,schema:r,root:s}){var n;if("/"!==(null===(n=e.fragment)||void 0===n?void 0:n[0]))return;for(const s of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;const e=r[(0,i.unescapeFragment)(s)];if(void 0===e)return;const n="object"==typeof(r=e)&&r[this.opts.schemaId];!y.has(s)&&n&&(t=(0,a.resolveUrl)(this.opts.uriResolver,t,n))}let o;if("boolean"!=typeof r&&r.$ref&&!(0,i.schemaHasRulesButRef)(r,this.RULES)){const e=(0,a.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=p.call(this,s,e)}const{schemaId:c}=this.opts;return o=o||new l({schema:r,schemaId:c,root:s,baseId:t}),o.schema!==o.root.schema?o:void 0}},2023(e,t,r){const s=r(9029),n={data:new s.Name("data"),valCxt:new s.Name("valCxt"),instancePath:new s.Name("instancePath"),parentData:new s.Name("parentData"),parentDataProperty:new s.Name("parentDataProperty"),rootData:new s.Name("rootData"),dynamicAnchors:new s.Name("dynamicAnchors"),vErrors:new s.Name("vErrors"),errors:new s.Name("errors"),this:new s.Name("this"),self:new s.Name("self"),scope:new s.Name("scope"),json:new s.Name("json"),jsonPos:new s.Name("jsonPos"),jsonLen:new s.Name("jsonLen"),jsonPart:new s.Name("jsonPart")};t.default=n},4551(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});const s=r(6939);class n extends Error{constructor(e,t,r,n){super(n||`can't resolve reference ${r} from id ${t}`),this.missingRef=(0,s.resolveUrl)(e,t,r),this.missingSchema=(0,s.normalizeId)((0,s.getFullPath)(e,this.missingRef))}}t.default=n},6939(e,t,r){t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;const s=r(4227),n=r(2017),o=r(7106),a=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);t.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!c(e):!!t&&l(e)<=t)};const i=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function c(e){for(const t in e){if(i.has(t))return!0;const r=e[t];if(Array.isArray(r)&&r.some(c))return!0;if("object"==typeof r&&c(r))return!0}return!1}function l(e){let t=0;for(const r in e){if("$ref"===r)return 1/0;if(t++,!a.has(r)&&("object"==typeof e[r]&&(0,s.eachItem)(e[r],e=>t+=l(e)),t===1/0))return 1/0}return t}function d(e,t="",r){!1!==r&&(t=h(t));const s=e.parse(t);return u(e,s)}function u(e,t){return e.serialize(t).split("#")[0]+"#"}t.getFullPath=d,t._getFullPath=u;const f=/#\/?$/;function h(e){return e?e.replace(f,""):""}t.normalizeId=h,t.resolveUrl=function(e,t,r){return r=h(r),e.resolve(t,r)};const m=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};const{schemaId:r,uriResolver:s}=this.opts,a=h(e[r]||t),i={"":a},c=d(s,a,!1),l={},u=new Set;return o(e,{allKeys:!0},(e,t,s,n)=>{if(void 0===n)return;const o=c+t;let a=i[n];function d(t){const r=this.opts.uriResolver.resolve;if(t=h(a?r(a,t):t),u.has(t))throw p(t);u.add(t);let s=this.refs[t];return"string"==typeof s&&(s=this.refs[s]),"object"==typeof s?f(e,s.schema,t):t!==h(o)&&("#"===t[0]?(f(e,l[t],t),l[t]=e):this.refs[t]=o),t}function y(e){if("string"==typeof e){if(!m.test(e))throw new Error(`invalid anchor "${e}"`);d.call(this,`#${e}`)}}"string"==typeof e[r]&&(a=d.call(this,e[r])),y.call(this,e.$anchor),y.call(this,e.$dynamicAnchor),i[t]=a}),l;function f(e,t,r){if(void 0!==t&&!n(e,t))throw p(r)}function p(e){return new Error(`reference "${e}" resolves to more than one schema`)}}},396(e,t){t.getRules=t.isJSONType=void 0;const r=new Set(["string","number","integer","boolean","null","object","array"]);t.isJSONType=function(e){return"string"==typeof e&&r.has(e)},t.getRules=function(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}},4227(e,t,r){t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;const s=r(9029),n=r(1520);function o(e,t=e.schema){const{opts:r,self:s}=e;if(!r.strictSchema)return;if("boolean"==typeof t)return;const n=s.RULES.keywords;for(const r in t)n[r]||h(e,`unknown keyword: "${r}"`)}function a(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function i(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function c({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,a,i,c)=>{const l=void 0===i?a:i instanceof s.Name?(a instanceof s.Name?e(o,a,i):t(o,a,i),i):a instanceof s.Name?(t(o,i,a),a):r(a,i);return c!==s.Name||l instanceof s.Name?l:n(o,l)}}function l(e,t){if(!0===t)return e.var("props",!0);const r=e.var("props",s._`{}`);return void 0!==t&&d(e,r,t),r}function d(e,t,r){Object.keys(r).forEach(r=>e.assign(s._`${t}${(0,s.getProperty)(r)}`,!0))}t.toHash=function(e){const t={};for(const r of e)t[r]=!0;return t},t.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(o(e,t),!function(e,t){if("boolean"==typeof e)return!e;for(const r in e)if(t[r])return!0;return!1}(t,e.self.RULES.all))},t.checkUnknownRules=o,t.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(const r in e)if("$ref"!==r&&t.all[r])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if("number"==typeof r||"boolean"==typeof r)return r;if("string"==typeof r)return s._`${r}`}return s._`${e}${t}${(0,s.getProperty)(n)}`},t.unescapeFragment=function(e){return i(decodeURIComponent(e))},t.escapeFragment=function(e){return encodeURIComponent(a(e))},t.unescapeJsonPointer=i,t.eachItem=function(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)},t.mergeEvaluated={props:c({mergeNames:(e,t,r)=>e.if(s._`${r} !== true && ${t} !== undefined`,()=>{e.if(s._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,s._`${r} || {}`).code(s._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(s._`${r} !== true`,()=>{!0===t?e.assign(r,!0):(e.assign(r,s._`${r} || {}`),d(e,r,t))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:l}),items:c({mergeNames:(e,t,r)=>e.if(s._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,s._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(s._`${r} !== true`,()=>e.assign(r,!0===t||s._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},t.evaluatedPropsToName=l;const u={};var f;function h(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw new Error(t);e.self.logger.warn(t)}}t.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:u[t.code]||(u[t.code]=new n._Code(t.code))})},function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(f||(t.Type=f={})),t.getErrorPath=function(e,t,r){if(e instanceof s.Name){const n=t===f.Num;return r?n?s._`"[" + ${e} + "]"`:s._`"['" + ${e} + "']"`:n?s._`"/" + ${e}`:s._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,s.getProperty)(e).toString():"/"+a(e)},t.checkStrictMode=h},7887(e,t){function r(e,t){return t.rules.some(t=>s(e,t))}function s(e,t){var r;return void 0!==e[t.keyword]||(null===(r=t.definition.implements)||void 0===r?void 0:r.some(t=>void 0!==e[t]))}t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0,t.schemaHasRulesForType=function({schema:e,self:t},s){const n=t.RULES.types[s];return n&&!0!==n&&r(e,n)},t.shouldUseGroup=r,t.shouldUseRule=s},8727(e,t,r){t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;const s=r(8708),n=r(9029),o=r(2023),a={message:"boolean schema is false"};function i(e,t){const{gen:r,data:n}=e,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,s.reportError)(o,a,void 0,t)}t.topBoolOrEmptySchema=function(e){const{gen:t,schema:r,validateName:s}=e;!1===r?i(e,!1):"object"==typeof r&&!0===r.$async?t.return(o.default.data):(t.assign(n._`${s}.errors`,null),t.return(!0))},t.boolOrEmptySchema=function(e,t){const{gen:r,schema:s}=e;!1===s?(r.var(t,!1),i(e)):r.var(t,!0)}},208(e,t,r){t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;const s=r(396),n=r(7887),o=r(8708),a=r(9029),i=r(4227);var c;function l(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(s.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}!function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"}(c||(t.DataType=c={})),t.getSchemaTypes=function(e){const t=l(e.type);if(t.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},t.getJSONTypes=l,t.coerceAndCheckDataType=function(e,t){const{gen:r,data:s,opts:o}=e,i=function(e,t){return t?e.filter(e=>d.has(e)||"array"===t&&"array"===e):[]}(t,o.coerceTypes),l=t.length>0&&!(0===i.length&&1===t.length&&(0,n.schemaHasRulesForType)(e,t[0]));if(l){const n=f(t,s,o.strictNumbers,c.Wrong);r.if(n,()=>{i.length?function(e,t,r){const{gen:s,data:n,opts:o}=e,i=s.let("dataType",a._`typeof ${n}`),c=s.let("coerced",a._`undefined`);"array"===o.coerceTypes&&s.if(a._`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>s.assign(n,a._`${n}[0]`).assign(i,a._`typeof ${n}`).if(f(t,n,o.strictNumbers),()=>s.assign(c,n))),s.if(a._`${c} !== undefined`);for(const e of r)(d.has(e)||"array"===e&&"array"===o.coerceTypes)&&l(e);function l(e){switch(e){case"string":return void s.elseIf(a._`${i} == "number" || ${i} == "boolean"`).assign(c,a._`"" + ${n}`).elseIf(a._`${n} === null`).assign(c,a._`""`);case"number":return void s.elseIf(a._`${i} == "boolean" || ${n} === null
|
|
3
3
|
|| (${i} == "string" && ${n} && ${n} == +${n})`).assign(c,a._`+${n}`);case"integer":return void s.elseIf(a._`${i} === "boolean" || ${n} === null
|
|
4
4
|
|| (${i} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(c,a._`+${n}`);case"boolean":return void s.elseIf(a._`${n} === "false" || ${n} === 0 || ${n} === null`).assign(c,!1).elseIf(a._`${n} === "true" || ${n} === 1`).assign(c,!0);case"null":return s.elseIf(a._`${n} === "" || ${n} === 0 || ${n} === false`),void s.assign(c,null);case"array":s.elseIf(a._`${i} === "string" || ${i} === "number"
|
|
5
|
-
|| ${i} === "boolean" || ${n} === null`).assign(c,a._`[${n}]`)}}s.else(),m(e),s.endIf(),s.if(a._`${c} !== undefined`,()=>{s.assign(n,c),function({gen:e,parentData:t,parentDataProperty:r},s){e.if(a._`${t} !== undefined`,()=>e.assign(a._`${t}[${r}]`,s))}(e,c)})}(e,t,i):m(e)})}return l};const d=new Set(["string","number","integer","boolean","null"]);function u(e,t,r,s=c.Correct){const n=s===c.Correct?a.operators.EQ:a.operators.NEQ;let o;switch(e){case"null":return a._`${t} ${n} null`;case"array":o=a._`Array.isArray(${t})`;break;case"object":o=a._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=i(a._`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=i();break;default:return a._`typeof ${t} ${n} ${e}`}return s===c.Correct?o:(0,a.not)(o);function i(e=a.nil){return(0,a.and)(a._`typeof ${t} == "number"`,e,r?a._`isFinite(${t})`:a.nil)}}function f(e,t,r,s){if(1===e.length)return u(e[0],t,r,s);let n;const o=(0,i.toHash)(e);if(o.array&&o.object){const e=a._`typeof ${t} != "object"`;n=o.null?e:a._`!${t} || ${e}`,delete o.null,delete o.array,delete o.object}else n=a.nil;o.number&&delete o.integer;for(const e in o)n=(0,a.and)(n,u(e,t,r,s));return n}t.checkDataType=u,t.checkDataTypes=f;const h={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?a._`{type: ${e}}`:a._`{type: ${t}}`};function m(e){const t=function(e){const{gen:t,data:r,schema:s}=e,n=(0,i.schemaRefOrVal)(e,s,"type");return{gen:t,keyword:"type",data:r,schema:s.type,schemaCode:n,schemaValue:n,parentSchema:s,params:{},it:e}}(e);(0,o.reportError)(t,h)}t.reportTypeError=m},7870(e,t,r){t.assignDefaults=void 0;const s=r(9029),n=r(4227);function o(e,t,r){const{gen:o,compositeRule:a,data:i,opts:c}=e;if(void 0===r)return;const l=s._`${i}${(0,s.getProperty)(t)}`;if(a)return void(0,n.checkStrictMode)(e,`default is ignored for: ${l}`);let d=s._`${l} === undefined`;"empty"===c.useDefaults&&(d=s._`${d} || ${l} === null || ${l} === ""`),o.if(d,s._`${l} = ${(0,s.stringify)(r)}`)}t.assignDefaults=function(e,t){const{properties:r,items:s}=e.schema;if("object"===t&&r)for(const t in r)o(e,t,r[t].default);else"array"===t&&Array.isArray(s)&&s.forEach((t,r)=>o(e,r,t.default))}},2586(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;const s=r(8727),n=r(208),o=r(7887),a=r(208),i=r(7870),c=r(3673),l=r(4495),d=r(9029),u=r(2023),f=r(6939),h=r(4227),m=r(8708);function p({gen:e,validateName:t,schema:r,schemaEnv:s,opts:n},o){n.code.es5?e.func(t,d._`${u.default.data}, ${u.default.valCxt}`,s.$async,()=>{e.code(d._`"use strict"; ${y(r,n)}`),function(e,t){e.if(u.default.valCxt,()=>{e.var(u.default.instancePath,d._`${u.default.valCxt}.${u.default.instancePath}`),e.var(u.default.parentData,d._`${u.default.valCxt}.${u.default.parentData}`),e.var(u.default.parentDataProperty,d._`${u.default.valCxt}.${u.default.parentDataProperty}`),e.var(u.default.rootData,d._`${u.default.valCxt}.${u.default.rootData}`),t.dynamicRef&&e.var(u.default.dynamicAnchors,d._`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{e.var(u.default.instancePath,d._`""`),e.var(u.default.parentData,d._`undefined`),e.var(u.default.parentDataProperty,d._`undefined`),e.var(u.default.rootData,u.default.data),t.dynamicRef&&e.var(u.default.dynamicAnchors,d._`{}`)})}(e,n),e.code(o)}):e.func(t,d._`${u.default.data}, ${function(e){return d._`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${e.dynamicRef?d._`, ${u.default.dynamicAnchors}={}`:d.nil}}={}`}(n)}`,s.$async,()=>e.code(y(r,n)).code(o))}function y(e,t){const r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?d._`/*# sourceURL=${r} */`:d.nil}function g({schema:e,self:t}){if("boolean"==typeof e)return!e;for(const r in e)if(t.RULES.all[r])return!0;return!1}function v(e){return"boolean"!=typeof e.schema}function $(e){(0,h.checkUnknownRules)(e),function(e){const{schema:t,errSchemaPath:r,opts:s,self:n}=e;t.$ref&&s.ignoreKeywordsWithRef&&(0,h.schemaHasRulesButRef)(t,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function w(e,t){if(e.opts.jtd)return _(e,[],!1,t);const r=(0,n.getSchemaTypes)(e.schema);_(e,r,!(0,n.coerceAndCheckDataType)(e,r),t)}function b({gen:e,schemaEnv:t,schema:r,errSchemaPath:s,opts:n}){const o=r.$comment;if(!0===n.$comment)e.code(d._`${u.default.self}.logger.log(${o})`);else if("function"==typeof n.$comment){const r=d.str`${s}/$comment`,n=e.scopeValue("root",{ref:t.root});e.code(d._`${u.default.self}.opts.$comment(${o}, ${r}, ${n}.schema)`)}}function _(e,t,r,s){const{gen:n,schema:i,data:c,allErrors:l,opts:f,self:m}=e,{RULES:p}=m;function y(h){(0,o.shouldUseGroup)(i,h)&&(h.type?(n.if((0,a.checkDataType)(h.type,c,f.strictNumbers)),S(e,h),1===t.length&&t[0]===h.type&&r&&(n.else(),(0,a.reportTypeError)(e)),n.endIf()):S(e,h),l||n.if(d._`${u.default.errors} === ${s||0}`))}!i.$ref||!f.ignoreKeywordsWithRef&&(0,h.schemaHasRulesButRef)(i,p)?(f.jtd||function(e,t){!e.schemaEnv.meta&&e.opts.strictTypes&&(function(e,t){t.length&&(e.dataTypes.length?(t.forEach(t=>{E(e.dataTypes,t)||k(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}),function(e,t){const r=[];for(const s of e.dataTypes)E(t,s)?r.push(s):t.includes("integer")&&"number"===s&&r.push("integer");e.dataTypes=r}(e,t)):e.dataTypes=t)}(e,t),e.opts.allowUnionTypes||function(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&k(e,"use allowUnionTypes to allow union type keyword")}(e,t),function(e,t){const r=e.self.RULES.all;for(const s in r){const n=r[s];if("object"==typeof n&&(0,o.shouldUseRule)(e.schema,n)){const{type:r}=n.definition;r.length&&!r.some(e=>{return s=e,(r=t).includes(s)||"number"===s&&r.includes("integer");var r,s})&&k(e,`missing type "${r.join(",")}" for keyword "${s}"`)}}}(e,e.dataTypes))}(e,t),n.block(()=>{for(const e of p.rules)y(e);y(p.post)})):n.block(()=>N(e,"$ref",p.all.$ref.definition))}function S(e,t){const{gen:r,schema:s,opts:{useDefaults:n}}=e;n&&(0,i.assignDefaults)(e,t.type),r.block(()=>{for(const r of t.rules)(0,o.shouldUseRule)(s,r)&&N(e,r.keyword,r.definition,t.type)})}function E(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function k(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,h.checkStrictMode)(e,t,e.opts.strictTypes)}t.validateFunctionCode=function(e){v(e)&&($(e),g(e))?function(e){const{schema:t,opts:r,gen:s}=e;p(e,()=>{r.$comment&&t.$comment&&b(e),function(e){const{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&(0,h.checkStrictMode)(e,"default is ignored in the schema root")}(e),s.let(u.default.vErrors,null),s.let(u.default.errors,0),r.unevaluated&&function(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",d._`${r}.evaluated`),t.if(d._`${e.evaluated}.dynamicProps`,()=>t.assign(d._`${e.evaluated}.props`,d._`undefined`)),t.if(d._`${e.evaluated}.dynamicItems`,()=>t.assign(d._`${e.evaluated}.items`,d._`undefined`))}(e),w(e),function(e){const{gen:t,schemaEnv:r,validateName:s,ValidationError:n,opts:o}=e;r.$async?t.if(d._`${u.default.errors} === 0`,()=>t.return(u.default.data),()=>t.throw(d._`new ${n}(${u.default.vErrors})`)):(t.assign(d._`${s}.errors`,u.default.vErrors),o.unevaluated&&function({gen:e,evaluated:t,props:r,items:s}){r instanceof d.Name&&e.assign(d._`${t}.props`,r),s instanceof d.Name&&e.assign(d._`${t}.items`,s)}(e),t.return(d._`${u.default.errors} === 0`))}(e)})}(e):p(e,()=>(0,s.topBoolOrEmptySchema)(e))};class P{constructor(e,t,r){if((0,c.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,h.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",O(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,c.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",u.default.errors))}result(e,t,r){this.failResult((0,d.not)(e),t,r)}failResult(e,t,r){this.gen.if(e),r?r():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,d.not)(e),void 0,t)}fail(e){if(void 0===e)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:t}=this;this.fail(d._`${t} !== undefined && (${(0,d.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t)return this.setParams(t),this._error(e,r),void this.setParams({});this._error(e,r)}_error(e,t){(e?m.reportExtraError:m.reportError)(this,this.def.error,t)}$dataError(){(0,m.reportError)(this,this.def.$dataError||m.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,m.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,r=d.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=d.nil,t=d.nil){if(!this.$data)return;const{gen:r,schemaCode:s,schemaType:n,def:o}=this;r.if((0,d.or)(d._`${s} === undefined`,t)),e!==d.nil&&r.assign(e,!0),(n.length||o.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==d.nil&&r.assign(e,!1)),r.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:r,def:s,it:n}=this;return(0,d.or)(function(){if(r.length){if(!(t instanceof d.Name))throw new Error("ajv implementation error");const e=Array.isArray(r)?r:[r];return d._`${(0,a.checkDataTypes)(e,t,n.opts.strictNumbers,a.DataType.Wrong)}`}return d.nil}(),function(){if(s.validateSchema){const r=e.scopeValue("validate$data",{ref:s.validateSchema});return d._`!${r}(${t})`}return d.nil}())}subschema(e,t){const r=(0,l.getSubschema)(this.it,e);(0,l.extendSubschemaData)(r,this.it,e),(0,l.extendSubschemaMode)(r,e);const n={...this.it,...r,items:void 0,props:void 0};return function(e,t){v(e)&&($(e),g(e))?function(e,t){const{schema:r,gen:s,opts:n}=e;n.$comment&&r.$comment&&b(e),function(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,f.resolveUrl)(e.opts.uriResolver,e.baseId,t))}(e),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}(e);const o=s.const("_errs",u.default.errors);w(e,o),s.var(t,d._`${o} === ${u.default.errors}`)}(e,t):(0,s.boolOrEmptySchema)(e,t)}(n,t),n}mergeEvaluated(e,t){const{it:r,gen:s}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=h.mergeEvaluated.props(s,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=h.mergeEvaluated.items(s,e.items,r.items,t)))}mergeValidEvaluated(e,t){const{it:r,gen:s}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return s.if(t,()=>this.mergeEvaluated(e,d.Name)),!0}}function N(e,t,r,s){const n=new P(e,r,t);"code"in r?r.code(n,s):n.$data&&r.validate?(0,c.funcKeywordCode)(n,r):"macro"in r?(0,c.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,c.funcKeywordCode)(n,r)}t.KeywordCxt=P;const j=/^\/(?:[^~]|~0|~1)*$/,x=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function O(e,{dataLevel:t,dataNames:r,dataPathArr:s}){let n,o;if(""===e)return u.default.rootData;if("/"===e[0]){if(!j.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);n=e,o=u.default.rootData}else{const a=x.exec(e);if(!a)throw new Error(`Invalid JSON-pointer: ${e}`);const i=+a[1];if(n=a[2],"#"===n){if(i>=t)throw new Error(c("property/index",i));return s[t-i]}if(i>t)throw new Error(c("data",i));if(o=r[t-i],!n)return o}let a=o;const i=n.split("/");for(const e of i)e&&(o=d._`${o}${(0,d.getProperty)((0,h.unescapeJsonPointer)(e))}`,a=d._`${a} && ${o}`);return a;function c(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}t.getData=O},3673(e,t,r){t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;const s=r(9029),n=r(2023),o=r(5765),a=r(8708);function i(e){const{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,s._`${n.parentData}[${n.parentDataProperty}]`))}function c(e,t,r){if(void 0===r)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword","function"==typeof r?{ref:r}:{ref:r,code:(0,s.stringify)(r)})}t.macroKeywordCode=function(e,t){const{gen:r,keyword:n,schema:o,parentSchema:a,it:i}=e,l=t.macro.call(i.self,o,a,i),d=c(r,n,l);!1!==i.opts.validateSchema&&i.self.validateSchema(l,!0);const u=r.name("valid");e.subschema({schema:l,schemaPath:s.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:d,compositeRule:!0},u),e.pass(u,()=>e.error(!0))},t.funcKeywordCode=function(e,t){var r;const{gen:l,keyword:d,schema:u,parentSchema:f,$data:h,it:m}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}(m,t);const p=!h&&t.compile?t.compile.call(m.self,u,f,m):t.validate,y=c(l,d,p),g=l.let("valid");function v(r=(t.async?s._`await `:s.nil)){const a=m.opts.passContext?n.default.this:n.default.self,i=!("compile"in t&&!h||!1===t.schema);l.assign(g,s._`${r}${(0,o.callValidateCode)(e,y,a,i)}`,t.modifying)}function $(e){var r;l.if((0,s.not)(null!==(r=t.valid)&&void 0!==r?r:g),e)}e.block$data(g,function(){if(!1===t.errors)v(),t.modifying&&i(e),$(()=>e.error());else{const r=t.async?function(){const e=l.let("ruleErrs",null);return l.try(()=>v(s._`await `),t=>l.assign(g,!1).if(s._`${t} instanceof ${m.ValidationError}`,()=>l.assign(e,s._`${t}.errors`),()=>l.throw(t))),e}():function(){const e=s._`${y}.errors`;return l.assign(e,null),v(s.nil),e}();t.modifying&&i(e),$(()=>function(e,t){const{gen:r}=e;r.if(s._`Array.isArray(${t})`,()=>{r.assign(n.default.vErrors,s._`${n.default.vErrors} === null ? ${t} : ${n.default.vErrors}.concat(${t})`).assign(n.default.errors,s._`${n.default.vErrors}.length`),(0,a.extendErrors)(e)},()=>e.error())}(e,r))}}),e.ok(null!==(r=t.valid)&&void 0!==r?r:g)},t.validSchemaType=function(e,t,r=!1){return!t.length||t.some(t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||r&&void 0===e)},t.validateKeywordUsage=function({schema:e,opts:t,self:r,errSchemaPath:s},n,o){if(Array.isArray(n.keyword)?!n.keyword.includes(o):n.keyword!==o)throw new Error("ajv implementation error");const a=n.dependencies;if(null==a?void 0:a.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw new Error(`parent schema must have dependencies of ${o}: ${a.join(",")}`);if(n.validateSchema&&!n.validateSchema(e[o])){const e=`keyword "${o}" value is invalid at path "${s}": `+r.errorsText(n.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);r.logger.error(e)}}},4495(e,t,r){t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;const s=r(9029),n=r(4227);t.getSubschema=function(e,{keyword:t,schemaProp:r,schema:o,schemaPath:a,errSchemaPath:i,topSchemaRef:c}){if(void 0!==t&&void 0!==o)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==t){const o=e.schema[t];return void 0===r?{schema:o,schemaPath:s._`${e.schemaPath}${(0,s.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:o[r],schemaPath:s._`${e.schemaPath}${(0,s.getProperty)(t)}${(0,s.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,n.escapeFragment)(r)}`}}if(void 0!==o){if(void 0===a||void 0===i||void 0===c)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:a,topSchemaRef:c,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(e,t,{dataProp:r,dataPropType:o,data:a,dataTypes:i,propertyName:c}){if(void 0!==a&&void 0!==r)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:l}=t;if(void 0!==r){const{errorPath:a,dataPathArr:i,opts:c}=t;d(l.let("data",s._`${t.data}${(0,s.getProperty)(r)}`,!0)),e.errorPath=s.str`${a}${(0,n.getErrorPath)(r,o,c.jsPropertySyntax)}`,e.parentDataProperty=s._`${r}`,e.dataPathArr=[...i,e.parentDataProperty]}function d(r){e.data=r,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,r]}void 0!==a&&(d(a instanceof s.Name?a:l.let("data",a,!0)),void 0!==c&&(e.propertyName=c)),i&&(e.dataTypes=i)},t.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:s,createErrors:n,allErrors:o}){void 0!==s&&(e.compositeRule=s),void 0!==n&&(e.createErrors=n),void 0!==o&&(e.allErrors=o),e.jtdDiscriminator=t,e.jtdMetadata=r}},4042(e,t,r){r(2586),r(9029);const s=r(3558),n=r(4551),o=r(396),a=r(3835),i=r(9029),c=r(6939),l=r(208),d=r(4227),u=r(3837),f=r(5944),h=(e,t)=>new RegExp(e,t);h.code="new RegExp";const m=["removeAdditional","useDefaults","coerceTypes"],p=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),y={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."},g={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function v(e){var t,r,s,n,o,a,i,c,l,d,u,m,p,y,g,v,$,w,b,_,S,E,k,P,N;const j=e.strict,x=null===(t=e.code)||void 0===t?void 0:t.optimize,O=!0===x||void 0===x?1:x||0,C=null!==(s=null===(r=e.code)||void 0===r?void 0:r.regExp)&&void 0!==s?s:h,I=null!==(n=e.uriResolver)&&void 0!==n?n:f.default;return{strictSchema:null===(a=null!==(o=e.strictSchema)&&void 0!==o?o:j)||void 0===a||a,strictNumbers:null===(c=null!==(i=e.strictNumbers)&&void 0!==i?i:j)||void 0===c||c,strictTypes:null!==(d=null!==(l=e.strictTypes)&&void 0!==l?l:j)&&void 0!==d?d:"log",strictTuples:null!==(m=null!==(u=e.strictTuples)&&void 0!==u?u:j)&&void 0!==m?m:"log",strictRequired:null!==(y=null!==(p=e.strictRequired)&&void 0!==p?p:j)&&void 0!==y&&y,code:e.code?{...e.code,optimize:O,regExp:C}:{optimize:O,regExp:C},loopRequired:null!==(g=e.loopRequired)&&void 0!==g?g:200,loopEnum:null!==(v=e.loopEnum)&&void 0!==v?v:200,meta:null===($=e.meta)||void 0===$||$,messages:null===(w=e.messages)||void 0===w||w,inlineRefs:null===(b=e.inlineRefs)||void 0===b||b,schemaId:null!==(_=e.schemaId)&&void 0!==_?_:"$id",addUsedSchema:null===(S=e.addUsedSchema)||void 0===S||S,validateSchema:null===(E=e.validateSchema)||void 0===E||E,validateFormats:null===(k=e.validateFormats)||void 0===k||k,unicodeRegExp:null===(P=e.unicodeRegExp)||void 0===P||P,int32range:null===(N=e.int32range)||void 0===N||N,uriResolver:I}}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,...v(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new i.ValueScope({scope:{},prefixes:p,es5:t,lines:r}),this.logger=function(e){if(!1===e)return P;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}(e.logger);const s=e.validateFormats;e.validateFormats=!1,this.RULES=(0,o.getRules)(),w.call(this,y,e,"NOT SUPPORTED"),w.call(this,g,e,"DEPRECATED","warn"),this._metaOpts=k.call(this),e.formats&&S.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&E.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),_.call(this),e.validateFormats=s}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:r}=this.opts;let s=u;"id"===r&&(s={...u},s.id=s.$id,delete s.$id),t&&e&&this.addMetaSchema(s,s[r],!1)}defaultMeta(){const{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let r;if("string"==typeof e){if(r=this.getSchema(e),!r)throw new Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);const s=r(t);return"$async"in r||(this.errors=r.errors),s}compile(e,t){const r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:r}=this.opts;return s.call(this,e,t);async function s(e,t){await o.call(this,e.$schema);const r=this._addSchema(e,t);return r.validate||a.call(this,r)}async function o(e){e&&!this.getSchema(e)&&await s.call(this,{$ref:e},!0)}async function a(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof n.default))throw t;return i.call(this,t),await c.call(this,t.missingSchema),a.call(this,e)}}function i({missingSchema:e,missingRef:t}){if(this.refs[e])throw new Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){const r=await l.call(this,e);this.refs[e]||await o.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function l(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,s=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,r,s);return this}let n;if("object"==typeof e){const{schemaId:t}=this.opts;if(n=e[t],void 0!==n&&"string"!=typeof n)throw new Error(`schema ${t} must be string`)}return t=(0,c.normalizeId)(t||n),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,s,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if("boolean"==typeof e)return!0;let r;if(r=e.$schema,void 0!==r&&"string"!=typeof r)throw new Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const s=this.validate(r,e);if(!s&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return s}getSchema(e){let t;for(;"string"==typeof(t=b.call(this,e));)e=t;if(void 0===t){const{schemaId:r}=this.opts,s=new a.SchemaEnv({schema:{},schemaId:r});if(t=a.resolveSchema.call(this,s,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const t=b.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{const t=e;this._cache.delete(t);let r=e[this.opts.schemaId];return r&&(r=(0,c.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if("string"==typeof e)r=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r);else{if("object"!=typeof e||void 0!==t)throw new Error("invalid addKeywords parameters");if(r=(t=e).keyword,Array.isArray(r)&&!r.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(j.call(this,r,t),!t)return(0,d.eachItem)(r,e=>x.call(this,e)),this;C.call(this,t);const s={...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)};return(0,d.eachItem)(r,0===s.type.length?e=>x.call(this,e,s):e=>s.type.forEach(t=>x.call(this,e,s,t))),this}getKeyword(e){const t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){const{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(const r of t.rules){const t=r.rules.findIndex(t=>t.keyword===e);t>=0&&r.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){return e&&0!==e.length?e.map(e=>`${r}${e.instancePath} ${e.message}`).reduce((e,r)=>e+t+r):"No errors"}$dataMetaSchema(e,t){const r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const s of t){const t=s.split("/").slice(1);let n=e;for(const e of t)n=n[e];for(const e in r){const t=r[e];if("object"!=typeof t)continue;const{$data:s}=t.definition,o=n[e];s&&o&&(n[e]=R(o))}}return e}_removeAllSchemas(e,t){for(const r in e){const s=e[r];t&&!t.test(r)||("string"==typeof s?delete e[r]:s&&!s.meta&&(this._cache.delete(s.schema),delete e[r]))}}_addSchema(e,t,r,s=this.opts.validateSchema,n=this.opts.addUsedSchema){let o;const{schemaId:i}=this.opts;if("object"==typeof e)o=e[i];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof e)throw new Error("schema must be object or boolean")}let l=this._cache.get(e);if(void 0!==l)return l;r=(0,c.normalizeId)(o||r);const d=c.getSchemaRefs.call(this,e,r);return l=new a.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:r,localRefs:d}),this._cache.set(l.schema,l),n&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=l),s&&this.validateSchema(e,!0),l}_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):a.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const t=this.opts;this.opts=this._metaOpts;try{a.compileSchema.call(this,e)}finally{this.opts=t}}}function w(e,t,r,s="error"){for(const n in e){const o=n;o in t&&this.logger[s](`${r}: option ${n}. ${e[o]}`)}}function b(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function _(){const e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function S(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function E(e){if(Array.isArray(e))this.addVocabulary(e);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const t in e){const r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}}function k(){const e={...this.opts};for(const t of m)delete e[t];return e}$.ValidationError=s.default,$.MissingRefError=n.default,t.default=$;const P={log(){},warn(){},error(){}},N=/^[a-z_$][a-z0-9_$:-]*$/i;function j(e,t){const{RULES:r}=this;if((0,d.eachItem)(e,e=>{if(r.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!N.test(e))throw new Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!("code"in t)&&!("validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function x(e,t,r){var s;const n=null==t?void 0:t.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:o}=this;let a=n?o.post:o.rules.find(({type:e})=>e===r);if(a||(a={type:r,rules:[]},o.rules.push(a)),o.keywords[e]=!0,!t)return;const i={keyword:e,definition:{...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)}};t.before?O.call(this,a,i,t.before):a.rules.push(i),o.all[e]=i,null===(s=t.implements)||void 0===s||s.forEach(e=>this.addKeyword(e))}function O(e,t,r){const s=e.rules.findIndex(e=>e.keyword===r);s>=0?e.rules.splice(s,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function C(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=R(t)),e.validateSchema=this.compile(t,!0))}const I={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function R(e){return{anyOf:[e,I]}}},6250(e,t,r){const s=r(2017);s.code='require("ajv/dist/runtime/equal").default',t.default=s},3853(e,t){function r(e){const t=e.length;let r,s=0,n=0;for(;n<t;)s++,r=e.charCodeAt(n++),r>=55296&&r<=56319&&n<t&&(r=e.charCodeAt(n),56320==(64512&r)&&n++);return s}t.default=r,r.code='require("ajv/dist/runtime/ucs2length").default'},5944(e,t,r){const s=r(8343);s.code='require("ajv/dist/runtime/uri").default',t.default=s},3558(e,t){Object.defineProperty(t,"__esModule",{value:!0});class r extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}t.default=r},5457(e,t,r){t.validateAdditionalItems=void 0;const s=r(9029),n=r(4227),o={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>s.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>s._`{limit: ${e}}`},code(e){const{parentSchema:t,it:r}=e,{items:s}=t;Array.isArray(s)?a(e,s):(0,n.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas')}};function a(e,t){const{gen:r,schema:o,data:a,keyword:i,it:c}=e;c.items=!0;const l=r.const("len",s._`${a}.length`);if(!1===o)e.setParams({len:t.length}),e.pass(s._`${l} <= ${t.length}`);else if("object"==typeof o&&!(0,n.alwaysValidSchema)(c,o)){const o=r.var("valid",s._`${l} <= ${t.length}`);r.if((0,s.not)(o),()=>function(o){r.forRange("i",t.length,l,t=>{e.subschema({keyword:i,dataProp:t,dataPropType:n.Type.Num},o),c.allErrors||r.if((0,s.not)(o),()=>r.break())})}(o)),e.ok(o)}}t.validateAdditionalItems=a,t.default=o},8660(e,t,r){const s=r(5765),n=r(9029),o=r(2023),a=r(4227),i={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>n._`{additionalProperty: ${e.additionalProperty}}`},code(e){const{gen:t,schema:r,parentSchema:i,data:c,errsCount:l,it:d}=e;if(!l)throw new Error("ajv implementation error");const{allErrors:u,opts:f}=d;if(d.props=!0,"all"!==f.removeAdditional&&(0,a.alwaysValidSchema)(d,r))return;const h=(0,s.allSchemaProperties)(i.properties),m=(0,s.allSchemaProperties)(i.patternProperties);function p(e){t.code(n._`delete ${c}[${e}]`)}function y(s){if("all"===f.removeAdditional||f.removeAdditional&&!1===r)p(s);else{if(!1===r)return e.setParams({additionalProperty:s}),e.error(),void(u||t.break());if("object"==typeof r&&!(0,a.alwaysValidSchema)(d,r)){const r=t.name("valid");"failing"===f.removeAdditional?(g(s,r,!1),t.if((0,n.not)(r),()=>{e.reset(),p(s)})):(g(s,r),u||t.if((0,n.not)(r),()=>t.break()))}}}function g(t,r,s){const n={keyword:"additionalProperties",dataProp:t,dataPropType:a.Type.Str};!1===s&&Object.assign(n,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(n,r)}t.forIn("key",c,r=>{h.length||m.length?t.if(function(r){let o;if(h.length>8){const e=(0,a.schemaRefOrVal)(d,i.properties,"properties");o=(0,s.isOwnProperty)(t,e,r)}else o=h.length?(0,n.or)(...h.map(e=>n._`${r} === ${e}`)):n.nil;return m.length&&(o=(0,n.or)(o,...m.map(t=>n._`${(0,s.usePattern)(e,t)}.test(${r})`))),(0,n.not)(o)}(r),()=>y(r)):y(r)}),e.ok(n._`${l} === ${o.default.errors}`)}};t.default=i},5844(e,t,r){const s=r(4227),n={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");const o=t.name("valid");r.forEach((t,r)=>{if((0,s.alwaysValidSchema)(n,t))return;const a=e.subschema({keyword:"allOf",schemaProp:r},o);e.ok(o),e.mergeEvaluated(a)})}};t.default=n},6505(e,t,r){const s={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:r(5765).validateUnion,error:{message:"must match a schema in anyOf"}};t.default=s},2661(e,t,r){const s=r(9029),n=r(4227),o={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>void 0===t?s.str`must contain at least ${e} valid item(s)`:s.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?s._`{minContains: ${e}}`:s._`{minContains: ${e}, maxContains: ${t}}`},code(e){const{gen:t,schema:r,parentSchema:o,data:a,it:i}=e;let c,l;const{minContains:d,maxContains:u}=o;i.opts.next?(c=void 0===d?1:d,l=u):c=1;const f=t.const("len",s._`${a}.length`);if(e.setParams({min:c,max:l}),void 0===l&&0===c)return void(0,n.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==l&&c>l)return(0,n.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),void e.fail();if((0,n.alwaysValidSchema)(i,r)){let t=s._`${f} >= ${c}`;return void 0!==l&&(t=s._`${t} && ${f} <= ${l}`),void e.pass(t)}i.items=!0;const h=t.name("valid");function m(){const e=t.name("_valid"),r=t.let("count",0);p(e,()=>t.if(e,()=>function(e){t.code(s._`${e}++`),void 0===l?t.if(s._`${e} >= ${c}`,()=>t.assign(h,!0).break()):(t.if(s._`${e} > ${l}`,()=>t.assign(h,!1).break()),1===c?t.assign(h,!0):t.if(s._`${e} >= ${c}`,()=>t.assign(h,!0)))}(r)))}function p(r,s){t.forRange("i",0,f,t=>{e.subschema({keyword:"contains",dataProp:t,dataPropType:n.Type.Num,compositeRule:!0},r),s()})}void 0===l&&1===c?p(h,()=>t.if(h,()=>t.break())):0===c?(t.let(h,!0),void 0!==l&&t.if(s._`${a}.length > 0`,m)):(t.let(h,!1),m()),e.result(h,()=>e.reset())}};t.default=o},3025(e,t,r){t.z3=void 0;const s=r(9029),n=r(4227),o=r(5765);t.z3={message:({params:{property:e,depsCount:t,deps:r}})=>{const n=1===t?"property":"properties";return s.str`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>s._`{property: ${e},
|
|
5
|
+
|| ${i} === "boolean" || ${n} === null`).assign(c,a._`[${n}]`)}}s.else(),m(e),s.endIf(),s.if(a._`${c} !== undefined`,()=>{s.assign(n,c),function({gen:e,parentData:t,parentDataProperty:r},s){e.if(a._`${t} !== undefined`,()=>e.assign(a._`${t}[${r}]`,s))}(e,c)})}(e,t,i):m(e)})}return l};const d=new Set(["string","number","integer","boolean","null"]);function u(e,t,r,s=c.Correct){const n=s===c.Correct?a.operators.EQ:a.operators.NEQ;let o;switch(e){case"null":return a._`${t} ${n} null`;case"array":o=a._`Array.isArray(${t})`;break;case"object":o=a._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=i(a._`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=i();break;default:return a._`typeof ${t} ${n} ${e}`}return s===c.Correct?o:(0,a.not)(o);function i(e=a.nil){return(0,a.and)(a._`typeof ${t} == "number"`,e,r?a._`isFinite(${t})`:a.nil)}}function f(e,t,r,s){if(1===e.length)return u(e[0],t,r,s);let n;const o=(0,i.toHash)(e);if(o.array&&o.object){const e=a._`typeof ${t} != "object"`;n=o.null?e:a._`!${t} || ${e}`,delete o.null,delete o.array,delete o.object}else n=a.nil;o.number&&delete o.integer;for(const e in o)n=(0,a.and)(n,u(e,t,r,s));return n}t.checkDataType=u,t.checkDataTypes=f;const h={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?a._`{type: ${e}}`:a._`{type: ${t}}`};function m(e){const t=function(e){const{gen:t,data:r,schema:s}=e,n=(0,i.schemaRefOrVal)(e,s,"type");return{gen:t,keyword:"type",data:r,schema:s.type,schemaCode:n,schemaValue:n,parentSchema:s,params:{},it:e}}(e);(0,o.reportError)(t,h)}t.reportTypeError=m},7870(e,t,r){t.assignDefaults=void 0;const s=r(9029),n=r(4227);function o(e,t,r){const{gen:o,compositeRule:a,data:i,opts:c}=e;if(void 0===r)return;const l=s._`${i}${(0,s.getProperty)(t)}`;if(a)return void(0,n.checkStrictMode)(e,`default is ignored for: ${l}`);let d=s._`${l} === undefined`;"empty"===c.useDefaults&&(d=s._`${d} || ${l} === null || ${l} === ""`),o.if(d,s._`${l} = ${(0,s.stringify)(r)}`)}t.assignDefaults=function(e,t){const{properties:r,items:s}=e.schema;if("object"===t&&r)for(const t in r)o(e,t,r[t].default);else"array"===t&&Array.isArray(s)&&s.forEach((t,r)=>o(e,r,t.default))}},2586(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;const s=r(8727),n=r(208),o=r(7887),a=r(208),i=r(7870),c=r(3673),l=r(4495),d=r(9029),u=r(2023),f=r(6939),h=r(4227),m=r(8708);function p({gen:e,validateName:t,schema:r,schemaEnv:s,opts:n},o){n.code.es5?e.func(t,d._`${u.default.data}, ${u.default.valCxt}`,s.$async,()=>{e.code(d._`"use strict"; ${y(r,n)}`),function(e,t){e.if(u.default.valCxt,()=>{e.var(u.default.instancePath,d._`${u.default.valCxt}.${u.default.instancePath}`),e.var(u.default.parentData,d._`${u.default.valCxt}.${u.default.parentData}`),e.var(u.default.parentDataProperty,d._`${u.default.valCxt}.${u.default.parentDataProperty}`),e.var(u.default.rootData,d._`${u.default.valCxt}.${u.default.rootData}`),t.dynamicRef&&e.var(u.default.dynamicAnchors,d._`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{e.var(u.default.instancePath,d._`""`),e.var(u.default.parentData,d._`undefined`),e.var(u.default.parentDataProperty,d._`undefined`),e.var(u.default.rootData,u.default.data),t.dynamicRef&&e.var(u.default.dynamicAnchors,d._`{}`)})}(e,n),e.code(o)}):e.func(t,d._`${u.default.data}, ${function(e){return d._`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${e.dynamicRef?d._`, ${u.default.dynamicAnchors}={}`:d.nil}}={}`}(n)}`,s.$async,()=>e.code(y(r,n)).code(o))}function y(e,t){const r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?d._`/*# sourceURL=${r} */`:d.nil}function g({schema:e,self:t}){if("boolean"==typeof e)return!e;for(const r in e)if(t.RULES.all[r])return!0;return!1}function $(e){return"boolean"!=typeof e.schema}function v(e){(0,h.checkUnknownRules)(e),function(e){const{schema:t,errSchemaPath:r,opts:s,self:n}=e;t.$ref&&s.ignoreKeywordsWithRef&&(0,h.schemaHasRulesButRef)(t,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function w(e,t){if(e.opts.jtd)return _(e,[],!1,t);const r=(0,n.getSchemaTypes)(e.schema);_(e,r,!(0,n.coerceAndCheckDataType)(e,r),t)}function b({gen:e,schemaEnv:t,schema:r,errSchemaPath:s,opts:n}){const o=r.$comment;if(!0===n.$comment)e.code(d._`${u.default.self}.logger.log(${o})`);else if("function"==typeof n.$comment){const r=d.str`${s}/$comment`,n=e.scopeValue("root",{ref:t.root});e.code(d._`${u.default.self}.opts.$comment(${o}, ${r}, ${n}.schema)`)}}function _(e,t,r,s){const{gen:n,schema:i,data:c,allErrors:l,opts:f,self:m}=e,{RULES:p}=m;function y(h){(0,o.shouldUseGroup)(i,h)&&(h.type?(n.if((0,a.checkDataType)(h.type,c,f.strictNumbers)),S(e,h),1===t.length&&t[0]===h.type&&r&&(n.else(),(0,a.reportTypeError)(e)),n.endIf()):S(e,h),l||n.if(d._`${u.default.errors} === ${s||0}`))}!i.$ref||!f.ignoreKeywordsWithRef&&(0,h.schemaHasRulesButRef)(i,p)?(f.jtd||function(e,t){!e.schemaEnv.meta&&e.opts.strictTypes&&(function(e,t){t.length&&(e.dataTypes.length?(t.forEach(t=>{E(e.dataTypes,t)||k(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}),function(e,t){const r=[];for(const s of e.dataTypes)E(t,s)?r.push(s):t.includes("integer")&&"number"===s&&r.push("integer");e.dataTypes=r}(e,t)):e.dataTypes=t)}(e,t),e.opts.allowUnionTypes||function(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&k(e,"use allowUnionTypes to allow union type keyword")}(e,t),function(e,t){const r=e.self.RULES.all;for(const s in r){const n=r[s];if("object"==typeof n&&(0,o.shouldUseRule)(e.schema,n)){const{type:r}=n.definition;r.length&&!r.some(e=>{return s=e,(r=t).includes(s)||"number"===s&&r.includes("integer");var r,s})&&k(e,`missing type "${r.join(",")}" for keyword "${s}"`)}}}(e,e.dataTypes))}(e,t),n.block(()=>{for(const e of p.rules)y(e);y(p.post)})):n.block(()=>N(e,"$ref",p.all.$ref.definition))}function S(e,t){const{gen:r,schema:s,opts:{useDefaults:n}}=e;n&&(0,i.assignDefaults)(e,t.type),r.block(()=>{for(const r of t.rules)(0,o.shouldUseRule)(s,r)&&N(e,r.keyword,r.definition,t.type)})}function E(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function k(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,h.checkStrictMode)(e,t,e.opts.strictTypes)}t.validateFunctionCode=function(e){$(e)&&(v(e),g(e))?function(e){const{schema:t,opts:r,gen:s}=e;p(e,()=>{r.$comment&&t.$comment&&b(e),function(e){const{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&(0,h.checkStrictMode)(e,"default is ignored in the schema root")}(e),s.let(u.default.vErrors,null),s.let(u.default.errors,0),r.unevaluated&&function(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",d._`${r}.evaluated`),t.if(d._`${e.evaluated}.dynamicProps`,()=>t.assign(d._`${e.evaluated}.props`,d._`undefined`)),t.if(d._`${e.evaluated}.dynamicItems`,()=>t.assign(d._`${e.evaluated}.items`,d._`undefined`))}(e),w(e),function(e){const{gen:t,schemaEnv:r,validateName:s,ValidationError:n,opts:o}=e;r.$async?t.if(d._`${u.default.errors} === 0`,()=>t.return(u.default.data),()=>t.throw(d._`new ${n}(${u.default.vErrors})`)):(t.assign(d._`${s}.errors`,u.default.vErrors),o.unevaluated&&function({gen:e,evaluated:t,props:r,items:s}){r instanceof d.Name&&e.assign(d._`${t}.props`,r),s instanceof d.Name&&e.assign(d._`${t}.items`,s)}(e),t.return(d._`${u.default.errors} === 0`))}(e)})}(e):p(e,()=>(0,s.topBoolOrEmptySchema)(e))};class P{constructor(e,t,r){if((0,c.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,h.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",x(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,c.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",u.default.errors))}result(e,t,r){this.failResult((0,d.not)(e),t,r)}failResult(e,t,r){this.gen.if(e),r?r():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,d.not)(e),void 0,t)}fail(e){if(void 0===e)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:t}=this;this.fail(d._`${t} !== undefined && (${(0,d.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t)return this.setParams(t),this._error(e,r),void this.setParams({});this._error(e,r)}_error(e,t){(e?m.reportExtraError:m.reportError)(this,this.def.error,t)}$dataError(){(0,m.reportError)(this,this.def.$dataError||m.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,m.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,r=d.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=d.nil,t=d.nil){if(!this.$data)return;const{gen:r,schemaCode:s,schemaType:n,def:o}=this;r.if((0,d.or)(d._`${s} === undefined`,t)),e!==d.nil&&r.assign(e,!0),(n.length||o.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==d.nil&&r.assign(e,!1)),r.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:r,def:s,it:n}=this;return(0,d.or)(function(){if(r.length){if(!(t instanceof d.Name))throw new Error("ajv implementation error");const e=Array.isArray(r)?r:[r];return d._`${(0,a.checkDataTypes)(e,t,n.opts.strictNumbers,a.DataType.Wrong)}`}return d.nil}(),function(){if(s.validateSchema){const r=e.scopeValue("validate$data",{ref:s.validateSchema});return d._`!${r}(${t})`}return d.nil}())}subschema(e,t){const r=(0,l.getSubschema)(this.it,e);(0,l.extendSubschemaData)(r,this.it,e),(0,l.extendSubschemaMode)(r,e);const n={...this.it,...r,items:void 0,props:void 0};return function(e,t){$(e)&&(v(e),g(e))?function(e,t){const{schema:r,gen:s,opts:n}=e;n.$comment&&r.$comment&&b(e),function(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,f.resolveUrl)(e.opts.uriResolver,e.baseId,t))}(e),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}(e);const o=s.const("_errs",u.default.errors);w(e,o),s.var(t,d._`${o} === ${u.default.errors}`)}(e,t):(0,s.boolOrEmptySchema)(e,t)}(n,t),n}mergeEvaluated(e,t){const{it:r,gen:s}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=h.mergeEvaluated.props(s,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=h.mergeEvaluated.items(s,e.items,r.items,t)))}mergeValidEvaluated(e,t){const{it:r,gen:s}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return s.if(t,()=>this.mergeEvaluated(e,d.Name)),!0}}function N(e,t,r,s){const n=new P(e,r,t);"code"in r?r.code(n,s):n.$data&&r.validate?(0,c.funcKeywordCode)(n,r):"macro"in r?(0,c.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,c.funcKeywordCode)(n,r)}t.KeywordCxt=P;const j=/^\/(?:[^~]|~0|~1)*$/,O=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function x(e,{dataLevel:t,dataNames:r,dataPathArr:s}){let n,o;if(""===e)return u.default.rootData;if("/"===e[0]){if(!j.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);n=e,o=u.default.rootData}else{const a=O.exec(e);if(!a)throw new Error(`Invalid JSON-pointer: ${e}`);const i=+a[1];if(n=a[2],"#"===n){if(i>=t)throw new Error(c("property/index",i));return s[t-i]}if(i>t)throw new Error(c("data",i));if(o=r[t-i],!n)return o}let a=o;const i=n.split("/");for(const e of i)e&&(o=d._`${o}${(0,d.getProperty)((0,h.unescapeJsonPointer)(e))}`,a=d._`${a} && ${o}`);return a;function c(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}t.getData=x},3673(e,t,r){t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;const s=r(9029),n=r(2023),o=r(5765),a=r(8708);function i(e){const{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,s._`${n.parentData}[${n.parentDataProperty}]`))}function c(e,t,r){if(void 0===r)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword","function"==typeof r?{ref:r}:{ref:r,code:(0,s.stringify)(r)})}t.macroKeywordCode=function(e,t){const{gen:r,keyword:n,schema:o,parentSchema:a,it:i}=e,l=t.macro.call(i.self,o,a,i),d=c(r,n,l);!1!==i.opts.validateSchema&&i.self.validateSchema(l,!0);const u=r.name("valid");e.subschema({schema:l,schemaPath:s.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:d,compositeRule:!0},u),e.pass(u,()=>e.error(!0))},t.funcKeywordCode=function(e,t){var r;const{gen:l,keyword:d,schema:u,parentSchema:f,$data:h,it:m}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}(m,t);const p=!h&&t.compile?t.compile.call(m.self,u,f,m):t.validate,y=c(l,d,p),g=l.let("valid");function $(r=(t.async?s._`await `:s.nil)){const a=m.opts.passContext?n.default.this:n.default.self,i=!("compile"in t&&!h||!1===t.schema);l.assign(g,s._`${r}${(0,o.callValidateCode)(e,y,a,i)}`,t.modifying)}function v(e){var r;l.if((0,s.not)(null!==(r=t.valid)&&void 0!==r?r:g),e)}e.block$data(g,function(){if(!1===t.errors)$(),t.modifying&&i(e),v(()=>e.error());else{const r=t.async?function(){const e=l.let("ruleErrs",null);return l.try(()=>$(s._`await `),t=>l.assign(g,!1).if(s._`${t} instanceof ${m.ValidationError}`,()=>l.assign(e,s._`${t}.errors`),()=>l.throw(t))),e}():function(){const e=s._`${y}.errors`;return l.assign(e,null),$(s.nil),e}();t.modifying&&i(e),v(()=>function(e,t){const{gen:r}=e;r.if(s._`Array.isArray(${t})`,()=>{r.assign(n.default.vErrors,s._`${n.default.vErrors} === null ? ${t} : ${n.default.vErrors}.concat(${t})`).assign(n.default.errors,s._`${n.default.vErrors}.length`),(0,a.extendErrors)(e)},()=>e.error())}(e,r))}}),e.ok(null!==(r=t.valid)&&void 0!==r?r:g)},t.validSchemaType=function(e,t,r=!1){return!t.length||t.some(t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||r&&void 0===e)},t.validateKeywordUsage=function({schema:e,opts:t,self:r,errSchemaPath:s},n,o){if(Array.isArray(n.keyword)?!n.keyword.includes(o):n.keyword!==o)throw new Error("ajv implementation error");const a=n.dependencies;if(null==a?void 0:a.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw new Error(`parent schema must have dependencies of ${o}: ${a.join(",")}`);if(n.validateSchema&&!n.validateSchema(e[o])){const e=`keyword "${o}" value is invalid at path "${s}": `+r.errorsText(n.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);r.logger.error(e)}}},4495(e,t,r){t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;const s=r(9029),n=r(4227);t.getSubschema=function(e,{keyword:t,schemaProp:r,schema:o,schemaPath:a,errSchemaPath:i,topSchemaRef:c}){if(void 0!==t&&void 0!==o)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==t){const o=e.schema[t];return void 0===r?{schema:o,schemaPath:s._`${e.schemaPath}${(0,s.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:o[r],schemaPath:s._`${e.schemaPath}${(0,s.getProperty)(t)}${(0,s.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,n.escapeFragment)(r)}`}}if(void 0!==o){if(void 0===a||void 0===i||void 0===c)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:a,topSchemaRef:c,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(e,t,{dataProp:r,dataPropType:o,data:a,dataTypes:i,propertyName:c}){if(void 0!==a&&void 0!==r)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:l}=t;if(void 0!==r){const{errorPath:a,dataPathArr:i,opts:c}=t;d(l.let("data",s._`${t.data}${(0,s.getProperty)(r)}`,!0)),e.errorPath=s.str`${a}${(0,n.getErrorPath)(r,o,c.jsPropertySyntax)}`,e.parentDataProperty=s._`${r}`,e.dataPathArr=[...i,e.parentDataProperty]}function d(r){e.data=r,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,r]}void 0!==a&&(d(a instanceof s.Name?a:l.let("data",a,!0)),void 0!==c&&(e.propertyName=c)),i&&(e.dataTypes=i)},t.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:s,createErrors:n,allErrors:o}){void 0!==s&&(e.compositeRule=s),void 0!==n&&(e.createErrors=n),void 0!==o&&(e.allErrors=o),e.jtdDiscriminator=t,e.jtdMetadata=r}},4042(e,t,r){r(2586),r(9029);const s=r(3558),n=r(4551),o=r(396),a=r(3835),i=r(9029),c=r(6939),l=r(208),d=r(4227),u=r(3837),f=r(5944),h=(e,t)=>new RegExp(e,t);h.code="new RegExp";const m=["removeAdditional","useDefaults","coerceTypes"],p=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),y={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."},g={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function $(e){var t,r,s,n,o,a,i,c,l,d,u,m,p,y,g,$,v,w,b,_,S,E,k,P,N;const j=e.strict,O=null===(t=e.code)||void 0===t?void 0:t.optimize,x=!0===O||void 0===O?1:O||0,I=null!==(s=null===(r=e.code)||void 0===r?void 0:r.regExp)&&void 0!==s?s:h,C=null!==(n=e.uriResolver)&&void 0!==n?n:f.default;return{strictSchema:null===(a=null!==(o=e.strictSchema)&&void 0!==o?o:j)||void 0===a||a,strictNumbers:null===(c=null!==(i=e.strictNumbers)&&void 0!==i?i:j)||void 0===c||c,strictTypes:null!==(d=null!==(l=e.strictTypes)&&void 0!==l?l:j)&&void 0!==d?d:"log",strictTuples:null!==(m=null!==(u=e.strictTuples)&&void 0!==u?u:j)&&void 0!==m?m:"log",strictRequired:null!==(y=null!==(p=e.strictRequired)&&void 0!==p?p:j)&&void 0!==y&&y,code:e.code?{...e.code,optimize:x,regExp:I}:{optimize:x,regExp:I},loopRequired:null!==(g=e.loopRequired)&&void 0!==g?g:200,loopEnum:null!==($=e.loopEnum)&&void 0!==$?$:200,meta:null===(v=e.meta)||void 0===v||v,messages:null===(w=e.messages)||void 0===w||w,inlineRefs:null===(b=e.inlineRefs)||void 0===b||b,schemaId:null!==(_=e.schemaId)&&void 0!==_?_:"$id",addUsedSchema:null===(S=e.addUsedSchema)||void 0===S||S,validateSchema:null===(E=e.validateSchema)||void 0===E||E,validateFormats:null===(k=e.validateFormats)||void 0===k||k,unicodeRegExp:null===(P=e.unicodeRegExp)||void 0===P||P,int32range:null===(N=e.int32range)||void 0===N||N,uriResolver:C}}class v{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,...$(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new i.ValueScope({scope:{},prefixes:p,es5:t,lines:r}),this.logger=function(e){if(!1===e)return P;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}(e.logger);const s=e.validateFormats;e.validateFormats=!1,this.RULES=(0,o.getRules)(),w.call(this,y,e,"NOT SUPPORTED"),w.call(this,g,e,"DEPRECATED","warn"),this._metaOpts=k.call(this),e.formats&&S.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&E.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),_.call(this),e.validateFormats=s}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:r}=this.opts;let s=u;"id"===r&&(s={...u},s.id=s.$id,delete s.$id),t&&e&&this.addMetaSchema(s,s[r],!1)}defaultMeta(){const{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let r;if("string"==typeof e){if(r=this.getSchema(e),!r)throw new Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);const s=r(t);return"$async"in r||(this.errors=r.errors),s}compile(e,t){const r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:r}=this.opts;return s.call(this,e,t);async function s(e,t){await o.call(this,e.$schema);const r=this._addSchema(e,t);return r.validate||a.call(this,r)}async function o(e){e&&!this.getSchema(e)&&await s.call(this,{$ref:e},!0)}async function a(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof n.default))throw t;return i.call(this,t),await c.call(this,t.missingSchema),a.call(this,e)}}function i({missingSchema:e,missingRef:t}){if(this.refs[e])throw new Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){const r=await l.call(this,e);this.refs[e]||await o.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function l(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,s=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,r,s);return this}let n;if("object"==typeof e){const{schemaId:t}=this.opts;if(n=e[t],void 0!==n&&"string"!=typeof n)throw new Error(`schema ${t} must be string`)}return t=(0,c.normalizeId)(t||n),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,s,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if("boolean"==typeof e)return!0;let r;if(r=e.$schema,void 0!==r&&"string"!=typeof r)throw new Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const s=this.validate(r,e);if(!s&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return s}getSchema(e){let t;for(;"string"==typeof(t=b.call(this,e));)e=t;if(void 0===t){const{schemaId:r}=this.opts,s=new a.SchemaEnv({schema:{},schemaId:r});if(t=a.resolveSchema.call(this,s,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const t=b.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{const t=e;this._cache.delete(t);let r=e[this.opts.schemaId];return r&&(r=(0,c.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if("string"==typeof e)r=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r);else{if("object"!=typeof e||void 0!==t)throw new Error("invalid addKeywords parameters");if(r=(t=e).keyword,Array.isArray(r)&&!r.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(j.call(this,r,t),!t)return(0,d.eachItem)(r,e=>O.call(this,e)),this;I.call(this,t);const s={...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)};return(0,d.eachItem)(r,0===s.type.length?e=>O.call(this,e,s):e=>s.type.forEach(t=>O.call(this,e,s,t))),this}getKeyword(e){const t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){const{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(const r of t.rules){const t=r.rules.findIndex(t=>t.keyword===e);t>=0&&r.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){return e&&0!==e.length?e.map(e=>`${r}${e.instancePath} ${e.message}`).reduce((e,r)=>e+t+r):"No errors"}$dataMetaSchema(e,t){const r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const s of t){const t=s.split("/").slice(1);let n=e;for(const e of t)n=n[e];for(const e in r){const t=r[e];if("object"!=typeof t)continue;const{$data:s}=t.definition,o=n[e];s&&o&&(n[e]=R(o))}}return e}_removeAllSchemas(e,t){for(const r in e){const s=e[r];t&&!t.test(r)||("string"==typeof s?delete e[r]:s&&!s.meta&&(this._cache.delete(s.schema),delete e[r]))}}_addSchema(e,t,r,s=this.opts.validateSchema,n=this.opts.addUsedSchema){let o;const{schemaId:i}=this.opts;if("object"==typeof e)o=e[i];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof e)throw new Error("schema must be object or boolean")}let l=this._cache.get(e);if(void 0!==l)return l;r=(0,c.normalizeId)(o||r);const d=c.getSchemaRefs.call(this,e,r);return l=new a.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:r,localRefs:d}),this._cache.set(l.schema,l),n&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=l),s&&this.validateSchema(e,!0),l}_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):a.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const t=this.opts;this.opts=this._metaOpts;try{a.compileSchema.call(this,e)}finally{this.opts=t}}}function w(e,t,r,s="error"){for(const n in e){const o=n;o in t&&this.logger[s](`${r}: option ${n}. ${e[o]}`)}}function b(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function _(){const e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function S(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function E(e){if(Array.isArray(e))this.addVocabulary(e);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const t in e){const r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}}function k(){const e={...this.opts};for(const t of m)delete e[t];return e}v.ValidationError=s.default,v.MissingRefError=n.default,t.default=v;const P={log(){},warn(){},error(){}},N=/^[a-z_$][a-z0-9_$:-]*$/i;function j(e,t){const{RULES:r}=this;if((0,d.eachItem)(e,e=>{if(r.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!N.test(e))throw new Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!("code"in t)&&!("validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function O(e,t,r){var s;const n=null==t?void 0:t.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:o}=this;let a=n?o.post:o.rules.find(({type:e})=>e===r);if(a||(a={type:r,rules:[]},o.rules.push(a)),o.keywords[e]=!0,!t)return;const i={keyword:e,definition:{...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)}};t.before?x.call(this,a,i,t.before):a.rules.push(i),o.all[e]=i,null===(s=t.implements)||void 0===s||s.forEach(e=>this.addKeyword(e))}function x(e,t,r){const s=e.rules.findIndex(e=>e.keyword===r);s>=0?e.rules.splice(s,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function I(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=R(t)),e.validateSchema=this.compile(t,!0))}const C={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function R(e){return{anyOf:[e,C]}}},6250(e,t,r){const s=r(2017);s.code='require("ajv/dist/runtime/equal").default',t.default=s},3853(e,t){function r(e){const t=e.length;let r,s=0,n=0;for(;n<t;)s++,r=e.charCodeAt(n++),r>=55296&&r<=56319&&n<t&&(r=e.charCodeAt(n),56320==(64512&r)&&n++);return s}t.default=r,r.code='require("ajv/dist/runtime/ucs2length").default'},5944(e,t,r){const s=r(8343);s.code='require("ajv/dist/runtime/uri").default',t.default=s},3558(e,t){Object.defineProperty(t,"__esModule",{value:!0});class r extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}t.default=r},5457(e,t,r){t.validateAdditionalItems=void 0;const s=r(9029),n=r(4227),o={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>s.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>s._`{limit: ${e}}`},code(e){const{parentSchema:t,it:r}=e,{items:s}=t;Array.isArray(s)?a(e,s):(0,n.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas')}};function a(e,t){const{gen:r,schema:o,data:a,keyword:i,it:c}=e;c.items=!0;const l=r.const("len",s._`${a}.length`);if(!1===o)e.setParams({len:t.length}),e.pass(s._`${l} <= ${t.length}`);else if("object"==typeof o&&!(0,n.alwaysValidSchema)(c,o)){const o=r.var("valid",s._`${l} <= ${t.length}`);r.if((0,s.not)(o),()=>function(o){r.forRange("i",t.length,l,t=>{e.subschema({keyword:i,dataProp:t,dataPropType:n.Type.Num},o),c.allErrors||r.if((0,s.not)(o),()=>r.break())})}(o)),e.ok(o)}}t.validateAdditionalItems=a,t.default=o},8660(e,t,r){const s=r(5765),n=r(9029),o=r(2023),a=r(4227),i={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>n._`{additionalProperty: ${e.additionalProperty}}`},code(e){const{gen:t,schema:r,parentSchema:i,data:c,errsCount:l,it:d}=e;if(!l)throw new Error("ajv implementation error");const{allErrors:u,opts:f}=d;if(d.props=!0,"all"!==f.removeAdditional&&(0,a.alwaysValidSchema)(d,r))return;const h=(0,s.allSchemaProperties)(i.properties),m=(0,s.allSchemaProperties)(i.patternProperties);function p(e){t.code(n._`delete ${c}[${e}]`)}function y(s){if("all"===f.removeAdditional||f.removeAdditional&&!1===r)p(s);else{if(!1===r)return e.setParams({additionalProperty:s}),e.error(),void(u||t.break());if("object"==typeof r&&!(0,a.alwaysValidSchema)(d,r)){const r=t.name("valid");"failing"===f.removeAdditional?(g(s,r,!1),t.if((0,n.not)(r),()=>{e.reset(),p(s)})):(g(s,r),u||t.if((0,n.not)(r),()=>t.break()))}}}function g(t,r,s){const n={keyword:"additionalProperties",dataProp:t,dataPropType:a.Type.Str};!1===s&&Object.assign(n,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(n,r)}t.forIn("key",c,r=>{h.length||m.length?t.if(function(r){let o;if(h.length>8){const e=(0,a.schemaRefOrVal)(d,i.properties,"properties");o=(0,s.isOwnProperty)(t,e,r)}else o=h.length?(0,n.or)(...h.map(e=>n._`${r} === ${e}`)):n.nil;return m.length&&(o=(0,n.or)(o,...m.map(t=>n._`${(0,s.usePattern)(e,t)}.test(${r})`))),(0,n.not)(o)}(r),()=>y(r)):y(r)}),e.ok(n._`${l} === ${o.default.errors}`)}};t.default=i},5844(e,t,r){const s=r(4227),n={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");const o=t.name("valid");r.forEach((t,r)=>{if((0,s.alwaysValidSchema)(n,t))return;const a=e.subschema({keyword:"allOf",schemaProp:r},o);e.ok(o),e.mergeEvaluated(a)})}};t.default=n},6505(e,t,r){const s={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:r(5765).validateUnion,error:{message:"must match a schema in anyOf"}};t.default=s},2661(e,t,r){const s=r(9029),n=r(4227),o={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>void 0===t?s.str`must contain at least ${e} valid item(s)`:s.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?s._`{minContains: ${e}}`:s._`{minContains: ${e}, maxContains: ${t}}`},code(e){const{gen:t,schema:r,parentSchema:o,data:a,it:i}=e;let c,l;const{minContains:d,maxContains:u}=o;i.opts.next?(c=void 0===d?1:d,l=u):c=1;const f=t.const("len",s._`${a}.length`);if(e.setParams({min:c,max:l}),void 0===l&&0===c)return void(0,n.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==l&&c>l)return(0,n.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),void e.fail();if((0,n.alwaysValidSchema)(i,r)){let t=s._`${f} >= ${c}`;return void 0!==l&&(t=s._`${t} && ${f} <= ${l}`),void e.pass(t)}i.items=!0;const h=t.name("valid");function m(){const e=t.name("_valid"),r=t.let("count",0);p(e,()=>t.if(e,()=>function(e){t.code(s._`${e}++`),void 0===l?t.if(s._`${e} >= ${c}`,()=>t.assign(h,!0).break()):(t.if(s._`${e} > ${l}`,()=>t.assign(h,!1).break()),1===c?t.assign(h,!0):t.if(s._`${e} >= ${c}`,()=>t.assign(h,!0)))}(r)))}function p(r,s){t.forRange("i",0,f,t=>{e.subschema({keyword:"contains",dataProp:t,dataPropType:n.Type.Num,compositeRule:!0},r),s()})}void 0===l&&1===c?p(h,()=>t.if(h,()=>t.break())):0===c?(t.let(h,!0),void 0!==l&&t.if(s._`${a}.length > 0`,m)):(t.let(h,!1),m()),e.result(h,()=>e.reset())}};t.default=o},3025(e,t,r){t.z3=void 0;const s=r(9029),n=r(4227),o=r(5765);t.z3={message:({params:{property:e,depsCount:t,deps:r}})=>{const n=1===t?"property":"properties";return s.str`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>s._`{property: ${e},
|
|
6
6
|
missingProperty: ${n},
|
|
7
7
|
depsCount: ${t},
|
|
8
|
-
deps: ${r}}`};const a={keyword:"dependencies",type:"object",schemaType:"object",error:t.z3,code(e){const[t,r]=function({schema:e}){const t={},r={};for(const s in e)"__proto__"!==s&&((Array.isArray(e[s])?t:r)[s]=e[s]);return[t,r]}(e);(function(e,t=e.schema){const{gen:r,data:n,it:a}=e;if(0===Object.keys(t).length)return;const i=r.let("missing");for(const c in t){const l=t[c];if(0===l.length)continue;const d=(0,o.propertyInData)(r,n,c,a.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(", ")}),a.allErrors?r.if(d,()=>{for(const t of l)(0,o.checkReportMissingProp)(e,t)}):(r.if(s._`${d} && (${(0,o.checkMissingProp)(e,l,i)})`),(0,o.reportMissingProp)(e,i),r.else())}})(e,t),function(e,t=e.schema){const{gen:r,data:s,keyword:a,it:i}=e,c=r.name("valid");for(const l in t)(0,n.alwaysValidSchema)(i,t[l])||(r.if((0,o.propertyInData)(r,s,l,i.opts.ownProperties),()=>{const t=e.subschema({keyword:a,schemaProp:l},c);e.mergeValidEvaluated(t,c)},()=>r.var(c,!0)),e.ok(c))}(e,r)}};t.default=a},1239(e,t,r){const s=r(9029),n=r(4227),o={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>s.str`must match "${e.ifClause}" schema`,params:({params:e})=>s._`{failingKeyword: ${e.ifClause}}`},code(e){const{gen:t,parentSchema:r,it:o}=e;void 0===r.then&&void 0===r.else&&(0,n.checkStrictMode)(o,'"if" without "then" and "else" is ignored');const i=a(o,"then"),c=a(o,"else");if(!i&&!c)return;const l=t.let("valid",!0),d=t.name("_valid");if(function(){const t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},d);e.mergeEvaluated(t)}(),e.reset(),i&&c){const r=t.let("ifClause");e.setParams({ifClause:r}),t.if(d,u("then",r),u("else",r))}else i?t.if(d,u("then")):t.if((0,s.not)(d),u("else"));function u(r,n){return()=>{const o=e.subschema({keyword:r},d);t.assign(l,d),e.mergeValidEvaluated(o,l),n?t.assign(n,s._`${r}`):e.setParams({ifClause:r})}}e.pass(l,()=>e.error(!0))}};function a(e,t){const r=e.schema[t];return void 0!==r&&!(0,n.alwaysValidSchema)(e,r)}t.default=o},6378(e,t,r){const s=r(5457),n=r(5354),o=r(494),a=r(3966),i=r(2661),c=r(3025),l=r(9713),d=r(8660),u=r(117),f=r(5333),h=r(7923),m=r(6505),p=r(6163),y=r(5844),g=r(1239),v=r(4426);t.default=function(e=!1){const t=[h.default,m.default,p.default,y.default,g.default,v.default,l.default,d.default,c.default,u.default,f.default];return e?t.push(n.default,a.default):t.push(s.default,o.default),t.push(i.default),t}},494(e,t,r){t.validateTuple=void 0;const s=r(9029),n=r(4227),o=r(5765),a={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:r}=e;if(Array.isArray(t))return i(e,"additionalItems",t);r.items=!0,(0,n.alwaysValidSchema)(r,t)||e.ok((0,o.validateArray)(e))}};function i(e,t,r=e.schema){const{gen:o,parentSchema:a,data:i,keyword:c,it:l}=e;!function(e){const{opts:s,errSchemaPath:o}=l,a=r.length,i=a===e.minItems&&(a===e.maxItems||!1===e[t]);if(s.strictTuples&&!i){const e=`"${c}" is ${a}-tuple, but minItems or maxItems/${t} are not specified or different at path "${o}"`;(0,n.checkStrictMode)(l,e,s.strictTuples)}}(a),l.opts.unevaluated&&r.length&&!0!==l.items&&(l.items=n.mergeEvaluated.items(o,r.length,l.items));const d=o.name("valid"),u=o.const("len",s._`${i}.length`);r.forEach((t,r)=>{(0,n.alwaysValidSchema)(l,t)||(o.if(s._`${u} > ${r}`,()=>e.subschema({keyword:c,schemaProp:r,dataProp:r},d)),e.ok(d))})}t.validateTuple=i,t.default=a},3966(e,t,r){const s=r(9029),n=r(4227),o=r(5765),a=r(5457),i={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>s.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>s._`{limit: ${e}}`},code(e){const{schema:t,parentSchema:r,it:s}=e,{prefixItems:i}=r;s.items=!0,(0,n.alwaysValidSchema)(s,t)||(i?(0,a.validateAdditionalItems)(e,i):e.ok((0,o.validateArray)(e)))}};t.default=i},7923(e,t,r){const s=r(4227),n={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:r,it:n}=e;if((0,s.alwaysValidSchema)(n,r))return void e.fail();const o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};t.default=n},6163(e,t,r){const s=r(9029),n=r(4227),o={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>s._`{passingSchemas: ${e.passing}}`},code(e){const{gen:t,schema:r,parentSchema:o,it:a}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(a.opts.discriminator&&o.discriminator)return;const i=r,c=t.let("valid",!1),l=t.let("passing",null),d=t.name("_valid");e.setParams({passing:l}),t.block(function(){i.forEach((r,o)=>{let i;(0,n.alwaysValidSchema)(a,r)?t.var(d,!0):i=e.subschema({keyword:"oneOf",schemaProp:o,compositeRule:!0},d),o>0&&t.if(s._`${d} && ${c}`).assign(c,!1).assign(l,s._`[${l}, ${o}]`).else(),t.if(d,()=>{t.assign(c,!0),t.assign(l,o),i&&e.mergeEvaluated(i,s.Name)})})}),e.result(c,()=>e.reset(),()=>e.error(!0))}};t.default=o},5333(e,t,r){const s=r(5765),n=r(9029),o=r(4227),a=r(4227),i={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,data:i,parentSchema:c,it:l}=e,{opts:d}=l,u=(0,s.allSchemaProperties)(r),f=u.filter(e=>(0,o.alwaysValidSchema)(l,r[e]));if(0===u.length||f.length===u.length&&(!l.opts.unevaluated||!0===l.props))return;const h=d.strictSchema&&!d.allowMatchingProperties&&c.properties,m=t.name("valid");!0===l.props||l.props instanceof n.Name||(l.props=(0,a.evaluatedPropsToName)(t,l.props));const{props:p}=l;function y(e){for(const t in h)new RegExp(e).test(t)&&(0,o.checkStrictMode)(l,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function g(r){t.forIn("key",i,o=>{t.if(n._`${(0,s.usePattern)(e,r)}.test(${o})`,()=>{const s=f.includes(r);s||e.subschema({keyword:"patternProperties",schemaProp:r,dataProp:o,dataPropType:a.Type.Str},m),l.opts.unevaluated&&!0!==p?t.assign(n._`${p}[${o}]`,!0):s||l.allErrors||t.if((0,n.not)(m),()=>t.break())})})}!function(){for(const e of u)h&&y(e),l.allErrors?g(e):(t.var(m,!0),g(e),t.if(m))}()}};t.default=i},5354(e,t,r){const s=r(494),n={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,s.validateTuple)(e,"items")};t.default=n},117(e,t,r){const s=r(2586),n=r(5765),o=r(4227),a=r(8660),i={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,parentSchema:i,data:c,it:l}=e;"all"===l.opts.removeAdditional&&void 0===i.additionalProperties&&a.default.code(new s.KeywordCxt(l,a.default,"additionalProperties"));const d=(0,n.allSchemaProperties)(r);for(const e of d)l.definedProperties.add(e);l.opts.unevaluated&&d.length&&!0!==l.props&&(l.props=o.mergeEvaluated.props(t,(0,o.toHash)(d),l.props));const u=d.filter(e=>!(0,o.alwaysValidSchema)(l,r[e]));if(0===u.length)return;const f=t.name("valid");for(const r of u)h(r)?m(r):(t.if((0,n.propertyInData)(t,c,r,l.opts.ownProperties)),m(r),l.allErrors||t.else().var(f,!0),t.endIf()),e.it.definedProperties.add(r),e.ok(f);function h(e){return l.opts.useDefaults&&!l.compositeRule&&void 0!==r[e].default}function m(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},f)}}};t.default=i},9713(e,t,r){const s=r(9029),n=r(4227),o={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>s._`{propertyName: ${e.propertyName}}`},code(e){const{gen:t,schema:r,data:o,it:a}=e;if((0,n.alwaysValidSchema)(a,r))return;const i=t.name("valid");t.forIn("key",o,r=>{e.setParams({propertyName:r}),e.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:!0},i),t.if((0,s.not)(i),()=>{e.error(!0),a.allErrors||t.break()})}),e.ok(i)}};t.default=o},4426(e,t,r){const s=r(4227),n={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){void 0===t.if&&(0,s.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};t.default=n},5765(e,t,r){t.validateUnion=t.validateArray=t.usePattern=t.callValidateCode=t.allSchemaProperties=t.noPropertyInData=t.propertyInData=t.isOwnProperty=t.reportMissingProp=t.checkMissingProp=t.checkReportMissingProp=void 0;const s=r(9029),n=r(4227),o=r(2023),a=r(4227);function i(e,t,r){return s._`${function(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:s._`Object.prototype.hasOwnProperty`})}(e)}.call(${t}, ${r})`}function c(e,t,r,n){const o=s._`${t}${(0,s.getProperty)(r)} === undefined`;return n?(0,s.or)(o,(0,s.not)(i(e,t,r))):o}t.checkReportMissingProp=function(e,t){const{gen:r,data:n,it:o}=e;r.if(c(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:s._`${t}`},!0),e.error()})},t.checkMissingProp=function({gen:e,data:t,it:{opts:r}},n,o){return(0,s.or)(...n.map(n=>(0,s.and)(c(e,t,n,r.ownProperties),s._`${o} = ${n}`)))},t.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},t.isOwnProperty=i,t.propertyInData=function(e,t,r,n){const o=s._`${t}${(0,s.getProperty)(r)} !== undefined`;return n?s._`${o} && ${i(e,t,r)}`:o},t.noPropertyInData=c,t.allSchemaProperties=function(e){return e?Object.keys(e).filter(e=>"__proto__"!==e):[]},t.callValidateCode=function({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:a,errorPath:i},it:c},l,d,u){const f=u?s._`${e}, ${t}, ${n}${a}`:t,h=[[o.default.instancePath,(0,s.strConcat)(o.default.instancePath,i)],[o.default.parentData,c.parentData],[o.default.parentDataProperty,c.parentDataProperty],[o.default.rootData,o.default.rootData]];c.opts.dynamicRef&&h.push([o.default.dynamicAnchors,o.default.dynamicAnchors]);const m=s._`${f}, ${r.object(...h)}`;return d!==s.nil?s._`${l}.call(${d}, ${m})`:s._`${l}(${m})`};const l=s._`new RegExp`;t.usePattern=function({gen:e,it:{opts:t}},r){const n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,i=o(r,n);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:s._`${"new RegExp"===o.code?l:(0,a.useFunc)(e,o)}(${r}, ${n})`})},t.validateArray=function(e){const{gen:t,data:r,keyword:o,it:a}=e,i=t.name("valid");if(a.allErrors){const e=t.let("valid",!0);return c(()=>t.assign(e,!1)),e}return t.var(i,!0),c(()=>t.break()),i;function c(a){const c=t.const("len",s._`${r}.length`);t.forRange("i",0,c,r=>{e.subschema({keyword:o,dataProp:r,dataPropType:n.Type.Num},i),t.if((0,s.not)(i),a)})}},t.validateUnion=function(e){const{gen:t,schema:r,keyword:o,it:a}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(e=>(0,n.alwaysValidSchema)(a,e))&&!a.opts.unevaluated)return;const i=t.let("valid",!1),c=t.name("_valid");t.block(()=>r.forEach((r,n)=>{const a=e.subschema({keyword:o,schemaProp:n,compositeRule:!0},c);t.assign(i,s._`${i} || ${c}`),e.mergeValidEvaluated(a,c)||t.if((0,s.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}},3463(e,t){const r={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};t.default=r},2128(e,t,r){const s=r(3463),n=r(3693),o=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",s.default,n.default];t.default=o},3693(e,t,r){const s=r(4551),n=r(5765),o=r(9029),a=r(2023),i=r(3835),c=r(4227),l={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:r,it:n}=e,{baseId:a,schemaEnv:c,validateName:l,opts:u,self:f}=n,{root:h}=c;if(("#"===r||"#/"===r)&&a===h.baseId)return function(){if(c===h)return d(e,l,c,c.$async);const r=t.scopeValue("root",{ref:h});return d(e,o._`${r}.validate`,h,h.$async)}();const m=i.resolveRef.call(f,h,a,r);if(void 0===m)throw new s.default(n.opts.uriResolver,a,r);return m instanceof i.SchemaEnv?function(t){const r=function(e,t){const{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):o._`${r.scopeValue("wrapper",{ref:t})}.validate`}(e,t);d(e,r,t,t.$async)}(m):function(s){const n=t.scopeValue("schema",!0===u.code.source?{ref:s,code:(0,o.stringify)(s)}:{ref:s}),a=t.name("valid"),i=e.subschema({schema:s,dataTypes:[],schemaPath:o.nil,topSchemaRef:n,errSchemaPath:r},a);e.mergeEvaluated(i),e.ok(a)}(m)}};function d(e,t,r,s){const{gen:i,it:l}=e,{allErrors:d,schemaEnv:u,opts:f}=l,h=f.passContext?a.default.this:o.nil;function m(e){const t=o._`${e}.errors`;i.assign(a.default.vErrors,o._`${a.default.vErrors} === null ? ${t} : ${a.default.vErrors}.concat(${t})`),i.assign(a.default.errors,o._`${a.default.vErrors}.length`)}function p(e){var t;if(!l.opts.unevaluated)return;const s=null===(t=null==r?void 0:r.validate)||void 0===t?void 0:t.evaluated;if(!0!==l.props)if(s&&!s.dynamicProps)void 0!==s.props&&(l.props=c.mergeEvaluated.props(i,s.props,l.props));else{const t=i.var("props",o._`${e}.evaluated.props`);l.props=c.mergeEvaluated.props(i,t,l.props,o.Name)}if(!0!==l.items)if(s&&!s.dynamicItems)void 0!==s.items&&(l.items=c.mergeEvaluated.items(i,s.items,l.items));else{const t=i.var("items",o._`${e}.evaluated.items`);l.items=c.mergeEvaluated.items(i,t,l.items,o.Name)}}s?function(){if(!u.$async)throw new Error("async schema referenced by sync schema");const r=i.let("valid");i.try(()=>{i.code(o._`await ${(0,n.callValidateCode)(e,t,h)}`),p(t),d||i.assign(r,!0)},e=>{i.if(o._`!(${e} instanceof ${l.ValidationError})`,()=>i.throw(e)),m(e),d||i.assign(r,!1)}),e.ok(r)}():e.result((0,n.callValidateCode)(e,t,h),()=>p(t),()=>m(t))}t.default=l},6653(e,t,r){const s=r(9029),n=r(7652),o=r(3835),a=r(4551),i=r(4227),c={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===n.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>s._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},code(e){const{gen:t,data:r,schema:c,parentSchema:l,it:d}=e,{oneOf:u}=l;if(!d.opts.discriminator)throw new Error("discriminator: requires discriminator option");const f=c.propertyName;if("string"!=typeof f)throw new Error("discriminator: requires propertyName");if(c.mapping)throw new Error("discriminator: mapping is not supported");if(!u)throw new Error("discriminator: requires oneOf keyword");const h=t.let("valid",!1),m=t.const("tag",s._`${r}${(0,s.getProperty)(f)}`);function p(r){const n=t.name("valid"),o=e.subschema({keyword:"oneOf",schemaProp:r},n);return e.mergeEvaluated(o,s.Name),n}t.if(s._`typeof ${m} == "string"`,()=>function(){const r=function(){var e;const t={},r=n(l);let s=!0;for(let t=0;t<u.length;t++){let l=u[t];if((null==l?void 0:l.$ref)&&!(0,i.schemaHasRulesButRef)(l,d.self.RULES)){const e=l.$ref;if(l=o.resolveRef.call(d.self,d.schemaEnv.root,d.baseId,e),l instanceof o.SchemaEnv&&(l=l.schema),void 0===l)throw new a.default(d.opts.uriResolver,d.baseId,e)}const h=null===(e=null==l?void 0:l.properties)||void 0===e?void 0:e[f];if("object"!=typeof h)throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${f}"`);s=s&&(r||n(l)),c(h,t)}if(!s)throw new Error(`discriminator: "${f}" must be required`);return t;function n({required:e}){return Array.isArray(e)&&e.includes(f)}function c(e,t){if(e.const)h(e.const,t);else{if(!e.enum)throw new Error(`discriminator: "properties/${f}" must have "const" or "enum"`);for(const r of e.enum)h(r,t)}}function h(e,r){if("string"!=typeof e||e in t)throw new Error(`discriminator: "${f}" values must be unique strings`);t[e]=r}}();t.if(!1);for(const e in r)t.elseIf(s._`${m} === ${e}`),t.assign(h,p(r[e]));t.else(),e.error(!1,{discrError:n.DiscrError.Mapping,tag:m,tagName:f}),t.endIf()}(),()=>e.error(!1,{discrError:n.DiscrError.Tag,tag:m,tagName:f})),e.ok(h)}};t.default=c},7652(e,t){var r;t.DiscrError=void 0,function(e){e.Tag="tag",e.Mapping="mapping"}(r||(t.DiscrError=r={}))},6144(e,t,r){const s=r(2128),n=r(7060),o=r(6378),a=r(7532),i=r(9857),c=[s.default,n.default,(0,o.default)(),a.default,i.metadataVocabulary,i.contentVocabulary];t.default=c},4737(e,t,r){const s=r(9029),n={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>s.str`must match format "${e}"`,params:({schemaCode:e})=>s._`{format: ${e}}`},code(e,t){const{gen:r,data:n,$data:o,schema:a,schemaCode:i,it:c}=e,{opts:l,errSchemaPath:d,schemaEnv:u,self:f}=c;l.validateFormats&&(o?function(){const o=r.scopeValue("formats",{ref:f.formats,code:l.code.formats}),a=r.const("fDef",s._`${o}[${i}]`),c=r.let("fType"),d=r.let("format");r.if(s._`typeof ${a} == "object" && !(${a} instanceof RegExp)`,()=>r.assign(c,s._`${a}.type || "string"`).assign(d,s._`${a}.validate`),()=>r.assign(c,s._`"string"`).assign(d,a)),e.fail$data((0,s.or)(!1===l.strictSchema?s.nil:s._`${i} && !${d}`,function(){const e=u.$async?s._`(${a}.async ? await ${d}(${n}) : ${d}(${n}))`:s._`${d}(${n})`,r=s._`(typeof ${d} == "function" ? ${e} : ${d}.test(${n}))`;return s._`${d} && ${d} !== true && ${c} === ${t} && !${r}`}()))}():function(){const o=f.formats[a];if(!o)return void function(){if(!1!==l.strictSchema)throw new Error(e());function e(){return`unknown format "${a}" ignored in schema at path "${d}"`}f.logger.warn(e())}();if(!0===o)return;const[i,c,h]=function(e){const t=e instanceof RegExp?(0,s.regexpCode)(e):l.code.formats?s._`${l.code.formats}${(0,s.getProperty)(a)}`:void 0,n=r.scopeValue("formats",{key:a,ref:e,code:t});return"object"!=typeof e||e instanceof RegExp?["string",e,n]:[e.type||"string",e.validate,s._`${n}.validate`]}(o);i===t&&e.pass(function(){if("object"==typeof o&&!(o instanceof RegExp)&&o.async){if(!u.$async)throw new Error("async format in sync schema");return s._`await ${h}(${n})`}return"function"==typeof c?s._`${h}(${n})`:s._`${h}.test(${n})`}())}())}};t.default=n},7532(e,t,r){const s=[r(4737).default];t.default=s},9857(e,t){t.contentVocabulary=t.metadataVocabulary=void 0,t.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],t.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]},7935(e,t,r){const s=r(9029),n=r(4227),o=r(6250),a={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>s._`{allowedValue: ${e}}`},code(e){const{gen:t,data:r,$data:a,schemaCode:i,schema:c}=e;a||c&&"object"==typeof c?e.fail$data(s._`!${(0,n.useFunc)(t,o.default)}(${r}, ${i})`):e.fail(s._`${c} !== ${r}`)}};t.default=a},8643(e,t,r){const s=r(9029),n=r(4227),o=r(6250),a={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>s._`{allowedValues: ${e}}`},code(e){const{gen:t,data:r,$data:a,schema:i,schemaCode:c,it:l}=e;if(!a&&0===i.length)throw new Error("enum must have non-empty array");const d=i.length>=l.opts.loopEnum;let u;const f=()=>null!=u?u:u=(0,n.useFunc)(t,o.default);let h;if(d||a)h=t.let("valid"),e.block$data(h,function(){t.assign(h,!1),t.forOf("v",c,e=>t.if(s._`${f()}(${r}, ${e})`,()=>t.assign(h,!0).break()))});else{if(!Array.isArray(i))throw new Error("ajv implementation error");const e=t.const("vSchema",c);h=(0,s.or)(...i.map((t,n)=>function(e,t){const n=i[t];return"object"==typeof n&&null!==n?s._`${f()}(${r}, ${e}[${t}])`:s._`${r} === ${n}`}(e,n)))}e.pass(h)}};t.default=a},7060(e,t,r){const s=r(5882),n=r(3439),o=r(7307),a=r(422),i=r(4486),c=r(4003),l=r(1163),d=r(617),u=r(7935),f=r(8643),h=[s.default,n.default,o.default,a.default,i.default,c.default,l.default,d.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,f.default];t.default=h},1163(e,t,r){const s=r(9029),n={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const r="maxItems"===e?"more":"fewer";return s.str`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>s._`{limit: ${e}}`},code(e){const{keyword:t,data:r,schemaCode:n}=e,o="maxItems"===t?s.operators.GT:s.operators.LT;e.fail$data(s._`${r}.length ${o} ${n}`)}};t.default=n},7307(e,t,r){const s=r(9029),n=r(4227),o=r(3853),a={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const r="maxLength"===e?"more":"fewer";return s.str`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>s._`{limit: ${e}}`},code(e){const{keyword:t,data:r,schemaCode:a,it:i}=e,c="maxLength"===t?s.operators.GT:s.operators.LT,l=!1===i.opts.unicode?s._`${r}.length`:s._`${(0,n.useFunc)(e.gen,o.default)}(${r})`;e.fail$data(s._`${l} ${c} ${a}`)}};t.default=a},5882(e,t,r){const s=r(9029),n=s.operators,o={maximum:{okStr:"<=",ok:n.LTE,fail:n.GT},minimum:{okStr:">=",ok:n.GTE,fail:n.LT},exclusiveMaximum:{okStr:"<",ok:n.LT,fail:n.GTE},exclusiveMinimum:{okStr:">",ok:n.GT,fail:n.LTE}},a={message:({keyword:e,schemaCode:t})=>s.str`must be ${o[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>s._`{comparison: ${o[e].okStr}, limit: ${t}}`},i={keyword:Object.keys(o),type:"number",schemaType:"number",$data:!0,error:a,code(e){const{keyword:t,data:r,schemaCode:n}=e;e.fail$data(s._`${r} ${o[t].fail} ${n} || isNaN(${r})`)}};t.default=i},4486(e,t,r){const s=r(9029),n={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const r="maxProperties"===e?"more":"fewer";return s.str`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>s._`{limit: ${e}}`},code(e){const{keyword:t,data:r,schemaCode:n}=e,o="maxProperties"===t?s.operators.GT:s.operators.LT;e.fail$data(s._`Object.keys(${r}).length ${o} ${n}`)}};t.default=n},3439(e,t,r){const s=r(9029),n={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>s.str`must be multiple of ${e}`,params:({schemaCode:e})=>s._`{multipleOf: ${e}}`},code(e){const{gen:t,data:r,schemaCode:n,it:o}=e,a=o.opts.multipleOfPrecision,i=t.let("res"),c=a?s._`Math.abs(Math.round(${i}) - ${i}) > 1e-${a}`:s._`${i} !== parseInt(${i})`;e.fail$data(s._`(${n} === 0 || (${i} = ${r}/${n}, ${c}))`)}};t.default=n},422(e,t,r){const s=r(5765),n=r(4227),o=r(9029),a={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>o.str`must match pattern "${e}"`,params:({schemaCode:e})=>o._`{pattern: ${e}}`},code(e){const{gen:t,data:r,$data:a,schema:i,schemaCode:c,it:l}=e,d=l.opts.unicodeRegExp?"u":"";if(a){const{regExp:s}=l.opts.code,a="new RegExp"===s.code?o._`new RegExp`:(0,n.useFunc)(t,s),i=t.let("valid");t.try(()=>t.assign(i,o._`${a}(${c}, ${d}).test(${r})`),()=>t.assign(i,!1)),e.fail$data(o._`!${i}`)}else{const t=(0,s.usePattern)(e,i);e.fail$data(o._`!${t}.test(${r})`)}}};t.default=a},4003(e,t,r){const s=r(5765),n=r(9029),o=r(4227),a={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>n.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>n._`{missingProperty: ${e}}`},code(e){const{gen:t,schema:r,schemaCode:a,data:i,$data:c,it:l}=e,{opts:d}=l;if(!c&&0===r.length)return;const u=r.length>=d.loopRequired;if(l.allErrors?function(){if(u||c)e.block$data(n.nil,f);else for(const t of r)(0,s.checkReportMissingProp)(e,t)}():function(){const o=t.let("missing");if(u||c){const r=t.let("valid",!0);e.block$data(r,()=>function(r,o){e.setParams({missingProperty:r}),t.forOf(r,a,()=>{t.assign(o,(0,s.propertyInData)(t,i,r,d.ownProperties)),t.if((0,n.not)(o),()=>{e.error(),t.break()})},n.nil)}(o,r)),e.ok(r)}else t.if((0,s.checkMissingProp)(e,r,o)),(0,s.reportMissingProp)(e,o),t.else()}(),d.strictRequired){const t=e.parentSchema.properties,{definedProperties:s}=e.it;for(const e of r)if(void 0===(null==t?void 0:t[e])&&!s.has(e)){const t=`required property "${e}" is not defined at "${l.schemaEnv.baseId+l.errSchemaPath}" (strictRequired)`;(0,o.checkStrictMode)(l,t,l.opts.strictRequired)}}function f(){t.forOf("prop",a,r=>{e.setParams({missingProperty:r}),t.if((0,s.noPropertyInData)(t,i,r,d.ownProperties),()=>e.error())})}}};t.default=a},617(e,t,r){const s=r(208),n=r(9029),o=r(4227),a=r(6250),i={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>n.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>n._`{i: ${e}, j: ${t}}`},code(e){const{gen:t,data:r,$data:i,schema:c,parentSchema:l,schemaCode:d,it:u}=e;if(!i&&!c)return;const f=t.let("valid"),h=l.items?(0,s.getSchemaTypes)(l.items):[];function m(o,a){const i=t.name("item"),c=(0,s.checkDataTypes)(h,i,u.opts.strictNumbers,s.DataType.Wrong),l=t.const("indices",n._`{}`);t.for(n._`;${o}--;`,()=>{t.let(i,n._`${r}[${o}]`),t.if(c,n._`continue`),h.length>1&&t.if(n._`typeof ${i} == "string"`,n._`${i} += "_"`),t.if(n._`typeof ${l}[${i}] == "number"`,()=>{t.assign(a,n._`${l}[${i}]`),e.error(),t.assign(f,!1).break()}).code(n._`${l}[${i}] = ${o}`)})}function p(s,i){const c=(0,o.useFunc)(t,a.default),l=t.name("outer");t.label(l).for(n._`;${s}--;`,()=>t.for(n._`${i} = ${s}; ${i}--;`,()=>t.if(n._`${c}(${r}[${s}], ${r}[${i}])`,()=>{e.error(),t.assign(f,!1).break(l)})))}e.block$data(f,function(){const s=t.let("i",n._`${r}.length`),o=t.let("j");e.setParams({i:s,j:o}),t.assign(f,!0),t.if(n._`${s} > 1`,()=>(h.length>0&&!h.some(e=>"object"===e||"array"===e)?m:p)(s,o))},n._`${d} === false`),e.ok(f)}};t.default=i},2017(e){e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var s,n,o;if(Array.isArray(t)){if((s=t.length)!=r.length)return!1;for(n=s;0!==n--;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((s=(o=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(n=s;0!==n--;)if(!Object.prototype.hasOwnProperty.call(r,o[n]))return!1;for(n=s;0!==n--;){var a=o[n];if(!e(t[a],r[a]))return!1}return!0}return t!=t&&r!=r}},7106(e){var t=e.exports=function(e,t,s){"function"==typeof t&&(s=t,t={}),r(t,"function"==typeof(s=t.cb||s)?s:s.pre||function(){},s.post||function(){},e,"",e)};function r(e,n,o,a,i,c,l,d,u,f){if(a&&"object"==typeof a&&!Array.isArray(a)){for(var h in n(a,i,c,l,d,u,f),a){var m=a[h];if(Array.isArray(m)){if(h in t.arrayKeywords)for(var p=0;p<m.length;p++)r(e,n,o,m[p],i+"/"+h+"/"+p,c,i,h,a,p)}else if(h in t.propsKeywords){if(m&&"object"==typeof m)for(var y in m)r(e,n,o,m[y],i+"/"+h+"/"+s(y),c,i,h,a,y)}else(h in t.keywords||e.allKeys&&!(h in t.skipKeywords))&&r(e,n,o,m,i+"/"+h,c,i,h,a)}o(a,i,c,l,d,u,f)}}function s(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}t.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},t.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},t.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},t.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0}},3903(t,r,s){var n=s(9627),o=s(5663),a=s(5316);function i(e,t){const r=[];let s,a=o.dirname(o.resolve(e));for(;void 0===s&&(s=t?.get(a),void 0===s);)r.push(a),n.existsSync(o.join(a,"infoCourse.json"))?s=a:o.dirname(a)===a?s=null:a=o.dirname(a);return r.forEach(e=>t?.set(e,s)),s}var c=s(8141);function l(e,t){let r=1,s=0;for(let n=0;n<t&&n<e.length;n++)"\n"===e[n]&&(r++,s=n+1);return{line:r,column:t-s+1}}var d=s(4269),u=s(1493),f=s(6897),h=s(2940);class m{courseRoot;plDate;usesByFile=new Map;namesByFile=new Map;filesByTarget=new Map;targetsUnder=new Map;constructor(e,t){this.courseRoot=e,this.plDate=t}holdsReferences(e){return(0,f.Li)((0,c.bo)(this.courseRoot,e))}update(e,t){this.remove(e);const r=(0,f.vz)(t),s=(0,c.bo)(this.courseRoot,e),n=(0,f.IO)(r,s,this.plDate,{courseRoot:this.courseRoot,fileDir:o.dirname(e)}),a=function(e){const t=(0,c.kt)(e,c.l$.question);if(!t&&!(0,c.kt)(e,c.l$.assessment))return;const s=r.doc.value,n=t&&Array.isArray(s?.tags)?s.tags:[],o=t||"string"!=typeof s?.set?[]:[s.set];return{tags:n.filter(e=>"string"==typeof e),assessmentSets:o}}(s);a&&this.namesByFile.set(e,a);const i=n.filter(e=>null!==e.target).map(r=>({file:e,ref:r,start:l(t,r.startOffset),end:l(t,r.endOffset)}));this.usesByFile.set(e,i);for(const t of i){const r=t.ref.target;let s=this.filesByTarget.get(r);s||(this.filesByTarget.set(r,s=new Set),this.countUnder(r,1)),s.add(e)}}remove(e){for(const t of this.usesByFile.get(e)??[]){const r=this.filesByTarget.get(t.ref.target);r?.delete(e),0===r?.size&&(this.filesByTarget.delete(t.ref.target),this.countUnder(t.ref.target,-1))}this.usesByFile.delete(e),this.namesByFile.delete(e)}files(){return[...this.usesByFile.keys()]}namesIn(e){return this.namesByFile.get(e)}namesUsed(e){const t=new Set;for(const r of this.namesByFile.values())r[e].forEach(e=>t.add(e));return t}usesIn(e){return this.usesByFile.get(e)??[]}usesOf(e){const t=[];for(let r=e;;r=o.dirname(r)){for(const s of this.filesByTarget.get(r)??[])for(const n of this.usesIn(s))n.ref.target===r&&p(n,r,e)&&t.push(n);if(r===this.courseRoot||o.dirname(r)===r)break}return t.sort((e,t)=>e.file.localeCompare(t.file)||e.ref.startOffset-t.ref.startOffset)}countUnder(e,t){for(let r=o.dirname(e);;r=o.dirname(r)){const e=(this.targetsUnder.get(r)??0)+t;if(0===e?this.targetsUnder.delete(r):this.targetsUnder.set(r,e),r===this.courseRoot||o.dirname(r)===r)break}}filesAffectedBy(e){const t=new Set,r=e=>this.filesByTarget.get(e)?.forEach(e=>t.add(e));for(let t=e;r(t),t!==this.courseRoot&&o.dirname(t)!==t;t=o.dirname(t));if(this.targetsUnder.has(e))for(const t of this.filesByTarget.keys())t.startsWith(e+o.sep)&&r(t);return[...t]}}function p(e,t,r){switch(e.ref.spec.target){case"file":return t===r;case"question":return t===r||o.dirname(r)===t;case"fileOrDir":return!0}}var y=s(4402),g=s(9889);function v(e){return Object.values(y.aO).some(t=>t.some(([,t])=>(0,c.kt)(e,t)))}function $(e,t,r){const s=r.ignoredDiagnostics.filter(t=>t.file===e);if(0===s.length)return t;const n=new Map;return t.filter(e=>{const t=e.code?.startsWith("prairielearn-navigator/")?e.code.slice(23).split("/")[0]:void 0;if(void 0===t||!(0,y.KX)(t))return!0;const r=`${t}\0${e.message}`,o=(n.get(r)??0)+1;return n.set(r,o),!s.some(r=>r.rule===t&&(void 0!==r.identifier?r.identifier===e.identifier:r.message===e.message&&r.occurrence===o))})}function w(e,t,r){const s=r.rules[t];return{...e,code:(0,y.NC)(t),severity:void 0!==s&&"off"!==s?s:e.severity}}function b(e,t){const r=new Map;if("off"===t.rules["question-info-missing"])return r;for(const{dir:s,anchor:i}of function(e){const t=[],r=e=>{const s=n.readdirSync(e,{withFileTypes:!0}).filter(e=>!e.name.startsWith(".")).sort((e,t)=>e.name<t.name?-1:e.name>t.name?1:0);let a=!1;for(const i of s){if(!i.isDirectory())continue;const s=o.join(e,i.name);if(n.existsSync(o.join(s,"info.json"))||r(s))a=!0;else{const e=n.readdirSync(s,{withFileTypes:!0}).filter(e=>!e.name.startsWith(".")&&!e.isDirectory()).map(e=>e.name).sort();if(e.length>0){const r=e.includes("question.html")?"question.html":e[0];t.push({dir:s,anchor:o.join(s,r)})}}}return a},s=o.join(e,"questions");return n.statSync(s,{throwIfNoEntry:!1})?.isDirectory()&&r(s),t.sort((e,t)=>e.dir<t.dir?-1:e.dir>t.dir?1:0)}(e)){if((0,a.RF)(t,i))continue;const n=o.join(s,"info.json"),l=$(i,[w({startOffset:0,endOffset:0,message:`directory "${(0,c.bo)(o.join(e,"questions"),s)}" in questions/ has files but no info.json: PrairieLearn will fail to load it from disk (Missing JSON file: ${(0,c.bo)(e,n)})`,severity:"error",related:[{path:n,message:"Expected location of info.json"}]},"question-info-missing",t)],t);l.length>0&&r.set(i,l)}return r}var _=s(3282),S=s.n(_);const E="PrairieLearn/PrairieLearn",k=["apps/prairielearn/src/schemas/schemas","schemas/schemas"];class P{options;problems=new Set;fetch;loading=new Map;resolving=new Map;constructor(e){this.options=e,this.fetch=e.fetch??globalThis.fetch}get cacheDir(){return this.options.cacheDir}get(e,t){const r=`${t}\0${e}`;let s=this.loading.get(r);return s||(s=this.load(e,t),this.loading.set(r,s)),s}async load(e,t){const r=await this.resolve(t);if(!r)return;const s=await this.schemaText(e,r);if(void 0!==s)try{return{validate:new(S())({allErrors:!0,strict:!1,validateFormats:!1}).compile(JSON.parse(s)),label:r.label}}catch(t){return void this.problems.add(`could not compile ${e} schema for PL ${r.label}: ${t}`)}}resolve(e){let t=this.resolving.get(e);return t||(t=this.resolveUncached(e),this.resolving.set(e,t)),t}async resolveUncached(e){if((0,d._$)(e))return{key:e,ref:e,label:e.slice(0,7)};if("latest"===e){const e=(0,d.Ec)();return{key:`master-${e}`,ref:"master",label:`latest (${e})`}}const t=this.readRefs()[e]??await this.lookupSha(e);return t?{key:t,ref:t,label:`${e} (${t.slice(0,7)})`}:void 0}async lookupSha(e){const t=`https://api.github.com/repos/${E}/commits?sha=master&until=${e}T23:59:59Z&per_page=1`,r={accept:"application/vnd.github+json"};this.options.githubToken&&(r.authorization=`Bearer ${this.options.githubToken}`);try{const s=await this.fetch(t,{headers:r});if(!s.ok){const t=403===s.status||429===s.status?" (rate limited; set GITHUB_TOKEN or pin a commit sha)":"";return void this.problems.add(`could not resolve PL version ${e}: GitHub API returned ${s.status}${t}`)}const n=await s.json(),o=n[0]?.sha;return o?(this.writeRefs({...this.readRefs(),[e]:o}),o):void this.problems.add(`no PrairieLearn commit found on or before ${e}`)}catch(t){return void this.problems.add(`could not resolve PL version ${e} (offline?): ${t}`)}}async schemaText(e,t){const r=o.join(this.options.cacheDir,t.key),s=o.join(r,`${e}.json`);if(n.existsSync(s))return n.readFileSync(s,"utf-8");let a="";for(const n of k){const o=`https://raw.githubusercontent.com/${E}/${t.ref}/${n}/${e}.json`;try{const e=await this.fetch(o);if(e.ok){const n=await e.text();return this.writeCache(r,s,n,t),n}if(a=`HTTP ${e.status}`,404!==e.status)break}catch(r){return void this.problems.add(`schema ${e} for PL ${t.label} is not cached and could not be downloaded (offline?): ${r}`)}}this.problems.add(`schema ${e} not found for PL ${t.label} (${a})`)}writeCache(e,t,r,s){try{n.mkdirSync(e,{recursive:!0}),n.writeFileSync(t,r),"master"===s.ref&&this.pruneStaleLatest(s.key)}catch(t){this.problems.add(`could not write schema cache ${e}: ${t}`)}}pruneStaleLatest(e){for(const t of n.readdirSync(this.options.cacheDir))t.startsWith("master-")&&t!==e&&n.rmSync(o.join(this.options.cacheDir,t),{recursive:!0,force:!0})}get refsFile(){return o.join(this.options.cacheDir,"refs.json")}readRefs(){try{return JSON.parse(n.readFileSync(this.refsFile,"utf-8"))}catch{return{}}}writeRefs(e){try{n.mkdirSync(this.options.cacheDir,{recursive:!0}),n.writeFileSync(this.refsFile,JSON.stringify(e,void 0,2)+"\n")}catch(e){this.problems.add(`could not write ${this.refsFile}: ${e}`)}}}class N{configPath;overrides;byCourse=new Map;stores=new Map;constructor(e,t){this.configPath=e,this.overrides=t}get(e){let t=this.byCourse.get(e);if(!t){const r=(0,a.Z9)(e,{configPath:this.configPath,overrides:this.overrides}),{schemaCacheDir:s}=r.config;let i=this.stores.get(s);i||(i=new P({cacheDir:s,githubToken:process.env.GITHUB_TOKEN}),this.stores.set(s,i));const c=y.np.every(e=>"off"===r.config.rules[e])?void 0:function(e,t){const r=new m(e,t);for(const t of function(e){const t=[...new Set(h.c.map(e=>e.files))];return n.globSync(t,{cwd:e}).map(t=>o.join(e,t))}(e))r.update(t,n.readFileSync(t,"utf-8"));return r}(e,(0,d.JX)(r.config.plVersion));t={loaded:r,schemas:i,references:c},this.byCourse.set(e,t)}return t}configProblems(){const e=new Map;for(const{loaded:t}of this.byCourse.values())t.file&&t.problems.some(e=>e.file)&&e.set(t.file,t.problems.filter(e=>e.file));return e}schemaProblems(){return[...this.stores.values()].flatMap(e=>[...e.problems])}}function j(e,t,r){const s=l(t,e.startOffset),n=l(t,e.endOffset),o=e.code?.replace(/^prairielearn-navigator\//,"");return{file:r,line:s.line,column:s.column,endLine:n.line,endColumn:n.column,message:o?`${e.message} [${o}]`:e.message,severity:e.severity}}async function x(e,t,r,s){const a=n.readFileSync(e,"utf-8"),i=await async function(e,t,r){const{courseRoot:s,config:n,schemas:o,references:a}=r,i=(0,c.bo)(s,e),l=(0,d.JX)(n.plVersion);let u;const f={courseRoot:s,filePath:e,relPath:i,text:t,get doc(){return u??=(0,g.ye)(t)},plVersion:n.plVersion,plDate:l,schemas:o,references:a},h=await Promise.all(function(e,t,r=y.aO){const s=[];for(const[n,o]of Object.entries(r)){const r=o.find(([r,s])=>(0,c.kt)(e,s)&&(0,d.tT)(r,t));r&&s.push([n,r[2]])}return s}(i,l).filter(([e])=>"off"!==n.rules[e]).map(async([e,t])=>{let r;n.rules[e];try{r=await t(f)}catch(e){r=[{startOffset:0,endOffset:0,message:`internal error in rule: ${e}`,severity:"warning"}]}return r.map(t=>w(t,e,n))}));return $(e,h.flat().sort((e,t)=>e.startOffset-t.startOffset),n)}(e,a,{courseRoot:t,config:s.loaded.config,schemas:s.schemas,references:s.references}),l=new Set(i.filter(e=>"error"===e.severity).map(e=>a.slice(e.startOffset,e.endOffset))),h=o.basename(e)===T?(0,f.IO)((0,f.vz)(a),(0,c.bo)(t,e),(0,d.JX)(s.loaded.config.plVersion),{courseRoot:t,fileDir:o.dirname(e)},e=>"question"===e.target).map(e=>e.value):[],m=[...new Set(h)].map(e=>({infoJson:(0,u.S)({courseId:t,localId:e}).infoJson,hasError:l.has(e)}));return{errors:i.map(e=>j(e,a,r)),questions:m}}function O(e){return{errors:[{file:e,line:1,column:1,endLine:1,endColumn:1,message:"not inside a course (no infoCourse.json found in any parent directory); skipped",severity:"warning"}],questions:[]}}function C(e){return e.replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function I(e){const t=[`file=${r=e.file,C(r).replace(/:/g,"%3A").replace(/,/g,"%2C")}`,`line=${e.line}`,`col=${e.column}`,`endLine=${e.endLine}`,`endColumn=${e.endColumn}`,"title=prairielearn-navigator"].join(",");var r;return`::${"info"===e.severity?"notice":e.severity} ${t}::${C(e.message)}`}const R=[`${o.sep}node_modules${o.sep}`,`${o.sep}.git${o.sep}`],T="infoAssessment.json",D=["infoCourse.json","infoCourseInstance.json",T,"info.json","question.html"],A=["infoCourseInstance.json",T],V=`**/{${D.join(",")}}`;function M(e){return/[*?[\]{}]/.test(e)}function q(e,t){return n.globSync([e,`${e.replace(/\/+$/,"")}/${V}`],{cwd:t}).filter(e=>D.includes(o.basename(e))).map(e=>o.resolve(t,e))}function U(e,t){const r=process.cwd(),s=o.relative(r,e).split(o.sep).join("/");return t.some(t=>{if(M(t)){const e=t.replace(/^\.\//,"").replace(/\/+$/,"");return(0,c.kt)(s,e)||(0,c.kt)(s,`${e}/**`)}const n=o.relative(o.resolve(r,t),e);return""===n||!n.startsWith("..")&&!o.isAbsolute(n)})}function z(e){const t=process.cwd(),r=new Map,s=new Set;for(const a of e)for(const e of M(a)?n.globSync(a,{cwd:t}):[a]){const a=o.resolve(t,e),c=n.statSync(a,{throwIfNoEntry:!1}),l=c&&i(c.isDirectory()?o.join(a,"_"):a,r);l&&s.add(l)}return s}const F='Usage: prairielearn-navigator check [options] [paths...]\n\nCheck a PrairieLearn course\'s JSON files against PrairieLearn\'s schemas and\nthe navigator\'s rules: missing, incomplete, and duplicate questions,\nquestion directories without info.json, and clientFilesCourse dependencies\nthat do not exist.\n\nArguments:\n paths Course directories to search, course JSON files, or glob\n patterns matching either (default: .). Quote globs so the shell\n does not expand them.\n\nOptions:\n --format <pretty|github> Output format (default: pretty). "github" emits\n GitHub Actions annotations.\n --config <path> Config file (default: .pl-navigator.jsonc in each\n course root)\n --pl-version <version> PrairieLearn version to check against: "latest",\n a date (YYYY-MM-DD), or a commit sha\n --schema-cache <dir> Where downloaded schemas are cached\n --exclude <glob> Skip matching files (relative to the current\n directory; repeatable). Adds to the config\n file\'s "excludes".\n --unused-questions <ignored|info|warning|error>\n Severity for questions no assessment uses\n (default: info)\n --unused-tags <ignored|info|warning|error>\n Severity for infoCourse.json tags no question\n uses (default: warning)\n --unused-assessment-sets <ignored|info|warning|error>\n Severity for infoCourse.json assessment sets no\n assessment uses (default: warning)\n --missing-question-info <ignored|info|warning|error>\n Severity for directories in questions/ with files\n but no info.json, which PrairieLearn fails to\n load (default: error)\n --help Show this help message\n\nDated versions are resolved with the GitHub API; set GITHUB_TOKEN to avoid\nits rate limit.\n\nExit status is 1 if any errors are found; warnings and infos do not affect it.\n\nExamples:\n prairielearn-navigator check\n prairielearn-navigator check path/to/course\n prairielearn-navigator check --pl-version 2025-06-01\n prairielearn-navigator check --exclude "questions/archive/**"\n prairielearn-navigator check --unused-questions error\n prairielearn-navigator check --missing-question-info warning\n prairielearn-navigator check "courseInstances/Fa26/**"\n prairielearn-navigator check "**/assessments/hw*/infoAssessment.json"\n prairielearn-navigator check --format github',L=["--format","--config","--pl-version","--schema-cache","--exclude","--unused-questions","--unused-tags","--unused-assessment-sets","--missing-question-info"],K=["--exclude"];!async function(){const t=process.argv.slice(2),r=t[0];switch(r){case"check":process.exit(await async function(t){if(t.includes("--help")||t.includes("-h"))return console.log(F),0;const r=function(e){const t={},r=[];for(let s=0;s<e.length;s++){const n=e[s];if(!n.startsWith("-")){r.push(n);continue}const o=n.indexOf("="),a=-1===o?n:n.slice(0,o);if(!L.includes(a))return`Unknown option: ${n}`;const i=-1===o?e[++s]:n.slice(o+1);if(void 0===i)return`Missing value for ${a}`;t[a]=K.includes(a)&&void 0!==t[a]?`${t[a]}\0${i}`:i}return{options:t,paths:r}}(t);if("string"==typeof r)return console.error(e("red",r)),console.error(F),1;const{options:s,paths:l}=r,d=s["--format"]??"pretty";if("pretty"!==d&&"github"!==d)return console.error(e("red",`Invalid --format: ${d}`)),1;0===l.length&&l.push(".");const u={excludes:s["--exclude"]?.split("\0"),plVersion:s["--pl-version"],schemaCacheDir:s["--schema-cache"],unusedQuestions:s["--unused-questions"],unusedTags:s["--unused-tags"],unusedAssessmentSets:s["--unused-assessment-sets"],missingQuestionInfo:s["--missing-question-info"]},f=(0,a.Z9)(null,{configPath:s["--config"],overrides:u}).problems.filter(e=>!e.file);if(f.length>0)return f.forEach(t=>console.error(e("red",t.message))),1;const h=new N(s["--config"],u),m=function(e,t){const r=[],s=new Map;for(const n of e){const e=i(n,s);t(n,e)||(null===e?A.includes(o.basename(n))&&r.push([n,null]):v((0,c.bo)(e,n))&&r.push([n,e]))}return r}(function(e){const t=new Set,r=process.cwd();for(const s of e){if(M(s)){for(const e of q(s,r))t.add(e);continue}const e=o.resolve(r,s);if(n.existsSync(e))if(n.statSync(e).isDirectory())for(const r of n.globSync(V,{cwd:e}))t.add(o.resolve(e,r));else t.add(e)}return[...t].filter(e=>!R.some(t=>e.includes(t))).sort()}(l),(e,t)=>(0,a.RF)(null===t?(0,a.Z9)(null,{overrides:u}).config:h.get(t).loaded.config,e)),p=new Map,y=new Set([...z(l),...m.flatMap(([,e])=>null===e?[]:[e])]);for(const e of y)for(const[t,r]of b(e,h.get(e).loaded.config))U(t,l)&&p.set(t,r);if(0===m.length&&0===p.size){console.error(e("yellow","No PrairieLearn course JSON files found in:"));for(const t of l)console.error(e("yellow",` ${t}`));return 1}let g=0,$=0,w=0,_=0;const S=new Set,E=[],k=[],P=process.cwd(),T=e=>o.relative(P,e)||e,D=(t,r)=>{const s=t.filter(e=>"error"===e.severity).length,n=t.filter(e=>"warning"===e.severity).length;if(t.length>0)if(s+n>0&&_++,g+=s,$+=n,w+=t.length-s-n,"github"===d)k.push(...t.map(I));else{const s=r();k.push(...t.map(t=>function(t,r){const s=r.split("\n"),n=t.line-1,o="error"===t.severity?"red":"warning"===t.severity?"yellow":"cyan",a=e("bold",`${t.file}:${t.line}:${t.column}`)+" "+e(o,t.severity)+": "+t.message;if(""===r)return a;const i=Math.max(0,n-2),c=Math.min(s.length-1,t.endLine-1),l=String(c+1).length,d=e=>String(e).padStart(l),u=[a];u.push(e("dim"," ".repeat(l)+" |"));for(let t=i;t<=c;t++)u.push(e("dim",`${d(t+1)} |`)+" "+s[t]);const f=s[t.endLine-1]||"",[h,m]=t.line===t.endLine?[t.column-1,t.endColumn-1]:[0,f.length],p=" ".repeat(h)+"^".repeat(Math.max(1,m-h))+" "+t.message;return u.push(e("dim"," ".repeat(l)+" |")+" "+e(o,p)),u.join("\n")}(t,s)+"\n"))}return{fileErrors:s,fileWarnings:n}},B=(e,t)=>e>0?"red":t>0?"yellow":"dim";for(const[t,r]of m){const s=T(t),a=null===r?O(s):await x(t,r,s,h.get(r)),{questions:i}=a,c=[...(p.get(t)??[]).map(e=>j(e,"",s)),...a.errors];p.delete(t);const{fileErrors:l,fileWarnings:d}=D(c,()=>n.readFileSync(t,"utf-8"));E.push(e(B(l,d),s));for(const t of i){S.add(t.infoJson);const r=" "+(o.relative(P,t.infoJson)||t.infoJson);E.push(e(t.hasError?"red":"dim",r))}}for(const[t,r]of p){const s=T(t),{fileErrors:n,fileWarnings:o}=D(r.map(e=>j(e,"",s)),()=>"");E.push(e(B(n,o),s))}for(const[e,t]of h.configProblems()){const r=n.readFileSync(e,"utf-8");D(t.map(t=>j(t,r,T(e))),()=>r)}for(const t of h.schemaProblems())$++,k.push("github"===d?`::warning title=prairielearn-navigator::${C(t)}`:e("yellow","warning")+`: ${t}\n`);if("github"===d?(console.log("::group::Checked files"),E.forEach(e=>console.log(e)),console.log("::endgroup::")):E.forEach(e=>console.log(e)),k.length>0){"pretty"===d&&console.log();for(const e of k)console.log(e)}return console.log(function(t,r,s,n,o=0,a=0){const i=`${s} ${1===s?"file":"files"}, ${n} ${1===n?"question":"questions"} checked`,c=a>0?`${a} ${1===a?"info":"infos"}`:"";if(0===t&&0===o)return c?e("green","No errors found")+`, ${e("cyan",c)} (${i})`:e("green",`No errors found (${i})`);const l=[];if(t>0){const r=1===t?"error":"errors";l.push(e("red",`${t} ${r}`))}if(o>0){const t=1===o?"warning":"warnings";l.push(e("yellow",`${o} ${t}`))}c&&l.push(e("cyan",c));const d=r>0?` in ${r} ${1===r?"file":"files"}`:"";return`${l.join(", ")}${d} (${i})`}(g,_,m.length,S.size,$,w)),g>0?1:0}(t.slice(1)));break;case"--help":case"-h":case void 0:console.log("Usage: prairielearn-navigator <command> [options]\n\nCommands:\n check Check a course's JSON files against PrairieLearn's schemas and rules\n\nRun 'prairielearn-navigator <command> --help' for command-specific help."),process.exit(r?0:1);break;default:console.error(e("red",`Unknown command: ${r}`)),console.error('Run "prairielearn-navigator --help" for usage.'),process.exit(1)}}()},4269(e,t,r){r.d(t,{Ec:()=>l,JX:()=>d,_$:()=>i,rx:()=>c,tT:()=>u});const s=/^\d{4}-\d{2}-\d{2}$/,n=/^[0-9a-f]{40}$/,o=/^(>=|<=|>|<|=)?(\d{4}-\d{2}-\d{2})$/;function a(e){return s.test(e)&&!Number.isNaN(Date.parse(e))}function i(e){return n.test(e)}function c(e){return"string"!=typeof e?"plVersion must be a string":"latest"===e||a(e)||i(e)?void 0:`invalid plVersion "${e}": expected "latest", a date (YYYY-MM-DD), or a 40-character commit sha`}function l(){return(new Date).toISOString().slice(0,10)}function d(e){return a(e)?e:l()}function u(e,t){return e.trim().split(/\s+/).every(r=>{if("*"===r)return!0;const s=o.exec(r);if(!s)throw new Error(`invalid version range "${e}"`);const[,n="=",a]=s;switch(n){case">=":return t>=a;case"<=":return t<=a;case">":return t>a;case"<":return t<a;default:return t===a}})}},6897(e,t,r){r.d(t,{IO:()=>u,Li:()=>d,vz:()=>l}),r(9627),r(5663);var s=r(8141),n=r(1656),o=r(9889),a=r(4269),i=r(6590),c=r(2940);function l(e){let t;return{text:e,get doc(){return t??=(0,o.ye)(e)}}}function d(e){return c.c.some(t=>(0,s.kt)(e,t.files))}function u(e,t,r,o,i=()=>!0){const l=[];for(const d of c.c)if(i(d)&&(0,s.kt)(t,d.files)&&(0,a.tT)(d.range,r))if("json"===d.source){const t=e.doc.tree;t&&h(d,d.json.json,d.json.base,t,o,l)}else for(const t of(0,n.b)(e.text,d.html.tag)){const e=p(d,t,o);e&&l.push(e)}return l.sort((e,t)=>e.startOffset-t.startOffset)}function f(e,t){return"*"===e||(e instanceof RegExp?"string"==typeof t&&e.test(t):e===String(t))}function h(e,t,r,s,n,o,a=0){if(a===t.length){if("string"===s.type){const t=s.value;o.push({spec:e,value:t,startOffset:s.offset+1,endOffset:s.offset+s.length-1,...y(e,t,(0,i.P)(r,n))})}return}const c=t[a];if("object"===s.type)for(const i of s.children??[]){const[s,l]=i.children??[];s&&l&&f(c,s.value)&&h(e,t,r,l,n,o,a+1)}else"array"===s.type&&(s.children??[]).forEach((s,i)=>{f(c,i)&&h(e,t,r,s,n,o,a+1)})}const m=e=>e.includes("{{");function p(e,t,r){const{attr:s,directory:n,base:o,staticOnly:a}=e.html,c=t.attributes.get(s),l=t.attributes.get("type")?.value??"static",d=t.attributes.get("directory"),u=d?.value??n?.default??"";if(!c||[c.value,l,u].some(m)||a&&"static"!==l.trim().toLowerCase())return;const f={spec:e,value:c.value,startOffset:c.startOffset,endOffset:c.endOffset};let h;if(n?Object.hasOwn(n.named,u)?h=(0,i.P)(n.named[u],r):n.relative&&(h=(0,i.n)(r.fileDir,u,!0)??void 0):h=(0,i.P)(o??"fileDir",r),!h){const t=Object.keys(n?.named??{}).map(e=>`"${e}"`),r=t.length>2?`one of ${t.join(", ")}`:t.join(" or ");return{...f,value:u,startOffset:d?.startOffset??f.startOffset,endOffset:d?.endOffset??f.endOffset,target:null,problem:n?.relative?`${e.html.tag} directory "${u}" must be inside the question directory`:`invalid ${e.html.tag} directory "${u}": must be ${r}`}}return{...f,...y(e,c.value,h,u)}}function y(e,t,r,s=("json"===e.source?e.json.base:"")){const n=(0,i.n)(r,t);return n?{target:n}:{target:null,problem:`"${t}" must be a path inside ${"question"===e.target?"questions/":"fileDir"===s||"."===s||""===s?"its directory":`${s}/`}`}}},4402(e,t,r){r.d(t,{KX:()=>i,NC:()=>c});var s=r(8141),n=r(2940),o=r(1922);const a={"json-syntax":Object.values(s.l$).map(e=>["*",e,o.WS]),schema:[["*",s.l$.course,(0,o.Et)("infoCourse")],["*",s.l$.courseInstance,(0,o.Et)("infoCourseInstance")],["*",s.l$.assessment,(0,o.Et)("infoAssessment")],["*",s.l$.question,(0,o.Et)("infoQuestion")],["*",s.l$.element,(0,o.Et)("infoElementCourse")],["*",s.l$.elementExtension,(0,o.Et)("infoElementExtension")]],"duplicate-question-id":[["*",s.l$.assessment,o.Ex]],"unused-question":[["*",s.l$.question,o.f0]],"unused-tag":[["*",s.l$.course,o.Gx]],"unused-assessment-set":[["*",s.l$.course,o.qQ]],"question-info-missing":[],...function(){const e={};for(const t of n.c){const r=e[t.rule]??=[];r.some(([,e])=>e===t.files)||r.push(["*",t.files,(0,o.k2)(t.rule)])}return e}()};function i(e){return Object.hasOwn(a,e)}function c(e){return`prairielearn-navigator/${e}`}r.d(t,["aO",0,a,"np",0,["unused-question","unused-tag","unused-assessment-set"]])},9627(e,r,s){e.exports=(e=>{const t={};return s.d(t,e),t})({existsSync:()=>t.existsSync,globSync:()=>t.globSync,mkdirSync:()=>t.mkdirSync,readFileSync:()=>t.readFileSync,readdirSync:()=>t.readdirSync,rmSync:()=>t.rmSync,statSync:()=>t.statSync,writeFileSync:()=>t.writeFileSync})},5663(e,t,s){e.exports=(e=>{const t={};return s.d(t,e),t})({basename:()=>r.basename,dirname:()=>r.dirname,isAbsolute:()=>r.isAbsolute,join:()=>r.join,relative:()=>r.relative,resolve:()=>r.resolve,sep:()=>r.sep})},8343(e,t,r){const{normalizeIPv6:s,removeDotSegments:n,recomposeAuthority:o,normalizePercentEncoding:a,normalizePathEncoding:i,escapePreservingEscapes:c,reescapeHostDelimiters:l,isIPv4:d,nonSimpleDomain:u}=r(4834),{SCHEMES:f,getSchemeHandler:h}=r(343);function m(e,t,r,s){const o={};return s||(e=w(p(e,r),r),t=w(p(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=n(t.path||""),o.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=n(t.path||""),o.query=t.query):(t.path?("/"===t.path[0]?o.path=n(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:o.path=t.path:o.path="/"+t.path,o.path=n(o.path)),o.query=t.query):(o.path=e.path,void 0!==t.query?o.query=t.query:o.query=e.query),o.userinfo=e.userinfo,o.host=e.host,o.port=e.port),o.scheme=e.scheme),o.fragment=t.fragment,o}function p(e,t){const r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},s=Object.assign({},t),i=[],l=h(s.scheme||r.scheme);l&&l.serialize&&l.serialize(r,s),void 0!==r.path&&(s.skipEscape?r.path=a(r.path):(r.path=c(r.path),void 0!==r.scheme&&(r.path=r.path.split("%3A").join(":")))),"suffix"!==s.reference&&r.scheme&&i.push(r.scheme,":");const d=o(r);if(void 0!==d&&("suffix"!==s.reference&&i.push("//"),i.push(d),r.path&&"/"!==r.path[0]&&i.push("/")),void 0!==r.path){let e=r.path;s.absolutePath||l&&l.absolutePath||(e=n(e)),void 0===d&&"/"===e[0]&&"/"===e[1]&&(e="/%2F"+e.slice(2)),i.push(e)}return void 0!==r.query&&i.push("?",r.query),void 0!==r.fragment&&i.push("#",r.fragment),i.join("")}const y=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,g=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,v=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function $(e,t){const r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let o=!1,a=!1;"suffix"===r.reference&&(e=r.scheme?r.scheme+":"+e:"//"+e);const c=e.match(g);null!==c&&-1!==c[1].indexOf("\\")&&(n.error="URI authority must not contain a literal backslash.",o=!0);const f=e.match(v);if(null!==f){const e=f[1],t=e.replace(/[\t\n\r]/g,"");t.length>=2&&("//"!==t.slice(0,2)?(n.error=n.error||"URI authority must not contain a literal backslash.",o=!0):e.length!==t.length&&(n.error=n.error||"URI authority introducer must not contain whitespace.",o=!0))}const m=e.match(y);if(m){n.scheme=m[1],n.userinfo=m[3],n.host=m[4],n.port=parseInt(m[5],10),n.path=m[6]||"",n.query=m[7],n.fragment=m[8],isNaN(n.port)&&(n.port=m[5]);const t=function(e,t){return void 0!==t[2]&&e.path&&"/"!==e.path[0]?'URI path must start with "/" when authority is present.':"number"==typeof e.port&&(e.port<0||e.port>65535)?"URI port is malformed.":void 0}(n,m);if(void 0!==t&&(n.error=n.error||t,o=!0),n.host)if(!1===d(n.host)){const e=s(n.host);n.host=e.host.toLowerCase(),a=e.isIPV6}else a=!0;void 0!==n.scheme||void 0!==n.userinfo||void 0!==n.host||void 0!==n.port||void 0!==n.query||n.path?void 0===n.scheme?n.reference="relative":void 0===n.fragment?n.reference="absolute":n.reference="uri":n.reference="same-document",r.reference&&"suffix"!==r.reference&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");const c=h(r.scheme||n.scheme);if(!(r.unicodeSupport||c&&c.unicodeSupport)&&n.host&&(r.domainHost||c&&c.domainHost)&&!1===a&&u(n.host))try{n.host=new URL("http://"+n.host).hostname}catch(e){n.error=n.error||"Host's domain name can not be converted to ASCII: "+e}if((!c||c&&!c.skipNormalize)&&(-1!==e.indexOf("%")&&(void 0!==n.scheme&&(n.scheme=unescape(n.scheme)),void 0!==n.host&&(n.host=l(unescape(n.host),a))),n.path&&(n.path=i(n.path)),n.fragment))try{n.fragment=encodeURI(decodeURIComponent(n.fragment))}catch{n.error=n.error||"URI malformed"}c&&c.parse&&c.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:o}}function w(e,t){return $(e,t).parsed}function b(e,t){const{parsed:r,malformedAuthorityOrPort:s}=$(e,t);return{normalized:s?e:p(r,t),malformedAuthorityOrPort:s}}function _(e,t){if("string"==typeof e){const{normalized:r,malformedAuthorityOrPort:s}=b(e,t);return s?void 0:r}if("object"==typeof e)return p(e,t)}const S={SCHEMES:f,normalize:function(e,t){return"string"==typeof e?e=function(e,t){return b(e,t).normalized}(e,t):"object"==typeof e&&(e=w(p(e,t),t)),e},resolve:function(e,t,r){const s=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:n,malformedAuthorityOrPort:o}=$(e,s),{parsed:a,malformedAuthorityOrPort:i}=$(t,s);if(o||i)throw new Error(n.error||a.error||"URI is malformed.");const c=m(n,a,s,!0);return s.skipEscape=!0,p(c,s)},resolveComponent:m,equal:function(e,t,r){const s=_(e,r),n=_(t,r);return void 0!==s&&void 0!==n&&s.toLowerCase()===n.toLowerCase()},serialize:p,parse:w};e.exports=S,e.exports.default=S,e.exports.fastUri=S},343(e,t,r){const{isUUID:s}=r(4834),n=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,o=["http","https","ws","wss","urn","urn:uuid"];function a(e){return!0===e.secure||!1!==e.secure&&!!e.scheme&&!(3!==e.scheme.length||"w"!==e.scheme[0]&&"W"!==e.scheme[0]||"s"!==e.scheme[1]&&"S"!==e.scheme[1]||"s"!==e.scheme[2]&&"S"!==e.scheme[2])}function i(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function c(e){const t="https"===String(e.scheme).toLowerCase();return e.port!==(t?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}const l={scheme:"http",domainHost:!0,parse:i,serialize:c},d={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=a(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if(e.port!==(a(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){const[t,r]=e.resourceName.split("?");e.path=t&&"/"!==t?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}},u={http:l,https:{scheme:"https",domainHost:l.domainHost,parse:i,serialize:c},ws:d,wss:{scheme:"wss",domainHost:d.domainHost,parse:d.parse,serialize:d.serialize},urn:{scheme:"urn",parse:function(e,t){if(!e.path)return e.error="URN can not be parsed",e;const r=e.path.match(n);if(r){const s=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];const n=f(`${s}:${t.nid||e.nid}`);e.path=void 0,n&&(e=n.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e},serialize:function(e,t){if(void 0===e.nid)throw new Error("URN without nid cannot be serialized");const r=t.scheme||e.scheme||"urn",s=e.nid.toLowerCase(),n=f(`${r}:${t.nid||s}`);n&&(e=n.serialize(e,t));const o=e,a=e.nss;return o.path=`${s||t.nid}:${a}`,t.skipEscape=!0,o},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(e,t){const r=e;return r.uuid=r.nss,r.nss=void 0,t.tolerant||r.uuid&&s(r.uuid)||(r.error=r.error||"UUID is not valid."),r},serialize:function(e){const t=e;return t.nss=(e.uuid||"").toLowerCase(),t},skipNormalize:!0}};function f(e){return e&&(u[e]||u[e.toLowerCase()])||void 0}Object.setPrototypeOf(u,null),e.exports={wsIsSecure:a,SCHEMES:u,isValidSchemeName:function(e){return-1!==o.indexOf(e)},getSchemeHandler:f}},4834(e){const t=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),r=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),s=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),n=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),o=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function a(e){let t="",r=0,s=0;for(s=0;s<e.length;s++)if(r=e[s].charCodeAt(0),48!==r){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[s];break}for(s+=1;s<e.length;s++){if(r=e[s].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[s]}return t}const i=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function c(e){return e.length=0,!0}function l(e,t,r){if(e.length){const s=a(e);if(""===s)return r.error=!0,!1;t.push(s),e.length=0}return!0}function d(e){if(function(e){let t=0;for(let r=0;r<e.length;r++)":"===e[r]&&t++;return t}(e)<2)return{host:e,isIPV6:!1};const t=function(e){let t=0;const r={error:!1,address:"",zone:""},s=[],n=[];let o=!1,i=!1,d=l;for(let a=0;a<e.length;a++){const l=e[a];if("["!==l&&"]"!==l)if(":"!==l)if("%"===l){if(!d(n,s,r))break;d=c}else n.push(l);else{if(!0===o&&(i=!0),!d(n,s,r))break;if(++t>7){r.error=!0;break}a>0&&":"===e[a-1]&&(o=!0),s.push(":")}}return n.length&&(d===c?r.zone=n.join(""):i?s.push(n.join("")):s.push(a(n))),r.address=s.join(""),r}(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,r=t.address;return t.zone&&(e+="%"+t.zone,r+="%25"+t.zone),{host:e,isIPV6:!0,escapedHost:r}}}const u={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},f=/[@/?#:]/g,h=/[@/?#]/g;function m(e,t){const r=t?h:f;return r.lastIndex=0,e.replace(r,e=>u[e])}e.exports={nonSimpleDomain:i,recomposeAuthority:function(e){const t=[];if(void 0!==e.userinfo&&(t.push(e.userinfo),t.push("@")),void 0!==e.host){let s=unescape(e.host);if(!r(s)){const e=d(s);s=!0===e.isIPV6?`[${e.escapedHost}]`:m(s,!1)}t.push(s)}return"number"!=typeof e.port&&"string"!=typeof e.port||(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0},reescapeHostDelimiters:m,normalizePercentEncoding:function(e,t=!1){if(-1===e.indexOf("%"))return e;let r="";for(let o=0;o<e.length;o++){if("%"===e[o]&&o+2<e.length){const a=e.slice(o+1,o+3);if(s(a)){const e=a.toUpperCase(),s=String.fromCharCode(parseInt(e,16));t&&n(s)?r+=s:r+="%"+e,o+=2;continue}}r+=e[o]}return r},normalizePathEncoding:function(e){let t="";for(let r=0;r<e.length;r++){if("%"===e[r]&&r+2<e.length){const o=e.slice(r+1,r+3);if(s(o)){const e=o.toUpperCase(),s=String.fromCharCode(parseInt(e,16));"."!==s&&n(s)?t+=s:t+="%"+e,r+=2;continue}}o(e[r])?t+=e[r]:t+=escape(e[r])}return t},escapePreservingEscapes:function(e){let t="";for(let r=0;r<e.length;r++){if("%"===e[r]&&r+2<e.length){const n=e.slice(r+1,r+3);if(s(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t},removeDotSegments:function(e){let t=e;const r=[];let s=-1,n=0;for(;n=t.length;){if(1===n){if("."===t)break;if("/"===t){r.push("/");break}r.push(t);break}if(2===n){if("."===t[0]){if("."===t[1])break;if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&("."===t[1]||"/"===t[1])){r.push("/");break}}else if(3===n&&"/.."===t){0!==r.length&&r.pop(),r.push("/");break}if("."===t[0]){if("."===t[1]){if("/"===t[2]){t=t.slice(3);continue}}else if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&"."===t[1]){if("/"===t[2]){t=t.slice(2);continue}if("."===t[2]&&"/"===t[3]){t=t.slice(3),0!==r.length&&r.pop();continue}}if(-1===(s=t.indexOf("/",1))){r.push(t);break}r.push(t.slice(0,s)),t=t.slice(s)}return r.join("")},isIPv4:r,isUUID:t,normalizeIPv6:d,stringArrayToHexStripped:a}},3837(e){e.exports=JSON.parse('{"$id":"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#","description":"Meta-schema for $data reference (JSON AnySchema extension proposal)","type":"object","required":["$data"],"properties":{"$data":{"type":"string","anyOf":[{"format":"relative-json-pointer"},{"format":"json-pointer"}]}},"additionalProperties":false}')},2079(e){e.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true}')}};const n={};function o(e){const t=n[e];if(void 0!==t)return t.exports;const r=n[e]={exports:{}};return s[e](r,r.exports,o),r.exports}o.m=s,(()=>{const e=[];o.O=(t,r,s,n)=>{if(r){n=n||0;for(var a=e.length;a>0&&e[a-1][2]>n;a--)e[a]=e[a-1];return void(e[a]=[r,s,n])}let i=1/0;for(a=0;a<e.length;a++){let[r,s,n]=e[a],l=!0;for(var c=0;c<r.length;c++)(!1&n||i>=n)&&Object.keys(o.O).every(e=>o.O[e](r[c]))?r.splice(c--,1):(l=!1,n<i&&(i=n));if(l){e.splice(a--,1);const r=s();void 0!==r&&(t=r)}}return t}})(),o.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{if(Array.isArray(t))for(var r=0;r<t.length;){var s=t[r++],n=t[r++];o.o(e,s)?0===n&&r++:0===n?Object.defineProperty(e,s,{enumerable:!0,value:t[r++]}):Object.defineProperty(e,s,{enumerable:!0,get:n})}else for(var s in t)o.o(t,s)&&!o.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},o.o=(e,t)=>Object.hasOwn(e,t);export{o as __webpack_require__};(()=>{const e={27:0};o.C=t=>{let{__webpack_esm_ids__:r,__webpack_esm_modules__:s,__webpack_esm_runtime__:n}=t;var a,i,c=0;for(a in s)o.o(s,a)&&(o.m[a]=s[a]);for(n&&n(o);c<r.length;c++)i=r[c],o.o(e,i)&&e[i]&&e[i][0](),e[r[c]]=0;o.O()},o.O.j=t=>0===e[t]})();import*as a from"./shared.js";o.C(a);let i=o.O(void 0,[804],()=>o(3903));i=o.O(i);
|
|
8
|
+
deps: ${r}}`};const a={keyword:"dependencies",type:"object",schemaType:"object",error:t.z3,code(e){const[t,r]=function({schema:e}){const t={},r={};for(const s in e)"__proto__"!==s&&((Array.isArray(e[s])?t:r)[s]=e[s]);return[t,r]}(e);(function(e,t=e.schema){const{gen:r,data:n,it:a}=e;if(0===Object.keys(t).length)return;const i=r.let("missing");for(const c in t){const l=t[c];if(0===l.length)continue;const d=(0,o.propertyInData)(r,n,c,a.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(", ")}),a.allErrors?r.if(d,()=>{for(const t of l)(0,o.checkReportMissingProp)(e,t)}):(r.if(s._`${d} && (${(0,o.checkMissingProp)(e,l,i)})`),(0,o.reportMissingProp)(e,i),r.else())}})(e,t),function(e,t=e.schema){const{gen:r,data:s,keyword:a,it:i}=e,c=r.name("valid");for(const l in t)(0,n.alwaysValidSchema)(i,t[l])||(r.if((0,o.propertyInData)(r,s,l,i.opts.ownProperties),()=>{const t=e.subschema({keyword:a,schemaProp:l},c);e.mergeValidEvaluated(t,c)},()=>r.var(c,!0)),e.ok(c))}(e,r)}};t.default=a},1239(e,t,r){const s=r(9029),n=r(4227),o={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>s.str`must match "${e.ifClause}" schema`,params:({params:e})=>s._`{failingKeyword: ${e.ifClause}}`},code(e){const{gen:t,parentSchema:r,it:o}=e;void 0===r.then&&void 0===r.else&&(0,n.checkStrictMode)(o,'"if" without "then" and "else" is ignored');const i=a(o,"then"),c=a(o,"else");if(!i&&!c)return;const l=t.let("valid",!0),d=t.name("_valid");if(function(){const t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},d);e.mergeEvaluated(t)}(),e.reset(),i&&c){const r=t.let("ifClause");e.setParams({ifClause:r}),t.if(d,u("then",r),u("else",r))}else i?t.if(d,u("then")):t.if((0,s.not)(d),u("else"));function u(r,n){return()=>{const o=e.subschema({keyword:r},d);t.assign(l,d),e.mergeValidEvaluated(o,l),n?t.assign(n,s._`${r}`):e.setParams({ifClause:r})}}e.pass(l,()=>e.error(!0))}};function a(e,t){const r=e.schema[t];return void 0!==r&&!(0,n.alwaysValidSchema)(e,r)}t.default=o},6378(e,t,r){const s=r(5457),n=r(5354),o=r(494),a=r(3966),i=r(2661),c=r(3025),l=r(9713),d=r(8660),u=r(117),f=r(5333),h=r(7923),m=r(6505),p=r(6163),y=r(5844),g=r(1239),$=r(4426);t.default=function(e=!1){const t=[h.default,m.default,p.default,y.default,g.default,$.default,l.default,d.default,c.default,u.default,f.default];return e?t.push(n.default,a.default):t.push(s.default,o.default),t.push(i.default),t}},494(e,t,r){t.validateTuple=void 0;const s=r(9029),n=r(4227),o=r(5765),a={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:r}=e;if(Array.isArray(t))return i(e,"additionalItems",t);r.items=!0,(0,n.alwaysValidSchema)(r,t)||e.ok((0,o.validateArray)(e))}};function i(e,t,r=e.schema){const{gen:o,parentSchema:a,data:i,keyword:c,it:l}=e;!function(e){const{opts:s,errSchemaPath:o}=l,a=r.length,i=a===e.minItems&&(a===e.maxItems||!1===e[t]);if(s.strictTuples&&!i){const e=`"${c}" is ${a}-tuple, but minItems or maxItems/${t} are not specified or different at path "${o}"`;(0,n.checkStrictMode)(l,e,s.strictTuples)}}(a),l.opts.unevaluated&&r.length&&!0!==l.items&&(l.items=n.mergeEvaluated.items(o,r.length,l.items));const d=o.name("valid"),u=o.const("len",s._`${i}.length`);r.forEach((t,r)=>{(0,n.alwaysValidSchema)(l,t)||(o.if(s._`${u} > ${r}`,()=>e.subschema({keyword:c,schemaProp:r,dataProp:r},d)),e.ok(d))})}t.validateTuple=i,t.default=a},3966(e,t,r){const s=r(9029),n=r(4227),o=r(5765),a=r(5457),i={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>s.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>s._`{limit: ${e}}`},code(e){const{schema:t,parentSchema:r,it:s}=e,{prefixItems:i}=r;s.items=!0,(0,n.alwaysValidSchema)(s,t)||(i?(0,a.validateAdditionalItems)(e,i):e.ok((0,o.validateArray)(e)))}};t.default=i},7923(e,t,r){const s=r(4227),n={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:r,it:n}=e;if((0,s.alwaysValidSchema)(n,r))return void e.fail();const o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};t.default=n},6163(e,t,r){const s=r(9029),n=r(4227),o={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>s._`{passingSchemas: ${e.passing}}`},code(e){const{gen:t,schema:r,parentSchema:o,it:a}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(a.opts.discriminator&&o.discriminator)return;const i=r,c=t.let("valid",!1),l=t.let("passing",null),d=t.name("_valid");e.setParams({passing:l}),t.block(function(){i.forEach((r,o)=>{let i;(0,n.alwaysValidSchema)(a,r)?t.var(d,!0):i=e.subschema({keyword:"oneOf",schemaProp:o,compositeRule:!0},d),o>0&&t.if(s._`${d} && ${c}`).assign(c,!1).assign(l,s._`[${l}, ${o}]`).else(),t.if(d,()=>{t.assign(c,!0),t.assign(l,o),i&&e.mergeEvaluated(i,s.Name)})})}),e.result(c,()=>e.reset(),()=>e.error(!0))}};t.default=o},5333(e,t,r){const s=r(5765),n=r(9029),o=r(4227),a=r(4227),i={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,data:i,parentSchema:c,it:l}=e,{opts:d}=l,u=(0,s.allSchemaProperties)(r),f=u.filter(e=>(0,o.alwaysValidSchema)(l,r[e]));if(0===u.length||f.length===u.length&&(!l.opts.unevaluated||!0===l.props))return;const h=d.strictSchema&&!d.allowMatchingProperties&&c.properties,m=t.name("valid");!0===l.props||l.props instanceof n.Name||(l.props=(0,a.evaluatedPropsToName)(t,l.props));const{props:p}=l;function y(e){for(const t in h)new RegExp(e).test(t)&&(0,o.checkStrictMode)(l,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function g(r){t.forIn("key",i,o=>{t.if(n._`${(0,s.usePattern)(e,r)}.test(${o})`,()=>{const s=f.includes(r);s||e.subschema({keyword:"patternProperties",schemaProp:r,dataProp:o,dataPropType:a.Type.Str},m),l.opts.unevaluated&&!0!==p?t.assign(n._`${p}[${o}]`,!0):s||l.allErrors||t.if((0,n.not)(m),()=>t.break())})})}!function(){for(const e of u)h&&y(e),l.allErrors?g(e):(t.var(m,!0),g(e),t.if(m))}()}};t.default=i},5354(e,t,r){const s=r(494),n={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,s.validateTuple)(e,"items")};t.default=n},117(e,t,r){const s=r(2586),n=r(5765),o=r(4227),a=r(8660),i={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,parentSchema:i,data:c,it:l}=e;"all"===l.opts.removeAdditional&&void 0===i.additionalProperties&&a.default.code(new s.KeywordCxt(l,a.default,"additionalProperties"));const d=(0,n.allSchemaProperties)(r);for(const e of d)l.definedProperties.add(e);l.opts.unevaluated&&d.length&&!0!==l.props&&(l.props=o.mergeEvaluated.props(t,(0,o.toHash)(d),l.props));const u=d.filter(e=>!(0,o.alwaysValidSchema)(l,r[e]));if(0===u.length)return;const f=t.name("valid");for(const r of u)h(r)?m(r):(t.if((0,n.propertyInData)(t,c,r,l.opts.ownProperties)),m(r),l.allErrors||t.else().var(f,!0),t.endIf()),e.it.definedProperties.add(r),e.ok(f);function h(e){return l.opts.useDefaults&&!l.compositeRule&&void 0!==r[e].default}function m(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},f)}}};t.default=i},9713(e,t,r){const s=r(9029),n=r(4227),o={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>s._`{propertyName: ${e.propertyName}}`},code(e){const{gen:t,schema:r,data:o,it:a}=e;if((0,n.alwaysValidSchema)(a,r))return;const i=t.name("valid");t.forIn("key",o,r=>{e.setParams({propertyName:r}),e.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:!0},i),t.if((0,s.not)(i),()=>{e.error(!0),a.allErrors||t.break()})}),e.ok(i)}};t.default=o},4426(e,t,r){const s=r(4227),n={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){void 0===t.if&&(0,s.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};t.default=n},5765(e,t,r){t.validateUnion=t.validateArray=t.usePattern=t.callValidateCode=t.allSchemaProperties=t.noPropertyInData=t.propertyInData=t.isOwnProperty=t.reportMissingProp=t.checkMissingProp=t.checkReportMissingProp=void 0;const s=r(9029),n=r(4227),o=r(2023),a=r(4227);function i(e,t,r){return s._`${function(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:s._`Object.prototype.hasOwnProperty`})}(e)}.call(${t}, ${r})`}function c(e,t,r,n){const o=s._`${t}${(0,s.getProperty)(r)} === undefined`;return n?(0,s.or)(o,(0,s.not)(i(e,t,r))):o}t.checkReportMissingProp=function(e,t){const{gen:r,data:n,it:o}=e;r.if(c(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:s._`${t}`},!0),e.error()})},t.checkMissingProp=function({gen:e,data:t,it:{opts:r}},n,o){return(0,s.or)(...n.map(n=>(0,s.and)(c(e,t,n,r.ownProperties),s._`${o} = ${n}`)))},t.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},t.isOwnProperty=i,t.propertyInData=function(e,t,r,n){const o=s._`${t}${(0,s.getProperty)(r)} !== undefined`;return n?s._`${o} && ${i(e,t,r)}`:o},t.noPropertyInData=c,t.allSchemaProperties=function(e){return e?Object.keys(e).filter(e=>"__proto__"!==e):[]},t.callValidateCode=function({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:a,errorPath:i},it:c},l,d,u){const f=u?s._`${e}, ${t}, ${n}${a}`:t,h=[[o.default.instancePath,(0,s.strConcat)(o.default.instancePath,i)],[o.default.parentData,c.parentData],[o.default.parentDataProperty,c.parentDataProperty],[o.default.rootData,o.default.rootData]];c.opts.dynamicRef&&h.push([o.default.dynamicAnchors,o.default.dynamicAnchors]);const m=s._`${f}, ${r.object(...h)}`;return d!==s.nil?s._`${l}.call(${d}, ${m})`:s._`${l}(${m})`};const l=s._`new RegExp`;t.usePattern=function({gen:e,it:{opts:t}},r){const n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,i=o(r,n);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:s._`${"new RegExp"===o.code?l:(0,a.useFunc)(e,o)}(${r}, ${n})`})},t.validateArray=function(e){const{gen:t,data:r,keyword:o,it:a}=e,i=t.name("valid");if(a.allErrors){const e=t.let("valid",!0);return c(()=>t.assign(e,!1)),e}return t.var(i,!0),c(()=>t.break()),i;function c(a){const c=t.const("len",s._`${r}.length`);t.forRange("i",0,c,r=>{e.subschema({keyword:o,dataProp:r,dataPropType:n.Type.Num},i),t.if((0,s.not)(i),a)})}},t.validateUnion=function(e){const{gen:t,schema:r,keyword:o,it:a}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(e=>(0,n.alwaysValidSchema)(a,e))&&!a.opts.unevaluated)return;const i=t.let("valid",!1),c=t.name("_valid");t.block(()=>r.forEach((r,n)=>{const a=e.subschema({keyword:o,schemaProp:n,compositeRule:!0},c);t.assign(i,s._`${i} || ${c}`),e.mergeValidEvaluated(a,c)||t.if((0,s.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}},3463(e,t){const r={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};t.default=r},2128(e,t,r){const s=r(3463),n=r(3693),o=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",s.default,n.default];t.default=o},3693(e,t,r){const s=r(4551),n=r(5765),o=r(9029),a=r(2023),i=r(3835),c=r(4227),l={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:r,it:n}=e,{baseId:a,schemaEnv:c,validateName:l,opts:u,self:f}=n,{root:h}=c;if(("#"===r||"#/"===r)&&a===h.baseId)return function(){if(c===h)return d(e,l,c,c.$async);const r=t.scopeValue("root",{ref:h});return d(e,o._`${r}.validate`,h,h.$async)}();const m=i.resolveRef.call(f,h,a,r);if(void 0===m)throw new s.default(n.opts.uriResolver,a,r);return m instanceof i.SchemaEnv?function(t){const r=function(e,t){const{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):o._`${r.scopeValue("wrapper",{ref:t})}.validate`}(e,t);d(e,r,t,t.$async)}(m):function(s){const n=t.scopeValue("schema",!0===u.code.source?{ref:s,code:(0,o.stringify)(s)}:{ref:s}),a=t.name("valid"),i=e.subschema({schema:s,dataTypes:[],schemaPath:o.nil,topSchemaRef:n,errSchemaPath:r},a);e.mergeEvaluated(i),e.ok(a)}(m)}};function d(e,t,r,s){const{gen:i,it:l}=e,{allErrors:d,schemaEnv:u,opts:f}=l,h=f.passContext?a.default.this:o.nil;function m(e){const t=o._`${e}.errors`;i.assign(a.default.vErrors,o._`${a.default.vErrors} === null ? ${t} : ${a.default.vErrors}.concat(${t})`),i.assign(a.default.errors,o._`${a.default.vErrors}.length`)}function p(e){var t;if(!l.opts.unevaluated)return;const s=null===(t=null==r?void 0:r.validate)||void 0===t?void 0:t.evaluated;if(!0!==l.props)if(s&&!s.dynamicProps)void 0!==s.props&&(l.props=c.mergeEvaluated.props(i,s.props,l.props));else{const t=i.var("props",o._`${e}.evaluated.props`);l.props=c.mergeEvaluated.props(i,t,l.props,o.Name)}if(!0!==l.items)if(s&&!s.dynamicItems)void 0!==s.items&&(l.items=c.mergeEvaluated.items(i,s.items,l.items));else{const t=i.var("items",o._`${e}.evaluated.items`);l.items=c.mergeEvaluated.items(i,t,l.items,o.Name)}}s?function(){if(!u.$async)throw new Error("async schema referenced by sync schema");const r=i.let("valid");i.try(()=>{i.code(o._`await ${(0,n.callValidateCode)(e,t,h)}`),p(t),d||i.assign(r,!0)},e=>{i.if(o._`!(${e} instanceof ${l.ValidationError})`,()=>i.throw(e)),m(e),d||i.assign(r,!1)}),e.ok(r)}():e.result((0,n.callValidateCode)(e,t,h),()=>p(t),()=>m(t))}t.default=l},6653(e,t,r){const s=r(9029),n=r(7652),o=r(3835),a=r(4551),i=r(4227),c={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===n.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>s._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},code(e){const{gen:t,data:r,schema:c,parentSchema:l,it:d}=e,{oneOf:u}=l;if(!d.opts.discriminator)throw new Error("discriminator: requires discriminator option");const f=c.propertyName;if("string"!=typeof f)throw new Error("discriminator: requires propertyName");if(c.mapping)throw new Error("discriminator: mapping is not supported");if(!u)throw new Error("discriminator: requires oneOf keyword");const h=t.let("valid",!1),m=t.const("tag",s._`${r}${(0,s.getProperty)(f)}`);function p(r){const n=t.name("valid"),o=e.subschema({keyword:"oneOf",schemaProp:r},n);return e.mergeEvaluated(o,s.Name),n}t.if(s._`typeof ${m} == "string"`,()=>function(){const r=function(){var e;const t={},r=n(l);let s=!0;for(let t=0;t<u.length;t++){let l=u[t];if((null==l?void 0:l.$ref)&&!(0,i.schemaHasRulesButRef)(l,d.self.RULES)){const e=l.$ref;if(l=o.resolveRef.call(d.self,d.schemaEnv.root,d.baseId,e),l instanceof o.SchemaEnv&&(l=l.schema),void 0===l)throw new a.default(d.opts.uriResolver,d.baseId,e)}const h=null===(e=null==l?void 0:l.properties)||void 0===e?void 0:e[f];if("object"!=typeof h)throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${f}"`);s=s&&(r||n(l)),c(h,t)}if(!s)throw new Error(`discriminator: "${f}" must be required`);return t;function n({required:e}){return Array.isArray(e)&&e.includes(f)}function c(e,t){if(e.const)h(e.const,t);else{if(!e.enum)throw new Error(`discriminator: "properties/${f}" must have "const" or "enum"`);for(const r of e.enum)h(r,t)}}function h(e,r){if("string"!=typeof e||e in t)throw new Error(`discriminator: "${f}" values must be unique strings`);t[e]=r}}();t.if(!1);for(const e in r)t.elseIf(s._`${m} === ${e}`),t.assign(h,p(r[e]));t.else(),e.error(!1,{discrError:n.DiscrError.Mapping,tag:m,tagName:f}),t.endIf()}(),()=>e.error(!1,{discrError:n.DiscrError.Tag,tag:m,tagName:f})),e.ok(h)}};t.default=c},7652(e,t){var r;t.DiscrError=void 0,function(e){e.Tag="tag",e.Mapping="mapping"}(r||(t.DiscrError=r={}))},6144(e,t,r){const s=r(2128),n=r(7060),o=r(6378),a=r(7532),i=r(9857),c=[s.default,n.default,(0,o.default)(),a.default,i.metadataVocabulary,i.contentVocabulary];t.default=c},4737(e,t,r){const s=r(9029),n={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>s.str`must match format "${e}"`,params:({schemaCode:e})=>s._`{format: ${e}}`},code(e,t){const{gen:r,data:n,$data:o,schema:a,schemaCode:i,it:c}=e,{opts:l,errSchemaPath:d,schemaEnv:u,self:f}=c;l.validateFormats&&(o?function(){const o=r.scopeValue("formats",{ref:f.formats,code:l.code.formats}),a=r.const("fDef",s._`${o}[${i}]`),c=r.let("fType"),d=r.let("format");r.if(s._`typeof ${a} == "object" && !(${a} instanceof RegExp)`,()=>r.assign(c,s._`${a}.type || "string"`).assign(d,s._`${a}.validate`),()=>r.assign(c,s._`"string"`).assign(d,a)),e.fail$data((0,s.or)(!1===l.strictSchema?s.nil:s._`${i} && !${d}`,function(){const e=u.$async?s._`(${a}.async ? await ${d}(${n}) : ${d}(${n}))`:s._`${d}(${n})`,r=s._`(typeof ${d} == "function" ? ${e} : ${d}.test(${n}))`;return s._`${d} && ${d} !== true && ${c} === ${t} && !${r}`}()))}():function(){const o=f.formats[a];if(!o)return void function(){if(!1!==l.strictSchema)throw new Error(e());function e(){return`unknown format "${a}" ignored in schema at path "${d}"`}f.logger.warn(e())}();if(!0===o)return;const[i,c,h]=function(e){const t=e instanceof RegExp?(0,s.regexpCode)(e):l.code.formats?s._`${l.code.formats}${(0,s.getProperty)(a)}`:void 0,n=r.scopeValue("formats",{key:a,ref:e,code:t});return"object"!=typeof e||e instanceof RegExp?["string",e,n]:[e.type||"string",e.validate,s._`${n}.validate`]}(o);i===t&&e.pass(function(){if("object"==typeof o&&!(o instanceof RegExp)&&o.async){if(!u.$async)throw new Error("async format in sync schema");return s._`await ${h}(${n})`}return"function"==typeof c?s._`${h}(${n})`:s._`${h}.test(${n})`}())}())}};t.default=n},7532(e,t,r){const s=[r(4737).default];t.default=s},9857(e,t){t.contentVocabulary=t.metadataVocabulary=void 0,t.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],t.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]},7935(e,t,r){const s=r(9029),n=r(4227),o=r(6250),a={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>s._`{allowedValue: ${e}}`},code(e){const{gen:t,data:r,$data:a,schemaCode:i,schema:c}=e;a||c&&"object"==typeof c?e.fail$data(s._`!${(0,n.useFunc)(t,o.default)}(${r}, ${i})`):e.fail(s._`${c} !== ${r}`)}};t.default=a},8643(e,t,r){const s=r(9029),n=r(4227),o=r(6250),a={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>s._`{allowedValues: ${e}}`},code(e){const{gen:t,data:r,$data:a,schema:i,schemaCode:c,it:l}=e;if(!a&&0===i.length)throw new Error("enum must have non-empty array");const d=i.length>=l.opts.loopEnum;let u;const f=()=>null!=u?u:u=(0,n.useFunc)(t,o.default);let h;if(d||a)h=t.let("valid"),e.block$data(h,function(){t.assign(h,!1),t.forOf("v",c,e=>t.if(s._`${f()}(${r}, ${e})`,()=>t.assign(h,!0).break()))});else{if(!Array.isArray(i))throw new Error("ajv implementation error");const e=t.const("vSchema",c);h=(0,s.or)(...i.map((t,n)=>function(e,t){const n=i[t];return"object"==typeof n&&null!==n?s._`${f()}(${r}, ${e}[${t}])`:s._`${r} === ${n}`}(e,n)))}e.pass(h)}};t.default=a},7060(e,t,r){const s=r(5882),n=r(3439),o=r(7307),a=r(422),i=r(4486),c=r(4003),l=r(1163),d=r(617),u=r(7935),f=r(8643),h=[s.default,n.default,o.default,a.default,i.default,c.default,l.default,d.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,f.default];t.default=h},1163(e,t,r){const s=r(9029),n={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const r="maxItems"===e?"more":"fewer";return s.str`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>s._`{limit: ${e}}`},code(e){const{keyword:t,data:r,schemaCode:n}=e,o="maxItems"===t?s.operators.GT:s.operators.LT;e.fail$data(s._`${r}.length ${o} ${n}`)}};t.default=n},7307(e,t,r){const s=r(9029),n=r(4227),o=r(3853),a={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const r="maxLength"===e?"more":"fewer";return s.str`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>s._`{limit: ${e}}`},code(e){const{keyword:t,data:r,schemaCode:a,it:i}=e,c="maxLength"===t?s.operators.GT:s.operators.LT,l=!1===i.opts.unicode?s._`${r}.length`:s._`${(0,n.useFunc)(e.gen,o.default)}(${r})`;e.fail$data(s._`${l} ${c} ${a}`)}};t.default=a},5882(e,t,r){const s=r(9029),n=s.operators,o={maximum:{okStr:"<=",ok:n.LTE,fail:n.GT},minimum:{okStr:">=",ok:n.GTE,fail:n.LT},exclusiveMaximum:{okStr:"<",ok:n.LT,fail:n.GTE},exclusiveMinimum:{okStr:">",ok:n.GT,fail:n.LTE}},a={message:({keyword:e,schemaCode:t})=>s.str`must be ${o[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>s._`{comparison: ${o[e].okStr}, limit: ${t}}`},i={keyword:Object.keys(o),type:"number",schemaType:"number",$data:!0,error:a,code(e){const{keyword:t,data:r,schemaCode:n}=e;e.fail$data(s._`${r} ${o[t].fail} ${n} || isNaN(${r})`)}};t.default=i},4486(e,t,r){const s=r(9029),n={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const r="maxProperties"===e?"more":"fewer";return s.str`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>s._`{limit: ${e}}`},code(e){const{keyword:t,data:r,schemaCode:n}=e,o="maxProperties"===t?s.operators.GT:s.operators.LT;e.fail$data(s._`Object.keys(${r}).length ${o} ${n}`)}};t.default=n},3439(e,t,r){const s=r(9029),n={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>s.str`must be multiple of ${e}`,params:({schemaCode:e})=>s._`{multipleOf: ${e}}`},code(e){const{gen:t,data:r,schemaCode:n,it:o}=e,a=o.opts.multipleOfPrecision,i=t.let("res"),c=a?s._`Math.abs(Math.round(${i}) - ${i}) > 1e-${a}`:s._`${i} !== parseInt(${i})`;e.fail$data(s._`(${n} === 0 || (${i} = ${r}/${n}, ${c}))`)}};t.default=n},422(e,t,r){const s=r(5765),n=r(4227),o=r(9029),a={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>o.str`must match pattern "${e}"`,params:({schemaCode:e})=>o._`{pattern: ${e}}`},code(e){const{gen:t,data:r,$data:a,schema:i,schemaCode:c,it:l}=e,d=l.opts.unicodeRegExp?"u":"";if(a){const{regExp:s}=l.opts.code,a="new RegExp"===s.code?o._`new RegExp`:(0,n.useFunc)(t,s),i=t.let("valid");t.try(()=>t.assign(i,o._`${a}(${c}, ${d}).test(${r})`),()=>t.assign(i,!1)),e.fail$data(o._`!${i}`)}else{const t=(0,s.usePattern)(e,i);e.fail$data(o._`!${t}.test(${r})`)}}};t.default=a},4003(e,t,r){const s=r(5765),n=r(9029),o=r(4227),a={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>n.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>n._`{missingProperty: ${e}}`},code(e){const{gen:t,schema:r,schemaCode:a,data:i,$data:c,it:l}=e,{opts:d}=l;if(!c&&0===r.length)return;const u=r.length>=d.loopRequired;if(l.allErrors?function(){if(u||c)e.block$data(n.nil,f);else for(const t of r)(0,s.checkReportMissingProp)(e,t)}():function(){const o=t.let("missing");if(u||c){const r=t.let("valid",!0);e.block$data(r,()=>function(r,o){e.setParams({missingProperty:r}),t.forOf(r,a,()=>{t.assign(o,(0,s.propertyInData)(t,i,r,d.ownProperties)),t.if((0,n.not)(o),()=>{e.error(),t.break()})},n.nil)}(o,r)),e.ok(r)}else t.if((0,s.checkMissingProp)(e,r,o)),(0,s.reportMissingProp)(e,o),t.else()}(),d.strictRequired){const t=e.parentSchema.properties,{definedProperties:s}=e.it;for(const e of r)if(void 0===(null==t?void 0:t[e])&&!s.has(e)){const t=`required property "${e}" is not defined at "${l.schemaEnv.baseId+l.errSchemaPath}" (strictRequired)`;(0,o.checkStrictMode)(l,t,l.opts.strictRequired)}}function f(){t.forOf("prop",a,r=>{e.setParams({missingProperty:r}),t.if((0,s.noPropertyInData)(t,i,r,d.ownProperties),()=>e.error())})}}};t.default=a},617(e,t,r){const s=r(208),n=r(9029),o=r(4227),a=r(6250),i={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>n.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>n._`{i: ${e}, j: ${t}}`},code(e){const{gen:t,data:r,$data:i,schema:c,parentSchema:l,schemaCode:d,it:u}=e;if(!i&&!c)return;const f=t.let("valid"),h=l.items?(0,s.getSchemaTypes)(l.items):[];function m(o,a){const i=t.name("item"),c=(0,s.checkDataTypes)(h,i,u.opts.strictNumbers,s.DataType.Wrong),l=t.const("indices",n._`{}`);t.for(n._`;${o}--;`,()=>{t.let(i,n._`${r}[${o}]`),t.if(c,n._`continue`),h.length>1&&t.if(n._`typeof ${i} == "string"`,n._`${i} += "_"`),t.if(n._`typeof ${l}[${i}] == "number"`,()=>{t.assign(a,n._`${l}[${i}]`),e.error(),t.assign(f,!1).break()}).code(n._`${l}[${i}] = ${o}`)})}function p(s,i){const c=(0,o.useFunc)(t,a.default),l=t.name("outer");t.label(l).for(n._`;${s}--;`,()=>t.for(n._`${i} = ${s}; ${i}--;`,()=>t.if(n._`${c}(${r}[${s}], ${r}[${i}])`,()=>{e.error(),t.assign(f,!1).break(l)})))}e.block$data(f,function(){const s=t.let("i",n._`${r}.length`),o=t.let("j");e.setParams({i:s,j:o}),t.assign(f,!0),t.if(n._`${s} > 1`,()=>(h.length>0&&!h.some(e=>"object"===e||"array"===e)?m:p)(s,o))},n._`${d} === false`),e.ok(f)}};t.default=i},2017(e){e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var s,n,o;if(Array.isArray(t)){if((s=t.length)!=r.length)return!1;for(n=s;0!==n--;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((s=(o=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(n=s;0!==n--;)if(!Object.prototype.hasOwnProperty.call(r,o[n]))return!1;for(n=s;0!==n--;){var a=o[n];if(!e(t[a],r[a]))return!1}return!0}return t!=t&&r!=r}},7106(e){var t=e.exports=function(e,t,s){"function"==typeof t&&(s=t,t={}),r(t,"function"==typeof(s=t.cb||s)?s:s.pre||function(){},s.post||function(){},e,"",e)};function r(e,n,o,a,i,c,l,d,u,f){if(a&&"object"==typeof a&&!Array.isArray(a)){for(var h in n(a,i,c,l,d,u,f),a){var m=a[h];if(Array.isArray(m)){if(h in t.arrayKeywords)for(var p=0;p<m.length;p++)r(e,n,o,m[p],i+"/"+h+"/"+p,c,i,h,a,p)}else if(h in t.propsKeywords){if(m&&"object"==typeof m)for(var y in m)r(e,n,o,m[y],i+"/"+h+"/"+s(y),c,i,h,a,y)}else(h in t.keywords||e.allKeys&&!(h in t.skipKeywords))&&r(e,n,o,m,i+"/"+h,c,i,h,a)}o(a,i,c,l,d,u,f)}}function s(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}t.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},t.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},t.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},t.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0}},4071(t,r,s){var n=s(9627),o=s(5663),a=s(5316);function i(e,t){const r=[];let s,a=o.dirname(o.resolve(e));for(;void 0===s&&(s=t?.get(a),void 0===s);)r.push(a),n.existsSync(o.join(a,"infoCourse.json"))?s=a:o.dirname(a)===a?s=null:a=o.dirname(a);return r.forEach(e=>t?.set(e,s)),s}var c=s(8141);function l(e,t){let r=1,s=0;for(let n=0;n<t&&n<e.length;n++)"\n"===e[n]&&(r++,s=n+1);return{line:r,column:t-s+1}}var d=s(4269),u=s(1493),f=s(6897),h=s(2940);class m{courseRoot;plDate;usesByFile=new Map;namesByFile=new Map;filesByTarget=new Map;targetsUnder=new Map;constructor(e,t){this.courseRoot=e,this.plDate=t}holdsReferences(e){return(0,f.Li)((0,c.bo)(this.courseRoot,e))}update(e,t){this.remove(e);const r=(0,f.vz)(t),s=(0,c.bo)(this.courseRoot,e),n=(0,f.IO)(r,s,this.plDate,{courseRoot:this.courseRoot,fileDir:o.dirname(e)}),a=function(e){const t=(0,c.kt)(e,c.l$.question);if(!t&&!(0,c.kt)(e,c.l$.assessment))return;const s=r.doc.value,n=t&&Array.isArray(s?.tags)?s.tags:[],o=t||"string"!=typeof s?.set?[]:[s.set];return{tags:n.filter(e=>"string"==typeof e),assessmentSets:o}}(s);a&&this.namesByFile.set(e,a);const i=n.filter(e=>null!==e.target).map(r=>({file:e,ref:r,start:l(t,r.startOffset),end:l(t,r.endOffset)}));this.usesByFile.set(e,i);for(const t of i){const r=t.ref.target;let s=this.filesByTarget.get(r);s||(this.filesByTarget.set(r,s=new Set),this.countUnder(r,1)),s.add(e)}}remove(e){for(const t of this.usesByFile.get(e)??[]){const r=this.filesByTarget.get(t.ref.target);r?.delete(e),0===r?.size&&(this.filesByTarget.delete(t.ref.target),this.countUnder(t.ref.target,-1))}this.usesByFile.delete(e),this.namesByFile.delete(e)}files(){return[...this.usesByFile.keys()]}namesIn(e){return this.namesByFile.get(e)}namesUsed(e){const t=new Set;for(const r of this.namesByFile.values())r[e].forEach(e=>t.add(e));return t}usesIn(e){return this.usesByFile.get(e)??[]}usesOf(e){const t=[];for(let r=e;;r=o.dirname(r)){for(const s of this.filesByTarget.get(r)??[])for(const n of this.usesIn(s))n.ref.target===r&&p(n,r,e)&&t.push(n);if(r===this.courseRoot||o.dirname(r)===r)break}return t.sort((e,t)=>e.file.localeCompare(t.file)||e.ref.startOffset-t.ref.startOffset)}countUnder(e,t){for(let r=o.dirname(e);;r=o.dirname(r)){const e=(this.targetsUnder.get(r)??0)+t;if(0===e?this.targetsUnder.delete(r):this.targetsUnder.set(r,e),r===this.courseRoot||o.dirname(r)===r)break}}filesAffectedBy(e){const t=new Set,r=e=>this.filesByTarget.get(e)?.forEach(e=>t.add(e));for(let t=e;r(t),t!==this.courseRoot&&o.dirname(t)!==t;t=o.dirname(t));if(this.targetsUnder.has(e))for(const t of this.filesByTarget.keys())t.startsWith(e+o.sep)&&r(t);return[...t]}}function p(e,t,r){switch(e.ref.spec.target){case"file":return t===r;case"question":return t===r||o.dirname(r)===t;case"fileOrDir":return!0}}function y(e,t){const r=new m(e,t);for(const t of function(e){const t=[...new Set(h.c.map(e=>e.files))];return n.globSync(t,{cwd:e}).map(t=>o.join(e,t))}(e))r.update(t,n.readFileSync(t,"utf-8"));return r}var g=s(4402),$=s(9889);function v(e){return Object.values(g.aO).some(t=>t.some(([,t])=>(0,c.kt)(e,t)))}function w(e,t,r){const s=r.ignoredDiagnostics.filter(t=>t.file===e);if(0===s.length)return t;const n=new Map;return t.filter(e=>{const t=e.code?.startsWith("prairielearn-navigator/")?e.code.slice(23).split("/")[0]:void 0;if(void 0===t||!(0,g.KX)(t))return!0;const r=`${t}\0${e.message}`,o=(n.get(r)??0)+1;return n.set(r,o),!s.some(r=>r.rule===t&&(void 0!==r.identifier?r.identifier===e.identifier:r.message===e.message&&r.occurrence===o))})}function b(e,t,r){const s=r.rules[t];return{...e,code:(0,g.NC)(t),severity:void 0!==s&&"off"!==s?s:e.severity}}function _(e,t){const r=new Map;if("off"===t.rules["question-info-missing"])return r;for(const{dir:s,anchor:i}of function(e){const t=[],r=e=>{const s=n.readdirSync(e,{withFileTypes:!0}).filter(e=>!e.name.startsWith(".")).sort((e,t)=>e.name<t.name?-1:e.name>t.name?1:0);let a=!1;for(const i of s){if(!i.isDirectory())continue;const s=o.join(e,i.name);if(n.existsSync(o.join(s,"info.json"))||r(s))a=!0;else{const e=n.readdirSync(s,{withFileTypes:!0}).filter(e=>!e.name.startsWith(".")&&!e.isDirectory()).map(e=>e.name).sort();if(e.length>0){const r=e.includes("question.html")?"question.html":e[0];t.push({dir:s,anchor:o.join(s,r)})}}}return a},s=o.join(e,"questions");return n.statSync(s,{throwIfNoEntry:!1})?.isDirectory()&&r(s),t.sort((e,t)=>e.dir<t.dir?-1:e.dir>t.dir?1:0)}(e)){if((0,a.RF)(t,i))continue;const n=o.join(s,"info.json"),l=w(i,[b({startOffset:0,endOffset:0,message:`directory "${(0,c.bo)(o.join(e,"questions"),s)}" in questions/ has files but no info.json: PrairieLearn will fail to load it from disk (Missing JSON file: ${(0,c.bo)(e,n)})`,severity:"error",related:[{path:n,message:"Expected location of info.json"}]},"question-info-missing",t)],t);l.length>0&&r.set(i,l)}return r}var S=s(3282),E=s.n(S);const k="PrairieLearn/PrairieLearn",P=["apps/prairielearn/src/schemas/schemas","schemas/schemas"];class N{options;problems=new Set;fetch;loading=new Map;resolving=new Map;constructor(e){this.options=e,this.fetch=e.fetch??globalThis.fetch}get cacheDir(){return this.options.cacheDir}get(e,t){const r=`${t}\0${e}`;let s=this.loading.get(r);return s||(s=this.load(e,t),this.loading.set(r,s)),s}async load(e,t){const r=await this.resolve(t);if(!r)return;const s=await this.schemaText(e,r);if(void 0!==s)try{return{validate:new(E())({allErrors:!0,strict:!1,validateFormats:!1}).compile(JSON.parse(s)),label:r.label}}catch(t){return void this.problems.add(`could not compile ${e} schema for PL ${r.label}: ${t}`)}}resolve(e){let t=this.resolving.get(e);return t||(t=this.resolveUncached(e),this.resolving.set(e,t)),t}async resolveUncached(e){if((0,d._$)(e))return{key:e,ref:e,label:e.slice(0,7)};if("latest"===e){const e=(0,d.Ec)();return{key:`master-${e}`,ref:"master",label:`latest (${e})`}}const t=this.readRefs()[e]??await this.lookupSha(e);return t?{key:t,ref:t,label:`${e} (${t.slice(0,7)})`}:void 0}async lookupSha(e){const t=`https://api.github.com/repos/${k}/commits?sha=master&until=${e}T23:59:59Z&per_page=1`,r={accept:"application/vnd.github+json"};this.options.githubToken&&(r.authorization=`Bearer ${this.options.githubToken}`);try{const s=await this.fetch(t,{headers:r});if(!s.ok){const t=403===s.status||429===s.status?" (rate limited; set GITHUB_TOKEN or pin a commit sha)":"";return void this.problems.add(`could not resolve PL version ${e}: GitHub API returned ${s.status}${t}`)}const n=await s.json(),o=n[0]?.sha;return o?(this.writeRefs({...this.readRefs(),[e]:o}),o):void this.problems.add(`no PrairieLearn commit found on or before ${e}`)}catch(t){return void this.problems.add(`could not resolve PL version ${e} (offline?): ${t}`)}}async schemaText(e,t){const r=o.join(this.options.cacheDir,t.key),s=o.join(r,`${e}.json`);if(n.existsSync(s))return n.readFileSync(s,"utf-8");let a="";for(const n of P){const o=`https://raw.githubusercontent.com/${k}/${t.ref}/${n}/${e}.json`;try{const e=await this.fetch(o);if(e.ok){const n=await e.text();return this.writeCache(r,s,n,t),n}if(a=`HTTP ${e.status}`,404!==e.status)break}catch(r){return void this.problems.add(`schema ${e} for PL ${t.label} is not cached and could not be downloaded (offline?): ${r}`)}}this.problems.add(`schema ${e} not found for PL ${t.label} (${a})`)}writeCache(e,t,r,s){try{n.mkdirSync(e,{recursive:!0}),n.writeFileSync(t,r),"master"===s.ref&&this.pruneStaleLatest(s.key)}catch(t){this.problems.add(`could not write schema cache ${e}: ${t}`)}}pruneStaleLatest(e){for(const t of n.readdirSync(this.options.cacheDir))t.startsWith("master-")&&t!==e&&n.rmSync(o.join(this.options.cacheDir,t),{recursive:!0,force:!0})}get refsFile(){return o.join(this.options.cacheDir,"refs.json")}readRefs(){try{return JSON.parse(n.readFileSync(this.refsFile,"utf-8"))}catch{return{}}}writeRefs(e){try{n.mkdirSync(this.options.cacheDir,{recursive:!0}),n.writeFileSync(this.refsFile,JSON.stringify(e,void 0,2)+"\n")}catch(e){this.problems.add(`could not write ${this.refsFile}: ${e}`)}}}function j(){return{cwd:process.cwd(),stdout:(e="")=>console.log(e),stderr:(e="")=>console.error(e)}}class O{configPath;overrides;cwd;byCourse=new Map;stores=new Map;constructor(e,t,r){this.configPath=e,this.overrides=t,this.cwd=r}get(e){let t=this.byCourse.get(e);if(!t){const r=(0,a.Z9)(e,{configPath:this.configPath,configPathBaseDir:this.cwd,overrides:this.overrides,overridesBaseDir:this.cwd}),{schemaCacheDir:s}=r.config;let n=this.stores.get(s);n||(n=new N({cacheDir:s,githubToken:process.env.GITHUB_TOKEN}),this.stores.set(s,n));const o=g.np.every(e=>"off"===r.config.rules[e])?void 0:y(e,(0,d.JX)(r.config.plVersion));t={loaded:r,schemas:n,references:o},this.byCourse.set(e,t)}return t}configProblems(){const e=new Map;for(const{loaded:t}of this.byCourse.values())t.file&&t.problems.some(e=>e.file)&&e.set(t.file,t.problems.filter(e=>e.file));return e}schemaProblems(){return[...this.stores.values()].flatMap(e=>[...e.problems])}}function x(e,t,r){const s=l(t,e.startOffset),n=l(t,e.endOffset),o=e.code?.replace(/^prairielearn-navigator\//,"");return{file:r,line:s.line,column:s.column,endLine:n.line,endColumn:n.column,message:o?`${e.message} [${o}]`:e.message,severity:e.severity}}async function I(e,t,r,s){const a=n.readFileSync(e,"utf-8"),i=await async function(e,t,r){const{courseRoot:s,config:n,schemas:o,references:a}=r,i=(0,c.bo)(s,e),l=(0,d.JX)(n.plVersion);let u;const f={courseRoot:s,filePath:e,relPath:i,text:t,get doc(){return u??=(0,$.ye)(t)},plVersion:n.plVersion,plDate:l,schemas:o,references:a},h=await Promise.all(function(e,t,r=g.aO){const s=[];for(const[n,o]of Object.entries(r)){const r=o.find(([r,s])=>(0,c.kt)(e,s)&&(0,d.tT)(r,t));r&&s.push([n,r[2]])}return s}(i,l).filter(([e])=>"off"!==n.rules[e]).map(async([e,t])=>{let r;n.rules[e];try{r=await t(f)}catch(e){r=[{startOffset:0,endOffset:0,message:`internal error in rule: ${e}`,severity:"warning"}]}return r.map(t=>b(t,e,n))}));return w(e,h.flat().sort((e,t)=>e.startOffset-t.startOffset),n)}(e,a,{courseRoot:t,config:s.loaded.config,schemas:s.schemas,references:s.references}),l=new Set(i.filter(e=>"error"===e.severity).map(e=>a.slice(e.startOffset,e.endOffset))),h=o.basename(e)===A?(0,f.IO)((0,f.vz)(a),(0,c.bo)(t,e),(0,d.JX)(s.loaded.config.plVersion),{courseRoot:t,fileDir:o.dirname(e)},e=>"question"===e.target).map(e=>e.value):[],m=[...new Set(h)].map(e=>({infoJson:(0,u.S)({courseId:t,localId:e}).infoJson,hasError:l.has(e)}));return{errors:i.map(e=>x(e,a,r)),questions:m}}function C(e){return{errors:[{file:e,line:1,column:1,endLine:1,endColumn:1,message:"not inside a course (no infoCourse.json found in any parent directory); skipped",severity:"warning"}],questions:[]}}function R(e){return e.replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function T(e){const t=[`file=${r=e.file,R(r).replace(/:/g,"%3A").replace(/,/g,"%2C")}`,`line=${e.line}`,`col=${e.column}`,`endLine=${e.endLine}`,`endColumn=${e.endColumn}`,"title=prairielearn-navigator"].join(",");var r;return`::${"info"===e.severity?"notice":e.severity} ${t}::${R(e.message)}`}const D=[`${o.sep}node_modules${o.sep}`,`${o.sep}.git${o.sep}`],A="infoAssessment.json",q=["infoCourse.json","infoCourseInstance.json",A,"info.json","question.html"],V=["infoCourseInstance.json",A],M=`**/{${q.join(",")}}`;function U(e){return/[*?[\]{}]/.test(e)}function z(e,t){return n.globSync([e,`${e.replace(/\/+$/,"")}/${M}`],{cwd:t}).filter(e=>q.includes(o.basename(e))).map(e=>o.resolve(t,e))}function F(e,t,r){const s=o.relative(r,e).split(o.sep).join("/");return t.some(t=>{if(U(t)){const e=t.replace(/^\.\//,"").replace(/\/+$/,"");return(0,c.kt)(s,e)||(0,c.kt)(s,`${e}/**`)}const n=o.relative(o.resolve(r,t),e);return""===n||!n.startsWith("..")&&!o.isAbsolute(n)})}function L(e,t){const r=new Map,s=new Set;for(const a of e)for(const e of U(a)?n.globSync(a,{cwd:t}):[a]){const a=o.resolve(t,e),c=n.statSync(a,{throwIfNoEntry:!1}),l=c&&i(c.isDirectory()?o.join(a,"_"):a,r);l&&s.add(l)}return s}const K='Usage: prairielearn-navigator check [options] [paths...]\n\nCheck a PrairieLearn course\'s JSON files against PrairieLearn\'s schemas and\nthe navigator\'s rules: missing, incomplete, and duplicate questions,\nquestion directories without info.json, and clientFilesCourse dependencies\nthat do not exist.\n\nArguments:\n paths Course directories to search, course JSON files, or glob\n patterns matching either (default: .). Quote globs so the shell\n does not expand them.\n\nOptions:\n --format <pretty|github> Output format (default: pretty). "github" emits\n GitHub Actions annotations.\n --config <path> Config file (default: .pl-navigator.jsonc in each\n course root)\n --pl-version <version> PrairieLearn version to check against: "latest",\n a date (YYYY-MM-DD), or a commit sha\n --schema-cache <dir> Where downloaded schemas are cached\n --exclude <glob> Skip matching files (relative to the current\n directory; repeatable). Adds to the config\n file\'s "excludes".\n --unused-questions <ignored|info|warning|error>\n Severity for questions no assessment uses\n (default: info)\n --unused-tags <ignored|info|warning|error>\n Severity for infoCourse.json tags no question\n uses (default: warning)\n --unused-assessment-sets <ignored|info|warning|error>\n Severity for infoCourse.json assessment sets no\n assessment uses (default: warning)\n --missing-question-info <ignored|info|warning|error>\n Severity for directories in questions/ with files\n but no info.json, which PrairieLearn fails to\n load (default: error)\n --help Show this help message\n\nDated versions are resolved with the GitHub API; set GITHUB_TOKEN to avoid\nits rate limit.\n\nExit status is 1 if any errors are found; warnings and infos do not affect it.\n\nExamples:\n prairielearn-navigator check\n prairielearn-navigator check path/to/course\n prairielearn-navigator check --pl-version 2025-06-01\n prairielearn-navigator check --exclude "questions/archive/**"\n prairielearn-navigator check --unused-questions error\n prairielearn-navigator check --missing-question-info warning\n prairielearn-navigator check "courseInstances/Fa26/**"\n prairielearn-navigator check "**/assessments/hw*/infoAssessment.json"\n prairielearn-navigator check --format github',B=["--format","--config","--pl-version","--schema-cache","--exclude","--unused-questions","--unused-tags","--unused-assessment-sets","--missing-question-info"],J=["--exclude"];function G(e){return 0===e.length?"QIDs must not be empty":e.includes("\\")||o.posix.isAbsolute(e)||/^[A-Za-z]:/.test(e)?`QID "${e}" must be a relative path using forward slashes`:e.split("/").some(e=>""===e||"."===e||".."===e)?`QID "${e}" must not contain empty, ".", or ".." path segments`:void 0}function H(e,t){return o.join(e,"questions",...t.split("/"))}const W="Usage: prairielearn-navigator rename-qids [options] <old-qid> <new-qid> [<old-qid> <new-qid> ...]\n\nUpdate every semantic reference to one or more PrairieLearn question IDs.\nThis command changes references only; it never moves question directories.\n\nArguments:\n old-qid new-qid One or more pairs of QIDs to rename\n\nOptions:\n --course <path> A PrairieLearn course or path inside one (default: .)\n --write Write the planned changes. Without this flag, only preview\n them.\n --help Show this help message\n\nExamples:\n prairielearn-navigator rename-qids old new\n prairielearn-navigator rename-qids --course path/to/course old new\n prairielearn-navigator rename-qids a b topic/one unit/one\n prairielearn-navigator rename-qids --write old new";const Q="Usage: prairielearn-navigator <command> [options]\n\nCommands:\n check Check a course's JSON files against PrairieLearn's schemas and rules\n rename-qids Preview or write semantic QID reference updates\n\nRun 'prairielearn-navigator <command> --help' for command-specific help.";!async function(){process.exit(await async function(t,r=j()){const s=t[0];switch(s){case"check":return async function(t,r=j()){if(t.includes("--help")||t.includes("-h"))return r.stdout(K),0;const s=function(e){const t={},r=[];for(let s=0;s<e.length;s++){const n=e[s];if(!n.startsWith("-")){r.push(n);continue}const o=n.indexOf("="),a=-1===o?n:n.slice(0,o);if(!B.includes(a))return`Unknown option: ${n}`;const i=-1===o?e[++s]:n.slice(o+1);if(void 0===i)return`Missing value for ${a}`;t[a]=J.includes(a)&&void 0!==t[a]?`${t[a]}\0${i}`:i}return{options:t,paths:r}}(t);if("string"==typeof s)return r.stderr(e("red",s)),r.stderr(K),1;const{options:l,paths:d}=s,u=l["--format"]??"pretty";if("pretty"!==u&&"github"!==u)return r.stderr(e("red",`Invalid --format: ${u}`)),1;0===d.length&&d.push(".");const f=r.cwd,h={excludes:l["--exclude"]?.split("\0"),plVersion:l["--pl-version"],schemaCacheDir:l["--schema-cache"],unusedQuestions:l["--unused-questions"],unusedTags:l["--unused-tags"],unusedAssessmentSets:l["--unused-assessment-sets"],missingQuestionInfo:l["--missing-question-info"]},m=(0,a.Z9)(null,{configPath:l["--config"],configPathBaseDir:f,overrides:h,overridesBaseDir:f}).problems.filter(e=>!e.file);if(m.length>0)return m.forEach(t=>r.stderr(e("red",t.message))),1;const p=new O(l["--config"],h,f),y=function(e,t){const r=[],s=new Map;for(const n of e){const e=i(n,s);t(n,e)||(null===e?V.includes(o.basename(n))&&r.push([n,null]):v((0,c.bo)(e,n))&&r.push([n,e]))}return r}(function(e,t){const r=new Set;for(const s of e){if(U(s)){for(const e of z(s,t))r.add(e);continue}const e=o.resolve(t,s);if(n.existsSync(e))if(n.statSync(e).isDirectory())for(const t of n.globSync(M,{cwd:e}))r.add(o.resolve(e,t));else r.add(e)}return[...r].filter(e=>!D.some(t=>e.includes(t))).sort()}(d,f),(e,t)=>(0,a.RF)(null===t?(0,a.Z9)(null,{overrides:h,overridesBaseDir:f}).config:p.get(t).loaded.config,e)),g=new Map,$=new Set([...L(d,f),...y.flatMap(([,e])=>null===e?[]:[e])]);for(const e of $)for(const[t,r]of _(e,p.get(e).loaded.config))F(t,d,f)&&g.set(t,r);if(0===y.length&&0===g.size){r.stderr(e("yellow","No PrairieLearn course JSON files found in:"));for(const t of d)r.stderr(e("yellow",` ${t}`));return 1}let w=0,b=0,S=0,E=0;const k=new Set,P=[],N=[],A=e=>o.relative(f,e)||e,q=(t,r)=>{const s=t.filter(e=>"error"===e.severity).length,n=t.filter(e=>"warning"===e.severity).length;if(t.length>0)if(s+n>0&&E++,w+=s,b+=n,S+=t.length-s-n,"github"===u)N.push(...t.map(T));else{const s=r();N.push(...t.map(t=>function(t,r){const s=r.split("\n"),n=t.line-1,o="error"===t.severity?"red":"warning"===t.severity?"yellow":"cyan",a=e("bold",`${t.file}:${t.line}:${t.column}`)+" "+e(o,t.severity)+": "+t.message;if(""===r)return a;const i=Math.max(0,n-2),c=Math.min(s.length-1,t.endLine-1),l=String(c+1).length,d=e=>String(e).padStart(l),u=[a];u.push(e("dim"," ".repeat(l)+" |"));for(let t=i;t<=c;t++)u.push(e("dim",`${d(t+1)} |`)+" "+s[t]);const f=s[t.endLine-1]||"",[h,m]=t.line===t.endLine?[t.column-1,t.endColumn-1]:[0,f.length],p=" ".repeat(h)+"^".repeat(Math.max(1,m-h))+" "+t.message;return u.push(e("dim"," ".repeat(l)+" |")+" "+e(o,p)),u.join("\n")}(t,s)+"\n"))}return{fileErrors:s,fileWarnings:n}},G=(e,t)=>e>0?"red":t>0?"yellow":"dim";for(const[t,r]of y){const s=A(t),a=null===r?C(s):await I(t,r,s,p.get(r)),{questions:i}=a,c=[...(g.get(t)??[]).map(e=>x(e,"",s)),...a.errors];g.delete(t);const{fileErrors:l,fileWarnings:d}=q(c,()=>n.readFileSync(t,"utf-8"));P.push(e(G(l,d),s));for(const t of i){k.add(t.infoJson);const r=" "+(o.relative(f,t.infoJson)||t.infoJson);P.push(e(t.hasError?"red":"dim",r))}}for(const[t,r]of g){const s=A(t),{fileErrors:n,fileWarnings:o}=q(r.map(e=>x(e,"",s)),()=>"");P.push(e(G(n,o),s))}for(const[e,t]of p.configProblems()){const r=n.readFileSync(e,"utf-8");q(t.map(t=>x(t,r,A(e))),()=>r)}for(const t of p.schemaProblems())b++,N.push("github"===u?`::warning title=prairielearn-navigator::${R(t)}`:e("yellow","warning")+`: ${t}\n`);if("github"===u?(r.stdout("::group::Checked files"),P.forEach(e=>r.stdout(e)),r.stdout("::endgroup::")):P.forEach(e=>r.stdout(e)),N.length>0){"pretty"===u&&r.stdout();for(const e of N)r.stdout(e)}return r.stdout(function(t,r,s,n,o=0,a=0){const i=`${s} ${1===s?"file":"files"}, ${n} ${1===n?"question":"questions"} checked`,c=a>0?`${a} ${1===a?"info":"infos"}`:"";if(0===t&&0===o)return c?e("green","No errors found")+`, ${e("cyan",c)} (${i})`:e("green",`No errors found (${i})`);const l=[];if(t>0){const r=1===t?"error":"errors";l.push(e("red",`${t} ${r}`))}if(o>0){const t=1===o?"warning":"warnings";l.push(e("yellow",`${o} ${t}`))}c&&l.push(e("cyan",c));const d=r>0?` in ${r} ${1===r?"file":"files"}`:"";return`${l.join(", ")}${d} (${i})`}(w,E,y.length,k.size,b,S)),w>0?1:0}(t.slice(1),r);case"rename-qids":return async function(e,t=j()){if(e.includes("--help")||e.includes("-h"))return t.stdout(W),0;const r=function(e){let t=".",r=!1;const s=[];for(let n=0;n<e.length;n++){const o=e[n];if("--write"!==o){if("--course"===o||o.startsWith("--course=")){const r="--course"===o?e[++n]:o.slice(9);if(!r)return"Missing value for --course";t=r;continue}if(o.startsWith("-"))return`Unknown option: ${o}`;s.push(o)}else r=!0}if(0===s.length)return"At least one old/new QID pair is required";if(s.length%2!=0)return"QIDs must be provided as old/new pairs";const n=[];for(let e=0;e<s.length;e+=2)n.push({oldQid:s[e],newQid:s[e+1]});return{course:t,write:r,renames:n}}(e);if("string"==typeof r)return t.stderr(r),t.stderr(W),1;let s;try{s=function(e,t){const r=o.resolve(t,e),s=n.statSync(r,{throwIfNoEntry:!1});return s?i(s.isDirectory()?o.join(r,"_"):r):null}(r.course,t.cwd)}catch(e){return t.stderr(e instanceof Error?e.message:String(e)),1}if(!s)return t.stderr(`No PrairieLearn course found for ${o.resolve(t.cwd,r.course)}`),1;try{const e=function(e,t){const r=new Map;for(const{oldQid:e,newQid:s}of t){const t=G(e)??G(s);if(t)throw new Error(t);if(e===s)throw new Error(`QID "${e}" cannot be renamed to itself`);const n=r.get(e);if(void 0!==n&&n!==s)throw new Error(`Conflicting QID renames for "${e}": "${n}" and "${s}"`);r.set(e,s)}const s=new Map;for(const[t,n]of r){const r=H(e.courseRoot,t);for(const o of e.usesOf(r)){if("question"!==o.ref.spec.target||o.ref.target!==r)continue;const e=`${o.file}\0${o.ref.startOffset}\0${o.ref.endOffset}`,a={oldQid:t,newQid:n,file:o.file,startOffset:o.ref.startOffset,endOffset:o.ref.endOffset,start:o.start,end:o.end,expected:o.ref.value,replacement:n},i=s.get(e);if(i&&i.replacement!==a.replacement)throw new Error(`Conflicting replacements for ${o.file}:${o.start.line}:${o.start.column}`);s.set(e,a)}}return[...s.values()].sort((e,t)=>e.file.localeCompare(t.file)||e.startOffset-t.startOffset||e.endOffset-t.endOffset)}(y(s,(0,d.Ec)()),r.renames);if(0===e.length)return t.stdout("No semantic QID references matched."),0;const a=function(e){const t=new Map;for(const r of e){const e=t.get(r.file)??[];e.push(r),t.set(r.file,e)}const r=[];for(const e of[...t.keys()].sort()){const s=n.readFileSync(e,"utf-8"),o=t.get(e).sort((e,t)=>t.startOffset-e.startOffset||t.endOffset-e.endOffset);let a=s.length;for(const t of o){if(t.endOffset>a)throw new Error(`Overlapping QID edits in ${e}:${t.start.line}:${t.start.column}`);if(t.startOffset<0||t.endOffset<t.startOffset||s.slice(t.startOffset,t.endOffset)!==t.expected)throw new Error(`QID reference changed before it could be updated at ${e}:${t.start.line}:${t.start.column}`);a=t.startOffset}let i=s;for(const e of o)i=i.slice(0,e.startOffset)+e.replacement+i.slice(e.endOffset);r.push({file:e,original:s,updated:i})}return r}(e);return e.forEach(e=>t.stdout(function(e,t){return`${o.relative(t,e.file)||e.file}:${e.start.line}:${e.start.column} ${JSON.stringify(e.expected)} -> ${JSON.stringify(e.replacement)}`}(e,t.cwd))),r.write?(function(e){const t=[];try{for(const r of e)n.writeFileSync(r.file,r.updated),t.push(r)}catch(e){const r=[];for(const e of t.reverse())try{n.writeFileSync(e.file,e.original)}catch(e){r.push(e)}if(r.length>0)throw new Error(`${e instanceof Error?e.message:String(e)}; failed to roll back ${r.length} file(s)`);throw e}}(a),t.stdout(`Updated ${e.length} ${1===e.length?"reference":"references"} in ${a.length} ${1===a.length?"file":"files"}.`),0):(t.stdout(`Would update ${e.length} ${1===e.length?"reference":"references"} in ${a.length} ${1===a.length?"file":"files"}. Rerun with --write to apply these changes.`),0)}catch(e){return t.stderr(e instanceof Error?e.message:String(e)),1}}(t.slice(1),r);case"--help":case"-h":return r.stdout(Q),0;case void 0:return r.stdout(Q),1;default:return r.stderr(e("red",`Unknown command: ${s}`)),r.stderr('Run "prairielearn-navigator --help" for usage.'),1}}(process.argv.slice(2)))}()},4269(e,t,r){r.d(t,{Ec:()=>l,JX:()=>d,_$:()=>i,rx:()=>c,tT:()=>u});const s=/^\d{4}-\d{2}-\d{2}$/,n=/^[0-9a-f]{40}$/,o=/^(>=|<=|>|<|=)?(\d{4}-\d{2}-\d{2})$/;function a(e){return s.test(e)&&!Number.isNaN(Date.parse(e))}function i(e){return n.test(e)}function c(e){return"string"!=typeof e?"plVersion must be a string":"latest"===e||a(e)||i(e)?void 0:`invalid plVersion "${e}": expected "latest", a date (YYYY-MM-DD), or a 40-character commit sha`}function l(){return(new Date).toISOString().slice(0,10)}function d(e){return a(e)?e:l()}function u(e,t){return e.trim().split(/\s+/).every(r=>{if("*"===r)return!0;const s=o.exec(r);if(!s)throw new Error(`invalid version range "${e}"`);const[,n="=",a]=s;switch(n){case">=":return t>=a;case"<=":return t<=a;case">":return t>a;case"<":return t<a;default:return t===a}})}},6897(e,t,r){r.d(t,{IO:()=>u,Li:()=>d,vz:()=>l}),r(9627),r(5663);var s=r(8141),n=r(1656),o=r(9889),a=r(4269),i=r(6590),c=r(2940);function l(e){let t;return{text:e,get doc(){return t??=(0,o.ye)(e)}}}function d(e){return c.c.some(t=>(0,s.kt)(e,t.files))}function u(e,t,r,o,i=()=>!0){const l=[];for(const d of c.c)if(i(d)&&(0,s.kt)(t,d.files)&&(0,a.tT)(d.range,r))if("json"===d.source){const t=e.doc.tree;t&&h(d,d.json.json,d.json.base,t,o,l)}else for(const t of(0,n.b)(e.text,d.html.tag)){const e=p(d,t,o);e&&l.push(e)}return l.sort((e,t)=>e.startOffset-t.startOffset)}function f(e,t){return"*"===e||(e instanceof RegExp?"string"==typeof t&&e.test(t):e===String(t))}function h(e,t,r,s,n,o,a=0){if(a===t.length){if("string"===s.type){const t=s.value;o.push({spec:e,value:t,startOffset:s.offset+1,endOffset:s.offset+s.length-1,...y(e,t,(0,i.P)(r,n))})}return}const c=t[a];if("object"===s.type)for(const i of s.children??[]){const[s,l]=i.children??[];s&&l&&f(c,s.value)&&h(e,t,r,l,n,o,a+1)}else"array"===s.type&&(s.children??[]).forEach((s,i)=>{f(c,i)&&h(e,t,r,s,n,o,a+1)})}const m=e=>e.includes("{{");function p(e,t,r){const{attr:s,directory:n,base:o,staticOnly:a}=e.html,c=t.attributes.get(s),l=t.attributes.get("type")?.value??"static",d=t.attributes.get("directory"),u=d?.value??n?.default??"";if(!c||[c.value,l,u].some(m)||a&&"static"!==l.trim().toLowerCase())return;const f={spec:e,value:c.value,startOffset:c.startOffset,endOffset:c.endOffset};let h;if(n?Object.hasOwn(n.named,u)?h=(0,i.P)(n.named[u],r):n.relative&&(h=(0,i.n)(r.fileDir,u,!0)??void 0):h=(0,i.P)(o??"fileDir",r),!h){const t=Object.keys(n?.named??{}).map(e=>`"${e}"`),r=t.length>2?`one of ${t.join(", ")}`:t.join(" or ");return{...f,value:u,startOffset:d?.startOffset??f.startOffset,endOffset:d?.endOffset??f.endOffset,target:null,problem:n?.relative?`${e.html.tag} directory "${u}" must be inside the question directory`:`invalid ${e.html.tag} directory "${u}": must be ${r}`}}return{...f,...y(e,c.value,h,u)}}function y(e,t,r,s=("json"===e.source?e.json.base:"")){const n=(0,i.n)(r,t);return n?{target:n}:{target:null,problem:`"${t}" must be a path inside ${"question"===e.target?"questions/":"fileDir"===s||"."===s||""===s?"its directory":`${s}/`}`}}},4402(e,t,r){r.d(t,{KX:()=>i,NC:()=>c});var s=r(8141),n=r(2940),o=r(1922);const a={"json-syntax":Object.values(s.l$).map(e=>["*",e,o.WS]),schema:[["*",s.l$.course,(0,o.Et)("infoCourse")],["*",s.l$.courseInstance,(0,o.Et)("infoCourseInstance")],["*",s.l$.assessment,(0,o.Et)("infoAssessment")],["*",s.l$.question,(0,o.Et)("infoQuestion")],["*",s.l$.element,(0,o.Et)("infoElementCourse")],["*",s.l$.elementExtension,(0,o.Et)("infoElementExtension")]],"duplicate-question-id":[["*",s.l$.assessment,o.Ex]],"unused-question":[["*",s.l$.question,o.f0]],"unused-tag":[["*",s.l$.course,o.Gx]],"unused-assessment-set":[["*",s.l$.course,o.qQ]],"question-info-missing":[],...function(){const e={};for(const t of n.c){const r=e[t.rule]??=[];r.some(([,e])=>e===t.files)||r.push(["*",t.files,(0,o.k2)(t.rule)])}return e}()};function i(e){return Object.hasOwn(a,e)}function c(e){return`prairielearn-navigator/${e}`}r.d(t,["aO",0,a,"np",0,["unused-question","unused-tag","unused-assessment-set"]])},9627(e,r,s){e.exports=(e=>{const t={};return s.d(t,e),t})({existsSync:()=>t.existsSync,globSync:()=>t.globSync,mkdirSync:()=>t.mkdirSync,readFileSync:()=>t.readFileSync,readdirSync:()=>t.readdirSync,rmSync:()=>t.rmSync,statSync:()=>t.statSync,writeFileSync:()=>t.writeFileSync})},5663(e,t,s){e.exports=(e=>{const t={};return s.d(t,e),t})({basename:()=>r.basename,dirname:()=>r.dirname,isAbsolute:()=>r.isAbsolute,join:()=>r.join,posix:()=>r.posix,relative:()=>r.relative,resolve:()=>r.resolve,sep:()=>r.sep})},8343(e,t,r){const{normalizeIPv6:s,removeDotSegments:n,recomposeAuthority:o,normalizePercentEncoding:a,normalizePathEncoding:i,escapePreservingEscapes:c,reescapeHostDelimiters:l,isIPv4:d,nonSimpleDomain:u}=r(4834),{SCHEMES:f,getSchemeHandler:h}=r(343);function m(e,t,r,s){const o={};return s||(e=w(p(e,r),r),t=w(p(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=n(t.path||""),o.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=n(t.path||""),o.query=t.query):(t.path?("/"===t.path[0]?o.path=n(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:o.path=t.path:o.path="/"+t.path,o.path=n(o.path)),o.query=t.query):(o.path=e.path,void 0!==t.query?o.query=t.query:o.query=e.query),o.userinfo=e.userinfo,o.host=e.host,o.port=e.port),o.scheme=e.scheme),o.fragment=t.fragment,o}function p(e,t){const r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},s=Object.assign({},t),i=[],l=h(s.scheme||r.scheme);l&&l.serialize&&l.serialize(r,s),void 0!==r.path&&(s.skipEscape?r.path=a(r.path):(r.path=c(r.path),void 0!==r.scheme&&(r.path=r.path.split("%3A").join(":")))),"suffix"!==s.reference&&r.scheme&&i.push(r.scheme,":");const d=o(r);if(void 0!==d&&("suffix"!==s.reference&&i.push("//"),i.push(d),r.path&&"/"!==r.path[0]&&i.push("/")),void 0!==r.path){let e=r.path;s.absolutePath||l&&l.absolutePath||(e=n(e)),void 0===d&&"/"===e[0]&&"/"===e[1]&&(e="/%2F"+e.slice(2)),i.push(e)}return void 0!==r.query&&i.push("?",r.query),void 0!==r.fragment&&i.push("#",r.fragment),i.join("")}const y=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,g=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,$=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function v(e,t){const r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let o=!1,a=!1;"suffix"===r.reference&&(e=r.scheme?r.scheme+":"+e:"//"+e);const c=e.match(g);null!==c&&-1!==c[1].indexOf("\\")&&(n.error="URI authority must not contain a literal backslash.",o=!0);const f=e.match($);if(null!==f){const e=f[1],t=e.replace(/[\t\n\r]/g,"");t.length>=2&&("//"!==t.slice(0,2)?(n.error=n.error||"URI authority must not contain a literal backslash.",o=!0):e.length!==t.length&&(n.error=n.error||"URI authority introducer must not contain whitespace.",o=!0))}const m=e.match(y);if(m){n.scheme=m[1],n.userinfo=m[3],n.host=m[4],n.port=parseInt(m[5],10),n.path=m[6]||"",n.query=m[7],n.fragment=m[8],isNaN(n.port)&&(n.port=m[5]);const t=function(e,t){return void 0!==t[2]&&e.path&&"/"!==e.path[0]?'URI path must start with "/" when authority is present.':"number"==typeof e.port&&(e.port<0||e.port>65535)?"URI port is malformed.":void 0}(n,m);if(void 0!==t&&(n.error=n.error||t,o=!0),n.host)if(!1===d(n.host)){const e=s(n.host);n.host=e.host.toLowerCase(),a=e.isIPV6}else a=!0;void 0!==n.scheme||void 0!==n.userinfo||void 0!==n.host||void 0!==n.port||void 0!==n.query||n.path?void 0===n.scheme?n.reference="relative":void 0===n.fragment?n.reference="absolute":n.reference="uri":n.reference="same-document",r.reference&&"suffix"!==r.reference&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");const c=h(r.scheme||n.scheme);if(!(r.unicodeSupport||c&&c.unicodeSupport)&&n.host&&(r.domainHost||c&&c.domainHost)&&!1===a&&u(n.host))try{n.host=new URL("http://"+n.host).hostname}catch(e){n.error=n.error||"Host's domain name can not be converted to ASCII: "+e}if((!c||c&&!c.skipNormalize)&&(-1!==e.indexOf("%")&&(void 0!==n.scheme&&(n.scheme=unescape(n.scheme)),void 0!==n.host&&(n.host=l(unescape(n.host),a))),n.path&&(n.path=i(n.path)),n.fragment))try{n.fragment=encodeURI(decodeURIComponent(n.fragment))}catch{n.error=n.error||"URI malformed"}c&&c.parse&&c.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:o}}function w(e,t){return v(e,t).parsed}function b(e,t){const{parsed:r,malformedAuthorityOrPort:s}=v(e,t);return{normalized:s?e:p(r,t),malformedAuthorityOrPort:s}}function _(e,t){if("string"==typeof e){const{normalized:r,malformedAuthorityOrPort:s}=b(e,t);return s?void 0:r}if("object"==typeof e)return p(e,t)}const S={SCHEMES:f,normalize:function(e,t){return"string"==typeof e?e=function(e,t){return b(e,t).normalized}(e,t):"object"==typeof e&&(e=w(p(e,t),t)),e},resolve:function(e,t,r){const s=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:n,malformedAuthorityOrPort:o}=v(e,s),{parsed:a,malformedAuthorityOrPort:i}=v(t,s);if(o||i)throw new Error(n.error||a.error||"URI is malformed.");const c=m(n,a,s,!0);return s.skipEscape=!0,p(c,s)},resolveComponent:m,equal:function(e,t,r){const s=_(e,r),n=_(t,r);return void 0!==s&&void 0!==n&&s.toLowerCase()===n.toLowerCase()},serialize:p,parse:w};e.exports=S,e.exports.default=S,e.exports.fastUri=S},343(e,t,r){const{isUUID:s}=r(4834),n=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,o=["http","https","ws","wss","urn","urn:uuid"];function a(e){return!0===e.secure||!1!==e.secure&&!!e.scheme&&!(3!==e.scheme.length||"w"!==e.scheme[0]&&"W"!==e.scheme[0]||"s"!==e.scheme[1]&&"S"!==e.scheme[1]||"s"!==e.scheme[2]&&"S"!==e.scheme[2])}function i(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function c(e){const t="https"===String(e.scheme).toLowerCase();return e.port!==(t?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}const l={scheme:"http",domainHost:!0,parse:i,serialize:c},d={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=a(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if(e.port!==(a(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){const[t,r]=e.resourceName.split("?");e.path=t&&"/"!==t?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}},u={http:l,https:{scheme:"https",domainHost:l.domainHost,parse:i,serialize:c},ws:d,wss:{scheme:"wss",domainHost:d.domainHost,parse:d.parse,serialize:d.serialize},urn:{scheme:"urn",parse:function(e,t){if(!e.path)return e.error="URN can not be parsed",e;const r=e.path.match(n);if(r){const s=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];const n=f(`${s}:${t.nid||e.nid}`);e.path=void 0,n&&(e=n.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e},serialize:function(e,t){if(void 0===e.nid)throw new Error("URN without nid cannot be serialized");const r=t.scheme||e.scheme||"urn",s=e.nid.toLowerCase(),n=f(`${r}:${t.nid||s}`);n&&(e=n.serialize(e,t));const o=e,a=e.nss;return o.path=`${s||t.nid}:${a}`,t.skipEscape=!0,o},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(e,t){const r=e;return r.uuid=r.nss,r.nss=void 0,t.tolerant||r.uuid&&s(r.uuid)||(r.error=r.error||"UUID is not valid."),r},serialize:function(e){const t=e;return t.nss=(e.uuid||"").toLowerCase(),t},skipNormalize:!0}};function f(e){return e&&(u[e]||u[e.toLowerCase()])||void 0}Object.setPrototypeOf(u,null),e.exports={wsIsSecure:a,SCHEMES:u,isValidSchemeName:function(e){return-1!==o.indexOf(e)},getSchemeHandler:f}},4834(e){const t=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),r=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),s=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),n=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),o=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function a(e){let t="",r=0,s=0;for(s=0;s<e.length;s++)if(r=e[s].charCodeAt(0),48!==r){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[s];break}for(s+=1;s<e.length;s++){if(r=e[s].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[s]}return t}const i=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function c(e){return e.length=0,!0}function l(e,t,r){if(e.length){const s=a(e);if(""===s)return r.error=!0,!1;t.push(s),e.length=0}return!0}function d(e){if(function(e){let t=0;for(let r=0;r<e.length;r++)":"===e[r]&&t++;return t}(e)<2)return{host:e,isIPV6:!1};const t=function(e){let t=0;const r={error:!1,address:"",zone:""},s=[],n=[];let o=!1,i=!1,d=l;for(let a=0;a<e.length;a++){const l=e[a];if("["!==l&&"]"!==l)if(":"!==l)if("%"===l){if(!d(n,s,r))break;d=c}else n.push(l);else{if(!0===o&&(i=!0),!d(n,s,r))break;if(++t>7){r.error=!0;break}a>0&&":"===e[a-1]&&(o=!0),s.push(":")}}return n.length&&(d===c?r.zone=n.join(""):i?s.push(n.join("")):s.push(a(n))),r.address=s.join(""),r}(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,r=t.address;return t.zone&&(e+="%"+t.zone,r+="%25"+t.zone),{host:e,isIPV6:!0,escapedHost:r}}}const u={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},f=/[@/?#:]/g,h=/[@/?#]/g;function m(e,t){const r=t?h:f;return r.lastIndex=0,e.replace(r,e=>u[e])}e.exports={nonSimpleDomain:i,recomposeAuthority:function(e){const t=[];if(void 0!==e.userinfo&&(t.push(e.userinfo),t.push("@")),void 0!==e.host){let s=unescape(e.host);if(!r(s)){const e=d(s);s=!0===e.isIPV6?`[${e.escapedHost}]`:m(s,!1)}t.push(s)}return"number"!=typeof e.port&&"string"!=typeof e.port||(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0},reescapeHostDelimiters:m,normalizePercentEncoding:function(e,t=!1){if(-1===e.indexOf("%"))return e;let r="";for(let o=0;o<e.length;o++){if("%"===e[o]&&o+2<e.length){const a=e.slice(o+1,o+3);if(s(a)){const e=a.toUpperCase(),s=String.fromCharCode(parseInt(e,16));t&&n(s)?r+=s:r+="%"+e,o+=2;continue}}r+=e[o]}return r},normalizePathEncoding:function(e){let t="";for(let r=0;r<e.length;r++){if("%"===e[r]&&r+2<e.length){const o=e.slice(r+1,r+3);if(s(o)){const e=o.toUpperCase(),s=String.fromCharCode(parseInt(e,16));"."!==s&&n(s)?t+=s:t+="%"+e,r+=2;continue}}o(e[r])?t+=e[r]:t+=escape(e[r])}return t},escapePreservingEscapes:function(e){let t="";for(let r=0;r<e.length;r++){if("%"===e[r]&&r+2<e.length){const n=e.slice(r+1,r+3);if(s(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t},removeDotSegments:function(e){let t=e;const r=[];let s=-1,n=0;for(;n=t.length;){if(1===n){if("."===t)break;if("/"===t){r.push("/");break}r.push(t);break}if(2===n){if("."===t[0]){if("."===t[1])break;if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&("."===t[1]||"/"===t[1])){r.push("/");break}}else if(3===n&&"/.."===t){0!==r.length&&r.pop(),r.push("/");break}if("."===t[0]){if("."===t[1]){if("/"===t[2]){t=t.slice(3);continue}}else if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&"."===t[1]){if("/"===t[2]){t=t.slice(2);continue}if("."===t[2]&&"/"===t[3]){t=t.slice(3),0!==r.length&&r.pop();continue}}if(-1===(s=t.indexOf("/",1))){r.push(t);break}r.push(t.slice(0,s)),t=t.slice(s)}return r.join("")},isIPv4:r,isUUID:t,normalizeIPv6:d,stringArrayToHexStripped:a}},3837(e){e.exports=JSON.parse('{"$id":"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#","description":"Meta-schema for $data reference (JSON AnySchema extension proposal)","type":"object","required":["$data"],"properties":{"$data":{"type":"string","anyOf":[{"format":"relative-json-pointer"},{"format":"json-pointer"}]}},"additionalProperties":false}')},2079(e){e.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true}')}};const n={};function o(e){const t=n[e];if(void 0!==t)return t.exports;const r=n[e]={exports:{}};return s[e](r,r.exports,o),r.exports}o.m=s,(()=>{const e=[];o.O=(t,r,s,n)=>{if(r){n=n||0;for(var a=e.length;a>0&&e[a-1][2]>n;a--)e[a]=e[a-1];return void(e[a]=[r,s,n])}let i=1/0;for(a=0;a<e.length;a++){let[r,s,n]=e[a],l=!0;for(var c=0;c<r.length;c++)(!1&n||i>=n)&&Object.keys(o.O).every(e=>o.O[e](r[c]))?r.splice(c--,1):(l=!1,n<i&&(i=n));if(l){e.splice(a--,1);const r=s();void 0!==r&&(t=r)}}return t}})(),o.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{if(Array.isArray(t))for(var r=0;r<t.length;){var s=t[r++],n=t[r++];o.o(e,s)?0===n&&r++:0===n?Object.defineProperty(e,s,{enumerable:!0,value:t[r++]}):Object.defineProperty(e,s,{enumerable:!0,get:n})}else for(var s in t)o.o(t,s)&&!o.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},o.o=(e,t)=>Object.hasOwn(e,t);export{o as __webpack_require__};(()=>{const e={27:0};o.C=t=>{let{__webpack_esm_ids__:r,__webpack_esm_modules__:s,__webpack_esm_runtime__:n}=t;var a,i,c=0;for(a in s)o.o(s,a)&&(o.m[a]=s[a]);for(n&&n(o);c<r.length;c++)i=r[c],o.o(e,i)&&e[i]&&e[i][0](),e[r[c]]=0;o.O()},o.O.j=t=>0===e[t]})();import*as a from"./shared.js";o.C(a);let i=o.O(void 0,[804],()=>o(4071));i=o.O(i);
|