@everymatrix/casino-challenges-container 0.0.1 → 0.0.2

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 (31) hide show
  1. package/dist/casino-challenges-container/casino-challenge-card_4.entry.js +1 -0
  2. package/dist/casino-challenges-container/casino-challenges-container-b776a245.js +1 -0
  3. package/dist/casino-challenges-container/casino-challenges-container.esm.js +1 -1
  4. package/dist/casino-challenges-container/index-c7b24115.js +2 -0
  5. package/dist/casino-challenges-container/index.esm.js +1 -1
  6. package/dist/cjs/casino-challenge-card_4.cjs.entry.js +570 -0
  7. package/dist/cjs/{casino-challenges-container-54a20dee.js → casino-challenges-container-aa20cd29.js} +70 -5
  8. package/dist/cjs/casino-challenges-container.cjs.js +2 -2
  9. package/dist/cjs/{index-cf89b5da.js → index-2631ee03.js} +39 -5
  10. package/dist/cjs/index.cjs.js +2 -2
  11. package/dist/cjs/loader.cjs.js +2 -2
  12. package/dist/collection/collection-manifest.json +20 -1
  13. package/dist/collection/components/casino-challenges-container/casino-challenges-container.css +15 -2
  14. package/dist/collection/components/casino-challenges-container/casino-challenges-container.js +144 -3
  15. package/dist/collection/utils/locale.utils.js +2 -1
  16. package/dist/collection/utils/types.js +40 -0
  17. package/dist/esm/casino-challenge-card_4.entry.js +564 -0
  18. package/dist/esm/{casino-challenges-container-affc90f5.js → casino-challenges-container-b776a245.js} +68 -6
  19. package/dist/esm/casino-challenges-container.js +3 -3
  20. package/dist/esm/{index-9c823353.js → index-c7b24115.js} +37 -6
  21. package/dist/esm/index.js +2 -2
  22. package/dist/esm/loader.js +3 -3
  23. package/dist/types/components/casino-challenges-container/casino-challenges-container.d.ts +30 -0
  24. package/dist/types/components.d.ts +32 -0
  25. package/dist/types/utils/types.d.ts +130 -0
  26. package/package.json +1 -1
  27. package/dist/casino-challenges-container/casino-challenges-container-affc90f5.js +0 -1
  28. package/dist/casino-challenges-container/casino-challenges-container.entry.js +0 -1
  29. package/dist/casino-challenges-container/index-9c823353.js +0 -2
  30. package/dist/cjs/casino-challenges-container.cjs.entry.js +0 -10
  31. package/dist/esm/casino-challenges-container.entry.js +0 -2
