@everymatrix/lottery-tipping-ticket-buy 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/app-tooltip_11.cjs.entry.js +3998 -0
  3. package/dist/cjs/index-8a0b513b.js +1364 -0
  4. package/dist/cjs/index.cjs.js +10 -0
  5. package/dist/cjs/loader.cjs.js +15 -0
  6. package/dist/cjs/lottery-tipping-ticket-buy-164a217a.js +7953 -0
  7. package/dist/cjs/lottery-tipping-ticket-buy.cjs.js +25 -0
  8. package/dist/collection/collection-manifest.json +63 -0
  9. package/dist/collection/components/lottery-segmented/lottery-segmented.css +52 -0
  10. package/dist/collection/components/lottery-segmented/lottery-segmented.js +151 -0
  11. package/dist/collection/components/lottery-tipping-ticket-buy/index.js +1 -0
  12. package/dist/collection/components/lottery-tipping-ticket-buy/lottery-tipping-ticket-buy.css +122 -0
  13. package/dist/collection/components/lottery-tipping-ticket-buy/lottery-tipping-ticket-buy.js +806 -0
  14. package/dist/collection/index.js +1 -0
  15. package/dist/collection/model/type.js +6 -0
  16. package/dist/collection/utils/api.js +72 -0
  17. package/dist/collection/utils/locale.utils.js +118 -0
  18. package/dist/collection/utils/utils.js +114 -0
  19. package/dist/esm/app-globals-0f993ce5.js +3 -0
  20. package/dist/esm/app-tooltip_11.entry.js +3985 -0
  21. package/dist/esm/index-c24f96b9.js +1335 -0
  22. package/dist/esm/index.js +2 -0
  23. package/dist/esm/loader.js +11 -0
  24. package/dist/esm/lottery-tipping-ticket-buy-04819204.js +7941 -0
  25. package/dist/esm/lottery-tipping-ticket-buy.js +20 -0
  26. package/dist/index.cjs.js +1 -0
  27. package/dist/index.js +1 -0
  28. package/dist/lottery-tipping-ticket-buy/app-globals-0f993ce5.js +1 -0
  29. package/dist/lottery-tipping-ticket-buy/app-tooltip_11.entry.js +1 -0
  30. package/dist/lottery-tipping-ticket-buy/index-c24f96b9.js +2 -0
  31. package/dist/lottery-tipping-ticket-buy/index.esm.js +1 -0
  32. package/dist/lottery-tipping-ticket-buy/lottery-tipping-ticket-buy-04819204.js +6657 -0
  33. package/dist/lottery-tipping-ticket-buy/lottery-tipping-ticket-buy.esm.js +1 -0
  34. package/dist/static/poolGameLogo.webp +0 -0
  35. package/dist/stencil.config.dev.js +19 -0
  36. package/dist/stencil.config.js +19 -0
  37. package/dist/storybook/main.js +43 -0
  38. package/dist/storybook/preview.js +9 -0
  39. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
  40. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/packages/stencil/lottery-tipping-ticket-buy/stencil.config.d.ts +2 -0
  41. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/packages/stencil/lottery-tipping-ticket-buy/stencil.config.dev.d.ts +2 -0
  42. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/packages/stencil/lottery-tipping-ticket-buy/storybook/main.d.ts +3 -0
  43. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/packages/stencil/lottery-tipping-ticket-buy/storybook/preview.d.ts +70 -0
  44. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/tools/plugins/index.d.ts +4 -0
  45. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
  46. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
  47. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
  48. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
  49. package/dist/types/components/lottery-segmented/lottery-segmented.d.ts +34 -0
  50. package/dist/types/components/lottery-tipping-ticket-buy/index.d.ts +1 -0
  51. package/dist/types/components/lottery-tipping-ticket-buy/lottery-tipping-ticket-buy.d.ts +165 -0
  52. package/dist/types/components.d.ts +228 -0
  53. package/dist/types/index.d.ts +1 -0
  54. package/dist/types/model/type.d.ts +203 -0
  55. package/dist/types/stencil-public-runtime.d.ts +1674 -0
  56. package/dist/types/utils/api.d.ts +9 -0
  57. package/dist/types/utils/locale.utils.d.ts +3 -0
  58. package/dist/types/utils/utils.d.ts +13 -0
  59. package/loader/cdn.js +1 -0
  60. package/loader/index.cjs.js +1 -0
  61. package/loader/index.d.ts +24 -0
  62. package/loader/index.es2017.js +1 -0
  63. package/loader/index.js +2 -0
  64. package/loader/package.json +11 -0
  65. package/package.json +27 -0
