@netlify/framework-info
Version:
Framework detection utility
5 lines • 169 kB
JavaScript
/*! For license information please see index.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.frameworkInfo=t():e.frameworkInfo=t()}(this,(function(){return e={1581:(e,t,r)=>{"use strict";r(2227).default,r(3487);const s=r(7159),n=r(3924),o=r(278),a=["/properties"],i="http://json-schema.org/draft-07/schema";class c extends s.default{_addVocabularies(){super._addVocabularies(),n.default.forEach((e=>this.addVocabulary(e)))}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const e=this.opts.$data?this.$dataMetaSchema(o,a):o;this.addMetaSchema(e,i,!1),this.refs["http://json-schema.org/schema"]=i}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i)?i:void 0)}}t.ZP=c},7023:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),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=[u(e[0])];let s=0;for(;s<t.length;)r.push(a),c(r,t[s]),r.push(a,u(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:u(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 u(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(u(e))},t.safeStringify=u,t.getProperty=function(e){return"string"==typeof e&&t.IDENTIFIER.test(e)?new n(`.${e}`):o`[${e}]`}},3487:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;const s=r(7023),n=r(8490);var o=r(7023);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,"Name",{enumerable:!0,get:function(){return o.Name}});var a=r(8490);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 R(this.lhs instanceof s.Name?{}:{...this.lhs.names},this.rhs)}}class u 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 d extends i{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class p 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 f 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 m 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)||(k(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 g extends m{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class y extends m{}class v extends g{}v.kind="else";class $ extends g{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 $(I(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 R(e,this.condition),this.else&&O(e,this.else.names),e}}$.kind="if";class w extends g{}w.kind="for";class E 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 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=R(super.names,this.from);return R(e,this.to)}}class b 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 O(super.names,this.iterable.names)}}class S extends g{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)}}S.kind="func";class P extends m{render(e){return"return "+super.render(e)}}P.kind="return";class N extends g{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 x extends g{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}x.kind="catch";class T extends g{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 R(e,t){return t instanceof s._CodeOrName?O(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 k(e,t){for(const r in t)e[r]=(e[r]||0)-(t[r]||0)}function I(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:s._`!${M(e)}`}T.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 y]}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 u(e,t.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==s.nil&&this._leafNode(new f(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(":"),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 E(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 b("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 b("in",o,a,t),(()=>r(a)))}endFor(){return this._endBlockNode(w)}label(e){return this._leafNode(new d(e))}break(e){return this._leafNode(new p(e))}return(e){const t=new P;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(P)}try(e,t,r){if(!t&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');const s=new N;if(this._blockNode(s),this.code(e),t){const e=this.name("e");this._currNode=s.catch=new x(e),t(e)}return r&&(this._currNode=s.finally=new T,this.code(r)),this._endBlockNode(x,T)}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 S(e,t,r)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(S)}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=I;const A=D(t.operators.AND);t.and=function(...e){return e.reduce(A)};const j=D(t.operators.OR);function D(e){return(t,r)=>t===s.nil?r:r===s.nil?t:s._`${M(t)} ${e} ${M(r)}`}function M(e){return e instanceof s.Name?e:s._`(${e})`}t.or=function(...e){return e.reduce(j)}},8490:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const s=r(7023);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||(t.UsedValueState={})),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 u=e[l];if(!u)continue;const d=a[l]=a[l]||new Map;u.forEach((e=>{if(d.has(e))return;d.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}`}d.set(e,o.Completed)}))}return c}}},2227:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getData=void 0;const s=r(453),n=r(6776),o=r(4181),a=r(3487),i=r(2141),c=r(4069);t.default=class{constructor(e,t,r){if(function({schema:e,opts:t,self:r},s,n){if(Array.isArray(s.keyword)?!s.keyword.includes(n):s.keyword!==n)throw new Error("ajv implementation error");const o=s.dependencies;if(null==o?void 0:o.some((t=>!Object.prototype.hasOwnProperty.call(e,t))))throw new Error(`parent schema must have dependencies of ${n}: ${o.join(",")}`);if(s.validateSchema&&!s.validateSchema(e[n])){const e="keyword value is invalid: "+r.errorsText(s.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);r.logger.error(e)}}(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=n.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",d(this.$data,e));else if(this.schemaCode=this.schemaValue,!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))}(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",i.default.errors))}result(e,t,r){this.gen.if(a.not(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.result(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(a._`${t} !== undefined && (${a.or(this.invalid$data(),e)})`)}error(e){(e?o.reportExtraError:o.reportError)(this,this.def.error)}$dataError(){o.reportError(this,this.def.$dataError||o.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');o.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=a.nil){this.gen.block((()=>{this.check$data(e,r),t()}))}check$data(e=a.nil,t=a.nil){if(!this.$data)return;const{gen:r,schemaCode:s,schemaType:n,def:o}=this;r.if(a.or(a._`${s} === undefined`,t)),e!==a.nil&&r.assign(e,!0),(n.length||o.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==a.nil&&r.assign(e,!1)),r.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:r,def:n,it:o}=this;return a.or(function(){if(r.length){if(!(t instanceof a.Name))throw new Error("ajv implementation error");const e=Array.isArray(r)?r:[r];return a._`${s.checkDataTypes(e,t,o.opts.strict,s.DataType.Wrong)}`}return a.nil}(),function(){if(n.validateSchema){const r=e.scopeValue("validate$data",{ref:n.validateSchema});return a._`!${r}(${t})`}return a.nil}())}subschema(e,t){return c.applySubschema(this.it,e,t)}mergeEvaluated(e,t){const{it:r,gen:s}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=n.mergeEvaluated.props(s,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=n.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,a.Name))),!0}};const l=/^\/(?:[^~]|~0|~1)*$/,u=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function d(e,{dataLevel:t,dataNames:r,dataPathArr:s}){let o,c;if(""===e)return i.default.rootData;if("/"===e[0]){if(!l.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,c=i.default.rootData}else{const n=u.exec(e);if(!n)throw new Error(`Invalid JSON-pointer: ${e}`);const a=+n[1];if(o=n[2],"#"===o){if(a>=t)throw new Error(h("property/index",a));return s[t-a]}if(a>t)throw new Error(h("data",a));if(c=r[t-a],!o)return c}let d=c;const p=o.split("/");for(const e of p)e&&(c=a._`${c}${a.getProperty(n.unescapeJsonPointer(e))}`,d=a._`${d} && ${c}`);return d;function h(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}t.getData=d},8727:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=void 0;const s=r(2531);class n extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}t.ValidationError=n;class o extends Error{constructor(e,t,r){super(r||`can't resolve reference ${t} from id ${e}`),this.missingRef=s.resolveUrl(e,t),this.missingSchema=s.normalizeId(s.getFullPath(this.missingRef))}}t.MissingRefError=o,e.exports={ValidationError:n,MissingRefError:o}},4181:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;const s=r(3487),n=r(2141);function o(e,t){const r=e.const("err",t);e.if(s._`${n.default.vErrors} === null`,(()=>e.assign(n.default.vErrors,s._`[${r}]`)),s._`${n.default.vErrors}.push(${r})`),e.code(s._`${n.default.errors}++`)}function a(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.keywordError={message:({keyword:e})=>s.str`should 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.keywordError,n){const{it:i}=e,{gen:l,compositeRule:u,allErrors:d}=i,p=c(e,r);(null!=n?n:u||d)?o(l,p):a(i,s._`[${p}]`)},t.reportExtraError=function(e,r=t.keywordError){const{it:s}=e,{gen:i,compositeRule:l,allErrors:u}=s;o(i,c(e,r)),l||u||a(s,n.default.vErrors)},t.resetErrorsCount=function(e,t){e.assign(n.default.errors,t),e.if(s._`${n.default.vErrors} !== null`,(()=>e.if(t,(()=>e.assign(s._`${n.default.vErrors}.length`,t)),(()=>e.assign(n.default.vErrors,null)))))},t.extendErrors=function({gen:e,keyword:t,schemaValue:r,data:o,errsCount:a,it:i}){if(void 0===a)throw new Error("ajv implementation error");const c=e.name("err");e.forRange("i",a,n.default.errors,(a=>{e.const(c,s._`${n.default.vErrors}[${a}]`),e.if(s._`${c}.dataPath === undefined`,(()=>e.assign(s._`${c}.dataPath`,s.strConcat(n.default.dataPath,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`,o))}))};const i={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"),instancePath:new s.Name("instancePath")};function c(e,t){const{createErrors:r,opts:n}=e.it;return!1===r?s._`{}`:(n.jtd&&!n.ajvErrors?l:u)(e,t)}function l(e,{message:t}){const{gen:r,keyword:o,it:a}=e,{errorPath:c,errSchemaPath:l,opts:u}=a,d=[[i.instancePath,s.strConcat(n.default.dataPath,c)],[i.schemaPath,s.str`${l}/${o}`]];return u.messages&&d.push([i.message,"function"==typeof t?t(e):t]),r.object(...d)}function u(e,t){const{gen:r,keyword:o,data:a,schemaValue:c,it:l}=e,{topSchemaRef:u,schemaPath:d,errorPath:p,errSchemaPath:h,propertyName:f,opts:m}=l,{params:g,message:y}=t,v=[[i.keyword,o],[n.default.dataPath,s.strConcat(n.default.dataPath,p)],[i.schemaPath,s.str`${h}/${o}`],[i.params,"function"==typeof g?g(e):g||s._`{}`]];return f&&v.push([i.propertyName,f]),m.messages&&v.push([i.message,"function"==typeof y?y(e):y]),m.verbose&&v.push([i.schema,c],[i.parentSchema,s._`${u}${d}`],[n.default.data,a]),r.object(...v)}},5173:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;const s=r(3487),n=r(8727),o=r(2141),a=r(2531),i=r(6776),c=r(4815),l=r(540);class u{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.root=e.root||this,this.baseId=null!==(t=e.baseId)&&void 0!==t?t:a.normalizeId(null==r?void 0:r.$id),this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}}function d(e){const t=h.call(this,e);if(t)return t;const r=a.getFullPath(e.root.baseId),{es5:i,lines:l}=this.opts.code,{ownProperties:u}=this.opts,d=new s.CodeGen(this.scope,{es5:i,lines:l,ownProperties:u});let p;e.$async&&(p=d.scopeValue("Error",{ref:n.ValidationError,code:s._`require("ajv/dist/compile/error_classes").ValidationError`}));const f=d.scopeName("validate");e.validateName=f;const m={gen:d,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:d.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:s.stringify(e.schema)}:{ref:e.schema}),validateName:f,ValidationError:p,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:s.nil,errSchemaPath:this.opts.jtd?"":"#",errorPath:s._`""`,opts:this.opts,self:this};let g;try{this._compilations.add(e),c.validateFunctionCode(m),d.optimize(this.opts.code.optimize);const t=d.toString();g=`${d.scopeRefs(o.default.scope)}return ${t}`,this.opts.code.process&&(g=this.opts.code.process(g,e));const r=new Function(`${o.default.self}`,`${o.default.scope}`,g)(this,this.scope.get());if(this.scope.value(f,{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:f,validateCode:t,scopeValues:d._values}),this.opts.unevaluated){const{props:e,items:t}=m;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=s.stringify(r.evaluated))}return e.validate=r,e}catch(t){throw delete e.validate,delete e.validateName,g&&this.logger.error("Error compiling schema, function code:",g),t}finally{this._compilations.delete(e)}}function p(e){return a.inlineRef(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:d.call(this,e)}function h(e){for(const s of this._compilations)if(r=e,(t=s).schema===r.schema&&t.root===r.root&&t.baseId===r.baseId)return s;var t,r}function f(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||m.call(this,e,t)}function m(e,t){const r=l.parse(t),s=a._getFullPath(r);let n=a.getFullPath(e.baseId);if(Object.keys(e.schema).length>0&&s===n)return y.call(this,r,e);const o=a.normalizeId(s),i=this.refs[o]||this.schemas[o];if("string"==typeof i){const t=m.call(this,e,i);if("object"!=typeof(null==t?void 0:t.schema))return;return y.call(this,r,t)}if("object"==typeof(null==i?void 0:i.schema)){if(i.validate||d.call(this,i),o===a.normalizeId(t)){const{schema:t}=i;return t.$id&&(n=a.resolveUrl(n,t.$id)),new u({schema:t,root:e,baseId:n})}return y.call(this,r,i)}}t.SchemaEnv=u,t.compileSchema=d,t.resolveRef=function(e,t,r){var s;r=a.resolveUrl(t,r);const n=e.refs[r];if(n)return n;let o=f.call(this,e,r);if(void 0===o){const n=null===(s=e.localRefs)||void 0===s?void 0:s[r];n&&(o=new u({schema:n,root:e,baseId:t}))}return void 0!==o?e.refs[r]=p.call(this,o):void 0},t.getCompilingSchema=h,t.resolveSchema=m;const g=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function y(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;if(void 0===(r=r[i.unescapeFragment(s)]))return;!g.has(s)&&"object"==typeof r&&r.$id&&(t=a.resolveUrl(t,r.$id))}let o;if("boolean"!=typeof r&&r.$ref&&!i.schemaHasRulesButRef(r,this.RULES)){const e=a.resolveUrl(t,r.$ref);o=m.call(this,s,e)}return o=o||new u({schema:r,root:s,baseId:t}),o.schema!==o.root.schema?o:void 0}},2141:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=r(3487),n={data:new s.Name("data"),valCxt:new s.Name("valCxt"),dataPath:new s.Name("dataPath"),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},2531:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;const s=r(6776),n=r(4063),o=r(9461),a=r(540),i=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?!l(e):!!t&&u(e)<=t)};const c=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function l(e){for(const t in e){if(c.has(t))return!0;const r=e[t];if(Array.isArray(r)&&r.some(l))return!0;if("object"==typeof r&&l(r))return!0}return!1}function u(e){let t=0;for(const r in e){if("$ref"===r)return 1/0;if(t++,!i.has(r)&&("object"==typeof e[r]&&s.eachItem(e[r],(e=>t+=u(e))),t===1/0))return 1/0}return t}function d(e="",t){return!1!==t&&(e=f(e)),p(a.parse(e))}function p(e){return a.serialize(e).split("#")[0]+"#"}t.getFullPath=d,t._getFullPath=p;const h=/#\/?$/;function f(e){return e?e.replace(h,""):""}t.normalizeId=f,t.resolveUrl=function(e,t){return t=f(t),a.resolve(e,t)};const m=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(e){if("boolean"==typeof e)return{};const t=f(e.$id),r={"":t},s=d(t,!1),i={},c=new Set;return o(e,{allKeys:!0},((e,t,n,o)=>{if(void 0===o)return;const d=s+t;let p=r[o];function h(t){if(t=f(p?a.resolve(p,t):t),c.has(t))throw u(t);c.add(t);let r=this.refs[t];return"string"==typeof r&&(r=this.refs[r]),"object"==typeof r?l(e,r.schema,t):t!==f(d)&&("#"===t[0]?(l(e,i[t],t),i[t]=e):this.refs[t]=d),t}function g(e){if("string"==typeof e){if(!m.test(e))throw new Error(`invalid anchor "${e}"`);h.call(this,`#${e}`)}}"string"==typeof e.$id&&(p=h.call(this,e.$id)),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),r[t]=p})),i;function l(e,t,r){if(void 0!==t&&!n(e,t))throw u(r)}function u(e){return new Error(`reference "${e}" resolves to more than one schema`)}}},3141:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),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:{}}}},4069:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.applySubschema=t.Type=void 0;const s=r(4815),n=r(6776),o=r(3487);var a;!function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(a=t.Type||(t.Type={})),t.applySubschema=function(e,t,r){const i=function(e,{keyword:t,schemaProp:r,schema:s,schemaPath:a,errSchemaPath:i,topSchemaRef:c}){if(void 0!==t&&void 0!==s)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==t){const s=e.schema[t];return void 0===r?{schema:s,schemaPath:o._`${e.schemaPath}${o.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[r],schemaPath:o._`${e.schemaPath}${o.getProperty(t)}${o.getProperty(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${n.escapeFragment(r)}`}}if(void 0!==s){if(void 0===a||void 0===i||void 0===c)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:s,schemaPath:a,topSchemaRef:c,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}(e,t);!function(e,t,{dataProp:r,dataPropType:s,data:i,dataTypes:c,propertyName:l}){if(void 0!==i&&void 0!==r)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:u}=t;if(void 0!==r){const{errorPath:i,dataPathArr:c,opts:l}=t;d(u.let("data",o._`${t.data}${o.getProperty(r)}`,!0)),e.errorPath=o.str`${i}${function(e,t,r){if(e instanceof o.Name){const s=t===a.Num;return r?s?o._`"[" + ${e} + "]"`:o._`"['" + ${e} + "']"`:s?o._`"/" + ${e}`:o._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?o.getProperty(e).toString():"/"+n.escapeJsonPointer(e)}(r,s,l.jsPropertySyntax)}`,e.parentDataProperty=o._`${r}`,e.dataPathArr=[...c,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!==i&&(d(i instanceof o.Name?i:u.let("data",i,!0)),void 0!==l&&(e.propertyName=l)),c&&(e.dataTypes=c)}(i,e,t),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}(i,t);const c={...e,...i,items:void 0,props:void 0};return s.subschemaCode(c,r),c}},4776:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(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}},6776:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.func=t.setEvaluated=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.schemaHasRules=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;const s=r(3487),n=r(4815);function o(e,t=e.schema){const{opts:r,self:s}=e;if(!r.strict)return;if("boolean"==typeof t)return;const o=s.RULES.keywords;for(const r in t)o[r]||n.checkStrictMode(e,`unknown keyword: "${r}"`)}function a(e,t){if("boolean"==typeof e)return!e;for(const r in e)if(t[r])return!0;return!1}function i(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function c(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function l({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 u(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}${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),!a(t,e.self.RULES.all))},t.checkUnknownRules=o,t.schemaHasRules=a,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}${s.getProperty(n)}`},t.unescapeFragment=function(e){return c(decodeURIComponent(e))},t.escapeFragment=function(e){return encodeURIComponent(i(e))},t.escapeJsonPointer=i,t.unescapeJsonPointer=c,t.eachItem=function(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)},t.mergeEvaluated={props:l({mergeNames:(e,t,r)=>e.if(s._`${r} !== true && ${t} !== undefined`,(()=>{e.if(s._`${t} === true`,(()=>e.assign(r,!0)),(()=>e.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:u}),items:l({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=u,t.setEvaluated=d,t.func=function(e,t){return e.scopeValue("func",{ref:t,code:t.code})}},8876:(e,t)=>{"use strict";function r(e,t){return t.rules.some((t=>s(e,t)))}function s(e,t){var r;return void 0!==e[t.keyword]||(null===(r=t.definition.implements)||void 0===r?void 0:r.some((t=>void 0!==e[t])))}Object.defineProperty(t,"__esModule",{value:!0}),t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0,t.schemaHasRulesForType=function({schema:e,self:t},s){const n=t.RULES.types[s];return n&&!0!==n&&r(e,n)},t.shouldUseGroup=r,t.shouldUseRule=s},5667:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;const s=r(4181),n=r(3487),o=r(2141),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};s.reportError(o,a,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)}},453:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;const s=r(3141),n=r(8876),o=r(4181),a=r(3487),i=r(6776);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||(t.DataType={})),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=>u.has(e)||"array"===t&&"array"===e)):[]}(t,o.coerceTypes),l=t.length>0&&!(0===i.length&&1===t.length&&n.schemaHasRulesForType(e,t[0]));if(l){const n=p(t,s,o.strict,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(p(t,n,o.strict),(()=>s.assign(c,n))))),s.if(a._`${c} !== undefined`);for(const e of r)(u.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
|| (${i} == "string" && ${n} && ${n} == +${n})`).assign(c,a._`+${n}`);case"integer":return void s.elseIf(a._`${i} === "boolean" || ${n} === null
|| (${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"
|| ${i} === "boolean" || ${n} === null`).assign(c,a._`[${n}]`)}}s.else(),f(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):f(e)}))}return l};const u=new Set(["string","number","integer","boolean","null"]);function d(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:a.not(o);function i(e=a.nil){return a.and(a._`typeof ${t} == "number"`,e,r?a._`isFinite(${t})`:a.nil)}}function p(e,t,r,s){if(1===e.length)return d(e[0],t,r,s);let n;const o=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=a.and(n,d(e,t,r,s));return n}t.checkDataType=d,t.checkDataTypes=p;const h={message:({schema:e})=>a.str`should be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?a._`{type: ${e}}`:a._`{type: ${t}}`};function f(e){const t=function(e){const{gen:t,data:r,schema:s}=e,n=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);o.reportError(t,h)}t.reportTypeError=f},313:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;const s=r(3487),n=r(4815);function o(e,t,r){const{gen:o,compositeRule:a,data:i,opts:c}=e;if(void 0===r)return;const l=s._`${i}${s.getProperty(t)}`;if(a)return void n.checkStrictMode(e,`default is ignored for: ${l}`);let u=s._`${l} === undefined`;"empty"===c.useDefaults&&(u=s._`${u} || ${l} === null || ${l} === ""`),o.if(u,s._`${l} = ${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)))}},4815:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.checkStrictMode=t.schemaCxtHasRules=t.subschemaCode=t.validateFunctionCode=void 0;const s=r(5667),n=r(453),o=r(7449),a=r(3487),i=r(2141),c=r(2531),l=r(6776);function u({gen:e,validateName:t,schema:r,schemaEnv:s,opts:n},o){n.code.es5?e.func(t,a._`${i.default.data}, ${i.default.valCxt}`,s.$async,(()=>{e.code(a._`"use strict"; ${d(r,n)}`),function(e,t){e.if(i.default.valCxt,(()=>{e.var(i.default.dataPath,a._`${i.default.valCxt}.${i.default.dataPath}`),e.var(i.default.parentData,a._`${i.default.valCxt}.${i.default.parentData}`),e.var(i.default.parentDataProperty,a._`${i.default.valCxt}.${i.default.parentDataProperty}`),e.var(i.default.rootData,a._`${i.default.valCxt}.${i.default.rootData}`),t.dynamicRef&&e.var(i.default.dynamicAnchors,a._`${i.default.valCxt}.${i.default.dynamicAnchors}`)}),(()=>{e.var(i.default.dataPath,a._`""`),e.var(i.default.parentData,a._`undefined`),e.var(i.default.parentDataProperty,a._`undefined`),e.var(i.default.rootData,i.default.data),t.dynamicRef&&e.var(i.default.dynamicAnchors,a._`{}`)}))}(e,n),e.code(o)})):e.func(t,a._`${i.default.data}, ${function(e){return a._`{${i.default.dataPath}="", ${i.default.parentData}, ${i.default.parentDataProperty}, ${i.default.rootData}=${i.default.data}${e.dynamicRef?a._`, ${i.default.dynamicAnchors}={}`:a.nil}}={}`}(n)}`,s.$async,(()=>e.code(d(r,n)).code(o)))}function d(e,t){return"object"==typeof e&&e.$id&&(t.code.source||t.code.process)?a._`/*# sourceURL=${e.$id} */`:a.nil}function p({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 h(e){return"boolean"!=typeof e.schema}function f(e){l.checkUnknownRules(e),function(e){const{schema:t,errSchemaPath:r,opts:s,self:n}=e;t.$ref&&s.ignoreKeywordsWithRef&&l.schemaHasRulesButRef(t,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function m(e,t){if(e.opts.jtd)return o.schemaKeywords(e,[],!1,t);const r=n.getSchemaTypes(e.schema),s=n.coerceAndCheckDataType(e,r);o.schemaKeywords(e,r,!s,t)}function g({gen:e,schemaEnv:t,schema:r,errSchemaPath:s,opts:n}){const o=r.$comment;if(!0===n.$comment)e.code(a._`${i.default.self}.logger.log(${o})`);else if("function"==typeof n.$comment){const r=a.str`${s}/$comment`,n=e.scopeValue("root",{ref:t.root});e.code(a._`${i.default.self}.opts.$comment(${o}, ${r}, ${n}.schema)`)}}function y(e,t,r=e.opts.strict){if(r){if(t=`strict mode: ${t}`,!0===r)throw new Error(t);e.self.logger.warn(t)}}t.validateFunctionCode=function(e){h(e)&&(f(e),p(e))?function(e){const{schema:t,opts:r,gen:s}=e;u(e,(()=>{r.$comment&&t.$comment&&g(e),function(e){const{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strict&&y(e,"default is ignored in the schema root")}(e),s.let(i.default.vErrors,null),s.let(i.default.errors,0),r.unevaluated&&function(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",a._`${r}.evaluated`),t.if(a._`${e.evaluated}.dynamicProps`,(()=>t.assign(a._`${e.evaluated}.props`,a._`undefined`))),t.if(a._`${e.evaluated}.dynamicItems`,(()=>t.assign(a._`${e.evaluated}.items`,a._`undefined`)))}(e),m(e),function(e){const{gen:t,schemaEnv:r,validateName:s,ValidationError:n,opts:o}=e;r.$async?t.if(a._`${i.default.errors} === 0`,(()=>t.return(i.default.data)),(()=>t.throw(a._`new ${n}(${i.default.vErrors})`))):(t.assign(a._`${s}.errors`,i.default.vErrors),o.unevaluated&&function({gen:e,evaluated:t,props:r,items:s}){r instanceof a.Name&&e.assign(a._`${t}.props`,r),s instanceof a.Name&&e.assign(a._`${t}.items`,s)}(e),t.return(a._`${i.default.errors} === 0`))}(e)}))}(e):u(e,(()=>s.topBoolOrEmptySchema(e)))},t.subschemaCode=function(e,t){h(e)&&(f(e),p(e))?function(e,t){const{schema:r,gen:s,opts:n}=e;n.$comment&&r.$comment&&g(e),function(e){e.schema.$id&&(e.baseId=c.resolveUrl(e.baseId,e.schema.$id))}(e),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}(e);const o=s.const("_errs",i.default.errors);m(e,o),s.var(t,a._`${o} === ${i.default.errors}`)}(e,t):s.boolOrEmptySchema(e,t)},t.schemaCxtHasRules=p,t.checkStrictMode=y},7449:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.schemaKeywords=void 0;const s=r(8876),n=r(453),o=r(313),a=r(5005),i=r(6776),c=r(4815),l=r(3487),u=r(2141);function d(e,t){const{gen:r,schema:n,opts:{useDefaults:i}}=e;i&&o.assignDefaults(e,t.type),r.block((()=>{for(const r of t.rules)s.shouldUseRule(n,r)&&a.keywordCode(e,r.keyword,r.definition,t.type)}))}function p(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function h(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,c.checkStrictMode(e,t,e.opts.strictTypes)}t.schemaKeywords=function(e,t,r,o){const{gen:c,schema:f,data:m,allErrors:g,opts:y,self:v}=e,{RULES:$}=v;function w(a){s.shouldUseGroup(f,a)&&(a.type?(c.if(n.checkDataType(a.type,m,y.strict)),d(e,a),1===t.length&&t[0]===a.type&&r&&(c.else(),n.reportTypeError(e)),c.endIf()):d(e,a),g||c.if(l._`${u.default.errors} === ${o||0}`))}!f.$ref||!y.ignoreKeywordsWithRef&&i.schemaHasRulesButRef(f,$)?(y.jtd||function(e,t){!e.schemaEnv.meta&&e.opts.strictTypes&&(function(e,t){t.length&&(e.dataTypes.length?(t.forEach((t=>{p(e.dataTypes,t)||h(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)})),e.dataTypes=e.dataTypes.filter((e=>p(t,e)))):e.dataTypes=t)}(e,t),e.opts.allowUnionTypes||function(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&h(e,"use allowUnionTypes to allow union type keyword")}(e,t),function(e,t){const r=e.self.RULES.all;for(const n in r){const o=r[n];if("object"==typeof o&&s.shouldUseRule(e.schema,o)){const{type:r}=o.definition;r.length&&!r.some((e=>{return s=e,(r=t).includes(s)||"number"===s&&r.includes("integer");var r,s}))&&h(e,`missing type "${r.join(",")}" for keyword "${n}"`)}}}(e,e.dataTypes))}(e,t),c.block((()=>{for(const e of $.rules)w(e);w($.post)}))):c.block((()=>a.keywordCode(e,"$ref",$.all.$ref.definition)))}},5005:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.keywordCode=void 0;const s=r(2227),n=r(4181),o=r(412),a=r(3487),i=r(2141);function c(e,t){var r;const{gen:s,keyword:c,schema:d,parentSchema:p,$data:h,it:f}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}(f,t);const m=!h&&t.compile?t.compile.call(f.self,d,p,f):t.validate,g=u(s,c,m),y=s.let("valid");function v(r=(t.async?a._`await `:a.nil)){const n=f.opts.passContext?i.default.this:i.default.self,c=!("compile"in t&&!h||!