@formatjs/intl-datetimeformat 4.5.1 → 5.0.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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/polyfill.iife.js +235 -362
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formatjs/intl-datetimeformat",
3
- "version": "4.5.1",
3
+ "version": "5.0.1",
4
4
  "description": "Intl.DateTimeFormat polyfill",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -22,8 +22,8 @@
22
22
  },
23
23
  "homepage": "https://github.com/formatjs/formatjs#readme",
24
24
  "dependencies": {
25
- "@formatjs/ecma402-abstract": "1.11.2",
26
- "@formatjs/intl-localematcher": "0.2.23",
25
+ "@formatjs/ecma402-abstract": "1.11.4",
26
+ "@formatjs/intl-localematcher": "0.2.25",
27
27
  "tslib": "^2.1.0"
28
28
  }
29
29
  }
package/polyfill.iife.js CHANGED
@@ -1,357 +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, mod2) {
12
- return function __require() {
13
- return mod2 || (0, cb[__getOwnPropNames(cb)[0]])((mod2 = { exports: {} }).exports, mod2), mod2.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/CanonicalizeLocaleList.js
34
- var require_CanonicalizeLocaleList = __commonJS({
35
- "bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/CanonicalizeLocaleList.js": function(exports) {
36
- "use strict";
37
- Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.CanonicalizeLocaleList = void 0;
39
- function CanonicalizeLocaleList2(locales) {
40
- return Intl.getCanonicalLocales(locales);
41
- }
42
- exports.CanonicalizeLocaleList = CanonicalizeLocaleList2;
43
- }
44
- });
45
-
46
- // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/utils.js
47
- var require_utils = __commonJS({
48
- "bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/utils.js": function(exports) {
49
- "use strict";
50
- Object.defineProperty(exports, "__esModule", { value: true });
51
- exports.invariant = exports.UNICODE_EXTENSION_SEQUENCE_REGEX = void 0;
52
- exports.UNICODE_EXTENSION_SEQUENCE_REGEX = /-u(?:-[0-9a-z]{2,8})+/gi;
53
- function invariant2(condition, message, Err) {
54
- if (Err === void 0) {
55
- Err = Error;
56
- }
57
- if (!condition) {
58
- throw new Err(message);
59
- }
60
- }
61
- exports.invariant = invariant2;
62
- }
63
- });
64
-
65
- // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/BestAvailableLocale.js
66
- var require_BestAvailableLocale = __commonJS({
67
- "bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/BestAvailableLocale.js": function(exports) {
68
- "use strict";
69
- Object.defineProperty(exports, "__esModule", { value: true });
70
- exports.BestAvailableLocale = void 0;
71
- function BestAvailableLocale(availableLocales, locale) {
72
- var candidate = locale;
73
- while (true) {
74
- if (availableLocales.has(candidate)) {
75
- return candidate;
76
- }
77
- var pos = candidate.lastIndexOf("-");
78
- if (!~pos) {
79
- return void 0;
80
- }
81
- if (pos >= 2 && candidate[pos - 2] === "-") {
82
- pos -= 2;
83
- }
84
- candidate = candidate.slice(0, pos);
85
- }
86
- }
87
- exports.BestAvailableLocale = BestAvailableLocale;
88
- }
89
- });
90
-
91
- // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/LookupMatcher.js
92
- var require_LookupMatcher = __commonJS({
93
- "bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/LookupMatcher.js": function(exports) {
94
- "use strict";
95
- Object.defineProperty(exports, "__esModule", { value: true });
96
- exports.LookupMatcher = void 0;
97
- var utils_1 = require_utils();
98
- var BestAvailableLocale_1 = require_BestAvailableLocale();
99
- function LookupMatcher(availableLocales, requestedLocales, getDefaultLocale) {
100
- var result = { locale: "" };
101
- for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
102
- var locale = requestedLocales_1[_i];
103
- var noExtensionLocale = locale.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, "");
104
- var availableLocale = (0, BestAvailableLocale_1.BestAvailableLocale)(availableLocales, noExtensionLocale);
105
- if (availableLocale) {
106
- result.locale = availableLocale;
107
- if (locale !== noExtensionLocale) {
108
- result.extension = locale.slice(noExtensionLocale.length + 1, locale.length);
109
- }
110
- return result;
111
- }
112
- }
113
- result.locale = getDefaultLocale();
114
- return result;
115
- }
116
- exports.LookupMatcher = LookupMatcher;
117
- }
118
- });
119
-
120
- // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/BestFitMatcher.js
121
- var require_BestFitMatcher = __commonJS({
122
- "bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/BestFitMatcher.js": function(exports) {
123
- "use strict";
124
- Object.defineProperty(exports, "__esModule", { value: true });
125
- exports.BestFitMatcher = void 0;
126
- var BestAvailableLocale_1 = require_BestAvailableLocale();
127
- var utils_1 = require_utils();
128
- function BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale) {
129
- var minimizedAvailableLocaleMap = {};
130
- var minimizedAvailableLocales = /* @__PURE__ */ new Set();
131
- availableLocales.forEach(function(locale2) {
132
- var minimizedLocale = new Intl.Locale(locale2).minimize().toString();
133
- var canonicalizedLocale = Intl.getCanonicalLocales(locale2)[0] || locale2;
134
- minimizedAvailableLocaleMap[minimizedLocale] = locale2;
135
- minimizedAvailableLocaleMap[locale2] = locale2;
136
- minimizedAvailableLocaleMap[canonicalizedLocale] = locale2;
137
- minimizedAvailableLocales.add(minimizedLocale);
138
- minimizedAvailableLocales.add(locale2);
139
- minimizedAvailableLocales.add(canonicalizedLocale);
140
- });
141
- var foundLocale;
142
- for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
143
- var l = requestedLocales_1[_i];
144
- if (foundLocale) {
145
- break;
146
- }
147
- var noExtensionLocale = l.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, "");
148
- if (availableLocales.has(noExtensionLocale)) {
149
- foundLocale = noExtensionLocale;
150
- break;
151
- }
152
- if (minimizedAvailableLocales.has(noExtensionLocale)) {
153
- foundLocale = noExtensionLocale;
154
- break;
155
- }
156
- var locale = new Intl.Locale(noExtensionLocale);
157
- var maximizedRequestedLocale = locale.maximize().toString();
158
- var minimizedRequestedLocale = locale.minimize().toString();
159
- if (minimizedAvailableLocales.has(minimizedRequestedLocale)) {
160
- foundLocale = minimizedRequestedLocale;
161
- break;
162
- }
163
- foundLocale = (0, BestAvailableLocale_1.BestAvailableLocale)(minimizedAvailableLocales, maximizedRequestedLocale);
164
- }
165
- if (!foundLocale) {
166
- return { locale: getDefaultLocale() };
167
- }
168
- return {
169
- locale: minimizedAvailableLocaleMap[foundLocale] || foundLocale
170
- };
171
- }
172
- exports.BestFitMatcher = BestFitMatcher;
173
- }
174
- });
175
-
176
- // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/UnicodeExtensionValue.js
177
- var require_UnicodeExtensionValue = __commonJS({
178
- "bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/UnicodeExtensionValue.js": function(exports) {
179
- "use strict";
180
- Object.defineProperty(exports, "__esModule", { value: true });
181
- exports.UnicodeExtensionValue = void 0;
182
- var utils_1 = require_utils();
183
- function UnicodeExtensionValue(extension, key) {
184
- (0, utils_1.invariant)(key.length === 2, "key must have 2 elements");
185
- var size = extension.length;
186
- var searchValue = "-".concat(key, "-");
187
- var pos = extension.indexOf(searchValue);
188
- if (pos !== -1) {
189
- var start = pos + 4;
190
- var end = start;
191
- var k = start;
192
- var done = false;
193
- while (!done) {
194
- var e = extension.indexOf("-", k);
195
- var len = void 0;
196
- if (e === -1) {
197
- len = size - k;
198
- } else {
199
- len = e - k;
200
- }
201
- if (len === 2) {
202
- done = true;
203
- } else if (e === -1) {
204
- end = size;
205
- done = true;
206
- } else {
207
- end = e;
208
- k = e + 1;
209
- }
210
- }
211
- return extension.slice(start, end);
212
- }
213
- searchValue = "-".concat(key);
214
- pos = extension.indexOf(searchValue);
215
- if (pos !== -1 && pos + 3 === size) {
216
- return "";
217
- }
218
- return void 0;
219
- }
220
- exports.UnicodeExtensionValue = UnicodeExtensionValue;
221
- }
222
- });
223
-
224
- // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/ResolveLocale.js
225
- var require_ResolveLocale = __commonJS({
226
- "bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/ResolveLocale.js": function(exports) {
227
- "use strict";
228
- Object.defineProperty(exports, "__esModule", { value: true });
229
- exports.ResolveLocale = void 0;
230
- var LookupMatcher_1 = require_LookupMatcher();
231
- var BestFitMatcher_1 = require_BestFitMatcher();
232
- var utils_1 = require_utils();
233
- var UnicodeExtensionValue_1 = require_UnicodeExtensionValue();
234
- function ResolveLocale2(availableLocales, requestedLocales, options, relevantExtensionKeys, localeData, getDefaultLocale) {
235
- var matcher = options.localeMatcher;
236
- var r;
237
- if (matcher === "lookup") {
238
- r = (0, LookupMatcher_1.LookupMatcher)(availableLocales, requestedLocales, getDefaultLocale);
239
- } else {
240
- r = (0, BestFitMatcher_1.BestFitMatcher)(availableLocales, requestedLocales, getDefaultLocale);
241
- }
242
- var foundLocale = r.locale;
243
- var result = { locale: "", dataLocale: foundLocale };
244
- var supportedExtension = "-u";
245
- for (var _i = 0, relevantExtensionKeys_1 = relevantExtensionKeys; _i < relevantExtensionKeys_1.length; _i++) {
246
- var key = relevantExtensionKeys_1[_i];
247
- (0, utils_1.invariant)(foundLocale in localeData, "Missing locale data for ".concat(foundLocale));
248
- var foundLocaleData = localeData[foundLocale];
249
- (0, utils_1.invariant)(typeof foundLocaleData === "object" && foundLocaleData !== null, "locale data ".concat(key, " must be an object"));
250
- var keyLocaleData = foundLocaleData[key];
251
- (0, utils_1.invariant)(Array.isArray(keyLocaleData), "keyLocaleData for ".concat(key, " must be an array"));
252
- var value = keyLocaleData[0];
253
- (0, utils_1.invariant)(typeof value === "string" || value === null, "value must be string or null but got ".concat(typeof value, " in key ").concat(key));
254
- var supportedExtensionAddition = "";
255
- if (r.extension) {
256
- var requestedValue = (0, UnicodeExtensionValue_1.UnicodeExtensionValue)(r.extension, key);
257
- if (requestedValue !== void 0) {
258
- if (requestedValue !== "") {
259
- if (~keyLocaleData.indexOf(requestedValue)) {
260
- value = requestedValue;
261
- supportedExtensionAddition = "-".concat(key, "-").concat(value);
262
- }
263
- } else if (~requestedValue.indexOf("true")) {
264
- value = "true";
265
- supportedExtensionAddition = "-".concat(key);
266
- }
267
- }
268
- }
269
- if (key in options) {
270
- var optionsValue = options[key];
271
- (0, utils_1.invariant)(typeof optionsValue === "string" || typeof optionsValue === "undefined" || optionsValue === null, "optionsValue must be String, Undefined or Null");
272
- if (~keyLocaleData.indexOf(optionsValue)) {
273
- if (optionsValue !== value) {
274
- value = optionsValue;
275
- supportedExtensionAddition = "";
276
- }
277
- }
278
- }
279
- result[key] = value;
280
- supportedExtension += supportedExtensionAddition;
281
- }
282
- if (supportedExtension.length > 2) {
283
- var privateIndex = foundLocale.indexOf("-x-");
284
- if (privateIndex === -1) {
285
- foundLocale = foundLocale + supportedExtension;
286
- } else {
287
- var preExtension = foundLocale.slice(0, privateIndex);
288
- var postExtension = foundLocale.slice(privateIndex, foundLocale.length);
289
- foundLocale = preExtension + supportedExtension + postExtension;
290
- }
291
- foundLocale = Intl.getCanonicalLocales(foundLocale)[0];
292
- }
293
- result.locale = foundLocale;
294
- return result;
295
- }
296
- exports.ResolveLocale = ResolveLocale2;
297
- }
298
- });
299
-
300
- // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/LookupSupportedLocales.js
301
- var require_LookupSupportedLocales = __commonJS({
302
- "bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/LookupSupportedLocales.js": function(exports) {
303
- "use strict";
304
- Object.defineProperty(exports, "__esModule", { value: true });
305
- exports.LookupSupportedLocales = void 0;
306
- var utils_1 = require_utils();
307
- var BestAvailableLocale_1 = require_BestAvailableLocale();
308
- function LookupSupportedLocales2(availableLocales, requestedLocales) {
309
- var subset = [];
310
- for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
311
- var locale = requestedLocales_1[_i];
312
- var noExtensionLocale = locale.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, "");
313
- var availableLocale = (0, BestAvailableLocale_1.BestAvailableLocale)(availableLocales, noExtensionLocale);
314
- if (availableLocale) {
315
- subset.push(availableLocale);
316
- }
317
- }
318
- return subset;
319
- }
320
- exports.LookupSupportedLocales = LookupSupportedLocales2;
321
- }
322
- });
323
-
324
- // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/index.js
325
- var require_intl_localematcher = __commonJS({
326
- "bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/index.js": function(exports) {
327
- "use strict";
328
- Object.defineProperty(exports, "__esModule", { value: true });
329
- exports.ResolveLocale = exports.LookupSupportedLocales = exports.match = void 0;
330
- var CanonicalizeLocaleList_1 = require_CanonicalizeLocaleList();
331
- var ResolveLocale_1 = require_ResolveLocale();
332
- function match2(requestedLocales, availableLocales, defaultLocale, opts) {
333
- var locales = availableLocales.reduce(function(all, l) {
334
- all.add(l);
335
- return all;
336
- }, /* @__PURE__ */ new Set());
337
- return (0, ResolveLocale_1.ResolveLocale)(locales, (0, CanonicalizeLocaleList_1.CanonicalizeLocaleList)(requestedLocales), {
338
- localeMatcher: (opts === null || opts === void 0 ? void 0 : opts.algorithm) || "best fit"
339
- }, [], {}, function() {
340
- return defaultLocale;
341
- }).locale;
342
- }
343
- exports.match = match2;
344
- var LookupSupportedLocales_1 = require_LookupSupportedLocales();
345
- Object.defineProperty(exports, "LookupSupportedLocales", { enumerable: true, get: function() {
346
- return LookupSupportedLocales_1.LookupSupportedLocales;
347
- } });
348
- var ResolveLocale_2 = require_ResolveLocale();
349
- Object.defineProperty(exports, "ResolveLocale", { enumerable: true, get: function() {
350
- return ResolveLocale_2.ResolveLocale;
351
- } });
352
- }
353
- });
354
-
355
2
  // node_modules/tslib/tslib.es6.js
