@everymatrix/lottery-selection-group 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-bc355d7d.js +1310 -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_4.cjs.entry.js +486 -0
  6. package/dist/cjs/lottery-selection-group-1608b2e2.js +480 -0
  7. package/dist/cjs/lottery-selection-group.cjs.js +25 -0
  8. package/dist/collection/collection-manifest.json +31 -0
  9. package/dist/collection/components/lottery-selection-group/index.js +1 -0
  10. package/dist/collection/components/lottery-selection-group/lottery-selection-group.css +84 -0
  11. package/dist/collection/components/lottery-selection-group/lottery-selection-group.js +685 -0
  12. package/dist/collection/index.js +1 -0
  13. package/dist/collection/model/type.js +1 -0
  14. package/dist/collection/utils/locale.utils.js +74 -0
  15. package/dist/collection/utils/utils.js +86 -0
  16. package/dist/esm/app-globals-0f993ce5.js +3 -0
  17. package/dist/esm/index-3a4d6110.js +1282 -0
  18. package/dist/esm/index.js +2 -0
  19. package/dist/esm/loader.js +11 -0
  20. package/dist/esm/lottery-button_4.entry.js +480 -0
  21. package/dist/esm/lottery-selection-group-656d6729.js +475 -0
  22. package/dist/esm/lottery-selection-group.js +20 -0
  23. package/dist/index.cjs.js +1 -0
  24. package/dist/index.js +1 -0
  25. package/dist/lottery-selection-group/app-globals-0f993ce5.js +1 -0
  26. package/dist/lottery-selection-group/index-3a4d6110.js +2 -0
  27. package/dist/lottery-selection-group/index.esm.js +1 -0
  28. package/dist/lottery-selection-group/lottery-button_4.entry.js +1 -0
  29. package/dist/lottery-selection-group/lottery-selection-group-656d6729.js +1 -0
  30. package/dist/lottery-selection-group/lottery-selection-group.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-selection-group/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
  36. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-selection-group/.stencil/packages/stencil/lottery-selection-group/stencil.config.d.ts +2 -0
  37. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-selection-group/.stencil/packages/stencil/lottery-selection-group/stencil.config.dev.d.ts +2 -0
  38. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-selection-group/.stencil/packages/stencil/lottery-selection-group/storybook/main.d.ts +3 -0
  39. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-selection-group/.stencil/packages/stencil/lottery-selection-group/storybook/preview.d.ts +70 -0
  40. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-selection-group/.stencil/tools/plugins/index.d.ts +4 -0
  41. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-selection-group/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
  42. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-selection-group/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
  43. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-selection-group/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
  44. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-selection-group/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
  45. package/dist/types/components/lottery-selection-group/index.d.ts +1 -0
  46. package/dist/types/components/lottery-selection-group/lottery-selection-group.d.ts +122 -0
  47. package/dist/types/components.d.ts +218 -0
  48. package/dist/types/index.d.ts +1 -0
  49. package/dist/types/model/type.d.ts +12 -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 +14 -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,475 @@
