@wp-playground/client 0.6.3 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +22 -22
- package/index.d.ts +4 -0
- package/index.js +1088 -942
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Nt = (e, t, r) => {
|
|
2
2
|
if (!t.has(e))
|
|
3
3
|
throw TypeError("Cannot " + r);
|
|
4
4
|
};
|
|
5
|
-
var H = (e, t, r) => (
|
|
5
|
+
var H = (e, t, r) => (Nt(e, t, "read from private field"), r ? r.call(e) : t.get(e)), Q = (e, t, r) => {
|
|
6
6
|
if (t.has(e))
|
|
7
7
|
throw TypeError("Cannot add the same private member more than once");
|
|
8
8
|
t instanceof WeakSet ? t.add(e) : t.set(e, r);
|
|
9
|
-
}, te = (e, t, r, n) => (
|
|
10
|
-
var ce = (e, t, r) => (
|
|
9
|
+
}, te = (e, t, r, n) => (Nt(e, t, "write to private field"), n ? n.call(e, r) : t.set(e, r), r);
|
|
10
|
+
var ce = (e, t, r) => (Nt(e, t, "access private method"), r);
|
|
11
11
|
if (typeof File > "u") {
|
|
12
12
|
class e extends Blob {
|
|
13
13
|
constructor(r, n, s) {
|
|
@@ -52,8 +52,8 @@ function isByobSupported() {
|
|
|
52
52
|
async pull(r) {
|
|
53
53
|
const n = r.byobRequest.view, i = await t.slice(e, e + n.byteLength).arrayBuffer(), o = new Uint8Array(i);
|
|
54
54
|
new Uint8Array(n.buffer).set(o);
|
|
55
|
-
const
|
|
56
|
-
r.byobRequest.respond(
|
|
55
|
+
const c = o.byteLength;
|
|
56
|
+
r.byobRequest.respond(c), e += c, e >= t.size && r.close();
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
59
|
});
|
|
@@ -147,12 +147,31 @@ function normalizePathsArray(e, t) {
|
|
|
147
147
|
e.unshift("..");
|
|
148
148
|
return e;
|
|
149
149
|
}
|
|
150
|
+
function splitShellCommand$1(e) {
|
|
151
|
+
let n = 0, s = "";
|
|
152
|
+
const i = [];
|
|
153
|
+
let o = "";
|
|
154
|
+
for (let c = 0; c < e.length; c++) {
|
|
155
|
+
const d = e[c];
|
|
156
|
+
d === "\\" ? ((e[c + 1] === '"' || e[c + 1] === "'") && c++, o += e[c]) : n === 0 ? d === '"' || d === "'" ? (n = 1, s = d) : d.match(/\s/) ? (o.trim().length && i.push(o.trim()), o = d) : i.length && !o ? o = i.pop() + d : o += d : n === 1 && (d === s ? (n = 0, s = "") : o += d);
|
|
157
|
+
}
|
|
158
|
+
return o && i.push(o.trim()), i;
|
|
159
|
+
}
|
|
150
160
|
function createSpawnHandler(e) {
|
|
151
|
-
return function(t) {
|
|
152
|
-
const
|
|
161
|
+
return function(t, r = [], n = {}) {
|
|
162
|
+
const s = new ChildProcess(), i = new ProcessApi(s);
|
|
153
163
|
return setTimeout(async () => {
|
|
154
|
-
|
|
155
|
-
|
|
164
|
+
let o = [];
|
|
165
|
+
if (r.length)
|
|
166
|
+
o = [t, ...r];
|
|
167
|
+
else if (typeof t == "string")
|
|
168
|
+
o = splitShellCommand$1(t);
|
|
169
|
+
else if (Array.isArray(t))
|
|
170
|
+
o = t;
|
|
171
|
+
else
|
|
172
|
+
throw new Error("Invalid command ", t);
|
|
173
|
+
await e(o, i, n), s.emit("spawn", !0);
|
|
174
|
+
}), s;
|
|
156
175
|
};
|
|
157
176
|
}
|
|
158
177
|
class EventEmitter {
|
|
@@ -177,9 +196,15 @@ class ProcessApi extends EventEmitter {
|
|
|
177
196
|
stdout(t) {
|
|
178
197
|
typeof t == "string" && (t = new TextEncoder().encode(t)), this.childProcess.stdout.emit("data", t);
|
|
179
198
|
}
|
|
199
|
+
stdoutEnd() {
|
|
200
|
+
this.childProcess.stdout.emit("end", {});
|
|
201
|
+
}
|
|
180
202
|
stderr(t) {
|
|
181
203
|
typeof t == "string" && (t = new TextEncoder().encode(t)), this.childProcess.stderr.emit("data", t);
|
|
182
204
|
}
|
|
205
|
+
stderrEnd() {
|
|
206
|
+
this.childProcess.stderr.emit("end", {});
|
|
207
|
+
}
|
|
183
208
|
exit(t) {
|
|
184
209
|
this.exited || (this.exited = !0, this.childProcess.emit("exit", t));
|
|
185
210
|
}
|
|
@@ -687,7 +712,7 @@ async function rewriteDefineCalls(e, t, r) {
|
|
|
687
712
|
}), await e.readFileAsText("/tmp/code.php");
|
|
688
713
|
}
|
|
689
714
|
const login = async (e, { username: t = "admin", password: r = "password" } = {}, n) => {
|
|
690
|
-
var i, o,
|
|
715
|
+
var i, o, c;
|
|
691
716
|
n == null || n.tracker.setCaption((n == null ? void 0 : n.initialCaption) || "Logging in"), await e.request({
|
|
692
717
|
url: "/wp-login.php"
|
|
693
718
|
});
|
|
@@ -700,7 +725,7 @@ const login = async (e, { username: t = "admin", password: r = "password" } = {}
|
|
|
700
725
|
rememberme: "forever"
|
|
701
726
|
}
|
|
702
727
|
});
|
|
703
|
-
if (!((
|
|
728
|
+
if (!((c = (o = (i = s.headers) == null ? void 0 : i.location) == null ? void 0 : o[0]) != null && c.includes("/wp-admin/")))
|
|
704
729
|
throw console.warn("WordPress response was", {
|
|
705
730
|
response: s,
|
|
706
731
|
text: s.text
|
|
@@ -830,14 +855,14 @@ echo json_encode($deactivated_plugins);
|
|
|
830
855
|
PATH_CURRENT_SITE: r
|
|
831
856
|
}
|
|
832
857
|
});
|
|
833
|
-
const p = new URL(await e.absoluteUrl),
|
|
858
|
+
const p = new URL(await e.absoluteUrl), _ = isURLScoped(p) ? "scope:" + getURLScope(p) : null;
|
|
834
859
|
await e.writeFile(
|
|
835
860
|
joinPaths(s, "/wp-content/sunrise.php"),
|
|
836
861
|
`<?php
|
|
837
862
|
if ( !defined( 'BLOG_ID_CURRENT_SITE' ) ) {
|
|
838
863
|
define( 'BLOG_ID_CURRENT_SITE', 1 );
|
|
839
864
|
}
|
|
840
|
-
$folder = ${phpVar(
|
|
865
|
+
$folder = ${phpVar(_)};
|
|
841
866
|
if ($folder && strpos($_SERVER['REQUEST_URI'],"/$folder") === false) {
|
|
842
867
|
$_SERVER['HTTP_HOST'] = ${phpVar(p.hostname)};
|
|
843
868
|
$_SERVER['REQUEST_URI'] = "/$folder/" . ltrim($_SERVER['REQUEST_URI'], '/');
|
|
@@ -874,33 +899,39 @@ const cp = async (e, { fromPath: t, toPath: r }) => {
|
|
|
874
899
|
WP_SITEURL: t
|
|
875
900
|
}
|
|
876
901
|
});
|
|
877
|
-
}, importFile = async (e, { file: t }) => {
|
|
878
|
-
var
|
|
879
|
-
|
|
902
|
+
}, importFile = async (e, { file: t }, r) => {
|
|
903
|
+
var u, p;
|
|
904
|
+
(u = r == null ? void 0 : r.tracker) == null || u.setCaption("Importing content");
|
|
905
|
+
const n = await e.request({
|
|
880
906
|
url: "/wp-admin/admin.php?import=wordpress"
|
|
881
|
-
}),
|
|
882
|
-
url: `/wp-admin/${
|
|
907
|
+
}), s = (p = DOM(n).getElementById("import-upload-form")) == null ? void 0 : p.getAttribute("action"), i = await e.request({
|
|
908
|
+
url: `/wp-admin/${s}`,
|
|
883
909
|
method: "POST",
|
|
884
910
|
body: { import: t }
|
|
885
|
-
}),
|
|
911
|
+
}), o = DOM(i).querySelector(
|
|
886
912
|
"#wpbody-content form"
|
|
887
913
|
);
|
|
888
|
-
if (!
|
|
889
|
-
throw console.log(
|
|
914
|
+
if (!o)
|
|
915
|
+
throw console.log(i.text), new Error(
|
|
890
916
|
"Could not find an importer form in response. See the response text above for details."
|
|
891
917
|
);
|
|
892
|
-
const
|
|
893
|
-
|
|
894
|
-
for (const
|
|
895
|
-
if (
|
|
896
|
-
const
|
|
897
|
-
|
|
898
|
-
}
|
|
899
|
-
await e.request({
|
|
900
|
-
url:
|
|
918
|
+
const c = getFormData(o);
|
|
919
|
+
c.fetch_attachments = "1";
|
|
920
|
+
for (const _ in c)
|
|
921
|
+
if (_.startsWith("user_map[")) {
|
|
922
|
+
const R = "user_new[" + _.slice(9, -1) + "]";
|
|
923
|
+
c[R] = "1";
|
|
924
|
+
}
|
|
925
|
+
const d = await e.request({
|
|
926
|
+
url: o.action,
|
|
901
927
|
method: "POST",
|
|
902
|
-
body:
|
|
928
|
+
body: c
|
|
903
929
|
});
|
|
930
|
+
if (!d.text.includes("All done."))
|
|
931
|
+
throw console.warn("WordPress response was: ", {
|
|
932
|
+
text: d.text,
|
|
933
|
+
errors: d.errors
|
|
934
|
+
}), new Error("Import failed, see console for details.");
|
|
904
935
|
};
|
|
905
936
|
function DOM(e) {
|
|
906
937
|
return new DOMParser().parseFromString(e.text, "text/html");
|
|
@@ -1030,22 +1061,22 @@ const tmpPath = "/tmp/file.zip", unzip = async (e, { zipFile: t, zipPath: r, ext
|
|
|
1030
1061
|
}), s = joinPaths(s, r);
|
|
1031
1062
|
const i = joinPaths(s, "wp-content"), o = joinPaths(n, "wp-content");
|
|
1032
1063
|
for (const p of wpContentFilesExcludedFromExport) {
|
|
1033
|
-
const
|
|
1064
|
+
const _ = joinPaths(
|
|
1034
1065
|
i,
|
|
1035
1066
|
p
|
|
1036
1067
|
);
|
|
1037
|
-
await removePath(e,
|
|
1068
|
+
await removePath(e, _);
|
|
1038
1069
|
const R = joinPaths(o, p);
|
|
1039
|
-
await e.fileExists(R) && (await e.mkdir(dirname(
|
|
1070
|
+
await e.fileExists(R) && (await e.mkdir(dirname(_)), await e.mv(R, _));
|
|
1040
1071
|
}
|
|
1041
|
-
const
|
|
1072
|
+
const c = joinPaths(
|
|
1042
1073
|
s,
|
|
1043
1074
|
"wp-content",
|
|
1044
1075
|
"database"
|
|
1045
1076
|
);
|
|
1046
|
-
await e.fileExists(
|
|
1077
|
+
await e.fileExists(c) || await e.mv(
|
|
1047
1078
|
joinPaths(n, "wp-content", "database"),
|
|
1048
|
-
|
|
1079
|
+
c
|
|
1049
1080
|
);
|
|
1050
1081
|
const d = await e.listFiles(s);
|
|
1051
1082
|
for (const p of d)
|
|
@@ -1083,24 +1114,24 @@ async function exportWXZ(e) {
|
|
|
1083
1114
|
return new File([t.bytes], "export.wxz");
|
|
1084
1115
|
}
|
|
1085
1116
|
async function installAsset(e, { targetPath: t, zipFile: r }) {
|
|
1086
|
-
const s = r.name.replace(/\.zip$/, ""), i = joinPaths(await e.documentRoot, "wp-content"), o = joinPaths(i, randomString()),
|
|
1087
|
-
await e.fileExists(
|
|
1117
|
+
const s = r.name.replace(/\.zip$/, ""), i = joinPaths(await e.documentRoot, "wp-content"), o = joinPaths(i, randomString()), c = joinPaths(o, "assets", s);
|
|
1118
|
+
await e.fileExists(c) && await e.rmdir(o, {
|
|
1088
1119
|
recursive: !0
|
|
1089
1120
|
}), await e.mkdir(o);
|
|
1090
1121
|
try {
|
|
1091
1122
|
await unzip(e, {
|
|
1092
1123
|
zipFile: r,
|
|
1093
|
-
extractToPath:
|
|
1124
|
+
extractToPath: c
|
|
1094
1125
|
});
|
|
1095
|
-
let d = await e.listFiles(
|
|
1126
|
+
let d = await e.listFiles(c, {
|
|
1096
1127
|
prependPath: !0
|
|
1097
1128
|
});
|
|
1098
1129
|
d = d.filter((O) => !O.endsWith("/__MACOSX"));
|
|
1099
1130
|
const u = d.length === 1 && await e.isDir(d[0]);
|
|
1100
|
-
let p,
|
|
1101
|
-
u ? (
|
|
1131
|
+
let p, _ = "";
|
|
1132
|
+
u ? (_ = d[0], p = d[0].split("/").pop()) : (_ = c, p = s);
|
|
1102
1133
|
const R = `${t}/${p}`;
|
|
1103
|
-
return await e.mv(
|
|
1134
|
+
return await e.mv(_, R), {
|
|
1104
1135
|
assetFolderPath: R,
|
|
1105
1136
|
assetFolderName: p
|
|
1106
1137
|
};
|
|
@@ -1185,8 +1216,8 @@ const installPlugin = async (e, { pluginZipFile: t, options: r = {} }, n) => {
|
|
|
1185
1216
|
'additional_paths' => ${o.additionalPaths}
|
|
1186
1217
|
));`
|
|
1187
1218
|
);
|
|
1188
|
-
const
|
|
1189
|
-
return e.unlink(r),
|
|
1219
|
+
const c = await e.readFileAsBuffer(r);
|
|
1220
|
+
return e.unlink(r), c;
|
|
1190
1221
|
}, wpCLI$1 = async (e, { command: t, wpCliPath: r = "/tmp/wp-cli.phar" }) => {
|
|
1191
1222
|
if (!await e.fileExists(r))
|
|
1192
1223
|
throw new Error(`wp-cli.phar not found at ${r}`);
|
|
@@ -1230,9 +1261,9 @@ function splitShellCommand(e) {
|
|
|
1230
1261
|
let n = 0, s = "";
|
|
1231
1262
|
const i = [];
|
|
1232
1263
|
let o = "";
|
|
1233
|
-
for (let
|
|
1234
|
-
const d = e[
|
|
1235
|
-
n === 0 ? d === '"' || d === "'" ? (n = 1, s = d) : d.match(/\s/) ? (o && i.push(o), o = "") : o += d : n === 1 && (d === "\\" ? (
|
|
1264
|
+
for (let c = 0; c < e.length; c++) {
|
|
1265
|
+
const d = e[c];
|
|
1266
|
+
n === 0 ? d === '"' || d === "'" ? (n = 1, s = d) : d.match(/\s/) ? (o && i.push(o), o = "") : o += d : n === 1 && (d === "\\" ? (c++, o += e[c]) : d === s ? (n = 0, s = "") : o += d);
|
|
1236
1267
|
}
|
|
1237
1268
|
return o && i.push(o), i;
|
|
1238
1269
|
}
|
|
@@ -1288,15 +1319,15 @@ function cloneResponseMonitorProgress(e, t) {
|
|
|
1288
1319
|
return;
|
|
1289
1320
|
}
|
|
1290
1321
|
const o = e.body.getReader();
|
|
1291
|
-
let
|
|
1322
|
+
let c = 0;
|
|
1292
1323
|
for (; ; )
|
|
1293
1324
|
try {
|
|
1294
1325
|
const { done: d, value: u } = await o.read();
|
|
1295
|
-
if (u && (
|
|
1296
|
-
s(
|
|
1326
|
+
if (u && (c += u.byteLength), d) {
|
|
1327
|
+
s(c, c), i.close();
|
|
1297
1328
|
break;
|
|
1298
1329
|
} else
|
|
1299
|
-
s(
|
|
1330
|
+
s(c, n), i.enqueue(u);
|
|
1300
1331
|
} catch (d) {
|
|
1301
1332
|
console.error({ e: d }), i.error(d);
|
|
1302
1333
|
break;
|
|
@@ -1531,7 +1562,7 @@ function improveWASMErrorReporting(e) {
|
|
|
1531
1562
|
} catch (o) {
|
|
1532
1563
|
if (!(o instanceof Error))
|
|
1533
1564
|
throw o;
|
|
1534
|
-
const
|
|
1565
|
+
const c = clarifyErrorMessage(
|
|
1535
1566
|
o,
|
|
1536
1567
|
(i = e.lastAsyncifyStackSource) == null ? void 0 : i.stack
|
|
1537
1568
|
);
|
|
@@ -1539,12 +1570,12 @@ function improveWASMErrorReporting(e) {
|
|
|
1539
1570
|
t.dispatchEvent(
|
|
1540
1571
|
new ErrorEvent("error", {
|
|
1541
1572
|
error: o,
|
|
1542
|
-
message:
|
|
1573
|
+
message: c
|
|
1543
1574
|
})
|
|
1544
1575
|
);
|
|
1545
1576
|
return;
|
|
1546
1577
|
}
|
|
1547
|
-
throw isExitCodeZero(o) || showCriticalErrorBox(
|
|
1578
|
+
throw isExitCodeZero(o) || showCriticalErrorBox(c), o;
|
|
1548
1579
|
}
|
|
1549
1580
|
};
|
|
1550
1581
|
}
|
|
@@ -1796,19 +1827,19 @@ async function encodeAsMultipart(e) {
|
|
|
1796
1827
|
for (const [d, u] of Object.entries(e))
|
|
1797
1828
|
s.push(`--${t}\r
|
|
1798
1829
|
`), s.push(`Content-Disposition: form-data; name="${d}"`), u instanceof File && s.push(`; filename="${u.name}"`), s.push(`\r
|
|
1799
|
-
`), u instanceof File && s.push("Content-Type: application/octet-stream"), s.push(`\r
|
|
1800
|
-
|
|
1830
|
+
`), u instanceof File && (s.push("Content-Type: application/octet-stream"), s.push(`\r
|
|
1831
|
+
`)), s.push(`\r
|
|
1801
1832
|
`), u instanceof File ? s.push(await fileToUint8Array(u)) : s.push(u), s.push(`\r
|
|
1802
1833
|
`);
|
|
1803
1834
|
s.push(`--${t}--\r
|
|
1804
1835
|
`);
|
|
1805
1836
|
const i = s.reduce((d, u) => d + u.length, 0), o = new Uint8Array(i);
|
|
1806
|
-
let
|
|
1837
|
+
let c = 0;
|
|
1807
1838
|
for (const d of s)
|
|
1808
1839
|
o.set(
|
|
1809
1840
|
typeof d == "string" ? n.encode(d) : d,
|
|
1810
|
-
|
|
1811
|
-
),
|
|
1841
|
+
c
|
|
1842
|
+
), c += d.length;
|
|
1812
1843
|
return { bytes: o, contentType: r };
|
|
1813
1844
|
}
|
|
1814
1845
|
function fileToUint8Array(e) {
|
|
@@ -1819,7 +1850,7 @@ function fileToUint8Array(e) {
|
|
|
1819
1850
|
}, r.readAsArrayBuffer(e);
|
|
1820
1851
|
});
|
|
1821
1852
|
}
|
|
1822
|
-
var
|
|
1853
|
+
var Pe, Ke, dt, De, Je, ve, Qe, Fe, mt, zt, _t, Wt, gt, Bt;
|
|
1823
1854
|
class PHPRequestHandler {
|
|
1824
1855
|
/**
|
|
1825
1856
|
* @param php - The PHP instance.
|
|
@@ -1851,7 +1882,7 @@ class PHPRequestHandler {
|
|
|
1851
1882
|
* @returns The resolved filesystem path.
|
|
1852
1883
|
*/
|
|
1853
1884
|
Q(this, gt);
|
|
1854
|
-
Q(this,
|
|
1885
|
+
Q(this, Pe, void 0);
|
|
1855
1886
|
Q(this, Ke, void 0);
|
|
1856
1887
|
Q(this, dt, void 0);
|
|
1857
1888
|
Q(this, De, void 0);
|
|
@@ -1864,7 +1895,7 @@ class PHPRequestHandler {
|
|
|
1864
1895
|
documentRoot: n = "/www/",
|
|
1865
1896
|
absoluteUrl: s = typeof location == "object" ? location == null ? void 0 : location.href : ""
|
|
1866
1897
|
} = r;
|
|
1867
|
-
this.php = t, te(this,
|
|
1898
|
+
this.php = t, te(this, Pe, n);
|
|
1868
1899
|
const i = new URL(s);
|
|
1869
1900
|
te(this, dt, i.hostname), te(this, De, i.port ? Number(i.port) : i.protocol === "https:" ? 443 : 80), te(this, Ke, (i.protocol || "").replace(":", ""));
|
|
1870
1901
|
const o = H(this, De) !== 443 && H(this, De) !== 80;
|
|
@@ -1895,7 +1926,7 @@ class PHPRequestHandler {
|
|
|
1895
1926
|
}
|
|
1896
1927
|
/** @inheritDoc */
|
|
1897
1928
|
get documentRoot() {
|
|
1898
|
-
return H(this,
|
|
1929
|
+
return H(this, Pe);
|
|
1899
1930
|
}
|
|
1900
1931
|
/** @inheritDoc */
|
|
1901
1932
|
async request(t) {
|
|
@@ -1905,11 +1936,11 @@ class PHPRequestHandler {
|
|
|
1905
1936
|
), s = removePathPrefix(
|
|
1906
1937
|
n.pathname,
|
|
1907
1938
|
H(this, ve)
|
|
1908
|
-
), i = `${H(this,
|
|
1909
|
-
return seemsLikeAPHPRequestHandlerPath(i) ? await ce(this, _t,
|
|
1939
|
+
), i = `${H(this, Pe)}${s}`;
|
|
1940
|
+
return seemsLikeAPHPRequestHandlerPath(i) ? await ce(this, _t, Wt).call(this, t, n) : ce(this, mt, zt).call(this, i);
|
|
1910
1941
|
}
|
|
1911
1942
|
}
|
|
1912
|
-
|
|
1943
|
+
Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(), Je = new WeakMap(), ve = new WeakMap(), Qe = new WeakMap(), Fe = new WeakMap(), mt = new WeakSet(), zt = function(t) {
|
|
1913
1944
|
if (!this.php.fileExists(t))
|
|
1914
1945
|
return new PHPResponse(
|
|
1915
1946
|
404,
|
|
@@ -1934,7 +1965,7 @@ Se = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
1934
1965
|
},
|
|
1935
1966
|
r
|
|
1936
1967
|
);
|
|
1937
|
-
}, _t = new WeakSet(),
|
|
1968
|
+
}, _t = new WeakSet(), Wt = async function(t, r) {
|
|
1938
1969
|
var s, i;
|
|
1939
1970
|
if (H(this, Fe).running > 0 && ((s = t.headers) == null ? void 0 : s["x-request-issuer"]) === "php")
|
|
1940
1971
|
return console.warn(
|
|
@@ -1946,20 +1977,20 @@ Se = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
1946
1977
|
);
|
|
1947
1978
|
const n = await H(this, Fe).acquire();
|
|
1948
1979
|
try {
|
|
1949
|
-
this.php.addServerGlobalEntry("REMOTE_ADDR", "127.0.0.1"), this.php.addServerGlobalEntry("DOCUMENT_ROOT", H(this,
|
|
1980
|
+
this.php.addServerGlobalEntry("REMOTE_ADDR", "127.0.0.1"), this.php.addServerGlobalEntry("DOCUMENT_ROOT", H(this, Pe)), this.php.addServerGlobalEntry(
|
|
1950
1981
|
"HTTPS",
|
|
1951
1982
|
H(this, Qe).startsWith("https://") ? "on" : ""
|
|
1952
1983
|
);
|
|
1953
1984
|
let o = "GET";
|
|
1954
|
-
const
|
|
1985
|
+
const c = {
|
|
1955
1986
|
host: H(this, Je),
|
|
1956
1987
|
...normalizeHeaders(t.headers || {})
|
|
1957
1988
|
};
|
|
1958
1989
|
let d = t.body;
|
|
1959
1990
|
if (typeof d == "object" && !(d instanceof Uint8Array)) {
|
|
1960
1991
|
o = "POST";
|
|
1961
|
-
const { bytes: p, contentType:
|
|
1962
|
-
d = p,
|
|
1992
|
+
const { bytes: p, contentType: _ } = await encodeAsMultipart(d);
|
|
1993
|
+
d = p, c["content-type"] = _;
|
|
1963
1994
|
}
|
|
1964
1995
|
let u;
|
|
1965
1996
|
try {
|
|
@@ -1971,7 +2002,7 @@ Se = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
1971
2002
|
).pathname;
|
|
1972
2003
|
} catch {
|
|
1973
2004
|
}
|
|
1974
|
-
u = ce(this, gt,
|
|
2005
|
+
u = ce(this, gt, Bt).call(this, p);
|
|
1975
2006
|
} catch {
|
|
1976
2007
|
return new PHPResponse(
|
|
1977
2008
|
404,
|
|
@@ -1988,15 +2019,15 @@ Se = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
1988
2019
|
method: t.method || o,
|
|
1989
2020
|
body: d,
|
|
1990
2021
|
scriptPath: u,
|
|
1991
|
-
headers:
|
|
2022
|
+
headers: c
|
|
1992
2023
|
});
|
|
1993
2024
|
} finally {
|
|
1994
2025
|
n();
|
|
1995
2026
|
}
|
|
1996
|
-
}, gt = new WeakSet(),
|
|
2027
|
+
}, gt = new WeakSet(), Bt = function(t) {
|
|
1997
2028
|
let r = removePathPrefix(t, H(this, ve));
|
|
1998
|
-
r.includes(".php") ? r = r.split(".php")[0] + ".php" : (r.endsWith("/") || (r
|
|
1999
|
-
const n = `${H(this,
|
|
2029
|
+
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";
|
|
2030
|
+
const n = `${H(this, Pe)}${r}`;
|
|
2000
2031
|
if (this.php.fileExists(n))
|
|
2001
2032
|
return n;
|
|
2002
2033
|
throw new Error(`File not found: ${n}`);
|
|
@@ -2140,15 +2171,15 @@ function rethrowFileSystemError(e = "") {
|
|
|
2140
2171
|
s.value = function(...o) {
|
|
2141
2172
|
try {
|
|
2142
2173
|
return i.apply(this, o);
|
|
2143
|
-
} catch (
|
|
2144
|
-
const d = typeof
|
|
2174
|
+
} catch (c) {
|
|
2175
|
+
const d = typeof c == "object" ? c == null ? void 0 : c.errno : null;
|
|
2145
2176
|
if (d in FileErrorCodes) {
|
|
2146
|
-
const u = FileErrorCodes[d], p = typeof o[0] == "string" ? o[0] : null,
|
|
2147
|
-
throw new Error(`${
|
|
2148
|
-
cause:
|
|
2177
|
+
const u = FileErrorCodes[d], p = typeof o[0] == "string" ? o[0] : null, _ = p !== null ? e.replaceAll("{path}", p) : e;
|
|
2178
|
+
throw new Error(`${_}: ${u}`, {
|
|
2179
|
+
cause: c
|
|
2149
2180
|
});
|
|
2150
2181
|
}
|
|
2151
|
-
throw
|
|
2182
|
+
throw c;
|
|
2152
2183
|
}
|
|
2153
2184
|
};
|
|
2154
2185
|
};
|
|
@@ -2167,7 +2198,7 @@ var __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyD
|
|
|
2167
2198
|
return n && s && __defProp(t, r, s), s;
|
|
2168
2199
|
};
|
|
2169
2200
|
const STRING = "string", NUMBER = "number", __private__dont__use = Symbol("__private__dont__use");
|
|
2170
|
-
var Me, Ze, Ye,
|
|
2201
|
+
var Me, Ze, Ye, be, Re, Te, Ee, Xe, $t, Gt, yt, Kt, vt, Jt, wt, Qt, Pt, Zt, bt, Yt, Et, Xt, St, er, Rt, tr, Tt, rr, kt, nr, Ct, sr;
|
|
2171
2202
|
class BasePHP {
|
|
2172
2203
|
/**
|
|
2173
2204
|
* Initializes a PHP runtime.
|
|
@@ -2188,27 +2219,28 @@ class BasePHP {
|
|
|
2188
2219
|
Q(this, Rt);
|
|
2189
2220
|
Q(this, Tt);
|
|
2190
2221
|
Q(this, kt);
|
|
2222
|
+
Q(this, Ct);
|
|
2191
2223
|
Q(this, Me, void 0);
|
|
2192
2224
|
Q(this, Ze, void 0);
|
|
2193
2225
|
Q(this, Ye, void 0);
|
|
2194
|
-
Q(this,
|
|
2226
|
+
Q(this, be, void 0);
|
|
2195
2227
|
Q(this, Re, void 0);
|
|
2196
2228
|
Q(this, Te, void 0);
|
|
2197
|
-
Q(this,
|
|
2229
|
+
Q(this, Ee, void 0);
|
|
2198
2230
|
Q(this, Xe, void 0);
|
|
2199
|
-
te(this, Me, []), te(this,
|
|
2231
|
+
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(
|
|
2200
2232
|
new PHPRequestHandler(this, t)
|
|
2201
2233
|
));
|
|
2202
2234
|
}
|
|
2203
2235
|
addEventListener(e, t) {
|
|
2204
|
-
H(this,
|
|
2236
|
+
H(this, Ee).has(e) || H(this, Ee).set(e, /* @__PURE__ */ new Set()), H(this, Ee).get(e).add(t);
|
|
2205
2237
|
}
|
|
2206
2238
|
removeEventListener(e, t) {
|
|
2207
2239
|
var r;
|
|
2208
|
-
(r = H(this,
|
|
2240
|
+
(r = H(this, Ee).get(e)) == null || r.delete(t);
|
|
2209
2241
|
}
|
|
2210
2242
|
dispatchEvent(e) {
|
|
2211
|
-
const t = H(this,
|
|
2243
|
+
const t = H(this, Ee).get(e.type);
|
|
2212
2244
|
if (t)
|
|
2213
2245
|
for (const r of t)
|
|
2214
2246
|
r(e);
|
|
@@ -2271,7 +2303,7 @@ class BasePHP {
|
|
|
2271
2303
|
}
|
|
2272
2304
|
/** @inheritDoc */
|
|
2273
2305
|
setPhpIniPath(e) {
|
|
2274
|
-
if (H(this,
|
|
2306
|
+
if (H(this, be))
|
|
2275
2307
|
throw new Error("Cannot set PHP ini path after calling run().");
|
|
2276
2308
|
te(this, Ze, e), this[__private__dont__use].ccall(
|
|
2277
2309
|
"wasm_set_phpini_path",
|
|
@@ -2282,7 +2314,7 @@ class BasePHP {
|
|
|
2282
2314
|
}
|
|
2283
2315
|
/** @inheritDoc */
|
|
2284
2316
|
setPhpIniEntry(e, t) {
|
|
2285
|
-
if (H(this,
|
|
2317
|
+
if (H(this, be))
|
|
2286
2318
|
throw new Error("Cannot set PHP ini entries after calling run().");
|
|
2287
2319
|
H(this, Me).push([e, t]);
|
|
2288
2320
|
}
|
|
@@ -2301,22 +2333,29 @@ class BasePHP {
|
|
|
2301
2333
|
const t = await this.semaphore.acquire();
|
|
2302
2334
|
let r;
|
|
2303
2335
|
try {
|
|
2304
|
-
H(this,
|
|
2336
|
+
if (H(this, be) || (ce(this, $t, Gt).call(this), te(this, be, !0)), e.scriptPath && !this.fileExists(e.scriptPath))
|
|
2337
|
+
throw new Error(
|
|
2338
|
+
`The script path "${e.scriptPath}" does not exist.`
|
|
2339
|
+
);
|
|
2340
|
+
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");
|
|
2305
2341
|
const n = normalizeHeaders(e.headers || {}), s = n.host || "example.com:443";
|
|
2306
|
-
ce(this, wt,
|
|
2307
|
-
const i =
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2342
|
+
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);
|
|
2343
|
+
const i = e.env || {};
|
|
2344
|
+
for (const c in i)
|
|
2345
|
+
ce(this, Tt, rr).call(this, c, i[c]);
|
|
2346
|
+
const o = await ce(this, Ct, sr).call(this);
|
|
2347
|
+
if (e.throwOnError && o.exitCode !== 0) {
|
|
2348
|
+
const c = {
|
|
2349
|
+
stdout: o.text,
|
|
2350
|
+
stderr: o.errors
|
|
2312
2351
|
};
|
|
2313
|
-
console.warn("PHP.run() output was:",
|
|
2314
|
-
const
|
|
2315
|
-
`PHP.run() failed with exit code ${
|
|
2352
|
+
console.warn("PHP.run() output was:", c);
|
|
2353
|
+
const d = new Error(
|
|
2354
|
+
`PHP.run() failed with exit code ${o.exitCode} and the following output: ` + o.errors
|
|
2316
2355
|
);
|
|
2317
|
-
throw
|
|
2356
|
+
throw d.output = c, console.error(d), d;
|
|
2318
2357
|
}
|
|
2319
|
-
return
|
|
2358
|
+
return o;
|
|
2320
2359
|
} finally {
|
|
2321
2360
|
try {
|
|
2322
2361
|
r && this[__private__dont__use].free(r);
|
|
@@ -2334,12 +2373,12 @@ class BasePHP {
|
|
|
2334
2373
|
let r = {};
|
|
2335
2374
|
try {
|
|
2336
2375
|
r = JSON.parse(
|
|
2337
|
-
this.fileExists("/
|
|
2376
|
+
this.fileExists("/internal/consts.json") && this.readFileAsText("/internal/consts.json") || "{}"
|
|
2338
2377
|
);
|
|
2339
2378
|
} catch {
|
|
2340
2379
|
}
|
|
2341
2380
|
this.writeFile(
|
|
2342
|
-
"/
|
|
2381
|
+
"/internal/consts.json",
|
|
2343
2382
|
JSON.stringify({
|
|
2344
2383
|
...r,
|
|
2345
2384
|
[e]: t
|
|
@@ -2426,7 +2465,7 @@ class BasePHP {
|
|
|
2426
2465
|
}
|
|
2427
2466
|
if (this.initializeRuntime(e), H(this, Ze) && this.setPhpIniPath(H(this, Ze)), H(this, Ye) && this.setSapiName(H(this, Ye)), this.requestHandler) {
|
|
2428
2467
|
const r = this.documentRoot;
|
|
2429
|
-
|
|
2468
|
+
copyFS(t, this[__private__dont__use].FS, r);
|
|
2430
2469
|
}
|
|
2431
2470
|
}
|
|
2432
2471
|
exit(e = 0) {
|
|
@@ -2437,15 +2476,15 @@ class BasePHP {
|
|
|
2437
2476
|
this[__private__dont__use]._exit(e);
|
|
2438
2477
|
} catch {
|
|
2439
2478
|
}
|
|
2440
|
-
te(this,
|
|
2479
|
+
te(this, be, !1), te(this, Re, null), delete this[__private__dont__use].onMessage, delete this[__private__dont__use];
|
|
2441
2480
|
}
|
|
2442
2481
|
}
|
|
2443
|
-
Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(),
|
|
2444
|
-
if (this.setPhpIniEntry("auto_prepend_file", "/
|
|
2445
|
-
"/
|
|
2482
|
+
Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), be = new WeakMap(), Re = new WeakMap(), Te = new WeakMap(), Ee = new WeakMap(), Xe = new WeakMap(), $t = new WeakSet(), Gt = function() {
|
|
2483
|
+
if (this.setPhpIniEntry("auto_prepend_file", "/internal/consts.php"), this.fileExists("/internal/consts.php") || this.writeFile(
|
|
2484
|
+
"/internal/consts.php",
|
|
2446
2485
|
`<?php
|
|
2447
|
-
if(file_exists('/
|
|
2448
|
-
$consts = json_decode(file_get_contents('/
|
|
2486
|
+
if(file_exists('/internal/consts.json')) {
|
|
2487
|
+
$consts = json_decode(file_get_contents('/internal/consts.json'), true);
|
|
2449
2488
|
foreach ($consts as $const => $value) {
|
|
2450
2489
|
if (!defined($const) && is_scalar($value)) {
|
|
2451
2490
|
define($const, $value);
|
|
@@ -2465,8 +2504,8 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(),
|
|
|
2465
2504
|
);
|
|
2466
2505
|
}
|
|
2467
2506
|
this[__private__dont__use].ccall("php_wasm_init", null, [], []);
|
|
2468
|
-
}, yt = new WeakSet(),
|
|
2469
|
-
const e = "/
|
|
2507
|
+
}, yt = new WeakSet(), Kt = function() {
|
|
2508
|
+
const e = "/internal/headers.json";
|
|
2470
2509
|
if (!this.fileExists(e))
|
|
2471
2510
|
throw new Error(
|
|
2472
2511
|
"SAPI Error: Could not find response headers file."
|
|
@@ -2482,7 +2521,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(),
|
|
|
2482
2521
|
headers: r,
|
|
2483
2522
|
httpStatusCode: t.status
|
|
2484
2523
|
};
|
|
2485
|
-
}, vt = new WeakSet(),
|
|
2524
|
+
}, vt = new WeakSet(), Jt = function(e) {
|
|
2486
2525
|
if (this[__private__dont__use].ccall(
|
|
2487
2526
|
"wasm_set_request_uri",
|
|
2488
2527
|
null,
|
|
@@ -2497,7 +2536,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(),
|
|
|
2497
2536
|
[t]
|
|
2498
2537
|
);
|
|
2499
2538
|
}
|
|
2500
|
-
}, wt = new WeakSet(),
|
|
2539
|
+
}, wt = new WeakSet(), Qt = function(e, t) {
|
|
2501
2540
|
this[__private__dont__use].ccall(
|
|
2502
2541
|
"wasm_set_request_host",
|
|
2503
2542
|
null,
|
|
@@ -2515,14 +2554,14 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(),
|
|
|
2515
2554
|
[NUMBER],
|
|
2516
2555
|
[r]
|
|
2517
2556
|
), (t === "https" || !t && r === 443) && this.addServerGlobalEntry("HTTPS", "on");
|
|
2518
|
-
}, Pt = new WeakSet(),
|
|
2557
|
+
}, Pt = new WeakSet(), Zt = function(e) {
|
|
2519
2558
|
this[__private__dont__use].ccall(
|
|
2520
2559
|
"wasm_set_request_method",
|
|
2521
2560
|
null,
|
|
2522
2561
|
[STRING],
|
|
2523
2562
|
[e]
|
|
2524
2563
|
);
|
|
2525
|
-
}, bt = new WeakSet(),
|
|
2564
|
+
}, bt = new WeakSet(), Yt = function(e) {
|
|
2526
2565
|
e.cookie && this[__private__dont__use].ccall(
|
|
2527
2566
|
"wasm_set_cookies",
|
|
2528
2567
|
null,
|
|
@@ -2546,7 +2585,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(),
|
|
|
2546
2585
|
e[t]
|
|
2547
2586
|
);
|
|
2548
2587
|
}
|
|
2549
|
-
}, Et = new WeakSet(),
|
|
2588
|
+
}, Et = new WeakSet(), Xt = function(e) {
|
|
2550
2589
|
let t, r;
|
|
2551
2590
|
typeof e == "string" ? (console.warn(
|
|
2552
2591
|
"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"
|
|
@@ -2569,14 +2608,14 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(),
|
|
|
2569
2608
|
[NUMBER],
|
|
2570
2609
|
[r]
|
|
2571
2610
|
), n;
|
|
2572
|
-
}, St = new WeakSet(),
|
|
2611
|
+
}, St = new WeakSet(), er = function(e) {
|
|
2573
2612
|
this[__private__dont__use].ccall(
|
|
2574
2613
|
"wasm_set_path_translated",
|
|
2575
2614
|
null,
|
|
2576
2615
|
[STRING],
|
|
2577
2616
|
[e]
|
|
2578
2617
|
);
|
|
2579
|
-
}, Rt = new WeakSet(),
|
|
2618
|
+
}, Rt = new WeakSet(), tr = function() {
|
|
2580
2619
|
for (const e in H(this, Te))
|
|
2581
2620
|
this[__private__dont__use].ccall(
|
|
2582
2621
|
"wasm_add_SERVER_entry",
|
|
@@ -2584,34 +2623,42 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(),
|
|
|
2584
2623
|
[STRING, STRING],
|
|
2585
2624
|
[e, H(this, Te)[e]]
|
|
2586
2625
|
);
|
|
2587
|
-
}, Tt = new WeakSet(),
|
|
2626
|
+
}, Tt = new WeakSet(), rr = function(e, t) {
|
|
2627
|
+
this[__private__dont__use].ccall(
|
|
2628
|
+
"wasm_add_ENV_entry",
|
|
2629
|
+
null,
|
|
2630
|
+
[STRING, STRING],
|
|
2631
|
+
[e, t]
|
|
2632
|
+
);
|
|
2633
|
+
}, kt = new WeakSet(), nr = function(e) {
|
|
2588
2634
|
this[__private__dont__use].ccall(
|
|
2589
2635
|
"wasm_set_php_code",
|
|
2590
2636
|
null,
|
|
2591
2637
|
[STRING],
|
|
2592
2638
|
[e]
|
|
2593
2639
|
);
|
|
2594
|
-
},
|
|
2640
|
+
}, Ct = new WeakSet(), sr = async function() {
|
|
2595
2641
|
var s;
|
|
2596
2642
|
let e, t;
|
|
2597
2643
|
try {
|
|
2598
2644
|
e = await new Promise((i, o) => {
|
|
2599
2645
|
var d;
|
|
2600
2646
|
t = (u) => {
|
|
2647
|
+
console.error(u), console.error(u.error);
|
|
2601
2648
|
const p = new Error("Rethrown");
|
|
2602
2649
|
p.cause = u.error, p.betterMessage = u.message, o(p);
|
|
2603
2650
|
}, (d = H(this, Re)) == null || d.addEventListener(
|
|
2604
2651
|
"error",
|
|
2605
2652
|
t
|
|
2606
2653
|
);
|
|
2607
|
-
const
|
|
2654
|
+
const c = this[__private__dont__use].ccall(
|
|
2608
2655
|
"wasm_sapi_handle_request",
|
|
2609
2656
|
NUMBER,
|
|
2610
2657
|
[],
|
|
2611
2658
|
[],
|
|
2612
2659
|
{ async: !0 }
|
|
2613
2660
|
);
|
|
2614
|
-
return
|
|
2661
|
+
return c instanceof Promise ? c.then(i, o) : i(c);
|
|
2615
2662
|
});
|
|
2616
2663
|
} catch (i) {
|
|
2617
2664
|
for (const u in this)
|
|
@@ -2621,17 +2668,17 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(),
|
|
|
2621
2668
|
);
|
|
2622
2669
|
});
|
|
2623
2670
|
this.functionsMaybeMissingFromAsyncify = getFunctionsMaybeMissingFromAsyncify();
|
|
2624
|
-
const o = i,
|
|
2625
|
-
throw d.cause = o, d;
|
|
2671
|
+
const o = i, c = "betterMessage" in o ? o.betterMessage : o.message, d = new Error(c);
|
|
2672
|
+
throw d.cause = o, console.error(d), d;
|
|
2626
2673
|
} finally {
|
|
2627
2674
|
(s = H(this, Re)) == null || s.removeEventListener("error", t), te(this, Te, {});
|
|
2628
2675
|
}
|
|
2629
|
-
const { headers: r, httpStatusCode: n } = ce(this, yt,
|
|
2676
|
+
const { headers: r, httpStatusCode: n } = ce(this, yt, Kt).call(this);
|
|
2630
2677
|
return new PHPResponse(
|
|
2631
2678
|
n,
|
|
2632
2679
|
r,
|
|
2633
|
-
this.readFileAsBuffer("/
|
|
2634
|
-
this.readFileAsText("/
|
|
2680
|
+
this.readFileAsBuffer("/internal/stdout"),
|
|
2681
|
+
this.readFileAsText("/internal/stderr"),
|
|
2635
2682
|
e
|
|
2636
2683
|
);
|
|
2637
2684
|
};
|
|
@@ -2671,28 +2718,23 @@ function normalizeHeaders(e) {
|
|
|
2671
2718
|
t[r.toLowerCase()] = e[r];
|
|
2672
2719
|
return t;
|
|
2673
2720
|
}
|
|
2674
|
-
function
|
|
2721
|
+
function copyFS(e, t, r) {
|
|
2675
2722
|
let n;
|
|
2676
2723
|
try {
|
|
2677
|
-
n =
|
|
2724
|
+
n = e.lookupPath(r);
|
|
2678
2725
|
} catch {
|
|
2679
2726
|
return;
|
|
2680
2727
|
}
|
|
2681
2728
|
if (!("contents" in n.node))
|
|
2682
2729
|
return;
|
|
2683
|
-
|
|
2684
|
-
|
|
2730
|
+
if (!e.isDir(n.node.mode)) {
|
|
2731
|
+
t.writeFile(r, e.readFile(r));
|
|
2685
2732
|
return;
|
|
2686
|
-
} catch {
|
|
2687
2733
|
}
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
return;
|
|
2691
|
-
}
|
|
2692
|
-
e.mkdirTree(r);
|
|
2693
|
-
const s = t.readdir(r).filter((i) => i !== "." && i !== "..");
|
|
2734
|
+
t.mkdirTree(r);
|
|
2735
|
+
const s = e.readdir(r).filter((i) => i !== "." && i !== "..");
|
|
2694
2736
|
for (const i of s)
|
|
2695
|
-
|
|
2737
|
+
copyFS(e, t, joinPaths(r, i));
|
|
2696
2738
|
}
|
|
2697
2739
|
const ResourceTypes = [
|
|
2698
2740
|
"vfs",
|
|
@@ -2928,10 +2970,10 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
2928
2970
|
}
|
|
2929
2971
|
e._CodeOrName = t, e.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
|
|
2930
2972
|
class r extends t {
|
|
2931
|
-
constructor(
|
|
2932
|
-
if (super(), !e.IDENTIFIER.test(
|
|
2973
|
+
constructor(k) {
|
|
2974
|
+
if (super(), !e.IDENTIFIER.test(k))
|
|
2933
2975
|
throw new Error("CodeGen: name must be a valid identifier");
|
|
2934
|
-
this.str =
|
|
2976
|
+
this.str = k;
|
|
2935
2977
|
}
|
|
2936
2978
|
toString() {
|
|
2937
2979
|
return this.str;
|
|
@@ -2945,8 +2987,8 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
2945
2987
|
}
|
|
2946
2988
|
e.Name = r;
|
|
2947
2989
|
class n extends t {
|
|
2948
|
-
constructor(
|
|
2949
|
-
super(), this._items = typeof
|
|
2990
|
+
constructor(k) {
|
|
2991
|
+
super(), this._items = typeof k == "string" ? [k] : k;
|
|
2950
2992
|
}
|
|
2951
2993
|
toString() {
|
|
2952
2994
|
return this.str;
|
|
@@ -2954,69 +2996,69 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
2954
2996
|
emptyStr() {
|
|
2955
2997
|
if (this._items.length > 1)
|
|
2956
2998
|
return !1;
|
|
2957
|
-
const
|
|
2958
|
-
return
|
|
2999
|
+
const k = this._items[0];
|
|
3000
|
+
return k === "" || k === '""';
|
|
2959
3001
|
}
|
|
2960
3002
|
get str() {
|
|
2961
|
-
var
|
|
2962
|
-
return (
|
|
3003
|
+
var k;
|
|
3004
|
+
return (k = this._str) !== null && k !== void 0 ? k : this._str = this._items.reduce((S, I) => `${S}${I}`, "");
|
|
2963
3005
|
}
|
|
2964
3006
|
get names() {
|
|
2965
|
-
var
|
|
2966
|
-
return (
|
|
3007
|
+
var k;
|
|
3008
|
+
return (k = this._names) !== null && k !== void 0 ? k : this._names = this._items.reduce((S, I) => (I instanceof r && (S[I.str] = (S[I.str] || 0) + 1), S), {});
|
|
2967
3009
|
}
|
|
2968
3010
|
}
|
|
2969
3011
|
e._Code = n, e.nil = new n("");
|
|
2970
|
-
function s(m, ...
|
|
2971
|
-
const
|
|
3012
|
+
function s(m, ...k) {
|
|
3013
|
+
const S = [m[0]];
|
|
2972
3014
|
let I = 0;
|
|
2973
|
-
for (; I <
|
|
2974
|
-
|
|
2975
|
-
return new n(
|
|
3015
|
+
for (; I < k.length; )
|
|
3016
|
+
c(S, k[I]), S.push(m[++I]);
|
|
3017
|
+
return new n(S);
|
|
2976
3018
|
}
|
|
2977
3019
|
e._ = s;
|
|
2978
3020
|
const i = new n("+");
|
|
2979
|
-
function o(m, ...
|
|
2980
|
-
const
|
|
3021
|
+
function o(m, ...k) {
|
|
3022
|
+
const S = [O(m[0])];
|
|
2981
3023
|
let I = 0;
|
|
2982
|
-
for (; I <
|
|
2983
|
-
|
|
2984
|
-
return d(
|
|
3024
|
+
for (; I < k.length; )
|
|
3025
|
+
S.push(i), c(S, k[I]), S.push(i, O(m[++I]));
|
|
3026
|
+
return d(S), new n(S);
|
|
2985
3027
|
}
|
|
2986
3028
|
e.str = o;
|
|
2987
|
-
function
|
|
2988
|
-
|
|
3029
|
+
function c(m, k) {
|
|
3030
|
+
k instanceof n ? m.push(...k._items) : k instanceof r ? m.push(k) : m.push(_(k));
|
|
2989
3031
|
}
|
|
2990
|
-
e.addCodeArg =
|
|
3032
|
+
e.addCodeArg = c;
|
|
2991
3033
|
function d(m) {
|
|
2992
|
-
let
|
|
2993
|
-
for (;
|
|
2994
|
-
if (m[
|
|
2995
|
-
const
|
|
2996
|
-
if (
|
|
2997
|
-
m.splice(
|
|
3034
|
+
let k = 1;
|
|
3035
|
+
for (; k < m.length - 1; ) {
|
|
3036
|
+
if (m[k] === i) {
|
|
3037
|
+
const S = u(m[k - 1], m[k + 1]);
|
|
3038
|
+
if (S !== void 0) {
|
|
3039
|
+
m.splice(k - 1, 3, S);
|
|
2998
3040
|
continue;
|
|
2999
3041
|
}
|
|
3000
|
-
m[
|
|
3042
|
+
m[k++] = "+";
|
|
3001
3043
|
}
|
|
3002
|
-
|
|
3044
|
+
k++;
|
|
3003
3045
|
}
|
|
3004
3046
|
}
|
|
3005
|
-
function u(m,
|
|
3006
|
-
if (
|
|
3047
|
+
function u(m, k) {
|
|
3048
|
+
if (k === '""')
|
|
3007
3049
|
return m;
|
|
3008
3050
|
if (m === '""')
|
|
3009
|
-
return
|
|
3051
|
+
return k;
|
|
3010
3052
|
if (typeof m == "string")
|
|
3011
|
-
return
|
|
3012
|
-
if (typeof
|
|
3013
|
-
return `"${m}${
|
|
3053
|
+
return k instanceof r || m[m.length - 1] !== '"' ? void 0 : typeof k != "string" ? `${m.slice(0, -1)}${k}"` : k[0] === '"' ? m.slice(0, -1) + k.slice(1) : void 0;
|
|
3054
|
+
if (typeof k == "string" && k[0] === '"' && !(m instanceof r))
|
|
3055
|
+
return `"${m}${k.slice(1)}`;
|
|
3014
3056
|
}
|
|
3015
|
-
function p(m,
|
|
3016
|
-
return
|
|
3057
|
+
function p(m, k) {
|
|
3058
|
+
return k.emptyStr() ? m : m.emptyStr() ? k : o`${m}${k}`;
|
|
3017
3059
|
}
|
|
3018
3060
|
e.strConcat = p;
|
|
3019
|
-
function
|
|
3061
|
+
function _(m) {
|
|
3020
3062
|
return typeof m == "number" || typeof m == "boolean" || m === null ? m : O(Array.isArray(m) ? m.join(",") : m);
|
|
3021
3063
|
}
|
|
3022
3064
|
function R(m) {
|
|
@@ -3027,10 +3069,10 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3027
3069
|
return JSON.stringify(m).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
3028
3070
|
}
|
|
3029
3071
|
e.safeStringify = O;
|
|
3030
|
-
function
|
|
3072
|
+
function T(m) {
|
|
3031
3073
|
return typeof m == "string" && e.IDENTIFIER.test(m) ? new n(`.${m}`) : s`[${m}]`;
|
|
3032
3074
|
}
|
|
3033
|
-
e.getProperty =
|
|
3075
|
+
e.getProperty = T;
|
|
3034
3076
|
function v(m) {
|
|
3035
3077
|
if (typeof m == "string" && e.IDENTIFIER.test(m))
|
|
3036
3078
|
return new n(`${m}`);
|
|
@@ -3074,8 +3116,8 @@ var scope = {};
|
|
|
3074
3116
|
return `${u}${p.index++}`;
|
|
3075
3117
|
}
|
|
3076
3118
|
_nameGroup(u) {
|
|
3077
|
-
var p,
|
|
3078
|
-
if (!((
|
|
3119
|
+
var p, _;
|
|
3120
|
+
if (!((_ = (p = this._parent) === null || p === void 0 ? void 0 : p._prefixes) === null || _ === void 0) && _.has(u) || this._prefixes && !this._prefixes.has(u))
|
|
3079
3121
|
throw new Error(`CodeGen: prefix "${u}" is not allowed in this scope`);
|
|
3080
3122
|
return this._names[u] = { prefix: u, index: 0 };
|
|
3081
3123
|
}
|
|
@@ -3085,13 +3127,13 @@ var scope = {};
|
|
|
3085
3127
|
constructor(u, p) {
|
|
3086
3128
|
super(p), this.prefix = u;
|
|
3087
3129
|
}
|
|
3088
|
-
setValue(u, { property: p, itemIndex:
|
|
3089
|
-
this.value = u, this.scopePath = (0, t._)`.${new t.Name(p)}[${
|
|
3130
|
+
setValue(u, { property: p, itemIndex: _ }) {
|
|
3131
|
+
this.value = u, this.scopePath = (0, t._)`.${new t.Name(p)}[${_}]`;
|
|
3090
3132
|
}
|
|
3091
3133
|
}
|
|
3092
3134
|
e.ValueScopeName = i;
|
|
3093
3135
|
const o = (0, t._)`\n`;
|
|
3094
|
-
class
|
|
3136
|
+
class c extends s {
|
|
3095
3137
|
constructor(u) {
|
|
3096
3138
|
super(u), this._values = {}, this._scope = u.scope, this.opts = { ...u, _n: u.lines ? o : t.nil };
|
|
3097
3139
|
}
|
|
@@ -3102,57 +3144,57 @@ var scope = {};
|
|
|
3102
3144
|
return new i(u, this._newName(u));
|
|
3103
3145
|
}
|
|
3104
3146
|
value(u, p) {
|
|
3105
|
-
var
|
|
3147
|
+
var _;
|
|
3106
3148
|
if (p.ref === void 0)
|
|
3107
3149
|
throw new Error("CodeGen: ref must be passed in value");
|
|
3108
|
-
const R = this.toName(u), { prefix: O } = R,
|
|
3150
|
+
const R = this.toName(u), { prefix: O } = R, T = (_ = p.key) !== null && _ !== void 0 ? _ : p.ref;
|
|
3109
3151
|
let v = this._values[O];
|
|
3110
3152
|
if (v) {
|
|
3111
|
-
const
|
|
3112
|
-
if (
|
|
3113
|
-
return
|
|
3153
|
+
const k = v.get(T);
|
|
3154
|
+
if (k)
|
|
3155
|
+
return k;
|
|
3114
3156
|
} else
|
|
3115
3157
|
v = this._values[O] = /* @__PURE__ */ new Map();
|
|
3116
|
-
v.set(
|
|
3158
|
+
v.set(T, R);
|
|
3117
3159
|
const $ = this._scope[O] || (this._scope[O] = []), m = $.length;
|
|
3118
3160
|
return $[m] = p.ref, R.setValue(p, { property: O, itemIndex: m }), R;
|
|
3119
3161
|
}
|
|
3120
3162
|
getValue(u, p) {
|
|
3121
|
-
const
|
|
3122
|
-
if (
|
|
3123
|
-
return
|
|
3163
|
+
const _ = this._values[u];
|
|
3164
|
+
if (_)
|
|
3165
|
+
return _.get(p);
|
|
3124
3166
|
}
|
|
3125
3167
|
scopeRefs(u, p = this._values) {
|
|
3126
|
-
return this._reduceValues(p, (
|
|
3127
|
-
if (
|
|
3128
|
-
throw new Error(`CodeGen: name "${
|
|
3129
|
-
return (0, t._)`${u}${
|
|
3168
|
+
return this._reduceValues(p, (_) => {
|
|
3169
|
+
if (_.scopePath === void 0)
|
|
3170
|
+
throw new Error(`CodeGen: name "${_}" has no value`);
|
|
3171
|
+
return (0, t._)`${u}${_.scopePath}`;
|
|
3130
3172
|
});
|
|
3131
3173
|
}
|
|
3132
|
-
scopeCode(u = this._values, p,
|
|
3174
|
+
scopeCode(u = this._values, p, _) {
|
|
3133
3175
|
return this._reduceValues(u, (R) => {
|
|
3134
3176
|
if (R.value === void 0)
|
|
3135
3177
|
throw new Error(`CodeGen: name "${R}" has no value`);
|
|
3136
3178
|
return R.value.code;
|
|
3137
|
-
}, p,
|
|
3179
|
+
}, p, _);
|
|
3138
3180
|
}
|
|
3139
|
-
_reduceValues(u, p,
|
|
3181
|
+
_reduceValues(u, p, _ = {}, R) {
|
|
3140
3182
|
let O = t.nil;
|
|
3141
|
-
for (const
|
|
3142
|
-
const v = u[
|
|
3183
|
+
for (const T in u) {
|
|
3184
|
+
const v = u[T];
|
|
3143
3185
|
if (!v)
|
|
3144
3186
|
continue;
|
|
3145
|
-
const $ =
|
|
3187
|
+
const $ = _[T] = _[T] || /* @__PURE__ */ new Map();
|
|
3146
3188
|
v.forEach((m) => {
|
|
3147
3189
|
if ($.has(m))
|
|
3148
3190
|
return;
|
|
3149
3191
|
$.set(m, n.Started);
|
|
3150
|
-
let
|
|
3151
|
-
if (
|
|
3152
|
-
const
|
|
3153
|
-
O = (0, t._)`${O}${
|
|
3154
|
-
} else if (
|
|
3155
|
-
O = (0, t._)`${O}${
|
|
3192
|
+
let k = p(m);
|
|
3193
|
+
if (k) {
|
|
3194
|
+
const S = this.opts.es5 ? e.varKinds.var : e.varKinds.const;
|
|
3195
|
+
O = (0, t._)`${O}${S} ${m} = ${k};${this.opts._n}`;
|
|
3196
|
+
} else if (k = R == null ? void 0 : R(m))
|
|
3197
|
+
O = (0, t._)`${O}${k}${this.opts._n}`;
|
|
3156
3198
|
else
|
|
3157
3199
|
throw new r(m);
|
|
3158
3200
|
$.set(m, n.Completed);
|
|
@@ -3161,7 +3203,7 @@ var scope = {};
|
|
|
3161
3203
|
return O;
|
|
3162
3204
|
}
|
|
3163
3205
|
}
|
|
3164
|
-
e.ValueScope =
|
|
3206
|
+
e.ValueScope = c;
|
|
3165
3207
|
})(scope);
|
|
3166
3208
|
(function(e) {
|
|
3167
3209
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.or = e.and = e.not = e.CodeGen = e.operators = e.varKinds = e.ValueScopeName = e.ValueScope = e.Scope = e.Name = e.regexpCode = e.stringify = e.getProperty = e.nil = e.strConcat = e.str = e._ = void 0;
|
|
@@ -3229,7 +3271,7 @@ var scope = {};
|
|
|
3229
3271
|
return this.rhs instanceof t._CodeOrName ? this.rhs.names : {};
|
|
3230
3272
|
}
|
|
3231
3273
|
}
|
|
3232
|
-
class
|
|
3274
|
+
class c extends i {
|
|
3233
3275
|
constructor(a, h, N) {
|
|
3234
3276
|
super(), this.lhs = a, this.rhs = h, this.sideEffects = N;
|
|
3235
3277
|
}
|
|
@@ -3245,7 +3287,7 @@ var scope = {};
|
|
|
3245
3287
|
return ue(a, this.rhs);
|
|
3246
3288
|
}
|
|
3247
3289
|
}
|
|
3248
|
-
class d extends
|
|
3290
|
+
class d extends c {
|
|
3249
3291
|
constructor(a, h, N, M) {
|
|
3250
3292
|
super(a, N, M), this.op = h;
|
|
3251
3293
|
}
|
|
@@ -3269,7 +3311,7 @@ var scope = {};
|
|
|
3269
3311
|
return `break${this.label ? ` ${this.label}` : ""};` + a;
|
|
3270
3312
|
}
|
|
3271
3313
|
}
|
|
3272
|
-
class
|
|
3314
|
+
class _ extends i {
|
|
3273
3315
|
constructor(a) {
|
|
3274
3316
|
super(), this.error = a;
|
|
3275
3317
|
}
|
|
@@ -3326,17 +3368,17 @@ var scope = {};
|
|
|
3326
3368
|
return this.nodes.reduce((a, h) => K(a, h.names), {});
|
|
3327
3369
|
}
|
|
3328
3370
|
}
|
|
3329
|
-
class
|
|
3371
|
+
class T extends O {
|
|
3330
3372
|
render(a) {
|
|
3331
3373
|
return "{" + a._n + super.render(a) + "}" + a._n;
|
|
3332
3374
|
}
|
|
3333
3375
|
}
|
|
3334
3376
|
class v extends O {
|
|
3335
3377
|
}
|
|
3336
|
-
class $ extends
|
|
3378
|
+
class $ extends T {
|
|
3337
3379
|
}
|
|
3338
3380
|
$.kind = "else";
|
|
3339
|
-
class m extends
|
|
3381
|
+
class m extends T {
|
|
3340
3382
|
constructor(a, h) {
|
|
3341
3383
|
super(h), this.condition = a;
|
|
3342
3384
|
}
|
|
@@ -3370,10 +3412,10 @@ var scope = {};
|
|
|
3370
3412
|
}
|
|
3371
3413
|
}
|
|
3372
3414
|
m.kind = "if";
|
|
3373
|
-
class T extends S {
|
|
3374
|
-
}
|
|
3375
|
-
T.kind = "for";
|
|
3376
3415
|
class k extends T {
|
|
3416
|
+
}
|
|
3417
|
+
k.kind = "for";
|
|
3418
|
+
class S extends k {
|
|
3377
3419
|
constructor(a) {
|
|
3378
3420
|
super(), this.iteration = a;
|
|
3379
3421
|
}
|
|
@@ -3388,7 +3430,7 @@ var scope = {};
|
|
|
3388
3430
|
return K(super.names, this.iteration.names);
|
|
3389
3431
|
}
|
|
3390
3432
|
}
|
|
3391
|
-
class I extends
|
|
3433
|
+
class I extends k {
|
|
3392
3434
|
constructor(a, h, N, M) {
|
|
3393
3435
|
super(), this.varKind = a, this.name = h, this.from = N, this.to = M;
|
|
3394
3436
|
}
|
|
@@ -3401,7 +3443,7 @@ var scope = {};
|
|
|
3401
3443
|
return ue(a, this.to);
|
|
3402
3444
|
}
|
|
3403
3445
|
}
|
|
3404
|
-
class D extends
|
|
3446
|
+
class D extends k {
|
|
3405
3447
|
constructor(a, h, N, M) {
|
|
3406
3448
|
super(), this.loop = a, this.varKind = h, this.name = N, this.iterable = M;
|
|
3407
3449
|
}
|
|
@@ -3416,7 +3458,7 @@ var scope = {};
|
|
|
3416
3458
|
return K(super.names, this.iterable.names);
|
|
3417
3459
|
}
|
|
3418
3460
|
}
|
|
3419
|
-
class w extends
|
|
3461
|
+
class w extends T {
|
|
3420
3462
|
constructor(a, h, N) {
|
|
3421
3463
|
super(), this.name = a, this.args = h, this.async = N;
|
|
3422
3464
|
}
|
|
@@ -3431,7 +3473,7 @@ var scope = {};
|
|
|
3431
3473
|
}
|
|
3432
3474
|
}
|
|
3433
3475
|
C.kind = "return";
|
|
3434
|
-
class A extends
|
|
3476
|
+
class A extends T {
|
|
3435
3477
|
render(a) {
|
|
3436
3478
|
let h = "try" + super.render(a);
|
|
3437
3479
|
return this.catch && (h += this.catch.render(a)), this.finally && (h += this.finally.render(a)), h;
|
|
@@ -3449,7 +3491,7 @@ var scope = {};
|
|
|
3449
3491
|
return this.catch && K(a, this.catch.names), this.finally && K(a, this.finally.names), a;
|
|
3450
3492
|
}
|
|
3451
3493
|
}
|
|
3452
|
-
class V extends
|
|
3494
|
+
class V extends T {
|
|
3453
3495
|
constructor(a) {
|
|
3454
3496
|
super(), this.error = a;
|
|
3455
3497
|
}
|
|
@@ -3458,12 +3500,12 @@ var scope = {};
|
|
|
3458
3500
|
}
|
|
3459
3501
|
}
|
|
3460
3502
|
V.kind = "catch";
|
|
3461
|
-
class
|
|
3503
|
+
class z extends T {
|
|
3462
3504
|
render(a) {
|
|
3463
3505
|
return "finally" + super.render(a);
|
|
3464
3506
|
}
|
|
3465
3507
|
}
|
|
3466
|
-
|
|
3508
|
+
z.kind = "finally";
|
|
3467
3509
|
class re {
|
|
3468
3510
|
constructor(a, h = {}) {
|
|
3469
3511
|
this._values = {}, this._blockStarts = [], this._constants = {}, this.opts = { ...h, _n: h.lines ? `
|
|
@@ -3514,7 +3556,7 @@ var scope = {};
|
|
|
3514
3556
|
}
|
|
3515
3557
|
// assignment code
|
|
3516
3558
|
assign(a, h, N) {
|
|
3517
|
-
return this._leafNode(new
|
|
3559
|
+
return this._leafNode(new c(a, h, N));
|
|
3518
3560
|
}
|
|
3519
3561
|
// `+=` code
|
|
3520
3562
|
add(a, h) {
|
|
@@ -3558,7 +3600,7 @@ var scope = {};
|
|
|
3558
3600
|
}
|
|
3559
3601
|
// a generic `for` clause (or statement if `forBody` is passed)
|
|
3560
3602
|
for(a, h) {
|
|
3561
|
-
return this._for(new
|
|
3603
|
+
return this._for(new S(a), h);
|
|
3562
3604
|
}
|
|
3563
3605
|
// `for` statement for a range of values
|
|
3564
3606
|
forRange(a, h, N, M, q = this.opts.es5 ? r.varKinds.var : r.varKinds.let) {
|
|
@@ -3586,7 +3628,7 @@ var scope = {};
|
|
|
3586
3628
|
}
|
|
3587
3629
|
// end `for` loop
|
|
3588
3630
|
endFor() {
|
|
3589
|
-
return this._endBlockNode(
|
|
3631
|
+
return this._endBlockNode(k);
|
|
3590
3632
|
}
|
|
3591
3633
|
// `label` statement
|
|
3592
3634
|
label(a) {
|
|
@@ -3612,11 +3654,11 @@ var scope = {};
|
|
|
3612
3654
|
const q = this.name("e");
|
|
3613
3655
|
this._currNode = M.catch = new V(q), h(q);
|
|
3614
3656
|
}
|
|
3615
|
-
return N && (this._currNode = M.finally = new
|
|
3657
|
+
return N && (this._currNode = M.finally = new z(), this.code(N)), this._endBlockNode(V, z);
|
|
3616
3658
|
}
|
|
3617
3659
|
// `throw` statement
|
|
3618
3660
|
throw(a) {
|
|
3619
|
-
return this._leafNode(new
|
|
3661
|
+
return this._leafNode(new _(a));
|
|
3620
3662
|
}
|
|
3621
3663
|
// start self-balancing block
|
|
3622
3664
|
block(a, h) {
|
|
@@ -3741,9 +3783,9 @@ var util = {};
|
|
|
3741
3783
|
const { opts: A, self: V } = w;
|
|
3742
3784
|
if (!A.strictSchema || typeof C == "boolean")
|
|
3743
3785
|
return;
|
|
3744
|
-
const
|
|
3786
|
+
const z = V.RULES.keywords;
|
|
3745
3787
|
for (const re in C)
|
|
3746
|
-
|
|
3788
|
+
z[re] || D(w, `unknown keyword: "${re}"`);
|
|
3747
3789
|
}
|
|
3748
3790
|
e.checkUnknownRules = i;
|
|
3749
3791
|
function o(w, C) {
|
|
@@ -3755,7 +3797,7 @@ var util = {};
|
|
|
3755
3797
|
return !1;
|
|
3756
3798
|
}
|
|
3757
3799
|
e.schemaHasRules = o;
|
|
3758
|
-
function
|
|
3800
|
+
function c(w, C) {
|
|
3759
3801
|
if (typeof w == "boolean")
|
|
3760
3802
|
return !w;
|
|
3761
3803
|
for (const A in w)
|
|
@@ -3763,9 +3805,9 @@ var util = {};
|
|
|
3763
3805
|
return !0;
|
|
3764
3806
|
return !1;
|
|
3765
3807
|
}
|
|
3766
|
-
e.schemaHasRulesButRef =
|
|
3767
|
-
function d({ topSchemaRef: w, schemaPath: C }, A, V,
|
|
3768
|
-
if (!
|
|
3808
|
+
e.schemaHasRulesButRef = c;
|
|
3809
|
+
function d({ topSchemaRef: w, schemaPath: C }, A, V, z) {
|
|
3810
|
+
if (!z) {
|
|
3769
3811
|
if (typeof A == "number" || typeof A == "boolean")
|
|
3770
3812
|
return A;
|
|
3771
3813
|
if (typeof A == "string")
|
|
@@ -3779,13 +3821,13 @@ var util = {};
|
|
|
3779
3821
|
}
|
|
3780
3822
|
e.unescapeFragment = u;
|
|
3781
3823
|
function p(w) {
|
|
3782
|
-
return encodeURIComponent(
|
|
3824
|
+
return encodeURIComponent(_(w));
|
|
3783
3825
|
}
|
|
3784
3826
|
e.escapeFragment = p;
|
|
3785
|
-
function
|
|
3827
|
+
function _(w) {
|
|
3786
3828
|
return typeof w == "number" ? `${w}` : w.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
3787
3829
|
}
|
|
3788
|
-
e.escapeJsonPointer =
|
|
3830
|
+
e.escapeJsonPointer = _;
|
|
3789
3831
|
function R(w) {
|
|
3790
3832
|
return w.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
3791
3833
|
}
|
|
@@ -3798,14 +3840,14 @@ var util = {};
|
|
|
3798
3840
|
C(w);
|
|
3799
3841
|
}
|
|
3800
3842
|
e.eachItem = O;
|
|
3801
|
-
function
|
|
3802
|
-
return (
|
|
3803
|
-
const oe = K === void 0 ? re : K instanceof t.Name ? (re instanceof t.Name ? w(
|
|
3804
|
-
return ue === t.Name && !(oe instanceof t.Name) ? V(
|
|
3843
|
+
function T({ mergeNames: w, mergeToName: C, mergeValues: A, resultToName: V }) {
|
|
3844
|
+
return (z, re, K, ue) => {
|
|
3845
|
+
const oe = K === void 0 ? re : K instanceof t.Name ? (re instanceof t.Name ? w(z, re, K) : C(z, re, K), K) : re instanceof t.Name ? (C(z, K, re), re) : A(re, K);
|
|
3846
|
+
return ue === t.Name && !(oe instanceof t.Name) ? V(z, oe) : oe;
|
|
3805
3847
|
};
|
|
3806
3848
|
}
|
|
3807
3849
|
e.mergeEvaluated = {
|
|
3808
|
-
props:
|
|
3850
|
+
props: T({
|
|
3809
3851
|
mergeNames: (w, C, A) => w.if((0, t._)`${A} !== true && ${C} !== undefined`, () => {
|
|
3810
3852
|
w.if((0, t._)`${C} === true`, () => w.assign(A, !0), () => w.assign(A, (0, t._)`${A} || {}`).code((0, t._)`Object.assign(${A}, ${C})`));
|
|
3811
3853
|
}),
|
|
@@ -3815,7 +3857,7 @@ var util = {};
|
|
|
3815
3857
|
mergeValues: (w, C) => w === !0 ? !0 : { ...w, ...C },
|
|
3816
3858
|
resultToName: v
|
|
3817
3859
|
}),
|
|
3818
|
-
items:
|
|
3860
|
+
items: T({
|
|
3819
3861
|
mergeNames: (w, C, A) => w.if((0, t._)`${A} !== true && ${C} !== undefined`, () => w.assign(A, (0, t._)`${C} === true ? true : ${A} > ${C} ? ${A} : ${C}`)),
|
|
3820
3862
|
mergeToName: (w, C, A) => w.if((0, t._)`${A} !== true`, () => w.assign(A, C === !0 ? !0 : (0, t._)`${A} > ${C} ? ${A} : ${C}`)),
|
|
3821
3863
|
mergeValues: (w, C) => w === !0 ? !0 : Math.max(w, C),
|
|
@@ -3834,23 +3876,23 @@ var util = {};
|
|
|
3834
3876
|
}
|
|
3835
3877
|
e.setEvaluated = $;
|
|
3836
3878
|
const m = {};
|
|
3837
|
-
function
|
|
3879
|
+
function k(w, C) {
|
|
3838
3880
|
return w.scopeValue("func", {
|
|
3839
3881
|
ref: C,
|
|
3840
3882
|
code: m[C.code] || (m[C.code] = new r._Code(C.code))
|
|
3841
3883
|
});
|
|
3842
3884
|
}
|
|
3843
|
-
e.useFunc =
|
|
3844
|
-
var
|
|
3885
|
+
e.useFunc = k;
|
|
3886
|
+
var S;
|
|
3845
3887
|
(function(w) {
|
|
3846
3888
|
w[w.Num = 0] = "Num", w[w.Str = 1] = "Str";
|
|
3847
|
-
})(
|
|
3889
|
+
})(S = e.Type || (e.Type = {}));
|
|
3848
3890
|
function I(w, C, A) {
|
|
3849
3891
|
if (w instanceof t.Name) {
|
|
3850
|
-
const V = C ===
|
|
3892
|
+
const V = C === S.Num;
|
|
3851
3893
|
return A ? V ? (0, t._)`"[" + ${w} + "]"` : (0, t._)`"['" + ${w} + "']"` : V ? (0, t._)`"/" + ${w}` : (0, t._)`"/" + ${w}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
|
|
3852
3894
|
}
|
|
3853
|
-
return A ? (0, t.getProperty)(w).toString() : "/" +
|
|
3895
|
+
return A ? (0, t.getProperty)(w).toString() : "/" + _(w);
|
|
3854
3896
|
}
|
|
3855
3897
|
e.getErrorPath = I;
|
|
3856
3898
|
function D(w, C, A = w.opts.strictSchema) {
|
|
@@ -3896,36 +3938,36 @@ names$1.default = names;
|
|
|
3896
3938
|
}, e.keyword$DataError = {
|
|
3897
3939
|
message: ({ keyword: $, schemaType: m }) => m ? (0, t.str)`"${$}" keyword must be ${m} ($data)` : (0, t.str)`"${$}" keyword is invalid ($data)`
|
|
3898
3940
|
};
|
|
3899
|
-
function s($, m = e.keywordError,
|
|
3900
|
-
const { it: I } = $, { gen: D, compositeRule: w, allErrors: C } = I, A =
|
|
3901
|
-
|
|
3941
|
+
function s($, m = e.keywordError, k, S) {
|
|
3942
|
+
const { it: I } = $, { gen: D, compositeRule: w, allErrors: C } = I, A = _($, m, k);
|
|
3943
|
+
S ?? (w || C) ? d(D, A) : u(I, (0, t._)`[${A}]`);
|
|
3902
3944
|
}
|
|
3903
3945
|
e.reportError = s;
|
|
3904
|
-
function i($, m = e.keywordError,
|
|
3905
|
-
const { it:
|
|
3906
|
-
d(I, C), D || w || u(
|
|
3946
|
+
function i($, m = e.keywordError, k) {
|
|
3947
|
+
const { it: S } = $, { gen: I, compositeRule: D, allErrors: w } = S, C = _($, m, k);
|
|
3948
|
+
d(I, C), D || w || u(S, n.default.vErrors);
|
|
3907
3949
|
}
|
|
3908
3950
|
e.reportExtraError = i;
|
|
3909
3951
|
function o($, m) {
|
|
3910
3952
|
$.assign(n.default.errors, m), $.if((0, t._)`${n.default.vErrors} !== null`, () => $.if(m, () => $.assign((0, t._)`${n.default.vErrors}.length`, m), () => $.assign(n.default.vErrors, null)));
|
|
3911
3953
|
}
|
|
3912
3954
|
e.resetErrorsCount = o;
|
|
3913
|
-
function
|
|
3955
|
+
function c({ gen: $, keyword: m, schemaValue: k, data: S, errsCount: I, it: D }) {
|
|
3914
3956
|
if (I === void 0)
|
|
3915
3957
|
throw new Error("ajv implementation error");
|
|
3916
3958
|
const w = $.name("err");
|
|
3917
3959
|
$.forRange("i", I, n.default.errors, (C) => {
|
|
3918
|
-
$.const(w, (0, t._)`${n.default.vErrors}[${C}]`), $.if((0, t._)`${w}.instancePath === undefined`, () => $.assign((0, t._)`${w}.instancePath`, (0, t.strConcat)(n.default.instancePath, D.errorPath))), $.assign((0, t._)`${w}.schemaPath`, (0, t.str)`${D.errSchemaPath}/${m}`), D.opts.verbose && ($.assign((0, t._)`${w}.schema`,
|
|
3960
|
+
$.const(w, (0, t._)`${n.default.vErrors}[${C}]`), $.if((0, t._)`${w}.instancePath === undefined`, () => $.assign((0, t._)`${w}.instancePath`, (0, t.strConcat)(n.default.instancePath, D.errorPath))), $.assign((0, t._)`${w}.schemaPath`, (0, t.str)`${D.errSchemaPath}/${m}`), D.opts.verbose && ($.assign((0, t._)`${w}.schema`, k), $.assign((0, t._)`${w}.data`, S));
|
|
3919
3961
|
});
|
|
3920
3962
|
}
|
|
3921
|
-
e.extendErrors =
|
|
3963
|
+
e.extendErrors = c;
|
|
3922
3964
|
function d($, m) {
|
|
3923
|
-
const
|
|
3924
|
-
$.if((0, t._)`${n.default.vErrors} === null`, () => $.assign(n.default.vErrors, (0, t._)`[${
|
|
3965
|
+
const k = $.const("err", m);
|
|
3966
|
+
$.if((0, t._)`${n.default.vErrors} === null`, () => $.assign(n.default.vErrors, (0, t._)`[${k}]`), (0, t._)`${n.default.vErrors}.push(${k})`), $.code((0, t._)`${n.default.errors}++`);
|
|
3925
3967
|
}
|
|
3926
3968
|
function u($, m) {
|
|
3927
|
-
const { gen:
|
|
3928
|
-
I.$async ?
|
|
3969
|
+
const { gen: k, validateName: S, schemaEnv: I } = $;
|
|
3970
|
+
I.$async ? k.throw((0, t._)`new ${$.ValidationError}(${m})`) : (k.assign((0, t._)`${S}.errors`, m), k.return(!1));
|
|
3929
3971
|
}
|
|
3930
3972
|
const p = {
|
|
3931
3973
|
keyword: new t.Name("keyword"),
|
|
@@ -3936,28 +3978,28 @@ names$1.default = names;
|
|
|
3936
3978
|
schema: new t.Name("schema"),
|
|
3937
3979
|
parentSchema: new t.Name("parentSchema")
|
|
3938
3980
|
};
|
|
3939
|
-
function
|
|
3940
|
-
const { createErrors:
|
|
3941
|
-
return
|
|
3942
|
-
}
|
|
3943
|
-
function R($, m,
|
|
3944
|
-
const { gen:
|
|
3945
|
-
O(I,
|
|
3946
|
-
|
|
3981
|
+
function _($, m, k) {
|
|
3982
|
+
const { createErrors: S } = $.it;
|
|
3983
|
+
return S === !1 ? (0, t._)`{}` : R($, m, k);
|
|
3984
|
+
}
|
|
3985
|
+
function R($, m, k = {}) {
|
|
3986
|
+
const { gen: S, it: I } = $, D = [
|
|
3987
|
+
O(I, k),
|
|
3988
|
+
T($, k)
|
|
3947
3989
|
];
|
|
3948
|
-
return v($, m, D),
|
|
3990
|
+
return v($, m, D), S.object(...D);
|
|
3949
3991
|
}
|
|
3950
3992
|
function O({ errorPath: $ }, { instancePath: m }) {
|
|
3951
|
-
const
|
|
3952
|
-
return [n.default.instancePath, (0, t.strConcat)(n.default.instancePath,
|
|
3993
|
+
const k = m ? (0, t.str)`${$}${(0, r.getErrorPath)(m, r.Type.Str)}` : $;
|
|
3994
|
+
return [n.default.instancePath, (0, t.strConcat)(n.default.instancePath, k)];
|
|
3953
3995
|
}
|
|
3954
|
-
function
|
|
3955
|
-
let I =
|
|
3956
|
-
return
|
|
3996
|
+
function T({ keyword: $, it: { errSchemaPath: m } }, { schemaPath: k, parentSchema: S }) {
|
|
3997
|
+
let I = S ? m : (0, t.str)`${m}/${$}`;
|
|
3998
|
+
return k && (I = (0, t.str)`${I}${(0, r.getErrorPath)(k, r.Type.Str)}`), [p.schemaPath, I];
|
|
3957
3999
|
}
|
|
3958
|
-
function v($, { params: m, message:
|
|
3959
|
-
const { keyword: I, data: D, schemaValue: w, it: C } = $, { opts: A, propertyName: V, topSchemaRef:
|
|
3960
|
-
|
|
4000
|
+
function v($, { params: m, message: k }, S) {
|
|
4001
|
+
const { keyword: I, data: D, schemaValue: w, it: C } = $, { opts: A, propertyName: V, topSchemaRef: z, schemaPath: re } = C;
|
|
4002
|
+
S.push([p.keyword, I], [p.params, typeof m == "function" ? m($) : m || (0, t._)`{}`]), A.messages && S.push([p.message, typeof k == "function" ? k($) : k]), A.verbose && S.push([p.schema, w], [p.parentSchema, (0, t._)`${z}${re}`], [n.default.data, D]), V && S.push([p.propertyName, V]);
|
|
3961
4003
|
}
|
|
3962
4004
|
})(errors);
|
|
3963
4005
|
Object.defineProperty(boolSchema, "__esModule", { value: !0 });
|
|
@@ -4033,84 +4075,84 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4033
4075
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.reportTypeError = e.checkDataTypes = e.checkDataType = e.coerceAndCheckDataType = e.getJSONTypes = e.getSchemaTypes = e.DataType = void 0;
|
|
4034
4076
|
const t = rules, r = applicability, n = errors, s = codegen, i = util;
|
|
4035
4077
|
var o;
|
|
4036
|
-
(function(
|
|
4037
|
-
|
|
4078
|
+
(function(S) {
|
|
4079
|
+
S[S.Correct = 0] = "Correct", S[S.Wrong = 1] = "Wrong";
|
|
4038
4080
|
})(o = e.DataType || (e.DataType = {}));
|
|
4039
|
-
function
|
|
4040
|
-
const I = d(
|
|
4081
|
+
function c(S) {
|
|
4082
|
+
const I = d(S.type);
|
|
4041
4083
|
if (I.includes("null")) {
|
|
4042
|
-
if (
|
|
4084
|
+
if (S.nullable === !1)
|
|
4043
4085
|
throw new Error("type: null contradicts nullable: false");
|
|
4044
4086
|
} else {
|
|
4045
|
-
if (!I.length &&
|
|
4087
|
+
if (!I.length && S.nullable !== void 0)
|
|
4046
4088
|
throw new Error('"nullable" cannot be used without "type"');
|
|
4047
|
-
|
|
4089
|
+
S.nullable === !0 && I.push("null");
|
|
4048
4090
|
}
|
|
4049
4091
|
return I;
|
|
4050
4092
|
}
|
|
4051
|
-
e.getSchemaTypes =
|
|
4052
|
-
function d(
|
|
4053
|
-
const I = Array.isArray(
|
|
4093
|
+
e.getSchemaTypes = c;
|
|
4094
|
+
function d(S) {
|
|
4095
|
+
const I = Array.isArray(S) ? S : S ? [S] : [];
|
|
4054
4096
|
if (I.every(t.isJSONType))
|
|
4055
4097
|
return I;
|
|
4056
4098
|
throw new Error("type must be JSONType or JSONType[]: " + I.join(","));
|
|
4057
4099
|
}
|
|
4058
4100
|
e.getJSONTypes = d;
|
|
4059
|
-
function u(
|
|
4060
|
-
const { gen: D, data: w, opts: C } =
|
|
4101
|
+
function u(S, I) {
|
|
4102
|
+
const { gen: D, data: w, opts: C } = S, A = _(I, C.coerceTypes), V = I.length > 0 && !(A.length === 0 && I.length === 1 && (0, r.schemaHasRulesForType)(S, I[0]));
|
|
4061
4103
|
if (V) {
|
|
4062
|
-
const
|
|
4063
|
-
D.if(
|
|
4064
|
-
A.length ? R(
|
|
4104
|
+
const z = v(I, w, C.strictNumbers, o.Wrong);
|
|
4105
|
+
D.if(z, () => {
|
|
4106
|
+
A.length ? R(S, I, A) : m(S);
|
|
4065
4107
|
});
|
|
4066
4108
|
}
|
|
4067
4109
|
return V;
|
|
4068
4110
|
}
|
|
4069
4111
|
e.coerceAndCheckDataType = u;
|
|
4070
4112
|
const p = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]);
|
|
4071
|
-
function
|
|
4072
|
-
return I ?
|
|
4113
|
+
function _(S, I) {
|
|
4114
|
+
return I ? S.filter((D) => p.has(D) || I === "array" && D === "array") : [];
|
|
4073
4115
|
}
|
|
4074
|
-
function R(
|
|
4075
|
-
const { gen: w, data: C, opts: A } =
|
|
4076
|
-
A.coerceTypes === "array" && w.if((0, s._)`${V} == 'object' && Array.isArray(${C}) && ${C}.length == 1`, () => w.assign(C, (0, s._)`${C}[0]`).assign(V, (0, s._)`typeof ${C}`).if(v(I, C, A.strictNumbers), () => w.assign(
|
|
4116
|
+
function R(S, I, D) {
|
|
4117
|
+
const { gen: w, data: C, opts: A } = S, V = w.let("dataType", (0, s._)`typeof ${C}`), z = w.let("coerced", (0, s._)`undefined`);
|
|
4118
|
+
A.coerceTypes === "array" && w.if((0, s._)`${V} == 'object' && Array.isArray(${C}) && ${C}.length == 1`, () => w.assign(C, (0, s._)`${C}[0]`).assign(V, (0, s._)`typeof ${C}`).if(v(I, C, A.strictNumbers), () => w.assign(z, C))), w.if((0, s._)`${z} !== undefined`);
|
|
4077
4119
|
for (const K of D)
|
|
4078
4120
|
(p.has(K) || K === "array" && A.coerceTypes === "array") && re(K);
|
|
4079
|
-
w.else(), m(
|
|
4080
|
-
w.assign(C,
|
|
4121
|
+
w.else(), m(S), w.endIf(), w.if((0, s._)`${z} !== undefined`, () => {
|
|
4122
|
+
w.assign(C, z), O(S, z);
|
|
4081
4123
|
});
|
|
4082
4124
|
function re(K) {
|
|
4083
4125
|
switch (K) {
|
|
4084
4126
|
case "string":
|
|
4085
|
-
w.elseIf((0, s._)`${V} == "number" || ${V} == "boolean"`).assign(
|
|
4127
|
+
w.elseIf((0, s._)`${V} == "number" || ${V} == "boolean"`).assign(z, (0, s._)`"" + ${C}`).elseIf((0, s._)`${C} === null`).assign(z, (0, s._)`""`);
|
|
4086
4128
|
return;
|
|
4087
4129
|
case "number":
|
|
4088
4130
|
w.elseIf((0, s._)`${V} == "boolean" || ${C} === null
|
|
4089
|
-
|| (${V} == "string" && ${C} && ${C} == +${C})`).assign(
|
|
4131
|
+
|| (${V} == "string" && ${C} && ${C} == +${C})`).assign(z, (0, s._)`+${C}`);
|
|
4090
4132
|
return;
|
|
4091
4133
|
case "integer":
|
|
4092
4134
|
w.elseIf((0, s._)`${V} === "boolean" || ${C} === null
|
|
4093
|
-
|| (${V} === "string" && ${C} && ${C} == +${C} && !(${C} % 1))`).assign(
|
|
4135
|
+
|| (${V} === "string" && ${C} && ${C} == +${C} && !(${C} % 1))`).assign(z, (0, s._)`+${C}`);
|
|
4094
4136
|
return;
|
|
4095
4137
|
case "boolean":
|
|
4096
|
-
w.elseIf((0, s._)`${C} === "false" || ${C} === 0 || ${C} === null`).assign(
|
|
4138
|
+
w.elseIf((0, s._)`${C} === "false" || ${C} === 0 || ${C} === null`).assign(z, !1).elseIf((0, s._)`${C} === "true" || ${C} === 1`).assign(z, !0);
|
|
4097
4139
|
return;
|
|
4098
4140
|
case "null":
|
|
4099
|
-
w.elseIf((0, s._)`${C} === "" || ${C} === 0 || ${C} === false`), w.assign(
|
|
4141
|
+
w.elseIf((0, s._)`${C} === "" || ${C} === 0 || ${C} === false`), w.assign(z, null);
|
|
4100
4142
|
return;
|
|
4101
4143
|
case "array":
|
|
4102
4144
|
w.elseIf((0, s._)`${V} === "string" || ${V} === "number"
|
|
4103
|
-
|| ${V} === "boolean" || ${C} === null`).assign(
|
|
4145
|
+
|| ${V} === "boolean" || ${C} === null`).assign(z, (0, s._)`[${C}]`);
|
|
4104
4146
|
}
|
|
4105
4147
|
}
|
|
4106
4148
|
}
|
|
4107
|
-
function O({ gen:
|
|
4108
|
-
|
|
4149
|
+
function O({ gen: S, parentData: I, parentDataProperty: D }, w) {
|
|
4150
|
+
S.if((0, s._)`${I} !== undefined`, () => S.assign((0, s._)`${I}[${D}]`, w));
|
|
4109
4151
|
}
|
|
4110
|
-
function S
|
|
4152
|
+
function T(S, I, D, w = o.Correct) {
|
|
4111
4153
|
const C = w === o.Correct ? s.operators.EQ : s.operators.NEQ;
|
|
4112
4154
|
let A;
|
|
4113
|
-
switch (
|
|
4155
|
+
switch (S) {
|
|
4114
4156
|
case "null":
|
|
4115
4157
|
return (0, s._)`${I} ${C} null`;
|
|
4116
4158
|
case "array":
|
|
@@ -4126,19 +4168,19 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4126
4168
|
A = V();
|
|
4127
4169
|
break;
|
|
4128
4170
|
default:
|
|
4129
|
-
return (0, s._)`typeof ${I} ${C} ${
|
|
4171
|
+
return (0, s._)`typeof ${I} ${C} ${S}`;
|
|
4130
4172
|
}
|
|
4131
4173
|
return w === o.Correct ? A : (0, s.not)(A);
|
|
4132
|
-
function V(
|
|
4133
|
-
return (0, s.and)((0, s._)`typeof ${I} == "number"`,
|
|
4174
|
+
function V(z = s.nil) {
|
|
4175
|
+
return (0, s.and)((0, s._)`typeof ${I} == "number"`, z, D ? (0, s._)`isFinite(${I})` : s.nil);
|
|
4134
4176
|
}
|
|
4135
4177
|
}
|
|
4136
|
-
e.checkDataType =
|
|
4137
|
-
function v(
|
|
4138
|
-
if (
|
|
4139
|
-
return S
|
|
4178
|
+
e.checkDataType = T;
|
|
4179
|
+
function v(S, I, D, w) {
|
|
4180
|
+
if (S.length === 1)
|
|
4181
|
+
return T(S[0], I, D, w);
|
|
4140
4182
|
let C;
|
|
4141
|
-
const A = (0, i.toHash)(
|
|
4183
|
+
const A = (0, i.toHash)(S);
|
|
4142
4184
|
if (A.array && A.object) {
|
|
4143
4185
|
const V = (0, s._)`typeof ${I} != "object"`;
|
|
4144
4186
|
C = A.null ? V : (0, s._)`!${I} || ${V}`, delete A.null, delete A.array, delete A.object;
|
|
@@ -4146,21 +4188,21 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4146
4188
|
C = s.nil;
|
|
4147
4189
|
A.number && delete A.integer;
|
|
4148
4190
|
for (const V in A)
|
|
4149
|
-
C = (0, s.and)(C,
|
|
4191
|
+
C = (0, s.and)(C, T(V, I, D, w));
|
|
4150
4192
|
return C;
|
|
4151
4193
|
}
|
|
4152
4194
|
e.checkDataTypes = v;
|
|
4153
4195
|
const $ = {
|
|
4154
|
-
message: ({ schema:
|
|
4155
|
-
params: ({ schema:
|
|
4196
|
+
message: ({ schema: S }) => `must be ${S}`,
|
|
4197
|
+
params: ({ schema: S, schemaValue: I }) => typeof S == "string" ? (0, s._)`{type: ${S}}` : (0, s._)`{type: ${I}}`
|
|
4156
4198
|
};
|
|
4157
|
-
function m(
|
|
4158
|
-
const I =
|
|
4199
|
+
function m(S) {
|
|
4200
|
+
const I = k(S);
|
|
4159
4201
|
(0, n.reportError)(I, $);
|
|
4160
4202
|
}
|
|
4161
4203
|
e.reportTypeError = m;
|
|
4162
|
-
function
|
|
4163
|
-
const { gen: I, data: D, schema: w } =
|
|
4204
|
+
function k(S) {
|
|
4205
|
+
const { gen: I, data: D, schema: w } = S, C = (0, i.schemaRefOrVal)(S, w, "type");
|
|
4164
4206
|
return {
|
|
4165
4207
|
gen: I,
|
|
4166
4208
|
keyword: "type",
|
|
@@ -4170,7 +4212,7 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4170
4212
|
schemaValue: C,
|
|
4171
4213
|
parentSchema: w,
|
|
4172
4214
|
params: {},
|
|
4173
|
-
it:
|
|
4215
|
+
it: S
|
|
4174
4216
|
};
|
|
4175
4217
|
}
|
|
4176
4218
|
})(dataType);
|
|
@@ -4191,13 +4233,13 @@ function assignDefault(e, t, r) {
|
|
|
4191
4233
|
const { gen: n, compositeRule: s, data: i, opts: o } = e;
|
|
4192
4234
|
if (r === void 0)
|
|
4193
4235
|
return;
|
|
4194
|
-
const
|
|
4236
|
+
const c = (0, codegen_1$r._)`${i}${(0, codegen_1$r.getProperty)(t)}`;
|
|
4195
4237
|
if (s) {
|
|
4196
|
-
(0, util_1$p.checkStrictMode)(e, `default is ignored for: ${
|
|
4238
|
+
(0, util_1$p.checkStrictMode)(e, `default is ignored for: ${c}`);
|
|
4197
4239
|
return;
|
|
4198
4240
|
}
|
|
4199
|
-
let d = (0, codegen_1$r._)`${
|
|
4200
|
-
o.useDefaults === "empty" && (d = (0, codegen_1$r._)`${d} || ${
|
|
4241
|
+
let d = (0, codegen_1$r._)`${c} === undefined`;
|
|
4242
|
+
o.useDefaults === "empty" && (d = (0, codegen_1$r._)`${d} || ${c} === null || ${c} === ""`), n.if(d, (0, codegen_1$r._)`${c} = ${(0, codegen_1$r.stringify)(r)}`);
|
|
4201
4243
|
}
|
|
4202
4244
|
var keyword = {}, code = {};
|
|
4203
4245
|
Object.defineProperty(code, "__esModule", { value: !0 });
|
|
@@ -4248,16 +4290,16 @@ function schemaProperties(e, t) {
|
|
|
4248
4290
|
return allSchemaProperties(t).filter((r) => !(0, util_1$o.alwaysValidSchema)(e, t[r]));
|
|
4249
4291
|
}
|
|
4250
4292
|
code.schemaProperties = schemaProperties;
|
|
4251
|
-
function callValidateCode({ schemaCode: e, data: t, it: { gen: r, topSchemaRef: n, schemaPath: s, errorPath: i }, it: o },
|
|
4252
|
-
const p = u ? (0, codegen_1$q._)`${e}, ${t}, ${n}${s}` : t,
|
|
4293
|
+
function callValidateCode({ schemaCode: e, data: t, it: { gen: r, topSchemaRef: n, schemaPath: s, errorPath: i }, it: o }, c, d, u) {
|
|
4294
|
+
const p = u ? (0, codegen_1$q._)`${e}, ${t}, ${n}${s}` : t, _ = [
|
|
4253
4295
|
[names_1$5.default.instancePath, (0, codegen_1$q.strConcat)(names_1$5.default.instancePath, i)],
|
|
4254
4296
|
[names_1$5.default.parentData, o.parentData],
|
|
4255
4297
|
[names_1$5.default.parentDataProperty, o.parentDataProperty],
|
|
4256
4298
|
[names_1$5.default.rootData, names_1$5.default.rootData]
|
|
4257
4299
|
];
|
|
4258
|
-
o.opts.dynamicRef &&
|
|
4259
|
-
const R = (0, codegen_1$q._)`${p}, ${r.object(...
|
|
4260
|
-
return d !== codegen_1$q.nil ? (0, codegen_1$q._)`${
|
|
4300
|
+
o.opts.dynamicRef && _.push([names_1$5.default.dynamicAnchors, names_1$5.default.dynamicAnchors]);
|
|
4301
|
+
const R = (0, codegen_1$q._)`${p}, ${r.object(..._)}`;
|
|
4302
|
+
return d !== codegen_1$q.nil ? (0, codegen_1$q._)`${c}.call(${d}, ${R})` : (0, codegen_1$q._)`${c}(${R})`;
|
|
4261
4303
|
}
|
|
4262
4304
|
code.callValidateCode = callValidateCode;
|
|
4263
4305
|
const newRegExp = (0, codegen_1$q._)`new RegExp`;
|
|
@@ -4273,18 +4315,18 @@ code.usePattern = usePattern;
|
|
|
4273
4315
|
function validateArray(e) {
|
|
4274
4316
|
const { gen: t, data: r, keyword: n, it: s } = e, i = t.name("valid");
|
|
4275
4317
|
if (s.allErrors) {
|
|
4276
|
-
const
|
|
4277
|
-
return o(() => t.assign(
|
|
4318
|
+
const c = t.let("valid", !0);
|
|
4319
|
+
return o(() => t.assign(c, !1)), c;
|
|
4278
4320
|
}
|
|
4279
4321
|
return t.var(i, !0), o(() => t.break()), i;
|
|
4280
|
-
function o(
|
|
4322
|
+
function o(c) {
|
|
4281
4323
|
const d = t.const("len", (0, codegen_1$q._)`${r}.length`);
|
|
4282
4324
|
t.forRange("i", 0, d, (u) => {
|
|
4283
4325
|
e.subschema({
|
|
4284
4326
|
keyword: n,
|
|
4285
4327
|
dataProp: u,
|
|
4286
4328
|
dataPropType: util_1$o.Type.Num
|
|
4287
|
-
}, i), t.if((0, codegen_1$q.not)(i),
|
|
4329
|
+
}, i), t.if((0, codegen_1$q.not)(i), c);
|
|
4288
4330
|
});
|
|
4289
4331
|
}
|
|
4290
4332
|
}
|
|
@@ -4295,14 +4337,14 @@ function validateUnion(e) {
|
|
|
4295
4337
|
throw new Error("ajv implementation error");
|
|
4296
4338
|
if (r.some((d) => (0, util_1$o.alwaysValidSchema)(s, d)) && !s.opts.unevaluated)
|
|
4297
4339
|
return;
|
|
4298
|
-
const o = t.let("valid", !1),
|
|
4340
|
+
const o = t.let("valid", !1), c = t.name("_valid");
|
|
4299
4341
|
t.block(() => r.forEach((d, u) => {
|
|
4300
4342
|
const p = e.subschema({
|
|
4301
4343
|
keyword: n,
|
|
4302
4344
|
schemaProp: u,
|
|
4303
4345
|
compositeRule: !0
|
|
4304
|
-
},
|
|
4305
|
-
t.assign(o, (0, codegen_1$q._)`${o} || ${
|
|
4346
|
+
}, c);
|
|
4347
|
+
t.assign(o, (0, codegen_1$q._)`${o} || ${c}`), e.mergeValidEvaluated(p, c) || t.if((0, codegen_1$q.not)(o));
|
|
4306
4348
|
})), e.result(o, () => e.reset(), () => e.error(!0));
|
|
4307
4349
|
}
|
|
4308
4350
|
code.validateUnion = validateUnion;
|
|
@@ -4310,11 +4352,11 @@ Object.defineProperty(keyword, "__esModule", { value: !0 });
|
|
|
4310
4352
|
keyword.validateKeywordUsage = keyword.validSchemaType = keyword.funcKeywordCode = keyword.macroKeywordCode = void 0;
|
|
4311
4353
|
const codegen_1$p = codegen, names_1$4 = names$1, code_1$9 = code, errors_1$1 = errors;
|
|
4312
4354
|
function macroKeywordCode(e, t) {
|
|
4313
|
-
const { gen: r, keyword: n, schema: s, parentSchema: i, it: o } = e,
|
|
4314
|
-
o.opts.validateSchema !== !1 && o.self.validateSchema(
|
|
4355
|
+
const { gen: r, keyword: n, schema: s, parentSchema: i, it: o } = e, c = t.macro.call(o.self, s, i, o), d = useKeyword(r, n, c);
|
|
4356
|
+
o.opts.validateSchema !== !1 && o.self.validateSchema(c, !0);
|
|
4315
4357
|
const u = r.name("valid");
|
|
4316
4358
|
e.subschema({
|
|
4317
|
-
schema:
|
|
4359
|
+
schema: c,
|
|
4318
4360
|
schemaPath: codegen_1$p.nil,
|
|
4319
4361
|
errSchemaPath: `${o.errSchemaPath}/${n}`,
|
|
4320
4362
|
topSchemaRef: d,
|
|
@@ -4324,33 +4366,33 @@ function macroKeywordCode(e, t) {
|
|
|
4324
4366
|
keyword.macroKeywordCode = macroKeywordCode;
|
|
4325
4367
|
function funcKeywordCode(e, t) {
|
|
4326
4368
|
var r;
|
|
4327
|
-
const { gen: n, keyword: s, schema: i, parentSchema: o, $data:
|
|
4369
|
+
const { gen: n, keyword: s, schema: i, parentSchema: o, $data: c, it: d } = e;
|
|
4328
4370
|
checkAsyncKeyword(d, t);
|
|
4329
|
-
const u = !
|
|
4330
|
-
e.block$data(
|
|
4371
|
+
const u = !c && t.compile ? t.compile.call(d.self, i, o, d) : t.validate, p = useKeyword(n, s, u), _ = n.let("valid");
|
|
4372
|
+
e.block$data(_, R), e.ok((r = t.valid) !== null && r !== void 0 ? r : _);
|
|
4331
4373
|
function R() {
|
|
4332
4374
|
if (t.errors === !1)
|
|
4333
4375
|
v(), t.modifying && modifyData(e), $(() => e.error());
|
|
4334
4376
|
else {
|
|
4335
|
-
const m = t.async ? O() :
|
|
4377
|
+
const m = t.async ? O() : T();
|
|
4336
4378
|
t.modifying && modifyData(e), $(() => addErrs(e, m));
|
|
4337
4379
|
}
|
|
4338
4380
|
}
|
|
4339
4381
|
function O() {
|
|
4340
4382
|
const m = n.let("ruleErrs", null);
|
|
4341
|
-
return n.try(() => v((0, codegen_1$p._)`await `), (
|
|
4383
|
+
return n.try(() => v((0, codegen_1$p._)`await `), (k) => n.assign(_, !1).if((0, codegen_1$p._)`${k} instanceof ${d.ValidationError}`, () => n.assign(m, (0, codegen_1$p._)`${k}.errors`), () => n.throw(k))), m;
|
|
4342
4384
|
}
|
|
4343
|
-
function
|
|
4385
|
+
function T() {
|
|
4344
4386
|
const m = (0, codegen_1$p._)`${p}.errors`;
|
|
4345
4387
|
return n.assign(m, null), v(codegen_1$p.nil), m;
|
|
4346
4388
|
}
|
|
4347
4389
|
function v(m = t.async ? (0, codegen_1$p._)`await ` : codegen_1$p.nil) {
|
|
4348
|
-
const
|
|
4349
|
-
n.assign(
|
|
4390
|
+
const k = d.opts.passContext ? names_1$4.default.this : names_1$4.default.self, S = !("compile" in t && !c || t.schema === !1);
|
|
4391
|
+
n.assign(_, (0, codegen_1$p._)`${m}${(0, code_1$9.callValidateCode)(e, p, k, S)}`, t.modifying);
|
|
4350
4392
|
}
|
|
4351
4393
|
function $(m) {
|
|
4352
|
-
var
|
|
4353
|
-
n.if((0, codegen_1$p.not)((
|
|
4394
|
+
var k;
|
|
4395
|
+
n.if((0, codegen_1$p.not)((k = t.valid) !== null && k !== void 0 ? k : _), m);
|
|
4354
4396
|
}
|
|
4355
4397
|
}
|
|
4356
4398
|
keyword.funcKeywordCode = funcKeywordCode;
|
|
@@ -4381,7 +4423,7 @@ function validateKeywordUsage({ schema: e, opts: t, self: r, errSchemaPath: n },
|
|
|
4381
4423
|
if (Array.isArray(s.keyword) ? !s.keyword.includes(i) : s.keyword !== i)
|
|
4382
4424
|
throw new Error("ajv implementation error");
|
|
4383
4425
|
const o = s.dependencies;
|
|
4384
|
-
if (o != null && o.some((
|
|
4426
|
+
if (o != null && o.some((c) => !Object.prototype.hasOwnProperty.call(e, c)))
|
|
4385
4427
|
throw new Error(`parent schema must have dependencies of ${i}: ${o.join(",")}`);
|
|
4386
4428
|
if (s.validateSchema && !s.validateSchema(e[i])) {
|
|
4387
4429
|
const d = `keyword "${i}" value is invalid at path "${n}": ` + r.errorsText(s.validateSchema.errors);
|
|
@@ -4400,13 +4442,13 @@ function getSubschema(e, { keyword: t, schemaProp: r, schema: n, schemaPath: s,
|
|
|
4400
4442
|
if (t !== void 0 && n !== void 0)
|
|
4401
4443
|
throw new Error('both "keyword" and "schema" passed, only one allowed');
|
|
4402
4444
|
if (t !== void 0) {
|
|
4403
|
-
const
|
|
4445
|
+
const c = e.schema[t];
|
|
4404
4446
|
return r === void 0 ? {
|
|
4405
|
-
schema:
|
|
4447
|
+
schema: c,
|
|
4406
4448
|
schemaPath: (0, codegen_1$o._)`${e.schemaPath}${(0, codegen_1$o.getProperty)(t)}`,
|
|
4407
4449
|
errSchemaPath: `${e.errSchemaPath}/${t}`
|
|
4408
4450
|
} : {
|
|
4409
|
-
schema:
|
|
4451
|
+
schema: c[r],
|
|
4410
4452
|
schemaPath: (0, codegen_1$o._)`${e.schemaPath}${(0, codegen_1$o.getProperty)(t)}${(0, codegen_1$o.getProperty)(r)}`,
|
|
4411
4453
|
errSchemaPath: `${e.errSchemaPath}/${t}/${(0, util_1$n.escapeFragment)(r)}`
|
|
4412
4454
|
};
|
|
@@ -4427,13 +4469,13 @@ subschema.getSubschema = getSubschema;
|
|
|
4427
4469
|
function extendSubschemaData(e, t, { dataProp: r, dataPropType: n, data: s, dataTypes: i, propertyName: o }) {
|
|
4428
4470
|
if (s !== void 0 && r !== void 0)
|
|
4429
4471
|
throw new Error('both "data" and "dataProp" passed, only one allowed');
|
|
4430
|
-
const { gen:
|
|
4472
|
+
const { gen: c } = t;
|
|
4431
4473
|
if (r !== void 0) {
|
|
4432
|
-
const { errorPath: u, dataPathArr: p, opts:
|
|
4433
|
-
d(R), e.errorPath = (0, codegen_1$o.str)`${u}${(0, util_1$n.getErrorPath)(r, n,
|
|
4474
|
+
const { errorPath: u, dataPathArr: p, opts: _ } = t, R = c.let("data", (0, codegen_1$o._)`${t.data}${(0, codegen_1$o.getProperty)(r)}`, !0);
|
|
4475
|
+
d(R), e.errorPath = (0, codegen_1$o.str)`${u}${(0, util_1$n.getErrorPath)(r, n, _.jsPropertySyntax)}`, e.parentDataProperty = (0, codegen_1$o._)`${r}`, e.dataPathArr = [...p, e.parentDataProperty];
|
|
4434
4476
|
}
|
|
4435
4477
|
if (s !== void 0) {
|
|
4436
|
-
const u = s instanceof codegen_1$o.Name ? s :
|
|
4478
|
+
const u = s instanceof codegen_1$o.Name ? s : c.let("data", s, !0);
|
|
4437
4479
|
d(u), o !== void 0 && (e.propertyName = o);
|
|
4438
4480
|
}
|
|
4439
4481
|
i && (e.dataTypes = i);
|
|
@@ -4531,23 +4573,23 @@ traverse$1.skipKeywords = {
|
|
|
4531
4573
|
maxProperties: !0,
|
|
4532
4574
|
minProperties: !0
|
|
4533
4575
|
};
|
|
4534
|
-
function _traverse(e, t, r, n, s, i, o,
|
|
4576
|
+
function _traverse(e, t, r, n, s, i, o, c, d, u) {
|
|
4535
4577
|
if (n && typeof n == "object" && !Array.isArray(n)) {
|
|
4536
|
-
t(n, s, i, o,
|
|
4578
|
+
t(n, s, i, o, c, d, u);
|
|
4537
4579
|
for (var p in n) {
|
|
4538
|
-
var
|
|
4539
|
-
if (Array.isArray(
|
|
4580
|
+
var _ = n[p];
|
|
4581
|
+
if (Array.isArray(_)) {
|
|
4540
4582
|
if (p in traverse$1.arrayKeywords)
|
|
4541
|
-
for (var R = 0; R <
|
|
4542
|
-
_traverse(e, t, r,
|
|
4583
|
+
for (var R = 0; R < _.length; R++)
|
|
4584
|
+
_traverse(e, t, r, _[R], s + "/" + p + "/" + R, i, s, p, n, R);
|
|
4543
4585
|
} else if (p in traverse$1.propsKeywords) {
|
|
4544
|
-
if (
|
|
4545
|
-
for (var O in
|
|
4546
|
-
_traverse(e, t, r,
|
|
4586
|
+
if (_ && typeof _ == "object")
|
|
4587
|
+
for (var O in _)
|
|
4588
|
+
_traverse(e, t, r, _[O], s + "/" + p + "/" + escapeJsonPtr(O), i, s, p, n, O);
|
|
4547
4589
|
} else
|
|
4548
|
-
(p in traverse$1.keywords || e.allKeys && !(p in traverse$1.skipKeywords)) && _traverse(e, t, r,
|
|
4590
|
+
(p in traverse$1.keywords || e.allKeys && !(p in traverse$1.skipKeywords)) && _traverse(e, t, r, _, s + "/" + p, i, s, p, n);
|
|
4549
4591
|
}
|
|
4550
|
-
r(n, s, i, o,
|
|
4592
|
+
r(n, s, i, o, c, d, u);
|
|
4551
4593
|
}
|
|
4552
4594
|
}
|
|
4553
4595
|
function escapeJsonPtr(e) {
|
|
@@ -4628,35 +4670,35 @@ const ANCHOR = /^[a-z_][-a-z0-9._]*$/i;
|
|
|
4628
4670
|
function getSchemaRefs(e, t) {
|
|
4629
4671
|
if (typeof e == "boolean")
|
|
4630
4672
|
return {};
|
|
4631
|
-
const { schemaId: r, uriResolver: n } = this.opts, s = normalizeId(e[r] || t), i = { "": s }, o = getFullPath(n, s, !1),
|
|
4632
|
-
return traverse(e, { allKeys: !0 }, (
|
|
4633
|
-
if (
|
|
4673
|
+
const { schemaId: r, uriResolver: n } = this.opts, s = normalizeId(e[r] || t), i = { "": s }, o = getFullPath(n, s, !1), c = {}, d = /* @__PURE__ */ new Set();
|
|
4674
|
+
return traverse(e, { allKeys: !0 }, (_, R, O, T) => {
|
|
4675
|
+
if (T === void 0)
|
|
4634
4676
|
return;
|
|
4635
4677
|
const v = o + R;
|
|
4636
|
-
let $ = i[
|
|
4637
|
-
typeof
|
|
4638
|
-
function m(
|
|
4678
|
+
let $ = i[T];
|
|
4679
|
+
typeof _[r] == "string" && ($ = m.call(this, _[r])), k.call(this, _.$anchor), k.call(this, _.$dynamicAnchor), i[R] = $;
|
|
4680
|
+
function m(S) {
|
|
4639
4681
|
const I = this.opts.uriResolver.resolve;
|
|
4640
|
-
if (
|
|
4641
|
-
throw p(
|
|
4642
|
-
d.add(
|
|
4643
|
-
let D = this.refs[
|
|
4644
|
-
return typeof D == "string" && (D = this.refs[D]), typeof D == "object" ? u(
|
|
4645
|
-
}
|
|
4646
|
-
function
|
|
4647
|
-
if (typeof
|
|
4648
|
-
if (!ANCHOR.test(
|
|
4649
|
-
throw new Error(`invalid anchor "${
|
|
4650
|
-
m.call(this, `#${
|
|
4682
|
+
if (S = normalizeId($ ? I($, S) : S), d.has(S))
|
|
4683
|
+
throw p(S);
|
|
4684
|
+
d.add(S);
|
|
4685
|
+
let D = this.refs[S];
|
|
4686
|
+
return typeof D == "string" && (D = this.refs[D]), typeof D == "object" ? u(_, D.schema, S) : S !== normalizeId(v) && (S[0] === "#" ? (u(_, c[S], S), c[S] = _) : this.refs[S] = v), S;
|
|
4687
|
+
}
|
|
4688
|
+
function k(S) {
|
|
4689
|
+
if (typeof S == "string") {
|
|
4690
|
+
if (!ANCHOR.test(S))
|
|
4691
|
+
throw new Error(`invalid anchor "${S}"`);
|
|
4692
|
+
m.call(this, `#${S}`);
|
|
4651
4693
|
}
|
|
4652
4694
|
}
|
|
4653
|
-
}),
|
|
4654
|
-
function u(
|
|
4655
|
-
if (R !== void 0 && !equal$2(
|
|
4695
|
+
}), c;
|
|
4696
|
+
function u(_, R, O) {
|
|
4697
|
+
if (R !== void 0 && !equal$2(_, R))
|
|
4656
4698
|
throw p(O);
|
|
4657
4699
|
}
|
|
4658
|
-
function p(
|
|
4659
|
-
return new Error(`reference "${
|
|
4700
|
+
function p(_) {
|
|
4701
|
+
return new Error(`reference "${_}" resolves to more than one schema`);
|
|
4660
4702
|
}
|
|
4661
4703
|
}
|
|
4662
4704
|
resolve$1.getSchemaRefs = getSchemaRefs;
|
|
@@ -4754,8 +4796,8 @@ function commentKeyword({ gen: e, schemaEnv: t, schema: r, errSchemaPath: n, opt
|
|
|
4754
4796
|
if (s.$comment === !0)
|
|
4755
4797
|
e.code((0, codegen_1$n._)`${names_1$3.default.self}.logger.log(${i})`);
|
|
4756
4798
|
else if (typeof s.$comment == "function") {
|
|
4757
|
-
const o = (0, codegen_1$n.str)`${n}/$comment`,
|
|
4758
|
-
e.code((0, codegen_1$n._)`${names_1$3.default.self}.opts.$comment(${i}, ${o}, ${
|
|
4799
|
+
const o = (0, codegen_1$n.str)`${n}/$comment`, c = e.scopeValue("root", { ref: t.root });
|
|
4800
|
+
e.code((0, codegen_1$n._)`${names_1$3.default.self}.opts.$comment(${i}, ${o}, ${c}.schema)`);
|
|
4759
4801
|
}
|
|
4760
4802
|
}
|
|
4761
4803
|
function returnResults(e) {
|
|
@@ -4766,18 +4808,18 @@ function assignEvaluated({ gen: e, evaluated: t, props: r, items: n }) {
|
|
|
4766
4808
|
r instanceof codegen_1$n.Name && e.assign((0, codegen_1$n._)`${t}.props`, r), n instanceof codegen_1$n.Name && e.assign((0, codegen_1$n._)`${t}.items`, n);
|
|
4767
4809
|
}
|
|
4768
4810
|
function schemaKeywords(e, t, r, n) {
|
|
4769
|
-
const { gen: s, schema: i, data: o, allErrors:
|
|
4811
|
+
const { gen: s, schema: i, data: o, allErrors: c, opts: d, self: u } = e, { RULES: p } = u;
|
|
4770
4812
|
if (i.$ref && (d.ignoreKeywordsWithRef || !(0, util_1$l.schemaHasRulesButRef)(i, p))) {
|
|
4771
4813
|
s.block(() => keywordCode(e, "$ref", p.all.$ref.definition));
|
|
4772
4814
|
return;
|
|
4773
4815
|
}
|
|
4774
4816
|
d.jtd || checkStrictTypes(e, t), s.block(() => {
|
|
4775
4817
|
for (const R of p.rules)
|
|
4776
|
-
|
|
4777
|
-
|
|
4818
|
+
_(R);
|
|
4819
|
+
_(p.post);
|
|
4778
4820
|
});
|
|
4779
|
-
function
|
|
4780
|
-
(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),
|
|
4821
|
+
function _(R) {
|
|
4822
|
+
(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}`));
|
|
4781
4823
|
}
|
|
4782
4824
|
}
|
|
4783
4825
|
function iterateKeywords(e, t) {
|
|
@@ -4897,7 +4939,7 @@ class KeywordCxt {
|
|
|
4897
4939
|
}
|
|
4898
4940
|
invalid$data() {
|
|
4899
4941
|
const { gen: t, schemaCode: r, schemaType: n, def: s, it: i } = this;
|
|
4900
|
-
return (0, codegen_1$n.or)(o(),
|
|
4942
|
+
return (0, codegen_1$n.or)(o(), c());
|
|
4901
4943
|
function o() {
|
|
4902
4944
|
if (n.length) {
|
|
4903
4945
|
if (!(r instanceof codegen_1$n.Name))
|
|
@@ -4907,7 +4949,7 @@ class KeywordCxt {
|
|
|
4907
4949
|
}
|
|
4908
4950
|
return codegen_1$n.nil;
|
|
4909
4951
|
}
|
|
4910
|
-
function
|
|
4952
|
+
function c() {
|
|
4911
4953
|
if (s.validateSchema) {
|
|
4912
4954
|
const d = t.scopeValue("validate$data", { ref: s.validateSchema });
|
|
4913
4955
|
return (0, codegen_1$n._)`!${d}(${r})`;
|
|
@@ -4961,8 +5003,8 @@ function getData(e, { dataLevel: t, dataNames: r, dataPathArr: n }) {
|
|
|
4961
5003
|
return i;
|
|
4962
5004
|
}
|
|
4963
5005
|
let o = i;
|
|
4964
|
-
const
|
|
4965
|
-
for (const u of
|
|
5006
|
+
const c = s.split("/");
|
|
5007
|
+
for (const u of c)
|
|
4966
5008
|
u && (i = (0, codegen_1$n._)`${i}${(0, codegen_1$n.getProperty)((0, util_1$l.unescapeJsonPointer)(u))}`, o = (0, codegen_1$n._)`${o} && ${i}`);
|
|
4967
5009
|
return o;
|
|
4968
5010
|
function d(u, p) {
|
|
@@ -5005,8 +5047,8 @@ function compileSchema(e) {
|
|
|
5005
5047
|
if (t)
|
|
5006
5048
|
return t;
|
|
5007
5049
|
const r = (0, resolve_1.getFullPath)(this.opts.uriResolver, e.root.baseId), { es5: n, lines: s } = this.opts.code, { ownProperties: i } = this.opts, o = new codegen_1$m.CodeGen(this.scope, { es5: n, lines: s, ownProperties: i });
|
|
5008
|
-
let
|
|
5009
|
-
e.$async && (
|
|
5050
|
+
let c;
|
|
5051
|
+
e.$async && (c = o.scopeValue("Error", {
|
|
5010
5052
|
ref: validation_error_1.default,
|
|
5011
5053
|
code: (0, codegen_1$m._)`require("ajv/dist/runtime/validation_error").default`
|
|
5012
5054
|
}));
|
|
@@ -5025,7 +5067,7 @@ function compileSchema(e) {
|
|
|
5025
5067
|
definedProperties: /* @__PURE__ */ new Set(),
|
|
5026
5068
|
topSchemaRef: o.scopeValue("schema", this.opts.code.source === !0 ? { ref: e.schema, code: (0, codegen_1$m.stringify)(e.schema) } : { ref: e.schema }),
|
|
5027
5069
|
validateName: d,
|
|
5028
|
-
ValidationError:
|
|
5070
|
+
ValidationError: c,
|
|
5029
5071
|
schema: e.schema,
|
|
5030
5072
|
schemaEnv: e,
|
|
5031
5073
|
rootId: r,
|
|
@@ -5039,21 +5081,21 @@ function compileSchema(e) {
|
|
|
5039
5081
|
let p;
|
|
5040
5082
|
try {
|
|
5041
5083
|
this._compilations.add(e), (0, validate_1$1.validateFunctionCode)(u), o.optimize(this.opts.code.optimize);
|
|
5042
|
-
const
|
|
5043
|
-
p = `${o.scopeRefs(names_1$2.default.scope)}return ${
|
|
5084
|
+
const _ = o.toString();
|
|
5085
|
+
p = `${o.scopeRefs(names_1$2.default.scope)}return ${_}`, this.opts.code.process && (p = this.opts.code.process(p, e));
|
|
5044
5086
|
const O = new Function(`${names_1$2.default.self}`, `${names_1$2.default.scope}`, p)(this, this.scope.get());
|
|
5045
|
-
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:
|
|
5046
|
-
const { props:
|
|
5087
|
+
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: _, scopeValues: o._values }), this.opts.unevaluated) {
|
|
5088
|
+
const { props: T, items: v } = u;
|
|
5047
5089
|
O.evaluated = {
|
|
5048
|
-
props:
|
|
5090
|
+
props: T instanceof codegen_1$m.Name ? void 0 : T,
|
|
5049
5091
|
items: v instanceof codegen_1$m.Name ? void 0 : v,
|
|
5050
|
-
dynamicProps:
|
|
5092
|
+
dynamicProps: T instanceof codegen_1$m.Name,
|
|
5051
5093
|
dynamicItems: v instanceof codegen_1$m.Name
|
|
5052
5094
|
}, O.source && (O.source.evaluated = (0, codegen_1$m.stringify)(O.evaluated));
|
|
5053
5095
|
}
|
|
5054
5096
|
return e.validate = O, e;
|
|
5055
|
-
} catch (
|
|
5056
|
-
throw delete e.validate, delete e.validateName, p && this.logger.error("Error compiling schema, function code:", p),
|
|
5097
|
+
} catch (_) {
|
|
5098
|
+
throw delete e.validate, delete e.validateName, p && this.logger.error("Error compiling schema, function code:", p), _;
|
|
5057
5099
|
} finally {
|
|
5058
5100
|
this._compilations.delete(e);
|
|
5059
5101
|
}
|
|
@@ -5067,8 +5109,8 @@ function resolveRef(e, t, r) {
|
|
|
5067
5109
|
return s;
|
|
5068
5110
|
let i = resolve.call(this, e, r);
|
|
5069
5111
|
if (i === void 0) {
|
|
5070
|
-
const o = (n = e.localRefs) === null || n === void 0 ? void 0 : n[r], { schemaId:
|
|
5071
|
-
o && (i = new SchemaEnv({ schema: o, schemaId:
|
|
5112
|
+
const o = (n = e.localRefs) === null || n === void 0 ? void 0 : n[r], { schemaId: c } = this.opts;
|
|
5113
|
+
o && (i = new SchemaEnv({ schema: o, schemaId: c, root: e, baseId: t }));
|
|
5072
5114
|
}
|
|
5073
5115
|
if (i !== void 0)
|
|
5074
5116
|
return e.refs[r] = inlineOrCompile.call(this, i);
|
|
@@ -5099,13 +5141,13 @@ function resolveSchema(e, t) {
|
|
|
5099
5141
|
return getJsonPointer.call(this, r, e);
|
|
5100
5142
|
const i = (0, resolve_1.normalizeId)(n), o = this.refs[i] || this.schemas[i];
|
|
5101
5143
|
if (typeof o == "string") {
|
|
5102
|
-
const
|
|
5103
|
-
return typeof (
|
|
5144
|
+
const c = resolveSchema.call(this, e, o);
|
|
5145
|
+
return typeof (c == null ? void 0 : c.schema) != "object" ? void 0 : getJsonPointer.call(this, r, c);
|
|
5104
5146
|
}
|
|
5105
5147
|
if (typeof (o == null ? void 0 : o.schema) == "object") {
|
|
5106
5148
|
if (o.validate || compileSchema.call(this, o), i === (0, resolve_1.normalizeId)(t)) {
|
|
5107
|
-
const { schema:
|
|
5108
|
-
return u && (s = (0, resolve_1.resolveUrl)(this.opts.uriResolver, s, u)), new SchemaEnv({ schema:
|
|
5149
|
+
const { schema: c } = o, { schemaId: d } = this.opts, u = c[d];
|
|
5150
|
+
return u && (s = (0, resolve_1.resolveUrl)(this.opts.uriResolver, s, u)), new SchemaEnv({ schema: c, schemaId: d, root: e, baseId: s });
|
|
5109
5151
|
}
|
|
5110
5152
|
return getJsonPointer.call(this, r, o);
|
|
5111
5153
|
}
|
|
@@ -5122,20 +5164,20 @@ function getJsonPointer(e, { baseId: t, schema: r, root: n }) {
|
|
|
5122
5164
|
var s;
|
|
5123
5165
|
if (((s = e.fragment) === null || s === void 0 ? void 0 : s[0]) !== "/")
|
|
5124
5166
|
return;
|
|
5125
|
-
for (const
|
|
5167
|
+
for (const c of e.fragment.slice(1).split("/")) {
|
|
5126
5168
|
if (typeof r == "boolean")
|
|
5127
5169
|
return;
|
|
5128
|
-
const d = r[(0, util_1$k.unescapeFragment)(
|
|
5170
|
+
const d = r[(0, util_1$k.unescapeFragment)(c)];
|
|
5129
5171
|
if (d === void 0)
|
|
5130
5172
|
return;
|
|
5131
5173
|
r = d;
|
|
5132
5174
|
const u = typeof r == "object" && r[this.opts.schemaId];
|
|
5133
|
-
!PREVENT_SCOPE_CHANGE.has(
|
|
5175
|
+
!PREVENT_SCOPE_CHANGE.has(c) && u && (t = (0, resolve_1.resolveUrl)(this.opts.uriResolver, t, u));
|
|
5134
5176
|
}
|
|
5135
5177
|
let i;
|
|
5136
5178
|
if (typeof r != "boolean" && r.$ref && !(0, util_1$k.schemaHasRulesButRef)(r, this.RULES)) {
|
|
5137
|
-
const
|
|
5138
|
-
i = resolveSchema.call(this, n,
|
|
5179
|
+
const c = (0, resolve_1.resolveUrl)(this.opts.uriResolver, t, r.$ref);
|
|
5180
|
+
i = resolveSchema.call(this, n, c);
|
|
5139
5181
|
}
|
|
5140
5182
|
const { schemaId: o } = this.opts;
|
|
5141
5183
|
if (i = i || new SchemaEnv({ schema: r, schemaId: o, root: n, baseId: t }), i.schema !== i.root.schema)
|
|
@@ -5170,15 +5212,15 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5170
5212
|
n(t);
|
|
5171
5213
|
})(commonjsGlobal, function(r) {
|
|
5172
5214
|
function n() {
|
|
5173
|
-
for (var f = arguments.length,
|
|
5174
|
-
|
|
5175
|
-
if (
|
|
5176
|
-
|
|
5177
|
-
for (var E =
|
|
5178
|
-
|
|
5179
|
-
return
|
|
5215
|
+
for (var f = arguments.length, l = Array(f), g = 0; g < f; g++)
|
|
5216
|
+
l[g] = arguments[g];
|
|
5217
|
+
if (l.length > 1) {
|
|
5218
|
+
l[0] = l[0].slice(0, -1);
|
|
5219
|
+
for (var E = l.length - 1, b = 1; b < E; ++b)
|
|
5220
|
+
l[b] = l[b].slice(1, -1);
|
|
5221
|
+
return l[E] = l[E].slice(1), l.join("");
|
|
5180
5222
|
} else
|
|
5181
|
-
return
|
|
5223
|
+
return l[0];
|
|
5182
5224
|
}
|
|
5183
5225
|
function s(f) {
|
|
5184
5226
|
return "(?:" + f + ")";
|
|
@@ -5189,24 +5231,24 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5189
5231
|
function o(f) {
|
|
5190
5232
|
return f.toUpperCase();
|
|
5191
5233
|
}
|
|
5192
|
-
function
|
|
5234
|
+
function c(f) {
|
|
5193
5235
|
return f != null ? f instanceof Array ? f : typeof f.length != "number" || f.split || f.setInterval || f.call ? [f] : Array.prototype.slice.call(f) : [];
|
|
5194
5236
|
}
|
|
5195
|
-
function d(f,
|
|
5196
|
-
var
|
|
5197
|
-
if (
|
|
5198
|
-
for (var E in
|
|
5199
|
-
|
|
5200
|
-
return
|
|
5237
|
+
function d(f, l) {
|
|
5238
|
+
var g = f;
|
|
5239
|
+
if (l)
|
|
5240
|
+
for (var E in l)
|
|
5241
|
+
g[E] = l[E];
|
|
5242
|
+
return g;
|
|
5201
5243
|
}
|
|
5202
5244
|
function u(f) {
|
|
5203
|
-
var
|
|
5204
|
-
s(
|
|
5205
|
-
var Z = s(s("25[0-5]") + "|" + s("2[0-4]" +
|
|
5245
|
+
var l = "[A-Za-z]", g = "[0-9]", E = n(g, "[A-Fa-f]"), b = s(s("%[EFef]" + E + "%" + E + E + "%" + E + E) + "|" + s("%[89A-Fa-f]" + E + "%" + E + E) + "|" + s("%" + E + E)), L = "[\\:\\/\\?\\#\\[\\]\\@]", U = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", J = n(L, U), Y = f ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", se = f ? "[\\uE000-\\uF8FF]" : "[]", B = n(l, g, "[\\-\\.\\_\\~]", Y);
|
|
5246
|
+
s(l + n(l, g, "[\\+\\-\\.]") + "*"), s(s(b + "|" + n(B, U, "[\\:]")) + "*");
|
|
5247
|
+
var Z = s(s("25[0-5]") + "|" + s("2[0-4]" + g) + "|" + s("1" + g + g) + "|" + s("0?[1-9]" + g) + "|0?0?" + g), 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), $e = 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), ye = s(s(s(x + "\\:") + "{0,6}" + x) + "?\\:\\:"), je = s([ae, ee, Se, ge, $e, Be, Ie, fe, ye].join("|")), we = s(s(B + "|" + b) + "+");
|
|
5206
5248
|
s("[vV]" + E + "+\\." + n(B, U, "[\\:]") + "+"), s(s(b + "|" + n(B, U)) + "*");
|
|
5207
5249
|
var ct = s(b + "|" + n(B, U, "[\\:\\@]"));
|
|
5208
5250
|
return s(s(b + "|" + n(B, U, "[\\@]")) + "+"), s(s(ct + "|" + n("[\\/\\?]", se)) + "*"), {
|
|
5209
|
-
NOT_SCHEME: new RegExp(n("[^]",
|
|
5251
|
+
NOT_SCHEME: new RegExp(n("[^]", l, g, "[\\+\\-\\.]"), "g"),
|
|
5210
5252
|
NOT_USERINFO: new RegExp(n("[^\\%\\:]", B, U), "g"),
|
|
5211
5253
|
NOT_HOST: new RegExp(n("[^\\%\\[\\]\\:]", B, U), "g"),
|
|
5212
5254
|
NOT_PATH: new RegExp(n("[^\\%\\/\\:\\@]", B, U), "g"),
|
|
@@ -5222,11 +5264,11 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5222
5264
|
//RFC 6874, with relaxed parsing rules
|
|
5223
5265
|
};
|
|
5224
5266
|
}
|
|
5225
|
-
var p = u(!1),
|
|
5226
|
-
function f(
|
|
5267
|
+
var p = u(!1), _ = u(!0), R = function() {
|
|
5268
|
+
function f(l, g) {
|
|
5227
5269
|
var E = [], b = !0, L = !1, U = void 0;
|
|
5228
5270
|
try {
|
|
5229
|
-
for (var J =
|
|
5271
|
+
for (var J = l[Symbol.iterator](), Y; !(b = (Y = J.next()).done) && (E.push(Y.value), !(g && E.length === g)); b = !0)
|
|
5230
5272
|
;
|
|
5231
5273
|
} catch (se) {
|
|
5232
5274
|
L = !0, U = se;
|
|
@@ -5240,71 +5282,71 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5240
5282
|
}
|
|
5241
5283
|
return E;
|
|
5242
5284
|
}
|
|
5243
|
-
return function(
|
|
5244
|
-
if (Array.isArray(
|
|
5245
|
-
return
|
|
5246
|
-
if (Symbol.iterator in Object(
|
|
5247
|
-
return f(
|
|
5285
|
+
return function(l, g) {
|
|
5286
|
+
if (Array.isArray(l))
|
|
5287
|
+
return l;
|
|
5288
|
+
if (Symbol.iterator in Object(l))
|
|
5289
|
+
return f(l, g);
|
|
5248
5290
|
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
5249
5291
|
};
|
|
5250
5292
|
}(), O = function(f) {
|
|
5251
5293
|
if (Array.isArray(f)) {
|
|
5252
|
-
for (var
|
|
5253
|
-
|
|
5254
|
-
return
|
|
5294
|
+
for (var l = 0, g = Array(f.length); l < f.length; l++)
|
|
5295
|
+
g[l] = f[l];
|
|
5296
|
+
return g;
|
|
5255
5297
|
} else
|
|
5256
5298
|
return Array.from(f);
|
|
5257
|
-
},
|
|
5299
|
+
}, T = 2147483647, v = 36, $ = 1, m = 26, k = 38, S = 700, I = 72, D = 128, w = "-", C = /^xn--/, A = /[^\0-\x7E]/, V = /[\x2E\u3002\uFF0E\uFF61]/g, z = {
|
|
5258
5300
|
overflow: "Overflow: input needs wider integers to process",
|
|
5259
5301
|
"not-basic": "Illegal input >= 0x80 (not a basic code point)",
|
|
5260
5302
|
"invalid-input": "Invalid input"
|
|
5261
5303
|
}, re = v - $, K = Math.floor, ue = String.fromCharCode;
|
|
5262
5304
|
function oe(f) {
|
|
5263
|
-
throw new RangeError(
|
|
5305
|
+
throw new RangeError(z[f]);
|
|
5264
5306
|
}
|
|
5265
|
-
function ke(f,
|
|
5266
|
-
for (var
|
|
5267
|
-
|
|
5268
|
-
return
|
|
5307
|
+
function ke(f, l) {
|
|
5308
|
+
for (var g = [], E = f.length; E--; )
|
|
5309
|
+
g[E] = l(f[E]);
|
|
5310
|
+
return g;
|
|
5269
5311
|
}
|
|
5270
|
-
function Ce(f,
|
|
5271
|
-
var
|
|
5272
|
-
|
|
5273
|
-
var b = f.split("."), L = ke(b,
|
|
5312
|
+
function Ce(f, l) {
|
|
5313
|
+
var g = f.split("@"), E = "";
|
|
5314
|
+
g.length > 1 && (E = g[0] + "@", f = g[1]), f = f.replace(V, ".");
|
|
5315
|
+
var b = f.split("."), L = ke(b, l).join(".");
|
|
5274
5316
|
return E + L;
|
|
5275
5317
|
}
|
|
5276
5318
|
function qe(f) {
|
|
5277
|
-
for (var
|
|
5278
|
-
var b = f.charCodeAt(
|
|
5279
|
-
if (b >= 55296 && b <= 56319 &&
|
|
5280
|
-
var L = f.charCodeAt(
|
|
5281
|
-
(L & 64512) == 56320 ?
|
|
5319
|
+
for (var l = [], g = 0, E = f.length; g < E; ) {
|
|
5320
|
+
var b = f.charCodeAt(g++);
|
|
5321
|
+
if (b >= 55296 && b <= 56319 && g < E) {
|
|
5322
|
+
var L = f.charCodeAt(g++);
|
|
5323
|
+
(L & 64512) == 56320 ? l.push(((b & 1023) << 10) + (L & 1023) + 65536) : (l.push(b), g--);
|
|
5282
5324
|
} else
|
|
5283
|
-
|
|
5325
|
+
l.push(b);
|
|
5284
5326
|
}
|
|
5285
|
-
return
|
|
5286
|
-
}
|
|
5287
|
-
var et = function(
|
|
5288
|
-
return String.fromCodePoint.apply(String, O(
|
|
5289
|
-
}, Le = function(
|
|
5290
|
-
return
|
|
5291
|
-
}, F = function(
|
|
5292
|
-
return
|
|
5293
|
-
}, y = function(
|
|
5327
|
+
return l;
|
|
5328
|
+
}
|
|
5329
|
+
var et = function(l) {
|
|
5330
|
+
return String.fromCodePoint.apply(String, O(l));
|
|
5331
|
+
}, Le = function(l) {
|
|
5332
|
+
return l - 48 < 10 ? l - 22 : l - 65 < 26 ? l - 65 : l - 97 < 26 ? l - 97 : v;
|
|
5333
|
+
}, F = function(l, g) {
|
|
5334
|
+
return l + 22 + 75 * (l < 26) - ((g != 0) << 5);
|
|
5335
|
+
}, y = function(l, g, E) {
|
|
5294
5336
|
var b = 0;
|
|
5295
5337
|
for (
|
|
5296
|
-
|
|
5338
|
+
l = E ? K(l / S) : l >> 1, l += K(l / g);
|
|
5297
5339
|
/* no initialization */
|
|
5298
|
-
|
|
5340
|
+
l > re * m >> 1;
|
|
5299
5341
|
b += v
|
|
5300
5342
|
)
|
|
5301
|
-
|
|
5302
|
-
return K(b + (re + 1) *
|
|
5303
|
-
}, j = function(
|
|
5304
|
-
var
|
|
5343
|
+
l = K(l / re);
|
|
5344
|
+
return K(b + (re + 1) * l / (l + k));
|
|
5345
|
+
}, j = function(l) {
|
|
5346
|
+
var g = [], E = l.length, b = 0, L = D, U = I, J = l.lastIndexOf(w);
|
|
5305
5347
|
J < 0 && (J = 0);
|
|
5306
5348
|
for (var Y = 0; Y < J; ++Y)
|
|
5307
|
-
|
|
5349
|
+
l.charCodeAt(Y) >= 128 && oe("not-basic"), g.push(l.charCodeAt(Y));
|
|
5308
5350
|
for (var se = J > 0 ? J + 1 : 0; se < E; ) {
|
|
5309
5351
|
for (
|
|
5310
5352
|
var B = b, Z = 1, ie = v;
|
|
@@ -5313,26 +5355,26 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5313
5355
|
ie += v
|
|
5314
5356
|
) {
|
|
5315
5357
|
se >= E && oe("invalid-input");
|
|
5316
|
-
var
|
|
5317
|
-
(
|
|
5358
|
+
var x = Le(l.charCodeAt(se++));
|
|
5359
|
+
(x >= v || x > K((T - b) / Z)) && oe("overflow"), b += x * Z;
|
|
5318
5360
|
var X = ie <= U ? $ : ie >= U + m ? m : ie - U;
|
|
5319
|
-
if (
|
|
5361
|
+
if (x < X)
|
|
5320
5362
|
break;
|
|
5321
5363
|
var ae = v - X;
|
|
5322
|
-
Z > K(
|
|
5364
|
+
Z > K(T / ae) && oe("overflow"), Z *= ae;
|
|
5323
5365
|
}
|
|
5324
|
-
var ee =
|
|
5325
|
-
U = y(b - B, ee, B == 0), K(b / ee) >
|
|
5366
|
+
var ee = g.length + 1;
|
|
5367
|
+
U = y(b - B, ee, B == 0), K(b / ee) > T - L && oe("overflow"), L += K(b / ee), b %= ee, g.splice(b++, 0, L);
|
|
5326
5368
|
}
|
|
5327
|
-
return String.fromCodePoint.apply(String,
|
|
5328
|
-
}, P = function(
|
|
5329
|
-
var
|
|
5330
|
-
|
|
5331
|
-
var E =
|
|
5369
|
+
return String.fromCodePoint.apply(String, g);
|
|
5370
|
+
}, P = function(l) {
|
|
5371
|
+
var g = [];
|
|
5372
|
+
l = qe(l);
|
|
5373
|
+
var E = l.length, b = D, L = 0, U = I, J = !0, Y = !1, se = void 0;
|
|
5332
5374
|
try {
|
|
5333
|
-
for (var B =
|
|
5375
|
+
for (var B = l[Symbol.iterator](), Z; !(J = (Z = B.next()).done); J = !0) {
|
|
5334
5376
|
var ie = Z.value;
|
|
5335
|
-
ie < 128 &&
|
|
5377
|
+
ie < 128 && g.push(ue(ie));
|
|
5336
5378
|
}
|
|
5337
5379
|
} catch (lt) {
|
|
5338
5380
|
Y = !0, se = lt;
|
|
@@ -5344,31 +5386,31 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5344
5386
|
throw se;
|
|
5345
5387
|
}
|
|
5346
5388
|
}
|
|
5347
|
-
var
|
|
5348
|
-
for (
|
|
5349
|
-
var ae =
|
|
5389
|
+
var x = g.length, X = x;
|
|
5390
|
+
for (x && g.push(w); X < E; ) {
|
|
5391
|
+
var ae = T, ee = !0, Se = !1, ge = void 0;
|
|
5350
5392
|
try {
|
|
5351
|
-
for (var $e =
|
|
5393
|
+
for (var $e = l[Symbol.iterator](), Be; !(ee = (Be = $e.next()).done); ee = !0) {
|
|
5352
5394
|
var Ie = Be.value;
|
|
5353
5395
|
Ie >= b && Ie < ae && (ae = Ie);
|
|
5354
5396
|
}
|
|
5355
5397
|
} catch (lt) {
|
|
5356
|
-
|
|
5398
|
+
Se = !0, ge = lt;
|
|
5357
5399
|
} finally {
|
|
5358
5400
|
try {
|
|
5359
5401
|
!ee && $e.return && $e.return();
|
|
5360
5402
|
} finally {
|
|
5361
|
-
if (
|
|
5403
|
+
if (Se)
|
|
5362
5404
|
throw ge;
|
|
5363
5405
|
}
|
|
5364
5406
|
}
|
|
5365
5407
|
var fe = X + 1;
|
|
5366
|
-
ae - b > K((
|
|
5408
|
+
ae - b > K((T - L) / fe) && oe("overflow"), L += (ae - b) * fe, b = ae;
|
|
5367
5409
|
var ye = !0, je = !1, we = void 0;
|
|
5368
5410
|
try {
|
|
5369
|
-
for (var ct =
|
|
5370
|
-
var
|
|
5371
|
-
if (
|
|
5411
|
+
for (var ct = l[Symbol.iterator](), Ut; !(ye = (Ut = ct.next()).done); ye = !0) {
|
|
5412
|
+
var Ht = Ut.value;
|
|
5413
|
+
if (Ht < b && ++L > T && oe("overflow"), Ht == b) {
|
|
5372
5414
|
for (
|
|
5373
5415
|
var pt = L, ft = v;
|
|
5374
5416
|
;
|
|
@@ -5378,10 +5420,10 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5378
5420
|
var ht = ft <= U ? $ : ft >= U + m ? m : ft - U;
|
|
5379
5421
|
if (pt < ht)
|
|
5380
5422
|
break;
|
|
5381
|
-
var
|
|
5382
|
-
|
|
5423
|
+
var Vt = pt - ht, xt = v - ht;
|
|
5424
|
+
g.push(ue(F(ht + Vt % xt, 0))), pt = K(Vt / xt);
|
|
5383
5425
|
}
|
|
5384
|
-
|
|
5426
|
+
g.push(ue(F(pt, 0))), U = y(L, fe, X == x), L = 0, ++X;
|
|
5385
5427
|
}
|
|
5386
5428
|
}
|
|
5387
5429
|
} catch (lt) {
|
|
@@ -5396,14 +5438,14 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5396
5438
|
}
|
|
5397
5439
|
++L, ++b;
|
|
5398
5440
|
}
|
|
5399
|
-
return
|
|
5400
|
-
}, a = function(
|
|
5401
|
-
return Ce(
|
|
5402
|
-
return C.test(
|
|
5441
|
+
return g.join("");
|
|
5442
|
+
}, a = function(l) {
|
|
5443
|
+
return Ce(l, function(g) {
|
|
5444
|
+
return C.test(g) ? j(g.slice(4).toLowerCase()) : g;
|
|
5403
5445
|
});
|
|
5404
|
-
}, h = function(
|
|
5405
|
-
return Ce(
|
|
5406
|
-
return A.test(
|
|
5446
|
+
}, h = function(l) {
|
|
5447
|
+
return Ce(l, function(g) {
|
|
5448
|
+
return A.test(g) ? "xn--" + P(g) : g;
|
|
5407
5449
|
});
|
|
5408
5450
|
}, N = {
|
|
5409
5451
|
/**
|
|
@@ -5429,60 +5471,60 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5429
5471
|
toUnicode: a
|
|
5430
5472
|
}, M = {};
|
|
5431
5473
|
function q(f) {
|
|
5432
|
-
var
|
|
5433
|
-
return
|
|
5474
|
+
var l = f.charCodeAt(0), g = void 0;
|
|
5475
|
+
return l < 16 ? g = "%0" + l.toString(16).toUpperCase() : l < 128 ? g = "%" + l.toString(16).toUpperCase() : l < 2048 ? g = "%" + (l >> 6 | 192).toString(16).toUpperCase() + "%" + (l & 63 | 128).toString(16).toUpperCase() : g = "%" + (l >> 12 | 224).toString(16).toUpperCase() + "%" + (l >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (l & 63 | 128).toString(16).toUpperCase(), g;
|
|
5434
5476
|
}
|
|
5435
5477
|
function W(f) {
|
|
5436
|
-
for (var
|
|
5437
|
-
var b = parseInt(f.substr(
|
|
5478
|
+
for (var l = "", g = 0, E = f.length; g < E; ) {
|
|
5479
|
+
var b = parseInt(f.substr(g + 1, 2), 16);
|
|
5438
5480
|
if (b < 128)
|
|
5439
|
-
|
|
5481
|
+
l += String.fromCharCode(b), g += 3;
|
|
5440
5482
|
else if (b >= 194 && b < 224) {
|
|
5441
|
-
if (E -
|
|
5442
|
-
var L = parseInt(f.substr(
|
|
5443
|
-
|
|
5483
|
+
if (E - g >= 6) {
|
|
5484
|
+
var L = parseInt(f.substr(g + 4, 2), 16);
|
|
5485
|
+
l += String.fromCharCode((b & 31) << 6 | L & 63);
|
|
5444
5486
|
} else
|
|
5445
|
-
|
|
5446
|
-
|
|
5487
|
+
l += f.substr(g, 6);
|
|
5488
|
+
g += 6;
|
|
5447
5489
|
} else if (b >= 224) {
|
|
5448
|
-
if (E -
|
|
5449
|
-
var U = parseInt(f.substr(
|
|
5450
|
-
|
|
5490
|
+
if (E - g >= 9) {
|
|
5491
|
+
var U = parseInt(f.substr(g + 4, 2), 16), J = parseInt(f.substr(g + 7, 2), 16);
|
|
5492
|
+
l += String.fromCharCode((b & 15) << 12 | (U & 63) << 6 | J & 63);
|
|
5451
5493
|
} else
|
|
5452
|
-
|
|
5453
|
-
|
|
5494
|
+
l += f.substr(g, 9);
|
|
5495
|
+
g += 9;
|
|
5454
5496
|
} else
|
|
5455
|
-
|
|
5497
|
+
l += f.substr(g, 3), g += 3;
|
|
5456
5498
|
}
|
|
5457
|
-
return
|
|
5499
|
+
return l;
|
|
5458
5500
|
}
|
|
5459
|
-
function G(f,
|
|
5460
|
-
function
|
|
5501
|
+
function G(f, l) {
|
|
5502
|
+
function g(E) {
|
|
5461
5503
|
var b = W(E);
|
|
5462
|
-
return b.match(
|
|
5504
|
+
return b.match(l.UNRESERVED) ? b : E;
|
|
5463
5505
|
}
|
|
5464
|
-
return f.scheme && (f.scheme = String(f.scheme).replace(
|
|
5506
|
+
return f.scheme && (f.scheme = String(f.scheme).replace(l.PCT_ENCODED, g).toLowerCase().replace(l.NOT_SCHEME, "")), f.userinfo !== void 0 && (f.userinfo = String(f.userinfo).replace(l.PCT_ENCODED, g).replace(l.NOT_USERINFO, q).replace(l.PCT_ENCODED, o)), f.host !== void 0 && (f.host = String(f.host).replace(l.PCT_ENCODED, g).toLowerCase().replace(l.NOT_HOST, q).replace(l.PCT_ENCODED, o)), f.path !== void 0 && (f.path = String(f.path).replace(l.PCT_ENCODED, g).replace(f.scheme ? l.NOT_PATH : l.NOT_PATH_NOSCHEME, q).replace(l.PCT_ENCODED, o)), f.query !== void 0 && (f.query = String(f.query).replace(l.PCT_ENCODED, g).replace(l.NOT_QUERY, q).replace(l.PCT_ENCODED, o)), f.fragment !== void 0 && (f.fragment = String(f.fragment).replace(l.PCT_ENCODED, g).replace(l.NOT_FRAGMENT, q).replace(l.PCT_ENCODED, o)), f;
|
|
5465
5507
|
}
|
|
5466
5508
|
function ne(f) {
|
|
5467
5509
|
return f.replace(/^0*(.*)/, "$1") || "0";
|
|
5468
5510
|
}
|
|
5469
|
-
function he(f,
|
|
5470
|
-
var
|
|
5511
|
+
function he(f, l) {
|
|
5512
|
+
var g = f.match(l.IPV4ADDRESS) || [], E = R(g, 2), b = E[1];
|
|
5471
5513
|
return b ? b.split(".").map(ne).join(".") : f;
|
|
5472
5514
|
}
|
|
5473
|
-
function Ue(f,
|
|
5474
|
-
var
|
|
5515
|
+
function Ue(f, l) {
|
|
5516
|
+
var g = f.match(l.IPV6ADDRESS) || [], E = R(g, 3), b = E[1], L = E[2];
|
|
5475
5517
|
if (b) {
|
|
5476
|
-
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 =
|
|
5518
|
+
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)
|
|
5477
5519
|
ae[ee] = B[ee] || Z[X + ee] || "";
|
|
5478
|
-
ie && (ae[
|
|
5479
|
-
var
|
|
5520
|
+
ie && (ae[x - 1] = he(ae[x - 1], l));
|
|
5521
|
+
var Se = ae.reduce(function(fe, ye, je) {
|
|
5480
5522
|
if (!ye || ye === "0") {
|
|
5481
5523
|
var we = fe[fe.length - 1];
|
|
5482
5524
|
we && we.index + we.length === je ? we.length++ : fe.push({ index: je, length: 1 });
|
|
5483
5525
|
}
|
|
5484
5526
|
return fe;
|
|
5485
|
-
}, []), ge =
|
|
5527
|
+
}, []), ge = Se.sort(function(fe, ye) {
|
|
5486
5528
|
return ye.length - fe.length;
|
|
5487
5529
|
})[0], $e = void 0;
|
|
5488
5530
|
if (ge && ge.length > 1) {
|
|
@@ -5496,155 +5538,155 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5496
5538
|
}
|
|
5497
5539
|
var tt = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, rt = "".match(/(){0}/)[1] === void 0;
|
|
5498
5540
|
function de(f) {
|
|
5499
|
-
var
|
|
5500
|
-
|
|
5541
|
+
var l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, g = {}, E = l.iri !== !1 ? _ : p;
|
|
5542
|
+
l.reference === "suffix" && (f = (l.scheme ? l.scheme + ":" : "") + "//" + f);
|
|
5501
5543
|
var b = f.match(tt);
|
|
5502
5544
|
if (b) {
|
|
5503
|
-
rt ? (
|
|
5504
|
-
var L = M[(
|
|
5505
|
-
if (!
|
|
5506
|
-
if (
|
|
5545
|
+
rt ? (g.scheme = b[1], g.userinfo = b[3], g.host = b[4], g.port = parseInt(b[5], 10), g.path = b[6] || "", g.query = b[7], g.fragment = b[8], isNaN(g.port) && (g.port = b[5])) : (g.scheme = b[1] || void 0, g.userinfo = f.indexOf("@") !== -1 ? b[3] : void 0, g.host = f.indexOf("//") !== -1 ? b[4] : void 0, g.port = parseInt(b[5], 10), g.path = b[6] || "", g.query = f.indexOf("?") !== -1 ? b[7] : void 0, g.fragment = f.indexOf("#") !== -1 ? b[8] : void 0, isNaN(g.port) && (g.port = f.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? b[4] : void 0)), g.host && (g.host = Ue(he(g.host, E), E)), g.scheme === void 0 && g.userinfo === void 0 && g.host === void 0 && g.port === void 0 && !g.path && g.query === void 0 ? g.reference = "same-document" : g.scheme === void 0 ? g.reference = "relative" : g.fragment === void 0 ? g.reference = "absolute" : g.reference = "uri", l.reference && l.reference !== "suffix" && l.reference !== g.reference && (g.error = g.error || "URI is not a " + l.reference + " reference.");
|
|
5546
|
+
var L = M[(l.scheme || g.scheme || "").toLowerCase()];
|
|
5547
|
+
if (!l.unicodeSupport && (!L || !L.unicodeSupport)) {
|
|
5548
|
+
if (g.host && (l.domainHost || L && L.domainHost))
|
|
5507
5549
|
try {
|
|
5508
|
-
|
|
5550
|
+
g.host = N.toASCII(g.host.replace(E.PCT_ENCODED, W).toLowerCase());
|
|
5509
5551
|
} catch (U) {
|
|
5510
|
-
|
|
5552
|
+
g.error = g.error || "Host's domain name can not be converted to ASCII via punycode: " + U;
|
|
5511
5553
|
}
|
|
5512
|
-
G(
|
|
5554
|
+
G(g, p);
|
|
5513
5555
|
} else
|
|
5514
|
-
G(
|
|
5515
|
-
L && L.parse && L.parse(
|
|
5556
|
+
G(g, E);
|
|
5557
|
+
L && L.parse && L.parse(g, l);
|
|
5516
5558
|
} else
|
|
5517
|
-
|
|
5518
|
-
return
|
|
5559
|
+
g.error = g.error || "URI can not be parsed.";
|
|
5560
|
+
return g;
|
|
5519
5561
|
}
|
|
5520
|
-
function nt(f,
|
|
5521
|
-
var
|
|
5522
|
-
return f.userinfo !== void 0 && (E.push(f.userinfo), E.push("@")), f.host !== void 0 && E.push(Ue(he(String(f.host),
|
|
5562
|
+
function nt(f, l) {
|
|
5563
|
+
var g = l.iri !== !1 ? _ : p, E = [];
|
|
5564
|
+
return f.userinfo !== void 0 && (E.push(f.userinfo), E.push("@")), f.host !== void 0 && E.push(Ue(he(String(f.host), g), g).replace(g.IPV6ADDRESS, function(b, L, U) {
|
|
5523
5565
|
return "[" + L + (U ? "%25" + U : "") + "]";
|
|
5524
5566
|
})), (typeof f.port == "number" || typeof f.port == "string") && (E.push(":"), E.push(String(f.port))), E.length ? E.join("") : void 0;
|
|
5525
5567
|
}
|
|
5526
|
-
var He = /^\.\.?\//, Ve = /^\/\.(\/|$)/,
|
|
5568
|
+
var He = /^\.\.?\//, Ve = /^\/\.(\/|$)/, xe = /^\/\.\.(\/|$)/, st = /^\/?(?:.|\n)*?(?=\/|$)/;
|
|
5527
5569
|
function me(f) {
|
|
5528
|
-
for (var
|
|
5570
|
+
for (var l = []; f.length; )
|
|
5529
5571
|
if (f.match(He))
|
|
5530
5572
|
f = f.replace(He, "");
|
|
5531
5573
|
else if (f.match(Ve))
|
|
5532
5574
|
f = f.replace(Ve, "/");
|
|
5533
|
-
else if (f.match(
|
|
5534
|
-
f = f.replace(
|
|
5575
|
+
else if (f.match(xe))
|
|
5576
|
+
f = f.replace(xe, "/"), l.pop();
|
|
5535
5577
|
else if (f === "." || f === "..")
|
|
5536
5578
|
f = "";
|
|
5537
5579
|
else {
|
|
5538
|
-
var
|
|
5539
|
-
if (
|
|
5540
|
-
var E =
|
|
5541
|
-
f = f.slice(E.length),
|
|
5580
|
+
var g = f.match(st);
|
|
5581
|
+
if (g) {
|
|
5582
|
+
var E = g[0];
|
|
5583
|
+
f = f.slice(E.length), l.push(E);
|
|
5542
5584
|
} else
|
|
5543
5585
|
throw new Error("Unexpected dot segment condition");
|
|
5544
5586
|
}
|
|
5545
|
-
return
|
|
5587
|
+
return l.join("");
|
|
5546
5588
|
}
|
|
5547
5589
|
function le(f) {
|
|
5548
|
-
var
|
|
5549
|
-
if (b && b.serialize && b.serialize(f,
|
|
5550
|
-
if (
|
|
5590
|
+
var l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, g = l.iri ? _ : p, E = [], b = M[(l.scheme || f.scheme || "").toLowerCase()];
|
|
5591
|
+
if (b && b.serialize && b.serialize(f, l), f.host && !g.IPV6ADDRESS.test(f.host)) {
|
|
5592
|
+
if (l.domainHost || b && b.domainHost)
|
|
5551
5593
|
try {
|
|
5552
|
-
f.host =
|
|
5594
|
+
f.host = l.iri ? N.toUnicode(f.host) : N.toASCII(f.host.replace(g.PCT_ENCODED, W).toLowerCase());
|
|
5553
5595
|
} catch (J) {
|
|
5554
|
-
f.error = f.error || "Host's domain name can not be converted to " + (
|
|
5596
|
+
f.error = f.error || "Host's domain name can not be converted to " + (l.iri ? "Unicode" : "ASCII") + " via punycode: " + J;
|
|
5555
5597
|
}
|
|
5556
5598
|
}
|
|
5557
|
-
G(f,
|
|
5558
|
-
var L = nt(f,
|
|
5559
|
-
if (L !== void 0 && (
|
|
5599
|
+
G(f, g), l.reference !== "suffix" && f.scheme && (E.push(f.scheme), E.push(":"));
|
|
5600
|
+
var L = nt(f, l);
|
|
5601
|
+
if (L !== void 0 && (l.reference !== "suffix" && E.push("//"), E.push(L), f.path && f.path.charAt(0) !== "/" && E.push("/")), f.path !== void 0) {
|
|
5560
5602
|
var U = f.path;
|
|
5561
|
-
!
|
|
5603
|
+
!l.absolutePath && (!b || !b.absolutePath) && (U = me(U)), L === void 0 && (U = U.replace(/^\/\//, "/%2F")), E.push(U);
|
|
5562
5604
|
}
|
|
5563
5605
|
return f.query !== void 0 && (E.push("?"), E.push(f.query)), f.fragment !== void 0 && (E.push("#"), E.push(f.fragment)), E.join("");
|
|
5564
5606
|
}
|
|
5565
|
-
function
|
|
5566
|
-
var
|
|
5567
|
-
return E || (f = de(le(f,
|
|
5607
|
+
function ze(f, l) {
|
|
5608
|
+
var g = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, E = arguments[3], b = {};
|
|
5609
|
+
return E || (f = de(le(f, g), g), l = de(le(l, g), g)), g = g || {}, !g.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;
|
|
5568
5610
|
}
|
|
5569
|
-
function it(f,
|
|
5570
|
-
var E = d({ scheme: "null" },
|
|
5571
|
-
return le(
|
|
5611
|
+
function it(f, l, g) {
|
|
5612
|
+
var E = d({ scheme: "null" }, g);
|
|
5613
|
+
return le(ze(de(f, E), de(l, E), E, !0), E);
|
|
5572
5614
|
}
|
|
5573
|
-
function Oe(f,
|
|
5574
|
-
return typeof f == "string" ? f = le(de(f,
|
|
5615
|
+
function Oe(f, l) {
|
|
5616
|
+
return typeof f == "string" ? f = le(de(f, l), l) : i(f) === "object" && (f = de(le(f, l), l)), f;
|
|
5575
5617
|
}
|
|
5576
|
-
function ot(f,
|
|
5577
|
-
return typeof f == "string" ? f = le(de(f,
|
|
5618
|
+
function ot(f, l, g) {
|
|
5619
|
+
return typeof f == "string" ? f = le(de(f, g), g) : i(f) === "object" && (f = le(f, g)), typeof l == "string" ? l = le(de(l, g), g) : i(l) === "object" && (l = le(l, g)), f === l;
|
|
5578
5620
|
}
|
|
5579
|
-
function ut(f,
|
|
5580
|
-
return f && f.toString().replace(!
|
|
5621
|
+
function ut(f, l) {
|
|
5622
|
+
return f && f.toString().replace(!l || !l.iri ? p.ESCAPE : _.ESCAPE, q);
|
|
5581
5623
|
}
|
|
5582
|
-
function pe(f,
|
|
5583
|
-
return f && f.toString().replace(!
|
|
5624
|
+
function pe(f, l) {
|
|
5625
|
+
return f && f.toString().replace(!l || !l.iri ? p.PCT_ENCODED : _.PCT_ENCODED, W);
|
|
5584
5626
|
}
|
|
5585
5627
|
var Ne = {
|
|
5586
5628
|
scheme: "http",
|
|
5587
5629
|
domainHost: !0,
|
|
5588
|
-
parse: function(
|
|
5589
|
-
return
|
|
5630
|
+
parse: function(l, g) {
|
|
5631
|
+
return l.host || (l.error = l.error || "HTTP URIs must have a host."), l;
|
|
5590
5632
|
},
|
|
5591
|
-
serialize: function(
|
|
5592
|
-
var E = String(
|
|
5593
|
-
return (
|
|
5633
|
+
serialize: function(l, g) {
|
|
5634
|
+
var E = String(l.scheme).toLowerCase() === "https";
|
|
5635
|
+
return (l.port === (E ? 443 : 80) || l.port === "") && (l.port = void 0), l.path || (l.path = "/"), l;
|
|
5594
5636
|
}
|
|
5595
|
-
},
|
|
5637
|
+
}, It = {
|
|
5596
5638
|
scheme: "https",
|
|
5597
5639
|
domainHost: Ne.domainHost,
|
|
5598
5640
|
parse: Ne.parse,
|
|
5599
5641
|
serialize: Ne.serialize
|
|
5600
5642
|
};
|
|
5601
|
-
function
|
|
5643
|
+
function jt(f) {
|
|
5602
5644
|
return typeof f.secure == "boolean" ? f.secure : String(f.scheme).toLowerCase() === "wss";
|
|
5603
5645
|
}
|
|
5604
5646
|
var at = {
|
|
5605
5647
|
scheme: "ws",
|
|
5606
5648
|
domainHost: !0,
|
|
5607
|
-
parse: function(
|
|
5608
|
-
var E =
|
|
5609
|
-
return E.secure =
|
|
5649
|
+
parse: function(l, g) {
|
|
5650
|
+
var E = l;
|
|
5651
|
+
return E.secure = jt(E), E.resourceName = (E.path || "/") + (E.query ? "?" + E.query : ""), E.path = void 0, E.query = void 0, E;
|
|
5610
5652
|
},
|
|
5611
|
-
serialize: function(
|
|
5612
|
-
if ((
|
|
5613
|
-
var E =
|
|
5614
|
-
|
|
5653
|
+
serialize: function(l, g) {
|
|
5654
|
+
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) {
|
|
5655
|
+
var E = l.resourceName.split("?"), b = R(E, 2), L = b[0], U = b[1];
|
|
5656
|
+
l.path = L && L !== "/" ? L : void 0, l.query = U, l.resourceName = void 0;
|
|
5615
5657
|
}
|
|
5616
|
-
return
|
|
5658
|
+
return l.fragment = void 0, l;
|
|
5617
5659
|
}
|
|
5618
|
-
},
|
|
5660
|
+
}, At = {
|
|
5619
5661
|
scheme: "wss",
|
|
5620
5662
|
domainHost: at.domainHost,
|
|
5621
5663
|
parse: at.parse,
|
|
5622
5664
|
serialize: at.serialize
|
|
5623
|
-
},
|
|
5624
|
-
function
|
|
5625
|
-
var
|
|
5626
|
-
return
|
|
5665
|
+
}, ir = {}, Dt = "[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]", _e = "[0-9A-Fa-f]", or = s(s("%[EFef]" + _e + "%" + _e + _e + "%" + _e + _e) + "|" + s("%[89A-Fa-f]" + _e + "%" + _e + _e) + "|" + s("%" + _e + _e)), ar = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]", cr = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]", lr = n(cr, '[\\"\\\\]'), dr = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]", ur = new RegExp(Dt, "g"), We = new RegExp(or, "g"), pr = new RegExp(n("[^]", ar, "[\\.]", '[\\"]', lr), "g"), Ft = new RegExp(n("[^]", Dt, dr), "g"), fr = Ft;
|
|
5666
|
+
function Ot(f) {
|
|
5667
|
+
var l = W(f);
|
|
5668
|
+
return l.match(ur) ? l : f;
|
|
5627
5669
|
}
|
|
5628
|
-
var
|
|
5670
|
+
var Mt = {
|
|
5629
5671
|
scheme: "mailto",
|
|
5630
|
-
parse: function(
|
|
5631
|
-
var E =
|
|
5672
|
+
parse: function(l, g) {
|
|
5673
|
+
var E = l, b = E.to = E.path ? E.path.split(",") : [];
|
|
5632
5674
|
if (E.path = void 0, E.query) {
|
|
5633
5675
|
for (var L = !1, U = {}, J = E.query.split("&"), Y = 0, se = J.length; Y < se; ++Y) {
|
|
5634
5676
|
var B = J[Y].split("=");
|
|
5635
5677
|
switch (B[0]) {
|
|
5636
5678
|
case "to":
|
|
5637
|
-
for (var Z = B[1].split(","), ie = 0,
|
|
5679
|
+
for (var Z = B[1].split(","), ie = 0, x = Z.length; ie < x; ++ie)
|
|
5638
5680
|
b.push(Z[ie]);
|
|
5639
5681
|
break;
|
|
5640
5682
|
case "subject":
|
|
5641
|
-
E.subject = pe(B[1],
|
|
5683
|
+
E.subject = pe(B[1], g);
|
|
5642
5684
|
break;
|
|
5643
5685
|
case "body":
|
|
5644
|
-
E.body = pe(B[1],
|
|
5686
|
+
E.body = pe(B[1], g);
|
|
5645
5687
|
break;
|
|
5646
5688
|
default:
|
|
5647
|
-
L = !0, U[pe(B[0],
|
|
5689
|
+
L = !0, U[pe(B[0], g)] = pe(B[1], g);
|
|
5648
5690
|
break;
|
|
5649
5691
|
}
|
|
5650
5692
|
}
|
|
@@ -5653,68 +5695,68 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5653
5695
|
E.query = void 0;
|
|
5654
5696
|
for (var X = 0, ae = b.length; X < ae; ++X) {
|
|
5655
5697
|
var ee = b[X].split("@");
|
|
5656
|
-
if (ee[0] = pe(ee[0]),
|
|
5657
|
-
ee[1] = pe(ee[1],
|
|
5698
|
+
if (ee[0] = pe(ee[0]), g.unicodeSupport)
|
|
5699
|
+
ee[1] = pe(ee[1], g).toLowerCase();
|
|
5658
5700
|
else
|
|
5659
5701
|
try {
|
|
5660
|
-
ee[1] = N.toASCII(pe(ee[1],
|
|
5661
|
-
} catch (
|
|
5662
|
-
E.error = E.error || "Email address's domain name can not be converted to ASCII via punycode: " +
|
|
5702
|
+
ee[1] = N.toASCII(pe(ee[1], g).toLowerCase());
|
|
5703
|
+
} catch (Se) {
|
|
5704
|
+
E.error = E.error || "Email address's domain name can not be converted to ASCII via punycode: " + Se;
|
|
5663
5705
|
}
|
|
5664
5706
|
b[X] = ee.join("@");
|
|
5665
5707
|
}
|
|
5666
5708
|
return E;
|
|
5667
5709
|
},
|
|
5668
|
-
serialize: function(
|
|
5669
|
-
var E =
|
|
5710
|
+
serialize: function(l, g) {
|
|
5711
|
+
var E = l, b = c(l.to);
|
|
5670
5712
|
if (b) {
|
|
5671
5713
|
for (var L = 0, U = b.length; L < U; ++L) {
|
|
5672
|
-
var J = String(b[L]), Y = J.lastIndexOf("@"), se = J.slice(0, Y).replace(We,
|
|
5714
|
+
var J = String(b[L]), Y = J.lastIndexOf("@"), se = J.slice(0, Y).replace(We, Ot).replace(We, o).replace(pr, q), B = J.slice(Y + 1);
|
|
5673
5715
|
try {
|
|
5674
|
-
B =
|
|
5716
|
+
B = g.iri ? N.toUnicode(B) : N.toASCII(pe(B, g).toLowerCase());
|
|
5675
5717
|
} catch (X) {
|
|
5676
|
-
E.error = E.error || "Email address's domain name can not be converted to " + (
|
|
5718
|
+
E.error = E.error || "Email address's domain name can not be converted to " + (g.iri ? "Unicode" : "ASCII") + " via punycode: " + X;
|
|
5677
5719
|
}
|
|
5678
5720
|
b[L] = se + "@" + B;
|
|
5679
5721
|
}
|
|
5680
5722
|
E.path = b.join(",");
|
|
5681
5723
|
}
|
|
5682
|
-
var Z =
|
|
5683
|
-
|
|
5724
|
+
var Z = l.headers = l.headers || {};
|
|
5725
|
+
l.subject && (Z.subject = l.subject), l.body && (Z.body = l.body);
|
|
5684
5726
|
var ie = [];
|
|
5685
|
-
for (var
|
|
5686
|
-
Z[
|
|
5727
|
+
for (var x in Z)
|
|
5728
|
+
Z[x] !== ir[x] && ie.push(x.replace(We, Ot).replace(We, o).replace(Ft, q) + "=" + Z[x].replace(We, Ot).replace(We, o).replace(fr, q));
|
|
5687
5729
|
return ie.length && (E.query = ie.join("&")), E;
|
|
5688
5730
|
}
|
|
5689
|
-
},
|
|
5731
|
+
}, hr = /^([^\:]+)\:(.*)/, qt = {
|
|
5690
5732
|
scheme: "urn",
|
|
5691
|
-
parse: function(
|
|
5692
|
-
var E =
|
|
5733
|
+
parse: function(l, g) {
|
|
5734
|
+
var E = l.path && l.path.match(hr), b = l;
|
|
5693
5735
|
if (E) {
|
|
5694
|
-
var L =
|
|
5695
|
-
b.nid = U, b.nss = J, b.path = void 0, se && (b = se.parse(b,
|
|
5736
|
+
var L = g.scheme || b.scheme || "urn", U = E[1].toLowerCase(), J = E[2], Y = L + ":" + (g.nid || U), se = M[Y];
|
|
5737
|
+
b.nid = U, b.nss = J, b.path = void 0, se && (b = se.parse(b, g));
|
|
5696
5738
|
} else
|
|
5697
5739
|
b.error = b.error || "URN can not be parsed.";
|
|
5698
5740
|
return b;
|
|
5699
5741
|
},
|
|
5700
|
-
serialize: function(
|
|
5701
|
-
var E =
|
|
5702
|
-
U && (
|
|
5703
|
-
var J =
|
|
5704
|
-
return J.path = (b ||
|
|
5742
|
+
serialize: function(l, g) {
|
|
5743
|
+
var E = g.scheme || l.scheme || "urn", b = l.nid, L = E + ":" + (g.nid || b), U = M[L];
|
|
5744
|
+
U && (l = U.serialize(l, g));
|
|
5745
|
+
var J = l, Y = l.nss;
|
|
5746
|
+
return J.path = (b || g.nid) + ":" + Y, J;
|
|
5705
5747
|
}
|
|
5706
|
-
},
|
|
5748
|
+
}, mr = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, Lt = {
|
|
5707
5749
|
scheme: "urn:uuid",
|
|
5708
|
-
parse: function(
|
|
5709
|
-
var E =
|
|
5710
|
-
return E.uuid = E.nss, E.nss = void 0, !
|
|
5750
|
+
parse: function(l, g) {
|
|
5751
|
+
var E = l;
|
|
5752
|
+
return E.uuid = E.nss, E.nss = void 0, !g.tolerant && (!E.uuid || !E.uuid.match(mr)) && (E.error = E.error || "UUID is not valid."), E;
|
|
5711
5753
|
},
|
|
5712
|
-
serialize: function(
|
|
5713
|
-
var E =
|
|
5714
|
-
return E.nss = (
|
|
5754
|
+
serialize: function(l, g) {
|
|
5755
|
+
var E = l;
|
|
5756
|
+
return E.nss = (l.uuid || "").toLowerCase(), E;
|
|
5715
5757
|
}
|
|
5716
5758
|
};
|
|
5717
|
-
M[Ne.scheme] = Ne, M[
|
|
5759
|
+
M[Ne.scheme] = Ne, M[It.scheme] = It, M[at.scheme] = at, M[At.scheme] = At, M[Mt.scheme] = Mt, M[qt.scheme] = qt, M[Lt.scheme] = Lt, r.SCHEMES = M, r.pctEncChar = q, 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 });
|
|
5718
5760
|
});
|
|
5719
5761
|
})(uri_all, uri_all.exports);
|
|
5720
5762
|
var uri_allExports = uri_all.exports;
|
|
@@ -5742,9 +5784,9 @@ uri$1.default = uri;
|
|
|
5742
5784
|
} }), Object.defineProperty(e, "CodeGen", { enumerable: !0, get: function() {
|
|
5743
5785
|
return r.CodeGen;
|
|
5744
5786
|
} });
|
|
5745
|
-
const n = validation_error, s = ref_error, i = rules, o = compile,
|
|
5787
|
+
const n = validation_error, s = ref_error, i = rules, o = compile, c = codegen, d = resolve$1, u = dataType, p = util, _ = require$$9, R = uri$1, O = (F, y) => new RegExp(F, y);
|
|
5746
5788
|
O.code = "new RegExp";
|
|
5747
|
-
const
|
|
5789
|
+
const T = ["removeAdditional", "useDefaults", "coerceTypes"], v = /* @__PURE__ */ new Set([
|
|
5748
5790
|
"validate",
|
|
5749
5791
|
"serialize",
|
|
5750
5792
|
"parse",
|
|
@@ -5778,9 +5820,9 @@ uri$1.default = uri;
|
|
|
5778
5820
|
ignoreKeywordsWithRef: "",
|
|
5779
5821
|
jsPropertySyntax: "",
|
|
5780
5822
|
unicode: '"minLength"/"maxLength" account for unicode characters by default.'
|
|
5781
|
-
},
|
|
5782
|
-
function
|
|
5783
|
-
var y, j, P, a, h, N, M, q, W, G, ne, he, Ue, tt, rt, de, nt, He, Ve,
|
|
5823
|
+
}, k = 200;
|
|
5824
|
+
function S(F) {
|
|
5825
|
+
var y, j, P, a, h, N, M, q, W, G, ne, he, Ue, tt, rt, de, nt, He, Ve, xe, st, me, le, ze, it;
|
|
5784
5826
|
const Oe = F.strict, ot = (y = F.code) === null || y === void 0 ? void 0 : y.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;
|
|
5785
5827
|
return {
|
|
5786
5828
|
strictSchema: (N = (h = F.strictSchema) !== null && h !== void 0 ? h : Oe) !== null && N !== void 0 ? N : !0,
|
|
@@ -5789,35 +5831,35 @@ uri$1.default = uri;
|
|
|
5789
5831
|
strictTuples: (he = (ne = F.strictTuples) !== null && ne !== void 0 ? ne : Oe) !== null && he !== void 0 ? he : "log",
|
|
5790
5832
|
strictRequired: (tt = (Ue = F.strictRequired) !== null && Ue !== void 0 ? Ue : Oe) !== null && tt !== void 0 ? tt : !1,
|
|
5791
5833
|
code: F.code ? { ...F.code, optimize: ut, regExp: pe } : { optimize: ut, regExp: pe },
|
|
5792
|
-
loopRequired: (rt = F.loopRequired) !== null && rt !== void 0 ? rt :
|
|
5793
|
-
loopEnum: (de = F.loopEnum) !== null && de !== void 0 ? de :
|
|
5834
|
+
loopRequired: (rt = F.loopRequired) !== null && rt !== void 0 ? rt : k,
|
|
5835
|
+
loopEnum: (de = F.loopEnum) !== null && de !== void 0 ? de : k,
|
|
5794
5836
|
meta: (nt = F.meta) !== null && nt !== void 0 ? nt : !0,
|
|
5795
5837
|
messages: (He = F.messages) !== null && He !== void 0 ? He : !0,
|
|
5796
5838
|
inlineRefs: (Ve = F.inlineRefs) !== null && Ve !== void 0 ? Ve : !0,
|
|
5797
|
-
schemaId: (
|
|
5839
|
+
schemaId: (xe = F.schemaId) !== null && xe !== void 0 ? xe : "$id",
|
|
5798
5840
|
addUsedSchema: (st = F.addUsedSchema) !== null && st !== void 0 ? st : !0,
|
|
5799
5841
|
validateSchema: (me = F.validateSchema) !== null && me !== void 0 ? me : !0,
|
|
5800
5842
|
validateFormats: (le = F.validateFormats) !== null && le !== void 0 ? le : !0,
|
|
5801
|
-
unicodeRegExp: (
|
|
5843
|
+
unicodeRegExp: (ze = F.unicodeRegExp) !== null && ze !== void 0 ? ze : !0,
|
|
5802
5844
|
int32range: (it = F.int32range) !== null && it !== void 0 ? it : !0,
|
|
5803
5845
|
uriResolver: Ne
|
|
5804
5846
|
};
|
|
5805
5847
|
}
|
|
5806
5848
|
class I {
|
|
5807
5849
|
constructor(y = {}) {
|
|
5808
|
-
this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), y = this.opts = { ...y, ...
|
|
5850
|
+
this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), y = this.opts = { ...y, ...S(y) };
|
|
5809
5851
|
const { es5: j, lines: P } = this.opts.code;
|
|
5810
|
-
this.scope = new
|
|
5852
|
+
this.scope = new c.ValueScope({ scope: {}, prefixes: v, es5: j, lines: P }), this.logger = K(y.logger);
|
|
5811
5853
|
const a = y.validateFormats;
|
|
5812
|
-
y.validateFormats = !1, this.RULES = (0, i.getRules)(), D.call(this, $, y, "NOT SUPPORTED"), D.call(this, m, y, "DEPRECATED", "warn"), this._metaOpts =
|
|
5854
|
+
y.validateFormats = !1, this.RULES = (0, i.getRules)(), D.call(this, $, y, "NOT SUPPORTED"), D.call(this, m, y, "DEPRECATED", "warn"), this._metaOpts = z.call(this), y.formats && A.call(this), this._addVocabularies(), this._addDefaultMetaSchema(), y.keywords && V.call(this, y.keywords), typeof y.meta == "object" && this.addMetaSchema(y.meta), C.call(this), y.validateFormats = a;
|
|
5813
5855
|
}
|
|
5814
5856
|
_addVocabularies() {
|
|
5815
5857
|
this.addKeyword("$async");
|
|
5816
5858
|
}
|
|
5817
5859
|
_addDefaultMetaSchema() {
|
|
5818
5860
|
const { $data: y, meta: j, schemaId: P } = this.opts;
|
|
5819
|
-
let a =
|
|
5820
|
-
P === "id" && (a = { ...
|
|
5861
|
+
let a = _;
|
|
5862
|
+
P === "id" && (a = { ..._ }, a.id = a.$id, delete a.$id), j && y && this.addMetaSchema(a, a[P], !1);
|
|
5821
5863
|
}
|
|
5822
5864
|
defaultMeta() {
|
|
5823
5865
|
const { meta: y, schemaId: j } = this.opts;
|
|
@@ -6098,9 +6140,9 @@ uri$1.default = uri;
|
|
|
6098
6140
|
j.keyword || (j.keyword = y), this.addKeyword(j);
|
|
6099
6141
|
}
|
|
6100
6142
|
}
|
|
6101
|
-
function
|
|
6143
|
+
function z() {
|
|
6102
6144
|
const F = { ...this.opts };
|
|
6103
|
-
for (const y of
|
|
6145
|
+
for (const y of T)
|
|
6104
6146
|
delete F[y];
|
|
6105
6147
|
return F;
|
|
6106
6148
|
}
|
|
@@ -6178,28 +6220,28 @@ const ref_error_1 = ref_error, code_1$8 = code, codegen_1$l = codegen, names_1$1
|
|
|
6178
6220
|
keyword: "$ref",
|
|
6179
6221
|
schemaType: "string",
|
|
6180
6222
|
code(e) {
|
|
6181
|
-
const { gen: t, schema: r, it: n } = e, { baseId: s, schemaEnv: i, validateName: o, opts:
|
|
6223
|
+
const { gen: t, schema: r, it: n } = e, { baseId: s, schemaEnv: i, validateName: o, opts: c, self: d } = n, { root: u } = i;
|
|
6182
6224
|
if ((r === "#" || r === "#/") && s === u.baseId)
|
|
6183
|
-
return
|
|
6225
|
+
return _();
|
|
6184
6226
|
const p = compile_1$1.resolveRef.call(d, u, s, r);
|
|
6185
6227
|
if (p === void 0)
|
|
6186
6228
|
throw new ref_error_1.default(n.opts.uriResolver, s, r);
|
|
6187
6229
|
if (p instanceof compile_1$1.SchemaEnv)
|
|
6188
6230
|
return R(p);
|
|
6189
6231
|
return O(p);
|
|
6190
|
-
function
|
|
6232
|
+
function _() {
|
|
6191
6233
|
if (i === u)
|
|
6192
6234
|
return callRef(e, o, i, i.$async);
|
|
6193
|
-
const
|
|
6194
|
-
return callRef(e, (0, codegen_1$l._)`${
|
|
6235
|
+
const T = t.scopeValue("root", { ref: u });
|
|
6236
|
+
return callRef(e, (0, codegen_1$l._)`${T}.validate`, u, u.$async);
|
|
6195
6237
|
}
|
|
6196
|
-
function R(
|
|
6197
|
-
const v = getValidate(e,
|
|
6198
|
-
callRef(e, v,
|
|
6238
|
+
function R(T) {
|
|
6239
|
+
const v = getValidate(e, T);
|
|
6240
|
+
callRef(e, v, T, T.$async);
|
|
6199
6241
|
}
|
|
6200
|
-
function O(
|
|
6201
|
-
const v = t.scopeValue("schema",
|
|
6202
|
-
schema:
|
|
6242
|
+
function O(T) {
|
|
6243
|
+
const v = t.scopeValue("schema", c.code.source === !0 ? { ref: T, code: (0, codegen_1$l.stringify)(T) } : { ref: T }), $ = t.name("valid"), m = e.subschema({
|
|
6244
|
+
schema: T,
|
|
6203
6245
|
dataTypes: [],
|
|
6204
6246
|
schemaPath: codegen_1$l.nil,
|
|
6205
6247
|
topSchemaRef: v,
|
|
@@ -6215,26 +6257,26 @@ function getValidate(e, t) {
|
|
|
6215
6257
|
}
|
|
6216
6258
|
ref.getValidate = getValidate;
|
|
6217
6259
|
function callRef(e, t, r, n) {
|
|
6218
|
-
const { gen: s, it: i } = e, { allErrors: o, schemaEnv:
|
|
6219
|
-
n ? p() :
|
|
6260
|
+
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;
|
|
6261
|
+
n ? p() : _();
|
|
6220
6262
|
function p() {
|
|
6221
|
-
if (!
|
|
6263
|
+
if (!c.$async)
|
|
6222
6264
|
throw new Error("async schema referenced by sync schema");
|
|
6223
|
-
const
|
|
6265
|
+
const T = s.let("valid");
|
|
6224
6266
|
s.try(() => {
|
|
6225
|
-
s.code((0, codegen_1$l._)`await ${(0, code_1$8.callValidateCode)(e, t, u)}`), O(t), o || s.assign(
|
|
6267
|
+
s.code((0, codegen_1$l._)`await ${(0, code_1$8.callValidateCode)(e, t, u)}`), O(t), o || s.assign(T, !0);
|
|
6226
6268
|
}, (v) => {
|
|
6227
|
-
s.if((0, codegen_1$l._)`!(${v} instanceof ${i.ValidationError})`, () => s.throw(v)), R(v), o || s.assign(
|
|
6228
|
-
}), e.ok(
|
|
6269
|
+
s.if((0, codegen_1$l._)`!(${v} instanceof ${i.ValidationError})`, () => s.throw(v)), R(v), o || s.assign(T, !1);
|
|
6270
|
+
}), e.ok(T);
|
|
6229
6271
|
}
|
|
6230
|
-
function
|
|
6272
|
+
function _() {
|
|
6231
6273
|
e.result((0, code_1$8.callValidateCode)(e, t, u), () => O(t), () => R(t));
|
|
6232
6274
|
}
|
|
6233
|
-
function R(
|
|
6234
|
-
const v = (0, codegen_1$l._)`${
|
|
6275
|
+
function R(T) {
|
|
6276
|
+
const v = (0, codegen_1$l._)`${T}.errors`;
|
|
6235
6277
|
s.assign(names_1$1.default.vErrors, (0, codegen_1$l._)`${names_1$1.default.vErrors} === null ? ${v} : ${names_1$1.default.vErrors}.concat(${v})`), s.assign(names_1$1.default.errors, (0, codegen_1$l._)`${names_1$1.default.vErrors}.length`);
|
|
6236
6278
|
}
|
|
6237
|
-
function O(
|
|
6279
|
+
function O(T) {
|
|
6238
6280
|
var v;
|
|
6239
6281
|
if (!i.opts.unevaluated)
|
|
6240
6282
|
return;
|
|
@@ -6243,14 +6285,14 @@ function callRef(e, t, r, n) {
|
|
|
6243
6285
|
if ($ && !$.dynamicProps)
|
|
6244
6286
|
$.props !== void 0 && (i.props = util_1$j.mergeEvaluated.props(s, $.props, i.props));
|
|
6245
6287
|
else {
|
|
6246
|
-
const m = s.var("props", (0, codegen_1$l._)`${
|
|
6288
|
+
const m = s.var("props", (0, codegen_1$l._)`${T}.evaluated.props`);
|
|
6247
6289
|
i.props = util_1$j.mergeEvaluated.props(s, m, i.props, codegen_1$l.Name);
|
|
6248
6290
|
}
|
|
6249
6291
|
if (i.items !== !0)
|
|
6250
6292
|
if ($ && !$.dynamicItems)
|
|
6251
6293
|
$.items !== void 0 && (i.items = util_1$j.mergeEvaluated.items(s, $.items, i.items));
|
|
6252
6294
|
else {
|
|
6253
|
-
const m = s.var("items", (0, codegen_1$l._)`${
|
|
6295
|
+
const m = s.var("items", (0, codegen_1$l._)`${T}.evaluated.items`);
|
|
6254
6296
|
i.items = util_1$j.mergeEvaluated.items(s, m, i.items, codegen_1$l.Name);
|
|
6255
6297
|
}
|
|
6256
6298
|
}
|
|
@@ -6303,8 +6345,8 @@ const codegen_1$j = codegen, error$h = {
|
|
|
6303
6345
|
$data: !0,
|
|
6304
6346
|
error: error$h,
|
|
6305
6347
|
code(e) {
|
|
6306
|
-
const { gen: t, data: r, schemaCode: n, it: s } = e, i = s.opts.multipleOfPrecision, o = t.let("res"),
|
|
6307
|
-
e.fail$data((0, codegen_1$j._)`(${n} === 0 || (${o} = ${r}/${n}, ${
|
|
6348
|
+
const { gen: t, data: r, schemaCode: n, it: s } = e, i = s.opts.multipleOfPrecision, o = t.let("res"), c = i ? (0, codegen_1$j._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${i}` : (0, codegen_1$j._)`${o} !== parseInt(${o})`;
|
|
6349
|
+
e.fail$data((0, codegen_1$j._)`(${n} === 0 || (${o} = ${r}/${n}, ${c}))`);
|
|
6308
6350
|
}
|
|
6309
6351
|
};
|
|
6310
6352
|
multipleOf.default = def$p;
|
|
@@ -6350,8 +6392,8 @@ const code_1$7 = code, codegen_1$h = codegen, error$f = {
|
|
|
6350
6392
|
$data: !0,
|
|
6351
6393
|
error: error$f,
|
|
6352
6394
|
code(e) {
|
|
6353
|
-
const { data: t, $data: r, schema: n, schemaCode: s, it: i } = e, o = i.opts.unicodeRegExp ? "u" : "",
|
|
6354
|
-
e.fail$data((0, codegen_1$h._)`!${
|
|
6395
|
+
const { data: t, $data: r, schema: n, schemaCode: s, it: i } = e, o = i.opts.unicodeRegExp ? "u" : "", c = r ? (0, codegen_1$h._)`(new RegExp(${s}, ${o}))` : (0, code_1$7.usePattern)(e, n);
|
|
6396
|
+
e.fail$data((0, codegen_1$h._)`!${c}.test(${t})`);
|
|
6355
6397
|
}
|
|
6356
6398
|
};
|
|
6357
6399
|
pattern.default = def$n;
|
|
@@ -6387,21 +6429,21 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6387
6429
|
$data: !0,
|
|
6388
6430
|
error: error$d,
|
|
6389
6431
|
code(e) {
|
|
6390
|
-
const { gen: t, schema: r, schemaCode: n, data: s, $data: i, it: o } = e, { opts:
|
|
6432
|
+
const { gen: t, schema: r, schemaCode: n, data: s, $data: i, it: o } = e, { opts: c } = o;
|
|
6391
6433
|
if (!i && r.length === 0)
|
|
6392
6434
|
return;
|
|
6393
|
-
const d = r.length >=
|
|
6394
|
-
if (o.allErrors ? u() : p(),
|
|
6395
|
-
const O = e.parentSchema.properties, { definedProperties:
|
|
6435
|
+
const d = r.length >= c.loopRequired;
|
|
6436
|
+
if (o.allErrors ? u() : p(), c.strictRequired) {
|
|
6437
|
+
const O = e.parentSchema.properties, { definedProperties: T } = e.it;
|
|
6396
6438
|
for (const v of r)
|
|
6397
|
-
if ((O == null ? void 0 : O[v]) === void 0 && !
|
|
6439
|
+
if ((O == null ? void 0 : O[v]) === void 0 && !T.has(v)) {
|
|
6398
6440
|
const $ = o.schemaEnv.baseId + o.errSchemaPath, m = `required property "${v}" is not defined at "${$}" (strictRequired)`;
|
|
6399
6441
|
(0, util_1$h.checkStrictMode)(o, m, o.opts.strictRequired);
|
|
6400
6442
|
}
|
|
6401
6443
|
}
|
|
6402
6444
|
function u() {
|
|
6403
6445
|
if (d || i)
|
|
6404
|
-
e.block$data(codegen_1$f.nil,
|
|
6446
|
+
e.block$data(codegen_1$f.nil, _);
|
|
6405
6447
|
else
|
|
6406
6448
|
for (const O of r)
|
|
6407
6449
|
(0, code_1$6.checkReportMissingProp)(e, O);
|
|
@@ -6409,19 +6451,19 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6409
6451
|
function p() {
|
|
6410
6452
|
const O = t.let("missing");
|
|
6411
6453
|
if (d || i) {
|
|
6412
|
-
const
|
|
6413
|
-
e.block$data(
|
|
6454
|
+
const T = t.let("valid", !0);
|
|
6455
|
+
e.block$data(T, () => R(O, T)), e.ok(T);
|
|
6414
6456
|
} else
|
|
6415
6457
|
t.if((0, code_1$6.checkMissingProp)(e, r, O)), (0, code_1$6.reportMissingProp)(e, O), t.else();
|
|
6416
6458
|
}
|
|
6417
|
-
function
|
|
6459
|
+
function _() {
|
|
6418
6460
|
t.forOf("prop", n, (O) => {
|
|
6419
|
-
e.setParams({ missingProperty: O }), t.if((0, code_1$6.noPropertyInData)(t, s, O,
|
|
6461
|
+
e.setParams({ missingProperty: O }), t.if((0, code_1$6.noPropertyInData)(t, s, O, c.ownProperties), () => e.error());
|
|
6420
6462
|
});
|
|
6421
6463
|
}
|
|
6422
|
-
function R(O,
|
|
6464
|
+
function R(O, T) {
|
|
6423
6465
|
e.setParams({ missingProperty: O }), t.forOf(O, n, () => {
|
|
6424
|
-
t.assign(
|
|
6466
|
+
t.assign(T, (0, code_1$6.propertyInData)(t, s, O, c.ownProperties)), t.if((0, codegen_1$f.not)(T), () => {
|
|
6425
6467
|
e.error(), t.break();
|
|
6426
6468
|
});
|
|
6427
6469
|
}, codegen_1$f.nil);
|
|
@@ -6465,29 +6507,29 @@ const dataType_1 = dataType, codegen_1$d = codegen, util_1$g = util, equal_1$2 =
|
|
|
6465
6507
|
$data: !0,
|
|
6466
6508
|
error: error$b,
|
|
6467
6509
|
code(e) {
|
|
6468
|
-
const { gen: t, data: r, $data: n, schema: s, parentSchema: i, schemaCode: o, it:
|
|
6510
|
+
const { gen: t, data: r, $data: n, schema: s, parentSchema: i, schemaCode: o, it: c } = e;
|
|
6469
6511
|
if (!n && !s)
|
|
6470
6512
|
return;
|
|
6471
6513
|
const d = t.let("valid"), u = i.items ? (0, dataType_1.getSchemaTypes)(i.items) : [];
|
|
6472
6514
|
e.block$data(d, p, (0, codegen_1$d._)`${o} === false`), e.ok(d);
|
|
6473
6515
|
function p() {
|
|
6474
|
-
const
|
|
6475
|
-
e.setParams({ i:
|
|
6476
|
-
}
|
|
6477
|
-
function
|
|
6478
|
-
return u.length > 0 && !u.some((
|
|
6479
|
-
}
|
|
6480
|
-
function R(
|
|
6481
|
-
const $ = t.name("item"), m = (0, dataType_1.checkDataTypes)(u, $,
|
|
6482
|
-
t.for((0, codegen_1$d._)`;${
|
|
6483
|
-
t.let($, (0, codegen_1$d._)`${r}[${
|
|
6484
|
-
t.assign(v, (0, codegen_1$d._)`${
|
|
6485
|
-
}).code((0, codegen_1$d._)`${
|
|
6516
|
+
const T = t.let("i", (0, codegen_1$d._)`${r}.length`), v = t.let("j");
|
|
6517
|
+
e.setParams({ i: T, j: v }), t.assign(d, !0), t.if((0, codegen_1$d._)`${T} > 1`, () => (_() ? R : O)(T, v));
|
|
6518
|
+
}
|
|
6519
|
+
function _() {
|
|
6520
|
+
return u.length > 0 && !u.some((T) => T === "object" || T === "array");
|
|
6521
|
+
}
|
|
6522
|
+
function R(T, v) {
|
|
6523
|
+
const $ = t.name("item"), m = (0, dataType_1.checkDataTypes)(u, $, c.opts.strictNumbers, dataType_1.DataType.Wrong), k = t.const("indices", (0, codegen_1$d._)`{}`);
|
|
6524
|
+
t.for((0, codegen_1$d._)`;${T}--;`, () => {
|
|
6525
|
+
t.let($, (0, codegen_1$d._)`${r}[${T}]`), t.if(m, (0, codegen_1$d._)`continue`), u.length > 1 && t.if((0, codegen_1$d._)`typeof ${$} == "string"`, (0, codegen_1$d._)`${$} += "_"`), t.if((0, codegen_1$d._)`typeof ${k}[${$}] == "number"`, () => {
|
|
6526
|
+
t.assign(v, (0, codegen_1$d._)`${k}[${$}]`), e.error(), t.assign(d, !1).break();
|
|
6527
|
+
}).code((0, codegen_1$d._)`${k}[${$}] = ${T}`);
|
|
6486
6528
|
});
|
|
6487
6529
|
}
|
|
6488
|
-
function O(
|
|
6530
|
+
function O(T, v) {
|
|
6489
6531
|
const $ = (0, util_1$g.useFunc)(t, equal_1$2.default), m = t.name("outer");
|
|
6490
|
-
t.label(m).for((0, codegen_1$d._)`;${
|
|
6532
|
+
t.label(m).for((0, codegen_1$d._)`;${T}--;`, () => t.for((0, codegen_1$d._)`${v} = ${T}; ${v}--;`, () => t.if((0, codegen_1$d._)`${$}(${r}[${T}], ${r}[${v}])`, () => {
|
|
6491
6533
|
e.error(), t.assign(d, !1).break(m);
|
|
6492
6534
|
})));
|
|
6493
6535
|
}
|
|
@@ -6523,25 +6565,25 @@ const codegen_1$b = codegen, util_1$e = util, equal_1 = equal$1, error$9 = {
|
|
|
6523
6565
|
const { gen: t, data: r, $data: n, schema: s, schemaCode: i, it: o } = e;
|
|
6524
6566
|
if (!n && s.length === 0)
|
|
6525
6567
|
throw new Error("enum must have non-empty array");
|
|
6526
|
-
const
|
|
6568
|
+
const c = s.length >= o.opts.loopEnum;
|
|
6527
6569
|
let d;
|
|
6528
6570
|
const u = () => d ?? (d = (0, util_1$e.useFunc)(t, equal_1.default));
|
|
6529
6571
|
let p;
|
|
6530
|
-
if (
|
|
6531
|
-
p = t.let("valid"), e.block$data(p,
|
|
6572
|
+
if (c || n)
|
|
6573
|
+
p = t.let("valid"), e.block$data(p, _);
|
|
6532
6574
|
else {
|
|
6533
6575
|
if (!Array.isArray(s))
|
|
6534
6576
|
throw new Error("ajv implementation error");
|
|
6535
6577
|
const O = t.const("vSchema", i);
|
|
6536
|
-
p = (0, codegen_1$b.or)(...s.map((
|
|
6578
|
+
p = (0, codegen_1$b.or)(...s.map((T, v) => R(O, v)));
|
|
6537
6579
|
}
|
|
6538
6580
|
e.pass(p);
|
|
6539
|
-
function
|
|
6581
|
+
function _() {
|
|
6540
6582
|
t.assign(p, !1), t.forOf("v", i, (O) => t.if((0, codegen_1$b._)`${u()}(${r}, ${O})`, () => t.assign(p, !0).break()));
|
|
6541
6583
|
}
|
|
6542
|
-
function R(O,
|
|
6543
|
-
const v = s[
|
|
6544
|
-
return typeof v == "object" && v !== null ? (0, codegen_1$b._)`${u()}(${r}, ${O}[${
|
|
6584
|
+
function R(O, T) {
|
|
6585
|
+
const v = s[T];
|
|
6586
|
+
return typeof v == "object" && v !== null ? (0, codegen_1$b._)`${u()}(${r}, ${O}[${T}])` : (0, codegen_1$b._)`${r} === ${v}`;
|
|
6545
6587
|
}
|
|
6546
6588
|
}
|
|
6547
6589
|
};
|
|
@@ -6591,15 +6633,15 @@ const codegen_1$a = codegen, util_1$d = util, error$8 = {
|
|
|
6591
6633
|
function validateAdditionalItems(e, t) {
|
|
6592
6634
|
const { gen: r, schema: n, data: s, keyword: i, it: o } = e;
|
|
6593
6635
|
o.items = !0;
|
|
6594
|
-
const
|
|
6636
|
+
const c = r.const("len", (0, codegen_1$a._)`${s}.length`);
|
|
6595
6637
|
if (n === !1)
|
|
6596
|
-
e.setParams({ len: t.length }), e.pass((0, codegen_1$a._)`${
|
|
6638
|
+
e.setParams({ len: t.length }), e.pass((0, codegen_1$a._)`${c} <= ${t.length}`);
|
|
6597
6639
|
else if (typeof n == "object" && !(0, util_1$d.alwaysValidSchema)(o, n)) {
|
|
6598
|
-
const u = r.var("valid", (0, codegen_1$a._)`${
|
|
6640
|
+
const u = r.var("valid", (0, codegen_1$a._)`${c} <= ${t.length}`);
|
|
6599
6641
|
r.if((0, codegen_1$a.not)(u), () => d(u)), e.ok(u);
|
|
6600
6642
|
}
|
|
6601
6643
|
function d(u) {
|
|
6602
|
-
r.forRange("i", t.length,
|
|
6644
|
+
r.forRange("i", t.length, c, (p) => {
|
|
6603
6645
|
e.subschema({ keyword: i, dataProp: p, dataPropType: util_1$d.Type.Num }, u), o.allErrors || r.if((0, codegen_1$a.not)(u), () => r.break());
|
|
6604
6646
|
});
|
|
6605
6647
|
}
|
|
@@ -6622,21 +6664,21 @@ const codegen_1$9 = codegen, util_1$c = util, code_1$5 = code, def$f = {
|
|
|
6622
6664
|
}
|
|
6623
6665
|
};
|
|
6624
6666
|
function validateTuple(e, t, r = e.schema) {
|
|
6625
|
-
const { gen: n, parentSchema: s, data: i, keyword: o, it:
|
|
6626
|
-
p(s),
|
|
6667
|
+
const { gen: n, parentSchema: s, data: i, keyword: o, it: c } = e;
|
|
6668
|
+
p(s), c.opts.unevaluated && r.length && c.items !== !0 && (c.items = util_1$c.mergeEvaluated.items(n, r.length, c.items));
|
|
6627
6669
|
const d = n.name("valid"), u = n.const("len", (0, codegen_1$9._)`${i}.length`);
|
|
6628
|
-
r.forEach((
|
|
6629
|
-
(0, util_1$c.alwaysValidSchema)(
|
|
6670
|
+
r.forEach((_, R) => {
|
|
6671
|
+
(0, util_1$c.alwaysValidSchema)(c, _) || (n.if((0, codegen_1$9._)`${u} > ${R}`, () => e.subschema({
|
|
6630
6672
|
keyword: o,
|
|
6631
6673
|
schemaProp: R,
|
|
6632
6674
|
dataProp: R
|
|
6633
6675
|
}, d)), e.ok(d));
|
|
6634
6676
|
});
|
|
6635
|
-
function p(
|
|
6636
|
-
const { opts: R, errSchemaPath: O } =
|
|
6677
|
+
function p(_) {
|
|
6678
|
+
const { opts: R, errSchemaPath: O } = c, T = r.length, v = T === _.minItems && (T === _.maxItems || _[t] === !1);
|
|
6637
6679
|
if (R.strictTuples && !v) {
|
|
6638
|
-
const $ = `"${o}" is ${
|
|
6639
|
-
(0, util_1$c.checkStrictMode)(
|
|
6680
|
+
const $ = `"${o}" is ${T}-tuple, but minItems or maxItems/${t} are not specified or different at path "${O}"`;
|
|
6681
|
+
(0, util_1$c.checkStrictMode)(c, $, R.strictTuples);
|
|
6640
6682
|
}
|
|
6641
6683
|
}
|
|
6642
6684
|
}
|
|
@@ -6682,29 +6724,29 @@ const codegen_1$7 = codegen, util_1$a = util, error$6 = {
|
|
|
6682
6724
|
error: error$6,
|
|
6683
6725
|
code(e) {
|
|
6684
6726
|
const { gen: t, schema: r, parentSchema: n, data: s, it: i } = e;
|
|
6685
|
-
let o,
|
|
6727
|
+
let o, c;
|
|
6686
6728
|
const { minContains: d, maxContains: u } = n;
|
|
6687
|
-
i.opts.next ? (o = d === void 0 ? 1 : d,
|
|
6729
|
+
i.opts.next ? (o = d === void 0 ? 1 : d, c = u) : o = 1;
|
|
6688
6730
|
const p = t.const("len", (0, codegen_1$7._)`${s}.length`);
|
|
6689
|
-
if (e.setParams({ min: o, max:
|
|
6731
|
+
if (e.setParams({ min: o, max: c }), c === void 0 && o === 0) {
|
|
6690
6732
|
(0, util_1$a.checkStrictMode)(i, '"minContains" == 0 without "maxContains": "contains" keyword ignored');
|
|
6691
6733
|
return;
|
|
6692
6734
|
}
|
|
6693
|
-
if (
|
|
6735
|
+
if (c !== void 0 && o > c) {
|
|
6694
6736
|
(0, util_1$a.checkStrictMode)(i, '"minContains" > "maxContains" is always invalid'), e.fail();
|
|
6695
6737
|
return;
|
|
6696
6738
|
}
|
|
6697
6739
|
if ((0, util_1$a.alwaysValidSchema)(i, r)) {
|
|
6698
6740
|
let v = (0, codegen_1$7._)`${p} >= ${o}`;
|
|
6699
|
-
|
|
6741
|
+
c !== void 0 && (v = (0, codegen_1$7._)`${v} && ${p} <= ${c}`), e.pass(v);
|
|
6700
6742
|
return;
|
|
6701
6743
|
}
|
|
6702
6744
|
i.items = !0;
|
|
6703
|
-
const
|
|
6704
|
-
|
|
6745
|
+
const _ = t.name("valid");
|
|
6746
|
+
c === void 0 && o === 1 ? O(_, () => t.if(_, () => t.break())) : o === 0 ? (t.let(_, !0), c !== void 0 && t.if((0, codegen_1$7._)`${s}.length > 0`, R)) : (t.let(_, !1), R()), e.result(_, () => e.reset());
|
|
6705
6747
|
function R() {
|
|
6706
6748
|
const v = t.name("_valid"), $ = t.let("count", 0);
|
|
6707
|
-
O(v, () => t.if(v, () =>
|
|
6749
|
+
O(v, () => t.if(v, () => T($)));
|
|
6708
6750
|
}
|
|
6709
6751
|
function O(v, $) {
|
|
6710
6752
|
t.forRange("i", 0, p, (m) => {
|
|
@@ -6716,8 +6758,8 @@ const codegen_1$7 = codegen, util_1$a = util, error$6 = {
|
|
|
6716
6758
|
}, v), $();
|
|
6717
6759
|
});
|
|
6718
6760
|
}
|
|
6719
|
-
function
|
|
6720
|
-
t.code((0, codegen_1$7._)`${v}++`),
|
|
6761
|
+
function T(v) {
|
|
6762
|
+
t.code((0, codegen_1$7._)`${v}++`), c === void 0 ? t.if((0, codegen_1$7._)`${v} >= ${o}`, () => t.assign(_, !0).break()) : (t.if((0, codegen_1$7._)`${v} > ${c}`, () => t.assign(_, !1).break()), o === 1 ? t.assign(_, !0) : t.if((0, codegen_1$7._)`${v} >= ${o}`, () => t.assign(_, !0)));
|
|
6721
6763
|
}
|
|
6722
6764
|
}
|
|
6723
6765
|
};
|
|
@@ -6728,11 +6770,11 @@ var dependencies = {};
|
|
|
6728
6770
|
const t = codegen, r = util, n = code;
|
|
6729
6771
|
e.error = {
|
|
6730
6772
|
message: ({ params: { property: d, depsCount: u, deps: p } }) => {
|
|
6731
|
-
const
|
|
6732
|
-
return (0, t.str)`must have ${
|
|
6773
|
+
const _ = u === 1 ? "property" : "properties";
|
|
6774
|
+
return (0, t.str)`must have ${_} ${p} when property ${d} is present`;
|
|
6733
6775
|
},
|
|
6734
|
-
params: ({ params: { property: d, depsCount: u, deps: p, missingProperty:
|
|
6735
|
-
missingProperty: ${
|
|
6776
|
+
params: ({ params: { property: d, depsCount: u, deps: p, missingProperty: _ } }) => (0, t._)`{property: ${d},
|
|
6777
|
+
missingProperty: ${_},
|
|
6736
6778
|
depsCount: ${u},
|
|
6737
6779
|
deps: ${p}}`
|
|
6738
6780
|
// TODO change to reference
|
|
@@ -6744,31 +6786,31 @@ var dependencies = {};
|
|
|
6744
6786
|
error: e.error,
|
|
6745
6787
|
code(d) {
|
|
6746
6788
|
const [u, p] = i(d);
|
|
6747
|
-
o(d, u),
|
|
6789
|
+
o(d, u), c(d, p);
|
|
6748
6790
|
}
|
|
6749
6791
|
};
|
|
6750
6792
|
function i({ schema: d }) {
|
|
6751
6793
|
const u = {}, p = {};
|
|
6752
|
-
for (const
|
|
6753
|
-
if (
|
|
6794
|
+
for (const _ in d) {
|
|
6795
|
+
if (_ === "__proto__")
|
|
6754
6796
|
continue;
|
|
6755
|
-
const R = Array.isArray(d[
|
|
6756
|
-
R[
|
|
6797
|
+
const R = Array.isArray(d[_]) ? u : p;
|
|
6798
|
+
R[_] = d[_];
|
|
6757
6799
|
}
|
|
6758
6800
|
return [u, p];
|
|
6759
6801
|
}
|
|
6760
6802
|
function o(d, u = d.schema) {
|
|
6761
|
-
const { gen: p, data:
|
|
6803
|
+
const { gen: p, data: _, it: R } = d;
|
|
6762
6804
|
if (Object.keys(u).length === 0)
|
|
6763
6805
|
return;
|
|
6764
6806
|
const O = p.let("missing");
|
|
6765
|
-
for (const
|
|
6766
|
-
const v = u[
|
|
6807
|
+
for (const T in u) {
|
|
6808
|
+
const v = u[T];
|
|
6767
6809
|
if (v.length === 0)
|
|
6768
6810
|
continue;
|
|
6769
|
-
const $ = (0, n.propertyInData)(p,
|
|
6811
|
+
const $ = (0, n.propertyInData)(p, _, T, R.opts.ownProperties);
|
|
6770
6812
|
d.setParams({
|
|
6771
|
-
property:
|
|
6813
|
+
property: T,
|
|
6772
6814
|
depsCount: v.length,
|
|
6773
6815
|
deps: v.join(", ")
|
|
6774
6816
|
}), R.allErrors ? p.if($, () => {
|
|
@@ -6778,20 +6820,20 @@ var dependencies = {};
|
|
|
6778
6820
|
}
|
|
6779
6821
|
}
|
|
6780
6822
|
e.validatePropertyDeps = o;
|
|
6781
|
-
function
|
|
6782
|
-
const { gen: p, data:
|
|
6823
|
+
function c(d, u = d.schema) {
|
|
6824
|
+
const { gen: p, data: _, keyword: R, it: O } = d, T = p.name("valid");
|
|
6783
6825
|
for (const v in u)
|
|
6784
6826
|
(0, r.alwaysValidSchema)(O, u[v]) || (p.if(
|
|
6785
|
-
(0, n.propertyInData)(p,
|
|
6827
|
+
(0, n.propertyInData)(p, _, v, O.opts.ownProperties),
|
|
6786
6828
|
() => {
|
|
6787
|
-
const $ = d.subschema({ keyword: R, schemaProp: v },
|
|
6788
|
-
d.mergeValidEvaluated($,
|
|
6829
|
+
const $ = d.subschema({ keyword: R, schemaProp: v }, T);
|
|
6830
|
+
d.mergeValidEvaluated($, T);
|
|
6789
6831
|
},
|
|
6790
|
-
() => p.var(
|
|
6832
|
+
() => p.var(T, !0)
|
|
6791
6833
|
// TODO var
|
|
6792
|
-
), d.ok(
|
|
6834
|
+
), d.ok(T));
|
|
6793
6835
|
}
|
|
6794
|
-
e.validateSchemaDeps =
|
|
6836
|
+
e.validateSchemaDeps = c, e.default = s;
|
|
6795
6837
|
})(dependencies);
|
|
6796
6838
|
var propertyNames = {};
|
|
6797
6839
|
Object.defineProperty(propertyNames, "__esModule", { value: !0 });
|
|
@@ -6838,55 +6880,55 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
6838
6880
|
const { gen: t, schema: r, parentSchema: n, data: s, errsCount: i, it: o } = e;
|
|
6839
6881
|
if (!i)
|
|
6840
6882
|
throw new Error("ajv implementation error");
|
|
6841
|
-
const { allErrors:
|
|
6883
|
+
const { allErrors: c, opts: d } = o;
|
|
6842
6884
|
if (o.props = !0, d.removeAdditional !== "all" && (0, util_1$8.alwaysValidSchema)(o, r))
|
|
6843
6885
|
return;
|
|
6844
6886
|
const u = (0, code_1$3.allSchemaProperties)(n.properties), p = (0, code_1$3.allSchemaProperties)(n.patternProperties);
|
|
6845
|
-
|
|
6846
|
-
function
|
|
6887
|
+
_(), e.ok((0, codegen_1$5._)`${i} === ${names_1.default.errors}`);
|
|
6888
|
+
function _() {
|
|
6847
6889
|
t.forIn("key", s, ($) => {
|
|
6848
|
-
!u.length && !p.length ?
|
|
6890
|
+
!u.length && !p.length ? T($) : t.if(R($), () => T($));
|
|
6849
6891
|
});
|
|
6850
6892
|
}
|
|
6851
6893
|
function R($) {
|
|
6852
6894
|
let m;
|
|
6853
6895
|
if (u.length > 8) {
|
|
6854
|
-
const
|
|
6855
|
-
m = (0, code_1$3.isOwnProperty)(t,
|
|
6896
|
+
const k = (0, util_1$8.schemaRefOrVal)(o, n.properties, "properties");
|
|
6897
|
+
m = (0, code_1$3.isOwnProperty)(t, k, $);
|
|
6856
6898
|
} else
|
|
6857
|
-
u.length ? m = (0, codegen_1$5.or)(...u.map((
|
|
6858
|
-
return p.length && (m = (0, codegen_1$5.or)(m, ...p.map((
|
|
6899
|
+
u.length ? m = (0, codegen_1$5.or)(...u.map((k) => (0, codegen_1$5._)`${$} === ${k}`)) : m = codegen_1$5.nil;
|
|
6900
|
+
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(${$})`))), (0, codegen_1$5.not)(m);
|
|
6859
6901
|
}
|
|
6860
6902
|
function O($) {
|
|
6861
6903
|
t.code((0, codegen_1$5._)`delete ${s}[${$}]`);
|
|
6862
6904
|
}
|
|
6863
|
-
function
|
|
6905
|
+
function T($) {
|
|
6864
6906
|
if (d.removeAdditional === "all" || d.removeAdditional && r === !1) {
|
|
6865
6907
|
O($);
|
|
6866
6908
|
return;
|
|
6867
6909
|
}
|
|
6868
6910
|
if (r === !1) {
|
|
6869
|
-
e.setParams({ additionalProperty: $ }), e.error(),
|
|
6911
|
+
e.setParams({ additionalProperty: $ }), e.error(), c || t.break();
|
|
6870
6912
|
return;
|
|
6871
6913
|
}
|
|
6872
6914
|
if (typeof r == "object" && !(0, util_1$8.alwaysValidSchema)(o, r)) {
|
|
6873
6915
|
const m = t.name("valid");
|
|
6874
6916
|
d.removeAdditional === "failing" ? (v($, m, !1), t.if((0, codegen_1$5.not)(m), () => {
|
|
6875
6917
|
e.reset(), O($);
|
|
6876
|
-
})) : (v($, m),
|
|
6918
|
+
})) : (v($, m), c || t.if((0, codegen_1$5.not)(m), () => t.break()));
|
|
6877
6919
|
}
|
|
6878
6920
|
}
|
|
6879
|
-
function v($, m,
|
|
6880
|
-
const
|
|
6921
|
+
function v($, m, k) {
|
|
6922
|
+
const S = {
|
|
6881
6923
|
keyword: "additionalProperties",
|
|
6882
6924
|
dataProp: $,
|
|
6883
6925
|
dataPropType: util_1$8.Type.Str
|
|
6884
6926
|
};
|
|
6885
|
-
|
|
6927
|
+
k === !1 && Object.assign(S, {
|
|
6886
6928
|
compositeRule: !0,
|
|
6887
6929
|
createErrors: !1,
|
|
6888
6930
|
allErrors: !1
|
|
6889
|
-
}), e.subschema(
|
|
6931
|
+
}), e.subschema(S, m);
|
|
6890
6932
|
}
|
|
6891
6933
|
}
|
|
6892
6934
|
};
|
|
@@ -6901,23 +6943,23 @@ const validate_1 = validate, code_1$2 = code, util_1$7 = util, additionalPropert
|
|
|
6901
6943
|
const { gen: t, schema: r, parentSchema: n, data: s, it: i } = e;
|
|
6902
6944
|
i.opts.removeAdditional === "all" && n.additionalProperties === void 0 && additionalProperties_1$1.default.code(new validate_1.KeywordCxt(i, additionalProperties_1$1.default, "additionalProperties"));
|
|
6903
6945
|
const o = (0, code_1$2.allSchemaProperties)(r);
|
|
6904
|
-
for (const
|
|
6905
|
-
i.definedProperties.add(
|
|
6946
|
+
for (const _ of o)
|
|
6947
|
+
i.definedProperties.add(_);
|
|
6906
6948
|
i.opts.unevaluated && o.length && i.props !== !0 && (i.props = util_1$7.mergeEvaluated.props(t, (0, util_1$7.toHash)(o), i.props));
|
|
6907
|
-
const
|
|
6908
|
-
if (
|
|
6949
|
+
const c = o.filter((_) => !(0, util_1$7.alwaysValidSchema)(i, r[_]));
|
|
6950
|
+
if (c.length === 0)
|
|
6909
6951
|
return;
|
|
6910
6952
|
const d = t.name("valid");
|
|
6911
|
-
for (const
|
|
6912
|
-
u(
|
|
6913
|
-
function u(
|
|
6914
|
-
return i.opts.useDefaults && !i.compositeRule && r[
|
|
6953
|
+
for (const _ of c)
|
|
6954
|
+
u(_) ? p(_) : (t.if((0, code_1$2.propertyInData)(t, s, _, i.opts.ownProperties)), p(_), i.allErrors || t.else().var(d, !0), t.endIf()), e.it.definedProperties.add(_), e.ok(d);
|
|
6955
|
+
function u(_) {
|
|
6956
|
+
return i.opts.useDefaults && !i.compositeRule && r[_].default !== void 0;
|
|
6915
6957
|
}
|
|
6916
|
-
function p(
|
|
6958
|
+
function p(_) {
|
|
6917
6959
|
e.subschema({
|
|
6918
6960
|
keyword: "properties",
|
|
6919
|
-
schemaProp:
|
|
6920
|
-
dataProp:
|
|
6961
|
+
schemaProp: _,
|
|
6962
|
+
dataProp: _
|
|
6921
6963
|
}, d);
|
|
6922
6964
|
}
|
|
6923
6965
|
}
|
|
@@ -6930,22 +6972,22 @@ const code_1$1 = code, codegen_1$4 = codegen, util_1$6 = util, util_2 = util, de
|
|
|
6930
6972
|
type: "object",
|
|
6931
6973
|
schemaType: "object",
|
|
6932
6974
|
code(e) {
|
|
6933
|
-
const { gen: t, schema: r, data: n, parentSchema: s, it: i } = e, { opts: o } = i,
|
|
6934
|
-
if (
|
|
6975
|
+
const { gen: t, schema: r, data: n, parentSchema: s, it: i } = e, { opts: o } = i, c = (0, code_1$1.allSchemaProperties)(r), d = c.filter((v) => (0, util_1$6.alwaysValidSchema)(i, r[v]));
|
|
6976
|
+
if (c.length === 0 || d.length === c.length && (!i.opts.unevaluated || i.props === !0))
|
|
6935
6977
|
return;
|
|
6936
6978
|
const u = o.strictSchema && !o.allowMatchingProperties && s.properties, p = t.name("valid");
|
|
6937
6979
|
i.props !== !0 && !(i.props instanceof codegen_1$4.Name) && (i.props = (0, util_2.evaluatedPropsToName)(t, i.props));
|
|
6938
|
-
const { props:
|
|
6980
|
+
const { props: _ } = i;
|
|
6939
6981
|
R();
|
|
6940
6982
|
function R() {
|
|
6941
|
-
for (const v of
|
|
6942
|
-
u && O(v), i.allErrors ?
|
|
6983
|
+
for (const v of c)
|
|
6984
|
+
u && O(v), i.allErrors ? T(v) : (t.var(p, !0), T(v), t.if(p));
|
|
6943
6985
|
}
|
|
6944
6986
|
function O(v) {
|
|
6945
6987
|
for (const $ in u)
|
|
6946
6988
|
new RegExp(v).test($) && (0, util_1$6.checkStrictMode)(i, `property ${$} matches pattern ${v} (use allowMatchingProperties)`);
|
|
6947
6989
|
}
|
|
6948
|
-
function
|
|
6990
|
+
function T(v) {
|
|
6949
6991
|
t.forIn("key", n, ($) => {
|
|
6950
6992
|
t.if((0, codegen_1$4._)`${(0, code_1$1.usePattern)(e, v)}.test(${$})`, () => {
|
|
6951
6993
|
const m = d.includes(v);
|
|
@@ -6954,7 +6996,7 @@ const code_1$1 = code, codegen_1$4 = codegen, util_1$6 = util, util_2 = util, de
|
|
|
6954
6996
|
schemaProp: v,
|
|
6955
6997
|
dataProp: $,
|
|
6956
6998
|
dataPropType: util_2.Type.Str
|
|
6957
|
-
}, p), i.opts.unevaluated &&
|
|
6999
|
+
}, p), i.opts.unevaluated && _ !== !0 ? t.assign((0, codegen_1$4._)`${_}[${$}]`, !0) : !m && !i.allErrors && t.if((0, codegen_1$4.not)(p), () => t.break());
|
|
6958
7000
|
});
|
|
6959
7001
|
});
|
|
6960
7002
|
}
|
|
@@ -7010,17 +7052,17 @@ const codegen_1$3 = codegen, util_1$4 = util, error$3 = {
|
|
|
7010
7052
|
throw new Error("ajv implementation error");
|
|
7011
7053
|
if (s.opts.discriminator && n.discriminator)
|
|
7012
7054
|
return;
|
|
7013
|
-
const i = r, o = t.let("valid", !1),
|
|
7014
|
-
e.setParams({ passing:
|
|
7055
|
+
const i = r, o = t.let("valid", !1), c = t.let("passing", null), d = t.name("_valid");
|
|
7056
|
+
e.setParams({ passing: c }), t.block(u), e.result(o, () => e.reset(), () => e.error(!0));
|
|
7015
7057
|
function u() {
|
|
7016
|
-
i.forEach((p,
|
|
7058
|
+
i.forEach((p, _) => {
|
|
7017
7059
|
let R;
|
|
7018
7060
|
(0, util_1$4.alwaysValidSchema)(s, p) ? t.var(d, !0) : R = e.subschema({
|
|
7019
7061
|
keyword: "oneOf",
|
|
7020
|
-
schemaProp:
|
|
7062
|
+
schemaProp: _,
|
|
7021
7063
|
compositeRule: !0
|
|
7022
|
-
}, d),
|
|
7023
|
-
t.assign(o, !0), t.assign(
|
|
7064
|
+
}, d), _ > 0 && t.if((0, codegen_1$3._)`${d} && ${o}`).assign(o, !1).assign(c, (0, codegen_1$3._)`[${c}, ${_}]`).else(), t.if(d, () => {
|
|
7065
|
+
t.assign(o, !0), t.assign(c, _), R && e.mergeEvaluated(R, codegen_1$3.Name);
|
|
7024
7066
|
});
|
|
7025
7067
|
});
|
|
7026
7068
|
}
|
|
@@ -7040,8 +7082,8 @@ const util_1$3 = util, def$4 = {
|
|
|
7040
7082
|
r.forEach((i, o) => {
|
|
7041
7083
|
if ((0, util_1$3.alwaysValidSchema)(n, i))
|
|
7042
7084
|
return;
|
|
7043
|
-
const
|
|
7044
|
-
e.ok(s), e.mergeEvaluated(
|
|
7085
|
+
const c = e.subschema({ keyword: "allOf", schemaProp: o }, s);
|
|
7086
|
+
e.ok(s), e.mergeEvaluated(c);
|
|
7045
7087
|
});
|
|
7046
7088
|
}
|
|
7047
7089
|
};
|
|
@@ -7062,12 +7104,12 @@ const codegen_1$2 = codegen, util_1$2 = util, error$2 = {
|
|
|
7062
7104
|
const s = hasSchema(n, "then"), i = hasSchema(n, "else");
|
|
7063
7105
|
if (!s && !i)
|
|
7064
7106
|
return;
|
|
7065
|
-
const o = t.let("valid", !0),
|
|
7107
|
+
const o = t.let("valid", !0), c = t.name("_valid");
|
|
7066
7108
|
if (d(), e.reset(), s && i) {
|
|
7067
7109
|
const p = t.let("ifClause");
|
|
7068
|
-
e.setParams({ ifClause: p }), t.if(
|
|
7110
|
+
e.setParams({ ifClause: p }), t.if(c, u("then", p), u("else", p));
|
|
7069
7111
|
} else
|
|
7070
|
-
s ? t.if(
|
|
7112
|
+
s ? t.if(c, u("then")) : t.if((0, codegen_1$2.not)(c), u("else"));
|
|
7071
7113
|
e.pass(o, () => e.error(!0));
|
|
7072
7114
|
function d() {
|
|
7073
7115
|
const p = e.subschema({
|
|
@@ -7075,13 +7117,13 @@ const codegen_1$2 = codegen, util_1$2 = util, error$2 = {
|
|
|
7075
7117
|
compositeRule: !0,
|
|
7076
7118
|
createErrors: !1,
|
|
7077
7119
|
allErrors: !1
|
|
7078
|
-
},
|
|
7120
|
+
}, c);
|
|
7079
7121
|
e.mergeEvaluated(p);
|
|
7080
7122
|
}
|
|
7081
|
-
function u(p,
|
|
7123
|
+
function u(p, _) {
|
|
7082
7124
|
return () => {
|
|
7083
|
-
const R = e.subschema({ keyword: p },
|
|
7084
|
-
t.assign(o,
|
|
7125
|
+
const R = e.subschema({ keyword: p }, c);
|
|
7126
|
+
t.assign(o, c), e.mergeValidEvaluated(R, o), _ ? t.assign(_, (0, codegen_1$2._)`${p}`) : e.setParams({ ifClause: p });
|
|
7085
7127
|
};
|
|
7086
7128
|
}
|
|
7087
7129
|
}
|
|
@@ -7134,37 +7176,37 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7134
7176
|
$data: !0,
|
|
7135
7177
|
error: error$1,
|
|
7136
7178
|
code(e, t) {
|
|
7137
|
-
const { gen: r, data: n, $data: s, schema: i, schemaCode: o, it:
|
|
7179
|
+
const { gen: r, data: n, $data: s, schema: i, schemaCode: o, it: c } = e, { opts: d, errSchemaPath: u, schemaEnv: p, self: _ } = c;
|
|
7138
7180
|
if (!d.validateFormats)
|
|
7139
7181
|
return;
|
|
7140
7182
|
s ? R() : O();
|
|
7141
7183
|
function R() {
|
|
7142
|
-
const
|
|
7143
|
-
ref:
|
|
7184
|
+
const T = r.scopeValue("formats", {
|
|
7185
|
+
ref: _.formats,
|
|
7144
7186
|
code: d.code.formats
|
|
7145
|
-
}), v = r.const("fDef", (0, codegen_1$1._)`${
|
|
7146
|
-
r.if((0, codegen_1$1._)`typeof ${v} == "object" && !(${v} instanceof RegExp)`, () => r.assign($, (0, codegen_1$1._)`${v}.type || "string"`).assign(m, (0, codegen_1$1._)`${v}.validate`), () => r.assign($, (0, codegen_1$1._)`"string"`).assign(m, v)), e.fail$data((0, codegen_1$1.or)(
|
|
7147
|
-
function
|
|
7187
|
+
}), v = r.const("fDef", (0, codegen_1$1._)`${T}[${o}]`), $ = r.let("fType"), m = r.let("format");
|
|
7188
|
+
r.if((0, codegen_1$1._)`typeof ${v} == "object" && !(${v} instanceof RegExp)`, () => r.assign($, (0, codegen_1$1._)`${v}.type || "string"`).assign(m, (0, codegen_1$1._)`${v}.validate`), () => r.assign($, (0, codegen_1$1._)`"string"`).assign(m, v)), e.fail$data((0, codegen_1$1.or)(k(), S()));
|
|
7189
|
+
function k() {
|
|
7148
7190
|
return d.strictSchema === !1 ? codegen_1$1.nil : (0, codegen_1$1._)`${o} && !${m}`;
|
|
7149
7191
|
}
|
|
7150
|
-
function
|
|
7192
|
+
function S() {
|
|
7151
7193
|
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}))`;
|
|
7152
7194
|
return (0, codegen_1$1._)`${m} && ${m} !== true && ${$} === ${t} && !${D}`;
|
|
7153
7195
|
}
|
|
7154
7196
|
}
|
|
7155
7197
|
function O() {
|
|
7156
|
-
const
|
|
7157
|
-
if (!
|
|
7158
|
-
|
|
7198
|
+
const T = _.formats[i];
|
|
7199
|
+
if (!T) {
|
|
7200
|
+
k();
|
|
7159
7201
|
return;
|
|
7160
7202
|
}
|
|
7161
|
-
if (
|
|
7203
|
+
if (T === !0)
|
|
7162
7204
|
return;
|
|
7163
|
-
const [v, $, m] =
|
|
7205
|
+
const [v, $, m] = S(T);
|
|
7164
7206
|
v === t && e.pass(I());
|
|
7165
|
-
function
|
|
7207
|
+
function k() {
|
|
7166
7208
|
if (d.strictSchema === !1) {
|
|
7167
|
-
|
|
7209
|
+
_.logger.warn(D());
|
|
7168
7210
|
return;
|
|
7169
7211
|
}
|
|
7170
7212
|
throw new Error(D());
|
|
@@ -7172,12 +7214,12 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7172
7214
|
return `unknown format "${i}" ignored in schema at path "${u}"`;
|
|
7173
7215
|
}
|
|
7174
7216
|
}
|
|
7175
|
-
function
|
|
7217
|
+
function S(D) {
|
|
7176
7218
|
const w = D instanceof RegExp ? (0, codegen_1$1.regexpCode)(D) : d.code.formats ? (0, codegen_1$1._)`${d.code.formats}${(0, codegen_1$1.getProperty)(i)}` : void 0, C = r.scopeValue("formats", { key: i, ref: D, code: w });
|
|
7177
7219
|
return typeof D == "object" && !(D instanceof RegExp) ? [D.type || "string", D.validate, (0, codegen_1$1._)`${C}.validate`] : ["string", D, C];
|
|
7178
7220
|
}
|
|
7179
7221
|
function I() {
|
|
7180
|
-
if (typeof
|
|
7222
|
+
if (typeof T == "object" && !(T instanceof RegExp) && T.async) {
|
|
7181
7223
|
if (!p.$async)
|
|
7182
7224
|
throw new Error("async format in sync schema");
|
|
7183
7225
|
return (0, codegen_1$1._)`await ${m}(${n})`;
|
|
@@ -7237,57 +7279,57 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7237
7279
|
const { gen: t, data: r, schema: n, parentSchema: s, it: i } = e, { oneOf: o } = s;
|
|
7238
7280
|
if (!i.opts.discriminator)
|
|
7239
7281
|
throw new Error("discriminator: requires discriminator option");
|
|
7240
|
-
const
|
|
7241
|
-
if (typeof
|
|
7282
|
+
const c = n.propertyName;
|
|
7283
|
+
if (typeof c != "string")
|
|
7242
7284
|
throw new Error("discriminator: requires propertyName");
|
|
7243
7285
|
if (n.mapping)
|
|
7244
7286
|
throw new Error("discriminator: mapping is not supported");
|
|
7245
7287
|
if (!o)
|
|
7246
7288
|
throw new Error("discriminator: requires oneOf keyword");
|
|
7247
|
-
const d = t.let("valid", !1), u = t.const("tag", (0, codegen_1._)`${r}${(0, codegen_1.getProperty)(
|
|
7248
|
-
t.if((0, codegen_1._)`typeof ${u} == "string"`, () => p(), () => e.error(!1, { discrError: types_1.DiscrError.Tag, tag: u, tagName:
|
|
7289
|
+
const d = t.let("valid", !1), u = t.const("tag", (0, codegen_1._)`${r}${(0, codegen_1.getProperty)(c)}`);
|
|
7290
|
+
t.if((0, codegen_1._)`typeof ${u} == "string"`, () => p(), () => e.error(!1, { discrError: types_1.DiscrError.Tag, tag: u, tagName: c })), e.ok(d);
|
|
7249
7291
|
function p() {
|
|
7250
7292
|
const O = R();
|
|
7251
7293
|
t.if(!1);
|
|
7252
|
-
for (const
|
|
7253
|
-
t.elseIf((0, codegen_1._)`${u} === ${
|
|
7254
|
-
t.else(), e.error(!1, { discrError: types_1.DiscrError.Mapping, tag: u, tagName:
|
|
7294
|
+
for (const T in O)
|
|
7295
|
+
t.elseIf((0, codegen_1._)`${u} === ${T}`), t.assign(d, _(O[T]));
|
|
7296
|
+
t.else(), e.error(!1, { discrError: types_1.DiscrError.Mapping, tag: u, tagName: c }), t.endIf();
|
|
7255
7297
|
}
|
|
7256
|
-
function
|
|
7257
|
-
const
|
|
7258
|
-
return e.mergeEvaluated(v, codegen_1.Name),
|
|
7298
|
+
function _(O) {
|
|
7299
|
+
const T = t.name("valid"), v = e.subschema({ keyword: "oneOf", schemaProp: O }, T);
|
|
7300
|
+
return e.mergeEvaluated(v, codegen_1.Name), T;
|
|
7259
7301
|
}
|
|
7260
7302
|
function R() {
|
|
7261
7303
|
var O;
|
|
7262
|
-
const
|
|
7304
|
+
const T = {}, v = m(s);
|
|
7263
7305
|
let $ = !0;
|
|
7264
7306
|
for (let I = 0; I < o.length; I++) {
|
|
7265
7307
|
let D = o[I];
|
|
7266
7308
|
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));
|
|
7267
|
-
const w = (O = D == null ? void 0 : D.properties) === null || O === void 0 ? void 0 : O[
|
|
7309
|
+
const w = (O = D == null ? void 0 : D.properties) === null || O === void 0 ? void 0 : O[c];
|
|
7268
7310
|
if (typeof w != "object")
|
|
7269
|
-
throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${
|
|
7270
|
-
$ = $ && (v || m(D)),
|
|
7311
|
+
throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${c}"`);
|
|
7312
|
+
$ = $ && (v || m(D)), k(w, I);
|
|
7271
7313
|
}
|
|
7272
7314
|
if (!$)
|
|
7273
|
-
throw new Error(`discriminator: "${
|
|
7274
|
-
return
|
|
7315
|
+
throw new Error(`discriminator: "${c}" must be required`);
|
|
7316
|
+
return T;
|
|
7275
7317
|
function m({ required: I }) {
|
|
7276
|
-
return Array.isArray(I) && I.includes(
|
|
7318
|
+
return Array.isArray(I) && I.includes(c);
|
|
7277
7319
|
}
|
|
7278
|
-
function
|
|
7320
|
+
function k(I, D) {
|
|
7279
7321
|
if (I.const)
|
|
7280
|
-
|
|
7322
|
+
S(I.const, D);
|
|
7281
7323
|
else if (I.enum)
|
|
7282
7324
|
for (const w of I.enum)
|
|
7283
|
-
|
|
7325
|
+
S(w, D);
|
|
7284
7326
|
else
|
|
7285
|
-
throw new Error(`discriminator: "properties/${
|
|
7327
|
+
throw new Error(`discriminator: "properties/${c}" must have "const" or "enum"`);
|
|
7286
7328
|
}
|
|
7287
|
-
function
|
|
7288
|
-
if (typeof I != "string" || I in
|
|
7289
|
-
throw new Error(`discriminator: "${
|
|
7290
|
-
|
|
7329
|
+
function S(I, D) {
|
|
7330
|
+
if (typeof I != "string" || I in T)
|
|
7331
|
+
throw new Error(`discriminator: "${c}" values must be unique strings`);
|
|
7332
|
+
T[I] = D;
|
|
7291
7333
|
}
|
|
7292
7334
|
}
|
|
7293
7335
|
}
|
|
@@ -7536,19 +7578,19 @@ const $schema$1 = "http://json-schema.org/draft-07/schema#", $id = "http://json-
|
|
|
7536
7578
|
};
|
|
7537
7579
|
(function(e, t) {
|
|
7538
7580
|
Object.defineProperty(t, "__esModule", { value: !0 }), t.MissingRefError = t.ValidationError = t.CodeGen = t.Name = t.nil = t.stringify = t.str = t._ = t.KeywordCxt = void 0;
|
|
7539
|
-
const r = core$2, n = draft7, s = discriminator, i = require$$3, o = ["/properties"],
|
|
7581
|
+
const r = core$2, n = draft7, s = discriminator, i = require$$3, o = ["/properties"], c = "http://json-schema.org/draft-07/schema";
|
|
7540
7582
|
class d extends r.default {
|
|
7541
7583
|
_addVocabularies() {
|
|
7542
|
-
super._addVocabularies(), n.default.forEach((
|
|
7584
|
+
super._addVocabularies(), n.default.forEach((T) => this.addVocabulary(T)), this.opts.discriminator && this.addKeyword(s.default);
|
|
7543
7585
|
}
|
|
7544
7586
|
_addDefaultMetaSchema() {
|
|
7545
7587
|
if (super._addDefaultMetaSchema(), !this.opts.meta)
|
|
7546
7588
|
return;
|
|
7547
|
-
const
|
|
7548
|
-
this.addMetaSchema(
|
|
7589
|
+
const T = this.opts.$data ? this.$dataMetaSchema(i, o) : i;
|
|
7590
|
+
this.addMetaSchema(T, c, !1), this.refs["http://json-schema.org/schema"] = c;
|
|
7549
7591
|
}
|
|
7550
7592
|
defaultMeta() {
|
|
7551
|
-
return this.opts.defaultMeta = super.defaultMeta() || (this.getSchema(
|
|
7593
|
+
return this.opts.defaultMeta = super.defaultMeta() || (this.getSchema(c) ? c : void 0);
|
|
7552
7594
|
}
|
|
7553
7595
|
}
|
|
7554
7596
|
e.exports = t = d, Object.defineProperty(t, "__esModule", { value: !0 }), t.default = d;
|
|
@@ -7570,9 +7612,9 @@ const $schema$1 = "http://json-schema.org/draft-07/schema#", $id = "http://json-
|
|
|
7570
7612
|
} }), Object.defineProperty(t, "CodeGen", { enumerable: !0, get: function() {
|
|
7571
7613
|
return p.CodeGen;
|
|
7572
7614
|
} });
|
|
7573
|
-
var
|
|
7615
|
+
var _ = validation_error;
|
|
7574
7616
|
Object.defineProperty(t, "ValidationError", { enumerable: !0, get: function() {
|
|
7575
|
-
return
|
|
7617
|
+
return _.default;
|
|
7576
7618
|
} });
|
|
7577
7619
|
var R = ref_error;
|
|
7578
7620
|
Object.defineProperty(t, "MissingRefError", { enumerable: !0, get: function() {
|
|
@@ -9063,7 +9105,7 @@ function compileBlueprint(e, {
|
|
|
9063
9105
|
onStepCompleted: n = () => {
|
|
9064
9106
|
}
|
|
9065
9107
|
} = {}) {
|
|
9066
|
-
var p,
|
|
9108
|
+
var p, _, R, O, T;
|
|
9067
9109
|
if (e = {
|
|
9068
9110
|
...e,
|
|
9069
9111
|
steps: (e.steps || []).filter(isStepDefinition)
|
|
@@ -9095,7 +9137,7 @@ function compileBlueprint(e, {
|
|
|
9095
9137
|
);
|
|
9096
9138
|
s !== void 0 && s > -1 && (e.phpExtensionBundles || (e.phpExtensionBundles = []), e.phpExtensionBundles.includes("kitchen-sink") || (e.phpExtensionBundles.push("kitchen-sink"), console.warn(
|
|
9097
9139
|
"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. "
|
|
9098
|
-
)), (
|
|
9140
|
+
)), (_ = e.steps) == null || _.splice(s, 0, {
|
|
9099
9141
|
step: "writeFile",
|
|
9100
9142
|
data: {
|
|
9101
9143
|
resource: "url",
|
|
@@ -9120,13 +9162,13 @@ function compileBlueprint(e, {
|
|
|
9120
9162
|
);
|
|
9121
9163
|
throw v.errors = o, v;
|
|
9122
9164
|
}
|
|
9123
|
-
const
|
|
9165
|
+
const c = e.steps || [], d = c.reduce(
|
|
9124
9166
|
(v, $) => {
|
|
9125
9167
|
var m;
|
|
9126
9168
|
return v + (((m = $.progress) == null ? void 0 : m.weight) || 1);
|
|
9127
9169
|
},
|
|
9128
9170
|
0
|
|
9129
|
-
), u =
|
|
9171
|
+
), u = c.map(
|
|
9130
9172
|
(v) => compileStep(v, {
|
|
9131
9173
|
semaphore: r,
|
|
9132
9174
|
rootProgressTracker: t,
|
|
@@ -9148,25 +9190,23 @@ function compileBlueprint(e, {
|
|
|
9148
9190
|
),
|
|
9149
9191
|
features: {
|
|
9150
9192
|
// Disable networking by default
|
|
9151
|
-
networking: ((
|
|
9193
|
+
networking: ((T = e.features) == null ? void 0 : T.networking) ?? !1
|
|
9152
9194
|
},
|
|
9153
9195
|
run: async (v) => {
|
|
9154
9196
|
try {
|
|
9155
9197
|
for (const { resources: $ } of u)
|
|
9156
9198
|
for (const m of $)
|
|
9157
9199
|
m.setPlayground(v), m.isAsync && m.resolve();
|
|
9158
|
-
for (const [$, { run: m, step:
|
|
9200
|
+
for (const [$, { run: m, step: k }] of Object.entries(u))
|
|
9159
9201
|
try {
|
|
9160
|
-
const
|
|
9161
|
-
n(
|
|
9162
|
-
} catch (
|
|
9163
|
-
throw console.error(
|
|
9202
|
+
const S = await m(v);
|
|
9203
|
+
n(S, k);
|
|
9204
|
+
} catch (S) {
|
|
9205
|
+
throw console.error(S), new Error(
|
|
9164
9206
|
`Error when executing the blueprint step #${$} (${JSON.stringify(
|
|
9165
|
-
|
|
9166
|
-
)})
|
|
9167
|
-
{
|
|
9168
|
-
cause: k
|
|
9169
|
-
}
|
|
9207
|
+
k
|
|
9208
|
+
)}) ${S instanceof Error ? `: ${S.message}` : S}`,
|
|
9209
|
+
{ cause: S }
|
|
9170
9210
|
);
|
|
9171
9211
|
}
|
|
9172
9212
|
} finally {
|
|
@@ -9223,17 +9263,17 @@ function compileStep(e, {
|
|
|
9223
9263
|
const s = r.stage(
|
|
9224
9264
|
(((p = e.progress) == null ? void 0 : p.weight) || 1) / n
|
|
9225
9265
|
), i = {};
|
|
9226
|
-
for (const
|
|
9227
|
-
let R = e[
|
|
9266
|
+
for (const _ of Object.keys(e)) {
|
|
9267
|
+
let R = e[_];
|
|
9228
9268
|
isFileReference(R) && (R = Resource.create(R, {
|
|
9229
9269
|
semaphore: t
|
|
9230
|
-
})), i[
|
|
9270
|
+
})), i[_] = R;
|
|
9231
9271
|
}
|
|
9232
|
-
const o = async (
|
|
9272
|
+
const o = async (_) => {
|
|
9233
9273
|
var R;
|
|
9234
9274
|
try {
|
|
9235
9275
|
return s.fillSlowly(), await keyedStepHandlers[e.step](
|
|
9236
|
-
|
|
9276
|
+
_,
|
|
9237
9277
|
await resolveArguments(i),
|
|
9238
9278
|
{
|
|
9239
9279
|
tracker: s,
|
|
@@ -9243,12 +9283,12 @@ function compileStep(e, {
|
|
|
9243
9283
|
} finally {
|
|
9244
9284
|
s.finish();
|
|
9245
9285
|
}
|
|
9246
|
-
},
|
|
9247
|
-
(
|
|
9286
|
+
}, c = getResources(i), d = getResources(i).filter(
|
|
9287
|
+
(_) => _.isAsync
|
|
9248
9288
|
), u = 1 / (d.length + 1);
|
|
9249
|
-
for (const
|
|
9250
|
-
|
|
9251
|
-
return { run: o, step: e, resources:
|
|
9289
|
+
for (const _ of d)
|
|
9290
|
+
_.progress = s.stage(u);
|
|
9291
|
+
return { run: o, step: e, resources: c };
|
|
9252
9292
|
}
|
|
9253
9293
|
function getResources(e) {
|
|
9254
9294
|
const t = [];
|
|
@@ -9319,23 +9359,23 @@ function expose(e, t = globalThis, r = ["*"]) {
|
|
|
9319
9359
|
console.warn(`Invalid origin '${s.origin}' for comlink proxy`);
|
|
9320
9360
|
return;
|
|
9321
9361
|
}
|
|
9322
|
-
const { id: i, type: o, path:
|
|
9362
|
+
const { id: i, type: o, path: c } = Object.assign({ path: [] }, s.data), d = (s.data.argumentList || []).map(fromWireValue);
|
|
9323
9363
|
let u;
|
|
9324
9364
|
try {
|
|
9325
|
-
const p =
|
|
9365
|
+
const p = c.slice(0, -1).reduce((R, O) => R[O], e), _ = c.reduce((R, O) => R[O], e);
|
|
9326
9366
|
switch (o) {
|
|
9327
9367
|
case "GET":
|
|
9328
|
-
u =
|
|
9368
|
+
u = _;
|
|
9329
9369
|
break;
|
|
9330
9370
|
case "SET":
|
|
9331
|
-
p[
|
|
9371
|
+
p[c.slice(-1)[0]] = fromWireValue(s.data.value), u = !0;
|
|
9332
9372
|
break;
|
|
9333
9373
|
case "APPLY":
|
|
9334
|
-
u =
|
|
9374
|
+
u = _.apply(p, d);
|
|
9335
9375
|
break;
|
|
9336
9376
|
case "CONSTRUCT":
|
|
9337
9377
|
{
|
|
9338
|
-
const R = new
|
|
9378
|
+
const R = new _(...d);
|
|
9339
9379
|
u = proxy(R);
|
|
9340
9380
|
}
|
|
9341
9381
|
break;
|
|
@@ -9355,14 +9395,14 @@ function expose(e, t = globalThis, r = ["*"]) {
|
|
|
9355
9395
|
u = { value: p, [throwMarker]: 0 };
|
|
9356
9396
|
}
|
|
9357
9397
|
Promise.resolve(u).catch((p) => ({ value: p, [throwMarker]: 0 })).then((p) => {
|
|
9358
|
-
const [
|
|
9359
|
-
t.postMessage(Object.assign(Object.assign({},
|
|
9398
|
+
const [_, R] = toWireValue(p);
|
|
9399
|
+
t.postMessage(Object.assign(Object.assign({}, _), { id: i }), R), o === "RELEASE" && (t.removeEventListener("message", n), closeEndPoint(t), finalizer in e && typeof e[finalizer] == "function" && e[finalizer]());
|
|
9360
9400
|
}).catch((p) => {
|
|
9361
|
-
const [
|
|
9401
|
+
const [_, R] = toWireValue({
|
|
9362
9402
|
value: new TypeError("Unserializable return value"),
|
|
9363
9403
|
[throwMarker]: 0
|
|
9364
9404
|
});
|
|
9365
|
-
t.postMessage(Object.assign(Object.assign({},
|
|
9405
|
+
t.postMessage(Object.assign(Object.assign({}, _), { id: i }), R);
|
|
9366
9406
|
});
|
|
9367
9407
|
}), t.start && t.start();
|
|
9368
9408
|
}
|
|
@@ -9409,24 +9449,24 @@ function createProxy(e, t = [], r = function() {
|
|
|
9409
9449
|
if (o === "then") {
|
|
9410
9450
|
if (t.length === 0)
|
|
9411
9451
|
return { then: () => s };
|
|
9412
|
-
const
|
|
9452
|
+
const c = requestResponseMessage(e, {
|
|
9413
9453
|
type: "GET",
|
|
9414
9454
|
path: t.map((d) => d.toString())
|
|
9415
9455
|
}).then(fromWireValue);
|
|
9416
|
-
return
|
|
9456
|
+
return c.then.bind(c);
|
|
9417
9457
|
}
|
|
9418
9458
|
return createProxy(e, [...t, o]);
|
|
9419
9459
|
},
|
|
9420
|
-
set(i, o,
|
|
9460
|
+
set(i, o, c) {
|
|
9421
9461
|
throwIfProxyReleased(n);
|
|
9422
|
-
const [d, u] = toWireValue(
|
|
9462
|
+
const [d, u] = toWireValue(c);
|
|
9423
9463
|
return requestResponseMessage(e, {
|
|
9424
9464
|
type: "SET",
|
|
9425
9465
|
path: [...t, o].map((p) => p.toString()),
|
|
9426
9466
|
value: d
|
|
9427
9467
|
}, u).then(fromWireValue);
|
|
9428
9468
|
},
|
|
9429
|
-
apply(i, o,
|
|
9469
|
+
apply(i, o, c) {
|
|
9430
9470
|
throwIfProxyReleased(n);
|
|
9431
9471
|
const d = t[t.length - 1];
|
|
9432
9472
|
if (d === createEndpoint)
|
|
@@ -9435,20 +9475,20 @@ function createProxy(e, t = [], r = function() {
|
|
|
9435
9475
|
}).then(fromWireValue);
|
|
9436
9476
|
if (d === "bind")
|
|
9437
9477
|
return createProxy(e, t.slice(0, -1));
|
|
9438
|
-
const [u, p] = processArguments(
|
|
9478
|
+
const [u, p] = processArguments(c);
|
|
9439
9479
|
return requestResponseMessage(e, {
|
|
9440
9480
|
type: "APPLY",
|
|
9441
|
-
path: t.map((
|
|
9481
|
+
path: t.map((_) => _.toString()),
|
|
9442
9482
|
argumentList: u
|
|
9443
9483
|
}, p).then(fromWireValue);
|
|
9444
9484
|
},
|
|
9445
9485
|
construct(i, o) {
|
|
9446
9486
|
throwIfProxyReleased(n);
|
|
9447
|
-
const [
|
|
9487
|
+
const [c, d] = processArguments(o);
|
|
9448
9488
|
return requestResponseMessage(e, {
|
|
9449
9489
|
type: "CONSTRUCT",
|
|
9450
9490
|
path: t.map((u) => u.toString()),
|
|
9451
|
-
argumentList:
|
|
9491
|
+
argumentList: c
|
|
9452
9492
|
}, d).then(fromWireValue);
|
|
9453
9493
|
}
|
|
9454
9494
|
});
|
|
@@ -9583,6 +9623,112 @@ function proxyClone(e) {
|
|
|
9583
9623
|
}
|
|
9584
9624
|
});
|
|
9585
9625
|
}
|
|
9626
|
+
class Logger {
|
|
9627
|
+
constructor(t) {
|
|
9628
|
+
this.LOG_PREFIX = "Playground", this.windowConnected = !1, this.lastPHPLogLength = 0, this.errorLogPath = "/wordpress/wp-content/debug.log", t && (this.errorLogPath = t);
|
|
9629
|
+
}
|
|
9630
|
+
/**
|
|
9631
|
+
* Read the WordPress debug.log file and return its content.
|
|
9632
|
+
*
|
|
9633
|
+
* @param UniversalPHP playground instance
|
|
9634
|
+
* @returns string The content of the debug.log file
|
|
9635
|
+
*/
|
|
9636
|
+
async getRequestPhpErrorLog(t) {
|
|
9637
|
+
return await t.fileExists(this.errorLogPath) ? await t.readFileAsText(this.errorLogPath) : "";
|
|
9638
|
+
}
|
|
9639
|
+
/**
|
|
9640
|
+
* Log Windows errors.
|
|
9641
|
+
*
|
|
9642
|
+
* @param ErrorEvent event
|
|
9643
|
+
*/
|
|
9644
|
+
logWindowError(t) {
|
|
9645
|
+
this.log(
|
|
9646
|
+
`${t.message} in ${t.filename} on line ${t.lineno}:${t.colno}`,
|
|
9647
|
+
"fatal"
|
|
9648
|
+
);
|
|
9649
|
+
}
|
|
9650
|
+
/**
|
|
9651
|
+
* Log unhandled promise rejections.
|
|
9652
|
+
*
|
|
9653
|
+
* @param PromiseRejectionEvent event
|
|
9654
|
+
*/
|
|
9655
|
+
logUnhandledRejection(t) {
|
|
9656
|
+
this.log(`${t.reason.stack}`, "fatal");
|
|
9657
|
+
}
|
|
9658
|
+
/**
|
|
9659
|
+
* Register a listener for the window error events and log the data.
|
|
9660
|
+
*/
|
|
9661
|
+
addWindowErrorListener() {
|
|
9662
|
+
this.windowConnected || typeof window > "u" || (window.addEventListener("error", this.logWindowError.bind(this)), window.addEventListener(
|
|
9663
|
+
"unhandledrejection",
|
|
9664
|
+
this.logUnhandledRejection.bind(this)
|
|
9665
|
+
), window.addEventListener(
|
|
9666
|
+
"rejectionhandled",
|
|
9667
|
+
this.logUnhandledRejection.bind(this)
|
|
9668
|
+
), this.windowConnected = !0);
|
|
9669
|
+
}
|
|
9670
|
+
/**
|
|
9671
|
+
* Register a listener for the request.end event and log the data.
|
|
9672
|
+
* @param UniversalPHP playground instance
|
|
9673
|
+
*/
|
|
9674
|
+
addPlaygroundRequestEndListener(t) {
|
|
9675
|
+
t.addEventListener("request.end", async () => {
|
|
9676
|
+
const r = await this.getRequestPhpErrorLog(t);
|
|
9677
|
+
r.length > this.lastPHPLogLength && (this.logRaw(r.substring(this.lastPHPLogLength)), this.lastPHPLogLength = r.length);
|
|
9678
|
+
});
|
|
9679
|
+
}
|
|
9680
|
+
/**
|
|
9681
|
+
* Get UTC date in the PHP log format https://github.com/php/php-src/blob/master/main/main.c#L849
|
|
9682
|
+
*
|
|
9683
|
+
* @param date
|
|
9684
|
+
* @returns string
|
|
9685
|
+
*/
|
|
9686
|
+
formatLogDate(t) {
|
|
9687
|
+
const r = new Intl.DateTimeFormat("en-GB", {
|
|
9688
|
+
year: "numeric",
|
|
9689
|
+
month: "short",
|
|
9690
|
+
day: "2-digit",
|
|
9691
|
+
timeZone: "UTC"
|
|
9692
|
+
}).format(t).replace(/ /g, "-"), n = new Intl.DateTimeFormat("en-GB", {
|
|
9693
|
+
hour: "2-digit",
|
|
9694
|
+
minute: "2-digit",
|
|
9695
|
+
second: "2-digit",
|
|
9696
|
+
hour12: !1,
|
|
9697
|
+
timeZone: "UTC",
|
|
9698
|
+
timeZoneName: "short"
|
|
9699
|
+
}).format(t);
|
|
9700
|
+
return r + " " + n;
|
|
9701
|
+
}
|
|
9702
|
+
/**
|
|
9703
|
+
* Format log message and severity and log it.
|
|
9704
|
+
* @param string message
|
|
9705
|
+
* @param LogSeverity severity
|
|
9706
|
+
*/
|
|
9707
|
+
formatMessage(t, r) {
|
|
9708
|
+
return `[${this.formatLogDate(/* @__PURE__ */ new Date())}] ${this.LOG_PREFIX} ${r}: ${t}`;
|
|
9709
|
+
}
|
|
9710
|
+
/**
|
|
9711
|
+
* Log message with severity and timestamp.
|
|
9712
|
+
* @param string message
|
|
9713
|
+
* @param LogSeverity severity
|
|
9714
|
+
*/
|
|
9715
|
+
log(t, r) {
|
|
9716
|
+
r === void 0 && (r = "info");
|
|
9717
|
+
const n = this.formatMessage(t, r);
|
|
9718
|
+
this.logRaw(n);
|
|
9719
|
+
}
|
|
9720
|
+
/**
|
|
9721
|
+
* Log message without severity and timestamp.
|
|
9722
|
+
* @param string log
|
|
9723
|
+
*/
|
|
9724
|
+
logRaw(t) {
|
|
9725
|
+
console.debug(t);
|
|
9726
|
+
}
|
|
9727
|
+
}
|
|
9728
|
+
const logger = new Logger();
|
|
9729
|
+
function collectPhpLogs(e, t) {
|
|
9730
|
+
e.addPlaygroundRequestEndListener(t);
|
|
9731
|
+
}
|
|
9586
9732
|
async function startPlaygroundWeb({
|
|
9587
9733
|
iframe: e,
|
|
9588
9734
|
blueprint: t,
|
|
@@ -9596,21 +9742,21 @@ async function startPlaygroundWeb({
|
|
|
9596
9742
|
progressbar: !s
|
|
9597
9743
|
}), n.setCaption("Preparing WordPress"), !t)
|
|
9598
9744
|
return doStartPlaygroundWeb(e, r, n);
|
|
9599
|
-
const
|
|
9745
|
+
const c = compileBlueprint(t, {
|
|
9600
9746
|
progress: n.stage(0.5),
|
|
9601
9747
|
onStepCompleted: i
|
|
9602
9748
|
}), d = await doStartPlaygroundWeb(
|
|
9603
9749
|
e,
|
|
9604
9750
|
setQueryParams(r, {
|
|
9605
|
-
php:
|
|
9606
|
-
wp:
|
|
9751
|
+
php: c.versions.php,
|
|
9752
|
+
wp: c.versions.wp,
|
|
9607
9753
|
"sapi-name": o,
|
|
9608
|
-
"php-extension":
|
|
9609
|
-
networking:
|
|
9754
|
+
"php-extension": c.phpExtensions,
|
|
9755
|
+
networking: c.features.networking ? "yes" : "no"
|
|
9610
9756
|
}),
|
|
9611
9757
|
n
|
|
9612
9758
|
);
|
|
9613
|
-
return await runBlueprintSteps(
|
|
9759
|
+
return collectPhpLogs(logger, d), await runBlueprintSteps(c, d), n.finish(), d;
|
|
9614
9760
|
}
|
|
9615
9761
|
function allowStorageAccessByUserActivation(e) {
|
|
9616
9762
|
var t, r;
|