@everymatrix/player-elevate-level 1.32.4 → 1.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dist/cjs/bonus-elevate-levels_8.cjs.entry.js +919 -0
  2. package/dist/cjs/index-c706b0d2.js +1726 -0
  3. package/dist/cjs/index.cjs.js +2 -0
  4. package/dist/cjs/loader.cjs.js +21 -0
  5. package/dist/cjs/player-elevate-card-items-31eb5d57.js +2477 -0
  6. package/dist/cjs/player-elevate-card.cjs.entry.js +77 -0
  7. package/dist/cjs/player-elevate-level.cjs.js +19 -0
  8. package/dist/cjs/player-elevate-pointcard.cjs.entry.js +84 -0
  9. package/dist/collection/collection-manifest.json +37 -0
  10. package/dist/collection/components/player-elevate-level/player-elevate-level.css +13 -0
  11. package/dist/collection/components/player-elevate-level/player-elevate-level.js +212 -0
  12. package/dist/collection/index.js +1 -0
  13. package/dist/collection/utils/utils.js +0 -0
  14. package/dist/components/bonus-elevate-levels.js +6 -0
  15. package/dist/components/bonus-elevate-levels2.js +133 -0
  16. package/dist/components/elevate-level-list.js +6 -0
  17. package/dist/components/elevate-level-list2.js +177 -0
  18. package/dist/components/elevate-level-presentation.js +6 -0
  19. package/dist/components/elevate-level-presentation2.js +31 -0
  20. package/dist/components/elevate-levels-data.js +6 -0
  21. package/dist/components/elevate-levels-data2.js +102 -0
  22. package/dist/components/general-styling-wrapper.js +6 -0
  23. package/dist/components/general-styling-wrapper2.js +103 -0
  24. package/dist/components/index.d.ts +26 -0
  25. package/dist/components/index.js +1 -0
  26. package/dist/components/player-elevate-card-data.js +6 -0
  27. package/dist/components/player-elevate-card-data2.js +624 -0
  28. package/dist/components/player-elevate-card-items.js +2250 -0
  29. package/dist/components/player-elevate-card.js +118 -0
  30. package/dist/components/player-elevate-level.d.ts +11 -0
  31. package/dist/components/player-elevate-level.js +107 -0
  32. package/dist/components/player-elevate-loyaltycard.js +6 -0
  33. package/dist/components/player-elevate-loyaltycard2.js +121 -0
  34. package/dist/components/player-elevate-pointcard.js +127 -0
  35. package/dist/esm/bonus-elevate-levels_8.entry.js +908 -0
  36. package/dist/esm/index-104132db.js +1696 -0
  37. package/dist/esm/index.js +1 -0
  38. package/dist/esm/loader.js +17 -0
  39. package/dist/esm/player-elevate-card-items-289d91dc.js +2464 -0
  40. package/dist/esm/player-elevate-card.entry.js +73 -0
  41. package/dist/esm/player-elevate-level.js +17 -0
  42. package/dist/esm/player-elevate-pointcard.entry.js +80 -0
  43. package/dist/esm/polyfills/core-js.js +11 -0
  44. package/dist/esm/polyfills/css-shim.js +1 -0
  45. package/dist/esm/polyfills/dom.js +79 -0
  46. package/dist/esm/polyfills/es5-html-element.js +1 -0
  47. package/dist/esm/polyfills/index.js +34 -0
  48. package/dist/esm/polyfills/system.js +6 -0
  49. package/dist/index.cjs.js +1 -0
  50. package/dist/index.js +1 -0
  51. package/dist/player-elevate-level/index.esm.js +0 -0
  52. package/dist/player-elevate-level/p-34b6a7b6.entry.js +1 -0
  53. package/dist/player-elevate-level/p-46fd6f51.js +1 -0
  54. package/dist/player-elevate-level/p-b67b6b93.entry.js +1 -0
  55. package/dist/player-elevate-level/p-c73cc225.entry.js +1 -0
  56. package/dist/player-elevate-level/p-f43f6ed2.js +1 -0
  57. package/dist/player-elevate-level/player-elevate-level.esm.js +1 -0
  58. package/dist/static/button-default.svg +42 -0
  59. package/dist/static/button-disabled.svg +4 -0
  60. package/dist/static/button-hover.svg +4 -0
  61. package/dist/static/button-level.svg +27 -0
  62. package/dist/static/button-pressed.svg +18 -0
  63. package/dist/static/button-redeem.svg +36 -0
  64. package/dist/static/card-ground-over.png +0 -0
  65. package/dist/static/card-ground-over.svg +903 -0
  66. package/dist/static/card-ground.png +0 -0
  67. package/dist/static/card-ground.svg +34 -0
  68. package/dist/static/info.svg +4 -0
  69. package/dist/static/level-badge.png +0 -0
  70. package/dist/static/level-percent.svg +80 -0
  71. package/dist/static/tips-info.svg +21 -0
  72. package/dist/static/user.svg +3 -0
  73. package/dist/stencil.config.js +25 -0
  74. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/player-elevate-level/.stencil/packages/player-elevate-level/stencil.config.d.ts +2 -0
  75. package/dist/types/components/player-elevate-level/player-elevate-level.d.ts +43 -0
  76. package/dist/types/components.d.ts +109 -0
  77. package/dist/types/index.d.ts +1 -0
  78. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  79. package/dist/types/utils/utils.d.ts +0 -0
  80. package/loader/cdn.js +3 -0
  81. package/loader/index.cjs.js +3 -0
  82. package/loader/index.d.ts +12 -0
  83. package/loader/index.es2017.js +3 -0
  84. package/loader/index.js +4 -0
  85. package/loader/package.json +10 -0
  86. package/package.json +2 -3
  87. package/LICENSE +0 -21
