@formatjs/intl-pluralrules 4.3.0 → 4.3.3

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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/polyfill.iife.js +239 -347
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formatjs/intl-pluralrules",
3
- "version": "4.3.0",
3
+ "version": "4.3.3",
4
4
  "description": "Polyfill for Intl.PluralRules",
5
5
  "keywords": [
6
6
  "polyfill",
@@ -20,8 +20,8 @@
20
20
  "url": "git+https://github.com/formatjs/formatjs.git"
21
21
  },
22
22
  "dependencies": {
23
- "@formatjs/ecma402-abstract": "1.11.1",
24
- "@formatjs/intl-localematcher": "0.2.22",
23
+ "@formatjs/ecma402-abstract": "1.11.4",
24
+ "@formatjs/intl-localematcher": "0.2.25",
25
25
  "tslib": "^2.1.0"
26
26
  },
27
27
  "bugs": {
package/polyfill.iife.js CHANGED
@@ -1,338 +1,4 @@
1
1
  (function() {
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __markAsModule = function(target) {
9
- return __defProp(target, "__esModule", { value: true });
10
- };
11
- var __commonJS = function(cb, mod) {
12
- return function __require() {
13
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
14
- };
15
- };
16
- var __reExport = function(target, module, copyDefault, desc) {
17
- if (module && typeof module === "object" || typeof module === "function")
18
- for (var keys = __getOwnPropNames(module), i = 0, n = keys.length, key; i < n; i++) {
19
- key = keys[i];
20
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
21
- __defProp(target, key, { get: function(k) {
22
- return module[k];
23
- }.bind(null, key), enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
24
- }
25
- return target;
26
- };
27
- var __toESM = function(module, isNodeMode) {
28
- return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", !isNodeMode && module && module.__esModule ? { get: function() {
29
- return module.default;
30
- }, enumerable: true } : { value: module, enumerable: true })), module);
31
- };
32
-
33
- // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/utils.js
34
- var require_utils = __commonJS({
35
- "bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/utils.js": function(exports) {
36
- "use strict";
37
- Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.invariant = exports.UNICODE_EXTENSION_SEQUENCE_REGEX = void 0;
39
- exports.UNICODE_EXTENSION_SEQUENCE_REGEX = /-u(?:-[0-9a-z]{2,8})+/gi;
40
- function invariant2(condition, message, Err) {
41
- if (Err === void 0) {
42
- Err = Error;
43
- }
44
- if (!condition) {
45
- throw new Err(message);
46
- }
47
- }
48
- exports.invariant = invariant2;
49
- }
50
- });
51
-
52
- // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/BestAvailableLocale.js
53
- var require_BestAvailableLocale = __commonJS({
54
- "bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/BestAvailableLocale.js": function(exports) {
55
- "use strict";
56
- Object.defineProperty(exports, "__esModule", { value: true });
57
- exports.BestAvailableLocale = void 0;
58
- function BestAvailableLocale(availableLocales, locale) {
59
- var candidate = locale;
60
- while (true) {
61
- if (availableLocales.has(candidate)) {
62
- return candidate;
63
- }
64
- var pos = candidate.lastIndexOf("-");
65
- if (!~pos) {
66
- return void 0;
67
- }
68
- if (pos >= 2 && candidate[pos - 2] === "-") {
69
- pos -= 2;
70
- }
71
- candidate = candidate.slice(0, pos);
72
- }
73
- }
74
- exports.BestAvailableLocale = BestAvailableLocale;
75
- }
76
- });
77
-
78
- // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/LookupMatcher.js
79
- var require_LookupMatcher = __commonJS({
80
- "bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/LookupMatcher.js": function(exports) {
81
- "use strict";
82
- Object.defineProperty(exports, "__esModule", { value: true });
83
- exports.LookupMatcher = void 0;
84
- var utils_1 = require_utils();
85
- var BestAvailableLocale_1 = require_BestAvailableLocale();
86
- function LookupMatcher(availableLocales, requestedLocales, getDefaultLocale) {
87
- var result = { locale: "" };
88
- for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
89
- var locale = requestedLocales_1[_i];
90
- var noExtensionLocale = locale.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, "");
91
- var availableLocale = (0, BestAvailableLocale_1.BestAvailableLocale)(availableLocales, noExtensionLocale);
92
- if (availableLocale) {
93
- result.locale = availableLocale;
94
- if (locale !== noExtensionLocale) {
95
- result.extension = locale.slice(noExtensionLocale.length + 1, locale.length);
96
- }
97
- return result;
98
- }
99
- }
100
- result.locale = getDefaultLocale();
101
- return result;
102
- }
103
- exports.LookupMatcher = LookupMatcher;
104
- }
105
- });
106
-
107
- // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/BestFitMatcher.js
108
- var require_BestFitMatcher = __commonJS({
109
- "bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/BestFitMatcher.js": function(exports) {
110
- "use strict";
111
- Object.defineProperty(exports, "__esModule", { value: true });
112
- exports.BestFitMatcher = void 0;
113
- var BestAvailableLocale_1 = require_BestAvailableLocale();
114
- var utils_1 = require_utils();
115
- function BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale) {
116
- var minimizedAvailableLocaleMap = {};
117
- availableLocales.forEach(function(l2) {
118
- return minimizedAvailableLocaleMap[l2] = l2;
119
- });
120
- var minimizedAvailableLocales = /* @__PURE__ */ new Set();
121
- availableLocales.forEach(function(locale2) {
122
- var minimizedLocale = new Intl.Locale(locale2).minimize().toString();
123
- minimizedAvailableLocaleMap[minimizedLocale] = locale2;
124
- minimizedAvailableLocales.add(minimizedLocale);
125
- });
126
- var foundLocale;
127
- for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
128
- var l = requestedLocales_1[_i];
129
- if (foundLocale) {
130
- break;
131
- }
132
- var noExtensionLocale = l.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, "");
133
- if (availableLocales.has(noExtensionLocale)) {
134
- foundLocale = noExtensionLocale;
135
- break;
136
- }
137
- if (minimizedAvailableLocales.has(noExtensionLocale)) {
138
- foundLocale = noExtensionLocale;
139
- break;
140
- }
141
- var locale = new Intl.Locale(noExtensionLocale);
142
- var maximizedRequestedLocale = locale.maximize().toString();
143
- var minimizedRequestedLocale = locale.minimize().toString();
144
- if (minimizedAvailableLocales.has(minimizedRequestedLocale)) {
145
- foundLocale = minimizedRequestedLocale;
146
- break;
147
- }
148
- foundLocale = (0, BestAvailableLocale_1.BestAvailableLocale)(minimizedAvailableLocales, maximizedRequestedLocale);
149
- }
150
- return {
151
- locale: foundLocale && minimizedAvailableLocaleMap[foundLocale] || getDefaultLocale()
152
- };
153
- }
154
- exports.BestFitMatcher = BestFitMatcher;
155
- }
156
- });
157
-
158
- // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/UnicodeExtensionValue.js
159
- var require_UnicodeExtensionValue = __commonJS({
160
- "bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/UnicodeExtensionValue.js": function(exports) {
161
- "use strict";
162
- Object.defineProperty(exports, "__esModule", { value: true });
163
- exports.UnicodeExtensionValue = void 0;
164
- var utils_1 = require_utils();
165
- function UnicodeExtensionValue(extension, key) {
166
- (0, utils_1.invariant)(key.length === 2, "key must have 2 elements");
167
- var size = extension.length;
168
- var searchValue = "-".concat(key, "-");
169
- var pos = extension.indexOf(searchValue);
170
- if (pos !== -1) {
171
- var start = pos + 4;
172
- var end = start;
173
- var k = start;
174
- var done = false;
175
- while (!done) {
176
- var e = extension.indexOf("-", k);
177
- var len = void 0;
178
- if (e === -1) {
179
- len = size - k;
180
- } else {
181
- len = e - k;
182
- }
183
- if (len === 2) {
184
- done = true;
185
- } else if (e === -1) {
186
- end = size;
187
- done = true;
188
- } else {
189
- end = e;
190
- k = e + 1;
191
- }
192
- }
193
- return extension.slice(start, end);
194
- }
195
- searchValue = "-".concat(key);
196
- pos = extension.indexOf(searchValue);
197
- if (pos !== -1 && pos + 3 === size) {
198
- return "";
199
- }
200
- return void 0;
201
- }
202
- exports.UnicodeExtensionValue = UnicodeExtensionValue;
203
- }
204
- });
205
-
206
- // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/ResolveLocale.js
207
- var require_ResolveLocale = __commonJS({
208
- "bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/ResolveLocale.js": function(exports) {
209
- "use strict";
210
- Object.defineProperty(exports, "__esModule", { value: true });
211
- exports.ResolveLocale = void 0;
212
- var LookupMatcher_1 = require_LookupMatcher();
213
- var BestFitMatcher_1 = require_BestFitMatcher();
214
- var utils_1 = require_utils();
215
- var UnicodeExtensionValue_1 = require_UnicodeExtensionValue();
216
- function ResolveLocale2(availableLocales, requestedLocales, options, relevantExtensionKeys, localeData, getDefaultLocale) {
217
- var matcher = options.localeMatcher;
218
- var r;
219
- if (matcher === "lookup") {
220
- r = (0, LookupMatcher_1.LookupMatcher)(availableLocales, requestedLocales, getDefaultLocale);
221
- } else {
222
- r = (0, BestFitMatcher_1.BestFitMatcher)(availableLocales, requestedLocales, getDefaultLocale);
223
- }
224
- var foundLocale = r.locale;
225
- var result = { locale: "", dataLocale: foundLocale };
226
- var supportedExtension = "-u";
227
- for (var _i = 0, relevantExtensionKeys_1 = relevantExtensionKeys; _i < relevantExtensionKeys_1.length; _i++) {
228
- var key = relevantExtensionKeys_1[_i];
229
- (0, utils_1.invariant)(foundLocale in localeData, "Missing locale data for ".concat(foundLocale));
230
- var foundLocaleData = localeData[foundLocale];
231
- (0, utils_1.invariant)(typeof foundLocaleData === "object" && foundLocaleData !== null, "locale data ".concat(key, " must be an object"));
232
- var keyLocaleData = foundLocaleData[key];
233
- (0, utils_1.invariant)(Array.isArray(keyLocaleData), "keyLocaleData for ".concat(key, " must be an array"));
234
- var value = keyLocaleData[0];
235
- (0, utils_1.invariant)(typeof value === "string" || value === null, "value must be string or null but got ".concat(typeof value, " in key ").concat(key));
236
- var supportedExtensionAddition = "";
237
- if (r.extension) {
238
- var requestedValue = (0, UnicodeExtensionValue_1.UnicodeExtensionValue)(r.extension, key);
239
- if (requestedValue !== void 0) {
240
- if (requestedValue !== "") {
241
- if (~keyLocaleData.indexOf(requestedValue)) {
242
- value = requestedValue;
243
- supportedExtensionAddition = "-".concat(key, "-").concat(value);
244
- }
245
- } else if (~requestedValue.indexOf("true")) {
246
- value = "true";
247
- supportedExtensionAddition = "-".concat(key);
248
- }
249
- }
250
- }
251
- if (key in options) {
252
- var optionsValue = options[key];
253
- (0, utils_1.invariant)(typeof optionsValue === "string" || typeof optionsValue === "undefined" || optionsValue === null, "optionsValue must be String, Undefined or Null");
254
- if (~keyLocaleData.indexOf(optionsValue)) {
255
- if (optionsValue !== value) {
256
- value = optionsValue;
257
- supportedExtensionAddition = "";
258
- }
259
- }
260
- }
261
- result[key] = value;
262
- supportedExtension += supportedExtensionAddition;
263
- }
264
- if (supportedExtension.length > 2) {
265
- var privateIndex = foundLocale.indexOf("-x-");
266
- if (privateIndex === -1) {
267
- foundLocale = foundLocale + supportedExtension;
268
- } else {
269
- var preExtension = foundLocale.slice(0, privateIndex);
270
- var postExtension = foundLocale.slice(privateIndex, foundLocale.length);
271
- foundLocale = preExtension + supportedExtension + postExtension;
272
- }
273
- foundLocale = Intl.getCanonicalLocales(foundLocale)[0];
274
- }
275
- result.locale = foundLocale;
276
- return result;
277
- }
278
- exports.ResolveLocale = ResolveLocale2;
279
- }
280
- });
281
-
282
- // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/LookupSupportedLocales.js
283
- var require_LookupSupportedLocales = __commonJS({
284
- "bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/LookupSupportedLocales.js": function(exports) {
285
- "use strict";
286
- Object.defineProperty(exports, "__esModule", { value: true });
287
- exports.LookupSupportedLocales = void 0;
288
- var utils_1 = require_utils();
289
- var BestAvailableLocale_1 = require_BestAvailableLocale();
290
- function LookupSupportedLocales2(availableLocales, requestedLocales) {
291
- var subset = [];
292
- for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
293
- var locale = requestedLocales_1[_i];
294
- var noExtensionLocale = locale.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, "");
295
- var availableLocale = (0, BestAvailableLocale_1.BestAvailableLocale)(availableLocales, noExtensionLocale);
296
- if (availableLocale) {
297
- subset.push(availableLocale);
298
- }
299
- }
300
- return subset;
301
- }
302
- exports.LookupSupportedLocales = LookupSupportedLocales2;
303
- }
304
- });
305
-
306
- // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/index.js
307
- var require_intl_localematcher = __commonJS({
308
- "bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/index.js": function(exports) {
309
- "use strict";
310
- Object.defineProperty(exports, "__esModule", { value: true });
311
- exports.ResolveLocale = exports.LookupSupportedLocales = exports.match = void 0;
312
- var ResolveLocale_1 = require_ResolveLocale();
313
- function match2(requestedLocales, availableLocales, defaultLocale, opts) {
314
- var locales = availableLocales.reduce(function(all, l) {
315
- all.add(l);
316
- return all;
317
- }, /* @__PURE__ */ new Set());
318
- return (0, ResolveLocale_1.ResolveLocale)(locales, requestedLocales, {
319
- localeMatcher: (opts === null || opts === void 0 ? void 0 : opts.algorithm) || "best fit"
320
- }, [], {}, function() {
321
- return defaultLocale;
322
- }).locale;
323
- }
324
- exports.match = match2;
325
- var LookupSupportedLocales_1 = require_LookupSupportedLocales();
326
- Object.defineProperty(exports, "LookupSupportedLocales", { enumerable: true, get: function() {
327
- return LookupSupportedLocales_1.LookupSupportedLocales;
328
- } });
329
- var ResolveLocale_2 = require_ResolveLocale();
330
- Object.defineProperty(exports, "ResolveLocale", { enumerable: true, get: function() {
331
- return ResolveLocale_2.ResolveLocale;
332
- } });
333
- }
334
- });
335
-
336
2
  // node_modules/tslib/tslib.es6.js
