@everymatrix/casino-challenges-container 0.6.10 → 0.6.12

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/casino-challenges-container/casino-challenge-card_6.entry.js +1 -1
  2. package/dist/casino-challenges-container/casino-challenges-container-dbb852af.js +7 -0
  3. package/dist/casino-challenges-container/casino-challenges-container.esm.js +1 -1
  4. package/dist/casino-challenges-container/index-7720ad93.js +2 -0
  5. package/dist/casino-challenges-container/index.esm.js +1 -1
  6. package/dist/cjs/casino-challenge-card_6.cjs.entry.js +11 -5
  7. package/dist/cjs/{casino-challenges-container-259a8575.js → casino-challenges-container-a067bdf7.js} +1082 -14
  8. package/dist/cjs/casino-challenges-container.cjs.js +2 -2
  9. package/dist/cjs/{index-076c8c1d.js → index-d5f8d1ee.js} +2 -69
  10. package/dist/cjs/index.cjs.js +2 -2
  11. package/dist/cjs/loader.cjs.js +2 -2
  12. package/dist/collection/components/casino-challenges-container/casino-challenges-container.js +36 -23
  13. package/dist/esm/casino-challenge-card_6.entry.js +12 -6
  14. package/dist/esm/{casino-challenges-container-7a8a2af6.js → casino-challenges-container-dbb852af.js} +1082 -14
  15. package/dist/esm/casino-challenges-container.js +3 -3
  16. package/dist/esm/{index-889cb07d.js → index-7720ad93.js} +2 -69
  17. package/dist/esm/index.js +2 -2
  18. package/dist/esm/loader.js +3 -3
  19. package/dist/types/components/casino-challenges-container/casino-challenges-container.d.ts +8 -2
  20. package/package.json +1 -1
  21. package/dist/casino-challenges-container/casino-challenges-container-7a8a2af6.js +0 -1
  22. package/dist/casino-challenges-container/index-889cb07d.js +0 -2
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h } from './index-889cb07d.js';
1
+ import { r as registerInstance, h } from './index-7720ad93.js';
2
2
 
