@everymatrix/casino-game-thumb-view 1.62.3 → 1.63.0

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.
@@ -3,10 +3,2139 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-81c5b70d.js');
6
- const utils = require('./utils-21e506f8.js');
6
+ const utils = require('./utils-d65e7a9f.js');
7
7
  const locale_utils = require('./locale.utils-53bf703a.js');
8
8
  const gameThumbnail = require('./game-thumbnail-5a34c727.js');
9
9
 
10
+ function toInteger(dirtyNumber) {
11
+ if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
12
+ return NaN;
13
+ }
14
+ var number = Number(dirtyNumber);
15
+ if (isNaN(number)) {
16
+ return number;
17
+ }
18
+ return number < 0 ? Math.ceil(number) : Math.floor(number);
19
+ }
20
+
21
+ /**
22
+ * @name addMilliseconds
23
+ * @category Millisecond Helpers
24
+ * @summary Add the specified number of milliseconds to the given date.
25
+ *
26
+ * @description
27
+ * Add the specified number of milliseconds to the given date.
28
+ *
29
+ * @param {Date|Number} date - the date to be changed
30
+ * @param {Number} amount - the amount of milliseconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
31
+ * @returns {Date} the new date with the milliseconds added
32
+ * @throws {TypeError} 2 arguments required
33
+ *
34
+ * @example
35
+ * // Add 750 milliseconds to 10 July 2014 12:45:30.000:
36
+ * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
37
+ * //=> Thu Jul 10 2014 12:45:30.750
38
+ */
39
+ function addMilliseconds(dirtyDate, dirtyAmount) {
40
+ utils.requiredArgs(2, arguments);
41
+ var timestamp = utils.toDate(dirtyDate).getTime();
42
+ var amount = toInteger(dirtyAmount);
43
+ return new Date(timestamp + amount);
44
+ }
45
+
46
+ var defaultOptions = {};
47
+ function getDefaultOptions() {
48
+ return defaultOptions;
49
+ }
50
+
51
+ /**
52
+ * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
53
+ * They usually appear for dates that denote time before the timezones were introduced
54
+ * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
55
+ * and GMT+01:00:00 after that date)
56
+ *
57
+ * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
58
+ * which would lead to incorrect calculations.
59
+ *
60
+ * This function returns the timezone offset in milliseconds that takes seconds in account.
61
+ */
62
+ function getTimezoneOffsetInMilliseconds(date) {
63
+ var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
64
+ utcDate.setUTCFullYear(date.getFullYear());
65
+ return date.getTime() - utcDate.getTime();
66
+ }
67
+
68
+ /**
69
+ * @name isDate
70
+ * @category Common Helpers
71
+ * @summary Is the given value a date?
72
+ *
73
+ * @description
74
+ * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
75
+ *
76
+ * @param {*} value - the value to check
77
+ * @returns {boolean} true if the given value is a date
78
+ * @throws {TypeError} 1 arguments required
79
+ *
80
+ * @example
81
+ * // For a valid date:
82
+ * const result = isDate(new Date())
83
+ * //=> true
84
+ *
85
+ * @example
86
+ * // For an invalid date:
87
+ * const result = isDate(new Date(NaN))
88
+ * //=> true
89
+ *
90
+ * @example
91
+ * // For some value:
92
+ * const result = isDate('2014-02-31')
93
+ * //=> false
94
+ *
95
+ * @example
96
+ * // For an object:
97
+ * const result = isDate({})
98
+ * //=> false
99
+ */
100
+ function isDate(value) {
101
+ utils.requiredArgs(1, arguments);
102
+ return value instanceof Date || utils._typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
103
+ }
104
+
105
+ /**
106
+ * @name isValid
107
+ * @category Common Helpers
108
+ * @summary Is the given date valid?
109
+ *
110
+ * @description
111
+ * Returns false if argument is Invalid Date and true otherwise.
112
+ * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
113
+ * Invalid Date is a Date, whose time value is NaN.
114
+ *
115
+ * Time value of Date: http://es5.github.io/#x15.9.1.1
116
+ *
117
+ * @param {*} date - the date to check
118
+ * @returns {Boolean} the date is valid
119
+ * @throws {TypeError} 1 argument required
120
+ *
121
+ * @example
122
+ * // For the valid date:
123
+ * const result = isValid(new Date(2014, 1, 31))
124
+ * //=> true
125
+ *
126
+ * @example
127
+ * // For the value, convertable into a date:
128
+ * const result = isValid(1393804800000)
129
+ * //=> true
130
+ *
131
+ * @example
132
+ * // For the invalid date:
133
+ * const result = isValid(new Date(''))
134
+ * //=> false
135
+ */
136
+ function isValid(dirtyDate) {
137
+ utils.requiredArgs(1, arguments);
138
+ if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
139
+ return false;
140
+ }
141
+ var date = utils.toDate(dirtyDate);
142
+ return !isNaN(Number(date));
143
+ }
144
+
145
+ /**
146
+ * @name subMilliseconds
147
+ * @category Millisecond Helpers
148
+ * @summary Subtract the specified number of milliseconds from the given date.
149
+ *
150
+ * @description
151
+ * Subtract the specified number of milliseconds from the given date.
152
+ *
153
+ * @param {Date|Number} date - the date to be changed
154
+ * @param {Number} amount - the amount of milliseconds to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
155
+ * @returns {Date} the new date with the milliseconds subtracted
156
+ * @throws {TypeError} 2 arguments required
157
+ *
158
+ * @example
159
+ * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
160
+ * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
161
+ * //=> Thu Jul 10 2014 12:45:29.250
162
+ */
163
+ function subMilliseconds(dirtyDate, dirtyAmount) {
164
+ utils.requiredArgs(2, arguments);
165
+ var amount = toInteger(dirtyAmount);
166
+ return addMilliseconds(dirtyDate, -amount);
167
+ }
168
+
169
+ var MILLISECONDS_IN_DAY = 86400000;
170
+ function getUTCDayOfYear(dirtyDate) {
171
+ utils.requiredArgs(1, arguments);
172
+ var date = utils.toDate(dirtyDate);
173
+ var timestamp = date.getTime();
174
+ date.setUTCMonth(0, 1);
175
+ date.setUTCHours(0, 0, 0, 0);
176
+ var startOfYearTimestamp = date.getTime();
177
+ var difference = timestamp - startOfYearTimestamp;
178
+ return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
179
+ }
180
+
181
+ function startOfUTCISOWeek(dirtyDate) {
182
+ utils.requiredArgs(1, arguments);
183
+ var weekStartsOn = 1;
184
+ var date = utils.toDate(dirtyDate);
185
+ var day = date.getUTCDay();
186
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
187
+ date.setUTCDate(date.getUTCDate() - diff);
188
+ date.setUTCHours(0, 0, 0, 0);
189
+ return date;
190
+ }
191
+
192
+ function getUTCISOWeekYear(dirtyDate) {
193
+ utils.requiredArgs(1, arguments);
194
+ var date = utils.toDate(dirtyDate);
195
+ var year = date.getUTCFullYear();
196
+ var fourthOfJanuaryOfNextYear = new Date(0);
197
+ fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
198
+ fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
199
+ var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
200
+ var fourthOfJanuaryOfThisYear = new Date(0);
201
+ fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
202
+ fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
203
+ var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);
204
+ if (date.getTime() >= startOfNextYear.getTime()) {
205
+ return year + 1;
206
+ } else if (date.getTime() >= startOfThisYear.getTime()) {
207
+ return year;
208
+ } else {
209
+ return year - 1;
210
+ }
211
+ }
212
+
213
+ function startOfUTCISOWeekYear(dirtyDate) {
214
+ utils.requiredArgs(1, arguments);
215
+ var year = getUTCISOWeekYear(dirtyDate);
216
+ var fourthOfJanuary = new Date(0);
217
+ fourthOfJanuary.setUTCFullYear(year, 0, 4);
218
+ fourthOfJanuary.setUTCHours(0, 0, 0, 0);
219
+ var date = startOfUTCISOWeek(fourthOfJanuary);
220
+ return date;
221
+ }
222
+
223
+ var MILLISECONDS_IN_WEEK$1 = 604800000;
224
+ function getUTCISOWeek(dirtyDate) {
225
+ utils.requiredArgs(1, arguments);
226
+ var date = utils.toDate(dirtyDate);
227
+ var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime();
228
+
229
+ // Round the number of days to the nearest integer
230
+ // because the number of milliseconds in a week is not constant
231
+ // (e.g. it's different in the week of the daylight saving time clock shift)
232
+ return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;
233
+ }
234
+
235
+ function startOfUTCWeek(dirtyDate, options) {
236
+ var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
237
+ utils.requiredArgs(1, arguments);
238
+ var defaultOptions = getDefaultOptions();
239
+ var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0);
240
+
241
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
242
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
243
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
244
+ }
245
+ var date = utils.toDate(dirtyDate);
246
+ var day = date.getUTCDay();
247
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
248
+ date.setUTCDate(date.getUTCDate() - diff);
249
+ date.setUTCHours(0, 0, 0, 0);
250
+ return date;
251
+ }
252
+
253
+ function getUTCWeekYear(dirtyDate, options) {
254
+ var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
255
+ utils.requiredArgs(1, arguments);
256
+ var date = utils.toDate(dirtyDate);
257
+ var year = date.getUTCFullYear();
258
+ var defaultOptions = getDefaultOptions();
259
+ var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
260
+
261
+ // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
262
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
263
+ throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
264
+ }
265
+ var firstWeekOfNextYear = new Date(0);
266
+ firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
267
+ firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
268
+ var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);
269
+ var firstWeekOfThisYear = new Date(0);
270
+ firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
271
+ firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
272
+ var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);
273
+ if (date.getTime() >= startOfNextYear.getTime()) {
274
+ return year + 1;
275
+ } else if (date.getTime() >= startOfThisYear.getTime()) {
276
+ return year;
277
+ } else {
278
+ return year - 1;
279
+ }
280
+ }
281
+
282
+ function startOfUTCWeekYear(dirtyDate, options) {
283
+ var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
284
+ utils.requiredArgs(1, arguments);
285
+ var defaultOptions = getDefaultOptions();
286
+ var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
287
+ var year = getUTCWeekYear(dirtyDate, options);
288
+ var firstWeek = new Date(0);
289
+ firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
290
+ firstWeek.setUTCHours(0, 0, 0, 0);
291
+ var date = startOfUTCWeek(firstWeek, options);
292
+ return date;
293
+ }
294
+
295
+ var MILLISECONDS_IN_WEEK = 604800000;
296
+ function getUTCWeek(dirtyDate, options) {
297
+ utils.requiredArgs(1, arguments);
298
+ var date = utils.toDate(dirtyDate);
299
+ var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime();
300
+
301
+ // Round the number of days to the nearest integer
302
+ // because the number of milliseconds in a week is not constant
303
+ // (e.g. it's different in the week of the daylight saving time clock shift)
304
+ return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
305
+ }
306
+
307
+ function addLeadingZeros(number, targetLength) {
308
+ var sign = number < 0 ? '-' : '';
309
+ var output = Math.abs(number).toString();
310
+ while (output.length < targetLength) {
311
+ output = '0' + output;
312
+ }
313
+ return sign + output;
314
+ }
315
+
316
+ /*
317
+ * | | Unit | | Unit |
318
+ * |-----|--------------------------------|-----|--------------------------------|
319
+ * | a | AM, PM | A* | |
320
+ * | d | Day of month | D | |
321
+ * | h | Hour [1-12] | H | Hour [0-23] |
322
+ * | m | Minute | M | Month |
323
+ * | s | Second | S | Fraction of second |
324
+ * | y | Year (abs) | Y | |
325
+ *
326
+ * Letters marked by * are not implemented but reserved by Unicode standard.
327
+ */
328
+ var formatters$2 = {
329
+ // Year
330
+ y: function y(date, token) {
331
+ // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
332
+ // | Year | y | yy | yyy | yyyy | yyyyy |
333
+ // |----------|-------|----|-------|-------|-------|
334
+ // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
335
+ // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
336
+ // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
337
+ // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
338
+ // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
339
+
340
+ var signedYear = date.getUTCFullYear();
341
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
342
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
343
+ return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
344
+ },
345
+ // Month
346
+ M: function M(date, token) {
347
+ var month = date.getUTCMonth();
348
+ return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
349
+ },
350
+ // Day of the month
351
+ d: function d(date, token) {
352
+ return addLeadingZeros(date.getUTCDate(), token.length);
353
+ },
354
+ // AM or PM
355
+ a: function a(date, token) {
356
+ var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
357
+ switch (token) {
358
+ case 'a':
359
+ case 'aa':
360
+ return dayPeriodEnumValue.toUpperCase();
361
+ case 'aaa':
362
+ return dayPeriodEnumValue;
363
+ case 'aaaaa':
364
+ return dayPeriodEnumValue[0];
365
+ case 'aaaa':
366
+ default:
367
+ return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
368
+ }
369
+ },
370
+ // Hour [1-12]
371
+ h: function h(date, token) {
372
+ return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
373
+ },
374
+ // Hour [0-23]
375
+ H: function H(date, token) {
376
+ return addLeadingZeros(date.getUTCHours(), token.length);
377
+ },
378
+ // Minute
379
+ m: function m(date, token) {
380
+ return addLeadingZeros(date.getUTCMinutes(), token.length);
381
+ },
382
+ // Second
383
+ s: function s(date, token) {
384
+ return addLeadingZeros(date.getUTCSeconds(), token.length);
385
+ },
386
+ // Fraction of second
387
+ S: function S(date, token) {
388
+ var numberOfDigits = token.length;
389
+ var milliseconds = date.getUTCMilliseconds();
390
+ var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
391
+ return addLeadingZeros(fractionalSeconds, token.length);
392
+ }
393
+ };
394
+ const formatters$3 = formatters$2;
395
+
396
+ var dayPeriodEnum = {
397
+ am: 'am',
398
+ pm: 'pm',
399
+ midnight: 'midnight',
400
+ noon: 'noon',
401
+ morning: 'morning',
402
+ afternoon: 'afternoon',
403
+ evening: 'evening',
404
+ night: 'night'
405
+ };
406
+ /*
407
+ * | | Unit | | Unit |
408
+ * |-----|--------------------------------|-----|--------------------------------|
409
+ * | a | AM, PM | A* | Milliseconds in day |
410
+ * | b | AM, PM, noon, midnight | B | Flexible day period |
411
+ * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
412
+ * | d | Day of month | D | Day of year |
413
+ * | e | Local day of week | E | Day of week |
414
+ * | f | | F* | Day of week in month |
415
+ * | g* | Modified Julian day | G | Era |
416
+ * | h | Hour [1-12] | H | Hour [0-23] |
417
+ * | i! | ISO day of week | I! | ISO week of year |
418
+ * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
419
+ * | k | Hour [1-24] | K | Hour [0-11] |
420
+ * | l* | (deprecated) | L | Stand-alone month |
421
+ * | m | Minute | M | Month |
422
+ * | n | | N | |
423
+ * | o! | Ordinal number modifier | O | Timezone (GMT) |
424
+ * | p! | Long localized time | P! | Long localized date |
425
+ * | q | Stand-alone quarter | Q | Quarter |
426
+ * | r* | Related Gregorian year | R! | ISO week-numbering year |
427
+ * | s | Second | S | Fraction of second |
428
+ * | t! | Seconds timestamp | T! | Milliseconds timestamp |
429
+ * | u | Extended year | U* | Cyclic year |
430
+ * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
431
+ * | w | Local week of year | W* | Week of month |
432
+ * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
433
+ * | y | Year (abs) | Y | Local week-numbering year |
434
+ * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
435
+ *
436
+ * Letters marked by * are not implemented but reserved by Unicode standard.
437
+ *
438
+ * Letters marked by ! are non-standard, but implemented by date-fns:
439
+ * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
440
+ * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
441
+ * i.e. 7 for Sunday, 1 for Monday, etc.
442
+ * - `I` is ISO week of year, as opposed to `w` which is local week of year.
443
+ * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
444
+ * `R` is supposed to be used in conjunction with `I` and `i`
445
+ * for universal ISO week-numbering date, whereas
446
+ * `Y` is supposed to be used in conjunction with `w` and `e`
447
+ * for week-numbering date specific to the locale.
448
+ * - `P` is long localized date format
449
+ * - `p` is long localized time format
450
+ */
451
+
452
+ var formatters = {
453
+ // Era
454
+ G: function G(date, token, localize) {
455
+ var era = date.getUTCFullYear() > 0 ? 1 : 0;
456
+ switch (token) {
457
+ // AD, BC
458
+ case 'G':
459
+ case 'GG':
460
+ case 'GGG':
461
+ return localize.era(era, {
462
+ width: 'abbreviated'
463
+ });
464
+ // A, B
465
+ case 'GGGGG':
466
+ return localize.era(era, {
467
+ width: 'narrow'
468
+ });
469
+ // Anno Domini, Before Christ
470
+ case 'GGGG':
471
+ default:
472
+ return localize.era(era, {
473
+ width: 'wide'
474
+ });
475
+ }
476
+ },
477
+ // Year
478
+ y: function y(date, token, localize) {
479
+ // Ordinal number
480
+ if (token === 'yo') {
481
+ var signedYear = date.getUTCFullYear();
482
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
483
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
484
+ return localize.ordinalNumber(year, {
485
+ unit: 'year'
486
+ });
487
+ }
488
+ return formatters$3.y(date, token);
489
+ },
490
+ // Local week-numbering year
491
+ Y: function Y(date, token, localize, options) {
492
+ var signedWeekYear = getUTCWeekYear(date, options);
493
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
494
+ var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
495
+
496
+ // Two digit year
497
+ if (token === 'YY') {
498
+ var twoDigitYear = weekYear % 100;
499
+ return addLeadingZeros(twoDigitYear, 2);
500
+ }
501
+
502
+ // Ordinal number
503
+ if (token === 'Yo') {
504
+ return localize.ordinalNumber(weekYear, {
505
+ unit: 'year'
506
+ });
507
+ }
508
+
509
+ // Padding
510
+ return addLeadingZeros(weekYear, token.length);
511
+ },
512
+ // ISO week-numbering year
513
+ R: function R(date, token) {
514
+ var isoWeekYear = getUTCISOWeekYear(date);
515
+
516
+ // Padding
517
+ return addLeadingZeros(isoWeekYear, token.length);
518
+ },
519
+ // Extended year. This is a single number designating the year of this calendar system.
520
+ // The main difference between `y` and `u` localizers are B.C. years:
521
+ // | Year | `y` | `u` |
522
+ // |------|-----|-----|
523
+ // | AC 1 | 1 | 1 |
524
+ // | BC 1 | 1 | 0 |
525
+ // | BC 2 | 2 | -1 |
526
+ // Also `yy` always returns the last two digits of a year,
527
+ // while `uu` pads single digit years to 2 characters and returns other years unchanged.
528
+ u: function u(date, token) {
529
+ var year = date.getUTCFullYear();
530
+ return addLeadingZeros(year, token.length);
531
+ },
532
+ // Quarter
533
+ Q: function Q(date, token, localize) {
534
+ var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
535
+ switch (token) {
536
+ // 1, 2, 3, 4
537
+ case 'Q':
538
+ return String(quarter);
539
+ // 01, 02, 03, 04
540
+ case 'QQ':
541
+ return addLeadingZeros(quarter, 2);
542
+ // 1st, 2nd, 3rd, 4th
543
+ case 'Qo':
544
+ return localize.ordinalNumber(quarter, {
545
+ unit: 'quarter'
546
+ });
547
+ // Q1, Q2, Q3, Q4
548
+ case 'QQQ':
549
+ return localize.quarter(quarter, {
550
+ width: 'abbreviated',
551
+ context: 'formatting'
552
+ });
553
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
554
+ case 'QQQQQ':
555
+ return localize.quarter(quarter, {
556
+ width: 'narrow',
557
+ context: 'formatting'
558
+ });
559
+ // 1st quarter, 2nd quarter, ...
560
+ case 'QQQQ':
561
+ default:
562
+ return localize.quarter(quarter, {
563
+ width: 'wide',
564
+ context: 'formatting'
565
+ });
566
+ }
567
+ },
568
+ // Stand-alone quarter
569
+ q: function q(date, token, localize) {
570
+ var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
571
+ switch (token) {
572
+ // 1, 2, 3, 4
573
+ case 'q':
574
+ return String(quarter);
575
+ // 01, 02, 03, 04
576
+ case 'qq':
577
+ return addLeadingZeros(quarter, 2);
578
+ // 1st, 2nd, 3rd, 4th
579
+ case 'qo':
580
+ return localize.ordinalNumber(quarter, {
581
+ unit: 'quarter'
582
+ });
583
+ // Q1, Q2, Q3, Q4
584
+ case 'qqq':
585
+ return localize.quarter(quarter, {
586
+ width: 'abbreviated',
587
+ context: 'standalone'
588
+ });
589
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
590
+ case 'qqqqq':
591
+ return localize.quarter(quarter, {
592
+ width: 'narrow',
593
+ context: 'standalone'
594
+ });
595
+ // 1st quarter, 2nd quarter, ...
596
+ case 'qqqq':
597
+ default:
598
+ return localize.quarter(quarter, {
599
+ width: 'wide',
600
+ context: 'standalone'
601
+ });
602
+ }
603
+ },
604
+ // Month
605
+ M: function M(date, token, localize) {
606
+ var month = date.getUTCMonth();
607
+ switch (token) {
608
+ case 'M':
609
+ case 'MM':
610
+ return formatters$3.M(date, token);
611
+ // 1st, 2nd, ..., 12th
612
+ case 'Mo':
613
+ return localize.ordinalNumber(month + 1, {
614
+ unit: 'month'
615
+ });
616
+ // Jan, Feb, ..., Dec
617
+ case 'MMM':
618
+ return localize.month(month, {
619
+ width: 'abbreviated',
620
+ context: 'formatting'
621
+ });
622
+ // J, F, ..., D
623
+ case 'MMMMM':
624
+ return localize.month(month, {
625
+ width: 'narrow',
626
+ context: 'formatting'
627
+ });
628
+ // January, February, ..., December
629
+ case 'MMMM':
630
+ default:
631
+ return localize.month(month, {
632
+ width: 'wide',
633
+ context: 'formatting'
634
+ });
635
+ }
636
+ },
637
+ // Stand-alone month
638
+ L: function L(date, token, localize) {
639
+ var month = date.getUTCMonth();
640
+ switch (token) {
641
+ // 1, 2, ..., 12
642
+ case 'L':
643
+ return String(month + 1);
644
+ // 01, 02, ..., 12
645
+ case 'LL':
646
+ return addLeadingZeros(month + 1, 2);
647
+ // 1st, 2nd, ..., 12th
648
+ case 'Lo':
649
+ return localize.ordinalNumber(month + 1, {
650
+ unit: 'month'
651
+ });
652
+ // Jan, Feb, ..., Dec
653
+ case 'LLL':
654
+ return localize.month(month, {
655
+ width: 'abbreviated',
656
+ context: 'standalone'
657
+ });
658
+ // J, F, ..., D
659
+ case 'LLLLL':
660
+ return localize.month(month, {
661
+ width: 'narrow',
662
+ context: 'standalone'
663
+ });
664
+ // January, February, ..., December
665
+ case 'LLLL':
666
+ default:
667
+ return localize.month(month, {
668
+ width: 'wide',
669
+ context: 'standalone'
670
+ });
671
+ }
672
+ },
673
+ // Local week of year
674
+ w: function w(date, token, localize, options) {
675
+ var week = getUTCWeek(date, options);
676
+ if (token === 'wo') {
677
+ return localize.ordinalNumber(week, {
678
+ unit: 'week'
679
+ });
680
+ }
681
+ return addLeadingZeros(week, token.length);
682
+ },
683
+ // ISO week of year
684
+ I: function I(date, token, localize) {
685
+ var isoWeek = getUTCISOWeek(date);
686
+ if (token === 'Io') {
687
+ return localize.ordinalNumber(isoWeek, {
688
+ unit: 'week'
689
+ });
690
+ }
691
+ return addLeadingZeros(isoWeek, token.length);
692
+ },
693
+ // Day of the month
694
+ d: function d(date, token, localize) {
695
+ if (token === 'do') {
696
+ return localize.ordinalNumber(date.getUTCDate(), {
697
+ unit: 'date'
698
+ });
699
+ }
700
+ return formatters$3.d(date, token);
701
+ },
702
+ // Day of year
703
+ D: function D(date, token, localize) {
704
+ var dayOfYear = getUTCDayOfYear(date);
705
+ if (token === 'Do') {
706
+ return localize.ordinalNumber(dayOfYear, {
707
+ unit: 'dayOfYear'
708
+ });
709
+ }
710
+ return addLeadingZeros(dayOfYear, token.length);
711
+ },
712
+ // Day of week
713
+ E: function E(date, token, localize) {
714
+ var dayOfWeek = date.getUTCDay();
715
+ switch (token) {
716
+ // Tue
717
+ case 'E':
718
+ case 'EE':
719
+ case 'EEE':
720
+ return localize.day(dayOfWeek, {
721
+ width: 'abbreviated',
722
+ context: 'formatting'
723
+ });
724
+ // T
725
+ case 'EEEEE':
726
+ return localize.day(dayOfWeek, {
727
+ width: 'narrow',
728
+ context: 'formatting'
729
+ });
730
+ // Tu
731
+ case 'EEEEEE':
732
+ return localize.day(dayOfWeek, {
733
+ width: 'short',
734
+ context: 'formatting'
735
+ });
736
+ // Tuesday
737
+ case 'EEEE':
738
+ default:
739
+ return localize.day(dayOfWeek, {
740
+ width: 'wide',
741
+ context: 'formatting'
742
+ });
743
+ }
744
+ },
745
+ // Local day of week
746
+ e: function e(date, token, localize, options) {
747
+ var dayOfWeek = date.getUTCDay();
748
+ var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
749
+ switch (token) {
750
+ // Numerical value (Nth day of week with current locale or weekStartsOn)
751
+ case 'e':
752
+ return String(localDayOfWeek);
753
+ // Padded numerical value
754
+ case 'ee':
755
+ return addLeadingZeros(localDayOfWeek, 2);
756
+ // 1st, 2nd, ..., 7th
757
+ case 'eo':
758
+ return localize.ordinalNumber(localDayOfWeek, {
759
+ unit: 'day'
760
+ });
761
+ case 'eee':
762
+ return localize.day(dayOfWeek, {
763
+ width: 'abbreviated',
764
+ context: 'formatting'
765
+ });
766
+ // T
767
+ case 'eeeee':
768
+ return localize.day(dayOfWeek, {
769
+ width: 'narrow',
770
+ context: 'formatting'
771
+ });
772
+ // Tu
773
+ case 'eeeeee':
774
+ return localize.day(dayOfWeek, {
775
+ width: 'short',
776
+ context: 'formatting'
777
+ });
778
+ // Tuesday
779
+ case 'eeee':
780
+ default:
781
+ return localize.day(dayOfWeek, {
782
+ width: 'wide',
783
+ context: 'formatting'
784
+ });
785
+ }
786
+ },
787
+ // Stand-alone local day of week
788
+ c: function c(date, token, localize, options) {
789
+ var dayOfWeek = date.getUTCDay();
790
+ var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
791
+ switch (token) {
792
+ // Numerical value (same as in `e`)
793
+ case 'c':
794
+ return String(localDayOfWeek);
795
+ // Padded numerical value
796
+ case 'cc':
797
+ return addLeadingZeros(localDayOfWeek, token.length);
798
+ // 1st, 2nd, ..., 7th
799
+ case 'co':
800
+ return localize.ordinalNumber(localDayOfWeek, {
801
+ unit: 'day'
802
+ });
803
+ case 'ccc':
804
+ return localize.day(dayOfWeek, {
805
+ width: 'abbreviated',
806
+ context: 'standalone'
807
+ });
808
+ // T
809
+ case 'ccccc':
810
+ return localize.day(dayOfWeek, {
811
+ width: 'narrow',
812
+ context: 'standalone'
813
+ });
814
+ // Tu
815
+ case 'cccccc':
816
+ return localize.day(dayOfWeek, {
817
+ width: 'short',
818
+ context: 'standalone'
819
+ });
820
+ // Tuesday
821
+ case 'cccc':
822
+ default:
823
+ return localize.day(dayOfWeek, {
824
+ width: 'wide',
825
+ context: 'standalone'
826
+ });
827
+ }
828
+ },
829
+ // ISO day of week
830
+ i: function i(date, token, localize) {
831
+ var dayOfWeek = date.getUTCDay();
832
+ var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
833
+ switch (token) {
834
+ // 2
835
+ case 'i':
836
+ return String(isoDayOfWeek);
837
+ // 02
838
+ case 'ii':
839
+ return addLeadingZeros(isoDayOfWeek, token.length);
840
+ // 2nd
841
+ case 'io':
842
+ return localize.ordinalNumber(isoDayOfWeek, {
843
+ unit: 'day'
844
+ });
845
+ // Tue
846
+ case 'iii':
847
+ return localize.day(dayOfWeek, {
848
+ width: 'abbreviated',
849
+ context: 'formatting'
850
+ });
851
+ // T
852
+ case 'iiiii':
853
+ return localize.day(dayOfWeek, {
854
+ width: 'narrow',
855
+ context: 'formatting'
856
+ });
857
+ // Tu
858
+ case 'iiiiii':
859
+ return localize.day(dayOfWeek, {
860
+ width: 'short',
861
+ context: 'formatting'
862
+ });
863
+ // Tuesday
864
+ case 'iiii':
865
+ default:
866
+ return localize.day(dayOfWeek, {
867
+ width: 'wide',
868
+ context: 'formatting'
869
+ });
870
+ }
871
+ },
872
+ // AM or PM
873
+ a: function a(date, token, localize) {
874
+ var hours = date.getUTCHours();
875
+ var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
876
+ switch (token) {
877
+ case 'a':
878
+ case 'aa':
879
+ return localize.dayPeriod(dayPeriodEnumValue, {
880
+ width: 'abbreviated',
881
+ context: 'formatting'
882
+ });
883
+ case 'aaa':
884
+ return localize.dayPeriod(dayPeriodEnumValue, {
885
+ width: 'abbreviated',
886
+ context: 'formatting'
887
+ }).toLowerCase();
888
+ case 'aaaaa':
889
+ return localize.dayPeriod(dayPeriodEnumValue, {
890
+ width: 'narrow',
891
+ context: 'formatting'
892
+ });
893
+ case 'aaaa':
894
+ default:
895
+ return localize.dayPeriod(dayPeriodEnumValue, {
896
+ width: 'wide',
897
+ context: 'formatting'
898
+ });
899
+ }
900
+ },
901
+ // AM, PM, midnight, noon
902
+ b: function b(date, token, localize) {
903
+ var hours = date.getUTCHours();
904
+ var dayPeriodEnumValue;
905
+ if (hours === 12) {
906
+ dayPeriodEnumValue = dayPeriodEnum.noon;
907
+ } else if (hours === 0) {
908
+ dayPeriodEnumValue = dayPeriodEnum.midnight;
909
+ } else {
910
+ dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
911
+ }
912
+ switch (token) {
913
+ case 'b':
914
+ case 'bb':
915
+ return localize.dayPeriod(dayPeriodEnumValue, {
916
+ width: 'abbreviated',
917
+ context: 'formatting'
918
+ });
919
+ case 'bbb':
920
+ return localize.dayPeriod(dayPeriodEnumValue, {
921
+ width: 'abbreviated',
922
+ context: 'formatting'
923
+ }).toLowerCase();
924
+ case 'bbbbb':
925
+ return localize.dayPeriod(dayPeriodEnumValue, {
926
+ width: 'narrow',
927
+ context: 'formatting'
928
+ });
929
+ case 'bbbb':
930
+ default:
931
+ return localize.dayPeriod(dayPeriodEnumValue, {
932
+ width: 'wide',
933
+ context: 'formatting'
934
+ });
935
+ }
936
+ },
937
+ // in the morning, in the afternoon, in the evening, at night
938
+ B: function B(date, token, localize) {
939
+ var hours = date.getUTCHours();
940
+ var dayPeriodEnumValue;
941
+ if (hours >= 17) {
942
+ dayPeriodEnumValue = dayPeriodEnum.evening;
943
+ } else if (hours >= 12) {
944
+ dayPeriodEnumValue = dayPeriodEnum.afternoon;
945
+ } else if (hours >= 4) {
946
+ dayPeriodEnumValue = dayPeriodEnum.morning;
947
+ } else {
948
+ dayPeriodEnumValue = dayPeriodEnum.night;
949
+ }
950
+ switch (token) {
951
+ case 'B':
952
+ case 'BB':
953
+ case 'BBB':
954
+ return localize.dayPeriod(dayPeriodEnumValue, {
955
+ width: 'abbreviated',
956
+ context: 'formatting'
957
+ });
958
+ case 'BBBBB':
959
+ return localize.dayPeriod(dayPeriodEnumValue, {
960
+ width: 'narrow',
961
+ context: 'formatting'
962
+ });
963
+ case 'BBBB':
964
+ default:
965
+ return localize.dayPeriod(dayPeriodEnumValue, {
966
+ width: 'wide',
967
+ context: 'formatting'
968
+ });
969
+ }
970
+ },
971
+ // Hour [1-12]
972
+ h: function h(date, token, localize) {
973
+ if (token === 'ho') {
974
+ var hours = date.getUTCHours() % 12;
975
+ if (hours === 0) hours = 12;
976
+ return localize.ordinalNumber(hours, {
977
+ unit: 'hour'
978
+ });
979
+ }
980
+ return formatters$3.h(date, token);
981
+ },
982
+ // Hour [0-23]
983
+ H: function H(date, token, localize) {
984
+ if (token === 'Ho') {
985
+ return localize.ordinalNumber(date.getUTCHours(), {
986
+ unit: 'hour'
987
+ });
988
+ }
989
+ return formatters$3.H(date, token);
990
+ },
991
+ // Hour [0-11]
992
+ K: function K(date, token, localize) {
993
+ var hours = date.getUTCHours() % 12;
994
+ if (token === 'Ko') {
995
+ return localize.ordinalNumber(hours, {
996
+ unit: 'hour'
997
+ });
998
+ }
999
+ return addLeadingZeros(hours, token.length);
1000
+ },
1001
+ // Hour [1-24]
1002
+ k: function k(date, token, localize) {
1003
+ var hours = date.getUTCHours();
1004
+ if (hours === 0) hours = 24;
1005
+ if (token === 'ko') {
1006
+ return localize.ordinalNumber(hours, {
1007
+ unit: 'hour'
1008
+ });
1009
+ }
1010
+ return addLeadingZeros(hours, token.length);
1011
+ },
1012
+ // Minute
1013
+ m: function m(date, token, localize) {
1014
+ if (token === 'mo') {
1015
+ return localize.ordinalNumber(date.getUTCMinutes(), {
1016
+ unit: 'minute'
1017
+ });
1018
+ }
1019
+ return formatters$3.m(date, token);
1020
+ },
1021
+ // Second
1022
+ s: function s(date, token, localize) {
1023
+ if (token === 'so') {
1024
+ return localize.ordinalNumber(date.getUTCSeconds(), {
1025
+ unit: 'second'
1026
+ });
1027
+ }
1028
+ return formatters$3.s(date, token);
1029
+ },
1030
+ // Fraction of second
1031
+ S: function S(date, token) {
1032
+ return formatters$3.S(date, token);
1033
+ },
1034
+ // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
1035
+ X: function X(date, token, _localize, options) {
1036
+ var originalDate = options._originalDate || date;
1037
+ var timezoneOffset = originalDate.getTimezoneOffset();
1038
+ if (timezoneOffset === 0) {
1039
+ return 'Z';
1040
+ }
1041
+ switch (token) {
1042
+ // Hours and optional minutes
1043
+ case 'X':
1044
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
1045
+
1046
+ // Hours, minutes and optional seconds without `:` delimiter
1047
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1048
+ // so this token always has the same output as `XX`
1049
+ case 'XXXX':
1050
+ case 'XX':
1051
+ // Hours and minutes without `:` delimiter
1052
+ return formatTimezone(timezoneOffset);
1053
+
1054
+ // Hours, minutes and optional seconds with `:` delimiter
1055
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1056
+ // so this token always has the same output as `XXX`
1057
+ case 'XXXXX':
1058
+ case 'XXX': // Hours and minutes with `:` delimiter
1059
+ default:
1060
+ return formatTimezone(timezoneOffset, ':');
1061
+ }
1062
+ },
1063
+ // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
1064
+ x: function x(date, token, _localize, options) {
1065
+ var originalDate = options._originalDate || date;
1066
+ var timezoneOffset = originalDate.getTimezoneOffset();
1067
+ switch (token) {
1068
+ // Hours and optional minutes
1069
+ case 'x':
1070
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
1071
+
1072
+ // Hours, minutes and optional seconds without `:` delimiter
1073
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1074
+ // so this token always has the same output as `xx`
1075
+ case 'xxxx':
1076
+ case 'xx':
1077
+ // Hours and minutes without `:` delimiter
1078
+ return formatTimezone(timezoneOffset);
1079
+
1080
+ // Hours, minutes and optional seconds with `:` delimiter
1081
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1082
+ // so this token always has the same output as `xxx`
1083
+ case 'xxxxx':
1084
+ case 'xxx': // Hours and minutes with `:` delimiter
1085
+ default:
1086
+ return formatTimezone(timezoneOffset, ':');
1087
+ }
1088
+ },
1089
+ // Timezone (GMT)
1090
+ O: function O(date, token, _localize, options) {
1091
+ var originalDate = options._originalDate || date;
1092
+ var timezoneOffset = originalDate.getTimezoneOffset();
1093
+ switch (token) {
1094
+ // Short
1095
+ case 'O':
1096
+ case 'OO':
1097
+ case 'OOO':
1098
+ return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
1099
+ // Long
1100
+ case 'OOOO':
1101
+ default:
1102
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
1103
+ }
1104
+ },
1105
+ // Timezone (specific non-location)
1106
+ z: function z(date, token, _localize, options) {
1107
+ var originalDate = options._originalDate || date;
1108
+ var timezoneOffset = originalDate.getTimezoneOffset();
1109
+ switch (token) {
1110
+ // Short
1111
+ case 'z':
1112
+ case 'zz':
1113
+ case 'zzz':
1114
+ return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
1115
+ // Long
1116
+ case 'zzzz':
1117
+ default:
1118
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
1119
+ }
1120
+ },
1121
+ // Seconds timestamp
1122
+ t: function t(date, token, _localize, options) {
1123
+ var originalDate = options._originalDate || date;
1124
+ var timestamp = Math.floor(originalDate.getTime() / 1000);
1125
+ return addLeadingZeros(timestamp, token.length);
1126
+ },
1127
+ // Milliseconds timestamp
1128
+ T: function T(date, token, _localize, options) {
1129
+ var originalDate = options._originalDate || date;
1130
+ var timestamp = originalDate.getTime();
1131
+ return addLeadingZeros(timestamp, token.length);
1132
+ }
1133
+ };
1134
+ function formatTimezoneShort(offset, dirtyDelimiter) {
1135
+ var sign = offset > 0 ? '-' : '+';
1136
+ var absOffset = Math.abs(offset);
1137
+ var hours = Math.floor(absOffset / 60);
1138
+ var minutes = absOffset % 60;
1139
+ if (minutes === 0) {
1140
+ return sign + String(hours);
1141
+ }
1142
+ var delimiter = dirtyDelimiter || '';
1143
+ return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
1144
+ }
1145
+ function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
1146
+ if (offset % 60 === 0) {
1147
+ var sign = offset > 0 ? '-' : '+';
1148
+ return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
1149
+ }
1150
+ return formatTimezone(offset, dirtyDelimiter);
1151
+ }
1152
+ function formatTimezone(offset, dirtyDelimiter) {
1153
+ var delimiter = dirtyDelimiter || '';
1154
+ var sign = offset > 0 ? '-' : '+';
1155
+ var absOffset = Math.abs(offset);
1156
+ var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
1157
+ var minutes = addLeadingZeros(absOffset % 60, 2);
1158
+ return sign + hours + delimiter + minutes;
1159
+ }
1160
+ const formatters$1 = formatters;
1161
+
1162
+ var dateLongFormatter = function dateLongFormatter(pattern, formatLong) {
1163
+ switch (pattern) {
1164
+ case 'P':
1165
+ return formatLong.date({
1166
+ width: 'short'
1167
+ });
1168
+ case 'PP':
1169
+ return formatLong.date({
1170
+ width: 'medium'
1171
+ });
1172
+ case 'PPP':
1173
+ return formatLong.date({
1174
+ width: 'long'
1175
+ });
1176
+ case 'PPPP':
1177
+ default:
1178
+ return formatLong.date({
1179
+ width: 'full'
1180
+ });
1181
+ }
1182
+ };
1183
+ var timeLongFormatter = function timeLongFormatter(pattern, formatLong) {
1184
+ switch (pattern) {
1185
+ case 'p':
1186
+ return formatLong.time({
1187
+ width: 'short'
1188
+ });
1189
+ case 'pp':
1190
+ return formatLong.time({
1191
+ width: 'medium'
1192
+ });
1193
+ case 'ppp':
1194
+ return formatLong.time({
1195
+ width: 'long'
1196
+ });
1197
+ case 'pppp':
1198
+ default:
1199
+ return formatLong.time({
1200
+ width: 'full'
1201
+ });
1202
+ }
1203
+ };
1204
+ var dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) {
1205
+ var matchResult = pattern.match(/(P+)(p+)?/) || [];
1206
+ var datePattern = matchResult[1];
1207
+ var timePattern = matchResult[2];
1208
+ if (!timePattern) {
1209
+ return dateLongFormatter(pattern, formatLong);
1210
+ }
1211
+ var dateTimeFormat;
1212
+ switch (datePattern) {
1213
+ case 'P':
1214
+ dateTimeFormat = formatLong.dateTime({
1215
+ width: 'short'
1216
+ });
1217
+ break;
1218
+ case 'PP':
1219
+ dateTimeFormat = formatLong.dateTime({
1220
+ width: 'medium'
1221
+ });
1222
+ break;
1223
+ case 'PPP':
1224
+ dateTimeFormat = formatLong.dateTime({
1225
+ width: 'long'
1226
+ });
1227
+ break;
1228
+ case 'PPPP':
1229
+ default:
1230
+ dateTimeFormat = formatLong.dateTime({
1231
+ width: 'full'
1232
+ });
1233
+ break;
1234
+ }
1235
+ return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
1236
+ };
1237
+ var longFormatters = {
1238
+ p: timeLongFormatter,
1239
+ P: dateTimeLongFormatter
1240
+ };
1241
+ const longFormatters$1 = longFormatters;
1242
+
1243
+ var protectedDayOfYearTokens = ['D', 'DD'];
1244
+ var protectedWeekYearTokens = ['YY', 'YYYY'];
1245
+ function isProtectedDayOfYearToken(token) {
1246
+ return protectedDayOfYearTokens.indexOf(token) !== -1;
1247
+ }
1248
+ function isProtectedWeekYearToken(token) {
1249
+ return protectedWeekYearTokens.indexOf(token) !== -1;
1250
+ }
1251
+ function throwProtectedError(token, format, input) {
1252
+ if (token === 'YYYY') {
1253
+ throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
1254
+ } else if (token === 'YY') {
1255
+ throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
1256
+ } else if (token === 'D') {
1257
+ throw new RangeError("Use `d` instead of `D` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
1258
+ } else if (token === 'DD') {
1259
+ throw new RangeError("Use `dd` instead of `DD` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
1260
+ }
1261
+ }
1262
+
1263
+ var formatDistanceLocale = {
1264
+ lessThanXSeconds: {
1265
+ one: 'less than a second',
1266
+ other: 'less than {{count}} seconds'
1267
+ },
1268
+ xSeconds: {
1269
+ one: '1 second',
1270
+ other: '{{count}} seconds'
1271
+ },
1272
+ halfAMinute: 'half a minute',
1273
+ lessThanXMinutes: {
1274
+ one: 'less than a minute',
1275
+ other: 'less than {{count}} minutes'
1276
+ },
1277
+ xMinutes: {
1278
+ one: '1 minute',
1279
+ other: '{{count}} minutes'
1280
+ },
1281
+ aboutXHours: {
1282
+ one: 'about 1 hour',
1283
+ other: 'about {{count}} hours'
1284
+ },
1285
+ xHours: {
1286
+ one: '1 hour',
1287
+ other: '{{count}} hours'
1288
+ },
1289
+ xDays: {
1290
+ one: '1 day',
1291
+ other: '{{count}} days'
1292
+ },
1293
+ aboutXWeeks: {
1294
+ one: 'about 1 week',
1295
+ other: 'about {{count}} weeks'
1296
+ },
1297
+ xWeeks: {
1298
+ one: '1 week',
1299
+ other: '{{count}} weeks'
1300
+ },
1301
+ aboutXMonths: {
1302
+ one: 'about 1 month',
1303
+ other: 'about {{count}} months'
1304
+ },
1305
+ xMonths: {
1306
+ one: '1 month',
1307
+ other: '{{count}} months'
1308
+ },
1309
+ aboutXYears: {
1310
+ one: 'about 1 year',
1311
+ other: 'about {{count}} years'
1312
+ },
1313
+ xYears: {
1314
+ one: '1 year',
1315
+ other: '{{count}} years'
1316
+ },
1317
+ overXYears: {
1318
+ one: 'over 1 year',
1319
+ other: 'over {{count}} years'
1320
+ },
1321
+ almostXYears: {
1322
+ one: 'almost 1 year',
1323
+ other: 'almost {{count}} years'
1324
+ }
1325
+ };
1326
+ var formatDistance = function formatDistance(token, count, options) {
1327
+ var result;
1328
+ var tokenValue = formatDistanceLocale[token];
1329
+ if (typeof tokenValue === 'string') {
1330
+ result = tokenValue;
1331
+ } else if (count === 1) {
1332
+ result = tokenValue.one;
1333
+ } else {
1334
+ result = tokenValue.other.replace('{{count}}', count.toString());
1335
+ }
1336
+ if (options !== null && options !== void 0 && options.addSuffix) {
1337
+ if (options.comparison && options.comparison > 0) {
1338
+ return 'in ' + result;
1339
+ } else {
1340
+ return result + ' ago';
1341
+ }
1342
+ }
1343
+ return result;
1344
+ };
1345
+ const formatDistance$1 = formatDistance;
1346
+
1347
+ function buildFormatLongFn(args) {
1348
+ return function () {
1349
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1350
+ // TODO: Remove String()
1351
+ var width = options.width ? String(options.width) : args.defaultWidth;
1352
+ var format = args.formats[width] || args.formats[args.defaultWidth];
1353
+ return format;
1354
+ };
1355
+ }
1356
+
1357
+ var dateFormats = {
1358
+ full: 'EEEE, MMMM do, y',
1359
+ long: 'MMMM do, y',
1360
+ medium: 'MMM d, y',
1361
+ short: 'MM/dd/yyyy'
1362
+ };
1363
+ var timeFormats = {
1364
+ full: 'h:mm:ss a zzzz',
1365
+ long: 'h:mm:ss a z',
1366
+ medium: 'h:mm:ss a',
1367
+ short: 'h:mm a'
1368
+ };
1369
+ var dateTimeFormats = {
1370
+ full: "{{date}} 'at' {{time}}",
1371
+ long: "{{date}} 'at' {{time}}",
1372
+ medium: '{{date}}, {{time}}',
1373
+ short: '{{date}}, {{time}}'
1374
+ };
1375
+ var formatLong = {
1376
+ date: buildFormatLongFn({
1377
+ formats: dateFormats,
1378
+ defaultWidth: 'full'
1379
+ }),
1380
+ time: buildFormatLongFn({
1381
+ formats: timeFormats,
1382
+ defaultWidth: 'full'
1383
+ }),
1384
+ dateTime: buildFormatLongFn({
1385
+ formats: dateTimeFormats,
1386
+ defaultWidth: 'full'
1387
+ })
1388
+ };
1389
+ const formatLong$1 = formatLong;
1390
+
1391
+ var formatRelativeLocale = {
1392
+ lastWeek: "'last' eeee 'at' p",
1393
+ yesterday: "'yesterday at' p",
1394
+ today: "'today at' p",
1395
+ tomorrow: "'tomorrow at' p",
1396
+ nextWeek: "eeee 'at' p",
1397
+ other: 'P'
1398
+ };
1399
+ var formatRelative = function formatRelative(token, _date, _baseDate, _options) {
1400
+ return formatRelativeLocale[token];
1401
+ };
1402
+ const formatRelative$1 = formatRelative;
1403
+
1404
+ function buildLocalizeFn(args) {
1405
+ return function (dirtyIndex, options) {
1406
+ var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';
1407
+ var valuesArray;
1408
+ if (context === 'formatting' && args.formattingValues) {
1409
+ var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
1410
+ var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
1411
+ valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
1412
+ } else {
1413
+ var _defaultWidth = args.defaultWidth;
1414
+ var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
1415
+ valuesArray = args.values[_width] || args.values[_defaultWidth];
1416
+ }
1417
+ var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
1418
+ // @ts-ignore: For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!
1419
+ return valuesArray[index];
1420
+ };
1421
+ }
1422
+
1423
+ var eraValues = {
1424
+ narrow: ['B', 'A'],
1425
+ abbreviated: ['BC', 'AD'],
1426
+ wide: ['Before Christ', 'Anno Domini']
1427
+ };
1428
+ var quarterValues = {
1429
+ narrow: ['1', '2', '3', '4'],
1430
+ abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
1431
+ wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
1432
+ };
1433
+
1434
+ // Note: in English, the names of days of the week and months are capitalized.
1435
+ // If you are making a new locale based on this one, check if the same is true for the language you're working on.
1436
+ // Generally, formatted dates should look like they are in the middle of a sentence,
1437
+ // e.g. in Spanish language the weekdays and months should be in the lowercase.
1438
+ var monthValues = {
1439
+ narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
1440
+ abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
1441
+ wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
1442
+ };
1443
+ var dayValues = {
1444
+ narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
1445
+ short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
1446
+ abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
1447
+ wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
1448
+ };
1449
+ var dayPeriodValues = {
1450
+ narrow: {
1451
+ am: 'a',
1452
+ pm: 'p',
1453
+ midnight: 'mi',
1454
+ noon: 'n',
1455
+ morning: 'morning',
1456
+ afternoon: 'afternoon',
1457
+ evening: 'evening',
1458
+ night: 'night'
1459
+ },
1460
+ abbreviated: {
1461
+ am: 'AM',
1462
+ pm: 'PM',
1463
+ midnight: 'midnight',
1464
+ noon: 'noon',
1465
+ morning: 'morning',
1466
+ afternoon: 'afternoon',
1467
+ evening: 'evening',
1468
+ night: 'night'
1469
+ },
1470
+ wide: {
1471
+ am: 'a.m.',
1472
+ pm: 'p.m.',
1473
+ midnight: 'midnight',
1474
+ noon: 'noon',
1475
+ morning: 'morning',
1476
+ afternoon: 'afternoon',
1477
+ evening: 'evening',
1478
+ night: 'night'
1479
+ }
1480
+ };
1481
+ var formattingDayPeriodValues = {
1482
+ narrow: {
1483
+ am: 'a',
1484
+ pm: 'p',
1485
+ midnight: 'mi',
1486
+ noon: 'n',
1487
+ morning: 'in the morning',
1488
+ afternoon: 'in the afternoon',
1489
+ evening: 'in the evening',
1490
+ night: 'at night'
1491
+ },
1492
+ abbreviated: {
1493
+ am: 'AM',
1494
+ pm: 'PM',
1495
+ midnight: 'midnight',
1496
+ noon: 'noon',
1497
+ morning: 'in the morning',
1498
+ afternoon: 'in the afternoon',
1499
+ evening: 'in the evening',
1500
+ night: 'at night'
1501
+ },
1502
+ wide: {
1503
+ am: 'a.m.',
1504
+ pm: 'p.m.',
1505
+ midnight: 'midnight',
1506
+ noon: 'noon',
1507
+ morning: 'in the morning',
1508
+ afternoon: 'in the afternoon',
1509
+ evening: 'in the evening',
1510
+ night: 'at night'
1511
+ }
1512
+ };
1513
+ var ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
1514
+ var number = Number(dirtyNumber);
1515
+
1516
+ // If ordinal numbers depend on context, for example,
1517
+ // if they are different for different grammatical genders,
1518
+ // use `options.unit`.
1519
+ //
1520
+ // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
1521
+ // 'day', 'hour', 'minute', 'second'.
1522
+
1523
+ var rem100 = number % 100;
1524
+ if (rem100 > 20 || rem100 < 10) {
1525
+ switch (rem100 % 10) {
1526
+ case 1:
1527
+ return number + 'st';
1528
+ case 2:
1529
+ return number + 'nd';
1530
+ case 3:
1531
+ return number + 'rd';
1532
+ }
1533
+ }
1534
+ return number + 'th';
1535
+ };
1536
+ var localize = {
1537
+ ordinalNumber: ordinalNumber,
1538
+ era: buildLocalizeFn({
1539
+ values: eraValues,
1540
+ defaultWidth: 'wide'
1541
+ }),
1542
+ quarter: buildLocalizeFn({
1543
+ values: quarterValues,
1544
+ defaultWidth: 'wide',
1545
+ argumentCallback: function argumentCallback(quarter) {
1546
+ return quarter - 1;
1547
+ }
1548
+ }),
1549
+ month: buildLocalizeFn({
1550
+ values: monthValues,
1551
+ defaultWidth: 'wide'
1552
+ }),
1553
+ day: buildLocalizeFn({
1554
+ values: dayValues,
1555
+ defaultWidth: 'wide'
1556
+ }),
1557
+ dayPeriod: buildLocalizeFn({
1558
+ values: dayPeriodValues,
1559
+ defaultWidth: 'wide',
1560
+ formattingValues: formattingDayPeriodValues,
1561
+ defaultFormattingWidth: 'wide'
1562
+ })
1563
+ };
1564
+ const localize$1 = localize;
1565
+
1566
+ function buildMatchFn(args) {
1567
+ return function (string) {
1568
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1569
+ var width = options.width;
1570
+ var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
1571
+ var matchResult = string.match(matchPattern);
1572
+ if (!matchResult) {
1573
+ return null;
1574
+ }
1575
+ var matchedString = matchResult[0];
1576
+ var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
1577
+ var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
1578
+ return pattern.test(matchedString);
1579
+ }) : findKey(parsePatterns, function (pattern) {
1580
+ return pattern.test(matchedString);
1581
+ });
1582
+ var value;
1583
+ value = args.valueCallback ? args.valueCallback(key) : key;
1584
+ value = options.valueCallback ? options.valueCallback(value) : value;
1585
+ var rest = string.slice(matchedString.length);
1586
+ return {
1587
+ value: value,
1588
+ rest: rest
1589
+ };
1590
+ };
1591
+ }
1592
+ function findKey(object, predicate) {
1593
+ for (var key in object) {
1594
+ if (object.hasOwnProperty(key) && predicate(object[key])) {
1595
+ return key;
1596
+ }
1597
+ }
1598
+ return undefined;
1599
+ }
1600
+ function findIndex(array, predicate) {
1601
+ for (var key = 0; key < array.length; key++) {
1602
+ if (predicate(array[key])) {
1603
+ return key;
1604
+ }
1605
+ }
1606
+ return undefined;
1607
+ }
1608
+
1609
+ function buildMatchPatternFn(args) {
1610
+ return function (string) {
1611
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1612
+ var matchResult = string.match(args.matchPattern);
1613
+ if (!matchResult) return null;
1614
+ var matchedString = matchResult[0];
1615
+ var parseResult = string.match(args.parsePattern);
1616
+ if (!parseResult) return null;
1617
+ var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
1618
+ value = options.valueCallback ? options.valueCallback(value) : value;
1619
+ var rest = string.slice(matchedString.length);
1620
+ return {
1621
+ value: value,
1622
+ rest: rest
1623
+ };
1624
+ };
1625
+ }
1626
+
1627
+ var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
1628
+ var parseOrdinalNumberPattern = /\d+/i;
1629
+ var matchEraPatterns = {
1630
+ narrow: /^(b|a)/i,
1631
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
1632
+ wide: /^(before christ|before common era|anno domini|common era)/i
1633
+ };
1634
+ var parseEraPatterns = {
1635
+ any: [/^b/i, /^(a|c)/i]
1636
+ };
1637
+ var matchQuarterPatterns = {
1638
+ narrow: /^[1234]/i,
1639
+ abbreviated: /^q[1234]/i,
1640
+ wide: /^[1234](th|st|nd|rd)? quarter/i
1641
+ };
1642
+ var parseQuarterPatterns = {
1643
+ any: [/1/i, /2/i, /3/i, /4/i]
1644
+ };
1645
+ var matchMonthPatterns = {
1646
+ narrow: /^[jfmasond]/i,
1647
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
1648
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
1649
+ };
1650
+ var parseMonthPatterns = {
1651
+ narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],
1652
+ any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
1653
+ };
1654
+ var matchDayPatterns = {
1655
+ narrow: /^[smtwf]/i,
1656
+ short: /^(su|mo|tu|we|th|fr|sa)/i,
1657
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
1658
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
1659
+ };
1660
+ var parseDayPatterns = {
1661
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
1662
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
1663
+ };
1664
+ var matchDayPeriodPatterns = {
1665
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
1666
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
1667
+ };
1668
+ var parseDayPeriodPatterns = {
1669
+ any: {
1670
+ am: /^a/i,
1671
+ pm: /^p/i,
1672
+ midnight: /^mi/i,
1673
+ noon: /^no/i,
1674
+ morning: /morning/i,
1675
+ afternoon: /afternoon/i,
1676
+ evening: /evening/i,
1677
+ night: /night/i
1678
+ }
1679
+ };
1680
+ var match = {
1681
+ ordinalNumber: buildMatchPatternFn({
1682
+ matchPattern: matchOrdinalNumberPattern,
1683
+ parsePattern: parseOrdinalNumberPattern,
1684
+ valueCallback: function valueCallback(value) {
1685
+ return parseInt(value, 10);
1686
+ }
1687
+ }),
1688
+ era: buildMatchFn({
1689
+ matchPatterns: matchEraPatterns,
1690
+ defaultMatchWidth: 'wide',
1691
+ parsePatterns: parseEraPatterns,
1692
+ defaultParseWidth: 'any'
1693
+ }),
1694
+ quarter: buildMatchFn({
1695
+ matchPatterns: matchQuarterPatterns,
1696
+ defaultMatchWidth: 'wide',
1697
+ parsePatterns: parseQuarterPatterns,
1698
+ defaultParseWidth: 'any',
1699
+ valueCallback: function valueCallback(index) {
1700
+ return index + 1;
1701
+ }
1702
+ }),
1703
+ month: buildMatchFn({
1704
+ matchPatterns: matchMonthPatterns,
1705
+ defaultMatchWidth: 'wide',
1706
+ parsePatterns: parseMonthPatterns,
1707
+ defaultParseWidth: 'any'
1708
+ }),
1709
+ day: buildMatchFn({
1710
+ matchPatterns: matchDayPatterns,
1711
+ defaultMatchWidth: 'wide',
1712
+ parsePatterns: parseDayPatterns,
1713
+ defaultParseWidth: 'any'
1714
+ }),
1715
+ dayPeriod: buildMatchFn({
1716
+ matchPatterns: matchDayPeriodPatterns,
1717
+ defaultMatchWidth: 'any',
1718
+ parsePatterns: parseDayPeriodPatterns,
1719
+ defaultParseWidth: 'any'
1720
+ })
1721
+ };
1722
+ const match$1 = match;
1723
+
1724
+ /**
1725
+ * @type {Locale}
1726
+ * @category Locales
1727
+ * @summary English locale (United States).
1728
+ * @language English
1729
+ * @iso-639-2 eng
1730
+ * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
1731
+ * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
1732
+ */
1733
+ var locale = {
1734
+ code: 'en-US',
1735
+ formatDistance: formatDistance$1,
1736
+ formatLong: formatLong$1,
1737
+ formatRelative: formatRelative$1,
1738
+ localize: localize$1,
1739
+ match: match$1,
1740
+ options: {
1741
+ weekStartsOn: 0 /* Sunday */,
1742
+ firstWeekContainsDate: 1
1743
+ }
1744
+ };
1745
+ const defaultLocale = locale;
1746
+
1747
+ // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
1748
+ // (one of the certain letters followed by `o`)
1749
+ // - (\w)\1* matches any sequences of the same letter
1750
+ // - '' matches two quote characters in a row
1751
+ // - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
1752
+ // except a single quote symbol, which ends the sequence.
1753
+ // Two quote characters do not end the sequence.
1754
+ // If there is no matching single quote
1755
+ // then the sequence will continue until the end of the string.
1756
+ // - . matches any single character unmatched by previous parts of the RegExps
1757
+ var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
1758
+
1759
+ // This RegExp catches symbols escaped by quotes, and also
1760
+ // sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
1761
+ var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
1762
+ var escapedStringRegExp = /^'([^]*?)'?$/;
1763
+ var doubleQuoteRegExp = /''/g;
1764
+ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
1765
+
1766
+ /**
1767
+ * @name format
1768
+ * @category Common Helpers
1769
+ * @summary Format the date.
1770
+ *
1771
+ * @description
1772
+ * Return the formatted date string in the given format. The result may vary by locale.
1773
+ *
1774
+ * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
1775
+ * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
1776
+ *
1777
+ * The characters wrapped between two single quotes characters (') are escaped.
1778
+ * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
1779
+ * (see the last example)
1780
+ *
1781
+ * Format of the string is based on Unicode Technical Standard #35:
1782
+ * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
1783
+ * with a few additions (see note 7 below the table).
1784
+ *
1785
+ * Accepted patterns:
1786
+ * | Unit | Pattern | Result examples | Notes |
1787
+ * |---------------------------------|---------|-----------------------------------|-------|
1788
+ * | Era | G..GGG | AD, BC | |
1789
+ * | | GGGG | Anno Domini, Before Christ | 2 |
1790
+ * | | GGGGG | A, B | |
1791
+ * | Calendar year | y | 44, 1, 1900, 2017 | 5 |
1792
+ * | | yo | 44th, 1st, 0th, 17th | 5,7 |
1793
+ * | | yy | 44, 01, 00, 17 | 5 |
1794
+ * | | yyy | 044, 001, 1900, 2017 | 5 |
1795
+ * | | yyyy | 0044, 0001, 1900, 2017 | 5 |
1796
+ * | | yyyyy | ... | 3,5 |
1797
+ * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
1798
+ * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
1799
+ * | | YY | 44, 01, 00, 17 | 5,8 |
1800
+ * | | YYY | 044, 001, 1900, 2017 | 5 |
1801
+ * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
1802
+ * | | YYYYY | ... | 3,5 |
1803
+ * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
1804
+ * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
1805
+ * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
1806
+ * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
1807
+ * | | RRRRR | ... | 3,5,7 |
1808
+ * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
1809
+ * | | uu | -43, 01, 1900, 2017 | 5 |
1810
+ * | | uuu | -043, 001, 1900, 2017 | 5 |
1811
+ * | | uuuu | -0043, 0001, 1900, 2017 | 5 |
1812
+ * | | uuuuu | ... | 3,5 |
1813
+ * | Quarter (formatting) | Q | 1, 2, 3, 4 | |
1814
+ * | | Qo | 1st, 2nd, 3rd, 4th | 7 |
1815
+ * | | QQ | 01, 02, 03, 04 | |
1816
+ * | | QQQ | Q1, Q2, Q3, Q4 | |
1817
+ * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
1818
+ * | | QQQQQ | 1, 2, 3, 4 | 4 |
1819
+ * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
1820
+ * | | qo | 1st, 2nd, 3rd, 4th | 7 |
1821
+ * | | qq | 01, 02, 03, 04 | |
1822
+ * | | qqq | Q1, Q2, Q3, Q4 | |
1823
+ * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
1824
+ * | | qqqqq | 1, 2, 3, 4 | 4 |
1825
+ * | Month (formatting) | M | 1, 2, ..., 12 | |
1826
+ * | | Mo | 1st, 2nd, ..., 12th | 7 |
1827
+ * | | MM | 01, 02, ..., 12 | |
1828
+ * | | MMM | Jan, Feb, ..., Dec | |
1829
+ * | | MMMM | January, February, ..., December | 2 |
1830
+ * | | MMMMM | J, F, ..., D | |
1831
+ * | Month (stand-alone) | L | 1, 2, ..., 12 | |
1832
+ * | | Lo | 1st, 2nd, ..., 12th | 7 |
1833
+ * | | LL | 01, 02, ..., 12 | |
1834
+ * | | LLL | Jan, Feb, ..., Dec | |
1835
+ * | | LLLL | January, February, ..., December | 2 |
1836
+ * | | LLLLL | J, F, ..., D | |
1837
+ * | Local week of year | w | 1, 2, ..., 53 | |
1838
+ * | | wo | 1st, 2nd, ..., 53th | 7 |
1839
+ * | | ww | 01, 02, ..., 53 | |
1840
+ * | ISO week of year | I | 1, 2, ..., 53 | 7 |
1841
+ * | | Io | 1st, 2nd, ..., 53th | 7 |
1842
+ * | | II | 01, 02, ..., 53 | 7 |
1843
+ * | Day of month | d | 1, 2, ..., 31 | |
1844
+ * | | do | 1st, 2nd, ..., 31st | 7 |
1845
+ * | | dd | 01, 02, ..., 31 | |
1846
+ * | Day of year | D | 1, 2, ..., 365, 366 | 9 |
1847
+ * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
1848
+ * | | DD | 01, 02, ..., 365, 366 | 9 |
1849
+ * | | DDD | 001, 002, ..., 365, 366 | |
1850
+ * | | DDDD | ... | 3 |
1851
+ * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
1852
+ * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
1853
+ * | | EEEEE | M, T, W, T, F, S, S | |
1854
+ * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
1855
+ * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
1856
+ * | | io | 1st, 2nd, ..., 7th | 7 |
1857
+ * | | ii | 01, 02, ..., 07 | 7 |
1858
+ * | | iii | Mon, Tue, Wed, ..., Sun | 7 |
1859
+ * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
1860
+ * | | iiiii | M, T, W, T, F, S, S | 7 |
1861
+ * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
1862
+ * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
1863
+ * | | eo | 2nd, 3rd, ..., 1st | 7 |
1864
+ * | | ee | 02, 03, ..., 01 | |
1865
+ * | | eee | Mon, Tue, Wed, ..., Sun | |
1866
+ * | | eeee | Monday, Tuesday, ..., Sunday | 2 |
1867
+ * | | eeeee | M, T, W, T, F, S, S | |
1868
+ * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
1869
+ * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
1870
+ * | | co | 2nd, 3rd, ..., 1st | 7 |
1871
+ * | | cc | 02, 03, ..., 01 | |
1872
+ * | | ccc | Mon, Tue, Wed, ..., Sun | |
1873
+ * | | cccc | Monday, Tuesday, ..., Sunday | 2 |
1874
+ * | | ccccc | M, T, W, T, F, S, S | |
1875
+ * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
1876
+ * | AM, PM | a..aa | AM, PM | |
1877
+ * | | aaa | am, pm | |
1878
+ * | | aaaa | a.m., p.m. | 2 |
1879
+ * | | aaaaa | a, p | |
1880
+ * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
1881
+ * | | bbb | am, pm, noon, midnight | |
1882
+ * | | bbbb | a.m., p.m., noon, midnight | 2 |
1883
+ * | | bbbbb | a, p, n, mi | |
1884
+ * | Flexible day period | B..BBB | at night, in the morning, ... | |
1885
+ * | | BBBB | at night, in the morning, ... | 2 |
1886
+ * | | BBBBB | at night, in the morning, ... | |
1887
+ * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
1888
+ * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
1889
+ * | | hh | 01, 02, ..., 11, 12 | |
1890
+ * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
1891
+ * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
1892
+ * | | HH | 00, 01, 02, ..., 23 | |
1893
+ * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
1894
+ * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
1895
+ * | | KK | 01, 02, ..., 11, 00 | |
1896
+ * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
1897
+ * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
1898
+ * | | kk | 24, 01, 02, ..., 23 | |
1899
+ * | Minute | m | 0, 1, ..., 59 | |
1900
+ * | | mo | 0th, 1st, ..., 59th | 7 |
1901
+ * | | mm | 00, 01, ..., 59 | |
1902
+ * | Second | s | 0, 1, ..., 59 | |
1903
+ * | | so | 0th, 1st, ..., 59th | 7 |
1904
+ * | | ss | 00, 01, ..., 59 | |
1905
+ * | Fraction of second | S | 0, 1, ..., 9 | |
1906
+ * | | SS | 00, 01, ..., 99 | |
1907
+ * | | SSS | 000, 001, ..., 999 | |
1908
+ * | | SSSS | ... | 3 |
1909
+ * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
1910
+ * | | XX | -0800, +0530, Z | |
1911
+ * | | XXX | -08:00, +05:30, Z | |
1912
+ * | | XXXX | -0800, +0530, Z, +123456 | 2 |
1913
+ * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
1914
+ * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
1915
+ * | | xx | -0800, +0530, +0000 | |
1916
+ * | | xxx | -08:00, +05:30, +00:00 | 2 |
1917
+ * | | xxxx | -0800, +0530, +0000, +123456 | |
1918
+ * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
1919
+ * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
1920
+ * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
1921
+ * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
1922
+ * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
1923
+ * | Seconds timestamp | t | 512969520 | 7 |
1924
+ * | | tt | ... | 3,7 |
1925
+ * | Milliseconds timestamp | T | 512969520900 | 7 |
1926
+ * | | TT | ... | 3,7 |
1927
+ * | Long localized date | P | 04/29/1453 | 7 |
1928
+ * | | PP | Apr 29, 1453 | 7 |
1929
+ * | | PPP | April 29th, 1453 | 7 |
1930
+ * | | PPPP | Friday, April 29th, 1453 | 2,7 |
1931
+ * | Long localized time | p | 12:00 AM | 7 |
1932
+ * | | pp | 12:00:00 AM | 7 |
1933
+ * | | ppp | 12:00:00 AM GMT+2 | 7 |
1934
+ * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
1935
+ * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
1936
+ * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
1937
+ * | | PPPppp | April 29th, 1453 at ... | 7 |
1938
+ * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
1939
+ * Notes:
1940
+ * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
1941
+ * are the same as "stand-alone" units, but are different in some languages.
1942
+ * "Formatting" units are declined according to the rules of the language
1943
+ * in the context of a date. "Stand-alone" units are always nominative singular:
1944
+ *
1945
+ * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
1946
+ *
1947
+ * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
1948
+ *
1949
+ * 2. Any sequence of the identical letters is a pattern, unless it is escaped by
1950
+ * the single quote characters (see below).
1951
+ * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
1952
+ * the output will be the same as default pattern for this unit, usually
1953
+ * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
1954
+ * are marked with "2" in the last column of the table.
1955
+ *
1956
+ * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
1957
+ *
1958
+ * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
1959
+ *
1960
+ * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
1961
+ *
1962
+ * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
1963
+ *
1964
+ * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
1965
+ *
1966
+ * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
1967
+ * The output will be padded with zeros to match the length of the pattern.
1968
+ *
1969
+ * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
1970
+ *
1971
+ * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
1972
+ * These tokens represent the shortest form of the quarter.
1973
+ *
1974
+ * 5. The main difference between `y` and `u` patterns are B.C. years:
1975
+ *
1976
+ * | Year | `y` | `u` |
1977
+ * |------|-----|-----|
1978
+ * | AC 1 | 1 | 1 |
1979
+ * | BC 1 | 1 | 0 |
1980
+ * | BC 2 | 2 | -1 |
1981
+ *
1982
+ * Also `yy` always returns the last two digits of a year,
1983
+ * while `uu` pads single digit years to 2 characters and returns other years unchanged:
1984
+ *
1985
+ * | Year | `yy` | `uu` |
1986
+ * |------|------|------|
1987
+ * | 1 | 01 | 01 |
1988
+ * | 14 | 14 | 14 |
1989
+ * | 376 | 76 | 376 |
1990
+ * | 1453 | 53 | 1453 |
1991
+ *
1992
+ * The same difference is true for local and ISO week-numbering years (`Y` and `R`),
1993
+ * except local week-numbering years are dependent on `options.weekStartsOn`
1994
+ * and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}
1995
+ * and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).
1996
+ *
1997
+ * 6. Specific non-location timezones are currently unavailable in `date-fns`,
1998
+ * so right now these tokens fall back to GMT timezones.
1999
+ *
2000
+ * 7. These patterns are not in the Unicode Technical Standard #35:
2001
+ * - `i`: ISO day of week
2002
+ * - `I`: ISO week of year
2003
+ * - `R`: ISO week-numbering year
2004
+ * - `t`: seconds timestamp
2005
+ * - `T`: milliseconds timestamp
2006
+ * - `o`: ordinal number modifier
2007
+ * - `P`: long localized date
2008
+ * - `p`: long localized time
2009
+ *
2010
+ * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
2011
+ * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2012
+ *
2013
+ * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
2014
+ * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2015
+ *
2016
+ * @param {Date|Number} date - the original date
2017
+ * @param {String} format - the string of tokens
2018
+ * @param {Object} [options] - an object with options.
2019
+ * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
2020
+ * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
2021
+ * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
2022
+ * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
2023
+ * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2024
+ * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
2025
+ * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2026
+ * @returns {String} the formatted date string
2027
+ * @throws {TypeError} 2 arguments required
2028
+ * @throws {RangeError} `date` must not be Invalid Date
2029
+ * @throws {RangeError} `options.locale` must contain `localize` property
2030
+ * @throws {RangeError} `options.locale` must contain `formatLong` property
2031
+ * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
2032
+ * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
2033
+ * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2034
+ * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2035
+ * @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2036
+ * @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2037
+ * @throws {RangeError} format string contains an unescaped latin alphabet character
2038
+ *
2039
+ * @example
2040
+ * // Represent 11 February 2014 in middle-endian format:
2041
+ * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
2042
+ * //=> '02/11/2014'
2043
+ *
2044
+ * @example
2045
+ * // Represent 2 July 2014 in Esperanto:
2046
+ * import { eoLocale } from 'date-fns/locale/eo'
2047
+ * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
2048
+ * locale: eoLocale
2049
+ * })
2050
+ * //=> '2-a de julio 2014'
2051
+ *
2052
+ * @example
2053
+ * // Escape string by single quote characters:
2054
+ * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
2055
+ * //=> "3 o'clock"
2056
+ */
2057
+
2058
+ function format(dirtyDate, dirtyFormatStr, options) {
2059
+ var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _options$locale3, _options$locale3$opti, _defaultOptions$local3, _defaultOptions$local4;
2060
+ utils.requiredArgs(2, arguments);
2061
+ var formatStr = String(dirtyFormatStr);
2062
+ var defaultOptions = getDefaultOptions();
2063
+ var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : defaultLocale;
2064
+ var firstWeekContainsDate = toInteger((_ref2 = (_ref3 = (_ref4 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.firstWeekContainsDate) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1);
2065
+
2066
+ // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
2067
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
2068
+ throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
2069
+ }
2070
+ var weekStartsOn = toInteger((_ref5 = (_ref6 = (_ref7 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale3 = options.locale) === null || _options$locale3 === void 0 ? void 0 : (_options$locale3$opti = _options$locale3.options) === null || _options$locale3$opti === void 0 ? void 0 : _options$locale3$opti.weekStartsOn) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0);
2071
+
2072
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
2073
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
2074
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
2075
+ }
2076
+ if (!locale.localize) {
2077
+ throw new RangeError('locale must contain localize property');
2078
+ }
2079
+ if (!locale.formatLong) {
2080
+ throw new RangeError('locale must contain formatLong property');
2081
+ }
2082
+ var originalDate = utils.toDate(dirtyDate);
2083
+ if (!isValid(originalDate)) {
2084
+ throw new RangeError('Invalid time value');
2085
+ }
2086
+
2087
+ // Convert the date in system timezone to the same date in UTC+00:00 timezone.
2088
+ // This ensures that when UTC functions will be implemented, locales will be compatible with them.
2089
+ // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
2090
+ var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
2091
+ var utcDate = subMilliseconds(originalDate, timezoneOffset);
2092
+ var formatterOptions = {
2093
+ firstWeekContainsDate: firstWeekContainsDate,
2094
+ weekStartsOn: weekStartsOn,
2095
+ locale: locale,
2096
+ _originalDate: originalDate
2097
+ };
2098
+ var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {
2099
+ var firstCharacter = substring[0];
2100
+ if (firstCharacter === 'p' || firstCharacter === 'P') {
2101
+ var longFormatter = longFormatters$1[firstCharacter];
2102
+ return longFormatter(substring, locale.formatLong);
2103
+ }
2104
+ return substring;
2105
+ }).join('').match(formattingTokensRegExp).map(function (substring) {
2106
+ // Replace two single quote characters with one single quote character
2107
+ if (substring === "''") {
2108
+ return "'";
2109
+ }
2110
+ var firstCharacter = substring[0];
2111
+ if (firstCharacter === "'") {
2112
+ return cleanEscapedString(substring);
2113
+ }
2114
+ var formatter = formatters$1[firstCharacter];
2115
+ if (formatter) {
2116
+ if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {
2117
+ throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
2118
+ }
2119
+ if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {
2120
+ throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
2121
+ }
2122
+ return formatter(utcDate, substring, locale.localize, formatterOptions);
2123
+ }
2124
+ if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
2125
+ throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');
2126
+ }
2127
+ return substring;
2128
+ }).join('');
2129
+ return result;
2130
+ }
2131
+ function cleanEscapedString(input) {
2132
+ var matched = input.match(escapedStringRegExp);
2133
+ if (!matched) {
2134
+ return input;
2135
+ }
2136
+ return matched[1].replace(doubleQuoteRegExp, "'");
2137
+ }
2138
+
10
2139
  /* eslint-disable quote-props */
