@everymatrix/bonus-elevate-shop-item 1.94.52 → 1.94.53

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 (22) hide show
  1. package/dist/bonus-elevate-shop-item/bonus-elevate-shop-assets-slider_5.entry.js +1 -0
  2. package/dist/bonus-elevate-shop-item/bonus-elevate-shop-item.esm.js +1 -1
  3. package/dist/cjs/bonus-elevate-shop-assets-slider_5.cjs.entry.js +918 -0
  4. package/dist/cjs/bonus-elevate-shop-item.cjs.js +1 -1
  5. package/dist/cjs/index-ad2fddb6.js +2 -2
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/collection/collection-manifest.json +12 -0
  8. package/dist/collection/components/bonus-elevate-shop-item/bonus-elevate-shop-assets-slider.js +5 -5
  9. package/dist/collection/components/bonus-elevate-shop-item/bonus-elevate-shop-item.css +92 -1
  10. package/dist/collection/components/bonus-elevate-shop-item/bonus-elevate-shop-item.js +85 -4
  11. package/dist/collection/utils/locale.utils.js +1 -0
  12. package/dist/esm/bonus-elevate-shop-assets-slider_5.entry.js +910 -0
  13. package/dist/esm/bonus-elevate-shop-item.js +1 -1
  14. package/dist/esm/index-fca048d8.js +2 -2
  15. package/dist/esm/loader.js +1 -1
  16. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/bonus-elevate-shop-item/.stencil/libs/common/src/types/casino/tournaments.d.ts +111 -0
  17. package/dist/types/components/bonus-elevate-shop-item/bonus-elevate-shop-item.d.ts +11 -0
  18. package/dist/types/models/bonus-elevate-shop-item.d.ts +1 -0
  19. package/package.json +1 -1
  20. package/dist/bonus-elevate-shop-item/bonus-elevate-shop-assets-slider_3.entry.js +0 -1
  21. package/dist/cjs/bonus-elevate-shop-assets-slider_3.cjs.entry.js +0 -600
  22. package/dist/esm/bonus-elevate-shop-assets-slider_3.entry.js +0 -594