356
3
  var __assign = function() {
357
4
  __assign = Object.assign || function __assign2(t) {
@@ -730,6 +377,237 @@
730
377
  }
731
378
  }
732
379
 
380
+ // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/lib/abstract/CanonicalizeLocaleList.js
381
+ function CanonicalizeLocaleList2(locales) {
382
+ return Intl.getCanonicalLocales(locales);
383
+ }
384
+
385
+ // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/lib/abstract/utils.js
386
+ var UNICODE_EXTENSION_SEQUENCE_REGEX = /-u(?:-[0-9a-z]{2,8})+/gi;
387
+ function invariant2(condition, message, Err) {
388
+ if (Err === void 0) {
389
+ Err = Error;
390
+ }
391
+ if (!condition) {
392
+ throw new Err(message);
393
+ }
394
+ }
395
+
396
+ // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/lib/abstract/BestAvailableLocale.js
397
+ function BestAvailableLocale(availableLocales, locale) {
398
+ var candidate = locale;
399
+ while (true) {
400
+ if (availableLocales.has(candidate)) {
401
+ return candidate;
402
+ }
403
+ var pos = candidate.lastIndexOf("-");
404
+ if (!~pos) {
405
+ return void 0;
406
+ }
407
+ if (pos >= 2 && candidate[pos - 2] === "-") {
408
+ pos -= 2;
409
+ }
410
+ candidate = candidate.slice(0, pos);
411
+ }
412
+ }
413
+
414
+ // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/lib/abstract/LookupMatcher.js
415
+ function LookupMatcher(availableLocales, requestedLocales, getDefaultLocale) {
416
+ var result = { locale: "" };
417
+ for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
418
+ var locale = requestedLocales_1[_i];
419
+ var noExtensionLocale = locale.replace(UNICODE_EXTENSION_SEQUENCE_REGEX, "");
420
+ var availableLocale = BestAvailableLocale(availableLocales, noExtensionLocale);
421
+ if (availableLocale) {
422
+ result.locale = availableLocale;
423
+ if (locale !== noExtensionLocale) {
424
+ result.extension = locale.slice(noExtensionLocale.length + 1, locale.length);
425
+ }
426
+ return result;
427
+ }
428
+ }
429
+ result.locale = getDefaultLocale();
430
+ return result;
431
+ }
432
+
433
+ // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/lib/abstract/BestFitMatcher.js
434
+ function BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale) {
435
+ var minimizedAvailableLocaleMap = {};
436
+ var availableLocaleMap = {};
437
+ var canonicalizedLocaleMap = {};
438
+ var minimizedAvailableLocales = /* @__PURE__ */ new Set();
439
+ availableLocales.forEach(function(locale2) {
440
+ var minimizedLocale = new Intl.Locale(locale2).minimize().toString();
441
+ var canonicalizedLocale = Intl.getCanonicalLocales(locale2)[0] || locale2;
442
+ minimizedAvailableLocaleMap[minimizedLocale] = locale2;
443
+ availableLocaleMap[locale2] = locale2;
444
+ canonicalizedLocaleMap[canonicalizedLocale] = locale2;
445
+ minimizedAvailableLocales.add(minimizedLocale);
446
+ minimizedAvailableLocales.add(locale2);
447
+ minimizedAvailableLocales.add(canonicalizedLocale);
448
+ });
449
+ var foundLocale;
450
+ for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
451
+ var l = requestedLocales_1[_i];
452
+ if (foundLocale) {
453
+ break;
454
+ }
455
+ var noExtensionLocale = l.replace(UNICODE_EXTENSION_SEQUENCE_REGEX, "");
456
+ if (availableLocales.has(noExtensionLocale)) {
457
+ foundLocale = noExtensionLocale;
458
+ break;
459
+ }
460
+ if (minimizedAvailableLocales.has(noExtensionLocale)) {
461
+ foundLocale = noExtensionLocale;
462
+ break;
463
+ }
464
+ var locale = new Intl.Locale(noExtensionLocale);
465
+ var maximizedRequestedLocale = locale.maximize().toString();
466
+ var minimizedRequestedLocale = locale.minimize().toString();
467
+ if (minimizedAvailableLocales.has(minimizedRequestedLocale)) {
468
+ foundLocale = minimizedRequestedLocale;
469
+ break;
470
+ }
471
+ foundLocale = BestAvailableLocale(minimizedAvailableLocales, maximizedRequestedLocale);
472
+ }
473
+ if (!foundLocale) {
474
+ return { locale: getDefaultLocale() };
475
+ }
476
+ return {
477
+ locale: availableLocaleMap[foundLocale] || canonicalizedLocaleMap[foundLocale] || minimizedAvailableLocaleMap[foundLocale] || foundLocale
478
+ };
479
+ }
480
+
481
+ // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/lib/abstract/UnicodeExtensionValue.js
482
+ function UnicodeExtensionValue(extension, key) {
483
+ invariant2(key.length === 2, "key must have 2 elements");
484
+ var size = extension.length;
485
+ var searchValue = "-".concat(key, "-");
486
+ var pos = extension.indexOf(searchValue);
487
+ if (pos !== -1) {
488
+ var start = pos + 4;
489
+ var end = start;
490
+ var k = start;
491
+ var done = false;
492
+ while (!done) {
493
+ var e = extension.indexOf("-", k);
494
+ var len = void 0;
495
+ if (e === -1) {
496
+ len = size - k;
497
+ } else {
498
+ len = e - k;
499
+ }
500
+ if (len === 2) {
501
+ done = true;
502
+ } else if (e === -1) {
503
+ end = size;
504
+ done = true;
505
+ } else {
506
+ end = e;
507
+ k = e + 1;
508
+ }
509
+ }
510
+ return extension.slice(start, end);
511
+ }
512
+ searchValue = "-".concat(key);
513
+ pos = extension.indexOf(searchValue);
514
+ if (pos !== -1 && pos + 3 === size) {
515
+ return "";
516
+ }
517
+ return void 0;
518
+ }
519
+
520
+ // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/lib/abstract/ResolveLocale.js
521
+ function ResolveLocale(availableLocales, requestedLocales, options, relevantExtensionKeys, localeData, getDefaultLocale) {
522
+ var matcher = options.localeMatcher;
523
+ var r;
524
+ if (matcher === "lookup") {
525
+ r = LookupMatcher(availableLocales, requestedLocales, getDefaultLocale);
526
+ } else {
527
+ r = BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale);
528
+ }
529
+ var foundLocale = r.locale;
530
+ var result = { locale: "", dataLocale: foundLocale };
531
+ var supportedExtension = "-u";
532
+ for (var _i = 0, relevantExtensionKeys_1 = relevantExtensionKeys; _i < relevantExtensionKeys_1.length; _i++) {
533
+ var key = relevantExtensionKeys_1[_i];
534
+ invariant2(foundLocale in localeData, "Missing locale data for ".concat(foundLocale));
535
+ var foundLocaleData = localeData[foundLocale];
536
+ invariant2(typeof foundLocaleData === "object" && foundLocaleData !== null, "locale data ".concat(key, " must be an object"));
537
+ var keyLocaleData = foundLocaleData[key];
538
+ invariant2(Array.isArray(keyLocaleData), "keyLocaleData for ".concat(key, " must be an array"));
539
+ var value = keyLocaleData[0];
540
+ invariant2(typeof value === "string" || value === null, "value must be string or null but got ".concat(typeof value, " in key ").concat(key));
541
+ var supportedExtensionAddition = "";
542
+ if (r.extension) {
543
+ var requestedValue = UnicodeExtensionValue(r.extension, key);
544
+ if (requestedValue !== void 0) {
545
+ if (requestedValue !== "") {
546
+ if (~keyLocaleData.indexOf(requestedValue)) {
547
+ value = requestedValue;
548
+ supportedExtensionAddition = "-".concat(key, "-").concat(value);
549
+ }
550
+ } else if (~requestedValue.indexOf("true")) {
551
+ value = "true";
552
+ supportedExtensionAddition = "-".concat(key);
553
+ }
554
+ }
555
+ }
556
+ if (key in options) {
557
+ var optionsValue = options[key];
558
+ invariant2(typeof optionsValue === "string" || typeof optionsValue === "undefined" || optionsValue === null, "optionsValue must be String, Undefined or Null");
559
+ if (~keyLocaleData.indexOf(optionsValue)) {
560
+ if (optionsValue !== value) {
561
+ value = optionsValue;
562
+ supportedExtensionAddition = "";
563
+ }
564
+ }
565
+ }
566
+ result[key] = value;
567
+ supportedExtension += supportedExtensionAddition;
568
+ }
569
+ if (supportedExtension.length > 2) {
570
+ var privateIndex = foundLocale.indexOf("-x-");
571
+ if (privateIndex === -1) {
572
+ foundLocale = foundLocale + supportedExtension;
573
+ } else {
574
+ var preExtension = foundLocale.slice(0, privateIndex);
575
+ var postExtension = foundLocale.slice(privateIndex, foundLocale.length);
576
+ foundLocale = preExtension + supportedExtension + postExtension;
577
+ }
578
+ foundLocale = Intl.getCanonicalLocales(foundLocale)[0];
579
+ }
580
+ result.locale = foundLocale;
581
+ return result;
582
+ }
583
+
584
+ // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/lib/abstract/LookupSupportedLocales.js
585
+ function LookupSupportedLocales(availableLocales, requestedLocales) {
586
+ var subset = [];
587
+ for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
588
+ var locale = requestedLocales_1[_i];
589
+ var noExtensionLocale = locale.replace(UNICODE_EXTENSION_SEQUENCE_REGEX, "");
590
+ var availableLocale = BestAvailableLocale(availableLocales, noExtensionLocale);
591
+ if (availableLocale) {
592
+ subset.push(availableLocale);
593
+ }
594
+ }
595
+ return subset;
596
+ }
597
+
598
+ // bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/lib/index.js
599
+ function match(requestedLocales, availableLocales, defaultLocale, opts) {
600
+ var locales = availableLocales.reduce(function(all, l) {
601
+ all.add(l);
602
+ return all;
603
+ }, /* @__PURE__ */ new Set());
604
+ return ResolveLocale(locales, CanonicalizeLocaleList2(requestedLocales), {
605
+ localeMatcher: (opts === null || opts === void 0 ? void 0 : opts.algorithm) || "best fit"
606
+ }, [], {}, function() {
607
+ return defaultLocale;
608
+ }).locale;
609
+ }
610
+
733
611
  // bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/PartitionPattern.js