11
2140
  const currenciesSymbols = {
12
2141
  'AED': 'د.إ',
@@ -272,10 +2401,7 @@ const CasinoGameThumbnailExtrainfo = class {
272
2401
  return '';
273
2402
  }
274
2403
  return (index.h("div", { class: "GameExtraInfo", part: "GameExtraInfo" }, this.isNewGame && (index.h("span", { class: "GameExtraInfoLabel NewGameTag", part: "GameExtraInfoLabel NewGameTag" }, locale_utils.translate('new', this.language))), this.gameTag && (index.h("span", { class: "GameExtraInfoLabel PopularGameTag", part: "GameExtraInfoLabel PopularGameTag" }, this.gameTag)), this.gameDetails && (index.h("div", { class: `GameProp LiveProps ${gameThumbnail.WIDGETTYPE_CLASS[this.gameDetails.category.toLowerCase()]} ${this.isDouble ? ' Double' : ''}`, part: `GameProp LiveProps ${gameThumbnail.WIDGETTYPE_CLASS[this.gameDetails.category.toLowerCase()]} ${this.isDouble ? ' Double' : ''}` }, this.gameDetails.isOpen ? (index.h("slot", { name: "category-details" })) : (this.gameStartTime &&
275
- this.gameTimeFormat && (index.h("div", { class: "ClosedGame", part: "ClosedGame" }, locale_utils.translate('opens', this.language), index.h("span", null, ' ', utils.hooks
276
- .utc(this.gameStartTime)
277
- .local()
278
- .format(this.gameTimeFormat), ' ')))), ((_a = this.gameDetails.dealer) === null || _a === void 0 ? void 0 : _a.DealerName) && (index.h("p", { class: "LiveLimits" }, index.h("span", { class: "DealerName" }, locale_utils.translate('dealer', this.language), ":", ' ', (_b = this.gameDetails) === null || _b === void 0 ? void 0 :
2404
+ this.gameTimeFormat && (index.h("div", { class: "ClosedGame", part: "ClosedGame" }, locale_utils.translate('opens', this.language), index.h("span", null, ' ', format(new Date(this.gameStartTime), Intl.DateTimeFormat().resolvedOptions().timeZone), ' ')))), ((_a = this.gameDetails.dealer) === null || _a === void 0 ? void 0 : _a.DealerName) && (index.h("p", { class: "LiveLimits" }, index.h("span", { class: "DealerName" }, locale_utils.translate('dealer', this.language), ":", ' ', (_b = this.gameDetails) === null || _b === void 0 ? void 0 :
279
2405
  _b.dealer.DealerName, ' '))), index.h("casino-game-thumbnail-betlimit", { betLimit: this.betLimit, numberOfPlayers: (_c = this.gameDetails) === null || _c === void 0 ? void 0 : _c.numberOfPlayers })))));
280
2406
  }
281
2407
  };