@vindral/web-sdk 4.1.2 → 4.1.3

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.
@@ -22,22 +22,22 @@ var wd = (s, e) => {
22
22
  e.indexOf(i) < 0 && Ad.call(s, i) && (t[i] = s[i]);
23
23
  return t;
24
24
  };
25
- var vi = (s) => {
25
+ var Si = (s) => {
26
26
  var e;
27
27
  return [, , , tm((e = s == null ? void 0 : s[ht("metadata")]) != null ? e : null)];
28
- }, bd = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], qn = (s) => s !== void 0 && typeof s != "function" ? kt("Function expected") : s, rm = (s, e, t, i, n) => ({ kind: bd[s], name: e, metadata: i, addInitializer: (o) => t._ ? kt("Already initialized") : n.push(qn(o || null)) }), zt = (s, e) => Za(e, ht("metadata"), s[3]), Si = (s, e, t, i) => {
28
+ }, bd = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], qn = (s) => s !== void 0 && typeof s != "function" ? kt("Function expected") : s, rm = (s, e, t, i, n) => ({ kind: bd[s], name: e, metadata: i, addInitializer: (o) => t._ ? kt("Already initialized") : n.push(qn(o || null)) }), Xt = (s, e) => Za(e, ht("metadata"), s[3]), Ei = (s, e, t, i) => {
29
29
  for (var n = 0, o = s[e >> 1], c = o && o.length; n < c; n++) e & 1 ? o[n].call(t) : i = o[n].call(t, i);
30
30
  return i;
31
31
  }, ye = (s, e, t, i, n, o) => {
32
- var c, h, d, m, p, g = e & 7, w = !!(e & 8), b = !!(e & 16), S = g > 3 ? s.length + 1 : g ? w ? 1 : 2 : 0, x = bd[g + 5], R = g > 3 && (s[S - 1] = []), M = s[S] || (s[S] = []), T = g && (!b && !w && (n = n.prototype), g < 5 && (g > 3 || !b) && sm(g < 4 ? n : { get [t]() {
32
+ var c, h, d, m, p, g = e & 7, w = !!(e & 8), b = !!(e & 16), S = g > 3 ? s.length + 1 : g ? w ? 1 : 2 : 0, P = bd[g + 5], B = g > 3 && (s[S - 1] = []), D = s[S] || (s[S] = []), T = g && (!b && !w && (n = n.prototype), g < 5 && (g > 3 || !b) && sm(g < 4 ? n : { get [t]() {
33
33
  return a(this, o);
34
34
  }, set [t](k) {
35
35
  return l(this, o, k);
36
36
  } }, t));
37
37
  g ? b && g < 4 && pd(o, (g > 2 ? "set " : g > 1 ? "get " : "") + t) : pd(n, t);
38
38
  for (var U = i.length - 1; U >= 0; U--)
39
- m = rm(g, t, d = {}, s[3], M), g && (m.static = w, m.private = b, p = m.access = { has: b ? (k) => am(n, k) : (k) => t in k }, g ^ 3 && (p.get = b ? (k) => (g ^ 1 ? a : A)(k, n, g ^ 4 ? o : T.get) : (k) => k[t]), g > 2 && (p.set = b ? (k, _) => l(k, n, _, g ^ 4 ? o : T.set) : (k, _) => k[t] = _)), h = (0, i[U])(g ? g < 4 ? b ? o : T[x] : g > 4 ? void 0 : { get: T.get, set: T.set } : n, m), d._ = 1, g ^ 4 || h === void 0 ? qn(h) && (g > 4 ? R.unshift(h) : g ? b ? o = h : T[x] = h : n = h) : typeof h != "object" || h === null ? kt("Object expected") : (qn(c = h.get) && (T.get = c), qn(c = h.set) && (T.set = c), qn(c = h.init) && R.unshift(c));
40
- return g || zt(s, n), T && Gc(n, t, T), b ? g ^ 4 ? o : T : n;
39
+ m = rm(g, t, d = {}, s[3], D), g && (m.static = w, m.private = b, p = m.access = { has: b ? (k) => am(n, k) : (k) => t in k }, g ^ 3 && (p.get = b ? (k) => (g ^ 1 ? a : A)(k, n, g ^ 4 ? o : T.get) : (k) => k[t]), g > 2 && (p.set = b ? (k, _) => l(k, n, _, g ^ 4 ? o : T.set) : (k, _) => k[t] = _)), h = (0, i[U])(g ? g < 4 ? b ? o : T[P] : g > 4 ? void 0 : { get: T.get, set: T.set } : n, m), d._ = 1, g ^ 4 || h === void 0 ? qn(h) && (g > 4 ? B.unshift(h) : g ? b ? o = h : T[P] = h : n = h) : typeof h != "object" || h === null ? kt("Object expected") : (qn(c = h.get) && (T.get = c), qn(c = h.set) && (T.set = c), qn(c = h.init) && B.unshift(c));
40
+ return g || Xt(s, n), T && Gc(n, t, T), b ? g ^ 4 ? o : T : n;
41
41
  }, r = (s, e, t) => Za(s, typeof e != "symbol" ? e + "" : e, t), jc = (s, e, t) => e.has(s) || kt("Cannot " + t), am = (s, e) => Object(e) !== e ? kt('Cannot use the "in" operator on this value') : s.has(e), a = (s, e, t) => (jc(s, e, "read from private field"), t ? t.call(s) : e.get(s)), u = (s, e, t) => e.has(s) ? kt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(s) : e.set(s, t), l = (s, e, t, i) => (jc(s, e, "write to private field"), i ? i.call(s, t) : e.set(s, t), t), A = (s, e, t) => (jc(s, e, "access private method"), t);
42
42
  var Ze = (s, e, t, i) => ({
43
43
  set _(n) {
@@ -95,8 +95,14 @@ var f = (s, e, t) => new Promise((i, n) => {
95
95
  var Ne = (s, e, t) => {
96
96
  if (e != null) {
97
97
  typeof e != "object" && typeof e != "function" && kt("Object expected");
98
- var i;
99
- t && (i = e[ht("asyncDispose")]), i === void 0 && (i = e[ht("dispose")]), typeof i != "function" && kt("Object not disposable"), s.push([t, i, e]);
98
+ var i, n;
99
+ t && (i = e[ht("asyncDispose")]), i === void 0 && (i = e[ht("dispose")], t && (n = i)), typeof i != "function" && kt("Object not disposable"), n && (i = function() {
100
+ try {
101
+ n.call(this);
102
+ } catch (o) {
103
+ return Promise.reject(o);
104
+ }
105
+ }), s.push([t, i, e]);
100
106
  } else t && s.push([t]);
101
107
  return e;
102
108
  }, Ve = (s, e, t) => {
@@ -114,8 +120,8 @@ var Ne = (s, e, t) => {
114
120
  };
115
121
  return o();
116
122
  };
117
- import { E as bi } from "./Bx7s5QdT.js";
118
- import { a as Xe, p as Au, i as wu, c as om, b as cm, A as hm, d as dm, t as um, e as lm } from "./hRzek83o.js";
123
+ import { E as yi } from "./Bx7s5QdT.js";
124
+ import { a as Xe, p as Au, i as wu, c as om, b as cm, A as hm, d as dm, t as um, e as lm } from "./Bs3ZbgIy.js";
119
125
  class yd {
120
126
  constructor(e) {
121
127
  r(this, "maxSize", 0);
@@ -150,7 +156,7 @@ class yd {
150
156
  return this._borrowedBuffers;
151
157
  }
152
158
  }
153
- const D = () => {
159
+ const O = () => {
154
160
  };
155
161
  class H {
156
162
  constructor() {
@@ -180,7 +186,7 @@ class H {
180
186
  }, this.reject = (i) => {
181
187
  this.pending = !1, t(i);
182
188
  };
183
- }), this.promise.catch(D);
189
+ }), this.promise.catch(O);
184
190
  }
185
191
  static resolved(e) {
186
192
  const t = new H();
@@ -245,7 +251,7 @@ class Dc {
245
251
  }
246
252
  abort(e) {
247
253
  var t, i;
248
- (t = a(this, $e)) == null || t.promise.catch(D), (i = a(this, $e)) == null || i.reject(e);
254
+ (t = a(this, $e)) == null || t.promise.catch(O), (i = a(this, $e)) == null || i.reject(e);
249
255
  }
250
256
  push(e) {
251
257
  return f(this, null, function* () {
@@ -296,7 +302,7 @@ function bu(s) {
296
302
  t[i] = e.charCodeAt(i);
297
303
  return t.buffer;
298
304
  }
299
- function B(s) {
305
+ function R(s) {
300
306
  return typeof BigInt == "function" ? BigInt(s) : s;
301
307
  }
302
308
  var Pr, ut, Ye;
@@ -368,7 +374,7 @@ const mm = new RegExp(
368
374
  }, Am = () => Ee.indexOf("CrKey") !== -1, vu = () => navigator.platform === "MacIntel" && navigator.maxTouchPoints === 0, Oc = () => navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, wm = () => Ee.indexOf("iphone") >= 0 && Ee.indexOf("like iphone") < 0 || Ee.indexOf("ipad") >= 0 && Ee.indexOf("like ipad") < 0 || Ee.indexOf("ipod") >= 0 && Ee.indexOf("like ipod") < 0 || Oc(), bm = () => {
369
375
  var s, e;
370
376
  return Oc() ? !1 : (e = (s = Cr()) == null ? void 0 : s.isTypeSupported('audio/mp4; codecs="opus"')) != null ? e : !1;
371
- }, cw = () => "ontouchstart" in window || navigator.maxTouchPoints > 0, ym = () => /^(?!.*chrome).*safari/i.test(Ee);
377
+ }, dw = () => "ontouchstart" in window || navigator.maxTouchPoints > 0, ym = () => /^(?!.*chrome).*safari/i.test(Ee);
372
378
  function vm() {
373
379
  var s, e;
374
380
  if (/(iPhone|iPod|iPad)/i.test(Ee))
@@ -407,13 +413,13 @@ const Su = () => {
407
413
  i = i * 256 + s[n];
408
414
  return i;
409
415
  };
410
- var ie, Ut, $t;
416
+ var ie, Ut, Jt;
411
417
  class zn {
412
418
  constructor(e) {
413
419
  u(this, ie);
414
420
  u(this, Ut);
415
- u(this, $t);
416
- l(this, Ut, e), l(this, $t, new DataView(e.buffer, e.byteOffset, e.byteLength)), l(this, ie, 0);
421
+ u(this, Jt);
422
+ l(this, Ut, e), l(this, Jt, new DataView(e.buffer, e.byteOffset, e.byteLength)), l(this, ie, 0);
417
423
  }
418
424
  position() {
419
425
  return a(this, ie);
@@ -428,19 +434,19 @@ class zn {
428
434
  return a(this, Ut).length - a(this, ie);
429
435
  }
430
436
  readUint8() {
431
- const e = a(this, $t).getUint8(a(this, ie));
437
+ const e = a(this, Jt).getUint8(a(this, ie));
432
438
  return l(this, ie, a(this, ie) + 1), e;
433
439
  }
434
440
  readUint24() {
435
- const e = a(this, $t).getUint32(a(this, ie)) >> 8 & 16777215;
441
+ const e = a(this, Jt).getUint32(a(this, ie)) >> 8 & 16777215;
436
442
  return l(this, ie, a(this, ie) + 3), e;
437
443
  }
438
444
  readUint16() {
439
- const e = a(this, $t).getUint16(a(this, ie));
445
+ const e = a(this, Jt).getUint16(a(this, ie));
440
446
  return l(this, ie, a(this, ie) + 2), e;
441
447
  }
442
448
  readUint32() {
443
- const e = a(this, $t).getUint32(a(this, ie));
449
+ const e = a(this, Jt).getUint32(a(this, ie));
444
450
  return l(this, ie, a(this, ie) + 4), e;
445
451
  }
446
452
  readUint64() {
@@ -462,7 +468,7 @@ class zn {
462
468
  return new TextDecoder().decode(new Uint8Array(e));
463
469
  }
464
470
  }
465
- ie = new WeakMap(), Ut = new WeakMap(), $t = new WeakMap();
471
+ ie = new WeakMap(), Ut = new WeakMap(), Jt = new WeakMap();
466
472
  class Em {
467
473
  constructor(e = 100, t = 100) {
468
474
  r(this, "resizeSteps");
@@ -548,7 +554,7 @@ class Es {
548
554
  }
549
555
  }
550
556
  }
551
- const Xn = (s) => s.reduce((e, t) => e + t, 0) / s.length, qt = (s) => ({
557
+ const Xn = (s) => s.reduce((e, t) => e + t, 0) / s.length, Yt = (s) => ({
552
558
  last: s[s.length - 1] || 0,
553
559
  average: s.length === 0 ? 0 : Xn(s),
554
560
  max: s.length === 0 ? 0 : Math.max(...s),
@@ -587,7 +593,7 @@ class Im {
587
593
  return this.rates.isEmpty() ? 0 : Xn(this.rates.items());
588
594
  }
589
595
  get minMaxAverage() {
590
- return qt(this.rates.items());
596
+ return Yt(this.rates.items());
591
597
  }
592
598
  }
593
599
  const Ss = (s, e) => {
@@ -601,12 +607,12 @@ const Ss = (s, e) => {
601
607
  }, vd = ["off", "error", "warn", "info", "debug", "trace"], Cm = {
602
608
  OFF: "off"
603
609
  };
604
- var Pi, xr, xi, Ws, zs;
605
- const Xt = class Xt {
610
+ var xi, xr, Li, Ws, zs;
611
+ const Zt = class Zt {
606
612
  constructor({ context: e, logLevel: t, debug: i }) {
607
- u(this, Pi, /* @__PURE__ */ new Map());
613
+ u(this, xi, /* @__PURE__ */ new Map());
608
614
  u(this, xr, "");
609
- u(this, xi, !1);
615
+ u(this, Li, !1);
610
616
  u(this, Ws, "off");
611
617
  r(this, "trace", (...e) => {
612
618
  });
@@ -622,11 +628,11 @@ const Xt = class Xt {
622
628
  });
623
629
  r(this, "count", (...e) => {
624
630
  });
625
- l(this, xr, e), l(this, Ws, t), l(this, xi, i || !1), this.setLevel(t), this.setDebug(a(this, xi));
631
+ l(this, xr, e), l(this, Ws, t), l(this, Li, i || !1), this.setLevel(t), this.setDebug(a(this, Li));
626
632
  }
627
633
  setDebug(e) {
628
- l(this, xi, e);
629
- for (const [t, i] of a(this, Pi))
634
+ l(this, Li, e);
635
+ for (const [t, i] of a(this, xi))
630
636
  i.setDebug(e);
631
637
  e ? (this.table = console.table.bind(console), this.count = console.count.bind(console)) : (this.table = () => {
632
638
  }, this.count = () => {
@@ -634,7 +640,7 @@ const Xt = class Xt {
634
640
  }
635
641
  setLevel(e) {
636
642
  l(this, Ws, e);
637
- for (const [i, n] of a(this, Pi))
643
+ for (const [i, n] of a(this, xi))
638
644
  n.setLevel(e);
639
645
  const t = vd.indexOf(e);
640
646
  for (const [i, n] of vd.entries())
@@ -649,19 +655,19 @@ const Xt = class Xt {
649
655
  });
650
656
  }
651
657
  createContext(e) {
652
- const t = a(this, Pi).get(e);
658
+ const t = a(this, xi).get(e);
653
659
  if (!t) {
654
- const i = new Xt({ context: `${e}`, logLevel: a(this, Ws), debug: a(this, xi) });
655
- return a(this, Pi).set(e, i), i;
660
+ const i = new Zt({ context: `${e}`, logLevel: a(this, Ws), debug: a(this, Li) });
661
+ return a(this, xi).set(e, i), i;
656
662
  }
657
663
  return t;
658
664
  }
659
665
  static get() {
660
- return a(Xt, zs) || l(Xt, zs, new Xt({ context: "Vindral", logLevel: "off" })), a(Xt, zs);
666
+ return a(Zt, zs) || l(Zt, zs, new Zt({ context: "Vindral", logLevel: "off" })), a(Zt, zs);
661
667
  }
662
668
  };
663
- Pi = new WeakMap(), xr = new WeakMap(), xi = new WeakMap(), Ws = new WeakMap(), zs = new WeakMap(), u(Xt, zs);
664
- let ge = Xt;
669
+ xi = new WeakMap(), xr = new WeakMap(), Li = new WeakMap(), Ws = new WeakMap(), zs = new WeakMap(), u(Zt, zs);
670
+ let ge = Zt;
665
671
  function Pe(s) {
666
672
  const e = ge.get().createContext(s.context);
667
673
  return function(i, n) {
@@ -710,31 +716,31 @@ class km {
710
716
  Lr = new WeakSet(), ah = function() {
711
717
  this.unlocker.resolve(this.value);
712
718
  };
713
- var Li, Di;
719
+ var Di, Oi;
714
720
  class Bm {
715
721
  constructor(e) {
716
- u(this, Li);
717
- u(this, Di, new H());
718
- l(this, Li, e), a(this, Di).resolve(e);
722
+ u(this, Di);
723
+ u(this, Oi, new H());
724
+ l(this, Di, e), a(this, Oi).resolve(e);
719
725
  }
720
726
  unsafeValue() {
721
- return a(this, Li);
727
+ return a(this, Di);
722
728
  }
723
729
  isLocked() {
724
- return a(this, Di).pending;
730
+ return a(this, Oi).pending;
725
731
  }
726
732
  lock() {
727
733
  return f(this, null, function* () {
728
734
  const e = new H();
729
735
  e.promise.then((i) => {
730
- l(this, Li, i);
731
- }).catch(D);
732
- const t = a(this, Di).promise.then(() => e);
733
- return l(this, Di, e), yield t, new km(a(this, Li), e);
736
+ l(this, Di, i);
737
+ }).catch(O);
738
+ const t = a(this, Oi).promise.then(() => e);
739
+ return l(this, Oi, e), yield t, new km(a(this, Di), e);
734
740
  });
735
741
  }
736
742
  }
737
- Li = new WeakMap(), Di = new WeakMap();
743
+ Di = new WeakMap(), Oi = new WeakMap();
738
744
  var je, Je;
739
745
  class Ie {
740
746
  constructor(e) {
@@ -800,14 +806,14 @@ const Sd = (s, e) => {
800
806
  return typeof t != "object" || e.forEach((i) => {
801
807
  delete t[i];
802
808
  }), t;
803
- }, Ii = (s, e = Date.now()) => {
809
+ }, Ci = (s, e = Date.now()) => {
804
810
  const t = s.length;
805
811
  if (t > 0) {
806
812
  const i = t - 1, n = s[i];
807
813
  n.end || (n.end = e);
808
814
  }
809
815
  }, Ts = (s, e = Date.now()) => {
810
- Ii(s), s.push({ start: e });
816
+ Ci(s), s.push({ start: e });
811
817
  }, Is = (s) => s.reduce((e, t) => {
812
818
  var i;
813
819
  return e + (((i = t.end) != null ? i : Date.now()) - t.start);
@@ -854,13 +860,13 @@ function Tu(s) {
854
860
  const Td = () => {
855
861
  const s = [...Array(256).keys()].map((t) => t.toString(16).padStart(2, "0")), e = crypto.getRandomValues(new Uint8Array(16));
856
862
  return e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128, [...e.entries()].map(([t, i]) => [4, 6, 8, 10].includes(t) ? `-${s[i]}` : s[i]).join("");
857
- }, gs = (s) => f(void 0, null, function* () {
863
+ }, gs = (s) => f(null, null, function* () {
858
864
  return new Promise((e) => setTimeout(e, s));
859
- }), id = (t, ...i) => f(void 0, [t, ...i], function* (s, e = new Error("Timeout")) {
865
+ }), id = (t, ...i) => f(null, [t, ...i], function* (s, e = new Error("Timeout")) {
860
866
  return new Promise((n, o) => setTimeout(() => o(e), s));
861
- }), Rm = (s, e) => f(void 0, null, function* () {
867
+ }), Rm = (s, e) => f(null, null, function* () {
862
868
  throw yield s, new Error(e);
863
- }), fs = (s) => "width" in s && typeof s.width == "number", ps = (s) => "sampleRate" in s && typeof s.sampleRate == "number", Ui = (s) => {
869
+ }), fs = (s) => "width" in s && typeof s.width == "number", ps = (s) => "sampleRate" in s && typeof s.sampleRate == "number", Pi = (s) => {
864
870
  switch (s.codec) {
865
871
  case "opus":
866
872
  return 'audio/mp4; codecs="opus"';
@@ -875,7 +881,7 @@ const Td = () => {
875
881
  case "av1":
876
882
  return s.codecString ? `video/mp4; codecs="${s.codecString}"` : "video/mp4";
877
883
  }
878
- }, wi = () => Number.MAX_SAFE_INTEGER, co = () => ({
884
+ }, bi = () => Number.MAX_SAFE_INTEGER, co = () => ({
879
885
  width: Number.MAX_SAFE_INTEGER,
880
886
  height: Number.MAX_SAFE_INTEGER
881
887
  }), Id = (s) => !(typeof s != "object" || s === null || !("type" in s)), Um = {
@@ -890,8 +896,8 @@ const Td = () => {
890
896
  maxBufferTime: 1500,
891
897
  logLevel: Cm.OFF,
892
898
  maxSize: co(),
893
- maxVideoBitRate: wi(),
894
- maxAudioBitRate: wi(),
899
+ maxVideoBitRate: bi(),
900
+ maxAudioBitRate: bi(),
895
901
  tags: [],
896
902
  media: "audio+video",
897
903
  poster: !0,
@@ -911,7 +917,7 @@ const Td = () => {
911
917
  videoCodecs: ["av1", "h264"],
912
918
  webtransportEnabled: !0
913
919
  }, Pm = "connection_failed", xm = "connection_failed_will_not_attempt_again", Lm = "authentication_error", Dm = "authentication_expired", Om = "channel_not_found", Mm = "no_incoming_data_error", Fm = "connection_inactivity", _m = "missing_init_segment", Nm = "no_track_context", Vm = "invalid_track_context_state", Gm = "disconnected_by_edge", jm = "decoder_error", Wm = "audio_player_error", zm = "media_source_error", Hm = "webgl_context_lost_error", Xm = "access_forbidden", Qm = "channel_switch_failed", Zm = "drm_error";
914
- class P extends Error {
920
+ class x extends Error {
915
921
  constructor(t, i, n = {}) {
916
922
  super(t);
917
923
  r(this, "props");
@@ -953,44 +959,44 @@ class P extends Error {
953
959
  this.props = i, this.extra = n, Object.setPrototypeOf(this, new.target.prototype);
954
960
  }
955
961
  }
956
- const qm = (s, e) => new P(
962
+ const qm = (s, e) => new x(
957
963
  "MediaElement Error",
958
964
  { isFatal: s, code: "media_element_error", source: e },
959
965
  { mediaErrorCode: e.code }
960
- ), $m = (s, e) => new P("Decoder Error", { isFatal: s, code: jm, source: e, type: "internal" }), Iu = (s, e) => new P("Audio Player Error", { isFatal: s, code: Wm, source: e, type: "internal" }), Ym = (s, e) => new P(`No init segment for rendition id ${s} for channel ${e}`, {
966
+ ), $m = (s, e) => new x("Decoder Error", { isFatal: s, code: jm, source: e, type: "internal" }), Iu = (s, e) => new x("Audio Player Error", { isFatal: s, code: Wm, source: e, type: "internal" }), Ym = (s, e) => new x(`No init segment for rendition id ${s} for channel ${e}`, {
961
967
  isFatal: !1,
962
968
  code: _m,
963
969
  type: "internal"
964
- }), Cd = (s, e, t, i) => new P(
970
+ }), Cd = (s, e, t, i) => new x(
965
971
  "MediaSource Error",
966
972
  { isFatal: s, code: zm, source: e, type: "internal" },
967
973
  { type: i, consecutiveErrorsCount: t }
968
- ), qa = (s, e) => new P(`No track context for ${s}${e ? `, rendition id ${e}` : ""}`, {
974
+ ), qa = (s, e) => new x(`No track context for ${s}${e ? `, rendition id ${e}` : ""}`, {
969
975
  isFatal: !1,
970
976
  code: Nm,
971
977
  type: "internal"
972
- }), Jm = (s, e) => new P(
978
+ }), Jm = (s, e) => new x(
973
979
  `Track context is in an invalid state for ${s}${e ? `, rendition id ${e}` : ""}`,
974
980
  {
975
981
  isFatal: !1,
976
982
  code: Vm,
977
983
  type: "internal"
978
984
  }
979
- ), Km = () => new P("Web Audio Context resume timeout", { isFatal: !1, code: "web_audio_context_resume_timeout" }), $n = (s) => new P("Disconnected From Edge Server", {
985
+ ), Km = () => new x("Web Audio Context resume timeout", { isFatal: !1, code: "web_audio_context_resume_timeout" }), $n = (s) => new x("Disconnected From Edge Server", {
980
986
  type: "external",
981
987
  source: s,
982
988
  isFatal: !1,
983
989
  code: Gm
984
- }), ho = (s) => new P("Authentication Failed", { isFatal: !0, code: Lm, source: s }), ef = (s) => new P("Authentication Expired", { isFatal: !0, code: Dm, source: s }), tf = (s, e) => new P("Connection closed due to inactivity", { isFatal: !1, code: Fm, source: e, type: s }), Cu = (s, e) => new P("Channel not found", { isFatal: !1, code: Om, source: e, type: s }), sf = (s) => new P("No Incoming Data", { isFatal: !1, code: Mm, source: s }), nf = (s) => new P("Connection attempt failed", {
990
+ }), ho = (s) => new x("Authentication Failed", { isFatal: !0, code: Lm, source: s }), ef = (s) => new x("Authentication Expired", { isFatal: !0, code: Dm, source: s }), tf = (s, e) => new x("Connection closed due to inactivity", { isFatal: !1, code: Fm, source: e, type: s }), Cu = (s, e) => new x("Channel not found", { isFatal: !1, code: Om, source: e, type: s }), sf = (s) => new x("No Incoming Data", { isFatal: !1, code: Mm, source: s }), nf = (s) => new x("Connection attempt failed", {
985
991
  isFatal: !1,
986
992
  code: Pm,
987
993
  source: s
988
- }), ku = () => new P("Connection failed - no more reconnect attempts", {
994
+ }), ku = () => new x("Connection failed - no more reconnect attempts", {
989
995
  isFatal: !0,
990
996
  code: xm
991
- }), rf = (s) => new P("WebGL Context Lost", { isFatal: !1, code: Hm, source: s, type: "internal" }), kd = (s) => new P(s, { isFatal: !0, code: Xm }), Bd = (s) => new P(`Channel switch to '${s}' failed`, { isFatal: !1, code: Qm }), Bu = (s, e = !1, t) => new P(s, { isFatal: e, code: Zm, source: t }), Rd = (s, e) => s && typeof s == "object" && e in s, af = (s) => !(typeof s != "object" || !Rd(s, "channelId") || typeof s.channelId != "string" || !Rd(s, "url") || typeof s.url != "string" || s.channelId.length === 0 || s.url.length === 0), of = (s) => {
997
+ }), rf = (s) => new x("WebGL Context Lost", { isFatal: !1, code: Hm, source: s, type: "internal" }), kd = (s) => new x(s, { isFatal: !0, code: Xm }), Bd = (s) => new x(`Channel switch to '${s}' failed`, { isFatal: !1, code: Qm }), Bu = (s, e = !1, t) => new x(s, { isFatal: e, code: Zm, source: t }), Rd = (s, e) => s && typeof s == "object" && e in s, af = (s) => !(typeof s != "object" || !Rd(s, "channelId") || typeof s.channelId != "string" || !Rd(s, "url") || typeof s.url != "string" || s.channelId.length === 0 || s.url.length === 0), of = (s) => {
992
998
  if (!af(s))
993
- throw new P("Invalid options", { isFatal: !0, code: "invalid_options" });
999
+ throw new x("Invalid options", { isFatal: !0, code: "invalid_options" });
994
1000
  const e = v({}, s);
995
1001
  return Object.keys(e).forEach((t) => {
996
1002
  const i = e;
@@ -1037,10 +1043,10 @@ const qm = (s, e) => new P(
1037
1043
  keySystem: "org.w3.clearkey",
1038
1044
  supportedConfig: zc
1039
1045
  }
1040
- }, Ru = (s, e) => f(void 0, null, function* () {
1046
+ }, Ru = (s, e) => f(null, null, function* () {
1041
1047
  return navigator.requestMediaKeySystemAccess(s, [e]).catch(() => {
1042
1048
  });
1043
- }), Pd = (s, e, t, i, n, o) => f(void 0, null, function* () {
1049
+ }), Pd = (s, e, t, i, n, o) => f(null, null, function* () {
1044
1050
  let c;
1045
1051
  for (const h of i) {
1046
1052
  const d = t == null ? void 0 : t.map((p) => F(v({}, p), {
@@ -1055,7 +1061,7 @@ const qm = (s, e) => new P(
1055
1061
  c = d;
1056
1062
  }
1057
1063
  return c;
1058
- }), hf = (s, e, t, i) => f(void 0, null, function* () {
1064
+ }), hf = (s, e, t, i) => f(null, null, function* () {
1059
1065
  const { keySystem: n, supportedConfig: o } = cf[s], { initDataTypes: c, videoCapabilities: h, audioCapabilities: d } = o, m = i == null ? void 0 : i[s], p = (m == null ? void 0 : m.videoRobustness) || Ud[s], g = (m == null ? void 0 : m.audioRobustness) || Ud[s], [w, b] = yield Promise.all([
1060
1066
  Pd(
1061
1067
  n,
@@ -1079,7 +1085,7 @@ const qm = (s, e) => new P(
1079
1085
  videoCapabilities: w,
1080
1086
  audioCapabilities: b
1081
1087
  });
1082
- }), df = (s, e, t, i) => f(void 0, null, function* () {
1088
+ }), df = (s, e, t, i) => f(null, null, function* () {
1083
1089
  let n;
1084
1090
  for (const o of s)
1085
1091
  if (n = yield hf(o, e, t, i), n)
@@ -1088,7 +1094,7 @@ const qm = (s, e) => new P(
1088
1094
  mediaKeySystemAccess: n
1089
1095
  };
1090
1096
  });
1091
- var Oi, Mi;
1097
+ var Mi, Fi;
1092
1098
  class Mc {
1093
1099
  constructor(e, t, i, n) {
1094
1100
  r(this, "keySystem");
@@ -1096,20 +1102,20 @@ class Mc {
1096
1102
  r(this, "certificate");
1097
1103
  r(this, "headers", {});
1098
1104
  r(this, "queryParams", {});
1099
- u(this, Oi);
1100
1105
  u(this, Mi);
1101
- l(this, Oi, t), this.keySystem = e, this.licenseServerUrl = i, this.certificate = n;
1106
+ u(this, Fi);
1107
+ l(this, Mi, t), this.keySystem = e, this.licenseServerUrl = i, this.certificate = n;
1102
1108
  }
1103
1109
  get statistics() {
1104
1110
  return {
1105
- keySystem: a(this, Oi).keySystem,
1111
+ keySystem: a(this, Mi).keySystem,
1106
1112
  licenseServerUrl: this.licenseServerUrl,
1107
- mediaKeySystemConfiguration: a(this, Oi).getConfiguration()
1113
+ mediaKeySystemConfiguration: a(this, Mi).getConfiguration()
1108
1114
  };
1109
1115
  }
1110
1116
  getMediaKeys() {
1111
1117
  return f(this, null, function* () {
1112
- return a(this, Mi) ? a(this, Mi) : (l(this, Mi, yield a(this, Oi).createMediaKeys()), a(this, Mi));
1118
+ return a(this, Fi) ? a(this, Fi) : (l(this, Fi, yield a(this, Mi).createMediaKeys()), a(this, Fi));
1113
1119
  });
1114
1120
  }
1115
1121
  requestLicense(e) {
@@ -1130,7 +1136,7 @@ class Mc {
1130
1136
  });
1131
1137
  }
1132
1138
  }
1133
- Oi = new WeakMap(), Mi = new WeakMap();
1139
+ Mi = new WeakMap(), Fi = new WeakMap();
1134
1140
  function Uu(s) {
1135
1141
  const e = window.atob(s.replace(/-/g, "+").replace(/_/g, "/"));
1136
1142
  let t = "";
@@ -1192,8 +1198,8 @@ const pf = (s) => {
1192
1198
  if (i) {
1193
1199
  const g = i.getElementsByTagName("name"), w = i.getElementsByTagName("value");
1194
1200
  for (let b = 0; b < g.length; b++) {
1195
- const S = (h = g[b]) == null ? void 0 : h.childNodes[0], x = (d = w[b]) == null ? void 0 : d.childNodes[0];
1196
- S != null && S.nodeValue && x && x.nodeValue && (n[S.nodeValue] = x.nodeValue);
1201
+ const S = (h = g[b]) == null ? void 0 : h.childNodes[0], P = (d = w[b]) == null ? void 0 : d.childNodes[0];
1202
+ S != null && S.nodeValue && P && P.nodeValue && (n[S.nodeValue] = P.nodeValue);
1197
1203
  }
1198
1204
  }
1199
1205
  const o = t.getElementsByTagName("Challenge")[0];
@@ -1233,18 +1239,18 @@ class Af extends Mc {
1233
1239
  }
1234
1240
  }
1235
1241
  const wf = 5e3;
1236
- var G, Fi, Pt, Ke, lt, de, Yt, Jt, Go, Hs, Or, Mr, ne, Pu, xu, Lu, Du, jo, Wo, Ou, Kn, zo, Mu, Fu;
1242
+ var G, _i, Pt, Ke, lt, de, Kt, ei, Go, Hs, Or, Mr, ne, Pu, xu, Lu, Du, jo, Wo, Ou, Kn, zo, Mu, Fu;
1237
1243
  class xd {
1238
1244
  constructor(e, t, i = {}) {
1239
1245
  u(this, ne);
1240
1246
  u(this, G);
1241
- u(this, Fi);
1247
+ u(this, _i);
1242
1248
  u(this, Pt);
1243
1249
  u(this, Ke, new H());
1244
1250
  u(this, lt);
1245
1251
  u(this, de);
1246
- u(this, Yt, /* @__PURE__ */ new Map());
1247
- u(this, Jt);
1252
+ u(this, Kt, /* @__PURE__ */ new Map());
1253
+ u(this, ei);
1248
1254
  u(this, Go, Su());
1249
1255
  /**
1250
1256
  * Timeout to wait for new drm data when channel switch happens
@@ -1264,7 +1270,7 @@ class xd {
1264
1270
  var o, c;
1265
1271
  a(this, G).debug("Session message received", { event: e });
1266
1272
  const t = e.target, i = e.message;
1267
- if (!a(this, Yt).get(t)) {
1273
+ if (!a(this, Kt).get(t)) {
1268
1274
  a(this, G).error("No active session found for event", { event: e });
1269
1275
  return;
1270
1276
  }
@@ -1303,7 +1309,7 @@ class xd {
1303
1309
  let c = null;
1304
1310
  return n === "clearkey" ? (Xe(e.clearkeys, "No clearkeys found"), c = new mf(o, e.clearkeys)) : n === "playready" ? (Xe(e.playreadyLicenseUrl, "No playreadyLicenseUrl found"), c = new gf(o, e.playreadyLicenseUrl)) : n === "widevine" ? (Xe(e.widevineLicenseUrl, "No widevineLicenseUrl found"), c = new Af(o, e.widevineLicenseUrl)) : n === "fairplay" && (Xe(e.fairplayLicenseUrl, "No fairplayLicenseUrl found"), Xe(e.fairplayCertificate, "No fairplayCertificate found"), c = new ff(o, e.fairplayLicenseUrl, e.fairplayCertificate)), c && (c.headers = a(this, lt).headers || {}, c.queryParams = a(this, lt).queryParams || {}), c;
1305
1311
  }));
1306
- l(this, Fi, e), l(this, G, t), l(this, lt, i), a(this, Fi).on("received drm data", a(this, Or));
1312
+ l(this, _i, e), l(this, G, t), l(this, lt, i), a(this, _i).on("received drm data", a(this, Or));
1307
1313
  }
1308
1314
  static isSupported() {
1309
1315
  return !!navigator.requestMediaKeySystemAccess;
@@ -1317,9 +1323,9 @@ class xd {
1317
1323
  }
1318
1324
  unload() {
1319
1325
  var e;
1320
- a(this, G).info("Unloading EncryptedMediaExtensions"), a(this, Fi).off("received drm data", a(this, Or)), (e = a(this, Pt)) == null || e.removeEventListener("encrypted", a(this, Mr)), a(this, Yt).forEach((t, i) => {
1326
+ a(this, G).info("Unloading EncryptedMediaExtensions"), a(this, _i).off("received drm data", a(this, Or)), (e = a(this, Pt)) == null || e.removeEventListener("encrypted", a(this, Mr)), a(this, Kt).forEach((t, i) => {
1321
1327
  i.close();
1322
- }), a(this, Yt).clear(), l(this, Jt, void 0), l(this, de, void 0);
1328
+ }), a(this, Kt).clear(), l(this, ei, void 0), l(this, de, void 0);
1323
1329
  }
1324
1330
  set headers(e) {
1325
1331
  a(this, lt).headers = e, a(this, de) && (a(this, de).headers = e);
@@ -1342,7 +1348,7 @@ class xd {
1342
1348
  }, wf));
1343
1349
  }
1344
1350
  }
1345
- G = new WeakMap(), Fi = new WeakMap(), Pt = new WeakMap(), Ke = new WeakMap(), lt = new WeakMap(), de = new WeakMap(), Yt = new WeakMap(), Jt = new WeakMap(), Go = new WeakMap(), Hs = new WeakMap(), Or = new WeakMap(), Mr = new WeakMap(), ne = new WeakSet(), Pu = function(e) {
1351
+ G = new WeakMap(), _i = new WeakMap(), Pt = new WeakMap(), Ke = new WeakMap(), lt = new WeakMap(), de = new WeakMap(), Kt = new WeakMap(), ei = new WeakMap(), Go = new WeakMap(), Hs = new WeakMap(), Or = new WeakMap(), Mr = new WeakMap(), ne = new WeakSet(), Pu = function(e) {
1346
1352
  return f(this, null, function* () {
1347
1353
  try {
1348
1354
  yield A(this, ne, xu).call(this), a(this, G).debug("Media keys initialization completed"), yield A(this, ne, Lu).call(this, e.initData, e.initDataType);
@@ -1359,16 +1365,16 @@ G = new WeakMap(), Fi = new WeakMap(), Pt = new WeakMap(), Ke = new WeakMap(), l
1359
1365
  a(this, G).debug("Media keys already set on media element");
1360
1366
  return;
1361
1367
  }
1362
- if (a(this, Jt)) {
1363
- a(this, G).debug("Media keys initialization already in progress, waiting for completion"), yield a(this, Jt);
1368
+ if (a(this, ei)) {
1369
+ a(this, G).debug("Media keys initialization already in progress, waiting for completion"), yield a(this, ei);
1364
1370
  return;
1365
1371
  }
1366
- l(this, Jt, f(this, null, function* () {
1372
+ l(this, ei, f(this, null, function* () {
1367
1373
  const i = yield a(this, zo).call(this, e);
1368
1374
  a(this, G).debug("CDM obtained", { cdm: i }), Xe(a(this, Pt), "No media element found"), Xe(i, "No CDM found");
1369
1375
  const n = yield i.getMediaKeys();
1370
1376
  i.certificate && (yield A(this, ne, Ou).call(this, n, i.certificate)), a(this, G).debug("Setting media keys on media element"), yield a(this, Pt).setMediaKeys(n), l(this, de, i);
1371
- })), yield a(this, Jt);
1377
+ })), yield a(this, ei);
1372
1378
  });
1373
1379
  }, Lu = function(e, t) {
1374
1380
  return f(this, null, function* () {
@@ -1381,10 +1387,10 @@ G = new WeakMap(), Fi = new WeakMap(), Pt = new WeakMap(), Ke = new WeakMap(), l
1381
1387
  const n = i.createSession();
1382
1388
  a(this, G).debug("Creating new session", { session: n }), n.addEventListener("keystatuseschange", a(this, Wo)), n.closed.then((o) => {
1383
1389
  a(this, G).info("Session is closed", { reason: o });
1384
- }), n.addEventListener("message", a(this, jo)), a(this, Yt).set(n, e), a(this, G).debug("Generating request for session", { session: n, initDataType: t, initData: e }), yield n.generateRequest(t, e);
1390
+ }), n.addEventListener("message", a(this, jo)), a(this, Kt).set(n, e), a(this, G).debug("Generating request for session", { session: n, initDataType: t, initData: e }), yield n.generateRequest(t, e);
1385
1391
  });
1386
1392
  }, Du = function(e) {
1387
- for (const [t, i] of a(this, Yt))
1393
+ for (const [t, i] of a(this, Kt))
1388
1394
  if (lf(e, i)) return !1;
1389
1395
  return !0;
1390
1396
  }, jo = new WeakMap(), Wo = new WeakMap(), Ou = function(e, t) {
@@ -1397,7 +1403,7 @@ G = new WeakMap(), Fi = new WeakMap(), Pt = new WeakMap(), Ke = new WeakMap(), l
1397
1403
  });
1398
1404
  }, Kn = function(e) {
1399
1405
  const { message: t, isFatal: i, error: n } = e;
1400
- a(this, G).error(t, { error: n }), a(this, Fi).emit("error", Bu(t, i, n));
1406
+ a(this, G).error(t, { error: n }), a(this, _i).emit("error", Bu(t, i, n));
1401
1407
  }, zo = new WeakMap(), /**
1402
1408
  * Get the prioritized key system list based on the DRM data provided.
1403
1409
  * The order of the key systems in the list is the order in which they will be tried.
@@ -1468,7 +1474,7 @@ const bf = 7, yf = 8, vf = (s) => {
1468
1474
  }), { sequenceParameterSets: e, pictureParameterSets: t };
1469
1475
  }, If = (s) => {
1470
1476
  var S;
1471
- const e = new DataView(s), t = e.getUint8(1), i = e.getUint8(2), n = e.getUint8(3), o = new yu(s, 4 * 8);
1477
+ const e = new DataView(s), t = e.getUint8(1), i = e.getUint8(2), n = e.getUint8(3), o = new yu(s, 32);
1472
1478
  o.readUnsignedExpGolomb();
1473
1479
  let c = 1;
1474
1480
  switch (t) {
@@ -1484,9 +1490,9 @@ const bf = 7, yf = 8, vf = (s) => {
1484
1490
  case 138:
1485
1491
  case 144: {
1486
1492
  if (c = o.readUnsignedExpGolomb(), c === 3 && o.readBits(1), o.readUnsignedExpGolomb() + 8, o.readUnsignedExpGolomb() + 8, o.readBit(), o.readBit()) {
1487
- for (let R = 0; R < (c != 3 ? 8 : 12); R++)
1493
+ for (let B = 0; B < (c != 3 ? 8 : 12); B++)
1488
1494
  if (o.readBit()) {
1489
- const T = R < 6 ? 16 : 64;
1495
+ const T = B < 6 ? 16 : 64;
1490
1496
  let U = 0, k = 8, _ = 8;
1491
1497
  for (let ce = 0; ce < T; ce++)
1492
1498
  _ != 0 && (U = o.readSignedExpGolomb(), _ = (k + U + 256) % 256), k = _ == 0 ? k : _;
@@ -1506,7 +1512,7 @@ const bf = 7, yf = 8, vf = (s) => {
1506
1512
  p === 0 && o.readBit(), o.readBit();
1507
1513
  let g = d + 1, w = m + 1;
1508
1514
  if (w *= 2 - p, w *= 16, g *= 16, o.readBit()) {
1509
- const x = c == 1 ? 1 : 0, M = 1 << (c == 1 || c == 2 ? 1 : 0), T = 2 - p << x, U = o.readUnsignedExpGolomb() * M, k = o.readUnsignedExpGolomb() * M, _ = o.readUnsignedExpGolomb() * T, ce = o.readUnsignedExpGolomb() * T;
1515
+ const P = c == 1 ? 1 : 0, D = 1 << (c == 1 || c == 2 ? 1 : 0), T = 2 - p << P, U = o.readUnsignedExpGolomb() * D, k = o.readUnsignedExpGolomb() * D, _ = o.readUnsignedExpGolomb() * T, ce = o.readUnsignedExpGolomb() * T;
1510
1516
  g -= U + k, w -= _ + ce;
1511
1517
  }
1512
1518
  let b = {
@@ -1542,7 +1548,7 @@ const bf = 7, yf = 8, vf = (s) => {
1542
1548
  ], kf = 184549376;
1543
1549
  function Bf(s) {
1544
1550
  const e = new zn(s), t = Rf(e);
1545
- t.flags & kf && Uf(e);
1551
+ (t.flags & kf) !== 0 && Uf(e);
1546
1552
  const i = Pf(e);
1547
1553
  if (String.fromCharCode(...i.frameId) === "TXXX") {
1548
1554
  const o = new zn(e.readBytes(i.size));
@@ -1598,7 +1604,7 @@ function Lf(s, e) {
1598
1604
  const n = s.decodeData(i);
1599
1605
  return i.readRemaining(), n;
1600
1606
  }
1601
- function Wt(s) {
1607
+ function Ht(s) {
1602
1608
  const e = s.readUint8(), t = s.readUint24();
1603
1609
  return {
1604
1610
  version: e,
@@ -1628,7 +1634,7 @@ const xs = class xs {
1628
1634
  this.timescale = e, this.presentationTime = t, this.presentationTimeDelta = i, this.schemeIdUri = n, this.value = o, this.eventDuration = c, this.id = h, this.data = d;
1629
1635
  }
1630
1636
  static decodeData(e) {
1631
- const { version: t } = Wt(e);
1637
+ const { version: t } = Ht(e);
1632
1638
  switch (t) {
1633
1639
  case 1: {
1634
1640
  const i = e.readUint32(), n = e.readUint64(), o = e.readUint32(), c = e.readUint32(), h = e.readUtf8String(), d = e.readUtf8String(), m = e.remaining(), p = e.readBytes(m);
@@ -1678,7 +1684,7 @@ const or = class or {
1678
1684
  this.extra = e, this.byteOffset = t, this.baseMediaDecodeTime = i;
1679
1685
  }
1680
1686
  static decodeData(e) {
1681
- const t = Wt(e), i = e.byteOffset();
1687
+ const t = Ht(e), i = e.byteOffset();
1682
1688
  let n = 0;
1683
1689
  return t.version === 1 ? n = e.readUint64() : n = e.readUint32(), new or(t, i, n);
1684
1690
  }
@@ -1705,7 +1711,7 @@ const K = class K {
1705
1711
  return (this.firstSampleFlags & t) === 0;
1706
1712
  }
1707
1713
  static decodeData(e) {
1708
- const { flags: t } = Wt(e), i = e.readUint32();
1714
+ const { flags: t } = Ht(e), i = e.readUint32();
1709
1715
  let n, o;
1710
1716
  t & K.TRUN_DATA_OFFSET && (n = e.readUint32()), t & K.TRUN_FIRST_SAMPLE_FLAGS && (o = e.readUint32());
1711
1717
  const c = new K(i, n, o);
@@ -1726,7 +1732,7 @@ const Df = 1, Of = 2, Mf = 8, Ff = 16, _f = 32, cr = class cr {
1726
1732
  this.extra = e, this.defaultSampleDuration = t, this.defaultSampleSize = i, this.defaultSampleFlags = n;
1727
1733
  }
1728
1734
  static decodeData(e) {
1729
- const t = Wt(e);
1735
+ const t = Ht(e);
1730
1736
  let i, n, o;
1731
1737
  return e.readUint32(), (t.flags & Df) > 0 && e.readUint64(), (t.flags & Of) > 0 && e.readUint32(), (t.flags & Mf) > 0 && (i = e.readUint32()), (t.flags & Ff) > 0 && (n = e.readUint32()), (t.flags & _f) > 0 && (o = e.readUint32()), new cr(t, i, n, o);
1732
1738
  }
@@ -1800,7 +1806,7 @@ const lr = class lr {
1800
1806
  }
1801
1807
  }
1802
1808
  static decodeData(e) {
1803
- Wt(e), e.readUint32();
1809
+ Ht(e), e.readUint32();
1804
1810
  const t = String.fromCharCode(...e.readBytes(4));
1805
1811
  return new lr(t);
1806
1812
  }
@@ -1817,7 +1823,7 @@ const Ls = class Ls {
1817
1823
  this.creationTime = e, this.modificationTime = t, this.timescale = i, this.duration = n;
1818
1824
  }
1819
1825
  static decodeData(e) {
1820
- const { version: t } = Wt(e);
1826
+ const { version: t } = Ht(e);
1821
1827
  if (t === 1) {
1822
1828
  const h = e.readUint64(), d = e.readUint64(), m = e.readUint32(), p = e.readUint64();
1823
1829
  return new Ls(h, d, m, p);
@@ -1849,7 +1855,7 @@ const mr = class mr {
1849
1855
  return (e = this.avc1) == null ? void 0 : e.height;
1850
1856
  }
1851
1857
  static decodeData(e) {
1852
- Wt(e);
1858
+ Ht(e);
1853
1859
  const t = e.readUint32();
1854
1860
  let i, n, o, c;
1855
1861
  for (let h = 0; h < t; h++)
@@ -1952,7 +1958,7 @@ const Ar = class Ar {
1952
1958
  this.modificationTime = e, this.creationTime = t, this.trackId = i, this.duration = n, this.alternateGroup = o, this.volume = c, this.width = h, this.height = d;
1953
1959
  }
1954
1960
  static decodeData(e) {
1955
- const t = Wt(e);
1961
+ const t = Ht(e);
1956
1962
  let i = 0, n = 0;
1957
1963
  t.version === 1 ? (i = e.readUint64(), n = e.readUint64()) : (i = e.readUint32(), n = e.readUint32());
1958
1964
  const o = e.readUint32();
@@ -2124,7 +2130,7 @@ const Ds = class Ds {
2124
2130
  return new Date(n.getTime() + i);
2125
2131
  }
2126
2132
  static decodeData(e) {
2127
- const { version: t } = Wt(e);
2133
+ const { version: t } = Ht(e);
2128
2134
  e.readUint32();
2129
2135
  const i = e.readUint32(), n = e.readUint32();
2130
2136
  if (t === 1) {
@@ -2322,11 +2328,11 @@ const od = class od {
2322
2328
  return ((e = a(this, X).moof.traf.trun) == null ? void 0 : e.samplesCount) || 0;
2323
2329
  }
2324
2330
  sample(e) {
2325
- var b, S, x, R, M, T, U, k, _, ce, Me, Z, It, Ct, y;
2326
- const t = (b = a(this, Re).init().moov.traks[0]) == null ? void 0 : b.mdia.minf.stbl.stsd.codec, i = ((S = a(this, X).moof.traf.trun) == null ? void 0 : S.samplesCount) || 0, n = (x = a(this, X).moof.traf.tfdt) == null ? void 0 : x.baseMediaDecodeTime;
2331
+ var b, S, P, B, D, T, U, k, _, ce, Me, Z, It, Ct, y;
2332
+ const t = (b = a(this, Re).init().moov.traks[0]) == null ? void 0 : b.mdia.minf.stbl.stsd.codec, i = ((S = a(this, X).moof.traf.trun) == null ? void 0 : S.samplesCount) || 0, n = (P = a(this, X).moof.traf.tfdt) == null ? void 0 : P.baseMediaDecodeTime;
2327
2333
  if (e >= i || typeof n == "undefined" || !t)
2328
2334
  return;
2329
- const o = ((R = a(this, X).moof.traf.trun) == null ? void 0 : R.sampleDurations[e]) || 0, c = ((M = a(this, X).moof.traf.trun) == null ? void 0 : M.sampleDurations.slice(0, e).reduce((E, L) => E + L, 0)) || 0, h = n + c, d = ((T = a(this, Re).init().moov.traks[0]) == null ? void 0 : T.mdia.mdhd.timescale) || 1e3, m = ((U = a(this, X).moof.traf.trun) == null ? void 0 : U.sampleSizes[e]) || a(this, X).mdat.data.byteLength, p = ((k = a(this, X).moof.traf.trun) == null ? void 0 : k.sampleSizes.slice(0, e).reduce((E, L) => E + L, 0)) || 0, g = a(this, X).mdat.data.subarray(p, p + m), w = ((_ = a(this, X).moof.traf.trun) == null ? void 0 : _.is_sync_sample(e)) || !1;
2335
+ const o = ((B = a(this, X).moof.traf.trun) == null ? void 0 : B.sampleDurations[e]) || 0, c = ((D = a(this, X).moof.traf.trun) == null ? void 0 : D.sampleDurations.slice(0, e).reduce((E, L) => E + L, 0)) || 0, h = n + c, d = ((T = a(this, Re).init().moov.traks[0]) == null ? void 0 : T.mdia.mdhd.timescale) || 1e3, m = ((U = a(this, X).moof.traf.trun) == null ? void 0 : U.sampleSizes[e]) || a(this, X).mdat.data.byteLength, p = ((k = a(this, X).moof.traf.trun) == null ? void 0 : k.sampleSizes.slice(0, e).reduce((E, L) => E + L, 0)) || 0, g = a(this, X).mdat.data.subarray(p, p + m), w = ((_ = a(this, X).moof.traf.trun) == null ? void 0 : _.is_sync_sample(e)) || !1;
2330
2336
  if (this.mediaType() === "video") {
2331
2337
  const E = ((ce = a(this, Re).init().moov.traks[0]) == null ? void 0 : ce.tkhd.width) || 0, L = ((Me = a(this, Re).init().moov.traks[0]) == null ? void 0 : Me.tkhd.height) || 0;
2332
2338
  return {
@@ -2856,13 +2862,13 @@ const se = (s, e, t) => {
2856
2862
  d && s.readBit() !== 0 && s.readBits(4), g.push({ tier: Be, operatingPointIdc: he, seqLevelIdx: _e });
2857
2863
  }
2858
2864
  }
2859
- const w = s.readBits(4) + 1, b = s.readBits(4) + 1, S = s.readBits(w) + 1, x = s.readBits(b) + 1;
2860
- let R = !1;
2861
- n ? R = !1 : R = s.readBit() !== 0, R && (m = s.readBits(4) + 2, p = s.readBits(3) + 1);
2862
- const M = s.readBit() !== 0, T = s.readBit() !== 0, U = s.readBit() !== 0;
2865
+ const w = s.readBits(4) + 1, b = s.readBits(4) + 1, S = s.readBits(w) + 1, P = s.readBits(b) + 1;
2866
+ let B = !1;
2867
+ n ? B = !1 : B = s.readBit() !== 0, B && (m = s.readBits(4) + 2, p = s.readBits(3) + 1);
2868
+ const D = s.readBit() !== 0, T = s.readBit() !== 0, U = s.readBit() !== 0;
2863
2869
  let k = !1, _ = !1, ce = !1, Me = !1, Z = !1, It = !1, Ct = !1, y = Md, E = Qc, L = 0;
2864
2870
  n || (k = s.readBit() !== 0, _ = s.readBit() !== 0, ce = s.readBit() !== 0, Me = s.readBit() !== 0, Z = s.readBit() !== 0, Z && (It = s.readBit() !== 0, Ct = s.readBit() !== 0), s.readBit() !== 0 ? y = Md : y = s.readBit(), y > 0 ? s.readBit() > 0 ? E = Qc : E = s.readBit() : E = Qc, Z ? L = s.readBits(3) : L = 0);
2865
- const W = s.readBit() !== 0, O = s.readBit() !== 0, N = s.readBit() !== 0;
2871
+ const W = s.readBit() !== 0, M = s.readBit() !== 0, N = s.readBit() !== 0;
2866
2872
  return {
2867
2873
  seqProfile: e,
2868
2874
  stillPicture: i,
@@ -2880,11 +2886,11 @@ const se = (s, e, t) => {
2880
2886
  frameWidthBits: w,
2881
2887
  frameHeightBits: b,
2882
2888
  maxFrameWidth: S,
2883
- maxFrameHeight: x,
2884
- frameIdNumbersPresentFlag: R,
2889
+ maxFrameHeight: P,
2890
+ frameIdNumbersPresentFlag: B,
2885
2891
  deltaFrameIdLength: m,
2886
2892
  additionalFrameIdLength: p,
2887
- use_128x128Superblock: M,
2893
+ use_128x128Superblock: D,
2888
2894
  enableFilterIntra: T,
2889
2895
  enableIntraEdgeFilter: U,
2890
2896
  enableInterintraCompound: k,
@@ -2898,7 +2904,7 @@ const se = (s, e, t) => {
2898
2904
  seqForceIntegerMv: E,
2899
2905
  orderHintBits: L,
2900
2906
  enableSuperres: W,
2901
- enableCdef: O,
2907
+ enableCdef: M,
2902
2908
  enableRestoration: N,
2903
2909
  colorConfig: Vp(s, e),
2904
2910
  filmGrainParamsPresent: s.readBit() !== 0
@@ -2988,18 +2994,19 @@ const se = (s, e, t) => {
2988
2994
  trackId: 1
2989
2995
  }
2990
2996
  ]);
2991
- }, zp = (s, e, t) => {
2992
- switch (s) {
2997
+ }, zp = (s) => {
2998
+ const { codec: e, initData: t, timescale: i } = s;
2999
+ switch (e) {
2993
3000
  case "h264":
2994
- return Xp(e, t);
3001
+ return Xp(t, i);
2995
3002
  case "av1":
2996
- return Qp(e, t);
3003
+ return Qp(t, i);
2997
3004
  case "opus":
2998
- return Zp(e, t);
3005
+ return Zp(t, i, s.channelCount || 2);
2999
3006
  case "aac":
3000
- return qp(e, t);
3007
+ return qp(t, i, s.channelCount || 2);
3001
3008
  default:
3002
- throw new Error(`Failed to initialize ${s} segment`);
3009
+ throw new Error(`Failed to initialize ${e} segment`);
3003
3010
  }
3004
3011
  }, Hp = (s, e) => {
3005
3012
  switch (s) {
@@ -3008,7 +3015,7 @@ const se = (s, e, t) => {
3008
3015
  case "av1":
3009
3016
  return Gp(e);
3010
3017
  }
3011
- }, Xp = (s, e) => Cp(s, e), Qp = (s, e) => Wp(s, e), Zp = (s, e) => kp(new Uint8Array(s), 2, e), qp = (s, e) => Tp(new Uint8Array(s), 2, e, e), $p = (s, e) => {
3018
+ }, Xp = (s, e) => Cp(s, e), Qp = (s, e) => Wp(s, e), Zp = (s, e, t) => kp(new Uint8Array(s), t, e), qp = (s, e, t) => Tp(new Uint8Array(s), t, e, e), $p = (s, e) => {
3012
3019
  if (!s[0])
3013
3020
  throw new Error("At least one sample must be provided");
3014
3021
  switch (s[0].codec) {
@@ -3083,25 +3090,25 @@ class sg {
3083
3090
  }
3084
3091
  }
3085
3092
  const ng = /\r\n|\r|\n/;
3086
- var Kt, xt;
3093
+ var ti, xt;
3087
3094
  class _d {
3088
3095
  constructor(e) {
3089
- u(this, Kt);
3096
+ u(this, ti);
3090
3097
  u(this, xt);
3091
- l(this, Kt, e), l(this, xt, 0);
3098
+ l(this, ti, e), l(this, xt, 0);
3092
3099
  }
3093
3100
  skipEmptyLines() {
3094
3101
  let e = 0;
3095
- for (; a(this, Kt)[a(this, xt)] === ""; )
3102
+ for (; a(this, ti)[a(this, xt)] === ""; )
3096
3103
  Ze(this, xt)._++, e++;
3097
3104
  return e;
3098
3105
  }
3099
3106
  readLine() {
3100
- return a(this, Kt)[Ze(this, xt)._++];
3107
+ return a(this, ti)[Ze(this, xt)._++];
3101
3108
  }
3102
3109
  takeUntilEmptyLine() {
3103
3110
  const e = [];
3104
- for (; a(this, Kt)[a(this, xt)] !== ""; ) {
3111
+ for (; a(this, ti)[a(this, xt)] !== ""; ) {
3105
3112
  const t = this.readLine();
3106
3113
  if (t === void 0)
3107
3114
  break;
@@ -3110,10 +3117,10 @@ class _d {
3110
3117
  return e;
3111
3118
  }
3112
3119
  linesLeft() {
3113
- return a(this, Kt).length - a(this, xt);
3120
+ return a(this, ti).length - a(this, xt);
3114
3121
  }
3115
3122
  }
3116
- Kt = new WeakMap(), xt = new WeakMap();
3123
+ ti = new WeakMap(), xt = new WeakMap();
3117
3124
  var ws, Hu, mh;
3118
3125
  class zu {
3119
3126
  constructor() {
@@ -3127,7 +3134,7 @@ class zu {
3127
3134
  ;
3128
3135
  for (; n.linesLeft() > 0; ) {
3129
3136
  const c = A(this, ws, Hu).call(this, n);
3130
- t.push(c), n.skipEmptyLines();
3137
+ c && t.push(c), n.skipEmptyLines();
3131
3138
  }
3132
3139
  return t;
3133
3140
  }
@@ -3136,6 +3143,8 @@ ws = new WeakSet(), Hu = function(e) {
3136
3143
  e.skipEmptyLines();
3137
3144
  const t = e.takeUntilEmptyLine(), i = new _d(t);
3138
3145
  let n = i.readLine(), o;
3146
+ if (n != null && n.startsWith("NOTE"))
3147
+ return;
3139
3148
  if (n != null && n.includes("-->") || (o = n, n = i.readLine()), n === void 0)
3140
3149
  throw new Error("expected cue line");
3141
3150
  const [c, h] = n.split("-->").map((b) => b.trim());
@@ -3163,7 +3172,7 @@ ws = new WeakSet(), Hu = function(e) {
3163
3172
  const [i = 0, n = 0, o = 0] = t.map((h) => parseFloat(h));
3164
3173
  return i * 60 * 60 + n * 60 + o;
3165
3174
  };
3166
- class fh extends bi {
3175
+ class fh extends yi {
3167
3176
  constructor({ type: t, autoplay: i, muted: n, logger: o, poster: c }) {
3168
3177
  super();
3169
3178
  r(this, "element");
@@ -3222,13 +3231,13 @@ class fh extends bi {
3222
3231
  });
3223
3232
  /// This method is used to try to play the media element without throwing an error if it fails.
3224
3233
  r(this, "tryPlay", () => {
3225
- this.element.muted = this._userProvidedMuted, this._play().catch(D);
3234
+ this.element.muted = this._userProvidedMuted, this._play().catch(O);
3226
3235
  });
3227
3236
  /// This method is used to play the media element and will throw an error if it fails.
3228
3237
  r(this, "play", () => {
3229
3238
  this.element.muted = this._userProvidedMuted, this._play().catch((t) => {
3230
3239
  if (t instanceof Error) {
3231
- const i = new P("Media Play Error", { source: t, isFatal: !1, code: "media_play_error" });
3240
+ const i = new x("Media Play Error", { source: t, isFatal: !1, code: "media_play_error" });
3232
3241
  this.emit("error", i);
3233
3242
  }
3234
3243
  });
@@ -3398,7 +3407,7 @@ const cg = (s) => {
3398
3407
  return ps(s) ? e = {
3399
3408
  type: "media-source",
3400
3409
  audio: {
3401
- contentType: Ui(s),
3410
+ contentType: Pi(s),
3402
3411
  bitrate: s.bitRate,
3403
3412
  channels: s.channels.toString(),
3404
3413
  samplerate: s.sampleRate
@@ -3406,7 +3415,7 @@ const cg = (s) => {
3406
3415
  } : e = {
3407
3416
  type: "media-source",
3408
3417
  video: {
3409
- contentType: Ui(s),
3418
+ contentType: Pi(s),
3410
3419
  bitrate: s.bitRate,
3411
3420
  width: s.width,
3412
3421
  height: s.height,
@@ -3521,7 +3530,7 @@ const pg = {
3521
3530
  maxBufferingRatio: {
3522
3531
  last30Seconds: 0.15
3523
3532
  }
3524
- }, Qt = class Qt {
3533
+ }, qt = class qt {
3525
3534
  constructor(e, t, i, n, o) {
3526
3535
  r(this, "qualityOfServiceSource");
3527
3536
  r(this, "targetBufferTimeTarget");
@@ -3555,8 +3564,8 @@ const pg = {
3555
3564
  return;
3556
3565
  const o = this.qualityOfServiceSource.timeSpentBufferingLast(30 * 1e3), c = this.qualityOfServiceSource.bufferingEventsLast(30 * 1e3), h = this.qualityOfServiceSource.timeSpentActiveLast(30 * 1e3), d = o / h, m = Math.ceil(
3557
3566
  Math.max(
3558
- (i - t) / (Qt.BUFFER_TIME_MAX_STEPS - 1),
3559
- Qt.BUFFER_TIME_STEP_SIZE
3567
+ (i - t) / (qt.BUFFER_TIME_MAX_STEPS - 1),
3568
+ qt.BUFFER_TIME_STEP_SIZE
3560
3569
  )
3561
3570
  );
3562
3571
  (d > this.config.maxBufferingRatio.last30Seconds || c > this.config.maxBufferingEvents.last30Seconds) && (this.targetBufferTimeTarget.targetBufferTime = Math.min(
@@ -3570,8 +3579,8 @@ const pg = {
3570
3579
  this.config = v(v({}, this.config), e);
3571
3580
  }
3572
3581
  };
3573
- r(Qt, "BUFFER_TIME_STEP_SIZE", 500), r(Qt, "BUFFER_TIME_MAX_STEPS", 3), r(Qt, "create", (e, t, i, n, o = {}) => new Qt(e, t, i, n, o));
3574
- let gh = Qt;
3582
+ r(qt, "BUFFER_TIME_STEP_SIZE", 500), r(qt, "BUFFER_TIME_MAX_STEPS", 3), r(qt, "create", (e, t, i, n, o = {}) => new qt(e, t, i, n, o));
3583
+ let gh = qt;
3575
3584
  var Bo = /* @__PURE__ */ ((s) => (s[s.StreamHeaderGroup = 4] = "StreamHeaderGroup", s[s.FetchHeader = 5] = "FetchHeader", s[s.StreamHeaderTrack = 60] = "StreamHeaderTrack", s))(Bo || {});
3576
3585
  const Te = {
3577
3586
  Normal: 0,
@@ -3627,7 +3636,7 @@ class gg {
3627
3636
  subscribeId: a(this, Zs),
3628
3637
  trackAlias: a(this, Gr),
3629
3638
  groupId: e,
3630
- subGroupId: B(0),
3639
+ subGroupId: R(0),
3631
3640
  objectId: t,
3632
3641
  subscriberPriority: a(this, jr),
3633
3642
  streamId: a(this, zr),
@@ -3809,37 +3818,37 @@ function qu(s, e) {
3809
3818
  }
3810
3819
  });
3811
3820
  }
3812
- var ei, Yr;
3821
+ var ii, Yr;
3813
3822
  class bg {
3814
3823
  constructor(e, t) {
3815
- u(this, ei);
3824
+ u(this, ii);
3816
3825
  u(this, Yr);
3817
- l(this, ei, e), l(this, Yr, t);
3826
+ l(this, ii, e), l(this, Yr, t);
3818
3827
  }
3819
3828
  start(e) {
3820
- a(this, ei).addEventListener("message", (t) => {
3829
+ a(this, ii).addEventListener("message", (t) => {
3821
3830
  if (typeof t.data == "object" && t.data instanceof ArrayBuffer) {
3822
3831
  const i = new Uint8Array(t.data);
3823
3832
  i[0] == a(this, Yr) && e.enqueue(i.subarray(1));
3824
3833
  }
3825
- }), a(this, ei).addEventListener("error", () => e.error(new Error("WebSocket error"))), a(this, ei).addEventListener("close", () => Tu(() => e.close()));
3834
+ }), a(this, ii).addEventListener("error", () => e.error(new Error("WebSocket error"))), a(this, ii).addEventListener("close", () => Tu(() => e.close()));
3826
3835
  }
3827
3836
  cancel(e) {
3828
- a(this, ei).close(void 0, e);
3837
+ a(this, ii).close(void 0, e);
3829
3838
  }
3830
3839
  }
3831
- ei = new WeakMap(), Yr = new WeakMap();
3832
- var pt, _i, Ni, Vi;
3840
+ ii = new WeakMap(), Yr = new WeakMap();
3841
+ var pt, Ni, Vi, Gi;
3833
3842
  class yg {
3834
3843
  constructor(e) {
3835
3844
  u(this, pt);
3836
- u(this, _i, null);
3837
3845
  u(this, Ni, null);
3838
3846
  u(this, Vi, null);
3847
+ u(this, Gi, null);
3839
3848
  l(this, pt, e);
3840
3849
  }
3841
3850
  start(e) {
3842
- l(this, _i, (t) => {
3851
+ l(this, Ni, (t) => {
3843
3852
  if (typeof t.data == "object" && t.data instanceof ArrayBuffer) {
3844
3853
  const i = new Uint8Array(t.data), n = i[0] || 0, o = n & 127, c = (n >> 7 & 1) > 0;
3845
3854
  if (o && o !== 0) {
@@ -3847,27 +3856,27 @@ class yg {
3847
3856
  e.enqueue([c, o, h]);
3848
3857
  }
3849
3858
  }
3850
- }), l(this, Ni, () => Tu(() => e.close())), l(this, Vi, () => e.error(new Error("WebSocket error"))), a(this, pt).addEventListener("message", a(this, _i)), a(this, pt).addEventListener("error", a(this, Vi)), a(this, pt).addEventListener("close", a(this, Ni));
3859
+ }), l(this, Vi, () => Tu(() => e.close())), l(this, Gi, () => e.error(new Error("WebSocket error"))), a(this, pt).addEventListener("message", a(this, Ni)), a(this, pt).addEventListener("error", a(this, Gi)), a(this, pt).addEventListener("close", a(this, Vi));
3851
3860
  }
3852
3861
  cancel(e) {
3853
- a(this, _i) && a(this, pt).removeEventListener("message", a(this, _i)), a(this, Vi) && a(this, pt).removeEventListener("error", a(this, Vi)), a(this, Ni) && a(this, pt).removeEventListener("close", a(this, Ni));
3862
+ a(this, Ni) && a(this, pt).removeEventListener("message", a(this, Ni)), a(this, Gi) && a(this, pt).removeEventListener("error", a(this, Gi)), a(this, Vi) && a(this, pt).removeEventListener("close", a(this, Vi));
3854
3863
  }
3855
3864
  }
3856
- pt = new WeakMap(), _i = new WeakMap(), Ni = new WeakMap(), Vi = new WeakMap();
3857
- var gt, Jr, Gi, At, Qo, z, er, Ka, Ci, eo, Ht;
3865
+ pt = new WeakMap(), Ni = new WeakMap(), Vi = new WeakMap(), Gi = new WeakMap();
3866
+ var gt, Jr, ji, At, Qo, z, er, Ka, ki, eo, Qt;
3858
3867
  class Ro {
3859
3868
  constructor(e, t) {
3860
3869
  u(this, z);
3861
3870
  u(this, gt);
3862
3871
  u(this, Jr);
3863
- u(this, Gi);
3872
+ u(this, ji);
3864
3873
  u(this, At, 0);
3865
3874
  u(this, Qo, new TextDecoder());
3866
- l(this, gt, e), l(this, Jr, t), l(this, Gi, t.getReader());
3875
+ l(this, gt, e), l(this, Jr, t), l(this, ji, t.getReader());
3867
3876
  }
3868
3877
  readUnsigned8() {
3869
3878
  return f(this, null, function* () {
3870
- return yield A(this, z, Ci).call(this, 1), A(this, z, Ht).call(this, 1)[0];
3879
+ return yield A(this, z, ki).call(this, 1), A(this, z, Qt).call(this, 1)[0];
3871
3880
  });
3872
3881
  }
3873
3882
  readString() {
@@ -3886,28 +3895,28 @@ class Ro {
3886
3895
  }
3887
3896
  readBigVarInt() {
3888
3897
  return f(this, null, function* () {
3889
- yield A(this, z, Ci).call(this, 1);
3898
+ yield A(this, z, ki).call(this, 1);
3890
3899
  const e = (A(this, z, eo).call(this, 1)[0] & 192) >> 6;
3891
3900
  switch (a(this, gt)[a(this, At)] = A(this, z, eo).call(this, 1)[0] & 63, e) {
3892
3901
  case 0:
3893
- return B(A(this, z, Ht).call(this, 1)[0]);
3902
+ return R(A(this, z, Qt).call(this, 1)[0]);
3894
3903
  case 1: {
3895
- yield A(this, z, Ci).call(this, 2);
3896
- const t = A(this, z, Ht).call(this, 2), i = new DataView(t.buffer, t.byteOffset, t.byteLength);
3897
- return B(i.getUint16(0));
3904
+ yield A(this, z, ki).call(this, 2);
3905
+ const t = A(this, z, Qt).call(this, 2), i = new DataView(t.buffer, t.byteOffset, t.byteLength);
3906
+ return R(i.getUint16(0));
3898
3907
  }
3899
3908
  case 2: {
3900
- yield A(this, z, Ci).call(this, 4);
3901
- const t = A(this, z, Ht).call(this, 4), i = new DataView(t.buffer, t.byteOffset, t.byteLength);
3902
- return B(i.getUint32(0));
3909
+ yield A(this, z, ki).call(this, 4);
3910
+ const t = A(this, z, Qt).call(this, 4), i = new DataView(t.buffer, t.byteOffset, t.byteLength);
3911
+ return R(i.getUint32(0));
3903
3912
  }
3904
3913
  case 3: {
3905
- yield A(this, z, Ci).call(this, 8);
3906
- const t = A(this, z, Ht).call(this, 8), i = new DataView(t.buffer, t.byteOffset, t.byteLength);
3914
+ yield A(this, z, ki).call(this, 8);
3915
+ const t = A(this, z, Qt).call(this, 8), i = new DataView(t.buffer, t.byteOffset, t.byteLength);
3907
3916
  if (typeof i.getBigUint64 != "undefined")
3908
- return B(i.getBigUint64(0));
3917
+ return R(i.getBigUint64(0));
3909
3918
  const n = td(t, 0, 7);
3910
- return B(n);
3919
+ return R(n);
3911
3920
  }
3912
3921
  default:
3913
3922
  throw new Error("Invalid VarInt size");
@@ -3916,14 +3925,14 @@ class Ro {
3916
3925
  }
3917
3926
  read(e) {
3918
3927
  return f(this, null, function* () {
3919
- return yield A(this, z, Ci).call(this, e), A(this, z, Ht).call(this, e);
3928
+ return yield A(this, z, ki).call(this, e), A(this, z, Qt).call(this, e);
3920
3929
  });
3921
3930
  }
3922
3931
  readAll() {
3923
3932
  return f(this, null, function* () {
3924
3933
  for (; yield A(this, z, Ka).call(this); )
3925
3934
  ;
3926
- return A(this, z, Ht).call(this, A(this, z, er).call(this));
3935
+ return A(this, z, Qt).call(this, A(this, z, er).call(this));
3927
3936
  });
3928
3937
  }
3929
3938
  isDone() {
@@ -3933,20 +3942,20 @@ class Ro {
3933
3942
  }
3934
3943
  closed() {
3935
3944
  return f(this, null, function* () {
3936
- return a(this, Gi).closed;
3945
+ return a(this, ji).closed;
3937
3946
  });
3938
3947
  }
3939
3948
  close() {
3940
3949
  return f(this, null, function* () {
3941
- return a(this, Gi).releaseLock(), a(this, Jr).cancel();
3950
+ return a(this, ji).releaseLock(), a(this, Jr).cancel();
3942
3951
  });
3943
3952
  }
3944
3953
  }
3945
- gt = new WeakMap(), Jr = new WeakMap(), Gi = new WeakMap(), At = new WeakMap(), Qo = new WeakMap(), z = new WeakSet(), er = function() {
3954
+ gt = new WeakMap(), Jr = new WeakMap(), ji = new WeakMap(), At = new WeakMap(), Qo = new WeakMap(), z = new WeakSet(), er = function() {
3946
3955
  return a(this, gt).length - a(this, At);
3947
3956
  }, Ka = function() {
3948
3957
  return f(this, null, function* () {
3949
- const { value: e, done: t } = yield a(this, Gi).read();
3958
+ const { value: e, done: t } = yield a(this, ji).read();
3950
3959
  if (t)
3951
3960
  return Promise.resolve(0);
3952
3961
  if (A(this, z, er).call(this) === 0)
@@ -3957,7 +3966,7 @@ gt = new WeakMap(), Jr = new WeakMap(), Gi = new WeakMap(), At = new WeakMap(),
3957
3966
  }
3958
3967
  return l(this, At, 0), Promise.resolve(e.length);
3959
3968
  });
3960
- }, Ci = function(e) {
3969
+ }, ki = function(e) {
3961
3970
  return f(this, null, function* () {
3962
3971
  for (; A(this, z, er).call(this) < e; )
3963
3972
  if ((yield A(this, z, Ka).call(this)) === 0)
@@ -3965,7 +3974,7 @@ gt = new WeakMap(), Jr = new WeakMap(), Gi = new WeakMap(), At = new WeakMap(),
3965
3974
  });
3966
3975
  }, eo = function(e) {
3967
3976
  return a(this, gt).subarray(a(this, At), a(this, At) + e);
3968
- }, Ht = function(e) {
3977
+ }, Qt = function(e) {
3969
3978
  const t = A(this, z, eo).call(this, e);
3970
3979
  return l(this, At, a(this, At) + t.length), t;
3971
3980
  };
@@ -4010,14 +4019,14 @@ tn = new WeakMap(), sn = new WeakMap(), Lt = new WeakMap(), Zo = new WeakMap();
4010
4019
  const Yu = {
4011
4020
  OPEN: 1
4012
4021
  };
4013
- var Ue, xe, ji, qo;
4022
+ var Ue, xe, Wi, qo;
4014
4023
  const Tr = class Tr {
4015
4024
  constructor(e) {
4016
4025
  u(this, Ue, 0);
4017
4026
  u(this, xe, new Uint8Array(Tr.DEFAULT_BUFFER_SIZE));
4018
- u(this, ji);
4027
+ u(this, Wi);
4019
4028
  u(this, qo, new TextEncoder());
4020
- l(this, ji, e);
4029
+ l(this, Wi, e);
4021
4030
  }
4022
4031
  writeString(e) {
4023
4032
  return f(this, null, function* () {
@@ -4048,17 +4057,17 @@ const Tr = class Tr {
4048
4057
  return this.ensureBufferSpace(8), l(this, Ue, a(this, Ue) + al(e, a(this, xe).subarray(a(this, Ue))).byteLength), Promise.resolve();
4049
4058
  }
4050
4059
  flush() {
4051
- if (a(this, ji).readyState !== Yu.OPEN)
4060
+ if (a(this, Wi).readyState !== Yu.OPEN)
4052
4061
  throw new Error("Writer is not open");
4053
- return a(this, ji).send(a(this, xe).subarray(0, a(this, Ue))), l(this, Ue, 0), l(this, xe, new Uint8Array(Tr.DEFAULT_BUFFER_SIZE)), Promise.resolve();
4062
+ return a(this, Wi).send(a(this, xe).subarray(0, a(this, Ue))), l(this, Ue, 0), l(this, xe, new Uint8Array(Tr.DEFAULT_BUFFER_SIZE)), Promise.resolve();
4054
4063
  }
4055
4064
  close() {
4056
- return a(this, ji).close(), Promise.resolve();
4065
+ return a(this, Wi).close(), Promise.resolve();
4057
4066
  }
4058
4067
  };
4059
- Ue = new WeakMap(), xe = new WeakMap(), ji = new WeakMap(), qo = new WeakMap(), r(Tr, "DEFAULT_BUFFER_SIZE", 1024);
4068
+ Ue = new WeakMap(), xe = new WeakMap(), Wi = new WeakMap(), qo = new WeakMap(), r(Tr, "DEFAULT_BUFFER_SIZE", 1024);
4060
4069
  let Rr = Tr;
4061
- const Ju = Math.pow(2, 6) - 1, Ku = Math.pow(2, 14) - 1, el = Math.pow(2, 30) - 1, vg = Number.MAX_SAFE_INTEGER, Sg = typeof BigInt == "function" ? B(2) ** B(62) - B(1) : B(Number.MAX_SAFE_INTEGER);
4070
+ const Ju = Math.pow(2, 6) - 1, Ku = Math.pow(2, 14) - 1, el = Math.pow(2, 30) - 1, vg = Number.MAX_SAFE_INTEGER, Sg = typeof BigInt == "function" ? R(2) ** R(62) - R(1) : R(Number.MAX_SAFE_INTEGER);
4062
4071
  function Nc(s, e) {
4063
4072
  return e[0] = s, e.subarray(0, 1);
4064
4073
  }
@@ -4119,7 +4128,7 @@ function sd(s, e) {
4119
4128
  yield s.writeString(t);
4120
4129
  });
4121
4130
  }
4122
- const Uo = B(2);
4131
+ const Uo = R(2);
4123
4132
  function Qn(s) {
4124
4133
  return f(this, null, function* () {
4125
4134
  const e = yield s.readVarInt(), t = /* @__PURE__ */ new Map();
@@ -4167,7 +4176,7 @@ function Cg(s, e) {
4167
4176
  const kg = {
4168
4177
  Subscriber: 2
4169
4178
  }, Po = {
4170
- Role: B(0)
4179
+ Role: R(0)
4171
4180
  }, ol = {
4172
4181
  Draft07: 4278190087
4173
4182
  };
@@ -4616,7 +4625,7 @@ class Vd {
4616
4625
  case I.AnnounceError:
4617
4626
  return Zg(a(this, ae));
4618
4627
  }
4619
- return qg(a(this, ae), B(e), t);
4628
+ return qg(a(this, ae), R(e), t);
4620
4629
  });
4621
4630
  }
4622
4631
  }
@@ -4718,15 +4727,15 @@ class Jg {
4718
4727
  this.state = e;
4719
4728
  }
4720
4729
  }
4721
- var hn, ti, Wi, Jo, zi, tt;
4730
+ var hn, si, zi, Jo, Hi, tt;
4722
4731
  const Ms = class Ms {
4723
4732
  constructor(e) {
4724
4733
  r(this, "subscribe");
4725
4734
  u(this, hn, new H());
4726
- u(this, ti, new H());
4727
- u(this, Wi, new H());
4728
- u(this, Jo, Date.now());
4735
+ u(this, si, new H());
4729
4736
  u(this, zi, new H());
4737
+ u(this, Jo, Date.now());
4738
+ u(this, Hi, new H());
4730
4739
  u(this, tt);
4731
4740
  switch (this.subscribe = e, e.filterType.type) {
4732
4741
  case "absolute-start":
@@ -4738,28 +4747,28 @@ const Ms = class Ms {
4738
4747
  }
4739
4748
  }
4740
4749
  onUpdate(e) {
4741
- l(this, tt, { startGroup: e.start.group }), e.end.group > B(0) && (a(this, tt).endGroup = e.end.group - B(1));
4750
+ l(this, tt, { startGroup: e.start.group }), e.end.group > R(0) && (a(this, tt).endGroup = e.end.group - R(1));
4742
4751
  }
4743
4752
  onError(e) {
4744
4753
  const t = new Error(e.reason);
4745
- return a(this, hn).reject(t), a(this, ti).reject(t), t;
4754
+ return a(this, hn).reject(t), a(this, si).reject(t), t;
4746
4755
  }
4747
4756
  onDone(e) {
4748
- e.finalInfo && (a(this, tt) || l(this, tt, { startGroup: B(0) }), a(this, tt).endGroup = e.finalInfo.group), a(this, ti).resolve(e);
4757
+ e.finalInfo && (a(this, tt) || l(this, tt, { startGroup: R(0) }), a(this, tt).endGroup = e.finalInfo.group), a(this, si).resolve(e);
4749
4758
  }
4750
4759
  onUnsubscribe(e) {
4751
- a(this, Wi).resolve(e);
4760
+ a(this, zi).resolve(e);
4752
4761
  }
4753
4762
  onOk(e) {
4754
4763
  const t = Math.max(0, Date.now() - a(this, Jo)), i = Number(e.expires);
4755
4764
  if (i > 0) {
4756
4765
  const n = Math.max(Ms.minGraceTime, Math.min(i / 10, Ms.maxGraceTime));
4757
- Promise.race([gs(i - n - t), this.done().catch(D)]).then(() => a(this, zi).resolve(this.expiryState())).catch(D);
4766
+ Promise.race([gs(i - n - t), this.done().catch(O)]).then(() => a(this, Hi).resolve(this.expiryState())).catch(O);
4758
4767
  }
4759
4768
  a(this, hn).resolve(e);
4760
4769
  }
4761
4770
  done() {
4762
- return a(this, ti).promise;
4771
+ return a(this, si).promise;
4763
4772
  }
4764
4773
  ok() {
4765
4774
  return a(this, hn).promise;
@@ -4768,27 +4777,27 @@ const Ms = class Ms {
4768
4777
  return a(this, tt);
4769
4778
  }
4770
4779
  close() {
4771
- a(this, zi).promise.catch(D), a(this, zi).reject(new Error("Subscription closed"));
4780
+ a(this, Hi).promise.catch(O), a(this, Hi).reject(new Error("Subscription closed"));
4772
4781
  }
4773
4782
  // Returns whether the subscription is still active - i.e. hasn't received a done or unsubscribe
4774
4783
  expiryState() {
4775
- return a(this, ti).resolved && a(this, ti).resolved.errorCode !== bh.Expired ? "done" : a(this, Wi).pending ? "active" : "unsubscribed";
4784
+ return a(this, si).resolved && a(this, si).resolved.errorCode !== bh.Expired ? "done" : a(this, zi).pending ? "active" : "unsubscribed";
4776
4785
  }
4777
4786
  unsubscribed() {
4778
- return a(this, Wi).promise;
4787
+ return a(this, zi).promise;
4779
4788
  }
4780
4789
  isUnsubscribed() {
4781
- return a(this, Wi).resolved;
4790
+ return a(this, zi).resolved;
4782
4791
  }
4783
4792
  /**
4784
4793
  * Returns a promise that resolves when the subscription is about to expire (15 seconds before expiry).
4785
4794
 
4786
4795
  */
4787
4796
  expiryNotification() {
4788
- return a(this, zi).promise;
4797
+ return a(this, Hi).promise;
4789
4798
  }
4790
4799
  };
4791
- hn = new WeakMap(), ti = new WeakMap(), Wi = new WeakMap(), Jo = new WeakMap(), zi = new WeakMap(), tt = new WeakMap(), r(Ms, "maxGraceTime", 15e3), r(Ms, "minGraceTime", 3e3);
4800
+ hn = new WeakMap(), si = new WeakMap(), zi = new WeakMap(), Jo = new WeakMap(), Hi = new WeakMap(), tt = new WeakMap(), r(Ms, "maxGraceTime", 15e3), r(Ms, "minGraceTime", 3e3);
4792
4801
  let Lo = Ms;
4793
4802
  var we, sa;
4794
4803
  class Kg {
@@ -4830,7 +4839,7 @@ class eA {
4830
4839
  A(this, Ko, Tl).call(this).catch((e) => a(this, oa).error("error writing subscription", e)),
4831
4840
  a(this, We).unsubscribed(),
4832
4841
  a(this, We).done(),
4833
- a(this, We).expiryNotification().catch(D)
4842
+ a(this, We).expiryNotification().catch(O)
4834
4843
  ]);
4835
4844
  });
4836
4845
  }
@@ -4889,15 +4898,15 @@ na = new WeakMap(), We = new WeakMap(), ra = new WeakMap(), aa = new WeakMap(),
4889
4898
  }
4890
4899
  });
4891
4900
  };
4892
- var Hi, ca, un, ha, ln;
4901
+ var Xi, ca, un, ha, ln;
4893
4902
  class tA {
4894
4903
  constructor(e, t, i) {
4895
- u(this, Hi);
4904
+ u(this, Xi);
4896
4905
  u(this, ca);
4897
4906
  u(this, un);
4898
4907
  u(this, ha);
4899
4908
  u(this, ln);
4900
- l(this, Hi, e), l(this, ca, t), l(this, un, i), l(this, ln, ge.get().createContext(`GroupSubscriptionWriter:${i.subscribe.name}`));
4909
+ l(this, Xi, e), l(this, ca, t), l(this, un, i), l(this, ln, ge.get().createContext(`GroupSubscriptionWriter:${i.subscribe.name}`));
4901
4910
  }
4902
4911
  finalGroup() {
4903
4912
  return a(this, ha);
@@ -4908,10 +4917,10 @@ class tA {
4908
4917
  try {
4909
4918
  for (var e = Y(a(this, ca)), t, i, n; t = !(i = yield e.next()).done; t = !1) {
4910
4919
  const o = i.value;
4911
- yield a(this, Hi).write({
4920
+ yield a(this, Xi).write({
4912
4921
  subscribeId: a(this, un).subscribe.id,
4913
4922
  trackAlias: a(this, un).subscribe.trackAlias,
4914
- subGroupId: B(0),
4923
+ subGroupId: R(0),
4915
4924
  subscriberPriority: 0,
4916
4925
  groupId: o.groupId,
4917
4926
  objectId: o.objectId,
@@ -4933,21 +4942,21 @@ class tA {
4933
4942
  });
4934
4943
  }
4935
4944
  [Tt()]() {
4936
- return a(this, Hi).close().catch(D);
4945
+ return a(this, Xi).close().catch(O);
4937
4946
  }
4938
4947
  [Symbol.asyncDispose]() {
4939
- return a(this, Hi).close().catch(D);
4948
+ return a(this, Xi).close().catch(O);
4940
4949
  }
4941
4950
  }
4942
- Hi = new WeakMap(), ca = new WeakMap(), un = new WeakMap(), ha = new WeakMap(), ln = new WeakMap();
4943
- var da, Xi, ii, Bs;
4951
+ Xi = new WeakMap(), ca = new WeakMap(), un = new WeakMap(), ha = new WeakMap(), ln = new WeakMap();
4952
+ var da, Qi, ni, Bs;
4944
4953
  class iA {
4945
4954
  constructor(e, t, i) {
4946
- u(this, ii);
4955
+ u(this, ni);
4947
4956
  r(this, "state");
4948
4957
  u(this, da);
4949
- u(this, Xi);
4950
- this.state = e, l(this, da, t), l(this, Xi, i);
4958
+ u(this, Qi);
4959
+ this.state = e, l(this, da, t), l(this, Qi, i);
4951
4960
  }
4952
4961
  /**
4953
4962
  * Accept the subscription and provide a track cache for the subscription
@@ -4957,31 +4966,31 @@ class iA {
4957
4966
  ok(e) {
4958
4967
  return f(this, null, function* () {
4959
4968
  var d, m, p;
4960
- const t = (d = this.state.range()) == null ? void 0 : d.startGroup, i = e.latest(), n = i == null ? void 0 : i.id, o = (p = (m = i == null ? void 0 : i.latest()) == null ? void 0 : m.objectId) != null ? p : B(0), c = e.consume(t != null ? t : n), h = {
4969
+ const t = (d = this.state.range()) == null ? void 0 : d.startGroup, i = e.latest(), n = i == null ? void 0 : i.id, o = (p = (m = i == null ? void 0 : i.latest()) == null ? void 0 : m.objectId) != null ? p : R(0), c = e.consume(t != null ? t : n), h = {
4961
4970
  type: I.SubscribeOk,
4962
4971
  id: this.state.subscribe.id,
4963
- expires: B(0),
4972
+ expires: R(0),
4964
4973
  groupOrder: "ascending",
4965
4974
  params: /* @__PURE__ */ new Map(),
4966
4975
  largestInfo: n ? { group: n, object: o } : void 0
4967
4976
  };
4968
- return yield a(this, Xi).push(h), new eA(this.state, c, a(this, da), a(this, Xi));
4977
+ return yield a(this, Qi).push(h), new eA(this.state, c, a(this, da), a(this, Qi));
4969
4978
  });
4970
4979
  }
4971
4980
  invalidRange() {
4972
- return A(this, ii, Bs).call(this, B(1), "Invalid range");
4981
+ return A(this, ni, Bs).call(this, R(1), "Invalid range");
4973
4982
  }
4974
4983
  retryTrackAlias() {
4975
- return A(this, ii, Bs).call(this, B(2), "Retry track alias");
4984
+ return A(this, ni, Bs).call(this, R(2), "Retry track alias");
4976
4985
  }
4977
4986
  trackDoesNotExist() {
4978
- return A(this, ii, Bs).call(this, B(3), "Track does not exist");
4987
+ return A(this, ni, Bs).call(this, R(3), "Track does not exist");
4979
4988
  }
4980
4989
  unauthorized() {
4981
- return A(this, ii, Bs).call(this, B(4), "Unauthorized");
4990
+ return A(this, ni, Bs).call(this, R(4), "Unauthorized");
4982
4991
  }
4983
4992
  timeout() {
4984
- return A(this, ii, Bs).call(this, B(5), "Timeout");
4993
+ return A(this, ni, Bs).call(this, R(5), "Timeout");
4985
4994
  }
4986
4995
  [Tt()]() {
4987
4996
  return this.trackDoesNotExist();
@@ -4990,7 +4999,7 @@ class iA {
4990
4999
  return this.trackDoesNotExist();
4991
5000
  }
4992
5001
  }
4993
- da = new WeakMap(), Xi = new WeakMap(), ii = new WeakSet(), Bs = function(e, t) {
5002
+ da = new WeakMap(), Qi = new WeakMap(), ni = new WeakSet(), Bs = function(e, t) {
4994
5003
  const i = {
4995
5004
  type: I.SubscribeError,
4996
5005
  id: this.state.subscribe.id,
@@ -4998,25 +5007,25 @@ da = new WeakMap(), Xi = new WeakMap(), ii = new WeakSet(), Bs = function(e, t)
4998
5007
  reason: t,
4999
5008
  trackAlias: this.state.subscribe.trackAlias
5000
5009
  };
5001
- return a(this, Xi).push(i);
5010
+ return a(this, Qi).push(i);
5002
5011
  };
5003
- var su, mn, ua, fn, Qi, si, ni, ri, sh;
5012
+ var su, mn, ua, fn, Zi, ri, ai, oi, sh;
5004
5013
  su = [Pe({ context: "Session", enter: "info", error: "error" })];
5005
5014
  class yh {
5006
5015
  constructor(e, t, i) {
5007
- Si(sh, 5, this);
5016
+ Ei(sh, 5, this);
5008
5017
  u(this, mn);
5009
5018
  u(this, ua);
5010
5019
  u(this, fn);
5011
- u(this, Qi, ge.get().createContext("Publisher"));
5012
- u(this, si, new Ie(/* @__PURE__ */ new Map()));
5013
- u(this, ni, new Ie(/* @__PURE__ */ new Map()));
5014
- u(this, ri, new Dc(10));
5020
+ u(this, Zi, ge.get().createContext("Publisher"));
5021
+ u(this, ri, new Ie(/* @__PURE__ */ new Map()));
5022
+ u(this, ai, new Ie(/* @__PURE__ */ new Map()));
5023
+ u(this, oi, new Dc(10));
5015
5024
  l(this, mn, e), l(this, ua, t), l(this, fn, i);
5016
5025
  }
5017
5026
  announce(e) {
5018
5027
  return f(this, null, function* () {
5019
- if (a(this, si).current().has(e.join("/")))
5028
+ if (a(this, ri).current().has(e.join("/")))
5020
5029
  throw new Error("Duplicate announcement");
5021
5030
  const t = /* @__PURE__ */ new Map(), i = a(this, mn).authToken();
5022
5031
  i && t.set(Uo, { type: Uo, payload: new TextEncoder().encode(i) });
@@ -5025,15 +5034,15 @@ class yh {
5025
5034
  namespace: e,
5026
5035
  params: t
5027
5036
  }, o = Yg(n);
5028
- if (a(this, si).update((h) => h.set(n.namespace.join("/"), o)), yield a(this, fn).push(n), !(yield Promise.race([o.state.ok(), a(this, mn).closed()])))
5037
+ if (a(this, ri).update((h) => h.set(n.namespace.join("/"), o)), yield a(this, fn).push(n), !(yield Promise.race([o.state.ok(), a(this, mn).closed()])))
5029
5038
  throw new Error("Session closed");
5030
5039
  });
5031
5040
  }
5032
5041
  close() {
5033
- a(this, ni).current().forEach((e) => e.close()), a(this, ni).close(), a(this, si).close(), a(this, ri).close();
5042
+ a(this, ai).current().forEach((e) => e.close()), a(this, ai).close(), a(this, ri).close(), a(this, oi).close();
5034
5043
  }
5035
5044
  incomingSubscriptions() {
5036
- return a(this, ri);
5045
+ return a(this, oi);
5037
5046
  }
5038
5047
  onMessage(e) {
5039
5048
  return f(this, null, function* () {
@@ -5041,77 +5050,77 @@ class yh {
5041
5050
  case I.Subscribe:
5042
5051
  {
5043
5052
  const t = new Lo(e);
5044
- if (a(this, ni).update((i) => (i.set(e.id, t), i)), a(this, ri).isFull()) {
5045
- const i = yield a(this, ri).pop();
5053
+ if (a(this, ai).update((i) => (i.set(e.id, t), i)), a(this, oi).isFull()) {
5054
+ const i = yield a(this, oi).pop();
5046
5055
  yield i == null ? void 0 : i.timeout();
5047
5056
  }
5048
- yield a(this, ri).push(
5057
+ yield a(this, oi).push(
5049
5058
  new iA(t, a(this, ua), a(this, fn))
5050
5059
  );
5051
5060
  }
5052
5061
  break;
5053
5062
  case I.SubscribeUpdate:
5054
5063
  {
5055
- const t = a(this, ni).current().get(e.id);
5056
- t || a(this, Qi).debug("No subscription found", e), t == null || t.onUpdate(e);
5064
+ const t = a(this, ai).current().get(e.id);
5065
+ t || a(this, Zi).debug("No subscription found", e), t == null || t.onUpdate(e);
5057
5066
  }
5058
5067
  break;
5059
5068
  case I.Unsubscribe:
5060
5069
  {
5061
- const t = a(this, ni).current().get(e.id);
5062
- t || a(this, Qi).debug("No subscription found", e), t == null || t.onUnsubscribe(e);
5070
+ const t = a(this, ai).current().get(e.id);
5071
+ t || a(this, Zi).debug("No subscription found", e), t == null || t.onUnsubscribe(e);
5063
5072
  }
5064
5073
  break;
5065
5074
  case I.AnnounceOk:
5066
5075
  {
5067
- const t = a(this, si).current().get(e.namespace.join("/"));
5068
- t || a(this, Qi).debug("No announcement found", e), t == null || t.state.onOk(e);
5076
+ const t = a(this, ri).current().get(e.namespace.join("/"));
5077
+ t || a(this, Zi).debug("No announcement found", e), t == null || t.state.onOk(e);
5069
5078
  }
5070
5079
  break;
5071
5080
  case I.AnnounceError:
5072
5081
  {
5073
- const t = a(this, si).current().get(e.namespace.join("/"));
5074
- t || a(this, Qi).debug("No announcement found", e), t == null || t.state.onError(e);
5082
+ const t = a(this, ri).current().get(e.namespace.join("/"));
5083
+ t || a(this, Zi).debug("No announcement found", e), t == null || t.state.onError(e);
5075
5084
  }
5076
5085
  break;
5077
5086
  }
5078
5087
  });
5079
5088
  }
5080
5089
  }
5081
- sh = vi(null), mn = new WeakMap(), ua = new WeakMap(), fn = new WeakMap(), Qi = new WeakMap(), si = new WeakMap(), ni = new WeakMap(), ri = new WeakMap(), ye(sh, 1, "announce", su, yh), zt(sh, yh);
5090
+ sh = Si(null), mn = new WeakMap(), ua = new WeakMap(), fn = new WeakMap(), Zi = new WeakMap(), ri = new WeakMap(), ai = new WeakMap(), oi = new WeakMap(), ye(sh, 1, "announce", su, yh), Xt(sh, yh);
5082
5091
  function sA(s, e) {
5083
5092
  const t = new Lo(e), [i, n] = ed(100), o = new nA(t, i), c = new Il(s, t, n);
5084
5093
  return [o, c];
5085
5094
  }
5086
- var Zi;
5095
+ var qi;
5087
5096
  class nA {
5088
5097
  constructor(e, t) {
5089
5098
  r(this, "state");
5090
- u(this, Zi);
5091
- this.state = e, l(this, Zi, t);
5099
+ u(this, qi);
5100
+ this.state = e, l(this, qi, t);
5092
5101
  }
5093
5102
  onDone(e) {
5094
5103
  this.state.onDone(e);
5095
5104
  }
5096
5105
  onData(e) {
5097
- return a(this, Zi).push(e);
5106
+ return a(this, qi).push(e);
5098
5107
  }
5099
5108
  onError(e) {
5100
5109
  const t = this.state.onError(e);
5101
- a(this, Zi).abort(t);
5110
+ a(this, qi).abort(t);
5102
5111
  }
5103
5112
  /**
5104
5113
  * Closes the subscription producer so that no more objects an be emitted
5105
5114
  */
5106
5115
  close() {
5107
- this.state.close(), a(this, Zi).close();
5116
+ this.state.close(), a(this, qi).close();
5108
5117
  }
5109
5118
  }
5110
- Zi = new WeakMap();
5119
+ qi = new WeakMap();
5111
5120
  var nu, pn, ue, gn, An, nh, wn, tr;
5112
5121
  class Il {
5113
5122
  constructor(e, t, i) {
5114
- Si(nh, 5, this);
5123
+ Ei(nh, 5, this);
5115
5124
  u(this, wn);
5116
5125
  u(this, pn);
5117
5126
  u(this, ue);
@@ -5144,8 +5153,8 @@ class Il {
5144
5153
  const i = {
5145
5154
  type: I.SubscribeUpdate,
5146
5155
  id: a(this, ue).subscribe.id,
5147
- start: { group: e, object: B(0) },
5148
- end: { group: t + B(1), object: B(0) },
5156
+ start: { group: e, object: R(0) },
5157
+ end: { group: t + R(1), object: R(0) },
5149
5158
  params: /* @__PURE__ */ new Map(),
5150
5159
  subscriberPriority: 0
5151
5160
  };
@@ -5188,13 +5197,13 @@ class Il {
5188
5197
  return Bt(this, null, function* () {
5189
5198
  var e, t;
5190
5199
  try {
5191
- for (var b = Y(a(this, gn)), S, x, R; S = !(x = yield new q(b.next())).done; S = !1) {
5192
- var h = x.value;
5200
+ for (var b = Y(a(this, gn)), S, P, B; S = !(P = yield new q(b.next())).done; S = !1) {
5201
+ var h = P.value;
5193
5202
  var d = [];
5194
5203
  try {
5195
- const M = Ne(d, h, !0);
5204
+ const D = Ne(d, h, !0);
5196
5205
  try {
5197
- for (var i = Y(M.groups()), n, o, c; n = !(o = yield new q(i.next())).done; n = !1) {
5206
+ for (var i = Y(D.groups()), n, o, c; n = !(o = yield new q(i.next())).done; n = !1) {
5198
5207
  const T = o.value;
5199
5208
  const U = (e = a(this, ue).range()) == null ? void 0 : e.startGroup, k = (t = a(this, ue).range()) == null ? void 0 : t.endGroup;
5200
5209
  if (U && T.groupId() < U)
@@ -5220,14 +5229,14 @@ class Il {
5220
5229
  w && (yield new q(w));
5221
5230
  }
5222
5231
  }
5223
- } catch (x) {
5224
- R = [x];
5232
+ } catch (P) {
5233
+ B = [P];
5225
5234
  } finally {
5226
5235
  try {
5227
- S && (x = b.return) && (yield new q(x.call(b)));
5236
+ S && (P = b.return) && (yield new q(P.call(b)));
5228
5237
  } finally {
5229
- if (R)
5230
- throw R[0];
5238
+ if (B)
5239
+ throw B[0];
5231
5240
  }
5232
5241
  }
5233
5242
  });
@@ -5278,46 +5287,46 @@ class Il {
5278
5287
  return A(this, wn, tr).call(this);
5279
5288
  }
5280
5289
  }
5281
- nh = vi(null), pn = new WeakMap(), ue = new WeakMap(), gn = new WeakMap(), An = new WeakMap(), wn = new WeakSet(), tr = function() {
5290
+ nh = Si(null), pn = new WeakMap(), ue = new WeakMap(), gn = new WeakMap(), An = new WeakMap(), wn = new WeakSet(), tr = function() {
5282
5291
  return f(this, null, function* () {
5283
5292
  return yield this.close(), this.unsubscribe();
5284
5293
  });
5285
- }, tr = ye(nh, 17, "#dispose", nu, wn, tr), zt(nh, Il);
5294
+ }, tr = ye(nh, 17, "#dispose", nu, wn, tr), Xt(nh, Il);
5286
5295
  const rA = 2e3;
5287
- var ru, au, ou, cu, Ot, Le, qi, $i, Cs, Et, io, Rs;
5296
+ var ru, au, ou, cu, Ot, Le, $i, Yi, Cs, Et, io, Rs;
5288
5297
  cu = [Pe({ context: "Session", return: "debug" })], ou = [Pe({ context: "Session", enter: "info", error: "error" })], au = [Pe({ context: "Session", enter: "debug" })], ru = [Pe({ context: "Session", enter: "debug" })];
5289
5298
  class to {
5290
5299
  constructor(e, t) {
5291
- Si(Cs, 5, this);
5300
+ Ei(Cs, 5, this);
5292
5301
  u(this, Et);
5293
5302
  // The owner session of the subscriber
5294
5303
  u(this, Ot);
5295
5304
  // The next subscribe id
5296
- r(this, "nextSubscribeId", B(0));
5305
+ r(this, "nextSubscribeId", R(0));
5297
5306
  // The active subscriptions
5298
5307
  u(this, Le, new Ie(/* @__PURE__ */ new Map()));
5299
- u(this, qi);
5300
- u(this, $i, ge.get().createContext("Subscriber"));
5301
- l(this, Ot, e), l(this, qi, t), A(this, Et, io).call(this).catch(D);
5302
- }
5303
- subscribe(e, t) {
5304
- return f(this, null, function* () {
5305
- const i = this.nextSubscribeId++, n = /* @__PURE__ */ new Map(), o = a(this, Ot).authToken();
5306
- o && n.set(Uo, { type: Uo, payload: new TextEncoder().encode(o) });
5307
- const c = {
5308
+ u(this, $i);
5309
+ u(this, Yi, ge.get().createContext("Subscriber"));
5310
+ l(this, Ot, e), l(this, $i, t), A(this, Et, io).call(this).catch(O);
5311
+ }
5312
+ subscribe(n, o) {
5313
+ return f(this, arguments, function* (e, t, i = /* @__PURE__ */ new Map()) {
5314
+ const c = this.nextSubscribeId++, h = a(this, Ot).authToken();
5315
+ h && i.set(Uo, { type: Uo, payload: new TextEncoder().encode(h) });
5316
+ const d = {
5308
5317
  type: I.Subscribe,
5309
5318
  namespace: e,
5310
5319
  name: t.name,
5311
- id: i,
5312
- trackAlias: i,
5320
+ id: c,
5321
+ trackAlias: c,
5313
5322
  groupOrder: t.groupOrder,
5314
5323
  subscriberPriority: t.priority,
5315
5324
  filterType: t.filterType,
5316
- params: n
5317
- }, [h, d] = sA(a(this, qi), c);
5318
- if (a(this, Le).update((p) => p.set(i, h)), yield a(this, qi).push(c), !(yield Promise.race([h.state.ok(), a(this, Ot).closed()])))
5325
+ params: i
5326
+ }, [m, p] = sA(a(this, $i), d);
5327
+ if (a(this, Le).update((w) => w.set(c, m)), yield a(this, $i).push(d), !(yield Promise.race([m.state.ok(), a(this, Ot).closed()])))
5319
5328
  throw new Error("Session closed");
5320
- return d.closed().then(() => Promise.race([gs(rA), this.closed()])).then(() => A(this, Et, Rs).call(this, d.id)).catch(() => A(this, Et, Rs).call(this, d.id)), d;
5329
+ return p.closed().then(() => Promise.race([gs(rA), this.closed()])).then(() => A(this, Et, Rs).call(this, p.id)).catch(() => A(this, Et, Rs).call(this, p.id)), p;
5321
5330
  });
5322
5331
  }
5323
5332
  closed() {
@@ -5333,7 +5342,7 @@ class to {
5333
5342
  return f(this, null, function* () {
5334
5343
  switch (e.type) {
5335
5344
  case I.Announce:
5336
- yield a(this, qi).push({
5345
+ yield a(this, $i).push({
5337
5346
  type: I.AnnounceOk,
5338
5347
  namespace: e.namespace
5339
5348
  });
@@ -5347,13 +5356,13 @@ class to {
5347
5356
  case I.SubscribeError:
5348
5357
  {
5349
5358
  const t = a(this, Le).current().get(e.id);
5350
- t || a(this, $i).debug("No subscription found", e), t == null || t.onError(e), A(this, Et, Rs).call(this, e.id);
5359
+ t || a(this, Yi).debug("No subscription found", e), t == null || t.onError(e), A(this, Et, Rs).call(this, e.id);
5351
5360
  }
5352
5361
  break;
5353
5362
  case I.SubscribeDone:
5354
5363
  {
5355
5364
  const t = a(this, Le).current().get(e.id);
5356
- t || a(this, $i).debug("No subscription found", e), t == null || t.onDone(e);
5365
+ t || a(this, Yi).debug("No subscription found", e), t == null || t.onDone(e);
5357
5366
  }
5358
5367
  break;
5359
5368
  }
@@ -5363,7 +5372,7 @@ class to {
5363
5372
  return f(this, null, function* () {
5364
5373
  const t = a(this, Le).current().get(e.subscribeId());
5365
5374
  if (!t) {
5366
- a(this, $i).warn("No subscription found", e.subscribeId());
5375
+ a(this, Yi).warn("No subscription found", e.subscribeId());
5367
5376
  return;
5368
5377
  }
5369
5378
  yield t.onData(e);
@@ -5373,13 +5382,13 @@ class to {
5373
5382
  a(this, Le).current().forEach((e) => e.close()), a(this, Le).close();
5374
5383
  }
5375
5384
  }
5376
- Cs = vi(null), Ot = new WeakMap(), Le = new WeakMap(), qi = new WeakMap(), $i = new WeakMap(), Et = new WeakSet(), io = function() {
5385
+ Cs = Si(null), Ot = new WeakMap(), Le = new WeakMap(), $i = new WeakMap(), Yi = new WeakMap(), Et = new WeakSet(), io = function() {
5377
5386
  return f(this, null, function* () {
5378
5387
  try {
5379
5388
  for (var e = Y(a(this, Le)), t, i, n; t = !(i = yield e.next()).done; t = !1) {
5380
5389
  const o = i.value;
5381
5390
  const c = [...o.values()].map((h) => h.state.subscribe);
5382
- a(this, $i).debug("current subscriptions", c);
5391
+ a(this, Yi).debug("current subscriptions", c);
5383
5392
  }
5384
5393
  } catch (i) {
5385
5394
  n = [i];
@@ -5394,24 +5403,24 @@ Cs = vi(null), Ot = new WeakMap(), Le = new WeakMap(), qi = new WeakMap(), $i =
5394
5403
  });
5395
5404
  }, Rs = function(e) {
5396
5405
  a(this, Le).isClosed() || a(this, Le).update((t) => (t.delete(e), t));
5397
- }, io = ye(Cs, 17, "#observeChanges", cu, Et, io), ye(Cs, 1, "subscribe", ou, to), ye(Cs, 1, "close", au, to), Rs = ye(Cs, 17, "#deleteSubscription", ru, Et, Rs), zt(Cs, to);
5398
- var hu, du, uu, lu, it, la, Yi, bn, yn, oe, Cl, kl, ks, so, no, ro, ir;
5406
+ }, io = ye(Cs, 17, "#observeChanges", cu, Et, io), ye(Cs, 1, "subscribe", ou, to), ye(Cs, 1, "close", au, to), Rs = ye(Cs, 17, "#deleteSubscription", ru, Et, Rs), Xt(Cs, to);
5407
+ var hu, du, uu, lu, it, la, Ji, bn, yn, oe, Cl, kl, ks, so, no, ro, ir;
5399
5408
  class nd {
5400
5409
  constructor(e, t) {
5401
- Si(ks, 5, this);
5410
+ Ei(ks, 5, this);
5402
5411
  u(this, oe);
5403
5412
  // The underlying transport implementation
5404
5413
  u(this, it);
5405
5414
  // The background "thread" running the background tasks
5406
5415
  u(this, la);
5407
5416
  // Outgoing messages
5408
- u(this, Yi);
5417
+ u(this, Ji);
5409
5418
  u(this, bn, ge.get().createContext("Session"));
5410
5419
  r(this, "subscriber");
5411
5420
  r(this, "publisher");
5412
5421
  u(this, yn);
5413
5422
  const [i, n] = ed(100);
5414
- l(this, it, e), l(this, Yi, n), this.subscriber = new to(this, i), this.publisher = new yh(this, e, i), l(this, la, A(this, oe, kl).call(this)), l(this, yn, new Ie(t)), this.closed().then(() => this.close()).catch(D);
5423
+ l(this, it, e), l(this, Ji, n), this.subscriber = new to(this, i), this.publisher = new yh(this, e, i), l(this, la, A(this, oe, kl).call(this)), l(this, yn, new Ie(t)), this.closed().then(() => this.close()).catch(O);
5415
5424
  }
5416
5425
  updateAuthToken(e) {
5417
5426
  a(this, yn).update(e);
@@ -5430,7 +5439,7 @@ class nd {
5430
5439
  }
5431
5440
  close() {
5432
5441
  try {
5433
- this.subscriber.close(), this.publisher.close(), a(this, Yi).cancel("closing"), a(this, it).close();
5442
+ this.subscriber.close(), this.publisher.close(), a(this, Ji).cancel("closing"), a(this, it).close();
5434
5443
  } catch (e) {
5435
5444
  a(this, bn).warn("Error closing session", e);
5436
5445
  }
@@ -5442,7 +5451,7 @@ class nd {
5442
5451
  A(this, oe, ir).call(this);
5443
5452
  }
5444
5453
  }
5445
- ks = vi(null), it = new WeakMap(), la = new WeakMap(), Yi = new WeakMap(), bn = new WeakMap(), yn = new WeakMap(), oe = new WeakSet(), Cl = function(e) {
5454
+ ks = Si(null), it = new WeakMap(), la = new WeakMap(), Ji = new WeakMap(), bn = new WeakMap(), yn = new WeakMap(), oe = new WeakSet(), Cl = function(e) {
5446
5455
  return f(this, null, function* () {
5447
5456
  var t, i;
5448
5457
  switch (a(this, bn).debug("received message", e), yield (t = this.subscriber) == null ? void 0 : t.onMessage(e), yield (i = this.publisher) == null ? void 0 : i.onMessage(e), e.type) {
@@ -5458,7 +5467,7 @@ ks = vi(null), it = new WeakMap(), la = new WeakMap(), Yi = new WeakMap(), bn =
5458
5467
  return f(this, null, function* () {
5459
5468
  try {
5460
5469
  try {
5461
- for (var e = Y(a(this, Yi)), t, i, n; t = !(i = yield e.next()).done; t = !1) {
5470
+ for (var e = Y(a(this, Ji)), t, i, n; t = !(i = yield e.next()).done; t = !1) {
5462
5471
  const o = i.value;
5463
5472
  a(this, bn).debug("sending message", o), yield a(this, it).writeMessage(o);
5464
5473
  }
@@ -5489,7 +5498,7 @@ ks = vi(null), it = new WeakMap(), la = new WeakMap(), Yi = new WeakMap(), bn =
5489
5498
  } catch (e) {
5490
5499
  return e;
5491
5500
  } finally {
5492
- a(this, Yi).cancel("closing");
5501
+ a(this, Ji).cancel("closing");
5493
5502
  }
5494
5503
  });
5495
5504
  }, ro = function() {
@@ -5508,74 +5517,74 @@ ks = vi(null), it = new WeakMap(), la = new WeakMap(), Yi = new WeakMap(), bn =
5508
5517
  });
5509
5518
  }, ir = function() {
5510
5519
  this.close();
5511
- }, so = ye(ks, 17, "#runOutgoingMessages", lu, oe, so), no = ye(ks, 17, "#runControl", uu, oe, no), ro = ye(ks, 17, "#runObjects", du, oe, ro), ir = ye(ks, 17, "#dispose", hu, oe, ir), zt(ks, nd);
5520
+ }, so = ye(ks, 17, "#runOutgoingMessages", lu, oe, so), no = ye(ks, 17, "#runControl", uu, oe, no), ro = ye(ks, 17, "#runObjects", du, oe, ro), ir = ye(ks, 17, "#dispose", hu, oe, ir), Xt(ks, nd);
5512
5521
  const aA = 128;
5513
- var ze, ma, Ji, vn, fa, be, ki, Bi;
5522
+ var ze, ma, Ki, vn, fa, be, Bi, Ri;
5514
5523
  class oA {
5515
5524
  constructor(e, t, i) {
5516
5525
  u(this, be);
5517
5526
  u(this, ze);
5518
5527
  u(this, ma);
5519
- u(this, Ji, !0);
5528
+ u(this, Ki, !0);
5520
5529
  u(this, vn, !1);
5521
5530
  u(this, fa);
5522
5531
  l(this, ze, e), l(this, ma, t), l(this, fa, i);
5523
5532
  }
5524
5533
  writeUnsigned8(e) {
5525
5534
  return f(this, null, function* () {
5526
- return A(this, be, ki).call(this), yield A(this, be, Bi).call(this), a(this, ze).writeUnsigned8(e);
5535
+ return A(this, be, Bi).call(this), yield A(this, be, Ri).call(this), a(this, ze).writeUnsigned8(e);
5527
5536
  });
5528
5537
  }
5529
5538
  writeVarInt(e) {
5530
5539
  return f(this, null, function* () {
5531
- return A(this, be, ki).call(this), yield A(this, be, Bi).call(this), a(this, ze).writeVarInt(e);
5540
+ return A(this, be, Bi).call(this), yield A(this, be, Ri).call(this), a(this, ze).writeVarInt(e);
5532
5541
  });
5533
5542
  }
5534
5543
  writeBigVarInt(e) {
5535
5544
  return f(this, null, function* () {
5536
- return A(this, be, ki).call(this), yield A(this, be, Bi).call(this), a(this, ze).writeBigVarInt(e);
5545
+ return A(this, be, Bi).call(this), yield A(this, be, Ri).call(this), a(this, ze).writeBigVarInt(e);
5537
5546
  });
5538
5547
  }
5539
5548
  write(e) {
5540
5549
  return f(this, null, function* () {
5541
- return A(this, be, ki).call(this), yield A(this, be, Bi).call(this), a(this, ze).write(e);
5550
+ return A(this, be, Bi).call(this), yield A(this, be, Ri).call(this), a(this, ze).write(e);
5542
5551
  });
5543
5552
  }
5544
5553
  writeString(e) {
5545
5554
  return f(this, null, function* () {
5546
- return A(this, be, ki).call(this), yield A(this, be, Bi).call(this), a(this, ze).writeString(e);
5555
+ return A(this, be, Bi).call(this), yield A(this, be, Ri).call(this), a(this, ze).writeString(e);
5547
5556
  });
5548
5557
  }
5549
5558
  flush() {
5550
5559
  return f(this, null, function* () {
5551
- A(this, be, ki).call(this), l(this, Ji, !0), yield a(this, ze).flush();
5560
+ A(this, be, Bi).call(this), l(this, Ki, !0), yield a(this, ze).flush();
5552
5561
  });
5553
5562
  }
5554
5563
  close() {
5555
5564
  return f(this, null, function* () {
5556
- a(this, vn) || (l(this, Ji, !0), yield A(this, be, Bi).call(this, !1), yield a(this, ze).flush(), l(this, vn, !0), a(this, fa).call(this));
5565
+ a(this, vn) || (l(this, Ki, !0), yield A(this, be, Ri).call(this, !1), yield a(this, ze).flush(), l(this, vn, !0), a(this, fa).call(this));
5557
5566
  });
5558
5567
  }
5559
5568
  }
5560
- ze = new WeakMap(), ma = new WeakMap(), Ji = new WeakMap(), vn = new WeakMap(), fa = new WeakMap(), be = new WeakSet(), ki = function() {
5569
+ ze = new WeakMap(), ma = new WeakMap(), Ki = new WeakMap(), vn = new WeakMap(), fa = new WeakMap(), be = new WeakSet(), Bi = function() {
5561
5570
  if (a(this, vn))
5562
5571
  throw new Error("Stream is closed");
5563
- }, Bi = function(e = !0) {
5564
- if (a(this, Ji))
5565
- return l(this, Ji, !1), a(this, ze).writeUnsigned8(a(this, ma) | (e ? aA : 0));
5572
+ }, Ri = function(e = !0) {
5573
+ if (a(this, Ki))
5574
+ return l(this, Ki, !1), a(this, ze).writeUnsigned8(a(this, ma) | (e ? aA : 0));
5566
5575
  };
5567
- var ai, Mt, Sn, Ki, Ft, En, Tn, ec, Bl;
5576
+ var ci, Mt, Sn, es, Ft, En, Tn, ec, Bl;
5568
5577
  class cA {
5569
5578
  constructor(e, t) {
5570
5579
  u(this, ec);
5571
- u(this, ai);
5580
+ u(this, ci);
5572
5581
  u(this, Mt);
5573
5582
  u(this, Sn);
5574
- u(this, Ki);
5583
+ u(this, es);
5575
5584
  u(this, Ft, /* @__PURE__ */ new Map());
5576
5585
  u(this, En, ge.get().createContext("WebSocketConnection"));
5577
5586
  u(this, Tn, new Set(new Array(128).fill(0).map((e, t) => t + 1)));
5578
- l(this, ai, e), l(this, Mt, t), l(this, Sn, new ReadableStream(new yg(e))), a(this, ai).addEventListener("close", () => {
5587
+ l(this, ci, e), l(this, Mt, t), l(this, Sn, new ReadableStream(new yg(e))), a(this, ci).addEventListener("close", () => {
5579
5588
  a(this, Mt).markPostHandshake(), a(this, Ft).forEach((i) => i.close());
5580
5589
  });
5581
5590
  }
@@ -5584,14 +5593,14 @@ class cA {
5584
5593
  if (!e)
5585
5594
  throw new Error("No stream IDs available");
5586
5595
  return a(this, Tn).delete(e), Promise.resolve(
5587
- new oA(new Rr(a(this, ai)), e, () => A(this, ec, Bl).call(this, e))
5596
+ new oA(new Rr(a(this, ci)), e, () => A(this, ec, Bl).call(this, e))
5588
5597
  );
5589
5598
  }
5590
5599
  transportType() {
5591
5600
  return "websocket";
5592
5601
  }
5593
5602
  url() {
5594
- return a(this, ai).url;
5603
+ return a(this, ci).url;
5595
5604
  }
5596
5605
  afterHandshake() {
5597
5606
  return a(this, Mt).postHandshake();
@@ -5600,17 +5609,17 @@ class cA {
5600
5609
  return f(this, null, function* () {
5601
5610
  var e;
5602
5611
  for (; ; ) {
5603
- l(this, Ki, a(this, Sn).getReader());
5612
+ l(this, es, a(this, Sn).getReader());
5604
5613
  try {
5605
- const { value: t, done: i } = yield a(this, Ki).read();
5614
+ const { value: t, done: i } = yield a(this, es).read();
5606
5615
  if (i)
5607
5616
  return;
5608
5617
  const [n, o, c] = t;
5609
- if (a(this, Ft).has(B(o))) {
5610
- const h = a(this, Ft).get(B(o));
5618
+ if (a(this, Ft).has(R(o))) {
5619
+ const h = a(this, Ft).get(R(o));
5611
5620
  if (!h)
5612
5621
  throw new Error("Stream not found");
5613
- c.length > 0 && (yield h.push(c)), n || (a(this, En).debug("Closing stream", { streamId: o }), h.close(), a(this, Ft).delete(B(o)));
5622
+ c.length > 0 && (yield h.push(c)), n || (a(this, En).debug("Closing stream", { streamId: o }), h.close(), a(this, Ft).delete(R(o)));
5614
5623
  } else {
5615
5624
  let p;
5616
5625
  a(this, En).debug("Creating new stream", { streamId: o });
@@ -5622,18 +5631,18 @@ class cA {
5622
5631
  });
5623
5632
  }
5624
5633
  });
5625
- if (a(this, Ft).set(B(o), h), n || (a(this, En).debug("Closing new stream", { streamId: o }), yield m.cancel(), a(this, Ft).delete(B(o))), c.length > 0)
5634
+ if (a(this, Ft).set(R(o), h), n || (a(this, En).debug("Closing new stream", { streamId: o }), yield m.cancel(), a(this, Ft).delete(R(o))), c.length > 0)
5626
5635
  return yield qu(new Ro(c, m), o);
5627
5636
  }
5628
5637
  } finally {
5629
- (e = a(this, Ki)) == null || e.releaseLock();
5638
+ (e = a(this, es)) == null || e.releaseLock();
5630
5639
  }
5631
5640
  }
5632
5641
  });
5633
5642
  }
5634
5643
  close() {
5635
5644
  var e;
5636
- return a(this, Mt).cancel().catch(D), a(this, Sn).cancel("closing").catch(D), (e = a(this, Ki)) == null || e.cancel("closing").catch(D), a(this, ai).close();
5645
+ return a(this, Mt).cancel().catch(O), a(this, Sn).cancel("closing").catch(O), (e = a(this, es)) == null || e.cancel("closing").catch(O), a(this, ci).close();
5637
5646
  }
5638
5647
  closed() {
5639
5648
  return Promise.resolve();
@@ -5649,30 +5658,32 @@ class cA {
5649
5658
  });
5650
5659
  }
5651
5660
  }
5652
- ai = new WeakMap(), Mt = new WeakMap(), Sn = new WeakMap(), Ki = new WeakMap(), Ft = new WeakMap(), En = new WeakMap(), Tn = new WeakMap(), ec = new WeakSet(), /**
5661
+ ci = new WeakMap(), Mt = new WeakMap(), Sn = new WeakMap(), es = new WeakMap(), Ft = new WeakMap(), En = new WeakMap(), Tn = new WeakMap(), ec = new WeakSet(), /**
5653
5662
  * Return a stream ID to the pool of available stream IDs
5654
5663
  * @param streamId - The stream ID to return
5655
5664
  */
5656
5665
  Bl = function(e) {
5657
5666
  a(this, Tn).add(e);
5658
5667
  };
5659
- var oi, ci, es, pa, ga, tc, ic, Rl;
5668
+ var _t, Nt, hi, pa, ga, tc, ic, Rl;
5660
5669
  class hA {
5661
5670
  constructor(e, t, i) {
5662
5671
  u(this, ic);
5663
- u(this, oi);
5664
- u(this, ci);
5665
- u(this, es, new Dc(100));
5672
+ u(this, _t);
5673
+ u(this, Nt);
5674
+ u(this, hi, new Dc(100));
5666
5675
  u(this, pa);
5667
5676
  u(this, ga, 0);
5668
5677
  u(this, tc, ge.get().createContext("WebTransportConnection"));
5669
- l(this, pa, i), l(this, oi, e), l(this, ci, t), A(this, ic, Rl).call(this).catch((n) => {
5670
- a(this, tc).debug("Incoming streams handling ended with error", n), a(this, ci).markPostHandshake(), a(this, es).close();
5678
+ l(this, pa, i), l(this, _t, e), l(this, Nt, t), A(this, ic, Rl).call(this).catch((n) => {
5679
+ a(this, tc).debug("Incoming streams handling ended with error", n), a(this, Nt).markPostHandshake(), a(this, hi).close();
5680
+ }), a(this, _t).closed.then(() => {
5681
+ a(this, Nt).markPostHandshake(), a(this, hi).close();
5671
5682
  });
5672
5683
  }
5673
5684
  openSendStream() {
5674
5685
  return f(this, null, function* () {
5675
- const e = yield a(this, oi).createUnidirectionalStream();
5686
+ const e = yield a(this, _t).createUnidirectionalStream();
5676
5687
  return new $u(e);
5677
5688
  });
5678
5689
  }
@@ -5683,43 +5694,43 @@ class hA {
5683
5694
  return a(this, pa);
5684
5695
  }
5685
5696
  afterHandshake() {
5686
- return a(this, ci).postHandshake();
5697
+ return a(this, Nt).postHandshake();
5687
5698
  }
5688
5699
  closed() {
5689
5700
  return f(this, null, function* () {
5690
- yield a(this, oi).closed;
5701
+ yield a(this, _t).closed;
5691
5702
  });
5692
5703
  }
5693
5704
  close() {
5694
- a(this, oi).close();
5705
+ a(this, _t).close();
5695
5706
  }
5696
5707
  writeMessage(e) {
5697
5708
  return f(this, null, function* () {
5698
- yield a(this, ci).write(e);
5709
+ yield a(this, Nt).write(e);
5699
5710
  });
5700
5711
  }
5701
5712
  readMessage() {
5702
5713
  return f(this, null, function* () {
5703
- return a(this, ci).read();
5714
+ return a(this, Nt).read();
5704
5715
  });
5705
5716
  }
5706
5717
  objectStream() {
5707
5718
  return f(this, null, function* () {
5708
- return a(this, es).pop();
5719
+ return a(this, hi).pop();
5709
5720
  });
5710
5721
  }
5711
5722
  }
5712
- oi = new WeakMap(), ci = new WeakMap(), es = new WeakMap(), pa = new WeakMap(), ga = new WeakMap(), tc = new WeakMap(), ic = new WeakSet(), Rl = function() {
5723
+ _t = new WeakMap(), Nt = new WeakMap(), hi = new WeakMap(), pa = new WeakMap(), ga = new WeakMap(), tc = new WeakMap(), ic = new WeakSet(), Rl = function() {
5713
5724
  return f(this, null, function* () {
5714
- const e = a(this, oi).incomingUnidirectionalStreams.getReader();
5725
+ const e = a(this, _t).incomingUnidirectionalStreams.getReader();
5715
5726
  for (; ; ) {
5716
5727
  const { value: t, done: i } = yield e.read();
5717
5728
  if (i) {
5718
- a(this, es).close();
5729
+ a(this, hi).close();
5719
5730
  return;
5720
5731
  }
5721
5732
  const n = new Ro(new Uint8Array(), t);
5722
- yield a(this, es).push(qu(n, a(this, ga))), Ze(this, ga)._++;
5733
+ yield a(this, hi).push(qu(n, a(this, ga))), Ze(this, ga)._++;
5723
5734
  }
5724
5735
  });
5725
5736
  };
@@ -5764,47 +5775,47 @@ function uA(s) {
5764
5775
  return $c(s);
5765
5776
  });
5766
5777
  }
5767
- var _t;
5768
- class jt {
5778
+ var Vt;
5779
+ class zt {
5769
5780
  constructor() {
5770
- u(this, _t, {
5781
+ u(this, Vt, {
5771
5782
  name: "",
5772
5783
  priority: 0,
5773
- groupOrder: "descending",
5784
+ groupOrder: "ascending",
5774
5785
  filterType: { type: "latest-group" }
5775
5786
  });
5776
5787
  }
5777
5788
  name(e) {
5778
- return a(this, _t).name = e, this;
5789
+ return a(this, Vt).name = e, this;
5779
5790
  }
5780
5791
  priority(e) {
5781
- return a(this, _t).priority = e, this;
5792
+ return a(this, Vt).priority = e, this;
5782
5793
  }
5783
5794
  groupOrder(e) {
5784
- return a(this, _t).groupOrder = e, this;
5795
+ return a(this, Vt).groupOrder = e, this;
5785
5796
  }
5786
5797
  /**
5787
5798
  * @param startGroup the group to start the subscription at
5788
5799
  * @returns the builder
5789
5800
  */
5790
5801
  startGroup(e) {
5791
- return a(this, _t).filterType = {
5802
+ return a(this, Vt).filterType = {
5792
5803
  type: "absolute-start",
5793
- start: { group: e, object: B(0) }
5804
+ start: { group: e, object: R(0) }
5794
5805
  }, this;
5795
5806
  }
5796
5807
  range(e, t) {
5797
- return a(this, _t).filterType = {
5808
+ return a(this, Vt).filterType = {
5798
5809
  type: "absolute-range",
5799
- start: { group: e, object: B(0) },
5800
- end: { group: t, object: B(0) }
5810
+ start: { group: e, object: R(0) },
5811
+ end: { group: t, object: R(0) }
5801
5812
  }, this;
5802
5813
  }
5803
5814
  build() {
5804
- return a(this, _t);
5815
+ return a(this, Vt);
5805
5816
  }
5806
5817
  }
5807
- _t = new WeakMap();
5818
+ Vt = new WeakMap();
5808
5819
  var In, Aa;
5809
5820
  class Ul {
5810
5821
  constructor(e, t) {
@@ -5812,8 +5823,8 @@ class Ul {
5812
5823
  u(this, Aa);
5813
5824
  l(this, In, e), l(this, Aa, t);
5814
5825
  }
5815
- subscribe(e) {
5816
- return a(this, In).subscribe(this.namespace(), e);
5826
+ subscribe(e, t = /* @__PURE__ */ new Map()) {
5827
+ return a(this, In).subscribe(this.namespace(), e, t);
5817
5828
  }
5818
5829
  closed() {
5819
5830
  return a(this, In).closed();
@@ -5826,7 +5837,7 @@ In = new WeakMap(), Aa = new WeakMap();
5826
5837
  function lA(s, e) {
5827
5838
  return ["com.vindral.moq", s];
5828
5839
  }
5829
- function Ei(s) {
5840
+ function Ti(s) {
5830
5841
  const e = s[1];
5831
5842
  if (!e)
5832
5843
  throw new Error("namespace must contain a channel ID");
@@ -5862,7 +5873,7 @@ const cd = class cd {
5862
5873
  l(this, De, e), l(this, wt, t), e.done().then((i) => f(this, null, function* () {
5863
5874
  var n;
5864
5875
  return a(this, sc).call(this, (n = i.finalInfo) == null ? void 0 : n.group);
5865
- })).catch(D), l(this, wa, e.groups());
5876
+ })).catch(O), l(this, wa, e.groups());
5866
5877
  }
5867
5878
  static subscribe(e, t) {
5868
5879
  return f(this, null, function* () {
@@ -5927,7 +5938,7 @@ De = new WeakMap(), wt = new WeakMap(), ts = new WeakMap(), He = new WeakMap(),
5927
5938
  }), i;
5928
5939
  };
5929
5940
  let Do = cd;
5930
- var st, is, Nt, bt, ya, Sh, va;
5941
+ var st, is, Gt, bt, ya, Sh, va;
5931
5942
  const hd = class hd {
5932
5943
  constructor(e) {
5933
5944
  u(this, ya);
@@ -5936,7 +5947,7 @@ const hd = class hd {
5936
5947
  // The current group iterator - gets replaced by the next in #groups when it runs out
5937
5948
  u(this, is);
5938
5949
  // The next group iterators to switch to when the current one runs out
5939
- u(this, Nt, new Dc(10));
5950
+ u(this, Gt, new Dc(10));
5940
5951
  u(this, bt);
5941
5952
  u(this, va, (e, t) => f(this, null, function* () {
5942
5953
  var g = [];
@@ -5949,7 +5960,7 @@ const hd = class hd {
5949
5960
  }
5950
5961
  const o = i.value.largestGroupId();
5951
5962
  const c = o !== void 0;
5952
- const h = new jt().name(t.name).priority(t.priority).groupOrder(t.groupOrder);
5963
+ const h = new zt().name(t.name).priority(t.priority).groupOrder(t.groupOrder);
5953
5964
  n.largestGroupId = o;
5954
5965
  a(this, bt).debug("Renewing subscription", n);
5955
5966
  switch (t.filterType.type) {
@@ -5959,7 +5970,7 @@ const hd = class hd {
5959
5970
  case "absolute-start":
5960
5971
  case "latest-group":
5961
5972
  case "latest-object":
5962
- c && h.startGroup(o + B(1));
5973
+ c && h.startGroup(o + R(1));
5963
5974
  break;
5964
5975
  }
5965
5976
  const d = h.build();
@@ -5968,11 +5979,11 @@ const hd = class hd {
5968
5979
  e.subscribe(d),
5969
5980
  c ? i.value.update(o, o) : i.value.unsubscribe()
5970
5981
  ]);
5971
- m.done().then(() => A(this, ya, Sh).call(this, m)).catch(D);
5972
- m.expiryNotification().then(() => a(this, va).call(this, e, d)).catch(D);
5982
+ m.done().then(() => A(this, ya, Sh).call(this, m)).catch(O);
5983
+ m.expiryNotification().then(() => a(this, va).call(this, e, d)).catch(O);
5973
5984
  const p = new Do(m, o);
5974
5985
  i.value = p;
5975
- yield a(this, Nt).push(p);
5986
+ yield a(this, Gt).push(p);
5976
5987
  a(this, bt).info("Subscription renewed", n);
5977
5988
  } catch (w) {
5978
5989
  var b = w, S = !0;
@@ -5984,14 +5995,14 @@ const hd = class hd {
5984
5995
  }
5985
5996
  static subscribe(e, t, i) {
5986
5997
  return f(this, null, function* () {
5987
- const n = yield e.subscribe(t), o = new hd(new Do(n, i));
5988
- return n.done().then(() => {
5989
- var c;
5990
- return A(c = o, ya, Sh).call(c, n);
5991
- }).catch(D), n.expiryNotification().then(() => {
5992
- var c;
5993
- return a(c = o, va).call(c, e, t);
5994
- }).catch(D), o;
5998
+ const n = i == null ? void 0 : i.params, o = i == null ? void 0 : i.largestGroupId, c = yield e.subscribe(t, n), h = new hd(new Do(c, o));
5999
+ return c.done().then(() => {
6000
+ var d;
6001
+ return A(d = h, ya, Sh).call(d, c);
6002
+ }).catch(O), c.expiryNotification().then(() => {
6003
+ var d;
6004
+ return a(d = h, va).call(d, e, t);
6005
+ }).catch(O), h;
5995
6006
  });
5996
6007
  }
5997
6008
  largestGroupId() {
@@ -6002,7 +6013,7 @@ const hd = class hd {
6002
6013
  var n = [];
6003
6014
  try {
6004
6015
  const i = Ne(n, yield a(this, st).lock());
6005
- a(this, Nt).close();
6016
+ a(this, Gt).close();
6006
6017
  return i.value.update(e, t);
6007
6018
  } catch (o) {
6008
6019
  var c = o, h = !0;
@@ -6016,7 +6027,7 @@ const hd = class hd {
6016
6027
  var i = [];
6017
6028
  try {
6018
6029
  const t = Ne(i, yield a(this, st).lock());
6019
- a(this, Nt).close();
6030
+ a(this, Gt).close();
6020
6031
  return t.value.endOfTrack(e);
6021
6032
  } catch (n) {
6022
6033
  var o = n, c = !0;
@@ -6030,7 +6041,7 @@ const hd = class hd {
6030
6041
  var t = [];
6031
6042
  try {
6032
6043
  const e = Ne(t, yield a(this, st).lock());
6033
- a(this, Nt).close();
6044
+ a(this, Gt).close();
6034
6045
  return e.value.unsubscribe();
6035
6046
  } catch (i) {
6036
6047
  var n = i, o = !0;
@@ -6044,7 +6055,7 @@ const hd = class hd {
6044
6055
  var t = [];
6045
6056
  try {
6046
6057
  const e = Ne(t, yield a(this, st).lock());
6047
- a(this, Nt).close();
6058
+ a(this, Gt).close();
6048
6059
  return e.value.return();
6049
6060
  } catch (i) {
6050
6061
  var n = i, o = !0;
@@ -6059,7 +6070,7 @@ const hd = class hd {
6059
6070
  const e = yield a(this, is).next();
6060
6071
  if (e.done) {
6061
6072
  yield (i = (t = a(this, is)).return) == null ? void 0 : i.call(t);
6062
- const n = yield a(this, Nt).pop();
6073
+ const n = yield a(this, Gt).pop();
6063
6074
  if (n)
6064
6075
  return l(this, is, n), this.next();
6065
6076
  }
@@ -6098,7 +6109,7 @@ const hd = class hd {
6098
6109
  });
6099
6110
  }
6100
6111
  };
6101
- st = new WeakMap(), is = new WeakMap(), Nt = new WeakMap(), bt = new WeakMap(), ya = new WeakSet(), Sh = function(e) {
6112
+ st = new WeakMap(), is = new WeakMap(), Gt = new WeakMap(), bt = new WeakMap(), ya = new WeakSet(), Sh = function(e) {
6102
6113
  return f(this, null, function* () {
6103
6114
  var t;
6104
6115
  if (e.unsubscribed() || (t = e.range()) != null && t.endGroup) {
@@ -6112,7 +6123,7 @@ st = new WeakMap(), is = new WeakMap(), Nt = new WeakMap(), bt = new WeakMap(),
6112
6123
  return this.return();
6113
6124
  });
6114
6125
  }, va = new WeakMap();
6115
- let yi = hd;
6126
+ let vi = hd;
6116
6127
  const pA = "catalog";
6117
6128
  function Gd(s) {
6118
6129
  const e = fA(s.payload);
@@ -6120,33 +6131,33 @@ function Gd(s) {
6120
6131
  throw new Error("unexpected catalog type");
6121
6132
  return e;
6122
6133
  }
6123
- var hi, Sa, Ea, Ta, nc, Pl;
6134
+ var di, Sa, Ea, Ta, nc, Pl;
6124
6135
  const rc = class rc {
6125
6136
  constructor(e, t, i) {
6126
6137
  u(this, nc);
6127
- u(this, hi);
6138
+ u(this, di);
6128
6139
  u(this, Sa);
6129
6140
  u(this, Ea);
6130
6141
  u(this, Ta);
6131
- l(this, Sa, e), l(this, hi, t), l(this, Ea, i), l(this, Ta, A(this, nc, Pl).call(this)), this.closed().finally(() => a(this, hi).close()).catch(D);
6142
+ l(this, Sa, e), l(this, di, t), l(this, Ea, i), l(this, Ta, A(this, nc, Pl).call(this)), this.closed().finally(() => a(this, di).close()).catch(O);
6132
6143
  }
6133
6144
  catalog() {
6134
- return a(this, hi);
6145
+ return a(this, di);
6135
6146
  }
6136
6147
  closed() {
6137
6148
  return a(this, Ta);
6138
6149
  }
6139
6150
  close() {
6140
6151
  return f(this, null, function* () {
6141
- return a(this, hi).close(), (yield a(this, Sa).promise).unsubscribe();
6152
+ return a(this, di).close(), (yield a(this, Sa).promise).unsubscribe();
6142
6153
  });
6143
6154
  }
6144
6155
  static start(e, t) {
6145
6156
  return f(this, null, function* () {
6146
6157
  const i = H.fromPromise(
6147
- yi.subscribe(
6158
+ vi.subscribe(
6148
6159
  e,
6149
- new jt().name(t.catalogName || pA).groupOrder("ascending").build()
6160
+ new zt().name(t.catalogName || pA).groupOrder("ascending").build()
6150
6161
  )
6151
6162
  ), n = H.fromPromise(i.promise.then((d) => d.objects()));
6152
6163
  if (t.catalog)
@@ -6159,7 +6170,7 @@ const rc = class rc {
6159
6170
  });
6160
6171
  }
6161
6172
  };
6162
- hi = new WeakMap(), Sa = new WeakMap(), Ea = new WeakMap(), Ta = new WeakMap(), nc = new WeakSet(), Pl = function() {
6173
+ di = new WeakMap(), Sa = new WeakMap(), Ea = new WeakMap(), Ta = new WeakMap(), nc = new WeakSet(), Pl = function() {
6163
6174
  return f(this, null, function* () {
6164
6175
  const e = yield a(this, Ea).promise;
6165
6176
  try {
@@ -6168,7 +6179,7 @@ hi = new WeakMap(), Sa = new WeakMap(), Ea = new WeakMap(), Ta = new WeakMap(),
6168
6179
  if (c.objectStatus !== Te.Normal)
6169
6180
  continue;
6170
6181
  const h = Gd(c);
6171
- a(this, hi).update(h);
6182
+ a(this, di).update(h);
6172
6183
  }
6173
6184
  } catch (n) {
6174
6185
  o = [n];
@@ -6256,24 +6267,31 @@ const Fs = class Fs {
6256
6267
  r(this, "namespace");
6257
6268
  this.trackObject = e, this.namespace = t, l(this, yt, i), l(this, Ba, n), l(this, Ra, o);
6258
6269
  }
6259
- static subscribe(e, t, i, n) {
6260
- return f(this, null, function* () {
6261
- var p;
6270
+ static subscribe(c, h, d) {
6271
+ return f(this, arguments, function* (e, t, {
6272
+ timestampOffsetMs: i,
6273
+ startGroup: n,
6274
+ params: o
6275
+ }) {
6276
+ var S;
6262
6277
  if (t.format !== "cmaf")
6263
6278
  throw new Error("format must be cmaf");
6264
- const o = new jt().name(t.name);
6265
- n && o.startGroup(n);
6266
- const c = o.build();
6279
+ const m = new zt().name(t.name);
6280
+ n && m.startGroup(n);
6281
+ const p = m.build();
6267
6282
  if (t.initTrack) {
6268
- const g = new jt().name(t.initTrack).build(), [w, b] = yield Promise.all([
6269
- A(p = Fs, ac, xl).call(p, e, g),
6270
- yi.subscribe(e, c, n ? n - B(1) : void 0)
6271
- ]), S = new Dd(w);
6272
- return new Fs(t, e.namespace(), b, S, i);
6283
+ const P = new zt().name(t.initTrack).build(), [B, D] = yield Promise.all([
6284
+ A(S = Fs, ac, xl).call(S, e, P),
6285
+ vi.subscribe(e, p, { params: o, largestGroupId: n ? n - R(1) : void 0 })
6286
+ ]), T = new Dd(B);
6287
+ return new Fs(t, e.namespace(), D, T, i);
6273
6288
  }
6274
6289
  Xe(t.initData, "no init data found on track");
6275
- const h = bu(t.initData), d = new Dd(new Uint8Array(h)), m = yield yi.subscribe(e, c, n ? n - B(1) : void 0);
6276
- return new Fs(t, e.namespace(), m, d, i);
6290
+ const g = bu(t.initData), w = new Dd(new Uint8Array(g)), b = yield vi.subscribe(e, p, {
6291
+ params: o,
6292
+ largestGroupId: n ? n - R(1) : void 0
6293
+ });
6294
+ return new Fs(t, e.namespace(), b, w, i);
6277
6295
  });
6278
6296
  }
6279
6297
  largestGroupId() {
@@ -6342,17 +6360,17 @@ Ba = new WeakMap(), yt = new WeakMap(), Ra = new WeakMap(), Ua = new WeakMap(),
6342
6360
  }, u(Fs, ac);
6343
6361
  let Ih = Fs;
6344
6362
  const jd = 1e4, AA = 3e4;
6345
- var oc, di, ss, Pa, xa, La, vs, kh, Ll;
6363
+ var oc, ui, ss, Pa, xa, La, vs, kh, Ll;
6346
6364
  const dd = class dd {
6347
6365
  constructor(e, t, i) {
6348
6366
  u(this, vs);
6349
6367
  u(this, oc, ge.get().createContext("Timeline"));
6350
- u(this, di, new Ie([]));
6368
+ u(this, ui, new Ie([]));
6351
6369
  u(this, ss);
6352
6370
  u(this, Pa);
6353
6371
  u(this, xa);
6354
6372
  u(this, La);
6355
- l(this, Pa, e), l(this, xa, i), l(this, ss, t), l(this, La, A(this, vs, kh).call(this, a(this, ss))), this.closed().finally(() => a(this, di).close()).catch(D);
6373
+ l(this, Pa, e), l(this, xa, i), l(this, ss, t), l(this, La, A(this, vs, kh).call(this, a(this, ss))), this.closed().finally(() => a(this, ui).close()).catch(O);
6356
6374
  }
6357
6375
  closed() {
6358
6376
  return a(this, La);
@@ -6363,7 +6381,7 @@ const dd = class dd {
6363
6381
  });
6364
6382
  }
6365
6383
  timeline() {
6366
- const [e, t] = a(this, di).value();
6384
+ const [e, t] = a(this, ui).value();
6367
6385
  return e;
6368
6386
  }
6369
6387
  /**
@@ -6375,45 +6393,45 @@ const dd = class dd {
6375
6393
  }
6376
6394
  static start(e, t) {
6377
6395
  const i = H.fromPromise(
6378
- yi.subscribe(e, new jt().name(t).groupOrder("ascending").build())
6396
+ vi.subscribe(e, new zt().name(t).groupOrder("ascending").build())
6379
6397
  );
6380
6398
  return new dd(e, i, t);
6381
6399
  }
6382
6400
  waitForWallclockTime(e) {
6383
6401
  return f(this, null, function* () {
6384
- return yield a(this, di).waitFor((t) => !!t.find((i) => i.wallclock >= e)), this.timeline();
6402
+ return yield a(this, ui).waitFor((t) => !!t.find((i) => i.wallclock >= e)), this.timeline();
6385
6403
  });
6386
6404
  }
6387
6405
  waitForTimelineToHaveMinDuration() {
6388
6406
  return f(this, null, function* () {
6389
- return yield a(this, di).waitFor((e) => {
6407
+ return yield a(this, ui).waitFor((e) => {
6390
6408
  const t = e[0], i = e[e.length - 1];
6391
6409
  return !t || !i ? !1 : i.wallclock - t.wallclock > jd;
6392
6410
  }), this.timeline();
6393
6411
  });
6394
6412
  }
6395
6413
  };
6396
- oc = new WeakMap(), di = new WeakMap(), ss = new WeakMap(), Pa = new WeakMap(), xa = new WeakMap(), La = new WeakMap(), vs = new WeakSet(), kh = function(e) {
6414
+ oc = new WeakMap(), ui = new WeakMap(), ss = new WeakMap(), Pa = new WeakMap(), xa = new WeakMap(), La = new WeakMap(), vs = new WeakSet(), kh = function(e) {
6397
6415
  return f(this, null, function* () {
6398
6416
  const t = yield e.promise;
6399
6417
  try {
6400
- for (var b = Y(t), S, x, R; S = !(x = yield b.next()).done; S = !1) {
6401
- var h = x.value;
6418
+ for (var b = Y(t), S, P, B; S = !(P = yield b.next()).done; S = !1) {
6419
+ var h = P.value;
6402
6420
  var d = [];
6403
6421
  try {
6404
- const M = Ne(d, h, !0);
6422
+ const D = Ne(d, h, !0);
6405
6423
  try {
6406
- for (var i = Y(M), n, o, c; n = !(o = yield i.next()).done; n = !1) {
6424
+ for (var i = Y(D), n, o, c; n = !(o = yield i.next()).done; n = !1) {
6407
6425
  const T = o.value;
6408
6426
  if (T.objectStatus !== Te.Normal)
6409
6427
  continue;
6410
6428
  const U = wA(T.payload);
6411
- a(this, di).update((k) => {
6429
+ a(this, ui).update((k) => {
6412
6430
  var _, ce;
6413
6431
  for (k.push(...U), k.sort((Me, Z) => Me.wallclock - Z.wallclock); k[0] && ((ce = (_ = k[k.length - 1]) == null ? void 0 : _.wallclock) != null ? ce : 0) - k[0].wallclock > AA; )
6414
6432
  k.shift();
6415
6433
  return k;
6416
- }), t === a(this, ss).resolved && T.groupId > B(0) && T.objectId == B(0) && A(this, vs, Ll).call(this, T.groupId).catch((k) => {
6434
+ }), t === a(this, ss).resolved && T.groupId > R(0) && T.objectId == R(0) && A(this, vs, Ll).call(this, T.groupId).catch((k) => {
6417
6435
  a(this, oc).warn("backfill failed", k);
6418
6436
  });
6419
6437
  }
@@ -6434,26 +6452,26 @@ oc = new WeakMap(), di = new WeakMap(), ss = new WeakMap(), Pa = new WeakMap(),
6434
6452
  w && (yield w);
6435
6453
  }
6436
6454
  }
6437
- } catch (x) {
6438
- R = [x];
6455
+ } catch (P) {
6456
+ B = [P];
6439
6457
  } finally {
6440
6458
  try {
6441
- S && (x = b.return) && (yield x.call(b));
6459
+ S && (P = b.return) && (yield P.call(b));
6442
6460
  } finally {
6443
- if (R)
6444
- throw R[0];
6461
+ if (B)
6462
+ throw B[0];
6445
6463
  }
6446
6464
  }
6447
6465
  });
6448
6466
  }, Ll = function(e) {
6449
6467
  return f(this, null, function* () {
6450
- const t = e - B(1), i = this.timeline(), n = i[0], o = i[i.length - 1];
6468
+ const t = e - R(1), i = this.timeline(), n = i[0], o = i[i.length - 1];
6451
6469
  if (!n || !o || o.wallclock - n.wallclock > jd)
6452
6470
  return;
6453
6471
  const c = H.fromPromise(
6454
- yi.subscribe(
6472
+ vi.subscribe(
6455
6473
  a(this, Pa),
6456
- new jt().name(a(this, xa)).groupOrder("ascending").range(t, t).build()
6474
+ new zt().name(a(this, xa)).groupOrder("ascending").range(t, t).build()
6457
6475
  )
6458
6476
  );
6459
6477
  return A(this, vs, kh).call(this, c);
@@ -6480,33 +6498,33 @@ function wA(s) {
6480
6498
  function bA(s) {
6481
6499
  return typeof s.language == "string";
6482
6500
  }
6483
- var cc, Da, ui, Bn;
6501
+ var cc, Da, li, Bn;
6484
6502
  const ud = class ud {
6485
6503
  constructor(e, t, i, n, o) {
6486
6504
  u(this, cc, new zu());
6487
6505
  u(this, Da);
6488
- u(this, ui);
6506
+ u(this, li);
6489
6507
  u(this, Bn, 0);
6490
6508
  r(this, "trackObject");
6491
6509
  r(this, "namespace");
6492
- l(this, ui, e), l(this, Da, t), this.trackObject = i, this.namespace = n, l(this, Bn, o);
6510
+ l(this, li, e), l(this, Da, t), this.trackObject = i, this.namespace = n, l(this, Bn, o);
6493
6511
  }
6494
6512
  static subscribe(e, t, i) {
6495
6513
  return f(this, null, function* () {
6496
6514
  if (!bA(t))
6497
6515
  throw new Error("track object language is required");
6498
- const n = new jt().name(t.name).build(), o = yield yi.subscribe(e, n), c = o.objects();
6516
+ const n = new zt().name(t.name).build(), o = yield vi.subscribe(e, n), c = o.objects();
6499
6517
  return new ud(o, c, t, e.namespace(), i);
6500
6518
  });
6501
6519
  }
6502
6520
  largestGroupId() {
6503
- return a(this, ui).largestGroupId();
6521
+ return a(this, li).largestGroupId();
6504
6522
  }
6505
6523
  update(e, t) {
6506
- return a(this, ui).update(e, t);
6524
+ return a(this, li).update(e, t);
6507
6525
  }
6508
6526
  unsubscribe() {
6509
- return a(this, ui).unsubscribe();
6527
+ return a(this, li).unsubscribe();
6510
6528
  }
6511
6529
  next() {
6512
6530
  return f(this, null, function* () {
@@ -6526,7 +6544,7 @@ const ud = class ud {
6526
6544
  }
6527
6545
  return() {
6528
6546
  return f(this, null, function* () {
6529
- return yield a(this, ui).return(), { done: !0, value: void 0 };
6547
+ return yield a(this, li).return(), { done: !0, value: void 0 };
6530
6548
  });
6531
6549
  }
6532
6550
  [Symbol.asyncIterator]() {
@@ -6539,9 +6557,9 @@ const ud = class ud {
6539
6557
  return this.unsubscribe();
6540
6558
  }
6541
6559
  };
6542
- cc = new WeakMap(), Da = new WeakMap(), ui = new WeakMap(), Bn = new WeakMap();
6560
+ cc = new WeakMap(), Da = new WeakMap(), li = new WeakMap(), Bn = new WeakMap();
6543
6561
  let Bh = ud;
6544
- var mu, ns, rs, as, li, rh, Rn, ao;
6562
+ var mu, ns, rs, as, mi, rh, Rn, ao;
6545
6563
  mu = [Pe({ context: "Channel", enter: "info" })];
6546
6564
  const _s = class _s {
6547
6565
  constructor(e, t, i, n, o) {
@@ -6550,8 +6568,8 @@ const _s = class _s {
6550
6568
  u(this, ns);
6551
6569
  u(this, rs);
6552
6570
  u(this, as);
6553
- u(this, li);
6554
- this.namespace = n, l(this, ns, e), l(this, rs, t), l(this, as, i), l(this, li, o);
6571
+ u(this, mi);
6572
+ this.namespace = n, l(this, ns, e), l(this, rs, t), l(this, as, i), l(this, mi, o);
6555
6573
  }
6556
6574
  static start(e, t) {
6557
6575
  return f(this, null, function* () {
@@ -6572,20 +6590,24 @@ const _s = class _s {
6572
6590
  return a(this, rs).timestampWallclockOffset();
6573
6591
  }
6574
6592
  timestampOffsetMs() {
6575
- return a(this, li);
6593
+ return a(this, mi);
6576
6594
  }
6577
6595
  setTimestampOffsetMs(e) {
6578
- l(this, li, e);
6596
+ l(this, mi, e);
6579
6597
  }
6580
6598
  waitForWallclockTime(e) {
6581
6599
  return a(this, rs).waitForWallclockTime(e);
6582
6600
  }
6583
6601
  subscribeCmafTrack(e, t) {
6584
- const i = this.catalog().current().tracks, n = e["com.vindral.variant_uid"] !== void 0 ? i.find((o) => o["com.vindral.variant_uid"] === e["com.vindral.variant_uid"]) : void 0;
6585
- return A(this, Rn, ao).call(this, () => Ih.subscribe(a(this, ns), n != null ? n : e, a(this, li), t));
6602
+ const i = t == null ? void 0 : t.startGroup, n = t == null ? void 0 : t.params, o = this.catalog().current().tracks, c = e["com.vindral.variant_uid"] !== void 0 ? o.find((h) => h["com.vindral.variant_uid"] === e["com.vindral.variant_uid"]) : void 0;
6603
+ return A(this, Rn, ao).call(this, () => Ih.subscribe(a(this, ns), c != null ? c : e, {
6604
+ timestampOffsetMs: a(this, mi),
6605
+ startGroup: i,
6606
+ params: n
6607
+ }));
6586
6608
  }
6587
6609
  subscribeWebVttTrack(e) {
6588
- return A(this, Rn, ao).call(this, () => Bh.subscribe(a(this, ns), e, a(this, li)));
6610
+ return A(this, Rn, ao).call(this, () => Bh.subscribe(a(this, ns), e, a(this, mi)));
6589
6611
  }
6590
6612
  subscribeTrack(e) {
6591
6613
  return A(this, Rn, ao).call(this, () => a(this, ns).subscribe(e));
@@ -6597,7 +6619,7 @@ const _s = class _s {
6597
6619
  return Promise.all([a(this, as).close(), a(this, rs).close()]);
6598
6620
  }
6599
6621
  };
6600
- rh = vi(null), ns = new WeakMap(), rs = new WeakMap(), as = new WeakMap(), li = new WeakMap(), Rn = new WeakSet(), ao = function(e) {
6622
+ rh = Si(null), ns = new WeakMap(), rs = new WeakMap(), as = new WeakMap(), mi = new WeakMap(), Rn = new WeakSet(), ao = function(e) {
6601
6623
  return f(this, null, function* () {
6602
6624
  const [t, i] = this.catalog().value();
6603
6625
  try {
@@ -6608,7 +6630,7 @@ rh = vi(null), ns = new WeakMap(), rs = new WeakMap(), as = new WeakMap(), li =
6608
6630
  throw n;
6609
6631
  }
6610
6632
  });
6611
- }, ye(rh, 9, "start", mu, _s), zt(rh, _s), Si(rh, 3, _s);
6633
+ }, ye(rh, 9, "start", mu, _s), Xt(rh, _s), Ei(rh, 3, _s);
6612
6634
  let Oo = _s;
6613
6635
  var os, Oa, hc, Dl;
6614
6636
  const ld = class ld {
@@ -6692,7 +6714,7 @@ class rd {
6692
6714
  return f(this, null, function* () {
6693
6715
  var d = [];
6694
6716
  try {
6695
- const n = Ne(d, yield e.subscribeTrack(new jt().name("drm").build()), !0);
6717
+ const n = Ne(d, yield e.subscribeTrack(new zt().name("drm").build()), !0);
6696
6718
  const o = n.objects();
6697
6719
  const c = yield o.next();
6698
6720
  if (c.done)
@@ -6744,7 +6766,7 @@ const md = class md {
6744
6766
  }
6745
6767
  static start(e) {
6746
6768
  return f(this, null, function* () {
6747
- const i = (yield e.subscribe(new jt().name("stats").groupOrder("ascending").build())).objects(), n = yield i.next();
6769
+ const i = (yield e.subscribe(new zt().name("stats").groupOrder("ascending").build())).objects(), n = yield i.next();
6748
6770
  if (n.done)
6749
6771
  throw new Error("No stats object received");
6750
6772
  const o = Wd(n.value.payload);
@@ -6808,6 +6830,13 @@ class IA {
6808
6830
  }
6809
6831
  }
6810
6832
  uc = new WeakMap(), Un = new WeakMap();
6833
+ const CA = R(8);
6834
+ function kA(s) {
6835
+ if (s < 0 || s > 65535)
6836
+ throw new RangeError("burstMs must be between 0 and 65535 inclusive");
6837
+ const e = new Uint8Array([s >> 8 & 255, s & 255]);
6838
+ return { type: CA, payload: e };
6839
+ }
6811
6840
  var Pn, Fa, _a;
6812
6841
  class Yc {
6813
6842
  constructor(e, t) {
@@ -6845,11 +6874,11 @@ class Yc {
6845
6874
  }
6846
6875
  }
6847
6876
  Pn = new WeakMap(), Fa = new WeakMap(), _a = new WeakMap();
6848
- var fu, pu, gu, xn, Ln, cs, le, nt, rt, mi, Dn, Na, Jn, Ce, oo, sr, Ml, xh;
6877
+ var fu, pu, gu, xn, Ln, cs, le, nt, rt, fi, Dn, Na, Jn, Ce, oo, sr, Ml, xh;
6849
6878
  gu = [Pe({ context: "Player", enter: "info" })], pu = [Pe({ context: "Player", enter: "info", return: "info" })], fu = [Pe({ context: "Player", enter: "info" })];
6850
6879
  const Ns = class Ns {
6851
6880
  constructor(e, t, i) {
6852
- Si(Jn, 5, this);
6881
+ Ei(Jn, 5, this);
6853
6882
  u(this, Ce);
6854
6883
  u(this, xn);
6855
6884
  u(this, Ln);
@@ -6857,28 +6886,33 @@ const Ns = class Ns {
6857
6886
  u(this, le);
6858
6887
  u(this, nt, new Ie(void 0));
6859
6888
  u(this, rt, new Ie(void 0));
6860
- u(this, mi, new Ie(void 0));
6889
+ u(this, fi, new Ie(void 0));
6861
6890
  u(this, Dn);
6862
6891
  u(this, Na);
6863
- r(this, "subtitles", new Yc(a(this, mi), "subtitles"));
6892
+ r(this, "subtitles", new Yc(a(this, fi), "subtitles"));
6864
6893
  r(this, "video", new Yc(a(this, rt), "video"));
6865
6894
  r(this, "audio", new Yc(a(this, nt), "audio"));
6866
- l(this, xn, e), l(this, Ln, Rh.start(i)), l(this, cs, i), l(this, le, new Ie(t)), l(this, Dn, new IA(t)), l(this, Na, Promise.race([i.idleTimeout(), A(this, Ce, Ml).call(this), a(this, Dn).closed()])), a(this, xn).closed().then(() => this.close()).catch(D);
6895
+ l(this, xn, e), l(this, Ln, Rh.start(i)), l(this, cs, i), l(this, le, new Ie(t)), l(this, Dn, new IA(t)), l(this, Na, Promise.race([i.idleTimeout(), A(this, Ce, Ml).call(this), a(this, Dn).closed()])), a(this, xn).closed().then(() => this.close()).catch(O);
6867
6896
  }
6868
6897
  closed() {
6869
6898
  return a(this, Na);
6870
6899
  }
6871
6900
  static start(e, t) {
6872
6901
  return f(this, null, function* () {
6873
- const i = new Ul(e, { namespace: lA("auxiliary") }), [[n, o, c], h] = yield Promise.all([
6874
- Oo.start(e, t).then((m) => Promise.all([
6875
- Promise.resolve(m),
6876
- t.videoTrack ? m.subscribeCmafTrack(t.videoTrack) : void 0,
6877
- t.audioTrack ? m.subscribeCmafTrack(t.audioTrack) : void 0
6902
+ const i = /* @__PURE__ */ new Map();
6903
+ if (t.burstMs !== void 0) {
6904
+ const p = kA(t.burstMs);
6905
+ i.set(p.type, p);
6906
+ }
6907
+ const n = new Ul(e, { namespace: lA("auxiliary") }), [[o, c, h], d] = yield Promise.all([
6908
+ Oo.start(e, t).then((p) => Promise.all([
6909
+ Promise.resolve(p),
6910
+ t.videoTrack ? p.subscribeCmafTrack(t.videoTrack, { params: i }) : void 0,
6911
+ t.audioTrack ? p.subscribeCmafTrack(t.audioTrack, { params: i }) : void 0
6878
6912
  ])),
6879
- Uh.start(i)
6880
- ]), d = new Ns(e, n, h);
6881
- return c && a(d, nt).update(c), o && a(d, rt).update(o), d;
6913
+ Uh.start(n)
6914
+ ]), m = new Ns(e, o, d);
6915
+ return h && a(m, nt).update(h), c && a(m, rt).update(c), m;
6882
6916
  });
6883
6917
  }
6884
6918
  connectionInfo() {
@@ -6925,18 +6959,18 @@ const Ns = class Ns {
6925
6959
  // Close the consumers so that the iterators will stop
6926
6960
  A(this, Ce, oo).call(this, a(this, nt)),
6927
6961
  A(this, Ce, oo).call(this, a(this, rt)),
6928
- A(this, Ce, oo).call(this, a(this, mi))
6962
+ A(this, Ce, oo).call(this, a(this, fi))
6929
6963
  ]);
6930
6964
  }
6931
6965
  zap(e, t) {
6932
6966
  return f(this, null, function* () {
6933
- var S, x;
6967
+ var S, P;
6934
6968
  const i = yield Oo.start(a(this, xn), e), n = a(this, Ln).wallclock() - t, o = a(this, le).current(), c = o.timestampWallclockOffset(), h = yield i.waitForWallclockTime(n);
6935
6969
  a(this, Dn).update(i), yield a(this, le).current().close();
6936
- const d = h.toReversed().find((R) => R.wallclock <= n), m = d != null && d.mediaPts ? d.mediaPts - o.timestampOffsetMs() : void 0, w = i.timestampWallclockOffset() - c + o.timestampOffsetMs();
6970
+ const d = h.toReversed().find((B) => B.wallclock <= n), m = d != null && d.mediaPts ? d.mediaPts - o.timestampOffsetMs() : void 0, w = i.timestampWallclockOffset() - c + o.timestampOffsetMs();
6937
6971
  i.setTimestampOffsetMs(w);
6938
- const b = d != null && d.groupId ? B(d.groupId) : void 0;
6939
- m && ((S = a(this, rt).current()) == null || S.stopAfterTimestampReached(m), (x = a(this, nt).current()) == null || x.stopAfterTimestampReached(m)), a(this, le).update(i), yield Promise.all([
6972
+ const b = d != null && d.groupId ? R(d.groupId) : void 0;
6973
+ m && ((S = a(this, rt).current()) == null || S.stopAfterTimestampReached(m), (P = a(this, nt).current()) == null || P.stopAfterTimestampReached(m)), a(this, le).update(i), yield Promise.all([
6940
6974
  e.videoTrack ? this.setVideoTrack(e.videoTrack, b) : void 0,
6941
6975
  e.audioTrack ? this.setAudioTrack(e.audioTrack, b) : void 0
6942
6976
  ]);
@@ -6946,14 +6980,14 @@ const Ns = class Ns {
6946
6980
  return f(this, null, function* () {
6947
6981
  var i, n;
6948
6982
  if (!e) {
6949
- yield (i = a(this, mi).current()) == null ? void 0 : i.unsubscribe();
6983
+ yield (i = a(this, fi).current()) == null ? void 0 : i.unsubscribe();
6950
6984
  return;
6951
6985
  }
6952
6986
  const [t] = yield Promise.all([
6953
6987
  a(this, le).current().subscribeWebVttTrack(e),
6954
- (n = a(this, mi).current()) == null ? void 0 : n.unsubscribe()
6988
+ (n = a(this, fi).current()) == null ? void 0 : n.unsubscribe()
6955
6989
  ]);
6956
- a(this, mi).update(t);
6990
+ a(this, fi).update(t);
6957
6991
  });
6958
6992
  }
6959
6993
  setVideoTrack(e, t) {
@@ -6969,16 +7003,15 @@ const Ns = class Ns {
6969
7003
  });
6970
7004
  }
6971
7005
  };
6972
- Jn = vi(null), xn = new WeakMap(), Ln = new WeakMap(), cs = new WeakMap(), le = new WeakMap(), nt = new WeakMap(), rt = new WeakMap(), mi = new WeakMap(), Dn = new WeakMap(), Na = new WeakMap(), Ce = new WeakSet(), oo = function(e) {
7006
+ Jn = Si(null), xn = new WeakMap(), Ln = new WeakMap(), cs = new WeakMap(), le = new WeakMap(), nt = new WeakMap(), rt = new WeakMap(), fi = new WeakMap(), Dn = new WeakMap(), Na = new WeakMap(), Ce = new WeakSet(), oo = function(e) {
6973
7007
  const t = e.current(), i = t == null ? void 0 : t.largestGroupId();
6974
7008
  return e.isClosed() || e.update(void 0), e.close(), i ? t == null ? void 0 : t.update(i, i) : t == null ? void 0 : t.unsubscribe();
6975
7009
  }, sr = function(e, t, i, n) {
6976
7010
  return f(this, null, function* () {
6977
7011
  const o = i == null ? void 0 : i.largestGroupId(), [c, h] = yield Promise.all([
6978
- e.subscribeCmafTrack(
6979
- t,
6980
- n || (o ? o + B(1) : void 0)
6981
- ),
7012
+ e.subscribeCmafTrack(t, {
7013
+ startGroup: n || (o ? o + R(1) : void 0)
7014
+ }),
6982
7015
  o ? i == null ? void 0 : i.update(o, o) : i == null ? void 0 : i.unsubscribe()
6983
7016
  ]);
6984
7017
  return c;
@@ -7032,14 +7065,14 @@ Jn = vi(null), xn = new WeakMap(), Ln = new WeakMap(), cs = new WeakMap(), le =
7032
7065
  t.update(yield a(this, le).current().subscribeCmafTrack(h));
7033
7066
  }
7034
7067
  });
7035
- }, ye(Jn, 1, "close", gu, Ns), ye(Jn, 1, "zap", pu, Ns), sr = ye(Jn, 17, "#replaceTrack", fu, Ce, sr), zt(Jn, Ns);
7068
+ }, ye(Jn, 1, "close", gu, Ns), ye(Jn, 1, "zap", pu, Ns), sr = ye(Jn, 17, "#replaceTrack", fu, Ce, sr), Xt(Jn, Ns);
7036
7069
  let Ph = Ns;
7037
7070
  function Jc(s, e, t) {
7038
7071
  const i = new URL("/voq/subscribe", s);
7039
7072
  return i.searchParams.set("sessionId", e.sessionId), i.searchParams.set("clientId", e.clientId), i.searchParams.set("channelId", e.channelId), t && i.searchParams.set("authToken", t), i;
7040
7073
  }
7041
- const CA = 1e4;
7042
- var me, Se, at, hs, $, fi, Va, Ga, lc, On, ke, Fl, Mn, ja, Fn, _l, Nl, Vl, Gl, Dh;
7074
+ const BA = 1e4;
7075
+ var me, Se, at, hs, $, pi, Va, Ga, lc, On, ke, Fl, Mn, ja, Fn, _l, Nl, Vl, Gl, Dh;
7043
7076
  const fd = class fd {
7044
7077
  constructor(e, t, i, n, o, c) {
7045
7078
  u(this, ke);
@@ -7048,18 +7081,18 @@ const fd = class fd {
7048
7081
  u(this, at);
7049
7082
  u(this, hs, "disconnected");
7050
7083
  u(this, $);
7051
- u(this, fi, /* @__PURE__ */ new Map());
7084
+ u(this, pi, /* @__PURE__ */ new Map());
7052
7085
  u(this, Va);
7053
7086
  u(this, Ga, new pe(10));
7054
7087
  u(this, lc, Number.MAX_SAFE_INTEGER);
7055
7088
  u(this, On, /* @__PURE__ */ new Map());
7056
7089
  u(this, Mn, (e) => {
7057
7090
  if (!e) {
7058
- a(this, $).setSubtitleTrack(void 0).catch(D);
7091
+ a(this, $).setSubtitleTrack(void 0).catch(O);
7059
7092
  return;
7060
7093
  }
7061
- const t = a(this, fi).get(Ei(a(this, $).namespace())), i = t == null ? void 0 : t.getTextTrack(e);
7062
- i && a(this, $).setSubtitleTrack(i).catch(D);
7094
+ const t = a(this, pi).get(Ti(a(this, $).namespace())), i = t == null ? void 0 : t.getTextTrack(e);
7095
+ i && a(this, $).setSubtitleTrack(i).catch(O);
7063
7096
  });
7064
7097
  u(this, ja, (e) => {
7065
7098
  switch (e.type) {
@@ -7082,7 +7115,7 @@ const fd = class fd {
7082
7115
  Au(new URL("/api/telemetry", a(this, at).url().replace("wss://", "https://")), {
7083
7116
  body: e.body,
7084
7117
  headers: { "Content-Type": "text/plain" }
7085
- }).catch(D);
7118
+ }).catch(O);
7086
7119
  break;
7087
7120
  case "refresh auth":
7088
7121
  a(this, at).updateAuthToken(e.token);
@@ -7091,9 +7124,9 @@ const fd = class fd {
7091
7124
  });
7092
7125
  u(this, Fn, !1);
7093
7126
  r(this, "disconnect", (e = "Disconnect Requested") => {
7094
- a(this, Se).info("Disconnecting", e), a(this, at).close(), a(this, $).close().catch(D), l(this, On, /* @__PURE__ */ new Map()), l(this, hs, "disconnected");
7127
+ a(this, Se).info("Disconnecting", e), a(this, at).close(), a(this, $).close().catch(O), l(this, On, /* @__PURE__ */ new Map()), l(this, hs, "disconnected");
7095
7128
  });
7096
- l(this, me, e), l(this, Se, t), l(this, at, i), l(this, $, n), l(this, fi, o), l(this, Va, c), a(this, me).on("send signal", a(this, ja)), a(this, me).on("disconnect", this.disconnect), a(this, me).on("text track", a(this, Mn)), A(this, ke, Fl).call(this).catch(D), A(this, ke, Vl).call(this).catch(D);
7129
+ l(this, me, e), l(this, Se, t), l(this, at, i), l(this, $, n), l(this, pi, o), l(this, Va, c), a(this, me).on("send signal", a(this, ja)), a(this, me).on("disconnect", this.disconnect), a(this, me).on("text track", a(this, Mn)), A(this, ke, Fl).call(this).catch(O), A(this, ke, Vl).call(this).catch(O);
7097
7130
  }
7098
7131
  get estimatedBandwidth() {
7099
7132
  return a(this, lc);
@@ -7108,7 +7141,7 @@ const fd = class fd {
7108
7141
  getStatistics() {
7109
7142
  const t = a(this, $).connectionInfo().estimatedBandwidth;
7110
7143
  return {
7111
- rtt: qt(a(this, Ga).items()),
7144
+ rtt: Yt(a(this, Ga).items()),
7112
7145
  estimatedBandwidth: t,
7113
7146
  connectCount: 0,
7114
7147
  connectionAttemptCount: 0,
@@ -7118,10 +7151,10 @@ const fd = class fd {
7118
7151
  }
7119
7152
  static start(e, t, i, n) {
7120
7153
  return f(this, null, function* () {
7121
- var M, T, U, k;
7154
+ var D, T, U, k;
7122
7155
  const o = new Map(
7123
7156
  n.connectInfo.channels.map((_) => [
7124
- Ei(_.catalog.namespace),
7157
+ Ti(_.catalog.namespace),
7125
7158
  new Kc(new Ie(_.catalog))
7126
7159
  ])
7127
7160
  ), c = yield n.onConnectInfo(n.connectInfo), h = n.options.get("authenticationToken");
@@ -7135,9 +7168,9 @@ const fd = class fd {
7135
7168
  d = Jc(n.edgeUrl.moqUrl || n.edgeUrl.moqWsUrl, c, h), m = Jc(n.edgeUrl.moqWsUrl, c, h);
7136
7169
  break;
7137
7170
  }
7138
- const p = (M = n.connectInfo.channels.find((_) => _.channelId === c.channelId)) == null ? void 0 : M.catalog;
7171
+ const p = (D = n.connectInfo.channels.find((_) => _.channelId === c.channelId)) == null ? void 0 : D.catalog;
7139
7172
  t.debug("Resolved edge url", { edgeUrl: d, edgeWsUrl: m }), Xe(p, "no catalog found");
7140
- const g = (T = o.get(Ei(p.namespace))) == null ? void 0 : T.getVideoTrack(c.video), w = (U = o.get(Ei(p.namespace))) == null ? void 0 : U.getAudioTrack(c.audio), b = yield uA({
7173
+ const g = (T = o.get(Ti(p.namespace))) == null ? void 0 : T.getVideoTrack(c.video), w = (U = o.get(Ti(p.namespace))) == null ? void 0 : U.getAudioTrack(c.audio), b = yield uA({
7141
7174
  url: d,
7142
7175
  wsUrl: m,
7143
7176
  authToken: n.options.get("authenticationToken"),
@@ -7149,12 +7182,13 @@ const fd = class fd {
7149
7182
  namespace: p.namespace,
7150
7183
  catalog: p,
7151
7184
  videoTrack: g == null ? void 0 : g.track,
7152
- audioTrack: w == null ? void 0 : w.track
7185
+ audioTrack: w == null ? void 0 : w.track,
7186
+ burstMs: c.burstMs || 0
7153
7187
  }),
7154
- id(CA, new Error("Timeout waiting for player to start")),
7188
+ id(BA, new Error("Timeout waiting for player to start")),
7155
7189
  Rm(b.closed(), "Session closed before player started")
7156
- ]), x = new Kc(S.catalog());
7157
- o.set(Ei(p.namespace), x), e.emit("received signal", {
7190
+ ]), P = new Kc(S.catalog());
7191
+ o.set(Ti(p.namespace), P), e.emit("received signal", {
7158
7192
  type: "client ip",
7159
7193
  ip: S.connectionInfo().ip
7160
7194
  }), S.drm().then((_) => {
@@ -7162,8 +7196,8 @@ const fd = class fd {
7162
7196
  }).catch((_) => {
7163
7197
  t.error("Error getting DRM data", _);
7164
7198
  });
7165
- const R = new fd(e, t, b, S, o, i);
7166
- return c.textTrack && a(k = R, Mn).call(k, c.textTrack), R;
7199
+ const B = new fd(e, t, b, S, o, i);
7200
+ return c.textTrack && a(k = B, Mn).call(k, c.textTrack), B;
7167
7201
  });
7168
7202
  }
7169
7203
  getState() {
@@ -7179,7 +7213,7 @@ const fd = class fd {
7179
7213
  return Promise.race([a(this, at).closed(), a(this, $).closed()]);
7180
7214
  }
7181
7215
  };
7182
- me = new WeakMap(), Se = new WeakMap(), at = new WeakMap(), hs = new WeakMap(), $ = new WeakMap(), fi = new WeakMap(), Va = new WeakMap(), Ga = new WeakMap(), lc = new WeakMap(), On = new WeakMap(), ke = new WeakSet(), Fl = function() {
7216
+ me = new WeakMap(), Se = new WeakMap(), at = new WeakMap(), hs = new WeakMap(), $ = new WeakMap(), pi = new WeakMap(), Va = new WeakMap(), Ga = new WeakMap(), lc = new WeakMap(), On = new WeakMap(), ke = new WeakSet(), Fl = function() {
7183
7217
  return f(this, null, function* () {
7184
7218
  try {
7185
7219
  for (var e = Y(a(this, $).stats()), t, i, n; t = !(i = yield e.next()).done; t = !1) {
@@ -7213,8 +7247,8 @@ me = new WeakMap(), Se = new WeakMap(), at = new WeakMap(), hs = new WeakMap(),
7213
7247
  var c, h, d;
7214
7248
  a(this, Se).info("handle subscription", e);
7215
7249
  const t = a(this, $);
7216
- let i = a(this, fi).get(e.channelId);
7217
- if (i || (i = new Kc(new Ie(yield A(this, ke, _l).call(this, e.channelId))), a(this, fi).set(e.channelId, i)), t.namespace().join("/") !== i.namespace().join("/")) {
7250
+ let i = a(this, pi).get(e.channelId);
7251
+ if (i || (i = new Kc(new Ie(yield A(this, ke, _l).call(this, e.channelId))), a(this, pi).set(e.channelId, i)), t.namespace().join("/") !== i.namespace().join("/")) {
7218
7252
  a(this, Se).info("changing channel", e.channelId);
7219
7253
  const m = i.getVideoTrack(e.video), p = i.getAudioTrack(e.audio);
7220
7254
  yield t.zap(
@@ -7229,7 +7263,7 @@ me = new WeakMap(), Se = new WeakMap(), at = new WeakMap(), hs = new WeakMap(),
7229
7263
  g && a(this, me).emit("received drm data", g.value);
7230
7264
  }).catch((g) => {
7231
7265
  a(this, Se).error("Error getting DRM data", g);
7232
- }), a(this, Se).info("switched channel", e.channelId), (c = a(this, fi).get(Ei(t.namespace()))) == null || c.updateCatalog(t.catalog()), a(this, me).emit("received signal", {
7266
+ }), a(this, Se).info("switched channel", e.channelId), (c = a(this, pi).get(Ti(t.namespace()))) == null || c.updateCatalog(t.catalog()), a(this, me).emit("received signal", {
7233
7267
  type: "subscription changed",
7234
7268
  subscription: e
7235
7269
  });
@@ -7280,21 +7314,21 @@ me = new WeakMap(), Se = new WeakMap(), at = new WeakMap(), hs = new WeakMap(),
7280
7314
  let i = "", n = "", o;
7281
7315
  const c = a(this, $).videoTrack() === void 0;
7282
7316
  try {
7283
- for (var w = Y(t), b, S, x; b = !(S = yield w.next()).done; b = !1) {
7284
- const R = S.value;
7285
- const M = Ei(R.track.namespace), T = R.track.trackObject.language, U = om((h = R.track.trackObject.codec) != null ? h : ""), k = R.track.trackObject.codec, _ = U ? Ui({ codec: U, codecString: k }) : void 0, ce = !!R.track.trackObject["com.vindral.drm"];
7317
+ for (var w = Y(t), b, S, P; b = !(S = yield w.next()).done; b = !1) {
7318
+ const B = S.value;
7319
+ const D = Ti(B.track.namespace), T = B.track.trackObject.language, U = om((h = B.track.trackObject.codec) != null ? h : ""), k = B.track.trackObject.codec, _ = U ? Pi({ codec: U, codecString: k }) : void 0, ce = !!B.track.trackObject["com.vindral.drm"];
7286
7320
  try {
7287
- for (var d = Y(R), m, p, g; m = !(p = yield d.next()).done; m = !1) {
7321
+ for (var d = Y(B), m, p, g; m = !(p = yield d.next()).done; m = !1) {
7288
7322
  const [Me, Z] = p.value;
7289
7323
  const Ct = {
7290
- channelId: i !== "" && (c || Z.mediaType() === "video") && i !== M ? M : void 0,
7324
+ channelId: i !== "" && (c || Z.mediaType() === "video") && i !== D ? D : void 0,
7291
7325
  language: Z.mediaType() === "audio" && n !== T ? T : void 0,
7292
7326
  drmTransition: o !== void 0 && o !== ce
7293
7327
  };
7294
- i = M, n = T, o = ce;
7295
- const y = Z.producerReferenceTime(), E = a(this, On).get(R.track.namespace) || 0;
7328
+ i = D, n = T, o = ce;
7329
+ const y = Z.producerReferenceTime(), E = a(this, On).get(B.track.namespace) || 0;
7296
7330
  if (y && Date.now() - E > 1e3) {
7297
- a(this, On).set(R.track.namespace, Date.now());
7331
+ a(this, On).set(B.track.namespace, Date.now());
7298
7332
  const L = e.wallclock() - y.getTime();
7299
7333
  a(this, Se).debug("timing-info", {
7300
7334
  mediaType: Z.mediaType(),
@@ -7306,7 +7340,7 @@ me = new WeakMap(), Se = new WeakMap(), at = new WeakMap(), hs = new WeakMap(),
7306
7340
  }), a(this, me).emit("received signal", {
7307
7341
  type: "timing info",
7308
7342
  timingInfo: {
7309
- channelId: M,
7343
+ channelId: D,
7310
7344
  timestamp: Z.baseMediaDecodeTime() / Z.timescale() * 1e3 + L,
7311
7345
  wallclockTime: y.getTime()
7312
7346
  }
@@ -7314,13 +7348,13 @@ me = new WeakMap(), Se = new WeakMap(), at = new WeakMap(), hs = new WeakMap(),
7314
7348
  }
7315
7349
  a(this, me).emit("received moq data", {
7316
7350
  payload: Z,
7317
- channelId: M,
7351
+ channelId: D,
7318
7352
  groupId: Me,
7319
7353
  mimeType: _,
7320
7354
  codec: U,
7321
7355
  switchInfo: Ct,
7322
7356
  // FIXME: We should replace this with something better than hashing the track name
7323
- renditionId: kA(R.track.trackObject.name)
7357
+ renditionId: RA(B.track.trackObject.name)
7324
7358
  });
7325
7359
  }
7326
7360
  } catch (p) {
@@ -7335,43 +7369,43 @@ me = new WeakMap(), Se = new WeakMap(), at = new WeakMap(), hs = new WeakMap(),
7335
7369
  }
7336
7370
  }
7337
7371
  } catch (S) {
7338
- x = [S];
7372
+ P = [S];
7339
7373
  } finally {
7340
7374
  try {
7341
7375
  b && (S = w.return) && (yield S.call(w));
7342
7376
  } finally {
7343
- if (x)
7344
- throw x[0];
7377
+ if (P)
7378
+ throw P[0];
7345
7379
  }
7346
7380
  }
7347
7381
  });
7348
7382
  };
7349
7383
  let Lh = fd;
7350
- function kA(s) {
7384
+ function RA(s) {
7351
7385
  return s.split("").reduce(
7352
7386
  (t, i) => t = i.charCodeAt(0) + (t << 6) + (t << 16) - t,
7353
7387
  0
7354
7388
  );
7355
7389
  }
7356
- var Vt, ds, mc, jl;
7390
+ var jt, ds, mc, jl;
7357
7391
  class Kc {
7358
7392
  constructor(e) {
7359
7393
  u(this, mc);
7360
- u(this, Vt);
7394
+ u(this, jt);
7361
7395
  u(this, ds);
7362
- l(this, Vt, e), l(this, ds, A(this, mc, jl).call(this));
7396
+ l(this, jt, e), l(this, ds, A(this, mc, jl).call(this));
7363
7397
  }
7364
7398
  catalog() {
7365
- return a(this, Vt).current();
7399
+ return a(this, jt).current();
7366
7400
  }
7367
7401
  namespace() {
7368
- return a(this, Vt).current().namespace;
7402
+ return a(this, jt).current().namespace;
7369
7403
  }
7370
7404
  updateCatalog(e) {
7371
- l(this, Vt, e);
7405
+ l(this, jt, e);
7372
7406
  }
7373
7407
  getTextTrack(e) {
7374
- return a(this, Vt).current().tracks.find((t) => t.label === e);
7408
+ return a(this, jt).current().tracks.find((t) => t.label === e);
7375
7409
  }
7376
7410
  getAudioTrack(e) {
7377
7411
  if (!e.codec)
@@ -7389,15 +7423,15 @@ class Kc {
7389
7423
  return a(this, ds);
7390
7424
  }
7391
7425
  }
7392
- Vt = new WeakMap(), ds = new WeakMap(), mc = new WeakSet(), jl = function() {
7393
- const [e, t] = a(this, Vt).value();
7426
+ jt = new WeakMap(), ds = new WeakMap(), mc = new WeakSet(), jl = function() {
7427
+ const [e, t] = a(this, jt).value();
7394
7428
  return cm(e);
7395
7429
  };
7396
- const BA = (s, e) => {
7430
+ const UA = (s, e) => {
7397
7431
  const t = new URL("/subscribe", s);
7398
7432
  return t.searchParams.append("channelId", e.channelId), t.searchParams.append("sessionId", e.sessionId), t.searchParams.append("clientId", e.clientId), e.audio && e.audio.codec && (t.searchParams.append("audio.bitRate", Math.round(e.audio.bitRate).toString()), t.searchParams.append("audio.codec", e.audio.codec), e.audio.language && t.searchParams.append("audio.language", e.audio.language)), e.video && e.video.codec && (t.searchParams.append("video.width", e.video.width.toString()), t.searchParams.append("video.height", e.video.height.toString()), t.searchParams.append("video.bitRate", Math.round(e.video.bitRate).toString()), t.searchParams.append("video.codec", e.video.codec)), e.expectAdditionalConnection && t.searchParams.append("expectAdditionalConnection", e.expectAdditionalConnection.toString()), e.burstMs && t.searchParams.append("burstMs", e.burstMs.toString()), e.channelGroupId && t.searchParams.append("channelGroupId", e.channelGroupId), e.authToken && (t.searchParams.append("auth.token", e.authToken), t.searchParams.append("auth.type", "jwt")), t.toString();
7399
7433
  };
7400
- class RA extends bi {
7434
+ class PA extends yi {
7401
7435
  constructor(t, i) {
7402
7436
  super();
7403
7437
  r(this, "options");
@@ -7437,7 +7471,7 @@ class RA extends bi {
7437
7471
  var n;
7438
7472
  let i = !1;
7439
7473
  return (n = this.websockets) == null || n.forEach((o) => {
7440
- o.onmessage = D, o.removeEventListener("error", this.onError), o.removeEventListener("close", this.onClose), o.removeEventListener("open", this.onOpen), o.close(1e3, t), i = !0;
7474
+ o.onmessage = O, o.removeEventListener("error", this.onError), o.removeEventListener("close", this.onClose), o.removeEventListener("open", this.onOpen), o.close(1e3, t), i = !0;
7441
7475
  }), this.websockets = [], this.shouldContinueConnecting = !1, this._isConnectInProgress = !1, this.logger.info("Closed websocket", { reason: t }), i;
7442
7476
  });
7443
7477
  r(this, "suspend", () => {
@@ -7450,7 +7484,7 @@ class RA extends bi {
7450
7484
  this.websockets.length !== 0 && this.options.onMessage(t, i.data);
7451
7485
  });
7452
7486
  r(this, "onError", () => {
7453
- this.logger.info("On error", v({}, this.options)), this.close("one websocket had an error"), this.emit("error", new P("WebSocket error", { code: "websocket_error", isFatal: !1 }));
7487
+ this.logger.info("On error", v({}, this.options)), this.close("one websocket had an error"), this.emit("error", new x("WebSocket error", { code: "websocket_error", isFatal: !1 }));
7454
7488
  });
7455
7489
  r(this, "onClose", (t) => {
7456
7490
  switch (this.logger.info("Closed", F(v({}, this.options), {
@@ -7508,9 +7542,9 @@ class RA extends bi {
7508
7542
  }
7509
7543
  return !0;
7510
7544
  } catch (i) {
7511
- return this._isConnectInProgress = !1, i instanceof P && (this.logger.error("Failed to connect", i.toStringifiable()), i.isFatal()) || this.shouldContinueConnecting && (this.logger.info("Connection aborted", { error: i }), this.emit(
7545
+ return this._isConnectInProgress = !1, i instanceof x && (this.logger.error("Failed to connect", i.toStringifiable()), i.isFatal()) || this.shouldContinueConnecting && (this.logger.info("Connection aborted", { error: i }), this.emit(
7512
7546
  "error",
7513
- new P("Failed to connect", {
7547
+ new x("Failed to connect", {
7514
7548
  code: "failed_to_connect",
7515
7549
  isFatal: !1,
7516
7550
  source: i,
@@ -7534,7 +7568,7 @@ class RA extends bi {
7534
7568
  return this._connectTime;
7535
7569
  }
7536
7570
  }
7537
- const UA = 65536 * 8, PA = 0.9, eh = (s) => UA * PA * 1e3 / s, dt = class dt {
7571
+ const xA = 65536 * 8, LA = 0.9, eh = (s) => xA * LA * 1e3 / s, dt = class dt {
7538
7572
  constructor(e, t, i) {
7539
7573
  r(this, "emitter");
7540
7574
  r(this, "transport");
@@ -7578,7 +7612,7 @@ const UA = 65536 * 8, PA = 0.9, eh = (s) => UA * PA * 1e3 / s, dt = class dt {
7578
7612
  });
7579
7613
  r(this, "getStatistics", () => {
7580
7614
  var t;
7581
- const e = qt(this.rtts.items());
7615
+ const e = Yt(this.rtts.items());
7582
7616
  return {
7583
7617
  rtt: e,
7584
7618
  estimatedBandwidth: eh(e.average),
@@ -7613,7 +7647,7 @@ const UA = 65536 * 8, PA = 0.9, eh = (s) => UA * PA * 1e3 / s, dt = class dt {
7613
7647
  ), n = this.config.options.get("media") === "audio+video";
7614
7648
  let o = 1;
7615
7649
  n && (o = i !== !1 ? 2 : 1);
7616
- const c = BA(this.config.edgeUrl, {
7650
+ const c = UA(this.config.edgeUrl, {
7617
7651
  video: t.video,
7618
7652
  audio: t.audio,
7619
7653
  burstMs: t.burstMs,
@@ -7647,7 +7681,7 @@ const UA = 65536 * 8, PA = 0.9, eh = (s) => UA * PA * 1e3 / s, dt = class dt {
7647
7681
  }
7648
7682
  });
7649
7683
  r(this, "connectWebSocketTransport", () => {
7650
- const e = new RA(
7684
+ const e = new PA(
7651
7685
  {
7652
7686
  reconnectDelay: 1e3,
7653
7687
  onMessage: this.onMessage,
@@ -7696,7 +7730,7 @@ const UA = 65536 * 8, PA = 0.9, eh = (s) => UA * PA * 1e3 / s, dt = class dt {
7696
7730
  type: "ping"
7697
7731
  });
7698
7732
  });
7699
- this._estimatedPingBandwidth = eh(i.estimatedRtt), this.logger = t, this.emitter = e, this.config = i, this.emitter.on("send signal", this.sendSignal), this.emitter.on("disconnect", this.close), this.emitter.on("reconnect", this.reconnect), this.disconnected.promise.catch(D), this.transport = this.connectWebSocketTransport();
7733
+ this._estimatedPingBandwidth = eh(i.estimatedRtt), this.logger = t, this.emitter = e, this.config = i, this.emitter.on("send signal", this.sendSignal), this.emitter.on("disconnect", this.close), this.emitter.on("reconnect", this.reconnect), this.disconnected.promise.catch(O), this.transport = this.connectWebSocketTransport();
7700
7734
  }
7701
7735
  get rtt() {
7702
7736
  return this.rtts.items().length > 0 ? Xn(this.rtts.items()) : 0;
@@ -7713,11 +7747,11 @@ r(dt, "PING_INTERVAL", 5e3), r(dt, "MAX_MISSED_PINGS", 4), r(dt, "TLS_ROUNDTRIPS
7713
7747
  c.transport.once("error", (h) => o(h)), c.transport.once("open", () => n(c));
7714
7748
  }));
7715
7749
  let Oh = dt;
7716
- var _n, pi, Nn;
7717
- class xA {
7750
+ var _n, gi, Nn;
7751
+ class DA {
7718
7752
  constructor(e) {
7719
7753
  u(this, _n);
7720
- u(this, pi, []);
7754
+ u(this, gi, []);
7721
7755
  u(this, Nn);
7722
7756
  l(this, _n, e);
7723
7757
  }
@@ -7734,8 +7768,8 @@ class xA {
7734
7768
  select(e) {
7735
7769
  if (a(this, _n).edgeUrl)
7736
7770
  return a(this, _n).edgeUrl;
7737
- a(this, pi).length === 0 && l(this, pi, a(this, pi).concat(e));
7738
- const t = a(this, pi).shift();
7771
+ a(this, gi).length === 0 && l(this, gi, a(this, gi).concat(e));
7772
+ const t = a(this, gi).shift();
7739
7773
  if (l(this, Nn, t), t)
7740
7774
  return t;
7741
7775
  }
@@ -7750,11 +7784,11 @@ class xA {
7750
7784
  * Resets the cached list of edges
7751
7785
  */
7752
7786
  reset() {
7753
- l(this, Nn, void 0), l(this, pi, []);
7787
+ l(this, Nn, void 0), l(this, gi, []);
7754
7788
  }
7755
7789
  }
7756
- _n = new WeakMap(), pi = new WeakMap(), Nn = new WeakMap();
7757
- var vt, Vn, Gt, Gn, jn, Wn, fc, pc, gc, Wl;
7790
+ _n = new WeakMap(), gi = new WeakMap(), Nn = new WeakMap();
7791
+ var vt, Vn, Wt, Gn, jn, Wn, fc, pc, gc, Wl;
7758
7792
  const Vs = class Vs {
7759
7793
  constructor(e, t, i) {
7760
7794
  u(this, gc);
@@ -7765,7 +7799,7 @@ const Vs = class Vs {
7765
7799
  r(this, "connectionImpl");
7766
7800
  u(this, vt, !0);
7767
7801
  u(this, Vn);
7768
- u(this, Gt, 0);
7802
+ u(this, Wt, 0);
7769
7803
  u(this, Gn, 0);
7770
7804
  u(this, jn);
7771
7805
  u(this, Wn);
@@ -7784,12 +7818,12 @@ const Vs = class Vs {
7784
7818
  r(this, "getState", () => this.connectionImpl ? this.connectionImpl.getState() : "disconnected");
7785
7819
  r(this, "getStatistics", () => this.connectionImpl ? F(v({}, this.connectionImpl.getStatistics()), {
7786
7820
  connectCount: a(this, Gn),
7787
- connectionAttemptCount: a(this, Gt)
7821
+ connectionAttemptCount: a(this, Wt)
7788
7822
  }) : {
7789
7823
  rtt: { min: 0, max: 0, average: 0, last: 0 },
7790
7824
  estimatedBandwidth: 0,
7791
7825
  connectCount: a(this, Gn),
7792
- connectionAttemptCount: a(this, Gt),
7826
+ connectionAttemptCount: a(this, Wt),
7793
7827
  connectionProtocol: void 0
7794
7828
  });
7795
7829
  r(this, "connect", () => {
@@ -7851,19 +7885,19 @@ const Vs = class Vs {
7851
7885
  return a(this, Wn);
7852
7886
  }
7853
7887
  };
7854
- vt = new WeakMap(), Vn = new WeakMap(), Gt = new WeakMap(), Gn = new WeakMap(), jn = new WeakMap(), Wn = new WeakMap(), fc = new WeakMap(), pc = new WeakMap(), gc = new WeakSet(), Wl = function() {
7888
+ vt = new WeakMap(), Vn = new WeakMap(), Wt = new WeakMap(), Gn = new WeakMap(), jn = new WeakMap(), Wn = new WeakMap(), fc = new WeakMap(), pc = new WeakMap(), gc = new WeakSet(), Wl = function() {
7855
7889
  return f(this, null, function* () {
7856
7890
  var t;
7857
- const e = new xA({ edgeUrl: this.config.options.get("edgeUrl") });
7858
- for (l(this, Gt, 0); ; ) {
7859
- Ze(this, Gt)._++;
7891
+ const e = new DA({ edgeUrl: this.config.options.get("edgeUrl") });
7892
+ for (l(this, Wt, 0); ; ) {
7893
+ Ze(this, Wt)._++;
7860
7894
  try {
7861
7895
  const [n, o] = yield Promise.all([a(this, fc).call(this), a(this, pc).call(this)]), c = o / 2;
7862
7896
  if (!a(this, vt))
7863
7897
  break;
7864
7898
  const h = e.select(n.edges);
7865
7899
  if (!h)
7866
- throw new P("Failed to resolve edge url", { isFatal: !0, code: "failed_to_resolve_edge_url" });
7900
+ throw new x("Failed to resolve edge url", { isFatal: !0, code: "failed_to_resolve_edge_url" });
7867
7901
  wu(n) ? this.connectionImpl = yield Lh.start(this.emitter, this.logger, this.apiClient, F(v({}, this.config), {
7868
7902
  connectInfo: n,
7869
7903
  estimatedRtt: c,
@@ -7872,19 +7906,19 @@ vt = new WeakMap(), Vn = new WeakMap(), Gt = new WeakMap(), Gn = new WeakMap(),
7872
7906
  connectInfo: n,
7873
7907
  estimatedRtt: c,
7874
7908
  edgeUrl: h
7875
- }))), e.reset(), Ze(this, Gn)._++, l(this, Gt, 0), l(this, Wn, Date.now()), a(this, jn) || l(this, jn, a(this, Wn)), yield this.connectionImpl.closed();
7909
+ }))), e.reset(), Ze(this, Gn)._++, l(this, Wt, 0), l(this, Wn, Date.now()), a(this, jn) || l(this, jn, a(this, Wn)), yield this.connectionImpl.closed();
7876
7910
  } catch (n) {
7877
7911
  this.logger.info("Failed to connect", n);
7878
7912
  const o = e.shiftedEdge();
7879
7913
  o && this.emitter.emit("telemetry event", {
7880
7914
  code: "shifted_edge",
7881
7915
  edgeUrl: typeof o == "string" ? o : o.moqUrl || o.moqWsUrl
7882
- }), n instanceof P ? this.emitter.emit("error", n) : n instanceof Error && this.emitter.emit("error", new P(n.message, { code: "start_failed", isFatal: !1 }));
7916
+ }), n instanceof x ? this.emitter.emit("error", n) : n instanceof Error && this.emitter.emit("error", new x(n.message, { code: "start_failed", isFatal: !1 }));
7883
7917
  }
7884
7918
  if ((t = this.connectionImpl) == null || t.unload(), this.connectionImpl = void 0, !a(this, vt))
7885
7919
  break;
7886
7920
  if (!(yield this.config.reconnectHandler({
7887
- reconnectRetries: a(this, Gt)
7921
+ reconnectRetries: a(this, Wt)
7888
7922
  }))) {
7889
7923
  this.emitter.emit("error", ku());
7890
7924
  break;
@@ -7898,15 +7932,15 @@ vt = new WeakMap(), Vn = new WeakMap(), Gt = new WeakMap(), Gn = new WeakMap(),
7898
7932
  let Mh = Vs;
7899
7933
  const th = () => ({
7900
7934
  video: F(v({}, co()), {
7901
- bitRate: wi()
7935
+ bitRate: bi()
7902
7936
  }),
7903
7937
  audio: {
7904
- bitRate: wi()
7938
+ bitRate: bi()
7905
7939
  }
7906
- }), LA = () => ({
7940
+ }), OA = () => ({
7907
7941
  width: window.innerWidth,
7908
7942
  height: window.innerHeight,
7909
- bitRate: wi()
7943
+ bitRate: bi()
7910
7944
  }), Gs = class Gs {
7911
7945
  constructor(e, t, i, n) {
7912
7946
  r(this, "emitter");
@@ -7961,7 +7995,7 @@ const th = () => ({
7961
7995
  });
7962
7996
  r(this, "evaluateConstraintCap", () => {
7963
7997
  var c, h, d, m, p;
7964
- const e = this.sizeBasedResolutionCapEnabled ? F(v({}, th()), { video: LA() }) : th();
7998
+ const e = this.sizeBasedResolutionCapEnabled ? F(v({}, th()), { video: OA() }) : th();
7965
7999
  if (!this.resizeObserver) {
7966
8000
  const g = this.element.getBoundingClientRect();
7967
8001
  this.elementSize = { width: g.width, height: g.height };
@@ -7999,7 +8033,7 @@ const th = () => ({
7999
8033
  };
8000
8034
  r(Gs, "CHECK_SIZE_INTERVAL", 1e3), r(Gs, "create", (e, t, i, n) => new Gs(e, t, i, n));
8001
8035
  let Fh = Gs;
8002
- const DA = 5, OA = 100, MA = 1e3;
8036
+ const MA = 5, FA = 100, _A = 1e3;
8003
8037
  class ad {
8004
8038
  constructor(e, t, i, n) {
8005
8039
  r(this, "timers", Ae.create());
@@ -8009,7 +8043,7 @@ class ad {
8009
8043
  r(this, "playbackSource");
8010
8044
  r(this, "isSuspended", !1);
8011
8045
  r(this, "load", () => {
8012
- this.timers.setInterval(this.emitDecodedFrames, OA), this.timers.setInterval(this.emitDecodeRate, MA), this.emitter.on("init segment", this.onInitSegment), this.emitter.on("coded sample", this.decode);
8046
+ this.timers.setInterval(this.emitDecodedFrames, FA), this.timers.setInterval(this.emitDecodeRate, _A), this.emitter.on("init segment", this.onInitSegment), this.emitter.on("coded sample", this.decode);
8013
8047
  });
8014
8048
  r(this, "unload", () => {
8015
8049
  this.trackContexts.forEach(({ decoderContext: e }) => e.unload()), this.timers.unload(), this.emitter.off("init segment", this.onInitSegment), this.emitter.off("coded sample", this.decode);
@@ -8026,12 +8060,12 @@ class ad {
8026
8060
  });
8027
8061
  r(this, "videoDecodeRate", () => {
8028
8062
  var o, c, h;
8029
- const e = this.trackContexts.get("video"), t = (o = e == null ? void 0 : e.sampleDuration) != null ? o : 40, i = qt((c = e == null ? void 0 : e.decodeTime.items()) != null ? c : []), n = qt((h = e == null ? void 0 : e.transportTime.items()) != null ? h : []);
8063
+ const e = this.trackContexts.get("video"), t = (o = e == null ? void 0 : e.sampleDuration) != null ? o : 40, i = Yt((c = e == null ? void 0 : e.decodeTime.items()) != null ? c : []), n = Yt((h = e == null ? void 0 : e.transportTime.items()) != null ? h : []);
8030
8064
  return t / (i.average + n.average);
8031
8065
  });
8032
8066
  r(this, "getStatistics", () => {
8033
8067
  var o, c, h, d;
8034
- const e = this.trackContexts.get("video"), t = qt((o = e == null ? void 0 : e.decodeTime.items()) != null ? o : []), i = qt((c = e == null ? void 0 : e.transportTime.items()) != null ? c : []), n = qt((d = (h = this.trackContexts.get("audio")) == null ? void 0 : h.decodeTime.items()) != null ? d : []);
8068
+ const e = this.trackContexts.get("video"), t = Yt((o = e == null ? void 0 : e.decodeTime.items()) != null ? o : []), i = Yt((c = e == null ? void 0 : e.transportTime.items()) != null ? c : []), n = Yt((d = (h = this.trackContexts.get("audio")) == null ? void 0 : h.decodeTime.items()) != null ? d : []);
8035
8069
  return {
8036
8070
  videoDecodeRate: this.videoDecodeRate(),
8037
8071
  videoDecodeTime: t,
@@ -8043,7 +8077,7 @@ class ad {
8043
8077
  var i;
8044
8078
  const t = (i = this.trackContexts.get(e.type)) == null ? void 0 : i.decoderContext;
8045
8079
  if (!t)
8046
- throw new P("No known decoder context", {
8080
+ throw new x("No known decoder context", {
8047
8081
  code: "no_known_decoder_context",
8048
8082
  isFatal: !1
8049
8083
  });
@@ -8052,7 +8086,7 @@ class ad {
8052
8086
  r(this, "decode", (e) => {
8053
8087
  const t = this.trackContexts.get(e.type);
8054
8088
  if (!t)
8055
- throw new P("No known decoder context", {
8089
+ throw new x("No known decoder context", {
8056
8090
  code: "no_known_decoder_context",
8057
8091
  isFatal: !1
8058
8092
  });
@@ -8060,7 +8094,7 @@ class ad {
8060
8094
  return;
8061
8095
  t.sampleDuration = e.duration / e.timescale * 1e3;
8062
8096
  const { decoderContext: i, buffer: n } = t, o = e.timestamp / e.timescale * 1e3, c = e.duration / e.timescale * 1e3, h = n[n.length - 1];
8063
- !h || o - DA > h.end ? n.push({ start: o, end: o + c }) : o + c * 5 < h.end ? t.buffer = [{ start: o, end: o + c }] : h.end = o + c, i.enqueue(e), this.emitDecodedFrames();
8097
+ !h || o - MA > h.end ? n.push({ start: o, end: o + c }) : o + c * 5 < h.end ? t.buffer = [{ start: o, end: o + c }] : h.end = o + c, i.enqueue(e), this.emitDecodedFrames();
8064
8098
  });
8065
8099
  r(this, "emitDecodedFrames", () => {
8066
8100
  let e;
@@ -8109,7 +8143,7 @@ class ad {
8109
8143
  for (const h of i)
8110
8144
  switch (h.type) {
8111
8145
  case "audio": {
8112
- const { OpusDecoderContext: d } = yield import("./CI-d-Lzb.js");
8146
+ const { OpusDecoderContext: d } = yield import("./ypJV-2eL.js");
8113
8147
  c.set(h.type, {
8114
8148
  buffer: [],
8115
8149
  decoderContext: yield d.create(48e3, 2),
@@ -8120,7 +8154,7 @@ class ad {
8120
8154
  break;
8121
8155
  }
8122
8156
  case "video": {
8123
- const { H264DecoderWorkerContext: d } = yield import("./C-MEaX21.js");
8157
+ const { H264DecoderWorkerContext: d } = yield import("./CvnFcokQ.js");
8124
8158
  c.set(h.type, {
8125
8159
  buffer: [],
8126
8160
  decoderContext: yield d.create(o),
@@ -8187,16 +8221,16 @@ const Ac = class Ac {
8187
8221
  };
8188
8222
  r(Ac, "create", (e) => new Ac(e));
8189
8223
  let _h = Ac;
8190
- const FA = (s) => (e, t, i) => e.timestamp <= t || e.timestampAdded <= i - s, Zt = class Zt {
8224
+ const NA = (s) => (e, t, i) => e.timestamp <= t || e.timestampAdded <= i - s, $t = class $t {
8191
8225
  constructor(e, t, i) {
8192
8226
  r(this, "logger");
8193
8227
  r(this, "emitter");
8194
8228
  r(this, "waitingEvents", []);
8195
- r(this, "isTriggered", FA(Zt.EVENT_TIMEOUT));
8229
+ r(this, "isTriggered", NA($t.EVENT_TIMEOUT));
8196
8230
  r(this, "timeSource");
8197
8231
  r(this, "timers", new Ae());
8198
8232
  r(this, "load", () => {
8199
- this.timers.setInterval(this.onBufferedStateChanged, Zt.EVENT_CHECK_INTERVAL), this.emitter.on("add event", this.addEvent);
8233
+ this.timers.setInterval(this.onBufferedStateChanged, $t.EVENT_CHECK_INTERVAL), this.emitter.on("add event", this.addEvent);
8200
8234
  });
8201
8235
  r(this, "unload", () => {
8202
8236
  this.timers.unload(), this.emitter.off("add event", this.addEvent);
@@ -8228,8 +8262,8 @@ const FA = (s) => (e, t, i) => e.timestamp <= t || e.timestampAdded <= i - s, Zt
8228
8262
  this.logger = t, this.emitter = e, this.timeSource = i;
8229
8263
  }
8230
8264
  };
8231
- r(Zt, "EVENT_TIMEOUT", 5e3), r(Zt, "EVENT_CHECK_INTERVAL", 20), r(Zt, "create", (e, t, i) => new Zt(e, t, i));
8232
- let Nh = Zt;
8265
+ r($t, "EVENT_TIMEOUT", 5e3), r($t, "EVENT_CHECK_INTERVAL", 20), r($t, "create", (e, t, i) => new $t(e, t, i));
8266
+ let Nh = $t;
8233
8267
  const qe = class qe {
8234
8268
  constructor(e) {
8235
8269
  r(this, "emitter");
@@ -8287,11 +8321,11 @@ const qe = class qe {
8287
8321
  };
8288
8322
  r(qe, "NO_DATA_ERROR_TIMEOUT", 20 * 1e3), r(qe, "NO_DATA_TIMEOUT", 5 * 1e3), r(qe, "UPDATE_RECEIVED_BYTES_INTERVAL", 1e3), r(qe, "create", (e) => new qe(e));
8289
8323
  let Vh = qe;
8290
- const _A = () => window.AudioContext || window.webkitAudioContext, wc = class wc extends bi {
8324
+ const VA = () => window.AudioContext || window.webkitAudioContext, wc = class wc extends yi {
8291
8325
  constructor() {
8292
8326
  super();
8293
8327
  // TODO: Checkout what happens when limit is reached
8294
- r(this, "context", new (_A())());
8328
+ r(this, "context", new (VA())());
8295
8329
  r(this, "timers", Ae.create());
8296
8330
  r(this, "previousCurrentTime", 0);
8297
8331
  r(this, "_isStuck", !1);
@@ -8307,7 +8341,7 @@ const _A = () => window.AudioContext || window.webkitAudioContext, wc = class wc
8307
8341
  try {
8308
8342
  return yield Promise.race([this.context.resume(), id(1e3, Km())]);
8309
8343
  } catch (t) {
8310
- throw this.suspend().catch(D), t;
8344
+ throw this.suspend().catch(O), t;
8311
8345
  }
8312
8346
  }));
8313
8347
  r(this, "suspend", () => f(this, null, function* () {
@@ -8337,7 +8371,7 @@ const _A = () => window.AudioContext || window.webkitAudioContext, wc = class wc
8337
8371
  };
8338
8372
  r(wc, "CHECK_INTERVAL", 1e3);
8339
8373
  let Gh = wc;
8340
- const bc = class bc extends bi {
8374
+ const bc = class bc extends yi {
8341
8375
  constructor(t, i, { muted: n, reInitWhenStuck: o }) {
8342
8376
  super();
8343
8377
  r(this, "logger");
@@ -8381,7 +8415,7 @@ const bc = class bc extends bi {
8381
8415
  });
8382
8416
  r(this, "flush", () => {
8383
8417
  if (!this.audio || !this.gainNode)
8384
- throw new P("AudioContext must be initialized to flush", {
8418
+ throw new x("AudioContext must be initialized to flush", {
8385
8419
  isFatal: !1,
8386
8420
  code: "audiocontext_must_be_initialized"
8387
8421
  });
@@ -8450,7 +8484,7 @@ const bc = class bc extends bi {
8450
8484
  return (t = this.audio) == null || t.unload(), this.audio = new Gh(), this.audio.on("state", (o) => {
8451
8485
  this.logger.info("AudioContext state change", { state: o }), o === "running" && (this._muted = this._userProvidedMuted, this.setGain(this._volume)), !this.ignoreSuspendCalls && this.emit("state change", o);
8452
8486
  }), this.audio.on("stuck", () => {
8453
- this.reInitWhenStuck && (this.logger.info("Re-init audio context"), this.setupContext(), this.resume().catch(D), this.emit("stuck"));
8487
+ this.reInitWhenStuck && (this.logger.info("Re-init audio context"), this.setupContext(), this.resume().catch(O), this.emit("stuck"));
8454
8488
  }), (i = this.gainNode) == null || i.disconnect(), this.gainNode = this.audio.createGain(), this.setGain(this._volume), this.startTime = this.audio.currentTime, (n = this.splitter) == null || n.disconnect(), this.splitter = this.audio.createSplitter(), this.audio;
8455
8489
  });
8456
8490
  r(this, "setGain", (t) => {
@@ -8507,11 +8541,11 @@ const bc = class bc extends bi {
8507
8541
  };
8508
8542
  r(bc, "create", (t, i, n) => new bc(t, i, n));
8509
8543
  let Mo = bc;
8510
- var gi;
8544
+ var Ai;
8511
8545
  class zl {
8512
8546
  constructor() {
8513
- u(this, gi, []);
8514
- l(this, gi, []);
8547
+ u(this, Ai, []);
8548
+ l(this, Ai, []);
8515
8549
  }
8516
8550
  addTextTrack(e, t, i) {
8517
8551
  const n = [], o = {
@@ -8528,43 +8562,43 @@ class zl {
8528
8562
  h !== -1 && n.splice(h, 1);
8529
8563
  }
8530
8564
  };
8531
- return a(this, gi).push(o), o;
8565
+ return a(this, Ai).push(o), o;
8532
8566
  }
8533
8567
  set language(e) {
8534
- a(this, gi).forEach((t) => {
8568
+ a(this, Ai).forEach((t) => {
8535
8569
  t.language === e ? t.mode = "showing" : t.mode = "hidden";
8536
8570
  });
8537
8571
  }
8538
8572
  get language() {
8539
8573
  var e;
8540
- return (e = a(this, gi).find((t) => t.mode === "showing")) == null ? void 0 : e.language;
8574
+ return (e = a(this, Ai).find((t) => t.mode === "showing")) == null ? void 0 : e.language;
8541
8575
  }
8542
8576
  getActiveCues(e) {
8543
- const t = a(this, gi).find((i) => i.mode === "showing");
8577
+ const t = a(this, Ai).find((i) => i.mode === "showing");
8544
8578
  return t ? t.cues.filter(({ startTime: i, endTime: n }) => e >= i && e <= n) : [];
8545
8579
  }
8546
8580
  }
8547
- gi = new WeakMap();
8548
- const Ti = (s, e) => {
8581
+ Ai = new WeakMap();
8582
+ const Ii = (s, e) => {
8549
8583
  let t;
8550
8584
  for (t = e; s > 1; s--) t += e;
8551
8585
  return t;
8552
8586
  };
8553
- class NA {
8587
+ class GA {
8554
8588
  constructor() {
8555
8589
  r(this, "audio");
8556
- r(this, "unmute", () => this.audio.play().catch(D));
8590
+ r(this, "unmute", () => this.audio.play().catch(O));
8557
8591
  const e = document.createElement("div");
8558
8592
  e.innerHTML = "<audio x-webkit-airplay='deny'></audio>";
8559
8593
  const t = e.children.item(0);
8560
8594
  if (t instanceof HTMLAudioElement)
8561
- this.audio = t, this.audio.controls = !1, this.audio.disableRemotePlayback = !0, this.audio.preload = "auto", this.audio.src = "data:audio/mpeg;base64,//uQx" + Ti(23, "A") + "WGluZwAAAA8AAAACAAACcQCA" + Ti(16, "gICA") + Ti(66, "/") + "8AAABhTEFNRTMuMTAwA8MAAAAAAAAAABQgJAUHQQAB9AAAAnGMHkkI" + Ti(320, "A") + "//sQxAADgnABGiAAQBCqgCRMAAgEAH" + Ti(15, "/") + "7+n/9FTuQsQH//////2NG0jWUGlio5gLQTOtIoeR2WX////X4s9Atb/JRVCbBUpeRUq" + Ti(18, "/") + "9RUi0f2jn/+xDECgPCjAEQAABN4AAANIAAAAQVTEFNRTMuMTAw" + Ti(97, "V") + "Q==", this.audio.loop = !1, this.audio.load();
8595
+ this.audio = t, this.audio.controls = !1, this.audio.disableRemotePlayback = !0, this.audio.preload = "auto", this.audio.src = "data:audio/mpeg;base64,//uQx" + Ii(23, "A") + "WGluZwAAAA8AAAACAAACcQCA" + Ii(16, "gICA") + Ii(66, "/") + "8AAABhTEFNRTMuMTAwA8MAAAAAAAAAABQgJAUHQQAB9AAAAnGMHkkI" + Ii(320, "A") + "//sQxAADgnABGiAAQBCqgCRMAAgEAH" + Ii(15, "/") + "7+n/9FTuQsQH//////2NG0jWUGlio5gLQTOtIoeR2WX////X4s9Atb/JRVCbBUpeRUq" + Ii(18, "/") + "9RUi0f2jn/+xDECgPCjAEQAABN4AAANIAAAAQVTEFNRTMuMTAw" + Ii(97, "V") + "Q==", this.audio.loop = !1, this.audio.load();
8562
8596
  else
8563
8597
  throw new Error("Failed to create audio tag");
8564
8598
  }
8565
8599
  }
8566
8600
  var Wa, St, fe, us, Qe, Hl, Us, Xl;
8567
- class VA {
8601
+ class jA {
8568
8602
  constructor() {
8569
8603
  u(this, Qe);
8570
8604
  u(this, Wa, []);
@@ -8629,7 +8663,7 @@ Wa = new WeakMap(), St = new WeakMap(), fe = new WeakMap(), us = new WeakMap(),
8629
8663
  }
8630
8664
  return i;
8631
8665
  };
8632
- const GA = `
8666
+ const WA = `
8633
8667
  precision mediump float;
8634
8668
  uniform sampler2D texture;
8635
8669
 
@@ -8641,7 +8675,7 @@ void main() {
8641
8675
 
8642
8676
  gl_FragColor = vec4(y, y, y, a);
8643
8677
  }
8644
- `, jA = `
8678
+ `, zA = `
8645
8679
  attribute vec2 position;
8646
8680
  varying vec2 texture_coordinate;
8647
8681
  uniform mat4 model;
@@ -8653,7 +8687,7 @@ void main() {
8653
8687
  `, zd = (s, e) => {
8654
8688
  let t = s.getContext("webgl", e);
8655
8689
  if (t || (t = s.getContext("experimental-webgl", e)), !t)
8656
- throw new P("Failed to create webgl context", {
8690
+ throw new x("Failed to create webgl context", {
8657
8691
  isFatal: !0,
8658
8692
  code: "failed_to_create_web_gl_context"
8659
8693
  });
@@ -8661,19 +8695,19 @@ void main() {
8661
8695
  }, Ps = (s, e, t) => {
8662
8696
  const i = s.createShader(e);
8663
8697
  if (!i)
8664
- throw new P("Failed to create shader", { isFatal: !0, code: "failed_to_create_shader" });
8698
+ throw new x("Failed to create shader", { isFatal: !0, code: "failed_to_create_shader" });
8665
8699
  if (s.shaderSource(i, t), s.compileShader(i), !s.getShaderParameter(i, s.COMPILE_STATUS)) {
8666
8700
  const n = s.getShaderInfoLog(i);
8667
- throw new P(`Failed to compile shader: ${n != null ? n : ""}`, {
8701
+ throw new x(`Failed to compile shader: ${n != null ? n : ""}`, {
8668
8702
  isFatal: !0,
8669
8703
  code: "failed_to_compile_shader"
8670
8704
  });
8671
8705
  }
8672
8706
  return i;
8673
- }, Ri = (s) => {
8707
+ }, Ui = (s) => {
8674
8708
  const e = s.createTexture();
8675
8709
  if (!e)
8676
- throw new P("Failed to create texture", {
8710
+ throw new x("Failed to create texture", {
8677
8711
  isFatal: !0,
8678
8712
  code: "failed_to_create_texture"
8679
8713
  });
@@ -8681,7 +8715,7 @@ void main() {
8681
8715
  }, Hd = (s, e) => {
8682
8716
  const t = s.createBuffer();
8683
8717
  if (!t)
8684
- throw new P("Failed to create buffer", {
8718
+ throw new x("Failed to create buffer", {
8685
8719
  isFatal: !0,
8686
8720
  code: "failed_to_create_buffer"
8687
8721
  });
@@ -8689,21 +8723,21 @@ void main() {
8689
8723
  }, jh = (s, e, t) => {
8690
8724
  const i = s.createProgram();
8691
8725
  if (!i)
8692
- throw new P("Failed to create program", {
8726
+ throw new x("Failed to create program", {
8693
8727
  isFatal: !0,
8694
8728
  code: "failed_to_create_program"
8695
8729
  });
8696
8730
  if (s.attachShader(i, t), s.attachShader(i, e), s.linkProgram(i), !s.getProgramParameter(i, s.LINK_STATUS)) {
8697
8731
  const n = s.getShaderInfoLog(i);
8698
- throw new P(`Failed to link program: ${n != null ? n : ""}`, {
8732
+ throw new x(`Failed to link program: ${n != null ? n : ""}`, {
8699
8733
  isFatal: !0,
8700
8734
  code: "failed_to_link_program"
8701
8735
  });
8702
8736
  }
8703
8737
  return i;
8704
8738
  };
8705
- var yc, V, za, Ha, Xa, Ai, Hn, Ql, Zl, vc;
8706
- class WA {
8739
+ var yc, V, za, Ha, Xa, wi, Hn, Ql, Zl, vc;
8740
+ class HA {
8707
8741
  constructor(e) {
8708
8742
  u(this, Hn);
8709
8743
  u(this, yc, 96);
@@ -8711,8 +8745,8 @@ class WA {
8711
8745
  u(this, za);
8712
8746
  u(this, Ha);
8713
8747
  u(this, Xa);
8714
- u(this, Ai);
8715
- r(this, "subtitleRenderer", new VA());
8748
+ u(this, wi);
8749
+ r(this, "subtitleRenderer", new jA());
8716
8750
  // prettier-ignore
8717
8751
  u(this, vc, (e, t, i, n) => [
8718
8752
  e,
@@ -8732,14 +8766,14 @@ class WA {
8732
8766
  0,
8733
8767
  1
8734
8768
  ]);
8735
- l(this, V, e), l(this, za, Ri(e)), l(this, Ha, Ps(e, e.FRAGMENT_SHADER, GA)), l(this, Xa, Ps(e, e.VERTEX_SHADER, jA)), l(this, Ai, jh(e, a(this, Xa), a(this, Ha))), this.subtitleRenderer.config.fontSize = "64px";
8769
+ l(this, V, e), l(this, za, Ui(e)), l(this, Ha, Ps(e, e.FRAGMENT_SHADER, WA)), l(this, Xa, Ps(e, e.VERTEX_SHADER, zA)), l(this, wi, jh(e, a(this, Xa), a(this, Ha))), this.subtitleRenderer.config.fontSize = "64px";
8736
8770
  }
8737
8771
  setActiveCues(e, t) {
8738
8772
  this.subtitleRenderer.setActiveCues(e), this.subtitleRenderer.render(t);
8739
8773
  }
8740
8774
  render(e) {
8741
8775
  const t = this.subtitleRenderer.canvas, i = (e.padding + a(this, yc)) * window.devicePixelRatio;
8742
- t.width !== 0 && (a(this, V).useProgram(a(this, Ai)), A(this, Hn, Ql).call(this), A(this, Hn, Zl).call(this, this.subtitleRenderer.canvas.width / e.width, this.subtitleRenderer.canvas.height / e.height, -this.subtitleRenderer.canvas.width / e.width / 2, -(1 - (this.subtitleRenderer.canvas.height + i) / e.height)), a(this, V).uniform1i(a(this, V).getUniformLocation(a(this, Ai), "texture"), 4), a(this, V).activeTexture(a(this, V).TEXTURE4), a(this, V).bindTexture(a(this, V).TEXTURE_2D, a(this, za)), a(this, V).enable(a(this, V).BLEND), a(this, V).blendFunc(a(this, V).SRC_ALPHA, a(this, V).ONE_MINUS_SRC_ALPHA), a(this, V).texImage2D(
8776
+ t.width !== 0 && (a(this, V).useProgram(a(this, wi)), A(this, Hn, Ql).call(this), A(this, Hn, Zl).call(this, this.subtitleRenderer.canvas.width / e.width, this.subtitleRenderer.canvas.height / e.height, -this.subtitleRenderer.canvas.width / e.width / 2, -(1 - (this.subtitleRenderer.canvas.height + i) / e.height)), a(this, V).uniform1i(a(this, V).getUniformLocation(a(this, wi), "texture"), 4), a(this, V).activeTexture(a(this, V).TEXTURE4), a(this, V).bindTexture(a(this, V).TEXTURE_2D, a(this, za)), a(this, V).enable(a(this, V).BLEND), a(this, V).blendFunc(a(this, V).SRC_ALPHA, a(this, V).ONE_MINUS_SRC_ALPHA), a(this, V).texImage2D(
8743
8777
  a(this, V).TEXTURE_2D,
8744
8778
  0,
8745
8779
  a(this, V).RGBA,
@@ -8749,11 +8783,11 @@ class WA {
8749
8783
  ), a(this, V).texParameteri(a(this, V).TEXTURE_2D, a(this, V).TEXTURE_MAG_FILTER, a(this, V).LINEAR), a(this, V).drawArrays(a(this, V).TRIANGLE_STRIP, 0, 4));
8750
8784
  }
8751
8785
  }
8752
- yc = new WeakMap(), V = new WeakMap(), za = new WeakMap(), Ha = new WeakMap(), Xa = new WeakMap(), Ai = new WeakMap(), Hn = new WeakSet(), Ql = function() {
8753
- const e = a(this, V).getAttribLocation(a(this, Ai), "position");
8786
+ yc = new WeakMap(), V = new WeakMap(), za = new WeakMap(), Ha = new WeakMap(), Xa = new WeakMap(), wi = new WeakMap(), Hn = new WeakSet(), Ql = function() {
8787
+ const e = a(this, V).getAttribLocation(a(this, wi), "position");
8754
8788
  a(this, V).enableVertexAttribArray(e), a(this, V).vertexAttribPointer(e, 2, a(this, V).FLOAT, !1, 0, 0);
8755
8789
  }, Zl = function(e, t, i, n) {
8756
- const o = a(this, V).getUniformLocation(a(this, Ai), "model");
8790
+ const o = a(this, V).getUniformLocation(a(this, wi), "model");
8757
8791
  a(this, V).uniformMatrix4fv(o, !1, a(this, vc).call(this, e, t, i, n));
8758
8792
  }, vc = new WeakMap();
8759
8793
  const Xd = `
@@ -8793,7 +8827,7 @@ void main() {
8793
8827
  stencil: !1,
8794
8828
  antialias: !1,
8795
8829
  premultipliedAlpha: !1
8796
- }, Ir = class Ir extends bi {
8830
+ }, Ir = class Ir extends yi {
8797
8831
  constructor() {
8798
8832
  super();
8799
8833
  r(this, "canvas", document.createElement("canvas"));
@@ -8803,9 +8837,9 @@ void main() {
8803
8837
  r(this, "buffer", Hd(this.context, Ir.SQUARE_VERTICES));
8804
8838
  r(this, "program", jh(this.context, this.vertexShader, this.pixelShader));
8805
8839
  r(this, "textures", {
8806
- y: Ri(this.context),
8807
- u: Ri(this.context),
8808
- v: Ri(this.context)
8840
+ y: Ui(this.context),
8841
+ u: Ui(this.context),
8842
+ v: Ui(this.context)
8809
8843
  });
8810
8844
  // Lazy loaded when needed
8811
8845
  r(this, "textRenderer");
@@ -8817,9 +8851,9 @@ void main() {
8817
8851
  });
8818
8852
  r(this, "onContextRestored", () => {
8819
8853
  this.emit("context restored"), this.context = zd(this.canvas, qd), this.pixelShader = Ps(this.context, this.context.FRAGMENT_SHADER, Xd), this.vertexShader = Ps(this.context, this.context.VERTEX_SHADER, Qd), this.buffer = Hd(this.context, Ir.SQUARE_VERTICES), this.program = jh(this.context, this.vertexShader, this.pixelShader), this.textures = {
8820
- y: Ri(this.context),
8821
- u: Ri(this.context),
8822
- v: Ri(this.context)
8854
+ y: Ui(this.context),
8855
+ u: Ui(this.context),
8856
+ v: Ui(this.context)
8823
8857
  }, this.load();
8824
8858
  });
8825
8859
  r(this, "load", () => {
@@ -8929,7 +8963,7 @@ void main() {
8929
8963
  this.canvas.addEventListener("webglcontextlost", this.onContextLost), this.canvas.addEventListener("webglcontextrestored", this.onContextRestored, !1), this.canvas.style.width = "100%", this.canvas.style.position = "relative";
8930
8964
  }
8931
8965
  getTextRenderer() {
8932
- return this.textRenderer || (this.textRenderer = new WA(this.context)), this.textRenderer;
8966
+ return this.textRenderer || (this.textRenderer = new HA(this.context)), this.textRenderer;
8933
8967
  }
8934
8968
  };
8935
8969
  r(Ir, "SQUARE_VERTICES", new Float32Array([0, 0, 0, 1, 1, 0, 1, 1]));
@@ -9009,7 +9043,7 @@ const Ec = class Ec {
9009
9043
  r(this, "audioPlayer");
9010
9044
  r(this, "videoPlayer");
9011
9045
  r(this, "pool");
9012
- r(this, "unmuter", new NA());
9046
+ r(this, "unmuter", new GA());
9013
9047
  r(this, "_isPaused", !1);
9014
9048
  r(this, "isDisconnected", !1);
9015
9049
  r(this, "timers", new Ae());
@@ -9074,7 +9108,7 @@ const Ec = class Ec {
9074
9108
  }
9075
9109
  set muted(e) {
9076
9110
  const t = this.muted;
9077
- this.audioPlayer.muted = e, !e && t && this.activateAudioPlayer().catch(D);
9111
+ this.audioPlayer.muted = e, !e && t && this.activateAudioPlayer().catch(O);
9078
9112
  }
9079
9113
  get currentTime() {
9080
9114
  return this.audioPlayer.currentTime;
@@ -9192,7 +9226,7 @@ const Tc = class Tc {
9192
9226
  autoplay: !1,
9193
9227
  logger: this.logger.createContext("MediaElement")
9194
9228
  }), this.mediaElement.on("volume state", (d) => {
9195
- this.updateVolumeState(), !d.isMuted && !this.audioPlayer.isContextRunning && this.activateAudioPlayer().catch(D), d.isMuted || (this._userProvidedMuted = !1);
9229
+ this.updateVolumeState(), !d.isMuted && !this.audioPlayer.isContextRunning && this.activateAudioPlayer().catch(O), d.isMuted || (this._userProvidedMuted = !1);
9196
9230
  }), this.mediaElement.on("media element state", (d) => {
9197
9231
  d === "paused" && this.audioPlayer.flushBuffer(), this.emitter.emit("media element state", d);
9198
9232
  }), this.audioPlayer = Mo.create(this.logger.createContext("AudioPlayerModule"), n, {
@@ -9221,7 +9255,7 @@ const Tc = class Tc {
9221
9255
  }
9222
9256
  set muted(e) {
9223
9257
  const t = this.muted;
9224
- this._userProvidedMuted = e, this.mediaElement.muted = e, !e && t && this.activateAudioPlayer().catch(D);
9258
+ this._userProvidedMuted = e, this.mediaElement.muted = e, !e && t && this.activateAudioPlayer().catch(O);
9225
9259
  }
9226
9260
  get currentTime() {
9227
9261
  return this.audioPlayer.currentTime;
@@ -9262,8 +9296,8 @@ const Tc = class Tc {
9262
9296
  };
9263
9297
  r(Tc, "create", (e, t, i, n, o) => new Tc(e, t, i, n, o));
9264
9298
  let Hh = Tc;
9265
- const zA = () => (s) => ql(s.buffered.start(0), s.buffered.end(s.buffered.length - 1)), ql = (s, e) => (t) => t.remove(Math.max(0, s), Math.min(Number.POSITIVE_INFINITY, e)), $d = (s) => (e) => e.appendBuffer(s), HA = (s) => (e) => e.changeType(s), XA = (s) => (e) => s(e);
9266
- class QA {
9299
+ const XA = () => (s) => ql(s.buffered.start(0), s.buffered.end(s.buffered.length - 1)), ql = (s, e) => (t) => t.remove(Math.max(0, s), Math.min(Number.POSITIVE_INFINITY, e)), $d = (s) => (e) => e.appendBuffer(s), QA = (s) => (e) => e.changeType(s), ZA = (s) => (e) => s(e);
9300
+ class qA {
9267
9301
  constructor(e) {
9268
9302
  r(this, "commandQueue", []);
9269
9303
  r(this, "sourceBuffer");
@@ -9281,7 +9315,7 @@ class QA {
9281
9315
  this.commandQueue.push(o), this.handleQueue();
9282
9316
  }));
9283
9317
  r(this, "execute", (e) => new Promise((t, i) => {
9284
- const n = new Es(XA(e), t, i);
9318
+ const n = new Es(ZA(e), t, i);
9285
9319
  this.commandQueue.push(n), this.handleQueue();
9286
9320
  }));
9287
9321
  r(this, "buffered", () => this.sourceBuffer.buffered);
@@ -9289,7 +9323,7 @@ class QA {
9289
9323
  e.removeSourceBuffer(this.sourceBuffer);
9290
9324
  });
9291
9325
  r(this, "changeType", (e) => new Promise((t, i) => {
9292
- const n = new Es(HA(e), t, i);
9326
+ const n = new Es(QA(e), t, i);
9293
9327
  this.commandQueue.push(n), this.handleQueue();
9294
9328
  }));
9295
9329
  r(this, "removeBuffer", (e, t) => new Promise((i, n) => {
@@ -9297,13 +9331,13 @@ class QA {
9297
9331
  this.commandQueue.push(o), this.handleQueue();
9298
9332
  }));
9299
9333
  r(this, "flush", () => new Promise((e, t) => {
9300
- const i = new Es(zA, e, t);
9334
+ const i = new Es(XA, e, t);
9301
9335
  this.commandQueue.push(i), this.handleQueue();
9302
9336
  }));
9303
9337
  this.sourceBuffer = e, this.sourceBuffer.addEventListener("updateend", this.handleQueue);
9304
9338
  }
9305
9339
  }
9306
- class $l extends bi {
9340
+ class $l extends yi {
9307
9341
  constructor() {
9308
9342
  super();
9309
9343
  r(this, "MediaSource", Cr());
@@ -9335,7 +9369,7 @@ class $l extends bi {
9335
9369
  });
9336
9370
  r(this, "addSourceBuffer", (t) => {
9337
9371
  const i = this.mediaSource.addSourceBuffer(t);
9338
- return new QA(i);
9372
+ return new qA(i);
9339
9373
  });
9340
9374
  r(this, "removeSourceBuffer", (t) => {
9341
9375
  t.removeFromMediaSource(this.mediaSource);
@@ -9379,7 +9413,7 @@ class Yl {
9379
9413
  });
9380
9414
  }
9381
9415
  }
9382
- function ZA(s, { mediaSource: e, mimeType: t, codec: i }) {
9416
+ function $A(s, { mediaSource: e, mimeType: t, codec: i }) {
9383
9417
  return F(v({}, s), {
9384
9418
  state: "initialized",
9385
9419
  mimeType: t,
@@ -9480,7 +9514,7 @@ const Ic = class Ic {
9480
9514
  let n = this.trackContexts.get(i.type);
9481
9515
  n || (n = Yd({ pendingSamples: [], initSegments: new Yl() }), this.trackContexts.set(i.type, n)), n.state === "initialized" ? i.mimeType !== n.mimeType && (yield n.sourceBuffer.changeType(i.mimeType)) : this.trackContexts.set(
9482
9516
  i.type,
9483
- ZA(n, {
9517
+ $A(n, {
9484
9518
  mimeType: i.mimeType,
9485
9519
  mediaSource: this.mediaSource,
9486
9520
  codec: i.codec
@@ -9512,7 +9546,11 @@ const Ic = class Ic {
9512
9546
  if (!i)
9513
9547
  throw qa(e.type, e.renditionId);
9514
9548
  i.state === "initialized" && (i.mimeType = t);
9515
- const n = zp(e.codec, e.data, e.timescale);
9549
+ const n = zp({
9550
+ codec: e.codec,
9551
+ timescale: e.timescale,
9552
+ initData: e.data
9553
+ });
9516
9554
  n && i.initSegments.set(e.channelId, e.renditionId, new Uint8Array(n));
9517
9555
  });
9518
9556
  r(this, "append", (e, t) => f(this, null, function* () {
@@ -9576,7 +9614,7 @@ const Ic = class Ic {
9576
9614
  if (!S)
9577
9615
  throw qa(c);
9578
9616
  S.state === "initialized" && t && (S.mimeType = t, S.initSegments.set(n, o, d));
9579
- const x = {
9617
+ const P = {
9580
9618
  fragmented: !0,
9581
9619
  type: c,
9582
9620
  data: h,
@@ -9591,7 +9629,7 @@ const Ic = class Ic {
9591
9629
  fragment: e,
9592
9630
  compositionTimeOffset: b
9593
9631
  };
9594
- this.onCodedSample(x);
9632
+ this.onCodedSample(P);
9595
9633
  });
9596
9634
  r(this, "onCodedSample", (e) => {
9597
9635
  if (e.duration === 0)
@@ -9605,7 +9643,7 @@ const Ic = class Ic {
9605
9643
  const i = v({}, e);
9606
9644
  "fragment" in i ? (i.fragment = i.fragment.clone(), i.fragment.updateBaseMediaDecodeTime(0), i.data = i.fragment.rawBytes()) : i.timestamp = 0, t.pendingSamples.push(i);
9607
9645
  }
9608
- t.hasFirstSync = !0, t.pendingSamples.push(e), t.state !== "uninitialized" && (t.isWorkingOnPendingSamples || qA(t, this.append, this.maxChunkSize).catch((i) => {
9646
+ t.hasFirstSync = !0, t.pendingSamples.push(e), t.state !== "uninitialized" && (t.isWorkingOnPendingSamples || YA(t, this.append, this.maxChunkSize).catch((i) => {
9609
9647
  if (t.isWorkingOnPendingSamples = !1, i instanceof Error) {
9610
9648
  if (this.logger.error("append failed", { message: i.message, name: i.name }), i instanceof DOMException && i.code === DOMException.QUOTA_EXCEEDED_ERR) {
9611
9649
  if (t.consecutiveQuotaExceededErrorCount >= this.minConsecutiveErrorsBeforeEmit) {
@@ -9633,7 +9671,7 @@ const Ic = class Ic {
9633
9671
  const n = !this.mediaElement.paused, o = [];
9634
9672
  this.trackContexts.forEach((c, h) => {
9635
9673
  c.state === "initialized" && o.push({ type: h, mimeType: c.mimeType, codec: c.codec });
9636
- }), this.sourceOpenStartTime = Date.now(), this.pendingTracksToAddSourceBuffers = o, this.mediaElement.src = "", this.setTrackContexts(this.trackContexts), this.mediaSource.attach(this.mediaElement), n && this.mediaElement.play().catch(D);
9674
+ }), this.sourceOpenStartTime = Date.now(), this.pendingTracksToAddSourceBuffers = o, this.mediaElement.src = "", this.setTrackContexts(this.trackContexts), this.mediaSource.attach(this.mediaElement), n && this.mediaElement.play().catch(O);
9637
9675
  }
9638
9676
  }
9639
9677
  this.logger.debug("source ended");
@@ -9651,7 +9689,7 @@ const Jd = (s, e) => {
9651
9689
  const t = s.renditionId !== e.renditionId, i = s.channelId !== e.channelId, n = ((h = s.timestamp) != null ? h : 0) > e.timestamp, o = s.type === "video" && e.type === "video" && "levelIdc" in s && "levelIdc" in e && s.levelIdc !== e.levelIdc;
9652
9690
  let c = !1;
9653
9691
  return s.type === "video" && e.type === "video" && "width" in s && "width" in e && (c = e.width !== s.width || e.height !== s.height), i || t || n || c || o;
9654
- }, qA = (s, e, t) => f(void 0, null, function* () {
9692
+ }, YA = (s, e, t) => f(null, null, function* () {
9655
9693
  for (s.isWorkingOnPendingSamples = !0; s.pendingSamples.length > 0; ) {
9656
9694
  const i = [];
9657
9695
  let n = 0;
@@ -9703,7 +9741,7 @@ const Jd = (s, e) => {
9703
9741
  r(this, "requestStandardPictureInPicture", () => f(this, null, function* () {
9704
9742
  return yield this.element.requestPictureInPicture();
9705
9743
  }));
9706
- r(this, "exitStandardPictureInPicture", () => f(this, null, function* () {
9744
+ r(this, "exitStandardPictureInPicture", () => f(null, null, function* () {
9707
9745
  return yield document.exitPictureInPicture();
9708
9746
  }));
9709
9747
  r(this, "isStandardPictureInPictureSupported", () => !!this.element && !!this.element.requestPictureInPicture && !!document.pictureInPictureEnabled);
@@ -9764,7 +9802,7 @@ const qh = () => ({
9764
9802
  bufferingRanges: [],
9765
9803
  activeRanges: [],
9766
9804
  decodeRate: Number.MAX_SAFE_INTEGER
9767
- }), $A = () => ({
9805
+ }), JA = () => ({
9768
9806
  levels: {},
9769
9807
  levelDowngrades: [],
9770
9808
  levelUpgrades: [],
@@ -9776,7 +9814,7 @@ const qh = () => ({
9776
9814
  r(this, "logger");
9777
9815
  r(this, "emitter");
9778
9816
  r(this, "timers", Ae.create());
9779
- r(this, "metrics", $A());
9817
+ r(this, "metrics", JA());
9780
9818
  r(this, "bufferFullness", new pe(30));
9781
9819
  r(this, "bufferFullnessRegression");
9782
9820
  r(this, "currentLevel");
@@ -9846,8 +9884,8 @@ const qh = () => ({
9846
9884
  const t = this.timeSpentBuffering(), i = this.timeActive(), n = this.bufferingRatios(), o = this.activeRatios(), c = ((m = (d = e.video) == null ? void 0 : d.bitRate) != null ? m : 0) + ((g = (p = e.audio) == null ? void 0 : p.bitRate) != null ? g : 0), h = t / i;
9847
9885
  return Object.keys(this.metrics.levels).map((w) => parseInt(w, 10)).filter((w) => w >= c).reduce(
9848
9886
  (w, b) => {
9849
- var S, x;
9850
- return ((S = o.get(b.toString())) != null ? S : 0) - ((x = n.get(b.toString())) != null ? x : 0) * h + w;
9887
+ var S, P;
9888
+ return ((S = o.get(b.toString())) != null ? S : 0) - ((P = n.get(b.toString())) != null ? P : 0) * h + w;
9851
9889
  },
9852
9890
  0
9853
9891
  );
@@ -9861,15 +9899,15 @@ const qh = () => ({
9861
9899
  fatalQosCount: this.fatalQosCount
9862
9900
  }));
9863
9901
  r(this, "onRenditionLevelChanged", (e) => {
9864
- var o, c, h, d, m, p, g, w, b, S, x, R, M, T;
9865
- const t = ((h = (c = (o = e.from) == null ? void 0 : o.video) == null ? void 0 : c.bitRate) != null ? h : 0) + ((p = (m = (d = e.from) == null ? void 0 : d.audio) == null ? void 0 : m.bitRate) != null ? p : 0), i = ((b = (w = (g = e.to) == null ? void 0 : g.video) == null ? void 0 : w.bitRate) != null ? b : 0) + ((R = (x = (S = e.to) == null ? void 0 : S.audio) == null ? void 0 : x.bitRate) != null ? R : 0);
9902
+ var o, c, h, d, m, p, g, w, b, S, P, B, D, T;
9903
+ const t = ((h = (c = (o = e.from) == null ? void 0 : o.video) == null ? void 0 : c.bitRate) != null ? h : 0) + ((p = (m = (d = e.from) == null ? void 0 : d.audio) == null ? void 0 : m.bitRate) != null ? p : 0), i = ((b = (w = (g = e.to) == null ? void 0 : g.video) == null ? void 0 : w.bitRate) != null ? b : 0) + ((B = (P = (S = e.to) == null ? void 0 : S.audio) == null ? void 0 : P.bitRate) != null ? B : 0);
9866
9904
  this.logger.info("rendition level changed", { fromLevel: t, toLevel: i }), this.metrics.general.activeRanges.length === 0 && this.setActive(), e.from && e.to && (t < i ? this.metrics.general.upgradesFromLevel.push(Date.now()) : this.metrics.general.downgradesFromLevel.push(Date.now()));
9867
9905
  let n = !1;
9868
9906
  if (e.from) {
9869
- const U = (M = this.metrics.levels[t]) != null ? M : qh();
9870
- t < i ? U.upgradesFromLevel.push(Date.now()) : U.downgradesFromLevel.push(Date.now()), Ii(U.activeRanges);
9907
+ const U = (D = this.metrics.levels[t]) != null ? D : qh();
9908
+ t < i ? U.upgradesFromLevel.push(Date.now()) : U.downgradesFromLevel.push(Date.now()), Ci(U.activeRanges);
9871
9909
  const k = U.bufferingRanges[U.bufferingRanges.length - 1];
9872
- n = !!k && !k.end, Ii(U.bufferingRanges), this.metrics.levels[t] = U;
9910
+ n = !!k && !k.end, Ci(U.bufferingRanges), this.metrics.levels[t] = U;
9873
9911
  }
9874
9912
  if (e.to) {
9875
9913
  const U = (T = this.metrics.levels[i]) != null ? T : qh();
@@ -9905,9 +9943,9 @@ const qh = () => ({
9905
9943
  r(this, "stopBuffering", () => {
9906
9944
  if (this.currentLevel) {
9907
9945
  const e = this.metrics.levels[this.currentLevel];
9908
- e && Ii(e.bufferingRanges);
9946
+ e && Ci(e.bufferingRanges);
9909
9947
  }
9910
- Ii(this.metrics.general.bufferingRanges);
9948
+ Ci(this.metrics.general.bufferingRanges);
9911
9949
  });
9912
9950
  r(this, "startBuffering", () => {
9913
9951
  if (this.currentLevel) {
@@ -9919,9 +9957,9 @@ const qh = () => ({
9919
9957
  r(this, "unsetActive", () => {
9920
9958
  if (this.currentLevel) {
9921
9959
  const e = this.metrics.levels[this.currentLevel];
9922
- e && Ii(e.activeRanges);
9960
+ e && Ci(e.activeRanges);
9923
9961
  }
9924
- Ii(this.metrics.general.activeRanges);
9962
+ Ci(this.metrics.general.activeRanges);
9925
9963
  });
9926
9964
  this.logger = t, this.emitter = e;
9927
9965
  }
@@ -10039,7 +10077,7 @@ const Rc = class Rc {
10039
10077
  };
10040
10078
  r(Rc, "create", (e, t) => new Rc(e, t));
10041
10079
  let Yh = Rc;
10042
- const Yn = (s) => JSON.parse(JSON.stringify(s)), YA = 1e4, Uc = class Uc {
10080
+ const Yn = (s) => JSON.parse(JSON.stringify(s)), KA = 1e4, Uc = class Uc {
10043
10081
  constructor(e, t, i) {
10044
10082
  r(this, "logger");
10045
10083
  r(this, "timers", new Ae());
@@ -10100,7 +10138,7 @@ const Yn = (s) => JSON.parse(JSON.stringify(s)), YA = 1e4, Uc = class Uc {
10100
10138
  const e = this.currentSubscription.channelId, t = this.targetSubscription.channelId, i = e !== t;
10101
10139
  this._isSwitchingSubscription && (i && this.burstMs ? this.setBurst(this.burstMs) : this.setBurst(0), this.pendingSubscriptionTimeoutId && (this.timers.clearTimeout(this.pendingSubscriptionTimeoutId), this.pendingSubscriptionTimeoutId = void 0), i && this.timers.setTimeout(() => {
10102
10140
  this.currentSubscription.channelId === e && this.targetSubscription.channelId === t && (this.logger.warn("Channel switch timeout", t), this.targetSubscription = Yn(this.currentSubscription), this.emitter.emit("channel switch timeout", t));
10103
- }, YA), this.pendingSubscriptionTimeoutId = this.timers.setTimeout(
10141
+ }, KA), this.pendingSubscriptionTimeoutId = this.timers.setTimeout(
10104
10142
  () => this.emitter.emit("send signal", {
10105
10143
  type: "subscribe",
10106
10144
  subscription: this.getTargetSubscription()
@@ -10113,7 +10151,7 @@ const Yn = (s) => JSON.parse(JSON.stringify(s)), YA = 1e4, Uc = class Uc {
10113
10151
  };
10114
10152
  r(Uc, "create", (e, t, i) => new Uc(e, i, t));
10115
10153
  let Jh = Uc;
10116
- const Kd = 5e3, JA = () => vu() || Oc() || Am(), eu = () => JA() ? 100 : 0, tu = (s) => (e) => e > s, Pc = class Pc {
10154
+ const Kd = 5e3, ew = () => vu() || Oc() || Am(), eu = () => ew() ? 100 : 0, tu = (s) => (e) => e > s, Pc = class Pc {
10117
10155
  constructor(e, t, i, n, o) {
10118
10156
  r(this, "emitter");
10119
10157
  r(this, "logger");
@@ -10424,7 +10462,7 @@ const Kd = 5e3, JA = () => vu() || Oc() || Am(), eu = () => JA() ? 100 : 0, tu =
10424
10462
  };
10425
10463
  r(Pc, "create", (e, t, i, n, o) => new Pc(e, t, i, n, o));
10426
10464
  let Kh = Pc;
10427
- const KA = {
10465
+ const tw = {
10428
10466
  enabled: !0,
10429
10467
  interval: 3e4,
10430
10468
  includeErrors: !0,
@@ -10502,7 +10540,7 @@ const KA = {
10502
10540
  r(this, "onError", (e) => this.addError(e.error));
10503
10541
  r(this, "addError", (e) => {
10504
10542
  const { includeErrors: t, maxErrorReports: i } = this.options;
10505
- if (t && e instanceof P) {
10543
+ if (t && e instanceof x) {
10506
10544
  if (this.errorCount++, this.errorCount > i)
10507
10545
  return;
10508
10546
  const n = this.parentContext.getStatistics();
@@ -10511,7 +10549,7 @@ const KA = {
10511
10549
  );
10512
10550
  }
10513
10551
  });
10514
- this.logger = e, this.emitter = t, this.options = v(v({}, KA), i), this.parentContext = n;
10552
+ this.logger = e, this.emitter = t, this.options = v(v({}, tw), i), this.parentContext = n;
10515
10553
  }
10516
10554
  };
10517
10555
  r(xc, "create", (e, t, i, n) => new xc(e, t, i, n));
@@ -10533,11 +10571,11 @@ const Lc = class Lc {
10533
10571
  };
10534
10572
  r(Lc, "create", (e, t, i) => new Lc(e, t, i));
10535
10573
  let No = Lc;
10536
- const ew = 6, tw = (s) => {
10574
+ const iw = 6, sw = (s) => {
10537
10575
  let e = [s], t = 0, i = 0, n = !1;
10538
10576
  const o = (h, d) => {
10539
- var R, M, T;
10540
- h.flags && rr(h.flags) && (t = (R = h.compositionTimeOffset) != null ? R : 0), h.timestamp += t, h.compositionTimeOffset = ((M = h.compositionTimeOffset) != null ? M : 0) - t;
10577
+ var B, D, T;
10578
+ h.flags && rr(h.flags) && (t = (B = h.compositionTimeOffset) != null ? B : 0), h.timestamp += t, h.compositionTimeOffset = ((D = h.compositionTimeOffset) != null ? D : 0) - t;
10541
10579
  const m = h.timestamp / h.timescale, g = d.flags && rr(d.flags) ? (T = d.compositionTimeOffset) != null ? T : 0 : t, b = (d.timestamp + g) / d.timescale, S = Math.max(0, Math.round((b - m) * h.timescale));
10542
10580
  return S > 0 && (i = S), F(v({}, h), {
10543
10581
  /*
@@ -10548,7 +10586,7 @@ const ew = 6, tw = (s) => {
10548
10586
  });
10549
10587
  };
10550
10588
  return (h, d = !1) => {
10551
- if (h.flags && rr(h.flags) && d && (n = !n), !(d && e.length < ew && n) && e.length > 0) {
10589
+ if (h.flags && rr(h.flags) && d && (n = !n), !(d && e.length < iw && n) && e.length > 0) {
10552
10590
  n = !1;
10553
10591
  let p = h;
10554
10592
  for (let w = e.length - 1; w > 0; w--) {
@@ -10564,7 +10602,7 @@ const ew = 6, tw = (s) => {
10564
10602
  }
10565
10603
  return e.push(h), [];
10566
10604
  };
10567
- }, iw = (s, e, t) => {
10605
+ }, nw = (s, e, t) => {
10568
10606
  if (fs(e))
10569
10607
  return v(F(v({}, s), {
10570
10608
  type: "video",
@@ -10588,7 +10626,7 @@ const ew = 6, tw = (s) => {
10588
10626
  duration: 0
10589
10627
  });
10590
10628
  };
10591
- class sw {
10629
+ class rw {
10592
10630
  constructor() {
10593
10631
  r(this, "highEntropyValues");
10594
10632
  var e;
@@ -10606,24 +10644,24 @@ class sw {
10606
10644
  deviceMemory: navigator.deviceMemory
10607
10645
  };
10608
10646
  if (self.navigator.userAgentData && this.highEntropyValues) {
10609
- const g = "1", w = [...(c = this.highEntropyValues.brands) != null ? c : []];
10647
+ const w = [...(c = this.highEntropyValues.brands) != null ? c : []];
10610
10648
  w.sort((T, U) => T.brand.localeCompare(U.brand));
10611
10649
  const b = [...(h = this.highEntropyValues.fullVersionList) != null ? h : []];
10612
10650
  b.sort((T, U) => T.brand.localeCompare(U.brand));
10613
- const S = b.map((T) => T.version), x = w.map((T) => T.brand), R = w.map((T) => T.version), M = parseInt((m = (d = this.highEntropyValues.platformVersion) == null ? void 0 : d.split(".")[0]) != null ? m : g);
10651
+ const S = b.map((T) => T.version), P = w.map((T) => T.brand), B = w.map((T) => T.version), D = parseInt((m = (d = this.highEntropyValues.platformVersion) == null ? void 0 : d.split(".")[0]) != null ? m : "1");
10614
10652
  return v({
10615
10653
  userAgentLegacy: window.navigator.userAgent,
10616
10654
  ua: {
10617
10655
  browser: {
10618
- brands: x,
10656
+ brands: P,
10619
10657
  fullVersionBrands: S,
10620
- majorVersions: R
10658
+ majorVersions: B
10621
10659
  },
10622
10660
  device: this.highEntropyValues.model || "Other",
10623
10661
  os: {
10624
10662
  family: this.highEntropyValues.platform || "Other",
10625
- version: (p = this.highEntropyValues.platformVersion) != null ? p : g,
10626
- major_version: Number.isFinite(M) ? M : 0
10663
+ version: (p = this.highEntropyValues.platformVersion) != null ? p : "1",
10664
+ major_version: Number.isFinite(D) ? D : 0
10627
10665
  }
10628
10666
  }
10629
10667
  }, n);
@@ -10633,7 +10671,7 @@ class sw {
10633
10671
  }, n);
10634
10672
  }
10635
10673
  }
10636
- const nw = (s) => {
10674
+ const aw = (s) => {
10637
10675
  if (typeof s != "object" || s === null)
10638
10676
  throw new Error("not an object");
10639
10677
  if (!("video" in s))
@@ -10645,7 +10683,7 @@ const nw = (s) => {
10645
10683
  return !0;
10646
10684
  };
10647
10685
  var ls, Oe, ms;
10648
- const Ge = class Ge extends bi {
10686
+ const Ge = class Ge extends yi {
10649
10687
  constructor(t) {
10650
10688
  super();
10651
10689
  // 10s
@@ -10658,7 +10696,7 @@ const Ge = class Ge extends bi {
10658
10696
  r(this, "options");
10659
10697
  r(this, "element");
10660
10698
  r(this, "playbackSource");
10661
- r(this, "emitter", new bi());
10699
+ r(this, "emitter", new yi());
10662
10700
  r(this, "logger");
10663
10701
  r(this, "modules");
10664
10702
  r(this, "clientIp");
@@ -10670,7 +10708,7 @@ const Ge = class Ge extends bi {
10670
10708
  r(this, "latestEmittedLanguages", []);
10671
10709
  r(this, "wakeLock");
10672
10710
  r(this, "pool", new yd(Ge.MAX_POOL_SIZE));
10673
- r(this, "userAgentInformation", new sw());
10711
+ r(this, "userAgentInformation", new rw());
10674
10712
  r(this, "encryptedMediaExtensions");
10675
10713
  u(this, ls, 0);
10676
10714
  u(this, Oe, []);
@@ -10822,8 +10860,8 @@ const Ge = class Ge extends bi {
10822
10860
  if (!fs(h) || !this.isSupportedVideoCodecProfile(h.codec, h.codecString))
10823
10861
  return !1;
10824
10862
  if (!this.willUseMediaSource()) {
10825
- const b = this.options.get("advanced"), S = (p = b.wasmDecodingConstraint.bitRate) != null ? p : Number.MAX_SAFE_INTEGER, x = (g = b.wasmDecodingConstraint.width) != null ? g : Number.MAX_SAFE_INTEGER, R = (w = b.wasmDecodingConstraint.height) != null ? w : Number.MAX_SAFE_INTEGER;
10826
- return h.bitRate <= S && h.width <= x && h.height <= R;
10863
+ const b = this.options.get("advanced"), S = (p = b.wasmDecodingConstraint.bitRate) != null ? p : Number.MAX_SAFE_INTEGER, P = (g = b.wasmDecodingConstraint.width) != null ? g : Number.MAX_SAFE_INTEGER, B = (w = b.wasmDecodingConstraint.height) != null ? w : Number.MAX_SAFE_INTEGER;
10864
+ return h.bitRate <= S && h.width <= P && h.height <= B;
10827
10865
  }
10828
10866
  const d = yield hg(h);
10829
10867
  if (!d.supported || h.codec == "av1" && !d.smooth && !d.powerEfficient)
@@ -10851,7 +10889,7 @@ const Ge = class Ge extends bi {
10851
10889
  Ge.INITIAL_MAX_BIT_RATE,
10852
10890
  i,
10853
10891
  this.targetSubscription.audio.bitRate
10854
- ), c = this.options.get("media") === "audio" ? [] : this.options.get("videoCodecs", this.channelId), h = this.supportedAudioCodecs(), d = t.renditions.filter(ps), m = t.renditions.filter(fs), p = h.find((S) => d.find((x) => x.codec === S) !== void 0), g = c.find((S) => m.find((x) => x.codec === S) !== void 0), w = d.map((S) => S.language);
10892
+ ), c = this.options.get("media") === "audio" ? [] : this.options.get("videoCodecs", this.channelId), h = this.supportedAudioCodecs(), d = t.renditions.filter(ps), m = t.renditions.filter(fs), p = h.find((S) => d.find((P) => P.codec === S) !== void 0), g = c.find((S) => m.find((P) => P.codec === S) !== void 0), w = d.map((S) => S.language);
10855
10893
  if (this.logger.debug("supported and selected codecs", { audioCodecs: h, videoCodecs: c, audioCodec: p, videoCodec: g }), g) {
10856
10894
  const S = this.options.get("maxSize");
10857
10895
  this.modules.subscription.setVideoConstraint(v({
@@ -10873,7 +10911,7 @@ const Ge = class Ge extends bi {
10873
10911
  r(this, "isSupportedVideoCodecProfile", (t, i) => {
10874
10912
  if (this.willUseMediaSource()) {
10875
10913
  const n = Cr();
10876
- return n ? n.isTypeSupported(Ui({ codec: t, codecString: i })) : !0;
10914
+ return n ? n.isTypeSupported(Pi({ codec: t, codecString: i })) : !0;
10877
10915
  }
10878
10916
  if (t === "h264") {
10879
10917
  const n = !!(i != null && i.startsWith("avc1.42")), o = !!(i != null && i.startsWith("avc1.66."));
@@ -10891,17 +10929,17 @@ const Ge = class Ge extends bi {
10891
10929
  var n, o;
10892
10930
  const t = this.currentRenditionLevel, i = [];
10893
10931
  if (!t)
10894
- throw new P("No currentRenditionLevel", { code: "no_current_rendition_level", isFatal: !1 });
10932
+ throw new x("No currentRenditionLevel", { code: "no_current_rendition_level", isFatal: !1 });
10895
10933
  if (t != null && t.video && i.push({
10896
10934
  type: "video",
10897
- mimeType: Ui(t.video),
10935
+ mimeType: Pi(t.video),
10898
10936
  codec: t.video.codec
10899
10937
  }), t != null && t.audio && i.push({
10900
10938
  type: "audio",
10901
10939
  codec: t.audio.codec,
10902
- mimeType: Ui(t.audio)
10940
+ mimeType: Pi(t.audio)
10903
10941
  }), i.length === 0)
10904
- throw new P("Can't initialize decoding module without tracks", { code: "no_tracks", isFatal: !1 });
10942
+ throw new x("Can't initialize decoding module without tracks", { code: "no_tracks", isFatal: !1 });
10905
10943
  if (this.willUseMediaSource() && this.element instanceof HTMLMediaElement)
10906
10944
  this.emitter.emit("flush buffers"), yield (n = this.modules.mseModule) == null ? void 0 : n.setSourceBuffers(i);
10907
10945
  else {
@@ -10989,7 +11027,7 @@ const Ge = class Ge extends bi {
10989
11027
  const t = this.modules.canvasModule ? this.options.get("iosMediaElementEnabled") : void 0;
10990
11028
  return v({
10991
11029
  uptime: Date.now() - this.createdAt,
10992
- version: "4.1.2",
11030
+ version: "4.1.3",
10993
11031
  clientId: this.clientId,
10994
11032
  sessionId: this.sessionId,
10995
11033
  channelId: this.channelId,
@@ -11069,17 +11107,17 @@ const Ge = class Ge extends bi {
11069
11107
  this.encryptedMediaExtensions.queryParams = y;
11070
11108
  }
11071
11109
  };
11072
- const b = _h.create(this.emitter), S = this.options.get("poster"), x = S === !0 ? this.getThumbnailUrl() : S || void 0;
11073
- let R, M, T;
11110
+ const b = _h.create(this.emitter), S = this.options.get("poster"), P = S === !0 ? this.getThumbnailUrl() : S || void 0;
11111
+ let B, D, T;
11074
11112
  if (this.willUseMediaSource()) {
11075
11113
  const y = new fh({
11076
11114
  type: this.options.get("media") == "audio" ? "audio" : "video",
11077
11115
  autoplay: !1,
11078
11116
  muted: this.options.get("muted") || this.options.get("media") === "video",
11079
11117
  logger: this.logger.createContext("MediaElement"),
11080
- poster: x
11118
+ poster: P
11081
11119
  });
11082
- y.on("buffer state", (E) => this.emitter.emit("buffer state", E)), y.on("needs user input", (E) => this.emitter.emit("needs user input", E)), y.on("volume state", (E) => this.emit("volume state", E)), y.on("media element state", (E) => this.onMediaElementState(E)), this.element = y.element, this.playbackSource = y, xd.isSupported() && this.encryptedMediaExtensions.attach(y.element), R = Xh.create(this.logger.createContext("MseModule"), this.emitter, this.element), this.options.get("pauseSupportEnabled") || (M = No.create(this.logger.createContext("UnpauseModule"), y, b)), this.options.get("pictureInPictureEnabled") && this.emitter.emit("add picture in picture listener", { element: y.element });
11120
+ y.on("buffer state", (E) => this.emitter.emit("buffer state", E)), y.on("needs user input", (E) => this.emitter.emit("needs user input", E)), y.on("volume state", (E) => this.emit("volume state", E)), y.on("media element state", (E) => this.onMediaElementState(E)), this.element = y.element, this.playbackSource = y, xd.isSupported() && this.encryptedMediaExtensions.attach(y.element), B = Xh.create(this.logger.createContext("MseModule"), this.emitter, this.element), this.options.get("pauseSupportEnabled") || (D = No.create(this.logger.createContext("UnpauseModule"), y, b)), this.options.get("pictureInPictureEnabled") && this.emitter.emit("add picture in picture listener", { element: y.element });
11083
11121
  } else if (this.browser.platform.iosVersion >= 15 && this.options.get("iosMediaElementEnabled")) {
11084
11122
  const y = Hh.create(
11085
11123
  this.emitter,
@@ -11089,10 +11127,10 @@ const Ge = class Ge extends bi {
11089
11127
  {
11090
11128
  type: this.options.get("media") == "audio" ? "audio" : "video",
11091
11129
  muted: this.options.get("muted") || this.options.get("media") === "video",
11092
- poster: x
11130
+ poster: P
11093
11131
  }
11094
11132
  ), E = y.element();
11095
- this.element = E.element, this.playbackSource = y, T = y, this.options.get("pictureInPictureEnabled") && this.browser.platform.iosVersion > 15 && this.emitter.emit("add picture in picture listener", { element: this.element }), this.options.get("pauseSupportEnabled") || (M = No.create(this.logger.createContext("UnpauseModule"), E, b));
11133
+ this.element = E.element, this.playbackSource = y, T = y, this.options.get("pictureInPictureEnabled") && this.browser.platform.iosVersion > 15 && this.emitter.emit("add picture in picture listener", { element: this.element }), this.options.get("pauseSupportEnabled") || (D = No.create(this.logger.createContext("UnpauseModule"), E, b));
11096
11134
  } else {
11097
11135
  const y = zh.create(
11098
11136
  this.emitter,
@@ -11168,8 +11206,8 @@ const Ge = class Ge extends bi {
11168
11206
  subscription: m,
11169
11207
  renditions: p,
11170
11208
  qualityOfService: g,
11171
- mseModule: R,
11172
- unpause: M,
11209
+ mseModule: B,
11210
+ unpause: D,
11173
11211
  canvasModule: T
11174
11212
  }, this.modules.adaptivity.isEnabled = this.options.get("abrEnabled"), this.emitter.on("page active", (y) => {
11175
11213
  var E;
@@ -11202,8 +11240,8 @@ const Ge = class Ge extends bi {
11202
11240
  }), this.emitter.on("recovered from media error", () => {
11203
11241
  this.modules.adaptivity.reset(this.targetBufferTime * 2);
11204
11242
  }), this.emitter.once("connect info", (y) => {
11205
- var W, O, N;
11206
- const L = ((O = (W = y.telemetry) == null ? void 0 : W.probability) != null ? O : 1) >= Math.random();
11243
+ var W, M, N;
11244
+ const L = ((M = (W = y.telemetry) == null ? void 0 : W.probability) != null ? M : 1) >= Math.random();
11207
11245
  y.telemetry && ((N = this.modules.telemetry) == null || N.unload(), this.modules.telemetry = _o.create(
11208
11246
  this.logger.createContext("TelemetryModule"),
11209
11247
  this.emitter,
@@ -11215,12 +11253,12 @@ const Ge = class Ge extends bi {
11215
11253
  }), this.emitter.on("adapt level", (y) => {
11216
11254
  var Fe, Q, he, _e, Be;
11217
11255
  this.logger.debug("adapt level", { direction: y });
11218
- const E = this.modules.renditions.getRenditionLevels(), L = this.modules.renditions.getRenditionLevel(), W = E.findIndex((J) => J === L), O = E.length - 1;
11256
+ const E = this.modules.renditions.getRenditionLevels(), L = this.modules.renditions.getRenditionLevel(), W = E.findIndex((J) => J === L), M = E.length - 1;
11219
11257
  let N = W;
11220
11258
  switch (y) {
11221
11259
  case "upgrade":
11222
11260
  {
11223
- const J = Math.min(W + 1, O), ct = E[J], Jl = (Fe = this.modules.connection.estimatedBandwidth) != null ? Fe : wi(), Kl = ((he = (Q = ct == null ? void 0 : ct.audio) == null ? void 0 : Q.bitRate) != null ? he : 0) + ((Be = (_e = ct == null ? void 0 : ct.video) == null ? void 0 : _e.bitRate) != null ? Be : 0), em = Jl * 2 > Kl;
11261
+ const J = Math.min(W + 1, M), ct = E[J], Jl = (Fe = this.modules.connection.estimatedBandwidth) != null ? Fe : bi(), Kl = ((he = (Q = ct == null ? void 0 : ct.audio) == null ? void 0 : Q.bitRate) != null ? he : 0) + ((Be = (_e = ct == null ? void 0 : ct.video) == null ? void 0 : _e.bitRate) != null ? Be : 0), em = Jl * 2 > Kl;
11224
11262
  ct && em && this.modules.adaptivity.isQoSOk(ct) && (N = J);
11225
11263
  }
11226
11264
  break;
@@ -11247,11 +11285,11 @@ const Ge = class Ge extends bi {
11247
11285
  audio: v(v({}, this.targetSubscription.audio), te == null ? void 0 : te.audio)
11248
11286
  })), this.emitter.emit("adapted level");
11249
11287
  }), this.emitter.on("text track data", (y) => {
11250
- const E = a(this, Oe).find((N) => N.language === y.language), W = this.modules.sync.getTimeshiftOffset() / 1e3, O = W - a(this, ls);
11288
+ const E = a(this, Oe).find((N) => N.language === y.language), W = this.modules.sync.getTimeshiftOffset() / 1e3, M = W - a(this, ls);
11251
11289
  if (l(this, ls, W), E) {
11252
11290
  if (E.cues)
11253
11291
  for (const N of E.cues)
11254
- N.startTime -= O, N.endTime -= O;
11292
+ N.startTime -= M, N.endTime -= M;
11255
11293
  for (const N of y.cues) {
11256
11294
  const te = new VTTCue(N.startTime - W, N.endTime - W, N.text);
11257
11295
  E.addCue(te);
@@ -11265,9 +11303,9 @@ const Ge = class Ge extends bi {
11265
11303
  this.clientIp = E.ip;
11266
11304
  break;
11267
11305
  case "renditions":
11268
- this.updateTextTracks(E.renditions), l(this, ms, this.filterRenditions(E.renditions).then((O) => {
11306
+ this.updateTextTracks(E.renditions), l(this, ms, this.filterRenditions(E.renditions).then((M) => {
11269
11307
  this.emitter.emit("renditions", {
11270
- renditions: O,
11308
+ renditions: M,
11271
11309
  channelId: this.currentSubscription.channelId
11272
11310
  }), this.emit("rendition levels", this.modules.renditions.getRenditionLevels()), this.emitLanguagesIfChanged();
11273
11311
  }).finally(() => {
@@ -11276,12 +11314,12 @@ const Ge = class Ge extends bi {
11276
11314
  break;
11277
11315
  case "subscription changed":
11278
11316
  try {
11279
- nw(E.subscription);
11280
- } catch (O) {
11317
+ aw(E.subscription);
11318
+ } catch (M) {
11281
11319
  this.emitter.emit(
11282
11320
  "error",
11283
- new P("Subscription failed validation", {
11284
- source: O instanceof Error ? O : void 0,
11321
+ new x("Subscription failed validation", {
11322
+ source: M instanceof Error ? M : void 0,
11285
11323
  isFatal: !1,
11286
11324
  code: "subscription_failed_validation"
11287
11325
  })
@@ -11308,16 +11346,16 @@ const Ge = class Ge extends bi {
11308
11346
  Ct(F(v({}, L), { channelId: E.channelId }));
11309
11347
  }), this.emitter.on("received moq data", (y) => {
11310
11348
  var N, te, Fe;
11311
- const E = y.payload.mediaType(), L = y.channelId, W = y.renditionId, O = this.modules.sync.processFragment(L, y.payload);
11349
+ const E = y.payload.mediaType(), L = y.channelId, W = y.renditionId, M = this.modules.sync.processFragment(L, y.payload);
11312
11350
  if (y.switchInfo.channelId && (y.switchInfo.drmTransition && this.emitter.emit("error", Bu("Switching between DRM and non-DRM channels is not supported", !0)), this.encryptedMediaExtensions.onChannelSwitch(), this.emit("rendition levels", this.modules.renditions.getRenditionLevels()), this.modules.event.addEvent({
11313
11351
  type: "channel switch",
11314
11352
  channelId: y.switchInfo.channelId,
11315
- timestamp: O.baseMediaDecodeTime() / O.timescale() * 1e3
11353
+ timestamp: M.baseMediaDecodeTime() / M.timescale() * 1e3
11316
11354
  })), y.switchInfo.language && this.modules.event.addEvent({
11317
11355
  type: "language switch",
11318
11356
  language: y.switchInfo.language,
11319
- timestamp: O.baseMediaDecodeTime() / O.timescale() * 1e3
11320
- }), this.modules.incomingData.add(E, y.payload.rawBytes().byteLength), O.fragment().emsgs.forEach((Q) => {
11357
+ timestamp: M.baseMediaDecodeTime() / M.timescale() * 1e3
11358
+ }), this.modules.incomingData.add(E, y.payload.rawBytes().byteLength), M.fragment().emsgs.forEach((Q) => {
11321
11359
  if (!Q.presentationTime)
11322
11360
  return;
11323
11361
  const he = Bf(Q.data);
@@ -11328,7 +11366,7 @@ const Ge = class Ge extends bi {
11328
11366
  type: "metadata"
11329
11367
  });
11330
11368
  }), this.modules.decoder) {
11331
- const Q = (N = O.header().init().moov.traks[0]) == null ? void 0 : N.mdia.minf.stbl.stsd, he = (te = Q == null ? void 0 : Q.avc1) == null ? void 0 : te.avcC.bytes, _e = (Fe = Q == null ? void 0 : Q.codec) != null ? Fe : "h264";
11369
+ const Q = (N = M.header().init().moov.traks[0]) == null ? void 0 : N.mdia.minf.stbl.stsd, he = (te = Q == null ? void 0 : Q.avc1) == null ? void 0 : te.avcC.bytes, _e = (Fe = Q == null ? void 0 : Q.codec) != null ? Fe : "h264";
11332
11370
  if (he) {
11333
11371
  const Be = he.buffer.slice(he.byteOffset, he.byteOffset + he.byteLength);
11334
11372
  if (E === "text")
@@ -11346,8 +11384,8 @@ const Ge = class Ge extends bi {
11346
11384
  // mediaType !== mimeType - but the sw decoder doesn't care
11347
11385
  });
11348
11386
  }
11349
- for (let Be = 0; Be < O.samplesCount(); Be++) {
11350
- const J = O.sample(Be);
11387
+ for (let Be = 0; Be < M.samplesCount(); Be++) {
11388
+ const J = M.sample(Be);
11351
11389
  J && this.emitter.emit("coded sample", F(v({}, J), {
11352
11390
  renditionId: W,
11353
11391
  channelId: L,
@@ -11355,7 +11393,7 @@ const Ge = class Ge extends bi {
11355
11393
  }));
11356
11394
  }
11357
11395
  } else
11358
- this.emitter.emit("fragment", { mimeType: y.mimeType, codec: y.codec, fragment: O, channelId: L, renditionId: W });
11396
+ this.emitter.emit("fragment", { mimeType: y.mimeType, codec: y.codec, fragment: M, channelId: L, renditionId: W });
11359
11397
  });
11360
11398
  const It = this.options.get("container");
11361
11399
  It && this.attach(It), this.logger.info("Created Vindral instance", { options: this.options });
@@ -11365,9 +11403,9 @@ const Ge = class Ge extends bi {
11365
11403
  const L = this.modules.renditions.getRendition(y.renditionId, E);
11366
11404
  if (!Jp(y.flags)) {
11367
11405
  if (Kp(y.flags)) {
11368
- const O = new TextDecoder().decode(y.payload), N = this.modules.sync.getTimeshiftOffset();
11406
+ const M = new TextDecoder().decode(y.payload), N = this.modules.sync.getTimeshiftOffset();
11369
11407
  if (y.renditionId !== 0) {
11370
- const te = um(O);
11408
+ const te = um(M);
11371
11409
  if (te && te.language !== void 0) {
11372
11410
  const Q = new zu().parse(te.content || ""), he = N / 1e3, _e = a(this, Oe).find((J) => J.language === te.language), Be = he - a(this, ls);
11373
11411
  if (l(this, ls, he), _e) {
@@ -11383,7 +11421,7 @@ const Ge = class Ge extends bi {
11383
11421
  } else
11384
11422
  this.modules.event.addEvent({
11385
11423
  timestamp: y.timestamp / y.timescale * 1e3 - this.modules.sync.getTimeshiftOffset(),
11386
- content: O,
11424
+ content: M,
11387
11425
  type: "metadata"
11388
11426
  });
11389
11427
  } else if (L != null && L.codec) {
@@ -11391,29 +11429,29 @@ const Ge = class Ge extends bi {
11391
11429
  if (W === "text")
11392
11430
  throw new Error("Subtitles are not supported");
11393
11431
  if (this.modules.incomingData.add(W, y.payload.byteLength), Yp(y.flags)) {
11394
- const O = F(v({
11432
+ const M = F(v({
11395
11433
  type: W,
11396
11434
  data: y.payload,
11397
11435
  codec: L.codec
11398
11436
  }, y), {
11399
11437
  channelId: E
11400
- }), N = Hp(O.codec, O.payload);
11401
- N && this.sizes.set(O.renditionId, N);
11402
- const te = Ui({ codec: L.codec, codecString: L.codecString });
11403
- this.emitter.emit("init segment", { initSegment: O, mimeType: te }), this.emit("initialized media");
11438
+ }), N = Hp(M.codec, M.payload);
11439
+ N && this.sizes.set(M.renditionId, N);
11440
+ const te = Pi({ codec: L.codec, codecString: L.codecString });
11441
+ this.emitter.emit("init segment", { initSegment: M, mimeType: te }), this.emit("initialized media");
11404
11442
  } else {
11405
- const O = iw(y, L, this.sizes.get(y.renditionId));
11443
+ const M = nw(y, L, this.sizes.get(y.renditionId));
11406
11444
  let N = this.sampleProcessingSesssions.get(W);
11407
11445
  if (!N)
11408
- N = tw(
11409
- this.modules.sync.processSample(O)
11446
+ N = sw(
11447
+ this.modules.sync.processSample(M)
11410
11448
  ), this.sampleProcessingSesssions.set(W, N);
11411
11449
  else {
11412
11450
  const te = N(
11413
- this.modules.sync.processSample(O),
11414
- this.isSwitchingRenditionLevel && O.type === "video"
11451
+ this.modules.sync.processSample(M),
11452
+ this.isSwitchingRenditionLevel && M.type === "video"
11415
11453
  );
11416
- let Fe = O;
11454
+ let Fe = M;
11417
11455
  te.forEach((Q) => {
11418
11456
  this.modules.event.extractEvent(Q, Fe), this.emitter.emit("coded sample", Q), Fe = Q;
11419
11457
  });
@@ -11558,13 +11596,22 @@ const Ge = class Ge extends bi {
11558
11596
  return this.modules.sync.channelCurrentTime;
11559
11597
  }
11560
11598
  /**
11561
- * The current target buffer time in milliseconds
11599
+ * The current target buffer time in milliseconds.
11600
+ *
11601
+ * Initially, this will always be equal to `minBufferTime`.
11602
+ * Only when using a separate `maxBufferTime`, the `targetBufferTime` will be able to vary between min and max.
11603
+ *
11562
11604
  */
11563
11605
  get targetBufferTime() {
11564
11606
  return this.modules.playback.getTargetBufferTime();
11565
11607
  }
11566
11608
  /**
11567
- * Set the current target buffer time in milliseconds
11609
+ * Set the current target buffer time in milliseconds.
11610
+ *
11611
+ * Note that setting this will not respect min/max buffer time values.
11612
+ * For instance with `{ minBufferTime: 500, maxBufferTime: 3000 }, you can still set `targetBufferTime` to 100 ms.`
11613
+ * The dynamic buffer will still work in respect to the originally set values when needed. Therefore we recommend
11614
+ * setting targetBufferTime within that range for consistancy if using both min/max.
11568
11615
  */
11569
11616
  set targetBufferTime(t) {
11570
11617
  this.modules.playback.getTargetBufferTime() !== t && (this.modules.playback.setTargetBufferTime(t), this.playbackSource.currentTime = this.modules.sync.serverCurrentTime, this.options.get("burstEnabled", this.channelId) ? this.modules.subscription.enableBurst(this.targetBufferTime) : this.modules.subscription.enableBurst(0));
@@ -11681,7 +11728,7 @@ const Ge = class Ge extends bi {
11681
11728
  */
11682
11729
  get maxVideoBitRate() {
11683
11730
  var t, i;
11684
- return (i = (t = this.modules.constraintCap.getCurrentConstraintCap()) == null ? void 0 : t.video.bitRate) != null ? i : wi();
11731
+ return (i = (t = this.modules.constraintCap.getCurrentConstraintCap()) == null ? void 0 : t.video.bitRate) != null ? i : bi();
11685
11732
  }
11686
11733
  /**
11687
11734
  * Set max video bit rate that will be subscribed to
@@ -11698,7 +11745,7 @@ const Ge = class Ge extends bi {
11698
11745
  */
11699
11746
  get maxAudioBitRate() {
11700
11747
  var t, i;
11701
- return (i = (t = this.modules.constraintCap.getCurrentConstraintCap()) == null ? void 0 : t.audio.bitRate) != null ? i : wi();
11748
+ return (i = (t = this.modules.constraintCap.getCurrentConstraintCap()) == null ? void 0 : t.audio.bitRate) != null ? i : bi();
11702
11749
  }
11703
11750
  /**
11704
11751
  * Set max audio bit rate that will be subscribed to
@@ -11839,13 +11886,13 @@ export {
11839
11886
  ge as L,
11840
11887
  Mm as N,
11841
11888
  iu as V,
11842
- cw as a,
11889
+ dw as a,
11843
11890
  Dm as b,
11844
11891
  Lm as c,
11845
11892
  $m as d,
11846
11893
  Om as e,
11847
11894
  xm as f,
11848
- P as g,
11895
+ x as g,
11849
11896
  ym as i,
11850
- D as n
11897
+ O as n
11851
11898
  };