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