@formatjs/cli 6.14.5 → 6.15.0
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/bin/formatjs +226 -398
- package/bin/formatjs.map +1 -1
- package/bin/{gts_extractor-CEZNDfvc.js → gts_extractor-C_xuju_3.js} +2 -2
- package/bin/{gts_extractor-CEZNDfvc.js.map → gts_extractor-C_xuju_3.js.map} +1 -1
- package/bin/{parse_script-Dh6HQV8l.js → parse_script-3um9mN8Y.js} +2076 -2082
- package/bin/{parse_script-Dh6HQV8l.js.map → parse_script-3um9mN8Y.js.map} +1 -1
- package/package.json +6 -2
|
@@ -40,6 +40,1332 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
40
40
|
}) : target, mod));
|
|
41
41
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
42
42
|
//#endregion
|
|
43
|
+
//#region node_modules/.aspect_rules_js/jsonify@0.0.1/node_modules/jsonify/lib/parse.js
|
|
44
|
+
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
45
|
+
var at;
|
|
46
|
+
var ch;
|
|
47
|
+
var escapee = {
|
|
48
|
+
"\"": "\"",
|
|
49
|
+
"\\": "\\",
|
|
50
|
+
"/": "/",
|
|
51
|
+
b: "\b",
|
|
52
|
+
f: "\f",
|
|
53
|
+
n: "\n",
|
|
54
|
+
r: "\r",
|
|
55
|
+
t: " "
|
|
56
|
+
};
|
|
57
|
+
var text;
|
|
58
|
+
function error(m) {
|
|
59
|
+
throw {
|
|
60
|
+
name: "SyntaxError",
|
|
61
|
+
message: m,
|
|
62
|
+
at,
|
|
63
|
+
text
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function next(c) {
|
|
67
|
+
if (c && c !== ch) error("Expected '" + c + "' instead of '" + ch + "'");
|
|
68
|
+
ch = text.charAt(at);
|
|
69
|
+
at += 1;
|
|
70
|
+
return ch;
|
|
71
|
+
}
|
|
72
|
+
function number() {
|
|
73
|
+
var num;
|
|
74
|
+
var str = "";
|
|
75
|
+
if (ch === "-") {
|
|
76
|
+
str = "-";
|
|
77
|
+
next("-");
|
|
78
|
+
}
|
|
79
|
+
while (ch >= "0" && ch <= "9") {
|
|
80
|
+
str += ch;
|
|
81
|
+
next();
|
|
82
|
+
}
|
|
83
|
+
if (ch === ".") {
|
|
84
|
+
str += ".";
|
|
85
|
+
while (next() && ch >= "0" && ch <= "9") str += ch;
|
|
86
|
+
}
|
|
87
|
+
if (ch === "e" || ch === "E") {
|
|
88
|
+
str += ch;
|
|
89
|
+
next();
|
|
90
|
+
if (ch === "-" || ch === "+") {
|
|
91
|
+
str += ch;
|
|
92
|
+
next();
|
|
93
|
+
}
|
|
94
|
+
while (ch >= "0" && ch <= "9") {
|
|
95
|
+
str += ch;
|
|
96
|
+
next();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
num = Number(str);
|
|
100
|
+
if (!isFinite(num)) error("Bad number");
|
|
101
|
+
return num;
|
|
102
|
+
}
|
|
103
|
+
function string() {
|
|
104
|
+
var hex;
|
|
105
|
+
var i;
|
|
106
|
+
var str = "";
|
|
107
|
+
var uffff;
|
|
108
|
+
if (ch === "\"") while (next()) if (ch === "\"") {
|
|
109
|
+
next();
|
|
110
|
+
return str;
|
|
111
|
+
} else if (ch === "\\") {
|
|
112
|
+
next();
|
|
113
|
+
if (ch === "u") {
|
|
114
|
+
uffff = 0;
|
|
115
|
+
for (i = 0; i < 4; i += 1) {
|
|
116
|
+
hex = parseInt(next(), 16);
|
|
117
|
+
if (!isFinite(hex)) break;
|
|
118
|
+
uffff = uffff * 16 + hex;
|
|
119
|
+
}
|
|
120
|
+
str += String.fromCharCode(uffff);
|
|
121
|
+
} else if (typeof escapee[ch] === "string") str += escapee[ch];
|
|
122
|
+
else break;
|
|
123
|
+
} else str += ch;
|
|
124
|
+
error("Bad string");
|
|
125
|
+
}
|
|
126
|
+
function white() {
|
|
127
|
+
while (ch && ch <= " ") next();
|
|
128
|
+
}
|
|
129
|
+
function word() {
|
|
130
|
+
switch (ch) {
|
|
131
|
+
case "t":
|
|
132
|
+
next("t");
|
|
133
|
+
next("r");
|
|
134
|
+
next("u");
|
|
135
|
+
next("e");
|
|
136
|
+
return true;
|
|
137
|
+
case "f":
|
|
138
|
+
next("f");
|
|
139
|
+
next("a");
|
|
140
|
+
next("l");
|
|
141
|
+
next("s");
|
|
142
|
+
next("e");
|
|
143
|
+
return false;
|
|
144
|
+
case "n":
|
|
145
|
+
next("n");
|
|
146
|
+
next("u");
|
|
147
|
+
next("l");
|
|
148
|
+
next("l");
|
|
149
|
+
return null;
|
|
150
|
+
default: error("Unexpected '" + ch + "'");
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function array() {
|
|
154
|
+
var arr = [];
|
|
155
|
+
if (ch === "[") {
|
|
156
|
+
next("[");
|
|
157
|
+
white();
|
|
158
|
+
if (ch === "]") {
|
|
159
|
+
next("]");
|
|
160
|
+
return arr;
|
|
161
|
+
}
|
|
162
|
+
while (ch) {
|
|
163
|
+
arr.push(value());
|
|
164
|
+
white();
|
|
165
|
+
if (ch === "]") {
|
|
166
|
+
next("]");
|
|
167
|
+
return arr;
|
|
168
|
+
}
|
|
169
|
+
next(",");
|
|
170
|
+
white();
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
error("Bad array");
|
|
174
|
+
}
|
|
175
|
+
function object() {
|
|
176
|
+
var key;
|
|
177
|
+
var obj = {};
|
|
178
|
+
if (ch === "{") {
|
|
179
|
+
next("{");
|
|
180
|
+
white();
|
|
181
|
+
if (ch === "}") {
|
|
182
|
+
next("}");
|
|
183
|
+
return obj;
|
|
184
|
+
}
|
|
185
|
+
while (ch) {
|
|
186
|
+
key = string();
|
|
187
|
+
white();
|
|
188
|
+
next(":");
|
|
189
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) error("Duplicate key \"" + key + "\"");
|
|
190
|
+
obj[key] = value();
|
|
191
|
+
white();
|
|
192
|
+
if (ch === "}") {
|
|
193
|
+
next("}");
|
|
194
|
+
return obj;
|
|
195
|
+
}
|
|
196
|
+
next(",");
|
|
197
|
+
white();
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
error("Bad object");
|
|
201
|
+
}
|
|
202
|
+
function value() {
|
|
203
|
+
white();
|
|
204
|
+
switch (ch) {
|
|
205
|
+
case "{": return object();
|
|
206
|
+
case "[": return array();
|
|
207
|
+
case "\"": return string();
|
|
208
|
+
case "-": return number();
|
|
209
|
+
default: return ch >= "0" && ch <= "9" ? number() : word();
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
module.exports = function(source, reviver) {
|
|
213
|
+
var result;
|
|
214
|
+
text = source;
|
|
215
|
+
at = 0;
|
|
216
|
+
ch = " ";
|
|
217
|
+
result = value();
|
|
218
|
+
white();
|
|
219
|
+
if (ch) error("Syntax error");
|
|
220
|
+
return typeof reviver === "function" ? function walk(holder, key) {
|
|
221
|
+
var k;
|
|
222
|
+
var v;
|
|
223
|
+
var val = holder[key];
|
|
224
|
+
if (val && typeof val === "object") {
|
|
225
|
+
for (k in value) if (Object.prototype.hasOwnProperty.call(val, k)) {
|
|
226
|
+
v = walk(val, k);
|
|
227
|
+
if (typeof v === "undefined") delete val[k];
|
|
228
|
+
else val[k] = v;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return reviver.call(holder, key, val);
|
|
232
|
+
}({ "": result }, "") : result;
|
|
233
|
+
};
|
|
234
|
+
}));
|
|
235
|
+
//#endregion
|
|
236
|
+
//#region node_modules/.aspect_rules_js/jsonify@0.0.1/node_modules/jsonify/lib/stringify.js
|
|
237
|
+
var require_stringify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
238
|
+
var escapable = /[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
|
|
239
|
+
var gap;
|
|
240
|
+
var indent;
|
|
241
|
+
var meta = {
|
|
242
|
+
"\b": "\\b",
|
|
243
|
+
" ": "\\t",
|
|
244
|
+
"\n": "\\n",
|
|
245
|
+
"\f": "\\f",
|
|
246
|
+
"\r": "\\r",
|
|
247
|
+
"\"": "\\\"",
|
|
248
|
+
"\\": "\\\\"
|
|
249
|
+
};
|
|
250
|
+
var rep;
|
|
251
|
+
function quote(string) {
|
|
252
|
+
escapable.lastIndex = 0;
|
|
253
|
+
return escapable.test(string) ? "\"" + string.replace(escapable, function(a) {
|
|
254
|
+
var c = meta[a];
|
|
255
|
+
return typeof c === "string" ? c : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4);
|
|
256
|
+
}) + "\"" : "\"" + string + "\"";
|
|
257
|
+
}
|
|
258
|
+
function str(key, holder) {
|
|
259
|
+
var i;
|
|
260
|
+
var k;
|
|
261
|
+
var v;
|
|
262
|
+
var length;
|
|
263
|
+
var mind = gap;
|
|
264
|
+
var partial;
|
|
265
|
+
var value = holder[key];
|
|
266
|
+
if (value && typeof value === "object" && typeof value.toJSON === "function") value = value.toJSON(key);
|
|
267
|
+
if (typeof rep === "function") value = rep.call(holder, key, value);
|
|
268
|
+
switch (typeof value) {
|
|
269
|
+
case "string": return quote(value);
|
|
270
|
+
case "number": return isFinite(value) ? String(value) : "null";
|
|
271
|
+
case "boolean":
|
|
272
|
+
case "null": return String(value);
|
|
273
|
+
case "object":
|
|
274
|
+
if (!value) return "null";
|
|
275
|
+
gap += indent;
|
|
276
|
+
partial = [];
|
|
277
|
+
if (Object.prototype.toString.apply(value) === "[object Array]") {
|
|
278
|
+
length = value.length;
|
|
279
|
+
for (i = 0; i < length; i += 1) partial[i] = str(i, value) || "null";
|
|
280
|
+
v = partial.length === 0 ? "[]" : gap ? "[\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "]" : "[" + partial.join(",") + "]";
|
|
281
|
+
gap = mind;
|
|
282
|
+
return v;
|
|
283
|
+
}
|
|
284
|
+
if (rep && typeof rep === "object") {
|
|
285
|
+
length = rep.length;
|
|
286
|
+
for (i = 0; i < length; i += 1) {
|
|
287
|
+
k = rep[i];
|
|
288
|
+
if (typeof k === "string") {
|
|
289
|
+
v = str(k, value);
|
|
290
|
+
if (v) partial.push(quote(k) + (gap ? ": " : ":") + v);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
} else for (k in value) if (Object.prototype.hasOwnProperty.call(value, k)) {
|
|
294
|
+
v = str(k, value);
|
|
295
|
+
if (v) partial.push(quote(k) + (gap ? ": " : ":") + v);
|
|
296
|
+
}
|
|
297
|
+
v = partial.length === 0 ? "{}" : gap ? "{\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "}" : "{" + partial.join(",") + "}";
|
|
298
|
+
gap = mind;
|
|
299
|
+
return v;
|
|
300
|
+
default:
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
module.exports = function(value, replacer, space) {
|
|
304
|
+
var i;
|
|
305
|
+
gap = "";
|
|
306
|
+
indent = "";
|
|
307
|
+
if (typeof space === "number") for (i = 0; i < space; i += 1) indent += " ";
|
|
308
|
+
else if (typeof space === "string") indent = space;
|
|
309
|
+
rep = replacer;
|
|
310
|
+
if (replacer && typeof replacer !== "function" && (typeof replacer !== "object" || typeof replacer.length !== "number")) throw new Error("JSON.stringify");
|
|
311
|
+
return str("", { "": value });
|
|
312
|
+
};
|
|
313
|
+
}));
|
|
314
|
+
//#endregion
|
|
315
|
+
//#region node_modules/.aspect_rules_js/jsonify@0.0.1/node_modules/jsonify/index.js
|
|
316
|
+
var require_jsonify = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
317
|
+
exports.parse = require_parse();
|
|
318
|
+
exports.stringify = require_stringify();
|
|
319
|
+
}));
|
|
320
|
+
//#endregion
|
|
321
|
+
//#region node_modules/.aspect_rules_js/isarray@2.0.5/node_modules/isarray/index.js
|
|
322
|
+
var require_isarray = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
323
|
+
var toString = {}.toString;
|
|
324
|
+
module.exports = Array.isArray || function(arr) {
|
|
325
|
+
return toString.call(arr) == "[object Array]";
|
|
326
|
+
};
|
|
327
|
+
}));
|
|
328
|
+
//#endregion
|
|
329
|
+
//#region node_modules/.aspect_rules_js/object-keys@1.1.1/node_modules/object-keys/isArguments.js
|
|
330
|
+
var require_isArguments = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
331
|
+
var toStr = Object.prototype.toString;
|
|
332
|
+
module.exports = function isArguments(value) {
|
|
333
|
+
var str = toStr.call(value);
|
|
334
|
+
var isArgs = str === "[object Arguments]";
|
|
335
|
+
if (!isArgs) isArgs = str !== "[object Array]" && value !== null && typeof value === "object" && typeof value.length === "number" && value.length >= 0 && toStr.call(value.callee) === "[object Function]";
|
|
336
|
+
return isArgs;
|
|
337
|
+
};
|
|
338
|
+
}));
|
|
339
|
+
//#endregion
|
|
340
|
+
//#region node_modules/.aspect_rules_js/object-keys@1.1.1/node_modules/object-keys/implementation.js
|
|
341
|
+
var require_implementation$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
342
|
+
var keysShim;
|
|
343
|
+
if (!Object.keys) {
|
|
344
|
+
var has = Object.prototype.hasOwnProperty;
|
|
345
|
+
var toStr = Object.prototype.toString;
|
|
346
|
+
var isArgs = require_isArguments();
|
|
347
|
+
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
|
348
|
+
var hasDontEnumBug = !isEnumerable.call({ toString: null }, "toString");
|
|
349
|
+
var hasProtoEnumBug = isEnumerable.call(function() {}, "prototype");
|
|
350
|
+
var dontEnums = [
|
|
351
|
+
"toString",
|
|
352
|
+
"toLocaleString",
|
|
353
|
+
"valueOf",
|
|
354
|
+
"hasOwnProperty",
|
|
355
|
+
"isPrototypeOf",
|
|
356
|
+
"propertyIsEnumerable",
|
|
357
|
+
"constructor"
|
|
358
|
+
];
|
|
359
|
+
var equalsConstructorPrototype = function(o) {
|
|
360
|
+
var ctor = o.constructor;
|
|
361
|
+
return ctor && ctor.prototype === o;
|
|
362
|
+
};
|
|
363
|
+
var excludedKeys = {
|
|
364
|
+
$applicationCache: true,
|
|
365
|
+
$console: true,
|
|
366
|
+
$external: true,
|
|
367
|
+
$frame: true,
|
|
368
|
+
$frameElement: true,
|
|
369
|
+
$frames: true,
|
|
370
|
+
$innerHeight: true,
|
|
371
|
+
$innerWidth: true,
|
|
372
|
+
$onmozfullscreenchange: true,
|
|
373
|
+
$onmozfullscreenerror: true,
|
|
374
|
+
$outerHeight: true,
|
|
375
|
+
$outerWidth: true,
|
|
376
|
+
$pageXOffset: true,
|
|
377
|
+
$pageYOffset: true,
|
|
378
|
+
$parent: true,
|
|
379
|
+
$scrollLeft: true,
|
|
380
|
+
$scrollTop: true,
|
|
381
|
+
$scrollX: true,
|
|
382
|
+
$scrollY: true,
|
|
383
|
+
$self: true,
|
|
384
|
+
$webkitIndexedDB: true,
|
|
385
|
+
$webkitStorageInfo: true,
|
|
386
|
+
$window: true
|
|
387
|
+
};
|
|
388
|
+
var hasAutomationEqualityBug = function() {
|
|
389
|
+
if (typeof window === "undefined") return false;
|
|
390
|
+
for (var k in window) try {
|
|
391
|
+
if (!excludedKeys["$" + k] && has.call(window, k) && window[k] !== null && typeof window[k] === "object") try {
|
|
392
|
+
equalsConstructorPrototype(window[k]);
|
|
393
|
+
} catch (e) {
|
|
394
|
+
return true;
|
|
395
|
+
}
|
|
396
|
+
} catch (e) {
|
|
397
|
+
return true;
|
|
398
|
+
}
|
|
399
|
+
return false;
|
|
400
|
+
}();
|
|
401
|
+
var equalsConstructorPrototypeIfNotBuggy = function(o) {
|
|
402
|
+
if (typeof window === "undefined" || !hasAutomationEqualityBug) return equalsConstructorPrototype(o);
|
|
403
|
+
try {
|
|
404
|
+
return equalsConstructorPrototype(o);
|
|
405
|
+
} catch (e) {
|
|
406
|
+
return false;
|
|
407
|
+
}
|
|
408
|
+
};
|
|
409
|
+
keysShim = function keys(object) {
|
|
410
|
+
var isObject = object !== null && typeof object === "object";
|
|
411
|
+
var isFunction = toStr.call(object) === "[object Function]";
|
|
412
|
+
var isArguments = isArgs(object);
|
|
413
|
+
var isString = isObject && toStr.call(object) === "[object String]";
|
|
414
|
+
var theKeys = [];
|
|
415
|
+
if (!isObject && !isFunction && !isArguments) throw new TypeError("Object.keys called on a non-object");
|
|
416
|
+
var skipProto = hasProtoEnumBug && isFunction;
|
|
417
|
+
if (isString && object.length > 0 && !has.call(object, 0)) for (var i = 0; i < object.length; ++i) theKeys.push(String(i));
|
|
418
|
+
if (isArguments && object.length > 0) for (var j = 0; j < object.length; ++j) theKeys.push(String(j));
|
|
419
|
+
else for (var name in object) if (!(skipProto && name === "prototype") && has.call(object, name)) theKeys.push(String(name));
|
|
420
|
+
if (hasDontEnumBug) {
|
|
421
|
+
var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
|
|
422
|
+
for (var k = 0; k < dontEnums.length; ++k) if (!(skipConstructor && dontEnums[k] === "constructor") && has.call(object, dontEnums[k])) theKeys.push(dontEnums[k]);
|
|
423
|
+
}
|
|
424
|
+
return theKeys;
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
module.exports = keysShim;
|
|
428
|
+
}));
|
|
429
|
+
//#endregion
|
|
430
|
+
//#region node_modules/.aspect_rules_js/object-keys@1.1.1/node_modules/object-keys/index.js
|
|
431
|
+
var require_object_keys = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
432
|
+
var slice = Array.prototype.slice;
|
|
433
|
+
var isArgs = require_isArguments();
|
|
434
|
+
var origKeys = Object.keys;
|
|
435
|
+
var keysShim = origKeys ? function keys(o) {
|
|
436
|
+
return origKeys(o);
|
|
437
|
+
} : require_implementation$1();
|
|
438
|
+
var originalKeys = Object.keys;
|
|
439
|
+
keysShim.shim = function shimObjectKeys() {
|
|
440
|
+
if (Object.keys) {
|
|
441
|
+
if (!function() {
|
|
442
|
+
var args = Object.keys(arguments);
|
|
443
|
+
return args && args.length === arguments.length;
|
|
444
|
+
}(1, 2)) Object.keys = function keys(object) {
|
|
445
|
+
if (isArgs(object)) return originalKeys(slice.call(object));
|
|
446
|
+
return originalKeys(object);
|
|
447
|
+
};
|
|
448
|
+
} else Object.keys = keysShim;
|
|
449
|
+
return Object.keys || keysShim;
|
|
450
|
+
};
|
|
451
|
+
module.exports = keysShim;
|
|
452
|
+
}));
|
|
453
|
+
//#endregion
|
|
454
|
+
//#region node_modules/.aspect_rules_js/es-object-atoms@1.1.1/node_modules/es-object-atoms/index.js
|
|
455
|
+
var require_es_object_atoms = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
456
|
+
/** @type {import('.')} */
|
|
457
|
+
module.exports = Object;
|
|
458
|
+
}));
|
|
459
|
+
//#endregion
|
|
460
|
+
//#region node_modules/.aspect_rules_js/es-errors@1.3.0/node_modules/es-errors/index.js
|
|
461
|
+
var require_es_errors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
462
|
+
/** @type {import('.')} */
|
|
463
|
+
module.exports = Error;
|
|
464
|
+
}));
|
|
465
|
+
//#endregion
|
|
466
|
+
//#region node_modules/.aspect_rules_js/es-errors@1.3.0/node_modules/es-errors/eval.js
|
|
467
|
+
var require_eval = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
468
|
+
/** @type {import('./eval')} */
|
|
469
|
+
module.exports = EvalError;
|
|
470
|
+
}));
|
|
471
|
+
//#endregion
|
|
472
|
+
//#region node_modules/.aspect_rules_js/es-errors@1.3.0/node_modules/es-errors/range.js
|
|
473
|
+
var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
474
|
+
/** @type {import('./range')} */
|
|
475
|
+
module.exports = RangeError;
|
|
476
|
+
}));
|
|
477
|
+
//#endregion
|
|
478
|
+
//#region node_modules/.aspect_rules_js/es-errors@1.3.0/node_modules/es-errors/ref.js
|
|
479
|
+
var require_ref = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
480
|
+
/** @type {import('./ref')} */
|
|
481
|
+
module.exports = ReferenceError;
|
|
482
|
+
}));
|
|
483
|
+
//#endregion
|
|
484
|
+
//#region node_modules/.aspect_rules_js/es-errors@1.3.0/node_modules/es-errors/syntax.js
|
|
485
|
+
var require_syntax = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
486
|
+
/** @type {import('./syntax')} */
|
|
487
|
+
module.exports = SyntaxError;
|
|
488
|
+
}));
|
|
489
|
+
//#endregion
|
|
490
|
+
//#region node_modules/.aspect_rules_js/es-errors@1.3.0/node_modules/es-errors/type.js
|
|
491
|
+
var require_type = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
492
|
+
/** @type {import('./type')} */
|
|
493
|
+
module.exports = TypeError;
|
|
494
|
+
}));
|
|
495
|
+
//#endregion
|
|
496
|
+
//#region node_modules/.aspect_rules_js/es-errors@1.3.0/node_modules/es-errors/uri.js
|
|
497
|
+
var require_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
498
|
+
/** @type {import('./uri')} */
|
|
499
|
+
module.exports = URIError;
|
|
500
|
+
}));
|
|
501
|
+
//#endregion
|
|
502
|
+
//#region node_modules/.aspect_rules_js/math-intrinsics@1.1.0/node_modules/math-intrinsics/abs.js
|
|
503
|
+
var require_abs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
504
|
+
/** @type {import('./abs')} */
|
|
505
|
+
module.exports = Math.abs;
|
|
506
|
+
}));
|
|
507
|
+
//#endregion
|
|
508
|
+
//#region node_modules/.aspect_rules_js/math-intrinsics@1.1.0/node_modules/math-intrinsics/floor.js
|
|
509
|
+
var require_floor = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
510
|
+
/** @type {import('./floor')} */
|
|
511
|
+
module.exports = Math.floor;
|
|
512
|
+
}));
|
|
513
|
+
//#endregion
|
|
514
|
+
//#region node_modules/.aspect_rules_js/math-intrinsics@1.1.0/node_modules/math-intrinsics/max.js
|
|
515
|
+
var require_max = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
516
|
+
/** @type {import('./max')} */
|
|
517
|
+
module.exports = Math.max;
|
|
518
|
+
}));
|
|
519
|
+
//#endregion
|
|
520
|
+
//#region node_modules/.aspect_rules_js/math-intrinsics@1.1.0/node_modules/math-intrinsics/min.js
|
|
521
|
+
var require_min = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
522
|
+
/** @type {import('./min')} */
|
|
523
|
+
module.exports = Math.min;
|
|
524
|
+
}));
|
|
525
|
+
//#endregion
|
|
526
|
+
//#region node_modules/.aspect_rules_js/math-intrinsics@1.1.0/node_modules/math-intrinsics/pow.js
|
|
527
|
+
var require_pow = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
528
|
+
/** @type {import('./pow')} */
|
|
529
|
+
module.exports = Math.pow;
|
|
530
|
+
}));
|
|
531
|
+
//#endregion
|
|
532
|
+
//#region node_modules/.aspect_rules_js/math-intrinsics@1.1.0/node_modules/math-intrinsics/round.js
|
|
533
|
+
var require_round = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
534
|
+
/** @type {import('./round')} */
|
|
535
|
+
module.exports = Math.round;
|
|
536
|
+
}));
|
|
537
|
+
//#endregion
|
|
538
|
+
//#region node_modules/.aspect_rules_js/math-intrinsics@1.1.0/node_modules/math-intrinsics/isNaN.js
|
|
539
|
+
var require_isNaN = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
540
|
+
/** @type {import('./isNaN')} */
|
|
541
|
+
module.exports = Number.isNaN || function isNaN(a) {
|
|
542
|
+
return a !== a;
|
|
543
|
+
};
|
|
544
|
+
}));
|
|
545
|
+
//#endregion
|
|
546
|
+
//#region node_modules/.aspect_rules_js/math-intrinsics@1.1.0/node_modules/math-intrinsics/sign.js
|
|
547
|
+
var require_sign = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
548
|
+
var $isNaN = require_isNaN();
|
|
549
|
+
/** @type {import('./sign')} */
|
|
550
|
+
module.exports = function sign(number) {
|
|
551
|
+
if ($isNaN(number) || number === 0) return number;
|
|
552
|
+
return number < 0 ? -1 : 1;
|
|
553
|
+
};
|
|
554
|
+
}));
|
|
555
|
+
//#endregion
|
|
556
|
+
//#region node_modules/.aspect_rules_js/gopd@1.2.0/node_modules/gopd/gOPD.js
|
|
557
|
+
var require_gOPD = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
558
|
+
/** @type {import('./gOPD')} */
|
|
559
|
+
module.exports = Object.getOwnPropertyDescriptor;
|
|
560
|
+
}));
|
|
561
|
+
//#endregion
|
|
562
|
+
//#region node_modules/.aspect_rules_js/gopd@1.2.0/node_modules/gopd/index.js
|
|
563
|
+
var require_gopd = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
564
|
+
/** @type {import('.')} */
|
|
565
|
+
var $gOPD = require_gOPD();
|
|
566
|
+
if ($gOPD) try {
|
|
567
|
+
$gOPD([], "length");
|
|
568
|
+
} catch (e) {
|
|
569
|
+
$gOPD = null;
|
|
570
|
+
}
|
|
571
|
+
module.exports = $gOPD;
|
|
572
|
+
}));
|
|
573
|
+
//#endregion
|
|
574
|
+
//#region node_modules/.aspect_rules_js/es-define-property@1.0.1/node_modules/es-define-property/index.js
|
|
575
|
+
var require_es_define_property = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
576
|
+
/** @type {import('.')} */
|
|
577
|
+
var $defineProperty = Object.defineProperty || false;
|
|
578
|
+
if ($defineProperty) try {
|
|
579
|
+
$defineProperty({}, "a", { value: 1 });
|
|
580
|
+
} catch (e) {
|
|
581
|
+
$defineProperty = false;
|
|
582
|
+
}
|
|
583
|
+
module.exports = $defineProperty;
|
|
584
|
+
}));
|
|
585
|
+
//#endregion
|
|
586
|
+
//#region node_modules/.aspect_rules_js/has-symbols@1.1.0/node_modules/has-symbols/shams.js
|
|
587
|
+
var require_shams = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
588
|
+
/** @type {import('./shams')} */
|
|
589
|
+
module.exports = function hasSymbols() {
|
|
590
|
+
if (typeof Symbol !== "function" || typeof Object.getOwnPropertySymbols !== "function") return false;
|
|
591
|
+
if (typeof Symbol.iterator === "symbol") return true;
|
|
592
|
+
/** @type {{ [k in symbol]?: unknown }} */
|
|
593
|
+
var obj = {};
|
|
594
|
+
var sym = Symbol("test");
|
|
595
|
+
var symObj = Object(sym);
|
|
596
|
+
if (typeof sym === "string") return false;
|
|
597
|
+
if (Object.prototype.toString.call(sym) !== "[object Symbol]") return false;
|
|
598
|
+
if (Object.prototype.toString.call(symObj) !== "[object Symbol]") return false;
|
|
599
|
+
var symVal = 42;
|
|
600
|
+
obj[sym] = symVal;
|
|
601
|
+
for (var _ in obj) return false;
|
|
602
|
+
if (typeof Object.keys === "function" && Object.keys(obj).length !== 0) return false;
|
|
603
|
+
if (typeof Object.getOwnPropertyNames === "function" && Object.getOwnPropertyNames(obj).length !== 0) return false;
|
|
604
|
+
var syms = Object.getOwnPropertySymbols(obj);
|
|
605
|
+
if (syms.length !== 1 || syms[0] !== sym) return false;
|
|
606
|
+
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) return false;
|
|
607
|
+
if (typeof Object.getOwnPropertyDescriptor === "function") {
|
|
608
|
+
var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
|
|
609
|
+
if (descriptor.value !== symVal || descriptor.enumerable !== true) return false;
|
|
610
|
+
}
|
|
611
|
+
return true;
|
|
612
|
+
};
|
|
613
|
+
}));
|
|
614
|
+
//#endregion
|
|
615
|
+
//#region node_modules/.aspect_rules_js/has-symbols@1.1.0/node_modules/has-symbols/index.js
|
|
616
|
+
var require_has_symbols = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
617
|
+
var origSymbol = typeof Symbol !== "undefined" && Symbol;
|
|
618
|
+
var hasSymbolSham = require_shams();
|
|
619
|
+
/** @type {import('.')} */
|
|
620
|
+
module.exports = function hasNativeSymbols() {
|
|
621
|
+
if (typeof origSymbol !== "function") return false;
|
|
622
|
+
if (typeof Symbol !== "function") return false;
|
|
623
|
+
if (typeof origSymbol("foo") !== "symbol") return false;
|
|
624
|
+
if (typeof Symbol("bar") !== "symbol") return false;
|
|
625
|
+
return hasSymbolSham();
|
|
626
|
+
};
|
|
627
|
+
}));
|
|
628
|
+
//#endregion
|
|
629
|
+
//#region node_modules/.aspect_rules_js/get-proto@1.0.1/node_modules/get-proto/Reflect.getPrototypeOf.js
|
|
630
|
+
var require_Reflect_getPrototypeOf = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
631
|
+
/** @type {import('./Reflect.getPrototypeOf')} */
|
|
632
|
+
module.exports = typeof Reflect !== "undefined" && Reflect.getPrototypeOf || null;
|
|
633
|
+
}));
|
|
634
|
+
//#endregion
|
|
635
|
+
//#region node_modules/.aspect_rules_js/get-proto@1.0.1/node_modules/get-proto/Object.getPrototypeOf.js
|
|
636
|
+
var require_Object_getPrototypeOf = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
637
|
+
/** @type {import('./Object.getPrototypeOf')} */
|
|
638
|
+
module.exports = require_es_object_atoms().getPrototypeOf || null;
|
|
639
|
+
}));
|
|
640
|
+
//#endregion
|
|
641
|
+
//#region node_modules/.aspect_rules_js/function-bind@1.1.2/node_modules/function-bind/implementation.js
|
|
642
|
+
var require_implementation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
643
|
+
var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
|
|
644
|
+
var toStr = Object.prototype.toString;
|
|
645
|
+
var max = Math.max;
|
|
646
|
+
var funcType = "[object Function]";
|
|
647
|
+
var concatty = function concatty(a, b) {
|
|
648
|
+
var arr = [];
|
|
649
|
+
for (var i = 0; i < a.length; i += 1) arr[i] = a[i];
|
|
650
|
+
for (var j = 0; j < b.length; j += 1) arr[j + a.length] = b[j];
|
|
651
|
+
return arr;
|
|
652
|
+
};
|
|
653
|
+
var slicy = function slicy(arrLike, offset) {
|
|
654
|
+
var arr = [];
|
|
655
|
+
for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) arr[j] = arrLike[i];
|
|
656
|
+
return arr;
|
|
657
|
+
};
|
|
658
|
+
var joiny = function(arr, joiner) {
|
|
659
|
+
var str = "";
|
|
660
|
+
for (var i = 0; i < arr.length; i += 1) {
|
|
661
|
+
str += arr[i];
|
|
662
|
+
if (i + 1 < arr.length) str += joiner;
|
|
663
|
+
}
|
|
664
|
+
return str;
|
|
665
|
+
};
|
|
666
|
+
module.exports = function bind(that) {
|
|
667
|
+
var target = this;
|
|
668
|
+
if (typeof target !== "function" || toStr.apply(target) !== funcType) throw new TypeError(ERROR_MESSAGE + target);
|
|
669
|
+
var args = slicy(arguments, 1);
|
|
670
|
+
var bound;
|
|
671
|
+
var binder = function() {
|
|
672
|
+
if (this instanceof bound) {
|
|
673
|
+
var result = target.apply(this, concatty(args, arguments));
|
|
674
|
+
if (Object(result) === result) return result;
|
|
675
|
+
return this;
|
|
676
|
+
}
|
|
677
|
+
return target.apply(that, concatty(args, arguments));
|
|
678
|
+
};
|
|
679
|
+
var boundLength = max(0, target.length - args.length);
|
|
680
|
+
var boundArgs = [];
|
|
681
|
+
for (var i = 0; i < boundLength; i++) boundArgs[i] = "$" + i;
|
|
682
|
+
bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
|
|
683
|
+
if (target.prototype) {
|
|
684
|
+
var Empty = function Empty() {};
|
|
685
|
+
Empty.prototype = target.prototype;
|
|
686
|
+
bound.prototype = new Empty();
|
|
687
|
+
Empty.prototype = null;
|
|
688
|
+
}
|
|
689
|
+
return bound;
|
|
690
|
+
};
|
|
691
|
+
}));
|
|
692
|
+
//#endregion
|
|
693
|
+
//#region node_modules/.aspect_rules_js/function-bind@1.1.2/node_modules/function-bind/index.js
|
|
694
|
+
var require_function_bind = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
695
|
+
var implementation = require_implementation();
|
|
696
|
+
module.exports = Function.prototype.bind || implementation;
|
|
697
|
+
}));
|
|
698
|
+
//#endregion
|
|
699
|
+
//#region node_modules/.aspect_rules_js/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionCall.js
|
|
700
|
+
var require_functionCall = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
701
|
+
/** @type {import('./functionCall')} */
|
|
702
|
+
module.exports = Function.prototype.call;
|
|
703
|
+
}));
|
|
704
|
+
//#endregion
|
|
705
|
+
//#region node_modules/.aspect_rules_js/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionApply.js
|
|
706
|
+
var require_functionApply = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
707
|
+
/** @type {import('./functionApply')} */
|
|
708
|
+
module.exports = Function.prototype.apply;
|
|
709
|
+
}));
|
|
710
|
+
//#endregion
|
|
711
|
+
//#region node_modules/.aspect_rules_js/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/reflectApply.js
|
|
712
|
+
var require_reflectApply = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
713
|
+
/** @type {import('./reflectApply')} */
|
|
714
|
+
module.exports = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
|
|
715
|
+
}));
|
|
716
|
+
//#endregion
|
|
717
|
+
//#region node_modules/.aspect_rules_js/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/actualApply.js
|
|
718
|
+
var require_actualApply = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
719
|
+
var bind = require_function_bind();
|
|
720
|
+
var $apply = require_functionApply();
|
|
721
|
+
var $call = require_functionCall();
|
|
722
|
+
/** @type {import('./actualApply')} */
|
|
723
|
+
module.exports = require_reflectApply() || bind.call($call, $apply);
|
|
724
|
+
}));
|
|
725
|
+
//#endregion
|
|
726
|
+
//#region node_modules/.aspect_rules_js/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/index.js
|
|
727
|
+
var require_call_bind_apply_helpers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
728
|
+
var bind = require_function_bind();
|
|
729
|
+
var $TypeError = require_type();
|
|
730
|
+
var $call = require_functionCall();
|
|
731
|
+
var $actualApply = require_actualApply();
|
|
732
|
+
/** @type {(args: [Function, thisArg?: unknown, ...args: unknown[]]) => Function} TODO FIXME, find a way to use import('.') */
|
|
733
|
+
module.exports = function callBindBasic(args) {
|
|
734
|
+
if (args.length < 1 || typeof args[0] !== "function") throw new $TypeError("a function is required");
|
|
735
|
+
return $actualApply(bind, $call, args);
|
|
736
|
+
};
|
|
737
|
+
}));
|
|
738
|
+
//#endregion
|
|
739
|
+
//#region node_modules/.aspect_rules_js/dunder-proto@1.0.1/node_modules/dunder-proto/get.js
|
|
740
|
+
var require_get = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
741
|
+
var callBind = require_call_bind_apply_helpers();
|
|
742
|
+
var gOPD = require_gopd();
|
|
743
|
+
var hasProtoAccessor;
|
|
744
|
+
try {
|
|
745
|
+
hasProtoAccessor = [].__proto__ === Array.prototype;
|
|
746
|
+
} catch (e) {
|
|
747
|
+
if (!e || typeof e !== "object" || !("code" in e) || e.code !== "ERR_PROTO_ACCESS") throw e;
|
|
748
|
+
}
|
|
749
|
+
var desc = !!hasProtoAccessor && gOPD && gOPD(Object.prototype, "__proto__");
|
|
750
|
+
var $Object = Object;
|
|
751
|
+
var $getPrototypeOf = $Object.getPrototypeOf;
|
|
752
|
+
/** @type {import('./get')} */
|
|
753
|
+
module.exports = desc && typeof desc.get === "function" ? callBind([desc.get]) : typeof $getPrototypeOf === "function" ? function getDunder(value) {
|
|
754
|
+
return $getPrototypeOf(value == null ? value : $Object(value));
|
|
755
|
+
} : false;
|
|
756
|
+
}));
|
|
757
|
+
//#endregion
|
|
758
|
+
//#region node_modules/.aspect_rules_js/get-proto@1.0.1/node_modules/get-proto/index.js
|
|
759
|
+
var require_get_proto = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
760
|
+
var reflectGetProto = require_Reflect_getPrototypeOf();
|
|
761
|
+
var originalGetProto = require_Object_getPrototypeOf();
|
|
762
|
+
var getDunderProto = require_get();
|
|
763
|
+
/** @type {import('.')} */
|
|
764
|
+
module.exports = reflectGetProto ? function getProto(O) {
|
|
765
|
+
return reflectGetProto(O);
|
|
766
|
+
} : originalGetProto ? function getProto(O) {
|
|
767
|
+
if (!O || typeof O !== "object" && typeof O !== "function") throw new TypeError("getProto: not an object");
|
|
768
|
+
return originalGetProto(O);
|
|
769
|
+
} : getDunderProto ? function getProto(O) {
|
|
770
|
+
return getDunderProto(O);
|
|
771
|
+
} : null;
|
|
772
|
+
}));
|
|
773
|
+
//#endregion
|
|
774
|
+
//#region node_modules/.aspect_rules_js/hasown@2.0.2/node_modules/hasown/index.js
|
|
775
|
+
var require_hasown = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
776
|
+
var call = Function.prototype.call;
|
|
777
|
+
var $hasOwn = Object.prototype.hasOwnProperty;
|
|
778
|
+
/** @type {import('.')} */
|
|
779
|
+
module.exports = require_function_bind().call(call, $hasOwn);
|
|
780
|
+
}));
|
|
781
|
+
//#endregion
|
|
782
|
+
//#region node_modules/.aspect_rules_js/get-intrinsic@1.3.0/node_modules/get-intrinsic/index.js
|
|
783
|
+
var require_get_intrinsic = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
784
|
+
var undefined;
|
|
785
|
+
var $Object = require_es_object_atoms();
|
|
786
|
+
var $Error = require_es_errors();
|
|
787
|
+
var $EvalError = require_eval();
|
|
788
|
+
var $RangeError = require_range();
|
|
789
|
+
var $ReferenceError = require_ref();
|
|
790
|
+
var $SyntaxError = require_syntax();
|
|
791
|
+
var $TypeError = require_type();
|
|
792
|
+
var $URIError = require_uri();
|
|
793
|
+
var abs = require_abs();
|
|
794
|
+
var floor = require_floor();
|
|
795
|
+
var max = require_max();
|
|
796
|
+
var min = require_min();
|
|
797
|
+
var pow = require_pow();
|
|
798
|
+
var round = require_round();
|
|
799
|
+
var sign = require_sign();
|
|
800
|
+
var $Function = Function;
|
|
801
|
+
var getEvalledConstructor = function(expressionSyntax) {
|
|
802
|
+
try {
|
|
803
|
+
return $Function("\"use strict\"; return (" + expressionSyntax + ").constructor;")();
|
|
804
|
+
} catch (e) {}
|
|
805
|
+
};
|
|
806
|
+
var $gOPD = require_gopd();
|
|
807
|
+
var $defineProperty = require_es_define_property();
|
|
808
|
+
var throwTypeError = function() {
|
|
809
|
+
throw new $TypeError();
|
|
810
|
+
};
|
|
811
|
+
var ThrowTypeError = $gOPD ? function() {
|
|
812
|
+
try {
|
|
813
|
+
arguments.callee;
|
|
814
|
+
return throwTypeError;
|
|
815
|
+
} catch (calleeThrows) {
|
|
816
|
+
try {
|
|
817
|
+
return $gOPD(arguments, "callee").get;
|
|
818
|
+
} catch (gOPDthrows) {
|
|
819
|
+
return throwTypeError;
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
}() : throwTypeError;
|
|
823
|
+
var hasSymbols = require_has_symbols()();
|
|
824
|
+
var getProto = require_get_proto();
|
|
825
|
+
var $ObjectGPO = require_Object_getPrototypeOf();
|
|
826
|
+
var $ReflectGPO = require_Reflect_getPrototypeOf();
|
|
827
|
+
var $apply = require_functionApply();
|
|
828
|
+
var $call = require_functionCall();
|
|
829
|
+
var needsEval = {};
|
|
830
|
+
var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined : getProto(Uint8Array);
|
|
831
|
+
var INTRINSICS = {
|
|
832
|
+
__proto__: null,
|
|
833
|
+
"%AggregateError%": typeof AggregateError === "undefined" ? undefined : AggregateError,
|
|
834
|
+
"%Array%": Array,
|
|
835
|
+
"%ArrayBuffer%": typeof ArrayBuffer === "undefined" ? undefined : ArrayBuffer,
|
|
836
|
+
"%ArrayIteratorPrototype%": hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined,
|
|
837
|
+
"%AsyncFromSyncIteratorPrototype%": undefined,
|
|
838
|
+
"%AsyncFunction%": needsEval,
|
|
839
|
+
"%AsyncGenerator%": needsEval,
|
|
840
|
+
"%AsyncGeneratorFunction%": needsEval,
|
|
841
|
+
"%AsyncIteratorPrototype%": needsEval,
|
|
842
|
+
"%Atomics%": typeof Atomics === "undefined" ? undefined : Atomics,
|
|
843
|
+
"%BigInt%": typeof BigInt === "undefined" ? undefined : BigInt,
|
|
844
|
+
"%BigInt64Array%": typeof BigInt64Array === "undefined" ? undefined : BigInt64Array,
|
|
845
|
+
"%BigUint64Array%": typeof BigUint64Array === "undefined" ? undefined : BigUint64Array,
|
|
846
|
+
"%Boolean%": Boolean,
|
|
847
|
+
"%DataView%": typeof DataView === "undefined" ? undefined : DataView,
|
|
848
|
+
"%Date%": Date,
|
|
849
|
+
"%decodeURI%": decodeURI,
|
|
850
|
+
"%decodeURIComponent%": decodeURIComponent,
|
|
851
|
+
"%encodeURI%": encodeURI,
|
|
852
|
+
"%encodeURIComponent%": encodeURIComponent,
|
|
853
|
+
"%Error%": $Error,
|
|
854
|
+
"%eval%": eval,
|
|
855
|
+
"%EvalError%": $EvalError,
|
|
856
|
+
"%Float16Array%": typeof Float16Array === "undefined" ? undefined : Float16Array,
|
|
857
|
+
"%Float32Array%": typeof Float32Array === "undefined" ? undefined : Float32Array,
|
|
858
|
+
"%Float64Array%": typeof Float64Array === "undefined" ? undefined : Float64Array,
|
|
859
|
+
"%FinalizationRegistry%": typeof FinalizationRegistry === "undefined" ? undefined : FinalizationRegistry,
|
|
860
|
+
"%Function%": $Function,
|
|
861
|
+
"%GeneratorFunction%": needsEval,
|
|
862
|
+
"%Int8Array%": typeof Int8Array === "undefined" ? undefined : Int8Array,
|
|
863
|
+
"%Int16Array%": typeof Int16Array === "undefined" ? undefined : Int16Array,
|
|
864
|
+
"%Int32Array%": typeof Int32Array === "undefined" ? undefined : Int32Array,
|
|
865
|
+
"%isFinite%": isFinite,
|
|
866
|
+
"%isNaN%": isNaN,
|
|
867
|
+
"%IteratorPrototype%": hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined,
|
|
868
|
+
"%JSON%": typeof JSON === "object" ? JSON : undefined,
|
|
869
|
+
"%Map%": typeof Map === "undefined" ? undefined : Map,
|
|
870
|
+
"%MapIteratorPrototype%": typeof Map === "undefined" || !hasSymbols || !getProto ? undefined : getProto((/* @__PURE__ */ new Map())[Symbol.iterator]()),
|
|
871
|
+
"%Math%": Math,
|
|
872
|
+
"%Number%": Number,
|
|
873
|
+
"%Object%": $Object,
|
|
874
|
+
"%Object.getOwnPropertyDescriptor%": $gOPD,
|
|
875
|
+
"%parseFloat%": parseFloat,
|
|
876
|
+
"%parseInt%": parseInt,
|
|
877
|
+
"%Promise%": typeof Promise === "undefined" ? undefined : Promise,
|
|
878
|
+
"%Proxy%": typeof Proxy === "undefined" ? undefined : Proxy,
|
|
879
|
+
"%RangeError%": $RangeError,
|
|
880
|
+
"%ReferenceError%": $ReferenceError,
|
|
881
|
+
"%Reflect%": typeof Reflect === "undefined" ? undefined : Reflect,
|
|
882
|
+
"%RegExp%": RegExp,
|
|
883
|
+
"%Set%": typeof Set === "undefined" ? undefined : Set,
|
|
884
|
+
"%SetIteratorPrototype%": typeof Set === "undefined" || !hasSymbols || !getProto ? undefined : getProto((/* @__PURE__ */ new Set())[Symbol.iterator]()),
|
|
885
|
+
"%SharedArrayBuffer%": typeof SharedArrayBuffer === "undefined" ? undefined : SharedArrayBuffer,
|
|
886
|
+
"%String%": String,
|
|
887
|
+
"%StringIteratorPrototype%": hasSymbols && getProto ? getProto(""[Symbol.iterator]()) : undefined,
|
|
888
|
+
"%Symbol%": hasSymbols ? Symbol : undefined,
|
|
889
|
+
"%SyntaxError%": $SyntaxError,
|
|
890
|
+
"%ThrowTypeError%": ThrowTypeError,
|
|
891
|
+
"%TypedArray%": TypedArray,
|
|
892
|
+
"%TypeError%": $TypeError,
|
|
893
|
+
"%Uint8Array%": typeof Uint8Array === "undefined" ? undefined : Uint8Array,
|
|
894
|
+
"%Uint8ClampedArray%": typeof Uint8ClampedArray === "undefined" ? undefined : Uint8ClampedArray,
|
|
895
|
+
"%Uint16Array%": typeof Uint16Array === "undefined" ? undefined : Uint16Array,
|
|
896
|
+
"%Uint32Array%": typeof Uint32Array === "undefined" ? undefined : Uint32Array,
|
|
897
|
+
"%URIError%": $URIError,
|
|
898
|
+
"%WeakMap%": typeof WeakMap === "undefined" ? undefined : WeakMap,
|
|
899
|
+
"%WeakRef%": typeof WeakRef === "undefined" ? undefined : WeakRef,
|
|
900
|
+
"%WeakSet%": typeof WeakSet === "undefined" ? undefined : WeakSet,
|
|
901
|
+
"%Function.prototype.call%": $call,
|
|
902
|
+
"%Function.prototype.apply%": $apply,
|
|
903
|
+
"%Object.defineProperty%": $defineProperty,
|
|
904
|
+
"%Object.getPrototypeOf%": $ObjectGPO,
|
|
905
|
+
"%Math.abs%": abs,
|
|
906
|
+
"%Math.floor%": floor,
|
|
907
|
+
"%Math.max%": max,
|
|
908
|
+
"%Math.min%": min,
|
|
909
|
+
"%Math.pow%": pow,
|
|
910
|
+
"%Math.round%": round,
|
|
911
|
+
"%Math.sign%": sign,
|
|
912
|
+
"%Reflect.getPrototypeOf%": $ReflectGPO
|
|
913
|
+
};
|
|
914
|
+
if (getProto) try {
|
|
915
|
+
null.error;
|
|
916
|
+
} catch (e) {
|
|
917
|
+
INTRINSICS["%Error.prototype%"] = getProto(getProto(e));
|
|
918
|
+
}
|
|
919
|
+
var doEval = function doEval(name) {
|
|
920
|
+
var value;
|
|
921
|
+
if (name === "%AsyncFunction%") value = getEvalledConstructor("async function () {}");
|
|
922
|
+
else if (name === "%GeneratorFunction%") value = getEvalledConstructor("function* () {}");
|
|
923
|
+
else if (name === "%AsyncGeneratorFunction%") value = getEvalledConstructor("async function* () {}");
|
|
924
|
+
else if (name === "%AsyncGenerator%") {
|
|
925
|
+
var fn = doEval("%AsyncGeneratorFunction%");
|
|
926
|
+
if (fn) value = fn.prototype;
|
|
927
|
+
} else if (name === "%AsyncIteratorPrototype%") {
|
|
928
|
+
var gen = doEval("%AsyncGenerator%");
|
|
929
|
+
if (gen && getProto) value = getProto(gen.prototype);
|
|
930
|
+
}
|
|
931
|
+
INTRINSICS[name] = value;
|
|
932
|
+
return value;
|
|
933
|
+
};
|
|
934
|
+
var LEGACY_ALIASES = {
|
|
935
|
+
__proto__: null,
|
|
936
|
+
"%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"],
|
|
937
|
+
"%ArrayPrototype%": ["Array", "prototype"],
|
|
938
|
+
"%ArrayProto_entries%": [
|
|
939
|
+
"Array",
|
|
940
|
+
"prototype",
|
|
941
|
+
"entries"
|
|
942
|
+
],
|
|
943
|
+
"%ArrayProto_forEach%": [
|
|
944
|
+
"Array",
|
|
945
|
+
"prototype",
|
|
946
|
+
"forEach"
|
|
947
|
+
],
|
|
948
|
+
"%ArrayProto_keys%": [
|
|
949
|
+
"Array",
|
|
950
|
+
"prototype",
|
|
951
|
+
"keys"
|
|
952
|
+
],
|
|
953
|
+
"%ArrayProto_values%": [
|
|
954
|
+
"Array",
|
|
955
|
+
"prototype",
|
|
956
|
+
"values"
|
|
957
|
+
],
|
|
958
|
+
"%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"],
|
|
959
|
+
"%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"],
|
|
960
|
+
"%AsyncGeneratorPrototype%": [
|
|
961
|
+
"AsyncGeneratorFunction",
|
|
962
|
+
"prototype",
|
|
963
|
+
"prototype"
|
|
964
|
+
],
|
|
965
|
+
"%BooleanPrototype%": ["Boolean", "prototype"],
|
|
966
|
+
"%DataViewPrototype%": ["DataView", "prototype"],
|
|
967
|
+
"%DatePrototype%": ["Date", "prototype"],
|
|
968
|
+
"%ErrorPrototype%": ["Error", "prototype"],
|
|
969
|
+
"%EvalErrorPrototype%": ["EvalError", "prototype"],
|
|
970
|
+
"%Float32ArrayPrototype%": ["Float32Array", "prototype"],
|
|
971
|
+
"%Float64ArrayPrototype%": ["Float64Array", "prototype"],
|
|
972
|
+
"%FunctionPrototype%": ["Function", "prototype"],
|
|
973
|
+
"%Generator%": ["GeneratorFunction", "prototype"],
|
|
974
|
+
"%GeneratorPrototype%": [
|
|
975
|
+
"GeneratorFunction",
|
|
976
|
+
"prototype",
|
|
977
|
+
"prototype"
|
|
978
|
+
],
|
|
979
|
+
"%Int8ArrayPrototype%": ["Int8Array", "prototype"],
|
|
980
|
+
"%Int16ArrayPrototype%": ["Int16Array", "prototype"],
|
|
981
|
+
"%Int32ArrayPrototype%": ["Int32Array", "prototype"],
|
|
982
|
+
"%JSONParse%": ["JSON", "parse"],
|
|
983
|
+
"%JSONStringify%": ["JSON", "stringify"],
|
|
984
|
+
"%MapPrototype%": ["Map", "prototype"],
|
|
985
|
+
"%NumberPrototype%": ["Number", "prototype"],
|
|
986
|
+
"%ObjectPrototype%": ["Object", "prototype"],
|
|
987
|
+
"%ObjProto_toString%": [
|
|
988
|
+
"Object",
|
|
989
|
+
"prototype",
|
|
990
|
+
"toString"
|
|
991
|
+
],
|
|
992
|
+
"%ObjProto_valueOf%": [
|
|
993
|
+
"Object",
|
|
994
|
+
"prototype",
|
|
995
|
+
"valueOf"
|
|
996
|
+
],
|
|
997
|
+
"%PromisePrototype%": ["Promise", "prototype"],
|
|
998
|
+
"%PromiseProto_then%": [
|
|
999
|
+
"Promise",
|
|
1000
|
+
"prototype",
|
|
1001
|
+
"then"
|
|
1002
|
+
],
|
|
1003
|
+
"%Promise_all%": ["Promise", "all"],
|
|
1004
|
+
"%Promise_reject%": ["Promise", "reject"],
|
|
1005
|
+
"%Promise_resolve%": ["Promise", "resolve"],
|
|
1006
|
+
"%RangeErrorPrototype%": ["RangeError", "prototype"],
|
|
1007
|
+
"%ReferenceErrorPrototype%": ["ReferenceError", "prototype"],
|
|
1008
|
+
"%RegExpPrototype%": ["RegExp", "prototype"],
|
|
1009
|
+
"%SetPrototype%": ["Set", "prototype"],
|
|
1010
|
+
"%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"],
|
|
1011
|
+
"%StringPrototype%": ["String", "prototype"],
|
|
1012
|
+
"%SymbolPrototype%": ["Symbol", "prototype"],
|
|
1013
|
+
"%SyntaxErrorPrototype%": ["SyntaxError", "prototype"],
|
|
1014
|
+
"%TypedArrayPrototype%": ["TypedArray", "prototype"],
|
|
1015
|
+
"%TypeErrorPrototype%": ["TypeError", "prototype"],
|
|
1016
|
+
"%Uint8ArrayPrototype%": ["Uint8Array", "prototype"],
|
|
1017
|
+
"%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"],
|
|
1018
|
+
"%Uint16ArrayPrototype%": ["Uint16Array", "prototype"],
|
|
1019
|
+
"%Uint32ArrayPrototype%": ["Uint32Array", "prototype"],
|
|
1020
|
+
"%URIErrorPrototype%": ["URIError", "prototype"],
|
|
1021
|
+
"%WeakMapPrototype%": ["WeakMap", "prototype"],
|
|
1022
|
+
"%WeakSetPrototype%": ["WeakSet", "prototype"]
|
|
1023
|
+
};
|
|
1024
|
+
var bind = require_function_bind();
|
|
1025
|
+
var hasOwn = require_hasown();
|
|
1026
|
+
var $concat = bind.call($call, Array.prototype.concat);
|
|
1027
|
+
var $spliceApply = bind.call($apply, Array.prototype.splice);
|
|
1028
|
+
var $replace = bind.call($call, String.prototype.replace);
|
|
1029
|
+
var $strSlice = bind.call($call, String.prototype.slice);
|
|
1030
|
+
var $exec = bind.call($call, RegExp.prototype.exec);
|
|
1031
|
+
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
|
|
1032
|
+
var reEscapeChar = /\\(\\)?/g;
|
|
1033
|
+
var stringToPath = function stringToPath(string) {
|
|
1034
|
+
var first = $strSlice(string, 0, 1);
|
|
1035
|
+
var last = $strSlice(string, -1);
|
|
1036
|
+
if (first === "%" && last !== "%") throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`");
|
|
1037
|
+
else if (last === "%" && first !== "%") throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`");
|
|
1038
|
+
var result = [];
|
|
1039
|
+
$replace(string, rePropName, function(match, number, quote, subString) {
|
|
1040
|
+
result[result.length] = quote ? $replace(subString, reEscapeChar, "$1") : number || match;
|
|
1041
|
+
});
|
|
1042
|
+
return result;
|
|
1043
|
+
};
|
|
1044
|
+
var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
|
|
1045
|
+
var intrinsicName = name;
|
|
1046
|
+
var alias;
|
|
1047
|
+
if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
|
|
1048
|
+
alias = LEGACY_ALIASES[intrinsicName];
|
|
1049
|
+
intrinsicName = "%" + alias[0] + "%";
|
|
1050
|
+
}
|
|
1051
|
+
if (hasOwn(INTRINSICS, intrinsicName)) {
|
|
1052
|
+
var value = INTRINSICS[intrinsicName];
|
|
1053
|
+
if (value === needsEval) value = doEval(intrinsicName);
|
|
1054
|
+
if (typeof value === "undefined" && !allowMissing) throw new $TypeError("intrinsic " + name + " exists, but is not available. Please file an issue!");
|
|
1055
|
+
return {
|
|
1056
|
+
alias,
|
|
1057
|
+
name: intrinsicName,
|
|
1058
|
+
value
|
|
1059
|
+
};
|
|
1060
|
+
}
|
|
1061
|
+
throw new $SyntaxError("intrinsic " + name + " does not exist!");
|
|
1062
|
+
};
|
|
1063
|
+
module.exports = function GetIntrinsic(name, allowMissing) {
|
|
1064
|
+
if (typeof name !== "string" || name.length === 0) throw new $TypeError("intrinsic name must be a non-empty string");
|
|
1065
|
+
if (arguments.length > 1 && typeof allowMissing !== "boolean") throw new $TypeError("\"allowMissing\" argument must be a boolean");
|
|
1066
|
+
if ($exec(/^%?[^%]*%?$/, name) === null) throw new $SyntaxError("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
|
|
1067
|
+
var parts = stringToPath(name);
|
|
1068
|
+
var intrinsicBaseName = parts.length > 0 ? parts[0] : "";
|
|
1069
|
+
var intrinsic = getBaseIntrinsic("%" + intrinsicBaseName + "%", allowMissing);
|
|
1070
|
+
var intrinsicRealName = intrinsic.name;
|
|
1071
|
+
var value = intrinsic.value;
|
|
1072
|
+
var skipFurtherCaching = false;
|
|
1073
|
+
var alias = intrinsic.alias;
|
|
1074
|
+
if (alias) {
|
|
1075
|
+
intrinsicBaseName = alias[0];
|
|
1076
|
+
$spliceApply(parts, $concat([0, 1], alias));
|
|
1077
|
+
}
|
|
1078
|
+
for (var i = 1, isOwn = true; i < parts.length; i += 1) {
|
|
1079
|
+
var part = parts[i];
|
|
1080
|
+
var first = $strSlice(part, 0, 1);
|
|
1081
|
+
var last = $strSlice(part, -1);
|
|
1082
|
+
if ((first === "\"" || first === "'" || first === "`" || last === "\"" || last === "'" || last === "`") && first !== last) throw new $SyntaxError("property names with quotes must have matching quotes");
|
|
1083
|
+
if (part === "constructor" || !isOwn) skipFurtherCaching = true;
|
|
1084
|
+
intrinsicBaseName += "." + part;
|
|
1085
|
+
intrinsicRealName = "%" + intrinsicBaseName + "%";
|
|
1086
|
+
if (hasOwn(INTRINSICS, intrinsicRealName)) value = INTRINSICS[intrinsicRealName];
|
|
1087
|
+
else if (value != null) {
|
|
1088
|
+
if (!(part in value)) {
|
|
1089
|
+
if (!allowMissing) throw new $TypeError("base intrinsic for " + name + " exists, but the property is not available.");
|
|
1090
|
+
return;
|
|
1091
|
+
}
|
|
1092
|
+
if ($gOPD && i + 1 >= parts.length) {
|
|
1093
|
+
var desc = $gOPD(value, part);
|
|
1094
|
+
isOwn = !!desc;
|
|
1095
|
+
if (isOwn && "get" in desc && !("originalValue" in desc.get)) value = desc.get;
|
|
1096
|
+
else value = value[part];
|
|
1097
|
+
} else {
|
|
1098
|
+
isOwn = hasOwn(value, part);
|
|
1099
|
+
value = value[part];
|
|
1100
|
+
}
|
|
1101
|
+
if (isOwn && !skipFurtherCaching) INTRINSICS[intrinsicRealName] = value;
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
return value;
|
|
1105
|
+
};
|
|
1106
|
+
}));
|
|
1107
|
+
//#endregion
|
|
1108
|
+
//#region node_modules/.aspect_rules_js/define-data-property@1.1.4/node_modules/define-data-property/index.js
|
|
1109
|
+
var require_define_data_property = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1110
|
+
var $defineProperty = require_es_define_property();
|
|
1111
|
+
var $SyntaxError = require_syntax();
|
|
1112
|
+
var $TypeError = require_type();
|
|
1113
|
+
var gopd = require_gopd();
|
|
1114
|
+
/** @type {import('.')} */
|
|
1115
|
+
module.exports = function defineDataProperty(obj, property, value) {
|
|
1116
|
+
if (!obj || typeof obj !== "object" && typeof obj !== "function") throw new $TypeError("`obj` must be an object or a function`");
|
|
1117
|
+
if (typeof property !== "string" && typeof property !== "symbol") throw new $TypeError("`property` must be a string or a symbol`");
|
|
1118
|
+
if (arguments.length > 3 && typeof arguments[3] !== "boolean" && arguments[3] !== null) throw new $TypeError("`nonEnumerable`, if provided, must be a boolean or null");
|
|
1119
|
+
if (arguments.length > 4 && typeof arguments[4] !== "boolean" && arguments[4] !== null) throw new $TypeError("`nonWritable`, if provided, must be a boolean or null");
|
|
1120
|
+
if (arguments.length > 5 && typeof arguments[5] !== "boolean" && arguments[5] !== null) throw new $TypeError("`nonConfigurable`, if provided, must be a boolean or null");
|
|
1121
|
+
if (arguments.length > 6 && typeof arguments[6] !== "boolean") throw new $TypeError("`loose`, if provided, must be a boolean");
|
|
1122
|
+
var nonEnumerable = arguments.length > 3 ? arguments[3] : null;
|
|
1123
|
+
var nonWritable = arguments.length > 4 ? arguments[4] : null;
|
|
1124
|
+
var nonConfigurable = arguments.length > 5 ? arguments[5] : null;
|
|
1125
|
+
var loose = arguments.length > 6 ? arguments[6] : false;
|
|
1126
|
+
var desc = !!gopd && gopd(obj, property);
|
|
1127
|
+
if ($defineProperty) $defineProperty(obj, property, {
|
|
1128
|
+
configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable,
|
|
1129
|
+
enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable,
|
|
1130
|
+
value,
|
|
1131
|
+
writable: nonWritable === null && desc ? desc.writable : !nonWritable
|
|
1132
|
+
});
|
|
1133
|
+
else if (loose || !nonEnumerable && !nonWritable && !nonConfigurable) obj[property] = value;
|
|
1134
|
+
else throw new $SyntaxError("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");
|
|
1135
|
+
};
|
|
1136
|
+
}));
|
|
1137
|
+
//#endregion
|
|
1138
|
+
//#region node_modules/.aspect_rules_js/has-property-descriptors@1.0.2/node_modules/has-property-descriptors/index.js
|
|
1139
|
+
var require_has_property_descriptors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1140
|
+
var $defineProperty = require_es_define_property();
|
|
1141
|
+
var hasPropertyDescriptors = function hasPropertyDescriptors() {
|
|
1142
|
+
return !!$defineProperty;
|
|
1143
|
+
};
|
|
1144
|
+
hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
|
|
1145
|
+
if (!$defineProperty) return null;
|
|
1146
|
+
try {
|
|
1147
|
+
return $defineProperty([], "length", { value: 1 }).length !== 1;
|
|
1148
|
+
} catch (e) {
|
|
1149
|
+
return true;
|
|
1150
|
+
}
|
|
1151
|
+
};
|
|
1152
|
+
module.exports = hasPropertyDescriptors;
|
|
1153
|
+
}));
|
|
1154
|
+
//#endregion
|
|
1155
|
+
//#region node_modules/.aspect_rules_js/set-function-length@1.2.2/node_modules/set-function-length/index.js
|
|
1156
|
+
var require_set_function_length = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1157
|
+
var GetIntrinsic = require_get_intrinsic();
|
|
1158
|
+
var define = require_define_data_property();
|
|
1159
|
+
var hasDescriptors = require_has_property_descriptors()();
|
|
1160
|
+
var gOPD = require_gopd();
|
|
1161
|
+
var $TypeError = require_type();
|
|
1162
|
+
var $floor = GetIntrinsic("%Math.floor%");
|
|
1163
|
+
/** @type {import('.')} */
|
|
1164
|
+
module.exports = function setFunctionLength(fn, length) {
|
|
1165
|
+
if (typeof fn !== "function") throw new $TypeError("`fn` is not a function");
|
|
1166
|
+
if (typeof length !== "number" || length < 0 || length > 4294967295 || $floor(length) !== length) throw new $TypeError("`length` must be a positive 32-bit integer");
|
|
1167
|
+
var loose = arguments.length > 2 && !!arguments[2];
|
|
1168
|
+
var functionLengthIsConfigurable = true;
|
|
1169
|
+
var functionLengthIsWritable = true;
|
|
1170
|
+
if ("length" in fn && gOPD) {
|
|
1171
|
+
var desc = gOPD(fn, "length");
|
|
1172
|
+
if (desc && !desc.configurable) functionLengthIsConfigurable = false;
|
|
1173
|
+
if (desc && !desc.writable) functionLengthIsWritable = false;
|
|
1174
|
+
}
|
|
1175
|
+
if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) if (hasDescriptors) define(fn, "length", length, true, true);
|
|
1176
|
+
else define(fn, "length", length);
|
|
1177
|
+
return fn;
|
|
1178
|
+
};
|
|
1179
|
+
}));
|
|
1180
|
+
//#endregion
|
|
1181
|
+
//#region node_modules/.aspect_rules_js/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/applyBind.js
|
|
1182
|
+
var require_applyBind = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1183
|
+
var bind = require_function_bind();
|
|
1184
|
+
var $apply = require_functionApply();
|
|
1185
|
+
var actualApply = require_actualApply();
|
|
1186
|
+
/** @type {import('./applyBind')} */
|
|
1187
|
+
module.exports = function applyBind() {
|
|
1188
|
+
return actualApply(bind, $apply, arguments);
|
|
1189
|
+
};
|
|
1190
|
+
}));
|
|
1191
|
+
//#endregion
|
|
1192
|
+
//#region node_modules/.aspect_rules_js/call-bind@1.0.8/node_modules/call-bind/index.js
|
|
1193
|
+
var require_call_bind = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1194
|
+
var setFunctionLength = require_set_function_length();
|
|
1195
|
+
var $defineProperty = require_es_define_property();
|
|
1196
|
+
var callBindBasic = require_call_bind_apply_helpers();
|
|
1197
|
+
var applyBind = require_applyBind();
|
|
1198
|
+
module.exports = function callBind(originalFunction) {
|
|
1199
|
+
var func = callBindBasic(arguments);
|
|
1200
|
+
var adjustedLength = originalFunction.length - (arguments.length - 1);
|
|
1201
|
+
return setFunctionLength(func, 1 + (adjustedLength > 0 ? adjustedLength : 0), true);
|
|
1202
|
+
};
|
|
1203
|
+
if ($defineProperty) $defineProperty(module.exports, "apply", { value: applyBind });
|
|
1204
|
+
else module.exports.apply = applyBind;
|
|
1205
|
+
}));
|
|
1206
|
+
//#endregion
|
|
1207
|
+
//#region node_modules/.aspect_rules_js/call-bound@1.0.4/node_modules/call-bound/index.js
|
|
1208
|
+
var require_call_bound = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1209
|
+
var GetIntrinsic = require_get_intrinsic();
|
|
1210
|
+
var callBindBasic = require_call_bind_apply_helpers();
|
|
1211
|
+
/** @type {(thisArg: string, searchString: string, position?: number) => number} */
|
|
1212
|
+
var $indexOf = callBindBasic([GetIntrinsic("%String.prototype.indexOf%")]);
|
|
1213
|
+
/** @type {import('.')} */
|
|
1214
|
+
module.exports = function callBoundIntrinsic(name, allowMissing) {
|
|
1215
|
+
var intrinsic = GetIntrinsic(name, !!allowMissing);
|
|
1216
|
+
if (typeof intrinsic === "function" && $indexOf(name, ".prototype.") > -1) return callBindBasic([intrinsic]);
|
|
1217
|
+
return intrinsic;
|
|
1218
|
+
};
|
|
1219
|
+
}));
|
|
1220
|
+
//#endregion
|
|
1221
|
+
//#region node_modules/.aspect_rules_js/json-stable-stringify@1.3.0/node_modules/json-stable-stringify/index.js
|
|
1222
|
+
var require_json_stable_stringify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1223
|
+
/** @type {typeof JSON.stringify} */
|
|
1224
|
+
var jsonStringify = (typeof JSON !== "undefined" ? JSON : require_jsonify()).stringify;
|
|
1225
|
+
var isArray = require_isarray();
|
|
1226
|
+
var objectKeys = require_object_keys();
|
|
1227
|
+
var callBind = require_call_bind();
|
|
1228
|
+
var callBound = require_call_bound();
|
|
1229
|
+
var $join = callBound("Array.prototype.join");
|
|
1230
|
+
var $indexOf = callBound("Array.prototype.indexOf");
|
|
1231
|
+
var $splice = callBound("Array.prototype.splice");
|
|
1232
|
+
var $sort = callBound("Array.prototype.sort");
|
|
1233
|
+
/** @type {(n: number, char: string) => string} */
|
|
1234
|
+
var strRepeat = function repeat(n, char) {
|
|
1235
|
+
var str = "";
|
|
1236
|
+
for (var i = 0; i < n; i += 1) str += char;
|
|
1237
|
+
return str;
|
|
1238
|
+
};
|
|
1239
|
+
/** @type {(parent: import('.').Node, key: import('.').Key, value: unknown) => unknown} */
|
|
1240
|
+
var defaultReplacer = function(_parent, _key, value) {
|
|
1241
|
+
return value;
|
|
1242
|
+
};
|
|
1243
|
+
/** @type {import('.')} */
|
|
1244
|
+
module.exports = function stableStringify(obj) {
|
|
1245
|
+
/** @type {Parameters<import('.')>[1]} */
|
|
1246
|
+
var opts = arguments.length > 1 ? arguments[1] : void 0;
|
|
1247
|
+
var space = opts && opts.space || "";
|
|
1248
|
+
if (typeof space === "number") space = strRepeat(space, " ");
|
|
1249
|
+
var cycles = !!opts && typeof opts.cycles === "boolean" && opts.cycles;
|
|
1250
|
+
/** @type {undefined | typeof defaultReplacer} */
|
|
1251
|
+
var replacer = opts && opts.replacer ? callBind(opts.replacer) : defaultReplacer;
|
|
1252
|
+
if (opts && typeof opts.collapseEmpty !== "undefined" && typeof opts.collapseEmpty !== "boolean") throw new TypeError("`collapseEmpty` must be a boolean, if provided");
|
|
1253
|
+
var collapseEmpty = !!opts && opts.collapseEmpty;
|
|
1254
|
+
var cmpOpt = typeof opts === "function" ? opts : opts && opts.cmp;
|
|
1255
|
+
/** @type {undefined | (<T extends import('.').NonArrayNode>(node: T) => (a: Exclude<keyof T, symbol | number>, b: Exclude<keyof T, symbol | number>) => number)} */
|
|
1256
|
+
var cmp = cmpOpt && function(node) {
|
|
1257
|
+
var get = cmpOpt.length > 2 && function get(k) {
|
|
1258
|
+
return node[k];
|
|
1259
|
+
};
|
|
1260
|
+
return function(a, b) {
|
|
1261
|
+
return cmpOpt({
|
|
1262
|
+
key: a,
|
|
1263
|
+
value: node[a]
|
|
1264
|
+
}, {
|
|
1265
|
+
key: b,
|
|
1266
|
+
value: node[b]
|
|
1267
|
+
}, get ? ( /** @type {import('.').Getter} */ {
|
|
1268
|
+
__proto__: null,
|
|
1269
|
+
get
|
|
1270
|
+
}) : void 0);
|
|
1271
|
+
};
|
|
1272
|
+
};
|
|
1273
|
+
/** @type {import('.').Node[]} */
|
|
1274
|
+
var seen = [];
|
|
1275
|
+
return function stringify(parent, key, node, level) {
|
|
1276
|
+
var indent = space ? "\n" + strRepeat(level, space) : "";
|
|
1277
|
+
var colonSeparator = space ? ": " : ":";
|
|
1278
|
+
if (node && node.toJSON && typeof node.toJSON === "function") node = node.toJSON();
|
|
1279
|
+
node = replacer(parent, key, node);
|
|
1280
|
+
if (node === void 0) return;
|
|
1281
|
+
if (typeof node !== "object" || node === null) return jsonStringify(node);
|
|
1282
|
+
/** @type {(out: string[], brackets: '[]' | '{}') => string} */
|
|
1283
|
+
var groupOutput = function(out, brackets) {
|
|
1284
|
+
return collapseEmpty && out.length === 0 ? brackets : (brackets === "[]" ? "[" : "{") + $join(out, ",") + indent + (brackets === "[]" ? "]" : "}");
|
|
1285
|
+
};
|
|
1286
|
+
if (isArray(node)) {
|
|
1287
|
+
var out = [];
|
|
1288
|
+
for (var i = 0; i < node.length; i++) {
|
|
1289
|
+
var item = stringify(node, i, node[i], level + 1) || jsonStringify(null);
|
|
1290
|
+
out[out.length] = indent + space + item;
|
|
1291
|
+
}
|
|
1292
|
+
return groupOutput(out, "[]");
|
|
1293
|
+
}
|
|
1294
|
+
if ($indexOf(seen, node) !== -1) {
|
|
1295
|
+
if (cycles) return jsonStringify("__cycle__");
|
|
1296
|
+
throw new TypeError("Converting circular structure to JSON");
|
|
1297
|
+
} else seen[seen.length] = node;
|
|
1298
|
+
/** @type {import('.').Key[]} */
|
|
1299
|
+
var keys = $sort(objectKeys(node), cmp && cmp(node));
|
|
1300
|
+
var out = [];
|
|
1301
|
+
for (var i = 0; i < keys.length; i++) {
|
|
1302
|
+
var key = keys[i];
|
|
1303
|
+
var value = stringify(
|
|
1304
|
+
node,
|
|
1305
|
+
key,
|
|
1306
|
+
/** @type {import('.').NonArrayNode} */
|
|
1307
|
+
node[key],
|
|
1308
|
+
level + 1
|
|
1309
|
+
);
|
|
1310
|
+
if (!value) continue;
|
|
1311
|
+
var keyValue = jsonStringify(key) + colonSeparator + value;
|
|
1312
|
+
out[out.length] = indent + space + keyValue;
|
|
1313
|
+
}
|
|
1314
|
+
$splice(seen, $indexOf(seen, node), 1);
|
|
1315
|
+
return groupOutput(out, "{}");
|
|
1316
|
+
}({ "": obj }, "", obj, 0);
|
|
1317
|
+
};
|
|
1318
|
+
}));
|
|
1319
|
+
//#endregion
|
|
1320
|
+
//#region packages/cli-lib/console_utils.ts
|
|
1321
|
+
var import_json_stable_stringify = /* @__PURE__ */ __toESM(require_json_stable_stringify(), 1);
|
|
1322
|
+
const CLEAR_WHOLE_LINE = 0;
|
|
1323
|
+
const writeStderr = promisify(process.stderr.write).bind(process.stderr);
|
|
1324
|
+
const writeStdout = promisify(process.stdout.write).bind(process.stdout);
|
|
1325
|
+
async function clearLine$1(terminal) {
|
|
1326
|
+
if (!terminal.hasColors?.()) {
|
|
1327
|
+
if (terminal.isTTY) {
|
|
1328
|
+
if (terminal.columns > 0) await writeStderr(`\r${" ".repeat(terminal.columns - 1)}`);
|
|
1329
|
+
await writeStderr(`\r`);
|
|
1330
|
+
}
|
|
1331
|
+
} else {
|
|
1332
|
+
clearLine(terminal, CLEAR_WHOLE_LINE);
|
|
1333
|
+
cursorTo(terminal, 0, void 0);
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
const LEVEL_COLORS$1 = {
|
|
1337
|
+
debug: "green",
|
|
1338
|
+
warn: "yellow",
|
|
1339
|
+
error: "red"
|
|
1340
|
+
};
|
|
1341
|
+
function label$1(level, message) {
|
|
1342
|
+
return `[@formatjs/cli] [${styleText(LEVEL_COLORS$1[level], level.toUpperCase())}] ${message}`;
|
|
1343
|
+
}
|
|
1344
|
+
async function debug$1(message, ...args) {
|
|
1345
|
+
if (process.env.LOG_LEVEL !== "debug") return;
|
|
1346
|
+
await clearLine$1(process.stderr);
|
|
1347
|
+
await writeStderr(format(label$1("debug", message), ...args));
|
|
1348
|
+
await writeStderr("\n");
|
|
1349
|
+
}
|
|
1350
|
+
async function warn(message, ...args) {
|
|
1351
|
+
await clearLine$1(process.stderr);
|
|
1352
|
+
await writeStderr(format(label$1("warn", message), ...args));
|
|
1353
|
+
await writeStderr("\n");
|
|
1354
|
+
}
|
|
1355
|
+
function getStdinAsString() {
|
|
1356
|
+
let result = "";
|
|
1357
|
+
return new Promise((resolve) => {
|
|
1358
|
+
process.stdin.setEncoding("utf-8");
|
|
1359
|
+
process.stdin.on("readable", () => {
|
|
1360
|
+
let chunk;
|
|
1361
|
+
while (chunk = process.stdin.read()) result += chunk;
|
|
1362
|
+
});
|
|
1363
|
+
process.stdin.on("end", () => {
|
|
1364
|
+
resolve(result);
|
|
1365
|
+
});
|
|
1366
|
+
});
|
|
1367
|
+
}
|
|
1368
|
+
//#endregion
|
|
43
1369
|
//#region node_modules/.aspect_rules_js/@formatjs+icu-skeleton-parser@0.0.0/node_modules/@formatjs/icu-skeleton-parser/index.js
|
|
44
1370
|
/**
|
|
45
1371
|
* https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
|
@@ -522,12 +1848,6 @@ let SKELETON_TYPE$1 = /* @__PURE__ */ function(SKELETON_TYPE) {
|
|
|
522
1848
|
SKELETON_TYPE[SKELETON_TYPE["dateTime"] = 1] = "dateTime";
|
|
523
1849
|
return SKELETON_TYPE;
|
|
524
1850
|
}({});
|
|
525
|
-
/**
|
|
526
|
-
* Type Guards
|
|
527
|
-
*/
|
|
528
|
-
function isLiteralElement$1(el) {
|
|
529
|
-
return el.type === TYPE$2.literal;
|
|
530
|
-
}
|
|
531
1851
|
function isArgumentElement$1(el) {
|
|
532
1852
|
return el.type === TYPE$2.argument;
|
|
533
1853
|
}
|
|
@@ -1710,2123 +3030,797 @@ const timeData = {
|
|
|
1710
3030
|
"te-IN": [
|
|
1711
3031
|
"hB",
|
|
1712
3032
|
"h",
|
|
1713
|
-
"H"
|
|
1714
|
-
],
|
|
1715
|
-
"zu-ZA": [
|
|
1716
|
-
"H",
|
|
1717
|
-
"hB",
|
|
1718
|
-
"hb",
|
|
1719
|
-
"h"
|
|
1720
|
-
]
|
|
1721
|
-
};
|
|
1722
|
-
/**
|
|
1723
|
-
* Returns the best matching date time pattern if a date time skeleton
|
|
1724
|
-
* pattern is provided with a locale. Follows the Unicode specification:
|
|
1725
|
-
* https://www.unicode.org/reports/tr35/tr35-dates.html#table-mapping-requested-time-skeletons-to-patterns
|
|
1726
|
-
* @param skeleton date time skeleton pattern that possibly includes j, J or C
|
|
1727
|
-
* @param locale
|
|
1728
|
-
*/
|
|
1729
|
-
function getBestPattern(skeleton, locale) {
|
|
1730
|
-
let skeletonCopy = "";
|
|
1731
|
-
for (let patternPos = 0; patternPos < skeleton.length; patternPos++) {
|
|
1732
|
-
const patternChar = skeleton.charAt(patternPos);
|
|
1733
|
-
if (patternChar === "j") {
|
|
1734
|
-
let extraLength = 0;
|
|
1735
|
-
while (patternPos + 1 < skeleton.length && skeleton.charAt(patternPos + 1) === patternChar) {
|
|
1736
|
-
extraLength++;
|
|
1737
|
-
patternPos++;
|
|
1738
|
-
}
|
|
1739
|
-
let hourLen = 1 + (extraLength & 1);
|
|
1740
|
-
let dayPeriodLen = extraLength < 2 ? 1 : 3 + (extraLength >> 1);
|
|
1741
|
-
let dayPeriodChar = "a";
|
|
1742
|
-
let hourChar = getDefaultHourSymbolFromLocale(locale);
|
|
1743
|
-
if (hourChar == "H" || hourChar == "k") dayPeriodLen = 0;
|
|
1744
|
-
while (dayPeriodLen-- > 0) skeletonCopy += dayPeriodChar;
|
|
1745
|
-
while (hourLen-- > 0) skeletonCopy = hourChar + skeletonCopy;
|
|
1746
|
-
} else if (patternChar === "J") skeletonCopy += "H";
|
|
1747
|
-
else skeletonCopy += patternChar;
|
|
1748
|
-
}
|
|
1749
|
-
return skeletonCopy;
|
|
1750
|
-
}
|
|
1751
|
-
/**
|
|
1752
|
-
* Maps the [hour cycle type](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/hourCycle)
|
|
1753
|
-
* of the given `locale` to the corresponding time pattern.
|
|
1754
|
-
* @param locale
|
|
1755
|
-
*/
|
|
1756
|
-
function getDefaultHourSymbolFromLocale(locale) {
|
|
1757
|
-
let hourCycle = locale.hourCycle;
|
|
1758
|
-
if (hourCycle === void 0 && locale.hourCycles && locale.hourCycles.length) hourCycle = locale.hourCycles[0];
|
|
1759
|
-
if (hourCycle) switch (hourCycle) {
|
|
1760
|
-
case "h24": return "k";
|
|
1761
|
-
case "h23": return "H";
|
|
1762
|
-
case "h12": return "h";
|
|
1763
|
-
case "h11": return "K";
|
|
1764
|
-
default: throw new Error("Invalid hourCycle");
|
|
1765
|
-
}
|
|
1766
|
-
const languageTag = locale.language;
|
|
1767
|
-
let regionTag;
|
|
1768
|
-
if (languageTag !== "root") regionTag = locale.maximize().region;
|
|
1769
|
-
return (timeData[regionTag || ""] || timeData[languageTag || ""] || timeData[`${languageTag}-001`] || timeData["001"])[0];
|
|
1770
|
-
}
|
|
1771
|
-
const SPACE_SEPARATOR_START_REGEX = new RegExp(`^${SPACE_SEPARATOR_REGEX.source}*`);
|
|
1772
|
-
const SPACE_SEPARATOR_END_REGEX = new RegExp(`${SPACE_SEPARATOR_REGEX.source}*$`);
|
|
1773
|
-
function createLocation(start, end) {
|
|
1774
|
-
return {
|
|
1775
|
-
start,
|
|
1776
|
-
end
|
|
1777
|
-
};
|
|
1778
|
-
}
|
|
1779
|
-
const hasNativeFromEntries = !!Object.fromEntries;
|
|
1780
|
-
const hasTrimStart = !!String.prototype.trimStart;
|
|
1781
|
-
const hasTrimEnd = !!String.prototype.trimEnd;
|
|
1782
|
-
const fromEntries = hasNativeFromEntries ? Object.fromEntries : function fromEntries(entries) {
|
|
1783
|
-
const obj = {};
|
|
1784
|
-
for (const [k, v] of entries) obj[k] = v;
|
|
1785
|
-
return obj;
|
|
1786
|
-
};
|
|
1787
|
-
const trimStart = hasTrimStart ? function trimStart(s) {
|
|
1788
|
-
return s.trimStart();
|
|
1789
|
-
} : function trimStart(s) {
|
|
1790
|
-
return s.replace(SPACE_SEPARATOR_START_REGEX, "");
|
|
1791
|
-
};
|
|
1792
|
-
const trimEnd = hasTrimEnd ? function trimEnd(s) {
|
|
1793
|
-
return s.trimEnd();
|
|
1794
|
-
} : function trimEnd(s) {
|
|
1795
|
-
return s.replace(SPACE_SEPARATOR_END_REGEX, "");
|
|
1796
|
-
};
|
|
1797
|
-
const IDENTIFIER_PREFIX_RE = /* @__PURE__ */ new RegExp("([^\\p{White_Space}\\p{Pattern_Syntax}]*)", "yu");
|
|
1798
|
-
function matchIdentifierAtIndex(s, index) {
|
|
1799
|
-
IDENTIFIER_PREFIX_RE.lastIndex = index;
|
|
1800
|
-
return IDENTIFIER_PREFIX_RE.exec(s)[1] ?? "";
|
|
1801
|
-
}
|
|
1802
|
-
var Parser = class {
|
|
1803
|
-
constructor(message, options = {}) {
|
|
1804
|
-
this.message = message;
|
|
1805
|
-
this.position = {
|
|
1806
|
-
offset: 0,
|
|
1807
|
-
line: 1,
|
|
1808
|
-
column: 1
|
|
1809
|
-
};
|
|
1810
|
-
this.ignoreTag = !!options.ignoreTag;
|
|
1811
|
-
this.locale = options.locale;
|
|
1812
|
-
this.requiresOtherClause = !!options.requiresOtherClause;
|
|
1813
|
-
this.shouldParseSkeletons = !!options.shouldParseSkeletons;
|
|
1814
|
-
}
|
|
1815
|
-
parse() {
|
|
1816
|
-
if (this.offset() !== 0) throw Error("parser can only be used once");
|
|
1817
|
-
return this.parseMessage(0, "", false);
|
|
1818
|
-
}
|
|
1819
|
-
parseMessage(nestingLevel, parentArgType, expectingCloseTag) {
|
|
1820
|
-
let elements = [];
|
|
1821
|
-
while (!this.isEOF()) {
|
|
1822
|
-
const char = this.char();
|
|
1823
|
-
if (char === 123) {
|
|
1824
|
-
const result = this.parseArgument(nestingLevel, expectingCloseTag);
|
|
1825
|
-
if (result.err) return result;
|
|
1826
|
-
elements.push(result.val);
|
|
1827
|
-
} else if (char === 125 && nestingLevel > 0) break;
|
|
1828
|
-
else if (char === 35 && (parentArgType === "plural" || parentArgType === "selectordinal")) {
|
|
1829
|
-
const position = this.clonePosition();
|
|
1830
|
-
this.bump();
|
|
1831
|
-
elements.push({
|
|
1832
|
-
type: TYPE$2.pound,
|
|
1833
|
-
location: createLocation(position, this.clonePosition())
|
|
1834
|
-
});
|
|
1835
|
-
} else if (char === 60 && !this.ignoreTag && this.peek() === 47) if (expectingCloseTag) break;
|
|
1836
|
-
else return this.error(ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(this.clonePosition(), this.clonePosition()));
|
|
1837
|
-
else if (char === 60 && !this.ignoreTag && _isAlpha(this.peek() || 0)) {
|
|
1838
|
-
const result = this.parseTag(nestingLevel, parentArgType);
|
|
1839
|
-
if (result.err) return result;
|
|
1840
|
-
elements.push(result.val);
|
|
1841
|
-
} else {
|
|
1842
|
-
const result = this.parseLiteral(nestingLevel, parentArgType);
|
|
1843
|
-
if (result.err) return result;
|
|
1844
|
-
elements.push(result.val);
|
|
1845
|
-
}
|
|
1846
|
-
}
|
|
1847
|
-
return {
|
|
1848
|
-
val: elements,
|
|
1849
|
-
err: null
|
|
1850
|
-
};
|
|
1851
|
-
}
|
|
1852
|
-
/**
|
|
1853
|
-
* A tag name must start with an ASCII lower/upper case letter. The grammar is based on the
|
|
1854
|
-
* [custom element name][] except that a dash is NOT always mandatory and uppercase letters
|
|
1855
|
-
* are accepted:
|
|
1856
|
-
*
|
|
1857
|
-
* ```
|
|
1858
|
-
* tag ::= "<" tagName (whitespace)* "/>" | "<" tagName (whitespace)* ">" message "</" tagName (whitespace)* ">"
|
|
1859
|
-
* tagName ::= [a-z] (PENChar)*
|
|
1860
|
-
* PENChar ::=
|
|
1861
|
-
* "-" | "." | [0-9] | "_" | [a-z] | [A-Z] | #xB7 | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x37D] |
|
|
1862
|
-
* [#x37F-#x1FFF] | [#x200C-#x200D] | [#x203F-#x2040] | [#x2070-#x218F] | [#x2C00-#x2FEF] |
|
|
1863
|
-
* [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
|
|
1864
|
-
* ```
|
|
1865
|
-
*
|
|
1866
|
-
* [custom element name]: https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
|
|
1867
|
-
* NOTE: We're a bit more lax here since HTML technically does not allow uppercase HTML element but we do
|
|
1868
|
-
* since other tag-based engines like React allow it
|
|
1869
|
-
*/
|
|
1870
|
-
parseTag(nestingLevel, parentArgType) {
|
|
1871
|
-
const startPosition = this.clonePosition();
|
|
1872
|
-
this.bump();
|
|
1873
|
-
const tagName = this.parseTagName();
|
|
1874
|
-
this.bumpSpace();
|
|
1875
|
-
if (this.bumpIf("/>")) return {
|
|
1876
|
-
val: {
|
|
1877
|
-
type: TYPE$2.literal,
|
|
1878
|
-
value: `<${tagName}/>`,
|
|
1879
|
-
location: createLocation(startPosition, this.clonePosition())
|
|
1880
|
-
},
|
|
1881
|
-
err: null
|
|
1882
|
-
};
|
|
1883
|
-
else if (this.bumpIf(">")) {
|
|
1884
|
-
const childrenResult = this.parseMessage(nestingLevel + 1, parentArgType, true);
|
|
1885
|
-
if (childrenResult.err) return childrenResult;
|
|
1886
|
-
const children = childrenResult.val;
|
|
1887
|
-
const endTagStartPosition = this.clonePosition();
|
|
1888
|
-
if (this.bumpIf("</")) {
|
|
1889
|
-
if (this.isEOF() || !_isAlpha(this.char())) return this.error(ErrorKind.INVALID_TAG, createLocation(endTagStartPosition, this.clonePosition()));
|
|
1890
|
-
const closingTagNameStartPosition = this.clonePosition();
|
|
1891
|
-
if (tagName !== this.parseTagName()) return this.error(ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(closingTagNameStartPosition, this.clonePosition()));
|
|
1892
|
-
this.bumpSpace();
|
|
1893
|
-
if (!this.bumpIf(">")) return this.error(ErrorKind.INVALID_TAG, createLocation(endTagStartPosition, this.clonePosition()));
|
|
1894
|
-
return {
|
|
1895
|
-
val: {
|
|
1896
|
-
type: TYPE$2.tag,
|
|
1897
|
-
value: tagName,
|
|
1898
|
-
children,
|
|
1899
|
-
location: createLocation(startPosition, this.clonePosition())
|
|
1900
|
-
},
|
|
1901
|
-
err: null
|
|
1902
|
-
};
|
|
1903
|
-
} else return this.error(ErrorKind.UNCLOSED_TAG, createLocation(startPosition, this.clonePosition()));
|
|
1904
|
-
} else return this.error(ErrorKind.INVALID_TAG, createLocation(startPosition, this.clonePosition()));
|
|
1905
|
-
}
|
|
1906
|
-
/**
|
|
1907
|
-
* This method assumes that the caller has peeked ahead for the first tag character.
|
|
1908
|
-
*/
|
|
1909
|
-
parseTagName() {
|
|
1910
|
-
const startOffset = this.offset();
|
|
1911
|
-
this.bump();
|
|
1912
|
-
while (!this.isEOF() && _isPotentialElementNameChar(this.char())) this.bump();
|
|
1913
|
-
return this.message.slice(startOffset, this.offset());
|
|
1914
|
-
}
|
|
1915
|
-
parseLiteral(nestingLevel, parentArgType) {
|
|
1916
|
-
const start = this.clonePosition();
|
|
1917
|
-
let value = "";
|
|
1918
|
-
while (true) {
|
|
1919
|
-
const parseQuoteResult = this.tryParseQuote(parentArgType);
|
|
1920
|
-
if (parseQuoteResult) {
|
|
1921
|
-
value += parseQuoteResult;
|
|
1922
|
-
continue;
|
|
1923
|
-
}
|
|
1924
|
-
const parseUnquotedResult = this.tryParseUnquoted(nestingLevel, parentArgType);
|
|
1925
|
-
if (parseUnquotedResult) {
|
|
1926
|
-
value += parseUnquotedResult;
|
|
1927
|
-
continue;
|
|
1928
|
-
}
|
|
1929
|
-
const parseLeftAngleResult = this.tryParseLeftAngleBracket();
|
|
1930
|
-
if (parseLeftAngleResult) {
|
|
1931
|
-
value += parseLeftAngleResult;
|
|
1932
|
-
continue;
|
|
1933
|
-
}
|
|
1934
|
-
break;
|
|
1935
|
-
}
|
|
1936
|
-
const location = createLocation(start, this.clonePosition());
|
|
1937
|
-
return {
|
|
1938
|
-
val: {
|
|
1939
|
-
type: TYPE$2.literal,
|
|
1940
|
-
value,
|
|
1941
|
-
location
|
|
1942
|
-
},
|
|
1943
|
-
err: null
|
|
1944
|
-
};
|
|
1945
|
-
}
|
|
1946
|
-
tryParseLeftAngleBracket() {
|
|
1947
|
-
if (!this.isEOF() && this.char() === 60 && (this.ignoreTag || !_isAlphaOrSlash(this.peek() || 0))) {
|
|
1948
|
-
this.bump();
|
|
1949
|
-
return "<";
|
|
1950
|
-
}
|
|
1951
|
-
return null;
|
|
1952
|
-
}
|
|
1953
|
-
/**
|
|
1954
|
-
* Starting with ICU 4.8, an ASCII apostrophe only starts quoted text if it immediately precedes
|
|
1955
|
-
* a character that requires quoting (that is, "only where needed"), and works the same in
|
|
1956
|
-
* nested messages as on the top level of the pattern. The new behavior is otherwise compatible.
|
|
1957
|
-
*/
|
|
1958
|
-
tryParseQuote(parentArgType) {
|
|
1959
|
-
if (this.isEOF() || this.char() !== 39) return null;
|
|
1960
|
-
switch (this.peek()) {
|
|
1961
|
-
case 39:
|
|
1962
|
-
this.bump();
|
|
1963
|
-
this.bump();
|
|
1964
|
-
return "'";
|
|
1965
|
-
case 123:
|
|
1966
|
-
case 60:
|
|
1967
|
-
case 62:
|
|
1968
|
-
case 125: break;
|
|
1969
|
-
case 35:
|
|
1970
|
-
if (parentArgType === "plural" || parentArgType === "selectordinal") break;
|
|
1971
|
-
return null;
|
|
1972
|
-
default: return null;
|
|
1973
|
-
}
|
|
1974
|
-
this.bump();
|
|
1975
|
-
const codePoints = [this.char()];
|
|
1976
|
-
this.bump();
|
|
1977
|
-
while (!this.isEOF()) {
|
|
1978
|
-
const ch = this.char();
|
|
1979
|
-
if (ch === 39) if (this.peek() === 39) {
|
|
1980
|
-
codePoints.push(39);
|
|
1981
|
-
this.bump();
|
|
1982
|
-
} else {
|
|
1983
|
-
this.bump();
|
|
1984
|
-
break;
|
|
1985
|
-
}
|
|
1986
|
-
else codePoints.push(ch);
|
|
1987
|
-
this.bump();
|
|
1988
|
-
}
|
|
1989
|
-
return String.fromCodePoint(...codePoints);
|
|
1990
|
-
}
|
|
1991
|
-
tryParseUnquoted(nestingLevel, parentArgType) {
|
|
1992
|
-
if (this.isEOF()) return null;
|
|
1993
|
-
const ch = this.char();
|
|
1994
|
-
if (ch === 60 || ch === 123 || ch === 35 && (parentArgType === "plural" || parentArgType === "selectordinal") || ch === 125 && nestingLevel > 0) return null;
|
|
1995
|
-
else {
|
|
1996
|
-
this.bump();
|
|
1997
|
-
return String.fromCodePoint(ch);
|
|
1998
|
-
}
|
|
1999
|
-
}
|
|
2000
|
-
parseArgument(nestingLevel, expectingCloseTag) {
|
|
2001
|
-
const openingBracePosition = this.clonePosition();
|
|
2002
|
-
this.bump();
|
|
2003
|
-
this.bumpSpace();
|
|
2004
|
-
if (this.isEOF()) return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
|
|
2005
|
-
if (this.char() === 125) {
|
|
2006
|
-
this.bump();
|
|
2007
|
-
return this.error(ErrorKind.EMPTY_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));
|
|
2008
|
-
}
|
|
2009
|
-
let value = this.parseIdentifierIfPossible().value;
|
|
2010
|
-
if (!value) return this.error(ErrorKind.MALFORMED_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));
|
|
2011
|
-
this.bumpSpace();
|
|
2012
|
-
if (this.isEOF()) return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
|
|
2013
|
-
switch (this.char()) {
|
|
2014
|
-
case 125:
|
|
2015
|
-
this.bump();
|
|
2016
|
-
return {
|
|
2017
|
-
val: {
|
|
2018
|
-
type: TYPE$2.argument,
|
|
2019
|
-
value,
|
|
2020
|
-
location: createLocation(openingBracePosition, this.clonePosition())
|
|
2021
|
-
},
|
|
2022
|
-
err: null
|
|
2023
|
-
};
|
|
2024
|
-
case 44:
|
|
2025
|
-
this.bump();
|
|
2026
|
-
this.bumpSpace();
|
|
2027
|
-
if (this.isEOF()) return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
|
|
2028
|
-
return this.parseArgumentOptions(nestingLevel, expectingCloseTag, value, openingBracePosition);
|
|
2029
|
-
default: return this.error(ErrorKind.MALFORMED_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));
|
|
2030
|
-
}
|
|
2031
|
-
}
|
|
2032
|
-
/**
|
|
2033
|
-
* Advance the parser until the end of the identifier, if it is currently on
|
|
2034
|
-
* an identifier character. Return an empty string otherwise.
|
|
2035
|
-
*/
|
|
2036
|
-
parseIdentifierIfPossible() {
|
|
2037
|
-
const startingPosition = this.clonePosition();
|
|
2038
|
-
const startOffset = this.offset();
|
|
2039
|
-
const value = matchIdentifierAtIndex(this.message, startOffset);
|
|
2040
|
-
const endOffset = startOffset + value.length;
|
|
2041
|
-
this.bumpTo(endOffset);
|
|
2042
|
-
return {
|
|
2043
|
-
value,
|
|
2044
|
-
location: createLocation(startingPosition, this.clonePosition())
|
|
2045
|
-
};
|
|
2046
|
-
}
|
|
2047
|
-
parseArgumentOptions(nestingLevel, expectingCloseTag, value, openingBracePosition) {
|
|
2048
|
-
let typeStartPosition = this.clonePosition();
|
|
2049
|
-
let argType = this.parseIdentifierIfPossible().value;
|
|
2050
|
-
let typeEndPosition = this.clonePosition();
|
|
2051
|
-
switch (argType) {
|
|
2052
|
-
case "": return this.error(ErrorKind.EXPECT_ARGUMENT_TYPE, createLocation(typeStartPosition, typeEndPosition));
|
|
2053
|
-
case "number":
|
|
2054
|
-
case "date":
|
|
2055
|
-
case "time": {
|
|
2056
|
-
this.bumpSpace();
|
|
2057
|
-
let styleAndLocation = null;
|
|
2058
|
-
if (this.bumpIf(",")) {
|
|
2059
|
-
this.bumpSpace();
|
|
2060
|
-
const styleStartPosition = this.clonePosition();
|
|
2061
|
-
const result = this.parseSimpleArgStyleIfPossible();
|
|
2062
|
-
if (result.err) return result;
|
|
2063
|
-
const style = trimEnd(result.val);
|
|
2064
|
-
if (style.length === 0) return this.error(ErrorKind.EXPECT_ARGUMENT_STYLE, createLocation(this.clonePosition(), this.clonePosition()));
|
|
2065
|
-
styleAndLocation = {
|
|
2066
|
-
style,
|
|
2067
|
-
styleLocation: createLocation(styleStartPosition, this.clonePosition())
|
|
2068
|
-
};
|
|
2069
|
-
}
|
|
2070
|
-
const argCloseResult = this.tryParseArgumentClose(openingBracePosition);
|
|
2071
|
-
if (argCloseResult.err) return argCloseResult;
|
|
2072
|
-
const location = createLocation(openingBracePosition, this.clonePosition());
|
|
2073
|
-
if (styleAndLocation && styleAndLocation.style.startsWith("::")) {
|
|
2074
|
-
let skeleton = trimStart(styleAndLocation.style.slice(2));
|
|
2075
|
-
if (argType === "number") {
|
|
2076
|
-
const result = this.parseNumberSkeletonFromString(skeleton, styleAndLocation.styleLocation);
|
|
2077
|
-
if (result.err) return result;
|
|
2078
|
-
return {
|
|
2079
|
-
val: {
|
|
2080
|
-
type: TYPE$2.number,
|
|
2081
|
-
value,
|
|
2082
|
-
location,
|
|
2083
|
-
style: result.val
|
|
2084
|
-
},
|
|
2085
|
-
err: null
|
|
2086
|
-
};
|
|
2087
|
-
} else {
|
|
2088
|
-
if (skeleton.length === 0) return this.error(ErrorKind.EXPECT_DATE_TIME_SKELETON, location);
|
|
2089
|
-
let dateTimePattern = skeleton;
|
|
2090
|
-
if (this.locale) dateTimePattern = getBestPattern(skeleton, this.locale);
|
|
2091
|
-
const style = {
|
|
2092
|
-
type: SKELETON_TYPE$1.dateTime,
|
|
2093
|
-
pattern: dateTimePattern,
|
|
2094
|
-
location: styleAndLocation.styleLocation,
|
|
2095
|
-
parsedOptions: this.shouldParseSkeletons ? parseDateTimeSkeleton(dateTimePattern) : {}
|
|
2096
|
-
};
|
|
2097
|
-
return {
|
|
2098
|
-
val: {
|
|
2099
|
-
type: argType === "date" ? TYPE$2.date : TYPE$2.time,
|
|
2100
|
-
value,
|
|
2101
|
-
location,
|
|
2102
|
-
style
|
|
2103
|
-
},
|
|
2104
|
-
err: null
|
|
2105
|
-
};
|
|
2106
|
-
}
|
|
2107
|
-
}
|
|
2108
|
-
return {
|
|
2109
|
-
val: {
|
|
2110
|
-
type: argType === "number" ? TYPE$2.number : argType === "date" ? TYPE$2.date : TYPE$2.time,
|
|
2111
|
-
value,
|
|
2112
|
-
location,
|
|
2113
|
-
style: styleAndLocation?.style ?? null
|
|
2114
|
-
},
|
|
2115
|
-
err: null
|
|
2116
|
-
};
|
|
2117
|
-
}
|
|
2118
|
-
case "plural":
|
|
2119
|
-
case "selectordinal":
|
|
2120
|
-
case "select": {
|
|
2121
|
-
const typeEndPosition = this.clonePosition();
|
|
2122
|
-
this.bumpSpace();
|
|
2123
|
-
if (!this.bumpIf(",")) return this.error(ErrorKind.EXPECT_SELECT_ARGUMENT_OPTIONS, createLocation(typeEndPosition, { ...typeEndPosition }));
|
|
2124
|
-
this.bumpSpace();
|
|
2125
|
-
let identifierAndLocation = this.parseIdentifierIfPossible();
|
|
2126
|
-
let pluralOffset = 0;
|
|
2127
|
-
if (argType !== "select" && identifierAndLocation.value === "offset") {
|
|
2128
|
-
if (!this.bumpIf(":")) return this.error(ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, createLocation(this.clonePosition(), this.clonePosition()));
|
|
2129
|
-
this.bumpSpace();
|
|
2130
|
-
const result = this.tryParseDecimalInteger(ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, ErrorKind.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);
|
|
2131
|
-
if (result.err) return result;
|
|
2132
|
-
this.bumpSpace();
|
|
2133
|
-
identifierAndLocation = this.parseIdentifierIfPossible();
|
|
2134
|
-
pluralOffset = result.val;
|
|
2135
|
-
}
|
|
2136
|
-
const optionsResult = this.tryParsePluralOrSelectOptions(nestingLevel, argType, expectingCloseTag, identifierAndLocation);
|
|
2137
|
-
if (optionsResult.err) return optionsResult;
|
|
2138
|
-
const argCloseResult = this.tryParseArgumentClose(openingBracePosition);
|
|
2139
|
-
if (argCloseResult.err) return argCloseResult;
|
|
2140
|
-
const location = createLocation(openingBracePosition, this.clonePosition());
|
|
2141
|
-
if (argType === "select") return {
|
|
2142
|
-
val: {
|
|
2143
|
-
type: TYPE$2.select,
|
|
2144
|
-
value,
|
|
2145
|
-
options: fromEntries(optionsResult.val),
|
|
2146
|
-
location
|
|
2147
|
-
},
|
|
2148
|
-
err: null
|
|
2149
|
-
};
|
|
2150
|
-
else return {
|
|
2151
|
-
val: {
|
|
2152
|
-
type: TYPE$2.plural,
|
|
2153
|
-
value,
|
|
2154
|
-
options: fromEntries(optionsResult.val),
|
|
2155
|
-
offset: pluralOffset,
|
|
2156
|
-
pluralType: argType === "plural" ? "cardinal" : "ordinal",
|
|
2157
|
-
location
|
|
2158
|
-
},
|
|
2159
|
-
err: null
|
|
2160
|
-
};
|
|
2161
|
-
}
|
|
2162
|
-
default: return this.error(ErrorKind.INVALID_ARGUMENT_TYPE, createLocation(typeStartPosition, typeEndPosition));
|
|
2163
|
-
}
|
|
2164
|
-
}
|
|
2165
|
-
tryParseArgumentClose(openingBracePosition) {
|
|
2166
|
-
if (this.isEOF() || this.char() !== 125) return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
|
|
2167
|
-
this.bump();
|
|
2168
|
-
return {
|
|
2169
|
-
val: true,
|
|
2170
|
-
err: null
|
|
2171
|
-
};
|
|
2172
|
-
}
|
|
2173
|
-
/**
|
|
2174
|
-
* See: https://github.com/unicode-org/icu/blob/af7ed1f6d2298013dc303628438ec4abe1f16479/icu4c/source/common/messagepattern.cpp#L659
|
|
2175
|
-
*/
|
|
2176
|
-
parseSimpleArgStyleIfPossible() {
|
|
2177
|
-
let nestedBraces = 0;
|
|
2178
|
-
const startPosition = this.clonePosition();
|
|
2179
|
-
while (!this.isEOF()) switch (this.char()) {
|
|
2180
|
-
case 39: {
|
|
2181
|
-
this.bump();
|
|
2182
|
-
let apostrophePosition = this.clonePosition();
|
|
2183
|
-
if (!this.bumpUntil("'")) return this.error(ErrorKind.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE, createLocation(apostrophePosition, this.clonePosition()));
|
|
2184
|
-
this.bump();
|
|
2185
|
-
break;
|
|
2186
|
-
}
|
|
2187
|
-
case 123:
|
|
2188
|
-
nestedBraces += 1;
|
|
2189
|
-
this.bump();
|
|
2190
|
-
break;
|
|
2191
|
-
case 125:
|
|
2192
|
-
if (nestedBraces > 0) nestedBraces -= 1;
|
|
2193
|
-
else return {
|
|
2194
|
-
val: this.message.slice(startPosition.offset, this.offset()),
|
|
2195
|
-
err: null
|
|
2196
|
-
};
|
|
2197
|
-
break;
|
|
2198
|
-
default:
|
|
2199
|
-
this.bump();
|
|
2200
|
-
break;
|
|
2201
|
-
}
|
|
2202
|
-
return {
|
|
2203
|
-
val: this.message.slice(startPosition.offset, this.offset()),
|
|
2204
|
-
err: null
|
|
2205
|
-
};
|
|
2206
|
-
}
|
|
2207
|
-
parseNumberSkeletonFromString(skeleton, location) {
|
|
2208
|
-
let tokens = [];
|
|
2209
|
-
try {
|
|
2210
|
-
tokens = parseNumberSkeletonFromString(skeleton);
|
|
2211
|
-
} catch {
|
|
2212
|
-
return this.error(ErrorKind.INVALID_NUMBER_SKELETON, location);
|
|
2213
|
-
}
|
|
2214
|
-
return {
|
|
2215
|
-
val: {
|
|
2216
|
-
type: SKELETON_TYPE$1.number,
|
|
2217
|
-
tokens,
|
|
2218
|
-
location,
|
|
2219
|
-
parsedOptions: this.shouldParseSkeletons ? parseNumberSkeleton(tokens) : {}
|
|
2220
|
-
},
|
|
2221
|
-
err: null
|
|
2222
|
-
};
|
|
2223
|
-
}
|
|
2224
|
-
/**
|
|
2225
|
-
* @param nesting_level The current nesting level of messages.
|
|
2226
|
-
* This can be positive when parsing message fragment in select or plural argument options.
|
|
2227
|
-
* @param parent_arg_type The parent argument's type.
|
|
2228
|
-
* @param parsed_first_identifier If provided, this is the first identifier-like selector of
|
|
2229
|
-
* the argument. It is a by-product of a previous parsing attempt.
|
|
2230
|
-
* @param expecting_close_tag If true, this message is directly or indirectly nested inside
|
|
2231
|
-
* between a pair of opening and closing tags. The nested message will not parse beyond
|
|
2232
|
-
* the closing tag boundary.
|
|
2233
|
-
*/
|
|
2234
|
-
tryParsePluralOrSelectOptions(nestingLevel, parentArgType, expectCloseTag, parsedFirstIdentifier) {
|
|
2235
|
-
let hasOtherClause = false;
|
|
2236
|
-
const options = [];
|
|
2237
|
-
const parsedSelectors = /* @__PURE__ */ new Set();
|
|
2238
|
-
let { value: selector, location: selectorLocation } = parsedFirstIdentifier;
|
|
2239
|
-
while (true) {
|
|
2240
|
-
if (selector.length === 0) {
|
|
2241
|
-
const startPosition = this.clonePosition();
|
|
2242
|
-
if (parentArgType !== "select" && this.bumpIf("=")) {
|
|
2243
|
-
const result = this.tryParseDecimalInteger(ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, ErrorKind.INVALID_PLURAL_ARGUMENT_SELECTOR);
|
|
2244
|
-
if (result.err) return result;
|
|
2245
|
-
selectorLocation = createLocation(startPosition, this.clonePosition());
|
|
2246
|
-
selector = this.message.slice(startPosition.offset, this.offset());
|
|
2247
|
-
} else break;
|
|
2248
|
-
}
|
|
2249
|
-
if (parsedSelectors.has(selector)) return this.error(parentArgType === "select" ? ErrorKind.DUPLICATE_SELECT_ARGUMENT_SELECTOR : ErrorKind.DUPLICATE_PLURAL_ARGUMENT_SELECTOR, selectorLocation);
|
|
2250
|
-
if (selector === "other") hasOtherClause = true;
|
|
2251
|
-
this.bumpSpace();
|
|
2252
|
-
const openingBracePosition = this.clonePosition();
|
|
2253
|
-
if (!this.bumpIf("{")) return this.error(parentArgType === "select" ? ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT : ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT, createLocation(this.clonePosition(), this.clonePosition()));
|
|
2254
|
-
const fragmentResult = this.parseMessage(nestingLevel + 1, parentArgType, expectCloseTag);
|
|
2255
|
-
if (fragmentResult.err) return fragmentResult;
|
|
2256
|
-
const argCloseResult = this.tryParseArgumentClose(openingBracePosition);
|
|
2257
|
-
if (argCloseResult.err) return argCloseResult;
|
|
2258
|
-
options.push([selector, {
|
|
2259
|
-
value: fragmentResult.val,
|
|
2260
|
-
location: createLocation(openingBracePosition, this.clonePosition())
|
|
2261
|
-
}]);
|
|
2262
|
-
parsedSelectors.add(selector);
|
|
2263
|
-
this.bumpSpace();
|
|
2264
|
-
({value: selector, location: selectorLocation} = this.parseIdentifierIfPossible());
|
|
2265
|
-
}
|
|
2266
|
-
if (options.length === 0) return this.error(parentArgType === "select" ? ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR : ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, createLocation(this.clonePosition(), this.clonePosition()));
|
|
2267
|
-
if (this.requiresOtherClause && !hasOtherClause) return this.error(ErrorKind.MISSING_OTHER_CLAUSE, createLocation(this.clonePosition(), this.clonePosition()));
|
|
2268
|
-
return {
|
|
2269
|
-
val: options,
|
|
2270
|
-
err: null
|
|
2271
|
-
};
|
|
2272
|
-
}
|
|
2273
|
-
tryParseDecimalInteger(expectNumberError, invalidNumberError) {
|
|
2274
|
-
let sign = 1;
|
|
2275
|
-
const startingPosition = this.clonePosition();
|
|
2276
|
-
if (this.bumpIf("+")) {} else if (this.bumpIf("-")) sign = -1;
|
|
2277
|
-
let hasDigits = false;
|
|
2278
|
-
let decimal = 0;
|
|
2279
|
-
while (!this.isEOF()) {
|
|
2280
|
-
const ch = this.char();
|
|
2281
|
-
if (ch >= 48 && ch <= 57) {
|
|
2282
|
-
hasDigits = true;
|
|
2283
|
-
decimal = decimal * 10 + (ch - 48);
|
|
2284
|
-
this.bump();
|
|
2285
|
-
} else break;
|
|
2286
|
-
}
|
|
2287
|
-
const location = createLocation(startingPosition, this.clonePosition());
|
|
2288
|
-
if (!hasDigits) return this.error(expectNumberError, location);
|
|
2289
|
-
decimal *= sign;
|
|
2290
|
-
if (!Number.isSafeInteger(decimal)) return this.error(invalidNumberError, location);
|
|
2291
|
-
return {
|
|
2292
|
-
val: decimal,
|
|
2293
|
-
err: null
|
|
2294
|
-
};
|
|
2295
|
-
}
|
|
2296
|
-
offset() {
|
|
2297
|
-
return this.position.offset;
|
|
2298
|
-
}
|
|
2299
|
-
isEOF() {
|
|
2300
|
-
return this.offset() === this.message.length;
|
|
2301
|
-
}
|
|
2302
|
-
clonePosition() {
|
|
2303
|
-
return {
|
|
2304
|
-
offset: this.position.offset,
|
|
2305
|
-
line: this.position.line,
|
|
2306
|
-
column: this.position.column
|
|
2307
|
-
};
|
|
2308
|
-
}
|
|
2309
|
-
/**
|
|
2310
|
-
* Return the code point at the current position of the parser.
|
|
2311
|
-
* Throws if the index is out of bound.
|
|
2312
|
-
*/
|
|
2313
|
-
char() {
|
|
2314
|
-
const offset = this.position.offset;
|
|
2315
|
-
if (offset >= this.message.length) throw Error("out of bound");
|
|
2316
|
-
const code = this.message.codePointAt(offset);
|
|
2317
|
-
if (code === void 0) throw Error(`Offset ${offset} is at invalid UTF-16 code unit boundary`);
|
|
2318
|
-
return code;
|
|
2319
|
-
}
|
|
2320
|
-
error(kind, location) {
|
|
2321
|
-
return {
|
|
2322
|
-
val: null,
|
|
2323
|
-
err: {
|
|
2324
|
-
kind,
|
|
2325
|
-
message: this.message,
|
|
2326
|
-
location
|
|
2327
|
-
}
|
|
2328
|
-
};
|
|
2329
|
-
}
|
|
2330
|
-
/** Bump the parser to the next UTF-16 code unit. */
|
|
2331
|
-
bump() {
|
|
2332
|
-
if (this.isEOF()) return;
|
|
2333
|
-
const code = this.char();
|
|
2334
|
-
if (code === 10) {
|
|
2335
|
-
this.position.line += 1;
|
|
2336
|
-
this.position.column = 1;
|
|
2337
|
-
this.position.offset += 1;
|
|
2338
|
-
} else {
|
|
2339
|
-
this.position.column += 1;
|
|
2340
|
-
this.position.offset += code < 65536 ? 1 : 2;
|
|
2341
|
-
}
|
|
2342
|
-
}
|
|
2343
|
-
/**
|
|
2344
|
-
* If the substring starting at the current position of the parser has
|
|
2345
|
-
* the given prefix, then bump the parser to the character immediately
|
|
2346
|
-
* following the prefix and return true. Otherwise, don't bump the parser
|
|
2347
|
-
* and return false.
|
|
2348
|
-
*/
|
|
2349
|
-
bumpIf(prefix) {
|
|
2350
|
-
if (this.message.startsWith(prefix, this.offset())) {
|
|
2351
|
-
for (let i = 0; i < prefix.length; i++) this.bump();
|
|
2352
|
-
return true;
|
|
2353
|
-
}
|
|
2354
|
-
return false;
|
|
2355
|
-
}
|
|
2356
|
-
/**
|
|
2357
|
-
* Bump the parser until the pattern character is found and return `true`.
|
|
2358
|
-
* Otherwise bump to the end of the file and return `false`.
|
|
2359
|
-
*/
|
|
2360
|
-
bumpUntil(pattern) {
|
|
2361
|
-
const currentOffset = this.offset();
|
|
2362
|
-
const index = this.message.indexOf(pattern, currentOffset);
|
|
2363
|
-
if (index >= 0) {
|
|
2364
|
-
this.bumpTo(index);
|
|
2365
|
-
return true;
|
|
2366
|
-
} else {
|
|
2367
|
-
this.bumpTo(this.message.length);
|
|
2368
|
-
return false;
|
|
2369
|
-
}
|
|
2370
|
-
}
|
|
2371
|
-
/**
|
|
2372
|
-
* Bump the parser to the target offset.
|
|
2373
|
-
* If target offset is beyond the end of the input, bump the parser to the end of the input.
|
|
2374
|
-
*/
|
|
2375
|
-
bumpTo(targetOffset) {
|
|
2376
|
-
if (this.offset() > targetOffset) throw Error(`targetOffset ${targetOffset} must be greater than or equal to the current offset ${this.offset()}`);
|
|
2377
|
-
targetOffset = Math.min(targetOffset, this.message.length);
|
|
2378
|
-
while (true) {
|
|
2379
|
-
const offset = this.offset();
|
|
2380
|
-
if (offset === targetOffset) break;
|
|
2381
|
-
if (offset > targetOffset) throw Error(`targetOffset ${targetOffset} is at invalid UTF-16 code unit boundary`);
|
|
2382
|
-
this.bump();
|
|
2383
|
-
if (this.isEOF()) break;
|
|
2384
|
-
}
|
|
2385
|
-
}
|
|
2386
|
-
/** advance the parser through all whitespace to the next non-whitespace code unit. */
|
|
2387
|
-
bumpSpace() {
|
|
2388
|
-
while (!this.isEOF() && _isWhiteSpace(this.char())) this.bump();
|
|
2389
|
-
}
|
|
2390
|
-
/**
|
|
2391
|
-
* Peek at the *next* Unicode codepoint in the input without advancing the parser.
|
|
2392
|
-
* If the input has been exhausted, then this returns null.
|
|
2393
|
-
*/
|
|
2394
|
-
peek() {
|
|
2395
|
-
if (this.isEOF()) return null;
|
|
2396
|
-
const code = this.char();
|
|
2397
|
-
const offset = this.offset();
|
|
2398
|
-
return this.message.charCodeAt(offset + (code >= 65536 ? 2 : 1)) ?? null;
|
|
2399
|
-
}
|
|
2400
|
-
};
|
|
2401
|
-
/**
|
|
2402
|
-
* This check if codepoint is alphabet (lower & uppercase)
|
|
2403
|
-
* @param codepoint
|
|
2404
|
-
* @returns
|
|
2405
|
-
*/
|
|
2406
|
-
function _isAlpha(codepoint) {
|
|
2407
|
-
return codepoint >= 97 && codepoint <= 122 || codepoint >= 65 && codepoint <= 90;
|
|
2408
|
-
}
|
|
2409
|
-
function _isAlphaOrSlash(codepoint) {
|
|
2410
|
-
return _isAlpha(codepoint) || codepoint === 47;
|
|
2411
|
-
}
|
|
2412
|
-
/** See `parseTag` function docs. */
|
|
2413
|
-
function _isPotentialElementNameChar(c) {
|
|
2414
|
-
return c === 45 || c === 46 || c >= 48 && c <= 57 || c === 95 || c >= 97 && c <= 122 || c >= 65 && c <= 90 || c == 183 || c >= 192 && c <= 214 || c >= 216 && c <= 246 || c >= 248 && c <= 893 || c >= 895 && c <= 8191 || c >= 8204 && c <= 8205 || c >= 8255 && c <= 8256 || c >= 8304 && c <= 8591 || c >= 11264 && c <= 12271 || c >= 12289 && c <= 55295 || c >= 63744 && c <= 64975 || c >= 65008 && c <= 65533 || c >= 65536 && c <= 983039;
|
|
2415
|
-
}
|
|
2416
|
-
/**
|
|
2417
|
-
* Code point equivalent of regex `\p{White_Space}`.
|
|
2418
|
-
* From: https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt
|
|
2419
|
-
*/
|
|
2420
|
-
function _isWhiteSpace(c) {
|
|
2421
|
-
return c >= 9 && c <= 13 || c === 32 || c === 133 || c >= 8206 && c <= 8207 || c === 8232 || c === 8233;
|
|
2422
|
-
}
|
|
2423
|
-
/**
|
|
2424
|
-
* Collect all variables in an AST to Record<string, TYPE>
|
|
2425
|
-
* @param ast AST to collect variables from
|
|
2426
|
-
* @param vars Record of variable name to variable type
|
|
2427
|
-
*/
|
|
2428
|
-
function collectVariables(ast, vars = /* @__PURE__ */ new Map()) {
|
|
2429
|
-
ast.forEach((el) => {
|
|
2430
|
-
if (isArgumentElement$1(el) || isDateElement$1(el) || isTimeElement$1(el) || isNumberElement$1(el)) if (vars.has(el.value)) {
|
|
2431
|
-
const existingType = vars.get(el.value);
|
|
2432
|
-
if (existingType !== el.type && existingType !== TYPE$2.plural && existingType !== TYPE$2.select) throw new Error(`Variable ${el.value} has conflicting types`);
|
|
2433
|
-
} else vars.set(el.value, el.type);
|
|
2434
|
-
if (isPluralElement$2(el) || isSelectElement$2(el)) {
|
|
2435
|
-
vars.set(el.value, el.type);
|
|
2436
|
-
Object.keys(el.options).forEach((k) => {
|
|
2437
|
-
collectVariables(el.options[k].value, vars);
|
|
2438
|
-
});
|
|
2439
|
-
}
|
|
2440
|
-
if (isTagElement$2(el)) {
|
|
2441
|
-
vars.set(el.value, el.type);
|
|
2442
|
-
collectVariables(el.children, vars);
|
|
2443
|
-
}
|
|
2444
|
-
});
|
|
2445
|
-
}
|
|
2446
|
-
/**
|
|
2447
|
-
* Check if 2 ASTs are structurally the same. This primarily means that
|
|
2448
|
-
* they have the same variables with the same type
|
|
2449
|
-
* @param a
|
|
2450
|
-
* @param b
|
|
2451
|
-
* @returns
|
|
2452
|
-
*/
|
|
2453
|
-
function isStructurallySame(a, b) {
|
|
2454
|
-
const aVars = /* @__PURE__ */ new Map();
|
|
2455
|
-
const bVars = /* @__PURE__ */ new Map();
|
|
2456
|
-
collectVariables(a, aVars);
|
|
2457
|
-
collectVariables(b, bVars);
|
|
2458
|
-
if (aVars.size !== bVars.size) return {
|
|
2459
|
-
success: false,
|
|
2460
|
-
error: /* @__PURE__ */ new Error(`Different number of variables: [${Array.from(aVars.keys()).join(", ")}] vs [${Array.from(bVars.keys()).join(", ")}]`)
|
|
2461
|
-
};
|
|
2462
|
-
return Array.from(aVars.entries()).reduce((result, [key, type]) => {
|
|
2463
|
-
if (!result.success) return result;
|
|
2464
|
-
const bType = bVars.get(key);
|
|
2465
|
-
if (bType == null) return {
|
|
2466
|
-
success: false,
|
|
2467
|
-
error: /* @__PURE__ */ new Error(`Missing variable ${key} in message`)
|
|
2468
|
-
};
|
|
2469
|
-
if (bType !== type) return {
|
|
2470
|
-
success: false,
|
|
2471
|
-
error: /* @__PURE__ */ new Error(`Variable ${key} has conflicting types: ${TYPE$2[type]} vs ${TYPE$2[bType]}`)
|
|
2472
|
-
};
|
|
2473
|
-
return result;
|
|
2474
|
-
}, { success: true });
|
|
2475
|
-
}
|
|
2476
|
-
function pruneLocation(els) {
|
|
2477
|
-
els.forEach((el) => {
|
|
2478
|
-
delete el.location;
|
|
2479
|
-
if (isSelectElement$2(el) || isPluralElement$2(el)) for (const k in el.options) {
|
|
2480
|
-
delete el.options[k].location;
|
|
2481
|
-
pruneLocation(el.options[k].value);
|
|
2482
|
-
}
|
|
2483
|
-
else if (isNumberElement$1(el) && isNumberSkeleton(el.style)) delete el.style.location;
|
|
2484
|
-
else if ((isDateElement$1(el) || isTimeElement$1(el)) && isDateTimeSkeleton(el.style)) delete el.style.location;
|
|
2485
|
-
else if (isTagElement$2(el)) pruneLocation(el.children);
|
|
2486
|
-
});
|
|
3033
|
+
"H"
|
|
3034
|
+
],
|
|
3035
|
+
"zu-ZA": [
|
|
3036
|
+
"H",
|
|
3037
|
+
"hB",
|
|
3038
|
+
"hb",
|
|
3039
|
+
"h"
|
|
3040
|
+
]
|
|
3041
|
+
};
|
|
3042
|
+
/**
|
|
3043
|
+
* Returns the best matching date time pattern if a date time skeleton
|
|
3044
|
+
* pattern is provided with a locale. Follows the Unicode specification:
|
|
3045
|
+
* https://www.unicode.org/reports/tr35/tr35-dates.html#table-mapping-requested-time-skeletons-to-patterns
|
|
3046
|
+
* @param skeleton date time skeleton pattern that possibly includes j, J or C
|
|
3047
|
+
* @param locale
|
|
3048
|
+
*/
|
|
3049
|
+
function getBestPattern(skeleton, locale) {
|
|
3050
|
+
let skeletonCopy = "";
|
|
3051
|
+
for (let patternPos = 0; patternPos < skeleton.length; patternPos++) {
|
|
3052
|
+
const patternChar = skeleton.charAt(patternPos);
|
|
3053
|
+
if (patternChar === "j") {
|
|
3054
|
+
let extraLength = 0;
|
|
3055
|
+
while (patternPos + 1 < skeleton.length && skeleton.charAt(patternPos + 1) === patternChar) {
|
|
3056
|
+
extraLength++;
|
|
3057
|
+
patternPos++;
|
|
3058
|
+
}
|
|
3059
|
+
let hourLen = 1 + (extraLength & 1);
|
|
3060
|
+
let dayPeriodLen = extraLength < 2 ? 1 : 3 + (extraLength >> 1);
|
|
3061
|
+
let dayPeriodChar = "a";
|
|
3062
|
+
let hourChar = getDefaultHourSymbolFromLocale(locale);
|
|
3063
|
+
if (hourChar == "H" || hourChar == "k") dayPeriodLen = 0;
|
|
3064
|
+
while (dayPeriodLen-- > 0) skeletonCopy += dayPeriodChar;
|
|
3065
|
+
while (hourLen-- > 0) skeletonCopy = hourChar + skeletonCopy;
|
|
3066
|
+
} else if (patternChar === "J") skeletonCopy += "H";
|
|
3067
|
+
else skeletonCopy += patternChar;
|
|
3068
|
+
}
|
|
3069
|
+
return skeletonCopy;
|
|
2487
3070
|
}
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
if (
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
3071
|
+
/**
|
|
3072
|
+
* Maps the [hour cycle type](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/hourCycle)
|
|
3073
|
+
* of the given `locale` to the corresponding time pattern.
|
|
3074
|
+
* @param locale
|
|
3075
|
+
*/
|
|
3076
|
+
function getDefaultHourSymbolFromLocale(locale) {
|
|
3077
|
+
let hourCycle = locale.hourCycle;
|
|
3078
|
+
if (hourCycle === void 0 && locale.hourCycles && locale.hourCycles.length) hourCycle = locale.hourCycles[0];
|
|
3079
|
+
if (hourCycle) switch (hourCycle) {
|
|
3080
|
+
case "h24": return "k";
|
|
3081
|
+
case "h23": return "H";
|
|
3082
|
+
case "h12": return "h";
|
|
3083
|
+
case "h11": return "K";
|
|
3084
|
+
default: throw new Error("Invalid hourCycle");
|
|
2500
3085
|
}
|
|
2501
|
-
|
|
2502
|
-
|
|
3086
|
+
const languageTag = locale.language;
|
|
3087
|
+
let regionTag;
|
|
3088
|
+
if (languageTag !== "root") regionTag = locale.maximize().region;
|
|
3089
|
+
return (timeData[regionTag || ""] || timeData[languageTag || ""] || timeData[`${languageTag}-001`] || timeData["001"])[0];
|
|
2503
3090
|
}
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
"\"": "\"",
|
|
2511
|
-
"\\": "\\",
|
|
2512
|
-
"/": "/",
|
|
2513
|
-
b: "\b",
|
|
2514
|
-
f: "\f",
|
|
2515
|
-
n: "\n",
|
|
2516
|
-
r: "\r",
|
|
2517
|
-
t: " "
|
|
3091
|
+
const SPACE_SEPARATOR_START_REGEX = new RegExp(`^${SPACE_SEPARATOR_REGEX.source}*`);
|
|
3092
|
+
const SPACE_SEPARATOR_END_REGEX = new RegExp(`${SPACE_SEPARATOR_REGEX.source}*$`);
|
|
3093
|
+
function createLocation(start, end) {
|
|
3094
|
+
return {
|
|
3095
|
+
start,
|
|
3096
|
+
end
|
|
2518
3097
|
};
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
3098
|
+
}
|
|
3099
|
+
const hasNativeFromEntries = !!Object.fromEntries;
|
|
3100
|
+
const hasTrimStart = !!String.prototype.trimStart;
|
|
3101
|
+
const hasTrimEnd = !!String.prototype.trimEnd;
|
|
3102
|
+
const fromEntries = hasNativeFromEntries ? Object.fromEntries : function fromEntries(entries) {
|
|
3103
|
+
const obj = {};
|
|
3104
|
+
for (const [k, v] of entries) obj[k] = v;
|
|
3105
|
+
return obj;
|
|
3106
|
+
};
|
|
3107
|
+
const trimStart = hasTrimStart ? function trimStart(s) {
|
|
3108
|
+
return s.trimStart();
|
|
3109
|
+
} : function trimStart(s) {
|
|
3110
|
+
return s.replace(SPACE_SEPARATOR_START_REGEX, "");
|
|
3111
|
+
};
|
|
3112
|
+
const trimEnd = hasTrimEnd ? function trimEnd(s) {
|
|
3113
|
+
return s.trimEnd();
|
|
3114
|
+
} : function trimEnd(s) {
|
|
3115
|
+
return s.replace(SPACE_SEPARATOR_END_REGEX, "");
|
|
3116
|
+
};
|
|
3117
|
+
const IDENTIFIER_PREFIX_RE = /* @__PURE__ */ new RegExp("([^\\p{White_Space}\\p{Pattern_Syntax}]*)", "yu");
|
|
3118
|
+
function matchIdentifierAtIndex(s, index) {
|
|
3119
|
+
IDENTIFIER_PREFIX_RE.lastIndex = index;
|
|
3120
|
+
return IDENTIFIER_PREFIX_RE.exec(s)[1] ?? "";
|
|
3121
|
+
}
|
|
3122
|
+
var Parser = class {
|
|
3123
|
+
constructor(message, options = {}) {
|
|
3124
|
+
this.message = message;
|
|
3125
|
+
this.position = {
|
|
3126
|
+
offset: 0,
|
|
3127
|
+
line: 1,
|
|
3128
|
+
column: 1
|
|
2526
3129
|
};
|
|
3130
|
+
this.ignoreTag = !!options.ignoreTag;
|
|
3131
|
+
this.locale = options.locale;
|
|
3132
|
+
this.requiresOtherClause = !!options.requiresOtherClause;
|
|
3133
|
+
this.shouldParseSkeletons = !!options.shouldParseSkeletons;
|
|
2527
3134
|
}
|
|
2528
|
-
|
|
2529
|
-
if (
|
|
2530
|
-
|
|
2531
|
-
at += 1;
|
|
2532
|
-
return ch;
|
|
3135
|
+
parse() {
|
|
3136
|
+
if (this.offset() !== 0) throw Error("parser can only be used once");
|
|
3137
|
+
return this.parseMessage(0, "", false);
|
|
2533
3138
|
}
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
if (
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
3139
|
+
parseMessage(nestingLevel, parentArgType, expectingCloseTag) {
|
|
3140
|
+
let elements = [];
|
|
3141
|
+
while (!this.isEOF()) {
|
|
3142
|
+
const char = this.char();
|
|
3143
|
+
if (char === 123) {
|
|
3144
|
+
const result = this.parseArgument(nestingLevel, expectingCloseTag);
|
|
3145
|
+
if (result.err) return result;
|
|
3146
|
+
elements.push(result.val);
|
|
3147
|
+
} else if (char === 125 && nestingLevel > 0) break;
|
|
3148
|
+
else if (char === 35 && (parentArgType === "plural" || parentArgType === "selectordinal")) {
|
|
3149
|
+
const position = this.clonePosition();
|
|
3150
|
+
this.bump();
|
|
3151
|
+
elements.push({
|
|
3152
|
+
type: TYPE$2.pound,
|
|
3153
|
+
location: createLocation(position, this.clonePosition())
|
|
3154
|
+
});
|
|
3155
|
+
} else if (char === 60 && !this.ignoreTag && this.peek() === 47) if (expectingCloseTag) break;
|
|
3156
|
+
else return this.error(ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(this.clonePosition(), this.clonePosition()));
|
|
3157
|
+
else if (char === 60 && !this.ignoreTag && _isAlpha(this.peek() || 0)) {
|
|
3158
|
+
const result = this.parseTag(nestingLevel, parentArgType);
|
|
3159
|
+
if (result.err) return result;
|
|
3160
|
+
elements.push(result.val);
|
|
3161
|
+
} else {
|
|
3162
|
+
const result = this.parseLiteral(nestingLevel, parentArgType);
|
|
3163
|
+
if (result.err) return result;
|
|
3164
|
+
elements.push(result.val);
|
|
2559
3165
|
}
|
|
2560
3166
|
}
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
function string() {
|
|
2566
|
-
var hex;
|
|
2567
|
-
var i;
|
|
2568
|
-
var str = "";
|
|
2569
|
-
var uffff;
|
|
2570
|
-
if (ch === "\"") while (next()) if (ch === "\"") {
|
|
2571
|
-
next();
|
|
2572
|
-
return str;
|
|
2573
|
-
} else if (ch === "\\") {
|
|
2574
|
-
next();
|
|
2575
|
-
if (ch === "u") {
|
|
2576
|
-
uffff = 0;
|
|
2577
|
-
for (i = 0; i < 4; i += 1) {
|
|
2578
|
-
hex = parseInt(next(), 16);
|
|
2579
|
-
if (!isFinite(hex)) break;
|
|
2580
|
-
uffff = uffff * 16 + hex;
|
|
2581
|
-
}
|
|
2582
|
-
str += String.fromCharCode(uffff);
|
|
2583
|
-
} else if (typeof escapee[ch] === "string") str += escapee[ch];
|
|
2584
|
-
else break;
|
|
2585
|
-
} else str += ch;
|
|
2586
|
-
error("Bad string");
|
|
2587
|
-
}
|
|
2588
|
-
function white() {
|
|
2589
|
-
while (ch && ch <= " ") next();
|
|
3167
|
+
return {
|
|
3168
|
+
val: elements,
|
|
3169
|
+
err: null
|
|
3170
|
+
};
|
|
2590
3171
|
}
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
3172
|
+
/**
|
|
3173
|
+
* A tag name must start with an ASCII lower/upper case letter. The grammar is based on the
|
|
3174
|
+
* [custom element name][] except that a dash is NOT always mandatory and uppercase letters
|
|
3175
|
+
* are accepted:
|
|
3176
|
+
*
|
|
3177
|
+
* ```
|
|
3178
|
+
* tag ::= "<" tagName (whitespace)* "/>" | "<" tagName (whitespace)* ">" message "</" tagName (whitespace)* ">"
|
|
3179
|
+
* tagName ::= [a-z] (PENChar)*
|
|
3180
|
+
* PENChar ::=
|
|
3181
|
+
* "-" | "." | [0-9] | "_" | [a-z] | [A-Z] | #xB7 | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x37D] |
|
|
3182
|
+
* [#x37F-#x1FFF] | [#x200C-#x200D] | [#x203F-#x2040] | [#x2070-#x218F] | [#x2C00-#x2FEF] |
|
|
3183
|
+
* [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
|
|
3184
|
+
* ```
|
|
3185
|
+
*
|
|
3186
|
+
* [custom element name]: https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
|
|
3187
|
+
* NOTE: We're a bit more lax here since HTML technically does not allow uppercase HTML element but we do
|
|
3188
|
+
* since other tag-based engines like React allow it
|
|
3189
|
+
*/
|
|
3190
|
+
parseTag(nestingLevel, parentArgType) {
|
|
3191
|
+
const startPosition = this.clonePosition();
|
|
3192
|
+
this.bump();
|
|
3193
|
+
const tagName = this.parseTagName();
|
|
3194
|
+
this.bumpSpace();
|
|
3195
|
+
if (this.bumpIf("/>")) return {
|
|
3196
|
+
val: {
|
|
3197
|
+
type: TYPE$2.literal,
|
|
3198
|
+
value: `<${tagName}/>`,
|
|
3199
|
+
location: createLocation(startPosition, this.clonePosition())
|
|
3200
|
+
},
|
|
3201
|
+
err: null
|
|
3202
|
+
};
|
|
3203
|
+
else if (this.bumpIf(">")) {
|
|
3204
|
+
const childrenResult = this.parseMessage(nestingLevel + 1, parentArgType, true);
|
|
3205
|
+
if (childrenResult.err) return childrenResult;
|
|
3206
|
+
const children = childrenResult.val;
|
|
3207
|
+
const endTagStartPosition = this.clonePosition();
|
|
3208
|
+
if (this.bumpIf("</")) {
|
|
3209
|
+
if (this.isEOF() || !_isAlpha(this.char())) return this.error(ErrorKind.INVALID_TAG, createLocation(endTagStartPosition, this.clonePosition()));
|
|
3210
|
+
const closingTagNameStartPosition = this.clonePosition();
|
|
3211
|
+
if (tagName !== this.parseTagName()) return this.error(ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(closingTagNameStartPosition, this.clonePosition()));
|
|
3212
|
+
this.bumpSpace();
|
|
3213
|
+
if (!this.bumpIf(">")) return this.error(ErrorKind.INVALID_TAG, createLocation(endTagStartPosition, this.clonePosition()));
|
|
3214
|
+
return {
|
|
3215
|
+
val: {
|
|
3216
|
+
type: TYPE$2.tag,
|
|
3217
|
+
value: tagName,
|
|
3218
|
+
children,
|
|
3219
|
+
location: createLocation(startPosition, this.clonePosition())
|
|
3220
|
+
},
|
|
3221
|
+
err: null
|
|
3222
|
+
};
|
|
3223
|
+
} else return this.error(ErrorKind.UNCLOSED_TAG, createLocation(startPosition, this.clonePosition()));
|
|
3224
|
+
} else return this.error(ErrorKind.INVALID_TAG, createLocation(startPosition, this.clonePosition()));
|
|
2614
3225
|
}
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
}
|
|
2624
|
-
while (ch) {
|
|
2625
|
-
arr.push(value());
|
|
2626
|
-
white();
|
|
2627
|
-
if (ch === "]") {
|
|
2628
|
-
next("]");
|
|
2629
|
-
return arr;
|
|
2630
|
-
}
|
|
2631
|
-
next(",");
|
|
2632
|
-
white();
|
|
2633
|
-
}
|
|
2634
|
-
}
|
|
2635
|
-
error("Bad array");
|
|
3226
|
+
/**
|
|
3227
|
+
* This method assumes that the caller has peeked ahead for the first tag character.
|
|
3228
|
+
*/
|
|
3229
|
+
parseTagName() {
|
|
3230
|
+
const startOffset = this.offset();
|
|
3231
|
+
this.bump();
|
|
3232
|
+
while (!this.isEOF() && _isPotentialElementNameChar(this.char())) this.bump();
|
|
3233
|
+
return this.message.slice(startOffset, this.offset());
|
|
2636
3234
|
}
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
return obj;
|
|
3235
|
+
parseLiteral(nestingLevel, parentArgType) {
|
|
3236
|
+
const start = this.clonePosition();
|
|
3237
|
+
let value = "";
|
|
3238
|
+
while (true) {
|
|
3239
|
+
const parseQuoteResult = this.tryParseQuote(parentArgType);
|
|
3240
|
+
if (parseQuoteResult) {
|
|
3241
|
+
value += parseQuoteResult;
|
|
3242
|
+
continue;
|
|
2646
3243
|
}
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) error("Duplicate key \"" + key + "\"");
|
|
2652
|
-
obj[key] = value();
|
|
2653
|
-
white();
|
|
2654
|
-
if (ch === "}") {
|
|
2655
|
-
next("}");
|
|
2656
|
-
return obj;
|
|
2657
|
-
}
|
|
2658
|
-
next(",");
|
|
2659
|
-
white();
|
|
3244
|
+
const parseUnquotedResult = this.tryParseUnquoted(nestingLevel, parentArgType);
|
|
3245
|
+
if (parseUnquotedResult) {
|
|
3246
|
+
value += parseUnquotedResult;
|
|
3247
|
+
continue;
|
|
2660
3248
|
}
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
white();
|
|
2666
|
-
switch (ch) {
|
|
2667
|
-
case "{": return object();
|
|
2668
|
-
case "[": return array();
|
|
2669
|
-
case "\"": return string();
|
|
2670
|
-
case "-": return number();
|
|
2671
|
-
default: return ch >= "0" && ch <= "9" ? number() : word();
|
|
2672
|
-
}
|
|
2673
|
-
}
|
|
2674
|
-
module.exports = function(source, reviver) {
|
|
2675
|
-
var result;
|
|
2676
|
-
text = source;
|
|
2677
|
-
at = 0;
|
|
2678
|
-
ch = " ";
|
|
2679
|
-
result = value();
|
|
2680
|
-
white();
|
|
2681
|
-
if (ch) error("Syntax error");
|
|
2682
|
-
return typeof reviver === "function" ? function walk(holder, key) {
|
|
2683
|
-
var k;
|
|
2684
|
-
var v;
|
|
2685
|
-
var val = holder[key];
|
|
2686
|
-
if (val && typeof val === "object") {
|
|
2687
|
-
for (k in value) if (Object.prototype.hasOwnProperty.call(val, k)) {
|
|
2688
|
-
v = walk(val, k);
|
|
2689
|
-
if (typeof v === "undefined") delete val[k];
|
|
2690
|
-
else val[k] = v;
|
|
2691
|
-
}
|
|
3249
|
+
const parseLeftAngleResult = this.tryParseLeftAngleBracket();
|
|
3250
|
+
if (parseLeftAngleResult) {
|
|
3251
|
+
value += parseLeftAngleResult;
|
|
3252
|
+
continue;
|
|
2692
3253
|
}
|
|
2693
|
-
|
|
2694
|
-
}({ "": result }, "") : result;
|
|
2695
|
-
};
|
|
2696
|
-
}));
|
|
2697
|
-
//#endregion
|
|
2698
|
-
//#region node_modules/.aspect_rules_js/jsonify@0.0.1/node_modules/jsonify/lib/stringify.js
|
|
2699
|
-
var require_stringify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2700
|
-
var escapable = /[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
|
|
2701
|
-
var gap;
|
|
2702
|
-
var indent;
|
|
2703
|
-
var meta = {
|
|
2704
|
-
"\b": "\\b",
|
|
2705
|
-
" ": "\\t",
|
|
2706
|
-
"\n": "\\n",
|
|
2707
|
-
"\f": "\\f",
|
|
2708
|
-
"\r": "\\r",
|
|
2709
|
-
"\"": "\\\"",
|
|
2710
|
-
"\\": "\\\\"
|
|
2711
|
-
};
|
|
2712
|
-
var rep;
|
|
2713
|
-
function quote(string) {
|
|
2714
|
-
escapable.lastIndex = 0;
|
|
2715
|
-
return escapable.test(string) ? "\"" + string.replace(escapable, function(a) {
|
|
2716
|
-
var c = meta[a];
|
|
2717
|
-
return typeof c === "string" ? c : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4);
|
|
2718
|
-
}) + "\"" : "\"" + string + "\"";
|
|
2719
|
-
}
|
|
2720
|
-
function str(key, holder) {
|
|
2721
|
-
var i;
|
|
2722
|
-
var k;
|
|
2723
|
-
var v;
|
|
2724
|
-
var length;
|
|
2725
|
-
var mind = gap;
|
|
2726
|
-
var partial;
|
|
2727
|
-
var value = holder[key];
|
|
2728
|
-
if (value && typeof value === "object" && typeof value.toJSON === "function") value = value.toJSON(key);
|
|
2729
|
-
if (typeof rep === "function") value = rep.call(holder, key, value);
|
|
2730
|
-
switch (typeof value) {
|
|
2731
|
-
case "string": return quote(value);
|
|
2732
|
-
case "number": return isFinite(value) ? String(value) : "null";
|
|
2733
|
-
case "boolean":
|
|
2734
|
-
case "null": return String(value);
|
|
2735
|
-
case "object":
|
|
2736
|
-
if (!value) return "null";
|
|
2737
|
-
gap += indent;
|
|
2738
|
-
partial = [];
|
|
2739
|
-
if (Object.prototype.toString.apply(value) === "[object Array]") {
|
|
2740
|
-
length = value.length;
|
|
2741
|
-
for (i = 0; i < length; i += 1) partial[i] = str(i, value) || "null";
|
|
2742
|
-
v = partial.length === 0 ? "[]" : gap ? "[\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "]" : "[" + partial.join(",") + "]";
|
|
2743
|
-
gap = mind;
|
|
2744
|
-
return v;
|
|
2745
|
-
}
|
|
2746
|
-
if (rep && typeof rep === "object") {
|
|
2747
|
-
length = rep.length;
|
|
2748
|
-
for (i = 0; i < length; i += 1) {
|
|
2749
|
-
k = rep[i];
|
|
2750
|
-
if (typeof k === "string") {
|
|
2751
|
-
v = str(k, value);
|
|
2752
|
-
if (v) partial.push(quote(k) + (gap ? ": " : ":") + v);
|
|
2753
|
-
}
|
|
2754
|
-
}
|
|
2755
|
-
} else for (k in value) if (Object.prototype.hasOwnProperty.call(value, k)) {
|
|
2756
|
-
v = str(k, value);
|
|
2757
|
-
if (v) partial.push(quote(k) + (gap ? ": " : ":") + v);
|
|
2758
|
-
}
|
|
2759
|
-
v = partial.length === 0 ? "{}" : gap ? "{\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "}" : "{" + partial.join(",") + "}";
|
|
2760
|
-
gap = mind;
|
|
2761
|
-
return v;
|
|
2762
|
-
default:
|
|
3254
|
+
break;
|
|
2763
3255
|
}
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
if (replacer && typeof replacer !== "function" && (typeof replacer !== "object" || typeof replacer.length !== "number")) throw new Error("JSON.stringify");
|
|
2773
|
-
return str("", { "": value });
|
|
2774
|
-
};
|
|
2775
|
-
}));
|
|
2776
|
-
//#endregion
|
|
2777
|
-
//#region node_modules/.aspect_rules_js/jsonify@0.0.1/node_modules/jsonify/index.js
|
|
2778
|
-
var require_jsonify = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2779
|
-
exports.parse = require_parse();
|
|
2780
|
-
exports.stringify = require_stringify();
|
|
2781
|
-
}));
|
|
2782
|
-
//#endregion
|
|
2783
|
-
//#region node_modules/.aspect_rules_js/isarray@2.0.5/node_modules/isarray/index.js
|
|
2784
|
-
var require_isarray = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2785
|
-
var toString = {}.toString;
|
|
2786
|
-
module.exports = Array.isArray || function(arr) {
|
|
2787
|
-
return toString.call(arr) == "[object Array]";
|
|
2788
|
-
};
|
|
2789
|
-
}));
|
|
2790
|
-
//#endregion
|
|
2791
|
-
//#region node_modules/.aspect_rules_js/object-keys@1.1.1/node_modules/object-keys/isArguments.js
|
|
2792
|
-
var require_isArguments = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2793
|
-
var toStr = Object.prototype.toString;
|
|
2794
|
-
module.exports = function isArguments(value) {
|
|
2795
|
-
var str = toStr.call(value);
|
|
2796
|
-
var isArgs = str === "[object Arguments]";
|
|
2797
|
-
if (!isArgs) isArgs = str !== "[object Array]" && value !== null && typeof value === "object" && typeof value.length === "number" && value.length >= 0 && toStr.call(value.callee) === "[object Function]";
|
|
2798
|
-
return isArgs;
|
|
2799
|
-
};
|
|
2800
|
-
}));
|
|
2801
|
-
//#endregion
|
|
2802
|
-
//#region node_modules/.aspect_rules_js/object-keys@1.1.1/node_modules/object-keys/implementation.js
|
|
2803
|
-
var require_implementation$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2804
|
-
var keysShim;
|
|
2805
|
-
if (!Object.keys) {
|
|
2806
|
-
var has = Object.prototype.hasOwnProperty;
|
|
2807
|
-
var toStr = Object.prototype.toString;
|
|
2808
|
-
var isArgs = require_isArguments();
|
|
2809
|
-
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
|
2810
|
-
var hasDontEnumBug = !isEnumerable.call({ toString: null }, "toString");
|
|
2811
|
-
var hasProtoEnumBug = isEnumerable.call(function() {}, "prototype");
|
|
2812
|
-
var dontEnums = [
|
|
2813
|
-
"toString",
|
|
2814
|
-
"toLocaleString",
|
|
2815
|
-
"valueOf",
|
|
2816
|
-
"hasOwnProperty",
|
|
2817
|
-
"isPrototypeOf",
|
|
2818
|
-
"propertyIsEnumerable",
|
|
2819
|
-
"constructor"
|
|
2820
|
-
];
|
|
2821
|
-
var equalsConstructorPrototype = function(o) {
|
|
2822
|
-
var ctor = o.constructor;
|
|
2823
|
-
return ctor && ctor.prototype === o;
|
|
2824
|
-
};
|
|
2825
|
-
var excludedKeys = {
|
|
2826
|
-
$applicationCache: true,
|
|
2827
|
-
$console: true,
|
|
2828
|
-
$external: true,
|
|
2829
|
-
$frame: true,
|
|
2830
|
-
$frameElement: true,
|
|
2831
|
-
$frames: true,
|
|
2832
|
-
$innerHeight: true,
|
|
2833
|
-
$innerWidth: true,
|
|
2834
|
-
$onmozfullscreenchange: true,
|
|
2835
|
-
$onmozfullscreenerror: true,
|
|
2836
|
-
$outerHeight: true,
|
|
2837
|
-
$outerWidth: true,
|
|
2838
|
-
$pageXOffset: true,
|
|
2839
|
-
$pageYOffset: true,
|
|
2840
|
-
$parent: true,
|
|
2841
|
-
$scrollLeft: true,
|
|
2842
|
-
$scrollTop: true,
|
|
2843
|
-
$scrollX: true,
|
|
2844
|
-
$scrollY: true,
|
|
2845
|
-
$self: true,
|
|
2846
|
-
$webkitIndexedDB: true,
|
|
2847
|
-
$webkitStorageInfo: true,
|
|
2848
|
-
$window: true
|
|
2849
|
-
};
|
|
2850
|
-
var hasAutomationEqualityBug = function() {
|
|
2851
|
-
if (typeof window === "undefined") return false;
|
|
2852
|
-
for (var k in window) try {
|
|
2853
|
-
if (!excludedKeys["$" + k] && has.call(window, k) && window[k] !== null && typeof window[k] === "object") try {
|
|
2854
|
-
equalsConstructorPrototype(window[k]);
|
|
2855
|
-
} catch (e) {
|
|
2856
|
-
return true;
|
|
2857
|
-
}
|
|
2858
|
-
} catch (e) {
|
|
2859
|
-
return true;
|
|
2860
|
-
}
|
|
2861
|
-
return false;
|
|
2862
|
-
}();
|
|
2863
|
-
var equalsConstructorPrototypeIfNotBuggy = function(o) {
|
|
2864
|
-
if (typeof window === "undefined" || !hasAutomationEqualityBug) return equalsConstructorPrototype(o);
|
|
2865
|
-
try {
|
|
2866
|
-
return equalsConstructorPrototype(o);
|
|
2867
|
-
} catch (e) {
|
|
2868
|
-
return false;
|
|
2869
|
-
}
|
|
2870
|
-
};
|
|
2871
|
-
keysShim = function keys(object) {
|
|
2872
|
-
var isObject = object !== null && typeof object === "object";
|
|
2873
|
-
var isFunction = toStr.call(object) === "[object Function]";
|
|
2874
|
-
var isArguments = isArgs(object);
|
|
2875
|
-
var isString = isObject && toStr.call(object) === "[object String]";
|
|
2876
|
-
var theKeys = [];
|
|
2877
|
-
if (!isObject && !isFunction && !isArguments) throw new TypeError("Object.keys called on a non-object");
|
|
2878
|
-
var skipProto = hasProtoEnumBug && isFunction;
|
|
2879
|
-
if (isString && object.length > 0 && !has.call(object, 0)) for (var i = 0; i < object.length; ++i) theKeys.push(String(i));
|
|
2880
|
-
if (isArguments && object.length > 0) for (var j = 0; j < object.length; ++j) theKeys.push(String(j));
|
|
2881
|
-
else for (var name in object) if (!(skipProto && name === "prototype") && has.call(object, name)) theKeys.push(String(name));
|
|
2882
|
-
if (hasDontEnumBug) {
|
|
2883
|
-
var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
|
|
2884
|
-
for (var k = 0; k < dontEnums.length; ++k) if (!(skipConstructor && dontEnums[k] === "constructor") && has.call(object, dontEnums[k])) theKeys.push(dontEnums[k]);
|
|
2885
|
-
}
|
|
2886
|
-
return theKeys;
|
|
3256
|
+
const location = createLocation(start, this.clonePosition());
|
|
3257
|
+
return {
|
|
3258
|
+
val: {
|
|
3259
|
+
type: TYPE$2.literal,
|
|
3260
|
+
value,
|
|
3261
|
+
location
|
|
3262
|
+
},
|
|
3263
|
+
err: null
|
|
2887
3264
|
};
|
|
2888
3265
|
}
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
var require_object_keys = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2894
|
-
var slice = Array.prototype.slice;
|
|
2895
|
-
var isArgs = require_isArguments();
|
|
2896
|
-
var origKeys = Object.keys;
|
|
2897
|
-
var keysShim = origKeys ? function keys(o) {
|
|
2898
|
-
return origKeys(o);
|
|
2899
|
-
} : require_implementation$1();
|
|
2900
|
-
var originalKeys = Object.keys;
|
|
2901
|
-
keysShim.shim = function shimObjectKeys() {
|
|
2902
|
-
if (Object.keys) {
|
|
2903
|
-
if (!function() {
|
|
2904
|
-
var args = Object.keys(arguments);
|
|
2905
|
-
return args && args.length === arguments.length;
|
|
2906
|
-
}(1, 2)) Object.keys = function keys(object) {
|
|
2907
|
-
if (isArgs(object)) return originalKeys(slice.call(object));
|
|
2908
|
-
return originalKeys(object);
|
|
2909
|
-
};
|
|
2910
|
-
} else Object.keys = keysShim;
|
|
2911
|
-
return Object.keys || keysShim;
|
|
2912
|
-
};
|
|
2913
|
-
module.exports = keysShim;
|
|
2914
|
-
}));
|
|
2915
|
-
//#endregion
|
|
2916
|
-
//#region node_modules/.aspect_rules_js/es-object-atoms@1.1.1/node_modules/es-object-atoms/index.js
|
|
2917
|
-
var require_es_object_atoms = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2918
|
-
/** @type {import('.')} */
|
|
2919
|
-
module.exports = Object;
|
|
2920
|
-
}));
|
|
2921
|
-
//#endregion
|
|
2922
|
-
//#region node_modules/.aspect_rules_js/es-errors@1.3.0/node_modules/es-errors/index.js
|
|
2923
|
-
var require_es_errors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2924
|
-
/** @type {import('.')} */
|
|
2925
|
-
module.exports = Error;
|
|
2926
|
-
}));
|
|
2927
|
-
//#endregion
|
|
2928
|
-
//#region node_modules/.aspect_rules_js/es-errors@1.3.0/node_modules/es-errors/eval.js
|
|
2929
|
-
var require_eval = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2930
|
-
/** @type {import('./eval')} */
|
|
2931
|
-
module.exports = EvalError;
|
|
2932
|
-
}));
|
|
2933
|
-
//#endregion
|
|
2934
|
-
//#region node_modules/.aspect_rules_js/es-errors@1.3.0/node_modules/es-errors/range.js
|
|
2935
|
-
var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2936
|
-
/** @type {import('./range')} */
|
|
2937
|
-
module.exports = RangeError;
|
|
2938
|
-
}));
|
|
2939
|
-
//#endregion
|
|
2940
|
-
//#region node_modules/.aspect_rules_js/es-errors@1.3.0/node_modules/es-errors/ref.js
|
|
2941
|
-
var require_ref = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2942
|
-
/** @type {import('./ref')} */
|
|
2943
|
-
module.exports = ReferenceError;
|
|
2944
|
-
}));
|
|
2945
|
-
//#endregion
|
|
2946
|
-
//#region node_modules/.aspect_rules_js/es-errors@1.3.0/node_modules/es-errors/syntax.js
|
|
2947
|
-
var require_syntax = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2948
|
-
/** @type {import('./syntax')} */
|
|
2949
|
-
module.exports = SyntaxError;
|
|
2950
|
-
}));
|
|
2951
|
-
//#endregion
|
|
2952
|
-
//#region node_modules/.aspect_rules_js/es-errors@1.3.0/node_modules/es-errors/type.js
|
|
2953
|
-
var require_type = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2954
|
-
/** @type {import('./type')} */
|
|
2955
|
-
module.exports = TypeError;
|
|
2956
|
-
}));
|
|
2957
|
-
//#endregion
|
|
2958
|
-
//#region node_modules/.aspect_rules_js/es-errors@1.3.0/node_modules/es-errors/uri.js
|
|
2959
|
-
var require_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2960
|
-
/** @type {import('./uri')} */
|
|
2961
|
-
module.exports = URIError;
|
|
2962
|
-
}));
|
|
2963
|
-
//#endregion
|
|
2964
|
-
//#region node_modules/.aspect_rules_js/math-intrinsics@1.1.0/node_modules/math-intrinsics/abs.js
|
|
2965
|
-
var require_abs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2966
|
-
/** @type {import('./abs')} */
|
|
2967
|
-
module.exports = Math.abs;
|
|
2968
|
-
}));
|
|
2969
|
-
//#endregion
|
|
2970
|
-
//#region node_modules/.aspect_rules_js/math-intrinsics@1.1.0/node_modules/math-intrinsics/floor.js
|
|
2971
|
-
var require_floor = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2972
|
-
/** @type {import('./floor')} */
|
|
2973
|
-
module.exports = Math.floor;
|
|
2974
|
-
}));
|
|
2975
|
-
//#endregion
|
|
2976
|
-
//#region node_modules/.aspect_rules_js/math-intrinsics@1.1.0/node_modules/math-intrinsics/max.js
|
|
2977
|
-
var require_max = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2978
|
-
/** @type {import('./max')} */
|
|
2979
|
-
module.exports = Math.max;
|
|
2980
|
-
}));
|
|
2981
|
-
//#endregion
|
|
2982
|
-
//#region node_modules/.aspect_rules_js/math-intrinsics@1.1.0/node_modules/math-intrinsics/min.js
|
|
2983
|
-
var require_min = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2984
|
-
/** @type {import('./min')} */
|
|
2985
|
-
module.exports = Math.min;
|
|
2986
|
-
}));
|
|
2987
|
-
//#endregion
|
|
2988
|
-
//#region node_modules/.aspect_rules_js/math-intrinsics@1.1.0/node_modules/math-intrinsics/pow.js
|
|
2989
|
-
var require_pow = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2990
|
-
/** @type {import('./pow')} */
|
|
2991
|
-
module.exports = Math.pow;
|
|
2992
|
-
}));
|
|
2993
|
-
//#endregion
|
|
2994
|
-
//#region node_modules/.aspect_rules_js/math-intrinsics@1.1.0/node_modules/math-intrinsics/round.js
|
|
2995
|
-
var require_round = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2996
|
-
/** @type {import('./round')} */
|
|
2997
|
-
module.exports = Math.round;
|
|
2998
|
-
}));
|
|
2999
|
-
//#endregion
|
|
3000
|
-
//#region node_modules/.aspect_rules_js/math-intrinsics@1.1.0/node_modules/math-intrinsics/isNaN.js
|
|
3001
|
-
var require_isNaN = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3002
|
-
/** @type {import('./isNaN')} */
|
|
3003
|
-
module.exports = Number.isNaN || function isNaN(a) {
|
|
3004
|
-
return a !== a;
|
|
3005
|
-
};
|
|
3006
|
-
}));
|
|
3007
|
-
//#endregion
|
|
3008
|
-
//#region node_modules/.aspect_rules_js/math-intrinsics@1.1.0/node_modules/math-intrinsics/sign.js
|
|
3009
|
-
var require_sign = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3010
|
-
var $isNaN = require_isNaN();
|
|
3011
|
-
/** @type {import('./sign')} */
|
|
3012
|
-
module.exports = function sign(number) {
|
|
3013
|
-
if ($isNaN(number) || number === 0) return number;
|
|
3014
|
-
return number < 0 ? -1 : 1;
|
|
3015
|
-
};
|
|
3016
|
-
}));
|
|
3017
|
-
//#endregion
|
|
3018
|
-
//#region node_modules/.aspect_rules_js/gopd@1.2.0/node_modules/gopd/gOPD.js
|
|
3019
|
-
var require_gOPD = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3020
|
-
/** @type {import('./gOPD')} */
|
|
3021
|
-
module.exports = Object.getOwnPropertyDescriptor;
|
|
3022
|
-
}));
|
|
3023
|
-
//#endregion
|
|
3024
|
-
//#region node_modules/.aspect_rules_js/gopd@1.2.0/node_modules/gopd/index.js
|
|
3025
|
-
var require_gopd = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3026
|
-
/** @type {import('.')} */
|
|
3027
|
-
var $gOPD = require_gOPD();
|
|
3028
|
-
if ($gOPD) try {
|
|
3029
|
-
$gOPD([], "length");
|
|
3030
|
-
} catch (e) {
|
|
3031
|
-
$gOPD = null;
|
|
3032
|
-
}
|
|
3033
|
-
module.exports = $gOPD;
|
|
3034
|
-
}));
|
|
3035
|
-
//#endregion
|
|
3036
|
-
//#region node_modules/.aspect_rules_js/es-define-property@1.0.1/node_modules/es-define-property/index.js
|
|
3037
|
-
var require_es_define_property = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3038
|
-
/** @type {import('.')} */
|
|
3039
|
-
var $defineProperty = Object.defineProperty || false;
|
|
3040
|
-
if ($defineProperty) try {
|
|
3041
|
-
$defineProperty({}, "a", { value: 1 });
|
|
3042
|
-
} catch (e) {
|
|
3043
|
-
$defineProperty = false;
|
|
3044
|
-
}
|
|
3045
|
-
module.exports = $defineProperty;
|
|
3046
|
-
}));
|
|
3047
|
-
//#endregion
|
|
3048
|
-
//#region node_modules/.aspect_rules_js/has-symbols@1.1.0/node_modules/has-symbols/shams.js
|
|
3049
|
-
var require_shams = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3050
|
-
/** @type {import('./shams')} */
|
|
3051
|
-
module.exports = function hasSymbols() {
|
|
3052
|
-
if (typeof Symbol !== "function" || typeof Object.getOwnPropertySymbols !== "function") return false;
|
|
3053
|
-
if (typeof Symbol.iterator === "symbol") return true;
|
|
3054
|
-
/** @type {{ [k in symbol]?: unknown }} */
|
|
3055
|
-
var obj = {};
|
|
3056
|
-
var sym = Symbol("test");
|
|
3057
|
-
var symObj = Object(sym);
|
|
3058
|
-
if (typeof sym === "string") return false;
|
|
3059
|
-
if (Object.prototype.toString.call(sym) !== "[object Symbol]") return false;
|
|
3060
|
-
if (Object.prototype.toString.call(symObj) !== "[object Symbol]") return false;
|
|
3061
|
-
var symVal = 42;
|
|
3062
|
-
obj[sym] = symVal;
|
|
3063
|
-
for (var _ in obj) return false;
|
|
3064
|
-
if (typeof Object.keys === "function" && Object.keys(obj).length !== 0) return false;
|
|
3065
|
-
if (typeof Object.getOwnPropertyNames === "function" && Object.getOwnPropertyNames(obj).length !== 0) return false;
|
|
3066
|
-
var syms = Object.getOwnPropertySymbols(obj);
|
|
3067
|
-
if (syms.length !== 1 || syms[0] !== sym) return false;
|
|
3068
|
-
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) return false;
|
|
3069
|
-
if (typeof Object.getOwnPropertyDescriptor === "function") {
|
|
3070
|
-
var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
|
|
3071
|
-
if (descriptor.value !== symVal || descriptor.enumerable !== true) return false;
|
|
3072
|
-
}
|
|
3073
|
-
return true;
|
|
3074
|
-
};
|
|
3075
|
-
}));
|
|
3076
|
-
//#endregion
|
|
3077
|
-
//#region node_modules/.aspect_rules_js/has-symbols@1.1.0/node_modules/has-symbols/index.js
|
|
3078
|
-
var require_has_symbols = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3079
|
-
var origSymbol = typeof Symbol !== "undefined" && Symbol;
|
|
3080
|
-
var hasSymbolSham = require_shams();
|
|
3081
|
-
/** @type {import('.')} */
|
|
3082
|
-
module.exports = function hasNativeSymbols() {
|
|
3083
|
-
if (typeof origSymbol !== "function") return false;
|
|
3084
|
-
if (typeof Symbol !== "function") return false;
|
|
3085
|
-
if (typeof origSymbol("foo") !== "symbol") return false;
|
|
3086
|
-
if (typeof Symbol("bar") !== "symbol") return false;
|
|
3087
|
-
return hasSymbolSham();
|
|
3088
|
-
};
|
|
3089
|
-
}));
|
|
3090
|
-
//#endregion
|
|
3091
|
-
//#region node_modules/.aspect_rules_js/get-proto@1.0.1/node_modules/get-proto/Reflect.getPrototypeOf.js
|
|
3092
|
-
var require_Reflect_getPrototypeOf = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3093
|
-
/** @type {import('./Reflect.getPrototypeOf')} */
|
|
3094
|
-
module.exports = typeof Reflect !== "undefined" && Reflect.getPrototypeOf || null;
|
|
3095
|
-
}));
|
|
3096
|
-
//#endregion
|
|
3097
|
-
//#region node_modules/.aspect_rules_js/get-proto@1.0.1/node_modules/get-proto/Object.getPrototypeOf.js
|
|
3098
|
-
var require_Object_getPrototypeOf = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3099
|
-
/** @type {import('./Object.getPrototypeOf')} */
|
|
3100
|
-
module.exports = require_es_object_atoms().getPrototypeOf || null;
|
|
3101
|
-
}));
|
|
3102
|
-
//#endregion
|
|
3103
|
-
//#region node_modules/.aspect_rules_js/function-bind@1.1.2/node_modules/function-bind/implementation.js
|
|
3104
|
-
var require_implementation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3105
|
-
var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
|
|
3106
|
-
var toStr = Object.prototype.toString;
|
|
3107
|
-
var max = Math.max;
|
|
3108
|
-
var funcType = "[object Function]";
|
|
3109
|
-
var concatty = function concatty(a, b) {
|
|
3110
|
-
var arr = [];
|
|
3111
|
-
for (var i = 0; i < a.length; i += 1) arr[i] = a[i];
|
|
3112
|
-
for (var j = 0; j < b.length; j += 1) arr[j + a.length] = b[j];
|
|
3113
|
-
return arr;
|
|
3114
|
-
};
|
|
3115
|
-
var slicy = function slicy(arrLike, offset) {
|
|
3116
|
-
var arr = [];
|
|
3117
|
-
for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) arr[j] = arrLike[i];
|
|
3118
|
-
return arr;
|
|
3119
|
-
};
|
|
3120
|
-
var joiny = function(arr, joiner) {
|
|
3121
|
-
var str = "";
|
|
3122
|
-
for (var i = 0; i < arr.length; i += 1) {
|
|
3123
|
-
str += arr[i];
|
|
3124
|
-
if (i + 1 < arr.length) str += joiner;
|
|
3125
|
-
}
|
|
3126
|
-
return str;
|
|
3127
|
-
};
|
|
3128
|
-
module.exports = function bind(that) {
|
|
3129
|
-
var target = this;
|
|
3130
|
-
if (typeof target !== "function" || toStr.apply(target) !== funcType) throw new TypeError(ERROR_MESSAGE + target);
|
|
3131
|
-
var args = slicy(arguments, 1);
|
|
3132
|
-
var bound;
|
|
3133
|
-
var binder = function() {
|
|
3134
|
-
if (this instanceof bound) {
|
|
3135
|
-
var result = target.apply(this, concatty(args, arguments));
|
|
3136
|
-
if (Object(result) === result) return result;
|
|
3137
|
-
return this;
|
|
3138
|
-
}
|
|
3139
|
-
return target.apply(that, concatty(args, arguments));
|
|
3140
|
-
};
|
|
3141
|
-
var boundLength = max(0, target.length - args.length);
|
|
3142
|
-
var boundArgs = [];
|
|
3143
|
-
for (var i = 0; i < boundLength; i++) boundArgs[i] = "$" + i;
|
|
3144
|
-
bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
|
|
3145
|
-
if (target.prototype) {
|
|
3146
|
-
var Empty = function Empty() {};
|
|
3147
|
-
Empty.prototype = target.prototype;
|
|
3148
|
-
bound.prototype = new Empty();
|
|
3149
|
-
Empty.prototype = null;
|
|
3266
|
+
tryParseLeftAngleBracket() {
|
|
3267
|
+
if (!this.isEOF() && this.char() === 60 && (this.ignoreTag || !_isAlphaOrSlash(this.peek() || 0))) {
|
|
3268
|
+
this.bump();
|
|
3269
|
+
return "<";
|
|
3150
3270
|
}
|
|
3151
|
-
return
|
|
3152
|
-
};
|
|
3153
|
-
}));
|
|
3154
|
-
//#endregion
|
|
3155
|
-
//#region node_modules/.aspect_rules_js/function-bind@1.1.2/node_modules/function-bind/index.js
|
|
3156
|
-
var require_function_bind = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3157
|
-
var implementation = require_implementation();
|
|
3158
|
-
module.exports = Function.prototype.bind || implementation;
|
|
3159
|
-
}));
|
|
3160
|
-
//#endregion
|
|
3161
|
-
//#region node_modules/.aspect_rules_js/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionCall.js
|
|
3162
|
-
var require_functionCall = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3163
|
-
/** @type {import('./functionCall')} */
|
|
3164
|
-
module.exports = Function.prototype.call;
|
|
3165
|
-
}));
|
|
3166
|
-
//#endregion
|
|
3167
|
-
//#region node_modules/.aspect_rules_js/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionApply.js
|
|
3168
|
-
var require_functionApply = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3169
|
-
/** @type {import('./functionApply')} */
|
|
3170
|
-
module.exports = Function.prototype.apply;
|
|
3171
|
-
}));
|
|
3172
|
-
//#endregion
|
|
3173
|
-
//#region node_modules/.aspect_rules_js/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/reflectApply.js
|
|
3174
|
-
var require_reflectApply = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3175
|
-
/** @type {import('./reflectApply')} */
|
|
3176
|
-
module.exports = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
|
|
3177
|
-
}));
|
|
3178
|
-
//#endregion
|
|
3179
|
-
//#region node_modules/.aspect_rules_js/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/actualApply.js
|
|
3180
|
-
var require_actualApply = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3181
|
-
var bind = require_function_bind();
|
|
3182
|
-
var $apply = require_functionApply();
|
|
3183
|
-
var $call = require_functionCall();
|
|
3184
|
-
/** @type {import('./actualApply')} */
|
|
3185
|
-
module.exports = require_reflectApply() || bind.call($call, $apply);
|
|
3186
|
-
}));
|
|
3187
|
-
//#endregion
|
|
3188
|
-
//#region node_modules/.aspect_rules_js/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/index.js
|
|
3189
|
-
var require_call_bind_apply_helpers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3190
|
-
var bind = require_function_bind();
|
|
3191
|
-
var $TypeError = require_type();
|
|
3192
|
-
var $call = require_functionCall();
|
|
3193
|
-
var $actualApply = require_actualApply();
|
|
3194
|
-
/** @type {(args: [Function, thisArg?: unknown, ...args: unknown[]]) => Function} TODO FIXME, find a way to use import('.') */
|
|
3195
|
-
module.exports = function callBindBasic(args) {
|
|
3196
|
-
if (args.length < 1 || typeof args[0] !== "function") throw new $TypeError("a function is required");
|
|
3197
|
-
return $actualApply(bind, $call, args);
|
|
3198
|
-
};
|
|
3199
|
-
}));
|
|
3200
|
-
//#endregion
|
|
3201
|
-
//#region node_modules/.aspect_rules_js/dunder-proto@1.0.1/node_modules/dunder-proto/get.js
|
|
3202
|
-
var require_get = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3203
|
-
var callBind = require_call_bind_apply_helpers();
|
|
3204
|
-
var gOPD = require_gopd();
|
|
3205
|
-
var hasProtoAccessor;
|
|
3206
|
-
try {
|
|
3207
|
-
hasProtoAccessor = [].__proto__ === Array.prototype;
|
|
3208
|
-
} catch (e) {
|
|
3209
|
-
if (!e || typeof e !== "object" || !("code" in e) || e.code !== "ERR_PROTO_ACCESS") throw e;
|
|
3271
|
+
return null;
|
|
3210
3272
|
}
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
//#endregion
|
|
3244
|
-
//#region node_modules/.aspect_rules_js/get-intrinsic@1.3.0/node_modules/get-intrinsic/index.js
|
|
3245
|
-
var require_get_intrinsic = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3246
|
-
var undefined;
|
|
3247
|
-
var $Object = require_es_object_atoms();
|
|
3248
|
-
var $Error = require_es_errors();
|
|
3249
|
-
var $EvalError = require_eval();
|
|
3250
|
-
var $RangeError = require_range();
|
|
3251
|
-
var $ReferenceError = require_ref();
|
|
3252
|
-
var $SyntaxError = require_syntax();
|
|
3253
|
-
var $TypeError = require_type();
|
|
3254
|
-
var $URIError = require_uri();
|
|
3255
|
-
var abs = require_abs();
|
|
3256
|
-
var floor = require_floor();
|
|
3257
|
-
var max = require_max();
|
|
3258
|
-
var min = require_min();
|
|
3259
|
-
var pow = require_pow();
|
|
3260
|
-
var round = require_round();
|
|
3261
|
-
var sign = require_sign();
|
|
3262
|
-
var $Function = Function;
|
|
3263
|
-
var getEvalledConstructor = function(expressionSyntax) {
|
|
3264
|
-
try {
|
|
3265
|
-
return $Function("\"use strict\"; return (" + expressionSyntax + ").constructor;")();
|
|
3266
|
-
} catch (e) {}
|
|
3267
|
-
};
|
|
3268
|
-
var $gOPD = require_gopd();
|
|
3269
|
-
var $defineProperty = require_es_define_property();
|
|
3270
|
-
var throwTypeError = function() {
|
|
3271
|
-
throw new $TypeError();
|
|
3272
|
-
};
|
|
3273
|
-
var ThrowTypeError = $gOPD ? function() {
|
|
3274
|
-
try {
|
|
3275
|
-
arguments.callee;
|
|
3276
|
-
return throwTypeError;
|
|
3277
|
-
} catch (calleeThrows) {
|
|
3278
|
-
try {
|
|
3279
|
-
return $gOPD(arguments, "callee").get;
|
|
3280
|
-
} catch (gOPDthrows) {
|
|
3281
|
-
return throwTypeError;
|
|
3273
|
+
/**
|
|
3274
|
+
* Starting with ICU 4.8, an ASCII apostrophe only starts quoted text if it immediately precedes
|
|
3275
|
+
* a character that requires quoting (that is, "only where needed"), and works the same in
|
|
3276
|
+
* nested messages as on the top level of the pattern. The new behavior is otherwise compatible.
|
|
3277
|
+
*/
|
|
3278
|
+
tryParseQuote(parentArgType) {
|
|
3279
|
+
if (this.isEOF() || this.char() !== 39) return null;
|
|
3280
|
+
switch (this.peek()) {
|
|
3281
|
+
case 39:
|
|
3282
|
+
this.bump();
|
|
3283
|
+
this.bump();
|
|
3284
|
+
return "'";
|
|
3285
|
+
case 123:
|
|
3286
|
+
case 60:
|
|
3287
|
+
case 62:
|
|
3288
|
+
case 125: break;
|
|
3289
|
+
case 35:
|
|
3290
|
+
if (parentArgType === "plural" || parentArgType === "selectordinal") break;
|
|
3291
|
+
return null;
|
|
3292
|
+
default: return null;
|
|
3293
|
+
}
|
|
3294
|
+
this.bump();
|
|
3295
|
+
const codePoints = [this.char()];
|
|
3296
|
+
this.bump();
|
|
3297
|
+
while (!this.isEOF()) {
|
|
3298
|
+
const ch = this.char();
|
|
3299
|
+
if (ch === 39) if (this.peek() === 39) {
|
|
3300
|
+
codePoints.push(39);
|
|
3301
|
+
this.bump();
|
|
3302
|
+
} else {
|
|
3303
|
+
this.bump();
|
|
3304
|
+
break;
|
|
3282
3305
|
}
|
|
3306
|
+
else codePoints.push(ch);
|
|
3307
|
+
this.bump();
|
|
3283
3308
|
}
|
|
3284
|
-
|
|
3285
|
-
var hasSymbols = require_has_symbols()();
|
|
3286
|
-
var getProto = require_get_proto();
|
|
3287
|
-
var $ObjectGPO = require_Object_getPrototypeOf();
|
|
3288
|
-
var $ReflectGPO = require_Reflect_getPrototypeOf();
|
|
3289
|
-
var $apply = require_functionApply();
|
|
3290
|
-
var $call = require_functionCall();
|
|
3291
|
-
var needsEval = {};
|
|
3292
|
-
var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined : getProto(Uint8Array);
|
|
3293
|
-
var INTRINSICS = {
|
|
3294
|
-
__proto__: null,
|
|
3295
|
-
"%AggregateError%": typeof AggregateError === "undefined" ? undefined : AggregateError,
|
|
3296
|
-
"%Array%": Array,
|
|
3297
|
-
"%ArrayBuffer%": typeof ArrayBuffer === "undefined" ? undefined : ArrayBuffer,
|
|
3298
|
-
"%ArrayIteratorPrototype%": hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined,
|
|
3299
|
-
"%AsyncFromSyncIteratorPrototype%": undefined,
|
|
3300
|
-
"%AsyncFunction%": needsEval,
|
|
3301
|
-
"%AsyncGenerator%": needsEval,
|
|
3302
|
-
"%AsyncGeneratorFunction%": needsEval,
|
|
3303
|
-
"%AsyncIteratorPrototype%": needsEval,
|
|
3304
|
-
"%Atomics%": typeof Atomics === "undefined" ? undefined : Atomics,
|
|
3305
|
-
"%BigInt%": typeof BigInt === "undefined" ? undefined : BigInt,
|
|
3306
|
-
"%BigInt64Array%": typeof BigInt64Array === "undefined" ? undefined : BigInt64Array,
|
|
3307
|
-
"%BigUint64Array%": typeof BigUint64Array === "undefined" ? undefined : BigUint64Array,
|
|
3308
|
-
"%Boolean%": Boolean,
|
|
3309
|
-
"%DataView%": typeof DataView === "undefined" ? undefined : DataView,
|
|
3310
|
-
"%Date%": Date,
|
|
3311
|
-
"%decodeURI%": decodeURI,
|
|
3312
|
-
"%decodeURIComponent%": decodeURIComponent,
|
|
3313
|
-
"%encodeURI%": encodeURI,
|
|
3314
|
-
"%encodeURIComponent%": encodeURIComponent,
|
|
3315
|
-
"%Error%": $Error,
|
|
3316
|
-
"%eval%": eval,
|
|
3317
|
-
"%EvalError%": $EvalError,
|
|
3318
|
-
"%Float16Array%": typeof Float16Array === "undefined" ? undefined : Float16Array,
|
|
3319
|
-
"%Float32Array%": typeof Float32Array === "undefined" ? undefined : Float32Array,
|
|
3320
|
-
"%Float64Array%": typeof Float64Array === "undefined" ? undefined : Float64Array,
|
|
3321
|
-
"%FinalizationRegistry%": typeof FinalizationRegistry === "undefined" ? undefined : FinalizationRegistry,
|
|
3322
|
-
"%Function%": $Function,
|
|
3323
|
-
"%GeneratorFunction%": needsEval,
|
|
3324
|
-
"%Int8Array%": typeof Int8Array === "undefined" ? undefined : Int8Array,
|
|
3325
|
-
"%Int16Array%": typeof Int16Array === "undefined" ? undefined : Int16Array,
|
|
3326
|
-
"%Int32Array%": typeof Int32Array === "undefined" ? undefined : Int32Array,
|
|
3327
|
-
"%isFinite%": isFinite,
|
|
3328
|
-
"%isNaN%": isNaN,
|
|
3329
|
-
"%IteratorPrototype%": hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined,
|
|
3330
|
-
"%JSON%": typeof JSON === "object" ? JSON : undefined,
|
|
3331
|
-
"%Map%": typeof Map === "undefined" ? undefined : Map,
|
|
3332
|
-
"%MapIteratorPrototype%": typeof Map === "undefined" || !hasSymbols || !getProto ? undefined : getProto((/* @__PURE__ */ new Map())[Symbol.iterator]()),
|
|
3333
|
-
"%Math%": Math,
|
|
3334
|
-
"%Number%": Number,
|
|
3335
|
-
"%Object%": $Object,
|
|
3336
|
-
"%Object.getOwnPropertyDescriptor%": $gOPD,
|
|
3337
|
-
"%parseFloat%": parseFloat,
|
|
3338
|
-
"%parseInt%": parseInt,
|
|
3339
|
-
"%Promise%": typeof Promise === "undefined" ? undefined : Promise,
|
|
3340
|
-
"%Proxy%": typeof Proxy === "undefined" ? undefined : Proxy,
|
|
3341
|
-
"%RangeError%": $RangeError,
|
|
3342
|
-
"%ReferenceError%": $ReferenceError,
|
|
3343
|
-
"%Reflect%": typeof Reflect === "undefined" ? undefined : Reflect,
|
|
3344
|
-
"%RegExp%": RegExp,
|
|
3345
|
-
"%Set%": typeof Set === "undefined" ? undefined : Set,
|
|
3346
|
-
"%SetIteratorPrototype%": typeof Set === "undefined" || !hasSymbols || !getProto ? undefined : getProto((/* @__PURE__ */ new Set())[Symbol.iterator]()),
|
|
3347
|
-
"%SharedArrayBuffer%": typeof SharedArrayBuffer === "undefined" ? undefined : SharedArrayBuffer,
|
|
3348
|
-
"%String%": String,
|
|
3349
|
-
"%StringIteratorPrototype%": hasSymbols && getProto ? getProto(""[Symbol.iterator]()) : undefined,
|
|
3350
|
-
"%Symbol%": hasSymbols ? Symbol : undefined,
|
|
3351
|
-
"%SyntaxError%": $SyntaxError,
|
|
3352
|
-
"%ThrowTypeError%": ThrowTypeError,
|
|
3353
|
-
"%TypedArray%": TypedArray,
|
|
3354
|
-
"%TypeError%": $TypeError,
|
|
3355
|
-
"%Uint8Array%": typeof Uint8Array === "undefined" ? undefined : Uint8Array,
|
|
3356
|
-
"%Uint8ClampedArray%": typeof Uint8ClampedArray === "undefined" ? undefined : Uint8ClampedArray,
|
|
3357
|
-
"%Uint16Array%": typeof Uint16Array === "undefined" ? undefined : Uint16Array,
|
|
3358
|
-
"%Uint32Array%": typeof Uint32Array === "undefined" ? undefined : Uint32Array,
|
|
3359
|
-
"%URIError%": $URIError,
|
|
3360
|
-
"%WeakMap%": typeof WeakMap === "undefined" ? undefined : WeakMap,
|
|
3361
|
-
"%WeakRef%": typeof WeakRef === "undefined" ? undefined : WeakRef,
|
|
3362
|
-
"%WeakSet%": typeof WeakSet === "undefined" ? undefined : WeakSet,
|
|
3363
|
-
"%Function.prototype.call%": $call,
|
|
3364
|
-
"%Function.prototype.apply%": $apply,
|
|
3365
|
-
"%Object.defineProperty%": $defineProperty,
|
|
3366
|
-
"%Object.getPrototypeOf%": $ObjectGPO,
|
|
3367
|
-
"%Math.abs%": abs,
|
|
3368
|
-
"%Math.floor%": floor,
|
|
3369
|
-
"%Math.max%": max,
|
|
3370
|
-
"%Math.min%": min,
|
|
3371
|
-
"%Math.pow%": pow,
|
|
3372
|
-
"%Math.round%": round,
|
|
3373
|
-
"%Math.sign%": sign,
|
|
3374
|
-
"%Reflect.getPrototypeOf%": $ReflectGPO
|
|
3375
|
-
};
|
|
3376
|
-
if (getProto) try {
|
|
3377
|
-
null.error;
|
|
3378
|
-
} catch (e) {
|
|
3379
|
-
INTRINSICS["%Error.prototype%"] = getProto(getProto(e));
|
|
3309
|
+
return String.fromCodePoint(...codePoints);
|
|
3380
3310
|
}
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
else
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
if (fn) value = fn.prototype;
|
|
3389
|
-
} else if (name === "%AsyncIteratorPrototype%") {
|
|
3390
|
-
var gen = doEval("%AsyncGenerator%");
|
|
3391
|
-
if (gen && getProto) value = getProto(gen.prototype);
|
|
3392
|
-
}
|
|
3393
|
-
INTRINSICS[name] = value;
|
|
3394
|
-
return value;
|
|
3395
|
-
};
|
|
3396
|
-
var LEGACY_ALIASES = {
|
|
3397
|
-
__proto__: null,
|
|
3398
|
-
"%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"],
|
|
3399
|
-
"%ArrayPrototype%": ["Array", "prototype"],
|
|
3400
|
-
"%ArrayProto_entries%": [
|
|
3401
|
-
"Array",
|
|
3402
|
-
"prototype",
|
|
3403
|
-
"entries"
|
|
3404
|
-
],
|
|
3405
|
-
"%ArrayProto_forEach%": [
|
|
3406
|
-
"Array",
|
|
3407
|
-
"prototype",
|
|
3408
|
-
"forEach"
|
|
3409
|
-
],
|
|
3410
|
-
"%ArrayProto_keys%": [
|
|
3411
|
-
"Array",
|
|
3412
|
-
"prototype",
|
|
3413
|
-
"keys"
|
|
3414
|
-
],
|
|
3415
|
-
"%ArrayProto_values%": [
|
|
3416
|
-
"Array",
|
|
3417
|
-
"prototype",
|
|
3418
|
-
"values"
|
|
3419
|
-
],
|
|
3420
|
-
"%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"],
|
|
3421
|
-
"%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"],
|
|
3422
|
-
"%AsyncGeneratorPrototype%": [
|
|
3423
|
-
"AsyncGeneratorFunction",
|
|
3424
|
-
"prototype",
|
|
3425
|
-
"prototype"
|
|
3426
|
-
],
|
|
3427
|
-
"%BooleanPrototype%": ["Boolean", "prototype"],
|
|
3428
|
-
"%DataViewPrototype%": ["DataView", "prototype"],
|
|
3429
|
-
"%DatePrototype%": ["Date", "prototype"],
|
|
3430
|
-
"%ErrorPrototype%": ["Error", "prototype"],
|
|
3431
|
-
"%EvalErrorPrototype%": ["EvalError", "prototype"],
|
|
3432
|
-
"%Float32ArrayPrototype%": ["Float32Array", "prototype"],
|
|
3433
|
-
"%Float64ArrayPrototype%": ["Float64Array", "prototype"],
|
|
3434
|
-
"%FunctionPrototype%": ["Function", "prototype"],
|
|
3435
|
-
"%Generator%": ["GeneratorFunction", "prototype"],
|
|
3436
|
-
"%GeneratorPrototype%": [
|
|
3437
|
-
"GeneratorFunction",
|
|
3438
|
-
"prototype",
|
|
3439
|
-
"prototype"
|
|
3440
|
-
],
|
|
3441
|
-
"%Int8ArrayPrototype%": ["Int8Array", "prototype"],
|
|
3442
|
-
"%Int16ArrayPrototype%": ["Int16Array", "prototype"],
|
|
3443
|
-
"%Int32ArrayPrototype%": ["Int32Array", "prototype"],
|
|
3444
|
-
"%JSONParse%": ["JSON", "parse"],
|
|
3445
|
-
"%JSONStringify%": ["JSON", "stringify"],
|
|
3446
|
-
"%MapPrototype%": ["Map", "prototype"],
|
|
3447
|
-
"%NumberPrototype%": ["Number", "prototype"],
|
|
3448
|
-
"%ObjectPrototype%": ["Object", "prototype"],
|
|
3449
|
-
"%ObjProto_toString%": [
|
|
3450
|
-
"Object",
|
|
3451
|
-
"prototype",
|
|
3452
|
-
"toString"
|
|
3453
|
-
],
|
|
3454
|
-
"%ObjProto_valueOf%": [
|
|
3455
|
-
"Object",
|
|
3456
|
-
"prototype",
|
|
3457
|
-
"valueOf"
|
|
3458
|
-
],
|
|
3459
|
-
"%PromisePrototype%": ["Promise", "prototype"],
|
|
3460
|
-
"%PromiseProto_then%": [
|
|
3461
|
-
"Promise",
|
|
3462
|
-
"prototype",
|
|
3463
|
-
"then"
|
|
3464
|
-
],
|
|
3465
|
-
"%Promise_all%": ["Promise", "all"],
|
|
3466
|
-
"%Promise_reject%": ["Promise", "reject"],
|
|
3467
|
-
"%Promise_resolve%": ["Promise", "resolve"],
|
|
3468
|
-
"%RangeErrorPrototype%": ["RangeError", "prototype"],
|
|
3469
|
-
"%ReferenceErrorPrototype%": ["ReferenceError", "prototype"],
|
|
3470
|
-
"%RegExpPrototype%": ["RegExp", "prototype"],
|
|
3471
|
-
"%SetPrototype%": ["Set", "prototype"],
|
|
3472
|
-
"%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"],
|
|
3473
|
-
"%StringPrototype%": ["String", "prototype"],
|
|
3474
|
-
"%SymbolPrototype%": ["Symbol", "prototype"],
|
|
3475
|
-
"%SyntaxErrorPrototype%": ["SyntaxError", "prototype"],
|
|
3476
|
-
"%TypedArrayPrototype%": ["TypedArray", "prototype"],
|
|
3477
|
-
"%TypeErrorPrototype%": ["TypeError", "prototype"],
|
|
3478
|
-
"%Uint8ArrayPrototype%": ["Uint8Array", "prototype"],
|
|
3479
|
-
"%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"],
|
|
3480
|
-
"%Uint16ArrayPrototype%": ["Uint16Array", "prototype"],
|
|
3481
|
-
"%Uint32ArrayPrototype%": ["Uint32Array", "prototype"],
|
|
3482
|
-
"%URIErrorPrototype%": ["URIError", "prototype"],
|
|
3483
|
-
"%WeakMapPrototype%": ["WeakMap", "prototype"],
|
|
3484
|
-
"%WeakSetPrototype%": ["WeakSet", "prototype"]
|
|
3485
|
-
};
|
|
3486
|
-
var bind = require_function_bind();
|
|
3487
|
-
var hasOwn = require_hasown();
|
|
3488
|
-
var $concat = bind.call($call, Array.prototype.concat);
|
|
3489
|
-
var $spliceApply = bind.call($apply, Array.prototype.splice);
|
|
3490
|
-
var $replace = bind.call($call, String.prototype.replace);
|
|
3491
|
-
var $strSlice = bind.call($call, String.prototype.slice);
|
|
3492
|
-
var $exec = bind.call($call, RegExp.prototype.exec);
|
|
3493
|
-
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
|
|
3494
|
-
var reEscapeChar = /\\(\\)?/g;
|
|
3495
|
-
var stringToPath = function stringToPath(string) {
|
|
3496
|
-
var first = $strSlice(string, 0, 1);
|
|
3497
|
-
var last = $strSlice(string, -1);
|
|
3498
|
-
if (first === "%" && last !== "%") throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`");
|
|
3499
|
-
else if (last === "%" && first !== "%") throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`");
|
|
3500
|
-
var result = [];
|
|
3501
|
-
$replace(string, rePropName, function(match, number, quote, subString) {
|
|
3502
|
-
result[result.length] = quote ? $replace(subString, reEscapeChar, "$1") : number || match;
|
|
3503
|
-
});
|
|
3504
|
-
return result;
|
|
3505
|
-
};
|
|
3506
|
-
var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
|
|
3507
|
-
var intrinsicName = name;
|
|
3508
|
-
var alias;
|
|
3509
|
-
if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
|
|
3510
|
-
alias = LEGACY_ALIASES[intrinsicName];
|
|
3511
|
-
intrinsicName = "%" + alias[0] + "%";
|
|
3311
|
+
tryParseUnquoted(nestingLevel, parentArgType) {
|
|
3312
|
+
if (this.isEOF()) return null;
|
|
3313
|
+
const ch = this.char();
|
|
3314
|
+
if (ch === 60 || ch === 123 || ch === 35 && (parentArgType === "plural" || parentArgType === "selectordinal") || ch === 125 && nestingLevel > 0) return null;
|
|
3315
|
+
else {
|
|
3316
|
+
this.bump();
|
|
3317
|
+
return String.fromCodePoint(ch);
|
|
3512
3318
|
}
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3319
|
+
}
|
|
3320
|
+
parseArgument(nestingLevel, expectingCloseTag) {
|
|
3321
|
+
const openingBracePosition = this.clonePosition();
|
|
3322
|
+
this.bump();
|
|
3323
|
+
this.bumpSpace();
|
|
3324
|
+
if (this.isEOF()) return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
|
|
3325
|
+
if (this.char() === 125) {
|
|
3326
|
+
this.bump();
|
|
3327
|
+
return this.error(ErrorKind.EMPTY_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));
|
|
3522
3328
|
}
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
if (
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3329
|
+
let value = this.parseIdentifierIfPossible().value;
|
|
3330
|
+
if (!value) return this.error(ErrorKind.MALFORMED_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));
|
|
3331
|
+
this.bumpSpace();
|
|
3332
|
+
if (this.isEOF()) return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
|
|
3333
|
+
switch (this.char()) {
|
|
3334
|
+
case 125:
|
|
3335
|
+
this.bump();
|
|
3336
|
+
return {
|
|
3337
|
+
val: {
|
|
3338
|
+
type: TYPE$2.argument,
|
|
3339
|
+
value,
|
|
3340
|
+
location: createLocation(openingBracePosition, this.clonePosition())
|
|
3341
|
+
},
|
|
3342
|
+
err: null
|
|
3343
|
+
};
|
|
3344
|
+
case 44:
|
|
3345
|
+
this.bump();
|
|
3346
|
+
this.bumpSpace();
|
|
3347
|
+
if (this.isEOF()) return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
|
|
3348
|
+
return this.parseArgumentOptions(nestingLevel, expectingCloseTag, value, openingBracePosition);
|
|
3349
|
+
default: return this.error(ErrorKind.MALFORMED_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));
|
|
3539
3350
|
}
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3351
|
+
}
|
|
3352
|
+
/**
|
|
3353
|
+
* Advance the parser until the end of the identifier, if it is currently on
|
|
3354
|
+
* an identifier character. Return an empty string otherwise.
|
|
3355
|
+
*/
|
|
3356
|
+
parseIdentifierIfPossible() {
|
|
3357
|
+
const startingPosition = this.clonePosition();
|
|
3358
|
+
const startOffset = this.offset();
|
|
3359
|
+
const value = matchIdentifierAtIndex(this.message, startOffset);
|
|
3360
|
+
const endOffset = startOffset + value.length;
|
|
3361
|
+
this.bumpTo(endOffset);
|
|
3362
|
+
return {
|
|
3363
|
+
value,
|
|
3364
|
+
location: createLocation(startingPosition, this.clonePosition())
|
|
3365
|
+
};
|
|
3366
|
+
}
|
|
3367
|
+
parseArgumentOptions(nestingLevel, expectingCloseTag, value, openingBracePosition) {
|
|
3368
|
+
let typeStartPosition = this.clonePosition();
|
|
3369
|
+
let argType = this.parseIdentifierIfPossible().value;
|
|
3370
|
+
let typeEndPosition = this.clonePosition();
|
|
3371
|
+
switch (argType) {
|
|
3372
|
+
case "": return this.error(ErrorKind.EXPECT_ARGUMENT_TYPE, createLocation(typeStartPosition, typeEndPosition));
|
|
3373
|
+
case "number":
|
|
3374
|
+
case "date":
|
|
3375
|
+
case "time": {
|
|
3376
|
+
this.bumpSpace();
|
|
3377
|
+
let styleAndLocation = null;
|
|
3378
|
+
if (this.bumpIf(",")) {
|
|
3379
|
+
this.bumpSpace();
|
|
3380
|
+
const styleStartPosition = this.clonePosition();
|
|
3381
|
+
const result = this.parseSimpleArgStyleIfPossible();
|
|
3382
|
+
if (result.err) return result;
|
|
3383
|
+
const style = trimEnd(result.val);
|
|
3384
|
+
if (style.length === 0) return this.error(ErrorKind.EXPECT_ARGUMENT_STYLE, createLocation(this.clonePosition(), this.clonePosition()));
|
|
3385
|
+
styleAndLocation = {
|
|
3386
|
+
style,
|
|
3387
|
+
styleLocation: createLocation(styleStartPosition, this.clonePosition())
|
|
3388
|
+
};
|
|
3553
3389
|
}
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3390
|
+
const argCloseResult = this.tryParseArgumentClose(openingBracePosition);
|
|
3391
|
+
if (argCloseResult.err) return argCloseResult;
|
|
3392
|
+
const location = createLocation(openingBracePosition, this.clonePosition());
|
|
3393
|
+
if (styleAndLocation && styleAndLocation.style.startsWith("::")) {
|
|
3394
|
+
let skeleton = trimStart(styleAndLocation.style.slice(2));
|
|
3395
|
+
if (argType === "number") {
|
|
3396
|
+
const result = this.parseNumberSkeletonFromString(skeleton, styleAndLocation.styleLocation);
|
|
3397
|
+
if (result.err) return result;
|
|
3398
|
+
return {
|
|
3399
|
+
val: {
|
|
3400
|
+
type: TYPE$2.number,
|
|
3401
|
+
value,
|
|
3402
|
+
location,
|
|
3403
|
+
style: result.val
|
|
3404
|
+
},
|
|
3405
|
+
err: null
|
|
3406
|
+
};
|
|
3407
|
+
} else {
|
|
3408
|
+
if (skeleton.length === 0) return this.error(ErrorKind.EXPECT_DATE_TIME_SKELETON, location);
|
|
3409
|
+
let dateTimePattern = skeleton;
|
|
3410
|
+
if (this.locale) dateTimePattern = getBestPattern(skeleton, this.locale);
|
|
3411
|
+
const style = {
|
|
3412
|
+
type: SKELETON_TYPE$1.dateTime,
|
|
3413
|
+
pattern: dateTimePattern,
|
|
3414
|
+
location: styleAndLocation.styleLocation,
|
|
3415
|
+
parsedOptions: this.shouldParseSkeletons ? parseDateTimeSkeleton(dateTimePattern) : {}
|
|
3416
|
+
};
|
|
3417
|
+
return {
|
|
3418
|
+
val: {
|
|
3419
|
+
type: argType === "date" ? TYPE$2.date : TYPE$2.time,
|
|
3420
|
+
value,
|
|
3421
|
+
location,
|
|
3422
|
+
style
|
|
3423
|
+
},
|
|
3424
|
+
err: null
|
|
3425
|
+
};
|
|
3426
|
+
}
|
|
3562
3427
|
}
|
|
3563
|
-
|
|
3428
|
+
return {
|
|
3429
|
+
val: {
|
|
3430
|
+
type: argType === "number" ? TYPE$2.number : argType === "date" ? TYPE$2.date : TYPE$2.time,
|
|
3431
|
+
value,
|
|
3432
|
+
location,
|
|
3433
|
+
style: styleAndLocation?.style ?? null
|
|
3434
|
+
},
|
|
3435
|
+
err: null
|
|
3436
|
+
};
|
|
3437
|
+
}
|
|
3438
|
+
case "plural":
|
|
3439
|
+
case "selectordinal":
|
|
3440
|
+
case "select": {
|
|
3441
|
+
const typeEndPosition = this.clonePosition();
|
|
3442
|
+
this.bumpSpace();
|
|
3443
|
+
if (!this.bumpIf(",")) return this.error(ErrorKind.EXPECT_SELECT_ARGUMENT_OPTIONS, createLocation(typeEndPosition, { ...typeEndPosition }));
|
|
3444
|
+
this.bumpSpace();
|
|
3445
|
+
let identifierAndLocation = this.parseIdentifierIfPossible();
|
|
3446
|
+
let pluralOffset = 0;
|
|
3447
|
+
if (argType !== "select" && identifierAndLocation.value === "offset") {
|
|
3448
|
+
if (!this.bumpIf(":")) return this.error(ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, createLocation(this.clonePosition(), this.clonePosition()));
|
|
3449
|
+
this.bumpSpace();
|
|
3450
|
+
const result = this.tryParseDecimalInteger(ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, ErrorKind.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);
|
|
3451
|
+
if (result.err) return result;
|
|
3452
|
+
this.bumpSpace();
|
|
3453
|
+
identifierAndLocation = this.parseIdentifierIfPossible();
|
|
3454
|
+
pluralOffset = result.val;
|
|
3455
|
+
}
|
|
3456
|
+
const optionsResult = this.tryParsePluralOrSelectOptions(nestingLevel, argType, expectingCloseTag, identifierAndLocation);
|
|
3457
|
+
if (optionsResult.err) return optionsResult;
|
|
3458
|
+
const argCloseResult = this.tryParseArgumentClose(openingBracePosition);
|
|
3459
|
+
if (argCloseResult.err) return argCloseResult;
|
|
3460
|
+
const location = createLocation(openingBracePosition, this.clonePosition());
|
|
3461
|
+
if (argType === "select") return {
|
|
3462
|
+
val: {
|
|
3463
|
+
type: TYPE$2.select,
|
|
3464
|
+
value,
|
|
3465
|
+
options: fromEntries(optionsResult.val),
|
|
3466
|
+
location
|
|
3467
|
+
},
|
|
3468
|
+
err: null
|
|
3469
|
+
};
|
|
3470
|
+
else return {
|
|
3471
|
+
val: {
|
|
3472
|
+
type: TYPE$2.plural,
|
|
3473
|
+
value,
|
|
3474
|
+
options: fromEntries(optionsResult.val),
|
|
3475
|
+
offset: pluralOffset,
|
|
3476
|
+
pluralType: argType === "plural" ? "cardinal" : "ordinal",
|
|
3477
|
+
location
|
|
3478
|
+
},
|
|
3479
|
+
err: null
|
|
3480
|
+
};
|
|
3564
3481
|
}
|
|
3482
|
+
default: return this.error(ErrorKind.INVALID_ARGUMENT_TYPE, createLocation(typeStartPosition, typeEndPosition));
|
|
3565
3483
|
}
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
}
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
var hasPropertyDescriptors = function hasPropertyDescriptors() {
|
|
3604
|
-
return !!$defineProperty;
|
|
3605
|
-
};
|
|
3606
|
-
hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
|
|
3607
|
-
if (!$defineProperty) return null;
|
|
3608
|
-
try {
|
|
3609
|
-
return $defineProperty([], "length", { value: 1 }).length !== 1;
|
|
3610
|
-
} catch (e) {
|
|
3611
|
-
return true;
|
|
3484
|
+
}
|
|
3485
|
+
tryParseArgumentClose(openingBracePosition) {
|
|
3486
|
+
if (this.isEOF() || this.char() !== 125) return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
|
|
3487
|
+
this.bump();
|
|
3488
|
+
return {
|
|
3489
|
+
val: true,
|
|
3490
|
+
err: null
|
|
3491
|
+
};
|
|
3492
|
+
}
|
|
3493
|
+
/**
|
|
3494
|
+
* See: https://github.com/unicode-org/icu/blob/af7ed1f6d2298013dc303628438ec4abe1f16479/icu4c/source/common/messagepattern.cpp#L659
|
|
3495
|
+
*/
|
|
3496
|
+
parseSimpleArgStyleIfPossible() {
|
|
3497
|
+
let nestedBraces = 0;
|
|
3498
|
+
const startPosition = this.clonePosition();
|
|
3499
|
+
while (!this.isEOF()) switch (this.char()) {
|
|
3500
|
+
case 39: {
|
|
3501
|
+
this.bump();
|
|
3502
|
+
let apostrophePosition = this.clonePosition();
|
|
3503
|
+
if (!this.bumpUntil("'")) return this.error(ErrorKind.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE, createLocation(apostrophePosition, this.clonePosition()));
|
|
3504
|
+
this.bump();
|
|
3505
|
+
break;
|
|
3506
|
+
}
|
|
3507
|
+
case 123:
|
|
3508
|
+
nestedBraces += 1;
|
|
3509
|
+
this.bump();
|
|
3510
|
+
break;
|
|
3511
|
+
case 125:
|
|
3512
|
+
if (nestedBraces > 0) nestedBraces -= 1;
|
|
3513
|
+
else return {
|
|
3514
|
+
val: this.message.slice(startPosition.offset, this.offset()),
|
|
3515
|
+
err: null
|
|
3516
|
+
};
|
|
3517
|
+
break;
|
|
3518
|
+
default:
|
|
3519
|
+
this.bump();
|
|
3520
|
+
break;
|
|
3612
3521
|
}
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
var $floor = GetIntrinsic("%Math.floor%");
|
|
3625
|
-
/** @type {import('.')} */
|
|
3626
|
-
module.exports = function setFunctionLength(fn, length) {
|
|
3627
|
-
if (typeof fn !== "function") throw new $TypeError("`fn` is not a function");
|
|
3628
|
-
if (typeof length !== "number" || length < 0 || length > 4294967295 || $floor(length) !== length) throw new $TypeError("`length` must be a positive 32-bit integer");
|
|
3629
|
-
var loose = arguments.length > 2 && !!arguments[2];
|
|
3630
|
-
var functionLengthIsConfigurable = true;
|
|
3631
|
-
var functionLengthIsWritable = true;
|
|
3632
|
-
if ("length" in fn && gOPD) {
|
|
3633
|
-
var desc = gOPD(fn, "length");
|
|
3634
|
-
if (desc && !desc.configurable) functionLengthIsConfigurable = false;
|
|
3635
|
-
if (desc && !desc.writable) functionLengthIsWritable = false;
|
|
3522
|
+
return {
|
|
3523
|
+
val: this.message.slice(startPosition.offset, this.offset()),
|
|
3524
|
+
err: null
|
|
3525
|
+
};
|
|
3526
|
+
}
|
|
3527
|
+
parseNumberSkeletonFromString(skeleton, location) {
|
|
3528
|
+
let tokens = [];
|
|
3529
|
+
try {
|
|
3530
|
+
tokens = parseNumberSkeletonFromString(skeleton);
|
|
3531
|
+
} catch {
|
|
3532
|
+
return this.error(ErrorKind.INVALID_NUMBER_SKELETON, location);
|
|
3636
3533
|
}
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
var bind = require_function_bind();
|
|
3646
|
-
var $apply = require_functionApply();
|
|
3647
|
-
var actualApply = require_actualApply();
|
|
3648
|
-
/** @type {import('./applyBind')} */
|
|
3649
|
-
module.exports = function applyBind() {
|
|
3650
|
-
return actualApply(bind, $apply, arguments);
|
|
3651
|
-
};
|
|
3652
|
-
}));
|
|
3653
|
-
//#endregion
|
|
3654
|
-
//#region node_modules/.aspect_rules_js/call-bind@1.0.8/node_modules/call-bind/index.js
|
|
3655
|
-
var require_call_bind = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3656
|
-
var setFunctionLength = require_set_function_length();
|
|
3657
|
-
var $defineProperty = require_es_define_property();
|
|
3658
|
-
var callBindBasic = require_call_bind_apply_helpers();
|
|
3659
|
-
var applyBind = require_applyBind();
|
|
3660
|
-
module.exports = function callBind(originalFunction) {
|
|
3661
|
-
var func = callBindBasic(arguments);
|
|
3662
|
-
var adjustedLength = originalFunction.length - (arguments.length - 1);
|
|
3663
|
-
return setFunctionLength(func, 1 + (adjustedLength > 0 ? adjustedLength : 0), true);
|
|
3664
|
-
};
|
|
3665
|
-
if ($defineProperty) $defineProperty(module.exports, "apply", { value: applyBind });
|
|
3666
|
-
else module.exports.apply = applyBind;
|
|
3667
|
-
}));
|
|
3668
|
-
//#endregion
|
|
3669
|
-
//#region node_modules/.aspect_rules_js/call-bound@1.0.4/node_modules/call-bound/index.js
|
|
3670
|
-
var require_call_bound = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3671
|
-
var GetIntrinsic = require_get_intrinsic();
|
|
3672
|
-
var callBindBasic = require_call_bind_apply_helpers();
|
|
3673
|
-
/** @type {(thisArg: string, searchString: string, position?: number) => number} */
|
|
3674
|
-
var $indexOf = callBindBasic([GetIntrinsic("%String.prototype.indexOf%")]);
|
|
3675
|
-
/** @type {import('.')} */
|
|
3676
|
-
module.exports = function callBoundIntrinsic(name, allowMissing) {
|
|
3677
|
-
var intrinsic = GetIntrinsic(name, !!allowMissing);
|
|
3678
|
-
if (typeof intrinsic === "function" && $indexOf(name, ".prototype.") > -1) return callBindBasic([intrinsic]);
|
|
3679
|
-
return intrinsic;
|
|
3680
|
-
};
|
|
3681
|
-
}));
|
|
3682
|
-
//#endregion
|
|
3683
|
-
//#region node_modules/.aspect_rules_js/json-stable-stringify@1.3.0/node_modules/json-stable-stringify/index.js
|
|
3684
|
-
var require_json_stable_stringify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3685
|
-
/** @type {typeof JSON.stringify} */
|
|
3686
|
-
var jsonStringify = (typeof JSON !== "undefined" ? JSON : require_jsonify()).stringify;
|
|
3687
|
-
var isArray = require_isarray();
|
|
3688
|
-
var objectKeys = require_object_keys();
|
|
3689
|
-
var callBind = require_call_bind();
|
|
3690
|
-
var callBound = require_call_bound();
|
|
3691
|
-
var $join = callBound("Array.prototype.join");
|
|
3692
|
-
var $indexOf = callBound("Array.prototype.indexOf");
|
|
3693
|
-
var $splice = callBound("Array.prototype.splice");
|
|
3694
|
-
var $sort = callBound("Array.prototype.sort");
|
|
3695
|
-
/** @type {(n: number, char: string) => string} */
|
|
3696
|
-
var strRepeat = function repeat(n, char) {
|
|
3697
|
-
var str = "";
|
|
3698
|
-
for (var i = 0; i < n; i += 1) str += char;
|
|
3699
|
-
return str;
|
|
3700
|
-
};
|
|
3701
|
-
/** @type {(parent: import('.').Node, key: import('.').Key, value: unknown) => unknown} */
|
|
3702
|
-
var defaultReplacer = function(_parent, _key, value) {
|
|
3703
|
-
return value;
|
|
3704
|
-
};
|
|
3705
|
-
/** @type {import('.')} */
|
|
3706
|
-
module.exports = function stableStringify(obj) {
|
|
3707
|
-
/** @type {Parameters<import('.')>[1]} */
|
|
3708
|
-
var opts = arguments.length > 1 ? arguments[1] : void 0;
|
|
3709
|
-
var space = opts && opts.space || "";
|
|
3710
|
-
if (typeof space === "number") space = strRepeat(space, " ");
|
|
3711
|
-
var cycles = !!opts && typeof opts.cycles === "boolean" && opts.cycles;
|
|
3712
|
-
/** @type {undefined | typeof defaultReplacer} */
|
|
3713
|
-
var replacer = opts && opts.replacer ? callBind(opts.replacer) : defaultReplacer;
|
|
3714
|
-
if (opts && typeof opts.collapseEmpty !== "undefined" && typeof opts.collapseEmpty !== "boolean") throw new TypeError("`collapseEmpty` must be a boolean, if provided");
|
|
3715
|
-
var collapseEmpty = !!opts && opts.collapseEmpty;
|
|
3716
|
-
var cmpOpt = typeof opts === "function" ? opts : opts && opts.cmp;
|
|
3717
|
-
/** @type {undefined | (<T extends import('.').NonArrayNode>(node: T) => (a: Exclude<keyof T, symbol | number>, b: Exclude<keyof T, symbol | number>) => number)} */
|
|
3718
|
-
var cmp = cmpOpt && function(node) {
|
|
3719
|
-
var get = cmpOpt.length > 2 && function get(k) {
|
|
3720
|
-
return node[k];
|
|
3721
|
-
};
|
|
3722
|
-
return function(a, b) {
|
|
3723
|
-
return cmpOpt({
|
|
3724
|
-
key: a,
|
|
3725
|
-
value: node[a]
|
|
3726
|
-
}, {
|
|
3727
|
-
key: b,
|
|
3728
|
-
value: node[b]
|
|
3729
|
-
}, get ? ( /** @type {import('.').Getter} */ {
|
|
3730
|
-
__proto__: null,
|
|
3731
|
-
get
|
|
3732
|
-
}) : void 0);
|
|
3733
|
-
};
|
|
3534
|
+
return {
|
|
3535
|
+
val: {
|
|
3536
|
+
type: SKELETON_TYPE$1.number,
|
|
3537
|
+
tokens,
|
|
3538
|
+
location,
|
|
3539
|
+
parsedOptions: this.shouldParseSkeletons ? parseNumberSkeleton(tokens) : {}
|
|
3540
|
+
},
|
|
3541
|
+
err: null
|
|
3734
3542
|
};
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3543
|
+
}
|
|
3544
|
+
/**
|
|
3545
|
+
* @param nesting_level The current nesting level of messages.
|
|
3546
|
+
* This can be positive when parsing message fragment in select or plural argument options.
|
|
3547
|
+
* @param parent_arg_type The parent argument's type.
|
|
3548
|
+
* @param parsed_first_identifier If provided, this is the first identifier-like selector of
|
|
3549
|
+
* the argument. It is a by-product of a previous parsing attempt.
|
|
3550
|
+
* @param expecting_close_tag If true, this message is directly or indirectly nested inside
|
|
3551
|
+
* between a pair of opening and closing tags. The nested message will not parse beyond
|
|
3552
|
+
* the closing tag boundary.
|
|
3553
|
+
*/
|
|
3554
|
+
tryParsePluralOrSelectOptions(nestingLevel, parentArgType, expectCloseTag, parsedFirstIdentifier) {
|
|
3555
|
+
let hasOtherClause = false;
|
|
3556
|
+
const options = [];
|
|
3557
|
+
const parsedSelectors = /* @__PURE__ */ new Set();
|
|
3558
|
+
let { value: selector, location: selectorLocation } = parsedFirstIdentifier;
|
|
3559
|
+
while (true) {
|
|
3560
|
+
if (selector.length === 0) {
|
|
3561
|
+
const startPosition = this.clonePosition();
|
|
3562
|
+
if (parentArgType !== "select" && this.bumpIf("=")) {
|
|
3563
|
+
const result = this.tryParseDecimalInteger(ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, ErrorKind.INVALID_PLURAL_ARGUMENT_SELECTOR);
|
|
3564
|
+
if (result.err) return result;
|
|
3565
|
+
selectorLocation = createLocation(startPosition, this.clonePosition());
|
|
3566
|
+
selector = this.message.slice(startPosition.offset, this.offset());
|
|
3567
|
+
} else break;
|
|
3755
3568
|
}
|
|
3756
|
-
if (
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3569
|
+
if (parsedSelectors.has(selector)) return this.error(parentArgType === "select" ? ErrorKind.DUPLICATE_SELECT_ARGUMENT_SELECTOR : ErrorKind.DUPLICATE_PLURAL_ARGUMENT_SELECTOR, selectorLocation);
|
|
3570
|
+
if (selector === "other") hasOtherClause = true;
|
|
3571
|
+
this.bumpSpace();
|
|
3572
|
+
const openingBracePosition = this.clonePosition();
|
|
3573
|
+
if (!this.bumpIf("{")) return this.error(parentArgType === "select" ? ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT : ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT, createLocation(this.clonePosition(), this.clonePosition()));
|
|
3574
|
+
const fragmentResult = this.parseMessage(nestingLevel + 1, parentArgType, expectCloseTag);
|
|
3575
|
+
if (fragmentResult.err) return fragmentResult;
|
|
3576
|
+
const argCloseResult = this.tryParseArgumentClose(openingBracePosition);
|
|
3577
|
+
if (argCloseResult.err) return argCloseResult;
|
|
3578
|
+
options.push([selector, {
|
|
3579
|
+
value: fragmentResult.val,
|
|
3580
|
+
location: createLocation(openingBracePosition, this.clonePosition())
|
|
3581
|
+
}]);
|
|
3582
|
+
parsedSelectors.add(selector);
|
|
3583
|
+
this.bumpSpace();
|
|
3584
|
+
({value: selector, location: selectorLocation} = this.parseIdentifierIfPossible());
|
|
3585
|
+
}
|
|
3586
|
+
if (options.length === 0) return this.error(parentArgType === "select" ? ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR : ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, createLocation(this.clonePosition(), this.clonePosition()));
|
|
3587
|
+
if (this.requiresOtherClause && !hasOtherClause) return this.error(ErrorKind.MISSING_OTHER_CLAUSE, createLocation(this.clonePosition(), this.clonePosition()));
|
|
3588
|
+
return {
|
|
3589
|
+
val: options,
|
|
3590
|
+
err: null
|
|
3591
|
+
};
|
|
3592
|
+
}
|
|
3593
|
+
tryParseDecimalInteger(expectNumberError, invalidNumberError) {
|
|
3594
|
+
let sign = 1;
|
|
3595
|
+
const startingPosition = this.clonePosition();
|
|
3596
|
+
if (this.bumpIf("+")) {} else if (this.bumpIf("-")) sign = -1;
|
|
3597
|
+
let hasDigits = false;
|
|
3598
|
+
let decimal = 0;
|
|
3599
|
+
while (!this.isEOF()) {
|
|
3600
|
+
const ch = this.char();
|
|
3601
|
+
if (ch >= 48 && ch <= 57) {
|
|
3602
|
+
hasDigits = true;
|
|
3603
|
+
decimal = decimal * 10 + (ch - 48);
|
|
3604
|
+
this.bump();
|
|
3605
|
+
} else break;
|
|
3606
|
+
}
|
|
3607
|
+
const location = createLocation(startingPosition, this.clonePosition());
|
|
3608
|
+
if (!hasDigits) return this.error(expectNumberError, location);
|
|
3609
|
+
decimal *= sign;
|
|
3610
|
+
if (!Number.isSafeInteger(decimal)) return this.error(invalidNumberError, location);
|
|
3611
|
+
return {
|
|
3612
|
+
val: decimal,
|
|
3613
|
+
err: null
|
|
3614
|
+
};
|
|
3615
|
+
}
|
|
3616
|
+
offset() {
|
|
3617
|
+
return this.position.offset;
|
|
3618
|
+
}
|
|
3619
|
+
isEOF() {
|
|
3620
|
+
return this.offset() === this.message.length;
|
|
3621
|
+
}
|
|
3622
|
+
clonePosition() {
|
|
3623
|
+
return {
|
|
3624
|
+
offset: this.position.offset,
|
|
3625
|
+
line: this.position.line,
|
|
3626
|
+
column: this.position.column
|
|
3627
|
+
};
|
|
3628
|
+
}
|
|
3629
|
+
/**
|
|
3630
|
+
* Return the code point at the current position of the parser.
|
|
3631
|
+
* Throws if the index is out of bound.
|
|
3632
|
+
*/
|
|
3633
|
+
char() {
|
|
3634
|
+
const offset = this.position.offset;
|
|
3635
|
+
if (offset >= this.message.length) throw Error("out of bound");
|
|
3636
|
+
const code = this.message.codePointAt(offset);
|
|
3637
|
+
if (code === void 0) throw Error(`Offset ${offset} is at invalid UTF-16 code unit boundary`);
|
|
3638
|
+
return code;
|
|
3639
|
+
}
|
|
3640
|
+
error(kind, location) {
|
|
3641
|
+
return {
|
|
3642
|
+
val: null,
|
|
3643
|
+
err: {
|
|
3644
|
+
kind,
|
|
3645
|
+
message: this.message,
|
|
3646
|
+
location
|
|
3775
3647
|
}
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
if (terminal.isTTY) {
|
|
3790
|
-
if (terminal.columns > 0) await writeStderr(`\r${" ".repeat(terminal.columns - 1)}`);
|
|
3791
|
-
await writeStderr(`\r`);
|
|
3648
|
+
};
|
|
3649
|
+
}
|
|
3650
|
+
/** Bump the parser to the next UTF-16 code unit. */
|
|
3651
|
+
bump() {
|
|
3652
|
+
if (this.isEOF()) return;
|
|
3653
|
+
const code = this.char();
|
|
3654
|
+
if (code === 10) {
|
|
3655
|
+
this.position.line += 1;
|
|
3656
|
+
this.position.column = 1;
|
|
3657
|
+
this.position.offset += 1;
|
|
3658
|
+
} else {
|
|
3659
|
+
this.position.column += 1;
|
|
3660
|
+
this.position.offset += code < 65536 ? 1 : 2;
|
|
3792
3661
|
}
|
|
3793
|
-
} else {
|
|
3794
|
-
clearLine(terminal, CLEAR_WHOLE_LINE);
|
|
3795
|
-
cursorTo(terminal, 0, void 0);
|
|
3796
3662
|
}
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3663
|
+
/**
|
|
3664
|
+
* If the substring starting at the current position of the parser has
|
|
3665
|
+
* the given prefix, then bump the parser to the character immediately
|
|
3666
|
+
* following the prefix and return true. Otherwise, don't bump the parser
|
|
3667
|
+
* and return false.
|
|
3668
|
+
*/
|
|
3669
|
+
bumpIf(prefix) {
|
|
3670
|
+
if (this.message.startsWith(prefix, this.offset())) {
|
|
3671
|
+
for (let i = 0; i < prefix.length; i++) this.bump();
|
|
3672
|
+
return true;
|
|
3673
|
+
}
|
|
3674
|
+
return false;
|
|
3675
|
+
}
|
|
3676
|
+
/**
|
|
3677
|
+
* Bump the parser until the pattern character is found and return `true`.
|
|
3678
|
+
* Otherwise bump to the end of the file and return `false`.
|
|
3679
|
+
*/
|
|
3680
|
+
bumpUntil(pattern) {
|
|
3681
|
+
const currentOffset = this.offset();
|
|
3682
|
+
const index = this.message.indexOf(pattern, currentOffset);
|
|
3683
|
+
if (index >= 0) {
|
|
3684
|
+
this.bumpTo(index);
|
|
3685
|
+
return true;
|
|
3686
|
+
} else {
|
|
3687
|
+
this.bumpTo(this.message.length);
|
|
3688
|
+
return false;
|
|
3689
|
+
}
|
|
3690
|
+
}
|
|
3691
|
+
/**
|
|
3692
|
+
* Bump the parser to the target offset.
|
|
3693
|
+
* If target offset is beyond the end of the input, bump the parser to the end of the input.
|
|
3694
|
+
*/
|
|
3695
|
+
bumpTo(targetOffset) {
|
|
3696
|
+
if (this.offset() > targetOffset) throw Error(`targetOffset ${targetOffset} must be greater than or equal to the current offset ${this.offset()}`);
|
|
3697
|
+
targetOffset = Math.min(targetOffset, this.message.length);
|
|
3698
|
+
while (true) {
|
|
3699
|
+
const offset = this.offset();
|
|
3700
|
+
if (offset === targetOffset) break;
|
|
3701
|
+
if (offset > targetOffset) throw Error(`targetOffset ${targetOffset} is at invalid UTF-16 code unit boundary`);
|
|
3702
|
+
this.bump();
|
|
3703
|
+
if (this.isEOF()) break;
|
|
3704
|
+
}
|
|
3705
|
+
}
|
|
3706
|
+
/** advance the parser through all whitespace to the next non-whitespace code unit. */
|
|
3707
|
+
bumpSpace() {
|
|
3708
|
+
while (!this.isEOF() && _isWhiteSpace(this.char())) this.bump();
|
|
3709
|
+
}
|
|
3710
|
+
/**
|
|
3711
|
+
* Peek at the *next* Unicode codepoint in the input without advancing the parser.
|
|
3712
|
+
* If the input has been exhausted, then this returns null.
|
|
3713
|
+
*/
|
|
3714
|
+
peek() {
|
|
3715
|
+
if (this.isEOF()) return null;
|
|
3716
|
+
const code = this.char();
|
|
3717
|
+
const offset = this.offset();
|
|
3718
|
+
return this.message.charCodeAt(offset + (code >= 65536 ? 2 : 1)) ?? null;
|
|
3719
|
+
}
|
|
3802
3720
|
};
|
|
3803
|
-
|
|
3804
|
-
|
|
3721
|
+
/**
|
|
3722
|
+
* This check if codepoint is alphabet (lower & uppercase)
|
|
3723
|
+
* @param codepoint
|
|
3724
|
+
* @returns
|
|
3725
|
+
*/
|
|
3726
|
+
function _isAlpha(codepoint) {
|
|
3727
|
+
return codepoint >= 97 && codepoint <= 122 || codepoint >= 65 && codepoint <= 90;
|
|
3805
3728
|
}
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
await clearLine$1(process.stderr);
|
|
3809
|
-
await writeStderr(format(label$1("debug", message), ...args));
|
|
3810
|
-
await writeStderr("\n");
|
|
3729
|
+
function _isAlphaOrSlash(codepoint) {
|
|
3730
|
+
return _isAlpha(codepoint) || codepoint === 47;
|
|
3811
3731
|
}
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
await writeStderr("\n");
|
|
3732
|
+
/** See `parseTag` function docs. */
|
|
3733
|
+
function _isPotentialElementNameChar(c) {
|
|
3734
|
+
return c === 45 || c === 46 || c >= 48 && c <= 57 || c === 95 || c >= 97 && c <= 122 || c >= 65 && c <= 90 || c == 183 || c >= 192 && c <= 214 || c >= 216 && c <= 246 || c >= 248 && c <= 893 || c >= 895 && c <= 8191 || c >= 8204 && c <= 8205 || c >= 8255 && c <= 8256 || c >= 8304 && c <= 8591 || c >= 11264 && c <= 12271 || c >= 12289 && c <= 55295 || c >= 63744 && c <= 64975 || c >= 65008 && c <= 65533 || c >= 65536 && c <= 983039;
|
|
3816
3735
|
}
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3736
|
+
/**
|
|
3737
|
+
* Code point equivalent of regex `\p{White_Space}`.
|
|
3738
|
+
* From: https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt
|
|
3739
|
+
*/
|
|
3740
|
+
function _isWhiteSpace(c) {
|
|
3741
|
+
return c >= 9 && c <= 13 || c === 32 || c === 133 || c >= 8206 && c <= 8207 || c === 8232 || c === 8233;
|
|
3742
|
+
}
|
|
3743
|
+
/**
|
|
3744
|
+
* Collect all variables in an AST to Record<string, TYPE>
|
|
3745
|
+
* @param ast AST to collect variables from
|
|
3746
|
+
* @param vars Record of variable name to variable type
|
|
3747
|
+
*/
|
|
3748
|
+
function collectVariables(ast, vars = /* @__PURE__ */ new Map()) {
|
|
3749
|
+
ast.forEach((el) => {
|
|
3750
|
+
if (isArgumentElement$1(el) || isDateElement$1(el) || isTimeElement$1(el) || isNumberElement$1(el)) if (vars.has(el.value)) {
|
|
3751
|
+
const existingType = vars.get(el.value);
|
|
3752
|
+
if (existingType !== el.type && existingType !== TYPE$2.plural && existingType !== TYPE$2.select) throw new Error(`Variable ${el.value} has conflicting types`);
|
|
3753
|
+
} else vars.set(el.value, el.type);
|
|
3754
|
+
if (isPluralElement$2(el) || isSelectElement$2(el)) {
|
|
3755
|
+
vars.set(el.value, el.type);
|
|
3756
|
+
Object.keys(el.options).forEach((k) => {
|
|
3757
|
+
collectVariables(el.options[k].value, vars);
|
|
3758
|
+
});
|
|
3759
|
+
}
|
|
3760
|
+
if (isTagElement$2(el)) {
|
|
3761
|
+
vars.set(el.value, el.type);
|
|
3762
|
+
collectVariables(el.children, vars);
|
|
3763
|
+
}
|
|
3764
|
+
});
|
|
3765
|
+
}
|
|
3766
|
+
/**
|
|
3767
|
+
* Check if 2 ASTs are structurally the same. This primarily means that
|
|
3768
|
+
* they have the same variables with the same type
|
|
3769
|
+
* @param a
|
|
3770
|
+
* @param b
|
|
3771
|
+
* @returns
|
|
3772
|
+
*/
|
|
3773
|
+
function isStructurallySame(a, b) {
|
|
3774
|
+
const aVars = /* @__PURE__ */ new Map();
|
|
3775
|
+
const bVars = /* @__PURE__ */ new Map();
|
|
3776
|
+
collectVariables(a, aVars);
|
|
3777
|
+
collectVariables(b, bVars);
|
|
3778
|
+
if (aVars.size !== bVars.size) return {
|
|
3779
|
+
success: false,
|
|
3780
|
+
error: /* @__PURE__ */ new Error(`Different number of variables: [${Array.from(aVars.keys()).join(", ")}] vs [${Array.from(bVars.keys()).join(", ")}]`)
|
|
3781
|
+
};
|
|
3782
|
+
return Array.from(aVars.entries()).reduce((result, [key, type]) => {
|
|
3783
|
+
if (!result.success) return result;
|
|
3784
|
+
const bType = bVars.get(key);
|
|
3785
|
+
if (bType == null) return {
|
|
3786
|
+
success: false,
|
|
3787
|
+
error: /* @__PURE__ */ new Error(`Missing variable ${key} in message`)
|
|
3788
|
+
};
|
|
3789
|
+
if (bType !== type) return {
|
|
3790
|
+
success: false,
|
|
3791
|
+
error: /* @__PURE__ */ new Error(`Variable ${key} has conflicting types: ${TYPE$2[type]} vs ${TYPE$2[bType]}`)
|
|
3792
|
+
};
|
|
3793
|
+
return result;
|
|
3794
|
+
}, { success: true });
|
|
3795
|
+
}
|
|
3796
|
+
function pruneLocation(els) {
|
|
3797
|
+
els.forEach((el) => {
|
|
3798
|
+
delete el.location;
|
|
3799
|
+
if (isSelectElement$2(el) || isPluralElement$2(el)) for (const k in el.options) {
|
|
3800
|
+
delete el.options[k].location;
|
|
3801
|
+
pruneLocation(el.options[k].value);
|
|
3802
|
+
}
|
|
3803
|
+
else if (isNumberElement$1(el) && isNumberSkeleton(el.style)) delete el.style.location;
|
|
3804
|
+
else if ((isDateElement$1(el) || isTimeElement$1(el)) && isDateTimeSkeleton(el.style)) delete el.style.location;
|
|
3805
|
+
else if (isTagElement$2(el)) pruneLocation(el.children);
|
|
3828
3806
|
});
|
|
3829
3807
|
}
|
|
3808
|
+
function parse(message, opts = {}) {
|
|
3809
|
+
opts = {
|
|
3810
|
+
shouldParseSkeletons: true,
|
|
3811
|
+
requiresOtherClause: true,
|
|
3812
|
+
...opts
|
|
3813
|
+
};
|
|
3814
|
+
const result = new Parser(message, opts).parse();
|
|
3815
|
+
if (result.err) {
|
|
3816
|
+
const error = SyntaxError(ErrorKind[result.err.kind]);
|
|
3817
|
+
error.location = result.err.location;
|
|
3818
|
+
error.originalMessage = result.err.message;
|
|
3819
|
+
throw error;
|
|
3820
|
+
}
|
|
3821
|
+
if (!opts?.captureLocation) pruneLocation(result.val);
|
|
3822
|
+
return result.val;
|
|
3823
|
+
}
|
|
3830
3824
|
//#endregion
|
|
3831
3825
|
//#region node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/manipulator.js
|
|
3832
3826
|
let TYPE$1 = /* @__PURE__ */ function(TYPE) {
|
|
@@ -152176,6 +152170,6 @@ ${e.message || ""}`;
|
|
|
152176
152170
|
};
|
|
152177
152171
|
}
|
|
152178
152172
|
//#endregion
|
|
152179
|
-
export {
|
|
152173
|
+
export { debug$1 as a, writeStderr as c, __commonJSMin as d, __exportAll as f, parse as i, writeStdout as l, __toESM as m, interpolateName as n, getStdinAsString as o, __require as p, isStructurallySame as r, warn as s, parseScript as t, require_json_stable_stringify as u };
|
|
152180
152174
|
|
|
152181
|
-
//# sourceMappingURL=parse_script-
|
|
152175
|
+
//# sourceMappingURL=parse_script-3um9mN8Y.js.map
|