@everymatrix/lottery-hakuna-ticket 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 (59) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/index-14ac4886.js +1356 -0
  3. package/dist/cjs/index.cjs.js +10 -0
  4. package/dist/cjs/loader.cjs.js +15 -0
  5. package/dist/cjs/lottery-button_6.cjs.entry.js +967 -0
  6. package/dist/cjs/lottery-hakuna-ticket-a4c6f2d2.js +384 -0
  7. package/dist/cjs/lottery-hakuna-ticket.cjs.js +25 -0
  8. package/dist/collection/collection-manifest.json +43 -0
  9. package/dist/collection/components/lottery-hakuna-ticket/index.js +1 -0
  10. package/dist/collection/components/lottery-hakuna-ticket/lottery-hakuna-ticket.css +113 -0
  11. package/dist/collection/components/lottery-hakuna-ticket/lottery-hakuna-ticket.js +622 -0
  12. package/dist/collection/components/lottery-hakuna-ticket/lottery-hakuna-ticket.types.js +5 -0
  13. package/dist/collection/index.js +1 -0
  14. package/dist/collection/utils/locale.utils.js +85 -0
  15. package/dist/collection/utils/utils.js +3 -0
  16. package/dist/esm/app-globals-0f993ce5.js +3 -0
  17. package/dist/esm/index-032d8575.js +1328 -0
  18. package/dist/esm/index.js +2 -0
  19. package/dist/esm/loader.js +11 -0
  20. package/dist/esm/lottery-button_6.entry.js +959 -0
  21. package/dist/esm/lottery-hakuna-ticket-2019142e.js +379 -0
  22. package/dist/esm/lottery-hakuna-ticket.js +20 -0
  23. package/dist/index.cjs.js +1 -0
  24. package/dist/index.js +1 -0
  25. package/dist/lottery-hakuna-ticket/app-globals-0f993ce5.js +1 -0
  26. package/dist/lottery-hakuna-ticket/index-032d8575.js +2 -0
  27. package/dist/lottery-hakuna-ticket/index.esm.js +1 -0
  28. package/dist/lottery-hakuna-ticket/lottery-button_6.entry.js +1 -0
  29. package/dist/lottery-hakuna-ticket/lottery-hakuna-ticket-2019142e.js +1 -0
  30. package/dist/lottery-hakuna-ticket/lottery-hakuna-ticket.esm.js +1 -0
  31. package/dist/stencil.config.dev.js +19 -0
  32. package/dist/stencil.config.js +19 -0
  33. package/dist/storybook/main.js +43 -0
  34. package/dist/storybook/preview.js +9 -0
  35. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
  36. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket/.stencil/packages/stencil/lottery-hakuna-ticket/stencil.config.d.ts +2 -0
  37. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket/.stencil/packages/stencil/lottery-hakuna-ticket/stencil.config.dev.d.ts +2 -0
  38. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket/.stencil/packages/stencil/lottery-hakuna-ticket/storybook/main.d.ts +3 -0
  39. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket/.stencil/packages/stencil/lottery-hakuna-ticket/storybook/preview.d.ts +70 -0
  40. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket/.stencil/tools/plugins/index.d.ts +4 -0
  41. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
  42. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
  43. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
  44. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
  45. package/dist/types/components/lottery-hakuna-ticket/index.d.ts +1 -0
  46. package/dist/types/components/lottery-hakuna-ticket/lottery-hakuna-ticket.d.ts +110 -0
  47. package/dist/types/components/lottery-hakuna-ticket/lottery-hakuna-ticket.types.d.ts +97 -0
  48. package/dist/types/components.d.ts +190 -0
  49. package/dist/types/index.d.ts +1 -0
  50. package/dist/types/stencil-public-runtime.d.ts +1674 -0
  51. package/dist/types/utils/locale.utils.d.ts +3 -0
  52. package/dist/types/utils/utils.d.ts +1 -0
  53. package/loader/cdn.js +1 -0
  54. package/loader/index.cjs.js +1 -0
  55. package/loader/index.d.ts +24 -0
  56. package/loader/index.es2017.js +1 -0
  57. package/loader/index.js +2 -0
  58. package/loader/package.json +11 -0
  59. package/package.json +27 -0