3
3
  /**
4
4
  * @name setClientStyling
@@ -185,12 +185,1062 @@ function updateInStateByChallengeId(array, id, updates) {
185
185
  return array.map((el) => (el.ChallengeId === id ? Object.assign(Object.assign({}, el), updates) : el));
186
186
  }
187
187
 
188
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
189
+
190
+ var eventsource = {exports: {}};
191
+
192
+ /** @license
193
+ * eventsource.js
194
+ * Available under MIT License (MIT)
195
+ * https://github.com/Yaffle/EventSource/
196
+ */
197
+
198
+ (function (module, exports) {
199
+ /*jslint indent: 2, vars: true, plusplus: true */
200
+ /*global setTimeout, clearTimeout */
201
+
202
+ (function (global) {
203
+
204
+ var setTimeout = global.setTimeout;
205
+ var clearTimeout = global.clearTimeout;
206
+ var XMLHttpRequest = global.XMLHttpRequest;
207
+ var XDomainRequest = global.XDomainRequest;
208
+ var ActiveXObject = global.ActiveXObject;
209
+ var NativeEventSource = global.EventSource;
210
+
211
+ var document = global.document;
212
+ var Promise = global.Promise;
213
+ var fetch = global.fetch;
214
+ var Response = global.Response;
215
+ var TextDecoder = global.TextDecoder;
216
+ var TextEncoder = global.TextEncoder;
217
+ var AbortController = global.AbortController;
218
+
219
+ if (typeof window !== "undefined" && typeof document !== "undefined" && !("readyState" in document) && document.body == null) { // Firefox 2
220
+ document.readyState = "loading";
221
+ window.addEventListener("load", function (event) {
222
+ document.readyState = "complete";
223
+ }, false);
224
+ }
225
+
226
+ if (XMLHttpRequest == null && ActiveXObject != null) { // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest_in_IE6
227
+ XMLHttpRequest = function () {
228
+ return new ActiveXObject("Microsoft.XMLHTTP");
229
+ };
230
+ }
231
+
232
+ if (Object.create == undefined) {
233
+ Object.create = function (C) {
234
+ function F(){}
235
+ F.prototype = C;
236
+ return new F();
237
+ };
238
+ }
239
+
240
+ if (!Date.now) {
241
+ Date.now = function now() {
242
+ return new Date().getTime();
243
+ };
244
+ }
245
+
246
+ // see #118 (Promise#finally with polyfilled Promise)
247
+ // see #123 (data URLs crash Edge)
248
+ // see #125 (CSP violations)
249
+ // see pull/#138
250
+ // => No way to polyfill Promise#finally
251
+
252
+ if (AbortController == undefined) {
253
+ var originalFetch2 = fetch;
254
+ fetch = function (url, options) {
255
+ var signal = options.signal;
256
+ return originalFetch2(url, {headers: options.headers, credentials: options.credentials, cache: options.cache}).then(function (response) {
257
+ var reader = response.body.getReader();
258
+ signal._reader = reader;
259
+ if (signal._aborted) {
260
+ signal._reader.cancel();
261
+ }
262
+ return {
263
+ status: response.status,
264
+ statusText: response.statusText,
265
+ headers: response.headers,
266
+ body: {
267
+ getReader: function () {
268
+ return reader;
269
+ }
270
+ }
271
+ };
272
+ });
273
+ };
274
+ AbortController = function () {
275
+ this.signal = {
276
+ _reader: null,
277
+ _aborted: false
278
+ };
279
+ this.abort = function () {
280
+ if (this.signal._reader != null) {
281
+ this.signal._reader.cancel();
282
+ }
283
+ this.signal._aborted = true;
284
+ };
285
+ };
286
+ }
287
+
288
+ function TextDecoderPolyfill() {
289
+ this.bitsNeeded = 0;
290
+ this.codePoint = 0;
291
+ }
292
+
293
+ TextDecoderPolyfill.prototype.decode = function (octets) {
294
+ function valid(codePoint, shift, octetsCount) {
295
+ if (octetsCount === 1) {
296
+ return codePoint >= 0x0080 >> shift && codePoint << shift <= 0x07FF;
297
+ }
298
+ if (octetsCount === 2) {
299
+ return codePoint >= 0x0800 >> shift && codePoint << shift <= 0xD7FF || codePoint >= 0xE000 >> shift && codePoint << shift <= 0xFFFF;
300
+ }
301
+ if (octetsCount === 3) {
302
+ return codePoint >= 0x010000 >> shift && codePoint << shift <= 0x10FFFF;
303
+ }
304
+ throw new Error();
305
+ }
306
+ function octetsCount(bitsNeeded, codePoint) {
307
+ if (bitsNeeded === 6 * 1) {
308
+ return codePoint >> 6 > 15 ? 3 : codePoint > 31 ? 2 : 1;
309
+ }
310
+ if (bitsNeeded === 6 * 2) {
311
+ return codePoint > 15 ? 3 : 2;
312
+ }
313
+ if (bitsNeeded === 6 * 3) {
314
+ return 3;
315
+ }
316
+ throw new Error();
317
+ }
318
+ var REPLACER = 0xFFFD;
319
+ var string = "";
320
+ var bitsNeeded = this.bitsNeeded;
321
+ var codePoint = this.codePoint;
322
+ for (var i = 0; i < octets.length; i += 1) {
323
+ var octet = octets[i];
324
+ if (bitsNeeded !== 0) {
325
+ if (octet < 128 || octet > 191 || !valid(codePoint << 6 | octet & 63, bitsNeeded - 6, octetsCount(bitsNeeded, codePoint))) {
326
+ bitsNeeded = 0;
327
+ codePoint = REPLACER;
328
+ string += String.fromCharCode(codePoint);
329
+ }
330
+ }
331
+ if (bitsNeeded === 0) {
332
+ if (octet >= 0 && octet <= 127) {
333
+ bitsNeeded = 0;
334
+ codePoint = octet;
335
+ } else if (octet >= 192 && octet <= 223) {
336
+ bitsNeeded = 6 * 1;
337
+ codePoint = octet & 31;
338
+ } else if (octet >= 224 && octet <= 239) {
339
+ bitsNeeded = 6 * 2;
340
+ codePoint = octet & 15;
341
+ } else if (octet >= 240 && octet <= 247) {
342
+ bitsNeeded = 6 * 3;
343
+ codePoint = octet & 7;
344
+ } else {
345
+ bitsNeeded = 0;
346
+ codePoint = REPLACER;
347
+ }
348
+ if (bitsNeeded !== 0 && !valid(codePoint, bitsNeeded, octetsCount(bitsNeeded, codePoint))) {
349
+ bitsNeeded = 0;
350
+ codePoint = REPLACER;
351
+ }
352
+ } else {
353
+ bitsNeeded -= 6;
354
+ codePoint = codePoint << 6 | octet & 63;
355
+ }
356
+ if (bitsNeeded === 0) {
357
+ if (codePoint <= 0xFFFF) {
358
+ string += String.fromCharCode(codePoint);
359
+ } else {
360
+ string += String.fromCharCode(0xD800 + (codePoint - 0xFFFF - 1 >> 10));
361
+ string += String.fromCharCode(0xDC00 + (codePoint - 0xFFFF - 1 & 0x3FF));
362
+ }
363
+ }
364
+ }
365
+ this.bitsNeeded = bitsNeeded;
366
+ this.codePoint = codePoint;
367
+ return string;
368
+ };
369
+
370
+ // Firefox < 38 throws an error with stream option
371
+ var supportsStreamOption = function () {
372
+ try {
373
+ return new TextDecoder().decode(new TextEncoder().encode("test"), {stream: true}) === "test";
374
+ } catch (error) {
375
+ console.debug("TextDecoder does not support streaming option. Using polyfill instead: " + error);
376
+ }
377
+ return false;
378
+ };
379
+
380
+ // IE, Edge
381
+ if (TextDecoder == undefined || TextEncoder == undefined || !supportsStreamOption()) {
382
+ TextDecoder = TextDecoderPolyfill;
383
+ }
384
+
385
+ var k = function () {
386
+ };
387
+
388
+ function XHRWrapper(xhr) {
389
+ this.withCredentials = false;
390
+ this.readyState = 0;
391
+ this.status = 0;
392
+ this.statusText = "";
393
+ this.responseText = "";
394
+ this.onprogress = k;
395
+ this.onload = k;
396
+ this.onerror = k;
397
+ this.onreadystatechange = k;
398
+ this._contentType = "";
399
+ this._xhr = xhr;
400
+ this._sendTimeout = 0;
401
+ this._abort = k;
402
+ }
403
+
404
+ XHRWrapper.prototype.open = function (method, url) {
405
+ this._abort(true);
406
+
407
+ var that = this;
408
+ var xhr = this._xhr;
409
+ var state = 1;
410
+ var timeout = 0;
411
+
412
+ this._abort = function (silent) {
413
+ if (that._sendTimeout !== 0) {
414
+ clearTimeout(that._sendTimeout);
415
+ that._sendTimeout = 0;
416
+ }
417
+ if (state === 1 || state === 2 || state === 3) {
418
+ state = 4;
419
+ xhr.onload = k;
420
+ xhr.onerror = k;
421
+ xhr.onabort = k;
422
+ xhr.onprogress = k;
423
+ xhr.onreadystatechange = k;
424
+ // IE 8 - 9: XDomainRequest#abort() does not fire any event
425
+ // Opera < 10: XMLHttpRequest#abort() does not fire any event
426
+ xhr.abort();
427
+ if (timeout !== 0) {
428
+ clearTimeout(timeout);
429
+ timeout = 0;
430
+ }
431
+ if (!silent) {
432
+ that.readyState = 4;
433
+ that.onabort(null);
434
+ that.onreadystatechange();
435
+ }
436
+ }
437
+ state = 0;
438
+ };
439
+
440
+ var onStart = function () {
441
+ if (state === 1) {
442
+ //state = 2;
443
+ var status = 0;
444
+ var statusText = "";
445
+ var contentType = undefined;
446
+ if (!("contentType" in xhr)) {
447
+ try {
448
+ status = xhr.status;
449
+ statusText = xhr.statusText;
450
+ contentType = xhr.getResponseHeader("Content-Type");
451
+ } catch (error) {
452
+ // IE < 10 throws exception for `xhr.status` when xhr.readyState === 2 || xhr.readyState === 3
453
+ // Opera < 11 throws exception for `xhr.status` when xhr.readyState === 2
454
+ // https://bugs.webkit.org/show_bug.cgi?id=29121
455
+ status = 0;
456
+ statusText = "";
457
+ contentType = undefined;
458
+ // Firefox < 14, Chrome ?, Safari ?
459
+ // https://bugs.webkit.org/show_bug.cgi?id=29658
460
+ // https://bugs.webkit.org/show_bug.cgi?id=77854
461
+ }
462
+ } else {
463
+ status = 200;
464
+ statusText = "OK";
465
+ contentType = xhr.contentType;
466
+ }
467
+ if (status !== 0) {
468
+ state = 2;
469
+ that.readyState = 2;
470
+ that.status = status;
471
+ that.statusText = statusText;
472
+ that._contentType = contentType;
473
+ that.onreadystatechange();
474
+ }
475
+ }
476
+ };
477
+ var onProgress = function () {
478
+ onStart();
479
+ if (state === 2 || state === 3) {
480
+ state = 3;
481
+ var responseText = "";
482
+ try {
483
+ responseText = xhr.responseText;
484
+ } catch (error) {
485
+ // IE 8 - 9 with XMLHttpRequest
486
+ }
487
+ that.readyState = 3;
488
+ that.responseText = responseText;
489
+ that.onprogress();
490
+ }
491
+ };
492
+ var onFinish = function (type, event) {
493
+ if (event == null || event.preventDefault == null) {
494
+ event = {
495
+ preventDefault: k
496
+ };
497
+ }
498
+ // Firefox 52 fires "readystatechange" (xhr.readyState === 4) without final "readystatechange" (xhr.readyState === 3)
499
+ // IE 8 fires "onload" without "onprogress"
500
+ onProgress();
501
+ if (state === 1 || state === 2 || state === 3) {
502
+ state = 4;
503
+ if (timeout !== 0) {
504
+ clearTimeout(timeout);
505
+ timeout = 0;
506
+ }
507
+ that.readyState = 4;
508
+ if (type === "load") {
509
+ that.onload(event);
510
+ } else if (type === "error") {
511
+ that.onerror(event);
512
+ } else if (type === "abort") {
513
+ that.onabort(event);
514
+ } else {
515
+ throw new TypeError();
516
+ }
517
+ that.onreadystatechange();
518
+ }
519
+ };
520
+ var onReadyStateChange = function (event) {
521
+ if (xhr != undefined) { // Opera 12
522
+ if (xhr.readyState === 4) {
523
+ if (!("onload" in xhr) || !("onerror" in xhr) || !("onabort" in xhr)) {
524
+ onFinish(xhr.responseText === "" ? "error" : "load", event);
525
+ }
526
+ } else if (xhr.readyState === 3) {
527
+ if (!("onprogress" in xhr)) { // testing XMLHttpRequest#responseText too many times is too slow in IE 11
528
+ // and in Firefox 3.6
529
+ onProgress();
530
+ }
531
+ } else if (xhr.readyState === 2) {
532
+ onStart();
533
+ }
534
+ }
535
+ };
536
+ var onTimeout = function () {
537
+ timeout = setTimeout(function () {
538
+ onTimeout();
539
+ }, 500);
540
+ if (xhr.readyState === 3) {
541
+ onProgress();
542
+ }
543
+ };
544
+
545
+ // XDomainRequest#abort removes onprogress, onerror, onload
546
+ if ("onload" in xhr) {
547
+ xhr.onload = function (event) {
548
+ onFinish("load", event);
549
+ };
550
+ }
551
+ if ("onerror" in xhr) {
552
+ xhr.onerror = function (event) {
553
+ onFinish("error", event);
554
+ };
555
+ }
556
+ // improper fix to match Firefox behaviour, but it is better than just ignore abort
557
+ // see https://bugzilla.mozilla.org/show_bug.cgi?id=768596
558
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=880200
559
+ // https://code.google.com/p/chromium/issues/detail?id=153570
560
+ // IE 8 fires "onload" without "onprogress
561
+ if ("onabort" in xhr) {
562
+ xhr.onabort = function (event) {
563
+ onFinish("abort", event);
564
+ };
565
+ }
566
+
567
+ if ("onprogress" in xhr) {
568
+ xhr.onprogress = onProgress;
569
+ }
570
+
571
+ // IE 8 - 9 (XMLHTTPRequest)
572
+ // Opera < 12
573
+ // Firefox < 3.5
574
+ // Firefox 3.5 - 3.6 - ? < 9.0
575
+ // onprogress is not fired sometimes or delayed
576
+ // see also #64 (significant lag in IE 11)
577
+ if ("onreadystatechange" in xhr) {
578
+ xhr.onreadystatechange = function (event) {
579
+ onReadyStateChange(event);
580
+ };
581
+ }
582
+
583
+ if ("contentType" in xhr || !("ontimeout" in XMLHttpRequest.prototype)) {
584
+ url += (url.indexOf("?") === -1 ? "?" : "&") + "padding=true";
585
+ }
586
+ xhr.open(method, url, true);
587
+
588
+ if ("readyState" in xhr) {
589
+ // workaround for Opera 12 issue with "progress" events
590
+ // #91 (XMLHttpRequest onprogress not fired for streaming response in Edge 14-15-?)
591
+ timeout = setTimeout(function () {
592
+ onTimeout();
593
+ }, 0);
594
+ }
595
+ };
596
+ XHRWrapper.prototype.abort = function () {
597
+ this._abort(false);
598
+ };
599
+ XHRWrapper.prototype.getResponseHeader = function (name) {
600
+ return this._contentType;
601
+ };
602
+ XHRWrapper.prototype.setRequestHeader = function (name, value) {
603
+ var xhr = this._xhr;
604
+ if ("setRequestHeader" in xhr) {
605
+ xhr.setRequestHeader(name, value);
606
+ }
607
+ };
608
+ XHRWrapper.prototype.getAllResponseHeaders = function () {
609
+ // XMLHttpRequest#getAllResponseHeaders returns null for CORS requests in Firefox 3.6.28
610
+ return this._xhr.getAllResponseHeaders != undefined ? this._xhr.getAllResponseHeaders() || "" : "";
611
+ };
612
+ XHRWrapper.prototype.send = function () {
613
+ // loading indicator in Safari < ? (6), Chrome < 14, Firefox
614
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=736723
615
+ if ((!("ontimeout" in XMLHttpRequest.prototype) || (!("sendAsBinary" in XMLHttpRequest.prototype) && !("mozAnon" in XMLHttpRequest.prototype))) &&
616
+ document != undefined &&
617
+ document.readyState != undefined &&
618
+ document.readyState !== "complete") {
619
+ var that = this;
620
+ that._sendTimeout = setTimeout(function () {
621
+ that._sendTimeout = 0;
622
+ that.send();
623
+ }, 4);
624
+ return;
625
+ }
626
+
627
+ var xhr = this._xhr;
628
+ // withCredentials should be set after "open" for Safari and Chrome (< 19 ?)
629
+ if ("withCredentials" in xhr) {
630
+ xhr.withCredentials = this.withCredentials;
631
+ }
632
+ try {
633
+ // xhr.send(); throws "Not enough arguments" in Firefox 3.0
634
+ xhr.send(undefined);
635
+ } catch (error1) {
636
+ // Safari 5.1.7, Opera 12
637
+ throw error1;
638
+ }
639
+ };
640
+
641
+ function toLowerCase(name) {
642
+ return name.replace(/[A-Z]/g, function (c) {
643
+ return String.fromCharCode(c.charCodeAt(0) + 0x20);
644
+ });
645
+ }
646
+
647
+ function HeadersPolyfill(all) {
648
+ // Get headers: implemented according to mozilla's example code: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/getAllResponseHeaders#Example
649
+ var map = Object.create(null);
650
+ var array = all.split("\r\n");
651
+ for (var i = 0; i < array.length; i += 1) {
652
+ var line = array[i];
653
+ var parts = line.split(": ");
654
+ var name = parts.shift();
655
+ var value = parts.join(": ");
656
+ map[toLowerCase(name)] = value;
657
+ }
658
+ this._map = map;
659
+ }
660
+ HeadersPolyfill.prototype.get = function (name) {
661
+ return this._map[toLowerCase(name)];
662
+ };
663
+
664
+ if (XMLHttpRequest != null && XMLHttpRequest.HEADERS_RECEIVED == null) { // IE < 9, Firefox 3.6
665
+ XMLHttpRequest.HEADERS_RECEIVED = 2;
666
+ }
667
+
668
+ function XHRTransport() {
669
+ }
670
+
671
+ XHRTransport.prototype.open = function (xhr, onStartCallback, onProgressCallback, onFinishCallback, url, withCredentials, headers) {
672
+ xhr.open("GET", url);
673
+ var offset = 0;
674
+ xhr.onprogress = function () {
675
+ var responseText = xhr.responseText;
676
+ var chunk = responseText.slice(offset);
677
+ offset += chunk.length;
678
+ onProgressCallback(chunk);
679
+ };
680
+ xhr.onerror = function (event) {
681
+ event.preventDefault();
682
+ onFinishCallback(new Error("NetworkError"));
683
+ };
684
+ xhr.onload = function () {
685
+ onFinishCallback(null);
686
+ };
687
+ xhr.onabort = function () {
688
+ onFinishCallback(null);
689
+ };
690
+ xhr.onreadystatechange = function () {
691
+ if (xhr.readyState === XMLHttpRequest.HEADERS_RECEIVED) {
692
+ var status = xhr.status;
693
+ var statusText = xhr.statusText;
694
+ var contentType = xhr.getResponseHeader("Content-Type");
695
+ var headers = xhr.getAllResponseHeaders();
696
+ onStartCallback(status, statusText, contentType, new HeadersPolyfill(headers));
697
+ }
698
+ };
699
+ xhr.withCredentials = withCredentials;
700
+ for (var name in headers) {
701
+ if (Object.prototype.hasOwnProperty.call(headers, name)) {
702
+ xhr.setRequestHeader(name, headers[name]);
703
+ }
704
+ }
705
+ xhr.send();
706
+ return xhr;
707
+ };
708
+
709
+ function HeadersWrapper(headers) {
710
+ this._headers = headers;
711
+ }
712
+ HeadersWrapper.prototype.get = function (name) {
713
+ return this._headers.get(name);
714
+ };
715
+
716
+ function FetchTransport() {
717
+ }
718
+
719
+ FetchTransport.prototype.open = function (xhr, onStartCallback, onProgressCallback, onFinishCallback, url, withCredentials, headers) {
720
+ var reader = null;
721
+ var controller = new AbortController();
722
+ var signal = controller.signal;
723
+ var textDecoder = new TextDecoder();
724
+ fetch(url, {
725
+ headers: headers,
726
+ credentials: withCredentials ? "include" : "same-origin",
727
+ signal: signal,
728
+ cache: "no-store"
729
+ }).then(function (response) {
730
+ reader = response.body.getReader();
731
+ onStartCallback(response.status, response.statusText, response.headers.get("Content-Type"), new HeadersWrapper(response.headers));
732
+ // see https://github.com/promises-aplus/promises-spec/issues/179
733
+ return new Promise(function (resolve, reject) {
734
+ var readNextChunk = function () {
735
+ reader.read().then(function (result) {
736
+ if (result.done) {
737
+ //Note: bytes in textDecoder are ignored
738
+ resolve(undefined);
739
+ } else {
740
+ var chunk = textDecoder.decode(result.value, {stream: true});
741
+ onProgressCallback(chunk);
742
+ readNextChunk();
743
+ }
744
+ })["catch"](function (error) {
745
+ reject(error);
746
+ });
747
+ };
748
+ readNextChunk();
749
+ });
750
+ })["catch"](function (error) {
751
+ if (error.name === "AbortError") {
752
+ return undefined;
753
+ } else {
754
+ return error;
755
+ }
756
+ }).then(function (error) {
757
+ onFinishCallback(error);
758
+ });
759
+ return {
760
+ abort: function () {
761
+ if (reader != null) {
762
+ reader.cancel(); // https://bugzilla.mozilla.org/show_bug.cgi?id=1583815
763
+ }
764
+ controller.abort();
765
+ }
766
+ };
767
+ };
768
+
769
+ function EventTarget() {
770
+ this._listeners = Object.create(null);
771
+ }
772
+
773
+ function throwError(e) {
774
+ setTimeout(function () {
775
+ throw e;
776
+ }, 0);
777
+ }
778
+
779
+ EventTarget.prototype.dispatchEvent = function (event) {
780
+ event.target = this;
781
+ var typeListeners = this._listeners[event.type];
782
+ if (typeListeners != undefined) {
783
+ var length = typeListeners.length;
784
+ for (var i = 0; i < length; i += 1) {
785
+ var listener = typeListeners[i];
786
+ try {
787
+ if (typeof listener.handleEvent === "function") {
788
+ listener.handleEvent(event);
789
+ } else {
790
+ listener.call(this, event);
791
+ }
792
+ } catch (e) {
793
+ throwError(e);
794
+ }
795
+ }
796
+ }
797
+ };
798
+ EventTarget.prototype.addEventListener = function (type, listener) {
799
+ type = String(type);
800
+ var listeners = this._listeners;
801
+ var typeListeners = listeners[type];
802
+ if (typeListeners == undefined) {
803
+ typeListeners = [];
804
+ listeners[type] = typeListeners;
805
+ }
806
+ var found = false;
807
+ for (var i = 0; i < typeListeners.length; i += 1) {
808
+ if (typeListeners[i] === listener) {
809
+ found = true;
810
+ }
811
+ }
812
+ if (!found) {
813
+ typeListeners.push(listener);
814
+ }
815
+ };
816
+ EventTarget.prototype.removeEventListener = function (type, listener) {
817
+ type = String(type);
818
+ var listeners = this._listeners;
819
+ var typeListeners = listeners[type];
820
+ if (typeListeners != undefined) {
821
+ var filtered = [];
822
+ for (var i = 0; i < typeListeners.length; i += 1) {
823
+ if (typeListeners[i] !== listener) {
824
+ filtered.push(typeListeners[i]);
825
+ }
826
+ }
827
+ if (filtered.length === 0) {
828
+ delete listeners[type];
829
+ } else {
830
+ listeners[type] = filtered;
831
+ }
832
+ }
833
+ };
834
+
835
+ function Event(type) {
836
+ this.type = type;
837
+ this.target = undefined;
838
+ }
839
+
840
+ function MessageEvent(type, options) {
841
+ Event.call(this, type);
842
+ this.data = options.data;
843
+ this.lastEventId = options.lastEventId;
844
+ }
845
+
846
+ MessageEvent.prototype = Object.create(Event.prototype);
847
+
848
+ function ConnectionEvent(type, options) {
849
+ Event.call(this, type);
850
+ this.status = options.status;
851
+ this.statusText = options.statusText;
852
+ this.headers = options.headers;
853
+ }
854
+
855
+ ConnectionEvent.prototype = Object.create(Event.prototype);
856
+
857
+ function ErrorEvent(type, options) {
858
+ Event.call(this, type);
859
+ this.error = options.error;
860
+ }
861
+
862
+ ErrorEvent.prototype = Object.create(Event.prototype);
863
+
864
+ var WAITING = -1;
865
+ var CONNECTING = 0;
866
+ var OPEN = 1;
867
+ var CLOSED = 2;
868
+
869
+ var AFTER_CR = -1;
870
+ var FIELD_START = 0;
871
+ var FIELD = 1;
872
+ var VALUE_START = 2;
873
+ var VALUE = 3;
874
+
875
+ var contentTypeRegExp = /^text\/event\-stream(;.*)?$/i;
876
+
877
+ var MINIMUM_DURATION = 1000;
878
+ var MAXIMUM_DURATION = 18000000;
879
+
880
+ var parseDuration = function (value, def) {
881
+ var n = value == null ? def : parseInt(value, 10);
882
+ if (n !== n) {
883
+ n = def;
884
+ }
885
+ return clampDuration(n);
886
+ };
887
+ var clampDuration = function (n) {
888
+ return Math.min(Math.max(n, MINIMUM_DURATION), MAXIMUM_DURATION);
889
+ };
890
+
891
+ var fire = function (that, f, event) {
892
+ try {
893
+ if (typeof f === "function") {
894
+ f.call(that, event);
895
+ }
896
+ } catch (e) {
897
+ throwError(e);
898
+ }
899
+ };
900
+
901
+ function EventSourcePolyfill(url, options) {
902
+ EventTarget.call(this);
903
+ options = options || {};
904
+
905
+ this.onopen = undefined;
906
+ this.onmessage = undefined;
907
+ this.onerror = undefined;
908
+
909
+ this.url = undefined;
910
+ this.readyState = undefined;
911
+ this.withCredentials = undefined;
912
+ this.headers = undefined;
913
+
914
+ this._close = undefined;
915
+
916
+ start(this, url, options);
917
+ }
918
+
919
+ function getBestXHRTransport() {
920
+ return (XMLHttpRequest != undefined && ("withCredentials" in XMLHttpRequest.prototype)) || XDomainRequest == undefined
921
+ ? new XMLHttpRequest()
922
+ : new XDomainRequest();
923
+ }
924
+
925
+ var isFetchSupported = fetch != undefined && Response != undefined && "body" in Response.prototype;
926
+
927
+ function start(es, url, options) {
928
+ url = String(url);
929
+ var withCredentials = Boolean(options.withCredentials);
930
+ var lastEventIdQueryParameterName = options.lastEventIdQueryParameterName || "lastEventId";
931
+
932
+ var initialRetry = clampDuration(1000);
933
+ var heartbeatTimeout = parseDuration(options.heartbeatTimeout, 45000);
934
+
935
+ var lastEventId = "";
936
+ var retry = initialRetry;
937
+ var wasActivity = false;
938
+ var textLength = 0;
939
+ var headers = options.headers || {};
940
+ var TransportOption = options.Transport;
941
+ var xhr = isFetchSupported && TransportOption == undefined ? undefined : new XHRWrapper(TransportOption != undefined ? new TransportOption() : getBestXHRTransport());
942
+ var transport = TransportOption != null && typeof TransportOption !== "string" ? new TransportOption() : (xhr == undefined ? new FetchTransport() : new XHRTransport());
943
+ var abortController = undefined;
944
+ var timeout = 0;
945
+ var currentState = WAITING;
946
+ var dataBuffer = "";
947
+ var lastEventIdBuffer = "";
948
+ var eventTypeBuffer = "";
949
+
950
+ var textBuffer = "";
951
+ var state = FIELD_START;
952
+ var fieldStart = 0;
953
+ var valueStart = 0;
954
+
955
+ var onStart = function (status, statusText, contentType, headers) {
956
+ if (currentState === CONNECTING) {
957
+ if (status === 200 && contentType != undefined && contentTypeRegExp.test(contentType)) {
958
+ currentState = OPEN;
959
+ wasActivity = Date.now();
960
+ retry = initialRetry;
961
+ es.readyState = OPEN;
962
+ var event = new ConnectionEvent("open", {
963
+ status: status,
964
+ statusText: statusText,
965
+ headers: headers
966
+ });
967
+ es.dispatchEvent(event);
968
+ fire(es, es.onopen, event);
969
+ } else {
970
+ var message = "";
971
+ if (status !== 200) {
972
+ if (statusText) {
973
+ statusText = statusText.replace(/\s+/g, " ");
974
+ }
975
+ message = "EventSource's response has a status " + status + " " + statusText + " that is not 200. Aborting the connection.";
976
+ } else {
977
+ message = "EventSource's response has a Content-Type specifying an unsupported type: " + (contentType == undefined ? "-" : contentType.replace(/\s+/g, " ")) + ". Aborting the connection.";
978
+ }
979
+ close();
980
+ var event = new ConnectionEvent("error", {
981
+ status: status,
982
+ statusText: statusText,
983
+ headers: headers
984
+ });
985
+ es.dispatchEvent(event);
986
+ fire(es, es.onerror, event);
987
+ console.error(message);
988
+ }
989
+ }
990
+ };
991
+
992
+ var onProgress = function (textChunk) {
993
+ if (currentState === OPEN) {
994
+ var n = -1;
995
+ for (var i = 0; i < textChunk.length; i += 1) {
996
+ var c = textChunk.charCodeAt(i);
997
+ if (c === "\n".charCodeAt(0) || c === "\r".charCodeAt(0)) {
998
+ n = i;
999
+ }
1000
+ }
1001
+ var chunk = (n !== -1 ? textBuffer : "") + textChunk.slice(0, n + 1);
1002
+ textBuffer = (n === -1 ? textBuffer : "") + textChunk.slice(n + 1);
1003
+ if (textChunk !== "") {
1004
+ wasActivity = Date.now();
1005
+ textLength += textChunk.length;
1006
+ }
1007
+ for (var position = 0; position < chunk.length; position += 1) {
1008
+ var c = chunk.charCodeAt(position);
1009
+ if (state === AFTER_CR && c === "\n".charCodeAt(0)) {
1010
+ state = FIELD_START;
1011
+ } else {
1012
+ if (state === AFTER_CR) {
1013
+ state = FIELD_START;
1014
+ }
1015
+ if (c === "\r".charCodeAt(0) || c === "\n".charCodeAt(0)) {
1016
+ if (state !== FIELD_START) {
1017
+ if (state === FIELD) {
1018
+ valueStart = position + 1;
1019
+ }
1020
+ var field = chunk.slice(fieldStart, valueStart - 1);
1021
+ var value = chunk.slice(valueStart + (valueStart < position && chunk.charCodeAt(valueStart) === " ".charCodeAt(0) ? 1 : 0), position);
1022
+ if (field === "data") {
1023
+ dataBuffer += "\n";
1024
+ dataBuffer += value;
1025
+ } else if (field === "id") {
1026
+ lastEventIdBuffer = value;
1027
+ } else if (field === "event") {
1028
+ eventTypeBuffer = value;
1029
+ } else if (field === "retry") {
1030
+ initialRetry = parseDuration(value, initialRetry);
1031
+ retry = initialRetry;
1032
+ } else if (field === "heartbeatTimeout") {
1033
+ heartbeatTimeout = parseDuration(value, heartbeatTimeout);
1034
+ if (timeout !== 0) {
1035
+ clearTimeout(timeout);
1036
+ timeout = setTimeout(function () {
1037
+ onTimeout();
1038
+ }, heartbeatTimeout);
1039
+ }
1040
+ }
1041
+ }
1042
+ if (state === FIELD_START) {
1043
+ if (dataBuffer !== "") {
1044
+ lastEventId = lastEventIdBuffer;
1045
+ if (eventTypeBuffer === "") {
1046
+ eventTypeBuffer = "message";
1047
+ }
1048
+ var event = new MessageEvent(eventTypeBuffer, {
1049
+ data: dataBuffer.slice(1),
1050
+ lastEventId: lastEventIdBuffer
1051
+ });
1052
+ es.dispatchEvent(event);
1053
+ if (eventTypeBuffer === "open") {
1054
+ fire(es, es.onopen, event);
1055
+ } else if (eventTypeBuffer === "message") {
1056
+ fire(es, es.onmessage, event);
1057
+ } else if (eventTypeBuffer === "error") {
1058
+ fire(es, es.onerror, event);
1059
+ }
1060
+ if (currentState === CLOSED) {
1061
+ return;
1062
+ }
1063
+ }
1064
+ dataBuffer = "";
1065
+ eventTypeBuffer = "";
1066
+ }
1067
+ state = c === "\r".charCodeAt(0) ? AFTER_CR : FIELD_START;
1068
+ } else {
1069
+ if (state === FIELD_START) {
1070
+ fieldStart = position;
1071
+ state = FIELD;
1072
+ }
1073
+ if (state === FIELD) {
1074
+ if (c === ":".charCodeAt(0)) {
1075
+ valueStart = position + 1;
1076
+ state = VALUE_START;
1077
+ }
1078
+ } else if (state === VALUE_START) {
1079
+ state = VALUE;
1080
+ }
1081
+ }
1082
+ }
1083
+ }
1084
+ }
1085
+ };
1086
+
1087
+ var onFinish = function (error) {
1088
+ if (currentState === OPEN || currentState === CONNECTING) {
1089
+ currentState = WAITING;
1090
+ if (timeout !== 0) {
1091
+ clearTimeout(timeout);
1092
+ timeout = 0;
1093
+ }
1094
+ timeout = setTimeout(function () {
1095
+ onTimeout();
1096
+ }, retry);
1097
+ retry = clampDuration(Math.min(initialRetry * 16, retry * 2));
1098
+
1099
+ es.readyState = CONNECTING;
1100
+ var event = new ErrorEvent("error", {error: error});
1101
+ es.dispatchEvent(event);
1102
+ fire(es, es.onerror, event);
1103
+ if (error != undefined) {
1104
+ console.error(error);
1105
+ }
1106
+ }
1107
+ };
1108
+
1109
+ var close = function () {
1110
+ currentState = CLOSED;
1111
+ if (abortController != undefined) {
1112
+ abortController.abort();
1113
+ abortController = undefined;
1114
+ }
1115
+ if (timeout !== 0) {
1116
+ clearTimeout(timeout);
1117
+ timeout = 0;
1118
+ }
1119
+ es.readyState = CLOSED;
1120
+ };
1121
+
1122
+ var onTimeout = function () {
1123
+ timeout = 0;
1124
+
1125
+ if (currentState !== WAITING) {
1126
+ if (!wasActivity && abortController != undefined) {
1127
+ onFinish(new Error("No activity within " + heartbeatTimeout + " milliseconds." + " " + (currentState === CONNECTING ? "No response received." : textLength + " chars received.") + " " + "Reconnecting."));
1128
+ if (abortController != undefined) {
1129
+ abortController.abort();
1130
+ abortController = undefined;
1131
+ }
1132
+ } else {
1133
+ var nextHeartbeat = Math.max((wasActivity || Date.now()) + heartbeatTimeout - Date.now(), 1);
1134
+ wasActivity = false;
1135
+ timeout = setTimeout(function () {
1136
+ onTimeout();
1137
+ }, nextHeartbeat);
1138
+ }
1139
+ return;
1140
+ }
1141
+
1142
+ wasActivity = false;
1143
+ textLength = 0;
1144
+ timeout = setTimeout(function () {
1145
+ onTimeout();
1146
+ }, heartbeatTimeout);
1147
+
1148
+ currentState = CONNECTING;
1149
+ dataBuffer = "";
1150
+ eventTypeBuffer = "";
1151
+ lastEventIdBuffer = lastEventId;
1152
+ textBuffer = "";
1153
+ fieldStart = 0;
1154
+ valueStart = 0;
1155
+ state = FIELD_START;
1156
+
1157
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=428916
1158
+ // Request header field Last-Event-ID is not allowed by Access-Control-Allow-Headers.
1159
+ var requestURL = url;
1160
+ if (url.slice(0, 5) !== "data:" && url.slice(0, 5) !== "blob:") {
1161
+ if (lastEventId !== "") {
1162
+ // Remove the lastEventId parameter if it's already part of the request URL.
1163
+ var i = url.indexOf("?");
1164
+ requestURL = i === -1 ? url : url.slice(0, i + 1) + url.slice(i + 1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g, function (p, paramName) {
1165
+ return paramName === lastEventIdQueryParameterName ? '' : p;
1166
+ });
1167
+ // Append the current lastEventId to the request URL.
1168
+ requestURL += (url.indexOf("?") === -1 ? "?" : "&") + lastEventIdQueryParameterName +"=" + encodeURIComponent(lastEventId);
1169
+ }
1170
+ }
1171
+ var withCredentials = es.withCredentials;
1172
+ var requestHeaders = {};
1173
+ requestHeaders["Accept"] = "text/event-stream";
1174
+ var headers = es.headers;
1175
+ if (headers != undefined) {
1176
+ for (var name in headers) {
1177
+ if (Object.prototype.hasOwnProperty.call(headers, name)) {
1178
+ requestHeaders[name] = headers[name];
1179
+ }
1180
+ }
1181
+ }
1182
+ try {
1183
+ abortController = transport.open(xhr, onStart, onProgress, onFinish, requestURL, withCredentials, requestHeaders);
1184
+ } catch (error) {
1185
+ close();
1186
+ throw error;
1187
+ }
1188
+ };
1189
+
1190
+ es.url = url;
1191
+ es.readyState = CONNECTING;
1192
+ es.withCredentials = withCredentials;
1193
+ es.headers = headers;
1194
+ es._close = close;
1195
+
1196
+ onTimeout();
1197
+ }
1198
+
1199
+ EventSourcePolyfill.prototype = Object.create(EventTarget.prototype);
1200
+ EventSourcePolyfill.prototype.CONNECTING = CONNECTING;
1201
+ EventSourcePolyfill.prototype.OPEN = OPEN;
1202
+ EventSourcePolyfill.prototype.CLOSED = CLOSED;
1203
+ EventSourcePolyfill.prototype.close = function () {
1204
+ this._close();
1205
+ };
1206
+
1207
+ EventSourcePolyfill.CONNECTING = CONNECTING;
1208
+ EventSourcePolyfill.OPEN = OPEN;
1209
+ EventSourcePolyfill.CLOSED = CLOSED;
1210
+ EventSourcePolyfill.prototype.withCredentials = undefined;
1211
+
1212
+ var R = NativeEventSource;
1213
+ if (XMLHttpRequest != undefined && (NativeEventSource == undefined || !("withCredentials" in NativeEventSource.prototype))) {
1214
+ // Why replace a native EventSource ?
1215
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=444328
1216
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=831392
1217
+ // https://code.google.com/p/chromium/issues/detail?id=260144
1218
+ // https://code.google.com/p/chromium/issues/detail?id=225654
1219
+ // ...
1220
+ R = EventSourcePolyfill;
1221
+ }
1222
+
1223
+ (function (factory) {
1224
+ {
1225
+ var v = factory(exports);
1226
+ if (v !== undefined) module.exports = v;
1227
+ }
1228
+ })(function (exports) {
1229
+ exports.EventSourcePolyfill = EventSourcePolyfill;
1230
+ exports.NativeEventSource = NativeEventSource;
1231
+ exports.EventSource = R;
1232
+ });
1233
+ }(typeof globalThis === 'undefined' ? (typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : commonjsGlobal) : globalThis));
1234
+ }(eventsource, eventsource.exports));
1235
+
188
1236
  const casinoChallengesContainerCss = ".challenges {\n container-type: inline-size;\n container-name: challenges-container;\n background-color: var(--emw--color-background, #000);\n padding: 16px 12px;\n min-height: 100vh;\n}\n.challenges__header {\n margin: 0 0 32px;\n display: flex;\n justify-content: space-between;\n}\n.challenges__title {\n margin: 0;\n display: flex;\n gap: 10px;\n align-items: center;\n font-size: var(--emw--font-size-x-large, 24px);\n font-weight: var(--emw--font-weight-bold, 700);\n color: var(--emw--color-white, #ffffff);\n}\n.challenges__tabs {\n display: flex;\n gap: 12px;\n border-radius: 48px;\n padding: 6px;\n color: var(--emw--color-gray-150, #c8d6ce);\n background-color: var(--emw--color-background-secondary, #272727);\n}\n.challenges__tab {\n padding: 10px 16px;\n border-radius: 40px;\n font-size: var(--emw--font-size-small, 14px);\n font-weight: var(--emw--font-weight-bold, 700);\n cursor: pointer;\n text-align: center;\n width: 95px;\n display: flex;\n justify-content: center;\n align-items: center;\n gap: 4px;\n}\n.challenges__tab.active {\n color: var(--emw--color-white, #ffffff);\n background: linear-gradient(90deg, rgb(0, 62, 92) 0%, rgb(17, 59, 33) 100%);\n}\n.challenges__tab:last-child {\n width: inherit;\n padding: 10px 16px;\n}\n@container challenges-container (max-width: 800px) {\n .challenges__header {\n margin: 0 0 16px;\n flex-wrap: wrap;\n row-gap: 12px;\n }\n .challenges__title {\n width: 100%;\n font-size: var(--emw--font-size-large, 20px);\n }\n .challenges__title img {\n height: 32px;\n }\n .challenges__tabs {\n width: 100%;\n gap: 8px;\n }\n .challenges__tab {\n flex: 1;\n padding: 5px 0;\n font-size: var(--emw--font-size-x-small, 12px);\n }\n .challenges__tab:last-child {\n width: inherit;\n padding: 5px 0;\n }\n}\n\n.notification {\n display: flex;\n position: absolute;\n z-index: 400;\n align-items: center;\n bottom: 90px;\n box-shadow: 0 0 20px 0 rgba(136, 143, 170, 0.15);\n border-radius: 8px;\n padding: 20px 16px;\n gap: 16px;\n right: 40px;\n max-width: 445px;\n box-sizing: border-box;\n background-color: var(--emw--background-success-color, #C9F0D7);\n border: 2px solid var(--emw--border-success-color, #00B74F);\n}\n.notification.errored {\n background: var(--emw--background-errored-color, #FFE1DF);\n border-color: var(--emw--color-error, #D6421E);\n}\n.notification__icon {\n width: 32px;\n height: 32px;\n}\n.notification__message {\n margin: 0;\n font-size: var(--emw--font-size-medium, 16px);\n font-weight: var(--emw--font-weight-bold, 700);\n}\n.notification__message .active-tab {\n color: var(--emw--border-success-color, #00B74F);\n text-decoration-line: underline;\n cursor: pointer;\n}\n@container challenges-container (max-width: 576px) {\n .notification {\n bottom: 60px;\n right: 12px;\n max-width: 290px;\n }\n}";
