@formatjs/intl-getcanonicallocales 3.4.0 → 3.4.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.js +98 -24
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/polyfill-force.js +169 -30
- package/polyfill-force.js.map +1 -1
- package/polyfill.iife.js +169 -30
- package/polyfill.js +169 -30
- package/polyfill.js.map +1 -1
package/polyfill.iife.js
CHANGED
|
@@ -1,3 +1,84 @@
|
|
|
1
|
+
// packages/ecma262-abstract/IsObject.js
|
|
2
|
+
/** Includes browser host objects such as document.all. */
|
|
3
|
+
function IsObject(value) {
|
|
4
|
+
return value !== null && (typeof value === "object" || typeof value === "function" || typeof value === "undefined" && value !== void 0);
|
|
5
|
+
}
|
|
6
|
+
// packages/ecma262-abstract/intrinsics.js
|
|
7
|
+
const objectFrom = Object;
|
|
8
|
+
const mathMin = Math.min;
|
|
9
|
+
const mathMax = Math.max;
|
|
10
|
+
const mathTrunc = Math.trunc;
|
|
11
|
+
Number.isInteger;
|
|
12
|
+
Number.isFinite;
|
|
13
|
+
Number.isSafeInteger;
|
|
14
|
+
const TypeErrorConstructor$1 = TypeError;
|
|
15
|
+
const arrayApply = Reflect.apply;
|
|
16
|
+
const every = Array.prototype.every;
|
|
17
|
+
Array.prototype.some;
|
|
18
|
+
function arrayEvery(values, predicate) {
|
|
19
|
+
return arrayApply(every, values, [predicate]);
|
|
20
|
+
}
|
|
21
|
+
const includes = Array.prototype.includes;
|
|
22
|
+
const indexOf = Array.prototype.indexOf;
|
|
23
|
+
function arrayIncludes(values, search) {
|
|
24
|
+
return arrayApply(includes, values, [search]);
|
|
25
|
+
}
|
|
26
|
+
function arrayIndexOf(values, search) {
|
|
27
|
+
return arrayApply(indexOf, values, [search]);
|
|
28
|
+
}
|
|
29
|
+
// packages/intl-getcanonicallocales/locale-brand.ts
|
|
30
|
+
const apply$1 = Reflect.apply;
|
|
31
|
+
const defineProperty$2 = Object.defineProperty;
|
|
32
|
+
let readers;
|
|
33
|
+
function addLocaleBrandReader(read) {
|
|
34
|
+
if (typeof read !== "function") throw new TypeErrorConstructor$1("Locale brand reader must be callable");
|
|
35
|
+
for (let node = readers; node; node = node.next) if (node.read === read) return;
|
|
36
|
+
readers = {
|
|
37
|
+
read,
|
|
38
|
+
next: readers
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function getLocaleBrandReaders() {
|
|
42
|
+
const result = [];
|
|
43
|
+
for (let node = readers; node; node = node.next) defineProperty$2(result, result.length, {
|
|
44
|
+
value: node.read,
|
|
45
|
+
writable: true,
|
|
46
|
+
enumerable: true,
|
|
47
|
+
configurable: true
|
|
48
|
+
});
|
|
49
|
+
return result;
|
|
50
|
+
}
|
|
51
|
+
function localeString(value) {
|
|
52
|
+
if (!IsObject(value)) return void 0;
|
|
53
|
+
for (let node = readers; node; node = node.next) {
|
|
54
|
+
const tag = node.read(value);
|
|
55
|
+
if (typeof tag === "string") return tag;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const LocaleConstructor = typeof Intl === "undefined" ? void 0 : Intl.Locale;
|
|
59
|
+
const snapshot = LocaleConstructor?.__getLocaleBrandReaders;
|
|
60
|
+
if (typeof snapshot === "function") {
|
|
61
|
+
const known = apply$1(snapshot, LocaleConstructor, []);
|
|
62
|
+
for (let index = 0; index < known.length; index++) addLocaleBrandReader(known[index]);
|
|
63
|
+
} else {
|
|
64
|
+
const nativeToString = LocaleConstructor?.prototype.toString;
|
|
65
|
+
if (typeof nativeToString === "function") addLocaleBrandReader((value) => {
|
|
66
|
+
try {
|
|
67
|
+
const tag = apply$1(nativeToString, value, []);
|
|
68
|
+
return typeof tag === "string" ? tag : void 0;
|
|
69
|
+
} catch {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
// packages/ecma262-abstract/ToObject.js
|
|
75
|
+
/**
|
|
76
|
+
* https://tc39.es/ecma262/#sec-toobject
|
|
77
|
+
*/
|
|
78
|
+
function ToObject(arg) {
|
|
79
|
+
if (arg === void 0 || arg === null) throw new TypeErrorConstructor$1("undefined/null cannot be converted to object");
|
|
80
|
+
return objectFrom(arg);
|
|
81
|
+
}
|
|
1
82
|
// packages/intl-getcanonicallocales/appendToList.ts
|
|
2
83
|
function appendToList(list, ...values) {
|
|
3
84
|
for (const value of values) Object.defineProperty(list, list.length, {
|
|
@@ -8,12 +89,14 @@ function appendToList(list, ...values) {
|
|
|
8
89
|
});
|
|
9
90
|
}
|
|
10
91
|
// packages/ecma262-abstract/ToString.js
|
|
92
|
+
const StringConstructor = String;
|
|
93
|
+
const TypeErrorConstructor = TypeError;
|
|
11
94
|
/**
|
|
12
95
|
* https://tc39.es/ecma262/#sec-tostring
|
|
13
96
|
*/
|
|
14
97
|
function ToString(o) {
|
|
15
|
-
if (typeof o === "symbol") throw
|
|
16
|
-
return
|
|
98
|
+
if (typeof o === "symbol") throw TypeErrorConstructor("Cannot convert a Symbol value to a string");
|
|
99
|
+
return StringConstructor(o);
|
|
17
100
|
}
|
|
18
101
|
// node_modules/.aspect_rules_js/@formatjs_generated+cldr.core@0.0.0/node_modules/@formatjs_generated/cldr.core/aliases.js
|
|
19
102
|
const subdivisionAlias = {
|
|
@@ -9492,7 +9575,7 @@ function compareExtension(e1, e2) {
|
|
|
9492
9575
|
}
|
|
9493
9576
|
function mergeVariants(v1, v2) {
|
|
9494
9577
|
const result = [...v1];
|
|
9495
|
-
for (const v of v2) if (v1
|
|
9578
|
+
for (const v of v2) if (arrayIndexOf(v1, v) < 0) appendToList(result, v);
|
|
9496
9579
|
return result;
|
|
9497
9580
|
}
|
|
9498
9581
|
function compareLanguageAliasRules(a, b) {
|
|
@@ -9538,7 +9621,7 @@ function canonicalizeUnicodeLanguageId(unicodeLanguageId) {
|
|
|
9538
9621
|
unicodeLanguageId.variants = unicodeLanguageId.variants.map((v) => v.toLowerCase());
|
|
9539
9622
|
const original = emitUnicodeLanguageId(unicodeLanguageId);
|
|
9540
9623
|
let finalLangAst = unicodeLanguageId;
|
|
9541
|
-
const matches = ({ type }) => (!type.script || type.script === finalLangAst.script) && (!type.region || type.region === finalLangAst.region) && type.variants
|
|
9624
|
+
const matches = ({ type }) => (!type.script || type.script === finalLangAst.script) && (!type.region || type.region === finalLangAst.region) && arrayEvery(type.variants, (variant) => arrayIncludes(finalLangAst.variants, variant));
|
|
9542
9625
|
const languageRule = languageAliasRules[finalLangAst.lang]?.find(matches);
|
|
9543
9626
|
const undRule = finalLangAst.lang === "und" ? void 0 : languageAliasRules.und?.find(matches);
|
|
9544
9627
|
const matched = !languageRule ? undRule : !undRule ? languageRule : compareLanguageAliasRules(languageRule, undRule) <= 0 ? languageRule : undRule;
|
|
@@ -9548,7 +9631,7 @@ function canonicalizeUnicodeLanguageId(unicodeLanguageId) {
|
|
|
9548
9631
|
lang: type.lang !== "und" || finalLangAst.lang === "und" ? replacement.lang : finalLangAst.lang,
|
|
9549
9632
|
script: type.script ? replacement.script : finalLangAst.script || replacement.script,
|
|
9550
9633
|
region: type.region ? replacement.region : finalLangAst.region || replacement.region,
|
|
9551
|
-
variants: mergeVariants(finalLangAst.variants.filter((v) => !type.variants
|
|
9634
|
+
variants: mergeVariants(finalLangAst.variants.filter((v) => !arrayIncludes(type.variants, v)), replacement.variants)
|
|
9552
9635
|
};
|
|
9553
9636
|
return canonicalizeUnicodeLanguageId(finalLangAst);
|
|
9554
9637
|
}
|
|
@@ -9566,7 +9649,7 @@ function canonicalizeUnicodeLanguageId(unicodeLanguageId) {
|
|
|
9566
9649
|
})] || likelySubtags[finalLangAst.lang];
|
|
9567
9650
|
if (likelySubtag) {
|
|
9568
9651
|
const { region: likelyRegion } = parseUnicodeLanguageId(likelySubtag.split("-"));
|
|
9569
|
-
if (likelyRegion && regions
|
|
9652
|
+
if (likelyRegion && arrayIndexOf(regions, likelyRegion) > -1) replacedRegion = likelyRegion;
|
|
9570
9653
|
}
|
|
9571
9654
|
}
|
|
9572
9655
|
if (replacedRegion) finalLangAst.region = replacedRegion;
|
|
@@ -9615,15 +9698,6 @@ function CanonicalizeUnicodeLocaleId(locale) {
|
|
|
9615
9698
|
return locale;
|
|
9616
9699
|
}
|
|
9617
9700
|
// packages/intl-getcanonicallocales/index.ts
|
|
9618
|
-
const originalLocaleToString = typeof Intl !== "undefined" ? Intl.Locale?.prototype.toString : void 0;
|
|
9619
|
-
function localeString(value) {
|
|
9620
|
-
if (value === null || typeof value !== "object" && typeof value !== "function") return void 0;
|
|
9621
|
-
const currentLocaleToString = typeof Intl !== "undefined" ? Intl.Locale?.prototype.toString : void 0;
|
|
9622
|
-
for (const method of [originalLocaleToString, currentLocaleToString]) if (method) try {
|
|
9623
|
-
const tag = method.call(value);
|
|
9624
|
-
if (typeof tag === "string") return tag;
|
|
9625
|
-
} catch {}
|
|
9626
|
-
}
|
|
9627
9701
|
/**
|
|
9628
9702
|
* ECMA-402 §9.2.1 CanonicalizeLocaleList, steps 3–7.
|
|
9629
9703
|
* https://tc39.es/ecma402/#sec-canonicalizelocalelist
|
|
@@ -9631,28 +9705,28 @@ function localeString(value) {
|
|
|
9631
9705
|
*/
|
|
9632
9706
|
function CanonicalizeLocaleList(locales) {
|
|
9633
9707
|
if (locales === void 0) return [];
|
|
9634
|
-
if (locales === null) throw new
|
|
9708
|
+
if (locales === null) throw new TypeErrorConstructor$1("Cannot convert null to an object");
|
|
9635
9709
|
const singleLocale = localeString(locales);
|
|
9636
|
-
const list = typeof locales === "string" ? [locales] : singleLocale !== void 0 ? [singleLocale] :
|
|
9710
|
+
const list = typeof locales === "string" ? [locales] : singleLocale !== void 0 ? [singleLocale] : ToObject(locales);
|
|
9637
9711
|
const length = +list.length;
|
|
9638
|
-
const len =
|
|
9712
|
+
const len = length !== length ? 0 : mathMin(mathMax(mathTrunc(length), 0), 9007199254740991);
|
|
9639
9713
|
const seen = [];
|
|
9640
9714
|
for (let k = 0; k < len; k++) {
|
|
9641
9715
|
if (!(k in list)) continue;
|
|
9642
9716
|
const value = list[k];
|
|
9643
|
-
if (value
|
|
9644
|
-
"string",
|
|
9645
|
-
"object",
|
|
9646
|
-
"function"
|
|
9647
|
-
].includes(typeof value)) throw new TypeError("Locale list entries must be strings or objects");
|
|
9717
|
+
if (typeof value !== "string" && !IsObject(value)) throw new TypeErrorConstructor$1("Locale list entries must be strings or objects");
|
|
9648
9718
|
const canonicalizedTag = emitUnicodeLocaleId(CanonicalizeUnicodeLocaleId(parseUnicodeLocaleId(localeString(value) ?? ToString(value))));
|
|
9649
|
-
if (seen
|
|
9719
|
+
if (arrayIndexOf(seen, canonicalizedTag) < 0) appendToList(seen, canonicalizedTag);
|
|
9650
9720
|
}
|
|
9651
9721
|
return seen;
|
|
9652
9722
|
}
|
|
9653
9723
|
function getCanonicalLocales(locales) {
|
|
9654
9724
|
return CanonicalizeLocaleList(locales);
|
|
9655
9725
|
}
|
|
9726
|
+
Object.defineProperties(getCanonicalLocales, {
|
|
9727
|
+
__addLocaleBrandReader: { value: addLocaleBrandReader },
|
|
9728
|
+
__getLocaleBrandReaders: { value: getLocaleBrandReaders }
|
|
9729
|
+
});
|
|
9656
9730
|
// packages/intl-getcanonicallocales/should-polyfill.ts
|
|
9657
9731
|
function shouldPolyfill() {
|
|
9658
9732
|
if (typeof Intl === "undefined" || typeof Intl.getCanonicalLocales !== "function") return true;
|
|
@@ -9664,6 +9738,13 @@ function shouldPolyfill() {
|
|
|
9664
9738
|
}
|
|
9665
9739
|
}
|
|
9666
9740
|
// node_modules/.aspect_rules_js/@formatjs+fast-memoize@0.0.0/node_modules/@formatjs/fast-memoize/index.js
|
|
9741
|
+
const apply = Reflect.apply;
|
|
9742
|
+
const bind = Function.prototype.bind;
|
|
9743
|
+
const slice = Array.prototype.slice;
|
|
9744
|
+
const stringify = JSON.stringify;
|
|
9745
|
+
const create = Object.create;
|
|
9746
|
+
const defineProperty$1 = Object.defineProperty;
|
|
9747
|
+
const setPrototypeOf = Object.setPrototypeOf;
|
|
9667
9748
|
function memoize(fn, options) {
|
|
9668
9749
|
const cache = options && options.cache ? options.cache : cacheDefault;
|
|
9669
9750
|
const serializer = options && options.serializer ? options.serializer : serializerDefault;
|
|
@@ -9679,23 +9760,29 @@ function monadic(fn, cache, serializer, arg) {
|
|
|
9679
9760
|
const cacheKey = isPrimitive(arg) ? arg : serializer(arg);
|
|
9680
9761
|
let computedValue = cache.get(cacheKey);
|
|
9681
9762
|
if (typeof computedValue === "undefined") {
|
|
9682
|
-
computedValue = fn
|
|
9763
|
+
computedValue = apply(fn, this, [arg]);
|
|
9683
9764
|
cache.set(cacheKey, computedValue);
|
|
9684
9765
|
}
|
|
9685
9766
|
return computedValue;
|
|
9686
9767
|
}
|
|
9687
9768
|
function variadic(fn, cache, serializer) {
|
|
9688
|
-
const args =
|
|
9769
|
+
const args = apply(slice, arguments, [3]);
|
|
9770
|
+
if (serializer === serializerDefault) setPrototypeOf(args, null);
|
|
9689
9771
|
const cacheKey = serializer(args);
|
|
9690
9772
|
let computedValue = cache.get(cacheKey);
|
|
9691
9773
|
if (typeof computedValue === "undefined") {
|
|
9692
|
-
computedValue =
|
|
9774
|
+
computedValue = apply(fn, this, args);
|
|
9693
9775
|
cache.set(cacheKey, computedValue);
|
|
9694
9776
|
}
|
|
9695
9777
|
return computedValue;
|
|
9696
9778
|
}
|
|
9697
9779
|
function assemble(fn, context, strategy, cache, serialize) {
|
|
9698
|
-
return
|
|
9780
|
+
return apply(bind, strategy, [
|
|
9781
|
+
context,
|
|
9782
|
+
fn,
|
|
9783
|
+
cache,
|
|
9784
|
+
serialize
|
|
9785
|
+
]);
|
|
9699
9786
|
}
|
|
9700
9787
|
function strategyDefault(fn, options) {
|
|
9701
9788
|
const strategy = fn.length === 1 ? monadic : variadic;
|
|
@@ -9708,11 +9795,18 @@ function strategyMonadic(fn, options) {
|
|
|
9708
9795
|
return assemble(fn, this, monadic, options.cache.create(), options.serializer);
|
|
9709
9796
|
}
|
|
9710
9797
|
const serializerDefault = function() {
|
|
9711
|
-
|
|
9798
|
+
setPrototypeOf(arguments, null);
|
|
9799
|
+
return stringify(arguments);
|
|
9712
9800
|
};
|
|
9713
9801
|
var ObjectWithoutPrototypeCache = class {
|
|
9714
9802
|
constructor() {
|
|
9715
|
-
this
|
|
9803
|
+
defineProperty$1(this, "cache", {
|
|
9804
|
+
__proto__: null,
|
|
9805
|
+
value: create(null),
|
|
9806
|
+
writable: true,
|
|
9807
|
+
enumerable: true,
|
|
9808
|
+
configurable: true
|
|
9809
|
+
});
|
|
9716
9810
|
}
|
|
9717
9811
|
get(key) {
|
|
9718
9812
|
return this.cache[key];
|
|
@@ -9744,11 +9838,56 @@ function ensureIntl() {
|
|
|
9744
9838
|
writable: true,
|
|
9745
9839
|
value: {}
|
|
9746
9840
|
});
|
|
9841
|
+
if (providerIntl === void 0) providerIntl = Intl;
|
|
9747
9842
|
return Intl;
|
|
9748
9843
|
}
|
|
9749
9844
|
memoize((...args) => new Intl.NumberFormat(...args), { strategy: strategies.variadic });
|
|
9750
9845
|
memoize((...args) => new Intl.PluralRules(...args), { strategy: strategies.variadic });
|
|
9751
9846
|
memoize((...args) => new Intl.ListFormat(...args), { strategy: strategies.variadic });
|
|
9847
|
+
const getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
9848
|
+
strategies.variadic;
|
|
9849
|
+
let providerIntl = globalThis.Intl;
|
|
9850
|
+
function ownIntlProvider(name) {
|
|
9851
|
+
const descriptor = providerIntl && getOwnPropertyDescriptor(providerIntl, name);
|
|
9852
|
+
return (descriptor && getOwnPropertyDescriptor(descriptor, "value"))?.value;
|
|
9853
|
+
}
|
|
9854
|
+
let numberFormatProvider = ownIntlProvider("NumberFormat");
|
|
9855
|
+
let listFormatProvider = ownIntlProvider("ListFormat");
|
|
9856
|
+
const getFormatterPrototype = Object.getPrototypeOf;
|
|
9857
|
+
const formatterPartsMethods = /* @__PURE__ */ new WeakMap();
|
|
9858
|
+
const formatterPartsOwners = /* @__PURE__ */ new WeakMap();
|
|
9859
|
+
const getPartsMethod = formatterPartsMethods.get.bind(formatterPartsMethods);
|
|
9860
|
+
const setPartsMethod = formatterPartsMethods.set.bind(formatterPartsMethods);
|
|
9861
|
+
const getPartsOwner = formatterPartsOwners.get.bind(formatterPartsOwners);
|
|
9862
|
+
const setPartsOwner = formatterPartsOwners.set.bind(formatterPartsOwners);
|
|
9863
|
+
function findFormatterPartsMethod(Constructor) {
|
|
9864
|
+
const cached = getPartsMethod(Constructor);
|
|
9865
|
+
if (cached) return cached;
|
|
9866
|
+
let prototype = getOwnPropertyDescriptor(Constructor, "prototype")?.value;
|
|
9867
|
+
while (prototype != null) {
|
|
9868
|
+
const inherited = getPartsOwner(prototype);
|
|
9869
|
+
if (inherited) {
|
|
9870
|
+
setPartsMethod(Constructor, inherited);
|
|
9871
|
+
return inherited;
|
|
9872
|
+
}
|
|
9873
|
+
const descriptor = getOwnPropertyDescriptor(prototype, "formatToParts");
|
|
9874
|
+
const value = descriptor && getOwnPropertyDescriptor(descriptor, "value");
|
|
9875
|
+
if (value && typeof value.value === "function") {
|
|
9876
|
+
setPartsMethod(Constructor, value.value);
|
|
9877
|
+
setPartsOwner(prototype, value.value);
|
|
9878
|
+
return value.value;
|
|
9879
|
+
}
|
|
9880
|
+
prototype = getFormatterPrototype(prototype);
|
|
9881
|
+
}
|
|
9882
|
+
}
|
|
9883
|
+
if (typeof numberFormatProvider === "function") findFormatterPartsMethod(numberFormatProvider);
|
|
9884
|
+
if (typeof listFormatProvider === "function") findFormatterPartsMethod(listFormatProvider);
|
|
9885
|
+
const numberFormatMemoizers = /* @__PURE__ */ new WeakMap();
|
|
9886
|
+
numberFormatMemoizers.get.bind(numberFormatMemoizers);
|
|
9887
|
+
numberFormatMemoizers.set.bind(numberFormatMemoizers);
|
|
9888
|
+
const listFormatMemoizers = /* @__PURE__ */ new WeakMap();
|
|
9889
|
+
listFormatMemoizers.get.bind(listFormatMemoizers);
|
|
9890
|
+
listFormatMemoizers.set.bind(listFormatMemoizers);
|
|
9752
9891
|
// packages/intl-getcanonicallocales/polyfill.ts
|
|
9753
9892
|
const intl = ensureIntl();
|
|
9754
9893
|
if (shouldPolyfill()) defineProperty(intl, "getCanonicalLocales", { value: getCanonicalLocales });
|
package/polyfill.js
CHANGED
|
@@ -1,3 +1,84 @@
|
|
|
1
|
+
// packages/ecma262-abstract/IsObject.js
|
|
2
|
+
/** Includes browser host objects such as document.all. */
|
|
3
|
+
function IsObject(value) {
|
|
4
|
+
return value !== null && (typeof value === "object" || typeof value === "function" || typeof value === "undefined" && value !== void 0);
|
|
5
|
+
}
|
|
6
|
+
// packages/ecma262-abstract/intrinsics.js
|
|
7
|
+
const objectFrom = Object;
|
|
8
|
+
const mathMin = Math.min;
|
|
9
|
+
const mathMax = Math.max;
|
|
10
|
+
const mathTrunc = Math.trunc;
|
|
11
|
+
Number.isInteger;
|
|
12
|
+
Number.isFinite;
|
|
13
|
+
Number.isSafeInteger;
|
|
14
|
+
const TypeErrorConstructor$1 = TypeError;
|
|
15
|
+
const arrayApply = Reflect.apply;
|
|
16
|
+
const every = Array.prototype.every;
|
|
17
|
+
Array.prototype.some;
|
|
18
|
+
function arrayEvery(values, predicate) {
|
|
19
|
+
return arrayApply(every, values, [predicate]);
|
|
20
|
+
}
|
|
21
|
+
const includes = Array.prototype.includes;
|
|
22
|
+
const indexOf = Array.prototype.indexOf;
|
|
23
|
+
function arrayIncludes(values, search) {
|
|
24
|
+
return arrayApply(includes, values, [search]);
|
|
25
|
+
}
|
|
26
|
+
function arrayIndexOf(values, search) {
|
|
27
|
+
return arrayApply(indexOf, values, [search]);
|
|
28
|
+
}
|
|
29
|
+
// packages/intl-getcanonicallocales/locale-brand.ts
|
|
30
|
+
const apply$1 = Reflect.apply;
|
|
31
|
+
const defineProperty$2 = Object.defineProperty;
|
|
32
|
+
let readers;
|
|
33
|
+
function addLocaleBrandReader(read) {
|
|
34
|
+
if (typeof read !== "function") throw new TypeErrorConstructor$1("Locale brand reader must be callable");
|
|
35
|
+
for (let node = readers; node; node = node.next) if (node.read === read) return;
|
|
36
|
+
readers = {
|
|
37
|
+
read,
|
|
38
|
+
next: readers
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function getLocaleBrandReaders() {
|
|
42
|
+
const result = [];
|
|
43
|
+
for (let node = readers; node; node = node.next) defineProperty$2(result, result.length, {
|
|
44
|
+
value: node.read,
|
|
45
|
+
writable: true,
|
|
46
|
+
enumerable: true,
|
|
47
|
+
configurable: true
|
|
48
|
+
});
|
|
49
|
+
return result;
|
|
50
|
+
}
|
|
51
|
+
function localeString(value) {
|
|
52
|
+
if (!IsObject(value)) return void 0;
|
|
53
|
+
for (let node = readers; node; node = node.next) {
|
|
54
|
+
const tag = node.read(value);
|
|
55
|
+
if (typeof tag === "string") return tag;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const LocaleConstructor = typeof Intl === "undefined" ? void 0 : Intl.Locale;
|
|
59
|
+
const snapshot = LocaleConstructor?.__getLocaleBrandReaders;
|
|
60
|
+
if (typeof snapshot === "function") {
|
|
61
|
+
const known = apply$1(snapshot, LocaleConstructor, []);
|
|
62
|
+
for (let index = 0; index < known.length; index++) addLocaleBrandReader(known[index]);
|
|
63
|
+
} else {
|
|
64
|
+
const nativeToString = LocaleConstructor?.prototype.toString;
|
|
65
|
+
if (typeof nativeToString === "function") addLocaleBrandReader((value) => {
|
|
66
|
+
try {
|
|
67
|
+
const tag = apply$1(nativeToString, value, []);
|
|
68
|
+
return typeof tag === "string" ? tag : void 0;
|
|
69
|
+
} catch {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
// packages/ecma262-abstract/ToObject.js
|
|
75
|
+
/**
|
|
76
|
+
* https://tc39.es/ecma262/#sec-toobject
|
|
77
|
+
*/
|
|
78
|
+
function ToObject(arg) {
|
|
79
|
+
if (arg === void 0 || arg === null) throw new TypeErrorConstructor$1("undefined/null cannot be converted to object");
|
|
80
|
+
return objectFrom(arg);
|
|
81
|
+
}
|
|
1
82
|
// packages/intl-getcanonicallocales/appendToList.ts
|
|
2
83
|
function appendToList(list, ...values) {
|
|
3
84
|
for (const value of values) Object.defineProperty(list, list.length, {
|
|
@@ -8,12 +89,14 @@ function appendToList(list, ...values) {
|
|
|
8
89
|
});
|
|
9
90
|
}
|
|
10
91
|
// packages/ecma262-abstract/ToString.js
|
|
92
|
+
const StringConstructor = String;
|
|
93
|
+
const TypeErrorConstructor = TypeError;
|
|
11
94
|
/**
|
|
12
95
|
* https://tc39.es/ecma262/#sec-tostring
|
|
13
96
|
*/
|
|
14
97
|
function ToString(o) {
|
|
15
|
-
if (typeof o === "symbol") throw
|
|
16
|
-
return
|
|
98
|
+
if (typeof o === "symbol") throw TypeErrorConstructor("Cannot convert a Symbol value to a string");
|
|
99
|
+
return StringConstructor(o);
|
|
17
100
|
}
|
|
18
101
|
// node_modules/.aspect_rules_js/@formatjs_generated+cldr.core@0.0.0/node_modules/@formatjs_generated/cldr.core/aliases.js
|
|
19
102
|
const subdivisionAlias = {
|
|
@@ -9492,7 +9575,7 @@ function compareExtension(e1, e2) {
|
|
|
9492
9575
|
}
|
|
9493
9576
|
function mergeVariants(v1, v2) {
|
|
9494
9577
|
const result = [...v1];
|
|
9495
|
-
for (const v of v2) if (v1
|
|
9578
|
+
for (const v of v2) if (arrayIndexOf(v1, v) < 0) appendToList(result, v);
|
|
9496
9579
|
return result;
|
|
9497
9580
|
}
|
|
9498
9581
|
function compareLanguageAliasRules(a, b) {
|
|
@@ -9538,7 +9621,7 @@ function canonicalizeUnicodeLanguageId(unicodeLanguageId) {
|
|
|
9538
9621
|
unicodeLanguageId.variants = unicodeLanguageId.variants.map((v) => v.toLowerCase());
|
|
9539
9622
|
const original = emitUnicodeLanguageId(unicodeLanguageId);
|
|
9540
9623
|
let finalLangAst = unicodeLanguageId;
|
|
9541
|
-
const matches = ({ type }) => (!type.script || type.script === finalLangAst.script) && (!type.region || type.region === finalLangAst.region) && type.variants
|
|
9624
|
+
const matches = ({ type }) => (!type.script || type.script === finalLangAst.script) && (!type.region || type.region === finalLangAst.region) && arrayEvery(type.variants, (variant) => arrayIncludes(finalLangAst.variants, variant));
|
|
9542
9625
|
const languageRule = languageAliasRules[finalLangAst.lang]?.find(matches);
|
|
9543
9626
|
const undRule = finalLangAst.lang === "und" ? void 0 : languageAliasRules.und?.find(matches);
|
|
9544
9627
|
const matched = !languageRule ? undRule : !undRule ? languageRule : compareLanguageAliasRules(languageRule, undRule) <= 0 ? languageRule : undRule;
|
|
@@ -9548,7 +9631,7 @@ function canonicalizeUnicodeLanguageId(unicodeLanguageId) {
|
|
|
9548
9631
|
lang: type.lang !== "und" || finalLangAst.lang === "und" ? replacement.lang : finalLangAst.lang,
|
|
9549
9632
|
script: type.script ? replacement.script : finalLangAst.script || replacement.script,
|
|
9550
9633
|
region: type.region ? replacement.region : finalLangAst.region || replacement.region,
|
|
9551
|
-
variants: mergeVariants(finalLangAst.variants.filter((v) => !type.variants
|
|
9634
|
+
variants: mergeVariants(finalLangAst.variants.filter((v) => !arrayIncludes(type.variants, v)), replacement.variants)
|
|
9552
9635
|
};
|
|
9553
9636
|
return canonicalizeUnicodeLanguageId(finalLangAst);
|
|
9554
9637
|
}
|
|
@@ -9566,7 +9649,7 @@ function canonicalizeUnicodeLanguageId(unicodeLanguageId) {
|
|
|
9566
9649
|
})] || likelySubtags[finalLangAst.lang];
|
|
9567
9650
|
if (likelySubtag) {
|
|
9568
9651
|
const { region: likelyRegion } = parseUnicodeLanguageId(likelySubtag.split("-"));
|
|
9569
|
-
if (likelyRegion && regions
|
|
9652
|
+
if (likelyRegion && arrayIndexOf(regions, likelyRegion) > -1) replacedRegion = likelyRegion;
|
|
9570
9653
|
}
|
|
9571
9654
|
}
|
|
9572
9655
|
if (replacedRegion) finalLangAst.region = replacedRegion;
|
|
@@ -9615,15 +9698,6 @@ function CanonicalizeUnicodeLocaleId(locale) {
|
|
|
9615
9698
|
return locale;
|
|
9616
9699
|
}
|
|
9617
9700
|
// packages/intl-getcanonicallocales/index.ts
|
|
9618
|
-
const originalLocaleToString = typeof Intl !== "undefined" ? Intl.Locale?.prototype.toString : void 0;
|
|
9619
|
-
function localeString(value) {
|
|
9620
|
-
if (value === null || typeof value !== "object" && typeof value !== "function") return void 0;
|
|
9621
|
-
const currentLocaleToString = typeof Intl !== "undefined" ? Intl.Locale?.prototype.toString : void 0;
|
|
9622
|
-
for (const method of [originalLocaleToString, currentLocaleToString]) if (method) try {
|
|
9623
|
-
const tag = method.call(value);
|
|
9624
|
-
if (typeof tag === "string") return tag;
|
|
9625
|
-
} catch {}
|
|
9626
|
-
}
|
|
9627
9701
|
/**
|
|
9628
9702
|
* ECMA-402 §9.2.1 CanonicalizeLocaleList, steps 3–7.
|
|
9629
9703
|
* https://tc39.es/ecma402/#sec-canonicalizelocalelist
|
|
@@ -9631,28 +9705,28 @@ function localeString(value) {
|
|
|
9631
9705
|
*/
|
|
9632
9706
|
function CanonicalizeLocaleList(locales) {
|
|
9633
9707
|
if (locales === void 0) return [];
|
|
9634
|
-
if (locales === null) throw new
|
|
9708
|
+
if (locales === null) throw new TypeErrorConstructor$1("Cannot convert null to an object");
|
|
9635
9709
|
const singleLocale = localeString(locales);
|
|
9636
|
-
const list = typeof locales === "string" ? [locales] : singleLocale !== void 0 ? [singleLocale] :
|
|
9710
|
+
const list = typeof locales === "string" ? [locales] : singleLocale !== void 0 ? [singleLocale] : ToObject(locales);
|
|
9637
9711
|
const length = +list.length;
|
|
9638
|
-
const len =
|
|
9712
|
+
const len = length !== length ? 0 : mathMin(mathMax(mathTrunc(length), 0), 9007199254740991);
|
|
9639
9713
|
const seen = [];
|
|
9640
9714
|
for (let k = 0; k < len; k++) {
|
|
9641
9715
|
if (!(k in list)) continue;
|
|
9642
9716
|
const value = list[k];
|
|
9643
|
-
if (value
|
|
9644
|
-
"string",
|
|
9645
|
-
"object",
|
|
9646
|
-
"function"
|
|
9647
|
-
].includes(typeof value)) throw new TypeError("Locale list entries must be strings or objects");
|
|
9717
|
+
if (typeof value !== "string" && !IsObject(value)) throw new TypeErrorConstructor$1("Locale list entries must be strings or objects");
|
|
9648
9718
|
const canonicalizedTag = emitUnicodeLocaleId(CanonicalizeUnicodeLocaleId(parseUnicodeLocaleId(localeString(value) ?? ToString(value))));
|
|
9649
|
-
if (seen
|
|
9719
|
+
if (arrayIndexOf(seen, canonicalizedTag) < 0) appendToList(seen, canonicalizedTag);
|
|
9650
9720
|
}
|
|
9651
9721
|
return seen;
|
|
9652
9722
|
}
|
|
9653
9723
|
function getCanonicalLocales(locales) {
|
|
9654
9724
|
return CanonicalizeLocaleList(locales);
|
|
9655
9725
|
}
|
|
9726
|
+
Object.defineProperties(getCanonicalLocales, {
|
|
9727
|
+
__addLocaleBrandReader: { value: addLocaleBrandReader },
|
|
9728
|
+
__getLocaleBrandReaders: { value: getLocaleBrandReaders }
|
|
9729
|
+
});
|
|
9656
9730
|
// packages/intl-getcanonicallocales/should-polyfill.ts
|
|
9657
9731
|
function shouldPolyfill() {
|
|
9658
9732
|
if (typeof Intl === "undefined" || typeof Intl.getCanonicalLocales !== "function") return true;
|
|
@@ -9664,6 +9738,13 @@ function shouldPolyfill() {
|
|
|
9664
9738
|
}
|
|
9665
9739
|
}
|
|
9666
9740
|
// node_modules/.aspect_rules_js/@formatjs+fast-memoize@0.0.0/node_modules/@formatjs/fast-memoize/index.js
|
|
9741
|
+
const apply = Reflect.apply;
|
|
9742
|
+
const bind = Function.prototype.bind;
|
|
9743
|
+
const slice = Array.prototype.slice;
|
|
9744
|
+
const stringify = JSON.stringify;
|
|
9745
|
+
const create = Object.create;
|
|
9746
|
+
const defineProperty$1 = Object.defineProperty;
|
|
9747
|
+
const setPrototypeOf = Object.setPrototypeOf;
|
|
9667
9748
|
function memoize(fn, options) {
|
|
9668
9749
|
const cache = options && options.cache ? options.cache : cacheDefault;
|
|
9669
9750
|
const serializer = options && options.serializer ? options.serializer : serializerDefault;
|
|
@@ -9679,23 +9760,29 @@ function monadic(fn, cache, serializer, arg) {
|
|
|
9679
9760
|
const cacheKey = isPrimitive(arg) ? arg : serializer(arg);
|
|
9680
9761
|
let computedValue = cache.get(cacheKey);
|
|
9681
9762
|
if (typeof computedValue === "undefined") {
|
|
9682
|
-
computedValue = fn
|
|
9763
|
+
computedValue = apply(fn, this, [arg]);
|
|
9683
9764
|
cache.set(cacheKey, computedValue);
|
|
9684
9765
|
}
|
|
9685
9766
|
return computedValue;
|
|
9686
9767
|
}
|
|
9687
9768
|
function variadic(fn, cache, serializer) {
|
|
9688
|
-
const args =
|
|
9769
|
+
const args = apply(slice, arguments, [3]);
|
|
9770
|
+
if (serializer === serializerDefault) setPrototypeOf(args, null);
|
|
9689
9771
|
const cacheKey = serializer(args);
|
|
9690
9772
|
let computedValue = cache.get(cacheKey);
|
|
9691
9773
|
if (typeof computedValue === "undefined") {
|
|
9692
|
-
computedValue =
|
|
9774
|
+
computedValue = apply(fn, this, args);
|
|
9693
9775
|
cache.set(cacheKey, computedValue);
|
|
9694
9776
|
}
|
|
9695
9777
|
return computedValue;
|
|
9696
9778
|
}
|
|
9697
9779
|
function assemble(fn, context, strategy, cache, serialize) {
|
|
9698
|
-
return
|
|
9780
|
+
return apply(bind, strategy, [
|
|
9781
|
+
context,
|
|
9782
|
+
fn,
|
|
9783
|
+
cache,
|
|
9784
|
+
serialize
|
|
9785
|
+
]);
|
|
9699
9786
|
}
|
|
9700
9787
|
function strategyDefault(fn, options) {
|
|
9701
9788
|
const strategy = fn.length === 1 ? monadic : variadic;
|
|
@@ -9708,11 +9795,18 @@ function strategyMonadic(fn, options) {
|
|
|
9708
9795
|
return assemble(fn, this, monadic, options.cache.create(), options.serializer);
|
|
9709
9796
|
}
|
|
9710
9797
|
const serializerDefault = function() {
|
|
9711
|
-
|
|
9798
|
+
setPrototypeOf(arguments, null);
|
|
9799
|
+
return stringify(arguments);
|
|
9712
9800
|
};
|
|
9713
9801
|
var ObjectWithoutPrototypeCache = class {
|
|
9714
9802
|
constructor() {
|
|
9715
|
-
this
|
|
9803
|
+
defineProperty$1(this, "cache", {
|
|
9804
|
+
__proto__: null,
|
|
9805
|
+
value: create(null),
|
|
9806
|
+
writable: true,
|
|
9807
|
+
enumerable: true,
|
|
9808
|
+
configurable: true
|
|
9809
|
+
});
|
|
9716
9810
|
}
|
|
9717
9811
|
get(key) {
|
|
9718
9812
|
return this.cache[key];
|
|
@@ -9744,11 +9838,56 @@ function ensureIntl() {
|
|
|
9744
9838
|
writable: true,
|
|
9745
9839
|
value: {}
|
|
9746
9840
|
});
|
|
9841
|
+
if (providerIntl === void 0) providerIntl = Intl;
|
|
9747
9842
|
return Intl;
|
|
9748
9843
|
}
|
|
9749
9844
|
memoize((...args) => new Intl.NumberFormat(...args), { strategy: strategies.variadic });
|
|
9750
9845
|
memoize((...args) => new Intl.PluralRules(...args), { strategy: strategies.variadic });
|
|
9751
9846
|
memoize((...args) => new Intl.ListFormat(...args), { strategy: strategies.variadic });
|
|
9847
|
+
const getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
9848
|
+
strategies.variadic;
|
|
9849
|
+
let providerIntl = globalThis.Intl;
|
|
9850
|
+
function ownIntlProvider(name) {
|
|
9851
|
+
const descriptor = providerIntl && getOwnPropertyDescriptor(providerIntl, name);
|
|
9852
|
+
return (descriptor && getOwnPropertyDescriptor(descriptor, "value"))?.value;
|
|
9853
|
+
}
|
|
9854
|
+
let numberFormatProvider = ownIntlProvider("NumberFormat");
|
|
9855
|
+
let listFormatProvider = ownIntlProvider("ListFormat");
|
|
9856
|
+
const getFormatterPrototype = Object.getPrototypeOf;
|
|
9857
|
+
const formatterPartsMethods = /* @__PURE__ */ new WeakMap();
|
|
9858
|
+
const formatterPartsOwners = /* @__PURE__ */ new WeakMap();
|
|
9859
|
+
const getPartsMethod = formatterPartsMethods.get.bind(formatterPartsMethods);
|
|
9860
|
+
const setPartsMethod = formatterPartsMethods.set.bind(formatterPartsMethods);
|
|
9861
|
+
const getPartsOwner = formatterPartsOwners.get.bind(formatterPartsOwners);
|
|
9862
|
+
const setPartsOwner = formatterPartsOwners.set.bind(formatterPartsOwners);
|
|
9863
|
+
function findFormatterPartsMethod(Constructor) {
|
|
9864
|
+
const cached = getPartsMethod(Constructor);
|
|
9865
|
+
if (cached) return cached;
|
|
9866
|
+
let prototype = getOwnPropertyDescriptor(Constructor, "prototype")?.value;
|
|
9867
|
+
while (prototype != null) {
|
|
9868
|
+
const inherited = getPartsOwner(prototype);
|
|
9869
|
+
if (inherited) {
|
|
9870
|
+
setPartsMethod(Constructor, inherited);
|
|
9871
|
+
return inherited;
|
|
9872
|
+
}
|
|
9873
|
+
const descriptor = getOwnPropertyDescriptor(prototype, "formatToParts");
|
|
9874
|
+
const value = descriptor && getOwnPropertyDescriptor(descriptor, "value");
|
|
9875
|
+
if (value && typeof value.value === "function") {
|
|
9876
|
+
setPartsMethod(Constructor, value.value);
|
|
9877
|
+
setPartsOwner(prototype, value.value);
|
|
9878
|
+
return value.value;
|
|
9879
|
+
}
|
|
9880
|
+
prototype = getFormatterPrototype(prototype);
|
|
9881
|
+
}
|
|
9882
|
+
}
|
|
9883
|
+
if (typeof numberFormatProvider === "function") findFormatterPartsMethod(numberFormatProvider);
|
|
9884
|
+
if (typeof listFormatProvider === "function") findFormatterPartsMethod(listFormatProvider);
|
|
9885
|
+
const numberFormatMemoizers = /* @__PURE__ */ new WeakMap();
|
|
9886
|
+
numberFormatMemoizers.get.bind(numberFormatMemoizers);
|
|
9887
|
+
numberFormatMemoizers.set.bind(numberFormatMemoizers);
|
|
9888
|
+
const listFormatMemoizers = /* @__PURE__ */ new WeakMap();
|
|
9889
|
+
listFormatMemoizers.get.bind(listFormatMemoizers);
|
|
9890
|
+
listFormatMemoizers.set.bind(listFormatMemoizers);
|
|
9752
9891
|
// packages/intl-getcanonicallocales/polyfill.ts
|
|
9753
9892
|
const intl = ensureIntl();
|
|
9754
9893
|
if (shouldPolyfill()) defineProperty(intl, "getCanonicalLocales", { value: getCanonicalLocales });
|