react-intl 5.20.11 → 5.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +8 -7
- package/index.d.ts.map +1 -1
- package/index.js +27 -28
- package/lib/index.d.ts +8 -7
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +9 -7
- package/lib/src/components/provider.d.ts +1 -1
- package/lib/src/components/provider.d.ts.map +1 -1
- package/lib/src/components/provider.js +2 -1
- package/lib/src/components/relative.js +1 -1
- package/lib/src/utils.d.ts +1 -1
- package/lib/src/utils.d.ts.map +1 -1
- package/package.json +8 -8
- package/react-intl.iife.js +129 -95
- package/src/components/createFormattedComponent.js +10 -10
- package/src/components/dateTimeRange.js +4 -4
- package/src/components/injectIntl.js +6 -6
- package/src/components/message.js +7 -7
- package/src/components/plural.js +3 -3
- package/src/components/provider.d.ts +1 -1
- package/src/components/provider.d.ts.map +1 -1
- package/src/components/provider.js +15 -14
- package/src/components/relative.js +8 -8
- package/src/components/useIntl.js +2 -2
- package/src/utils.d.ts +1 -1
- package/src/utils.d.ts.map +1 -1
- package/src/utils.js +3 -3
package/react-intl.iife.js
CHANGED
|
@@ -6,32 +6,44 @@ var ReactIntl = (function() {
|
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __markAsModule = function(target) {
|
|
9
|
-
return __defProp(target, "__esModule", {value: true});
|
|
9
|
+
return __defProp(target, "__esModule", { value: true });
|
|
10
10
|
};
|
|
11
|
+
var __require = /* @__PURE__ */ function(x) {
|
|
12
|
+
return typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
13
|
+
get: function(a, b) {
|
|
14
|
+
return (typeof require !== "undefined" ? require : a)[b];
|
|
15
|
+
}
|
|
16
|
+
}) : x;
|
|
17
|
+
}(function(x) {
|
|
18
|
+
if (typeof require !== "undefined")
|
|
19
|
+
return require.apply(this, arguments);
|
|
20
|
+
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
21
|
+
});
|
|
11
22
|
var __commonJS = function(cb, mod) {
|
|
12
|
-
return function
|
|
13
|
-
return mod || (0, cb[Object.keys(cb)[0]])((mod = {exports: {}}).exports, mod), mod.exports;
|
|
23
|
+
return function __require2() {
|
|
24
|
+
return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
14
25
|
};
|
|
15
26
|
};
|
|
16
27
|
var __export = function(target, all) {
|
|
28
|
+
__markAsModule(target);
|
|
17
29
|
for (var name in all)
|
|
18
|
-
__defProp(target, name, {get: all[name], enumerable: true});
|
|
30
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
31
|
};
|
|
20
32
|
var __reExport = function(target, module, desc) {
|
|
21
33
|
if (module && typeof module === "object" || typeof module === "function")
|
|
22
34
|
for (var keys = __getOwnPropNames(module), i = 0, n = keys.length, key; i < n; i++) {
|
|
23
35
|
key = keys[i];
|
|
24
36
|
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
25
|
-
__defProp(target, key, {get: function(k) {
|
|
37
|
+
__defProp(target, key, { get: function(k) {
|
|
26
38
|
return module[k];
|
|
27
|
-
}.bind(null, key), enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable});
|
|
39
|
+
}.bind(null, key), enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
|
|
28
40
|
}
|
|
29
41
|
return target;
|
|
30
42
|
};
|
|
31
43
|
var __toModule = function(module) {
|
|
32
|
-
return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? {get: function() {
|
|
44
|
+
return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? { get: function() {
|
|
33
45
|
return module.default;
|
|
34
|
-
}, enumerable: true} : {value: module, enumerable: true})), module);
|
|
46
|
+
}, enumerable: true } : { value: module, enumerable: true })), module);
|
|
35
47
|
};
|
|
36
48
|
|
|
37
49
|
// node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.development.js
|
|
@@ -292,7 +304,7 @@ var ReactIntl = (function() {
|
|
|
292
304
|
var require_utils = __commonJS({
|
|
293
305
|
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/utils.js": function(exports) {
|
|
294
306
|
"use strict";
|
|
295
|
-
Object.defineProperty(exports, "__esModule", {value: true});
|
|
307
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
296
308
|
exports.invariant = exports.UNICODE_EXTENSION_SEQUENCE_REGEX = void 0;
|
|
297
309
|
exports.UNICODE_EXTENSION_SEQUENCE_REGEX = /-u(?:-[0-9a-z]{2,8})+/gi;
|
|
298
310
|
function invariant2(condition, message, Err) {
|
|
@@ -311,7 +323,7 @@ var ReactIntl = (function() {
|
|
|
311
323
|
var require_BestAvailableLocale = __commonJS({
|
|
312
324
|
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/BestAvailableLocale.js": function(exports) {
|
|
313
325
|
"use strict";
|
|
314
|
-
Object.defineProperty(exports, "__esModule", {value: true});
|
|
326
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
315
327
|
exports.BestAvailableLocale = void 0;
|
|
316
328
|
function BestAvailableLocale(availableLocales, locale) {
|
|
317
329
|
var candidate = locale;
|
|
@@ -337,16 +349,16 @@ var ReactIntl = (function() {
|
|
|
337
349
|
var require_LookupMatcher = __commonJS({
|
|
338
350
|
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/LookupMatcher.js": function(exports) {
|
|
339
351
|
"use strict";
|
|
340
|
-
Object.defineProperty(exports, "__esModule", {value: true});
|
|
352
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
341
353
|
exports.LookupMatcher = void 0;
|
|
342
354
|
var utils_1 = require_utils();
|
|
343
355
|
var BestAvailableLocale_1 = require_BestAvailableLocale();
|
|
344
356
|
function LookupMatcher(availableLocales, requestedLocales, getDefaultLocale) {
|
|
345
|
-
var result = {locale: ""};
|
|
357
|
+
var result = { locale: "" };
|
|
346
358
|
for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
|
|
347
359
|
var locale = requestedLocales_1[_i];
|
|
348
360
|
var noExtensionLocale = locale.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, "");
|
|
349
|
-
var availableLocale = BestAvailableLocale_1.BestAvailableLocale(availableLocales, noExtensionLocale);
|
|
361
|
+
var availableLocale = (0, BestAvailableLocale_1.BestAvailableLocale)(availableLocales, noExtensionLocale);
|
|
350
362
|
if (availableLocale) {
|
|
351
363
|
result.locale = availableLocale;
|
|
352
364
|
if (locale !== noExtensionLocale) {
|
|
@@ -366,7 +378,7 @@ var ReactIntl = (function() {
|
|
|
366
378
|
var require_BestFitMatcher = __commonJS({
|
|
367
379
|
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/BestFitMatcher.js": function(exports) {
|
|
368
380
|
"use strict";
|
|
369
|
-
Object.defineProperty(exports, "__esModule", {value: true});
|
|
381
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
370
382
|
exports.BestFitMatcher = void 0;
|
|
371
383
|
var BestAvailableLocale_1 = require_BestAvailableLocale();
|
|
372
384
|
var utils_1 = require_utils();
|
|
@@ -403,7 +415,7 @@ var ReactIntl = (function() {
|
|
|
403
415
|
foundLocale = minimizedRequestedLocale;
|
|
404
416
|
break;
|
|
405
417
|
}
|
|
406
|
-
foundLocale = BestAvailableLocale_1.BestAvailableLocale(minimizedAvailableLocales, maximizedRequestedLocale);
|
|
418
|
+
foundLocale = (0, BestAvailableLocale_1.BestAvailableLocale)(minimizedAvailableLocales, maximizedRequestedLocale);
|
|
407
419
|
}
|
|
408
420
|
return {
|
|
409
421
|
locale: foundLocale && minimizedAvailableLocaleMap[foundLocale] || getDefaultLocale()
|
|
@@ -417,11 +429,11 @@ var ReactIntl = (function() {
|
|
|
417
429
|
var require_UnicodeExtensionValue = __commonJS({
|
|
418
430
|
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/UnicodeExtensionValue.js": function(exports) {
|
|
419
431
|
"use strict";
|
|
420
|
-
Object.defineProperty(exports, "__esModule", {value: true});
|
|
432
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
421
433
|
exports.UnicodeExtensionValue = void 0;
|
|
422
434
|
var utils_1 = require_utils();
|
|
423
435
|
function UnicodeExtensionValue(extension, key) {
|
|
424
|
-
utils_1.invariant(key.length === 2, "key must have 2 elements");
|
|
436
|
+
(0, utils_1.invariant)(key.length === 2, "key must have 2 elements");
|
|
425
437
|
var size = extension.length;
|
|
426
438
|
var searchValue = "-" + key + "-";
|
|
427
439
|
var pos = extension.indexOf(searchValue);
|
|
@@ -465,7 +477,7 @@ var ReactIntl = (function() {
|
|
|
465
477
|
var require_ResolveLocale = __commonJS({
|
|
466
478
|
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/ResolveLocale.js": function(exports) {
|
|
467
479
|
"use strict";
|
|
468
|
-
Object.defineProperty(exports, "__esModule", {value: true});
|
|
480
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
469
481
|
exports.ResolveLocale = void 0;
|
|
470
482
|
var LookupMatcher_1 = require_LookupMatcher();
|
|
471
483
|
var BestFitMatcher_1 = require_BestFitMatcher();
|
|
@@ -475,25 +487,25 @@ var ReactIntl = (function() {
|
|
|
475
487
|
var matcher = options.localeMatcher;
|
|
476
488
|
var r;
|
|
477
489
|
if (matcher === "lookup") {
|
|
478
|
-
r = LookupMatcher_1.LookupMatcher(availableLocales, requestedLocales, getDefaultLocale);
|
|
490
|
+
r = (0, LookupMatcher_1.LookupMatcher)(availableLocales, requestedLocales, getDefaultLocale);
|
|
479
491
|
} else {
|
|
480
|
-
r = BestFitMatcher_1.BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale);
|
|
492
|
+
r = (0, BestFitMatcher_1.BestFitMatcher)(availableLocales, requestedLocales, getDefaultLocale);
|
|
481
493
|
}
|
|
482
494
|
var foundLocale = r.locale;
|
|
483
|
-
var result = {locale: "", dataLocale: foundLocale};
|
|
495
|
+
var result = { locale: "", dataLocale: foundLocale };
|
|
484
496
|
var supportedExtension = "-u";
|
|
485
497
|
for (var _i = 0, relevantExtensionKeys_1 = relevantExtensionKeys; _i < relevantExtensionKeys_1.length; _i++) {
|
|
486
498
|
var key = relevantExtensionKeys_1[_i];
|
|
487
|
-
utils_1.invariant(foundLocale in localeData, "Missing locale data for " + foundLocale);
|
|
499
|
+
(0, utils_1.invariant)(foundLocale in localeData, "Missing locale data for " + foundLocale);
|
|
488
500
|
var foundLocaleData = localeData[foundLocale];
|
|
489
|
-
utils_1.invariant(typeof foundLocaleData === "object" && foundLocaleData !== null, "locale data " + key + " must be an object");
|
|
501
|
+
(0, utils_1.invariant)(typeof foundLocaleData === "object" && foundLocaleData !== null, "locale data " + key + " must be an object");
|
|
490
502
|
var keyLocaleData = foundLocaleData[key];
|
|
491
|
-
utils_1.invariant(Array.isArray(keyLocaleData), "keyLocaleData for " + key + " must be an array");
|
|
503
|
+
(0, utils_1.invariant)(Array.isArray(keyLocaleData), "keyLocaleData for " + key + " must be an array");
|
|
492
504
|
var value = keyLocaleData[0];
|
|
493
|
-
utils_1.invariant(typeof value === "string" || value === null, "value must be string or null but got " + typeof value + " in key " + key);
|
|
505
|
+
(0, utils_1.invariant)(typeof value === "string" || value === null, "value must be string or null but got " + typeof value + " in key " + key);
|
|
494
506
|
var supportedExtensionAddition = "";
|
|
495
507
|
if (r.extension) {
|
|
496
|
-
var requestedValue = UnicodeExtensionValue_1.UnicodeExtensionValue(r.extension, key);
|
|
508
|
+
var requestedValue = (0, UnicodeExtensionValue_1.UnicodeExtensionValue)(r.extension, key);
|
|
497
509
|
if (requestedValue !== void 0) {
|
|
498
510
|
if (requestedValue !== "") {
|
|
499
511
|
if (~keyLocaleData.indexOf(requestedValue)) {
|
|
@@ -508,7 +520,7 @@ var ReactIntl = (function() {
|
|
|
508
520
|
}
|
|
509
521
|
if (key in options) {
|
|
510
522
|
var optionsValue = options[key];
|
|
511
|
-
utils_1.invariant(typeof optionsValue === "string" || typeof optionsValue === "undefined" || optionsValue === null, "optionsValue must be String, Undefined or Null");
|
|
523
|
+
(0, utils_1.invariant)(typeof optionsValue === "string" || typeof optionsValue === "undefined" || optionsValue === null, "optionsValue must be String, Undefined or Null");
|
|
512
524
|
if (~keyLocaleData.indexOf(optionsValue)) {
|
|
513
525
|
if (optionsValue !== value) {
|
|
514
526
|
value = optionsValue;
|
|
@@ -541,7 +553,7 @@ var ReactIntl = (function() {
|
|
|
541
553
|
var require_LookupSupportedLocales = __commonJS({
|
|
542
554
|
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/LookupSupportedLocales.js": function(exports) {
|
|
543
555
|
"use strict";
|
|
544
|
-
Object.defineProperty(exports, "__esModule", {value: true});
|
|
556
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
545
557
|
exports.LookupSupportedLocales = void 0;
|
|
546
558
|
var utils_1 = require_utils();
|
|
547
559
|
var BestAvailableLocale_1 = require_BestAvailableLocale();
|
|
@@ -550,7 +562,7 @@ var ReactIntl = (function() {
|
|
|
550
562
|
for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
|
|
551
563
|
var locale = requestedLocales_1[_i];
|
|
552
564
|
var noExtensionLocale = locale.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, "");
|
|
553
|
-
var availableLocale = BestAvailableLocale_1.BestAvailableLocale(availableLocales, noExtensionLocale);
|
|
565
|
+
var availableLocale = (0, BestAvailableLocale_1.BestAvailableLocale)(availableLocales, noExtensionLocale);
|
|
554
566
|
if (availableLocale) {
|
|
555
567
|
subset.push(availableLocale);
|
|
556
568
|
}
|
|
@@ -565,7 +577,7 @@ var ReactIntl = (function() {
|
|
|
565
577
|
var require_intl_localematcher = __commonJS({
|
|
566
578
|
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/index.js": function(exports) {
|
|
567
579
|
"use strict";
|
|
568
|
-
Object.defineProperty(exports, "__esModule", {value: true});
|
|
580
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
569
581
|
exports.ResolveLocale = exports.LookupSupportedLocales = exports.match = void 0;
|
|
570
582
|
var ResolveLocale_1 = require_ResolveLocale();
|
|
571
583
|
function match(requestedLocales, availableLocales, defaultLocale, opts) {
|
|
@@ -573,7 +585,7 @@ var ReactIntl = (function() {
|
|
|
573
585
|
all.add(l);
|
|
574
586
|
return all;
|
|
575
587
|
}, new Set());
|
|
576
|
-
return ResolveLocale_1.ResolveLocale(locales, requestedLocales, {
|
|
588
|
+
return (0, ResolveLocale_1.ResolveLocale)(locales, requestedLocales, {
|
|
577
589
|
localeMatcher: (opts === null || opts === void 0 ? void 0 : opts.algorithm) || "best fit"
|
|
578
590
|
}, [], {}, function() {
|
|
579
591
|
return defaultLocale;
|
|
@@ -581,13 +593,13 @@ var ReactIntl = (function() {
|
|
|
581
593
|
}
|
|
582
594
|
exports.match = match;
|
|
583
595
|
var LookupSupportedLocales_1 = require_LookupSupportedLocales();
|
|
584
|
-
Object.defineProperty(exports, "LookupSupportedLocales", {enumerable: true, get: function() {
|
|
596
|
+
Object.defineProperty(exports, "LookupSupportedLocales", { enumerable: true, get: function() {
|
|
585
597
|
return LookupSupportedLocales_1.LookupSupportedLocales;
|
|
586
|
-
}});
|
|
598
|
+
} });
|
|
587
599
|
var ResolveLocale_2 = require_ResolveLocale();
|
|
588
|
-
Object.defineProperty(exports, "ResolveLocale", {enumerable: true, get: function() {
|
|
600
|
+
Object.defineProperty(exports, "ResolveLocale", { enumerable: true, get: function() {
|
|
589
601
|
return ResolveLocale_2.ResolveLocale;
|
|
590
|
-
}});
|
|
602
|
+
} });
|
|
591
603
|
}
|
|
592
604
|
});
|
|
593
605
|
|
|
@@ -685,7 +697,7 @@ var ReactIntl = (function() {
|
|
|
685
697
|
|
|
686
698
|
// node_modules/tslib/tslib.es6.js
|
|
687
699
|
var extendStatics = function(d, b) {
|
|
688
|
-
extendStatics = Object.setPrototypeOf || {__proto__: []} instanceof Array && function(d2, b2) {
|
|
700
|
+
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
|
689
701
|
d2.__proto__ = b2;
|
|
690
702
|
} || function(d2, b2) {
|
|
691
703
|
for (var p in b2)
|
|
@@ -1064,7 +1076,7 @@ var ReactIntl = (function() {
|
|
|
1064
1076
|
throw new Error("Invalid number skeleton");
|
|
1065
1077
|
}
|
|
1066
1078
|
}
|
|
1067
|
-
tokens.push({stem: stem, options: options});
|
|
1079
|
+
tokens.push({ stem: stem, options: options });
|
|
1068
1080
|
}
|
|
1069
1081
|
return tokens;
|
|
1070
1082
|
}
|
|
@@ -1072,11 +1084,16 @@ var ReactIntl = (function() {
|
|
|
1072
1084
|
return unit.replace(/^(.*?)-/, "");
|
|
1073
1085
|
}
|
|
1074
1086
|
var FRACTION_PRECISION_REGEX = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g;
|
|
1075
|
-
var SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?$/g;
|
|
1087
|
+
var SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?[rs]?$/g;
|
|
1076
1088
|
var INTEGER_WIDTH_REGEX = /(\*)(0+)|(#+)(0+)|(0+)/g;
|
|
1077
1089
|
var CONCISE_INTEGER_WIDTH_REGEX = /^(0+)$/;
|
|
1078
1090
|
function parseSignificantPrecision(str) {
|
|
1079
1091
|
var result = {};
|
|
1092
|
+
if (str[str.length - 1] === "r") {
|
|
1093
|
+
result.roundingPriority = "morePrecision";
|
|
1094
|
+
} else if (str[str.length - 1] === "s") {
|
|
1095
|
+
result.roundingPriority = "lessPrecision";
|
|
1096
|
+
}
|
|
1080
1097
|
str.replace(SIGNIFICANT_PRECISION_REGEX, function(_, g1, g2) {
|
|
1081
1098
|
if (typeof g2 !== "string") {
|
|
1082
1099
|
result.minimumSignificantDigits = g1.length;
|
|
@@ -1211,13 +1228,13 @@ var ReactIntl = (function() {
|
|
|
1211
1228
|
result.compactDisplay = "long";
|
|
1212
1229
|
continue;
|
|
1213
1230
|
case "scientific":
|
|
1214
|
-
result = __assign(__assign(__assign({}, result), {notation: "scientific"}), token.options.reduce(function(all,
|
|
1215
|
-
return __assign(__assign({}, all), parseNotationOptions(
|
|
1231
|
+
result = __assign(__assign(__assign({}, result), { notation: "scientific" }), token.options.reduce(function(all, opt2) {
|
|
1232
|
+
return __assign(__assign({}, all), parseNotationOptions(opt2));
|
|
1216
1233
|
}, {}));
|
|
1217
1234
|
continue;
|
|
1218
1235
|
case "engineering":
|
|
1219
|
-
result = __assign(__assign(__assign({}, result), {notation: "engineering"}), token.options.reduce(function(all,
|
|
1220
|
-
return __assign(__assign({}, all), parseNotationOptions(
|
|
1236
|
+
result = __assign(__assign(__assign({}, result), { notation: "engineering" }), token.options.reduce(function(all, opt2) {
|
|
1237
|
+
return __assign(__assign({}, all), parseNotationOptions(opt2));
|
|
1221
1238
|
}, {}));
|
|
1222
1239
|
continue;
|
|
1223
1240
|
case "notation-simple":
|
|
@@ -1279,8 +1296,11 @@ var ReactIntl = (function() {
|
|
|
1279
1296
|
}
|
|
1280
1297
|
return "";
|
|
1281
1298
|
});
|
|
1282
|
-
|
|
1283
|
-
|
|
1299
|
+
var opt = token.options[0];
|
|
1300
|
+
if (opt === "w") {
|
|
1301
|
+
result = __assign(__assign({}, result), { trailingZeroDisplay: "stripIfInteger" });
|
|
1302
|
+
} else if (opt) {
|
|
1303
|
+
result = __assign(__assign({}, result), parseSignificantPrecision(opt));
|
|
1284
1304
|
}
|
|
1285
1305
|
continue;
|
|
1286
1306
|
}
|
|
@@ -1305,7 +1325,7 @@ var ReactIntl = (function() {
|
|
|
1305
1325
|
var SPACE_SEPARATOR_START_REGEX = new RegExp("^" + SPACE_SEPARATOR_REGEX.source + "*");
|
|
1306
1326
|
var SPACE_SEPARATOR_END_REGEX = new RegExp(SPACE_SEPARATOR_REGEX.source + "*$");
|
|
1307
1327
|
function createLocation(start, end) {
|
|
1308
|
-
return {start: start, end: end};
|
|
1328
|
+
return { start: start, end: end };
|
|
1309
1329
|
}
|
|
1310
1330
|
var hasNativeStartsWith = !!String.prototype.startsWith;
|
|
1311
1331
|
var hasNativeFromCodePoint = !!String.fromCodePoint;
|
|
@@ -1409,7 +1429,7 @@ var ReactIntl = (function() {
|
|
|
1409
1429
|
options = {};
|
|
1410
1430
|
}
|
|
1411
1431
|
this.message = message;
|
|
1412
|
-
this.position = {offset: 0, line: 1, column: 1};
|
|
1432
|
+
this.position = { offset: 0, line: 1, column: 1 };
|
|
1413
1433
|
this.ignoreTag = !!options.ignoreTag;
|
|
1414
1434
|
this.requiresOtherClause = !!options.requiresOtherClause;
|
|
1415
1435
|
this.shouldParseSkeletons = !!options.shouldParseSkeletons;
|
|
@@ -1459,7 +1479,7 @@ var ReactIntl = (function() {
|
|
|
1459
1479
|
elements.push(result.val);
|
|
1460
1480
|
}
|
|
1461
1481
|
}
|
|
1462
|
-
return {val: elements, err: null};
|
|
1482
|
+
return { val: elements, err: null };
|
|
1463
1483
|
};
|
|
1464
1484
|
Parser2.prototype.parseTag = function(nestingLevel, parentArgType) {
|
|
1465
1485
|
var startPosition = this.clonePosition();
|
|
@@ -1542,7 +1562,7 @@ var ReactIntl = (function() {
|
|
|
1542
1562
|
}
|
|
1543
1563
|
var location = createLocation(start, this.clonePosition());
|
|
1544
1564
|
return {
|
|
1545
|
-
val: {type: TYPE.literal, value: value, location: location},
|
|
1565
|
+
val: { type: TYPE.literal, value: value, location: location },
|
|
1546
1566
|
err: null
|
|
1547
1567
|
};
|
|
1548
1568
|
};
|
|
@@ -1658,7 +1678,7 @@ var ReactIntl = (function() {
|
|
|
1658
1678
|
this.bumpTo(endOffset);
|
|
1659
1679
|
var endPosition = this.clonePosition();
|
|
1660
1680
|
var location = createLocation(startingPosition, endPosition);
|
|
1661
|
-
return {value: value, location: location};
|
|
1681
|
+
return { value: value, location: location };
|
|
1662
1682
|
};
|
|
1663
1683
|
Parser2.prototype.parseArgumentOptions = function(nestingLevel, expectingCloseTag, value, openingBracePosition) {
|
|
1664
1684
|
var _a2;
|
|
@@ -1685,7 +1705,7 @@ var ReactIntl = (function() {
|
|
|
1685
1705
|
return this.error(ErrorKind.EXPECT_ARGUMENT_STYLE, createLocation(this.clonePosition(), this.clonePosition()));
|
|
1686
1706
|
}
|
|
1687
1707
|
var styleLocation = createLocation(styleStartPosition, this.clonePosition());
|
|
1688
|
-
styleAndLocation = {style: style, styleLocation: styleLocation};
|
|
1708
|
+
styleAndLocation = { style: style, styleLocation: styleLocation };
|
|
1689
1709
|
}
|
|
1690
1710
|
var argCloseResult = this.tryParseArgumentClose(openingBracePosition);
|
|
1691
1711
|
if (argCloseResult.err) {
|
|
@@ -1700,7 +1720,7 @@ var ReactIntl = (function() {
|
|
|
1700
1720
|
return result;
|
|
1701
1721
|
}
|
|
1702
1722
|
return {
|
|
1703
|
-
val: {type: TYPE.number, value: value, location: location_1, style: result.val},
|
|
1723
|
+
val: { type: TYPE.number, value: value, location: location_1, style: result.val },
|
|
1704
1724
|
err: null
|
|
1705
1725
|
};
|
|
1706
1726
|
} else {
|
|
@@ -1715,7 +1735,7 @@ var ReactIntl = (function() {
|
|
|
1715
1735
|
};
|
|
1716
1736
|
var type = argType === "date" ? TYPE.date : TYPE.time;
|
|
1717
1737
|
return {
|
|
1718
|
-
val: {type: type, value: value, location: location_1, style: style},
|
|
1738
|
+
val: { type: type, value: value, location: location_1, style: style },
|
|
1719
1739
|
err: null
|
|
1720
1740
|
};
|
|
1721
1741
|
}
|
|
@@ -1796,7 +1816,7 @@ var ReactIntl = (function() {
|
|
|
1796
1816
|
return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
|
|
1797
1817
|
}
|
|
1798
1818
|
this.bump();
|
|
1799
|
-
return {val: true, err: null};
|
|
1819
|
+
return { val: true, err: null };
|
|
1800
1820
|
};
|
|
1801
1821
|
Parser2.prototype.parseSimpleArgStyleIfPossible = function() {
|
|
1802
1822
|
var nestedBraces = 0;
|
|
@@ -1912,7 +1932,7 @@ var ReactIntl = (function() {
|
|
|
1912
1932
|
if (this.requiresOtherClause && !hasOtherClause) {
|
|
1913
1933
|
return this.error(ErrorKind.MISSING_OTHER_CLAUSE, createLocation(this.clonePosition(), this.clonePosition()));
|
|
1914
1934
|
}
|
|
1915
|
-
return {val: options, err: null};
|
|
1935
|
+
return { val: options, err: null };
|
|
1916
1936
|
};
|
|
1917
1937
|
Parser2.prototype.tryParseDecimalInteger = function(expectNumberError, invalidNumberError) {
|
|
1918
1938
|
var sign = 1;
|
|
@@ -1941,7 +1961,7 @@ var ReactIntl = (function() {
|
|
|
1941
1961
|
if (!isSafeInteger(decimal)) {
|
|
1942
1962
|
return this.error(invalidNumberError, location);
|
|
1943
1963
|
}
|
|
1944
|
-
return {val: decimal, err: null};
|
|
1964
|
+
return { val: decimal, err: null };
|
|
1945
1965
|
};
|
|
1946
1966
|
Parser2.prototype.offset = function() {
|
|
1947
1967
|
return this.position.offset;
|
|
@@ -2084,7 +2104,7 @@ var ReactIntl = (function() {
|
|
|
2084
2104
|
if (opts === void 0) {
|
|
2085
2105
|
opts = {};
|
|
2086
2106
|
}
|
|
2087
|
-
opts = __assign({shouldParseSkeletons: true, requiresOtherClause: true}, opts);
|
|
2107
|
+
opts = __assign({ shouldParseSkeletons: true, requiresOtherClause: true }, opts);
|
|
2088
2108
|
var result = new Parser(message, opts).parse();
|
|
2089
2109
|
if (result.err) {
|
|
2090
2110
|
var error = SyntaxError(ErrorKind[result.err.kind]);
|
|
@@ -2259,7 +2279,7 @@ var ReactIntl = (function() {
|
|
|
2259
2279
|
continue;
|
|
2260
2280
|
}
|
|
2261
2281
|
var varName = el.value;
|
|
2262
|
-
if (!(values && varName
|
|
2282
|
+
if (!(values && values[varName] != null)) {
|
|
2263
2283
|
throw new MissingValueError(varName, originalMessage);
|
|
2264
2284
|
}
|
|
2265
2285
|
var value = values[varName];
|
|
@@ -2334,7 +2354,7 @@ var ReactIntl = (function() {
|
|
|
2334
2354
|
if (!Intl.PluralRules) {
|
|
2335
2355
|
throw new FormatError('Intl.PluralRules is not available in this environment.\nTry polyfilling it using "@formatjs/intl-pluralrules"\n', ErrorCode.MISSING_INTL_API, originalMessage);
|
|
2336
2356
|
}
|
|
2337
|
-
var rule = formatters.getPluralRules(locales, {type: el.pluralType}).select(value - (el.offset || 0));
|
|
2357
|
+
var rule = formatters.getPluralRules(locales, { type: el.pluralType }).select(value - (el.offset || 0));
|
|
2338
2358
|
opt = el.options[rule] || el.options.other;
|
|
2339
2359
|
}
|
|
2340
2360
|
if (!opt) {
|
|
@@ -2395,7 +2415,7 @@ var ReactIntl = (function() {
|
|
|
2395
2415
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2396
2416
|
args[_i] = arguments[_i];
|
|
2397
2417
|
}
|
|
2398
|
-
return new ((_a2 = Intl.NumberFormat).bind.apply(_a2, __spreadArray([void 0], args)))();
|
|
2418
|
+
return new ((_a2 = Intl.NumberFormat).bind.apply(_a2, __spreadArray([void 0], args, false)))();
|
|
2399
2419
|
}, {
|
|
2400
2420
|
cache: createFastMemoizeCache(cache.number),
|
|
2401
2421
|
strategy: strategies.variadic
|
|
@@ -2406,7 +2426,7 @@ var ReactIntl = (function() {
|
|
|
2406
2426
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2407
2427
|
args[_i] = arguments[_i];
|
|
2408
2428
|
}
|
|
2409
|
-
return new ((_a2 = Intl.DateTimeFormat).bind.apply(_a2, __spreadArray([void 0], args)))();
|
|
2429
|
+
return new ((_a2 = Intl.DateTimeFormat).bind.apply(_a2, __spreadArray([void 0], args, false)))();
|
|
2410
2430
|
}, {
|
|
2411
2431
|
cache: createFastMemoizeCache(cache.dateTime),
|
|
2412
2432
|
strategy: strategies.variadic
|
|
@@ -2417,7 +2437,7 @@ var ReactIntl = (function() {
|
|
|
2417
2437
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2418
2438
|
args[_i] = arguments[_i];
|
|
2419
2439
|
}
|
|
2420
|
-
return new ((_a2 = Intl.PluralRules).bind.apply(_a2, __spreadArray([void 0], args)))();
|
|
2440
|
+
return new ((_a2 = Intl.PluralRules).bind.apply(_a2, __spreadArray([void 0], args, false)))();
|
|
2421
2441
|
}, {
|
|
2422
2442
|
cache: createFastMemoizeCache(cache.pluralRules),
|
|
2423
2443
|
strategy: strategies.variadic
|
|
@@ -2568,7 +2588,9 @@ var ReactIntl = (function() {
|
|
|
2568
2588
|
var IntlError = function(_super) {
|
|
2569
2589
|
__extends(IntlError2, _super);
|
|
2570
2590
|
function IntlError2(code, message, exception) {
|
|
2571
|
-
var _this =
|
|
2591
|
+
var _this = this;
|
|
2592
|
+
var err = exception ? exception instanceof Error ? exception : new Error(String(exception)) : void 0;
|
|
2593
|
+
_this = _super.call(this, "[@formatjs/intl Error " + code + "] " + message + " \n" + (err ? "\n" + err.message + "\n" + err.stack : "")) || this;
|
|
2572
2594
|
_this.code = code;
|
|
2573
2595
|
if (typeof Error.captureStackTrace === "function") {
|
|
2574
2596
|
Error.captureStackTrace(_this, IntlError2);
|
|
@@ -2598,15 +2620,22 @@ var ReactIntl = (function() {
|
|
|
2598
2620
|
}
|
|
2599
2621
|
return MissingDataError2;
|
|
2600
2622
|
}(IntlError);
|
|
2623
|
+
var IntlFormatError = function(_super) {
|
|
2624
|
+
__extends(IntlFormatError2, _super);
|
|
2625
|
+
function IntlFormatError2(message, locale, exception) {
|
|
2626
|
+
return _super.call(this, IntlErrorCode.FORMAT_ERROR, message + " \nLocale: " + locale + "\n", exception) || this;
|
|
2627
|
+
}
|
|
2628
|
+
return IntlFormatError2;
|
|
2629
|
+
}(IntlError);
|
|
2601
2630
|
var MessageFormatError = function(_super) {
|
|
2602
2631
|
__extends(MessageFormatError2, _super);
|
|
2603
2632
|
function MessageFormatError2(message, locale, descriptor, exception) {
|
|
2604
|
-
var _this = _super.call(this,
|
|
2633
|
+
var _this = _super.call(this, message + " \nMessageID: " + (descriptor === null || descriptor === void 0 ? void 0 : descriptor.id) + "\nDefault Message: " + (descriptor === null || descriptor === void 0 ? void 0 : descriptor.defaultMessage) + "\nDescription: " + (descriptor === null || descriptor === void 0 ? void 0 : descriptor.description) + " \n", locale, exception) || this;
|
|
2605
2634
|
_this.descriptor = descriptor;
|
|
2606
2635
|
return _this;
|
|
2607
2636
|
}
|
|
2608
2637
|
return MessageFormatError2;
|
|
2609
|
-
}(
|
|
2638
|
+
}(IntlFormatError);
|
|
2610
2639
|
var MissingTranslationError = function(_super) {
|
|
2611
2640
|
__extends(MissingTranslationError2, _super);
|
|
2612
2641
|
function MissingTranslationError2(descriptor, locale) {
|
|
@@ -2642,6 +2671,7 @@ var ReactIntl = (function() {
|
|
|
2642
2671
|
timeZone: void 0,
|
|
2643
2672
|
defaultLocale: "en",
|
|
2644
2673
|
defaultFormats: {},
|
|
2674
|
+
fallbackOnEmptyString: true,
|
|
2645
2675
|
onError: defaultErrorHandler
|
|
2646
2676
|
};
|
|
2647
2677
|
function createIntlCache() {
|
|
@@ -2682,7 +2712,7 @@ var ReactIntl = (function() {
|
|
|
2682
2712
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2683
2713
|
args[_i] = arguments[_i];
|
|
2684
2714
|
}
|
|
2685
|
-
return new ((_a2 = Intl.DateTimeFormat).bind.apply(_a2, __spreadArray([void 0], args)))();
|
|
2715
|
+
return new ((_a2 = Intl.DateTimeFormat).bind.apply(_a2, __spreadArray([void 0], args, false)))();
|
|
2686
2716
|
}, {
|
|
2687
2717
|
cache: createFastMemoizeCache2(cache.dateTime),
|
|
2688
2718
|
strategy: strategies.variadic
|
|
@@ -2693,7 +2723,7 @@ var ReactIntl = (function() {
|
|
|
2693
2723
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2694
2724
|
args[_i] = arguments[_i];
|
|
2695
2725
|
}
|
|
2696
|
-
return new ((_a2 = Intl.NumberFormat).bind.apply(_a2, __spreadArray([void 0], args)))();
|
|
2726
|
+
return new ((_a2 = Intl.NumberFormat).bind.apply(_a2, __spreadArray([void 0], args, false)))();
|
|
2697
2727
|
}, {
|
|
2698
2728
|
cache: createFastMemoizeCache2(cache.number),
|
|
2699
2729
|
strategy: strategies.variadic
|
|
@@ -2704,7 +2734,7 @@ var ReactIntl = (function() {
|
|
|
2704
2734
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2705
2735
|
args[_i] = arguments[_i];
|
|
2706
2736
|
}
|
|
2707
|
-
return new ((_a2 = Intl.PluralRules).bind.apply(_a2, __spreadArray([void 0], args)))();
|
|
2737
|
+
return new ((_a2 = Intl.PluralRules).bind.apply(_a2, __spreadArray([void 0], args, false)))();
|
|
2708
2738
|
}, {
|
|
2709
2739
|
cache: createFastMemoizeCache2(cache.pluralRules),
|
|
2710
2740
|
strategy: strategies.variadic
|
|
@@ -2713,11 +2743,11 @@ var ReactIntl = (function() {
|
|
|
2713
2743
|
getDateTimeFormat: getDateTimeFormat,
|
|
2714
2744
|
getNumberFormat: getNumberFormat,
|
|
2715
2745
|
getMessageFormat: memoize(function(message, locales, overrideFormats, opts) {
|
|
2716
|
-
return new IntlMessageFormat(message, locales, overrideFormats, __assign({formatters: {
|
|
2746
|
+
return new IntlMessageFormat(message, locales, overrideFormats, __assign({ formatters: {
|
|
2717
2747
|
getNumberFormat: getNumberFormat,
|
|
2718
2748
|
getDateTimeFormat: getDateTimeFormat,
|
|
2719
2749
|
getPluralRules: getPluralRules
|
|
2720
|
-
}}, opts || {}));
|
|
2750
|
+
} }, opts || {}));
|
|
2721
2751
|
}, {
|
|
2722
2752
|
cache: createFastMemoizeCache2(cache.message),
|
|
2723
2753
|
strategy: strategies.variadic
|
|
@@ -2727,7 +2757,7 @@ var ReactIntl = (function() {
|
|
|
2727
2757
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2728
2758
|
args[_i] = arguments[_i];
|
|
2729
2759
|
}
|
|
2730
|
-
return new (RelativeTimeFormat.bind.apply(RelativeTimeFormat, __spreadArray([void 0], args)))();
|
|
2760
|
+
return new (RelativeTimeFormat.bind.apply(RelativeTimeFormat, __spreadArray([void 0], args, false)))();
|
|
2731
2761
|
}, {
|
|
2732
2762
|
cache: createFastMemoizeCache2(cache.relativeTime),
|
|
2733
2763
|
strategy: strategies.variadic
|
|
@@ -2738,7 +2768,7 @@ var ReactIntl = (function() {
|
|
|
2738
2768
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2739
2769
|
args[_i] = arguments[_i];
|
|
2740
2770
|
}
|
|
2741
|
-
return new (ListFormat.bind.apply(ListFormat, __spreadArray([void 0], args)))();
|
|
2771
|
+
return new (ListFormat.bind.apply(ListFormat, __spreadArray([void 0], args, false)))();
|
|
2742
2772
|
}, {
|
|
2743
2773
|
cache: createFastMemoizeCache2(cache.list),
|
|
2744
2774
|
strategy: strategies.variadic
|
|
@@ -2748,7 +2778,7 @@ var ReactIntl = (function() {
|
|
|
2748
2778
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2749
2779
|
args[_i] = arguments[_i];
|
|
2750
2780
|
}
|
|
2751
|
-
return new (DisplayNames.bind.apply(DisplayNames, __spreadArray([void 0], args)))();
|
|
2781
|
+
return new (DisplayNames.bind.apply(DisplayNames, __spreadArray([void 0], args, false)))();
|
|
2752
2782
|
}, {
|
|
2753
2783
|
cache: createFastMemoizeCache2(cache.displayNames),
|
|
2754
2784
|
strategy: strategies.variadic
|
|
@@ -2770,7 +2800,7 @@ var ReactIntl = (function() {
|
|
|
2770
2800
|
// bazel-out/darwin-fastbuild/bin/packages/intl/lib/src/message.js
|
|
2771
2801
|
function setTimeZoneInOptions(opts, timeZone) {
|
|
2772
2802
|
return Object.keys(opts).reduce(function(all, k) {
|
|
2773
|
-
all[k] = __assign({timeZone: timeZone}, opts[k]);
|
|
2803
|
+
all[k] = __assign({ timeZone: timeZone }, opts[k]);
|
|
2774
2804
|
return all;
|
|
2775
2805
|
}, {});
|
|
2776
2806
|
}
|
|
@@ -2786,12 +2816,12 @@ var ReactIntl = (function() {
|
|
|
2786
2816
|
return f1;
|
|
2787
2817
|
}
|
|
2788
2818
|
var mfFormats = IntlMessageFormat.formats;
|
|
2789
|
-
return __assign(__assign(__assign({}, mfFormats), f1), {date: deepMergeOptions(setTimeZoneInOptions(mfFormats.date, timeZone), setTimeZoneInOptions(f1.date || {}, timeZone)), time: deepMergeOptions(setTimeZoneInOptions(mfFormats.time, timeZone), setTimeZoneInOptions(f1.time || {}, timeZone))});
|
|
2819
|
+
return __assign(__assign(__assign({}, mfFormats), f1), { date: deepMergeOptions(setTimeZoneInOptions(mfFormats.date, timeZone), setTimeZoneInOptions(f1.date || {}, timeZone)), time: deepMergeOptions(setTimeZoneInOptions(mfFormats.time, timeZone), setTimeZoneInOptions(f1.time || {}, timeZone)) });
|
|
2790
2820
|
}
|
|
2791
2821
|
function formatMessage(_a2, state, messageDescriptor, values, opts) {
|
|
2792
|
-
var locale = _a2.locale, formats = _a2.formats, messages = _a2.messages, defaultLocale = _a2.defaultLocale, defaultFormats = _a2.defaultFormats, onError = _a2.onError, timeZone = _a2.timeZone, defaultRichTextElements = _a2.defaultRichTextElements;
|
|
2822
|
+
var locale = _a2.locale, formats = _a2.formats, messages = _a2.messages, defaultLocale = _a2.defaultLocale, defaultFormats = _a2.defaultFormats, fallbackOnEmptyString = _a2.fallbackOnEmptyString, onError = _a2.onError, timeZone = _a2.timeZone, defaultRichTextElements = _a2.defaultRichTextElements;
|
|
2793
2823
|
if (messageDescriptor === void 0) {
|
|
2794
|
-
messageDescriptor = {id: ""};
|
|
2824
|
+
messageDescriptor = { id: "" };
|
|
2795
2825
|
}
|
|
2796
2826
|
var msgId = messageDescriptor.id, defaultMessage = messageDescriptor.defaultMessage;
|
|
2797
2827
|
invariant(!!msgId, "[@formatjs/intl] An `id` must be provided to format a message. You can either:\n1. Configure your build toolchain with [babel-plugin-formatjs](https://formatjs.io/docs/tooling/babel-plugin)\nor [@formatjs/ts-transformer](https://formatjs.io/docs/tooling/ts-transformer) OR\n2. Configure your `eslint` config to include [eslint-plugin-formatjs](https://formatjs.io/docs/tooling/linter#enforce-id)\nto autofix this issue");
|
|
@@ -2807,6 +2837,9 @@ var ReactIntl = (function() {
|
|
|
2807
2837
|
formats = deepMergeFormatsAndSetTimeZone(formats, timeZone);
|
|
2808
2838
|
defaultFormats = deepMergeFormatsAndSetTimeZone(defaultFormats, timeZone);
|
|
2809
2839
|
if (!message) {
|
|
2840
|
+
if (fallbackOnEmptyString === false && message === "") {
|
|
2841
|
+
return message;
|
|
2842
|
+
}
|
|
2810
2843
|
if (!defaultMessage || locale && locale.toLowerCase() !== defaultLocale.toLowerCase()) {
|
|
2811
2844
|
onError(new MissingTranslationError(messageDescriptor, locale));
|
|
2812
2845
|
}
|
|
@@ -2822,7 +2855,7 @@ var ReactIntl = (function() {
|
|
|
2822
2855
|
return id;
|
|
2823
2856
|
}
|
|
2824
2857
|
try {
|
|
2825
|
-
var formatter = state.getMessageFormat(message, locale, formats, __assign({formatters: state}, opts || {}));
|
|
2858
|
+
var formatter = state.getMessageFormat(message, locale, formats, __assign({ formatters: state }, opts || {}));
|
|
2826
2859
|
return formatter.format(values);
|
|
2827
2860
|
} catch (e) {
|
|
2828
2861
|
onError(new MessageFormatError('Error formatting message: "' + id + '", using ' + (defaultMessage ? "default message" : "id") + " as fallback.", locale, messageDescriptor, e));
|
|
@@ -2871,10 +2904,10 @@ var ReactIntl = (function() {
|
|
|
2871
2904
|
options = {};
|
|
2872
2905
|
}
|
|
2873
2906
|
var format = options.format;
|
|
2874
|
-
var defaults = __assign(__assign({}, timeZone && {timeZone: timeZone}), format && getNamedFormat(formats, type, format, onError));
|
|
2907
|
+
var defaults = __assign(__assign({}, timeZone && { timeZone: timeZone }), format && getNamedFormat(formats, type, format, onError));
|
|
2875
2908
|
var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, defaults);
|
|
2876
2909
|
if (type === "time" && !filteredOptions.hour && !filteredOptions.minute && !filteredOptions.second && !filteredOptions.timeStyle && !filteredOptions.dateStyle) {
|
|
2877
|
-
filteredOptions = __assign(__assign({}, filteredOptions), {hour: "numeric", minute: "numeric"});
|
|
2910
|
+
filteredOptions = __assign(__assign({}, filteredOptions), { hour: "numeric", minute: "numeric" });
|
|
2878
2911
|
}
|
|
2879
2912
|
return getDateTimeFormat(locale, filteredOptions);
|
|
2880
2913
|
}
|
|
@@ -2913,7 +2946,7 @@ var ReactIntl = (function() {
|
|
|
2913
2946
|
}
|
|
2914
2947
|
var from = _a2[0], to = _a2[1], _b = _a2[2], options = _b === void 0 ? {} : _b;
|
|
2915
2948
|
var timeZone = config.timeZone, locale = config.locale, onError = config.onError;
|
|
2916
|
-
var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, timeZone ? {timeZone: timeZone} : {});
|
|
2949
|
+
var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, timeZone ? { timeZone: timeZone } : {});
|
|
2917
2950
|
try {
|
|
2918
2951
|
return getDateTimeFormat(locale, filteredOptions).formatRange(from, to);
|
|
2919
2952
|
} catch (e) {
|
|
@@ -3019,7 +3052,7 @@ var ReactIntl = (function() {
|
|
|
3019
3052
|
return String(v);
|
|
3020
3053
|
});
|
|
3021
3054
|
return getListFormat(locale, filteredOptions).formatToParts(serializedValues).map(function(part) {
|
|
3022
|
-
return part.type === "literal" ? part : __assign(__assign({}, part), {value: richValues_1[part.value] || part.value});
|
|
3055
|
+
return part.type === "literal" ? part : __assign(__assign({}, part), { value: richValues_1[part.value] || part.value });
|
|
3023
3056
|
});
|
|
3024
3057
|
} catch (e) {
|
|
3025
3058
|
onError(new IntlError(IntlErrorCode.FORMAT_ERROR, "Error formatting list.", e));
|
|
@@ -3044,7 +3077,7 @@ var ReactIntl = (function() {
|
|
|
3044
3077
|
try {
|
|
3045
3078
|
return getPluralRules(locale, filteredOptions).select(value);
|
|
3046
3079
|
} catch (e) {
|
|
3047
|
-
onError(new
|
|
3080
|
+
onError(new IntlFormatError("Error formatting plural.", locale, e));
|
|
3048
3081
|
}
|
|
3049
3082
|
return "other";
|
|
3050
3083
|
}
|
|
@@ -3075,7 +3108,7 @@ var ReactIntl = (function() {
|
|
|
3075
3108
|
try {
|
|
3076
3109
|
return getFormatter2(config, getRelativeTimeFormat, options).format(value, unit);
|
|
3077
3110
|
} catch (e) {
|
|
3078
|
-
config.onError(new
|
|
3111
|
+
config.onError(new IntlFormatError("Error formatting relative time.", config.locale, e));
|
|
3079
3112
|
}
|
|
3080
3113
|
return String(value);
|
|
3081
3114
|
}
|
|
@@ -3161,14 +3194,14 @@ var ReactIntl = (function() {
|
|
|
3161
3194
|
onError(new MissingDataError('Missing locale data for locale: "' + locale + '" in Intl.DateTimeFormat. Using default locale: "' + defaultLocale + '" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details'));
|
|
3162
3195
|
}
|
|
3163
3196
|
verifyConfigMessages(resolvedConfig);
|
|
3164
|
-
return __assign(__assign({}, resolvedConfig), {formatters: formatters, formatNumber: formatNumber.bind(null, resolvedConfig, formatters.getNumberFormat), formatNumberToParts: formatNumberToParts.bind(null, resolvedConfig, formatters.getNumberFormat), formatRelativeTime: formatRelativeTime.bind(null, resolvedConfig, formatters.getRelativeTimeFormat), formatDate: formatDate.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatDateToParts: formatDateToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatTime: formatTime.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatDateTimeRange: formatDateTimeRange.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatTimeToParts: formatTimeToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatPlural: formatPlural.bind(null, resolvedConfig, formatters.getPluralRules), formatMessage: formatMessage.bind(null, resolvedConfig, formatters), formatList: formatList.bind(null, resolvedConfig, formatters.getListFormat), formatListToParts: formatListToParts.bind(null, resolvedConfig, formatters.getListFormat), formatDisplayName: formatDisplayName.bind(null, resolvedConfig, formatters.getDisplayNames)});
|
|
3197
|
+
return __assign(__assign({}, resolvedConfig), { formatters: formatters, formatNumber: formatNumber.bind(null, resolvedConfig, formatters.getNumberFormat), formatNumberToParts: formatNumberToParts.bind(null, resolvedConfig, formatters.getNumberFormat), formatRelativeTime: formatRelativeTime.bind(null, resolvedConfig, formatters.getRelativeTimeFormat), formatDate: formatDate.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatDateToParts: formatDateToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatTime: formatTime.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatDateTimeRange: formatDateTimeRange.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatTimeToParts: formatTimeToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatPlural: formatPlural.bind(null, resolvedConfig, formatters.getPluralRules), formatMessage: formatMessage.bind(null, resolvedConfig, formatters), formatList: formatList.bind(null, resolvedConfig, formatters.getListFormat), formatListToParts: formatListToParts.bind(null, resolvedConfig, formatters.getListFormat), formatDisplayName: formatDisplayName.bind(null, resolvedConfig, formatters.getDisplayNames) });
|
|
3165
3198
|
}
|
|
3166
3199
|
|
|
3167
3200
|
// bazel-out/darwin-fastbuild/bin/packages/react-intl/lib/src/utils.js
|
|
3168
3201
|
function invariantIntlContext(intl) {
|
|
3169
3202
|
invariant(intl, "[React Intl] Could not find required `intl` object. <IntlProvider> needs to exist in the component ancestry.");
|
|
3170
3203
|
}
|
|
3171
|
-
var DEFAULT_INTL_CONFIG2 = __assign(__assign({}, DEFAULT_INTL_CONFIG), {textComponent: React.Fragment});
|
|
3204
|
+
var DEFAULT_INTL_CONFIG2 = __assign(__assign({}, DEFAULT_INTL_CONFIG), { textComponent: React.Fragment });
|
|
3172
3205
|
function assignUniqueKeysToParts(formatXMLElementFn) {
|
|
3173
3206
|
return function(parts) {
|
|
3174
3207
|
return formatXMLElementFn(React.Children.toArray(parts));
|
|
@@ -3214,14 +3247,14 @@ var ReactIntl = (function() {
|
|
|
3214
3247
|
invariantIntlContext(intl);
|
|
3215
3248
|
}
|
|
3216
3249
|
var intlProp = (_a3 = {}, _a3[intlPropName] = intl, _a3);
|
|
3217
|
-
return React2.createElement(WrappedComponent, __assign({}, props, intlProp, {ref: forwardRef2 ? props.forwardedRef : null}));
|
|
3250
|
+
return React2.createElement(WrappedComponent, __assign({}, props, intlProp, { ref: forwardRef2 ? props.forwardedRef : null }));
|
|
3218
3251
|
});
|
|
3219
3252
|
};
|
|
3220
3253
|
WithIntl.displayName = "injectIntl(" + getDisplayName(WrappedComponent) + ")";
|
|
3221
3254
|
WithIntl.WrappedComponent = WrappedComponent;
|
|
3222
3255
|
if (forwardRef2) {
|
|
3223
3256
|
return (0, import_hoist_non_react_statics.default)(React2.forwardRef(function(props, ref) {
|
|
3224
|
-
return React2.createElement(WithIntl, __assign({}, props, {forwardedRef: ref}));
|
|
3257
|
+
return React2.createElement(WithIntl, __assign({}, props, { forwardedRef: ref }));
|
|
3225
3258
|
}), WrappedComponent);
|
|
3226
3259
|
}
|
|
3227
3260
|
return (0, import_hoist_non_react_statics.default)(WithIntl, WrappedComponent);
|
|
@@ -3294,6 +3327,7 @@ var ReactIntl = (function() {
|
|
|
3294
3327
|
return {
|
|
3295
3328
|
locale: config.locale,
|
|
3296
3329
|
timeZone: config.timeZone,
|
|
3330
|
+
fallbackOnEmptyString: config.fallbackOnEmptyString,
|
|
3297
3331
|
formats: config.formats,
|
|
3298
3332
|
textComponent: config.textComponent,
|
|
3299
3333
|
messages: config.messages,
|
|
@@ -3325,7 +3359,7 @@ var ReactIntl = (function() {
|
|
|
3325
3359
|
formatters,
|
|
3326
3360
|
descriptor,
|
|
3327
3361
|
values
|
|
3328
|
-
], rest));
|
|
3362
|
+
], rest, false));
|
|
3329
3363
|
if (Array.isArray(chunks)) {
|
|
3330
3364
|
return React5.Children.toArray(chunks);
|
|
3331
3365
|
}
|
|
@@ -3334,8 +3368,8 @@ var ReactIntl = (function() {
|
|
|
3334
3368
|
var createIntl2 = function(_a2, cache) {
|
|
3335
3369
|
var rawDefaultRichTextElements = _a2.defaultRichTextElements, config = __rest(_a2, ["defaultRichTextElements"]);
|
|
3336
3370
|
var defaultRichTextElements = assignUniqueKeysToFormatXMLElementFnArgument(rawDefaultRichTextElements);
|
|
3337
|
-
var coreIntl = createIntl(__assign(__assign(__assign({}, DEFAULT_INTL_CONFIG2), config), {defaultRichTextElements: defaultRichTextElements}), cache);
|
|
3338
|
-
return __assign(__assign({}, coreIntl), {formatMessage: formatMessage2.bind(null, {
|
|
3371
|
+
var coreIntl = createIntl(__assign(__assign(__assign({}, DEFAULT_INTL_CONFIG2), config), { defaultRichTextElements: defaultRichTextElements }), cache);
|
|
3372
|
+
return __assign(__assign({}, coreIntl), { formatMessage: formatMessage2.bind(null, {
|
|
3339
3373
|
locale: coreIntl.locale,
|
|
3340
3374
|
timeZone: coreIntl.timeZone,
|
|
3341
3375
|
formats: coreIntl.formats,
|
|
@@ -3344,7 +3378,7 @@ var ReactIntl = (function() {
|
|
|
3344
3378
|
messages: coreIntl.messages,
|
|
3345
3379
|
onError: coreIntl.onError,
|
|
3346
3380
|
defaultRichTextElements: defaultRichTextElements
|
|
3347
|
-
}, coreIntl.formatters)});
|
|
3381
|
+
}, coreIntl.formatters) });
|
|
3348
3382
|
};
|
|
3349
3383
|
var IntlProvider2 = function(_super) {
|
|
3350
3384
|
__extends(IntlProvider3, _super);
|
|
@@ -3371,7 +3405,7 @@ var ReactIntl = (function() {
|
|
|
3371
3405
|
};
|
|
3372
3406
|
IntlProvider3.prototype.render = function() {
|
|
3373
3407
|
invariantIntlContext(this.state.intl);
|
|
3374
|
-
return React5.createElement(Provider, {value: this.state.intl}, this.props.children);
|
|
3408
|
+
return React5.createElement(Provider, { value: this.state.intl }, this.props.children);
|
|
3375
3409
|
};
|
|
3376
3410
|
IntlProvider3.displayName = "IntlProvider";
|
|
3377
3411
|
IntlProvider3.defaultProps = DEFAULT_INTL_CONFIG2;
|
|
@@ -3431,7 +3465,7 @@ var ReactIntl = (function() {
|
|
|
3431
3465
|
if (unit === void 0) {
|
|
3432
3466
|
unit = "second";
|
|
3433
3467
|
}
|
|
3434
|
-
return INCREMENTABLE_UNITS.
|
|
3468
|
+
return INCREMENTABLE_UNITS.indexOf(unit) > -1;
|
|
3435
3469
|
}
|
|
3436
3470
|
var SimpleFormattedRelativeTime = function(props) {
|
|
3437
3471
|
var _a2 = useIntl(), formatRelativeTime2 = _a2.formatRelativeTime, Text = _a2.textComponent;
|
|
@@ -3489,7 +3523,7 @@ var ReactIntl = (function() {
|
|
|
3489
3523
|
var unitDuration = getDurationInSeconds(currentUnit);
|
|
3490
3524
|
currentValue = Math.round(currentValueInSeconds / unitDuration);
|
|
3491
3525
|
}
|
|
3492
|
-
return React6.createElement(SimpleFormattedRelativeTime, __assign({value: currentValue, unit: currentUnit}, otherProps));
|
|
3526
|
+
return React6.createElement(SimpleFormattedRelativeTime, __assign({ value: currentValue, unit: currentUnit }, otherProps));
|
|
3493
3527
|
};
|
|
3494
3528
|
FormattedRelativeTime.displayName = "FormattedRelativeTime";
|
|
3495
3529
|
FormattedRelativeTime.defaultProps = {
|
|
@@ -3530,7 +3564,7 @@ var ReactIntl = (function() {
|
|
|
3530
3564
|
var intl = useIntl();
|
|
3531
3565
|
var formatMessage3 = intl.formatMessage, _a2 = intl.textComponent, Text = _a2 === void 0 ? React8.Fragment : _a2;
|
|
3532
3566
|
var id = props.id, description = props.description, defaultMessage = props.defaultMessage, values = props.values, children = props.children, _b = props.tagName, Component = _b === void 0 ? Text : _b, ignoreTag = props.ignoreTag;
|
|
3533
|
-
var descriptor = {id: id, description: description, defaultMessage: defaultMessage};
|
|
3567
|
+
var descriptor = { id: id, description: description, defaultMessage: defaultMessage };
|
|
3534
3568
|
var nodes = formatMessage3(descriptor, values, {
|
|
3535
3569
|
ignoreTag: ignoreTag
|
|
3536
3570
|
});
|