337
3
  function __spreadArray(to, from, pack) {
338
4
  if (pack || arguments.length === 2)
@@ -426,7 +92,7 @@
426
92
  // bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/CoerceOptionsToObject.js
427
93
  function CoerceOptionsToObject(options) {
428
94
  if (typeof options === "undefined") {
429
- return Object.create(null);
95
+ return /* @__PURE__ */ Object.create(null);
430
96
  }
431
97
  return ToObject(options);
432
98
  }
@@ -632,6 +298,237 @@
632
298
  return { roundedNumber: x, formattedString: string };
633
299
  }
634
300
 
301
+ // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/lib/abstract/CanonicalizeLocaleList.js
302
+ function CanonicalizeLocaleList2(locales) {
303
+ return Intl.getCanonicalLocales(locales);
304
+ }
305
+
306
+ // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/lib/abstract/utils.js
307
+ var UNICODE_EXTENSION_SEQUENCE_REGEX = /-u(?:-[0-9a-z]{2,8})+/gi;
308
+ function invariant2(condition, message, Err) {
309
+ if (Err === void 0) {
310
+ Err = Error;
311
+ }
312
+ if (!condition) {
313
+ throw new Err(message);
314
+ }
315
+ }
316
+
317
+ // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/lib/abstract/BestAvailableLocale.js
318
+ function BestAvailableLocale(availableLocales, locale) {
319
+ var candidate = locale;
320
+ while (true) {
321
+ if (availableLocales.has(candidate)) {
322
+ return candidate;
323
+ }
324
+ var pos = candidate.lastIndexOf("-");
325
+ if (!~pos) {
326
+ return void 0;
327
+ }
328
+ if (pos >= 2 && candidate[pos - 2] === "-") {
329
+ pos -= 2;
330
+ }
331
+ candidate = candidate.slice(0, pos);
332
+ }
333
+ }
334
+
335
+ // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/lib/abstract/LookupMatcher.js
336
+ function LookupMatcher(availableLocales, requestedLocales, getDefaultLocale) {
337
+ var result = { locale: "" };
338
+ for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
339
+ var locale = requestedLocales_1[_i];
340
+ var noExtensionLocale = locale.replace(UNICODE_EXTENSION_SEQUENCE_REGEX, "");
341
+ var availableLocale = BestAvailableLocale(availableLocales, noExtensionLocale);
342
+ if (availableLocale) {
343
+ result.locale = availableLocale;
344
+ if (locale !== noExtensionLocale) {
345
+ result.extension = locale.slice(noExtensionLocale.length + 1, locale.length);
346
+ }
347
+ return result;
348
+ }
349
+ }
350
+ result.locale = getDefaultLocale();
351
+ return result;
352
+ }
353
+
354
+ // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/lib/abstract/BestFitMatcher.js
355
+ function BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale) {
356
+ var minimizedAvailableLocaleMap = {};
357
+ var availableLocaleMap = {};
358
+ var canonicalizedLocaleMap = {};
359
+ var minimizedAvailableLocales = /* @__PURE__ */ new Set();
360
+ availableLocales.forEach(function(locale2) {
361
+ var minimizedLocale = new Intl.Locale(locale2).minimize().toString();
362
+ var canonicalizedLocale = Intl.getCanonicalLocales(locale2)[0] || locale2;
363
+ minimizedAvailableLocaleMap[minimizedLocale] = locale2;
364
+ availableLocaleMap[locale2] = locale2;
365
+ canonicalizedLocaleMap[canonicalizedLocale] = locale2;
366
+ minimizedAvailableLocales.add(minimizedLocale);
367
+ minimizedAvailableLocales.add(locale2);
368
+ minimizedAvailableLocales.add(canonicalizedLocale);
369
+ });
370
+ var foundLocale;
371
+ for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
372
+ var l = requestedLocales_1[_i];
373
+ if (foundLocale) {
374
+ break;
375
+ }
376
+ var noExtensionLocale = l.replace(UNICODE_EXTENSION_SEQUENCE_REGEX, "");
377
+ if (availableLocales.has(noExtensionLocale)) {
378
+ foundLocale = noExtensionLocale;
379
+ break;
380
+ }
381
+ if (minimizedAvailableLocales.has(noExtensionLocale)) {
382
+ foundLocale = noExtensionLocale;
383
+ break;
384
+ }
385
+ var locale = new Intl.Locale(noExtensionLocale);
386
+ var maximizedRequestedLocale = locale.maximize().toString();
387
+ var minimizedRequestedLocale = locale.minimize().toString();
388
+ if (minimizedAvailableLocales.has(minimizedRequestedLocale)) {
389
+ foundLocale = minimizedRequestedLocale;
390
+ break;
391
+ }
392
+ foundLocale = BestAvailableLocale(minimizedAvailableLocales, maximizedRequestedLocale);
393
+ }
394
+ if (!foundLocale) {
395
+ return { locale: getDefaultLocale() };
396
+ }
397
+ return {
398
+ locale: availableLocaleMap[foundLocale] || canonicalizedLocaleMap[foundLocale] || minimizedAvailableLocaleMap[foundLocale] || foundLocale
399
+ };
400
+ }
401
+
402
+ // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/lib/abstract/UnicodeExtensionValue.js
403
+ function UnicodeExtensionValue(extension, key) {
404
+ invariant2(key.length === 2, "key must have 2 elements");
405
+ var size = extension.length;
406
+ var searchValue = "-".concat(key, "-");
407
+ var pos = extension.indexOf(searchValue);
408
+ if (pos !== -1) {
409
+ var start = pos + 4;
410
+ var end = start;
411
+ var k = start;
412
+ var done = false;
413
+ while (!done) {
414
+ var e = extension.indexOf("-", k);
415
+ var len = void 0;
416
+ if (e === -1) {
417
+ len = size - k;
418
+ } else {
419
+ len = e - k;
420
+ }
421
+ if (len === 2) {
422
+ done = true;
423
+ } else if (e === -1) {
424
+ end = size;
425
+ done = true;
426
+ } else {
427
+ end = e;
428
+ k = e + 1;
429
+ }
430
+ }
431
+ return extension.slice(start, end);
432
+ }
433
+ searchValue = "-".concat(key);
434
+ pos = extension.indexOf(searchValue);
435
+ if (pos !== -1 && pos + 3 === size) {
436
+ return "";
437
+ }
438
+ return void 0;
439
+ }
440
+
441
+ // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/lib/abstract/ResolveLocale.js
442
+ function ResolveLocale(availableLocales, requestedLocales, options, relevantExtensionKeys, localeData, getDefaultLocale) {
443
+ var matcher = options.localeMatcher;
444
+ var r;
445
+ if (matcher === "lookup") {
446
+ r = LookupMatcher(availableLocales, requestedLocales, getDefaultLocale);
447
+ } else {
448
+ r = BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale);
449
+ }
450
+ var foundLocale = r.locale;
451
+ var result = { locale: "", dataLocale: foundLocale };
452
+ var supportedExtension = "-u";
453
+ for (var _i = 0, relevantExtensionKeys_1 = relevantExtensionKeys; _i < relevantExtensionKeys_1.length; _i++) {
454
+ var key = relevantExtensionKeys_1[_i];
455
+ invariant2(foundLocale in localeData, "Missing locale data for ".concat(foundLocale));
456
+ var foundLocaleData = localeData[foundLocale];
457
+ invariant2(typeof foundLocaleData === "object" && foundLocaleData !== null, "locale data ".concat(key, " must be an object"));
458
+ var keyLocaleData = foundLocaleData[key];
459
+ invariant2(Array.isArray(keyLocaleData), "keyLocaleData for ".concat(key, " must be an array"));
460
+ var value = keyLocaleData[0];
461
+ invariant2(typeof value === "string" || value === null, "value must be string or null but got ".concat(typeof value, " in key ").concat(key));
462
+ var supportedExtensionAddition = "";
463
+ if (r.extension) {
464
+ var requestedValue = UnicodeExtensionValue(r.extension, key);
465
+ if (requestedValue !== void 0) {
466
+ if (requestedValue !== "") {
467
+ if (~keyLocaleData.indexOf(requestedValue)) {
468
+ value = requestedValue;
469
+ supportedExtensionAddition = "-".concat(key, "-").concat(value);
470
+ }
471
+ } else if (~requestedValue.indexOf("true")) {
472
+ value = "true";
473
+ supportedExtensionAddition = "-".concat(key);
474
+ }
475
+ }
476
+ }
477
+ if (key in options) {
478
+ var optionsValue = options[key];
479
+ invariant2(typeof optionsValue === "string" || typeof optionsValue === "undefined" || optionsValue === null, "optionsValue must be String, Undefined or Null");
480
+ if (~keyLocaleData.indexOf(optionsValue)) {
481
+ if (optionsValue !== value) {
482
+ value = optionsValue;
483
+ supportedExtensionAddition = "";
484
+ }
485
+ }
486
+ }
487
+ result[key] = value;
488
+ supportedExtension += supportedExtensionAddition;
489
+ }
490
+ if (supportedExtension.length > 2) {
491
+ var privateIndex = foundLocale.indexOf("-x-");
492
+ if (privateIndex === -1) {
493
+ foundLocale = foundLocale + supportedExtension;
494
+ } else {
495
+ var preExtension = foundLocale.slice(0, privateIndex);
496
+ var postExtension = foundLocale.slice(privateIndex, foundLocale.length);
497
+ foundLocale = preExtension + supportedExtension + postExtension;
498
+ }
499
+ foundLocale = Intl.getCanonicalLocales(foundLocale)[0];
500
+ }
501
+ result.locale = foundLocale;
502
+ return result;
503
+ }
504
+
505
+ // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/lib/abstract/LookupSupportedLocales.js
506
+ function LookupSupportedLocales(availableLocales, requestedLocales) {
507
+ var subset = [];
508
+ for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
509
+ var locale = requestedLocales_1[_i];
510
+ var noExtensionLocale = locale.replace(UNICODE_EXTENSION_SEQUENCE_REGEX, "");
511
+ var availableLocale = BestAvailableLocale(availableLocales, noExtensionLocale);
512
+ if (availableLocale) {
513
+ subset.push(availableLocale);
514
+ }
515
+ }
516
+ return subset;
517
+ }
518
+
519
+ // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/lib/index.js
520
+ function match(requestedLocales, availableLocales, defaultLocale, opts) {
521
+ var locales = availableLocales.reduce(function(all, l) {
522
+ all.add(l);
523
+ return all;
524
+ }, /* @__PURE__ */ new Set());
525
+ return ResolveLocale(locales, CanonicalizeLocaleList2(requestedLocales), {
526
+ localeMatcher: (opts === null || opts === void 0 ? void 0 : opts.algorithm) || "best fit"
527
+ }, [], {}, function() {
528
+ return defaultLocale;
529
+ }).locale;
530
+ }
531
+
635
532
  // bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/NumberFormat/SetNumberFormatDigitOptions.js
