@wp-playground/client 0.6.7 → 0.6.8
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/index.cjs +13 -13
- package/index.d.ts +41 -3
- package/index.js +938 -812
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -865,14 +865,14 @@ echo json_encode($deactivated_plugins);
|
|
|
865
865
|
PATH_CURRENT_SITE: r
|
|
866
866
|
}
|
|
867
867
|
});
|
|
868
|
-
const p = new URL(await e.absoluteUrl),
|
|
868
|
+
const p = new URL(await e.absoluteUrl), g = isURLScoped(p) ? "scope:" + getURLScope(p) : null;
|
|
869
869
|
await e.writeFile(
|
|
870
870
|
joinPaths(s, "/wp-content/sunrise.php"),
|
|
871
871
|
`<?php
|
|
872
872
|
if ( !defined( 'BLOG_ID_CURRENT_SITE' ) ) {
|
|
873
873
|
define( 'BLOG_ID_CURRENT_SITE', 1 );
|
|
874
874
|
}
|
|
875
|
-
$folder = ${phpVar(
|
|
875
|
+
$folder = ${phpVar(g)};
|
|
876
876
|
if ($folder && strpos($_SERVER['REQUEST_URI'],"/$folder") === false) {
|
|
877
877
|
$_SERVER['HTTP_HOST'] = ${phpVar(p.hostname)};
|
|
878
878
|
$_SERVER['REQUEST_URI'] = "/$folder/" . ltrim($_SERVER['REQUEST_URI'], '/');
|
|
@@ -927,9 +927,9 @@ const cp = async (e, { fromPath: t, toPath: r }) => {
|
|
|
927
927
|
);
|
|
928
928
|
const c = getFormData(o);
|
|
929
929
|
c.fetch_attachments = "1";
|
|
930
|
-
for (const
|
|
931
|
-
if (
|
|
932
|
-
const R = "user_new[" +
|
|
930
|
+
for (const g in c)
|
|
931
|
+
if (g.startsWith("user_map[")) {
|
|
932
|
+
const R = "user_new[" + g.slice(9, -1) + "]";
|
|
933
933
|
c[R] = "1";
|
|
934
934
|
}
|
|
935
935
|
const d = await e.request({
|
|
@@ -1071,13 +1071,13 @@ const tmpPath = "/tmp/file.zip", unzip = async (e, { zipFile: t, zipPath: r, ext
|
|
|
1071
1071
|
}), s = joinPaths(s, r);
|
|
1072
1072
|
const i = joinPaths(s, "wp-content"), o = joinPaths(n, "wp-content");
|
|
1073
1073
|
for (const p of wpContentFilesExcludedFromExport) {
|
|
1074
|
-
const
|
|
1074
|
+
const g = joinPaths(
|
|
1075
1075
|
i,
|
|
1076
1076
|
p
|
|
1077
1077
|
);
|
|
1078
|
-
await removePath(e,
|
|
1078
|
+
await removePath(e, g);
|
|
1079
1079
|
const R = joinPaths(o, p);
|
|
1080
|
-
await e.fileExists(R) && (await e.mkdir(dirname(
|
|
1080
|
+
await e.fileExists(R) && (await e.mkdir(dirname(g)), await e.mv(R, g));
|
|
1081
1081
|
}
|
|
1082
1082
|
const c = joinPaths(
|
|
1083
1083
|
s,
|
|
@@ -1138,10 +1138,10 @@ async function installAsset(e, { targetPath: t, zipFile: r }) {
|
|
|
1138
1138
|
});
|
|
1139
1139
|
d = d.filter((O) => !O.endsWith("/__MACOSX"));
|
|
1140
1140
|
const u = d.length === 1 && await e.isDir(d[0]);
|
|
1141
|
-
let p,
|
|
1142
|
-
u ? (
|
|
1141
|
+
let p, g = "";
|
|
1142
|
+
u ? (g = d[0], p = d[0].split("/").pop()) : (g = c, p = s);
|
|
1143
1143
|
const R = `${t}/${p}`;
|
|
1144
|
-
return await e.mv(
|
|
1144
|
+
return await e.mv(g, R), {
|
|
1145
1145
|
assetFolderPath: R,
|
|
1146
1146
|
assetFolderName: p
|
|
1147
1147
|
};
|
|
@@ -1903,20 +1903,21 @@ class PHPRequestHandler {
|
|
|
1903
1903
|
te(this, Fe, new Semaphore({ concurrency: 1 }));
|
|
1904
1904
|
const {
|
|
1905
1905
|
documentRoot: n = "/www/",
|
|
1906
|
-
absoluteUrl: s = typeof location == "object" ? location == null ? void 0 : location.href : ""
|
|
1906
|
+
absoluteUrl: s = typeof location == "object" ? location == null ? void 0 : location.href : "",
|
|
1907
|
+
rewriteRules: i = []
|
|
1907
1908
|
} = r;
|
|
1908
1909
|
this.php = t, te(this, Pe, n);
|
|
1909
|
-
const
|
|
1910
|
-
te(this, dt,
|
|
1911
|
-
const
|
|
1910
|
+
const o = new URL(s);
|
|
1911
|
+
te(this, dt, o.hostname), te(this, De, o.port ? Number(o.port) : o.protocol === "https:" ? 443 : 80), te(this, Ke, (o.protocol || "").replace(":", ""));
|
|
1912
|
+
const c = H(this, De) !== 443 && H(this, De) !== 80;
|
|
1912
1913
|
te(this, Je, [
|
|
1913
1914
|
H(this, dt),
|
|
1914
|
-
|
|
1915
|
-
].join("")), te(this, ve,
|
|
1915
|
+
c ? `:${H(this, De)}` : ""
|
|
1916
|
+
].join("")), te(this, ve, o.pathname.replace(/\/+$/, "")), te(this, Qe, [
|
|
1916
1917
|
`${H(this, Ke)}://`,
|
|
1917
1918
|
H(this, Je),
|
|
1918
1919
|
H(this, ve)
|
|
1919
|
-
].join(""));
|
|
1920
|
+
].join("")), this.rewriteRules = i;
|
|
1920
1921
|
}
|
|
1921
1922
|
/** @inheritDoc */
|
|
1922
1923
|
pathToInternalUrl(t) {
|
|
@@ -1943,9 +1944,9 @@ class PHPRequestHandler {
|
|
|
1943
1944
|
const r = t.url.startsWith("http://") || t.url.startsWith("https://"), n = new URL(
|
|
1944
1945
|
t.url,
|
|
1945
1946
|
r ? void 0 : DEFAULT_BASE_URL
|
|
1946
|
-
), s =
|
|
1947
|
-
n.pathname,
|
|
1948
|
-
|
|
1947
|
+
), s = applyRewriteRules(
|
|
1948
|
+
removePathPrefix(n.pathname, H(this, ve)),
|
|
1949
|
+
this.rewriteRules
|
|
1949
1950
|
), i = `${H(this, Pe)}${s}`;
|
|
1950
1951
|
return seemsLikeAPHPRequestHandlerPath(i) ? await ce(this, _t, Wt).call(this, t, n) : ce(this, mt, zt).call(this, i);
|
|
1951
1952
|
}
|
|
@@ -1976,7 +1977,7 @@ Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
1976
1977
|
r
|
|
1977
1978
|
);
|
|
1978
1979
|
}, _t = new WeakSet(), Wt = async function(t, r) {
|
|
1979
|
-
var s
|
|
1980
|
+
var s;
|
|
1980
1981
|
if (H(this, Fe).running > 0 && ((s = t.headers) == null ? void 0 : s["x-request-issuer"]) === "php")
|
|
1981
1982
|
return console.warn(
|
|
1982
1983
|
"Possible deadlock: Called request() before the previous request() have finished. PHP likely issued an HTTP call to itself. Normally this would lead to infinite waiting as Request 1 holds the lock that the Request 2 is waiting to acquire. That's not useful, so PHPRequestHandler will return error 502 instead."
|
|
@@ -1991,28 +1992,20 @@ Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
1991
1992
|
"HTTPS",
|
|
1992
1993
|
H(this, Qe).startsWith("https://") ? "on" : ""
|
|
1993
1994
|
);
|
|
1994
|
-
let
|
|
1995
|
-
const
|
|
1995
|
+
let i = "GET";
|
|
1996
|
+
const o = {
|
|
1996
1997
|
host: H(this, Je),
|
|
1997
1998
|
...normalizeHeaders(t.headers || {})
|
|
1998
1999
|
};
|
|
1999
|
-
let
|
|
2000
|
-
if (typeof
|
|
2001
|
-
|
|
2002
|
-
const { bytes:
|
|
2003
|
-
|
|
2000
|
+
let c = t.body;
|
|
2001
|
+
if (typeof c == "object" && !(c instanceof Uint8Array)) {
|
|
2002
|
+
i = "POST";
|
|
2003
|
+
const { bytes: u, contentType: p } = await encodeAsMultipart(c);
|
|
2004
|
+
c = u, o["content-type"] = p;
|
|
2004
2005
|
}
|
|
2005
|
-
let
|
|
2006
|
+
let d;
|
|
2006
2007
|
try {
|
|
2007
|
-
|
|
2008
|
-
if ((i = t.headers) != null && i["x-rewrite-url"])
|
|
2009
|
-
try {
|
|
2010
|
-
p = new URL(
|
|
2011
|
-
t.headers["x-rewrite-url"]
|
|
2012
|
-
).pathname;
|
|
2013
|
-
} catch {
|
|
2014
|
-
}
|
|
2015
|
-
u = ce(this, gt, Bt).call(this, p);
|
|
2008
|
+
d = ce(this, gt, Bt).call(this, r.pathname);
|
|
2016
2009
|
} catch {
|
|
2017
2010
|
return new PHPResponse(
|
|
2018
2011
|
404,
|
|
@@ -2026,17 +2019,17 @@ Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
2026
2019
|
H(this, ve)
|
|
2027
2020
|
),
|
|
2028
2021
|
protocol: H(this, Ke),
|
|
2029
|
-
method: t.method ||
|
|
2030
|
-
body:
|
|
2031
|
-
scriptPath:
|
|
2032
|
-
headers:
|
|
2022
|
+
method: t.method || i,
|
|
2023
|
+
body: c,
|
|
2024
|
+
scriptPath: d,
|
|
2025
|
+
headers: o
|
|
2033
2026
|
});
|
|
2034
2027
|
} finally {
|
|
2035
2028
|
n();
|
|
2036
2029
|
}
|
|
2037
2030
|
}, gt = new WeakSet(), Bt = function(t) {
|
|
2038
2031
|
let r = removePathPrefix(t, H(this, ve));
|
|
2039
|
-
r.includes(".php") ? r = r.split(".php")[0] + ".php" : this.php.isDir(`${H(this, Pe)}${r}`) ? (r.endsWith("/") || (r = `${r}/`), r = `${r}index.php`) : r = "/index.php";
|
|
2032
|
+
r = applyRewriteRules(r, this.rewriteRules), r.includes(".php") ? r = r.split(".php")[0] + ".php" : this.php.isDir(`${H(this, Pe)}${r}`) ? (r.endsWith("/") || (r = `${r}/`), r = `${r}index.php`) : r = "/index.php";
|
|
2040
2033
|
const n = `${H(this, Pe)}${r}`;
|
|
2041
2034
|
if (this.php.fileExists(n))
|
|
2042
2035
|
return n;
|
|
@@ -2091,6 +2084,12 @@ function seemsLikeAPHPFile(e) {
|
|
|
2091
2084
|
function seemsLikeADirectoryRoot(e) {
|
|
2092
2085
|
return !e.split("/").pop().includes(".");
|
|
2093
2086
|
}
|
|
2087
|
+
function applyRewriteRules(e, t) {
|
|
2088
|
+
for (const r of t)
|
|
2089
|
+
if (new RegExp(r.match).test(e))
|
|
2090
|
+
return e.replace(r.match, r.replacement);
|
|
2091
|
+
return e;
|
|
2092
|
+
}
|
|
2094
2093
|
const FileErrorCodes = {
|
|
2095
2094
|
0: "No error occurred. System call completed successfully.",
|
|
2096
2095
|
1: "Argument list too long.",
|
|
@@ -2184,8 +2183,8 @@ function rethrowFileSystemError(e = "") {
|
|
|
2184
2183
|
} catch (c) {
|
|
2185
2184
|
const d = typeof c == "object" ? c == null ? void 0 : c.errno : null;
|
|
2186
2185
|
if (d in FileErrorCodes) {
|
|
2187
|
-
const u = FileErrorCodes[d], p = typeof o[0] == "string" ? o[0] : null,
|
|
2188
|
-
throw new Error(`${
|
|
2186
|
+
const u = FileErrorCodes[d], p = typeof o[0] == "string" ? o[0] : null, g = p !== null ? e.replaceAll("{path}", p) : e;
|
|
2187
|
+
throw new Error(`${g}: ${u}`, {
|
|
2189
2188
|
cause: c
|
|
2190
2189
|
});
|
|
2191
2190
|
}
|
|
@@ -2208,7 +2207,7 @@ var __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyD
|
|
|
2208
2207
|
return n && s && __defProp(t, r, s), s;
|
|
2209
2208
|
};
|
|
2210
2209
|
const STRING = "string", NUMBER = "number", __private__dont__use = Symbol("__private__dont__use");
|
|
2211
|
-
var Me, Ze, Ye,
|
|
2210
|
+
var Me, Ze, Ye, be, Re, Te, Ee, Xe, yt, Gt, $t, Kt, vt, Jt, wt, Qt, Pt, Zt, bt, Yt, Et, Xt, St, er, Rt, tr, Tt, rr, kt, nr, Ct, sr;
|
|
2212
2211
|
class BasePHP {
|
|
2213
2212
|
/**
|
|
2214
2213
|
* Initializes a PHP runtime.
|
|
@@ -2218,13 +2217,13 @@ class BasePHP {
|
|
|
2218
2217
|
* @param serverOptions - Optional. Options for the PHPRequestHandler. If undefined, no request handler will be initialized.
|
|
2219
2218
|
*/
|
|
2220
2219
|
constructor(e, t) {
|
|
2221
|
-
Q(this, $t);
|
|
2222
2220
|
Q(this, yt);
|
|
2221
|
+
Q(this, $t);
|
|
2223
2222
|
Q(this, vt);
|
|
2224
2223
|
Q(this, wt);
|
|
2225
2224
|
Q(this, Pt);
|
|
2226
|
-
Q(this, Et);
|
|
2227
2225
|
Q(this, bt);
|
|
2226
|
+
Q(this, Et);
|
|
2228
2227
|
Q(this, St);
|
|
2229
2228
|
Q(this, Rt);
|
|
2230
2229
|
Q(this, Tt);
|
|
@@ -2233,24 +2232,24 @@ class BasePHP {
|
|
|
2233
2232
|
Q(this, Me, void 0);
|
|
2234
2233
|
Q(this, Ze, void 0);
|
|
2235
2234
|
Q(this, Ye, void 0);
|
|
2236
|
-
Q(this,
|
|
2235
|
+
Q(this, be, void 0);
|
|
2237
2236
|
Q(this, Re, void 0);
|
|
2238
2237
|
Q(this, Te, void 0);
|
|
2239
|
-
Q(this,
|
|
2238
|
+
Q(this, Ee, void 0);
|
|
2240
2239
|
Q(this, Xe, void 0);
|
|
2241
|
-
te(this, Me, []), te(this,
|
|
2240
|
+
te(this, Me, []), te(this, be, !1), te(this, Re, null), te(this, Te, {}), te(this, Ee, /* @__PURE__ */ new Map()), te(this, Xe, []), this.semaphore = new Semaphore({ concurrency: 1 }), e !== void 0 && this.initializeRuntime(e), t && (this.requestHandler = new PHPBrowser(
|
|
2242
2241
|
new PHPRequestHandler(this, t)
|
|
2243
2242
|
));
|
|
2244
2243
|
}
|
|
2245
2244
|
addEventListener(e, t) {
|
|
2246
|
-
H(this,
|
|
2245
|
+
H(this, Ee).has(e) || H(this, Ee).set(e, /* @__PURE__ */ new Set()), H(this, Ee).get(e).add(t);
|
|
2247
2246
|
}
|
|
2248
2247
|
removeEventListener(e, t) {
|
|
2249
2248
|
var r;
|
|
2250
|
-
(r = H(this,
|
|
2249
|
+
(r = H(this, Ee).get(e)) == null || r.delete(t);
|
|
2251
2250
|
}
|
|
2252
2251
|
dispatchEvent(e) {
|
|
2253
|
-
const t = H(this,
|
|
2252
|
+
const t = H(this, Ee).get(e.type);
|
|
2254
2253
|
if (t)
|
|
2255
2254
|
for (const r of t)
|
|
2256
2255
|
r(e);
|
|
@@ -2313,7 +2312,7 @@ class BasePHP {
|
|
|
2313
2312
|
}
|
|
2314
2313
|
/** @inheritDoc */
|
|
2315
2314
|
setPhpIniPath(e) {
|
|
2316
|
-
if (H(this,
|
|
2315
|
+
if (H(this, be))
|
|
2317
2316
|
throw new Error("Cannot set PHP ini path after calling run().");
|
|
2318
2317
|
te(this, Ze, e), this[__private__dont__use].ccall(
|
|
2319
2318
|
"wasm_set_phpini_path",
|
|
@@ -2324,7 +2323,7 @@ class BasePHP {
|
|
|
2324
2323
|
}
|
|
2325
2324
|
/** @inheritDoc */
|
|
2326
2325
|
setPhpIniEntry(e, t) {
|
|
2327
|
-
if (H(this,
|
|
2326
|
+
if (H(this, be))
|
|
2328
2327
|
throw new Error("Cannot set PHP ini entries after calling run().");
|
|
2329
2328
|
H(this, Me).push([e, t]);
|
|
2330
2329
|
}
|
|
@@ -2343,13 +2342,13 @@ class BasePHP {
|
|
|
2343
2342
|
const t = await this.semaphore.acquire();
|
|
2344
2343
|
let r;
|
|
2345
2344
|
try {
|
|
2346
|
-
if (H(this,
|
|
2345
|
+
if (H(this, be) || (ce(this, yt, Gt).call(this), te(this, be, !0)), e.scriptPath && !this.fileExists(e.scriptPath))
|
|
2347
2346
|
throw new Error(
|
|
2348
2347
|
`The script path "${e.scriptPath}" does not exist.`
|
|
2349
2348
|
);
|
|
2350
2349
|
ce(this, St, er).call(this, e.scriptPath || ""), ce(this, vt, Jt).call(this, e.relativeUri || ""), ce(this, Pt, Zt).call(this, e.method || "GET");
|
|
2351
2350
|
const n = normalizeHeaders(e.headers || {}), s = n.host || "example.com:443";
|
|
2352
|
-
ce(this, wt, Qt).call(this, s, e.protocol || "http"), ce(this,
|
|
2351
|
+
ce(this, wt, Qt).call(this, s, e.protocol || "http"), ce(this, bt, Yt).call(this, n), e.body && (r = ce(this, Et, Xt).call(this, e.body)), typeof e.code == "string" && ce(this, kt, nr).call(this, " ?>" + e.code), ce(this, Rt, tr).call(this);
|
|
2353
2352
|
const i = e.env || {};
|
|
2354
2353
|
for (const c in i)
|
|
2355
2354
|
ce(this, Tt, rr).call(this, c, i[c]);
|
|
@@ -2366,6 +2365,11 @@ class BasePHP {
|
|
|
2366
2365
|
throw d.output = c, console.error(d), d;
|
|
2367
2366
|
}
|
|
2368
2367
|
return o;
|
|
2368
|
+
} catch (n) {
|
|
2369
|
+
throw this.dispatchEvent({
|
|
2370
|
+
type: "request.error",
|
|
2371
|
+
error: n
|
|
2372
|
+
}), n;
|
|
2369
2373
|
} finally {
|
|
2370
2374
|
try {
|
|
2371
2375
|
r && this[__private__dont__use].free(r);
|
|
@@ -2486,10 +2490,10 @@ class BasePHP {
|
|
|
2486
2490
|
this[__private__dont__use]._exit(e);
|
|
2487
2491
|
} catch {
|
|
2488
2492
|
}
|
|
2489
|
-
te(this,
|
|
2493
|
+
te(this, be, !1), te(this, Re, null), delete this[__private__dont__use].onMessage, delete this[__private__dont__use];
|
|
2490
2494
|
}
|
|
2491
2495
|
}
|
|
2492
|
-
Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(),
|
|
2496
|
+
Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), be = new WeakMap(), Re = new WeakMap(), Te = new WeakMap(), Ee = new WeakMap(), Xe = new WeakMap(), yt = new WeakSet(), Gt = function() {
|
|
2493
2497
|
if (this.setPhpIniEntry("auto_prepend_file", "/internal/consts.php"), this.fileExists("/internal/consts.php") || this.writeFile(
|
|
2494
2498
|
"/internal/consts.php",
|
|
2495
2499
|
`<?php
|
|
@@ -2514,7 +2518,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Ee = new WeakMap(),
|
|
|
2514
2518
|
);
|
|
2515
2519
|
}
|
|
2516
2520
|
this[__private__dont__use].ccall("php_wasm_init", null, [], []);
|
|
2517
|
-
},
|
|
2521
|
+
}, $t = new WeakSet(), Kt = function() {
|
|
2518
2522
|
const e = "/internal/headers.json";
|
|
2519
2523
|
if (!this.fileExists(e))
|
|
2520
2524
|
throw new Error(
|
|
@@ -2571,7 +2575,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Ee = new WeakMap(),
|
|
|
2571
2575
|
[STRING],
|
|
2572
2576
|
[e]
|
|
2573
2577
|
);
|
|
2574
|
-
},
|
|
2578
|
+
}, bt = new WeakSet(), Yt = function(e) {
|
|
2575
2579
|
e.cookie && this[__private__dont__use].ccall(
|
|
2576
2580
|
"wasm_set_cookies",
|
|
2577
2581
|
null,
|
|
@@ -2595,7 +2599,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Ee = new WeakMap(),
|
|
|
2595
2599
|
e[t]
|
|
2596
2600
|
);
|
|
2597
2601
|
}
|
|
2598
|
-
},
|
|
2602
|
+
}, Et = new WeakSet(), Xt = function(e) {
|
|
2599
2603
|
let t, r;
|
|
2600
2604
|
typeof e == "string" ? (console.warn(
|
|
2601
2605
|
"Passing a string as the request body is deprecated. Please use a Uint8Array instead. See https://github.com/WordPress/wordpress-playground/issues/997 for more details"
|
|
@@ -2683,7 +2687,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Ee = new WeakMap(),
|
|
|
2683
2687
|
} finally {
|
|
2684
2688
|
(s = H(this, Re)) == null || s.removeEventListener("error", t), te(this, Te, {});
|
|
2685
2689
|
}
|
|
2686
|
-
const { headers: r, httpStatusCode: n } = ce(this,
|
|
2690
|
+
const { headers: r, httpStatusCode: n } = ce(this, $t, Kt).call(this);
|
|
2687
2691
|
return new PHPResponse(
|
|
2688
2692
|
n,
|
|
2689
2693
|
r,
|
|
@@ -3037,7 +3041,7 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3037
3041
|
}
|
|
3038
3042
|
e.str = o;
|
|
3039
3043
|
function c(m, k) {
|
|
3040
|
-
k instanceof n ? m.push(...k._items) : k instanceof r ? m.push(k) : m.push(
|
|
3044
|
+
k instanceof n ? m.push(...k._items) : k instanceof r ? m.push(k) : m.push(g(k));
|
|
3041
3045
|
}
|
|
3042
3046
|
e.addCodeArg = c;
|
|
3043
3047
|
function d(m) {
|
|
@@ -3068,7 +3072,7 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3068
3072
|
return k.emptyStr() ? m : m.emptyStr() ? k : o`${m}${k}`;
|
|
3069
3073
|
}
|
|
3070
3074
|
e.strConcat = p;
|
|
3071
|
-
function
|
|
3075
|
+
function g(m) {
|
|
3072
3076
|
return typeof m == "number" || typeof m == "boolean" || m === null ? m : O(Array.isArray(m) ? m.join(",") : m);
|
|
3073
3077
|
}
|
|
3074
3078
|
function R(m) {
|
|
@@ -3089,10 +3093,10 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3089
3093
|
throw new Error(`CodeGen: invalid export name: ${m}, use explicit $id name mapping`);
|
|
3090
3094
|
}
|
|
3091
3095
|
e.getEsmExportName = v;
|
|
3092
|
-
function
|
|
3096
|
+
function y(m) {
|
|
3093
3097
|
return new n(m.toString());
|
|
3094
3098
|
}
|
|
3095
|
-
e.regexpCode =
|
|
3099
|
+
e.regexpCode = y;
|
|
3096
3100
|
})(code$1);
|
|
3097
3101
|
var scope = {};
|
|
3098
3102
|
(function(e) {
|
|
@@ -3126,8 +3130,8 @@ var scope = {};
|
|
|
3126
3130
|
return `${u}${p.index++}`;
|
|
3127
3131
|
}
|
|
3128
3132
|
_nameGroup(u) {
|
|
3129
|
-
var p,
|
|
3130
|
-
if (!((
|
|
3133
|
+
var p, g;
|
|
3134
|
+
if (!((g = (p = this._parent) === null || p === void 0 ? void 0 : p._prefixes) === null || g === void 0) && g.has(u) || this._prefixes && !this._prefixes.has(u))
|
|
3131
3135
|
throw new Error(`CodeGen: prefix "${u}" is not allowed in this scope`);
|
|
3132
3136
|
return this._names[u] = { prefix: u, index: 0 };
|
|
3133
3137
|
}
|
|
@@ -3137,8 +3141,8 @@ var scope = {};
|
|
|
3137
3141
|
constructor(u, p) {
|
|
3138
3142
|
super(p), this.prefix = u;
|
|
3139
3143
|
}
|
|
3140
|
-
setValue(u, { property: p, itemIndex:
|
|
3141
|
-
this.value = u, this.scopePath = (0, t._)`.${new t.Name(p)}[${
|
|
3144
|
+
setValue(u, { property: p, itemIndex: g }) {
|
|
3145
|
+
this.value = u, this.scopePath = (0, t._)`.${new t.Name(p)}[${g}]`;
|
|
3142
3146
|
}
|
|
3143
3147
|
}
|
|
3144
3148
|
e.ValueScopeName = i;
|
|
@@ -3154,10 +3158,10 @@ var scope = {};
|
|
|
3154
3158
|
return new i(u, this._newName(u));
|
|
3155
3159
|
}
|
|
3156
3160
|
value(u, p) {
|
|
3157
|
-
var
|
|
3161
|
+
var g;
|
|
3158
3162
|
if (p.ref === void 0)
|
|
3159
3163
|
throw new Error("CodeGen: ref must be passed in value");
|
|
3160
|
-
const R = this.toName(u), { prefix: O } = R, T = (
|
|
3164
|
+
const R = this.toName(u), { prefix: O } = R, T = (g = p.key) !== null && g !== void 0 ? g : p.ref;
|
|
3161
3165
|
let v = this._values[O];
|
|
3162
3166
|
if (v) {
|
|
3163
3167
|
const k = v.get(T);
|
|
@@ -3166,39 +3170,39 @@ var scope = {};
|
|
|
3166
3170
|
} else
|
|
3167
3171
|
v = this._values[O] = /* @__PURE__ */ new Map();
|
|
3168
3172
|
v.set(T, R);
|
|
3169
|
-
const
|
|
3170
|
-
return
|
|
3173
|
+
const y = this._scope[O] || (this._scope[O] = []), m = y.length;
|
|
3174
|
+
return y[m] = p.ref, R.setValue(p, { property: O, itemIndex: m }), R;
|
|
3171
3175
|
}
|
|
3172
3176
|
getValue(u, p) {
|
|
3173
|
-
const
|
|
3174
|
-
if (
|
|
3175
|
-
return
|
|
3177
|
+
const g = this._values[u];
|
|
3178
|
+
if (g)
|
|
3179
|
+
return g.get(p);
|
|
3176
3180
|
}
|
|
3177
3181
|
scopeRefs(u, p = this._values) {
|
|
3178
|
-
return this._reduceValues(p, (
|
|
3179
|
-
if (
|
|
3180
|
-
throw new Error(`CodeGen: name "${
|
|
3181
|
-
return (0, t._)`${u}${
|
|
3182
|
+
return this._reduceValues(p, (g) => {
|
|
3183
|
+
if (g.scopePath === void 0)
|
|
3184
|
+
throw new Error(`CodeGen: name "${g}" has no value`);
|
|
3185
|
+
return (0, t._)`${u}${g.scopePath}`;
|
|
3182
3186
|
});
|
|
3183
3187
|
}
|
|
3184
|
-
scopeCode(u = this._values, p,
|
|
3188
|
+
scopeCode(u = this._values, p, g) {
|
|
3185
3189
|
return this._reduceValues(u, (R) => {
|
|
3186
3190
|
if (R.value === void 0)
|
|
3187
3191
|
throw new Error(`CodeGen: name "${R}" has no value`);
|
|
3188
3192
|
return R.value.code;
|
|
3189
|
-
}, p,
|
|
3193
|
+
}, p, g);
|
|
3190
3194
|
}
|
|
3191
|
-
_reduceValues(u, p,
|
|
3195
|
+
_reduceValues(u, p, g = {}, R) {
|
|
3192
3196
|
let O = t.nil;
|
|
3193
3197
|
for (const T in u) {
|
|
3194
3198
|
const v = u[T];
|
|
3195
3199
|
if (!v)
|
|
3196
3200
|
continue;
|
|
3197
|
-
const
|
|
3201
|
+
const y = g[T] = g[T] || /* @__PURE__ */ new Map();
|
|
3198
3202
|
v.forEach((m) => {
|
|
3199
|
-
if (
|
|
3203
|
+
if (y.has(m))
|
|
3200
3204
|
return;
|
|
3201
|
-
|
|
3205
|
+
y.set(m, n.Started);
|
|
3202
3206
|
let k = p(m);
|
|
3203
3207
|
if (k) {
|
|
3204
3208
|
const S = this.opts.es5 ? e.varKinds.var : e.varKinds.const;
|
|
@@ -3207,7 +3211,7 @@ var scope = {};
|
|
|
3207
3211
|
O = (0, t._)`${O}${k}${this.opts._n}`;
|
|
3208
3212
|
else
|
|
3209
3213
|
throw new r(m);
|
|
3210
|
-
|
|
3214
|
+
y.set(m, n.Completed);
|
|
3211
3215
|
});
|
|
3212
3216
|
}
|
|
3213
3217
|
return O;
|
|
@@ -3321,7 +3325,7 @@ var scope = {};
|
|
|
3321
3325
|
return `break${this.label ? ` ${this.label}` : ""};` + a;
|
|
3322
3326
|
}
|
|
3323
3327
|
}
|
|
3324
|
-
class
|
|
3328
|
+
class g extends i {
|
|
3325
3329
|
constructor(a) {
|
|
3326
3330
|
super(), this.error = a;
|
|
3327
3331
|
}
|
|
@@ -3369,8 +3373,8 @@ var scope = {};
|
|
|
3369
3373
|
const { nodes: N } = this;
|
|
3370
3374
|
let M = N.length;
|
|
3371
3375
|
for (; M--; ) {
|
|
3372
|
-
const
|
|
3373
|
-
|
|
3376
|
+
const L = N[M];
|
|
3377
|
+
L.optimizeNames(a, h) || (ke(a, L.names), N.splice(M, 1));
|
|
3374
3378
|
}
|
|
3375
3379
|
return N.length > 0 ? this : void 0;
|
|
3376
3380
|
}
|
|
@@ -3385,9 +3389,9 @@ var scope = {};
|
|
|
3385
3389
|
}
|
|
3386
3390
|
class v extends O {
|
|
3387
3391
|
}
|
|
3388
|
-
class
|
|
3392
|
+
class y extends T {
|
|
3389
3393
|
}
|
|
3390
|
-
|
|
3394
|
+
y.kind = "else";
|
|
3391
3395
|
class m extends T {
|
|
3392
3396
|
constructor(a, h) {
|
|
3393
3397
|
super(h), this.condition = a;
|
|
@@ -3404,7 +3408,7 @@ var scope = {};
|
|
|
3404
3408
|
let h = this.else;
|
|
3405
3409
|
if (h) {
|
|
3406
3410
|
const N = h.optimizeNodes();
|
|
3407
|
-
h = this.else = Array.isArray(N) ? new
|
|
3411
|
+
h = this.else = Array.isArray(N) ? new y(N) : N;
|
|
3408
3412
|
}
|
|
3409
3413
|
if (h)
|
|
3410
3414
|
return a === !1 ? h instanceof m ? h : h.nodes : this.nodes.length ? this : new m(Ce(a), h instanceof m ? [h] : h.nodes);
|
|
@@ -3445,8 +3449,8 @@ var scope = {};
|
|
|
3445
3449
|
super(), this.varKind = a, this.name = h, this.from = N, this.to = M;
|
|
3446
3450
|
}
|
|
3447
3451
|
render(a) {
|
|
3448
|
-
const h = a.es5 ? r.varKinds.var : this.varKind, { name: N, from: M, to:
|
|
3449
|
-
return `for(${h} ${N}=${M}; ${N}<${
|
|
3452
|
+
const h = a.es5 ? r.varKinds.var : this.varKind, { name: N, from: M, to: L } = this;
|
|
3453
|
+
return `for(${h} ${N}=${M}; ${N}<${L}; ${N}++)` + super.render(a);
|
|
3450
3454
|
}
|
|
3451
3455
|
get names() {
|
|
3452
3456
|
const a = ue(super.names, this.from);
|
|
@@ -3549,8 +3553,8 @@ var scope = {};
|
|
|
3549
3553
|
return this._extScope.scopeCode(this._values);
|
|
3550
3554
|
}
|
|
3551
3555
|
_def(a, h, N, M) {
|
|
3552
|
-
const
|
|
3553
|
-
return N !== void 0 && M && (this._constants[
|
|
3556
|
+
const L = this._scope.toName(h);
|
|
3557
|
+
return N !== void 0 && M && (this._constants[L.str] = N), this._leafNode(new o(a, L, N)), L;
|
|
3554
3558
|
}
|
|
3555
3559
|
// `const` declaration (`var` in es5 mode)
|
|
3556
3560
|
const(a, h, N) {
|
|
@@ -3599,11 +3603,11 @@ var scope = {};
|
|
|
3599
3603
|
}
|
|
3600
3604
|
// `else` clause - only valid after `if` or `else if` clauses
|
|
3601
3605
|
else() {
|
|
3602
|
-
return this._elseNode(new
|
|
3606
|
+
return this._elseNode(new y());
|
|
3603
3607
|
}
|
|
3604
3608
|
// end `if` statement (needed if gen.if was used only with condition)
|
|
3605
3609
|
endIf() {
|
|
3606
|
-
return this._endBlockNode(m,
|
|
3610
|
+
return this._endBlockNode(m, y);
|
|
3607
3611
|
}
|
|
3608
3612
|
_for(a, h) {
|
|
3609
3613
|
return this._blockNode(a), h && this.code(h).endFor(), this;
|
|
@@ -3613,28 +3617,28 @@ var scope = {};
|
|
|
3613
3617
|
return this._for(new S(a), h);
|
|
3614
3618
|
}
|
|
3615
3619
|
// `for` statement for a range of values
|
|
3616
|
-
forRange(a, h, N, M,
|
|
3620
|
+
forRange(a, h, N, M, L = this.opts.es5 ? r.varKinds.var : r.varKinds.let) {
|
|
3617
3621
|
const W = this._scope.toName(a);
|
|
3618
|
-
return this._for(new I(
|
|
3622
|
+
return this._for(new I(L, W, h, N), () => M(W));
|
|
3619
3623
|
}
|
|
3620
3624
|
// `for-of` statement (in es5 mode replace with a normal for loop)
|
|
3621
3625
|
forOf(a, h, N, M = r.varKinds.const) {
|
|
3622
|
-
const
|
|
3626
|
+
const L = this._scope.toName(a);
|
|
3623
3627
|
if (this.opts.es5) {
|
|
3624
3628
|
const W = h instanceof t.Name ? h : this.var("_arr", h);
|
|
3625
3629
|
return this.forRange("_i", 0, (0, t._)`${W}.length`, (G) => {
|
|
3626
|
-
this.var(
|
|
3630
|
+
this.var(L, (0, t._)`${W}[${G}]`), N(L);
|
|
3627
3631
|
});
|
|
3628
3632
|
}
|
|
3629
|
-
return this._for(new D("of", M,
|
|
3633
|
+
return this._for(new D("of", M, L, h), () => N(L));
|
|
3630
3634
|
}
|
|
3631
3635
|
// `for-in` statement.
|
|
3632
3636
|
// With option `ownProperties` replaced with a `for-of` loop for object keys
|
|
3633
3637
|
forIn(a, h, N, M = this.opts.es5 ? r.varKinds.var : r.varKinds.const) {
|
|
3634
3638
|
if (this.opts.ownProperties)
|
|
3635
3639
|
return this.forOf(a, (0, t._)`Object.keys(${h})`, N);
|
|
3636
|
-
const
|
|
3637
|
-
return this._for(new D("in", M,
|
|
3640
|
+
const L = this._scope.toName(a);
|
|
3641
|
+
return this._for(new D("in", M, L, h), () => N(L));
|
|
3638
3642
|
}
|
|
3639
3643
|
// end `for` loop
|
|
3640
3644
|
endFor() {
|
|
@@ -3661,14 +3665,14 @@ var scope = {};
|
|
|
3661
3665
|
throw new Error('CodeGen: "try" without "catch" and "finally"');
|
|
3662
3666
|
const M = new A();
|
|
3663
3667
|
if (this._blockNode(M), this.code(a), h) {
|
|
3664
|
-
const
|
|
3665
|
-
this._currNode = M.catch = new V(
|
|
3668
|
+
const L = this.name("e");
|
|
3669
|
+
this._currNode = M.catch = new V(L), h(L);
|
|
3666
3670
|
}
|
|
3667
3671
|
return N && (this._currNode = M.finally = new z(), this.code(N)), this._endBlockNode(V, z);
|
|
3668
3672
|
}
|
|
3669
3673
|
// `throw` statement
|
|
3670
3674
|
throw(a) {
|
|
3671
|
-
return this._leafNode(new
|
|
3675
|
+
return this._leafNode(new g(a));
|
|
3672
3676
|
}
|
|
3673
3677
|
// start self-balancing block
|
|
3674
3678
|
block(a, h) {
|
|
@@ -3740,13 +3744,13 @@ var scope = {};
|
|
|
3740
3744
|
return N(P);
|
|
3741
3745
|
if (!M(P))
|
|
3742
3746
|
return P;
|
|
3743
|
-
return new t._Code(P._items.reduce((
|
|
3744
|
-
function N(
|
|
3745
|
-
const W = h[
|
|
3746
|
-
return W === void 0 || a[
|
|
3747
|
+
return new t._Code(P._items.reduce((L, W) => (W instanceof t.Name && (W = N(W)), W instanceof t._Code ? L.push(...W._items) : L.push(W), L), []));
|
|
3748
|
+
function N(L) {
|
|
3749
|
+
const W = h[L.str];
|
|
3750
|
+
return W === void 0 || a[L.str] !== 1 ? L : (delete a[L.str], W);
|
|
3747
3751
|
}
|
|
3748
|
-
function M(
|
|
3749
|
-
return
|
|
3752
|
+
function M(L) {
|
|
3753
|
+
return L instanceof t._Code && L._items.some((W) => W instanceof t.Name && a[W.str] === 1 && h[W.str] !== void 0);
|
|
3750
3754
|
}
|
|
3751
3755
|
}
|
|
3752
3756
|
function ke(P, a) {
|
|
@@ -3757,17 +3761,17 @@ var scope = {};
|
|
|
3757
3761
|
return typeof P == "boolean" || typeof P == "number" || P === null ? !P : (0, t._)`!${j(P)}`;
|
|
3758
3762
|
}
|
|
3759
3763
|
e.not = Ce;
|
|
3760
|
-
const
|
|
3764
|
+
const Le = $(e.operators.AND);
|
|
3761
3765
|
function et(...P) {
|
|
3762
|
-
return P.reduce(
|
|
3766
|
+
return P.reduce(Le);
|
|
3763
3767
|
}
|
|
3764
3768
|
e.and = et;
|
|
3765
|
-
const
|
|
3769
|
+
const qe = $(e.operators.OR);
|
|
3766
3770
|
function F(...P) {
|
|
3767
|
-
return P.reduce(
|
|
3771
|
+
return P.reduce(qe);
|
|
3768
3772
|
}
|
|
3769
3773
|
e.or = F;
|
|
3770
|
-
function
|
|
3774
|
+
function $(P) {
|
|
3771
3775
|
return (a, h) => a === t.nil ? h : h === t.nil ? a : (0, t._)`${j(a)} ${P} ${j(h)}`;
|
|
3772
3776
|
}
|
|
3773
3777
|
function j(P) {
|
|
@@ -3831,13 +3835,13 @@ var util = {};
|
|
|
3831
3835
|
}
|
|
3832
3836
|
e.unescapeFragment = u;
|
|
3833
3837
|
function p(w) {
|
|
3834
|
-
return encodeURIComponent(
|
|
3838
|
+
return encodeURIComponent(g(w));
|
|
3835
3839
|
}
|
|
3836
3840
|
e.escapeFragment = p;
|
|
3837
|
-
function
|
|
3841
|
+
function g(w) {
|
|
3838
3842
|
return typeof w == "number" ? `${w}` : w.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
3839
3843
|
}
|
|
3840
|
-
e.escapeJsonPointer =
|
|
3844
|
+
e.escapeJsonPointer = g;
|
|
3841
3845
|
function R(w) {
|
|
3842
3846
|
return w.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
3843
3847
|
}
|
|
@@ -3862,7 +3866,7 @@ var util = {};
|
|
|
3862
3866
|
w.if((0, t._)`${C} === true`, () => w.assign(A, !0), () => w.assign(A, (0, t._)`${A} || {}`).code((0, t._)`Object.assign(${A}, ${C})`));
|
|
3863
3867
|
}),
|
|
3864
3868
|
mergeToName: (w, C, A) => w.if((0, t._)`${A} !== true`, () => {
|
|
3865
|
-
C === !0 ? w.assign(A, !0) : (w.assign(A, (0, t._)`${A} || {}`),
|
|
3869
|
+
C === !0 ? w.assign(A, !0) : (w.assign(A, (0, t._)`${A} || {}`), y(w, A, C));
|
|
3866
3870
|
}),
|
|
3867
3871
|
mergeValues: (w, C) => w === !0 ? !0 : { ...w, ...C },
|
|
3868
3872
|
resultToName: v
|
|
@@ -3878,13 +3882,13 @@ var util = {};
|
|
|
3878
3882
|
if (C === !0)
|
|
3879
3883
|
return w.var("props", !0);
|
|
3880
3884
|
const A = w.var("props", (0, t._)`{}`);
|
|
3881
|
-
return C !== void 0 &&
|
|
3885
|
+
return C !== void 0 && y(w, A, C), A;
|
|
3882
3886
|
}
|
|
3883
3887
|
e.evaluatedPropsToName = v;
|
|
3884
|
-
function
|
|
3888
|
+
function y(w, C, A) {
|
|
3885
3889
|
Object.keys(A).forEach((V) => w.assign((0, t._)`${C}${(0, t.getProperty)(V)}`, !0));
|
|
3886
3890
|
}
|
|
3887
|
-
e.setEvaluated =
|
|
3891
|
+
e.setEvaluated = y;
|
|
3888
3892
|
const m = {};
|
|
3889
3893
|
function k(w, C) {
|
|
3890
3894
|
return w.scopeValue("func", {
|
|
@@ -3902,7 +3906,7 @@ var util = {};
|
|
|
3902
3906
|
const V = C === S.Num;
|
|
3903
3907
|
return A ? V ? (0, t._)`"[" + ${w} + "]"` : (0, t._)`"['" + ${w} + "']"` : V ? (0, t._)`"/" + ${w}` : (0, t._)`"/" + ${w}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
|
|
3904
3908
|
}
|
|
3905
|
-
return A ? (0, t.getProperty)(w).toString() : "/" +
|
|
3909
|
+
return A ? (0, t.getProperty)(w).toString() : "/" + g(w);
|
|
3906
3910
|
}
|
|
3907
3911
|
e.getErrorPath = I;
|
|
3908
3912
|
function D(w, C, A = w.opts.strictSchema) {
|
|
@@ -3944,40 +3948,40 @@ names$1.default = names;
|
|
|
3944
3948
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.extendErrors = e.resetErrorsCount = e.reportExtraError = e.reportError = e.keyword$DataError = e.keywordError = void 0;
|
|
3945
3949
|
const t = codegen, r = util, n = names$1;
|
|
3946
3950
|
e.keywordError = {
|
|
3947
|
-
message: ({ keyword:
|
|
3951
|
+
message: ({ keyword: y }) => (0, t.str)`must pass "${y}" keyword validation`
|
|
3948
3952
|
}, e.keyword$DataError = {
|
|
3949
|
-
message: ({ keyword:
|
|
3953
|
+
message: ({ keyword: y, schemaType: m }) => m ? (0, t.str)`"${y}" keyword must be ${m} ($data)` : (0, t.str)`"${y}" keyword is invalid ($data)`
|
|
3950
3954
|
};
|
|
3951
|
-
function s(
|
|
3952
|
-
const { it: I } =
|
|
3955
|
+
function s(y, m = e.keywordError, k, S) {
|
|
3956
|
+
const { it: I } = y, { gen: D, compositeRule: w, allErrors: C } = I, A = g(y, m, k);
|
|
3953
3957
|
S ?? (w || C) ? d(D, A) : u(I, (0, t._)`[${A}]`);
|
|
3954
3958
|
}
|
|
3955
3959
|
e.reportError = s;
|
|
3956
|
-
function i(
|
|
3957
|
-
const { it: S } =
|
|
3960
|
+
function i(y, m = e.keywordError, k) {
|
|
3961
|
+
const { it: S } = y, { gen: I, compositeRule: D, allErrors: w } = S, C = g(y, m, k);
|
|
3958
3962
|
d(I, C), D || w || u(S, n.default.vErrors);
|
|
3959
3963
|
}
|
|
3960
3964
|
e.reportExtraError = i;
|
|
3961
|
-
function o(
|
|
3962
|
-
|
|
3965
|
+
function o(y, m) {
|
|
3966
|
+
y.assign(n.default.errors, m), y.if((0, t._)`${n.default.vErrors} !== null`, () => y.if(m, () => y.assign((0, t._)`${n.default.vErrors}.length`, m), () => y.assign(n.default.vErrors, null)));
|
|
3963
3967
|
}
|
|
3964
3968
|
e.resetErrorsCount = o;
|
|
3965
|
-
function c({ gen:
|
|
3969
|
+
function c({ gen: y, keyword: m, schemaValue: k, data: S, errsCount: I, it: D }) {
|
|
3966
3970
|
if (I === void 0)
|
|
3967
3971
|
throw new Error("ajv implementation error");
|
|
3968
|
-
const w =
|
|
3969
|
-
|
|
3970
|
-
|
|
3972
|
+
const w = y.name("err");
|
|
3973
|
+
y.forRange("i", I, n.default.errors, (C) => {
|
|
3974
|
+
y.const(w, (0, t._)`${n.default.vErrors}[${C}]`), y.if((0, t._)`${w}.instancePath === undefined`, () => y.assign((0, t._)`${w}.instancePath`, (0, t.strConcat)(n.default.instancePath, D.errorPath))), y.assign((0, t._)`${w}.schemaPath`, (0, t.str)`${D.errSchemaPath}/${m}`), D.opts.verbose && (y.assign((0, t._)`${w}.schema`, k), y.assign((0, t._)`${w}.data`, S));
|
|
3971
3975
|
});
|
|
3972
3976
|
}
|
|
3973
3977
|
e.extendErrors = c;
|
|
3974
|
-
function d(
|
|
3975
|
-
const k =
|
|
3976
|
-
|
|
3978
|
+
function d(y, m) {
|
|
3979
|
+
const k = y.const("err", m);
|
|
3980
|
+
y.if((0, t._)`${n.default.vErrors} === null`, () => y.assign(n.default.vErrors, (0, t._)`[${k}]`), (0, t._)`${n.default.vErrors}.push(${k})`), y.code((0, t._)`${n.default.errors}++`);
|
|
3977
3981
|
}
|
|
3978
|
-
function u(
|
|
3979
|
-
const { gen: k, validateName: S, schemaEnv: I } =
|
|
3980
|
-
I.$async ? k.throw((0, t._)`new ${
|
|
3982
|
+
function u(y, m) {
|
|
3983
|
+
const { gen: k, validateName: S, schemaEnv: I } = y;
|
|
3984
|
+
I.$async ? k.throw((0, t._)`new ${y.ValidationError}(${m})`) : (k.assign((0, t._)`${S}.errors`, m), k.return(!1));
|
|
3981
3985
|
}
|
|
3982
3986
|
const p = {
|
|
3983
3987
|
keyword: new t.Name("keyword"),
|
|
@@ -3988,28 +3992,28 @@ names$1.default = names;
|
|
|
3988
3992
|
schema: new t.Name("schema"),
|
|
3989
3993
|
parentSchema: new t.Name("parentSchema")
|
|
3990
3994
|
};
|
|
3991
|
-
function
|
|
3992
|
-
const { createErrors: S } =
|
|
3993
|
-
return S === !1 ? (0, t._)`{}` : R(
|
|
3995
|
+
function g(y, m, k) {
|
|
3996
|
+
const { createErrors: S } = y.it;
|
|
3997
|
+
return S === !1 ? (0, t._)`{}` : R(y, m, k);
|
|
3994
3998
|
}
|
|
3995
|
-
function R(
|
|
3996
|
-
const { gen: S, it: I } =
|
|
3999
|
+
function R(y, m, k = {}) {
|
|
4000
|
+
const { gen: S, it: I } = y, D = [
|
|
3997
4001
|
O(I, k),
|
|
3998
|
-
T(
|
|
4002
|
+
T(y, k)
|
|
3999
4003
|
];
|
|
4000
|
-
return v(
|
|
4004
|
+
return v(y, m, D), S.object(...D);
|
|
4001
4005
|
}
|
|
4002
|
-
function O({ errorPath:
|
|
4003
|
-
const k = m ? (0, t.str)`${
|
|
4006
|
+
function O({ errorPath: y }, { instancePath: m }) {
|
|
4007
|
+
const k = m ? (0, t.str)`${y}${(0, r.getErrorPath)(m, r.Type.Str)}` : y;
|
|
4004
4008
|
return [n.default.instancePath, (0, t.strConcat)(n.default.instancePath, k)];
|
|
4005
4009
|
}
|
|
4006
|
-
function T({ keyword:
|
|
4007
|
-
let I = S ? m : (0, t.str)`${m}/${
|
|
4010
|
+
function T({ keyword: y, it: { errSchemaPath: m } }, { schemaPath: k, parentSchema: S }) {
|
|
4011
|
+
let I = S ? m : (0, t.str)`${m}/${y}`;
|
|
4008
4012
|
return k && (I = (0, t.str)`${I}${(0, r.getErrorPath)(k, r.Type.Str)}`), [p.schemaPath, I];
|
|
4009
4013
|
}
|
|
4010
|
-
function v(
|
|
4011
|
-
const { keyword: I, data: D, schemaValue: w, it: C } =
|
|
4012
|
-
S.push([p.keyword, I], [p.params, typeof m == "function" ? m(
|
|
4014
|
+
function v(y, { params: m, message: k }, S) {
|
|
4015
|
+
const { keyword: I, data: D, schemaValue: w, it: C } = y, { opts: A, propertyName: V, topSchemaRef: z, schemaPath: re } = C;
|
|
4016
|
+
S.push([p.keyword, I], [p.params, typeof m == "function" ? m(y) : m || (0, t._)`{}`]), A.messages && S.push([p.message, typeof k == "function" ? k(y) : k]), A.verbose && S.push([p.schema, w], [p.parentSchema, (0, t._)`${z}${re}`], [n.default.data, D]), V && S.push([p.propertyName, V]);
|
|
4013
4017
|
}
|
|
4014
4018
|
})(errors);
|
|
4015
4019
|
Object.defineProperty(boolSchema, "__esModule", { value: !0 });
|
|
@@ -4109,7 +4113,7 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4109
4113
|
}
|
|
4110
4114
|
e.getJSONTypes = d;
|
|
4111
4115
|
function u(S, I) {
|
|
4112
|
-
const { gen: D, data: w, opts: C } = S, A =
|
|
4116
|
+
const { gen: D, data: w, opts: C } = S, A = g(I, C.coerceTypes), V = I.length > 0 && !(A.length === 0 && I.length === 1 && (0, r.schemaHasRulesForType)(S, I[0]));
|
|
4113
4117
|
if (V) {
|
|
4114
4118
|
const z = v(I, w, C.strictNumbers, o.Wrong);
|
|
4115
4119
|
D.if(z, () => {
|
|
@@ -4120,7 +4124,7 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4120
4124
|
}
|
|
4121
4125
|
e.coerceAndCheckDataType = u;
|
|
4122
4126
|
const p = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]);
|
|
4123
|
-
function
|
|
4127
|
+
function g(S, I) {
|
|
4124
4128
|
return I ? S.filter((D) => p.has(D) || I === "array" && D === "array") : [];
|
|
4125
4129
|
}
|
|
4126
4130
|
function R(S, I, D) {
|
|
@@ -4202,13 +4206,13 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4202
4206
|
return C;
|
|
4203
4207
|
}
|
|
4204
4208
|
e.checkDataTypes = v;
|
|
4205
|
-
const
|
|
4209
|
+
const y = {
|
|
4206
4210
|
message: ({ schema: S }) => `must be ${S}`,
|
|
4207
4211
|
params: ({ schema: S, schemaValue: I }) => typeof S == "string" ? (0, s._)`{type: ${S}}` : (0, s._)`{type: ${I}}`
|
|
4208
4212
|
};
|
|
4209
4213
|
function m(S) {
|
|
4210
4214
|
const I = k(S);
|
|
4211
|
-
(0, n.reportError)(I,
|
|
4215
|
+
(0, n.reportError)(I, y);
|
|
4212
4216
|
}
|
|
4213
4217
|
e.reportTypeError = m;
|
|
4214
4218
|
function k(S) {
|
|
@@ -4301,14 +4305,14 @@ function schemaProperties(e, t) {
|
|
|
4301
4305
|
}
|
|
4302
4306
|
code.schemaProperties = schemaProperties;
|
|
4303
4307
|
function callValidateCode({ schemaCode: e, data: t, it: { gen: r, topSchemaRef: n, schemaPath: s, errorPath: i }, it: o }, c, d, u) {
|
|
4304
|
-
const p = u ? (0, codegen_1$q._)`${e}, ${t}, ${n}${s}` : t,
|
|
4308
|
+
const p = u ? (0, codegen_1$q._)`${e}, ${t}, ${n}${s}` : t, g = [
|
|
4305
4309
|
[names_1$5.default.instancePath, (0, codegen_1$q.strConcat)(names_1$5.default.instancePath, i)],
|
|
4306
4310
|
[names_1$5.default.parentData, o.parentData],
|
|
4307
4311
|
[names_1$5.default.parentDataProperty, o.parentDataProperty],
|
|
4308
4312
|
[names_1$5.default.rootData, names_1$5.default.rootData]
|
|
4309
4313
|
];
|
|
4310
|
-
o.opts.dynamicRef &&
|
|
4311
|
-
const R = (0, codegen_1$q._)`${p}, ${r.object(...
|
|
4314
|
+
o.opts.dynamicRef && g.push([names_1$5.default.dynamicAnchors, names_1$5.default.dynamicAnchors]);
|
|
4315
|
+
const R = (0, codegen_1$q._)`${p}, ${r.object(...g)}`;
|
|
4312
4316
|
return d !== codegen_1$q.nil ? (0, codegen_1$q._)`${c}.call(${d}, ${R})` : (0, codegen_1$q._)`${c}(${R})`;
|
|
4313
4317
|
}
|
|
4314
4318
|
code.callValidateCode = callValidateCode;
|
|
@@ -4378,19 +4382,19 @@ function funcKeywordCode(e, t) {
|
|
|
4378
4382
|
var r;
|
|
4379
4383
|
const { gen: n, keyword: s, schema: i, parentSchema: o, $data: c, it: d } = e;
|
|
4380
4384
|
checkAsyncKeyword(d, t);
|
|
4381
|
-
const u = !c && t.compile ? t.compile.call(d.self, i, o, d) : t.validate, p = useKeyword(n, s, u),
|
|
4382
|
-
e.block$data(
|
|
4385
|
+
const u = !c && t.compile ? t.compile.call(d.self, i, o, d) : t.validate, p = useKeyword(n, s, u), g = n.let("valid");
|
|
4386
|
+
e.block$data(g, R), e.ok((r = t.valid) !== null && r !== void 0 ? r : g);
|
|
4383
4387
|
function R() {
|
|
4384
4388
|
if (t.errors === !1)
|
|
4385
|
-
v(), t.modifying && modifyData(e),
|
|
4389
|
+
v(), t.modifying && modifyData(e), y(() => e.error());
|
|
4386
4390
|
else {
|
|
4387
4391
|
const m = t.async ? O() : T();
|
|
4388
|
-
t.modifying && modifyData(e),
|
|
4392
|
+
t.modifying && modifyData(e), y(() => addErrs(e, m));
|
|
4389
4393
|
}
|
|
4390
4394
|
}
|
|
4391
4395
|
function O() {
|
|
4392
4396
|
const m = n.let("ruleErrs", null);
|
|
4393
|
-
return n.try(() => v((0, codegen_1$p._)`await `), (k) => n.assign(
|
|
4397
|
+
return n.try(() => v((0, codegen_1$p._)`await `), (k) => n.assign(g, !1).if((0, codegen_1$p._)`${k} instanceof ${d.ValidationError}`, () => n.assign(m, (0, codegen_1$p._)`${k}.errors`), () => n.throw(k))), m;
|
|
4394
4398
|
}
|
|
4395
4399
|
function T() {
|
|
4396
4400
|
const m = (0, codegen_1$p._)`${p}.errors`;
|
|
@@ -4398,11 +4402,11 @@ function funcKeywordCode(e, t) {
|
|
|
4398
4402
|
}
|
|
4399
4403
|
function v(m = t.async ? (0, codegen_1$p._)`await ` : codegen_1$p.nil) {
|
|
4400
4404
|
const k = d.opts.passContext ? names_1$4.default.this : names_1$4.default.self, S = !("compile" in t && !c || t.schema === !1);
|
|
4401
|
-
n.assign(
|
|
4405
|
+
n.assign(g, (0, codegen_1$p._)`${m}${(0, code_1$9.callValidateCode)(e, p, k, S)}`, t.modifying);
|
|
4402
4406
|
}
|
|
4403
|
-
function
|
|
4407
|
+
function y(m) {
|
|
4404
4408
|
var k;
|
|
4405
|
-
n.if((0, codegen_1$p.not)((k = t.valid) !== null && k !== void 0 ? k :
|
|
4409
|
+
n.if((0, codegen_1$p.not)((k = t.valid) !== null && k !== void 0 ? k : g), m);
|
|
4406
4410
|
}
|
|
4407
4411
|
}
|
|
4408
4412
|
keyword.funcKeywordCode = funcKeywordCode;
|
|
@@ -4481,8 +4485,8 @@ function extendSubschemaData(e, t, { dataProp: r, dataPropType: n, data: s, data
|
|
|
4481
4485
|
throw new Error('both "data" and "dataProp" passed, only one allowed');
|
|
4482
4486
|
const { gen: c } = t;
|
|
4483
4487
|
if (r !== void 0) {
|
|
4484
|
-
const { errorPath: u, dataPathArr: p, opts:
|
|
4485
|
-
d(R), e.errorPath = (0, codegen_1$o.str)`${u}${(0, util_1$n.getErrorPath)(r, n,
|
|
4488
|
+
const { errorPath: u, dataPathArr: p, opts: g } = t, R = c.let("data", (0, codegen_1$o._)`${t.data}${(0, codegen_1$o.getProperty)(r)}`, !0);
|
|
4489
|
+
d(R), e.errorPath = (0, codegen_1$o.str)`${u}${(0, util_1$n.getErrorPath)(r, n, g.jsPropertySyntax)}`, e.parentDataProperty = (0, codegen_1$o._)`${r}`, e.dataPathArr = [...p, e.parentDataProperty];
|
|
4486
4490
|
}
|
|
4487
4491
|
if (s !== void 0) {
|
|
4488
4492
|
const u = s instanceof codegen_1$o.Name ? s : c.let("data", s, !0);
|
|
@@ -4587,17 +4591,17 @@ function _traverse(e, t, r, n, s, i, o, c, d, u) {
|
|
|
4587
4591
|
if (n && typeof n == "object" && !Array.isArray(n)) {
|
|
4588
4592
|
t(n, s, i, o, c, d, u);
|
|
4589
4593
|
for (var p in n) {
|
|
4590
|
-
var
|
|
4591
|
-
if (Array.isArray(
|
|
4594
|
+
var g = n[p];
|
|
4595
|
+
if (Array.isArray(g)) {
|
|
4592
4596
|
if (p in traverse$1.arrayKeywords)
|
|
4593
|
-
for (var R = 0; R <
|
|
4594
|
-
_traverse(e, t, r,
|
|
4597
|
+
for (var R = 0; R < g.length; R++)
|
|
4598
|
+
_traverse(e, t, r, g[R], s + "/" + p + "/" + R, i, s, p, n, R);
|
|
4595
4599
|
} else if (p in traverse$1.propsKeywords) {
|
|
4596
|
-
if (
|
|
4597
|
-
for (var O in
|
|
4598
|
-
_traverse(e, t, r,
|
|
4600
|
+
if (g && typeof g == "object")
|
|
4601
|
+
for (var O in g)
|
|
4602
|
+
_traverse(e, t, r, g[O], s + "/" + p + "/" + escapeJsonPtr(O), i, s, p, n, O);
|
|
4599
4603
|
} else
|
|
4600
|
-
(p in traverse$1.keywords || e.allKeys && !(p in traverse$1.skipKeywords)) && _traverse(e, t, r,
|
|
4604
|
+
(p in traverse$1.keywords || e.allKeys && !(p in traverse$1.skipKeywords)) && _traverse(e, t, r, g, s + "/" + p, i, s, p, n);
|
|
4601
4605
|
}
|
|
4602
4606
|
r(n, s, i, o, c, d, u);
|
|
4603
4607
|
}
|
|
@@ -4681,19 +4685,19 @@ function getSchemaRefs(e, t) {
|
|
|
4681
4685
|
if (typeof e == "boolean")
|
|
4682
4686
|
return {};
|
|
4683
4687
|
const { schemaId: r, uriResolver: n } = this.opts, s = normalizeId(e[r] || t), i = { "": s }, o = getFullPath(n, s, !1), c = {}, d = /* @__PURE__ */ new Set();
|
|
4684
|
-
return traverse(e, { allKeys: !0 }, (
|
|
4688
|
+
return traverse(e, { allKeys: !0 }, (g, R, O, T) => {
|
|
4685
4689
|
if (T === void 0)
|
|
4686
4690
|
return;
|
|
4687
4691
|
const v = o + R;
|
|
4688
|
-
let
|
|
4689
|
-
typeof
|
|
4692
|
+
let y = i[T];
|
|
4693
|
+
typeof g[r] == "string" && (y = m.call(this, g[r])), k.call(this, g.$anchor), k.call(this, g.$dynamicAnchor), i[R] = y;
|
|
4690
4694
|
function m(S) {
|
|
4691
4695
|
const I = this.opts.uriResolver.resolve;
|
|
4692
|
-
if (S = normalizeId(
|
|
4696
|
+
if (S = normalizeId(y ? I(y, S) : S), d.has(S))
|
|
4693
4697
|
throw p(S);
|
|
4694
4698
|
d.add(S);
|
|
4695
4699
|
let D = this.refs[S];
|
|
4696
|
-
return typeof D == "string" && (D = this.refs[D]), typeof D == "object" ? u(
|
|
4700
|
+
return typeof D == "string" && (D = this.refs[D]), typeof D == "object" ? u(g, D.schema, S) : S !== normalizeId(v) && (S[0] === "#" ? (u(g, c[S], S), c[S] = g) : this.refs[S] = v), S;
|
|
4697
4701
|
}
|
|
4698
4702
|
function k(S) {
|
|
4699
4703
|
if (typeof S == "string") {
|
|
@@ -4703,12 +4707,12 @@ function getSchemaRefs(e, t) {
|
|
|
4703
4707
|
}
|
|
4704
4708
|
}
|
|
4705
4709
|
}), c;
|
|
4706
|
-
function u(
|
|
4707
|
-
if (R !== void 0 && !equal$2(
|
|
4710
|
+
function u(g, R, O) {
|
|
4711
|
+
if (R !== void 0 && !equal$2(g, R))
|
|
4708
4712
|
throw p(O);
|
|
4709
4713
|
}
|
|
4710
|
-
function p(
|
|
4711
|
-
return new Error(`reference "${
|
|
4714
|
+
function p(g) {
|
|
4715
|
+
return new Error(`reference "${g}" resolves to more than one schema`);
|
|
4712
4716
|
}
|
|
4713
4717
|
}
|
|
4714
4718
|
resolve$1.getSchemaRefs = getSchemaRefs;
|
|
@@ -4825,10 +4829,10 @@ function schemaKeywords(e, t, r, n) {
|
|
|
4825
4829
|
}
|
|
4826
4830
|
d.jtd || checkStrictTypes(e, t), s.block(() => {
|
|
4827
4831
|
for (const R of p.rules)
|
|
4828
|
-
|
|
4829
|
-
|
|
4832
|
+
g(R);
|
|
4833
|
+
g(p.post);
|
|
4830
4834
|
});
|
|
4831
|
-
function
|
|
4835
|
+
function g(R) {
|
|
4832
4836
|
(0, applicability_1.shouldUseGroup)(i, R) && (R.type ? (s.if((0, dataType_2.checkDataType)(R.type, o, d.strictNumbers)), iterateKeywords(e, R), t.length === 1 && t[0] === R.type && r && (s.else(), (0, dataType_2.reportTypeError)(e)), s.endIf()) : iterateKeywords(e, R), c || s.if((0, codegen_1$n._)`${names_1$3.default.errors} === ${n || 0}`));
|
|
4833
4837
|
}
|
|
4834
4838
|
}
|
|
@@ -5091,10 +5095,10 @@ function compileSchema(e) {
|
|
|
5091
5095
|
let p;
|
|
5092
5096
|
try {
|
|
5093
5097
|
this._compilations.add(e), (0, validate_1$1.validateFunctionCode)(u), o.optimize(this.opts.code.optimize);
|
|
5094
|
-
const
|
|
5095
|
-
p = `${o.scopeRefs(names_1$2.default.scope)}return ${
|
|
5098
|
+
const g = o.toString();
|
|
5099
|
+
p = `${o.scopeRefs(names_1$2.default.scope)}return ${g}`, this.opts.code.process && (p = this.opts.code.process(p, e));
|
|
5096
5100
|
const O = new Function(`${names_1$2.default.self}`, `${names_1$2.default.scope}`, p)(this, this.scope.get());
|
|
5097
|
-
if (this.scope.value(d, { ref: O }), O.errors = null, O.schema = e.schema, O.schemaEnv = e, e.$async && (O.$async = !0), this.opts.code.source === !0 && (O.source = { validateName: d, validateCode:
|
|
5101
|
+
if (this.scope.value(d, { ref: O }), O.errors = null, O.schema = e.schema, O.schemaEnv = e, e.$async && (O.$async = !0), this.opts.code.source === !0 && (O.source = { validateName: d, validateCode: g, scopeValues: o._values }), this.opts.unevaluated) {
|
|
5098
5102
|
const { props: T, items: v } = u;
|
|
5099
5103
|
O.evaluated = {
|
|
5100
5104
|
props: T instanceof codegen_1$m.Name ? void 0 : T,
|
|
@@ -5104,8 +5108,8 @@ function compileSchema(e) {
|
|
|
5104
5108
|
}, O.source && (O.source.evaluated = (0, codegen_1$m.stringify)(O.evaluated));
|
|
5105
5109
|
}
|
|
5106
5110
|
return e.validate = O, e;
|
|
5107
|
-
} catch (
|
|
5108
|
-
throw delete e.validate, delete e.validateName, p && this.logger.error("Error compiling schema, function code:", p),
|
|
5111
|
+
} catch (g) {
|
|
5112
|
+
throw delete e.validate, delete e.validateName, p && this.logger.error("Error compiling schema, function code:", p), g;
|
|
5109
5113
|
} finally {
|
|
5110
5114
|
this._compilations.delete(e);
|
|
5111
5115
|
}
|
|
@@ -5222,13 +5226,13 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5222
5226
|
n(t);
|
|
5223
5227
|
})(commonjsGlobal, function(r) {
|
|
5224
5228
|
function n() {
|
|
5225
|
-
for (var f = arguments.length, l = Array(f),
|
|
5226
|
-
l[
|
|
5229
|
+
for (var f = arguments.length, l = Array(f), _ = 0; _ < f; _++)
|
|
5230
|
+
l[_] = arguments[_];
|
|
5227
5231
|
if (l.length > 1) {
|
|
5228
5232
|
l[0] = l[0].slice(0, -1);
|
|
5229
|
-
for (var
|
|
5230
|
-
l[
|
|
5231
|
-
return l[
|
|
5233
|
+
for (var E = l.length - 1, b = 1; b < E; ++b)
|
|
5234
|
+
l[b] = l[b].slice(1, -1);
|
|
5235
|
+
return l[E] = l[E].slice(1), l.join("");
|
|
5232
5236
|
} else
|
|
5233
5237
|
return l[0];
|
|
5234
5238
|
}
|
|
@@ -5245,20 +5249,20 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5245
5249
|
return f != null ? f instanceof Array ? f : typeof f.length != "number" || f.split || f.setInterval || f.call ? [f] : Array.prototype.slice.call(f) : [];
|
|
5246
5250
|
}
|
|
5247
5251
|
function d(f, l) {
|
|
5248
|
-
var
|
|
5252
|
+
var _ = f;
|
|
5249
5253
|
if (l)
|
|
5250
|
-
for (var
|
|
5251
|
-
|
|
5252
|
-
return
|
|
5254
|
+
for (var E in l)
|
|
5255
|
+
_[E] = l[E];
|
|
5256
|
+
return _;
|
|
5253
5257
|
}
|
|
5254
5258
|
function u(f) {
|
|
5255
|
-
var l = "[A-Za-z]",
|
|
5256
|
-
s(l + n(l,
|
|
5257
|
-
var Z = s(s("25[0-5]") + "|" + s("2[0-4]" +
|
|
5258
|
-
s("[vV]" +
|
|
5259
|
-
var ct = s(
|
|
5260
|
-
return s(s(
|
|
5261
|
-
NOT_SCHEME: new RegExp(n("[^]", l,
|
|
5259
|
+
var l = "[A-Za-z]", _ = "[0-9]", E = n(_, "[A-Fa-f]"), b = s(s("%[EFef]" + E + "%" + E + E + "%" + E + E) + "|" + s("%[89A-Fa-f]" + E + "%" + E + E) + "|" + s("%" + E + E)), q = "[\\:\\/\\?\\#\\[\\]\\@]", U = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", J = n(q, U), Y = f ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", se = f ? "[\\uE000-\\uF8FF]" : "[]", B = n(l, _, "[\\-\\.\\_\\~]", Y);
|
|
5260
|
+
s(l + n(l, _, "[\\+\\-\\.]") + "*"), s(s(b + "|" + n(B, U, "[\\:]")) + "*");
|
|
5261
|
+
var Z = s(s("25[0-5]") + "|" + s("2[0-4]" + _) + "|" + s("1" + _ + _) + "|" + s("0?[1-9]" + _) + "|0?0?" + _), ie = s(Z + "\\." + Z + "\\." + Z + "\\." + Z), x = s(E + "{1,4}"), X = s(s(x + "\\:" + x) + "|" + ie), ae = s(s(x + "\\:") + "{6}" + X), ee = s("\\:\\:" + s(x + "\\:") + "{5}" + X), Se = s(s(x) + "?\\:\\:" + s(x + "\\:") + "{4}" + X), ge = s(s(s(x + "\\:") + "{0,1}" + x) + "?\\:\\:" + s(x + "\\:") + "{3}" + X), ye = s(s(s(x + "\\:") + "{0,2}" + x) + "?\\:\\:" + s(x + "\\:") + "{2}" + X), Be = s(s(s(x + "\\:") + "{0,3}" + x) + "?\\:\\:" + x + "\\:" + X), Ie = s(s(s(x + "\\:") + "{0,4}" + x) + "?\\:\\:" + X), fe = s(s(s(x + "\\:") + "{0,5}" + x) + "?\\:\\:" + x), $e = s(s(s(x + "\\:") + "{0,6}" + x) + "?\\:\\:"), je = s([ae, ee, Se, ge, ye, Be, Ie, fe, $e].join("|")), we = s(s(B + "|" + b) + "+");
|
|
5262
|
+
s("[vV]" + E + "+\\." + n(B, U, "[\\:]") + "+"), s(s(b + "|" + n(B, U)) + "*");
|
|
5263
|
+
var ct = s(b + "|" + n(B, U, "[\\:\\@]"));
|
|
5264
|
+
return s(s(b + "|" + n(B, U, "[\\@]")) + "+"), s(s(ct + "|" + n("[\\/\\?]", se)) + "*"), {
|
|
5265
|
+
NOT_SCHEME: new RegExp(n("[^]", l, _, "[\\+\\-\\.]"), "g"),
|
|
5262
5266
|
NOT_USERINFO: new RegExp(n("[^\\%\\:]", B, U), "g"),
|
|
5263
5267
|
NOT_HOST: new RegExp(n("[^\\%\\[\\]\\:]", B, U), "g"),
|
|
5264
5268
|
NOT_PATH: new RegExp(n("[^\\%\\/\\:\\@]", B, U), "g"),
|
|
@@ -5268,123 +5272,123 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5268
5272
|
ESCAPE: new RegExp(n("[^]", B, U), "g"),
|
|
5269
5273
|
UNRESERVED: new RegExp(B, "g"),
|
|
5270
5274
|
OTHER_CHARS: new RegExp(n("[^\\%]", B, J), "g"),
|
|
5271
|
-
PCT_ENCODED: new RegExp(
|
|
5275
|
+
PCT_ENCODED: new RegExp(b, "g"),
|
|
5272
5276
|
IPV4ADDRESS: new RegExp("^(" + ie + ")$"),
|
|
5273
|
-
IPV6ADDRESS: new RegExp("^\\[?(" + je + ")" + s(s("\\%25|\\%(?!" +
|
|
5277
|
+
IPV6ADDRESS: new RegExp("^\\[?(" + je + ")" + s(s("\\%25|\\%(?!" + E + "{2})") + "(" + we + ")") + "?\\]?$")
|
|
5274
5278
|
//RFC 6874, with relaxed parsing rules
|
|
5275
5279
|
};
|
|
5276
5280
|
}
|
|
5277
|
-
var p = u(!1),
|
|
5278
|
-
function f(l,
|
|
5279
|
-
var
|
|
5281
|
+
var p = u(!1), g = u(!0), R = function() {
|
|
5282
|
+
function f(l, _) {
|
|
5283
|
+
var E = [], b = !0, q = !1, U = void 0;
|
|
5280
5284
|
try {
|
|
5281
|
-
for (var J = l[Symbol.iterator](), Y; !(
|
|
5285
|
+
for (var J = l[Symbol.iterator](), Y; !(b = (Y = J.next()).done) && (E.push(Y.value), !(_ && E.length === _)); b = !0)
|
|
5282
5286
|
;
|
|
5283
5287
|
} catch (se) {
|
|
5284
|
-
|
|
5288
|
+
q = !0, U = se;
|
|
5285
5289
|
} finally {
|
|
5286
5290
|
try {
|
|
5287
|
-
!
|
|
5291
|
+
!b && J.return && J.return();
|
|
5288
5292
|
} finally {
|
|
5289
|
-
if (
|
|
5293
|
+
if (q)
|
|
5290
5294
|
throw U;
|
|
5291
5295
|
}
|
|
5292
5296
|
}
|
|
5293
|
-
return
|
|
5297
|
+
return E;
|
|
5294
5298
|
}
|
|
5295
|
-
return function(l,
|
|
5299
|
+
return function(l, _) {
|
|
5296
5300
|
if (Array.isArray(l))
|
|
5297
5301
|
return l;
|
|
5298
5302
|
if (Symbol.iterator in Object(l))
|
|
5299
|
-
return f(l,
|
|
5303
|
+
return f(l, _);
|
|
5300
5304
|
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
5301
5305
|
};
|
|
5302
5306
|
}(), O = function(f) {
|
|
5303
5307
|
if (Array.isArray(f)) {
|
|
5304
|
-
for (var l = 0,
|
|
5305
|
-
|
|
5306
|
-
return
|
|
5308
|
+
for (var l = 0, _ = Array(f.length); l < f.length; l++)
|
|
5309
|
+
_[l] = f[l];
|
|
5310
|
+
return _;
|
|
5307
5311
|
} else
|
|
5308
5312
|
return Array.from(f);
|
|
5309
|
-
}, T = 2147483647, v = 36,
|
|
5313
|
+
}, T = 2147483647, v = 36, y = 1, m = 26, k = 38, S = 700, I = 72, D = 128, w = "-", C = /^xn--/, A = /[^\0-\x7E]/, V = /[\x2E\u3002\uFF0E\uFF61]/g, z = {
|
|
5310
5314
|
overflow: "Overflow: input needs wider integers to process",
|
|
5311
5315
|
"not-basic": "Illegal input >= 0x80 (not a basic code point)",
|
|
5312
5316
|
"invalid-input": "Invalid input"
|
|
5313
|
-
}, re = v -
|
|
5317
|
+
}, re = v - y, K = Math.floor, ue = String.fromCharCode;
|
|
5314
5318
|
function oe(f) {
|
|
5315
5319
|
throw new RangeError(z[f]);
|
|
5316
5320
|
}
|
|
5317
5321
|
function ke(f, l) {
|
|
5318
|
-
for (var
|
|
5319
|
-
|
|
5320
|
-
return
|
|
5322
|
+
for (var _ = [], E = f.length; E--; )
|
|
5323
|
+
_[E] = l(f[E]);
|
|
5324
|
+
return _;
|
|
5321
5325
|
}
|
|
5322
5326
|
function Ce(f, l) {
|
|
5323
|
-
var
|
|
5324
|
-
|
|
5325
|
-
var
|
|
5326
|
-
return
|
|
5327
|
-
}
|
|
5328
|
-
function
|
|
5329
|
-
for (var l = [],
|
|
5330
|
-
var
|
|
5331
|
-
if (
|
|
5332
|
-
var
|
|
5333
|
-
(
|
|
5327
|
+
var _ = f.split("@"), E = "";
|
|
5328
|
+
_.length > 1 && (E = _[0] + "@", f = _[1]), f = f.replace(V, ".");
|
|
5329
|
+
var b = f.split("."), q = ke(b, l).join(".");
|
|
5330
|
+
return E + q;
|
|
5331
|
+
}
|
|
5332
|
+
function Le(f) {
|
|
5333
|
+
for (var l = [], _ = 0, E = f.length; _ < E; ) {
|
|
5334
|
+
var b = f.charCodeAt(_++);
|
|
5335
|
+
if (b >= 55296 && b <= 56319 && _ < E) {
|
|
5336
|
+
var q = f.charCodeAt(_++);
|
|
5337
|
+
(q & 64512) == 56320 ? l.push(((b & 1023) << 10) + (q & 1023) + 65536) : (l.push(b), _--);
|
|
5334
5338
|
} else
|
|
5335
|
-
l.push(
|
|
5339
|
+
l.push(b);
|
|
5336
5340
|
}
|
|
5337
5341
|
return l;
|
|
5338
5342
|
}
|
|
5339
5343
|
var et = function(l) {
|
|
5340
5344
|
return String.fromCodePoint.apply(String, O(l));
|
|
5341
|
-
},
|
|
5345
|
+
}, qe = function(l) {
|
|
5342
5346
|
return l - 48 < 10 ? l - 22 : l - 65 < 26 ? l - 65 : l - 97 < 26 ? l - 97 : v;
|
|
5343
|
-
}, F = function(l,
|
|
5344
|
-
return l + 22 + 75 * (l < 26) - ((
|
|
5345
|
-
},
|
|
5346
|
-
var
|
|
5347
|
+
}, F = function(l, _) {
|
|
5348
|
+
return l + 22 + 75 * (l < 26) - ((_ != 0) << 5);
|
|
5349
|
+
}, $ = function(l, _, E) {
|
|
5350
|
+
var b = 0;
|
|
5347
5351
|
for (
|
|
5348
|
-
l =
|
|
5352
|
+
l = E ? K(l / S) : l >> 1, l += K(l / _);
|
|
5349
5353
|
/* no initialization */
|
|
5350
5354
|
l > re * m >> 1;
|
|
5351
|
-
|
|
5355
|
+
b += v
|
|
5352
5356
|
)
|
|
5353
5357
|
l = K(l / re);
|
|
5354
|
-
return K(
|
|
5358
|
+
return K(b + (re + 1) * l / (l + k));
|
|
5355
5359
|
}, j = function(l) {
|
|
5356
|
-
var
|
|
5360
|
+
var _ = [], E = l.length, b = 0, q = D, U = I, J = l.lastIndexOf(w);
|
|
5357
5361
|
J < 0 && (J = 0);
|
|
5358
5362
|
for (var Y = 0; Y < J; ++Y)
|
|
5359
|
-
l.charCodeAt(Y) >= 128 && oe("not-basic"),
|
|
5360
|
-
for (var se = J > 0 ? J + 1 : 0; se <
|
|
5363
|
+
l.charCodeAt(Y) >= 128 && oe("not-basic"), _.push(l.charCodeAt(Y));
|
|
5364
|
+
for (var se = J > 0 ? J + 1 : 0; se < E; ) {
|
|
5361
5365
|
for (
|
|
5362
|
-
var B =
|
|
5366
|
+
var B = b, Z = 1, ie = v;
|
|
5363
5367
|
;
|
|
5364
5368
|
/* no condition */
|
|
5365
5369
|
ie += v
|
|
5366
5370
|
) {
|
|
5367
|
-
se >=
|
|
5368
|
-
var x =
|
|
5369
|
-
(x >= v || x > K((T -
|
|
5370
|
-
var X = ie <= U ?
|
|
5371
|
+
se >= E && oe("invalid-input");
|
|
5372
|
+
var x = qe(l.charCodeAt(se++));
|
|
5373
|
+
(x >= v || x > K((T - b) / Z)) && oe("overflow"), b += x * Z;
|
|
5374
|
+
var X = ie <= U ? y : ie >= U + m ? m : ie - U;
|
|
5371
5375
|
if (x < X)
|
|
5372
5376
|
break;
|
|
5373
5377
|
var ae = v - X;
|
|
5374
5378
|
Z > K(T / ae) && oe("overflow"), Z *= ae;
|
|
5375
5379
|
}
|
|
5376
|
-
var ee =
|
|
5377
|
-
U =
|
|
5380
|
+
var ee = _.length + 1;
|
|
5381
|
+
U = $(b - B, ee, B == 0), K(b / ee) > T - q && oe("overflow"), q += K(b / ee), b %= ee, _.splice(b++, 0, q);
|
|
5378
5382
|
}
|
|
5379
|
-
return String.fromCodePoint.apply(String,
|
|
5383
|
+
return String.fromCodePoint.apply(String, _);
|
|
5380
5384
|
}, P = function(l) {
|
|
5381
|
-
var
|
|
5382
|
-
l =
|
|
5383
|
-
var
|
|
5385
|
+
var _ = [];
|
|
5386
|
+
l = Le(l);
|
|
5387
|
+
var E = l.length, b = D, q = 0, U = I, J = !0, Y = !1, se = void 0;
|
|
5384
5388
|
try {
|
|
5385
5389
|
for (var B = l[Symbol.iterator](), Z; !(J = (Z = B.next()).done); J = !0) {
|
|
5386
5390
|
var ie = Z.value;
|
|
5387
|
-
ie < 128 &&
|
|
5391
|
+
ie < 128 && _.push(ue(ie));
|
|
5388
5392
|
}
|
|
5389
5393
|
} catch (lt) {
|
|
5390
5394
|
Y = !0, se = lt;
|
|
@@ -5396,66 +5400,66 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5396
5400
|
throw se;
|
|
5397
5401
|
}
|
|
5398
5402
|
}
|
|
5399
|
-
var x =
|
|
5400
|
-
for (x &&
|
|
5403
|
+
var x = _.length, X = x;
|
|
5404
|
+
for (x && _.push(w); X < E; ) {
|
|
5401
5405
|
var ae = T, ee = !0, Se = !1, ge = void 0;
|
|
5402
5406
|
try {
|
|
5403
|
-
for (var
|
|
5407
|
+
for (var ye = l[Symbol.iterator](), Be; !(ee = (Be = ye.next()).done); ee = !0) {
|
|
5404
5408
|
var Ie = Be.value;
|
|
5405
|
-
Ie >=
|
|
5409
|
+
Ie >= b && Ie < ae && (ae = Ie);
|
|
5406
5410
|
}
|
|
5407
5411
|
} catch (lt) {
|
|
5408
5412
|
Se = !0, ge = lt;
|
|
5409
5413
|
} finally {
|
|
5410
5414
|
try {
|
|
5411
|
-
!ee &&
|
|
5415
|
+
!ee && ye.return && ye.return();
|
|
5412
5416
|
} finally {
|
|
5413
5417
|
if (Se)
|
|
5414
5418
|
throw ge;
|
|
5415
5419
|
}
|
|
5416
5420
|
}
|
|
5417
5421
|
var fe = X + 1;
|
|
5418
|
-
ae -
|
|
5419
|
-
var
|
|
5422
|
+
ae - b > K((T - q) / fe) && oe("overflow"), q += (ae - b) * fe, b = ae;
|
|
5423
|
+
var $e = !0, je = !1, we = void 0;
|
|
5420
5424
|
try {
|
|
5421
|
-
for (var ct = l[Symbol.iterator](), Ut; !(
|
|
5425
|
+
for (var ct = l[Symbol.iterator](), Ut; !($e = (Ut = ct.next()).done); $e = !0) {
|
|
5422
5426
|
var Ht = Ut.value;
|
|
5423
|
-
if (Ht <
|
|
5427
|
+
if (Ht < b && ++q > T && oe("overflow"), Ht == b) {
|
|
5424
5428
|
for (
|
|
5425
|
-
var pt =
|
|
5429
|
+
var pt = q, ft = v;
|
|
5426
5430
|
;
|
|
5427
5431
|
/* no condition */
|
|
5428
5432
|
ft += v
|
|
5429
5433
|
) {
|
|
5430
|
-
var ht = ft <= U ?
|
|
5434
|
+
var ht = ft <= U ? y : ft >= U + m ? m : ft - U;
|
|
5431
5435
|
if (pt < ht)
|
|
5432
5436
|
break;
|
|
5433
5437
|
var Vt = pt - ht, xt = v - ht;
|
|
5434
|
-
|
|
5438
|
+
_.push(ue(F(ht + Vt % xt, 0))), pt = K(Vt / xt);
|
|
5435
5439
|
}
|
|
5436
|
-
|
|
5440
|
+
_.push(ue(F(pt, 0))), U = $(q, fe, X == x), q = 0, ++X;
|
|
5437
5441
|
}
|
|
5438
5442
|
}
|
|
5439
5443
|
} catch (lt) {
|
|
5440
5444
|
je = !0, we = lt;
|
|
5441
5445
|
} finally {
|
|
5442
5446
|
try {
|
|
5443
|
-
|
|
5447
|
+
!$e && ct.return && ct.return();
|
|
5444
5448
|
} finally {
|
|
5445
5449
|
if (je)
|
|
5446
5450
|
throw we;
|
|
5447
5451
|
}
|
|
5448
5452
|
}
|
|
5449
|
-
++
|
|
5453
|
+
++q, ++b;
|
|
5450
5454
|
}
|
|
5451
|
-
return
|
|
5455
|
+
return _.join("");
|
|
5452
5456
|
}, a = function(l) {
|
|
5453
|
-
return Ce(l, function(
|
|
5454
|
-
return C.test(
|
|
5457
|
+
return Ce(l, function(_) {
|
|
5458
|
+
return C.test(_) ? j(_.slice(4).toLowerCase()) : _;
|
|
5455
5459
|
});
|
|
5456
5460
|
}, h = function(l) {
|
|
5457
|
-
return Ce(l, function(
|
|
5458
|
-
return A.test(
|
|
5461
|
+
return Ce(l, function(_) {
|
|
5462
|
+
return A.test(_) ? "xn--" + P(_) : _;
|
|
5459
5463
|
});
|
|
5460
5464
|
}, N = {
|
|
5461
5465
|
/**
|
|
@@ -5472,7 +5476,7 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5472
5476
|
* @type Object
|
|
5473
5477
|
*/
|
|
5474
5478
|
ucs2: {
|
|
5475
|
-
decode:
|
|
5479
|
+
decode: Le,
|
|
5476
5480
|
encode: et
|
|
5477
5481
|
},
|
|
5478
5482
|
decode: j,
|
|
@@ -5480,100 +5484,100 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5480
5484
|
toASCII: h,
|
|
5481
5485
|
toUnicode: a
|
|
5482
5486
|
}, M = {};
|
|
5483
|
-
function
|
|
5484
|
-
var l = f.charCodeAt(0),
|
|
5485
|
-
return l < 16 ?
|
|
5487
|
+
function L(f) {
|
|
5488
|
+
var l = f.charCodeAt(0), _ = void 0;
|
|
5489
|
+
return l < 16 ? _ = "%0" + l.toString(16).toUpperCase() : l < 128 ? _ = "%" + l.toString(16).toUpperCase() : l < 2048 ? _ = "%" + (l >> 6 | 192).toString(16).toUpperCase() + "%" + (l & 63 | 128).toString(16).toUpperCase() : _ = "%" + (l >> 12 | 224).toString(16).toUpperCase() + "%" + (l >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (l & 63 | 128).toString(16).toUpperCase(), _;
|
|
5486
5490
|
}
|
|
5487
5491
|
function W(f) {
|
|
5488
|
-
for (var l = "",
|
|
5489
|
-
var
|
|
5490
|
-
if (
|
|
5491
|
-
l += String.fromCharCode(
|
|
5492
|
-
else if (
|
|
5493
|
-
if (
|
|
5494
|
-
var
|
|
5495
|
-
l += String.fromCharCode((
|
|
5492
|
+
for (var l = "", _ = 0, E = f.length; _ < E; ) {
|
|
5493
|
+
var b = parseInt(f.substr(_ + 1, 2), 16);
|
|
5494
|
+
if (b < 128)
|
|
5495
|
+
l += String.fromCharCode(b), _ += 3;
|
|
5496
|
+
else if (b >= 194 && b < 224) {
|
|
5497
|
+
if (E - _ >= 6) {
|
|
5498
|
+
var q = parseInt(f.substr(_ + 4, 2), 16);
|
|
5499
|
+
l += String.fromCharCode((b & 31) << 6 | q & 63);
|
|
5496
5500
|
} else
|
|
5497
|
-
l += f.substr(
|
|
5498
|
-
|
|
5499
|
-
} else if (
|
|
5500
|
-
if (
|
|
5501
|
-
var U = parseInt(f.substr(
|
|
5502
|
-
l += String.fromCharCode((
|
|
5501
|
+
l += f.substr(_, 6);
|
|
5502
|
+
_ += 6;
|
|
5503
|
+
} else if (b >= 224) {
|
|
5504
|
+
if (E - _ >= 9) {
|
|
5505
|
+
var U = parseInt(f.substr(_ + 4, 2), 16), J = parseInt(f.substr(_ + 7, 2), 16);
|
|
5506
|
+
l += String.fromCharCode((b & 15) << 12 | (U & 63) << 6 | J & 63);
|
|
5503
5507
|
} else
|
|
5504
|
-
l += f.substr(
|
|
5505
|
-
|
|
5508
|
+
l += f.substr(_, 9);
|
|
5509
|
+
_ += 9;
|
|
5506
5510
|
} else
|
|
5507
|
-
l += f.substr(
|
|
5511
|
+
l += f.substr(_, 3), _ += 3;
|
|
5508
5512
|
}
|
|
5509
5513
|
return l;
|
|
5510
5514
|
}
|
|
5511
5515
|
function G(f, l) {
|
|
5512
|
-
function
|
|
5513
|
-
var
|
|
5514
|
-
return
|
|
5516
|
+
function _(E) {
|
|
5517
|
+
var b = W(E);
|
|
5518
|
+
return b.match(l.UNRESERVED) ? b : E;
|
|
5515
5519
|
}
|
|
5516
|
-
return f.scheme && (f.scheme = String(f.scheme).replace(l.PCT_ENCODED,
|
|
5520
|
+
return f.scheme && (f.scheme = String(f.scheme).replace(l.PCT_ENCODED, _).toLowerCase().replace(l.NOT_SCHEME, "")), f.userinfo !== void 0 && (f.userinfo = String(f.userinfo).replace(l.PCT_ENCODED, _).replace(l.NOT_USERINFO, L).replace(l.PCT_ENCODED, o)), f.host !== void 0 && (f.host = String(f.host).replace(l.PCT_ENCODED, _).toLowerCase().replace(l.NOT_HOST, L).replace(l.PCT_ENCODED, o)), f.path !== void 0 && (f.path = String(f.path).replace(l.PCT_ENCODED, _).replace(f.scheme ? l.NOT_PATH : l.NOT_PATH_NOSCHEME, L).replace(l.PCT_ENCODED, o)), f.query !== void 0 && (f.query = String(f.query).replace(l.PCT_ENCODED, _).replace(l.NOT_QUERY, L).replace(l.PCT_ENCODED, o)), f.fragment !== void 0 && (f.fragment = String(f.fragment).replace(l.PCT_ENCODED, _).replace(l.NOT_FRAGMENT, L).replace(l.PCT_ENCODED, o)), f;
|
|
5517
5521
|
}
|
|
5518
5522
|
function ne(f) {
|
|
5519
5523
|
return f.replace(/^0*(.*)/, "$1") || "0";
|
|
5520
5524
|
}
|
|
5521
5525
|
function he(f, l) {
|
|
5522
|
-
var
|
|
5523
|
-
return
|
|
5526
|
+
var _ = f.match(l.IPV4ADDRESS) || [], E = R(_, 2), b = E[1];
|
|
5527
|
+
return b ? b.split(".").map(ne).join(".") : f;
|
|
5524
5528
|
}
|
|
5525
5529
|
function Ue(f, l) {
|
|
5526
|
-
var
|
|
5527
|
-
if (
|
|
5528
|
-
for (var U =
|
|
5530
|
+
var _ = f.match(l.IPV6ADDRESS) || [], E = R(_, 3), b = E[1], q = E[2];
|
|
5531
|
+
if (b) {
|
|
5532
|
+
for (var U = b.toLowerCase().split("::").reverse(), J = R(U, 2), Y = J[0], se = J[1], B = se ? se.split(":").map(ne) : [], Z = Y.split(":").map(ne), ie = l.IPV4ADDRESS.test(Z[Z.length - 1]), x = ie ? 7 : 8, X = Z.length - x, ae = Array(x), ee = 0; ee < x; ++ee)
|
|
5529
5533
|
ae[ee] = B[ee] || Z[X + ee] || "";
|
|
5530
5534
|
ie && (ae[x - 1] = he(ae[x - 1], l));
|
|
5531
|
-
var Se = ae.reduce(function(fe,
|
|
5532
|
-
if (
|
|
5535
|
+
var Se = ae.reduce(function(fe, $e, je) {
|
|
5536
|
+
if (!$e || $e === "0") {
|
|
5533
5537
|
var we = fe[fe.length - 1];
|
|
5534
5538
|
we && we.index + we.length === je ? we.length++ : fe.push({ index: je, length: 1 });
|
|
5535
5539
|
}
|
|
5536
5540
|
return fe;
|
|
5537
|
-
}, []), ge = Se.sort(function(fe,
|
|
5538
|
-
return
|
|
5539
|
-
})[0],
|
|
5541
|
+
}, []), ge = Se.sort(function(fe, $e) {
|
|
5542
|
+
return $e.length - fe.length;
|
|
5543
|
+
})[0], ye = void 0;
|
|
5540
5544
|
if (ge && ge.length > 1) {
|
|
5541
5545
|
var Be = ae.slice(0, ge.index), Ie = ae.slice(ge.index + ge.length);
|
|
5542
|
-
|
|
5546
|
+
ye = Be.join(":") + "::" + Ie.join(":");
|
|
5543
5547
|
} else
|
|
5544
|
-
|
|
5545
|
-
return
|
|
5548
|
+
ye = ae.join(":");
|
|
5549
|
+
return q && (ye += "%" + q), ye;
|
|
5546
5550
|
} else
|
|
5547
5551
|
return f;
|
|
5548
5552
|
}
|
|
5549
5553
|
var tt = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, rt = "".match(/(){0}/)[1] === void 0;
|
|
5550
5554
|
function de(f) {
|
|
5551
|
-
var l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
5555
|
+
var l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, _ = {}, E = l.iri !== !1 ? g : p;
|
|
5552
5556
|
l.reference === "suffix" && (f = (l.scheme ? l.scheme + ":" : "") + "//" + f);
|
|
5553
|
-
var
|
|
5554
|
-
if (
|
|
5555
|
-
rt ? (
|
|
5556
|
-
var
|
|
5557
|
-
if (!l.unicodeSupport && (!
|
|
5558
|
-
if (
|
|
5557
|
+
var b = f.match(tt);
|
|
5558
|
+
if (b) {
|
|
5559
|
+
rt ? (_.scheme = b[1], _.userinfo = b[3], _.host = b[4], _.port = parseInt(b[5], 10), _.path = b[6] || "", _.query = b[7], _.fragment = b[8], isNaN(_.port) && (_.port = b[5])) : (_.scheme = b[1] || void 0, _.userinfo = f.indexOf("@") !== -1 ? b[3] : void 0, _.host = f.indexOf("//") !== -1 ? b[4] : void 0, _.port = parseInt(b[5], 10), _.path = b[6] || "", _.query = f.indexOf("?") !== -1 ? b[7] : void 0, _.fragment = f.indexOf("#") !== -1 ? b[8] : void 0, isNaN(_.port) && (_.port = f.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? b[4] : void 0)), _.host && (_.host = Ue(he(_.host, E), E)), _.scheme === void 0 && _.userinfo === void 0 && _.host === void 0 && _.port === void 0 && !_.path && _.query === void 0 ? _.reference = "same-document" : _.scheme === void 0 ? _.reference = "relative" : _.fragment === void 0 ? _.reference = "absolute" : _.reference = "uri", l.reference && l.reference !== "suffix" && l.reference !== _.reference && (_.error = _.error || "URI is not a " + l.reference + " reference.");
|
|
5560
|
+
var q = M[(l.scheme || _.scheme || "").toLowerCase()];
|
|
5561
|
+
if (!l.unicodeSupport && (!q || !q.unicodeSupport)) {
|
|
5562
|
+
if (_.host && (l.domainHost || q && q.domainHost))
|
|
5559
5563
|
try {
|
|
5560
|
-
|
|
5564
|
+
_.host = N.toASCII(_.host.replace(E.PCT_ENCODED, W).toLowerCase());
|
|
5561
5565
|
} catch (U) {
|
|
5562
|
-
|
|
5566
|
+
_.error = _.error || "Host's domain name can not be converted to ASCII via punycode: " + U;
|
|
5563
5567
|
}
|
|
5564
|
-
G(
|
|
5568
|
+
G(_, p);
|
|
5565
5569
|
} else
|
|
5566
|
-
G(
|
|
5567
|
-
|
|
5570
|
+
G(_, E);
|
|
5571
|
+
q && q.parse && q.parse(_, l);
|
|
5568
5572
|
} else
|
|
5569
|
-
|
|
5570
|
-
return
|
|
5573
|
+
_.error = _.error || "URI can not be parsed.";
|
|
5574
|
+
return _;
|
|
5571
5575
|
}
|
|
5572
5576
|
function nt(f, l) {
|
|
5573
|
-
var
|
|
5574
|
-
return f.userinfo !== void 0 && (
|
|
5575
|
-
return "[" +
|
|
5576
|
-
})), (typeof f.port == "number" || typeof f.port == "string") && (
|
|
5577
|
+
var _ = l.iri !== !1 ? g : p, E = [];
|
|
5578
|
+
return f.userinfo !== void 0 && (E.push(f.userinfo), E.push("@")), f.host !== void 0 && E.push(Ue(he(String(f.host), _), _).replace(_.IPV6ADDRESS, function(b, q, U) {
|
|
5579
|
+
return "[" + q + (U ? "%25" + U : "") + "]";
|
|
5580
|
+
})), (typeof f.port == "number" || typeof f.port == "string") && (E.push(":"), E.push(String(f.port))), E.length ? E.join("") : void 0;
|
|
5577
5581
|
}
|
|
5578
5582
|
var He = /^\.\.?\//, Ve = /^\/\.(\/|$)/, xe = /^\/\.\.(\/|$)/, st = /^\/?(?:.|\n)*?(?=\/|$)/;
|
|
5579
5583
|
function me(f) {
|
|
@@ -5587,62 +5591,62 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5587
5591
|
else if (f === "." || f === "..")
|
|
5588
5592
|
f = "";
|
|
5589
5593
|
else {
|
|
5590
|
-
var
|
|
5591
|
-
if (
|
|
5592
|
-
var
|
|
5593
|
-
f = f.slice(
|
|
5594
|
+
var _ = f.match(st);
|
|
5595
|
+
if (_) {
|
|
5596
|
+
var E = _[0];
|
|
5597
|
+
f = f.slice(E.length), l.push(E);
|
|
5594
5598
|
} else
|
|
5595
5599
|
throw new Error("Unexpected dot segment condition");
|
|
5596
5600
|
}
|
|
5597
5601
|
return l.join("");
|
|
5598
5602
|
}
|
|
5599
5603
|
function le(f) {
|
|
5600
|
-
var l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
5601
|
-
if (
|
|
5602
|
-
if (l.domainHost ||
|
|
5604
|
+
var l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, _ = l.iri ? g : p, E = [], b = M[(l.scheme || f.scheme || "").toLowerCase()];
|
|
5605
|
+
if (b && b.serialize && b.serialize(f, l), f.host && !_.IPV6ADDRESS.test(f.host)) {
|
|
5606
|
+
if (l.domainHost || b && b.domainHost)
|
|
5603
5607
|
try {
|
|
5604
|
-
f.host = l.iri ? N.toUnicode(f.host) : N.toASCII(f.host.replace(
|
|
5608
|
+
f.host = l.iri ? N.toUnicode(f.host) : N.toASCII(f.host.replace(_.PCT_ENCODED, W).toLowerCase());
|
|
5605
5609
|
} catch (J) {
|
|
5606
5610
|
f.error = f.error || "Host's domain name can not be converted to " + (l.iri ? "Unicode" : "ASCII") + " via punycode: " + J;
|
|
5607
5611
|
}
|
|
5608
5612
|
}
|
|
5609
|
-
G(f,
|
|
5610
|
-
var
|
|
5611
|
-
if (
|
|
5613
|
+
G(f, _), l.reference !== "suffix" && f.scheme && (E.push(f.scheme), E.push(":"));
|
|
5614
|
+
var q = nt(f, l);
|
|
5615
|
+
if (q !== void 0 && (l.reference !== "suffix" && E.push("//"), E.push(q), f.path && f.path.charAt(0) !== "/" && E.push("/")), f.path !== void 0) {
|
|
5612
5616
|
var U = f.path;
|
|
5613
|
-
!l.absolutePath && (!
|
|
5617
|
+
!l.absolutePath && (!b || !b.absolutePath) && (U = me(U)), q === void 0 && (U = U.replace(/^\/\//, "/%2F")), E.push(U);
|
|
5614
5618
|
}
|
|
5615
|
-
return f.query !== void 0 && (
|
|
5619
|
+
return f.query !== void 0 && (E.push("?"), E.push(f.query)), f.fragment !== void 0 && (E.push("#"), E.push(f.fragment)), E.join("");
|
|
5616
5620
|
}
|
|
5617
5621
|
function ze(f, l) {
|
|
5618
|
-
var
|
|
5619
|
-
return
|
|
5622
|
+
var _ = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, E = arguments[3], b = {};
|
|
5623
|
+
return E || (f = de(le(f, _), _), l = de(le(l, _), _)), _ = _ || {}, !_.tolerant && l.scheme ? (b.scheme = l.scheme, b.userinfo = l.userinfo, b.host = l.host, b.port = l.port, b.path = me(l.path || ""), b.query = l.query) : (l.userinfo !== void 0 || l.host !== void 0 || l.port !== void 0 ? (b.userinfo = l.userinfo, b.host = l.host, b.port = l.port, b.path = me(l.path || ""), b.query = l.query) : (l.path ? (l.path.charAt(0) === "/" ? b.path = me(l.path) : ((f.userinfo !== void 0 || f.host !== void 0 || f.port !== void 0) && !f.path ? b.path = "/" + l.path : f.path ? b.path = f.path.slice(0, f.path.lastIndexOf("/") + 1) + l.path : b.path = l.path, b.path = me(b.path)), b.query = l.query) : (b.path = f.path, l.query !== void 0 ? b.query = l.query : b.query = f.query), b.userinfo = f.userinfo, b.host = f.host, b.port = f.port), b.scheme = f.scheme), b.fragment = l.fragment, b;
|
|
5620
5624
|
}
|
|
5621
|
-
function it(f, l,
|
|
5622
|
-
var
|
|
5623
|
-
return le(ze(de(f,
|
|
5625
|
+
function it(f, l, _) {
|
|
5626
|
+
var E = d({ scheme: "null" }, _);
|
|
5627
|
+
return le(ze(de(f, E), de(l, E), E, !0), E);
|
|
5624
5628
|
}
|
|
5625
5629
|
function Oe(f, l) {
|
|
5626
5630
|
return typeof f == "string" ? f = le(de(f, l), l) : i(f) === "object" && (f = de(le(f, l), l)), f;
|
|
5627
5631
|
}
|
|
5628
|
-
function ot(f, l,
|
|
5629
|
-
return typeof f == "string" ? f = le(de(f,
|
|
5632
|
+
function ot(f, l, _) {
|
|
5633
|
+
return typeof f == "string" ? f = le(de(f, _), _) : i(f) === "object" && (f = le(f, _)), typeof l == "string" ? l = le(de(l, _), _) : i(l) === "object" && (l = le(l, _)), f === l;
|
|
5630
5634
|
}
|
|
5631
5635
|
function ut(f, l) {
|
|
5632
|
-
return f && f.toString().replace(!l || !l.iri ? p.ESCAPE :
|
|
5636
|
+
return f && f.toString().replace(!l || !l.iri ? p.ESCAPE : g.ESCAPE, L);
|
|
5633
5637
|
}
|
|
5634
5638
|
function pe(f, l) {
|
|
5635
|
-
return f && f.toString().replace(!l || !l.iri ? p.PCT_ENCODED :
|
|
5639
|
+
return f && f.toString().replace(!l || !l.iri ? p.PCT_ENCODED : g.PCT_ENCODED, W);
|
|
5636
5640
|
}
|
|
5637
5641
|
var Ne = {
|
|
5638
5642
|
scheme: "http",
|
|
5639
5643
|
domainHost: !0,
|
|
5640
|
-
parse: function(l,
|
|
5644
|
+
parse: function(l, _) {
|
|
5641
5645
|
return l.host || (l.error = l.error || "HTTP URIs must have a host."), l;
|
|
5642
5646
|
},
|
|
5643
|
-
serialize: function(l,
|
|
5644
|
-
var
|
|
5645
|
-
return (l.port === (
|
|
5647
|
+
serialize: function(l, _) {
|
|
5648
|
+
var E = String(l.scheme).toLowerCase() === "https";
|
|
5649
|
+
return (l.port === (E ? 443 : 80) || l.port === "") && (l.port = void 0), l.path || (l.path = "/"), l;
|
|
5646
5650
|
}
|
|
5647
5651
|
}, It = {
|
|
5648
5652
|
scheme: "https",
|
|
@@ -5656,14 +5660,14 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5656
5660
|
var at = {
|
|
5657
5661
|
scheme: "ws",
|
|
5658
5662
|
domainHost: !0,
|
|
5659
|
-
parse: function(l,
|
|
5660
|
-
var
|
|
5661
|
-
return
|
|
5663
|
+
parse: function(l, _) {
|
|
5664
|
+
var E = l;
|
|
5665
|
+
return E.secure = jt(E), E.resourceName = (E.path || "/") + (E.query ? "?" + E.query : ""), E.path = void 0, E.query = void 0, E;
|
|
5662
5666
|
},
|
|
5663
|
-
serialize: function(l,
|
|
5667
|
+
serialize: function(l, _) {
|
|
5664
5668
|
if ((l.port === (jt(l) ? 443 : 80) || l.port === "") && (l.port = void 0), typeof l.secure == "boolean" && (l.scheme = l.secure ? "wss" : "ws", l.secure = void 0), l.resourceName) {
|
|
5665
|
-
var
|
|
5666
|
-
l.path =
|
|
5669
|
+
var E = l.resourceName.split("?"), b = R(E, 2), q = b[0], U = b[1];
|
|
5670
|
+
l.path = q && q !== "/" ? q : void 0, l.query = U, l.resourceName = void 0;
|
|
5667
5671
|
}
|
|
5668
5672
|
return l.fragment = void 0, l;
|
|
5669
5673
|
}
|
|
@@ -5679,94 +5683,94 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5679
5683
|
}
|
|
5680
5684
|
var Mt = {
|
|
5681
5685
|
scheme: "mailto",
|
|
5682
|
-
parse: function(l,
|
|
5683
|
-
var
|
|
5684
|
-
if (
|
|
5685
|
-
for (var
|
|
5686
|
+
parse: function(l, _) {
|
|
5687
|
+
var E = l, b = E.to = E.path ? E.path.split(",") : [];
|
|
5688
|
+
if (E.path = void 0, E.query) {
|
|
5689
|
+
for (var q = !1, U = {}, J = E.query.split("&"), Y = 0, se = J.length; Y < se; ++Y) {
|
|
5686
5690
|
var B = J[Y].split("=");
|
|
5687
5691
|
switch (B[0]) {
|
|
5688
5692
|
case "to":
|
|
5689
5693
|
for (var Z = B[1].split(","), ie = 0, x = Z.length; ie < x; ++ie)
|
|
5690
|
-
|
|
5694
|
+
b.push(Z[ie]);
|
|
5691
5695
|
break;
|
|
5692
5696
|
case "subject":
|
|
5693
|
-
|
|
5697
|
+
E.subject = pe(B[1], _);
|
|
5694
5698
|
break;
|
|
5695
5699
|
case "body":
|
|
5696
|
-
|
|
5700
|
+
E.body = pe(B[1], _);
|
|
5697
5701
|
break;
|
|
5698
5702
|
default:
|
|
5699
|
-
|
|
5703
|
+
q = !0, U[pe(B[0], _)] = pe(B[1], _);
|
|
5700
5704
|
break;
|
|
5701
5705
|
}
|
|
5702
5706
|
}
|
|
5703
|
-
|
|
5707
|
+
q && (E.headers = U);
|
|
5704
5708
|
}
|
|
5705
|
-
|
|
5706
|
-
for (var X = 0, ae =
|
|
5707
|
-
var ee =
|
|
5708
|
-
if (ee[0] = pe(ee[0]),
|
|
5709
|
-
ee[1] = pe(ee[1],
|
|
5709
|
+
E.query = void 0;
|
|
5710
|
+
for (var X = 0, ae = b.length; X < ae; ++X) {
|
|
5711
|
+
var ee = b[X].split("@");
|
|
5712
|
+
if (ee[0] = pe(ee[0]), _.unicodeSupport)
|
|
5713
|
+
ee[1] = pe(ee[1], _).toLowerCase();
|
|
5710
5714
|
else
|
|
5711
5715
|
try {
|
|
5712
|
-
ee[1] = N.toASCII(pe(ee[1],
|
|
5716
|
+
ee[1] = N.toASCII(pe(ee[1], _).toLowerCase());
|
|
5713
5717
|
} catch (Se) {
|
|
5714
|
-
|
|
5718
|
+
E.error = E.error || "Email address's domain name can not be converted to ASCII via punycode: " + Se;
|
|
5715
5719
|
}
|
|
5716
|
-
|
|
5720
|
+
b[X] = ee.join("@");
|
|
5717
5721
|
}
|
|
5718
|
-
return
|
|
5722
|
+
return E;
|
|
5719
5723
|
},
|
|
5720
|
-
serialize: function(l,
|
|
5721
|
-
var
|
|
5722
|
-
if (
|
|
5723
|
-
for (var
|
|
5724
|
-
var J = String(
|
|
5724
|
+
serialize: function(l, _) {
|
|
5725
|
+
var E = l, b = c(l.to);
|
|
5726
|
+
if (b) {
|
|
5727
|
+
for (var q = 0, U = b.length; q < U; ++q) {
|
|
5728
|
+
var J = String(b[q]), Y = J.lastIndexOf("@"), se = J.slice(0, Y).replace(We, Ot).replace(We, o).replace(pr, L), B = J.slice(Y + 1);
|
|
5725
5729
|
try {
|
|
5726
|
-
B =
|
|
5730
|
+
B = _.iri ? N.toUnicode(B) : N.toASCII(pe(B, _).toLowerCase());
|
|
5727
5731
|
} catch (X) {
|
|
5728
|
-
|
|
5732
|
+
E.error = E.error || "Email address's domain name can not be converted to " + (_.iri ? "Unicode" : "ASCII") + " via punycode: " + X;
|
|
5729
5733
|
}
|
|
5730
|
-
|
|
5734
|
+
b[q] = se + "@" + B;
|
|
5731
5735
|
}
|
|
5732
|
-
|
|
5736
|
+
E.path = b.join(",");
|
|
5733
5737
|
}
|
|
5734
5738
|
var Z = l.headers = l.headers || {};
|
|
5735
5739
|
l.subject && (Z.subject = l.subject), l.body && (Z.body = l.body);
|
|
5736
5740
|
var ie = [];
|
|
5737
5741
|
for (var x in Z)
|
|
5738
|
-
Z[x] !== ir[x] && ie.push(x.replace(We, Ot).replace(We, o).replace(Ft,
|
|
5739
|
-
return ie.length && (
|
|
5742
|
+
Z[x] !== ir[x] && ie.push(x.replace(We, Ot).replace(We, o).replace(Ft, L) + "=" + Z[x].replace(We, Ot).replace(We, o).replace(fr, L));
|
|
5743
|
+
return ie.length && (E.query = ie.join("&")), E;
|
|
5740
5744
|
}
|
|
5741
|
-
}, hr = /^([^\:]+)\:(.*)/,
|
|
5745
|
+
}, hr = /^([^\:]+)\:(.*)/, Lt = {
|
|
5742
5746
|
scheme: "urn",
|
|
5743
|
-
parse: function(l,
|
|
5744
|
-
var
|
|
5745
|
-
if (
|
|
5746
|
-
var
|
|
5747
|
-
|
|
5747
|
+
parse: function(l, _) {
|
|
5748
|
+
var E = l.path && l.path.match(hr), b = l;
|
|
5749
|
+
if (E) {
|
|
5750
|
+
var q = _.scheme || b.scheme || "urn", U = E[1].toLowerCase(), J = E[2], Y = q + ":" + (_.nid || U), se = M[Y];
|
|
5751
|
+
b.nid = U, b.nss = J, b.path = void 0, se && (b = se.parse(b, _));
|
|
5748
5752
|
} else
|
|
5749
|
-
|
|
5750
|
-
return
|
|
5753
|
+
b.error = b.error || "URN can not be parsed.";
|
|
5754
|
+
return b;
|
|
5751
5755
|
},
|
|
5752
|
-
serialize: function(l,
|
|
5753
|
-
var
|
|
5754
|
-
U && (l = U.serialize(l,
|
|
5756
|
+
serialize: function(l, _) {
|
|
5757
|
+
var E = _.scheme || l.scheme || "urn", b = l.nid, q = E + ":" + (_.nid || b), U = M[q];
|
|
5758
|
+
U && (l = U.serialize(l, _));
|
|
5755
5759
|
var J = l, Y = l.nss;
|
|
5756
|
-
return J.path = (
|
|
5760
|
+
return J.path = (b || _.nid) + ":" + Y, J;
|
|
5757
5761
|
}
|
|
5758
|
-
}, mr = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,
|
|
5762
|
+
}, mr = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, qt = {
|
|
5759
5763
|
scheme: "urn:uuid",
|
|
5760
|
-
parse: function(l,
|
|
5761
|
-
var
|
|
5762
|
-
return
|
|
5764
|
+
parse: function(l, _) {
|
|
5765
|
+
var E = l;
|
|
5766
|
+
return E.uuid = E.nss, E.nss = void 0, !_.tolerant && (!E.uuid || !E.uuid.match(mr)) && (E.error = E.error || "UUID is not valid."), E;
|
|
5763
5767
|
},
|
|
5764
|
-
serialize: function(l,
|
|
5765
|
-
var
|
|
5766
|
-
return
|
|
5768
|
+
serialize: function(l, _) {
|
|
5769
|
+
var E = l;
|
|
5770
|
+
return E.nss = (l.uuid || "").toLowerCase(), E;
|
|
5767
5771
|
}
|
|
5768
5772
|
};
|
|
5769
|
-
M[Ne.scheme] = Ne, M[It.scheme] = It, M[at.scheme] = at, M[At.scheme] = At, M[Mt.scheme] = Mt, M[
|
|
5773
|
+
M[Ne.scheme] = Ne, M[It.scheme] = It, M[at.scheme] = at, M[At.scheme] = At, M[Mt.scheme] = Mt, M[Lt.scheme] = Lt, M[qt.scheme] = qt, r.SCHEMES = M, r.pctEncChar = L, r.pctDecChars = W, r.parse = de, r.removeDotSegments = me, r.serialize = le, r.resolveComponents = ze, r.resolve = it, r.normalize = Oe, r.equal = ot, r.escapeComponent = ut, r.unescapeComponent = pe, Object.defineProperty(r, "__esModule", { value: !0 });
|
|
5770
5774
|
});
|
|
5771
5775
|
})(uri_all, uri_all.exports);
|
|
5772
5776
|
var uri_allExports = uri_all.exports;
|
|
@@ -5794,7 +5798,7 @@ uri$1.default = uri;
|
|
|
5794
5798
|
} }), Object.defineProperty(e, "CodeGen", { enumerable: !0, get: function() {
|
|
5795
5799
|
return r.CodeGen;
|
|
5796
5800
|
} });
|
|
5797
|
-
const n = validation_error, s = ref_error, i = rules, o = compile, c = codegen, d = resolve$1, u = dataType, p = util,
|
|
5801
|
+
const n = validation_error, s = ref_error, i = rules, o = compile, c = codegen, d = resolve$1, u = dataType, p = util, g = require$$9, R = uri$1, O = (F, $) => new RegExp(F, $);
|
|
5798
5802
|
O.code = "new RegExp";
|
|
5799
5803
|
const T = ["removeAdditional", "useDefaults", "coerceTypes"], v = /* @__PURE__ */ new Set([
|
|
5800
5804
|
"validate",
|
|
@@ -5810,7 +5814,7 @@ uri$1.default = uri;
|
|
|
5810
5814
|
"func",
|
|
5811
5815
|
"obj",
|
|
5812
5816
|
"Error"
|
|
5813
|
-
]),
|
|
5817
|
+
]), y = {
|
|
5814
5818
|
errorDataPath: "",
|
|
5815
5819
|
format: "`validateFormats: false` can be used instead.",
|
|
5816
5820
|
nullable: '"nullable" keyword is supported by default.',
|
|
@@ -5832,11 +5836,11 @@ uri$1.default = uri;
|
|
|
5832
5836
|
unicode: '"minLength"/"maxLength" account for unicode characters by default.'
|
|
5833
5837
|
}, k = 200;
|
|
5834
5838
|
function S(F) {
|
|
5835
|
-
var
|
|
5836
|
-
const Oe = F.strict, ot = (
|
|
5839
|
+
var $, j, P, a, h, N, M, L, W, G, ne, he, Ue, tt, rt, de, nt, He, Ve, xe, st, me, le, ze, it;
|
|
5840
|
+
const Oe = F.strict, ot = ($ = F.code) === null || $ === void 0 ? void 0 : $.optimize, ut = ot === !0 || ot === void 0 ? 1 : ot || 0, pe = (P = (j = F.code) === null || j === void 0 ? void 0 : j.regExp) !== null && P !== void 0 ? P : O, Ne = (a = F.uriResolver) !== null && a !== void 0 ? a : R.default;
|
|
5837
5841
|
return {
|
|
5838
5842
|
strictSchema: (N = (h = F.strictSchema) !== null && h !== void 0 ? h : Oe) !== null && N !== void 0 ? N : !0,
|
|
5839
|
-
strictNumbers: (
|
|
5843
|
+
strictNumbers: (L = (M = F.strictNumbers) !== null && M !== void 0 ? M : Oe) !== null && L !== void 0 ? L : !0,
|
|
5840
5844
|
strictTypes: (G = (W = F.strictTypes) !== null && W !== void 0 ? W : Oe) !== null && G !== void 0 ? G : "log",
|
|
5841
5845
|
strictTuples: (he = (ne = F.strictTuples) !== null && ne !== void 0 ? ne : Oe) !== null && he !== void 0 ? he : "log",
|
|
5842
5846
|
strictRequired: (tt = (Ue = F.strictRequired) !== null && Ue !== void 0 ? Ue : Oe) !== null && tt !== void 0 ? tt : !1,
|
|
@@ -5856,44 +5860,44 @@ uri$1.default = uri;
|
|
|
5856
5860
|
};
|
|
5857
5861
|
}
|
|
5858
5862
|
class I {
|
|
5859
|
-
constructor(
|
|
5860
|
-
this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(),
|
|
5863
|
+
constructor($ = {}) {
|
|
5864
|
+
this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), $ = this.opts = { ...$, ...S($) };
|
|
5861
5865
|
const { es5: j, lines: P } = this.opts.code;
|
|
5862
|
-
this.scope = new c.ValueScope({ scope: {}, prefixes: v, es5: j, lines: P }), this.logger = K(
|
|
5863
|
-
const a =
|
|
5864
|
-
|
|
5866
|
+
this.scope = new c.ValueScope({ scope: {}, prefixes: v, es5: j, lines: P }), this.logger = K($.logger);
|
|
5867
|
+
const a = $.validateFormats;
|
|
5868
|
+
$.validateFormats = !1, this.RULES = (0, i.getRules)(), D.call(this, y, $, "NOT SUPPORTED"), D.call(this, m, $, "DEPRECATED", "warn"), this._metaOpts = z.call(this), $.formats && A.call(this), this._addVocabularies(), this._addDefaultMetaSchema(), $.keywords && V.call(this, $.keywords), typeof $.meta == "object" && this.addMetaSchema($.meta), C.call(this), $.validateFormats = a;
|
|
5865
5869
|
}
|
|
5866
5870
|
_addVocabularies() {
|
|
5867
5871
|
this.addKeyword("$async");
|
|
5868
5872
|
}
|
|
5869
5873
|
_addDefaultMetaSchema() {
|
|
5870
|
-
const { $data:
|
|
5871
|
-
let a =
|
|
5872
|
-
P === "id" && (a = { ...
|
|
5874
|
+
const { $data: $, meta: j, schemaId: P } = this.opts;
|
|
5875
|
+
let a = g;
|
|
5876
|
+
P === "id" && (a = { ...g }, a.id = a.$id, delete a.$id), j && $ && this.addMetaSchema(a, a[P], !1);
|
|
5873
5877
|
}
|
|
5874
5878
|
defaultMeta() {
|
|
5875
|
-
const { meta:
|
|
5876
|
-
return this.opts.defaultMeta = typeof
|
|
5879
|
+
const { meta: $, schemaId: j } = this.opts;
|
|
5880
|
+
return this.opts.defaultMeta = typeof $ == "object" ? $[j] || $ : void 0;
|
|
5877
5881
|
}
|
|
5878
|
-
validate(
|
|
5882
|
+
validate($, j) {
|
|
5879
5883
|
let P;
|
|
5880
|
-
if (typeof
|
|
5881
|
-
if (P = this.getSchema(
|
|
5882
|
-
throw new Error(`no schema with key or ref "${
|
|
5884
|
+
if (typeof $ == "string") {
|
|
5885
|
+
if (P = this.getSchema($), !P)
|
|
5886
|
+
throw new Error(`no schema with key or ref "${$}"`);
|
|
5883
5887
|
} else
|
|
5884
|
-
P = this.compile(
|
|
5888
|
+
P = this.compile($);
|
|
5885
5889
|
const a = P(j);
|
|
5886
5890
|
return "$async" in P || (this.errors = P.errors), a;
|
|
5887
5891
|
}
|
|
5888
|
-
compile(
|
|
5889
|
-
const P = this._addSchema(
|
|
5892
|
+
compile($, j) {
|
|
5893
|
+
const P = this._addSchema($, j);
|
|
5890
5894
|
return P.validate || this._compileSchemaEnv(P);
|
|
5891
5895
|
}
|
|
5892
|
-
compileAsync(
|
|
5896
|
+
compileAsync($, j) {
|
|
5893
5897
|
if (typeof this.opts.loadSchema != "function")
|
|
5894
5898
|
throw new Error("options.loadSchema should be a function");
|
|
5895
5899
|
const { loadSchema: P } = this.opts;
|
|
5896
|
-
return a.call(this,
|
|
5900
|
+
return a.call(this, $, j);
|
|
5897
5901
|
async function a(G, ne) {
|
|
5898
5902
|
await h.call(this, G.$schema);
|
|
5899
5903
|
const he = this._addSchema(G, ne);
|
|
@@ -5908,14 +5912,14 @@ uri$1.default = uri;
|
|
|
5908
5912
|
} catch (ne) {
|
|
5909
5913
|
if (!(ne instanceof s.default))
|
|
5910
5914
|
throw ne;
|
|
5911
|
-
return M.call(this, ne), await
|
|
5915
|
+
return M.call(this, ne), await L.call(this, ne.missingSchema), N.call(this, G);
|
|
5912
5916
|
}
|
|
5913
5917
|
}
|
|
5914
5918
|
function M({ missingSchema: G, missingRef: ne }) {
|
|
5915
5919
|
if (this.refs[G])
|
|
5916
5920
|
throw new Error(`AnySchema ${G} is loaded but ${ne} cannot be resolved`);
|
|
5917
5921
|
}
|
|
5918
|
-
async function
|
|
5922
|
+
async function L(G) {
|
|
5919
5923
|
const ne = await W.call(this, G);
|
|
5920
5924
|
this.refs[G] || await h.call(this, ne.$schema), this.refs[G] || this.addSchema(ne, G, j);
|
|
5921
5925
|
}
|
|
@@ -5931,35 +5935,35 @@ uri$1.default = uri;
|
|
|
5931
5935
|
}
|
|
5932
5936
|
}
|
|
5933
5937
|
// Adds schema to the instance
|
|
5934
|
-
addSchema(
|
|
5935
|
-
if (Array.isArray(
|
|
5936
|
-
for (const N of
|
|
5938
|
+
addSchema($, j, P, a = this.opts.validateSchema) {
|
|
5939
|
+
if (Array.isArray($)) {
|
|
5940
|
+
for (const N of $)
|
|
5937
5941
|
this.addSchema(N, void 0, P, a);
|
|
5938
5942
|
return this;
|
|
5939
5943
|
}
|
|
5940
5944
|
let h;
|
|
5941
|
-
if (typeof
|
|
5945
|
+
if (typeof $ == "object") {
|
|
5942
5946
|
const { schemaId: N } = this.opts;
|
|
5943
|
-
if (h =
|
|
5947
|
+
if (h = $[N], h !== void 0 && typeof h != "string")
|
|
5944
5948
|
throw new Error(`schema ${N} must be string`);
|
|
5945
5949
|
}
|
|
5946
|
-
return j = (0, d.normalizeId)(j || h), this._checkUnique(j), this.schemas[j] = this._addSchema(
|
|
5950
|
+
return j = (0, d.normalizeId)(j || h), this._checkUnique(j), this.schemas[j] = this._addSchema($, P, j, a, !0), this;
|
|
5947
5951
|
}
|
|
5948
5952
|
// Add schema that will be used to validate other schemas
|
|
5949
5953
|
// options in META_IGNORE_OPTIONS are alway set to false
|
|
5950
|
-
addMetaSchema(
|
|
5951
|
-
return this.addSchema(
|
|
5954
|
+
addMetaSchema($, j, P = this.opts.validateSchema) {
|
|
5955
|
+
return this.addSchema($, j, !0, P), this;
|
|
5952
5956
|
}
|
|
5953
5957
|
// Validate schema against its meta-schema
|
|
5954
|
-
validateSchema(
|
|
5955
|
-
if (typeof
|
|
5958
|
+
validateSchema($, j) {
|
|
5959
|
+
if (typeof $ == "boolean")
|
|
5956
5960
|
return !0;
|
|
5957
5961
|
let P;
|
|
5958
|
-
if (P =
|
|
5962
|
+
if (P = $.$schema, P !== void 0 && typeof P != "string")
|
|
5959
5963
|
throw new Error("$schema must be a string");
|
|
5960
5964
|
if (P = P || this.opts.defaultMeta || this.defaultMeta(), !P)
|
|
5961
5965
|
return this.logger.warn("meta-schema not available"), this.errors = null, !0;
|
|
5962
|
-
const a = this.validate(P,
|
|
5966
|
+
const a = this.validate(P, $);
|
|
5963
5967
|
if (!a && j) {
|
|
5964
5968
|
const h = "schema is invalid: " + this.errorsText();
|
|
5965
5969
|
if (this.opts.validateSchema === "log")
|
|
@@ -5971,15 +5975,15 @@ uri$1.default = uri;
|
|
|
5971
5975
|
}
|
|
5972
5976
|
// Get compiled schema by `key` or `ref`.
|
|
5973
5977
|
// (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id)
|
|
5974
|
-
getSchema(
|
|
5978
|
+
getSchema($) {
|
|
5975
5979
|
let j;
|
|
5976
|
-
for (; typeof (j = w.call(this,
|
|
5977
|
-
|
|
5980
|
+
for (; typeof (j = w.call(this, $)) == "string"; )
|
|
5981
|
+
$ = j;
|
|
5978
5982
|
if (j === void 0) {
|
|
5979
5983
|
const { schemaId: P } = this.opts, a = new o.SchemaEnv({ schema: {}, schemaId: P });
|
|
5980
|
-
if (j = o.resolveSchema.call(this, a,
|
|
5984
|
+
if (j = o.resolveSchema.call(this, a, $), !j)
|
|
5981
5985
|
return;
|
|
5982
|
-
this.refs[
|
|
5986
|
+
this.refs[$] = j;
|
|
5983
5987
|
}
|
|
5984
5988
|
return j.validate || this._compileSchemaEnv(j);
|
|
5985
5989
|
}
|
|
@@ -5987,20 +5991,20 @@ uri$1.default = uri;
|
|
|
5987
5991
|
// If no parameter is passed all schemas but meta-schemas are removed.
|
|
5988
5992
|
// If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
|
|
5989
5993
|
// Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
|
|
5990
|
-
removeSchema(
|
|
5991
|
-
if (
|
|
5992
|
-
return this._removeAllSchemas(this.schemas,
|
|
5993
|
-
switch (typeof
|
|
5994
|
+
removeSchema($) {
|
|
5995
|
+
if ($ instanceof RegExp)
|
|
5996
|
+
return this._removeAllSchemas(this.schemas, $), this._removeAllSchemas(this.refs, $), this;
|
|
5997
|
+
switch (typeof $) {
|
|
5994
5998
|
case "undefined":
|
|
5995
5999
|
return this._removeAllSchemas(this.schemas), this._removeAllSchemas(this.refs), this._cache.clear(), this;
|
|
5996
6000
|
case "string": {
|
|
5997
|
-
const j = w.call(this,
|
|
5998
|
-
return typeof j == "object" && this._cache.delete(j.schema), delete this.schemas[
|
|
6001
|
+
const j = w.call(this, $);
|
|
6002
|
+
return typeof j == "object" && this._cache.delete(j.schema), delete this.schemas[$], delete this.refs[$], this;
|
|
5999
6003
|
}
|
|
6000
6004
|
case "object": {
|
|
6001
|
-
const j =
|
|
6005
|
+
const j = $;
|
|
6002
6006
|
this._cache.delete(j);
|
|
6003
|
-
let P =
|
|
6007
|
+
let P = $[this.opts.schemaId];
|
|
6004
6008
|
return P && (P = (0, d.normalizeId)(P), delete this.schemas[P], delete this.refs[P]), this;
|
|
6005
6009
|
}
|
|
6006
6010
|
default:
|
|
@@ -6008,23 +6012,23 @@ uri$1.default = uri;
|
|
|
6008
6012
|
}
|
|
6009
6013
|
}
|
|
6010
6014
|
// add "vocabulary" - a collection of keywords
|
|
6011
|
-
addVocabulary(
|
|
6012
|
-
for (const j of
|
|
6015
|
+
addVocabulary($) {
|
|
6016
|
+
for (const j of $)
|
|
6013
6017
|
this.addKeyword(j);
|
|
6014
6018
|
return this;
|
|
6015
6019
|
}
|
|
6016
|
-
addKeyword(
|
|
6020
|
+
addKeyword($, j) {
|
|
6017
6021
|
let P;
|
|
6018
|
-
if (typeof
|
|
6019
|
-
P =
|
|
6020
|
-
else if (typeof
|
|
6021
|
-
if (j =
|
|
6022
|
+
if (typeof $ == "string")
|
|
6023
|
+
P = $, typeof j == "object" && (this.logger.warn("these parameters are deprecated, see docs for addKeyword"), j.keyword = P);
|
|
6024
|
+
else if (typeof $ == "object" && j === void 0) {
|
|
6025
|
+
if (j = $, P = j.keyword, Array.isArray(P) && !P.length)
|
|
6022
6026
|
throw new Error("addKeywords: keyword must be string or non-empty array");
|
|
6023
6027
|
} else
|
|
6024
6028
|
throw new Error("invalid addKeywords parameters");
|
|
6025
6029
|
if (oe.call(this, P, j), !j)
|
|
6026
6030
|
return (0, p.eachItem)(P, (h) => ke.call(this, h)), this;
|
|
6027
|
-
|
|
6031
|
+
Le.call(this, j);
|
|
6028
6032
|
const a = {
|
|
6029
6033
|
...j,
|
|
6030
6034
|
type: (0, u.getJSONTypes)(j.type),
|
|
@@ -6032,93 +6036,93 @@ uri$1.default = uri;
|
|
|
6032
6036
|
};
|
|
6033
6037
|
return (0, p.eachItem)(P, a.type.length === 0 ? (h) => ke.call(this, h, a) : (h) => a.type.forEach((N) => ke.call(this, h, a, N))), this;
|
|
6034
6038
|
}
|
|
6035
|
-
getKeyword(
|
|
6036
|
-
const j = this.RULES.all[
|
|
6039
|
+
getKeyword($) {
|
|
6040
|
+
const j = this.RULES.all[$];
|
|
6037
6041
|
return typeof j == "object" ? j.definition : !!j;
|
|
6038
6042
|
}
|
|
6039
6043
|
// Remove keyword
|
|
6040
|
-
removeKeyword(
|
|
6044
|
+
removeKeyword($) {
|
|
6041
6045
|
const { RULES: j } = this;
|
|
6042
|
-
delete j.keywords[
|
|
6046
|
+
delete j.keywords[$], delete j.all[$];
|
|
6043
6047
|
for (const P of j.rules) {
|
|
6044
|
-
const a = P.rules.findIndex((h) => h.keyword ===
|
|
6048
|
+
const a = P.rules.findIndex((h) => h.keyword === $);
|
|
6045
6049
|
a >= 0 && P.rules.splice(a, 1);
|
|
6046
6050
|
}
|
|
6047
6051
|
return this;
|
|
6048
6052
|
}
|
|
6049
6053
|
// Add format
|
|
6050
|
-
addFormat(
|
|
6051
|
-
return typeof j == "string" && (j = new RegExp(j)), this.formats[
|
|
6054
|
+
addFormat($, j) {
|
|
6055
|
+
return typeof j == "string" && (j = new RegExp(j)), this.formats[$] = j, this;
|
|
6052
6056
|
}
|
|
6053
|
-
errorsText(
|
|
6054
|
-
return
|
|
6057
|
+
errorsText($ = this.errors, { separator: j = ", ", dataVar: P = "data" } = {}) {
|
|
6058
|
+
return !$ || $.length === 0 ? "No errors" : $.map((a) => `${P}${a.instancePath} ${a.message}`).reduce((a, h) => a + j + h);
|
|
6055
6059
|
}
|
|
6056
|
-
$dataMetaSchema(
|
|
6060
|
+
$dataMetaSchema($, j) {
|
|
6057
6061
|
const P = this.RULES.all;
|
|
6058
|
-
|
|
6062
|
+
$ = JSON.parse(JSON.stringify($));
|
|
6059
6063
|
for (const a of j) {
|
|
6060
6064
|
const h = a.split("/").slice(1);
|
|
6061
|
-
let N =
|
|
6065
|
+
let N = $;
|
|
6062
6066
|
for (const M of h)
|
|
6063
6067
|
N = N[M];
|
|
6064
6068
|
for (const M in P) {
|
|
6065
|
-
const
|
|
6066
|
-
if (typeof
|
|
6069
|
+
const L = P[M];
|
|
6070
|
+
if (typeof L != "object")
|
|
6067
6071
|
continue;
|
|
6068
|
-
const { $data: W } =
|
|
6069
|
-
W && G && (N[M] =
|
|
6072
|
+
const { $data: W } = L.definition, G = N[M];
|
|
6073
|
+
W && G && (N[M] = qe(G));
|
|
6070
6074
|
}
|
|
6071
6075
|
}
|
|
6072
|
-
return
|
|
6076
|
+
return $;
|
|
6073
6077
|
}
|
|
6074
|
-
_removeAllSchemas(
|
|
6075
|
-
for (const P in
|
|
6076
|
-
const a =
|
|
6077
|
-
(!j || j.test(P)) && (typeof a == "string" ? delete
|
|
6078
|
+
_removeAllSchemas($, j) {
|
|
6079
|
+
for (const P in $) {
|
|
6080
|
+
const a = $[P];
|
|
6081
|
+
(!j || j.test(P)) && (typeof a == "string" ? delete $[P] : a && !a.meta && (this._cache.delete(a.schema), delete $[P]));
|
|
6078
6082
|
}
|
|
6079
6083
|
}
|
|
6080
|
-
_addSchema(
|
|
6084
|
+
_addSchema($, j, P, a = this.opts.validateSchema, h = this.opts.addUsedSchema) {
|
|
6081
6085
|
let N;
|
|
6082
6086
|
const { schemaId: M } = this.opts;
|
|
6083
|
-
if (typeof
|
|
6084
|
-
N =
|
|
6087
|
+
if (typeof $ == "object")
|
|
6088
|
+
N = $[M];
|
|
6085
6089
|
else {
|
|
6086
6090
|
if (this.opts.jtd)
|
|
6087
6091
|
throw new Error("schema must be object");
|
|
6088
|
-
if (typeof
|
|
6092
|
+
if (typeof $ != "boolean")
|
|
6089
6093
|
throw new Error("schema must be object or boolean");
|
|
6090
6094
|
}
|
|
6091
|
-
let
|
|
6092
|
-
if (
|
|
6093
|
-
return
|
|
6095
|
+
let L = this._cache.get($);
|
|
6096
|
+
if (L !== void 0)
|
|
6097
|
+
return L;
|
|
6094
6098
|
P = (0, d.normalizeId)(N || P);
|
|
6095
|
-
const W = d.getSchemaRefs.call(this,
|
|
6096
|
-
return
|
|
6099
|
+
const W = d.getSchemaRefs.call(this, $, P);
|
|
6100
|
+
return L = new o.SchemaEnv({ schema: $, schemaId: M, meta: j, baseId: P, localRefs: W }), this._cache.set(L.schema, L), h && !P.startsWith("#") && (P && this._checkUnique(P), this.refs[P] = L), a && this.validateSchema($, !0), L;
|
|
6097
6101
|
}
|
|
6098
|
-
_checkUnique(
|
|
6099
|
-
if (this.schemas[
|
|
6100
|
-
throw new Error(`schema with key or id "${
|
|
6102
|
+
_checkUnique($) {
|
|
6103
|
+
if (this.schemas[$] || this.refs[$])
|
|
6104
|
+
throw new Error(`schema with key or id "${$}" already exists`);
|
|
6101
6105
|
}
|
|
6102
|
-
_compileSchemaEnv(
|
|
6103
|
-
if (
|
|
6106
|
+
_compileSchemaEnv($) {
|
|
6107
|
+
if ($.meta ? this._compileMetaSchema($) : o.compileSchema.call(this, $), !$.validate)
|
|
6104
6108
|
throw new Error("ajv implementation error");
|
|
6105
|
-
return
|
|
6109
|
+
return $.validate;
|
|
6106
6110
|
}
|
|
6107
|
-
_compileMetaSchema(
|
|
6111
|
+
_compileMetaSchema($) {
|
|
6108
6112
|
const j = this.opts;
|
|
6109
6113
|
this.opts = this._metaOpts;
|
|
6110
6114
|
try {
|
|
6111
|
-
o.compileSchema.call(this,
|
|
6115
|
+
o.compileSchema.call(this, $);
|
|
6112
6116
|
} finally {
|
|
6113
6117
|
this.opts = j;
|
|
6114
6118
|
}
|
|
6115
6119
|
}
|
|
6116
6120
|
}
|
|
6117
6121
|
e.default = I, I.ValidationError = n.default, I.MissingRefError = s.default;
|
|
6118
|
-
function D(F,
|
|
6122
|
+
function D(F, $, j, P = "error") {
|
|
6119
6123
|
for (const a in F) {
|
|
6120
6124
|
const h = a;
|
|
6121
|
-
h in
|
|
6125
|
+
h in $ && this.logger[P](`${j}: option ${a}. ${F[h]}`);
|
|
6122
6126
|
}
|
|
6123
6127
|
}
|
|
6124
6128
|
function w(F) {
|
|
@@ -6130,13 +6134,13 @@ uri$1.default = uri;
|
|
|
6130
6134
|
if (Array.isArray(F))
|
|
6131
6135
|
this.addSchema(F);
|
|
6132
6136
|
else
|
|
6133
|
-
for (const
|
|
6134
|
-
this.addSchema(F[
|
|
6137
|
+
for (const $ in F)
|
|
6138
|
+
this.addSchema(F[$], $);
|
|
6135
6139
|
}
|
|
6136
6140
|
function A() {
|
|
6137
6141
|
for (const F in this.opts.formats) {
|
|
6138
|
-
const
|
|
6139
|
-
|
|
6142
|
+
const $ = this.opts.formats[F];
|
|
6143
|
+
$ && this.addFormat(F, $);
|
|
6140
6144
|
}
|
|
6141
6145
|
}
|
|
6142
6146
|
function V(F) {
|
|
@@ -6145,15 +6149,15 @@ uri$1.default = uri;
|
|
|
6145
6149
|
return;
|
|
6146
6150
|
}
|
|
6147
6151
|
this.logger.warn("keywords option as map is deprecated, pass array");
|
|
6148
|
-
for (const
|
|
6149
|
-
const j = F[
|
|
6150
|
-
j.keyword || (j.keyword =
|
|
6152
|
+
for (const $ in F) {
|
|
6153
|
+
const j = F[$];
|
|
6154
|
+
j.keyword || (j.keyword = $), this.addKeyword(j);
|
|
6151
6155
|
}
|
|
6152
6156
|
}
|
|
6153
6157
|
function z() {
|
|
6154
6158
|
const F = { ...this.opts };
|
|
6155
|
-
for (const
|
|
6156
|
-
delete F[
|
|
6159
|
+
for (const $ of T)
|
|
6160
|
+
delete F[$];
|
|
6157
6161
|
return F;
|
|
6158
6162
|
}
|
|
6159
6163
|
const re = { log() {
|
|
@@ -6170,47 +6174,47 @@ uri$1.default = uri;
|
|
|
6170
6174
|
throw new Error("logger must implement log, warn and error methods");
|
|
6171
6175
|
}
|
|
6172
6176
|
const ue = /^[a-z_$][a-z0-9_$:-]*$/i;
|
|
6173
|
-
function oe(F,
|
|
6177
|
+
function oe(F, $) {
|
|
6174
6178
|
const { RULES: j } = this;
|
|
6175
6179
|
if ((0, p.eachItem)(F, (P) => {
|
|
6176
6180
|
if (j.keywords[P])
|
|
6177
6181
|
throw new Error(`Keyword ${P} is already defined`);
|
|
6178
6182
|
if (!ue.test(P))
|
|
6179
6183
|
throw new Error(`Keyword ${P} has invalid name`);
|
|
6180
|
-
}),
|
|
6184
|
+
}), !!$ && $.$data && !("code" in $ || "validate" in $))
|
|
6181
6185
|
throw new Error('$data keyword must have "code" or "validate" function');
|
|
6182
6186
|
}
|
|
6183
|
-
function ke(F,
|
|
6187
|
+
function ke(F, $, j) {
|
|
6184
6188
|
var P;
|
|
6185
|
-
const a =
|
|
6189
|
+
const a = $ == null ? void 0 : $.post;
|
|
6186
6190
|
if (j && a)
|
|
6187
6191
|
throw new Error('keyword with "post" flag cannot have "type"');
|
|
6188
6192
|
const { RULES: h } = this;
|
|
6189
|
-
let N = a ? h.post : h.rules.find(({ type:
|
|
6190
|
-
if (N || (N = { type: j, rules: [] }, h.rules.push(N)), h.keywords[F] = !0,
|
|
6193
|
+
let N = a ? h.post : h.rules.find(({ type: L }) => L === j);
|
|
6194
|
+
if (N || (N = { type: j, rules: [] }, h.rules.push(N)), h.keywords[F] = !0, !$)
|
|
6191
6195
|
return;
|
|
6192
6196
|
const M = {
|
|
6193
6197
|
keyword: F,
|
|
6194
6198
|
definition: {
|
|
6195
|
-
|
|
6196
|
-
type: (0, u.getJSONTypes)(
|
|
6197
|
-
schemaType: (0, u.getJSONTypes)(
|
|
6199
|
+
...$,
|
|
6200
|
+
type: (0, u.getJSONTypes)($.type),
|
|
6201
|
+
schemaType: (0, u.getJSONTypes)($.schemaType)
|
|
6198
6202
|
}
|
|
6199
6203
|
};
|
|
6200
|
-
|
|
6204
|
+
$.before ? Ce.call(this, N, M, $.before) : N.rules.push(M), h.all[F] = M, (P = $.implements) === null || P === void 0 || P.forEach((L) => this.addKeyword(L));
|
|
6201
6205
|
}
|
|
6202
|
-
function Ce(F,
|
|
6206
|
+
function Ce(F, $, j) {
|
|
6203
6207
|
const P = F.rules.findIndex((a) => a.keyword === j);
|
|
6204
|
-
P >= 0 ? F.rules.splice(P, 0,
|
|
6208
|
+
P >= 0 ? F.rules.splice(P, 0, $) : (F.rules.push($), this.logger.warn(`rule ${j} is not defined`));
|
|
6205
6209
|
}
|
|
6206
|
-
function
|
|
6207
|
-
let { metaSchema:
|
|
6208
|
-
|
|
6210
|
+
function Le(F) {
|
|
6211
|
+
let { metaSchema: $ } = F;
|
|
6212
|
+
$ !== void 0 && (F.$data && this.opts.$data && ($ = qe($)), F.validateSchema = this.compile($, !0));
|
|
6209
6213
|
}
|
|
6210
6214
|
const et = {
|
|
6211
6215
|
$ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"
|
|
6212
6216
|
};
|
|
6213
|
-
function
|
|
6217
|
+
function qe(F) {
|
|
6214
6218
|
return { anyOf: [F, et] };
|
|
6215
6219
|
}
|
|
6216
6220
|
})(core$2);
|
|
@@ -6232,14 +6236,14 @@ const ref_error_1 = ref_error, code_1$8 = code, codegen_1$l = codegen, names_1$1
|
|
|
6232
6236
|
code(e) {
|
|
6233
6237
|
const { gen: t, schema: r, it: n } = e, { baseId: s, schemaEnv: i, validateName: o, opts: c, self: d } = n, { root: u } = i;
|
|
6234
6238
|
if ((r === "#" || r === "#/") && s === u.baseId)
|
|
6235
|
-
return
|
|
6239
|
+
return g();
|
|
6236
6240
|
const p = compile_1$1.resolveRef.call(d, u, s, r);
|
|
6237
6241
|
if (p === void 0)
|
|
6238
6242
|
throw new ref_error_1.default(n.opts.uriResolver, s, r);
|
|
6239
6243
|
if (p instanceof compile_1$1.SchemaEnv)
|
|
6240
6244
|
return R(p);
|
|
6241
6245
|
return O(p);
|
|
6242
|
-
function
|
|
6246
|
+
function g() {
|
|
6243
6247
|
if (i === u)
|
|
6244
6248
|
return callRef(e, o, i, i.$async);
|
|
6245
6249
|
const T = t.scopeValue("root", { ref: u });
|
|
@@ -6250,14 +6254,14 @@ const ref_error_1 = ref_error, code_1$8 = code, codegen_1$l = codegen, names_1$1
|
|
|
6250
6254
|
callRef(e, v, T, T.$async);
|
|
6251
6255
|
}
|
|
6252
6256
|
function O(T) {
|
|
6253
|
-
const v = t.scopeValue("schema", c.code.source === !0 ? { ref: T, code: (0, codegen_1$l.stringify)(T) } : { ref: T }),
|
|
6257
|
+
const v = t.scopeValue("schema", c.code.source === !0 ? { ref: T, code: (0, codegen_1$l.stringify)(T) } : { ref: T }), y = t.name("valid"), m = e.subschema({
|
|
6254
6258
|
schema: T,
|
|
6255
6259
|
dataTypes: [],
|
|
6256
6260
|
schemaPath: codegen_1$l.nil,
|
|
6257
6261
|
topSchemaRef: v,
|
|
6258
6262
|
errSchemaPath: r
|
|
6259
|
-
},
|
|
6260
|
-
e.mergeEvaluated(m), e.ok(
|
|
6263
|
+
}, y);
|
|
6264
|
+
e.mergeEvaluated(m), e.ok(y);
|
|
6261
6265
|
}
|
|
6262
6266
|
}
|
|
6263
6267
|
};
|
|
@@ -6268,7 +6272,7 @@ function getValidate(e, t) {
|
|
|
6268
6272
|
ref.getValidate = getValidate;
|
|
6269
6273
|
function callRef(e, t, r, n) {
|
|
6270
6274
|
const { gen: s, it: i } = e, { allErrors: o, schemaEnv: c, opts: d } = i, u = d.passContext ? names_1$1.default.this : codegen_1$l.nil;
|
|
6271
|
-
n ? p() :
|
|
6275
|
+
n ? p() : g();
|
|
6272
6276
|
function p() {
|
|
6273
6277
|
if (!c.$async)
|
|
6274
6278
|
throw new Error("async schema referenced by sync schema");
|
|
@@ -6279,7 +6283,7 @@ function callRef(e, t, r, n) {
|
|
|
6279
6283
|
s.if((0, codegen_1$l._)`!(${v} instanceof ${i.ValidationError})`, () => s.throw(v)), R(v), o || s.assign(T, !1);
|
|
6280
6284
|
}), e.ok(T);
|
|
6281
6285
|
}
|
|
6282
|
-
function
|
|
6286
|
+
function g() {
|
|
6283
6287
|
e.result((0, code_1$8.callValidateCode)(e, t, u), () => O(t), () => R(t));
|
|
6284
6288
|
}
|
|
6285
6289
|
function R(T) {
|
|
@@ -6290,17 +6294,17 @@ function callRef(e, t, r, n) {
|
|
|
6290
6294
|
var v;
|
|
6291
6295
|
if (!i.opts.unevaluated)
|
|
6292
6296
|
return;
|
|
6293
|
-
const
|
|
6297
|
+
const y = (v = r == null ? void 0 : r.validate) === null || v === void 0 ? void 0 : v.evaluated;
|
|
6294
6298
|
if (i.props !== !0)
|
|
6295
|
-
if (
|
|
6296
|
-
|
|
6299
|
+
if (y && !y.dynamicProps)
|
|
6300
|
+
y.props !== void 0 && (i.props = util_1$j.mergeEvaluated.props(s, y.props, i.props));
|
|
6297
6301
|
else {
|
|
6298
6302
|
const m = s.var("props", (0, codegen_1$l._)`${T}.evaluated.props`);
|
|
6299
6303
|
i.props = util_1$j.mergeEvaluated.props(s, m, i.props, codegen_1$l.Name);
|
|
6300
6304
|
}
|
|
6301
6305
|
if (i.items !== !0)
|
|
6302
|
-
if (
|
|
6303
|
-
|
|
6306
|
+
if (y && !y.dynamicItems)
|
|
6307
|
+
y.items !== void 0 && (i.items = util_1$j.mergeEvaluated.items(s, y.items, i.items));
|
|
6304
6308
|
else {
|
|
6305
6309
|
const m = s.var("items", (0, codegen_1$l._)`${T}.evaluated.items`);
|
|
6306
6310
|
i.items = util_1$j.mergeEvaluated.items(s, m, i.items, codegen_1$l.Name);
|
|
@@ -6447,13 +6451,13 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6447
6451
|
const O = e.parentSchema.properties, { definedProperties: T } = e.it;
|
|
6448
6452
|
for (const v of r)
|
|
6449
6453
|
if ((O == null ? void 0 : O[v]) === void 0 && !T.has(v)) {
|
|
6450
|
-
const
|
|
6454
|
+
const y = o.schemaEnv.baseId + o.errSchemaPath, m = `required property "${v}" is not defined at "${y}" (strictRequired)`;
|
|
6451
6455
|
(0, util_1$h.checkStrictMode)(o, m, o.opts.strictRequired);
|
|
6452
6456
|
}
|
|
6453
6457
|
}
|
|
6454
6458
|
function u() {
|
|
6455
6459
|
if (d || i)
|
|
6456
|
-
e.block$data(codegen_1$f.nil,
|
|
6460
|
+
e.block$data(codegen_1$f.nil, g);
|
|
6457
6461
|
else
|
|
6458
6462
|
for (const O of r)
|
|
6459
6463
|
(0, code_1$6.checkReportMissingProp)(e, O);
|
|
@@ -6466,7 +6470,7 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6466
6470
|
} else
|
|
6467
6471
|
t.if((0, code_1$6.checkMissingProp)(e, r, O)), (0, code_1$6.reportMissingProp)(e, O), t.else();
|
|
6468
6472
|
}
|
|
6469
|
-
function
|
|
6473
|
+
function g() {
|
|
6470
6474
|
t.forOf("prop", n, (O) => {
|
|
6471
6475
|
e.setParams({ missingProperty: O }), t.if((0, code_1$6.noPropertyInData)(t, s, O, c.ownProperties), () => e.error());
|
|
6472
6476
|
});
|
|
@@ -6524,22 +6528,22 @@ const dataType_1 = dataType, codegen_1$d = codegen, util_1$g = util, equal_1$2 =
|
|
|
6524
6528
|
e.block$data(d, p, (0, codegen_1$d._)`${o} === false`), e.ok(d);
|
|
6525
6529
|
function p() {
|
|
6526
6530
|
const T = t.let("i", (0, codegen_1$d._)`${r}.length`), v = t.let("j");
|
|
6527
|
-
e.setParams({ i: T, j: v }), t.assign(d, !0), t.if((0, codegen_1$d._)`${T} > 1`, () => (
|
|
6531
|
+
e.setParams({ i: T, j: v }), t.assign(d, !0), t.if((0, codegen_1$d._)`${T} > 1`, () => (g() ? R : O)(T, v));
|
|
6528
6532
|
}
|
|
6529
|
-
function
|
|
6533
|
+
function g() {
|
|
6530
6534
|
return u.length > 0 && !u.some((T) => T === "object" || T === "array");
|
|
6531
6535
|
}
|
|
6532
6536
|
function R(T, v) {
|
|
6533
|
-
const
|
|
6537
|
+
const y = t.name("item"), m = (0, dataType_1.checkDataTypes)(u, y, c.opts.strictNumbers, dataType_1.DataType.Wrong), k = t.const("indices", (0, codegen_1$d._)`{}`);
|
|
6534
6538
|
t.for((0, codegen_1$d._)`;${T}--;`, () => {
|
|
6535
|
-
t.let(
|
|
6536
|
-
t.assign(v, (0, codegen_1$d._)`${k}[${
|
|
6537
|
-
}).code((0, codegen_1$d._)`${k}[${
|
|
6539
|
+
t.let(y, (0, codegen_1$d._)`${r}[${T}]`), t.if(m, (0, codegen_1$d._)`continue`), u.length > 1 && t.if((0, codegen_1$d._)`typeof ${y} == "string"`, (0, codegen_1$d._)`${y} += "_"`), t.if((0, codegen_1$d._)`typeof ${k}[${y}] == "number"`, () => {
|
|
6540
|
+
t.assign(v, (0, codegen_1$d._)`${k}[${y}]`), e.error(), t.assign(d, !1).break();
|
|
6541
|
+
}).code((0, codegen_1$d._)`${k}[${y}] = ${T}`);
|
|
6538
6542
|
});
|
|
6539
6543
|
}
|
|
6540
6544
|
function O(T, v) {
|
|
6541
|
-
const
|
|
6542
|
-
t.label(m).for((0, codegen_1$d._)`;${T}--;`, () => t.for((0, codegen_1$d._)`${v} = ${T}; ${v}--;`, () => t.if((0, codegen_1$d._)`${
|
|
6545
|
+
const y = (0, util_1$g.useFunc)(t, equal_1$2.default), m = t.name("outer");
|
|
6546
|
+
t.label(m).for((0, codegen_1$d._)`;${T}--;`, () => t.for((0, codegen_1$d._)`${v} = ${T}; ${v}--;`, () => t.if((0, codegen_1$d._)`${y}(${r}[${T}], ${r}[${v}])`, () => {
|
|
6543
6547
|
e.error(), t.assign(d, !1).break(m);
|
|
6544
6548
|
})));
|
|
6545
6549
|
}
|
|
@@ -6580,7 +6584,7 @@ const codegen_1$b = codegen, util_1$e = util, equal_1 = equal$1, error$9 = {
|
|
|
6580
6584
|
const u = () => d ?? (d = (0, util_1$e.useFunc)(t, equal_1.default));
|
|
6581
6585
|
let p;
|
|
6582
6586
|
if (c || n)
|
|
6583
|
-
p = t.let("valid"), e.block$data(p,
|
|
6587
|
+
p = t.let("valid"), e.block$data(p, g);
|
|
6584
6588
|
else {
|
|
6585
6589
|
if (!Array.isArray(s))
|
|
6586
6590
|
throw new Error("ajv implementation error");
|
|
@@ -6588,7 +6592,7 @@ const codegen_1$b = codegen, util_1$e = util, equal_1 = equal$1, error$9 = {
|
|
|
6588
6592
|
p = (0, codegen_1$b.or)(...s.map((T, v) => R(O, v)));
|
|
6589
6593
|
}
|
|
6590
6594
|
e.pass(p);
|
|
6591
|
-
function
|
|
6595
|
+
function g() {
|
|
6592
6596
|
t.assign(p, !1), t.forOf("v", i, (O) => t.if((0, codegen_1$b._)`${u()}(${r}, ${O})`, () => t.assign(p, !0).break()));
|
|
6593
6597
|
}
|
|
6594
6598
|
function R(O, T) {
|
|
@@ -6677,18 +6681,18 @@ function validateTuple(e, t, r = e.schema) {
|
|
|
6677
6681
|
const { gen: n, parentSchema: s, data: i, keyword: o, it: c } = e;
|
|
6678
6682
|
p(s), c.opts.unevaluated && r.length && c.items !== !0 && (c.items = util_1$c.mergeEvaluated.items(n, r.length, c.items));
|
|
6679
6683
|
const d = n.name("valid"), u = n.const("len", (0, codegen_1$9._)`${i}.length`);
|
|
6680
|
-
r.forEach((
|
|
6681
|
-
(0, util_1$c.alwaysValidSchema)(c,
|
|
6684
|
+
r.forEach((g, R) => {
|
|
6685
|
+
(0, util_1$c.alwaysValidSchema)(c, g) || (n.if((0, codegen_1$9._)`${u} > ${R}`, () => e.subschema({
|
|
6682
6686
|
keyword: o,
|
|
6683
6687
|
schemaProp: R,
|
|
6684
6688
|
dataProp: R
|
|
6685
6689
|
}, d)), e.ok(d));
|
|
6686
6690
|
});
|
|
6687
|
-
function p(
|
|
6688
|
-
const { opts: R, errSchemaPath: O } = c, T = r.length, v = T ===
|
|
6691
|
+
function p(g) {
|
|
6692
|
+
const { opts: R, errSchemaPath: O } = c, T = r.length, v = T === g.minItems && (T === g.maxItems || g[t] === !1);
|
|
6689
6693
|
if (R.strictTuples && !v) {
|
|
6690
|
-
const
|
|
6691
|
-
(0, util_1$c.checkStrictMode)(c,
|
|
6694
|
+
const y = `"${o}" is ${T}-tuple, but minItems or maxItems/${t} are not specified or different at path "${O}"`;
|
|
6695
|
+
(0, util_1$c.checkStrictMode)(c, y, R.strictTuples);
|
|
6692
6696
|
}
|
|
6693
6697
|
}
|
|
6694
6698
|
}
|
|
@@ -6752,24 +6756,24 @@ const codegen_1$7 = codegen, util_1$a = util, error$6 = {
|
|
|
6752
6756
|
return;
|
|
6753
6757
|
}
|
|
6754
6758
|
i.items = !0;
|
|
6755
|
-
const
|
|
6756
|
-
c === void 0 && o === 1 ? O(
|
|
6759
|
+
const g = t.name("valid");
|
|
6760
|
+
c === void 0 && o === 1 ? O(g, () => t.if(g, () => t.break())) : o === 0 ? (t.let(g, !0), c !== void 0 && t.if((0, codegen_1$7._)`${s}.length > 0`, R)) : (t.let(g, !1), R()), e.result(g, () => e.reset());
|
|
6757
6761
|
function R() {
|
|
6758
|
-
const v = t.name("_valid"),
|
|
6759
|
-
O(v, () => t.if(v, () => T(
|
|
6762
|
+
const v = t.name("_valid"), y = t.let("count", 0);
|
|
6763
|
+
O(v, () => t.if(v, () => T(y)));
|
|
6760
6764
|
}
|
|
6761
|
-
function O(v,
|
|
6765
|
+
function O(v, y) {
|
|
6762
6766
|
t.forRange("i", 0, p, (m) => {
|
|
6763
6767
|
e.subschema({
|
|
6764
6768
|
keyword: "contains",
|
|
6765
6769
|
dataProp: m,
|
|
6766
6770
|
dataPropType: util_1$a.Type.Num,
|
|
6767
6771
|
compositeRule: !0
|
|
6768
|
-
}, v),
|
|
6772
|
+
}, v), y();
|
|
6769
6773
|
});
|
|
6770
6774
|
}
|
|
6771
6775
|
function T(v) {
|
|
6772
|
-
t.code((0, codegen_1$7._)`${v}++`), c === void 0 ? t.if((0, codegen_1$7._)`${v} >= ${o}`, () => t.assign(
|
|
6776
|
+
t.code((0, codegen_1$7._)`${v}++`), c === void 0 ? t.if((0, codegen_1$7._)`${v} >= ${o}`, () => t.assign(g, !0).break()) : (t.if((0, codegen_1$7._)`${v} > ${c}`, () => t.assign(g, !1).break()), o === 1 ? t.assign(g, !0) : t.if((0, codegen_1$7._)`${v} >= ${o}`, () => t.assign(g, !0)));
|
|
6773
6777
|
}
|
|
6774
6778
|
}
|
|
6775
6779
|
};
|
|
@@ -6780,11 +6784,11 @@ var dependencies = {};
|
|
|
6780
6784
|
const t = codegen, r = util, n = code;
|
|
6781
6785
|
e.error = {
|
|
6782
6786
|
message: ({ params: { property: d, depsCount: u, deps: p } }) => {
|
|
6783
|
-
const
|
|
6784
|
-
return (0, t.str)`must have ${
|
|
6787
|
+
const g = u === 1 ? "property" : "properties";
|
|
6788
|
+
return (0, t.str)`must have ${g} ${p} when property ${d} is present`;
|
|
6785
6789
|
},
|
|
6786
|
-
params: ({ params: { property: d, depsCount: u, deps: p, missingProperty:
|
|
6787
|
-
missingProperty: ${
|
|
6790
|
+
params: ({ params: { property: d, depsCount: u, deps: p, missingProperty: g } }) => (0, t._)`{property: ${d},
|
|
6791
|
+
missingProperty: ${g},
|
|
6788
6792
|
depsCount: ${u},
|
|
6789
6793
|
deps: ${p}}`
|
|
6790
6794
|
// TODO change to reference
|
|
@@ -6801,16 +6805,16 @@ var dependencies = {};
|
|
|
6801
6805
|
};
|
|
6802
6806
|
function i({ schema: d }) {
|
|
6803
6807
|
const u = {}, p = {};
|
|
6804
|
-
for (const
|
|
6805
|
-
if (
|
|
6808
|
+
for (const g in d) {
|
|
6809
|
+
if (g === "__proto__")
|
|
6806
6810
|
continue;
|
|
6807
|
-
const R = Array.isArray(d[
|
|
6808
|
-
R[
|
|
6811
|
+
const R = Array.isArray(d[g]) ? u : p;
|
|
6812
|
+
R[g] = d[g];
|
|
6809
6813
|
}
|
|
6810
6814
|
return [u, p];
|
|
6811
6815
|
}
|
|
6812
6816
|
function o(d, u = d.schema) {
|
|
6813
|
-
const { gen: p, data:
|
|
6817
|
+
const { gen: p, data: g, it: R } = d;
|
|
6814
6818
|
if (Object.keys(u).length === 0)
|
|
6815
6819
|
return;
|
|
6816
6820
|
const O = p.let("missing");
|
|
@@ -6818,26 +6822,26 @@ var dependencies = {};
|
|
|
6818
6822
|
const v = u[T];
|
|
6819
6823
|
if (v.length === 0)
|
|
6820
6824
|
continue;
|
|
6821
|
-
const
|
|
6825
|
+
const y = (0, n.propertyInData)(p, g, T, R.opts.ownProperties);
|
|
6822
6826
|
d.setParams({
|
|
6823
6827
|
property: T,
|
|
6824
6828
|
depsCount: v.length,
|
|
6825
6829
|
deps: v.join(", ")
|
|
6826
|
-
}), R.allErrors ? p.if(
|
|
6830
|
+
}), R.allErrors ? p.if(y, () => {
|
|
6827
6831
|
for (const m of v)
|
|
6828
6832
|
(0, n.checkReportMissingProp)(d, m);
|
|
6829
|
-
}) : (p.if((0, t._)`${
|
|
6833
|
+
}) : (p.if((0, t._)`${y} && (${(0, n.checkMissingProp)(d, v, O)})`), (0, n.reportMissingProp)(d, O), p.else());
|
|
6830
6834
|
}
|
|
6831
6835
|
}
|
|
6832
6836
|
e.validatePropertyDeps = o;
|
|
6833
6837
|
function c(d, u = d.schema) {
|
|
6834
|
-
const { gen: p, data:
|
|
6838
|
+
const { gen: p, data: g, keyword: R, it: O } = d, T = p.name("valid");
|
|
6835
6839
|
for (const v in u)
|
|
6836
6840
|
(0, r.alwaysValidSchema)(O, u[v]) || (p.if(
|
|
6837
|
-
(0, n.propertyInData)(p,
|
|
6841
|
+
(0, n.propertyInData)(p, g, v, O.opts.ownProperties),
|
|
6838
6842
|
() => {
|
|
6839
|
-
const
|
|
6840
|
-
d.mergeValidEvaluated(
|
|
6843
|
+
const y = d.subschema({ keyword: R, schemaProp: v }, T);
|
|
6844
|
+
d.mergeValidEvaluated(y, T);
|
|
6841
6845
|
},
|
|
6842
6846
|
() => p.var(T, !0)
|
|
6843
6847
|
// TODO var
|
|
@@ -6894,44 +6898,44 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
6894
6898
|
if (o.props = !0, d.removeAdditional !== "all" && (0, util_1$8.alwaysValidSchema)(o, r))
|
|
6895
6899
|
return;
|
|
6896
6900
|
const u = (0, code_1$3.allSchemaProperties)(n.properties), p = (0, code_1$3.allSchemaProperties)(n.patternProperties);
|
|
6897
|
-
|
|
6898
|
-
function
|
|
6899
|
-
t.forIn("key", s, (
|
|
6900
|
-
!u.length && !p.length ? T(
|
|
6901
|
+
g(), e.ok((0, codegen_1$5._)`${i} === ${names_1.default.errors}`);
|
|
6902
|
+
function g() {
|
|
6903
|
+
t.forIn("key", s, (y) => {
|
|
6904
|
+
!u.length && !p.length ? T(y) : t.if(R(y), () => T(y));
|
|
6901
6905
|
});
|
|
6902
6906
|
}
|
|
6903
|
-
function R(
|
|
6907
|
+
function R(y) {
|
|
6904
6908
|
let m;
|
|
6905
6909
|
if (u.length > 8) {
|
|
6906
6910
|
const k = (0, util_1$8.schemaRefOrVal)(o, n.properties, "properties");
|
|
6907
|
-
m = (0, code_1$3.isOwnProperty)(t, k,
|
|
6911
|
+
m = (0, code_1$3.isOwnProperty)(t, k, y);
|
|
6908
6912
|
} else
|
|
6909
|
-
u.length ? m = (0, codegen_1$5.or)(...u.map((k) => (0, codegen_1$5._)`${
|
|
6910
|
-
return p.length && (m = (0, codegen_1$5.or)(m, ...p.map((k) => (0, codegen_1$5._)`${(0, code_1$3.usePattern)(e, k)}.test(${
|
|
6913
|
+
u.length ? m = (0, codegen_1$5.or)(...u.map((k) => (0, codegen_1$5._)`${y} === ${k}`)) : m = codegen_1$5.nil;
|
|
6914
|
+
return p.length && (m = (0, codegen_1$5.or)(m, ...p.map((k) => (0, codegen_1$5._)`${(0, code_1$3.usePattern)(e, k)}.test(${y})`))), (0, codegen_1$5.not)(m);
|
|
6911
6915
|
}
|
|
6912
|
-
function O(
|
|
6913
|
-
t.code((0, codegen_1$5._)`delete ${s}[${
|
|
6916
|
+
function O(y) {
|
|
6917
|
+
t.code((0, codegen_1$5._)`delete ${s}[${y}]`);
|
|
6914
6918
|
}
|
|
6915
|
-
function T(
|
|
6919
|
+
function T(y) {
|
|
6916
6920
|
if (d.removeAdditional === "all" || d.removeAdditional && r === !1) {
|
|
6917
|
-
O(
|
|
6921
|
+
O(y);
|
|
6918
6922
|
return;
|
|
6919
6923
|
}
|
|
6920
6924
|
if (r === !1) {
|
|
6921
|
-
e.setParams({ additionalProperty:
|
|
6925
|
+
e.setParams({ additionalProperty: y }), e.error(), c || t.break();
|
|
6922
6926
|
return;
|
|
6923
6927
|
}
|
|
6924
6928
|
if (typeof r == "object" && !(0, util_1$8.alwaysValidSchema)(o, r)) {
|
|
6925
6929
|
const m = t.name("valid");
|
|
6926
|
-
d.removeAdditional === "failing" ? (v(
|
|
6927
|
-
e.reset(), O(
|
|
6928
|
-
})) : (v(
|
|
6930
|
+
d.removeAdditional === "failing" ? (v(y, m, !1), t.if((0, codegen_1$5.not)(m), () => {
|
|
6931
|
+
e.reset(), O(y);
|
|
6932
|
+
})) : (v(y, m), c || t.if((0, codegen_1$5.not)(m), () => t.break()));
|
|
6929
6933
|
}
|
|
6930
6934
|
}
|
|
6931
|
-
function v(
|
|
6935
|
+
function v(y, m, k) {
|
|
6932
6936
|
const S = {
|
|
6933
6937
|
keyword: "additionalProperties",
|
|
6934
|
-
dataProp:
|
|
6938
|
+
dataProp: y,
|
|
6935
6939
|
dataPropType: util_1$8.Type.Str
|
|
6936
6940
|
};
|
|
6937
6941
|
k === !1 && Object.assign(S, {
|
|
@@ -6953,23 +6957,23 @@ const validate_1 = validate, code_1$2 = code, util_1$7 = util, additionalPropert
|
|
|
6953
6957
|
const { gen: t, schema: r, parentSchema: n, data: s, it: i } = e;
|
|
6954
6958
|
i.opts.removeAdditional === "all" && n.additionalProperties === void 0 && additionalProperties_1$1.default.code(new validate_1.KeywordCxt(i, additionalProperties_1$1.default, "additionalProperties"));
|
|
6955
6959
|
const o = (0, code_1$2.allSchemaProperties)(r);
|
|
6956
|
-
for (const
|
|
6957
|
-
i.definedProperties.add(
|
|
6960
|
+
for (const g of o)
|
|
6961
|
+
i.definedProperties.add(g);
|
|
6958
6962
|
i.opts.unevaluated && o.length && i.props !== !0 && (i.props = util_1$7.mergeEvaluated.props(t, (0, util_1$7.toHash)(o), i.props));
|
|
6959
|
-
const c = o.filter((
|
|
6963
|
+
const c = o.filter((g) => !(0, util_1$7.alwaysValidSchema)(i, r[g]));
|
|
6960
6964
|
if (c.length === 0)
|
|
6961
6965
|
return;
|
|
6962
6966
|
const d = t.name("valid");
|
|
6963
|
-
for (const
|
|
6964
|
-
u(
|
|
6965
|
-
function u(
|
|
6966
|
-
return i.opts.useDefaults && !i.compositeRule && r[
|
|
6967
|
+
for (const g of c)
|
|
6968
|
+
u(g) ? p(g) : (t.if((0, code_1$2.propertyInData)(t, s, g, i.opts.ownProperties)), p(g), i.allErrors || t.else().var(d, !0), t.endIf()), e.it.definedProperties.add(g), e.ok(d);
|
|
6969
|
+
function u(g) {
|
|
6970
|
+
return i.opts.useDefaults && !i.compositeRule && r[g].default !== void 0;
|
|
6967
6971
|
}
|
|
6968
|
-
function p(
|
|
6972
|
+
function p(g) {
|
|
6969
6973
|
e.subschema({
|
|
6970
6974
|
keyword: "properties",
|
|
6971
|
-
schemaProp:
|
|
6972
|
-
dataProp:
|
|
6975
|
+
schemaProp: g,
|
|
6976
|
+
dataProp: g
|
|
6973
6977
|
}, d);
|
|
6974
6978
|
}
|
|
6975
6979
|
}
|
|
@@ -6987,26 +6991,26 @@ const code_1$1 = code, codegen_1$4 = codegen, util_1$6 = util, util_2 = util, de
|
|
|
6987
6991
|
return;
|
|
6988
6992
|
const u = o.strictSchema && !o.allowMatchingProperties && s.properties, p = t.name("valid");
|
|
6989
6993
|
i.props !== !0 && !(i.props instanceof codegen_1$4.Name) && (i.props = (0, util_2.evaluatedPropsToName)(t, i.props));
|
|
6990
|
-
const { props:
|
|
6994
|
+
const { props: g } = i;
|
|
6991
6995
|
R();
|
|
6992
6996
|
function R() {
|
|
6993
6997
|
for (const v of c)
|
|
6994
6998
|
u && O(v), i.allErrors ? T(v) : (t.var(p, !0), T(v), t.if(p));
|
|
6995
6999
|
}
|
|
6996
7000
|
function O(v) {
|
|
6997
|
-
for (const
|
|
6998
|
-
new RegExp(v).test(
|
|
7001
|
+
for (const y in u)
|
|
7002
|
+
new RegExp(v).test(y) && (0, util_1$6.checkStrictMode)(i, `property ${y} matches pattern ${v} (use allowMatchingProperties)`);
|
|
6999
7003
|
}
|
|
7000
7004
|
function T(v) {
|
|
7001
|
-
t.forIn("key", n, (
|
|
7002
|
-
t.if((0, codegen_1$4._)`${(0, code_1$1.usePattern)(e, v)}.test(${
|
|
7005
|
+
t.forIn("key", n, (y) => {
|
|
7006
|
+
t.if((0, codegen_1$4._)`${(0, code_1$1.usePattern)(e, v)}.test(${y})`, () => {
|
|
7003
7007
|
const m = d.includes(v);
|
|
7004
7008
|
m || e.subschema({
|
|
7005
7009
|
keyword: "patternProperties",
|
|
7006
7010
|
schemaProp: v,
|
|
7007
|
-
dataProp:
|
|
7011
|
+
dataProp: y,
|
|
7008
7012
|
dataPropType: util_2.Type.Str
|
|
7009
|
-
}, p), i.opts.unevaluated &&
|
|
7013
|
+
}, p), i.opts.unevaluated && g !== !0 ? t.assign((0, codegen_1$4._)`${g}[${y}]`, !0) : !m && !i.allErrors && t.if((0, codegen_1$4.not)(p), () => t.break());
|
|
7010
7014
|
});
|
|
7011
7015
|
});
|
|
7012
7016
|
}
|
|
@@ -7065,14 +7069,14 @@ const codegen_1$3 = codegen, util_1$4 = util, error$3 = {
|
|
|
7065
7069
|
const i = r, o = t.let("valid", !1), c = t.let("passing", null), d = t.name("_valid");
|
|
7066
7070
|
e.setParams({ passing: c }), t.block(u), e.result(o, () => e.reset(), () => e.error(!0));
|
|
7067
7071
|
function u() {
|
|
7068
|
-
i.forEach((p,
|
|
7072
|
+
i.forEach((p, g) => {
|
|
7069
7073
|
let R;
|
|
7070
7074
|
(0, util_1$4.alwaysValidSchema)(s, p) ? t.var(d, !0) : R = e.subschema({
|
|
7071
7075
|
keyword: "oneOf",
|
|
7072
|
-
schemaProp:
|
|
7076
|
+
schemaProp: g,
|
|
7073
7077
|
compositeRule: !0
|
|
7074
|
-
}, d),
|
|
7075
|
-
t.assign(o, !0), t.assign(c,
|
|
7078
|
+
}, d), g > 0 && t.if((0, codegen_1$3._)`${d} && ${o}`).assign(o, !1).assign(c, (0, codegen_1$3._)`[${c}, ${g}]`).else(), t.if(d, () => {
|
|
7079
|
+
t.assign(o, !0), t.assign(c, g), R && e.mergeEvaluated(R, codegen_1$3.Name);
|
|
7076
7080
|
});
|
|
7077
7081
|
});
|
|
7078
7082
|
}
|
|
@@ -7130,10 +7134,10 @@ const codegen_1$2 = codegen, util_1$2 = util, error$2 = {
|
|
|
7130
7134
|
}, c);
|
|
7131
7135
|
e.mergeEvaluated(p);
|
|
7132
7136
|
}
|
|
7133
|
-
function u(p,
|
|
7137
|
+
function u(p, g) {
|
|
7134
7138
|
return () => {
|
|
7135
7139
|
const R = e.subschema({ keyword: p }, c);
|
|
7136
|
-
t.assign(o, c), e.mergeValidEvaluated(R, o),
|
|
7140
|
+
t.assign(o, c), e.mergeValidEvaluated(R, o), g ? t.assign(g, (0, codegen_1$2._)`${p}`) : e.setParams({ ifClause: p });
|
|
7137
7141
|
};
|
|
7138
7142
|
}
|
|
7139
7143
|
}
|
|
@@ -7186,37 +7190,37 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7186
7190
|
$data: !0,
|
|
7187
7191
|
error: error$1,
|
|
7188
7192
|
code(e, t) {
|
|
7189
|
-
const { gen: r, data: n, $data: s, schema: i, schemaCode: o, it: c } = e, { opts: d, errSchemaPath: u, schemaEnv: p, self:
|
|
7193
|
+
const { gen: r, data: n, $data: s, schema: i, schemaCode: o, it: c } = e, { opts: d, errSchemaPath: u, schemaEnv: p, self: g } = c;
|
|
7190
7194
|
if (!d.validateFormats)
|
|
7191
7195
|
return;
|
|
7192
7196
|
s ? R() : O();
|
|
7193
7197
|
function R() {
|
|
7194
7198
|
const T = r.scopeValue("formats", {
|
|
7195
|
-
ref:
|
|
7199
|
+
ref: g.formats,
|
|
7196
7200
|
code: d.code.formats
|
|
7197
|
-
}), v = r.const("fDef", (0, codegen_1$1._)`${T}[${o}]`),
|
|
7198
|
-
r.if((0, codegen_1$1._)`typeof ${v} == "object" && !(${v} instanceof RegExp)`, () => r.assign(
|
|
7201
|
+
}), v = r.const("fDef", (0, codegen_1$1._)`${T}[${o}]`), y = r.let("fType"), m = r.let("format");
|
|
7202
|
+
r.if((0, codegen_1$1._)`typeof ${v} == "object" && !(${v} instanceof RegExp)`, () => r.assign(y, (0, codegen_1$1._)`${v}.type || "string"`).assign(m, (0, codegen_1$1._)`${v}.validate`), () => r.assign(y, (0, codegen_1$1._)`"string"`).assign(m, v)), e.fail$data((0, codegen_1$1.or)(k(), S()));
|
|
7199
7203
|
function k() {
|
|
7200
7204
|
return d.strictSchema === !1 ? codegen_1$1.nil : (0, codegen_1$1._)`${o} && !${m}`;
|
|
7201
7205
|
}
|
|
7202
7206
|
function S() {
|
|
7203
7207
|
const I = p.$async ? (0, codegen_1$1._)`(${v}.async ? await ${m}(${n}) : ${m}(${n}))` : (0, codegen_1$1._)`${m}(${n})`, D = (0, codegen_1$1._)`(typeof ${m} == "function" ? ${I} : ${m}.test(${n}))`;
|
|
7204
|
-
return (0, codegen_1$1._)`${m} && ${m} !== true && ${
|
|
7208
|
+
return (0, codegen_1$1._)`${m} && ${m} !== true && ${y} === ${t} && !${D}`;
|
|
7205
7209
|
}
|
|
7206
7210
|
}
|
|
7207
7211
|
function O() {
|
|
7208
|
-
const T =
|
|
7212
|
+
const T = g.formats[i];
|
|
7209
7213
|
if (!T) {
|
|
7210
7214
|
k();
|
|
7211
7215
|
return;
|
|
7212
7216
|
}
|
|
7213
7217
|
if (T === !0)
|
|
7214
7218
|
return;
|
|
7215
|
-
const [v,
|
|
7219
|
+
const [v, y, m] = S(T);
|
|
7216
7220
|
v === t && e.pass(I());
|
|
7217
7221
|
function k() {
|
|
7218
7222
|
if (d.strictSchema === !1) {
|
|
7219
|
-
|
|
7223
|
+
g.logger.warn(D());
|
|
7220
7224
|
return;
|
|
7221
7225
|
}
|
|
7222
7226
|
throw new Error(D());
|
|
@@ -7234,7 +7238,7 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7234
7238
|
throw new Error("async format in sync schema");
|
|
7235
7239
|
return (0, codegen_1$1._)`await ${m}(${n})`;
|
|
7236
7240
|
}
|
|
7237
|
-
return typeof
|
|
7241
|
+
return typeof y == "function" ? (0, codegen_1$1._)`${m}(${n})` : (0, codegen_1$1._)`${m}.test(${n})`;
|
|
7238
7242
|
}
|
|
7239
7243
|
}
|
|
7240
7244
|
}
|
|
@@ -7302,26 +7306,26 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7302
7306
|
const O = R();
|
|
7303
7307
|
t.if(!1);
|
|
7304
7308
|
for (const T in O)
|
|
7305
|
-
t.elseIf((0, codegen_1._)`${u} === ${T}`), t.assign(d,
|
|
7309
|
+
t.elseIf((0, codegen_1._)`${u} === ${T}`), t.assign(d, g(O[T]));
|
|
7306
7310
|
t.else(), e.error(!1, { discrError: types_1.DiscrError.Mapping, tag: u, tagName: c }), t.endIf();
|
|
7307
7311
|
}
|
|
7308
|
-
function
|
|
7312
|
+
function g(O) {
|
|
7309
7313
|
const T = t.name("valid"), v = e.subschema({ keyword: "oneOf", schemaProp: O }, T);
|
|
7310
7314
|
return e.mergeEvaluated(v, codegen_1.Name), T;
|
|
7311
7315
|
}
|
|
7312
7316
|
function R() {
|
|
7313
7317
|
var O;
|
|
7314
7318
|
const T = {}, v = m(s);
|
|
7315
|
-
let
|
|
7319
|
+
let y = !0;
|
|
7316
7320
|
for (let I = 0; I < o.length; I++) {
|
|
7317
7321
|
let D = o[I];
|
|
7318
7322
|
D != null && D.$ref && !(0, util_1.schemaHasRulesButRef)(D, i.self.RULES) && (D = compile_1.resolveRef.call(i.self, i.schemaEnv.root, i.baseId, D == null ? void 0 : D.$ref), D instanceof compile_1.SchemaEnv && (D = D.schema));
|
|
7319
7323
|
const w = (O = D == null ? void 0 : D.properties) === null || O === void 0 ? void 0 : O[c];
|
|
7320
7324
|
if (typeof w != "object")
|
|
7321
7325
|
throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${c}"`);
|
|
7322
|
-
|
|
7326
|
+
y = y && (v || m(D)), k(w, I);
|
|
7323
7327
|
}
|
|
7324
|
-
if (
|
|
7328
|
+
if (!y)
|
|
7325
7329
|
throw new Error(`discriminator: "${c}" must be required`);
|
|
7326
7330
|
return T;
|
|
7327
7331
|
function m({ required: I }) {
|
|
@@ -7622,9 +7626,9 @@ const $schema$1 = "http://json-schema.org/draft-07/schema#", $id = "http://json-
|
|
|
7622
7626
|
} }), Object.defineProperty(t, "CodeGen", { enumerable: !0, get: function() {
|
|
7623
7627
|
return p.CodeGen;
|
|
7624
7628
|
} });
|
|
7625
|
-
var
|
|
7629
|
+
var g = validation_error;
|
|
7626
7630
|
Object.defineProperty(t, "ValidationError", { enumerable: !0, get: function() {
|
|
7627
|
-
return
|
|
7631
|
+
return g.default;
|
|
7628
7632
|
} });
|
|
7629
7633
|
var R = ref_error;
|
|
7630
7634
|
Object.defineProperty(t, "MissingRefError", { enumerable: !0, get: function() {
|
|
@@ -7642,7 +7646,38 @@ const Ajv = /* @__PURE__ */ getDefaultExportFromCjs(ajvExports), $schema = "http
|
|
|
7642
7646
|
},
|
|
7643
7647
|
description: {
|
|
7644
7648
|
type: "string",
|
|
7645
|
-
description: "Optional description. It doesn't do anything but is exposed as a courtesy to developers who may want to document which blueprint file does what."
|
|
7649
|
+
description: "Optional description. It doesn't do anything but is exposed as a courtesy to developers who may want to document which blueprint file does what.",
|
|
7650
|
+
deprecated: "Use meta.description instead."
|
|
7651
|
+
},
|
|
7652
|
+
meta: {
|
|
7653
|
+
type: "object",
|
|
7654
|
+
properties: {
|
|
7655
|
+
title: {
|
|
7656
|
+
type: "string",
|
|
7657
|
+
description: "A clear and concise name for your Blueprint."
|
|
7658
|
+
},
|
|
7659
|
+
description: {
|
|
7660
|
+
type: "string",
|
|
7661
|
+
description: "A brief explanation of what your Blueprint offers."
|
|
7662
|
+
},
|
|
7663
|
+
author: {
|
|
7664
|
+
type: "string",
|
|
7665
|
+
description: "A GitHub username of the author of this Blueprint."
|
|
7666
|
+
},
|
|
7667
|
+
categories: {
|
|
7668
|
+
type: "array",
|
|
7669
|
+
items: {
|
|
7670
|
+
type: "string"
|
|
7671
|
+
},
|
|
7672
|
+
description: "Relevant categories to help users find your Blueprint in the future Blueprints section on WordPress.org."
|
|
7673
|
+
}
|
|
7674
|
+
},
|
|
7675
|
+
required: [
|
|
7676
|
+
"title",
|
|
7677
|
+
"author"
|
|
7678
|
+
],
|
|
7679
|
+
additionalProperties: !1,
|
|
7680
|
+
description: "Optional metadata. Used by the Blueprints gallery at https://github.com/WordPress/blueprints"
|
|
7646
7681
|
},
|
|
7647
7682
|
preferredVersions: {
|
|
7648
7683
|
type: "object",
|
|
@@ -8919,46 +8954,129 @@ for existing apps using this option.`
|
|
|
8919
8954
|
$ref: "#/definitions/PHPRequestHeaders",
|
|
8920
8955
|
description: "Request headers."
|
|
8921
8956
|
},
|
|
8922
|
-
|
|
8923
|
-
|
|
8924
|
-
|
|
8925
|
-
|
|
8926
|
-
|
|
8927
|
-
|
|
8928
|
-
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
|
|
8957
|
+
body: {
|
|
8958
|
+
anyOf: [
|
|
8959
|
+
{
|
|
8960
|
+
type: "string"
|
|
8961
|
+
},
|
|
8962
|
+
{
|
|
8963
|
+
type: "object",
|
|
8964
|
+
properties: {
|
|
8965
|
+
BYTES_PER_ELEMENT: {
|
|
8966
|
+
type: "number"
|
|
8967
|
+
},
|
|
8968
|
+
buffer: {
|
|
8969
|
+
type: "object",
|
|
8970
|
+
properties: {
|
|
8971
|
+
byteLength: {
|
|
8972
|
+
type: "number"
|
|
8973
|
+
}
|
|
8974
|
+
},
|
|
8975
|
+
required: [
|
|
8976
|
+
"byteLength"
|
|
8977
|
+
],
|
|
8978
|
+
additionalProperties: !1
|
|
8979
|
+
},
|
|
8980
|
+
byteLength: {
|
|
8981
|
+
type: "number"
|
|
8982
|
+
},
|
|
8983
|
+
byteOffset: {
|
|
8984
|
+
type: "number"
|
|
8985
|
+
},
|
|
8986
|
+
length: {
|
|
8987
|
+
type: "number"
|
|
8988
|
+
}
|
|
8932
8989
|
},
|
|
8933
|
-
|
|
8990
|
+
required: [
|
|
8991
|
+
"BYTES_PER_ELEMENT",
|
|
8992
|
+
"buffer",
|
|
8993
|
+
"byteLength",
|
|
8994
|
+
"byteOffset",
|
|
8995
|
+
"length"
|
|
8996
|
+
],
|
|
8997
|
+
additionalProperties: {
|
|
8934
8998
|
type: "number"
|
|
8935
|
-
},
|
|
8936
|
-
name: {
|
|
8937
|
-
type: "string"
|
|
8938
|
-
},
|
|
8939
|
-
webkitRelativePath: {
|
|
8940
|
-
type: "string"
|
|
8941
8999
|
}
|
|
8942
9000
|
},
|
|
8943
|
-
|
|
8944
|
-
"
|
|
8945
|
-
|
|
8946
|
-
|
|
8947
|
-
|
|
8948
|
-
|
|
8949
|
-
|
|
8950
|
-
|
|
8951
|
-
|
|
8952
|
-
|
|
8953
|
-
|
|
8954
|
-
|
|
8955
|
-
|
|
8956
|
-
|
|
8957
|
-
|
|
8958
|
-
|
|
8959
|
-
|
|
8960
|
-
|
|
8961
|
-
|
|
9001
|
+
{
|
|
9002
|
+
type: "object",
|
|
9003
|
+
additionalProperties: {
|
|
9004
|
+
anyOf: [
|
|
9005
|
+
{
|
|
9006
|
+
type: "string"
|
|
9007
|
+
},
|
|
9008
|
+
{
|
|
9009
|
+
type: "object",
|
|
9010
|
+
properties: {
|
|
9011
|
+
BYTES_PER_ELEMENT: {
|
|
9012
|
+
type: "number"
|
|
9013
|
+
},
|
|
9014
|
+
buffer: {
|
|
9015
|
+
type: "object",
|
|
9016
|
+
properties: {
|
|
9017
|
+
byteLength: {
|
|
9018
|
+
type: "number"
|
|
9019
|
+
}
|
|
9020
|
+
},
|
|
9021
|
+
required: [
|
|
9022
|
+
"byteLength"
|
|
9023
|
+
],
|
|
9024
|
+
additionalProperties: !1
|
|
9025
|
+
},
|
|
9026
|
+
byteLength: {
|
|
9027
|
+
type: "number"
|
|
9028
|
+
},
|
|
9029
|
+
byteOffset: {
|
|
9030
|
+
type: "number"
|
|
9031
|
+
},
|
|
9032
|
+
length: {
|
|
9033
|
+
type: "number"
|
|
9034
|
+
}
|
|
9035
|
+
},
|
|
9036
|
+
required: [
|
|
9037
|
+
"BYTES_PER_ELEMENT",
|
|
9038
|
+
"buffer",
|
|
9039
|
+
"byteLength",
|
|
9040
|
+
"byteOffset",
|
|
9041
|
+
"length"
|
|
9042
|
+
],
|
|
9043
|
+
additionalProperties: {
|
|
9044
|
+
type: "number"
|
|
9045
|
+
}
|
|
9046
|
+
},
|
|
9047
|
+
{
|
|
9048
|
+
type: "object",
|
|
9049
|
+
properties: {
|
|
9050
|
+
size: {
|
|
9051
|
+
type: "number"
|
|
9052
|
+
},
|
|
9053
|
+
type: {
|
|
9054
|
+
type: "string"
|
|
9055
|
+
},
|
|
9056
|
+
lastModified: {
|
|
9057
|
+
type: "number"
|
|
9058
|
+
},
|
|
9059
|
+
name: {
|
|
9060
|
+
type: "string"
|
|
9061
|
+
},
|
|
9062
|
+
webkitRelativePath: {
|
|
9063
|
+
type: "string"
|
|
9064
|
+
}
|
|
9065
|
+
},
|
|
9066
|
+
required: [
|
|
9067
|
+
"lastModified",
|
|
9068
|
+
"name",
|
|
9069
|
+
"size",
|
|
9070
|
+
"type",
|
|
9071
|
+
"webkitRelativePath"
|
|
9072
|
+
],
|
|
9073
|
+
additionalProperties: !1
|
|
9074
|
+
}
|
|
9075
|
+
]
|
|
9076
|
+
}
|
|
9077
|
+
}
|
|
9078
|
+
],
|
|
9079
|
+
description: "Request body. If an object is given, the request will be encoded as multipart and sent with a `multipart/form-data` header."
|
|
8962
9080
|
}
|
|
8963
9081
|
},
|
|
8964
9082
|
required: [
|
|
@@ -9008,85 +9126,68 @@ for existing apps using this option.`
|
|
|
9008
9126
|
description: "Request headers."
|
|
9009
9127
|
},
|
|
9010
9128
|
body: {
|
|
9011
|
-
|
|
9012
|
-
|
|
9013
|
-
|
|
9014
|
-
fileInfos: {
|
|
9015
|
-
type: "array",
|
|
9016
|
-
items: {
|
|
9017
|
-
$ref: "#/definitions/FileInfo"
|
|
9018
|
-
},
|
|
9019
|
-
description: "Uploaded files."
|
|
9020
|
-
},
|
|
9021
|
-
code: {
|
|
9022
|
-
type: "string",
|
|
9023
|
-
description: "The code snippet to eval instead of a php file."
|
|
9024
|
-
},
|
|
9025
|
-
throwOnError: {
|
|
9026
|
-
type: "boolean",
|
|
9027
|
-
description: "Whether to throw an error if the PHP process exits with a non-zero code or outputs to stderr."
|
|
9028
|
-
}
|
|
9029
|
-
},
|
|
9030
|
-
additionalProperties: !1
|
|
9031
|
-
},
|
|
9032
|
-
FileInfo: {
|
|
9033
|
-
type: "object",
|
|
9034
|
-
properties: {
|
|
9035
|
-
key: {
|
|
9036
|
-
type: "string"
|
|
9037
|
-
},
|
|
9038
|
-
name: {
|
|
9039
|
-
type: "string"
|
|
9040
|
-
},
|
|
9041
|
-
type: {
|
|
9042
|
-
type: "string"
|
|
9043
|
-
},
|
|
9044
|
-
data: {
|
|
9045
|
-
type: "object",
|
|
9046
|
-
properties: {
|
|
9047
|
-
BYTES_PER_ELEMENT: {
|
|
9048
|
-
type: "number"
|
|
9129
|
+
anyOf: [
|
|
9130
|
+
{
|
|
9131
|
+
type: "string"
|
|
9049
9132
|
},
|
|
9050
|
-
|
|
9133
|
+
{
|
|
9051
9134
|
type: "object",
|
|
9052
9135
|
properties: {
|
|
9136
|
+
BYTES_PER_ELEMENT: {
|
|
9137
|
+
type: "number"
|
|
9138
|
+
},
|
|
9139
|
+
buffer: {
|
|
9140
|
+
type: "object",
|
|
9141
|
+
properties: {
|
|
9142
|
+
byteLength: {
|
|
9143
|
+
type: "number"
|
|
9144
|
+
}
|
|
9145
|
+
},
|
|
9146
|
+
required: [
|
|
9147
|
+
"byteLength"
|
|
9148
|
+
],
|
|
9149
|
+
additionalProperties: !1
|
|
9150
|
+
},
|
|
9053
9151
|
byteLength: {
|
|
9054
9152
|
type: "number"
|
|
9153
|
+
},
|
|
9154
|
+
byteOffset: {
|
|
9155
|
+
type: "number"
|
|
9156
|
+
},
|
|
9157
|
+
length: {
|
|
9158
|
+
type: "number"
|
|
9055
9159
|
}
|
|
9056
9160
|
},
|
|
9057
9161
|
required: [
|
|
9058
|
-
"
|
|
9162
|
+
"BYTES_PER_ELEMENT",
|
|
9163
|
+
"buffer",
|
|
9164
|
+
"byteLength",
|
|
9165
|
+
"byteOffset",
|
|
9166
|
+
"length"
|
|
9059
9167
|
],
|
|
9060
|
-
additionalProperties:
|
|
9061
|
-
|
|
9062
|
-
|
|
9063
|
-
type: "number"
|
|
9064
|
-
},
|
|
9065
|
-
byteOffset: {
|
|
9066
|
-
type: "number"
|
|
9067
|
-
},
|
|
9068
|
-
length: {
|
|
9069
|
-
type: "number"
|
|
9168
|
+
additionalProperties: {
|
|
9169
|
+
type: "number"
|
|
9170
|
+
}
|
|
9070
9171
|
}
|
|
9071
|
-
},
|
|
9072
|
-
required: [
|
|
9073
|
-
"BYTES_PER_ELEMENT",
|
|
9074
|
-
"buffer",
|
|
9075
|
-
"byteLength",
|
|
9076
|
-
"byteOffset",
|
|
9077
|
-
"length"
|
|
9078
9172
|
],
|
|
9173
|
+
description: "Request body."
|
|
9174
|
+
},
|
|
9175
|
+
env: {
|
|
9176
|
+
type: "object",
|
|
9079
9177
|
additionalProperties: {
|
|
9080
|
-
type: "
|
|
9081
|
-
}
|
|
9178
|
+
type: "string"
|
|
9179
|
+
},
|
|
9180
|
+
description: "Environment variables to set for this run."
|
|
9181
|
+
},
|
|
9182
|
+
code: {
|
|
9183
|
+
type: "string",
|
|
9184
|
+
description: "The code snippet to eval instead of a php file."
|
|
9185
|
+
},
|
|
9186
|
+
throwOnError: {
|
|
9187
|
+
type: "boolean",
|
|
9188
|
+
description: "Whether to throw an error if the PHP process exits with a non-zero code or outputs to stderr."
|
|
9082
9189
|
}
|
|
9083
9190
|
},
|
|
9084
|
-
required: [
|
|
9085
|
-
"key",
|
|
9086
|
-
"name",
|
|
9087
|
-
"type",
|
|
9088
|
-
"data"
|
|
9089
|
-
],
|
|
9090
9191
|
additionalProperties: !1
|
|
9091
9192
|
},
|
|
9092
9193
|
WordPressInstallationOptions: {
|
|
@@ -9115,7 +9216,7 @@ function compileBlueprint(e, {
|
|
|
9115
9216
|
onStepCompleted: n = () => {
|
|
9116
9217
|
}
|
|
9117
9218
|
} = {}) {
|
|
9118
|
-
var p,
|
|
9219
|
+
var p, g, R, O, T;
|
|
9119
9220
|
if (e = {
|
|
9120
9221
|
...e,
|
|
9121
9222
|
steps: (e.steps || []).filter(isStepDefinition)
|
|
@@ -9126,15 +9227,15 @@ function compileBlueprint(e, {
|
|
|
9126
9227
|
step: "setSiteOptions",
|
|
9127
9228
|
options: e.siteOptions
|
|
9128
9229
|
}), e.plugins) {
|
|
9129
|
-
const v = e.plugins.map((
|
|
9230
|
+
const v = e.plugins.map((y) => typeof y == "string" ? y.startsWith("https://") ? {
|
|
9130
9231
|
resource: "url",
|
|
9131
|
-
url:
|
|
9232
|
+
url: y
|
|
9132
9233
|
} : {
|
|
9133
9234
|
resource: "wordpress.org/plugins",
|
|
9134
|
-
slug:
|
|
9135
|
-
} :
|
|
9235
|
+
slug: y
|
|
9236
|
+
} : y).map((y) => ({
|
|
9136
9237
|
step: "installPlugin",
|
|
9137
|
-
pluginZipFile:
|
|
9238
|
+
pluginZipFile: y
|
|
9138
9239
|
}));
|
|
9139
9240
|
e.steps.unshift(...v);
|
|
9140
9241
|
}
|
|
@@ -9147,7 +9248,7 @@ function compileBlueprint(e, {
|
|
|
9147
9248
|
);
|
|
9148
9249
|
s !== void 0 && s > -1 && (e.phpExtensionBundles || (e.phpExtensionBundles = []), e.phpExtensionBundles.includes("kitchen-sink") || (e.phpExtensionBundles.push("kitchen-sink"), console.warn(
|
|
9149
9250
|
"The WP-CLI step used in your Blueprint requires the iconv and mbstring PHP extensions. However, you did not specify the kitchen-sink extension bundle. Playground will override your choice and load the kitchen-sink PHP extensions bundle to prevent the WP-CLI step from failing. "
|
|
9150
|
-
)), (
|
|
9251
|
+
)), (g = e.steps) == null || g.splice(s, 0, {
|
|
9151
9252
|
step: "writeFile",
|
|
9152
9253
|
data: {
|
|
9153
9254
|
resource: "url",
|
|
@@ -9173,9 +9274,9 @@ function compileBlueprint(e, {
|
|
|
9173
9274
|
throw v.errors = o, v;
|
|
9174
9275
|
}
|
|
9175
9276
|
const c = e.steps || [], d = c.reduce(
|
|
9176
|
-
(v,
|
|
9277
|
+
(v, y) => {
|
|
9177
9278
|
var m;
|
|
9178
|
-
return v + (((m =
|
|
9279
|
+
return v + (((m = y.progress) == null ? void 0 : m.weight) || 1);
|
|
9179
9280
|
},
|
|
9180
9281
|
0
|
|
9181
9282
|
), u = c.map(
|
|
@@ -9204,16 +9305,16 @@ function compileBlueprint(e, {
|
|
|
9204
9305
|
},
|
|
9205
9306
|
run: async (v) => {
|
|
9206
9307
|
try {
|
|
9207
|
-
for (const { resources:
|
|
9208
|
-
for (const m of
|
|
9308
|
+
for (const { resources: y } of u)
|
|
9309
|
+
for (const m of y)
|
|
9209
9310
|
m.setPlayground(v), m.isAsync && m.resolve();
|
|
9210
|
-
for (const [
|
|
9311
|
+
for (const [y, { run: m, step: k }] of Object.entries(u))
|
|
9211
9312
|
try {
|
|
9212
9313
|
const S = await m(v);
|
|
9213
9314
|
n(S, k);
|
|
9214
9315
|
} catch (S) {
|
|
9215
9316
|
throw console.error(S), new Error(
|
|
9216
|
-
`Error when executing the blueprint step #${
|
|
9317
|
+
`Error when executing the blueprint step #${y} (${JSON.stringify(
|
|
9217
9318
|
k
|
|
9218
9319
|
)}) ${S instanceof Error ? `: ${S.message}` : S}`,
|
|
9219
9320
|
{ cause: S }
|
|
@@ -9273,17 +9374,17 @@ function compileStep(e, {
|
|
|
9273
9374
|
const s = r.stage(
|
|
9274
9375
|
(((p = e.progress) == null ? void 0 : p.weight) || 1) / n
|
|
9275
9376
|
), i = {};
|
|
9276
|
-
for (const
|
|
9277
|
-
let R = e[
|
|
9377
|
+
for (const g of Object.keys(e)) {
|
|
9378
|
+
let R = e[g];
|
|
9278
9379
|
isFileReference(R) && (R = Resource.create(R, {
|
|
9279
9380
|
semaphore: t
|
|
9280
|
-
})), i[
|
|
9381
|
+
})), i[g] = R;
|
|
9281
9382
|
}
|
|
9282
|
-
const o = async (
|
|
9383
|
+
const o = async (g) => {
|
|
9283
9384
|
var R;
|
|
9284
9385
|
try {
|
|
9285
9386
|
return s.fillSlowly(), await keyedStepHandlers[e.step](
|
|
9286
|
-
|
|
9387
|
+
g,
|
|
9287
9388
|
await resolveArguments(i),
|
|
9288
9389
|
{
|
|
9289
9390
|
tracker: s,
|
|
@@ -9294,10 +9395,10 @@ function compileStep(e, {
|
|
|
9294
9395
|
s.finish();
|
|
9295
9396
|
}
|
|
9296
9397
|
}, c = getResources(i), d = getResources(i).filter(
|
|
9297
|
-
(
|
|
9398
|
+
(g) => g.isAsync
|
|
9298
9399
|
), u = 1 / (d.length + 1);
|
|
9299
|
-
for (const
|
|
9300
|
-
|
|
9400
|
+
for (const g of d)
|
|
9401
|
+
g.progress = s.stage(u);
|
|
9301
9402
|
return { run: o, step: e, resources: c };
|
|
9302
9403
|
}
|
|
9303
9404
|
function getResources(e) {
|
|
@@ -9372,20 +9473,20 @@ function expose(e, t = globalThis, r = ["*"]) {
|
|
|
9372
9473
|
const { id: i, type: o, path: c } = Object.assign({ path: [] }, s.data), d = (s.data.argumentList || []).map(fromWireValue);
|
|
9373
9474
|
let u;
|
|
9374
9475
|
try {
|
|
9375
|
-
const p = c.slice(0, -1).reduce((R, O) => R[O], e),
|
|
9476
|
+
const p = c.slice(0, -1).reduce((R, O) => R[O], e), g = c.reduce((R, O) => R[O], e);
|
|
9376
9477
|
switch (o) {
|
|
9377
9478
|
case "GET":
|
|
9378
|
-
u =
|
|
9479
|
+
u = g;
|
|
9379
9480
|
break;
|
|
9380
9481
|
case "SET":
|
|
9381
9482
|
p[c.slice(-1)[0]] = fromWireValue(s.data.value), u = !0;
|
|
9382
9483
|
break;
|
|
9383
9484
|
case "APPLY":
|
|
9384
|
-
u =
|
|
9485
|
+
u = g.apply(p, d);
|
|
9385
9486
|
break;
|
|
9386
9487
|
case "CONSTRUCT":
|
|
9387
9488
|
{
|
|
9388
|
-
const R = new
|
|
9489
|
+
const R = new g(...d);
|
|
9389
9490
|
u = proxy(R);
|
|
9390
9491
|
}
|
|
9391
9492
|
break;
|
|
@@ -9405,14 +9506,14 @@ function expose(e, t = globalThis, r = ["*"]) {
|
|
|
9405
9506
|
u = { value: p, [throwMarker]: 0 };
|
|
9406
9507
|
}
|
|
9407
9508
|
Promise.resolve(u).catch((p) => ({ value: p, [throwMarker]: 0 })).then((p) => {
|
|
9408
|
-
const [
|
|
9409
|
-
t.postMessage(Object.assign(Object.assign({},
|
|
9509
|
+
const [g, R] = toWireValue(p);
|
|
9510
|
+
t.postMessage(Object.assign(Object.assign({}, g), { id: i }), R), o === "RELEASE" && (t.removeEventListener("message", n), closeEndPoint(t), finalizer in e && typeof e[finalizer] == "function" && e[finalizer]());
|
|
9410
9511
|
}).catch((p) => {
|
|
9411
|
-
const [
|
|
9512
|
+
const [g, R] = toWireValue({
|
|
9412
9513
|
value: new TypeError("Unserializable return value"),
|
|
9413
9514
|
[throwMarker]: 0
|
|
9414
9515
|
});
|
|
9415
|
-
t.postMessage(Object.assign(Object.assign({},
|
|
9516
|
+
t.postMessage(Object.assign(Object.assign({}, g), { id: i }), R);
|
|
9416
9517
|
});
|
|
9417
9518
|
}), t.start && t.start();
|
|
9418
9519
|
}
|
|
@@ -9488,7 +9589,7 @@ function createProxy(e, t = [], r = function() {
|
|
|
9488
9589
|
const [u, p] = processArguments(c);
|
|
9489
9590
|
return requestResponseMessage(e, {
|
|
9490
9591
|
type: "APPLY",
|
|
9491
|
-
path: t.map((
|
|
9592
|
+
path: t.map((g) => g.toString()),
|
|
9492
9593
|
argumentList: u
|
|
9493
9594
|
}, p).then(fromWireValue);
|
|
9494
9595
|
},
|
|
@@ -9633,9 +9734,9 @@ function proxyClone(e) {
|
|
|
9633
9734
|
}
|
|
9634
9735
|
});
|
|
9635
9736
|
}
|
|
9636
|
-
class Logger {
|
|
9737
|
+
class Logger extends EventTarget {
|
|
9637
9738
|
constructor(t) {
|
|
9638
|
-
this.
|
|
9739
|
+
super(), this.fatalErrorEvent = "playground-fatal-error", this.logs = [], this.windowConnected = !1, this.lastPHPLogLength = 0, this.errorLogPath = "/wordpress/wp-content/debug.log", t && (this.errorLogPath = t);
|
|
9639
9740
|
}
|
|
9640
9741
|
/**
|
|
9641
9742
|
* Read the WordPress debug.log file and return its content.
|
|
@@ -9654,7 +9755,7 @@ class Logger {
|
|
|
9654
9755
|
logWindowError(t) {
|
|
9655
9756
|
this.log(
|
|
9656
9757
|
`${t.message} in ${t.filename} on line ${t.lineno}:${t.colno}`,
|
|
9657
|
-
"
|
|
9758
|
+
"Error"
|
|
9658
9759
|
);
|
|
9659
9760
|
}
|
|
9660
9761
|
/**
|
|
@@ -9663,7 +9764,7 @@ class Logger {
|
|
|
9663
9764
|
* @param PromiseRejectionEvent event
|
|
9664
9765
|
*/
|
|
9665
9766
|
logUnhandledRejection(t) {
|
|
9666
|
-
this.log(`${t.reason.stack}`, "
|
|
9767
|
+
this.log(`${t.reason.stack}`, "Error");
|
|
9667
9768
|
}
|
|
9668
9769
|
/**
|
|
9669
9770
|
* Register a listener for the window error events and log the data.
|
|
@@ -9685,6 +9786,18 @@ class Logger {
|
|
|
9685
9786
|
t.addEventListener("request.end", async () => {
|
|
9686
9787
|
const r = await this.getRequestPhpErrorLog(t);
|
|
9687
9788
|
r.length > this.lastPHPLogLength && (this.logRaw(r.substring(this.lastPHPLogLength)), this.lastPHPLogLength = r.length);
|
|
9789
|
+
}), t.addEventListener("request.error", (r) => {
|
|
9790
|
+
r = r, r.error && (this.log(
|
|
9791
|
+
`${r.error.message} ${r.error.stack}`,
|
|
9792
|
+
"Fatal",
|
|
9793
|
+
"PHP-WASM"
|
|
9794
|
+
), this.dispatchEvent(
|
|
9795
|
+
new CustomEvent(this.fatalErrorEvent, {
|
|
9796
|
+
detail: {
|
|
9797
|
+
logs: this.getLogs()
|
|
9798
|
+
}
|
|
9799
|
+
})
|
|
9800
|
+
));
|
|
9688
9801
|
});
|
|
9689
9802
|
}
|
|
9690
9803
|
/**
|
|
@@ -9713,26 +9826,39 @@ class Logger {
|
|
|
9713
9826
|
* Format log message and severity and log it.
|
|
9714
9827
|
* @param string message
|
|
9715
9828
|
* @param LogSeverity severity
|
|
9829
|
+
* @param string prefix
|
|
9716
9830
|
*/
|
|
9717
|
-
formatMessage(t, r) {
|
|
9718
|
-
return `[${this.formatLogDate(/* @__PURE__ */ new Date())}] ${
|
|
9831
|
+
formatMessage(t, r, n) {
|
|
9832
|
+
return `[${this.formatLogDate(/* @__PURE__ */ new Date())}] ${n} ${r}: ${t}`;
|
|
9719
9833
|
}
|
|
9720
9834
|
/**
|
|
9721
9835
|
* Log message with severity and timestamp.
|
|
9722
9836
|
* @param string message
|
|
9723
9837
|
* @param LogSeverity severity
|
|
9838
|
+
* @param string prefix
|
|
9724
9839
|
*/
|
|
9725
|
-
log(t, r) {
|
|
9726
|
-
r === void 0 && (r = "
|
|
9727
|
-
const
|
|
9728
|
-
|
|
9840
|
+
log(t, r, n) {
|
|
9841
|
+
r === void 0 && (r = "Info");
|
|
9842
|
+
const s = this.formatMessage(
|
|
9843
|
+
t,
|
|
9844
|
+
r,
|
|
9845
|
+
n ?? "Playground"
|
|
9846
|
+
);
|
|
9847
|
+
this.logRaw(s);
|
|
9729
9848
|
}
|
|
9730
9849
|
/**
|
|
9731
9850
|
* Log message without severity and timestamp.
|
|
9732
9851
|
* @param string log
|
|
9733
9852
|
*/
|
|
9734
9853
|
logRaw(t) {
|
|
9735
|
-
console.debug(t);
|
|
9854
|
+
this.logs.push(t), console.debug(t);
|
|
9855
|
+
}
|
|
9856
|
+
/**
|
|
9857
|
+
* Get all logs.
|
|
9858
|
+
* @returns string[]
|
|
9859
|
+
*/
|
|
9860
|
+
getLogs() {
|
|
9861
|
+
return this.logs;
|
|
9736
9862
|
}
|
|
9737
9863
|
}
|
|
9738
9864
|
const logger = new Logger();
|