@everymatrix/casino-challenges-container 0.6.9 → 0.6.11

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