636
533
  function SetNumberFormatDigitOptions(internalSlots, opts, mnfdDefault, mxfdDefault, notation) {
637
534
  var mnid = GetNumberOption(opts, "minimumIntegerDigits", 1, 21, 1);
@@ -663,7 +560,6 @@
663
560
  }
664
561
 
665
562
  // bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/SupportedLocales.js
666
- var import_intl_localematcher = __toESM(require_intl_localematcher());
667
563
  function SupportedLocales(availableLocales, requestedLocales, options) {
668
564
  var matcher = "best fit";
669
565
  if (options !== void 0) {
@@ -671,17 +567,16 @@
671
567
  matcher = GetOption(options, "localeMatcher", "string", ["lookup", "best fit"], "best fit");
672
568
  }
673
569
  if (matcher === "best fit") {
674
- return (0, import_intl_localematcher.LookupSupportedLocales)(availableLocales, requestedLocales);
570
+ return LookupSupportedLocales(availableLocales, requestedLocales);
675
571
  }
676
- return (0, import_intl_localematcher.LookupSupportedLocales)(availableLocales, requestedLocales);
572
+ return LookupSupportedLocales(availableLocales, requestedLocales);
677
573
  }
678
574
 
679
575
  // bazel-out/darwin-fastbuild/bin/packages/intl-pluralrules/lib/abstract/InitializePluralRules.js