@@ -0,0 +1,918 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-ad2fddb6.js');
6
+
7
+ const BonusElevateShopAssetsSlider = class {
8
+ constructor(hostRef) {
9
+ index.registerInstance(this, hostRef);
10
+ this.xDown = null;
11
+ this.yDown = null;
12
+ this.orientationChangeHandler = () => {
13
+ setTimeout(() => {
14
+ this.recalculateItemsPerPage();
15
+ }, 10);
16
+ };
17
+ this.resizeHandler = () => {
18
+ this.recalculateItemsPerPage();
19
+ };
20
+ this.showSliderDots = false;
21
+ this.showSliderArrows = true;
22
+ this.itemsPerPage = 1;
23
+ this.sliderItems = [];
24
+ this.activeIndex = 0;
25
+ }
26
+ setActive(index) {
27
+ var _a;
28
+ const maxLength = (_a = this.sliderItems) === null || _a === void 0 ? void 0 : _a.length;
29
+ if (index >= 0) {
30
+ if (index >= maxLength - 1) {
31
+ this.activeIndex = maxLength - 1;
32
+ }
33
+ else {
34
+ this.activeIndex = index;
35
+ }
36
+ }
37
+ else {
38
+ this.activeIndex = 0;
39
+ }
40
+ }
41
+ move(direction) {
42
+ this.setActive(this.activeIndex + direction);
43
+ }
44
+ goTo(index) {
45
+ let diff = this.activeIndex - index;
46
+ if (diff > 0) {
47
+ for (let i = 0; i < diff; i++) {
48
+ this.move(-1);
49
+ }
50
+ }
51
+ else {
52
+ for (let i = 0; i > diff; i--) {
53
+ this.move(1);
54
+ }
55
+ }
56
+ }
57
+ handleTouchStart(evt) {
58
+ const firstTouch = this.getTouches(evt)[0];
59
+ this.xDown = firstTouch.clientX;
60
+ this.yDown = firstTouch.clientY;
61
+ }
62
+ getTouches(evt) {
63
+ return evt.touches || evt.originalEvent.touches;
64
+ }
65
+ handleTouchMove(evt) {
66
+ if (!this.xDown || !this.yDown)
67
+ return;
68
+ let xUp = evt.touches[0].clientX;
69
+ let yUp = evt.touches[0].clientY;
70
+ let xDiff = this.xDown - xUp;
71
+ let yDiff = this.yDown - yUp;
72
+ if (Math.abs(xDiff) > Math.abs(yDiff)) {
73
+ if (xDiff > 0) {
74
+ this.move(1);
75
+ }
76
+ else {
77
+ this.move(-1);
78
+ }
79
+ }
80
+ this.xDown = null;
81
+ this.yDown = null;
82
+ }
83
+ ;
84
+ recalculateItemsPerPage() {
85
+ if (!this.sliderItemsElement)
86
+ return;
87
+ this.itemElementWidth = this.sliderItemsElement.clientWidth;
88
+ this.sliderItemsElementWidth = (this.sliderItems.length - 1) * this.itemElementWidth;
89
+ }
90
+ ;
91
+ renderDots() {
92
+ var _a;
93
+ const dots = [];
94
+ for (let index$1 = 0; index$1 < ((_a = this.sliderItems) === null || _a === void 0 ? void 0 : _a.length) / this.itemsPerPage; index$1++) {
95
+ dots.push(index.h("li", { class: index$1 == this.activeIndex ? 'active' : 'default', onClick: () => { this.goTo(index$1); this.setActive(index$1); } }));
96
+ }
97
+ return dots;
98
+ }
99
+ componentDidRender() {
100
+ this.el.addEventListener('touchstart', this.handleTouchStart.bind(this), { passive: true });
101
+ this.el.addEventListener('touchmove', this.handleTouchMove.bind(this), { passive: true });
102
+ this.recalculateItemsPerPage();
103
+ }
104
+ componentDidUpdate() {
105
+ this.recalculateItemsPerPage();
106
+ }
107
+ connectedCallback() {
108
+ window.screen.orientation.addEventListener('change', this.orientationChangeHandler);
109
+ }
110
+ disconnectedCallback() {
111
+ this.el.removeEventListener('touchstart', this.handleTouchStart);
112
+ this.el.removeEventListener('touchmove', this.handleTouchMove);
113
+ window.screen.orientation.removeEventListener('change', this.orientationChangeHandler);
114
+ window.removeEventListener('resize', this.resizeHandler);
115
+ }
116
+ render() {
117
+ var _a;
118
+ const styles = {
119
+ transform: `translate(${(this.sliderItemsElementWidth / (((_a = this.sliderItems) === null || _a === void 0 ? void 0 : _a.length) - 1) * this.activeIndex) * -1}px, 0px)`
120
+ };
121
+ const itemStyle = {
122
+ width: `${this.itemElementWidth / this.itemsPerPage}px`
123
+ };
124
+ return index.h("div", { key: '740222cee57f5759854860f015dd900c1cb66f80', class: "SliderWrapper" }, index.h("div", { key: '6d8971425bc1fc42bc4e64331b0c5f21d4ed1c40', class: 'MainContent ' }, this.showSliderArrows &&
125
+ index.h("div", { key: '1db77bb5cd7dfb6d5e06a4f42a33ff435f9eb224', class: `SliderNavButton LeftArrow ${this.activeIndex === 0 ? 'DisabledArrow ' : ''} ${this.sliderItems.length === 1 ? 'HiddenArrow ' : ''}`, onClick: () => this.move(-1) }, index.h("svg", { key: 'e406abe6d9d44ab3809322d2f0699ea3ee372b0f', fill: "none", stroke: "var(--emw--color-secondary, #FD2839)", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { key: 'a8ee39ea455a06058466e03755582fbd07391514', "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M15 19l-7-7 7-7" }))), index.h("div", { key: 'a2681048af708d96aa6886db7b6b94639a650a26', class: 'ItemsWrapper', ref: (el) => this.sliderItemsElement = el }, index.h("div", { key: 'be1c762012144756bda71a46302dfe0954bc6add', class: 'Items AssetsItems', style: styles }, this.sliderItems.map((assetUrl) => index.h("img", { class: `img${this.itemsPerPage}`, alt: 'Gift Thumbnails', style: itemStyle, src: assetUrl })))), this.showSliderArrows &&
126
+ index.h("div", { key: '927367a3bbc674cc953eccc3359639381423d0a4', class: `SliderNavButton RightArrow ${this.sliderItems.length === 1 ? 'HiddenArrow ' : ''}
127
+ ${(this.activeIndex === (this.sliderItems.length - 1) || this.itemsPerPage == this.sliderItems.length) ? 'DisabledArrow' : ''}`, onClick: () => this.move(1) }, index.h("svg", { key: 'd84e6e3011f8609f1ded47098bb28333f352f430', fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { key: 'f05768932ee5e8fb74b6b1016612320d0e4ed737', "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M9 5l7 7-7 7" })))), this.showSliderDots && this.sliderItems.length > 1 &&
128
+ index.h("div", { key: 'a08098a90c717ccceda93cd741cb65521a83df9b', class: "DotsWrapper" }, index.h("ul", { key: '8c873c229c603b4aca57e277f74cdf3d2192c01b', class: "Dots" }, this.renderDots())));
129
+ }
130
+ get el() { return index.getElement(this); }
131
+ };
132
+
133
+ const DEFAULT_LANGUAGE = 'en';
134
+ const TRANSLATIONS = {
135
+ en: {
136
+ coins: 'Coins',
137
+ noGiftPresentation: 'No description',
138
+ redeemGift: 'Redeem Gift',
139
+ noDataFound: 'No data found',
140
+ error4003: 'Invalid Session',
141
+ redeemFailed: 'Failed to redeem',
142
+ back: 'Back',
143
+ games: 'Games'
144
+ },
145
+ tr: {
146
+ coins: 'Coin',
147
+ noGiftPresentation: 'Açıklama yok',
148
+ redeemGift: 'Hediye Al',
149
+ noDataFound: 'Veri bulunamadı',
150
+ error4003: 'Geçersiz Oturum',
151
+ redeemFailed: 'Kullanım başarısız',
152
+ back: 'Geri',
153
+ },
154
+ ro: {
155
+ coins: 'Coins',
156
+ noGiftPresentation: 'No description',
157
+ redeemGift: 'Redeem Gift',
158
+ noDataFound: 'No data found',
159
+ error4003: 'Invalid Session',
160
+ redeemFailed: 'Failed to redeem',
161
+ back: 'Back',
162
+ },
163
+ fr: {
164
+ coins: 'Coins',
165
+ noGiftPresentation: 'No description',
166
+ redeemGift: 'Redeem Gift',
167
+ noDataFound: 'No data found',
168
+ error4003: 'Invalid Session',
169
+ redeemFailed: 'Failed to redeem',
170
+ back: 'Back',
171
+ },
172
+ ar: {
173
+ coins: 'Coins',
174
+ noGiftPresentation: 'No description',
175
+ redeemGift: 'Redeem Gift',
176
+ noDataFound: 'No data found',
177
+ error4003: 'Invalid Session',
178
+ redeemFailed: 'Failed to redeem',
179
+ back: 'Back',
180
+ },
181
+ hu: {
182
+ coins: 'Coins',
183
+ noGiftPresentation: 'No description',
184
+ redeemGift: 'Redeem Gift',
185
+ noDataFound: 'No data found',
186
+ error4003: 'Invalid Session',
187
+ redeemFailed: 'Failed to redeem',
188
+ back: 'Back',
189
+ }
190
+ };
191
+ const translate = (key, customLang) => {
192
+ const lang = customLang ? customLang : DEFAULT_LANGUAGE;
193
+ return TRANSLATIONS[lang][key] || TRANSLATIONS[DEFAULT_LANGUAGE][key];
194
+ };
195
+ const getTranslations = (url) => {
196
+ // fetch url, get the data, replace the TRANSLATIONS content
197
+ return new Promise((resolve) => {
198
+ fetch(url)
199
+ .then((res) => res.json())
200
+ .then((data) => {
201
+ Object.keys(data).forEach((item) => {
202
+ TRANSLATIONS[item] = TRANSLATIONS[item] || {};
203
+ for (let key in data[item]) {
204
+ TRANSLATIONS[item][key] = data[item][key];
205
+ }
206
+ });
207
+ resolve(true);
208
+ }).catch((err) => {
209
+ console.error("Failed to load translations:", err);
210
+ resolve(false);
211
+ });
212
+ });
213
+ };
214
+
215
+ /**
216
+ * @name isMobile
217
+ * @description A method that returns if the browser used to access the app is from a mobile device or not
218
+ * @param {String} userAgent window.navigator.userAgent
219
+ * @returns {Boolean} true or false
220
+ */
221
+ const getDevice = () => {
222
+ let userAgent = window.navigator.userAgent;
223
+ if (userAgent.toLowerCase().match(/android/i)) {
224
+ return 'Android';
225
+ }
226
+ if (userAgent.toLowerCase().match(/iphone/i)) {
227
+ return 'iPhone';
228
+ }
229
+ if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
230
+ return 'iPad';
231
+ }
232
+ return 'PC';
233
+ };
234
+ const getDevicePlatform = () => {
235
+ const device = getDevice();
236
+ if (device) {
237
+ if (device === 'PC') {
238
+ return 'dk';
239
+ }
240
+ else if (device === 'iPad' || device === 'iPhone') {
241
+ return 'ios';
242
+ }
243
+ else {
244
+ return 'mtWeb';
245
+ }
246
+ }
247
+ };
248
+
249
+ const bonusElevateShopItemCss = ":host{display:block;--game-amount-per-line:6}.ElevateDetails{display:flex;flex-direction:row;padding:10px;width:calc(100% - 20px);}.ElevateDetails .RedeemError{display:none}.ElevateDetails .Error{color:var(--emw--color-error, #FD2839)}.ElevateDetails .Row{flex-direction:row;display:flex}.ElevateDetails .Col{flex-direction:column;display:flex}.ElevateDetails .Details{padding:20px}.ElevateDetails .ThumbnailRow{display:flex;flex-direction:column;justify-content:space-between;min-width:268px;max-width:398px}.ElevateDetails .ThumbnailRow .BackButton{width:100px;height:20px;padding:5px;background:white;box-shadow:0px 4px 40px 0px rgba(138, 149, 158, 0.2);margin:10px 0 10px;cursor:pointer;animation-timing-function:ease-out;animation-duration:300ms;transition-property:all;border:1px solid #e4e6e8;border-radius:5px;text-align:center}.ElevateDetails .ThumbnailRow .BackButton:hover{background:rgb(227, 222, 222)}.ElevateDetails .ThumbnailRow .Thumbnails{display:flex;flex-direction:column;position:relative;width:calc(100% - 40px)}.ElevateDetails .ShopItemDetail{flex-grow:1;min-width:300px;display:flex;flex-direction:column;justify-content:space-between}.ElevateDetails .GiftPoints .Points{font-size:21px}.ElevateDetails .GiftPoints .PointsLabel{font-size:12px;color:var(--emw--color-gray-300, rgb(78, 90, 55));font-weight:400;line-height:29px;letter-spacing:0.04em;text-align:left}.ElevateDetails .RedeemButton{width:150px;padding:5px 0px;border:2px solid var(--emw--button-border-color, rgba(8, 59, 23, 0.1098039216));text-align:center;color:var(--emw--button-typography, var(--emw--color-white, #FFFFFF));font-size:var(--emw--font-size-small, 12px);font-weight:var(--emw--font-weight-bold, 700);line-height:var(--emw--font-size-medium, 14px);text-transform:uppercase;border-radius:var(--emw--border-radius-medium, 10px)}.ElevateDetails .RedeemButton.active{background:var(--emw--color-primary, #18CE51)}.ElevateDetails .RedeemButton.active:hover{background:var(--mmw--color-main-button-hover, #24B24E)}.ElevateDetails .RedeemButton.deactive,.ElevateDetails .RedeemButton.disabled{background:var(--mmw--color-disabled, rgba(153, 153, 153, 0.5019607843))}.ElevateDetails .SliderWrapper{display:flex;flex-direction:column;position:relative;width:calc(100% - 40px)}.ElevateDetails .SliderWrapper .MainContent{display:flex;flex-direction:row;justify-content:space-around}.ElevateDetails .SliderWrapper .MainContent .LeftArrow,.ElevateDetails .SliderWrapper .MainContent .RightArrow{width:20px}.ElevateDetails .SliderWrapper .MainContent .ItemsWrapper{overflow:hidden;display:inline-flex;width:calc(100% - 40px);flex-direction:column}.ElevateDetails .SliderWrapper .MainContent .ItemsWrapper .Items{display:inline-flex;transition:transform 0.4s ease-in-out;transform:translateX(0px);margin:auto}.ElevateDetails .SliderWrapper .MainContent .ItemsWrapper img.img2{width:50%}.ElevateDetails .SliderWrapper .MainContent .ItemsWrapper img.img3{width:30%}.ElevateDetails .SliderWrapper .MainContent .ItemsWrapper img,.ElevateDetails .SliderWrapper .MainContent .ItemsWrapper img.img1{max-width:100%;background:rgb(239, 239, 239);border:1px solid rgb(239, 239, 239);border-radius:18px;border:1px;margin:10px 0 10px}.ElevateDetails .SliderWrapper .DotsWrapper{width:100%;margin:0 auto;height:30px}.ElevateDetails .SliderWrapper .DotsWrapper ul.Dots{display:flex;justify-content:center;padding:0}.ElevateDetails .SliderWrapper .DotsWrapper ul.Dots li{height:10px;width:10px;background:#ccc;border-radius:50%;margin-left:3px;margin-right:3px;list-style:none;cursor:pointer}.ElevateDetails .SliderWrapper .DotsWrapper ul.Dots li:hover{background:#bbb}.ElevateDetails .SliderWrapper .DotsWrapper ul.Dots li.active{border:solid 1px var(--emw--color-secondary, #FD2839);background:var(--emw--color-secondary, #FD2839)}.ElevateDetails .SliderWrapper .DotsWrapper ul.Dots li.default{border:solid 1px var(--emw--color-secondary, #FD2839);background-color:#FFF}.ElevateDetails .SliderNavButton{border:0px;width:25px;display:flex;align-items:center;justify-content:center;cursor:pointer}.ElevateDetails .SliderNavButton.HiddenArrow{visibility:hidden}.ElevateDetails .SliderNavButton svg{width:20px;stroke:var(--emw--color-secondary, #FD2839)}.ElevateDetails .DisabledArrow svg{opacity:0.2;stroke:var(--emw--color-secondary, #FD2839);pointer-events:none}.GamesContent{margin:20px;padding:15px;min-height:500px;flex:1;gap:12px;display:flex;flex-direction:column;border-radius:8px;border:2px solid var(--emw--color-powup-light-green-0D, rgba(188, 252, 177, 0.0509803922))}.GamesContent .GamesTitle{display:flex;flex-direction:row}.GamesContent .GamesTitle .Title2{text-transform:capitalize}.GamesContent .GamesTitle .GamesAmount{opacity:0.8}.GamesContent .GameTitleTip{color:var(--emw--color-powup-gray-green, #C8D6CE);font-size:0.8rem}.GamesContent .GamesList{display:flex;justify-content:center;width:100%;max-height:300px;flex:1;overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--emw--background-gray-color, gray) transparent}.GamesContent .GamesList::-webkit-scrollbar-track{background-color:transparent;border-radius:5px}.GamesContent .GamesList .Games{width:100%;padding:0;display:flex;align-items:flex-start;justify-content:flex-start;flex-wrap:wrap;gap:calc(30px / (var(--game-amount-per-line) - 1))}.GamesContent .GamesList .Games .Game{width:calc((100% - 30px) / var(--game-amount-per-line));cursor:pointer;position:relative}.GamesContent .GamesList .Games .Game .GameMask{transition:opacity;transition-duration:0.2s;opacity:0;position:absolute;width:70%;height:100%}.GamesContent .GamesList .Games .Game:hover .mask-filter{opacity:1}.GamesContent .GamesList .Games .Game:hover img{opacity:0.4;filter:blur(1.5px)}.GamesContent .GamesList .Games .Game:hover .GameMask{opacity:1;mix-blend-mode:screen;background-color:var(--emw--color-powup-green, #24B24E);display:flex;justify-content:center;align-items:center;position:absolute;width:100%;left:0;height:100%;top:0;border-radius:8px}.GamesContent .GamesList .Games .Game:hover .GameMask .PlayBtn{border:2px solid var(--emw--color-powup-gray, #f0f0f0);padding:5px 3px;border-radius:3px}";
250
+ const BonusElevateShopItemStyle0 = bonusElevateShopItemCss;
251
+
252
+ const BonusElevateShopItem = class {
253
+ constructor(hostRef) {
254
+ index.registerInstance(this, hostRef);
255
+ this.redeemGiftButton = index.createEvent(this, "redeemGiftButton", 7);
256
+ this.bindedHandler = this.handleMessage.bind(this);
257
+ this.deviceType = getDevicePlatform();
258
+ this.powerUpGameSearchConditions = {
259
+ expand: "games",
260
+ fields: "powerUpID,games(id,gameId,slug,name,thumbnail)"
261
+ };
262
+ this.endpoint = undefined;
263
+ this.language = 'en';
264
+ this.itemId = undefined;
265
+ this.elevateGift = undefined;
266
+ this.session = undefined;
267
+ this.mbSource = undefined;
268
+ this.clientStyling = '';
269
+ this.clientStylingUrl = '';
270
+ this.translationUrl = '';
271
+ this.showSliderDots = false;
272
+ this.showSliderArrows = true;
273
+ this.isGiftNotFound = false;
274
+ this.redeemErrorMsg = '';
275
+ this.isRedeeming = false;
276
+ this.powerUpGames = undefined;
277
+ this.isLoadingGames = false;
278
+ }
279
+ redeemGiftConfirm() {
280
+ if (this.isRedeeming || this.elevateGift.available != 'true') {
281
+ return;
282
+ }
283
+ window.postMessage({ type: 'BEERedeemConfirm', shopItem: this.elevateGift }, window.location.href);
284
+ }
285
+ handleMessage(message) {
286
+ if (message.data && message.data.type === "bee-redeem-confirmed" &&
287
+ message.data.id == this.elevateGift.id) {
288
+ this.redeemGift();
289
+ }
290
+ }
291
+ onBackClicked() {
292
+ window.postMessage({ type: 'OnGiftDetailsBackButtonClicked' }, window.location.href);
293
+ }
294
+ redeemGift() {
295
+ if (this.elevateGift.available.toLowerCase() === 'false' || this.isRedeeming) {
296
+ return;
297
+ }
298
+ let url = new URL(`${this.endpoint}/v1/elevate/redeem`);
299
+ let claimGiftOptions = {
300
+ method: 'PUT',
301
+ headers: {
302
+ 'x-SessionId': this.session,
303
+ 'Content-Type': 'application/json-patch+json',
304
+ },
305
+ body: JSON.stringify({ giftId: this.elevateGift.id }),
306
+ };
307
+ this.redeemErrorMsg = '';
308
+ this.isRedeeming = true;
309
+ fetch(url.toString(), claimGiftOptions)
310
+ .then((res) => res.json())
311
+ .then((res) => {
312
+ if (res.success) {
313
+ this.redeemGiftButton.emit();
314
+ window.postMessage({ type: 'BEEGiftRedeem', itemId: this.elevateGift.id }, window.location.href);
315
+ }
316
+ else {
317
+ let translatedError = translate(`error${res.errorCode}`, this.language);
318
+ this.redeemErrorMsg = translatedError ? translatedError : translate('redeemFailed', this.language);
319
+ window.postMessage({ type: 'BEEGiftRedeemFailed', itemId: this.elevateGift.id, res }, window.location.href);
320
+ }
321
+ })
322
+ .catch((err) => {
323
+ window.postMessage({ type: 'BEEGiftClaimFailed', itemId: this.elevateGift.id, err }, window.location.href);
324
+ }).finally(() => {
325
+ this.isRedeeming = false;
326
+ });
327
+ }
328
+ async loadElevateGift() {
329
+ let url = new URL(`${this.endpoint}/v1/elevate/shop?language=${this.language}&filter=id=${this.itemId}`);
330
+ let options = {
331
+ headers: {
332
+ 'Content-Type': 'application/json',
333
+ 'x-SessionId': this.session,
334
+ },
335
+ method: 'GET',
336
+ };
337
+ await new Promise((resolve) => {
338
+ fetch(url.href, options)
339
+ .then((res) => res.json())
340
+ .then((data) => {
341
+ let filteredGifts = data.data;
342
+ if (filteredGifts && filteredGifts.length == 1) {
343
+ this.elevateGift = filteredGifts[0];
344
+ if (this.elevateGift.type === 'powerUp' && this.elevateGift.powerUpID) {
345
+ this.loadMoreGames();
346
+ }
347
+ this.isGiftNotFound = false;
348
+ }
349
+ else {
350
+ this.isGiftNotFound = true;
351
+ }
352
+ resolve(true);
353
+ });
354
+ });
355
+ }
356
+ async loadMoreGames() {
357
+ var _a, _b, _c, _d, _e;
358
+ if (this.isLoadingGames || (((_a = this.powerUpGames) === null || _a === void 0 ? void 0 : _a.total) > 0 && ((_b = this.powerUpGames) === null || _b === void 0 ? void 0 : _b.items.length) >= ((_c = this.powerUpGames) === null || _c === void 0 ? void 0 : _c.total))) {
359
+ return;
360
+ }
361
+ this.isLoadingGames = true;
362
+ try {
363
+ const url = new URL(`${this.endpoint}/v1/elevate/powerups/available?pagination=games(limit=20,offset=${((_d = this.powerUpGames) === null || _d === void 0 ? void 0 : _d.items.length) || 0})`);
364
+ const options = {
365
+ headers: { 'x-SessionId': this.session },
366
+ };
367
+ url.searchParams.append('filter', `id=${this.elevateGift.powerUpID}`);
368
+ Object.entries(this.powerUpGameSearchConditions).forEach(([key, value]) => {
369
+ url.searchParams.append(key, value);
370
+ });
371
+ const response = await fetch(url.toString(), options);
372
+ if (!response.ok) {
373
+ throw new Error(`HTTP error! status: ${response.status}`);
374
+ }
375
+ const { data } = await response.json();
376
+ const fetchedPowerUp = data === null || data === void 0 ? void 0 : data[0];
377
+ if ((_e = fetchedPowerUp === null || fetchedPowerUp === void 0 ? void 0 : fetchedPowerUp.games) === null || _e === void 0 ? void 0 : _e.items) {
378
+ if (!this.powerUpGames) {
379
+ this.powerUpGames = fetchedPowerUp.games;
380
+ }
381
+ else {
382
+ this.powerUpGames.items = [...this.powerUpGames.items, ...fetchedPowerUp.games.items];
383
+ }
384
+ this.powerUpGames = Object.assign({}, this.powerUpGames);
385
+ }
386
+ }
387
+ catch (error) {
388
+ console.error('Failed to load more games:', error);
389
+ }
390
+ finally {
391
+ this.isLoadingGames = false;
392
+ }
393
+ }
394
+ initializeGamesObserver() {
395
+ if (this.loadMoreGamesObserver) {
396
+ this.loadMoreGamesObserver.disconnect();
397
+ }
398
+ this.loadMoreGamesObserver = new IntersectionObserver((entries) => {
399
+ entries.forEach((entry) => {
400
+ if (entry.isIntersecting) {
401
+ this.loadMoreGames();
402
+ }
403
+ });
404
+ });
405
+ if (this.lastGameElement) {
406
+ this.loadMoreGamesObserver.observe(this.lastGameElement);
407
+ }
408
+ }
409
+ onGameClick(game) {
410
+ window.postMessage({ type: 'EngagementSuiteGameRedirect', data: { Slug: game.slug } });
411
+ }
412
+ disconnectedCallback() {
413
+ window.removeEventListener('message', this.bindedHandler, false);
414
+ if (this.loadMoreGamesObserver) {
415
+ this.loadMoreGamesObserver.disconnect();
416
+ }
417
+ }
418
+ componentDidLoad() {
419
+ window.addEventListener('message', this.bindedHandler, false);
420
+ }
421
+ async componentWillLoad() {
422
+ if (this.translationUrl.length > 2) {
423
+ await getTranslations(this.translationUrl);
424
+ }
425
+ if (this.elevateGift) {
426
+ this.isGiftNotFound = false;
427
+ }
428
+ else {
429
+ await this.loadElevateGift();
430
+ }
431
+ }
432
+ componentDidUpdate() {
433
+ var _a, _b;
434
+ if (((_a = this.powerUpGames) === null || _a === void 0 ? void 0 : _a.items.length) < ((_b = this.powerUpGames) === null || _b === void 0 ? void 0 : _b.total)) {
435
+ this.initializeGamesObserver();
436
+ }
437
+ }
438
+ render() {
439
+ var _a, _b, _c;
440
+ return (index.h(index.Host, { key: '02194284778bc18ed94c17ee0c4a682da0c9935e' }, index.h("general-styling-wrapper", { key: '3109c90669d039df0aa7caf8dac48ca7576b1db2', clientStylingUrl: this.clientStylingUrl, clientStyling: this.clientStyling, mbSource: this.mbSource }), index.h("div", { key: 'aa8fa9853ff3f0c50cf055f622640f187138531b', class: 'ElevateDetails' }, this.isGiftNotFound && (index.h(index.Fragment, { key: '1ff8d0e249663ea5f2ee0de06d406f962f973493' }, index.h("div", { key: '5575275bd24e74a530ffd2b8b17045f7b0daed7c', class: "Row ThumbnailRow" }, index.h("div", { key: '501b117a2c493750deb056ecf8f8614351c0fac2', class: "BackButton", onClick: () => {
441
+ this.onBackClicked();
442
+ } }, index.h("span", { key: '556a1ece3c4b8398277ad996ed58d0d84db0f7b4', class: "BackArrow", innerHTML: "<" }), index.h("span", { key: '43f9a46fe32710cc7d05e953475088f049999791', class: "BackTxt" }, " ", translate('back', this.language), " "))), index.h("div", { key: 'ba220234e040ed863b3bbc1960b54ced43fe4303', class: "Thumnails GiftNotFound" }, translate('noDataFound', this.language), "."))), this.elevateGift && index.h(index.Fragment, { key: 'e1f7f2dfd7d80da3fafdc5edd8d8686522509893' }, index.h("div", { key: '4a8f3ee47e7ef7bd87eafa5ebdd3346b523f13fd', class: "ThumbnailRow" }, index.h("div", { key: 'd8dcab9b4b3d4963cd4ef7904caca9e1df3a6e88', class: 'Row' }, index.h("div", { key: '6368dc35f95a2202cc38c5dc05bdf6f6d83fce55', class: "BackButton", onClick: () => { this.onBackClicked(); } }, index.h("span", { key: '64f67312085b9216b42cb61a9ee7ea780058856d', class: "BackArrow", innerHTML: "<" }), index.h("span", { key: '4e5d8bdec62fe9e32cb839e3904113449e4d4c0c', class: "BackTxt" }, " ", translate('back', this.language), " ")), index.h("bonus-elevate-shop-assets-slider", { key: '0b9e8164653ec6a7c8b9d1d260ed44ca641f0726', class: 'Thumbnails', itemsPerPage: 1, sliderItems: this.elevateGift.presentation.assets, showSliderDots: this.showSliderDots })), index.h("div", { key: 'd911392a0ce5afac58cdf26046d80cfdaf7c1793', class: 'Col Details' }, index.h("h3", { key: '273ff2eb682767a5429dc99642b1c166921cb1dc', class: "GiftName" }, this.elevateGift.presentation.displayName || this.elevateGift.displayName), index.h("div", { key: '459bcb83df4dc907bb7cc9757a86c88b39ca4905', class: "GiftPoints" }, index.h("span", { key: '3648c21ea2133c6a3050f2417449ab046e51c04b', class: "Points" }, this.elevateGift.points, " "), index.h("span", { key: '8b6665da119f9dd777644592cc2815fc77dffda1', class: " PointsLabel" }, translate('coins', this.language))))), index.h("div", { key: '6e9a28dd26368897ddfd76032ce1e3882a886a5b', class: 'ShopItemDetail Details' }, index.h("div", { key: 'd2844066fe51e4b3d43689406879e1306d494f0a', class: "GiftPresentation" }, index.h("p", { key: '12f8bce3abf0df34657392e95aa8ddfb42d4c088' }, this.elevateGift.presentation.description ? this.elevateGift.presentation.description : translate('noGiftPresentation', this.language))), index.h("div", { key: '2b0cc39b8e53336355f1f5d0576a59bfd9859abf', class: 'BottomDetail' }, index.h("div", { key: '0eabb8f4ecb8236d78665110c835a0cf2689e864', class: `RedeemButton ${this.elevateGift.available === 'false' || this.isRedeeming ? 'Disabled deactive' : ' active '}
443
+ ${this.deviceType == 'dk' ? 'DkButton' : ''}`, onClick: this.redeemGiftConfirm.bind(this) }, translate('redeemGift', this.language)), index.h("span", { key: '9773077b08f77bc2940519070053aee362f34e2a', class: 'RedeemError Error' }, " ", this.redeemErrorMsg, " "))))), ((_a = this.elevateGift) === null || _a === void 0 ? void 0 : _a.type) === 'powerUp' && this.powerUpGames && index.h("div", { key: 'ec880bb1c11a7fb485f4d7e80dce6e250f2b4e19', class: 'GamesContent' }, index.h("div", { key: 'a6dc572f4f5b6732ed6d29fad4c76fbf0415ca68', class: 'GamesTitle' }, index.h("span", { key: '2904186a96290683dbbcd06cfca99f48c616f6f1', class: 'Title2' }, " ", translate('games', this.language)), index.h("span", { key: '9c7f5fa7f0441721bc32aab10b07c3f7f2de91c4', class: 'GamesAmount' }, " ( ", ((_b = this.powerUpGames) === null || _b === void 0 ? void 0 : _b.total) || 0, " ) ")), index.h("div", { key: '4f465d62df13e07bf2d946416ed70cdd52591cbb', class: 'GamesList' }, index.h("div", { key: 'd23fc7b21125dd6467ad56cbd7d2ce03a579d689', class: 'Games' }, (_c = this.powerUpGames) === null || _c === void 0 ? void 0 : _c.items.map((g, index$1) => {
444
+ const isLastItem = index$1 === this.powerUpGames.items.length - 1;
445
+ return index.h("div", { class: 'Game', ref: isLastItem ? (el) => (this.lastGameElement = el) : null }, index.h("ui-image", { src: g.thumbnail }), index.h("div", { class: 'GameMask', onClick: this.onGameClick.bind(this, g) }, index.h("span", { class: 'PlayBtn' }, "Start Now!")));
446
+ })), this.isLoadingGames && index.h("p", { key: '89e860b88abc15beda61b9989e5a82a9f445aadd' }, "Loading more games...")))));
447
+ }
448
+ };
449
+ BonusElevateShopItem.style = BonusElevateShopItemStyle0;
450
+
451
+ const mergeTranslations = (url, target) => {
452
+ return new Promise((resolve) => {
453
+ fetch(url)
454
+ .then((res) => res.json())
455
+ .then((data) => {
456
+ Object.keys(data).forEach((item) => {
457
+ target[item] = target[item] || {};
458
+ Object.keys(data[item]).forEach((key) => {
459
+ //if there is no key in target, do nothing
460
+ if (!target['en'][key]) {
461
+ return;
462
+ }
463
+ const defaultTranslation = target['en'][key];
464
+ if (typeof data[item][key] === 'object') {
465
+ // if the key is not in target, then take from en
466
+ target[item][key] = target[item][key] || Object.assign({}, defaultTranslation);
467
+ Object.keys(data[item][key]).forEach((subKey) => {
468
+ target[item][key][subKey] = data[item][key][subKey];
469
+ });
470
+ }
471
+ else {
472
+ target[item][key] = data[item][key] || Object.assign({}, defaultTranslation);
473
+ }
474
+ });
475
+ });
476
+ resolve(true);
477
+ })
478
+ .catch(err => {
479
+ console.error("Failed to load translations:", err);
480
+ resolve(false);
481
+ });
482
+ });
483
+ };
484
+
485
+ const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
486
+
487
+ /**
488
+ * @name setClientStyling
489
+ * @description Method used to create and append to the passed element of the widget a style element with the content received
490
+ * @param {HTMLElement} stylingContainer The reference element of the widget
491
+ * @param {string} clientStyling The style content
492
+ */
493
+ function setClientStyling(stylingContainer, clientStyling) {
494
+ if (stylingContainer) {
495
+ const sheet = document.createElement('style');
496
+ sheet.innerHTML = clientStyling;
497
+ stylingContainer.appendChild(sheet);
498
+ }
499
+ }
500
+
501
+ /**
502
+ * @name setClientStylingURL
503
+ * @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
504
+ * @param {HTMLElement} stylingContainer The reference element of the widget
505
+ * @param {string} clientStylingUrl The URL of the style content
506
+ */
507
+ function setClientStylingURL(stylingContainer, clientStylingUrl) {
508
+ if (!stylingContainer || !clientStylingUrl) return;
509
+
510
+ const url = new URL(clientStylingUrl);
511
+
512
+ fetch(url.href)
513
+ .then((res) => res.text())
514
+ .then((data) => {
515
+ const cssFile = document.createElement('style');
516
+ cssFile.innerHTML = data;
517
+ if (stylingContainer) {
518
+ stylingContainer.appendChild(cssFile);
519
+ }
520
+ })
521
+ .catch((err) => {
522
+ console.error('There was an error while trying to load client styling from URL', err);
523
+ });
524
+ }
525
+
526
+ /**
527
+ * @name setStreamLibrary
528
+ * @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
529
+ * @param {HTMLElement} stylingContainer The highest element of the widget
530
+ * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
531
+ * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
532
+ * @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
533
+ */
534
+ function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
535
+ if (!window.emMessageBus) return;
536
+
537
+ const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
538
+
539
+ if (!supportAdoptStyle || !useAdoptedStyleSheets) {
540
+ subscription = getStyleTagSubscription(stylingContainer, domain);
541
+
542
+ return subscription;
543
+ }
544
+
545
+ if (!window[StyleCacheKey]) {
546
+ window[StyleCacheKey] = {};
547
+ }
548
+ subscription = getAdoptStyleSubscription(stylingContainer, domain);
549
+
550
+ const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
551
+ const wrappedUnsubscribe = () => {
552
+ if (window[StyleCacheKey][domain]) {
553
+ const cachedObject = window[StyleCacheKey][domain];
554
+ cachedObject.refCount > 1
555
+ ? (cachedObject.refCount = cachedObject.refCount - 1)
556
+ : delete window[StyleCacheKey][domain];
557
+ }
558
+
559
+ originalUnsubscribe();
560
+ };
561
+ subscription.unsubscribe = wrappedUnsubscribe;
562
+
563
+ return subscription;
564
+ }
565
+
566
+ function getStyleTagSubscription(stylingContainer, domain) {
567
+ const sheet = document.createElement('style');
568
+
569
+ return window.emMessageBus.subscribe(domain, (data) => {
570
+ if (stylingContainer) {
571
+ sheet.innerHTML = data;
572
+ stylingContainer.appendChild(sheet);
573
+ }
574
+ });
575
+ }
576
+
577
+ function getAdoptStyleSubscription(stylingContainer, domain) {
578
+ return window.emMessageBus.subscribe(domain, (data) => {
579
+ if (!stylingContainer) return;
580
+
581
+ const shadowRoot = stylingContainer.getRootNode();
582
+ const cacheStyleObject = window[StyleCacheKey];
583
+ let cachedStyle = cacheStyleObject[domain] && cacheStyleObject[domain].sheet;
584
+
585
+ if (!cachedStyle) {
586
+ cachedStyle = new CSSStyleSheet();
587
+ cachedStyle.replaceSync(data);
588
+ cacheStyleObject[domain] = {
589
+ sheet: cachedStyle,
590
+ refCount: 1
591
+ };
592
+ } else {
593
+ cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
594
+ }
595
+
596
+ const currentSheets = shadowRoot.adoptedStyleSheets || [];
597
+ if (!currentSheets.includes(cachedStyle)) {
598
+ shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
599
+ }
600
+ });
601
+ }
602
+
603
+ const generalStylingWrapperCss = ":host{display:block}";
604
+ const GeneralStylingWrapperStyle0 = generalStylingWrapperCss;
605
+
606
+ const GeneralStylingWrapper = class {
607
+ constructor(hostRef) {
608
+ index.registerInstance(this, hostRef);
609
+ this.stylingAppends = false;
610
+ this.clientStyling = '';
611
+ this.clientStylingUrl = '';
612
+ this.mbSource = undefined;
613
+ this.translationUrl = '';
614
+ this.targetTranslations = undefined;
615
+ }
616
+ componentDidLoad() {
617
+ if (this.el) {
618
+ if (this.mbSource)
619
+ setStreamStyling(this.el, `${this.mbSource}.Style`, this.stylingSubscription);
620
+ if (this.clientStyling)
621
+ setClientStyling(this.el, this.clientStyling);
622
+ if (this.clientStylingUrl)
623
+ setClientStylingURL(this.el, this.clientStylingUrl);
624
+ this.stylingAppends = true;
625
+ }
626
+ }
627
+ disconnectedCallback() {
628
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
629
+ }
630
+ handleMbSourceChange(newValue, oldValue) {
631
+ if (newValue != oldValue) {
632
+ setStreamStyling(this.el, `${this.mbSource}.Style`, this.stylingSubscription);
633
+ }
634
+ }
635
+ handleClientStylingChange(newValue, oldValue) {
636
+ if (newValue != oldValue) {
637
+ setClientStyling(this.el, this.clientStyling);
638
+ }
639
+ }
640
+ handleClientStylingUrlChange(newValue, oldValue) {
641
+ if (newValue != oldValue) {
642
+ if (this.clientStylingUrl)
643
+ setClientStylingURL(this.el, this.clientStylingUrl);
644
+ }
645
+ }
646
+ componentDidRender() {
647
+ // start custom styling area
648
+ if (!this.stylingAppends) {
649
+ if (this.clientStyling)
650
+ setClientStyling(this.el, this.clientStyling);
651
+ if (this.clientStylingUrl)
652
+ setClientStylingURL(this.el, this.clientStylingUrl);
653
+ this.stylingAppends = true;
654
+ }
655
+ // end custom styling area
656
+ }
657
+ async componentWillLoad() {
658
+ const promises = [];
659
+ if (this.translationUrl) {
660
+ const translationPromise = mergeTranslations(this.translationUrl, this.targetTranslations);
661
+ promises.push(translationPromise);
662
+ }
663
+ return await Promise.all(promises);
664
+ }
665
+ render() {
666
+ return (index.h("div", { key: 'e660ceb69f5e848c788c3924fc814c0fa7a777a2', class: "StyleShell" }, index.h("slot", { key: '35014b6c0c32532af11e6a629ba9b13942504d21', name: "mainContent" })));
667
+ }
668
+ get el() { return index.getElement(this); }
669
+ static get watchers() { return {
670
+ "mbSource": ["handleMbSourceChange"],
671
+ "clientStyling": ["handleClientStylingChange"],
672
+ "clientStylingUrl": ["handleClientStylingUrlChange"]
673
+ }; }
674
+ };
675
+ GeneralStylingWrapper.style = GeneralStylingWrapperStyle0;
676
+
677
+ const uiImageCss = ".HostContainer{display:block}.UiContainer{height:100%;width:100%;border-radius:inherit;object-fit:inherit}.UiContainer .Image{border-radius:inherit}.Hidden{opacity:0;transition:opacity 0.5s ease-in-out}.Visible{opacity:1;border-radius:var(--emw--border-radius-medium, 10px);transition:opacity 0.5s ease-in-out}";
678
+ const UiImageStyle0 = uiImageCss;
679
+
680
+ const UiImage = class {
681
+ constructor(hostRef) {
682
+ index.registerInstance(this, hostRef);
683
+ this.src = undefined;
684
+ this.width = undefined;
685
+ this.height = undefined;
686
+ this.alt = undefined;
687
+ this.styles = undefined;
688
+ this.detectDistance = '200px';
689
+ this.imgLoaded = false;
690
+ this.shouldLoad = false;
691
+ }
692
+ handleSrc() {
693
+ if (!this.shouldLoad) {
694
+ return;
695
+ }
696
+ const preloadedImage = new Image();
697
+ preloadedImage.onload = () => {
698
+ if (this.image) {
699
+ this.image.src = this.src;
700
+ this.imgLoaded = true;
701
+ preloadedImage.onload = null;
702
+ }
703
+ };
704
+ preloadedImage.src = this.src;
705
+ }
706
+ componentDidLoad() {
707
+ if ('IntersectionObserver' in window) {
708
+ this.el.__uxComponent = this;
709
+ if (!window.EMUxObserver) {
710
+ window.EMUxObserver = new IntersectionObserver((entries) => {
711
+ entries.forEach(entry => {
712
+ if (entry.isIntersecting) {
713
+ const comp = entry.target.__uxComponent;
714
+ if (comp) {
715
+ comp.shouldLoad = true;
716
+ comp.handleSrc();
717
+ }
718
+ window.EMUxObserver.unobserve(entry.target);
719
+ }
720
+ });
721
+ }, { rootMargin: this.detectDistance });
722
+ }
723
+ window.EMUxObserver.observe(this.el);
724
+ }
725
+ else {
726
+ this.shouldLoad = true;
727
+ this.handleSrc();
728
+ }
729
+ }
730
+ render() {
731
+ return (index.h(index.Host, { key: 'f506ba73852f257ad80bf59ca177d2065a5f365e', class: "HostContainer" }, !this.imgLoaded && (index.h("ui-skeleton", { key: '564ebfab701f827ddc2debccb7615926dbc9e876', class: "UiContainer", structure: "image", width: "100%", height: "100%" })), index.h("img", { key: '2188ca4494c10587f064acc5459ffc468948f497', ref: (el) => (this.image = el), src: this.shouldLoad ? this.src : undefined, onLoad: () => (this.imgLoaded = true), style: this.styles, class: `UiContainer ${this.imgLoaded ? 'Visible' : 'Hidden'}`, alt: this.alt, width: this.width, height: this.height, loading: "lazy" })));
732
+ }
733
+ get el() { return index.getElement(this); }
734
+ static get watchers() { return {
735
+ "src": ["handleSrc"]
736
+ }; }
737
+ };
738
+ UiImage.style = UiImageStyle0;
739
+
740
+ const uiSkeletonCss = ":host{display:block}.Skeleton{animation:skeleton-loading 1s linear infinite alternate}.SkeletonRectangle{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)}.SkeletonCircle{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%}.SkeletonText{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)}.SkeletonText:last-child{width:calc(var(--emw-skeleton-text-width, 400px) - 100px)}.SkeletonTitle{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)}.SkeletonImage{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)}.SkeletonLogo{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)}}";
741
+ const UiSkeletonStyle0 = uiSkeletonCss;
742
+
743
+ const UiSkeleton = class {
744
+ constructor(hostRef) {
745
+ index.registerInstance(this, hostRef);
746
+ this.stylingValue = {
747
+ width: this.handleStylingProps(this.width),
748
+ height: this.handleStylingProps(this.height),
749
+ borderRadius: this.handleStylingProps(this.borderRadius),
750
+ marginBottom: this.handleStylingProps(this.marginBottom),
751
+ marginTop: this.handleStylingProps(this.marginTop),
752
+ marginLeft: this.handleStylingProps(this.marginLeft),
753
+ marginRight: this.handleStylingProps(this.marginRight),
754
+ size: this.handleStylingProps(this.size),
755
+ };
756
+ this.structure = undefined;
757
+ this.width = 'unset';
758
+ this.height = 'unset';
759
+ this.borderRadius = 'unset';
760
+ this.marginBottom = 'unset';
761
+ this.marginTop = 'unset';
762
+ this.marginLeft = 'unset';
763
+ this.marginRight = 'unset';
764
+ this.animation = true;
765
+ this.rows = 0;
766
+ this.size = '100%';
767
+ }
768
+ handleStructureChange(newValue, oldValue) {
769
+ if (oldValue !== newValue) {
770
+ this.handleStructure(newValue);
771
+ }
772
+ }
773
+ handleStylingProps(value) {
774
+ switch (typeof value) {
775
+ case 'number':
776
+ return value === 0 ? 0 : `${value}px`;
777
+ case 'undefined':
778
+ return 'unset';
779
+ case 'string':
780
+ if (['auto', 'unset', 'none', 'inherit', 'initial'].includes(value) ||
781
+ value.endsWith('px') ||
782
+ value.endsWith('%')) {
783
+ return value;
784
+ }
785
+ else {
786
+ return 'unset';
787
+ }
788
+ default:
789
+ return 'unset';
790
+ }
791
+ }
792
+ handleStructure(structure) {
793
+ switch (structure) {
794
+ case 'logo':
795
+ return this.renderLogo();
796
+ case 'image':
797
+ return this.renderImage();
798
+ case 'title':
799
+ return this.renderTitle();
800
+ case 'text':
801
+ return this.renderText();
802
+ case 'rectangle':
803
+ return this.renderRectangle();
804
+ case 'circle':
805
+ return this.renderCircle();
806
+ default:
807
+ return null;
808
+ }
809
+ }
810
+ renderLogo() {
811
+ return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: 'SkeletonLogo ' + (this.animation ? 'Skeleton' : '') })));
812
+ }
813
+ renderImage() {
814
+ return index.h("div", { class: 'SkeletonImage ' + (this.animation ? 'Skeleton' : '') });
815
+ }
816
+ renderTitle() {
817
+ return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: 'SkeletonTitle ' + (this.animation ? 'Skeleton' : '') })));
818
+ }
819
+ renderText() {
820
+ return (index.h("div", { class: "SkeletonContainer" }, Array.from({ length: this.rows > 0 ? this.rows : 1 }).map((_, index$1) => (index.h("div", { key: index$1, class: 'SkeletonText ' + (this.animation ? 'Skeleton' : '') })))));
821
+ }
822
+ renderRectangle() {
823
+ return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: 'SkeletonRectangle ' + (this.animation ? 'Skeleton' : '') })));
824
+ }
825
+ renderCircle() {
826
+ return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: 'SkeletonCircle ' + (this.animation ? 'Skeleton' : '') })));
827
+ }
828
+ render() {
829
+ let styleBlock = '';
830
+ switch (this.structure) {
831
+ case 'logo':
832
+ styleBlock = `
833
+ :host {
834
+ --emw-skeleton-logo-width: ${this.stylingValue.width};
835
+ --emw-skeleton-logo-height: ${this.stylingValue.height};
836
+ --emw-skeleton-logo-border-radius: ${this.stylingValue.borderRadius};
837
+ --emw-skeleton-logo-margin-bottom: ${this.stylingValue.marginBottom};
838
+ --emw-skeleton-logo-margin-top: ${this.stylingValue.marginTop};
839
+ --emw-skeleton-logo-margin-left: ${this.stylingValue.marginLeft};
840
+ --emw-skeleton-logo-margin-right: ${this.stylingValue.marginRight};
841
+ }
842
+ `;
843
+ break;
844
+ case 'image':
845
+ styleBlock = `
846
+ :host {
847
+ --emw-skeleton-image-width: ${this.stylingValue.width};
848
+ --emw-skeleton-image-height: ${this.stylingValue.height};
849
+ --emw-skeleton-image-border-radius: ${this.stylingValue.borderRadius};
850
+ --emw-skeleton-image-margin-bottom: ${this.stylingValue.marginBottom};
851
+ --emw-skeleton-image-margin-top: ${this.stylingValue.marginTop};
852
+ --emw-skeleton-image-margin-left: ${this.stylingValue.marginLeft};
853
+ --emw-skeleton-image-margin-right: ${this.stylingValue.marginRight};
854
+ }
855
+ `;
856
+ break;
857
+ case 'title':
858
+ styleBlock = `
859
+ :host {
860
+ --emw-skeleton-title-width: ${this.stylingValue.width};
861
+ --emw-skeleton-title-height: ${this.stylingValue.height};
862
+ --emw-skeleton-title-border-radius: ${this.stylingValue.borderRadius};
863
+ --emw-skeleton-title-margin-bottom: ${this.stylingValue.marginBottom};
864
+ --emw-skeleton-title-margin-top: ${this.stylingValue.marginTop};
865
+ --emw-skeleton-title-margin-left: ${this.stylingValue.marginLeft};
866
+ --emw-skeleton-title-margin-right: ${this.stylingValue.marginRight};
867
+ }
868
+ `;
869
+ break;
870
+ case 'text':
871
+ styleBlock = `
872
+ :host {
873
+ --emw-skeleton-text-width: ${this.stylingValue.width};
874
+ --emw-skeleton-text-height: ${this.stylingValue.height};
875
+ --emw-skeleton-text-border-radius: ${this.stylingValue.borderRadius};
876
+ --emw-skeleton-text-margin-bottom: ${this.stylingValue.marginBottom};
877
+ --emw-skeleton-text-margin-top: ${this.stylingValue.marginTop};
878
+ --emw-skeleton-text-margin-left: ${this.stylingValue.marginLeft};
879
+ --emw-skeleton-text-margin-right: ${this.stylingValue.marginRight};
880
+ }
881
+ `;
882
+ break;
883
+ case 'rectangle':
884
+ styleBlock = `
885
+ :host {
886
+ --emw-skeleton-rectangle-width: ${this.stylingValue.width};
887
+ --emw-skeleton-rectangle-height: ${this.stylingValue.height};
888
+ --emw-skeleton-rectangle-border-radius: ${this.stylingValue.borderRadius};
889
+ --emw-skeleton-rectangle-margin-bottom: ${this.stylingValue.marginBottom};
890
+ --emw-skeleton-rectangle-margin-top: ${this.stylingValue.marginTop};
891
+ --emw-skeleton-rectangle-margin-left: ${this.stylingValue.marginLeft};
892
+ --emw-skeleton-rectangle-margin-right: ${this.stylingValue.marginRight};
893
+ }
894
+ `;
895
+ break;
896
+ case 'circle':
897
+ styleBlock = `
898
+ :host {
899
+ --emw-skeleton-circle-size: ${this.stylingValue.size};
900
+ }
901
+ `;
902
+ break;
903
+ default:
904
+ styleBlock = '';
905
+ }
906
+ return (index.h(index.Host, { key: 'c2a2650acd416962a2bc4e1a7ee18bc6d8e2def8' }, index.h("style", { key: '9bd7fc1f9e9ed9f17735a7b72fce6f09696f5e19' }, styleBlock), this.handleStructure(this.structure)));
907
+ }
908
+ static get watchers() { return {
909
+ "structure": ["handleStructureChange"]
910
+ }; }
911
+ };
912
+ UiSkeleton.style = UiSkeletonStyle0;
913
+
914
+ exports.bonus_elevate_shop_assets_slider = BonusElevateShopAssetsSlider;
915
+ exports.bonus_elevate_shop_item = BonusElevateShopItem;
916
+ exports.general_styling_wrapper = GeneralStylingWrapper;
917
+ exports.ui_image = UiImage;
918
+ exports.ui_skeleton = UiSkeleton;