@common.js/intl-messageformat 11.2.9
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/LICENSE.md +33 -0
- package/README.md +5 -0
- package/index.d.ts +144 -0
- package/index.js +697 -0
- package/index.js.map +1 -0
- package/intl-messageformat.iife.js +3658 -0
- package/package.json +24 -0
|
@@ -0,0 +1,3658 @@
|
|
|
1
|
+
//#region node_modules/.aspect_rules_js/@formatjs+fast-memoize@0.0.0/node_modules/@formatjs/fast-memoize/index.js
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
function _export(target, all) {
|
|
7
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
13
|
+
ErrorCode: function() {
|
|
14
|
+
return ErrorCode;
|
|
15
|
+
},
|
|
16
|
+
FormatError: function() {
|
|
17
|
+
return FormatError;
|
|
18
|
+
},
|
|
19
|
+
IntlMessageFormat: function() {
|
|
20
|
+
return IntlMessageFormat;
|
|
21
|
+
},
|
|
22
|
+
InvalidValueError: function() {
|
|
23
|
+
return InvalidValueError;
|
|
24
|
+
},
|
|
25
|
+
InvalidValueTypeError: function() {
|
|
26
|
+
return InvalidValueTypeError;
|
|
27
|
+
},
|
|
28
|
+
MissingValueError: function() {
|
|
29
|
+
return MissingValueError;
|
|
30
|
+
},
|
|
31
|
+
PART_TYPE: function() {
|
|
32
|
+
return PART_TYPE;
|
|
33
|
+
},
|
|
34
|
+
default: function() {
|
|
35
|
+
return intl_messageformat_default;
|
|
36
|
+
},
|
|
37
|
+
formatToParts: function() {
|
|
38
|
+
return formatToParts;
|
|
39
|
+
},
|
|
40
|
+
isFormatXMLElementFn: function() {
|
|
41
|
+
return isFormatXMLElementFn;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
function _arrayLikeToArray(arr, len) {
|
|
45
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
46
|
+
for(var i1 = 0, arr2 = new Array(len); i1 < len; i1++)arr2[i1] = arr[i1];
|
|
47
|
+
return arr2;
|
|
48
|
+
}
|
|
49
|
+
function _arrayWithHoles(arr) {
|
|
50
|
+
if (Array.isArray(arr)) return arr;
|
|
51
|
+
}
|
|
52
|
+
function _arrayWithoutHoles(arr) {
|
|
53
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
54
|
+
}
|
|
55
|
+
function _assertThisInitialized(self) {
|
|
56
|
+
if (self === void 0) {
|
|
57
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
58
|
+
}
|
|
59
|
+
return self;
|
|
60
|
+
}
|
|
61
|
+
function _classCallCheck(instance, Constructor) {
|
|
62
|
+
if (!(instance instanceof Constructor)) {
|
|
63
|
+
throw new TypeError("Cannot call a class as a function");
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function isNativeReflectConstruct() {
|
|
67
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
68
|
+
if (Reflect.construct.sham) return false;
|
|
69
|
+
if (typeof Proxy === "function") return true;
|
|
70
|
+
try {
|
|
71
|
+
Date.prototype.toString.call(Reflect.construct(Date, [], function() {}));
|
|
72
|
+
return true;
|
|
73
|
+
} catch (e) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function _construct(Parent, args, Class) {
|
|
78
|
+
if (isNativeReflectConstruct()) {
|
|
79
|
+
_construct = Reflect.construct;
|
|
80
|
+
} else {
|
|
81
|
+
_construct = function _construct(Parent, args, Class) {
|
|
82
|
+
var a = [
|
|
83
|
+
null
|
|
84
|
+
];
|
|
85
|
+
a.push.apply(a, args);
|
|
86
|
+
var Constructor = Function.bind.apply(Parent, a);
|
|
87
|
+
var instance = new Constructor();
|
|
88
|
+
if (Class) _setPrototypeOf(instance, Class.prototype);
|
|
89
|
+
return instance;
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return _construct.apply(null, arguments);
|
|
93
|
+
}
|
|
94
|
+
function _defineProperties(target, props) {
|
|
95
|
+
for(var i1 = 0; i1 < props.length; i1++){
|
|
96
|
+
var descriptor = props[i1];
|
|
97
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
98
|
+
descriptor.configurable = true;
|
|
99
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
100
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
104
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
105
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
106
|
+
return Constructor;
|
|
107
|
+
}
|
|
108
|
+
function _defineProperty(obj, key, value) {
|
|
109
|
+
if (key in obj) {
|
|
110
|
+
Object.defineProperty(obj, key, {
|
|
111
|
+
value: value,
|
|
112
|
+
enumerable: true,
|
|
113
|
+
configurable: true,
|
|
114
|
+
writable: true
|
|
115
|
+
});
|
|
116
|
+
} else {
|
|
117
|
+
obj[key] = value;
|
|
118
|
+
}
|
|
119
|
+
return obj;
|
|
120
|
+
}
|
|
121
|
+
function _extends() {
|
|
122
|
+
_extends = Object.assign || function(target) {
|
|
123
|
+
for(var i1 = 1; i1 < arguments.length; i1++){
|
|
124
|
+
var source = arguments[i1];
|
|
125
|
+
for(var key in source){
|
|
126
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
127
|
+
target[key] = source[key];
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return target;
|
|
132
|
+
};
|
|
133
|
+
return _extends.apply(this, arguments);
|
|
134
|
+
}
|
|
135
|
+
function _getPrototypeOf(o) {
|
|
136
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
137
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
138
|
+
};
|
|
139
|
+
return _getPrototypeOf(o);
|
|
140
|
+
}
|
|
141
|
+
function _inherits(subClass, superClass) {
|
|
142
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
143
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
144
|
+
}
|
|
145
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
146
|
+
constructor: {
|
|
147
|
+
value: subClass,
|
|
148
|
+
writable: true,
|
|
149
|
+
configurable: true
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
153
|
+
}
|
|
154
|
+
function _isNativeFunction(fn) {
|
|
155
|
+
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
156
|
+
}
|
|
157
|
+
function _iterableToArray(iter) {
|
|
158
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
159
|
+
}
|
|
160
|
+
function _iterableToArrayLimit(arr, i1) {
|
|
161
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
162
|
+
if (_i == null) return;
|
|
163
|
+
var _arr = [];
|
|
164
|
+
var _n = true;
|
|
165
|
+
var _d = false;
|
|
166
|
+
var _s, _e;
|
|
167
|
+
try {
|
|
168
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
169
|
+
_arr.push(_s.value);
|
|
170
|
+
if (i1 && _arr.length === i1) break;
|
|
171
|
+
}
|
|
172
|
+
} catch (err) {
|
|
173
|
+
_d = true;
|
|
174
|
+
_e = err;
|
|
175
|
+
} finally{
|
|
176
|
+
try {
|
|
177
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
178
|
+
} finally{
|
|
179
|
+
if (_d) throw _e;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return _arr;
|
|
183
|
+
}
|
|
184
|
+
function _nonIterableRest() {
|
|
185
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
186
|
+
}
|
|
187
|
+
function _nonIterableSpread() {
|
|
188
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
189
|
+
}
|
|
190
|
+
function _objectSpread(target) {
|
|
191
|
+
for(var i1 = 1; i1 < arguments.length; i1++){
|
|
192
|
+
var source = arguments[i1] != null ? arguments[i1] : {};
|
|
193
|
+
var ownKeys = Object.keys(source);
|
|
194
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
195
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
196
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
197
|
+
}));
|
|
198
|
+
}
|
|
199
|
+
ownKeys.forEach(function(key) {
|
|
200
|
+
_defineProperty(target, key, source[key]);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
return target;
|
|
204
|
+
}
|
|
205
|
+
function ownKeys(object, enumerableOnly) {
|
|
206
|
+
var keys = Object.keys(object);
|
|
207
|
+
if (Object.getOwnPropertySymbols) {
|
|
208
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
209
|
+
if (enumerableOnly) {
|
|
210
|
+
symbols = symbols.filter(function(sym) {
|
|
211
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
keys.push.apply(keys, symbols);
|
|
215
|
+
}
|
|
216
|
+
return keys;
|
|
217
|
+
}
|
|
218
|
+
function _objectSpreadProps(target, source) {
|
|
219
|
+
source = source != null ? source : {};
|
|
220
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
221
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
222
|
+
} else {
|
|
223
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
224
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
return target;
|
|
228
|
+
}
|
|
229
|
+
function _possibleConstructorReturn(self, call) {
|
|
230
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
231
|
+
return call;
|
|
232
|
+
}
|
|
233
|
+
return _assertThisInitialized(self);
|
|
234
|
+
}
|
|
235
|
+
function _setPrototypeOf(o, p) {
|
|
236
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
237
|
+
o.__proto__ = p;
|
|
238
|
+
return o;
|
|
239
|
+
};
|
|
240
|
+
return _setPrototypeOf(o, p);
|
|
241
|
+
}
|
|
242
|
+
function _slicedToArray(arr, i1) {
|
|
243
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i1) || _unsupportedIterableToArray(arr, i1) || _nonIterableRest();
|
|
244
|
+
}
|
|
245
|
+
function _toArray(arr) {
|
|
246
|
+
return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
247
|
+
}
|
|
248
|
+
function _toConsumableArray(arr) {
|
|
249
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
250
|
+
}
|
|
251
|
+
var _typeof = function(obj) {
|
|
252
|
+
"@swc/helpers - typeof";
|
|
253
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
254
|
+
};
|
|
255
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
256
|
+
if (!o) return;
|
|
257
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
258
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
259
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
260
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
261
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
262
|
+
}
|
|
263
|
+
function _wrapNativeSuper(Class) {
|
|
264
|
+
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
265
|
+
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
|
266
|
+
if (Class === null || !_isNativeFunction(Class)) return Class;
|
|
267
|
+
if (typeof Class !== "function") {
|
|
268
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
269
|
+
}
|
|
270
|
+
if (typeof _cache !== "undefined") {
|
|
271
|
+
if (_cache.has(Class)) return _cache.get(Class);
|
|
272
|
+
_cache.set(Class, Wrapper);
|
|
273
|
+
}
|
|
274
|
+
function Wrapper() {
|
|
275
|
+
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
|
276
|
+
}
|
|
277
|
+
Wrapper.prototype = Object.create(Class.prototype, {
|
|
278
|
+
constructor: {
|
|
279
|
+
value: Wrapper,
|
|
280
|
+
enumerable: false,
|
|
281
|
+
writable: true,
|
|
282
|
+
configurable: true
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
return _setPrototypeOf(Wrapper, Class);
|
|
286
|
+
};
|
|
287
|
+
return _wrapNativeSuper(Class);
|
|
288
|
+
}
|
|
289
|
+
function _isNativeReflectConstruct() {
|
|
290
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
291
|
+
if (Reflect.construct.sham) return false;
|
|
292
|
+
if (typeof Proxy === "function") return true;
|
|
293
|
+
try {
|
|
294
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
295
|
+
return true;
|
|
296
|
+
} catch (e) {
|
|
297
|
+
return false;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
function _createSuper(Derived) {
|
|
301
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
302
|
+
return function _createSuperInternal() {
|
|
303
|
+
var Super = _getPrototypeOf(Derived), result;
|
|
304
|
+
if (hasNativeReflectConstruct) {
|
|
305
|
+
var NewTarget = _getPrototypeOf(this).constructor;
|
|
306
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
307
|
+
} else {
|
|
308
|
+
result = Super.apply(this, arguments);
|
|
309
|
+
}
|
|
310
|
+
return _possibleConstructorReturn(this, result);
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
var _IntlMessageFormat, __, __1, __2, __3;
|
|
314
|
+
function memoize(fn, options) {
|
|
315
|
+
var cache = options && options.cache ? options.cache : cacheDefault;
|
|
316
|
+
var serializer = options && options.serializer ? options.serializer : serializerDefault;
|
|
317
|
+
return (options && options.strategy ? options.strategy : strategyDefault)(fn, {
|
|
318
|
+
cache: cache,
|
|
319
|
+
serializer: serializer
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
function isPrimitive(value) {
|
|
323
|
+
return value == null || typeof value === "number" || typeof value === "boolean";
|
|
324
|
+
}
|
|
325
|
+
function monadic(fn, cache, serializer, arg) {
|
|
326
|
+
var cacheKey = isPrimitive(arg) ? arg : serializer(arg);
|
|
327
|
+
var computedValue = cache.get(cacheKey);
|
|
328
|
+
if (typeof computedValue === "undefined") {
|
|
329
|
+
computedValue = fn.call(this, arg);
|
|
330
|
+
cache.set(cacheKey, computedValue);
|
|
331
|
+
}
|
|
332
|
+
return computedValue;
|
|
333
|
+
}
|
|
334
|
+
function variadic(fn, cache, serializer) {
|
|
335
|
+
var args = Array.prototype.slice.call(arguments, 3);
|
|
336
|
+
var cacheKey = serializer(args);
|
|
337
|
+
var computedValue = cache.get(cacheKey);
|
|
338
|
+
if (typeof computedValue === "undefined") {
|
|
339
|
+
computedValue = fn.apply(this, args);
|
|
340
|
+
cache.set(cacheKey, computedValue);
|
|
341
|
+
}
|
|
342
|
+
return computedValue;
|
|
343
|
+
}
|
|
344
|
+
function assemble(fn, context, strategy, cache, serialize) {
|
|
345
|
+
return strategy.bind(context, fn, cache, serialize);
|
|
346
|
+
}
|
|
347
|
+
function strategyDefault(fn, options) {
|
|
348
|
+
var strategy = fn.length === 1 ? monadic : variadic;
|
|
349
|
+
return assemble(fn, this, strategy, options.cache.create(), options.serializer);
|
|
350
|
+
}
|
|
351
|
+
function strategyVariadic(fn, options) {
|
|
352
|
+
return assemble(fn, this, variadic, options.cache.create(), options.serializer);
|
|
353
|
+
}
|
|
354
|
+
function strategyMonadic(fn, options) {
|
|
355
|
+
return assemble(fn, this, monadic, options.cache.create(), options.serializer);
|
|
356
|
+
}
|
|
357
|
+
var serializerDefault = function serializerDefault() {
|
|
358
|
+
return JSON.stringify(arguments);
|
|
359
|
+
};
|
|
360
|
+
var ObjectWithoutPrototypeCache = /*#__PURE__*/ function() {
|
|
361
|
+
"use strict";
|
|
362
|
+
function ObjectWithoutPrototypeCache() {
|
|
363
|
+
_classCallCheck(this, ObjectWithoutPrototypeCache);
|
|
364
|
+
this.cache = Object.create(null);
|
|
365
|
+
}
|
|
366
|
+
_createClass(ObjectWithoutPrototypeCache, [
|
|
367
|
+
{
|
|
368
|
+
key: "get",
|
|
369
|
+
value: function get(key) {
|
|
370
|
+
return this.cache[key];
|
|
371
|
+
}
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
key: "set",
|
|
375
|
+
value: function set(key, value) {
|
|
376
|
+
this.cache[key] = value;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
]);
|
|
380
|
+
return ObjectWithoutPrototypeCache;
|
|
381
|
+
}();
|
|
382
|
+
var cacheDefault = {
|
|
383
|
+
create: function create() {
|
|
384
|
+
return new ObjectWithoutPrototypeCache();
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
var strategies = {
|
|
388
|
+
variadic: strategyVariadic,
|
|
389
|
+
monadic: strategyMonadic
|
|
390
|
+
};
|
|
391
|
+
//#endregion
|
|
392
|
+
//#region node_modules/.aspect_rules_js/@formatjs+icu-skeleton-parser@0.0.0/node_modules/@formatjs/icu-skeleton-parser/index.js
|
|
393
|
+
/**
|
|
394
|
+
* https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
|
395
|
+
* Credit: https://github.com/caridy/intl-datetimeformat-pattern/blob/master/index.js
|
|
396
|
+
* with some tweaks
|
|
397
|
+
*/ var DATE_TIME_REGEX = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;
|
|
398
|
+
/**
|
|
399
|
+
* Parse Date time skeleton into Intl.DateTimeFormatOptions
|
|
400
|
+
* Ref: https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
|
401
|
+
* @public
|
|
402
|
+
* @param skeleton skeleton string
|
|
403
|
+
*/ function parseDateTimeSkeleton(skeleton) {
|
|
404
|
+
var result = {};
|
|
405
|
+
skeleton.replace(DATE_TIME_REGEX, function(match) {
|
|
406
|
+
var len = match.length;
|
|
407
|
+
switch(match[0]){
|
|
408
|
+
case "G":
|
|
409
|
+
result.era = len === 4 ? "long" : len === 5 ? "narrow" : "short";
|
|
410
|
+
break;
|
|
411
|
+
case "y":
|
|
412
|
+
result.year = len === 2 ? "2-digit" : "numeric";
|
|
413
|
+
break;
|
|
414
|
+
case "Y":
|
|
415
|
+
case "u":
|
|
416
|
+
case "U":
|
|
417
|
+
case "r":
|
|
418
|
+
throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");
|
|
419
|
+
case "q":
|
|
420
|
+
case "Q":
|
|
421
|
+
throw new RangeError("`q/Q` (quarter) patterns are not supported");
|
|
422
|
+
case "M":
|
|
423
|
+
case "L":
|
|
424
|
+
result.month = [
|
|
425
|
+
"numeric",
|
|
426
|
+
"2-digit",
|
|
427
|
+
"short",
|
|
428
|
+
"long",
|
|
429
|
+
"narrow"
|
|
430
|
+
][len - 1];
|
|
431
|
+
break;
|
|
432
|
+
case "w":
|
|
433
|
+
case "W":
|
|
434
|
+
throw new RangeError("`w/W` (week) patterns are not supported");
|
|
435
|
+
case "d":
|
|
436
|
+
result.day = [
|
|
437
|
+
"numeric",
|
|
438
|
+
"2-digit"
|
|
439
|
+
][len - 1];
|
|
440
|
+
break;
|
|
441
|
+
case "D":
|
|
442
|
+
case "F":
|
|
443
|
+
case "g":
|
|
444
|
+
throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");
|
|
445
|
+
case "E":
|
|
446
|
+
result.weekday = len === 4 ? "long" : len === 5 ? "narrow" : "short";
|
|
447
|
+
break;
|
|
448
|
+
case "e":
|
|
449
|
+
if (len < 4) throw new RangeError("`e..eee` (weekday) patterns are not supported");
|
|
450
|
+
result.weekday = [
|
|
451
|
+
"short",
|
|
452
|
+
"long",
|
|
453
|
+
"narrow",
|
|
454
|
+
"short"
|
|
455
|
+
][len - 4];
|
|
456
|
+
break;
|
|
457
|
+
case "c":
|
|
458
|
+
if (len < 4) throw new RangeError("`c..ccc` (weekday) patterns are not supported");
|
|
459
|
+
result.weekday = [
|
|
460
|
+
"short",
|
|
461
|
+
"long",
|
|
462
|
+
"narrow",
|
|
463
|
+
"short"
|
|
464
|
+
][len - 4];
|
|
465
|
+
break;
|
|
466
|
+
case "a":
|
|
467
|
+
result.hour12 = true;
|
|
468
|
+
break;
|
|
469
|
+
case "b":
|
|
470
|
+
case "B":
|
|
471
|
+
throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead");
|
|
472
|
+
case "h":
|
|
473
|
+
result.hourCycle = "h12";
|
|
474
|
+
result.hour = [
|
|
475
|
+
"numeric",
|
|
476
|
+
"2-digit"
|
|
477
|
+
][len - 1];
|
|
478
|
+
break;
|
|
479
|
+
case "H":
|
|
480
|
+
result.hourCycle = "h23";
|
|
481
|
+
result.hour = [
|
|
482
|
+
"numeric",
|
|
483
|
+
"2-digit"
|
|
484
|
+
][len - 1];
|
|
485
|
+
break;
|
|
486
|
+
case "K":
|
|
487
|
+
result.hourCycle = "h11";
|
|
488
|
+
result.hour = [
|
|
489
|
+
"numeric",
|
|
490
|
+
"2-digit"
|
|
491
|
+
][len - 1];
|
|
492
|
+
break;
|
|
493
|
+
case "k":
|
|
494
|
+
result.hourCycle = "h24";
|
|
495
|
+
result.hour = [
|
|
496
|
+
"numeric",
|
|
497
|
+
"2-digit"
|
|
498
|
+
][len - 1];
|
|
499
|
+
break;
|
|
500
|
+
case "j":
|
|
501
|
+
case "J":
|
|
502
|
+
case "C":
|
|
503
|
+
throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");
|
|
504
|
+
case "m":
|
|
505
|
+
result.minute = [
|
|
506
|
+
"numeric",
|
|
507
|
+
"2-digit"
|
|
508
|
+
][len - 1];
|
|
509
|
+
break;
|
|
510
|
+
case "s":
|
|
511
|
+
result.second = [
|
|
512
|
+
"numeric",
|
|
513
|
+
"2-digit"
|
|
514
|
+
][len - 1];
|
|
515
|
+
break;
|
|
516
|
+
case "S":
|
|
517
|
+
case "A":
|
|
518
|
+
throw new RangeError("`S/A` (second) patterns are not supported, use `s` instead");
|
|
519
|
+
case "z":
|
|
520
|
+
result.timeZoneName = len < 4 ? "short" : "long";
|
|
521
|
+
break;
|
|
522
|
+
case "Z":
|
|
523
|
+
case "O":
|
|
524
|
+
case "v":
|
|
525
|
+
case "V":
|
|
526
|
+
case "X":
|
|
527
|
+
case "x":
|
|
528
|
+
throw new RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead");
|
|
529
|
+
}
|
|
530
|
+
return "";
|
|
531
|
+
});
|
|
532
|
+
return result;
|
|
533
|
+
}
|
|
534
|
+
var WHITE_SPACE_REGEX = /[\t-\r \x85\u200E\u200F\u2028\u2029]/i;
|
|
535
|
+
function parseNumberSkeletonFromString(skeleton) {
|
|
536
|
+
if (skeleton.length === 0) throw new Error("Number skeleton cannot be empty");
|
|
537
|
+
var stringTokens = skeleton.split(WHITE_SPACE_REGEX).filter(function(x) {
|
|
538
|
+
return x.length > 0;
|
|
539
|
+
});
|
|
540
|
+
var tokens = [];
|
|
541
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
542
|
+
try {
|
|
543
|
+
for(var _iterator = stringTokens[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
544
|
+
var stringToken = _step.value;
|
|
545
|
+
var stemAndOptions = stringToken.split("/");
|
|
546
|
+
if (stemAndOptions.length === 0) throw new Error("Invalid number skeleton");
|
|
547
|
+
var _stemAndOptions = _toArray(stemAndOptions), stem = _stemAndOptions[0], options = _stemAndOptions.slice(1);
|
|
548
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
549
|
+
try {
|
|
550
|
+
for(var _iterator1 = options[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
551
|
+
var option = _step1.value;
|
|
552
|
+
if (option.length === 0) throw new Error("Invalid number skeleton");
|
|
553
|
+
}
|
|
554
|
+
} catch (err) {
|
|
555
|
+
_didIteratorError1 = true;
|
|
556
|
+
_iteratorError1 = err;
|
|
557
|
+
} finally{
|
|
558
|
+
try {
|
|
559
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
560
|
+
_iterator1.return();
|
|
561
|
+
}
|
|
562
|
+
} finally{
|
|
563
|
+
if (_didIteratorError1) {
|
|
564
|
+
throw _iteratorError1;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
tokens.push({
|
|
569
|
+
stem: stem,
|
|
570
|
+
options: options
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
} catch (err) {
|
|
574
|
+
_didIteratorError = true;
|
|
575
|
+
_iteratorError = err;
|
|
576
|
+
} finally{
|
|
577
|
+
try {
|
|
578
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
579
|
+
_iterator.return();
|
|
580
|
+
}
|
|
581
|
+
} finally{
|
|
582
|
+
if (_didIteratorError) {
|
|
583
|
+
throw _iteratorError;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
return tokens;
|
|
588
|
+
}
|
|
589
|
+
function icuUnitToEcma(unit) {
|
|
590
|
+
return unit.replace(/^(.*?)-/, "");
|
|
591
|
+
}
|
|
592
|
+
var FRACTION_PRECISION_REGEX = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g;
|
|
593
|
+
var SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?[rs]?$/g;
|
|
594
|
+
var INTEGER_WIDTH_REGEX = /(\*)(0+)|(#+)(0+)|(0+)/g;
|
|
595
|
+
var CONCISE_INTEGER_WIDTH_REGEX = /^(0+)$/;
|
|
596
|
+
function parseSignificantPrecision(str) {
|
|
597
|
+
var result = {};
|
|
598
|
+
if (str[str.length - 1] === "r") result.roundingPriority = "morePrecision";
|
|
599
|
+
else if (str[str.length - 1] === "s") result.roundingPriority = "lessPrecision";
|
|
600
|
+
str.replace(SIGNIFICANT_PRECISION_REGEX, function(_, g1, g2) {
|
|
601
|
+
if (typeof g2 !== "string") {
|
|
602
|
+
result.minimumSignificantDigits = g1.length;
|
|
603
|
+
result.maximumSignificantDigits = g1.length;
|
|
604
|
+
} else if (g2 === "+") result.minimumSignificantDigits = g1.length;
|
|
605
|
+
else if (g1[0] === "#") result.maximumSignificantDigits = g1.length;
|
|
606
|
+
else {
|
|
607
|
+
result.minimumSignificantDigits = g1.length;
|
|
608
|
+
result.maximumSignificantDigits = g1.length + (typeof g2 === "string" ? g2.length : 0);
|
|
609
|
+
}
|
|
610
|
+
return "";
|
|
611
|
+
});
|
|
612
|
+
return result;
|
|
613
|
+
}
|
|
614
|
+
function parseSign(str) {
|
|
615
|
+
switch(str){
|
|
616
|
+
case "sign-auto":
|
|
617
|
+
return {
|
|
618
|
+
signDisplay: "auto"
|
|
619
|
+
};
|
|
620
|
+
case "sign-accounting":
|
|
621
|
+
case "()":
|
|
622
|
+
return {
|
|
623
|
+
currencySign: "accounting"
|
|
624
|
+
};
|
|
625
|
+
case "sign-always":
|
|
626
|
+
case "+!":
|
|
627
|
+
return {
|
|
628
|
+
signDisplay: "always"
|
|
629
|
+
};
|
|
630
|
+
case "sign-accounting-always":
|
|
631
|
+
case "()!":
|
|
632
|
+
return {
|
|
633
|
+
signDisplay: "always",
|
|
634
|
+
currencySign: "accounting"
|
|
635
|
+
};
|
|
636
|
+
case "sign-except-zero":
|
|
637
|
+
case "+?":
|
|
638
|
+
return {
|
|
639
|
+
signDisplay: "exceptZero"
|
|
640
|
+
};
|
|
641
|
+
case "sign-accounting-except-zero":
|
|
642
|
+
case "()?":
|
|
643
|
+
return {
|
|
644
|
+
signDisplay: "exceptZero",
|
|
645
|
+
currencySign: "accounting"
|
|
646
|
+
};
|
|
647
|
+
case "sign-never":
|
|
648
|
+
case "+_":
|
|
649
|
+
return {
|
|
650
|
+
signDisplay: "never"
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
function parseConciseScientificAndEngineeringStem(stem) {
|
|
655
|
+
var result;
|
|
656
|
+
if (stem[0] === "E" && stem[1] === "E") {
|
|
657
|
+
result = {
|
|
658
|
+
notation: "engineering"
|
|
659
|
+
};
|
|
660
|
+
stem = stem.slice(2);
|
|
661
|
+
} else if (stem[0] === "E") {
|
|
662
|
+
result = {
|
|
663
|
+
notation: "scientific"
|
|
664
|
+
};
|
|
665
|
+
stem = stem.slice(1);
|
|
666
|
+
}
|
|
667
|
+
if (result) {
|
|
668
|
+
var signDisplay = stem.slice(0, 2);
|
|
669
|
+
if (signDisplay === "+!") {
|
|
670
|
+
result.signDisplay = "always";
|
|
671
|
+
stem = stem.slice(2);
|
|
672
|
+
} else if (signDisplay === "+?") {
|
|
673
|
+
result.signDisplay = "exceptZero";
|
|
674
|
+
stem = stem.slice(2);
|
|
675
|
+
}
|
|
676
|
+
if (!CONCISE_INTEGER_WIDTH_REGEX.test(stem)) throw new Error("Malformed concise eng/scientific notation");
|
|
677
|
+
result.minimumIntegerDigits = stem.length;
|
|
678
|
+
}
|
|
679
|
+
return result;
|
|
680
|
+
}
|
|
681
|
+
function parseNotationOptions(opt) {
|
|
682
|
+
var result = {};
|
|
683
|
+
var signOpts = parseSign(opt);
|
|
684
|
+
if (signOpts) return signOpts;
|
|
685
|
+
return result;
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* https://github.com/unicode-org/icu/blob/master/docs/userguide/format_parse/numbers/skeletons.md#skeleton-stems-and-options
|
|
689
|
+
*/ function parseNumberSkeleton(tokens) {
|
|
690
|
+
var result = {};
|
|
691
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
692
|
+
try {
|
|
693
|
+
for(var _iterator = tokens[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
694
|
+
var token = _step.value;
|
|
695
|
+
switch(token.stem){
|
|
696
|
+
case "percent":
|
|
697
|
+
case "%":
|
|
698
|
+
result.style = "percent";
|
|
699
|
+
continue;
|
|
700
|
+
case "%x100":
|
|
701
|
+
result.style = "percent";
|
|
702
|
+
result.scale = 100;
|
|
703
|
+
continue;
|
|
704
|
+
case "currency":
|
|
705
|
+
result.style = "currency";
|
|
706
|
+
result.currency = token.options[0];
|
|
707
|
+
continue;
|
|
708
|
+
case "group-off":
|
|
709
|
+
case ",_":
|
|
710
|
+
result.useGrouping = false;
|
|
711
|
+
continue;
|
|
712
|
+
case "precision-integer":
|
|
713
|
+
case ".":
|
|
714
|
+
result.maximumFractionDigits = 0;
|
|
715
|
+
continue;
|
|
716
|
+
case "measure-unit":
|
|
717
|
+
case "unit":
|
|
718
|
+
result.style = "unit";
|
|
719
|
+
result.unit = icuUnitToEcma(token.options[0]);
|
|
720
|
+
continue;
|
|
721
|
+
case "compact-short":
|
|
722
|
+
case "K":
|
|
723
|
+
result.notation = "compact";
|
|
724
|
+
result.compactDisplay = "short";
|
|
725
|
+
continue;
|
|
726
|
+
case "compact-long":
|
|
727
|
+
case "KK":
|
|
728
|
+
result.notation = "compact";
|
|
729
|
+
result.compactDisplay = "long";
|
|
730
|
+
continue;
|
|
731
|
+
case "scientific":
|
|
732
|
+
result = _objectSpread(_objectSpreadProps(_objectSpread({}, result), {
|
|
733
|
+
notation: "scientific"
|
|
734
|
+
}), token.options.reduce(function(all, opt) {
|
|
735
|
+
return _objectSpread({}, all, parseNotationOptions(opt));
|
|
736
|
+
}, {}));
|
|
737
|
+
continue;
|
|
738
|
+
case "engineering":
|
|
739
|
+
result = _objectSpread(_objectSpreadProps(_objectSpread({}, result), {
|
|
740
|
+
notation: "engineering"
|
|
741
|
+
}), token.options.reduce(function(all, opt) {
|
|
742
|
+
return _objectSpread({}, all, parseNotationOptions(opt));
|
|
743
|
+
}, {}));
|
|
744
|
+
continue;
|
|
745
|
+
case "notation-simple":
|
|
746
|
+
result.notation = "standard";
|
|
747
|
+
continue;
|
|
748
|
+
case "unit-width-narrow":
|
|
749
|
+
result.currencyDisplay = "narrowSymbol";
|
|
750
|
+
result.unitDisplay = "narrow";
|
|
751
|
+
continue;
|
|
752
|
+
case "unit-width-short":
|
|
753
|
+
result.currencyDisplay = "code";
|
|
754
|
+
result.unitDisplay = "short";
|
|
755
|
+
continue;
|
|
756
|
+
case "unit-width-full-name":
|
|
757
|
+
result.currencyDisplay = "name";
|
|
758
|
+
result.unitDisplay = "long";
|
|
759
|
+
continue;
|
|
760
|
+
case "unit-width-iso-code":
|
|
761
|
+
result.currencyDisplay = "symbol";
|
|
762
|
+
continue;
|
|
763
|
+
case "scale":
|
|
764
|
+
result.scale = parseFloat(token.options[0]);
|
|
765
|
+
continue;
|
|
766
|
+
case "rounding-mode-floor":
|
|
767
|
+
result.roundingMode = "floor";
|
|
768
|
+
continue;
|
|
769
|
+
case "rounding-mode-ceiling":
|
|
770
|
+
result.roundingMode = "ceil";
|
|
771
|
+
continue;
|
|
772
|
+
case "rounding-mode-down":
|
|
773
|
+
result.roundingMode = "trunc";
|
|
774
|
+
continue;
|
|
775
|
+
case "rounding-mode-up":
|
|
776
|
+
result.roundingMode = "expand";
|
|
777
|
+
continue;
|
|
778
|
+
case "rounding-mode-half-even":
|
|
779
|
+
result.roundingMode = "halfEven";
|
|
780
|
+
continue;
|
|
781
|
+
case "rounding-mode-half-down":
|
|
782
|
+
result.roundingMode = "halfTrunc";
|
|
783
|
+
continue;
|
|
784
|
+
case "rounding-mode-half-up":
|
|
785
|
+
result.roundingMode = "halfExpand";
|
|
786
|
+
continue;
|
|
787
|
+
case "integer-width":
|
|
788
|
+
if (token.options.length > 1) throw new RangeError("integer-width stems only accept a single optional option");
|
|
789
|
+
token.options[0].replace(INTEGER_WIDTH_REGEX, function(_, g1, g2, g3, g4, g5) {
|
|
790
|
+
if (g1) result.minimumIntegerDigits = g2.length;
|
|
791
|
+
else if (g3 && g4) throw new Error("We currently do not support maximum integer digits");
|
|
792
|
+
else if (g5) throw new Error("We currently do not support exact integer digits");
|
|
793
|
+
return "";
|
|
794
|
+
});
|
|
795
|
+
continue;
|
|
796
|
+
}
|
|
797
|
+
if (CONCISE_INTEGER_WIDTH_REGEX.test(token.stem)) {
|
|
798
|
+
result.minimumIntegerDigits = token.stem.length;
|
|
799
|
+
continue;
|
|
800
|
+
}
|
|
801
|
+
if (FRACTION_PRECISION_REGEX.test(token.stem)) {
|
|
802
|
+
if (token.options.length > 1) throw new RangeError("Fraction-precision stems only accept a single optional option");
|
|
803
|
+
token.stem.replace(FRACTION_PRECISION_REGEX, function(_, g1, g2, g3, g4, g5) {
|
|
804
|
+
if (g2 === "*") result.minimumFractionDigits = g1.length;
|
|
805
|
+
else if (g3 && g3[0] === "#") result.maximumFractionDigits = g3.length;
|
|
806
|
+
else if (g4 && g5) {
|
|
807
|
+
result.minimumFractionDigits = g4.length;
|
|
808
|
+
result.maximumFractionDigits = g4.length + g5.length;
|
|
809
|
+
} else {
|
|
810
|
+
result.minimumFractionDigits = g1.length;
|
|
811
|
+
result.maximumFractionDigits = g1.length;
|
|
812
|
+
}
|
|
813
|
+
return "";
|
|
814
|
+
});
|
|
815
|
+
var opt = token.options[0];
|
|
816
|
+
if (opt === "w") result = _objectSpreadProps(_objectSpread({}, result), {
|
|
817
|
+
trailingZeroDisplay: "stripIfInteger"
|
|
818
|
+
});
|
|
819
|
+
else if (opt) result = _objectSpread({}, result, parseSignificantPrecision(opt));
|
|
820
|
+
continue;
|
|
821
|
+
}
|
|
822
|
+
if (SIGNIFICANT_PRECISION_REGEX.test(token.stem)) {
|
|
823
|
+
result = _objectSpread({}, result, parseSignificantPrecision(token.stem));
|
|
824
|
+
continue;
|
|
825
|
+
}
|
|
826
|
+
var signOpts = parseSign(token.stem);
|
|
827
|
+
if (signOpts) result = _objectSpread({}, result, signOpts);
|
|
828
|
+
var conciseScientificAndEngineeringOpts = parseConciseScientificAndEngineeringStem(token.stem);
|
|
829
|
+
if (conciseScientificAndEngineeringOpts) result = _objectSpread({}, result, conciseScientificAndEngineeringOpts);
|
|
830
|
+
}
|
|
831
|
+
} catch (err) {
|
|
832
|
+
_didIteratorError = true;
|
|
833
|
+
_iteratorError = err;
|
|
834
|
+
} finally{
|
|
835
|
+
try {
|
|
836
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
837
|
+
_iterator.return();
|
|
838
|
+
}
|
|
839
|
+
} finally{
|
|
840
|
+
if (_didIteratorError) {
|
|
841
|
+
throw _iteratorError;
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
return result;
|
|
846
|
+
}
|
|
847
|
+
//#endregion
|
|
848
|
+
//#region node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/index.js
|
|
849
|
+
var ErrorKind = /* @__PURE__ */ function(ErrorKind) {
|
|
850
|
+
/** Argument is unclosed (e.g. `{0`) */ ErrorKind[ErrorKind["EXPECT_ARGUMENT_CLOSING_BRACE"] = 1] = "EXPECT_ARGUMENT_CLOSING_BRACE";
|
|
851
|
+
/** Argument is empty (e.g. `{}`). */ ErrorKind[ErrorKind["EMPTY_ARGUMENT"] = 2] = "EMPTY_ARGUMENT";
|
|
852
|
+
/** Argument is malformed (e.g. `{foo!}``) */ ErrorKind[ErrorKind["MALFORMED_ARGUMENT"] = 3] = "MALFORMED_ARGUMENT";
|
|
853
|
+
/** Expect an argument type (e.g. `{foo,}`) */ ErrorKind[ErrorKind["EXPECT_ARGUMENT_TYPE"] = 4] = "EXPECT_ARGUMENT_TYPE";
|
|
854
|
+
/** Unsupported argument type (e.g. `{foo,foo}`) */ ErrorKind[ErrorKind["INVALID_ARGUMENT_TYPE"] = 5] = "INVALID_ARGUMENT_TYPE";
|
|
855
|
+
/** Expect an argument style (e.g. `{foo, number, }`) */ ErrorKind[ErrorKind["EXPECT_ARGUMENT_STYLE"] = 6] = "EXPECT_ARGUMENT_STYLE";
|
|
856
|
+
/** The number skeleton is invalid. */ ErrorKind[ErrorKind["INVALID_NUMBER_SKELETON"] = 7] = "INVALID_NUMBER_SKELETON";
|
|
857
|
+
/** The date time skeleton is invalid. */ ErrorKind[ErrorKind["INVALID_DATE_TIME_SKELETON"] = 8] = "INVALID_DATE_TIME_SKELETON";
|
|
858
|
+
/** Exepct a number skeleton following the `::` (e.g. `{foo, number, ::}`) */ ErrorKind[ErrorKind["EXPECT_NUMBER_SKELETON"] = 9] = "EXPECT_NUMBER_SKELETON";
|
|
859
|
+
/** Exepct a date time skeleton following the `::` (e.g. `{foo, date, ::}`) */ ErrorKind[ErrorKind["EXPECT_DATE_TIME_SKELETON"] = 10] = "EXPECT_DATE_TIME_SKELETON";
|
|
860
|
+
/** Unmatched apostrophes in the argument style (e.g. `{foo, number, 'test`) */ ErrorKind[ErrorKind["UNCLOSED_QUOTE_IN_ARGUMENT_STYLE"] = 11] = "UNCLOSED_QUOTE_IN_ARGUMENT_STYLE";
|
|
861
|
+
/** Missing select argument options (e.g. `{foo, select}`) */ ErrorKind[ErrorKind["EXPECT_SELECT_ARGUMENT_OPTIONS"] = 12] = "EXPECT_SELECT_ARGUMENT_OPTIONS";
|
|
862
|
+
/** Expecting an offset value in `plural` or `selectordinal` argument (e.g `{foo, plural, offset}`) */ ErrorKind[ErrorKind["EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE"] = 13] = "EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE";
|
|
863
|
+
/** Offset value in `plural` or `selectordinal` is invalid (e.g. `{foo, plural, offset: x}`) */ ErrorKind[ErrorKind["INVALID_PLURAL_ARGUMENT_OFFSET_VALUE"] = 14] = "INVALID_PLURAL_ARGUMENT_OFFSET_VALUE";
|
|
864
|
+
/** Expecting a selector in `select` argument (e.g `{foo, select}`) */ ErrorKind[ErrorKind["EXPECT_SELECT_ARGUMENT_SELECTOR"] = 15] = "EXPECT_SELECT_ARGUMENT_SELECTOR";
|
|
865
|
+
/** Expecting a selector in `plural` or `selectordinal` argument (e.g `{foo, plural}`) */ ErrorKind[ErrorKind["EXPECT_PLURAL_ARGUMENT_SELECTOR"] = 16] = "EXPECT_PLURAL_ARGUMENT_SELECTOR";
|
|
866
|
+
/** Expecting a message fragment after the `select` selector (e.g. `{foo, select, apple}`) */ ErrorKind[ErrorKind["EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT"] = 17] = "EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT";
|
|
867
|
+
/**
|
|
868
|
+
* Expecting a message fragment after the `plural` or `selectordinal` selector
|
|
869
|
+
* (e.g. `{foo, plural, one}`)
|
|
870
|
+
*/ ErrorKind[ErrorKind["EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT"] = 18] = "EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT";
|
|
871
|
+
/** Selector in `plural` or `selectordinal` is malformed (e.g. `{foo, plural, =x {#}}`) */ ErrorKind[ErrorKind["INVALID_PLURAL_ARGUMENT_SELECTOR"] = 19] = "INVALID_PLURAL_ARGUMENT_SELECTOR";
|
|
872
|
+
/**
|
|
873
|
+
* Duplicate selectors in `plural` or `selectordinal` argument.
|
|
874
|
+
* (e.g. {foo, plural, one {#} one {#}})
|
|
875
|
+
*/ ErrorKind[ErrorKind["DUPLICATE_PLURAL_ARGUMENT_SELECTOR"] = 20] = "DUPLICATE_PLURAL_ARGUMENT_SELECTOR";
|
|
876
|
+
/** Duplicate selectors in `select` argument.
|
|
877
|
+
* (e.g. {foo, select, apple {apple} apple {apple}})
|
|
878
|
+
*/ ErrorKind[ErrorKind["DUPLICATE_SELECT_ARGUMENT_SELECTOR"] = 21] = "DUPLICATE_SELECT_ARGUMENT_SELECTOR";
|
|
879
|
+
/** Plural or select argument option must have `other` clause. */ ErrorKind[ErrorKind["MISSING_OTHER_CLAUSE"] = 22] = "MISSING_OTHER_CLAUSE";
|
|
880
|
+
/** The tag is malformed. (e.g. `<bold!>foo</bold!>) */ ErrorKind[ErrorKind["INVALID_TAG"] = 23] = "INVALID_TAG";
|
|
881
|
+
/** The tag name is invalid. (e.g. `<123>foo</123>`) */ ErrorKind[ErrorKind["INVALID_TAG_NAME"] = 25] = "INVALID_TAG_NAME";
|
|
882
|
+
/** The closing tag does not match the opening tag. (e.g. `<bold>foo</italic>`) */ ErrorKind[ErrorKind["UNMATCHED_CLOSING_TAG"] = 26] = "UNMATCHED_CLOSING_TAG";
|
|
883
|
+
/** The opening tag has unmatched closing tag. (e.g. `<bold>foo`) */ ErrorKind[ErrorKind["UNCLOSED_TAG"] = 27] = "UNCLOSED_TAG";
|
|
884
|
+
return ErrorKind;
|
|
885
|
+
}({});
|
|
886
|
+
/**
|
|
887
|
+
* Type Guards
|
|
888
|
+
*/ function isLiteralElement(el) {
|
|
889
|
+
return el.type === 0;
|
|
890
|
+
}
|
|
891
|
+
function isArgumentElement(el) {
|
|
892
|
+
return el.type === 1;
|
|
893
|
+
}
|
|
894
|
+
function isNumberElement(el) {
|
|
895
|
+
return el.type === 2;
|
|
896
|
+
}
|
|
897
|
+
function isDateElement(el) {
|
|
898
|
+
return el.type === 3;
|
|
899
|
+
}
|
|
900
|
+
function isTimeElement(el) {
|
|
901
|
+
return el.type === 4;
|
|
902
|
+
}
|
|
903
|
+
function isSelectElement(el) {
|
|
904
|
+
return el.type === 5;
|
|
905
|
+
}
|
|
906
|
+
function isPluralElement(el) {
|
|
907
|
+
return el.type === 6;
|
|
908
|
+
}
|
|
909
|
+
function isPoundElement(el) {
|
|
910
|
+
return el.type === 7;
|
|
911
|
+
}
|
|
912
|
+
function isTagElement(el) {
|
|
913
|
+
return el.type === 8;
|
|
914
|
+
}
|
|
915
|
+
function isNumberSkeleton(el) {
|
|
916
|
+
return !!(el && typeof el === "object" && el.type === 0);
|
|
917
|
+
}
|
|
918
|
+
function isDateTimeSkeleton(el) {
|
|
919
|
+
return !!(el && typeof el === "object" && el.type === 1);
|
|
920
|
+
}
|
|
921
|
+
var SPACE_SEPARATOR_REGEX = /[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/;
|
|
922
|
+
var timeData = {
|
|
923
|
+
"001": [
|
|
924
|
+
"H",
|
|
925
|
+
"h"
|
|
926
|
+
],
|
|
927
|
+
"419": [
|
|
928
|
+
"h",
|
|
929
|
+
"H",
|
|
930
|
+
"hB",
|
|
931
|
+
"hb"
|
|
932
|
+
],
|
|
933
|
+
"AC": [
|
|
934
|
+
"H",
|
|
935
|
+
"h",
|
|
936
|
+
"hb",
|
|
937
|
+
"hB"
|
|
938
|
+
],
|
|
939
|
+
"AD": [
|
|
940
|
+
"H",
|
|
941
|
+
"hB"
|
|
942
|
+
],
|
|
943
|
+
"AE": [
|
|
944
|
+
"h",
|
|
945
|
+
"hB",
|
|
946
|
+
"hb",
|
|
947
|
+
"H"
|
|
948
|
+
],
|
|
949
|
+
"AF": [
|
|
950
|
+
"H",
|
|
951
|
+
"hb",
|
|
952
|
+
"hB",
|
|
953
|
+
"h"
|
|
954
|
+
],
|
|
955
|
+
"AG": [
|
|
956
|
+
"h",
|
|
957
|
+
"hb",
|
|
958
|
+
"H",
|
|
959
|
+
"hB"
|
|
960
|
+
],
|
|
961
|
+
"AI": [
|
|
962
|
+
"H",
|
|
963
|
+
"h",
|
|
964
|
+
"hb",
|
|
965
|
+
"hB"
|
|
966
|
+
],
|
|
967
|
+
"AL": [
|
|
968
|
+
"h",
|
|
969
|
+
"H",
|
|
970
|
+
"hB"
|
|
971
|
+
],
|
|
972
|
+
"AM": [
|
|
973
|
+
"H",
|
|
974
|
+
"hB"
|
|
975
|
+
],
|
|
976
|
+
"AO": [
|
|
977
|
+
"H",
|
|
978
|
+
"hB"
|
|
979
|
+
],
|
|
980
|
+
"AR": [
|
|
981
|
+
"h",
|
|
982
|
+
"H",
|
|
983
|
+
"hB",
|
|
984
|
+
"hb"
|
|
985
|
+
],
|
|
986
|
+
"AS": [
|
|
987
|
+
"h",
|
|
988
|
+
"H"
|
|
989
|
+
],
|
|
990
|
+
"AT": [
|
|
991
|
+
"H",
|
|
992
|
+
"hB"
|
|
993
|
+
],
|
|
994
|
+
"AU": [
|
|
995
|
+
"h",
|
|
996
|
+
"hb",
|
|
997
|
+
"H",
|
|
998
|
+
"hB"
|
|
999
|
+
],
|
|
1000
|
+
"AW": [
|
|
1001
|
+
"H",
|
|
1002
|
+
"hB"
|
|
1003
|
+
],
|
|
1004
|
+
"AX": [
|
|
1005
|
+
"H"
|
|
1006
|
+
],
|
|
1007
|
+
"AZ": [
|
|
1008
|
+
"H",
|
|
1009
|
+
"hB",
|
|
1010
|
+
"h"
|
|
1011
|
+
],
|
|
1012
|
+
"BA": [
|
|
1013
|
+
"H",
|
|
1014
|
+
"hB",
|
|
1015
|
+
"h"
|
|
1016
|
+
],
|
|
1017
|
+
"BB": [
|
|
1018
|
+
"h",
|
|
1019
|
+
"hb",
|
|
1020
|
+
"H",
|
|
1021
|
+
"hB"
|
|
1022
|
+
],
|
|
1023
|
+
"BD": [
|
|
1024
|
+
"h",
|
|
1025
|
+
"hB",
|
|
1026
|
+
"H"
|
|
1027
|
+
],
|
|
1028
|
+
"BE": [
|
|
1029
|
+
"H",
|
|
1030
|
+
"hB"
|
|
1031
|
+
],
|
|
1032
|
+
"BF": [
|
|
1033
|
+
"H",
|
|
1034
|
+
"hB"
|
|
1035
|
+
],
|
|
1036
|
+
"BG": [
|
|
1037
|
+
"H",
|
|
1038
|
+
"hB",
|
|
1039
|
+
"h"
|
|
1040
|
+
],
|
|
1041
|
+
"BH": [
|
|
1042
|
+
"h",
|
|
1043
|
+
"hB",
|
|
1044
|
+
"hb",
|
|
1045
|
+
"H"
|
|
1046
|
+
],
|
|
1047
|
+
"BI": [
|
|
1048
|
+
"H",
|
|
1049
|
+
"h"
|
|
1050
|
+
],
|
|
1051
|
+
"BJ": [
|
|
1052
|
+
"H",
|
|
1053
|
+
"hB"
|
|
1054
|
+
],
|
|
1055
|
+
"BL": [
|
|
1056
|
+
"H",
|
|
1057
|
+
"hB"
|
|
1058
|
+
],
|
|
1059
|
+
"BM": [
|
|
1060
|
+
"h",
|
|
1061
|
+
"hb",
|
|
1062
|
+
"H",
|
|
1063
|
+
"hB"
|
|
1064
|
+
],
|
|
1065
|
+
"BN": [
|
|
1066
|
+
"hb",
|
|
1067
|
+
"hB",
|
|
1068
|
+
"h",
|
|
1069
|
+
"H"
|
|
1070
|
+
],
|
|
1071
|
+
"BO": [
|
|
1072
|
+
"h",
|
|
1073
|
+
"H",
|
|
1074
|
+
"hB",
|
|
1075
|
+
"hb"
|
|
1076
|
+
],
|
|
1077
|
+
"BQ": [
|
|
1078
|
+
"H"
|
|
1079
|
+
],
|
|
1080
|
+
"BR": [
|
|
1081
|
+
"H",
|
|
1082
|
+
"hB"
|
|
1083
|
+
],
|
|
1084
|
+
"BS": [
|
|
1085
|
+
"h",
|
|
1086
|
+
"hb",
|
|
1087
|
+
"H",
|
|
1088
|
+
"hB"
|
|
1089
|
+
],
|
|
1090
|
+
"BT": [
|
|
1091
|
+
"h",
|
|
1092
|
+
"H"
|
|
1093
|
+
],
|
|
1094
|
+
"BW": [
|
|
1095
|
+
"H",
|
|
1096
|
+
"h",
|
|
1097
|
+
"hb",
|
|
1098
|
+
"hB"
|
|
1099
|
+
],
|
|
1100
|
+
"BY": [
|
|
1101
|
+
"H",
|
|
1102
|
+
"h"
|
|
1103
|
+
],
|
|
1104
|
+
"BZ": [
|
|
1105
|
+
"H",
|
|
1106
|
+
"h",
|
|
1107
|
+
"hb",
|
|
1108
|
+
"hB"
|
|
1109
|
+
],
|
|
1110
|
+
"CA": [
|
|
1111
|
+
"h",
|
|
1112
|
+
"hb",
|
|
1113
|
+
"H",
|
|
1114
|
+
"hB"
|
|
1115
|
+
],
|
|
1116
|
+
"CC": [
|
|
1117
|
+
"H",
|
|
1118
|
+
"h",
|
|
1119
|
+
"hb",
|
|
1120
|
+
"hB"
|
|
1121
|
+
],
|
|
1122
|
+
"CD": [
|
|
1123
|
+
"hB",
|
|
1124
|
+
"H"
|
|
1125
|
+
],
|
|
1126
|
+
"CF": [
|
|
1127
|
+
"H",
|
|
1128
|
+
"h",
|
|
1129
|
+
"hB"
|
|
1130
|
+
],
|
|
1131
|
+
"CG": [
|
|
1132
|
+
"H",
|
|
1133
|
+
"hB"
|
|
1134
|
+
],
|
|
1135
|
+
"CH": [
|
|
1136
|
+
"H",
|
|
1137
|
+
"hB",
|
|
1138
|
+
"h"
|
|
1139
|
+
],
|
|
1140
|
+
"CI": [
|
|
1141
|
+
"H",
|
|
1142
|
+
"hB"
|
|
1143
|
+
],
|
|
1144
|
+
"CK": [
|
|
1145
|
+
"H",
|
|
1146
|
+
"h",
|
|
1147
|
+
"hb",
|
|
1148
|
+
"hB"
|
|
1149
|
+
],
|
|
1150
|
+
"CL": [
|
|
1151
|
+
"h",
|
|
1152
|
+
"H",
|
|
1153
|
+
"hB",
|
|
1154
|
+
"hb"
|
|
1155
|
+
],
|
|
1156
|
+
"CM": [
|
|
1157
|
+
"H",
|
|
1158
|
+
"h",
|
|
1159
|
+
"hB"
|
|
1160
|
+
],
|
|
1161
|
+
"CN": [
|
|
1162
|
+
"H",
|
|
1163
|
+
"hB",
|
|
1164
|
+
"hb",
|
|
1165
|
+
"h"
|
|
1166
|
+
],
|
|
1167
|
+
"CO": [
|
|
1168
|
+
"h",
|
|
1169
|
+
"H",
|
|
1170
|
+
"hB",
|
|
1171
|
+
"hb"
|
|
1172
|
+
],
|
|
1173
|
+
"CP": [
|
|
1174
|
+
"H"
|
|
1175
|
+
],
|
|
1176
|
+
"CR": [
|
|
1177
|
+
"h",
|
|
1178
|
+
"H",
|
|
1179
|
+
"hB",
|
|
1180
|
+
"hb"
|
|
1181
|
+
],
|
|
1182
|
+
"CU": [
|
|
1183
|
+
"h",
|
|
1184
|
+
"H",
|
|
1185
|
+
"hB",
|
|
1186
|
+
"hb"
|
|
1187
|
+
],
|
|
1188
|
+
"CV": [
|
|
1189
|
+
"H",
|
|
1190
|
+
"hB"
|
|
1191
|
+
],
|
|
1192
|
+
"CW": [
|
|
1193
|
+
"H",
|
|
1194
|
+
"hB"
|
|
1195
|
+
],
|
|
1196
|
+
"CX": [
|
|
1197
|
+
"H",
|
|
1198
|
+
"h",
|
|
1199
|
+
"hb",
|
|
1200
|
+
"hB"
|
|
1201
|
+
],
|
|
1202
|
+
"CY": [
|
|
1203
|
+
"h",
|
|
1204
|
+
"H",
|
|
1205
|
+
"hb",
|
|
1206
|
+
"hB"
|
|
1207
|
+
],
|
|
1208
|
+
"CZ": [
|
|
1209
|
+
"H"
|
|
1210
|
+
],
|
|
1211
|
+
"DE": [
|
|
1212
|
+
"H",
|
|
1213
|
+
"hB"
|
|
1214
|
+
],
|
|
1215
|
+
"DG": [
|
|
1216
|
+
"H",
|
|
1217
|
+
"h",
|
|
1218
|
+
"hb",
|
|
1219
|
+
"hB"
|
|
1220
|
+
],
|
|
1221
|
+
"DJ": [
|
|
1222
|
+
"h",
|
|
1223
|
+
"H"
|
|
1224
|
+
],
|
|
1225
|
+
"DK": [
|
|
1226
|
+
"H"
|
|
1227
|
+
],
|
|
1228
|
+
"DM": [
|
|
1229
|
+
"h",
|
|
1230
|
+
"hb",
|
|
1231
|
+
"H",
|
|
1232
|
+
"hB"
|
|
1233
|
+
],
|
|
1234
|
+
"DO": [
|
|
1235
|
+
"h",
|
|
1236
|
+
"H",
|
|
1237
|
+
"hB",
|
|
1238
|
+
"hb"
|
|
1239
|
+
],
|
|
1240
|
+
"DZ": [
|
|
1241
|
+
"h",
|
|
1242
|
+
"hB",
|
|
1243
|
+
"hb",
|
|
1244
|
+
"H"
|
|
1245
|
+
],
|
|
1246
|
+
"EA": [
|
|
1247
|
+
"H",
|
|
1248
|
+
"h",
|
|
1249
|
+
"hB",
|
|
1250
|
+
"hb"
|
|
1251
|
+
],
|
|
1252
|
+
"EC": [
|
|
1253
|
+
"h",
|
|
1254
|
+
"H",
|
|
1255
|
+
"hB",
|
|
1256
|
+
"hb"
|
|
1257
|
+
],
|
|
1258
|
+
"EE": [
|
|
1259
|
+
"H",
|
|
1260
|
+
"hB"
|
|
1261
|
+
],
|
|
1262
|
+
"EG": [
|
|
1263
|
+
"h",
|
|
1264
|
+
"hB",
|
|
1265
|
+
"hb",
|
|
1266
|
+
"H"
|
|
1267
|
+
],
|
|
1268
|
+
"EH": [
|
|
1269
|
+
"h",
|
|
1270
|
+
"hB",
|
|
1271
|
+
"hb",
|
|
1272
|
+
"H"
|
|
1273
|
+
],
|
|
1274
|
+
"ER": [
|
|
1275
|
+
"h",
|
|
1276
|
+
"H"
|
|
1277
|
+
],
|
|
1278
|
+
"ES": [
|
|
1279
|
+
"H",
|
|
1280
|
+
"hB",
|
|
1281
|
+
"h",
|
|
1282
|
+
"hb"
|
|
1283
|
+
],
|
|
1284
|
+
"ET": [
|
|
1285
|
+
"hB",
|
|
1286
|
+
"hb",
|
|
1287
|
+
"h",
|
|
1288
|
+
"H"
|
|
1289
|
+
],
|
|
1290
|
+
"FI": [
|
|
1291
|
+
"H"
|
|
1292
|
+
],
|
|
1293
|
+
"FJ": [
|
|
1294
|
+
"h",
|
|
1295
|
+
"hb",
|
|
1296
|
+
"H",
|
|
1297
|
+
"hB"
|
|
1298
|
+
],
|
|
1299
|
+
"FK": [
|
|
1300
|
+
"H",
|
|
1301
|
+
"h",
|
|
1302
|
+
"hb",
|
|
1303
|
+
"hB"
|
|
1304
|
+
],
|
|
1305
|
+
"FM": [
|
|
1306
|
+
"h",
|
|
1307
|
+
"hb",
|
|
1308
|
+
"H",
|
|
1309
|
+
"hB"
|
|
1310
|
+
],
|
|
1311
|
+
"FO": [
|
|
1312
|
+
"H",
|
|
1313
|
+
"h"
|
|
1314
|
+
],
|
|
1315
|
+
"FR": [
|
|
1316
|
+
"H",
|
|
1317
|
+
"hB"
|
|
1318
|
+
],
|
|
1319
|
+
"GA": [
|
|
1320
|
+
"H",
|
|
1321
|
+
"hB"
|
|
1322
|
+
],
|
|
1323
|
+
"GB": [
|
|
1324
|
+
"H",
|
|
1325
|
+
"h",
|
|
1326
|
+
"hb",
|
|
1327
|
+
"hB"
|
|
1328
|
+
],
|
|
1329
|
+
"GD": [
|
|
1330
|
+
"h",
|
|
1331
|
+
"hb",
|
|
1332
|
+
"H",
|
|
1333
|
+
"hB"
|
|
1334
|
+
],
|
|
1335
|
+
"GE": [
|
|
1336
|
+
"H",
|
|
1337
|
+
"hB",
|
|
1338
|
+
"h"
|
|
1339
|
+
],
|
|
1340
|
+
"GF": [
|
|
1341
|
+
"H",
|
|
1342
|
+
"hB"
|
|
1343
|
+
],
|
|
1344
|
+
"GG": [
|
|
1345
|
+
"H",
|
|
1346
|
+
"h",
|
|
1347
|
+
"hb",
|
|
1348
|
+
"hB"
|
|
1349
|
+
],
|
|
1350
|
+
"GH": [
|
|
1351
|
+
"h",
|
|
1352
|
+
"H"
|
|
1353
|
+
],
|
|
1354
|
+
"GI": [
|
|
1355
|
+
"H",
|
|
1356
|
+
"h",
|
|
1357
|
+
"hb",
|
|
1358
|
+
"hB"
|
|
1359
|
+
],
|
|
1360
|
+
"GL": [
|
|
1361
|
+
"H",
|
|
1362
|
+
"h"
|
|
1363
|
+
],
|
|
1364
|
+
"GM": [
|
|
1365
|
+
"h",
|
|
1366
|
+
"hb",
|
|
1367
|
+
"H",
|
|
1368
|
+
"hB"
|
|
1369
|
+
],
|
|
1370
|
+
"GN": [
|
|
1371
|
+
"H",
|
|
1372
|
+
"hB"
|
|
1373
|
+
],
|
|
1374
|
+
"GP": [
|
|
1375
|
+
"H",
|
|
1376
|
+
"hB"
|
|
1377
|
+
],
|
|
1378
|
+
"GQ": [
|
|
1379
|
+
"H",
|
|
1380
|
+
"hB",
|
|
1381
|
+
"h",
|
|
1382
|
+
"hb"
|
|
1383
|
+
],
|
|
1384
|
+
"GR": [
|
|
1385
|
+
"h",
|
|
1386
|
+
"H",
|
|
1387
|
+
"hb",
|
|
1388
|
+
"hB"
|
|
1389
|
+
],
|
|
1390
|
+
"GS": [
|
|
1391
|
+
"H",
|
|
1392
|
+
"h",
|
|
1393
|
+
"hb",
|
|
1394
|
+
"hB"
|
|
1395
|
+
],
|
|
1396
|
+
"GT": [
|
|
1397
|
+
"h",
|
|
1398
|
+
"H",
|
|
1399
|
+
"hB",
|
|
1400
|
+
"hb"
|
|
1401
|
+
],
|
|
1402
|
+
"GU": [
|
|
1403
|
+
"h",
|
|
1404
|
+
"hb",
|
|
1405
|
+
"H",
|
|
1406
|
+
"hB"
|
|
1407
|
+
],
|
|
1408
|
+
"GW": [
|
|
1409
|
+
"H",
|
|
1410
|
+
"hB"
|
|
1411
|
+
],
|
|
1412
|
+
"GY": [
|
|
1413
|
+
"h",
|
|
1414
|
+
"hb",
|
|
1415
|
+
"H",
|
|
1416
|
+
"hB"
|
|
1417
|
+
],
|
|
1418
|
+
"HK": [
|
|
1419
|
+
"h",
|
|
1420
|
+
"hB",
|
|
1421
|
+
"hb",
|
|
1422
|
+
"H"
|
|
1423
|
+
],
|
|
1424
|
+
"HN": [
|
|
1425
|
+
"h",
|
|
1426
|
+
"H",
|
|
1427
|
+
"hB",
|
|
1428
|
+
"hb"
|
|
1429
|
+
],
|
|
1430
|
+
"HR": [
|
|
1431
|
+
"H",
|
|
1432
|
+
"hB"
|
|
1433
|
+
],
|
|
1434
|
+
"HU": [
|
|
1435
|
+
"H",
|
|
1436
|
+
"h"
|
|
1437
|
+
],
|
|
1438
|
+
"IC": [
|
|
1439
|
+
"H",
|
|
1440
|
+
"h",
|
|
1441
|
+
"hB",
|
|
1442
|
+
"hb"
|
|
1443
|
+
],
|
|
1444
|
+
"ID": [
|
|
1445
|
+
"H"
|
|
1446
|
+
],
|
|
1447
|
+
"IE": [
|
|
1448
|
+
"H",
|
|
1449
|
+
"h",
|
|
1450
|
+
"hb",
|
|
1451
|
+
"hB"
|
|
1452
|
+
],
|
|
1453
|
+
"IL": [
|
|
1454
|
+
"H",
|
|
1455
|
+
"hB"
|
|
1456
|
+
],
|
|
1457
|
+
"IM": [
|
|
1458
|
+
"H",
|
|
1459
|
+
"h",
|
|
1460
|
+
"hb",
|
|
1461
|
+
"hB"
|
|
1462
|
+
],
|
|
1463
|
+
"IN": [
|
|
1464
|
+
"h",
|
|
1465
|
+
"H"
|
|
1466
|
+
],
|
|
1467
|
+
"IO": [
|
|
1468
|
+
"H",
|
|
1469
|
+
"h",
|
|
1470
|
+
"hb",
|
|
1471
|
+
"hB"
|
|
1472
|
+
],
|
|
1473
|
+
"IQ": [
|
|
1474
|
+
"h",
|
|
1475
|
+
"hB",
|
|
1476
|
+
"hb",
|
|
1477
|
+
"H"
|
|
1478
|
+
],
|
|
1479
|
+
"IR": [
|
|
1480
|
+
"hB",
|
|
1481
|
+
"H"
|
|
1482
|
+
],
|
|
1483
|
+
"IS": [
|
|
1484
|
+
"H"
|
|
1485
|
+
],
|
|
1486
|
+
"IT": [
|
|
1487
|
+
"H",
|
|
1488
|
+
"hB"
|
|
1489
|
+
],
|
|
1490
|
+
"JE": [
|
|
1491
|
+
"H",
|
|
1492
|
+
"h",
|
|
1493
|
+
"hb",
|
|
1494
|
+
"hB"
|
|
1495
|
+
],
|
|
1496
|
+
"JM": [
|
|
1497
|
+
"h",
|
|
1498
|
+
"hb",
|
|
1499
|
+
"H",
|
|
1500
|
+
"hB"
|
|
1501
|
+
],
|
|
1502
|
+
"JO": [
|
|
1503
|
+
"h",
|
|
1504
|
+
"hB",
|
|
1505
|
+
"hb",
|
|
1506
|
+
"H"
|
|
1507
|
+
],
|
|
1508
|
+
"JP": [
|
|
1509
|
+
"H",
|
|
1510
|
+
"K",
|
|
1511
|
+
"h"
|
|
1512
|
+
],
|
|
1513
|
+
"KE": [
|
|
1514
|
+
"hB",
|
|
1515
|
+
"hb",
|
|
1516
|
+
"H",
|
|
1517
|
+
"h"
|
|
1518
|
+
],
|
|
1519
|
+
"KG": [
|
|
1520
|
+
"H",
|
|
1521
|
+
"h",
|
|
1522
|
+
"hB",
|
|
1523
|
+
"hb"
|
|
1524
|
+
],
|
|
1525
|
+
"KH": [
|
|
1526
|
+
"hB",
|
|
1527
|
+
"h",
|
|
1528
|
+
"H",
|
|
1529
|
+
"hb"
|
|
1530
|
+
],
|
|
1531
|
+
"KI": [
|
|
1532
|
+
"h",
|
|
1533
|
+
"hb",
|
|
1534
|
+
"H",
|
|
1535
|
+
"hB"
|
|
1536
|
+
],
|
|
1537
|
+
"KM": [
|
|
1538
|
+
"H",
|
|
1539
|
+
"h",
|
|
1540
|
+
"hB",
|
|
1541
|
+
"hb"
|
|
1542
|
+
],
|
|
1543
|
+
"KN": [
|
|
1544
|
+
"h",
|
|
1545
|
+
"hb",
|
|
1546
|
+
"H",
|
|
1547
|
+
"hB"
|
|
1548
|
+
],
|
|
1549
|
+
"KP": [
|
|
1550
|
+
"h",
|
|
1551
|
+
"H",
|
|
1552
|
+
"hB",
|
|
1553
|
+
"hb"
|
|
1554
|
+
],
|
|
1555
|
+
"KR": [
|
|
1556
|
+
"h",
|
|
1557
|
+
"H",
|
|
1558
|
+
"hB",
|
|
1559
|
+
"hb"
|
|
1560
|
+
],
|
|
1561
|
+
"KW": [
|
|
1562
|
+
"h",
|
|
1563
|
+
"hB",
|
|
1564
|
+
"hb",
|
|
1565
|
+
"H"
|
|
1566
|
+
],
|
|
1567
|
+
"KY": [
|
|
1568
|
+
"h",
|
|
1569
|
+
"hb",
|
|
1570
|
+
"H",
|
|
1571
|
+
"hB"
|
|
1572
|
+
],
|
|
1573
|
+
"KZ": [
|
|
1574
|
+
"H",
|
|
1575
|
+
"hB"
|
|
1576
|
+
],
|
|
1577
|
+
"LA": [
|
|
1578
|
+
"H",
|
|
1579
|
+
"hb",
|
|
1580
|
+
"hB",
|
|
1581
|
+
"h"
|
|
1582
|
+
],
|
|
1583
|
+
"LB": [
|
|
1584
|
+
"h",
|
|
1585
|
+
"hB",
|
|
1586
|
+
"hb",
|
|
1587
|
+
"H"
|
|
1588
|
+
],
|
|
1589
|
+
"LC": [
|
|
1590
|
+
"h",
|
|
1591
|
+
"hb",
|
|
1592
|
+
"H",
|
|
1593
|
+
"hB"
|
|
1594
|
+
],
|
|
1595
|
+
"LI": [
|
|
1596
|
+
"H",
|
|
1597
|
+
"hB",
|
|
1598
|
+
"h"
|
|
1599
|
+
],
|
|
1600
|
+
"LK": [
|
|
1601
|
+
"H",
|
|
1602
|
+
"h",
|
|
1603
|
+
"hB",
|
|
1604
|
+
"hb"
|
|
1605
|
+
],
|
|
1606
|
+
"LR": [
|
|
1607
|
+
"h",
|
|
1608
|
+
"hb",
|
|
1609
|
+
"H",
|
|
1610
|
+
"hB"
|
|
1611
|
+
],
|
|
1612
|
+
"LS": [
|
|
1613
|
+
"h",
|
|
1614
|
+
"H"
|
|
1615
|
+
],
|
|
1616
|
+
"LT": [
|
|
1617
|
+
"H",
|
|
1618
|
+
"h",
|
|
1619
|
+
"hb",
|
|
1620
|
+
"hB"
|
|
1621
|
+
],
|
|
1622
|
+
"LU": [
|
|
1623
|
+
"H",
|
|
1624
|
+
"h",
|
|
1625
|
+
"hB"
|
|
1626
|
+
],
|
|
1627
|
+
"LV": [
|
|
1628
|
+
"H",
|
|
1629
|
+
"hB",
|
|
1630
|
+
"hb",
|
|
1631
|
+
"h"
|
|
1632
|
+
],
|
|
1633
|
+
"LY": [
|
|
1634
|
+
"h",
|
|
1635
|
+
"hB",
|
|
1636
|
+
"hb",
|
|
1637
|
+
"H"
|
|
1638
|
+
],
|
|
1639
|
+
"MA": [
|
|
1640
|
+
"H",
|
|
1641
|
+
"h",
|
|
1642
|
+
"hB",
|
|
1643
|
+
"hb"
|
|
1644
|
+
],
|
|
1645
|
+
"MC": [
|
|
1646
|
+
"H",
|
|
1647
|
+
"hB"
|
|
1648
|
+
],
|
|
1649
|
+
"MD": [
|
|
1650
|
+
"H",
|
|
1651
|
+
"hB"
|
|
1652
|
+
],
|
|
1653
|
+
"ME": [
|
|
1654
|
+
"H",
|
|
1655
|
+
"hB",
|
|
1656
|
+
"h"
|
|
1657
|
+
],
|
|
1658
|
+
"MF": [
|
|
1659
|
+
"H",
|
|
1660
|
+
"hB"
|
|
1661
|
+
],
|
|
1662
|
+
"MG": [
|
|
1663
|
+
"H",
|
|
1664
|
+
"h"
|
|
1665
|
+
],
|
|
1666
|
+
"MH": [
|
|
1667
|
+
"h",
|
|
1668
|
+
"hb",
|
|
1669
|
+
"H",
|
|
1670
|
+
"hB"
|
|
1671
|
+
],
|
|
1672
|
+
"MK": [
|
|
1673
|
+
"H",
|
|
1674
|
+
"h",
|
|
1675
|
+
"hb",
|
|
1676
|
+
"hB"
|
|
1677
|
+
],
|
|
1678
|
+
"ML": [
|
|
1679
|
+
"H"
|
|
1680
|
+
],
|
|
1681
|
+
"MM": [
|
|
1682
|
+
"hB",
|
|
1683
|
+
"hb",
|
|
1684
|
+
"H",
|
|
1685
|
+
"h"
|
|
1686
|
+
],
|
|
1687
|
+
"MN": [
|
|
1688
|
+
"H",
|
|
1689
|
+
"h",
|
|
1690
|
+
"hb",
|
|
1691
|
+
"hB"
|
|
1692
|
+
],
|
|
1693
|
+
"MO": [
|
|
1694
|
+
"h",
|
|
1695
|
+
"hB",
|
|
1696
|
+
"hb",
|
|
1697
|
+
"H"
|
|
1698
|
+
],
|
|
1699
|
+
"MP": [
|
|
1700
|
+
"h",
|
|
1701
|
+
"hb",
|
|
1702
|
+
"H",
|
|
1703
|
+
"hB"
|
|
1704
|
+
],
|
|
1705
|
+
"MQ": [
|
|
1706
|
+
"H",
|
|
1707
|
+
"hB"
|
|
1708
|
+
],
|
|
1709
|
+
"MR": [
|
|
1710
|
+
"h",
|
|
1711
|
+
"hB",
|
|
1712
|
+
"hb",
|
|
1713
|
+
"H"
|
|
1714
|
+
],
|
|
1715
|
+
"MS": [
|
|
1716
|
+
"H",
|
|
1717
|
+
"h",
|
|
1718
|
+
"hb",
|
|
1719
|
+
"hB"
|
|
1720
|
+
],
|
|
1721
|
+
"MT": [
|
|
1722
|
+
"H",
|
|
1723
|
+
"h"
|
|
1724
|
+
],
|
|
1725
|
+
"MU": [
|
|
1726
|
+
"H",
|
|
1727
|
+
"h"
|
|
1728
|
+
],
|
|
1729
|
+
"MV": [
|
|
1730
|
+
"H",
|
|
1731
|
+
"h"
|
|
1732
|
+
],
|
|
1733
|
+
"MW": [
|
|
1734
|
+
"h",
|
|
1735
|
+
"hb",
|
|
1736
|
+
"H",
|
|
1737
|
+
"hB"
|
|
1738
|
+
],
|
|
1739
|
+
"MX": [
|
|
1740
|
+
"h",
|
|
1741
|
+
"H",
|
|
1742
|
+
"hB",
|
|
1743
|
+
"hb"
|
|
1744
|
+
],
|
|
1745
|
+
"MY": [
|
|
1746
|
+
"hb",
|
|
1747
|
+
"hB",
|
|
1748
|
+
"h",
|
|
1749
|
+
"H"
|
|
1750
|
+
],
|
|
1751
|
+
"MZ": [
|
|
1752
|
+
"H",
|
|
1753
|
+
"hB"
|
|
1754
|
+
],
|
|
1755
|
+
"NA": [
|
|
1756
|
+
"h",
|
|
1757
|
+
"H",
|
|
1758
|
+
"hB",
|
|
1759
|
+
"hb"
|
|
1760
|
+
],
|
|
1761
|
+
"NC": [
|
|
1762
|
+
"H",
|
|
1763
|
+
"hB"
|
|
1764
|
+
],
|
|
1765
|
+
"NE": [
|
|
1766
|
+
"H"
|
|
1767
|
+
],
|
|
1768
|
+
"NF": [
|
|
1769
|
+
"H",
|
|
1770
|
+
"h",
|
|
1771
|
+
"hb",
|
|
1772
|
+
"hB"
|
|
1773
|
+
],
|
|
1774
|
+
"NG": [
|
|
1775
|
+
"H",
|
|
1776
|
+
"h",
|
|
1777
|
+
"hb",
|
|
1778
|
+
"hB"
|
|
1779
|
+
],
|
|
1780
|
+
"NI": [
|
|
1781
|
+
"h",
|
|
1782
|
+
"H",
|
|
1783
|
+
"hB",
|
|
1784
|
+
"hb"
|
|
1785
|
+
],
|
|
1786
|
+
"NL": [
|
|
1787
|
+
"H",
|
|
1788
|
+
"hB"
|
|
1789
|
+
],
|
|
1790
|
+
"NO": [
|
|
1791
|
+
"H",
|
|
1792
|
+
"h"
|
|
1793
|
+
],
|
|
1794
|
+
"NP": [
|
|
1795
|
+
"H",
|
|
1796
|
+
"h",
|
|
1797
|
+
"hB"
|
|
1798
|
+
],
|
|
1799
|
+
"NR": [
|
|
1800
|
+
"H",
|
|
1801
|
+
"h",
|
|
1802
|
+
"hb",
|
|
1803
|
+
"hB"
|
|
1804
|
+
],
|
|
1805
|
+
"NU": [
|
|
1806
|
+
"H",
|
|
1807
|
+
"h",
|
|
1808
|
+
"hb",
|
|
1809
|
+
"hB"
|
|
1810
|
+
],
|
|
1811
|
+
"NZ": [
|
|
1812
|
+
"h",
|
|
1813
|
+
"hb",
|
|
1814
|
+
"H",
|
|
1815
|
+
"hB"
|
|
1816
|
+
],
|
|
1817
|
+
"OM": [
|
|
1818
|
+
"h",
|
|
1819
|
+
"hB",
|
|
1820
|
+
"hb",
|
|
1821
|
+
"H"
|
|
1822
|
+
],
|
|
1823
|
+
"PA": [
|
|
1824
|
+
"h",
|
|
1825
|
+
"H",
|
|
1826
|
+
"hB",
|
|
1827
|
+
"hb"
|
|
1828
|
+
],
|
|
1829
|
+
"PE": [
|
|
1830
|
+
"h",
|
|
1831
|
+
"H",
|
|
1832
|
+
"hB",
|
|
1833
|
+
"hb"
|
|
1834
|
+
],
|
|
1835
|
+
"PF": [
|
|
1836
|
+
"H",
|
|
1837
|
+
"h",
|
|
1838
|
+
"hB"
|
|
1839
|
+
],
|
|
1840
|
+
"PG": [
|
|
1841
|
+
"h",
|
|
1842
|
+
"H"
|
|
1843
|
+
],
|
|
1844
|
+
"PH": [
|
|
1845
|
+
"h",
|
|
1846
|
+
"hB",
|
|
1847
|
+
"hb",
|
|
1848
|
+
"H"
|
|
1849
|
+
],
|
|
1850
|
+
"PK": [
|
|
1851
|
+
"h",
|
|
1852
|
+
"hB",
|
|
1853
|
+
"H"
|
|
1854
|
+
],
|
|
1855
|
+
"PL": [
|
|
1856
|
+
"H",
|
|
1857
|
+
"h"
|
|
1858
|
+
],
|
|
1859
|
+
"PM": [
|
|
1860
|
+
"H",
|
|
1861
|
+
"hB"
|
|
1862
|
+
],
|
|
1863
|
+
"PN": [
|
|
1864
|
+
"H",
|
|
1865
|
+
"h",
|
|
1866
|
+
"hb",
|
|
1867
|
+
"hB"
|
|
1868
|
+
],
|
|
1869
|
+
"PR": [
|
|
1870
|
+
"h",
|
|
1871
|
+
"H",
|
|
1872
|
+
"hB",
|
|
1873
|
+
"hb"
|
|
1874
|
+
],
|
|
1875
|
+
"PS": [
|
|
1876
|
+
"h",
|
|
1877
|
+
"hB",
|
|
1878
|
+
"hb",
|
|
1879
|
+
"H"
|
|
1880
|
+
],
|
|
1881
|
+
"PT": [
|
|
1882
|
+
"H",
|
|
1883
|
+
"hB"
|
|
1884
|
+
],
|
|
1885
|
+
"PW": [
|
|
1886
|
+
"h",
|
|
1887
|
+
"H"
|
|
1888
|
+
],
|
|
1889
|
+
"PY": [
|
|
1890
|
+
"h",
|
|
1891
|
+
"H",
|
|
1892
|
+
"hB",
|
|
1893
|
+
"hb"
|
|
1894
|
+
],
|
|
1895
|
+
"QA": [
|
|
1896
|
+
"h",
|
|
1897
|
+
"hB",
|
|
1898
|
+
"hb",
|
|
1899
|
+
"H"
|
|
1900
|
+
],
|
|
1901
|
+
"RE": [
|
|
1902
|
+
"H",
|
|
1903
|
+
"hB"
|
|
1904
|
+
],
|
|
1905
|
+
"RO": [
|
|
1906
|
+
"H",
|
|
1907
|
+
"hB"
|
|
1908
|
+
],
|
|
1909
|
+
"RS": [
|
|
1910
|
+
"H",
|
|
1911
|
+
"hB",
|
|
1912
|
+
"h"
|
|
1913
|
+
],
|
|
1914
|
+
"RU": [
|
|
1915
|
+
"H"
|
|
1916
|
+
],
|
|
1917
|
+
"RW": [
|
|
1918
|
+
"H",
|
|
1919
|
+
"h"
|
|
1920
|
+
],
|
|
1921
|
+
"SA": [
|
|
1922
|
+
"h",
|
|
1923
|
+
"hB",
|
|
1924
|
+
"hb",
|
|
1925
|
+
"H"
|
|
1926
|
+
],
|
|
1927
|
+
"SB": [
|
|
1928
|
+
"h",
|
|
1929
|
+
"hb",
|
|
1930
|
+
"H",
|
|
1931
|
+
"hB"
|
|
1932
|
+
],
|
|
1933
|
+
"SC": [
|
|
1934
|
+
"H",
|
|
1935
|
+
"h",
|
|
1936
|
+
"hB"
|
|
1937
|
+
],
|
|
1938
|
+
"SD": [
|
|
1939
|
+
"h",
|
|
1940
|
+
"hB",
|
|
1941
|
+
"hb",
|
|
1942
|
+
"H"
|
|
1943
|
+
],
|
|
1944
|
+
"SE": [
|
|
1945
|
+
"H"
|
|
1946
|
+
],
|
|
1947
|
+
"SG": [
|
|
1948
|
+
"h",
|
|
1949
|
+
"hb",
|
|
1950
|
+
"H",
|
|
1951
|
+
"hB"
|
|
1952
|
+
],
|
|
1953
|
+
"SH": [
|
|
1954
|
+
"H",
|
|
1955
|
+
"h",
|
|
1956
|
+
"hb",
|
|
1957
|
+
"hB"
|
|
1958
|
+
],
|
|
1959
|
+
"SI": [
|
|
1960
|
+
"H",
|
|
1961
|
+
"hB"
|
|
1962
|
+
],
|
|
1963
|
+
"SJ": [
|
|
1964
|
+
"H"
|
|
1965
|
+
],
|
|
1966
|
+
"SK": [
|
|
1967
|
+
"H"
|
|
1968
|
+
],
|
|
1969
|
+
"SL": [
|
|
1970
|
+
"h",
|
|
1971
|
+
"hb",
|
|
1972
|
+
"H",
|
|
1973
|
+
"hB"
|
|
1974
|
+
],
|
|
1975
|
+
"SM": [
|
|
1976
|
+
"H",
|
|
1977
|
+
"h",
|
|
1978
|
+
"hB"
|
|
1979
|
+
],
|
|
1980
|
+
"SN": [
|
|
1981
|
+
"H",
|
|
1982
|
+
"h",
|
|
1983
|
+
"hB"
|
|
1984
|
+
],
|
|
1985
|
+
"SO": [
|
|
1986
|
+
"h",
|
|
1987
|
+
"H"
|
|
1988
|
+
],
|
|
1989
|
+
"SR": [
|
|
1990
|
+
"H",
|
|
1991
|
+
"hB"
|
|
1992
|
+
],
|
|
1993
|
+
"SS": [
|
|
1994
|
+
"h",
|
|
1995
|
+
"hb",
|
|
1996
|
+
"H",
|
|
1997
|
+
"hB"
|
|
1998
|
+
],
|
|
1999
|
+
"ST": [
|
|
2000
|
+
"H",
|
|
2001
|
+
"hB"
|
|
2002
|
+
],
|
|
2003
|
+
"SV": [
|
|
2004
|
+
"h",
|
|
2005
|
+
"H",
|
|
2006
|
+
"hB",
|
|
2007
|
+
"hb"
|
|
2008
|
+
],
|
|
2009
|
+
"SX": [
|
|
2010
|
+
"H",
|
|
2011
|
+
"h",
|
|
2012
|
+
"hb",
|
|
2013
|
+
"hB"
|
|
2014
|
+
],
|
|
2015
|
+
"SY": [
|
|
2016
|
+
"h",
|
|
2017
|
+
"hB",
|
|
2018
|
+
"hb",
|
|
2019
|
+
"H"
|
|
2020
|
+
],
|
|
2021
|
+
"SZ": [
|
|
2022
|
+
"h",
|
|
2023
|
+
"hb",
|
|
2024
|
+
"H",
|
|
2025
|
+
"hB"
|
|
2026
|
+
],
|
|
2027
|
+
"TA": [
|
|
2028
|
+
"H",
|
|
2029
|
+
"h",
|
|
2030
|
+
"hb",
|
|
2031
|
+
"hB"
|
|
2032
|
+
],
|
|
2033
|
+
"TC": [
|
|
2034
|
+
"h",
|
|
2035
|
+
"hb",
|
|
2036
|
+
"H",
|
|
2037
|
+
"hB"
|
|
2038
|
+
],
|
|
2039
|
+
"TD": [
|
|
2040
|
+
"h",
|
|
2041
|
+
"H",
|
|
2042
|
+
"hB"
|
|
2043
|
+
],
|
|
2044
|
+
"TF": [
|
|
2045
|
+
"H",
|
|
2046
|
+
"h",
|
|
2047
|
+
"hB"
|
|
2048
|
+
],
|
|
2049
|
+
"TG": [
|
|
2050
|
+
"H",
|
|
2051
|
+
"hB"
|
|
2052
|
+
],
|
|
2053
|
+
"TH": [
|
|
2054
|
+
"H",
|
|
2055
|
+
"h"
|
|
2056
|
+
],
|
|
2057
|
+
"TJ": [
|
|
2058
|
+
"H",
|
|
2059
|
+
"h"
|
|
2060
|
+
],
|
|
2061
|
+
"TL": [
|
|
2062
|
+
"H",
|
|
2063
|
+
"hB",
|
|
2064
|
+
"hb",
|
|
2065
|
+
"h"
|
|
2066
|
+
],
|
|
2067
|
+
"TM": [
|
|
2068
|
+
"H",
|
|
2069
|
+
"h"
|
|
2070
|
+
],
|
|
2071
|
+
"TN": [
|
|
2072
|
+
"h",
|
|
2073
|
+
"hB",
|
|
2074
|
+
"hb",
|
|
2075
|
+
"H"
|
|
2076
|
+
],
|
|
2077
|
+
"TO": [
|
|
2078
|
+
"h",
|
|
2079
|
+
"H"
|
|
2080
|
+
],
|
|
2081
|
+
"TR": [
|
|
2082
|
+
"H",
|
|
2083
|
+
"hB"
|
|
2084
|
+
],
|
|
2085
|
+
"TT": [
|
|
2086
|
+
"h",
|
|
2087
|
+
"hb",
|
|
2088
|
+
"H",
|
|
2089
|
+
"hB"
|
|
2090
|
+
],
|
|
2091
|
+
"TW": [
|
|
2092
|
+
"hB",
|
|
2093
|
+
"hb",
|
|
2094
|
+
"h",
|
|
2095
|
+
"H"
|
|
2096
|
+
],
|
|
2097
|
+
"TZ": [
|
|
2098
|
+
"hB",
|
|
2099
|
+
"hb",
|
|
2100
|
+
"H",
|
|
2101
|
+
"h"
|
|
2102
|
+
],
|
|
2103
|
+
"UA": [
|
|
2104
|
+
"H",
|
|
2105
|
+
"hB",
|
|
2106
|
+
"h"
|
|
2107
|
+
],
|
|
2108
|
+
"UG": [
|
|
2109
|
+
"hB",
|
|
2110
|
+
"hb",
|
|
2111
|
+
"H",
|
|
2112
|
+
"h"
|
|
2113
|
+
],
|
|
2114
|
+
"UM": [
|
|
2115
|
+
"h",
|
|
2116
|
+
"hb",
|
|
2117
|
+
"H",
|
|
2118
|
+
"hB"
|
|
2119
|
+
],
|
|
2120
|
+
"US": [
|
|
2121
|
+
"h",
|
|
2122
|
+
"hb",
|
|
2123
|
+
"H",
|
|
2124
|
+
"hB"
|
|
2125
|
+
],
|
|
2126
|
+
"UY": [
|
|
2127
|
+
"h",
|
|
2128
|
+
"H",
|
|
2129
|
+
"hB",
|
|
2130
|
+
"hb"
|
|
2131
|
+
],
|
|
2132
|
+
"UZ": [
|
|
2133
|
+
"H",
|
|
2134
|
+
"hB",
|
|
2135
|
+
"h"
|
|
2136
|
+
],
|
|
2137
|
+
"VA": [
|
|
2138
|
+
"H",
|
|
2139
|
+
"h",
|
|
2140
|
+
"hB"
|
|
2141
|
+
],
|
|
2142
|
+
"VC": [
|
|
2143
|
+
"h",
|
|
2144
|
+
"hb",
|
|
2145
|
+
"H",
|
|
2146
|
+
"hB"
|
|
2147
|
+
],
|
|
2148
|
+
"VE": [
|
|
2149
|
+
"h",
|
|
2150
|
+
"H",
|
|
2151
|
+
"hB",
|
|
2152
|
+
"hb"
|
|
2153
|
+
],
|
|
2154
|
+
"VG": [
|
|
2155
|
+
"h",
|
|
2156
|
+
"hb",
|
|
2157
|
+
"H",
|
|
2158
|
+
"hB"
|
|
2159
|
+
],
|
|
2160
|
+
"VI": [
|
|
2161
|
+
"h",
|
|
2162
|
+
"hb",
|
|
2163
|
+
"H",
|
|
2164
|
+
"hB"
|
|
2165
|
+
],
|
|
2166
|
+
"VN": [
|
|
2167
|
+
"H",
|
|
2168
|
+
"h"
|
|
2169
|
+
],
|
|
2170
|
+
"VU": [
|
|
2171
|
+
"h",
|
|
2172
|
+
"H"
|
|
2173
|
+
],
|
|
2174
|
+
"WF": [
|
|
2175
|
+
"H",
|
|
2176
|
+
"hB"
|
|
2177
|
+
],
|
|
2178
|
+
"WS": [
|
|
2179
|
+
"h",
|
|
2180
|
+
"H"
|
|
2181
|
+
],
|
|
2182
|
+
"XK": [
|
|
2183
|
+
"H",
|
|
2184
|
+
"hB",
|
|
2185
|
+
"h"
|
|
2186
|
+
],
|
|
2187
|
+
"YE": [
|
|
2188
|
+
"h",
|
|
2189
|
+
"hB",
|
|
2190
|
+
"hb",
|
|
2191
|
+
"H"
|
|
2192
|
+
],
|
|
2193
|
+
"YT": [
|
|
2194
|
+
"H",
|
|
2195
|
+
"hB"
|
|
2196
|
+
],
|
|
2197
|
+
"ZA": [
|
|
2198
|
+
"H",
|
|
2199
|
+
"h",
|
|
2200
|
+
"hb",
|
|
2201
|
+
"hB"
|
|
2202
|
+
],
|
|
2203
|
+
"ZM": [
|
|
2204
|
+
"h",
|
|
2205
|
+
"hb",
|
|
2206
|
+
"H",
|
|
2207
|
+
"hB"
|
|
2208
|
+
],
|
|
2209
|
+
"ZW": [
|
|
2210
|
+
"H",
|
|
2211
|
+
"h"
|
|
2212
|
+
],
|
|
2213
|
+
"af-ZA": [
|
|
2214
|
+
"H",
|
|
2215
|
+
"h",
|
|
2216
|
+
"hB",
|
|
2217
|
+
"hb"
|
|
2218
|
+
],
|
|
2219
|
+
"ar-001": [
|
|
2220
|
+
"h",
|
|
2221
|
+
"hB",
|
|
2222
|
+
"hb",
|
|
2223
|
+
"H"
|
|
2224
|
+
],
|
|
2225
|
+
"ca-ES": [
|
|
2226
|
+
"H",
|
|
2227
|
+
"h",
|
|
2228
|
+
"hB"
|
|
2229
|
+
],
|
|
2230
|
+
"en-001": [
|
|
2231
|
+
"h",
|
|
2232
|
+
"hb",
|
|
2233
|
+
"H",
|
|
2234
|
+
"hB"
|
|
2235
|
+
],
|
|
2236
|
+
"en-HK": [
|
|
2237
|
+
"h",
|
|
2238
|
+
"hb",
|
|
2239
|
+
"H",
|
|
2240
|
+
"hB"
|
|
2241
|
+
],
|
|
2242
|
+
"en-IL": [
|
|
2243
|
+
"H",
|
|
2244
|
+
"h",
|
|
2245
|
+
"hb",
|
|
2246
|
+
"hB"
|
|
2247
|
+
],
|
|
2248
|
+
"en-MY": [
|
|
2249
|
+
"h",
|
|
2250
|
+
"hb",
|
|
2251
|
+
"H",
|
|
2252
|
+
"hB"
|
|
2253
|
+
],
|
|
2254
|
+
"es-BR": [
|
|
2255
|
+
"H",
|
|
2256
|
+
"h",
|
|
2257
|
+
"hB",
|
|
2258
|
+
"hb"
|
|
2259
|
+
],
|
|
2260
|
+
"es-ES": [
|
|
2261
|
+
"H",
|
|
2262
|
+
"h",
|
|
2263
|
+
"hB",
|
|
2264
|
+
"hb"
|
|
2265
|
+
],
|
|
2266
|
+
"es-GQ": [
|
|
2267
|
+
"H",
|
|
2268
|
+
"h",
|
|
2269
|
+
"hB",
|
|
2270
|
+
"hb"
|
|
2271
|
+
],
|
|
2272
|
+
"fr-CA": [
|
|
2273
|
+
"H",
|
|
2274
|
+
"h",
|
|
2275
|
+
"hB"
|
|
2276
|
+
],
|
|
2277
|
+
"gl-ES": [
|
|
2278
|
+
"H",
|
|
2279
|
+
"h",
|
|
2280
|
+
"hB"
|
|
2281
|
+
],
|
|
2282
|
+
"gu-IN": [
|
|
2283
|
+
"hB",
|
|
2284
|
+
"hb",
|
|
2285
|
+
"h",
|
|
2286
|
+
"H"
|
|
2287
|
+
],
|
|
2288
|
+
"hi-IN": [
|
|
2289
|
+
"hB",
|
|
2290
|
+
"h",
|
|
2291
|
+
"H"
|
|
2292
|
+
],
|
|
2293
|
+
"it-CH": [
|
|
2294
|
+
"H",
|
|
2295
|
+
"h",
|
|
2296
|
+
"hB"
|
|
2297
|
+
],
|
|
2298
|
+
"it-IT": [
|
|
2299
|
+
"H",
|
|
2300
|
+
"h",
|
|
2301
|
+
"hB"
|
|
2302
|
+
],
|
|
2303
|
+
"kn-IN": [
|
|
2304
|
+
"hB",
|
|
2305
|
+
"h",
|
|
2306
|
+
"H"
|
|
2307
|
+
],
|
|
2308
|
+
"ku-SY": [
|
|
2309
|
+
"H",
|
|
2310
|
+
"hB"
|
|
2311
|
+
],
|
|
2312
|
+
"ml-IN": [
|
|
2313
|
+
"hB",
|
|
2314
|
+
"h",
|
|
2315
|
+
"H"
|
|
2316
|
+
],
|
|
2317
|
+
"mr-IN": [
|
|
2318
|
+
"hB",
|
|
2319
|
+
"hb",
|
|
2320
|
+
"h",
|
|
2321
|
+
"H"
|
|
2322
|
+
],
|
|
2323
|
+
"pa-IN": [
|
|
2324
|
+
"hB",
|
|
2325
|
+
"hb",
|
|
2326
|
+
"h",
|
|
2327
|
+
"H"
|
|
2328
|
+
],
|
|
2329
|
+
"ta-IN": [
|
|
2330
|
+
"hB",
|
|
2331
|
+
"h",
|
|
2332
|
+
"hb",
|
|
2333
|
+
"H"
|
|
2334
|
+
],
|
|
2335
|
+
"te-IN": [
|
|
2336
|
+
"hB",
|
|
2337
|
+
"h",
|
|
2338
|
+
"H"
|
|
2339
|
+
],
|
|
2340
|
+
"zu-ZA": [
|
|
2341
|
+
"H",
|
|
2342
|
+
"hB",
|
|
2343
|
+
"hb",
|
|
2344
|
+
"h"
|
|
2345
|
+
]
|
|
2346
|
+
};
|
|
2347
|
+
/**
|
|
2348
|
+
* Returns the best matching date time pattern if a date time skeleton
|
|
2349
|
+
* pattern is provided with a locale. Follows the Unicode specification:
|
|
2350
|
+
* https://www.unicode.org/reports/tr35/tr35-dates.html#table-mapping-requested-time-skeletons-to-patterns
|
|
2351
|
+
* @param skeleton date time skeleton pattern that possibly includes j, J or C
|
|
2352
|
+
* @param locale
|
|
2353
|
+
*/ function getBestPattern(skeleton, locale) {
|
|
2354
|
+
var skeletonCopy = "";
|
|
2355
|
+
for(var patternPos = 0; patternPos < skeleton.length; patternPos++){
|
|
2356
|
+
var patternChar = skeleton.charAt(patternPos);
|
|
2357
|
+
if (patternChar === "j") {
|
|
2358
|
+
var extraLength = 0;
|
|
2359
|
+
while(patternPos + 1 < skeleton.length && skeleton.charAt(patternPos + 1) === patternChar){
|
|
2360
|
+
extraLength++;
|
|
2361
|
+
patternPos++;
|
|
2362
|
+
}
|
|
2363
|
+
var hourLen = 1 + (extraLength & 1);
|
|
2364
|
+
var dayPeriodLen = extraLength < 2 ? 1 : 3 + (extraLength >> 1);
|
|
2365
|
+
var dayPeriodChar = "a";
|
|
2366
|
+
var hourChar = getDefaultHourSymbolFromLocale(locale);
|
|
2367
|
+
if (hourChar == "H" || hourChar == "k") dayPeriodLen = 0;
|
|
2368
|
+
while(dayPeriodLen-- > 0)skeletonCopy += dayPeriodChar;
|
|
2369
|
+
while(hourLen-- > 0)skeletonCopy = hourChar + skeletonCopy;
|
|
2370
|
+
} else if (patternChar === "J") skeletonCopy += "H";
|
|
2371
|
+
else skeletonCopy += patternChar;
|
|
2372
|
+
}
|
|
2373
|
+
return skeletonCopy;
|
|
2374
|
+
}
|
|
2375
|
+
/**
|
|
2376
|
+
* Maps the [hour cycle type](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/hourCycle)
|
|
2377
|
+
* of the given `locale` to the corresponding time pattern.
|
|
2378
|
+
* @param locale
|
|
2379
|
+
*/ function getDefaultHourSymbolFromLocale(locale) {
|
|
2380
|
+
var hourCycle = locale.hourCycle;
|
|
2381
|
+
if (hourCycle === void 0 && locale.hourCycles && locale.hourCycles.length) hourCycle = locale.hourCycles[0];
|
|
2382
|
+
if (hourCycle) switch(hourCycle){
|
|
2383
|
+
case "h24":
|
|
2384
|
+
return "k";
|
|
2385
|
+
case "h23":
|
|
2386
|
+
return "H";
|
|
2387
|
+
case "h12":
|
|
2388
|
+
return "h";
|
|
2389
|
+
case "h11":
|
|
2390
|
+
return "K";
|
|
2391
|
+
default:
|
|
2392
|
+
throw new Error("Invalid hourCycle");
|
|
2393
|
+
}
|
|
2394
|
+
var languageTag = locale.language;
|
|
2395
|
+
var regionTag;
|
|
2396
|
+
if (languageTag !== "root") regionTag = locale.maximize().region;
|
|
2397
|
+
return (timeData[regionTag || ""] || timeData[languageTag || ""] || timeData["".concat(languageTag, "-001")] || timeData["001"])[0];
|
|
2398
|
+
}
|
|
2399
|
+
var SPACE_SEPARATOR_START_REGEX = new RegExp("^".concat(SPACE_SEPARATOR_REGEX.source, "*"));
|
|
2400
|
+
var SPACE_SEPARATOR_END_REGEX = new RegExp("".concat(SPACE_SEPARATOR_REGEX.source, "*$"));
|
|
2401
|
+
function createLocation(start, end) {
|
|
2402
|
+
return {
|
|
2403
|
+
start: start,
|
|
2404
|
+
end: end
|
|
2405
|
+
};
|
|
2406
|
+
}
|
|
2407
|
+
var hasNativeFromEntries = !!Object.fromEntries;
|
|
2408
|
+
var hasTrimStart = !!String.prototype.trimStart;
|
|
2409
|
+
var hasTrimEnd = !!String.prototype.trimEnd;
|
|
2410
|
+
var fromEntries = hasNativeFromEntries ? Object.fromEntries : function fromEntries(entries) {
|
|
2411
|
+
var obj = {};
|
|
2412
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2413
|
+
try {
|
|
2414
|
+
for(var _iterator = entries[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2415
|
+
var _value = _slicedToArray(_step.value, 2), k = _value[0], v = _value[1];
|
|
2416
|
+
obj[k] = v;
|
|
2417
|
+
}
|
|
2418
|
+
} catch (err) {
|
|
2419
|
+
_didIteratorError = true;
|
|
2420
|
+
_iteratorError = err;
|
|
2421
|
+
} finally{
|
|
2422
|
+
try {
|
|
2423
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2424
|
+
_iterator.return();
|
|
2425
|
+
}
|
|
2426
|
+
} finally{
|
|
2427
|
+
if (_didIteratorError) {
|
|
2428
|
+
throw _iteratorError;
|
|
2429
|
+
}
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2432
|
+
return obj;
|
|
2433
|
+
};
|
|
2434
|
+
var trimStart = hasTrimStart ? function trimStart(s) {
|
|
2435
|
+
return s.trimStart();
|
|
2436
|
+
} : function trimStart(s) {
|
|
2437
|
+
return s.replace(SPACE_SEPARATOR_START_REGEX, "");
|
|
2438
|
+
};
|
|
2439
|
+
var trimEnd = hasTrimEnd ? function trimEnd(s) {
|
|
2440
|
+
return s.trimEnd();
|
|
2441
|
+
} : function trimEnd(s) {
|
|
2442
|
+
return s.replace(SPACE_SEPARATOR_END_REGEX, "");
|
|
2443
|
+
};
|
|
2444
|
+
var IDENTIFIER_PREFIX_RE = /* @__PURE__ */ new RegExp("([^\\p{White_Space}\\p{Pattern_Syntax}]*)", "yu");
|
|
2445
|
+
function matchIdentifierAtIndex(s, index) {
|
|
2446
|
+
IDENTIFIER_PREFIX_RE.lastIndex = index;
|
|
2447
|
+
var ref;
|
|
2448
|
+
return (ref = IDENTIFIER_PREFIX_RE.exec(s)[1]) !== null && ref !== void 0 ? ref : "";
|
|
2449
|
+
}
|
|
2450
|
+
function plainTopLevelEndPosition(message) {
|
|
2451
|
+
if (message.length === 0) return null;
|
|
2452
|
+
var line = 1;
|
|
2453
|
+
var column = 1;
|
|
2454
|
+
for(var offset = 0; offset < message.length;){
|
|
2455
|
+
var code = message.charCodeAt(offset);
|
|
2456
|
+
switch(code){
|
|
2457
|
+
case 35:
|
|
2458
|
+
case 39:
|
|
2459
|
+
case 60:
|
|
2460
|
+
case 123:
|
|
2461
|
+
case 125:
|
|
2462
|
+
return null;
|
|
2463
|
+
}
|
|
2464
|
+
if (code === 10) {
|
|
2465
|
+
line++;
|
|
2466
|
+
column = 1;
|
|
2467
|
+
offset++;
|
|
2468
|
+
} else {
|
|
2469
|
+
column++;
|
|
2470
|
+
if (code >= 55296 && code <= 56319 && offset + 1 < message.length) {
|
|
2471
|
+
var next = message.charCodeAt(offset + 1);
|
|
2472
|
+
offset += next >= 56320 && next <= 57343 ? 2 : 1;
|
|
2473
|
+
} else offset++;
|
|
2474
|
+
}
|
|
2475
|
+
}
|
|
2476
|
+
return {
|
|
2477
|
+
offset: message.length,
|
|
2478
|
+
line: line,
|
|
2479
|
+
column: column
|
|
2480
|
+
};
|
|
2481
|
+
}
|
|
2482
|
+
var Parser = /*#__PURE__*/ function() {
|
|
2483
|
+
"use strict";
|
|
2484
|
+
function Parser(message) {
|
|
2485
|
+
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
2486
|
+
_classCallCheck(this, Parser);
|
|
2487
|
+
this.message = message;
|
|
2488
|
+
this.position = {
|
|
2489
|
+
offset: 0,
|
|
2490
|
+
line: 1,
|
|
2491
|
+
column: 1
|
|
2492
|
+
};
|
|
2493
|
+
this.ignoreTag = !!options.ignoreTag;
|
|
2494
|
+
this.locale = options.locale;
|
|
2495
|
+
this.requiresOtherClause = !!options.requiresOtherClause;
|
|
2496
|
+
this.shouldParseSkeletons = !!options.shouldParseSkeletons;
|
|
2497
|
+
}
|
|
2498
|
+
_createClass(Parser, [
|
|
2499
|
+
{
|
|
2500
|
+
key: "parse",
|
|
2501
|
+
value: function parse() {
|
|
2502
|
+
if (this.offset() !== 0) throw Error("parser can only be used once");
|
|
2503
|
+
if (this.message.length > 0) {
|
|
2504
|
+
var firstCode = this.message.charCodeAt(0);
|
|
2505
|
+
if (firstCode !== 35 && firstCode !== 39 && firstCode !== 60 && firstCode !== 123 && firstCode !== 125) {
|
|
2506
|
+
var plainEndPosition = plainTopLevelEndPosition(this.message);
|
|
2507
|
+
if (plainEndPosition) {
|
|
2508
|
+
var start = this.clonePosition();
|
|
2509
|
+
this.position = plainEndPosition;
|
|
2510
|
+
return {
|
|
2511
|
+
val: [
|
|
2512
|
+
{
|
|
2513
|
+
type: 0,
|
|
2514
|
+
value: this.message,
|
|
2515
|
+
location: createLocation(start, this.clonePosition())
|
|
2516
|
+
}
|
|
2517
|
+
],
|
|
2518
|
+
err: null
|
|
2519
|
+
};
|
|
2520
|
+
}
|
|
2521
|
+
}
|
|
2522
|
+
}
|
|
2523
|
+
return this.parseMessage(0, "", false);
|
|
2524
|
+
}
|
|
2525
|
+
},
|
|
2526
|
+
{
|
|
2527
|
+
key: "parseMessage",
|
|
2528
|
+
value: function parseMessage(nestingLevel, parentArgType, expectingCloseTag) {
|
|
2529
|
+
var elements = [];
|
|
2530
|
+
while(!this.isEOF()){
|
|
2531
|
+
var char = this.char();
|
|
2532
|
+
if (char === 123) {
|
|
2533
|
+
var result = this.parseArgument(nestingLevel, expectingCloseTag);
|
|
2534
|
+
if (result.err) return result;
|
|
2535
|
+
elements.push(result.val);
|
|
2536
|
+
} else if (char === 125 && nestingLevel > 0) break;
|
|
2537
|
+
else if (char === 35 && (parentArgType === "plural" || parentArgType === "selectordinal")) {
|
|
2538
|
+
var position = this.clonePosition();
|
|
2539
|
+
this.bump();
|
|
2540
|
+
elements.push({
|
|
2541
|
+
type: 7,
|
|
2542
|
+
location: createLocation(position, this.clonePosition())
|
|
2543
|
+
});
|
|
2544
|
+
} else if (char === 60 && !this.ignoreTag && this.peek() === 47) if (expectingCloseTag) break;
|
|
2545
|
+
else return this.error(26, createLocation(this.clonePosition(), this.clonePosition()));
|
|
2546
|
+
else if (char === 60 && !this.ignoreTag && _isAlpha(this.peek() || 0)) {
|
|
2547
|
+
var result1 = this.parseTag(nestingLevel, parentArgType);
|
|
2548
|
+
if (result1.err) return result1;
|
|
2549
|
+
elements.push(result1.val);
|
|
2550
|
+
} else {
|
|
2551
|
+
var result2 = this.parseLiteral(nestingLevel, parentArgType);
|
|
2552
|
+
if (result2.err) return result2;
|
|
2553
|
+
elements.push(result2.val);
|
|
2554
|
+
}
|
|
2555
|
+
}
|
|
2556
|
+
return {
|
|
2557
|
+
val: elements,
|
|
2558
|
+
err: null
|
|
2559
|
+
};
|
|
2560
|
+
}
|
|
2561
|
+
},
|
|
2562
|
+
{
|
|
2563
|
+
/**
|
|
2564
|
+
* A tag name must start with an ASCII lower/upper case letter. The grammar is based on the
|
|
2565
|
+
* [custom element name][] except that a dash is NOT always mandatory and uppercase letters
|
|
2566
|
+
* are accepted:
|
|
2567
|
+
*
|
|
2568
|
+
* ```
|
|
2569
|
+
* tag ::= "<" tagName (whitespace)* "/>" | "<" tagName (whitespace)* ">" message "</" tagName (whitespace)* ">"
|
|
2570
|
+
* tagName ::= [a-z] (PENChar)*
|
|
2571
|
+
* PENChar ::=
|
|
2572
|
+
* "-" | "." | [0-9] | "_" | [a-z] | [A-Z] | #xB7 | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x37D] |
|
|
2573
|
+
* [#x37F-#x1FFF] | [#x200C-#x200D] | [#x203F-#x2040] | [#x2070-#x218F] | [#x2C00-#x2FEF] |
|
|
2574
|
+
* [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
|
|
2575
|
+
* ```
|
|
2576
|
+
*
|
|
2577
|
+
* [custom element name]: https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
|
|
2578
|
+
* NOTE: We're a bit more lax here since HTML technically does not allow uppercase HTML element but we do
|
|
2579
|
+
* since other tag-based engines like React allow it
|
|
2580
|
+
*/ key: "parseTag",
|
|
2581
|
+
value: function parseTag(nestingLevel, parentArgType) {
|
|
2582
|
+
var startPosition = this.clonePosition();
|
|
2583
|
+
this.bump();
|
|
2584
|
+
var tagName = this.parseTagName();
|
|
2585
|
+
this.bumpSpace();
|
|
2586
|
+
if (this.bumpIf("/>")) return {
|
|
2587
|
+
val: {
|
|
2588
|
+
type: 0,
|
|
2589
|
+
value: "<".concat(tagName, "/>"),
|
|
2590
|
+
location: createLocation(startPosition, this.clonePosition())
|
|
2591
|
+
},
|
|
2592
|
+
err: null
|
|
2593
|
+
};
|
|
2594
|
+
else if (this.bumpIf(">")) {
|
|
2595
|
+
var childrenResult = this.parseMessage(nestingLevel + 1, parentArgType, true);
|
|
2596
|
+
if (childrenResult.err) return childrenResult;
|
|
2597
|
+
var children = childrenResult.val;
|
|
2598
|
+
var endTagStartPosition = this.clonePosition();
|
|
2599
|
+
if (this.bumpIf("</")) {
|
|
2600
|
+
if (this.isEOF() || !_isAlpha(this.char())) return this.error(23, createLocation(endTagStartPosition, this.clonePosition()));
|
|
2601
|
+
var closingTagNameStartPosition = this.clonePosition();
|
|
2602
|
+
if (tagName !== this.parseTagName()) return this.error(26, createLocation(closingTagNameStartPosition, this.clonePosition()));
|
|
2603
|
+
this.bumpSpace();
|
|
2604
|
+
if (!this.bumpIf(">")) return this.error(23, createLocation(endTagStartPosition, this.clonePosition()));
|
|
2605
|
+
return {
|
|
2606
|
+
val: {
|
|
2607
|
+
type: 8,
|
|
2608
|
+
value: tagName,
|
|
2609
|
+
children: children,
|
|
2610
|
+
location: createLocation(startPosition, this.clonePosition())
|
|
2611
|
+
},
|
|
2612
|
+
err: null
|
|
2613
|
+
};
|
|
2614
|
+
} else return this.error(27, createLocation(startPosition, this.clonePosition()));
|
|
2615
|
+
} else return this.error(23, createLocation(startPosition, this.clonePosition()));
|
|
2616
|
+
}
|
|
2617
|
+
},
|
|
2618
|
+
{
|
|
2619
|
+
/**
|
|
2620
|
+
* This method assumes that the caller has peeked ahead for the first tag character.
|
|
2621
|
+
*/ key: "parseTagName",
|
|
2622
|
+
value: function parseTagName() {
|
|
2623
|
+
var startOffset = this.offset();
|
|
2624
|
+
this.bump();
|
|
2625
|
+
while(!this.isEOF() && _isPotentialElementNameChar(this.char()))this.bump();
|
|
2626
|
+
return this.message.slice(startOffset, this.offset());
|
|
2627
|
+
}
|
|
2628
|
+
},
|
|
2629
|
+
{
|
|
2630
|
+
key: "parseLiteral",
|
|
2631
|
+
value: function parseLiteral(nestingLevel, parentArgType) {
|
|
2632
|
+
var start = this.clonePosition();
|
|
2633
|
+
var value = "";
|
|
2634
|
+
while(true){
|
|
2635
|
+
var parseQuoteResult = this.tryParseQuote(parentArgType);
|
|
2636
|
+
if (parseQuoteResult) {
|
|
2637
|
+
value += parseQuoteResult;
|
|
2638
|
+
continue;
|
|
2639
|
+
}
|
|
2640
|
+
var parseUnquotedResult = this.tryParseUnquoted(nestingLevel, parentArgType);
|
|
2641
|
+
if (parseUnquotedResult) {
|
|
2642
|
+
value += parseUnquotedResult;
|
|
2643
|
+
continue;
|
|
2644
|
+
}
|
|
2645
|
+
var parseLeftAngleResult = this.tryParseLeftAngleBracket();
|
|
2646
|
+
if (parseLeftAngleResult) {
|
|
2647
|
+
value += parseLeftAngleResult;
|
|
2648
|
+
continue;
|
|
2649
|
+
}
|
|
2650
|
+
break;
|
|
2651
|
+
}
|
|
2652
|
+
var location = createLocation(start, this.clonePosition());
|
|
2653
|
+
return {
|
|
2654
|
+
val: {
|
|
2655
|
+
type: 0,
|
|
2656
|
+
value: value,
|
|
2657
|
+
location: location
|
|
2658
|
+
},
|
|
2659
|
+
err: null
|
|
2660
|
+
};
|
|
2661
|
+
}
|
|
2662
|
+
},
|
|
2663
|
+
{
|
|
2664
|
+
key: "tryParseLeftAngleBracket",
|
|
2665
|
+
value: function tryParseLeftAngleBracket() {
|
|
2666
|
+
if (!this.isEOF() && this.char() === 60 && (this.ignoreTag || !_isAlphaOrSlash(this.peek() || 0))) {
|
|
2667
|
+
this.bump();
|
|
2668
|
+
return "<";
|
|
2669
|
+
}
|
|
2670
|
+
return null;
|
|
2671
|
+
}
|
|
2672
|
+
},
|
|
2673
|
+
{
|
|
2674
|
+
/**
|
|
2675
|
+
* Starting with ICU 4.8, an ASCII apostrophe only starts quoted text if it immediately precedes
|
|
2676
|
+
* a character that requires quoting (that is, "only where needed"), and works the same in
|
|
2677
|
+
* nested messages as on the top level of the pattern. The new behavior is otherwise compatible.
|
|
2678
|
+
*/ key: "tryParseQuote",
|
|
2679
|
+
value: function tryParseQuote(parentArgType) {
|
|
2680
|
+
var _String;
|
|
2681
|
+
if (this.isEOF() || this.char() !== 39) return null;
|
|
2682
|
+
switch(this.peek()){
|
|
2683
|
+
case 39:
|
|
2684
|
+
this.bump();
|
|
2685
|
+
this.bump();
|
|
2686
|
+
return "'";
|
|
2687
|
+
case 123:
|
|
2688
|
+
case 60:
|
|
2689
|
+
case 62:
|
|
2690
|
+
case 125:
|
|
2691
|
+
break;
|
|
2692
|
+
case 35:
|
|
2693
|
+
if (parentArgType === "plural" || parentArgType === "selectordinal") break;
|
|
2694
|
+
return null;
|
|
2695
|
+
default:
|
|
2696
|
+
return null;
|
|
2697
|
+
}
|
|
2698
|
+
this.bump();
|
|
2699
|
+
var codePoints = [
|
|
2700
|
+
this.char()
|
|
2701
|
+
];
|
|
2702
|
+
this.bump();
|
|
2703
|
+
while(!this.isEOF()){
|
|
2704
|
+
var ch = this.char();
|
|
2705
|
+
if (ch === 39) if (this.peek() === 39) {
|
|
2706
|
+
codePoints.push(39);
|
|
2707
|
+
this.bump();
|
|
2708
|
+
} else {
|
|
2709
|
+
this.bump();
|
|
2710
|
+
break;
|
|
2711
|
+
}
|
|
2712
|
+
else codePoints.push(ch);
|
|
2713
|
+
this.bump();
|
|
2714
|
+
}
|
|
2715
|
+
return (_String = String).fromCodePoint.apply(_String, _toConsumableArray(codePoints));
|
|
2716
|
+
}
|
|
2717
|
+
},
|
|
2718
|
+
{
|
|
2719
|
+
key: "tryParseUnquoted",
|
|
2720
|
+
value: function tryParseUnquoted(nestingLevel, parentArgType) {
|
|
2721
|
+
if (this.isEOF()) return null;
|
|
2722
|
+
var ch = this.char();
|
|
2723
|
+
if (ch === 60 || ch === 123 || ch === 35 && (parentArgType === "plural" || parentArgType === "selectordinal") || ch === 125 && nestingLevel > 0) return null;
|
|
2724
|
+
else {
|
|
2725
|
+
this.bump();
|
|
2726
|
+
return String.fromCodePoint(ch);
|
|
2727
|
+
}
|
|
2728
|
+
}
|
|
2729
|
+
},
|
|
2730
|
+
{
|
|
2731
|
+
key: "parseArgument",
|
|
2732
|
+
value: function parseArgument(nestingLevel, expectingCloseTag) {
|
|
2733
|
+
var openingBracePosition = this.clonePosition();
|
|
2734
|
+
this.bump();
|
|
2735
|
+
this.bumpSpace();
|
|
2736
|
+
if (this.isEOF()) return this.error(1, createLocation(openingBracePosition, this.clonePosition()));
|
|
2737
|
+
if (this.char() === 125) {
|
|
2738
|
+
this.bump();
|
|
2739
|
+
return this.error(2, createLocation(openingBracePosition, this.clonePosition()));
|
|
2740
|
+
}
|
|
2741
|
+
var value = this.parseIdentifierIfPossible().value;
|
|
2742
|
+
if (!value) return this.error(3, createLocation(openingBracePosition, this.clonePosition()));
|
|
2743
|
+
this.bumpSpace();
|
|
2744
|
+
if (this.isEOF()) return this.error(1, createLocation(openingBracePosition, this.clonePosition()));
|
|
2745
|
+
switch(this.char()){
|
|
2746
|
+
case 125:
|
|
2747
|
+
this.bump();
|
|
2748
|
+
return {
|
|
2749
|
+
val: {
|
|
2750
|
+
type: 1,
|
|
2751
|
+
value: value,
|
|
2752
|
+
location: createLocation(openingBracePosition, this.clonePosition())
|
|
2753
|
+
},
|
|
2754
|
+
err: null
|
|
2755
|
+
};
|
|
2756
|
+
case 44:
|
|
2757
|
+
this.bump();
|
|
2758
|
+
this.bumpSpace();
|
|
2759
|
+
if (this.isEOF()) return this.error(1, createLocation(openingBracePosition, this.clonePosition()));
|
|
2760
|
+
return this.parseArgumentOptions(nestingLevel, expectingCloseTag, value, openingBracePosition);
|
|
2761
|
+
default:
|
|
2762
|
+
return this.error(3, createLocation(openingBracePosition, this.clonePosition()));
|
|
2763
|
+
}
|
|
2764
|
+
}
|
|
2765
|
+
},
|
|
2766
|
+
{
|
|
2767
|
+
/**
|
|
2768
|
+
* Advance the parser until the end of the identifier, if it is currently on
|
|
2769
|
+
* an identifier character. Return an empty string otherwise.
|
|
2770
|
+
*/ key: "parseIdentifierIfPossible",
|
|
2771
|
+
value: function parseIdentifierIfPossible() {
|
|
2772
|
+
var startingPosition = this.clonePosition();
|
|
2773
|
+
var startOffset = this.offset();
|
|
2774
|
+
var value = matchIdentifierAtIndex(this.message, startOffset);
|
|
2775
|
+
var endOffset = startOffset + value.length;
|
|
2776
|
+
this.bumpTo(endOffset);
|
|
2777
|
+
return {
|
|
2778
|
+
value: value,
|
|
2779
|
+
location: createLocation(startingPosition, this.clonePosition())
|
|
2780
|
+
};
|
|
2781
|
+
}
|
|
2782
|
+
},
|
|
2783
|
+
{
|
|
2784
|
+
key: "parseArgumentOptions",
|
|
2785
|
+
value: function parseArgumentOptions(nestingLevel, expectingCloseTag, value, openingBracePosition) {
|
|
2786
|
+
var typeStartPosition = this.clonePosition();
|
|
2787
|
+
var argType = this.parseIdentifierIfPossible().value;
|
|
2788
|
+
var typeEndPosition = this.clonePosition();
|
|
2789
|
+
switch(argType){
|
|
2790
|
+
case "":
|
|
2791
|
+
return this.error(4, createLocation(typeStartPosition, typeEndPosition));
|
|
2792
|
+
case "number":
|
|
2793
|
+
case "date":
|
|
2794
|
+
case "time":
|
|
2795
|
+
{
|
|
2796
|
+
this.bumpSpace();
|
|
2797
|
+
var styleAndLocation = null;
|
|
2798
|
+
if (this.bumpIf(",")) {
|
|
2799
|
+
this.bumpSpace();
|
|
2800
|
+
var styleStartPosition = this.clonePosition();
|
|
2801
|
+
var result = this.parseSimpleArgStyleIfPossible();
|
|
2802
|
+
if (result.err) return result;
|
|
2803
|
+
var style = trimEnd(result.val);
|
|
2804
|
+
if (style.length === 0) return this.error(6, createLocation(this.clonePosition(), this.clonePosition()));
|
|
2805
|
+
styleAndLocation = {
|
|
2806
|
+
style: style,
|
|
2807
|
+
styleLocation: createLocation(styleStartPosition, this.clonePosition())
|
|
2808
|
+
};
|
|
2809
|
+
}
|
|
2810
|
+
var argCloseResult = this.tryParseArgumentClose(openingBracePosition);
|
|
2811
|
+
if (argCloseResult.err) return argCloseResult;
|
|
2812
|
+
var location = createLocation(openingBracePosition, this.clonePosition());
|
|
2813
|
+
if (styleAndLocation && styleAndLocation.style.startsWith("::")) {
|
|
2814
|
+
var skeleton = trimStart(styleAndLocation.style.slice(2));
|
|
2815
|
+
if (argType === "number") {
|
|
2816
|
+
var result1 = this.parseNumberSkeletonFromString(skeleton, styleAndLocation.styleLocation);
|
|
2817
|
+
if (result1.err) return result1;
|
|
2818
|
+
return {
|
|
2819
|
+
val: {
|
|
2820
|
+
type: 2,
|
|
2821
|
+
value: value,
|
|
2822
|
+
location: location,
|
|
2823
|
+
style: result1.val
|
|
2824
|
+
},
|
|
2825
|
+
err: null
|
|
2826
|
+
};
|
|
2827
|
+
} else {
|
|
2828
|
+
if (skeleton.length === 0) return this.error(10, location);
|
|
2829
|
+
var dateTimePattern = skeleton;
|
|
2830
|
+
if (this.locale) dateTimePattern = getBestPattern(skeleton, this.locale);
|
|
2831
|
+
var style1 = {
|
|
2832
|
+
type: 1,
|
|
2833
|
+
pattern: dateTimePattern,
|
|
2834
|
+
location: styleAndLocation.styleLocation,
|
|
2835
|
+
parsedOptions: this.shouldParseSkeletons ? parseDateTimeSkeleton(dateTimePattern) : {}
|
|
2836
|
+
};
|
|
2837
|
+
return {
|
|
2838
|
+
val: {
|
|
2839
|
+
type: argType === "date" ? 3 : 4,
|
|
2840
|
+
value: value,
|
|
2841
|
+
location: location,
|
|
2842
|
+
style: style1
|
|
2843
|
+
},
|
|
2844
|
+
err: null
|
|
2845
|
+
};
|
|
2846
|
+
}
|
|
2847
|
+
}
|
|
2848
|
+
var ref;
|
|
2849
|
+
return {
|
|
2850
|
+
val: {
|
|
2851
|
+
type: argType === "number" ? 2 : argType === "date" ? 3 : 4,
|
|
2852
|
+
value: value,
|
|
2853
|
+
location: location,
|
|
2854
|
+
style: (ref = styleAndLocation === null || styleAndLocation === void 0 ? void 0 : styleAndLocation.style) !== null && ref !== void 0 ? ref : null
|
|
2855
|
+
},
|
|
2856
|
+
err: null
|
|
2857
|
+
};
|
|
2858
|
+
}
|
|
2859
|
+
case "plural":
|
|
2860
|
+
case "selectordinal":
|
|
2861
|
+
case "select":
|
|
2862
|
+
{
|
|
2863
|
+
var typeEndPosition1 = this.clonePosition();
|
|
2864
|
+
this.bumpSpace();
|
|
2865
|
+
if (!this.bumpIf(",")) return this.error(12, createLocation(typeEndPosition1, _objectSpread({}, typeEndPosition1)));
|
|
2866
|
+
this.bumpSpace();
|
|
2867
|
+
var identifierAndLocation = this.parseIdentifierIfPossible();
|
|
2868
|
+
var pluralOffset = 0;
|
|
2869
|
+
if (argType !== "select" && identifierAndLocation.value === "offset") {
|
|
2870
|
+
if (!this.bumpIf(":")) return this.error(13, createLocation(this.clonePosition(), this.clonePosition()));
|
|
2871
|
+
this.bumpSpace();
|
|
2872
|
+
var result2 = this.tryParseDecimalInteger(13, 14);
|
|
2873
|
+
if (result2.err) return result2;
|
|
2874
|
+
this.bumpSpace();
|
|
2875
|
+
identifierAndLocation = this.parseIdentifierIfPossible();
|
|
2876
|
+
pluralOffset = result2.val;
|
|
2877
|
+
}
|
|
2878
|
+
var optionsResult = this.tryParsePluralOrSelectOptions(nestingLevel, argType, expectingCloseTag, identifierAndLocation);
|
|
2879
|
+
if (optionsResult.err) return optionsResult;
|
|
2880
|
+
var argCloseResult1 = this.tryParseArgumentClose(openingBracePosition);
|
|
2881
|
+
if (argCloseResult1.err) return argCloseResult1;
|
|
2882
|
+
var location1 = createLocation(openingBracePosition, this.clonePosition());
|
|
2883
|
+
if (argType === "select") return {
|
|
2884
|
+
val: {
|
|
2885
|
+
type: 5,
|
|
2886
|
+
value: value,
|
|
2887
|
+
options: fromEntries(optionsResult.val),
|
|
2888
|
+
location: location1
|
|
2889
|
+
},
|
|
2890
|
+
err: null
|
|
2891
|
+
};
|
|
2892
|
+
else return {
|
|
2893
|
+
val: {
|
|
2894
|
+
type: 6,
|
|
2895
|
+
value: value,
|
|
2896
|
+
options: fromEntries(optionsResult.val),
|
|
2897
|
+
offset: pluralOffset,
|
|
2898
|
+
pluralType: argType === "plural" ? "cardinal" : "ordinal",
|
|
2899
|
+
location: location1
|
|
2900
|
+
},
|
|
2901
|
+
err: null
|
|
2902
|
+
};
|
|
2903
|
+
}
|
|
2904
|
+
default:
|
|
2905
|
+
return this.error(5, createLocation(typeStartPosition, typeEndPosition));
|
|
2906
|
+
}
|
|
2907
|
+
}
|
|
2908
|
+
},
|
|
2909
|
+
{
|
|
2910
|
+
key: "tryParseArgumentClose",
|
|
2911
|
+
value: function tryParseArgumentClose(openingBracePosition) {
|
|
2912
|
+
if (this.isEOF() || this.char() !== 125) return this.error(1, createLocation(openingBracePosition, this.clonePosition()));
|
|
2913
|
+
this.bump();
|
|
2914
|
+
return {
|
|
2915
|
+
val: true,
|
|
2916
|
+
err: null
|
|
2917
|
+
};
|
|
2918
|
+
}
|
|
2919
|
+
},
|
|
2920
|
+
{
|
|
2921
|
+
/**
|
|
2922
|
+
* See: https://github.com/unicode-org/icu/blob/af7ed1f6d2298013dc303628438ec4abe1f16479/icu4c/source/common/messagepattern.cpp#L659
|
|
2923
|
+
*/ key: "parseSimpleArgStyleIfPossible",
|
|
2924
|
+
value: function parseSimpleArgStyleIfPossible() {
|
|
2925
|
+
var nestedBraces = 0;
|
|
2926
|
+
var startPosition = this.clonePosition();
|
|
2927
|
+
while(!this.isEOF())switch(this.char()){
|
|
2928
|
+
case 39:
|
|
2929
|
+
{
|
|
2930
|
+
this.bump();
|
|
2931
|
+
var apostrophePosition = this.clonePosition();
|
|
2932
|
+
if (!this.bumpUntil("'")) return this.error(11, createLocation(apostrophePosition, this.clonePosition()));
|
|
2933
|
+
this.bump();
|
|
2934
|
+
break;
|
|
2935
|
+
}
|
|
2936
|
+
case 123:
|
|
2937
|
+
nestedBraces += 1;
|
|
2938
|
+
this.bump();
|
|
2939
|
+
break;
|
|
2940
|
+
case 125:
|
|
2941
|
+
if (nestedBraces > 0) nestedBraces -= 1;
|
|
2942
|
+
else return {
|
|
2943
|
+
val: this.message.slice(startPosition.offset, this.offset()),
|
|
2944
|
+
err: null
|
|
2945
|
+
};
|
|
2946
|
+
break;
|
|
2947
|
+
default:
|
|
2948
|
+
this.bump();
|
|
2949
|
+
break;
|
|
2950
|
+
}
|
|
2951
|
+
return {
|
|
2952
|
+
val: this.message.slice(startPosition.offset, this.offset()),
|
|
2953
|
+
err: null
|
|
2954
|
+
};
|
|
2955
|
+
}
|
|
2956
|
+
},
|
|
2957
|
+
{
|
|
2958
|
+
key: "parseNumberSkeletonFromString",
|
|
2959
|
+
value: function parseNumberSkeletonFromString1(skeleton, location) {
|
|
2960
|
+
var tokens = [];
|
|
2961
|
+
try {
|
|
2962
|
+
tokens = parseNumberSkeletonFromString(skeleton);
|
|
2963
|
+
} catch (e) {
|
|
2964
|
+
return this.error(7, location);
|
|
2965
|
+
}
|
|
2966
|
+
return {
|
|
2967
|
+
val: {
|
|
2968
|
+
type: 0,
|
|
2969
|
+
tokens: tokens,
|
|
2970
|
+
location: location,
|
|
2971
|
+
parsedOptions: this.shouldParseSkeletons ? parseNumberSkeleton(tokens) : {}
|
|
2972
|
+
},
|
|
2973
|
+
err: null
|
|
2974
|
+
};
|
|
2975
|
+
}
|
|
2976
|
+
},
|
|
2977
|
+
{
|
|
2978
|
+
/**
|
|
2979
|
+
* @param nesting_level The current nesting level of messages.
|
|
2980
|
+
* This can be positive when parsing message fragment in select or plural argument options.
|
|
2981
|
+
* @param parent_arg_type The parent argument's type.
|
|
2982
|
+
* @param parsed_first_identifier If provided, this is the first identifier-like selector of
|
|
2983
|
+
* the argument. It is a by-product of a previous parsing attempt.
|
|
2984
|
+
* @param expecting_close_tag If true, this message is directly or indirectly nested inside
|
|
2985
|
+
* between a pair of opening and closing tags. The nested message will not parse beyond
|
|
2986
|
+
* the closing tag boundary.
|
|
2987
|
+
*/ key: "tryParsePluralOrSelectOptions",
|
|
2988
|
+
value: function tryParsePluralOrSelectOptions(nestingLevel, parentArgType, expectCloseTag, parsedFirstIdentifier) {
|
|
2989
|
+
var hasOtherClause = false;
|
|
2990
|
+
var options = [];
|
|
2991
|
+
var parsedSelectors = /* @__PURE__ */ new Set();
|
|
2992
|
+
var selector = parsedFirstIdentifier.value, selectorLocation = parsedFirstIdentifier.location;
|
|
2993
|
+
while(true){
|
|
2994
|
+
if (selector.length === 0) {
|
|
2995
|
+
var startPosition = this.clonePosition();
|
|
2996
|
+
if (parentArgType !== "select" && this.bumpIf("=")) {
|
|
2997
|
+
var result = this.tryParseDecimalInteger(16, 19);
|
|
2998
|
+
if (result.err) return result;
|
|
2999
|
+
selectorLocation = createLocation(startPosition, this.clonePosition());
|
|
3000
|
+
selector = this.message.slice(startPosition.offset, this.offset());
|
|
3001
|
+
} else break;
|
|
3002
|
+
}
|
|
3003
|
+
if (parsedSelectors.has(selector)) return this.error(parentArgType === "select" ? 21 : 20, selectorLocation);
|
|
3004
|
+
if (selector === "other") hasOtherClause = true;
|
|
3005
|
+
this.bumpSpace();
|
|
3006
|
+
var openingBracePosition = this.clonePosition();
|
|
3007
|
+
if (!this.bumpIf("{")) return this.error(parentArgType === "select" ? 17 : 18, createLocation(this.clonePosition(), this.clonePosition()));
|
|
3008
|
+
var fragmentResult = this.parseMessage(nestingLevel + 1, parentArgType, expectCloseTag);
|
|
3009
|
+
if (fragmentResult.err) return fragmentResult;
|
|
3010
|
+
var argCloseResult = this.tryParseArgumentClose(openingBracePosition);
|
|
3011
|
+
if (argCloseResult.err) return argCloseResult;
|
|
3012
|
+
options.push([
|
|
3013
|
+
selector,
|
|
3014
|
+
{
|
|
3015
|
+
value: fragmentResult.val,
|
|
3016
|
+
location: createLocation(openingBracePosition, this.clonePosition())
|
|
3017
|
+
}
|
|
3018
|
+
]);
|
|
3019
|
+
parsedSelectors.add(selector);
|
|
3020
|
+
this.bumpSpace();
|
|
3021
|
+
var ref;
|
|
3022
|
+
ref = this.parseIdentifierIfPossible(), selector = ref.value, selectorLocation = ref.location, ref;
|
|
3023
|
+
}
|
|
3024
|
+
if (options.length === 0) return this.error(parentArgType === "select" ? 15 : 16, createLocation(this.clonePosition(), this.clonePosition()));
|
|
3025
|
+
if (this.requiresOtherClause && !hasOtherClause) return this.error(22, createLocation(this.clonePosition(), this.clonePosition()));
|
|
3026
|
+
return {
|
|
3027
|
+
val: options,
|
|
3028
|
+
err: null
|
|
3029
|
+
};
|
|
3030
|
+
}
|
|
3031
|
+
},
|
|
3032
|
+
{
|
|
3033
|
+
key: "tryParseDecimalInteger",
|
|
3034
|
+
value: function tryParseDecimalInteger(expectNumberError, invalidNumberError) {
|
|
3035
|
+
var sign = 1;
|
|
3036
|
+
var startingPosition = this.clonePosition();
|
|
3037
|
+
if (this.bumpIf("+")) {} else if (this.bumpIf("-")) sign = -1;
|
|
3038
|
+
var hasDigits = false;
|
|
3039
|
+
var decimal = 0;
|
|
3040
|
+
while(!this.isEOF()){
|
|
3041
|
+
var ch = this.char();
|
|
3042
|
+
if (ch >= 48 && ch <= 57) {
|
|
3043
|
+
hasDigits = true;
|
|
3044
|
+
decimal = decimal * 10 + (ch - 48);
|
|
3045
|
+
this.bump();
|
|
3046
|
+
} else break;
|
|
3047
|
+
}
|
|
3048
|
+
var location = createLocation(startingPosition, this.clonePosition());
|
|
3049
|
+
if (!hasDigits) return this.error(expectNumberError, location);
|
|
3050
|
+
decimal *= sign;
|
|
3051
|
+
if (!Number.isSafeInteger(decimal)) return this.error(invalidNumberError, location);
|
|
3052
|
+
return {
|
|
3053
|
+
val: decimal,
|
|
3054
|
+
err: null
|
|
3055
|
+
};
|
|
3056
|
+
}
|
|
3057
|
+
},
|
|
3058
|
+
{
|
|
3059
|
+
key: "offset",
|
|
3060
|
+
value: function offset() {
|
|
3061
|
+
return this.position.offset;
|
|
3062
|
+
}
|
|
3063
|
+
},
|
|
3064
|
+
{
|
|
3065
|
+
key: "isEOF",
|
|
3066
|
+
value: function isEOF() {
|
|
3067
|
+
return this.offset() === this.message.length;
|
|
3068
|
+
}
|
|
3069
|
+
},
|
|
3070
|
+
{
|
|
3071
|
+
key: "clonePosition",
|
|
3072
|
+
value: function clonePosition() {
|
|
3073
|
+
return {
|
|
3074
|
+
offset: this.position.offset,
|
|
3075
|
+
line: this.position.line,
|
|
3076
|
+
column: this.position.column
|
|
3077
|
+
};
|
|
3078
|
+
}
|
|
3079
|
+
},
|
|
3080
|
+
{
|
|
3081
|
+
/**
|
|
3082
|
+
* Return the code point at the current position of the parser.
|
|
3083
|
+
* Throws if the index is out of bound.
|
|
3084
|
+
*/ key: "char",
|
|
3085
|
+
value: function char() {
|
|
3086
|
+
var offset = this.position.offset;
|
|
3087
|
+
if (offset >= this.message.length) throw Error("out of bound");
|
|
3088
|
+
var code = this.message.codePointAt(offset);
|
|
3089
|
+
if (code === void 0) throw Error("Offset ".concat(offset, " is at invalid UTF-16 code unit boundary"));
|
|
3090
|
+
return code;
|
|
3091
|
+
}
|
|
3092
|
+
},
|
|
3093
|
+
{
|
|
3094
|
+
key: "error",
|
|
3095
|
+
value: function error(kind, location) {
|
|
3096
|
+
return {
|
|
3097
|
+
val: null,
|
|
3098
|
+
err: {
|
|
3099
|
+
kind: kind,
|
|
3100
|
+
message: this.message,
|
|
3101
|
+
location: location
|
|
3102
|
+
}
|
|
3103
|
+
};
|
|
3104
|
+
}
|
|
3105
|
+
},
|
|
3106
|
+
{
|
|
3107
|
+
/** Bump the parser to the next UTF-16 code unit. */ key: "bump",
|
|
3108
|
+
value: function bump() {
|
|
3109
|
+
if (this.isEOF()) return;
|
|
3110
|
+
var code = this.char();
|
|
3111
|
+
if (code === 10) {
|
|
3112
|
+
this.position.line += 1;
|
|
3113
|
+
this.position.column = 1;
|
|
3114
|
+
this.position.offset += 1;
|
|
3115
|
+
} else {
|
|
3116
|
+
this.position.column += 1;
|
|
3117
|
+
this.position.offset += code < 65536 ? 1 : 2;
|
|
3118
|
+
}
|
|
3119
|
+
}
|
|
3120
|
+
},
|
|
3121
|
+
{
|
|
3122
|
+
/**
|
|
3123
|
+
* If the substring starting at the current position of the parser has
|
|
3124
|
+
* the given prefix, then bump the parser to the character immediately
|
|
3125
|
+
* following the prefix and return true. Otherwise, don't bump the parser
|
|
3126
|
+
* and return false.
|
|
3127
|
+
*/ key: "bumpIf",
|
|
3128
|
+
value: function bumpIf(prefix) {
|
|
3129
|
+
if (this.message.startsWith(prefix, this.offset())) {
|
|
3130
|
+
for(var i1 = 0; i1 < prefix.length; i1++)this.bump();
|
|
3131
|
+
return true;
|
|
3132
|
+
}
|
|
3133
|
+
return false;
|
|
3134
|
+
}
|
|
3135
|
+
},
|
|
3136
|
+
{
|
|
3137
|
+
/**
|
|
3138
|
+
* Bump the parser until the pattern character is found and return `true`.
|
|
3139
|
+
* Otherwise bump to the end of the file and return `false`.
|
|
3140
|
+
*/ key: "bumpUntil",
|
|
3141
|
+
value: function bumpUntil(pattern) {
|
|
3142
|
+
var currentOffset = this.offset();
|
|
3143
|
+
var index = this.message.indexOf(pattern, currentOffset);
|
|
3144
|
+
if (index >= 0) {
|
|
3145
|
+
this.bumpTo(index);
|
|
3146
|
+
return true;
|
|
3147
|
+
} else {
|
|
3148
|
+
this.bumpTo(this.message.length);
|
|
3149
|
+
return false;
|
|
3150
|
+
}
|
|
3151
|
+
}
|
|
3152
|
+
},
|
|
3153
|
+
{
|
|
3154
|
+
/**
|
|
3155
|
+
* Bump the parser to the target offset.
|
|
3156
|
+
* If target offset is beyond the end of the input, bump the parser to the end of the input.
|
|
3157
|
+
*/ key: "bumpTo",
|
|
3158
|
+
value: function bumpTo(targetOffset) {
|
|
3159
|
+
if (this.offset() > targetOffset) throw Error("targetOffset ".concat(targetOffset, " must be greater than or equal to the current offset ").concat(this.offset()));
|
|
3160
|
+
targetOffset = Math.min(targetOffset, this.message.length);
|
|
3161
|
+
while(true){
|
|
3162
|
+
var offset = this.offset();
|
|
3163
|
+
if (offset === targetOffset) break;
|
|
3164
|
+
if (offset > targetOffset) throw Error("targetOffset ".concat(targetOffset, " is at invalid UTF-16 code unit boundary"));
|
|
3165
|
+
this.bump();
|
|
3166
|
+
if (this.isEOF()) break;
|
|
3167
|
+
}
|
|
3168
|
+
}
|
|
3169
|
+
},
|
|
3170
|
+
{
|
|
3171
|
+
/** advance the parser through all whitespace to the next non-whitespace code unit. */ key: "bumpSpace",
|
|
3172
|
+
value: function bumpSpace() {
|
|
3173
|
+
while(!this.isEOF() && _isWhiteSpace(this.char()))this.bump();
|
|
3174
|
+
}
|
|
3175
|
+
},
|
|
3176
|
+
{
|
|
3177
|
+
/**
|
|
3178
|
+
* Peek at the *next* Unicode codepoint in the input without advancing the parser.
|
|
3179
|
+
* If the input has been exhausted, then this returns null.
|
|
3180
|
+
*/ key: "peek",
|
|
3181
|
+
value: function peek() {
|
|
3182
|
+
if (this.isEOF()) return null;
|
|
3183
|
+
var code = this.char();
|
|
3184
|
+
var offset = this.offset();
|
|
3185
|
+
var ref;
|
|
3186
|
+
return (ref = this.message.charCodeAt(offset + (code >= 65536 ? 2 : 1))) !== null && ref !== void 0 ? ref : null;
|
|
3187
|
+
}
|
|
3188
|
+
}
|
|
3189
|
+
]);
|
|
3190
|
+
return Parser;
|
|
3191
|
+
}();
|
|
3192
|
+
/**
|
|
3193
|
+
* This check if codepoint is alphabet (lower & uppercase)
|
|
3194
|
+
* @param codepoint
|
|
3195
|
+
* @returns
|
|
3196
|
+
*/ function _isAlpha(codepoint) {
|
|
3197
|
+
return codepoint >= 97 && codepoint <= 122 || codepoint >= 65 && codepoint <= 90;
|
|
3198
|
+
}
|
|
3199
|
+
function _isAlphaOrSlash(codepoint) {
|
|
3200
|
+
return _isAlpha(codepoint) || codepoint === 47;
|
|
3201
|
+
}
|
|
3202
|
+
/** See `parseTag` function docs. */ function _isPotentialElementNameChar(c) {
|
|
3203
|
+
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;
|
|
3204
|
+
}
|
|
3205
|
+
/**
|
|
3206
|
+
* Code point equivalent of regex `\p{White_Space}`.
|
|
3207
|
+
* From: https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt
|
|
3208
|
+
*/ function _isWhiteSpace(c) {
|
|
3209
|
+
return c >= 9 && c <= 13 || c === 32 || c === 133 || c >= 8206 && c <= 8207 || c === 8232 || c === 8233;
|
|
3210
|
+
}
|
|
3211
|
+
function pruneLocation(els) {
|
|
3212
|
+
els.forEach(function(el) {
|
|
3213
|
+
delete el.location;
|
|
3214
|
+
if (isSelectElement(el) || isPluralElement(el)) for(var k in el.options){
|
|
3215
|
+
delete el.options[k].location;
|
|
3216
|
+
pruneLocation(el.options[k].value);
|
|
3217
|
+
}
|
|
3218
|
+
else if (isNumberElement(el) && isNumberSkeleton(el.style)) delete el.style.location;
|
|
3219
|
+
else if ((isDateElement(el) || isTimeElement(el)) && isDateTimeSkeleton(el.style)) delete el.style.location;
|
|
3220
|
+
else if (isTagElement(el)) pruneLocation(el.children);
|
|
3221
|
+
});
|
|
3222
|
+
}
|
|
3223
|
+
function parse(message) {
|
|
3224
|
+
var opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
3225
|
+
opts = _objectSpread({
|
|
3226
|
+
shouldParseSkeletons: true,
|
|
3227
|
+
requiresOtherClause: true
|
|
3228
|
+
}, opts);
|
|
3229
|
+
var result = new Parser(message, opts).parse();
|
|
3230
|
+
if (result.err) {
|
|
3231
|
+
var error = SyntaxError(ErrorKind[result.err.kind]);
|
|
3232
|
+
error.location = result.err.location;
|
|
3233
|
+
error.originalMessage = result.err.message;
|
|
3234
|
+
throw error;
|
|
3235
|
+
}
|
|
3236
|
+
if (!(opts === null || opts === void 0 ? void 0 : opts.captureLocation)) pruneLocation(result.val);
|
|
3237
|
+
return result.val;
|
|
3238
|
+
}
|
|
3239
|
+
//#endregion
|
|
3240
|
+
//#region packages/intl-messageformat/error.ts
|
|
3241
|
+
var ErrorCode = /* @__PURE__ */ function(ErrorCode) {
|
|
3242
|
+
ErrorCode["MISSING_VALUE"] = "MISSING_VALUE";
|
|
3243
|
+
ErrorCode["INVALID_VALUE"] = "INVALID_VALUE";
|
|
3244
|
+
ErrorCode["MISSING_INTL_API"] = "MISSING_INTL_API";
|
|
3245
|
+
return ErrorCode;
|
|
3246
|
+
}({});
|
|
3247
|
+
var FormatError = /*#__PURE__*/ function(Error1) {
|
|
3248
|
+
"use strict";
|
|
3249
|
+
_inherits(FormatError, Error1);
|
|
3250
|
+
var _super = _createSuper(FormatError);
|
|
3251
|
+
function FormatError(msg, code, originalMessage) {
|
|
3252
|
+
_classCallCheck(this, FormatError);
|
|
3253
|
+
var _this;
|
|
3254
|
+
_this = _super.call(this, msg);
|
|
3255
|
+
_this.code = code;
|
|
3256
|
+
_this.originalMessage = originalMessage;
|
|
3257
|
+
return _this;
|
|
3258
|
+
}
|
|
3259
|
+
_createClass(FormatError, [
|
|
3260
|
+
{
|
|
3261
|
+
key: "toString",
|
|
3262
|
+
value: function toString() {
|
|
3263
|
+
return "[formatjs Error: ".concat(this.code, "] ").concat(this.message);
|
|
3264
|
+
}
|
|
3265
|
+
}
|
|
3266
|
+
]);
|
|
3267
|
+
return FormatError;
|
|
3268
|
+
}(_wrapNativeSuper(Error));
|
|
3269
|
+
var InvalidValueError = /*#__PURE__*/ function(FormatError) {
|
|
3270
|
+
"use strict";
|
|
3271
|
+
_inherits(InvalidValueError, FormatError);
|
|
3272
|
+
var _super = _createSuper(InvalidValueError);
|
|
3273
|
+
function InvalidValueError(variableId, value, options, originalMessage) {
|
|
3274
|
+
_classCallCheck(this, InvalidValueError);
|
|
3275
|
+
return _super.call(this, 'Invalid values for "'.concat(variableId, '": "').concat(value, '". Options are "').concat(Object.keys(options).join('", "'), '"'), "INVALID_VALUE", originalMessage);
|
|
3276
|
+
}
|
|
3277
|
+
return InvalidValueError;
|
|
3278
|
+
}(FormatError);
|
|
3279
|
+
var InvalidValueTypeError = /*#__PURE__*/ function(FormatError) {
|
|
3280
|
+
"use strict";
|
|
3281
|
+
_inherits(InvalidValueTypeError, FormatError);
|
|
3282
|
+
var _super = _createSuper(InvalidValueTypeError);
|
|
3283
|
+
function InvalidValueTypeError(value, type, originalMessage) {
|
|
3284
|
+
_classCallCheck(this, InvalidValueTypeError);
|
|
3285
|
+
return _super.call(this, 'Value for "'.concat(value, '" must be of type ').concat(type), "INVALID_VALUE", originalMessage);
|
|
3286
|
+
}
|
|
3287
|
+
return InvalidValueTypeError;
|
|
3288
|
+
}(FormatError);
|
|
3289
|
+
var MissingValueError = /*#__PURE__*/ function(FormatError) {
|
|
3290
|
+
"use strict";
|
|
3291
|
+
_inherits(MissingValueError, FormatError);
|
|
3292
|
+
var _super = _createSuper(MissingValueError);
|
|
3293
|
+
function MissingValueError(variableId, originalMessage) {
|
|
3294
|
+
_classCallCheck(this, MissingValueError);
|
|
3295
|
+
return _super.call(this, 'The intl string context variable "'.concat(variableId, '" was not provided to the string "').concat(originalMessage, '"'), "MISSING_VALUE", originalMessage);
|
|
3296
|
+
}
|
|
3297
|
+
return MissingValueError;
|
|
3298
|
+
}(FormatError);
|
|
3299
|
+
//#endregion
|
|
3300
|
+
//#region packages/intl-messageformat/formatters.ts
|
|
3301
|
+
var PART_TYPE = /* @__PURE__ */ function(PART_TYPE) {
|
|
3302
|
+
PART_TYPE[PART_TYPE["literal"] = 0] = "literal";
|
|
3303
|
+
PART_TYPE[PART_TYPE["object"] = 1] = "object";
|
|
3304
|
+
return PART_TYPE;
|
|
3305
|
+
}({});
|
|
3306
|
+
function mergeLiteral(parts) {
|
|
3307
|
+
if (parts.length < 2) return parts;
|
|
3308
|
+
return parts.reduce(function(all, part) {
|
|
3309
|
+
var lastPart = all[all.length - 1];
|
|
3310
|
+
if (!lastPart || lastPart.type !== 0 || part.type !== 0) all.push(part);
|
|
3311
|
+
else lastPart.value += part.value;
|
|
3312
|
+
return all;
|
|
3313
|
+
}, []);
|
|
3314
|
+
}
|
|
3315
|
+
function isFormatXMLElementFn(el) {
|
|
3316
|
+
return typeof el === "function";
|
|
3317
|
+
}
|
|
3318
|
+
function formatToParts(els, locales, formatters, formats, values, currentPluralValue, originalMessage) {
|
|
3319
|
+
if (els.length === 1 && isLiteralElement(els[0])) return [
|
|
3320
|
+
{
|
|
3321
|
+
type: 0,
|
|
3322
|
+
value: els[0].value
|
|
3323
|
+
}
|
|
3324
|
+
];
|
|
3325
|
+
var result = [];
|
|
3326
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
3327
|
+
try {
|
|
3328
|
+
for(var _iterator = els[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
3329
|
+
var el = _step.value;
|
|
3330
|
+
if (isLiteralElement(el)) {
|
|
3331
|
+
result.push({
|
|
3332
|
+
type: 0,
|
|
3333
|
+
value: el.value
|
|
3334
|
+
});
|
|
3335
|
+
continue;
|
|
3336
|
+
}
|
|
3337
|
+
if (isPoundElement(el)) {
|
|
3338
|
+
if (typeof currentPluralValue === "number") result.push({
|
|
3339
|
+
type: 0,
|
|
3340
|
+
value: formatters.getNumberFormat(locales).format(currentPluralValue)
|
|
3341
|
+
});
|
|
3342
|
+
continue;
|
|
3343
|
+
}
|
|
3344
|
+
var varName = el.value;
|
|
3345
|
+
if (!(values && varName in values)) throw new MissingValueError(varName, originalMessage);
|
|
3346
|
+
var value = values[varName];
|
|
3347
|
+
if (isArgumentElement(el)) {
|
|
3348
|
+
if (!value || typeof value === "string" || typeof value === "number" || (typeof value === "undefined" ? "undefined" : _typeof(value)) === "bigint") value = typeof value === "string" || typeof value === "number" || (typeof value === "undefined" ? "undefined" : _typeof(value)) === "bigint" ? String(value) : "";
|
|
3349
|
+
result.push({
|
|
3350
|
+
type: typeof value === "string" ? 0 : 1,
|
|
3351
|
+
value: value
|
|
3352
|
+
});
|
|
3353
|
+
continue;
|
|
3354
|
+
}
|
|
3355
|
+
if (isDateElement(el)) {
|
|
3356
|
+
var style = typeof el.style === "string" ? formats.date[el.style] : isDateTimeSkeleton(el.style) ? el.style.parsedOptions : void 0;
|
|
3357
|
+
result.push({
|
|
3358
|
+
type: 0,
|
|
3359
|
+
value: formatters.getDateTimeFormat(locales, style).format(value)
|
|
3360
|
+
});
|
|
3361
|
+
continue;
|
|
3362
|
+
}
|
|
3363
|
+
if (isTimeElement(el)) {
|
|
3364
|
+
var style1 = typeof el.style === "string" ? formats.time[el.style] : isDateTimeSkeleton(el.style) ? el.style.parsedOptions : formats.time.medium;
|
|
3365
|
+
result.push({
|
|
3366
|
+
type: 0,
|
|
3367
|
+
value: formatters.getDateTimeFormat(locales, style1).format(value)
|
|
3368
|
+
});
|
|
3369
|
+
continue;
|
|
3370
|
+
}
|
|
3371
|
+
if (isNumberElement(el)) {
|
|
3372
|
+
var style2 = typeof el.style === "string" ? formats.number[el.style] : isNumberSkeleton(el.style) ? el.style.parsedOptions : void 0;
|
|
3373
|
+
if (style2 && style2.scale) {
|
|
3374
|
+
var scale = style2.scale || 1;
|
|
3375
|
+
if ((typeof value === "undefined" ? "undefined" : _typeof(value)) === "bigint") {
|
|
3376
|
+
if (!Number.isInteger(scale)) throw new TypeError("Cannot apply fractional scale ".concat(scale, " to bigint value. Scale must be an integer when formatting bigint."));
|
|
3377
|
+
value = value * BigInt(scale);
|
|
3378
|
+
} else value = value * scale;
|
|
3379
|
+
}
|
|
3380
|
+
result.push({
|
|
3381
|
+
type: 0,
|
|
3382
|
+
value: formatters.getNumberFormat(locales, style2).format(value)
|
|
3383
|
+
});
|
|
3384
|
+
continue;
|
|
3385
|
+
}
|
|
3386
|
+
if (isTagElement(el)) {
|
|
3387
|
+
var _result;
|
|
3388
|
+
var children = el.children, value1 = el.value;
|
|
3389
|
+
var formatFn = values[value1];
|
|
3390
|
+
if (!isFormatXMLElementFn(formatFn)) throw new InvalidValueTypeError(value1, "function", originalMessage);
|
|
3391
|
+
var chunks = formatFn(formatToParts(children, locales, formatters, formats, values, currentPluralValue).map(function(p) {
|
|
3392
|
+
return p.value;
|
|
3393
|
+
}));
|
|
3394
|
+
if (!Array.isArray(chunks)) chunks = [
|
|
3395
|
+
chunks
|
|
3396
|
+
];
|
|
3397
|
+
(_result = result).push.apply(_result, _toConsumableArray(chunks.map(function(c) {
|
|
3398
|
+
return {
|
|
3399
|
+
type: typeof c === "string" ? 0 : 1,
|
|
3400
|
+
value: c
|
|
3401
|
+
};
|
|
3402
|
+
})));
|
|
3403
|
+
}
|
|
3404
|
+
if (isSelectElement(el)) {
|
|
3405
|
+
var _result1;
|
|
3406
|
+
var key = value;
|
|
3407
|
+
var opt = (Object.prototype.hasOwnProperty.call(el.options, key) ? el.options[key] : void 0) || el.options.other;
|
|
3408
|
+
if (!opt) throw new InvalidValueError(el.value, value, Object.keys(el.options), originalMessage);
|
|
3409
|
+
(_result1 = result).push.apply(_result1, _toConsumableArray(formatToParts(opt.value, locales, formatters, formats, values)));
|
|
3410
|
+
continue;
|
|
3411
|
+
}
|
|
3412
|
+
if (isPluralElement(el)) {
|
|
3413
|
+
var _result2;
|
|
3414
|
+
var exactKey = "=".concat(value);
|
|
3415
|
+
var opt1 = Object.prototype.hasOwnProperty.call(el.options, exactKey) ? el.options[exactKey] : void 0;
|
|
3416
|
+
if (!opt1) {
|
|
3417
|
+
if (!Intl.PluralRules) throw new FormatError('Intl.PluralRules is not available in this environment.\nTry polyfilling it using "@formatjs/intl-pluralrules"\n', "MISSING_INTL_API", originalMessage);
|
|
3418
|
+
var numericValue = (typeof value === "undefined" ? "undefined" : _typeof(value)) === "bigint" ? Number(value) : value;
|
|
3419
|
+
var rule = formatters.getPluralRules(locales, {
|
|
3420
|
+
type: el.pluralType
|
|
3421
|
+
}).select(numericValue - (el.offset || 0));
|
|
3422
|
+
opt1 = (Object.prototype.hasOwnProperty.call(el.options, rule) ? el.options[rule] : void 0) || el.options.other;
|
|
3423
|
+
}
|
|
3424
|
+
if (!opt1) throw new InvalidValueError(el.value, value, Object.keys(el.options), originalMessage);
|
|
3425
|
+
var numericValue1 = (typeof value === "undefined" ? "undefined" : _typeof(value)) === "bigint" ? Number(value) : value;
|
|
3426
|
+
(_result2 = result).push.apply(_result2, _toConsumableArray(formatToParts(opt1.value, locales, formatters, formats, values, numericValue1 - (el.offset || 0))));
|
|
3427
|
+
continue;
|
|
3428
|
+
}
|
|
3429
|
+
}
|
|
3430
|
+
} catch (err) {
|
|
3431
|
+
_didIteratorError = true;
|
|
3432
|
+
_iteratorError = err;
|
|
3433
|
+
} finally{
|
|
3434
|
+
try {
|
|
3435
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
3436
|
+
_iterator.return();
|
|
3437
|
+
}
|
|
3438
|
+
} finally{
|
|
3439
|
+
if (_didIteratorError) {
|
|
3440
|
+
throw _iteratorError;
|
|
3441
|
+
}
|
|
3442
|
+
}
|
|
3443
|
+
}
|
|
3444
|
+
return mergeLiteral(result);
|
|
3445
|
+
}
|
|
3446
|
+
//#endregion
|
|
3447
|
+
//#region packages/intl-messageformat/core.ts
|
|
3448
|
+
function mergeConfig(c1, c2) {
|
|
3449
|
+
if (!c2) return c1;
|
|
3450
|
+
return _objectSpread({}, c1, c2, Object.keys(c1).reduce(function(all, k) {
|
|
3451
|
+
all[k] = _objectSpread({}, c1[k], c2[k]);
|
|
3452
|
+
return all;
|
|
3453
|
+
}, {}));
|
|
3454
|
+
}
|
|
3455
|
+
function mergeConfigs(defaultConfig, configs) {
|
|
3456
|
+
if (!configs) return defaultConfig;
|
|
3457
|
+
return Object.keys(defaultConfig).reduce(function(all, k) {
|
|
3458
|
+
all[k] = mergeConfig(defaultConfig[k], configs[k]);
|
|
3459
|
+
return all;
|
|
3460
|
+
}, _objectSpread({}, defaultConfig));
|
|
3461
|
+
}
|
|
3462
|
+
function createFastMemoizeCache(store) {
|
|
3463
|
+
return {
|
|
3464
|
+
create: function create() {
|
|
3465
|
+
return {
|
|
3466
|
+
get: function get(key) {
|
|
3467
|
+
return store[key];
|
|
3468
|
+
},
|
|
3469
|
+
set: function set(key, value) {
|
|
3470
|
+
store[key] = value;
|
|
3471
|
+
}
|
|
3472
|
+
};
|
|
3473
|
+
}
|
|
3474
|
+
};
|
|
3475
|
+
}
|
|
3476
|
+
function createDefaultFormatters() {
|
|
3477
|
+
var cache = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
|
|
3478
|
+
number: {},
|
|
3479
|
+
dateTime: {},
|
|
3480
|
+
pluralRules: {}
|
|
3481
|
+
};
|
|
3482
|
+
return {
|
|
3483
|
+
getNumberFormat: memoize(function() {
|
|
3484
|
+
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
3485
|
+
args[_key] = arguments[_key];
|
|
3486
|
+
}
|
|
3487
|
+
return _construct(Intl.NumberFormat, _toConsumableArray(args));
|
|
3488
|
+
}, {
|
|
3489
|
+
cache: createFastMemoizeCache(cache.number),
|
|
3490
|
+
strategy: strategies.variadic
|
|
3491
|
+
}),
|
|
3492
|
+
getDateTimeFormat: memoize(function() {
|
|
3493
|
+
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
3494
|
+
args[_key] = arguments[_key];
|
|
3495
|
+
}
|
|
3496
|
+
return _construct(Intl.DateTimeFormat, _toConsumableArray(args));
|
|
3497
|
+
}, {
|
|
3498
|
+
cache: createFastMemoizeCache(cache.dateTime),
|
|
3499
|
+
strategy: strategies.variadic
|
|
3500
|
+
}),
|
|
3501
|
+
getPluralRules: memoize(function() {
|
|
3502
|
+
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
3503
|
+
args[_key] = arguments[_key];
|
|
3504
|
+
}
|
|
3505
|
+
return _construct(Intl.PluralRules, _toConsumableArray(args));
|
|
3506
|
+
}, {
|
|
3507
|
+
cache: createFastMemoizeCache(cache.pluralRules),
|
|
3508
|
+
strategy: strategies.variadic
|
|
3509
|
+
})
|
|
3510
|
+
};
|
|
3511
|
+
}
|
|
3512
|
+
var /*#__PURE__*/ _IntlMessageFormat1;
|
|
3513
|
+
var IntlMessageFormat = ((_IntlMessageFormat1 = function() {
|
|
3514
|
+
"use strict";
|
|
3515
|
+
function IntlMessageFormat(message) {
|
|
3516
|
+
var locales = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : IntlMessageFormat.defaultLocale, overrideFormats = arguments.length > 2 ? arguments[2] : void 0, opts = arguments.length > 3 ? arguments[3] : void 0;
|
|
3517
|
+
var _this = this;
|
|
3518
|
+
_classCallCheck(this, IntlMessageFormat);
|
|
3519
|
+
this.formatterCache = {
|
|
3520
|
+
number: {},
|
|
3521
|
+
dateTime: {},
|
|
3522
|
+
pluralRules: {}
|
|
3523
|
+
};
|
|
3524
|
+
this.format = function(values) {
|
|
3525
|
+
var parts = _this.formatToParts(values);
|
|
3526
|
+
if (parts.length === 1) return parts[0].value;
|
|
3527
|
+
var result = parts.reduce(function(all, part) {
|
|
3528
|
+
if (!all.length || part.type !== 0 || typeof all[all.length - 1] !== "string") all.push(part.value);
|
|
3529
|
+
else all[all.length - 1] += part.value;
|
|
3530
|
+
return all;
|
|
3531
|
+
}, []);
|
|
3532
|
+
if (result.length <= 1) return result[0] || "";
|
|
3533
|
+
return result;
|
|
3534
|
+
};
|
|
3535
|
+
this.formatToParts = function(values) {
|
|
3536
|
+
return formatToParts(_this.ast, _this.locales, _this.formatters, _this.formats, values, void 0, _this.message);
|
|
3537
|
+
};
|
|
3538
|
+
this.resolvedOptions = function() {
|
|
3539
|
+
var ref;
|
|
3540
|
+
return {
|
|
3541
|
+
locale: ((ref = _this.resolvedLocale) === null || ref === void 0 ? void 0 : ref.toString()) || Intl.NumberFormat.supportedLocalesOf(_this.locales)[0]
|
|
3542
|
+
};
|
|
3543
|
+
};
|
|
3544
|
+
this.getAst = function() {
|
|
3545
|
+
return _this.ast;
|
|
3546
|
+
};
|
|
3547
|
+
this.locales = locales;
|
|
3548
|
+
this.resolvedLocale = IntlMessageFormat.resolveLocale(locales);
|
|
3549
|
+
if (typeof message === "string") {
|
|
3550
|
+
this.message = message;
|
|
3551
|
+
if (!IntlMessageFormat.__parse) throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");
|
|
3552
|
+
var parseOpts = _extends({}, opts || {});
|
|
3553
|
+
this.ast = IntlMessageFormat.__parse(message, _objectSpreadProps(_objectSpread({}, parseOpts), {
|
|
3554
|
+
locale: this.resolvedLocale
|
|
3555
|
+
}));
|
|
3556
|
+
} else this.ast = message;
|
|
3557
|
+
if (!Array.isArray(this.ast)) throw new TypeError("A message must be provided as a String or AST.");
|
|
3558
|
+
this.formats = mergeConfigs(IntlMessageFormat.formats, overrideFormats);
|
|
3559
|
+
this.formatters = opts && opts.formatters || createDefaultFormatters(this.formatterCache);
|
|
3560
|
+
}
|
|
3561
|
+
_createClass(IntlMessageFormat, null, [
|
|
3562
|
+
{
|
|
3563
|
+
key: "defaultLocale",
|
|
3564
|
+
get: function get() {
|
|
3565
|
+
if (!IntlMessageFormat.memoizedDefaultLocale) IntlMessageFormat.memoizedDefaultLocale = new Intl.NumberFormat().resolvedOptions().locale;
|
|
3566
|
+
return IntlMessageFormat.memoizedDefaultLocale;
|
|
3567
|
+
}
|
|
3568
|
+
}
|
|
3569
|
+
]);
|
|
3570
|
+
return IntlMessageFormat;
|
|
3571
|
+
}(), _IntlMessageFormat = _IntlMessageFormat1, _IntlMessageFormat1), __ = {
|
|
3572
|
+
writable: true,
|
|
3573
|
+
value: function() {
|
|
3574
|
+
_IntlMessageFormat.memoizedDefaultLocale = null;
|
|
3575
|
+
}()
|
|
3576
|
+
}, __1 = {
|
|
3577
|
+
writable: true,
|
|
3578
|
+
value: function() {
|
|
3579
|
+
_IntlMessageFormat.resolveLocale = function(locales) {
|
|
3580
|
+
if (typeof Intl.Locale === "undefined") return;
|
|
3581
|
+
var supportedLocales = Intl.NumberFormat.supportedLocalesOf(locales);
|
|
3582
|
+
if (supportedLocales.length > 0) return new Intl.Locale(supportedLocales[0]);
|
|
3583
|
+
return new Intl.Locale(typeof locales === "string" ? locales : locales[0]);
|
|
3584
|
+
};
|
|
3585
|
+
}()
|
|
3586
|
+
}, __2 = {
|
|
3587
|
+
writable: true,
|
|
3588
|
+
value: function() {
|
|
3589
|
+
_IntlMessageFormat.__parse = parse;
|
|
3590
|
+
}()
|
|
3591
|
+
}, __3 = {
|
|
3592
|
+
writable: true,
|
|
3593
|
+
value: function() {
|
|
3594
|
+
_IntlMessageFormat.formats = {
|
|
3595
|
+
number: {
|
|
3596
|
+
integer: {
|
|
3597
|
+
maximumFractionDigits: 0
|
|
3598
|
+
},
|
|
3599
|
+
currency: {
|
|
3600
|
+
style: "currency"
|
|
3601
|
+
},
|
|
3602
|
+
percent: {
|
|
3603
|
+
style: "percent"
|
|
3604
|
+
}
|
|
3605
|
+
},
|
|
3606
|
+
date: {
|
|
3607
|
+
short: {
|
|
3608
|
+
month: "numeric",
|
|
3609
|
+
day: "numeric",
|
|
3610
|
+
year: "2-digit"
|
|
3611
|
+
},
|
|
3612
|
+
medium: {
|
|
3613
|
+
month: "short",
|
|
3614
|
+
day: "numeric",
|
|
3615
|
+
year: "numeric"
|
|
3616
|
+
},
|
|
3617
|
+
long: {
|
|
3618
|
+
month: "long",
|
|
3619
|
+
day: "numeric",
|
|
3620
|
+
year: "numeric"
|
|
3621
|
+
},
|
|
3622
|
+
full: {
|
|
3623
|
+
weekday: "long",
|
|
3624
|
+
month: "long",
|
|
3625
|
+
day: "numeric",
|
|
3626
|
+
year: "numeric"
|
|
3627
|
+
}
|
|
3628
|
+
},
|
|
3629
|
+
time: {
|
|
3630
|
+
short: {
|
|
3631
|
+
hour: "numeric",
|
|
3632
|
+
minute: "numeric"
|
|
3633
|
+
},
|
|
3634
|
+
medium: {
|
|
3635
|
+
hour: "numeric",
|
|
3636
|
+
minute: "numeric",
|
|
3637
|
+
second: "numeric"
|
|
3638
|
+
},
|
|
3639
|
+
long: {
|
|
3640
|
+
hour: "numeric",
|
|
3641
|
+
minute: "numeric",
|
|
3642
|
+
second: "numeric",
|
|
3643
|
+
timeZoneName: "short"
|
|
3644
|
+
},
|
|
3645
|
+
full: {
|
|
3646
|
+
hour: "numeric",
|
|
3647
|
+
minute: "numeric",
|
|
3648
|
+
second: "numeric",
|
|
3649
|
+
timeZoneName: "short"
|
|
3650
|
+
}
|
|
3651
|
+
}
|
|
3652
|
+
};
|
|
3653
|
+
}()
|
|
3654
|
+
}, _IntlMessageFormat);
|
|
3655
|
+
//#endregion
|
|
3656
|
+
//#region packages/intl-messageformat/index.ts
|
|
3657
|
+
var intl_messageformat_default = IntlMessageFormat;
|
|
3658
|
+
//# sourceMappingURL=intl-messageformat.iife.js.map
|