680
- var import_intl_localematcher2 = __toESM(require_intl_localematcher());
681
576
  function InitializePluralRules(pl, locales, options, _a) {
682
577
  var availableLocales = _a.availableLocales, relevantExtensionKeys = _a.relevantExtensionKeys, localeData = _a.localeData, getDefaultLocale = _a.getDefaultLocale, getInternalSlots2 = _a.getInternalSlots;
683
578
  var requestedLocales = CanonicalizeLocaleList(locales);
684
- var opt = Object.create(null);
579
+ var opt = /* @__PURE__ */ Object.create(null);
685
580
  var opts = CoerceOptionsToObject(options);
686
581
  var internalSlots = getInternalSlots2(pl);
687
582
  internalSlots.initializedPluralRules = true;
@@ -689,7 +584,7 @@
689
584
  opt.localeMatcher = matcher;
690
585
  internalSlots.type = GetOption(opts, "type", "string", ["cardinal", "ordinal"], "cardinal");
691
586
  SetNumberFormatDigitOptions(internalSlots, opts, 0, 3, "standard");
692
- var r = (0, import_intl_localematcher2.ResolveLocale)(availableLocales, requestedLocales, opt, relevantExtensionKeys, localeData, getDefaultLocale);
587
+ var r = ResolveLocale(availableLocales, requestedLocales, opt, relevantExtensionKeys, localeData, getDefaultLocale);
693
588
  internalSlots.locale = r.locale;
694
589
  return pl;
695
590
  }
