@everymatrix/lottery-oddsbom-bomb 0.0.1

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