@wp-playground/blueprints 0.6.14 → 0.6.15
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/blueprint-schema.json +10 -27
- package/index.cjs +14 -14
- package/index.d.ts +27 -11
- package/index.js +666 -653
- package/lib/steps/define-site-url.d.ts +6 -9
- package/lib/steps/install-asset.d.ts +5 -1
- package/lib/steps/install-plugin.d.ts +2 -1
- package/lib/steps/install-theme.d.ts +2 -1
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -777,8 +777,8 @@ const enableMultisite = async (e) => {
|
|
|
777
777
|
});
|
|
778
778
|
const t = new URL(await e.absoluteUrl);
|
|
779
779
|
if (t.port !== "") {
|
|
780
|
-
let
|
|
781
|
-
throw t.hostname === "localhost" && (
|
|
780
|
+
let C = `The current host is ${t.host}, but WordPress multisites do not support custom ports.`;
|
|
781
|
+
throw t.hostname === "localhost" && (C += " For development, you can set up a playground.test domain using the instructions at https://wordpress.github.io/wordpress-playground/contributing/code."), new Error(C);
|
|
782
782
|
}
|
|
783
783
|
const r = t.pathname.replace(/\/$/, "") + "/", n = `${t.protocol}//${t.hostname}${r}`;
|
|
784
784
|
await setSiteOptions(e, {
|
|
@@ -858,7 +858,7 @@ echo json_encode($deactivated_plugins);
|
|
|
858
858
|
PATH_CURRENT_SITE: r
|
|
859
859
|
}
|
|
860
860
|
});
|
|
861
|
-
const
|
|
861
|
+
const f = new URL(await e.absoluteUrl), $ = isURLScoped(f) ? "scope:" + getURLScope(f) : null;
|
|
862
862
|
await e.writeFile(
|
|
863
863
|
joinPaths(s, "/wp-content/sunrise.php"),
|
|
864
864
|
`<?php
|
|
@@ -867,14 +867,14 @@ echo json_encode($deactivated_plugins);
|
|
|
867
867
|
}
|
|
868
868
|
$folder = ${phpVar($)};
|
|
869
869
|
if ($folder && strpos($_SERVER['REQUEST_URI'],"/$folder") === false) {
|
|
870
|
-
$_SERVER['HTTP_HOST'] = ${phpVar(
|
|
870
|
+
$_SERVER['HTTP_HOST'] = ${phpVar(f.hostname)};
|
|
871
871
|
$_SERVER['REQUEST_URI'] = "/$folder/" . ltrim($_SERVER['REQUEST_URI'], '/');
|
|
872
872
|
}
|
|
873
873
|
`
|
|
874
874
|
), await login(e, {});
|
|
875
|
-
for (const
|
|
875
|
+
for (const C of o)
|
|
876
876
|
await activatePlugin(e, {
|
|
877
|
-
pluginPath:
|
|
877
|
+
pluginPath: C
|
|
878
878
|
});
|
|
879
879
|
};
|
|
880
880
|
function jsonToUrlEncoded(e) {
|
|
@@ -1049,13 +1049,13 @@ const tmpPath = "/tmp/file.zip", unzip = async (e, { zipFile: t, zipPath: r, ext
|
|
|
1049
1049
|
extractToPath: s
|
|
1050
1050
|
}), s = joinPaths(s, r);
|
|
1051
1051
|
const i = joinPaths(s, "wp-content"), o = joinPaths(n, "wp-content");
|
|
1052
|
-
for (const
|
|
1052
|
+
for (const f of wpContentFilesExcludedFromExport) {
|
|
1053
1053
|
const $ = joinPaths(
|
|
1054
1054
|
i,
|
|
1055
|
-
|
|
1055
|
+
f
|
|
1056
1056
|
);
|
|
1057
1057
|
await removePath(e, $);
|
|
1058
|
-
const O = joinPaths(o,
|
|
1058
|
+
const O = joinPaths(o, f);
|
|
1059
1059
|
await e.fileExists(O) && (await e.mkdir(dirname($)), await e.mv(O, $));
|
|
1060
1060
|
}
|
|
1061
1061
|
const l = joinPaths(
|
|
@@ -1068,10 +1068,10 @@ const tmpPath = "/tmp/file.zip", unzip = async (e, { zipFile: t, zipPath: r, ext
|
|
|
1068
1068
|
l
|
|
1069
1069
|
);
|
|
1070
1070
|
const d = await e.listFiles(s);
|
|
1071
|
-
for (const
|
|
1072
|
-
await removePath(e, joinPaths(n,
|
|
1073
|
-
joinPaths(s,
|
|
1074
|
-
joinPaths(n,
|
|
1071
|
+
for (const f of d)
|
|
1072
|
+
await removePath(e, joinPaths(n, f)), await e.mv(
|
|
1073
|
+
joinPaths(s, f),
|
|
1074
|
+
joinPaths(n, f)
|
|
1075
1075
|
);
|
|
1076
1076
|
await e.rmdir(s), await defineSiteUrl(e, {
|
|
1077
1077
|
siteUrl: await e.absoluteUrl
|
|
@@ -1095,30 +1095,54 @@ async function exportWXR(e) {
|
|
|
1095
1095
|
});
|
|
1096
1096
|
return new File([t.bytes], "export.xml");
|
|
1097
1097
|
}
|
|
1098
|
-
async function installAsset(e, {
|
|
1099
|
-
|
|
1100
|
-
|
|
1098
|
+
async function installAsset(e, {
|
|
1099
|
+
targetPath: t,
|
|
1100
|
+
zipFile: r,
|
|
1101
|
+
ifAlreadyInstalled: n = "overwrite"
|
|
1102
|
+
}) {
|
|
1103
|
+
const i = r.name.replace(/\.zip$/, ""), o = joinPaths(await e.documentRoot, "wp-content"), l = joinPaths(o, randomString()), d = joinPaths(l, "assets", i);
|
|
1104
|
+
await e.fileExists(d) && await e.rmdir(l, {
|
|
1101
1105
|
recursive: !0
|
|
1102
|
-
}), await e.mkdir(
|
|
1106
|
+
}), await e.mkdir(l);
|
|
1103
1107
|
try {
|
|
1104
1108
|
await unzip(e, {
|
|
1105
1109
|
zipFile: r,
|
|
1106
|
-
extractToPath:
|
|
1110
|
+
extractToPath: d
|
|
1107
1111
|
});
|
|
1108
|
-
let
|
|
1112
|
+
let u = await e.listFiles(d, {
|
|
1109
1113
|
prependPath: !0
|
|
1110
1114
|
});
|
|
1111
|
-
|
|
1112
|
-
const
|
|
1113
|
-
let
|
|
1114
|
-
|
|
1115
|
-
const
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1115
|
+
u = u.filter((S) => !S.endsWith("/__MACOSX"));
|
|
1116
|
+
const f = u.length === 1 && await e.isDir(u[0]);
|
|
1117
|
+
let $, O = "";
|
|
1118
|
+
f ? (O = u[0], $ = u[0].split("/").pop()) : (O = d, $ = i);
|
|
1119
|
+
const C = `${t}/${$}`;
|
|
1120
|
+
if (await e.fileExists(C)) {
|
|
1121
|
+
if (!await e.isDir(C))
|
|
1122
|
+
throw new Error(
|
|
1123
|
+
`Cannot install asset ${$} to ${C} because a file with the same name already exists. Note it's a file, not a directory! Is this by mistake?`
|
|
1124
|
+
);
|
|
1125
|
+
if (n === "overwrite")
|
|
1126
|
+
await e.rmdir(C, {
|
|
1127
|
+
recursive: !0
|
|
1128
|
+
});
|
|
1129
|
+
else {
|
|
1130
|
+
if (n === "skip")
|
|
1131
|
+
return {
|
|
1132
|
+
assetFolderPath: C,
|
|
1133
|
+
assetFolderName: $
|
|
1134
|
+
};
|
|
1135
|
+
throw new Error(
|
|
1136
|
+
`Cannot install asset ${$} to ${t} because it already exists and the ifAlreadyInstalled option was set to ${n}`
|
|
1137
|
+
);
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
return await e.mv(O, C), {
|
|
1141
|
+
assetFolderPath: C,
|
|
1142
|
+
assetFolderName: $
|
|
1119
1143
|
};
|
|
1120
1144
|
} finally {
|
|
1121
|
-
await e.rmdir(
|
|
1145
|
+
await e.rmdir(l, {
|
|
1122
1146
|
recursive: !0
|
|
1123
1147
|
});
|
|
1124
1148
|
}
|
|
@@ -1127,34 +1151,36 @@ function zipNameToHumanName(e) {
|
|
|
1127
1151
|
const t = e.split(".").shift().replace(/-/g, " ");
|
|
1128
1152
|
return t.charAt(0).toUpperCase() + t.slice(1).toLowerCase();
|
|
1129
1153
|
}
|
|
1130
|
-
const installPlugin = async (e, { pluginZipFile: t,
|
|
1131
|
-
const
|
|
1132
|
-
|
|
1133
|
-
const { assetFolderPath:
|
|
1154
|
+
const installPlugin = async (e, { pluginZipFile: t, ifAlreadyInstalled: r, options: n = {} }, s) => {
|
|
1155
|
+
const i = t.name.split("/").pop() || "plugin.zip", o = zipNameToHumanName(i);
|
|
1156
|
+
s == null || s.tracker.setCaption(`Installing the ${o} plugin`);
|
|
1157
|
+
const { assetFolderPath: l } = await installAsset(e, {
|
|
1158
|
+
ifAlreadyInstalled: r,
|
|
1134
1159
|
zipFile: t,
|
|
1135
1160
|
targetPath: `${await e.documentRoot}/wp-content/plugins`
|
|
1136
1161
|
});
|
|
1137
|
-
("activate" in
|
|
1162
|
+
("activate" in n ? n.activate : !0) && await activatePlugin(
|
|
1138
1163
|
e,
|
|
1139
1164
|
{
|
|
1140
|
-
pluginPath:
|
|
1141
|
-
pluginName:
|
|
1165
|
+
pluginPath: l,
|
|
1166
|
+
pluginName: o
|
|
1142
1167
|
},
|
|
1143
|
-
|
|
1168
|
+
s
|
|
1144
1169
|
);
|
|
1145
|
-
}, installTheme = async (e, { themeZipFile: t,
|
|
1146
|
-
const
|
|
1147
|
-
|
|
1148
|
-
const { assetFolderName:
|
|
1170
|
+
}, installTheme = async (e, { themeZipFile: t, ifAlreadyInstalled: r, options: n = {} }, s) => {
|
|
1171
|
+
const i = zipNameToHumanName(t.name);
|
|
1172
|
+
s == null || s.tracker.setCaption(`Installing the ${i} theme`);
|
|
1173
|
+
const { assetFolderName: o } = await installAsset(e, {
|
|
1174
|
+
ifAlreadyInstalled: r,
|
|
1149
1175
|
zipFile: t,
|
|
1150
1176
|
targetPath: `${await e.documentRoot}/wp-content/themes`
|
|
1151
1177
|
});
|
|
1152
|
-
("activate" in
|
|
1178
|
+
("activate" in n ? n.activate : !0) && await activateTheme(
|
|
1153
1179
|
e,
|
|
1154
1180
|
{
|
|
1155
|
-
themeFolderName:
|
|
1181
|
+
themeFolderName: o
|
|
1156
1182
|
},
|
|
1157
|
-
|
|
1183
|
+
s
|
|
1158
1184
|
);
|
|
1159
1185
|
}, runWpInstallationWizard = async (e, { options: t }) => {
|
|
1160
1186
|
await e.request({
|
|
@@ -1918,9 +1944,12 @@ class PHPRequestHandler {
|
|
|
1918
1944
|
t.url.split("#")[0],
|
|
1919
1945
|
r ? void 0 : DEFAULT_BASE_URL
|
|
1920
1946
|
), s = applyRewriteRules(
|
|
1921
|
-
removePathPrefix(
|
|
1947
|
+
removePathPrefix(
|
|
1948
|
+
decodeURIComponent(n.pathname),
|
|
1949
|
+
H(this, ve)
|
|
1950
|
+
),
|
|
1922
1951
|
this.rewriteRules
|
|
1923
|
-
), i =
|
|
1952
|
+
), i = joinPaths(H(this, Pe), s);
|
|
1924
1953
|
return seemsLikeAPHPRequestHandlerPath(i) ? await ce(this, _t, Wt).call(this, t, n) : ce(this, mt, xt).call(this, i);
|
|
1925
1954
|
}
|
|
1926
1955
|
}
|
|
@@ -1973,12 +2002,12 @@ Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
1973
2002
|
let l = t.body;
|
|
1974
2003
|
if (typeof l == "object" && !(l instanceof Uint8Array)) {
|
|
1975
2004
|
i = "POST";
|
|
1976
|
-
const { bytes: u, contentType:
|
|
1977
|
-
l = u, o["content-type"] =
|
|
2005
|
+
const { bytes: u, contentType: f } = await encodeAsMultipart(l);
|
|
2006
|
+
l = u, o["content-type"] = f;
|
|
1978
2007
|
}
|
|
1979
2008
|
let d;
|
|
1980
2009
|
try {
|
|
1981
|
-
d = ce(this, $t, Bt).call(this, r.pathname);
|
|
2010
|
+
d = ce(this, $t, Bt).call(this, decodeURIComponent(r.pathname));
|
|
1982
2011
|
} catch {
|
|
1983
2012
|
return new PHPResponse(
|
|
1984
2013
|
404,
|
|
@@ -2156,7 +2185,7 @@ function rethrowFileSystemError(e = "") {
|
|
|
2156
2185
|
} catch (l) {
|
|
2157
2186
|
const d = typeof l == "object" ? l == null ? void 0 : l.errno : null;
|
|
2158
2187
|
if (d in FileErrorCodes) {
|
|
2159
|
-
const u = FileErrorCodes[d],
|
|
2188
|
+
const u = FileErrorCodes[d], f = typeof o[0] == "string" ? o[0] : null, $ = f !== null ? e.replaceAll("{path}", f) : e;
|
|
2160
2189
|
throw new Error(`${$}: ${u}`, {
|
|
2161
2190
|
cause: l
|
|
2162
2191
|
});
|
|
@@ -2327,15 +2356,11 @@ class BasePHP {
|
|
|
2327
2356
|
ce(this, Tt, rr).call(this, l, i[l]);
|
|
2328
2357
|
const o = await ce(this, Ct, sr).call(this);
|
|
2329
2358
|
if (o.exitCode !== 0) {
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
stderr: o.errors
|
|
2333
|
-
};
|
|
2334
|
-
console.warn("PHP.run() output was:", l);
|
|
2335
|
-
const d = new Error(
|
|
2359
|
+
console.warn("PHP.run() output was:", o.text);
|
|
2360
|
+
const l = new Error(
|
|
2336
2361
|
`PHP.run() failed with exit code ${o.exitCode} and the following output: ` + o.errors
|
|
2337
2362
|
);
|
|
2338
|
-
throw
|
|
2363
|
+
throw l.response = o, l.source = "request", console.error(l), l;
|
|
2339
2364
|
}
|
|
2340
2365
|
return o;
|
|
2341
2366
|
} catch (n) {
|
|
@@ -2634,8 +2659,8 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), be = new WeakMap(),
|
|
|
2634
2659
|
var d;
|
|
2635
2660
|
t = (u) => {
|
|
2636
2661
|
console.error(u), console.error(u.error);
|
|
2637
|
-
const
|
|
2638
|
-
|
|
2662
|
+
const f = new Error("Rethrown");
|
|
2663
|
+
f.cause = u.error, f.betterMessage = u.message, o(f);
|
|
2639
2664
|
}, (d = H(this, Re)) == null || d.addEventListener(
|
|
2640
2665
|
"error",
|
|
2641
2666
|
t
|
|
@@ -3008,10 +3033,10 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3008
3033
|
e._ = s;
|
|
3009
3034
|
const i = new n("+");
|
|
3010
3035
|
function o(_, ...g) {
|
|
3011
|
-
const P = [
|
|
3036
|
+
const P = [C(_[0])];
|
|
3012
3037
|
let I = 0;
|
|
3013
3038
|
for (; I < g.length; )
|
|
3014
|
-
P.push(i), l(P, g[I]), P.push(i,
|
|
3039
|
+
P.push(i), l(P, g[I]), P.push(i, C(_[++I]));
|
|
3015
3040
|
return d(P), new n(P);
|
|
3016
3041
|
}
|
|
3017
3042
|
e.str = o;
|
|
@@ -3043,25 +3068,25 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3043
3068
|
if (typeof g == "string" && g[0] === '"' && !(_ instanceof r))
|
|
3044
3069
|
return `"${_}${g.slice(1)}`;
|
|
3045
3070
|
}
|
|
3046
|
-
function
|
|
3071
|
+
function f(_, g) {
|
|
3047
3072
|
return g.emptyStr() ? _ : _.emptyStr() ? g : o`${_}${g}`;
|
|
3048
3073
|
}
|
|
3049
|
-
e.strConcat =
|
|
3074
|
+
e.strConcat = f;
|
|
3050
3075
|
function $(_) {
|
|
3051
|
-
return typeof _ == "number" || typeof _ == "boolean" || _ === null ? _ :
|
|
3076
|
+
return typeof _ == "number" || typeof _ == "boolean" || _ === null ? _ : C(Array.isArray(_) ? _.join(",") : _);
|
|
3052
3077
|
}
|
|
3053
3078
|
function O(_) {
|
|
3054
|
-
return new n(
|
|
3079
|
+
return new n(C(_));
|
|
3055
3080
|
}
|
|
3056
3081
|
e.stringify = O;
|
|
3057
|
-
function
|
|
3082
|
+
function C(_) {
|
|
3058
3083
|
return JSON.stringify(_).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
3059
3084
|
}
|
|
3060
|
-
e.safeStringify =
|
|
3061
|
-
function
|
|
3085
|
+
e.safeStringify = C;
|
|
3086
|
+
function S(_) {
|
|
3062
3087
|
return typeof _ == "string" && e.IDENTIFIER.test(_) ? new n(`.${_}`) : s`[${_}]`;
|
|
3063
3088
|
}
|
|
3064
|
-
e.getProperty =
|
|
3089
|
+
e.getProperty = S;
|
|
3065
3090
|
function T(_) {
|
|
3066
3091
|
if (typeof _ == "string" && e.IDENTIFIER.test(_))
|
|
3067
3092
|
return new n(`${_}`);
|
|
@@ -3091,8 +3116,8 @@ var scope = {};
|
|
|
3091
3116
|
var: new t.Name("var")
|
|
3092
3117
|
};
|
|
3093
3118
|
class s {
|
|
3094
|
-
constructor({ prefixes: u, parent:
|
|
3095
|
-
this._names = {}, this._prefixes = u, this._parent =
|
|
3119
|
+
constructor({ prefixes: u, parent: f } = {}) {
|
|
3120
|
+
this._names = {}, this._prefixes = u, this._parent = f;
|
|
3096
3121
|
}
|
|
3097
3122
|
toName(u) {
|
|
3098
3123
|
return u instanceof t.Name ? u : this.name(u);
|
|
@@ -3101,23 +3126,23 @@ var scope = {};
|
|
|
3101
3126
|
return new t.Name(this._newName(u));
|
|
3102
3127
|
}
|
|
3103
3128
|
_newName(u) {
|
|
3104
|
-
const
|
|
3105
|
-
return `${u}${
|
|
3129
|
+
const f = this._names[u] || this._nameGroup(u);
|
|
3130
|
+
return `${u}${f.index++}`;
|
|
3106
3131
|
}
|
|
3107
3132
|
_nameGroup(u) {
|
|
3108
|
-
var
|
|
3109
|
-
if (!(($ = (
|
|
3133
|
+
var f, $;
|
|
3134
|
+
if (!(($ = (f = this._parent) === null || f === void 0 ? void 0 : f._prefixes) === null || $ === void 0) && $.has(u) || this._prefixes && !this._prefixes.has(u))
|
|
3110
3135
|
throw new Error(`CodeGen: prefix "${u}" is not allowed in this scope`);
|
|
3111
3136
|
return this._names[u] = { prefix: u, index: 0 };
|
|
3112
3137
|
}
|
|
3113
3138
|
}
|
|
3114
3139
|
e.Scope = s;
|
|
3115
3140
|
class i extends t.Name {
|
|
3116
|
-
constructor(u,
|
|
3117
|
-
super(
|
|
3141
|
+
constructor(u, f) {
|
|
3142
|
+
super(f), this.prefix = u;
|
|
3118
3143
|
}
|
|
3119
|
-
setValue(u, { property:
|
|
3120
|
-
this.value = u, this.scopePath = (0, t._)`.${new t.Name(
|
|
3144
|
+
setValue(u, { property: f, itemIndex: $ }) {
|
|
3145
|
+
this.value = u, this.scopePath = (0, t._)`.${new t.Name(f)}[${$}]`;
|
|
3121
3146
|
}
|
|
3122
3147
|
}
|
|
3123
3148
|
e.ValueScopeName = i;
|
|
@@ -3132,64 +3157,64 @@ var scope = {};
|
|
|
3132
3157
|
name(u) {
|
|
3133
3158
|
return new i(u, this._newName(u));
|
|
3134
3159
|
}
|
|
3135
|
-
value(u,
|
|
3160
|
+
value(u, f) {
|
|
3136
3161
|
var $;
|
|
3137
|
-
if (
|
|
3162
|
+
if (f.ref === void 0)
|
|
3138
3163
|
throw new Error("CodeGen: ref must be passed in value");
|
|
3139
|
-
const O = this.toName(u), { prefix:
|
|
3140
|
-
let T = this._values[
|
|
3164
|
+
const O = this.toName(u), { prefix: C } = O, S = ($ = f.key) !== null && $ !== void 0 ? $ : f.ref;
|
|
3165
|
+
let T = this._values[C];
|
|
3141
3166
|
if (T) {
|
|
3142
|
-
const g = T.get(
|
|
3167
|
+
const g = T.get(S);
|
|
3143
3168
|
if (g)
|
|
3144
3169
|
return g;
|
|
3145
3170
|
} else
|
|
3146
|
-
T = this._values[
|
|
3147
|
-
T.set(
|
|
3148
|
-
const y = this._scope[
|
|
3149
|
-
return y[_] =
|
|
3171
|
+
T = this._values[C] = /* @__PURE__ */ new Map();
|
|
3172
|
+
T.set(S, O);
|
|
3173
|
+
const y = this._scope[C] || (this._scope[C] = []), _ = y.length;
|
|
3174
|
+
return y[_] = f.ref, O.setValue(f, { property: C, itemIndex: _ }), O;
|
|
3150
3175
|
}
|
|
3151
|
-
getValue(u,
|
|
3176
|
+
getValue(u, f) {
|
|
3152
3177
|
const $ = this._values[u];
|
|
3153
3178
|
if ($)
|
|
3154
|
-
return $.get(
|
|
3179
|
+
return $.get(f);
|
|
3155
3180
|
}
|
|
3156
|
-
scopeRefs(u,
|
|
3157
|
-
return this._reduceValues(
|
|
3181
|
+
scopeRefs(u, f = this._values) {
|
|
3182
|
+
return this._reduceValues(f, ($) => {
|
|
3158
3183
|
if ($.scopePath === void 0)
|
|
3159
3184
|
throw new Error(`CodeGen: name "${$}" has no value`);
|
|
3160
3185
|
return (0, t._)`${u}${$.scopePath}`;
|
|
3161
3186
|
});
|
|
3162
3187
|
}
|
|
3163
|
-
scopeCode(u = this._values,
|
|
3188
|
+
scopeCode(u = this._values, f, $) {
|
|
3164
3189
|
return this._reduceValues(u, (O) => {
|
|
3165
3190
|
if (O.value === void 0)
|
|
3166
3191
|
throw new Error(`CodeGen: name "${O}" has no value`);
|
|
3167
3192
|
return O.value.code;
|
|
3168
|
-
},
|
|
3193
|
+
}, f, $);
|
|
3169
3194
|
}
|
|
3170
|
-
_reduceValues(u,
|
|
3171
|
-
let
|
|
3172
|
-
for (const
|
|
3173
|
-
const T = u[
|
|
3195
|
+
_reduceValues(u, f, $ = {}, O) {
|
|
3196
|
+
let C = t.nil;
|
|
3197
|
+
for (const S in u) {
|
|
3198
|
+
const T = u[S];
|
|
3174
3199
|
if (!T)
|
|
3175
3200
|
continue;
|
|
3176
|
-
const y = $[
|
|
3201
|
+
const y = $[S] = $[S] || /* @__PURE__ */ new Map();
|
|
3177
3202
|
T.forEach((_) => {
|
|
3178
3203
|
if (y.has(_))
|
|
3179
3204
|
return;
|
|
3180
3205
|
y.set(_, n.Started);
|
|
3181
|
-
let g =
|
|
3206
|
+
let g = f(_);
|
|
3182
3207
|
if (g) {
|
|
3183
3208
|
const P = this.opts.es5 ? e.varKinds.var : e.varKinds.const;
|
|
3184
|
-
|
|
3209
|
+
C = (0, t._)`${C}${P} ${_} = ${g};${this.opts._n}`;
|
|
3185
3210
|
} else if (g = O == null ? void 0 : O(_))
|
|
3186
|
-
|
|
3211
|
+
C = (0, t._)`${C}${g}${this.opts._n}`;
|
|
3187
3212
|
else
|
|
3188
3213
|
throw new r(_);
|
|
3189
3214
|
y.set(_, n.Completed);
|
|
3190
3215
|
});
|
|
3191
3216
|
}
|
|
3192
|
-
return
|
|
3217
|
+
return C;
|
|
3193
3218
|
}
|
|
3194
3219
|
}
|
|
3195
3220
|
e.ValueScope = l;
|
|
@@ -3245,12 +3270,12 @@ var scope = {};
|
|
|
3245
3270
|
}
|
|
3246
3271
|
}
|
|
3247
3272
|
class o extends i {
|
|
3248
|
-
constructor(a, h,
|
|
3249
|
-
super(), this.varKind = a, this.name = h, this.rhs =
|
|
3273
|
+
constructor(a, h, N) {
|
|
3274
|
+
super(), this.varKind = a, this.name = h, this.rhs = N;
|
|
3250
3275
|
}
|
|
3251
3276
|
render({ es5: a, _n: h }) {
|
|
3252
|
-
const
|
|
3253
|
-
return `${
|
|
3277
|
+
const N = a ? r.varKinds.var : this.varKind, M = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
|
|
3278
|
+
return `${N} ${this.name}${M};` + h;
|
|
3254
3279
|
}
|
|
3255
3280
|
optimizeNames(a, h) {
|
|
3256
3281
|
if (a[this.name.str])
|
|
@@ -3261,8 +3286,8 @@ var scope = {};
|
|
|
3261
3286
|
}
|
|
3262
3287
|
}
|
|
3263
3288
|
class l extends i {
|
|
3264
|
-
constructor(a, h,
|
|
3265
|
-
super(), this.lhs = a, this.rhs = h, this.sideEffects =
|
|
3289
|
+
constructor(a, h, N) {
|
|
3290
|
+
super(), this.lhs = a, this.rhs = h, this.sideEffects = N;
|
|
3266
3291
|
}
|
|
3267
3292
|
render({ _n: a }) {
|
|
3268
3293
|
return `${this.lhs} = ${this.rhs};` + a;
|
|
@@ -3277,8 +3302,8 @@ var scope = {};
|
|
|
3277
3302
|
}
|
|
3278
3303
|
}
|
|
3279
3304
|
class d extends l {
|
|
3280
|
-
constructor(a, h,
|
|
3281
|
-
super(a,
|
|
3305
|
+
constructor(a, h, N, M) {
|
|
3306
|
+
super(a, N, M), this.op = h;
|
|
3282
3307
|
}
|
|
3283
3308
|
render({ _n: a }) {
|
|
3284
3309
|
return `${this.lhs} ${this.op}= ${this.rhs};` + a;
|
|
@@ -3292,7 +3317,7 @@ var scope = {};
|
|
|
3292
3317
|
return `${this.label}:` + a;
|
|
3293
3318
|
}
|
|
3294
3319
|
}
|
|
3295
|
-
class
|
|
3320
|
+
class f extends i {
|
|
3296
3321
|
constructor(a) {
|
|
3297
3322
|
super(), this.label = a, this.names = {};
|
|
3298
3323
|
}
|
|
@@ -3328,46 +3353,46 @@ var scope = {};
|
|
|
3328
3353
|
return this.code instanceof t._CodeOrName ? this.code.names : {};
|
|
3329
3354
|
}
|
|
3330
3355
|
}
|
|
3331
|
-
class
|
|
3356
|
+
class C extends i {
|
|
3332
3357
|
constructor(a = []) {
|
|
3333
3358
|
super(), this.nodes = a;
|
|
3334
3359
|
}
|
|
3335
3360
|
render(a) {
|
|
3336
|
-
return this.nodes.reduce((h,
|
|
3361
|
+
return this.nodes.reduce((h, N) => h + N.render(a), "");
|
|
3337
3362
|
}
|
|
3338
3363
|
optimizeNodes() {
|
|
3339
3364
|
const { nodes: a } = this;
|
|
3340
3365
|
let h = a.length;
|
|
3341
3366
|
for (; h--; ) {
|
|
3342
|
-
const
|
|
3343
|
-
Array.isArray(
|
|
3367
|
+
const N = a[h].optimizeNodes();
|
|
3368
|
+
Array.isArray(N) ? a.splice(h, 1, ...N) : N ? a[h] = N : a.splice(h, 1);
|
|
3344
3369
|
}
|
|
3345
3370
|
return a.length > 0 ? this : void 0;
|
|
3346
3371
|
}
|
|
3347
3372
|
optimizeNames(a, h) {
|
|
3348
|
-
const { nodes:
|
|
3349
|
-
let M =
|
|
3373
|
+
const { nodes: N } = this;
|
|
3374
|
+
let M = N.length;
|
|
3350
3375
|
for (; M--; ) {
|
|
3351
|
-
const q =
|
|
3352
|
-
q.optimizeNames(a, h) || (ke(a, q.names),
|
|
3376
|
+
const q = N[M];
|
|
3377
|
+
q.optimizeNames(a, h) || (ke(a, q.names), N.splice(M, 1));
|
|
3353
3378
|
}
|
|
3354
|
-
return
|
|
3379
|
+
return N.length > 0 ? this : void 0;
|
|
3355
3380
|
}
|
|
3356
3381
|
get names() {
|
|
3357
3382
|
return this.nodes.reduce((a, h) => K(a, h.names), {});
|
|
3358
3383
|
}
|
|
3359
3384
|
}
|
|
3360
|
-
class
|
|
3385
|
+
class S extends C {
|
|
3361
3386
|
render(a) {
|
|
3362
3387
|
return "{" + a._n + super.render(a) + "}" + a._n;
|
|
3363
3388
|
}
|
|
3364
3389
|
}
|
|
3365
|
-
class T extends
|
|
3390
|
+
class T extends C {
|
|
3366
3391
|
}
|
|
3367
|
-
class y extends
|
|
3392
|
+
class y extends S {
|
|
3368
3393
|
}
|
|
3369
3394
|
y.kind = "else";
|
|
3370
|
-
class _ extends
|
|
3395
|
+
class _ extends S {
|
|
3371
3396
|
constructor(a, h) {
|
|
3372
3397
|
super(h), this.condition = a;
|
|
3373
3398
|
}
|
|
@@ -3382,8 +3407,8 @@ var scope = {};
|
|
|
3382
3407
|
return this.nodes;
|
|
3383
3408
|
let h = this.else;
|
|
3384
3409
|
if (h) {
|
|
3385
|
-
const
|
|
3386
|
-
h = this.else = Array.isArray(
|
|
3410
|
+
const N = h.optimizeNodes();
|
|
3411
|
+
h = this.else = Array.isArray(N) ? new y(N) : N;
|
|
3387
3412
|
}
|
|
3388
3413
|
if (h)
|
|
3389
3414
|
return a === !1 ? h instanceof _ ? h : h.nodes : this.nodes.length ? this : new _(Ce(a), h instanceof _ ? [h] : h.nodes);
|
|
@@ -3391,8 +3416,8 @@ var scope = {};
|
|
|
3391
3416
|
return this;
|
|
3392
3417
|
}
|
|
3393
3418
|
optimizeNames(a, h) {
|
|
3394
|
-
var
|
|
3395
|
-
if (this.else = (
|
|
3419
|
+
var N;
|
|
3420
|
+
if (this.else = (N = this.else) === null || N === void 0 ? void 0 : N.optimizeNames(a, h), !!(super.optimizeNames(a, h) || this.else))
|
|
3396
3421
|
return this.condition = oe(this.condition, a, h), this;
|
|
3397
3422
|
}
|
|
3398
3423
|
get names() {
|
|
@@ -3401,7 +3426,7 @@ var scope = {};
|
|
|
3401
3426
|
}
|
|
3402
3427
|
}
|
|
3403
3428
|
_.kind = "if";
|
|
3404
|
-
class g extends
|
|
3429
|
+
class g extends S {
|
|
3405
3430
|
}
|
|
3406
3431
|
g.kind = "for";
|
|
3407
3432
|
class P extends g {
|
|
@@ -3420,12 +3445,12 @@ var scope = {};
|
|
|
3420
3445
|
}
|
|
3421
3446
|
}
|
|
3422
3447
|
class I extends g {
|
|
3423
|
-
constructor(a, h,
|
|
3424
|
-
super(), this.varKind = a, this.name = h, this.from =
|
|
3448
|
+
constructor(a, h, N, M) {
|
|
3449
|
+
super(), this.varKind = a, this.name = h, this.from = N, this.to = M;
|
|
3425
3450
|
}
|
|
3426
3451
|
render(a) {
|
|
3427
|
-
const h = a.es5 ? r.varKinds.var : this.varKind, { name:
|
|
3428
|
-
return `for(${h} ${
|
|
3452
|
+
const h = a.es5 ? r.varKinds.var : this.varKind, { name: N, from: M, to: q } = this;
|
|
3453
|
+
return `for(${h} ${N}=${M}; ${N}<${q}; ${N}++)` + super.render(a);
|
|
3429
3454
|
}
|
|
3430
3455
|
get names() {
|
|
3431
3456
|
const a = ue(super.names, this.from);
|
|
@@ -3433,8 +3458,8 @@ var scope = {};
|
|
|
3433
3458
|
}
|
|
3434
3459
|
}
|
|
3435
3460
|
class D extends g {
|
|
3436
|
-
constructor(a, h,
|
|
3437
|
-
super(), this.loop = a, this.varKind = h, this.name =
|
|
3461
|
+
constructor(a, h, N, M) {
|
|
3462
|
+
super(), this.loop = a, this.varKind = h, this.name = N, this.iterable = M;
|
|
3438
3463
|
}
|
|
3439
3464
|
render(a) {
|
|
3440
3465
|
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(a);
|
|
@@ -3447,22 +3472,22 @@ var scope = {};
|
|
|
3447
3472
|
return K(super.names, this.iterable.names);
|
|
3448
3473
|
}
|
|
3449
3474
|
}
|
|
3450
|
-
class w extends
|
|
3451
|
-
constructor(a, h,
|
|
3452
|
-
super(), this.name = a, this.args = h, this.async =
|
|
3475
|
+
class w extends S {
|
|
3476
|
+
constructor(a, h, N) {
|
|
3477
|
+
super(), this.name = a, this.args = h, this.async = N;
|
|
3453
3478
|
}
|
|
3454
3479
|
render(a) {
|
|
3455
3480
|
return `${this.async ? "async " : ""}function ${this.name}(${this.args})` + super.render(a);
|
|
3456
3481
|
}
|
|
3457
3482
|
}
|
|
3458
3483
|
w.kind = "func";
|
|
3459
|
-
class k extends
|
|
3484
|
+
class k extends C {
|
|
3460
3485
|
render(a) {
|
|
3461
3486
|
return "return " + super.render(a);
|
|
3462
3487
|
}
|
|
3463
3488
|
}
|
|
3464
3489
|
k.kind = "return";
|
|
3465
|
-
class A extends
|
|
3490
|
+
class A extends S {
|
|
3466
3491
|
render(a) {
|
|
3467
3492
|
let h = "try" + super.render(a);
|
|
3468
3493
|
return this.catch && (h += this.catch.render(a)), this.finally && (h += this.finally.render(a)), h;
|
|
@@ -3472,15 +3497,15 @@ var scope = {};
|
|
|
3472
3497
|
return super.optimizeNodes(), (a = this.catch) === null || a === void 0 || a.optimizeNodes(), (h = this.finally) === null || h === void 0 || h.optimizeNodes(), this;
|
|
3473
3498
|
}
|
|
3474
3499
|
optimizeNames(a, h) {
|
|
3475
|
-
var
|
|
3476
|
-
return super.optimizeNames(a, h), (
|
|
3500
|
+
var N, M;
|
|
3501
|
+
return super.optimizeNames(a, h), (N = this.catch) === null || N === void 0 || N.optimizeNames(a, h), (M = this.finally) === null || M === void 0 || M.optimizeNames(a, h), this;
|
|
3477
3502
|
}
|
|
3478
3503
|
get names() {
|
|
3479
3504
|
const a = super.names;
|
|
3480
3505
|
return this.catch && K(a, this.catch.names), this.finally && K(a, this.finally.names), a;
|
|
3481
3506
|
}
|
|
3482
3507
|
}
|
|
3483
|
-
class V extends
|
|
3508
|
+
class V extends S {
|
|
3484
3509
|
constructor(a) {
|
|
3485
3510
|
super(), this.error = a;
|
|
3486
3511
|
}
|
|
@@ -3489,7 +3514,7 @@ var scope = {};
|
|
|
3489
3514
|
}
|
|
3490
3515
|
}
|
|
3491
3516
|
V.kind = "catch";
|
|
3492
|
-
class x extends
|
|
3517
|
+
class x extends S {
|
|
3493
3518
|
render(a) {
|
|
3494
3519
|
return "finally" + super.render(a);
|
|
3495
3520
|
}
|
|
@@ -3513,8 +3538,8 @@ var scope = {};
|
|
|
3513
3538
|
}
|
|
3514
3539
|
// reserves unique name in the external scope and assigns value to it
|
|
3515
3540
|
scopeValue(a, h) {
|
|
3516
|
-
const
|
|
3517
|
-
return (this._values[
|
|
3541
|
+
const N = this._extScope.value(a, h);
|
|
3542
|
+
return (this._values[N.prefix] || (this._values[N.prefix] = /* @__PURE__ */ new Set())).add(N), N;
|
|
3518
3543
|
}
|
|
3519
3544
|
getScopeValue(a, h) {
|
|
3520
3545
|
return this._extScope.getValue(a, h);
|
|
@@ -3527,25 +3552,25 @@ var scope = {};
|
|
|
3527
3552
|
scopeCode() {
|
|
3528
3553
|
return this._extScope.scopeCode(this._values);
|
|
3529
3554
|
}
|
|
3530
|
-
_def(a, h,
|
|
3555
|
+
_def(a, h, N, M) {
|
|
3531
3556
|
const q = this._scope.toName(h);
|
|
3532
|
-
return
|
|
3557
|
+
return N !== void 0 && M && (this._constants[q.str] = N), this._leafNode(new o(a, q, N)), q;
|
|
3533
3558
|
}
|
|
3534
3559
|
// `const` declaration (`var` in es5 mode)
|
|
3535
|
-
const(a, h,
|
|
3536
|
-
return this._def(r.varKinds.const, a, h,
|
|
3560
|
+
const(a, h, N) {
|
|
3561
|
+
return this._def(r.varKinds.const, a, h, N);
|
|
3537
3562
|
}
|
|
3538
3563
|
// `let` declaration with optional assignment (`var` in es5 mode)
|
|
3539
|
-
let(a, h,
|
|
3540
|
-
return this._def(r.varKinds.let, a, h,
|
|
3564
|
+
let(a, h, N) {
|
|
3565
|
+
return this._def(r.varKinds.let, a, h, N);
|
|
3541
3566
|
}
|
|
3542
3567
|
// `var` declaration with optional assignment
|
|
3543
|
-
var(a, h,
|
|
3544
|
-
return this._def(r.varKinds.var, a, h,
|
|
3568
|
+
var(a, h, N) {
|
|
3569
|
+
return this._def(r.varKinds.var, a, h, N);
|
|
3545
3570
|
}
|
|
3546
3571
|
// assignment code
|
|
3547
|
-
assign(a, h,
|
|
3548
|
-
return this._leafNode(new l(a, h,
|
|
3572
|
+
assign(a, h, N) {
|
|
3573
|
+
return this._leafNode(new l(a, h, N));
|
|
3549
3574
|
}
|
|
3550
3575
|
// `+=` code
|
|
3551
3576
|
add(a, h) {
|
|
@@ -3558,17 +3583,17 @@ var scope = {};
|
|
|
3558
3583
|
// returns code for object literal for the passed argument list of key-value pairs
|
|
3559
3584
|
object(...a) {
|
|
3560
3585
|
const h = ["{"];
|
|
3561
|
-
for (const [
|
|
3562
|
-
h.length > 1 && h.push(","), h.push(
|
|
3586
|
+
for (const [N, M] of a)
|
|
3587
|
+
h.length > 1 && h.push(","), h.push(N), (N !== M || this.opts.es5) && (h.push(":"), (0, t.addCodeArg)(h, M));
|
|
3563
3588
|
return h.push("}"), new t._Code(h);
|
|
3564
3589
|
}
|
|
3565
3590
|
// `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed)
|
|
3566
|
-
if(a, h,
|
|
3567
|
-
if (this._blockNode(new _(a)), h &&
|
|
3568
|
-
this.code(h).else().code(
|
|
3591
|
+
if(a, h, N) {
|
|
3592
|
+
if (this._blockNode(new _(a)), h && N)
|
|
3593
|
+
this.code(h).else().code(N).endIf();
|
|
3569
3594
|
else if (h)
|
|
3570
3595
|
this.code(h).endIf();
|
|
3571
|
-
else if (
|
|
3596
|
+
else if (N)
|
|
3572
3597
|
throw new Error('CodeGen: "else" body without "then" body');
|
|
3573
3598
|
return this;
|
|
3574
3599
|
}
|
|
@@ -3592,28 +3617,28 @@ var scope = {};
|
|
|
3592
3617
|
return this._for(new P(a), h);
|
|
3593
3618
|
}
|
|
3594
3619
|
// `for` statement for a range of values
|
|
3595
|
-
forRange(a, h,
|
|
3620
|
+
forRange(a, h, N, M, q = this.opts.es5 ? r.varKinds.var : r.varKinds.let) {
|
|
3596
3621
|
const W = this._scope.toName(a);
|
|
3597
|
-
return this._for(new I(q, W, h,
|
|
3622
|
+
return this._for(new I(q, W, h, N), () => M(W));
|
|
3598
3623
|
}
|
|
3599
3624
|
// `for-of` statement (in es5 mode replace with a normal for loop)
|
|
3600
|
-
forOf(a, h,
|
|
3625
|
+
forOf(a, h, N, M = r.varKinds.const) {
|
|
3601
3626
|
const q = this._scope.toName(a);
|
|
3602
3627
|
if (this.opts.es5) {
|
|
3603
3628
|
const W = h instanceof t.Name ? h : this.var("_arr", h);
|
|
3604
3629
|
return this.forRange("_i", 0, (0, t._)`${W}.length`, (G) => {
|
|
3605
|
-
this.var(q, (0, t._)`${W}[${G}]`),
|
|
3630
|
+
this.var(q, (0, t._)`${W}[${G}]`), N(q);
|
|
3606
3631
|
});
|
|
3607
3632
|
}
|
|
3608
|
-
return this._for(new D("of", M, q, h), () =>
|
|
3633
|
+
return this._for(new D("of", M, q, h), () => N(q));
|
|
3609
3634
|
}
|
|
3610
3635
|
// `for-in` statement.
|
|
3611
3636
|
// With option `ownProperties` replaced with a `for-of` loop for object keys
|
|
3612
|
-
forIn(a, h,
|
|
3637
|
+
forIn(a, h, N, M = this.opts.es5 ? r.varKinds.var : r.varKinds.const) {
|
|
3613
3638
|
if (this.opts.ownProperties)
|
|
3614
|
-
return this.forOf(a, (0, t._)`Object.keys(${h})`,
|
|
3639
|
+
return this.forOf(a, (0, t._)`Object.keys(${h})`, N);
|
|
3615
3640
|
const q = this._scope.toName(a);
|
|
3616
|
-
return this._for(new D("in", M, q, h), () =>
|
|
3641
|
+
return this._for(new D("in", M, q, h), () => N(q));
|
|
3617
3642
|
}
|
|
3618
3643
|
// end `for` loop
|
|
3619
3644
|
endFor() {
|
|
@@ -3625,7 +3650,7 @@ var scope = {};
|
|
|
3625
3650
|
}
|
|
3626
3651
|
// `break` statement
|
|
3627
3652
|
break(a) {
|
|
3628
|
-
return this._leafNode(new
|
|
3653
|
+
return this._leafNode(new f(a));
|
|
3629
3654
|
}
|
|
3630
3655
|
// `return` statement
|
|
3631
3656
|
return(a) {
|
|
@@ -3635,15 +3660,15 @@ var scope = {};
|
|
|
3635
3660
|
return this._endBlockNode(k);
|
|
3636
3661
|
}
|
|
3637
3662
|
// `try` statement
|
|
3638
|
-
try(a, h,
|
|
3639
|
-
if (!h && !
|
|
3663
|
+
try(a, h, N) {
|
|
3664
|
+
if (!h && !N)
|
|
3640
3665
|
throw new Error('CodeGen: "try" without "catch" and "finally"');
|
|
3641
3666
|
const M = new A();
|
|
3642
3667
|
if (this._blockNode(M), this.code(a), h) {
|
|
3643
3668
|
const q = this.name("e");
|
|
3644
3669
|
this._currNode = M.catch = new V(q), h(q);
|
|
3645
3670
|
}
|
|
3646
|
-
return
|
|
3671
|
+
return N && (this._currNode = M.finally = new x(), this.code(N)), this._endBlockNode(V, x);
|
|
3647
3672
|
}
|
|
3648
3673
|
// `throw` statement
|
|
3649
3674
|
throw(a) {
|
|
@@ -3658,14 +3683,14 @@ var scope = {};
|
|
|
3658
3683
|
const h = this._blockStarts.pop();
|
|
3659
3684
|
if (h === void 0)
|
|
3660
3685
|
throw new Error("CodeGen: not in self-balancing block");
|
|
3661
|
-
const
|
|
3662
|
-
if (
|
|
3663
|
-
throw new Error(`CodeGen: wrong number of nodes: ${
|
|
3686
|
+
const N = this._nodes.length - h;
|
|
3687
|
+
if (N < 0 || a !== void 0 && N !== a)
|
|
3688
|
+
throw new Error(`CodeGen: wrong number of nodes: ${N} vs ${a} expected`);
|
|
3664
3689
|
return this._nodes.length = h, this;
|
|
3665
3690
|
}
|
|
3666
3691
|
// `function` heading (or definition if funcBody is passed)
|
|
3667
|
-
func(a, h = t.nil,
|
|
3668
|
-
return this._blockNode(new w(a, h,
|
|
3692
|
+
func(a, h = t.nil, N, M) {
|
|
3693
|
+
return this._blockNode(new w(a, h, N)), M && this.code(M).endFunc(), this;
|
|
3669
3694
|
}
|
|
3670
3695
|
// end function definition
|
|
3671
3696
|
endFunc() {
|
|
@@ -3682,8 +3707,8 @@ var scope = {};
|
|
|
3682
3707
|
this._currNode.nodes.push(a), this._nodes.push(a);
|
|
3683
3708
|
}
|
|
3684
3709
|
_endBlockNode(a, h) {
|
|
3685
|
-
const
|
|
3686
|
-
if (
|
|
3710
|
+
const N = this._currNode;
|
|
3711
|
+
if (N instanceof a || h && N instanceof h)
|
|
3687
3712
|
return this._nodes.pop(), this;
|
|
3688
3713
|
throw new Error(`CodeGen: not in block "${h ? `${a.kind}/${h.kind}` : a.kind}"`);
|
|
3689
3714
|
}
|
|
@@ -3716,11 +3741,11 @@ var scope = {};
|
|
|
3716
3741
|
}
|
|
3717
3742
|
function oe(b, a, h) {
|
|
3718
3743
|
if (b instanceof t.Name)
|
|
3719
|
-
return
|
|
3744
|
+
return N(b);
|
|
3720
3745
|
if (!M(b))
|
|
3721
3746
|
return b;
|
|
3722
|
-
return new t._Code(b._items.reduce((q, W) => (W instanceof t.Name && (W =
|
|
3723
|
-
function
|
|
3747
|
+
return new t._Code(b._items.reduce((q, W) => (W instanceof t.Name && (W = N(W)), W instanceof t._Code ? q.push(...W._items) : q.push(W), q), []));
|
|
3748
|
+
function N(q) {
|
|
3724
3749
|
const W = h[q.str];
|
|
3725
3750
|
return W === void 0 || a[q.str] !== 1 ? q : (delete a[q.str], W);
|
|
3726
3751
|
}
|
|
@@ -3809,10 +3834,10 @@ var util = {};
|
|
|
3809
3834
|
return O(decodeURIComponent(w));
|
|
3810
3835
|
}
|
|
3811
3836
|
e.unescapeFragment = u;
|
|
3812
|
-
function
|
|
3837
|
+
function f(w) {
|
|
3813
3838
|
return encodeURIComponent($(w));
|
|
3814
3839
|
}
|
|
3815
|
-
e.escapeFragment =
|
|
3840
|
+
e.escapeFragment = f;
|
|
3816
3841
|
function $(w) {
|
|
3817
3842
|
return typeof w == "number" ? `${w}` : w.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
3818
3843
|
}
|
|
@@ -3821,22 +3846,22 @@ var util = {};
|
|
|
3821
3846
|
return w.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
3822
3847
|
}
|
|
3823
3848
|
e.unescapeJsonPointer = O;
|
|
3824
|
-
function
|
|
3849
|
+
function C(w, k) {
|
|
3825
3850
|
if (Array.isArray(w))
|
|
3826
3851
|
for (const A of w)
|
|
3827
3852
|
k(A);
|
|
3828
3853
|
else
|
|
3829
3854
|
k(w);
|
|
3830
3855
|
}
|
|
3831
|
-
e.eachItem =
|
|
3832
|
-
function
|
|
3856
|
+
e.eachItem = C;
|
|
3857
|
+
function S({ mergeNames: w, mergeToName: k, mergeValues: A, resultToName: V }) {
|
|
3833
3858
|
return (x, re, K, ue) => {
|
|
3834
3859
|
const oe = K === void 0 ? re : K instanceof t.Name ? (re instanceof t.Name ? w(x, re, K) : k(x, re, K), K) : re instanceof t.Name ? (k(x, K, re), re) : A(re, K);
|
|
3835
3860
|
return ue === t.Name && !(oe instanceof t.Name) ? V(x, oe) : oe;
|
|
3836
3861
|
};
|
|
3837
3862
|
}
|
|
3838
3863
|
e.mergeEvaluated = {
|
|
3839
|
-
props:
|
|
3864
|
+
props: S({
|
|
3840
3865
|
mergeNames: (w, k, A) => w.if((0, t._)`${A} !== true && ${k} !== undefined`, () => {
|
|
3841
3866
|
w.if((0, t._)`${k} === true`, () => w.assign(A, !0), () => w.assign(A, (0, t._)`${A} || {}`).code((0, t._)`Object.assign(${A}, ${k})`));
|
|
3842
3867
|
}),
|
|
@@ -3846,7 +3871,7 @@ var util = {};
|
|
|
3846
3871
|
mergeValues: (w, k) => w === !0 ? !0 : { ...w, ...k },
|
|
3847
3872
|
resultToName: T
|
|
3848
3873
|
}),
|
|
3849
|
-
items:
|
|
3874
|
+
items: S({
|
|
3850
3875
|
mergeNames: (w, k, A) => w.if((0, t._)`${A} !== true && ${k} !== undefined`, () => w.assign(A, (0, t._)`${k} === true ? true : ${A} > ${k} ? ${A} : ${k}`)),
|
|
3851
3876
|
mergeToName: (w, k, A) => w.if((0, t._)`${A} !== true`, () => w.assign(A, k === !0 ? !0 : (0, t._)`${A} > ${k} ? ${A} : ${k}`)),
|
|
3852
3877
|
mergeValues: (w, k) => w === !0 ? !0 : Math.max(w, k),
|
|
@@ -3958,7 +3983,7 @@ names$1.default = names;
|
|
|
3958
3983
|
const { gen: g, validateName: P, schemaEnv: I } = y;
|
|
3959
3984
|
I.$async ? g.throw((0, t._)`new ${y.ValidationError}(${_})`) : (g.assign((0, t._)`${P}.errors`, _), g.return(!1));
|
|
3960
3985
|
}
|
|
3961
|
-
const
|
|
3986
|
+
const f = {
|
|
3962
3987
|
keyword: new t.Name("keyword"),
|
|
3963
3988
|
schemaPath: new t.Name("schemaPath"),
|
|
3964
3989
|
params: new t.Name("params"),
|
|
@@ -3973,22 +3998,22 @@ names$1.default = names;
|
|
|
3973
3998
|
}
|
|
3974
3999
|
function O(y, _, g = {}) {
|
|
3975
4000
|
const { gen: P, it: I } = y, D = [
|
|
3976
|
-
|
|
3977
|
-
|
|
4001
|
+
C(I, g),
|
|
4002
|
+
S(y, g)
|
|
3978
4003
|
];
|
|
3979
4004
|
return T(y, _, D), P.object(...D);
|
|
3980
4005
|
}
|
|
3981
|
-
function
|
|
4006
|
+
function C({ errorPath: y }, { instancePath: _ }) {
|
|
3982
4007
|
const g = _ ? (0, t.str)`${y}${(0, r.getErrorPath)(_, r.Type.Str)}` : y;
|
|
3983
4008
|
return [n.default.instancePath, (0, t.strConcat)(n.default.instancePath, g)];
|
|
3984
4009
|
}
|
|
3985
|
-
function
|
|
4010
|
+
function S({ keyword: y, it: { errSchemaPath: _ } }, { schemaPath: g, parentSchema: P }) {
|
|
3986
4011
|
let I = P ? _ : (0, t.str)`${_}/${y}`;
|
|
3987
|
-
return g && (I = (0, t.str)`${I}${(0, r.getErrorPath)(g, r.Type.Str)}`), [
|
|
4012
|
+
return g && (I = (0, t.str)`${I}${(0, r.getErrorPath)(g, r.Type.Str)}`), [f.schemaPath, I];
|
|
3988
4013
|
}
|
|
3989
4014
|
function T(y, { params: _, message: g }, P) {
|
|
3990
4015
|
const { keyword: I, data: D, schemaValue: w, it: k } = y, { opts: A, propertyName: V, topSchemaRef: x, schemaPath: re } = k;
|
|
3991
|
-
P.push([
|
|
4016
|
+
P.push([f.keyword, I], [f.params, typeof _ == "function" ? _(y) : _ || (0, t._)`{}`]), A.messages && P.push([f.message, typeof g == "function" ? g(y) : g]), A.verbose && P.push([f.schema, w], [f.parentSchema, (0, t._)`${x}${re}`], [n.default.data, D]), V && P.push([f.propertyName, V]);
|
|
3992
4017
|
}
|
|
3993
4018
|
})(errors);
|
|
3994
4019
|
Object.defineProperty(boolSchema, "__esModule", { value: !0 });
|
|
@@ -4098,17 +4123,17 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4098
4123
|
return V;
|
|
4099
4124
|
}
|
|
4100
4125
|
e.coerceAndCheckDataType = u;
|
|
4101
|
-
const
|
|
4126
|
+
const f = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]);
|
|
4102
4127
|
function $(P, I) {
|
|
4103
|
-
return I ? P.filter((D) =>
|
|
4128
|
+
return I ? P.filter((D) => f.has(D) || I === "array" && D === "array") : [];
|
|
4104
4129
|
}
|
|
4105
4130
|
function O(P, I, D) {
|
|
4106
4131
|
const { gen: w, data: k, opts: A } = P, V = w.let("dataType", (0, s._)`typeof ${k}`), x = w.let("coerced", (0, s._)`undefined`);
|
|
4107
4132
|
A.coerceTypes === "array" && w.if((0, s._)`${V} == 'object' && Array.isArray(${k}) && ${k}.length == 1`, () => w.assign(k, (0, s._)`${k}[0]`).assign(V, (0, s._)`typeof ${k}`).if(T(I, k, A.strictNumbers), () => w.assign(x, k))), w.if((0, s._)`${x} !== undefined`);
|
|
4108
4133
|
for (const K of D)
|
|
4109
|
-
(
|
|
4134
|
+
(f.has(K) || K === "array" && A.coerceTypes === "array") && re(K);
|
|
4110
4135
|
w.else(), _(P), w.endIf(), w.if((0, s._)`${x} !== undefined`, () => {
|
|
4111
|
-
w.assign(k, x),
|
|
4136
|
+
w.assign(k, x), C(P, x);
|
|
4112
4137
|
});
|
|
4113
4138
|
function re(K) {
|
|
4114
4139
|
switch (K) {
|
|
@@ -4135,10 +4160,10 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4135
4160
|
}
|
|
4136
4161
|
}
|
|
4137
4162
|
}
|
|
4138
|
-
function
|
|
4163
|
+
function C({ gen: P, parentData: I, parentDataProperty: D }, w) {
|
|
4139
4164
|
P.if((0, s._)`${I} !== undefined`, () => P.assign((0, s._)`${I}[${D}]`, w));
|
|
4140
4165
|
}
|
|
4141
|
-
function
|
|
4166
|
+
function S(P, I, D, w = o.Correct) {
|
|
4142
4167
|
const k = w === o.Correct ? s.operators.EQ : s.operators.NEQ;
|
|
4143
4168
|
let A;
|
|
4144
4169
|
switch (P) {
|
|
@@ -4164,10 +4189,10 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4164
4189
|
return (0, s.and)((0, s._)`typeof ${I} == "number"`, x, D ? (0, s._)`isFinite(${I})` : s.nil);
|
|
4165
4190
|
}
|
|
4166
4191
|
}
|
|
4167
|
-
e.checkDataType =
|
|
4192
|
+
e.checkDataType = S;
|
|
4168
4193
|
function T(P, I, D, w) {
|
|
4169
4194
|
if (P.length === 1)
|
|
4170
|
-
return
|
|
4195
|
+
return S(P[0], I, D, w);
|
|
4171
4196
|
let k;
|
|
4172
4197
|
const A = (0, i.toHash)(P);
|
|
4173
4198
|
if (A.array && A.object) {
|
|
@@ -4177,7 +4202,7 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4177
4202
|
k = s.nil;
|
|
4178
4203
|
A.number && delete A.integer;
|
|
4179
4204
|
for (const V in A)
|
|
4180
|
-
k = (0, s.and)(k,
|
|
4205
|
+
k = (0, s.and)(k, S(V, I, D, w));
|
|
4181
4206
|
return k;
|
|
4182
4207
|
}
|
|
4183
4208
|
e.checkDataTypes = T;
|
|
@@ -4280,14 +4305,14 @@ function schemaProperties(e, t) {
|
|
|
4280
4305
|
}
|
|
4281
4306
|
code.schemaProperties = schemaProperties;
|
|
4282
4307
|
function callValidateCode({ schemaCode: e, data: t, it: { gen: r, topSchemaRef: n, schemaPath: s, errorPath: i }, it: o }, l, d, u) {
|
|
4283
|
-
const
|
|
4308
|
+
const f = u ? (0, codegen_1$q._)`${e}, ${t}, ${n}${s}` : t, $ = [
|
|
4284
4309
|
[names_1$5.default.instancePath, (0, codegen_1$q.strConcat)(names_1$5.default.instancePath, i)],
|
|
4285
4310
|
[names_1$5.default.parentData, o.parentData],
|
|
4286
4311
|
[names_1$5.default.parentDataProperty, o.parentDataProperty],
|
|
4287
4312
|
[names_1$5.default.rootData, names_1$5.default.rootData]
|
|
4288
4313
|
];
|
|
4289
4314
|
o.opts.dynamicRef && $.push([names_1$5.default.dynamicAnchors, names_1$5.default.dynamicAnchors]);
|
|
4290
|
-
const O = (0, codegen_1$q._)`${
|
|
4315
|
+
const O = (0, codegen_1$q._)`${f}, ${r.object(...$)}`;
|
|
4291
4316
|
return d !== codegen_1$q.nil ? (0, codegen_1$q._)`${l}.call(${d}, ${O})` : (0, codegen_1$q._)`${l}(${O})`;
|
|
4292
4317
|
}
|
|
4293
4318
|
code.callValidateCode = callValidateCode;
|
|
@@ -4328,12 +4353,12 @@ function validateUnion(e) {
|
|
|
4328
4353
|
return;
|
|
4329
4354
|
const o = t.let("valid", !1), l = t.name("_valid");
|
|
4330
4355
|
t.block(() => r.forEach((d, u) => {
|
|
4331
|
-
const
|
|
4356
|
+
const f = e.subschema({
|
|
4332
4357
|
keyword: n,
|
|
4333
4358
|
schemaProp: u,
|
|
4334
4359
|
compositeRule: !0
|
|
4335
4360
|
}, l);
|
|
4336
|
-
t.assign(o, (0, codegen_1$q._)`${o} || ${l}`), e.mergeValidEvaluated(
|
|
4361
|
+
t.assign(o, (0, codegen_1$q._)`${o} || ${l}`), e.mergeValidEvaluated(f, l) || t.if((0, codegen_1$q.not)(o));
|
|
4337
4362
|
})), e.result(o, () => e.reset(), () => e.error(!0));
|
|
4338
4363
|
}
|
|
4339
4364
|
code.validateUnion = validateUnion;
|
|
@@ -4357,27 +4382,27 @@ function funcKeywordCode(e, t) {
|
|
|
4357
4382
|
var r;
|
|
4358
4383
|
const { gen: n, keyword: s, schema: i, parentSchema: o, $data: l, it: d } = e;
|
|
4359
4384
|
checkAsyncKeyword(d, t);
|
|
4360
|
-
const u = !l && t.compile ? t.compile.call(d.self, i, o, d) : t.validate,
|
|
4385
|
+
const u = !l && t.compile ? t.compile.call(d.self, i, o, d) : t.validate, f = useKeyword(n, s, u), $ = n.let("valid");
|
|
4361
4386
|
e.block$data($, O), e.ok((r = t.valid) !== null && r !== void 0 ? r : $);
|
|
4362
4387
|
function O() {
|
|
4363
4388
|
if (t.errors === !1)
|
|
4364
4389
|
T(), t.modifying && modifyData(e), y(() => e.error());
|
|
4365
4390
|
else {
|
|
4366
|
-
const _ = t.async ?
|
|
4391
|
+
const _ = t.async ? C() : S();
|
|
4367
4392
|
t.modifying && modifyData(e), y(() => addErrs(e, _));
|
|
4368
4393
|
}
|
|
4369
4394
|
}
|
|
4370
|
-
function
|
|
4395
|
+
function C() {
|
|
4371
4396
|
const _ = n.let("ruleErrs", null);
|
|
4372
4397
|
return n.try(() => T((0, codegen_1$p._)`await `), (g) => n.assign($, !1).if((0, codegen_1$p._)`${g} instanceof ${d.ValidationError}`, () => n.assign(_, (0, codegen_1$p._)`${g}.errors`), () => n.throw(g))), _;
|
|
4373
4398
|
}
|
|
4374
|
-
function
|
|
4375
|
-
const _ = (0, codegen_1$p._)`${
|
|
4399
|
+
function S() {
|
|
4400
|
+
const _ = (0, codegen_1$p._)`${f}.errors`;
|
|
4376
4401
|
return n.assign(_, null), T(codegen_1$p.nil), _;
|
|
4377
4402
|
}
|
|
4378
4403
|
function T(_ = t.async ? (0, codegen_1$p._)`await ` : codegen_1$p.nil) {
|
|
4379
4404
|
const g = d.opts.passContext ? names_1$4.default.this : names_1$4.default.self, P = !("compile" in t && !l || t.schema === !1);
|
|
4380
|
-
n.assign($, (0, codegen_1$p._)`${_}${(0, code_1$9.callValidateCode)(e,
|
|
4405
|
+
n.assign($, (0, codegen_1$p._)`${_}${(0, code_1$9.callValidateCode)(e, f, g, P)}`, t.modifying);
|
|
4381
4406
|
}
|
|
4382
4407
|
function y(_) {
|
|
4383
4408
|
var g;
|
|
@@ -4460,8 +4485,8 @@ function extendSubschemaData(e, t, { dataProp: r, dataPropType: n, data: s, data
|
|
|
4460
4485
|
throw new Error('both "data" and "dataProp" passed, only one allowed');
|
|
4461
4486
|
const { gen: l } = t;
|
|
4462
4487
|
if (r !== void 0) {
|
|
4463
|
-
const { errorPath: u, dataPathArr:
|
|
4464
|
-
d(O), 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 = [...
|
|
4488
|
+
const { errorPath: u, dataPathArr: f, opts: $ } = t, O = l.let("data", (0, codegen_1$o._)`${t.data}${(0, codegen_1$o.getProperty)(r)}`, !0);
|
|
4489
|
+
d(O), 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 = [...f, e.parentDataProperty];
|
|
4465
4490
|
}
|
|
4466
4491
|
if (s !== void 0) {
|
|
4467
4492
|
const u = s instanceof codegen_1$o.Name ? s : l.let("data", s, !0);
|
|
@@ -4565,18 +4590,18 @@ traverse$1.skipKeywords = {
|
|
|
4565
4590
|
function _traverse(e, t, r, n, s, i, o, l, d, u) {
|
|
4566
4591
|
if (n && typeof n == "object" && !Array.isArray(n)) {
|
|
4567
4592
|
t(n, s, i, o, l, d, u);
|
|
4568
|
-
for (var
|
|
4569
|
-
var $ = n[
|
|
4593
|
+
for (var f in n) {
|
|
4594
|
+
var $ = n[f];
|
|
4570
4595
|
if (Array.isArray($)) {
|
|
4571
|
-
if (
|
|
4596
|
+
if (f in traverse$1.arrayKeywords)
|
|
4572
4597
|
for (var O = 0; O < $.length; O++)
|
|
4573
|
-
_traverse(e, t, r, $[O], s + "/" +
|
|
4574
|
-
} else if (
|
|
4598
|
+
_traverse(e, t, r, $[O], s + "/" + f + "/" + O, i, s, f, n, O);
|
|
4599
|
+
} else if (f in traverse$1.propsKeywords) {
|
|
4575
4600
|
if ($ && typeof $ == "object")
|
|
4576
|
-
for (var
|
|
4577
|
-
_traverse(e, t, r, $[
|
|
4601
|
+
for (var C in $)
|
|
4602
|
+
_traverse(e, t, r, $[C], s + "/" + f + "/" + escapeJsonPtr(C), i, s, f, n, C);
|
|
4578
4603
|
} else
|
|
4579
|
-
(
|
|
4604
|
+
(f in traverse$1.keywords || e.allKeys && !(f in traverse$1.skipKeywords)) && _traverse(e, t, r, $, s + "/" + f, i, s, f, n);
|
|
4580
4605
|
}
|
|
4581
4606
|
r(n, s, i, o, l, d, u);
|
|
4582
4607
|
}
|
|
@@ -4660,16 +4685,16 @@ function getSchemaRefs(e, t) {
|
|
|
4660
4685
|
if (typeof e == "boolean")
|
|
4661
4686
|
return {};
|
|
4662
4687
|
const { schemaId: r, uriResolver: n } = this.opts, s = normalizeId(e[r] || t), i = { "": s }, o = getFullPath(n, s, !1), l = {}, d = /* @__PURE__ */ new Set();
|
|
4663
|
-
return traverse(e, { allKeys: !0 }, ($, O,
|
|
4664
|
-
if (
|
|
4688
|
+
return traverse(e, { allKeys: !0 }, ($, O, C, S) => {
|
|
4689
|
+
if (S === void 0)
|
|
4665
4690
|
return;
|
|
4666
4691
|
const T = o + O;
|
|
4667
|
-
let y = i[
|
|
4692
|
+
let y = i[S];
|
|
4668
4693
|
typeof $[r] == "string" && (y = _.call(this, $[r])), g.call(this, $.$anchor), g.call(this, $.$dynamicAnchor), i[O] = y;
|
|
4669
4694
|
function _(P) {
|
|
4670
4695
|
const I = this.opts.uriResolver.resolve;
|
|
4671
4696
|
if (P = normalizeId(y ? I(y, P) : P), d.has(P))
|
|
4672
|
-
throw
|
|
4697
|
+
throw f(P);
|
|
4673
4698
|
d.add(P);
|
|
4674
4699
|
let D = this.refs[P];
|
|
4675
4700
|
return typeof D == "string" && (D = this.refs[D]), typeof D == "object" ? u($, D.schema, P) : P !== normalizeId(T) && (P[0] === "#" ? (u($, l[P], P), l[P] = $) : this.refs[P] = T), P;
|
|
@@ -4682,11 +4707,11 @@ function getSchemaRefs(e, t) {
|
|
|
4682
4707
|
}
|
|
4683
4708
|
}
|
|
4684
4709
|
}), l;
|
|
4685
|
-
function u($, O,
|
|
4710
|
+
function u($, O, C) {
|
|
4686
4711
|
if (O !== void 0 && !equal$2($, O))
|
|
4687
|
-
throw
|
|
4712
|
+
throw f(C);
|
|
4688
4713
|
}
|
|
4689
|
-
function
|
|
4714
|
+
function f($) {
|
|
4690
4715
|
return new Error(`reference "${$}" resolves to more than one schema`);
|
|
4691
4716
|
}
|
|
4692
4717
|
}
|
|
@@ -4797,15 +4822,15 @@ function assignEvaluated({ gen: e, evaluated: t, props: r, items: n }) {
|
|
|
4797
4822
|
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);
|
|
4798
4823
|
}
|
|
4799
4824
|
function schemaKeywords(e, t, r, n) {
|
|
4800
|
-
const { gen: s, schema: i, data: o, allErrors: l, opts: d, self: u } = e, { RULES:
|
|
4801
|
-
if (i.$ref && (d.ignoreKeywordsWithRef || !(0, util_1$l.schemaHasRulesButRef)(i,
|
|
4802
|
-
s.block(() => keywordCode(e, "$ref",
|
|
4825
|
+
const { gen: s, schema: i, data: o, allErrors: l, opts: d, self: u } = e, { RULES: f } = u;
|
|
4826
|
+
if (i.$ref && (d.ignoreKeywordsWithRef || !(0, util_1$l.schemaHasRulesButRef)(i, f))) {
|
|
4827
|
+
s.block(() => keywordCode(e, "$ref", f.all.$ref.definition));
|
|
4803
4828
|
return;
|
|
4804
4829
|
}
|
|
4805
4830
|
d.jtd || checkStrictTypes(e, t), s.block(() => {
|
|
4806
|
-
for (const O of
|
|
4831
|
+
for (const O of f.rules)
|
|
4807
4832
|
$(O);
|
|
4808
|
-
$(
|
|
4833
|
+
$(f.post);
|
|
4809
4834
|
});
|
|
4810
4835
|
function $(O) {
|
|
4811
4836
|
(0, applicability_1.shouldUseGroup)(i, O) && (O.type ? (s.if((0, dataType_2.checkDataType)(O.type, o, d.strictNumbers)), iterateKeywords(e, O), t.length === 1 && t[0] === O.type && r && (s.else(), (0, dataType_2.reportTypeError)(e)), s.endIf()) : iterateKeywords(e, O), l || s.if((0, codegen_1$n._)`${names_1$3.default.errors} === ${n || 0}`));
|
|
@@ -4980,15 +5005,15 @@ function getData(e, { dataLevel: t, dataNames: r, dataPathArr: n }) {
|
|
|
4980
5005
|
const u = RELATIVE_JSON_POINTER.exec(e);
|
|
4981
5006
|
if (!u)
|
|
4982
5007
|
throw new Error(`Invalid JSON-pointer: ${e}`);
|
|
4983
|
-
const
|
|
5008
|
+
const f = +u[1];
|
|
4984
5009
|
if (s = u[2], s === "#") {
|
|
4985
|
-
if (
|
|
4986
|
-
throw new Error(d("property/index",
|
|
4987
|
-
return n[t -
|
|
5010
|
+
if (f >= t)
|
|
5011
|
+
throw new Error(d("property/index", f));
|
|
5012
|
+
return n[t - f];
|
|
4988
5013
|
}
|
|
4989
|
-
if (
|
|
4990
|
-
throw new Error(d("data",
|
|
4991
|
-
if (i = r[t -
|
|
5014
|
+
if (f > t)
|
|
5015
|
+
throw new Error(d("data", f));
|
|
5016
|
+
if (i = r[t - f], !s)
|
|
4992
5017
|
return i;
|
|
4993
5018
|
}
|
|
4994
5019
|
let o = i;
|
|
@@ -4996,8 +5021,8 @@ function getData(e, { dataLevel: t, dataNames: r, dataPathArr: n }) {
|
|
|
4996
5021
|
for (const u of l)
|
|
4997
5022
|
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}`);
|
|
4998
5023
|
return o;
|
|
4999
|
-
function d(u,
|
|
5000
|
-
return `Cannot access ${u} ${
|
|
5024
|
+
function d(u, f) {
|
|
5025
|
+
return `Cannot access ${u} ${f} levels up, current level is ${t}`;
|
|
5001
5026
|
}
|
|
5002
5027
|
}
|
|
5003
5028
|
validate.getData = getData;
|
|
@@ -5067,24 +5092,24 @@ function compileSchema(e) {
|
|
|
5067
5092
|
opts: this.opts,
|
|
5068
5093
|
self: this
|
|
5069
5094
|
};
|
|
5070
|
-
let
|
|
5095
|
+
let f;
|
|
5071
5096
|
try {
|
|
5072
5097
|
this._compilations.add(e), (0, validate_1$1.validateFunctionCode)(u), o.optimize(this.opts.code.optimize);
|
|
5073
5098
|
const $ = o.toString();
|
|
5074
|
-
|
|
5075
|
-
const
|
|
5076
|
-
if (this.scope.value(d, { ref:
|
|
5077
|
-
const { props:
|
|
5078
|
-
|
|
5079
|
-
props:
|
|
5099
|
+
f = `${o.scopeRefs(names_1$2.default.scope)}return ${$}`, this.opts.code.process && (f = this.opts.code.process(f, e));
|
|
5100
|
+
const C = new Function(`${names_1$2.default.self}`, `${names_1$2.default.scope}`, f)(this, this.scope.get());
|
|
5101
|
+
if (this.scope.value(d, { ref: C }), C.errors = null, C.schema = e.schema, C.schemaEnv = e, e.$async && (C.$async = !0), this.opts.code.source === !0 && (C.source = { validateName: d, validateCode: $, scopeValues: o._values }), this.opts.unevaluated) {
|
|
5102
|
+
const { props: S, items: T } = u;
|
|
5103
|
+
C.evaluated = {
|
|
5104
|
+
props: S instanceof codegen_1$m.Name ? void 0 : S,
|
|
5080
5105
|
items: T instanceof codegen_1$m.Name ? void 0 : T,
|
|
5081
|
-
dynamicProps:
|
|
5106
|
+
dynamicProps: S instanceof codegen_1$m.Name,
|
|
5082
5107
|
dynamicItems: T instanceof codegen_1$m.Name
|
|
5083
|
-
},
|
|
5108
|
+
}, C.source && (C.source.evaluated = (0, codegen_1$m.stringify)(C.evaluated));
|
|
5084
5109
|
}
|
|
5085
|
-
return e.validate =
|
|
5110
|
+
return e.validate = C, e;
|
|
5086
5111
|
} catch ($) {
|
|
5087
|
-
throw delete e.validate, delete e.validateName,
|
|
5112
|
+
throw delete e.validate, delete e.validateName, f && this.logger.error("Error compiling schema, function code:", f), $;
|
|
5088
5113
|
} finally {
|
|
5089
5114
|
this._compilations.delete(e);
|
|
5090
5115
|
}
|
|
@@ -5201,40 +5226,40 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5201
5226
|
n(t);
|
|
5202
5227
|
})(commonjsGlobal, function(r) {
|
|
5203
5228
|
function n() {
|
|
5204
|
-
for (var
|
|
5229
|
+
for (var p = arguments.length, c = Array(p), m = 0; m < p; m++)
|
|
5205
5230
|
c[m] = arguments[m];
|
|
5206
5231
|
if (c.length > 1) {
|
|
5207
5232
|
c[0] = c[0].slice(0, -1);
|
|
5208
|
-
for (var
|
|
5233
|
+
for (var R = c.length - 1, E = 1; E < R; ++E)
|
|
5209
5234
|
c[E] = c[E].slice(1, -1);
|
|
5210
|
-
return c[
|
|
5235
|
+
return c[R] = c[R].slice(1), c.join("");
|
|
5211
5236
|
} else
|
|
5212
5237
|
return c[0];
|
|
5213
5238
|
}
|
|
5214
|
-
function s(
|
|
5215
|
-
return "(?:" +
|
|
5239
|
+
function s(p) {
|
|
5240
|
+
return "(?:" + p + ")";
|
|
5216
5241
|
}
|
|
5217
|
-
function i(
|
|
5218
|
-
return
|
|
5242
|
+
function i(p) {
|
|
5243
|
+
return p === void 0 ? "undefined" : p === null ? "null" : Object.prototype.toString.call(p).split(" ").pop().split("]").shift().toLowerCase();
|
|
5219
5244
|
}
|
|
5220
|
-
function o(
|
|
5221
|
-
return
|
|
5245
|
+
function o(p) {
|
|
5246
|
+
return p.toUpperCase();
|
|
5222
5247
|
}
|
|
5223
|
-
function l(
|
|
5224
|
-
return
|
|
5248
|
+
function l(p) {
|
|
5249
|
+
return p != null ? p instanceof Array ? p : typeof p.length != "number" || p.split || p.setInterval || p.call ? [p] : Array.prototype.slice.call(p) : [];
|
|
5225
5250
|
}
|
|
5226
|
-
function d(
|
|
5227
|
-
var m =
|
|
5251
|
+
function d(p, c) {
|
|
5252
|
+
var m = p;
|
|
5228
5253
|
if (c)
|
|
5229
|
-
for (var
|
|
5230
|
-
m[
|
|
5254
|
+
for (var R in c)
|
|
5255
|
+
m[R] = c[R];
|
|
5231
5256
|
return m;
|
|
5232
5257
|
}
|
|
5233
|
-
function u(
|
|
5234
|
-
var c = "[A-Za-z]", m = "[0-9]",
|
|
5258
|
+
function u(p) {
|
|
5259
|
+
var c = "[A-Za-z]", m = "[0-9]", R = n(m, "[A-Fa-f]"), E = s(s("%[EFef]" + R + "%" + R + R + "%" + R + R) + "|" + s("%[89A-Fa-f]" + R + "%" + R + R) + "|" + s("%" + R + R)), U = "[\\:\\/\\?\\#\\[\\]\\@]", L = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", J = n(U, L), Y = p ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", se = p ? "[\\uE000-\\uF8FF]" : "[]", B = n(c, m, "[\\-\\.\\_\\~]", Y);
|
|
5235
5260
|
s(c + n(c, m, "[\\+\\-\\.]") + "*"), s(s(E + "|" + n(B, L, "[\\:]")) + "*");
|
|
5236
|
-
var Z = s(s("25[0-5]") + "|" + s("2[0-4]" + m) + "|" + s("1" + m + m) + "|" + s("0?[1-9]" + m) + "|0?0?" + m), ie = s(Z + "\\." + Z + "\\." + Z + "\\." + Z), z = s(
|
|
5237
|
-
s("[vV]" +
|
|
5261
|
+
var Z = s(s("25[0-5]") + "|" + s("2[0-4]" + m) + "|" + s("1" + m + m) + "|" + s("0?[1-9]" + m) + "|0?0?" + m), ie = s(Z + "\\." + Z + "\\." + Z + "\\." + Z), z = s(R + "{1,4}"), X = s(s(z + "\\:" + z) + "|" + ie), ae = s(s(z + "\\:") + "{6}" + X), ee = s("\\:\\:" + s(z + "\\:") + "{5}" + X), Se = s(s(z) + "?\\:\\:" + s(z + "\\:") + "{4}" + X), $e = s(s(s(z + "\\:") + "{0,1}" + z) + "?\\:\\:" + s(z + "\\:") + "{3}" + X), ge = s(s(s(z + "\\:") + "{0,2}" + z) + "?\\:\\:" + s(z + "\\:") + "{2}" + X), Be = s(s(s(z + "\\:") + "{0,3}" + z) + "?\\:\\:" + z + "\\:" + X), Ie = s(s(s(z + "\\:") + "{0,4}" + z) + "?\\:\\:" + X), fe = s(s(s(z + "\\:") + "{0,5}" + z) + "?\\:\\:" + z), ye = s(s(s(z + "\\:") + "{0,6}" + z) + "?\\:\\:"), je = s([ae, ee, Se, $e, ge, Be, Ie, fe, ye].join("|")), we = s(s(B + "|" + E) + "+");
|
|
5262
|
+
s("[vV]" + R + "+\\." + n(B, L, "[\\:]") + "+"), s(s(E + "|" + n(B, L)) + "*");
|
|
5238
5263
|
var ct = s(E + "|" + n(B, L, "[\\:\\@]"));
|
|
5239
5264
|
return s(s(E + "|" + n(B, L, "[\\@]")) + "+"), s(s(ct + "|" + n("[\\/\\?]", se)) + "*"), {
|
|
5240
5265
|
NOT_SCHEME: new RegExp(n("[^]", c, m, "[\\+\\-\\.]"), "g"),
|
|
@@ -5249,15 +5274,15 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5249
5274
|
OTHER_CHARS: new RegExp(n("[^\\%]", B, J), "g"),
|
|
5250
5275
|
PCT_ENCODED: new RegExp(E, "g"),
|
|
5251
5276
|
IPV4ADDRESS: new RegExp("^(" + ie + ")$"),
|
|
5252
|
-
IPV6ADDRESS: new RegExp("^\\[?(" + je + ")" + s(s("\\%25|\\%(?!" +
|
|
5277
|
+
IPV6ADDRESS: new RegExp("^\\[?(" + je + ")" + s(s("\\%25|\\%(?!" + R + "{2})") + "(" + we + ")") + "?\\]?$")
|
|
5253
5278
|
//RFC 6874, with relaxed parsing rules
|
|
5254
5279
|
};
|
|
5255
5280
|
}
|
|
5256
|
-
var
|
|
5257
|
-
function
|
|
5258
|
-
var
|
|
5281
|
+
var f = u(!1), $ = u(!0), O = function() {
|
|
5282
|
+
function p(c, m) {
|
|
5283
|
+
var R = [], E = !0, U = !1, L = void 0;
|
|
5259
5284
|
try {
|
|
5260
|
-
for (var J = c[Symbol.iterator](), Y; !(E = (Y = J.next()).done) && (
|
|
5285
|
+
for (var J = c[Symbol.iterator](), Y; !(E = (Y = J.next()).done) && (R.push(Y.value), !(m && R.length === m)); E = !0)
|
|
5261
5286
|
;
|
|
5262
5287
|
} catch (se) {
|
|
5263
5288
|
U = !0, L = se;
|
|
@@ -5269,46 +5294,46 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5269
5294
|
throw L;
|
|
5270
5295
|
}
|
|
5271
5296
|
}
|
|
5272
|
-
return
|
|
5297
|
+
return R;
|
|
5273
5298
|
}
|
|
5274
5299
|
return function(c, m) {
|
|
5275
5300
|
if (Array.isArray(c))
|
|
5276
5301
|
return c;
|
|
5277
5302
|
if (Symbol.iterator in Object(c))
|
|
5278
|
-
return
|
|
5303
|
+
return p(c, m);
|
|
5279
5304
|
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
5280
5305
|
};
|
|
5281
|
-
}(),
|
|
5282
|
-
if (Array.isArray(
|
|
5283
|
-
for (var c = 0, m = Array(
|
|
5284
|
-
m[c] =
|
|
5306
|
+
}(), C = function(p) {
|
|
5307
|
+
if (Array.isArray(p)) {
|
|
5308
|
+
for (var c = 0, m = Array(p.length); c < p.length; c++)
|
|
5309
|
+
m[c] = p[c];
|
|
5285
5310
|
return m;
|
|
5286
5311
|
} else
|
|
5287
|
-
return Array.from(
|
|
5288
|
-
},
|
|
5312
|
+
return Array.from(p);
|
|
5313
|
+
}, S = 2147483647, T = 36, y = 1, _ = 26, g = 38, P = 700, I = 72, D = 128, w = "-", k = /^xn--/, A = /[^\0-\x7E]/, V = /[\x2E\u3002\uFF0E\uFF61]/g, x = {
|
|
5289
5314
|
overflow: "Overflow: input needs wider integers to process",
|
|
5290
5315
|
"not-basic": "Illegal input >= 0x80 (not a basic code point)",
|
|
5291
5316
|
"invalid-input": "Invalid input"
|
|
5292
5317
|
}, re = T - y, K = Math.floor, ue = String.fromCharCode;
|
|
5293
|
-
function oe(
|
|
5294
|
-
throw new RangeError(x[
|
|
5318
|
+
function oe(p) {
|
|
5319
|
+
throw new RangeError(x[p]);
|
|
5295
5320
|
}
|
|
5296
|
-
function ke(
|
|
5297
|
-
for (var m = [],
|
|
5298
|
-
m[
|
|
5321
|
+
function ke(p, c) {
|
|
5322
|
+
for (var m = [], R = p.length; R--; )
|
|
5323
|
+
m[R] = c(p[R]);
|
|
5299
5324
|
return m;
|
|
5300
5325
|
}
|
|
5301
|
-
function Ce(
|
|
5302
|
-
var m =
|
|
5303
|
-
m.length > 1 && (
|
|
5304
|
-
var E =
|
|
5305
|
-
return
|
|
5306
|
-
}
|
|
5307
|
-
function qe(
|
|
5308
|
-
for (var c = [], m = 0,
|
|
5309
|
-
var E =
|
|
5310
|
-
if (E >= 55296 && E <= 56319 && m <
|
|
5311
|
-
var U =
|
|
5326
|
+
function Ce(p, c) {
|
|
5327
|
+
var m = p.split("@"), R = "";
|
|
5328
|
+
m.length > 1 && (R = m[0] + "@", p = m[1]), p = p.replace(V, ".");
|
|
5329
|
+
var E = p.split("."), U = ke(E, c).join(".");
|
|
5330
|
+
return R + U;
|
|
5331
|
+
}
|
|
5332
|
+
function qe(p) {
|
|
5333
|
+
for (var c = [], m = 0, R = p.length; m < R; ) {
|
|
5334
|
+
var E = p.charCodeAt(m++);
|
|
5335
|
+
if (E >= 55296 && E <= 56319 && m < R) {
|
|
5336
|
+
var U = p.charCodeAt(m++);
|
|
5312
5337
|
(U & 64512) == 56320 ? c.push(((E & 1023) << 10) + (U & 1023) + 65536) : (c.push(E), m--);
|
|
5313
5338
|
} else
|
|
5314
5339
|
c.push(E);
|
|
@@ -5316,15 +5341,15 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5316
5341
|
return c;
|
|
5317
5342
|
}
|
|
5318
5343
|
var et = function(c) {
|
|
5319
|
-
return String.fromCodePoint.apply(String,
|
|
5344
|
+
return String.fromCodePoint.apply(String, C(c));
|
|
5320
5345
|
}, Ue = function(c) {
|
|
5321
5346
|
return c - 48 < 10 ? c - 22 : c - 65 < 26 ? c - 65 : c - 97 < 26 ? c - 97 : T;
|
|
5322
5347
|
}, F = function(c, m) {
|
|
5323
5348
|
return c + 22 + 75 * (c < 26) - ((m != 0) << 5);
|
|
5324
|
-
}, v = function(c, m,
|
|
5349
|
+
}, v = function(c, m, R) {
|
|
5325
5350
|
var E = 0;
|
|
5326
5351
|
for (
|
|
5327
|
-
c =
|
|
5352
|
+
c = R ? K(c / P) : c >> 1, c += K(c / m);
|
|
5328
5353
|
/* no initialization */
|
|
5329
5354
|
c > re * _ >> 1;
|
|
5330
5355
|
E += T
|
|
@@ -5332,34 +5357,34 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5332
5357
|
c = K(c / re);
|
|
5333
5358
|
return K(E + (re + 1) * c / (c + g));
|
|
5334
5359
|
}, j = function(c) {
|
|
5335
|
-
var m = [],
|
|
5360
|
+
var m = [], R = c.length, E = 0, U = D, L = I, J = c.lastIndexOf(w);
|
|
5336
5361
|
J < 0 && (J = 0);
|
|
5337
5362
|
for (var Y = 0; Y < J; ++Y)
|
|
5338
5363
|
c.charCodeAt(Y) >= 128 && oe("not-basic"), m.push(c.charCodeAt(Y));
|
|
5339
|
-
for (var se = J > 0 ? J + 1 : 0; se <
|
|
5364
|
+
for (var se = J > 0 ? J + 1 : 0; se < R; ) {
|
|
5340
5365
|
for (
|
|
5341
5366
|
var B = E, Z = 1, ie = T;
|
|
5342
5367
|
;
|
|
5343
5368
|
/* no condition */
|
|
5344
5369
|
ie += T
|
|
5345
5370
|
) {
|
|
5346
|
-
se >=
|
|
5371
|
+
se >= R && oe("invalid-input");
|
|
5347
5372
|
var z = Ue(c.charCodeAt(se++));
|
|
5348
|
-
(z >= T || z > K((
|
|
5373
|
+
(z >= T || z > K((S - E) / Z)) && oe("overflow"), E += z * Z;
|
|
5349
5374
|
var X = ie <= L ? y : ie >= L + _ ? _ : ie - L;
|
|
5350
5375
|
if (z < X)
|
|
5351
5376
|
break;
|
|
5352
5377
|
var ae = T - X;
|
|
5353
|
-
Z > K(
|
|
5378
|
+
Z > K(S / ae) && oe("overflow"), Z *= ae;
|
|
5354
5379
|
}
|
|
5355
5380
|
var ee = m.length + 1;
|
|
5356
|
-
L = v(E - B, ee, B == 0), K(E / ee) >
|
|
5381
|
+
L = v(E - B, ee, B == 0), K(E / ee) > S - U && oe("overflow"), U += K(E / ee), E %= ee, m.splice(E++, 0, U);
|
|
5357
5382
|
}
|
|
5358
5383
|
return String.fromCodePoint.apply(String, m);
|
|
5359
5384
|
}, b = function(c) {
|
|
5360
5385
|
var m = [];
|
|
5361
5386
|
c = qe(c);
|
|
5362
|
-
var
|
|
5387
|
+
var R = c.length, E = D, U = 0, L = I, J = !0, Y = !1, se = void 0;
|
|
5363
5388
|
try {
|
|
5364
5389
|
for (var B = c[Symbol.iterator](), Z; !(J = (Z = B.next()).done); J = !0) {
|
|
5365
5390
|
var ie = Z.value;
|
|
@@ -5376,8 +5401,8 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5376
5401
|
}
|
|
5377
5402
|
}
|
|
5378
5403
|
var z = m.length, X = z;
|
|
5379
|
-
for (z && m.push(w); X <
|
|
5380
|
-
var ae =
|
|
5404
|
+
for (z && m.push(w); X < R; ) {
|
|
5405
|
+
var ae = S, ee = !0, Se = !1, $e = void 0;
|
|
5381
5406
|
try {
|
|
5382
5407
|
for (var ge = c[Symbol.iterator](), Be; !(ee = (Be = ge.next()).done); ee = !0) {
|
|
5383
5408
|
var Ie = Be.value;
|
|
@@ -5394,12 +5419,12 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5394
5419
|
}
|
|
5395
5420
|
}
|
|
5396
5421
|
var fe = X + 1;
|
|
5397
|
-
ae - E > K((
|
|
5422
|
+
ae - E > K((S - U) / fe) && oe("overflow"), U += (ae - E) * fe, E = ae;
|
|
5398
5423
|
var ye = !0, je = !1, we = void 0;
|
|
5399
5424
|
try {
|
|
5400
5425
|
for (var ct = c[Symbol.iterator](), Lt; !(ye = (Lt = ct.next()).done); ye = !0) {
|
|
5401
5426
|
var Ht = Lt.value;
|
|
5402
|
-
if (Ht < E && ++U >
|
|
5427
|
+
if (Ht < E && ++U > S && oe("overflow"), Ht == E) {
|
|
5403
5428
|
for (
|
|
5404
5429
|
var pt = U, ft = T;
|
|
5405
5430
|
;
|
|
@@ -5436,7 +5461,7 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5436
5461
|
return Ce(c, function(m) {
|
|
5437
5462
|
return A.test(m) ? "xn--" + b(m) : m;
|
|
5438
5463
|
});
|
|
5439
|
-
},
|
|
5464
|
+
}, N = {
|
|
5440
5465
|
/**
|
|
5441
5466
|
* A string representing the current Punycode.js version number.
|
|
5442
5467
|
* @memberOf punycode
|
|
@@ -5459,50 +5484,50 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5459
5484
|
toASCII: h,
|
|
5460
5485
|
toUnicode: a
|
|
5461
5486
|
}, M = {};
|
|
5462
|
-
function q(
|
|
5463
|
-
var c =
|
|
5487
|
+
function q(p) {
|
|
5488
|
+
var c = p.charCodeAt(0), m = void 0;
|
|
5464
5489
|
return c < 16 ? m = "%0" + c.toString(16).toUpperCase() : c < 128 ? m = "%" + c.toString(16).toUpperCase() : c < 2048 ? m = "%" + (c >> 6 | 192).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase() : m = "%" + (c >> 12 | 224).toString(16).toUpperCase() + "%" + (c >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase(), m;
|
|
5465
5490
|
}
|
|
5466
|
-
function W(
|
|
5467
|
-
for (var c = "", m = 0,
|
|
5468
|
-
var E = parseInt(
|
|
5491
|
+
function W(p) {
|
|
5492
|
+
for (var c = "", m = 0, R = p.length; m < R; ) {
|
|
5493
|
+
var E = parseInt(p.substr(m + 1, 2), 16);
|
|
5469
5494
|
if (E < 128)
|
|
5470
5495
|
c += String.fromCharCode(E), m += 3;
|
|
5471
5496
|
else if (E >= 194 && E < 224) {
|
|
5472
|
-
if (
|
|
5473
|
-
var U = parseInt(
|
|
5497
|
+
if (R - m >= 6) {
|
|
5498
|
+
var U = parseInt(p.substr(m + 4, 2), 16);
|
|
5474
5499
|
c += String.fromCharCode((E & 31) << 6 | U & 63);
|
|
5475
5500
|
} else
|
|
5476
|
-
c +=
|
|
5501
|
+
c += p.substr(m, 6);
|
|
5477
5502
|
m += 6;
|
|
5478
5503
|
} else if (E >= 224) {
|
|
5479
|
-
if (
|
|
5480
|
-
var L = parseInt(
|
|
5504
|
+
if (R - m >= 9) {
|
|
5505
|
+
var L = parseInt(p.substr(m + 4, 2), 16), J = parseInt(p.substr(m + 7, 2), 16);
|
|
5481
5506
|
c += String.fromCharCode((E & 15) << 12 | (L & 63) << 6 | J & 63);
|
|
5482
5507
|
} else
|
|
5483
|
-
c +=
|
|
5508
|
+
c += p.substr(m, 9);
|
|
5484
5509
|
m += 9;
|
|
5485
5510
|
} else
|
|
5486
|
-
c +=
|
|
5511
|
+
c += p.substr(m, 3), m += 3;
|
|
5487
5512
|
}
|
|
5488
5513
|
return c;
|
|
5489
5514
|
}
|
|
5490
|
-
function G(
|
|
5491
|
-
function m(
|
|
5492
|
-
var E = W(
|
|
5493
|
-
return E.match(c.UNRESERVED) ? E :
|
|
5515
|
+
function G(p, c) {
|
|
5516
|
+
function m(R) {
|
|
5517
|
+
var E = W(R);
|
|
5518
|
+
return E.match(c.UNRESERVED) ? E : R;
|
|
5494
5519
|
}
|
|
5495
|
-
return
|
|
5520
|
+
return p.scheme && (p.scheme = String(p.scheme).replace(c.PCT_ENCODED, m).toLowerCase().replace(c.NOT_SCHEME, "")), p.userinfo !== void 0 && (p.userinfo = String(p.userinfo).replace(c.PCT_ENCODED, m).replace(c.NOT_USERINFO, q).replace(c.PCT_ENCODED, o)), p.host !== void 0 && (p.host = String(p.host).replace(c.PCT_ENCODED, m).toLowerCase().replace(c.NOT_HOST, q).replace(c.PCT_ENCODED, o)), p.path !== void 0 && (p.path = String(p.path).replace(c.PCT_ENCODED, m).replace(p.scheme ? c.NOT_PATH : c.NOT_PATH_NOSCHEME, q).replace(c.PCT_ENCODED, o)), p.query !== void 0 && (p.query = String(p.query).replace(c.PCT_ENCODED, m).replace(c.NOT_QUERY, q).replace(c.PCT_ENCODED, o)), p.fragment !== void 0 && (p.fragment = String(p.fragment).replace(c.PCT_ENCODED, m).replace(c.NOT_FRAGMENT, q).replace(c.PCT_ENCODED, o)), p;
|
|
5496
5521
|
}
|
|
5497
|
-
function ne(
|
|
5498
|
-
return
|
|
5522
|
+
function ne(p) {
|
|
5523
|
+
return p.replace(/^0*(.*)/, "$1") || "0";
|
|
5499
5524
|
}
|
|
5500
|
-
function he(
|
|
5501
|
-
var m =
|
|
5502
|
-
return E ? E.split(".").map(ne).join(".") :
|
|
5525
|
+
function he(p, c) {
|
|
5526
|
+
var m = p.match(c.IPV4ADDRESS) || [], R = O(m, 2), E = R[1];
|
|
5527
|
+
return E ? E.split(".").map(ne).join(".") : p;
|
|
5503
5528
|
}
|
|
5504
|
-
function Le(
|
|
5505
|
-
var m =
|
|
5529
|
+
function Le(p, c) {
|
|
5530
|
+
var m = p.match(c.IPV6ADDRESS) || [], R = O(m, 3), E = R[1], U = R[2];
|
|
5506
5531
|
if (E) {
|
|
5507
5532
|
for (var L = E.toLowerCase().split("::").reverse(), J = O(L, 2), Y = J[0], se = J[1], B = se ? se.split(":").map(ne) : [], Z = Y.split(":").map(ne), ie = c.IPV4ADDRESS.test(Z[Z.length - 1]), z = ie ? 7 : 8, X = Z.length - z, ae = Array(z), ee = 0; ee < z; ++ee)
|
|
5508
5533
|
ae[ee] = B[ee] || Z[X + ee] || "";
|
|
@@ -5523,95 +5548,95 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5523
5548
|
ge = ae.join(":");
|
|
5524
5549
|
return U && (ge += "%" + U), ge;
|
|
5525
5550
|
} else
|
|
5526
|
-
return
|
|
5551
|
+
return p;
|
|
5527
5552
|
}
|
|
5528
5553
|
var tt = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, rt = "".match(/(){0}/)[1] === void 0;
|
|
5529
|
-
function de(
|
|
5530
|
-
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = {},
|
|
5531
|
-
c.reference === "suffix" && (
|
|
5532
|
-
var E =
|
|
5554
|
+
function de(p) {
|
|
5555
|
+
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = {}, R = c.iri !== !1 ? $ : f;
|
|
5556
|
+
c.reference === "suffix" && (p = (c.scheme ? c.scheme + ":" : "") + "//" + p);
|
|
5557
|
+
var E = p.match(tt);
|
|
5533
5558
|
if (E) {
|
|
5534
|
-
rt ? (m.scheme = E[1], m.userinfo = E[3], m.host = E[4], m.port = parseInt(E[5], 10), m.path = E[6] || "", m.query = E[7], m.fragment = E[8], isNaN(m.port) && (m.port = E[5])) : (m.scheme = E[1] || void 0, m.userinfo =
|
|
5559
|
+
rt ? (m.scheme = E[1], m.userinfo = E[3], m.host = E[4], m.port = parseInt(E[5], 10), m.path = E[6] || "", m.query = E[7], m.fragment = E[8], isNaN(m.port) && (m.port = E[5])) : (m.scheme = E[1] || void 0, m.userinfo = p.indexOf("@") !== -1 ? E[3] : void 0, m.host = p.indexOf("//") !== -1 ? E[4] : void 0, m.port = parseInt(E[5], 10), m.path = E[6] || "", m.query = p.indexOf("?") !== -1 ? E[7] : void 0, m.fragment = p.indexOf("#") !== -1 ? E[8] : void 0, isNaN(m.port) && (m.port = p.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? E[4] : void 0)), m.host && (m.host = Le(he(m.host, R), R)), m.scheme === void 0 && m.userinfo === void 0 && m.host === void 0 && m.port === void 0 && !m.path && m.query === void 0 ? m.reference = "same-document" : m.scheme === void 0 ? m.reference = "relative" : m.fragment === void 0 ? m.reference = "absolute" : m.reference = "uri", c.reference && c.reference !== "suffix" && c.reference !== m.reference && (m.error = m.error || "URI is not a " + c.reference + " reference.");
|
|
5535
5560
|
var U = M[(c.scheme || m.scheme || "").toLowerCase()];
|
|
5536
5561
|
if (!c.unicodeSupport && (!U || !U.unicodeSupport)) {
|
|
5537
5562
|
if (m.host && (c.domainHost || U && U.domainHost))
|
|
5538
5563
|
try {
|
|
5539
|
-
m.host =
|
|
5564
|
+
m.host = N.toASCII(m.host.replace(R.PCT_ENCODED, W).toLowerCase());
|
|
5540
5565
|
} catch (L) {
|
|
5541
5566
|
m.error = m.error || "Host's domain name can not be converted to ASCII via punycode: " + L;
|
|
5542
5567
|
}
|
|
5543
|
-
G(m,
|
|
5568
|
+
G(m, f);
|
|
5544
5569
|
} else
|
|
5545
|
-
G(m,
|
|
5570
|
+
G(m, R);
|
|
5546
5571
|
U && U.parse && U.parse(m, c);
|
|
5547
5572
|
} else
|
|
5548
5573
|
m.error = m.error || "URI can not be parsed.";
|
|
5549
5574
|
return m;
|
|
5550
5575
|
}
|
|
5551
|
-
function nt(
|
|
5552
|
-
var m = c.iri !== !1 ? $ :
|
|
5553
|
-
return
|
|
5576
|
+
function nt(p, c) {
|
|
5577
|
+
var m = c.iri !== !1 ? $ : f, R = [];
|
|
5578
|
+
return p.userinfo !== void 0 && (R.push(p.userinfo), R.push("@")), p.host !== void 0 && R.push(Le(he(String(p.host), m), m).replace(m.IPV6ADDRESS, function(E, U, L) {
|
|
5554
5579
|
return "[" + U + (L ? "%25" + L : "") + "]";
|
|
5555
|
-
})), (typeof
|
|
5580
|
+
})), (typeof p.port == "number" || typeof p.port == "string") && (R.push(":"), R.push(String(p.port))), R.length ? R.join("") : void 0;
|
|
5556
5581
|
}
|
|
5557
5582
|
var He = /^\.\.?\//, Ve = /^\/\.(\/|$)/, ze = /^\/\.\.(\/|$)/, st = /^\/?(?:.|\n)*?(?=\/|$)/;
|
|
5558
|
-
function me(
|
|
5559
|
-
for (var c = [];
|
|
5560
|
-
if (
|
|
5561
|
-
|
|
5562
|
-
else if (
|
|
5563
|
-
|
|
5564
|
-
else if (
|
|
5565
|
-
|
|
5566
|
-
else if (
|
|
5567
|
-
|
|
5583
|
+
function me(p) {
|
|
5584
|
+
for (var c = []; p.length; )
|
|
5585
|
+
if (p.match(He))
|
|
5586
|
+
p = p.replace(He, "");
|
|
5587
|
+
else if (p.match(Ve))
|
|
5588
|
+
p = p.replace(Ve, "/");
|
|
5589
|
+
else if (p.match(ze))
|
|
5590
|
+
p = p.replace(ze, "/"), c.pop();
|
|
5591
|
+
else if (p === "." || p === "..")
|
|
5592
|
+
p = "";
|
|
5568
5593
|
else {
|
|
5569
|
-
var m =
|
|
5594
|
+
var m = p.match(st);
|
|
5570
5595
|
if (m) {
|
|
5571
|
-
var
|
|
5572
|
-
|
|
5596
|
+
var R = m[0];
|
|
5597
|
+
p = p.slice(R.length), c.push(R);
|
|
5573
5598
|
} else
|
|
5574
5599
|
throw new Error("Unexpected dot segment condition");
|
|
5575
5600
|
}
|
|
5576
5601
|
return c.join("");
|
|
5577
5602
|
}
|
|
5578
|
-
function le(
|
|
5579
|
-
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = c.iri ? $ :
|
|
5580
|
-
if (E && E.serialize && E.serialize(
|
|
5603
|
+
function le(p) {
|
|
5604
|
+
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = c.iri ? $ : f, R = [], E = M[(c.scheme || p.scheme || "").toLowerCase()];
|
|
5605
|
+
if (E && E.serialize && E.serialize(p, c), p.host && !m.IPV6ADDRESS.test(p.host)) {
|
|
5581
5606
|
if (c.domainHost || E && E.domainHost)
|
|
5582
5607
|
try {
|
|
5583
|
-
|
|
5608
|
+
p.host = c.iri ? N.toUnicode(p.host) : N.toASCII(p.host.replace(m.PCT_ENCODED, W).toLowerCase());
|
|
5584
5609
|
} catch (J) {
|
|
5585
|
-
|
|
5610
|
+
p.error = p.error || "Host's domain name can not be converted to " + (c.iri ? "Unicode" : "ASCII") + " via punycode: " + J;
|
|
5586
5611
|
}
|
|
5587
5612
|
}
|
|
5588
|
-
G(
|
|
5589
|
-
var U = nt(
|
|
5590
|
-
if (U !== void 0 && (c.reference !== "suffix" &&
|
|
5591
|
-
var L =
|
|
5592
|
-
!c.absolutePath && (!E || !E.absolutePath) && (L = me(L)), U === void 0 && (L = L.replace(/^\/\//, "/%2F")),
|
|
5613
|
+
G(p, m), c.reference !== "suffix" && p.scheme && (R.push(p.scheme), R.push(":"));
|
|
5614
|
+
var U = nt(p, c);
|
|
5615
|
+
if (U !== void 0 && (c.reference !== "suffix" && R.push("//"), R.push(U), p.path && p.path.charAt(0) !== "/" && R.push("/")), p.path !== void 0) {
|
|
5616
|
+
var L = p.path;
|
|
5617
|
+
!c.absolutePath && (!E || !E.absolutePath) && (L = me(L)), U === void 0 && (L = L.replace(/^\/\//, "/%2F")), R.push(L);
|
|
5593
5618
|
}
|
|
5594
|
-
return
|
|
5619
|
+
return p.query !== void 0 && (R.push("?"), R.push(p.query)), p.fragment !== void 0 && (R.push("#"), R.push(p.fragment)), R.join("");
|
|
5595
5620
|
}
|
|
5596
|
-
function xe(
|
|
5597
|
-
var m = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {},
|
|
5598
|
-
return
|
|
5621
|
+
function xe(p, c) {
|
|
5622
|
+
var m = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, R = arguments[3], E = {};
|
|
5623
|
+
return R || (p = de(le(p, m), m), c = de(le(c, m), m)), m = m || {}, !m.tolerant && c.scheme ? (E.scheme = c.scheme, E.userinfo = c.userinfo, E.host = c.host, E.port = c.port, E.path = me(c.path || ""), E.query = c.query) : (c.userinfo !== void 0 || c.host !== void 0 || c.port !== void 0 ? (E.userinfo = c.userinfo, E.host = c.host, E.port = c.port, E.path = me(c.path || ""), E.query = c.query) : (c.path ? (c.path.charAt(0) === "/" ? E.path = me(c.path) : ((p.userinfo !== void 0 || p.host !== void 0 || p.port !== void 0) && !p.path ? E.path = "/" + c.path : p.path ? E.path = p.path.slice(0, p.path.lastIndexOf("/") + 1) + c.path : E.path = c.path, E.path = me(E.path)), E.query = c.query) : (E.path = p.path, c.query !== void 0 ? E.query = c.query : E.query = p.query), E.userinfo = p.userinfo, E.host = p.host, E.port = p.port), E.scheme = p.scheme), E.fragment = c.fragment, E;
|
|
5599
5624
|
}
|
|
5600
|
-
function it(
|
|
5601
|
-
var
|
|
5602
|
-
return le(xe(de(
|
|
5625
|
+
function it(p, c, m) {
|
|
5626
|
+
var R = d({ scheme: "null" }, m);
|
|
5627
|
+
return le(xe(de(p, R), de(c, R), R, !0), R);
|
|
5603
5628
|
}
|
|
5604
|
-
function Oe(
|
|
5605
|
-
return typeof
|
|
5629
|
+
function Oe(p, c) {
|
|
5630
|
+
return typeof p == "string" ? p = le(de(p, c), c) : i(p) === "object" && (p = de(le(p, c), c)), p;
|
|
5606
5631
|
}
|
|
5607
|
-
function ot(
|
|
5608
|
-
return typeof
|
|
5632
|
+
function ot(p, c, m) {
|
|
5633
|
+
return typeof p == "string" ? p = le(de(p, m), m) : i(p) === "object" && (p = le(p, m)), typeof c == "string" ? c = le(de(c, m), m) : i(c) === "object" && (c = le(c, m)), p === c;
|
|
5609
5634
|
}
|
|
5610
|
-
function ut(
|
|
5611
|
-
return
|
|
5635
|
+
function ut(p, c) {
|
|
5636
|
+
return p && p.toString().replace(!c || !c.iri ? f.ESCAPE : $.ESCAPE, q);
|
|
5612
5637
|
}
|
|
5613
|
-
function pe(
|
|
5614
|
-
return
|
|
5638
|
+
function pe(p, c) {
|
|
5639
|
+
return p && p.toString().replace(!c || !c.iri ? f.PCT_ENCODED : $.PCT_ENCODED, W);
|
|
5615
5640
|
}
|
|
5616
5641
|
var Ne = {
|
|
5617
5642
|
scheme: "http",
|
|
@@ -5620,8 +5645,8 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5620
5645
|
return c.host || (c.error = c.error || "HTTP URIs must have a host."), c;
|
|
5621
5646
|
},
|
|
5622
5647
|
serialize: function(c, m) {
|
|
5623
|
-
var
|
|
5624
|
-
return (c.port === (
|
|
5648
|
+
var R = String(c.scheme).toLowerCase() === "https";
|
|
5649
|
+
return (c.port === (R ? 443 : 80) || c.port === "") && (c.port = void 0), c.path || (c.path = "/"), c;
|
|
5625
5650
|
}
|
|
5626
5651
|
}, It = {
|
|
5627
5652
|
scheme: "https",
|
|
@@ -5629,19 +5654,19 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5629
5654
|
parse: Ne.parse,
|
|
5630
5655
|
serialize: Ne.serialize
|
|
5631
5656
|
};
|
|
5632
|
-
function jt(
|
|
5633
|
-
return typeof
|
|
5657
|
+
function jt(p) {
|
|
5658
|
+
return typeof p.secure == "boolean" ? p.secure : String(p.scheme).toLowerCase() === "wss";
|
|
5634
5659
|
}
|
|
5635
5660
|
var at = {
|
|
5636
5661
|
scheme: "ws",
|
|
5637
5662
|
domainHost: !0,
|
|
5638
5663
|
parse: function(c, m) {
|
|
5639
|
-
var
|
|
5640
|
-
return
|
|
5664
|
+
var R = c;
|
|
5665
|
+
return R.secure = jt(R), R.resourceName = (R.path || "/") + (R.query ? "?" + R.query : ""), R.path = void 0, R.query = void 0, R;
|
|
5641
5666
|
},
|
|
5642
5667
|
serialize: function(c, m) {
|
|
5643
5668
|
if ((c.port === (jt(c) ? 443 : 80) || c.port === "") && (c.port = void 0), typeof c.secure == "boolean" && (c.scheme = c.secure ? "wss" : "ws", c.secure = void 0), c.resourceName) {
|
|
5644
|
-
var
|
|
5669
|
+
var R = c.resourceName.split("?"), E = O(R, 2), U = E[0], L = E[1];
|
|
5645
5670
|
c.path = U && U !== "/" ? U : void 0, c.query = L, c.resourceName = void 0;
|
|
5646
5671
|
}
|
|
5647
5672
|
return c.fragment = void 0, c;
|
|
@@ -5652,16 +5677,16 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5652
5677
|
parse: at.parse,
|
|
5653
5678
|
serialize: at.serialize
|
|
5654
5679
|
}, 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;
|
|
5655
|
-
function Ot(
|
|
5656
|
-
var c = W(
|
|
5657
|
-
return c.match(ur) ? c :
|
|
5680
|
+
function Ot(p) {
|
|
5681
|
+
var c = W(p);
|
|
5682
|
+
return c.match(ur) ? c : p;
|
|
5658
5683
|
}
|
|
5659
5684
|
var Mt = {
|
|
5660
5685
|
scheme: "mailto",
|
|
5661
5686
|
parse: function(c, m) {
|
|
5662
|
-
var
|
|
5663
|
-
if (
|
|
5664
|
-
for (var U = !1, L = {}, J =
|
|
5687
|
+
var R = c, E = R.to = R.path ? R.path.split(",") : [];
|
|
5688
|
+
if (R.path = void 0, R.query) {
|
|
5689
|
+
for (var U = !1, L = {}, J = R.query.split("&"), Y = 0, se = J.length; Y < se; ++Y) {
|
|
5665
5690
|
var B = J[Y].split("=");
|
|
5666
5691
|
switch (B[0]) {
|
|
5667
5692
|
case "to":
|
|
@@ -5669,67 +5694,67 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5669
5694
|
E.push(Z[ie]);
|
|
5670
5695
|
break;
|
|
5671
5696
|
case "subject":
|
|
5672
|
-
|
|
5697
|
+
R.subject = pe(B[1], m);
|
|
5673
5698
|
break;
|
|
5674
5699
|
case "body":
|
|
5675
|
-
|
|
5700
|
+
R.body = pe(B[1], m);
|
|
5676
5701
|
break;
|
|
5677
5702
|
default:
|
|
5678
5703
|
U = !0, L[pe(B[0], m)] = pe(B[1], m);
|
|
5679
5704
|
break;
|
|
5680
5705
|
}
|
|
5681
5706
|
}
|
|
5682
|
-
U && (
|
|
5707
|
+
U && (R.headers = L);
|
|
5683
5708
|
}
|
|
5684
|
-
|
|
5709
|
+
R.query = void 0;
|
|
5685
5710
|
for (var X = 0, ae = E.length; X < ae; ++X) {
|
|
5686
5711
|
var ee = E[X].split("@");
|
|
5687
5712
|
if (ee[0] = pe(ee[0]), m.unicodeSupport)
|
|
5688
5713
|
ee[1] = pe(ee[1], m).toLowerCase();
|
|
5689
5714
|
else
|
|
5690
5715
|
try {
|
|
5691
|
-
ee[1] =
|
|
5716
|
+
ee[1] = N.toASCII(pe(ee[1], m).toLowerCase());
|
|
5692
5717
|
} catch (Se) {
|
|
5693
|
-
|
|
5718
|
+
R.error = R.error || "Email address's domain name can not be converted to ASCII via punycode: " + Se;
|
|
5694
5719
|
}
|
|
5695
5720
|
E[X] = ee.join("@");
|
|
5696
5721
|
}
|
|
5697
|
-
return
|
|
5722
|
+
return R;
|
|
5698
5723
|
},
|
|
5699
5724
|
serialize: function(c, m) {
|
|
5700
|
-
var
|
|
5725
|
+
var R = c, E = l(c.to);
|
|
5701
5726
|
if (E) {
|
|
5702
5727
|
for (var U = 0, L = E.length; U < L; ++U) {
|
|
5703
5728
|
var J = String(E[U]), Y = J.lastIndexOf("@"), se = J.slice(0, Y).replace(We, Ot).replace(We, o).replace(pr, q), B = J.slice(Y + 1);
|
|
5704
5729
|
try {
|
|
5705
|
-
B = m.iri ?
|
|
5730
|
+
B = m.iri ? N.toUnicode(B) : N.toASCII(pe(B, m).toLowerCase());
|
|
5706
5731
|
} catch (X) {
|
|
5707
|
-
|
|
5732
|
+
R.error = R.error || "Email address's domain name can not be converted to " + (m.iri ? "Unicode" : "ASCII") + " via punycode: " + X;
|
|
5708
5733
|
}
|
|
5709
5734
|
E[U] = se + "@" + B;
|
|
5710
5735
|
}
|
|
5711
|
-
|
|
5736
|
+
R.path = E.join(",");
|
|
5712
5737
|
}
|
|
5713
5738
|
var Z = c.headers = c.headers || {};
|
|
5714
5739
|
c.subject && (Z.subject = c.subject), c.body && (Z.body = c.body);
|
|
5715
5740
|
var ie = [];
|
|
5716
5741
|
for (var z in Z)
|
|
5717
5742
|
Z[z] !== ir[z] && ie.push(z.replace(We, Ot).replace(We, o).replace(Ft, q) + "=" + Z[z].replace(We, Ot).replace(We, o).replace(fr, q));
|
|
5718
|
-
return ie.length && (
|
|
5743
|
+
return ie.length && (R.query = ie.join("&")), R;
|
|
5719
5744
|
}
|
|
5720
5745
|
}, hr = /^([^\:]+)\:(.*)/, qt = {
|
|
5721
5746
|
scheme: "urn",
|
|
5722
5747
|
parse: function(c, m) {
|
|
5723
|
-
var
|
|
5724
|
-
if (
|
|
5725
|
-
var U = m.scheme || E.scheme || "urn", L =
|
|
5748
|
+
var R = c.path && c.path.match(hr), E = c;
|
|
5749
|
+
if (R) {
|
|
5750
|
+
var U = m.scheme || E.scheme || "urn", L = R[1].toLowerCase(), J = R[2], Y = U + ":" + (m.nid || L), se = M[Y];
|
|
5726
5751
|
E.nid = L, E.nss = J, E.path = void 0, se && (E = se.parse(E, m));
|
|
5727
5752
|
} else
|
|
5728
5753
|
E.error = E.error || "URN can not be parsed.";
|
|
5729
5754
|
return E;
|
|
5730
5755
|
},
|
|
5731
5756
|
serialize: function(c, m) {
|
|
5732
|
-
var
|
|
5757
|
+
var R = m.scheme || c.scheme || "urn", E = c.nid, U = R + ":" + (m.nid || E), L = M[U];
|
|
5733
5758
|
L && (c = L.serialize(c, m));
|
|
5734
5759
|
var J = c, Y = c.nss;
|
|
5735
5760
|
return J.path = (E || m.nid) + ":" + Y, J;
|
|
@@ -5737,12 +5762,12 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5737
5762
|
}, mr = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, Ut = {
|
|
5738
5763
|
scheme: "urn:uuid",
|
|
5739
5764
|
parse: function(c, m) {
|
|
5740
|
-
var
|
|
5741
|
-
return
|
|
5765
|
+
var R = c;
|
|
5766
|
+
return R.uuid = R.nss, R.nss = void 0, !m.tolerant && (!R.uuid || !R.uuid.match(mr)) && (R.error = R.error || "UUID is not valid."), R;
|
|
5742
5767
|
},
|
|
5743
5768
|
serialize: function(c, m) {
|
|
5744
|
-
var
|
|
5745
|
-
return
|
|
5769
|
+
var R = c;
|
|
5770
|
+
return R.nss = (c.uuid || "").toLowerCase(), R;
|
|
5746
5771
|
}
|
|
5747
5772
|
};
|
|
5748
5773
|
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[Ut.scheme] = Ut, r.SCHEMES = M, r.pctEncChar = q, r.pctDecChars = W, r.parse = de, r.removeDotSegments = me, r.serialize = le, r.resolveComponents = xe, r.resolve = it, r.normalize = Oe, r.equal = ot, r.escapeComponent = ut, r.unescapeComponent = pe, Object.defineProperty(r, "__esModule", { value: !0 });
|
|
@@ -5773,9 +5798,9 @@ uri$1.default = uri;
|
|
|
5773
5798
|
} }), Object.defineProperty(e, "CodeGen", { enumerable: !0, get: function() {
|
|
5774
5799
|
return r.CodeGen;
|
|
5775
5800
|
} });
|
|
5776
|
-
const n = validation_error, s = ref_error, i = rules, o = compile, l = codegen, d = resolve$1, u = dataType,
|
|
5777
|
-
|
|
5778
|
-
const
|
|
5801
|
+
const n = validation_error, s = ref_error, i = rules, o = compile, l = codegen, d = resolve$1, u = dataType, f = util, $ = require$$9, O = uri$1, C = (F, v) => new RegExp(F, v);
|
|
5802
|
+
C.code = "new RegExp";
|
|
5803
|
+
const S = ["removeAdditional", "useDefaults", "coerceTypes"], T = /* @__PURE__ */ new Set([
|
|
5779
5804
|
"validate",
|
|
5780
5805
|
"serialize",
|
|
5781
5806
|
"parse",
|
|
@@ -5811,10 +5836,10 @@ uri$1.default = uri;
|
|
|
5811
5836
|
unicode: '"minLength"/"maxLength" account for unicode characters by default.'
|
|
5812
5837
|
}, g = 200;
|
|
5813
5838
|
function P(F) {
|
|
5814
|
-
var v, j, b, a, h,
|
|
5815
|
-
const Oe = F.strict, ot = (v = F.code) === null || v === void 0 ? void 0 : v.optimize, ut = ot === !0 || ot === void 0 ? 1 : ot || 0, pe = (b = (j = F.code) === null || j === void 0 ? void 0 : j.regExp) !== null && b !== void 0 ? b :
|
|
5839
|
+
var v, j, b, a, h, N, M, q, W, G, ne, he, Le, tt, rt, de, nt, He, Ve, ze, st, me, le, xe, it;
|
|
5840
|
+
const Oe = F.strict, ot = (v = F.code) === null || v === void 0 ? void 0 : v.optimize, ut = ot === !0 || ot === void 0 ? 1 : ot || 0, pe = (b = (j = F.code) === null || j === void 0 ? void 0 : j.regExp) !== null && b !== void 0 ? b : C, Ne = (a = F.uriResolver) !== null && a !== void 0 ? a : O.default;
|
|
5816
5841
|
return {
|
|
5817
|
-
strictSchema: (
|
|
5842
|
+
strictSchema: (N = (h = F.strictSchema) !== null && h !== void 0 ? h : Oe) !== null && N !== void 0 ? N : !0,
|
|
5818
5843
|
strictNumbers: (q = (M = F.strictNumbers) !== null && M !== void 0 ? M : Oe) !== null && q !== void 0 ? q : !0,
|
|
5819
5844
|
strictTypes: (G = (W = F.strictTypes) !== null && W !== void 0 ? W : Oe) !== null && G !== void 0 ? G : "log",
|
|
5820
5845
|
strictTuples: (he = (ne = F.strictTuples) !== null && ne !== void 0 ? ne : Oe) !== null && he !== void 0 ? he : "log",
|
|
@@ -5876,18 +5901,18 @@ uri$1.default = uri;
|
|
|
5876
5901
|
async function a(G, ne) {
|
|
5877
5902
|
await h.call(this, G.$schema);
|
|
5878
5903
|
const he = this._addSchema(G, ne);
|
|
5879
|
-
return he.validate ||
|
|
5904
|
+
return he.validate || N.call(this, he);
|
|
5880
5905
|
}
|
|
5881
5906
|
async function h(G) {
|
|
5882
5907
|
G && !this.getSchema(G) && await a.call(this, { $ref: G }, !0);
|
|
5883
5908
|
}
|
|
5884
|
-
async function
|
|
5909
|
+
async function N(G) {
|
|
5885
5910
|
try {
|
|
5886
5911
|
return this._compileSchemaEnv(G);
|
|
5887
5912
|
} catch (ne) {
|
|
5888
5913
|
if (!(ne instanceof s.default))
|
|
5889
5914
|
throw ne;
|
|
5890
|
-
return M.call(this, ne), await q.call(this, ne.missingSchema),
|
|
5915
|
+
return M.call(this, ne), await q.call(this, ne.missingSchema), N.call(this, G);
|
|
5891
5916
|
}
|
|
5892
5917
|
}
|
|
5893
5918
|
function M({ missingSchema: G, missingRef: ne }) {
|
|
@@ -5912,15 +5937,15 @@ uri$1.default = uri;
|
|
|
5912
5937
|
// Adds schema to the instance
|
|
5913
5938
|
addSchema(v, j, b, a = this.opts.validateSchema) {
|
|
5914
5939
|
if (Array.isArray(v)) {
|
|
5915
|
-
for (const
|
|
5916
|
-
this.addSchema(
|
|
5940
|
+
for (const N of v)
|
|
5941
|
+
this.addSchema(N, void 0, b, a);
|
|
5917
5942
|
return this;
|
|
5918
5943
|
}
|
|
5919
5944
|
let h;
|
|
5920
5945
|
if (typeof v == "object") {
|
|
5921
|
-
const { schemaId:
|
|
5922
|
-
if (h = v[
|
|
5923
|
-
throw new Error(`schema ${
|
|
5946
|
+
const { schemaId: N } = this.opts;
|
|
5947
|
+
if (h = v[N], h !== void 0 && typeof h != "string")
|
|
5948
|
+
throw new Error(`schema ${N} must be string`);
|
|
5924
5949
|
}
|
|
5925
5950
|
return j = (0, d.normalizeId)(j || h), this._checkUnique(j), this.schemas[j] = this._addSchema(v, b, j, a, !0), this;
|
|
5926
5951
|
}
|
|
@@ -6002,14 +6027,14 @@ uri$1.default = uri;
|
|
|
6002
6027
|
} else
|
|
6003
6028
|
throw new Error("invalid addKeywords parameters");
|
|
6004
6029
|
if (oe.call(this, b, j), !j)
|
|
6005
|
-
return (0,
|
|
6030
|
+
return (0, f.eachItem)(b, (h) => ke.call(this, h)), this;
|
|
6006
6031
|
qe.call(this, j);
|
|
6007
6032
|
const a = {
|
|
6008
6033
|
...j,
|
|
6009
6034
|
type: (0, u.getJSONTypes)(j.type),
|
|
6010
6035
|
schemaType: (0, u.getJSONTypes)(j.schemaType)
|
|
6011
6036
|
};
|
|
6012
|
-
return (0,
|
|
6037
|
+
return (0, f.eachItem)(b, a.type.length === 0 ? (h) => ke.call(this, h, a) : (h) => a.type.forEach((N) => ke.call(this, h, a, N))), this;
|
|
6013
6038
|
}
|
|
6014
6039
|
getKeyword(v) {
|
|
6015
6040
|
const j = this.RULES.all[v];
|
|
@@ -6037,15 +6062,15 @@ uri$1.default = uri;
|
|
|
6037
6062
|
v = JSON.parse(JSON.stringify(v));
|
|
6038
6063
|
for (const a of j) {
|
|
6039
6064
|
const h = a.split("/").slice(1);
|
|
6040
|
-
let
|
|
6065
|
+
let N = v;
|
|
6041
6066
|
for (const M of h)
|
|
6042
|
-
|
|
6067
|
+
N = N[M];
|
|
6043
6068
|
for (const M in b) {
|
|
6044
6069
|
const q = b[M];
|
|
6045
6070
|
if (typeof q != "object")
|
|
6046
6071
|
continue;
|
|
6047
|
-
const { $data: W } = q.definition, G =
|
|
6048
|
-
W && G && (
|
|
6072
|
+
const { $data: W } = q.definition, G = N[M];
|
|
6073
|
+
W && G && (N[M] = Ue(G));
|
|
6049
6074
|
}
|
|
6050
6075
|
}
|
|
6051
6076
|
return v;
|
|
@@ -6057,10 +6082,10 @@ uri$1.default = uri;
|
|
|
6057
6082
|
}
|
|
6058
6083
|
}
|
|
6059
6084
|
_addSchema(v, j, b, a = this.opts.validateSchema, h = this.opts.addUsedSchema) {
|
|
6060
|
-
let
|
|
6085
|
+
let N;
|
|
6061
6086
|
const { schemaId: M } = this.opts;
|
|
6062
6087
|
if (typeof v == "object")
|
|
6063
|
-
|
|
6088
|
+
N = v[M];
|
|
6064
6089
|
else {
|
|
6065
6090
|
if (this.opts.jtd)
|
|
6066
6091
|
throw new Error("schema must be object");
|
|
@@ -6070,7 +6095,7 @@ uri$1.default = uri;
|
|
|
6070
6095
|
let q = this._cache.get(v);
|
|
6071
6096
|
if (q !== void 0)
|
|
6072
6097
|
return q;
|
|
6073
|
-
b = (0, d.normalizeId)(
|
|
6098
|
+
b = (0, d.normalizeId)(N || b);
|
|
6074
6099
|
const W = d.getSchemaRefs.call(this, v, b);
|
|
6075
6100
|
return q = new o.SchemaEnv({ schema: v, schemaId: M, meta: j, baseId: b, localRefs: W }), this._cache.set(q.schema, q), h && !b.startsWith("#") && (b && this._checkUnique(b), this.refs[b] = q), a && this.validateSchema(v, !0), q;
|
|
6076
6101
|
}
|
|
@@ -6131,7 +6156,7 @@ uri$1.default = uri;
|
|
|
6131
6156
|
}
|
|
6132
6157
|
function x() {
|
|
6133
6158
|
const F = { ...this.opts };
|
|
6134
|
-
for (const v of
|
|
6159
|
+
for (const v of S)
|
|
6135
6160
|
delete F[v];
|
|
6136
6161
|
return F;
|
|
6137
6162
|
}
|
|
@@ -6151,7 +6176,7 @@ uri$1.default = uri;
|
|
|
6151
6176
|
const ue = /^[a-z_$][a-z0-9_$:-]*$/i;
|
|
6152
6177
|
function oe(F, v) {
|
|
6153
6178
|
const { RULES: j } = this;
|
|
6154
|
-
if ((0,
|
|
6179
|
+
if ((0, f.eachItem)(F, (b) => {
|
|
6155
6180
|
if (j.keywords[b])
|
|
6156
6181
|
throw new Error(`Keyword ${b} is already defined`);
|
|
6157
6182
|
if (!ue.test(b))
|
|
@@ -6165,8 +6190,8 @@ uri$1.default = uri;
|
|
|
6165
6190
|
if (j && a)
|
|
6166
6191
|
throw new Error('keyword with "post" flag cannot have "type"');
|
|
6167
6192
|
const { RULES: h } = this;
|
|
6168
|
-
let
|
|
6169
|
-
if (
|
|
6193
|
+
let N = a ? h.post : h.rules.find(({ type: q }) => q === j);
|
|
6194
|
+
if (N || (N = { type: j, rules: [] }, h.rules.push(N)), h.keywords[F] = !0, !v)
|
|
6170
6195
|
return;
|
|
6171
6196
|
const M = {
|
|
6172
6197
|
keyword: F,
|
|
@@ -6176,7 +6201,7 @@ uri$1.default = uri;
|
|
|
6176
6201
|
schemaType: (0, u.getJSONTypes)(v.schemaType)
|
|
6177
6202
|
}
|
|
6178
6203
|
};
|
|
6179
|
-
v.before ? Ce.call(this,
|
|
6204
|
+
v.before ? Ce.call(this, N, M, v.before) : N.rules.push(M), h.all[F] = M, (b = v.implements) === null || b === void 0 || b.forEach((q) => this.addKeyword(q));
|
|
6180
6205
|
}
|
|
6181
6206
|
function Ce(F, v, j) {
|
|
6182
6207
|
const b = F.rules.findIndex((a) => a.keyword === j);
|
|
@@ -6212,25 +6237,25 @@ const ref_error_1 = ref_error, code_1$8 = code, codegen_1$l = codegen, names_1$1
|
|
|
6212
6237
|
const { gen: t, schema: r, it: n } = e, { baseId: s, schemaEnv: i, validateName: o, opts: l, self: d } = n, { root: u } = i;
|
|
6213
6238
|
if ((r === "#" || r === "#/") && s === u.baseId)
|
|
6214
6239
|
return $();
|
|
6215
|
-
const
|
|
6216
|
-
if (
|
|
6240
|
+
const f = compile_1$1.resolveRef.call(d, u, s, r);
|
|
6241
|
+
if (f === void 0)
|
|
6217
6242
|
throw new ref_error_1.default(n.opts.uriResolver, s, r);
|
|
6218
|
-
if (
|
|
6219
|
-
return O(
|
|
6220
|
-
return
|
|
6243
|
+
if (f instanceof compile_1$1.SchemaEnv)
|
|
6244
|
+
return O(f);
|
|
6245
|
+
return C(f);
|
|
6221
6246
|
function $() {
|
|
6222
6247
|
if (i === u)
|
|
6223
6248
|
return callRef(e, o, i, i.$async);
|
|
6224
|
-
const
|
|
6225
|
-
return callRef(e, (0, codegen_1$l._)`${
|
|
6249
|
+
const S = t.scopeValue("root", { ref: u });
|
|
6250
|
+
return callRef(e, (0, codegen_1$l._)`${S}.validate`, u, u.$async);
|
|
6226
6251
|
}
|
|
6227
|
-
function O(
|
|
6228
|
-
const T = getValidate(e,
|
|
6229
|
-
callRef(e, T,
|
|
6252
|
+
function O(S) {
|
|
6253
|
+
const T = getValidate(e, S);
|
|
6254
|
+
callRef(e, T, S, S.$async);
|
|
6230
6255
|
}
|
|
6231
|
-
function
|
|
6232
|
-
const T = t.scopeValue("schema", l.code.source === !0 ? { ref:
|
|
6233
|
-
schema:
|
|
6256
|
+
function C(S) {
|
|
6257
|
+
const T = t.scopeValue("schema", l.code.source === !0 ? { ref: S, code: (0, codegen_1$l.stringify)(S) } : { ref: S }), y = t.name("valid"), _ = e.subschema({
|
|
6258
|
+
schema: S,
|
|
6234
6259
|
dataTypes: [],
|
|
6235
6260
|
schemaPath: codegen_1$l.nil,
|
|
6236
6261
|
topSchemaRef: T,
|
|
@@ -6247,25 +6272,25 @@ function getValidate(e, t) {
|
|
|
6247
6272
|
ref.getValidate = getValidate;
|
|
6248
6273
|
function callRef(e, t, r, n) {
|
|
6249
6274
|
const { gen: s, it: i } = e, { allErrors: o, schemaEnv: l, opts: d } = i, u = d.passContext ? names_1$1.default.this : codegen_1$l.nil;
|
|
6250
|
-
n ?
|
|
6251
|
-
function
|
|
6275
|
+
n ? f() : $();
|
|
6276
|
+
function f() {
|
|
6252
6277
|
if (!l.$async)
|
|
6253
6278
|
throw new Error("async schema referenced by sync schema");
|
|
6254
|
-
const
|
|
6279
|
+
const S = s.let("valid");
|
|
6255
6280
|
s.try(() => {
|
|
6256
|
-
s.code((0, codegen_1$l._)`await ${(0, code_1$8.callValidateCode)(e, t, u)}`),
|
|
6281
|
+
s.code((0, codegen_1$l._)`await ${(0, code_1$8.callValidateCode)(e, t, u)}`), C(t), o || s.assign(S, !0);
|
|
6257
6282
|
}, (T) => {
|
|
6258
|
-
s.if((0, codegen_1$l._)`!(${T} instanceof ${i.ValidationError})`, () => s.throw(T)), O(T), o || s.assign(
|
|
6259
|
-
}), e.ok(
|
|
6283
|
+
s.if((0, codegen_1$l._)`!(${T} instanceof ${i.ValidationError})`, () => s.throw(T)), O(T), o || s.assign(S, !1);
|
|
6284
|
+
}), e.ok(S);
|
|
6260
6285
|
}
|
|
6261
6286
|
function $() {
|
|
6262
|
-
e.result((0, code_1$8.callValidateCode)(e, t, u), () =>
|
|
6287
|
+
e.result((0, code_1$8.callValidateCode)(e, t, u), () => C(t), () => O(t));
|
|
6263
6288
|
}
|
|
6264
|
-
function O(
|
|
6265
|
-
const T = (0, codegen_1$l._)`${
|
|
6289
|
+
function O(S) {
|
|
6290
|
+
const T = (0, codegen_1$l._)`${S}.errors`;
|
|
6266
6291
|
s.assign(names_1$1.default.vErrors, (0, codegen_1$l._)`${names_1$1.default.vErrors} === null ? ${T} : ${names_1$1.default.vErrors}.concat(${T})`), s.assign(names_1$1.default.errors, (0, codegen_1$l._)`${names_1$1.default.vErrors}.length`);
|
|
6267
6292
|
}
|
|
6268
|
-
function
|
|
6293
|
+
function C(S) {
|
|
6269
6294
|
var T;
|
|
6270
6295
|
if (!i.opts.unevaluated)
|
|
6271
6296
|
return;
|
|
@@ -6274,14 +6299,14 @@ function callRef(e, t, r, n) {
|
|
|
6274
6299
|
if (y && !y.dynamicProps)
|
|
6275
6300
|
y.props !== void 0 && (i.props = util_1$j.mergeEvaluated.props(s, y.props, i.props));
|
|
6276
6301
|
else {
|
|
6277
|
-
const _ = s.var("props", (0, codegen_1$l._)`${
|
|
6302
|
+
const _ = s.var("props", (0, codegen_1$l._)`${S}.evaluated.props`);
|
|
6278
6303
|
i.props = util_1$j.mergeEvaluated.props(s, _, i.props, codegen_1$l.Name);
|
|
6279
6304
|
}
|
|
6280
6305
|
if (i.items !== !0)
|
|
6281
6306
|
if (y && !y.dynamicItems)
|
|
6282
6307
|
y.items !== void 0 && (i.items = util_1$j.mergeEvaluated.items(s, y.items, i.items));
|
|
6283
6308
|
else {
|
|
6284
|
-
const _ = s.var("items", (0, codegen_1$l._)`${
|
|
6309
|
+
const _ = s.var("items", (0, codegen_1$l._)`${S}.evaluated.items`);
|
|
6285
6310
|
i.items = util_1$j.mergeEvaluated.items(s, _, i.items, codegen_1$l.Name);
|
|
6286
6311
|
}
|
|
6287
6312
|
}
|
|
@@ -6422,10 +6447,10 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6422
6447
|
if (!i && r.length === 0)
|
|
6423
6448
|
return;
|
|
6424
6449
|
const d = r.length >= l.loopRequired;
|
|
6425
|
-
if (o.allErrors ? u() :
|
|
6426
|
-
const
|
|
6450
|
+
if (o.allErrors ? u() : f(), l.strictRequired) {
|
|
6451
|
+
const C = e.parentSchema.properties, { definedProperties: S } = e.it;
|
|
6427
6452
|
for (const T of r)
|
|
6428
|
-
if ((
|
|
6453
|
+
if ((C == null ? void 0 : C[T]) === void 0 && !S.has(T)) {
|
|
6429
6454
|
const y = o.schemaEnv.baseId + o.errSchemaPath, _ = `required property "${T}" is not defined at "${y}" (strictRequired)`;
|
|
6430
6455
|
(0, util_1$h.checkStrictMode)(o, _, o.opts.strictRequired);
|
|
6431
6456
|
}
|
|
@@ -6434,25 +6459,25 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6434
6459
|
if (d || i)
|
|
6435
6460
|
e.block$data(codegen_1$f.nil, $);
|
|
6436
6461
|
else
|
|
6437
|
-
for (const
|
|
6438
|
-
(0, code_1$6.checkReportMissingProp)(e,
|
|
6462
|
+
for (const C of r)
|
|
6463
|
+
(0, code_1$6.checkReportMissingProp)(e, C);
|
|
6439
6464
|
}
|
|
6440
|
-
function
|
|
6441
|
-
const
|
|
6465
|
+
function f() {
|
|
6466
|
+
const C = t.let("missing");
|
|
6442
6467
|
if (d || i) {
|
|
6443
|
-
const
|
|
6444
|
-
e.block$data(
|
|
6468
|
+
const S = t.let("valid", !0);
|
|
6469
|
+
e.block$data(S, () => O(C, S)), e.ok(S);
|
|
6445
6470
|
} else
|
|
6446
|
-
t.if((0, code_1$6.checkMissingProp)(e, r,
|
|
6471
|
+
t.if((0, code_1$6.checkMissingProp)(e, r, C)), (0, code_1$6.reportMissingProp)(e, C), t.else();
|
|
6447
6472
|
}
|
|
6448
6473
|
function $() {
|
|
6449
|
-
t.forOf("prop", n, (
|
|
6450
|
-
e.setParams({ missingProperty:
|
|
6474
|
+
t.forOf("prop", n, (C) => {
|
|
6475
|
+
e.setParams({ missingProperty: C }), t.if((0, code_1$6.noPropertyInData)(t, s, C, l.ownProperties), () => e.error());
|
|
6451
6476
|
});
|
|
6452
6477
|
}
|
|
6453
|
-
function O(
|
|
6454
|
-
e.setParams({ missingProperty:
|
|
6455
|
-
t.assign(
|
|
6478
|
+
function O(C, S) {
|
|
6479
|
+
e.setParams({ missingProperty: C }), t.forOf(C, n, () => {
|
|
6480
|
+
t.assign(S, (0, code_1$6.propertyInData)(t, s, C, l.ownProperties)), t.if((0, codegen_1$f.not)(S), () => {
|
|
6456
6481
|
e.error(), t.break();
|
|
6457
6482
|
});
|
|
6458
6483
|
}, codegen_1$f.nil);
|
|
@@ -6500,25 +6525,25 @@ const dataType_1 = dataType, codegen_1$d = codegen, util_1$g = util, equal_1$2 =
|
|
|
6500
6525
|
if (!n && !s)
|
|
6501
6526
|
return;
|
|
6502
6527
|
const d = t.let("valid"), u = i.items ? (0, dataType_1.getSchemaTypes)(i.items) : [];
|
|
6503
|
-
e.block$data(d,
|
|
6504
|
-
function
|
|
6505
|
-
const
|
|
6506
|
-
e.setParams({ i:
|
|
6528
|
+
e.block$data(d, f, (0, codegen_1$d._)`${o} === false`), e.ok(d);
|
|
6529
|
+
function f() {
|
|
6530
|
+
const S = t.let("i", (0, codegen_1$d._)`${r}.length`), T = t.let("j");
|
|
6531
|
+
e.setParams({ i: S, j: T }), t.assign(d, !0), t.if((0, codegen_1$d._)`${S} > 1`, () => ($() ? O : C)(S, T));
|
|
6507
6532
|
}
|
|
6508
6533
|
function $() {
|
|
6509
|
-
return u.length > 0 && !u.some((
|
|
6534
|
+
return u.length > 0 && !u.some((S) => S === "object" || S === "array");
|
|
6510
6535
|
}
|
|
6511
|
-
function O(
|
|
6536
|
+
function O(S, T) {
|
|
6512
6537
|
const y = t.name("item"), _ = (0, dataType_1.checkDataTypes)(u, y, l.opts.strictNumbers, dataType_1.DataType.Wrong), g = t.const("indices", (0, codegen_1$d._)`{}`);
|
|
6513
|
-
t.for((0, codegen_1$d._)`;${
|
|
6514
|
-
t.let(y, (0, codegen_1$d._)`${r}[${
|
|
6538
|
+
t.for((0, codegen_1$d._)`;${S}--;`, () => {
|
|
6539
|
+
t.let(y, (0, codegen_1$d._)`${r}[${S}]`), t.if(_, (0, codegen_1$d._)`continue`), u.length > 1 && t.if((0, codegen_1$d._)`typeof ${y} == "string"`, (0, codegen_1$d._)`${y} += "_"`), t.if((0, codegen_1$d._)`typeof ${g}[${y}] == "number"`, () => {
|
|
6515
6540
|
t.assign(T, (0, codegen_1$d._)`${g}[${y}]`), e.error(), t.assign(d, !1).break();
|
|
6516
|
-
}).code((0, codegen_1$d._)`${g}[${y}] = ${
|
|
6541
|
+
}).code((0, codegen_1$d._)`${g}[${y}] = ${S}`);
|
|
6517
6542
|
});
|
|
6518
6543
|
}
|
|
6519
|
-
function
|
|
6544
|
+
function C(S, T) {
|
|
6520
6545
|
const y = (0, util_1$g.useFunc)(t, equal_1$2.default), _ = t.name("outer");
|
|
6521
|
-
t.label(_).for((0, codegen_1$d._)`;${
|
|
6546
|
+
t.label(_).for((0, codegen_1$d._)`;${S}--;`, () => t.for((0, codegen_1$d._)`${T} = ${S}; ${T}--;`, () => t.if((0, codegen_1$d._)`${y}(${r}[${S}], ${r}[${T}])`, () => {
|
|
6522
6547
|
e.error(), t.assign(d, !1).break(_);
|
|
6523
6548
|
})));
|
|
6524
6549
|
}
|
|
@@ -6557,22 +6582,22 @@ const codegen_1$b = codegen, util_1$e = util, equal_1 = equal$1, error$9 = {
|
|
|
6557
6582
|
const l = s.length >= o.opts.loopEnum;
|
|
6558
6583
|
let d;
|
|
6559
6584
|
const u = () => d ?? (d = (0, util_1$e.useFunc)(t, equal_1.default));
|
|
6560
|
-
let
|
|
6585
|
+
let f;
|
|
6561
6586
|
if (l || n)
|
|
6562
|
-
|
|
6587
|
+
f = t.let("valid"), e.block$data(f, $);
|
|
6563
6588
|
else {
|
|
6564
6589
|
if (!Array.isArray(s))
|
|
6565
6590
|
throw new Error("ajv implementation error");
|
|
6566
|
-
const
|
|
6567
|
-
|
|
6591
|
+
const C = t.const("vSchema", i);
|
|
6592
|
+
f = (0, codegen_1$b.or)(...s.map((S, T) => O(C, T)));
|
|
6568
6593
|
}
|
|
6569
|
-
e.pass(
|
|
6594
|
+
e.pass(f);
|
|
6570
6595
|
function $() {
|
|
6571
|
-
t.assign(
|
|
6596
|
+
t.assign(f, !1), t.forOf("v", i, (C) => t.if((0, codegen_1$b._)`${u()}(${r}, ${C})`, () => t.assign(f, !0).break()));
|
|
6572
6597
|
}
|
|
6573
|
-
function O(
|
|
6574
|
-
const T = s[
|
|
6575
|
-
return typeof T == "object" && T !== null ? (0, codegen_1$b._)`${u()}(${r}, ${
|
|
6598
|
+
function O(C, S) {
|
|
6599
|
+
const T = s[S];
|
|
6600
|
+
return typeof T == "object" && T !== null ? (0, codegen_1$b._)`${u()}(${r}, ${C}[${S}])` : (0, codegen_1$b._)`${r} === ${T}`;
|
|
6576
6601
|
}
|
|
6577
6602
|
}
|
|
6578
6603
|
};
|
|
@@ -6630,8 +6655,8 @@ function validateAdditionalItems(e, t) {
|
|
|
6630
6655
|
r.if((0, codegen_1$a.not)(u), () => d(u)), e.ok(u);
|
|
6631
6656
|
}
|
|
6632
6657
|
function d(u) {
|
|
6633
|
-
r.forRange("i", t.length, l, (
|
|
6634
|
-
e.subschema({ keyword: i, dataProp:
|
|
6658
|
+
r.forRange("i", t.length, l, (f) => {
|
|
6659
|
+
e.subschema({ keyword: i, dataProp: f, dataPropType: util_1$d.Type.Num }, u), o.allErrors || r.if((0, codegen_1$a.not)(u), () => r.break());
|
|
6635
6660
|
});
|
|
6636
6661
|
}
|
|
6637
6662
|
}
|
|
@@ -6654,7 +6679,7 @@ const codegen_1$9 = codegen, util_1$c = util, code_1$5 = code, def$f = {
|
|
|
6654
6679
|
};
|
|
6655
6680
|
function validateTuple(e, t, r = e.schema) {
|
|
6656
6681
|
const { gen: n, parentSchema: s, data: i, keyword: o, it: l } = e;
|
|
6657
|
-
|
|
6682
|
+
f(s), l.opts.unevaluated && r.length && l.items !== !0 && (l.items = util_1$c.mergeEvaluated.items(n, r.length, l.items));
|
|
6658
6683
|
const d = n.name("valid"), u = n.const("len", (0, codegen_1$9._)`${i}.length`);
|
|
6659
6684
|
r.forEach(($, O) => {
|
|
6660
6685
|
(0, util_1$c.alwaysValidSchema)(l, $) || (n.if((0, codegen_1$9._)`${u} > ${O}`, () => e.subschema({
|
|
@@ -6663,10 +6688,10 @@ function validateTuple(e, t, r = e.schema) {
|
|
|
6663
6688
|
dataProp: O
|
|
6664
6689
|
}, d)), e.ok(d));
|
|
6665
6690
|
});
|
|
6666
|
-
function
|
|
6667
|
-
const { opts: O, errSchemaPath:
|
|
6691
|
+
function f($) {
|
|
6692
|
+
const { opts: O, errSchemaPath: C } = l, S = r.length, T = S === $.minItems && (S === $.maxItems || $[t] === !1);
|
|
6668
6693
|
if (O.strictTuples && !T) {
|
|
6669
|
-
const y = `"${o}" is ${
|
|
6694
|
+
const y = `"${o}" is ${S}-tuple, but minItems or maxItems/${t} are not specified or different at path "${C}"`;
|
|
6670
6695
|
(0, util_1$c.checkStrictMode)(l, y, O.strictTuples);
|
|
6671
6696
|
}
|
|
6672
6697
|
}
|
|
@@ -6716,7 +6741,7 @@ const codegen_1$7 = codegen, util_1$a = util, error$6 = {
|
|
|
6716
6741
|
let o, l;
|
|
6717
6742
|
const { minContains: d, maxContains: u } = n;
|
|
6718
6743
|
i.opts.next ? (o = d === void 0 ? 1 : d, l = u) : o = 1;
|
|
6719
|
-
const
|
|
6744
|
+
const f = t.const("len", (0, codegen_1$7._)`${s}.length`);
|
|
6720
6745
|
if (e.setParams({ min: o, max: l }), l === void 0 && o === 0) {
|
|
6721
6746
|
(0, util_1$a.checkStrictMode)(i, '"minContains" == 0 without "maxContains": "contains" keyword ignored');
|
|
6722
6747
|
return;
|
|
@@ -6726,19 +6751,19 @@ const codegen_1$7 = codegen, util_1$a = util, error$6 = {
|
|
|
6726
6751
|
return;
|
|
6727
6752
|
}
|
|
6728
6753
|
if ((0, util_1$a.alwaysValidSchema)(i, r)) {
|
|
6729
|
-
let T = (0, codegen_1$7._)`${
|
|
6730
|
-
l !== void 0 && (T = (0, codegen_1$7._)`${T} && ${
|
|
6754
|
+
let T = (0, codegen_1$7._)`${f} >= ${o}`;
|
|
6755
|
+
l !== void 0 && (T = (0, codegen_1$7._)`${T} && ${f} <= ${l}`), e.pass(T);
|
|
6731
6756
|
return;
|
|
6732
6757
|
}
|
|
6733
6758
|
i.items = !0;
|
|
6734
6759
|
const $ = t.name("valid");
|
|
6735
|
-
l === void 0 && o === 1 ?
|
|
6760
|
+
l === void 0 && o === 1 ? C($, () => t.if($, () => t.break())) : o === 0 ? (t.let($, !0), l !== void 0 && t.if((0, codegen_1$7._)`${s}.length > 0`, O)) : (t.let($, !1), O()), e.result($, () => e.reset());
|
|
6736
6761
|
function O() {
|
|
6737
6762
|
const T = t.name("_valid"), y = t.let("count", 0);
|
|
6738
|
-
|
|
6763
|
+
C(T, () => t.if(T, () => S(y)));
|
|
6739
6764
|
}
|
|
6740
|
-
function
|
|
6741
|
-
t.forRange("i", 0,
|
|
6765
|
+
function C(T, y) {
|
|
6766
|
+
t.forRange("i", 0, f, (_) => {
|
|
6742
6767
|
e.subschema({
|
|
6743
6768
|
keyword: "contains",
|
|
6744
6769
|
dataProp: _,
|
|
@@ -6747,7 +6772,7 @@ const codegen_1$7 = codegen, util_1$a = util, error$6 = {
|
|
|
6747
6772
|
}, T), y();
|
|
6748
6773
|
});
|
|
6749
6774
|
}
|
|
6750
|
-
function
|
|
6775
|
+
function S(T) {
|
|
6751
6776
|
t.code((0, codegen_1$7._)`${T}++`), l === void 0 ? t.if((0, codegen_1$7._)`${T} >= ${o}`, () => t.assign($, !0).break()) : (t.if((0, codegen_1$7._)`${T} > ${l}`, () => t.assign($, !1).break()), o === 1 ? t.assign($, !0) : t.if((0, codegen_1$7._)`${T} >= ${o}`, () => t.assign($, !0)));
|
|
6752
6777
|
}
|
|
6753
6778
|
}
|
|
@@ -6758,14 +6783,14 @@ var dependencies = {};
|
|
|
6758
6783
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.validateSchemaDeps = e.validatePropertyDeps = e.error = void 0;
|
|
6759
6784
|
const t = codegen, r = util, n = code;
|
|
6760
6785
|
e.error = {
|
|
6761
|
-
message: ({ params: { property: d, depsCount: u, deps:
|
|
6786
|
+
message: ({ params: { property: d, depsCount: u, deps: f } }) => {
|
|
6762
6787
|
const $ = u === 1 ? "property" : "properties";
|
|
6763
|
-
return (0, t.str)`must have ${$} ${
|
|
6788
|
+
return (0, t.str)`must have ${$} ${f} when property ${d} is present`;
|
|
6764
6789
|
},
|
|
6765
|
-
params: ({ params: { property: d, depsCount: u, deps:
|
|
6790
|
+
params: ({ params: { property: d, depsCount: u, deps: f, missingProperty: $ } }) => (0, t._)`{property: ${d},
|
|
6766
6791
|
missingProperty: ${$},
|
|
6767
6792
|
depsCount: ${u},
|
|
6768
|
-
deps: ${
|
|
6793
|
+
deps: ${f}}`
|
|
6769
6794
|
// TODO change to reference
|
|
6770
6795
|
};
|
|
6771
6796
|
const s = {
|
|
@@ -6774,53 +6799,53 @@ var dependencies = {};
|
|
|
6774
6799
|
schemaType: "object",
|
|
6775
6800
|
error: e.error,
|
|
6776
6801
|
code(d) {
|
|
6777
|
-
const [u,
|
|
6778
|
-
o(d, u), l(d,
|
|
6802
|
+
const [u, f] = i(d);
|
|
6803
|
+
o(d, u), l(d, f);
|
|
6779
6804
|
}
|
|
6780
6805
|
};
|
|
6781
6806
|
function i({ schema: d }) {
|
|
6782
|
-
const u = {},
|
|
6807
|
+
const u = {}, f = {};
|
|
6783
6808
|
for (const $ in d) {
|
|
6784
6809
|
if ($ === "__proto__")
|
|
6785
6810
|
continue;
|
|
6786
|
-
const O = Array.isArray(d[$]) ? u :
|
|
6811
|
+
const O = Array.isArray(d[$]) ? u : f;
|
|
6787
6812
|
O[$] = d[$];
|
|
6788
6813
|
}
|
|
6789
|
-
return [u,
|
|
6814
|
+
return [u, f];
|
|
6790
6815
|
}
|
|
6791
6816
|
function o(d, u = d.schema) {
|
|
6792
|
-
const { gen:
|
|
6817
|
+
const { gen: f, data: $, it: O } = d;
|
|
6793
6818
|
if (Object.keys(u).length === 0)
|
|
6794
6819
|
return;
|
|
6795
|
-
const
|
|
6796
|
-
for (const
|
|
6797
|
-
const T = u[
|
|
6820
|
+
const C = f.let("missing");
|
|
6821
|
+
for (const S in u) {
|
|
6822
|
+
const T = u[S];
|
|
6798
6823
|
if (T.length === 0)
|
|
6799
6824
|
continue;
|
|
6800
|
-
const y = (0, n.propertyInData)(
|
|
6825
|
+
const y = (0, n.propertyInData)(f, $, S, O.opts.ownProperties);
|
|
6801
6826
|
d.setParams({
|
|
6802
|
-
property:
|
|
6827
|
+
property: S,
|
|
6803
6828
|
depsCount: T.length,
|
|
6804
6829
|
deps: T.join(", ")
|
|
6805
|
-
}), O.allErrors ?
|
|
6830
|
+
}), O.allErrors ? f.if(y, () => {
|
|
6806
6831
|
for (const _ of T)
|
|
6807
6832
|
(0, n.checkReportMissingProp)(d, _);
|
|
6808
|
-
}) : (
|
|
6833
|
+
}) : (f.if((0, t._)`${y} && (${(0, n.checkMissingProp)(d, T, C)})`), (0, n.reportMissingProp)(d, C), f.else());
|
|
6809
6834
|
}
|
|
6810
6835
|
}
|
|
6811
6836
|
e.validatePropertyDeps = o;
|
|
6812
6837
|
function l(d, u = d.schema) {
|
|
6813
|
-
const { gen:
|
|
6838
|
+
const { gen: f, data: $, keyword: O, it: C } = d, S = f.name("valid");
|
|
6814
6839
|
for (const T in u)
|
|
6815
|
-
(0, r.alwaysValidSchema)(
|
|
6816
|
-
(0, n.propertyInData)(
|
|
6840
|
+
(0, r.alwaysValidSchema)(C, u[T]) || (f.if(
|
|
6841
|
+
(0, n.propertyInData)(f, $, T, C.opts.ownProperties),
|
|
6817
6842
|
() => {
|
|
6818
|
-
const y = d.subschema({ keyword: O, schemaProp: T },
|
|
6819
|
-
d.mergeValidEvaluated(y,
|
|
6843
|
+
const y = d.subschema({ keyword: O, schemaProp: T }, S);
|
|
6844
|
+
d.mergeValidEvaluated(y, S);
|
|
6820
6845
|
},
|
|
6821
|
-
() =>
|
|
6846
|
+
() => f.var(S, !0)
|
|
6822
6847
|
// TODO var
|
|
6823
|
-
), d.ok(
|
|
6848
|
+
), d.ok(S));
|
|
6824
6849
|
}
|
|
6825
6850
|
e.validateSchemaDeps = l, e.default = s;
|
|
6826
6851
|
})(dependencies);
|
|
@@ -6872,11 +6897,11 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
6872
6897
|
const { allErrors: l, opts: d } = o;
|
|
6873
6898
|
if (o.props = !0, d.removeAdditional !== "all" && (0, util_1$8.alwaysValidSchema)(o, r))
|
|
6874
6899
|
return;
|
|
6875
|
-
const u = (0, code_1$3.allSchemaProperties)(n.properties),
|
|
6900
|
+
const u = (0, code_1$3.allSchemaProperties)(n.properties), f = (0, code_1$3.allSchemaProperties)(n.patternProperties);
|
|
6876
6901
|
$(), e.ok((0, codegen_1$5._)`${i} === ${names_1.default.errors}`);
|
|
6877
6902
|
function $() {
|
|
6878
6903
|
t.forIn("key", s, (y) => {
|
|
6879
|
-
!u.length && !
|
|
6904
|
+
!u.length && !f.length ? S(y) : t.if(O(y), () => S(y));
|
|
6880
6905
|
});
|
|
6881
6906
|
}
|
|
6882
6907
|
function O(y) {
|
|
@@ -6886,14 +6911,14 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
6886
6911
|
_ = (0, code_1$3.isOwnProperty)(t, g, y);
|
|
6887
6912
|
} else
|
|
6888
6913
|
u.length ? _ = (0, codegen_1$5.or)(...u.map((g) => (0, codegen_1$5._)`${y} === ${g}`)) : _ = codegen_1$5.nil;
|
|
6889
|
-
return
|
|
6914
|
+
return f.length && (_ = (0, codegen_1$5.or)(_, ...f.map((g) => (0, codegen_1$5._)`${(0, code_1$3.usePattern)(e, g)}.test(${y})`))), (0, codegen_1$5.not)(_);
|
|
6890
6915
|
}
|
|
6891
|
-
function
|
|
6916
|
+
function C(y) {
|
|
6892
6917
|
t.code((0, codegen_1$5._)`delete ${s}[${y}]`);
|
|
6893
6918
|
}
|
|
6894
|
-
function
|
|
6919
|
+
function S(y) {
|
|
6895
6920
|
if (d.removeAdditional === "all" || d.removeAdditional && r === !1) {
|
|
6896
|
-
|
|
6921
|
+
C(y);
|
|
6897
6922
|
return;
|
|
6898
6923
|
}
|
|
6899
6924
|
if (r === !1) {
|
|
@@ -6903,7 +6928,7 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
6903
6928
|
if (typeof r == "object" && !(0, util_1$8.alwaysValidSchema)(o, r)) {
|
|
6904
6929
|
const _ = t.name("valid");
|
|
6905
6930
|
d.removeAdditional === "failing" ? (T(y, _, !1), t.if((0, codegen_1$5.not)(_), () => {
|
|
6906
|
-
e.reset(),
|
|
6931
|
+
e.reset(), C(y);
|
|
6907
6932
|
})) : (T(y, _), l || t.if((0, codegen_1$5.not)(_), () => t.break()));
|
|
6908
6933
|
}
|
|
6909
6934
|
}
|
|
@@ -6940,11 +6965,11 @@ const validate_1 = validate, code_1$2 = code, util_1$7 = util, additionalPropert
|
|
|
6940
6965
|
return;
|
|
6941
6966
|
const d = t.name("valid");
|
|
6942
6967
|
for (const $ of l)
|
|
6943
|
-
u($) ?
|
|
6968
|
+
u($) ? f($) : (t.if((0, code_1$2.propertyInData)(t, s, $, i.opts.ownProperties)), f($), i.allErrors || t.else().var(d, !0), t.endIf()), e.it.definedProperties.add($), e.ok(d);
|
|
6944
6969
|
function u($) {
|
|
6945
6970
|
return i.opts.useDefaults && !i.compositeRule && r[$].default !== void 0;
|
|
6946
6971
|
}
|
|
6947
|
-
function
|
|
6972
|
+
function f($) {
|
|
6948
6973
|
e.subschema({
|
|
6949
6974
|
keyword: "properties",
|
|
6950
6975
|
schemaProp: $,
|
|
@@ -6964,19 +6989,19 @@ const code_1$1 = code, codegen_1$4 = codegen, util_1$6 = util, util_2 = util, de
|
|
|
6964
6989
|
const { gen: t, schema: r, data: n, parentSchema: s, it: i } = e, { opts: o } = i, l = (0, code_1$1.allSchemaProperties)(r), d = l.filter((T) => (0, util_1$6.alwaysValidSchema)(i, r[T]));
|
|
6965
6990
|
if (l.length === 0 || d.length === l.length && (!i.opts.unevaluated || i.props === !0))
|
|
6966
6991
|
return;
|
|
6967
|
-
const u = o.strictSchema && !o.allowMatchingProperties && s.properties,
|
|
6992
|
+
const u = o.strictSchema && !o.allowMatchingProperties && s.properties, f = t.name("valid");
|
|
6968
6993
|
i.props !== !0 && !(i.props instanceof codegen_1$4.Name) && (i.props = (0, util_2.evaluatedPropsToName)(t, i.props));
|
|
6969
6994
|
const { props: $ } = i;
|
|
6970
6995
|
O();
|
|
6971
6996
|
function O() {
|
|
6972
6997
|
for (const T of l)
|
|
6973
|
-
u &&
|
|
6998
|
+
u && C(T), i.allErrors ? S(T) : (t.var(f, !0), S(T), t.if(f));
|
|
6974
6999
|
}
|
|
6975
|
-
function
|
|
7000
|
+
function C(T) {
|
|
6976
7001
|
for (const y in u)
|
|
6977
7002
|
new RegExp(T).test(y) && (0, util_1$6.checkStrictMode)(i, `property ${y} matches pattern ${T} (use allowMatchingProperties)`);
|
|
6978
7003
|
}
|
|
6979
|
-
function
|
|
7004
|
+
function S(T) {
|
|
6980
7005
|
t.forIn("key", n, (y) => {
|
|
6981
7006
|
t.if((0, codegen_1$4._)`${(0, code_1$1.usePattern)(e, T)}.test(${y})`, () => {
|
|
6982
7007
|
const _ = d.includes(T);
|
|
@@ -6985,7 +7010,7 @@ const code_1$1 = code, codegen_1$4 = codegen, util_1$6 = util, util_2 = util, de
|
|
|
6985
7010
|
schemaProp: T,
|
|
6986
7011
|
dataProp: y,
|
|
6987
7012
|
dataPropType: util_2.Type.Str
|
|
6988
|
-
},
|
|
7013
|
+
}, f), i.opts.unevaluated && $ !== !0 ? t.assign((0, codegen_1$4._)`${$}[${y}]`, !0) : !_ && !i.allErrors && t.if((0, codegen_1$4.not)(f), () => t.break());
|
|
6989
7014
|
});
|
|
6990
7015
|
});
|
|
6991
7016
|
}
|
|
@@ -7044,9 +7069,9 @@ const codegen_1$3 = codegen, util_1$4 = util, error$3 = {
|
|
|
7044
7069
|
const i = r, o = t.let("valid", !1), l = t.let("passing", null), d = t.name("_valid");
|
|
7045
7070
|
e.setParams({ passing: l }), t.block(u), e.result(o, () => e.reset(), () => e.error(!0));
|
|
7046
7071
|
function u() {
|
|
7047
|
-
i.forEach((
|
|
7072
|
+
i.forEach((f, $) => {
|
|
7048
7073
|
let O;
|
|
7049
|
-
(0, util_1$4.alwaysValidSchema)(s,
|
|
7074
|
+
(0, util_1$4.alwaysValidSchema)(s, f) ? t.var(d, !0) : O = e.subschema({
|
|
7050
7075
|
keyword: "oneOf",
|
|
7051
7076
|
schemaProp: $,
|
|
7052
7077
|
compositeRule: !0
|
|
@@ -7095,24 +7120,24 @@ const codegen_1$2 = codegen, util_1$2 = util, error$2 = {
|
|
|
7095
7120
|
return;
|
|
7096
7121
|
const o = t.let("valid", !0), l = t.name("_valid");
|
|
7097
7122
|
if (d(), e.reset(), s && i) {
|
|
7098
|
-
const
|
|
7099
|
-
e.setParams({ ifClause:
|
|
7123
|
+
const f = t.let("ifClause");
|
|
7124
|
+
e.setParams({ ifClause: f }), t.if(l, u("then", f), u("else", f));
|
|
7100
7125
|
} else
|
|
7101
7126
|
s ? t.if(l, u("then")) : t.if((0, codegen_1$2.not)(l), u("else"));
|
|
7102
7127
|
e.pass(o, () => e.error(!0));
|
|
7103
7128
|
function d() {
|
|
7104
|
-
const
|
|
7129
|
+
const f = e.subschema({
|
|
7105
7130
|
keyword: "if",
|
|
7106
7131
|
compositeRule: !0,
|
|
7107
7132
|
createErrors: !1,
|
|
7108
7133
|
allErrors: !1
|
|
7109
7134
|
}, l);
|
|
7110
|
-
e.mergeEvaluated(
|
|
7135
|
+
e.mergeEvaluated(f);
|
|
7111
7136
|
}
|
|
7112
|
-
function u(
|
|
7137
|
+
function u(f, $) {
|
|
7113
7138
|
return () => {
|
|
7114
|
-
const O = e.subschema({ keyword:
|
|
7115
|
-
t.assign(o, l), e.mergeValidEvaluated(O, o), $ ? t.assign($, (0, codegen_1$2._)`${
|
|
7139
|
+
const O = e.subschema({ keyword: f }, l);
|
|
7140
|
+
t.assign(o, l), e.mergeValidEvaluated(O, o), $ ? t.assign($, (0, codegen_1$2._)`${f}`) : e.setParams({ ifClause: f });
|
|
7116
7141
|
};
|
|
7117
7142
|
}
|
|
7118
7143
|
}
|
|
@@ -7165,33 +7190,33 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7165
7190
|
$data: !0,
|
|
7166
7191
|
error: error$1,
|
|
7167
7192
|
code(e, t) {
|
|
7168
|
-
const { gen: r, data: n, $data: s, schema: i, schemaCode: o, it: l } = e, { opts: d, errSchemaPath: u, schemaEnv:
|
|
7193
|
+
const { gen: r, data: n, $data: s, schema: i, schemaCode: o, it: l } = e, { opts: d, errSchemaPath: u, schemaEnv: f, self: $ } = l;
|
|
7169
7194
|
if (!d.validateFormats)
|
|
7170
7195
|
return;
|
|
7171
|
-
s ? O() :
|
|
7196
|
+
s ? O() : C();
|
|
7172
7197
|
function O() {
|
|
7173
|
-
const
|
|
7198
|
+
const S = r.scopeValue("formats", {
|
|
7174
7199
|
ref: $.formats,
|
|
7175
7200
|
code: d.code.formats
|
|
7176
|
-
}), T = r.const("fDef", (0, codegen_1$1._)`${
|
|
7201
|
+
}), T = r.const("fDef", (0, codegen_1$1._)`${S}[${o}]`), y = r.let("fType"), _ = r.let("format");
|
|
7177
7202
|
r.if((0, codegen_1$1._)`typeof ${T} == "object" && !(${T} instanceof RegExp)`, () => r.assign(y, (0, codegen_1$1._)`${T}.type || "string"`).assign(_, (0, codegen_1$1._)`${T}.validate`), () => r.assign(y, (0, codegen_1$1._)`"string"`).assign(_, T)), e.fail$data((0, codegen_1$1.or)(g(), P()));
|
|
7178
7203
|
function g() {
|
|
7179
7204
|
return d.strictSchema === !1 ? codegen_1$1.nil : (0, codegen_1$1._)`${o} && !${_}`;
|
|
7180
7205
|
}
|
|
7181
7206
|
function P() {
|
|
7182
|
-
const I =
|
|
7207
|
+
const I = f.$async ? (0, codegen_1$1._)`(${T}.async ? await ${_}(${n}) : ${_}(${n}))` : (0, codegen_1$1._)`${_}(${n})`, D = (0, codegen_1$1._)`(typeof ${_} == "function" ? ${I} : ${_}.test(${n}))`;
|
|
7183
7208
|
return (0, codegen_1$1._)`${_} && ${_} !== true && ${y} === ${t} && !${D}`;
|
|
7184
7209
|
}
|
|
7185
7210
|
}
|
|
7186
|
-
function
|
|
7187
|
-
const
|
|
7188
|
-
if (!
|
|
7211
|
+
function C() {
|
|
7212
|
+
const S = $.formats[i];
|
|
7213
|
+
if (!S) {
|
|
7189
7214
|
g();
|
|
7190
7215
|
return;
|
|
7191
7216
|
}
|
|
7192
|
-
if (
|
|
7217
|
+
if (S === !0)
|
|
7193
7218
|
return;
|
|
7194
|
-
const [T, y, _] = P(
|
|
7219
|
+
const [T, y, _] = P(S);
|
|
7195
7220
|
T === t && e.pass(I());
|
|
7196
7221
|
function g() {
|
|
7197
7222
|
if (d.strictSchema === !1) {
|
|
@@ -7208,8 +7233,8 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7208
7233
|
return typeof D == "object" && !(D instanceof RegExp) ? [D.type || "string", D.validate, (0, codegen_1$1._)`${k}.validate`] : ["string", D, k];
|
|
7209
7234
|
}
|
|
7210
7235
|
function I() {
|
|
7211
|
-
if (typeof
|
|
7212
|
-
if (!
|
|
7236
|
+
if (typeof S == "object" && !(S instanceof RegExp) && S.async) {
|
|
7237
|
+
if (!f.$async)
|
|
7213
7238
|
throw new Error("async format in sync schema");
|
|
7214
7239
|
return (0, codegen_1$1._)`await ${_}(${n})`;
|
|
7215
7240
|
}
|
|
@@ -7276,33 +7301,33 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7276
7301
|
if (!o)
|
|
7277
7302
|
throw new Error("discriminator: requires oneOf keyword");
|
|
7278
7303
|
const d = t.let("valid", !1), u = t.const("tag", (0, codegen_1._)`${r}${(0, codegen_1.getProperty)(l)}`);
|
|
7279
|
-
t.if((0, codegen_1._)`typeof ${u} == "string"`, () =>
|
|
7280
|
-
function
|
|
7281
|
-
const
|
|
7304
|
+
t.if((0, codegen_1._)`typeof ${u} == "string"`, () => f(), () => e.error(!1, { discrError: types_1.DiscrError.Tag, tag: u, tagName: l })), e.ok(d);
|
|
7305
|
+
function f() {
|
|
7306
|
+
const C = O();
|
|
7282
7307
|
t.if(!1);
|
|
7283
|
-
for (const
|
|
7284
|
-
t.elseIf((0, codegen_1._)`${u} === ${
|
|
7308
|
+
for (const S in C)
|
|
7309
|
+
t.elseIf((0, codegen_1._)`${u} === ${S}`), t.assign(d, $(C[S]));
|
|
7285
7310
|
t.else(), e.error(!1, { discrError: types_1.DiscrError.Mapping, tag: u, tagName: l }), t.endIf();
|
|
7286
7311
|
}
|
|
7287
|
-
function $(
|
|
7288
|
-
const
|
|
7289
|
-
return e.mergeEvaluated(T, codegen_1.Name),
|
|
7312
|
+
function $(C) {
|
|
7313
|
+
const S = t.name("valid"), T = e.subschema({ keyword: "oneOf", schemaProp: C }, S);
|
|
7314
|
+
return e.mergeEvaluated(T, codegen_1.Name), S;
|
|
7290
7315
|
}
|
|
7291
7316
|
function O() {
|
|
7292
|
-
var
|
|
7293
|
-
const
|
|
7317
|
+
var C;
|
|
7318
|
+
const S = {}, T = _(s);
|
|
7294
7319
|
let y = !0;
|
|
7295
7320
|
for (let I = 0; I < o.length; I++) {
|
|
7296
7321
|
let D = o[I];
|
|
7297
7322
|
D != null && D.$ref && !(0, util_1.schemaHasRulesButRef)(D, i.self.RULES) && (D = compile_1.resolveRef.call(i.self, i.schemaEnv.root, i.baseId, D == null ? void 0 : D.$ref), D instanceof compile_1.SchemaEnv && (D = D.schema));
|
|
7298
|
-
const w = (
|
|
7323
|
+
const w = (C = D == null ? void 0 : D.properties) === null || C === void 0 ? void 0 : C[l];
|
|
7299
7324
|
if (typeof w != "object")
|
|
7300
7325
|
throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${l}"`);
|
|
7301
7326
|
y = y && (T || _(D)), g(w, I);
|
|
7302
7327
|
}
|
|
7303
7328
|
if (!y)
|
|
7304
7329
|
throw new Error(`discriminator: "${l}" must be required`);
|
|
7305
|
-
return
|
|
7330
|
+
return S;
|
|
7306
7331
|
function _({ required: I }) {
|
|
7307
7332
|
return Array.isArray(I) && I.includes(l);
|
|
7308
7333
|
}
|
|
@@ -7316,9 +7341,9 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7316
7341
|
throw new Error(`discriminator: "properties/${l}" must have "const" or "enum"`);
|
|
7317
7342
|
}
|
|
7318
7343
|
function P(I, D) {
|
|
7319
|
-
if (typeof I != "string" || I in
|
|
7344
|
+
if (typeof I != "string" || I in S)
|
|
7320
7345
|
throw new Error(`discriminator: "${l}" values must be unique strings`);
|
|
7321
|
-
|
|
7346
|
+
S[I] = D;
|
|
7322
7347
|
}
|
|
7323
7348
|
}
|
|
7324
7349
|
}
|
|
@@ -7570,13 +7595,13 @@ const $schema$1 = "http://json-schema.org/draft-07/schema#", $id = "http://json-
|
|
|
7570
7595
|
const r = core$2, n = draft7, s = discriminator, i = require$$3, o = ["/properties"], l = "http://json-schema.org/draft-07/schema";
|
|
7571
7596
|
class d extends r.default {
|
|
7572
7597
|
_addVocabularies() {
|
|
7573
|
-
super._addVocabularies(), n.default.forEach((
|
|
7598
|
+
super._addVocabularies(), n.default.forEach((S) => this.addVocabulary(S)), this.opts.discriminator && this.addKeyword(s.default);
|
|
7574
7599
|
}
|
|
7575
7600
|
_addDefaultMetaSchema() {
|
|
7576
7601
|
if (super._addDefaultMetaSchema(), !this.opts.meta)
|
|
7577
7602
|
return;
|
|
7578
|
-
const
|
|
7579
|
-
this.addMetaSchema(
|
|
7603
|
+
const S = this.opts.$data ? this.$dataMetaSchema(i, o) : i;
|
|
7604
|
+
this.addMetaSchema(S, l, !1), this.refs["http://json-schema.org/schema"] = l;
|
|
7580
7605
|
}
|
|
7581
7606
|
defaultMeta() {
|
|
7582
7607
|
return this.opts.defaultMeta = super.defaultMeta() || (this.getSchema(l) ? l : void 0);
|
|
@@ -7587,19 +7612,19 @@ const $schema$1 = "http://json-schema.org/draft-07/schema#", $id = "http://json-
|
|
|
7587
7612
|
Object.defineProperty(t, "KeywordCxt", { enumerable: !0, get: function() {
|
|
7588
7613
|
return u.KeywordCxt;
|
|
7589
7614
|
} });
|
|
7590
|
-
var
|
|
7615
|
+
var f = codegen;
|
|
7591
7616
|
Object.defineProperty(t, "_", { enumerable: !0, get: function() {
|
|
7592
|
-
return
|
|
7617
|
+
return f._;
|
|
7593
7618
|
} }), Object.defineProperty(t, "str", { enumerable: !0, get: function() {
|
|
7594
|
-
return
|
|
7619
|
+
return f.str;
|
|
7595
7620
|
} }), Object.defineProperty(t, "stringify", { enumerable: !0, get: function() {
|
|
7596
|
-
return
|
|
7621
|
+
return f.stringify;
|
|
7597
7622
|
} }), Object.defineProperty(t, "nil", { enumerable: !0, get: function() {
|
|
7598
|
-
return
|
|
7623
|
+
return f.nil;
|
|
7599
7624
|
} }), Object.defineProperty(t, "Name", { enumerable: !0, get: function() {
|
|
7600
|
-
return
|
|
7625
|
+
return f.Name;
|
|
7601
7626
|
} }), Object.defineProperty(t, "CodeGen", { enumerable: !0, get: function() {
|
|
7602
|
-
return
|
|
7627
|
+
return f.CodeGen;
|
|
7603
7628
|
} });
|
|
7604
7629
|
var $ = validation_error;
|
|
7605
7630
|
Object.defineProperty(t, "ValidationError", { enumerable: !0, get: function() {
|
|
@@ -8217,36 +8242,6 @@ for existing apps using this option.`
|
|
|
8217
8242
|
"step"
|
|
8218
8243
|
]
|
|
8219
8244
|
},
|
|
8220
|
-
{
|
|
8221
|
-
type: "object",
|
|
8222
|
-
additionalProperties: !1,
|
|
8223
|
-
properties: {
|
|
8224
|
-
progress: {
|
|
8225
|
-
type: "object",
|
|
8226
|
-
properties: {
|
|
8227
|
-
weight: {
|
|
8228
|
-
type: "number"
|
|
8229
|
-
},
|
|
8230
|
-
caption: {
|
|
8231
|
-
type: "string"
|
|
8232
|
-
}
|
|
8233
|
-
},
|
|
8234
|
-
additionalProperties: !1
|
|
8235
|
-
},
|
|
8236
|
-
step: {
|
|
8237
|
-
type: "string",
|
|
8238
|
-
const: "importFile"
|
|
8239
|
-
},
|
|
8240
|
-
file: {
|
|
8241
|
-
$ref: "#/definitions/FileReference",
|
|
8242
|
-
description: "The file to import"
|
|
8243
|
-
}
|
|
8244
|
-
},
|
|
8245
|
-
required: [
|
|
8246
|
-
"file",
|
|
8247
|
-
"step"
|
|
8248
|
-
]
|
|
8249
|
-
},
|
|
8250
8245
|
{
|
|
8251
8246
|
type: "object",
|
|
8252
8247
|
additionalProperties: !1,
|
|
@@ -8297,6 +8292,15 @@ for existing apps using this option.`
|
|
|
8297
8292
|
},
|
|
8298
8293
|
additionalProperties: !1
|
|
8299
8294
|
},
|
|
8295
|
+
ifAlreadyInstalled: {
|
|
8296
|
+
type: "string",
|
|
8297
|
+
enum: [
|
|
8298
|
+
"overwrite",
|
|
8299
|
+
"skip",
|
|
8300
|
+
"error"
|
|
8301
|
+
],
|
|
8302
|
+
description: "What to do if the asset already exists."
|
|
8303
|
+
},
|
|
8300
8304
|
step: {
|
|
8301
8305
|
type: "string",
|
|
8302
8306
|
const: "installPlugin",
|
|
@@ -8332,6 +8336,15 @@ for existing apps using this option.`
|
|
|
8332
8336
|
},
|
|
8333
8337
|
additionalProperties: !1
|
|
8334
8338
|
},
|
|
8339
|
+
ifAlreadyInstalled: {
|
|
8340
|
+
type: "string",
|
|
8341
|
+
enum: [
|
|
8342
|
+
"overwrite",
|
|
8343
|
+
"skip",
|
|
8344
|
+
"error"
|
|
8345
|
+
],
|
|
8346
|
+
description: "What to do if the asset already exists."
|
|
8347
|
+
},
|
|
8335
8348
|
step: {
|
|
8336
8349
|
type: "string",
|
|
8337
8350
|
const: "installTheme",
|
|
@@ -9221,7 +9234,7 @@ function compileBlueprint(e, {
|
|
|
9221
9234
|
onStepCompleted: n = () => {
|
|
9222
9235
|
}
|
|
9223
9236
|
} = {}) {
|
|
9224
|
-
var $, O,
|
|
9237
|
+
var $, O, C, S, T, y, _;
|
|
9225
9238
|
e = {
|
|
9226
9239
|
...e,
|
|
9227
9240
|
steps: (e.steps || []).filter(isStepDefinition)
|
|
@@ -9278,14 +9291,14 @@ function compileBlueprint(e, {
|
|
|
9278
9291
|
},
|
|
9279
9292
|
path: "/tmp/wp-cli.phar"
|
|
9280
9293
|
}));
|
|
9281
|
-
const i = (
|
|
9294
|
+
const i = (C = e.steps) == null ? void 0 : C.findIndex(
|
|
9282
9295
|
(g) => typeof g == "object" && (g == null ? void 0 : g.step) === "importWxr"
|
|
9283
9296
|
);
|
|
9284
9297
|
i !== void 0 && i > -1 && (e.phpExtensionBundles.includes("light") && (e.phpExtensionBundles = e.phpExtensionBundles.filter(
|
|
9285
9298
|
(g) => g !== "light"
|
|
9286
9299
|
), console.warn(
|
|
9287
9300
|
"The importWxr 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. "
|
|
9288
|
-
)), (
|
|
9301
|
+
)), (S = e.steps) == null || S.splice(i, 0, {
|
|
9289
9302
|
step: "installPlugin",
|
|
9290
9303
|
pluginZipFile: {
|
|
9291
9304
|
resource: "url",
|
|
@@ -9306,7 +9319,7 @@ function compileBlueprint(e, {
|
|
|
9306
9319
|
return g + (((I = P.progress) == null ? void 0 : I.weight) || 1);
|
|
9307
9320
|
},
|
|
9308
9321
|
0
|
|
9309
|
-
),
|
|
9322
|
+
), f = d.map(
|
|
9310
9323
|
(g) => compileStep(g, {
|
|
9311
9324
|
semaphore: r,
|
|
9312
9325
|
rootProgressTracker: t,
|
|
@@ -9332,10 +9345,10 @@ function compileBlueprint(e, {
|
|
|
9332
9345
|
},
|
|
9333
9346
|
run: async (g) => {
|
|
9334
9347
|
try {
|
|
9335
|
-
for (const { resources: P } of
|
|
9348
|
+
for (const { resources: P } of f)
|
|
9336
9349
|
for (const I of P)
|
|
9337
9350
|
I.setPlayground(g), I.isAsync && I.resolve();
|
|
9338
|
-
for (const [P, { run: I, step: D }] of Object.entries(
|
|
9351
|
+
for (const [P, { run: I, step: D }] of Object.entries(f))
|
|
9339
9352
|
try {
|
|
9340
9353
|
const w = await I(g);
|
|
9341
9354
|
n(w, D);
|
|
@@ -9397,9 +9410,9 @@ function compileStep(e, {
|
|
|
9397
9410
|
rootProgressTracker: r,
|
|
9398
9411
|
totalProgressWeight: n
|
|
9399
9412
|
}) {
|
|
9400
|
-
var
|
|
9413
|
+
var f;
|
|
9401
9414
|
const s = r.stage(
|
|
9402
|
-
(((
|
|
9415
|
+
(((f = e.progress) == null ? void 0 : f.weight) || 1) / n
|
|
9403
9416
|
), i = {};
|
|
9404
9417
|
for (const $ of Object.keys(e)) {
|
|
9405
9418
|
let O = e[$];
|