@@ -0,0 +1,3998 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-8a0b513b.js');
6
+ const lotteryTippingTicketBuy = require('./lottery-tipping-ticket-buy-164a217a.js');
7
+
8
+ /**
9
+ * @name addMilliseconds
10
+ * @category Millisecond Helpers
11
+ * @summary Add the specified number of milliseconds to the given date.
12
+ *
13
+ * @description
14
+ * Add the specified number of milliseconds to the given date.
15
+ *
16
+ * @param {Date|Number} date - the date to be changed
17
+ * @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`.
18
+ * @returns {Date} the new date with the milliseconds added
19
+ * @throws {TypeError} 2 arguments required
20
+ *
21
+ * @example
22
+ * // Add 750 milliseconds to 10 July 2014 12:45:30.000:
23
+ * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
24
+ * //=> Thu Jul 10 2014 12:45:30.750
25
+ */
26
+ function addMilliseconds(dirtyDate, dirtyAmount) {
27
+ lotteryTippingTicketBuy.requiredArgs(2, arguments);
28
+ var timestamp = lotteryTippingTicketBuy.toDate(dirtyDate).getTime();
29
+ var amount = lotteryTippingTicketBuy.toInteger(dirtyAmount);
30
+ return new Date(timestamp + amount);
31
+ }
32
+
33
+ var defaultOptions = {};
34
+ function getDefaultOptions() {
35
+ return defaultOptions;
36
+ }
37
+
38
+ /**
39
+ * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
40
+ * They usually appear for dates that denote time before the timezones were introduced
41
+ * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
42
+ * and GMT+01:00:00 after that date)
43
+ *
44
+ * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
45
+ * which would lead to incorrect calculations.
46
+ *
47
+ * This function returns the timezone offset in milliseconds that takes seconds in account.
48
+ */
49
+ function getTimezoneOffsetInMilliseconds(date) {
50
+ var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
51
+ utcDate.setUTCFullYear(date.getFullYear());
52
+ return date.getTime() - utcDate.getTime();
53
+ }
54
+
55
+ /**
56
+ * @name isDate
57
+ * @category Common Helpers
58
+ * @summary Is the given value a date?
59
+ *
60
+ * @description
61
+ * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
62
+ *
63
+ * @param {*} value - the value to check
64
+ * @returns {boolean} true if the given value is a date
65
+ * @throws {TypeError} 1 arguments required
66
+ *
67
+ * @example
68
+ * // For a valid date:
69
+ * const result = isDate(new Date())
70
+ * //=> true
71
+ *
72
+ * @example
73
+ * // For an invalid date:
74
+ * const result = isDate(new Date(NaN))
75
+ * //=> true
76
+ *
77
+ * @example
78
+ * // For some value:
79
+ * const result = isDate('2014-02-31')
80
+ * //=> false
81
+ *
82
+ * @example
83
+ * // For an object:
84
+ * const result = isDate({})
85
+ * //=> false
86
+ */
87
+ function isDate(value) {
88
+ lotteryTippingTicketBuy.requiredArgs(1, arguments);
89
+ return value instanceof Date || lotteryTippingTicketBuy._typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
90
+ }
91
+
92
+ /**
93
+ * @name isValid
94
+ * @category Common Helpers
95
+ * @summary Is the given date valid?
96
+ *
97
+ * @description
98
+ * Returns false if argument is Invalid Date and true otherwise.
99
+ * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
100
+ * Invalid Date is a Date, whose time value is NaN.
101
+ *
102
+ * Time value of Date: http://es5.github.io/#x15.9.1.1
103
+ *
104
+ * @param {*} date - the date to check
105
+ * @returns {Boolean} the date is valid
106
+ * @throws {TypeError} 1 argument required
107
+ *
108
+ * @example
109
+ * // For the valid date:
110
+ * const result = isValid(new Date(2014, 1, 31))
111
+ * //=> true
112
+ *
113
+ * @example
114
+ * // For the value, convertable into a date:
115
+ * const result = isValid(1393804800000)
116
+ * //=> true
117
+ *
118
+ * @example
119
+ * // For the invalid date:
120
+ * const result = isValid(new Date(''))
121
+ * //=> false
122
+ */
123
+ function isValid(dirtyDate) {
124
+ lotteryTippingTicketBuy.requiredArgs(1, arguments);
125
+ if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
126
+ return false;
127
+ }
128
+ var date = lotteryTippingTicketBuy.toDate(dirtyDate);
129
+ return !isNaN(Number(date));
130
+ }
131
+
132
+ /**
133
+ * @name subMilliseconds
134
+ * @category Millisecond Helpers
135
+ * @summary Subtract the specified number of milliseconds from the given date.
136
+ *
137
+ * @description
138
+ * Subtract the specified number of milliseconds from the given date.
139
+ *
140
+ * @param {Date|Number} date - the date to be changed
141
+ * @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`.
142
+ * @returns {Date} the new date with the milliseconds subtracted
143
+ * @throws {TypeError} 2 arguments required
144
+ *
145
+ * @example
146
+ * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
147
+ * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
148
+ * //=> Thu Jul 10 2014 12:45:29.250
149
+ */
150
+ function subMilliseconds(dirtyDate, dirtyAmount) {
151
+ lotteryTippingTicketBuy.requiredArgs(2, arguments);
152
+ var amount = lotteryTippingTicketBuy.toInteger(dirtyAmount);
153
+ return addMilliseconds(dirtyDate, -amount);
154
+ }
155
+
156
+ var MILLISECONDS_IN_DAY = 86400000;
157
+ function getUTCDayOfYear(dirtyDate) {
158
+ lotteryTippingTicketBuy.requiredArgs(1, arguments);
159
+ var date = lotteryTippingTicketBuy.toDate(dirtyDate);
160
+ var timestamp = date.getTime();
161
+ date.setUTCMonth(0, 1);
162
+ date.setUTCHours(0, 0, 0, 0);
163
+ var startOfYearTimestamp = date.getTime();
164
+ var difference = timestamp - startOfYearTimestamp;
165
+ return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
166
+ }
167
+
168
+ function startOfUTCISOWeek(dirtyDate) {
169
+ lotteryTippingTicketBuy.requiredArgs(1, arguments);
170
+ var weekStartsOn = 1;
171
+ var date = lotteryTippingTicketBuy.toDate(dirtyDate);
172
+ var day = date.getUTCDay();
173
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
174
+ date.setUTCDate(date.getUTCDate() - diff);
175
+ date.setUTCHours(0, 0, 0, 0);
176
+ return date;
177
+ }
178
+
179
+ function getUTCISOWeekYear(dirtyDate) {
180
+ lotteryTippingTicketBuy.requiredArgs(1, arguments);
181
+ var date = lotteryTippingTicketBuy.toDate(dirtyDate);
182
+ var year = date.getUTCFullYear();
183
+ var fourthOfJanuaryOfNextYear = new Date(0);
184
+ fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
185
+ fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
186
+ var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
187
+ var fourthOfJanuaryOfThisYear = new Date(0);
188
+ fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
189
+ fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
190
+ var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);
191
+ if (date.getTime() >= startOfNextYear.getTime()) {
192
+ return year + 1;
193
+ } else if (date.getTime() >= startOfThisYear.getTime()) {
194
+ return year;
195
+ } else {
196
+ return year - 1;
197
+ }
198
+ }
199
+
200
+ function startOfUTCISOWeekYear(dirtyDate) {
201
+ lotteryTippingTicketBuy.requiredArgs(1, arguments);
202
+ var year = getUTCISOWeekYear(dirtyDate);
203
+ var fourthOfJanuary = new Date(0);
204
+ fourthOfJanuary.setUTCFullYear(year, 0, 4);
205
+ fourthOfJanuary.setUTCHours(0, 0, 0, 0);
206
+ var date = startOfUTCISOWeek(fourthOfJanuary);
207
+ return date;
208
+ }
209
+
210
+ var MILLISECONDS_IN_WEEK$1 = 604800000;
211
+ function getUTCISOWeek(dirtyDate) {
212
+ lotteryTippingTicketBuy.requiredArgs(1, arguments);
213
+ var date = lotteryTippingTicketBuy.toDate(dirtyDate);
214
+ var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime();
215
+
216
+ // Round the number of days to the nearest integer
217
+ // because the number of milliseconds in a week is not constant
218
+ // (e.g. it's different in the week of the daylight saving time clock shift)
219
+ return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;
220
+ }
221
+
222
+ function startOfUTCWeek(dirtyDate, options) {
223
+ var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
224
+ lotteryTippingTicketBuy.requiredArgs(1, arguments);
225
+ var defaultOptions = getDefaultOptions();
226
+ var weekStartsOn = lotteryTippingTicketBuy.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);
227
+
228
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
229
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
230
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
231
+ }
232
+ var date = lotteryTippingTicketBuy.toDate(dirtyDate);
233
+ var day = date.getUTCDay();
234
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
235
+ date.setUTCDate(date.getUTCDate() - diff);
236
+ date.setUTCHours(0, 0, 0, 0);
237
+ return date;
238
+ }
239
+
240
+ function getUTCWeekYear(dirtyDate, options) {
241
+ var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
242
+ lotteryTippingTicketBuy.requiredArgs(1, arguments);
243
+ var date = lotteryTippingTicketBuy.toDate(dirtyDate);
244
+ var year = date.getUTCFullYear();
245
+ var defaultOptions = getDefaultOptions();
246
+ var firstWeekContainsDate = lotteryTippingTicketBuy.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);
247
+
248
+ // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
249
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
250
+ throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
251
+ }
252
+ var firstWeekOfNextYear = new Date(0);
253
+ firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
254
+ firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
255
+ var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);
256
+ var firstWeekOfThisYear = new Date(0);
257
+ firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
258
+ firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
259
+ var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);
260
+ if (date.getTime() >= startOfNextYear.getTime()) {
261
+ return year + 1;
262
+ } else if (date.getTime() >= startOfThisYear.getTime()) {
263
+ return year;
264
+ } else {
265
+ return year - 1;
266
+ }
267
+ }
268
+
269
+ function startOfUTCWeekYear(dirtyDate, options) {
270
+ var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
271
+ lotteryTippingTicketBuy.requiredArgs(1, arguments);
272
+ var defaultOptions = getDefaultOptions();
273
+ var firstWeekContainsDate = lotteryTippingTicketBuy.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);
274
+ var year = getUTCWeekYear(dirtyDate, options);
275
+ var firstWeek = new Date(0);
276
+ firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
277
+ firstWeek.setUTCHours(0, 0, 0, 0);
278
+ var date = startOfUTCWeek(firstWeek, options);
279
+ return date;
280
+ }
281
+
282
+ var MILLISECONDS_IN_WEEK = 604800000;
283
+ function getUTCWeek(dirtyDate, options) {
284
+ lotteryTippingTicketBuy.requiredArgs(1, arguments);
285
+ var date = lotteryTippingTicketBuy.toDate(dirtyDate);
286
+ var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime();
287
+
288
+ // Round the number of days to the nearest integer
289
+ // because the number of milliseconds in a week is not constant
290
+ // (e.g. it's different in the week of the daylight saving time clock shift)
291
+ return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
292
+ }
293
+
294
+ function addLeadingZeros(number, targetLength) {
295
+ var sign = number < 0 ? '-' : '';
296
+ var output = Math.abs(number).toString();
297
+ while (output.length < targetLength) {
298
+ output = '0' + output;
299
+ }
300
+ return sign + output;
301
+ }
302
+
303
+ /*
304
+ * | | Unit | | Unit |
305
+ * |-----|--------------------------------|-----|--------------------------------|
306
+ * | a | AM, PM | A* | |
307
+ * | d | Day of month | D | |
308
+ * | h | Hour [1-12] | H | Hour [0-23] |
309
+ * | m | Minute | M | Month |
310
+ * | s | Second | S | Fraction of second |
311
+ * | y | Year (abs) | Y | |
312
+ *
313
+ * Letters marked by * are not implemented but reserved by Unicode standard.
314
+ */
315
+ var formatters$2 = {
316
+ // Year
317
+ y: function y(date, token) {
318
+ // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
319
+ // | Year | y | yy | yyy | yyyy | yyyyy |
320
+ // |----------|-------|----|-------|-------|-------|
321
+ // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
322
+ // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
323
+ // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
324
+ // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
325
+ // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
326
+
327
+ var signedYear = date.getUTCFullYear();
328
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
329
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
330
+ return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
331
+ },
332
+ // Month
333
+ M: function M(date, token) {
334
+ var month = date.getUTCMonth();
335
+ return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
336
+ },
337
+ // Day of the month
338
+ d: function d(date, token) {
339
+ return addLeadingZeros(date.getUTCDate(), token.length);
340
+ },
341
+ // AM or PM
342
+ a: function a(date, token) {
343
+ var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
344
+ switch (token) {
345
+ case 'a':
346
+ case 'aa':
347
+ return dayPeriodEnumValue.toUpperCase();
348
+ case 'aaa':
349
+ return dayPeriodEnumValue;
350
+ case 'aaaaa':
351
+ return dayPeriodEnumValue[0];
352
+ case 'aaaa':
353
+ default:
354
+ return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
355
+ }
356
+ },
357
+ // Hour [1-12]
358
+ h: function h(date, token) {
359
+ return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
360
+ },
361
+ // Hour [0-23]
362
+ H: function H(date, token) {
363
+ return addLeadingZeros(date.getUTCHours(), token.length);
364
+ },
365
+ // Minute
366
+ m: function m(date, token) {
367
+ return addLeadingZeros(date.getUTCMinutes(), token.length);
368
+ },
369
+ // Second
370
+ s: function s(date, token) {
371
+ return addLeadingZeros(date.getUTCSeconds(), token.length);
372
+ },
373
+ // Fraction of second
374
+ S: function S(date, token) {
375
+ var numberOfDigits = token.length;
376
+ var milliseconds = date.getUTCMilliseconds();
377
+ var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
378
+ return addLeadingZeros(fractionalSeconds, token.length);
379
+ }
380
+ };
381
+ const formatters$3 = formatters$2;
382
+
383
+ var dayPeriodEnum = {
384
+ am: 'am',
385
+ pm: 'pm',
386
+ midnight: 'midnight',
387
+ noon: 'noon',
388
+ morning: 'morning',
389
+ afternoon: 'afternoon',
390
+ evening: 'evening',
391
+ night: 'night'
392
+ };
393
+ /*
394
+ * | | Unit | | Unit |
395
+ * |-----|--------------------------------|-----|--------------------------------|
396
+ * | a | AM, PM | A* | Milliseconds in day |
397
+ * | b | AM, PM, noon, midnight | B | Flexible day period |
398
+ * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
399
+ * | d | Day of month | D | Day of year |
400
+ * | e | Local day of week | E | Day of week |
401
+ * | f | | F* | Day of week in month |
402
+ * | g* | Modified Julian day | G | Era |
403
+ * | h | Hour [1-12] | H | Hour [0-23] |
404
+ * | i! | ISO day of week | I! | ISO week of year |
405
+ * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
406
+ * | k | Hour [1-24] | K | Hour [0-11] |
407
+ * | l* | (deprecated) | L | Stand-alone month |
408
+ * | m | Minute | M | Month |
409
+ * | n | | N | |
410
+ * | o! | Ordinal number modifier | O | Timezone (GMT) |
411
+ * | p! | Long localized time | P! | Long localized date |
412
+ * | q | Stand-alone quarter | Q | Quarter |
413
+ * | r* | Related Gregorian year | R! | ISO week-numbering year |
414
+ * | s | Second | S | Fraction of second |
415
+ * | t! | Seconds timestamp | T! | Milliseconds timestamp |
416
+ * | u | Extended year | U* | Cyclic year |
417
+ * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
418
+ * | w | Local week of year | W* | Week of month |
419
+ * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
420
+ * | y | Year (abs) | Y | Local week-numbering year |
421
+ * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
422
+ *
423
+ * Letters marked by * are not implemented but reserved by Unicode standard.
424
+ *
425
+ * Letters marked by ! are non-standard, but implemented by date-fns:
426
+ * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
427
+ * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
428
+ * i.e. 7 for Sunday, 1 for Monday, etc.
429
+ * - `I` is ISO week of year, as opposed to `w` which is local week of year.
430
+ * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
431
+ * `R` is supposed to be used in conjunction with `I` and `i`
432
+ * for universal ISO week-numbering date, whereas
433
+ * `Y` is supposed to be used in conjunction with `w` and `e`
434
+ * for week-numbering date specific to the locale.
435
+ * - `P` is long localized date format
436
+ * - `p` is long localized time format
437
+ */
438
+
439
+ var formatters = {
440
+ // Era
441
+ G: function G(date, token, localize) {
442
+ var era = date.getUTCFullYear() > 0 ? 1 : 0;
443
+ switch (token) {
444
+ // AD, BC
445
+ case 'G':
446
+ case 'GG':
447
+ case 'GGG':
448
+ return localize.era(era, {
449
+ width: 'abbreviated'
450
+ });
451
+ // A, B
452
+ case 'GGGGG':
453
+ return localize.era(era, {
454
+ width: 'narrow'
455
+ });
456
+ // Anno Domini, Before Christ
457
+ case 'GGGG':
458
+ default:
459
+ return localize.era(era, {
460
+ width: 'wide'
461
+ });
462
+ }
463
+ },
464
+ // Year
465
+ y: function y(date, token, localize) {
466
+ // Ordinal number
467
+ if (token === 'yo') {
468
+ var signedYear = date.getUTCFullYear();
469
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
470
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
471
+ return localize.ordinalNumber(year, {
472
+ unit: 'year'
473
+ });
474
+ }
475
+ return formatters$3.y(date, token);
476
+ },
477
+ // Local week-numbering year
478
+ Y: function Y(date, token, localize, options) {
479
+ var signedWeekYear = getUTCWeekYear(date, options);
480
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
481
+ var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
482
+
483
+ // Two digit year
484
+ if (token === 'YY') {
485
+ var twoDigitYear = weekYear % 100;
486
+ return addLeadingZeros(twoDigitYear, 2);
487
+ }
488
+
489
+ // Ordinal number
490
+ if (token === 'Yo') {
491
+ return localize.ordinalNumber(weekYear, {
492
+ unit: 'year'
493
+ });
494
+ }
495
+
496
+ // Padding
497
+ return addLeadingZeros(weekYear, token.length);
498
+ },
499
+ // ISO week-numbering year
500
+ R: function R(date, token) {
501
+ var isoWeekYear = getUTCISOWeekYear(date);
502
+
503
+ // Padding
504
+ return addLeadingZeros(isoWeekYear, token.length);
505
+ },
506
+ // Extended year. This is a single number designating the year of this calendar system.
507
+ // The main difference between `y` and `u` localizers are B.C. years:
508
+ // | Year | `y` | `u` |
509
+ // |------|-----|-----|
510
+ // | AC 1 | 1 | 1 |
511
+ // | BC 1 | 1 | 0 |
512
+ // | BC 2 | 2 | -1 |
513
+ // Also `yy` always returns the last two digits of a year,
514
+ // while `uu` pads single digit years to 2 characters and returns other years unchanged.
515
+ u: function u(date, token) {
516
+ var year = date.getUTCFullYear();
517
+ return addLeadingZeros(year, token.length);
518
+ },
519
+ // Quarter
520
+ Q: function Q(date, token, localize) {
521
+ var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
522
+ switch (token) {
523
+ // 1, 2, 3, 4
524
+ case 'Q':
525
+ return String(quarter);
526
+ // 01, 02, 03, 04
527
+ case 'QQ':
528
+ return addLeadingZeros(quarter, 2);
529
+ // 1st, 2nd, 3rd, 4th
530
+ case 'Qo':
531
+ return localize.ordinalNumber(quarter, {
532
+ unit: 'quarter'
533
+ });
534
+ // Q1, Q2, Q3, Q4
535
+ case 'QQQ':
536
+ return localize.quarter(quarter, {
537
+ width: 'abbreviated',
538
+ context: 'formatting'
539
+ });
540
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
541
+ case 'QQQQQ':
542
+ return localize.quarter(quarter, {
543
+ width: 'narrow',
544
+ context: 'formatting'
545
+ });
546
+ // 1st quarter, 2nd quarter, ...
547
+ case 'QQQQ':
548
+ default:
549
+ return localize.quarter(quarter, {
550
+ width: 'wide',
551
+ context: 'formatting'
552
+ });
553
+ }
554
+ },
555
+ // Stand-alone quarter
556
+ q: function q(date, token, localize) {
557
+ var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
558
+ switch (token) {
559
+ // 1, 2, 3, 4
560
+ case 'q':
561
+ return String(quarter);
562
+ // 01, 02, 03, 04
563
+ case 'qq':
564
+ return addLeadingZeros(quarter, 2);
565
+ // 1st, 2nd, 3rd, 4th
566
+ case 'qo':
567
+ return localize.ordinalNumber(quarter, {
568
+ unit: 'quarter'
569
+ });
570
+ // Q1, Q2, Q3, Q4
571
+ case 'qqq':
572
+ return localize.quarter(quarter, {
573
+ width: 'abbreviated',
574
+ context: 'standalone'
575
+ });
576
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
577
+ case 'qqqqq':
578
+ return localize.quarter(quarter, {
579
+ width: 'narrow',
580
+ context: 'standalone'
581
+ });
582
+ // 1st quarter, 2nd quarter, ...
583
+ case 'qqqq':
584
+ default:
585
+ return localize.quarter(quarter, {
586
+ width: 'wide',
587
+ context: 'standalone'
588
+ });
589
+ }
590
+ },
591
+ // Month
592
+ M: function M(date, token, localize) {
593
+ var month = date.getUTCMonth();
594
+ switch (token) {
595
+ case 'M':
596
+ case 'MM':
597
+ return formatters$3.M(date, token);
598
+ // 1st, 2nd, ..., 12th
599
+ case 'Mo':
600
+ return localize.ordinalNumber(month + 1, {
601
+ unit: 'month'
602
+ });
603
+ // Jan, Feb, ..., Dec
604
+ case 'MMM':
605
+ return localize.month(month, {
606
+ width: 'abbreviated',
607
+ context: 'formatting'
608
+ });
609
+ // J, F, ..., D
610
+ case 'MMMMM':
611
+ return localize.month(month, {
612
+ width: 'narrow',
613
+ context: 'formatting'
614
+ });
615
+ // January, February, ..., December
616
+ case 'MMMM':
617
+ default:
618
+ return localize.month(month, {
619
+ width: 'wide',
620
+ context: 'formatting'
621
+ });
622
+ }
623
+ },
624
+ // Stand-alone month
625
+ L: function L(date, token, localize) {
626
+ var month = date.getUTCMonth();
627
+ switch (token) {
628
+ // 1, 2, ..., 12
629
+ case 'L':
630
+ return String(month + 1);
631
+ // 01, 02, ..., 12
632
+ case 'LL':
633
+ return addLeadingZeros(month + 1, 2);
634
+ // 1st, 2nd, ..., 12th
635
+ case 'Lo':
636
+ return localize.ordinalNumber(month + 1, {
637
+ unit: 'month'
638
+ });
639
+ // Jan, Feb, ..., Dec
640
+ case 'LLL':
641
+ return localize.month(month, {
642
+ width: 'abbreviated',
643
+ context: 'standalone'
644
+ });
645
+ // J, F, ..., D
646
+ case 'LLLLL':
647
+ return localize.month(month, {
648
+ width: 'narrow',
649
+ context: 'standalone'
650
+ });
651
+ // January, February, ..., December
652
+ case 'LLLL':
653
+ default:
654
+ return localize.month(month, {
655
+ width: 'wide',
656
+ context: 'standalone'
657
+ });
658
+ }
659
+ },
660
+ // Local week of year
661
+ w: function w(date, token, localize, options) {
662
+ var week = getUTCWeek(date, options);
663
+ if (token === 'wo') {
664
+ return localize.ordinalNumber(week, {
665
+ unit: 'week'
666
+ });
667
+ }
668
+ return addLeadingZeros(week, token.length);
669
+ },
670
+ // ISO week of year
671
+ I: function I(date, token, localize) {
672
+ var isoWeek = getUTCISOWeek(date);
673
+ if (token === 'Io') {
674
+ return localize.ordinalNumber(isoWeek, {
675
+ unit: 'week'
676
+ });
677
+ }
678
+ return addLeadingZeros(isoWeek, token.length);
679
+ },
680
+ // Day of the month
681
+ d: function d(date, token, localize) {
682
+ if (token === 'do') {
683
+ return localize.ordinalNumber(date.getUTCDate(), {
684
+ unit: 'date'
685
+ });
686
+ }
687
+ return formatters$3.d(date, token);
688
+ },
689
+ // Day of year
690
+ D: function D(date, token, localize) {
691
+ var dayOfYear = getUTCDayOfYear(date);
692
+ if (token === 'Do') {
693
+ return localize.ordinalNumber(dayOfYear, {
694
+ unit: 'dayOfYear'
695
+ });
696
+ }
697
+ return addLeadingZeros(dayOfYear, token.length);
698
+ },
699
+ // Day of week
700
+ E: function E(date, token, localize) {
701
+ var dayOfWeek = date.getUTCDay();
702
+ switch (token) {
703
+ // Tue
704
+ case 'E':
705
+ case 'EE':
706
+ case 'EEE':
707
+ return localize.day(dayOfWeek, {
708
+ width: 'abbreviated',
709
+ context: 'formatting'
710
+ });
711
+ // T
712
+ case 'EEEEE':
713
+ return localize.day(dayOfWeek, {
714
+ width: 'narrow',
715
+ context: 'formatting'
716
+ });
717
+ // Tu
718
+ case 'EEEEEE':
719
+ return localize.day(dayOfWeek, {
720
+ width: 'short',
721
+ context: 'formatting'
722
+ });
723
+ // Tuesday
724
+ case 'EEEE':
725
+ default:
726
+ return localize.day(dayOfWeek, {
727
+ width: 'wide',
728
+ context: 'formatting'
729
+ });
730
+ }
731
+ },
732
+ // Local day of week
733
+ e: function e(date, token, localize, options) {
734
+ var dayOfWeek = date.getUTCDay();
735
+ var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
736
+ switch (token) {
737
+ // Numerical value (Nth day of week with current locale or weekStartsOn)
738
+ case 'e':
739
+ return String(localDayOfWeek);
740
+ // Padded numerical value
741
+ case 'ee':
742
+ return addLeadingZeros(localDayOfWeek, 2);
743
+ // 1st, 2nd, ..., 7th
744
+ case 'eo':
745
+ return localize.ordinalNumber(localDayOfWeek, {
746
+ unit: 'day'
747
+ });
748
+ case 'eee':
749
+ return localize.day(dayOfWeek, {
750
+ width: 'abbreviated',
751
+ context: 'formatting'
752
+ });
753
+ // T
754
+ case 'eeeee':
755
+ return localize.day(dayOfWeek, {
756
+ width: 'narrow',
757
+ context: 'formatting'
758
+ });
759
+ // Tu
760
+ case 'eeeeee':
761
+ return localize.day(dayOfWeek, {
762
+ width: 'short',
763
+ context: 'formatting'
764
+ });
765
+ // Tuesday
766
+ case 'eeee':
767
+ default:
768
+ return localize.day(dayOfWeek, {
769
+ width: 'wide',
770
+ context: 'formatting'
771
+ });
772
+ }
773
+ },
774
+ // Stand-alone local day of week
775
+ c: function c(date, token, localize, options) {
776
+ var dayOfWeek = date.getUTCDay();
777
+ var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
778
+ switch (token) {
779
+ // Numerical value (same as in `e`)
780
+ case 'c':
781
+ return String(localDayOfWeek);
782
+ // Padded numerical value
783
+ case 'cc':
784
+ return addLeadingZeros(localDayOfWeek, token.length);
785
+ // 1st, 2nd, ..., 7th
786
+ case 'co':
787
+ return localize.ordinalNumber(localDayOfWeek, {
788
+ unit: 'day'
789
+ });
790
+ case 'ccc':
791
+ return localize.day(dayOfWeek, {
792
+ width: 'abbreviated',
793
+ context: 'standalone'
794
+ });
795
+ // T
796
+ case 'ccccc':
797
+ return localize.day(dayOfWeek, {
798
+ width: 'narrow',
799
+ context: 'standalone'
800
+ });
801
+ // Tu
802
+ case 'cccccc':
803
+ return localize.day(dayOfWeek, {
804
+ width: 'short',
805
+ context: 'standalone'
806
+ });
807
+ // Tuesday
808
+ case 'cccc':
809
+ default:
810
+ return localize.day(dayOfWeek, {
811
+ width: 'wide',
812
+ context: 'standalone'
813
+ });
814
+ }
815
+ },
816
+ // ISO day of week
817
+ i: function i(date, token, localize) {
818
+ var dayOfWeek = date.getUTCDay();
819
+ var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
820
+ switch (token) {
821
+ // 2
822
+ case 'i':
823
+ return String(isoDayOfWeek);
824
+ // 02
825
+ case 'ii':
826
+ return addLeadingZeros(isoDayOfWeek, token.length);
827
+ // 2nd
828
+ case 'io':
829
+ return localize.ordinalNumber(isoDayOfWeek, {
830
+ unit: 'day'
831
+ });
832
+ // Tue
833
+ case 'iii':
834
+ return localize.day(dayOfWeek, {
835
+ width: 'abbreviated',
836
+ context: 'formatting'
837
+ });
838
+ // T
839
+ case 'iiiii':
840
+ return localize.day(dayOfWeek, {
841
+ width: 'narrow',
842
+ context: 'formatting'
843
+ });
844
+ // Tu
845
+ case 'iiiiii':
846
+ return localize.day(dayOfWeek, {
847
+ width: 'short',
848
+ context: 'formatting'
849
+ });
850
+ // Tuesday
851
+ case 'iiii':
852
+ default:
853
+ return localize.day(dayOfWeek, {
854
+ width: 'wide',
855
+ context: 'formatting'
856
+ });
857
+ }
858
+ },
859
+ // AM or PM
860
+ a: function a(date, token, localize) {
861
+ var hours = date.getUTCHours();
862
+ var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
863
+ switch (token) {
864
+ case 'a':
865
+ case 'aa':
866
+ return localize.dayPeriod(dayPeriodEnumValue, {
867
+ width: 'abbreviated',
868
+ context: 'formatting'
869
+ });
870
+ case 'aaa':
871
+ return localize.dayPeriod(dayPeriodEnumValue, {
872
+ width: 'abbreviated',
873
+ context: 'formatting'
874
+ }).toLowerCase();
875
+ case 'aaaaa':
876
+ return localize.dayPeriod(dayPeriodEnumValue, {
877
+ width: 'narrow',
878
+ context: 'formatting'
879
+ });
880
+ case 'aaaa':
881
+ default:
882
+ return localize.dayPeriod(dayPeriodEnumValue, {
883
+ width: 'wide',
884
+ context: 'formatting'
885
+ });
886
+ }
887
+ },
888
+ // AM, PM, midnight, noon
889
+ b: function b(date, token, localize) {
890
+ var hours = date.getUTCHours();
891
+ var dayPeriodEnumValue;
892
+ if (hours === 12) {
893
+ dayPeriodEnumValue = dayPeriodEnum.noon;
894
+ } else if (hours === 0) {
895
+ dayPeriodEnumValue = dayPeriodEnum.midnight;
896
+ } else {
897
+ dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
898
+ }
899
+ switch (token) {
900
+ case 'b':
901
+ case 'bb':
902
+ return localize.dayPeriod(dayPeriodEnumValue, {
903
+ width: 'abbreviated',
904
+ context: 'formatting'
905
+ });
906
+ case 'bbb':
907
+ return localize.dayPeriod(dayPeriodEnumValue, {
908
+ width: 'abbreviated',
909
+ context: 'formatting'
910
+ }).toLowerCase();
911
+ case 'bbbbb':
912
+ return localize.dayPeriod(dayPeriodEnumValue, {
913
+ width: 'narrow',
914
+ context: 'formatting'
915
+ });
916
+ case 'bbbb':
917
+ default:
918
+ return localize.dayPeriod(dayPeriodEnumValue, {
919
+ width: 'wide',
920
+ context: 'formatting'
921
+ });
922
+ }
923
+ },
924
+ // in the morning, in the afternoon, in the evening, at night
925
+ B: function B(date, token, localize) {
926
+ var hours = date.getUTCHours();
927
+ var dayPeriodEnumValue;
928
+ if (hours >= 17) {
929
+ dayPeriodEnumValue = dayPeriodEnum.evening;
930
+ } else if (hours >= 12) {
931
+ dayPeriodEnumValue = dayPeriodEnum.afternoon;
932
+ } else if (hours >= 4) {
933
+ dayPeriodEnumValue = dayPeriodEnum.morning;
934
+ } else {
935
+ dayPeriodEnumValue = dayPeriodEnum.night;
936
+ }
937
+ switch (token) {
938
+ case 'B':
939
+ case 'BB':
940
+ case 'BBB':
941
+ return localize.dayPeriod(dayPeriodEnumValue, {
942
+ width: 'abbreviated',
943
+ context: 'formatting'
944
+ });
945
+ case 'BBBBB':
946
+ return localize.dayPeriod(dayPeriodEnumValue, {
947
+ width: 'narrow',
948
+ context: 'formatting'
949
+ });
950
+ case 'BBBB':
951
+ default:
952
+ return localize.dayPeriod(dayPeriodEnumValue, {
953
+ width: 'wide',
954
+ context: 'formatting'
955
+ });
956
+ }
957
+ },
958
+ // Hour [1-12]
959
+ h: function h(date, token, localize) {
960
+ if (token === 'ho') {
961
+ var hours = date.getUTCHours() % 12;
962
+ if (hours === 0) hours = 12;
963
+ return localize.ordinalNumber(hours, {
964
+ unit: 'hour'
965
+ });
966
+ }
967
+ return formatters$3.h(date, token);
968
+ },
969
+ // Hour [0-23]
970
+ H: function H(date, token, localize) {
971
+ if (token === 'Ho') {
972
+ return localize.ordinalNumber(date.getUTCHours(), {
973
+ unit: 'hour'
974
+ });
975
+ }
976
+ return formatters$3.H(date, token);
977
+ },
978
+ // Hour [0-11]
979
+ K: function K(date, token, localize) {
980
+ var hours = date.getUTCHours() % 12;
981
+ if (token === 'Ko') {
982
+ return localize.ordinalNumber(hours, {
983
+ unit: 'hour'
984
+ });
985
+ }
986
+ return addLeadingZeros(hours, token.length);
987
+ },
988
+ // Hour [1-24]
989
+ k: function k(date, token, localize) {
990
+ var hours = date.getUTCHours();
991
+ if (hours === 0) hours = 24;
992
+ if (token === 'ko') {
993
+ return localize.ordinalNumber(hours, {
994
+ unit: 'hour'
995
+ });
996
+ }
997
+ return addLeadingZeros(hours, token.length);
998
+ },
999
+ // Minute
1000
+ m: function m(date, token, localize) {
1001
+ if (token === 'mo') {
1002
+ return localize.ordinalNumber(date.getUTCMinutes(), {
1003
+ unit: 'minute'
1004
+ });
1005
+ }
1006
+ return formatters$3.m(date, token);
1007
+ },
1008
+ // Second
1009
+ s: function s(date, token, localize) {
1010
+ if (token === 'so') {
1011
+ return localize.ordinalNumber(date.getUTCSeconds(), {
1012
+ unit: 'second'
1013
+ });
1014
+ }
1015
+ return formatters$3.s(date, token);
1016
+ },
1017
+ // Fraction of second
1018
+ S: function S(date, token) {
1019
+ return formatters$3.S(date, token);
1020
+ },
1021
+ // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
1022
+ X: function X(date, token, _localize, options) {
1023
+ var originalDate = options._originalDate || date;
1024
+ var timezoneOffset = originalDate.getTimezoneOffset();
1025
+ if (timezoneOffset === 0) {
1026
+ return 'Z';
1027
+ }
1028
+ switch (token) {
1029
+ // Hours and optional minutes
1030
+ case 'X':
1031
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
1032
+
1033
+ // Hours, minutes and optional seconds without `:` delimiter
1034
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1035
+ // so this token always has the same output as `XX`
1036
+ case 'XXXX':
1037
+ case 'XX':
1038
+ // Hours and minutes without `:` delimiter
1039
+ return formatTimezone(timezoneOffset);
1040
+
1041
+ // Hours, minutes and optional seconds with `:` delimiter
1042
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1043
+ // so this token always has the same output as `XXX`
1044
+ case 'XXXXX':
1045
+ case 'XXX': // Hours and minutes with `:` delimiter
1046
+ default:
1047
+ return formatTimezone(timezoneOffset, ':');
1048
+ }
1049
+ },
1050
+ // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
1051
+ x: function x(date, token, _localize, options) {
1052
+ var originalDate = options._originalDate || date;
1053
+ var timezoneOffset = originalDate.getTimezoneOffset();
1054
+ switch (token) {
1055
+ // Hours and optional minutes
1056
+ case 'x':
1057
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
1058
+
1059
+ // Hours, minutes and optional seconds without `:` delimiter
1060
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1061
+ // so this token always has the same output as `xx`
1062
+ case 'xxxx':
1063
+ case 'xx':
1064
+ // Hours and minutes without `:` delimiter
1065
+ return formatTimezone(timezoneOffset);
1066
+
1067
+ // Hours, minutes and optional seconds with `:` delimiter
1068
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1069
+ // so this token always has the same output as `xxx`
1070
+ case 'xxxxx':
1071
+ case 'xxx': // Hours and minutes with `:` delimiter
1072
+ default:
1073
+ return formatTimezone(timezoneOffset, ':');
1074
+ }
1075
+ },
1076
+ // Timezone (GMT)
1077
+ O: function O(date, token, _localize, options) {
1078
+ var originalDate = options._originalDate || date;
1079
+ var timezoneOffset = originalDate.getTimezoneOffset();
1080
+ switch (token) {
1081
+ // Short
1082
+ case 'O':
1083
+ case 'OO':
1084
+ case 'OOO':
1085
+ return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
1086
+ // Long
1087
+ case 'OOOO':
1088
+ default:
1089
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
1090
+ }
1091
+ },
1092
+ // Timezone (specific non-location)
1093
+ z: function z(date, token, _localize, options) {
1094
+ var originalDate = options._originalDate || date;
1095
+ var timezoneOffset = originalDate.getTimezoneOffset();
1096
+ switch (token) {
1097
+ // Short
1098
+ case 'z':
1099
+ case 'zz':
1100
+ case 'zzz':
1101
+ return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
1102
+ // Long
1103
+ case 'zzzz':
1104
+ default:
1105
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
1106
+ }
1107
+ },
1108
+ // Seconds timestamp
1109
+ t: function t(date, token, _localize, options) {
1110
+ var originalDate = options._originalDate || date;
1111
+ var timestamp = Math.floor(originalDate.getTime() / 1000);
1112
+ return addLeadingZeros(timestamp, token.length);
1113
+ },
1114
+ // Milliseconds timestamp
1115
+ T: function T(date, token, _localize, options) {
1116
+ var originalDate = options._originalDate || date;
1117
+ var timestamp = originalDate.getTime();
1118
+ return addLeadingZeros(timestamp, token.length);
1119
+ }
1120
+ };
1121
+ function formatTimezoneShort(offset, dirtyDelimiter) {
1122
+ var sign = offset > 0 ? '-' : '+';
1123
+ var absOffset = Math.abs(offset);
1124
+ var hours = Math.floor(absOffset / 60);
1125
+ var minutes = absOffset % 60;
1126
+ if (minutes === 0) {
1127
+ return sign + String(hours);
1128
+ }
1129
+ var delimiter = dirtyDelimiter || '';
1130
+ return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
1131
+ }
1132
+ function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
1133
+ if (offset % 60 === 0) {
1134
+ var sign = offset > 0 ? '-' : '+';
1135
+ return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
1136
+ }
1137
+ return formatTimezone(offset, dirtyDelimiter);
1138
+ }
1139
+ function formatTimezone(offset, dirtyDelimiter) {
1140
+ var delimiter = dirtyDelimiter || '';
1141
+ var sign = offset > 0 ? '-' : '+';
1142
+ var absOffset = Math.abs(offset);
1143
+ var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
1144
+ var minutes = addLeadingZeros(absOffset % 60, 2);
1145
+ return sign + hours + delimiter + minutes;
1146
+ }
1147
+ const formatters$1 = formatters;
1148
+
1149
+ var dateLongFormatter = function dateLongFormatter(pattern, formatLong) {
1150
+ switch (pattern) {
1151
+ case 'P':
1152
+ return formatLong.date({
1153
+ width: 'short'
1154
+ });
1155
+ case 'PP':
1156
+ return formatLong.date({
1157
+ width: 'medium'
1158
+ });
1159
+ case 'PPP':
1160
+ return formatLong.date({
1161
+ width: 'long'
1162
+ });
1163
+ case 'PPPP':
1164
+ default:
1165
+ return formatLong.date({
1166
+ width: 'full'
1167
+ });
1168
+ }
1169
+ };
1170
+ var timeLongFormatter = function timeLongFormatter(pattern, formatLong) {
1171
+ switch (pattern) {
1172
+ case 'p':
1173
+ return formatLong.time({
1174
+ width: 'short'
1175
+ });
1176
+ case 'pp':
1177
+ return formatLong.time({
1178
+ width: 'medium'
1179
+ });
1180
+ case 'ppp':
1181
+ return formatLong.time({
1182
+ width: 'long'
1183
+ });
1184
+ case 'pppp':
1185
+ default:
1186
+ return formatLong.time({
1187
+ width: 'full'
1188
+ });
1189
+ }
1190
+ };
1191
+ var dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) {
1192
+ var matchResult = pattern.match(/(P+)(p+)?/) || [];
1193
+ var datePattern = matchResult[1];
1194
+ var timePattern = matchResult[2];
1195
+ if (!timePattern) {
1196
+ return dateLongFormatter(pattern, formatLong);
1197
+ }
1198
+ var dateTimeFormat;
1199
+ switch (datePattern) {
1200
+ case 'P':
1201
+ dateTimeFormat = formatLong.dateTime({
1202
+ width: 'short'
1203
+ });
1204
+ break;
1205
+ case 'PP':
1206
+ dateTimeFormat = formatLong.dateTime({
1207
+ width: 'medium'
1208
+ });
1209
+ break;
1210
+ case 'PPP':
1211
+ dateTimeFormat = formatLong.dateTime({
1212
+ width: 'long'
1213
+ });
1214
+ break;
1215
+ case 'PPPP':
1216
+ default:
1217
+ dateTimeFormat = formatLong.dateTime({
1218
+ width: 'full'
1219
+ });
1220
+ break;
1221
+ }
1222
+ return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
1223
+ };
1224
+ var longFormatters = {
1225
+ p: timeLongFormatter,
1226
+ P: dateTimeLongFormatter
1227
+ };
1228
+ const longFormatters$1 = longFormatters;
1229
+
1230
+ var protectedDayOfYearTokens = ['D', 'DD'];
1231
+ var protectedWeekYearTokens = ['YY', 'YYYY'];
1232
+ function isProtectedDayOfYearToken(token) {
1233
+ return protectedDayOfYearTokens.indexOf(token) !== -1;
1234
+ }
1235
+ function isProtectedWeekYearToken(token) {
1236
+ return protectedWeekYearTokens.indexOf(token) !== -1;
1237
+ }
1238
+ function throwProtectedError(token, format, input) {
1239
+ if (token === 'YYYY') {
1240
+ 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"));
1241
+ } else if (token === 'YY') {
1242
+ 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"));
1243
+ } else if (token === 'D') {
1244
+ 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"));
1245
+ } else if (token === 'DD') {
1246
+ 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"));
1247
+ }
1248
+ }
1249
+
1250
+ var formatDistanceLocale = {
1251
+ lessThanXSeconds: {
1252
+ one: 'less than a second',
1253
+ other: 'less than {{count}} seconds'
1254
+ },
1255
+ xSeconds: {
1256
+ one: '1 second',
1257
+ other: '{{count}} seconds'
1258
+ },
1259
+ halfAMinute: 'half a minute',
1260
+ lessThanXMinutes: {
1261
+ one: 'less than a minute',
1262
+ other: 'less than {{count}} minutes'
1263
+ },
1264
+ xMinutes: {
1265
+ one: '1 minute',
1266
+ other: '{{count}} minutes'
1267
+ },
1268
+ aboutXHours: {
1269
+ one: 'about 1 hour',
1270
+ other: 'about {{count}} hours'
1271
+ },
1272
+ xHours: {
1273
+ one: '1 hour',
1274
+ other: '{{count}} hours'
1275
+ },
1276
+ xDays: {
1277
+ one: '1 day',
1278
+ other: '{{count}} days'
1279
+ },
1280
+ aboutXWeeks: {
1281
+ one: 'about 1 week',
1282
+ other: 'about {{count}} weeks'
1283
+ },
1284
+ xWeeks: {
1285
+ one: '1 week',
1286
+ other: '{{count}} weeks'
1287
+ },
1288
+ aboutXMonths: {
1289
+ one: 'about 1 month',
1290
+ other: 'about {{count}} months'
1291
+ },
1292
+ xMonths: {
1293
+ one: '1 month',
1294
+ other: '{{count}} months'
1295
+ },
1296
+ aboutXYears: {
1297
+ one: 'about 1 year',
1298
+ other: 'about {{count}} years'
1299
+ },
1300
+ xYears: {
1301
+ one: '1 year',
1302
+ other: '{{count}} years'
1303
+ },
1304
+ overXYears: {
1305
+ one: 'over 1 year',
1306
+ other: 'over {{count}} years'
1307
+ },
1308
+ almostXYears: {
1309
+ one: 'almost 1 year',
1310
+ other: 'almost {{count}} years'
1311
+ }
1312
+ };
1313
+ var formatDistance = function formatDistance(token, count, options) {
1314
+ var result;
1315
+ var tokenValue = formatDistanceLocale[token];
1316
+ if (typeof tokenValue === 'string') {
1317
+ result = tokenValue;
1318
+ } else if (count === 1) {
1319
+ result = tokenValue.one;
1320
+ } else {
1321
+ result = tokenValue.other.replace('{{count}}', count.toString());
1322
+ }
1323
+ if (options !== null && options !== void 0 && options.addSuffix) {
1324
+ if (options.comparison && options.comparison > 0) {
1325
+ return 'in ' + result;
1326
+ } else {
1327
+ return result + ' ago';
1328
+ }
1329
+ }
1330
+ return result;
1331
+ };
1332
+ const formatDistance$1 = formatDistance;
1333
+
1334
+ function buildFormatLongFn(args) {
1335
+ return function () {
1336
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1337
+ // TODO: Remove String()
1338
+ var width = options.width ? String(options.width) : args.defaultWidth;
1339
+ var format = args.formats[width] || args.formats[args.defaultWidth];
1340
+ return format;
1341
+ };
1342
+ }
1343
+
1344
+ var dateFormats = {
1345
+ full: 'EEEE, MMMM do, y',
1346
+ long: 'MMMM do, y',
1347
+ medium: 'MMM d, y',
1348
+ short: 'MM/dd/yyyy'
1349
+ };
1350
+ var timeFormats = {
1351
+ full: 'h:mm:ss a zzzz',
1352
+ long: 'h:mm:ss a z',
1353
+ medium: 'h:mm:ss a',
1354
+ short: 'h:mm a'
1355
+ };
1356
+ var dateTimeFormats = {
1357
+ full: "{{date}} 'at' {{time}}",
1358
+ long: "{{date}} 'at' {{time}}",
1359
+ medium: '{{date}}, {{time}}',
1360
+ short: '{{date}}, {{time}}'
1361
+ };
1362
+ var formatLong = {
1363
+ date: buildFormatLongFn({
1364
+ formats: dateFormats,
1365
+ defaultWidth: 'full'
1366
+ }),
1367
+ time: buildFormatLongFn({
1368
+ formats: timeFormats,
1369
+ defaultWidth: 'full'
1370
+ }),
1371
+ dateTime: buildFormatLongFn({
1372
+ formats: dateTimeFormats,
1373
+ defaultWidth: 'full'
1374
+ })
1375
+ };
1376
+ const formatLong$1 = formatLong;
1377
+
1378
+ var formatRelativeLocale = {
1379
+ lastWeek: "'last' eeee 'at' p",
1380
+ yesterday: "'yesterday at' p",
1381
+ today: "'today at' p",
1382
+ tomorrow: "'tomorrow at' p",
1383
+ nextWeek: "eeee 'at' p",
1384
+ other: 'P'
1385
+ };
1386
+ var formatRelative = function formatRelative(token, _date, _baseDate, _options) {
1387
+ return formatRelativeLocale[token];
1388
+ };
1389
+ const formatRelative$1 = formatRelative;
1390
+
1391
+ function buildLocalizeFn(args) {
1392
+ return function (dirtyIndex, options) {
1393
+ var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';
1394
+ var valuesArray;
1395
+ if (context === 'formatting' && args.formattingValues) {
1396
+ var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
1397
+ var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
1398
+ valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
1399
+ } else {
1400
+ var _defaultWidth = args.defaultWidth;
1401
+ var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
1402
+ valuesArray = args.values[_width] || args.values[_defaultWidth];
1403
+ }
1404
+ var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
1405
+ // @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!
1406
+ return valuesArray[index];
1407
+ };
1408
+ }
1409
+
1410
+ var eraValues = {
1411
+ narrow: ['B', 'A'],
1412
+ abbreviated: ['BC', 'AD'],
1413
+ wide: ['Before Christ', 'Anno Domini']
1414
+ };
1415
+ var quarterValues = {
1416
+ narrow: ['1', '2', '3', '4'],
1417
+ abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
1418
+ wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
1419
+ };
1420
+
1421
+ // Note: in English, the names of days of the week and months are capitalized.
1422
+ // If you are making a new locale based on this one, check if the same is true for the language you're working on.
1423
+ // Generally, formatted dates should look like they are in the middle of a sentence,
1424
+ // e.g. in Spanish language the weekdays and months should be in the lowercase.
1425
+ var monthValues = {
1426
+ narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
1427
+ abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
1428
+ wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
1429
+ };
1430
+ var dayValues = {
1431
+ narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
1432
+ short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
1433
+ abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
1434
+ wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
1435
+ };
1436
+ var dayPeriodValues = {
1437
+ narrow: {
1438
+ am: 'a',
1439
+ pm: 'p',
1440
+ midnight: 'mi',
1441
+ noon: 'n',
1442
+ morning: 'morning',
1443
+ afternoon: 'afternoon',
1444
+ evening: 'evening',
1445
+ night: 'night'
1446
+ },
1447
+ abbreviated: {
1448
+ am: 'AM',
1449
+ pm: 'PM',
1450
+ midnight: 'midnight',
1451
+ noon: 'noon',
1452
+ morning: 'morning',
1453
+ afternoon: 'afternoon',
1454
+ evening: 'evening',
1455
+ night: 'night'
1456
+ },
1457
+ wide: {
1458
+ am: 'a.m.',
1459
+ pm: 'p.m.',
1460
+ midnight: 'midnight',
1461
+ noon: 'noon',
1462
+ morning: 'morning',
1463
+ afternoon: 'afternoon',
1464
+ evening: 'evening',
1465
+ night: 'night'
1466
+ }
1467
+ };
1468
+ var formattingDayPeriodValues = {
1469
+ narrow: {
1470
+ am: 'a',
1471
+ pm: 'p',
1472
+ midnight: 'mi',
1473
+ noon: 'n',
1474
+ morning: 'in the morning',
1475
+ afternoon: 'in the afternoon',
1476
+ evening: 'in the evening',
1477
+ night: 'at night'
1478
+ },
1479
+ abbreviated: {
1480
+ am: 'AM',
1481
+ pm: 'PM',
1482
+ midnight: 'midnight',
1483
+ noon: 'noon',
1484
+ morning: 'in the morning',
1485
+ afternoon: 'in the afternoon',
1486
+ evening: 'in the evening',
1487
+ night: 'at night'
1488
+ },
1489
+ wide: {
1490
+ am: 'a.m.',
1491
+ pm: 'p.m.',
1492
+ midnight: 'midnight',
1493
+ noon: 'noon',
1494
+ morning: 'in the morning',
1495
+ afternoon: 'in the afternoon',
1496
+ evening: 'in the evening',
1497
+ night: 'at night'
1498
+ }
1499
+ };
1500
+ var ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
1501
+ var number = Number(dirtyNumber);
1502
+
1503
+ // If ordinal numbers depend on context, for example,
1504
+ // if they are different for different grammatical genders,
1505
+ // use `options.unit`.
1506
+ //
1507
+ // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
1508
+ // 'day', 'hour', 'minute', 'second'.
1509
+
1510
+ var rem100 = number % 100;
1511
+ if (rem100 > 20 || rem100 < 10) {
1512
+ switch (rem100 % 10) {
1513
+ case 1:
1514
+ return number + 'st';
1515
+ case 2:
1516
+ return number + 'nd';
1517
+ case 3:
1518
+ return number + 'rd';
1519
+ }
1520
+ }
1521
+ return number + 'th';
1522
+ };
1523
+ var localize = {
1524
+ ordinalNumber: ordinalNumber,
1525
+ era: buildLocalizeFn({
1526
+ values: eraValues,
1527
+ defaultWidth: 'wide'
1528
+ }),
1529
+ quarter: buildLocalizeFn({
1530
+ values: quarterValues,
1531
+ defaultWidth: 'wide',
1532
+ argumentCallback: function argumentCallback(quarter) {
1533
+ return quarter - 1;
1534
+ }
1535
+ }),
1536
+ month: buildLocalizeFn({
1537
+ values: monthValues,
1538
+ defaultWidth: 'wide'
1539
+ }),
1540
+ day: buildLocalizeFn({
1541
+ values: dayValues,
1542
+ defaultWidth: 'wide'
1543
+ }),
1544
+ dayPeriod: buildLocalizeFn({
1545
+ values: dayPeriodValues,
1546
+ defaultWidth: 'wide',
1547
+ formattingValues: formattingDayPeriodValues,
1548
+ defaultFormattingWidth: 'wide'
1549
+ })
1550
+ };
1551
+ const localize$1 = localize;
1552
+
1553
+ function buildMatchFn(args) {
1554
+ return function (string) {
1555
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1556
+ var width = options.width;
1557
+ var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
1558
+ var matchResult = string.match(matchPattern);
1559
+ if (!matchResult) {
1560
+ return null;
1561
+ }
1562
+ var matchedString = matchResult[0];
1563
+ var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
1564
+ var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
1565
+ return pattern.test(matchedString);
1566
+ }) : findKey(parsePatterns, function (pattern) {
1567
+ return pattern.test(matchedString);
1568
+ });
1569
+ var value;
1570
+ value = args.valueCallback ? args.valueCallback(key) : key;
1571
+ value = options.valueCallback ? options.valueCallback(value) : value;
1572
+ var rest = string.slice(matchedString.length);
1573
+ return {
1574
+ value: value,
1575
+ rest: rest
1576
+ };
1577
+ };
1578
+ }
1579
+ function findKey(object, predicate) {
1580
+ for (var key in object) {
1581
+ if (object.hasOwnProperty(key) && predicate(object[key])) {
1582
+ return key;
1583
+ }
1584
+ }
1585
+ return undefined;
1586
+ }
1587
+ function findIndex(array, predicate) {
1588
+ for (var key = 0; key < array.length; key++) {
1589
+ if (predicate(array[key])) {
1590
+ return key;
1591
+ }
1592
+ }
1593
+ return undefined;
1594
+ }
1595
+
1596
+ function buildMatchPatternFn(args) {
1597
+ return function (string) {
1598
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1599
+ var matchResult = string.match(args.matchPattern);
1600
+ if (!matchResult) return null;
1601
+ var matchedString = matchResult[0];
1602
+ var parseResult = string.match(args.parsePattern);
1603
+ if (!parseResult) return null;
1604
+ var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
1605
+ value = options.valueCallback ? options.valueCallback(value) : value;
1606
+ var rest = string.slice(matchedString.length);
1607
+ return {
1608
+ value: value,
1609
+ rest: rest
1610
+ };
1611
+ };
1612
+ }
1613
+
1614
+ var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
1615
+ var parseOrdinalNumberPattern = /\d+/i;
1616
+ var matchEraPatterns = {
1617
+ narrow: /^(b|a)/i,
1618
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
1619
+ wide: /^(before christ|before common era|anno domini|common era)/i
1620
+ };
1621
+ var parseEraPatterns = {
1622
+ any: [/^b/i, /^(a|c)/i]
1623
+ };
1624
+ var matchQuarterPatterns = {
1625
+ narrow: /^[1234]/i,
1626
+ abbreviated: /^q[1234]/i,
1627
+ wide: /^[1234](th|st|nd|rd)? quarter/i
1628
+ };
1629
+ var parseQuarterPatterns = {
1630
+ any: [/1/i, /2/i, /3/i, /4/i]
1631
+ };
1632
+ var matchMonthPatterns = {
1633
+ narrow: /^[jfmasond]/i,
1634
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
1635
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
1636
+ };
1637
+ var parseMonthPatterns = {
1638
+ 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],
1639
+ 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]
1640
+ };
1641
+ var matchDayPatterns = {
1642
+ narrow: /^[smtwf]/i,
1643
+ short: /^(su|mo|tu|we|th|fr|sa)/i,
1644
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
1645
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
1646
+ };
1647
+ var parseDayPatterns = {
1648
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
1649
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
1650
+ };
1651
+ var matchDayPeriodPatterns = {
1652
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
1653
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
1654
+ };
1655
+ var parseDayPeriodPatterns = {
1656
+ any: {
1657
+ am: /^a/i,
1658
+ pm: /^p/i,
1659
+ midnight: /^mi/i,
1660
+ noon: /^no/i,
1661
+ morning: /morning/i,
1662
+ afternoon: /afternoon/i,
1663
+ evening: /evening/i,
1664
+ night: /night/i
1665
+ }
1666
+ };
1667
+ var match = {
1668
+ ordinalNumber: buildMatchPatternFn({
1669
+ matchPattern: matchOrdinalNumberPattern,
1670
+ parsePattern: parseOrdinalNumberPattern,
1671
+ valueCallback: function valueCallback(value) {
1672
+ return parseInt(value, 10);
1673
+ }
1674
+ }),
1675
+ era: buildMatchFn({
1676
+ matchPatterns: matchEraPatterns,
1677
+ defaultMatchWidth: 'wide',
1678
+ parsePatterns: parseEraPatterns,
1679
+ defaultParseWidth: 'any'
1680
+ }),
1681
+ quarter: buildMatchFn({
1682
+ matchPatterns: matchQuarterPatterns,
1683
+ defaultMatchWidth: 'wide',
1684
+ parsePatterns: parseQuarterPatterns,
1685
+ defaultParseWidth: 'any',
1686
+ valueCallback: function valueCallback(index) {
1687
+ return index + 1;
1688
+ }
1689
+ }),
1690
+ month: buildMatchFn({
1691
+ matchPatterns: matchMonthPatterns,
1692
+ defaultMatchWidth: 'wide',
1693
+ parsePatterns: parseMonthPatterns,
1694
+ defaultParseWidth: 'any'
1695
+ }),
1696
+ day: buildMatchFn({
1697
+ matchPatterns: matchDayPatterns,
1698
+ defaultMatchWidth: 'wide',
1699
+ parsePatterns: parseDayPatterns,
1700
+ defaultParseWidth: 'any'
1701
+ }),
1702
+ dayPeriod: buildMatchFn({
1703
+ matchPatterns: matchDayPeriodPatterns,
1704
+ defaultMatchWidth: 'any',
1705
+ parsePatterns: parseDayPeriodPatterns,
1706
+ defaultParseWidth: 'any'
1707
+ })
1708
+ };
1709
+ const match$1 = match;
1710
+
1711
+ /**
1712
+ * @type {Locale}
1713
+ * @category Locales
1714
+ * @summary English locale (United States).
1715
+ * @language English
1716
+ * @iso-639-2 eng
1717
+ * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
1718
+ * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
1719
+ */
1720
+ var locale = {
1721
+ code: 'en-US',
1722
+ formatDistance: formatDistance$1,
1723
+ formatLong: formatLong$1,
1724
+ formatRelative: formatRelative$1,
1725
+ localize: localize$1,
1726
+ match: match$1,
1727
+ options: {
1728
+ weekStartsOn: 0 /* Sunday */,
1729
+ firstWeekContainsDate: 1
1730
+ }
1731
+ };
1732
+ const defaultLocale = locale;
1733
+
1734
+ // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
1735
+ // (one of the certain letters followed by `o`)
1736
+ // - (\w)\1* matches any sequences of the same letter
1737
+ // - '' matches two quote characters in a row
1738
+ // - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
1739
+ // except a single quote symbol, which ends the sequence.
1740
+ // Two quote characters do not end the sequence.
1741
+ // If there is no matching single quote
1742
+ // then the sequence will continue until the end of the string.
1743
+ // - . matches any single character unmatched by previous parts of the RegExps
1744
+ var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
1745
+
1746
+ // This RegExp catches symbols escaped by quotes, and also
1747
+ // sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
1748
+ var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
1749
+ var escapedStringRegExp = /^'([^]*?)'?$/;
1750
+ var doubleQuoteRegExp = /''/g;
1751
+ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
1752
+
1753
+ /**
1754
+ * @name format
1755
+ * @category Common Helpers
1756
+ * @summary Format the date.
1757
+ *
1758
+ * @description
1759
+ * Return the formatted date string in the given format. The result may vary by locale.
1760
+ *
1761
+ * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
1762
+ * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
1763
+ *
1764
+ * The characters wrapped between two single quotes characters (') are escaped.
1765
+ * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
1766
+ * (see the last example)
1767
+ *
1768
+ * Format of the string is based on Unicode Technical Standard #35:
1769
+ * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
1770
+ * with a few additions (see note 7 below the table).
1771
+ *
1772
+ * Accepted patterns:
1773
+ * | Unit | Pattern | Result examples | Notes |
1774
+ * |---------------------------------|---------|-----------------------------------|-------|
1775
+ * | Era | G..GGG | AD, BC | |
1776
+ * | | GGGG | Anno Domini, Before Christ | 2 |
1777
+ * | | GGGGG | A, B | |
1778
+ * | Calendar year | y | 44, 1, 1900, 2017 | 5 |
1779
+ * | | yo | 44th, 1st, 0th, 17th | 5,7 |
1780
+ * | | yy | 44, 01, 00, 17 | 5 |
1781
+ * | | yyy | 044, 001, 1900, 2017 | 5 |
1782
+ * | | yyyy | 0044, 0001, 1900, 2017 | 5 |
1783
+ * | | yyyyy | ... | 3,5 |
1784
+ * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
1785
+ * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
1786
+ * | | YY | 44, 01, 00, 17 | 5,8 |
1787
+ * | | YYY | 044, 001, 1900, 2017 | 5 |
1788
+ * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
1789
+ * | | YYYYY | ... | 3,5 |
1790
+ * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
1791
+ * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
1792
+ * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
1793
+ * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
1794
+ * | | RRRRR | ... | 3,5,7 |
1795
+ * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
1796
+ * | | uu | -43, 01, 1900, 2017 | 5 |
1797
+ * | | uuu | -043, 001, 1900, 2017 | 5 |
1798
+ * | | uuuu | -0043, 0001, 1900, 2017 | 5 |
1799
+ * | | uuuuu | ... | 3,5 |
1800
+ * | Quarter (formatting) | Q | 1, 2, 3, 4 | |
1801
+ * | | Qo | 1st, 2nd, 3rd, 4th | 7 |
1802
+ * | | QQ | 01, 02, 03, 04 | |
1803
+ * | | QQQ | Q1, Q2, Q3, Q4 | |
1804
+ * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
1805
+ * | | QQQQQ | 1, 2, 3, 4 | 4 |
1806
+ * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
1807
+ * | | qo | 1st, 2nd, 3rd, 4th | 7 |
1808
+ * | | qq | 01, 02, 03, 04 | |
1809
+ * | | qqq | Q1, Q2, Q3, Q4 | |
1810
+ * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
1811
+ * | | qqqqq | 1, 2, 3, 4 | 4 |
1812
+ * | Month (formatting) | M | 1, 2, ..., 12 | |
1813
+ * | | Mo | 1st, 2nd, ..., 12th | 7 |
1814
+ * | | MM | 01, 02, ..., 12 | |
1815
+ * | | MMM | Jan, Feb, ..., Dec | |
1816
+ * | | MMMM | January, February, ..., December | 2 |
1817
+ * | | MMMMM | J, F, ..., D | |
1818
+ * | Month (stand-alone) | L | 1, 2, ..., 12 | |
1819
+ * | | Lo | 1st, 2nd, ..., 12th | 7 |
1820
+ * | | LL | 01, 02, ..., 12 | |
1821
+ * | | LLL | Jan, Feb, ..., Dec | |
1822
+ * | | LLLL | January, February, ..., December | 2 |
1823
+ * | | LLLLL | J, F, ..., D | |
1824
+ * | Local week of year | w | 1, 2, ..., 53 | |
1825
+ * | | wo | 1st, 2nd, ..., 53th | 7 |
1826
+ * | | ww | 01, 02, ..., 53 | |
1827
+ * | ISO week of year | I | 1, 2, ..., 53 | 7 |
1828
+ * | | Io | 1st, 2nd, ..., 53th | 7 |
1829
+ * | | II | 01, 02, ..., 53 | 7 |
1830
+ * | Day of month | d | 1, 2, ..., 31 | |
1831
+ * | | do | 1st, 2nd, ..., 31st | 7 |
1832
+ * | | dd | 01, 02, ..., 31 | |
1833
+ * | Day of year | D | 1, 2, ..., 365, 366 | 9 |
1834
+ * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
1835
+ * | | DD | 01, 02, ..., 365, 366 | 9 |
1836
+ * | | DDD | 001, 002, ..., 365, 366 | |
1837
+ * | | DDDD | ... | 3 |
1838
+ * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
1839
+ * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
1840
+ * | | EEEEE | M, T, W, T, F, S, S | |
1841
+ * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
1842
+ * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
1843
+ * | | io | 1st, 2nd, ..., 7th | 7 |
1844
+ * | | ii | 01, 02, ..., 07 | 7 |
1845
+ * | | iii | Mon, Tue, Wed, ..., Sun | 7 |
1846
+ * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
1847
+ * | | iiiii | M, T, W, T, F, S, S | 7 |
1848
+ * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
1849
+ * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
1850
+ * | | eo | 2nd, 3rd, ..., 1st | 7 |
1851
+ * | | ee | 02, 03, ..., 01 | |
1852
+ * | | eee | Mon, Tue, Wed, ..., Sun | |
1853
+ * | | eeee | Monday, Tuesday, ..., Sunday | 2 |
1854
+ * | | eeeee | M, T, W, T, F, S, S | |
1855
+ * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
1856
+ * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
1857
+ * | | co | 2nd, 3rd, ..., 1st | 7 |
1858
+ * | | cc | 02, 03, ..., 01 | |
1859
+ * | | ccc | Mon, Tue, Wed, ..., Sun | |
1860
+ * | | cccc | Monday, Tuesday, ..., Sunday | 2 |
1861
+ * | | ccccc | M, T, W, T, F, S, S | |
1862
+ * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
1863
+ * | AM, PM | a..aa | AM, PM | |
1864
+ * | | aaa | am, pm | |
1865
+ * | | aaaa | a.m., p.m. | 2 |
1866
+ * | | aaaaa | a, p | |
1867
+ * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
1868
+ * | | bbb | am, pm, noon, midnight | |
1869
+ * | | bbbb | a.m., p.m., noon, midnight | 2 |
1870
+ * | | bbbbb | a, p, n, mi | |
1871
+ * | Flexible day period | B..BBB | at night, in the morning, ... | |
1872
+ * | | BBBB | at night, in the morning, ... | 2 |
1873
+ * | | BBBBB | at night, in the morning, ... | |
1874
+ * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
1875
+ * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
1876
+ * | | hh | 01, 02, ..., 11, 12 | |
1877
+ * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
1878
+ * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
1879
+ * | | HH | 00, 01, 02, ..., 23 | |
1880
+ * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
1881
+ * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
1882
+ * | | KK | 01, 02, ..., 11, 00 | |
1883
+ * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
1884
+ * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
1885
+ * | | kk | 24, 01, 02, ..., 23 | |
1886
+ * | Minute | m | 0, 1, ..., 59 | |
1887
+ * | | mo | 0th, 1st, ..., 59th | 7 |
1888
+ * | | mm | 00, 01, ..., 59 | |
1889
+ * | Second | s | 0, 1, ..., 59 | |
1890
+ * | | so | 0th, 1st, ..., 59th | 7 |
1891
+ * | | ss | 00, 01, ..., 59 | |
1892
+ * | Fraction of second | S | 0, 1, ..., 9 | |
1893
+ * | | SS | 00, 01, ..., 99 | |
1894
+ * | | SSS | 000, 001, ..., 999 | |
1895
+ * | | SSSS | ... | 3 |
1896
+ * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
1897
+ * | | XX | -0800, +0530, Z | |
1898
+ * | | XXX | -08:00, +05:30, Z | |
1899
+ * | | XXXX | -0800, +0530, Z, +123456 | 2 |
1900
+ * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
1901
+ * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
1902
+ * | | xx | -0800, +0530, +0000 | |
1903
+ * | | xxx | -08:00, +05:30, +00:00 | 2 |
1904
+ * | | xxxx | -0800, +0530, +0000, +123456 | |
1905
+ * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
1906
+ * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
1907
+ * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
1908
+ * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
1909
+ * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
1910
+ * | Seconds timestamp | t | 512969520 | 7 |
1911
+ * | | tt | ... | 3,7 |
1912
+ * | Milliseconds timestamp | T | 512969520900 | 7 |
1913
+ * | | TT | ... | 3,7 |
1914
+ * | Long localized date | P | 04/29/1453 | 7 |
1915
+ * | | PP | Apr 29, 1453 | 7 |
1916
+ * | | PPP | April 29th, 1453 | 7 |
1917
+ * | | PPPP | Friday, April 29th, 1453 | 2,7 |
1918
+ * | Long localized time | p | 12:00 AM | 7 |
1919
+ * | | pp | 12:00:00 AM | 7 |
1920
+ * | | ppp | 12:00:00 AM GMT+2 | 7 |
1921
+ * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
1922
+ * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
1923
+ * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
1924
+ * | | PPPppp | April 29th, 1453 at ... | 7 |
1925
+ * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
1926
+ * Notes:
1927
+ * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
1928
+ * are the same as "stand-alone" units, but are different in some languages.
1929
+ * "Formatting" units are declined according to the rules of the language
1930
+ * in the context of a date. "Stand-alone" units are always nominative singular:
1931
+ *
1932
+ * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
1933
+ *
1934
+ * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
1935
+ *
1936
+ * 2. Any sequence of the identical letters is a pattern, unless it is escaped by
1937
+ * the single quote characters (see below).
1938
+ * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
1939
+ * the output will be the same as default pattern for this unit, usually
1940
+ * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
1941
+ * are marked with "2" in the last column of the table.
1942
+ *
1943
+ * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
1944
+ *
1945
+ * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
1946
+ *
1947
+ * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
1948
+ *
1949
+ * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
1950
+ *
1951
+ * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
1952
+ *
1953
+ * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
1954
+ * The output will be padded with zeros to match the length of the pattern.
1955
+ *
1956
+ * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
1957
+ *
1958
+ * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
1959
+ * These tokens represent the shortest form of the quarter.
1960
+ *
1961
+ * 5. The main difference between `y` and `u` patterns are B.C. years:
1962
+ *
1963
+ * | Year | `y` | `u` |
1964
+ * |------|-----|-----|
1965
+ * | AC 1 | 1 | 1 |
1966
+ * | BC 1 | 1 | 0 |
1967
+ * | BC 2 | 2 | -1 |
1968
+ *
1969
+ * Also `yy` always returns the last two digits of a year,
1970
+ * while `uu` pads single digit years to 2 characters and returns other years unchanged:
1971
+ *
1972
+ * | Year | `yy` | `uu` |
1973
+ * |------|------|------|
1974
+ * | 1 | 01 | 01 |
1975
+ * | 14 | 14 | 14 |
1976
+ * | 376 | 76 | 376 |
1977
+ * | 1453 | 53 | 1453 |
1978
+ *
1979
+ * The same difference is true for local and ISO week-numbering years (`Y` and `R`),
1980
+ * except local week-numbering years are dependent on `options.weekStartsOn`
1981
+ * and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}
1982
+ * and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).
1983
+ *
1984
+ * 6. Specific non-location timezones are currently unavailable in `date-fns`,
1985
+ * so right now these tokens fall back to GMT timezones.
1986
+ *
1987
+ * 7. These patterns are not in the Unicode Technical Standard #35:
1988
+ * - `i`: ISO day of week
1989
+ * - `I`: ISO week of year
1990
+ * - `R`: ISO week-numbering year
1991
+ * - `t`: seconds timestamp
1992
+ * - `T`: milliseconds timestamp
1993
+ * - `o`: ordinal number modifier
1994
+ * - `P`: long localized date
1995
+ * - `p`: long localized time
1996
+ *
1997
+ * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
1998
+ * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
1999
+ *
2000
+ * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
2001
+ * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2002
+ *
2003
+ * @param {Date|Number} date - the original date
2004
+ * @param {String} format - the string of tokens
2005
+ * @param {Object} [options] - an object with options.
2006
+ * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
2007
+ * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
2008
+ * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
2009
+ * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
2010
+ * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2011
+ * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
2012
+ * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2013
+ * @returns {String} the formatted date string
2014
+ * @throws {TypeError} 2 arguments required
2015
+ * @throws {RangeError} `date` must not be Invalid Date
2016
+ * @throws {RangeError} `options.locale` must contain `localize` property
2017
+ * @throws {RangeError} `options.locale` must contain `formatLong` property
2018
+ * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
2019
+ * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
2020
+ * @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
2021
+ * @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
2022
+ * @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
2023
+ * @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
2024
+ * @throws {RangeError} format string contains an unescaped latin alphabet character
2025
+ *
2026
+ * @example
2027
+ * // Represent 11 February 2014 in middle-endian format:
2028
+ * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
2029
+ * //=> '02/11/2014'
2030
+ *
2031
+ * @example
2032
+ * // Represent 2 July 2014 in Esperanto:
2033
+ * import { eoLocale } from 'date-fns/locale/eo'
2034
+ * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
2035
+ * locale: eoLocale
2036
+ * })
2037
+ * //=> '2-a de julio 2014'
2038
+ *
2039
+ * @example
2040
+ * // Escape string by single quote characters:
2041
+ * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
2042
+ * //=> "3 o'clock"
2043
+ */
2044
+
2045
+ function format(dirtyDate, dirtyFormatStr, options) {
2046
+ 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;
2047
+ lotteryTippingTicketBuy.requiredArgs(2, arguments);
2048
+ var formatStr = String(dirtyFormatStr);
2049
+ var defaultOptions = getDefaultOptions();
2050
+ 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;
2051
+ var firstWeekContainsDate = lotteryTippingTicketBuy.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);
2052
+
2053
+ // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
2054
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
2055
+ throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
2056
+ }
2057
+ var weekStartsOn = lotteryTippingTicketBuy.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);
2058
+
2059
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
2060
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
2061
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
2062
+ }
2063
+ if (!locale.localize) {
2064
+ throw new RangeError('locale must contain localize property');
2065
+ }
2066
+ if (!locale.formatLong) {
2067
+ throw new RangeError('locale must contain formatLong property');
2068
+ }
2069
+ var originalDate = lotteryTippingTicketBuy.toDate(dirtyDate);
2070
+ if (!isValid(originalDate)) {
2071
+ throw new RangeError('Invalid time value');
2072
+ }
2073
+
2074
+ // Convert the date in system timezone to the same date in UTC+00:00 timezone.
2075
+ // This ensures that when UTC functions will be implemented, locales will be compatible with them.
2076
+ // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
2077
+ var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
2078
+ var utcDate = subMilliseconds(originalDate, timezoneOffset);
2079
+ var formatterOptions = {
2080
+ firstWeekContainsDate: firstWeekContainsDate,
2081
+ weekStartsOn: weekStartsOn,
2082
+ locale: locale,
2083
+ _originalDate: originalDate
2084
+ };
2085
+ var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {
2086
+ var firstCharacter = substring[0];
2087
+ if (firstCharacter === 'p' || firstCharacter === 'P') {
2088
+ var longFormatter = longFormatters$1[firstCharacter];
2089
+ return longFormatter(substring, locale.formatLong);
2090
+ }
2091
+ return substring;
2092
+ }).join('').match(formattingTokensRegExp).map(function (substring) {
2093
+ // Replace two single quote characters with one single quote character
2094
+ if (substring === "''") {
2095
+ return "'";
2096
+ }
2097
+ var firstCharacter = substring[0];
2098
+ if (firstCharacter === "'") {
2099
+ return cleanEscapedString(substring);
2100
+ }
2101
+ var formatter = formatters$1[firstCharacter];
2102
+ if (formatter) {
2103
+ if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {
2104
+ throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
2105
+ }
2106
+ if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {
2107
+ throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
2108
+ }
2109
+ return formatter(utcDate, substring, locale.localize, formatterOptions);
2110
+ }
2111
+ if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
2112
+ throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');
2113
+ }
2114
+ return substring;
2115
+ }).join('');
2116
+ return result;
2117
+ }
2118
+ function cleanEscapedString(input) {
2119
+ var matched = input.match(escapedStringRegExp);
2120
+ if (!matched) {
2121
+ return input;
2122
+ }
2123
+ return matched[1].replace(doubleQuoteRegExp, "'");
2124
+ }
2125
+
2126
+ const tooltipCss = ":host{display:inline-flex;position:relative}.tooltip-wrapper{position:relative;display:inline-flex}.tooltip-content-wrapper{position:absolute;z-index:10;bottom:125%;left:50%;transform:translateX(-50%);opacity:0;visibility:hidden;transition:opacity 0.2s, visibility 0.2s}.tooltip-content-wrapper.visible{opacity:1;visibility:visible}.tooltip-content{background-color:var(--emw--tooltip-background-color, #000);color:var(--emw--tooltip-text-color, #fff);border-radius:4px;box-shadow:0 2px 8px rgba(0, 0, 0, 0.15);white-space:nowrap;padding:4px}";
2127
+ const AppTooltipStyle0 = tooltipCss;
2128
+
2129
+ const Tooltip = class {
2130
+ constructor(hostRef) {
2131
+ index.registerInstance(this, hostRef);
2132
+ this.show = () => (this.visible = true);
2133
+ this.hide = () => (this.visible = false);
2134
+ this.visible = false;
2135
+ }
2136
+ componentDidLoad() {
2137
+ this.trigger = this.host.querySelector('[slot="trigger"]');
2138
+ if (this.trigger) {
2139
+ this.trigger.addEventListener('mouseenter', this.show);
2140
+ this.trigger.addEventListener('mouseleave', this.hide);
2141
+ this.trigger.addEventListener('focus', this.show);
2142
+ this.trigger.addEventListener('blur', this.hide);
2143
+ }
2144
+ }
2145
+ disconnectedCallback() {
2146
+ if (this.trigger) {
2147
+ this.trigger.removeEventListener('mouseenter', this.show);
2148
+ this.trigger.removeEventListener('mouseleave', this.hide);
2149
+ this.trigger.removeEventListener('focus', this.show);
2150
+ this.trigger.removeEventListener('blur', this.hide);
2151
+ }
2152
+ }
2153
+ render() {
2154
+ return (index.h("div", { key: 'e56695ac60fcd7903127179423e9954ef40f05c0', class: "tooltip-wrapper" }, index.h("slot", { key: '4e2472a395ceeb2b911692739d326c031df07e29', name: "trigger" }), index.h("div", { key: 'f77bd72da94eb17d12e42ebb86c395c55801b728', class: { 'tooltip-content-wrapper': true, visible: this.visible } }, index.h("div", { key: '988399e2b42988622d46eaf255f17c6221eb9697', class: "tooltip-content" }, index.h("slot", { key: '05de0572ab1331d965e61947c5c15775e225197a', name: "content" })))));
2155
+ }
2156
+ get host() { return index.getElement(this); }
2157
+ };
2158
+ Tooltip.style = AppTooltipStyle0;
2159
+
2160
+ const helperCountDownCss = ":host{display:block}.helper-count-down-container{display:flex;align-items:center}.helper-count-down-prefix{margin-right:4px}.helper-count-down-suffix{margin-left:4px}.helper-count-down-values{display:flex;align-items:center}.helper-count-down-item{display:flex;align-items:center;justify-content:center}.helper-count-down-item-num{font-variant-numeric:tabular-nums}";
2161
+ const HelperCountDownStyle0 = helperCountDownCss;
2162
+
2163
+ const HelperCountDown = class {
2164
+ constructor(hostRef) {
2165
+ index.registerInstance(this, hostRef);
2166
+ this.countDownChange = index.createEvent(this, "countDownChange", 7);
2167
+ this.countDownFinish = index.createEvent(this, "countDownFinish", 7);
2168
+ this.value = undefined;
2169
+ this.format = 'HH:mm:ss';
2170
+ this.prefix = undefined;
2171
+ this.suffix = undefined;
2172
+ this.mbSource = undefined;
2173
+ this.clientStyling = undefined;
2174
+ this.clientStylingUrl = undefined;
2175
+ this.endTime = undefined;
2176
+ this.timeObj = {
2177
+ day: { str: '00', unit: '' },
2178
+ hour: { str: '00', unit: '' },
2179
+ minute: { str: '00', unit: '' },
2180
+ second: { str: '00', unit: '' }
2181
+ };
2182
+ }
2183
+ handleClientStylingChange(newValue, oldValue) {
2184
+ if (newValue != oldValue) {
2185
+ lotteryTippingTicketBuy.setClientStyling(this.stylingContainer, this.clientStyling);
2186
+ }
2187
+ }
2188
+ handleClientStylingUrlChange(newValue, oldValue) {
2189
+ if (newValue != oldValue) {
2190
+ lotteryTippingTicketBuy.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2191
+ }
2192
+ }
2193
+ handleMbSourceChange(newValue, oldValue) {
2194
+ if (newValue != oldValue) {
2195
+ lotteryTippingTicketBuy.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
2196
+ }
2197
+ }
2198
+ handleValueChange(newValue) {
2199
+ this.setEndTime(newValue);
2200
+ if (newValue) {
2201
+ this.startCountDown();
2202
+ }
2203
+ else {
2204
+ this.clearCountDown();
2205
+ }
2206
+ }
2207
+ componentDidLoad() {
2208
+ if (this.stylingContainer) {
2209
+ if (this.mbSource)
2210
+ lotteryTippingTicketBuy.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
2211
+ if (this.clientStyling)
2212
+ lotteryTippingTicketBuy.setClientStyling(this.stylingContainer, this.clientStyling);
2213
+ if (this.clientStylingUrl)
2214
+ lotteryTippingTicketBuy.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2215
+ }
2216
+ this.setEndTime(this.value);
2217
+ if (this.value)
2218
+ this.startCountDown();
2219
+ }
2220
+ setEndTime(value) {
2221
+ if (typeof value === 'string') {
2222
+ // If it's a string, parse it and get the milliseconds
2223
+ const time = lotteryTippingTicketBuy.parseISO(value).getTime();
2224
+ this.endTime = isNaN(time) ? null : time;
2225
+ }
2226
+ else {
2227
+ // If it's a number, use it directly
2228
+ this.endTime = value;
2229
+ }
2230
+ }
2231
+ disconnectedCallback() {
2232
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
2233
+ this.clearCountDown();
2234
+ }
2235
+ startCountDown() {
2236
+ this.clearCountDown();
2237
+ this.tick();
2238
+ this.timer = setInterval(() => {
2239
+ this.tick();
2240
+ }, 1000);
2241
+ }
2242
+ clearCountDown() {
2243
+ if (this.timer) {
2244
+ clearInterval(this.timer);
2245
+ this.timer = null;
2246
+ }
2247
+ }
2248
+ tick() {
2249
+ if (!this.endTime)
2250
+ return;
2251
+ let leftTime = this.endTime - Date.now();
2252
+ if (leftTime <= 0) {
2253
+ leftTime = 0;
2254
+ this.clearCountDown();
2255
+ this.countDownFinish.emit();
2256
+ }
2257
+ const d = Math.floor(leftTime / (1000 * 60 * 60 * 24));
2258
+ const h = Math.floor((leftTime / (1000 * 60 * 60)) % 24);
2259
+ const m = Math.floor((leftTime / 1000 / 60) % 60);
2260
+ const s = Math.floor((leftTime / 1000) % 60);
2261
+ const pad = (n) => (n < 10 ? `0${n}` : `${n}`);
2262
+ this.timeObj = {
2263
+ day: { str: pad(d), unit: 'd' },
2264
+ hour: { str: pad(h), unit: 'h' },
2265
+ minute: { str: pad(m), unit: 'm' },
2266
+ second: { str: pad(s), unit: 's' }
2267
+ };
2268
+ const formatTime = this.getFormatTime();
2269
+ this.countDownChange.emit({ leftTime, formatTime, legalTime: formatTime });
2270
+ }
2271
+ getFormatTime() {
2272
+ return this.format
2273
+ .replace('DD', this.timeObj.day.str)
2274
+ .replace('HH', this.timeObj.hour.str)
2275
+ .replace('mm', this.timeObj.minute.str)
2276
+ .replace('ss', this.timeObj.second.str);
2277
+ }
2278
+ renderItems() {
2279
+ const regex = /(DD|HH|mm|ss)|([\s\S]+?)(?=(DD|HH|mm|ss)|$)/g;
2280
+ const items = [];
2281
+ let match;
2282
+ while ((match = regex.exec(this.format)) !== null) {
2283
+ if (match[1]) {
2284
+ let val = '';
2285
+ switch (match[1]) {
2286
+ case 'DD':
2287
+ val = this.timeObj.day.str;
2288
+ break;
2289
+ case 'HH':
2290
+ val = this.timeObj.hour.str;
2291
+ break;
2292
+ case 'mm':
2293
+ val = this.timeObj.minute.str;
2294
+ break;
2295
+ case 'ss':
2296
+ val = this.timeObj.second.str;
2297
+ break;
2298
+ }
2299
+ items.push({ val, unit: '' });
2300
+ }
2301
+ else if (match[2]) {
2302
+ if (items.length > 0) {
2303
+ items[items.length - 1].unit = match[2];
2304
+ }
2305
+ }
2306
+ }
2307
+ return items.map((item, index$1) => {
2308
+ return (index.h("div", { key: index$1 + item.unit, class: "helper-count-down-item", part: "item" }, index.h("div", { class: "helper-count-down-item-num" }, item.val), index.h("div", { class: "helper-count-down-item-unit" }, item.unit)));
2309
+ });
2310
+ }
2311
+ render() {
2312
+ return (index.h("div", { key: 'b360412e045020b5ac0263c6ca56458f31eedb2c', class: "helper-count-down-container", ref: (el) => (this.stylingContainer = el) }, index.h("slot", { key: 'c72bed87fba869c842407b04e0cbfe038e5b7ea8' }), this.prefix && index.h("div", { key: '8d3ba9d60577421f81bae7bc76f52a774b17e1fe', class: "helper-count-down-prefix" }, this.prefix), index.h("div", { key: '187edf3b8eb6de85efe1a748fd8ef47a68e19611', class: "helper-count-down-values", part: "values" }, this.renderItems()), this.suffix && index.h("div", { key: '3a8e5d9561ecd3f52eff423bd43c8b60a261a17c', class: "helper-count-down-suffix" }, this.suffix)));
2313
+ }
2314
+ static get watchers() { return {
2315
+ "clientStyling": ["handleClientStylingChange"],
2316
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
2317
+ "mbSource": ["handleMbSourceChange"],
2318
+ "value": ["handleValueChange"]
2319
+ }; }
2320
+ };
2321
+ HelperCountDown.style = HelperCountDownStyle0;
2322
+
2323
+ const DEFAULT_LANGUAGE$4 = 'en';
2324
+ const SUPPORTED_LANGUAGES$4 = ['ro', 'en', 'fr', 'ar', 'hr'];
2325
+ const TRANSLATIONS$4 = {
2326
+ en: {
2327
+ stop: 'Stop',
2328
+ at: 'at',
2329
+ turnover: 'Turnover: ',
2330
+ startIn: 'Sales Start in:',
2331
+ },
2332
+ ro: {
2333
+ stop: 'Oprește',
2334
+ at: 'la'
2335
+ },
2336
+ fr: {
2337
+ stop: 'Arrêtez',
2338
+ at: 'à'
2339
+ },
2340
+ ar: {
2341
+ stop: 'توقف',
2342
+ at: 'في'
2343
+ },
2344
+ hr: {
2345
+ stop: 'Stop',
2346
+ at: 'u'
2347
+ }
2348
+ };
2349
+ const translate$4 = (key, customLang) => {
2350
+ const lang = customLang;
2351
+ return TRANSLATIONS$4[lang !== undefined && SUPPORTED_LANGUAGES$4.includes(lang) ? lang : DEFAULT_LANGUAGE$4][key];
2352
+ };
2353
+ const getTranslations$4 = (data) => {
2354
+ Object.keys(data).forEach((item) => {
2355
+ for (let key in data[item]) {
2356
+ TRANSLATIONS$4[item][key] = data[item][key];
2357
+ }
2358
+ });
2359
+ };
2360
+ const resolveTranslationUrl$3 = async (translationUrl) => {
2361
+ if (translationUrl) {
2362
+ try {
2363
+ const response = await fetch(translationUrl);
2364
+ if (!response.ok) {
2365
+ throw new Error(`HTTP error! status: ${response.status}`);
2366
+ }
2367
+ const translations = await response.json();
2368
+ getTranslations$4(translations);
2369
+ }
2370
+ catch (error) {
2371
+ console.error('Failed to fetch or parse translations from URL:', error);
2372
+ }
2373
+ }
2374
+ };
2375
+
2376
+ const lotteryBannerCss = ":host {\n display: block;\n container-type: inline-size;\n}\n\n.lottery-banner {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--lottery-banner-gap, 0.5rem);\n padding: var(--lottery-banner-padding, 0px 20px);\n background: var(--lottery-banner-background, var(--emw--color-primary, #fed275));\n border-top: var(--lottery-banner-border-width, 2px) var(--lottery-banner-border-style, solid) var(--lottery-banner-border-color, var(--emw--color-primary, #fed275));\n border-bottom: var(--lottery-banner-border-width, 2px) var(--lottery-banner-border-style, solid) var(--lottery-banner-border-color, var(--emw--color-primary, #fed275));\n border-left: var(--lottery-banner-border-left, none);\n border-right: var(--lottery-banner-border-right, none);\n border-radius: var(--lottery-banner-border-radius, 0);\n white-space: nowrap;\n height: var(--lottery-banner-height, 50px);\n position: relative;\n box-sizing: border-box;\n}\n\n.lottery-banner__logo-wrapper {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n}\n.lottery-banner__logo-wrapper img {\n height: 100%;\n max-width: 32vw;\n object-fit: var(--lottery-banner-logo-object-fit, contain);\n}\n\n.lottery-banner__item--center {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n}\n\n.lottery-banner__title {\n text-align: center;\n font-size: var(--lottery-banner-title-font-size, 1.5rem);\n font-weight: 800;\n font-style: italic;\n letter-spacing: var(--lottery-banner-title-font-letter-spacing, 0.04em);\n color: var(--emw--color-typography, #000);\n}\n\n.lottery-banner__info {\n display: flex;\n align-items: center;\n gap: var(--lottery-banner-info-gap, 0.75rem);\n}\n\n.lottery-banner__info-item {\n font-size: var(--lottery-banner-info-font-size, 0.9rem);\n color: var(--lottery-banner-info-color, var(--emw--color-typography, #000));\n display: inline-flex;\n align-items: center;\n gap: 0.3rem;\n}\n\n.lottery-banner__info-item-label {\n color: var(--lottery-banner-info-label-color, var(--emw--color-typography, #000));\n}\n.lottery-banner__info-item-label__strong {\n font-weight: var(--lottery-banner-info-label-font-weight, 700);\n}\n\n.lottery-banner__info-item-value {\n font-weight: var(--lottery-banner-info-value-font-weight, inherit);\n color: var(--lottery-banner-info-value-color, var(--emw--color-typography, #000));\n}\n.lottery-banner__info-item-value__strong {\n font-weight: var(--lottery-banner-info-label-font-weight, 700);\n}\n\nhelper-count-down::part(values) {\n gap: 8px;\n}\n\n@container (max-width: 700px) {\n .lottery-banner {\n height: auto;\n padding: var(--lottery-banner-mobile-padding, 0.5rem 0.2rem);\n }\n .lottery-banner__title {\n flex-basis: 100%;\n text-align: var(--lottery-banner-mobile-title-text-align, left);\n font-size: var(--emw--font-size-small, 0.875rem);\n }\n .lottery-banner__info {\n flex-direction: column;\n align-items: flex-start;\n gap: var(--lottery-banner-mobile-info-gap, 0.1rem);\n }\n .lottery-banner__info-item {\n font-size: var(--emw--font-size-x-small, 0.75rem);\n }\n}";
2377
+ const LotteryBannerStyle0 = lotteryBannerCss;
2378
+
2379
+ const LotteryBanner = class {
2380
+ constructor(hostRef) {
2381
+ index.registerInstance(this, hostRef);
2382
+ this.lotteryBannerWagerStarted = index.createEvent(this, "lotteryBannerWagerStarted", 7);
2383
+ this.handleCountdownFinish = () => {
2384
+ this.isWagerStarted = true;
2385
+ this.lotteryBannerWagerStarted.emit();
2386
+ };
2387
+ this.mbSource = undefined;
2388
+ this.clientStyling = undefined;
2389
+ this.clientStylingUrl = undefined;
2390
+ this.translationUrl = '';
2391
+ this.language = 'en';
2392
+ this.logoUrl = undefined;
2393
+ this.stopTime = '';
2394
+ this.startTime = '';
2395
+ this.bannerTitle = undefined;
2396
+ this.turnover = undefined;
2397
+ this.layout = 'logo,title,info';
2398
+ this.isWagerStarted = false;
2399
+ this.formattedStopTime = undefined;
2400
+ }
2401
+ handleClientStylingChange(newValue, oldValue) {
2402
+ if (newValue !== oldValue) {
2403
+ lotteryTippingTicketBuy.setClientStyling(this.stylingContainer, this.clientStyling);
2404
+ }
2405
+ }
2406
+ handleClientStylingUrlChange(newValue, oldValue) {
2407
+ if (newValue !== oldValue) {
2408
+ lotteryTippingTicketBuy.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2409
+ }
2410
+ }
2411
+ handleMbSourceChange(newValue, oldValue) {
2412
+ if (newValue !== oldValue) {
2413
+ lotteryTippingTicketBuy.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
2414
+ }
2415
+ }
2416
+ handleTimeChange() {
2417
+ this.checkWagerStatus();
2418
+ }
2419
+ async componentWillLoad() {
2420
+ if (this.translationUrl) {
2421
+ resolveTranslationUrl$3(this.translationUrl);
2422
+ }
2423
+ this.checkWagerStatus();
2424
+ }
2425
+ checkWagerStatus() {
2426
+ if (this.startTime && lotteryTippingTicketBuy.isBefore(new Date(), lotteryTippingTicketBuy.parseISO(this.startTime))) {
2427
+ this.isWagerStarted = false;
2428
+ }
2429
+ else {
2430
+ this.isWagerStarted = true;
2431
+ }
2432
+ if (this.stopTime) {
2433
+ this.formattedStopTime = format(lotteryTippingTicketBuy.parseISO(this.stopTime), 'dd/MM/yyyy HH:mm');
2434
+ }
2435
+ }
2436
+ componentDidLoad() {
2437
+ if (this.stylingContainer) {
2438
+ if (this.mbSource)
2439
+ lotteryTippingTicketBuy.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
2440
+ if (this.clientStyling)
2441
+ lotteryTippingTicketBuy.setClientStyling(this.stylingContainer, this.clientStyling);
2442
+ if (this.clientStylingUrl)
2443
+ lotteryTippingTicketBuy.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2444
+ }
2445
+ }
2446
+ disconnectedCallback() {
2447
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
2448
+ }
2449
+ renderElement(item, className = '') {
2450
+ const poolGameLogo = index.getAssetPath('../static/poolGameLogo.webp');
2451
+ switch (item) {
2452
+ case 'logo':
2453
+ return (index.h("div", { class: `lottery-banner__logo-wrapper ${className}` }, poolGameLogo && index.h("img", { alt: "logo", src: poolGameLogo, class: "lottery-banner__logo" })));
2454
+ case 'title':
2455
+ return this.bannerTitle && index.h("div", { class: `lottery-banner__title ${className}` }, this.bannerTitle);
2456
+ case 'info':
2457
+ return (index.h("div", { class: `lottery-banner__info ${className}` }, !this.isWagerStarted ? (index.h("div", { class: "lottery-banner__info-item" }, index.h("span", { class: "lottery-banner__info-item-label" }, index.h("span", { class: "lottery-banner__info-item-label__strong" }, translate$4('startIn', this.language)), "\u00A0"), index.h("helper-count-down", { class: "lottery-banner__info-item-value lottery-banner__info-item-value__strong", value: this.startTime, format: "DDD HHH mmM ssS", onCountDownFinish: this.handleCountdownFinish }))) : (index.h("div", { class: "lottery-banner__info-item" }, index.h("span", { class: "lottery-banner__info-item-label" }, index.h("span", { class: "lottery-banner__info-item-label__strong" }, translate$4('stop', this.language)), "\u00A0", translate$4('at', this.language)), index.h("span", { class: "lottery-banner__info-item-value" }, this.formattedStopTime))), this.isWagerStarted && this.turnover !== null && this.turnover !== undefined && (index.h("div", { class: "lottery-banner__info-item" }, index.h("span", { class: "lottery-banner__info-item-label" }, translate$4('turnover', this.language)), index.h("span", { class: "lottery-banner__info-item-value" }, this.turnover)))));
2458
+ default:
2459
+ return null;
2460
+ }
2461
+ }
2462
+ render() {
2463
+ const layoutItems = this.layout.split(',').map((item) => item.trim());
2464
+ return (index.h("section", { key: '8714d4136821b8afd6079da769bb9cc94149ed9d', ref: (el) => (this.stylingContainer = el), class: "lottery-banner" }, layoutItems.map((item, index) => {
2465
+ const isMiddle = layoutItems.length === 3 && index === 1;
2466
+ const className = isMiddle ? 'lottery-banner__item--center' : '';
2467
+ return this.renderElement(item, className);
2468
+ })));
2469
+ }
2470
+ static get assetsDirs() { return ["../static"]; }
2471
+ static get watchers() { return {
2472
+ "clientStyling": ["handleClientStylingChange"],
2473
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
2474
+ "mbSource": ["handleMbSourceChange"],
2475
+ "startTime": ["handleTimeChange"],
2476
+ "stopTime": ["handleTimeChange"]
2477
+ }; }
2478
+ };
2479
+ LotteryBanner.style = LotteryBannerStyle0;
2480
+
2481
+ const DEFAULT_LANGUAGE$3 = 'en';
2482
+ const SUPPORTED_LANGUAGES$3 = ['ro', 'en', 'fr', 'ar', 'hr', 'zh'];
2483
+ const TRANSLATIONS$3 = {
2484
+ en: {
2485
+ loading: 'Loading'
2486
+ },
2487
+ ro: {},
2488
+ fr: {},
2489
+ ar: {},
2490
+ hr: {}
2491
+ };
2492
+ const translate$3 = (key, customLang, replacements) => {
2493
+ const lang = customLang;
2494
+ let translation = TRANSLATIONS$3[lang !== undefined && SUPPORTED_LANGUAGES$3.includes(lang) ? lang : DEFAULT_LANGUAGE$3][key];
2495
+ if (replacements) {
2496
+ Object.keys(replacements).forEach((placeholder) => {
2497
+ translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
2498
+ });
2499
+ }
2500
+ return translation;
2501
+ };
2502
+ const getTranslations$3 = (data) => {
2503
+ Object.keys(data).forEach((item) => {
2504
+ for (let key in data[item]) {
2505
+ TRANSLATIONS$3[item][key] = data[item][key];
2506
+ }
2507
+ });
2508
+ };
2509
+ const resolveTranslationUrl$2 = async (translationUrl) => {
2510
+ if (translationUrl) {
2511
+ try {
2512
+ const response = await fetch(translationUrl);
2513
+ if (!response.ok) {
2514
+ throw new Error(`HTTP error! status: ${response.status}`);
2515
+ }
2516
+ const translations = await response.json();
2517
+ getTranslations$3(translations);
2518
+ }
2519
+ catch (error) {
2520
+ console.error('Failed to fetch or parse translations from URL:', error);
2521
+ }
2522
+ }
2523
+ };
2524
+
2525
+ const lotteryButtonCss = ":host{display:inline-block}.btn{font:inherit;position:relative;display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;border-radius:var(--lottery-button-border-radius, 6px);font-weight:var(--lottery-button-font-weight, 500);cursor:pointer;outline:none;overflow:hidden;transition:var(--lottery-button-transition, background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s);user-select:none;-webkit-tap-highlight-color:transparent;box-shadow:var(--lottery-button-box-shadow, 0 2px 4px 0 rgba(0, 0, 0, 0.5))}.btn .content{position:relative;display:inline-flex;align-items:center;gap:var(--lottery-button-content-gap, 0.5em)}.btn .content ::slotted(span){display:inline-flex;align-items:center}.btn:hover:not(:disabled){box-shadow:var(--lottery-button-hover-box-shadow, 0 4px 8px 0 rgba(0, 0, 0, 0.5))}.btn:disabled{cursor:not-allowed;opacity:var(--lottery-button-disabled-opacity, 0.5)}.btn .loading-container{display:flex;align-items:center}.btn--loading{position:relative}.btn .spinner{display:inline-block;width:1em;height:1em;border:var(--lottery-button-spinner-border, 2px solid rgba(255, 255, 255, 0.3));border-radius:50%;border-top-color:var(--lottery-button-spinner-color, white);animation:spin 1s ease-in-out infinite;margin-left:0.5em;vertical-align:middle}.btn--small .spinner{width:0.8em;height:0.8em}.btn--large .spinner{width:1.2em;height:1.2em}@keyframes spin{to{transform:rotate(360deg)}}.btn--primary{background-color:var(--emw--color-primary, #0d196e);color:var(--emw--color-typography-inverse, #fff)}.btn--primary:hover:not(:disabled){background-color:var(--emw--color-primary-variant, #1367e7)}.btn--primary:active:not(:disabled){background-color:var(--lottery-button-primary-active-bg, #08104a)}.btn--outline .spinner,.btn--dashed .spinner,.btn--text .spinner{border-top-color:currentColor;border-color:var(--lottery-button-spinner-inverse-border-color, rgba(0, 0, 0, 0.2))}.btn--outline{background-color:var(--emw--color-background, #fff);border-color:var(--lottery-button-outline-border-color, #dcdcdc);color:var(--emw--color-typography, #000)}.btn--outline:hover:not(:disabled){background-color:var(--emw--color-background-tertiary, #ccc);border-color:var(--lottery-button-outline-hover-border-color, #a6a6a6)}.btn--outline:active:not(:disabled){background-color:var(--lottery-button-outline-active-bg, #e6e6e6)}.btn--dashed{background-color:transparent;border-style:dashed;border-color:var(--lottery-button-dashed-border-color, #dcdcdc);color:var(--lottery-button-dashed-color, #333)}.btn--dashed:hover:not(:disabled){border-color:var(--lottery-button-dashed-hover-border-color, #a6a6a6);color:var(--lottery-button-dashed-hover-color, #0052d9)}.btn--text{background-color:transparent;color:var(--lottery-button-text-color, #0052d9);border-color:transparent}.btn--text:hover:not(:disabled){background-color:var(--lottery-button-text-hover-bg, #f2f2f2)}.btn--text:active:not(:disabled){background-color:var(--lottery-button-text-active-bg, #e6e6e6)}.btn--custom-color:hover:not(:disabled){opacity:var(--lottery-button-custom-hover-opacity, 0.9)}.btn--custom-color:active:not(:disabled){opacity:var(--lottery-button-custom-active-opacity, 0.8)}.btn--small{height:var(--lottery-button-small-height, 28px);font-size:var(--lottery-button-small-font-size, 12px);padding:var(--lottery-button-small-padding, 0 12px)}.btn--medium{height:var(--lottery-button-medium-height, 34px);font-size:var(--lottery-button-medium-font-size, 14px);padding:var(--lottery-button-medium-padding, 0 18px)}.btn--large{height:var(--lottery-button-large-height, 40px);font-size:var(--lottery-button-large-font-size, 16px);padding:var(--lottery-button-large-padding, 0 24px)}.ripple-container{position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none;border-radius:inherit}.ripple{position:absolute;border-radius:50%;background-color:var(--lottery-button-ripple-light, rgba(255, 255, 255, 0.3));transform:scale(0);animation:ripple-animation 600ms linear}.btn--outline .ripple,.btn--dashed .ripple,.btn--text .ripple{background-color:var(--lottery-button-ripple-dark, rgba(0, 0, 0, 0.03))}@keyframes ripple-animation{to{transform:scale(4);opacity:0}}";
2526
+ const LotteryButtonStyle0 = lotteryButtonCss;
2527
+
2528
+ const LotteryButton = class {
2529
+ constructor(hostRef) {
2530
+ index.registerInstance(this, hostRef);
2531
+ this.handleClick = (event) => {
2532
+ if (this.disabled) {
2533
+ return;
2534
+ }
2535
+ // Get the button element from the shadow root
2536
+ const button = this.host.shadowRoot.querySelector('.btn');
2537
+ if (!button)
2538
+ return;
2539
+ const rect = button.getBoundingClientRect();
2540
+ const size = Math.max(rect.width, rect.height);
2541
+ const top = event.clientY - rect.top - size / 2;
2542
+ const left = event.clientX - rect.left - size / 2;
2543
+ // Add the new ripple to the state, triggering a re-render
2544
+ const newRipple = { top, left, size };
2545
+ this.ripples = [...this.ripples, newRipple];
2546
+ // Set a timeout to clean up the ripple from the state after the animation ends
2547
+ // This prevents the DOM from filling up with old ripple elements
2548
+ setTimeout(() => {
2549
+ this.ripples = this.ripples.filter((r) => r !== newRipple);
2550
+ }, 600); // This duration should match the CSS animation duration
2551
+ };
2552
+ this.variant = 'primary';
2553
+ this.size = 'medium';
2554
+ this.color = undefined;
2555
+ this.disabled = false;
2556
+ this.loading = false;
2557
+ this.text = undefined;
2558
+ this.mbSource = undefined;
2559
+ this.language = 'en';
2560
+ this.clientStyling = undefined;
2561
+ this.clientStylingUrl = undefined;
2562
+ this.translationUrl = '';
2563
+ this.ripples = [];
2564
+ }
2565
+ handleClientStylingChange(newValue, oldValue) {
2566
+ if (newValue != oldValue) {
2567
+ lotteryTippingTicketBuy.setClientStyling(this.stylingContainer, this.clientStyling);
2568
+ }
2569
+ }
2570
+ handleClientStylingUrlChange(newValue, oldValue) {
2571
+ if (newValue != oldValue) {
2572
+ lotteryTippingTicketBuy.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2573
+ }
2574
+ }
2575
+ handleMbSourceChange(newValue, oldValue) {
2576
+ if (newValue != oldValue) {
2577
+ lotteryTippingTicketBuy.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
2578
+ }
2579
+ }
2580
+ disconnectedCallback() {
2581
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
2582
+ }
2583
+ componentDidLoad() {
2584
+ if (this.stylingContainer) {
2585
+ if (this.mbSource)
2586
+ lotteryTippingTicketBuy.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
2587
+ if (this.clientStyling)
2588
+ lotteryTippingTicketBuy.setClientStyling(this.stylingContainer, this.clientStyling);
2589
+ if (this.clientStylingUrl)
2590
+ lotteryTippingTicketBuy.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2591
+ }
2592
+ }
2593
+ componentWillLoad() {
2594
+ if (this.translationUrl) {
2595
+ resolveTranslationUrl$2(this.translationUrl);
2596
+ }
2597
+ }
2598
+ render() {
2599
+ const { variant, disabled, size, color } = this;
2600
+ const isDisabled = disabled || this.loading;
2601
+ // Calculate styles based on variant and color
2602
+ const buttonStyles = {};
2603
+ if (color) {
2604
+ switch (variant) {
2605
+ case 'primary':
2606
+ Object.assign(buttonStyles, {
2607
+ backgroundColor: color,
2608
+ borderColor: color
2609
+ });
2610
+ break;
2611
+ case 'outline':
2612
+ case 'dashed':
2613
+ Object.assign(buttonStyles, {
2614
+ color: color,
2615
+ borderColor: color
2616
+ });
2617
+ break;
2618
+ case 'text':
2619
+ Object.assign(buttonStyles, {
2620
+ color: color
2621
+ });
2622
+ break;
2623
+ default:
2624
+ Object.assign(buttonStyles, {
2625
+ backgroundColor: color,
2626
+ borderColor: color
2627
+ });
2628
+ }
2629
+ }
2630
+ return (index.h("button", { key: 'aa74ad98c90e7548228557bf8a8d26b125d4a83a', class: {
2631
+ btn: true,
2632
+ [`btn--${variant}`]: true,
2633
+ [`btn--${size}`]: true,
2634
+ 'btn--loading': this.loading
2635
+ }, style: color ? buttonStyles : undefined, disabled: isDisabled, onClick: this.handleClick, ref: (el) => (this.stylingContainer = el) }, this.loading ? (index.h("div", { class: "loading-container" }, index.h("span", { class: "content" }, this.text || translate$3('loading', this.language)), index.h("span", { class: "spinner" }))) : (index.h("span", { class: "content" }, index.h("slot", { name: "icon-left" }), this.text || index.h("slot", null), index.h("slot", { name: "icon-right" }))), index.h("div", { key: '302ea02be395bb24989d4abc040a513e23fa029a', class: "ripple-container" }, this.ripples.map((ripple, index$1) => (index.h("span", { key: index$1, class: "ripple", style: {
2636
+ top: `${ripple.top}px`,
2637
+ left: `${ripple.left}px`,
2638
+ width: `${ripple.size}px`,
2639
+ height: `${ripple.size}px`
2640
+ } }))))));
2641
+ }
2642
+ get host() { return index.getElement(this); }
2643
+ static get watchers() { return {
2644
+ "clientStyling": ["handleClientStylingChange"],
2645
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
2646
+ "mbSource": ["handleMbSourceChange"]
2647
+ }; }
2648
+ };
2649
+ LotteryButton.style = LotteryButtonStyle0;
2650
+
2651
+ const generateUUID = () => {
2652
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
2653
+ var r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8;
2654
+ return v.toString(16);
2655
+ });
2656
+ };
2657
+ function fetchRequest(url, method = 'GET', body = null, headers = {}) {
2658
+ return new Promise((resolve, reject) => {
2659
+ const uuid = generateUUID();
2660
+ const headersOrigin = Object.assign({ 'Content-Type': 'application/json' }, headers);
2661
+ if (method !== 'GET' && method !== 'HEAD') {
2662
+ headersOrigin['X-Idempotency-Key'] = uuid;
2663
+ }
2664
+ const options = {
2665
+ method,
2666
+ headers: headersOrigin,
2667
+ body: null
2668
+ };
2669
+ if (body && method !== 'GET' && method !== 'HEAD') {
2670
+ options.body = JSON.stringify(body);
2671
+ }
2672
+ else {
2673
+ delete options.body;
2674
+ }
2675
+ fetch(url, options)
2676
+ .then((response) => {
2677
+ if (!response.ok) {
2678
+ return reject(response);
2679
+ }
2680
+ return response.json();
2681
+ })
2682
+ .then((data) => resolve(data))
2683
+ .catch((error) => reject(error));
2684
+ });
2685
+ }
2686
+
2687
+ var TicketStatus;
2688
+ (function (TicketStatus) {
2689
+ TicketStatus["PURCHASED"] = "Purchased";
2690
+ TicketStatus["SETTLED"] = "Settled";
2691
+ TicketStatus["CANCELED"] = "Canceled";
2692
+ TicketStatus["ERROR"] = "Error";
2693
+ })(TicketStatus || (TicketStatus = {}));
2694
+
2695
+ const lotteryOrderSummaryCss = ":host{width:100%}.order-summary{width:100%;background:var(--emw--color-background, #fff);border-radius:var(--lottery-order-summary-border-radius, 8px);border:var(--lottery-order-summary-border, none);box-shadow:var(--lottery-order-summary-box-shadow, none);box-sizing:border-box}.order-summary__title{margin:var(--lottery-order-summary-title-margin, 0 0 30px 0);text-align:var(--lottery-order-summary-title-text-align, center);color:var(--emw--color-typography, #000);text-transform:uppercase;font-weight:var(--lottery-order-summary-title-font-weight, 700)}.order-summary__ticket-info{display:flex;align-items:center;margin-bottom:var(--lottery-order-summary-row-gap, 16px);gap:var(--lottery-order-summary-col-gap, 10px);color:var(--emw--color-typography, #000)}.order-summary__ticket-label{display:flex;flex-direction:row;align-items:center;width:var(--lottery-order-summary-label-width, 50px);max-width:var(--lottery-order-summary-label-max-width, 100%);flex-shrink:0}.order-summary__colon{margin-left:2px}.order-summary__ticket{font-weight:var(--lottery-order-summary-label-font-weight, 500);color:var(--emw--color-typography, #000);overflow-wrap:break-word}.order-summary__details{display:flex;align-items:center;color:var(--emw--color-typography, #000);font-weight:var(--lottery-order-summary-details-font-weight, 400)}.order-summary__divider{border:none;border-top:var(--lottery-order-summary-divider-border, 1px solid var(--emw--color-gray-100, #e6e6e6));margin:var(--lottery-order-summary-divider-margin, 20px 0)}.order-summary__button-wrapper{display:flex;justify-content:center;margin:var(--lottery-order-summary-button-wrapper-margin, 0);padding:var(--lottery-order-summary-button-wrapper-padding, 0)}";
2696
+ const LotteryOrderSummaryStyle0 = lotteryOrderSummaryCss;
2697
+
2698
+ const LotteryOrderSummary = class {
2699
+ constructor(hostRef) {
2700
+ index.registerInstance(this, hostRef);
2701
+ this.orderSummarySubmit = index.createEvent(this, "orderSummarySubmit", 7);
2702
+ this.submitSuccess = index.createEvent(this, "lotteryTicketSubmitSuccess", 7);
2703
+ this.submitError = index.createEvent(this, "lotteryTicketSubmitError", 7);
2704
+ this.sessionExpired = index.createEvent(this, "sessionExpired", 7);
2705
+ this.endpoint = undefined;
2706
+ this.sessionId = undefined;
2707
+ this.mbSource = undefined;
2708
+ this.clientStyling = undefined;
2709
+ this.clientStylingUrl = undefined;
2710
+ this.language = 'en';
2711
+ this.orderSummaryTitle = undefined;
2712
+ this.ticketsLabel = undefined;
2713
+ this.totalLabel = undefined;
2714
+ this.showColon = true;
2715
+ this.showDivider = false;
2716
+ this.submitDisabled = false;
2717
+ this.submitButtonText = undefined;
2718
+ this.submitLoading = false;
2719
+ }
2720
+ handleClientStylingChange(newValue, oldValue) {
2721
+ if (newValue != oldValue) {
2722
+ lotteryTippingTicketBuy.setClientStyling(this.stylingContainer, this.clientStyling);
2723
+ }
2724
+ }
2725
+ handleClientStylingUrlChange(newValue, oldValue) {
2726
+ if (newValue != oldValue) {
2727
+ lotteryTippingTicketBuy.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2728
+ }
2729
+ }
2730
+ handleMbSourceChange(newValue, oldValue) {
2731
+ if (newValue != oldValue) {
2732
+ lotteryTippingTicketBuy.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
2733
+ }
2734
+ }
2735
+ componentDidLoad() {
2736
+ if (this.stylingContainer) {
2737
+ if (this.mbSource)
2738
+ lotteryTippingTicketBuy.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
2739
+ if (this.clientStyling)
2740
+ lotteryTippingTicketBuy.setClientStyling(this.stylingContainer, this.clientStyling);
2741
+ if (this.clientStylingUrl)
2742
+ lotteryTippingTicketBuy.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2743
+ }
2744
+ }
2745
+ disconnectedCallback() {
2746
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
2747
+ }
2748
+ handleLotteryTicketParamsReady(event) {
2749
+ if (event.detail && this.isValidTicketSubmitParam(event.detail)) {
2750
+ this.handleSubmitTickets(event.detail);
2751
+ }
2752
+ else {
2753
+ const errorMessage = 'Invalid ticket data received before submission.';
2754
+ console.error(errorMessage, event.detail);
2755
+ this.submitError.emit({
2756
+ message: errorMessage,
2757
+ dataOrigin: event.detail,
2758
+ status: 400 // Bad Request
2759
+ });
2760
+ }
2761
+ }
2762
+ isValidTicketSubmitParam(detail) {
2763
+ return (detail &&
2764
+ Array.isArray(detail.tickets) &&
2765
+ detail.tickets.length > 0 &&
2766
+ detail.tickets.every((ticket) => this.isValidTicketParam(ticket)));
2767
+ }
2768
+ isValidTicketParam(ticket) {
2769
+ return (ticket &&
2770
+ ticket.gameName !== undefined &&
2771
+ ticket.startingDrawId !== undefined &&
2772
+ ticket.amount !== undefined &&
2773
+ ticket.currency !== undefined &&
2774
+ ticket.selection !== undefined);
2775
+ }
2776
+ async handleSubmitTickets(body) {
2777
+ try {
2778
+ this.submitLoading = true;
2779
+ const res = await fetchRequest(`${this.endpoint}/tickets`, 'POST', body, {
2780
+ Authorization: `Bearer ${this.sessionId}`
2781
+ });
2782
+ if (!res.tickets.every((ticket) => ticket.state === TicketStatus.PURCHASED)) {
2783
+ this.submitError.emit({
2784
+ message: 'Failed to purchase ticket',
2785
+ dataOrigin: res,
2786
+ status: 200
2787
+ });
2788
+ }
2789
+ else {
2790
+ this.submitSuccess.emit({
2791
+ dataOrigin: res,
2792
+ status: 200
2793
+ });
2794
+ }
2795
+ }
2796
+ catch (e) {
2797
+ if (e.status === 401) {
2798
+ this.sessionExpired.emit();
2799
+ }
2800
+ if (e.status > 300 || !e.status) {
2801
+ this.submitError.emit({
2802
+ dataOrigin: e,
2803
+ status: e.status || 0
2804
+ });
2805
+ }
2806
+ }
2807
+ finally {
2808
+ this.submitLoading = false;
2809
+ }
2810
+ }
2811
+ handleSubmit() {
2812
+ this.orderSummarySubmit.emit();
2813
+ }
2814
+ render() {
2815
+ return (index.h("div", { key: 'bdab321b9336f47e16057d240b3226d7cba59b97', ref: (el) => (this.stylingContainer = el) }, index.h("div", { key: 'de7ffcc9f96d8c7cfc7bdb3a3c7225ee78c33483', class: "order-summary" }, index.h("h3", { key: '9500cd69a6eba0855d4981cdad8eaa91b9c98567', class: "order-summary__title" }, this.orderSummaryTitle), index.h("div", { key: 'ce29c82eef1d12bc63e94e4fa2d5474700860af2', class: "order-summary__ticket" }, index.h("div", { key: '9db79da17590c7f847f46c3b3b66489ea9a0e268', class: "order-summary__ticket-info" }, index.h("div", { key: '4b5a2df807aeb421cf3c1ebf33f410a92f39ccaf', class: "order-summary__ticket-label" }, index.h("div", { key: 'feb73e9f849d2e3d6b77e4c848657f27e6a82323', class: "order-summary__ticket" }, this.ticketsLabel), index.h("span", { key: '51f70dcdda2154d8ce97d8e1a7c0f61a6198afbb', class: "order-summary__colon" }, this.showColon ? ':' : null)), index.h("div", { key: '4fed2d63cd7a881c8844055fe1fde99c8c7aa9fb', class: "order-summary__details" }, index.h("slot", { key: '6a7969738546ee4aca81a075f6174556e78d2c31', name: "orderSummaryTicketDetail" }))), this.showDivider && index.h("hr", { key: '029803fa93960d5098a24d5ca18e77e14562b29f', class: "order-summary__divider" }), index.h("div", { key: '738096c5b605a97851dbf24a972d93d9533ad48b', class: "order-summary__ticket-info" }, index.h("div", { key: 'acd8a7f3e64c97f58c79f57a90143151c996abf8', class: "order-summary__ticket-label" }, index.h("div", { key: '44e6b29978ca4fc2b22ca9d95ee4facfc883f292', class: "order-summary__ticket" }, this.totalLabel), index.h("span", { key: '330a00a4b39e578a1b0d80211d2b68d44c5235c9', class: "order-summary__colon" }, this.showColon ? ':' : null)), index.h("span", { key: '294046815a62a80366458aade4ec5d5476577a93', class: "order-summary__details" }, index.h("slot", { key: '02d129ef0caf523ec0c9da34318df46d3b008376', name: "orderSummaryTotalDetail" })))), index.h("slot", { key: '9395396883f0594ad8db216a9aa9fa0aeff45c10', name: "orderSummaryChoice" }), index.h("div", { key: '462672abc490cde00fea90ea585f48875ca2ec47', class: "order-summary__button-wrapper" }, index.h("lottery-button", { key: '1885bee3570ce6b58d4ae1977c635f418485fdbe', onClick: this.handleSubmit.bind(this), loading: this.submitLoading, disabled: this.submitDisabled, text: this.submitButtonText })))));
2816
+ }
2817
+ static get watchers() { return {
2818
+ "clientStyling": ["handleClientStylingChange"],
2819
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
2820
+ "mbSource": ["handleMbSourceChange"]
2821
+ }; }
2822
+ };
2823
+ LotteryOrderSummary.style = LotteryOrderSummaryStyle0;
2824
+
2825
+ // This icon file is generated automatically.
2826
+ var DeleteFilled = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M864 256H736v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zm-200 0H360v-72h304v72z" } }] }, "name": "delete", "theme": "filled" };
2827
+ const DeleteFilled$1 = DeleteFilled;
2828
+
2829
+ // This icon file is generated automatically.
2830
+ var DeleteOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z" } }] }, "name": "delete", "theme": "outlined" };
2831
+ const DeleteOutlined$1 = DeleteOutlined;
2832
+
2833
+ // This icon file is generated automatically.
2834
+ var InfoCircleOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M464 336a48 48 0 1096 0 48 48 0 10-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z" } }] }, "name": "info-circle", "theme": "outlined" };
2835
+ const InfoCircleOutlined$1 = InfoCircleOutlined;
2836
+
2837
+ // This icon file is generated automatically.
2838
+ var LeftOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z" } }] }, "name": "left", "theme": "outlined" };
2839
+ const LeftOutlined$1 = LeftOutlined;
2840
+
2841
+ // This icon file is generated automatically.
2842
+ var LoadingOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z" } }] }, "name": "loading", "theme": "outlined" };
2843
+ const LoadingOutlined$1 = LoadingOutlined;
2844
+
2845
+ // This icon file is generated automatically.
2846
+ var PlusSquareOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M328 544h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z" } }, { "tag": "path", "attrs": { "d": "M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z" } }] }, "name": "plus-square", "theme": "outlined" };
2847
+ const PlusSquareOutlined$1 = PlusSquareOutlined;
2848
+
2849
+ // This icon file is generated automatically.
2850
+ var RightOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z" } }] }, "name": "right", "theme": "outlined" };
2851
+ const RightOutlined$1 = RightOutlined;
2852
+
2853
+ var __assign = (undefined && undefined.__assign) || function () {
2854
+ __assign = Object.assign || function(t) {
2855
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
2856
+ s = arguments[i];
2857
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
2858
+ t[p] = s[p];
2859
+ }
2860
+ return t;
2861
+ };
2862
+ return __assign.apply(this, arguments);
2863
+ };
2864
+ var defaultColors = {
2865
+ primaryColor: '#333',
2866
+ secondaryColor: '#E6E6E6'
2867
+ };
2868
+ function renderIconDefinitionToSVGElement(icond, options) {
2869
+ if (options === void 0) { options = {}; }
2870
+ if (typeof icond.icon === 'function') {
2871
+ // two-tone
2872
+ var placeholders = options.placeholders || defaultColors;
2873
+ return renderAbstractNodeToSVGElement(icond.icon(placeholders.primaryColor, placeholders.secondaryColor), options);
2874
+ }
2875
+ // fill, outline
2876
+ return renderAbstractNodeToSVGElement(icond.icon, options);
2877
+ }
2878
+ function renderAbstractNodeToSVGElement(node, options) {
2879
+ var targetAttrs = node.tag === 'svg'
2880
+ ? __assign(__assign({}, node.attrs), (options.extraSVGAttrs || {})) : node.attrs;
2881
+ var attrs = Object.keys(targetAttrs).reduce(function (acc, nextKey) {
2882
+ var key = nextKey;
2883
+ var value = targetAttrs[key];
2884
+ var token = "".concat(key, "=\"").concat(value, "\"");
2885
+ acc.push(token);
2886
+ return acc;
2887
+ }, []);
2888
+ var attrsToken = attrs.length ? ' ' + attrs.join(' ') : '';
2889
+ var children = (node.children || [])
2890
+ .map(function (child) { return renderAbstractNodeToSVGElement(child, options); })
2891
+ .join('');
2892
+ if (children && children.length) {
2893
+ return "<".concat(node.tag).concat(attrsToken, ">").concat(children, "</").concat(node.tag, ">");
2894
+ }
2895
+ return "<".concat(node.tag).concat(attrsToken, " />");
2896
+ }
2897
+
2898
+ // Basic sanitization method for SVG content
2899
+ // This is NOT a complete XSS prevention for SVG, but prevents common attacks.
2900
+ function sanitizeSvg(svgString) {
2901
+ let sanitized = svgString.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, ''); // Remove <script> tags
2902
+ sanitized = sanitized.replace(/on[a-z]+=[\"'][^\"']*[\"']/gi, ''); // Remove on* attributes
2903
+ sanitized = sanitized.replace(/javascript:/gi, ''); // Remove javascript: URLs
2904
+ return sanitized;
2905
+ }
2906
+
2907
+ const lotterySelectionCss = ":host{display:inline-block}.lottery-selection__button{display:flex;align-items:center;justify-content:center;width:var(--lottery-selection-width, 32px);height:var(--lottery-selection-height, 32px);padding:var(--lottery-selection-padding, 0);box-sizing:border-box;background:var(--lottery-selection-background, var(--emw--color-background, #fff));border:var(--lottery-selection-border-width, 2px) var(--lottery-selection-border-style, solid) var(--lottery-selection-border-color, var(--emw--color-primary, #0d196e));border-radius:var(--lottery-selection-border-radius, var(--emw--border-radius-medium, 8px));color:var(--lottery-selection-color, var(--emw--color-typography, #000));font-weight:var(--lottery-selection-font-weight, bold);font-size:var(--lottery-selection-font-size, 1em);cursor:pointer;user-select:none;}.lottery-selection__button:hover{background:var(--lottery-selection-hover-background, var(--emw--color-background, #fff));border-color:var(--lottery-selection-hover-border-color, var(--emw--color-primary, #0d196e));color:var(--lottery-selection-hover-color, var(--emw--color-typography, #000))}.lottery-selection__button .lottery-selection__delete-icon{display:none}.lottery-selection__button.isDeleteByIcon:hover .lottery-selection__text{display:none}.lottery-selection__button.isDeleteByIcon:hover .lottery-selection__delete-icon{display:flex;align-items:center;justify-content:center;fill:var(--lottery-selection-delete-icon-color, var(--emw--color-typography, #000));vertical-align:middle}.lottery-selection__button.lottery-selection__button--selected{background-color:var(--lottery-selection-selected-background, var(--emw--color-primary, #0d196e));border-color:var(--lottery-selection-selected-border-color, var(--emw--color-primary, #0d196e));color:var(--lottery-selection-selected-color, var(--emw--color-typography-inverse, #fff))}.lottery-selection__button.lottery-selection__button--disabled{background-color:var(--lottery-selection-disabled-background, var(--emw--color-gray-50, #f5f5f5));border-color:var(--lottery-selection-disabled-border-color, var(--emw--color-gray-100, #e6e6e6));color:var(--lottery-selection-disabled-color, var(--emw--color-gray-150, #6f6f6f));cursor:not-allowed;pointer-events:none;}.lottery-selection__button.lottery-selection__button--no-border{border:none}.lottery-selection__button.lottery-selection__button--no-background{background:transparent}";
2908
+ const LotterySelectionStyle0 = lotterySelectionCss;
2909
+
2910
+ const LotterySelection = class {
2911
+ constructor(hostRef) {
2912
+ index.registerInstance(this, hostRef);
2913
+ this.lotteryBulletClickHandler = index.createEvent(this, "lotteryBulletClick", 7);
2914
+ this.value = 0;
2915
+ this.text = undefined;
2916
+ this.idx = undefined;
2917
+ this.type = 'toggle';
2918
+ this.mbSource = undefined;
2919
+ this.clientStyling = undefined;
2920
+ this.clientStylingUrl = undefined;
2921
+ this.hasBorder = true;
2922
+ this.hasBackground = true;
2923
+ this.deleteIconSvg = '';
2924
+ this.deleteIconWidth = '16px';
2925
+ this.deleteIconHeight = '16px';
2926
+ }
2927
+ handleClientStylingChange(newValue, oldValue) {
2928
+ if (newValue !== oldValue) {
2929
+ lotteryTippingTicketBuy.setClientStyling(this.stylingContainer, this.clientStyling);
2930
+ }
2931
+ }
2932
+ handleClientStylingUrlChange(newValue, oldValue) {
2933
+ if (newValue !== oldValue) {
2934
+ lotteryTippingTicketBuy.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2935
+ }
2936
+ }
2937
+ handleMbSourceChange(newValue, oldValue) {
2938
+ if (newValue !== oldValue) {
2939
+ lotteryTippingTicketBuy.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
2940
+ }
2941
+ }
2942
+ componentDidLoad() {
2943
+ if (this.stylingContainer) {
2944
+ if (this.mbSource)
2945
+ lotteryTippingTicketBuy.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
2946
+ if (this.clientStyling)
2947
+ lotteryTippingTicketBuy.setClientStyling(this.stylingContainer, this.clientStyling);
2948
+ if (this.clientStylingUrl)
2949
+ lotteryTippingTicketBuy.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2950
+ }
2951
+ }
2952
+ disconnectedCallback() {
2953
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
2954
+ }
2955
+ handleClick() {
2956
+ if (this.type === 'disabled' || this.type === 'readonly') {
2957
+ return;
2958
+ }
2959
+ console.log('bullet clicked', this.type, this.idx, this.text, this.value);
2960
+ this.lotteryBulletClickHandler.emit({
2961
+ type: this.type,
2962
+ idx: this.idx,
2963
+ text: this.text,
2964
+ value: this.value
2965
+ });
2966
+ }
2967
+ render() {
2968
+ let iconToRender;
2969
+ if (this.deleteIconSvg) {
2970
+ iconToRender = sanitizeSvg(this.deleteIconSvg);
2971
+ }
2972
+ else {
2973
+ iconToRender = renderIconDefinitionToSVGElement(DeleteFilled$1, {
2974
+ extraSVGAttrs: {
2975
+ width: this.deleteIconWidth,
2976
+ height: this.deleteIconHeight,
2977
+ fill: 'currentColor'
2978
+ }
2979
+ });
2980
+ }
2981
+ return (index.h("div", { key: '0d1e8aaa80a907a7467410f6b27b4b6175e82299', class: "lottery-selection", ref: (el) => (this.stylingContainer = el) }, index.h("button", { key: '11a2402abbc290dc877ad95f3433092c3a0d8419', class: {
2982
+ 'lottery-selection__button': true,
2983
+ 'lottery-selection__button--selected': this.value == 1,
2984
+ 'lottery-selection__button--disabled': this.type === 'disabled',
2985
+ 'lottery-selection__button--no-border': !this.hasBorder,
2986
+ 'lottery-selection__button--no-background': !this.hasBackground,
2987
+ isDeleteByIcon: this.type === 'delete',
2988
+ isCallDialogBtn: this.type === 'input' || this.type === 'readonly'
2989
+ }, onClick: this.handleClick.bind(this), disabled: this.type === 'disabled' }, this.type === 'delete' && index.h("span", { key: 'f99001d936a8f7bdf8adc5c46e82caf730a9442a', class: "lottery-selection__delete-icon", innerHTML: iconToRender }), index.h("span", { key: '55775e2492a1fe45cc8a457ac0a0d206744461ab', class: "lottery-selection__text" }, this.text))));
2990
+ }
2991
+ static get watchers() { return {
2992
+ "clientStyling": ["handleClientStylingChange"],
2993
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
2994
+ "mbSource": ["handleMbSourceChange"]
2995
+ }; }
2996
+ };
2997
+ LotterySelection.style = LotterySelectionStyle0;
2998
+
2999
+ const DEFAULT_LANGUAGE$2 = 'en';
3000
+ const SUPPORTED_LANGUAGES$2 = ['ro', 'en', 'fr', 'ar', 'hr', 'zh'];
3001
+ const TRANSLATIONS$2 = {
3002
+ en: {
3003
+ noTicketBoard: 'No ticket board available.',
3004
+ selectionCleared: 'Your selection has been cleared.',
3005
+ clearAll: 'Clear All',
3006
+ stopAt: 'Stop at',
3007
+ turnover: 'Turnover: ',
3008
+ pleaseFillIn: 'Please fill in all the selection input!',
3009
+ fillIn: 'Fill in',
3010
+ noBets: 'Sorry. No bets have been placed so far. Check back later!',
3011
+ search: 'Search',
3012
+ clear: 'Clear',
3013
+ oddsChart: 'Odds Chart',
3014
+ ticketSuccess: 'Ticket purchased successfully.',
3015
+ stakePerLine: 'Stake per Line:',
3016
+ lowestOdds: 'Lowest Odds:',
3017
+ highestOdds: 'Highest Odds:',
3018
+ orderSummary: 'ORDER SUMMARY',
3019
+ ticket: 'Ticket',
3020
+ lines: 'Lines',
3021
+ total: 'Total',
3022
+ submit: 'Submit',
3023
+ loading: 'Loading',
3024
+ enterValidNumber: 'Please enter a valid number.',
3025
+ enterNumberBetween: 'Please enter a number between {min} and {max}.',
3026
+ numberAlreadySelected: 'This number has already been selected.',
3027
+ enterScoreUpTo: 'Please enter the score (Up to {maxScore})',
3028
+ enterValue: 'Please enter a value',
3029
+ myChoices: 'My Choices',
3030
+ teams: 'Teams',
3031
+ scores: 'Scores',
3032
+ euro: 'Euro',
3033
+ cancel: 'Cancel',
3034
+ confirm: 'Confirm'
3035
+ },
3036
+ ro: {},
3037
+ fr: {},
3038
+ ar: {},
3039
+ hr: {}
3040
+ };
3041
+ const translate$2 = (key, customLang, replacements) => {
3042
+ const lang = customLang;
3043
+ let translation = TRANSLATIONS$2[lang !== undefined && SUPPORTED_LANGUAGES$2.includes(lang) ? lang : DEFAULT_LANGUAGE$2][key];
3044
+ if (replacements) {
3045
+ Object.keys(replacements).forEach((placeholder) => {
3046
+ translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
3047
+ });
3048
+ }
3049
+ return translation;
3050
+ };
3051
+ const getTranslations$2 = (data) => {
3052
+ Object.keys(data).forEach((item) => {
3053
+ for (let key in data[item]) {
3054
+ TRANSLATIONS$2[item][key] = data[item][key];
3055
+ }
3056
+ });
3057
+ };
3058
+
3059
+ function getBulletTextsSet(bulletTexts, splitToken) {
3060
+ return new Set(bulletTexts ? bulletTexts.split(splitToken) : []);
3061
+ }
3062
+ function validateInput({ value, selectedSet, maxValue, minValue, language, type = 'integer' }) {
3063
+ const trimmedValue = value.trim();
3064
+ if (type === 'integer') {
3065
+ // Strict integer check
3066
+ if (!/^-?\d+$/.test(trimmedValue)) {
3067
+ return {
3068
+ valid: false,
3069
+ errorMessage: translate$2('enterValidNumber', language),
3070
+ value
3071
+ };
3072
+ }
3073
+ const numValue = Number(trimmedValue);
3074
+ if (isNaN(numValue)) {
3075
+ return {
3076
+ valid: false,
3077
+ errorMessage: translate$2('enterValidNumber', language),
3078
+ value
3079
+ };
3080
+ }
3081
+ if ((minValue !== undefined && numValue < minValue) || (maxValue !== undefined && numValue > maxValue)) {
3082
+ return {
3083
+ valid: false,
3084
+ errorMessage: translate$2('enterNumberBetween', language, {
3085
+ min: minValue,
3086
+ max: maxValue
3087
+ }),
3088
+ value
3089
+ };
3090
+ }
3091
+ // Normalize value (e.g. "05" -> "5") for set check
3092
+ const normalizedValue = String(numValue);
3093
+ if (selectedSet.has(normalizedValue)) {
3094
+ return {
3095
+ valid: false,
3096
+ errorMessage: translate$2('numberAlreadySelected', language),
3097
+ value
3098
+ };
3099
+ }
3100
+ }
3101
+ else {
3102
+ // Text mode validation
3103
+ if (selectedSet.has(trimmedValue)) {
3104
+ return {
3105
+ valid: false,
3106
+ errorMessage: translate$2('numberAlreadySelected', language), // Or generic 'alreadySelected' if available, but reusing key for now
3107
+ value
3108
+ };
3109
+ }
3110
+ }
3111
+ return {
3112
+ valid: true,
3113
+ errorMessage: '',
3114
+ value
3115
+ };
3116
+ }
3117
+ function removeBulletTexts(text, selectedArr) {
3118
+ return selectedArr.filter((s) => s !== text);
3119
+ }
3120
+ function addSelectedBulletTexts(text, selectedArr) {
3121
+ return selectedArr.concat([text]);
3122
+ }
3123
+ function removeAndAddSelectedBulletTexts(text, selectedArr, maxSelectedCount) {
3124
+ return selectedArr.slice(selectedArr.length - (maxSelectedCount - 1)).concat([text]);
3125
+ }
3126
+ function buildSelectedBulletTextsArr(item, selectedArr, maxSelectedCount) {
3127
+ if (item.type === 'delete') {
3128
+ return removeBulletTexts(item.text, selectedArr);
3129
+ }
3130
+ if (item.type === 'toggle') {
3131
+ if (selectedArr.includes(item.text)) {
3132
+ return removeBulletTexts(item.text, selectedArr);
3133
+ }
3134
+ if (selectedArr.length >= maxSelectedCount) {
3135
+ return removeAndAddSelectedBulletTexts(item.text, selectedArr, maxSelectedCount);
3136
+ }
3137
+ return addSelectedBulletTexts(item.text, selectedArr);
3138
+ }
3139
+ return [];
3140
+ }
3141
+
3142
+ const lotterySelectionGroupCss = ":host {\n width: 100%;\n}\n\n.lottery-selection-group {\n container-type: inline-size;\n padding: var(--lottery-selection-group-padding, 0);\n background: var(--lottery-selection-group-background, transparent);\n border: var(--lottery-selection-group-border, none);\n border-radius: var(--lottery-selection-group-border-radius, 0);\n}\n.lottery-selection-group__item {\n display: flex;\n flex-direction: var(--lottery-selection-group-flex-direction, row);\n align-items: var(--lottery-selection-group-item-align, center);\n justify-content: var(--lottery-selection-group-item-justify, flex-start);\n gap: var(--lottery-selection-group-item-gap, 16px);\n width: 100%;\n}\n.lottery-selection-group__item--left {\n width: var(--lottery-selection-group-label-width, 130px);\n min-width: var(--lottery-selection-group-label-min-width, auto);\n max-width: var(--lottery-selection-group-label-max-width, none);\n color: var(--lottery-selection-group-label-color, var(--emw--color-typography, #000));\n font-size: var(--lottery-selection-group-label-font-size, 1em);\n font-weight: var(--lottery-selection-group-label-font-weight, bold);\n text-align: var(--lottery-selection-group-label-align, left);\n white-space: var(--lottery-selection-group-label-white-space, normal);\n}\n.lottery-selection-group__item--right {\n flex: 1;\n display: flex;\n flex-wrap: var(--lottery-selection-group-bullets-wrap, wrap); /* Allow items to wrap */\n gap: var(--lottery-selection-group-bullets-gap, 8px); /* Gap between bullets */\n align-items: var(--lottery-selection-group-bullets-align, center);\n justify-content: var(--lottery-selection-group-bullets-justify, flex-start); /* Align bullets to start */\n}\n@container (max-width: 320px) {\n .lottery-selection-group__item--left {\n width: 100px;\n max-width: 100px;\n }\n}\n\n.dialog-input {\n width: 100%;\n padding: var(--lottery-selection-group-input-padding, 8px);\n border: var(--lottery-selection-group-input-border-width, 1px) var(--lottery-selection-group-input-border-style, solid) var(--lottery-selection-group-input-border-color, var(--emw--color-gray-100, #e6e6e6));\n border-radius: var(--lottery-selection-group-input-radius, 4px);\n background-color: var(--lottery-selection-group-input-bg, #fff);\n color: var(--lottery-selection-group-input-color, #000);\n box-sizing: border-box;\n margin-top: var(--lottery-selection-group-input-margin-top, 10px);\n font-size: var(--lottery-selection-group-input-font-size, 1em);\n}\n.dialog-input::placeholder {\n color: var(--lottery-selection-group-input-placeholder-color, #999);\n}\n\n.dialog-input.invalid,\n.dialog-input.invalid:focus {\n border-color: var(--emw--color-error, #ff3d00);\n outline-color: var(--emw--color-error, #ff3d00);\n}\n\n.error-message {\n color: var(--lottery-selection-group-error-color, var(--emw--color-error, #ff3d00));\n font-size: var(--lottery-selection-group-error-font-size, 12px);\n font-weight: var(--lottery-selection-group-error-font-weight, normal);\n margin-top: 4px;\n}\n\n.addSelectionDialog-title {\n color: var(--lottery-selection-group-dialog-title-color, var(--emw--color-typography, #000));\n font-size: var(--lottery-selection-group-dialog-title-font-size, 1.2em);\n font-weight: var(--lottery-selection-group-dialog-title-font-weight, bold);\n margin-bottom: var(--lottery-selection-group-dialog-title-margin-bottom, 0);\n}\n.addSelectionDialog-footer {\n display: flex;\n justify-content: var(--lottery-selection-group-dialog-footer-justify, flex-end);\n gap: var(--lottery-selection-group-dialog-footer-gap, 18px);\n margin-top: var(--lottery-selection-group-dialog-footer-margin-top, 0);\n}";
3143
+ const LotterySelectionGroupStyle0 = lotterySelectionGroupCss;
3144
+
3145
+ const LotterySelectionGroup = class {
3146
+ constructor(hostRef) {
3147
+ index.registerInstance(this, hostRef);
3148
+ this.bulletGroupUpdateSelectedBulletTexts = index.createEvent(this, "bulletGroupUpdateSelection", 7);
3149
+ this.mbSource = undefined;
3150
+ this.clientStyling = undefined;
3151
+ this.clientStylingUrl = undefined;
3152
+ this.language = 'en';
3153
+ this.translationUrl = '';
3154
+ this.splitToken = ',';
3155
+ this.selectionGroupId = undefined;
3156
+ this.selectionGroupLabel = undefined;
3157
+ this.type = 'bet';
3158
+ this.selectedBulletTexts = null;
3159
+ this.maxSelectedCount = null;
3160
+ this.maxDisplayBulletsCount = 11;
3161
+ this.bulletTexts = null;
3162
+ this.maxIntegerBulletText = null;
3163
+ this.minIntegerBulletText = 0;
3164
+ this.bulletTextType = 'integer';
3165
+ this.hasBorder = true;
3166
+ this.hasBackground = true;
3167
+ this.dialogTitle = undefined;
3168
+ this.dialogInputPlaceholder = undefined;
3169
+ this.disabledBulletTexts = '';
3170
+ this.dialogConfig = {
3171
+ width: '400px',
3172
+ visible: false,
3173
+ onConfirm: () => this.handleFillInAddMore(),
3174
+ onCancel: () => this.handleCloseAddMoreDialog()
3175
+ };
3176
+ this.inputInfo = { valid: true, errorMessage: '', value: '' };
3177
+ }
3178
+ handleClientStylingChange(newValue, oldValue) {
3179
+ if (newValue != oldValue) {
3180
+ lotteryTippingTicketBuy.setClientStyling(this.stylingContainer, this.clientStyling);
3181
+ }
3182
+ }
3183
+ handleClientStylingUrlChange(newValue, oldValue) {
3184
+ if (newValue != oldValue) {
3185
+ lotteryTippingTicketBuy.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
3186
+ }
3187
+ }
3188
+ handleMbSourceChange(newValue, oldValue) {
3189
+ if (newValue != oldValue) {
3190
+ lotteryTippingTicketBuy.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
3191
+ }
3192
+ }
3193
+ componentWillLoad() {
3194
+ if (this.translationUrl) {
3195
+ getTranslations$2(JSON.parse(this.translationUrl));
3196
+ }
3197
+ }
3198
+ componentDidLoad() {
3199
+ if (this.stylingContainer) {
3200
+ if (this.mbSource)
3201
+ lotteryTippingTicketBuy.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
3202
+ if (this.clientStyling)
3203
+ lotteryTippingTicketBuy.setClientStyling(this.stylingContainer, this.clientStyling);
3204
+ if (this.clientStylingUrl)
3205
+ lotteryTippingTicketBuy.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
3206
+ }
3207
+ }
3208
+ disconnectedCallback() {
3209
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
3210
+ }
3211
+ lotteryBulletClickHandler(event) {
3212
+ event.stopPropagation();
3213
+ // if it's input type, open the dialog
3214
+ if (event.detail.type === 'input') {
3215
+ this.dialogConfig = Object.assign(Object.assign({}, this.dialogConfig), { visible: true });
3216
+ return;
3217
+ }
3218
+ if (['delete', 'toggle'].includes(event.detail.type)) {
3219
+ this.bulletGroupUpdateSelectedBulletTexts.emit({
3220
+ newSelectedBulletTexts: buildSelectedBulletTextsArr(event.detail, Array.from(this.selectedSet), this.maxSelectedCount).join(this.splitToken),
3221
+ selectionGroupId: this.selectionGroupId
3222
+ });
3223
+ return;
3224
+ }
3225
+ }
3226
+ get selectedSet() {
3227
+ return getBulletTextsSet(this.selectedBulletTexts, this.splitToken);
3228
+ }
3229
+ get disabledSet() {
3230
+ return getBulletTextsSet(this.disabledBulletTexts, this.splitToken);
3231
+ }
3232
+ get bulletTextsSet() {
3233
+ if (this.bulletTexts)
3234
+ return getBulletTextsSet(this.bulletTexts, this.splitToken);
3235
+ if (this.bulletTextType === 'integer' &&
3236
+ this.maxIntegerBulletText !== null &&
3237
+ this.maxIntegerBulletText !== undefined) {
3238
+ return getBulletTextsSet(Array.from({ length: Number(this.lastDisplayBulletText) - this.minIntegerBulletText + 1 }, (_, index) => this.minIntegerBulletText + index).join(this.splitToken), this.splitToken);
3239
+ }
3240
+ // If neither bulletTexts nor maxIntegerBulletText are provided,
3241
+ return new Set();
3242
+ }
3243
+ // the last bullet text
3244
+ get lastDisplayBulletText() {
3245
+ if (this.bulletTextType === 'integer') {
3246
+ if (this.maxIntegerBulletText !== null && this.maxIntegerBulletText !== undefined) {
3247
+ return Math.min(this.maxIntegerBulletText, this.minIntegerBulletText + this.maxDisplayBulletsCount - 1);
3248
+ }
3249
+ return this.minIntegerBulletText + this.maxDisplayBulletsCount - 1;
3250
+ }
3251
+ // Text mode: return the text at the max display index if available
3252
+ if (this.bulletTextsSet.size > 0) {
3253
+ const texts = Array.from(this.bulletTextsSet);
3254
+ if (texts.length >= this.maxDisplayBulletsCount) {
3255
+ return texts[this.maxDisplayBulletsCount - 1];
3256
+ }
3257
+ return texts[texts.length - 1]; // If fewer than maxDisplayBulletsCount, return the last one
3258
+ }
3259
+ return null;
3260
+ }
3261
+ get isSingleSelectionMode() {
3262
+ return this.maxSelectedCount === 1;
3263
+ }
3264
+ getBulletToRender() {
3265
+ const allBulletTexts = Array.from(this.bulletTextsSet);
3266
+ // Determine which bullets to display based on type and limit
3267
+ let bulletsToRender = allBulletTexts;
3268
+ let showInputButton = false;
3269
+ if (this.bulletTextType === 'text') {
3270
+ // For text, if we have more items than the limit, we need an input button.
3271
+ // The input button takes one slot, so we show (limit - 1) items.
3272
+ if (allBulletTexts.length > this.maxDisplayBulletsCount) {
3273
+ showInputButton = true;
3274
+ bulletsToRender = allBulletTexts.slice(0, this.maxDisplayBulletsCount - 1);
3275
+ }
3276
+ else {
3277
+ bulletsToRender = allBulletTexts;
3278
+ }
3279
+ }
3280
+ else {
3281
+ // For integer, logic is based on maxIntegerBulletText vs displayed range
3282
+ showInputButton =
3283
+ this.maxIntegerBulletText !== null &&
3284
+ this.maxIntegerBulletText !== undefined &&
3285
+ this.maxIntegerBulletText > Number(this.lastDisplayBulletText);
3286
+ // Integer bullets generation already respects the count, no slicing needed on the raw set
3287
+ bulletsToRender = allBulletTexts;
3288
+ }
3289
+ return {
3290
+ bulletsToRender,
3291
+ showInputButton
3292
+ };
3293
+ }
3294
+ renderBulletGroup() {
3295
+ let items = [];
3296
+ if (this.type === 'bet') {
3297
+ const isMaxSelected = this.maxSelectedCount !== null && this.selectedSet.size >= this.maxSelectedCount;
3298
+ const { bulletsToRender, showInputButton } = this.getBulletToRender();
3299
+ bulletsToRender.forEach((text, idx) => {
3300
+ let bulletType = 'toggle';
3301
+ if (this.disabledSet.has(String(text))) {
3302
+ bulletType = 'disabled';
3303
+ }
3304
+ else if (!this.selectedSet.has(String(text)) && isMaxSelected && !this.isSingleSelectionMode) {
3305
+ bulletType = 'disabled';
3306
+ }
3307
+ items.push({
3308
+ value: this.selectedSet.has(String(text)) ? 1 : 0,
3309
+ text: String(text),
3310
+ idx,
3311
+ type: bulletType
3312
+ });
3313
+ });
3314
+ if (showInputButton) {
3315
+ let inputBulletType = 'input';
3316
+ if (isMaxSelected && !this.isSingleSelectionMode) {
3317
+ inputBulletType = 'disabled';
3318
+ }
3319
+ const inputButtonText = this.bulletTextType === 'text' ? '...' : `${this.lastDisplayBulletText}+`;
3320
+ const inputButtonIdx = this.bulletTextType === 'text' ? -1 : Number(this.lastDisplayBulletText) + 1;
3321
+ // Special handling for integer mode:
3322
+ // If the generated set is "full" (size == maxDisplayBulletsCount),
3323
+ // we need to remove the last item to make room for the "N+" button
3324
+ // so the total visual count remains consistent.
3325
+ if (this.bulletTextType === 'integer' && items.length >= this.maxDisplayBulletsCount) {
3326
+ items.pop();
3327
+ }
3328
+ items.push({
3329
+ value: 0,
3330
+ text: inputButtonText,
3331
+ idx: inputButtonIdx,
3332
+ type: inputBulletType
3333
+ });
3334
+ }
3335
+ }
3336
+ else if (['choice', 'preview'].includes(this.type)) {
3337
+ // For choice/preview, also respect the visual limit for text mode
3338
+ const { bulletsToRender } = this.getBulletToRender();
3339
+ bulletsToRender.forEach((text, idx) => {
3340
+ let bulletType = 'toggle';
3341
+ if (this.disabledSet.has(String(text))) {
3342
+ bulletType = 'disabled';
3343
+ }
3344
+ else if (this.type === 'preview') {
3345
+ bulletType = 'readonly';
3346
+ }
3347
+ else if (this.selectedSet.has(String(text))) {
3348
+ bulletType = 'delete';
3349
+ }
3350
+ items.push({
3351
+ value: this.selectedSet.has(String(text)) ? 1 : 0,
3352
+ text,
3353
+ idx,
3354
+ type: bulletType
3355
+ });
3356
+ });
3357
+ }
3358
+ return (index.h("div", { class: "lottery-selection-group__item--right" }, items.map((item) => {
3359
+ return (index.h("lottery-selection", { clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl, mbSource: this.mbSource, text: item.text, idx: item.idx, value: item.value, type: item.type, hasBorder: this.hasBorder, hasBackground: this.hasBackground }));
3360
+ })));
3361
+ }
3362
+ handleCloseAddMoreDialog() {
3363
+ this.dialogConfig = Object.assign(Object.assign({}, this.dialogConfig), { visible: false });
3364
+ this.inputInfo = { value: '', errorMessage: '', valid: true };
3365
+ }
3366
+ handleInputChange(e) {
3367
+ const inputElement = e.target;
3368
+ const value = inputElement.value;
3369
+ this.inputInfo = Object.assign(Object.assign({}, this.inputInfo), { value: value });
3370
+ this.inputInfo = validateInput({
3371
+ value,
3372
+ selectedSet: this.selectedSet,
3373
+ maxValue: this.maxIntegerBulletText,
3374
+ minValue: this.bulletTextType === 'integer' ? Number(this.lastDisplayBulletText) + 1 : undefined,
3375
+ language: this.language,
3376
+ type: this.bulletTextType
3377
+ });
3378
+ }
3379
+ handleFillInAddMore() {
3380
+ if (this.inputInfo.valid) {
3381
+ const { value } = this.inputInfo;
3382
+ // Normalize the value (e.g., "05" -> "5") to match validation logic
3383
+ let normalizedValue = value;
3384
+ if (this.bulletTextType === 'integer') {
3385
+ normalizedValue = String(Number(value));
3386
+ }
3387
+ else {
3388
+ normalizedValue = value.trim();
3389
+ }
3390
+ let newSelectedBulletTexts;
3391
+ if (this.isSingleSelectionMode) {
3392
+ newSelectedBulletTexts = normalizedValue;
3393
+ }
3394
+ else {
3395
+ newSelectedBulletTexts = addSelectedBulletTexts(normalizedValue, Array.from(this.selectedSet)).join(this.splitToken);
3396
+ }
3397
+ this.bulletGroupUpdateSelectedBulletTexts.emit({
3398
+ newSelectedBulletTexts,
3399
+ selectionGroupId: this.selectionGroupId
3400
+ });
3401
+ this.handleCloseAddMoreDialog();
3402
+ }
3403
+ }
3404
+ render() {
3405
+ return (index.h("div", { key: '39225bad75cf435b166269367df570732eff7ef4', class: "lottery-selection-group", ref: (el) => (this.stylingContainer = el) }, index.h("div", { key: '2bb2bc539c9fc05aeece7145b13f722756bc054e', class: "lottery-selection-group__item" }, this.selectionGroupLabel && (index.h("div", { key: 'dc15197dca90375bd4eb50e87d96402d1ef694d2', class: "lottery-selection-group__item--left" }, this.selectionGroupLabel)), this.renderBulletGroup()), index.h("lottery-tipping-dialog", { key: '9526dbb5d1656d6724e6566465febde778437c64', visible: this.dialogConfig.visible, width: this.dialogConfig.width, onCancel: this.dialogConfig.onCancel }, index.h("div", { key: 'ecf5800430e92be4a2af279f1d8c5075d5965b7e', class: "addSelectionDialog" }, index.h("div", { key: '3e8a2f445679ef5fe2ada60d4a6832f472f27dfa', class: "addSelectionDialog-title" }, this.dialogTitle ||
3406
+ (this.bulletTextType === 'text'
3407
+ ? translate$2('enterValue', this.language)
3408
+ : translate$2('enterScoreUpTo', this.language, {
3409
+ maxScore: this.maxIntegerBulletText
3410
+ }))), index.h("input", { key: '46462ee8f27410639d45970a76fc3d90a03f3a10', type: "text", class: {
3411
+ 'dialog-input': true,
3412
+ invalid: !this.inputInfo.valid
3413
+ }, value: this.inputInfo.value, onInput: this.handleInputChange.bind(this), placeholder: this.dialogInputPlaceholder }), index.h("div", { key: '2e66988e4186f8f4f773ed548fc76e53085be946', class: "error-message" }, this.inputInfo.errorMessage)), index.h("div", { key: '81dc64f0b7cba422a54af8ecff4734aa19832583', slot: "footer", class: "addSelectionDialog-footer" }, index.h("lottery-button", { key: '3027240894aef525dc9fc50db79597cf29f9cb99', onClick: this.dialogConfig.onCancel, text: translate$2('cancel', this.language), variant: "outline" }), index.h("lottery-button", { key: 'ab8c6deed9ab4a7d79d71ed6fe8122b23af5741b', onClick: this.dialogConfig.onConfirm, text: translate$2('confirm', this.language), variant: "primary", disabled: !this.inputInfo.valid || !this.inputInfo.value })))));
3414
+ }
3415
+ static get watchers() { return {
3416
+ "clientStyling": ["handleClientStylingChange"],
3417
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
3418
+ "mbSource": ["handleMbSourceChange"]
3419
+ }; }
3420
+ };
3421
+ LotterySelectionGroup.style = LotterySelectionGroupStyle0;
3422
+
3423
+ const DEFAULT_LANGUAGE$1 = 'en';
3424
+ const SUPPORTED_LANGUAGES$1 = ['ro', 'en', 'fr', 'ar', 'hr'];
3425
+ const TRANSLATIONS$1 = {
3426
+ en: {
3427
+ homeTeam: 'Home team:',
3428
+ awayTeam: 'Away team:',
3429
+ loading: 'Loading...',
3430
+ error: 'Error!',
3431
+ noData: 'No data available.',
3432
+ lineInfo: 'Line {currentPage} of {totalPages}',
3433
+ clearAll: 'Clear All'
3434
+ },
3435
+ ro: {
3436
+ homeTeam: 'Echipa gazdă:',
3437
+ awayTeam: 'Echipa oaspete:',
3438
+ selectionCleared: 'Selecția dvs. a fost ștearsă.',
3439
+ selectionOnLineCleared: 'Selecția dvs. de pe această linie va fi ștearsă.',
3440
+ loading: `Se încarcă...',n error: 'Eroare!`,
3441
+ noData: 'Nu sunt date disponibile.',
3442
+ lineInfo: 'Linia {currentPage} din {totalPages}',
3443
+ clearAll: 'Șterge tot',
3444
+ cancel: 'Anulează',
3445
+ confirm: 'Confirmă'
3446
+ },
3447
+ fr: {
3448
+ homeTeam: 'Équipe à domicile:',
3449
+ awayTeam: `Équipe à l'extérieur:`,
3450
+ selectionCleared: 'Votre sélection a été effacée.',
3451
+ selectionOnLineCleared: 'Votre sélection sur cette ligne sera effacée.',
3452
+ loading: `Chargement...',n error: 'Erreur!`,
3453
+ noData: 'Aucune donnée disponible.',
3454
+ lineInfo: 'Ligne {currentPage} sur {totalPages}',
3455
+ clearAll: 'Tout effacer',
3456
+ cancel: 'Annuler',
3457
+ confirm: 'Confirmer'
3458
+ },
3459
+ ar: {
3460
+ homeTeam: 'الفريق المضيف:',
3461
+ awayTeam: 'الفريق الضيف:',
3462
+ selectionCleared: 'تم مسح اختيارك.',
3463
+ selectionOnLineCleared: 'سيتم مسح اختيارك في هذا السطر.',
3464
+ loading: `جار التحميل...',n error: 'خطأ!`,
3465
+ noData: 'لا توجد بيانات متاحة.',
3466
+ lineInfo: 'السطر {currentPage} من {totalPages}',
3467
+ clearAll: 'مسح الكل',
3468
+ cancel: 'إلغاء',
3469
+ confirm: 'تأكيد'
3470
+ },
3471
+ hr: {
3472
+ homeTeam: 'Domaći tim:',
3473
+ awayTeam: 'Gostujući tim:',
3474
+ selectionCleared: 'Vaš odabir je obrisan.',
3475
+ selectionOnLineCleared: 'Vaš odabir na ovoj liniji bit će obrisan.',
3476
+ loading: `Učitavanje...',n error: 'Greška!`,
3477
+ noData: 'Nema dostupnih podataka.',
3478
+ lineInfo: 'Linija {currentPage} od {totalPages}',
3479
+ clearAll: 'Očisti sve',
3480
+ cancel: 'Odustani',
3481
+ confirm: 'Potvrdi'
3482
+ }
3483
+ };
3484
+ const translate$1 = (key, customLang, replacements) => {
3485
+ const lang = customLang;
3486
+ let translation = TRANSLATIONS$1[lang !== undefined && SUPPORTED_LANGUAGES$1.includes(lang) ? lang : DEFAULT_LANGUAGE$1][key];
3487
+ if (replacements) {
3488
+ Object.keys(replacements).forEach((placeholder) => {
3489
+ translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
3490
+ });
3491
+ }
3492
+ return translation;
3493
+ };
3494
+ const getTranslations$1 = (data) => {
3495
+ Object.keys(data).forEach((item) => {
3496
+ for (let key in data[item]) {
3497
+ TRANSLATIONS$1[item][key] = data[item][key];
3498
+ }
3499
+ });
3500
+ };
3501
+ const resolveTranslationUrl$1 = async (translationUrl) => {
3502
+ if (translationUrl) {
3503
+ try {
3504
+ const response = await fetch(translationUrl);
3505
+ if (!response.ok) {
3506
+ throw new Error(`HTTP error! status: ${response.status}`);
3507
+ }
3508
+ const translations = await response.json();
3509
+ getTranslations$1(translations);
3510
+ }
3511
+ catch (error) {
3512
+ console.error('Failed to fetch or parse translations from URL:', error);
3513
+ }
3514
+ }
3515
+ };
3516
+
3517
+ const formatDate = ({ date, type = 'date', format: format$1 }) => {
3518
+ try {
3519
+ const parsedDate = lotteryTippingTicketBuy.parseISO(date);
3520
+ if (isNaN(parsedDate.getTime())) {
3521
+ throw new Error(`Invalid date: ${date}`);
3522
+ }
3523
+ if (format$1)
3524
+ return format(parsedDate, format$1);
3525
+ let formatStr = 'dd/MM/yyyy';
3526
+ if (type === 'time') {
3527
+ formatStr = 'dd/MM/yyyy HH:mm:ss';
3528
+ }
3529
+ else if (type === 'week') {
3530
+ formatStr = 'ccc dd/MM/yyyy HH:mm:ss';
3531
+ }
3532
+ return format(parsedDate, formatStr);
3533
+ }
3534
+ catch (error) {
3535
+ console.error('Error formatting date:', error.message);
3536
+ return '';
3537
+ }
3538
+ };
3539
+
3540
+ const lotteryTippingBetSlipCss = ":host {\n --lottery-button-border-radius: 16px;\n}\n\n.LotteryTippingTicketBet__container {\n display: block; /* Or inline-block, depending on desired layout flow */\n font-size: 14px;\n padding: 12px;\n border: 1px solid var(--emw--color-gray-100, #e6e6e6);\n border-radius: var(--emw--button-border-radius, 4px);\n line-height: 1.5715;\n color: var(--emw--color-typography, #000);\n background: var(--emw--color-background, #fff);\n overflow: hidden;\n min-width: 300px;\n container-type: inline-size;\n}\n@container (max-width: 375px) {\n .LotteryTippingTicketBet__container {\n font-size: 12px;\n }\n}\n\n.table-wrapper {\n overflow-x: auto; /* Handle horizontal scroll if content overflows */\n}\n\n.LotteryTippingTicketBet__main {\n overflow: hidden;\n}\n\n.table-scroll-wrapper {\n overflow-x: auto;\n flex-grow: 1;\n min-width: 0;\n}\n\n.my-table-component {\n width: 100%;\n border-collapse: collapse; /* Important for borders */\n text-align: left;\n border-radius: 0.1rem; /* Ant Design like subtle rounding */\n border-spacing: 0;\n}\n\n/* Header */\n.my-table-component th {\n background: var(--emw--color-background-secondary, #f5f5f5);\n color: var(--emw--color-typography, #000);\n font-weight: 500;\n padding: 0.4rem 0.5rem;\n transition: background 0.3s ease;\n}\n@container (max-width: 400px) {\n .my-table-component th {\n padding: 0.3rem 0.3rem;\n }\n}\n\n/* Cells */\n.my-table-component td {\n padding: 0.4rem 0.5rem;\n color: var(--emw--color-typography, #000);\n background: var(--emw--color-background, #fff);\n transition: background 0.3s;\n}\n@container (max-width: 400px) {\n .my-table-component td {\n padding: 0.3rem 0.3rem;\n }\n}\n\n.my-table-component th:nth-child(1),\n.my-table-component td:nth-child(1) {\n /* index */\n min-width: 10px;\n}\n.my-table-component th:nth-child(3),\n.my-table-component td:nth-child(3) {\n /* startTime */\n min-width: 60px;\n}\n.my-table-component th:nth-child(4),\n.my-table-component td:nth-child(4) {\n /* results */\n min-width: 120px;\n}\n\n.my-table-component.bordered th,\n.my-table-component.bordered td {\n border-bottom: 1px solid var(--emw--color-gray-100, #e6e6e6);\n}\n\n/* Bordered style */\n.my-table-component.grid th,\n.my-table-component.grid td {\n border: 1px solid var(--emw--color-gray-100, #e6e6e6);\n}\n\n.my-table-component.grid th {\n border-bottom-width: 1px; /* Ensure bottom border is consistent */\n}\n\n.my-table-component.grid {\n border: 1px solid var(--emw--color-gray-100, #e6e6e6); /* Outer border */\n border-right-width: 0;\n border-bottom-width: 0;\n}\n\n.my-table-component.grid th:last-child,\n.my-table-component.grid td:last-child {\n border-right: 1px solid var(--emw--color-gray-100, #e6e6e6);\n}\n\n.my-table-component.grid tr:last-child td {\n border-bottom: 1px solid var(--emw--color-gray-100, #e6e6e6);\n}\n\n/* Striped style */\n.my-table-component.striped tbody tr:nth-child(even) td {\n background-color: var(--emw--color-background-secondary, #f5f5f5);\n}\n\n/* Hover (optional, but nice) */\n.my-table-component tbody tr:hover td {\n background-color: var(--emw--color-background-secondary, #f5f5f5);\n}\n\n.flex {\n display: flex;\n}\n\n.justify-end {\n justify-content: flex-end;\n}\n\n.gap-1 {\n gap: 4px;\n}\n\n.justify-between {\n justify-content: space-between;\n}\n\n.align-center {\n align-items: center;\n}\n\n.gap-1 {\n gap: 0.5rem;\n}\n\n.btn {\n color: var(--emw--color-typography, #000);\n background: var(--emw--color-background, #fff);\n font-size: 14px;\n transition: all 0.2s ease;\n}\n.btn:hover {\n cursor: pointer;\n}\n\n.btn:hover {\n background-color: var(--emw--color-gray-100, #e6e6e6);\n}\n\n.btn.disabled {\n opacity: 0.5;\n pointer-events: none;\n}\n.btn.disabled:hover {\n cursor: not-allowed !important;\n}\n\n.LotteryTippingTicketBet__tableToolbar {\n width: 100%;\n margin-bottom: 1rem;\n}\n\n.LotteryTippingTicketBet__tableToolbar--item {\n margin-right: 2rem;\n}\n.LotteryTippingTicketBet__tableToolbar--item.mr-0 {\n margin-right: 0rem !important;\n}\n\n.LotteryTippingTicketBet__lineOperatorGroup {\n flex-basis: 2rem;\n display: flex;\n flex-direction: column;\n gap: 1rem;\n border-radius: 8px;\n}\n\n.LotteryTippingTicketBet__lineOperatorGroup--item {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 2rem;\n height: 2rem;\n background-color: var(--emw--color-background-secondary, #f5f5f5);\n color: var(--emw--color-typography, #000);\n border-radius: 8px;\n border: none;\n transition: all 0.2s ease-in-out;\n cursor: pointer;\n}\n\n.LotteryTippingTicketBet__lineOperatorGroup--item:hover {\n transform: scale(1.1);\n box-shadow: 0 6px 14px var(--emw-calender-curday-box-shadow, rgba(0, 0, 0, 0.09));\n}\n\n.LotteryTippingTicketBet__lineOperatorGroup--item .icon {\n width: 20px;\n height: 20px;\n transition: filter 0.2s ease-in-out;\n filter: grayscale(0.3);\n}\n\n.LotteryTippingTicketBet__lineOperatorGroup--item:hover .icon {\n filter: grayscale(0);\n transform: rotate(3deg);\n}\n\ndiv.border-line {\n margin-top: 1rem;\n height: 1px;\n width: 100%;\n box-sizing: border-box;\n background-color: var(--emw--color-background-secondary, #f5f5f5);\n transition: all 0.3s ease;\n}\n\n.LotteryTippingTicketBet__footer {\n padding: 0.5rem;\n}\n\n.my-pagination {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 1rem;\n font-size: 0.8rem;\n color: var(--emw--color-typography-secondary, #333);\n}\n\n.my-pagination span {\n font-weight: 500;\n user-select: none;\n}\n\n.my-pagination .btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 2rem;\n height: 2rem;\n border-radius: 50%;\n border: none;\n transition: all 0.3s ease;\n cursor: pointer;\n opacity: 0.9;\n color: var(--emw--color-typography, #000);\n background-color: var(--emw--color-background-secondary, #f5f5f5);\n}\n\n.my-pagination .btn .icon {\n width: 20px;\n height: 20px;\n transition: transform 0.2s ease;\n}\n\n.my-pagination .btn:hover {\n transform: scale(1.1);\n box-shadow: 0 6px 14px var(--emw-calender-curday-box-shadow, rgba(0, 0, 0, 0.09));\n}\n\n.my-pagination .btn.disabled {\n background-color: var(--emw--color-background-tertiary, #ccc);\n cursor: not-allowed;\n opacity: 0.5;\n transform: scale(1);\n}\n\n.match-info-item {\n display: flex;\n}\n\n.match-info-item-label {\n margin-right: 6px;\n}\n\n.info-icon:hover {\n cursor: pointer;\n}\n\n.LotteryTippingTicketBet__empty p {\n text-align: center;\n}\n\n.no-wrap {\n white-space: nowrap;\n overflow: hidden;\n}\n\n.eventNameContainer__item--title {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 300px;\n}\n@container (max-width: 600px) {\n .eventNameContainer__item--title {\n max-width: 180px;\n }\n}\n@container (max-width: 500px) {\n .eventNameContainer__item--title {\n max-width: 150px;\n }\n}\n@container (max-width: 400px) {\n .eventNameContainer__item--title {\n max-width: 100px;\n }\n}\n@container (max-width: 330px) {\n .eventNameContainer__item--title {\n max-width: 70px;\n }\n}\n\n.LotteryTippingTicketBet__main {\n perspective: 800px;\n will-change: transform, opacity;\n}\n\n@container (max-width: 520px) {\n .LotteryTippingTicketBet__main {\n flex-wrap: wrap;\n justify-content: center;\n }\n .LotteryTippingTicketBet__tableToolbar--item {\n margin-right: 0 !important;\n }\n}\n/* Fade-In Keyframes */\n@keyframes fadeInLeft {\n from {\n opacity: 0;\n transform: translateX(100%);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n/* Fade-Out Keyframes */\n@keyframes fadeOut {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n@keyframes fadeInRight {\n from {\n opacity: 0;\n transform: translateX(-100%);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n@keyframes fadeInUp {\n from {\n opacity: 0;\n transform: translateY(100%);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n@-webkit-keyframes slide-left {\n 0% {\n -webkit-transform: translateX(0);\n transform: translateX(0);\n }\n 100% {\n -webkit-transform: translateX(-100px);\n transform: translateX(-100px);\n }\n}\n@keyframes slide-left {\n 0% {\n -webkit-transform: translateX(100%);\n transform: translateX(100%);\n }\n 100% {\n -webkit-transform: translateX(0px);\n transform: translateX(0px);\n }\n}\n@-webkit-keyframes slide-right {\n 0% {\n -webkit-transform: translateX(-100%);\n transform: translateX(-100%);\n }\n 100% {\n -webkit-transform: translateX(0px);\n transform: translateX(0px);\n }\n}\n@keyframes slide-right {\n 0% {\n -webkit-transform: translateX(-100px);\n transform: translateX(-100px);\n }\n 100% {\n -webkit-transform: translateX(0);\n transform: translateX(0);\n }\n}\n@-webkit-keyframes slide-top {\n 0% {\n -webkit-transform: translateY(-100px);\n transform: translateY(-100px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slide-top {\n 0% {\n -webkit-transform: translateY(-100px);\n transform: translateY(-100px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n/* Apply to your card classes */\n.card-in-left {\n -webkit-animation: slide-left 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slide-left 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n}\n\n.card-out-left {\n animation: fadeOut 0.2s ease-out both;\n}\n\n.card-in-right {\n -webkit-animation: slide-right 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slide-right 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n}\n\n.card-out-right {\n animation: fadeOut 0.2s ease-out both;\n}\n\n.card-in-up {\n -webkit-animation: slide-top 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slide-top 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n}\n\n.card-out-down {\n animation: fadeOut 0.2s ease-out both;\n}\n\n.loading-wrap {\n margin: 20px 0;\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 40vh;\n}\n.loading-wrap .dots-container {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n}\n.loading-wrap .dot {\n height: 14px;\n width: 14px;\n margin-right: 14px;\n border-radius: 14px;\n background-color: var(--emw--color-gray-300, #333);\n animation: pulse 1.5s infinite ease-in-out;\n}\n.loading-wrap .dot:last-child {\n margin-right: 0;\n}\n.loading-wrap .dot:nth-child(1) {\n animation-delay: -0.3s;\n}\n.loading-wrap .dot:nth-child(2) {\n animation-delay: -0.1s;\n}\n.loading-wrap .dot:nth-child(3) {\n animation-delay: 0.1s;\n}\n@keyframes pulse {\n 0% {\n transform: scale(0.8);\n background-color: var(--emw--color-gray-300, #333);\n }\n 50% {\n transform: scale(1.2);\n background-color: var(--emw--color-gray-100, #e6e6e6);\n }\n 100% {\n transform: scale(0.8);\n background-color: var(--emw--color-gray-150, #6f6f6f);\n }\n}\n\n.lottery-selection-group-table-header .lottery-selection__button {\n border: none;\n background: none;\n}";
3541
+ const LotteryTippingBetSlipStyle0 = lotteryTippingBetSlipCss;
3542
+
3543
+ const MyTable = ({ columns, dataSource, hideHead = false, grid = true, bordered = true }) => (index.h("table", { class: { bordered: bordered, grid: grid, 'my-table-component': true } }, !hideHead && (index.h("thead", null, index.h("tr", null, columns.map((column) => {
3544
+ var _a;
3545
+ return (index.h("th", { key: column.value, style: { width: column.width + '%', textAlign: column.align } }, typeof column.title === 'string' ? column.title : (_a = column.title) === null || _a === void 0 ? void 0 : _a.call(column)));
3546
+ })))), index.h("tbody", null, dataSource.map((row, index$1) => (index.h("tr", { key: index$1 }, columns.map((column) => (index.h("td", { key: column.value, style: { width: column.width + '%', textAlign: column.align }, class: { 'no-wrap': column.nowrap } }, column.render ? column.render(row, row[column.value], index$1) : row[column.value])))))))));
3547
+ const LotteryTippingBetSlip = class {
3548
+ constructor(hostRef) {
3549
+ index.registerInstance(this, hostRef);
3550
+ this.selectionChangeHandler = index.createEvent(this, "lotteryTippingBetSelectionChange", 7);
3551
+ this.clearAll = index.createEvent(this, "lotteryTippingBetClearAll", 7);
3552
+ this.addLine = index.createEvent(this, "lotteryTippingBetAddLine", 7);
3553
+ this.removeLine = index.createEvent(this, "lotteryTippingBetRemoveLine", 7);
3554
+ this.pageChange = index.createEvent(this, "lotteryTippingBetPageChange", 7);
3555
+ this.columns = [
3556
+ { title: '', value: 'index', width: 3 },
3557
+ {
3558
+ title: '',
3559
+ value: 'eventName',
3560
+ width: 65,
3561
+ render: (item, value) => this.renderEventName(item, value)
3562
+ },
3563
+ {
3564
+ title: '',
3565
+ value: 'startTime',
3566
+ width: 22,
3567
+ align: 'right',
3568
+ nowrap: true,
3569
+ render: (_, value) => formatDate({ date: value, format: 'ccc HH:mm' })
3570
+ },
3571
+ {
3572
+ title: () => (index.h("lottery-selection-group", { language: this.language, "translation-url": this.translationUrl, "client-styling": this.clientStyling, clientStylingUrl: this.clientStylingUrl, type: "preview", splitToken: this.bulletTextsSplitToken, "bullet-texts": this.bulletNames, bulletTextType: "text", hasBackground: false, hasBorder: false })),
3573
+ value: 'results',
3574
+ width: 10,
3575
+ render: (_, __, curRow) => (index.h("lottery-selection-group", { language: this.language, "translation-url": this.translationUrl, "client-styling": this.clientStyling, clientStylingUrl: this.clientStylingUrl, "mb-source": this.mbSource, selectionGroupId: `${this.currentPage - 1}${this.bulletTextsSplitToken}${curRow}`, type: this.readPretty ? 'preview' : 'bet', "selected-bullet-texts": this.selectedBulletTexts(curRow), "disabled-bullet-texts": this.getBulletDisabledOptions(curRow), "max-selected-count": this.mode === 'single' ? 1 : this.bulletTexts.split(this.bulletTextsSplitToken).length, "bullet-texts": this.bulletTexts, splitToken: this.bulletTextsSplitToken, bulletTextType: "text" }))
3576
+ }
3577
+ ];
3578
+ this.mbSource = undefined;
3579
+ this.clientStyling = undefined;
3580
+ this.clientStylingUrl = undefined;
3581
+ this.translationUrl = '';
3582
+ this.language = 'en';
3583
+ this.totalPages = 1;
3584
+ this.minTotalPages = 1;
3585
+ this.maxTotalPages = 3;
3586
+ this.bulletTexts = '1,X,2';
3587
+ this.bulletNames = 'Home,Draw,Away';
3588
+ this.bulletTextsSplitToken = ',';
3589
+ this.showClearButton = true;
3590
+ this.addImage = renderIconDefinitionToSVGElement(PlusSquareOutlined$1, {
3591
+ extraSVGAttrs: { width: '20px', height: '20px', fill: 'currentColor' }
3592
+ });
3593
+ this.deleteImage = renderIconDefinitionToSVGElement(DeleteOutlined$1, {
3594
+ extraSVGAttrs: { width: '20px', height: '20px', fill: 'currentColor' }
3595
+ });
3596
+ this.infoImage = renderIconDefinitionToSVGElement(InfoCircleOutlined$1, {
3597
+ extraSVGAttrs: { width: '16px', height: '16px', fill: 'currentColor' }
3598
+ });
3599
+ this.leftImage = renderIconDefinitionToSVGElement(LeftOutlined$1, {
3600
+ extraSVGAttrs: { width: '20px', height: '20px', fill: 'currentColor' }
3601
+ });
3602
+ this.rightImage = renderIconDefinitionToSVGElement(RightOutlined$1, {
3603
+ extraSVGAttrs: { width: '20px', height: '20px', fill: 'currentColor' }
3604
+ });
3605
+ this.mode = 'multi';
3606
+ this.readPretty = false;
3607
+ this.ticketDataSourceStr = '[]';
3608
+ this.bulletSelectionsLineGroupStr = '[]';
3609
+ this.currentPage = 1;
3610
+ this.bulletSelectionsLineGroup = [];
3611
+ this.ticketDataSource = [];
3612
+ this.betIsLoading = false;
3613
+ this.betHasErrors = false;
3614
+ }
3615
+ renderEventName(_, value) {
3616
+ const [homeName, awayName] = value.split(' vs ');
3617
+ return (index.h("div", { class: "flex gap-1 eventNameContainer__item" }, index.h("span", { class: "eventNameContainer__item--title" }, value), index.h("app-tooltip", null, index.h("span", { slot: "trigger", class: "icon info-icon", innerHTML: this.infoImage, style: { width: '18px' } }), index.h("div", { slot: "content" }, index.h("div", { class: "match-info" }, index.h("div", { class: "match-info-item" }, index.h("div", { class: "match-info-item-label" }, translate$1('homeTeam', this.language)), index.h("div", { class: "match-info-item-value" }, homeName)), index.h("div", { class: "match-info-item" }, index.h("div", { class: "match-info-item-label" }, translate$1('awayTeam', this.language)), index.h("div", { class: "match-info-item-value" }, awayName)))))));
3618
+ }
3619
+ selectedBulletTexts(curRow) {
3620
+ var _a, _b, _c;
3621
+ return ((_c = (_b = (_a = this.bulletSelectionsLineGroup) === null || _a === void 0 ? void 0 : _a[this.currentPage - 1]) === null || _b === void 0 ? void 0 : _b[curRow]) === null || _c === void 0 ? void 0 : _c.join(this.bulletTextsSplitToken)) || '';
3622
+ }
3623
+ getBulletDisabledOptions(curRow) {
3624
+ const { outcomes } = this.ticketDataSource[curRow];
3625
+ const curActiveOptions = outcomes.map((ev) => ev.betOn);
3626
+ const bulletText = this.bulletTexts.split(this.bulletTextsSplitToken);
3627
+ const disabledOptions = bulletText.filter((bullet) => !curActiveOptions.includes(bullet));
3628
+ return disabledOptions.join(this.bulletTextsSplitToken);
3629
+ }
3630
+ handleNewTranslations() {
3631
+ resolveTranslationUrl$1(this.translationUrl);
3632
+ }
3633
+ handleClientStylingChange(newValue, oldValue) {
3634
+ if (newValue != oldValue) {
3635
+ lotteryTippingTicketBuy.setClientStyling(this.stylingContainer, this.clientStyling);
3636
+ }
3637
+ }
3638
+ handleClientStylingUrlChange(newValue, oldValue) {
3639
+ if (newValue != oldValue) {
3640
+ lotteryTippingTicketBuy.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
3641
+ }
3642
+ }
3643
+ handleMbSourceChange(newValue, oldValue) {
3644
+ if (newValue != oldValue) {
3645
+ lotteryTippingTicketBuy.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
3646
+ }
3647
+ }
3648
+ parseTicketDataSource(newValue) {
3649
+ try {
3650
+ this.ticketDataSource = JSON.parse(newValue || '[]');
3651
+ }
3652
+ catch (e) {
3653
+ console.error('Failed to parse ticketDataSourceStr:', e);
3654
+ }
3655
+ }
3656
+ parseBulletSelectionsLineGroup(newValue) {
3657
+ try {
3658
+ this.bulletSelectionsLineGroup = JSON.parse(newValue || '[]');
3659
+ }
3660
+ catch (e) {
3661
+ console.error('Failed to parse bulletSelectionsLineGroupStr:', e);
3662
+ }
3663
+ }
3664
+ connectedCallback() {
3665
+ this.boundMessageHandler = this.messageHandler.bind(this);
3666
+ window.addEventListener('message', this.boundMessageHandler);
3667
+ }
3668
+ disconnectedCallback() {
3669
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
3670
+ if (this.boundMessageHandler) {
3671
+ window.removeEventListener('message', this.boundMessageHandler);
3672
+ }
3673
+ }
3674
+ messageHandler() {
3675
+ // This handler can be kept for other potential messages, or removed if no longer needed.
3676
+ }
3677
+ componentWillLoad() {
3678
+ resolveTranslationUrl$1(this.translationUrl);
3679
+ this.parseTicketDataSource(this.ticketDataSourceStr);
3680
+ this.parseBulletSelectionsLineGroup(this.bulletSelectionsLineGroupStr);
3681
+ }
3682
+ componentDidLoad() {
3683
+ if (this.stylingContainer) {
3684
+ if (this.mbSource)
3685
+ lotteryTippingTicketBuy.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
3686
+ if (this.clientStyling)
3687
+ lotteryTippingTicketBuy.setClientStyling(this.stylingContainer, this.clientStyling);
3688
+ if (this.clientStylingUrl)
3689
+ lotteryTippingTicketBuy.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
3690
+ }
3691
+ }
3692
+ handleClearAll() {
3693
+ this.clearAll.emit();
3694
+ }
3695
+ bulletGroupUpdateSelectionHandler(event) {
3696
+ event.stopPropagation();
3697
+ const { newSelectedBulletTexts, selectionGroupId } = event.detail;
3698
+ if (!selectionGroupId) {
3699
+ console.error('Miss selectionGroupId');
3700
+ return;
3701
+ }
3702
+ const idParts = selectionGroupId.split(this.bulletTextsSplitToken);
3703
+ if (idParts.length !== 2) {
3704
+ console.error('Invalid selectionGroupId format:', selectionGroupId);
3705
+ return;
3706
+ }
3707
+ const [boardId, matchId] = idParts;
3708
+ this.selectionChangeHandler.emit({
3709
+ newSelections: newSelectedBulletTexts.split(this.bulletTextsSplitToken),
3710
+ matchId,
3711
+ boardId
3712
+ });
3713
+ }
3714
+ prevPage() {
3715
+ const doPrev = () => {
3716
+ this.pageChange.emit({ newPage: this.currentPage - 1 });
3717
+ };
3718
+ this.swapCard('prev', doPrev);
3719
+ }
3720
+ nextPage() {
3721
+ const doNext = () => {
3722
+ this.pageChange.emit({ newPage: this.currentPage + 1 });
3723
+ };
3724
+ this.swapCard('next', doNext);
3725
+ }
3726
+ handleAddLine() {
3727
+ const doAdd = () => {
3728
+ this.addLine.emit();
3729
+ };
3730
+ this.swapCard('add', doAdd);
3731
+ }
3732
+ handleRemoveLine() {
3733
+ this.removeLine.emit({
3734
+ boardId: this.currentPage - 1,
3735
+ close: (onClose) => {
3736
+ onClose && this.swapCard('remove', onClose);
3737
+ }
3738
+ });
3739
+ }
3740
+ swapCard(action, cb) {
3741
+ const wrapper = this.mainContainer;
3742
+ if (!wrapper)
3743
+ return;
3744
+ // Prevent new animations if one is already in progress
3745
+ const isAnimating = Array.from(wrapper.classList).some((cls) => cls.startsWith('card-out-') || cls.startsWith('card-in-'));
3746
+ if (isAnimating) {
3747
+ return;
3748
+ }
3749
+ const map = {
3750
+ next: { out: 'card-out-left', in: 'card-in-left' },
3751
+ prev: { out: 'card-out-right', in: 'card-in-right' },
3752
+ remove: { out: 'card-out-down', in: 'card-in-right' },
3753
+ add: { out: 'card-out-left', in: 'card-in-up' }
3754
+ };
3755
+ const { out: outCls, in: inCls } = map[action];
3756
+ wrapper.classList.add(outCls);
3757
+ wrapper.addEventListener('animationend', () => {
3758
+ wrapper.classList.remove(outCls);
3759
+ cb();
3760
+ const newWrapper = this.mainContainer;
3761
+ if (!newWrapper)
3762
+ return;
3763
+ newWrapper.classList.add(inCls);
3764
+ newWrapper.addEventListener('animationend', () => newWrapper.classList.remove(inCls), { once: true });
3765
+ }, { once: true });
3766
+ }
3767
+ renderLoading() {
3768
+ return (index.h("div", { class: "loading-wrap" }, index.h("section", { class: "dots-container" }, index.h("div", { class: "dot" }), index.h("div", { class: "dot" }), index.h("div", { class: "dot" }), index.h("div", { class: "dot" }), index.h("div", { class: "dot" }))));
3769
+ }
3770
+ renderErrorContent() {
3771
+ return index.h("p", null, translate$1('error', this.language));
3772
+ }
3773
+ renderEmptyContent() {
3774
+ return (index.h("div", { class: "LotteryTippingTicketBet__empty" }, index.h("p", null, translate$1('noData', this.language))));
3775
+ }
3776
+ renderPageFooter() {
3777
+ if (this.totalPages <= 1)
3778
+ return null;
3779
+ return (index.h("div", null, index.h("div", { class: 'border-line' }), index.h("div", { class: "LotteryTippingTicketBet__footer" }, index.h("div", { class: "my-pagination flex justify-between" }, index.h("span", null, translate$1('lineInfo', this.language, { currentPage: this.currentPage, totalPages: this.totalPages })), index.h("div", { class: 'flex gap-1' }, index.h("button", { type: "button", class: `btn ${this.currentPage === 1 ? 'disabled' : ''}`, onClick: () => this.prevPage(), disabled: this.currentPage === 1 }, index.h("span", { class: "icon", innerHTML: this.leftImage })), index.h("button", { type: "button", class: `btn ${this.currentPage === this.totalPages ? 'disabled' : ''}`, onClick: () => this.nextPage(), disabled: this.currentPage === this.totalPages }, index.h("span", { class: "icon", innerHTML: this.rightImage })))))));
3780
+ }
3781
+ renderReadPrettyContent() {
3782
+ var _a;
3783
+ return (index.h("div", { class: "LotteryTippingTicketBet__main", ref: (el) => (this.mainContainer = el) }, index.h("div", { class: "table-scroll-wrapper" }, index.h(MyTable, { columns: this.columns, dataSource: ((_a = this.ticketDataSource) === null || _a === void 0 ? void 0 : _a.map((item, index) => (Object.assign(Object.assign({}, item), { index: index + 1 })))) || [], hideHead: false, grid: false, bordered: false })), this.renderPageFooter()));
3784
+ }
3785
+ renderDefaultContent() {
3786
+ var _a;
3787
+ const lineOperatorAddShow = this.totalPages < this.maxTotalPages && this.currentPage === this.totalPages ? true : false;
3788
+ const lineOperatorRemoveShow = this.totalPages > this.minTotalPages ? true : false;
3789
+ return (index.h("div", null, index.h("div", { class: "LotteryTippingTicketBet__tableToolbar flex justify-end gap-1" }, this.showClearButton && (index.h("lottery-button", { class: {
3790
+ 'LotteryTippingTicketBet__tableToolbar--item': true,
3791
+ 'mr-0': !(lineOperatorAddShow || lineOperatorRemoveShow)
3792
+ }, text: translate$1('clearAll', this.language), onClick: () => this.handleClearAll(), variant: "text", clientStyling: this.clientStyling || '' }))), index.h("div", { class: "flex align-center LotteryTippingTicketBet__main", ref: (el) => (this.mainContainer = el) }, index.h("div", { class: "table-scroll-wrapper" }, index.h(MyTable, { columns: this.columns, dataSource: ((_a = this.ticketDataSource) === null || _a === void 0 ? void 0 : _a.map((item, index) => (Object.assign(Object.assign({}, item), { index: index + 1 })))) || [], hideHead: false, grid: false, bordered: false })), (lineOperatorAddShow || lineOperatorRemoveShow) && (index.h("div", { class: "LotteryTippingTicketBet__lineOperatorGroup" }, lineOperatorAddShow && (index.h("button", { type: "button", class: {
3793
+ 'LotteryTippingTicketBet__lineOperatorGroup--item': true
3794
+ }, onClick: () => this.handleAddLine() }, index.h("span", { class: "icon", innerHTML: this.addImage }))), lineOperatorRemoveShow && (index.h("button", { type: "button", class: {
3795
+ 'LotteryTippingTicketBet__lineOperatorGroup--item': true
3796
+ }, onClick: () => this.handleRemoveLine() }, index.h("span", { class: "icon", innerHTML: this.deleteImage })))))), this.renderPageFooter()));
3797
+ }
3798
+ render() {
3799
+ let content;
3800
+ if (this.betIsLoading) {
3801
+ content = this.renderLoading();
3802
+ }
3803
+ else if (this.betHasErrors) {
3804
+ content = this.renderErrorContent();
3805
+ }
3806
+ else if (this.ticketDataSource.length === 0) {
3807
+ content = this.renderEmptyContent();
3808
+ }
3809
+ else if (this.readPretty) {
3810
+ content = this.renderReadPrettyContent();
3811
+ }
3812
+ else {
3813
+ content = this.renderDefaultContent();
3814
+ }
3815
+ return (index.h("div", { key: '425f7f3d185616af3189857a9159868e3c57f100', ref: (el) => (this.stylingContainer = el), class: "LotteryTippingTicketBet__container" }, content));
3816
+ }
3817
+ static get watchers() { return {
3818
+ "translationUrl": ["handleNewTranslations"],
3819
+ "clientStyling": ["handleClientStylingChange"],
3820
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
3821
+ "mbSource": ["handleMbSourceChange"],
3822
+ "ticketDataSourceStr": ["parseTicketDataSource"],
3823
+ "bulletSelectionsLineGroupStr": ["parseBulletSelectionsLineGroup"]
3824
+ }; }
3825
+ };
3826
+ LotteryTippingBetSlip.style = LotteryTippingBetSlipStyle0;
3827
+
3828
+ const DEFAULT_LANGUAGE = 'en';
3829
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
3830
+ const TRANSLATIONS = {
3831
+ en: {
3832
+ cancel: 'Cancel',
3833
+ confirm: 'Confirm'
3834
+ },
3835
+ ro: {
3836
+ cancel: 'Anulează',
3837
+ confirm: 'Confirmă'
3838
+ },
3839
+ fr: {
3840
+ cancel: 'Annuler',
3841
+ confirm: 'Confirmer'
3842
+ },
3843
+ ar: {
3844
+ cancel: 'إلغاء',
3845
+ confirm: 'تأكيد'
3846
+ },
3847
+ hr: {
3848
+ cancel: 'Odustani',
3849
+ confirm: 'Potvrdi'
3850
+ }
3851
+ };
3852
+ const translate = (key, customLang) => {
3853
+ const lang = customLang;
3854
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
3855
+ };
3856
+ const getTranslations = (data) => {
3857
+ Object.keys(data).forEach((item) => {
3858
+ for (let key in data[item]) {
3859
+ TRANSLATIONS[item][key] = data[item][key];
3860
+ }
3861
+ });
3862
+ };
3863
+ const resolveTranslationUrl = async (translationUrl) => {
3864
+ if (translationUrl) {
3865
+ try {
3866
+ const response = await fetch(translationUrl);
3867
+ if (!response.ok) {
3868
+ throw new Error(`HTTP error! status: ${response.status}`);
3869
+ }
3870
+ const translations = await response.json();
3871
+ getTranslations(translations);
3872
+ }
3873
+ catch (error) {
3874
+ console.error('Failed to fetch or parse translations from URL:', error);
3875
+ }
3876
+ }
3877
+ };
3878
+
3879
+ const lotteryTippingDialogCss = ".dialog-wrapper{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;visibility:hidden;opacity:1;z-index:199}.dialog-wrapper-visible{visibility:visible}.mask{position:fixed;inset:0;background:var(--emw--color-mask-dialog-background, rgba(0, 0, 0, 0.5));opacity:0;z-index:1000;transition:opacity var(--duration) linear}.mask-enter{opacity:1}.mask-leave{opacity:0}.dialog{position:relative;background:var(--emw--color-background, #fff);border-radius:12px;box-shadow:0 4px 32px var(--emw--button-box-shadow-color-secondary, rgba(0, 0, 0, 0.15));opacity:0;transform:scale(0.9);transition:all var(--duration) linear;width:100%;max-width:100vw;overflow:hidden;z-index:1000}.dialog-enter{opacity:1;transform:scale(1)}.dialog-leave{opacity:0}.dialog.fullscreen{width:100vw !important;height:100vh;overflow:auto;max-height:none;border-radius:0;overflow:hidden}.dialog-header{padding:16px 16px 0 16px;display:flex;justify-content:space-between;align-items:center}.dialog-header .dialog-title{margin:0;font-size:1.25rem;font-weight:500;color:var(--emw--color-typography, #000)}.dialog-header .close-btn{background:transparent;border:none;font-size:1.5rem;width:2rem;height:2rem;color:var(--emw--color-gray-150, #6f6f6f);cursor:pointer;border-radius:4px}.dialog-header .close-btn:hover{background:var(--emw--color-gray-50, #f5f5f5);color:var(--emw--color-gray-300, #333)}.dialog-content{padding:24px;font-size:0.95rem;line-height:1.6;color:var(--emw--color-dialog-typography, #000);flex:1;overflow-y:auto;max-height:calc(100vh - 200px)}.dialog.fullscreen .dialog-content{max-height:none}.dialog-footer{padding:0 16px 16px 16px;display:flex;justify-content:center;gap:12px}.dialog-footer .cancel-btn,.dialog-footer .confirm-btn{padding:10px 24px;min-width:60px;border-radius:6px;font-size:0.9rem;cursor:pointer;transition:all 0.3s linear}.dialog-footer .cancel-btn{border:var(--emw--button-border, 1px solid rgba(221, 221, 221, 0.8666666667));background-color:var(--emw--color-background, #fff);color:var(--emw--color-typography, #000)}.dialog-footer .cancel-btn:hover{background-color:var(--emw--color-background-tertiary, #ccc)}.dialog-footer .confirm-btn{border:none;color:var(--emw--color-typography-normalized, #ffffff);background:var(--emw--color-primary, #009993)}.dialog-footer .confirm-btn:hover{background:var(--emw--color-primary-variant, #004d4a)}@media screen and (max-width: 480px){.dialog.fullscreen .dialog-content{padding:12px}}.Loading{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.Loading svg{animation:spin 1s linear infinite;transform-origin:center}@keyframes spin{100%{transform:rotate(360deg)}}";
3880
+ const LotteryTippingDialogStyle0 = lotteryTippingDialogCss;
3881
+
3882
+ const LotteryTippingDialog = class {
3883
+ constructor(hostRef) {
3884
+ index.registerInstance(this, hostRef);
3885
+ this.open = index.createEvent(this, "open", 7);
3886
+ this.close = index.createEvent(this, "close", 7);
3887
+ this.confirm = index.createEvent(this, "confirm", 7);
3888
+ this.cancel = index.createEvent(this, "cancel", 7);
3889
+ this.wasVisible = false;
3890
+ this.mbSource = undefined;
3891
+ this.clientStyling = '';
3892
+ this.clientStylingUrl = '';
3893
+ this.visible = undefined;
3894
+ this.dialogTitle = '';
3895
+ this.width = '520px';
3896
+ this.closable = true;
3897
+ this.mask = true;
3898
+ this.maskClosable = true;
3899
+ this.animationDuration = 300;
3900
+ this.fullscreen = false;
3901
+ this.showFooter = true;
3902
+ this.showCancelBtn = true;
3903
+ this.language = 'en';
3904
+ this.translationUrl = undefined;
3905
+ this.dialogClass = undefined;
3906
+ this.dialogStyle = undefined;
3907
+ this.confirmLoading = false;
3908
+ }
3909
+ handleClientStylingChange(newValue, oldValue) {
3910
+ if (newValue != oldValue) {
3911
+ lotteryTippingTicketBuy.setClientStyling(this.stylingContainer, this.clientStyling);
3912
+ }
3913
+ }
3914
+ handleClientStylingUrlChange(newValue, oldValue) {
3915
+ if (newValue != oldValue) {
3916
+ lotteryTippingTicketBuy.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
3917
+ }
3918
+ }
3919
+ handleMbSourceChange(newValue, oldValue) {
3920
+ if (newValue != oldValue) {
3921
+ lotteryTippingTicketBuy.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
3922
+ }
3923
+ }
3924
+ componentWillLoad() {
3925
+ if (this.translationUrl) {
3926
+ resolveTranslationUrl(this.translationUrl);
3927
+ }
3928
+ }
3929
+ componentWillUpdate() {
3930
+ if (this.visible && !this.wasVisible) {
3931
+ this.disableBodyScroll();
3932
+ }
3933
+ else if (!this.visible && this.wasVisible) {
3934
+ this.enableBodyScroll();
3935
+ }
3936
+ this.wasVisible = this.visible;
3937
+ }
3938
+ disconnectedCallback() {
3939
+ this.enableBodyScroll();
3940
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
3941
+ }
3942
+ disableBodyScroll() {
3943
+ document.body.style.overflow = 'hidden';
3944
+ }
3945
+ enableBodyScroll() {
3946
+ document.body.style.overflow = '';
3947
+ }
3948
+ handleClose() {
3949
+ this.cancel.emit();
3950
+ }
3951
+ handleMaskClick() {
3952
+ if (this.maskClosable) {
3953
+ this.cancel.emit();
3954
+ }
3955
+ }
3956
+ handleConfirm() {
3957
+ this.confirm.emit();
3958
+ }
3959
+ render() {
3960
+ const computedDialogStyle = Object.assign({ width: typeof this.width === 'number' ? `${this.width}px` : this.width, '--duration': `${this.animationDuration}ms` }, (this.dialogStyle || {}));
3961
+ const dialogWrapperClass = ['dialog-wrapper', this.visible ? 'dialog-wrapper-visible' : ''];
3962
+ const maskClass = ['mask', this.visible ? 'mask-enter' : 'mask-leave'];
3963
+ const computedDialogClass = [
3964
+ 'dialog',
3965
+ this.visible ? 'dialog-enter' : 'dialog-leave',
3966
+ this.fullscreen ? 'fullscreen' : '',
3967
+ this.dialogClass
3968
+ ]
3969
+ .filter(Boolean)
3970
+ .join(' ');
3971
+ const contentStyle = {
3972
+ maxHeight: 'calc(100vh - 62px)',
3973
+ overflowY: 'auto'
3974
+ };
3975
+ return (index.h("div", { key: '05dd671f10bdebda6f138e8f8039f4bc0533fe98', class: dialogWrapperClass.join(' '), ref: (el) => (this.stylingContainer = el) }, index.h("div", { key: '6e814e02770149de5495617039750461fc0a42d1', class: maskClass.join(' '), onClick: this.handleMaskClick.bind(this) }), index.h("div", { key: '4cbc5db20317ef1b0808fc4a91a53fa8b86c5f4f', part: "dialog", class: computedDialogClass, style: computedDialogStyle, role: "dialog", "aria-modal": "true", "aria-labelledby": "dialog-title" }, (this.dialogTitle || this.closable) && (index.h("div", { key: '85dc705676a37e6ea2828a7b683fc54b0eb77d17', class: "dialog-header" }, index.h("h2", { key: '85b7472d2b72801dfae19a24fc2018f3c1f1529a', id: "dialog-title", class: "dialog-title" }, this.dialogTitle), this.closable && (index.h("button", { key: '8089aaecfe511558055ee9f64214ff97030eb2a9', class: "close-btn", onClick: this.handleClose.bind(this) }, "x")))), index.h("div", { key: '776255540f30d757caa3fcaee747c79ac638ae76', class: "dialog-content", style: contentStyle }, index.h("slot", { key: '5ef964615b6ab70a9e561f8efac8fe952fe47b4e' })), this.showFooter && (index.h("div", { key: '8927a0991d916caf7852d58db996b9818687da30', class: "dialog-footer" }, index.h("slot", { key: '84de0306994ec62220ae30fa2881dadbae5544ea', name: "footer" }, this.showCancelBtn && (index.h("button", { key: 'ee87b8c3918c1f4d007923a2498142b3af2740a0', class: "cancel-btn", onClick: this.handleClose.bind(this) }, translate('cancel', this.language))), index.h("button", { key: '935cff86381b21fff07c2d4156b29779c50e5ce3', class: "confirm-btn", onClick: this.handleConfirm.bind(this), disabled: this.confirmLoading }, this.confirmLoading ? (index.h("div", { class: "Loading", innerHTML: renderIconDefinitionToSVGElement(LoadingOutlined$1, {
3976
+ extraSVGAttrs: { width: '20px', height: '20px', fill: 'currentColor' }
3977
+ }) })) : (translate('confirm', this.language)))))))));
3978
+ }
3979
+ get el() { return index.getElement(this); }
3980
+ static get watchers() { return {
3981
+ "clientStyling": ["handleClientStylingChange"],
3982
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
3983
+ "mbSource": ["handleMbSourceChange"]
3984
+ }; }
3985
+ };
3986
+ LotteryTippingDialog.style = LotteryTippingDialogStyle0;
3987
+
3988
+ exports.lottery_segmented = lotteryTippingTicketBuy.LotterySegmented;
3989
+ exports.lottery_tipping_ticket_buy = lotteryTippingTicketBuy.LotteryTippingTicketBuy;
3990
+ exports.app_tooltip = Tooltip;
3991
+ exports.helper_count_down = HelperCountDown;
3992
+ exports.lottery_banner = LotteryBanner;
3993
+ exports.lottery_button = LotteryButton;
3994
+ exports.lottery_order_summary = LotteryOrderSummary;
3995
+ exports.lottery_selection = LotterySelection;
3996
+ exports.lottery_selection_group = LotterySelectionGroup;
3997
+ exports.lottery_tipping_bet_slip = LotteryTippingBetSlip;
3998
+ exports.lottery_tipping_dialog = LotteryTippingDialog;