@everymatrix/player-elevate-card 1.0.69

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