@@ -0,0 +1,564 @@
1
+ import { r as registerInstance, c as createEvent, h, g as getElement, H as Host } from './index-c7b24115.js';
2
+ import { s as setClientStyling, a as setClientStylingURL, b as setStreamStyling } from './casino-challenges-container-b776a245.js';
3
+ export { C as casino_challenges_container } from './casino-challenges-container-b776a245.js';
4
+
5
+ const DEFAULT_LANGUAGE = 'en';
6
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
7
+ const TRANSLATIONS = {
8
+ en: {
9
+ totalLevels: 'Total levels:',
10
+ level1: 'Level 1:',
11
+ get: 'Get:',
12
+ endsIn: 'Ends In',
13
+ expired: 'Expired',
14
+ viewDetails: 'View details',
15
+ placeBetsOf: 'Place bets of',
16
+ place: 'Place',
17
+ bet: 'bet',
18
+ bets: 'bets',
19
+ minBet: 'min bet'
20
+ },
21
+ ro: {
22
+ totalLevels: 'Niveluri totale:',
23
+ level1: 'Nivel 1:',
24
+ get: 'Obține:',
25
+ endsIn: 'Se termină în',
26
+ expired: 'Expirat',
27
+ viewDetails: 'Vezi detalii',
28
+ placeBetsOf: 'Plasează pariuri de',
29
+ place: 'Plasare',
30
+ bet: 'pariu',
31
+ bets: 'pariuri',
32
+ minBet: 'pariu minim'
33
+ },
34
+ fr: {
35
+ totalLevels: 'Niveaux totaux :',
36
+ level1: 'Niveau 1 :',
37
+ get: 'Obtenir :',
38
+ endsIn: 'Se termine dans',
39
+ expired: 'Expiré',
40
+ viewDetails: 'Voir les détails',
41
+ placeBetsOf: 'Placez des paris de',
42
+ place: 'Placer',
43
+ bet: 'pari',
44
+ bets: 'paris',
45
+ minBet: 'mise minimale'
46
+ },
47
+ ar: {
48
+ totalLevels: 'إجمالي المستويات:',
49
+ level1: 'المستوى 1:',
50
+ get: 'احصل على:',
51
+ endsIn: 'ينتهي في',
52
+ expired: 'منتهي الصلاحية',
53
+ viewDetails: 'عرض التفاصيل',
54
+ placeBetsOf: 'قم بوضع رهانات بقيمة',
55
+ place: 'ضع',
56
+ bet: 'رهان',
57
+ bets: 'رهانات',
58
+ minBet: 'الحد الأدنى للرهان'
59
+ },
60
+ hr: {
61
+ totalLevels: 'Ukupno razina:',
62
+ level1: 'Razina 1:',
63
+ get: 'Dobiti:',
64
+ endsIn: 'Završava za',
65
+ expired: 'Isteklo',
66
+ viewDetails: 'Pogledaj detalje',
67
+ placeBetsOf: 'Postavite oklade od',
68
+ place: 'Postavi',
69
+ bet: 'kladnja',
70
+ bets: 'kladnje',
71
+ minBet: 'minimalna oklada'
72
+ }
73
+ };
74
+ const translate = (key, customLang) => {
75
+ const lang = customLang;
76
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
77
+ };
78
+ const getTranslations = (data) => {
79
+ Object.keys(data).forEach((item) => {
80
+ for (let key in data[item]) {
81
+ TRANSLATIONS[item][key] = data[item][key];
82
+ }
83
+ });
84
+ };
85
+ const resolveTranslationUrl = async (translationUrl) => {
86
+ if (translationUrl) {
87
+ try {
88
+ const response = await fetch(translationUrl);
89
+ if (!response.ok) {
90
+ throw new Error(`HTTP error! status: ${response.status}`);
91
+ }
92
+ const translations = await response.json();
93
+ getTranslations(translations);
94
+ }
95
+ catch (error) {
96
+ console.error('Failed to fetch or parse translations from URL:', error);
97
+ }
98
+ }
99
+ };
100
+
101
+ var EChallengeLevelTargetType;
102
+ (function (EChallengeLevelTargetType) {
103
+ EChallengeLevelTargetType[EChallengeLevelTargetType["Accumulative"] = 0] = "Accumulative";
104
+ EChallengeLevelTargetType[EChallengeLevelTargetType["SingleBet"] = 1] = "SingleBet";
105
+ EChallengeLevelTargetType[EChallengeLevelTargetType["MultipleOneBetSize"] = 2] = "MultipleOneBetSize";
106
+ })(EChallengeLevelTargetType || (EChallengeLevelTargetType = {}));
107
+ var EChallengeRecurrenceType;
108
+ (function (EChallengeRecurrenceType) {
109
+ EChallengeRecurrenceType[EChallengeRecurrenceType["Single"] = 0] = "Single";
110
+ EChallengeRecurrenceType[EChallengeRecurrenceType["Daily"] = 1] = "Daily";
111
+ EChallengeRecurrenceType[EChallengeRecurrenceType["Weekly"] = 2] = "Weekly";
112
+ EChallengeRecurrenceType[EChallengeRecurrenceType["Monthly"] = 3] = "Monthly";
113
+ })(EChallengeRecurrenceType || (EChallengeRecurrenceType = {}));
114
+ var EChallengeRewardType;
115
+ (function (EChallengeRewardType) {
116
+ EChallengeRewardType[EChallengeRewardType["FreeSpins"] = 0] = "FreeSpins";
117
+ EChallengeRewardType[EChallengeRewardType["LuckyWheel"] = 1] = "LuckyWheel";
118
+ EChallengeRewardType[EChallengeRewardType["Leaderboard"] = 2] = "Leaderboard";
119
+ EChallengeRewardType[EChallengeRewardType["Challenge"] = 3] = "Challenge";
120
+ EChallengeRewardType[EChallengeRewardType["Custom"] = 4] = "Custom";
121
+ })(EChallengeRewardType || (EChallengeRewardType = {}));
122
+ var EChallengeStatus;
123
+ (function (EChallengeStatus) {
124
+ EChallengeStatus[EChallengeStatus["Setup"] = 0] = "Setup";
125
+ EChallengeStatus[EChallengeStatus["Active"] = 1] = "Active";
126
+ EChallengeStatus[EChallengeStatus["Paused"] = 2] = "Paused";
127
+ EChallengeStatus[EChallengeStatus["Closed"] = 3] = "Closed";
128
+ EChallengeStatus[EChallengeStatus["Deleted"] = 4] = "Deleted";
129
+ })(EChallengeStatus || (EChallengeStatus = {}));
130
+ var EChallengeTriggerType;
131
+ (function (EChallengeTriggerType) {
132
+ EChallengeTriggerType[EChallengeTriggerType["GameLaunch"] = 0] = "GameLaunch";
133
+ EChallengeTriggerType[EChallengeTriggerType["Reward"] = 1] = "Reward";
134
+ EChallengeTriggerType[EChallengeTriggerType["Manual"] = 2] = "Manual";
135
+ })(EChallengeTriggerType || (EChallengeTriggerType = {}));
136
+ var EChallengeValidityType;
137
+ (function (EChallengeValidityType) {
138
+ EChallengeValidityType[EChallengeValidityType["Period"] = 0] = "Period";
139
+ EChallengeValidityType[EChallengeValidityType["Date"] = 1] = "Date";
140
+ })(EChallengeValidityType || (EChallengeValidityType = {}));
141
+
142
+ function getTimeLeft(endTime) {
143
+ const now = new Date();
144
+ const end = new Date(endTime);
145
+ let diff = end.getTime() - now.getTime();
146
+ if (diff <= 0) {
147
+ return;
148
+ }
149
+ const days = Math.floor(diff / (1000 * 60 * 60 * 24));
150
+ diff -= days * (1000 * 60 * 60 * 24);
151
+ const hours = Math.floor(diff / (1000 * 60 * 60));
152
+ diff -= hours * (1000 * 60 * 60);
153
+ const minutes = Math.floor(diff / (1000 * 60));
154
+ diff -= minutes * (1000 * 60);
155
+ const seconds = Math.floor(diff / 1000);
156
+ const pad = (n) => n.toString().padStart(2, '0');
157
+ return `${pad(days)} : ${pad(hours)} : ${pad(minutes)} : ${pad(seconds)}`;
158
+ }
159
+
160
+ const casinoChallengeCardCss = ".card {\n width: 308px;\n border-radius: 16px;\n border: 2px solid var(--emw--button-border-color, rgba(221, 255, 207, 0.1019607843));\n background-color: var(--emw--color-background, #141515);\n box-sizing: border-box;\n position: relative;\n}\n@container challenge-list (max-width: 576px) {\n .card {\n width: 100%;\n }\n}\n.card:hover {\n background: linear-gradient(90deg, rgb(0, 62, 92) 0%, rgb(17, 59, 33) 100%);\n cursor: pointer;\n}\n.card__image {\n width: 100%;\n height: 200px;\n border-radius: 16px 16px 0 0;\n}\n@container challenge-list (max-width: 576px) {\n .card__image {\n height: 224px;\n }\n}\n.card__title {\n color: var(--emw--color-white, #FFFFFF);\n font-size: var(--emw--font-size-medium, 16px);\n margin: 0 0 10px;\n}\n.card__content {\n padding: 20px;\n}\n.card__button {\n margin-top: 20px;\n width: 100%;\n height: 34px;\n background: transparent;\n text-transform: uppercase;\n border-radius: var(--emw--button-border-radius, 99px);\n border: 2px solid var(--emw--button-border-color, #727672);\n font-size: var(--emw--font-size-x-small, 12px);\n font-weight: var(--emw--font-weight-bold, 700);\n color: var(--emw--color-secondary, #e9931e);\n}\n.card__button:hover {\n border-color: var(--emw--color-secondary, #e9931e);\n cursor: pointer;\n}\n.card__badge {\n position: absolute;\n background: white;\n top: 6px;\n right: 6px;\n border-radius: 30px;\n padding: 2px 12px;\n line-height: 22px;\n font-weight: var(--emw--font-weight-medium, 500);\n font-size: var(--emw--font-size-x-small, 12px);\n box-shadow: 0 4px 4px 0 rgba(0, 0, 0, 0.25);\n backdrop-filter: blur(20px);\n}\n.card__badge span {\n font-weight: var(--emw--font-weight-bold, 700);\n}\n\n.info-item {\n line-height: 24px;\n font-size: var(--emw--font-size-small, 14px);\n font-weight: var(--emw--font-weight-bold, 700);\n color: var(--emw--color-primary, #1dbf51);\n}\n@container challenge-list (min-width: 576px) {\n .info-item {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n vertical-align: bottom;\n }\n}\n.info-item__label {\n font-weight: var(--emw--font-weight-medium, 500);\n margin-right: 3px;\n color: var(--emw--color-gray-150, #C8D6CE);\n}\n.info-item__tooltip {\n position: absolute;\n line-height: 22px;\n padding: 8px 12px;\n border-radius: 8px;\n opacity: 1;\n z-index: 200;\n white-space: nowrap;\n font-size: var(--emw--font-size-x-small, 12px);\n font-weight: var(--emw--font-weight-medium, 500);\n color: var(--emw--color-white, #FFFFFF);\n background-color: var(--emw--color-background-secondary, #1B1C2B);\n}\n.info-item__tooltip::before {\n content: \"\";\n position: absolute;\n top: -5px;\n left: 50%;\n transform: translateX(-50%);\n border-left: 6px solid transparent;\n border-right: 6px solid transparent;\n border-bottom: 6px solid var(--emw--color-background-secondary, #1B1C2B);\n width: 0;\n height: 0;\n z-index: 201;\n}";
161
+ const CasinoChallengeCardStyle0 = casinoChallengeCardCss;
162
+
163
+ const CasinoChallengeCard = class {
164
+ constructor(hostRef) {
165
+ registerInstance(this, hostRef);
166
+ this.timerExpired = createEvent(this, "timerExpired", 7);
167
+ this.calculateTargetValue = (level, currencySymbol) => {
168
+ var _a;
169
+ if (!level)
170
+ return '';
171
+ const minbet = ((_a = level.BetRange) === null || _a === void 0 ? void 0 : _a.MinBet)
172
+ ? `, ${translate('minBet', this.language)} ${currencySymbol + level.BetRange.MinBet}`
173
+ : '';
174
+ switch (level.LevelTargetType) {
175
+ case EChallengeLevelTargetType.Accumulative:
176
+ return `${translate('placeBetsOf', this.language)} ${currencySymbol + level.DisplayCurrencyTargetTurnover + minbet}`;
177
+ case EChallengeLevelTargetType.SingleBet:
178
+ return `${translate('place', this.language)} ${currencySymbol + level.TargetTurnover} ${translate('bet', this.language)}`;
179
+ case EChallengeLevelTargetType.MultipleOneBetSize:
180
+ return `${translate('place', this.language)} ${level.TargetBetCount} ${translate('bets', this.language) + minbet}`;
181
+ }
182
+ };
183
+ this.onMouseEnterHandler = (index, el) => {
184
+ if (el.scrollWidth > el.clientWidth) {
185
+ this.tooltipIndex = index;
186
+ }
187
+ };
188
+ this.onMouseLeaveHandler = () => {
189
+ this.tooltipIndex = null;
190
+ };
191
+ this.mbSource = undefined;
192
+ this.clientStyling = undefined;
193
+ this.clientStylingUrl = undefined;
194
+ this.translationUrl = '';
195
+ this.language = 'en';
196
+ this.challenge = undefined;
197
+ this.tooltipIndex = null;
198
+ this.timeLeft = undefined;
199
+ }
200
+ get infoItems() {
201
+ var _a, _b, _c, _d;
202
+ const level1 = (_a = this.challenge) === null || _a === void 0 ? void 0 : _a.LevelProgresses.find((x) => x.OrderNumber === 0);
203
+ if (level1) {
204
+ const rewardValue = (_b = level1.Rewards) === null || _b === void 0 ? void 0 : _b.slice(0, 2).map((r) => r.RewardDescription).join(' + ');
205
+ return [
206
+ {
207
+ lable: translate('totalLevels', this.language),
208
+ value: (_c = this.challenge.LevelProgresses) === null || _c === void 0 ? void 0 : _c.length
209
+ },
210
+ {
211
+ lable: translate('level1', this.language),
212
+ value: this.calculateTargetValue(level1, (_d = this.challenge) === null || _d === void 0 ? void 0 : _d.CurrencySymbol)
213
+ },
214
+ {
215
+ lable: translate('get', this.language),
216
+ value: rewardValue
217
+ }
218
+ ];
219
+ }
220
+ return [];
221
+ }
222
+ handleClientStylingChange(newValue, oldValue) {
223
+ if (newValue != oldValue) {
224
+ setClientStyling(this.stylingContainer, this.clientStyling);
225
+ }
226
+ }
227
+ handleClientStylingUrlChange(newValue, oldValue) {
228
+ if (newValue != oldValue) {
229
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
230
+ }
231
+ }
232
+ handleMbSourceChange(newValue, oldValue) {
233
+ if (newValue != oldValue) {
234
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
235
+ }
236
+ }
237
+ connectedCallback() {
238
+ this.timerId = setInterval(() => {
239
+ this.updateTime();
240
+ }, 1000);
241
+ }
242
+ componentWillLoad() {
243
+ if (this.translationUrl) {
244
+ resolveTranslationUrl(this.translationUrl);
245
+ }
246
+ this.updateTime();
247
+ }
248
+ componentDidLoad() {
249
+ if (this.stylingContainer) {
250
+ if (this.mbSource)
251
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
252
+ if (this.clientStyling)
253
+ setClientStyling(this.stylingContainer, this.clientStyling);
254
+ if (this.clientStylingUrl)
255
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
256
+ }
257
+ }
258
+ disconnectedCallback() {
259
+ if (this.stylingSubscription) {
260
+ this.stylingSubscription.unsubscribe();
261
+ }
262
+ clearInterval(this.timerId);
263
+ }
264
+ updateTime() {
265
+ var _a;
266
+ this.timeLeft = getTimeLeft((_a = this.challenge) === null || _a === void 0 ? void 0 : _a.ExpirationTime);
267
+ if (!this.timeLeft && this.timerExpired) {
268
+ clearInterval(this.timerId);
269
+ this.timerExpired.emit(this.challenge.Id);
270
+ }
271
+ }
272
+ renderInfoItem(item, index) {
273
+ return (h("div", { class: "info-item", onMouseEnter: (e) => this.onMouseEnterHandler(index, e.currentTarget), onMouseLeave: this.onMouseLeaveHandler }, h("span", { class: "info-item__label" }, item.lable), item.value, this.tooltipIndex === index && h("div", { class: "info-item__tooltip" }, item.value)));
274
+ }
275
+ renderCardBadge() {
276
+ return (h("div", { class: "card__badge" }, this.timeLeft
277
+ ? [translate('endsIn', this.language), ' - ', h("span", null, this.timeLeft)]
278
+ : translate('expired', this.language)));
279
+ }
280
+ render() {
281
+ var _a, _b, _c, _d;
282
+ return (h("div", { key: '5df3a2d368e6057d1b47cf5d4766126406c4afc8', ref: (el) => (this.stylingContainer = el) }, h("div", { key: 'de708f82c0fbe5324419fafcb395f115c020d021', class: "card" }, h("img", { key: '209c1f05bb70c3182b4ff6211e7c9398999b30fc', class: "card__image", src: (_b = (_a = this.challenge) === null || _a === void 0 ? void 0 : _a.ChallengePresentation) === null || _b === void 0 ? void 0 : _b.Url }), this.renderCardBadge(), h("div", { key: 'aa3a5f3eee8bdb7c2606bc8a232c441ff4a22006', class: "card__content" }, h("h1", { key: '524933e67d8eac476d678aee9f2643b6ac1449ff', class: "card__title" }, (_d = (_c = this.challenge) === null || _c === void 0 ? void 0 : _c.ChallengePresentation) === null || _d === void 0 ? void 0 : _d.PresentationName), this.infoItems.map((x, index) => this.renderInfoItem(x, index)), h("button", { key: '52fec7d22602a2757c1a36238fb0b797f6bb4306', class: "card__button" }, translate('viewDetails', this.language))))));
283
+ }
284
+ static get watchers() { return {
285
+ "clientStyling": ["handleClientStylingChange"],
286
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
287
+ "mbSource": ["handleMbSourceChange"]
288
+ }; }
289
+ };
290
+ CasinoChallengeCard.style = CasinoChallengeCardStyle0;
291
+
292
+ const casinoChallengesListCss = ".challenges-list {\n display: flex;\n flex-wrap: wrap;\n gap: 30px;\n width: 100%;\n}\n\n.loader {\n width: 308px;\n border-radius: 16px;\n border: 2px solid var(--emw--button-border-color, rgba(221, 255, 207, 0.1019607843));\n background-color: var(--emw--color-background, #141515);\n box-sizing: border-box;\n position: relative;\n}\n@container challenge-list (max-width: 576px) {\n .loader {\n width: 100%;\n }\n}\n.loader:hover {\n background: linear-gradient(90deg, rgb(0, 62, 92) 0%, rgb(17, 59, 33) 100%);\n cursor: pointer;\n}\n.loader .SkeletonRows .SkeletonContainer {\n padding: 0 20px 0 20px;\n}\n.loader .SkeletonButton .Skeleton.Text {\n margin: 0;\n height: 28px;\n margin: 0 20px 20px 20px;\n border-radius: var(--emw--button-border-radius, 99px);\n width: auto;\n}\n.loader .Skeleton.Image {\n border-radius: 16px 16px 0 0;\n}\n.loader .Skeleton.Text {\n margin: 20px 0;\n}";
293
+ const CasinoChallengesListStyle0 = casinoChallengesListCss;
294
+
295
+ const skeletons = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
296
+ const CasinoChallengeList = class {
297
+ constructor(hostRef) {
298
+ registerInstance(this, hostRef);
299
+ this.loadMore = createEvent(this, "loadMore", 7);
300
+ this.timerExpired = createEvent(this, "timerExpired", 7);
301
+ this.setLastItemRef = (el) => {
302
+ if (this.lastItemRef && this.observer) {
303
+ this.observer.unobserve(this.lastItemRef);
304
+ }
305
+ this.lastItemRef = el;
306
+ if (el && this.observer && !this.loading) {
307
+ this.observer.observe(el);
308
+ }
309
+ };
310
+ this.mbSource = undefined;
311
+ this.clientStyling = undefined;
312
+ this.clientStylingUrl = undefined;
313
+ this.language = 'en';
314
+ this.translationUrl = undefined;
315
+ this.challenges = [];
316
+ this.loading = false;
317
+ this.hasMore = false;
318
+ }
319
+ handleClientStylingChange(newValue, oldValue) {
320
+ if (newValue != oldValue) {
321
+ setClientStyling(this.stylingContainer, this.clientStyling);
322
+ }
323
+ }
324
+ handleClientStylingUrlChange(newValue, oldValue) {
325
+ if (newValue != oldValue) {
326
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
327
+ }
328
+ }
329
+ handleMbSourceChange(newValue, oldValue) {
330
+ if (newValue != oldValue) {
331
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
332
+ }
333
+ }
334
+ setupObserver() {
335
+ if (!this.lastItemRef || this.loading || !this.hasMore)
336
+ return;
337
+ if (!this.observer) {
338
+ this.observer = new IntersectionObserver(([entry]) => {
339
+ if (entry.isIntersecting && !this.loading && this.hasMore) {
340
+ this.observer.unobserve(entry.target);
341
+ this.loadMore.emit();
342
+ }
343
+ }, {
344
+ root: null,
345
+ rootMargin: '0px',
346
+ threshold: 0.1
347
+ });
348
+ }
349
+ this.observer.disconnect();
350
+ this.observer.observe(this.lastItemRef);
351
+ }
352
+ componentDidRender() {
353
+ this.setupObserver();
354
+ }
355
+ disconnectedCallback() {
356
+ var _a;
357
+ (_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
358
+ this.observer = undefined;
359
+ }
360
+ componentDidLoad() {
361
+ if (this.stylingContainer) {
362
+ if (this.mbSource)
363
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
364
+ if (this.clientStyling)
365
+ setClientStyling(this.stylingContainer, this.clientStyling);
366
+ if (this.clientStylingUrl)
367
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
368
+ }
369
+ }
370
+ renderSkeletons() {
371
+ return skeletons.map((skeleton) => (h("div", { class: "loader", key: skeleton }, h("ui-skeleton", { structure: "image", height: "200px", "border-radius": "16px 16px 0 0" }), h("ui-skeleton", { class: "SkeletonRows", structure: "text", width: "220px", height: "16px", rows: "3" }), h("ui-skeleton", { class: "SkeletonButton", structure: "text", width: "100%" }))));
372
+ }
373
+ onTimerExpired(e) {
374
+ if (this.timerExpired) {
375
+ this.timerExpired.emit(e.detail);
376
+ }
377
+ }
378
+ render() {
379
+ return (h("div", { key: 'c2dc103d0aa9777b8b79bd8e787985a69f2e2457', ref: (el) => (this.stylingContainer = el), class: "challenges-list" }, this.challenges.map((challenge, index) => (h("div", { key: challenge.Id, ref: index === this.challenges.length - 1 ? this.setLastItemRef : null }, h("casino-challenge-card", { challenge: challenge, language: this.language, mbSource: this.mbSource, clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl, translationUrl: this.translationUrl, onTimerExpired: this.onTimerExpired })))), this.loading && this.renderSkeletons()));
380
+ }
381
+ get el() { return getElement(this); }
382
+ static get watchers() { return {
383
+ "clientStyling": ["handleClientStylingChange"],
384
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
385
+ "mbSource": ["handleMbSourceChange"]
386
+ }; }
387
+ };
388
+ CasinoChallengeList.style = CasinoChallengesListStyle0;
389
+
390
+ const uiSkeletonCss = ":host{display:block}.Skeleton{animation:skeleton-loading 1s linear infinite alternate}.Rectangle{background-color:var(--emw-skeleton-rectangle-background, #c2c2c2);width:var(--emw-skeleton-rectangle-width, 400px);height:var(--emw-skeleton-rectangle-height, 200px);border-radius:var(--emw-skeleton-rectangle-border-radius, 10px)}.Circle{background-color:var(--emw-skeleton-circle-background, #c2c2c2);width:var(--emw-skeleton-circle-size, 400px);height:var(--emw-skeleton-circle-size, 400px);border-radius:50%}.Text{background-color:var(--emw-skeleton-text-background, #c2c2c2);width:var(--emw-skeleton-text-width, 500px);height:var(--emw-skeleton-text-height, 20px);border-radius:var(--emw-skeleton-text-border-radius, 10px);margin-bottom:var(--emw-skeleton-text-margin-bottom, 5px)}.Text:last-child{width:calc(var(--emw-skeleton-text-width, 400px) - 100px)}.Title{background-color:var(--emw-skeleton-title-background, #c2c2c2);width:var(--emw-skeleton-title-width, 300px);height:var(--emw-skeleton-title-height, 30px);border-radius:var(--emw-skeleton-title-border-radius, 10px);margin-bottom:var(--emw-skeleton-title-margin-bottom, 5px)}.Image{background-color:var(--emw-skeleton-image-background, #c2c2c2);width:var(--emw-skeleton-image-width, 100%);height:var(--emw-skeleton-image-height, 100%);border-radius:var(--emw-skeleton-image-border-radius, unset)}.Logo{background-color:var(--emw-skeleton-logo-background, #c2c2c2);width:var(--emw-skeleton-logo-width, 120px);height:var(--emw-skeleton-logo-height, 75px);border-radius:var(--emw-skeleton-logo-border-radius, 10px)}@keyframes skeleton-loading{0%{background-color:var(--emw-skeleton-primary-color, #e0e0e0)}100%{background-color:var(--emw-skeleton-secondary-color, #f0f0f0)}}";
391
+ const UiSkeletonStyle0 = uiSkeletonCss;
392
+
393
+ const UiSkeleton = class {
394
+ constructor(hostRef) {
395
+ registerInstance(this, hostRef);
396
+ this.stylingValue = {
397
+ width: this.handleStylingProps(this.width),
398
+ height: this.handleStylingProps(this.height),
399
+ borderRadius: this.handleStylingProps(this.borderRadius),
400
+ marginBottom: this.handleStylingProps(this.marginBottom),
401
+ marginTop: this.handleStylingProps(this.marginTop),
402
+ marginLeft: this.handleStylingProps(this.marginLeft),
403
+ marginRight: this.handleStylingProps(this.marginRight),
404
+ size: this.handleStylingProps(this.size)
405
+ };
406
+ this.structure = undefined;
407
+ this.width = 'unset';
408
+ this.height = 'unset';
409
+ this.borderRadius = 'unset';
410
+ this.marginBottom = 'unset';
411
+ this.marginTop = 'unset';
412
+ this.marginLeft = 'unset';
413
+ this.marginRight = 'unset';
414
+ this.animation = true;
415
+ this.rows = 0;
416
+ this.size = '100%';
417
+ }
418
+ handleStructureChange(newValue, oldValue) {
419
+ if (oldValue !== newValue) {
420
+ this.handleStructure(newValue);
421
+ }
422
+ }
423
+ handleStylingProps(value) {
424
+ switch (typeof value) {
425
+ case 'number':
426
+ return value === 0 ? 0 : `${value}px`;
427
+ case 'undefined':
428
+ return 'unset';
429
+ case 'string':
430
+ if (['auto', 'unset', 'none', 'inherit', 'initial'].includes(value) ||
431
+ value.endsWith('px') ||
432
+ value.endsWith('%')) {
433
+ return value;
434
+ }
435
+ else {
436
+ return 'unset';
437
+ }
438
+ default:
439
+ return 'unset';
440
+ }
441
+ }
442
+ handleStructure(structure) {
443
+ switch (structure) {
444
+ case 'logo':
445
+ return this.renderLogo();
446
+ case 'image':
447
+ return this.renderImage();
448
+ case 'title':
449
+ return this.renderTitle();
450
+ case 'text':
451
+ return this.renderText();
452
+ case 'rectangle':
453
+ return this.renderRectangle();
454
+ case 'circle':
455
+ return this.renderCircle();
456
+ default:
457
+ return null;
458
+ }
459
+ }
460
+ renderLogo() {
461
+ return (h("div", { class: "SkeletonContainer" }, h("div", { class: 'Logo ' + (this.animation ? 'Skeleton' : '') })));
462
+ }
463
+ renderImage() {
464
+ return h("div", { class: 'Image ' + (this.animation ? 'Skeleton' : '') });
465
+ }
466
+ renderTitle() {
467
+ return (h("div", { class: "SkeletonContainer" }, h("div", { class: 'Title ' + (this.animation ? 'Skeleton' : '') })));
468
+ }
469
+ renderText() {
470
+ return (h("div", { class: "SkeletonContainer" }, Array.from({ length: this.rows > 0 ? this.rows : 1 }).map((_, index) => (h("div", { key: index, class: 'Text ' + (this.animation ? 'Skeleton' : '') })))));
471
+ }
472
+ renderRectangle() {
473
+ return (h("div", { class: "SkeletonContainer" }, h("div", { class: 'Rectangle ' + (this.animation ? 'Skeleton' : '') })));
474
+ }
475
+ renderCircle() {
476
+ return (h("div", { class: "SkeletonContainer" }, h("div", { class: 'Circle ' + (this.animation ? 'Skeleton' : '') })));
477
+ }
478
+ render() {
479
+ let styleBlock = '';
480
+ switch (this.structure) {
481
+ case 'logo':
482
+ styleBlock = `
483
+ :host {
484
+ --emw-skeleton-logo-width: ${this.stylingValue.width};
485
+ --emw-skeleton-logo-height: ${this.stylingValue.height};
486
+ --emw-skeleton-logo-border-radius: ${this.stylingValue.borderRadius};
487
+ --emw-skeleton-logo-margin-bottom: ${this.stylingValue.marginBottom};
488
+ --emw-skeleton-logo-margin-top: ${this.stylingValue.marginTop};
489
+ --emw-skeleton-logo-margin-left: ${this.stylingValue.marginLeft};
490
+ --emw-skeleton-logo-margin-right: ${this.stylingValue.marginRight};
491
+ }
492
+ `;
493
+ break;
494
+ case 'image':
495
+ styleBlock = `
496
+ :host {
497
+ --emw-skeleton-image-width: ${this.stylingValue.width};
498
+ --emw-skeleton-image-height: ${this.stylingValue.height};
499
+ --emw-skeleton-image-border-radius: ${this.stylingValue.borderRadius};
500
+ --emw-skeleton-image-margin-bottom: ${this.stylingValue.marginBottom};
501
+ --emw-skeleton-image-margin-top: ${this.stylingValue.marginTop};
502
+ --emw-skeleton-image-margin-left: ${this.stylingValue.marginLeft};
503
+ --emw-skeleton-image-margin-right: ${this.stylingValue.marginRight};
504
+ }
505
+ `;
506
+ break;
507
+ case 'title':
508
+ styleBlock = `
509
+ :host {
510
+ --emw-skeleton-title-width: ${this.stylingValue.width};
511
+ --emw-skeleton-title-height: ${this.stylingValue.height};
512
+ --emw-skeleton-title-border-radius: ${this.stylingValue.borderRadius};
513
+ --emw-skeleton-title-margin-bottom: ${this.stylingValue.marginBottom};
514
+ --emw-skeleton-title-margin-top: ${this.stylingValue.marginTop};
515
+ --emw-skeleton-title-margin-left: ${this.stylingValue.marginLeft};
516
+ --emw-skeleton-title-margin-right: ${this.stylingValue.marginRight};
517
+ }
518
+ `;
519
+ break;
520
+ case 'text':
521
+ styleBlock = `
522
+ :host {
523
+ --emw-skeleton-text-width: ${this.stylingValue.width};
524
+ --emw-skeleton-text-height: ${this.stylingValue.height};
525
+ --emw-skeleton-text-border-radius: ${this.stylingValue.borderRadius};
526
+ --emw-skeleton-text-margin-bottom: ${this.stylingValue.marginBottom};
527
+ --emw-skeleton-text-margin-top: ${this.stylingValue.marginTop};
528
+ --emw-skeleton-text-margin-left: ${this.stylingValue.marginLeft};
529
+ --emw-skeleton-text-margin-right: ${this.stylingValue.marginRight};
530
+ }
531
+ `;
532
+ break;
533
+ case 'rectangle':
534
+ styleBlock = `
535
+ :host {
536
+ --emw-skeleton-rectangle-width: ${this.stylingValue.width};
537
+ --emw-skeleton-rectangle-height: ${this.stylingValue.height};
538
+ --emw-skeleton-rectangle-border-radius: ${this.stylingValue.borderRadius};
539
+ --emw-skeleton-rectangle-margin-bottom: ${this.stylingValue.marginBottom};
540
+ --emw-skeleton-rectangle-margin-top: ${this.stylingValue.marginTop};
541
+ --emw-skeleton-rectangle-margin-left: ${this.stylingValue.marginLeft};
542
+ --emw-skeleton-rectangle-margin-right: ${this.stylingValue.marginRight};
543
+ }
544
+ `;
545
+ break;
546
+ case 'circle':
547
+ styleBlock = `
548
+ :host {
549
+ --emw-skeleton-circle-size: ${this.stylingValue.size};
550
+ }
551
+ `;
552
+ break;
553
+ default:
554
+ styleBlock = '';
555
+ }
556
+ return (h(Host, { key: 'e6b885bfd985ce7663d990756fe9101e25eb97f0' }, h("style", { key: '06ae24c7bb74f4dacfc12ae58085333f9dc89da5' }, styleBlock), this.handleStructure(this.structure)));
557
+ }
558
+ static get watchers() { return {
559
+ "structure": ["handleStructureChange"]
560
+ }; }
561
+ };
562
+ UiSkeleton.style = UiSkeletonStyle0;
563
+
564
+ export { CasinoChallengeCard as casino_challenge_card, CasinoChallengeList as casino_challenges_list, UiSkeleton as ui_skeleton };