@vindral/web-sdk 3.0.1 → 3.0.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.
package/index.mjs CHANGED
@@ -1,15 +1,15 @@
1
- var ag = Object.defineProperty, Eg = Object.defineProperties;
2
- var rg = Object.getOwnPropertyDescriptors;
1
+ var Eg = Object.defineProperty, rg = Object.defineProperties;
2
+ var hg = Object.getOwnPropertyDescriptors;
3
3
  var yt = Object.getOwnPropertySymbols;
4
- var hg = Object.prototype.hasOwnProperty, cg = Object.prototype.propertyIsEnumerable;
5
- var Le = (i, A, e) => A in i ? ag(i, A, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[A] = e, r = (i, A) => {
4
+ var cg = Object.prototype.hasOwnProperty, dg = Object.prototype.propertyIsEnumerable;
5
+ var Le = (i, A, e) => A in i ? Eg(i, A, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[A] = e, r = (i, A) => {
6
6
  for (var e in A || (A = {}))
7
- hg.call(A, e) && Le(i, e, A[e]);
7
+ cg.call(A, e) && Le(i, e, A[e]);
8
8
  if (yt)
9
9
  for (var e of yt(A))
10
- cg.call(A, e) && Le(i, e, A[e]);
10
+ dg.call(A, e) && Le(i, e, A[e]);
11
11
  return i;
12
- }, b = (i, A) => Eg(i, rg(A));
12
+ }, b = (i, A) => rg(i, hg(A));
13
13
  var t = (i, A, e) => (Le(i, typeof A != "symbol" ? A + "" : A, e), e);
14
14
  var u = (i, A, e) => new Promise((g, I) => {
15
15
  var s = (o) => {
@@ -27,7 +27,7 @@ var u = (i, A, e) => new Promise((g, I) => {
27
27
  }, n = (o) => o.done ? g(o.value) : Promise.resolve(o.value).then(s, B);
28
28
  n((e = e.apply(i, A)).next());
29
29
  });
30
- const dg = (i) => i ? {
30
+ const lg = (i) => i ? {
31
31
  Authorization: `Bearer ${i}`
32
32
  } : void 0;
33
33
  class Rt {
@@ -55,7 +55,7 @@ class Rt {
55
55
  return this._borrowedBuffers;
56
56
  }
57
57
  }
58
- class xi {
58
+ class Wi {
59
59
  constructor(A, e = 0) {
60
60
  t(this, "buffer");
61
61
  t(this, "bytes");
@@ -84,7 +84,7 @@ class xi {
84
84
  this.buffer = A, this.bytes = new Uint8Array(this.buffer), this.bitOffset = e;
85
85
  }
86
86
  }
87
- class lg {
87
+ class ug {
88
88
  constructor(A = 100, e = 100) {
89
89
  t(this, "resizeSteps");
90
90
  t(this, "internalBuffer");
@@ -190,7 +190,7 @@ const WA = (i) => i.reduce((A, e) => A + e, 0) / i.length, fA = (i) => ({
190
190
  average: i.length === 0 ? 0 : WA(i),
191
191
  max: i.length === 0 ? 0 : Math.max(...i),
192
192
  min: i.length === 0 ? 0 : Math.min(...i)
193
- }), ug = (i) => {
193
+ }), wg = (i) => {
194
194
  let A = 0, e = 0, g = 0, I = 0, s = 0;
195
195
  for (let C = 0; C < i.length; C++) {
196
196
  const { x: a, y: Q } = i[C];
@@ -202,7 +202,7 @@ const WA = (i) => i.reduce((A, e) => A + e, 0) / i.length, fA = (i) => ({
202
202
  );
203
203
  return { slope: B, intercept: n, r2: o, predict: (C) => B * (i.length + C) + n };
204
204
  };
205
- class wg {
205
+ class mg {
206
206
  constructor(A = 10) {
207
207
  t(this, "rates");
208
208
  t(this, "_total", 0);
@@ -263,7 +263,7 @@ class O {
263
263
  I ? I.push(s) : this.listeners[A] = [s];
264
264
  }
265
265
  }
266
- const je = 1e3, _e = je * 1e3, Gt = _e * 1e3, ve = (i, A, e) => i % A === 0 ? i / A : (i / A).toFixed(e), mg = (i, A = 1) => i >= Gt ? `${ve(i, Gt, A)} Gbit/s` : i >= _e ? `${ve(i, _e, A)} Mbit/s` : i >= je ? `${ve(i, je, A)} Kbit/s` : `${i} bit/s`, Sg = ({ width: i, height: A }) => `${i}x${A}`, Dg = (i) => i % 1e3 === 0 ? `${i / 1e3} kHz` : i > 1e3 ? `${(i / 1e3).toFixed(1)} kHz` : `${i} Hz`, z = () => {
266
+ const je = 1e3, _e = je * 1e3, Gt = _e * 1e3, ve = (i, A, e) => i % A === 0 ? i / A : (i / A).toFixed(e), Sg = (i, A = 1) => i >= Gt ? `${ve(i, Gt, A)} Gbit/s` : i >= _e ? `${ve(i, _e, A)} Mbit/s` : i >= je ? `${ve(i, je, A)} Kbit/s` : `${i} bit/s`, Dg = ({ width: i, height: A }) => `${i}x${A}`, fg = (i) => i % 1e3 === 0 ? `${i / 1e3} kHz` : i > 1e3 ? `${(i / 1e3).toFixed(1)} kHz` : `${i} Hz`, z = () => {
267
267
  }, kt = (i, A) => {
268
268
  const e = r({}, i);
269
269
  return typeof e != "object" || A.forEach((g) => {
@@ -284,7 +284,7 @@ const je = 1e3, _e = je * 1e3, Gt = _e * 1e3, ve = (i, A, e) => i % A === 0 ? i
284
284
  var n;
285
285
  const s = Math.max(e - A, I.start), B = (n = I.end) != null ? n : e;
286
286
  return Math.max(0, B - s) + g;
287
- }, 0), fg = (i) => {
287
+ }, 0), pg = (i) => {
288
288
  try {
289
289
  return JSON.parse(i);
290
290
  } catch (A) {
@@ -293,14 +293,14 @@ const je = 1e3, _e = je * 1e3, Gt = _e * 1e3, ve = (i, A, e) => i % A === 0 ? i
293
293
  }, bt = () => {
294
294
  const i = [...Array(256).keys()].map((e) => e.toString(16).padStart(2, "0")), A = crypto.getRandomValues(new Uint8Array(16));
295
295
  return A[6] = A[6] & 15 | 64, A[8] = A[8] & 63 | 128, [...A.entries()].map(([e, g]) => [4, 6, 8, 10].includes(e) ? `-${i[g]}` : i[g]).join("");
296
- }, Wi = (i) => u(void 0, null, function* () {
296
+ }, Vi = (i) => u(void 0, null, function* () {
297
297
  return new Promise((A) => setTimeout(A, i));
298
- }), pg = (e, ...g) => u(void 0, [e, ...g], function* (i, A = new Error("Timeout")) {
298
+ }), Fg = (e, ...g) => u(void 0, [e, ...g], function* (i, A = new Error("Timeout")) {
299
299
  return new Promise((I, s) => setTimeout(() => s(A), i));
300
- }), Fg = (i) => typeof i == "object" && i !== null && "message" in i;
301
- class yg extends Error {
300
+ }), yg = (i) => typeof i == "object" && i !== null && "message" in i;
301
+ class Rg extends Error {
302
302
  constructor({ status: e, url: g, body: I }) {
303
- const s = fg(I), B = Fg(s) ? s.message : `Url ${g.toString()}, Status code: ${e}, Body: ${I}`;
303
+ const s = pg(I), B = yg(s) ? s.message : `Url ${g.toString()}, Status code: ${e}, Body: ${I}`;
304
304
  super(B);
305
305
  t(this, "status");
306
306
  t(this, "body");
@@ -308,20 +308,20 @@ class yg extends Error {
308
308
  this.status = e, this.body = I, this.url = g, Object.setPrototypeOf(this, new.target.prototype);
309
309
  }
310
310
  }
311
- const Rg = (i) => typeof i.status == "number", Vi = (i, A) => u(void 0, null, function* () {
311
+ const Gg = (i) => typeof i.status == "number", Zi = (i, A) => u(void 0, null, function* () {
312
312
  const e = yield fetch(i.toString(), r({ mode: "cors" }, A));
313
313
  if (!e.ok)
314
- throw new yg({ status: e.status, url: i, body: yield e.text() });
314
+ throw new Rg({ status: e.status, url: i, body: yield e.text() });
315
315
  return e;
316
316
  }), Ne = (i, A) => u(void 0, null, function* () {
317
- return yield (yield Vi(i, r({}, A))).json();
318
- }), Gg = (i, A) => u(void 0, null, function* () {
319
- return Vi(i, r({ method: "POST" }, A));
317
+ return yield (yield Zi(i, r({}, A))).json();
318
+ }), kg = (i, A) => u(void 0, null, function* () {
319
+ return Zi(i, r({ method: "POST" }, A));
320
320
  }), Jt = {
321
321
  lbConnect: (i) => i.channelGroupId ? `connect/?channelId=${i.channelId}&channelGroupId=${i.channelGroupId}` : `connect/?channelId=${i.channelId}`,
322
322
  thumbnails: (i, A) => A ? i.channelGroupId ? `thumbnail/?channelGroupId=${i.channelGroupId}&auth.token=${A}&auth.type=jwt` : i.channelId ? `thumbnail/?channelId=${i.channelId}&auth.token=${A}&auth.type=jwt` : "thumbnail" : "thumbnail"
323
323
  };
324
- class kg {
324
+ class Ug {
325
325
  constructor(A) {
326
326
  t(this, "baseUrl");
327
327
  t(this, "tokenFactory");
@@ -359,7 +359,7 @@ class kg {
359
359
  }
360
360
  getHeaders(A) {
361
361
  var g;
362
- return (g = dg(A)) != null ? g : {};
362
+ return (g = lg(A)) != null ? g : {};
363
363
  }
364
364
  getAuthToken(A) {
365
365
  return this.tokenFactory ? this.tokenFactory(A) : void 0;
@@ -369,7 +369,7 @@ class kg {
369
369
  }
370
370
  toChannel(A, e, g) {
371
371
  const { baseUrl: I, sizes: s } = A.thumbnail, B = I || new URL(Jt.thumbnails(e, g), this.baseUrl), n = s.map((o) => new URL(
372
- `?channelId=${A.channelId}&width=${o.width}&height=${o.height}${Ug(
372
+ `?channelId=${A.channelId}&width=${o.width}&height=${o.height}${bg(
373
373
  e,
374
374
  g
375
375
  )}`,
@@ -383,8 +383,8 @@ class kg {
383
383
  };
384
384
  }
385
385
  }
386
- const Ug = (i, A) => A ? i.channelGroupId ? `&channelGroupId=${i.channelGroupId}&auth.token=${A}&auth.type=jwt` : `&auth.token=${A}&auth.type=jwt` : "";
387
- class bg extends O {
386
+ const bg = (i, A) => A ? i.channelGroupId ? `&channelGroupId=${i.channelGroupId}&auth.token=${A}&auth.type=jwt` : `&auth.token=${A}&auth.type=jwt` : "";
387
+ class Jg extends O {
388
388
  constructor(e) {
389
389
  super();
390
390
  t(this, "state", "not casting");
@@ -588,7 +588,7 @@ class it {
588
588
  this.options = A;
589
589
  }
590
590
  }
591
- const Jg = {
591
+ const Lg = {
592
592
  sizeBasedResolutionCapEnabled: !0,
593
593
  pictureInPictureEnabled: !0,
594
594
  abrEnabled: !0,
@@ -617,7 +617,7 @@ const Jg = {
617
617
  height: 1280
618
618
  }
619
619
  }
620
- }, Lg = "connection_failed", vg = "connection_failed_will_not_attempt_again", Ng = "authentication_error", Hg = "authentication_expired", Mg = "channel_not_found", Pg = "no_incoming_data_error", qg = "connection_inactivity", Tg = "missing_init_segment", Kg = "no_track_context", Yg = "invalid_track_context_state", xg = "disconnected_by_edge", Wg = "decoder_error", Vg = "audio_player_error", Zg = "media_source_error", Xg = "webgl_context_lost_error";
620
+ }, vg = "connection_failed", Ng = "connection_failed_will_not_attempt_again", Hg = "authentication_error", Mg = "authentication_expired", Pg = "channel_not_found", qg = "no_incoming_data_error", Tg = "connection_inactivity", Kg = "missing_init_segment", Yg = "no_track_context", xg = "invalid_track_context_state", Wg = "disconnected_by_edge", Vg = "decoder_error", Zg = "audio_player_error", Xg = "media_source_error", Og = "webgl_context_lost_error";
621
621
  class p extends Error {
622
622
  constructor(e, g, I = {}) {
623
623
  super(e);
@@ -645,39 +645,43 @@ class p extends Error {
645
645
  this.props = g, this.extra = I, Object.setPrototypeOf(this, new.target.prototype);
646
646
  }
647
647
  }
648
- const Og = (i, A) => new p(
648
+ const zg = (i, A) => new p(
649
649
  "MediaElement Error",
650
650
  { isFatal: i, code: "media_element_error", source: A },
651
651
  { mediaErrorCode: A.code }
652
- ), Zi = (i, A) => new p("Decoder Error", { isFatal: i, code: Wg, source: A, type: "internal" }), Xi = (i, A) => new p("Audio Player Error", { isFatal: i, code: Vg, source: A, type: "internal" }), zg = (i, A) => new p(`No init segment for rendition id ${i} for channel ${A}`, {
652
+ ), Xi = (i, A) => new p("Decoder Error", { isFatal: i, code: Vg, source: A, type: "internal" }), Oi = (i, A) => new p("Audio Player Error", { isFatal: i, code: Zg, source: A, type: "internal" }), jg = (i, A) => new p(`No init segment for rendition id ${i} for channel ${A}`, {
653
653
  isFatal: !1,
654
- code: Tg,
654
+ code: Kg,
655
655
  type: "internal"
656
- }), jg = (i, A) => new p("MediaSource Error", { isFatal: i, code: Zg, source: A, type: "internal" }), Me = (i, A) => new p(`No track context for ${i}${A ? `, rendition id ${A}` : ""}`, {
656
+ }), vt = (i, A, e, g) => new p(
657
+ "MediaSource Error",
658
+ { isFatal: i, code: Xg, source: A, type: "internal" },
659
+ { type: g, consecutiveErrorsCount: e }
660
+ ), Me = (i, A) => new p(`No track context for ${i}${A ? `, rendition id ${A}` : ""}`, {
657
661
  isFatal: !1,
658
- code: Kg,
662
+ code: Yg,
659
663
  type: "internal"
660
664
  }), _g = (i, A) => new p(
661
665
  `Track context is in an invalid state for ${i}${A ? `, rendition id ${A}` : ""}`,
662
666
  {
663
667
  isFatal: !1,
664
- code: Yg,
668
+ code: xg,
665
669
  type: "internal"
666
670
  }
667
671
  ), $g = () => new p("Web Audio Context resume timeout", { isFatal: !1, code: "web_audio_context_resume_timeout" }), bA = (i) => new p("Disconnected From Edge Server", {
668
672
  type: "external",
669
673
  source: i,
670
674
  isFatal: !1,
671
- code: xg
672
- }), de = (i) => new p("Authentication Failed", { isFatal: !0, code: Ng, source: i }), AI = (i) => new p("Authentication Expired", { isFatal: !0, code: Hg, source: i }), eI = (i, A) => new p("Connection closed due to inactivity", { isFatal: !1, code: qg, source: A, type: i }), Oi = (i, A) => new p("Channel not found", { isFatal: !1, code: Mg, source: A, type: i }), tI = (i) => new p("No Incoming Data", { isFatal: !1, code: Pg, source: i }), iI = (i) => new p("Connection attempt failed", {
675
+ code: Wg
676
+ }), de = (i) => new p("Authentication Failed", { isFatal: !0, code: Hg, source: i }), AI = (i) => new p("Authentication Expired", { isFatal: !0, code: Mg, source: i }), eI = (i, A) => new p("Connection closed due to inactivity", { isFatal: !1, code: Tg, source: A, type: i }), zi = (i, A) => new p("Channel not found", { isFatal: !1, code: Pg, source: A, type: i }), tI = (i) => new p("No Incoming Data", { isFatal: !1, code: qg, source: i }), iI = (i) => new p("Connection attempt failed", {
673
677
  isFatal: !1,
674
- code: Lg,
678
+ code: vg,
675
679
  source: i
676
680
  }), gI = () => new p("Connection failed - no more reconnect attempts", {
677
681
  isFatal: !0,
678
- code: vg
679
- }), II = (i) => new p("WebGL Context Lost", { isFatal: !1, code: Xg, source: i, type: "internal" }), vt = (i, A) => i && typeof i == "object" && A in i, zi = (i) => !(typeof i != "object" || !vt(i, "channelId") || typeof i.channelId != "string" || !vt(i, "url") || typeof i.url != "string" || i.channelId.length === 0 || i.url.length === 0), sI = (i) => {
680
- if (!zi(i))
682
+ code: Ng
683
+ }), II = (i) => new p("WebGL Context Lost", { isFatal: !1, code: Og, source: i, type: "internal" }), Nt = (i, A) => i && typeof i == "object" && A in i, ji = (i) => !(typeof i != "object" || !Nt(i, "channelId") || typeof i.channelId != "string" || !Nt(i, "url") || typeof i.url != "string" || i.channelId.length === 0 || i.url.length === 0), sI = (i) => {
684
+ if (!ji(i))
681
685
  throw new p("Invalid options", { isFatal: !0, code: "invalid_options" });
682
686
  const A = r({}, i);
683
687
  return Object.keys(A).forEach((e) => {
@@ -700,7 +704,7 @@ const Og = (i, A) => new p(
700
704
  const A = i.getUint32(0, !1), e = i.getUint8(0) << 16 | i.getUint16(1, !1);
701
705
  let g = 0;
702
706
  return e === 1 ? g += 3 : A === 1 && (g += 4), g;
703
- }, QI = (i) => CI(new DataView(i, 0)) !== 0, Nt = (i, A = 0) => {
707
+ }, QI = (i) => CI(new DataView(i, 0)) !== 0, Ht = (i, A = 0) => {
704
708
  for (let e = A; e < i.byteLength - 4; e++) {
705
709
  const g = i.getUint32(e) === 1, I = (i.getUint8(e) << 16 | i.getUint16(e + 1)) === 1;
706
710
  if (g || I)
@@ -708,14 +712,14 @@ const Og = (i, A) => new p(
708
712
  }
709
713
  }, aI = (i) => i & 31, EI = (i, A) => {
710
714
  const e = new DataView(i, 0);
711
- let g = Nt(e);
715
+ let g = Ht(e);
712
716
  for (; g; ) {
713
- const { position: I, nalPrefixSize: s } = g, B = Nt(e, I + 4), n = B ? B.position - I - s : void 0;
717
+ const { position: I, nalPrefixSize: s } = g, B = Ht(e, I + 4), n = B ? B.position - I - s : void 0;
714
718
  if (!A(new DataView(i, I + s, n), s))
715
719
  return;
716
720
  g = B;
717
721
  }
718
- }, ji = (i) => {
722
+ }, _i = (i) => {
719
723
  const A = [], e = [];
720
724
  if (!QI(i)) {
721
725
  const g = new DataView(i, 0), I = g.getUint8(5) & 31;
@@ -749,7 +753,7 @@ const Og = (i, A) => new p(
749
753
  }), { sequenceParameterSets: A, pictureParameterSets: e };
750
754
  }, rI = (i) => {
751
755
  var w;
752
- const A = new DataView(i), e = A.getUint8(1), g = A.getUint8(2), I = A.getUint8(3), s = new xi(i, 4 * 8);
756
+ const A = new DataView(i), e = A.getUint8(1), g = A.getUint8(2), I = A.getUint8(3), s = new Wi(i, 4 * 8);
753
757
  s.readUnsignedExpGolomb();
754
758
  let B = 1;
755
759
  switch (e) {
@@ -860,7 +864,7 @@ const Og = (i, A) => new p(
860
864
  tfdt: d("tfdt"),
861
865
  trun: d("trun"),
862
866
  mdat: d("mdat")
863
- }, cI = 1e3, xA = d("iso6"), Ht = new Uint8Array([0, 0, 2, 0]), dI = [
867
+ }, cI = 1e3, xA = d("iso6"), Mt = new Uint8Array([0, 0, 2, 0]), dI = [
864
868
  xA,
865
869
  new Uint8Array([105, 115, 111, 109]),
866
870
  new Uint8Array([105, 115, 111, 50]),
@@ -878,9 +882,9 @@ const Og = (i, A) => new p(
878
882
  new Uint8Array([105, 115, 111, 50]),
879
883
  new Uint8Array([109, 112, 52, 49])
880
884
  ];
881
- class _i {
885
+ class $i {
882
886
  constructor() {
883
- t(this, "writer", new lg());
887
+ t(this, "writer", new ug());
884
888
  }
885
889
  }
886
890
  const J = (i, A, e) => {
@@ -891,8 +895,8 @@ const J = (i, A, e) => {
891
895
  J(
892
896
  i,
893
897
  F.ftyp,
894
- xA.byteLength + Ht.byteLength + A.reduce((e, g) => e + g.byteLength, 0)
895
- ), i.writer.writeBytes(xA), i.writer.writeBytes(Ht), A.forEach((e) => i.writer.writeBytes(e));
898
+ xA.byteLength + Mt.byteLength + A.reduce((e, g) => e + g.byteLength, 0)
899
+ ), i.writer.writeBytes(xA), i.writer.writeBytes(Mt), A.forEach((e) => i.writer.writeBytes(e));
896
900
  }, wI = (i, A, e) => {
897
901
  P(i, F.mvhd, 96, 0, 0), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeUint32(e), i.writer.writeUint32(A), i.writer.writeUint32(65536), i.writer.writeUint16(256), i.writer.writeBytes(new Uint8Array([
898
902
  0,
@@ -966,7 +970,7 @@ const J = (i, A, e) => {
966
970
  0,
967
971
  0
968
972
  ])), i.writer.writeUint32(2);
969
- }, $i = (i) => "sequenceParameterSets" in i, $e = (i) => "sequenceHeader" in i, cA = (i) => i.type == "video", NA = (i) => i.type == "audio", mI = (i, A, e) => {
973
+ }, Ag = (i) => "sequenceParameterSets" in i, $e = (i) => "sequenceHeader" in i, cA = (i) => i.type == "video", NA = (i) => i.type == "audio", mI = (i, A, e) => {
970
974
  const g = i.writer.position();
971
975
  P(i, F.tkhd, 0, 0, 3), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeUint32(A.trackId), i.writer.writeUint32(0), i.writer.writeUint32(A.duration * e / A.timescale), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeUint16(0), i.writer.writeUint16(NA(A) ? 1 : 0), i.writer.writeUint16(NA(A) ? 256 : 0), i.writer.writeUint16(0), i.writer.writeBytes(new Uint8Array(
972
976
  [
@@ -1035,7 +1039,7 @@ const J = (i, A, e) => {
1035
1039
  ), i.writer.writeUint8(0), i.writer.writeBytes(A.sequenceHeader), i.writer.writeUint32At(e, i.writer.position() - e);
1036
1040
  }, yI = (i, A) => {
1037
1041
  const e = i.writer.position(), g = $e(A) ? F.av01 : F.avc1;
1038
- J(i, g, 0), i.writer.writeUint32(0), i.writer.writeUint16(0), i.writer.writeUint16(1), i.writer.writeUint16(0), i.writer.writeUint16(0), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeUint16(A.width), i.writer.writeUint16(A.height), i.writer.writeUint32(4718592), i.writer.writeUint32(4718592), i.writer.writeUint32(0), i.writer.writeUint16(1), i.writer.writeUint8(0), i.writer.writeBytes(new Uint8Array(31)), i.writer.writeUint16(24), i.writer.writeUint16(-1), $i(A) ? pI(i, A) : $e(A) && (FI(i, A), A.parsedSequenceHeader.colorConfig && (J(i, d("colr"), 11), i.writer.writeBytes(F.nclx), i.writer.writeUint16(A.parsedSequenceHeader.colorConfig.colorPrimaries), i.writer.writeUint16(A.parsedSequenceHeader.colorConfig.transferCharacteristics), i.writer.writeUint16(A.parsedSequenceHeader.colorConfig.matrixCoefficients), i.writer.writeUint8(A.parsedSequenceHeader.colorConfig.colorRange ? 1 : 0 << 7))), A.pixelAspectRatio && (J(i, d("pasp"), 8), i.writer.writeUint32(A.pixelAspectRatio.numerator), i.writer.writeUint32(A.pixelAspectRatio.denumerator)), A.bitrate && (J(i, d("btrt"), 12), i.writer.writeUint32(0), i.writer.writeUint32(A.bitrate), i.writer.writeUint32(A.bitrate)), i.writer.writeUint32At(e, i.writer.position() - e);
1042
+ J(i, g, 0), i.writer.writeUint32(0), i.writer.writeUint16(0), i.writer.writeUint16(1), i.writer.writeUint16(0), i.writer.writeUint16(0), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeUint16(A.width), i.writer.writeUint16(A.height), i.writer.writeUint32(4718592), i.writer.writeUint32(4718592), i.writer.writeUint32(0), i.writer.writeUint16(1), i.writer.writeUint8(0), i.writer.writeBytes(new Uint8Array(31)), i.writer.writeUint16(24), i.writer.writeUint16(-1), Ag(A) ? pI(i, A) : $e(A) && (FI(i, A), A.parsedSequenceHeader.colorConfig && (J(i, d("colr"), 11), i.writer.writeBytes(F.nclx), i.writer.writeUint16(A.parsedSequenceHeader.colorConfig.colorPrimaries), i.writer.writeUint16(A.parsedSequenceHeader.colorConfig.transferCharacteristics), i.writer.writeUint16(A.parsedSequenceHeader.colorConfig.matrixCoefficients), i.writer.writeUint8(A.parsedSequenceHeader.colorConfig.colorRange ? 1 : 0 << 7))), A.pixelAspectRatio && (J(i, d("pasp"), 8), i.writer.writeUint32(A.pixelAspectRatio.numerator), i.writer.writeUint32(A.pixelAspectRatio.denumerator)), A.bitrate && (J(i, d("btrt"), 12), i.writer.writeUint32(0), i.writer.writeUint32(A.bitrate), i.writer.writeUint32(A.bitrate)), i.writer.writeUint32At(e, i.writer.position() - e);
1039
1043
  }, XA = (i, A, e) => {
1040
1044
  let g = 3;
1041
1045
  for (i.writer.writeUint8(A); g > 0; g--)
@@ -1115,14 +1119,14 @@ const J = (i, A, e) => {
1115
1119
  const g = Math.floor(A.timestamp / 4294967296), I = (A.timestamp & 4294967295) >>> 0;
1116
1120
  i.writer.writeUint32(g), i.writer.writeUint32(I), i.writer.writeUint32At(e, i.writer.position() - e);
1117
1121
  }, xI = (i, A) => {
1118
- const e = A.samples.some((n) => !!n.compositionTimeOffset), g = Mt(A.samples[0]) !== A.defaultFlags;
1122
+ const e = A.samples.some((n) => !!n.compositionTimeOffset), g = Pt(A.samples[0]) !== A.defaultFlags;
1119
1123
  let I = 1;
1120
1124
  g && (I |= 4), e && (I |= 2048);
1121
1125
  const s = i.writer.position();
1122
1126
  P(i, F.trun, 16, 1, I), i.writer.writeUint32(A.samples.length);
1123
1127
  const B = i.writer.position();
1124
- i.writer.writeUint32(0), g && i.writer.writeUint32(Mt(A.samples[0])), e && A.samples.forEach((n) => i.writer.writeUint32(n.compositionTimeOffset || 0)), i.writer.writeUint32At(B, i.writer.position() + 8), i.writer.writeUint32At(s, i.writer.position() - s);
1125
- }, Mt = (i) => i.isSync ? 33554432 : 16842752, WI = (i, A) => {
1128
+ i.writer.writeUint32(0), g && i.writer.writeUint32(Pt(A.samples[0])), e && A.samples.forEach((n) => i.writer.writeUint32(n.compositionTimeOffset || 0)), i.writer.writeUint32At(B, i.writer.position() + 8), i.writer.writeUint32At(s, i.writer.position() - s);
1129
+ }, Pt = (i) => i.isSync ? 33554432 : 16842752, WI = (i, A) => {
1126
1130
  const e = i.writer.position();
1127
1131
  J(i, F.traf, 0), KI(i, A), YI(i, A), xI(i, A), i.writer.writeUint32At(e, i.writer.position() - e);
1128
1132
  }, VI = (i, A) => {
@@ -1133,10 +1137,10 @@ const J = (i, A, e) => {
1133
1137
  }, XI = (i, A) => {
1134
1138
  J(i, F.mdat, A.samples[0].data.length), i.writer.writeBytes(A.samples[0].data);
1135
1139
  }, fe = (i, A) => {
1136
- const e = new _i(), g = i.filter((s) => cA(s) && $i(s)).length > 0;
1140
+ const e = new $i(), g = i.filter((s) => cA(s) && Ag(s)).length > 0;
1137
1141
  return i.filter((s) => cA(s) && $e(s)).length > 0 ? Pe(e, lI) : g ? Pe(e, dI) : Pe(e, uI), TI(e, i, cI, A), e.writer.buffer();
1138
1142
  }, pe = (i) => {
1139
- const A = new _i();
1143
+ const A = new $i();
1140
1144
  if (i.samples.length !== 1)
1141
1145
  throw new Error("Only one sample is supported");
1142
1146
  return ZI(A, i), XI(A, i), A.writer.buffer();
@@ -1165,8 +1169,8 @@ const J = (i, A, e) => {
1165
1169
  duration: 0,
1166
1170
  trackId: 1
1167
1171
  }
1168
- ]), Ag = (i) => {
1169
- const { sequenceParameterSets: A, pictureParameterSets: e } = ji(i), g = A[0], I = e[0];
1172
+ ]), eg = (i) => {
1173
+ const { sequenceParameterSets: A, pictureParameterSets: e } = _i(i), g = A[0], I = e[0];
1170
1174
  if (!g || !I)
1171
1175
  throw new Error("No sps or pps provided");
1172
1176
  return rI(g);
@@ -1186,7 +1190,7 @@ const J = (i, A, e) => {
1186
1190
  }
1187
1191
  ]
1188
1192
  }), _I = (i, A) => {
1189
- const { sequenceParameterSets: e, pictureParameterSets: g } = ji(i), I = Ag(i);
1193
+ const { sequenceParameterSets: e, pictureParameterSets: g } = _i(i), I = eg(i);
1190
1194
  return fe([
1191
1195
  {
1192
1196
  type: "video",
@@ -1224,7 +1228,7 @@ const J = (i, A, e) => {
1224
1228
  duration: g
1225
1229
  }
1226
1230
  ]
1227
- }), es = () => (i) => eg(i.buffered.start(0), i.buffered.end(i.buffered.length - 1)), eg = (i, A) => (e) => e.remove(Math.max(0, i), Math.min(Number.POSITIVE_INFINITY, A)), ts = (i) => (A) => A.appendBuffer(i), is = (i) => (A) => A.changeType(i), gs = (i) => (A) => i(A);
1231
+ }), es = () => (i) => tg(i.buffered.start(0), i.buffered.end(i.buffered.length - 1)), tg = (i, A) => (e) => e.remove(Math.max(0, i), Math.min(Number.POSITIVE_INFINITY, A)), ts = (i) => (A) => A.appendBuffer(i), is = (i) => (A) => A.changeType(i), gs = (i) => (A) => i(A);
1228
1232
  class Is {
1229
1233
  constructor(A) {
1230
1234
  t(this, "commandQueue", []);
@@ -1250,7 +1254,7 @@ class Is {
1250
1254
  this.commandQueue.push(I), this.handleQueue();
1251
1255
  }));
1252
1256
  t(this, "removeBuffer", (A, e) => new Promise((g, I) => {
1253
- const s = new UA(eg(A, e), g, I);
1257
+ const s = new UA(tg(A, e), g, I);
1254
1258
  this.commandQueue.push(s), this.handleQueue();
1255
1259
  }));
1256
1260
  t(this, "flush", () => new Promise((A, e) => {
@@ -1260,7 +1264,7 @@ class Is {
1260
1264
  this.sourceBuffer = A, this.sourceBuffer.addEventListener("updateend", this.handleQueue);
1261
1265
  }
1262
1266
  }
1263
- class tg extends O {
1267
+ class ig extends O {
1264
1268
  constructor() {
1265
1269
  super();
1266
1270
  t(this, "mediaSource", new MediaSource());
@@ -1286,8 +1290,8 @@ class tg extends O {
1286
1290
  this.mediaSource.addEventListener("sourceopen", this.onSourceOpen), this.mediaSource.addEventListener("sourceclose", this.onSourceClosed), this.mediaSource.addEventListener("sourceended", this.onSourceEnded);
1287
1291
  }
1288
1292
  }
1289
- t(tg, "isTypeSupported", (e) => MediaSource.isTypeSupported(e));
1290
- const Pt = (i) => !!(i & 1), ss = (i) => !!(i & 2), Bs = (i) => !!(i & 4), ns = (i) => !!(i & 8), os = (i) => !!(i & 16), Cs = (i) => {
1293
+ t(ig, "isTypeSupported", (e) => MediaSource.isTypeSupported(e));
1294
+ const qt = (i) => !!(i & 1), ss = (i) => !!(i & 2), Bs = (i) => !!(i & 4), ns = (i) => !!(i & 8), os = (i) => !!(i & 16), Cs = (i) => {
1291
1295
  const A = new DataView(i, 0), e = A.getUint8(0), g = A.getUint16(1), I = A.getUint8(3), s = A.getUint8(4), B = Qs(new Uint8Array(i), 5, 12), n = A.getUint32(13), o = os(I) ? A.getUint16(17) : void 0, C = i.slice(g);
1292
1296
  return { version: e, renditionId: s, flags: I, timestamp: B, timescale: n, payload: C, compositionTimeOffset: o };
1293
1297
  }, Qs = (i, A, e) => {
@@ -1299,8 +1303,8 @@ const Pt = (i) => !!(i & 1), ss = (i) => !!(i & 2), Bs = (i) => !!(i & 4), ns =
1299
1303
  } else
1300
1304
  g = g * 256 + i[I];
1301
1305
  return g;
1302
- }, ig = (i) => {
1303
- const A = new xi(i);
1306
+ }, gg = (i) => {
1307
+ const A = new Wi(i);
1304
1308
  return Es(A), ms(A);
1305
1309
  }, as = (i) => {
1306
1310
  let A = 0;
@@ -1330,7 +1334,7 @@ const Pt = (i) => !!(i & 1), ss = (i) => !!(i & 2), Bs = (i) => !!(i & 4), ns =
1330
1334
  numUnitsInDisplayTick: A,
1331
1335
  numTicksPerPicture: I
1332
1336
  };
1333
- }, qt = 2, qe = 2, hs = 1, cs = 2, ds = 2, ls = 13, us = 0, ws = 2, Tt = 0, ms = (i) => {
1337
+ }, Tt = 2, qe = 2, hs = 1, cs = 2, ds = 2, ls = 13, us = 0, ws = 2, Kt = 0, ms = (i) => {
1334
1338
  const A = i.readBits(3), g = i.readBit() !== 0, I = i.readBit() !== 0;
1335
1339
  let s, B = !1, n = !1, o = !1, C = 0, a = 0;
1336
1340
  const Q = [];
@@ -1355,8 +1359,8 @@ const Pt = (i) => !!(i & 1), ss = (i) => !!(i & 2), Bs = (i) => !!(i & 4), ns =
1355
1359
  let S = !1;
1356
1360
  I ? S = !1 : S = i.readBit() !== 0, S && (C = i.readBits(4) + 2, a = i.readBits(3) + 1);
1357
1361
  const q = i.readBit() !== 0, H = i.readBit() !== 0, G = i.readBit() !== 0;
1358
- let K = !1, T = !1, Y = !1, _ = !1, $ = !1, E = !1, m = !1, k = qt, U = qe, v = 0;
1359
- I || (K = i.readBit() !== 0, T = i.readBit() !== 0, Y = i.readBit() !== 0, _ = i.readBit() !== 0, $ = i.readBit() !== 0, $ && (E = i.readBit() !== 0, m = i.readBit() !== 0), i.readBit() !== 0 ? k = qt : k = i.readBit(), k > 0 ? i.readBit() > 0 ? U = qe : U = i.readBit() : U = qe, $ ? v = i.readBits(3) : v = 0);
1362
+ let K = !1, T = !1, Y = !1, _ = !1, $ = !1, E = !1, m = !1, k = Tt, U = qe, v = 0;
1363
+ I || (K = i.readBit() !== 0, T = i.readBit() !== 0, Y = i.readBit() !== 0, _ = i.readBit() !== 0, $ = i.readBit() !== 0, $ && (E = i.readBit() !== 0, m = i.readBit() !== 0), i.readBit() !== 0 ? k = Tt : k = i.readBit(), k > 0 ? i.readBit() > 0 ? U = qe : U = i.readBit() : U = qe, $ ? v = i.readBits(3) : v = 0);
1360
1364
  const N = i.readBit() !== 0, V = i.readBit() !== 0, lA = i.readBit() !== 0;
1361
1365
  return {
1362
1366
  seqProfile: A,
@@ -1403,8 +1407,8 @@ const Pt = (i) => !!(i & 1), ss = (i) => !!(i & 2), Bs = (i) => !!(i & 4), ns =
1403
1407
  let g = 8, I = !1;
1404
1408
  A === 2 && e ? g = i.readBit() !== 0 ? 12 : 10 : A <= 2 && (g = e ? 10 : 8), A === 1 ? I = !1 : I = i.readBit() !== 0;
1405
1409
  const s = I ? 1 : 3, B = i.readBit() !== 0;
1406
- let n = cs, o = ds, C = ws, a = !1, Q = 0, h = 0, l = Tt, w = !1;
1407
- return B && (n = i.readBits(8), o = i.readBits(8), C = i.readBits(8)), I ? (a = i.readBit() !== 0, Q = 1, h = 1, l = Tt, w = !1, {
1410
+ let n = cs, o = ds, C = ws, a = !1, Q = 0, h = 0, l = Kt, w = !1;
1411
+ return B && (n = i.readBits(8), o = i.readBits(8), C = i.readBits(8)), I ? (a = i.readBit() !== 0, Q = 1, h = 1, l = Kt, w = !1, {
1408
1412
  highBitDepth: e,
1409
1413
  bitDepth: g,
1410
1414
  monoChrome: I,
@@ -1445,7 +1449,7 @@ const Pt = (i) => !!(i & 1), ss = (i) => !!(i & 2), Bs = (i) => !!(i & 4), ns =
1445
1449
  transferCharacteristics: o
1446
1450
  });
1447
1451
  }, Ds = (i) => {
1448
- const A = ig(i);
1452
+ const A = gg(i);
1449
1453
  if (A)
1450
1454
  return {
1451
1455
  width: A.maxFrameWidth,
@@ -1467,7 +1471,7 @@ const Pt = (i) => !!(i & 1), ss = (i) => !!(i & 2), Bs = (i) => !!(i & 4), ns =
1467
1471
  }
1468
1472
  ]
1469
1473
  }), ps = (i, A) => {
1470
- const e = ig(i);
1474
+ const e = gg(i);
1471
1475
  if (!e)
1472
1476
  throw new Error("Failed to parse sequence header");
1473
1477
  return fe([
@@ -1498,7 +1502,7 @@ const Pt = (i) => !!(i & 1), ss = (i) => !!(i & 2), Bs = (i) => !!(i & 4), ns =
1498
1502
  }, ys = (i, A) => {
1499
1503
  switch (i) {
1500
1504
  case "h264":
1501
- return Ag(A);
1505
+ return eg(A);
1502
1506
  case "av1":
1503
1507
  return Ds(A);
1504
1508
  }
@@ -1598,13 +1602,13 @@ const vs = (i) => {
1598
1602
  return !1;
1599
1603
  }
1600
1604
  return !1;
1601
- }, qs = () => X.indexOf("CrKey") !== -1, gg = () => navigator.platform === "MacIntel" && navigator.maxTouchPoints === 0, Fe = () => navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, Ts = () => X.indexOf("iphone") >= 0 && X.indexOf("like iphone") < 0 || X.indexOf("ipad") >= 0 && X.indexOf("like ipad") < 0 || X.indexOf("ipod") >= 0 && X.indexOf("like ipod") < 0 || Fe(), Ks = () => Fe() ? !1 : window.MediaSource.isTypeSupported('audio/mp4; codecs="opus"');
1605
+ }, qs = () => X.indexOf("CrKey") !== -1, Ig = () => navigator.platform === "MacIntel" && navigator.maxTouchPoints === 0, Fe = () => navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, Ts = () => X.indexOf("iphone") >= 0 && X.indexOf("like iphone") < 0 || X.indexOf("ipad") >= 0 && X.indexOf("like ipad") < 0 || X.indexOf("ipod") >= 0 && X.indexOf("like ipod") < 0 || Fe(), Ks = () => Fe() ? !1 : window.MediaSource.isTypeSupported('audio/mp4; codecs="opus"');
1602
1606
  function Ys() {
1603
1607
  var i, A;
1604
1608
  if (/(iPhone|iPod|iPad)/i.test(X))
1605
1609
  return (A = (i = X == null ? void 0 : X.match(/OS [\d_]+/i)) == null ? void 0 : i[0]) == null ? void 0 : A.substring(3).split("_").map((e) => parseInt(e))[0];
1606
1610
  }
1607
- const Ig = () => {
1611
+ const sg = () => {
1608
1612
  var e;
1609
1613
  const i = !!window.MediaSource;
1610
1614
  let A = !1;
@@ -1617,7 +1621,7 @@ const Ig = () => {
1617
1621
  platform: {
1618
1622
  iosVersion: (e = Ys()) != null ? e : Number.MAX_SAFE_INTEGER,
1619
1623
  isIpadOS: Fe(),
1620
- isMacOS: gg(),
1624
+ isMacOS: Ig(),
1621
1625
  isIOS: Ts()
1622
1626
  }
1623
1627
  };
@@ -1783,7 +1787,7 @@ class At extends O {
1783
1787
  return this._isPaused;
1784
1788
  }
1785
1789
  }
1786
- const Vs = 0.15, Zs = 0.2, Kt = 0.4, Xs = 0.5, Os = 0.6, Te = 15, zs = {
1790
+ const Vs = 0.15, Zs = 0.2, Yt = 0.4, Xs = 0.5, Os = 0.6, Te = 15, zs = {
1787
1791
  cooldownTime: 3e3,
1788
1792
  maxBufferingEvents: {
1789
1793
  last10Seconds: 0
@@ -1843,7 +1847,7 @@ const Vs = 0.15, Zs = 0.2, Kt = 0.4, Xs = 0.5, Os = 0.6, Te = 15, zs = {
1843
1847
  recentDowngrades: B,
1844
1848
  timeSpentPlayingInAtLeastLevelRatio: o
1845
1849
  }), !1;
1846
- const Q = Math.max(0, I.length - g.length - a), h = this.config.maxDowngradeLookbackMs * Q, l = I.filter(Ke(h)).length;
1850
+ const Q = Math.max(0, I.length - g.length - a), h = Date.now() - this.config.maxDowngradeLookbackMs * Q, l = I.filter(Ke(h)).length;
1847
1851
  return l && Q > this.config.maxCooldownRatio ? (this.logger.debug("Too many downgrades compared to time spent playing", {
1848
1852
  downgradesWithinCooldownTime: l,
1849
1853
  cooldownRatio: Q
@@ -1855,7 +1859,7 @@ const Vs = 0.15, Zs = 0.2, Kt = 0.4, Xs = 0.5, Os = 0.6, Te = 15, zs = {
1855
1859
  const { bufferFullness: e, general: g } = this.qualityOfServiceSource.getMetrics(), I = this.qualityOfServiceSource.getBufferFullnessRegression();
1856
1860
  if (!I)
1857
1861
  return;
1858
- const s = 10 * 1e3, { slope: B } = I, n = I.predict(Te), o = B < 0, C = I.predict(Te) < Kt && I.slope < 0, a = I.predict(Te) > Os, Q = this.qualityOfServiceSource.timeSpentBufferingLast(30 * 1e3), h = this.qualityOfServiceSource.timeSpentActiveLast(30 * 1e3), l = Q / h;
1862
+ const s = 10 * 1e3, { slope: B } = I, n = I.predict(Te), o = B < 0, C = I.predict(Te) < Yt && I.slope < 0, a = I.predict(Te) > Os, Q = this.qualityOfServiceSource.timeSpentBufferingLast(30 * 1e3), h = this.qualityOfServiceSource.timeSpentActiveLast(30 * 1e3), l = Q / h;
1859
1863
  if (e < 0.15 && l > 0.8) {
1860
1864
  this.adaptLevel("reconnect");
1861
1865
  return;
@@ -1864,7 +1868,7 @@ const Vs = 0.15, Zs = 0.2, Kt = 0.4, Xs = 0.5, Os = 0.6, Te = 15, zs = {
1864
1868
  this.adaptLevel("downgrade");
1865
1869
  return;
1866
1870
  }
1867
- C || e < Vs ? o && e < Kt && n < Zs && this.adaptLevel(A.playbackState === "buffering" ? "double downgrade" : "downgrade") : e > Xs && a && !this.tooMuchTimeBuffering(s) && !this.tooManyBufferingEvents(s) && this.adaptLevel("upgrade");
1871
+ C || e < Vs ? o && e < Yt && n < Zs && this.adaptLevel(A.playbackState === "buffering" ? "double downgrade" : "downgrade") : e > Xs && a && !this.tooMuchTimeBuffering(s) && !this.tooManyBufferingEvents(s) && this.adaptLevel("upgrade");
1868
1872
  });
1869
1873
  t(this, "onAdaptedLevel", () => {
1870
1874
  this.reset();
@@ -2007,7 +2011,7 @@ class _s extends O {
2007
2011
  this.emit("error", AI(bA()));
2008
2012
  break;
2009
2013
  case 4003:
2010
- this.emit("error", Oi("internal", bA())), this.connect(!0);
2014
+ this.emit("error", zi("internal", bA())), this.connect(!0);
2011
2015
  break;
2012
2016
  case 4010:
2013
2017
  this.emit("error", eI("internal", bA())), this.connect(!0);
@@ -2025,7 +2029,7 @@ class _s extends O {
2025
2029
  if (this.isSuspended)
2026
2030
  return !1;
2027
2031
  if (this.readyState() !== WebSocket.CLOSED && this.close("new connection in progress"), this.shouldContinueConnecting = !0, this._isConnectInProgress = !0, e && this.options.reconnectDelay > 0) {
2028
- this.logger.info("Waiting for reconnect delay", r({}, this.options)), yield Wi(this.options.reconnectDelay);
2032
+ this.logger.info("Waiting for reconnect delay", r({}, this.options)), yield Vi(this.options.reconnectDelay);
2029
2033
  const g = yield this.options.reconnectHandler(this.reconnectState);
2030
2034
  if (this.reconnectState.reconnectRetries++, !g)
2031
2035
  return this._isConnectInProgress = !1, this.emit("error", gI()), !1;
@@ -2633,7 +2637,7 @@ var tB = function() {
2633
2637
  e.preInit.pop()();
2634
2638
  return eA(), A.ready;
2635
2639
  };
2636
- }(), sg = /* @__PURE__ */ ((i) => (i[i.OK = 0] = "OK", i[i["Bad argument"] = -1] = "Bad argument", i[i["Buffer too small"] = -2] = "Buffer too small", i[i["Internal error"] = -3] = "Internal error", i[i["Invalid packet"] = -4] = "Invalid packet", i[i.Unimplemented = -5] = "Unimplemented", i[i["Invalid state"] = -6] = "Invalid state", i[i["Memory allocation fail"] = -7] = "Memory allocation fail", i))(sg || {});
2640
+ }(), Bg = /* @__PURE__ */ ((i) => (i[i.OK = 0] = "OK", i[i["Bad argument"] = -1] = "Bad argument", i[i["Buffer too small"] = -2] = "Buffer too small", i[i["Internal error"] = -3] = "Internal error", i[i["Invalid packet"] = -4] = "Invalid packet", i[i.Unimplemented = -5] = "Unimplemented", i[i["Invalid state"] = -6] = "Invalid state", i[i["Memory allocation fail"] = -7] = "Memory allocation fail", i))(Bg || {});
2637
2641
  const gA = class {
2638
2642
  constructor(A, e, g) {
2639
2643
  t(this, "opusModule");
@@ -2659,7 +2663,7 @@ const gA = class {
2659
2663
  0
2660
2664
  );
2661
2665
  if (e < 0)
2662
- throw new Error(sg[e]);
2666
+ throw new Error(Bg[e]);
2663
2667
  return this.pcm.subarray(0, e * this.channels);
2664
2668
  });
2665
2669
  this.opusModule = A, this.channels = g, this.sampleRate = e, this.decoderInstance = this.opusModule._opus_decoder_create(e, g, 0), this.opusBufferPointer = this.opusModule._malloc(gA.MAX_OPUS_BUFFER), this.opus = this.opusModule.HEAPU8.subarray(
@@ -2700,7 +2704,7 @@ const me = class {
2700
2704
  }
2701
2705
  }));
2702
2706
  } catch (e) {
2703
- e instanceof Error && this.errors.push(Zi(!1, e));
2707
+ e instanceof Error && this.errors.push(Xi(!1, e));
2704
2708
  }
2705
2709
  });
2706
2710
  t(this, "initSegment", z);
@@ -2783,7 +2787,7 @@ const rA = class {
2783
2787
  var I, s;
2784
2788
  let g;
2785
2789
  for (; (g = (s = (I = e.decoderContext).error) == null ? void 0 : s.call(I)) !== void 0; )
2786
- this.emitter.emit("error", Zi(!1, g));
2790
+ this.emitter.emit("error", Xi(!1, g));
2787
2791
  for (; (A = e.decoderContext.take()) !== void 0; ) {
2788
2792
  const { statistics: B } = A;
2789
2793
  B && (e.decodeTime.push(B.decodeTime), e.transportTime.push(
@@ -2965,7 +2969,7 @@ const hA = class {
2965
2969
  });
2966
2970
  t(this, "add", (A, e) => {
2967
2971
  let g = this.bytesReceived.get(A);
2968
- g || (g = new wg(20), this.bytesReceived.set(A, g)), e > 0 && (this.lastBytesUpdated = Date.now(), this.timeoutInterval || (this.timeoutInterval = this.timers.setInterval(
2972
+ g || (g = new mg(20), this.bytesReceived.set(A, g)), e > 0 && (this.lastBytesUpdated = Date.now(), this.timeoutInterval || (this.timeoutInterval = this.timers.setInterval(
2969
2973
  this.checkTimeout,
2970
2974
  hA.UPDATE_RECEIVED_BYTES_INTERVAL
2971
2975
  ))), g.add(e);
@@ -3012,7 +3016,7 @@ const gB = window.AudioContext || window.webkitAudioContext, Qt = class extends
3012
3016
  t(this, "getMediaStreamDestination", () => (this.mediaStreamDestination || (this.mediaStreamDestination = this.context.createMediaStreamDestination()), this.mediaStreamDestination));
3013
3017
  t(this, "getDefaultDestination", () => this.context.destination);
3014
3018
  t(this, "resume", () => u(this, null, function* () {
3015
- yield Promise.race([this.context.resume(), pg(1e3, $g())]);
3019
+ yield Promise.race([this.context.resume(), Fg(1e3, $g())]);
3016
3020
  }));
3017
3021
  t(this, "suspend", () => u(this, null, function* () {
3018
3022
  var e;
@@ -3200,7 +3204,7 @@ const at = class extends O {
3200
3204
  };
3201
3205
  let HA = at;
3202
3206
  t(HA, "create", (e, g, I) => new at(e, g, I));
3203
- const Yt = `
3207
+ const xt = `
3204
3208
  precision mediump float;
3205
3209
  uniform sampler2D y_texture;
3206
3210
  uniform sampler2D u_texture;
@@ -3216,7 +3220,7 @@ void main() {
3216
3220
 
3217
3221
  gl_FragColor = vec4(y, u, v, 1) * conversion;
3218
3222
  }
3219
- `, xt = `
3223
+ `, Wt = `
3220
3224
  attribute vec2 position;
3221
3225
  varying vec2 texture_coordinate;
3222
3226
  uniform mat4 model;
@@ -3225,7 +3229,7 @@ void main() {
3225
3229
  texture_coordinate = position;
3226
3230
  gl_Position = model * vec4(position, 0.0, 1.0);
3227
3231
  }
3228
- `, Wt = (i, A) => {
3232
+ `, Vt = (i, A) => {
3229
3233
  let e = i.getContext("webgl", A);
3230
3234
  if (e || (e = i.getContext("experimental-webgl", A)), !e)
3231
3235
  throw new p("Failed to create webgl context", {
@@ -3253,7 +3257,7 @@ void main() {
3253
3257
  code: "failed_to_create_texture"
3254
3258
  });
3255
3259
  return i.bindTexture(i.TEXTURE_2D, A), i.texParameteri(i.TEXTURE_2D, i.TEXTURE_MAG_FILTER, i.NEAREST), i.texParameteri(i.TEXTURE_2D, i.TEXTURE_MIN_FILTER, i.NEAREST), i.texParameteri(i.TEXTURE_2D, i.TEXTURE_WRAP_S, i.CLAMP_TO_EDGE), i.texParameteri(i.TEXTURE_2D, i.TEXTURE_WRAP_T, i.CLAMP_TO_EDGE), A;
3256
- }, Vt = (i, A) => {
3260
+ }, Zt = (i, A) => {
3257
3261
  const e = i.createBuffer();
3258
3262
  if (!e)
3259
3263
  throw new p("Failed to create buffer", {
@@ -3261,7 +3265,7 @@ void main() {
3261
3265
  code: "failed_to_create_buffer"
3262
3266
  });
3263
3267
  return i.bindBuffer(i.ARRAY_BUFFER, e), i.bufferData(i.ARRAY_BUFFER, A.buffer, i.STATIC_DRAW), e;
3264
- }, Zt = (i, A, e) => {
3268
+ }, Xt = (i, A, e) => {
3265
3269
  const g = i.createProgram();
3266
3270
  if (!g)
3267
3271
  throw new p("Failed to create program", {
@@ -3281,7 +3285,7 @@ void main() {
3281
3285
  codedWidth: 256,
3282
3286
  height: 144,
3283
3287
  codedHeight: 144
3284
- }, Xt = {
3288
+ }, Ot = {
3285
3289
  preserveDrawingBuffer: !1,
3286
3290
  alpha: !1,
3287
3291
  depth: !1,
@@ -3292,11 +3296,11 @@ void main() {
3292
3296
  constructor() {
3293
3297
  super();
3294
3298
  t(this, "canvas", document.createElement("canvas"));
3295
- t(this, "context", Wt(this.canvas, Xt));
3296
- t(this, "pixelShader", zA(this.context, this.context.FRAGMENT_SHADER, Yt));
3297
- t(this, "vertexShader", zA(this.context, this.context.VERTEX_SHADER, xt));
3298
- t(this, "buffer", Vt(this.context, Se.SQUARE_VERTICES));
3299
- t(this, "program", Zt(this.context, this.vertexShader, this.pixelShader));
3299
+ t(this, "context", Vt(this.canvas, Ot));
3300
+ t(this, "pixelShader", zA(this.context, this.context.FRAGMENT_SHADER, xt));
3301
+ t(this, "vertexShader", zA(this.context, this.context.VERTEX_SHADER, Wt));
3302
+ t(this, "buffer", Zt(this.context, Se.SQUARE_VERTICES));
3303
+ t(this, "program", Xt(this.context, this.vertexShader, this.pixelShader));
3300
3304
  t(this, "textures", {
3301
3305
  y: DA(this.context),
3302
3306
  u: DA(this.context),
@@ -3308,7 +3312,7 @@ void main() {
3308
3312
  this.emit("context lost", II(g)), e.preventDefault();
3309
3313
  });
3310
3314
  t(this, "onContextRestored", () => {
3311
- this.emit("context restored"), this.context = Wt(this.canvas, Xt), this.pixelShader = zA(this.context, this.context.FRAGMENT_SHADER, Yt), this.vertexShader = zA(this.context, this.context.VERTEX_SHADER, xt), this.buffer = Vt(this.context, Se.SQUARE_VERTICES), this.program = Zt(this.context, this.vertexShader, this.pixelShader), this.textures = {
3315
+ this.emit("context restored"), this.context = Vt(this.canvas, Ot), this.pixelShader = zA(this.context, this.context.FRAGMENT_SHADER, xt), this.vertexShader = zA(this.context, this.context.VERTEX_SHADER, Wt), this.buffer = Zt(this.context, Se.SQUARE_VERTICES), this.program = Xt(this.context, this.vertexShader, this.pixelShader), this.textures = {
3312
3316
  y: DA(this.context),
3313
3317
  u: DA(this.context),
3314
3318
  v: DA(this.context)
@@ -3521,7 +3525,7 @@ const rt = class {
3521
3525
  try {
3522
3526
  this.audioPlayer.onDecodedFrame(A);
3523
3527
  } catch (e) {
3524
- e instanceof Error && this.emitter.emit("error", Xi(!1, e));
3528
+ e instanceof Error && this.emitter.emit("error", Oi(!1, e));
3525
3529
  }
3526
3530
  this.videoPlayer.onDecodedFrame(A);
3527
3531
  });
@@ -3590,7 +3594,7 @@ const rt = class {
3590
3594
  };
3591
3595
  let se = rt;
3592
3596
  t(se, "create", (A, e, g, I, s) => new rt(A, e, g, I, s));
3593
- const Ot = Object.values(De), zt = (i, A) => Ot.indexOf(i) < Ot.indexOf(A), ht = class {
3597
+ const zt = Object.values(De), jt = (i, A) => zt.indexOf(i) < zt.indexOf(A), ht = class {
3594
3598
  constructor() {
3595
3599
  t(this, "level", De.DEBUG);
3596
3600
  t(this, "categoryLevels", /* @__PURE__ */ new Map());
@@ -3604,10 +3608,10 @@ const Ot = Object.values(De), zt = (i, A) => Ot.indexOf(i) < Ot.indexOf(A), ht =
3604
3608
  t(this, "unload", () => {
3605
3609
  });
3606
3610
  t(this, "onLog", (A, e, g, I) => {
3607
- if (zt(e, this.level))
3611
+ if (jt(e, this.level))
3608
3612
  return;
3609
3613
  const s = A.category(), B = this.categoryLevels.get(s);
3610
- if (B && zt(e, B))
3614
+ if (B && jt(e, B))
3611
3615
  return;
3612
3616
  const n = A.getFullCategory().reduceRight((C, a) => (C.length ? C + " > " : "") + a, ""), o = `[${new Date().toISOString()}][${e}][${n}] ${g}`;
3613
3617
  console.log(o, I);
@@ -3651,7 +3655,7 @@ const ct = class {
3651
3655
  try {
3652
3656
  this.audioPlayer.onDecodedFrame(A);
3653
3657
  } catch (e) {
3654
- e instanceof Error && this.emitter.emit("error", Xi(!1, e));
3658
+ e instanceof Error && this.emitter.emit("error", Oi(!1, e));
3655
3659
  }
3656
3660
  this.videoPlayer.onDecodedFrame(A);
3657
3661
  });
@@ -3736,7 +3740,7 @@ const ct = class {
3736
3740
  };
3737
3741
  let ne = ct;
3738
3742
  t(ne, "create", (A, e, g, I, s) => new ct(A, e, g, I, s));
3739
- class Bg {
3743
+ class ng {
3740
3744
  constructor() {
3741
3745
  t(this, "initSegments", /* @__PURE__ */ new Map());
3742
3746
  t(this, "set", (A, e, g) => {
@@ -3759,27 +3763,30 @@ function sB(i, { mediaSource: A, mimeType: e }) {
3759
3763
  sequenceNumber: 0
3760
3764
  });
3761
3765
  }
3762
- function jt({
3766
+ function _t({
3763
3767
  initSegments: i,
3764
3768
  pendingSamples: A
3765
3769
  }) {
3766
3770
  return {
3767
3771
  state: "uninitialized",
3768
- initSegments: i != null ? i : new Bg(),
3772
+ initSegments: i != null ? i : new ng(),
3769
3773
  sequenceNumber: 0,
3770
3774
  isWorkingOnPendingSamples: !1,
3771
3775
  hasFirstSync: !!A,
3772
- pendingSamples: A != null ? A : []
3776
+ pendingSamples: A != null ? A : [],
3777
+ consecutiveQuotaExceededErrorCount: 0,
3778
+ successfulAppendCalls: 0
3773
3779
  };
3774
3780
  }
3775
3781
  const dt = class {
3776
3782
  constructor(A, e, g) {
3777
3783
  t(this, "maxChunkSize", 20);
3784
+ t(this, "minConsecutiveErrorsBeforeEmit", 5);
3778
3785
  t(this, "logger");
3779
3786
  t(this, "timers", x.create());
3780
3787
  t(this, "emitter");
3781
3788
  t(this, "mediaElement");
3782
- t(this, "mediaSource", new tg());
3789
+ t(this, "mediaSource", new ig());
3783
3790
  t(this, "trackContexts", /* @__PURE__ */ new Map());
3784
3791
  t(this, "autoRecoverFromMediaErrors", !0);
3785
3792
  t(this, "quotaErrorCount", 0);
@@ -3795,14 +3802,16 @@ const dt = class {
3795
3802
  this.logger.debug("Unloading module..."), this.emitter.off("init segment", this.init), this.emitter.off("coded sample", this.onCodedSample), this.emitter.off("flush buffers", this.flushBuffers), this.mediaSource.off("source ended", this.onSourceEnded), this.mediaSource.off("source open", this.onSourceOpen), this.trackContexts.forEach((A) => A.pendingSamples = []), this.timers.unload(), this.logger.debug("Unloaded module");
3796
3803
  });
3797
3804
  t(this, "getStatistics", () => {
3798
- var e, g;
3805
+ var e, g, I, s;
3799
3806
  const A = {
3800
3807
  quotaErrorCount: this.quotaErrorCount,
3801
- mediaSourceOpenTime: this.sourceOpenEndTime - this.sourceOpenStartTime
3808
+ mediaSourceOpenTime: this.sourceOpenEndTime - this.sourceOpenStartTime,
3809
+ successfulAudioAppendsCalls: (e = this.trackContexts.get("audio")) == null ? void 0 : e.successfulAppendCalls,
3810
+ successfulVideoAppendCalls: (g = this.trackContexts.get("video")) == null ? void 0 : g.successfulAppendCalls
3802
3811
  };
3803
3812
  if (this.mediaElement instanceof HTMLVideoElement) {
3804
- const I = (g = (e = this.mediaElement).getVideoPlaybackQuality) == null ? void 0 : g.call(e);
3805
- A.totalVideoFrames = I == null ? void 0 : I.totalVideoFrames, A.droppedVideoFrames = I == null ? void 0 : I.droppedVideoFrames;
3813
+ const B = (s = (I = this.mediaElement).getVideoPlaybackQuality) == null ? void 0 : s.call(I);
3814
+ A.totalVideoFrames = B == null ? void 0 : B.totalVideoFrames, A.droppedVideoFrames = B == null ? void 0 : B.droppedVideoFrames;
3806
3815
  }
3807
3816
  return A;
3808
3817
  });
@@ -3822,7 +3831,7 @@ const dt = class {
3822
3831
  const s = (o = (n = A.get(I)) == null ? void 0 : n.pendingSamples) != null ? o : [], B = (C = A.get(I)) == null ? void 0 : C.initSegments;
3823
3832
  for (; s.length > 0 && !((a = s[0]) != null && a.isSync); )
3824
3833
  s.shift();
3825
- this.trackContexts.set(I, jt({ pendingSamples: s, initSegments: B }));
3834
+ this.trackContexts.set(I, _t({ pendingSamples: s, initSegments: B }));
3826
3835
  });
3827
3836
  }));
3828
3837
  t(this, "setSourceBuffers", (A) => u(this, null, function* () {
@@ -3844,7 +3853,7 @@ const dt = class {
3844
3853
  }
3845
3854
  for (const g of A) {
3846
3855
  let I = this.trackContexts.get(g.type);
3847
- I || (I = jt({ pendingSamples: [], initSegments: new Bg() }), this.trackContexts.set(g.type, I)), I.state === "initialized" ? g.mimeType !== I.mimeType && (yield I.sourceBuffer.changeType(g.mimeType)) : this.trackContexts.set(
3856
+ I || (I = _t({ pendingSamples: [], initSegments: new ng() }), this.trackContexts.set(g.type, I)), I.state === "initialized" ? g.mimeType !== I.mimeType && (yield I.sourceBuffer.changeType(g.mimeType)) : this.trackContexts.set(
3848
3857
  g.type,
3849
3858
  sB(I, { mimeType: g.mimeType, mediaSource: this.mediaSource })
3850
3859
  );
@@ -3880,7 +3889,7 @@ const dt = class {
3880
3889
  const I = this.trackContexts.get(g.type), s = I == null ? void 0 : I.initSegments.get(g.channelId, g.renditionId);
3881
3890
  if (!this.mediaSource.isClosed()) {
3882
3891
  if (!s)
3883
- throw zg(g.renditionId, g.channelId);
3892
+ throw jg(g.renditionId, g.channelId);
3884
3893
  if (!I)
3885
3894
  throw Me(g.type, g.renditionId);
3886
3895
  if (I.state === "uninitialized")
@@ -3892,9 +3901,9 @@ const dt = class {
3892
3901
  try {
3893
3902
  let n = I.sequenceNumber;
3894
3903
  const o = BB(A.map((C) => bs(C, n++)));
3895
- yield I.sourceBuffer.appendBuffer(o), I.sequenceNumber = n;
3904
+ yield I.sourceBuffer.appendBuffer(o), I.sequenceNumber = n, I.consecutiveQuotaExceededErrorCount = 0, I.successfulAppendCalls++;
3896
3905
  } catch (n) {
3897
- throw n instanceof DOMException && (n.code === DOMException.QUOTA_EXCEEDED_ERR ? (this.quotaErrorCount++, this.logger.error("quota exceeded error", { error: n }), I.pendingSamples.unshift(...A)) : this.mediaElement.error && I.pendingSamples.unshift(...A)), n;
3906
+ throw n instanceof DOMException && (n.code === DOMException.QUOTA_EXCEEDED_ERR ? (this.quotaErrorCount++, I.consecutiveQuotaExceededErrorCount++, this.logger.error("quota exceeded error", { error: n }), I.pendingSamples.unshift(...A)) : this.mediaElement.error && I.pendingSamples.unshift(...A)), n;
3898
3907
  }
3899
3908
  }
3900
3909
  }));
@@ -3911,7 +3920,18 @@ const dt = class {
3911
3920
  g.timestamp = 0, e.pendingSamples.push(g);
3912
3921
  }
3913
3922
  e.hasFirstSync = !0, e.pendingSamples.push(A), e.state !== "uninitialized" && (e.isWorkingOnPendingSamples || nB(e, this.append, this.maxChunkSize).catch((g) => {
3914
- e.isWorkingOnPendingSamples = !1, g instanceof Error && (this.logger.error("append failed", { message: g.message, name: g.name }), this.emitter.emit("error", jg(!1, g)), this.mediaElement.error && this.onSourceEnded());
3923
+ if (e.isWorkingOnPendingSamples = !1, g instanceof Error) {
3924
+ if (this.logger.error("append failed", { message: g.message, name: g.name }), g instanceof DOMException && g.code === DOMException.QUOTA_EXCEEDED_ERR) {
3925
+ if (e.consecutiveQuotaExceededErrorCount >= this.minConsecutiveErrorsBeforeEmit) {
3926
+ const I = vt(!1, g, e.consecutiveQuotaExceededErrorCount, A.type);
3927
+ this.emitter.emit("error", I);
3928
+ }
3929
+ } else {
3930
+ const I = vt(!1, g, e.consecutiveQuotaExceededErrorCount, A.type);
3931
+ this.emitter.emit("error", I);
3932
+ }
3933
+ this.mediaElement.error && this.onSourceEnded();
3934
+ }
3915
3935
  }));
3916
3936
  }
3917
3937
  });
@@ -3921,7 +3941,7 @@ const dt = class {
3921
3941
  t(this, "onSourceEnded", () => {
3922
3942
  const { error: A } = this.mediaElement;
3923
3943
  if (A) {
3924
- const e = /AUDIO_RENDERER/.test(A.message) || !this.autoRecoverFromMediaErrors, g = Og(e, A);
3944
+ const e = /AUDIO_RENDERER/.test(A.message) || !this.autoRecoverFromMediaErrors, g = zg(e, A);
3925
3945
  if (this.logger.error("MediaElement error", { error: g }), this.emitter.emit("error", g), !g.isFatal()) {
3926
3946
  this.logger.info("Re-opening MediaSource"), this.emitter.emit("recovered from media error", { error: g, count: this.recoveredFromErrorCount }), this.recoveredFromErrorCount++;
3927
3947
  const I = !this.mediaElement.paused, s = [];
@@ -3940,7 +3960,7 @@ t(oe, "create", (A, e, g) => {
3940
3960
  const I = new dt(A, e, g);
3941
3961
  return I.setTrackContexts(), I.mediaSource.on("source ended", I.onSourceEnded), I.mediaSource.on("source open", I.onSourceOpen), g.src = I.mediaSource.createObjectURL(), I;
3942
3962
  });
3943
- const _t = (i, A) => {
3963
+ const $t = (i, A) => {
3944
3964
  var B;
3945
3965
  const e = i.renditionId !== A.renditionId, g = i.channelId !== A.channelId, I = ((B = i.timestamp) != null ? B : 0) > A.timestamp;
3946
3966
  let s = !1;
@@ -3958,13 +3978,13 @@ const _t = (i, A) => {
3958
3978
  for (let n = 0; n < i.pendingSamples.length; n++) {
3959
3979
  I = n;
3960
3980
  const o = i.pendingSamples[n], C = i.pendingSamples[n + 1];
3961
- if (o && (g.push(o), C && _t(o, C)) || n === e - 1)
3981
+ if (o && (g.push(o), C && $t(o, C)) || n === e - 1)
3962
3982
  break;
3963
3983
  }
3964
3984
  const s = g[0];
3965
3985
  if (!s)
3966
3986
  break;
3967
- const B = i.previousSample ? _t(i.previousSample, s) : !0;
3987
+ const B = i.previousSample ? $t(i.previousSample, s) : !0;
3968
3988
  yield A(g, B), i.pendingSamples = i.pendingSamples.slice(I + 1), i.previousSample = g[g.length - 1];
3969
3989
  }
3970
3990
  i.isWorkingOnPendingSamples = !1;
@@ -4187,7 +4207,7 @@ const tt = () => ({
4187
4207
  const e = this.metrics.levels[(g = this.currentLevel) != null ? g : 0];
4188
4208
  e && (e.decodeRate = A);
4189
4209
  });
4190
- t(this, "calculateLinearRegression", () => ug(
4210
+ t(this, "calculateLinearRegression", () => wg(
4191
4211
  this.bufferFullness.items().map((A, e) => ({
4192
4212
  x: e,
4193
4213
  y: A
@@ -4326,7 +4346,7 @@ const mt = class {
4326
4346
  };
4327
4347
  let Ee = mt;
4328
4348
  t(Ee, "create", (A, e) => new mt(A, e));
4329
- const $t = (i) => JSON.parse(JSON.stringify(i)), St = class {
4349
+ const Ai = (i) => JSON.parse(JSON.stringify(i)), St = class {
4330
4350
  constructor(A, e, g) {
4331
4351
  t(this, "logger");
4332
4352
  t(this, "timers", new x());
@@ -4383,7 +4403,7 @@ const $t = (i) => JSON.parse(JSON.stringify(i)), St = class {
4383
4403
  this.logger.debug("onSubscriptionChanged", { to: A }), this.currentSubscription = r({}, A), this._isSwitchingSubscription = this.isNewSubscription();
4384
4404
  });
4385
4405
  t(this, "scheduleSubscriptionChange", () => {
4386
- this.targetSubscription = $t(this.targetSubscription), this._isSwitchingSubscription = this.isNewSubscription();
4406
+ this.targetSubscription = Ai(this.targetSubscription), this._isSwitchingSubscription = this.isNewSubscription();
4387
4407
  const A = this.currentSubscription.channelId !== this.targetSubscription.channelId;
4388
4408
  this._isSwitchingSubscription && (A && this.burstMs ? this.setBurst(this.burstMs) : this.setBurst(0), this.pendingSubscriptionTimeoutId && (this.timers.clearTimeout(this.pendingSubscriptionTimeoutId), this.pendingSubscriptionTimeoutId = void 0), this.pendingSubscriptionTimeoutId = this.timers.setTimeout(
4389
4409
  () => this.emitter.emit(
@@ -4396,12 +4416,12 @@ const $t = (i) => JSON.parse(JSON.stringify(i)), St = class {
4396
4416
  0
4397
4417
  ));
4398
4418
  });
4399
- this.logger = A, this.targetSubscription = e, this.currentSubscription = $t(e), this.emitter = g, this.emitter.on("subscription changed", this.onSubscriptionChanged);
4419
+ this.logger = A, this.targetSubscription = e, this.currentSubscription = Ai(e), this.emitter = g, this.emitter.on("subscription changed", this.onSubscriptionChanged);
4400
4420
  }
4401
4421
  };
4402
4422
  let re = St;
4403
4423
  t(re, "create", (A, e, g) => new St(A, g, e));
4404
- const CB = 5e3, QB = () => gg() || Fe() || qs(), Ai = () => QB() ? 100 : 0, Dt = class {
4424
+ const CB = 5e3, QB = () => Ig() || Fe() || qs(), ei = () => QB() ? 100 : 0, Dt = class {
4405
4425
  constructor(A, e, g, I, s) {
4406
4426
  t(this, "emitter");
4407
4427
  t(this, "logger");
@@ -4422,8 +4442,8 @@ const CB = 5e3, QB = () => gg() || Fe() || qs(), Ai = () => QB() ? 100 : 0, Dt =
4422
4442
  maxBehind: 50,
4423
4443
  multiplier: 1,
4424
4444
  maxBehindAllowed: 600,
4425
- overshoot: Ai(),
4426
- minOvershootAllowed: Ai(),
4445
+ overshoot: ei(),
4446
+ minOvershootAllowed: ei(),
4427
4447
  maxOvershootAllowed: 500
4428
4448
  });
4429
4449
  t(this, "maxTimeSyncDifferenceTolerance", 150);
@@ -4682,7 +4702,7 @@ const aB = {
4682
4702
  type: "telemetry",
4683
4703
  body: e
4684
4704
  })
4685
- ) : yield Gg(new URL(this.options.url), { body: e, headers: { "Content-Type": "text/plain" } });
4705
+ ) : yield kg(new URL(this.options.url), { body: e, headers: { "Content-Type": "text/plain" } });
4686
4706
  break;
4687
4707
  }
4688
4708
  this.retries = 0, this.unsentLines.clear();
@@ -4773,7 +4793,7 @@ const cB = (i, A) => {
4773
4793
  }, dB = (i, A, e) => YA(A) ? r(b(r({}, i), {
4774
4794
  type: "video",
4775
4795
  codec: A.codec,
4776
- isSync: Pt(i.flags),
4796
+ isSync: qt(i.flags),
4777
4797
  data: i.payload,
4778
4798
  duration: 0,
4779
4799
  width: A.width,
@@ -4784,7 +4804,7 @@ const cB = (i, A) => {
4784
4804
  sampleRate: A.sampleRate,
4785
4805
  codec: A.codec,
4786
4806
  language: A.language,
4787
- isSync: Pt(i.flags),
4807
+ isSync: qt(i.flags),
4788
4808
  data: i.payload,
4789
4809
  duration: 0
4790
4810
  }), lB = () => {
@@ -4810,7 +4830,7 @@ const cB = (i, A) => {
4810
4830
  constructor(e) {
4811
4831
  super();
4812
4832
  t(this, "pictureInPicture");
4813
- t(this, "browser", Ig());
4833
+ t(this, "browser", sg());
4814
4834
  t(this, "options");
4815
4835
  t(this, "element");
4816
4836
  t(this, "playbackSource");
@@ -4879,7 +4899,7 @@ const cB = (i, A) => {
4879
4899
  try {
4880
4900
  return yield this.apiClient.connect(this.options.getOptions());
4881
4901
  } catch (e) {
4882
- if (Rg(e))
4902
+ if (Gg(e))
4883
4903
  switch (e.status) {
4884
4904
  case 401:
4885
4905
  throw this.emitter.emit("error", de(e)), de(e);
@@ -4890,7 +4910,7 @@ const cB = (i, A) => {
4890
4910
  t(this, "estimateRTT", () => u(this, null, function* () {
4891
4911
  const e = Date.now(), g = () => Date.now() - e;
4892
4912
  return Promise.race([
4893
- Wi(IA.PING_TIMEOUT),
4913
+ Vi(IA.PING_TIMEOUT),
4894
4914
  fetch(new URL("/api/v2/connect/ping", this.options.get("url")).toString(), {
4895
4915
  method: "HEAD"
4896
4916
  })
@@ -4903,7 +4923,7 @@ const cB = (i, A) => {
4903
4923
  if (this.emitter.emit("connect info", g), this._channels = g.channels, g.channels.forEach((S) => {
4904
4924
  S.overrides && this.options.addOverrides(S.channelId, S.overrides), S.renditions = this.filterRenditions(S.renditions), this.modules.renditions.setRenditions(S.channelId, S.renditions);
4905
4925
  }), !n)
4906
- throw Oi("external");
4926
+ throw zi("external");
4907
4927
  const o = this.options.getOverride("minBufferTime", this.channelId), C = this.options.getOverride("maxBufferTime", this.channelId);
4908
4928
  if ((o || C) && (this.modules.bufferTime.updateConfig({
4909
4929
  minBufferTime: o,
@@ -5046,7 +5066,7 @@ const cB = (i, A) => {
5046
5066
  const e = this.modules.canvasModule ? this.options.get("iosMediaElementEnabled") : void 0;
5047
5067
  return r({
5048
5068
  uptime: Date.now() - this.createdAt,
5049
- version: "3.0.1",
5069
+ version: "3.0.3",
5050
5070
  clientId: this.clientId,
5051
5071
  sessionId: this.sessionId,
5052
5072
  channelId: this.channelId,
@@ -5080,7 +5100,7 @@ const cB = (i, A) => {
5080
5100
  return e - g;
5081
5101
  });
5082
5102
  t(this, "willUseMediaSource", () => this.browser.supportsMediaSource && this.options.get("mseEnabled"));
5083
- this.options = new hB(r(r({}, Jg), sI(e)));
5103
+ this.options = new hB(r(r({}, Lg), sI(e)));
5084
5104
  const g = ["localhost", "127.0.0.1"];
5085
5105
  e.telemetryEnabled === void 0 && g.includes(location.hostname) && this.options.set("telemetryEnabled", !1);
5086
5106
  const I = {
@@ -5100,7 +5120,7 @@ const cB = (i, A) => {
5100
5120
  this.emitter,
5101
5121
  this.logger.getLogger("PictureInPictureModule")
5102
5122
  ), n = x.create();
5103
- this.apiClient = new kg({
5123
+ this.apiClient = new Ug({
5104
5124
  publicEndpoint: this.options.get("url").toString(),
5105
5125
  tokenFactory: () => this.options.get("authenticationToken")
5106
5126
  });
@@ -5571,7 +5591,7 @@ const cB = (i, A) => {
5571
5591
  };
5572
5592
  let EA = IA;
5573
5593
  t(EA, "MAX_POOL_SIZE", 10), t(EA, "INITIAL_MAX_BIT_RATE", 2.5 * 1e3 * 1e3), t(EA, "PING_TIMEOUT", 1e3), t(EA, "DISCONNECT_TIMEOUT", 15 * 1e3);
5574
- const wB = "_bar_1o8iy_1", mB = "_hidden_1o8iy_30", ng = {
5594
+ const wB = "_bar_1o8iy_1", mB = "_hidden_1o8iy_30", og = {
5575
5595
  bar: wB,
5576
5596
  hidden: mB
5577
5597
  }, SB = "_withThumbnails_4pb7p_19", ye = {
@@ -5634,7 +5654,7 @@ const DB = {
5634
5654
  }, LB = {
5635
5655
  viewBox: "-8 -8 40 40",
5636
5656
  content: '<path fill="white" d="M14.4 6L14 4H5v17h2v-7h5.6l.4 2h7V6z"/>'
5637
- }, ei = {
5657
+ }, ti = {
5638
5658
  enter: GB,
5639
5659
  exit: kB,
5640
5660
  pip: UB,
@@ -5647,13 +5667,13 @@ const DB = {
5647
5667
  pause: pB,
5648
5668
  play: FB
5649
5669
  };
5650
- var si;
5651
- const vB = (si = DB["icon-button"]) != null ? si : "";
5670
+ var Bi;
5671
+ const vB = (Bi = DB["icon-button"]) != null ? Bi : "";
5652
5672
  class RA extends j {
5653
5673
  constructor(e, g) {
5654
5674
  super(document.createElementNS("http://www.w3.org/2000/svg", "svg"));
5655
5675
  t(this, "setIcon", (e) => {
5656
- this.element.setAttribute("viewBox", ei[e].viewBox), this.element.innerHTML = ei[e].content;
5676
+ this.element.setAttribute("viewBox", ti[e].viewBox), this.element.innerHTML = ti[e].content;
5657
5677
  });
5658
5678
  t(this, "isHidden", () => this.element.style.display === "none");
5659
5679
  t(this, "setHidden", (e) => e ? this.hide() : this.show());
@@ -5668,14 +5688,14 @@ const NB = "_list_oecdq_1", HB = "_hidden_oecdq_19", Re = {
5668
5688
  "list-item-disabled": "_list-item-disabled_oecdq_15",
5669
5689
  hidden: HB
5670
5690
  };
5671
- var Bi;
5672
- const ti = (Bi = Re.hidden) != null ? Bi : "";
5673
5691
  var ni;
5674
- const MB = (ni = Re.list) != null ? ni : "";
5692
+ const ii = (ni = Re.hidden) != null ? ni : "";
5675
5693
  var oi;
5676
- const PB = (oi = Re["list-item"]) != null ? oi : "";
5694
+ const MB = (oi = Re.list) != null ? oi : "";
5677
5695
  var Ci;
5678
- const qB = (Ci = Re["list-item-disabled"]) != null ? Ci : "";
5696
+ const PB = (Ci = Re["list-item"]) != null ? Ci : "";
5697
+ var Qi;
5698
+ const qB = (Qi = Re["list-item-disabled"]) != null ? Qi : "";
5679
5699
  class TB extends j {
5680
5700
  constructor({ items: e, onItemClick: g, classNames: I = [], maxHeight: s }) {
5681
5701
  super(document.createElement("div"));
@@ -5691,8 +5711,8 @@ class TB extends j {
5691
5711
  })
5692
5712
  );
5693
5713
  });
5694
- t(this, "hide", () => this.element.classList.add(ti));
5695
- t(this, "show", () => this.element.classList.remove(ti));
5714
+ t(this, "hide", () => this.element.classList.add(ii));
5715
+ t(this, "show", () => this.element.classList.remove(ii));
5696
5716
  this.element.className = [MB, ...I].join(" "), this.onItemClick = g, this.updateItems(e), s && (this.element.style.maxHeight = s);
5697
5717
  }
5698
5718
  }
@@ -5701,12 +5721,12 @@ const KB = "_container_13xnz_1", YB = "_hidden_13xnz_6", xB = "_list_13xnz_10",
5701
5721
  hidden: YB,
5702
5722
  list: xB
5703
5723
  };
5704
- var Qi;
5705
- const WB = (Qi = gt.list) != null ? Qi : "";
5706
5724
  var ai;
5707
- const jA = (ai = gt.hidden) != null ? ai : "";
5725
+ const WB = (ai = gt.list) != null ? ai : "";
5708
5726
  var Ei;
5709
- const VB = (Ei = gt.container) != null ? Ei : "";
5727
+ const jA = (Ei = gt.hidden) != null ? Ei : "";
5728
+ var ri;
5729
+ const VB = (ri = gt.container) != null ? ri : "";
5710
5730
  class It extends j {
5711
5731
  constructor({ items: e, onItemClick: g, iconButtonType: I, onToggle: s }) {
5712
5732
  super(document.createElement("div"));
@@ -5751,14 +5771,14 @@ class It extends j {
5751
5771
  this.element.className = VB, this.onItemClick = g, this.onToggle = s, this.items = e, this.iconButton = new RA(I, this.onButtonClick), this.iconButton.attach(this.element);
5752
5772
  }
5753
5773
  }
5754
- var ri;
5755
- const ZB = (ri = ye["channel-selection-item"]) != null ? ri : "";
5756
5774
  var hi;
5757
- const XB = (hi = ye["channel-selection-item-selected"]) != null ? hi : "";
5775
+ const ZB = (hi = ye["channel-selection-item"]) != null ? hi : "";
5758
5776
  var ci;
5759
- const OB = (ci = ye["channel-selection-item-image"]) != null ? ci : "";
5777
+ const XB = (ci = ye["channel-selection-item-selected"]) != null ? ci : "";
5760
5778
  var di;
5761
- const zB = (di = ye.withThumbnails) != null ? di : "";
5779
+ const OB = (di = ye["channel-selection-item-image"]) != null ? di : "";
5780
+ var li;
5781
+ const zB = (li = ye.withThumbnails) != null ? li : "";
5762
5782
  class jB extends It {
5763
5783
  constructor({ vindral: A, enabled: e, thumbnailsEnabled: g, thumbnailModule: I }) {
5764
5784
  const s = () => {
@@ -5781,21 +5801,21 @@ class jB extends It {
5781
5801
  return C;
5782
5802
  }
5783
5803
  }));
5784
- this.maxHeight = `calc(${A.mediaElement.clientHeight}px - 46px)`, this.updateItems(n), n.length > 1 && e != !1 ? this.show() : this.hide();
5804
+ this.maxHeight = `calc(${Math.max(110, A.mediaElement.clientHeight)}px - 46px)`, this.updateItems(n), n.length > 1 && e != !1 ? this.show() : this.hide();
5785
5805
  };
5786
5806
  A.on("channels", s);
5787
5807
  const B = (n) => A.channelId = n.channel.channelId;
5788
5808
  super({ items: [], onItemClick: B, onToggle: z, iconButtonType: "channels" }), this.hide();
5789
5809
  }
5790
5810
  }
5791
- const og = {
5811
+ const Cg = {
5792
5812
  "language-button-item": "_language-button-item_1dov5_1",
5793
5813
  "language-button-item-selected": "_language-button-item-selected_1dov5_6"
5794
5814
  };
5795
- var li;
5796
- const _B = (li = og["language-button-item"]) != null ? li : "";
5797
5815
  var ui;
5798
- const $B = (ui = og["language-button-item-selected"]) != null ? ui : "";
5816
+ const _B = (ui = Cg["language-button-item"]) != null ? ui : "";
5817
+ var wi;
5818
+ const $B = (wi = Cg["language-button-item-selected"]) != null ? wi : "";
5799
5819
  class An extends It {
5800
5820
  constructor({ vindral: A }) {
5801
5821
  const e = () => {
@@ -5810,7 +5830,7 @@ class An extends It {
5810
5830
  ].join(" "), B.innerHTML = s, B;
5811
5831
  }
5812
5832
  }));
5813
- this.maxHeight = `calc(${A.mediaElement.clientHeight}px - 46px)`, this.updateItems(I), I.length > 0 ? this.show() : this.hide();
5833
+ this.maxHeight = `calc(${Math.max(110, A.mediaElement.clientHeight)}px - 46px)`, this.updateItems(I), I.length > 0 ? this.show() : this.hide();
5814
5834
  };
5815
5835
  A.on("languages", e);
5816
5836
  const g = (I) => A.language = I.language;
@@ -5838,14 +5858,14 @@ const tn = "_item_1lmjh_1", gn = "_title_1lmjh_10", Ge = {
5838
5858
  title: gn,
5839
5859
  "sub-title": "_sub-title_1lmjh_14"
5840
5860
  };
5841
- var wi;
5842
- const In = (wi = Ge.item) != null ? wi : "";
5843
5861
  var mi;
5844
- const sn = (mi = Ge["item-selected"]) != null ? mi : "";
5862
+ const In = (mi = Ge.item) != null ? mi : "";
5845
5863
  var Si;
5846
- const Bn = (Si = Ge.title) != null ? Si : "";
5864
+ const sn = (Si = Ge["item-selected"]) != null ? Si : "";
5847
5865
  var Di;
5848
- const nn = (Di = Ge["sub-title"]) != null ? Di : "";
5866
+ const Bn = (Di = Ge.title) != null ? Di : "";
5867
+ var fi;
5868
+ const nn = (fi = Ge["sub-title"]) != null ? fi : "";
5849
5869
  class on extends It {
5850
5870
  constructor({ vindral: A }) {
5851
5871
  const e = () => {
@@ -5856,11 +5876,11 @@ class on extends It {
5856
5876
  var w, D, S;
5857
5877
  const B = document.createElement("div");
5858
5878
  B.className = [In, s === A.currentRenditionLevel ? sn : ""].join(" ");
5859
- const n = document.createElement("span"), o = document.createElement("span"), { audio: C, video: a } = s, Q = a ? Sg(a) : void 0, h = C ? Dg(C.sampleRate) : void 0, l = mg(((w = a == null ? void 0 : a.bitRate) != null ? w : 0) + ((D = C == null ? void 0 : C.bitRate) != null ? D : 0));
5879
+ const n = document.createElement("span"), o = document.createElement("span"), { audio: C, video: a } = s, Q = a ? Dg(a) : void 0, h = C ? fg(C.sampleRate) : void 0, l = Sg(((w = a == null ? void 0 : a.bitRate) != null ? w : 0) + ((D = C == null ? void 0 : C.bitRate) != null ? D : 0));
5860
5880
  return n.innerHTML = (S = Q != null ? Q : h) != null ? S : "", n.className = Bn, o.innerHTML = l, o.className = nn, B.append(n, o), B;
5861
5881
  }
5862
5882
  }));
5863
- this.maxHeight = `calc(${A.mediaElement.clientHeight}px - 46px)`, this.updateItems(I);
5883
+ this.maxHeight = `calc(${Math.max(110, A.mediaElement.clientHeight)}px - 46px)`, this.updateItems(I);
5864
5884
  };
5865
5885
  A.on("rendition level", e), A.on("rendition levels", e);
5866
5886
  const g = ({ rendition: I }) => {
@@ -5889,10 +5909,10 @@ class Qn extends j {
5889
5909
  this.element.style.cursor = "pointer", this.vindral = e, this.muteButton = new RA(this.muteIcon(), this.onMuteClick), this.muteButton.attach(this.element);
5890
5910
  }
5891
5911
  }
5892
- var fi;
5893
- const _A = (fi = ng.hidden) != null ? fi : "";
5894
5912
  var pi;
5895
- const an = (pi = ng.bar) != null ? pi : "";
5913
+ const _A = (pi = og.hidden) != null ? pi : "";
5914
+ var Fi;
5915
+ const an = (Fi = og.bar) != null ? Fi : "";
5896
5916
  class En extends j {
5897
5917
  constructor({
5898
5918
  vindral: e,
@@ -5961,15 +5981,15 @@ const rn = "_buffering_1ccif_1", hn = "_hidden_1ccif_25", cn = "_scaleout_1ccif_
5961
5981
  "buffering-indicator": "_buffering-indicator_1ccif_31",
5962
5982
  scaleout: cn
5963
5983
  };
5964
- var Fi;
5965
- const Ve = (Fi = ke.hidden) != null ? Fi : "";
5966
5984
  var yi;
5967
- const dn = (yi = ke.buffering) != null ? yi : "";
5985
+ const Ve = (yi = ke.hidden) != null ? yi : "";
5968
5986
  var Ri;
5969
- const ii = (Ri = ke["buffering-fullscreen"]) != null ? Ri : "";
5987
+ const dn = (Ri = ke.buffering) != null ? Ri : "";
5970
5988
  var Gi;
5971
- const ln = (Gi = ke["buffering-indicator"]) != null ? Gi : "";
5972
- class Cg extends j {
5989
+ const gi = (Gi = ke["buffering-fullscreen"]) != null ? Gi : "";
5990
+ var ki;
5991
+ const ln = (ki = ke["buffering-indicator"]) != null ? ki : "";
5992
+ class Qg extends j {
5973
5993
  constructor() {
5974
5994
  super(document.createElement("div"));
5975
5995
  t(this, "indicator", document.createElement("div"));
@@ -5978,7 +5998,7 @@ class Cg extends j {
5978
5998
  t(this, "hide", () => this.element.classList.add(Ve));
5979
5999
  t(this, "show", () => this.element.classList.remove(Ve));
5980
6000
  t(this, "fullscreen", (e) => {
5981
- e ? this.element.classList.add(ii) : this.element.classList.remove(ii);
6001
+ e ? this.element.classList.add(gi) : this.element.classList.remove(gi);
5982
6002
  });
5983
6003
  this.element.className = dn, this.indicator.className = ln, this.element.append(this.indicator);
5984
6004
  }
@@ -5992,16 +6012,16 @@ const un = "_button_137xm_21", wn = "_image_137xm_96", mn = "_overlay_137xm_116"
5992
6012
  hidden: Dn,
5993
6013
  disabled: fn
5994
6014
  };
5995
- var ki;
5996
- const pn = (ki = VA.button) != null ? ki : "";
5997
6015
  var Ui;
5998
- const Ze = (Ui = VA.hidden) != null ? Ui : "";
6016
+ const pn = (Ui = VA.button) != null ? Ui : "";
5999
6017
  var bi;
6000
- const Fn = (bi = VA.overlay) != null ? bi : "";
6018
+ const Ze = (bi = VA.hidden) != null ? bi : "";
6001
6019
  var Ji;
6002
- const gi = (Ji = VA.image) != null ? Ji : "";
6020
+ const Fn = (Ji = VA.overlay) != null ? Ji : "";
6003
6021
  var Li;
6004
- const Ii = (Li = VA.selected) != null ? Li : "";
6022
+ const Ii = (Li = VA.image) != null ? Li : "";
6023
+ var vi;
6024
+ const si = (vi = VA.selected) != null ? vi : "";
6005
6025
  class yn extends j {
6006
6026
  constructor({ title: e, onClick: g, imageUrl: I, selected: s }) {
6007
6027
  super(document.createElement("button"));
@@ -6014,7 +6034,7 @@ class yn extends j {
6014
6034
  g.style.backgroundImage = `url(${I})`, g.style.opacity = "1", e.style.opacity = "0";
6015
6035
  });
6016
6036
  t(this, "setSelected", (e) => {
6017
- e ? this.element.classList.add(Ii) : this.element.classList.remove(Ii);
6037
+ e ? this.element.classList.add(si) : this.element.classList.remove(si);
6018
6038
  });
6019
6039
  t(this, "setAnimationDelay", (e) => {
6020
6040
  this.element.style.animationDelay = e;
@@ -6028,7 +6048,7 @@ class yn extends j {
6028
6048
  t(this, "show", () => this.element.classList.remove(Ze));
6029
6049
  this.element.className = pn, s && this.setSelected(s), this.element.onclick = () => {
6030
6050
  this.loadingOverlay.show(), g();
6031
- }, this.imageHolder1 = document.createElement("div"), this.imageHolder1.className = gi, this.imageHolder1.style.animationFillMode = "forwards", this.imageHolder2 = document.createElement("div"), this.imageHolder2.className = gi, this.imageHolder2.style.animationFillMode = "forwards", I && (this.imageHolder1.style.backgroundImage = `url(${I})`, this.isImageHolder1Active = !0), this.loadingOverlay = new Cg(), this.loadingOverlay.attach(this.element), this.loadingOverlay.hide(), this.element.append(this.imageHolder1), this.element.append(this.imageHolder2), this.overlay = document.createElement("div"), this.overlay.className = Fn, this.element.append(this.overlay);
6051
+ }, this.imageHolder1 = document.createElement("div"), this.imageHolder1.className = Ii, this.imageHolder1.style.animationFillMode = "forwards", this.imageHolder2 = document.createElement("div"), this.imageHolder2.className = Ii, this.imageHolder2.style.animationFillMode = "forwards", I && (this.imageHolder1.style.backgroundImage = `url(${I})`, this.isImageHolder1Active = !0), this.loadingOverlay = new Qg(), this.loadingOverlay.attach(this.element), this.loadingOverlay.hide(), this.element.append(this.imageHolder1), this.element.append(this.imageHolder2), this.overlay = document.createElement("div"), this.overlay.className = Fn, this.element.append(this.overlay);
6032
6052
  const B = document.createElement("span");
6033
6053
  B.innerHTML = e, this.element.append(B), this.show();
6034
6054
  }
@@ -6042,16 +6062,16 @@ class yn extends j {
6042
6062
  }
6043
6063
  }
6044
6064
  }
6045
- const Rn = "_container_btpgd_13", Gn = "_hidden_btpgd_37", kn = "_disabled_btpgd_41", Qg = {
6065
+ const Rn = "_container_btpgd_13", Gn = "_hidden_btpgd_37", kn = "_disabled_btpgd_41", ag = {
6046
6066
  "channel-selection-overlay": "_channel-selection-overlay_btpgd_1",
6047
6067
  container: Rn,
6048
6068
  hidden: Gn,
6049
6069
  disabled: kn
6050
6070
  };
6051
- var vi;
6052
- const Xe = (vi = Qg.hidden) != null ? vi : "";
6053
6071
  var Ni;
6054
- const Un = (Ni = Qg.container) != null ? Ni : "";
6072
+ const Xe = (Ni = ag.hidden) != null ? Ni : "";
6073
+ var Hi;
6074
+ const Un = (Hi = ag.container) != null ? Hi : "";
6055
6075
  class bn extends j {
6056
6076
  constructor({ vindral: e, thumbnailModule: g }) {
6057
6077
  var I;
@@ -6105,8 +6125,8 @@ class bn extends j {
6105
6125
  const Jn = "_fullscreen_1v9d8_1", Ln = {
6106
6126
  fullscreen: Jn
6107
6127
  };
6108
- var Hi;
6109
- const Oe = (Hi = Ln.fullscreen) != null ? Hi : "", KA = class extends O {
6128
+ var Mi;
6129
+ const Oe = (Mi = Ln.fullscreen) != null ? Mi : "", KA = class extends O {
6110
6130
  constructor(e) {
6111
6131
  super();
6112
6132
  t(this, "container");
@@ -6147,12 +6167,12 @@ const vn = "_player_1jt4y_1", st = {
6147
6167
  hidden: Hn,
6148
6168
  "playoverlay-indicator": "_playoverlay-indicator_1hl5t_23"
6149
6169
  };
6150
- var Mi;
6151
- const $A = (Mi = Bt.hidden) != null ? Mi : "";
6152
6170
  var Pi;
6153
- const Mn = (Pi = Bt.playoverlay) != null ? Pi : "";
6171
+ const $A = (Pi = Bt.hidden) != null ? Pi : "";
6154
6172
  var qi;
6155
- const Pn = (qi = Bt["playoverlay-indicator"]) != null ? qi : "";
6173
+ const Mn = (qi = Bt.playoverlay) != null ? qi : "";
6174
+ var Ti;
6175
+ const Pn = (Ti = Bt["playoverlay-indicator"]) != null ? Ti : "";
6156
6176
  class qn extends j {
6157
6177
  constructor() {
6158
6178
  super(document.createElement("div"));
@@ -6215,12 +6235,12 @@ class Tn extends O {
6215
6235
  });
6216
6236
  }
6217
6237
  }
6218
- var Ti;
6219
- const Kn = (Ti = st.player) != null ? Ti : "";
6220
6238
  var Ki;
6221
- const ze = (Ki = st["one-to-one"]) != null ? Ki : "";
6239
+ const Kn = (Ki = st.player) != null ? Ki : "";
6222
6240
  var Yi;
6223
- const Yn = (Yi = st["audio-only"]) != null ? Yi : "", xn = {
6241
+ const ze = (Yi = st["one-to-one"]) != null ? Yi : "";
6242
+ var xi;
6243
+ const Yn = (xi = st["audio-only"]) != null ? xi : "", xn = {
6224
6244
  controlsEnabled: !0,
6225
6245
  castEnabled: !0,
6226
6246
  channelSelectionEnabled: !0,
@@ -6230,7 +6250,7 @@ const Yn = (Yi = st["audio-only"]) != null ? Yi : "", xn = {
6230
6250
  iosWakeLockEnabled: !0,
6231
6251
  hideTimeout: 2e3,
6232
6252
  pauseButtonEnabled: !0
6233
- }, Wn = (i) => !zi(i);
6253
+ }, Wn = (i) => !ji(i);
6234
6254
  class Zn {
6235
6255
  constructor(A, e) {
6236
6256
  t(this, "core");
@@ -6238,13 +6258,13 @@ class Zn {
6238
6258
  t(this, "options");
6239
6259
  t(this, "state");
6240
6260
  t(this, "playerElement", document.createElement("div"));
6241
- t(this, "bufferingOverlay", new Cg());
6261
+ t(this, "bufferingOverlay", new Qg());
6242
6262
  t(this, "playOverlay", new qn());
6243
6263
  t(this, "channelSelectionList");
6244
6264
  t(this, "bar");
6245
6265
  t(this, "stateInterval");
6246
6266
  t(this, "thumbnailModule");
6247
- t(this, "browser", Ig());
6267
+ t(this, "browser", sg());
6248
6268
  t(this, "unload", () => {
6249
6269
  var A;
6250
6270
  this.stateInterval && window.clearInterval(this.stateInterval), this.core.unload(), this.playerElement.remove(), (A = this.thumbnailModule) == null || A.stop();
@@ -6289,14 +6309,14 @@ class Zn {
6289
6309
  t(this, "exitFullscreen", () => (this.bar.fullscreenButton.setIcon("enter"), this.unlockOrientation(), this.state.fullscreen.exit()));
6290
6310
  t(this, "lockOrientation", () => {
6291
6311
  var e, g;
6292
- if (!("orientation" in screen))
6312
+ if (!("orientation" in screen) || !screen.orientation.lock)
6293
6313
  return;
6294
6314
  const A = this.core.currentRenditionLevel;
6295
6315
  A != null && A.video && screen.orientation.lock(((e = A == null ? void 0 : A.video) == null ? void 0 : e.width) > ((g = A == null ? void 0 : A.video) == null ? void 0 : g.height) ? "landscape-primary" : "portrait-primary").catch(() => {
6296
6316
  });
6297
6317
  });
6298
6318
  t(this, "unlockOrientation", () => {
6299
- "orientation" in screen && screen.orientation.unlock();
6319
+ !("orientation" in screen) || !screen.orientation.unlock || screen.orientation.unlock();
6300
6320
  });
6301
6321
  t(this, "checkState", () => {
6302
6322
  this.bar.hasFocus() || this.state.lastInteractionTime && this.state.lastInteractionTime <= Date.now() - this.options.hideTimeout && this.core.media !== "audio" && this.core.playbackState !== "paused" && this.bar.hide();
@@ -6329,13 +6349,14 @@ class Zn {
6329
6349
  channelSelectionEnabled: s,
6330
6350
  channelSelectionThumbnails: B,
6331
6351
  fullscreenButtonEnabled: this.core.media !== "audio" && (e == null ? void 0 : e.fullscreenButtonEnabled) && this.state.fullscreen.isSupported(),
6352
+ oneToOneButtonEnabled: this.core.media !== "audio" && (e == null ? void 0 : e.oneToOneButtonEnabled),
6332
6353
  pipButtonEnabled: (e == null ? void 0 : e.pipButtonEnabled) && this.core.pictureInPicture.isSupported(),
6333
6354
  onFullscreenClicked: () => this.toggleFullscreen(),
6334
6355
  onOneToOneClicked: () => this.toggleOneToOne(),
6335
6356
  onPipClicked: () => this.togglePip()
6336
6357
  })), this.core.media === "audio" && (this.playerElement.classList.add(Yn), this.options.controlsEnabled && this.bar.show());
6337
6358
  const n = this.core.getCastOptions();
6338
- this.castSender = new bg({
6359
+ this.castSender = new Jg({
6339
6360
  background: this.options.castBackground,
6340
6361
  receiverApplicationId: this.options.castReceiverApplicationId,
6341
6362
  options: n
@@ -6370,17 +6391,17 @@ class Zn {
6370
6391
  }
6371
6392
  }
6372
6393
  export {
6373
- Hg as AUTHENTICATION_EXPIRED_CODE,
6374
- Ng as AUTHENTICATION_FAILED_CODE,
6375
- kg as ApiClient,
6376
- Mg as CHANNEL_NOT_FOUND_CODE,
6377
- vg as CONNECTION_FAILED_AFTER_RETRIES_CODE,
6378
- Lg as CONNECTION_FAILED_CODE,
6379
- bg as CastSender,
6380
- xg as DISCONNECTED_BY_EDGE,
6381
- qg as INACTIVITY_CODE,
6394
+ Mg as AUTHENTICATION_EXPIRED_CODE,
6395
+ Hg as AUTHENTICATION_FAILED_CODE,
6396
+ Ug as ApiClient,
6397
+ Pg as CHANNEL_NOT_FOUND_CODE,
6398
+ Ng as CONNECTION_FAILED_AFTER_RETRIES_CODE,
6399
+ vg as CONNECTION_FAILED_CODE,
6400
+ Jg as CastSender,
6401
+ Wg as DISCONNECTED_BY_EDGE,
6402
+ Tg as INACTIVITY_CODE,
6382
6403
  De as Level,
6383
- Pg as NO_INCOMING_DATA,
6404
+ qg as NO_INCOMING_DATA,
6384
6405
  Zn as Player,
6385
6406
  EA as Vindral,
6386
6407
  p as VindralError