189
1237
  const CasinoChallengesContainerStyle0 = casinoChallengesContainerCss;
190
1238
 
191
1239
  const CasinoChallengesContainer = class {
192
1240
  constructor(hostRef) {
193
1241
  registerInstance(this, hostRef);
1242
+ this.activeProgressTabIndex = 0;
1243
+ this.pendingProgressTabIndex = 1;
194
1244
  this.onOpenNotification = (event) => {
195
1245
  this.notification = event.detail;
196
1246
  setTimeout(() => (this.notification = null), 10000);
@@ -209,7 +1259,7 @@ const CasinoChallengesContainer = class {
209
1259
  };
210
1260
  this.onLoadMore = () => {
211
1261
  this.pageNumber += 1;
212
- this.getChallenges().then((res) => {
1262
+ this.getChallenges(this.activeTabIndex).then((res) => {
213
1263
  this.total = res.TotalCount;
214
1264
  switch (this.activeTabIndex) {
215
1265
  case 0:
@@ -230,7 +1280,7 @@ const CasinoChallengesContainer = class {
230
1280
  this.activeTabIndex = index;
231
1281
  this.pageNumber = 0;
232
1282
  this.total = 0;
233
- this.loadData();
1283
+ this.loadData(index);
234
1284
  }
235
1285
  };
236
1286
  this.renderNotification = () => {
@@ -275,6 +1325,7 @@ const CasinoChallengesContainer = class {
275
1325
  this.total = 0;
276
1326
  this.pageSize = 20;
277
1327
  this.notification = null;
1328
+ this.sseConnection = undefined;
278
1329
  }
279
1330
  get tabs() {
280
1331
  var _a, _b;
@@ -285,15 +1336,29 @@ const CasinoChallengesContainer = class {
285
1336
  { label: translate('code', this.language) }
286
1337
  ];
287
1338
  }
1339
+ connectGameToLiveLobby() {
1340
+ if (EventSource && !this.sseConnection) {
1341
+ const updateUrl = `${this.endpoint}/v1/encoder/challenges/*/update`;
1342
+ this.sseConnection = new eventsource.exports.EventSourcePolyfill(updateUrl);
1343
+ this.sseConnection.addEventListener('message', this.handleEvent);
1344
+ }
1345
+ }
1346
+ disconnectGameFromLiveLobby() {
1347
+ if (this.sseConnection) {
1348
+ this.sseConnection.removeEventListener('message');
1349
+ this.sseConnection.close();
1350
+ this.sseConnection = undefined;
1351
+ }
1352
+ }
288
1353
  handleEvent(e) {
289
1354
  const { data } = e === null || e === void 0 ? void 0 : e.data;
290
1355
  switch (data === null || data === void 0 ? void 0 : data.messageType) {
291
1356
  case 'newProgressNotification': {
292
1357
  const newChallengeProgress = data === null || data === void 0 ? void 0 : data.challengeProgress;
293
- if (this.activeTabIndex === 0 && newChallengeProgress.Status === EChallengeProgressStatus.Started) {
1358
+ if (newChallengeProgress.Status === EChallengeProgressStatus.Started) {
294
1359
  this.activeChallenges = [newChallengeProgress, ...this.activeChallenges];
295
1360
  }
296
- else if (this.activeTabIndex === 1 && newChallengeProgress.Status === EChallengeProgressStatus.Awaiting) {
1361
+ else if (newChallengeProgress.Status === EChallengeProgressStatus.Awaiting) {
297
1362
  this.pendingChallenges = [newChallengeProgress, ...this.pendingChallenges];
298
1363
  }
299
1364
  break;
@@ -360,14 +1425,14 @@ const CasinoChallengesContainer = class {
360
1425
  }
361
1426
  handleSessionChange(newValue, oldValue) {
362
1427
  if (newValue != oldValue) {
363
- this.loadData();
1428
+ this.loadData(this.activeTabIndex);
364
1429
  }
365
1430
  }
366
- async getChallenges() {
1431
+ async getChallenges(tabIndex) {
367
1432
  if (!this.checkAttrs()) {
368
- const path = this.activeTabIndex === 2 ? 'PlayerHistory' : 'GetChallengesInfo';
1433
+ const path = tabIndex === 2 ? 'PlayerHistory' : 'GetChallengesInfo';
369
1434
  const url = `${this.endpoint}/challenge/${path}`;
370
- const body = Object.assign(Object.assign(Object.assign({ DomainId: this.domain, PlayerLanguage: this.language, PageNumber: this.pageNumber, PageSize: this.pageSize }, (this.session && { PlayerSession: this.session })), (this.userId && this.activeTabIndex === 2 && { UserId: this.userId })), (this.session && { IsFutureAvailable: this.activeTabIndex === 0 ? false : true }));
1435
+ const body = Object.assign(Object.assign(Object.assign({ DomainId: this.domain, PlayerLanguage: this.language, PageNumber: this.pageNumber, PageSize: this.pageSize }, (this.session && { PlayerSession: this.session })), (this.userId && tabIndex === 2 && { UserId: this.userId })), (this.session && { IsFutureAvailable: tabIndex === 0 ? false : true }));
371
1436
  this.loading = true;
372
1437
  return fetch(url, {
373
1438
  method: 'POST',
@@ -380,12 +1445,12 @@ const CasinoChallengesContainer = class {
380
1445
  .finally(() => (this.loading = false));
381
1446
  }
382
1447
  }
383
- loadData() {
384
- this.getChallenges().then((res) => {
1448
+ loadData(tabIndex) {
1449
+ this.getChallenges(tabIndex).then((res) => {
385
1450
  if (res === null || res === void 0 ? void 0 : res.Success) {
386
1451
  this.pageNumber = res.PageNumber;
387
1452
  this.total = res.TotalCount;
388
- switch (this.activeTabIndex) {
1453
+ switch (tabIndex) {
389
1454
  case 0:
390
1455
  this.activeChallenges = res.Data;
391
1456
  break;
@@ -408,15 +1473,18 @@ const CasinoChallengesContainer = class {
408
1473
  if (this.clientStylingUrl)
409
1474
  setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
410
1475
  }
411
- this.loadData();
1476
+ this.loadData(this.activeProgressTabIndex);
1477
+ this.loadData(this.pendingProgressTabIndex);
412
1478
  }
413
1479
  disconnectedCallback() {
414
1480
  this.stylingSubscription && this.stylingSubscription.unsubscribe();
1481
+ this.disconnectGameFromLiveLobby();
415
1482
  }
416
1483
  componentWillLoad() {
417
1484
  if (this.translationUrl) {
418
1485
  resolveTranslationUrl(this.translationUrl);
419
1486
  }
1487
+ this.connectGameToLiveLobby();
420
1488
  }
421
1489
  renderChallengesContent() {
422
1490
  var _a, _b, _c;
@@ -432,7 +1500,7 @@ const CasinoChallengesContainer = class {
432
1500
  }
433
1501
  }
434
1502
  render() {
435
- return (h("div", { key: 'da495376f9a27af317ec3da563aba200ce5a141f', ref: (el) => (this.stylingContainer = el) }, h("div", { key: '44b928986d3c2d80a4b077e61c142fb4edf82514', class: "challenges" }, h("div", { key: 'b6d9b3d52efdc960d8da1a9d9534d1e9920bca25', class: "challenges__header" }, h("h1", { key: '1f75bc0b171f9145e237b6fc99d93cdacbf35988', class: "challenges__title" }, h("img", { key: '34c10a8f15d7b432c9889bbc78c46cbebb640e8b', src: titleIconSvg, alt: "icon" }), translate('title', this.language)), this.session && (h("div", { key: '0e5f77413fae9fc3782095d06cb5bee4ddc33fc7', class: "challenges__tabs" }, this.tabs.map((tab, index) => (h("div", { class: `challenges__tab ${index === this.activeTabIndex ? 'active' : ''}`, onClick: this.handleTabClick(index) }, tab.label, (tab === null || tab === void 0 ? void 0 : tab.showNotification) && h("img", { src: notificationSvg }))))))), this.renderChallengesContent(), this.notification && this.renderNotification())));
1503
+ return (h("div", { key: '36461cd1f1f59990657e39d336140f09ae7438cb', ref: (el) => (this.stylingContainer = el) }, h("div", { key: '4669ebf93f74cd0d656aca08c3f9e0d326db4c3b', class: "challenges" }, h("div", { key: '995286f02b8270df171bdee774fd0fe5a308f617', class: "challenges__header" }, h("h1", { key: 'a8314d3f965fbf76e9d2b74605b5f1ab540147fe', class: "challenges__title" }, h("img", { key: '9a86217ff12d13c25455f8488767a42b0cc0ad15', src: titleIconSvg, alt: "icon" }), translate('title', this.language)), this.session && (h("div", { key: '94ce45066f951413fccceb22178396e1ab60dd4a', class: "challenges__tabs" }, this.tabs.map((tab, index) => (h("div", { class: `challenges__tab ${index === this.activeTabIndex ? 'active' : ''}`, onClick: this.handleTabClick(index) }, tab.label, (tab === null || tab === void 0 ? void 0 : tab.showNotification) && h("img", { src: notificationSvg }))))))), this.renderChallengesContent(), this.notification && this.renderNotification())));
436
1504
  }
437
1505
  static get watchers() { return {
438
1506
  "clientStyling": ["handleClientStylingChange"],