@@ -0,0 +1,967 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-14ac4886.js');
6
+ const lotteryHakunaTicket = require('./lottery-hakuna-ticket-a4c6f2d2.js');
7
+
8
+ const DEFAULT_LANGUAGE$2 = 'en';
9
+ const SUPPORTED_LANGUAGES$2 = ['ro', 'en', 'fr', 'ar', 'hr', 'zh'];
10
+ const TRANSLATIONS$2 = {
11
+ en: {
12
+ loading: 'Loading'
13
+ },
14
+ ro: {},
15
+ fr: {},
16
+ ar: {},
17
+ hr: {}
18
+ };
19
+ const translate$2 = (key, customLang, replacements) => {
20
+ const lang = customLang;
21
+ let translation = TRANSLATIONS$2[lang !== undefined && SUPPORTED_LANGUAGES$2.includes(lang) ? lang : DEFAULT_LANGUAGE$2][key];
22
+ if (replacements) {
23
+ Object.keys(replacements).forEach((placeholder) => {
24
+ translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
25
+ });
26
+ }
27
+ return translation;
28
+ };
29
+ const getTranslations$2 = (data) => {
30
+ Object.keys(data).forEach((item) => {
31
+ for (let key in data[item]) {
32
+ TRANSLATIONS$2[item][key] = data[item][key];
33
+ }
34
+ });
35
+ };
36
+ const resolveTranslationUrl$1 = async (translationUrl) => {
37
+ if (translationUrl) {
38
+ try {
39
+ const response = await fetch(translationUrl);
40
+ if (!response.ok) {
41
+ throw new Error(`HTTP error! status: ${response.status}`);
42
+ }
43
+ const translations = await response.json();
44
+ getTranslations$2(translations);
45
+ }
46
+ catch (error) {
47
+ console.error('Failed to fetch or parse translations from URL:', error);
48
+ }
49
+ }
50
+ };
51
+
52
+ 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}}";
53
+ const LotteryButtonStyle0 = lotteryButtonCss;
54
+
55
+ const LotteryButton = class {
56
+ constructor(hostRef) {
57
+ index.registerInstance(this, hostRef);
58
+ this.handleClick = (event) => {
59
+ if (this.disabled) {
60
+ return;
61
+ }
62
+ // Get the button element from the shadow root
63
+ const button = this.host.shadowRoot.querySelector('.btn');
64
+ if (!button)
65
+ return;
66
+ const rect = button.getBoundingClientRect();
67
+ const size = Math.max(rect.width, rect.height);
68
+ const top = event.clientY - rect.top - size / 2;
69
+ const left = event.clientX - rect.left - size / 2;
70
+ // Add the new ripple to the state, triggering a re-render
71
+ const newRipple = { top, left, size };
72
+ this.ripples = [...this.ripples, newRipple];
73
+ // Set a timeout to clean up the ripple from the state after the animation ends
74
+ // This prevents the DOM from filling up with old ripple elements
75
+ setTimeout(() => {
76
+ this.ripples = this.ripples.filter((r) => r !== newRipple);
77
+ }, 600); // This duration should match the CSS animation duration
78
+ };
79
+ this.variant = 'primary';
80
+ this.size = 'medium';
81
+ this.color = undefined;
82
+ this.disabled = false;
83
+ this.loading = false;
84
+ this.text = undefined;
85
+ this.mbSource = undefined;
86
+ this.language = 'en';
87
+ this.clientStyling = undefined;
88
+ this.clientStylingUrl = undefined;
89
+ this.translationUrl = '';
90
+ this.ripples = [];
91
+ }
92
+ handleClientStylingChange(newValue, oldValue) {
93
+ if (newValue != oldValue) {
94
+ lotteryHakunaTicket.setClientStyling(this.stylingContainer, this.clientStyling);
95
+ }
96
+ }
97
+ handleClientStylingUrlChange(newValue, oldValue) {
98
+ if (newValue != oldValue) {
99
+ lotteryHakunaTicket.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
100
+ }
101
+ }
102
+ handleMbSourceChange(newValue, oldValue) {
103
+ if (newValue != oldValue) {
104
+ lotteryHakunaTicket.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
105
+ }
106
+ }
107
+ disconnectedCallback() {
108
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
109
+ }
110
+ componentDidLoad() {
111
+ if (this.stylingContainer) {
112
+ if (this.mbSource)
113
+ lotteryHakunaTicket.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
114
+ if (this.clientStyling)
115
+ lotteryHakunaTicket.setClientStyling(this.stylingContainer, this.clientStyling);
116
+ if (this.clientStylingUrl)
117
+ lotteryHakunaTicket.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
118
+ }
119
+ }
120
+ componentWillLoad() {
121
+ if (this.translationUrl) {
122
+ resolveTranslationUrl$1(this.translationUrl);
123
+ }
124
+ }
125
+ render() {
126
+ const { variant, disabled, size, color } = this;
127
+ const isDisabled = disabled || this.loading;
128
+ // Calculate styles based on variant and color
129
+ const buttonStyles = {};
130
+ if (color) {
131
+ switch (variant) {
132
+ case 'primary':
133
+ Object.assign(buttonStyles, {
134
+ backgroundColor: color,
135
+ borderColor: color
136
+ });
137
+ break;
138
+ case 'outline':
139
+ case 'dashed':
140
+ Object.assign(buttonStyles, {
141
+ color: color,
142
+ borderColor: color
143
+ });
144
+ break;
145
+ case 'text':
146
+ Object.assign(buttonStyles, {
147
+ color: color
148
+ });
149
+ break;
150
+ default:
151
+ Object.assign(buttonStyles, {
152
+ backgroundColor: color,
153
+ borderColor: color
154
+ });
155
+ }
156
+ }
157
+ return (index.h("button", { key: 'aa74ad98c90e7548228557bf8a8d26b125d4a83a', class: {
158
+ btn: true,
159
+ [`btn--${variant}`]: true,
160
+ [`btn--${size}`]: true,
161
+ 'btn--loading': this.loading
162
+ }, 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$2('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: {
163
+ top: `${ripple.top}px`,
164
+ left: `${ripple.left}px`,
165
+ width: `${ripple.size}px`,
166
+ height: `${ripple.size}px`
167
+ } }))))));
168
+ }
169
+ get host() { return index.getElement(this); }
170
+ static get watchers() { return {
171
+ "clientStyling": ["handleClientStylingChange"],
172
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
173
+ "mbSource": ["handleMbSourceChange"]
174
+ }; }
175
+ };
176
+ LotteryButton.style = LotteryButtonStyle0;
177
+
178
+ const lotteryHakunaCollapseCss = ":host{display:block;width:100%;box-sizing:border-box}.lottery-hakuna-collapse{border:var(--lottery-hakuna-collapse-border-width, 1px) solid transparent;border-radius:var(--lottery-hakuna-collapse-border-radius, 12px);background-origin:border-box;background-clip:padding-box, border-box;background-image:linear-gradient(var(--lottery-hakuna-collapse-bg, #120505), var(--lottery-hakuna-collapse-bg, #120505)), linear-gradient(to top left, var(--lottery-hakuna-collapse-border-gradient-start, #c52217) var(--lottery-hakuna-collapse-border-gradient-start-stop, 32%), var(--lottery-hakuna-collapse-border-gradient-end, #2c2525) var(--lottery-hakuna-collapse-border-gradient-end-stop, 68%));overflow:hidden;margin-bottom:var(--lottery-hakuna-collapse-margin-bottom, 10px)}.lottery-hakuna-collapse .header{display:flex;justify-content:space-between;align-items:center;padding:var(--lottery-hakuna-collapse-header-padding, 20px);cursor:pointer;user-select:none}.lottery-hakuna-collapse .header .header-content{display:flex;align-items:center;flex:1;gap:var(--lottery-hakuna-collapse-header-gap, 8px)}.lottery-hakuna-collapse .header .title{font-size:var(--lottery-hakuna-collapse-title-size, 16px);font-weight:var(--lottery-hakuna-collapse-title-weight, 600);color:var(--lottery-hakuna-collapse-title-color, #fff)}.lottery-hakuna-collapse .header .icon{color:var(--lottery-hakuna-collapse-icon-color, #fff);font-size:var(--lottery-hakuna-collapse-icon-size, 12px);transition:transform 0.3s ease}.lottery-hakuna-collapse .header .icon.is-open{transform:rotate(180deg)}.lottery-hakuna-collapse .content{padding:var(--lottery-hakuna-collapse-content-padding, 0 20px 20px 20px);color:var(--lottery-hakuna-collapse-content-color, #fff);font-size:var(--lottery-hakuna-collapse-content-size, 14px);line-height:var(--lottery-hakuna-collapse-content-line-height, 1.5)}";
179
+ const LotteryHakunaCollapseStyle0 = lotteryHakunaCollapseCss;
180
+
181
+ const LotteryHakunaCollapse = class {
182
+ constructor(hostRef) {
183
+ index.registerInstance(this, hostRef);
184
+ this.mbSource = undefined;
185
+ this.clientStyling = undefined;
186
+ this.clientStylingUrl = undefined;
187
+ this.headerTitle = '';
188
+ this.collapsed = true;
189
+ this.isOpen = false;
190
+ this.hasSummary = false;
191
+ }
192
+ handleClientStylingChange(newValue, oldValue) {
193
+ if (newValue != oldValue) {
194
+ lotteryHakunaTicket.setClientStyling(this.stylingContainer, this.clientStyling);
195
+ }
196
+ }
197
+ handleClientStylingUrlChange(newValue, oldValue) {
198
+ if (newValue != oldValue) {
199
+ lotteryHakunaTicket.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
200
+ }
201
+ }
202
+ handleMbSourceChange(newValue, oldValue) {
203
+ if (newValue != oldValue) {
204
+ lotteryHakunaTicket.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
205
+ }
206
+ }
207
+ componentWillLoad() {
208
+ this.isOpen = !this.collapsed;
209
+ }
210
+ componentWillRender() {
211
+ this.hasSummary = !!this.el.querySelector('[slot="summary"]');
212
+ }
213
+ componentDidLoad() {
214
+ if (this.stylingContainer) {
215
+ if (this.mbSource)
216
+ lotteryHakunaTicket.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
217
+ if (this.clientStyling)
218
+ lotteryHakunaTicket.setClientStyling(this.stylingContainer, this.clientStyling);
219
+ if (this.clientStylingUrl)
220
+ lotteryHakunaTicket.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
221
+ }
222
+ }
223
+ disconnectedCallback() {
224
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
225
+ }
226
+ async toggle() {
227
+ this.isOpen = !this.isOpen;
228
+ }
229
+ render() {
230
+ const showContent = this.isOpen || this.hasSummary;
231
+ return (index.h("div", { key: '5e28ba28bf46f6a22f749bbd878aef8972bb7eeb', ref: (el) => (this.stylingContainer = el), class: "lottery-hakuna-collapse" }, index.h("div", { key: 'ec42a23932c7e0652476743c1cafcfe7e411c2aa', class: "header", onClick: () => this.toggle() }, index.h("div", { key: '152e98bb7fc69274d61ffff0d6de9f76a1df90f8', class: "header-content" }, this.headerTitle && index.h("span", { key: '0acc51d711ca12fa1a666dbe1678071a37fa0aff', class: "title" }, this.headerTitle)), index.h("span", { key: 'ad31e6e3a249a9dca394e725e805422297811f85', class: { icon: true, 'is-open': this.isOpen } }, index.h("svg", { key: '14bc41acc77204fcb1966f8966dc6feb49730518', xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 18 18", fill: "none" }, index.h("path", { key: 'bac152fc477b275a1792264a35dba2765cf2687f', "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M3.96967 6.21967C4.26256 5.92678 4.73744 5.92678 5.03033 6.21967L9 10.1893L12.9697 6.21967C13.2626 5.92678 13.7374 5.92678 14.0303 6.21967C14.3232 6.51256 14.3232 6.98744 14.0303 7.28033L9.53033 11.7803C9.23744 12.0732 8.76256 12.0732 8.46967 11.7803L3.96967 7.28033C3.67678 6.98744 3.67678 6.51256 3.96967 6.21967Z", fill: "currentColor" })))), showContent && index.h("div", { key: '0358ec8ccc21286a31f6ffcb770efa6c1bcc36ea', class: "content" }, this.isOpen ? index.h("slot", null) : index.h("slot", { name: "summary" }))));
232
+ }
233
+ get el() { return index.getElement(this); }
234
+ static get watchers() { return {
235
+ "clientStyling": ["handleClientStylingChange"],
236
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
237
+ "mbSource": ["handleMbSourceChange"]
238
+ }; }
239
+ };
240
+ LotteryHakunaCollapse.style = LotteryHakunaCollapseStyle0;
241
+
242
+ // This icon file is generated automatically.
243
+ 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" };
244
+ const DeleteFilled$1 = DeleteFilled;
245
+
246
+ var __assign = (undefined && undefined.__assign) || function () {
247
+ __assign = Object.assign || function(t) {
248
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
249
+ s = arguments[i];
250
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
251
+ t[p] = s[p];
252
+ }
253
+ return t;
254
+ };
255
+ return __assign.apply(this, arguments);
256
+ };
257
+ var defaultColors = {
258
+ primaryColor: '#333',
259
+ secondaryColor: '#E6E6E6'
260
+ };
261
+ function renderIconDefinitionToSVGElement(icond, options) {
262
+ if (options === void 0) { options = {}; }
263
+ if (typeof icond.icon === 'function') {
264
+ // two-tone
265
+ var placeholders = options.placeholders || defaultColors;
266
+ return renderAbstractNodeToSVGElement(icond.icon(placeholders.primaryColor, placeholders.secondaryColor), options);
267
+ }
268
+ // fill, outline
269
+ return renderAbstractNodeToSVGElement(icond.icon, options);
270
+ }
271
+ function renderAbstractNodeToSVGElement(node, options) {
272
+ var targetAttrs = node.tag === 'svg'
273
+ ? __assign(__assign({}, node.attrs), (options.extraSVGAttrs || {})) : node.attrs;
274
+ var attrs = Object.keys(targetAttrs).reduce(function (acc, nextKey) {
275
+ var key = nextKey;
276
+ var value = targetAttrs[key];
277
+ var token = "".concat(key, "=\"").concat(value, "\"");
278
+ acc.push(token);
279
+ return acc;
280
+ }, []);
281
+ var attrsToken = attrs.length ? ' ' + attrs.join(' ') : '';
282
+ var children = (node.children || [])
283
+ .map(function (child) { return renderAbstractNodeToSVGElement(child, options); })
284
+ .join('');
285
+ if (children && children.length) {
286
+ return "<".concat(node.tag).concat(attrsToken, ">").concat(children, "</").concat(node.tag, ">");
287
+ }
288
+ return "<".concat(node.tag).concat(attrsToken, " />");
289
+ }
290
+
291
+ // Basic sanitization method for SVG content
292
+ // This is NOT a complete XSS prevention for SVG, but prevents common attacks.
293
+ function sanitizeSvg(svgString) {
294
+ let sanitized = svgString.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, ''); // Remove <script> tags
295
+ sanitized = sanitized.replace(/on[a-z]+=[\"'][^\"']*[\"']/gi, ''); // Remove on* attributes
296
+ sanitized = sanitized.replace(/javascript:/gi, ''); // Remove javascript: URLs
297
+ return sanitized;
298
+ }
299
+
300
+ 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}";
301
+ const LotterySelectionStyle0 = lotterySelectionCss;
302
+
303
+ const LotterySelection = class {
304
+ constructor(hostRef) {
305
+ index.registerInstance(this, hostRef);
306
+ this.lotteryBulletClickHandler = index.createEvent(this, "lotteryBulletClick", 7);
307
+ this.value = 0;
308
+ this.text = undefined;
309
+ this.idx = undefined;
310
+ this.type = 'toggle';
311
+ this.mbSource = undefined;
312
+ this.clientStyling = undefined;
313
+ this.clientStylingUrl = undefined;
314
+ this.hasBorder = true;
315
+ this.hasBackground = true;
316
+ this.deleteIconSvg = '';
317
+ this.deleteIconWidth = '16px';
318
+ this.deleteIconHeight = '16px';
319
+ }
320
+ handleClientStylingChange(newValue, oldValue) {
321
+ if (newValue !== oldValue) {
322
+ lotteryHakunaTicket.setClientStyling(this.stylingContainer, this.clientStyling);
323
+ }
324
+ }
325
+ handleClientStylingUrlChange(newValue, oldValue) {
326
+ if (newValue !== oldValue) {
327
+ lotteryHakunaTicket.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
328
+ }
329
+ }
330
+ handleMbSourceChange(newValue, oldValue) {
331
+ if (newValue !== oldValue) {
332
+ lotteryHakunaTicket.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
333
+ }
334
+ }
335
+ componentDidLoad() {
336
+ if (this.stylingContainer) {
337
+ if (this.mbSource)
338
+ lotteryHakunaTicket.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
339
+ if (this.clientStyling)
340
+ lotteryHakunaTicket.setClientStyling(this.stylingContainer, this.clientStyling);
341
+ if (this.clientStylingUrl)
342
+ lotteryHakunaTicket.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
343
+ }
344
+ }
345
+ disconnectedCallback() {
346
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
347
+ }
348
+ handleClick() {
349
+ if (this.type === 'disabled' || this.type === 'readonly') {
350
+ return;
351
+ }
352
+ console.log('bullet clicked', this.type, this.idx, this.text, this.value);
353
+ this.lotteryBulletClickHandler.emit({
354
+ type: this.type,
355
+ idx: this.idx,
356
+ text: this.text,
357
+ value: this.value
358
+ });
359
+ }
360
+ render() {
361
+ let iconToRender;
362
+ if (this.deleteIconSvg) {
363
+ iconToRender = sanitizeSvg(this.deleteIconSvg);
364
+ }
365
+ else {
366
+ iconToRender = renderIconDefinitionToSVGElement(DeleteFilled$1, {
367
+ extraSVGAttrs: {
368
+ width: this.deleteIconWidth,
369
+ height: this.deleteIconHeight,
370
+ fill: 'currentColor'
371
+ }
372
+ });
373
+ }
374
+ return (index.h("div", { key: '0d1e8aaa80a907a7467410f6b27b4b6175e82299', class: "lottery-selection", ref: (el) => (this.stylingContainer = el) }, index.h("button", { key: '11a2402abbc290dc877ad95f3433092c3a0d8419', class: {
375
+ 'lottery-selection__button': true,
376
+ 'lottery-selection__button--selected': this.value == 1,
377
+ 'lottery-selection__button--disabled': this.type === 'disabled',
378
+ 'lottery-selection__button--no-border': !this.hasBorder,
379
+ 'lottery-selection__button--no-background': !this.hasBackground,
380
+ isDeleteByIcon: this.type === 'delete',
381
+ isCallDialogBtn: this.type === 'input' || this.type === 'readonly'
382
+ }, 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))));
383
+ }
384
+ static get watchers() { return {
385
+ "clientStyling": ["handleClientStylingChange"],
386
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
387
+ "mbSource": ["handleMbSourceChange"]
388
+ }; }
389
+ };
390
+ LotterySelection.style = LotterySelectionStyle0;
391
+
392
+ const DEFAULT_LANGUAGE$1 = 'en';
393
+ const SUPPORTED_LANGUAGES$1 = ['ro', 'en', 'fr', 'ar', 'hr', 'zh'];
394
+ const TRANSLATIONS$1 = {
395
+ en: {
396
+ noTicketBoard: 'No ticket board available.',
397
+ selectionCleared: 'Your selection has been cleared.',
398
+ clearAll: 'Clear All',
399
+ stopAt: 'Stop at',
400
+ turnover: 'Turnover: ',
401
+ pleaseFillIn: 'Please fill in all the selection input!',
402
+ fillIn: 'Fill in',
403
+ noBets: 'Sorry. No bets have been placed so far. Check back later!',
404
+ search: 'Search',
405
+ clear: 'Clear',
406
+ oddsChart: 'Odds Chart',
407
+ ticketSuccess: 'Ticket purchased successfully.',
408
+ stakePerLine: 'Stake per Line:',
409
+ lowestOdds: 'Lowest Odds:',
410
+ highestOdds: 'Highest Odds:',
411
+ orderSummary: 'ORDER SUMMARY',
412
+ ticket: 'Ticket',
413
+ lines: 'Lines',
414
+ total: 'Total',
415
+ submit: 'Submit',
416
+ loading: 'Loading',
417
+ enterValidNumber: 'Please enter a valid number.',
418
+ enterNumberBetween: 'Please enter a number between {min} and {max}.',
419
+ numberAlreadySelected: 'This number has already been selected.',
420
+ enterScoreUpTo: 'Please enter the score (Up to {maxScore})',
421
+ enterValue: 'Please enter a value',
422
+ myChoices: 'My Choices',
423
+ teams: 'Teams',
424
+ scores: 'Scores',
425
+ euro: 'Euro',
426
+ cancel: 'Cancel',
427
+ confirm: 'Confirm'
428
+ },
429
+ ro: {},
430
+ fr: {},
431
+ ar: {},
432
+ hr: {}
433
+ };
434
+ const translate$1 = (key, customLang, replacements) => {
435
+ const lang = customLang;
436
+ let translation = TRANSLATIONS$1[lang !== undefined && SUPPORTED_LANGUAGES$1.includes(lang) ? lang : DEFAULT_LANGUAGE$1][key];
437
+ if (replacements) {
438
+ Object.keys(replacements).forEach((placeholder) => {
439
+ translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
440
+ });
441
+ }
442
+ return translation;
443
+ };
444
+ const getTranslations$1 = (data) => {
445
+ Object.keys(data).forEach((item) => {
446
+ for (let key in data[item]) {
447
+ TRANSLATIONS$1[item][key] = data[item][key];
448
+ }
449
+ });
450
+ };
451
+
452
+ function getBulletTextsSet(bulletTexts, splitToken) {
453
+ return new Set(bulletTexts ? bulletTexts.split(splitToken) : []);
454
+ }
455
+ function validateInput({ value, selectedSet, maxValue, minValue, language, type = 'integer' }) {
456
+ const trimmedValue = value.trim();
457
+ if (type === 'integer') {
458
+ // Strict integer check
459
+ if (!/^-?\d+$/.test(trimmedValue)) {
460
+ return {
461
+ valid: false,
462
+ errorMessage: translate$1('enterValidNumber', language),
463
+ value
464
+ };
465
+ }
466
+ const numValue = Number(trimmedValue);
467
+ if (isNaN(numValue)) {
468
+ return {
469
+ valid: false,
470
+ errorMessage: translate$1('enterValidNumber', language),
471
+ value
472
+ };
473
+ }
474
+ if ((minValue !== undefined && numValue < minValue) || (maxValue !== undefined && numValue > maxValue)) {
475
+ return {
476
+ valid: false,
477
+ errorMessage: translate$1('enterNumberBetween', language, {
478
+ min: minValue,
479
+ max: maxValue
480
+ }),
481
+ value
482
+ };
483
+ }
484
+ // Normalize value (e.g. "05" -> "5") for set check
485
+ const normalizedValue = String(numValue);
486
+ if (selectedSet.has(normalizedValue)) {
487
+ return {
488
+ valid: false,
489
+ errorMessage: translate$1('numberAlreadySelected', language),
490
+ value
491
+ };
492
+ }
493
+ }
494
+ else {
495
+ // Text mode validation
496
+ if (selectedSet.has(trimmedValue)) {
497
+ return {
498
+ valid: false,
499
+ errorMessage: translate$1('numberAlreadySelected', language), // Or generic 'alreadySelected' if available, but reusing key for now
500
+ value
501
+ };
502
+ }
503
+ }
504
+ return {
505
+ valid: true,
506
+ errorMessage: '',
507
+ value
508
+ };
509
+ }
510
+ function removeBulletTexts(text, selectedArr) {
511
+ return selectedArr.filter((s) => s !== text);
512
+ }
513
+ function addSelectedBulletTexts(text, selectedArr) {
514
+ return selectedArr.concat([text]);
515
+ }
516
+ function removeAndAddSelectedBulletTexts(text, selectedArr, maxSelectedCount) {
517
+ return selectedArr.slice(selectedArr.length - (maxSelectedCount - 1)).concat([text]);
518
+ }
519
+ function buildSelectedBulletTextsArr(item, selectedArr, maxSelectedCount) {
520
+ if (item.type === 'delete') {
521
+ return removeBulletTexts(item.text, selectedArr);
522
+ }
523
+ if (item.type === 'toggle') {
524
+ if (selectedArr.includes(item.text)) {
525
+ return removeBulletTexts(item.text, selectedArr);
526
+ }
527
+ if (selectedArr.length >= maxSelectedCount) {
528
+ return removeAndAddSelectedBulletTexts(item.text, selectedArr, maxSelectedCount);
529
+ }
530
+ return addSelectedBulletTexts(item.text, selectedArr);
531
+ }
532
+ return [];
533
+ }
534
+
535
+ 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}";
536
+ const LotterySelectionGroupStyle0 = lotterySelectionGroupCss;
537
+
538
+ const LotterySelectionGroup = class {
539
+ constructor(hostRef) {
540
+ index.registerInstance(this, hostRef);
541
+ this.bulletGroupUpdateSelectedBulletTexts = index.createEvent(this, "bulletGroupUpdateSelection", 7);
542
+ this.mbSource = undefined;
543
+ this.clientStyling = undefined;
544
+ this.clientStylingUrl = undefined;
545
+ this.language = 'en';
546
+ this.translationUrl = '';
547
+ this.splitToken = ',';
548
+ this.selectionGroupId = undefined;
549
+ this.selectionGroupLabel = undefined;
550
+ this.type = 'bet';
551
+ this.selectedBulletTexts = null;
552
+ this.maxSelectedCount = null;
553
+ this.maxDisplayBulletsCount = 11;
554
+ this.bulletTexts = null;
555
+ this.maxIntegerBulletText = null;
556
+ this.minIntegerBulletText = 0;
557
+ this.bulletTextType = 'integer';
558
+ this.hasBorder = true;
559
+ this.hasBackground = true;
560
+ this.dialogTitle = undefined;
561
+ this.dialogInputPlaceholder = undefined;
562
+ this.dialogConfig = {
563
+ width: '400px',
564
+ visible: false,
565
+ onConfirm: () => this.handleFillInAddMore(),
566
+ onCancel: () => this.handleCloseAddMoreDialog()
567
+ };
568
+ this.inputInfo = { valid: true, errorMessage: '', value: '' };
569
+ }
570
+ handleClientStylingChange(newValue, oldValue) {
571
+ if (newValue != oldValue) {
572
+ lotteryHakunaTicket.setClientStyling(this.stylingContainer, this.clientStyling);
573
+ }
574
+ }
575
+ handleClientStylingUrlChange(newValue, oldValue) {
576
+ if (newValue != oldValue) {
577
+ lotteryHakunaTicket.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
578
+ }
579
+ }
580
+ handleMbSourceChange(newValue, oldValue) {
581
+ if (newValue != oldValue) {
582
+ lotteryHakunaTicket.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
583
+ }
584
+ }
585
+ componentWillLoad() {
586
+ if (this.translationUrl) {
587
+ getTranslations$1(JSON.parse(this.translationUrl));
588
+ }
589
+ }
590
+ componentDidLoad() {
591
+ if (this.stylingContainer) {
592
+ if (this.mbSource)
593
+ lotteryHakunaTicket.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
594
+ if (this.clientStyling)
595
+ lotteryHakunaTicket.setClientStyling(this.stylingContainer, this.clientStyling);
596
+ if (this.clientStylingUrl)
597
+ lotteryHakunaTicket.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
598
+ }
599
+ }
600
+ disconnectedCallback() {
601
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
602
+ }
603
+ lotteryBulletClickHandler(event) {
604
+ event.stopPropagation();
605
+ // if it's input type, open the dialog
606
+ if (event.detail.type === 'input') {
607
+ this.dialogConfig = Object.assign(Object.assign({}, this.dialogConfig), { visible: true });
608
+ return;
609
+ }
610
+ if (['delete', 'toggle'].includes(event.detail.type)) {
611
+ this.bulletGroupUpdateSelectedBulletTexts.emit({
612
+ newSelectedBulletTexts: buildSelectedBulletTextsArr(event.detail, Array.from(this.selectedSet), this.maxSelectedCount).join(this.splitToken),
613
+ selectionGroupId: this.selectionGroupId
614
+ });
615
+ return;
616
+ }
617
+ }
618
+ get selectedSet() {
619
+ return getBulletTextsSet(this.selectedBulletTexts, this.splitToken);
620
+ }
621
+ get bulletTextsSet() {
622
+ if (this.bulletTexts)
623
+ return getBulletTextsSet(this.bulletTexts, this.splitToken);
624
+ if (this.bulletTextType === 'integer' &&
625
+ this.maxIntegerBulletText !== null &&
626
+ this.maxIntegerBulletText !== undefined) {
627
+ return getBulletTextsSet(Array.from({ length: Number(this.lastDisplayBulletText) - this.minIntegerBulletText + 1 }, (_, index) => this.minIntegerBulletText + index).join(this.splitToken), this.splitToken);
628
+ }
629
+ // If neither bulletTexts nor maxIntegerBulletText are provided,
630
+ return new Set();
631
+ }
632
+ // the last bullet text
633
+ get lastDisplayBulletText() {
634
+ if (this.bulletTextType === 'integer') {
635
+ if (this.maxIntegerBulletText !== null && this.maxIntegerBulletText !== undefined) {
636
+ return Math.min(this.maxIntegerBulletText, this.minIntegerBulletText + this.maxDisplayBulletsCount - 1);
637
+ }
638
+ return this.minIntegerBulletText + this.maxDisplayBulletsCount - 1;
639
+ }
640
+ // Text mode: return the text at the max display index if available
641
+ if (this.bulletTextsSet.size > 0) {
642
+ const texts = Array.from(this.bulletTextsSet);
643
+ if (texts.length >= this.maxDisplayBulletsCount) {
644
+ return texts[this.maxDisplayBulletsCount - 1];
645
+ }
646
+ return texts[texts.length - 1]; // If fewer than maxDisplayBulletsCount, return the last one
647
+ }
648
+ return null;
649
+ }
650
+ get isSingleSelectionMode() {
651
+ return this.maxSelectedCount === 1;
652
+ }
653
+ getBulletToRender() {
654
+ const allBulletTexts = Array.from(this.bulletTextsSet);
655
+ // Determine which bullets to display based on type and limit
656
+ let bulletsToRender = allBulletTexts;
657
+ let showInputButton = false;
658
+ if (this.bulletTextType === 'text') {
659
+ // For text, if we have more items than the limit, we need an input button.
660
+ // The input button takes one slot, so we show (limit - 1) items.
661
+ if (allBulletTexts.length > this.maxDisplayBulletsCount) {
662
+ showInputButton = true;
663
+ bulletsToRender = allBulletTexts.slice(0, this.maxDisplayBulletsCount - 1);
664
+ }
665
+ else {
666
+ bulletsToRender = allBulletTexts;
667
+ }
668
+ }
669
+ else {
670
+ // For integer, logic is based on maxIntegerBulletText vs displayed range
671
+ showInputButton =
672
+ this.maxIntegerBulletText !== null &&
673
+ this.maxIntegerBulletText !== undefined &&
674
+ this.maxIntegerBulletText > Number(this.lastDisplayBulletText);
675
+ // Integer bullets generation already respects the count, no slicing needed on the raw set
676
+ bulletsToRender = allBulletTexts;
677
+ }
678
+ return {
679
+ bulletsToRender,
680
+ showInputButton
681
+ };
682
+ }
683
+ renderBulletGroup() {
684
+ let items = [];
685
+ if (this.type === 'bet') {
686
+ const isMaxSelected = this.maxSelectedCount !== null && this.selectedSet.size >= this.maxSelectedCount;
687
+ const { bulletsToRender, showInputButton } = this.getBulletToRender();
688
+ bulletsToRender.forEach((text, idx) => {
689
+ let bulletType = 'toggle';
690
+ if (!this.selectedSet.has(String(text)) && isMaxSelected && !this.isSingleSelectionMode) {
691
+ bulletType = 'disabled';
692
+ }
693
+ items.push({
694
+ value: this.selectedSet.has(String(text)) ? 1 : 0,
695
+ text: String(text),
696
+ idx,
697
+ type: bulletType
698
+ });
699
+ });
700
+ if (showInputButton) {
701
+ let inputBulletType = 'input';
702
+ if (isMaxSelected && !this.isSingleSelectionMode) {
703
+ inputBulletType = 'disabled';
704
+ }
705
+ const inputButtonText = this.bulletTextType === 'text' ? '...' : `${this.lastDisplayBulletText}+`;
706
+ const inputButtonIdx = this.bulletTextType === 'text' ? -1 : Number(this.lastDisplayBulletText) + 1;
707
+ // Special handling for integer mode:
708
+ // If the generated set is "full" (size == maxDisplayBulletsCount),
709
+ // we need to remove the last item to make room for the "N+" button
710
+ // so the total visual count remains consistent.
711
+ if (this.bulletTextType === 'integer' && items.length >= this.maxDisplayBulletsCount) {
712
+ items.pop();
713
+ }
714
+ items.push({
715
+ value: 0,
716
+ text: inputButtonText,
717
+ idx: inputButtonIdx,
718
+ type: inputBulletType
719
+ });
720
+ }
721
+ }
722
+ else if (['choice', 'preview'].includes(this.type)) {
723
+ // For choice/preview, also respect the visual limit for text mode
724
+ const { bulletsToRender } = this.getBulletToRender();
725
+ bulletsToRender.forEach((text, idx) => {
726
+ let bulletType = 'toggle';
727
+ if (this.type === 'preview') {
728
+ bulletType = 'readonly';
729
+ }
730
+ else if (this.selectedSet.has(String(text))) {
731
+ bulletType = 'delete';
732
+ }
733
+ items.push({
734
+ value: this.selectedSet.has(String(text)) ? 1 : 0,
735
+ text,
736
+ idx,
737
+ type: bulletType
738
+ });
739
+ });
740
+ }
741
+ return (index.h("div", { class: "lottery-selection-group__item--right" }, items.map((item) => {
742
+ 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 }));
743
+ })));
744
+ }
745
+ handleCloseAddMoreDialog() {
746
+ this.dialogConfig = Object.assign(Object.assign({}, this.dialogConfig), { visible: false });
747
+ this.inputInfo = { value: '', errorMessage: '', valid: true };
748
+ }
749
+ handleInputChange(e) {
750
+ const inputElement = e.target;
751
+ const value = inputElement.value;
752
+ this.inputInfo = Object.assign(Object.assign({}, this.inputInfo), { value: value });
753
+ this.inputInfo = validateInput({
754
+ value,
755
+ selectedSet: this.selectedSet,
756
+ maxValue: this.maxIntegerBulletText,
757
+ minValue: this.bulletTextType === 'integer' ? Number(this.lastDisplayBulletText) + 1 : undefined,
758
+ language: this.language,
759
+ type: this.bulletTextType
760
+ });
761
+ }
762
+ handleFillInAddMore() {
763
+ if (this.inputInfo.valid) {
764
+ const { value } = this.inputInfo;
765
+ // Normalize the value (e.g., "05" -> "5") to match validation logic
766
+ let normalizedValue = value;
767
+ if (this.bulletTextType === 'integer') {
768
+ normalizedValue = String(Number(value));
769
+ }
770
+ else {
771
+ normalizedValue = value.trim();
772
+ }
773
+ let newSelectedBulletTexts;
774
+ if (this.isSingleSelectionMode) {
775
+ newSelectedBulletTexts = normalizedValue;
776
+ }
777
+ else {
778
+ newSelectedBulletTexts = addSelectedBulletTexts(normalizedValue, Array.from(this.selectedSet)).join(this.splitToken);
779
+ }
780
+ this.bulletGroupUpdateSelectedBulletTexts.emit({
781
+ newSelectedBulletTexts,
782
+ selectionGroupId: this.selectionGroupId
783
+ });
784
+ this.handleCloseAddMoreDialog();
785
+ }
786
+ }
787
+ render() {
788
+ return (index.h("div", { key: '66b8e9c63d948eb2f7eb37adb80892dbedd7df9a', class: "lottery-selection-group", ref: (el) => (this.stylingContainer = el) }, index.h("div", { key: '6562fdcad0f352b5e2d03edcc980a9aeab32277e', class: "lottery-selection-group__item" }, this.selectionGroupLabel && (index.h("div", { key: '43c2132e4904a2b69b970d9b2074f120ed4d0986', class: "lottery-selection-group__item--left" }, this.selectionGroupLabel)), this.renderBulletGroup()), index.h("lottery-tipping-dialog", { key: 'cb693d10e6b499628909571021d8508cdebbe29a', visible: this.dialogConfig.visible, width: this.dialogConfig.width, onCancel: this.dialogConfig.onCancel }, index.h("div", { key: 'dd312634574bbe1b4d3de7e82a9c58f58f846c1a', class: "addSelectionDialog" }, index.h("div", { key: 'b371b1090598f0219a7c652bab51e9d349703c34', class: "addSelectionDialog-title" }, this.dialogTitle || (this.bulletTextType === 'text'
789
+ ? translate$1('enterValue', this.language)
790
+ : translate$1('enterScoreUpTo', this.language, {
791
+ maxScore: this.maxIntegerBulletText
792
+ }))), index.h("input", { key: 'b5f1bb74999246dac8dc20f04e3af893deae6654', type: "text", class: {
793
+ 'dialog-input': true,
794
+ invalid: !this.inputInfo.valid
795
+ }, value: this.inputInfo.value, onInput: this.handleInputChange.bind(this), placeholder: this.dialogInputPlaceholder }), index.h("div", { key: 'f33970a6dffdc881ffa9cf2c0bb54b26b27cccd6', class: "error-message" }, this.inputInfo.errorMessage)), index.h("div", { key: '4c580dae14b38aff03e17067b2c0b72d01aa4f42', slot: "footer", class: "addSelectionDialog-footer" }, index.h("lottery-button", { key: '874aa0ffde8fe2d0b08efea0cf951f101ab8dad0', onClick: this.dialogConfig.onCancel, text: translate$1('cancel', this.language), variant: "outline" }), index.h("lottery-button", { key: '63a556eb5f9ad1cdd357c017756be274d40ef235', onClick: this.dialogConfig.onConfirm, text: translate$1('confirm', this.language), variant: "primary", disabled: !this.inputInfo.valid || !this.inputInfo.value })))));
796
+ }
797
+ static get watchers() { return {
798
+ "clientStyling": ["handleClientStylingChange"],
799
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
800
+ "mbSource": ["handleMbSourceChange"]
801
+ }; }
802
+ };
803
+ LotterySelectionGroup.style = LotterySelectionGroupStyle0;
804
+
805
+ const DEFAULT_LANGUAGE = 'en';
806
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
807
+ const TRANSLATIONS = {
808
+ en: {
809
+ cancel: 'Cancel',
810
+ confirm: 'Confirm'
811
+ },
812
+ ro: {
813
+ cancel: 'Anulează',
814
+ confirm: 'Confirmă'
815
+ },
816
+ fr: {
817
+ cancel: 'Annuler',
818
+ confirm: 'Confirmer'
819
+ },
820
+ ar: {
821
+ cancel: 'إلغاء',
822
+ confirm: 'تأكيد'
823
+ },
824
+ hr: {
825
+ cancel: 'Odustani',
826
+ confirm: 'Potvrdi'
827
+ }
828
+ };
829
+ const translate = (key, customLang) => {
830
+ const lang = customLang;
831
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
832
+ };
833
+ const getTranslations = (data) => {
834
+ Object.keys(data).forEach((item) => {
835
+ for (let key in data[item]) {
836
+ TRANSLATIONS[item][key] = data[item][key];
837
+ }
838
+ });
839
+ };
840
+ const resolveTranslationUrl = async (translationUrl) => {
841
+ if (translationUrl) {
842
+ try {
843
+ const response = await fetch(translationUrl);
844
+ if (!response.ok) {
845
+ throw new Error(`HTTP error! status: ${response.status}`);
846
+ }
847
+ const translations = await response.json();
848
+ getTranslations(translations);
849
+ }
850
+ catch (error) {
851
+ console.error('Failed to fetch or parse translations from URL:', error);
852
+ }
853
+ }
854
+ };
855
+
856
+ 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-color: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 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;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)}}";
857
+ const LotteryTippingDialogStyle0 = lotteryTippingDialogCss;
858
+
859
+ const LotteryTippingDialog = class {
860
+ constructor(hostRef) {
861
+ index.registerInstance(this, hostRef);
862
+ this.open = index.createEvent(this, "open", 7);
863
+ this.close = index.createEvent(this, "close", 7);
864
+ this.confirm = index.createEvent(this, "confirm", 7);
865
+ this.cancel = index.createEvent(this, "cancel", 7);
866
+ this.wasVisible = false;
867
+ this.mbSource = undefined;
868
+ this.clientStyling = '';
869
+ this.clientStylingUrl = '';
870
+ this.visible = undefined;
871
+ this.dialogTitle = '';
872
+ this.width = '520px';
873
+ this.closable = true;
874
+ this.mask = true;
875
+ this.maskClosable = true;
876
+ this.animationDuration = 300;
877
+ this.fullscreen = false;
878
+ this.showFooter = true;
879
+ this.showCancelBtn = true;
880
+ this.language = 'en';
881
+ this.translationUrl = undefined;
882
+ this.dialogClass = undefined;
883
+ this.dialogStyle = undefined;
884
+ }
885
+ handleClientStylingChange(newValue, oldValue) {
886
+ if (newValue != oldValue) {
887
+ lotteryHakunaTicket.setClientStyling(this.stylingContainer, this.clientStyling);
888
+ }
889
+ }
890
+ handleClientStylingUrlChange(newValue, oldValue) {
891
+ if (newValue != oldValue) {
892
+ lotteryHakunaTicket.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
893
+ }
894
+ }
895
+ handleMbSourceChange(newValue, oldValue) {
896
+ if (newValue != oldValue) {
897
+ lotteryHakunaTicket.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
898
+ }
899
+ }
900
+ componentWillLoad() {
901
+ if (this.translationUrl) {
902
+ resolveTranslationUrl(this.translationUrl);
903
+ }
904
+ }
905
+ componentWillUpdate() {
906
+ if (this.visible && !this.wasVisible) {
907
+ this.disableBodyScroll();
908
+ }
909
+ else if (!this.visible && this.wasVisible) {
910
+ this.enableBodyScroll();
911
+ }
912
+ this.wasVisible = this.visible;
913
+ }
914
+ disconnectedCallback() {
915
+ this.enableBodyScroll();
916
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
917
+ }
918
+ disableBodyScroll() {
919
+ document.body.style.overflow = 'hidden';
920
+ }
921
+ enableBodyScroll() {
922
+ document.body.style.overflow = '';
923
+ }
924
+ handleClose() {
925
+ this.cancel.emit();
926
+ }
927
+ handleMaskClick() {
928
+ if (this.maskClosable) {
929
+ this.cancel.emit();
930
+ }
931
+ }
932
+ handleConfirm() {
933
+ this.confirm.emit();
934
+ }
935
+ render() {
936
+ const computedDialogStyle = Object.assign({ width: typeof this.width === 'number' ? `${this.width}px` : this.width, '--duration': `${this.animationDuration}ms` }, (this.dialogStyle || {}));
937
+ const dialogWrapperClass = ['dialog-wrapper', this.visible ? 'dialog-wrapper-visible' : ''];
938
+ const maskClass = ['mask', this.visible ? 'mask-enter' : 'mask-leave'];
939
+ const computedDialogClass = [
940
+ 'dialog',
941
+ this.visible ? 'dialog-enter' : 'dialog-leave',
942
+ this.fullscreen ? 'fullscreen' : '',
943
+ this.dialogClass
944
+ ]
945
+ .filter(Boolean)
946
+ .join(' ');
947
+ const contentStyle = {
948
+ maxHeight: 'calc(100vh - 62px)',
949
+ overflowY: 'auto'
950
+ };
951
+ return (index.h("div", { key: '306683c5190fa6dca57dcf75e52eca575c0215e7', class: dialogWrapperClass.join(' '), ref: (el) => (this.stylingContainer = el) }, index.h("div", { key: '8be097f3a86fcd9ad4e18c6ac56cafdcf249049b', class: maskClass.join(' '), onClick: this.handleMaskClick.bind(this) }), index.h("div", { key: '87d2206d3e3d75fe0e0ef8a6afd8de5c20892ae6', part: "dialog", class: computedDialogClass, style: computedDialogStyle, role: "dialog", "aria-modal": "true", "aria-labelledby": "dialog-title" }, index.h("div", { key: '30ca33b925ff2525ead8aae83e72031258367b40', class: "dialog-header" }, index.h("h2", { key: '492c3e864ac1547da58b0a47e4cc8d45470bde54', id: "dialog-title", class: "dialog-title" }, this.dialogTitle), this.closable && (index.h("button", { key: '8ae4b872d18ce82d33292dc794e8a1f714a96ba9', class: "close-btn", onClick: this.handleClose.bind(this) }, "x"))), index.h("div", { key: 'd661c78b333f78b9dee92e0975f8b136ef5a3071', class: "dialog-content", style: contentStyle }, index.h("slot", { key: 'f32a6f6e4962239e0148e61c4bb70f6b5d3a2c82' })), this.showFooter && (index.h("div", { key: '40b5e9fd1c9221eb4d6c87d053c5d018f540d8e7', class: "dialog-footer" }, index.h("slot", { key: '91539def47d118a69735ec229e7a6b36fc1db40b', name: "footer" }, this.showCancelBtn && (index.h("button", { key: 'f3b3add23f150c660159a906c2ef23b5fbe3b4c5', class: "cancel-btn", onClick: this.handleClose.bind(this) }, translate('cancel', this.language))), index.h("button", { key: '5fc33e89b6c55ac9e2162302e128bce0e79c5f89', class: "confirm-btn", onClick: this.handleConfirm.bind(this) }, translate('confirm', this.language))))))));
952
+ }
953
+ get el() { return index.getElement(this); }
954
+ static get watchers() { return {
955
+ "clientStyling": ["handleClientStylingChange"],
956
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
957
+ "mbSource": ["handleMbSourceChange"]
958
+ }; }
959
+ };
960
+ LotteryTippingDialog.style = LotteryTippingDialogStyle0;
961
+
962
+ exports.lottery_hakuna_ticket = lotteryHakunaTicket.LotteryHakunaTicket;
963
+ exports.lottery_button = LotteryButton;
964
+ exports.lottery_hakuna_collapse = LotteryHakunaCollapse;
965
+ exports.lottery_selection = LotterySelection;
966
+ exports.lottery_selection_group = LotterySelectionGroup;
967
+ exports.lottery_tipping_dialog = LotteryTippingDialog;