@everymatrix/lottery-tipping-ticket-controller 1.85.14 → 1.85.16

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 (27) hide show
  1. package/dist/cjs/general-tooltip_7.cjs.entry.js +1136 -0
  2. package/dist/cjs/index-3e1fe885.js +2 -2
  3. package/dist/cjs/index.cjs.js +1 -2
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/{general-tooltip_6.cjs.entry.js → lottery-tipping-ticket-controller-1e79780d.js} +7366 -5190
  6. package/dist/cjs/lottery-tipping-ticket-controller.cjs.js +1 -1
  7. package/dist/collection/collection-manifest.json +6 -0
  8. package/dist/collection/components/lottery-tipping-ticket-controller/lottery-tipping-ticket-controller.js +41 -9
  9. package/dist/collection/utils/locale.utils.js +2 -1
  10. package/dist/collection/utils/utils.js +1 -0
  11. package/dist/esm/general-tooltip_7.entry.js +1127 -0
  12. package/dist/esm/index-e3ec645c.js +2 -2
  13. package/dist/esm/index.js +1 -2
  14. package/dist/esm/loader.js +1 -1
  15. package/dist/esm/{general-tooltip_6.entry.js → lottery-tipping-ticket-controller-e914932b.js} +7220 -5047
  16. package/dist/esm/lottery-tipping-ticket-controller.js +1 -1
  17. package/dist/lottery-tipping-ticket-controller/general-tooltip_7.entry.js +1 -0
  18. package/dist/lottery-tipping-ticket-controller/index.esm.js +1 -1
  19. package/dist/lottery-tipping-ticket-controller/{general-tooltip_6.entry.js → lottery-tipping-ticket-controller-e914932b.js} +242 -242
  20. package/dist/lottery-tipping-ticket-controller/lottery-tipping-ticket-controller.esm.js +1 -1
  21. package/dist/types/components/lottery-tipping-ticket-controller/lottery-tipping-ticket-controller.d.ts +8 -3
  22. package/dist/types/models/index.d.ts +5 -0
  23. package/dist/types/utils/utils.d.ts +1 -0
  24. package/package.json +1 -1
  25. package/dist/cjs/lottery-tipping-ticket-controller-b89883ee.js +0 -3141
  26. package/dist/esm/lottery-tipping-ticket-controller-12ffe9b9.js +0 -3130
  27. package/dist/lottery-tipping-ticket-controller/lottery-tipping-ticket-controller-12ffe9b9.js +0 -1
