ai-client-sdk 4.1.3 → 4.1.4

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.
@@ -1,4290 +0,0 @@
1
- import { i as e, n as t, r as n, t as r } from "./rolldown-runtime-DC4cgjXG.mjs";
2
- //#region node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/code.js
3
- var i = /* @__PURE__ */ r(((e) => {
4
- Object.defineProperty(e, "__esModule", { value: !0 }), e.regexpCode = e.getEsmExportName = e.getProperty = e.safeStringify = e.stringify = e.strConcat = e.addCodeArg = e.str = e._ = e.nil = e._Code = e.Name = e.IDENTIFIER = e._CodeOrName = void 0;
5
- var t = class {};
6
- e._CodeOrName = t, e.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
7
- var n = class extends t {
8
- constructor(t) {
9
- if (super(), !e.IDENTIFIER.test(t)) throw Error("CodeGen: name must be a valid identifier");
10
- this.str = t;
11
- }
12
- toString() {
13
- return this.str;
14
- }
15
- emptyStr() {
16
- return !1;
17
- }
18
- get names() {
19
- return { [this.str]: 1 };
20
- }
21
- };
22
- e.Name = n;
23
- var r = class extends t {
24
- constructor(e) {
25
- super(), this._items = typeof e == "string" ? [e] : e;
26
- }
27
- toString() {
28
- return this.str;
29
- }
30
- emptyStr() {
31
- if (this._items.length > 1) return !1;
32
- let e = this._items[0];
33
- return e === "" || e === "\"\"";
34
- }
35
- get str() {
36
- return this._str ??= this._items.reduce((e, t) => `${e}${t}`, "");
37
- }
38
- get names() {
39
- return this._names ??= this._items.reduce((e, t) => (t instanceof n && (e[t.str] = (e[t.str] || 0) + 1), e), {});
40
- }
41
- };
42
- e._Code = r, e.nil = new r("");
43
- function i(e, ...t) {
44
- let n = [e[0]], i = 0;
45
- for (; i < t.length;) s(n, t[i]), n.push(e[++i]);
46
- return new r(n);
47
- }
48
- e._ = i;
49
- var a = new r("+");
50
- function o(e, ...t) {
51
- let n = [p(e[0])], i = 0;
52
- for (; i < t.length;) n.push(a), s(n, t[i]), n.push(a, p(e[++i]));
53
- return c(n), new r(n);
54
- }
55
- e.str = o;
56
- function s(e, t) {
57
- t instanceof r ? e.push(...t._items) : t instanceof n ? e.push(t) : e.push(d(t));
58
- }
59
- e.addCodeArg = s;
60
- function c(e) {
61
- let t = 1;
62
- for (; t < e.length - 1;) {
63
- if (e[t] === a) {
64
- let n = l(e[t - 1], e[t + 1]);
65
- if (n !== void 0) {
66
- e.splice(t - 1, 3, n);
67
- continue;
68
- }
69
- e[t++] = "+";
70
- }
71
- t++;
72
- }
73
- }
74
- function l(e, t) {
75
- if (t === "\"\"") return e;
76
- if (e === "\"\"") return t;
77
- if (typeof e == "string") return t instanceof n || e[e.length - 1] !== "\"" ? void 0 : typeof t == "string" ? t[0] === "\"" ? e.slice(0, -1) + t.slice(1) : void 0 : `${e.slice(0, -1)}${t}"`;
78
- if (typeof t == "string" && t[0] === "\"" && !(e instanceof n)) return `"${e}${t.slice(1)}`;
79
- }
80
- function u(e, t) {
81
- return t.emptyStr() ? e : e.emptyStr() ? t : o`${e}${t}`;
82
- }
83
- e.strConcat = u;
84
- function d(e) {
85
- return typeof e == "number" || typeof e == "boolean" || e === null ? e : p(Array.isArray(e) ? e.join(",") : e);
86
- }
87
- function f(e) {
88
- return new r(p(e));
89
- }
90
- e.stringify = f;
91
- function p(e) {
92
- return JSON.stringify(e).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
93
- }
94
- e.safeStringify = p;
95
- function m(t) {
96
- return typeof t == "string" && e.IDENTIFIER.test(t) ? new r(`.${t}`) : i`[${t}]`;
97
- }
98
- e.getProperty = m;
99
- function h(t) {
100
- if (typeof t == "string" && e.IDENTIFIER.test(t)) return new r(`${t}`);
101
- throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`);
102
- }
103
- e.getEsmExportName = h;
104
- function g(e) {
105
- return new r(e.toString());
106
- }
107
- e.regexpCode = g;
108
- })), a = /* @__PURE__ */ r(((e) => {
109
- Object.defineProperty(e, "__esModule", { value: !0 }), e.ValueScope = e.ValueScopeName = e.Scope = e.varKinds = e.UsedValueState = void 0;
110
- var t = i(), n = class extends Error {
111
- constructor(e) {
112
- super(`CodeGen: "code" for ${e} not defined`), this.value = e.value;
113
- }
114
- }, r;
115
- (function(e) {
116
- e[e.Started = 0] = "Started", e[e.Completed = 1] = "Completed";
117
- })(r || (e.UsedValueState = r = {})), e.varKinds = {
118
- const: new t.Name("const"),
119
- let: new t.Name("let"),
120
- var: new t.Name("var")
121
- };
122
- var a = class {
123
- constructor({ prefixes: e, parent: t } = {}) {
124
- this._names = {}, this._prefixes = e, this._parent = t;
125
- }
126
- toName(e) {
127
- return e instanceof t.Name ? e : this.name(e);
128
- }
129
- name(e) {
130
- return new t.Name(this._newName(e));
131
- }
132
- _newName(e) {
133
- let t = this._names[e] || this._nameGroup(e);
134
- return `${e}${t.index++}`;
135
- }
136
- _nameGroup(e) {
137
- if ((this._parent?._prefixes)?.has(e) || this._prefixes && !this._prefixes.has(e)) throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);
138
- return this._names[e] = {
139
- prefix: e,
140
- index: 0
141
- };
142
- }
143
- };
144
- e.Scope = a;
145
- var o = class extends t.Name {
146
- constructor(e, t) {
147
- super(t), this.prefix = e;
148
- }
149
- setValue(e, { property: n, itemIndex: r }) {
150
- this.value = e, this.scopePath = (0, t._)`.${new t.Name(n)}[${r}]`;
151
- }
152
- };
153
- e.ValueScopeName = o;
154
- var s = (0, t._)`\n`;
155
- e.ValueScope = class extends a {
156
- constructor(e) {
157
- super(e), this._values = {}, this._scope = e.scope, this.opts = {
158
- ...e,
159
- _n: e.lines ? s : t.nil
160
- };
161
- }
162
- get() {
163
- return this._scope;
164
- }
165
- name(e) {
166
- return new o(e, this._newName(e));
167
- }
168
- value(e, t) {
169
- if (t.ref === void 0) throw Error("CodeGen: ref must be passed in value");
170
- let n = this.toName(e), { prefix: r } = n, i = t.key ?? t.ref, a = this._values[r];
171
- if (a) {
172
- let e = a.get(i);
173
- if (e) return e;
174
- } else a = this._values[r] = /* @__PURE__ */ new Map();
175
- a.set(i, n);
176
- let o = this._scope[r] || (this._scope[r] = []), s = o.length;
177
- return o[s] = t.ref, n.setValue(t, {
178
- property: r,
179
- itemIndex: s
180
- }), n;
181
- }
182
- getValue(e, t) {
183
- let n = this._values[e];
184
- if (n) return n.get(t);
185
- }
186
- scopeRefs(e, n = this._values) {
187
- return this._reduceValues(n, (n) => {
188
- if (n.scopePath === void 0) throw Error(`CodeGen: name "${n}" has no value`);
189
- return (0, t._)`${e}${n.scopePath}`;
190
- });
191
- }
192
- scopeCode(e = this._values, t, n) {
193
- return this._reduceValues(e, (e) => {
194
- if (e.value === void 0) throw Error(`CodeGen: name "${e}" has no value`);
195
- return e.value.code;
196
- }, t, n);
197
- }
198
- _reduceValues(i, a, o = {}, s) {
199
- let c = t.nil;
200
- for (let l in i) {
201
- let u = i[l];
202
- if (!u) continue;
203
- let d = o[l] = o[l] || /* @__PURE__ */ new Map();
204
- u.forEach((i) => {
205
- if (d.has(i)) return;
206
- d.set(i, r.Started);
207
- let o = a(i);
208
- if (o) {
209
- let n = this.opts.es5 ? e.varKinds.var : e.varKinds.const;
210
- c = (0, t._)`${c}${n} ${i} = ${o};${this.opts._n}`;
211
- } else if (o = s?.(i)) c = (0, t._)`${c}${o}${this.opts._n}`;
212
- else throw new n(i);
213
- d.set(i, r.Completed);
214
- });
215
- }
216
- return c;
217
- }
218
- };
219
- })), o = /* @__PURE__ */ r(((e) => {
220
- Object.defineProperty(e, "__esModule", { value: !0 }), e.or = e.and = e.not = e.CodeGen = e.operators = e.varKinds = e.ValueScopeName = e.ValueScope = e.Scope = e.Name = e.regexpCode = e.stringify = e.getProperty = e.nil = e.strConcat = e.str = e._ = void 0;
221
- var t = i(), n = a(), r = i();
222
- Object.defineProperty(e, "_", {
223
- enumerable: !0,
224
- get: function() {
225
- return r._;
226
- }
227
- }), Object.defineProperty(e, "str", {
228
- enumerable: !0,
229
- get: function() {
230
- return r.str;
231
- }
232
- }), Object.defineProperty(e, "strConcat", {
233
- enumerable: !0,
234
- get: function() {
235
- return r.strConcat;
236
- }
237
- }), Object.defineProperty(e, "nil", {
238
- enumerable: !0,
239
- get: function() {
240
- return r.nil;
241
- }
242
- }), Object.defineProperty(e, "getProperty", {
243
- enumerable: !0,
244
- get: function() {
245
- return r.getProperty;
246
- }
247
- }), Object.defineProperty(e, "stringify", {
248
- enumerable: !0,
249
- get: function() {
250
- return r.stringify;
251
- }
252
- }), Object.defineProperty(e, "regexpCode", {
253
- enumerable: !0,
254
- get: function() {
255
- return r.regexpCode;
256
- }
257
- }), Object.defineProperty(e, "Name", {
258
- enumerable: !0,
259
- get: function() {
260
- return r.Name;
261
- }
262
- });
263
- var o = a();
264
- Object.defineProperty(e, "Scope", {
265
- enumerable: !0,
266
- get: function() {
267
- return o.Scope;
268
- }
269
- }), Object.defineProperty(e, "ValueScope", {
270
- enumerable: !0,
271
- get: function() {
272
- return o.ValueScope;
273
- }
274
- }), Object.defineProperty(e, "ValueScopeName", {
275
- enumerable: !0,
276
- get: function() {
277
- return o.ValueScopeName;
278
- }
279
- }), Object.defineProperty(e, "varKinds", {
280
- enumerable: !0,
281
- get: function() {
282
- return o.varKinds;
283
- }
284
- }), e.operators = {
285
- GT: new t._Code(">"),
286
- GTE: new t._Code(">="),
287
- LT: new t._Code("<"),
288
- LTE: new t._Code("<="),
289
- EQ: new t._Code("==="),
290
- NEQ: new t._Code("!=="),
291
- NOT: new t._Code("!"),
292
- OR: new t._Code("||"),
293
- AND: new t._Code("&&"),
294
- ADD: new t._Code("+")
295
- };
296
- var s = class {
297
- optimizeNodes() {
298
- return this;
299
- }
300
- optimizeNames(e, t) {
301
- return this;
302
- }
303
- }, c = class extends s {
304
- constructor(e, t, n) {
305
- super(), this.varKind = e, this.name = t, this.rhs = n;
306
- }
307
- render({ es5: e, _n: t }) {
308
- let r = e ? n.varKinds.var : this.varKind, i = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
309
- return `${r} ${this.name}${i};` + t;
310
- }
311
- optimizeNames(e, t) {
312
- if (e[this.name.str]) return this.rhs &&= j(this.rhs, e, t), this;
313
- }
314
- get names() {
315
- return this.rhs instanceof t._CodeOrName ? this.rhs.names : {};
316
- }
317
- }, l = class extends s {
318
- constructor(e, t, n) {
319
- super(), this.lhs = e, this.rhs = t, this.sideEffects = n;
320
- }
321
- render({ _n: e }) {
322
- return `${this.lhs} = ${this.rhs};` + e;
323
- }
324
- optimizeNames(e, n) {
325
- if (!(this.lhs instanceof t.Name && !e[this.lhs.str] && !this.sideEffects)) return this.rhs = j(this.rhs, e, n), this;
326
- }
327
- get names() {
328
- return A(this.lhs instanceof t.Name ? {} : { ...this.lhs.names }, this.rhs);
329
- }
330
- }, u = class extends l {
331
- constructor(e, t, n, r) {
332
- super(e, n, r), this.op = t;
333
- }
334
- render({ _n: e }) {
335
- return `${this.lhs} ${this.op}= ${this.rhs};` + e;
336
- }
337
- }, d = class extends s {
338
- constructor(e) {
339
- super(), this.label = e, this.names = {};
340
- }
341
- render({ _n: e }) {
342
- return `${this.label}:` + e;
343
- }
344
- }, f = class extends s {
345
- constructor(e) {
346
- super(), this.label = e, this.names = {};
347
- }
348
- render({ _n: e }) {
349
- return `break${this.label ? ` ${this.label}` : ""};` + e;
350
- }
351
- }, p = class extends s {
352
- constructor(e) {
353
- super(), this.error = e;
354
- }
355
- render({ _n: e }) {
356
- return `throw ${this.error};` + e;
357
- }
358
- get names() {
359
- return this.error.names;
360
- }
361
- }, m = class extends s {
362
- constructor(e) {
363
- super(), this.code = e;
364
- }
365
- render({ _n: e }) {
366
- return `${this.code};` + e;
367
- }
368
- optimizeNodes() {
369
- return `${this.code}` ? this : void 0;
370
- }
371
- optimizeNames(e, t) {
372
- return this.code = j(this.code, e, t), this;
373
- }
374
- get names() {
375
- return this.code instanceof t._CodeOrName ? this.code.names : {};
376
- }
377
- }, h = class extends s {
378
- constructor(e = []) {
379
- super(), this.nodes = e;
380
- }
381
- render(e) {
382
- return this.nodes.reduce((t, n) => t + n.render(e), "");
383
- }
384
- optimizeNodes() {
385
- let { nodes: e } = this, t = e.length;
386
- for (; t--;) {
387
- let n = e[t].optimizeNodes();
388
- Array.isArray(n) ? e.splice(t, 1, ...n) : n ? e[t] = n : e.splice(t, 1);
389
- }
390
- return e.length > 0 ? this : void 0;
391
- }
392
- optimizeNames(e, t) {
393
- let { nodes: n } = this, r = n.length;
394
- for (; r--;) {
395
- let i = n[r];
396
- i.optimizeNames(e, t) || (M(e, i.names), n.splice(r, 1));
397
- }
398
- return n.length > 0 ? this : void 0;
399
- }
400
- get names() {
401
- return this.nodes.reduce((e, t) => k(e, t.names), {});
402
- }
403
- }, g = class extends h {
404
- render(e) {
405
- return "{" + e._n + super.render(e) + "}" + e._n;
406
- }
407
- }, _ = class extends h {}, v = class extends g {};
408
- v.kind = "else";
409
- var y = class e extends g {
410
- constructor(e, t) {
411
- super(t), this.condition = e;
412
- }
413
- render(e) {
414
- let t = `if(${this.condition})` + super.render(e);
415
- return this.else && (t += "else " + this.else.render(e)), t;
416
- }
417
- optimizeNodes() {
418
- super.optimizeNodes();
419
- let t = this.condition;
420
- if (t === !0) return this.nodes;
421
- let n = this.else;
422
- if (n) {
423
- let e = n.optimizeNodes();
424
- n = this.else = Array.isArray(e) ? new v(e) : e;
425
- }
426
- if (n) return t === !1 ? n instanceof e ? n : n.nodes : this.nodes.length ? this : new e(N(t), n instanceof e ? [n] : n.nodes);
427
- if (!(t === !1 || !this.nodes.length)) return this;
428
- }
429
- optimizeNames(e, t) {
430
- if (this.else = this.else?.optimizeNames(e, t), super.optimizeNames(e, t) || this.else) return this.condition = j(this.condition, e, t), this;
431
- }
432
- get names() {
433
- let e = super.names;
434
- return A(e, this.condition), this.else && k(e, this.else.names), e;
435
- }
436
- };
437
- y.kind = "if";
438
- var b = class extends g {};
439
- b.kind = "for";
440
- var x = class extends b {
441
- constructor(e) {
442
- super(), this.iteration = e;
443
- }
444
- render(e) {
445
- return `for(${this.iteration})` + super.render(e);
446
- }
447
- optimizeNames(e, t) {
448
- if (super.optimizeNames(e, t)) return this.iteration = j(this.iteration, e, t), this;
449
- }
450
- get names() {
451
- return k(super.names, this.iteration.names);
452
- }
453
- }, S = class extends b {
454
- constructor(e, t, n, r) {
455
- super(), this.varKind = e, this.name = t, this.from = n, this.to = r;
456
- }
457
- render(e) {
458
- let t = e.es5 ? n.varKinds.var : this.varKind, { name: r, from: i, to: a } = this;
459
- return `for(${t} ${r}=${i}; ${r}<${a}; ${r}++)` + super.render(e);
460
- }
461
- get names() {
462
- return A(A(super.names, this.from), this.to);
463
- }
464
- }, C = class extends b {
465
- constructor(e, t, n, r) {
466
- super(), this.loop = e, this.varKind = t, this.name = n, this.iterable = r;
467
- }
468
- render(e) {
469
- return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(e);
470
- }
471
- optimizeNames(e, t) {
472
- if (super.optimizeNames(e, t)) return this.iterable = j(this.iterable, e, t), this;
473
- }
474
- get names() {
475
- return k(super.names, this.iterable.names);
476
- }
477
- }, w = class extends g {
478
- constructor(e, t, n) {
479
- super(), this.name = e, this.args = t, this.async = n;
480
- }
481
- render(e) {
482
- return `${this.async ? "async " : ""}function ${this.name}(${this.args})` + super.render(e);
483
- }
484
- };
485
- w.kind = "func";
486
- var T = class extends h {
487
- render(e) {
488
- return "return " + super.render(e);
489
- }
490
- };
491
- T.kind = "return";
492
- var E = class extends g {
493
- render(e) {
494
- let t = "try" + super.render(e);
495
- return this.catch && (t += this.catch.render(e)), this.finally && (t += this.finally.render(e)), t;
496
- }
497
- optimizeNodes() {
498
- var e, t;
499
- return super.optimizeNodes(), (e = this.catch) == null || e.optimizeNodes(), (t = this.finally) == null || t.optimizeNodes(), this;
500
- }
501
- optimizeNames(e, t) {
502
- var n, r;
503
- return super.optimizeNames(e, t), (n = this.catch) == null || n.optimizeNames(e, t), (r = this.finally) == null || r.optimizeNames(e, t), this;
504
- }
505
- get names() {
506
- let e = super.names;
507
- return this.catch && k(e, this.catch.names), this.finally && k(e, this.finally.names), e;
508
- }
509
- }, D = class extends g {
510
- constructor(e) {
511
- super(), this.error = e;
512
- }
513
- render(e) {
514
- return `catch(${this.error})` + super.render(e);
515
- }
516
- };
517
- D.kind = "catch";
518
- var O = class extends g {
519
- render(e) {
520
- return "finally" + super.render(e);
521
- }
522
- };
523
- O.kind = "finally", e.CodeGen = class {
524
- constructor(e, t = {}) {
525
- this._values = {}, this._blockStarts = [], this._constants = {}, this.opts = {
526
- ...t,
527
- _n: t.lines ? "\n" : ""
528
- }, this._extScope = e, this._scope = new n.Scope({ parent: e }), this._nodes = [new _()];
529
- }
530
- toString() {
531
- return this._root.render(this.opts);
532
- }
533
- name(e) {
534
- return this._scope.name(e);
535
- }
536
- scopeName(e) {
537
- return this._extScope.name(e);
538
- }
539
- scopeValue(e, t) {
540
- let n = this._extScope.value(e, t);
541
- return (this._values[n.prefix] || (this._values[n.prefix] = /* @__PURE__ */ new Set())).add(n), n;
542
- }
543
- getScopeValue(e, t) {
544
- return this._extScope.getValue(e, t);
545
- }
546
- scopeRefs(e) {
547
- return this._extScope.scopeRefs(e, this._values);
548
- }
549
- scopeCode() {
550
- return this._extScope.scopeCode(this._values);
551
- }
552
- _def(e, t, n, r) {
553
- let i = this._scope.toName(t);
554
- return n !== void 0 && r && (this._constants[i.str] = n), this._leafNode(new c(e, i, n)), i;
555
- }
556
- const(e, t, r) {
557
- return this._def(n.varKinds.const, e, t, r);
558
- }
559
- let(e, t, r) {
560
- return this._def(n.varKinds.let, e, t, r);
561
- }
562
- var(e, t, r) {
563
- return this._def(n.varKinds.var, e, t, r);
564
- }
565
- assign(e, t, n) {
566
- return this._leafNode(new l(e, t, n));
567
- }
568
- add(t, n) {
569
- return this._leafNode(new u(t, e.operators.ADD, n));
570
- }
571
- code(e) {
572
- return typeof e == "function" ? e() : e !== t.nil && this._leafNode(new m(e)), this;
573
- }
574
- object(...e) {
575
- let n = ["{"];
576
- for (let [r, i] of e) n.length > 1 && n.push(","), n.push(r), (r !== i || this.opts.es5) && (n.push(":"), (0, t.addCodeArg)(n, i));
577
- return n.push("}"), new t._Code(n);
578
- }
579
- if(e, t, n) {
580
- if (this._blockNode(new y(e)), t && n) this.code(t).else().code(n).endIf();
581
- else if (t) this.code(t).endIf();
582
- else if (n) throw Error("CodeGen: \"else\" body without \"then\" body");
583
- return this;
584
- }
585
- elseIf(e) {
586
- return this._elseNode(new y(e));
587
- }
588
- else() {
589
- return this._elseNode(new v());
590
- }
591
- endIf() {
592
- return this._endBlockNode(y, v);
593
- }
594
- _for(e, t) {
595
- return this._blockNode(e), t && this.code(t).endFor(), this;
596
- }
597
- for(e, t) {
598
- return this._for(new x(e), t);
599
- }
600
- forRange(e, t, r, i, a = this.opts.es5 ? n.varKinds.var : n.varKinds.let) {
601
- let o = this._scope.toName(e);
602
- return this._for(new S(a, o, t, r), () => i(o));
603
- }
604
- forOf(e, r, i, a = n.varKinds.const) {
605
- let o = this._scope.toName(e);
606
- if (this.opts.es5) {
607
- let e = r instanceof t.Name ? r : this.var("_arr", r);
608
- return this.forRange("_i", 0, (0, t._)`${e}.length`, (n) => {
609
- this.var(o, (0, t._)`${e}[${n}]`), i(o);
610
- });
611
- }
612
- return this._for(new C("of", a, o, r), () => i(o));
613
- }
614
- forIn(e, r, i, a = this.opts.es5 ? n.varKinds.var : n.varKinds.const) {
615
- if (this.opts.ownProperties) return this.forOf(e, (0, t._)`Object.keys(${r})`, i);
616
- let o = this._scope.toName(e);
617
- return this._for(new C("in", a, o, r), () => i(o));
618
- }
619
- endFor() {
620
- return this._endBlockNode(b);
621
- }
622
- label(e) {
623
- return this._leafNode(new d(e));
624
- }
625
- break(e) {
626
- return this._leafNode(new f(e));
627
- }
628
- return(e) {
629
- let t = new T();
630
- if (this._blockNode(t), this.code(e), t.nodes.length !== 1) throw Error("CodeGen: \"return\" should have one node");
631
- return this._endBlockNode(T);
632
- }
633
- try(e, t, n) {
634
- if (!t && !n) throw Error("CodeGen: \"try\" without \"catch\" and \"finally\"");
635
- let r = new E();
636
- if (this._blockNode(r), this.code(e), t) {
637
- let e = this.name("e");
638
- this._currNode = r.catch = new D(e), t(e);
639
- }
640
- return n && (this._currNode = r.finally = new O(), this.code(n)), this._endBlockNode(D, O);
641
- }
642
- throw(e) {
643
- return this._leafNode(new p(e));
644
- }
645
- block(e, t) {
646
- return this._blockStarts.push(this._nodes.length), e && this.code(e).endBlock(t), this;
647
- }
648
- endBlock(e) {
649
- let t = this._blockStarts.pop();
650
- if (t === void 0) throw Error("CodeGen: not in self-balancing block");
651
- let n = this._nodes.length - t;
652
- if (n < 0 || e !== void 0 && n !== e) throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);
653
- return this._nodes.length = t, this;
654
- }
655
- func(e, n = t.nil, r, i) {
656
- return this._blockNode(new w(e, n, r)), i && this.code(i).endFunc(), this;
657
- }
658
- endFunc() {
659
- return this._endBlockNode(w);
660
- }
661
- optimize(e = 1) {
662
- for (; e-- > 0;) this._root.optimizeNodes(), this._root.optimizeNames(this._root.names, this._constants);
663
- }
664
- _leafNode(e) {
665
- return this._currNode.nodes.push(e), this;
666
- }
667
- _blockNode(e) {
668
- this._currNode.nodes.push(e), this._nodes.push(e);
669
- }
670
- _endBlockNode(e, t) {
671
- let n = this._currNode;
672
- if (n instanceof e || t && n instanceof t) return this._nodes.pop(), this;
673
- throw Error(`CodeGen: not in block "${t ? `${e.kind}/${t.kind}` : e.kind}"`);
674
- }
675
- _elseNode(e) {
676
- let t = this._currNode;
677
- if (!(t instanceof y)) throw Error("CodeGen: \"else\" without \"if\"");
678
- return this._currNode = t.else = e, this;
679
- }
680
- get _root() {
681
- return this._nodes[0];
682
- }
683
- get _currNode() {
684
- let e = this._nodes;
685
- return e[e.length - 1];
686
- }
687
- set _currNode(e) {
688
- let t = this._nodes;
689
- t[t.length - 1] = e;
690
- }
691
- };
692
- function k(e, t) {
693
- for (let n in t) e[n] = (e[n] || 0) + (t[n] || 0);
694
- return e;
695
- }
696
- function A(e, n) {
697
- return n instanceof t._CodeOrName ? k(e, n.names) : e;
698
- }
699
- function j(e, n, r) {
700
- if (e instanceof t.Name) return i(e);
701
- if (!a(e)) return e;
702
- return new t._Code(e._items.reduce((e, n) => (n instanceof t.Name && (n = i(n)), n instanceof t._Code ? e.push(...n._items) : e.push(n), e), []));
703
- function i(e) {
704
- let t = r[e.str];
705
- return t === void 0 || n[e.str] !== 1 ? e : (delete n[e.str], t);
706
- }
707
- function a(e) {
708
- return e instanceof t._Code && e._items.some((e) => e instanceof t.Name && n[e.str] === 1 && r[e.str] !== void 0);
709
- }
710
- }
711
- function M(e, t) {
712
- for (let n in t) e[n] = (e[n] || 0) - (t[n] || 0);
713
- }
714
- function N(e) {
715
- return typeof e == "boolean" || typeof e == "number" || e === null ? !e : (0, t._)`!${z(e)}`;
716
- }
717
- e.not = N;
718
- var P = R(e.operators.AND);
719
- function F(...e) {
720
- return e.reduce(P);
721
- }
722
- e.and = F;
723
- var I = R(e.operators.OR);
724
- function L(...e) {
725
- return e.reduce(I);
726
- }
727
- e.or = L;
728
- function R(e) {
729
- return (n, r) => n === t.nil ? r : r === t.nil ? n : (0, t._)`${z(n)} ${e} ${z(r)}`;
730
- }
731
- function z(e) {
732
- return e instanceof t.Name ? e : (0, t._)`(${e})`;
733
- }
734
- })), s = /* @__PURE__ */ r(((e) => {
735
- Object.defineProperty(e, "__esModule", { value: !0 }), e.checkStrictMode = e.getErrorPath = e.Type = e.useFunc = e.setEvaluated = e.evaluatedPropsToName = e.mergeEvaluated = e.eachItem = e.unescapeJsonPointer = e.escapeJsonPointer = e.escapeFragment = e.unescapeFragment = e.schemaRefOrVal = e.schemaHasRulesButRef = e.schemaHasRules = e.checkUnknownRules = e.alwaysValidSchema = e.toHash = void 0;
736
- var t = o(), n = i();
737
- function r(e) {
738
- let t = {};
739
- for (let n of e) t[n] = !0;
740
- return t;
741
- }
742
- e.toHash = r;
743
- function a(e, t) {
744
- return typeof t == "boolean" ? t : Object.keys(t).length === 0 ? !0 : (s(e, t), !c(t, e.self.RULES.all));
745
- }
746
- e.alwaysValidSchema = a;
747
- function s(e, t = e.schema) {
748
- let { opts: n, self: r } = e;
749
- if (!n.strictSchema || typeof t == "boolean") return;
750
- let i = r.RULES.keywords;
751
- for (let n in t) i[n] || C(e, `unknown keyword: "${n}"`);
752
- }
753
- e.checkUnknownRules = s;
754
- function c(e, t) {
755
- if (typeof e == "boolean") return !e;
756
- for (let n in e) if (t[n]) return !0;
757
- return !1;
758
- }
759
- e.schemaHasRules = c;
760
- function l(e, t) {
761
- if (typeof e == "boolean") return !e;
762
- for (let n in e) if (n !== "$ref" && t.all[n]) return !0;
763
- return !1;
764
- }
765
- e.schemaHasRulesButRef = l;
766
- function u({ topSchemaRef: e, schemaPath: n }, r, i, a) {
767
- if (!a) {
768
- if (typeof r == "number" || typeof r == "boolean") return r;
769
- if (typeof r == "string") return (0, t._)`${r}`;
770
- }
771
- return (0, t._)`${e}${n}${(0, t.getProperty)(i)}`;
772
- }
773
- e.schemaRefOrVal = u;
774
- function d(e) {
775
- return m(decodeURIComponent(e));
776
- }
777
- e.unescapeFragment = d;
778
- function f(e) {
779
- return encodeURIComponent(p(e));
780
- }
781
- e.escapeFragment = f;
782
- function p(e) {
783
- return typeof e == "number" ? `${e}` : e.replace(/~/g, "~0").replace(/\//g, "~1");
784
- }
785
- e.escapeJsonPointer = p;
786
- function m(e) {
787
- return e.replace(/~1/g, "/").replace(/~0/g, "~");
788
- }
789
- e.unescapeJsonPointer = m;
790
- function h(e, t) {
791
- if (Array.isArray(e)) for (let n of e) t(n);
792
- else t(e);
793
- }
794
- e.eachItem = h;
795
- function g({ mergeNames: e, mergeToName: n, mergeValues: r, resultToName: i }) {
796
- return (a, o, s, c) => {
797
- let l = s === void 0 ? o : s instanceof t.Name ? (o instanceof t.Name ? e(a, o, s) : n(a, o, s), s) : o instanceof t.Name ? (n(a, s, o), o) : r(o, s);
798
- return c === t.Name && !(l instanceof t.Name) ? i(a, l) : l;
799
- };
800
- }
801
- e.mergeEvaluated = {
802
- props: g({
803
- mergeNames: (e, n, r) => e.if((0, t._)`${r} !== true && ${n} !== undefined`, () => {
804
- e.if((0, t._)`${n} === true`, () => e.assign(r, !0), () => e.assign(r, (0, t._)`${r} || {}`).code((0, t._)`Object.assign(${r}, ${n})`));
805
- }),
806
- mergeToName: (e, n, r) => e.if((0, t._)`${r} !== true`, () => {
807
- n === !0 ? e.assign(r, !0) : (e.assign(r, (0, t._)`${r} || {}`), v(e, r, n));
808
- }),
809
- mergeValues: (e, t) => e === !0 ? !0 : {
810
- ...e,
811
- ...t
812
- },
813
- resultToName: _
814
- }),
815
- items: g({
816
- mergeNames: (e, n, r) => e.if((0, t._)`${r} !== true && ${n} !== undefined`, () => e.assign(r, (0, t._)`${n} === true ? true : ${r} > ${n} ? ${r} : ${n}`)),
817
- mergeToName: (e, n, r) => e.if((0, t._)`${r} !== true`, () => e.assign(r, n === !0 ? !0 : (0, t._)`${r} > ${n} ? ${r} : ${n}`)),
818
- mergeValues: (e, t) => e === !0 ? !0 : Math.max(e, t),
819
- resultToName: (e, t) => e.var("items", t)
820
- })
821
- };
822
- function _(e, n) {
823
- if (n === !0) return e.var("props", !0);
824
- let r = e.var("props", (0, t._)`{}`);
825
- return n !== void 0 && v(e, r, n), r;
826
- }
827
- e.evaluatedPropsToName = _;
828
- function v(e, n, r) {
829
- Object.keys(r).forEach((r) => e.assign((0, t._)`${n}${(0, t.getProperty)(r)}`, !0));
830
- }
831
- e.setEvaluated = v;
832
- var y = {};
833
- function b(e, t) {
834
- return e.scopeValue("func", {
835
- ref: t,
836
- code: y[t.code] || (y[t.code] = new n._Code(t.code))
837
- });
838
- }
839
- e.useFunc = b;
840
- var x;
841
- (function(e) {
842
- e[e.Num = 0] = "Num", e[e.Str = 1] = "Str";
843
- })(x || (e.Type = x = {}));
844
- function S(e, n, r) {
845
- if (e instanceof t.Name) {
846
- let i = n === x.Num;
847
- return r ? i ? (0, t._)`"[" + ${e} + "]"` : (0, t._)`"['" + ${e} + "']"` : i ? (0, t._)`"/" + ${e}` : (0, t._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
848
- }
849
- return r ? (0, t.getProperty)(e).toString() : "/" + p(e);
850
- }
851
- e.getErrorPath = S;
852
- function C(e, t, n = e.opts.strictSchema) {
853
- if (n) {
854
- if (t = `strict mode: ${t}`, n === !0) throw Error(t);
855
- e.self.logger.warn(t);
856
- }
857
- }
858
- e.checkStrictMode = C;
859
- })), c = /* @__PURE__ */ r(((e) => {
860
- Object.defineProperty(e, "__esModule", { value: !0 });
861
- var t = o();
862
- e.default = {
863
- data: new t.Name("data"),
864
- valCxt: new t.Name("valCxt"),
865
- instancePath: new t.Name("instancePath"),
866
- parentData: new t.Name("parentData"),
867
- parentDataProperty: new t.Name("parentDataProperty"),
868
- rootData: new t.Name("rootData"),
869
- dynamicAnchors: new t.Name("dynamicAnchors"),
870
- vErrors: new t.Name("vErrors"),
871
- errors: new t.Name("errors"),
872
- this: new t.Name("this"),
873
- self: new t.Name("self"),
874
- scope: new t.Name("scope"),
875
- json: new t.Name("json"),
876
- jsonPos: new t.Name("jsonPos"),
877
- jsonLen: new t.Name("jsonLen"),
878
- jsonPart: new t.Name("jsonPart")
879
- };
880
- })), l = /* @__PURE__ */ r(((e) => {
881
- Object.defineProperty(e, "__esModule", { value: !0 }), e.extendErrors = e.resetErrorsCount = e.reportExtraError = e.reportError = e.keyword$DataError = e.keywordError = void 0;
882
- var t = o(), n = s(), r = c();
883
- e.keywordError = { message: ({ keyword: e }) => (0, t.str)`must pass "${e}" keyword validation` }, e.keyword$DataError = { message: ({ keyword: e, schemaType: n }) => n ? (0, t.str)`"${e}" keyword must be ${n} ($data)` : (0, t.str)`"${e}" keyword is invalid ($data)` };
884
- function i(n, r = e.keywordError, i, a) {
885
- let { it: o } = n, { gen: s, compositeRule: c, allErrors: l } = o, u = m(n, r, i);
886
- a ?? (c || l) ? d(s, u) : f(o, (0, t._)`[${u}]`);
887
- }
888
- e.reportError = i;
889
- function a(t, n = e.keywordError, i) {
890
- let { it: a } = t, { gen: o, compositeRule: s, allErrors: c } = a;
891
- d(o, m(t, n, i)), s || c || f(a, r.default.vErrors);
892
- }
893
- e.reportExtraError = a;
894
- function l(e, n) {
895
- e.assign(r.default.errors, n), e.if((0, t._)`${r.default.vErrors} !== null`, () => e.if(n, () => e.assign((0, t._)`${r.default.vErrors}.length`, n), () => e.assign(r.default.vErrors, null)));
896
- }
897
- e.resetErrorsCount = l;
898
- function u({ gen: e, keyword: n, schemaValue: i, data: a, errsCount: o, it: s }) {
899
- /* istanbul ignore if */
900
- if (o === void 0) throw Error("ajv implementation error");
901
- let c = e.name("err");
902
- e.forRange("i", o, r.default.errors, (o) => {
903
- e.const(c, (0, t._)`${r.default.vErrors}[${o}]`), e.if((0, t._)`${c}.instancePath === undefined`, () => e.assign((0, t._)`${c}.instancePath`, (0, t.strConcat)(r.default.instancePath, s.errorPath))), e.assign((0, t._)`${c}.schemaPath`, (0, t.str)`${s.errSchemaPath}/${n}`), s.opts.verbose && (e.assign((0, t._)`${c}.schema`, i), e.assign((0, t._)`${c}.data`, a));
904
- });
905
- }
906
- e.extendErrors = u;
907
- function d(e, n) {
908
- let i = e.const("err", n);
909
- e.if((0, t._)`${r.default.vErrors} === null`, () => e.assign(r.default.vErrors, (0, t._)`[${i}]`), (0, t._)`${r.default.vErrors}.push(${i})`), e.code((0, t._)`${r.default.errors}++`);
910
- }
911
- function f(e, n) {
912
- let { gen: r, validateName: i, schemaEnv: a } = e;
913
- a.$async ? r.throw((0, t._)`new ${e.ValidationError}(${n})`) : (r.assign((0, t._)`${i}.errors`, n), r.return(!1));
914
- }
915
- var p = {
916
- keyword: new t.Name("keyword"),
917
- schemaPath: new t.Name("schemaPath"),
918
- params: new t.Name("params"),
919
- propertyName: new t.Name("propertyName"),
920
- message: new t.Name("message"),
921
- schema: new t.Name("schema"),
922
- parentSchema: new t.Name("parentSchema")
923
- };
924
- function m(e, n, r) {
925
- let { createErrors: i } = e.it;
926
- return i === !1 ? (0, t._)`{}` : h(e, n, r);
927
- }
928
- function h(e, t, n = {}) {
929
- let { gen: r, it: i } = e, a = [g(i, n), _(e, n)];
930
- return v(e, t, a), r.object(...a);
931
- }
932
- function g({ errorPath: e }, { instancePath: i }) {
933
- let a = i ? (0, t.str)`${e}${(0, n.getErrorPath)(i, n.Type.Str)}` : e;
934
- return [r.default.instancePath, (0, t.strConcat)(r.default.instancePath, a)];
935
- }
936
- function _({ keyword: e, it: { errSchemaPath: r } }, { schemaPath: i, parentSchema: a }) {
937
- let o = a ? r : (0, t.str)`${r}/${e}`;
938
- return i && (o = (0, t.str)`${o}${(0, n.getErrorPath)(i, n.Type.Str)}`), [p.schemaPath, o];
939
- }
940
- function v(e, { params: n, message: i }, a) {
941
- let { keyword: o, data: s, schemaValue: c, it: l } = e, { opts: u, propertyName: d, topSchemaRef: f, schemaPath: m } = l;
942
- a.push([p.keyword, o], [p.params, typeof n == "function" ? n(e) : n || (0, t._)`{}`]), u.messages && a.push([p.message, typeof i == "function" ? i(e) : i]), u.verbose && a.push([p.schema, c], [p.parentSchema, (0, t._)`${f}${m}`], [r.default.data, s]), d && a.push([p.propertyName, d]);
943
- }
944
- })), u = /* @__PURE__ */ r(((e) => {
945
- Object.defineProperty(e, "__esModule", { value: !0 }), e.boolOrEmptySchema = e.topBoolOrEmptySchema = void 0;
946
- var t = l(), n = o(), r = c(), i = { message: "boolean schema is false" };
947
- function a(e) {
948
- let { gen: t, schema: i, validateName: a } = e;
949
- i === !1 ? u(e, !1) : typeof i == "object" && i.$async === !0 ? t.return(r.default.data) : (t.assign((0, n._)`${a}.errors`, null), t.return(!0));
950
- }
951
- e.topBoolOrEmptySchema = a;
952
- function s(e, t) {
953
- let { gen: n, schema: r } = e;
954
- r === !1 ? (n.var(t, !1), u(e)) : n.var(t, !0);
955
- }
956
- e.boolOrEmptySchema = s;
957
- function u(e, n) {
958
- let { gen: r, data: a } = e, o = {
959
- gen: r,
960
- keyword: "false schema",
961
- data: a,
962
- schema: !1,
963
- schemaCode: !1,
964
- schemaValue: !1,
965
- params: {},
966
- it: e
967
- };
968
- (0, t.reportError)(o, i, void 0, n);
969
- }
970
- })), d = /* @__PURE__ */ r(((e) => {
971
- Object.defineProperty(e, "__esModule", { value: !0 }), e.getRules = e.isJSONType = void 0;
972
- var t = new Set([
973
- "string",
974
- "number",
975
- "integer",
976
- "boolean",
977
- "null",
978
- "object",
979
- "array"
980
- ]);
981
- function n(e) {
982
- return typeof e == "string" && t.has(e);
983
- }
984
- e.isJSONType = n;
985
- function r() {
986
- let e = {
987
- number: {
988
- type: "number",
989
- rules: []
990
- },
991
- string: {
992
- type: "string",
993
- rules: []
994
- },
995
- array: {
996
- type: "array",
997
- rules: []
998
- },
999
- object: {
1000
- type: "object",
1001
- rules: []
1002
- }
1003
- };
1004
- return {
1005
- types: {
1006
- ...e,
1007
- integer: !0,
1008
- boolean: !0,
1009
- null: !0
1010
- },
1011
- rules: [
1012
- { rules: [] },
1013
- e.number,
1014
- e.string,
1015
- e.array,
1016
- e.object
1017
- ],
1018
- post: { rules: [] },
1019
- all: {},
1020
- keywords: {}
1021
- };
1022
- }
1023
- e.getRules = r;
1024
- })), f = /* @__PURE__ */ r(((e) => {
1025
- Object.defineProperty(e, "__esModule", { value: !0 }), e.shouldUseRule = e.shouldUseGroup = e.schemaHasRulesForType = void 0;
1026
- function t({ schema: e, self: t }, r) {
1027
- let i = t.RULES.types[r];
1028
- return i && i !== !0 && n(e, i);
1029
- }
1030
- e.schemaHasRulesForType = t;
1031
- function n(e, t) {
1032
- return t.rules.some((t) => r(e, t));
1033
- }
1034
- e.shouldUseGroup = n;
1035
- function r(e, t) {
1036
- return e[t.keyword] !== void 0 || t.definition.implements?.some((t) => e[t] !== void 0);
1037
- }
1038
- e.shouldUseRule = r;
1039
- })), p = /* @__PURE__ */ r(((e) => {
1040
- Object.defineProperty(e, "__esModule", { value: !0 }), e.reportTypeError = e.checkDataTypes = e.checkDataType = e.coerceAndCheckDataType = e.getJSONTypes = e.getSchemaTypes = e.DataType = void 0;
1041
- var t = d(), n = f(), r = l(), i = o(), a = s(), c;
1042
- (function(e) {
1043
- e[e.Correct = 0] = "Correct", e[e.Wrong = 1] = "Wrong";
1044
- })(c || (e.DataType = c = {}));
1045
- function u(e) {
1046
- let t = p(e.type);
1047
- if (t.includes("null")) {
1048
- if (e.nullable === !1) throw Error("type: null contradicts nullable: false");
1049
- } else {
1050
- if (!t.length && e.nullable !== void 0) throw Error("\"nullable\" cannot be used without \"type\"");
1051
- e.nullable === !0 && t.push("null");
1052
- }
1053
- return t;
1054
- }
1055
- e.getSchemaTypes = u;
1056
- function p(e) {
1057
- let n = Array.isArray(e) ? e : e ? [e] : [];
1058
- if (n.every(t.isJSONType)) return n;
1059
- throw Error("type must be JSONType or JSONType[]: " + n.join(","));
1060
- }
1061
- e.getJSONTypes = p;
1062
- function m(e, t) {
1063
- let { gen: r, data: i, opts: a } = e, o = g(t, a.coerceTypes), s = t.length > 0 && !(o.length === 0 && t.length === 1 && (0, n.schemaHasRulesForType)(e, t[0]));
1064
- if (s) {
1065
- let n = b(t, i, a.strictNumbers, c.Wrong);
1066
- r.if(n, () => {
1067
- o.length ? _(e, t, o) : S(e);
1068
- });
1069
- }
1070
- return s;
1071
- }
1072
- e.coerceAndCheckDataType = m;
1073
- var h = new Set([
1074
- "string",
1075
- "number",
1076
- "integer",
1077
- "boolean",
1078
- "null"
1079
- ]);
1080
- function g(e, t) {
1081
- return t ? e.filter((e) => h.has(e) || t === "array" && e === "array") : [];
1082
- }
1083
- function _(e, t, n) {
1084
- let { gen: r, data: a, opts: o } = e, s = r.let("dataType", (0, i._)`typeof ${a}`), c = r.let("coerced", (0, i._)`undefined`);
1085
- o.coerceTypes === "array" && r.if((0, i._)`${s} == 'object' && Array.isArray(${a}) && ${a}.length == 1`, () => r.assign(a, (0, i._)`${a}[0]`).assign(s, (0, i._)`typeof ${a}`).if(b(t, a, o.strictNumbers), () => r.assign(c, a))), r.if((0, i._)`${c} !== undefined`);
1086
- for (let e of n) (h.has(e) || e === "array" && o.coerceTypes === "array") && l(e);
1087
- r.else(), S(e), r.endIf(), r.if((0, i._)`${c} !== undefined`, () => {
1088
- r.assign(a, c), v(e, c);
1089
- });
1090
- function l(e) {
1091
- switch (e) {
1092
- case "string":
1093
- r.elseIf((0, i._)`${s} == "number" || ${s} == "boolean"`).assign(c, (0, i._)`"" + ${a}`).elseIf((0, i._)`${a} === null`).assign(c, (0, i._)`""`);
1094
- return;
1095
- case "number":
1096
- r.elseIf((0, i._)`${s} == "boolean" || ${a} === null
1097
- || (${s} == "string" && ${a} && ${a} == +${a})`).assign(c, (0, i._)`+${a}`);
1098
- return;
1099
- case "integer":
1100
- r.elseIf((0, i._)`${s} === "boolean" || ${a} === null
1101
- || (${s} === "string" && ${a} && ${a} == +${a} && !(${a} % 1))`).assign(c, (0, i._)`+${a}`);
1102
- return;
1103
- case "boolean":
1104
- r.elseIf((0, i._)`${a} === "false" || ${a} === 0 || ${a} === null`).assign(c, !1).elseIf((0, i._)`${a} === "true" || ${a} === 1`).assign(c, !0);
1105
- return;
1106
- case "null":
1107
- r.elseIf((0, i._)`${a} === "" || ${a} === 0 || ${a} === false`), r.assign(c, null);
1108
- return;
1109
- case "array": r.elseIf((0, i._)`${s} === "string" || ${s} === "number"
1110
- || ${s} === "boolean" || ${a} === null`).assign(c, (0, i._)`[${a}]`);
1111
- }
1112
- }
1113
- }
1114
- function v({ gen: e, parentData: t, parentDataProperty: n }, r) {
1115
- e.if((0, i._)`${t} !== undefined`, () => e.assign((0, i._)`${t}[${n}]`, r));
1116
- }
1117
- function y(e, t, n, r = c.Correct) {
1118
- let a = r === c.Correct ? i.operators.EQ : i.operators.NEQ, o;
1119
- switch (e) {
1120
- case "null": return (0, i._)`${t} ${a} null`;
1121
- case "array":
1122
- o = (0, i._)`Array.isArray(${t})`;
1123
- break;
1124
- case "object":
1125
- o = (0, i._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;
1126
- break;
1127
- case "integer":
1128
- o = s((0, i._)`!(${t} % 1) && !isNaN(${t})`);
1129
- break;
1130
- case "number":
1131
- o = s();
1132
- break;
1133
- default: return (0, i._)`typeof ${t} ${a} ${e}`;
1134
- }
1135
- return r === c.Correct ? o : (0, i.not)(o);
1136
- function s(e = i.nil) {
1137
- return (0, i.and)((0, i._)`typeof ${t} == "number"`, e, n ? (0, i._)`isFinite(${t})` : i.nil);
1138
- }
1139
- }
1140
- e.checkDataType = y;
1141
- function b(e, t, n, r) {
1142
- if (e.length === 1) return y(e[0], t, n, r);
1143
- let o, s = (0, a.toHash)(e);
1144
- if (s.array && s.object) {
1145
- let e = (0, i._)`typeof ${t} != "object"`;
1146
- o = s.null ? e : (0, i._)`!${t} || ${e}`, delete s.null, delete s.array, delete s.object;
1147
- } else o = i.nil;
1148
- s.number && delete s.integer;
1149
- for (let e in s) o = (0, i.and)(o, y(e, t, n, r));
1150
- return o;
1151
- }
1152
- e.checkDataTypes = b;
1153
- var x = {
1154
- message: ({ schema: e }) => `must be ${e}`,
1155
- params: ({ schema: e, schemaValue: t }) => typeof e == "string" ? (0, i._)`{type: ${e}}` : (0, i._)`{type: ${t}}`
1156
- };
1157
- function S(e) {
1158
- let t = C(e);
1159
- (0, r.reportError)(t, x);
1160
- }
1161
- e.reportTypeError = S;
1162
- function C(e) {
1163
- let { gen: t, data: n, schema: r } = e, i = (0, a.schemaRefOrVal)(e, r, "type");
1164
- return {
1165
- gen: t,
1166
- keyword: "type",
1167
- data: n,
1168
- schema: r.type,
1169
- schemaCode: i,
1170
- schemaValue: i,
1171
- parentSchema: r,
1172
- params: {},
1173
- it: e
1174
- };
1175
- }
1176
- })), m = /* @__PURE__ */ r(((e) => {
1177
- Object.defineProperty(e, "__esModule", { value: !0 }), e.assignDefaults = void 0;
1178
- var t = o(), n = s();
1179
- function r(e, t) {
1180
- let { properties: n, items: r } = e.schema;
1181
- if (t === "object" && n) for (let t in n) i(e, t, n[t].default);
1182
- else t === "array" && Array.isArray(r) && r.forEach((t, n) => i(e, n, t.default));
1183
- }
1184
- e.assignDefaults = r;
1185
- function i(e, r, i) {
1186
- let { gen: a, compositeRule: o, data: s, opts: c } = e;
1187
- if (i === void 0) return;
1188
- let l = (0, t._)`${s}${(0, t.getProperty)(r)}`;
1189
- if (o) {
1190
- (0, n.checkStrictMode)(e, `default is ignored for: ${l}`);
1191
- return;
1192
- }
1193
- let u = (0, t._)`${l} === undefined`;
1194
- c.useDefaults === "empty" && (u = (0, t._)`${u} || ${l} === null || ${l} === ""`), a.if(u, (0, t._)`${l} = ${(0, t.stringify)(i)}`);
1195
- }
1196
- })), h = /* @__PURE__ */ r(((e) => {
1197
- Object.defineProperty(e, "__esModule", { value: !0 }), e.validateUnion = e.validateArray = e.usePattern = e.callValidateCode = e.schemaProperties = e.allSchemaProperties = e.noPropertyInData = e.propertyInData = e.isOwnProperty = e.hasPropFunc = e.reportMissingProp = e.checkMissingProp = e.checkReportMissingProp = void 0;
1198
- var t = o(), n = s(), r = c(), i = s();
1199
- function a(e, n) {
1200
- let { gen: r, data: i, it: a } = e;
1201
- r.if(m(r, i, n, a.opts.ownProperties), () => {
1202
- e.setParams({ missingProperty: (0, t._)`${n}` }, !0), e.error();
1203
- });
1204
- }
1205
- e.checkReportMissingProp = a;
1206
- function l({ gen: e, data: n, it: { opts: r } }, i, a) {
1207
- return (0, t.or)(...i.map((i) => (0, t.and)(m(e, n, i, r.ownProperties), (0, t._)`${a} = ${i}`)));
1208
- }
1209
- e.checkMissingProp = l;
1210
- function u(e, t) {
1211
- e.setParams({ missingProperty: t }, !0), e.error();
1212
- }
1213
- e.reportMissingProp = u;
1214
- function d(e) {
1215
- return e.scopeValue("func", {
1216
- ref: Object.prototype.hasOwnProperty,
1217
- code: (0, t._)`Object.prototype.hasOwnProperty`
1218
- });
1219
- }
1220
- e.hasPropFunc = d;
1221
- function f(e, n, r) {
1222
- return (0, t._)`${d(e)}.call(${n}, ${r})`;
1223
- }
1224
- e.isOwnProperty = f;
1225
- function p(e, n, r, i) {
1226
- let a = (0, t._)`${n}${(0, t.getProperty)(r)} !== undefined`;
1227
- return i ? (0, t._)`${a} && ${f(e, n, r)}` : a;
1228
- }
1229
- e.propertyInData = p;
1230
- function m(e, n, r, i) {
1231
- let a = (0, t._)`${n}${(0, t.getProperty)(r)} === undefined`;
1232
- return i ? (0, t.or)(a, (0, t.not)(f(e, n, r))) : a;
1233
- }
1234
- e.noPropertyInData = m;
1235
- function h(e) {
1236
- return e ? Object.keys(e).filter((e) => e !== "__proto__") : [];
1237
- }
1238
- e.allSchemaProperties = h;
1239
- function g(e, t) {
1240
- return h(t).filter((r) => !(0, n.alwaysValidSchema)(e, t[r]));
1241
- }
1242
- e.schemaProperties = g;
1243
- function _({ schemaCode: e, data: n, it: { gen: i, topSchemaRef: a, schemaPath: o, errorPath: s }, it: c }, l, u, d) {
1244
- let f = d ? (0, t._)`${e}, ${n}, ${a}${o}` : n, p = [
1245
- [r.default.instancePath, (0, t.strConcat)(r.default.instancePath, s)],
1246
- [r.default.parentData, c.parentData],
1247
- [r.default.parentDataProperty, c.parentDataProperty],
1248
- [r.default.rootData, r.default.rootData]
1249
- ];
1250
- c.opts.dynamicRef && p.push([r.default.dynamicAnchors, r.default.dynamicAnchors]);
1251
- let m = (0, t._)`${f}, ${i.object(...p)}`;
1252
- return u === t.nil ? (0, t._)`${l}(${m})` : (0, t._)`${l}.call(${u}, ${m})`;
1253
- }
1254
- e.callValidateCode = _;
1255
- var v = (0, t._)`new RegExp`;
1256
- function y({ gen: e, it: { opts: n } }, r) {
1257
- let a = n.unicodeRegExp ? "u" : "", { regExp: o } = n.code, s = o(r, a);
1258
- return e.scopeValue("pattern", {
1259
- key: s.toString(),
1260
- ref: s,
1261
- code: (0, t._)`${o.code === "new RegExp" ? v : (0, i.useFunc)(e, o)}(${r}, ${a})`
1262
- });
1263
- }
1264
- e.usePattern = y;
1265
- function b(e) {
1266
- let { gen: r, data: i, keyword: a, it: o } = e, s = r.name("valid");
1267
- if (o.allErrors) {
1268
- let e = r.let("valid", !0);
1269
- return c(() => r.assign(e, !1)), e;
1270
- }
1271
- return r.var(s, !0), c(() => r.break()), s;
1272
- function c(o) {
1273
- let c = r.const("len", (0, t._)`${i}.length`);
1274
- r.forRange("i", 0, c, (i) => {
1275
- e.subschema({
1276
- keyword: a,
1277
- dataProp: i,
1278
- dataPropType: n.Type.Num
1279
- }, s), r.if((0, t.not)(s), o);
1280
- });
1281
- }
1282
- }
1283
- e.validateArray = b;
1284
- function x(e) {
1285
- let { gen: r, schema: i, keyword: a, it: o } = e;
1286
- /* istanbul ignore if */
1287
- if (!Array.isArray(i)) throw Error("ajv implementation error");
1288
- if (i.some((e) => (0, n.alwaysValidSchema)(o, e)) && !o.opts.unevaluated) return;
1289
- let s = r.let("valid", !1), c = r.name("_valid");
1290
- r.block(() => i.forEach((n, i) => {
1291
- let o = e.subschema({
1292
- keyword: a,
1293
- schemaProp: i,
1294
- compositeRule: !0
1295
- }, c);
1296
- r.assign(s, (0, t._)`${s} || ${c}`), e.mergeValidEvaluated(o, c) || r.if((0, t.not)(s));
1297
- })), e.result(s, () => e.reset(), () => e.error(!0));
1298
- }
1299
- e.validateUnion = x;
1300
- })), g = /* @__PURE__ */ r(((e) => {
1301
- Object.defineProperty(e, "__esModule", { value: !0 }), e.validateKeywordUsage = e.validSchemaType = e.funcKeywordCode = e.macroKeywordCode = void 0;
1302
- var t = o(), n = c(), r = h(), i = l();
1303
- function a(e, n) {
1304
- let { gen: r, keyword: i, schema: a, parentSchema: o, it: s } = e, c = n.macro.call(s.self, a, o, s), l = p(r, i, c);
1305
- s.opts.validateSchema !== !1 && s.self.validateSchema(c, !0);
1306
- let u = r.name("valid");
1307
- e.subschema({
1308
- schema: c,
1309
- schemaPath: t.nil,
1310
- errSchemaPath: `${s.errSchemaPath}/${i}`,
1311
- topSchemaRef: l,
1312
- compositeRule: !0
1313
- }, u), e.pass(u, () => e.error(!0));
1314
- }
1315
- e.macroKeywordCode = a;
1316
- function s(e, i) {
1317
- let { gen: a, keyword: o, schema: s, parentSchema: c, $data: l, it: m } = e;
1318
- f(m, i);
1319
- let h = p(a, o, !l && i.compile ? i.compile.call(m.self, s, c, m) : i.validate), g = a.let("valid");
1320
- e.block$data(g, _), e.ok(i.valid ?? g);
1321
- function _() {
1322
- if (i.errors === !1) b(), i.modifying && u(e), x(() => e.error());
1323
- else {
1324
- let t = i.async ? v() : y();
1325
- i.modifying && u(e), x(() => d(e, t));
1326
- }
1327
- }
1328
- function v() {
1329
- let e = a.let("ruleErrs", null);
1330
- return a.try(() => b((0, t._)`await `), (n) => a.assign(g, !1).if((0, t._)`${n} instanceof ${m.ValidationError}`, () => a.assign(e, (0, t._)`${n}.errors`), () => a.throw(n))), e;
1331
- }
1332
- function y() {
1333
- let e = (0, t._)`${h}.errors`;
1334
- return a.assign(e, null), b(t.nil), e;
1335
- }
1336
- function b(o = i.async ? (0, t._)`await ` : t.nil) {
1337
- let s = m.opts.passContext ? n.default.this : n.default.self, c = !("compile" in i && !l || i.schema === !1);
1338
- a.assign(g, (0, t._)`${o}${(0, r.callValidateCode)(e, h, s, c)}`, i.modifying);
1339
- }
1340
- function x(e) {
1341
- a.if((0, t.not)(i.valid ?? g), e);
1342
- }
1343
- }
1344
- e.funcKeywordCode = s;
1345
- function u(e) {
1346
- let { gen: n, data: r, it: i } = e;
1347
- n.if(i.parentData, () => n.assign(r, (0, t._)`${i.parentData}[${i.parentDataProperty}]`));
1348
- }
1349
- function d(e, r) {
1350
- let { gen: a } = e;
1351
- a.if((0, t._)`Array.isArray(${r})`, () => {
1352
- a.assign(n.default.vErrors, (0, t._)`${n.default.vErrors} === null ? ${r} : ${n.default.vErrors}.concat(${r})`).assign(n.default.errors, (0, t._)`${n.default.vErrors}.length`), (0, i.extendErrors)(e);
1353
- }, () => e.error());
1354
- }
1355
- function f({ schemaEnv: e }, t) {
1356
- if (t.async && !e.$async) throw Error("async keyword in sync schema");
1357
- }
1358
- function p(e, n, r) {
1359
- if (r === void 0) throw Error(`keyword "${n}" failed to compile`);
1360
- return e.scopeValue("keyword", typeof r == "function" ? { ref: r } : {
1361
- ref: r,
1362
- code: (0, t.stringify)(r)
1363
- });
1364
- }
1365
- function m(e, t, n = !1) {
1366
- return !t.length || t.some((t) => t === "array" ? Array.isArray(e) : t === "object" ? e && typeof e == "object" && !Array.isArray(e) : typeof e == t || n && e === void 0);
1367
- }
1368
- e.validSchemaType = m;
1369
- function g({ schema: e, opts: t, self: n, errSchemaPath: r }, i, a) {
1370
- /* istanbul ignore if */
1371
- if (Array.isArray(i.keyword) ? !i.keyword.includes(a) : i.keyword !== a) throw Error("ajv implementation error");
1372
- let o = i.dependencies;
1373
- if (o?.some((t) => !Object.prototype.hasOwnProperty.call(e, t))) throw Error(`parent schema must have dependencies of ${a}: ${o.join(",")}`);
1374
- if (i.validateSchema && !i.validateSchema(e[a])) {
1375
- let e = `keyword "${a}" value is invalid at path "${r}": ` + n.errorsText(i.validateSchema.errors);
1376
- if (t.validateSchema === "log") n.logger.error(e);
1377
- else throw Error(e);
1378
- }
1379
- }
1380
- e.validateKeywordUsage = g;
1381
- })), _ = /* @__PURE__ */ r(((e) => {
1382
- Object.defineProperty(e, "__esModule", { value: !0 }), e.extendSubschemaMode = e.extendSubschemaData = e.getSubschema = void 0;
1383
- var t = o(), n = s();
1384
- function r(e, { keyword: r, schemaProp: i, schema: a, schemaPath: o, errSchemaPath: s, topSchemaRef: c }) {
1385
- if (r !== void 0 && a !== void 0) throw Error("both \"keyword\" and \"schema\" passed, only one allowed");
1386
- if (r !== void 0) {
1387
- let a = e.schema[r];
1388
- return i === void 0 ? {
1389
- schema: a,
1390
- schemaPath: (0, t._)`${e.schemaPath}${(0, t.getProperty)(r)}`,
1391
- errSchemaPath: `${e.errSchemaPath}/${r}`
1392
- } : {
1393
- schema: a[i],
1394
- schemaPath: (0, t._)`${e.schemaPath}${(0, t.getProperty)(r)}${(0, t.getProperty)(i)}`,
1395
- errSchemaPath: `${e.errSchemaPath}/${r}/${(0, n.escapeFragment)(i)}`
1396
- };
1397
- }
1398
- if (a !== void 0) {
1399
- if (o === void 0 || s === void 0 || c === void 0) throw Error("\"schemaPath\", \"errSchemaPath\" and \"topSchemaRef\" are required with \"schema\"");
1400
- return {
1401
- schema: a,
1402
- schemaPath: o,
1403
- topSchemaRef: c,
1404
- errSchemaPath: s
1405
- };
1406
- }
1407
- throw Error("either \"keyword\" or \"schema\" must be passed");
1408
- }
1409
- e.getSubschema = r;
1410
- function i(e, r, { dataProp: i, dataPropType: a, data: o, dataTypes: s, propertyName: c }) {
1411
- if (o !== void 0 && i !== void 0) throw Error("both \"data\" and \"dataProp\" passed, only one allowed");
1412
- let { gen: l } = r;
1413
- if (i !== void 0) {
1414
- let { errorPath: o, dataPathArr: s, opts: c } = r;
1415
- u(l.let("data", (0, t._)`${r.data}${(0, t.getProperty)(i)}`, !0)), e.errorPath = (0, t.str)`${o}${(0, n.getErrorPath)(i, a, c.jsPropertySyntax)}`, e.parentDataProperty = (0, t._)`${i}`, e.dataPathArr = [...s, e.parentDataProperty];
1416
- }
1417
- o !== void 0 && (u(o instanceof t.Name ? o : l.let("data", o, !0)), c !== void 0 && (e.propertyName = c)), s && (e.dataTypes = s);
1418
- function u(t) {
1419
- e.data = t, e.dataLevel = r.dataLevel + 1, e.dataTypes = [], r.definedProperties = /* @__PURE__ */ new Set(), e.parentData = r.data, e.dataNames = [...r.dataNames, t];
1420
- }
1421
- }
1422
- e.extendSubschemaData = i;
1423
- function a(e, { jtdDiscriminator: t, jtdMetadata: n, compositeRule: r, createErrors: i, allErrors: a }) {
1424
- r !== void 0 && (e.compositeRule = r), i !== void 0 && (e.createErrors = i), a !== void 0 && (e.allErrors = a), e.jtdDiscriminator = t, e.jtdMetadata = n;
1425
- }
1426
- e.extendSubschemaMode = a;
1427
- })), v = /* @__PURE__ */ r(((e, t) => {
1428
- t.exports = function e(t, n) {
1429
- if (t === n) return !0;
1430
- if (t && n && typeof t == "object" && typeof n == "object") {
1431
- if (t.constructor !== n.constructor) return !1;
1432
- var r, i, a;
1433
- if (Array.isArray(t)) {
1434
- if (r = t.length, r != n.length) return !1;
1435
- for (i = r; i-- !== 0;) if (!e(t[i], n[i])) return !1;
1436
- return !0;
1437
- }
1438
- if (t.constructor === RegExp) return t.source === n.source && t.flags === n.flags;
1439
- if (t.valueOf !== Object.prototype.valueOf) return t.valueOf() === n.valueOf();
1440
- if (t.toString !== Object.prototype.toString) return t.toString() === n.toString();
1441
- if (a = Object.keys(t), r = a.length, r !== Object.keys(n).length) return !1;
1442
- for (i = r; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(n, a[i])) return !1;
1443
- for (i = r; i-- !== 0;) {
1444
- var o = a[i];
1445
- if (!e(t[o], n[o])) return !1;
1446
- }
1447
- return !0;
1448
- }
1449
- return t !== t && n !== n;
1450
- };
1451
- })), y = /* @__PURE__ */ r(((e, t) => {
1452
- var n = t.exports = function(e, t, n) {
1453
- typeof t == "function" && (n = t, t = {}), n = t.cb || n;
1454
- var i = typeof n == "function" ? n : n.pre || function() {}, a = n.post || function() {};
1455
- r(t, i, a, e, "", e);
1456
- };
1457
- n.keywords = {
1458
- additionalItems: !0,
1459
- items: !0,
1460
- contains: !0,
1461
- additionalProperties: !0,
1462
- propertyNames: !0,
1463
- not: !0,
1464
- if: !0,
1465
- then: !0,
1466
- else: !0
1467
- }, n.arrayKeywords = {
1468
- items: !0,
1469
- allOf: !0,
1470
- anyOf: !0,
1471
- oneOf: !0
1472
- }, n.propsKeywords = {
1473
- $defs: !0,
1474
- definitions: !0,
1475
- properties: !0,
1476
- patternProperties: !0,
1477
- dependencies: !0
1478
- }, n.skipKeywords = {
1479
- default: !0,
1480
- enum: !0,
1481
- const: !0,
1482
- required: !0,
1483
- maximum: !0,
1484
- minimum: !0,
1485
- exclusiveMaximum: !0,
1486
- exclusiveMinimum: !0,
1487
- multipleOf: !0,
1488
- maxLength: !0,
1489
- minLength: !0,
1490
- pattern: !0,
1491
- format: !0,
1492
- maxItems: !0,
1493
- minItems: !0,
1494
- uniqueItems: !0,
1495
- maxProperties: !0,
1496
- minProperties: !0
1497
- };
1498
- function r(e, t, a, o, s, c, l, u, d, f) {
1499
- if (o && typeof o == "object" && !Array.isArray(o)) {
1500
- for (var p in t(o, s, c, l, u, d, f), o) {
1501
- var m = o[p];
1502
- if (Array.isArray(m)) {
1503
- if (p in n.arrayKeywords) for (var h = 0; h < m.length; h++) r(e, t, a, m[h], s + "/" + p + "/" + h, c, s, p, o, h);
1504
- } else if (p in n.propsKeywords) {
1505
- if (m && typeof m == "object") for (var g in m) r(e, t, a, m[g], s + "/" + p + "/" + i(g), c, s, p, o, g);
1506
- } else (p in n.keywords || e.allKeys && !(p in n.skipKeywords)) && r(e, t, a, m, s + "/" + p, c, s, p, o);
1507
- }
1508
- a(o, s, c, l, u, d, f);
1509
- }
1510
- }
1511
- function i(e) {
1512
- return e.replace(/~/g, "~0").replace(/\//g, "~1");
1513
- }
1514
- })), b = /* @__PURE__ */ r(((e) => {
1515
- Object.defineProperty(e, "__esModule", { value: !0 }), e.getSchemaRefs = e.resolveUrl = e.normalizeId = e._getFullPath = e.getFullPath = e.inlineRef = void 0;
1516
- var t = s(), n = v(), r = y(), i = new Set([
1517
- "type",
1518
- "format",
1519
- "pattern",
1520
- "maxLength",
1521
- "minLength",
1522
- "maxProperties",
1523
- "minProperties",
1524
- "maxItems",
1525
- "minItems",
1526
- "maximum",
1527
- "minimum",
1528
- "uniqueItems",
1529
- "multipleOf",
1530
- "required",
1531
- "enum",
1532
- "const"
1533
- ]);
1534
- function a(e, t = !0) {
1535
- return typeof e == "boolean" ? !0 : t === !0 ? !c(e) : t ? l(e) <= t : !1;
1536
- }
1537
- e.inlineRef = a;
1538
- var o = new Set([
1539
- "$ref",
1540
- "$recursiveRef",
1541
- "$recursiveAnchor",
1542
- "$dynamicRef",
1543
- "$dynamicAnchor"
1544
- ]);
1545
- function c(e) {
1546
- for (let t in e) {
1547
- if (o.has(t)) return !0;
1548
- let n = e[t];
1549
- if (Array.isArray(n) && n.some(c) || typeof n == "object" && c(n)) return !0;
1550
- }
1551
- return !1;
1552
- }
1553
- function l(e) {
1554
- let n = 0;
1555
- for (let r in e) if (r === "$ref" || (n++, !i.has(r) && (typeof e[r] == "object" && (0, t.eachItem)(e[r], (e) => n += l(e)), n === Infinity))) return Infinity;
1556
- return n;
1557
- }
1558
- function u(e, t = "", n) {
1559
- return n !== !1 && (t = p(t)), d(e, e.parse(t));
1560
- }
1561
- e.getFullPath = u;
1562
- function d(e, t) {
1563
- return e.serialize(t).split("#")[0] + "#";
1564
- }
1565
- e._getFullPath = d;
1566
- var f = /#\/?$/;
1567
- function p(e) {
1568
- return e ? e.replace(f, "") : "";
1569
- }
1570
- e.normalizeId = p;
1571
- function m(e, t, n) {
1572
- return n = p(n), e.resolve(t, n);
1573
- }
1574
- e.resolveUrl = m;
1575
- var h = /^[a-z_][-a-z0-9._]*$/i;
1576
- function g(e, t) {
1577
- if (typeof e == "boolean") return {};
1578
- let { schemaId: i, uriResolver: a } = this.opts, o = p(e[i] || t), s = { "": o }, c = u(a, o, !1), l = {}, d = /* @__PURE__ */ new Set();
1579
- return r(e, { allKeys: !0 }, (e, t, n, r) => {
1580
- if (r === void 0) return;
1581
- let a = c + t, o = s[r];
1582
- typeof e[i] == "string" && (o = u.call(this, e[i])), g.call(this, e.$anchor), g.call(this, e.$dynamicAnchor), s[t] = o;
1583
- function u(t) {
1584
- let n = this.opts.uriResolver.resolve;
1585
- if (t = p(o ? n(o, t) : t), d.has(t)) throw m(t);
1586
- d.add(t);
1587
- let r = this.refs[t];
1588
- return typeof r == "string" && (r = this.refs[r]), typeof r == "object" ? f(e, r.schema, t) : t !== p(a) && (t[0] === "#" ? (f(e, l[t], t), l[t] = e) : this.refs[t] = a), t;
1589
- }
1590
- function g(e) {
1591
- if (typeof e == "string") {
1592
- if (!h.test(e)) throw Error(`invalid anchor "${e}"`);
1593
- u.call(this, `#${e}`);
1594
- }
1595
- }
1596
- }), l;
1597
- function f(e, t, r) {
1598
- if (t !== void 0 && !n(e, t)) throw m(r);
1599
- }
1600
- function m(e) {
1601
- return /* @__PURE__ */ Error(`reference "${e}" resolves to more than one schema`);
1602
- }
1603
- }
1604
- e.getSchemaRefs = g;
1605
- })), x = /* @__PURE__ */ r(((e) => {
1606
- Object.defineProperty(e, "__esModule", { value: !0 }), e.getData = e.KeywordCxt = e.validateFunctionCode = void 0;
1607
- var t = u(), n = p(), r = f(), i = p(), a = m(), d = g(), h = _(), v = o(), y = c(), x = b(), S = s(), C = l();
1608
- function w(e) {
1609
- if (N(e) && (F(e), M(e))) {
1610
- O(e);
1611
- return;
1612
- }
1613
- T(e, () => (0, t.topBoolOrEmptySchema)(e));
1614
- }
1615
- e.validateFunctionCode = w;
1616
- function T({ gen: e, validateName: t, schema: n, schemaEnv: r, opts: i }, a) {
1617
- i.code.es5 ? e.func(t, (0, v._)`${y.default.data}, ${y.default.valCxt}`, r.$async, () => {
1618
- e.code((0, v._)`"use strict"; ${A(n, i)}`), D(e, i), e.code(a);
1619
- }) : e.func(t, (0, v._)`${y.default.data}, ${E(i)}`, r.$async, () => e.code(A(n, i)).code(a));
1620
- }
1621
- function E(e) {
1622
- return (0, v._)`{${y.default.instancePath}="", ${y.default.parentData}, ${y.default.parentDataProperty}, ${y.default.rootData}=${y.default.data}${e.dynamicRef ? (0, v._)`, ${y.default.dynamicAnchors}={}` : v.nil}}={}`;
1623
- }
1624
- function D(e, t) {
1625
- e.if(y.default.valCxt, () => {
1626
- e.var(y.default.instancePath, (0, v._)`${y.default.valCxt}.${y.default.instancePath}`), e.var(y.default.parentData, (0, v._)`${y.default.valCxt}.${y.default.parentData}`), e.var(y.default.parentDataProperty, (0, v._)`${y.default.valCxt}.${y.default.parentDataProperty}`), e.var(y.default.rootData, (0, v._)`${y.default.valCxt}.${y.default.rootData}`), t.dynamicRef && e.var(y.default.dynamicAnchors, (0, v._)`${y.default.valCxt}.${y.default.dynamicAnchors}`);
1627
- }, () => {
1628
- e.var(y.default.instancePath, (0, v._)`""`), e.var(y.default.parentData, (0, v._)`undefined`), e.var(y.default.parentDataProperty, (0, v._)`undefined`), e.var(y.default.rootData, y.default.data), t.dynamicRef && e.var(y.default.dynamicAnchors, (0, v._)`{}`);
1629
- });
1630
- }
1631
- function O(e) {
1632
- let { schema: t, opts: n, gen: r } = e;
1633
- T(e, () => {
1634
- n.$comment && t.$comment && V(e), R(e), r.let(y.default.vErrors, null), r.let(y.default.errors, 0), n.unevaluated && k(e), I(e), ee(e);
1635
- });
1636
- }
1637
- function k(e) {
1638
- let { gen: t, validateName: n } = e;
1639
- e.evaluated = t.const("evaluated", (0, v._)`${n}.evaluated`), t.if((0, v._)`${e.evaluated}.dynamicProps`, () => t.assign((0, v._)`${e.evaluated}.props`, (0, v._)`undefined`)), t.if((0, v._)`${e.evaluated}.dynamicItems`, () => t.assign((0, v._)`${e.evaluated}.items`, (0, v._)`undefined`));
1640
- }
1641
- function A(e, t) {
1642
- let n = typeof e == "object" && e[t.schemaId];
1643
- return n && (t.code.source || t.code.process) ? (0, v._)`/*# sourceURL=${n} */` : v.nil;
1644
- }
1645
- function j(e, n) {
1646
- if (N(e) && (F(e), M(e))) {
1647
- P(e, n);
1648
- return;
1649
- }
1650
- (0, t.boolOrEmptySchema)(e, n);
1651
- }
1652
- function M({ schema: e, self: t }) {
1653
- if (typeof e == "boolean") return !e;
1654
- for (let n in e) if (t.RULES.all[n]) return !0;
1655
- return !1;
1656
- }
1657
- function N(e) {
1658
- return typeof e.schema != "boolean";
1659
- }
1660
- function P(e, t) {
1661
- let { schema: n, gen: r, opts: i } = e;
1662
- i.$comment && n.$comment && V(e), z(e), B(e);
1663
- let a = r.const("_errs", y.default.errors);
1664
- I(e, a), r.var(t, (0, v._)`${a} === ${y.default.errors}`);
1665
- }
1666
- function F(e) {
1667
- (0, S.checkUnknownRules)(e), L(e);
1668
- }
1669
- function I(e, t) {
1670
- if (e.opts.jtd) return U(e, [], !1, t);
1671
- let r = (0, n.getSchemaTypes)(e.schema);
1672
- U(e, r, !(0, n.coerceAndCheckDataType)(e, r), t);
1673
- }
1674
- function L(e) {
1675
- let { schema: t, errSchemaPath: n, opts: r, self: i } = e;
1676
- t.$ref && r.ignoreKeywordsWithRef && (0, S.schemaHasRulesButRef)(t, i.RULES) && i.logger.warn(`$ref: keywords ignored in schema at path "${n}"`);
1677
- }
1678
- function R(e) {
1679
- let { schema: t, opts: n } = e;
1680
- t.default !== void 0 && n.useDefaults && n.strictSchema && (0, S.checkStrictMode)(e, "default is ignored in the schema root");
1681
- }
1682
- function z(e) {
1683
- let t = e.schema[e.opts.schemaId];
1684
- t && (e.baseId = (0, x.resolveUrl)(e.opts.uriResolver, e.baseId, t));
1685
- }
1686
- function B(e) {
1687
- if (e.schema.$async && !e.schemaEnv.$async) throw Error("async schema in sync schema");
1688
- }
1689
- function V({ gen: e, schemaEnv: t, schema: n, errSchemaPath: r, opts: i }) {
1690
- let a = n.$comment;
1691
- if (i.$comment === !0) e.code((0, v._)`${y.default.self}.logger.log(${a})`);
1692
- else if (typeof i.$comment == "function") {
1693
- let n = (0, v.str)`${r}/$comment`, i = e.scopeValue("root", { ref: t.root });
1694
- e.code((0, v._)`${y.default.self}.opts.$comment(${a}, ${n}, ${i}.schema)`);
1695
- }
1696
- }
1697
- function ee(e) {
1698
- let { gen: t, schemaEnv: n, validateName: r, ValidationError: i, opts: a } = e;
1699
- n.$async ? t.if((0, v._)`${y.default.errors} === 0`, () => t.return(y.default.data), () => t.throw((0, v._)`new ${i}(${y.default.vErrors})`)) : (t.assign((0, v._)`${r}.errors`, y.default.vErrors), a.unevaluated && H(e), t.return((0, v._)`${y.default.errors} === 0`));
1700
- }
1701
- function H({ gen: e, evaluated: t, props: n, items: r }) {
1702
- n instanceof v.Name && e.assign((0, v._)`${t}.props`, n), r instanceof v.Name && e.assign((0, v._)`${t}.items`, r);
1703
- }
1704
- function U(e, t, n, a) {
1705
- let { gen: o, schema: s, data: c, allErrors: l, opts: u, self: d } = e, { RULES: f } = d;
1706
- if (s.$ref && (u.ignoreKeywordsWithRef || !(0, S.schemaHasRulesButRef)(s, f))) {
1707
- o.block(() => Q(e, "$ref", f.all.$ref.definition));
1708
- return;
1709
- }
1710
- u.jtd || G(e, t), o.block(() => {
1711
- for (let e of f.rules) p(e);
1712
- p(f.post);
1713
- });
1714
- function p(d) {
1715
- (0, r.shouldUseGroup)(s, d) && (d.type ? (o.if((0, i.checkDataType)(d.type, c, u.strictNumbers)), W(e, d), t.length === 1 && t[0] === d.type && n && (o.else(), (0, i.reportTypeError)(e)), o.endIf()) : W(e, d), l || o.if((0, v._)`${y.default.errors} === ${a || 0}`));
1716
- }
1717
- }
1718
- function W(e, t) {
1719
- let { gen: n, schema: i, opts: { useDefaults: o } } = e;
1720
- o && (0, a.assignDefaults)(e, t.type), n.block(() => {
1721
- for (let n of t.rules) (0, r.shouldUseRule)(i, n) && Q(e, n.keyword, n.definition, t.type);
1722
- });
1723
- }
1724
- function G(e, t) {
1725
- e.schemaEnv.meta || !e.opts.strictTypes || (K(e, t), e.opts.allowUnionTypes || q(e, t), J(e, e.dataTypes));
1726
- }
1727
- function K(e, t) {
1728
- if (t.length) {
1729
- if (!e.dataTypes.length) {
1730
- e.dataTypes = t;
1731
- return;
1732
- }
1733
- t.forEach((t) => {
1734
- Y(e.dataTypes, t) || X(e, `type "${t}" not allowed by context "${e.dataTypes.join(",")}"`);
1735
- }), ne(e, t);
1736
- }
1737
- }
1738
- function q(e, t) {
1739
- t.length > 1 && !(t.length === 2 && t.includes("null")) && X(e, "use allowUnionTypes to allow union type keyword");
1740
- }
1741
- function J(e, t) {
1742
- let n = e.self.RULES.all;
1743
- for (let i in n) {
1744
- let a = n[i];
1745
- if (typeof a == "object" && (0, r.shouldUseRule)(e.schema, a)) {
1746
- let { type: n } = a.definition;
1747
- n.length && !n.some((e) => te(t, e)) && X(e, `missing type "${n.join(",")}" for keyword "${i}"`);
1748
- }
1749
- }
1750
- }
1751
- function te(e, t) {
1752
- return e.includes(t) || t === "number" && e.includes("integer");
1753
- }
1754
- function Y(e, t) {
1755
- return e.includes(t) || t === "integer" && e.includes("number");
1756
- }
1757
- function ne(e, t) {
1758
- let n = [];
1759
- for (let r of e.dataTypes) Y(t, r) ? n.push(r) : t.includes("integer") && r === "number" && n.push("integer");
1760
- e.dataTypes = n;
1761
- }
1762
- function X(e, t) {
1763
- let n = e.schemaEnv.baseId + e.errSchemaPath;
1764
- t += ` at "${n}" (strictTypes)`, (0, S.checkStrictMode)(e, t, e.opts.strictTypes);
1765
- }
1766
- var Z = class {
1767
- constructor(e, t, n) {
1768
- if ((0, d.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 = (0, S.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", $(this.$data, e));
1769
- else if (this.schemaCode = this.schemaValue, !(0, d.validSchemaType)(this.schema, t.schemaType, t.allowUndefined)) throw Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);
1770
- ("code" in t ? t.trackErrors : t.errors !== !1) && (this.errsCount = e.gen.const("_errs", y.default.errors));
1771
- }
1772
- result(e, t, n) {
1773
- this.failResult((0, v.not)(e), t, n);
1774
- }
1775
- failResult(e, t, n) {
1776
- this.gen.if(e), n ? n() : this.error(), t ? (this.gen.else(), t(), this.allErrors && this.gen.endIf()) : this.allErrors ? this.gen.endIf() : this.gen.else();
1777
- }
1778
- pass(e, t) {
1779
- this.failResult((0, v.not)(e), void 0, t);
1780
- }
1781
- fail(e) {
1782
- if (e === void 0) {
1783
- this.error(), this.allErrors || this.gen.if(!1);
1784
- return;
1785
- }
1786
- this.gen.if(e), this.error(), this.allErrors ? this.gen.endIf() : this.gen.else();
1787
- }
1788
- fail$data(e) {
1789
- if (!this.$data) return this.fail(e);
1790
- let { schemaCode: t } = this;
1791
- this.fail((0, v._)`${t} !== undefined && (${(0, v.or)(this.invalid$data(), e)})`);
1792
- }
1793
- error(e, t, n) {
1794
- if (t) {
1795
- this.setParams(t), this._error(e, n), this.setParams({});
1796
- return;
1797
- }
1798
- this._error(e, n);
1799
- }
1800
- _error(e, t) {
1801
- (e ? C.reportExtraError : C.reportError)(this, this.def.error, t);
1802
- }
1803
- $dataError() {
1804
- (0, C.reportError)(this, this.def.$dataError || C.keyword$DataError);
1805
- }
1806
- reset() {
1807
- if (this.errsCount === void 0) throw Error("add \"trackErrors\" to keyword definition");
1808
- (0, C.resetErrorsCount)(this.gen, this.errsCount);
1809
- }
1810
- ok(e) {
1811
- this.allErrors || this.gen.if(e);
1812
- }
1813
- setParams(e, t) {
1814
- t ? Object.assign(this.params, e) : this.params = e;
1815
- }
1816
- block$data(e, t, n = v.nil) {
1817
- this.gen.block(() => {
1818
- this.check$data(e, n), t();
1819
- });
1820
- }
1821
- check$data(e = v.nil, t = v.nil) {
1822
- if (!this.$data) return;
1823
- let { gen: n, schemaCode: r, schemaType: i, def: a } = this;
1824
- n.if((0, v.or)((0, v._)`${r} === undefined`, t)), e !== v.nil && n.assign(e, !0), (i.length || a.validateSchema) && (n.elseIf(this.invalid$data()), this.$dataError(), e !== v.nil && n.assign(e, !1)), n.else();
1825
- }
1826
- invalid$data() {
1827
- let { gen: e, schemaCode: t, schemaType: n, def: r, it: a } = this;
1828
- return (0, v.or)(o(), s());
1829
- function o() {
1830
- if (n.length) {
1831
- /* istanbul ignore if */
1832
- if (!(t instanceof v.Name)) throw Error("ajv implementation error");
1833
- let e = Array.isArray(n) ? n : [n];
1834
- return (0, v._)`${(0, i.checkDataTypes)(e, t, a.opts.strictNumbers, i.DataType.Wrong)}`;
1835
- }
1836
- return v.nil;
1837
- }
1838
- function s() {
1839
- if (r.validateSchema) {
1840
- let n = e.scopeValue("validate$data", { ref: r.validateSchema });
1841
- return (0, v._)`!${n}(${t})`;
1842
- }
1843
- return v.nil;
1844
- }
1845
- }
1846
- subschema(e, t) {
1847
- let n = (0, h.getSubschema)(this.it, e);
1848
- (0, h.extendSubschemaData)(n, this.it, e), (0, h.extendSubschemaMode)(n, e);
1849
- let r = {
1850
- ...this.it,
1851
- ...n,
1852
- items: void 0,
1853
- props: void 0
1854
- };
1855
- return j(r, t), r;
1856
- }
1857
- mergeEvaluated(e, t) {
1858
- let { it: n, gen: r } = this;
1859
- n.opts.unevaluated && (n.props !== !0 && e.props !== void 0 && (n.props = S.mergeEvaluated.props(r, e.props, n.props, t)), n.items !== !0 && e.items !== void 0 && (n.items = S.mergeEvaluated.items(r, e.items, n.items, t)));
1860
- }
1861
- mergeValidEvaluated(e, t) {
1862
- let { it: n, gen: r } = this;
1863
- if (n.opts.unevaluated && (n.props !== !0 || n.items !== !0)) return r.if(t, () => this.mergeEvaluated(e, v.Name)), !0;
1864
- }
1865
- };
1866
- e.KeywordCxt = Z;
1867
- function Q(e, t, n, r) {
1868
- let i = new Z(e, n, t);
1869
- "code" in n ? n.code(i, r) : i.$data && n.validate ? (0, d.funcKeywordCode)(i, n) : "macro" in n ? (0, d.macroKeywordCode)(i, n) : (n.compile || n.validate) && (0, d.funcKeywordCode)(i, n);
1870
- }
1871
- var re = /^\/(?:[^~]|~0|~1)*$/, ie = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
1872
- function $(e, { dataLevel: t, dataNames: n, dataPathArr: r }) {
1873
- let i, a;
1874
- if (e === "") return y.default.rootData;
1875
- if (e[0] === "/") {
1876
- if (!re.test(e)) throw Error(`Invalid JSON-pointer: ${e}`);
1877
- i = e, a = y.default.rootData;
1878
- } else {
1879
- let o = ie.exec(e);
1880
- if (!o) throw Error(`Invalid JSON-pointer: ${e}`);
1881
- let s = +o[1];
1882
- if (i = o[2], i === "#") {
1883
- if (s >= t) throw Error(c("property/index", s));
1884
- return r[t - s];
1885
- }
1886
- if (s > t) throw Error(c("data", s));
1887
- if (a = n[t - s], !i) return a;
1888
- }
1889
- let o = a, s = i.split("/");
1890
- for (let e of s) e && (a = (0, v._)`${a}${(0, v.getProperty)((0, S.unescapeJsonPointer)(e))}`, o = (0, v._)`${o} && ${a}`);
1891
- return o;
1892
- function c(e, n) {
1893
- return `Cannot access ${e} ${n} levels up, current level is ${t}`;
1894
- }
1895
- }
1896
- e.getData = $;
1897
- })), S = /* @__PURE__ */ r(((e) => {
1898
- Object.defineProperty(e, "__esModule", { value: !0 }), e.default = class extends Error {
1899
- constructor(e) {
1900
- super("validation failed"), this.errors = e, this.ajv = this.validation = !0;
1901
- }
1902
- };
1903
- })), C = /* @__PURE__ */ r(((e) => {
1904
- Object.defineProperty(e, "__esModule", { value: !0 });
1905
- var t = b();
1906
- e.default = class extends Error {
1907
- constructor(e, n, r, i) {
1908
- super(i || `can't resolve reference ${r} from id ${n}`), this.missingRef = (0, t.resolveUrl)(e, n, r), this.missingSchema = (0, t.normalizeId)((0, t.getFullPath)(e, this.missingRef));
1909
- }
1910
- };
1911
- })), w = /* @__PURE__ */ r(((e) => {
1912
- Object.defineProperty(e, "__esModule", { value: !0 }), e.resolveSchema = e.getCompilingSchema = e.resolveRef = e.compileSchema = e.SchemaEnv = void 0;
1913
- var t = o(), n = S(), r = c(), i = b(), a = s(), l = x(), u = class {
1914
- constructor(e) {
1915
- this.refs = {}, this.dynamicAnchors = {};
1916
- let t;
1917
- typeof e.schema == "object" && (t = e.schema), this.schema = e.schema, this.schemaId = e.schemaId, this.root = e.root || this, this.baseId = e.baseId ?? (0, i.normalizeId)(t?.[e.schemaId || "$id"]), this.schemaPath = e.schemaPath, this.localRefs = e.localRefs, this.meta = e.meta, this.$async = t?.$async, this.refs = {};
1918
- }
1919
- };
1920
- e.SchemaEnv = u;
1921
- function d(e) {
1922
- let a = m.call(this, e);
1923
- if (a) return a;
1924
- let o = (0, i.getFullPath)(this.opts.uriResolver, e.root.baseId), { es5: s, lines: c } = this.opts.code, { ownProperties: u } = this.opts, d = new t.CodeGen(this.scope, {
1925
- es5: s,
1926
- lines: c,
1927
- ownProperties: u
1928
- }), f;
1929
- e.$async && (f = d.scopeValue("Error", {
1930
- ref: n.default,
1931
- code: (0, t._)`require("ajv/dist/runtime/validation_error").default`
1932
- }));
1933
- let p = d.scopeName("validate");
1934
- e.validateName = p;
1935
- let h = {
1936
- gen: d,
1937
- allErrors: this.opts.allErrors,
1938
- data: r.default.data,
1939
- parentData: r.default.parentData,
1940
- parentDataProperty: r.default.parentDataProperty,
1941
- dataNames: [r.default.data],
1942
- dataPathArr: [t.nil],
1943
- dataLevel: 0,
1944
- dataTypes: [],
1945
- definedProperties: /* @__PURE__ */ new Set(),
1946
- topSchemaRef: d.scopeValue("schema", this.opts.code.source === !0 ? {
1947
- ref: e.schema,
1948
- code: (0, t.stringify)(e.schema)
1949
- } : { ref: e.schema }),
1950
- validateName: p,
1951
- ValidationError: f,
1952
- schema: e.schema,
1953
- schemaEnv: e,
1954
- rootId: o,
1955
- baseId: e.baseId || o,
1956
- schemaPath: t.nil,
1957
- errSchemaPath: e.schemaPath || (this.opts.jtd ? "" : "#"),
1958
- errorPath: (0, t._)`""`,
1959
- opts: this.opts,
1960
- self: this
1961
- }, g;
1962
- try {
1963
- this._compilations.add(e), (0, l.validateFunctionCode)(h), d.optimize(this.opts.code.optimize);
1964
- let n = d.toString();
1965
- g = `${d.scopeRefs(r.default.scope)}return ${n}`, this.opts.code.process && (g = this.opts.code.process(g, e));
1966
- let i = Function(`${r.default.self}`, `${r.default.scope}`, g)(this, this.scope.get());
1967
- if (this.scope.value(p, { ref: i }), i.errors = null, i.schema = e.schema, i.schemaEnv = e, e.$async && (i.$async = !0), this.opts.code.source === !0 && (i.source = {
1968
- validateName: p,
1969
- validateCode: n,
1970
- scopeValues: d._values
1971
- }), this.opts.unevaluated) {
1972
- let { props: e, items: n } = h;
1973
- i.evaluated = {
1974
- props: e instanceof t.Name ? void 0 : e,
1975
- items: n instanceof t.Name ? void 0 : n,
1976
- dynamicProps: e instanceof t.Name,
1977
- dynamicItems: n instanceof t.Name
1978
- }, i.source && (i.source.evaluated = (0, t.stringify)(i.evaluated));
1979
- }
1980
- return e.validate = i, e;
1981
- } catch (t) {
1982
- throw delete e.validate, delete e.validateName, g && this.logger.error("Error compiling schema, function code:", g), t;
1983
- } finally {
1984
- this._compilations.delete(e);
1985
- }
1986
- }
1987
- e.compileSchema = d;
1988
- function f(e, t, n) {
1989
- n = (0, i.resolveUrl)(this.opts.uriResolver, t, n);
1990
- let r = e.refs[n];
1991
- if (r) return r;
1992
- let a = g.call(this, e, n);
1993
- if (a === void 0) {
1994
- let r = e.localRefs?.[n], { schemaId: i } = this.opts;
1995
- r && (a = new u({
1996
- schema: r,
1997
- schemaId: i,
1998
- root: e,
1999
- baseId: t
2000
- }));
2001
- }
2002
- if (a !== void 0) return e.refs[n] = p.call(this, a);
2003
- }
2004
- e.resolveRef = f;
2005
- function p(e) {
2006
- return (0, i.inlineRef)(e.schema, this.opts.inlineRefs) ? e.schema : e.validate ? e : d.call(this, e);
2007
- }
2008
- function m(e) {
2009
- for (let t of this._compilations) if (h(t, e)) return t;
2010
- }
2011
- e.getCompilingSchema = m;
2012
- function h(e, t) {
2013
- return e.schema === t.schema && e.root === t.root && e.baseId === t.baseId;
2014
- }
2015
- function g(e, t) {
2016
- let n;
2017
- for (; typeof (n = this.refs[t]) == "string";) t = n;
2018
- return n || this.schemas[t] || _.call(this, e, t);
2019
- }
2020
- function _(e, t) {
2021
- let n = this.opts.uriResolver.parse(t), r = (0, i._getFullPath)(this.opts.uriResolver, n), a = (0, i.getFullPath)(this.opts.uriResolver, e.baseId, void 0);
2022
- if (Object.keys(e.schema).length > 0 && r === a) return y.call(this, n, e);
2023
- let o = (0, i.normalizeId)(r), s = this.refs[o] || this.schemas[o];
2024
- if (typeof s == "string") {
2025
- let t = _.call(this, e, s);
2026
- return typeof t?.schema == "object" ? y.call(this, n, t) : void 0;
2027
- }
2028
- if (typeof s?.schema == "object") {
2029
- if (s.validate || d.call(this, s), o === (0, i.normalizeId)(t)) {
2030
- let { schema: t } = s, { schemaId: n } = this.opts, r = t[n];
2031
- return r && (a = (0, i.resolveUrl)(this.opts.uriResolver, a, r)), new u({
2032
- schema: t,
2033
- schemaId: n,
2034
- root: e,
2035
- baseId: a
2036
- });
2037
- }
2038
- return y.call(this, n, s);
2039
- }
2040
- }
2041
- e.resolveSchema = _;
2042
- var v = new Set([
2043
- "properties",
2044
- "patternProperties",
2045
- "enum",
2046
- "dependencies",
2047
- "definitions"
2048
- ]);
2049
- function y(e, { baseId: t, schema: n, root: r }) {
2050
- if (e.fragment?.[0] !== "/") return;
2051
- for (let r of e.fragment.slice(1).split("/")) {
2052
- if (typeof n == "boolean") return;
2053
- let e = n[(0, a.unescapeFragment)(r)];
2054
- if (e === void 0) return;
2055
- n = e;
2056
- let o = typeof n == "object" && n[this.opts.schemaId];
2057
- !v.has(r) && o && (t = (0, i.resolveUrl)(this.opts.uriResolver, t, o));
2058
- }
2059
- let o;
2060
- if (typeof n != "boolean" && n.$ref && !(0, a.schemaHasRulesButRef)(n, this.RULES)) {
2061
- let e = (0, i.resolveUrl)(this.opts.uriResolver, t, n.$ref);
2062
- o = _.call(this, r, e);
2063
- }
2064
- let { schemaId: s } = this.opts;
2065
- if (o ||= new u({
2066
- schema: n,
2067
- schemaId: s,
2068
- root: r,
2069
- baseId: t
2070
- }), o.schema !== o.root.schema) return o;
2071
- }
2072
- })), T = /* @__PURE__ */ n({
2073
- $id: () => E,
2074
- additionalProperties: () => !1,
2075
- default: () => j,
2076
- description: () => D,
2077
- properties: () => A,
2078
- required: () => k,
2079
- type: () => O
2080
- }), E, D, O, k, A, j, M = t((() => {
2081
- E = "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", D = "Meta-schema for $data reference (JSON AnySchema extension proposal)", O = "object", k = ["$data"], A = { $data: {
2082
- type: "string",
2083
- anyOf: [{ format: "relative-json-pointer" }, { format: "json-pointer" }]
2084
- } }, j = {
2085
- $id: E,
2086
- description: D,
2087
- type: O,
2088
- required: k,
2089
- properties: A,
2090
- additionalProperties: !1
2091
- };
2092
- })), N = /* @__PURE__ */ r(((e, t) => {
2093
- var n = 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), i = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu), a = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu), o = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
2094
- function s(e) {
2095
- let t = "", n = 0, r = 0;
2096
- for (r = 0; r < e.length; r++) if (n = e[r].charCodeAt(0), n !== 48) {
2097
- if (!(n >= 48 && n <= 57 || n >= 65 && n <= 70 || n >= 97 && n <= 102)) return "";
2098
- t += e[r];
2099
- break;
2100
- }
2101
- for (r += 1; r < e.length; r++) {
2102
- if (n = e[r].charCodeAt(0), !(n >= 48 && n <= 57 || n >= 65 && n <= 70 || n >= 97 && n <= 102)) return "";
2103
- t += e[r];
2104
- }
2105
- return t;
2106
- }
2107
- var c = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
2108
- function l(e) {
2109
- return e.length = 0, !0;
2110
- }
2111
- function u(e, t, n) {
2112
- if (e.length) {
2113
- let r = s(e);
2114
- if (r !== "") t.push(r);
2115
- else return n.error = !0, !1;
2116
- e.length = 0;
2117
- }
2118
- return !0;
2119
- }
2120
- function d(e) {
2121
- let t = 0, n = {
2122
- error: !1,
2123
- address: "",
2124
- zone: ""
2125
- }, r = [], i = [], a = !1, o = !1, c = u;
2126
- for (let s = 0; s < e.length; s++) {
2127
- let u = e[s];
2128
- if (!(u === "[" || u === "]")) if (u === ":") {
2129
- if (a === !0 && (o = !0), !c(i, r, n)) break;
2130
- if (++t > 7) {
2131
- n.error = !0;
2132
- break;
2133
- }
2134
- s > 0 && e[s - 1] === ":" && (a = !0), r.push(":");
2135
- continue;
2136
- } else if (u === "%") {
2137
- if (!c(i, r, n)) break;
2138
- c = l;
2139
- } else {
2140
- i.push(u);
2141
- continue;
2142
- }
2143
- }
2144
- return i.length && (c === l ? n.zone = i.join("") : o ? r.push(i.join("")) : r.push(s(i))), n.address = r.join(""), n;
2145
- }
2146
- function f(e) {
2147
- if (p(e, ":") < 2) return {
2148
- host: e,
2149
- isIPV6: !1
2150
- };
2151
- let t = d(e);
2152
- if (t.error) return {
2153
- host: e,
2154
- isIPV6: !1
2155
- };
2156
- {
2157
- let e = t.address, n = t.address;
2158
- return t.zone && (e += "%" + t.zone, n += "%25" + t.zone), {
2159
- host: e,
2160
- isIPV6: !0,
2161
- escapedHost: n
2162
- };
2163
- }
2164
- }
2165
- function p(e, t) {
2166
- let n = 0;
2167
- for (let r = 0; r < e.length; r++) e[r] === t && n++;
2168
- return n;
2169
- }
2170
- function m(e) {
2171
- let t = e, n = [], r = -1, i = 0;
2172
- for (; i = t.length;) {
2173
- if (i === 1) {
2174
- if (t === ".") break;
2175
- if (t === "/") {
2176
- n.push("/");
2177
- break;
2178
- } else {
2179
- n.push(t);
2180
- break;
2181
- }
2182
- } else if (i === 2) {
2183
- if (t[0] === ".") {
2184
- if (t[1] === ".") break;
2185
- if (t[1] === "/") {
2186
- t = t.slice(2);
2187
- continue;
2188
- }
2189
- } else if (t[0] === "/" && (t[1] === "." || t[1] === "/")) {
2190
- n.push("/");
2191
- break;
2192
- }
2193
- } else if (i === 3 && t === "/..") {
2194
- n.length !== 0 && n.pop(), n.push("/");
2195
- break;
2196
- }
2197
- if (t[0] === ".") {
2198
- if (t[1] === ".") {
2199
- if (t[2] === "/") {
2200
- t = t.slice(3);
2201
- continue;
2202
- }
2203
- } else if (t[1] === "/") {
2204
- t = t.slice(2);
2205
- continue;
2206
- }
2207
- } else if (t[0] === "/" && t[1] === ".") {
2208
- if (t[2] === "/") {
2209
- t = t.slice(2);
2210
- continue;
2211
- } else if (t[2] === "." && t[3] === "/") {
2212
- t = t.slice(3), n.length !== 0 && n.pop();
2213
- continue;
2214
- }
2215
- }
2216
- if ((r = t.indexOf("/", 1)) === -1) {
2217
- n.push(t);
2218
- break;
2219
- } else n.push(t.slice(0, r)), t = t.slice(r);
2220
- }
2221
- return n.join("");
2222
- }
2223
- var h = {
2224
- "@": "%40",
2225
- "/": "%2F",
2226
- "?": "%3F",
2227
- "#": "%23",
2228
- ":": "%3A"
2229
- }, g = /[@/?#:]/g, _ = /[@/?#]/g;
2230
- function v(e, t) {
2231
- let n = t ? _ : g;
2232
- return n.lastIndex = 0, e.replace(n, (e) => h[e]);
2233
- }
2234
- function y(e, t = !1) {
2235
- if (e.indexOf("%") === -1) return e;
2236
- let n = "";
2237
- for (let r = 0; r < e.length; r++) {
2238
- if (e[r] === "%" && r + 2 < e.length) {
2239
- let o = e.slice(r + 1, r + 3);
2240
- if (i(o)) {
2241
- let e = o.toUpperCase(), i = String.fromCharCode(parseInt(e, 16));
2242
- t && a(i) ? n += i : n += "%" + e, r += 2;
2243
- continue;
2244
- }
2245
- }
2246
- n += e[r];
2247
- }
2248
- return n;
2249
- }
2250
- function b(e) {
2251
- let t = "";
2252
- for (let n = 0; n < e.length; n++) {
2253
- if (e[n] === "%" && n + 2 < e.length) {
2254
- let r = e.slice(n + 1, n + 3);
2255
- if (i(r)) {
2256
- let e = r.toUpperCase(), i = String.fromCharCode(parseInt(e, 16));
2257
- i !== "." && a(i) ? t += i : t += "%" + e, n += 2;
2258
- continue;
2259
- }
2260
- }
2261
- o(e[n]) ? t += e[n] : t += escape(e[n]);
2262
- }
2263
- return t;
2264
- }
2265
- function x(e) {
2266
- let t = "";
2267
- for (let n = 0; n < e.length; n++) {
2268
- if (e[n] === "%" && n + 2 < e.length) {
2269
- let r = e.slice(n + 1, n + 3);
2270
- if (i(r)) {
2271
- t += "%" + r.toUpperCase(), n += 2;
2272
- continue;
2273
- }
2274
- }
2275
- t += escape(e[n]);
2276
- }
2277
- return t;
2278
- }
2279
- function S(e) {
2280
- let t = [];
2281
- if (e.userinfo !== void 0 && (t.push(e.userinfo), t.push("@")), e.host !== void 0) {
2282
- let n = unescape(e.host);
2283
- if (!r(n)) {
2284
- let e = f(n);
2285
- n = e.isIPV6 === !0 ? `[${e.escapedHost}]` : v(n, !1);
2286
- }
2287
- t.push(n);
2288
- }
2289
- return (typeof e.port == "number" || typeof e.port == "string") && (t.push(":"), t.push(String(e.port))), t.length ? t.join("") : void 0;
2290
- }
2291
- t.exports = {
2292
- nonSimpleDomain: c,
2293
- recomposeAuthority: S,
2294
- reescapeHostDelimiters: v,
2295
- normalizePercentEncoding: y,
2296
- normalizePathEncoding: b,
2297
- escapePreservingEscapes: x,
2298
- removeDotSegments: m,
2299
- isIPv4: r,
2300
- isUUID: n,
2301
- normalizeIPv6: f,
2302
- stringArrayToHexStripped: s
2303
- };
2304
- })), P = /* @__PURE__ */ r(((e, t) => {
2305
- var { isUUID: n } = N(), r = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu, i = [
2306
- "http",
2307
- "https",
2308
- "ws",
2309
- "wss",
2310
- "urn",
2311
- "urn:uuid"
2312
- ];
2313
- function a(e) {
2314
- return i.indexOf(e) !== -1;
2315
- }
2316
- function o(e) {
2317
- return e.secure === !0 ? !0 : e.secure === !1 ? !1 : e.scheme ? e.scheme.length === 3 && (e.scheme[0] === "w" || e.scheme[0] === "W") && (e.scheme[1] === "s" || e.scheme[1] === "S") && (e.scheme[2] === "s" || e.scheme[2] === "S") : !1;
2318
- }
2319
- function s(e) {
2320
- return e.host || (e.error = e.error || "HTTP URIs must have a host."), e;
2321
- }
2322
- function c(e) {
2323
- let t = String(e.scheme).toLowerCase() === "https";
2324
- return (e.port === (t ? 443 : 80) || e.port === "") && (e.port = void 0), e.path ||= "/", e;
2325
- }
2326
- function l(e) {
2327
- return e.secure = o(e), e.resourceName = (e.path || "/") + (e.query ? "?" + e.query : ""), e.path = void 0, e.query = void 0, e;
2328
- }
2329
- function u(e) {
2330
- if ((e.port === (o(e) ? 443 : 80) || e.port === "") && (e.port = void 0), typeof e.secure == "boolean" && (e.scheme = e.secure ? "wss" : "ws", e.secure = void 0), e.resourceName) {
2331
- let [t, n] = e.resourceName.split("?");
2332
- e.path = t && t !== "/" ? t : void 0, e.query = n, e.resourceName = void 0;
2333
- }
2334
- return e.fragment = void 0, e;
2335
- }
2336
- function d(e, t) {
2337
- if (!e.path) return e.error = "URN can not be parsed", e;
2338
- let n = e.path.match(r);
2339
- if (n) {
2340
- let r = t.scheme || e.scheme || "urn";
2341
- e.nid = n[1].toLowerCase(), e.nss = n[2];
2342
- let i = y(`${r}:${t.nid || e.nid}`);
2343
- e.path = void 0, i && (e = i.parse(e, t));
2344
- } else e.error = e.error || "URN can not be parsed.";
2345
- return e;
2346
- }
2347
- function f(e, t) {
2348
- if (e.nid === void 0) throw Error("URN without nid cannot be serialized");
2349
- let n = t.scheme || e.scheme || "urn", r = e.nid.toLowerCase(), i = y(`${n}:${t.nid || r}`);
2350
- i && (e = i.serialize(e, t));
2351
- let a = e, o = e.nss;
2352
- return a.path = `${r || t.nid}:${o}`, t.skipEscape = !0, a;
2353
- }
2354
- function p(e, t) {
2355
- let r = e;
2356
- return r.uuid = r.nss, r.nss = void 0, !t.tolerant && (!r.uuid || !n(r.uuid)) && (r.error = r.error || "UUID is not valid."), r;
2357
- }
2358
- function m(e) {
2359
- let t = e;
2360
- return t.nss = (e.uuid || "").toLowerCase(), t;
2361
- }
2362
- var h = {
2363
- scheme: "http",
2364
- domainHost: !0,
2365
- parse: s,
2366
- serialize: c
2367
- }, g = {
2368
- scheme: "https",
2369
- domainHost: h.domainHost,
2370
- parse: s,
2371
- serialize: c
2372
- }, _ = {
2373
- scheme: "ws",
2374
- domainHost: !0,
2375
- parse: l,
2376
- serialize: u
2377
- }, v = {
2378
- http: h,
2379
- https: g,
2380
- ws: _,
2381
- wss: {
2382
- scheme: "wss",
2383
- domainHost: _.domainHost,
2384
- parse: _.parse,
2385
- serialize: _.serialize
2386
- },
2387
- urn: {
2388
- scheme: "urn",
2389
- parse: d,
2390
- serialize: f,
2391
- skipNormalize: !0
2392
- },
2393
- "urn:uuid": {
2394
- scheme: "urn:uuid",
2395
- parse: p,
2396
- serialize: m,
2397
- skipNormalize: !0
2398
- }
2399
- };
2400
- Object.setPrototypeOf(v, null);
2401
- function y(e) {
2402
- return e && (v[e] || v[e.toLowerCase()]) || void 0;
2403
- }
2404
- t.exports = {
2405
- wsIsSecure: o,
2406
- SCHEMES: v,
2407
- isValidSchemeName: a,
2408
- getSchemeHandler: y
2409
- };
2410
- })), F = /* @__PURE__ */ r(((e, t) => {
2411
- var { normalizeIPv6: n, removeDotSegments: r, recomposeAuthority: i, normalizePercentEncoding: a, normalizePathEncoding: o, escapePreservingEscapes: s, reescapeHostDelimiters: c, isIPv4: l, nonSimpleDomain: u } = N(), { SCHEMES: d, getSchemeHandler: f } = P();
2412
- function p(e, t) {
2413
- return typeof e == "string" ? e = S(e, t) : typeof e == "object" && (e = x(_(e, t), t)), e;
2414
- }
2415
- function m(e, t, n) {
2416
- let r = n ? Object.assign({ scheme: "null" }, n) : { scheme: "null" }, i = h(x(e, r), x(t, r), r, !0);
2417
- return r.skipEscape = !0, _(i, r);
2418
- }
2419
- function h(e, t, n, i) {
2420
- let a = {};
2421
- return i || (e = x(_(e, n), n), t = x(_(t, n), n)), n ||= {}, !n.tolerant && t.scheme ? (a.scheme = t.scheme, a.userinfo = t.userinfo, a.host = t.host, a.port = t.port, a.path = r(t.path || ""), a.query = t.query) : (t.userinfo !== void 0 || t.host !== void 0 || t.port !== void 0 ? (a.userinfo = t.userinfo, a.host = t.host, a.port = t.port, a.path = r(t.path || ""), a.query = t.query) : (t.path ? (t.path[0] === "/" ? a.path = r(t.path) : ((e.userinfo !== void 0 || e.host !== void 0 || e.port !== void 0) && !e.path ? a.path = "/" + t.path : e.path ? a.path = e.path.slice(0, e.path.lastIndexOf("/") + 1) + t.path : a.path = t.path, a.path = r(a.path)), a.query = t.query) : (a.path = e.path, t.query === void 0 ? a.query = e.query : a.query = t.query), a.userinfo = e.userinfo, a.host = e.host, a.port = e.port), a.scheme = e.scheme), a.fragment = t.fragment, a;
2422
- }
2423
- function g(e, t, n) {
2424
- let r = w(e, n), i = w(t, n);
2425
- return r !== void 0 && i !== void 0 && r.toLowerCase() === i.toLowerCase();
2426
- }
2427
- function _(e, t) {
2428
- let n = {
2429
- host: e.host,
2430
- scheme: e.scheme,
2431
- userinfo: e.userinfo,
2432
- port: e.port,
2433
- path: e.path,
2434
- query: e.query,
2435
- nid: e.nid,
2436
- nss: e.nss,
2437
- uuid: e.uuid,
2438
- fragment: e.fragment,
2439
- reference: e.reference,
2440
- resourceName: e.resourceName,
2441
- secure: e.secure,
2442
- error: ""
2443
- }, o = Object.assign({}, t), c = [], l = f(o.scheme || n.scheme);
2444
- l && l.serialize && l.serialize(n, o), n.path !== void 0 && (o.skipEscape ? n.path = a(n.path) : (n.path = s(n.path), n.scheme !== void 0 && (n.path = n.path.split("%3A").join(":")))), o.reference !== "suffix" && n.scheme && c.push(n.scheme, ":");
2445
- let u = i(n);
2446
- if (u !== void 0 && (o.reference !== "suffix" && c.push("//"), c.push(u), n.path && n.path[0] !== "/" && c.push("/")), n.path !== void 0) {
2447
- let e = n.path;
2448
- !o.absolutePath && (!l || !l.absolutePath) && (e = r(e)), u === void 0 && e[0] === "/" && e[1] === "/" && (e = "/%2F" + e.slice(2)), c.push(e);
2449
- }
2450
- return n.query !== void 0 && c.push("?", n.query), n.fragment !== void 0 && c.push("#", n.fragment), c.join("");
2451
- }
2452
- var v = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
2453
- function y(e, t) {
2454
- if (t[2] !== void 0 && e.path && e.path[0] !== "/") return "URI path must start with \"/\" when authority is present.";
2455
- if (typeof e.port == "number" && (e.port < 0 || e.port > 65535)) return "URI port is malformed.";
2456
- }
2457
- function b(e, t) {
2458
- let r = Object.assign({}, t), i = {
2459
- scheme: void 0,
2460
- userinfo: void 0,
2461
- host: "",
2462
- port: void 0,
2463
- path: "",
2464
- query: void 0,
2465
- fragment: void 0
2466
- }, a = !1, s = !1;
2467
- r.reference === "suffix" && (e = r.scheme ? r.scheme + ":" + e : "//" + e);
2468
- let d = e.match(v);
2469
- if (d) {
2470
- i.scheme = d[1], i.userinfo = d[3], i.host = d[4], i.port = parseInt(d[5], 10), i.path = d[6] || "", i.query = d[7], i.fragment = d[8], isNaN(i.port) && (i.port = d[5]);
2471
- let t = y(i, d);
2472
- if (t !== void 0 && (i.error = i.error || t, a = !0), i.host) if (l(i.host) === !1) {
2473
- let e = n(i.host);
2474
- i.host = e.host.toLowerCase(), s = e.isIPV6;
2475
- } else s = !0;
2476
- i.scheme === void 0 && i.userinfo === void 0 && i.host === void 0 && i.port === void 0 && i.query === void 0 && !i.path ? i.reference = "same-document" : i.scheme === void 0 ? i.reference = "relative" : i.fragment === void 0 ? i.reference = "absolute" : i.reference = "uri", r.reference && r.reference !== "suffix" && r.reference !== i.reference && (i.error = i.error || "URI is not a " + r.reference + " reference.");
2477
- let p = f(r.scheme || i.scheme);
2478
- if (!r.unicodeSupport && (!p || !p.unicodeSupport) && i.host && (r.domainHost || p && p.domainHost) && s === !1 && u(i.host)) try {
2479
- i.host = URL.domainToASCII(i.host.toLowerCase());
2480
- } catch (e) {
2481
- i.error = i.error || "Host's domain name can not be converted to ASCII: " + e;
2482
- }
2483
- if ((!p || p && !p.skipNormalize) && (e.indexOf("%") !== -1 && (i.scheme !== void 0 && (i.scheme = unescape(i.scheme)), i.host !== void 0 && (i.host = c(unescape(i.host), s))), i.path &&= o(i.path), i.fragment)) try {
2484
- i.fragment = encodeURI(decodeURIComponent(i.fragment));
2485
- } catch {
2486
- i.error = i.error || "URI malformed";
2487
- }
2488
- p && p.parse && p.parse(i, r);
2489
- } else i.error = i.error || "URI can not be parsed.";
2490
- return {
2491
- parsed: i,
2492
- malformedAuthorityOrPort: a
2493
- };
2494
- }
2495
- function x(e, t) {
2496
- return b(e, t).parsed;
2497
- }
2498
- function S(e, t) {
2499
- return C(e, t).normalized;
2500
- }
2501
- function C(e, t) {
2502
- let { parsed: n, malformedAuthorityOrPort: r } = b(e, t);
2503
- return {
2504
- normalized: r ? e : _(n, t),
2505
- malformedAuthorityOrPort: r
2506
- };
2507
- }
2508
- function w(e, t) {
2509
- if (typeof e == "string") {
2510
- let { normalized: n, malformedAuthorityOrPort: r } = C(e, t);
2511
- return r ? void 0 : n;
2512
- }
2513
- if (typeof e == "object") return _(e, t);
2514
- }
2515
- var T = {
2516
- SCHEMES: d,
2517
- normalize: p,
2518
- resolve: m,
2519
- resolveComponent: h,
2520
- equal: g,
2521
- serialize: _,
2522
- parse: x
2523
- };
2524
- t.exports = T, t.exports.default = T, t.exports.fastUri = T;
2525
- })), I = /* @__PURE__ */ r(((e) => {
2526
- Object.defineProperty(e, "__esModule", { value: !0 });
2527
- var t = F();
2528
- t.code = "require(\"ajv/dist/runtime/uri\").default", e.default = t;
2529
- })), L = /* @__PURE__ */ r(((t) => {
2530
- Object.defineProperty(t, "__esModule", { value: !0 }), t.CodeGen = t.Name = t.nil = t.stringify = t.str = t._ = t.KeywordCxt = void 0;
2531
- var n = x();
2532
- Object.defineProperty(t, "KeywordCxt", {
2533
- enumerable: !0,
2534
- get: function() {
2535
- return n.KeywordCxt;
2536
- }
2537
- });
2538
- var r = o();
2539
- Object.defineProperty(t, "_", {
2540
- enumerable: !0,
2541
- get: function() {
2542
- return r._;
2543
- }
2544
- }), Object.defineProperty(t, "str", {
2545
- enumerable: !0,
2546
- get: function() {
2547
- return r.str;
2548
- }
2549
- }), Object.defineProperty(t, "stringify", {
2550
- enumerable: !0,
2551
- get: function() {
2552
- return r.stringify;
2553
- }
2554
- }), Object.defineProperty(t, "nil", {
2555
- enumerable: !0,
2556
- get: function() {
2557
- return r.nil;
2558
- }
2559
- }), Object.defineProperty(t, "Name", {
2560
- enumerable: !0,
2561
- get: function() {
2562
- return r.Name;
2563
- }
2564
- }), Object.defineProperty(t, "CodeGen", {
2565
- enumerable: !0,
2566
- get: function() {
2567
- return r.CodeGen;
2568
- }
2569
- });
2570
- var i = S(), a = C(), c = d(), l = w(), u = o(), f = b(), m = p(), h = s(), g = (M(), e(T).default), _ = I(), v = (e, t) => new RegExp(e, t);
2571
- v.code = "new RegExp";
2572
- var y = [
2573
- "removeAdditional",
2574
- "useDefaults",
2575
- "coerceTypes"
2576
- ], E = new Set([
2577
- "validate",
2578
- "serialize",
2579
- "parse",
2580
- "wrapper",
2581
- "root",
2582
- "schema",
2583
- "keyword",
2584
- "pattern",
2585
- "formats",
2586
- "validate$data",
2587
- "func",
2588
- "obj",
2589
- "Error"
2590
- ]), D = {
2591
- errorDataPath: "",
2592
- format: "`validateFormats: false` can be used instead.",
2593
- nullable: "\"nullable\" keyword is supported by default.",
2594
- jsonPointers: "Deprecated jsPropertySyntax can be used instead.",
2595
- extendRefs: "Deprecated ignoreKeywordsWithRef can be used instead.",
2596
- missingRefs: "Pass empty schema with $id that should be ignored to ajv.addSchema.",
2597
- processCode: "Use option `code: {process: (code, schemaEnv: object) => string}`",
2598
- sourceCode: "Use option `code: {source: true}`",
2599
- strictDefaults: "It is default now, see option `strict`.",
2600
- strictKeywords: "It is default now, see option `strict`.",
2601
- uniqueItems: "\"uniqueItems\" keyword is always validated.",
2602
- unknownFormats: "Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",
2603
- cache: "Map is used as cache, schema object as key.",
2604
- serialize: "Map is used as cache, schema object as key.",
2605
- ajvErrors: "It is default now."
2606
- }, O = {
2607
- ignoreKeywordsWithRef: "",
2608
- jsPropertySyntax: "",
2609
- unicode: "\"minLength\"/\"maxLength\" account for unicode characters by default."
2610
- }, k = 200;
2611
- function A(e) {
2612
- let t = e.strict, n = e.code?.optimize, r = n === !0 || n === void 0 ? 1 : n || 0, i = e.code?.regExp ?? v, a = e.uriResolver ?? _.default;
2613
- return {
2614
- strictSchema: e.strictSchema ?? t ?? !0,
2615
- strictNumbers: e.strictNumbers ?? t ?? !0,
2616
- strictTypes: e.strictTypes ?? t ?? "log",
2617
- strictTuples: e.strictTuples ?? t ?? "log",
2618
- strictRequired: e.strictRequired ?? t ?? !1,
2619
- code: e.code ? {
2620
- ...e.code,
2621
- optimize: r,
2622
- regExp: i
2623
- } : {
2624
- optimize: r,
2625
- regExp: i
2626
- },
2627
- loopRequired: e.loopRequired ?? k,
2628
- loopEnum: e.loopEnum ?? k,
2629
- meta: e.meta ?? !0,
2630
- messages: e.messages ?? !0,
2631
- inlineRefs: e.inlineRefs ?? !0,
2632
- schemaId: e.schemaId ?? "$id",
2633
- addUsedSchema: e.addUsedSchema ?? !0,
2634
- validateSchema: e.validateSchema ?? !0,
2635
- validateFormats: e.validateFormats ?? !0,
2636
- unicodeRegExp: e.unicodeRegExp ?? !0,
2637
- int32range: e.int32range ?? !0,
2638
- uriResolver: a
2639
- };
2640
- }
2641
- var j = class {
2642
- constructor(e = {}) {
2643
- this.schemas = {}, this.refs = {}, this.formats = Object.create(null), this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), e = this.opts = {
2644
- ...e,
2645
- ...A(e)
2646
- };
2647
- let { es5: t, lines: n } = this.opts.code;
2648
- this.scope = new u.ValueScope({
2649
- scope: {},
2650
- prefixes: E,
2651
- es5: t,
2652
- lines: n
2653
- }), this.logger = V(e.logger);
2654
- let r = e.validateFormats;
2655
- e.validateFormats = !1, this.RULES = (0, c.getRules)(), N.call(this, D, e, "NOT SUPPORTED"), N.call(this, O, e, "DEPRECATED", "warn"), this._metaOpts = z.call(this), e.formats && L.call(this), this._addVocabularies(), this._addDefaultMetaSchema(), e.keywords && R.call(this, e.keywords), typeof e.meta == "object" && this.addMetaSchema(e.meta), F.call(this), e.validateFormats = r;
2656
- }
2657
- _addVocabularies() {
2658
- this.addKeyword("$async");
2659
- }
2660
- _addDefaultMetaSchema() {
2661
- let { $data: e, meta: t, schemaId: n } = this.opts, r = g;
2662
- n === "id" && (r = { ...g }, r.id = r.$id, delete r.$id), t && e && this.addMetaSchema(r, r[n], !1);
2663
- }
2664
- defaultMeta() {
2665
- let { meta: e, schemaId: t } = this.opts;
2666
- return this.opts.defaultMeta = typeof e == "object" ? e[t] || e : void 0;
2667
- }
2668
- validate(e, t) {
2669
- let n;
2670
- if (typeof e == "string") {
2671
- if (n = this.getSchema(e), !n) throw Error(`no schema with key or ref "${e}"`);
2672
- } else n = this.compile(e);
2673
- let r = n(t);
2674
- return "$async" in n || (this.errors = n.errors), r;
2675
- }
2676
- compile(e, t) {
2677
- let n = this._addSchema(e, t);
2678
- return n.validate || this._compileSchemaEnv(n);
2679
- }
2680
- compileAsync(e, t) {
2681
- if (typeof this.opts.loadSchema != "function") throw Error("options.loadSchema should be a function");
2682
- let { loadSchema: n } = this.opts;
2683
- return r.call(this, e, t);
2684
- async function r(e, t) {
2685
- await i.call(this, e.$schema);
2686
- let n = this._addSchema(e, t);
2687
- return n.validate || o.call(this, n);
2688
- }
2689
- async function i(e) {
2690
- e && !this.getSchema(e) && await r.call(this, { $ref: e }, !0);
2691
- }
2692
- async function o(e) {
2693
- try {
2694
- return this._compileSchemaEnv(e);
2695
- } catch (t) {
2696
- if (!(t instanceof a.default)) throw t;
2697
- return s.call(this, t), await c.call(this, t.missingSchema), o.call(this, e);
2698
- }
2699
- }
2700
- function s({ missingSchema: e, missingRef: t }) {
2701
- if (this.refs[e]) throw Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`);
2702
- }
2703
- async function c(e) {
2704
- let n = await l.call(this, e);
2705
- this.refs[e] || await i.call(this, n.$schema), this.refs[e] || this.addSchema(n, e, t);
2706
- }
2707
- async function l(e) {
2708
- let t = this._loading[e];
2709
- if (t) return t;
2710
- try {
2711
- return await (this._loading[e] = n(e));
2712
- } finally {
2713
- delete this._loading[e];
2714
- }
2715
- }
2716
- }
2717
- addSchema(e, t, n, r = this.opts.validateSchema) {
2718
- if (Array.isArray(e)) {
2719
- for (let t of e) this.addSchema(t, void 0, n, r);
2720
- return this;
2721
- }
2722
- let i;
2723
- if (typeof e == "object") {
2724
- let { schemaId: t } = this.opts;
2725
- if (i = e[t], i !== void 0 && typeof i != "string") throw Error(`schema ${t} must be string`);
2726
- }
2727
- return t = (0, f.normalizeId)(t || i), this._checkUnique(t), this.schemas[t] = this._addSchema(e, n, t, r, !0), this;
2728
- }
2729
- addMetaSchema(e, t, n = this.opts.validateSchema) {
2730
- return this.addSchema(e, t, !0, n), this;
2731
- }
2732
- validateSchema(e, t) {
2733
- if (typeof e == "boolean") return !0;
2734
- let n;
2735
- if (n = e.$schema, n !== void 0 && typeof n != "string") throw Error("$schema must be a string");
2736
- if (n = n || this.opts.defaultMeta || this.defaultMeta(), !n) return this.logger.warn("meta-schema not available"), this.errors = null, !0;
2737
- let r = this.validate(n, e);
2738
- if (!r && t) {
2739
- let e = "schema is invalid: " + this.errorsText();
2740
- if (this.opts.validateSchema === "log") this.logger.error(e);
2741
- else throw Error(e);
2742
- }
2743
- return r;
2744
- }
2745
- getSchema(e) {
2746
- let t;
2747
- for (; typeof (t = P.call(this, e)) == "string";) e = t;
2748
- if (t === void 0) {
2749
- let { schemaId: n } = this.opts, r = new l.SchemaEnv({
2750
- schema: {},
2751
- schemaId: n
2752
- });
2753
- if (t = l.resolveSchema.call(this, r, e), !t) return;
2754
- this.refs[e] = t;
2755
- }
2756
- return t.validate || this._compileSchemaEnv(t);
2757
- }
2758
- removeSchema(e) {
2759
- if (e instanceof RegExp) return this._removeAllSchemas(this.schemas, e), this._removeAllSchemas(this.refs, e), this;
2760
- switch (typeof e) {
2761
- case "undefined": return this._removeAllSchemas(this.schemas), this._removeAllSchemas(this.refs), this._cache.clear(), this;
2762
- case "string": {
2763
- let t = P.call(this, e);
2764
- return typeof t == "object" && this._cache.delete(t.schema), delete this.schemas[e], delete this.refs[e], this;
2765
- }
2766
- case "object": {
2767
- let t = e;
2768
- this._cache.delete(t);
2769
- let n = e[this.opts.schemaId];
2770
- return n && (n = (0, f.normalizeId)(n), delete this.schemas[n], delete this.refs[n]), this;
2771
- }
2772
- default: throw Error("ajv.removeSchema: invalid parameter");
2773
- }
2774
- }
2775
- addVocabulary(e) {
2776
- for (let t of e) this.addKeyword(t);
2777
- return this;
2778
- }
2779
- addKeyword(e, t) {
2780
- let n;
2781
- if (typeof e == "string") n = e, typeof t == "object" && (this.logger.warn("these parameters are deprecated, see docs for addKeyword"), t.keyword = n);
2782
- else if (typeof e == "object" && t === void 0) {
2783
- if (t = e, n = t.keyword, Array.isArray(n) && !n.length) throw Error("addKeywords: keyword must be string or non-empty array");
2784
- } else throw Error("invalid addKeywords parameters");
2785
- if (H.call(this, n, t), !t) return (0, h.eachItem)(n, (e) => U.call(this, e)), this;
2786
- G.call(this, t);
2787
- let r = {
2788
- ...t,
2789
- type: (0, m.getJSONTypes)(t.type),
2790
- schemaType: (0, m.getJSONTypes)(t.schemaType)
2791
- };
2792
- return (0, h.eachItem)(n, r.type.length === 0 ? (e) => U.call(this, e, r) : (e) => r.type.forEach((t) => U.call(this, e, r, t))), this;
2793
- }
2794
- getKeyword(e) {
2795
- let t = this.RULES.all[e];
2796
- return typeof t == "object" ? t.definition : !!t;
2797
- }
2798
- removeKeyword(e) {
2799
- let { RULES: t } = this;
2800
- delete t.keywords[e], delete t.all[e];
2801
- for (let n of t.rules) {
2802
- let t = n.rules.findIndex((t) => t.keyword === e);
2803
- t >= 0 && n.rules.splice(t, 1);
2804
- }
2805
- return this;
2806
- }
2807
- addFormat(e, t) {
2808
- return typeof t == "string" && (t = new RegExp(t)), this.formats[e] = t, this;
2809
- }
2810
- errorsText(e = this.errors, { separator: t = ", ", dataVar: n = "data" } = {}) {
2811
- return !e || e.length === 0 ? "No errors" : e.map((e) => `${n}${e.instancePath} ${e.message}`).reduce((e, n) => e + t + n);
2812
- }
2813
- $dataMetaSchema(e, t) {
2814
- let n = this.RULES.all;
2815
- e = JSON.parse(JSON.stringify(e));
2816
- for (let r of t) {
2817
- let t = r.split("/").slice(1), i = e;
2818
- for (let e of t) i = i[e];
2819
- for (let e in n) {
2820
- let t = n[e];
2821
- if (typeof t != "object") continue;
2822
- let { $data: r } = t.definition, a = i[e];
2823
- r && a && (i[e] = q(a));
2824
- }
2825
- }
2826
- return e;
2827
- }
2828
- _removeAllSchemas(e, t) {
2829
- for (let n in e) {
2830
- let r = e[n];
2831
- (!t || t.test(n)) && (typeof r == "string" ? delete e[n] : r && !r.meta && (this._cache.delete(r.schema), delete e[n]));
2832
- }
2833
- }
2834
- _addSchema(e, t, n, r = this.opts.validateSchema, i = this.opts.addUsedSchema) {
2835
- let a, { schemaId: o } = this.opts;
2836
- if (typeof e == "object") a = e[o];
2837
- else if (this.opts.jtd) throw Error("schema must be object");
2838
- else if (typeof e != "boolean") throw Error("schema must be object or boolean");
2839
- let s = this._cache.get(e);
2840
- if (s !== void 0) return s;
2841
- n = (0, f.normalizeId)(a || n);
2842
- let c = f.getSchemaRefs.call(this, e, n);
2843
- return s = new l.SchemaEnv({
2844
- schema: e,
2845
- schemaId: o,
2846
- meta: t,
2847
- baseId: n,
2848
- localRefs: c
2849
- }), this._cache.set(s.schema, s), i && !n.startsWith("#") && (n && this._checkUnique(n), this.refs[n] = s), r && this.validateSchema(e, !0), s;
2850
- }
2851
- _checkUnique(e) {
2852
- if (this.schemas[e] || this.refs[e]) throw Error(`schema with key or id "${e}" already exists`);
2853
- }
2854
- _compileSchemaEnv(e) {
2855
- /* istanbul ignore if */
2856
- if (e.meta ? this._compileMetaSchema(e) : l.compileSchema.call(this, e), !e.validate) throw Error("ajv implementation error");
2857
- return e.validate;
2858
- }
2859
- _compileMetaSchema(e) {
2860
- let t = this.opts;
2861
- this.opts = this._metaOpts;
2862
- try {
2863
- l.compileSchema.call(this, e);
2864
- } finally {
2865
- this.opts = t;
2866
- }
2867
- }
2868
- };
2869
- j.ValidationError = i.default, j.MissingRefError = a.default, t.default = j;
2870
- function N(e, t, n, r = "error") {
2871
- for (let i in e) {
2872
- let a = i;
2873
- a in t && this.logger[r](`${n}: option ${i}. ${e[a]}`);
2874
- }
2875
- }
2876
- function P(e) {
2877
- return e = (0, f.normalizeId)(e), this.schemas[e] || this.refs[e];
2878
- }
2879
- function F() {
2880
- let e = this.opts.schemas;
2881
- if (e) if (Array.isArray(e)) this.addSchema(e);
2882
- else for (let t in e) this.addSchema(e[t], t);
2883
- }
2884
- function L() {
2885
- for (let e in this.opts.formats) {
2886
- let t = this.opts.formats[e];
2887
- t && this.addFormat(e, t);
2888
- }
2889
- }
2890
- function R(e) {
2891
- if (Array.isArray(e)) {
2892
- this.addVocabulary(e);
2893
- return;
2894
- }
2895
- this.logger.warn("keywords option as map is deprecated, pass array");
2896
- for (let t in e) {
2897
- let n = e[t];
2898
- n.keyword ||= t, this.addKeyword(n);
2899
- }
2900
- }
2901
- function z() {
2902
- let e = { ...this.opts };
2903
- for (let t of y) delete e[t];
2904
- return e;
2905
- }
2906
- var B = {
2907
- log() {},
2908
- warn() {},
2909
- error() {}
2910
- };
2911
- function V(e) {
2912
- if (e === !1) return B;
2913
- if (e === void 0) return console;
2914
- if (e.log && e.warn && e.error) return e;
2915
- throw Error("logger must implement log, warn and error methods");
2916
- }
2917
- var ee = /^[a-z_$][a-z0-9_$:-]*$/i;
2918
- function H(e, t) {
2919
- let { RULES: n } = this;
2920
- if ((0, h.eachItem)(e, (e) => {
2921
- if (n.keywords[e]) throw Error(`Keyword ${e} is already defined`);
2922
- if (!ee.test(e)) throw Error(`Keyword ${e} has invalid name`);
2923
- }), t && t.$data && !("code" in t || "validate" in t)) throw Error("$data keyword must have \"code\" or \"validate\" function");
2924
- }
2925
- function U(e, t, n) {
2926
- var r;
2927
- let i = t?.post;
2928
- if (n && i) throw Error("keyword with \"post\" flag cannot have \"type\"");
2929
- let { RULES: a } = this, o = i ? a.post : a.rules.find(({ type: e }) => e === n);
2930
- if (o || (o = {
2931
- type: n,
2932
- rules: []
2933
- }, a.rules.push(o)), a.keywords[e] = !0, !t) return;
2934
- let s = {
2935
- keyword: e,
2936
- definition: {
2937
- ...t,
2938
- type: (0, m.getJSONTypes)(t.type),
2939
- schemaType: (0, m.getJSONTypes)(t.schemaType)
2940
- }
2941
- };
2942
- t.before ? W.call(this, o, s, t.before) : o.rules.push(s), a.all[e] = s, (r = t.implements) == null || r.forEach((e) => this.addKeyword(e));
2943
- }
2944
- function W(e, t, n) {
2945
- let r = e.rules.findIndex((e) => e.keyword === n);
2946
- r >= 0 ? e.rules.splice(r, 0, t) : (e.rules.push(t), this.logger.warn(`rule ${n} is not defined`));
2947
- }
2948
- function G(e) {
2949
- let { metaSchema: t } = e;
2950
- t !== void 0 && (e.$data && this.opts.$data && (t = q(t)), e.validateSchema = this.compile(t, !0));
2951
- }
2952
- var K = { $ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#" };
2953
- function q(e) {
2954
- return { anyOf: [e, K] };
2955
- }
2956
- })), R = /* @__PURE__ */ r(((e) => {
2957
- Object.defineProperty(e, "__esModule", { value: !0 }), e.default = {
2958
- keyword: "id",
2959
- code() {
2960
- throw Error("NOT SUPPORTED: keyword \"id\", use \"$id\" for schema ID");
2961
- }
2962
- };
2963
- })), z = /* @__PURE__ */ r(((e) => {
2964
- Object.defineProperty(e, "__esModule", { value: !0 }), e.callRef = e.getValidate = void 0;
2965
- var t = C(), n = h(), r = o(), i = c(), a = w(), l = s(), u = {
2966
- keyword: "$ref",
2967
- schemaType: "string",
2968
- code(e) {
2969
- let { gen: n, schema: i, it: o } = e, { baseId: s, schemaEnv: c, validateName: l, opts: u, self: p } = o, { root: m } = c;
2970
- if ((i === "#" || i === "#/") && s === m.baseId) return g();
2971
- let h = a.resolveRef.call(p, m, s, i);
2972
- if (h === void 0) throw new t.default(o.opts.uriResolver, s, i);
2973
- if (h instanceof a.SchemaEnv) return _(h);
2974
- return v(h);
2975
- function g() {
2976
- if (c === m) return f(e, l, c, c.$async);
2977
- let t = n.scopeValue("root", { ref: m });
2978
- return f(e, (0, r._)`${t}.validate`, m, m.$async);
2979
- }
2980
- function _(t) {
2981
- f(e, d(e, t), t, t.$async);
2982
- }
2983
- function v(t) {
2984
- let a = n.scopeValue("schema", u.code.source === !0 ? {
2985
- ref: t,
2986
- code: (0, r.stringify)(t)
2987
- } : { ref: t }), o = n.name("valid"), s = e.subschema({
2988
- schema: t,
2989
- dataTypes: [],
2990
- schemaPath: r.nil,
2991
- topSchemaRef: a,
2992
- errSchemaPath: i
2993
- }, o);
2994
- e.mergeEvaluated(s), e.ok(o);
2995
- }
2996
- }
2997
- };
2998
- function d(e, t) {
2999
- let { gen: n } = e;
3000
- return t.validate ? n.scopeValue("validate", { ref: t.validate }) : (0, r._)`${n.scopeValue("wrapper", { ref: t })}.validate`;
3001
- }
3002
- e.getValidate = d;
3003
- function f(e, t, a, o) {
3004
- let { gen: s, it: c } = e, { allErrors: u, schemaEnv: d, opts: f } = c, p = f.passContext ? i.default.this : r.nil;
3005
- o ? m() : h();
3006
- function m() {
3007
- if (!d.$async) throw Error("async schema referenced by sync schema");
3008
- let i = s.let("valid");
3009
- s.try(() => {
3010
- s.code((0, r._)`await ${(0, n.callValidateCode)(e, t, p)}`), _(t), u || s.assign(i, !0);
3011
- }, (e) => {
3012
- s.if((0, r._)`!(${e} instanceof ${c.ValidationError})`, () => s.throw(e)), g(e), u || s.assign(i, !1);
3013
- }), e.ok(i);
3014
- }
3015
- function h() {
3016
- e.result((0, n.callValidateCode)(e, t, p), () => _(t), () => g(t));
3017
- }
3018
- function g(e) {
3019
- let t = (0, r._)`${e}.errors`;
3020
- s.assign(i.default.vErrors, (0, r._)`${i.default.vErrors} === null ? ${t} : ${i.default.vErrors}.concat(${t})`), s.assign(i.default.errors, (0, r._)`${i.default.vErrors}.length`);
3021
- }
3022
- function _(e) {
3023
- if (!c.opts.unevaluated) return;
3024
- let t = a?.validate?.evaluated;
3025
- if (c.props !== !0) if (t && !t.dynamicProps) t.props !== void 0 && (c.props = l.mergeEvaluated.props(s, t.props, c.props));
3026
- else {
3027
- let t = s.var("props", (0, r._)`${e}.evaluated.props`);
3028
- c.props = l.mergeEvaluated.props(s, t, c.props, r.Name);
3029
- }
3030
- if (c.items !== !0) if (t && !t.dynamicItems) t.items !== void 0 && (c.items = l.mergeEvaluated.items(s, t.items, c.items));
3031
- else {
3032
- let t = s.var("items", (0, r._)`${e}.evaluated.items`);
3033
- c.items = l.mergeEvaluated.items(s, t, c.items, r.Name);
3034
- }
3035
- }
3036
- }
3037
- e.callRef = f, e.default = u;
3038
- })), B = /* @__PURE__ */ r(((e) => {
3039
- Object.defineProperty(e, "__esModule", { value: !0 });
3040
- var t = R(), n = z();
3041
- e.default = [
3042
- "$schema",
3043
- "$id",
3044
- "$defs",
3045
- "$vocabulary",
3046
- { keyword: "$comment" },
3047
- "definitions",
3048
- t.default,
3049
- n.default
3050
- ];
3051
- })), V = /* @__PURE__ */ r(((e) => {
3052
- Object.defineProperty(e, "__esModule", { value: !0 });
3053
- var t = o(), n = t.operators, r = {
3054
- maximum: {
3055
- okStr: "<=",
3056
- ok: n.LTE,
3057
- fail: n.GT
3058
- },
3059
- minimum: {
3060
- okStr: ">=",
3061
- ok: n.GTE,
3062
- fail: n.LT
3063
- },
3064
- exclusiveMaximum: {
3065
- okStr: "<",
3066
- ok: n.LT,
3067
- fail: n.GTE
3068
- },
3069
- exclusiveMinimum: {
3070
- okStr: ">",
3071
- ok: n.GT,
3072
- fail: n.LTE
3073
- }
3074
- };
3075
- e.default = {
3076
- keyword: Object.keys(r),
3077
- type: "number",
3078
- schemaType: "number",
3079
- $data: !0,
3080
- error: {
3081
- message: ({ keyword: e, schemaCode: n }) => (0, t.str)`must be ${r[e].okStr} ${n}`,
3082
- params: ({ keyword: e, schemaCode: n }) => (0, t._)`{comparison: ${r[e].okStr}, limit: ${n}}`
3083
- },
3084
- code(e) {
3085
- let { keyword: n, data: i, schemaCode: a } = e;
3086
- e.fail$data((0, t._)`${i} ${r[n].fail} ${a} || isNaN(${i})`);
3087
- }
3088
- };
3089
- })), ee = /* @__PURE__ */ r(((e) => {
3090
- Object.defineProperty(e, "__esModule", { value: !0 });
3091
- var t = o();
3092
- e.default = {
3093
- keyword: "multipleOf",
3094
- type: "number",
3095
- schemaType: "number",
3096
- $data: !0,
3097
- error: {
3098
- message: ({ schemaCode: e }) => (0, t.str)`must be multiple of ${e}`,
3099
- params: ({ schemaCode: e }) => (0, t._)`{multipleOf: ${e}}`
3100
- },
3101
- code(e) {
3102
- let { gen: n, data: r, schemaCode: i, it: a } = e, o = a.opts.multipleOfPrecision, s = n.let("res"), c = o ? (0, t._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}` : (0, t._)`${s} !== parseInt(${s})`;
3103
- e.fail$data((0, t._)`(${i} === 0 || (${s} = ${r}/${i}, ${c}))`);
3104
- }
3105
- };
3106
- })), H = /* @__PURE__ */ r(((e) => {
3107
- Object.defineProperty(e, "__esModule", { value: !0 });
3108
- function t(e) {
3109
- let t = e.length, n = 0, r = 0, i;
3110
- for (; r < t;) n++, i = e.charCodeAt(r++), i >= 55296 && i <= 56319 && r < t && (i = e.charCodeAt(r), (i & 64512) == 56320 && r++);
3111
- return n;
3112
- }
3113
- e.default = t, t.code = "require(\"ajv/dist/runtime/ucs2length\").default";
3114
- })), U = /* @__PURE__ */ r(((e) => {
3115
- Object.defineProperty(e, "__esModule", { value: !0 });
3116
- var t = o(), n = s(), r = H();
3117
- e.default = {
3118
- keyword: ["maxLength", "minLength"],
3119
- type: "string",
3120
- schemaType: "number",
3121
- $data: !0,
3122
- error: {
3123
- message({ keyword: e, schemaCode: n }) {
3124
- let r = e === "maxLength" ? "more" : "fewer";
3125
- return (0, t.str)`must NOT have ${r} than ${n} characters`;
3126
- },
3127
- params: ({ schemaCode: e }) => (0, t._)`{limit: ${e}}`
3128
- },
3129
- code(e) {
3130
- let { keyword: i, data: a, schemaCode: o, it: s } = e, c = i === "maxLength" ? t.operators.GT : t.operators.LT, l = s.opts.unicode === !1 ? (0, t._)`${a}.length` : (0, t._)`${(0, n.useFunc)(e.gen, r.default)}(${a})`;
3131
- e.fail$data((0, t._)`${l} ${c} ${o}`);
3132
- }
3133
- };
3134
- })), W = /* @__PURE__ */ r(((e) => {
3135
- Object.defineProperty(e, "__esModule", { value: !0 });
3136
- var t = h(), n = s(), r = o();
3137
- e.default = {
3138
- keyword: "pattern",
3139
- type: "string",
3140
- schemaType: "string",
3141
- $data: !0,
3142
- error: {
3143
- message: ({ schemaCode: e }) => (0, r.str)`must match pattern "${e}"`,
3144
- params: ({ schemaCode: e }) => (0, r._)`{pattern: ${e}}`
3145
- },
3146
- code(e) {
3147
- let { gen: i, data: a, $data: o, schema: s, schemaCode: c, it: l } = e, u = l.opts.unicodeRegExp ? "u" : "";
3148
- if (o) {
3149
- let { regExp: t } = l.opts.code, o = t.code === "new RegExp" ? (0, r._)`new RegExp` : (0, n.useFunc)(i, t), s = i.let("valid");
3150
- i.try(() => i.assign(s, (0, r._)`${o}(${c}, ${u}).test(${a})`), () => i.assign(s, !1)), e.fail$data((0, r._)`!${s}`);
3151
- } else {
3152
- let n = (0, t.usePattern)(e, s);
3153
- e.fail$data((0, r._)`!${n}.test(${a})`);
3154
- }
3155
- }
3156
- };
3157
- })), G = /* @__PURE__ */ r(((e) => {
3158
- Object.defineProperty(e, "__esModule", { value: !0 });
3159
- var t = o();
3160
- e.default = {
3161
- keyword: ["maxProperties", "minProperties"],
3162
- type: "object",
3163
- schemaType: "number",
3164
- $data: !0,
3165
- error: {
3166
- message({ keyword: e, schemaCode: n }) {
3167
- let r = e === "maxProperties" ? "more" : "fewer";
3168
- return (0, t.str)`must NOT have ${r} than ${n} properties`;
3169
- },
3170
- params: ({ schemaCode: e }) => (0, t._)`{limit: ${e}}`
3171
- },
3172
- code(e) {
3173
- let { keyword: n, data: r, schemaCode: i } = e, a = n === "maxProperties" ? t.operators.GT : t.operators.LT;
3174
- e.fail$data((0, t._)`Object.keys(${r}).length ${a} ${i}`);
3175
- }
3176
- };
3177
- })), K = /* @__PURE__ */ r(((e) => {
3178
- Object.defineProperty(e, "__esModule", { value: !0 });
3179
- var t = h(), n = o(), r = s();
3180
- e.default = {
3181
- keyword: "required",
3182
- type: "object",
3183
- schemaType: "array",
3184
- $data: !0,
3185
- error: {
3186
- message: ({ params: { missingProperty: e } }) => (0, n.str)`must have required property '${e}'`,
3187
- params: ({ params: { missingProperty: e } }) => (0, n._)`{missingProperty: ${e}}`
3188
- },
3189
- code(e) {
3190
- let { gen: i, schema: a, schemaCode: o, data: s, $data: c, it: l } = e, { opts: u } = l;
3191
- if (!c && a.length === 0) return;
3192
- let d = a.length >= u.loopRequired;
3193
- if (l.allErrors ? f() : p(), u.strictRequired) {
3194
- let t = e.parentSchema.properties, { definedProperties: n } = e.it;
3195
- for (let e of a) if (t?.[e] === void 0 && !n.has(e)) {
3196
- let t = `required property "${e}" is not defined at "${l.schemaEnv.baseId + l.errSchemaPath}" (strictRequired)`;
3197
- (0, r.checkStrictMode)(l, t, l.opts.strictRequired);
3198
- }
3199
- }
3200
- function f() {
3201
- if (d || c) e.block$data(n.nil, m);
3202
- else for (let n of a) (0, t.checkReportMissingProp)(e, n);
3203
- }
3204
- function p() {
3205
- let n = i.let("missing");
3206
- if (d || c) {
3207
- let t = i.let("valid", !0);
3208
- e.block$data(t, () => h(n, t)), e.ok(t);
3209
- } else i.if((0, t.checkMissingProp)(e, a, n)), (0, t.reportMissingProp)(e, n), i.else();
3210
- }
3211
- function m() {
3212
- i.forOf("prop", o, (n) => {
3213
- e.setParams({ missingProperty: n }), i.if((0, t.noPropertyInData)(i, s, n, u.ownProperties), () => e.error());
3214
- });
3215
- }
3216
- function h(r, a) {
3217
- e.setParams({ missingProperty: r }), i.forOf(r, o, () => {
3218
- i.assign(a, (0, t.propertyInData)(i, s, r, u.ownProperties)), i.if((0, n.not)(a), () => {
3219
- e.error(), i.break();
3220
- });
3221
- }, n.nil);
3222
- }
3223
- }
3224
- };
3225
- })), q = /* @__PURE__ */ r(((e) => {
3226
- Object.defineProperty(e, "__esModule", { value: !0 });
3227
- var t = o();
3228
- e.default = {
3229
- keyword: ["maxItems", "minItems"],
3230
- type: "array",
3231
- schemaType: "number",
3232
- $data: !0,
3233
- error: {
3234
- message({ keyword: e, schemaCode: n }) {
3235
- let r = e === "maxItems" ? "more" : "fewer";
3236
- return (0, t.str)`must NOT have ${r} than ${n} items`;
3237
- },
3238
- params: ({ schemaCode: e }) => (0, t._)`{limit: ${e}}`
3239
- },
3240
- code(e) {
3241
- let { keyword: n, data: r, schemaCode: i } = e, a = n === "maxItems" ? t.operators.GT : t.operators.LT;
3242
- e.fail$data((0, t._)`${r}.length ${a} ${i}`);
3243
- }
3244
- };
3245
- })), J = /* @__PURE__ */ r(((e) => {
3246
- Object.defineProperty(e, "__esModule", { value: !0 });
3247
- var t = v();
3248
- t.code = "require(\"ajv/dist/runtime/equal\").default", e.default = t;
3249
- })), te = /* @__PURE__ */ r(((e) => {
3250
- Object.defineProperty(e, "__esModule", { value: !0 });
3251
- var t = p(), n = o(), r = s(), i = J();
3252
- e.default = {
3253
- keyword: "uniqueItems",
3254
- type: "array",
3255
- schemaType: "boolean",
3256
- $data: !0,
3257
- error: {
3258
- message: ({ params: { i: e, j: t } }) => (0, n.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,
3259
- params: ({ params: { i: e, j: t } }) => (0, n._)`{i: ${e}, j: ${t}}`
3260
- },
3261
- code(e) {
3262
- let { gen: a, data: o, $data: s, schema: c, parentSchema: l, schemaCode: u, it: d } = e;
3263
- if (!s && !c) return;
3264
- let f = a.let("valid"), p = l.items ? (0, t.getSchemaTypes)(l.items) : [];
3265
- e.block$data(f, m, (0, n._)`${u} === false`), e.ok(f);
3266
- function m() {
3267
- let t = a.let("i", (0, n._)`${o}.length`), r = a.let("j");
3268
- e.setParams({
3269
- i: t,
3270
- j: r
3271
- }), a.assign(f, !0), a.if((0, n._)`${t} > 1`, () => (h() ? g : _)(t, r));
3272
- }
3273
- function h() {
3274
- return p.length > 0 && !p.some((e) => e === "object" || e === "array");
3275
- }
3276
- function g(r, i) {
3277
- let s = a.name("item"), c = (0, t.checkDataTypes)(p, s, d.opts.strictNumbers, t.DataType.Wrong), l = a.const("indices", (0, n._)`{}`);
3278
- a.for((0, n._)`;${r}--;`, () => {
3279
- a.let(s, (0, n._)`${o}[${r}]`), a.if(c, (0, n._)`continue`), p.length > 1 && a.if((0, n._)`typeof ${s} == "string"`, (0, n._)`${s} += "_"`), a.if((0, n._)`typeof ${l}[${s}] == "number"`, () => {
3280
- a.assign(i, (0, n._)`${l}[${s}]`), e.error(), a.assign(f, !1).break();
3281
- }).code((0, n._)`${l}[${s}] = ${r}`);
3282
- });
3283
- }
3284
- function _(t, s) {
3285
- let c = (0, r.useFunc)(a, i.default), l = a.name("outer");
3286
- a.label(l).for((0, n._)`;${t}--;`, () => a.for((0, n._)`${s} = ${t}; ${s}--;`, () => a.if((0, n._)`${c}(${o}[${t}], ${o}[${s}])`, () => {
3287
- e.error(), a.assign(f, !1).break(l);
3288
- })));
3289
- }
3290
- }
3291
- };
3292
- })), Y = /* @__PURE__ */ r(((e) => {
3293
- Object.defineProperty(e, "__esModule", { value: !0 });
3294
- var t = o(), n = s(), r = J();
3295
- e.default = {
3296
- keyword: "const",
3297
- $data: !0,
3298
- error: {
3299
- message: "must be equal to constant",
3300
- params: ({ schemaCode: e }) => (0, t._)`{allowedValue: ${e}}`
3301
- },
3302
- code(e) {
3303
- let { gen: i, data: a, $data: o, schemaCode: s, schema: c } = e;
3304
- o || c && typeof c == "object" ? e.fail$data((0, t._)`!${(0, n.useFunc)(i, r.default)}(${a}, ${s})`) : e.fail((0, t._)`${c} !== ${a}`);
3305
- }
3306
- };
3307
- })), ne = /* @__PURE__ */ r(((e) => {
3308
- Object.defineProperty(e, "__esModule", { value: !0 });
3309
- var t = o(), n = s(), r = J();
3310
- e.default = {
3311
- keyword: "enum",
3312
- schemaType: "array",
3313
- $data: !0,
3314
- error: {
3315
- message: "must be equal to one of the allowed values",
3316
- params: ({ schemaCode: e }) => (0, t._)`{allowedValues: ${e}}`
3317
- },
3318
- code(e) {
3319
- let { gen: i, data: a, $data: o, schema: s, schemaCode: c, it: l } = e;
3320
- if (!o && s.length === 0) throw Error("enum must have non-empty array");
3321
- let u = s.length >= l.opts.loopEnum, d, f = () => d ??= (0, n.useFunc)(i, r.default), p;
3322
- if (u || o) p = i.let("valid"), e.block$data(p, m);
3323
- else {
3324
- /* istanbul ignore if */
3325
- if (!Array.isArray(s)) throw Error("ajv implementation error");
3326
- let e = i.const("vSchema", c);
3327
- p = (0, t.or)(...s.map((t, n) => h(e, n)));
3328
- }
3329
- e.pass(p);
3330
- function m() {
3331
- i.assign(p, !1), i.forOf("v", c, (e) => i.if((0, t._)`${f()}(${a}, ${e})`, () => i.assign(p, !0).break()));
3332
- }
3333
- function h(e, n) {
3334
- let r = s[n];
3335
- return typeof r == "object" && r ? (0, t._)`${f()}(${a}, ${e}[${n}])` : (0, t._)`${a} === ${r}`;
3336
- }
3337
- }
3338
- };
3339
- })), X = /* @__PURE__ */ r(((e) => {
3340
- Object.defineProperty(e, "__esModule", { value: !0 });
3341
- var t = V(), n = ee(), r = U(), i = W(), a = G(), o = K(), s = q(), c = te(), l = Y(), u = ne();
3342
- e.default = [
3343
- t.default,
3344
- n.default,
3345
- r.default,
3346
- i.default,
3347
- a.default,
3348
- o.default,
3349
- s.default,
3350
- c.default,
3351
- {
3352
- keyword: "type",
3353
- schemaType: ["string", "array"]
3354
- },
3355
- {
3356
- keyword: "nullable",
3357
- schemaType: "boolean"
3358
- },
3359
- l.default,
3360
- u.default
3361
- ];
3362
- })), Z = /* @__PURE__ */ r(((e) => {
3363
- Object.defineProperty(e, "__esModule", { value: !0 }), e.validateAdditionalItems = void 0;
3364
- var t = o(), n = s(), r = {
3365
- keyword: "additionalItems",
3366
- type: "array",
3367
- schemaType: ["boolean", "object"],
3368
- before: "uniqueItems",
3369
- error: {
3370
- message: ({ params: { len: e } }) => (0, t.str)`must NOT have more than ${e} items`,
3371
- params: ({ params: { len: e } }) => (0, t._)`{limit: ${e}}`
3372
- },
3373
- code(e) {
3374
- let { parentSchema: t, it: r } = e, { items: a } = t;
3375
- if (!Array.isArray(a)) {
3376
- (0, n.checkStrictMode)(r, "\"additionalItems\" is ignored when \"items\" is not an array of schemas");
3377
- return;
3378
- }
3379
- i(e, a);
3380
- }
3381
- };
3382
- function i(e, r) {
3383
- let { gen: i, schema: a, data: o, keyword: s, it: c } = e;
3384
- c.items = !0;
3385
- let l = i.const("len", (0, t._)`${o}.length`);
3386
- if (a === !1) e.setParams({ len: r.length }), e.pass((0, t._)`${l} <= ${r.length}`);
3387
- else if (typeof a == "object" && !(0, n.alwaysValidSchema)(c, a)) {
3388
- let n = i.var("valid", (0, t._)`${l} <= ${r.length}`);
3389
- i.if((0, t.not)(n), () => u(n)), e.ok(n);
3390
- }
3391
- function u(a) {
3392
- i.forRange("i", r.length, l, (r) => {
3393
- e.subschema({
3394
- keyword: s,
3395
- dataProp: r,
3396
- dataPropType: n.Type.Num
3397
- }, a), c.allErrors || i.if((0, t.not)(a), () => i.break());
3398
- });
3399
- }
3400
- }
3401
- e.validateAdditionalItems = i, e.default = r;
3402
- })), Q = /* @__PURE__ */ r(((e) => {
3403
- Object.defineProperty(e, "__esModule", { value: !0 }), e.validateTuple = void 0;
3404
- var t = o(), n = s(), r = h(), i = {
3405
- keyword: "items",
3406
- type: "array",
3407
- schemaType: [
3408
- "object",
3409
- "array",
3410
- "boolean"
3411
- ],
3412
- before: "uniqueItems",
3413
- code(e) {
3414
- let { schema: t, it: i } = e;
3415
- if (Array.isArray(t)) return a(e, "additionalItems", t);
3416
- i.items = !0, !(0, n.alwaysValidSchema)(i, t) && e.ok((0, r.validateArray)(e));
3417
- }
3418
- };
3419
- function a(e, r, i = e.schema) {
3420
- let { gen: a, parentSchema: o, data: s, keyword: c, it: l } = e;
3421
- f(o), l.opts.unevaluated && i.length && l.items !== !0 && (l.items = n.mergeEvaluated.items(a, i.length, l.items));
3422
- let u = a.name("valid"), d = a.const("len", (0, t._)`${s}.length`);
3423
- i.forEach((r, i) => {
3424
- (0, n.alwaysValidSchema)(l, r) || (a.if((0, t._)`${d} > ${i}`, () => e.subschema({
3425
- keyword: c,
3426
- schemaProp: i,
3427
- dataProp: i
3428
- }, u)), e.ok(u));
3429
- });
3430
- function f(e) {
3431
- let { opts: t, errSchemaPath: a } = l, o = i.length, s = o === e.minItems && (o === e.maxItems || e[r] === !1);
3432
- if (t.strictTuples && !s) {
3433
- let e = `"${c}" is ${o}-tuple, but minItems or maxItems/${r} are not specified or different at path "${a}"`;
3434
- (0, n.checkStrictMode)(l, e, t.strictTuples);
3435
- }
3436
- }
3437
- }
3438
- e.validateTuple = a, e.default = i;
3439
- })), re = /* @__PURE__ */ r(((e) => {
3440
- Object.defineProperty(e, "__esModule", { value: !0 });
3441
- var t = Q();
3442
- e.default = {
3443
- keyword: "prefixItems",
3444
- type: "array",
3445
- schemaType: ["array"],
3446
- before: "uniqueItems",
3447
- code: (e) => (0, t.validateTuple)(e, "items")
3448
- };
3449
- })), ie = /* @__PURE__ */ r(((e) => {
3450
- Object.defineProperty(e, "__esModule", { value: !0 });
3451
- var t = o(), n = s(), r = h(), i = Z();
3452
- e.default = {
3453
- keyword: "items",
3454
- type: "array",
3455
- schemaType: ["object", "boolean"],
3456
- before: "uniqueItems",
3457
- error: {
3458
- message: ({ params: { len: e } }) => (0, t.str)`must NOT have more than ${e} items`,
3459
- params: ({ params: { len: e } }) => (0, t._)`{limit: ${e}}`
3460
- },
3461
- code(e) {
3462
- let { schema: t, parentSchema: a, it: o } = e, { prefixItems: s } = a;
3463
- o.items = !0, !(0, n.alwaysValidSchema)(o, t) && (s ? (0, i.validateAdditionalItems)(e, s) : e.ok((0, r.validateArray)(e)));
3464
- }
3465
- };
3466
- })), $ = /* @__PURE__ */ r(((e) => {
3467
- Object.defineProperty(e, "__esModule", { value: !0 });
3468
- var t = o(), n = s();
3469
- e.default = {
3470
- keyword: "contains",
3471
- type: "array",
3472
- schemaType: ["object", "boolean"],
3473
- before: "uniqueItems",
3474
- trackErrors: !0,
3475
- error: {
3476
- message: ({ params: { min: e, max: n } }) => n === void 0 ? (0, t.str)`must contain at least ${e} valid item(s)` : (0, t.str)`must contain at least ${e} and no more than ${n} valid item(s)`,
3477
- params: ({ params: { min: e, max: n } }) => n === void 0 ? (0, t._)`{minContains: ${e}}` : (0, t._)`{minContains: ${e}, maxContains: ${n}}`
3478
- },
3479
- code(e) {
3480
- let { gen: r, schema: i, parentSchema: a, data: o, it: s } = e, c, l, { minContains: u, maxContains: d } = a;
3481
- s.opts.next ? (c = u === void 0 ? 1 : u, l = d) : c = 1;
3482
- let f = r.const("len", (0, t._)`${o}.length`);
3483
- if (e.setParams({
3484
- min: c,
3485
- max: l
3486
- }), l === void 0 && c === 0) {
3487
- (0, n.checkStrictMode)(s, "\"minContains\" == 0 without \"maxContains\": \"contains\" keyword ignored");
3488
- return;
3489
- }
3490
- if (l !== void 0 && c > l) {
3491
- (0, n.checkStrictMode)(s, "\"minContains\" > \"maxContains\" is always invalid"), e.fail();
3492
- return;
3493
- }
3494
- if ((0, n.alwaysValidSchema)(s, i)) {
3495
- let n = (0, t._)`${f} >= ${c}`;
3496
- l !== void 0 && (n = (0, t._)`${n} && ${f} <= ${l}`), e.pass(n);
3497
- return;
3498
- }
3499
- s.items = !0;
3500
- let p = r.name("valid");
3501
- l === void 0 && c === 1 ? h(p, () => r.if(p, () => r.break())) : c === 0 ? (r.let(p, !0), l !== void 0 && r.if((0, t._)`${o}.length > 0`, m)) : (r.let(p, !1), m()), e.result(p, () => e.reset());
3502
- function m() {
3503
- let e = r.name("_valid"), t = r.let("count", 0);
3504
- h(e, () => r.if(e, () => g(t)));
3505
- }
3506
- function h(t, i) {
3507
- r.forRange("i", 0, f, (r) => {
3508
- e.subschema({
3509
- keyword: "contains",
3510
- dataProp: r,
3511
- dataPropType: n.Type.Num,
3512
- compositeRule: !0
3513
- }, t), i();
3514
- });
3515
- }
3516
- function g(e) {
3517
- r.code((0, t._)`${e}++`), l === void 0 ? r.if((0, t._)`${e} >= ${c}`, () => r.assign(p, !0).break()) : (r.if((0, t._)`${e} > ${l}`, () => r.assign(p, !1).break()), c === 1 ? r.assign(p, !0) : r.if((0, t._)`${e} >= ${c}`, () => r.assign(p, !0)));
3518
- }
3519
- }
3520
- };
3521
- })), ae = /* @__PURE__ */ r(((e) => {
3522
- Object.defineProperty(e, "__esModule", { value: !0 }), e.validateSchemaDeps = e.validatePropertyDeps = e.error = void 0;
3523
- var t = o(), n = s(), r = h();
3524
- e.error = {
3525
- message: ({ params: { property: e, depsCount: n, deps: r } }) => {
3526
- let i = n === 1 ? "property" : "properties";
3527
- return (0, t.str)`must have ${i} ${r} when property ${e} is present`;
3528
- },
3529
- params: ({ params: { property: e, depsCount: n, deps: r, missingProperty: i } }) => (0, t._)`{property: ${e},
3530
- missingProperty: ${i},
3531
- depsCount: ${n},
3532
- deps: ${r}}`
3533
- };
3534
- var i = {
3535
- keyword: "dependencies",
3536
- type: "object",
3537
- schemaType: "object",
3538
- error: e.error,
3539
- code(e) {
3540
- let [t, n] = a(e);
3541
- c(e, t), l(e, n);
3542
- }
3543
- };
3544
- function a({ schema: e }) {
3545
- let t = {}, n = {};
3546
- for (let r in e) {
3547
- if (r === "__proto__") continue;
3548
- let i = Array.isArray(e[r]) ? t : n;
3549
- i[r] = e[r];
3550
- }
3551
- return [t, n];
3552
- }
3553
- function c(e, n = e.schema) {
3554
- let { gen: i, data: a, it: o } = e;
3555
- if (Object.keys(n).length === 0) return;
3556
- let s = i.let("missing");
3557
- for (let c in n) {
3558
- let l = n[c];
3559
- if (l.length === 0) continue;
3560
- let u = (0, r.propertyInData)(i, a, c, o.opts.ownProperties);
3561
- e.setParams({
3562
- property: c,
3563
- depsCount: l.length,
3564
- deps: l.join(", ")
3565
- }), o.allErrors ? i.if(u, () => {
3566
- for (let t of l) (0, r.checkReportMissingProp)(e, t);
3567
- }) : (i.if((0, t._)`${u} && (${(0, r.checkMissingProp)(e, l, s)})`), (0, r.reportMissingProp)(e, s), i.else());
3568
- }
3569
- }
3570
- e.validatePropertyDeps = c;
3571
- function l(e, t = e.schema) {
3572
- let { gen: i, data: a, keyword: o, it: s } = e, c = i.name("valid");
3573
- for (let l in t) (0, n.alwaysValidSchema)(s, t[l]) || (i.if((0, r.propertyInData)(i, a, l, s.opts.ownProperties), () => {
3574
- let t = e.subschema({
3575
- keyword: o,
3576
- schemaProp: l
3577
- }, c);
3578
- e.mergeValidEvaluated(t, c);
3579
- }, () => i.var(c, !0)), e.ok(c));
3580
- }
3581
- e.validateSchemaDeps = l, e.default = i;
3582
- })), oe = /* @__PURE__ */ r(((e) => {
3583
- Object.defineProperty(e, "__esModule", { value: !0 });
3584
- var t = o(), n = s();
3585
- e.default = {
3586
- keyword: "propertyNames",
3587
- type: "object",
3588
- schemaType: ["object", "boolean"],
3589
- error: {
3590
- message: "property name must be valid",
3591
- params: ({ params: e }) => (0, t._)`{propertyName: ${e.propertyName}}`
3592
- },
3593
- code(e) {
3594
- let { gen: r, schema: i, data: a, it: o } = e;
3595
- if ((0, n.alwaysValidSchema)(o, i)) return;
3596
- let s = r.name("valid");
3597
- r.forIn("key", a, (n) => {
3598
- e.setParams({ propertyName: n }), e.subschema({
3599
- keyword: "propertyNames",
3600
- data: n,
3601
- dataTypes: ["string"],
3602
- propertyName: n,
3603
- compositeRule: !0
3604
- }, s), r.if((0, t.not)(s), () => {
3605
- e.error(!0), o.allErrors || r.break();
3606
- });
3607
- }), e.ok(s);
3608
- }
3609
- };
3610
- })), se = /* @__PURE__ */ r(((e) => {
3611
- Object.defineProperty(e, "__esModule", { value: !0 });
3612
- var t = h(), n = o(), r = c(), i = s();
3613
- e.default = {
3614
- keyword: "additionalProperties",
3615
- type: ["object"],
3616
- schemaType: ["boolean", "object"],
3617
- allowUndefined: !0,
3618
- trackErrors: !0,
3619
- error: {
3620
- message: "must NOT have additional properties",
3621
- params: ({ params: e }) => (0, n._)`{additionalProperty: ${e.additionalProperty}}`
3622
- },
3623
- code(e) {
3624
- let { gen: a, schema: o, parentSchema: s, data: c, errsCount: l, it: u } = e;
3625
- /* istanbul ignore if */
3626
- if (!l) throw Error("ajv implementation error");
3627
- let { allErrors: d, opts: f } = u;
3628
- if (u.props = !0, f.removeAdditional !== "all" && (0, i.alwaysValidSchema)(u, o)) return;
3629
- let p = (0, t.allSchemaProperties)(s.properties), m = (0, t.allSchemaProperties)(s.patternProperties);
3630
- h(), e.ok((0, n._)`${l} === ${r.default.errors}`);
3631
- function h() {
3632
- a.forIn("key", c, (e) => {
3633
- !p.length && !m.length ? v(e) : a.if(g(e), () => v(e));
3634
- });
3635
- }
3636
- function g(r) {
3637
- let o;
3638
- if (p.length > 8) {
3639
- let e = (0, i.schemaRefOrVal)(u, s.properties, "properties");
3640
- o = (0, t.isOwnProperty)(a, e, r);
3641
- } else o = p.length ? (0, n.or)(...p.map((e) => (0, n._)`${r} === ${e}`)) : n.nil;
3642
- return m.length && (o = (0, n.or)(o, ...m.map((i) => (0, n._)`${(0, t.usePattern)(e, i)}.test(${r})`))), (0, n.not)(o);
3643
- }
3644
- function _(e) {
3645
- a.code((0, n._)`delete ${c}[${e}]`);
3646
- }
3647
- function v(t) {
3648
- if (f.removeAdditional === "all" || f.removeAdditional && o === !1) {
3649
- _(t);
3650
- return;
3651
- }
3652
- if (o === !1) {
3653
- e.setParams({ additionalProperty: t }), e.error(), d || a.break();
3654
- return;
3655
- }
3656
- if (typeof o == "object" && !(0, i.alwaysValidSchema)(u, o)) {
3657
- let r = a.name("valid");
3658
- f.removeAdditional === "failing" ? (y(t, r, !1), a.if((0, n.not)(r), () => {
3659
- e.reset(), _(t);
3660
- })) : (y(t, r), d || a.if((0, n.not)(r), () => a.break()));
3661
- }
3662
- }
3663
- function y(t, n, r) {
3664
- let a = {
3665
- keyword: "additionalProperties",
3666
- dataProp: t,
3667
- dataPropType: i.Type.Str
3668
- };
3669
- r === !1 && Object.assign(a, {
3670
- compositeRule: !0,
3671
- createErrors: !1,
3672
- allErrors: !1
3673
- }), e.subschema(a, n);
3674
- }
3675
- }
3676
- };
3677
- })), ce = /* @__PURE__ */ r(((e) => {
3678
- Object.defineProperty(e, "__esModule", { value: !0 });
3679
- var t = x(), n = h(), r = s(), i = se();
3680
- e.default = {
3681
- keyword: "properties",
3682
- type: "object",
3683
- schemaType: "object",
3684
- code(e) {
3685
- let { gen: a, schema: o, parentSchema: s, data: c, it: l } = e;
3686
- l.opts.removeAdditional === "all" && s.additionalProperties === void 0 && i.default.code(new t.KeywordCxt(l, i.default, "additionalProperties"));
3687
- let u = (0, n.allSchemaProperties)(o);
3688
- for (let e of u) l.definedProperties.add(e);
3689
- l.opts.unevaluated && u.length && l.props !== !0 && (l.props = r.mergeEvaluated.props(a, (0, r.toHash)(u), l.props));
3690
- let d = u.filter((e) => !(0, r.alwaysValidSchema)(l, o[e]));
3691
- if (d.length === 0) return;
3692
- let f = a.name("valid");
3693
- for (let t of d) p(t) ? m(t) : (a.if((0, n.propertyInData)(a, c, t, l.opts.ownProperties)), m(t), l.allErrors || a.else().var(f, !0), a.endIf()), e.it.definedProperties.add(t), e.ok(f);
3694
- function p(e) {
3695
- return l.opts.useDefaults && !l.compositeRule && o[e].default !== void 0;
3696
- }
3697
- function m(t) {
3698
- e.subschema({
3699
- keyword: "properties",
3700
- schemaProp: t,
3701
- dataProp: t
3702
- }, f);
3703
- }
3704
- }
3705
- };
3706
- })), le = /* @__PURE__ */ r(((e) => {
3707
- Object.defineProperty(e, "__esModule", { value: !0 });
3708
- var t = h(), n = o(), r = s(), i = s();
3709
- e.default = {
3710
- keyword: "patternProperties",
3711
- type: "object",
3712
- schemaType: "object",
3713
- code(e) {
3714
- let { gen: a, schema: o, data: s, parentSchema: c, it: l } = e, { opts: u } = l, d = (0, t.allSchemaProperties)(o), f = d.filter((e) => (0, r.alwaysValidSchema)(l, o[e]));
3715
- if (d.length === 0 || f.length === d.length && (!l.opts.unevaluated || l.props === !0)) return;
3716
- let p = u.strictSchema && !u.allowMatchingProperties && c.properties, m = a.name("valid");
3717
- l.props !== !0 && !(l.props instanceof n.Name) && (l.props = (0, i.evaluatedPropsToName)(a, l.props));
3718
- let { props: h } = l;
3719
- g();
3720
- function g() {
3721
- for (let e of d) p && _(e), l.allErrors ? v(e) : (a.var(m, !0), v(e), a.if(m));
3722
- }
3723
- function _(e) {
3724
- for (let t in p) new RegExp(e).test(t) && (0, r.checkStrictMode)(l, `property ${t} matches pattern ${e} (use allowMatchingProperties)`);
3725
- }
3726
- function v(r) {
3727
- a.forIn("key", s, (o) => {
3728
- a.if((0, n._)`${(0, t.usePattern)(e, r)}.test(${o})`, () => {
3729
- let t = f.includes(r);
3730
- t || e.subschema({
3731
- keyword: "patternProperties",
3732
- schemaProp: r,
3733
- dataProp: o,
3734
- dataPropType: i.Type.Str
3735
- }, m), l.opts.unevaluated && h !== !0 ? a.assign((0, n._)`${h}[${o}]`, !0) : !t && !l.allErrors && a.if((0, n.not)(m), () => a.break());
3736
- });
3737
- });
3738
- }
3739
- }
3740
- };
3741
- })), ue = /* @__PURE__ */ r(((e) => {
3742
- Object.defineProperty(e, "__esModule", { value: !0 });
3743
- var t = s();
3744
- e.default = {
3745
- keyword: "not",
3746
- schemaType: ["object", "boolean"],
3747
- trackErrors: !0,
3748
- code(e) {
3749
- let { gen: n, schema: r, it: i } = e;
3750
- if ((0, t.alwaysValidSchema)(i, r)) {
3751
- e.fail();
3752
- return;
3753
- }
3754
- let a = n.name("valid");
3755
- e.subschema({
3756
- keyword: "not",
3757
- compositeRule: !0,
3758
- createErrors: !1,
3759
- allErrors: !1
3760
- }, a), e.failResult(a, () => e.reset(), () => e.error());
3761
- },
3762
- error: { message: "must NOT be valid" }
3763
- };
3764
- })), de = /* @__PURE__ */ r(((e) => {
3765
- Object.defineProperty(e, "__esModule", { value: !0 }), e.default = {
3766
- keyword: "anyOf",
3767
- schemaType: "array",
3768
- trackErrors: !0,
3769
- code: h().validateUnion,
3770
- error: { message: "must match a schema in anyOf" }
3771
- };
3772
- })), fe = /* @__PURE__ */ r(((e) => {
3773
- Object.defineProperty(e, "__esModule", { value: !0 });
3774
- var t = o(), n = s();
3775
- e.default = {
3776
- keyword: "oneOf",
3777
- schemaType: "array",
3778
- trackErrors: !0,
3779
- error: {
3780
- message: "must match exactly one schema in oneOf",
3781
- params: ({ params: e }) => (0, t._)`{passingSchemas: ${e.passing}}`
3782
- },
3783
- code(e) {
3784
- let { gen: r, schema: i, parentSchema: a, it: o } = e;
3785
- /* istanbul ignore if */
3786
- if (!Array.isArray(i)) throw Error("ajv implementation error");
3787
- if (o.opts.discriminator && a.discriminator) return;
3788
- let s = i, c = r.let("valid", !1), l = r.let("passing", null), u = r.name("_valid");
3789
- e.setParams({ passing: l }), r.block(d), e.result(c, () => e.reset(), () => e.error(!0));
3790
- function d() {
3791
- s.forEach((i, a) => {
3792
- let s;
3793
- (0, n.alwaysValidSchema)(o, i) ? r.var(u, !0) : s = e.subschema({
3794
- keyword: "oneOf",
3795
- schemaProp: a,
3796
- compositeRule: !0
3797
- }, u), a > 0 && r.if((0, t._)`${u} && ${c}`).assign(c, !1).assign(l, (0, t._)`[${l}, ${a}]`).else(), r.if(u, () => {
3798
- r.assign(c, !0), r.assign(l, a), s && e.mergeEvaluated(s, t.Name);
3799
- });
3800
- });
3801
- }
3802
- }
3803
- };
3804
- })), pe = /* @__PURE__ */ r(((e) => {
3805
- Object.defineProperty(e, "__esModule", { value: !0 });
3806
- var t = s();
3807
- e.default = {
3808
- keyword: "allOf",
3809
- schemaType: "array",
3810
- code(e) {
3811
- let { gen: n, schema: r, it: i } = e;
3812
- /* istanbul ignore if */
3813
- if (!Array.isArray(r)) throw Error("ajv implementation error");
3814
- let a = n.name("valid");
3815
- r.forEach((n, r) => {
3816
- if ((0, t.alwaysValidSchema)(i, n)) return;
3817
- let o = e.subschema({
3818
- keyword: "allOf",
3819
- schemaProp: r
3820
- }, a);
3821
- e.ok(a), e.mergeEvaluated(o);
3822
- });
3823
- }
3824
- };
3825
- })), me = /* @__PURE__ */ r(((e) => {
3826
- Object.defineProperty(e, "__esModule", { value: !0 });
3827
- var t = o(), n = s(), r = {
3828
- keyword: "if",
3829
- schemaType: ["object", "boolean"],
3830
- trackErrors: !0,
3831
- error: {
3832
- message: ({ params: e }) => (0, t.str)`must match "${e.ifClause}" schema`,
3833
- params: ({ params: e }) => (0, t._)`{failingKeyword: ${e.ifClause}}`
3834
- },
3835
- code(e) {
3836
- let { gen: r, parentSchema: a, it: o } = e;
3837
- a.then === void 0 && a.else === void 0 && (0, n.checkStrictMode)(o, "\"if\" without \"then\" and \"else\" is ignored");
3838
- let s = i(o, "then"), c = i(o, "else");
3839
- if (!s && !c) return;
3840
- let l = r.let("valid", !0), u = r.name("_valid");
3841
- if (d(), e.reset(), s && c) {
3842
- let t = r.let("ifClause");
3843
- e.setParams({ ifClause: t }), r.if(u, f("then", t), f("else", t));
3844
- } else s ? r.if(u, f("then")) : r.if((0, t.not)(u), f("else"));
3845
- e.pass(l, () => e.error(!0));
3846
- function d() {
3847
- let t = e.subschema({
3848
- keyword: "if",
3849
- compositeRule: !0,
3850
- createErrors: !1,
3851
- allErrors: !1
3852
- }, u);
3853
- e.mergeEvaluated(t);
3854
- }
3855
- function f(n, i) {
3856
- return () => {
3857
- let a = e.subschema({ keyword: n }, u);
3858
- r.assign(l, u), e.mergeValidEvaluated(a, l), i ? r.assign(i, (0, t._)`${n}`) : e.setParams({ ifClause: n });
3859
- };
3860
- }
3861
- }
3862
- };
3863
- function i(e, t) {
3864
- let r = e.schema[t];
3865
- return r !== void 0 && !(0, n.alwaysValidSchema)(e, r);
3866
- }
3867
- e.default = r;
3868
- })), he = /* @__PURE__ */ r(((e) => {
3869
- Object.defineProperty(e, "__esModule", { value: !0 });
3870
- var t = s();
3871
- e.default = {
3872
- keyword: ["then", "else"],
3873
- schemaType: ["object", "boolean"],
3874
- code({ keyword: e, parentSchema: n, it: r }) {
3875
- n.if === void 0 && (0, t.checkStrictMode)(r, `"${e}" without "if" is ignored`);
3876
- }
3877
- };
3878
- })), ge = /* @__PURE__ */ r(((e) => {
3879
- Object.defineProperty(e, "__esModule", { value: !0 });
3880
- var t = Z(), n = re(), r = Q(), i = ie(), a = $(), o = ae(), s = oe(), c = se(), l = ce(), u = le(), d = ue(), f = de(), p = fe(), m = pe(), h = me(), g = he();
3881
- function _(e = !1) {
3882
- let _ = [
3883
- d.default,
3884
- f.default,
3885
- p.default,
3886
- m.default,
3887
- h.default,
3888
- g.default,
3889
- s.default,
3890
- c.default,
3891
- o.default,
3892
- l.default,
3893
- u.default
3894
- ];
3895
- return e ? _.push(n.default, i.default) : _.push(t.default, r.default), _.push(a.default), _;
3896
- }
3897
- e.default = _;
3898
- })), _e = /* @__PURE__ */ r(((e) => {
3899
- Object.defineProperty(e, "__esModule", { value: !0 });
3900
- var t = o();
3901
- e.default = {
3902
- keyword: "format",
3903
- type: ["number", "string"],
3904
- schemaType: "string",
3905
- $data: !0,
3906
- error: {
3907
- message: ({ schemaCode: e }) => (0, t.str)`must match format "${e}"`,
3908
- params: ({ schemaCode: e }) => (0, t._)`{format: ${e}}`
3909
- },
3910
- code(e, n) {
3911
- let { gen: r, data: i, $data: a, schema: o, schemaCode: s, it: c } = e, { opts: l, errSchemaPath: u, schemaEnv: d, self: f } = c;
3912
- if (!l.validateFormats) return;
3913
- a ? p() : m();
3914
- function p() {
3915
- let a = r.scopeValue("formats", {
3916
- ref: f.formats,
3917
- code: l.code.formats
3918
- }), o = r.const("fDef", (0, t._)`${a}[${s}]`), c = r.let("fType"), u = r.let("format");
3919
- r.if((0, t._)`typeof ${o} == "object" && !(${o} instanceof RegExp)`, () => r.assign(c, (0, t._)`${o}.type || "string"`).assign(u, (0, t._)`${o}.validate`), () => r.assign(c, (0, t._)`"string"`).assign(u, o)), e.fail$data((0, t.or)(p(), m()));
3920
- function p() {
3921
- return l.strictSchema === !1 ? t.nil : (0, t._)`${s} && !${u}`;
3922
- }
3923
- function m() {
3924
- let e = d.$async ? (0, t._)`(${o}.async ? await ${u}(${i}) : ${u}(${i}))` : (0, t._)`${u}(${i})`, r = (0, t._)`(typeof ${u} == "function" ? ${e} : ${u}.test(${i}))`;
3925
- return (0, t._)`${u} && ${u} !== true && ${c} === ${n} && !${r}`;
3926
- }
3927
- }
3928
- function m() {
3929
- let a = f.formats[o];
3930
- if (!a) {
3931
- m();
3932
- return;
3933
- }
3934
- if (a === !0) return;
3935
- let [s, c, p] = h(a);
3936
- s === n && e.pass(g());
3937
- function m() {
3938
- if (l.strictSchema === !1) {
3939
- f.logger.warn(e());
3940
- return;
3941
- }
3942
- throw Error(e());
3943
- function e() {
3944
- return `unknown format "${o}" ignored in schema at path "${u}"`;
3945
- }
3946
- }
3947
- function h(e) {
3948
- let n = e instanceof RegExp ? (0, t.regexpCode)(e) : l.code.formats ? (0, t._)`${l.code.formats}${(0, t.getProperty)(o)}` : void 0, i = r.scopeValue("formats", {
3949
- key: o,
3950
- ref: e,
3951
- code: n
3952
- });
3953
- return typeof e == "object" && !(e instanceof RegExp) ? [
3954
- e.type || "string",
3955
- e.validate,
3956
- (0, t._)`${i}.validate`
3957
- ] : [
3958
- "string",
3959
- e,
3960
- i
3961
- ];
3962
- }
3963
- function g() {
3964
- if (typeof a == "object" && !(a instanceof RegExp) && a.async) {
3965
- if (!d.$async) throw Error("async format in sync schema");
3966
- return (0, t._)`await ${p}(${i})`;
3967
- }
3968
- return typeof c == "function" ? (0, t._)`${p}(${i})` : (0, t._)`${p}.test(${i})`;
3969
- }
3970
- }
3971
- }
3972
- };
3973
- })), ve = /* @__PURE__ */ r(((e) => {
3974
- Object.defineProperty(e, "__esModule", { value: !0 }), e.default = [_e().default];
3975
- })), ye = /* @__PURE__ */ r(((e) => {
3976
- Object.defineProperty(e, "__esModule", { value: !0 }), e.contentVocabulary = e.metadataVocabulary = void 0, e.metadataVocabulary = [
3977
- "title",
3978
- "description",
3979
- "default",
3980
- "deprecated",
3981
- "readOnly",
3982
- "writeOnly",
3983
- "examples"
3984
- ], e.contentVocabulary = [
3985
- "contentMediaType",
3986
- "contentEncoding",
3987
- "contentSchema"
3988
- ];
3989
- })), be = /* @__PURE__ */ r(((e) => {
3990
- Object.defineProperty(e, "__esModule", { value: !0 });
3991
- var t = B(), n = X(), r = ge(), i = ve(), a = ye();
3992
- e.default = [
3993
- t.default,
3994
- n.default,
3995
- (0, r.default)(),
3996
- i.default,
3997
- a.metadataVocabulary,
3998
- a.contentVocabulary
3999
- ];
4000
- })), xe = /* @__PURE__ */ r(((e) => {
4001
- Object.defineProperty(e, "__esModule", { value: !0 }), e.DiscrError = void 0;
4002
- var t;
4003
- (function(e) {
4004
- e.Tag = "tag", e.Mapping = "mapping";
4005
- })(t || (e.DiscrError = t = {}));
4006
- })), Se = /* @__PURE__ */ r(((e) => {
4007
- Object.defineProperty(e, "__esModule", { value: !0 });
4008
- var t = o(), n = xe(), r = w(), i = C(), a = s();
4009
- e.default = {
4010
- keyword: "discriminator",
4011
- type: "object",
4012
- schemaType: "object",
4013
- error: {
4014
- message: ({ params: { discrError: e, tagName: t } }) => e === n.DiscrError.Tag ? `tag "${t}" must be string` : `value of tag "${t}" must be in oneOf`,
4015
- params: ({ params: { discrError: e, tag: n, tagName: r } }) => (0, t._)`{error: ${e}, tag: ${r}, tagValue: ${n}}`
4016
- },
4017
- code(e) {
4018
- let { gen: o, data: s, schema: c, parentSchema: l, it: u } = e, { oneOf: d } = l;
4019
- if (!u.opts.discriminator) throw Error("discriminator: requires discriminator option");
4020
- let f = c.propertyName;
4021
- if (typeof f != "string") throw Error("discriminator: requires propertyName");
4022
- if (c.mapping) throw Error("discriminator: mapping is not supported");
4023
- if (!d) throw Error("discriminator: requires oneOf keyword");
4024
- let p = o.let("valid", !1), m = o.const("tag", (0, t._)`${s}${(0, t.getProperty)(f)}`);
4025
- o.if((0, t._)`typeof ${m} == "string"`, () => h(), () => e.error(!1, {
4026
- discrError: n.DiscrError.Tag,
4027
- tag: m,
4028
- tagName: f
4029
- })), e.ok(p);
4030
- function h() {
4031
- let r = _();
4032
- o.if(!1);
4033
- for (let e in r) o.elseIf((0, t._)`${m} === ${e}`), o.assign(p, g(r[e]));
4034
- o.else(), e.error(!1, {
4035
- discrError: n.DiscrError.Mapping,
4036
- tag: m,
4037
- tagName: f
4038
- }), o.endIf();
4039
- }
4040
- function g(n) {
4041
- let r = o.name("valid"), i = e.subschema({
4042
- keyword: "oneOf",
4043
- schemaProp: n
4044
- }, r);
4045
- return e.mergeEvaluated(i, t.Name), r;
4046
- }
4047
- function _() {
4048
- let e = {}, t = o(l), n = !0;
4049
- for (let e = 0; e < d.length; e++) {
4050
- let c = d[e];
4051
- if (c?.$ref && !(0, a.schemaHasRulesButRef)(c, u.self.RULES)) {
4052
- let e = c.$ref;
4053
- if (c = r.resolveRef.call(u.self, u.schemaEnv.root, u.baseId, e), c instanceof r.SchemaEnv && (c = c.schema), c === void 0) throw new i.default(u.opts.uriResolver, u.baseId, e);
4054
- }
4055
- let l = c?.properties?.[f];
4056
- if (typeof l != "object") throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${f}"`);
4057
- n &&= t || o(c), s(l, e);
4058
- }
4059
- if (!n) throw Error(`discriminator: "${f}" must be required`);
4060
- return e;
4061
- function o({ required: e }) {
4062
- return Array.isArray(e) && e.includes(f);
4063
- }
4064
- function s(e, t) {
4065
- if (e.const) c(e.const, t);
4066
- else if (e.enum) for (let n of e.enum) c(n, t);
4067
- else throw Error(`discriminator: "properties/${f}" must have "const" or "enum"`);
4068
- }
4069
- function c(t, n) {
4070
- if (typeof t != "string" || t in e) throw Error(`discriminator: "${f}" values must be unique strings`);
4071
- e[t] = n;
4072
- }
4073
- }
4074
- }
4075
- };
4076
- })), Ce = /* @__PURE__ */ n({
4077
- $id: () => Te,
4078
- $schema: () => we,
4079
- default: () => Ae,
4080
- definitions: () => De,
4081
- properties: () => ke,
4082
- title: () => Ee,
4083
- type: () => Oe
4084
- }), we, Te, Ee, De, Oe, ke, Ae, je = t((() => {
4085
- we = "http://json-schema.org/draft-07/schema#", Te = "http://json-schema.org/draft-07/schema#", Ee = "Core schema meta-schema", De = {
4086
- schemaArray: {
4087
- type: "array",
4088
- minItems: 1,
4089
- items: { $ref: "#" }
4090
- },
4091
- nonNegativeInteger: {
4092
- type: "integer",
4093
- minimum: 0
4094
- },
4095
- nonNegativeIntegerDefault0: { allOf: [{ $ref: "#/definitions/nonNegativeInteger" }, { default: 0 }] },
4096
- simpleTypes: { enum: [
4097
- "array",
4098
- "boolean",
4099
- "integer",
4100
- "null",
4101
- "number",
4102
- "object",
4103
- "string"
4104
- ] },
4105
- stringArray: {
4106
- type: "array",
4107
- items: { type: "string" },
4108
- uniqueItems: !0,
4109
- default: []
4110
- }
4111
- }, Oe = ["object", "boolean"], ke = {
4112
- $id: {
4113
- type: "string",
4114
- format: "uri-reference"
4115
- },
4116
- $schema: {
4117
- type: "string",
4118
- format: "uri"
4119
- },
4120
- $ref: {
4121
- type: "string",
4122
- format: "uri-reference"
4123
- },
4124
- $comment: { type: "string" },
4125
- title: { type: "string" },
4126
- description: { type: "string" },
4127
- default: !0,
4128
- readOnly: {
4129
- type: "boolean",
4130
- default: !1
4131
- },
4132
- examples: {
4133
- type: "array",
4134
- items: !0
4135
- },
4136
- multipleOf: {
4137
- type: "number",
4138
- exclusiveMinimum: 0
4139
- },
4140
- maximum: { type: "number" },
4141
- exclusiveMaximum: { type: "number" },
4142
- minimum: { type: "number" },
4143
- exclusiveMinimum: { type: "number" },
4144
- maxLength: { $ref: "#/definitions/nonNegativeInteger" },
4145
- minLength: { $ref: "#/definitions/nonNegativeIntegerDefault0" },
4146
- pattern: {
4147
- type: "string",
4148
- format: "regex"
4149
- },
4150
- additionalItems: { $ref: "#" },
4151
- items: {
4152
- anyOf: [{ $ref: "#" }, { $ref: "#/definitions/schemaArray" }],
4153
- default: !0
4154
- },
4155
- maxItems: { $ref: "#/definitions/nonNegativeInteger" },
4156
- minItems: { $ref: "#/definitions/nonNegativeIntegerDefault0" },
4157
- uniqueItems: {
4158
- type: "boolean",
4159
- default: !1
4160
- },
4161
- contains: { $ref: "#" },
4162
- maxProperties: { $ref: "#/definitions/nonNegativeInteger" },
4163
- minProperties: { $ref: "#/definitions/nonNegativeIntegerDefault0" },
4164
- required: { $ref: "#/definitions/stringArray" },
4165
- additionalProperties: { $ref: "#" },
4166
- definitions: {
4167
- type: "object",
4168
- additionalProperties: { $ref: "#" },
4169
- default: {}
4170
- },
4171
- properties: {
4172
- type: "object",
4173
- additionalProperties: { $ref: "#" },
4174
- default: {}
4175
- },
4176
- patternProperties: {
4177
- type: "object",
4178
- additionalProperties: { $ref: "#" },
4179
- propertyNames: { format: "regex" },
4180
- default: {}
4181
- },
4182
- dependencies: {
4183
- type: "object",
4184
- additionalProperties: { anyOf: [{ $ref: "#" }, { $ref: "#/definitions/stringArray" }] }
4185
- },
4186
- propertyNames: { $ref: "#" },
4187
- const: !0,
4188
- enum: {
4189
- type: "array",
4190
- items: !0,
4191
- minItems: 1,
4192
- uniqueItems: !0
4193
- },
4194
- type: { anyOf: [{ $ref: "#/definitions/simpleTypes" }, {
4195
- type: "array",
4196
- items: { $ref: "#/definitions/simpleTypes" },
4197
- minItems: 1,
4198
- uniqueItems: !0
4199
- }] },
4200
- format: { type: "string" },
4201
- contentMediaType: { type: "string" },
4202
- contentEncoding: { type: "string" },
4203
- if: { $ref: "#" },
4204
- then: { $ref: "#" },
4205
- else: { $ref: "#" },
4206
- allOf: { $ref: "#/definitions/schemaArray" },
4207
- anyOf: { $ref: "#/definitions/schemaArray" },
4208
- oneOf: { $ref: "#/definitions/schemaArray" },
4209
- not: { $ref: "#" }
4210
- }, Ae = {
4211
- $schema: we,
4212
- $id: Te,
4213
- title: Ee,
4214
- definitions: De,
4215
- type: Oe,
4216
- properties: ke,
4217
- default: !0
4218
- };
4219
- })), Me = /* @__PURE__ */ r(((t, n) => {
4220
- 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;
4221
- var r = L(), i = be(), a = Se(), s = (je(), e(Ce).default), c = ["/properties"], l = "http://json-schema.org/draft-07/schema", u = class extends r.default {
4222
- _addVocabularies() {
4223
- super._addVocabularies(), i.default.forEach((e) => this.addVocabulary(e)), this.opts.discriminator && this.addKeyword(a.default);
4224
- }
4225
- _addDefaultMetaSchema() {
4226
- if (super._addDefaultMetaSchema(), !this.opts.meta) return;
4227
- let e = this.opts.$data ? this.$dataMetaSchema(s, c) : s;
4228
- this.addMetaSchema(e, l, !1), this.refs["http://json-schema.org/schema"] = l;
4229
- }
4230
- defaultMeta() {
4231
- return this.opts.defaultMeta = super.defaultMeta() || (this.getSchema(l) ? l : void 0);
4232
- }
4233
- };
4234
- t.Ajv = u, n.exports = t = u, n.exports.Ajv = u, Object.defineProperty(t, "__esModule", { value: !0 }), t.default = u;
4235
- var d = x();
4236
- Object.defineProperty(t, "KeywordCxt", {
4237
- enumerable: !0,
4238
- get: function() {
4239
- return d.KeywordCxt;
4240
- }
4241
- });
4242
- var f = o();
4243
- Object.defineProperty(t, "_", {
4244
- enumerable: !0,
4245
- get: function() {
4246
- return f._;
4247
- }
4248
- }), Object.defineProperty(t, "str", {
4249
- enumerable: !0,
4250
- get: function() {
4251
- return f.str;
4252
- }
4253
- }), Object.defineProperty(t, "stringify", {
4254
- enumerable: !0,
4255
- get: function() {
4256
- return f.stringify;
4257
- }
4258
- }), Object.defineProperty(t, "nil", {
4259
- enumerable: !0,
4260
- get: function() {
4261
- return f.nil;
4262
- }
4263
- }), Object.defineProperty(t, "Name", {
4264
- enumerable: !0,
4265
- get: function() {
4266
- return f.Name;
4267
- }
4268
- }), Object.defineProperty(t, "CodeGen", {
4269
- enumerable: !0,
4270
- get: function() {
4271
- return f.CodeGen;
4272
- }
4273
- });
4274
- var p = S();
4275
- Object.defineProperty(t, "ValidationError", {
4276
- enumerable: !0,
4277
- get: function() {
4278
- return p.default;
4279
- }
4280
- });
4281
- var m = C();
4282
- Object.defineProperty(t, "MissingRefError", {
4283
- enumerable: !0,
4284
- get: function() {
4285
- return m.default;
4286
- }
4287
- });
4288
- }));
4289
- //#endregion
4290
- export { Me as t };