1
+ import { r as registerInstance, c as createEvent, h } from './index-3a4d6110.js';
2
+
3
+ /**
4
+ * @name setClientStyling
5
+ * @description Method used to create and append to the passed element of the widget a style element with the content received
6
+ * @param {HTMLElement} stylingContainer The reference element of the widget
7
+ * @param {string} clientStyling The style content
8
+ */
9
+ function setClientStyling(stylingContainer, clientStyling) {
10
+ if (stylingContainer) {
11
+ const sheet = document.createElement('style');
12
+ sheet.innerHTML = clientStyling;
13
+ stylingContainer.appendChild(sheet);
14
+ }
15
+ }
16
+
17
+ /**
18
+ * @name setClientStylingURL
19
+ * @description Method used to create and append to the passed element of the widget a style element with the content fetched from a given URL
20
+ * @param {HTMLElement} stylingContainer The reference element of the widget
21
+ * @param {string} clientStylingUrl The URL of the style content
22
+ */
23
+ function setClientStylingURL(stylingContainer, clientStylingUrl) {
24
+ if (!stylingContainer || !clientStylingUrl) return;
25
+
26
+ const url = new URL(clientStylingUrl);
27
+
28
+ fetch(url.href)
29
+ .then((res) => res.text())
30
+ .then((data) => {
31
+ const cssFile = document.createElement('style');
32
+ cssFile.innerHTML = data;
33
+ if (stylingContainer) {
34
+ stylingContainer.appendChild(cssFile);
35
+ }
36
+ })
37
+ .catch((err) => {
38
+ console.error('There was an error while trying to load client styling from URL', err);
39
+ });
40
+ }
41
+
42
+ /**
43
+ * @name setStreamLibrary
44
+ * @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
45
+ * @param {HTMLElement} stylingContainer The highest element of the widget
46
+ * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
47
+ * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
48
+ */
49
+ function setStreamStyling(stylingContainer, domain, subscription) {
50
+ if (window.emMessageBus) {
51
+ const sheet = document.createElement('style');
52
+
53
+ window.emMessageBus.subscribe(domain, (data) => {
54
+ sheet.innerHTML = data;
55
+ if (stylingContainer) {
56
+ stylingContainer.appendChild(sheet);
57
+ }
58
+ });
59
+ }
60
+ }
61
+
62
+ const DEFAULT_LANGUAGE = 'en';
63
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr', 'zh'];
64
+ const TRANSLATIONS = {
65
+ en: {
66
+ noTicketBoard: 'No ticket board available.',
67
+ selectionCleared: 'Your selection has been cleared.',
68
+ clearAll: 'Clear All',
69
+ stopAt: 'Stop at',
70
+ turnover: 'Turnover: ',
71
+ pleaseFillIn: 'Please fill in all the selection input!',
72
+ fillIn: 'Fill in',
73
+ noBets: 'Sorry. No bets have been placed so far. Check back later!',
74
+ search: 'Search',
75
+ clear: 'Clear',
76
+ oddsChart: 'Odds Chart',
77
+ ticketSuccess: 'Ticket purchased successfully.',
78
+ stakePerLine: 'Stake per Line:',
79
+ lowestOdds: 'Lowest Odds:',
80
+ highestOdds: 'Highest Odds:',
81
+ orderSummary: 'ORDER SUMMARY',
82
+ ticket: 'Ticket',
83
+ lines: 'Lines',
84
+ total: 'Total',
85
+ submit: 'Submit',
86
+ loading: 'Loading',
87
+ enterValidNumber: 'Please enter a valid number.',
88
+ enterNumberBetween: 'Please enter a number between {min} and {max}.',
89
+ numberAlreadySelected: 'This number has already been selected.',
90
+ enterScoreUpTo: 'Please enter the score (Up to {maxScore})',
91
+ enterValue: 'Please enter a value',
92
+ myChoices: 'My Choices',
93
+ teams: 'Teams',
94
+ scores: 'Scores',
95
+ euro: 'Euro',
96
+ cancel: 'Cancel',
97
+ confirm: 'Confirm'
98
+ },
99
+ ro: {},
100
+ fr: {},
101
+ ar: {},
102
+ hr: {}
103
+ };
104
+ const translate = (key, customLang, replacements) => {
105
+ const lang = customLang;
106
+ let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
107
+ if (replacements) {
108
+ Object.keys(replacements).forEach((placeholder) => {
109
+ translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
110
+ });
111
+ }
112
+ return translation;
113
+ };
114
+ const getTranslations = (data) => {
115
+ Object.keys(data).forEach((item) => {
116
+ for (let key in data[item]) {
117
+ TRANSLATIONS[item][key] = data[item][key];
118
+ }
119
+ });
120
+ };
121
+
122
+ function getBulletTextsSet(bulletTexts, splitToken) {
123
+ return new Set(bulletTexts ? bulletTexts.split(splitToken) : []);
124
+ }
125
+ function validateInput({ value, selectedSet, maxValue, minValue, language, type = 'integer' }) {
126
+ const trimmedValue = value.trim();
127
+ if (type === 'integer') {
128
+ // Strict integer check
129
+ if (!/^-?\d+$/.test(trimmedValue)) {
130
+ return {
131
+ valid: false,
132
+ errorMessage: translate('enterValidNumber', language),
133
+ value
134
+ };
135
+ }
136
+ const numValue = Number(trimmedValue);
137
+ if (isNaN(numValue)) {
138
+ return {
139
+ valid: false,
140
+ errorMessage: translate('enterValidNumber', language),
141
+ value
142
+ };
143
+ }
144
+ if ((minValue !== undefined && numValue < minValue) || (maxValue !== undefined && numValue > maxValue)) {
145
+ return {
146
+ valid: false,
147
+ errorMessage: translate('enterNumberBetween', language, {
148
+ min: minValue,
149
+ max: maxValue
150
+ }),
151
+ value
152
+ };
153
+ }
154
+ // Normalize value (e.g. "05" -> "5") for set check
155
+ const normalizedValue = String(numValue);
156
+ if (selectedSet.has(normalizedValue)) {
157
+ return {
158
+ valid: false,
159
+ errorMessage: translate('numberAlreadySelected', language),
160
+ value
161
+ };
162
+ }
163
+ }
164
+ else {
165
+ // Text mode validation
166
+ if (selectedSet.has(trimmedValue)) {
167
+ return {
168
+ valid: false,
169
+ errorMessage: translate('numberAlreadySelected', language), // Or generic 'alreadySelected' if available, but reusing key for now
170
+ value
171
+ };
172
+ }
173
+ }
174
+ return {
175
+ valid: true,
176
+ errorMessage: '',
177
+ value
178
+ };
179
+ }
180
+ function removeBulletTexts(text, selectedArr) {
181
+ return selectedArr.filter((s) => s !== text);
182
+ }
183
+ function addSelectedBulletTexts(text, selectedArr) {
184
+ return selectedArr.concat([text]);
185
+ }
186
+ function removeAndAddSelectedBulletTexts(text, selectedArr, maxSelectedCount) {
187
+ return selectedArr.slice(selectedArr.length - (maxSelectedCount - 1)).concat([text]);
188
+ }
189
+ function buildSelectedBulletTextsArr(item, selectedArr, maxSelectedCount) {
190
+ if (item.type === 'delete') {
191
+ return removeBulletTexts(item.text, selectedArr);
192
+ }
193
+ if (item.type === 'toggle') {
194
+ if (selectedArr.includes(item.text)) {
195
+ return removeBulletTexts(item.text, selectedArr);
196
+ }
197
+ if (selectedArr.length >= maxSelectedCount) {
198
+ return removeAndAddSelectedBulletTexts(item.text, selectedArr, maxSelectedCount);
199
+ }
200
+ return addSelectedBulletTexts(item.text, selectedArr);
201
+ }
202
+ return [];
203
+ }
204
+
205
+ 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}";
206
+ const LotterySelectionGroupStyle0 = lotterySelectionGroupCss;
207
+
208
+ const LotterySelectionGroup = class {
209
+ constructor(hostRef) {
210
+ registerInstance(this, hostRef);
211
+ this.bulletGroupUpdateSelectedBulletTexts = createEvent(this, "bulletGroupUpdateSelection", 7);
212
+ this.mbSource = undefined;
213
+ this.clientStyling = undefined;
214
+ this.clientStylingUrl = undefined;
215
+ this.language = 'en';
216
+ this.translationUrl = '';
217
+ this.splitToken = ',';
218
+ this.selectionGroupId = undefined;
219
+ this.selectionGroupLabel = undefined;
220
+ this.type = 'bet';
221
+ this.selectedBulletTexts = null;
222
+ this.maxSelectedCount = null;
223
+ this.maxDisplayBulletsCount = 11;
224
+ this.bulletTexts = null;
225
+ this.maxIntegerBulletText = null;
226
+ this.minIntegerBulletText = 0;
227
+ this.bulletTextType = 'integer';
228
+ this.hasBorder = true;
229
+ this.hasBackground = true;
230
+ this.dialogTitle = undefined;
231
+ this.dialogInputPlaceholder = undefined;
232
+ this.dialogConfig = {
233
+ width: '400px',
234
+ visible: false,
235
+ onConfirm: () => this.handleFillInAddMore(),
236
+ onCancel: () => this.handleCloseAddMoreDialog()
237
+ };
238
+ this.inputInfo = { valid: true, errorMessage: '', value: '' };
239
+ }
240
+ handleClientStylingChange(newValue, oldValue) {
241
+ if (newValue != oldValue) {
242
+ setClientStyling(this.stylingContainer, this.clientStyling);
243
+ }
244
+ }
245
+ handleClientStylingUrlChange(newValue, oldValue) {
246
+ if (newValue != oldValue) {
247
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
248
+ }
249
+ }
250
+ handleMbSourceChange(newValue, oldValue) {
251
+ if (newValue != oldValue) {
252
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
253
+ }
254
+ }
255
+ componentWillLoad() {
256
+ if (this.translationUrl) {
257
+ getTranslations(JSON.parse(this.translationUrl));
258
+ }
259
+ }
260
+ componentDidLoad() {
261
+ if (this.stylingContainer) {
262
+ if (this.mbSource)
263
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
264
+ if (this.clientStyling)
265
+ setClientStyling(this.stylingContainer, this.clientStyling);
266
+ if (this.clientStylingUrl)
267
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
268
+ }
269
+ }
270
+ disconnectedCallback() {
271
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
272
+ }
273
+ lotteryBulletClickHandler(event) {
274
+ event.stopPropagation();
275
+ // if it's input type, open the dialog
276
+ if (event.detail.type === 'input') {
277
+ this.dialogConfig = Object.assign(Object.assign({}, this.dialogConfig), { visible: true });
278
+ return;
279
+ }
280
+ if (['delete', 'toggle'].includes(event.detail.type)) {
281
+ this.bulletGroupUpdateSelectedBulletTexts.emit({
282
+ newSelectedBulletTexts: buildSelectedBulletTextsArr(event.detail, Array.from(this.selectedSet), this.maxSelectedCount).join(this.splitToken),
283
+ selectionGroupId: this.selectionGroupId
284
+ });
285
+ return;
286
+ }
287
+ }
288
+ get selectedSet() {
289
+ return getBulletTextsSet(this.selectedBulletTexts, this.splitToken);
290
+ }
291
+ get bulletTextsSet() {
292
+ if (this.bulletTexts)
293
+ return getBulletTextsSet(this.bulletTexts, this.splitToken);
294
+ if (this.bulletTextType === 'integer' &&
295
+ this.maxIntegerBulletText !== null &&
296
+ this.maxIntegerBulletText !== undefined) {
297
+ return getBulletTextsSet(Array.from({ length: Number(this.lastDisplayBulletText) - this.minIntegerBulletText + 1 }, (_, index) => this.minIntegerBulletText + index).join(this.splitToken), this.splitToken);
298
+ }
299
+ // If neither bulletTexts nor maxIntegerBulletText are provided,
300
+ return new Set();
301
+ }
302
+ // the last bullet text
303
+ get lastDisplayBulletText() {
304
+ if (this.bulletTextType === 'integer') {
305
+ if (this.maxIntegerBulletText !== null && this.maxIntegerBulletText !== undefined) {
306
+ return Math.min(this.maxIntegerBulletText, this.minIntegerBulletText + this.maxDisplayBulletsCount - 1);
307
+ }
308
+ return this.minIntegerBulletText + this.maxDisplayBulletsCount - 1;
309
+ }
310
+ // Text mode: return the text at the max display index if available
311
+ if (this.bulletTextsSet.size > 0) {
312
+ const texts = Array.from(this.bulletTextsSet);
313
+ if (texts.length >= this.maxDisplayBulletsCount) {
314
+ return texts[this.maxDisplayBulletsCount - 1];
315
+ }
316
+ return texts[texts.length - 1]; // If fewer than maxDisplayBulletsCount, return the last one
317
+ }
318
+ return null;
319
+ }
320
+ get isSingleSelectionMode() {
321
+ return this.maxSelectedCount === 1;
322
+ }
323
+ getBulletToRender() {
324
+ const allBulletTexts = Array.from(this.bulletTextsSet);
325
+ // Determine which bullets to display based on type and limit
326
+ let bulletsToRender = allBulletTexts;
327
+ let showInputButton = false;
328
+ if (this.bulletTextType === 'text') {
329
+ // For text, if we have more items than the limit, we need an input button.
330
+ // The input button takes one slot, so we show (limit - 1) items.
331
+ if (allBulletTexts.length > this.maxDisplayBulletsCount) {
332
+ showInputButton = true;
333
+ bulletsToRender = allBulletTexts.slice(0, this.maxDisplayBulletsCount - 1);
334
+ }
335
+ else {
336
+ bulletsToRender = allBulletTexts;
337
+ }
338
+ }
339
+ else {
340
+ // For integer, logic is based on maxIntegerBulletText vs displayed range
341
+ showInputButton =
342
+ this.maxIntegerBulletText !== null &&
343
+ this.maxIntegerBulletText !== undefined &&
344
+ this.maxIntegerBulletText > Number(this.lastDisplayBulletText);
345
+ // Integer bullets generation already respects the count, no slicing needed on the raw set
346
+ bulletsToRender = allBulletTexts;
347
+ }
348
+ return {
349
+ bulletsToRender,
350
+ showInputButton
351
+ };
352
+ }
353
+ renderBulletGroup() {
354
+ let items = [];
355
+ if (this.type === 'bet') {
356
+ const isMaxSelected = this.maxSelectedCount !== null && this.selectedSet.size >= this.maxSelectedCount;
357
+ const { bulletsToRender, showInputButton } = this.getBulletToRender();
358
+ bulletsToRender.forEach((text, idx) => {
359
+ let bulletType = 'toggle';
360
+ if (!this.selectedSet.has(String(text)) && isMaxSelected && !this.isSingleSelectionMode) {
361
+ bulletType = 'disabled';
362
+ }
363
+ items.push({
364
+ value: this.selectedSet.has(String(text)) ? 1 : 0,
365
+ text: String(text),
366
+ idx,
367
+ type: bulletType
368
+ });
369
+ });
370
+ if (showInputButton) {
371
+ let inputBulletType = 'input';
372
+ if (isMaxSelected && !this.isSingleSelectionMode) {
373
+ inputBulletType = 'disabled';
374
+ }
375
+ const inputButtonText = this.bulletTextType === 'text' ? '...' : `${this.lastDisplayBulletText}+`;
376
+ const inputButtonIdx = this.bulletTextType === 'text' ? -1 : Number(this.lastDisplayBulletText) + 1;
377
+ // Special handling for integer mode:
378
+ // If the generated set is "full" (size == maxDisplayBulletsCount),
379
+ // we need to remove the last item to make room for the "N+" button
380
+ // so the total visual count remains consistent.
381
+ if (this.bulletTextType === 'integer' && items.length >= this.maxDisplayBulletsCount) {
382
+ items.pop();
383
+ }
384
+ items.push({
385
+ value: 0,
386
+ text: inputButtonText,
387
+ idx: inputButtonIdx,
388
+ type: inputBulletType
389
+ });
390
+ }
391
+ }
392
+ else if (['choice', 'preview'].includes(this.type)) {
393
+ // For choice/preview, also respect the visual limit for text mode
394
+ const { bulletsToRender } = this.getBulletToRender();
395
+ bulletsToRender.forEach((text, idx) => {
396
+ let bulletType = 'toggle';
397
+ if (this.type === 'preview') {
398
+ bulletType = 'readonly';
399
+ }
400
+ else if (this.selectedSet.has(String(text))) {
401
+ bulletType = 'delete';
402
+ }
403
+ items.push({
404
+ value: this.selectedSet.has(String(text)) ? 1 : 0,
405
+ text,
406
+ idx,
407
+ type: bulletType
408
+ });
409
+ });
410
+ }
411
+ return (h("div", { class: "lottery-selection-group__item--right" }, items.map((item) => {
412
+ return (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 }));
413
+ })));
414
+ }
415
+ handleCloseAddMoreDialog() {
416
+ this.dialogConfig = Object.assign(Object.assign({}, this.dialogConfig), { visible: false });
417
+ this.inputInfo = { value: '', errorMessage: '', valid: true };
418
+ }
419
+ handleInputChange(e) {
420
+ const inputElement = e.target;
421
+ const value = inputElement.value;
422
+ this.inputInfo = Object.assign(Object.assign({}, this.inputInfo), { value: value });
423
+ this.inputInfo = validateInput({
424
+ value,
425
+ selectedSet: this.selectedSet,
426
+ maxValue: this.maxIntegerBulletText,
427
+ minValue: this.bulletTextType === 'integer' ? Number(this.lastDisplayBulletText) + 1 : undefined,
428
+ language: this.language,
429
+ type: this.bulletTextType
430
+ });
431
+ }
432
+ handleFillInAddMore() {
433
+ if (this.inputInfo.valid) {
434
+ const { value } = this.inputInfo;
435
+ // Normalize the value (e.g., "05" -> "5") to match validation logic
436
+ let normalizedValue = value;
437
+ if (this.bulletTextType === 'integer') {
438
+ normalizedValue = String(Number(value));
439
+ }
440
+ else {
441
+ normalizedValue = value.trim();
442
+ }
443
+ let newSelectedBulletTexts;
444
+ if (this.isSingleSelectionMode) {
445
+ newSelectedBulletTexts = normalizedValue;
446
+ }
447
+ else {
448
+ newSelectedBulletTexts = addSelectedBulletTexts(normalizedValue, Array.from(this.selectedSet)).join(this.splitToken);
449
+ }
450
+ this.bulletGroupUpdateSelectedBulletTexts.emit({
451
+ newSelectedBulletTexts,
452
+ selectionGroupId: this.selectionGroupId
453
+ });
454
+ this.handleCloseAddMoreDialog();
455
+ }
456
+ }
457
+ render() {
458
+ return (h("div", { key: '66b8e9c63d948eb2f7eb37adb80892dbedd7df9a', class: "lottery-selection-group", ref: (el) => (this.stylingContainer = el) }, h("div", { key: '6562fdcad0f352b5e2d03edcc980a9aeab32277e', class: "lottery-selection-group__item" }, this.selectionGroupLabel && (h("div", { key: '43c2132e4904a2b69b970d9b2074f120ed4d0986', class: "lottery-selection-group__item--left" }, this.selectionGroupLabel)), this.renderBulletGroup()), h("lottery-tipping-dialog", { key: 'cb693d10e6b499628909571021d8508cdebbe29a', visible: this.dialogConfig.visible, width: this.dialogConfig.width, onCancel: this.dialogConfig.onCancel }, h("div", { key: 'dd312634574bbe1b4d3de7e82a9c58f58f846c1a', class: "addSelectionDialog" }, h("div", { key: 'b371b1090598f0219a7c652bab51e9d349703c34', class: "addSelectionDialog-title" }, this.dialogTitle || (this.bulletTextType === 'text'
459
+ ? translate('enterValue', this.language)
460
+ : translate('enterScoreUpTo', this.language, {
461
+ maxScore: this.maxIntegerBulletText
462
+ }))), h("input", { key: 'b5f1bb74999246dac8dc20f04e3af893deae6654', type: "text", class: {
463
+ 'dialog-input': true,
464
+ invalid: !this.inputInfo.valid
465
+ }, value: this.inputInfo.value, onInput: this.handleInputChange.bind(this), placeholder: this.dialogInputPlaceholder }), h("div", { key: 'f33970a6dffdc881ffa9cf2c0bb54b26b27cccd6', class: "error-message" }, this.inputInfo.errorMessage)), h("div", { key: '4c580dae14b38aff03e17067b2c0b72d01aa4f42', slot: "footer", class: "addSelectionDialog-footer" }, h("lottery-button", { key: '874aa0ffde8fe2d0b08efea0cf951f101ab8dad0', onClick: this.dialogConfig.onCancel, text: translate('cancel', this.language), variant: "outline" }), h("lottery-button", { key: '63a556eb5f9ad1cdd357c017756be274d40ef235', onClick: this.dialogConfig.onConfirm, text: translate('confirm', this.language), variant: "primary", disabled: !this.inputInfo.valid || !this.inputInfo.value })))));
466
+ }
467
+ static get watchers() { return {
468
+ "clientStyling": ["handleClientStylingChange"],
469
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
470
+ "mbSource": ["handleMbSourceChange"]
471
+ }; }
472
+ };
473
+ LotterySelectionGroup.style = LotterySelectionGroupStyle0;
474
+
475
+ export { LotterySelectionGroup as L, setClientStylingURL as a, setStreamStyling as b, setClientStyling as s };
@@ -0,0 +1,20 @@
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-3a4d6110.js';
2
+ export { s as setNonce } from './index-3a4d6110.js';
3
+ import { g as globalScripts } from './app-globals-0f993ce5.js';
4
+
5
+ /*
6
+ Stencil Client Patch Browser v4.19.2 | MIT Licensed | https://stenciljs.com
7
+ */
8
+ var patchBrowser = () => {
9
+ const importMeta = import.meta.url;
10
+ const opts = {};
11
+ if (importMeta !== "") {
12
+ opts.resourcesUrl = new URL(".", importMeta).href;
13
+ }
14
+ return promiseResolve(opts);
15
+ };
16
+
17
+ patchBrowser().then(async (options) => {
18
+ await globalScripts();
19
+ return bootstrapLazy([["lottery-button_4",[[1,"lottery-selection-group",{"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"language":[513],"translationUrl":[513,"translation-url"],"splitToken":[513,"split-token"],"selectionGroupId":[513,"selection-group-id"],"selectionGroupLabel":[513,"selection-group-label"],"type":[513],"selectedBulletTexts":[513,"selected-bullet-texts"],"maxSelectedCount":[514,"max-selected-count"],"maxDisplayBulletsCount":[514,"max-display-bullets-count"],"bulletTexts":[513,"bullet-texts"],"maxIntegerBulletText":[514,"max-integer-bullet-text"],"minIntegerBulletText":[514,"min-integer-bullet-text"],"bulletTextType":[513,"bullet-text-type"],"hasBorder":[516,"has-border"],"hasBackground":[516,"has-background"],"dialogTitle":[513,"dialog-title"],"dialogInputPlaceholder":[513,"dialog-input-placeholder"],"dialogConfig":[32],"inputInfo":[32]},[[0,"lotteryBulletClick","lotteryBulletClickHandler"]],{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}],[1,"lottery-button",{"variant":[513],"size":[513],"color":[513],"disabled":[516],"loading":[516],"text":[513],"mbSource":[513,"mb-source"],"language":[513],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"ripples":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}],[1,"lottery-selection",{"value":[520],"text":[513],"idx":[514],"type":[513],"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"hasBorder":[516,"has-border"],"hasBackground":[516,"has-background"],"deleteIconSvg":[513,"delete-icon-svg"],"deleteIconWidth":[513,"delete-icon-width"],"deleteIconHeight":[513,"delete-icon-height"]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}],[1,"lottery-tipping-dialog",{"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"visible":[516],"dialogTitle":[1,"dialog-title"],"width":[1],"closable":[4],"mask":[4],"maskClosable":[4,"mask-closable"],"animationDuration":[2,"animation-duration"],"fullscreen":[4],"showFooter":[4,"show-footer"],"showCancelBtn":[4,"show-cancel-btn"],"language":[513],"translationUrl":[520,"translation-url"]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}]]]], options);
20
+ });
@@ -0,0 +1 @@
1
+ module.exports = require('./cjs/index.cjs.js');
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from './esm/index.js';
@@ -0,0 +1 @@
1
+ const o=()=>{};export{o as g}
@@ -0,0 +1,2 @@
1
+ var e=Object.defineProperty,t=new WeakMap,n=e=>t.get(e),l=(e,n)=>t.set(n.t=e,n),o=(e,t)=>t in e,s=(e,t)=>(0,console.error)(e,t),r=new Map,i=new Map,c="slot-fb{display:contents}slot-fb[hidden]{display:none}",u="undefined"!=typeof window?window:{},a=u.document||{head:{}},f={l:0,o:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l),ce:(e,t)=>new CustomEvent(e,t)},h=e=>Promise.resolve(e),p=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),d=!1,m=[],y=[],$=(e,t)=>n=>{e.push(n),d||(d=!0,t&&4&f.l?w(b):f.raf(b))},v=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){s(e)}e.length=0},b=()=>{v(m),v(y),(d=m.length>0)&&f.raf(b)},w=e=>h().then(e),g=$(y,!0),S={},j=e=>"object"==(e=typeof e)||"function"===e;function k(e){var t,n,l;return null!=(l=null==(n=null==(t=e.head)?void 0:t.querySelector('meta[name="csp-nonce"]'))?void 0:n.getAttribute("content"))?l:void 0}((t,n)=>{for(var l in n)e(t,l,{get:n[l],enumerable:!0})})({},{err:()=>E,map:()=>C,ok:()=>O,unwrap:()=>P,unwrapErr:()=>L});var O=e=>({isOk:!0,isErr:!1,value:e}),E=e=>({isOk:!1,isErr:!0,value:e});function C(e,t){if(e.isOk){const n=t(e.value);return n instanceof Promise?n.then((e=>O(e))):O(n)}if(e.isErr)return E(e.value);throw"should never get here"}var M,x,P=e=>{if(e.isOk)return e.value;throw e.value},L=e=>{if(e.isErr)return e.value;throw e.value},R=(e,t,...n)=>{let l=null,o=null,s=!1,r=!1;const i=[],c=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?c(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof e&&!j(l))&&(l+=""),s&&r?i[i.length-1].i+=l:i.push(s?T(null,l):l),r=s)};if(c(n),t){t.key&&(o=t.key);{const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}}const u=T(e,null);return u.u=t,i.length>0&&(u.h=i),u.p=o,u},T=(e,t)=>({l:0,m:e,i:t,$:null,h:null,u:null,p:null}),U={},W=e=>n(e).$hostElement$,A=(e,t,n)=>{const l=W(e);return{emit:e=>F(l,t,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:e})}},F=(e,t,n)=>{const l=f.ce(t,n);return e.dispatchEvent(l),l},N=new WeakMap,D=e=>"sc-"+e.v,H=(e,t,n,l,s,r)=>{if(n!==l){let i=o(e,t),c=t.toLowerCase();if("class"===t){const t=e.classList,o=G(n),s=G(l);t.remove(...o.filter((e=>e&&!s.includes(e)))),t.add(...s.filter((e=>e&&!o.includes(e))))}else if("style"===t){for(const t in n)l&&null!=l[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in l)n&&l[t]===n[t]||(t.includes("-")?e.style.setProperty(t,l[t]):e.style[t]=l[t])}else if("key"===t);else if("ref"===t)l&&l(e);else if(i||"o"!==t[0]||"n"!==t[1]){const o=j(l);if((i||o&&null!==l)&&!s)try{if(e.tagName.includes("-"))e[t]=l;else{const o=null==l?"":l;"list"===t?i=!1:null!=n&&e[t]==o||(e[t]=o)}}catch(e){}null==l||!1===l?!1===l&&""!==e.getAttribute(t)||e.removeAttribute(t):(!i||4&r||s)&&!o&&e.setAttribute(t,l=!0===l?"":l)}else if(t="-"===t[2]?t.slice(3):o(u,c)?c.slice(2):c[2]+t.slice(3),n||l){const o=t.endsWith(V);t=t.replace(_,""),n&&f.rel(e,t,n,o),l&&f.ael(e,t,l,o)}}},q=/\s/,G=e=>e?e.split(q):[],V="Capture",_=RegExp(V+"$"),z=(e,t,n)=>{const l=11===t.$.nodeType&&t.$.host?t.$.host:t.$,o=e&&e.u||S,s=t.u||S;for(const e of B(Object.keys(o)))e in s||H(l,e,o[e],void 0,n,t.l);for(const e of B(Object.keys(s)))H(l,e,o[e],s[e],n,t.l)};function B(e){return e.includes("ref")?[...e.filter((e=>"ref"!==e)),"ref"]:e}var I=!1,J=!1,K=(e,t,n)=>{const l=t.h[n];let o,s,r=0;if(null!==l.i)o=l.$=a.createTextNode(l.i);else if(o=l.$=a.createElement(l.m),z(null,l,J),null!=M&&o["s-si"]!==M&&o.classList.add(o["s-si"]=M),l.h)for(r=0;r<l.h.length;++r)s=K(e,l,r),s&&o.appendChild(s);return o["s-hn"]=x,o},Q=(e,t,n,l,o,s)=>{let r,i=e;for(i.shadowRoot&&i.tagName===x&&(i=i.shadowRoot);o<=s;++o)l[o]&&(r=K(null,n,o),r&&(l[o].$=r,te(i,r,t)))},X=(e,t,n)=>{for(let l=t;l<=n;++l){const t=e[l];if(t){const e=t.$;ee(t),e&&e.remove()}}},Y=(e,t,n=!1)=>e.m===t.m&&(!!n||e.p===t.p),Z=(e,t,n=!1)=>{const l=t.$=e.$,o=e.h,s=t.h,r=t.i;null===r?(("slot"!==t.m||I)&&z(e,t,J),null!==o&&null!==s?((e,t,n,l,o=!1)=>{let s,r,i=0,c=0,u=0,a=0,f=t.length-1,h=t[0],p=t[f],d=l.length-1,m=l[0],y=l[d];for(;i<=f&&c<=d;)if(null==h)h=t[++i];else if(null==p)p=t[--f];else if(null==m)m=l[++c];else if(null==y)y=l[--d];else if(Y(h,m,o))Z(h,m,o),h=t[++i],m=l[++c];else if(Y(p,y,o))Z(p,y,o),p=t[--f],y=l[--d];else if(Y(h,y,o))Z(h,y,o),te(e,h.$,p.$.nextSibling),h=t[++i],y=l[--d];else if(Y(p,m,o))Z(p,m,o),te(e,p.$,h.$),p=t[--f],m=l[++c];else{for(u=-1,a=i;a<=f;++a)if(t[a]&&null!==t[a].p&&t[a].p===m.p){u=a;break}u>=0?(r=t[u],r.m!==m.m?s=K(t&&t[c],n,u):(Z(r,m,o),t[u]=void 0,s=r.$),m=l[++c]):(s=K(t&&t[c],n,c),m=l[++c]),s&&te(h.$.parentNode,s,h.$)}i>f?Q(e,null==l[d+1]?null:l[d+1].$,n,l,c,d):c>d&&X(t,i,f)})(l,o,t,s,n):null!==s?(null!==e.i&&(l.textContent=""),Q(l,null,t,s,0,s.length-1)):null!==o&&X(o,0,o.length-1)):e.i!==r&&(l.data=r)},ee=e=>{e.u&&e.u.ref&&e.u.ref(null),e.h&&e.h.map(ee)},te=(e,t,n)=>null==e?void 0:e.insertBefore(t,n),ne=(e,t)=>{t&&!e.S&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.S=t)))},le=(e,t)=>{if(e.l|=16,!(4&e.l))return ne(e,e.j),g((()=>oe(e,t)));e.l|=512},oe=(e,t)=>{const n=e.t;if(!n)throw Error(`Can't render component <${e.$hostElement$.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);let l;return t?(e.l|=256,e.k&&(e.k.map((([e,t])=>fe(n,e,t))),e.k=void 0),l=fe(n,"componentWillLoad")):l=fe(n,"componentWillUpdate"),se(l,(()=>ie(e,n,t)))},se=(e,t)=>re(e)?e.then(t).catch((e=>{console.error(e),t()})):t(),re=e=>e instanceof Promise||e&&e.then&&"function"==typeof e.then,ie=async(e,t,n)=>{var l;const o=e.$hostElement$,s=o["s-rc"];n&&(e=>{const t=e.O,n=e.$hostElement$,l=t.l,o=((e,t)=>{var n;const l=D(t),o=i.get(l);if(e=11===e.nodeType?e:a,o)if("string"==typeof o){let s,r=N.get(e=e.head||e);if(r||N.set(e,r=new Set),!r.has(l)){{s=a.createElement("style"),s.innerHTML=o;const t=null!=(n=f.C)?n:k(a);null!=t&&s.setAttribute("nonce",t),e.insertBefore(s,e.querySelector("link"))}4&t.l&&(s.innerHTML+=c),r&&r.add(l)}}else e.adoptedStyleSheets.includes(o)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,o]);return l})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=o,n.classList.add(o+"-h"))})(e);ce(e,t,o,n),s&&(s.map((e=>e())),o["s-rc"]=void 0);{const t=null!=(l=o["s-p"])?l:[],n=()=>ue(e);0===t.length?n():(Promise.all(t).then(n),e.l|=4,t.length=0)}},ce=(e,t,n,l)=>{try{t=t.render(),e.l&=-17,e.l|=2,((e,t,n=!1)=>{const l=e.$hostElement$,o=e.O,s=e.M||T(null,null),r=(e=>e&&e.m===U)(t)?t:R(null,null,t);if(x=l.tagName,o.P&&(r.u=r.u||{},o.P.map((([e,t])=>r.u[t]=l[e]))),n&&r.u)for(const e of Object.keys(r.u))l.hasAttribute(e)&&!["key","ref","style","class"].includes(e)&&(r.u[e]=l[e]);r.m=null,r.l|=4,e.M=r,r.$=s.$=l.shadowRoot||l,M=l["s-sc"],I=!!(1&o.l),Z(s,r,n)})(e,t,l)}catch(t){s(t,e.$hostElement$)}return null},ue=e=>{const t=e.$hostElement$,n=e.t,l=e.j;64&e.l||(e.l|=64,he(t),fe(n,"componentDidLoad"),e.L(t),l||ae()),e.S&&(e.S(),e.S=void 0),512&e.l&&w((()=>le(e,!1))),e.l&=-517},ae=()=>{he(a.documentElement),w((()=>F(u,"appload",{detail:{namespace:"lottery-selection-group"}})))},fe=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){s(e)}},he=e=>e.classList.add("hydrated"),pe=(e,t,l)=>{var o,r;const i=e.prototype;if(t.R||t.T||e.watchers){e.watchers&&!t.T&&(t.T=e.watchers);const c=Object.entries(null!=(o=t.R)?o:{});if(c.map((([e,[o]])=>{(31&o||2&l&&32&o)&&Object.defineProperty(i,e,{get(){return((e,t)=>n(this).U.get(t))(0,e)},set(l){((e,t,l,o)=>{const r=n(e);if(!r)throw Error(`Couldn't find host element for "${o.v}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/ionic-team/stencil/issues/5457).`);const i=r.$hostElement$,c=r.U.get(t),u=r.l,a=r.t;if(l=((e,t)=>null==e||j(e)?e:4&t?"false"!==e&&(""===e||!!e):2&t?parseFloat(e):1&t?e+"":e)(l,o.R[t][0]),(!(8&u)||void 0===c)&&l!==c&&(!Number.isNaN(c)||!Number.isNaN(l))&&(r.U.set(t,l),a)){if(o.T&&128&u){const e=o.T[t];e&&e.map((e=>{try{a[e](l,c,t)}catch(e){s(e,i)}}))}2==(18&u)&&le(r,!1)}})(this,e,l,t)},configurable:!0,enumerable:!0})})),1&l){const l=new Map;i.attributeChangedCallback=function(e,o,s){f.jmp((()=>{var r;const c=l.get(e);if(this.hasOwnProperty(c))s=this[c],delete this[c];else{if(i.hasOwnProperty(c)&&"number"==typeof this[c]&&this[c]==s)return;if(null==c){const l=n(this),i=null==l?void 0:l.l;if(i&&!(8&i)&&128&i&&s!==o){const n=l.t,i=null==(r=t.T)?void 0:r[e];null==i||i.forEach((t=>{null!=n[t]&&n[t].call(n,s,o,e)}))}return}}this[c]=(null!==s||"boolean"!=typeof this[c])&&s}))},e.observedAttributes=Array.from(new Set([...Object.keys(null!=(r=t.T)?r:{}),...c.filter((([e,t])=>15&t[0])).map((([e,n])=>{var o;const s=n[1]||e;return l.set(s,e),512&n[0]&&(null==(o=t.P)||o.push([e,s])),s}))]))}}return e},de=e=>{fe(e,"disconnectedCallback")},me=(e,l={})=>{var o;const h=[],d=l.exclude||[],m=u.customElements,y=a.head,$=y.querySelector("meta[charset]"),v=a.createElement("style"),b=[];let w,g=!0;Object.assign(f,l),f.o=new URL(l.resourcesUrl||"./",a.baseURI).href;let S=!1;if(e.map((e=>{e[1].map((l=>{var o;const c={l:l[0],v:l[1],R:l[2],W:l[3]};4&c.l&&(S=!0),c.R=l[2],c.W=l[3],c.P=[],c.T=null!=(o=l[4])?o:{};const u=c.v,a=class extends HTMLElement{constructor(e){if(super(e),this.hasRegisteredEventListeners=!1,((e,n)=>{const l={l:0,$hostElement$:e,O:n,U:new Map};l.A=new Promise((e=>l.L=e)),e["s-p"]=[],e["s-rc"]=[],t.set(e,l)})(e=this,c),1&c.l)if(e.shadowRoot){if("open"!==e.shadowRoot.mode)throw Error(`Unable to re-use existing shadow root for ${c.v}! Mode is set to ${e.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else e.attachShadow({mode:"open"})}connectedCallback(){const e=n(this);this.hasRegisteredEventListeners||(this.hasRegisteredEventListeners=!0,ye(this,e,c.W)),w&&(clearTimeout(w),w=null),g?b.push(this):f.jmp((()=>(e=>{if(!(1&f.l)){const t=n(e),l=t.O,o=()=>{};if(1&t.l)ye(e,t,l.W),(null==t?void 0:t.t)||(null==t?void 0:t.A)&&t.A.then((()=>{}));else{t.l|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){ne(t,t.j=n);break}}l.R&&Object.entries(l.R).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n)=>{let l;if(!(32&t.l)){if(t.l|=32,n.F){const e=(e=>{const t=e.v.replace(/-/g,"_"),n=e.F;if(!n)return;const l=r.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(r.set(n,e),e[t])),s)
2
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/})(n);if(e&&"then"in e){const t=()=>{};l=await e,t()}else l=e;if(!l)throw Error(`Constructor for "${n.v}#${t.N}" was not found`);l.isProxied||(n.T=l.watchers,pe(l,n,2),l.isProxied=!0);const o=()=>{};t.l|=8;try{new l(t)}catch(e){s(e)}t.l&=-9,t.l|=128,o()}else l=e.constructor,customElements.whenDefined(e.localName).then((()=>t.l|=128));if(l&&l.style){let e;"string"==typeof l.style&&(e=l.style);const t=D(n);if(!i.has(t)){const l=()=>{};((e,t,n)=>{let l=i.get(e);p&&n?(l=l||new CSSStyleSheet,"string"==typeof l?l=t:l.replaceSync(t)):l=t,i.set(e,l)})(t,e,!!(1&n.l)),l()}}}const o=t.j,c=()=>le(t,!0);o&&o["s-rc"]?o["s-rc"].push(c):c()})(e,t,l)}o()}})(this)))}disconnectedCallback(){f.jmp((()=>(async()=>{if(!(1&f.l)){const e=n(this);e.D&&(e.D.map((e=>e())),e.D=void 0),(null==e?void 0:e.t)?de(e.t):(null==e?void 0:e.A)&&e.A.then((()=>de(e.t)))}})()))}componentOnReady(){return n(this).A}};c.F=e[0],d.includes(u)||m.get(u)||(h.push(u),m.define(u,pe(a,c,1)))}))})),h.length>0&&(S&&(v.textContent+=c),v.textContent+=h.sort()+"{visibility:hidden}.hydrated{visibility:inherit}",v.innerHTML.length)){v.setAttribute("data-styles","");const e=null!=(o=f.C)?o:k(a);null!=e&&v.setAttribute("nonce",e),y.insertBefore(v,$?$.nextSibling:y.firstChild)}g=!1,b.length?b.map((e=>e.connectedCallback())):f.jmp((()=>w=setTimeout(ae,30)))},ye=(e,t,n)=>{n&&n.map((([n,l,o])=>{const s=e,r=$e(t,o),i=ve(n);f.ael(s,l,r,i),(t.D=t.D||[]).push((()=>f.rel(s,l,r,i)))}))},$e=(e,t)=>n=>{var l;try{256&e.l?null==(l=e.t)||l[t](n):(e.k=e.k||[]).push([t,n])}catch(e){s(e)}},ve=e=>({passive:!!(1&e),capture:!!(2&e)}),be=e=>f.C=e;export{me as b,A as c,W as g,R as h,h as p,l as r,be as s}
@@ -0,0 +1 @@
1
+ export{L as LotterySelectionGroup}from"./lottery-selection-group-656d6729.js";import"./index-3a4d6110.js";
@@ -0,0 +1 @@
1
+ import{r as t,h as e,g as o,c as r}from"./index-3a4d6110.js";import{s as i,a as n,b as a}from"./lottery-selection-group-656d6729.js";export{L as lottery_selection_group}from"./lottery-selection-group-656d6729.js";const l=["ro","en","fr","ar","hr","zh"],s={en:{loading:"Loading"},ro:{},fr:{},ar:{},hr:{}},c=class{constructor(e){t(this,e),this.handleClick=t=>{if(this.disabled)return;const e=this.host.shadowRoot.querySelector(".btn");if(!e)return;const o=e.getBoundingClientRect(),r=Math.max(o.width,o.height),i={top:t.clientY-o.top-r/2,left:t.clientX-o.left-r/2,size:r};this.ripples=[...this.ripples,i],setTimeout((()=>{this.ripples=this.ripples.filter((t=>t!==i))}),600)},this.variant="primary",this.size="medium",this.color=void 0,this.disabled=!1,this.loading=!1,this.text=void 0,this.mbSource=void 0,this.language="en",this.clientStyling=void 0,this.clientStylingUrl=void 0,this.translationUrl="",this.ripples=[]}handleClientStylingChange(t,e){t!=e&&i(this.stylingContainer,this.clientStyling)}handleClientStylingUrlChange(t,e){t!=e&&n(this.stylingContainer,this.clientStylingUrl)}handleMbSourceChange(t,e){t!=e&&a(this.stylingContainer,`${this.mbSource}.Style`)}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}componentDidLoad(){this.stylingContainer&&(this.mbSource&&a(this.stylingContainer,`${this.mbSource}.Style`),this.clientStyling&&i(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&n(this.stylingContainer,this.clientStylingUrl))}componentWillLoad(){this.translationUrl&&(async t=>{if(t)try{const o=await fetch(t);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);const r=await o.json();e=r,Object.keys(e).forEach((t=>{for(let o in e[t])s[t][o]=e[t][o]}))}catch(t){console.error("Failed to fetch or parse translations from URL:",t)}var e})(this.translationUrl)}render(){const{variant:t,disabled:o,size:r,color:i}=this,n=o||this.loading,a={};if(i)switch(t){case"primary":default:Object.assign(a,{backgroundColor:i,borderColor:i});break;case"outline":case"dashed":Object.assign(a,{color:i,borderColor:i});break;case"text":Object.assign(a,{color:i})}return e("button",{key:"aa74ad98c90e7548228557bf8a8d26b125d4a83a",class:{btn:!0,[`btn--${t}`]:!0,[`btn--${r}`]:!0,"btn--loading":this.loading},style:i?a:void 0,disabled:n,onClick:this.handleClick,ref:t=>this.stylingContainer=t},this.loading?e("div",{class:"loading-container"},e("span",{class:"content"},this.text||(()=>{const t=this.language;let e=s[void 0!==t&&l.includes(t)?t:"en"].loading;return e})()),e("span",{class:"spinner"})):e("span",{class:"content"},e("slot",{name:"icon-left"}),this.text||e("slot",null),e("slot",{name:"icon-right"})),e("div",{key:"302ea02be395bb24989d4abc040a513e23fa029a",class:"ripple-container"},this.ripples.map(((t,o)=>e("span",{key:o,class:"ripple",style:{top:`${t.top}px`,left:`${t.left}px`,width:`${t.size}px`,height:`${t.size}px`}})))))}get host(){return o(this)}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"]}}};c.style=":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}}";const d={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"};var h=function(){return h=Object.assign||function(t){for(var e,o=1,r=arguments.length;o<r;o++)for(var i in e=arguments[o])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},h.apply(this,arguments)},b={primaryColor:"#333",secondaryColor:"#E6E6E6"};function g(t,e){var o="svg"===t.tag?h(h({},t.attrs),e.extraSVGAttrs||{}):t.attrs,r=Object.keys(o).reduce((function(t,e){var r=o[e],i="".concat(e,'="').concat(r,'"');return t.push(i),t}),[]),i=r.length?" "+r.join(" "):"",n=(t.children||[]).map((function(t){return g(t,e)})).join("");return n&&n.length?"<".concat(t.tag).concat(i,">").concat(n,"</").concat(t.tag,">"):"<".concat(t.tag).concat(i," />")}const p=class{constructor(e){t(this,e),this.lotteryBulletClickHandler=r(this,"lotteryBulletClick",7),this.value=0,this.text=void 0,this.idx=void 0,this.type="toggle",this.mbSource=void 0,this.clientStyling=void 0,this.clientStylingUrl=void 0,this.hasBorder=!0,this.hasBackground=!0,this.deleteIconSvg="",this.deleteIconWidth="16px",this.deleteIconHeight="16px"}handleClientStylingChange(t,e){t!==e&&i(this.stylingContainer,this.clientStyling)}handleClientStylingUrlChange(t,e){t!==e&&n(this.stylingContainer,this.clientStylingUrl)}handleMbSourceChange(t,e){t!==e&&a(this.stylingContainer,`${this.mbSource}.Style`)}componentDidLoad(){this.stylingContainer&&(this.mbSource&&a(this.stylingContainer,`${this.mbSource}.Style`),this.clientStyling&&i(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&n(this.stylingContainer,this.clientStylingUrl))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}handleClick(){"disabled"!==this.type&&"readonly"!==this.type&&(console.log("bullet clicked",this.type,this.idx,this.text,this.value),this.lotteryBulletClickHandler.emit({type:this.type,idx:this.idx,text:this.text,value:this.value}))}render(){let t;return t=this.deleteIconSvg?function(t){let e=t.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"");return e=e.replace(/on[a-z]+=[\"'][^\"']*[\"']/gi,""),e=e.replace(/javascript:/gi,""),e}(this.deleteIconSvg):function(t,e){if(void 0===e&&(e={}),"function"==typeof t.icon){var o=e.placeholders||b;return g(t.icon(o.primaryColor,o.secondaryColor),e)}return g(t.icon,e)}(d,{extraSVGAttrs:{width:this.deleteIconWidth,height:this.deleteIconHeight,fill:"currentColor"}}),e("div",{key:"0d1e8aaa80a907a7467410f6b27b4b6175e82299",class:"lottery-selection",ref:t=>this.stylingContainer=t},e("button",{key:"11a2402abbc290dc877ad95f3433092c3a0d8419",class:{"lottery-selection__button":!0,"lottery-selection__button--selected":1==this.value,"lottery-selection__button--disabled":"disabled"===this.type,"lottery-selection__button--no-border":!this.hasBorder,"lottery-selection__button--no-background":!this.hasBackground,isDeleteByIcon:"delete"===this.type,isCallDialogBtn:"input"===this.type||"readonly"===this.type},onClick:this.handleClick.bind(this),disabled:"disabled"===this.type},"delete"===this.type&&e("span",{key:"f99001d936a8f7bdf8adc5c46e82caf730a9442a",class:"lottery-selection__delete-icon",innerHTML:t}),e("span",{key:"55775e2492a1fe45cc8a457ac0a0d206744461ab",class:"lottery-selection__text"},this.text)))}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"]}}};p.style=":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}";const y=["ro","en","fr","ar","hr"],u={en:{cancel:"Cancel",confirm:"Confirm"},ro:{cancel:"Anulează",confirm:"Confirmă"},fr:{cancel:"Annuler",confirm:"Confirmer"},ar:{cancel:"إلغاء",confirm:"تأكيد"},hr:{cancel:"Odustani",confirm:"Potvrdi"}},f=(t,e)=>{const o=e;return u[void 0!==o&&y.includes(o)?o:"en"][t]},v=class{constructor(e){t(this,e),this.open=r(this,"open",7),this.close=r(this,"close",7),this.confirm=r(this,"confirm",7),this.cancel=r(this,"cancel",7),this.wasVisible=!1,this.mbSource=void 0,this.clientStyling="",this.clientStylingUrl="",this.visible=void 0,this.dialogTitle="",this.width="520px",this.closable=!0,this.mask=!0,this.maskClosable=!0,this.animationDuration=300,this.fullscreen=!1,this.showFooter=!0,this.showCancelBtn=!0,this.language="en",this.translationUrl=void 0}handleClientStylingChange(t,e){t!=e&&i(this.stylingContainer,this.clientStyling)}handleClientStylingUrlChange(t,e){t!=e&&n(this.stylingContainer,this.clientStylingUrl)}handleMbSourceChange(t,e){t!=e&&a(this.stylingContainer,`${this.mbSource}.Style`)}componentWillLoad(){this.translationUrl&&(async t=>{if(t)try{const o=await fetch(t);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);const r=await o.json();e=r,Object.keys(e).forEach((t=>{for(let o in e[t])u[t][o]=e[t][o]}))}catch(t){console.error("Failed to fetch or parse translations from URL:",t)}var e})(this.translationUrl)}componentWillUpdate(){this.visible&&!this.wasVisible?this.disableBodyScroll():!this.visible&&this.wasVisible&&this.enableBodyScroll(),this.wasVisible=this.visible}disconnectedCallback(){this.enableBodyScroll(),this.stylingSubscription&&this.stylingSubscription.unsubscribe()}disableBodyScroll(){document.body.style.overflow="hidden"}enableBodyScroll(){document.body.style.overflow=""}handleClose(){this.cancel.emit()}handleMaskClick(t){this.maskClosable&&t.target===this.el.querySelector(".mask")&&this.cancel.emit()}handleConfirm(){this.confirm.emit()}render(){const t={width:"number"==typeof this.width?`${this.width}px`:this.width,"--duration":`${this.animationDuration}ms`},o=["dialog-wrapper",this.visible?"dialog-wrapper-visible":""],r=["mask",this.visible?"mask-enter":"mask-leave"],i=["dialog",this.visible?"dialog-enter":"dialog-leave",this.fullscreen?"fullscreen":""].join(" ");return e("div",{key:"716c6488b86fc5a74bcd8c8c8a4eee1b85f75cb7",class:o.join(" "),ref:t=>this.stylingContainer=t},e("div",{key:"161d976b5a15f62c63b56555e161b5b29c0a7771",class:r.join(" "),onClick:this.handleMaskClick.bind(this)}),e("div",{key:"ebd2c356c169765b06c85997dc9906b74358b450",class:i,style:t,role:"dialog","aria-modal":"true","aria-labelledby":"dialog-title"},e("div",{key:"2a8616c336447b33d3c4b3f22deee3871abd93c9",class:"dialog-header"},e("h2",{key:"fc4f4f87826620754f8cce73874726cdebcc280e",id:"dialog-title",class:"dialog-title"},this.dialogTitle),this.closable&&e("button",{key:"1626434c0700df7dc094cbf0c96840476ab65da5",class:"close-btn",onClick:this.handleClose.bind(this)},"x")),e("div",{key:"44d28c0e477e3e16069749f7700ee70b6a486d07",class:"dialog-content",style:{maxHeight:"calc(100vh - 62px)",overflowY:"auto"}},e("slot",{key:"745e1329fc3647247245f7aa96d10a06b6b18329"})),this.showFooter&&e("div",{key:"cc3b19ba0ab16fd485f2c4e81a5793a25cecb98f",class:"dialog-footer"},e("slot",{key:"906adc00a3735e096159002b972804cfe147f42e",name:"footer"},this.showCancelBtn&&e("button",{key:"1fc68b04c7c39ca9b7dfb228836eb38c4368c355",class:"cancel-btn",onClick:this.handleClose.bind(this)},f("cancel",this.language)),e("button",{key:"1d054ca93148286249d4989c783a67e1afe33667",class:"confirm-btn",onClick:this.handleConfirm.bind(this)},f("confirm",this.language))))))}get el(){return o(this)}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"]}}};v.style=".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)}}";export{c as lottery_button,p as lottery_selection,v as lottery_tipping_dialog}
@@ -0,0 +1 @@
1
+ import{r as e,c as t,h as i}from"./index-3a4d6110.js";function r(e,t){if(e){const i=document.createElement("style");i.innerHTML=t,e.appendChild(i)}}function l(e,t){if(!e||!t)return;const i=new URL(t);fetch(i.href).then((e=>e.text())).then((t=>{const i=document.createElement("style");i.innerHTML=t,e&&e.appendChild(i)})).catch((e=>{console.error("There was an error while trying to load client styling from URL",e)}))}function o(e,t){if(window.emMessageBus){const i=document.createElement("style");window.emMessageBus.subscribe(t,(t=>{i.innerHTML=t,e&&e.appendChild(i)}))}}const n=["ro","en","fr","ar","hr","zh"],s={en:{noTicketBoard:"No ticket board available.",selectionCleared:"Your selection has been cleared.",clearAll:"Clear All",stopAt:"Stop at",turnover:"Turnover: ",pleaseFillIn:"Please fill in all the selection input!",fillIn:"Fill in",noBets:"Sorry. No bets have been placed so far. Check back later!",search:"Search",clear:"Clear",oddsChart:"Odds Chart",ticketSuccess:"Ticket purchased successfully.",stakePerLine:"Stake per Line:",lowestOdds:"Lowest Odds:",highestOdds:"Highest Odds:",orderSummary:"ORDER SUMMARY",ticket:"Ticket",lines:"Lines",total:"Total",submit:"Submit",loading:"Loading",enterValidNumber:"Please enter a valid number.",enterNumberBetween:"Please enter a number between {min} and {max}.",numberAlreadySelected:"This number has already been selected.",enterScoreUpTo:"Please enter the score (Up to {maxScore})",enterValue:"Please enter a value",myChoices:"My Choices",teams:"Teams",scores:"Scores",euro:"Euro",cancel:"Cancel",confirm:"Confirm"},ro:{},fr:{},ar:{},hr:{}},a=(e,t,i)=>{const r=t;let l=s[void 0!==r&&n.includes(r)?r:"en"][e];return i&&Object.keys(i).forEach((e=>{l=l.replace(`{${e}}`,i[e])})),l};function c(e,t){return new Set(e?e.split(t):[])}function d(e,t){return t.filter((t=>t!==e))}function h(e,t){return t.concat([e])}const u=class{constructor(i){e(this,i),this.bulletGroupUpdateSelectedBulletTexts=t(this,"bulletGroupUpdateSelection",7),this.mbSource=void 0,this.clientStyling=void 0,this.clientStylingUrl=void 0,this.language="en",this.translationUrl="",this.splitToken=",",this.selectionGroupId=void 0,this.selectionGroupLabel=void 0,this.type="bet",this.selectedBulletTexts=null,this.maxSelectedCount=null,this.maxDisplayBulletsCount=11,this.bulletTexts=null,this.maxIntegerBulletText=null,this.minIntegerBulletText=0,this.bulletTextType="integer",this.hasBorder=!0,this.hasBackground=!0,this.dialogTitle=void 0,this.dialogInputPlaceholder=void 0,this.dialogConfig={width:"400px",visible:!1,onConfirm:()=>this.handleFillInAddMore(),onCancel:()=>this.handleCloseAddMoreDialog()},this.inputInfo={valid:!0,errorMessage:"",value:""}}handleClientStylingChange(e,t){e!=t&&r(this.stylingContainer,this.clientStyling)}handleClientStylingUrlChange(e,t){e!=t&&l(this.stylingContainer,this.clientStylingUrl)}handleMbSourceChange(e,t){e!=t&&o(this.stylingContainer,`${this.mbSource}.Style`)}componentWillLoad(){var e;this.translationUrl&&(e=JSON.parse(this.translationUrl),Object.keys(e).forEach((t=>{for(let i in e[t])s[t][i]=e[t][i]})))}componentDidLoad(){this.stylingContainer&&(this.mbSource&&o(this.stylingContainer,`${this.mbSource}.Style`),this.clientStyling&&r(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&l(this.stylingContainer,this.clientStylingUrl))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}lotteryBulletClickHandler(e){if(e.stopPropagation(),"input"!==e.detail.type)if(["delete","toggle"].includes(e.detail.type))this.bulletGroupUpdateSelectedBulletTexts.emit({newSelectedBulletTexts:(t=e.detail,i=Array.from(this.selectedSet),r=this.maxSelectedCount,"delete"===t.type?d(t.text,i):"toggle"===t.type?i.includes(t.text)?d(t.text,i):i.length>=r?function(e,t,i){return t.slice(t.length-(i-1)).concat([e])}(t.text,i,r):h(t.text,i):[]).join(this.splitToken),selectionGroupId:this.selectionGroupId});else var t,i,r;else this.dialogConfig=Object.assign(Object.assign({},this.dialogConfig),{visible:!0})}get selectedSet(){return c(this.selectedBulletTexts,this.splitToken)}get bulletTextsSet(){return this.bulletTexts?c(this.bulletTexts,this.splitToken):"integer"===this.bulletTextType&&null!=this.maxIntegerBulletText?c(Array.from({length:Number(this.lastDisplayBulletText)-this.minIntegerBulletText+1},((e,t)=>this.minIntegerBulletText+t)).join(this.splitToken),this.splitToken):new Set}get lastDisplayBulletText(){if("integer"===this.bulletTextType)return null!=this.maxIntegerBulletText?Math.min(this.maxIntegerBulletText,this.minIntegerBulletText+this.maxDisplayBulletsCount-1):this.minIntegerBulletText+this.maxDisplayBulletsCount-1;if(this.bulletTextsSet.size>0){const e=Array.from(this.bulletTextsSet);return e.length>=this.maxDisplayBulletsCount?e[this.maxDisplayBulletsCount-1]:e[e.length-1]}return null}get isSingleSelectionMode(){return 1===this.maxSelectedCount}getBulletToRender(){const e=Array.from(this.bulletTextsSet);let t=e,i=!1;return"text"===this.bulletTextType?e.length>this.maxDisplayBulletsCount?(i=!0,t=e.slice(0,this.maxDisplayBulletsCount-1)):t=e:(i=null!=this.maxIntegerBulletText&&this.maxIntegerBulletText>Number(this.lastDisplayBulletText),t=e),{bulletsToRender:t,showInputButton:i}}renderBulletGroup(){let e=[];if("bet"===this.type){const t=null!==this.maxSelectedCount&&this.selectedSet.size>=this.maxSelectedCount,{bulletsToRender:i,showInputButton:r}=this.getBulletToRender();if(i.forEach(((i,r)=>{let l="toggle";this.selectedSet.has(String(i))||!t||this.isSingleSelectionMode||(l="disabled"),e.push({value:this.selectedSet.has(String(i))?1:0,text:String(i),idx:r,type:l})})),r){let i="input";t&&!this.isSingleSelectionMode&&(i="disabled");const r="text"===this.bulletTextType?"...":`${this.lastDisplayBulletText}+`,l="text"===this.bulletTextType?-1:Number(this.lastDisplayBulletText)+1;"integer"===this.bulletTextType&&e.length>=this.maxDisplayBulletsCount&&e.pop(),e.push({value:0,text:r,idx:l,type:i})}}else if(["choice","preview"].includes(this.type)){const{bulletsToRender:t}=this.getBulletToRender();t.forEach(((t,i)=>{let r="toggle";"preview"===this.type?r="readonly":this.selectedSet.has(String(t))&&(r="delete"),e.push({value:this.selectedSet.has(String(t))?1:0,text:t,idx:i,type:r})}))}return i("div",{class:"lottery-selection-group__item--right"},e.map((e=>i("lottery-selection",{clientStyling:this.clientStyling,clientStylingUrl:this.clientStylingUrl,mbSource:this.mbSource,text:e.text,idx:e.idx,value:e.value,type:e.type,hasBorder:this.hasBorder,hasBackground:this.hasBackground}))))}handleCloseAddMoreDialog(){this.dialogConfig=Object.assign(Object.assign({},this.dialogConfig),{visible:!1}),this.inputInfo={value:"",errorMessage:"",valid:!0}}handleInputChange(e){const t=e.target.value;this.inputInfo=Object.assign(Object.assign({},this.inputInfo),{value:t}),this.inputInfo=function({value:e,selectedSet:t,maxValue:i,minValue:r,language:l,type:o="integer"}){const n=e.trim();if("integer"===o){if(!/^-?\d+$/.test(n))return{valid:!1,errorMessage:a("enterValidNumber",l),value:e};const o=Number(n);if(isNaN(o))return{valid:!1,errorMessage:a("enterValidNumber",l),value:e};if(void 0!==r&&o<r||void 0!==i&&o>i)return{valid:!1,errorMessage:a("enterNumberBetween",l,{min:r,max:i}),value:e};const s=String(o);if(t.has(s))return{valid:!1,errorMessage:a("numberAlreadySelected",l),value:e}}else if(t.has(n))return{valid:!1,errorMessage:a("numberAlreadySelected",l),value:e};return{valid:!0,errorMessage:"",value:e}}({value:t,selectedSet:this.selectedSet,maxValue:this.maxIntegerBulletText,minValue:"integer"===this.bulletTextType?Number(this.lastDisplayBulletText)+1:void 0,language:this.language,type:this.bulletTextType})}handleFillInAddMore(){if(this.inputInfo.valid){const{value:e}=this.inputInfo;let t,i=e;i="integer"===this.bulletTextType?String(Number(e)):e.trim(),t=this.isSingleSelectionMode?i:h(i,Array.from(this.selectedSet)).join(this.splitToken),this.bulletGroupUpdateSelectedBulletTexts.emit({newSelectedBulletTexts:t,selectionGroupId:this.selectionGroupId}),this.handleCloseAddMoreDialog()}}render(){return i("div",{key:"66b8e9c63d948eb2f7eb37adb80892dbedd7df9a",class:"lottery-selection-group",ref:e=>this.stylingContainer=e},i("div",{key:"6562fdcad0f352b5e2d03edcc980a9aeab32277e",class:"lottery-selection-group__item"},this.selectionGroupLabel&&i("div",{key:"43c2132e4904a2b69b970d9b2074f120ed4d0986",class:"lottery-selection-group__item--left"},this.selectionGroupLabel),this.renderBulletGroup()),i("lottery-tipping-dialog",{key:"cb693d10e6b499628909571021d8508cdebbe29a",visible:this.dialogConfig.visible,width:this.dialogConfig.width,onCancel:this.dialogConfig.onCancel},i("div",{key:"dd312634574bbe1b4d3de7e82a9c58f58f846c1a",class:"addSelectionDialog"},i("div",{key:"b371b1090598f0219a7c652bab51e9d349703c34",class:"addSelectionDialog-title"},this.dialogTitle||("text"===this.bulletTextType?a("enterValue",this.language):a("enterScoreUpTo",this.language,{maxScore:this.maxIntegerBulletText}))),i("input",{key:"b5f1bb74999246dac8dc20f04e3af893deae6654",type:"text",class:{"dialog-input":!0,invalid:!this.inputInfo.valid},value:this.inputInfo.value,onInput:this.handleInputChange.bind(this),placeholder:this.dialogInputPlaceholder}),i("div",{key:"f33970a6dffdc881ffa9cf2c0bb54b26b27cccd6",class:"error-message"},this.inputInfo.errorMessage)),i("div",{key:"4c580dae14b38aff03e17067b2c0b72d01aa4f42",slot:"footer",class:"addSelectionDialog-footer"},i("lottery-button",{key:"874aa0ffde8fe2d0b08efea0cf951f101ab8dad0",onClick:this.dialogConfig.onCancel,text:a("cancel",this.language),variant:"outline"}),i("lottery-button",{key:"63a556eb5f9ad1cdd357c017756be274d40ef235",onClick:this.dialogConfig.onConfirm,text:a("confirm",this.language),variant:"primary",disabled:!this.inputInfo.valid||!this.inputInfo.value}))))}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"]}}};u.style=":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}";export{u as L,l as a,o as b,r as s}