734
612
  function PartitionPattern(pattern) {
735
613
  var result = [];
@@ -763,7 +641,6 @@
763
641
  }
764
642
 
765
643
  // bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/SupportedLocales.js
766
- var import_intl_localematcher = __toESM(require_intl_localematcher());
767
644
  function SupportedLocales(availableLocales, requestedLocales, options) {
768
645
  var matcher = "best fit";
769
646
  if (options !== void 0) {
@@ -771,9 +648,9 @@
771
648
  matcher = GetOption(options, "localeMatcher", "string", ["lookup", "best fit"], "best fit");
772
649
  }
773
650
  if (matcher === "best fit") {
774
- return (0, import_intl_localematcher.LookupSupportedLocales)(availableLocales, requestedLocales);
651
+ return LookupSupportedLocales(availableLocales, requestedLocales);
775
652
  }
776
- return (0, import_intl_localematcher.LookupSupportedLocales)(availableLocales, requestedLocales);
653
+ return LookupSupportedLocales(availableLocales, requestedLocales);
777
654
  }
778
655
 
779
656
  // bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/types/date-time.js
@@ -1655,7 +1532,6 @@
1655
1532
  }
1656
1533
 
1657
1534
  // bazel-out/darwin-fastbuild/bin/packages/intl-datetimeformat/lib/src/abstract/InitializeDateTimeFormat.js