@@ -0,0 +1,1127 @@
1
+ import { r as registerInstance, h, g as getElement, c as createEvent } from './index-e3ec645c.js';
2
+ import { r as requiredArgs, t as toDate, s as setClientStyling, a as setClientStylingURL, b as setStreamStyling, f as formatDate$1, c as resolveTranslationUrl$1, p as parseISO, d as format } from './lottery-tipping-ticket-controller-e914932b.js';
3
+ export { L as lottery_tipping_ticket_controller } from './lottery-tipping-ticket-controller-e914932b.js';
4
+
5
+ /**
6
+ * @name startOfDay
7
+ * @category Day Helpers
8
+ * @summary Return the start of a day for the given date.
9
+ *
10
+ * @description
11
+ * Return the start of a day for the given date.
12
+ * The result will be in the local timezone.
13
+ *
14
+ * @param {Date|Number} date - the original date
15
+ * @returns {Date} the start of a day
16
+ * @throws {TypeError} 1 argument required
17
+ *
18
+ * @example
19
+ * // The start of a day for 2 September 2014 11:55:00:
20
+ * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
21
+ * //=> Tue Sep 02 2014 00:00:00
22
+ */
23
+ function startOfDay(dirtyDate) {
24
+ requiredArgs(1, arguments);
25
+ var date = toDate(dirtyDate);
26
+ date.setHours(0, 0, 0, 0);
27
+ return date;
28
+ }
29
+
30
+ /**
31
+ * @name isSameDay
32
+ * @category Day Helpers
33
+ * @summary Are the given dates in the same day (and year and month)?
34
+ *
35
+ * @description
36
+ * Are the given dates in the same day (and year and month)?
37
+ *
38
+ * @param {Date|Number} dateLeft - the first date to check
39
+ * @param {Date|Number} dateRight - the second date to check
40
+ * @returns {Boolean} the dates are in the same day (and year and month)
41
+ * @throws {TypeError} 2 arguments required
42
+ *
43
+ * @example
44
+ * // Are 4 September 06:00:00 and 4 September 18:00:00 in the same day?
45
+ * const result = isSameDay(new Date(2014, 8, 4, 6, 0), new Date(2014, 8, 4, 18, 0))
46
+ * //=> true
47
+ *
48
+ * @example
49
+ * // Are 4 September and 4 October in the same day?
50
+ * const result = isSameDay(new Date(2014, 8, 4), new Date(2014, 9, 4))
51
+ * //=> false
52
+ *
53
+ * @example
54
+ * // Are 4 September, 2014 and 4 September, 2015 in the same day?
55
+ * const result = isSameDay(new Date(2014, 8, 4), new Date(2015, 8, 4))
56
+ * //=> false
57
+ */
58
+ function isSameDay(dirtyDateLeft, dirtyDateRight) {
59
+ requiredArgs(2, arguments);
60
+ var dateLeftStartOfDay = startOfDay(dirtyDateLeft);
61
+ var dateRightStartOfDay = startOfDay(dirtyDateRight);
62
+ return dateLeftStartOfDay.getTime() === dateRightStartOfDay.getTime();
63
+ }
64
+
65
+ /**
66
+ * @name isToday
67
+ * @category Day Helpers
68
+ * @summary Is the given date today?
69
+ * @pure false
70
+ *
71
+ * @description
72
+ * Is the given date today?
73
+ *
74
+ * > ⚠️ Please note that this function is not present in the FP submodule as
75
+ * > it uses `Date.now()` internally hence impure and can't be safely curried.
76
+ *
77
+ * @param {Date|Number} date - the date to check
78
+ * @returns {Boolean} the date is today
79
+ * @throws {TypeError} 1 argument required
80
+ *
81
+ * @example
82
+ * // If today is 6 October 2014, is 6 October 14:00:00 today?
83
+ * const result = isToday(new Date(2014, 9, 6, 14, 0))
84
+ * //=> true
85
+ */
86
+ function isToday(dirtyDate) {
87
+ requiredArgs(1, arguments);
88
+ return isSameDay(dirtyDate, Date.now());
89
+ }
90
+
91
+ const generalTooltipCss = ".general-tooltip-wrapper{display:inline-block;position:relative;line-height:0}.general-tooltip-container{display:contents;}.general-tooltip-popup{position:absolute;color:var(--emw--color-typography-inverse, #fff);background:var(--emw--color-background-inverse, #000);padding:8px 12px;border-radius:4px;font-size:0.875em;line-height:1.4;z-index:1000;opacity:0;visibility:hidden;transition:opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;white-space:nowrap;pointer-events:none;}.general-tooltip-popup.visible{opacity:1;visibility:visible}.general-tooltip-arrow{position:absolute;width:0;height:0;border-style:solid}.general-tooltip-top{bottom:100%;left:50%;transform:translateX(-50%);margin-bottom:8px;}.general-tooltip-top .general-tooltip-arrow{top:100%;left:50%;transform:translateX(-50%);border-width:6px 6px 0 6px;border-color:var(--emw--color-gray-300, #333) transparent transparent transparent}.general-tooltip-bottom{top:100%;left:50%;transform:translateX(-50%);margin-top:8px;}.general-tooltip-bottom .general-tooltip-arrow{bottom:100%;left:50%;transform:translateX(-50%);border-width:0 6px 6px 6px;border-color:transparent transparent var(--emw--color-gray-300, #333) transparent}.general-tooltip-left{right:100%;top:50%;transform:translateY(-50%);margin-right:8px;}.general-tooltip-left .general-tooltip-arrow{left:100%;top:50%;transform:translateY(-50%);border-width:6px 0 6px 6px;border-color:transparent transparent transparent var(--emw--color-gray-300, #333)}.general-tooltip-right{left:100%;top:50%;transform:translateY(-50%);margin-left:8px;}.general-tooltip-right .general-tooltip-arrow{right:100%;top:50%;transform:translateY(-50%);border-width:6px 6px 6px 0;border-color:transparent var(--emw--color-gray-300, #333) transparent transparent}";
92
+ const GeneralTooltipStyle0 = generalTooltipCss;
93
+
94
+ const GeneralTooltip = class {
95
+ constructor(hostRef) {
96
+ registerInstance(this, hostRef);
97
+ this.mbSource = undefined;
98
+ this.clientStyling = undefined;
99
+ this.clientStylingUrl = undefined;
100
+ this.position = 'top';
101
+ this.delay = 200;
102
+ this.isVisible = false;
103
+ this._tooltipId = undefined;
104
+ }
105
+ handleClientStylingChange(newValue, oldValue) {
106
+ if (newValue != oldValue) {
107
+ setClientStyling(this.stylingContainer, this.clientStyling);
108
+ }
109
+ }
110
+ handleClientStylingUrlChange(newValue, oldValue) {
111
+ if (newValue != oldValue) {
112
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
113
+ }
114
+ }
115
+ handleMbSourceChange(newValue, oldValue) {
116
+ if (newValue != oldValue) {
117
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
118
+ }
119
+ }
120
+ componentWillLoad() {
121
+ this._tooltipId = `general-tooltip-${Math.random().toString(36).substring(2, 9)}`;
122
+ }
123
+ componentDidLoad() {
124
+ if (this.stylingContainer) {
125
+ if (this.mbSource)
126
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
127
+ if (this.clientStyling)
128
+ setClientStyling(this.stylingContainer, this.clientStyling);
129
+ if (this.clientStylingUrl)
130
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
131
+ }
132
+ }
133
+ handleMouseEnterOrFocus() {
134
+ clearTimeout(this.hideTimeout); // Clear any pending hide
135
+ if (this.showTimeout)
136
+ clearTimeout(this.showTimeout);
137
+ this.showTimeout = setTimeout(() => {
138
+ this.isVisible = true;
139
+ }, this.delay);
140
+ }
141
+ handleMouseLeaveOrBlur() {
142
+ if (this.showTimeout)
143
+ clearTimeout(this.showTimeout);
144
+ this.hideTimeout = setTimeout(() => {
145
+ this.isVisible = false;
146
+ }, 100);
147
+ }
148
+ handleKeyDown(event) {
149
+ if (event.key === 'Escape' && this.isVisible) {
150
+ this.isVisible = false;
151
+ }
152
+ }
153
+ disconnectedCallback() {
154
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
155
+ clearTimeout(this.showTimeout);
156
+ clearTimeout(this.hideTimeout);
157
+ }
158
+ render() {
159
+ const tooltipClasses = {
160
+ 'general-tooltip-popup': true,
161
+ visible: this.isVisible,
162
+ [`general-tooltip-${this.position}`]: true
163
+ };
164
+ return (h("div", { key: 'c0d52518e1e196e0d022789f7c6b7e64173b2c7d', class: "general-tooltip-wrapper" }, h("slot", { key: 'a935e103e16b0b619a024706e8224f4a937de6b9', name: "trigger" }), h("div", { key: '35c60e35ce3f8d5c2c42cd333fe64a3b289d34d4', class: "general-tooltip-container", role: "tooltip", ref: (el) => (this.stylingContainer = el) }, h("div", { key: '9d3fd9f142c1e3bd263dee289a2c1a9e4eebfddc', id: this._tooltipId, class: tooltipClasses, role: "tooltip" }, h("slot", { key: '31344f0d4d4139f913d1819cc4f42a39f5113d8a', name: "content" }), h("div", { key: 'f5cdd93060baec37b2a2879056efe2d66c5a553a', class: "general-tooltip-arrow" })))));
165
+ }
166
+ get hostElement() { return getElement(this); }
167
+ static get watchers() { return {
168
+ "clientStyling": ["handleClientStylingChange"],
169
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
170
+ "mbSource": ["handleMbSourceChange"]
171
+ }; }
172
+ };
173
+ GeneralTooltip.style = GeneralTooltipStyle0;
174
+
175
+ const DEFAULT_LANGUAGE$2 = 'en';
176
+ const SUPPORTED_LANGUAGES$2 = ['ro', 'en', 'fr', 'ar', 'hr', 'zh'];
177
+ const TRANSLATIONS$2 = {
178
+ en: {
179
+ loading: 'Loading'
180
+ },
181
+ ro: {},
182
+ fr: {},
183
+ ar: {},
184
+ hr: {}
185
+ };
186
+ const translate$2 = (key, customLang, replacements) => {
187
+ const lang = customLang;
188
+ let translation = TRANSLATIONS$2[lang !== undefined && SUPPORTED_LANGUAGES$2.includes(lang) ? lang : DEFAULT_LANGUAGE$2][key];
189
+ if (replacements) {
190
+ Object.keys(replacements).forEach((placeholder) => {
191
+ translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
192
+ });
193
+ }
194
+ return translation;
195
+ };
196
+ const getTranslations$1 = (data) => {
197
+ Object.keys(data).forEach((item) => {
198
+ for (let key in data[item]) {
199
+ TRANSLATIONS$2[item][key] = data[item][key];
200
+ }
201
+ });
202
+ };
203
+ const resolveTranslationUrl = async (translationUrl) => {
204
+ if (translationUrl) {
205
+ try {
206
+ const response = await fetch(translationUrl);
207
+ if (!response.ok) {
208
+ throw new Error(`HTTP error! status: ${response.status}`);
209
+ }
210
+ const translations = await response.json();
211
+ getTranslations$1(translations);
212
+ }
213
+ catch (error) {
214
+ console.error('Failed to fetch or parse translations from URL:', error);
215
+ }
216
+ }
217
+ };
218
+
219
+ const lotteryButtonCss = ":host{display:inline-block;font-family:\"PingFang SC\", \"Microsoft YaHei\", \"Helvetica Neue\", Helvetica, Arial, sans-serif}.btn{position:relative;display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;border-radius:6px;font-weight:500;cursor:pointer;outline:none;overflow:hidden;transition:background-color 0.2s, border-color 0.2s, color 0.2s;user-select:none;-webkit-tap-highlight-color:transparent}.btn .content{position:relative}.btn:disabled{cursor:not-allowed;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:2px solid rgba(255, 255, 255, 0.3);border-radius:50%;border-top-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:#08104a}.btn--outline .spinner,.btn--dashed .spinner,.btn--text .spinner{border-top-color:currentColor;border-color:rgba(0, 0, 0, 0.2)}.btn--outline{background-color:var(--emw--color-background, #fff);border-color:#dcdcdc;color:var(--emw--color-typography, #000)}.btn--outline:hover:not(:disabled){background-color:var(--emw--color-background-tertiary, #ccc);border-color:#a6a6a6}.btn--outline:active:not(:disabled){background-color:#e6e6e6}.btn--dashed{background-color:transparent;border-style:dashed;border-color:#dcdcdc;color:#333}.btn--dashed:hover:not(:disabled){border-color:#a6a6a6;color:#0052d9}.btn--text{background-color:transparent;color:#0052d9;border-color:transparent}.btn--text:hover:not(:disabled){background-color:#f2f2f2}.btn--text:active:not(:disabled){background-color:#e6e6e6}.btn--small{height:28px;font-size:12px;padding:0 12px}.btn--medium{height:34px;font-size:14px;padding:0 18px}.btn--large{height:40px;font-size:16px;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: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:rgba(0, 0, 0, 0.1)}@keyframes ripple-animation{to{transform:scale(4);opacity:0}}";
220
+ const LotteryButtonStyle0 = lotteryButtonCss;
221
+
222
+ const LotteryButton = class {
223
+ constructor(hostRef) {
224
+ registerInstance(this, hostRef);
225
+ this.handleClick = (event) => {
226
+ if (this.disabled) {
227
+ return;
228
+ }
229
+ // Get the button element from the shadow root
230
+ const button = this.host.shadowRoot.querySelector('.btn');
231
+ if (!button)
232
+ return;
233
+ const rect = button.getBoundingClientRect();
234
+ const size = Math.max(rect.width, rect.height);
235
+ const top = event.clientY - rect.top - size / 2;
236
+ const left = event.clientX - rect.left - size / 2;
237
+ // Add the new ripple to the state, triggering a re-render
238
+ const newRipple = { top, left, size };
239
+ this.ripples = [...this.ripples, newRipple];
240
+ // Set a timeout to clean up the ripple from the state after the animation ends
241
+ // This prevents the DOM from filling up with old ripple elements
242
+ setTimeout(() => {
243
+ this.ripples = this.ripples.filter((r) => r !== newRipple);
244
+ }, 600); // This duration should match the CSS animation duration
245
+ };
246
+ this.variant = 'primary';
247
+ this.size = 'medium';
248
+ this.disabled = false;
249
+ this.loading = false;
250
+ this.text = undefined;
251
+ this.mbSource = undefined;
252
+ this.language = 'en';
253
+ this.clientStyling = undefined;
254
+ this.clientStylingUrl = undefined;
255
+ this.translationUrl = '';
256
+ this.ripples = [];
257
+ }
258
+ handleClientStylingChange(newValue, oldValue) {
259
+ if (newValue != oldValue) {
260
+ setClientStyling(this.stylingContainer, this.clientStyling);
261
+ }
262
+ }
263
+ handleClientStylingUrlChange(newValue, oldValue) {
264
+ if (newValue != oldValue) {
265
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
266
+ }
267
+ }
268
+ handleMbSourceChange(newValue, oldValue) {
269
+ if (newValue != oldValue) {
270
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
271
+ }
272
+ }
273
+ disconnectedCallback() {
274
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
275
+ }
276
+ componentDidLoad() {
277
+ if (this.stylingContainer) {
278
+ if (this.mbSource)
279
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
280
+ if (this.clientStyling)
281
+ setClientStyling(this.stylingContainer, this.clientStyling);
282
+ if (this.clientStylingUrl)
283
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
284
+ }
285
+ }
286
+ componentWillLoad() {
287
+ if (this.translationUrl) {
288
+ resolveTranslationUrl(this.translationUrl);
289
+ }
290
+ }
291
+ render() {
292
+ const { variant, disabled, size } = this;
293
+ const isDisabled = disabled || this.loading;
294
+ return (h("button", { key: '19094b8ffd0d13c7e3cdc7139d559214803f0e73', class: {
295
+ btn: true,
296
+ [`btn--${variant}`]: true,
297
+ [`btn--${size}`]: true,
298
+ 'btn--loading': this.loading
299
+ }, disabled: isDisabled, onClick: this.handleClick }, this.loading ? (h("div", { class: "loading-container" }, h("span", { class: "content" }, this.text || translate$2('loading', this.language)), h("span", { class: "spinner" }))) : (h("span", { class: "content" }, this.text)), h("div", { key: 'e7e7542f0b79c5bf8e41969e23dd77d9fdec4462', class: "ripple-container" }, this.ripples.map((ripple, index) => (h("span", { key: index, class: "ripple", style: {
300
+ top: `${ripple.top}px`,
301
+ left: `${ripple.left}px`,
302
+ width: `${ripple.size}px`,
303
+ height: `${ripple.size}px`
304
+ } }))))));
305
+ }
306
+ get host() { return getElement(this); }
307
+ static get watchers() { return {
308
+ "clientStyling": ["handleClientStylingChange"],
309
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
310
+ "mbSource": ["handleMbSourceChange"]
311
+ }; }
312
+ };
313
+ LotteryButton.style = LotteryButtonStyle0;
314
+
315
+ const lotteryTippingBulletCss = ".LotteryTippingBullet__segment{display:flex;align-items:center;justify-content:center;width:2rem;height:2rem;font-size:16px;line-height:1;font-weight:500;color:var(--emw--color-typography, #000);background:var(--emw--color-background, #fff);border:1px solid var(--emw--color-gray-100, #e6e6e6);border-radius:6px;cursor:pointer;transition:all 0.2s ease;user-select:none}.LotteryTippingBullet__segment:not(.LotteryTippingBullet__segment--disabled):hover{cursor:pointer;animation:jelly 0.3s ease-in-out;transform:scale(1.02)}.LotteryTippingBullet__segment--text{border:none;color:var(--emw--color-typography, #000);background:transparent;font-weight:400}.LotteryTippingBullet__segment--text:hover{cursor:not-allowed !important}.LotteryTippingBullet__segment--active{font-weight:600;background-color:var(--emw--color-background-inverse, #000);color:var(--emw--color-primary, #fed275)}.LotteryTippingBullet__segment--disabled:not(.LotteryTippingBullet__segment--active){background-color:var(--emw--color-background-tertiary, #ccc);color:var(--emw--color-gray-150, #6f6f6f);border-color:var(--emw--color-gray-100, #e6e6e6)}.LotteryTippingBullet__segment--disabled:hover{cursor:not-allowed}@keyframes jelly{0%{transform:translate(0, 0)}20%{transform:translate(-0.5px, -0.5px)}40%{transform:translate(0.5px, 0.5px)}60%{transform:translate(-0.25px, -0.25px)}80%{transform:translate(0.25px, 0.25px)}100%{transform:translate(0, 0)}}";
316
+ const LotteryTippingBulletStyle0 = lotteryTippingBulletCss;
317
+
318
+ const LotteryTippingBullet = class {
319
+ constructor(hostRef) {
320
+ registerInstance(this, hostRef);
321
+ this.lotteryTippingBulletToggleEvent = createEvent(this, "lotteryTippingBulletToggle", 7);
322
+ this.mbSource = undefined;
323
+ this.clientStyling = undefined;
324
+ this.clientStylingUrl = undefined;
325
+ this.positionIdx = undefined;
326
+ this.theme = 'default';
327
+ this.value = '';
328
+ this.disabled = false;
329
+ this.isSelected = false;
330
+ }
331
+ handleClientStylingChange(newValue, oldValue) {
332
+ if (newValue != oldValue) {
333
+ setClientStyling(this.stylingContainer, this.clientStyling);
334
+ }
335
+ }
336
+ handleClientStylingUrlChange(newValue, oldValue) {
337
+ if (newValue != oldValue) {
338
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
339
+ }
340
+ }
341
+ handleMbSourceChange(newValue, oldValue) {
342
+ if (newValue != oldValue) {
343
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
344
+ }
345
+ }
346
+ componentDidLoad() {
347
+ if (this.stylingContainer) {
348
+ if (this.mbSource)
349
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
350
+ if (this.clientStyling)
351
+ setClientStyling(this.stylingContainer, this.clientStyling);
352
+ if (this.clientStylingUrl)
353
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
354
+ }
355
+ }
356
+ handleClick() {
357
+ if (!this.disabled) {
358
+ this.lotteryTippingBulletToggleEvent.emit({ positionIdx: this.positionIdx });
359
+ }
360
+ }
361
+ disconnectedCallback() {
362
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
363
+ }
364
+ render() {
365
+ return (h("div", { key: 'ef0fee38ed62adb7809b5a60668af6a499ebe5a6', ref: (el) => (this.stylingContainer = el) }, this.theme === 'text' ? (h("div", { class: {
366
+ LotteryTippingBullet__segment: true,
367
+ 'LotteryTippingBullet__segment--text': true
368
+ } }, this.value)) : (h("button", { class: {
369
+ LotteryTippingBullet__segment: true,
370
+ 'LotteryTippingBullet__segment--disabled': this.disabled,
371
+ 'LotteryTippingBullet__segment--active': this.isSelected
372
+ }, onClick: this.handleClick.bind(this) }, this.isSelected ? 'X' : this.value))));
373
+ }
374
+ static get watchers() { return {
375
+ "clientStyling": ["handleClientStylingChange"],
376
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
377
+ "mbSource": ["handleMbSourceChange"]
378
+ }; }
379
+ };
380
+ LotteryTippingBullet.style = LotteryTippingBulletStyle0;
381
+
382
+ const lotteryTippingBulletGroupCss = "";
383
+ const LotteryTippingBulletGroupStyle0 = lotteryTippingBulletGroupCss;
384
+
385
+ const LotteryTippingBulletGroup = class {
386
+ constructor(hostRef) {
387
+ registerInstance(this, hostRef);
388
+ this.lotteryTippingBulletGroupToggleEvent = createEvent(this, "lotteryTippingBulletGroupToggle", 7);
389
+ this.mbSource = undefined;
390
+ this.clientStyling = undefined;
391
+ this.clientStylingUrl = undefined;
392
+ this.positionIdx = undefined;
393
+ this.theme = 'default';
394
+ this.mode = 'single';
395
+ this.bulletConfigContent = '';
396
+ }
397
+ get bulletConfigArr() {
398
+ const defaultConfig = [
399
+ {
400
+ value: '1'
401
+ },
402
+ {
403
+ value: 'X'
404
+ },
405
+ {
406
+ value: '2'
407
+ }
408
+ ];
409
+ if (typeof this.bulletConfigContent === 'string' && this.bulletConfigContent) {
410
+ try {
411
+ const _temp = JSON.parse(this.bulletConfigContent);
412
+ return _temp;
413
+ }
414
+ catch (e) {
415
+ console.error('Error parsing bulletConfigContent:', e);
416
+ return defaultConfig;
417
+ }
418
+ }
419
+ else {
420
+ return defaultConfig;
421
+ }
422
+ }
423
+ handleClientStylingChange(newValue, oldValue) {
424
+ if (newValue != oldValue) {
425
+ setClientStyling(this.stylingContainer, this.clientStyling);
426
+ }
427
+ }
428
+ handleClientStylingUrlChange(newValue, oldValue) {
429
+ if (newValue != oldValue) {
430
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
431
+ }
432
+ }
433
+ handleMbSourceChange(newValue, oldValue) {
434
+ if (newValue != oldValue) {
435
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
436
+ }
437
+ }
438
+ componentDidLoad() {
439
+ if (this.stylingContainer) {
440
+ if (this.mbSource)
441
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
442
+ if (this.clientStyling)
443
+ setClientStyling(this.stylingContainer, this.clientStyling);
444
+ if (this.clientStylingUrl)
445
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
446
+ }
447
+ }
448
+ disconnectedCallback() {
449
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
450
+ }
451
+ lotteryTippingBulletSelectionHandler(event) {
452
+ const { positionIdx } = event.detail;
453
+ this.handleToggle(positionIdx);
454
+ }
455
+ handleToggle(index) {
456
+ let newConfigArr = [...this.bulletConfigArr];
457
+ if (this.mode === 'single') {
458
+ // single mode: only one button can be selected
459
+ newConfigArr = newConfigArr.map((item) => (Object.assign(Object.assign({}, item), { isSelected: false })));
460
+ newConfigArr[index].isSelected = true;
461
+ }
462
+ else {
463
+ // multi mode: multiple buttons can be selected
464
+ newConfigArr = newConfigArr.map((item) => (Object.assign({}, item)));
465
+ newConfigArr[index].isSelected = !newConfigArr[index].isSelected;
466
+ }
467
+ this.lotteryTippingBulletGroupToggleEvent.emit({
468
+ bulletConfigArr: newConfigArr,
469
+ positionIdx: this.positionIdx + '-' + index
470
+ });
471
+ }
472
+ render() {
473
+ var _a;
474
+ return (h("div", { ref: (el) => (this.stylingContainer = el), key: this.positionIdx }, h("div", { key: '68223022eed831932c571378164be913206d98e9', style: { display: 'flex', flexDirection: 'row', gap: '10px' } }, (_a = this.bulletConfigArr) === null || _a === void 0 ? void 0 : _a.map((item, index) => (h("div", { key: index }, h("lottery-tipping-bullet", { value: item.value, isSelected: item.isSelected, "position-idx": index, disabled: item.disabled, theme: this.theme, clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl, mbSource: this.mbSource })))))));
475
+ }
476
+ static get watchers() { return {
477
+ "clientStyling": ["handleClientStylingChange"],
478
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
479
+ "mbSource": ["handleMbSourceChange"]
480
+ }; }
481
+ };
482
+ LotteryTippingBulletGroup.style = LotteryTippingBulletGroupStyle0;
483
+
484
+ const DEFAULT_LANGUAGE$1 = 'en';
485
+ const SUPPORTED_LANGUAGES$1 = ['ro', 'en', 'fr', 'ar', 'hr'];
486
+ const TRANSLATIONS$1 = {
487
+ en: {
488
+ stop: 'Stop',
489
+ at: 'at',
490
+ turnover: 'Turnover: '
491
+ },
492
+ ro: {
493
+ stop: 'Oprește',
494
+ at: 'la'
495
+ },
496
+ fr: {
497
+ stop: 'Arrêtez',
498
+ at: 'à'
499
+ },
500
+ ar: {
501
+ stop: 'توقف',
502
+ at: 'في'
503
+ },
504
+ hr: {
505
+ stop: 'Stop',
506
+ at: 'u'
507
+ }
508
+ };
509
+ const translate$1 = (key, customLang) => {
510
+ const lang = customLang;
511
+ return TRANSLATIONS$1[lang !== undefined && SUPPORTED_LANGUAGES$1.includes(lang) ? lang : DEFAULT_LANGUAGE$1][key];
512
+ };
513
+
514
+ const lotteryTippingTicketBannerCss = ".lottery-tipping-ticket-banner__container {\n font-family: system-ui, sans-serif;\n font-size: 14px;\n container-type: inline-size;\n}\n\n.banner {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: space-between;\n padding: 0 1rem;\n background: var(--emw--color-primary, #fed275);\n border-top: 2px solid var(--emw--color-primary, #fed275);\n border-bottom: 2px solid var(--emw--color-primary, #fed275);\n gap: 0.5rem;\n white-space: nowrap;\n position: relative;\n height: 46px;\n}\n\n.left {\n flex: 1;\n gap: 0.4rem;\n}\n.left .logo {\n width: 216px;\n position: absolute;\n top: -7px;\n}\n\n.brand {\n font-weight: 700;\n color: var(--emw--color-typography, #000);\n}\n\n.mid {\n flex: 1;\n font-size: 1.5rem;\n font-weight: 800;\n font-style: italic;\n letter-spacing: 0.04em;\n color: var(--emw--color-typography, #000);\n text-align: center;\n}\n\n.right {\n flex: 1;\n display: flex;\n gap: 0.4rem;\n flex-wrap: wrap;\n justify-content: flex-end;\n}\n\n@container (max-width: 420px) {\n .mid {\n text-align: right;\n }\n .right {\n justify-content: center;\n }\n}\n.pill {\n padding: 0.25rem 0.7rem;\n font-size: 0.9rem;\n color: var(--emw--color-gray-400, #000);\n display: inline-flex;\n align-items: baseline;\n}\n\n.pill > strong {\n font-weight: 700;\n}";
515
+ const LotteryTippingTicketBannerStyle0 = lotteryTippingTicketBannerCss;
516
+
517
+ const LotteryTippingTicketBanner = class {
518
+ constructor(hostRef) {
519
+ registerInstance(this, hostRef);
520
+ this.mbSource = undefined;
521
+ this.clientStyling = undefined;
522
+ this.clientStylingUrl = undefined;
523
+ this.language = 'en';
524
+ this.translationUrl = '';
525
+ this.logoUrl = undefined;
526
+ this.stopTime = '';
527
+ this.period = undefined;
528
+ this.formattedTurnover = undefined;
529
+ }
530
+ get formattedStopTime() {
531
+ let _temp = '';
532
+ if (!this.stopTime) {
533
+ return _temp;
534
+ }
535
+ _temp = formatDate$1({ date: this.stopTime, format: 'dd/MM/yyyy HH:mm' });
536
+ if (isToday(new Date(this.stopTime))) {
537
+ _temp = formatDate$1({ date: this.stopTime, format: 'HH:mm' });
538
+ }
539
+ return _temp;
540
+ }
541
+ get formattedPeriod() {
542
+ let _temp = '';
543
+ _temp = formatDate$1({ date: this.period, format: 'EEEE' });
544
+ if (_temp.toLowerCase() === 'wednesday') {
545
+ _temp = 'MIDWEEK';
546
+ }
547
+ return _temp.toUpperCase();
548
+ }
549
+ handleClientStylingChange(newValue, oldValue) {
550
+ if (newValue != oldValue) {
551
+ setClientStyling(this.stylingContainer, this.clientStyling);
552
+ }
553
+ }
554
+ handleClientStylingUrlChange(newValue, oldValue) {
555
+ if (newValue != oldValue) {
556
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
557
+ }
558
+ }
559
+ handleMbSourceChange(newValue, oldValue) {
560
+ if (newValue != oldValue) {
561
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
562
+ }
563
+ }
564
+ async componentWillLoad() {
565
+ if (this.translationUrl) {
566
+ resolveTranslationUrl$1(this.translationUrl);
567
+ }
568
+ }
569
+ componentDidLoad() {
570
+ if (this.stylingContainer) {
571
+ if (this.mbSource)
572
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
573
+ if (this.clientStyling)
574
+ setClientStyling(this.stylingContainer, this.clientStyling);
575
+ if (this.clientStylingUrl)
576
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
577
+ }
578
+ }
579
+ disconnectedCallback() {
580
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
581
+ }
582
+ render() {
583
+ return (h("div", { key: 'e9286d0a6a9433698703b9c04d6d50892a7b3168', ref: (el) => (this.stylingContainer = el), class: "lottery-tipping-ticket-banner__container" }, h("section", { key: 'd787e64156f76cf6d12bd552513971301534860c', class: "banner" }, h("div", { key: '027baf0c88733d1430801c96b5b338f79f92f22c', class: "left" }, this.logoUrl && h("img", { key: '7b41d5635a2121ccf394aca19de48e10e9a93357', alt: "Betting", src: this.logoUrl, class: "logo" })), h("div", { key: '73e6c3ffa336b020a3819a72b71117b8084381b1', class: "mid period" }, this.formattedPeriod), h("div", { key: '922ae894814157f68aa8f0774c8aa5ca06e1e7cd', class: "right" }, h("span", { key: 'efaf79b1ff5617f2ba92cfef464232041cd87fbf', class: "pill" }, h("strong", { key: 'c842562b15a13407038933da9d1cc7c6fafa0b76' }, translate$1('stop', this.language)), "\u00A0", translate$1('at', this.language), "\u00A0", this.formattedStopTime), h("span", { key: '3e79a5ec17cbcf0896d58196286fa0b637988f69', class: "pill" }, h("strong", { key: '1158b00abffb1c6bf04e9eec10b4c996d04f118e' }, translate$1('turnover', this.language)), "\u00A0", this.formattedTurnover)))));
584
+ }
585
+ static get assetsDirs() { return ["../static"]; }
586
+ static get watchers() { return {
587
+ "clientStyling": ["handleClientStylingChange"],
588
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
589
+ "mbSource": ["handleMbSourceChange"]
590
+ }; }
591
+ };
592
+ LotteryTippingTicketBanner.style = LotteryTippingTicketBannerStyle0;
593
+
594
+ const DEFAULT_LANGUAGE = 'en';
595
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
596
+ const TRANSLATIONS = {
597
+ en: {
598
+ homeTeam: 'Home team:',
599
+ awayTeam: 'Away team:',
600
+ selectionCleared: 'Your selection has been cleared.',
601
+ selectionOnLineCleared: 'Your selection on this line will be cleared.',
602
+ loading: 'Loading...',
603
+ error: 'Error!',
604
+ noData: 'No data available.',
605
+ lineInfo: 'Line {currentPage} of {totalPages}',
606
+ clearAll: 'Clear All',
607
+ cancel: 'Cancel',
608
+ confirm: 'Confirm'
609
+ },
610
+ ro: {
611
+ homeTeam: 'Echipa gazdă:',
612
+ awayTeam: 'Echipa oaspete:',
613
+ selectionCleared: 'Selecția dvs. a fost ștearsă.',
614
+ selectionOnLineCleared: 'Selecția dvs. de pe această linie va fi ștearsă.',
615
+ loading: `Se încarcă...',n error: 'Eroare!`,
616
+ noData: 'Nu sunt date disponibile.',
617
+ lineInfo: 'Linia {currentPage} din {totalPages}',
618
+ clearAll: 'Șterge tot',
619
+ cancel: 'Anulează',
620
+ confirm: 'Confirmă'
621
+ },
622
+ fr: {
623
+ homeTeam: 'Équipe à domicile:',
624
+ awayTeam: `Équipe à l'extérieur:`,
625
+ selectionCleared: 'Votre sélection a été effacée.',
626
+ selectionOnLineCleared: 'Votre sélection sur cette ligne sera effacée.',
627
+ loading: `Chargement...',n error: 'Erreur!`,
628
+ noData: 'Aucune donnée disponible.',
629
+ lineInfo: 'Ligne {currentPage} sur {totalPages}',
630
+ clearAll: 'Tout effacer',
631
+ cancel: 'Annuler',
632
+ confirm: 'Confirmer'
633
+ },
634
+ ar: {
635
+ homeTeam: 'الفريق المضيف:',
636
+ awayTeam: 'الفريق الضيف:',
637
+ selectionCleared: 'تم مسح اختيارك.',
638
+ selectionOnLineCleared: 'سيتم مسح اختيارك في هذا السطر.',
639
+ loading: `جار التحميل...',n error: 'خطأ!`,
640
+ noData: 'لا توجد بيانات متاحة.',
641
+ lineInfo: 'السطر {currentPage} من {totalPages}',
642
+ clearAll: 'مسح الكل',
643
+ cancel: 'إلغاء',
644
+ confirm: 'تأكيد'
645
+ },
646
+ hr: {
647
+ homeTeam: 'Domaći tim:',
648
+ awayTeam: 'Gostujući tim:',
649
+ selectionCleared: 'Vaš odabir je obrisan.',
650
+ selectionOnLineCleared: 'Vaš odabir na ovoj liniji bit će obrisan.',
651
+ loading: `Učitavanje...',n error: 'Greška!`,
652
+ noData: 'Nema dostupnih podataka.',
653
+ lineInfo: 'Linija {currentPage} od {totalPages}',
654
+ clearAll: 'Očisti sve',
655
+ cancel: 'Odustani',
656
+ confirm: 'Potvrdi'
657
+ }
658
+ };
659
+ const translate = (key, customLang, replacements) => {
660
+ const lang = customLang;
661
+ let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
662
+ if (replacements) {
663
+ Object.keys(replacements).forEach((placeholder) => {
664
+ translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
665
+ });
666
+ }
667
+ return translation;
668
+ };
669
+ const getTranslations = (data) => {
670
+ Object.keys(data).forEach((item) => {
671
+ for (let key in data[item]) {
672
+ TRANSLATIONS[item][key] = data[item][key];
673
+ }
674
+ });
675
+ };
676
+
677
+ const formatDate = ({ date, type = 'date', format: format$1 }) => {
678
+ try {
679
+ const parsedDate = parseISO(date);
680
+ if (isNaN(parsedDate.getTime())) {
681
+ throw new Error(`Invalid date: ${date}`);
682
+ }
683
+ if (format$1)
684
+ return format(parsedDate, format$1);
685
+ let formatStr = 'dd/MM/yyyy';
686
+ if (type === 'time') {
687
+ formatStr = 'dd/MM/yyyy HH:mm:ss';
688
+ }
689
+ else if (type === 'week') {
690
+ formatStr = 'ccc dd/MM/yyyy HH:mm:ss';
691
+ }
692
+ return format(parsedDate, formatStr);
693
+ }
694
+ catch (error) {
695
+ console.error('Error formatting date:', error.message);
696
+ return '';
697
+ }
698
+ };
699
+ const fetcher = (url) => fetch(url).then((r) => r.json());
700
+ const DEFAULT_BULLET_CONFIG = [
701
+ {
702
+ value: '1'
703
+ },
704
+ {
705
+ value: 'X'
706
+ },
707
+ {
708
+ value: '2'
709
+ }
710
+ ];
711
+ const SPLIT_TOKEN = '-';
712
+ const showNotification = ({ message, theme = 'success' }) => {
713
+ window.postMessage({
714
+ type: 'ShowNotificationToast',
715
+ message,
716
+ theme
717
+ });
718
+ };
719
+
720
+ // This icon file is generated automatically.
721
+ 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" };
722
+ const DeleteOutlined$1 = DeleteOutlined;
723
+
724
+ // This icon file is generated automatically.
725
+ 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" };
726
+ const InfoCircleOutlined$1 = InfoCircleOutlined;
727
+
728
+ // This icon file is generated automatically.
729
+ 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" };
730
+ const LeftOutlined$1 = LeftOutlined;
731
+
732
+ // This icon file is generated automatically.
733
+ 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" };
734
+ const PlusSquareOutlined$1 = PlusSquareOutlined;
735
+
736
+ // This icon file is generated automatically.
737
+ 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" };
738
+ const RightOutlined$1 = RightOutlined;
739
+
740
+ var __assign = (undefined && undefined.__assign) || function () {
741
+ __assign = Object.assign || function(t) {
742
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
743
+ s = arguments[i];
744
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
745
+ t[p] = s[p];
746
+ }
747
+ return t;
748
+ };
749
+ return __assign.apply(this, arguments);
750
+ };
751
+ var defaultColors = {
752
+ primaryColor: '#333',
753
+ secondaryColor: '#E6E6E6'
754
+ };
755
+ function renderIconDefinitionToSVGElement(icond, options) {
756
+ if (options === void 0) { options = {}; }
757
+ if (typeof icond.icon === 'function') {
758
+ // two-tone
759
+ var placeholders = options.placeholders || defaultColors;
760
+ return renderAbstractNodeToSVGElement(icond.icon(placeholders.primaryColor, placeholders.secondaryColor), options);
761
+ }
762
+ // fill, outline
763
+ return renderAbstractNodeToSVGElement(icond.icon, options);
764
+ }
765
+ function renderAbstractNodeToSVGElement(node, options) {
766
+ var targetAttrs = node.tag === 'svg'
767
+ ? __assign(__assign({}, node.attrs), (options.extraSVGAttrs || {})) : node.attrs;
768
+ var attrs = Object.keys(targetAttrs).reduce(function (acc, nextKey) {
769
+ var key = nextKey;
770
+ var value = targetAttrs[key];
771
+ var token = "".concat(key, "=\"").concat(value, "\"");
772
+ acc.push(token);
773
+ return acc;
774
+ }, []);
775
+ var attrsToken = attrs.length ? ' ' + attrs.join(' ') : '';
776
+ var children = (node.children || [])
777
+ .map(function (child) { return renderAbstractNodeToSVGElement(child, options); })
778
+ .join('');
779
+ if (children && children.length) {
780
+ return "<".concat(node.tag).concat(attrsToken, ">").concat(children, "</").concat(node.tag, ">");
781
+ }
782
+ return "<".concat(node.tag).concat(attrsToken, " />");
783
+ }
784
+
785
+ const lotteryTippingTicketBetCss = ".LotteryTippingTicketBet__container {\n display: block; /* Or inline-block, depending on desired layout flow */\n font-size: 14px;\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.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\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.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 background-color: transparent;\n cursor: pointer;\n font-weight: 500;\n white-space: nowrap;\n display: inline-flex;\n border-radius: 1.6rem;\n border: 1px solid var(--emw--color-gray-100, #e6e6e6);\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n padding-left: 1rem;\n padding-right: 1rem;\n margin-right: 2rem;\n color: var(--emw--color-typography, #000);\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 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 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 backface-visibility: hidden;\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}";
786
+ const LotteryTippingTicketBetStyle0 = lotteryTippingTicketBetCss;
787
+
788
+ const addImagePath = renderIconDefinitionToSVGElement(PlusSquareOutlined$1, {
789
+ extraSVGAttrs: { width: '20px', height: '20px', fill: 'currentColor' }
790
+ });
791
+ const deleteImagePath = renderIconDefinitionToSVGElement(DeleteOutlined$1, {
792
+ extraSVGAttrs: { width: '20px', height: '20px', fill: 'currentColor' }
793
+ });
794
+ const infoImagePath = renderIconDefinitionToSVGElement(InfoCircleOutlined$1, {
795
+ extraSVGAttrs: { width: '16px', height: '16px', fill: 'currentColor' }
796
+ });
797
+ const leftImagePath = renderIconDefinitionToSVGElement(LeftOutlined$1, {
798
+ extraSVGAttrs: { width: '20px', height: '20px', fill: 'currentColor' }
799
+ });
800
+ const rightImagePath = renderIconDefinitionToSVGElement(RightOutlined$1, {
801
+ extraSVGAttrs: { width: '20px', height: '20px', fill: 'currentColor' }
802
+ });
803
+ const LotteryTippingTicketBet = class {
804
+ constructor(hostRef) {
805
+ registerInstance(this, hostRef);
806
+ this.lotteryTippingBulletBetEvent = createEvent(this, "lotteryTippingBulletBetSelect", 7);
807
+ this.lotteryTippingCurrentPageChangeEvent = createEvent(this, "lotteryTippingCurrentPageChange", 7);
808
+ this.eventNameRender = (item, value) => (h("div", { class: "flex gap-1 eventNameContainer__item" }, h("span", { class: "eventNameContainer__item--title" }, value), h("general-tooltip", null, h("span", { slot: "trigger", class: "icon info-icon", innerHTML: infoImagePath, style: { width: '18px' } }), h("div", { slot: "content" }, h("div", { class: "match-info" }, h("div", { class: "match-info-item" }, h("div", { class: "match-info-item-label" }, translate('homeTeam', this.language)), h("div", { class: "match-info-item-value" }, item.homeName)), h("div", { class: "match-info-item" }, h("div", { class: "match-info-item-label" }, translate('awayTeam', this.language)), h("div", { class: "match-info-item-value" }, item.awayName)))))));
809
+ this.columns = [
810
+ { title: '', value: 'index', width: 3 },
811
+ {
812
+ title: '',
813
+ value: 'eventName',
814
+ width: 70,
815
+ render: this.eventNameRender
816
+ },
817
+ {
818
+ title: '',
819
+ value: 'startTime',
820
+ width: 22,
821
+ align: 'right',
822
+ nowrap: true,
823
+ render: (_, value) => formatDate({ date: value, format: 'ccc HH:mm' })
824
+ },
825
+ {
826
+ title: () => (h("lottery-tipping-bullet-group", { theme: "text", bulletConfigContent: JSON.stringify(DEFAULT_BULLET_CONFIG) })),
827
+ value: 'results',
828
+ width: 5,
829
+ render: (_, __, curRow) => {
830
+ var _a, _b;
831
+ return (h("lottery-tipping-bullet-group", { mode: this.mode, bulletConfigContent: JSON.stringify((_b = (_a = this.bulletConfigLineGroup) === null || _a === void 0 ? void 0 : _a[this.currentPage - 1]) === null || _b === void 0 ? void 0 : _b[curRow]), "position-idx": `${this.currentPage - 1}${SPLIT_TOKEN}${curRow}` }));
832
+ }
833
+ }
834
+ ];
835
+ this.mbSource = undefined;
836
+ this.clientStyling = undefined;
837
+ this.clientStylingUrl = undefined;
838
+ this.translationUrl = '';
839
+ this.language = 'en';
840
+ this.translationData = undefined;
841
+ this.clientStylingUrlContent = '';
842
+ this.sessionId = undefined;
843
+ this.endpoint = '';
844
+ this.gameId = undefined;
845
+ this.drawId = undefined;
846
+ this.totalPages = undefined;
847
+ this.minTotalPages = 0;
848
+ this.maxTotalPages = 0;
849
+ this.mode = 'multi';
850
+ this.readPretty = false;
851
+ this.defaultBulletConfigLineGroup = undefined;
852
+ this.bulletConfigLineGroup = [[[]]];
853
+ this.currentPage = 1;
854
+ this.isLoading = true;
855
+ this.hasErrors = false;
856
+ this.dialogConfig = { visible: false };
857
+ this.ticketDataSource = [];
858
+ }
859
+ handleNewTranslations() {
860
+ this.isLoading = true;
861
+ getTranslations(JSON.parse(this.translationUrl));
862
+ this.isLoading = false;
863
+ }
864
+ handleClientStylingChange(newValue, oldValue) {
865
+ if (newValue != oldValue) {
866
+ setClientStyling(this.stylingContainer, this.clientStyling);
867
+ }
868
+ }
869
+ handleClientStylingUrlChange(newValue, oldValue) {
870
+ if (newValue != oldValue) {
871
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
872
+ }
873
+ }
874
+ handleMbSourceChange(newValue, oldValue) {
875
+ if (newValue != oldValue) {
876
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
877
+ }
878
+ }
879
+ disconnectedCallback() {
880
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
881
+ }
882
+ componentWillLoad() {
883
+ if (this.translationUrl) {
884
+ getTranslations(JSON.parse(this.translationUrl));
885
+ }
886
+ }
887
+ componentDidLoad() {
888
+ console.log(111, this.stylingContainer);
889
+ if (this.stylingContainer) {
890
+ if (this.mbSource)
891
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
892
+ if (this.clientStyling)
893
+ setClientStyling(this.stylingContainer, this.clientStyling);
894
+ if (this.clientStylingUrl)
895
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
896
+ }
897
+ }
898
+ get parsedDefaultBulletConfigLineGroup() {
899
+ if (typeof this.defaultBulletConfigLineGroup === 'string' && this.defaultBulletConfigLineGroup) {
900
+ try {
901
+ const _temp = JSON.parse(this.defaultBulletConfigLineGroup);
902
+ return this.readPrettyHandler(_temp);
903
+ }
904
+ catch (e) {
905
+ console.error('Error parsing defaultBulletConfigLineGroup:', e);
906
+ return undefined;
907
+ }
908
+ }
909
+ else {
910
+ return undefined;
911
+ }
912
+ }
913
+ readPrettyHandler(rawDefaultBulletConfigLineGroup) {
914
+ if (this.readPretty) {
915
+ this.currentPage = 1;
916
+ this.minTotalPages = 1;
917
+ this.maxTotalPages = this.totalPages;
918
+ return rawDefaultBulletConfigLineGroup === null || rawDefaultBulletConfigLineGroup === void 0 ? void 0 : rawDefaultBulletConfigLineGroup.map((item) => item === null || item === void 0 ? void 0 : item.map((i) => i === null || i === void 0 ? void 0 : i.map((j) => (Object.assign(Object.assign({}, j), { disabled: true })))));
919
+ }
920
+ return rawDefaultBulletConfigLineGroup;
921
+ }
922
+ initLineForBulletConfig() {
923
+ var _a;
924
+ return Array.from({ length: (_a = this.ticketDataSource) === null || _a === void 0 ? void 0 : _a.length }, () => [...DEFAULT_BULLET_CONFIG]);
925
+ }
926
+ _resetBulletConfig() {
927
+ this.bulletConfigLineGroup = Array.from({ length: this.totalPages }).map(this.initLineForBulletConfig.bind(this));
928
+ }
929
+ fetchMatchData() {
930
+ // get match
931
+ let url = new URL(`${this.endpoint}/games/${this.gameId}/draws/${this.drawId}/findDrawEvents`);
932
+ if (!this.gameId || !this.drawId)
933
+ return;
934
+ this.isLoading = true;
935
+ fetcher(url.href)
936
+ .then((data) => {
937
+ this.ticketDataSource = data || [];
938
+ this.isLoading = false;
939
+ this.updateBulletConfigLineGroup();
940
+ })
941
+ .catch((err) => {
942
+ this.isLoading = false;
943
+ this.hasErrors = true;
944
+ console.error('Error!', err);
945
+ });
946
+ }
947
+ updateBulletConfigLineGroup() {
948
+ if (this.parsedDefaultBulletConfigLineGroup && this.parsedDefaultBulletConfigLineGroup.length > 0)
949
+ this.bulletConfigLineGroup = this.parsedDefaultBulletConfigLineGroup;
950
+ else {
951
+ this._resetBulletConfig();
952
+ }
953
+ }
954
+ connectedCallback() {
955
+ this.fetchMatchData();
956
+ }
957
+ handleClearAll() {
958
+ this._resetBulletConfig();
959
+ showNotification({ message: translate('selectionCleared', this.language) });
960
+ this.lotteryTippingBulletBetEvent.emit({ hasSelectBullet: false });
961
+ }
962
+ async resetBulletConfig({ minLineNumber, maxLineNumber, defaultBoards }) {
963
+ this.totalPages = defaultBoards;
964
+ this.minTotalPages = minLineNumber;
965
+ this.maxTotalPages = maxLineNumber;
966
+ this.currentPage = 1;
967
+ this._resetBulletConfig();
968
+ this.lotteryTippingBulletBetEvent.emit({ hasSelectBullet: false });
969
+ }
970
+ lotteryTippingBulletGroupSelectionHandler(event) {
971
+ const { bulletConfigArr, positionIdx } = event.detail;
972
+ const [curLine, curRow] = positionIdx.split(SPLIT_TOKEN);
973
+ this.bulletConfigLineGroup[curLine][curRow] = bulletConfigArr;
974
+ this.bulletConfigLineGroup = [...this.bulletConfigLineGroup];
975
+ this.lotteryTippingBulletBetEvent.emit({ hasSelectBullet: true });
976
+ }
977
+ async getData() {
978
+ await this.validateBulletConfigLineGroup();
979
+ return this.bulletConfigLineGroup;
980
+ }
981
+ validateBulletConfigLineGroup() {
982
+ if (JSON.stringify(this.bulletConfigLineGroup) === '[[[]]]')
983
+ return Promise.resolve(this.bulletConfigLineGroup);
984
+ const totalPages = this.bulletConfigLineGroup.length;
985
+ if (totalPages !== this.totalPages || totalPages < this.minTotalPages || totalPages > this.maxTotalPages) {
986
+ this._resetBulletConfig();
987
+ return Promise.reject(new Error('Invalid bullet config line group length'));
988
+ }
989
+ else {
990
+ return Promise.resolve(this.bulletConfigLineGroup);
991
+ }
992
+ }
993
+ /**
994
+ * previous page
995
+ */
996
+ prevPage() {
997
+ const doPrev = () => {
998
+ if (this.currentPage > 1) {
999
+ this.currentPage--;
1000
+ }
1001
+ };
1002
+ this.swapCard('prev', doPrev);
1003
+ }
1004
+ /**
1005
+ * next page
1006
+ */
1007
+ nextPage() {
1008
+ const doNext = () => {
1009
+ if (this.currentPage < this.totalPages) {
1010
+ this.currentPage++;
1011
+ }
1012
+ };
1013
+ this.swapCard('next', doNext);
1014
+ }
1015
+ handleAddLine() {
1016
+ const doAdd = () => {
1017
+ if (this.totalPages <= this.maxTotalPages - 1) {
1018
+ this.bulletConfigLineGroup.push(this.initLineForBulletConfig());
1019
+ this.totalPages++;
1020
+ // move to next line
1021
+ this.currentPage++;
1022
+ this.lotteryTippingBulletBetEvent.emit();
1023
+ }
1024
+ };
1025
+ this.swapCard('add', doAdd);
1026
+ }
1027
+ handleRemoveLine() {
1028
+ const doRemove = () => {
1029
+ if (this.totalPages >= this.minTotalPages + 1) {
1030
+ const closeDialog = () => {
1031
+ this.dialogConfig = { visible: false };
1032
+ };
1033
+ const doRemove = () => {
1034
+ this.bulletConfigLineGroup.splice(this.currentPage - 1, 1);
1035
+ this.totalPages--;
1036
+ if (this.currentPage !== 1)
1037
+ this.currentPage--;
1038
+ this.lotteryTippingBulletBetEvent.emit();
1039
+ this.swapCard('remove', closeDialog);
1040
+ };
1041
+ this.dialogConfig = {
1042
+ visible: true,
1043
+ content: translate('selectionOnLineCleared', this.language),
1044
+ onConfirm: doRemove,
1045
+ onCancel: closeDialog
1046
+ };
1047
+ }
1048
+ };
1049
+ doRemove();
1050
+ }
1051
+ swapCard(action, cb) {
1052
+ const wrapper = this.mainContainer;
1053
+ if (!wrapper)
1054
+ return;
1055
+ const map = {
1056
+ next: { out: 'card-out-left', in: 'card-in-left' },
1057
+ prev: { out: 'card-out-right', in: 'card-in-right' },
1058
+ remove: { out: 'card-out-down', in: 'card-in-right' },
1059
+ add: { out: 'card-out-left', in: 'card-in-up' }
1060
+ };
1061
+ const { out: outCls, in: inCls } = map[action];
1062
+ wrapper.classList.add(outCls);
1063
+ // FIXME: reference not clear
1064
+ wrapper.addEventListener('animationend', () => {
1065
+ wrapper.classList.remove(outCls);
1066
+ cb();
1067
+ const newWrapper = this.mainContainer;
1068
+ if (!newWrapper)
1069
+ return;
1070
+ newWrapper.classList.add(inCls);
1071
+ newWrapper.addEventListener('animationend', () => newWrapper.classList.remove(inCls), { once: true });
1072
+ }, { once: true });
1073
+ }
1074
+ handleCurrentPageChange() {
1075
+ this.lotteryTippingCurrentPageChangeEvent.emit({ currentPage: this.currentPage });
1076
+ }
1077
+ renderLoading() {
1078
+ return (h("div", { class: "loading-wrap" }, h("section", { class: "dots-container" }, h("div", { class: "dot" }), h("div", { class: "dot" }), h("div", { class: "dot" }), h("div", { class: "dot" }), h("div", { class: "dot" }))));
1079
+ }
1080
+ render() {
1081
+ var _a, _b, _c, _d;
1082
+ if (this.isLoading) {
1083
+ return this.renderLoading();
1084
+ }
1085
+ if (this.hasErrors) {
1086
+ return (h("div", { ref: (el) => (this.stylingContainer = el), class: "LotteryTippingTicketBet__container" }, h("p", null, translate('error', this.language))));
1087
+ }
1088
+ const MyTable = ({ columns, dataSource, hideHead = false, grid = true, bordered = true }) => (h("table", { class: { bordered: bordered, grid: grid, 'my-table-component': true } }, !hideHead && (h("thead", null, h("tr", null, columns.map((column) => {
1089
+ var _a;
1090
+ return (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)));
1091
+ })))), h("tbody", null, dataSource.map((row, index) => (h("tr", { key: index }, columns.map((column) => (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) : row[column.value])))))))));
1092
+ const lineOperatorAddShow = this.totalPages < this.maxTotalPages && this.currentPage === this.totalPages ? true : false;
1093
+ const lineOperatorRemoveShow = this.totalPages > this.minTotalPages ? true : false;
1094
+ if (this.ticketDataSource.length === 0 || this.minTotalPages === 0 || this.maxTotalPages === 0) {
1095
+ return (h("div", { class: "LotteryTippingTicketBet__container", ref: (el) => (this.stylingContainer = el) }, h("div", { class: "LotteryTippingTicketBet__empty" }, h("p", null, translate('noData', this.language)))));
1096
+ }
1097
+ if (this.readPretty) {
1098
+ return (h("div", { class: "LotteryTippingTicketBet__container", ref: (el) => (this.stylingContainer = el) }, h("div", { class: "LotteryTippingTicketBet__main", ref: (el) => (this.mainContainer = el) }, 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.totalPages > 1 && (h("div", null, h("div", { class: 'border-line' }), h("div", { class: "LotteryTippingTicketBet__footer" }, h("div", { class: "my-pagination flex justify-between" }, h("span", null, translate('lineInfo', this.language, {
1099
+ currentPage: this.currentPage,
1100
+ totalPages: this.totalPages
1101
+ })), h("div", { class: 'flex gap-1' }, h("span", { class: `btn ${this.currentPage === 1 ? 'disabled' : ''}`, onClick: this.prevPage.bind(this) }, h("span", { class: "icon", innerHTML: leftImagePath })), h("span", { class: `btn ${this.currentPage === this.totalPages ? 'disabled' : ''}`, onClick: this.nextPage.bind(this) }, h("span", { class: "icon", innerHTML: rightImagePath }))))))))));
1102
+ }
1103
+ return (h("div", { ref: (el) => (this.stylingContainer = el), class: "LotteryTippingTicketBet__container" }, h("div", { class: "LotteryTippingTicketBet__tableToolbar flex justify-end gap-1" }, h("button", { class: {
1104
+ 'LotteryTippingTicketBet__tableToolbar--item': true,
1105
+ 'mr-0': !(lineOperatorAddShow || lineOperatorRemoveShow)
1106
+ }, onClick: this.handleClearAll.bind(this) }, translate('clearAll', this.language))), h("div", { class: "flex align-center LotteryTippingTicketBet__main", ref: (el) => (this.mainContainer = el) }, h(MyTable, { columns: this.columns, dataSource: ((_b = this.ticketDataSource) === null || _b === void 0 ? void 0 : _b.map((item, index) => (Object.assign(Object.assign({}, item), { index: index + 1 })))) || [], hideHead: false, grid: false, bordered: false }), (lineOperatorAddShow || lineOperatorRemoveShow) && (h("div", { class: "LotteryTippingTicketBet__lineOperatorGroup" }, lineOperatorAddShow && (h("div", { class: {
1107
+ 'LotteryTippingTicketBet__lineOperatorGroup--item': true
1108
+ }, onClick: this.handleAddLine.bind(this) }, h("span", { class: "icon", innerHTML: addImagePath }))), lineOperatorRemoveShow && (h("div", { class: {
1109
+ 'LotteryTippingTicketBet__lineOperatorGroup--item': true
1110
+ }, onClick: this.handleRemoveLine.bind(this) }, h("span", { class: "icon", innerHTML: deleteImagePath })))))), h("div", { class: 'border-line' }), h("div", { class: "LotteryTippingTicketBet__footer" }, h("div", { class: "my-pagination flex justify-between" }, h("span", null, translate('lineInfo', this.language, { currentPage: this.currentPage, totalPages: this.totalPages })), h("div", { class: 'flex gap-1' }, h("span", { class: `btn ${this.currentPage === 1 ? 'disabled' : ''}`, onClick: this.prevPage.bind(this) }, h("span", { class: "icon", innerHTML: leftImagePath })), h("span", { class: `btn ${this.currentPage === this.totalPages ? 'disabled' : ''}`, onClick: this.nextPage.bind(this) }, h("span", { class: "icon", innerHTML: rightImagePath }))))), this.dialogConfig.visible && (h("vaadin-confirm-dialog", { rejectButtonVisible: true, rejectText: translate('cancel', this.language), confirmText: translate('confirm', this.language), opened: (_c = this.dialogConfig) === null || _c === void 0 ? void 0 : _c.visible, onConfirm: this.dialogConfig.onConfirm, onReject: this.dialogConfig.onCancel }, (_d = this.dialogConfig) === null || _d === void 0 ? void 0 : _d.content))));
1111
+ }
1112
+ static get assetsDirs() { return ["../static"]; }
1113
+ static get watchers() { return {
1114
+ "translationUrl": ["handleNewTranslations"],
1115
+ "clientStyling": ["handleClientStylingChange"],
1116
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
1117
+ "mbSource": ["handleMbSourceChange"],
1118
+ "gameId": ["fetchMatchData"],
1119
+ "sessionId": ["fetchMatchData"],
1120
+ "drawId": ["fetchMatchData"],
1121
+ "defaultBulletConfigLineGroup": ["fetchMatchData"],
1122
+ "currentPage": ["handleCurrentPageChange"]
1123
+ }; }
1124
+ };
1125
+ LotteryTippingTicketBet.style = LotteryTippingTicketBetStyle0;
1126
+
1127
+ export { GeneralTooltip as general_tooltip, LotteryButton as lottery_button, LotteryTippingBullet as lottery_tipping_bullet, LotteryTippingBulletGroup as lottery_tipping_bullet_group, LotteryTippingTicketBanner as lottery_tipping_ticket_banner, LotteryTippingTicketBet as lottery_tipping_ticket_bet };