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