@everymatrix/lottery-banner 0.0.16 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/cjs/{index-4511b749.js → index-0a0cc64c.js} +18 -1
  2. package/dist/cjs/index.cjs.js +2 -2
  3. package/dist/cjs/loader.cjs.js +2 -2
  4. package/dist/cjs/lottery-banner-a5256c5a.js +3032 -0
  5. package/dist/cjs/lottery-banner.cjs.entry.js +2 -2
  6. package/dist/cjs/lottery-banner.cjs.js +2 -2
  7. package/dist/collection/components/lottery-banner/lottery-banner.css +7 -3
  8. package/dist/collection/components/lottery-banner/lottery-banner.js +76 -3
  9. package/dist/collection/utils/locale.utils.js +5 -2
  10. package/dist/collection/utils/utils.js +42 -1
  11. package/dist/esm/{index-0b45dd81.js → index-58dd14ef.js} +18 -2
  12. package/dist/esm/index.js +2 -2
  13. package/dist/esm/loader.js +3 -3
  14. package/dist/esm/lottery-banner-925a2ddf.js +3030 -0
  15. package/dist/esm/lottery-banner.entry.js +2 -2
  16. package/dist/esm/lottery-banner.js +3 -3
  17. package/dist/lottery-banner/index-58dd14ef.js +2 -0
  18. package/dist/lottery-banner/index.esm.js +1 -1
  19. package/dist/lottery-banner/lottery-banner-925a2ddf.js +1 -0
  20. package/dist/lottery-banner/lottery-banner.entry.js +1 -1
  21. package/dist/lottery-banner/lottery-banner.esm.js +1 -1
  22. package/dist/types/components/lottery-banner/lottery-banner.d.ts +18 -1
  23. package/dist/types/components.d.ts +29 -2
  24. package/dist/types/utils/utils.d.ts +10 -0
  25. package/package.json +1 -1
  26. package/dist/cjs/lottery-banner-73236552.js +0 -252
  27. package/dist/esm/lottery-banner-89c08855.js +0 -250
  28. package/dist/lottery-banner/index-0b45dd81.js +0 -2
  29. package/dist/lottery-banner/lottery-banner-89c08855.js +0 -1