@@ -0,0 +1,2477 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index-c706b0d2.js');
4
+
5
+ function _typeof(o) {
6
+ "@babel/helpers - typeof";
7
+
8
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
9
+ return typeof o;
10
+ } : function (o) {
11
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
12
+ }, _typeof(o);
13
+ }
14
+
15
+ function toInteger(dirtyNumber) {
16
+ if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
17
+ return NaN;
18
+ }
19
+ var number = Number(dirtyNumber);
20
+ if (isNaN(number)) {
21
+ return number;
22
+ }
23
+ return number < 0 ? Math.ceil(number) : Math.floor(number);
24
+ }
25
+
26
+ function requiredArgs(required, args) {
27
+ if (args.length < required) {
28
+ throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
29
+ }
30
+ }
31
+
32
+ /**
33
+ * @name toDate
34
+ * @category Common Helpers
35
+ * @summary Convert the given argument to an instance of Date.
36
+ *
37
+ * @description
38
+ * Convert the given argument to an instance of Date.
39
+ *
40
+ * If the argument is an instance of Date, the function returns its clone.
41
+ *
42
+ * If the argument is a number, it is treated as a timestamp.
43
+ *
44
+ * If the argument is none of the above, the function returns Invalid Date.
45
+ *
46
+ * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
47
+ *
48
+ * @param {Date|Number} argument - the value to convert
49
+ * @returns {Date} the parsed date in the local time zone
50
+ * @throws {TypeError} 1 argument required
51
+ *
52
+ * @example
53
+ * // Clone the date:
54
+ * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
55
+ * //=> Tue Feb 11 2014 11:30:30
56
+ *
57
+ * @example
58
+ * // Convert the timestamp to date:
59
+ * const result = toDate(1392098430000)
60
+ * //=> Tue Feb 11 2014 11:30:30
61
+ */
62
+ function toDate(argument) {
63
+ requiredArgs(1, arguments);
64
+ var argStr = Object.prototype.toString.call(argument);
65
+
66
+ // Clone the date
67
+ if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
68
+ // Prevent the date to lose the milliseconds when passed to new Date() in IE10
69
+ return new Date(argument.getTime());
70
+ } else if (typeof argument === 'number' || argStr === '[object Number]') {
71
+ return new Date(argument);
72
+ } else {
73
+ if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
74
+ // eslint-disable-next-line no-console
75
+ 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");
76
+ // eslint-disable-next-line no-console
77
+ console.warn(new Error().stack);
78
+ }
79
+ return new Date(NaN);
80
+ }
81
+ }
82
+
83
+ /**
84
+ * @name addMilliseconds
85
+ * @category Millisecond Helpers
86
+ * @summary Add the specified number of milliseconds to the given date.
87
+ *
88
+ * @description
89
+ * Add the specified number of milliseconds to the given date.
90
+ *
91
+ * @param {Date|Number} date - the date to be changed
92
+ * @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`.
93
+ * @returns {Date} the new date with the milliseconds added
94
+ * @throws {TypeError} 2 arguments required
95
+ *
96
+ * @example
97
+ * // Add 750 milliseconds to 10 July 2014 12:45:30.000:
98
+ * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
99
+ * //=> Thu Jul 10 2014 12:45:30.750
100
+ */
101
+ function addMilliseconds(dirtyDate, dirtyAmount) {
102
+ requiredArgs(2, arguments);
103
+ var timestamp = toDate(dirtyDate).getTime();
104
+ var amount = toInteger(dirtyAmount);
105
+ return new Date(timestamp + amount);
106
+ }
107
+
108
+ var defaultOptions = {};
109
+ function getDefaultOptions() {
110
+ return defaultOptions;
111
+ }
112
+
113
+ /**
114
+ * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
115
+ * They usually appear for dates that denote time before the timezones were introduced
116
+ * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
117
+ * and GMT+01:00:00 after that date)
118
+ *
119
+ * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
120
+ * which would lead to incorrect calculations.
121
+ *
122
+ * This function returns the timezone offset in milliseconds that takes seconds in account.
123
+ */
124
+ function getTimezoneOffsetInMilliseconds(date) {
125
+ var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
126
+ utcDate.setUTCFullYear(date.getFullYear());
127
+ return date.getTime() - utcDate.getTime();
128
+ }
129
+
130
+ /**
131
+ * @name isDate
132
+ * @category Common Helpers
133
+ * @summary Is the given value a date?
134
+ *
135
+ * @description
136
+ * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
137
+ *
138
+ * @param {*} value - the value to check
139
+ * @returns {boolean} true if the given value is a date
140
+ * @throws {TypeError} 1 arguments required
141
+ *
142
+ * @example
143
+ * // For a valid date:
144
+ * const result = isDate(new Date())
145
+ * //=> true
146
+ *
147
+ * @example
148
+ * // For an invalid date:
149
+ * const result = isDate(new Date(NaN))
150
+ * //=> true
151
+ *
152
+ * @example
153
+ * // For some value:
154
+ * const result = isDate('2014-02-31')
155
+ * //=> false
156
+ *
157
+ * @example
158
+ * // For an object:
159
+ * const result = isDate({})
160
+ * //=> false
161
+ */
162
+ function isDate(value) {
163
+ requiredArgs(1, arguments);
164
+ return value instanceof Date || _typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
165
+ }
166
+
167
+ /**
168
+ * @name isValid
169
+ * @category Common Helpers
170
+ * @summary Is the given date valid?
171
+ *
172
+ * @description
173
+ * Returns false if argument is Invalid Date and true otherwise.
174
+ * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
175
+ * Invalid Date is a Date, whose time value is NaN.
176
+ *
177
+ * Time value of Date: http://es5.github.io/#x15.9.1.1
178
+ *
179
+ * @param {*} date - the date to check
180
+ * @returns {Boolean} the date is valid
181
+ * @throws {TypeError} 1 argument required
182
+ *
183
+ * @example
184
+ * // For the valid date:
185
+ * const result = isValid(new Date(2014, 1, 31))
186
+ * //=> true
187
+ *
188
+ * @example
189
+ * // For the value, convertable into a date:
190
+ * const result = isValid(1393804800000)
191
+ * //=> true
192
+ *
193
+ * @example
194
+ * // For the invalid date:
195
+ * const result = isValid(new Date(''))
196
+ * //=> false
197
+ */
198
+ function isValid(dirtyDate) {
199
+ requiredArgs(1, arguments);
200
+ if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
201
+ return false;
202
+ }
203
+ var date = toDate(dirtyDate);
204
+ return !isNaN(Number(date));
205
+ }
206
+
207
+ /**
208
+ * @name subMilliseconds
209
+ * @category Millisecond Helpers
210
+ * @summary Subtract the specified number of milliseconds from the given date.
211
+ *
212
+ * @description
213
+ * Subtract the specified number of milliseconds from the given date.
214
+ *
215
+ * @param {Date|Number} date - the date to be changed
216
+ * @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`.
217
+ * @returns {Date} the new date with the milliseconds subtracted
218
+ * @throws {TypeError} 2 arguments required
219
+ *
220
+ * @example
221
+ * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
222
+ * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
223
+ * //=> Thu Jul 10 2014 12:45:29.250
224
+ */
225
+ function subMilliseconds(dirtyDate, dirtyAmount) {
226
+ requiredArgs(2, arguments);
227
+ var amount = toInteger(dirtyAmount);
228
+ return addMilliseconds(dirtyDate, -amount);
229
+ }
230
+
231
+ var MILLISECONDS_IN_DAY = 86400000;
232
+ function getUTCDayOfYear(dirtyDate) {
233
+ requiredArgs(1, arguments);
234
+ var date = toDate(dirtyDate);
235
+ var timestamp = date.getTime();
236
+ date.setUTCMonth(0, 1);
237
+ date.setUTCHours(0, 0, 0, 0);
238
+ var startOfYearTimestamp = date.getTime();
239
+ var difference = timestamp - startOfYearTimestamp;
240
+ return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
241
+ }
242
+
243
+ function startOfUTCISOWeek(dirtyDate) {
244
+ requiredArgs(1, arguments);
245
+ var weekStartsOn = 1;
246
+ var date = toDate(dirtyDate);
247
+ var day = date.getUTCDay();
248
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
249
+ date.setUTCDate(date.getUTCDate() - diff);
250
+ date.setUTCHours(0, 0, 0, 0);
251
+ return date;
252
+ }
253
+
254
+ function getUTCISOWeekYear(dirtyDate) {
255
+ requiredArgs(1, arguments);
256
+ var date = toDate(dirtyDate);
257
+ var year = date.getUTCFullYear();
258
+ var fourthOfJanuaryOfNextYear = new Date(0);
259
+ fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
260
+ fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
261
+ var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
262
+ var fourthOfJanuaryOfThisYear = new Date(0);
263
+ fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
264
+ fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
265
+ var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);
266
+ if (date.getTime() >= startOfNextYear.getTime()) {
267
+ return year + 1;
268
+ } else if (date.getTime() >= startOfThisYear.getTime()) {
269
+ return year;
270
+ } else {
271
+ return year - 1;
272
+ }
273
+ }
274
+
275
+ function startOfUTCISOWeekYear(dirtyDate) {
276
+ requiredArgs(1, arguments);
277
+ var year = getUTCISOWeekYear(dirtyDate);
278
+ var fourthOfJanuary = new Date(0);
279
+ fourthOfJanuary.setUTCFullYear(year, 0, 4);
280
+ fourthOfJanuary.setUTCHours(0, 0, 0, 0);
281
+ var date = startOfUTCISOWeek(fourthOfJanuary);
282
+ return date;
283
+ }
284
+
285
+ var MILLISECONDS_IN_WEEK$1 = 604800000;
286
+ function getUTCISOWeek(dirtyDate) {
287
+ requiredArgs(1, arguments);
288
+ var date = toDate(dirtyDate);
289
+ var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime();
290
+
291
+ // Round the number of days to the nearest integer
292
+ // because the number of milliseconds in a week is not constant
293
+ // (e.g. it's different in the week of the daylight saving time clock shift)
294
+ return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;
295
+ }
296
+
297
+ function startOfUTCWeek(dirtyDate, options) {
298
+ var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
299
+ requiredArgs(1, arguments);
300
+ var defaultOptions = getDefaultOptions();
301
+ 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);
302
+
303
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
304
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
305
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
306
+ }
307
+ var date = toDate(dirtyDate);
308
+ var day = date.getUTCDay();
309
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
310
+ date.setUTCDate(date.getUTCDate() - diff);
311
+ date.setUTCHours(0, 0, 0, 0);
312
+ return date;
313
+ }
314
+
315
+ function getUTCWeekYear(dirtyDate, options) {
316
+ var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
317
+ requiredArgs(1, arguments);
318
+ var date = toDate(dirtyDate);
319
+ var year = date.getUTCFullYear();
320
+ var defaultOptions = getDefaultOptions();
321
+ 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);
322
+
323
+ // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
324
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
325
+ throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
326
+ }
327
+ var firstWeekOfNextYear = new Date(0);
328
+ firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
329
+ firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
330
+ var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);
331
+ var firstWeekOfThisYear = new Date(0);
332
+ firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
333
+ firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
334
+ var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);
335
+ if (date.getTime() >= startOfNextYear.getTime()) {
336
+ return year + 1;
337
+ } else if (date.getTime() >= startOfThisYear.getTime()) {
338
+ return year;
339
+ } else {
340
+ return year - 1;
341
+ }
342
+ }
343
+
344
+ function startOfUTCWeekYear(dirtyDate, options) {
345
+ var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
346
+ requiredArgs(1, arguments);
347
+ var defaultOptions = getDefaultOptions();
348
+ 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);
349
+ var year = getUTCWeekYear(dirtyDate, options);
350
+ var firstWeek = new Date(0);
351
+ firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
352
+ firstWeek.setUTCHours(0, 0, 0, 0);
353
+ var date = startOfUTCWeek(firstWeek, options);
354
+ return date;
355
+ }
356
+
357
+ var MILLISECONDS_IN_WEEK = 604800000;
358
+ function getUTCWeek(dirtyDate, options) {
359
+ requiredArgs(1, arguments);
360
+ var date = toDate(dirtyDate);
361
+ var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime();
362
+
363
+ // Round the number of days to the nearest integer
364
+ // because the number of milliseconds in a week is not constant
365
+ // (e.g. it's different in the week of the daylight saving time clock shift)
366
+ return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
367
+ }
368
+
369
+ function addLeadingZeros(number, targetLength) {
370
+ var sign = number < 0 ? '-' : '';
371
+ var output = Math.abs(number).toString();
372
+ while (output.length < targetLength) {
373
+ output = '0' + output;
374
+ }
375
+ return sign + output;
376
+ }
377
+
378
+ /*
379
+ * | | Unit | | Unit |
380
+ * |-----|--------------------------------|-----|--------------------------------|
381
+ * | a | AM, PM | A* | |
382
+ * | d | Day of month | D | |
383
+ * | h | Hour [1-12] | H | Hour [0-23] |
384
+ * | m | Minute | M | Month |
385
+ * | s | Second | S | Fraction of second |
386
+ * | y | Year (abs) | Y | |
387
+ *
388
+ * Letters marked by * are not implemented but reserved by Unicode standard.
389
+ */
390
+ var formatters$1 = {
391
+ // Year
392
+ y: function y(date, token) {
393
+ // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
394
+ // | Year | y | yy | yyy | yyyy | yyyyy |
395
+ // |----------|-------|----|-------|-------|-------|
396
+ // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
397
+ // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
398
+ // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
399
+ // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
400
+ // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
401
+
402
+ var signedYear = date.getUTCFullYear();
403
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
404
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
405
+ return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
406
+ },
407
+ // Month
408
+ M: function M(date, token) {
409
+ var month = date.getUTCMonth();
410
+ return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
411
+ },
412
+ // Day of the month
413
+ d: function d(date, token) {
414
+ return addLeadingZeros(date.getUTCDate(), token.length);
415
+ },
416
+ // AM or PM
417
+ a: function a(date, token) {
418
+ var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
419
+ switch (token) {
420
+ case 'a':
421
+ case 'aa':
422
+ return dayPeriodEnumValue.toUpperCase();
423
+ case 'aaa':
424
+ return dayPeriodEnumValue;
425
+ case 'aaaaa':
426
+ return dayPeriodEnumValue[0];
427
+ case 'aaaa':
428
+ default:
429
+ return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
430
+ }
431
+ },
432
+ // Hour [1-12]
433
+ h: function h(date, token) {
434
+ return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
435
+ },
436
+ // Hour [0-23]
437
+ H: function H(date, token) {
438
+ return addLeadingZeros(date.getUTCHours(), token.length);
439
+ },
440
+ // Minute
441
+ m: function m(date, token) {
442
+ return addLeadingZeros(date.getUTCMinutes(), token.length);
443
+ },
444
+ // Second
445
+ s: function s(date, token) {
446
+ return addLeadingZeros(date.getUTCSeconds(), token.length);
447
+ },
448
+ // Fraction of second
449
+ S: function S(date, token) {
450
+ var numberOfDigits = token.length;
451
+ var milliseconds = date.getUTCMilliseconds();
452
+ var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
453
+ return addLeadingZeros(fractionalSeconds, token.length);
454
+ }
455
+ };
456
+
457
+ var dayPeriodEnum = {
458
+ am: 'am',
459
+ pm: 'pm',
460
+ midnight: 'midnight',
461
+ noon: 'noon',
462
+ morning: 'morning',
463
+ afternoon: 'afternoon',
464
+ evening: 'evening',
465
+ night: 'night'
466
+ };
467
+ /*
468
+ * | | Unit | | Unit |
469
+ * |-----|--------------------------------|-----|--------------------------------|
470
+ * | a | AM, PM | A* | Milliseconds in day |
471
+ * | b | AM, PM, noon, midnight | B | Flexible day period |
472
+ * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
473
+ * | d | Day of month | D | Day of year |
474
+ * | e | Local day of week | E | Day of week |
475
+ * | f | | F* | Day of week in month |
476
+ * | g* | Modified Julian day | G | Era |
477
+ * | h | Hour [1-12] | H | Hour [0-23] |
478
+ * | i! | ISO day of week | I! | ISO week of year |
479
+ * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
480
+ * | k | Hour [1-24] | K | Hour [0-11] |
481
+ * | l* | (deprecated) | L | Stand-alone month |
482
+ * | m | Minute | M | Month |
483
+ * | n | | N | |
484
+ * | o! | Ordinal number modifier | O | Timezone (GMT) |
485
+ * | p! | Long localized time | P! | Long localized date |
486
+ * | q | Stand-alone quarter | Q | Quarter |
487
+ * | r* | Related Gregorian year | R! | ISO week-numbering year |
488
+ * | s | Second | S | Fraction of second |
489
+ * | t! | Seconds timestamp | T! | Milliseconds timestamp |
490
+ * | u | Extended year | U* | Cyclic year |
491
+ * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
492
+ * | w | Local week of year | W* | Week of month |
493
+ * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
494
+ * | y | Year (abs) | Y | Local week-numbering year |
495
+ * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
496
+ *
497
+ * Letters marked by * are not implemented but reserved by Unicode standard.
498
+ *
499
+ * Letters marked by ! are non-standard, but implemented by date-fns:
500
+ * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
501
+ * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
502
+ * i.e. 7 for Sunday, 1 for Monday, etc.
503
+ * - `I` is ISO week of year, as opposed to `w` which is local week of year.
504
+ * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
505
+ * `R` is supposed to be used in conjunction with `I` and `i`
506
+ * for universal ISO week-numbering date, whereas
507
+ * `Y` is supposed to be used in conjunction with `w` and `e`
508
+ * for week-numbering date specific to the locale.
509
+ * - `P` is long localized date format
510
+ * - `p` is long localized time format
511
+ */
512
+
513
+ var formatters = {
514
+ // Era
515
+ G: function G(date, token, localize) {
516
+ var era = date.getUTCFullYear() > 0 ? 1 : 0;
517
+ switch (token) {
518
+ // AD, BC
519
+ case 'G':
520
+ case 'GG':
521
+ case 'GGG':
522
+ return localize.era(era, {
523
+ width: 'abbreviated'
524
+ });
525
+ // A, B
526
+ case 'GGGGG':
527
+ return localize.era(era, {
528
+ width: 'narrow'
529
+ });
530
+ // Anno Domini, Before Christ
531
+ case 'GGGG':
532
+ default:
533
+ return localize.era(era, {
534
+ width: 'wide'
535
+ });
536
+ }
537
+ },
538
+ // Year
539
+ y: function y(date, token, localize) {
540
+ // Ordinal number
541
+ if (token === 'yo') {
542
+ var signedYear = date.getUTCFullYear();
543
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
544
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
545
+ return localize.ordinalNumber(year, {
546
+ unit: 'year'
547
+ });
548
+ }
549
+ return formatters$1.y(date, token);
550
+ },
551
+ // Local week-numbering year
552
+ Y: function Y(date, token, localize, options) {
553
+ var signedWeekYear = getUTCWeekYear(date, options);
554
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
555
+ var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
556
+
557
+ // Two digit year
558
+ if (token === 'YY') {
559
+ var twoDigitYear = weekYear % 100;
560
+ return addLeadingZeros(twoDigitYear, 2);
561
+ }
562
+
563
+ // Ordinal number
564
+ if (token === 'Yo') {
565
+ return localize.ordinalNumber(weekYear, {
566
+ unit: 'year'
567
+ });
568
+ }
569
+
570
+ // Padding
571
+ return addLeadingZeros(weekYear, token.length);
572
+ },
573
+ // ISO week-numbering year
574
+ R: function R(date, token) {
575
+ var isoWeekYear = getUTCISOWeekYear(date);
576
+
577
+ // Padding
578
+ return addLeadingZeros(isoWeekYear, token.length);
579
+ },
580
+ // Extended year. This is a single number designating the year of this calendar system.
581
+ // The main difference between `y` and `u` localizers are B.C. years:
582
+ // | Year | `y` | `u` |
583
+ // |------|-----|-----|
584
+ // | AC 1 | 1 | 1 |
585
+ // | BC 1 | 1 | 0 |
586
+ // | BC 2 | 2 | -1 |
587
+ // Also `yy` always returns the last two digits of a year,
588
+ // while `uu` pads single digit years to 2 characters and returns other years unchanged.
589
+ u: function u(date, token) {
590
+ var year = date.getUTCFullYear();
591
+ return addLeadingZeros(year, token.length);
592
+ },
593
+ // Quarter
594
+ Q: function Q(date, token, localize) {
595
+ var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
596
+ switch (token) {
597
+ // 1, 2, 3, 4
598
+ case 'Q':
599
+ return String(quarter);
600
+ // 01, 02, 03, 04
601
+ case 'QQ':
602
+ return addLeadingZeros(quarter, 2);
603
+ // 1st, 2nd, 3rd, 4th
604
+ case 'Qo':
605
+ return localize.ordinalNumber(quarter, {
606
+ unit: 'quarter'
607
+ });
608
+ // Q1, Q2, Q3, Q4
609
+ case 'QQQ':
610
+ return localize.quarter(quarter, {
611
+ width: 'abbreviated',
612
+ context: 'formatting'
613
+ });
614
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
615
+ case 'QQQQQ':
616
+ return localize.quarter(quarter, {
617
+ width: 'narrow',
618
+ context: 'formatting'
619
+ });
620
+ // 1st quarter, 2nd quarter, ...
621
+ case 'QQQQ':
622
+ default:
623
+ return localize.quarter(quarter, {
624
+ width: 'wide',
625
+ context: 'formatting'
626
+ });
627
+ }
628
+ },
629
+ // Stand-alone quarter
630
+ q: function q(date, token, localize) {
631
+ var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
632
+ switch (token) {
633
+ // 1, 2, 3, 4
634
+ case 'q':
635
+ return String(quarter);
636
+ // 01, 02, 03, 04
637
+ case 'qq':
638
+ return addLeadingZeros(quarter, 2);
639
+ // 1st, 2nd, 3rd, 4th
640
+ case 'qo':
641
+ return localize.ordinalNumber(quarter, {
642
+ unit: 'quarter'
643
+ });
644
+ // Q1, Q2, Q3, Q4
645
+ case 'qqq':
646
+ return localize.quarter(quarter, {
647
+ width: 'abbreviated',
648
+ context: 'standalone'
649
+ });
650
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
651
+ case 'qqqqq':
652
+ return localize.quarter(quarter, {
653
+ width: 'narrow',
654
+ context: 'standalone'
655
+ });
656
+ // 1st quarter, 2nd quarter, ...
657
+ case 'qqqq':
658
+ default:
659
+ return localize.quarter(quarter, {
660
+ width: 'wide',
661
+ context: 'standalone'
662
+ });
663
+ }
664
+ },
665
+ // Month
666
+ M: function M(date, token, localize) {
667
+ var month = date.getUTCMonth();
668
+ switch (token) {
669
+ case 'M':
670
+ case 'MM':
671
+ return formatters$1.M(date, token);
672
+ // 1st, 2nd, ..., 12th
673
+ case 'Mo':
674
+ return localize.ordinalNumber(month + 1, {
675
+ unit: 'month'
676
+ });
677
+ // Jan, Feb, ..., Dec
678
+ case 'MMM':
679
+ return localize.month(month, {
680
+ width: 'abbreviated',
681
+ context: 'formatting'
682
+ });
683
+ // J, F, ..., D
684
+ case 'MMMMM':
685
+ return localize.month(month, {
686
+ width: 'narrow',
687
+ context: 'formatting'
688
+ });
689
+ // January, February, ..., December
690
+ case 'MMMM':
691
+ default:
692
+ return localize.month(month, {
693
+ width: 'wide',
694
+ context: 'formatting'
695
+ });
696
+ }
697
+ },
698
+ // Stand-alone month
699
+ L: function L(date, token, localize) {
700
+ var month = date.getUTCMonth();
701
+ switch (token) {
702
+ // 1, 2, ..., 12
703
+ case 'L':
704
+ return String(month + 1);
705
+ // 01, 02, ..., 12
706
+ case 'LL':
707
+ return addLeadingZeros(month + 1, 2);
708
+ // 1st, 2nd, ..., 12th
709
+ case 'Lo':
710
+ return localize.ordinalNumber(month + 1, {
711
+ unit: 'month'
712
+ });
713
+ // Jan, Feb, ..., Dec
714
+ case 'LLL':
715
+ return localize.month(month, {
716
+ width: 'abbreviated',
717
+ context: 'standalone'
718
+ });
719
+ // J, F, ..., D
720
+ case 'LLLLL':
721
+ return localize.month(month, {
722
+ width: 'narrow',
723
+ context: 'standalone'
724
+ });
725
+ // January, February, ..., December
726
+ case 'LLLL':
727
+ default:
728
+ return localize.month(month, {
729
+ width: 'wide',
730
+ context: 'standalone'
731
+ });
732
+ }
733
+ },
734
+ // Local week of year
735
+ w: function w(date, token, localize, options) {
736
+ var week = getUTCWeek(date, options);
737
+ if (token === 'wo') {
738
+ return localize.ordinalNumber(week, {
739
+ unit: 'week'
740
+ });
741
+ }
742
+ return addLeadingZeros(week, token.length);
743
+ },
744
+ // ISO week of year
745
+ I: function I(date, token, localize) {
746
+ var isoWeek = getUTCISOWeek(date);
747
+ if (token === 'Io') {
748
+ return localize.ordinalNumber(isoWeek, {
749
+ unit: 'week'
750
+ });
751
+ }
752
+ return addLeadingZeros(isoWeek, token.length);
753
+ },
754
+ // Day of the month
755
+ d: function d(date, token, localize) {
756
+ if (token === 'do') {
757
+ return localize.ordinalNumber(date.getUTCDate(), {
758
+ unit: 'date'
759
+ });
760
+ }
761
+ return formatters$1.d(date, token);
762
+ },
763
+ // Day of year
764
+ D: function D(date, token, localize) {
765
+ var dayOfYear = getUTCDayOfYear(date);
766
+ if (token === 'Do') {
767
+ return localize.ordinalNumber(dayOfYear, {
768
+ unit: 'dayOfYear'
769
+ });
770
+ }
771
+ return addLeadingZeros(dayOfYear, token.length);
772
+ },
773
+ // Day of week
774
+ E: function E(date, token, localize) {
775
+ var dayOfWeek = date.getUTCDay();
776
+ switch (token) {
777
+ // Tue
778
+ case 'E':
779
+ case 'EE':
780
+ case 'EEE':
781
+ return localize.day(dayOfWeek, {
782
+ width: 'abbreviated',
783
+ context: 'formatting'
784
+ });
785
+ // T
786
+ case 'EEEEE':
787
+ return localize.day(dayOfWeek, {
788
+ width: 'narrow',
789
+ context: 'formatting'
790
+ });
791
+ // Tu
792
+ case 'EEEEEE':
793
+ return localize.day(dayOfWeek, {
794
+ width: 'short',
795
+ context: 'formatting'
796
+ });
797
+ // Tuesday
798
+ case 'EEEE':
799
+ default:
800
+ return localize.day(dayOfWeek, {
801
+ width: 'wide',
802
+ context: 'formatting'
803
+ });
804
+ }
805
+ },
806
+ // Local day of week
807
+ e: function e(date, token, localize, options) {
808
+ var dayOfWeek = date.getUTCDay();
809
+ var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
810
+ switch (token) {
811
+ // Numerical value (Nth day of week with current locale or weekStartsOn)
812
+ case 'e':
813
+ return String(localDayOfWeek);
814
+ // Padded numerical value
815
+ case 'ee':
816
+ return addLeadingZeros(localDayOfWeek, 2);
817
+ // 1st, 2nd, ..., 7th
818
+ case 'eo':
819
+ return localize.ordinalNumber(localDayOfWeek, {
820
+ unit: 'day'
821
+ });
822
+ case 'eee':
823
+ return localize.day(dayOfWeek, {
824
+ width: 'abbreviated',
825
+ context: 'formatting'
826
+ });
827
+ // T
828
+ case 'eeeee':
829
+ return localize.day(dayOfWeek, {
830
+ width: 'narrow',
831
+ context: 'formatting'
832
+ });
833
+ // Tu
834
+ case 'eeeeee':
835
+ return localize.day(dayOfWeek, {
836
+ width: 'short',
837
+ context: 'formatting'
838
+ });
839
+ // Tuesday
840
+ case 'eeee':
841
+ default:
842
+ return localize.day(dayOfWeek, {
843
+ width: 'wide',
844
+ context: 'formatting'
845
+ });
846
+ }
847
+ },
848
+ // Stand-alone local day of week
849
+ c: function c(date, token, localize, options) {
850
+ var dayOfWeek = date.getUTCDay();
851
+ var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
852
+ switch (token) {
853
+ // Numerical value (same as in `e`)
854
+ case 'c':
855
+ return String(localDayOfWeek);
856
+ // Padded numerical value
857
+ case 'cc':
858
+ return addLeadingZeros(localDayOfWeek, token.length);
859
+ // 1st, 2nd, ..., 7th
860
+ case 'co':
861
+ return localize.ordinalNumber(localDayOfWeek, {
862
+ unit: 'day'
863
+ });
864
+ case 'ccc':
865
+ return localize.day(dayOfWeek, {
866
+ width: 'abbreviated',
867
+ context: 'standalone'
868
+ });
869
+ // T
870
+ case 'ccccc':
871
+ return localize.day(dayOfWeek, {
872
+ width: 'narrow',
873
+ context: 'standalone'
874
+ });
875
+ // Tu
876
+ case 'cccccc':
877
+ return localize.day(dayOfWeek, {
878
+ width: 'short',
879
+ context: 'standalone'
880
+ });
881
+ // Tuesday
882
+ case 'cccc':
883
+ default:
884
+ return localize.day(dayOfWeek, {
885
+ width: 'wide',
886
+ context: 'standalone'
887
+ });
888
+ }
889
+ },
890
+ // ISO day of week
891
+ i: function i(date, token, localize) {
892
+ var dayOfWeek = date.getUTCDay();
893
+ var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
894
+ switch (token) {
895
+ // 2
896
+ case 'i':
897
+ return String(isoDayOfWeek);
898
+ // 02
899
+ case 'ii':
900
+ return addLeadingZeros(isoDayOfWeek, token.length);
901
+ // 2nd
902
+ case 'io':
903
+ return localize.ordinalNumber(isoDayOfWeek, {
904
+ unit: 'day'
905
+ });
906
+ // Tue
907
+ case 'iii':
908
+ return localize.day(dayOfWeek, {
909
+ width: 'abbreviated',
910
+ context: 'formatting'
911
+ });
912
+ // T
913
+ case 'iiiii':
914
+ return localize.day(dayOfWeek, {
915
+ width: 'narrow',
916
+ context: 'formatting'
917
+ });
918
+ // Tu
919
+ case 'iiiiii':
920
+ return localize.day(dayOfWeek, {
921
+ width: 'short',
922
+ context: 'formatting'
923
+ });
924
+ // Tuesday
925
+ case 'iiii':
926
+ default:
927
+ return localize.day(dayOfWeek, {
928
+ width: 'wide',
929
+ context: 'formatting'
930
+ });
931
+ }
932
+ },
933
+ // AM or PM
934
+ a: function a(date, token, localize) {
935
+ var hours = date.getUTCHours();
936
+ var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
937
+ switch (token) {
938
+ case 'a':
939
+ case 'aa':
940
+ return localize.dayPeriod(dayPeriodEnumValue, {
941
+ width: 'abbreviated',
942
+ context: 'formatting'
943
+ });
944
+ case 'aaa':
945
+ return localize.dayPeriod(dayPeriodEnumValue, {
946
+ width: 'abbreviated',
947
+ context: 'formatting'
948
+ }).toLowerCase();
949
+ case 'aaaaa':
950
+ return localize.dayPeriod(dayPeriodEnumValue, {
951
+ width: 'narrow',
952
+ context: 'formatting'
953
+ });
954
+ case 'aaaa':
955
+ default:
956
+ return localize.dayPeriod(dayPeriodEnumValue, {
957
+ width: 'wide',
958
+ context: 'formatting'
959
+ });
960
+ }
961
+ },
962
+ // AM, PM, midnight, noon
963
+ b: function b(date, token, localize) {
964
+ var hours = date.getUTCHours();
965
+ var dayPeriodEnumValue;
966
+ if (hours === 12) {
967
+ dayPeriodEnumValue = dayPeriodEnum.noon;
968
+ } else if (hours === 0) {
969
+ dayPeriodEnumValue = dayPeriodEnum.midnight;
970
+ } else {
971
+ dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
972
+ }
973
+ switch (token) {
974
+ case 'b':
975
+ case 'bb':
976
+ return localize.dayPeriod(dayPeriodEnumValue, {
977
+ width: 'abbreviated',
978
+ context: 'formatting'
979
+ });
980
+ case 'bbb':
981
+ return localize.dayPeriod(dayPeriodEnumValue, {
982
+ width: 'abbreviated',
983
+ context: 'formatting'
984
+ }).toLowerCase();
985
+ case 'bbbbb':
986
+ return localize.dayPeriod(dayPeriodEnumValue, {
987
+ width: 'narrow',
988
+ context: 'formatting'
989
+ });
990
+ case 'bbbb':
991
+ default:
992
+ return localize.dayPeriod(dayPeriodEnumValue, {
993
+ width: 'wide',
994
+ context: 'formatting'
995
+ });
996
+ }
997
+ },
998
+ // in the morning, in the afternoon, in the evening, at night
999
+ B: function B(date, token, localize) {
1000
+ var hours = date.getUTCHours();
1001
+ var dayPeriodEnumValue;
1002
+ if (hours >= 17) {
1003
+ dayPeriodEnumValue = dayPeriodEnum.evening;
1004
+ } else if (hours >= 12) {
1005
+ dayPeriodEnumValue = dayPeriodEnum.afternoon;
1006
+ } else if (hours >= 4) {
1007
+ dayPeriodEnumValue = dayPeriodEnum.morning;
1008
+ } else {
1009
+ dayPeriodEnumValue = dayPeriodEnum.night;
1010
+ }
1011
+ switch (token) {
1012
+ case 'B':
1013
+ case 'BB':
1014
+ case 'BBB':
1015
+ return localize.dayPeriod(dayPeriodEnumValue, {
1016
+ width: 'abbreviated',
1017
+ context: 'formatting'
1018
+ });
1019
+ case 'BBBBB':
1020
+ return localize.dayPeriod(dayPeriodEnumValue, {
1021
+ width: 'narrow',
1022
+ context: 'formatting'
1023
+ });
1024
+ case 'BBBB':
1025
+ default:
1026
+ return localize.dayPeriod(dayPeriodEnumValue, {
1027
+ width: 'wide',
1028
+ context: 'formatting'
1029
+ });
1030
+ }
1031
+ },
1032
+ // Hour [1-12]
1033
+ h: function h(date, token, localize) {
1034
+ if (token === 'ho') {
1035
+ var hours = date.getUTCHours() % 12;
1036
+ if (hours === 0) hours = 12;
1037
+ return localize.ordinalNumber(hours, {
1038
+ unit: 'hour'
1039
+ });
1040
+ }
1041
+ return formatters$1.h(date, token);
1042
+ },
1043
+ // Hour [0-23]
1044
+ H: function H(date, token, localize) {
1045
+ if (token === 'Ho') {
1046
+ return localize.ordinalNumber(date.getUTCHours(), {
1047
+ unit: 'hour'
1048
+ });
1049
+ }
1050
+ return formatters$1.H(date, token);
1051
+ },
1052
+ // Hour [0-11]
1053
+ K: function K(date, token, localize) {
1054
+ var hours = date.getUTCHours() % 12;
1055
+ if (token === 'Ko') {
1056
+ return localize.ordinalNumber(hours, {
1057
+ unit: 'hour'
1058
+ });
1059
+ }
1060
+ return addLeadingZeros(hours, token.length);
1061
+ },
1062
+ // Hour [1-24]
1063
+ k: function k(date, token, localize) {
1064
+ var hours = date.getUTCHours();
1065
+ if (hours === 0) hours = 24;
1066
+ if (token === 'ko') {
1067
+ return localize.ordinalNumber(hours, {
1068
+ unit: 'hour'
1069
+ });
1070
+ }
1071
+ return addLeadingZeros(hours, token.length);
1072
+ },
1073
+ // Minute
1074
+ m: function m(date, token, localize) {
1075
+ if (token === 'mo') {
1076
+ return localize.ordinalNumber(date.getUTCMinutes(), {
1077
+ unit: 'minute'
1078
+ });
1079
+ }
1080
+ return formatters$1.m(date, token);
1081
+ },
1082
+ // Second
1083
+ s: function s(date, token, localize) {
1084
+ if (token === 'so') {
1085
+ return localize.ordinalNumber(date.getUTCSeconds(), {
1086
+ unit: 'second'
1087
+ });
1088
+ }
1089
+ return formatters$1.s(date, token);
1090
+ },
1091
+ // Fraction of second
1092
+ S: function S(date, token) {
1093
+ return formatters$1.S(date, token);
1094
+ },
1095
+ // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
1096
+ X: function X(date, token, _localize, options) {
1097
+ var originalDate = options._originalDate || date;
1098
+ var timezoneOffset = originalDate.getTimezoneOffset();
1099
+ if (timezoneOffset === 0) {
1100
+ return 'Z';
1101
+ }
1102
+ switch (token) {
1103
+ // Hours and optional minutes
1104
+ case 'X':
1105
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
1106
+
1107
+ // Hours, minutes and optional seconds without `:` delimiter
1108
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1109
+ // so this token always has the same output as `XX`
1110
+ case 'XXXX':
1111
+ case 'XX':
1112
+ // Hours and minutes without `:` delimiter
1113
+ return formatTimezone(timezoneOffset);
1114
+
1115
+ // Hours, minutes and optional seconds with `:` delimiter
1116
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1117
+ // so this token always has the same output as `XXX`
1118
+ case 'XXXXX':
1119
+ case 'XXX': // Hours and minutes with `:` delimiter
1120
+ default:
1121
+ return formatTimezone(timezoneOffset, ':');
1122
+ }
1123
+ },
1124
+ // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
1125
+ x: function x(date, token, _localize, options) {
1126
+ var originalDate = options._originalDate || date;
1127
+ var timezoneOffset = originalDate.getTimezoneOffset();
1128
+ switch (token) {
1129
+ // Hours and optional minutes
1130
+ case 'x':
1131
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
1132
+
1133
+ // Hours, minutes and optional seconds without `:` delimiter
1134
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1135
+ // so this token always has the same output as `xx`
1136
+ case 'xxxx':
1137
+ case 'xx':
1138
+ // Hours and minutes without `:` delimiter
1139
+ return formatTimezone(timezoneOffset);
1140
+
1141
+ // Hours, minutes and optional seconds with `:` delimiter
1142
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1143
+ // so this token always has the same output as `xxx`
1144
+ case 'xxxxx':
1145
+ case 'xxx': // Hours and minutes with `:` delimiter
1146
+ default:
1147
+ return formatTimezone(timezoneOffset, ':');
1148
+ }
1149
+ },
1150
+ // Timezone (GMT)
1151
+ O: function O(date, token, _localize, options) {
1152
+ var originalDate = options._originalDate || date;
1153
+ var timezoneOffset = originalDate.getTimezoneOffset();
1154
+ switch (token) {
1155
+ // Short
1156
+ case 'O':
1157
+ case 'OO':
1158
+ case 'OOO':
1159
+ return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
1160
+ // Long
1161
+ case 'OOOO':
1162
+ default:
1163
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
1164
+ }
1165
+ },
1166
+ // Timezone (specific non-location)
1167
+ z: function z(date, token, _localize, options) {
1168
+ var originalDate = options._originalDate || date;
1169
+ var timezoneOffset = originalDate.getTimezoneOffset();
1170
+ switch (token) {
1171
+ // Short
1172
+ case 'z':
1173
+ case 'zz':
1174
+ case 'zzz':
1175
+ return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
1176
+ // Long
1177
+ case 'zzzz':
1178
+ default:
1179
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
1180
+ }
1181
+ },
1182
+ // Seconds timestamp
1183
+ t: function t(date, token, _localize, options) {
1184
+ var originalDate = options._originalDate || date;
1185
+ var timestamp = Math.floor(originalDate.getTime() / 1000);
1186
+ return addLeadingZeros(timestamp, token.length);
1187
+ },
1188
+ // Milliseconds timestamp
1189
+ T: function T(date, token, _localize, options) {
1190
+ var originalDate = options._originalDate || date;
1191
+ var timestamp = originalDate.getTime();
1192
+ return addLeadingZeros(timestamp, token.length);
1193
+ }
1194
+ };
1195
+ function formatTimezoneShort(offset, dirtyDelimiter) {
1196
+ var sign = offset > 0 ? '-' : '+';
1197
+ var absOffset = Math.abs(offset);
1198
+ var hours = Math.floor(absOffset / 60);
1199
+ var minutes = absOffset % 60;
1200
+ if (minutes === 0) {
1201
+ return sign + String(hours);
1202
+ }
1203
+ var delimiter = dirtyDelimiter || '';
1204
+ return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
1205
+ }
1206
+ function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
1207
+ if (offset % 60 === 0) {
1208
+ var sign = offset > 0 ? '-' : '+';
1209
+ return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
1210
+ }
1211
+ return formatTimezone(offset, dirtyDelimiter);
1212
+ }
1213
+ function formatTimezone(offset, dirtyDelimiter) {
1214
+ var delimiter = dirtyDelimiter || '';
1215
+ var sign = offset > 0 ? '-' : '+';
1216
+ var absOffset = Math.abs(offset);
1217
+ var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
1218
+ var minutes = addLeadingZeros(absOffset % 60, 2);
1219
+ return sign + hours + delimiter + minutes;
1220
+ }
1221
+
1222
+ var dateLongFormatter = function dateLongFormatter(pattern, formatLong) {
1223
+ switch (pattern) {
1224
+ case 'P':
1225
+ return formatLong.date({
1226
+ width: 'short'
1227
+ });
1228
+ case 'PP':
1229
+ return formatLong.date({
1230
+ width: 'medium'
1231
+ });
1232
+ case 'PPP':
1233
+ return formatLong.date({
1234
+ width: 'long'
1235
+ });
1236
+ case 'PPPP':
1237
+ default:
1238
+ return formatLong.date({
1239
+ width: 'full'
1240
+ });
1241
+ }
1242
+ };
1243
+ var timeLongFormatter = function timeLongFormatter(pattern, formatLong) {
1244
+ switch (pattern) {
1245
+ case 'p':
1246
+ return formatLong.time({
1247
+ width: 'short'
1248
+ });
1249
+ case 'pp':
1250
+ return formatLong.time({
1251
+ width: 'medium'
1252
+ });
1253
+ case 'ppp':
1254
+ return formatLong.time({
1255
+ width: 'long'
1256
+ });
1257
+ case 'pppp':
1258
+ default:
1259
+ return formatLong.time({
1260
+ width: 'full'
1261
+ });
1262
+ }
1263
+ };
1264
+ var dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) {
1265
+ var matchResult = pattern.match(/(P+)(p+)?/) || [];
1266
+ var datePattern = matchResult[1];
1267
+ var timePattern = matchResult[2];
1268
+ if (!timePattern) {
1269
+ return dateLongFormatter(pattern, formatLong);
1270
+ }
1271
+ var dateTimeFormat;
1272
+ switch (datePattern) {
1273
+ case 'P':
1274
+ dateTimeFormat = formatLong.dateTime({
1275
+ width: 'short'
1276
+ });
1277
+ break;
1278
+ case 'PP':
1279
+ dateTimeFormat = formatLong.dateTime({
1280
+ width: 'medium'
1281
+ });
1282
+ break;
1283
+ case 'PPP':
1284
+ dateTimeFormat = formatLong.dateTime({
1285
+ width: 'long'
1286
+ });
1287
+ break;
1288
+ case 'PPPP':
1289
+ default:
1290
+ dateTimeFormat = formatLong.dateTime({
1291
+ width: 'full'
1292
+ });
1293
+ break;
1294
+ }
1295
+ return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
1296
+ };
1297
+ var longFormatters = {
1298
+ p: timeLongFormatter,
1299
+ P: dateTimeLongFormatter
1300
+ };
1301
+
1302
+ var protectedDayOfYearTokens = ['D', 'DD'];
1303
+ var protectedWeekYearTokens = ['YY', 'YYYY'];
1304
+ function isProtectedDayOfYearToken(token) {
1305
+ return protectedDayOfYearTokens.indexOf(token) !== -1;
1306
+ }
1307
+ function isProtectedWeekYearToken(token) {
1308
+ return protectedWeekYearTokens.indexOf(token) !== -1;
1309
+ }
1310
+ function throwProtectedError(token, format, input) {
1311
+ if (token === 'YYYY') {
1312
+ 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"));
1313
+ } else if (token === 'YY') {
1314
+ 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"));
1315
+ } else if (token === 'D') {
1316
+ 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"));
1317
+ } else if (token === 'DD') {
1318
+ 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"));
1319
+ }
1320
+ }
1321
+
1322
+ var formatDistanceLocale = {
1323
+ lessThanXSeconds: {
1324
+ one: 'less than a second',
1325
+ other: 'less than {{count}} seconds'
1326
+ },
1327
+ xSeconds: {
1328
+ one: '1 second',
1329
+ other: '{{count}} seconds'
1330
+ },
1331
+ halfAMinute: 'half a minute',
1332
+ lessThanXMinutes: {
1333
+ one: 'less than a minute',
1334
+ other: 'less than {{count}} minutes'
1335
+ },
1336
+ xMinutes: {
1337
+ one: '1 minute',
1338
+ other: '{{count}} minutes'
1339
+ },
1340
+ aboutXHours: {
1341
+ one: 'about 1 hour',
1342
+ other: 'about {{count}} hours'
1343
+ },
1344
+ xHours: {
1345
+ one: '1 hour',
1346
+ other: '{{count}} hours'
1347
+ },
1348
+ xDays: {
1349
+ one: '1 day',
1350
+ other: '{{count}} days'
1351
+ },
1352
+ aboutXWeeks: {
1353
+ one: 'about 1 week',
1354
+ other: 'about {{count}} weeks'
1355
+ },
1356
+ xWeeks: {
1357
+ one: '1 week',
1358
+ other: '{{count}} weeks'
1359
+ },
1360
+ aboutXMonths: {
1361
+ one: 'about 1 month',
1362
+ other: 'about {{count}} months'
1363
+ },
1364
+ xMonths: {
1365
+ one: '1 month',
1366
+ other: '{{count}} months'
1367
+ },
1368
+ aboutXYears: {
1369
+ one: 'about 1 year',
1370
+ other: 'about {{count}} years'
1371
+ },
1372
+ xYears: {
1373
+ one: '1 year',
1374
+ other: '{{count}} years'
1375
+ },
1376
+ overXYears: {
1377
+ one: 'over 1 year',
1378
+ other: 'over {{count}} years'
1379
+ },
1380
+ almostXYears: {
1381
+ one: 'almost 1 year',
1382
+ other: 'almost {{count}} years'
1383
+ }
1384
+ };
1385
+ var formatDistance = function formatDistance(token, count, options) {
1386
+ var result;
1387
+ var tokenValue = formatDistanceLocale[token];
1388
+ if (typeof tokenValue === 'string') {
1389
+ result = tokenValue;
1390
+ } else if (count === 1) {
1391
+ result = tokenValue.one;
1392
+ } else {
1393
+ result = tokenValue.other.replace('{{count}}', count.toString());
1394
+ }
1395
+ if (options !== null && options !== void 0 && options.addSuffix) {
1396
+ if (options.comparison && options.comparison > 0) {
1397
+ return 'in ' + result;
1398
+ } else {
1399
+ return result + ' ago';
1400
+ }
1401
+ }
1402
+ return result;
1403
+ };
1404
+
1405
+ function buildFormatLongFn(args) {
1406
+ return function () {
1407
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1408
+ // TODO: Remove String()
1409
+ var width = options.width ? String(options.width) : args.defaultWidth;
1410
+ var format = args.formats[width] || args.formats[args.defaultWidth];
1411
+ return format;
1412
+ };
1413
+ }
1414
+
1415
+ var dateFormats = {
1416
+ full: 'EEEE, MMMM do, y',
1417
+ long: 'MMMM do, y',
1418
+ medium: 'MMM d, y',
1419
+ short: 'MM/dd/yyyy'
1420
+ };
1421
+ var timeFormats = {
1422
+ full: 'h:mm:ss a zzzz',
1423
+ long: 'h:mm:ss a z',
1424
+ medium: 'h:mm:ss a',
1425
+ short: 'h:mm a'
1426
+ };
1427
+ var dateTimeFormats = {
1428
+ full: "{{date}} 'at' {{time}}",
1429
+ long: "{{date}} 'at' {{time}}",
1430
+ medium: '{{date}}, {{time}}',
1431
+ short: '{{date}}, {{time}}'
1432
+ };
1433
+ var formatLong = {
1434
+ date: buildFormatLongFn({
1435
+ formats: dateFormats,
1436
+ defaultWidth: 'full'
1437
+ }),
1438
+ time: buildFormatLongFn({
1439
+ formats: timeFormats,
1440
+ defaultWidth: 'full'
1441
+ }),
1442
+ dateTime: buildFormatLongFn({
1443
+ formats: dateTimeFormats,
1444
+ defaultWidth: 'full'
1445
+ })
1446
+ };
1447
+
1448
+ var formatRelativeLocale = {
1449
+ lastWeek: "'last' eeee 'at' p",
1450
+ yesterday: "'yesterday at' p",
1451
+ today: "'today at' p",
1452
+ tomorrow: "'tomorrow at' p",
1453
+ nextWeek: "eeee 'at' p",
1454
+ other: 'P'
1455
+ };
1456
+ var formatRelative = function formatRelative(token, _date, _baseDate, _options) {
1457
+ return formatRelativeLocale[token];
1458
+ };
1459
+
1460
+ function buildLocalizeFn(args) {
1461
+ return function (dirtyIndex, options) {
1462
+ var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';
1463
+ var valuesArray;
1464
+ if (context === 'formatting' && args.formattingValues) {
1465
+ var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
1466
+ var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
1467
+ valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
1468
+ } else {
1469
+ var _defaultWidth = args.defaultWidth;
1470
+ var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
1471
+ valuesArray = args.values[_width] || args.values[_defaultWidth];
1472
+ }
1473
+ var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
1474
+ // @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!
1475
+ return valuesArray[index];
1476
+ };
1477
+ }
1478
+
1479
+ var eraValues = {
1480
+ narrow: ['B', 'A'],
1481
+ abbreviated: ['BC', 'AD'],
1482
+ wide: ['Before Christ', 'Anno Domini']
1483
+ };
1484
+ var quarterValues = {
1485
+ narrow: ['1', '2', '3', '4'],
1486
+ abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
1487
+ wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
1488
+ };
1489
+
1490
+ // Note: in English, the names of days of the week and months are capitalized.
1491
+ // If you are making a new locale based on this one, check if the same is true for the language you're working on.
1492
+ // Generally, formatted dates should look like they are in the middle of a sentence,
1493
+ // e.g. in Spanish language the weekdays and months should be in the lowercase.
1494
+ var monthValues = {
1495
+ narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
1496
+ abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
1497
+ wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
1498
+ };
1499
+ var dayValues = {
1500
+ narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
1501
+ short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
1502
+ abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
1503
+ wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
1504
+ };
1505
+ var dayPeriodValues = {
1506
+ narrow: {
1507
+ am: 'a',
1508
+ pm: 'p',
1509
+ midnight: 'mi',
1510
+ noon: 'n',
1511
+ morning: 'morning',
1512
+ afternoon: 'afternoon',
1513
+ evening: 'evening',
1514
+ night: 'night'
1515
+ },
1516
+ abbreviated: {
1517
+ am: 'AM',
1518
+ pm: 'PM',
1519
+ midnight: 'midnight',
1520
+ noon: 'noon',
1521
+ morning: 'morning',
1522
+ afternoon: 'afternoon',
1523
+ evening: 'evening',
1524
+ night: 'night'
1525
+ },
1526
+ wide: {
1527
+ am: 'a.m.',
1528
+ pm: 'p.m.',
1529
+ midnight: 'midnight',
1530
+ noon: 'noon',
1531
+ morning: 'morning',
1532
+ afternoon: 'afternoon',
1533
+ evening: 'evening',
1534
+ night: 'night'
1535
+ }
1536
+ };
1537
+ var formattingDayPeriodValues = {
1538
+ narrow: {
1539
+ am: 'a',
1540
+ pm: 'p',
1541
+ midnight: 'mi',
1542
+ noon: 'n',
1543
+ morning: 'in the morning',
1544
+ afternoon: 'in the afternoon',
1545
+ evening: 'in the evening',
1546
+ night: 'at night'
1547
+ },
1548
+ abbreviated: {
1549
+ am: 'AM',
1550
+ pm: 'PM',
1551
+ midnight: 'midnight',
1552
+ noon: 'noon',
1553
+ morning: 'in the morning',
1554
+ afternoon: 'in the afternoon',
1555
+ evening: 'in the evening',
1556
+ night: 'at night'
1557
+ },
1558
+ wide: {
1559
+ am: 'a.m.',
1560
+ pm: 'p.m.',
1561
+ midnight: 'midnight',
1562
+ noon: 'noon',
1563
+ morning: 'in the morning',
1564
+ afternoon: 'in the afternoon',
1565
+ evening: 'in the evening',
1566
+ night: 'at night'
1567
+ }
1568
+ };
1569
+ var ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
1570
+ var number = Number(dirtyNumber);
1571
+
1572
+ // If ordinal numbers depend on context, for example,
1573
+ // if they are different for different grammatical genders,
1574
+ // use `options.unit`.
1575
+ //
1576
+ // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
1577
+ // 'day', 'hour', 'minute', 'second'.
1578
+
1579
+ var rem100 = number % 100;
1580
+ if (rem100 > 20 || rem100 < 10) {
1581
+ switch (rem100 % 10) {
1582
+ case 1:
1583
+ return number + 'st';
1584
+ case 2:
1585
+ return number + 'nd';
1586
+ case 3:
1587
+ return number + 'rd';
1588
+ }
1589
+ }
1590
+ return number + 'th';
1591
+ };
1592
+ var localize = {
1593
+ ordinalNumber: ordinalNumber,
1594
+ era: buildLocalizeFn({
1595
+ values: eraValues,
1596
+ defaultWidth: 'wide'
1597
+ }),
1598
+ quarter: buildLocalizeFn({
1599
+ values: quarterValues,
1600
+ defaultWidth: 'wide',
1601
+ argumentCallback: function argumentCallback(quarter) {
1602
+ return quarter - 1;
1603
+ }
1604
+ }),
1605
+ month: buildLocalizeFn({
1606
+ values: monthValues,
1607
+ defaultWidth: 'wide'
1608
+ }),
1609
+ day: buildLocalizeFn({
1610
+ values: dayValues,
1611
+ defaultWidth: 'wide'
1612
+ }),
1613
+ dayPeriod: buildLocalizeFn({
1614
+ values: dayPeriodValues,
1615
+ defaultWidth: 'wide',
1616
+ formattingValues: formattingDayPeriodValues,
1617
+ defaultFormattingWidth: 'wide'
1618
+ })
1619
+ };
1620
+
1621
+ function buildMatchFn(args) {
1622
+ return function (string) {
1623
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1624
+ var width = options.width;
1625
+ var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
1626
+ var matchResult = string.match(matchPattern);
1627
+ if (!matchResult) {
1628
+ return null;
1629
+ }
1630
+ var matchedString = matchResult[0];
1631
+ var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
1632
+ var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
1633
+ return pattern.test(matchedString);
1634
+ }) : findKey(parsePatterns, function (pattern) {
1635
+ return pattern.test(matchedString);
1636
+ });
1637
+ var value;
1638
+ value = args.valueCallback ? args.valueCallback(key) : key;
1639
+ value = options.valueCallback ? options.valueCallback(value) : value;
1640
+ var rest = string.slice(matchedString.length);
1641
+ return {
1642
+ value: value,
1643
+ rest: rest
1644
+ };
1645
+ };
1646
+ }
1647
+ function findKey(object, predicate) {
1648
+ for (var key in object) {
1649
+ if (object.hasOwnProperty(key) && predicate(object[key])) {
1650
+ return key;
1651
+ }
1652
+ }
1653
+ return undefined;
1654
+ }
1655
+ function findIndex(array, predicate) {
1656
+ for (var key = 0; key < array.length; key++) {
1657
+ if (predicate(array[key])) {
1658
+ return key;
1659
+ }
1660
+ }
1661
+ return undefined;
1662
+ }
1663
+
1664
+ function buildMatchPatternFn(args) {
1665
+ return function (string) {
1666
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1667
+ var matchResult = string.match(args.matchPattern);
1668
+ if (!matchResult) return null;
1669
+ var matchedString = matchResult[0];
1670
+ var parseResult = string.match(args.parsePattern);
1671
+ if (!parseResult) return null;
1672
+ var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
1673
+ value = options.valueCallback ? options.valueCallback(value) : value;
1674
+ var rest = string.slice(matchedString.length);
1675
+ return {
1676
+ value: value,
1677
+ rest: rest
1678
+ };
1679
+ };
1680
+ }
1681
+
1682
+ var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
1683
+ var parseOrdinalNumberPattern = /\d+/i;
1684
+ var matchEraPatterns = {
1685
+ narrow: /^(b|a)/i,
1686
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
1687
+ wide: /^(before christ|before common era|anno domini|common era)/i
1688
+ };
1689
+ var parseEraPatterns = {
1690
+ any: [/^b/i, /^(a|c)/i]
1691
+ };
1692
+ var matchQuarterPatterns = {
1693
+ narrow: /^[1234]/i,
1694
+ abbreviated: /^q[1234]/i,
1695
+ wide: /^[1234](th|st|nd|rd)? quarter/i
1696
+ };
1697
+ var parseQuarterPatterns = {
1698
+ any: [/1/i, /2/i, /3/i, /4/i]
1699
+ };
1700
+ var matchMonthPatterns = {
1701
+ narrow: /^[jfmasond]/i,
1702
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
1703
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
1704
+ };
1705
+ var parseMonthPatterns = {
1706
+ 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],
1707
+ 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]
1708
+ };
1709
+ var matchDayPatterns = {
1710
+ narrow: /^[smtwf]/i,
1711
+ short: /^(su|mo|tu|we|th|fr|sa)/i,
1712
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
1713
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
1714
+ };
1715
+ var parseDayPatterns = {
1716
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
1717
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
1718
+ };
1719
+ var matchDayPeriodPatterns = {
1720
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
1721
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
1722
+ };
1723
+ var parseDayPeriodPatterns = {
1724
+ any: {
1725
+ am: /^a/i,
1726
+ pm: /^p/i,
1727
+ midnight: /^mi/i,
1728
+ noon: /^no/i,
1729
+ morning: /morning/i,
1730
+ afternoon: /afternoon/i,
1731
+ evening: /evening/i,
1732
+ night: /night/i
1733
+ }
1734
+ };
1735
+ var match = {
1736
+ ordinalNumber: buildMatchPatternFn({
1737
+ matchPattern: matchOrdinalNumberPattern,
1738
+ parsePattern: parseOrdinalNumberPattern,
1739
+ valueCallback: function valueCallback(value) {
1740
+ return parseInt(value, 10);
1741
+ }
1742
+ }),
1743
+ era: buildMatchFn({
1744
+ matchPatterns: matchEraPatterns,
1745
+ defaultMatchWidth: 'wide',
1746
+ parsePatterns: parseEraPatterns,
1747
+ defaultParseWidth: 'any'
1748
+ }),
1749
+ quarter: buildMatchFn({
1750
+ matchPatterns: matchQuarterPatterns,
1751
+ defaultMatchWidth: 'wide',
1752
+ parsePatterns: parseQuarterPatterns,
1753
+ defaultParseWidth: 'any',
1754
+ valueCallback: function valueCallback(index) {
1755
+ return index + 1;
1756
+ }
1757
+ }),
1758
+ month: buildMatchFn({
1759
+ matchPatterns: matchMonthPatterns,
1760
+ defaultMatchWidth: 'wide',
1761
+ parsePatterns: parseMonthPatterns,
1762
+ defaultParseWidth: 'any'
1763
+ }),
1764
+ day: buildMatchFn({
1765
+ matchPatterns: matchDayPatterns,
1766
+ defaultMatchWidth: 'wide',
1767
+ parsePatterns: parseDayPatterns,
1768
+ defaultParseWidth: 'any'
1769
+ }),
1770
+ dayPeriod: buildMatchFn({
1771
+ matchPatterns: matchDayPeriodPatterns,
1772
+ defaultMatchWidth: 'any',
1773
+ parsePatterns: parseDayPeriodPatterns,
1774
+ defaultParseWidth: 'any'
1775
+ })
1776
+ };
1777
+
1778
+ /**
1779
+ * @type {Locale}
1780
+ * @category Locales
1781
+ * @summary English locale (United States).
1782
+ * @language English
1783
+ * @iso-639-2 eng
1784
+ * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
1785
+ * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
1786
+ */
1787
+ var locale = {
1788
+ code: 'en-US',
1789
+ formatDistance: formatDistance,
1790
+ formatLong: formatLong,
1791
+ formatRelative: formatRelative,
1792
+ localize: localize,
1793
+ match: match,
1794
+ options: {
1795
+ weekStartsOn: 0 /* Sunday */,
1796
+ firstWeekContainsDate: 1
1797
+ }
1798
+ };
1799
+
1800
+ // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
1801
+ // (one of the certain letters followed by `o`)
1802
+ // - (\w)\1* matches any sequences of the same letter
1803
+ // - '' matches two quote characters in a row
1804
+ // - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
1805
+ // except a single quote symbol, which ends the sequence.
1806
+ // Two quote characters do not end the sequence.
1807
+ // If there is no matching single quote
1808
+ // then the sequence will continue until the end of the string.
1809
+ // - . matches any single character unmatched by previous parts of the RegExps
1810
+ var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
1811
+
1812
+ // This RegExp catches symbols escaped by quotes, and also
1813
+ // sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
1814
+ var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
1815
+ var escapedStringRegExp = /^'([^]*?)'?$/;
1816
+ var doubleQuoteRegExp = /''/g;
1817
+ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
1818
+
1819
+ /**
1820
+ * @name format
1821
+ * @category Common Helpers
1822
+ * @summary Format the date.
1823
+ *
1824
+ * @description
1825
+ * Return the formatted date string in the given format. The result may vary by locale.
1826
+ *
1827
+ * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
1828
+ * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
1829
+ *
1830
+ * The characters wrapped between two single quotes characters (') are escaped.
1831
+ * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
1832
+ * (see the last example)
1833
+ *
1834
+ * Format of the string is based on Unicode Technical Standard #35:
1835
+ * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
1836
+ * with a few additions (see note 7 below the table).
1837
+ *
1838
+ * Accepted patterns:
1839
+ * | Unit | Pattern | Result examples | Notes |
1840
+ * |---------------------------------|---------|-----------------------------------|-------|
1841
+ * | Era | G..GGG | AD, BC | |
1842
+ * | | GGGG | Anno Domini, Before Christ | 2 |
1843
+ * | | GGGGG | A, B | |
1844
+ * | Calendar year | y | 44, 1, 1900, 2017 | 5 |
1845
+ * | | yo | 44th, 1st, 0th, 17th | 5,7 |
1846
+ * | | yy | 44, 01, 00, 17 | 5 |
1847
+ * | | yyy | 044, 001, 1900, 2017 | 5 |
1848
+ * | | yyyy | 0044, 0001, 1900, 2017 | 5 |
1849
+ * | | yyyyy | ... | 3,5 |
1850
+ * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
1851
+ * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
1852
+ * | | YY | 44, 01, 00, 17 | 5,8 |
1853
+ * | | YYY | 044, 001, 1900, 2017 | 5 |
1854
+ * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
1855
+ * | | YYYYY | ... | 3,5 |
1856
+ * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
1857
+ * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
1858
+ * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
1859
+ * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
1860
+ * | | RRRRR | ... | 3,5,7 |
1861
+ * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
1862
+ * | | uu | -43, 01, 1900, 2017 | 5 |
1863
+ * | | uuu | -043, 001, 1900, 2017 | 5 |
1864
+ * | | uuuu | -0043, 0001, 1900, 2017 | 5 |
1865
+ * | | uuuuu | ... | 3,5 |
1866
+ * | Quarter (formatting) | Q | 1, 2, 3, 4 | |
1867
+ * | | Qo | 1st, 2nd, 3rd, 4th | 7 |
1868
+ * | | QQ | 01, 02, 03, 04 | |
1869
+ * | | QQQ | Q1, Q2, Q3, Q4 | |
1870
+ * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
1871
+ * | | QQQQQ | 1, 2, 3, 4 | 4 |
1872
+ * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
1873
+ * | | qo | 1st, 2nd, 3rd, 4th | 7 |
1874
+ * | | qq | 01, 02, 03, 04 | |
1875
+ * | | qqq | Q1, Q2, Q3, Q4 | |
1876
+ * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
1877
+ * | | qqqqq | 1, 2, 3, 4 | 4 |
1878
+ * | Month (formatting) | M | 1, 2, ..., 12 | |
1879
+ * | | Mo | 1st, 2nd, ..., 12th | 7 |
1880
+ * | | MM | 01, 02, ..., 12 | |
1881
+ * | | MMM | Jan, Feb, ..., Dec | |
1882
+ * | | MMMM | January, February, ..., December | 2 |
1883
+ * | | MMMMM | J, F, ..., D | |
1884
+ * | Month (stand-alone) | L | 1, 2, ..., 12 | |
1885
+ * | | Lo | 1st, 2nd, ..., 12th | 7 |
1886
+ * | | LL | 01, 02, ..., 12 | |
1887
+ * | | LLL | Jan, Feb, ..., Dec | |
1888
+ * | | LLLL | January, February, ..., December | 2 |
1889
+ * | | LLLLL | J, F, ..., D | |
1890
+ * | Local week of year | w | 1, 2, ..., 53 | |
1891
+ * | | wo | 1st, 2nd, ..., 53th | 7 |
1892
+ * | | ww | 01, 02, ..., 53 | |
1893
+ * | ISO week of year | I | 1, 2, ..., 53 | 7 |
1894
+ * | | Io | 1st, 2nd, ..., 53th | 7 |
1895
+ * | | II | 01, 02, ..., 53 | 7 |
1896
+ * | Day of month | d | 1, 2, ..., 31 | |
1897
+ * | | do | 1st, 2nd, ..., 31st | 7 |
1898
+ * | | dd | 01, 02, ..., 31 | |
1899
+ * | Day of year | D | 1, 2, ..., 365, 366 | 9 |
1900
+ * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
1901
+ * | | DD | 01, 02, ..., 365, 366 | 9 |
1902
+ * | | DDD | 001, 002, ..., 365, 366 | |
1903
+ * | | DDDD | ... | 3 |
1904
+ * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
1905
+ * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
1906
+ * | | EEEEE | M, T, W, T, F, S, S | |
1907
+ * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
1908
+ * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
1909
+ * | | io | 1st, 2nd, ..., 7th | 7 |
1910
+ * | | ii | 01, 02, ..., 07 | 7 |
1911
+ * | | iii | Mon, Tue, Wed, ..., Sun | 7 |
1912
+ * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
1913
+ * | | iiiii | M, T, W, T, F, S, S | 7 |
1914
+ * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
1915
+ * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
1916
+ * | | eo | 2nd, 3rd, ..., 1st | 7 |
1917
+ * | | ee | 02, 03, ..., 01 | |
1918
+ * | | eee | Mon, Tue, Wed, ..., Sun | |
1919
+ * | | eeee | Monday, Tuesday, ..., Sunday | 2 |
1920
+ * | | eeeee | M, T, W, T, F, S, S | |
1921
+ * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
1922
+ * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
1923
+ * | | co | 2nd, 3rd, ..., 1st | 7 |
1924
+ * | | cc | 02, 03, ..., 01 | |
1925
+ * | | ccc | Mon, Tue, Wed, ..., Sun | |
1926
+ * | | cccc | Monday, Tuesday, ..., Sunday | 2 |
1927
+ * | | ccccc | M, T, W, T, F, S, S | |
1928
+ * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
1929
+ * | AM, PM | a..aa | AM, PM | |
1930
+ * | | aaa | am, pm | |
1931
+ * | | aaaa | a.m., p.m. | 2 |
1932
+ * | | aaaaa | a, p | |
1933
+ * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
1934
+ * | | bbb | am, pm, noon, midnight | |
1935
+ * | | bbbb | a.m., p.m., noon, midnight | 2 |
1936
+ * | | bbbbb | a, p, n, mi | |
1937
+ * | Flexible day period | B..BBB | at night, in the morning, ... | |
1938
+ * | | BBBB | at night, in the morning, ... | 2 |
1939
+ * | | BBBBB | at night, in the morning, ... | |
1940
+ * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
1941
+ * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
1942
+ * | | hh | 01, 02, ..., 11, 12 | |
1943
+ * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
1944
+ * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
1945
+ * | | HH | 00, 01, 02, ..., 23 | |
1946
+ * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
1947
+ * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
1948
+ * | | KK | 01, 02, ..., 11, 00 | |
1949
+ * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
1950
+ * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
1951
+ * | | kk | 24, 01, 02, ..., 23 | |
1952
+ * | Minute | m | 0, 1, ..., 59 | |
1953
+ * | | mo | 0th, 1st, ..., 59th | 7 |
1954
+ * | | mm | 00, 01, ..., 59 | |
1955
+ * | Second | s | 0, 1, ..., 59 | |
1956
+ * | | so | 0th, 1st, ..., 59th | 7 |
1957
+ * | | ss | 00, 01, ..., 59 | |
1958
+ * | Fraction of second | S | 0, 1, ..., 9 | |
1959
+ * | | SS | 00, 01, ..., 99 | |
1960
+ * | | SSS | 000, 001, ..., 999 | |
1961
+ * | | SSSS | ... | 3 |
1962
+ * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
1963
+ * | | XX | -0800, +0530, Z | |
1964
+ * | | XXX | -08:00, +05:30, Z | |
1965
+ * | | XXXX | -0800, +0530, Z, +123456 | 2 |
1966
+ * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
1967
+ * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
1968
+ * | | xx | -0800, +0530, +0000 | |
1969
+ * | | xxx | -08:00, +05:30, +00:00 | 2 |
1970
+ * | | xxxx | -0800, +0530, +0000, +123456 | |
1971
+ * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
1972
+ * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
1973
+ * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
1974
+ * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
1975
+ * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
1976
+ * | Seconds timestamp | t | 512969520 | 7 |
1977
+ * | | tt | ... | 3,7 |
1978
+ * | Milliseconds timestamp | T | 512969520900 | 7 |
1979
+ * | | TT | ... | 3,7 |
1980
+ * | Long localized date | P | 04/29/1453 | 7 |
1981
+ * | | PP | Apr 29, 1453 | 7 |
1982
+ * | | PPP | April 29th, 1453 | 7 |
1983
+ * | | PPPP | Friday, April 29th, 1453 | 2,7 |
1984
+ * | Long localized time | p | 12:00 AM | 7 |
1985
+ * | | pp | 12:00:00 AM | 7 |
1986
+ * | | ppp | 12:00:00 AM GMT+2 | 7 |
1987
+ * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
1988
+ * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
1989
+ * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
1990
+ * | | PPPppp | April 29th, 1453 at ... | 7 |
1991
+ * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
1992
+ * Notes:
1993
+ * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
1994
+ * are the same as "stand-alone" units, but are different in some languages.
1995
+ * "Formatting" units are declined according to the rules of the language
1996
+ * in the context of a date. "Stand-alone" units are always nominative singular:
1997
+ *
1998
+ * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
1999
+ *
2000
+ * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
2001
+ *
2002
+ * 2. Any sequence of the identical letters is a pattern, unless it is escaped by
2003
+ * the single quote characters (see below).
2004
+ * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
2005
+ * the output will be the same as default pattern for this unit, usually
2006
+ * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
2007
+ * are marked with "2" in the last column of the table.
2008
+ *
2009
+ * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
2010
+ *
2011
+ * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
2012
+ *
2013
+ * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
2014
+ *
2015
+ * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
2016
+ *
2017
+ * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
2018
+ *
2019
+ * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
2020
+ * The output will be padded with zeros to match the length of the pattern.
2021
+ *
2022
+ * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
2023
+ *
2024
+ * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
2025
+ * These tokens represent the shortest form of the quarter.
2026
+ *
2027
+ * 5. The main difference between `y` and `u` patterns are B.C. years:
2028
+ *
2029
+ * | Year | `y` | `u` |
2030
+ * |------|-----|-----|
2031
+ * | AC 1 | 1 | 1 |
2032
+ * | BC 1 | 1 | 0 |
2033
+ * | BC 2 | 2 | -1 |
2034
+ *
2035
+ * Also `yy` always returns the last two digits of a year,
2036
+ * while `uu` pads single digit years to 2 characters and returns other years unchanged:
2037
+ *
2038
+ * | Year | `yy` | `uu` |
2039
+ * |------|------|------|
2040
+ * | 1 | 01 | 01 |
2041
+ * | 14 | 14 | 14 |
2042
+ * | 376 | 76 | 376 |
2043
+ * | 1453 | 53 | 1453 |
2044
+ *
2045
+ * The same difference is true for local and ISO week-numbering years (`Y` and `R`),
2046
+ * except local week-numbering years are dependent on `options.weekStartsOn`
2047
+ * and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}
2048
+ * and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).
2049
+ *
2050
+ * 6. Specific non-location timezones are currently unavailable in `date-fns`,
2051
+ * so right now these tokens fall back to GMT timezones.
2052
+ *
2053
+ * 7. These patterns are not in the Unicode Technical Standard #35:
2054
+ * - `i`: ISO day of week
2055
+ * - `I`: ISO week of year
2056
+ * - `R`: ISO week-numbering year
2057
+ * - `t`: seconds timestamp
2058
+ * - `T`: milliseconds timestamp
2059
+ * - `o`: ordinal number modifier
2060
+ * - `P`: long localized date
2061
+ * - `p`: long localized time
2062
+ *
2063
+ * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
2064
+ * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2065
+ *
2066
+ * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
2067
+ * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2068
+ *
2069
+ * @param {Date|Number} date - the original date
2070
+ * @param {String} format - the string of tokens
2071
+ * @param {Object} [options] - an object with options.
2072
+ * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
2073
+ * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
2074
+ * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
2075
+ * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
2076
+ * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2077
+ * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
2078
+ * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2079
+ * @returns {String} the formatted date string
2080
+ * @throws {TypeError} 2 arguments required
2081
+ * @throws {RangeError} `date` must not be Invalid Date
2082
+ * @throws {RangeError} `options.locale` must contain `localize` property
2083
+ * @throws {RangeError} `options.locale` must contain `formatLong` property
2084
+ * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
2085
+ * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
2086
+ * @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
2087
+ * @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
2088
+ * @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
2089
+ * @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
2090
+ * @throws {RangeError} format string contains an unescaped latin alphabet character
2091
+ *
2092
+ * @example
2093
+ * // Represent 11 February 2014 in middle-endian format:
2094
+ * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
2095
+ * //=> '02/11/2014'
2096
+ *
2097
+ * @example
2098
+ * // Represent 2 July 2014 in Esperanto:
2099
+ * import { eoLocale } from 'date-fns/locale/eo'
2100
+ * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
2101
+ * locale: eoLocale
2102
+ * })
2103
+ * //=> '2-a de julio 2014'
2104
+ *
2105
+ * @example
2106
+ * // Escape string by single quote characters:
2107
+ * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
2108
+ * //=> "3 o'clock"
2109
+ */
2110
+
2111
+ function format(dirtyDate, dirtyFormatStr, options) {
2112
+ 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;
2113
+ requiredArgs(2, arguments);
2114
+ var formatStr = String(dirtyFormatStr);
2115
+ var defaultOptions = getDefaultOptions();
2116
+ var locale$1 = (_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 : locale;
2117
+ 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);
2118
+
2119
+ // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
2120
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
2121
+ throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
2122
+ }
2123
+ 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);
2124
+
2125
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
2126
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
2127
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
2128
+ }
2129
+ if (!locale$1.localize) {
2130
+ throw new RangeError('locale must contain localize property');
2131
+ }
2132
+ if (!locale$1.formatLong) {
2133
+ throw new RangeError('locale must contain formatLong property');
2134
+ }
2135
+ var originalDate = toDate(dirtyDate);
2136
+ if (!isValid(originalDate)) {
2137
+ throw new RangeError('Invalid time value');
2138
+ }
2139
+
2140
+ // Convert the date in system timezone to the same date in UTC+00:00 timezone.
2141
+ // This ensures that when UTC functions will be implemented, locales will be compatible with them.
2142
+ // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
2143
+ var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
2144
+ var utcDate = subMilliseconds(originalDate, timezoneOffset);
2145
+ var formatterOptions = {
2146
+ firstWeekContainsDate: firstWeekContainsDate,
2147
+ weekStartsOn: weekStartsOn,
2148
+ locale: locale$1,
2149
+ _originalDate: originalDate
2150
+ };
2151
+ var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {
2152
+ var firstCharacter = substring[0];
2153
+ if (firstCharacter === 'p' || firstCharacter === 'P') {
2154
+ var longFormatter = longFormatters[firstCharacter];
2155
+ return longFormatter(substring, locale$1.formatLong);
2156
+ }
2157
+ return substring;
2158
+ }).join('').match(formattingTokensRegExp).map(function (substring) {
2159
+ // Replace two single quote characters with one single quote character
2160
+ if (substring === "''") {
2161
+ return "'";
2162
+ }
2163
+ var firstCharacter = substring[0];
2164
+ if (firstCharacter === "'") {
2165
+ return cleanEscapedString(substring);
2166
+ }
2167
+ var formatter = formatters[firstCharacter];
2168
+ if (formatter) {
2169
+ if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {
2170
+ throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
2171
+ }
2172
+ if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {
2173
+ throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
2174
+ }
2175
+ return formatter(utcDate, substring, locale$1.localize, formatterOptions);
2176
+ }
2177
+ if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
2178
+ throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');
2179
+ }
2180
+ return substring;
2181
+ }).join('');
2182
+ return result;
2183
+ }
2184
+ function cleanEscapedString(input) {
2185
+ var matched = input.match(escapedStringRegExp);
2186
+ if (!matched) {
2187
+ return input;
2188
+ }
2189
+ return matched[1].replace(doubleQuoteRegExp, "'");
2190
+ }
2191
+
2192
+ const DEFAULT_LANGUAGE = 'en';
2193
+ const SUPPORTED_LANGUAGES = ['ro', 'en'];
2194
+ const TRANSLATIONS = {
2195
+ en: {
2196
+ redeem: 'Redeem',
2197
+ expireOn: 'Expire on ',
2198
+ pointsToBeExpired: '${expirationPoints} points to expire in ${expireDay} days',
2199
+ pointsToBeExpiredDay: '${expirationPoints} points to expire in ${expireDay} day',
2200
+ pointsToBeExpiredHours: '${expirationPoints} points to expire in ${expireDay} hours',
2201
+ pointsToBeExpiredHour: '${expirationPoints} points to expire in ${expireDay} hour',
2202
+ tipsForNextLevel: 'Need ${pointsToReach} to reach ${levelName}',
2203
+ spendablePoints: 'Spendable Points:',
2204
+ details: 'Details',
2205
+ earningRules: 'Earning Rules',
2206
+ xp: 'XP',
2207
+ sp: 'Coins',
2208
+ termAndConditions: 'Term & Conditions',
2209
+ },
2210
+ 'zh-hk': {
2211
+ redeem: '兑奖',
2212
+ expireOn: 'Expire on ',
2213
+ pointsToBeExpired: '${expirationPoints} points to expire in ${expireDay} days',
2214
+ pointsToBeExpiredDay: '${expirationPoints} points to expire in ${expireDay} day',
2215
+ pointsToBeExpiredHours: '${expirationPoints} points to expire in ${expireDay} hours',
2216
+ pointsToBeExpiredHour: '${expirationPoints} points to expire in ${expireDay} hour',
2217
+ tipsForNextLevel: 'Need ${pointsToReach} to reach ${levelName}',
2218
+ spendablePoints: 'Spendable Points:',
2219
+ details: '明细',
2220
+ earningRules: 'Earning Rules',
2221
+ xp: 'XP',
2222
+ sp: 'Coins',
2223
+ termAndConditions: 'Term & Conditions',
2224
+ },
2225
+ de: {
2226
+ redeem: 'Redeem',
2227
+ expireOn: 'Expire on ',
2228
+ pointsToBeExpired: '${expirationPoints} points to expire in ${expireDay} days',
2229
+ pointsToBeExpiredDay: '${expirationPoints} points to expire in ${expireDay} day',
2230
+ pointsToBeExpiredHours: '${expirationPoints} points to expire in ${expireDay} hours',
2231
+ pointsToBeExpiredHour: '${expirationPoints} points to expire in ${expireDay} hour',
2232
+ tipsForNextLevel: 'Need ${pointsToReach} to reach ${levelName}',
2233
+ spendablePoints: 'Spendable Points:',
2234
+ details: 'Details',
2235
+ earningRules: 'Earning Rules',
2236
+ xp: 'XP',
2237
+ sp: 'Coins',
2238
+ termAndConditions: 'Term & Conditions',
2239
+ },
2240
+ it: {
2241
+ redeem: 'Redeem',
2242
+ expireOn: 'Expire on ',
2243
+ pointsToBeExpired: '${expirationPoints} points to expire in ${expireDay} days',
2244
+ pointsToBeExpiredDay: '${expirationPoints} points to expire in ${expireDay} day',
2245
+ pointsToBeExpiredHours: '${expirationPoints} points to expire in ${expireDay} hours',
2246
+ pointsToBeExpiredHour: '${expirationPoints} points to expire in ${expireDay} hour',
2247
+ tipsForNextLevel: 'Need ${pointsToReach} to reach ${levelName}',
2248
+ spendablePoints: 'Spendable Points:',
2249
+ details: 'Details',
2250
+ earningRules: 'Earning Rules',
2251
+ xp: 'XP',
2252
+ sp: 'Coins',
2253
+ termAndConditions: 'Term & Conditions',
2254
+ },
2255
+ fr: {
2256
+ redeem: 'Redeem',
2257
+ expireOn: 'Expire on ',
2258
+ pointsToBeExpired: '${expirationPoints} points to expire in ${expireDay} days',
2259
+ pointsToBeExpiredDay: '${expirationPoints} points to expire in ${expireDay} day',
2260
+ pointsToBeExpiredHours: '${expirationPoints} points to expire in ${expireDay} hours',
2261
+ pointsToBeExpiredHour: '${expirationPoints} points to expire in ${expireDay} hour',
2262
+ tipsForNextLevel: 'Need ${pointsToReach} to reach ${levelName}',
2263
+ spendablePoints: 'Spendable Points:',
2264
+ details: 'Details',
2265
+ earningRules: 'Earning Rules',
2266
+ xp: 'XP',
2267
+ sp: 'Coins',
2268
+ termAndConditions: 'Term & Conditions',
2269
+ },
2270
+ es: {
2271
+ redeem: 'Redeem'
2272
+ },
2273
+ tr: {
2274
+ redeem: 'Redeem'
2275
+ },
2276
+ ru: {
2277
+ redeem: 'Redeem'
2278
+ },
2279
+ ro: {
2280
+ redeem: 'Redeem'
2281
+ },
2282
+ hr: {
2283
+ redeem: 'Otkupiti',
2284
+ expireOn: 'Istječe',
2285
+ pointsToBeExpired: '${expirationPoints} bodova ističe za ${expireDay} dana',
2286
+ tipsForNextLevel: 'Trebate ${pointsToReach} da dosegnete razinu ${levelName}',
2287
+ spendablePoints: 'Bodovi za potrošit:',
2288
+ details: 'Detalji',
2289
+ xp: 'XP',
2290
+ },
2291
+ hu: {
2292
+ redeem: 'Redeem'
2293
+ },
2294
+ pl: {
2295
+ redeem: 'Redeem'
2296
+ },
2297
+ pt: {
2298
+ redeem: 'Redeem'
2299
+ },
2300
+ sl: {
2301
+ redeem: 'Redeem'
2302
+ },
2303
+ sr: {
2304
+ redeem: 'Redeem'
2305
+ }
2306
+ };
2307
+ const translate = (key, customLang) => {
2308
+ const lang = customLang;
2309
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
2310
+ };
2311
+ const translateWithParams = (key, params) => {
2312
+ const lang = params['lang'];
2313
+ let templateString = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
2314
+ if (!params) {
2315
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
2316
+ }
2317
+ Object.keys(params).forEach((paramName) => {
2318
+ templateString = templateString.replace(new RegExp('\\$\{' + paramName + '\}', 'gm'), params[paramName]);
2319
+ });
2320
+ return templateString;
2321
+ };
2322
+
2323
+ const LoyaltyProgress = `<svg width="100%" height="28" fill="none" xmlns="http://www.w3.org/2000/svg">
2324
+ <rect y="12" width="100%" id="total_level" height="5" rx="2.5" fill="white" fill-opacity="0.5"/>
2325
+ <rect y="12" id="current_level" width="64" height="5" rx="2.5" fill="white"/>
2326
+ <g filter="url(#filter_current_level)">
2327
+ <circle id="circle_current_level" cx="74.5" cy="14.5" r="6.5" fill="white"/>
2328
+ </g>
2329
+ <g filter="url(#filter_heart_ball)">
2330
+ <g filter="url(#filter_ball)">
2331
+ <circle cx="169" cy="14" r="10" id="lock" fill="url(#paint0_linear_ball)"/>
2332
+ </g>
2333
+ <g filter="url(#filter_heart)">
2334
+ <svg x="0" y="4" id="lock_box">
2335
+ <path d="M10.217 6.42442c-0.713,-0.574,-1.304,-1.083,-1.928,-1.622c-0.348,-0.299,-0.707,-0.611,-1.101,-0.943l-0.013,-0.01c0,0,-0.023,-0.017,-0.04,-0.027l-0.167,-0.095l-0.15,0.12c0,0,-0.015,0.012,-0.024,0.02c-0.391,0.33,-0.749,0.64,-1.094,0.939c-0.622,0.539,-1.211,1.048,-1.924,1.624c-1.816,1.463,-3.598,3.263,-3.033,5.506c0.404,1.601,2.104,2.905,3.789,2.905c0.211,0,0.423,-0.02,0.626,-0.061c0.286,-0.058,0.572,-0.145,0.864,-0.265c-0.079,0.962,-0.413,1.864,-0.881,2.369l-0.423,0.459h0.633c0.633,0,1.018,-0.007,1.356,-0.013c0.248,-0.004,0.462,-0.008,0.72,-0.008c0.335,0,0.709,0.006,1.215,0.021l0.686,0.02l-0.474,-0.483c-0.504,-0.514,-0.847,-1.403,-0.923,-2.385c0.311,0.132,0.616,0.227,0.916,0.287c0.204,0.039,0.411,0.059,0.623,0.059c1.687,0,3.386,-1.304,3.789,-2.909c0.56,-2.243,-1.224,-4.041,-3.042,-5.504v-0.004z" fill="#933CBF"/>
2336
+ <path d="M9.727,6.98459c-1.004,-0.83,-1.741,-1.515,-2.723,-2.365c-0.002,0,-0.004,-0.004,-0.007,-0.006c-0.002,0,-0.004,0.004,-0.006,0.006c-0.98,0.85,-1.715,1.537,-2.721,2.367c-1.455,1.202,-3.126,2.821,-2.638,4.81c0.37,1.511,2.091,2.751,3.665,2.43c0.389,-0.08,0.75,-0.224,1.094,-0.402c0,0.116,-0.004,0.233,-0.012,0.353c-0.064,0.991,-0.398,1.892,-0.86,2.401c1.481,0,1.481,-0.043,2.961,0c-0.481,-0.503,-0.834,-1.382,-0.9,-2.401c-0.008,-0.127,-0.012,-0.253,-0.012,-0.378c0.357,0.19,0.733,0.342,1.14,0.425c1.574,0.319,3.292,-0.922,3.661,-2.433c0.486,-1.992,-1.189,-3.609,-2.644,
2337
+ -4.809l0.002,0.002z" fill="url(#paint1_linear_lock)"/>
2338
+ <path d="M9.255,7.551c-0.844,-0.716,-1.462,-1.309,-2.286,-2.045c-0.002,0,-0.004,-0.004,-0.006,-0.006c0,0,-0.004,0.004,-0.006,0.006c-0.824,0.736,-1.44,1.329,-2.284,2.047c-0.919,0.782,-1.94,1.769,-2.214,2.943c-0.115,0.021,-0.914,0.044,-0.914,0.044l0.887,0.083c-0.039,0.206,-0.055,0.418,-0.041,0.638c0.087,-1.371,1.25,-2.507,2.282,-3.384c0.844,-0.718,1.462,-1.313,2.284,-2.047c0.002,-0.002,0.004,-0.004,0.006,-0.006c0.002,0,0.004,0.004,0.006,0.004c0.824,0.734,1.442,1.329,2.286,2.045c1.034,0.879,2.198,2.013,2.286,3.386c0.093,-1.517,-1.173,-2.761,-2.286,-3.708z" fill="#9040C9"/>
2339
+ </svg>
2340
+ </g>
2341
+ </g>
2342
+ <g filter="url(#filter_lock)">
2343
+ <svg x="100%" y="9" id="heart_box">
2344
+ <path d="M7,6c-0.19,-0.002,-0.377,0.052,-0.534,0.154c-0.158,0.103,-0.278,0.25,-0.346,0.42c-0.069,0.171,-0.081,0.357,-0.035,0.535c0.046,0.177,0.147,0.337,0.29,0.457v0.834c0,0.159,0.066,0.312,0.183,0.424c0.117,0.113,0.276,0.176,0.442,0.176c0.166,0,0.325,-0.063,0.442,-0.176c0.117,-0.112,0.183,-0.265,0.183,-0.424v-0.834c0.143,-0.12,0.244,-0.28,0.29,-0.457c0.046,-0.178,0.034,-0.364,-0.035,-0.535c-0.068,-0.17,-0.188,-0.317,-0.346,-0.42c-0.157,-0.102,-0.344,-0.156,-0.534,-0.154zm3.125,-2.4v-1.2c0,-0.796,-0.329,-1.559,-0.915,-2.121c-0.586,-0.563,-1.381,-0.879,-2.21,-0.879c-0.829,0,-1.624,0.316,-2.21,0.879c-0.586,0.562,-0.915,1.325,-0.915,2.121v1.2c-0.497,0,-0.974,0.19,-1.326,0.527c-0.351,0.338,-0.549,0.796,-0.549,1.273v4.2c0,0.477,0.198,0.935,0.549,1.273c0.352,0.337,0.829,0.527,1.326,0.527h6.25c0.497,0,0.974,-0.19,1.326,-0.527c0.351,-0.338,0.549,-0.796,0.549,-1.273v-4.2c0,-0.477,-0.198,-0.935,-0.549,-1.273c-0.352,-0.337,-0.829,-0.527,-1.326,-0.527zm-5,-1.2c0,-0.477,0.198,-0.935,0.549,-1.273c0.352,-0.337,0.829,-0.527,1.326,-0.527c0.497,0,0.974,0.19,1.326,0.527c0.351,0.338,0.549,0.796,0.549,1.273v1.2h-3.75v-1.2zm5.625,7.2c0,0.159,-0.066,0.312,-0.183,0.424c-0.117,0.113,-0.276,0.176,-0.442,0.176h-6.25c-0.166,0,-0.325,-0.063,-0.442,-0.176c-0.117,-0.112,-0.183,-0.265,-0.183,-0.424v-4.2c0,-0.159,0.066,-0.312,0.183,-0.424c0.117,-0.113,0.276,-0.176,0.442,-0.176h6.25c0.166,0,0.325,0.063,0.442,0.176c0.117,0.112,0.183,0.265,0.183,0.424v4.2z" fill="white"/>
2345
+ </svg>
2346
+ </g>
2347
+ <defs>
2348
+ <filter id="filter_current_level" x="64" y="4" width="21" height="21" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
2349
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
2350
+ <feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
2351
+ <feGaussianBlur stdDeviation="2" result="effect1_foregroundBlur_305_23"/>
2352
+ </filter>
2353
+ <filter id="filter_heart_ball" x="155" y="0" width="28" height="28" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
2354
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
2355
+ <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
2356
+ <feOffset/>
2357
+ <feGaussianBlur stdDeviation="2"/>
2358
+ <feComposite in2="hardAlpha" operator="out"/>
2359
+ <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
2360
+ <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_305_23"/>
2361
+ <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_305_23" result="shape"/>
2362
+ </filter>
2363
+ <filter id="filter_ball" x="159" y="4" width="20" height="21" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
2364
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
2365
+ <feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
2366
+ <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
2367
+ <feOffset dy="1"/>
2368
+ <feGaussianBlur stdDeviation="1"/>
2369
+ <feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
2370
+ <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.55 0"/>
2371
+ <feBlend mode="normal" in2="shape" result="effect1_innerShadow_305_23"/>
2372
+ </filter>
2373
+ <filter id="filter_heart" x="161.636" y="5.72727" width="14.7271" height="15.6364" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
2374
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
2375
+ <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
2376
+ <feOffset/>
2377
+ <feGaussianBlur stdDeviation="0.5"/>
2378
+ <feComposite in2="hardAlpha" operator="out"/>
2379
+ <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
2380
+ <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_305_23"/>
2381
+ <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_305_23" result="shape"/>
2382
+ </filter>
2383
+ <filter id="filter_lock" x="50" y="7" width="12" height="14" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
2384
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
2385
+ <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
2386
+ <feOffset/>
2387
+ <feGaussianBlur stdDeviation="0.5"/>
2388
+ <feComposite in2="hardAlpha" operator="out"/>
2389
+ <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
2390
+ <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_305_23"/>
2391
+ <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_305_23" result="shape"/>
2392
+ </filter>
2393
+ <linearGradient id="paint0_linear_ball" x1="163" y1="6" x2="174.2" y2="22.6" gradientUnits="userSpaceOnUse">
2394
+ <stop stop-color="#946AD7"/>
2395
+ <stop offset="1" stop-color="#EFABEB"/>
2396
+ </linearGradient>
2397
+ <linearGradient id="paint1_linear_lock" x1="100%" y1="18.4056" x2="169.002" y2="10.2845" gradientUnits="userSpaceOnUse">
2398
+ <stop stop-color="#814FD6"/>
2399
+ <stop offset="1" stop-color="#D679D8"/>
2400
+ </linearGradient>
2401
+ </defs>
2402
+ </svg>
2403
+ `;
2404
+
2405
+ const TipsInfo = `<svg width="126" height="92" viewBox="0 0 126 92" fill="none" xmlns="http://www.w3.org/2000/svg">
2406
+ <g filter="url(#filter0_d_242_4231)">
2407
+ <rect x="24" y="20" width="78" height="36" rx="4" fill="white"/>
2408
+ <path d="M24 24C24 21.7909 25.7909 20 28 20H64V56H28C25.7909 56 24 54.2091 24 52V24Z" fill="#464646"/>
2409
+ <path d="M51 56H37L43.2474 63.1399C43.6458 63.5952 44.3542 63.5952 44.7526 63.1399L51 56Z" fill="#464646"/>
2410
+ <circle cx="44" cy="38" r="7" fill="white"/>
2411
+ <path d="M43.9405 34C44.5456 34 45.0362 34.4906 45.0362 35.0957C45.0362 35.7009 44.5456 36.1915 43.9405 36.1915C43.3353 36.1915 42.8447 35.7009 42.8447 35.0957C42.8447 34.4906 43.3353 34 43.9405 34Z" fill="#464646"/>
2412
+ <path d="M45.8801 41.3737C45.8801 41.7617 45.5626 42.0791 45.1746 42.0791H44.3233H43.551H42.7055C42.3175 42.0791 42 41.7617 42 41.3737V41.3575C42 40.9695 42.3175 40.6521 42.7055 40.6521H42.8455V37.8714H42.3528C42.1588 37.8714 42 37.7127 42 37.5187V37.4936C42 37.2996 42.1588 37.1409 42.3528 37.1409H43.551H44.031H44.3233C44.7113 37.1409 45.0287 37.4583 45.0287 37.8463V40.6521H45.1746C45.5626 40.6521 45.8801 40.9696 45.8801 41.3576V41.3737Z" fill="#464646"/>
2413
+ </g>
2414
+ <defs>
2415
+ <filter id="filter0_d_242_4231" x="0" y="0" width="126" height="91.4814" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
2416
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
2417
+ <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
2418
+ <feOffset dy="4"/>
2419
+ <feGaussianBlur stdDeviation="12"/>
2420
+ <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
2421
+ <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_242_4231"/>
2422
+ <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_242_4231" result="shape"/>
2423
+ </filter>
2424
+ </defs>
2425
+ </svg>
2426
+ `;
2427
+
2428
+ const PlayerLoyaltyProcess = () => (index.h("span", { class: "LevelProgress", id: 'LevelProgress', innerHTML: LoyaltyProgress }));
2429
+ const PlayerPoints = ({ loyaltyPoints, spendablePoints, pointExpireString, language, }) => (index.h("div", { class: "PointsInfo" },
2430
+ loyaltyPoints &&
2431
+ index.h("div", { class: 'Points' },
2432
+ loyaltyPoints,
2433
+ " ",
2434
+ index.h("sub", { class: "XP" }, translate('xp', language))),
2435
+ spendablePoints &&
2436
+ index.h("div", { class: 'Points' },
2437
+ spendablePoints,
2438
+ " ",
2439
+ index.h("sub", { class: "XP" }, translate('sp', language))),
2440
+ pointExpireString && (index.h("div", { class: 'ExpirationPoints' },
2441
+ pointExpireString,
2442
+ " "))));
2443
+ const PlayerElevateCardRedeem = ({ language, onRedeemClick }) => (index.h("div", { class: "CardCell Redeem" },
2444
+ index.h("div", { class: "RedeemButton", onClick: () => {
2445
+ onRedeemClick();
2446
+ } },
2447
+ index.h("span", null, translate('redeem', language)))));
2448
+ const PlayerNameDiv = (props) => (index.h("div", { class: 'CardCell PlayerName Txt' }, props.playerName));
2449
+ const PlayerElevateLoyaltyLevel = (props) => (index.h("div", { class: 'CardCell ElevateLevel' },
2450
+ index.h("span", { class: "LevelName", title: props.level }, props.level),
2451
+ props.expireTime && (index.h("div", { class: "CardCell ExpirationDate Txt" },
2452
+ translate('expireOn', props.language),
2453
+ index.h("span", { class: "ExpireTime" }, format(new Date(props.expireTime), props.dateFormat || 'yyyy-MM-dd')),
2454
+ !props.hideInfo && (index.h("span", { class: "fa Info", style: { 'background': `url(${index.getAssetPath('../static/info.svg')})` } },
2455
+ index.h("span", { class: "InfoTips", innerHTML: TipsInfo })))))));
2456
+ const PlayerAvatar = (props) => {
2457
+ const badge = props.loyaltyIconUrl
2458
+ ? index.h("img", { class: "Badge", src: props.loyaltyIconUrl })
2459
+ : props.hideIfNull ? '' : index.h("div", { class: "Badge" });
2460
+ const avatarSrc = props.playerAvatarUrl || index.getAssetPath('../static/user.svg');
2461
+ return index.h("div", { class: "PlayerAvatar", style: { 'position': `${props.onlyBadge ? '' : 'relative'}` } },
2462
+ !props.onlyBadge && index.h("img", { class: "Avatar", src: avatarSrc }),
2463
+ badge);
2464
+ };
2465
+
2466
+ exports.PlayerAvatar = PlayerAvatar;
2467
+ exports.PlayerElevateCardRedeem = PlayerElevateCardRedeem;
2468
+ exports.PlayerElevateLoyaltyLevel = PlayerElevateLoyaltyLevel;
2469
+ exports.PlayerLoyaltyProcess = PlayerLoyaltyProcess;
2470
+ exports.PlayerNameDiv = PlayerNameDiv;
2471
+ exports.PlayerPoints = PlayerPoints;
2472
+ exports.TRANSLATIONS = TRANSLATIONS;
2473
+ exports.getTimezoneOffsetInMilliseconds = getTimezoneOffsetInMilliseconds;
2474
+ exports.requiredArgs = requiredArgs;
2475
+ exports.toDate = toDate;
2476
+ exports.translate = translate;
2477
+ exports.translateWithParams = translateWithParams;