@@ -757,7 +652,7 @@
757
652
  function getInternalSlots(x) {
758
653
  var internalSlots = internalSlotMap.get(x);
759
654
  if (!internalSlots) {
760
- internalSlots = Object.create(null);
655
+ internalSlots = /* @__PURE__ */ Object.create(null);
761
656
  internalSlotMap.set(x, internalSlots);
762
657
  }
763
658
  return internalSlots;
@@ -789,7 +684,7 @@
789
684
  }
790
685
  PluralRules2.prototype.resolvedOptions = function() {
791
686
  validateInstance(this, "resolvedOptions");
792
- var opts = Object.create(null);
687
+ var opts = /* @__PURE__ */ Object.create(null);
793
688
  var internalSlots = getInternalSlots(this);
794
689
  opts.locale = internalSlots.locale;
795
690
  opts.type = internalSlots.type;
@@ -877,9 +772,6 @@
877
772
  } catch (ex) {
878
773
  }
879
774
 
880
- // bazel-out/darwin-fastbuild/bin/packages/intl-pluralrules/lib/should-polyfill.js
881
- var import_intl_localematcher3 = __toESM(require_intl_localematcher());
882
-
883
775
  // bazel-out/darwin-fastbuild/bin/packages/intl-pluralrules/lib/supported-locales.js
