const n = null === (r = e.localRefs) || void 0 === r ? void 0 : r[o], { schemaId: i } = this.opts; n && (s = new u({ schema: n, schemaId: i, root: e, baseId: t })); } if (void 0 === s && this.opts.loadSchemaSync) { const r = this.opts.loadSchemaSync(t, n, o); !r || this.refs[o] || this.schemas[o] || (this.addSchema(r, o, void 0), (s = h.call(this, e, o))); } return void 0 !== s ? (e.refs[o] = d.call(this, s)) : void 0; }), (t.getCompilingSchema = f), (t.resolveSchema = m); const g = new Set([ 'properties', 'patternProperties', 'enum', 'dependencies', 'definitions' ]); function y(e, { baseId: t, schema: n, root: r }) { var o; if ( '/' !== (null === (o = e.fragment) || void 0 === o ? void 0 : o[0]) ) return; for (const r of e.fragment.slice(1).split('/')) { if ('boolean' == typeof n) return; if (void 0 === (n = n[s.unescapeFragment(r)])) return; const e = 'object' == typeof n && n[this.opts.schemaId]; !g.has(r) && e && (t = a.resolveUrl(t, e)); } let i; if ( 'boolean' != typeof n && n.$ref && !s.schemaHasRulesButRef(n, this.RULES) ) { const e = a.resolveUrl(t, n.$ref); i = m.call(this, r, e); } const { schemaId: l } = this.opts; return ( (i = i || new u({ schema: n, schemaId: l, root: r, baseId: t })), i.schema !== i.root.schema ? i : void 0 ); } }, 5018: function (e, t, n) { 'use strict'; Object.defineProperty(t, '__esModule', { value: !0 }); const r = n(4475), o = { data: new r.Name('data'), valCxt: new r.Name('valCxt'), instancePath: new r.Name('instancePath'), parentData: new r.Name('parentData'), parentDataProperty: new r.Name('parentDataProperty'), rootData: new r.Name('rootData'), dynamicAnchors: new r.Name('dynamicAnchors'), vErrors: new r.Name('vErrors'), errors: new r.Name('errors'), this: new r.Name('this'), self: new r.Name('self'), scope: new r.Name('scope'), json: new r.Name('json'), jsonPos: new r.Name('jsonPos'), jsonLen: new r.Name('jsonLen'), jsonPart: new r.Name('jsonPart') }; t.default = o; }, 4143: function (e, t, n) { 'use strict'; Object.defineProperty(t, '__esModule', { value: !0 }); const r = n(9826); class o extends Error { constructor(e, t, n) { super(n || \`can't resolve reference \${t} from id \${e}\`), (this.missingRef = r.resolveUrl(e, t)), (this.missingSchema = r.normalizeId( r.getFullPath(this.missingRef) )); } } t.default = o; }, 9826: function (e, t, n) { 'use strict'; Object.defineProperty(t, '__esModule', { value: !0 }), (t.getSchemaRefs = t.resolveUrl = t.normalizeId = t._getFullPath = t.getFullPath = t.inlineRef = void 0); const r = n(6124), o = n(4063), i = n(4029), a = n(540), s = 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 && u(e) <= t) ); }; const l = new Set([ '$ref', '$recursiveRef', '$recursiveAnchor', '$dynamicRef', '$dynamicAnchor' ]); function c(e) { for (const t in e) { if (l.has(t)) return !0; const n = e[t]; if (Array.isArray(n) && n.some(c)) return !0; if ('object' == typeof n && c(n)) return !0; } return !1; } function u(e) { let t = 0; for (const n in e) { if ('$ref' === n) return 1 / 0; if ( (t++, !s.has(n) && ('object' == typeof e[n] && r.eachItem(e[n], e => (t += u(e))), t === 1 / 0)) ) return 1 / 0; } return t; } function p(e = '', t) { return !1 !== t && (e = h(e)), d(a.parse(e)); } function d(e) { return a.serialize(e).split('#')[0] + '#'; } (t.getFullPath = p), (t._getFullPath = d); const f = /#\\/?$/; function h(e) { return e ? e.replace(f, '') : ''; } (t.normalizeId = h), (t.resolveUrl = function (e, t) { return (t = h(t)), a.resolve(e, t); }); const m = /^[a-z_][-a-z0-9._]*$/i; t.getSchemaRefs = function (e) { if ('boolean' == typeof e) return {}; const { schemaId: t } = this.opts, n = h(e[t]), r = { '': n }, s = p(n, !1), l = {}, c = new Set(); return ( i(e, { allKeys: !0 }, (e, n, o, i) => { if (void 0 === i) return; const p = s + n; let f = r[i]; function g(t) { if (((t = h(f ? a.resolve(f, t) : t)), c.has(t))) throw d(t); c.add(t); let n = this.refs[t]; return ( 'string' == typeof n && (n = this.refs[n]), 'object' == typeof n ? u(e, n.schema, t) : t !== h(p) && ('#' === t[0] ? (u(e, l[t], t), (l[t] = e)) : (this.refs[t] = p)), t ); } function y(e) { if ('string' == typeof e) { if (!m.test(e)) throw new Error(\`invalid anchor "\${e}"\`); g.call(this, \`#\${e}\`); } } 'string' == typeof e[t] && (f = g.call(this, e[t])), y.call(this, e.$anchor), y.call(this, e.$dynamicAnchor), (r[n] = f); }), l ); function u(e, t, n) { if (void 0 !== t && !o(e, t)) throw d(n); } function d(e) { return new Error( \`reference "\${e}" resolves to more than one schema\` ); } }; }, 3664: function (e, t) { 'use strict'; Object.defineProperty(t, '__esModule', { value: !0 }), (t.getRules = t.isJSONType = void 0); const n = new Set([ 'string', 'number', 'integer', 'boolean', 'null', 'object', 'array' ]); (t.isJSONType = function (e) { return 'string' == typeof e && n.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: {} }; }); }, 6124: function (e, t, n) { 'use strict'; Object.defineProperty(t, '__esModule', { value: !0 }), (t.checkStrictMode = t.getErrorPath = t.Type = t.useFunc = t.setEvaluated = t.evaluatedPropsToName = t.mergeEvaluated = t.eachItem = t.unescapeJsonPointer = t.escapeJsonPointer = t.escapeFragment = t.unescapeFragment = t.schemaRefOrVal = t.schemaHasRulesButRef = t.schemaHasRules = t.checkUnknownRules = t.alwaysValidSchema = t.toHash = void 0); const r = n(4475), o = n(4667); function i(e, t = e.schema) { const { opts: n, self: r } = e; if (!n.strictSchema) return; if ('boolean' == typeof t) return; const o = r.RULES.keywords; for (const n in t) o[n] || h(e, \`unknown keyword: "\${n}"\`); } function a(e, t) { if ('boolean' == typeof e) return !e; for (const n in e) if (t[n]) return !0; return !1; } function s(e) { return 'number' == typeof e ? \`\${e}\` : e.replace(/~/g, '~0').replace(/\\//g, '~1'); } function l(e) { return e.replace(/~1/g, '/').replace(/~0/g, '~'); } function c({ mergeNames: e, mergeToName: t, mergeValues: n, resultToName: o }) { return (i, a, s, l) => { const c = void 0 === s ? a : s instanceof r.Name ? (a instanceof r.Name ? e(i, a, s) : t(i, a, s), s) : a instanceof r.Name ? (t(i, s, a), a) : n(a, s); return l !== r.Name || c instanceof r.Name ? c : o(i, c); }; } function u(e, t) { if (!0 === t) return e.var('props', !0); const n = e.var('props', r._\`{}\`); return void 0 !== t && p(e, n, t), n; } function p(e, t, n) { Object.keys(n).forEach(n => e.assign(r._\`\${t}\${r.getProperty(n)}\`, !0) ); } (t.toHash = function (e) { const t = {}; for (const n of e) t[n] = !0; return t; }), (t.alwaysValidSchema = function (e, t) { return 'boolean' == typeof t ? t : 0 === Object.keys(t).length || (i(e, t), !a(t, e.self.RULES.all)); }), (t.checkUnknownRules = i), (t.schemaHasRules = a), (t.schemaHasRulesButRef = function (e, t) { if ('boolean' == typeof e) return !e; for (const n in e) if ('$ref' !== n && t.all[n]) return !0; return !1; }), (t.schemaRefOrVal = function ( { topSchemaRef: e, schemaPath: t }, n, o, i ) { if (!i) { if ('number' == typeof n || 'boolean' == typeof n) return n; if ('string' == typeof n) return r._\`\${n}\`; } return r._\`\${e}\${t}\${r.getProperty(o)}\`; }), (t.unescapeFragment = function (e) { return l(decodeURIComponent(e)); }), (t.escapeFragment = function (e) { return encodeURIComponent(s(e)); }), (t.escapeJsonPointer = s), (t.unescapeJsonPointer = l), (t.eachItem = function (e, t) { if (Array.isArray(e)) for (const n of e) t(n); else t(e); }), (t.mergeEvaluated = { props: c({ mergeNames: (e, t, n) => e.if(r._\`\${n} !== true && \${t} !== undefined\`, () => { e.if( r._\`\${t} === true\`, () => e.assign(n, !0), () => e .assign(n, r._\`\${n} || {}\`) .code(r._\`Object.assign(\${n}, \${t})\`) ); }), mergeToName: (e, t, n) => e.if(r._\`\${n} !== true\`, () => { !0 === t ? e.assign(n, !0) : (e.assign(n, r._\`\${n} || {}\`), p(e, n, t)); }), mergeValues: (e, t) => !0 === e || { ...e, ...t }, resultToName: u }), items: c({ mergeNames: (e, t, n) => e.if(r._\`\${n} !== true && \${t} !== undefined\`, () => e.assign( n, r._\`\${t} === true ? true : \${n} > \${t} ? \${n} : \${t}\` ) ), mergeToName: (e, t, n) => e.if(r._\`\${n} !== true\`, () => e.assign(n, !0 === t || r._\`\${n} > \${t} ? \${n} : \${t}\`) ), mergeValues: (e, t) => !0 === e || Math.max(e, t), resultToName: (e, t) => e.var('items', t) }) }), (t.evaluatedPropsToName = u), (t.setEvaluated = p); const d = {}; var f; function h(e, t, n = e.opts.strictSchema) { if (n) { if (((t = \`strict mode: \${t}\`), !0 === n)) throw new Error(t); e.self.logger.warn(t); } } (t.useFunc = function (e, t) { return e.scopeValue('func', { ref: t, code: d[t.code] || (d[t.code] = new o._Code(t.code)) }); }), (function (e) { (e[(e.Num = 0)] = 'Num'), (e[(e.Str = 1)] = 'Str'); })((f = t.Type || (t.Type = {}))), (t.getErrorPath = function (e, t, n) { if (e instanceof r.Name) { const o = t === f.Num; return n ? o ? r._\`"[" + \${e} + "]"\` : r._\`"['" + \${e} + "']"\` : o ? r._\`"/" + \${e}\` : r._\`"/" + \${e}.replace(/~/g, "~0").replace(/\\\\//g, "~1")\`; } return n ? r.getProperty(e).toString() : '/' + s(e); }), (t.checkStrictMode = h); }, 4566: function (e, t) { 'use strict'; function n(e, t) { return t.rules.some(t => r(e, t)); } function r(e, t) { var n; return ( void 0 !== e[t.keyword] || (null === (n = t.definition.implements) || void 0 === n ? void 0 : n.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 }, r) { const o = t.RULES.types[r]; return o && !0 !== o && n(e, o); }), (t.shouldUseGroup = n), (t.shouldUseRule = r); }, 7627: function (e, t, n) { 'use strict'; Object.defineProperty(t, '__esModule', { value: !0 }), (t.boolOrEmptySchema = t.topBoolOrEmptySchema = void 0); const r = n(1885), o = n(4475), i = n(5018), a = { message: 'boolean schema is false' }; function s(e, t) { const { gen: n, data: o } = e, i = { gen: n, keyword: 'false schema', data: o, schema: !1, schemaCode: !1, schemaValue: !1, params: {}, it: e }; r.reportError(i, a, void 0, t); } (t.topBoolOrEmptySchema = function (e) { const { gen: t, schema: n, validateName: r } = e; !1 === n ? s(e, !1) : 'object' == typeof n && !0 === n.$async ? t.return(i.default.data) : (t.assign(o._\`\${r}.errors\`, null), t.return(!0)); }), (t.boolOrEmptySchema = function (e, t) { const { gen: n, schema: r } = e; !1 === r ? (n.var(t, !1), s(e)) : n.var(t, !0); }); }, 7927: function (e, t, n) { '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 r = n(3664), o = n(4566), i = n(1885), a = n(4475), s = n(6124); var l; function c(e) { const t = Array.isArray(e) ? e : e ? [e] : []; if (t.every(r.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'); })((l = t.DataType || (t.DataType = {}))), (t.getSchemaTypes = function (e) { const t = c(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 = c), (t.coerceAndCheckDataType = function (e, t) { const { gen: n, data: r, opts: i } = e, s = (function (e, t) { return t ? e.filter( e => u.has(e) || ('array' === t && 'array' === e) ) : []; })(t, i.coerceTypes), c = t.length > 0 && !( 0 === s.length && 1 === t.length && o.schemaHasRulesForType(e, t[0]) ); if (c) { const o = d(t, r, i.strictNumbers, l.Wrong); n.if(o, () => { s.length ? (function (e, t, n) { const { gen: r, data: o, opts: i } = e, s = r.let('dataType', a._\`typeof \${o}\`), l = r.let('coerced', a._\`undefined\`); 'array' === i.coerceTypes && r.if( a._\`\${s} == 'object' && Array.isArray(\${o}) && \${o}.length == 1\`, () => r .assign(o, a._\`\${o}[0]\`) .assign(s, a._\`typeof \${o}\`) .if(d(t, o, i.strictNumbers), () => r.assign(l, o) ) ), r.if(a._\`\${l} !== undefined\`); for (const e of n) (u.has(e) || ('array' === e && 'array' === i.coerceTypes)) && c(e); function c(e) { switch (e) { case 'string': return void r .elseIf( a._\`\${s} == "number" || \${s} == "boolean"\` ) .assign(l, a._\`"" + \${o}\`) .elseIf(a._\`\${o} === null\`) .assign(l, a._\`""\`); case 'number': return void r .elseIf( a._\`\${s} == "boolean" || \${o} === null || (\${s} == "string" && \${o} && \${o} == +\${o})\` ) .assign(l, a._\`+\${o}\`); case 'integer': return void r .elseIf( a._\`\${s} === "boolean" || \${o} === null || (\${s} === "string" && \${o} && \${o} == +\${o} && !(\${o} % 1))\` ) .assign(l, a._\`+\${o}\`); case 'boolean': return void r .elseIf( a._\`\${o} === "false" || \${o} === 0 || \${o} === null\` ) .assign(l, !1) .elseIf(a._\`\${o} === "true" || \${o} === 1\`) .assign(l, !0); case 'null': return ( r.elseIf( a._\`\${o} === "" || \${o} === 0 || \${o} === false\` ), void r.assign(l, null) ); case 'array': r.elseIf( a._\`\${s} === "string" || \${s} === "number" || \${s} === "boolean" || \${o} === null\` ).assign(l, a._\`[\${o}]\`); } } r.else(), h(e), r.endIf(), r.if(a._\`\${l} !== undefined\`, () => { r.assign(o, l), (function ( { gen: e, parentData: t, parentDataProperty: n }, r ) { e.if(a._\`\${t} !== undefined\`, () => e.assign(a._\`\${t}[\${n}]\`, r) ); })(e, l); }); })(e, t, s) : h(e); }); } return c; }); const u = new Set(['string', 'number', 'integer', 'boolean', 'null']); function p(e, t, n, r = l.Correct) { const o = r === l.Correct ? a.operators.EQ : a.operators.NEQ; let i; switch (e) { case 'null': return a._\`\${t} \${o} null\`; case 'array': i = a._\`Array.isArray(\${t})\`; break; case 'object': i = a._\`\${t} && typeof \${t} == "object" && !Array.isArray(\${t})\`; break; case 'integer': i = s(a._\`!(\${t} % 1) && !isNaN(\${t})\`); break; case 'number': i = s(); break; default: return a._\`typeof \${t} \${o} \${e}\`; } return r === l.Correct ? i : a.not(i); function s(e = a.nil) { return a.and( a._\`typeof \${t} == "number"\`, e, n ? a._\`isFinite(\${t})\` : a.nil ); } } function d(e, t, n, r) { if (1 === e.length) return p(e[0], t, n, r); let o; const i = s.toHash(e); if (i.array && i.object) { const e = a._\`typeof \${t} != "object"\`; (o = i.null ? e : a._\`!\${t} || \${e}\`), delete i.null, delete i.array, delete i.object; } else o = a.nil; i.number && delete i.integer; for (const e in i) o = a.and(o, p(e, t, n, r)); return o; } (t.checkDataType = p), (t.checkDataTypes = d); const f = { message: ({ schema: e }) => \`must be \${e}\`, params: ({ schema: e, schemaValue: t }) => 'string' == typeof e ? a._\`{type: \${e}}\` : a._\`{type: \${t}}\` }; function h(e) { const t = (function (e) { const { gen: t, data: n, schema: r } = e, o = s.schemaRefOrVal(e, r, 'type'); return { gen: t, keyword: 'type', data: n, schema: r.type, schemaCode: o, schemaValue: o, parentSchema: r, params: {}, it: e }; })(e); i.reportError(t, f); } t.reportTypeError = h; }, 2537: function (e, t, n) { 'use strict'; Object.defineProperty(t, '__esModule', { value: !0 }), (t.assignDefaults = void 0); const r = n(4475), o = n(6124); function i(e, t, n) { const { gen: i, compositeRule: a, data: s, opts: l } = e; if (void 0 === n) return; const c = r._\`\${s}\${r.getProperty(t)}\`; if (a) return void o.checkStrictMode(e, \`default is ignored for: \${c}\`); let u = r._\`\${c} === undefined\`; 'empty' === l.useDefaults && (u = r._\`\${u} || \${c} === null || \${c} === ""\`), i.if(u, r._\`\${c} = \${r.stringify(n)}\`); } t.assignDefaults = function (e, t) { const { properties: n, items: r } = e.schema; if ('object' === t && n) for (const t in n) i(e, t, n[t].default); else 'array' === t && Array.isArray(r) && r.forEach((t, n) => i(e, n, t.default)); }; }, 1321: function (e, t, n) { 'use strict'; Object.defineProperty(t, '__esModule', { value: !0 }), (t.getData = t.KeywordCxt = t.validateFunctionCode = void 0); const r = n(7627), o = n(7927), i = n(4566), a = n(7927), s = n(2537), l = n(6488), c = n(4688), u = n(4475), p = n(5018), d = n(9826), f = n(6124), h = n(1885); function m( { gen: e, validateName: t, schema: n, schemaEnv: r, opts: o }, i ) { o.code.es5 ? e.func( t, u._\`\${p.default.data}, \${p.default.valCxt}\`, r.$async, () => { e.code(u._\`"use strict"; \${g(n, o)}\`), (function (e, t) { e.if( p.default.valCxt, () => { e.var( p.default.instancePath, u._\`\${p.default.valCxt}.\${p.default.instancePath}\` ), e.var( p.default.parentData, u._\`\${p.default.valCxt}.\${p.default.parentData}\` ), e.var( p.default.parentDataProperty, u._\`\${p.default.valCxt}.\${p.default.parentDataProperty}\` ), e.var( p.default.rootData, u._\`\${p.default.valCxt}.\${p.default.rootData}\` ), t.dynamicRef && e.var( p.default.dynamicAnchors, u._\`\${p.default.valCxt}.\${p.default.dynamicAnchors}\` ); }, () => { e.var(p.default.instancePath, u._\`""\`), e.var(p.default.parentData, u._\`undefined\`), e.var( p.default.parentDataProperty, u._\`undefined\` ), e.var(p.default.rootData, p.default.data), t.dynamicRef && e.var(p.default.dynamicAnchors, u._\`{}\`); } ); })(e, o), e.code(i); } ) : e.func( t, u._\`\${p.default.data}, \${(function (e) { return u._\`{\${p.default.instancePath}="", \${ p.default.parentData }, \${p.default.parentDataProperty}, \${p.default.rootData}=\${ p.default.data }\${ e.dynamicRef ? u._\`, \${p.default.dynamicAnchors}={}\` : u.nil }}={}\`; })(o)}\`, r.$async, () => e.code(g(n, o)).code(i) ); } function g(e, t) { const n = 'object' == typeof e && e[t.schemaId]; return n && (t.code.source || t.code.process) ? u._\`/*# sourceURL=\${n} */\` : u.nil; } function y({ schema: e, self: t }) { if ('boolean' == typeof e) return !e; for (const n in e) if (t.RULES.all[n]) return !0; return !1; } function v(e) { return 'boolean' != typeof e.schema; } function b(e) { f.checkUnknownRules(e), (function (e) { const { schema: t, errSchemaPath: n, opts: r, self: o } = e; t.$ref && r.ignoreKeywordsWithRef && f.schemaHasRulesButRef(t, o.RULES) && o.logger.warn( \`$ref: keywords ignored in schema at path "\${n}"\` ); })(e); } function w(e, t) { if (e.opts.jtd) return k(e, [], !1, t); const n = o.getSchemaTypes(e.schema); k(e, n, !o.coerceAndCheckDataType(e, n), t); } function x({ gen: e, schemaEnv: t, schema: n, errSchemaPath: r, opts: o }) { const i = n.$comment; if (!0 === o.$comment) e.code(u._\`\${p.default.self}.logger.log(\${i})\`); else if ('function' == typeof o.$comment) { const n = u.str\`\${r}/$comment\`, o = e.scopeValue('root', { ref: t.root }); e.code( u._\`\${p.default.self}.opts.$comment(\${i}, \${n}, \${o}.schema)\` ); } } function k(e, t, n, r) { const { gen: o, schema: s, data: l, allErrors: c, opts: d, self: h } = e, { RULES: m } = h; function g(f) { i.shouldUseGroup(s, f) && (f.type ? (o.if(a.checkDataType(f.type, l, d.strictNumbers)), _(e, f), 1 === t.length && t[0] === f.type && n && (o.else(), a.reportTypeError(e)), o.endIf()) : _(e, f), c || o.if(u._\`\${p.default.errors} === \${r || 0}\`)); } !s.$ref || (!d.ignoreKeywordsWithRef && f.schemaHasRulesButRef(s, m)) ? (d.jtd || (function (e, t) { !e.schemaEnv.meta && e.opts.strictTypes && ((function (e, t) { t.length && (e.dataTypes.length ? (t.forEach(t => { O(e.dataTypes, t) || S( e, \`type "\${t}" not allowed by context "\${e.dataTypes.join( ',' )}"\` ); }), (e.dataTypes = e.dataTypes.filter(e => O(t, e)))) : (e.dataTypes = t)); })(e, t), e.opts.allowUnionTypes || (function (e, t) { t.length > 1 && (2 !== t.length || !t.includes('null')) && S( e, 'use allowUnionTypes to allow union type keyword' ); })(e, t), (function (e, t) { const n = e.self.RULES.all; for (const r in n) { const o = n[r]; if ( 'object' == typeof o && i.shouldUseRule(e.schema, o) ) { const { type: n } = o.definition; n.length && !n.some(e => { return ( (r = e), (n = t).includes(r) || ('number' === r && n.includes('integer')) ); var n, r; }) && S( e, \`missing type "\${n.join( ',' )}" for keyword "\${r}"\` ); } } })(e, e.dataTypes)); })(e, t), o.block(() => { for (const e of m.rules) g(e); g(m.post); })) : o.block(() => P(e, '$ref', m.all.$ref.definition)); } function _(e, t) { const { gen: n, schema: r, opts: { useDefaults: o } } = e; o && s.assignDefaults(e, t.type), n.block(() => { for (const n of t.rules) i.shouldUseRule(r, n) && P(e, n.keyword, n.definition, t.type); }); } function O(e, t) { return e.includes(t) || ('integer' === t && e.includes('number')); } function S(e, t) { (t += \` at "\${ e.schemaEnv.baseId + e.errSchemaPath }" (strictTypes)\`), f.checkStrictMode(e, t, e.opts.strictTypes); } t.validateFunctionCode = function (e) { v(e) && (b(e), y(e)) ? (function (e) { const { schema: t, opts: n, gen: r } = e; m(e, () => { n.$comment && t.$comment && x(e), (function (e) { const { schema: t, opts: n } = e; void 0 !== t.default && n.useDefaults && n.strictSchema && f.checkStrictMode( e, 'default is ignored in the schema root' ); })(e), r.let(p.default.vErrors, null), r.let(p.default.errors, 0), n.unevaluated && (function (e) { const { gen: t, validateName: n } = e; (e.evaluated = t.const( 'evaluated', u._\`\${n}.evaluated\` )), t.if(u._\`\${e.evaluated}.dynamicProps\`, () => t.assign( u._\`\${e.evaluated}.props\`, u._\`undefined\` ) ), t.if(u._\`\${e.evaluated}.dynamicItems\`, () => t.assign( u._\`\${e.evaluated}.items\`, u._\`undefined\` ) ); })(e), w(e), (function (e) { const { gen: t, schemaEnv: n, validateName: r, ValidationError: o, opts: i } = e; n.$async ? t.if( u._\`\${p.default.errors} === 0\`, () => t.return(p.default.data), () => t.throw(u._\`new \${o}(\${p.default.vErrors})\`) ) : (t.assign(u._\`\${r}.errors\`, p.default.vErrors), i.unevaluated && (function ({ gen: e, evaluated: t, props: n, items: r }) { n instanceof u.Name && e.assign(u._\`\${t}.props\`, n), r instanceof u.Name && e.assign(u._\`\${t}.items\`, r); })(e), t.return(u._\`\${p.default.errors} === 0\`)); })(e); }); })(e) : m(e, () => r.topBoolOrEmptySchema(e)); }; class E { constructor(e, t, n) { if ( (l.validateKeywordUsage(e, t, n), (this.gen = e.gen), (this.allErrors = e.allErrors), (this.keyword = n), (this.data = e.data), (this.schema = e.schema[n]), (this.$data = t.$data && e.opts.$data && this.schema && this.schema.$data), (this.schemaValue = f.schemaRefOrVal( e, this.schema, n, 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', C(this.$data, e)); else if ( ((this.schemaCode = this.schemaValue), !l.validSchemaType(this.schema, t.schemaType, t.allowUndefined)) ) throw new Error( \`\${n} value must be \${JSON.stringify(t.schemaType)}\` ); ('code' in t ? t.trackErrors : !1 !== t.errors) && (this.errsCount = e.gen.const('_errs', p.default.errors)); } result(e, t, n) { this.gen.if(u.not(e)), n ? n() : 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( u._\`\${t} !== undefined && (\${u.or(this.invalid$data(), e)})\` ); } error(e, t, n) { if (t) return ( this.setParams(t), this._error(e, n), void this.setParams({}) ); this._error(e, n); } _error(e, t) { (e ? h.reportExtraError : h.reportError)(this, this.def.error, t); } $dataError() { h.reportError(this, this.def.$dataError || h.keyword$DataError); } reset() { if (void 0 === this.errsCount) throw new Error('add "trackErrors" to keyword definition'); h.resetErrorsCount(this.gen, this.errsCount); } ok(e) { this.allErrors || this.gen.if(e); } setParams(e, t) { t ? Object.assign(this.params, e) : (this.params = e); } block$data(e, t, n = u.nil) { this.gen.block(() => { this.check$data(e, n), t(); }); } check$data(e = u.nil, t = u.nil) { if (!this.$data) return; const { gen: n, schemaCode: r, schemaType: o, def: i } = this; n.if(u.or(u._\`\${r} === undefined\`, t)), e !== u.nil && n.assign(e, !0), (o.length || i.validateSchema) && (n.elseIf(this.invalid$data()), this.$dataError(), e !== u.nil && n.assign(e, !1)), n.else(); } invalid$data() { const { gen: e, schemaCode: t, schemaType: n, def: r, it: o } = this; return u.or( (function () { if (n.length) { if (!(t instanceof u.Name)) throw new Error('ajv implementation error'); const e = Array.isArray(n) ? n : [n]; return u._\`\${a.checkDataTypes( e, t, o.opts.strictNumbers, a.DataType.Wrong )}\`; } return u.nil; })(), (function () { if (r.validateSchema) { const n = e.scopeValue('validate$data', { ref: r.validateSchema }); return u._\`!\${n}(\${t})\`; } return u.nil; })() ); } subschema(e, t) { const n = c.getSubschema(this.it, e); c.extendSubschemaData(n, this.it, e), c.extendSubschemaMode(n, e); const o = { ...this.it, ...n, items: void 0, props: void 0 }; return ( (function (e, t) { v(e) && (b(e), y(e)) ? (function (e, t) { const { schema: n, gen: r, opts: o } = e; o.$comment && n.$comment && x(e), (function (e) { const t = e.schema[e.opts.schemaId]; t && (e.baseId = d.resolveUrl(e.baseId, t)); })(e), (function (e) { if (e.schema.$async && !e.schemaEnv.$async) throw new Error('async schema in sync schema'); })(e); const i = r.const('_errs', p.default.errors); w(e, i), r.var(t, u._\`\${i} === \${p.default.errors}\`); })(e, t) : r.boolOrEmptySchema(e, t); })(o, t), o ); } mergeEvaluated(e, t) { const { it: n, gen: r } = this; n.opts.unevaluated && (!0 !== n.props && void 0 !== e.props && (n.props = f.mergeEvaluated.props(r, e.props, n.props, t)), !0 !== n.items && void 0 !== e.items && (n.items = f.mergeEvaluated.items(r, e.items, n.items, t))); } mergeValidEvaluated(e, t) { const { it: n, gen: r } = this; if (n.opts.unevaluated && (!0 !== n.props || !0 !== n.items)) return r.if(t, () => this.mergeEvaluated(e, u.Name)), !0; } } function P(e, t, n, r) { const o = new E(e, n, t); 'code' in n ? n.code(o, r) : o.$data && n.validate ? l.funcKeywordCode(o, n) : 'macro' in n ? l.macroKeywordCode(o, n) : (n.compile || n.validate) && l.funcKeywordCode(o, n); } t.KeywordCxt = E; const A = /^\\/(?:[^~]|~0|~1)*$/, $ = /^([0-9]+)(#|\\/(?:[^~]|~0|~1)*)?$/; function C(e, { dataLevel: t, dataNames: n, dataPathArr: r }) { let o, i; if ('' === e) return p.default.rootData; if ('/' === e[0]) { if (!A.test(e)) throw new Error(\`Invalid JSON-pointer: \${e}\`); (o = e), (i = p.default.rootData); } else { const a = $.exec(e); if (!a) throw new Error(\`Invalid JSON-pointer: \${e}\`); const s = +a[1]; if (((o = a[2]), '#' === o)) { if (s >= t) throw new Error(l('property/index', s)); return r[t - s]; } if (s > t) throw new Error(l('data', s)); if (((i = n[t - s]), !o)) return i; } let a = i; const s = o.split('/'); for (const e of s) e && ((i = u._\`\${i}\${u.getProperty(f.unescapeJsonPointer(e))}\`), (a = u._\`\${a} && \${i}\`)); return a; function l(e, n) { return \`Cannot access \${e} \${n} levels up, current level is \${t}\`; } } t.getData = C; }, 6488: function (e, t, n) { 'use strict'; Object.defineProperty(t, '__esModule', { value: !0 }), (t.validateKeywordUsage = t.validSchemaType = t.funcKeywordCode = t.macroKeywordCode = void 0); const r = n(4475), o = n(5018), i = n(8619), a = n(1885); function s(e) { const { gen: t, data: n, it: o } = e; t.if(o.parentData, () => t.assign(n, r._\`\${o.parentData}[\${o.parentDataProperty}]\`) ); } function l(e, t, n) { if (void 0 === n) throw new Error(\`keyword "\${t}" failed to compile\`); return e.scopeValue( 'keyword', 'function' == typeof n ? { ref: n } : { ref: n, code: r.stringify(n) } ); } (t.macroKeywordCode = function (e, t) { const { gen: n, keyword: o, schema: i, parentSchema: a, it: s } = e, c = t.macro.call(s.self, i, a, s), u = l(n, o, c); !1 !== s.opts.validateSchema && s.self.validateSchema(c, !0); const p = n.name('valid'); e.subschema( { schema: c, schemaPath: r.nil, errSchemaPath: \`\${s.errSchemaPath}/\${o}\`, topSchemaRef: u, compositeRule: !0 }, p ), e.pass(p, () => e.error(!0)); }), (t.funcKeywordCode = function (e, t) { var n; const { gen: c, keyword: u, schema: p, parentSchema: d, $data: f, it: h } = e; !(function ({ schemaEnv: e }, t) { if (t.async && !e.$async) throw new Error('async keyword in sync schema'); })(h, t); const m = !f && t.compile ? t.compile.call(h.self, p, d, h) : t.validate, g = l(c, u, m), y = c.let('valid'); function v(n = t.async ? r._\`await \` : r.nil) { const a = h.opts.passContext ? o.default.this : o.default.self, s = !(('compile' in t && !f) || !1 === t.schema); c.assign( y, r._\`\${n}\${i.callValidateCode(e, g, a, s)}\`, t.modifying ); } function b(e) { var n; c.if(r.not(null !== (n = t.valid) && void 0 !== n ? n : y), e); } e.block$data(y, function () { if (!1 === t.errors) v(), t.modifying && s(e), b(() => e.error()); else { const n = t.async ? (function () { const e = c.let('ruleErrs', null); return ( c.try( () => v(r._\`await \`), t => c.assign(y, !1).if( r._\`\${t} instanceof \${h.ValidationError}\`, () => c.assign(e, r._\`\${t}.errors\`), () => c.throw(t) ) ), e ); })() : (function () { const e = r._\`\${g}.errors\`; return c.assign(e, null), v(r.nil), e; })(); t.modifying && s(e), b(() => (function (e, t) { const { gen: n } = e; n.if( r._\`Array.isArray(\${t})\`, () => { n .assign( o.default.vErrors, r._\`\${o.default.vErrors} === null ? \${t} : \${o.default.vErrors}.concat(\${t})\` ) .assign( o.default.errors, r._\`\${o.default.vErrors}.length\` ), a.extendErrors(e); }, () => e.error() ); })(e, n) ); } }), e.ok(null !== (n = t.valid) && void 0 !== n ? n : y); }), (t.validSchemaType = function (e, t, n = !1) { return ( !t.length || t.some(t => 'array' === t ? Array.isArray(e) : 'object' === t ? e && 'object' == typeof e && !Array.isArray(e) : typeof e == t || (n && void 0 === e) ) ); }), (t.validateKeywordUsage = function ( { schema: e, opts: t, self: n, errSchemaPath: r }, o, i ) { if ( Array.isArray(o.keyword) ? !o.keyword.includes(i) : o.keyword !== i ) throw new Error('ajv implementation error'); const a = o.dependencies; if ( null == a ? void 0 : a.some(t => !Object.prototype.hasOwnProperty.call(e, t)) ) throw new Error( \`parent schema must have dependencies of \${i}: \${a.join(',')}\` ); if (o.validateSchema && !o.validateSchema(e[i])) { const e = \`keyword "\${i}" value is invalid at path "\${r}": \` + n.errorsText(o.validateSchema.errors); if ('log' !== t.validateSchema) throw new Error(e); n.logger.error(e); } }); }, 4688: function (e, t, n) { 'use strict'; Object.defineProperty(t, '__esModule', { value: !0 }), (t.extendSubschemaMode = t.extendSubschemaData = t.getSubschema = void 0); const r = n(4475), o = n(6124); (t.getSubschema = function ( e, { keyword: t, schemaProp: n, schema: i, schemaPath: a, errSchemaPath: s, topSchemaRef: l } ) { if (void 0 !== t && void 0 !== i) throw new Error( 'both "keyword" and "schema" passed, only one allowed' ); if (void 0 !== t) { const i = e.schema[t]; return void 0 === n ? { schema: i, schemaPath: r._\`\${e.schemaPath}\${r.getProperty(t)}\`, errSchemaPath: \`\${e.errSchemaPath}/\${t}\` } : { schema: i[n], schemaPath: r._\`\${e.schemaPath}\${r.getProperty( t )}\${r.getProperty(n)}\`, errSchemaPath: \`\${e.errSchemaPath}/\${t}/\${o.escapeFragment( n )}\` }; } if (void 0 !== i) { if (void 0 === a || void 0 === s || void 0 === l) throw new Error( '"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"' ); return { schema: i, schemaPath: a, topSchemaRef: l, errSchemaPath: s }; } throw new Error('either "keyword" or "schema" must be passed'); }), (t.extendSubschemaData = function ( e, t, { dataProp: n, dataPropType: i, data: a, dataTypes: s, propertyName: l } ) { if (void 0 !== a && void 0 !== n) throw new Error( 'both "data" and "dataProp" passed, only one allowed' ); const { gen: c } = t; if (void 0 !== n) { const { errorPath: a, dataPathArr: s, opts: l } = t; u(c.let('data', r._\`\${t.data}\${r.getProperty(n)}\`, !0)), (e.errorPath = r.str\`\${a}\${o.getErrorPath( n, i, l.jsPropertySyntax )}\`), (e.parentDataProperty = r._\`\${n}\`), (e.dataPathArr = [...s, e.parentDataProperty]); } function u(n) { (e.data = n), (e.dataLevel = t.dataLevel + 1), (e.dataTypes = []), (t.definedProperties = new Set()), (e.parentData = t.data), (e.dataNames = [...t.dataNames, n]); } void 0 !== a && (u(a instanceof r.Name ? a : c.let('data', a, !0)), void 0 !== l && (e.propertyName = l)), s && (e.dataTypes = s); }), (t.extendSubschemaMode = function ( e, { jtdDiscriminator: t, jtdMetadata: n, compositeRule: r, createErrors: o, allErrors: i } ) { void 0 !== r && (e.compositeRule = r), void 0 !== o && (e.createErrors = o), void 0 !== i && (e.allErrors = i), (e.jtdDiscriminator = t), (e.jtdMetadata = n); }); }, 3325: function (e, t, n) { 'use strict'; Object.defineProperty(t, '__esModule', { value: !0 }), (t.CodeGen = t.Name = t.nil = t.stringify = t.str = t._ = t.KeywordCxt = void 0); var r = n(1321); Object.defineProperty(t, 'KeywordCxt', { enumerable: !0, get: function () { return r.KeywordCxt; } }); var o = n(4475); Object.defineProperty(t, '_', { enumerable: !0, get: function () { return o._; } }), Object.defineProperty(t, 'str', { enumerable: !0, get: function () { return o.str; } }), Object.defineProperty(t, 'stringify', { enumerable: !0, get: function () { return o.stringify; } }), Object.defineProperty(t, 'nil', { enumerable: !0, get: function () { return o.nil; } }), Object.defineProperty(t, 'Name', { enumerable: !0, get: function () { return o.Name; } }), Object.defineProperty(t, 'CodeGen', { enumerable: !0, get: function () { return o.CodeGen; } }); const i = n(8451), a = n(4143), s = n(3664), l = n(7805), c = n(4475), u = n(9826), p = n(7927), d = n(6124), f = n(425), h = ['removeAdditional', 'useDefaults', 'coerceTypes'], m = new Set([ 'validate', 'serialize', 'parse', 'wrapper', 'root', 'schema', 'keyw