1658
- var import_intl_localematcher2 = __toESM(require_intl_localematcher());
1659
1535
  function isTimeRelated(opt) {
1660
1536
  for (var _i = 0, _a = ["hour", "minute", "second"]; _i < _a.length; _i++) {
1661
1537
  var prop = _a[_i];
@@ -1713,7 +1589,7 @@
1713
1589
  hourCycle = null;
1714
1590
  }
1715
1591
  opt.hc = hourCycle;
1716
- var r = (0, import_intl_localematcher2.ResolveLocale)(availableLocales, requestedLocales, opt, relevantExtensionKeys, localeData, getDefaultLocale);
1592
+ var r = ResolveLocale(availableLocales, requestedLocales, opt, relevantExtensionKeys, localeData, getDefaultLocale);
1717
1593
  internalSlots.locale = r.locale;
1718
1594
  calendar = r.ca;
1719
1595
  internalSlots.calendar = calendar;
@@ -2221,9 +2097,6 @@
2221
2097
  } catch (e) {
2222
2098
  }
2223
2099
 
2224
- // bazel-out/darwin-fastbuild/bin/packages/intl-datetimeformat/lib/should-polyfill.js
2225
- var import_intl_localematcher3 = __toESM(require_intl_localematcher());
2226
-
2227
2100
  // bazel-out/darwin-fastbuild/bin/packages/intl-datetimeformat/lib/supported-locales.js