884
776
  var supportedLocales = ["af", "ak", "am", "an", "ar", "ars", "as", "asa", "ast", "az", "bal", "be", "bem", "bez", "bg", "bho", "bm", "bn", "bo", "br", "brx", "bs", "ca", "ce", "ceb", "cgg", "chr", "ckb", "cs", "cy", "da", "de", "doi", "dsb", "dv", "dz", "ee", "el", "en", "eo", "es", "et", "eu", "fa", "ff", "fi", "fil", "fo", "fr", "fur", "fy", "ga", "gd", "gl", "gsw", "gu", "guw", "gv", "ha", "haw", "he", "hi", "hnj", "hr", "hsb", "hu", "hy", "ia", "id", "ig", "ii", "io", "is", "it", "iu", "ja", "jbo", "jgo", "jmc", "jv", "jw", "ka", "kab", "kaj", "kcg", "kde", "kea", "kk", "kkj", "kl", "km", "kn", "ko", "ks", "ksb", "ksh", "ku", "kw", "ky", "lag", "lb", "lg", "lij", "lkt", "ln", "lo", "lt", "lv", "mas", "mg", "mgo", "mk", "ml", "mn", "mo", "mr", "ms", "mt", "my", "nah", "naq", "nb", "nd", "ne", "nl", "nn", "nnh", "no", "nqo", "nr", "nso", "ny", "nyn", "om", "or", "os", "osa", "pa", "pap", "pcm", "pl", "prg", "ps", "pt-PT", "pt", "rm", "ro", "rof", "ru", "rwk", "sah", "saq", "sat", "sc", "scn", "sd", "sdh", "se", "seh", "ses", "sg", "sh", "shi", "si", "sk", "sl", "sma", "smi", "smj", "smn", "sms", "sn", "so", "sq", "sr", "ss", "ssy", "st", "su", "sv", "sw", "syr", "ta", "te", "teo", "th", "ti", "tig", "tk", "tl", "tn", "to", "tpi", "tr", "ts", "tzm", "ug", "uk", "und", "ur", "uz", "ve", "vi", "vo", "vun", "wa", "wae", "wo", "xh", "xog", "yi", "yo", "yue", "zh", "zu"];
885
777
 
@@ -896,7 +788,7 @@
896
788
  locale = "en";
897
789
  }
898
790
  if (!("PluralRules" in Intl) || new Intl.PluralRules("en", { minimumFractionDigits: 2 }).select(1) === "one" || !supportedLocalesOf(locale)) {
899
- return locale ? (0, import_intl_localematcher3.match)([locale], supportedLocales, "en") : void 0;
791
+ return locale ? match([locale], supportedLocales, "en") : void 0;
900
792
  }
901
793
  }
902
794