@@ -0,0 +1,3030 @@
1
+ import { r as registerInstance, c as createEvent, h } from './index-58dd14ef.js';
2
+
3
+ const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
4
+
5
+ /**
6
+ * @name setClientStyling
7
+ * @description Method used to create and append to the passed element of the widget a style element with the content received
8
+ * @param {HTMLElement} stylingContainer The reference element of the widget
9
+ * @param {string} clientStyling The style content
10
+ */
11
+ function setClientStyling(stylingContainer, clientStyling) {
12
+ if (stylingContainer) {
13
+ const sheet = document.createElement('style');
14
+ sheet.innerHTML = clientStyling;
15
+ stylingContainer.appendChild(sheet);
16
+ }
17
+ }
18
+
19
+ /**
20
+ * @name setClientStylingURL
21
+ * @description Method used to create and append to the passed element of the widget a style element with the content fetched from a given URL
22
+ * @param {HTMLElement} stylingContainer The reference element of the widget
23
+ * @param {string} clientStylingUrl The URL of the style content
24
+ */
25
+ function setClientStylingURL(stylingContainer, clientStylingUrl) {
26
+ if (!stylingContainer || !clientStylingUrl) return;
27
+
28
+ const url = new URL(clientStylingUrl);
29
+
30
+ fetch(url.href)
31
+ .then((res) => res.text())
32
+ .then((data) => {
33
+ const cssFile = document.createElement('style');
34
+ cssFile.innerHTML = data;
35
+ if (stylingContainer) {
36
+ stylingContainer.appendChild(cssFile);
37
+ }
38
+ })
39
+ .catch((err) => {
40
+ console.error('There was an error while trying to load client styling from URL', err);
41
+ });
42
+ }
43
+
44
+ /**
45
+ * @name setStreamLibrary
46
+ * @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
47
+ * @param {HTMLElement} stylingContainer The highest element of the widget
48
+ * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
49
+ * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
50
+ * @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
51
+ */
52
+ function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
53
+ if (!window.emMessageBus) return;
54
+
55
+ const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
56
+
57
+ if (!supportAdoptStyle || !useAdoptedStyleSheets) {
58
+ subscription = getStyleTagSubscription(stylingContainer, domain);
59
+
60
+ return subscription;
61
+ }
62
+
63
+ if (!window[StyleCacheKey]) {
64
+ window[StyleCacheKey] = {};
65
+ }
66
+ subscription = getAdoptStyleSubscription(stylingContainer, domain);
67
+
68
+ const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
69
+ const wrappedUnsubscribe = () => {
70
+ if (window[StyleCacheKey][domain]) {
71
+ const cachedObject = window[StyleCacheKey][domain];
72
+ cachedObject.refCount > 1
73
+ ? (cachedObject.refCount = cachedObject.refCount - 1)
74
+ : delete window[StyleCacheKey][domain];
75
+ }
76
+
77
+ originalUnsubscribe();
78
+ };
79
+ subscription.unsubscribe = wrappedUnsubscribe;
80
+
81
+ return subscription;
82
+ }
83
+
84
+ function getStyleTagSubscription(stylingContainer, domain) {
85
+ const sheet = document.createElement('style');
86
+
87
+ return window.emMessageBus.subscribe(domain, (data) => {
88
+ if (stylingContainer) {
89
+ sheet.innerHTML = data;
90
+ stylingContainer.appendChild(sheet);
91
+ }
92
+ });
93
+ }
94
+
95
+ function getAdoptStyleSubscription(stylingContainer, domain) {
96
+ return window.emMessageBus.subscribe(domain, (data) => {
97
+ if (!stylingContainer) return;
98
+
99
+ const shadowRoot = stylingContainer.getRootNode();
100
+ const cacheStyleObject = window[StyleCacheKey];
101
+ let cachedStyle = cacheStyleObject[domain]?.sheet;
102
+
103
+ if (!cachedStyle) {
104
+ cachedStyle = new CSSStyleSheet();
105
+ cachedStyle.replaceSync(data);
106
+ cacheStyleObject[domain] = {
107
+ sheet: cachedStyle,
108
+ refCount: 1
109
+ };
110
+ } else {
111
+ cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
112
+ }
113
+
114
+ const currentSheets = shadowRoot.adoptedStyleSheets || [];
115
+ if (!currentSheets.includes(cachedStyle)) {
116
+ shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
117
+ }
118
+ });
119
+ }
120
+
121
+ const DEFAULT_LANGUAGE = 'en';
122
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
123
+ const TRANSLATIONS = {
124
+ en: {
125
+ stop: 'Stop',
126
+ at: 'at',
127
+ turnover: 'Turnover: ',
128
+ start: 'Sales Start',
129
+ in: 'in'
130
+ },
131
+ ro: {
132
+ stop: 'Oprește',
133
+ at: 'la'
134
+ },
135
+ fr: {
136
+ stop: 'Arrêtez',
137
+ at: 'à'
138
+ },
139
+ ar: {
140
+ stop: 'توقف',
141
+ at: 'في'
142
+ },
143
+ hr: {
144
+ stop: 'Stop',
145
+ at: 'u'
146
+ }
147
+ };
148
+ const translate = (key, customLang) => {
149
+ const lang = customLang;
150
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
151
+ };
152
+ const getTranslations = (data) => {
153
+ Object.keys(data).forEach((item) => {
154
+ for (let key in data[item]) {
155
+ TRANSLATIONS[item][key] = data[item][key];
156
+ }
157
+ });
158
+ };
159
+ const resolveTranslationUrl = async (translationUrl) => {
160
+ if (translationUrl) {
161
+ try {
162
+ const response = await fetch(translationUrl);
163
+ if (!response.ok) {
164
+ throw new Error(`HTTP error! status: ${response.status}`);
165
+ }
166
+ const translations = await response.json();
167
+ getTranslations(translations);
168
+ }
169
+ catch (error) {
170
+ console.error('Failed to fetch or parse translations from URL:', error);
171
+ }
172
+ }
173
+ };
174
+
175
+ function _typeof(o) {
176
+ "@babel/helpers - typeof";
177
+
178
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
179
+ return typeof o;
180
+ } : function (o) {
181
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
182
+ }, _typeof(o);
183
+ }
184
+
185
+ function toInteger(dirtyNumber) {
186
+ if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
187
+ return NaN;
188
+ }
189
+ var number = Number(dirtyNumber);
190
+ if (isNaN(number)) {
191
+ return number;
192
+ }
193
+ return number < 0 ? Math.ceil(number) : Math.floor(number);
194
+ }
195
+
196
+ function requiredArgs(required, args) {
197
+ if (args.length < required) {
198
+ throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
199
+ }
200
+ }
201
+
202
+ /**
203
+ * @name toDate
204
+ * @category Common Helpers
205
+ * @summary Convert the given argument to an instance of Date.
206
+ *
207
+ * @description
208
+ * Convert the given argument to an instance of Date.
209
+ *
210
+ * If the argument is an instance of Date, the function returns its clone.
211
+ *
212
+ * If the argument is a number, it is treated as a timestamp.
213
+ *
214
+ * If the argument is none of the above, the function returns Invalid Date.
215
+ *
216
+ * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
217
+ *
218
+ * @param {Date|Number} argument - the value to convert
219
+ * @returns {Date} the parsed date in the local time zone
220
+ * @throws {TypeError} 1 argument required
221
+ *
222
+ * @example
223
+ * // Clone the date:
224
+ * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
225
+ * //=> Tue Feb 11 2014 11:30:30
226
+ *
227
+ * @example
228
+ * // Convert the timestamp to date:
229
+ * const result = toDate(1392098430000)
230
+ * //=> Tue Feb 11 2014 11:30:30
231
+ */
232
+ function toDate(argument) {
233
+ requiredArgs(1, arguments);
234
+ var argStr = Object.prototype.toString.call(argument);
235
+
236
+ // Clone the date
237
+ if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
238
+ // Prevent the date to lose the milliseconds when passed to new Date() in IE10
239
+ return new Date(argument.getTime());
240
+ } else if (typeof argument === 'number' || argStr === '[object Number]') {
241
+ return new Date(argument);
242
+ } else {
243
+ if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
244
+ // eslint-disable-next-line no-console
245
+ console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");
246
+ // eslint-disable-next-line no-console
247
+ console.warn(new Error().stack);
248
+ }
249
+ return new Date(NaN);
250
+ }
251
+ }
252
+
253
+ /**
254
+ * @name addMilliseconds
255
+ * @category Millisecond Helpers
256
+ * @summary Add the specified number of milliseconds to the given date.
257
+ *
258
+ * @description
259
+ * Add the specified number of milliseconds to the given date.
260
+ *
261
+ * @param {Date|Number} date - the date to be changed
262
+ * @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`.
263
+ * @returns {Date} the new date with the milliseconds added
264
+ * @throws {TypeError} 2 arguments required
265
+ *
266
+ * @example
267
+ * // Add 750 milliseconds to 10 July 2014 12:45:30.000:
268
+ * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
269
+ * //=> Thu Jul 10 2014 12:45:30.750
270
+ */
271
+ function addMilliseconds(dirtyDate, dirtyAmount) {
272
+ requiredArgs(2, arguments);
273
+ var timestamp = toDate(dirtyDate).getTime();
274
+ var amount = toInteger(dirtyAmount);
275
+ return new Date(timestamp + amount);
276
+ }
277
+
278
+ var defaultOptions = {};
279
+ function getDefaultOptions() {
280
+ return defaultOptions;
281
+ }
282
+
283
+ /**
284
+ * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
285
+ * They usually appear for dates that denote time before the timezones were introduced
286
+ * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
287
+ * and GMT+01:00:00 after that date)
288
+ *
289
+ * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
290
+ * which would lead to incorrect calculations.
291
+ *
292
+ * This function returns the timezone offset in milliseconds that takes seconds in account.
293
+ */
294
+ function getTimezoneOffsetInMilliseconds(date) {
295
+ var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
296
+ utcDate.setUTCFullYear(date.getFullYear());
297
+ return date.getTime() - utcDate.getTime();
298
+ }
299
+
300
+ /**
301
+ * @name startOfDay
302
+ * @category Day Helpers
303
+ * @summary Return the start of a day for the given date.
304
+ *
305
+ * @description
306
+ * Return the start of a day for the given date.
307
+ * The result will be in the local timezone.
308
+ *
309
+ * @param {Date|Number} date - the original date
310
+ * @returns {Date} the start of a day
311
+ * @throws {TypeError} 1 argument required
312
+ *
313
+ * @example
314
+ * // The start of a day for 2 September 2014 11:55:00:
315
+ * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
316
+ * //=> Tue Sep 02 2014 00:00:00
317
+ */
318
+ function startOfDay(dirtyDate) {
319
+ requiredArgs(1, arguments);
320
+ var date = toDate(dirtyDate);
321
+ date.setHours(0, 0, 0, 0);
322
+ return date;
323
+ }
324
+
325
+ /**
326
+ * Days in 1 week.
327
+ *
328
+ * @name daysInWeek
329
+ * @constant
330
+ * @type {number}
331
+ * @default
332
+ */
333
+
334
+ /**
335
+ * Milliseconds in 1 minute
336
+ *
337
+ * @name millisecondsInMinute
338
+ * @constant
339
+ * @type {number}
340
+ * @default
341
+ */
342
+ var millisecondsInMinute = 60000;
343
+
344
+ /**
345
+ * Milliseconds in 1 hour
346
+ *
347
+ * @name millisecondsInHour
348
+ * @constant
349
+ * @type {number}
350
+ * @default
351
+ */
352
+ var millisecondsInHour = 3600000;
353
+
354
+ /**
355
+ * @name isSameDay
356
+ * @category Day Helpers
357
+ * @summary Are the given dates in the same day (and year and month)?
358
+ *
359
+ * @description
360
+ * Are the given dates in the same day (and year and month)?
361
+ *
362
+ * @param {Date|Number} dateLeft - the first date to check
363
+ * @param {Date|Number} dateRight - the second date to check
364
+ * @returns {Boolean} the dates are in the same day (and year and month)
365
+ * @throws {TypeError} 2 arguments required
366
+ *
367
+ * @example
368
+ * // Are 4 September 06:00:00 and 4 September 18:00:00 in the same day?
369
+ * const result = isSameDay(new Date(2014, 8, 4, 6, 0), new Date(2014, 8, 4, 18, 0))
370
+ * //=> true
371
+ *
372
+ * @example
373
+ * // Are 4 September and 4 October in the same day?
374
+ * const result = isSameDay(new Date(2014, 8, 4), new Date(2014, 9, 4))
375
+ * //=> false
376
+ *
377
+ * @example
378
+ * // Are 4 September, 2014 and 4 September, 2015 in the same day?
379
+ * const result = isSameDay(new Date(2014, 8, 4), new Date(2015, 8, 4))
380
+ * //=> false
381
+ */
382
+ function isSameDay(dirtyDateLeft, dirtyDateRight) {
383
+ requiredArgs(2, arguments);
384
+ var dateLeftStartOfDay = startOfDay(dirtyDateLeft);
385
+ var dateRightStartOfDay = startOfDay(dirtyDateRight);
386
+ return dateLeftStartOfDay.getTime() === dateRightStartOfDay.getTime();
387
+ }
388
+
389
+ /**
390
+ * @name isDate
391
+ * @category Common Helpers
392
+ * @summary Is the given value a date?
393
+ *
394
+ * @description
395
+ * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
396
+ *
397
+ * @param {*} value - the value to check
398
+ * @returns {boolean} true if the given value is a date
399
+ * @throws {TypeError} 1 arguments required
400
+ *
401
+ * @example
402
+ * // For a valid date:
403
+ * const result = isDate(new Date())
404
+ * //=> true
405
+ *
406
+ * @example
407
+ * // For an invalid date:
408
+ * const result = isDate(new Date(NaN))
409
+ * //=> true
410
+ *
411
+ * @example
412
+ * // For some value:
413
+ * const result = isDate('2014-02-31')
414
+ * //=> false
415
+ *
416
+ * @example
417
+ * // For an object:
418
+ * const result = isDate({})
419
+ * //=> false
420
+ */
421
+ function isDate(value) {
422
+ requiredArgs(1, arguments);
423
+ return value instanceof Date || _typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
424
+ }
425
+
426
+ /**
427
+ * @name isValid
428
+ * @category Common Helpers
429
+ * @summary Is the given date valid?
430
+ *
431
+ * @description
432
+ * Returns false if argument is Invalid Date and true otherwise.
433
+ * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
434
+ * Invalid Date is a Date, whose time value is NaN.
435
+ *
436
+ * Time value of Date: http://es5.github.io/#x15.9.1.1
437
+ *
438
+ * @param {*} date - the date to check
439
+ * @returns {Boolean} the date is valid
440
+ * @throws {TypeError} 1 argument required
441
+ *
442
+ * @example
443
+ * // For the valid date:
444
+ * const result = isValid(new Date(2014, 1, 31))
445
+ * //=> true
446
+ *
447
+ * @example
448
+ * // For the value, convertable into a date:
449
+ * const result = isValid(1393804800000)
450
+ * //=> true
451
+ *
452
+ * @example
453
+ * // For the invalid date:
454
+ * const result = isValid(new Date(''))
455
+ * //=> false
456
+ */
457
+ function isValid(dirtyDate) {
458
+ requiredArgs(1, arguments);
459
+ if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
460
+ return false;
461
+ }
462
+ var date = toDate(dirtyDate);
463
+ return !isNaN(Number(date));
464
+ }
465
+
466
+ /**
467
+ * @name differenceInMilliseconds
468
+ * @category Millisecond Helpers
469
+ * @summary Get the number of milliseconds between the given dates.
470
+ *
471
+ * @description
472
+ * Get the number of milliseconds between the given dates.
473
+ *
474
+ * @param {Date|Number} dateLeft - the later date
475
+ * @param {Date|Number} dateRight - the earlier date
476
+ * @returns {Number} the number of milliseconds
477
+ * @throws {TypeError} 2 arguments required
478
+ *
479
+ * @example
480
+ * // How many milliseconds are between
481
+ * // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?
482
+ * const result = differenceInMilliseconds(
483
+ * new Date(2014, 6, 2, 12, 30, 21, 700),
484
+ * new Date(2014, 6, 2, 12, 30, 20, 600)
485
+ * )
486
+ * //=> 1100
487
+ */
488
+ function differenceInMilliseconds(dateLeft, dateRight) {
489
+ requiredArgs(2, arguments);
490
+ return toDate(dateLeft).getTime() - toDate(dateRight).getTime();
491
+ }
492
+
493
+ var roundingMap = {
494
+ ceil: Math.ceil,
495
+ round: Math.round,
496
+ floor: Math.floor,
497
+ trunc: function trunc(value) {
498
+ return value < 0 ? Math.ceil(value) : Math.floor(value);
499
+ } // Math.trunc is not supported by IE
500
+ };
501
+
502
+ var defaultRoundingMethod = 'trunc';
503
+ function getRoundingMethod(method) {
504
+ return method ? roundingMap[method] : roundingMap[defaultRoundingMethod];
505
+ }
506
+
507
+ /**
508
+ * @name differenceInSeconds
509
+ * @category Second Helpers
510
+ * @summary Get the number of seconds between the given dates.
511
+ *
512
+ * @description
513
+ * Get the number of seconds between the given dates.
514
+ *
515
+ * @param {Date|Number} dateLeft - the later date
516
+ * @param {Date|Number} dateRight - the earlier date
517
+ * @param {Object} [options] - an object with options.
518
+ * @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)
519
+ * @returns {Number} the number of seconds
520
+ * @throws {TypeError} 2 arguments required
521
+ *
522
+ * @example
523
+ * // How many seconds are between
524
+ * // 2 July 2014 12:30:07.999 and 2 July 2014 12:30:20.000?
525
+ * const result = differenceInSeconds(
526
+ * new Date(2014, 6, 2, 12, 30, 20, 0),
527
+ * new Date(2014, 6, 2, 12, 30, 7, 999)
528
+ * )
529
+ * //=> 12
530
+ */
531
+ function differenceInSeconds(dateLeft, dateRight, options) {
532
+ requiredArgs(2, arguments);
533
+ var diff = differenceInMilliseconds(dateLeft, dateRight) / 1000;
534
+ return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
535
+ }
536
+
537
+ /**
538
+ * @name subMilliseconds
539
+ * @category Millisecond Helpers
540
+ * @summary Subtract the specified number of milliseconds from the given date.
541
+ *
542
+ * @description
543
+ * Subtract the specified number of milliseconds from the given date.
544
+ *
545
+ * @param {Date|Number} date - the date to be changed
546
+ * @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`.
547
+ * @returns {Date} the new date with the milliseconds subtracted
548
+ * @throws {TypeError} 2 arguments required
549
+ *
550
+ * @example
551
+ * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
552
+ * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
553
+ * //=> Thu Jul 10 2014 12:45:29.250
554
+ */
555
+ function subMilliseconds(dirtyDate, dirtyAmount) {
556
+ requiredArgs(2, arguments);
557
+ var amount = toInteger(dirtyAmount);
558
+ return addMilliseconds(dirtyDate, -amount);
559
+ }
560
+
561
+ var MILLISECONDS_IN_DAY = 86400000;
562
+ function getUTCDayOfYear(dirtyDate) {
563
+ requiredArgs(1, arguments);
564
+ var date = toDate(dirtyDate);
565
+ var timestamp = date.getTime();
566
+ date.setUTCMonth(0, 1);
567
+ date.setUTCHours(0, 0, 0, 0);
568
+ var startOfYearTimestamp = date.getTime();
569
+ var difference = timestamp - startOfYearTimestamp;
570
+ return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
571
+ }
572
+
573
+ function startOfUTCISOWeek(dirtyDate) {
574
+ requiredArgs(1, arguments);
575
+ var weekStartsOn = 1;
576
+ var date = toDate(dirtyDate);
577
+ var day = date.getUTCDay();
578
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
579
+ date.setUTCDate(date.getUTCDate() - diff);
580
+ date.setUTCHours(0, 0, 0, 0);
581
+ return date;
582
+ }
583
+
584
+ function getUTCISOWeekYear(dirtyDate) {
585
+ requiredArgs(1, arguments);
586
+ var date = toDate(dirtyDate);
587
+ var year = date.getUTCFullYear();
588
+ var fourthOfJanuaryOfNextYear = new Date(0);
589
+ fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
590
+ fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
591
+ var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
592
+ var fourthOfJanuaryOfThisYear = new Date(0);
593
+ fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
594
+ fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
595
+ var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);
596
+ if (date.getTime() >= startOfNextYear.getTime()) {
597
+ return year + 1;
598
+ } else if (date.getTime() >= startOfThisYear.getTime()) {
599
+ return year;
600
+ } else {
601
+ return year - 1;
602
+ }
603
+ }
604
+
605
+ function startOfUTCISOWeekYear(dirtyDate) {
606
+ requiredArgs(1, arguments);
607
+ var year = getUTCISOWeekYear(dirtyDate);
608
+ var fourthOfJanuary = new Date(0);
609
+ fourthOfJanuary.setUTCFullYear(year, 0, 4);
610
+ fourthOfJanuary.setUTCHours(0, 0, 0, 0);
611
+ var date = startOfUTCISOWeek(fourthOfJanuary);
612
+ return date;
613
+ }
614
+
615
+ var MILLISECONDS_IN_WEEK$1 = 604800000;
616
+ function getUTCISOWeek(dirtyDate) {
617
+ requiredArgs(1, arguments);
618
+ var date = toDate(dirtyDate);
619
+ var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime();
620
+
621
+ // Round the number of days to the nearest integer
622
+ // because the number of milliseconds in a week is not constant
623
+ // (e.g. it's different in the week of the daylight saving time clock shift)
624
+ return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;
625
+ }
626
+
627
+ function startOfUTCWeek(dirtyDate, options) {
628
+ var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
629
+ requiredArgs(1, arguments);
630
+ var defaultOptions = getDefaultOptions();
631
+ 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);
632
+
633
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
634
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
635
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
636
+ }
637
+ var date = toDate(dirtyDate);
638
+ var day = date.getUTCDay();
639
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
640
+ date.setUTCDate(date.getUTCDate() - diff);
641
+ date.setUTCHours(0, 0, 0, 0);
642
+ return date;
643
+ }
644
+
645
+ function getUTCWeekYear(dirtyDate, options) {
646
+ var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
647
+ requiredArgs(1, arguments);
648
+ var date = toDate(dirtyDate);
649
+ var year = date.getUTCFullYear();
650
+ var defaultOptions = getDefaultOptions();
651
+ 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);
652
+
653
+ // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
654
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
655
+ throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
656
+ }
657
+ var firstWeekOfNextYear = new Date(0);
658
+ firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
659
+ firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
660
+ var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);
661
+ var firstWeekOfThisYear = new Date(0);
662
+ firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
663
+ firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
664
+ var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);
665
+ if (date.getTime() >= startOfNextYear.getTime()) {
666
+ return year + 1;
667
+ } else if (date.getTime() >= startOfThisYear.getTime()) {
668
+ return year;
669
+ } else {
670
+ return year - 1;
671
+ }
672
+ }
673
+
674
+ function startOfUTCWeekYear(dirtyDate, options) {
675
+ var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
676
+ requiredArgs(1, arguments);
677
+ var defaultOptions = getDefaultOptions();
678
+ 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);
679
+ var year = getUTCWeekYear(dirtyDate, options);
680
+ var firstWeek = new Date(0);
681
+ firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
682
+ firstWeek.setUTCHours(0, 0, 0, 0);
683
+ var date = startOfUTCWeek(firstWeek, options);
684
+ return date;
685
+ }
686
+
687
+ var MILLISECONDS_IN_WEEK = 604800000;
688
+ function getUTCWeek(dirtyDate, options) {
689
+ requiredArgs(1, arguments);
690
+ var date = toDate(dirtyDate);
691
+ var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime();
692
+
693
+ // Round the number of days to the nearest integer
694
+ // because the number of milliseconds in a week is not constant
695
+ // (e.g. it's different in the week of the daylight saving time clock shift)
696
+ return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
697
+ }
698
+
699
+ function addLeadingZeros(number, targetLength) {
700
+ var sign = number < 0 ? '-' : '';
701
+ var output = Math.abs(number).toString();
702
+ while (output.length < targetLength) {
703
+ output = '0' + output;
704
+ }
705
+ return sign + output;
706
+ }
707
+
708
+ /*
709
+ * | | Unit | | Unit |
710
+ * |-----|--------------------------------|-----|--------------------------------|
711
+ * | a | AM, PM | A* | |
712
+ * | d | Day of month | D | |
713
+ * | h | Hour [1-12] | H | Hour [0-23] |
714
+ * | m | Minute | M | Month |
715
+ * | s | Second | S | Fraction of second |
716
+ * | y | Year (abs) | Y | |
717
+ *
718
+ * Letters marked by * are not implemented but reserved by Unicode standard.
719
+ */
720
+ var formatters$2 = {
721
+ // Year
722
+ y: function y(date, token) {
723
+ // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
724
+ // | Year | y | yy | yyy | yyyy | yyyyy |
725
+ // |----------|-------|----|-------|-------|-------|
726
+ // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
727
+ // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
728
+ // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
729
+ // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
730
+ // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
731
+
732
+ var signedYear = date.getUTCFullYear();
733
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
734
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
735
+ return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
736
+ },
737
+ // Month
738
+ M: function M(date, token) {
739
+ var month = date.getUTCMonth();
740
+ return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
741
+ },
742
+ // Day of the month
743
+ d: function d(date, token) {
744
+ return addLeadingZeros(date.getUTCDate(), token.length);
745
+ },
746
+ // AM or PM
747
+ a: function a(date, token) {
748
+ var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
749
+ switch (token) {
750
+ case 'a':
751
+ case 'aa':
752
+ return dayPeriodEnumValue.toUpperCase();
753
+ case 'aaa':
754
+ return dayPeriodEnumValue;
755
+ case 'aaaaa':
756
+ return dayPeriodEnumValue[0];
757
+ case 'aaaa':
758
+ default:
759
+ return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
760
+ }
761
+ },
762
+ // Hour [1-12]
763
+ h: function h(date, token) {
764
+ return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
765
+ },
766
+ // Hour [0-23]
767
+ H: function H(date, token) {
768
+ return addLeadingZeros(date.getUTCHours(), token.length);
769
+ },
770
+ // Minute
771
+ m: function m(date, token) {
772
+ return addLeadingZeros(date.getUTCMinutes(), token.length);
773
+ },
774
+ // Second
775
+ s: function s(date, token) {
776
+ return addLeadingZeros(date.getUTCSeconds(), token.length);
777
+ },
778
+ // Fraction of second
779
+ S: function S(date, token) {
780
+ var numberOfDigits = token.length;
781
+ var milliseconds = date.getUTCMilliseconds();
782
+ var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
783
+ return addLeadingZeros(fractionalSeconds, token.length);
784
+ }
785
+ };
786
+ const formatters$3 = formatters$2;
787
+
788
+ var dayPeriodEnum = {
789
+ am: 'am',
790
+ pm: 'pm',
791
+ midnight: 'midnight',
792
+ noon: 'noon',
793
+ morning: 'morning',
794
+ afternoon: 'afternoon',
795
+ evening: 'evening',
796
+ night: 'night'
797
+ };
798
+ /*
799
+ * | | Unit | | Unit |
800
+ * |-----|--------------------------------|-----|--------------------------------|
801
+ * | a | AM, PM | A* | Milliseconds in day |
802
+ * | b | AM, PM, noon, midnight | B | Flexible day period |
803
+ * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
804
+ * | d | Day of month | D | Day of year |
805
+ * | e | Local day of week | E | Day of week |
806
+ * | f | | F* | Day of week in month |
807
+ * | g* | Modified Julian day | G | Era |
808
+ * | h | Hour [1-12] | H | Hour [0-23] |
809
+ * | i! | ISO day of week | I! | ISO week of year |
810
+ * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
811
+ * | k | Hour [1-24] | K | Hour [0-11] |
812
+ * | l* | (deprecated) | L | Stand-alone month |
813
+ * | m | Minute | M | Month |
814
+ * | n | | N | |
815
+ * | o! | Ordinal number modifier | O | Timezone (GMT) |
816
+ * | p! | Long localized time | P! | Long localized date |
817
+ * | q | Stand-alone quarter | Q | Quarter |
818
+ * | r* | Related Gregorian year | R! | ISO week-numbering year |
819
+ * | s | Second | S | Fraction of second |
820
+ * | t! | Seconds timestamp | T! | Milliseconds timestamp |
821
+ * | u | Extended year | U* | Cyclic year |
822
+ * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
823
+ * | w | Local week of year | W* | Week of month |
824
+ * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
825
+ * | y | Year (abs) | Y | Local week-numbering year |
826
+ * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
827
+ *
828
+ * Letters marked by * are not implemented but reserved by Unicode standard.
829
+ *
830
+ * Letters marked by ! are non-standard, but implemented by date-fns:
831
+ * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
832
+ * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
833
+ * i.e. 7 for Sunday, 1 for Monday, etc.
834
+ * - `I` is ISO week of year, as opposed to `w` which is local week of year.
835
+ * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
836
+ * `R` is supposed to be used in conjunction with `I` and `i`
837
+ * for universal ISO week-numbering date, whereas
838
+ * `Y` is supposed to be used in conjunction with `w` and `e`
839
+ * for week-numbering date specific to the locale.
840
+ * - `P` is long localized date format
841
+ * - `p` is long localized time format
842
+ */
843
+
844
+ var formatters = {
845
+ // Era
846
+ G: function G(date, token, localize) {
847
+ var era = date.getUTCFullYear() > 0 ? 1 : 0;
848
+ switch (token) {
849
+ // AD, BC
850
+ case 'G':
851
+ case 'GG':
852
+ case 'GGG':
853
+ return localize.era(era, {
854
+ width: 'abbreviated'
855
+ });
856
+ // A, B
857
+ case 'GGGGG':
858
+ return localize.era(era, {
859
+ width: 'narrow'
860
+ });
861
+ // Anno Domini, Before Christ
862
+ case 'GGGG':
863
+ default:
864
+ return localize.era(era, {
865
+ width: 'wide'
866
+ });
867
+ }
868
+ },
869
+ // Year
870
+ y: function y(date, token, localize) {
871
+ // Ordinal number
872
+ if (token === 'yo') {
873
+ var signedYear = date.getUTCFullYear();
874
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
875
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
876
+ return localize.ordinalNumber(year, {
877
+ unit: 'year'
878
+ });
879
+ }
880
+ return formatters$3.y(date, token);
881
+ },
882
+ // Local week-numbering year
883
+ Y: function Y(date, token, localize, options) {
884
+ var signedWeekYear = getUTCWeekYear(date, options);
885
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
886
+ var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
887
+
888
+ // Two digit year
889
+ if (token === 'YY') {
890
+ var twoDigitYear = weekYear % 100;
891
+ return addLeadingZeros(twoDigitYear, 2);
892
+ }
893
+
894
+ // Ordinal number
895
+ if (token === 'Yo') {
896
+ return localize.ordinalNumber(weekYear, {
897
+ unit: 'year'
898
+ });
899
+ }
900
+
901
+ // Padding
902
+ return addLeadingZeros(weekYear, token.length);
903
+ },
904
+ // ISO week-numbering year
905
+ R: function R(date, token) {
906
+ var isoWeekYear = getUTCISOWeekYear(date);
907
+
908
+ // Padding
909
+ return addLeadingZeros(isoWeekYear, token.length);
910
+ },
911
+ // Extended year. This is a single number designating the year of this calendar system.
912
+ // The main difference between `y` and `u` localizers are B.C. years:
913
+ // | Year | `y` | `u` |
914
+ // |------|-----|-----|
915
+ // | AC 1 | 1 | 1 |
916
+ // | BC 1 | 1 | 0 |
917
+ // | BC 2 | 2 | -1 |
918
+ // Also `yy` always returns the last two digits of a year,
919
+ // while `uu` pads single digit years to 2 characters and returns other years unchanged.
920
+ u: function u(date, token) {
921
+ var year = date.getUTCFullYear();
922
+ return addLeadingZeros(year, token.length);
923
+ },
924
+ // Quarter
925
+ Q: function Q(date, token, localize) {
926
+ var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
927
+ switch (token) {
928
+ // 1, 2, 3, 4
929
+ case 'Q':
930
+ return String(quarter);
931
+ // 01, 02, 03, 04
932
+ case 'QQ':
933
+ return addLeadingZeros(quarter, 2);
934
+ // 1st, 2nd, 3rd, 4th
935
+ case 'Qo':
936
+ return localize.ordinalNumber(quarter, {
937
+ unit: 'quarter'
938
+ });
939
+ // Q1, Q2, Q3, Q4
940
+ case 'QQQ':
941
+ return localize.quarter(quarter, {
942
+ width: 'abbreviated',
943
+ context: 'formatting'
944
+ });
945
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
946
+ case 'QQQQQ':
947
+ return localize.quarter(quarter, {
948
+ width: 'narrow',
949
+ context: 'formatting'
950
+ });
951
+ // 1st quarter, 2nd quarter, ...
952
+ case 'QQQQ':
953
+ default:
954
+ return localize.quarter(quarter, {
955
+ width: 'wide',
956
+ context: 'formatting'
957
+ });
958
+ }
959
+ },
960
+ // Stand-alone quarter
961
+ q: function q(date, token, localize) {
962
+ var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
963
+ switch (token) {
964
+ // 1, 2, 3, 4
965
+ case 'q':
966
+ return String(quarter);
967
+ // 01, 02, 03, 04
968
+ case 'qq':
969
+ return addLeadingZeros(quarter, 2);
970
+ // 1st, 2nd, 3rd, 4th
971
+ case 'qo':
972
+ return localize.ordinalNumber(quarter, {
973
+ unit: 'quarter'
974
+ });
975
+ // Q1, Q2, Q3, Q4
976
+ case 'qqq':
977
+ return localize.quarter(quarter, {
978
+ width: 'abbreviated',
979
+ context: 'standalone'
980
+ });
981
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
982
+ case 'qqqqq':
983
+ return localize.quarter(quarter, {
984
+ width: 'narrow',
985
+ context: 'standalone'
986
+ });
987
+ // 1st quarter, 2nd quarter, ...
988
+ case 'qqqq':
989
+ default:
990
+ return localize.quarter(quarter, {
991
+ width: 'wide',
992
+ context: 'standalone'
993
+ });
994
+ }
995
+ },
996
+ // Month
997
+ M: function M(date, token, localize) {
998
+ var month = date.getUTCMonth();
999
+ switch (token) {
1000
+ case 'M':
1001
+ case 'MM':
1002
+ return formatters$3.M(date, token);
1003
+ // 1st, 2nd, ..., 12th
1004
+ case 'Mo':
1005
+ return localize.ordinalNumber(month + 1, {
1006
+ unit: 'month'
1007
+ });
1008
+ // Jan, Feb, ..., Dec
1009
+ case 'MMM':
1010
+ return localize.month(month, {
1011
+ width: 'abbreviated',
1012
+ context: 'formatting'
1013
+ });
1014
+ // J, F, ..., D
1015
+ case 'MMMMM':
1016
+ return localize.month(month, {
1017
+ width: 'narrow',
1018
+ context: 'formatting'
1019
+ });
1020
+ // January, February, ..., December
1021
+ case 'MMMM':
1022
+ default:
1023
+ return localize.month(month, {
1024
+ width: 'wide',
1025
+ context: 'formatting'
1026
+ });
1027
+ }
1028
+ },
1029
+ // Stand-alone month
1030
+ L: function L(date, token, localize) {
1031
+ var month = date.getUTCMonth();
1032
+ switch (token) {
1033
+ // 1, 2, ..., 12
1034
+ case 'L':
1035
+ return String(month + 1);
1036
+ // 01, 02, ..., 12
1037
+ case 'LL':
1038
+ return addLeadingZeros(month + 1, 2);
1039
+ // 1st, 2nd, ..., 12th
1040
+ case 'Lo':
1041
+ return localize.ordinalNumber(month + 1, {
1042
+ unit: 'month'
1043
+ });
1044
+ // Jan, Feb, ..., Dec
1045
+ case 'LLL':
1046
+ return localize.month(month, {
1047
+ width: 'abbreviated',
1048
+ context: 'standalone'
1049
+ });
1050
+ // J, F, ..., D
1051
+ case 'LLLLL':
1052
+ return localize.month(month, {
1053
+ width: 'narrow',
1054
+ context: 'standalone'
1055
+ });
1056
+ // January, February, ..., December
1057
+ case 'LLLL':
1058
+ default:
1059
+ return localize.month(month, {
1060
+ width: 'wide',
1061
+ context: 'standalone'
1062
+ });
1063
+ }
1064
+ },
1065
+ // Local week of year
1066
+ w: function w(date, token, localize, options) {
1067
+ var week = getUTCWeek(date, options);
1068
+ if (token === 'wo') {
1069
+ return localize.ordinalNumber(week, {
1070
+ unit: 'week'
1071
+ });
1072
+ }
1073
+ return addLeadingZeros(week, token.length);
1074
+ },
1075
+ // ISO week of year
1076
+ I: function I(date, token, localize) {
1077
+ var isoWeek = getUTCISOWeek(date);
1078
+ if (token === 'Io') {
1079
+ return localize.ordinalNumber(isoWeek, {
1080
+ unit: 'week'
1081
+ });
1082
+ }
1083
+ return addLeadingZeros(isoWeek, token.length);
1084
+ },
1085
+ // Day of the month
1086
+ d: function d(date, token, localize) {
1087
+ if (token === 'do') {
1088
+ return localize.ordinalNumber(date.getUTCDate(), {
1089
+ unit: 'date'
1090
+ });
1091
+ }
1092
+ return formatters$3.d(date, token);
1093
+ },
1094
+ // Day of year
1095
+ D: function D(date, token, localize) {
1096
+ var dayOfYear = getUTCDayOfYear(date);
1097
+ if (token === 'Do') {
1098
+ return localize.ordinalNumber(dayOfYear, {
1099
+ unit: 'dayOfYear'
1100
+ });
1101
+ }
1102
+ return addLeadingZeros(dayOfYear, token.length);
1103
+ },
1104
+ // Day of week
1105
+ E: function E(date, token, localize) {
1106
+ var dayOfWeek = date.getUTCDay();
1107
+ switch (token) {
1108
+ // Tue
1109
+ case 'E':
1110
+ case 'EE':
1111
+ case 'EEE':
1112
+ return localize.day(dayOfWeek, {
1113
+ width: 'abbreviated',
1114
+ context: 'formatting'
1115
+ });
1116
+ // T
1117
+ case 'EEEEE':
1118
+ return localize.day(dayOfWeek, {
1119
+ width: 'narrow',
1120
+ context: 'formatting'
1121
+ });
1122
+ // Tu
1123
+ case 'EEEEEE':
1124
+ return localize.day(dayOfWeek, {
1125
+ width: 'short',
1126
+ context: 'formatting'
1127
+ });
1128
+ // Tuesday
1129
+ case 'EEEE':
1130
+ default:
1131
+ return localize.day(dayOfWeek, {
1132
+ width: 'wide',
1133
+ context: 'formatting'
1134
+ });
1135
+ }
1136
+ },
1137
+ // Local day of week
1138
+ e: function e(date, token, localize, options) {
1139
+ var dayOfWeek = date.getUTCDay();
1140
+ var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
1141
+ switch (token) {
1142
+ // Numerical value (Nth day of week with current locale or weekStartsOn)
1143
+ case 'e':
1144
+ return String(localDayOfWeek);
1145
+ // Padded numerical value
1146
+ case 'ee':
1147
+ return addLeadingZeros(localDayOfWeek, 2);
1148
+ // 1st, 2nd, ..., 7th
1149
+ case 'eo':
1150
+ return localize.ordinalNumber(localDayOfWeek, {
1151
+ unit: 'day'
1152
+ });
1153
+ case 'eee':
1154
+ return localize.day(dayOfWeek, {
1155
+ width: 'abbreviated',
1156
+ context: 'formatting'
1157
+ });
1158
+ // T
1159
+ case 'eeeee':
1160
+ return localize.day(dayOfWeek, {
1161
+ width: 'narrow',
1162
+ context: 'formatting'
1163
+ });
1164
+ // Tu
1165
+ case 'eeeeee':
1166
+ return localize.day(dayOfWeek, {
1167
+ width: 'short',
1168
+ context: 'formatting'
1169
+ });
1170
+ // Tuesday
1171
+ case 'eeee':
1172
+ default:
1173
+ return localize.day(dayOfWeek, {
1174
+ width: 'wide',
1175
+ context: 'formatting'
1176
+ });
1177
+ }
1178
+ },
1179
+ // Stand-alone local day of week
1180
+ c: function c(date, token, localize, options) {
1181
+ var dayOfWeek = date.getUTCDay();
1182
+ var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
1183
+ switch (token) {
1184
+ // Numerical value (same as in `e`)
1185
+ case 'c':
1186
+ return String(localDayOfWeek);
1187
+ // Padded numerical value
1188
+ case 'cc':
1189
+ return addLeadingZeros(localDayOfWeek, token.length);
1190
+ // 1st, 2nd, ..., 7th
1191
+ case 'co':
1192
+ return localize.ordinalNumber(localDayOfWeek, {
1193
+ unit: 'day'
1194
+ });
1195
+ case 'ccc':
1196
+ return localize.day(dayOfWeek, {
1197
+ width: 'abbreviated',
1198
+ context: 'standalone'
1199
+ });
1200
+ // T
1201
+ case 'ccccc':
1202
+ return localize.day(dayOfWeek, {
1203
+ width: 'narrow',
1204
+ context: 'standalone'
1205
+ });
1206
+ // Tu
1207
+ case 'cccccc':
1208
+ return localize.day(dayOfWeek, {
1209
+ width: 'short',
1210
+ context: 'standalone'
1211
+ });
1212
+ // Tuesday
1213
+ case 'cccc':
1214
+ default:
1215
+ return localize.day(dayOfWeek, {
1216
+ width: 'wide',
1217
+ context: 'standalone'
1218
+ });
1219
+ }
1220
+ },
1221
+ // ISO day of week
1222
+ i: function i(date, token, localize) {
1223
+ var dayOfWeek = date.getUTCDay();
1224
+ var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
1225
+ switch (token) {
1226
+ // 2
1227
+ case 'i':
1228
+ return String(isoDayOfWeek);
1229
+ // 02
1230
+ case 'ii':
1231
+ return addLeadingZeros(isoDayOfWeek, token.length);
1232
+ // 2nd
1233
+ case 'io':
1234
+ return localize.ordinalNumber(isoDayOfWeek, {
1235
+ unit: 'day'
1236
+ });
1237
+ // Tue
1238
+ case 'iii':
1239
+ return localize.day(dayOfWeek, {
1240
+ width: 'abbreviated',
1241
+ context: 'formatting'
1242
+ });
1243
+ // T
1244
+ case 'iiiii':
1245
+ return localize.day(dayOfWeek, {
1246
+ width: 'narrow',
1247
+ context: 'formatting'
1248
+ });
1249
+ // Tu
1250
+ case 'iiiiii':
1251
+ return localize.day(dayOfWeek, {
1252
+ width: 'short',
1253
+ context: 'formatting'
1254
+ });
1255
+ // Tuesday
1256
+ case 'iiii':
1257
+ default:
1258
+ return localize.day(dayOfWeek, {
1259
+ width: 'wide',
1260
+ context: 'formatting'
1261
+ });
1262
+ }
1263
+ },
1264
+ // AM or PM
1265
+ a: function a(date, token, localize) {
1266
+ var hours = date.getUTCHours();
1267
+ var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
1268
+ switch (token) {
1269
+ case 'a':
1270
+ case 'aa':
1271
+ return localize.dayPeriod(dayPeriodEnumValue, {
1272
+ width: 'abbreviated',
1273
+ context: 'formatting'
1274
+ });
1275
+ case 'aaa':
1276
+ return localize.dayPeriod(dayPeriodEnumValue, {
1277
+ width: 'abbreviated',
1278
+ context: 'formatting'
1279
+ }).toLowerCase();
1280
+ case 'aaaaa':
1281
+ return localize.dayPeriod(dayPeriodEnumValue, {
1282
+ width: 'narrow',
1283
+ context: 'formatting'
1284
+ });
1285
+ case 'aaaa':
1286
+ default:
1287
+ return localize.dayPeriod(dayPeriodEnumValue, {
1288
+ width: 'wide',
1289
+ context: 'formatting'
1290
+ });
1291
+ }
1292
+ },
1293
+ // AM, PM, midnight, noon
1294
+ b: function b(date, token, localize) {
1295
+ var hours = date.getUTCHours();
1296
+ var dayPeriodEnumValue;
1297
+ if (hours === 12) {
1298
+ dayPeriodEnumValue = dayPeriodEnum.noon;
1299
+ } else if (hours === 0) {
1300
+ dayPeriodEnumValue = dayPeriodEnum.midnight;
1301
+ } else {
1302
+ dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
1303
+ }
1304
+ switch (token) {
1305
+ case 'b':
1306
+ case 'bb':
1307
+ return localize.dayPeriod(dayPeriodEnumValue, {
1308
+ width: 'abbreviated',
1309
+ context: 'formatting'
1310
+ });
1311
+ case 'bbb':
1312
+ return localize.dayPeriod(dayPeriodEnumValue, {
1313
+ width: 'abbreviated',
1314
+ context: 'formatting'
1315
+ }).toLowerCase();
1316
+ case 'bbbbb':
1317
+ return localize.dayPeriod(dayPeriodEnumValue, {
1318
+ width: 'narrow',
1319
+ context: 'formatting'
1320
+ });
1321
+ case 'bbbb':
1322
+ default:
1323
+ return localize.dayPeriod(dayPeriodEnumValue, {
1324
+ width: 'wide',
1325
+ context: 'formatting'
1326
+ });
1327
+ }
1328
+ },
1329
+ // in the morning, in the afternoon, in the evening, at night
1330
+ B: function B(date, token, localize) {
1331
+ var hours = date.getUTCHours();
1332
+ var dayPeriodEnumValue;
1333
+ if (hours >= 17) {
1334
+ dayPeriodEnumValue = dayPeriodEnum.evening;
1335
+ } else if (hours >= 12) {
1336
+ dayPeriodEnumValue = dayPeriodEnum.afternoon;
1337
+ } else if (hours >= 4) {
1338
+ dayPeriodEnumValue = dayPeriodEnum.morning;
1339
+ } else {
1340
+ dayPeriodEnumValue = dayPeriodEnum.night;
1341
+ }
1342
+ switch (token) {
1343
+ case 'B':
1344
+ case 'BB':
1345
+ case 'BBB':
1346
+ return localize.dayPeriod(dayPeriodEnumValue, {
1347
+ width: 'abbreviated',
1348
+ context: 'formatting'
1349
+ });
1350
+ case 'BBBBB':
1351
+ return localize.dayPeriod(dayPeriodEnumValue, {
1352
+ width: 'narrow',
1353
+ context: 'formatting'
1354
+ });
1355
+ case 'BBBB':
1356
+ default:
1357
+ return localize.dayPeriod(dayPeriodEnumValue, {
1358
+ width: 'wide',
1359
+ context: 'formatting'
1360
+ });
1361
+ }
1362
+ },
1363
+ // Hour [1-12]
1364
+ h: function h(date, token, localize) {
1365
+ if (token === 'ho') {
1366
+ var hours = date.getUTCHours() % 12;
1367
+ if (hours === 0) hours = 12;
1368
+ return localize.ordinalNumber(hours, {
1369
+ unit: 'hour'
1370
+ });
1371
+ }
1372
+ return formatters$3.h(date, token);
1373
+ },
1374
+ // Hour [0-23]
1375
+ H: function H(date, token, localize) {
1376
+ if (token === 'Ho') {
1377
+ return localize.ordinalNumber(date.getUTCHours(), {
1378
+ unit: 'hour'
1379
+ });
1380
+ }
1381
+ return formatters$3.H(date, token);
1382
+ },
1383
+ // Hour [0-11]
1384
+ K: function K(date, token, localize) {
1385
+ var hours = date.getUTCHours() % 12;
1386
+ if (token === 'Ko') {
1387
+ return localize.ordinalNumber(hours, {
1388
+ unit: 'hour'
1389
+ });
1390
+ }
1391
+ return addLeadingZeros(hours, token.length);
1392
+ },
1393
+ // Hour [1-24]
1394
+ k: function k(date, token, localize) {
1395
+ var hours = date.getUTCHours();
1396
+ if (hours === 0) hours = 24;
1397
+ if (token === 'ko') {
1398
+ return localize.ordinalNumber(hours, {
1399
+ unit: 'hour'
1400
+ });
1401
+ }
1402
+ return addLeadingZeros(hours, token.length);
1403
+ },
1404
+ // Minute
1405
+ m: function m(date, token, localize) {
1406
+ if (token === 'mo') {
1407
+ return localize.ordinalNumber(date.getUTCMinutes(), {
1408
+ unit: 'minute'
1409
+ });
1410
+ }
1411
+ return formatters$3.m(date, token);
1412
+ },
1413
+ // Second
1414
+ s: function s(date, token, localize) {
1415
+ if (token === 'so') {
1416
+ return localize.ordinalNumber(date.getUTCSeconds(), {
1417
+ unit: 'second'
1418
+ });
1419
+ }
1420
+ return formatters$3.s(date, token);
1421
+ },
1422
+ // Fraction of second
1423
+ S: function S(date, token) {
1424
+ return formatters$3.S(date, token);
1425
+ },
1426
+ // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
1427
+ X: function X(date, token, _localize, options) {
1428
+ var originalDate = options._originalDate || date;
1429
+ var timezoneOffset = originalDate.getTimezoneOffset();
1430
+ if (timezoneOffset === 0) {
1431
+ return 'Z';
1432
+ }
1433
+ switch (token) {
1434
+ // Hours and optional minutes
1435
+ case 'X':
1436
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
1437
+
1438
+ // Hours, minutes and optional seconds without `:` delimiter
1439
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1440
+ // so this token always has the same output as `XX`
1441
+ case 'XXXX':
1442
+ case 'XX':
1443
+ // Hours and minutes without `:` delimiter
1444
+ return formatTimezone(timezoneOffset);
1445
+
1446
+ // Hours, minutes and optional seconds with `:` delimiter
1447
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1448
+ // so this token always has the same output as `XXX`
1449
+ case 'XXXXX':
1450
+ case 'XXX': // Hours and minutes with `:` delimiter
1451
+ default:
1452
+ return formatTimezone(timezoneOffset, ':');
1453
+ }
1454
+ },
1455
+ // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
1456
+ x: function x(date, token, _localize, options) {
1457
+ var originalDate = options._originalDate || date;
1458
+ var timezoneOffset = originalDate.getTimezoneOffset();
1459
+ switch (token) {
1460
+ // Hours and optional minutes
1461
+ case 'x':
1462
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
1463
+
1464
+ // Hours, minutes and optional seconds without `:` delimiter
1465
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1466
+ // so this token always has the same output as `xx`
1467
+ case 'xxxx':
1468
+ case 'xx':
1469
+ // Hours and minutes without `:` delimiter
1470
+ return formatTimezone(timezoneOffset);
1471
+
1472
+ // Hours, minutes and optional seconds with `:` delimiter
1473
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1474
+ // so this token always has the same output as `xxx`
1475
+ case 'xxxxx':
1476
+ case 'xxx': // Hours and minutes with `:` delimiter
1477
+ default:
1478
+ return formatTimezone(timezoneOffset, ':');
1479
+ }
1480
+ },
1481
+ // Timezone (GMT)
1482
+ O: function O(date, token, _localize, options) {
1483
+ var originalDate = options._originalDate || date;
1484
+ var timezoneOffset = originalDate.getTimezoneOffset();
1485
+ switch (token) {
1486
+ // Short
1487
+ case 'O':
1488
+ case 'OO':
1489
+ case 'OOO':
1490
+ return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
1491
+ // Long
1492
+ case 'OOOO':
1493
+ default:
1494
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
1495
+ }
1496
+ },
1497
+ // Timezone (specific non-location)
1498
+ z: function z(date, token, _localize, options) {
1499
+ var originalDate = options._originalDate || date;
1500
+ var timezoneOffset = originalDate.getTimezoneOffset();
1501
+ switch (token) {
1502
+ // Short
1503
+ case 'z':
1504
+ case 'zz':
1505
+ case 'zzz':
1506
+ return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
1507
+ // Long
1508
+ case 'zzzz':
1509
+ default:
1510
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
1511
+ }
1512
+ },
1513
+ // Seconds timestamp
1514
+ t: function t(date, token, _localize, options) {
1515
+ var originalDate = options._originalDate || date;
1516
+ var timestamp = Math.floor(originalDate.getTime() / 1000);
1517
+ return addLeadingZeros(timestamp, token.length);
1518
+ },
1519
+ // Milliseconds timestamp
1520
+ T: function T(date, token, _localize, options) {
1521
+ var originalDate = options._originalDate || date;
1522
+ var timestamp = originalDate.getTime();
1523
+ return addLeadingZeros(timestamp, token.length);
1524
+ }
1525
+ };
1526
+ function formatTimezoneShort(offset, dirtyDelimiter) {
1527
+ var sign = offset > 0 ? '-' : '+';
1528
+ var absOffset = Math.abs(offset);
1529
+ var hours = Math.floor(absOffset / 60);
1530
+ var minutes = absOffset % 60;
1531
+ if (minutes === 0) {
1532
+ return sign + String(hours);
1533
+ }
1534
+ var delimiter = dirtyDelimiter || '';
1535
+ return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
1536
+ }
1537
+ function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
1538
+ if (offset % 60 === 0) {
1539
+ var sign = offset > 0 ? '-' : '+';
1540
+ return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
1541
+ }
1542
+ return formatTimezone(offset, dirtyDelimiter);
1543
+ }
1544
+ function formatTimezone(offset, dirtyDelimiter) {
1545
+ var delimiter = dirtyDelimiter || '';
1546
+ var sign = offset > 0 ? '-' : '+';
1547
+ var absOffset = Math.abs(offset);
1548
+ var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
1549
+ var minutes = addLeadingZeros(absOffset % 60, 2);
1550
+ return sign + hours + delimiter + minutes;
1551
+ }
1552
+ const formatters$1 = formatters;
1553
+
1554
+ var dateLongFormatter = function dateLongFormatter(pattern, formatLong) {
1555
+ switch (pattern) {
1556
+ case 'P':
1557
+ return formatLong.date({
1558
+ width: 'short'
1559
+ });
1560
+ case 'PP':
1561
+ return formatLong.date({
1562
+ width: 'medium'
1563
+ });
1564
+ case 'PPP':
1565
+ return formatLong.date({
1566
+ width: 'long'
1567
+ });
1568
+ case 'PPPP':
1569
+ default:
1570
+ return formatLong.date({
1571
+ width: 'full'
1572
+ });
1573
+ }
1574
+ };
1575
+ var timeLongFormatter = function timeLongFormatter(pattern, formatLong) {
1576
+ switch (pattern) {
1577
+ case 'p':
1578
+ return formatLong.time({
1579
+ width: 'short'
1580
+ });
1581
+ case 'pp':
1582
+ return formatLong.time({
1583
+ width: 'medium'
1584
+ });
1585
+ case 'ppp':
1586
+ return formatLong.time({
1587
+ width: 'long'
1588
+ });
1589
+ case 'pppp':
1590
+ default:
1591
+ return formatLong.time({
1592
+ width: 'full'
1593
+ });
1594
+ }
1595
+ };
1596
+ var dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) {
1597
+ var matchResult = pattern.match(/(P+)(p+)?/) || [];
1598
+ var datePattern = matchResult[1];
1599
+ var timePattern = matchResult[2];
1600
+ if (!timePattern) {
1601
+ return dateLongFormatter(pattern, formatLong);
1602
+ }
1603
+ var dateTimeFormat;
1604
+ switch (datePattern) {
1605
+ case 'P':
1606
+ dateTimeFormat = formatLong.dateTime({
1607
+ width: 'short'
1608
+ });
1609
+ break;
1610
+ case 'PP':
1611
+ dateTimeFormat = formatLong.dateTime({
1612
+ width: 'medium'
1613
+ });
1614
+ break;
1615
+ case 'PPP':
1616
+ dateTimeFormat = formatLong.dateTime({
1617
+ width: 'long'
1618
+ });
1619
+ break;
1620
+ case 'PPPP':
1621
+ default:
1622
+ dateTimeFormat = formatLong.dateTime({
1623
+ width: 'full'
1624
+ });
1625
+ break;
1626
+ }
1627
+ return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
1628
+ };
1629
+ var longFormatters = {
1630
+ p: timeLongFormatter,
1631
+ P: dateTimeLongFormatter
1632
+ };
1633
+ const longFormatters$1 = longFormatters;
1634
+
1635
+ var protectedDayOfYearTokens = ['D', 'DD'];
1636
+ var protectedWeekYearTokens = ['YY', 'YYYY'];
1637
+ function isProtectedDayOfYearToken(token) {
1638
+ return protectedDayOfYearTokens.indexOf(token) !== -1;
1639
+ }
1640
+ function isProtectedWeekYearToken(token) {
1641
+ return protectedWeekYearTokens.indexOf(token) !== -1;
1642
+ }
1643
+ function throwProtectedError(token, format, input) {
1644
+ if (token === 'YYYY') {
1645
+ 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"));
1646
+ } else if (token === 'YY') {
1647
+ 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"));
1648
+ } else if (token === 'D') {
1649
+ 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"));
1650
+ } else if (token === 'DD') {
1651
+ 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"));
1652
+ }
1653
+ }
1654
+
1655
+ var formatDistanceLocale = {
1656
+ lessThanXSeconds: {
1657
+ one: 'less than a second',
1658
+ other: 'less than {{count}} seconds'
1659
+ },
1660
+ xSeconds: {
1661
+ one: '1 second',
1662
+ other: '{{count}} seconds'
1663
+ },
1664
+ halfAMinute: 'half a minute',
1665
+ lessThanXMinutes: {
1666
+ one: 'less than a minute',
1667
+ other: 'less than {{count}} minutes'
1668
+ },
1669
+ xMinutes: {
1670
+ one: '1 minute',
1671
+ other: '{{count}} minutes'
1672
+ },
1673
+ aboutXHours: {
1674
+ one: 'about 1 hour',
1675
+ other: 'about {{count}} hours'
1676
+ },
1677
+ xHours: {
1678
+ one: '1 hour',
1679
+ other: '{{count}} hours'
1680
+ },
1681
+ xDays: {
1682
+ one: '1 day',
1683
+ other: '{{count}} days'
1684
+ },
1685
+ aboutXWeeks: {
1686
+ one: 'about 1 week',
1687
+ other: 'about {{count}} weeks'
1688
+ },
1689
+ xWeeks: {
1690
+ one: '1 week',
1691
+ other: '{{count}} weeks'
1692
+ },
1693
+ aboutXMonths: {
1694
+ one: 'about 1 month',
1695
+ other: 'about {{count}} months'
1696
+ },
1697
+ xMonths: {
1698
+ one: '1 month',
1699
+ other: '{{count}} months'
1700
+ },
1701
+ aboutXYears: {
1702
+ one: 'about 1 year',
1703
+ other: 'about {{count}} years'
1704
+ },
1705
+ xYears: {
1706
+ one: '1 year',
1707
+ other: '{{count}} years'
1708
+ },
1709
+ overXYears: {
1710
+ one: 'over 1 year',
1711
+ other: 'over {{count}} years'
1712
+ },
1713
+ almostXYears: {
1714
+ one: 'almost 1 year',
1715
+ other: 'almost {{count}} years'
1716
+ }
1717
+ };
1718
+ var formatDistance = function formatDistance(token, count, options) {
1719
+ var result;
1720
+ var tokenValue = formatDistanceLocale[token];
1721
+ if (typeof tokenValue === 'string') {
1722
+ result = tokenValue;
1723
+ } else if (count === 1) {
1724
+ result = tokenValue.one;
1725
+ } else {
1726
+ result = tokenValue.other.replace('{{count}}', count.toString());
1727
+ }
1728
+ if (options !== null && options !== void 0 && options.addSuffix) {
1729
+ if (options.comparison && options.comparison > 0) {
1730
+ return 'in ' + result;
1731
+ } else {
1732
+ return result + ' ago';
1733
+ }
1734
+ }
1735
+ return result;
1736
+ };
1737
+ const formatDistance$1 = formatDistance;
1738
+
1739
+ function buildFormatLongFn(args) {
1740
+ return function () {
1741
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1742
+ // TODO: Remove String()
1743
+ var width = options.width ? String(options.width) : args.defaultWidth;
1744
+ var format = args.formats[width] || args.formats[args.defaultWidth];
1745
+ return format;
1746
+ };
1747
+ }
1748
+
1749
+ var dateFormats = {
1750
+ full: 'EEEE, MMMM do, y',
1751
+ long: 'MMMM do, y',
1752
+ medium: 'MMM d, y',
1753
+ short: 'MM/dd/yyyy'
1754
+ };
1755
+ var timeFormats = {
1756
+ full: 'h:mm:ss a zzzz',
1757
+ long: 'h:mm:ss a z',
1758
+ medium: 'h:mm:ss a',
1759
+ short: 'h:mm a'
1760
+ };
1761
+ var dateTimeFormats = {
1762
+ full: "{{date}} 'at' {{time}}",
1763
+ long: "{{date}} 'at' {{time}}",
1764
+ medium: '{{date}}, {{time}}',
1765
+ short: '{{date}}, {{time}}'
1766
+ };
1767
+ var formatLong = {
1768
+ date: buildFormatLongFn({
1769
+ formats: dateFormats,
1770
+ defaultWidth: 'full'
1771
+ }),
1772
+ time: buildFormatLongFn({
1773
+ formats: timeFormats,
1774
+ defaultWidth: 'full'
1775
+ }),
1776
+ dateTime: buildFormatLongFn({
1777
+ formats: dateTimeFormats,
1778
+ defaultWidth: 'full'
1779
+ })
1780
+ };
1781
+ const formatLong$1 = formatLong;
1782
+
1783
+ var formatRelativeLocale = {
1784
+ lastWeek: "'last' eeee 'at' p",
1785
+ yesterday: "'yesterday at' p",
1786
+ today: "'today at' p",
1787
+ tomorrow: "'tomorrow at' p",
1788
+ nextWeek: "eeee 'at' p",
1789
+ other: 'P'
1790
+ };
1791
+ var formatRelative = function formatRelative(token, _date, _baseDate, _options) {
1792
+ return formatRelativeLocale[token];
1793
+ };
1794
+ const formatRelative$1 = formatRelative;
1795
+
1796
+ function buildLocalizeFn(args) {
1797
+ return function (dirtyIndex, options) {
1798
+ var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';
1799
+ var valuesArray;
1800
+ if (context === 'formatting' && args.formattingValues) {
1801
+ var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
1802
+ var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
1803
+ valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
1804
+ } else {
1805
+ var _defaultWidth = args.defaultWidth;
1806
+ var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
1807
+ valuesArray = args.values[_width] || args.values[_defaultWidth];
1808
+ }
1809
+ var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
1810
+ // @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!
1811
+ return valuesArray[index];
1812
+ };
1813
+ }
1814
+
1815
+ var eraValues = {
1816
+ narrow: ['B', 'A'],
1817
+ abbreviated: ['BC', 'AD'],
1818
+ wide: ['Before Christ', 'Anno Domini']
1819
+ };
1820
+ var quarterValues = {
1821
+ narrow: ['1', '2', '3', '4'],
1822
+ abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
1823
+ wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
1824
+ };
1825
+
1826
+ // Note: in English, the names of days of the week and months are capitalized.
1827
+ // If you are making a new locale based on this one, check if the same is true for the language you're working on.
1828
+ // Generally, formatted dates should look like they are in the middle of a sentence,
1829
+ // e.g. in Spanish language the weekdays and months should be in the lowercase.
1830
+ var monthValues = {
1831
+ narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
1832
+ abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
1833
+ wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
1834
+ };
1835
+ var dayValues = {
1836
+ narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
1837
+ short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
1838
+ abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
1839
+ wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
1840
+ };
1841
+ var dayPeriodValues = {
1842
+ narrow: {
1843
+ am: 'a',
1844
+ pm: 'p',
1845
+ midnight: 'mi',
1846
+ noon: 'n',
1847
+ morning: 'morning',
1848
+ afternoon: 'afternoon',
1849
+ evening: 'evening',
1850
+ night: 'night'
1851
+ },
1852
+ abbreviated: {
1853
+ am: 'AM',
1854
+ pm: 'PM',
1855
+ midnight: 'midnight',
1856
+ noon: 'noon',
1857
+ morning: 'morning',
1858
+ afternoon: 'afternoon',
1859
+ evening: 'evening',
1860
+ night: 'night'
1861
+ },
1862
+ wide: {
1863
+ am: 'a.m.',
1864
+ pm: 'p.m.',
1865
+ midnight: 'midnight',
1866
+ noon: 'noon',
1867
+ morning: 'morning',
1868
+ afternoon: 'afternoon',
1869
+ evening: 'evening',
1870
+ night: 'night'
1871
+ }
1872
+ };
1873
+ var formattingDayPeriodValues = {
1874
+ narrow: {
1875
+ am: 'a',
1876
+ pm: 'p',
1877
+ midnight: 'mi',
1878
+ noon: 'n',
1879
+ morning: 'in the morning',
1880
+ afternoon: 'in the afternoon',
1881
+ evening: 'in the evening',
1882
+ night: 'at night'
1883
+ },
1884
+ abbreviated: {
1885
+ am: 'AM',
1886
+ pm: 'PM',
1887
+ midnight: 'midnight',
1888
+ noon: 'noon',
1889
+ morning: 'in the morning',
1890
+ afternoon: 'in the afternoon',
1891
+ evening: 'in the evening',
1892
+ night: 'at night'
1893
+ },
1894
+ wide: {
1895
+ am: 'a.m.',
1896
+ pm: 'p.m.',
1897
+ midnight: 'midnight',
1898
+ noon: 'noon',
1899
+ morning: 'in the morning',
1900
+ afternoon: 'in the afternoon',
1901
+ evening: 'in the evening',
1902
+ night: 'at night'
1903
+ }
1904
+ };
1905
+ var ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
1906
+ var number = Number(dirtyNumber);
1907
+
1908
+ // If ordinal numbers depend on context, for example,
1909
+ // if they are different for different grammatical genders,
1910
+ // use `options.unit`.
1911
+ //
1912
+ // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
1913
+ // 'day', 'hour', 'minute', 'second'.
1914
+
1915
+ var rem100 = number % 100;
1916
+ if (rem100 > 20 || rem100 < 10) {
1917
+ switch (rem100 % 10) {
1918
+ case 1:
1919
+ return number + 'st';
1920
+ case 2:
1921
+ return number + 'nd';
1922
+ case 3:
1923
+ return number + 'rd';
1924
+ }
1925
+ }
1926
+ return number + 'th';
1927
+ };
1928
+ var localize = {
1929
+ ordinalNumber: ordinalNumber,
1930
+ era: buildLocalizeFn({
1931
+ values: eraValues,
1932
+ defaultWidth: 'wide'
1933
+ }),
1934
+ quarter: buildLocalizeFn({
1935
+ values: quarterValues,
1936
+ defaultWidth: 'wide',
1937
+ argumentCallback: function argumentCallback(quarter) {
1938
+ return quarter - 1;
1939
+ }
1940
+ }),
1941
+ month: buildLocalizeFn({
1942
+ values: monthValues,
1943
+ defaultWidth: 'wide'
1944
+ }),
1945
+ day: buildLocalizeFn({
1946
+ values: dayValues,
1947
+ defaultWidth: 'wide'
1948
+ }),
1949
+ dayPeriod: buildLocalizeFn({
1950
+ values: dayPeriodValues,
1951
+ defaultWidth: 'wide',
1952
+ formattingValues: formattingDayPeriodValues,
1953
+ defaultFormattingWidth: 'wide'
1954
+ })
1955
+ };
1956
+ const localize$1 = localize;
1957
+
1958
+ function buildMatchFn(args) {
1959
+ return function (string) {
1960
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1961
+ var width = options.width;
1962
+ var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
1963
+ var matchResult = string.match(matchPattern);
1964
+ if (!matchResult) {
1965
+ return null;
1966
+ }
1967
+ var matchedString = matchResult[0];
1968
+ var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
1969
+ var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
1970
+ return pattern.test(matchedString);
1971
+ }) : findKey(parsePatterns, function (pattern) {
1972
+ return pattern.test(matchedString);
1973
+ });
1974
+ var value;
1975
+ value = args.valueCallback ? args.valueCallback(key) : key;
1976
+ value = options.valueCallback ? options.valueCallback(value) : value;
1977
+ var rest = string.slice(matchedString.length);
1978
+ return {
1979
+ value: value,
1980
+ rest: rest
1981
+ };
1982
+ };
1983
+ }
1984
+ function findKey(object, predicate) {
1985
+ for (var key in object) {
1986
+ if (object.hasOwnProperty(key) && predicate(object[key])) {
1987
+ return key;
1988
+ }
1989
+ }
1990
+ return undefined;
1991
+ }
1992
+ function findIndex(array, predicate) {
1993
+ for (var key = 0; key < array.length; key++) {
1994
+ if (predicate(array[key])) {
1995
+ return key;
1996
+ }
1997
+ }
1998
+ return undefined;
1999
+ }
2000
+
2001
+ function buildMatchPatternFn(args) {
2002
+ return function (string) {
2003
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2004
+ var matchResult = string.match(args.matchPattern);
2005
+ if (!matchResult) return null;
2006
+ var matchedString = matchResult[0];
2007
+ var parseResult = string.match(args.parsePattern);
2008
+ if (!parseResult) return null;
2009
+ var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
2010
+ value = options.valueCallback ? options.valueCallback(value) : value;
2011
+ var rest = string.slice(matchedString.length);
2012
+ return {
2013
+ value: value,
2014
+ rest: rest
2015
+ };
2016
+ };
2017
+ }
2018
+
2019
+ var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
2020
+ var parseOrdinalNumberPattern = /\d+/i;
2021
+ var matchEraPatterns = {
2022
+ narrow: /^(b|a)/i,
2023
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
2024
+ wide: /^(before christ|before common era|anno domini|common era)/i
2025
+ };
2026
+ var parseEraPatterns = {
2027
+ any: [/^b/i, /^(a|c)/i]
2028
+ };
2029
+ var matchQuarterPatterns = {
2030
+ narrow: /^[1234]/i,
2031
+ abbreviated: /^q[1234]/i,
2032
+ wide: /^[1234](th|st|nd|rd)? quarter/i
2033
+ };
2034
+ var parseQuarterPatterns = {
2035
+ any: [/1/i, /2/i, /3/i, /4/i]
2036
+ };
2037
+ var matchMonthPatterns = {
2038
+ narrow: /^[jfmasond]/i,
2039
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
2040
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
2041
+ };
2042
+ var parseMonthPatterns = {
2043
+ 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],
2044
+ 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]
2045
+ };
2046
+ var matchDayPatterns = {
2047
+ narrow: /^[smtwf]/i,
2048
+ short: /^(su|mo|tu|we|th|fr|sa)/i,
2049
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
2050
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
2051
+ };
2052
+ var parseDayPatterns = {
2053
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
2054
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
2055
+ };
2056
+ var matchDayPeriodPatterns = {
2057
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
2058
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
2059
+ };
2060
+ var parseDayPeriodPatterns = {
2061
+ any: {
2062
+ am: /^a/i,
2063
+ pm: /^p/i,
2064
+ midnight: /^mi/i,
2065
+ noon: /^no/i,
2066
+ morning: /morning/i,
2067
+ afternoon: /afternoon/i,
2068
+ evening: /evening/i,
2069
+ night: /night/i
2070
+ }
2071
+ };
2072
+ var match = {
2073
+ ordinalNumber: buildMatchPatternFn({
2074
+ matchPattern: matchOrdinalNumberPattern,
2075
+ parsePattern: parseOrdinalNumberPattern,
2076
+ valueCallback: function valueCallback(value) {
2077
+ return parseInt(value, 10);
2078
+ }
2079
+ }),
2080
+ era: buildMatchFn({
2081
+ matchPatterns: matchEraPatterns,
2082
+ defaultMatchWidth: 'wide',
2083
+ parsePatterns: parseEraPatterns,
2084
+ defaultParseWidth: 'any'
2085
+ }),
2086
+ quarter: buildMatchFn({
2087
+ matchPatterns: matchQuarterPatterns,
2088
+ defaultMatchWidth: 'wide',
2089
+ parsePatterns: parseQuarterPatterns,
2090
+ defaultParseWidth: 'any',
2091
+ valueCallback: function valueCallback(index) {
2092
+ return index + 1;
2093
+ }
2094
+ }),
2095
+ month: buildMatchFn({
2096
+ matchPatterns: matchMonthPatterns,
2097
+ defaultMatchWidth: 'wide',
2098
+ parsePatterns: parseMonthPatterns,
2099
+ defaultParseWidth: 'any'
2100
+ }),
2101
+ day: buildMatchFn({
2102
+ matchPatterns: matchDayPatterns,
2103
+ defaultMatchWidth: 'wide',
2104
+ parsePatterns: parseDayPatterns,
2105
+ defaultParseWidth: 'any'
2106
+ }),
2107
+ dayPeriod: buildMatchFn({
2108
+ matchPatterns: matchDayPeriodPatterns,
2109
+ defaultMatchWidth: 'any',
2110
+ parsePatterns: parseDayPeriodPatterns,
2111
+ defaultParseWidth: 'any'
2112
+ })
2113
+ };
2114
+ const match$1 = match;
2115
+
2116
+ /**
2117
+ * @type {Locale}
2118
+ * @category Locales
2119
+ * @summary English locale (United States).
2120
+ * @language English
2121
+ * @iso-639-2 eng
2122
+ * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
2123
+ * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
2124
+ */
2125
+ var locale = {
2126
+ code: 'en-US',
2127
+ formatDistance: formatDistance$1,
2128
+ formatLong: formatLong$1,
2129
+ formatRelative: formatRelative$1,
2130
+ localize: localize$1,
2131
+ match: match$1,
2132
+ options: {
2133
+ weekStartsOn: 0 /* Sunday */,
2134
+ firstWeekContainsDate: 1
2135
+ }
2136
+ };
2137
+ const defaultLocale = locale;
2138
+
2139
+ // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
2140
+ // (one of the certain letters followed by `o`)
2141
+ // - (\w)\1* matches any sequences of the same letter
2142
+ // - '' matches two quote characters in a row
2143
+ // - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
2144
+ // except a single quote symbol, which ends the sequence.
2145
+ // Two quote characters do not end the sequence.
2146
+ // If there is no matching single quote
2147
+ // then the sequence will continue until the end of the string.
2148
+ // - . matches any single character unmatched by previous parts of the RegExps
2149
+ var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
2150
+
2151
+ // This RegExp catches symbols escaped by quotes, and also
2152
+ // sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
2153
+ var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
2154
+ var escapedStringRegExp = /^'([^]*?)'?$/;
2155
+ var doubleQuoteRegExp = /''/g;
2156
+ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
2157
+
2158
+ /**
2159
+ * @name format
2160
+ * @category Common Helpers
2161
+ * @summary Format the date.
2162
+ *
2163
+ * @description
2164
+ * Return the formatted date string in the given format. The result may vary by locale.
2165
+ *
2166
+ * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
2167
+ * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2168
+ *
2169
+ * The characters wrapped between two single quotes characters (') are escaped.
2170
+ * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
2171
+ * (see the last example)
2172
+ *
2173
+ * Format of the string is based on Unicode Technical Standard #35:
2174
+ * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
2175
+ * with a few additions (see note 7 below the table).
2176
+ *
2177
+ * Accepted patterns:
2178
+ * | Unit | Pattern | Result examples | Notes |
2179
+ * |---------------------------------|---------|-----------------------------------|-------|
2180
+ * | Era | G..GGG | AD, BC | |
2181
+ * | | GGGG | Anno Domini, Before Christ | 2 |
2182
+ * | | GGGGG | A, B | |
2183
+ * | Calendar year | y | 44, 1, 1900, 2017 | 5 |
2184
+ * | | yo | 44th, 1st, 0th, 17th | 5,7 |
2185
+ * | | yy | 44, 01, 00, 17 | 5 |
2186
+ * | | yyy | 044, 001, 1900, 2017 | 5 |
2187
+ * | | yyyy | 0044, 0001, 1900, 2017 | 5 |
2188
+ * | | yyyyy | ... | 3,5 |
2189
+ * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
2190
+ * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
2191
+ * | | YY | 44, 01, 00, 17 | 5,8 |
2192
+ * | | YYY | 044, 001, 1900, 2017 | 5 |
2193
+ * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
2194
+ * | | YYYYY | ... | 3,5 |
2195
+ * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
2196
+ * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
2197
+ * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
2198
+ * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
2199
+ * | | RRRRR | ... | 3,5,7 |
2200
+ * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
2201
+ * | | uu | -43, 01, 1900, 2017 | 5 |
2202
+ * | | uuu | -043, 001, 1900, 2017 | 5 |
2203
+ * | | uuuu | -0043, 0001, 1900, 2017 | 5 |
2204
+ * | | uuuuu | ... | 3,5 |
2205
+ * | Quarter (formatting) | Q | 1, 2, 3, 4 | |
2206
+ * | | Qo | 1st, 2nd, 3rd, 4th | 7 |
2207
+ * | | QQ | 01, 02, 03, 04 | |
2208
+ * | | QQQ | Q1, Q2, Q3, Q4 | |
2209
+ * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
2210
+ * | | QQQQQ | 1, 2, 3, 4 | 4 |
2211
+ * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
2212
+ * | | qo | 1st, 2nd, 3rd, 4th | 7 |
2213
+ * | | qq | 01, 02, 03, 04 | |
2214
+ * | | qqq | Q1, Q2, Q3, Q4 | |
2215
+ * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
2216
+ * | | qqqqq | 1, 2, 3, 4 | 4 |
2217
+ * | Month (formatting) | M | 1, 2, ..., 12 | |
2218
+ * | | Mo | 1st, 2nd, ..., 12th | 7 |
2219
+ * | | MM | 01, 02, ..., 12 | |
2220
+ * | | MMM | Jan, Feb, ..., Dec | |
2221
+ * | | MMMM | January, February, ..., December | 2 |
2222
+ * | | MMMMM | J, F, ..., D | |
2223
+ * | Month (stand-alone) | L | 1, 2, ..., 12 | |
2224
+ * | | Lo | 1st, 2nd, ..., 12th | 7 |
2225
+ * | | LL | 01, 02, ..., 12 | |
2226
+ * | | LLL | Jan, Feb, ..., Dec | |
2227
+ * | | LLLL | January, February, ..., December | 2 |
2228
+ * | | LLLLL | J, F, ..., D | |
2229
+ * | Local week of year | w | 1, 2, ..., 53 | |
2230
+ * | | wo | 1st, 2nd, ..., 53th | 7 |
2231
+ * | | ww | 01, 02, ..., 53 | |
2232
+ * | ISO week of year | I | 1, 2, ..., 53 | 7 |
2233
+ * | | Io | 1st, 2nd, ..., 53th | 7 |
2234
+ * | | II | 01, 02, ..., 53 | 7 |
2235
+ * | Day of month | d | 1, 2, ..., 31 | |
2236
+ * | | do | 1st, 2nd, ..., 31st | 7 |
2237
+ * | | dd | 01, 02, ..., 31 | |
2238
+ * | Day of year | D | 1, 2, ..., 365, 366 | 9 |
2239
+ * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
2240
+ * | | DD | 01, 02, ..., 365, 366 | 9 |
2241
+ * | | DDD | 001, 002, ..., 365, 366 | |
2242
+ * | | DDDD | ... | 3 |
2243
+ * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
2244
+ * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
2245
+ * | | EEEEE | M, T, W, T, F, S, S | |
2246
+ * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
2247
+ * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
2248
+ * | | io | 1st, 2nd, ..., 7th | 7 |
2249
+ * | | ii | 01, 02, ..., 07 | 7 |
2250
+ * | | iii | Mon, Tue, Wed, ..., Sun | 7 |
2251
+ * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
2252
+ * | | iiiii | M, T, W, T, F, S, S | 7 |
2253
+ * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
2254
+ * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
2255
+ * | | eo | 2nd, 3rd, ..., 1st | 7 |
2256
+ * | | ee | 02, 03, ..., 01 | |
2257
+ * | | eee | Mon, Tue, Wed, ..., Sun | |
2258
+ * | | eeee | Monday, Tuesday, ..., Sunday | 2 |
2259
+ * | | eeeee | M, T, W, T, F, S, S | |
2260
+ * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
2261
+ * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
2262
+ * | | co | 2nd, 3rd, ..., 1st | 7 |
2263
+ * | | cc | 02, 03, ..., 01 | |
2264
+ * | | ccc | Mon, Tue, Wed, ..., Sun | |
2265
+ * | | cccc | Monday, Tuesday, ..., Sunday | 2 |
2266
+ * | | ccccc | M, T, W, T, F, S, S | |
2267
+ * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
2268
+ * | AM, PM | a..aa | AM, PM | |
2269
+ * | | aaa | am, pm | |
2270
+ * | | aaaa | a.m., p.m. | 2 |
2271
+ * | | aaaaa | a, p | |
2272
+ * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
2273
+ * | | bbb | am, pm, noon, midnight | |
2274
+ * | | bbbb | a.m., p.m., noon, midnight | 2 |
2275
+ * | | bbbbb | a, p, n, mi | |
2276
+ * | Flexible day period | B..BBB | at night, in the morning, ... | |
2277
+ * | | BBBB | at night, in the morning, ... | 2 |
2278
+ * | | BBBBB | at night, in the morning, ... | |
2279
+ * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
2280
+ * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
2281
+ * | | hh | 01, 02, ..., 11, 12 | |
2282
+ * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
2283
+ * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
2284
+ * | | HH | 00, 01, 02, ..., 23 | |
2285
+ * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
2286
+ * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
2287
+ * | | KK | 01, 02, ..., 11, 00 | |
2288
+ * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
2289
+ * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
2290
+ * | | kk | 24, 01, 02, ..., 23 | |
2291
+ * | Minute | m | 0, 1, ..., 59 | |
2292
+ * | | mo | 0th, 1st, ..., 59th | 7 |
2293
+ * | | mm | 00, 01, ..., 59 | |
2294
+ * | Second | s | 0, 1, ..., 59 | |
2295
+ * | | so | 0th, 1st, ..., 59th | 7 |
2296
+ * | | ss | 00, 01, ..., 59 | |
2297
+ * | Fraction of second | S | 0, 1, ..., 9 | |
2298
+ * | | SS | 00, 01, ..., 99 | |
2299
+ * | | SSS | 000, 001, ..., 999 | |
2300
+ * | | SSSS | ... | 3 |
2301
+ * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
2302
+ * | | XX | -0800, +0530, Z | |
2303
+ * | | XXX | -08:00, +05:30, Z | |
2304
+ * | | XXXX | -0800, +0530, Z, +123456 | 2 |
2305
+ * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
2306
+ * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
2307
+ * | | xx | -0800, +0530, +0000 | |
2308
+ * | | xxx | -08:00, +05:30, +00:00 | 2 |
2309
+ * | | xxxx | -0800, +0530, +0000, +123456 | |
2310
+ * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
2311
+ * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
2312
+ * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
2313
+ * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
2314
+ * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
2315
+ * | Seconds timestamp | t | 512969520 | 7 |
2316
+ * | | tt | ... | 3,7 |
2317
+ * | Milliseconds timestamp | T | 512969520900 | 7 |
2318
+ * | | TT | ... | 3,7 |
2319
+ * | Long localized date | P | 04/29/1453 | 7 |
2320
+ * | | PP | Apr 29, 1453 | 7 |
2321
+ * | | PPP | April 29th, 1453 | 7 |
2322
+ * | | PPPP | Friday, April 29th, 1453 | 2,7 |
2323
+ * | Long localized time | p | 12:00 AM | 7 |
2324
+ * | | pp | 12:00:00 AM | 7 |
2325
+ * | | ppp | 12:00:00 AM GMT+2 | 7 |
2326
+ * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
2327
+ * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
2328
+ * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
2329
+ * | | PPPppp | April 29th, 1453 at ... | 7 |
2330
+ * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
2331
+ * Notes:
2332
+ * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
2333
+ * are the same as "stand-alone" units, but are different in some languages.
2334
+ * "Formatting" units are declined according to the rules of the language
2335
+ * in the context of a date. "Stand-alone" units are always nominative singular:
2336
+ *
2337
+ * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
2338
+ *
2339
+ * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
2340
+ *
2341
+ * 2. Any sequence of the identical letters is a pattern, unless it is escaped by
2342
+ * the single quote characters (see below).
2343
+ * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
2344
+ * the output will be the same as default pattern for this unit, usually
2345
+ * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
2346
+ * are marked with "2" in the last column of the table.
2347
+ *
2348
+ * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
2349
+ *
2350
+ * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
2351
+ *
2352
+ * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
2353
+ *
2354
+ * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
2355
+ *
2356
+ * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
2357
+ *
2358
+ * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
2359
+ * The output will be padded with zeros to match the length of the pattern.
2360
+ *
2361
+ * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
2362
+ *
2363
+ * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
2364
+ * These tokens represent the shortest form of the quarter.
2365
+ *
2366
+ * 5. The main difference between `y` and `u` patterns are B.C. years:
2367
+ *
2368
+ * | Year | `y` | `u` |
2369
+ * |------|-----|-----|
2370
+ * | AC 1 | 1 | 1 |
2371
+ * | BC 1 | 1 | 0 |
2372
+ * | BC 2 | 2 | -1 |
2373
+ *
2374
+ * Also `yy` always returns the last two digits of a year,
2375
+ * while `uu` pads single digit years to 2 characters and returns other years unchanged:
2376
+ *
2377
+ * | Year | `yy` | `uu` |
2378
+ * |------|------|------|
2379
+ * | 1 | 01 | 01 |
2380
+ * | 14 | 14 | 14 |
2381
+ * | 376 | 76 | 376 |
2382
+ * | 1453 | 53 | 1453 |
2383
+ *
2384
+ * The same difference is true for local and ISO week-numbering years (`Y` and `R`),
2385
+ * except local week-numbering years are dependent on `options.weekStartsOn`
2386
+ * and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}
2387
+ * and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).
2388
+ *
2389
+ * 6. Specific non-location timezones are currently unavailable in `date-fns`,
2390
+ * so right now these tokens fall back to GMT timezones.
2391
+ *
2392
+ * 7. These patterns are not in the Unicode Technical Standard #35:
2393
+ * - `i`: ISO day of week
2394
+ * - `I`: ISO week of year
2395
+ * - `R`: ISO week-numbering year
2396
+ * - `t`: seconds timestamp
2397
+ * - `T`: milliseconds timestamp
2398
+ * - `o`: ordinal number modifier
2399
+ * - `P`: long localized date
2400
+ * - `p`: long localized time
2401
+ *
2402
+ * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
2403
+ * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2404
+ *
2405
+ * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
2406
+ * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2407
+ *
2408
+ * @param {Date|Number} date - the original date
2409
+ * @param {String} format - the string of tokens
2410
+ * @param {Object} [options] - an object with options.
2411
+ * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
2412
+ * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
2413
+ * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
2414
+ * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
2415
+ * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2416
+ * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
2417
+ * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2418
+ * @returns {String} the formatted date string
2419
+ * @throws {TypeError} 2 arguments required
2420
+ * @throws {RangeError} `date` must not be Invalid Date
2421
+ * @throws {RangeError} `options.locale` must contain `localize` property
2422
+ * @throws {RangeError} `options.locale` must contain `formatLong` property
2423
+ * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
2424
+ * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
2425
+ * @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
2426
+ * @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
2427
+ * @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
2428
+ * @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
2429
+ * @throws {RangeError} format string contains an unescaped latin alphabet character
2430
+ *
2431
+ * @example
2432
+ * // Represent 11 February 2014 in middle-endian format:
2433
+ * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
2434
+ * //=> '02/11/2014'
2435
+ *
2436
+ * @example
2437
+ * // Represent 2 July 2014 in Esperanto:
2438
+ * import { eoLocale } from 'date-fns/locale/eo'
2439
+ * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
2440
+ * locale: eoLocale
2441
+ * })
2442
+ * //=> '2-a de julio 2014'
2443
+ *
2444
+ * @example
2445
+ * // Escape string by single quote characters:
2446
+ * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
2447
+ * //=> "3 o'clock"
2448
+ */
2449
+
2450
+ function format(dirtyDate, dirtyFormatStr, options) {
2451
+ 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;
2452
+ requiredArgs(2, arguments);
2453
+ var formatStr = String(dirtyFormatStr);
2454
+ var defaultOptions = getDefaultOptions();
2455
+ 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;
2456
+ 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);
2457
+
2458
+ // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
2459
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
2460
+ throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
2461
+ }
2462
+ 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);
2463
+
2464
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
2465
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
2466
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
2467
+ }
2468
+ if (!locale.localize) {
2469
+ throw new RangeError('locale must contain localize property');
2470
+ }
2471
+ if (!locale.formatLong) {
2472
+ throw new RangeError('locale must contain formatLong property');
2473
+ }
2474
+ var originalDate = toDate(dirtyDate);
2475
+ if (!isValid(originalDate)) {
2476
+ throw new RangeError('Invalid time value');
2477
+ }
2478
+
2479
+ // Convert the date in system timezone to the same date in UTC+00:00 timezone.
2480
+ // This ensures that when UTC functions will be implemented, locales will be compatible with them.
2481
+ // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
2482
+ var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
2483
+ var utcDate = subMilliseconds(originalDate, timezoneOffset);
2484
+ var formatterOptions = {
2485
+ firstWeekContainsDate: firstWeekContainsDate,
2486
+ weekStartsOn: weekStartsOn,
2487
+ locale: locale,
2488
+ _originalDate: originalDate
2489
+ };
2490
+ var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {
2491
+ var firstCharacter = substring[0];
2492
+ if (firstCharacter === 'p' || firstCharacter === 'P') {
2493
+ var longFormatter = longFormatters$1[firstCharacter];
2494
+ return longFormatter(substring, locale.formatLong);
2495
+ }
2496
+ return substring;
2497
+ }).join('').match(formattingTokensRegExp).map(function (substring) {
2498
+ // Replace two single quote characters with one single quote character
2499
+ if (substring === "''") {
2500
+ return "'";
2501
+ }
2502
+ var firstCharacter = substring[0];
2503
+ if (firstCharacter === "'") {
2504
+ return cleanEscapedString(substring);
2505
+ }
2506
+ var formatter = formatters$1[firstCharacter];
2507
+ if (formatter) {
2508
+ if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {
2509
+ throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
2510
+ }
2511
+ if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {
2512
+ throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
2513
+ }
2514
+ return formatter(utcDate, substring, locale.localize, formatterOptions);
2515
+ }
2516
+ if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
2517
+ throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');
2518
+ }
2519
+ return substring;
2520
+ }).join('');
2521
+ return result;
2522
+ }
2523
+ function cleanEscapedString(input) {
2524
+ var matched = input.match(escapedStringRegExp);
2525
+ if (!matched) {
2526
+ return input;
2527
+ }
2528
+ return matched[1].replace(doubleQuoteRegExp, "'");
2529
+ }
2530
+
2531
+ /**
2532
+ * @name isBefore
2533
+ * @category Common Helpers
2534
+ * @summary Is the first date before the second one?
2535
+ *
2536
+ * @description
2537
+ * Is the first date before the second one?
2538
+ *
2539
+ * @param {Date|Number} date - the date that should be before the other one to return true
2540
+ * @param {Date|Number} dateToCompare - the date to compare with
2541
+ * @returns {Boolean} the first date is before the second date
2542
+ * @throws {TypeError} 2 arguments required
2543
+ *
2544
+ * @example
2545
+ * // Is 10 July 1989 before 11 February 1987?
2546
+ * const result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))
2547
+ * //=> false
2548
+ */
2549
+ function isBefore(dirtyDate, dirtyDateToCompare) {
2550
+ requiredArgs(2, arguments);
2551
+ var date = toDate(dirtyDate);
2552
+ var dateToCompare = toDate(dirtyDateToCompare);
2553
+ return date.getTime() < dateToCompare.getTime();
2554
+ }
2555
+
2556
+ /**
2557
+ * @name isToday
2558
+ * @category Day Helpers
2559
+ * @summary Is the given date today?
2560
+ * @pure false
2561
+ *
2562
+ * @description
2563
+ * Is the given date today?
2564
+ *
2565
+ * > ⚠️ Please note that this function is not present in the FP submodule as
2566
+ * > it uses `Date.now()` internally hence impure and can't be safely curried.
2567
+ *
2568
+ * @param {Date|Number} date - the date to check
2569
+ * @returns {Boolean} the date is today
2570
+ * @throws {TypeError} 1 argument required
2571
+ *
2572
+ * @example
2573
+ * // If today is 6 October 2014, is 6 October 14:00:00 today?
2574
+ * const result = isToday(new Date(2014, 9, 6, 14, 0))
2575
+ * //=> true
2576
+ */
2577
+ function isToday(dirtyDate) {
2578
+ requiredArgs(1, arguments);
2579
+ return isSameDay(dirtyDate, Date.now());
2580
+ }
2581
+
2582
+ /**
2583
+ * @name isWithinInterval
2584
+ * @category Interval Helpers
2585
+ * @summary Is the given date within the interval?
2586
+ *
2587
+ * @description
2588
+ * Is the given date within the interval? (Including start and end.)
2589
+ *
2590
+ * @param {Date|Number} date - the date to check
2591
+ * @param {Interval} interval - the interval to check
2592
+ * @returns {Boolean} the date is within the interval
2593
+ * @throws {TypeError} 2 arguments required
2594
+ * @throws {RangeError} The start of an interval cannot be after its end
2595
+ * @throws {RangeError} Date in interval cannot be `Invalid Date`
2596
+ *
2597
+ * @example
2598
+ * // For the date within the interval:
2599
+ * isWithinInterval(new Date(2014, 0, 3), {
2600
+ * start: new Date(2014, 0, 1),
2601
+ * end: new Date(2014, 0, 7)
2602
+ * })
2603
+ * //=> true
2604
+ *
2605
+ * @example
2606
+ * // For the date outside of the interval:
2607
+ * isWithinInterval(new Date(2014, 0, 10), {
2608
+ * start: new Date(2014, 0, 1),
2609
+ * end: new Date(2014, 0, 7)
2610
+ * })
2611
+ * //=> false
2612
+ *
2613
+ * @example
2614
+ * // For date equal to interval start:
2615
+ * isWithinInterval(date, { start, end: date }) // => true
2616
+ *
2617
+ * @example
2618
+ * // For date equal to interval end:
2619
+ * isWithinInterval(date, { start: date, end }) // => true
2620
+ */
2621
+ function isWithinInterval(dirtyDate, interval) {
2622
+ requiredArgs(2, arguments);
2623
+ var time = toDate(dirtyDate).getTime();
2624
+ var startTime = toDate(interval.start).getTime();
2625
+ var endTime = toDate(interval.end).getTime();
2626
+
2627
+ // Throw an exception if start date is after end date or if any date is `Invalid Date`
2628
+ if (!(startTime <= endTime)) {
2629
+ throw new RangeError('Invalid interval');
2630
+ }
2631
+ return time >= startTime && time <= endTime;
2632
+ }
2633
+
2634
+ /**
2635
+ * @name parseISO
2636
+ * @category Common Helpers
2637
+ * @summary Parse ISO string
2638
+ *
2639
+ * @description
2640
+ * Parse the given string in ISO 8601 format and return an instance of Date.
2641
+ *
2642
+ * Function accepts complete ISO 8601 formats as well as partial implementations.
2643
+ * ISO 8601: http://en.wikipedia.org/wiki/ISO_8601
2644
+ *
2645
+ * If the argument isn't a string, the function cannot parse the string or
2646
+ * the values are invalid, it returns Invalid Date.
2647
+ *
2648
+ * @param {String} argument - the value to convert
2649
+ * @param {Object} [options] - an object with options.
2650
+ * @param {0|1|2} [options.additionalDigits=2] - the additional number of digits in the extended year format
2651
+ * @returns {Date} the parsed date in the local time zone
2652
+ * @throws {TypeError} 1 argument required
2653
+ * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
2654
+ *
2655
+ * @example
2656
+ * // Convert string '2014-02-11T11:30:30' to date:
2657
+ * const result = parseISO('2014-02-11T11:30:30')
2658
+ * //=> Tue Feb 11 2014 11:30:30
2659
+ *
2660
+ * @example
2661
+ * // Convert string '+02014101' to date,
2662
+ * // if the additional number of digits in the extended year format is 1:
2663
+ * const result = parseISO('+02014101', { additionalDigits: 1 })
2664
+ * //=> Fri Apr 11 2014 00:00:00
2665
+ */
2666
+ function parseISO(argument, options) {
2667
+ var _options$additionalDi;
2668
+ requiredArgs(1, arguments);
2669
+ var additionalDigits = toInteger((_options$additionalDi = options === null || options === void 0 ? void 0 : options.additionalDigits) !== null && _options$additionalDi !== void 0 ? _options$additionalDi : 2);
2670
+ if (additionalDigits !== 2 && additionalDigits !== 1 && additionalDigits !== 0) {
2671
+ throw new RangeError('additionalDigits must be 0, 1 or 2');
2672
+ }
2673
+ if (!(typeof argument === 'string' || Object.prototype.toString.call(argument) === '[object String]')) {
2674
+ return new Date(NaN);
2675
+ }
2676
+ var dateStrings = splitDateString(argument);
2677
+ var date;
2678
+ if (dateStrings.date) {
2679
+ var parseYearResult = parseYear(dateStrings.date, additionalDigits);
2680
+ date = parseDate(parseYearResult.restDateString, parseYearResult.year);
2681
+ }
2682
+ if (!date || isNaN(date.getTime())) {
2683
+ return new Date(NaN);
2684
+ }
2685
+ var timestamp = date.getTime();
2686
+ var time = 0;
2687
+ var offset;
2688
+ if (dateStrings.time) {
2689
+ time = parseTime(dateStrings.time);
2690
+ if (isNaN(time)) {
2691
+ return new Date(NaN);
2692
+ }
2693
+ }
2694
+ if (dateStrings.timezone) {
2695
+ offset = parseTimezone(dateStrings.timezone);
2696
+ if (isNaN(offset)) {
2697
+ return new Date(NaN);
2698
+ }
2699
+ } else {
2700
+ var dirtyDate = new Date(timestamp + time);
2701
+ // js parsed string assuming it's in UTC timezone
2702
+ // but we need it to be parsed in our timezone
2703
+ // so we use utc values to build date in our timezone.
2704
+ // Year values from 0 to 99 map to the years 1900 to 1999
2705
+ // so set year explicitly with setFullYear.
2706
+ var result = new Date(0);
2707
+ result.setFullYear(dirtyDate.getUTCFullYear(), dirtyDate.getUTCMonth(), dirtyDate.getUTCDate());
2708
+ result.setHours(dirtyDate.getUTCHours(), dirtyDate.getUTCMinutes(), dirtyDate.getUTCSeconds(), dirtyDate.getUTCMilliseconds());
2709
+ return result;
2710
+ }
2711
+ return new Date(timestamp + time + offset);
2712
+ }
2713
+ var patterns = {
2714
+ dateTimeDelimiter: /[T ]/,
2715
+ timeZoneDelimiter: /[Z ]/i,
2716
+ timezone: /([Z+-].*)$/
2717
+ };
2718
+ var dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
2719
+ var timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
2720
+ var timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
2721
+ function splitDateString(dateString) {
2722
+ var dateStrings = {};
2723
+ var array = dateString.split(patterns.dateTimeDelimiter);
2724
+ var timeString;
2725
+
2726
+ // The regex match should only return at maximum two array elements.
2727
+ // [date], [time], or [date, time].
2728
+ if (array.length > 2) {
2729
+ return dateStrings;
2730
+ }
2731
+ if (/:/.test(array[0])) {
2732
+ timeString = array[0];
2733
+ } else {
2734
+ dateStrings.date = array[0];
2735
+ timeString = array[1];
2736
+ if (patterns.timeZoneDelimiter.test(dateStrings.date)) {
2737
+ dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0];
2738
+ timeString = dateString.substr(dateStrings.date.length, dateString.length);
2739
+ }
2740
+ }
2741
+ if (timeString) {
2742
+ var token = patterns.timezone.exec(timeString);
2743
+ if (token) {
2744
+ dateStrings.time = timeString.replace(token[1], '');
2745
+ dateStrings.timezone = token[1];
2746
+ } else {
2747
+ dateStrings.time = timeString;
2748
+ }
2749
+ }
2750
+ return dateStrings;
2751
+ }
2752
+ function parseYear(dateString, additionalDigits) {
2753
+ var regex = new RegExp('^(?:(\\d{4}|[+-]\\d{' + (4 + additionalDigits) + '})|(\\d{2}|[+-]\\d{' + (2 + additionalDigits) + '})$)');
2754
+ var captures = dateString.match(regex);
2755
+ // Invalid ISO-formatted year
2756
+ if (!captures) return {
2757
+ year: NaN,
2758
+ restDateString: ''
2759
+ };
2760
+ var year = captures[1] ? parseInt(captures[1]) : null;
2761
+ var century = captures[2] ? parseInt(captures[2]) : null;
2762
+
2763
+ // either year or century is null, not both
2764
+ return {
2765
+ year: century === null ? year : century * 100,
2766
+ restDateString: dateString.slice((captures[1] || captures[2]).length)
2767
+ };
2768
+ }
2769
+ function parseDate(dateString, year) {
2770
+ // Invalid ISO-formatted year
2771
+ if (year === null) return new Date(NaN);
2772
+ var captures = dateString.match(dateRegex);
2773
+ // Invalid ISO-formatted string
2774
+ if (!captures) return new Date(NaN);
2775
+ var isWeekDate = !!captures[4];
2776
+ var dayOfYear = parseDateUnit(captures[1]);
2777
+ var month = parseDateUnit(captures[2]) - 1;
2778
+ var day = parseDateUnit(captures[3]);
2779
+ var week = parseDateUnit(captures[4]);
2780
+ var dayOfWeek = parseDateUnit(captures[5]) - 1;
2781
+ if (isWeekDate) {
2782
+ if (!validateWeekDate(year, week, dayOfWeek)) {
2783
+ return new Date(NaN);
2784
+ }
2785
+ return dayOfISOWeekYear(year, week, dayOfWeek);
2786
+ } else {
2787
+ var date = new Date(0);
2788
+ if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) {
2789
+ return new Date(NaN);
2790
+ }
2791
+ date.setUTCFullYear(year, month, Math.max(dayOfYear, day));
2792
+ return date;
2793
+ }
2794
+ }
2795
+ function parseDateUnit(value) {
2796
+ return value ? parseInt(value) : 1;
2797
+ }
2798
+ function parseTime(timeString) {
2799
+ var captures = timeString.match(timeRegex);
2800
+ if (!captures) return NaN; // Invalid ISO-formatted time
2801
+
2802
+ var hours = parseTimeUnit(captures[1]);
2803
+ var minutes = parseTimeUnit(captures[2]);
2804
+ var seconds = parseTimeUnit(captures[3]);
2805
+ if (!validateTime(hours, minutes, seconds)) {
2806
+ return NaN;
2807
+ }
2808
+ return hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1000;
2809
+ }
2810
+ function parseTimeUnit(value) {
2811
+ return value && parseFloat(value.replace(',', '.')) || 0;
2812
+ }
2813
+ function parseTimezone(timezoneString) {
2814
+ if (timezoneString === 'Z') return 0;
2815
+ var captures = timezoneString.match(timezoneRegex);
2816
+ if (!captures) return 0;
2817
+ var sign = captures[1] === '+' ? -1 : 1;
2818
+ var hours = parseInt(captures[2]);
2819
+ var minutes = captures[3] && parseInt(captures[3]) || 0;
2820
+ if (!validateTimezone(hours, minutes)) {
2821
+ return NaN;
2822
+ }
2823
+ return sign * (hours * millisecondsInHour + minutes * millisecondsInMinute);
2824
+ }
2825
+ function dayOfISOWeekYear(isoWeekYear, week, day) {
2826
+ var date = new Date(0);
2827
+ date.setUTCFullYear(isoWeekYear, 0, 4);
2828
+ var fourthOfJanuaryDay = date.getUTCDay() || 7;
2829
+ var diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay;
2830
+ date.setUTCDate(date.getUTCDate() + diff);
2831
+ return date;
2832
+ }
2833
+
2834
+ // Validation functions
2835
+
2836
+ // February is null to handle the leap year (using ||)
2837
+ var daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
2838
+ function isLeapYearIndex(year) {
2839
+ return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
2840
+ }
2841
+ function validateDate(year, month, date) {
2842
+ return month >= 0 && month <= 11 && date >= 1 && date <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28));
2843
+ }
2844
+ function validateDayOfYearDate(year, dayOfYear) {
2845
+ return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex(year) ? 366 : 365);
2846
+ }
2847
+ function validateWeekDate(_year, week, day) {
2848
+ return week >= 1 && week <= 53 && day >= 0 && day <= 6;
2849
+ }
2850
+ function validateTime(hours, minutes, seconds) {
2851
+ if (hours === 24) {
2852
+ return minutes === 0 && seconds === 0;
2853
+ }
2854
+ return seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25;
2855
+ }
2856
+ function validateTimezone(_hours, minutes) {
2857
+ return minutes >= 0 && minutes <= 59;
2858
+ }
2859
+
2860
+ const formatDate = ({ date, type = 'date', format: format$1 }) => {
2861
+ try {
2862
+ const parsedDate = parseISO(date);
2863
+ if (isNaN(parsedDate.getTime())) {
2864
+ throw new Error(`Invalid date: ${date}`);
2865
+ }
2866
+ if (format$1)
2867
+ return format(parsedDate, format$1);
2868
+ let formatStr = 'dd/MM/yyyy';
2869
+ if (type === 'time') {
2870
+ formatStr = 'dd/MM/yyyy HH:mm:ss';
2871
+ }
2872
+ else if (type === 'week') {
2873
+ formatStr = 'ccc dd/MM/yyyy HH:mm:ss';
2874
+ }
2875
+ return format(parsedDate, formatStr);
2876
+ }
2877
+ catch (error) {
2878
+ console.error('Error formatting date:', error.message);
2879
+ return '';
2880
+ }
2881
+ };
2882
+ function formatTime(time) {
2883
+ if (!time)
2884
+ return;
2885
+ if (isToday(new Date(time))) {
2886
+ return formatDate({ date: time, format: 'HH:mm' });
2887
+ }
2888
+ return formatDate({ date: time, format: 'dd/MM/yyyy HH:mm' });
2889
+ }
2890
+ function formatCountdown(stopTime, _now) {
2891
+ if (!stopTime)
2892
+ return;
2893
+ const endTime = typeof stopTime === 'string' ? parseISO(stopTime) : stopTime;
2894
+ const now = _now && new Date();
2895
+ let totalSeconds = differenceInSeconds(endTime, now);
2896
+ if (totalSeconds < 0)
2897
+ return '0D 00H 00M 00S';
2898
+ const days = Math.floor(totalSeconds / 86400);
2899
+ totalSeconds %= 86400;
2900
+ const hours = Math.floor(totalSeconds / 3600);
2901
+ totalSeconds %= 3600;
2902
+ const minutes = Math.floor(totalSeconds / 60);
2903
+ const seconds = totalSeconds % 60;
2904
+ return `${days}D ${hours.toString().padStart(2, '0')}H ${minutes.toString().padStart(2, '0')}M ${seconds
2905
+ .toString()
2906
+ .padStart(2, '0')}S`;
2907
+ }
2908
+ function getWagerTime(startTime, stopTime) {
2909
+ const now = new Date();
2910
+ if (startTime && isBefore(now, parseISO(startTime))) {
2911
+ return { start: formatCountdown(startTime, now) };
2912
+ }
2913
+ if (startTime &&
2914
+ stopTime &&
2915
+ isWithinInterval(now, {
2916
+ start: parseISO(startTime),
2917
+ end: parseISO(stopTime)
2918
+ })) {
2919
+ return { end: formatTime(stopTime) };
2920
+ }
2921
+ return {};
2922
+ }
2923
+
2924
+ const lotteryBannerCss = ":host {\n display: block;\n container-type: inline-size;\n}\n\n.lottery-banner {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--lottery-banner-gap, 0.5rem);\n padding: var(--lottery-banner-padding, 0px 20px);\n background: var(--lottery-banner-background, var(--emw--color-primary, #fed275));\n border-top: var(--lottery-banner-border-width, 2px) var(--lottery-banner-border-style, solid) var(--lottery-banner-border-color, var(--emw--color-primary, #fed275));\n border-bottom: var(--lottery-banner-border-width, 2px) var(--lottery-banner-border-style, solid) var(--lottery-banner-border-color, var(--emw--color-primary, #fed275));\n border-left: var(--lottery-banner-border-left, none);\n border-right: var(--lottery-banner-border-right, none);\n border-radius: var(--lottery-banner-border-radius, 0);\n white-space: nowrap;\n height: var(--lottery-banner-height, 50px);\n position: relative;\n box-sizing: border-box;\n}\n\n.lottery-banner__logo-wrapper {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n}\n.lottery-banner__logo-wrapper img {\n height: 100%;\n object-fit: var(--lottery-banner-logo-object-fit, contain);\n}\n\n.lottery-banner__item--center {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n}\n\n.lottery-banner__title {\n text-align: center;\n font-size: var(--lottery-banner-title-font-size, 1.5rem);\n font-weight: 800;\n font-style: italic;\n letter-spacing: var(--lottery-banner-title-font-letter-spacing, 0.04em);\n color: var(--emw--color-typography, #000);\n}\n\n.lottery-banner__info {\n display: flex;\n align-items: center;\n gap: var(--lottery-banner-info-gap, 0.75rem);\n}\n\n.lottery-banner__info-item {\n font-size: var(--lottery-banner-info-font-size, 0.9rem);\n color: var(--lottery-banner-info-color, var(--emw--color-typography, #000));\n display: inline-flex;\n align-items: center;\n gap: 0.3rem;\n}\n\n.lottery-banner__info-item-label {\n color: var(--lottery-banner-info-label-color, var(--emw--color-typography, #000));\n}\n.lottery-banner__info-item-label__strong {\n font-weight: var(--lottery-banner-info-label-font-weight, 700);\n}\n\n.lottery-banner__info-item-value {\n font-weight: var(--lottery-banner-info-value-font-weight, inherit);\n color: var(--lottery-banner-info-value-color, var(--emw--color-typography, #000));\n}\n\n@container (max-width: 700px) {\n .lottery-banner {\n height: auto;\n padding: var(--lottery-banner-mobile-padding, 0.5rem 1rem);\n }\n .lottery-banner__title {\n flex-basis: 100%;\n text-align: var(--lottery-banner-mobile-title-text-align, left);\n }\n .lottery-banner__info {\n flex-direction: column;\n align-items: flex-start;\n gap: var(--lottery-banner-mobile-info-gap, 0.1rem);\n }\n}";
2925
+ const LotteryBannerStyle0 = lotteryBannerCss;
2926
+
2927
+ const LotteryBanner = class {
2928
+ constructor(hostRef) {
2929
+ registerInstance(this, hostRef);
2930
+ this.lotteryBannerTimerStop = createEvent(this, "lotteryBannerTimerStop", 7);
2931
+ this.mbSource = undefined;
2932
+ this.clientStyling = undefined;
2933
+ this.clientStylingUrl = undefined;
2934
+ this.translationUrl = '';
2935
+ this.language = 'en';
2936
+ this.logoUrl = undefined;
2937
+ this.stopTime = '';
2938
+ this.startTime = '';
2939
+ this.bannerTitle = undefined;
2940
+ this.turnover = undefined;
2941
+ this.layout = 'logo,title,info';
2942
+ this.formattedTime = undefined;
2943
+ }
2944
+ handleClientStylingChange(newValue, oldValue) {
2945
+ if (newValue !== oldValue) {
2946
+ setClientStyling(this.stylingContainer, this.clientStyling);
2947
+ }
2948
+ }
2949
+ handleClientStylingUrlChange(newValue, oldValue) {
2950
+ if (newValue !== oldValue) {
2951
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2952
+ }
2953
+ }
2954
+ handleMbSourceChange(newValue, oldValue) {
2955
+ if (newValue !== oldValue) {
2956
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
2957
+ }
2958
+ }
2959
+ handleTimeChange() {
2960
+ this.startTimer();
2961
+ }
2962
+ async componentWillLoad() {
2963
+ if (this.translationUrl) {
2964
+ resolveTranslationUrl(this.translationUrl);
2965
+ }
2966
+ this.startTimer();
2967
+ }
2968
+ startTimer() {
2969
+ if (this.timer) {
2970
+ clearInterval(this.timer);
2971
+ }
2972
+ this.updateTime();
2973
+ this.timer = setInterval(() => {
2974
+ this.updateTime();
2975
+ }, 1000);
2976
+ }
2977
+ updateTime() {
2978
+ var _a;
2979
+ this.formattedTime = getWagerTime(this.startTime, this.stopTime);
2980
+ if ((_a = this.formattedTime) === null || _a === void 0 ? void 0 : _a.end) {
2981
+ this.timer && clearInterval(this.timer);
2982
+ this.lotteryBannerTimerStop.emit();
2983
+ }
2984
+ }
2985
+ componentDidLoad() {
2986
+ if (this.stylingContainer) {
2987
+ if (this.mbSource)
2988
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
2989
+ if (this.clientStyling)
2990
+ setClientStyling(this.stylingContainer, this.clientStyling);
2991
+ if (this.clientStylingUrl)
2992
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2993
+ }
2994
+ }
2995
+ disconnectedCallback() {
2996
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
2997
+ this.timer && clearInterval(this.timer);
2998
+ }
2999
+ renderElement(item, className = '') {
3000
+ var _a, _b;
3001
+ switch (item) {
3002
+ case 'logo':
3003
+ return (h("div", { class: `lottery-banner__logo-wrapper ${className}` }, this.logoUrl && h("img", { alt: "logo", src: this.logoUrl, class: "lottery-banner__logo" })));
3004
+ case 'title':
3005
+ return this.bannerTitle && h("div", { class: `lottery-banner__title ${className}` }, this.bannerTitle);
3006
+ case 'info':
3007
+ return (h("div", { class: `lottery-banner__info ${className}` }, ((_a = this.formattedTime) === null || _a === void 0 ? void 0 : _a.start) && (h("div", { class: "lottery-banner__info-item" }, h("span", { class: "lottery-banner__info-item-label" }, h("span", { class: "lottery-banner__info-item-label__strong" }, translate('start', this.language)), "\u00A0", translate('in', this.language)), h("span", { class: "lottery-banner__info-item-value" }, this.formattedTime.start))), ((_b = this.formattedTime) === null || _b === void 0 ? void 0 : _b.end) && (h("div", { class: "lottery-banner__info-item" }, h("span", { class: "lottery-banner__info-item-label" }, h("span", { class: "lottery-banner__info-item-label__strong" }, translate('stop', this.language)), "\u00A0", translate('at', this.language)), h("span", { class: "lottery-banner__info-item-value" }, this.formattedTime.end))), this.turnover !== null && this.turnover !== undefined && (h("div", { class: "lottery-banner__info-item" }, h("span", { class: "lottery-banner__info-item-label" }, translate('turnover', this.language)), h("span", { class: "lottery-banner__info-item-value" }, this.turnover)))));
3008
+ default:
3009
+ return null;
3010
+ }
3011
+ }
3012
+ render() {
3013
+ const layoutItems = this.layout.split(',').map((item) => item.trim());
3014
+ return (h("section", { key: '058aa04a8104d393f6066fd2738fb33cb6d832a2', ref: (el) => (this.stylingContainer = el), class: "lottery-banner" }, layoutItems.map((item, index) => {
3015
+ const isMiddle = layoutItems.length === 3 && index === 1;
3016
+ const className = isMiddle ? 'lottery-banner__item--center' : '';
3017
+ return this.renderElement(item, className);
3018
+ })));
3019
+ }
3020
+ static get watchers() { return {
3021
+ "clientStyling": ["handleClientStylingChange"],
3022
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
3023
+ "mbSource": ["handleMbSourceChange"],
3024
+ "startTime": ["handleTimeChange"],
3025
+ "stopTime": ["handleTimeChange"]
3026
+ }; }
3027
+ };
3028
+ LotteryBanner.style = LotteryBannerStyle0;
3029
+
3030
+ export { LotteryBanner as L };