2228
2101
  var supportedLocales = ["af-NA", "af", "agq", "ak", "am", "ar-AE", "ar-BH", "ar-DJ", "ar-DZ", "ar-EG", "ar-EH", "ar-ER", "ar-IL", "ar-IQ", "ar-JO", "ar-KM", "ar-KW", "ar-LB", "ar-LY", "ar-MA", "ar-MR", "ar-OM", "ar-PS", "ar-QA", "ar-SA", "ar-SD", "ar-SO", "ar-SS", "ar-SY", "ar-TD", "ar-TN", "ar-YE", "ar", "as", "asa", "ast", "az-Cyrl", "az-Latn", "az", "bas", "be-tarask", "be", "bem", "bez", "bg", "bm", "bn-IN", "bn", "bo-IN", "bo", "br", "brx", "bs-Cyrl", "bs-Latn", "bs", "ca-AD", "ca-ES-valencia", "ca-FR", "ca-IT", "ca", "ccp-IN", "ccp", "ce", "ceb", "cgg", "chr", "ckb-IR", "ckb", "cs", "cy", "da-GL", "da", "dav", "de-AT", "de-BE", "de-CH", "de-IT", "de-LI", "de-LU", "de", "dje", "doi", "dsb", "dua", "dyo", "dz", "ebu", "ee-TG", "ee", "el-CY", "el", "en-001", "en-150", "en-AE", "en-AG", "en-AI", "en-AS", "en-AT", "en-AU", "en-BB", "en-BE", "en-BI", "en-BM", "en-BS", "en-BW", "en-BZ", "en-CA", "en-CC", "en-CH", "en-CK", "en-CM", "en-CX", "en-CY", "en-DE", "en-DG", "en-DK", "en-DM", "en-ER", "en-FI", "en-FJ", "en-FK", "en-FM", "en-GB", "en-GD", "en-GG", "en-GH", "en-GI", "en-GM", "en-GU", "en-GY", "en-HK", "en-IE", "en-IL", "en-IM", "en-IN", "en-IO", "en-JE", "en-JM", "en-KE", "en-KI", "en-KN", "en-KY", "en-LC", "en-LR", "en-LS", "en-MG", "en-MH", "en-MO", "en-MP", "en-MS", "en-MT", "en-MU", "en-MW", "en-MY", "en-NA", "en-NF", "en-NG", "en-NL", "en-NR", "en-NU", "en-NZ", "en-PG", "en-PH", "en-PK", "en-PN", "en-PR", "en-PW", "en-RW", "en-SB", "en-SC", "en-SD", "en-SE", "en-SG", "en-SH", "en-SI", "en-SL", "en-SS", "en-SX", "en-SZ", "en-TC", "en-TK", "en-TO", "en-TT", "en-TV", "en-TZ", "en-UG", "en-UM", "en-VC", "en-VG", "en-VI", "en-VU", "en-WS", "en-ZA", "en-ZM", "en-ZW", "en", "eo", "es-419", "es-AR", "es-BO", "es-BR", "es-BZ", "es-CL", "es-CO", "es-CR", "es-CU", "es-DO", "es-EA", "es-EC", "es-GQ", "es-GT", "es-HN", "es-IC", "es-MX", "es-NI", "es-PA", "es-PE", "es-PH", "es-PR", "es-PY", "es-SV", "es-US", "es-UY", "es-VE", "es", "et", "eu", "ewo", "fa-AF", "fa", "ff-Adlm-BF", "ff-Adlm-CM", "ff-Adlm-GH", "ff-Adlm-GM", "ff-Adlm-GW", "ff-Adlm-LR", "ff-Adlm-MR", "ff-Adlm-NE", "ff-Adlm-NG", "ff-Adlm-SL", "ff-Adlm-SN", "ff-Adlm", "ff-Latn-BF", "ff-Latn-CM", "ff-Latn-GH", "ff-Latn-GM", "ff-Latn-GN", "ff-Latn-GW", "ff-Latn-LR", "ff-Latn-MR", "ff-Latn-NE", "ff-Latn-NG", "ff-Latn-SL", "ff-Latn", "ff", "fi", "fil", "fo-DK", "fo", "fr-BE", "fr-BF", "fr-BI", "fr-BJ", "fr-BL", "fr-CA", "fr-CD", "fr-CF", "fr-CG", "fr-CH", "fr-CI", "fr-CM", "fr-DJ", "fr-DZ", "fr-GA", "fr-GF", "fr-GN", "fr-GP", "fr-GQ", "fr-HT", "fr-KM", "fr-LU", "fr-MA", "fr-MC", "fr-MF", "fr-MG", "fr-ML", "fr-MQ", "fr-MR", "fr-MU", "fr-NC", "fr-NE", "fr-PF", "fr-PM", "fr-RE", "fr-RW", "fr-SC", "fr-SN", "fr-SY", "fr-TD", "fr-TG", "fr-TN", "fr-VU", "fr-WF", "fr-YT", "fr", "fur", "fy", "ga-GB", "ga", "gd", "gl", "gsw-FR", "gsw-LI", "gsw", "gu", "guz", "gv", "ha-GH", "ha-NE", "ha", "haw", "he", "hi", "hr-BA", "hr", "hsb", "hu", "hy", "ia", "id", "ig", "ii", "is", "it-CH", "it-SM", "it-VA", "it", "ja", "jgo", "jmc", "jv", "ka", "kab", "kam", "kde", "kea", "kgp", "khq", "ki", "kk", "kkj", "kl", "kln", "km", "kn", "ko-KP", "ko", "kok", "ks-Arab", "ks", "ksb", "ksf", "ksh", "ku", "kw", "ky", "lag", "lb", "lg", "lkt", "ln-AO", "ln-CF", "ln-CG", "ln", "lo", "lrc-IQ", "lrc", "lt", "lu", "luo", "luy", "lv", "mai", "mas-TZ", "mas", "mer", "mfe", "mg", "mgh", "mgo", "mi", "mk", "ml", "mn", "mni-Beng", "mni", "mr", "ms-BN", "ms-ID", "ms-SG", "ms", "mt", "mua", "my", "mzn", "naq", "nb-SJ", "nb", "nd", "nds-NL", "nds", "ne-IN", "ne", "nl-AW", "nl-BE", "nl-BQ", "nl-CW", "nl-SR", "nl-SX", "nl", "nmg", "nn", "nnh", "no", "nus", "nyn", "om-KE", "om", "or", "os-RU", "os", "pa-Arab", "pa-Guru", "pa", "pcm", "pl", "ps-PK", "ps", "pt-AO", "pt-CH", "pt-CV", "pt-GQ", "pt-GW", "pt-LU", "pt-MO", "pt-MZ", "pt-PT", "pt-ST", "pt-TL", "pt", "qu-BO", "qu-EC", "qu", "rm", "rn", "ro-MD", "ro", "rof", "ru-BY", "ru-KG", "ru-KZ", "ru-MD", "ru-UA", "ru", "rw", "rwk", "sa", "sah", "saq", "sat-Olck", "sat", "sbp", "sc", "sd-Arab", "sd-Deva", "sd", "se-FI", "se-SE", "se", "seh", "ses", "sg", "shi-Latn", "shi-Tfng", "shi", "si", "sk", "sl", "smn", "sn", "so-DJ", "so-ET", "so-KE", "so", "sq-MK", "sq-XK", "sq", "sr-Cyrl-BA", "sr-Cyrl-ME", "sr-Cyrl-XK", "sr-Cyrl", "sr-Latn-BA", "sr-Latn-ME", "sr-Latn-XK", "sr-Latn", "sr", "su-Latn", "su", "sv-AX", "sv-FI", "sv", "sw-CD", "sw-KE", "sw-UG", "sw", "ta-LK", "ta-MY", "ta-SG", "ta", "te", "teo-KE", "teo", "tg", "th", "ti-ER", "ti", "tk", "to", "tr-CY", "tr", "tt", "twq", "tzm", "ug", "uk", "und", "ur-IN", "ur", "uz-Arab", "uz-Cyrl", "uz-Latn", "uz", "vai-Latn", "vai-Vaii", "vai", "vi", "vun", "wae", "wo", "xh", "xog", "yav", "yi", "yo-BJ", "yo", "yrl-CO", "yrl-VE", "yrl", "yue-Hans", "yue-Hant", "yue", "zgh", "zh-Hans-HK", "zh-Hans-MO", "zh-Hans-SG", "zh-Hans", "zh-Hant-HK", "zh-Hant-MO", "zh-Hant", "zh", "zu"];
2229
2102
 
@@ -2269,7 +2142,7 @@
2269
2142
  locale = "en";
2270
2143
  }
2271
2144
  if (!("DateTimeFormat" in Intl) || !("formatToParts" in Intl.DateTimeFormat.prototype) || !("formatRange" in Intl.DateTimeFormat.prototype) || hasChromeLt71Bug() || hasUnthrownDateTimeStyleBug() || !supportsDateStyle() || !supportedLocalesOf2(locale)) {
2272
- return locale ? (0, import_intl_localematcher3.match)([locale], supportedLocales, "en") : void 0;
2145
+ return locale ? match([locale], supportedLocales, "en") : void 0;
2273
2146
  }
2274
2147
  }
2275
2148