@vindral/web-sdk 4.0.0-109-gc46e6fa9 → 4.0.0-110-ge5c8e532

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.
@@ -1,20 +1,20 @@
1
- var Sn = Object.defineProperty, vn = Object.defineProperties;
2
- var bn = Object.getOwnPropertyDescriptors;
3
- var rs = Object.getOwnPropertySymbols;
4
- var yn = Object.prototype.hasOwnProperty, En = Object.prototype.propertyIsEnumerable;
5
- var os = (i) => {
1
+ var pn = Object.defineProperty, wn = Object.defineProperties;
2
+ var Sn = Object.getOwnPropertyDescriptors;
3
+ var ns = Object.getOwnPropertySymbols;
4
+ var vn = Object.prototype.hasOwnProperty, bn = Object.prototype.propertyIsEnumerable;
5
+ var rs = (i) => {
6
6
  throw TypeError(i);
7
7
  };
8
- var yi = (i, e, t) => e in i ? Sn(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, A = (i, e) => {
8
+ var bi = (i, e, t) => e in i ? pn(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, A = (i, e) => {
9
9
  for (var t in e || (e = {}))
10
- yn.call(e, t) && yi(i, t, e[t]);
11
- if (rs)
12
- for (var t of rs(e))
13
- En.call(e, t) && yi(i, t, e[t]);
10
+ vn.call(e, t) && bi(i, t, e[t]);
11
+ if (ns)
12
+ for (var t of ns(e))
13
+ bn.call(e, t) && bi(i, t, e[t]);
14
14
  return i;
15
- }, R = (i, e) => vn(i, bn(e));
16
- var n = (i, e, t) => yi(i, typeof e != "symbol" ? e + "" : e, t), Ei = (i, e, t) => e.has(i) || os("Cannot " + t);
17
- var d = (i, e, t) => (Ei(i, e, "read from private field"), t ? t.call(i) : e.get(i)), p = (i, e, t) => e.has(i) ? os("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), S = (i, e, t, s) => (Ei(i, e, "write to private field"), s ? s.call(i, t) : e.set(i, t), t), O = (i, e, t) => (Ei(i, e, "access private method"), t);
15
+ }, R = (i, e) => wn(i, Sn(e));
16
+ var n = (i, e, t) => bi(i, typeof e != "symbol" ? e + "" : e, t), yi = (i, e, t) => e.has(i) || rs("Cannot " + t);
17
+ var d = (i, e, t) => (yi(i, e, "read from private field"), t ? t.call(i) : e.get(i)), w = (i, e, t) => e.has(i) ? rs("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), S = (i, e, t, s) => (yi(i, e, "write to private field"), s ? s.call(i, t) : e.set(i, t), t), F = (i, e, t) => (yi(i, e, "access private method"), t);
18
18
  var mt = (i, e, t, s) => ({
19
19
  set _(r) {
20
20
  S(i, e, r, t);
@@ -23,7 +23,7 @@ var mt = (i, e, t, s) => ({
23
23
  return d(i, e, s);
24
24
  }
25
25
  });
26
- var y = (i, e, t) => new Promise((s, r) => {
26
+ var E = (i, e, t) => new Promise((s, r) => {
27
27
  var o = (h) => {
28
28
  try {
29
29
  c(t.next(h));
@@ -40,8 +40,8 @@ var y = (i, e, t) => new Promise((s, r) => {
40
40
  c((t = t.apply(i, e)).next());
41
41
  });
42
42
  import { E as Pe } from "./Bx7s5QdT.js";
43
- import { a as ae, A as Tn, d as Cn, i as In, p as Bn, t as Rn, e as kn } from "./Bg1SqXxu.js";
44
- class as {
43
+ import { a as ae, A as yn, d as En, i as Tn, p as Cn, t as In, e as Bn } from "./Bg1SqXxu.js";
44
+ class os {
45
45
  constructor(e) {
46
46
  n(this, "maxSize", 0);
47
47
  n(this, "size", 0);
@@ -144,7 +144,7 @@ class J {
144
144
  }
145
145
  const le = () => {
146
146
  };
147
- class Vs {
147
+ class Fs {
148
148
  constructor(e, t = 0) {
149
149
  n(this, "buffer");
150
150
  n(this, "bytes");
@@ -183,13 +183,13 @@ function vt() {
183
183
  const i = self.MediaSource, e = self.ManagedMediaSource;
184
184
  return i != null ? i : e;
185
185
  }
186
- const Pn = new RegExp(
186
+ const Rn = new RegExp(
187
187
  "(android|bbd+|meego).+mobile|avantgo|bada/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)/|plucker|pocket|psp|series(4|6)0|symbian|treo|up.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/",
188
188
  "i"
189
- ), K = navigator.userAgent.toLowerCase(), xn = Pn.test(K), Un = () => {
189
+ ), K = navigator.userAgent.toLowerCase(), kn = Rn.test(K), Pn = () => {
190
190
  const i = document.createElement("video");
191
191
  return i.canPlayType("application/vnd.apple.mpegURL") !== "" || i.canPlayType("audio/mpegurl") !== "";
192
- }, Mn = () => {
192
+ }, xn = () => {
193
193
  try {
194
194
  if (typeof WebAssembly == "object" && typeof WebAssembly.instantiate == "function") {
195
195
  const i = new WebAssembly.Module(Uint8Array.of(0, 97, 115, 109, 1, 0, 0, 0));
@@ -199,33 +199,33 @@ const Pn = new RegExp(
199
199
  return !1;
200
200
  }
201
201
  return !1;
202
- }, Ln = () => K.indexOf("CrKey") !== -1, zs = () => navigator.platform === "MacIntel" && navigator.maxTouchPoints === 0, wi = () => navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, _n = () => K.indexOf("iphone") >= 0 && K.indexOf("like iphone") < 0 || K.indexOf("ipad") >= 0 && K.indexOf("like ipad") < 0 || K.indexOf("ipod") >= 0 && K.indexOf("like ipod") < 0 || wi(), Dn = () => {
202
+ }, Un = () => K.indexOf("CrKey") !== -1, Ns = () => navigator.platform === "MacIntel" && navigator.maxTouchPoints === 0, pi = () => navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, Mn = () => K.indexOf("iphone") >= 0 && K.indexOf("like iphone") < 0 || K.indexOf("ipad") >= 0 && K.indexOf("like ipad") < 0 || K.indexOf("ipod") >= 0 && K.indexOf("like ipod") < 0 || pi(), Ln = () => {
203
203
  var i, e;
204
- return wi() ? !1 : (e = (i = vt()) == null ? void 0 : i.isTypeSupported('audio/mp4; codecs="opus"')) != null ? e : !1;
205
- }, Ya = () => "ontouchstart" in window || navigator.maxTouchPoints > 0, Ka = () => /^(?!.*chrome).*safari/i.test(K);
206
- function Fn() {
204
+ return pi() ? !1 : (e = (i = vt()) == null ? void 0 : i.isTypeSupported('audio/mp4; codecs="opus"')) != null ? e : !1;
205
+ }, Ja = () => "ontouchstart" in window || navigator.maxTouchPoints > 0, Ya = () => /^(?!.*chrome).*safari/i.test(K);
206
+ function _n() {
207
207
  var i, e;
208
208
  if (/(iPhone|iPod|iPad)/i.test(K))
209
209
  return (e = (i = K == null ? void 0 : K.match(/OS [\d_]+/i)) == null ? void 0 : i[0]) == null ? void 0 : e.substring(3).split("_").map((t) => parseInt(t))[0];
210
210
  }
211
- const On = () => {
211
+ const Dn = () => {
212
212
  var t;
213
213
  const i = !!vt();
214
214
  let e = !1;
215
- return i && (e = Dn()), {
216
- isMobile: xn,
215
+ return i && (e = Ln()), {
216
+ isMobile: kn,
217
217
  supportsMp4Opus: e,
218
218
  supportsMediaSource: i,
219
- supportsHls: Un(),
220
- supportsWebAssembly: Mn(),
219
+ supportsHls: Pn(),
220
+ supportsWebAssembly: xn(),
221
221
  platform: {
222
- iosVersion: (t = Fn()) != null ? t : Number.MAX_SAFE_INTEGER,
223
- isIpadOS: wi(),
224
- isMacOS: zs(),
225
- isIOS: _n()
222
+ iosVersion: (t = _n()) != null ? t : Number.MAX_SAFE_INTEGER,
223
+ isIpadOS: pi(),
224
+ isMacOS: Ns(),
225
+ isIOS: Mn()
226
226
  }
227
227
  };
228
- }, Hs = (i, e, t) => {
228
+ }, Vs = (i, e, t) => {
229
229
  let s = 0;
230
230
  for (let r = e; r <= t; r++)
231
231
  if (r === e) {
@@ -236,11 +236,11 @@ const On = () => {
236
236
  return s;
237
237
  };
238
238
  var z, Ae, ye;
239
- class cs {
239
+ class as {
240
240
  constructor(e) {
241
- p(this, z);
242
- p(this, Ae);
243
- p(this, ye);
241
+ w(this, z);
242
+ w(this, Ae);
243
+ w(this, ye);
244
244
  S(this, Ae, e), S(this, ye, new DataView(e.buffer, e.byteOffset, e.byteLength)), S(this, z, 0);
245
245
  }
246
246
  position() {
@@ -272,7 +272,7 @@ class cs {
272
272
  return S(this, z, d(this, z) + 4), e;
273
273
  }
274
274
  readUint64() {
275
- const e = Hs(d(this, Ae), d(this, z), d(this, z) + 7);
275
+ const e = Vs(d(this, Ae), d(this, z), d(this, z) + 7);
276
276
  return S(this, z, d(this, z) + 8), e;
277
277
  }
278
278
  readBytes(e) {
@@ -291,7 +291,7 @@ class cs {
291
291
  }
292
292
  }
293
293
  z = new WeakMap(), Ae = new WeakMap(), ye = new WeakMap();
294
- class Nn {
294
+ class On {
295
295
  constructor(e = 100, t = 100) {
296
296
  n(this, "resizeSteps");
297
297
  n(this, "internalBuffer");
@@ -377,7 +377,7 @@ const Ut = (i) => i.reduce((e, t) => e + t, 0) / i.length, Ye = (i) => ({
377
377
  average: i.length === 0 ? 0 : Ut(i),
378
378
  max: i.length === 0 ? 0 : Math.max(...i),
379
379
  min: i.length === 0 ? 0 : Math.min(...i)
380
- }), Vn = (i) => {
380
+ }), Fn = (i) => {
381
381
  let e = 0, t = 0, s = 0, r = 0, o = 0;
382
382
  for (let u = 0; u < i.length; u++) {
383
383
  const { x: l, y: m } = i[u];
@@ -389,7 +389,7 @@ const Ut = (i) => i.reduce((e, t) => e + t, 0) / i.length, Ye = (i) => ({
389
389
  );
390
390
  return { slope: a, intercept: c, r2: h, predict: (u) => a * (i.length + u) + c };
391
391
  };
392
- class zn {
392
+ class Nn {
393
393
  constructor(e = 10) {
394
394
  n(this, "rates");
395
395
  n(this, "_total", 0);
@@ -419,7 +419,7 @@ const je = (i, e) => {
419
419
  for (const r in e)
420
420
  if (s += 1, !(r in i) || !je(i[r], e[r])) return !1;
421
421
  return t == s;
422
- }, ds = ["off", "error", "warn", "info", "debug", "trace"], Hn = {
422
+ }, cs = ["off", "error", "warn", "info", "debug", "trace"], Vn = {
423
423
  ERROR: "error",
424
424
  WARN: "warn",
425
425
  INFO: "info",
@@ -427,13 +427,13 @@ const je = (i, e) => {
427
427
  TRACE: "trace",
428
428
  OFF: "off"
429
429
  };
430
- var De, yt, Fe, rt, ot;
430
+ var De, yt, Oe, rt, ot;
431
431
  const Se = class Se {
432
432
  constructor({ context: e, logLevel: t, debug: s }) {
433
- p(this, De, /* @__PURE__ */ new Map());
434
- p(this, yt, "");
435
- p(this, Fe, !1);
436
- p(this, rt, "off");
433
+ w(this, De, /* @__PURE__ */ new Map());
434
+ w(this, yt, "");
435
+ w(this, Oe, !1);
436
+ w(this, rt, "off");
437
437
  n(this, "trace", (...e) => {
438
438
  });
439
439
  n(this, "debug", (...e) => {
@@ -448,10 +448,10 @@ const Se = class Se {
448
448
  });
449
449
  n(this, "count", (...e) => {
450
450
  });
451
- S(this, yt, e), S(this, rt, t), S(this, Fe, s || !1), this.setLevel(t), this.setDebug(d(this, Fe));
451
+ S(this, yt, e), S(this, rt, t), S(this, Oe, s || !1), this.setLevel(t), this.setDebug(d(this, Oe));
452
452
  }
453
453
  setDebug(e) {
454
- S(this, Fe, e);
454
+ S(this, Oe, e);
455
455
  for (const [t, s] of d(this, De))
456
456
  s.setDebug(e);
457
457
  e ? (this.table = console.table.bind(console), this.count = console.count.bind(console)) : (this.table = () => {
@@ -462,8 +462,8 @@ const Se = class Se {
462
462
  S(this, rt, e);
463
463
  for (const [s, r] of d(this, De))
464
464
  r.setLevel(e);
465
- const t = ds.indexOf(e);
466
- for (const [s, r] of ds.entries())
465
+ const t = cs.indexOf(e);
466
+ for (const [s, r] of cs.entries())
467
467
  r !== "off" && (s <= t ? this[r] = console[r].bind(
468
468
  console,
469
469
  "%c%s %c%s",
@@ -477,7 +477,7 @@ const Se = class Se {
477
477
  createContext(e) {
478
478
  const t = d(this, De).get(e);
479
479
  if (!t) {
480
- const s = new Se({ context: `${e}`, logLevel: d(this, rt), debug: d(this, Fe) });
480
+ const s = new Se({ context: `${e}`, logLevel: d(this, rt), debug: d(this, Oe) });
481
481
  return d(this, De).set(e, s), s;
482
482
  }
483
483
  return t;
@@ -486,9 +486,9 @@ const Se = class Se {
486
486
  return d(Se, ot) || S(Se, ot, new Se({ context: "Vindral", logLevel: "off" })), d(Se, ot);
487
487
  }
488
488
  };
489
- De = new WeakMap(), yt = new WeakMap(), Fe = new WeakMap(), rt = new WeakMap(), ot = new WeakMap(), p(Se, ot);
489
+ De = new WeakMap(), yt = new WeakMap(), Oe = new WeakMap(), rt = new WeakMap(), ot = new WeakMap(), w(Se, ot);
490
490
  let Nt = Se;
491
- function $a(i) {
491
+ function Ka(i) {
492
492
  const e = Nt.get().createContext(i.context);
493
493
  return function(s, r) {
494
494
  const o = String(r.name);
@@ -508,7 +508,7 @@ function $a(i) {
508
508
  return a;
509
509
  };
510
510
  }
511
- const hs = (i, e) => {
511
+ const ds = (i, e) => {
512
512
  const t = A({}, i);
513
513
  return typeof t != "object" || e.forEach((s) => {
514
514
  delete t[s];
@@ -524,11 +524,11 @@ const hs = (i, e) => {
524
524
  }, Je = (i) => i.reduce((e, t) => {
525
525
  var s;
526
526
  return e + (((s = t.end) != null ? s : Date.now()) - t.start);
527
- }, 0), us = (i, e, t = Date.now()) => i.reduce((s, r) => {
527
+ }, 0), hs = (i, e, t = Date.now()) => i.reduce((s, r) => {
528
528
  var c;
529
529
  const o = Math.max(t - e, r.start), a = (c = r.end) != null ? c : t;
530
530
  return Math.max(0, a - o) + s;
531
- }, 0), Wt = class Wt {
531
+ }, 0), Gt = class Gt {
532
532
  constructor() {
533
533
  n(this, "pendingTimeouts", /* @__PURE__ */ new Set());
534
534
  n(this, "pendingIntervals", /* @__PURE__ */ new Set());
@@ -555,14 +555,14 @@ const hs = (i, e) => {
555
555
  });
556
556
  }
557
557
  };
558
- n(Wt, "create", () => new Wt());
559
- let q = Wt;
560
- const ls = () => {
558
+ n(Gt, "create", () => new Gt());
559
+ let q = Gt;
560
+ const us = () => {
561
561
  const i = [...Array(256).keys()].map((t) => t.toString(16).padStart(2, "0")), e = crypto.getRandomValues(new Uint8Array(16));
562
562
  return e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128, [...e.entries()].map(([t, s]) => [4, 6, 8, 10].includes(t) ? `-${i[s]}` : i[s]).join("");
563
- }, Mi = (i) => y(void 0, null, function* () {
563
+ }, Ui = (i) => E(void 0, null, function* () {
564
564
  return new Promise((e) => setTimeout(e, i));
565
- }), Qn = (t, ...s) => y(void 0, [t, ...s], function* (i, e = new Error("Timeout")) {
565
+ }), zn = (t, ...s) => E(void 0, [t, ...s], function* (i, e = new Error("Timeout")) {
566
566
  return new Promise((r, o) => setTimeout(() => o(e), i));
567
567
  }), st = (i) => "width" in i && typeof i.width == "number", nt = (i) => "sampleRate" in i && typeof i.sampleRate == "number", $e = (i) => {
568
568
  switch (i.codec) {
@@ -582,10 +582,10 @@ const ls = () => {
582
582
  }, ke = () => Number.MAX_SAFE_INTEGER, Vt = () => ({
583
583
  width: Number.MAX_SAFE_INTEGER,
584
584
  height: Number.MAX_SAFE_INTEGER
585
- }), ms = (i) => !(typeof i != "object" || i === null || !("type" in i)), Xn = !0;
586
- function Gn() {
585
+ }), ls = (i) => !(typeof i != "object" || i === null || !("type" in i)), Hn = !0;
586
+ function Qn() {
587
587
  return {
588
- moqEnabled: Xn
588
+ moqEnabled: Hn
589
589
  };
590
590
  }
591
591
  const Wn = {
@@ -598,7 +598,7 @@ const Wn = {
598
598
  muted: !1,
599
599
  minBufferTime: 1500,
600
600
  maxBufferTime: 1500,
601
- logLevel: Hn.OFF,
601
+ logLevel: Vn.OFF,
602
602
  maxSize: Vt(),
603
603
  maxVideoBitRate: ke(),
604
604
  maxAudioBitRate: ke(),
@@ -620,7 +620,7 @@ const Wn = {
620
620
  },
621
621
  videoCodecs: ["av1", "h264"],
622
622
  webtransportEnabled: !0
623
- }, jn = "connection_failed", qn = "connection_failed_will_not_attempt_again", Zn = "authentication_error", Jn = "authentication_expired", Yn = "channel_not_found", Kn = "no_incoming_data_error", $n = "connection_inactivity", er = "missing_init_segment", tr = "no_track_context", ir = "invalid_track_context_state", sr = "disconnected_by_edge", nr = "decoder_error", rr = "audio_player_error", or = "media_source_error", ar = "webgl_context_lost_error", cr = "access_forbidden", dr = "channel_switch_failed";
623
+ }, Xn = "connection_failed", Gn = "connection_failed_will_not_attempt_again", jn = "authentication_error", qn = "authentication_expired", Zn = "channel_not_found", Jn = "no_incoming_data_error", Yn = "connection_inactivity", Kn = "missing_init_segment", $n = "no_track_context", er = "invalid_track_context_state", tr = "disconnected_by_edge", ir = "decoder_error", sr = "audio_player_error", nr = "media_source_error", rr = "webgl_context_lost_error", or = "access_forbidden", ar = "channel_switch_failed";
624
624
  class T extends Error {
625
625
  constructor(t, s, r = {}) {
626
626
  super(t);
@@ -663,55 +663,55 @@ class T extends Error {
663
663
  this.props = s, this.extra = r, Object.setPrototypeOf(this, new.target.prototype);
664
664
  }
665
665
  }
666
- const hr = (i, e) => new T(
666
+ const cr = (i, e) => new T(
667
667
  "MediaElement Error",
668
668
  { isFatal: i, code: "media_element_error", source: e },
669
669
  { mediaErrorCode: e.code }
670
- ), ur = (i, e) => new T("Decoder Error", { isFatal: i, code: nr, source: e, type: "internal" }), Qs = (i, e) => new T("Audio Player Error", { isFatal: i, code: rr, source: e, type: "internal" }), lr = (i, e) => new T(`No init segment for rendition id ${i} for channel ${e}`, {
670
+ ), dr = (i, e) => new T("Decoder Error", { isFatal: i, code: ir, source: e, type: "internal" }), zs = (i, e) => new T("Audio Player Error", { isFatal: i, code: sr, source: e, type: "internal" }), hr = (i, e) => new T(`No init segment for rendition id ${i} for channel ${e}`, {
671
671
  isFatal: !1,
672
- code: er,
672
+ code: Kn,
673
673
  type: "internal"
674
- }), fs = (i, e, t, s) => new T(
674
+ }), ms = (i, e, t, s) => new T(
675
675
  "MediaSource Error",
676
- { isFatal: i, code: or, source: e, type: "internal" },
676
+ { isFatal: i, code: nr, source: e, type: "internal" },
677
677
  { type: s, consecutiveErrorsCount: t }
678
678
  ), _t = (i, e) => new T(`No track context for ${i}${e ? `, rendition id ${e}` : ""}`, {
679
679
  isFatal: !1,
680
- code: tr,
680
+ code: $n,
681
681
  type: "internal"
682
- }), As = (i, e) => new T(
682
+ }), ur = (i, e) => new T(
683
683
  `Track context is in an invalid state for ${i}${e ? `, rendition id ${e}` : ""}`,
684
684
  {
685
685
  isFatal: !1,
686
- code: ir,
686
+ code: er,
687
687
  type: "internal"
688
688
  }
689
- ), mr = () => new T("Web Audio Context resume timeout", { isFatal: !1, code: "web_audio_context_resume_timeout" }), ft = (i) => new T("Disconnected From Edge Server", {
689
+ ), lr = () => new T("Web Audio Context resume timeout", { isFatal: !1, code: "web_audio_context_resume_timeout" }), ft = (i) => new T("Disconnected From Edge Server", {
690
690
  type: "external",
691
691
  source: i,
692
692
  isFatal: !1,
693
- code: sr
694
- }), zt = (i) => new T("Authentication Failed", { isFatal: !0, code: Zn, source: i }), fr = (i) => new T("Authentication Expired", { isFatal: !0, code: Jn, source: i }), Ar = (i, e) => new T("Connection closed due to inactivity", { isFatal: !1, code: $n, source: e, type: i }), Xs = (i, e) => new T("Channel not found", { isFatal: !1, code: Yn, source: e, type: i }), gr = (i) => new T("No Incoming Data", { isFatal: !1, code: Kn, source: i }), pr = (i) => new T("Connection attempt failed", {
693
+ code: tr
694
+ }), zt = (i) => new T("Authentication Failed", { isFatal: !0, code: jn, source: i }), mr = (i) => new T("Authentication Expired", { isFatal: !0, code: qn, source: i }), fr = (i, e) => new T("Connection closed due to inactivity", { isFatal: !1, code: Yn, source: e, type: i }), Hs = (i, e) => new T("Channel not found", { isFatal: !1, code: Zn, source: e, type: i }), Ar = (i) => new T("No Incoming Data", { isFatal: !1, code: Jn, source: i }), gr = (i) => new T("Connection attempt failed", {
695
695
  isFatal: !1,
696
- code: jn,
696
+ code: Xn,
697
697
  source: i
698
- }), Gs = () => new T("Connection failed - no more reconnect attempts", {
698
+ }), Qs = () => new T("Connection failed - no more reconnect attempts", {
699
699
  isFatal: !0,
700
- code: qn
701
- }), wr = (i) => new T("WebGL Context Lost", { isFatal: !1, code: ar, source: i, type: "internal" }), gs = (i) => new T(i, { isFatal: !0, code: cr }), ps = (i) => new T(`Channel switch to '${i}' failed`, { isFatal: !1, code: dr }), ws = (i, e) => i && typeof i == "object" && e in i, Sr = (i) => !(typeof i != "object" || !ws(i, "channelId") || typeof i.channelId != "string" || !ws(i, "url") || typeof i.url != "string" || i.channelId.length === 0 || i.url.length === 0), vr = (i) => {
702
- if (!Sr(i))
700
+ code: Gn
701
+ }), pr = (i) => new T("WebGL Context Lost", { isFatal: !1, code: rr, source: i, type: "internal" }), fs = (i) => new T(i, { isFatal: !0, code: or }), As = (i) => new T(`Channel switch to '${i}' failed`, { isFatal: !1, code: ar }), gs = (i, e) => i && typeof i == "object" && e in i, wr = (i) => !(typeof i != "object" || !gs(i, "channelId") || typeof i.channelId != "string" || !gs(i, "url") || typeof i.url != "string" || i.channelId.length === 0 || i.url.length === 0), Sr = (i) => {
702
+ if (!wr(i))
703
703
  throw new T("Invalid options", { isFatal: !0, code: "invalid_options" });
704
704
  const e = A({}, i);
705
705
  return Object.keys(e).forEach((t) => {
706
706
  const s = e;
707
707
  typeof s[t] == "undefined" && delete s[t];
708
708
  }), e;
709
- }, br = {
709
+ }, vr = {
710
710
  playready: ["150", "2000", "3000"],
711
711
  widevine: ["SW_SECURE_CRYPTO", "SW_SECURE_DECODE", "HW_SECURE_CRYPTO", "HW_SECURE_DECODE", "HW_SECURE_ALL"],
712
712
  fairplay: [""],
713
713
  clearkey: [""]
714
- }, Ti = {
714
+ }, Ei = {
715
715
  initDataTypes: ["cenc"],
716
716
  audioCapabilities: [
717
717
  {
@@ -723,7 +723,7 @@ const hr = (i, e) => new T(
723
723
  contentType: 'video/mp4; codecs="avc1.42c01f"'
724
724
  }
725
725
  ]
726
- }, yr = {
726
+ }, br = {
727
727
  fairplay: {
728
728
  keySystem: "com.apple.fps",
729
729
  supportedConfig: {
@@ -737,20 +737,20 @@ const hr = (i, e) => new T(
737
737
  },
738
738
  playready: {
739
739
  keySystem: "com.microsoft.playready",
740
- supportedConfig: Ti
740
+ supportedConfig: Ei
741
741
  },
742
742
  widevine: {
743
743
  keySystem: "com.widevine.alpha",
744
- supportedConfig: Ti
744
+ supportedConfig: Ei
745
745
  },
746
746
  clearkey: {
747
747
  keySystem: "org.w3.clearkey",
748
- supportedConfig: Ti
748
+ supportedConfig: Ei
749
749
  }
750
- }, Ws = (i, e) => y(void 0, null, function* () {
750
+ }, Ws = (i, e) => E(void 0, null, function* () {
751
751
  return navigator.requestMediaKeySystemAccess(i, [e]).catch(() => {
752
752
  });
753
- }), Ss = (i, e, t, s, r, o) => y(void 0, null, function* () {
753
+ }), ps = (i, e, t, s, r, o) => E(void 0, null, function* () {
754
754
  let a;
755
755
  for (const c of s) {
756
756
  const h = t == null ? void 0 : t.map((l) => R(A({}, l), {
@@ -765,9 +765,9 @@ const hr = (i, e) => new T(
765
765
  a = h;
766
766
  }
767
767
  return a;
768
- }), Er = (i, e, t) => y(void 0, null, function* () {
769
- const { keySystem: s, supportedConfig: r } = yr[i], { initDataTypes: o, videoCapabilities: a, audioCapabilities: c } = r, h = br[i], [u, l] = yield Promise.all([
770
- Ss(
768
+ }), yr = (i, e, t) => E(void 0, null, function* () {
769
+ const { keySystem: s, supportedConfig: r } = br[i], { initDataTypes: o, videoCapabilities: a, audioCapabilities: c } = r, h = vr[i], [u, l] = yield Promise.all([
770
+ ps(
771
771
  s,
772
772
  o,
773
773
  a,
@@ -775,7 +775,7 @@ const hr = (i, e) => new T(
775
775
  "videoCapabilities",
776
776
  e
777
777
  ),
778
- Ss(
778
+ ps(
779
779
  s,
780
780
  o,
781
781
  c,
@@ -789,41 +789,41 @@ const hr = (i, e) => new T(
789
789
  videoCapabilities: u,
790
790
  audioCapabilities: l
791
791
  });
792
- }), Tr = (i, e, t) => y(void 0, null, function* () {
792
+ }), Er = (i, e, t) => E(void 0, null, function* () {
793
793
  let s;
794
794
  for (const r of i)
795
- if (s = yield Er(r, e, t), s)
795
+ if (s = yield yr(r, e, t), s)
796
796
  return {
797
797
  keySystem: r,
798
798
  mediaKeySystemAccess: s
799
799
  };
800
800
  });
801
- var Oe, Ne;
802
- class Si {
801
+ var Fe, Ne;
802
+ class wi {
803
803
  constructor(e, t, s, r) {
804
804
  n(this, "keySystem");
805
805
  n(this, "licenseServerUrl");
806
806
  n(this, "certificate");
807
807
  n(this, "headers", {});
808
808
  n(this, "queryParams", {});
809
- p(this, Oe);
810
- p(this, Ne);
811
- S(this, Oe, t), this.keySystem = e, this.licenseServerUrl = s, this.certificate = r;
809
+ w(this, Fe);
810
+ w(this, Ne);
811
+ S(this, Fe, t), this.keySystem = e, this.licenseServerUrl = s, this.certificate = r;
812
812
  }
813
813
  get statistics() {
814
814
  return {
815
- keySystem: d(this, Oe).keySystem,
815
+ keySystem: d(this, Fe).keySystem,
816
816
  licenseServerUrl: this.licenseServerUrl,
817
- mediaKeySystemConfiguration: d(this, Oe).getConfiguration()
817
+ mediaKeySystemConfiguration: d(this, Fe).getConfiguration()
818
818
  };
819
819
  }
820
820
  getMediaKeys() {
821
- return y(this, null, function* () {
822
- return d(this, Ne) ? d(this, Ne) : (S(this, Ne, yield d(this, Oe).createMediaKeys()), d(this, Ne));
821
+ return E(this, null, function* () {
822
+ return d(this, Ne) ? d(this, Ne) : (S(this, Ne, yield d(this, Fe).createMediaKeys()), d(this, Ne));
823
823
  });
824
824
  }
825
825
  requestLicense(e) {
826
- return y(this, null, function* () {
826
+ return E(this, null, function* () {
827
827
  const t = new URL(this.licenseServerUrl);
828
828
  for (const [o, a] of Object.entries(this.queryParams))
829
829
  t.searchParams.append(o, a);
@@ -840,21 +840,21 @@ class Si {
840
840
  });
841
841
  }
842
842
  }
843
- Oe = new WeakMap(), Ne = new WeakMap();
844
- function js(i) {
843
+ Fe = new WeakMap(), Ne = new WeakMap();
844
+ function Xs(i) {
845
845
  const e = window.atob(i.replace(/-/g, "+").replace(/_/g, "/"));
846
846
  let t = "";
847
847
  for (let s = 0; s < e.length; s++)
848
848
  t += ("0" + e.charCodeAt(s).toString(16)).substr(-2);
849
849
  return t;
850
850
  }
851
- function Cr(i) {
851
+ function Tr(i) {
852
852
  let e = "";
853
853
  for (let t = 0; t < i.length; t += 2)
854
854
  e += String.fromCharCode(parseInt(i.substr(t, 2), 16));
855
855
  return window.btoa(e).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
856
856
  }
857
- function Ir(i, e) {
857
+ function Cr(i, e) {
858
858
  if (i.byteLength !== e.byteLength) return !1;
859
859
  const t = new Uint8Array(i), s = new Uint8Array(e);
860
860
  for (let r = 0; r < t.length; r++)
@@ -862,10 +862,10 @@ function Ir(i, e) {
862
862
  return !0;
863
863
  }
864
864
  var Et;
865
- class Br extends Si {
865
+ class Ir extends wi {
866
866
  constructor(t, s) {
867
867
  super("clearkey", t, "");
868
- p(this, Et);
868
+ w(this, Et);
869
869
  S(this, Et, s);
870
870
  }
871
871
  handleLicenseRequest(t) {
@@ -873,12 +873,12 @@ class Br extends Si {
873
873
  for (let u = 0; u < o.kids.length; u++) {
874
874
  const l = o.kids[u];
875
875
  if (l) {
876
- const m = js(l).toLowerCase(), g = d(this, Et)[m];
876
+ const m = Xs(l).toLowerCase(), g = d(this, Et)[m];
877
877
  g && a.push({
878
878
  kty: "oct",
879
879
  alg: "A128KW",
880
880
  kid: l,
881
- k: Cr(g)
881
+ k: Tr(g)
882
882
  });
883
883
  }
884
884
  }
@@ -890,20 +890,20 @@ class Br extends Si {
890
890
  }
891
891
  }
892
892
  Et = new WeakMap();
893
- class Rr extends Si {
893
+ class Br extends wi {
894
894
  constructor(e, t, s) {
895
895
  super("fairplay", e, t, s);
896
896
  }
897
897
  }
898
- const kr = (i) => {
898
+ const Rr = (i) => {
899
899
  var c, h, u, l;
900
900
  const e = String.fromCharCode(...new Uint16Array(i)), t = new window.DOMParser().parseFromString(e, "application/xml"), s = t.getElementsByTagName("HttpHeaders")[0];
901
901
  let r = {};
902
902
  if (s) {
903
903
  const m = s.getElementsByTagName("name"), g = s.getElementsByTagName("value");
904
- for (let w = 0; w < m.length; w++) {
905
- const E = (c = m[w]) == null ? void 0 : c.childNodes[0], M = (h = g[w]) == null ? void 0 : h.childNodes[0];
906
- E != null && E.nodeValue && M && M.nodeValue && (r[E.nodeValue] = M.nodeValue);
904
+ for (let p = 0; p < m.length; p++) {
905
+ const y = (c = m[p]) == null ? void 0 : c.childNodes[0], U = (h = g[p]) == null ? void 0 : h.childNodes[0];
906
+ y != null && y.nodeValue && U && U.nodeValue && (r[y.nodeValue] = U.nodeValue);
907
907
  }
908
908
  }
909
909
  const o = t.getElementsByTagName("Challenge")[0];
@@ -916,17 +916,17 @@ const kr = (i) => {
916
916
  message: a
917
917
  };
918
918
  };
919
- class Pr extends Si {
919
+ class kr extends wi {
920
920
  constructor(e, t) {
921
921
  super("playready", e, t);
922
922
  }
923
923
  requestLicense(e) {
924
- return y(this, null, function* () {
924
+ return E(this, null, function* () {
925
925
  ae(this.licenseServerUrl, "No license server URL set");
926
926
  const t = new URL(this.licenseServerUrl);
927
927
  for (const [o, a] of Object.entries(this.queryParams))
928
928
  t.searchParams.append(o, a);
929
- const s = kr(e), r = yield fetch(t, {
929
+ const s = Rr(e), r = yield fetch(t, {
930
930
  method: "POST",
931
931
  headers: A(A({}, s.headers), this.headers),
932
932
  body: s.message
@@ -937,31 +937,31 @@ class Pr extends Si {
937
937
  });
938
938
  }
939
939
  }
940
- class xr extends Si {
940
+ class Pr extends wi {
941
941
  constructor(e, t) {
942
942
  super("widevine", e, t);
943
943
  }
944
944
  }
945
- var k, Ve, ge, ze, Tt, Ct, de, Ee, Te, It, Bt, W, qs, Zs, Js, Ys, jt, qt, Ks, Ot, Zt, $s;
946
- class vs {
945
+ var k, Ve, ge, ze, Tt, Ct, de, Ee, Te, It, Bt, G, Gs, js, qs, Zs, jt, qt, Js, Ft, Zt, Ys;
946
+ class ws {
947
947
  constructor(e, t, s, r) {
948
- p(this, W);
949
- p(this, k);
950
- p(this, Ve);
951
- p(this, ge);
952
- p(this, ze, new St());
953
- p(this, Tt, {});
954
- p(this, Ct, {});
955
- p(this, de, null);
956
- p(this, Ee, /* @__PURE__ */ new Map());
957
- p(this, Te, null);
958
- p(this, It, (e) => {
948
+ w(this, G);
949
+ w(this, k);
950
+ w(this, Ve);
951
+ w(this, ge);
952
+ w(this, ze, new St());
953
+ w(this, Tt, {});
954
+ w(this, Ct, {});
955
+ w(this, de, null);
956
+ w(this, Ee, /* @__PURE__ */ new Map());
957
+ w(this, Te, null);
958
+ w(this, It, (e) => {
959
959
  d(this, k).debug("Received DRM data", { options: e }), d(this, ze).resolve(e);
960
960
  });
961
- p(this, Bt, (e) => {
962
- d(this, k).info("Encrypted event received", { event: e }), O(this, W, qs).call(this, e);
961
+ w(this, Bt, (e) => {
962
+ d(this, k).info("Encrypted event received", { event: e }), F(this, G, Gs).call(this, e);
963
963
  });
964
- p(this, jt, (e) => {
964
+ w(this, jt, (e) => {
965
965
  var o;
966
966
  d(this, k).debug("Session message received", { event: e });
967
967
  const t = e.target, s = e.message;
@@ -971,32 +971,32 @@ class vs {
971
971
  }
972
972
  d(this, k).debug("Requesting license for session", { sessionId: t.sessionId }), (o = d(this, de)) == null || o.requestLicense(s).then((a) => {
973
973
  d(this, k).debug("License received for session", { sessionId: t.sessionId }), t.update(a).catch((c) => {
974
- O(this, W, Ot).call(this, { message: "Failed to update session with license", code: "eme", isFatal: !1, error: c });
974
+ F(this, G, Ft).call(this, { message: "Failed to update session with license", code: "eme", isFatal: !1, error: c });
975
975
  });
976
976
  }).catch((a) => {
977
- O(this, W, Ot).call(this, { message: "Failed to request license", code: "eme", isFatal: !1, error: a });
977
+ F(this, G, Ft).call(this, { message: "Failed to request license", code: "eme", isFatal: !1, error: a });
978
978
  });
979
979
  });
980
- p(this, qt, (e) => {
980
+ w(this, qt, (e) => {
981
981
  const t = e.target;
982
982
  d(this, k).debug("Key status changed for session", { sessionId: t.sessionId }), t.keyStatuses.forEach((s, r) => {
983
- const o = js(window.btoa(String.fromCharCode(...new Uint8Array(r))));
983
+ const o = Xs(window.btoa(String.fromCharCode(...new Uint8Array(r))));
984
984
  d(this, k).debug("Key status", { base64kid: o, status: s });
985
985
  });
986
986
  });
987
987
  /**
988
988
  * Get the CDM based on the options and the supported key systems
989
989
  */
990
- p(this, Zt, (e) => y(this, null, function* () {
991
- const t = O(this, W, $s).call(this, e);
990
+ w(this, Zt, (e) => E(this, null, function* () {
991
+ const t = F(this, G, Ys).call(this, e);
992
992
  d(this, k).debug("Prioritized key system list", { keySystemList: t });
993
- const s = yield Tr(t, e.videoCodec, e.audioCodec);
993
+ const s = yield Er(t, e.videoCodec, e.audioCodec);
994
994
  if (!s)
995
995
  return d(this, k).debug("No supported key system found"), null;
996
996
  d(this, k).debug("Supported key system found", s.mediaKeySystemAccess.getConfiguration());
997
997
  const { keySystem: r, mediaKeySystemAccess: o } = s;
998
998
  let a = null;
999
- return r === "clearkey" ? (ae(e.clearkeys, "No clearkeys found"), a = new Br(o, e.clearkeys)) : r === "playready" ? (ae(e.playreadyLicenseUrl, "No playreadyLicenseUrl found"), a = new Pr(o, e.playreadyLicenseUrl)) : r === "widevine" ? (ae(e.widevineLicenseUrl, "No widevineLicenseUrl found"), a = new xr(o, e.widevineLicenseUrl)) : r === "fairplay" && (ae(e.fairplayLicenseUrl, "No fairplayLicenseUrl found"), ae(e.fairplayCertificate, "No fairplayCertificate found"), a = new Rr(o, e.fairplayLicenseUrl, e.fairplayCertificate)), a && (a.headers = d(this, Tt), a.queryParams = d(this, Ct)), a;
999
+ return r === "clearkey" ? (ae(e.clearkeys, "No clearkeys found"), a = new Ir(o, e.clearkeys)) : r === "playready" ? (ae(e.playreadyLicenseUrl, "No playreadyLicenseUrl found"), a = new kr(o, e.playreadyLicenseUrl)) : r === "widevine" ? (ae(e.widevineLicenseUrl, "No widevineLicenseUrl found"), a = new Pr(o, e.widevineLicenseUrl)) : r === "fairplay" && (ae(e.fairplayLicenseUrl, "No fairplayLicenseUrl found"), ae(e.fairplayCertificate, "No fairplayCertificate found"), a = new Br(o, e.fairplayLicenseUrl, e.fairplayCertificate)), a && (a.headers = d(this, Tt), a.queryParams = d(this, Ct)), a;
1000
1000
  }));
1001
1001
  S(this, Ve, e), S(this, k, t), S(this, Tt, s || {}), S(this, Ct, r || {}), d(this, Ve).on("received drm data", d(this, It));
1002
1002
  }
@@ -1017,16 +1017,16 @@ class vs {
1017
1017
  }), d(this, Ee).clear(), S(this, Te, null), S(this, de, null);
1018
1018
  }
1019
1019
  }
1020
- k = new WeakMap(), Ve = new WeakMap(), ge = new WeakMap(), ze = new WeakMap(), Tt = new WeakMap(), Ct = new WeakMap(), de = new WeakMap(), Ee = new WeakMap(), Te = new WeakMap(), It = new WeakMap(), Bt = new WeakMap(), W = new WeakSet(), qs = function(e) {
1021
- return y(this, null, function* () {
1020
+ k = new WeakMap(), Ve = new WeakMap(), ge = new WeakMap(), ze = new WeakMap(), Tt = new WeakMap(), Ct = new WeakMap(), de = new WeakMap(), Ee = new WeakMap(), Te = new WeakMap(), It = new WeakMap(), Bt = new WeakMap(), G = new WeakSet(), Gs = function(e) {
1021
+ return E(this, null, function* () {
1022
1022
  try {
1023
- yield O(this, W, Zs).call(this), d(this, k).debug("Media keys initialization completed"), yield O(this, W, Js).call(this, e.initData, e.initDataType);
1023
+ yield F(this, G, js).call(this), d(this, k).debug("Media keys initialization completed"), yield F(this, G, qs).call(this, e.initData, e.initDataType);
1024
1024
  } catch (t) {
1025
- O(this, W, Ot).call(this, { message: "Failed to handle encrypted event", code: "eme", isFatal: !0, error: t });
1025
+ F(this, G, Ft).call(this, { message: "Failed to handle encrypted event", code: "eme", isFatal: !0, error: t });
1026
1026
  }
1027
1027
  });
1028
- }, Zs = function() {
1029
- return y(this, null, function* () {
1028
+ }, js = function() {
1029
+ return E(this, null, function* () {
1030
1030
  var e;
1031
1031
  if (d(this, k).debug("Initializing media keys"), (e = d(this, ge)) != null && e.mediaKeys) {
1032
1032
  d(this, k).debug("Media keys already set on media element");
@@ -1036,18 +1036,18 @@ k = new WeakMap(), Ve = new WeakMap(), ge = new WeakMap(), ze = new WeakMap(), T
1036
1036
  d(this, k).debug("Media keys initialization already in progress, waiting for completion"), yield d(this, Te);
1037
1037
  return;
1038
1038
  }
1039
- S(this, Te, y(this, null, function* () {
1039
+ S(this, Te, E(this, null, function* () {
1040
1040
  const t = yield d(this, ze).promise, s = yield d(this, Zt).call(this, t);
1041
1041
  d(this, k).debug("CDM obtained", { cdm: s }), ae(d(this, ge), "No media element found"), ae(s, "No CDM found");
1042
1042
  const r = yield s.getMediaKeys();
1043
- s.certificate && (yield O(this, W, Ks).call(this, r, s.certificate)), d(this, k).debug("Setting media keys on media element"), yield d(this, ge).setMediaKeys(r), S(this, de, s);
1043
+ s.certificate && (yield F(this, G, Js).call(this, r, s.certificate)), d(this, k).debug("Setting media keys on media element"), yield d(this, ge).setMediaKeys(r), S(this, de, s);
1044
1044
  })), yield d(this, Te);
1045
1045
  });
1046
- }, Js = function(e, t) {
1047
- return y(this, null, function* () {
1046
+ }, qs = function(e, t) {
1047
+ return E(this, null, function* () {
1048
1048
  ae(d(this, de), "No CDM manager found");
1049
1049
  const s = yield d(this, de).getMediaKeys();
1050
- if (!e || !O(this, W, Ys).call(this, e)) {
1050
+ if (!e || !F(this, G, Zs).call(this, e)) {
1051
1051
  d(this, k).debug("Duplicate initData, no need to create new session", { initData: e });
1052
1052
  return;
1053
1053
  }
@@ -1056,19 +1056,19 @@ k = new WeakMap(), Ve = new WeakMap(), ge = new WeakMap(), ze = new WeakMap(), T
1056
1056
  d(this, k).info("Session is closed", { reason: o });
1057
1057
  }), r.addEventListener("message", d(this, jt)), d(this, Ee).set(r, e), d(this, k).debug("Generating request for session", { session: r, initDataType: t, initData: e }), yield r.generateRequest(t, e);
1058
1058
  });
1059
- }, Ys = function(e) {
1059
+ }, Zs = function(e) {
1060
1060
  for (const [t, s] of d(this, Ee))
1061
- if (Ir(e, s)) return !1;
1061
+ if (Cr(e, s)) return !1;
1062
1062
  return !0;
1063
- }, jt = new WeakMap(), qt = new WeakMap(), Ks = function(e, t) {
1064
- return y(this, null, function* () {
1063
+ }, jt = new WeakMap(), qt = new WeakMap(), Js = function(e, t) {
1064
+ return E(this, null, function* () {
1065
1065
  try {
1066
1066
  d(this, k).debug("Setting server certificate", { certificate: t }), (yield e.setServerCertificate(t)) || d(this, k).warn("Server certificates are not supported by the CDM.");
1067
1067
  } catch (s) {
1068
1068
  d(this, k).error("Failed to set server certificate", { error: s });
1069
1069
  }
1070
1070
  });
1071
- }, Ot = function(e) {
1071
+ }, Ft = function(e) {
1072
1072
  const { message: t, code: s, isFatal: r, error: o } = e;
1073
1073
  d(this, k).error(t, { error: o }), d(this, Ve).emit("error", new T(t, { code: s, isFatal: r }, { error: o }));
1074
1074
  }, Zt = new WeakMap(), /**
@@ -1077,32 +1077,32 @@ k = new WeakMap(), Ve = new WeakMap(), ge = new WeakMap(), ze = new WeakMap(), T
1077
1077
  * If clearkeys are provided, it will be the first in the list.
1078
1078
  * Playready will be prioritized over Widevine, some browsers support both but playready may support higher robustness level.
1079
1079
  */
1080
- $s = function(e) {
1080
+ Ys = function(e) {
1081
1081
  const t = [];
1082
1082
  return e.clearkeys && t.push("clearkey"), e.playreadyLicenseUrl && t.push("playready"), e.widevineLicenseUrl && t.push("widevine"), e.fairplayLicenseUrl && e.fairplayCertificate && t.push("fairplay"), t;
1083
1083
  };
1084
- const Ur = 7, Mr = 8, Lr = (i) => {
1084
+ const xr = 7, Ur = 8, Mr = (i) => {
1085
1085
  const e = i.getUint32(0, !1), t = i.getUint8(0) << 16 | i.getUint16(1, !1);
1086
1086
  let s = 0;
1087
1087
  return t === 1 ? s += 3 : e === 1 && (s += 4), s;
1088
- }, _r = (i) => Lr(new DataView(i, 0)) !== 0, bs = (i, e = 0) => {
1088
+ }, Lr = (i) => Mr(new DataView(i, 0)) !== 0, Ss = (i, e = 0) => {
1089
1089
  for (let t = e; t < i.byteLength - 4; t++) {
1090
1090
  const s = i.getUint32(t) === 1, r = (i.getUint8(t) << 16 | i.getUint16(t + 1)) === 1;
1091
1091
  if (s || r)
1092
1092
  return { position: t, nalPrefixSize: s ? 4 : 3 };
1093
1093
  }
1094
- }, Dr = (i) => i & 31, Fr = (i, e) => {
1094
+ }, _r = (i) => i & 31, Dr = (i, e) => {
1095
1095
  const t = new DataView(i, 0);
1096
- let s = bs(t);
1096
+ let s = Ss(t);
1097
1097
  for (; s; ) {
1098
- const { position: r, nalPrefixSize: o } = s, a = bs(t, r + 4), c = a ? a.position - r - o : void 0;
1098
+ const { position: r, nalPrefixSize: o } = s, a = Ss(t, r + 4), c = a ? a.position - r - o : void 0;
1099
1099
  if (!e(new DataView(i, r + o, c), o))
1100
1100
  return;
1101
1101
  s = a;
1102
1102
  }
1103
- }, en = (i) => {
1103
+ }, Ks = (i) => {
1104
1104
  const e = [], t = [];
1105
- if (!_r(i)) {
1105
+ if (!Lr(i)) {
1106
1106
  const s = new DataView(i, 0), r = s.getUint8(5) & 31;
1107
1107
  let o = 6;
1108
1108
  for (let c = 0; c < r; c++) {
@@ -1120,21 +1120,21 @@ const Ur = 7, Mr = 8, Lr = (i) => {
1120
1120
  pictureParameterSets: t
1121
1121
  };
1122
1122
  }
1123
- return Fr(i, (s) => {
1123
+ return Dr(i, (s) => {
1124
1124
  const r = s.byteOffset + s.byteLength;
1125
- switch (Dr(s.getUint8(0))) {
1126
- case Mr:
1125
+ switch (_r(s.getUint8(0))) {
1126
+ case Ur:
1127
1127
  t.push(s.buffer.slice(s.byteOffset, r));
1128
1128
  break;
1129
- case Ur:
1129
+ case xr:
1130
1130
  e.push(s.buffer.slice(s.byteOffset, r));
1131
1131
  break;
1132
1132
  }
1133
1133
  return !0;
1134
1134
  }), { sequenceParameterSets: e, pictureParameterSets: t };
1135
1135
  }, Or = (i) => {
1136
- var E;
1137
- const e = new DataView(i), t = e.getUint8(1), s = e.getUint8(2), r = e.getUint8(3), o = new Vs(i, 4 * 8);
1136
+ var y;
1137
+ const e = new DataView(i), t = e.getUint8(1), s = e.getUint8(2), r = e.getUint8(3), o = new Fs(i, 4 * 8);
1138
1138
  o.readUnsignedExpGolomb();
1139
1139
  let a = 1;
1140
1140
  switch (t) {
@@ -1172,22 +1172,22 @@ const Ur = 7, Mr = 8, Lr = (i) => {
1172
1172
  l === 0 && o.readBit(), o.readBit();
1173
1173
  let m = h + 1, g = u + 1;
1174
1174
  if (g *= 2 - l, g *= 16, m *= 16, o.readBit()) {
1175
- const M = a == 1 ? 1 : 0, G = 1 << (a == 1 || a == 2 ? 1 : 0), L = 2 - l << M, _ = o.readUnsignedExpGolomb() * G, Z = o.readUnsignedExpGolomb() * G, te = o.readUnsignedExpGolomb() * L, me = o.readUnsignedExpGolomb() * L;
1175
+ const U = a == 1 ? 1 : 0, X = 1 << (a == 1 || a == 2 ? 1 : 0), L = 2 - l << U, _ = o.readUnsignedExpGolomb() * X, Z = o.readUnsignedExpGolomb() * X, te = o.readUnsignedExpGolomb() * L, me = o.readUnsignedExpGolomb() * L;
1176
1176
  m -= _ + Z, g -= te + me;
1177
1177
  }
1178
- let w = {
1178
+ let p = {
1179
1179
  numerator: 1,
1180
1180
  denumerator: 1
1181
1181
  };
1182
- return o.readBit() && o.readBit() && (w = (E = Nr[o.readBits(8)]) != null ? E : { numerator: 0, denumerator: 0 }), {
1182
+ return o.readBit() && o.readBit() && (p = (y = Fr[o.readBits(8)]) != null ? y : { numerator: 0, denumerator: 0 }), {
1183
1183
  width: m,
1184
1184
  height: g,
1185
- pixelAspectRatio: w,
1185
+ pixelAspectRatio: p,
1186
1186
  profileIdc: t,
1187
1187
  constraintFlags: s,
1188
1188
  levelIdc: r
1189
1189
  };
1190
- }, Nr = [
1190
+ }, Fr = [
1191
1191
  { numerator: 0, denumerator: 0 },
1192
1192
  { numerator: 1, denumerator: 1 },
1193
1193
  { numerator: 12, denumerator: 11 },
@@ -1205,20 +1205,20 @@ const Ur = 7, Mr = 8, Lr = (i) => {
1205
1205
  { numerator: 4, denumerator: 3 },
1206
1206
  { numerator: 3, denumerator: 2 },
1207
1207
  { numerator: 2, denumerator: 1 }
1208
- ], Vr = 184549376;
1209
- function zr(i) {
1210
- const e = new cs(i), t = Hr(e);
1211
- t.flags & Vr && Qr(e);
1212
- const s = Xr(e);
1208
+ ], Nr = 184549376;
1209
+ function Vr(i) {
1210
+ const e = new as(i), t = zr(e);
1211
+ t.flags & Nr && Hr(e);
1212
+ const s = Qr(e);
1213
1213
  if (String.fromCharCode(...s.frameId) === "TXXX") {
1214
- const o = new cs(e.readBytes(s.size));
1214
+ const o = new as(e.readBytes(s.size));
1215
1215
  return {
1216
1216
  header: t,
1217
- txx: Gr(o)
1217
+ txx: Wr(o)
1218
1218
  };
1219
1219
  }
1220
1220
  }
1221
- function Hr(i) {
1221
+ function zr(i) {
1222
1222
  const e = i.readBytes(3), t = i.readUint8(), s = i.readUint8(), r = i.readUint8(), o = i.readUint32();
1223
1223
  return {
1224
1224
  id: e,
@@ -1228,11 +1228,11 @@ function Hr(i) {
1228
1228
  size: o
1229
1229
  };
1230
1230
  }
1231
- function Qr(i) {
1231
+ function Hr(i) {
1232
1232
  const e = i.readUint32();
1233
1233
  return i.readBytes(e - 4), {};
1234
1234
  }
1235
- function Xr(i) {
1235
+ function Qr(i) {
1236
1236
  const e = i.readBytes(4), t = i.readUint32(), s = i.readUint16();
1237
1237
  return {
1238
1238
  frameId: e,
@@ -1240,7 +1240,7 @@ function Xr(i) {
1240
1240
  flags: s
1241
1241
  };
1242
1242
  }
1243
- function Gr(i) {
1243
+ function Wr(i) {
1244
1244
  const e = i.readUint8(), t = i.readUtf8String(), s = i.readUtf8String();
1245
1245
  return {
1246
1246
  encoding: e,
@@ -1254,7 +1254,7 @@ function b(i) {
1254
1254
  t[s] = i.charCodeAt(s);
1255
1255
  return new Uint8Array(e);
1256
1256
  }
1257
- const P = {
1257
+ const x = {
1258
1258
  ftyp: b("ftyp"),
1259
1259
  mvhd: b("mvhd"),
1260
1260
  moov: b("moov"),
@@ -1294,7 +1294,7 @@ const P = {
1294
1294
  prft: b("prft"),
1295
1295
  dOps: b("dOps"),
1296
1296
  emsg: b("emsg")
1297
- }, Wr = 1e3, bt = b("iso6"), ys = new Uint8Array([0, 0, 2, 0]), jr = [
1297
+ }, Xr = 1e3, bt = b("iso6"), vs = new Uint8Array([0, 0, 2, 0]), Gr = [
1298
1298
  bt,
1299
1299
  new Uint8Array([105, 115, 111, 109]),
1300
1300
  // isom
@@ -1304,7 +1304,7 @@ const P = {
1304
1304
  // avc1
1305
1305
  new Uint8Array([109, 112, 52, 49])
1306
1306
  // mp41
1307
- ], qr = [
1307
+ ], jr = [
1308
1308
  bt,
1309
1309
  new Uint8Array([105, 115, 111, 109]),
1310
1310
  // isom
@@ -1314,7 +1314,7 @@ const P = {
1314
1314
  // av01
1315
1315
  new Uint8Array([109, 112, 52, 49])
1316
1316
  // mp41
1317
- ], Zr = [
1317
+ ], qr = [
1318
1318
  bt,
1319
1319
  new Uint8Array([105, 115, 111, 109]),
1320
1320
  // isom
@@ -1323,23 +1323,23 @@ const P = {
1323
1323
  new Uint8Array([109, 112, 52, 49])
1324
1324
  // mp41
1325
1325
  ];
1326
- class tn {
1326
+ class $s {
1327
1327
  constructor() {
1328
- n(this, "writer", new Nn());
1328
+ n(this, "writer", new On());
1329
1329
  }
1330
1330
  }
1331
1331
  const H = (i, e, t) => {
1332
1332
  i.writer.writeUint32(t + 8), i.writer.writeBytes(e);
1333
- }, X = (i, e, t, s, r) => {
1333
+ }, W = (i, e, t, s, r) => {
1334
1334
  H(i, e, t + 4), i.writer.writeUint8(s), i.writer.writeUint24(r);
1335
- }, Ci = (i, e) => {
1335
+ }, Ti = (i, e) => {
1336
1336
  H(
1337
1337
  i,
1338
- P.ftyp,
1339
- bt.byteLength + ys.byteLength + e.reduce((t, s) => t + s.byteLength, 0)
1340
- ), i.writer.writeBytes(bt), i.writer.writeBytes(ys), e.forEach((t) => i.writer.writeBytes(t));
1341
- }, Jr = (i, e, t) => {
1342
- X(i, P.mvhd, 96, 0, 0), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeUint32(t), i.writer.writeUint32(e), i.writer.writeUint32(65536), i.writer.writeUint16(256), i.writer.writeBytes(new Uint8Array([
1338
+ x.ftyp,
1339
+ bt.byteLength + vs.byteLength + e.reduce((t, s) => t + s.byteLength, 0)
1340
+ ), i.writer.writeBytes(bt), i.writer.writeBytes(vs), e.forEach((t) => i.writer.writeBytes(t));
1341
+ }, Zr = (i, e, t) => {
1342
+ W(i, x.mvhd, 96, 0, 0), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeUint32(t), i.writer.writeUint32(e), i.writer.writeUint32(65536), i.writer.writeUint16(256), i.writer.writeBytes(new Uint8Array([
1343
1343
  // reserved and unused junk
1344
1344
  0,
1345
1345
  0,
@@ -1412,9 +1412,9 @@ const H = (i, e, t) => {
1412
1412
  0,
1413
1413
  0
1414
1414
  ])), i.writer.writeUint32(2);
1415
- }, sn = (i) => "sequenceParameterSets" in i, Li = (i) => "sequenceHeader" in i, Ge = (i) => i.type == "video", gt = (i) => i.type == "audio", Yr = (i, e, t) => {
1415
+ }, en = (i) => "sequenceParameterSets" in i, Mi = (i) => "sequenceHeader" in i, Xe = (i) => i.type == "video", gt = (i) => i.type == "audio", Jr = (i, e, t) => {
1416
1416
  const s = i.writer.position();
1417
- X(i, P.tkhd, 0, 0, 3), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeUint32(e.trackId), i.writer.writeUint32(0), i.writer.writeUint32(e.duration * t / e.timescale), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeUint16(0), i.writer.writeUint16(gt(e) ? 1 : 0), i.writer.writeUint16(gt(e) ? 256 : 0), i.writer.writeUint16(0), i.writer.writeBytes(new Uint8Array(
1417
+ W(i, x.tkhd, 0, 0, 3), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeUint32(e.trackId), i.writer.writeUint32(0), i.writer.writeUint32(e.duration * t / e.timescale), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeUint16(0), i.writer.writeUint16(gt(e) ? 1 : 0), i.writer.writeUint16(gt(e) ? 256 : 0), i.writer.writeUint16(0), i.writer.writeBytes(new Uint8Array(
1418
1418
  [
1419
1419
  0,
1420
1420
  1,
@@ -1453,46 +1453,46 @@ const H = (i, e, t) => {
1453
1453
  0,
1454
1454
  0
1455
1455
  ]
1456
- )), Ge(e) ? (i.writer.writeUint32(e.width * 65536), i.writer.writeUint32(e.height * 65536)) : gt(e) && (i.writer.writeUint32(0), i.writer.writeUint32(0)), i.writer.writeUint32At(s, i.writer.position() - s);
1457
- }, Kr = (i, e) => {
1458
- X(i, P.mdhd, 20, 0, 0), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeUint32(e.timescale), i.writer.writeUint32(e.duration);
1456
+ )), Xe(e) ? (i.writer.writeUint32(e.width * 65536), i.writer.writeUint32(e.height * 65536)) : gt(e) && (i.writer.writeUint32(0), i.writer.writeUint32(0)), i.writer.writeUint32At(s, i.writer.position() - s);
1457
+ }, Yr = (i, e) => {
1458
+ W(i, x.mdhd, 20, 0, 0), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeUint32(e.timescale), i.writer.writeUint32(e.duration);
1459
1459
  const t = e.lang || "und", s = (t.charCodeAt(0) & 31) << 10 | (t.charCodeAt(1) & 31) << 5 | t.charCodeAt(2) & 31;
1460
1460
  i.writer.writeUint16(s), i.writer.writeUint16(0);
1461
- }, $r = (i, e) => {
1461
+ }, Kr = (i, e) => {
1462
1462
  const t = i.writer.position();
1463
- X(i, P.hdlr, 0, 0, 0), i.writer.writeUint32(0), i.writer.writeBytes(b(Ge(e) ? "vide" : "soun")), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeBytes(b(Ge(e) ? "VideoHandler\0" : "SoundHandler\0")), i.writer.writeUint32At(t, i.writer.position() - t);
1464
- }, eo = (i) => {
1463
+ W(i, x.hdlr, 0, 0, 0), i.writer.writeUint32(0), i.writer.writeBytes(b(Xe(e) ? "vide" : "soun")), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeBytes(b(Xe(e) ? "VideoHandler\0" : "SoundHandler\0")), i.writer.writeUint32At(t, i.writer.position() - t);
1464
+ }, $r = (i) => {
1465
1465
  const e = i.writer.position();
1466
- H(i, P.dinf, 0), X(i, P.dref, 16, 0, 0), i.writer.writeUint32(1), X(i, b("url "), 0, 0, 1), i.writer.writeUint32At(e, i.writer.position() - e);
1467
- }, to = (i, e) => {
1466
+ H(i, x.dinf, 0), W(i, x.dref, 16, 0, 0), i.writer.writeUint32(1), W(i, b("url "), 0, 0, 1), i.writer.writeUint32At(e, i.writer.position() - e);
1467
+ }, eo = (i, e) => {
1468
1468
  const t = i.writer.position();
1469
- H(i, P.avcC, 0), i.writer.writeUint8(1), i.writer.writeUint8(e.sequenceParameterSets[0][1]), i.writer.writeUint8(e.sequenceParameterSets[0][2]), i.writer.writeUint8(e.sequenceParameterSets[0][3]), i.writer.writeUint8(255), i.writer.writeUint8(224 | e.sequenceParameterSets.length), e.sequenceParameterSets.forEach((s) => {
1469
+ H(i, x.avcC, 0), i.writer.writeUint8(1), i.writer.writeUint8(e.sequenceParameterSets[0][1]), i.writer.writeUint8(e.sequenceParameterSets[0][2]), i.writer.writeUint8(e.sequenceParameterSets[0][3]), i.writer.writeUint8(255), i.writer.writeUint8(224 | e.sequenceParameterSets.length), e.sequenceParameterSets.forEach((s) => {
1470
1470
  i.writer.writeUint16(s.byteLength), i.writer.writeBytes(s);
1471
1471
  }), i.writer.writeUint8(e.pictureParameterSets.length), e.pictureParameterSets.forEach((s) => {
1472
1472
  i.writer.writeUint16(s.byteLength), i.writer.writeBytes(s);
1473
1473
  }), i.writer.writeUint32At(t, i.writer.position() - t);
1474
- }, io = (i, e) => {
1474
+ }, to = (i, e) => {
1475
1475
  var c, h;
1476
1476
  const t = i.writer.position();
1477
- H(i, P.av1C, 0);
1477
+ H(i, x.av1C, 0);
1478
1478
  const { seqProfile: s, operatingPoints: r, colorConfig: o } = e.parsedSequenceHeader, a = r[0];
1479
1479
  i.writer.writeUint8(129), i.writer.writeUint8(s << 5 | ((c = a == null ? void 0 : a.seqLevelIdx) != null ? c : 0)), i.writer.writeUint8(
1480
1480
  ((h = a == null ? void 0 : a.tier) != null ? h : 0) | (o.highBitDepth ? 1 : 0) | (o.bitDepth === 12 ? 1 : 0) << 5 | (o.monoChrome ? 1 : 0) << 4 | o.subsamplingX << 3 | o.subsamplingY << 2 | o.chromaSamplePosition & 65535
1481
1481
  ), i.writer.writeUint8(0), i.writer.writeBytes(e.sequenceHeader), i.writer.writeUint32At(t, i.writer.position() - t);
1482
- }, so = (i, e) => {
1483
- const t = i.writer.position(), s = Li(e) ? P.av01 : P.avc1;
1484
- H(i, s, 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(e.width), i.writer.writeUint16(e.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), sn(e) ? to(i, e) : Li(e) && (io(i, e), e.parsedSequenceHeader.colorConfig && (H(i, b("colr"), 11), i.writer.writeBytes(P.nclx), i.writer.writeUint16(e.parsedSequenceHeader.colorConfig.colorPrimaries), i.writer.writeUint16(e.parsedSequenceHeader.colorConfig.transferCharacteristics), i.writer.writeUint16(e.parsedSequenceHeader.colorConfig.matrixCoefficients), i.writer.writeUint8(e.parsedSequenceHeader.colorConfig.colorRange ? 1 : 0))), e.pixelAspectRatio && (H(i, b("pasp"), 8), i.writer.writeUint32(e.pixelAspectRatio.numerator), i.writer.writeUint32(e.pixelAspectRatio.denumerator)), e.bitrate && (H(i, b("btrt"), 12), i.writer.writeUint32(0), i.writer.writeUint32(e.bitrate), i.writer.writeUint32(e.bitrate)), i.writer.writeUint32At(t, i.writer.position() - t);
1482
+ }, io = (i, e) => {
1483
+ const t = i.writer.position(), s = Mi(e) ? x.av01 : x.avc1;
1484
+ H(i, s, 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(e.width), i.writer.writeUint16(e.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), en(e) ? eo(i, e) : Mi(e) && (to(i, e), e.parsedSequenceHeader.colorConfig && (H(i, b("colr"), 11), i.writer.writeBytes(x.nclx), i.writer.writeUint16(e.parsedSequenceHeader.colorConfig.colorPrimaries), i.writer.writeUint16(e.parsedSequenceHeader.colorConfig.transferCharacteristics), i.writer.writeUint16(e.parsedSequenceHeader.colorConfig.matrixCoefficients), i.writer.writeUint8(e.parsedSequenceHeader.colorConfig.colorRange ? 1 : 0))), e.pixelAspectRatio && (H(i, b("pasp"), 8), i.writer.writeUint32(e.pixelAspectRatio.numerator), i.writer.writeUint32(e.pixelAspectRatio.denumerator)), e.bitrate && (H(i, b("btrt"), 12), i.writer.writeUint32(0), i.writer.writeUint32(e.bitrate), i.writer.writeUint32(e.bitrate)), i.writer.writeUint32At(t, i.writer.position() - t);
1485
1485
  }, Dt = (i, e, t) => {
1486
1486
  let s = 3;
1487
1487
  for (i.writer.writeUint8(e); s > 0; s--)
1488
1488
  i.writer.writeUint8(t >> 7 * s | 128);
1489
1489
  i.writer.writeUint8(t & 127);
1490
- }, no = (i, e) => {
1490
+ }, so = (i, e) => {
1491
1491
  const t = e.decoderConfig.byteLength > 0 ? e.decoderConfig.byteLength + 5 : 0, s = i.writer.position();
1492
- X(i, P.esds, 0, 0, 0), Dt(i, 3, 21 + t + 5 + 1), i.writer.writeUint16(e.trackId), i.writer.writeUint8(0), Dt(i, 4, 13 + t);
1492
+ W(i, x.esds, 0, 0, 0), Dt(i, 3, 21 + t + 5 + 1), i.writer.writeUint16(e.trackId), i.writer.writeUint8(0), Dt(i, 4, 13 + t);
1493
1493
  const r = e.codec === "mp3" && e.sampleRate > 24e3 ? 107 : 64;
1494
1494
  i.writer.writeUint8(r), i.writer.writeUint8(21), i.writer.writeUint24(0), i.writer.writeUint32(e.bitrate || 0), i.writer.writeUint32(e.bitrate || 0), e.decoderConfig.byteLength > 0 && (Dt(i, 5, e.decoderConfig.byteLength), i.writer.writeBytes(e.decoderConfig)), Dt(i, 6, 1), i.writer.writeUint8(2), i.writer.writeUint32At(s, i.writer.position() - s);
1495
- }, ro = (i) => {
1495
+ }, no = (i) => {
1496
1496
  switch (i) {
1497
1497
  case "aac":
1498
1498
  case "mp3":
@@ -1500,91 +1500,91 @@ const H = (i, e, t) => {
1500
1500
  case "opus":
1501
1501
  return "Opus";
1502
1502
  }
1503
- }, oo = (i, e) => {
1503
+ }, ro = (i, e) => {
1504
1504
  const t = i.writer.position();
1505
1505
  H(i, b("dOps"), 0), i.writer.writeUint8(0);
1506
1506
  const s = e.decoderConfig, r = new DataView(s.buffer, s.byteOffset, s.byteLength);
1507
1507
  i.writer.writeUint8(r.getUint8(9)), i.writer.writeUint16(r.getUint16(10, !0)), i.writer.writeUint32(r.getUint32(12, !0)), i.writer.writeUint16(r.getUint16(16, !0)), i.writer.writeBytes(e.decoderConfig.slice(18)), i.writer.writeUint32At(t, i.writer.position() - t);
1508
- }, ao = (i, e) => {
1508
+ }, oo = (i, e) => {
1509
1509
  const t = i.writer.position();
1510
- switch (H(i, b(ro(e.codec)), 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.writeUint16(e.channelCount), i.writer.writeUint16(16), i.writer.writeUint32(0), i.writer.writeUint16(e.sampleRate), i.writer.writeUint16(0), e.codec) {
1510
+ switch (H(i, b(no(e.codec)), 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.writeUint16(e.channelCount), i.writer.writeUint16(16), i.writer.writeUint32(0), i.writer.writeUint16(e.sampleRate), i.writer.writeUint16(0), e.codec) {
1511
1511
  case "aac":
1512
1512
  case "mp3":
1513
- no(i, e);
1513
+ so(i, e);
1514
1514
  break;
1515
1515
  case "opus":
1516
- oo(i, e);
1516
+ ro(i, e);
1517
1517
  break;
1518
1518
  }
1519
1519
  e.bitrate && (H(i, b("btrt"), 12), i.writer.writeUint32(0), i.writer.writeUint32(e.bitrate), i.writer.writeUint32(e.bitrate)), i.writer.writeUint32At(t, i.writer.position() - t);
1520
- }, co = (i, e) => {
1520
+ }, ao = (i, e) => {
1521
1521
  const t = i.writer.position();
1522
- H(i, P.stbl, 0);
1522
+ H(i, x.stbl, 0);
1523
1523
  const s = i.writer.position();
1524
- X(i, P.stsd, 0, 0, 0), i.writer.writeUint32(1), Ge(e) ? so(i, e) : gt(e) && ao(i, e), i.writer.writeUint32At(s, i.writer.position() - s), X(i, b("stts"), 4, 0, 0), i.writer.writeUint32(0), X(i, b("stsc"), 4, 0, 0), i.writer.writeUint32(0), X(i, b("stsz"), 8, 0, 0), i.writer.writeUint32(0), i.writer.writeUint32(0), X(i, b("stco"), 4, 0, 0), i.writer.writeUint32(0), i.writer.writeUint32At(t, i.writer.position() - t);
1525
- }, ho = (i, e) => {
1524
+ W(i, x.stsd, 0, 0, 0), i.writer.writeUint32(1), Xe(e) ? io(i, e) : gt(e) && oo(i, e), i.writer.writeUint32At(s, i.writer.position() - s), W(i, b("stts"), 4, 0, 0), i.writer.writeUint32(0), W(i, b("stsc"), 4, 0, 0), i.writer.writeUint32(0), W(i, b("stsz"), 8, 0, 0), i.writer.writeUint32(0), i.writer.writeUint32(0), W(i, b("stco"), 4, 0, 0), i.writer.writeUint32(0), i.writer.writeUint32At(t, i.writer.position() - t);
1525
+ }, co = (i, e) => {
1526
1526
  const t = i.writer.position();
1527
- H(i, P.minf, 0), Ge(e) ? (X(i, P.vmhd, 8, 0, 1), i.writer.writeUint32(0), i.writer.writeUint32(0)) : gt(e) && (X(i, P.smhd, 4, 0, 0), i.writer.writeUint16(0), i.writer.writeUint16(0)), eo(i), co(i, e), i.writer.writeUint32At(t, i.writer.position() - t);
1528
- }, uo = (i, e) => {
1527
+ H(i, x.minf, 0), Xe(e) ? (W(i, x.vmhd, 8, 0, 1), i.writer.writeUint32(0), i.writer.writeUint32(0)) : gt(e) && (W(i, x.smhd, 4, 0, 0), i.writer.writeUint16(0), i.writer.writeUint16(0)), $r(i), ao(i, e), i.writer.writeUint32At(t, i.writer.position() - t);
1528
+ }, ho = (i, e) => {
1529
1529
  const t = i.writer.position();
1530
- H(i, P.mdia, 0), Kr(i, e), $r(i, e), ho(i, e), i.writer.writeUint32At(t, i.writer.position() - t);
1531
- }, lo = (i, e, t) => {
1530
+ H(i, x.mdia, 0), Yr(i, e), Kr(i, e), co(i, e), i.writer.writeUint32At(t, i.writer.position() - t);
1531
+ }, uo = (i, e, t) => {
1532
1532
  const s = i.writer.position();
1533
- H(i, P.trak, 0), Yr(i, e, t), uo(i, e), i.writer.writeUint32At(s, i.writer.position() - s);
1533
+ H(i, x.trak, 0), Jr(i, e, t), ho(i, e), i.writer.writeUint32At(s, i.writer.position() - s);
1534
+ }, lo = (i, e) => {
1535
+ W(i, x.trex, 20, 0, 0), i.writer.writeUint32(e.trackId), i.writer.writeUint32(1), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeUint32(0);
1534
1536
  }, mo = (i, e) => {
1535
- X(i, P.trex, 20, 0, 0), i.writer.writeUint32(e.trackId), i.writer.writeUint32(1), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeUint32(0);
1536
- }, fo = (i, e) => {
1537
1537
  const t = i.writer.position();
1538
- H(i, P.mvex, 0), e.forEach((s) => mo(i, s)), i.writer.writeUint32At(t, i.writer.position() - t);
1539
- }, Ao = (i, e, t, s) => {
1538
+ H(i, x.mvex, 0), e.forEach((s) => lo(i, s)), i.writer.writeUint32At(t, i.writer.position() - t);
1539
+ }, fo = (i, e, t, s) => {
1540
1540
  const r = i.writer.position();
1541
- H(i, P.moov, 0), Jr(i, 0, t), e.forEach((o) => lo(i, o, t)), fo(i, e), i.writer.writeUint32At(r, i.writer.position() - r);
1542
- }, go = (i, e) => {
1541
+ H(i, x.moov, 0), Zr(i, 0, t), e.forEach((o) => uo(i, o, t)), mo(i, e), i.writer.writeUint32At(r, i.writer.position() - r);
1542
+ }, Ao = (i, e) => {
1543
1543
  const t = i.writer.position();
1544
- X(i, P.tfhd, 16, 0, 56), i.writer.writeUint32(e.trackId), i.writer.writeUint32(e.defaultDuration || 0), i.writer.writeUint32(e.defaultSize || 0), i.writer.writeUint32(e.defaultFlags || 0), i.writer.writeUint32At(t, i.writer.position() - t);
1545
- }, po = (i, e) => {
1544
+ W(i, x.tfhd, 16, 0, 56), i.writer.writeUint32(e.trackId), i.writer.writeUint32(e.defaultDuration || 0), i.writer.writeUint32(e.defaultSize || 0), i.writer.writeUint32(e.defaultFlags || 0), i.writer.writeUint32At(t, i.writer.position() - t);
1545
+ }, go = (i, e) => {
1546
1546
  const t = i.writer.position();
1547
- X(i, P.tfdt, 8, 1, 0);
1547
+ W(i, x.tfdt, 8, 1, 0);
1548
1548
  const s = Math.floor(e.timestamp / 4294967296), r = (e.timestamp & 4294967295) >>> 0;
1549
1549
  i.writer.writeUint32(s), i.writer.writeUint32(r), i.writer.writeUint32At(t, i.writer.position() - t);
1550
- }, wo = (i, e) => {
1550
+ }, po = (i, e) => {
1551
1551
  if (!e.samples[0])
1552
1552
  throw new Error("At least one sample must be provided");
1553
- const t = e.samples.some((h) => !!h.compositionTimeOffset), s = Ii(e.samples[0]) !== e.defaultFlags, r = e.samples.length > 1;
1553
+ const t = e.samples.some((h) => !!h.compositionTimeOffset), s = Ci(e.samples[0]) !== e.defaultFlags, r = e.samples.length > 1;
1554
1554
  let o = 1;
1555
1555
  s && (o |= 4), t && (o |= 2048), r && (o |= 512, o |= 256, o |= 1024);
1556
1556
  const a = i.writer.position();
1557
- X(i, P.trun, 16, 1, o), i.writer.writeUint32(e.samples.length);
1557
+ W(i, x.trun, 16, 1, o), i.writer.writeUint32(e.samples.length);
1558
1558
  const c = i.writer.position();
1559
- i.writer.writeUint32(0), s && i.writer.writeUint32(Ii(e.samples[0]));
1559
+ i.writer.writeUint32(0), s && i.writer.writeUint32(Ci(e.samples[0]));
1560
1560
  for (const h of e.samples)
1561
- r && (i.writer.writeUint32(h.duration), i.writer.writeUint32(h.data.byteLength), i.writer.writeUint32(Ii(h))), t && i.writer.writeUint32(h.compositionTimeOffset || 0);
1561
+ r && (i.writer.writeUint32(h.duration), i.writer.writeUint32(h.data.byteLength), i.writer.writeUint32(Ci(h))), t && i.writer.writeUint32(h.compositionTimeOffset || 0);
1562
1562
  i.writer.writeUint32At(c, i.writer.position() + 8), i.writer.writeUint32At(a, i.writer.position() - a);
1563
- }, Ii = (i) => i.isSync ? 33554432 : 16842752, So = (i, e) => {
1563
+ }, Ci = (i) => i.isSync ? 33554432 : 16842752, wo = (i, e) => {
1564
1564
  const t = i.writer.position();
1565
- H(i, P.traf, 0), go(i, e), po(i, e), wo(i, e), i.writer.writeUint32At(t, i.writer.position() - t);
1565
+ H(i, x.traf, 0), Ao(i, e), go(i, e), po(i, e), i.writer.writeUint32At(t, i.writer.position() - t);
1566
+ }, So = (i, e) => {
1567
+ W(i, x.mfhd, 4, 0, 0), i.writer.writeUint32(e);
1566
1568
  }, vo = (i, e) => {
1567
- X(i, P.mfhd, 4, 0, 0), i.writer.writeUint32(e);
1568
- }, bo = (i, e) => {
1569
1569
  const t = i.writer.position();
1570
- H(i, P.moof, 0), vo(i, e.sequenceNumber), So(i, e), i.writer.writeUint32At(t, i.writer.position() - t);
1571
- }, yo = (i, e) => {
1570
+ H(i, x.moof, 0), So(i, e.sequenceNumber), wo(i, e), i.writer.writeUint32At(t, i.writer.position() - t);
1571
+ }, bo = (i, e) => {
1572
1572
  const t = e.samples.reduce((s, r) => s + r.data.byteLength, 0);
1573
- H(i, P.mdat, t), e.samples.forEach((s) => i.writer.writeBytes(s.data));
1574
- }, vi = (i, e) => {
1575
- const t = new tn(), s = i.filter((o) => Ge(o) && sn(o)).length > 0;
1576
- return i.filter((o) => Ge(o) && Li(o)).length > 0 ? Ci(t, qr) : s ? Ci(t, jr) : Ci(t, Zr), Ao(t, i, Wr), t.writer.buffer();
1577
- }, bi = (i) => {
1578
- const e = new tn();
1579
- return bo(e, i), yo(e, i), e.writer.buffer();
1580
- }, Eo = (i, e) => {
1573
+ H(i, x.mdat, t), e.samples.forEach((s) => i.writer.writeBytes(s.data));
1574
+ }, Si = (i, e) => {
1575
+ const t = new $s(), s = i.filter((o) => Xe(o) && en(o)).length > 0;
1576
+ return i.filter((o) => Xe(o) && Mi(o)).length > 0 ? Ti(t, jr) : s ? Ti(t, Gr) : Ti(t, qr), fo(t, i, Xr), t.writer.buffer();
1577
+ }, vi = (i) => {
1578
+ const e = new $s();
1579
+ return vo(e, i), bo(e, i), e.writer.buffer();
1580
+ }, yo = (i, e) => {
1581
1581
  const t = i.map((a) => R(A({}, a), {
1582
1582
  data: new Uint8Array(a.data)
1583
1583
  }));
1584
1584
  if (!t[0])
1585
1585
  throw new Error("At least one sample must be provided");
1586
1586
  const { timestamp: s, data: r, duration: o } = t[0];
1587
- return bi({
1587
+ return vi({
1588
1588
  trackId: 1,
1589
1589
  timestamp: s,
1590
1590
  sequenceNumber: e,
@@ -1593,7 +1593,7 @@ const H = (i, e, t) => {
1593
1593
  defaultDuration: o,
1594
1594
  samples: t
1595
1595
  });
1596
- }, To = (i, e, t, s) => vi([
1596
+ }, Eo = (i, e, t, s) => Si([
1597
1597
  {
1598
1598
  type: "audio",
1599
1599
  codec: "aac",
@@ -1604,19 +1604,19 @@ const H = (i, e, t) => {
1604
1604
  duration: 0,
1605
1605
  trackId: 1
1606
1606
  }
1607
- ]), nn = (i) => {
1608
- const { sequenceParameterSets: e, pictureParameterSets: t } = en(i), s = e[0], r = t[0];
1607
+ ]), tn = (i) => {
1608
+ const { sequenceParameterSets: e, pictureParameterSets: t } = Ks(i), s = e[0], r = t[0];
1609
1609
  if (!s || !r)
1610
1610
  throw new Error("No sps or pps provided");
1611
1611
  return Or(s);
1612
- }, Co = (i, e) => {
1612
+ }, To = (i, e) => {
1613
1613
  const t = i.map((c) => R(A({}, c), {
1614
1614
  data: new Uint8Array(c.data)
1615
1615
  }));
1616
1616
  if (!t[0])
1617
1617
  throw new Error("At least one sample must be provided");
1618
1618
  const { isSync: s, timestamp: r, data: o, duration: a } = t[0];
1619
- return bi({
1619
+ return vi({
1620
1620
  trackId: 1,
1621
1621
  timestamp: r,
1622
1622
  sequenceNumber: e,
@@ -1625,9 +1625,9 @@ const H = (i, e, t) => {
1625
1625
  defaultDuration: a,
1626
1626
  samples: t
1627
1627
  });
1628
- }, Io = (i, e) => {
1629
- const { sequenceParameterSets: t, pictureParameterSets: s } = en(i), r = nn(i);
1630
- return vi([
1628
+ }, Co = (i, e) => {
1629
+ const { sequenceParameterSets: t, pictureParameterSets: s } = Ks(i), r = tn(i);
1630
+ return Si([
1631
1631
  {
1632
1632
  type: "video",
1633
1633
  sequenceParameterSets: t.map((o) => new Uint8Array(o)),
@@ -1639,7 +1639,7 @@ const H = (i, e, t) => {
1639
1639
  trackId: 1
1640
1640
  }
1641
1641
  ]);
1642
- }, Bo = (i, e, t) => vi([
1642
+ }, Io = (i, e, t) => Si([
1643
1643
  {
1644
1644
  type: "audio",
1645
1645
  trackId: 1,
@@ -1650,14 +1650,14 @@ const H = (i, e, t) => {
1650
1650
  duration: 0,
1651
1651
  sampleRate: 48e3
1652
1652
  }
1653
- ]), Ro = (i, e) => {
1653
+ ]), Bo = (i, e) => {
1654
1654
  const t = i.map((a) => R(A({}, a), {
1655
1655
  data: new Uint8Array(a.data)
1656
1656
  }));
1657
1657
  if (!t[0])
1658
1658
  throw new Error("At least one sample must be provided");
1659
1659
  const { timestamp: s, data: r, duration: o } = t[0];
1660
- return bi({
1660
+ return vi({
1661
1661
  trackId: 1,
1662
1662
  timestamp: s,
1663
1663
  sequenceNumber: e,
@@ -1666,10 +1666,10 @@ const H = (i, e, t) => {
1666
1666
  defaultDuration: o,
1667
1667
  samples: t
1668
1668
  });
1669
- }, rn = (i) => {
1670
- const e = new Vs(i);
1671
- return e.peekBit() === 1 && e.readBits(32), xo(e), No(e);
1672
- }, ko = (i) => {
1669
+ }, sn = (i) => {
1670
+ const e = new Fs(i);
1671
+ return e.peekBit() === 1 && e.readBits(32), Po(e), Fo(e);
1672
+ }, Ro = (i) => {
1673
1673
  let e = 0;
1674
1674
  for (let t = 0; t < 8; t++) {
1675
1675
  const s = i.readBits(8);
@@ -1677,55 +1677,55 @@ const H = (i, e, t) => {
1677
1677
  break;
1678
1678
  }
1679
1679
  return e;
1680
- }, Po = (i) => {
1680
+ }, ko = (i) => {
1681
1681
  let e = 0;
1682
1682
  for (; e < 100 && i.readBit() === 0; )
1683
1683
  e++;
1684
1684
  return e >= 32 ? 0 : i.readBits(e) + (1 << e) - 1;
1685
- }, xo = (i) => {
1685
+ }, Po = (i) => {
1686
1686
  const e = i.readBits(8);
1687
1687
  if ((e >> 7 & 1) !== 0)
1688
1688
  return;
1689
1689
  const s = e >> 3 & 15, r = e >> 2 & 1, o = e >> 1 & 1;
1690
- return r == 1 && i.readBits(8), o == 1 && ko(i), {
1690
+ return r == 1 && i.readBits(8), o == 1 && Ro(i), {
1691
1691
  headerLength: 1 + r,
1692
1692
  type: s
1693
1693
  };
1694
- }, Uo = (i) => {
1694
+ }, xo = (i) => {
1695
1695
  const e = i.readBits(32), t = i.readBits(32), s = i.readBit() !== 0;
1696
1696
  let r = 0;
1697
- return s && (r = Po(i) + 1), {
1697
+ return s && (r = ko(i) + 1), {
1698
1698
  timescale: t,
1699
1699
  equalPictureInterval: s,
1700
1700
  numUnitsInDisplayTick: e,
1701
1701
  numTicksPerPicture: r
1702
1702
  };
1703
- }, Es = 2, Bi = 2, Mo = 1, Lo = 2, _o = 2, Do = 13, Fo = 0, Oo = 2, Ts = 0, No = (i) => {
1703
+ }, bs = 2, Ii = 2, Uo = 1, Mo = 2, Lo = 2, _o = 13, Do = 0, Oo = 2, ys = 0, Fo = (i) => {
1704
1704
  const e = i.readBits(3), s = i.readBit() !== 0, r = i.readBit() !== 0;
1705
1705
  let o, a = !1, c = !1, h = !1, u = 0, l = 0;
1706
1706
  const m = [];
1707
1707
  if (r)
1708
1708
  i.readBits(5);
1709
1709
  else {
1710
- if (c = i.readBit() !== 0, c && (o = Uo(i), a = i.readBit() !== 0, a))
1710
+ if (c = i.readBit() !== 0, c && (o = xo(i), a = i.readBit() !== 0, a))
1711
1711
  throw new Error("Not implemented");
1712
1712
  h = i.readBit() !== 0;
1713
- const C = i.readBits(5) + 1;
1714
- for (let D = 0; D < C; D++) {
1715
- const ie = i.readBits(12), F = i.readBits(5);
1713
+ const I = i.readBits(5) + 1;
1714
+ for (let D = 0; D < I; D++) {
1715
+ const ie = i.readBits(12), O = i.readBits(5);
1716
1716
  let Q = 0;
1717
- if (F > 7 && (Q = i.readBit()), a)
1717
+ if (O > 7 && (Q = i.readBit()), a)
1718
1718
  throw new Error("decoderModelInfoPresentFlag==1");
1719
- h && i.readBit() !== 0 && i.readBits(4), m.push({ tier: Q, operatingPointIdc: ie, seqLevelIdx: F });
1719
+ h && i.readBit() !== 0 && i.readBits(4), m.push({ tier: Q, operatingPointIdc: ie, seqLevelIdx: O });
1720
1720
  }
1721
1721
  }
1722
- const g = i.readBits(4) + 1, w = i.readBits(4) + 1, E = i.readBits(g) + 1, M = i.readBits(w) + 1;
1722
+ const g = i.readBits(4) + 1, p = i.readBits(4) + 1, y = i.readBits(g) + 1, U = i.readBits(p) + 1;
1723
1723
  let N = !1;
1724
1724
  r ? N = !1 : N = i.readBit() !== 0, N && (u = i.readBits(4) + 2, l = i.readBits(3) + 1);
1725
- const G = i.readBit() !== 0, L = i.readBit() !== 0, _ = i.readBit() !== 0;
1726
- let Z = !1, te = !1, me = !1, Mt = !1, fe = !1, lt = !1, Lt = !1, xe = Es, Ue = Bi, f = 0;
1727
- r || (Z = i.readBit() !== 0, te = i.readBit() !== 0, me = i.readBit() !== 0, Mt = i.readBit() !== 0, fe = i.readBit() !== 0, fe && (lt = i.readBit() !== 0, Lt = i.readBit() !== 0), i.readBit() !== 0 ? xe = Es : xe = i.readBit(), xe > 0 ? i.readBit() > 0 ? Ue = Bi : Ue = i.readBit() : Ue = Bi, fe ? f = i.readBits(3) : f = 0);
1728
- const v = i.readBit() !== 0, U = i.readBit() !== 0, x = i.readBit() !== 0;
1725
+ const X = i.readBit() !== 0, L = i.readBit() !== 0, _ = i.readBit() !== 0;
1726
+ let Z = !1, te = !1, me = !1, Mt = !1, fe = !1, lt = !1, Lt = !1, xe = bs, Ue = Ii, f = 0;
1727
+ r || (Z = i.readBit() !== 0, te = i.readBit() !== 0, me = i.readBit() !== 0, Mt = i.readBit() !== 0, fe = i.readBit() !== 0, fe && (lt = i.readBit() !== 0, Lt = i.readBit() !== 0), i.readBit() !== 0 ? xe = bs : xe = i.readBit(), xe > 0 ? i.readBit() > 0 ? Ue = Ii : Ue = i.readBit() : Ue = Ii, fe ? f = i.readBits(3) : f = 0);
1728
+ const v = i.readBit() !== 0, M = i.readBit() !== 0, P = i.readBit() !== 0;
1729
1729
  return {
1730
1730
  seqProfile: e,
1731
1731
  stillPicture: s,
@@ -1741,13 +1741,13 @@ const H = (i, e, t) => {
1741
1741
  initialDisplayDelayPresentFlag: h,
1742
1742
  operatingPoints: m,
1743
1743
  frameWidthBits: g,
1744
- frameHeightBits: w,
1745
- maxFrameWidth: E,
1746
- maxFrameHeight: M,
1744
+ frameHeightBits: p,
1745
+ maxFrameWidth: y,
1746
+ maxFrameHeight: U,
1747
1747
  frameIdNumbersPresentFlag: N,
1748
1748
  deltaFrameIdLength: u,
1749
1749
  additionalFrameIdLength: l,
1750
- use_128x128Superblock: G,
1750
+ use_128x128Superblock: X,
1751
1751
  enableFilterIntra: L,
1752
1752
  enableIntraEdgeFilter: _,
1753
1753
  enableInterintraCompound: Z,
@@ -1761,72 +1761,72 @@ const H = (i, e, t) => {
1761
1761
  seqForceIntegerMv: Ue,
1762
1762
  orderHintBits: f,
1763
1763
  enableSuperres: v,
1764
- enableCdef: U,
1765
- enableRestoration: x,
1766
- colorConfig: Vo(i, e),
1764
+ enableCdef: M,
1765
+ enableRestoration: P,
1766
+ colorConfig: No(i, e),
1767
1767
  filmGrainParamsPresent: i.readBit() !== 0
1768
1768
  };
1769
- }, Vo = (i, e) => {
1769
+ }, No = (i, e) => {
1770
1770
  const t = i.readBit() !== 0;
1771
1771
  let s = 8, r = !1;
1772
1772
  e === 2 && t ? s = i.readBit() !== 0 ? 12 : 10 : e <= 2 && (s = t ? 10 : 8), e === 1 ? r = !1 : r = i.readBit() !== 0;
1773
1773
  const o = r ? 1 : 3, a = i.readBit() !== 0;
1774
- let c = Lo, h = _o, u = Oo, l = !1, m = 0, g = 0, w = Ts, E = !1;
1775
- return a && (c = i.readBits(8), h = i.readBits(8), u = i.readBits(8)), r ? (l = i.readBit() !== 0, m = 1, g = 1, w = Ts, E = !1, {
1774
+ let c = Mo, h = Lo, u = Oo, l = !1, m = 0, g = 0, p = ys, y = !1;
1775
+ return a && (c = i.readBits(8), h = i.readBits(8), u = i.readBits(8)), r ? (l = i.readBit() !== 0, m = 1, g = 1, p = ys, y = !1, {
1776
1776
  highBitDepth: t,
1777
1777
  bitDepth: s,
1778
1778
  monoChrome: r,
1779
- chromaSamplePosition: w,
1779
+ chromaSamplePosition: p,
1780
1780
  colorPrimaries: c,
1781
1781
  colorRange: l,
1782
1782
  matrixCoefficients: u,
1783
1783
  numPlanes: o,
1784
- separateUvDeltaQ: E,
1784
+ separateUvDeltaQ: y,
1785
1785
  subsamplingX: m,
1786
1786
  subsamplingY: g,
1787
1787
  transferCharacteristics: h
1788
- }) : c === Mo && h == Do && u == Fo ? (l = !0, m = 0, g = 0, {
1788
+ }) : c === Uo && h == _o && u == Do ? (l = !0, m = 0, g = 0, {
1789
1789
  highBitDepth: t,
1790
1790
  bitDepth: s,
1791
1791
  monoChrome: r,
1792
- chromaSamplePosition: w,
1792
+ chromaSamplePosition: p,
1793
1793
  colorPrimaries: c,
1794
1794
  colorRange: l,
1795
1795
  matrixCoefficients: u,
1796
1796
  numPlanes: o,
1797
- separateUvDeltaQ: E,
1797
+ separateUvDeltaQ: y,
1798
1798
  subsamplingX: m,
1799
1799
  subsamplingY: g,
1800
1800
  transferCharacteristics: h
1801
- }) : (l = i.readBit() !== 0, e === 0 ? (m = 1, g = 1) : e === 1 ? (m = 0, g = 0) : s === 12 ? (m = i.readBit(), m !== 0 ? g = i.readBit() : g = 0) : (m = 1, g = 0), m !== 0 && g !== 0 && (w = i.readBits(2)), E = i.readBit() !== 0, {
1801
+ }) : (l = i.readBit() !== 0, e === 0 ? (m = 1, g = 1) : e === 1 ? (m = 0, g = 0) : s === 12 ? (m = i.readBit(), m !== 0 ? g = i.readBit() : g = 0) : (m = 1, g = 0), m !== 0 && g !== 0 && (p = i.readBits(2)), y = i.readBit() !== 0, {
1802
1802
  highBitDepth: t,
1803
1803
  bitDepth: s,
1804
1804
  monoChrome: r,
1805
- chromaSamplePosition: w,
1805
+ chromaSamplePosition: p,
1806
1806
  colorPrimaries: c,
1807
1807
  colorRange: l,
1808
1808
  matrixCoefficients: u,
1809
1809
  numPlanes: o,
1810
- separateUvDeltaQ: E,
1810
+ separateUvDeltaQ: y,
1811
1811
  subsamplingX: m,
1812
1812
  subsamplingY: g,
1813
1813
  transferCharacteristics: h
1814
1814
  });
1815
- }, zo = (i) => {
1816
- const e = rn(i);
1815
+ }, Vo = (i) => {
1816
+ const e = sn(i);
1817
1817
  if (e)
1818
1818
  return {
1819
1819
  width: e.maxFrameWidth,
1820
1820
  height: e.maxFrameHeight
1821
1821
  };
1822
- }, Ho = (i, e) => {
1822
+ }, zo = (i, e) => {
1823
1823
  const t = i.map((c) => R(A({}, c), {
1824
1824
  data: new Uint8Array(c.data)
1825
1825
  }));
1826
1826
  if (!t[0])
1827
1827
  throw new Error("At least one sample must be provided");
1828
1828
  const { isSync: s, timestamp: r, data: o, duration: a } = t[0];
1829
- return bi({
1829
+ return vi({
1830
1830
  trackId: 1,
1831
1831
  timestamp: r,
1832
1832
  sequenceNumber: e,
@@ -1835,11 +1835,11 @@ const H = (i, e, t) => {
1835
1835
  defaultDuration: a,
1836
1836
  samples: t
1837
1837
  });
1838
- }, Qo = (i, e) => {
1839
- const t = rn(i);
1838
+ }, Ho = (i, e) => {
1839
+ const t = sn(i);
1840
1840
  if (!t)
1841
1841
  throw new Error("Failed to parse sequence header");
1842
- return vi([
1842
+ return Si([
1843
1843
  {
1844
1844
  type: "video",
1845
1845
  parsedSequenceHeader: t,
@@ -1851,46 +1851,46 @@ const H = (i, e, t) => {
1851
1851
  trackId: 1
1852
1852
  }
1853
1853
  ]);
1854
- }, Xo = (i, e, t) => {
1854
+ }, Qo = (i, e, t) => {
1855
1855
  switch (i) {
1856
1856
  case "h264":
1857
- return Wo(e, t);
1857
+ return Xo(e, t);
1858
1858
  case "av1":
1859
- return jo(e, t);
1859
+ return Go(e, t);
1860
1860
  case "opus":
1861
- return qo(e, t);
1861
+ return jo(e, t);
1862
1862
  case "aac":
1863
- return Zo(e, t);
1863
+ return qo(e, t);
1864
1864
  default:
1865
1865
  throw new Error(`Failed to initialize ${i} segment`);
1866
1866
  }
1867
- }, Go = (i, e) => {
1867
+ }, Wo = (i, e) => {
1868
1868
  switch (i) {
1869
1869
  case "h264":
1870
- return nn(e);
1870
+ return tn(e);
1871
1871
  case "av1":
1872
- return zo(e);
1872
+ return Vo(e);
1873
1873
  }
1874
- }, Wo = (i, e) => Io(i, e), jo = (i, e) => Qo(i, e), qo = (i, e) => Bo(new Uint8Array(i), 2, e), Zo = (i, e) => To(new Uint8Array(i), 2, e, e), Jo = (i, e) => {
1874
+ }, Xo = (i, e) => Co(i, e), Go = (i, e) => Ho(i, e), jo = (i, e) => Io(new Uint8Array(i), 2, e), qo = (i, e) => Eo(new Uint8Array(i), 2, e, e), Zo = (i, e) => {
1875
1875
  if (!i[0])
1876
1876
  throw new Error("At least one sample must be provided");
1877
1877
  switch (i[0].codec) {
1878
1878
  case "h264":
1879
- return Co(i, e);
1879
+ return To(i, e);
1880
1880
  case "opus":
1881
- return Ro(i, e);
1881
+ return Bo(i, e);
1882
1882
  case "aac":
1883
- return Eo(i, e);
1883
+ return yo(i, e);
1884
1884
  case "av1":
1885
- return Ho(i, e);
1885
+ return zo(i, e);
1886
1886
  default:
1887
1887
  throw new Error(`Unsupported codec ${i[0].codec}`);
1888
1888
  }
1889
- }, pt = (i) => !!(i & 1), Yo = (i) => !!(i & 2), Ko = (i) => !!(i & 4), $o = (i) => !!(i & 8), ea = (i) => !!(i & 16), ta = (i) => {
1890
- const e = new DataView(i, 0), t = e.getUint8(0), s = e.getUint16(1), r = e.getUint8(3), o = e.getUint8(4), a = Hs(new Uint8Array(i), 5, 12), c = e.getUint32(13), h = ea(r) ? e.getInt16(17) : void 0, u = i.slice(s);
1889
+ }, pt = (i) => !!(i & 1), Jo = (i) => !!(i & 2), Yo = (i) => !!(i & 4), Ko = (i) => !!(i & 8), $o = (i) => !!(i & 16), ea = (i) => {
1890
+ const e = new DataView(i, 0), t = e.getUint8(0), s = e.getUint16(1), r = e.getUint8(3), o = e.getUint8(4), a = Vs(new Uint8Array(i), 5, 12), c = e.getUint32(13), h = $o(r) ? e.getInt16(17) : void 0, u = i.slice(s);
1891
1891
  return { version: t, renditionId: o, flags: r, timestamp: a, timescale: c, payload: u, compositionTimeOffset: h };
1892
- }, ia = "data:video/mp4;base64,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", Ft = () => "wakeLock" in navigator && window.navigator.userAgent.indexOf("Samsung") === -1;
1893
- class sa {
1892
+ }, ta = "data:video/mp4;base64,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", Ot = () => "wakeLock" in navigator && window.navigator.userAgent.indexOf("Samsung") === -1;
1893
+ class ia {
1894
1894
  constructor() {
1895
1895
  n(this, "enabled", !1);
1896
1896
  n(this, "wakeLockVideo");
@@ -1898,7 +1898,7 @@ class sa {
1898
1898
  n(this, "handleVisibilityChange", () => {
1899
1899
  this._wakeLock !== null && document.visibilityState === "visible" && this.enable();
1900
1900
  });
1901
- Ft() && (this._wakeLock = null, document.addEventListener("visibilitychange", this.handleVisibilityChange), document.addEventListener("fullscreenchange", this.handleVisibilityChange));
1901
+ Ot() && (this._wakeLock = null, document.addEventListener("visibilitychange", this.handleVisibilityChange), document.addEventListener("fullscreenchange", this.handleVisibilityChange));
1902
1902
  }
1903
1903
  _addSourceToVideo(e, t, s) {
1904
1904
  const r = document.createElement("source");
@@ -1908,10 +1908,10 @@ class sa {
1908
1908
  return this.enabled;
1909
1909
  }
1910
1910
  attach(e) {
1911
- if (!Ft()) {
1911
+ if (!Ot()) {
1912
1912
  if (!this.wakeLockVideo) {
1913
1913
  const t = document.createElement("video");
1914
- this.wakeLockVideo = t, this.wakeLockVideo.setAttribute("title", "Live Stream"), this.wakeLockVideo.setAttribute("playsinline", ""), this._addSourceToVideo(this.wakeLockVideo, "mp4", ia), Object.assign(this.wakeLockVideo.style, {
1914
+ this.wakeLockVideo = t, this.wakeLockVideo.setAttribute("title", "Live Stream"), this.wakeLockVideo.setAttribute("playsinline", ""), this._addSourceToVideo(this.wakeLockVideo, "mp4", ta), Object.assign(this.wakeLockVideo.style, {
1915
1915
  position: "absolute",
1916
1916
  left: "-100%",
1917
1917
  top: "-100%"
@@ -1925,9 +1925,9 @@ class sa {
1925
1925
  }
1926
1926
  }
1927
1927
  enable() {
1928
- return y(this, null, function* () {
1928
+ return E(this, null, function* () {
1929
1929
  var e, t;
1930
- return Ft() ? navigator.wakeLock.request("screen").then((s) => {
1930
+ return Ot() ? navigator.wakeLock.request("screen").then((s) => {
1931
1931
  this._wakeLock = s, this.enabled = !0, this._wakeLock.addEventListener("release", () => {
1932
1932
  });
1933
1933
  }).catch(() => {
@@ -1939,18 +1939,18 @@ class sa {
1939
1939
  }
1940
1940
  disable() {
1941
1941
  var e, t;
1942
- Ft() ? (this._wakeLock && this._wakeLock.release(), this._wakeLock = null) : ((e = this.wakeLockVideo) == null || e.pause(), (t = this.wakeLockVideo) == null || t.remove()), this.enabled = !1;
1942
+ Ot() ? (this._wakeLock && this._wakeLock.release(), this._wakeLock = null) : ((e = this.wakeLockVideo) == null || e.pause(), (t = this.wakeLockVideo) == null || t.remove()), this.enabled = !1;
1943
1943
  }
1944
1944
  unload() {
1945
1945
  document.removeEventListener("visibilitychange", this.handleVisibilityChange), document.removeEventListener("fullscreenchange", this.handleVisibilityChange), this.disable();
1946
1946
  }
1947
1947
  }
1948
- const na = /\r\n|\r|\n/;
1948
+ const sa = /\r\n|\r|\n/;
1949
1949
  var Ce, pe;
1950
- class Cs {
1950
+ class Es {
1951
1951
  constructor(e) {
1952
- p(this, Ce);
1953
- p(this, pe);
1952
+ w(this, Ce);
1953
+ w(this, pe);
1954
1954
  S(this, Ce, e), S(this, pe, 0);
1955
1955
  }
1956
1956
  skipEmptyLines() {
@@ -1977,47 +1977,47 @@ class Cs {
1977
1977
  }
1978
1978
  }
1979
1979
  Ce = new WeakMap(), pe = new WeakMap();
1980
- var We, on, _i;
1981
- class ra {
1980
+ var Ge, nn, Li;
1981
+ class na {
1982
1982
  constructor() {
1983
- p(this, We);
1983
+ w(this, Ge);
1984
1984
  }
1985
1985
  parse(e) {
1986
- const t = [], s = e.split(na), r = new Cs(s), o = r.readLine();
1986
+ const t = [], s = e.split(sa), r = new Es(s), o = r.readLine();
1987
1987
  if (!o || !o.startsWith("WEBVTT"))
1988
1988
  throw new Error("missing 'WEBVTT' signature");
1989
1989
  for (; r.readLine() !== ""; )
1990
1990
  ;
1991
1991
  for (; r.linesLeft() > 0; ) {
1992
- const a = O(this, We, on).call(this, r);
1992
+ const a = F(this, Ge, nn).call(this, r);
1993
1993
  t.push(a), r.skipEmptyLines();
1994
1994
  }
1995
1995
  return t;
1996
1996
  }
1997
1997
  }
1998
- We = new WeakSet(), on = function(e) {
1998
+ Ge = new WeakSet(), nn = function(e) {
1999
1999
  e.skipEmptyLines();
2000
- const t = e.takeUntilEmptyLine(), s = new Cs(t);
2000
+ const t = e.takeUntilEmptyLine(), s = new Es(t);
2001
2001
  let r = s.readLine(), o;
2002
2002
  if (r != null && r.includes("-->") || (o = r, r = s.readLine()), r === void 0)
2003
2003
  throw new Error("expected cue line");
2004
- const [a, c] = r.split("-->").map((w) => w.trim());
2004
+ const [a, c] = r.split("-->").map((p) => p.trim());
2005
2005
  if (!a || !c)
2006
2006
  throw new Error(`a cue needs both start and end time start: ${a} end: ${c}`);
2007
- const [h, u] = c.split(" ", 1).map((w) => w.trim());
2007
+ const [h, u] = c.split(" ", 1).map((p) => p.trim());
2008
2008
  if (!h)
2009
2009
  throw new Error(`missing end time: ${h}`);
2010
2010
  const l = s.readLine();
2011
2011
  if (!l)
2012
2012
  throw new Error("missing text");
2013
- const m = O(this, We, _i).call(this, a), g = O(this, We, _i).call(this, h);
2013
+ const m = F(this, Ge, Li).call(this, a), g = F(this, Ge, Li).call(this, h);
2014
2014
  return {
2015
2015
  id: o,
2016
2016
  startTime: m,
2017
2017
  endTime: g,
2018
2018
  text: l
2019
2019
  };
2020
- }, _i = function(e) {
2020
+ }, Li = function(e) {
2021
2021
  const t = e.split(":");
2022
2022
  if (t.length == 2) {
2023
2023
  const [c = 0, h = 0] = t.map((l) => parseFloat(l));
@@ -2026,7 +2026,7 @@ We = new WeakSet(), on = function(e) {
2026
2026
  const [s = 0, r = 0, o = 0] = t.map((c) => parseFloat(c));
2027
2027
  return s * 60 * 60 + r * 60 + o;
2028
2028
  };
2029
- class Di extends Pe {
2029
+ class _i extends Pe {
2030
2030
  constructor({ type: t, autoplay: s, muted: r, logger: o, poster: a }) {
2031
2031
  super();
2032
2032
  n(this, "element");
@@ -2096,7 +2096,7 @@ class Di extends Pe {
2096
2096
  }
2097
2097
  });
2098
2098
  });
2099
- n(this, "_play", () => y(this, null, function* () {
2099
+ n(this, "_play", () => E(this, null, function* () {
2100
2100
  try {
2101
2101
  yield this.element.play(), this._userHasProvidedInput = !this.muted || this._userProvidedMuted;
2102
2102
  } catch (t) {
@@ -2182,7 +2182,7 @@ class Di extends Pe {
2182
2182
  return this._isPaused;
2183
2183
  }
2184
2184
  }
2185
- const oa = [
2185
+ const ra = [
2186
2186
  "minBufferTime",
2187
2187
  "maxBufferTime",
2188
2188
  "burstEnabled",
@@ -2190,10 +2190,10 @@ const oa = [
2190
2190
  "separateVideoSocketEnabled",
2191
2191
  "videoCodecs"
2192
2192
  ];
2193
- function aa(i) {
2194
- return oa.includes(i);
2193
+ function oa(i) {
2194
+ return ra.includes(i);
2195
2195
  }
2196
- class ca {
2196
+ class aa {
2197
2197
  constructor(e) {
2198
2198
  n(this, "options");
2199
2199
  n(this, "overrides", /* @__PURE__ */ new Map());
@@ -2231,7 +2231,7 @@ class ca {
2231
2231
  */
2232
2232
  get(e, t) {
2233
2233
  var s;
2234
- if (t && aa(e)) {
2234
+ if (t && oa(e)) {
2235
2235
  const r = (s = this.overrides.get(t)) == null ? void 0 : s[e];
2236
2236
  if (typeof r != "undefined")
2237
2237
  return r;
@@ -2249,10 +2249,10 @@ class ca {
2249
2249
  return (s = this.overrides.get(t)) == null ? void 0 : s[e];
2250
2250
  }
2251
2251
  }
2252
- const da = (i) => {
2252
+ const ca = (i) => {
2253
2253
  const e = window;
2254
2254
  e.vindralInstances = e.vindralInstances || {}, e.vindralInstances[i.getStatistics().clientId.substring(0, 8)] = i;
2255
- }, ha = (i) => {
2255
+ }, da = (i) => {
2256
2256
  if (!navigator.mediaCapabilities)
2257
2257
  return Promise.resolve({ smooth: !0, supported: !0, powerEfficient: !0, failedToQuery: !0 });
2258
2258
  if (i.codec === "webvtt")
@@ -2276,7 +2276,7 @@ const da = (i) => {
2276
2276
  framerate: i.frameRate[0] / i.frameRate[1]
2277
2277
  }
2278
2278
  }, navigator.mediaCapabilities.decodingInfo(e);
2279
- }, ua = 0.15, la = 0.2, Is = 0.4, ma = 0.5, fa = 0.6, Ri = 15, Aa = {
2279
+ }, ha = 0.15, ua = 0.2, Ts = 0.4, la = 0.5, ma = 0.6, Bi = 15, fa = {
2280
2280
  cooldownTime: 3e3,
2281
2281
  maxBufferingEvents: {
2282
2282
  last10Seconds: 0
@@ -2291,7 +2291,7 @@ const da = (i) => {
2291
2291
  ratio: 0.1
2292
2292
  },
2293
2293
  maxCooldownRatio: 2
2294
- }, ki = (i) => (e) => e > i, Jt = class Jt {
2294
+ }, Ri = (i) => (e) => e > i, Jt = class Jt {
2295
2295
  constructor(e, t, s, r) {
2296
2296
  n(this, "qualityOfServiceSource");
2297
2297
  n(this, "config");
@@ -2319,7 +2319,7 @@ const da = (i) => {
2319
2319
  isAbrEnabled: this.isEnabled
2320
2320
  }));
2321
2321
  n(this, "isQoSOk", (e) => {
2322
- const t = this.qualityOfServiceSource.getLevelStats(e), { upgradesFromLevel: s, downgradesFromLevel: r } = t != null ? t : { upgradesFromLevel: [], downgradesFromLevel: [] }, o = Date.now() - this.config.maxDowngradeLookbackMs, a = r.filter(ki(o)).length, c = s.filter(ki(o)).length;
2322
+ const t = this.qualityOfServiceSource.getLevelStats(e), { upgradesFromLevel: s, downgradesFromLevel: r } = t != null ? t : { upgradesFromLevel: [], downgradesFromLevel: [] }, o = Date.now() - this.config.maxDowngradeLookbackMs, a = r.filter(Ri(o)).length, c = s.filter(Ri(o)).length;
2323
2323
  if (a - c > this.config.maxRecentDowngradesCount)
2324
2324
  return this.logger.debug("Recent downgrades count is over maximum", {
2325
2325
  downgrades: a - c,
@@ -2336,9 +2336,9 @@ const da = (i) => {
2336
2336
  recentDowngrades: a,
2337
2337
  timeSpentPlayingInAtLeastLevelRatio: h
2338
2338
  }), !1;
2339
- const m = Math.max(0, r.length - s.length - l), g = Date.now() - this.config.maxDowngradeLookbackMs * m, w = r.filter(ki(g)).length;
2340
- return w && m > this.config.maxCooldownRatio ? (this.logger.debug("Too many downgrades compared to time spent playing", {
2341
- downgradesWithinCooldownTime: w,
2339
+ const m = Math.max(0, r.length - s.length - l), g = Date.now() - this.config.maxDowngradeLookbackMs * m, p = r.filter(Ri(g)).length;
2340
+ return p && m > this.config.maxCooldownRatio ? (this.logger.debug("Too many downgrades compared to time spent playing", {
2341
+ downgradesWithinCooldownTime: p,
2342
2342
  cooldownRatio: m
2343
2343
  }), !1) : !0;
2344
2344
  });
@@ -2348,8 +2348,8 @@ const da = (i) => {
2348
2348
  const { bufferFullness: t, general: s } = this.qualityOfServiceSource.getMetrics(), r = this.qualityOfServiceSource.getBufferFullnessRegression();
2349
2349
  if (!r)
2350
2350
  return;
2351
- const o = 10 * 1e3, { slope: a } = r, c = r.predict(Ri), h = a < 0, u = r.predict(Ri) < Is && r.slope < 0, l = r.predict(Ri) > fa, m = this.qualityOfServiceSource.timeSpentBufferingLast(30 * 1e3), g = this.qualityOfServiceSource.timeSpentActiveLast(30 * 1e3), w = m / g;
2352
- if (t < 0.15 && w > 0.8) {
2351
+ const o = 10 * 1e3, { slope: a } = r, c = r.predict(Bi), h = a < 0, u = r.predict(Bi) < Ts && r.slope < 0, l = r.predict(Bi) > ma, m = this.qualityOfServiceSource.timeSpentBufferingLast(30 * 1e3), g = this.qualityOfServiceSource.timeSpentActiveLast(30 * 1e3), p = m / g;
2352
+ if (t < 0.15 && p > 0.8) {
2353
2353
  this.adaptLevel("reconnect");
2354
2354
  return;
2355
2355
  }
@@ -2357,13 +2357,13 @@ const da = (i) => {
2357
2357
  this.adaptLevel("downgrade");
2358
2358
  return;
2359
2359
  }
2360
- u || t < ua ? h && t < Is && c < la && this.adaptLevel(e.playbackState === "buffering" ? "double downgrade" : "downgrade") : t > ma && l && !this.tooMuchTimeBuffering(o) && !this.tooManyBufferingEvents(o) && this.adaptLevel("upgrade");
2360
+ u || t < ha ? h && t < Ts && c < ua && this.adaptLevel(e.playbackState === "buffering" ? "double downgrade" : "downgrade") : t > la && l && !this.tooMuchTimeBuffering(o) && !this.tooManyBufferingEvents(o) && this.adaptLevel("upgrade");
2361
2361
  });
2362
2362
  n(this, "onAdaptedLevel", () => {
2363
2363
  this.reset();
2364
2364
  });
2365
2365
  n(this, "adaptLevel", (e) => this.emitter.emit("adapt level", e));
2366
- this.qualityOfServiceSource = s, this.config = A(A({}, Aa), r), this.emitter = e, this.logger = t;
2366
+ this.qualityOfServiceSource = s, this.config = A(A({}, fa), r), this.emitter = e, this.logger = t;
2367
2367
  }
2368
2368
  tooMuchTimeBuffering(e) {
2369
2369
  return this.qualityOfServiceSource.timeSpentBufferingLast(e) / this.qualityOfServiceSource.timeSpentActiveLast(e) > this.config.maxBufferingRatio.last10Seconds;
@@ -2373,8 +2373,8 @@ const da = (i) => {
2373
2373
  }
2374
2374
  };
2375
2375
  n(Jt, "create", (e, t, s, r = {}) => new Jt(e, t, s, r));
2376
- let Fi = Jt;
2377
- const ga = {
2376
+ let Di = Jt;
2377
+ const Aa = {
2378
2378
  minBufferTime: 1500,
2379
2379
  maxBufferTime: 1500,
2380
2380
  cooldownTime: 3e4,
@@ -2427,7 +2427,7 @@ const ga = {
2427
2427
  this.targetBufferTimeTarget.targetBufferTime + u
2428
2428
  ), this.bufferTimeAdjustmentCount++, this.reset());
2429
2429
  });
2430
- this.qualityOfServiceSource = s, this.targetBufferTimeTarget = r, this.config = A(A({}, ga), o), this.emitter = e, this.logger = t;
2430
+ this.qualityOfServiceSource = s, this.targetBufferTimeTarget = r, this.config = A(A({}, Aa), o), this.emitter = e, this.logger = t;
2431
2431
  }
2432
2432
  updateConfig(e) {
2433
2433
  this.config = A(A({}, this.config), e);
@@ -2435,11 +2435,11 @@ const ga = {
2435
2435
  };
2436
2436
  n(ve, "BUFFER_TIME_STEP_SIZE", 500), n(ve, "BUFFER_TIME_MAX_STEPS", 3), n(ve, "create", (e, t, s, r, o = {}) => new ve(e, t, s, r, o));
2437
2437
  let Oi = ve;
2438
- const pa = (i, e) => {
2438
+ const ga = (i, e) => {
2439
2439
  const t = new URL("/subscribe", i);
2440
2440
  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();
2441
2441
  };
2442
- class wa extends Pe {
2442
+ class pa extends Pe {
2443
2443
  constructor(t, s) {
2444
2444
  super();
2445
2445
  n(this, "options");
@@ -2507,13 +2507,13 @@ class wa extends Pe {
2507
2507
  this.emit("error", zt(ft()));
2508
2508
  break;
2509
2509
  case 4002:
2510
- this.emit("error", fr(ft()));
2510
+ this.emit("error", mr(ft()));
2511
2511
  break;
2512
2512
  case 4003:
2513
- this.emit("error", Xs("internal", ft()));
2513
+ this.emit("error", Hs("internal", ft()));
2514
2514
  break;
2515
2515
  case 4010:
2516
- this.emit("error", Ar("internal", ft()));
2516
+ this.emit("error", fr("internal", ft()));
2517
2517
  break;
2518
2518
  }
2519
2519
  this.emit("close", this);
@@ -2525,16 +2525,16 @@ class wa extends Pe {
2525
2525
  * @returns a promise that resolves true if the connect steps succeeded
2526
2526
  * and false if any checks stopped the connection
2527
2527
  */
2528
- n(this, "connect", (t = !1) => y(this, null, function* () {
2528
+ n(this, "connect", (t = !1) => E(this, null, function* () {
2529
2529
  if (this.isConnectInProgress)
2530
2530
  return this.logger.info("Connect already in progress"), !1;
2531
2531
  if (this.isSuspended)
2532
2532
  return !1;
2533
2533
  if (this.readyState() !== WebSocket.CLOSED && this.close("new connection in progress"), this.shouldContinueConnecting = !0, this._isConnectInProgress = !0, t && this.options.reconnectDelay > 0) {
2534
- this.logger.info("Waiting for reconnect delay", A({}, this.options)), yield Mi(this.options.reconnectDelay);
2534
+ this.logger.info("Waiting for reconnect delay", A({}, this.options)), yield Ui(this.options.reconnectDelay);
2535
2535
  const s = yield this.options.reconnectHandler(this.reconnectState);
2536
2536
  if (this.reconnectState.reconnectRetries++, !s)
2537
- return this._isConnectInProgress = !1, this.emit("error", Gs()), !1;
2537
+ return this._isConnectInProgress = !1, this.emit("error", Qs()), !1;
2538
2538
  }
2539
2539
  this._connectionAttemptCount++;
2540
2540
  try {
@@ -2576,7 +2576,7 @@ class wa extends Pe {
2576
2576
  return this._connectTime;
2577
2577
  }
2578
2578
  }
2579
- const Sa = 65536 * 8, va = 0.9, Pi = (i) => Sa * va * 1e3 / i, ce = class ce {
2579
+ const wa = 65536 * 8, Sa = 0.9, ki = (i) => wa * Sa * 1e3 / i, ce = class ce {
2580
2580
  constructor(e, t, s) {
2581
2581
  n(this, "emitter");
2582
2582
  n(this, "transport");
@@ -2625,7 +2625,7 @@ const Sa = 65536 * 8, va = 0.9, Pi = (i) => Sa * va * 1e3 / i, ce = class ce {
2625
2625
  const e = Ye(this.rtts.items());
2626
2626
  return {
2627
2627
  rtt: e,
2628
- estimatedBandwidth: Pi(e.average),
2628
+ estimatedBandwidth: ki(e.average),
2629
2629
  edgeUrl: (t = this.transport) == null ? void 0 : t.url(),
2630
2630
  connectionProtocol: "vindral_ws"
2631
2631
  };
@@ -2640,7 +2640,7 @@ const Sa = 65536 * 8, va = 0.9, Pi = (i) => Sa * va * 1e3 / i, ce = class ce {
2640
2640
  if (this.contextSwitchesInProgress.has(e)) {
2641
2641
  if (!(t instanceof ArrayBuffer)) {
2642
2642
  const r = JSON.parse(t);
2643
- if (ms(r) && r.type === "context switch complete") {
2643
+ if (ls(r) && r.type === "context switch complete") {
2644
2644
  this.logger.info("context switch completed", { socketId: e }), this.emitter.emit("context switch complete"), this.contextSwitchesCompleted.add(e);
2645
2645
  return;
2646
2646
  }
@@ -2650,14 +2650,14 @@ const Sa = 65536 * 8, va = 0.9, Pi = (i) => Sa * va * 1e3 / i, ce = class ce {
2650
2650
  }
2651
2651
  this.handleMessage(e, t);
2652
2652
  });
2653
- n(this, "resolveEdgeUrl", () => y(this, null, function* () {
2653
+ n(this, "resolveEdgeUrl", () => E(this, null, function* () {
2654
2654
  const e = this.config.connectInfo, t = yield this.config.onConnectInfo(e), s = this.config.options.getOverride(
2655
2655
  "separateVideoSocketEnabled",
2656
2656
  t.channelId
2657
2657
  ), r = this.config.options.get("media") === "audio+video";
2658
2658
  let o = 1;
2659
2659
  r && (o = s !== !1 ? 2 : 1);
2660
- const a = pa(this.config.edgeUrl, {
2660
+ const a = ga(this.config.edgeUrl, {
2661
2661
  video: t.video,
2662
2662
  audio: t.audio,
2663
2663
  burstMs: t.burstMs,
@@ -2675,7 +2675,7 @@ const Sa = 65536 * 8, va = 0.9, Pi = (i) => Sa * va * 1e3 / i, ce = class ce {
2675
2675
  this.emitter.emit("received data", t);
2676
2676
  else {
2677
2677
  const s = JSON.parse(t);
2678
- if (!ms(s))
2678
+ if (!ls(s))
2679
2679
  return;
2680
2680
  switch (s.type) {
2681
2681
  case "pong":
@@ -2691,7 +2691,7 @@ const Sa = 65536 * 8, va = 0.9, Pi = (i) => Sa * va * 1e3 / i, ce = class ce {
2691
2691
  }
2692
2692
  });
2693
2693
  n(this, "connectWebSocketTransport", () => {
2694
- const e = new wa(
2694
+ const e = new pa(
2695
2695
  {
2696
2696
  reconnectDelay: 1e3,
2697
2697
  onMessage: this.onMessage,
@@ -2740,13 +2740,13 @@ const Sa = 65536 * 8, va = 0.9, Pi = (i) => Sa * va * 1e3 / i, ce = class ce {
2740
2740
  type: "ping"
2741
2741
  });
2742
2742
  });
2743
- this._estimatedPingBandwidth = Pi(s.estimatedRtt), this.logger = t, this.emitter = e, this.config = s, this.emitter.on("send signal", this.sendSignal), this.emitter.on("disconnect", this.close), this.emitter.on("reconnect", this.reconnect), this.disconnected.promise.catch(le), this.transport = this.connectWebSocketTransport();
2743
+ this._estimatedPingBandwidth = ki(s.estimatedRtt), this.logger = t, this.emitter = e, this.config = s, this.emitter.on("send signal", this.sendSignal), this.emitter.on("disconnect", this.close), this.emitter.on("reconnect", this.reconnect), this.disconnected.promise.catch(le), this.transport = this.connectWebSocketTransport();
2744
2744
  }
2745
2745
  get rtt() {
2746
2746
  return this.rtts.items().length > 0 ? Ut(this.rtts.items()) : 0;
2747
2747
  }
2748
2748
  get estimatedBandwidth() {
2749
- return this.rtt > 0 ? Pi(this.rtt) : this._estimatedPingBandwidth;
2749
+ return this.rtt > 0 ? ki(this.rtt) : this._estimatedPingBandwidth;
2750
2750
  }
2751
2751
  /**
2752
2752
  * The timestamp when the first connection was made
@@ -2768,13 +2768,13 @@ n(ce, "PING_INTERVAL", 5e3), n(ce, "MAX_MISSED_PINGS", 4), n(ce, "TLS_ROUNDTRIPS
2768
2768
  const a = new ce(e, t, s);
2769
2769
  a.transport.once("error", (c) => o(c)), a.transport.once("open", () => r(a));
2770
2770
  }));
2771
- let Ni = ce;
2771
+ let Fi = ce;
2772
2772
  var at, Ie, ct;
2773
- class ba {
2773
+ class va {
2774
2774
  constructor(e) {
2775
- p(this, at);
2776
- p(this, Ie, []);
2777
- p(this, ct);
2775
+ w(this, at);
2776
+ w(this, Ie, []);
2777
+ w(this, ct);
2778
2778
  S(this, at, e);
2779
2779
  }
2780
2780
  /**
@@ -2810,19 +2810,19 @@ class ba {
2810
2810
  }
2811
2811
  }
2812
2812
  at = new WeakMap(), Ie = new WeakMap(), ct = new WeakMap();
2813
- var he, dt, we, ht, Yt, Kt, $t, an;
2813
+ var he, dt, we, ht, Yt, Kt, $t, rn;
2814
2814
  const tt = class tt {
2815
2815
  constructor(e, t, s) {
2816
- p(this, $t);
2816
+ w(this, $t);
2817
2817
  n(this, "emitter");
2818
2818
  n(this, "logger");
2819
2819
  n(this, "config");
2820
2820
  n(this, "apiClient");
2821
2821
  n(this, "connectionImpl");
2822
- p(this, he, !0);
2823
- p(this, dt);
2824
- p(this, we, 0);
2825
- p(this, ht, 0);
2822
+ w(this, he, !0);
2823
+ w(this, dt);
2824
+ w(this, we, 0);
2825
+ w(this, ht, 0);
2826
2826
  n(this, "unload", () => {
2827
2827
  var e;
2828
2828
  this.logger.debug("Unloading module..."), this.disconnect("Unloading"), (e = this.connectionImpl) == null || e.unload(), this.logger.debug("Unloaded module");
@@ -2847,7 +2847,7 @@ const tt = class tt {
2847
2847
  connectionProtocol: void 0
2848
2848
  });
2849
2849
  n(this, "connect", () => {
2850
- S(this, he, !0), !d(this, dt) && S(this, dt, O(this, $t, an).call(this));
2850
+ S(this, he, !0), !d(this, dt) && S(this, dt, F(this, $t, rn).call(this));
2851
2851
  });
2852
2852
  n(this, "disconnect", (e = "Disconnect Requested") => {
2853
2853
  var t;
@@ -2856,30 +2856,30 @@ const tt = class tt {
2856
2856
  n(this, "reconnect", (e) => {
2857
2857
  this.disconnect(e), this.connect();
2858
2858
  });
2859
- p(this, Yt, () => y(this, null, function* () {
2859
+ w(this, Yt, () => E(this, null, function* () {
2860
2860
  try {
2861
2861
  return yield this.apiClient.connect(this.config.options.getOptions());
2862
2862
  } catch (e) {
2863
- if (Cn(e))
2863
+ if (En(e))
2864
2864
  switch (e.status) {
2865
2865
  case 401:
2866
2866
  throw this.emitter.emit("error", zt(e)), zt(e);
2867
2867
  case 403:
2868
- throw this.emitter.emit("error", gs(e.message)), gs(e.message);
2868
+ throw this.emitter.emit("error", fs(e.message)), fs(e.message);
2869
2869
  }
2870
- throw this.emitter.emit("error", pr(e instanceof Error ? e : void 0)), e;
2870
+ throw this.emitter.emit("error", gr(e instanceof Error ? e : void 0)), e;
2871
2871
  }
2872
2872
  }));
2873
- p(this, Kt, () => y(this, null, function* () {
2873
+ w(this, Kt, () => E(this, null, function* () {
2874
2874
  const e = Date.now(), t = () => Date.now() - e;
2875
2875
  return Promise.race([
2876
- Mi(tt.PING_TIMEOUT),
2876
+ Ui(tt.PING_TIMEOUT),
2877
2877
  fetch(new URL("/api/v4/connect/ping", this.config.options.get("url")).toString(), {
2878
2878
  method: "HEAD"
2879
2879
  })
2880
2880
  ]).then(t, t);
2881
2881
  }));
2882
- this.logger = t, this.emitter = e, this.config = s, this.apiClient = new Tn({
2882
+ this.logger = t, this.emitter = e, this.config = s, this.apiClient = new yn({
2883
2883
  publicEndpoint: this.config.options.get("url").toString(),
2884
2884
  tokenFactory: () => this.config.options.get("authenticationToken")
2885
2885
  });
@@ -2907,10 +2907,10 @@ const tt = class tt {
2907
2907
  return (e = this.connectionImpl) == null ? void 0 : e.lastConnectionTime;
2908
2908
  }
2909
2909
  };
2910
- he = new WeakMap(), dt = new WeakMap(), we = new WeakMap(), ht = new WeakMap(), Yt = new WeakMap(), Kt = new WeakMap(), $t = new WeakSet(), an = function() {
2911
- return y(this, null, function* () {
2910
+ he = new WeakMap(), dt = new WeakMap(), we = new WeakMap(), ht = new WeakMap(), Yt = new WeakMap(), Kt = new WeakMap(), $t = new WeakSet(), rn = function() {
2911
+ return E(this, null, function* () {
2912
2912
  var t;
2913
- const e = new ba({ edgeUrl: this.config.options.get("edgeUrl") });
2913
+ const e = new va({ edgeUrl: this.config.options.get("edgeUrl") });
2914
2914
  for (S(this, we, 0); ; ) {
2915
2915
  mt(this, we)._++;
2916
2916
  try {
@@ -2920,9 +2920,9 @@ he = new WeakMap(), dt = new WeakMap(), we = new WeakMap(), ht = new WeakMap(),
2920
2920
  const c = e.select(r.edges);
2921
2921
  if (!c)
2922
2922
  throw new T("Failed to resolve edge url", { isFatal: !0, code: "failed_to_resolve_edge_url" });
2923
- if (In(r)) {
2924
- if (Gn().moqEnabled) {
2925
- const { MoqConnectionAdapter: h } = yield import("./BIz303hD.js");
2923
+ if (Tn(r)) {
2924
+ if (Qn().moqEnabled) {
2925
+ const { MoqConnectionAdapter: h } = yield import("./CTUR22Wg.js");
2926
2926
  this.connectionImpl = yield h.start(this.emitter, this.logger, this.apiClient, R(A({}, this.config), {
2927
2927
  connectInfo: r,
2928
2928
  estimatedRtt: a,
@@ -2930,7 +2930,7 @@ he = new WeakMap(), dt = new WeakMap(), we = new WeakMap(), ht = new WeakMap(),
2930
2930
  }));
2931
2931
  }
2932
2932
  } else
2933
- ae(typeof c == "string", "Edge URL is expected to be a string"), this.connectionImpl = yield Ni.start(this.emitter, this.logger, R(A({}, this.config), {
2933
+ ae(typeof c == "string", "Edge URL is expected to be a string"), this.connectionImpl = yield Fi.start(this.emitter, this.logger, R(A({}, this.config), {
2934
2934
  connectInfo: r,
2935
2935
  estimatedRtt: a,
2936
2936
  edgeUrl: c
@@ -2949,24 +2949,24 @@ he = new WeakMap(), dt = new WeakMap(), we = new WeakMap(), ht = new WeakMap(),
2949
2949
  if (!(yield this.config.reconnectHandler({
2950
2950
  reconnectRetries: d(this, we)
2951
2951
  }))) {
2952
- this.emitter.emit("error", Gs());
2952
+ this.emitter.emit("error", Qs());
2953
2953
  break;
2954
2954
  }
2955
- if (yield Mi(1e3), !d(this, he))
2955
+ if (yield Ui(1e3), !d(this, he))
2956
2956
  break;
2957
2957
  }
2958
2958
  S(this, dt, void 0);
2959
2959
  });
2960
2960
  }, n(tt, "PING_TIMEOUT", 1e3), n(tt, "create", (e, t, s) => new tt(e, t, s));
2961
- let Vi = tt;
2962
- const xi = () => ({
2961
+ let Ni = tt;
2962
+ const Pi = () => ({
2963
2963
  video: R(A({}, Vt()), {
2964
2964
  bitRate: ke()
2965
2965
  }),
2966
2966
  audio: {
2967
2967
  bitRate: ke()
2968
2968
  }
2969
- }), ya = () => ({
2969
+ }), ba = () => ({
2970
2970
  width: window.innerWidth,
2971
2971
  height: window.innerHeight,
2972
2972
  bitRate: ke()
@@ -2997,7 +2997,7 @@ const xi = () => ({
2997
2997
  });
2998
2998
  n(this, "setUserSpecifiedCap", (e) => {
2999
2999
  var s;
3000
- const t = (s = this.getUserSpecifiedCap()) != null ? s : xi();
3000
+ const t = (s = this.getUserSpecifiedCap()) != null ? s : Pi();
3001
3001
  this.userSpecifiedCap = R(A({}, t), {
3002
3002
  video: A(A({}, t.video), e.video),
3003
3003
  audio: A(A({}, t.audio), e.audio)
@@ -3024,7 +3024,7 @@ const xi = () => ({
3024
3024
  });
3025
3025
  n(this, "evaluateConstraintCap", () => {
3026
3026
  var a, c, h, u, l;
3027
- const e = this.sizeBasedResolutionCapEnabled ? R(A({}, xi()), { video: ya() }) : xi();
3027
+ const e = this.sizeBasedResolutionCapEnabled ? R(A({}, Pi()), { video: ba() }) : Pi();
3028
3028
  if (!this.resizeObserver) {
3029
3029
  const m = this.element.getBoundingClientRect();
3030
3030
  this.elementSize = { width: m.width, height: m.height };
@@ -3035,8 +3035,8 @@ const xi = () => ({
3035
3035
  }
3036
3036
  const s = this.renditionLevelSource.getRenditionLevels().find((m) => {
3037
3037
  if (m.video) {
3038
- const g = m.video.width / m.video.height, w = e.video.width / e.video.height;
3039
- return g > w ? m.video.width > e.video.width : m.video.height > e.video.height;
3038
+ const g = m.video.width / m.video.height, p = e.video.width / e.video.height;
3039
+ return g > p ? m.video.width > e.video.width : m.video.height > e.video.height;
3040
3040
  }
3041
3041
  });
3042
3042
  s && s.video && (e.video.width = s.video.width, e.video.height = s.video.height);
@@ -3061,9 +3061,9 @@ const xi = () => ({
3061
3061
  }
3062
3062
  };
3063
3063
  n(it, "CHECK_SIZE_INTERVAL", 1e3), n(it, "create", (e, t, s, r) => new it(e, t, s, r));
3064
- let zi = it;
3065
- const Ea = 5, Ta = 100, Ca = 1e3;
3066
- class ns {
3064
+ let Vi = it;
3065
+ const ya = 5, Ea = 100, Ta = 1e3;
3066
+ class ss {
3067
3067
  constructor(e, t, s, r) {
3068
3068
  n(this, "timers", q.create());
3069
3069
  n(this, "logger");
@@ -3072,7 +3072,7 @@ class ns {
3072
3072
  n(this, "playbackSource");
3073
3073
  n(this, "isSuspended", !1);
3074
3074
  n(this, "load", () => {
3075
- this.timers.setInterval(this.emitDecodedFrames, Ta), this.timers.setInterval(this.emitDecodeRate, Ca), this.emitter.on("init segment", this.onInitSegment), this.emitter.on("coded sample", this.decode);
3075
+ this.timers.setInterval(this.emitDecodedFrames, Ea), this.timers.setInterval(this.emitDecodeRate, Ta), this.emitter.on("init segment", this.onInitSegment), this.emitter.on("coded sample", this.decode);
3076
3076
  });
3077
3077
  n(this, "unload", () => {
3078
3078
  this.trackContexts.forEach(({ decoderContext: e }) => e.unload()), this.timers.unload(), this.emitter.off("init segment", this.onInitSegment), this.emitter.off("coded sample", this.decode);
@@ -3123,7 +3123,7 @@ class ns {
3123
3123
  return;
3124
3124
  t.sampleDuration = e.duration / e.timescale * 1e3;
3125
3125
  const { decoderContext: s, buffer: r } = t, o = e.timestamp / e.timescale * 1e3, a = e.duration / e.timescale * 1e3, c = r[r.length - 1];
3126
- !c || o - Ea > c.end ? r.push({ start: o, end: o + a }) : o + a * 5 < c.end ? t.buffer = [{ start: o, end: o + a }] : c.end = o + a, s.enqueue(e), this.emitDecodedFrames();
3126
+ !c || o - ya > c.end ? r.push({ start: o, end: o + a }) : o + a * 5 < c.end ? t.buffer = [{ start: o, end: o + a }] : c.end = o + a, s.enqueue(e), this.emitDecodedFrames();
3127
3127
  });
3128
3128
  n(this, "emitDecodedFrames", () => {
3129
3129
  let e;
@@ -3131,7 +3131,7 @@ class ns {
3131
3131
  var r, o;
3132
3132
  let s;
3133
3133
  for (; (s = (o = (r = t.decoderContext).error) == null ? void 0 : o.call(r)) !== void 0; )
3134
- this.emitter.emit("error", ur(!1, s));
3134
+ this.emitter.emit("error", dr(!1, s));
3135
3135
  for (; (e = t.decoderContext.take()) !== void 0; ) {
3136
3136
  const { statistics: a } = e;
3137
3137
  a && (t.decodeTime.push(a.decodeTime), t.transportTime.push(
@@ -3167,12 +3167,12 @@ class ns {
3167
3167
  this.logger = t, this.emitter = e, this.trackContexts = s, this.playbackSource = r;
3168
3168
  }
3169
3169
  static create(e, t, s, r, o) {
3170
- return y(this, null, function* () {
3170
+ return E(this, null, function* () {
3171
3171
  const a = /* @__PURE__ */ new Map();
3172
3172
  for (const c of s)
3173
3173
  switch (c.type) {
3174
3174
  case "audio": {
3175
- const { OpusDecoderContext: h } = yield import("./BPJhCkoA.js");
3175
+ const { OpusDecoderContext: h } = yield import("./C2E9fx_I.js");
3176
3176
  a.set(c.type, {
3177
3177
  buffer: [],
3178
3178
  decoderContext: yield h.create(48e3, 2),
@@ -3183,7 +3183,7 @@ class ns {
3183
3183
  break;
3184
3184
  }
3185
3185
  case "video": {
3186
- const { H264DecoderWorkerContext: h } = yield import("./BaaAfzZ7.js");
3186
+ const { H264DecoderWorkerContext: h } = yield import("./DUVlYJes.js");
3187
3187
  a.set(c.type, {
3188
3188
  buffer: [],
3189
3189
  decoderContext: yield h.create(o),
@@ -3194,7 +3194,7 @@ class ns {
3194
3194
  break;
3195
3195
  }
3196
3196
  }
3197
- return new ns(e, t, a, r);
3197
+ return new ss(e, t, a, r);
3198
3198
  });
3199
3199
  }
3200
3200
  }
@@ -3249,13 +3249,13 @@ const ei = class ei {
3249
3249
  }
3250
3250
  };
3251
3251
  n(ei, "create", (e) => new ei(e));
3252
- let Hi = ei;
3253
- const Ia = (i) => (e, t, s) => e.timestamp <= t || e.timestampAdded <= s - i, be = class be {
3252
+ let zi = ei;
3253
+ const Ca = (i) => (e, t, s) => e.timestamp <= t || e.timestampAdded <= s - i, be = class be {
3254
3254
  constructor(e, t, s) {
3255
3255
  n(this, "logger");
3256
3256
  n(this, "emitter");
3257
3257
  n(this, "waitingEvents", []);
3258
- n(this, "isTriggered", Ia(be.EVENT_TIMEOUT));
3258
+ n(this, "isTriggered", Ca(be.EVENT_TIMEOUT));
3259
3259
  n(this, "timeSource");
3260
3260
  n(this, "timers", new q());
3261
3261
  n(this, "load", () => {
@@ -3292,7 +3292,7 @@ const Ia = (i) => (e, t, s) => e.timestamp <= t || e.timestampAdded <= s - i, be
3292
3292
  }
3293
3293
  };
3294
3294
  n(be, "EVENT_TIMEOUT", 5e3), n(be, "EVENT_CHECK_INTERVAL", 20), n(be, "create", (e, t, s) => new be(e, t, s));
3295
- let Qi = be;
3295
+ let Hi = be;
3296
3296
  const ne = class ne {
3297
3297
  constructor(e) {
3298
3298
  n(this, "emitter");
@@ -3318,7 +3318,7 @@ const ne = class ne {
3318
3318
  });
3319
3319
  n(this, "add", (e, t) => {
3320
3320
  let s = this.bytesReceived.get(e);
3321
- s || (s = new zn(20), this.bytesReceived.set(e, s)), t > 0 && (this.lastBytesUpdated = Date.now(), this.timeoutInterval || (this.timeoutInterval = this.timers.setInterval(
3321
+ s || (s = new Nn(20), this.bytesReceived.set(e, s)), t > 0 && (this.lastBytesUpdated = Date.now(), this.timeoutInterval || (this.timeoutInterval = this.timers.setInterval(
3322
3322
  this.checkTimeout,
3323
3323
  ne.UPDATE_RECEIVED_BYTES_INTERVAL
3324
3324
  ))), s.add(t);
@@ -3337,7 +3337,7 @@ const ne = class ne {
3337
3337
  n(this, "checkTimeout", () => {
3338
3338
  const e = Date.now() - this.lastBytesUpdated;
3339
3339
  if (this.totalBytesReceived() === 0 && e > ne.NO_DATA_ERROR_TIMEOUT) {
3340
- this.emitter.emit("error", gr()), this.emitter.emit("reconnect", "no incoming data"), this.clearTimeoutInterval();
3340
+ this.emitter.emit("error", Ar()), this.emitter.emit("reconnect", "no incoming data"), this.clearTimeoutInterval();
3341
3341
  return;
3342
3342
  }
3343
3343
  e > ne.NO_DATA_TIMEOUT && this.totalBytesReceived() > 0 && (this.emitter.emit("no data timeout", this.totalBytesReceived()), this.clearTimeoutInterval());
@@ -3349,12 +3349,12 @@ const ne = class ne {
3349
3349
  }
3350
3350
  };
3351
3351
  n(ne, "NO_DATA_ERROR_TIMEOUT", 20 * 1e3), n(ne, "NO_DATA_TIMEOUT", 5 * 1e3), n(ne, "UPDATE_RECEIVED_BYTES_INTERVAL", 1e3), n(ne, "create", (e) => new ne(e));
3352
- let Xi = ne;
3353
- const Ba = () => window.AudioContext || window.webkitAudioContext, ti = class ti extends Pe {
3352
+ let Qi = ne;
3353
+ const Ia = () => window.AudioContext || window.webkitAudioContext, ti = class ti extends Pe {
3354
3354
  constructor() {
3355
3355
  super();
3356
3356
  // TODO: Checkout what happens when limit is reached
3357
- n(this, "context", new (Ba())());
3357
+ n(this, "context", new (Ia())());
3358
3358
  n(this, "timers", q.create());
3359
3359
  n(this, "previousCurrentTime", 0);
3360
3360
  n(this, "_isStuck", !1);
@@ -3366,14 +3366,14 @@ const Ba = () => window.AudioContext || window.webkitAudioContext, ti = class ti
3366
3366
  n(this, "getMediaStreamDestination", () => (this.mediaStreamDestination || (this.mediaStreamDestination = this.context.createMediaStreamDestination()), this.mediaStreamDestination));
3367
3367
  n(this, "getDefaultDestination", () => this.context.destination);
3368
3368
  n(this, "createSplitter", () => this.context.createChannelSplitter(2));
3369
- n(this, "resume", () => y(this, null, function* () {
3369
+ n(this, "resume", () => E(this, null, function* () {
3370
3370
  try {
3371
- return yield Promise.race([this.context.resume(), Qn(1e3, mr())]);
3371
+ return yield Promise.race([this.context.resume(), zn(1e3, lr())]);
3372
3372
  } catch (t) {
3373
3373
  throw this.suspend().catch(le), t;
3374
3374
  }
3375
3375
  }));
3376
- n(this, "suspend", () => y(this, null, function* () {
3376
+ n(this, "suspend", () => E(this, null, function* () {
3377
3377
  var t;
3378
3378
  yield (t = this.context.suspend()) != null ? t : Promise.resolve();
3379
3379
  }));
@@ -3399,7 +3399,7 @@ const Ba = () => window.AudioContext || window.webkitAudioContext, ti = class ti
3399
3399
  }
3400
3400
  };
3401
3401
  n(ti, "CHECK_INTERVAL", 1e3);
3402
- let Gi = ti;
3402
+ let Wi = ti;
3403
3403
  const ii = class ii extends Pe {
3404
3404
  constructor(t, s, { muted: r, reInitWhenStuck: o }) {
3405
3405
  super();
@@ -3427,7 +3427,7 @@ const ii = class ii extends Pe {
3427
3427
  n(this, "reInitWhenStuck");
3428
3428
  n(this, "ignoreSuspendCalls", !1);
3429
3429
  n(this, "isActivated", !1);
3430
- n(this, "unload", () => y(this, null, function* () {
3430
+ n(this, "unload", () => E(this, null, function* () {
3431
3431
  var t, s;
3432
3432
  (t = this.gainNode) == null || t.disconnect(), yield (s = this.audio) == null ? void 0 : s.unload(), this.reset(), this.audio = void 0, this.gainNode = void 0;
3433
3433
  }));
@@ -3436,7 +3436,7 @@ const ii = class ii extends Pe {
3436
3436
  });
3437
3437
  n(this, "unsuspend", () => {
3438
3438
  var t;
3439
- this.setGain(this._volume), this.ignoreSuspendCalls = !!this.audio, (t = this.audio) == null || t.suspend().then(() => y(this, null, function* () {
3439
+ this.setGain(this._volume), this.ignoreSuspendCalls = !!this.audio, (t = this.audio) == null || t.suspend().then(() => E(this, null, function* () {
3440
3440
  yield this.resume(), this.ignoreSuspendCalls = !1;
3441
3441
  })).catch(() => {
3442
3442
  this.ignoreSuspendCalls = !1, this.emit("state change", "suspended");
@@ -3487,7 +3487,7 @@ const ii = class ii extends Pe {
3487
3487
  }
3488
3488
  });
3489
3489
  // Left empty since we don't do anything without user input
3490
- n(this, "play", () => y(this, null, function* () {
3490
+ n(this, "play", () => E(this, null, function* () {
3491
3491
  this.audio = this.getAudioContext(), yield this.resume();
3492
3492
  }));
3493
3493
  n(this, "pause", () => {
@@ -3495,7 +3495,7 @@ const ii = class ii extends Pe {
3495
3495
  n(this, "flushBuffer", () => {
3496
3496
  this.unplayedBufferSources.items().forEach(([t, s]) => s.stop()), this.index = 0;
3497
3497
  });
3498
- n(this, "resume", () => y(this, null, function* () {
3498
+ n(this, "resume", () => E(this, null, function* () {
3499
3499
  var t;
3500
3500
  if (!this._userProvidedMuted)
3501
3501
  try {
@@ -3510,7 +3510,7 @@ const ii = class ii extends Pe {
3510
3510
  n(this, "getAudioContext", () => this.audio ? this.audio : this.setupContext());
3511
3511
  n(this, "setupContext", () => {
3512
3512
  var t, s, r;
3513
- return (t = this.audio) == null || t.unload(), this.audio = new Gi(), this.audio.on("state", (o) => {
3513
+ return (t = this.audio) == null || t.unload(), this.audio = new Wi(), this.audio.on("state", (o) => {
3514
3514
  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);
3515
3515
  }), this.audio.on("stuck", () => {
3516
3516
  this.reInitWhenStuck && (this.logger.info("Re-init audio context"), this.setupContext(), this.resume().catch(le), this.emit("stuck"));
@@ -3571,9 +3571,9 @@ const ii = class ii extends Pe {
3571
3571
  n(ii, "create", (t, s, r) => new ii(t, s, r));
3572
3572
  let Ht = ii;
3573
3573
  var Be;
3574
- class cn {
3574
+ class on {
3575
3575
  constructor() {
3576
- p(this, Be, []);
3576
+ w(this, Be, []);
3577
3577
  S(this, Be, []);
3578
3578
  }
3579
3579
  addTextTrack(e, t, s) {
@@ -3613,7 +3613,7 @@ const Me = (i, e) => {
3613
3613
  for (t = e; i > 1; i--) t += e;
3614
3614
  return t;
3615
3615
  };
3616
- class Ra {
3616
+ class Ba {
3617
3617
  constructor() {
3618
3618
  n(this, "audio");
3619
3619
  n(this, "unmute", () => this.audio.play().catch(le));
@@ -3626,14 +3626,14 @@ class Ra {
3626
3626
  throw new Error("Failed to create audio tag");
3627
3627
  }
3628
3628
  }
3629
- var Rt, ue, j, He, ee, dn, Ke, hn;
3630
- class ka {
3629
+ var Rt, ue, j, He, ee, an, Ke, cn;
3630
+ class Ra {
3631
3631
  constructor() {
3632
- p(this, ee);
3633
- p(this, Rt, []);
3634
- p(this, ue, document.createElement("canvas"));
3635
- p(this, j);
3636
- p(this, He, window.devicePixelRatio || 1);
3632
+ w(this, ee);
3633
+ w(this, Rt, []);
3634
+ w(this, ue, document.createElement("canvas"));
3635
+ w(this, j);
3636
+ w(this, He, window.devicePixelRatio || 1);
3637
3637
  n(this, "config", {
3638
3638
  backgroundColor: "rgba(0,0,0,0.6)",
3639
3639
  textPadding: 8,
@@ -3643,7 +3643,7 @@ class ka {
3643
3643
  const e = d(this, ue).getContext("2d", { alpha: !0 });
3644
3644
  if (!e)
3645
3645
  throw new Error("Failed to create 2d context");
3646
- S(this, j, e), O(this, ee, Ke).call(this);
3646
+ S(this, j, e), F(this, ee, Ke).call(this);
3647
3647
  }
3648
3648
  get canvas() {
3649
3649
  return d(this, ue);
@@ -3653,8 +3653,8 @@ class ka {
3653
3653
  }
3654
3654
  render(e, t = !1) {
3655
3655
  const s = d(this, Rt).flatMap((c) => c.text.split(`
3656
- `).flatMap((u) => O(this, ee, hn).call(this, u, e.width)).map((u) => {
3657
- O(this, ee, Ke).call(this);
3656
+ `).flatMap((u) => F(this, ee, cn).call(this, u, e.width)).map((u) => {
3657
+ F(this, ee, Ke).call(this);
3658
3658
  const l = d(this, j).measureText(u);
3659
3659
  return {
3660
3660
  text: u,
@@ -3666,21 +3666,21 @@ class ka {
3666
3666
  };
3667
3667
  })), r = Math.max(...s.map((c) => c.size.width)), o = s.reduce((c, { size: h }) => c + h.height, 0) + (s.length - 1) * this.config.lineGap;
3668
3668
  let a = 0;
3669
- O(this, ee, dn).call(this, r, o), d(this, j).clearRect(0, 0, d(this, ue).width, d(this, ue).height);
3669
+ F(this, ee, an).call(this, r, o), d(this, j).clearRect(0, 0, d(this, ue).width, d(this, ue).height);
3670
3670
  for (const { size: c, text: h } of s)
3671
- O(this, ee, Ke).call(this), d(this, j).fillStyle = this.config.backgroundColor, d(this, j).fillRect(0, a, c.width, c.height), O(this, ee, Ke).call(this), d(this, j).fillText(h, this.config.textPadding, a + this.config.textPadding), a += c.height + this.config.lineGap;
3671
+ F(this, ee, Ke).call(this), d(this, j).fillStyle = this.config.backgroundColor, d(this, j).fillRect(0, a, c.width, c.height), F(this, ee, Ke).call(this), d(this, j).fillText(h, this.config.textPadding, a + this.config.textPadding), a += c.height + this.config.lineGap;
3672
3672
  t && (d(this, j).strokeStyle = "red", d(this, j).strokeRect(0, 0, e.width, d(this, ue).height));
3673
3673
  }
3674
3674
  }
3675
- Rt = new WeakMap(), ue = new WeakMap(), j = new WeakMap(), He = new WeakMap(), ee = new WeakSet(), dn = function(e, t) {
3675
+ Rt = new WeakMap(), ue = new WeakMap(), j = new WeakMap(), He = new WeakMap(), ee = new WeakSet(), an = function(e, t) {
3676
3676
  d(this, ue).width = e * d(this, He), d(this, ue).height = t * d(this, He), d(this, j).scale(d(this, He), d(this, He)), this.canvas.style.width = `${e}px`, this.canvas.style.height = `${t}px`;
3677
3677
  }, Ke = function() {
3678
3678
  d(this, j).fillStyle = "white", d(this, j).textAlign = "left", d(this, j).textBaseline = "top", d(this, j).font = `${this.config.fontSize} sans-serif`;
3679
- }, hn = function(e, t) {
3679
+ }, cn = function(e, t) {
3680
3680
  const s = [], r = e.split(" ");
3681
3681
  let o = "";
3682
3682
  for (; r.length > 0; ) {
3683
- O(this, ee, Ke).call(this);
3683
+ F(this, ee, Ke).call(this);
3684
3684
  let a = 0;
3685
3685
  for (; d(this, j).measureText(o + (o.length > 0 ? " " : "") + r[0]).width + this.config.textPadding * 2 <= t && r.length > 0; )
3686
3686
  a++, o += (o.length > 0 ? " " : "") + r.shift();
@@ -3692,7 +3692,7 @@ Rt = new WeakMap(), ue = new WeakMap(), j = new WeakMap(), He = new WeakMap(), e
3692
3692
  }
3693
3693
  return s;
3694
3694
  };
3695
- const Pa = `
3695
+ const ka = `
3696
3696
  precision mediump float;
3697
3697
  uniform sampler2D texture;
3698
3698
 
@@ -3704,7 +3704,7 @@ void main() {
3704
3704
 
3705
3705
  gl_FragColor = vec4(y, y, y, a);
3706
3706
  }
3707
- `, xa = `
3707
+ `, Pa = `
3708
3708
  attribute vec2 position;
3709
3709
  varying vec2 texture_coordinate;
3710
3710
  uniform mat4 model;
@@ -3713,7 +3713,7 @@ void main() {
3713
3713
  texture_coordinate = position;
3714
3714
  gl_Position = model * vec4(position, 0.0, 1.0);
3715
3715
  }
3716
- `, Bs = (i, e) => {
3716
+ `, Cs = (i, e) => {
3717
3717
  let t = i.getContext("webgl", e);
3718
3718
  if (t || (t = i.getContext("experimental-webgl", e)), !t)
3719
3719
  throw new T("Failed to create webgl context", {
@@ -3741,7 +3741,7 @@ void main() {
3741
3741
  code: "failed_to_create_texture"
3742
3742
  });
3743
3743
  return i.bindTexture(i.TEXTURE_2D, e), 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), e;
3744
- }, Rs = (i, e) => {
3744
+ }, Is = (i, e) => {
3745
3745
  const t = i.createBuffer();
3746
3746
  if (!t)
3747
3747
  throw new T("Failed to create buffer", {
@@ -3749,7 +3749,7 @@ void main() {
3749
3749
  code: "failed_to_create_buffer"
3750
3750
  });
3751
3751
  return i.bindBuffer(i.ARRAY_BUFFER, t), i.bufferData(i.ARRAY_BUFFER, e.buffer, i.STATIC_DRAW), t;
3752
- }, Wi = (i, e, t) => {
3752
+ }, Xi = (i, e, t) => {
3753
3753
  const s = i.createProgram();
3754
3754
  if (!s)
3755
3755
  throw new T("Failed to create program", {
@@ -3765,19 +3765,19 @@ void main() {
3765
3765
  }
3766
3766
  return s;
3767
3767
  };
3768
- var si, I, kt, Pt, xt, Re, ut, un, ln, ni;
3769
- class Ua {
3768
+ var si, B, kt, Pt, xt, Re, ut, dn, hn, ni;
3769
+ class xa {
3770
3770
  constructor(e) {
3771
- p(this, ut);
3772
- p(this, si, 96);
3773
- p(this, I);
3774
- p(this, kt);
3775
- p(this, Pt);
3776
- p(this, xt);
3777
- p(this, Re);
3778
- n(this, "subtitleRenderer", new ka());
3771
+ w(this, ut);
3772
+ w(this, si, 96);
3773
+ w(this, B);
3774
+ w(this, kt);
3775
+ w(this, Pt);
3776
+ w(this, xt);
3777
+ w(this, Re);
3778
+ n(this, "subtitleRenderer", new Ra());
3779
3779
  // prettier-ignore
3780
- p(this, ni, (e, t, s, r) => [
3780
+ w(this, ni, (e, t, s, r) => [
3781
3781
  e,
3782
3782
  0,
3783
3783
  0,
@@ -3795,31 +3795,31 @@ class Ua {
3795
3795
  0,
3796
3796
  1
3797
3797
  ]);
3798
- S(this, I, e), S(this, kt, _e(e)), S(this, Pt, et(e, e.FRAGMENT_SHADER, Pa)), S(this, xt, et(e, e.VERTEX_SHADER, xa)), S(this, Re, Wi(e, d(this, xt), d(this, Pt))), this.subtitleRenderer.config.fontSize = "64px";
3798
+ S(this, B, e), S(this, kt, _e(e)), S(this, Pt, et(e, e.FRAGMENT_SHADER, ka)), S(this, xt, et(e, e.VERTEX_SHADER, Pa)), S(this, Re, Xi(e, d(this, xt), d(this, Pt))), this.subtitleRenderer.config.fontSize = "64px";
3799
3799
  }
3800
3800
  setActiveCues(e, t) {
3801
3801
  this.subtitleRenderer.setActiveCues(e), this.subtitleRenderer.render(t);
3802
3802
  }
3803
3803
  render(e) {
3804
3804
  const t = this.subtitleRenderer.canvas, s = (e.padding + d(this, si)) * window.devicePixelRatio;
3805
- t.width !== 0 && (d(this, I).useProgram(d(this, Re)), O(this, ut, un).call(this), O(this, ut, ln).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 + s) / e.height)), d(this, I).uniform1i(d(this, I).getUniformLocation(d(this, Re), "texture"), 4), d(this, I).activeTexture(d(this, I).TEXTURE4), d(this, I).bindTexture(d(this, I).TEXTURE_2D, d(this, kt)), d(this, I).enable(d(this, I).BLEND), d(this, I).blendFunc(d(this, I).SRC_ALPHA, d(this, I).ONE_MINUS_SRC_ALPHA), d(this, I).texImage2D(
3806
- d(this, I).TEXTURE_2D,
3805
+ t.width !== 0 && (d(this, B).useProgram(d(this, Re)), F(this, ut, dn).call(this), F(this, ut, hn).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 + s) / e.height)), d(this, B).uniform1i(d(this, B).getUniformLocation(d(this, Re), "texture"), 4), d(this, B).activeTexture(d(this, B).TEXTURE4), d(this, B).bindTexture(d(this, B).TEXTURE_2D, d(this, kt)), d(this, B).enable(d(this, B).BLEND), d(this, B).blendFunc(d(this, B).SRC_ALPHA, d(this, B).ONE_MINUS_SRC_ALPHA), d(this, B).texImage2D(
3806
+ d(this, B).TEXTURE_2D,
3807
3807
  0,
3808
- d(this, I).RGBA,
3809
- d(this, I).RGBA,
3810
- d(this, I).UNSIGNED_BYTE,
3808
+ d(this, B).RGBA,
3809
+ d(this, B).RGBA,
3810
+ d(this, B).UNSIGNED_BYTE,
3811
3811
  t
3812
- ), d(this, I).texParameteri(d(this, I).TEXTURE_2D, d(this, I).TEXTURE_MAG_FILTER, d(this, I).LINEAR), d(this, I).drawArrays(d(this, I).TRIANGLE_STRIP, 0, 4));
3812
+ ), d(this, B).texParameteri(d(this, B).TEXTURE_2D, d(this, B).TEXTURE_MAG_FILTER, d(this, B).LINEAR), d(this, B).drawArrays(d(this, B).TRIANGLE_STRIP, 0, 4));
3813
3813
  }
3814
3814
  }
3815
- si = new WeakMap(), I = new WeakMap(), kt = new WeakMap(), Pt = new WeakMap(), xt = new WeakMap(), Re = new WeakMap(), ut = new WeakSet(), un = function() {
3816
- const e = d(this, I).getAttribLocation(d(this, Re), "position");
3817
- d(this, I).enableVertexAttribArray(e), d(this, I).vertexAttribPointer(e, 2, d(this, I).FLOAT, !1, 0, 0);
3818
- }, ln = function(e, t, s, r) {
3819
- const o = d(this, I).getUniformLocation(d(this, Re), "model");
3820
- d(this, I).uniformMatrix4fv(o, !1, d(this, ni).call(this, e, t, s, r));
3815
+ si = new WeakMap(), B = new WeakMap(), kt = new WeakMap(), Pt = new WeakMap(), xt = new WeakMap(), Re = new WeakMap(), ut = new WeakSet(), dn = function() {
3816
+ const e = d(this, B).getAttribLocation(d(this, Re), "position");
3817
+ d(this, B).enableVertexAttribArray(e), d(this, B).vertexAttribPointer(e, 2, d(this, B).FLOAT, !1, 0, 0);
3818
+ }, hn = function(e, t, s, r) {
3819
+ const o = d(this, B).getUniformLocation(d(this, Re), "model");
3820
+ d(this, B).uniformMatrix4fv(o, !1, d(this, ni).call(this, e, t, s, r));
3821
3821
  }, ni = new WeakMap();
3822
- const ks = `
3822
+ const Bs = `
3823
3823
  precision mediump float;
3824
3824
  uniform sampler2D y_texture;
3825
3825
  uniform sampler2D u_texture;
@@ -3835,7 +3835,7 @@ void main() {
3835
3835
 
3836
3836
  gl_FragColor = vec4(y, u, v, 1) * conversion;
3837
3837
  }
3838
- `, Ps = `
3838
+ `, Rs = `
3839
3839
  attribute vec2 position;
3840
3840
  varying vec2 texture_coordinate;
3841
3841
  uniform mat4 model;
@@ -3844,12 +3844,12 @@ void main() {
3844
3844
  texture_coordinate = position;
3845
3845
  gl_Position = model * vec4(position, 0.0, 1.0);
3846
3846
  }
3847
- `, xs = {
3847
+ `, ks = {
3848
3848
  width: 256,
3849
3849
  codedWidth: 256,
3850
3850
  height: 144,
3851
3851
  codedHeight: 144
3852
- }, Us = {
3852
+ }, Ps = {
3853
3853
  preserveDrawingBuffer: !1,
3854
3854
  alpha: !1,
3855
3855
  depth: !1,
@@ -3860,11 +3860,11 @@ void main() {
3860
3860
  constructor() {
3861
3861
  super();
3862
3862
  n(this, "canvas", document.createElement("canvas"));
3863
- n(this, "context", Bs(this.canvas, Us));
3864
- n(this, "pixelShader", et(this.context, this.context.FRAGMENT_SHADER, ks));
3865
- n(this, "vertexShader", et(this.context, this.context.VERTEX_SHADER, Ps));
3866
- n(this, "buffer", Rs(this.context, wt.SQUARE_VERTICES));
3867
- n(this, "program", Wi(this.context, this.vertexShader, this.pixelShader));
3863
+ n(this, "context", Cs(this.canvas, Ps));
3864
+ n(this, "pixelShader", et(this.context, this.context.FRAGMENT_SHADER, Bs));
3865
+ n(this, "vertexShader", et(this.context, this.context.VERTEX_SHADER, Rs));
3866
+ n(this, "buffer", Is(this.context, wt.SQUARE_VERTICES));
3867
+ n(this, "program", Xi(this.context, this.vertexShader, this.pixelShader));
3868
3868
  n(this, "textures", {
3869
3869
  y: _e(this.context),
3870
3870
  u: _e(this.context),
@@ -3872,21 +3872,21 @@ void main() {
3872
3872
  });
3873
3873
  // Lazy loaded when needed
3874
3874
  n(this, "textRenderer");
3875
- n(this, "size", xs);
3875
+ n(this, "size", ks);
3876
3876
  n(this, "onContextLost", (t) => {
3877
3877
  this.textRenderer = void 0;
3878
3878
  const s = new Error(t instanceof WebGLContextEvent ? t.statusMessage : "webgl context lost");
3879
- this.emit("context lost", wr(s)), t.preventDefault();
3879
+ this.emit("context lost", pr(s)), t.preventDefault();
3880
3880
  });
3881
3881
  n(this, "onContextRestored", () => {
3882
- this.emit("context restored"), this.context = Bs(this.canvas, Us), this.pixelShader = et(this.context, this.context.FRAGMENT_SHADER, ks), this.vertexShader = et(this.context, this.context.VERTEX_SHADER, Ps), this.buffer = Rs(this.context, wt.SQUARE_VERTICES), this.program = Wi(this.context, this.vertexShader, this.pixelShader), this.textures = {
3882
+ this.emit("context restored"), this.context = Cs(this.canvas, Ps), this.pixelShader = et(this.context, this.context.FRAGMENT_SHADER, Bs), this.vertexShader = et(this.context, this.context.VERTEX_SHADER, Rs), this.buffer = Is(this.context, wt.SQUARE_VERTICES), this.program = Xi(this.context, this.vertexShader, this.pixelShader), this.textures = {
3883
3883
  y: _e(this.context),
3884
3884
  u: _e(this.context),
3885
3885
  v: _e(this.context)
3886
3886
  }, this.load();
3887
3887
  });
3888
3888
  n(this, "load", () => {
3889
- this.context.useProgram(this.program), this.setupPositionVertexAttributes(), this.setSize(xs), this.context.uniform1i(this.context.getUniformLocation(this.program, "y_texture"), 0), this.context.uniform1i(this.context.getUniformLocation(this.program, "u_texture"), 1), this.context.uniform1i(this.context.getUniformLocation(this.program, "v_texture"), 2), this.setConversionMatrix(this.rec709());
3889
+ this.context.useProgram(this.program), this.setupPositionVertexAttributes(), this.setSize(ks), this.context.uniform1i(this.context.getUniformLocation(this.program, "y_texture"), 0), this.context.uniform1i(this.context.getUniformLocation(this.program, "u_texture"), 1), this.context.uniform1i(this.context.getUniformLocation(this.program, "v_texture"), 2), this.setConversionMatrix(this.rec709());
3890
3890
  });
3891
3891
  n(this, "unload", () => {
3892
3892
  var s;
@@ -3992,17 +3992,17 @@ void main() {
3992
3992
  this.canvas.addEventListener("webglcontextlost", this.onContextLost), this.canvas.addEventListener("webglcontextrestored", this.onContextRestored, !1), this.canvas.style.width = "100%", this.canvas.style.position = "relative";
3993
3993
  }
3994
3994
  getTextRenderer() {
3995
- return this.textRenderer || (this.textRenderer = new Ua(this.context)), this.textRenderer;
3995
+ return this.textRenderer || (this.textRenderer = new xa(this.context)), this.textRenderer;
3996
3996
  }
3997
3997
  };
3998
3998
  n(wt, "SQUARE_VERTICES", new Float32Array([0, 0, 0, 1, 1, 0, 1, 1]));
3999
- let ji = wt;
3999
+ let Gi = wt;
4000
4000
  const ri = class ri {
4001
4001
  constructor(e, t, s, r) {
4002
4002
  n(this, "oldTimestampLimit", 400);
4003
4003
  n(this, "pool");
4004
4004
  n(this, "logger");
4005
- n(this, "videoRenderer", new ji());
4005
+ n(this, "videoRenderer", new Gi());
4006
4006
  n(this, "renderQueue", []);
4007
4007
  n(this, "clockSource");
4008
4008
  n(this, "isFirstFrame", !0);
@@ -4072,11 +4072,11 @@ const oi = class oi {
4072
4072
  n(this, "audioPlayer");
4073
4073
  n(this, "videoPlayer");
4074
4074
  n(this, "pool");
4075
- n(this, "unmuter", new Ra());
4075
+ n(this, "unmuter", new Ba());
4076
4076
  n(this, "_isPaused", !1);
4077
4077
  n(this, "isDisconnected", !1);
4078
4078
  n(this, "timers", new q());
4079
- n(this, "textTracks", new cn());
4079
+ n(this, "textTracks", new on());
4080
4080
  n(this, "playbackRate");
4081
4081
  n(this, "reset", () => {
4082
4082
  });
@@ -4110,7 +4110,7 @@ const oi = class oi {
4110
4110
  try {
4111
4111
  this.audioPlayer.onDecodedFrame(e);
4112
4112
  } catch (t) {
4113
- t instanceof Error && this.emitter.emit("error", Qs(!1, t));
4113
+ t instanceof Error && this.emitter.emit("error", zs(!1, t));
4114
4114
  }
4115
4115
  this.videoPlayer.onDecodedFrame(e);
4116
4116
  });
@@ -4178,7 +4178,7 @@ const oi = class oi {
4178
4178
  }
4179
4179
  };
4180
4180
  n(oi, "create", (e, t, s, r, o) => new oi(e, t, s, r, o));
4181
- let qi = oi;
4181
+ let ji = oi;
4182
4182
  const ai = class ai {
4183
4183
  constructor(e, t, s, r, { muted: o, type: a, poster: c }) {
4184
4184
  n(this, "logger");
@@ -4191,7 +4191,7 @@ const ai = class ai {
4191
4191
  n(this, "_userProvidedMuted", !1);
4192
4192
  n(this, "timers", new q());
4193
4193
  n(this, "volumeState");
4194
- n(this, "textTracks", new cn());
4194
+ n(this, "textTracks", new on());
4195
4195
  n(this, "reset", () => {
4196
4196
  });
4197
4197
  n(this, "load", () => {
@@ -4233,7 +4233,7 @@ const ai = class ai {
4233
4233
  try {
4234
4234
  this.audioPlayer.onDecodedFrame(e);
4235
4235
  } catch (t) {
4236
- t instanceof Error && this.emitter.emit("error", Qs(!1, t));
4236
+ t instanceof Error && this.emitter.emit("error", zs(!1, t));
4237
4237
  }
4238
4238
  this.videoPlayer.onDecodedFrame(e);
4239
4239
  });
@@ -4248,7 +4248,7 @@ const ai = class ai {
4248
4248
  };
4249
4249
  je(e, this.volumeState) || (this.volumeState = e, this.emitter.emit("volume state", this.volumeState));
4250
4250
  });
4251
- this.logger = t, this.emitter = e, this.pool = s, this._userProvidedMuted = o, this.mediaElement = new Di({
4251
+ this.logger = t, this.emitter = e, this.pool = s, this._userProvidedMuted = o, this.mediaElement = new _i({
4252
4252
  poster: c,
4253
4253
  type: a,
4254
4254
  muted: o,
@@ -4324,9 +4324,9 @@ const ai = class ai {
4324
4324
  }
4325
4325
  };
4326
4326
  n(ai, "create", (e, t, s, r, o) => new ai(e, t, s, r, o));
4327
- let Zi = ai;
4328
- const Ma = () => (i) => mn(i.buffered.start(0), i.buffered.end(i.buffered.length - 1)), mn = (i, e) => (t) => t.remove(Math.max(0, i), Math.min(Number.POSITIVE_INFINITY, e)), Ms = (i) => (e) => e.appendBuffer(i), La = (i) => (e) => e.changeType(i), _a = (i) => (e) => i(e);
4329
- class Da {
4327
+ let qi = ai;
4328
+ const Ua = () => (i) => un(i.buffered.start(0), i.buffered.end(i.buffered.length - 1)), un = (i, e) => (t) => t.remove(Math.max(0, i), Math.min(Number.POSITIVE_INFINITY, e)), xs = (i) => (e) => e.appendBuffer(i), Ma = (i) => (e) => e.changeType(i), La = (i) => (e) => i(e);
4329
+ class _a {
4330
4330
  constructor(e) {
4331
4331
  n(this, "commandQueue", []);
4332
4332
  n(this, "sourceBuffer");
@@ -4337,14 +4337,14 @@ class Da {
4337
4337
  });
4338
4338
  n(this, "appendBuffer", (e, t) => new Promise((s, r) => {
4339
4339
  if (t && this.currentInit !== t) {
4340
- const a = new qe(Ms(t), s, r);
4340
+ const a = new qe(xs(t), s, r);
4341
4341
  this.commandQueue.push(a), this.currentInit = t;
4342
4342
  }
4343
- const o = new qe(Ms(e), s, r);
4343
+ const o = new qe(xs(e), s, r);
4344
4344
  this.commandQueue.push(o), this.handleQueue();
4345
4345
  }));
4346
4346
  n(this, "execute", (e) => new Promise((t, s) => {
4347
- const r = new qe(_a(e), t, s);
4347
+ const r = new qe(La(e), t, s);
4348
4348
  this.commandQueue.push(r), this.handleQueue();
4349
4349
  }));
4350
4350
  n(this, "buffered", () => this.sourceBuffer.buffered);
@@ -4352,21 +4352,21 @@ class Da {
4352
4352
  e.removeSourceBuffer(this.sourceBuffer);
4353
4353
  });
4354
4354
  n(this, "changeType", (e) => new Promise((t, s) => {
4355
- const r = new qe(La(e), t, s);
4355
+ const r = new qe(Ma(e), t, s);
4356
4356
  this.commandQueue.push(r), this.handleQueue();
4357
4357
  }));
4358
4358
  n(this, "removeBuffer", (e, t) => new Promise((s, r) => {
4359
- const o = new qe(mn(e, t), s, r);
4359
+ const o = new qe(un(e, t), s, r);
4360
4360
  this.commandQueue.push(o), this.handleQueue();
4361
4361
  }));
4362
4362
  n(this, "flush", () => new Promise((e, t) => {
4363
- const s = new qe(Ma, e, t);
4363
+ const s = new qe(Ua, e, t);
4364
4364
  this.commandQueue.push(s), this.handleQueue();
4365
4365
  }));
4366
4366
  this.sourceBuffer = e, this.sourceBuffer.addEventListener("updateend", this.handleQueue);
4367
4367
  }
4368
4368
  }
4369
- class fn extends Pe {
4369
+ class ln extends Pe {
4370
4370
  constructor() {
4371
4371
  super();
4372
4372
  n(this, "MediaSource", vt());
@@ -4398,7 +4398,7 @@ class fn extends Pe {
4398
4398
  });
4399
4399
  n(this, "addSourceBuffer", (t) => {
4400
4400
  const s = this.mediaSource.addSourceBuffer(t);
4401
- return new Da(s);
4401
+ return new _a(s);
4402
4402
  });
4403
4403
  n(this, "removeSourceBuffer", (t) => {
4404
4404
  t.removeFromMediaSource(this.mediaSource);
@@ -4424,11 +4424,11 @@ class fn extends Pe {
4424
4424
  this.mediaSource.addEventListener("sourceopen", this.onSourceOpen), this.mediaSource.addEventListener("sourceclose", this.onSourceClosed), this.mediaSource.addEventListener("sourceended", this.onSourceEnded);
4425
4425
  }
4426
4426
  }
4427
- n(fn, "isTypeSupported", (t) => {
4427
+ n(ln, "isTypeSupported", (t) => {
4428
4428
  var s, r;
4429
4429
  return (r = (s = vt()) == null ? void 0 : s.isTypeSupported(t)) != null ? r : !1;
4430
4430
  });
4431
- class An {
4431
+ class mn {
4432
4432
  constructor() {
4433
4433
  n(this, "initSegments", /* @__PURE__ */ new Map());
4434
4434
  n(this, "set", (e, t, s) => {
@@ -4442,7 +4442,7 @@ class An {
4442
4442
  });
4443
4443
  }
4444
4444
  }
4445
- function Fa(i, { mediaSource: e, mimeType: t, codec: s }) {
4445
+ function Da(i, { mediaSource: e, mimeType: t, codec: s }) {
4446
4446
  return R(A({}, i), {
4447
4447
  state: "initialized",
4448
4448
  mimeType: t,
@@ -4453,13 +4453,13 @@ function Fa(i, { mediaSource: e, mimeType: t, codec: s }) {
4453
4453
  lastBufferCleanupTime: Date.now()
4454
4454
  });
4455
4455
  }
4456
- function Ls({
4456
+ function Us({
4457
4457
  initSegments: i,
4458
4458
  pendingSamples: e
4459
4459
  }) {
4460
4460
  return {
4461
4461
  state: "uninitialized",
4462
- initSegments: i != null ? i : new An(),
4462
+ initSegments: i != null ? i : new mn(),
4463
4463
  sequenceNumber: 0,
4464
4464
  isWorkingOnPendingSamples: !1,
4465
4465
  hasFirstSync: !!e,
@@ -4468,8 +4468,7 @@ function Ls({
4468
4468
  successfulAppendCalls: 0
4469
4469
  };
4470
4470
  }
4471
- var ci;
4472
- const di = class di {
4471
+ const ci = class ci {
4473
4472
  constructor(e, t, s) {
4474
4473
  n(this, "maxChunkSize", 20);
4475
4474
  n(this, "minConsecutiveErrorsBeforeEmit", 5);
@@ -4478,7 +4477,7 @@ const di = class di {
4478
4477
  n(this, "timers", q.create());
4479
4478
  n(this, "emitter");
4480
4479
  n(this, "mediaElement");
4481
- n(this, "mediaSource", new fn());
4480
+ n(this, "mediaSource", new ln());
4482
4481
  n(this, "trackContexts", /* @__PURE__ */ new Map());
4483
4482
  n(this, "autoRecoverFromMediaErrors", !0);
4484
4483
  n(this, "quotaErrorCount", 0);
@@ -4520,10 +4519,10 @@ const di = class di {
4520
4519
  const r = (c = (a = e.get(s)) == null ? void 0 : a.pendingSamples) != null ? c : [], o = (h = e.get(s)) == null ? void 0 : h.initSegments;
4521
4520
  for (; r.length > 0 && !((u = r[0]) != null && u.isSync); )
4522
4521
  r.shift();
4523
- this.trackContexts.set(s, Ls({ pendingSamples: r, initSegments: o }));
4522
+ this.trackContexts.set(s, Us({ pendingSamples: r, initSegments: o }));
4524
4523
  });
4525
4524
  });
4526
- n(this, "setSourceBuffers", (e) => y(this, null, function* () {
4525
+ n(this, "setSourceBuffers", (e) => E(this, null, function* () {
4527
4526
  if (this.mediaSource.isClosed()) {
4528
4527
  this.pendingTracksToAddSourceBuffers = e;
4529
4528
  return;
@@ -4542,9 +4541,9 @@ const di = class di {
4542
4541
  }
4543
4542
  for (const s of e) {
4544
4543
  let r = this.trackContexts.get(s.type);
4545
- r || (r = Ls({ pendingSamples: [], initSegments: new An() }), this.trackContexts.set(s.type, r)), r.state === "initialized" ? s.mimeType !== r.mimeType && (yield r.sourceBuffer.changeType(s.mimeType)) : this.trackContexts.set(
4544
+ r || (r = Us({ pendingSamples: [], initSegments: new mn() }), this.trackContexts.set(s.type, r)), r.state === "initialized" ? s.mimeType !== r.mimeType && (yield r.sourceBuffer.changeType(s.mimeType)) : this.trackContexts.set(
4546
4545
  s.type,
4547
- Fa(r, {
4546
+ Da(r, {
4548
4547
  mimeType: s.mimeType,
4549
4548
  mediaSource: this.mediaSource,
4550
4549
  codec: s.codec
@@ -4576,10 +4575,10 @@ const di = class di {
4576
4575
  if (!s)
4577
4576
  throw _t(e.type, e.renditionId);
4578
4577
  s.state === "initialized" && (s.mimeType = t);
4579
- const r = Xo(e.codec, e.data, e.timescale);
4580
- r && s.initSegments.set(e.channelId, e.renditionId, r);
4578
+ const r = Qo(e.codec, e.data, e.timescale);
4579
+ r && s.initSegments.set(e.channelId, e.renditionId, new Uint8Array(r));
4581
4580
  });
4582
- n(this, "append", (e, t) => y(this, null, function* () {
4581
+ n(this, "append", (e, t) => E(this, null, function* () {
4583
4582
  var c;
4584
4583
  const s = e[0];
4585
4584
  if (!s)
@@ -4588,11 +4587,11 @@ const di = class di {
4588
4587
  if (this.mediaSource.isClosed())
4589
4588
  return;
4590
4589
  if (!o)
4591
- throw lr(s.renditionId, s.channelId);
4590
+ throw hr(s.renditionId, s.channelId);
4592
4591
  if (!r)
4593
4592
  throw _t(s.type, s.renditionId);
4594
4593
  if (r.state === "uninitialized")
4595
- throw As(s.type, s.renditionId);
4594
+ throw ur(s.type, s.renditionId);
4596
4595
  if (t) {
4597
4596
  const h = (s.timestamp + ((c = s.compositionTimeOffset) != null ? c : 0)) / s.timescale;
4598
4597
  yield r.sourceBuffer.removeBuffer(h, Number.POSITIVE_INFINITY);
@@ -4602,40 +4601,61 @@ const di = class di {
4602
4601
  yield r.sourceBuffer.changeType(r.mimeType);
4603
4602
  } catch (l) {
4604
4603
  }
4605
- yield r.sourceBuffer.appendBuffer(o);
4604
+ "fragmented" in s || (yield r.sourceBuffer.appendBuffer(o));
4606
4605
  }
4607
4606
  const a = Math.max(0, s.timestamp / s.timescale - this.maxSecondsInBuffer);
4608
4607
  a > 0 && Date.now() - r.lastBufferCleanupTime > 1e4 && (r.lastBufferCleanupTime = Date.now(), yield r.sourceBuffer.removeBuffer(0, a + 10));
4609
4608
  try {
4610
4609
  let h = r.sequenceNumber;
4611
- const u = Jo(e, h++);
4612
- yield r.sourceBuffer.appendBuffer(u), r.sequenceNumber = h, r.consecutiveQuotaExceededErrorCount = 0, r.successfulAppendCalls++;
4610
+ if ("fragmented" in s)
4611
+ for (const u of e)
4612
+ "initData" in u && (yield r.sourceBuffer.appendBuffer(u.data, u.initData));
4613
+ else {
4614
+ const u = Zo(e, h++);
4615
+ yield r.sourceBuffer.appendBuffer(u);
4616
+ }
4617
+ r.sequenceNumber = h, r.consecutiveQuotaExceededErrorCount = 0, r.successfulAppendCalls++;
4613
4618
  } catch (h) {
4614
4619
  throw h instanceof DOMException && (h.code === DOMException.QUOTA_EXCEEDED_ERR ? (this.quotaErrorCount++, r.consecutiveQuotaExceededErrorCount++, this.logger.error("quota exceeded error", { error: h }), r.pendingSamples.unshift(...e)) : this.mediaElement.error && r.pendingSamples.unshift(...e)), h;
4615
4620
  }
4616
4621
  }));
4617
- n(this, "onFragment", (e) => {
4618
- d(this, ci).call(this, e).catch((t) => {
4619
- this.logger.error("Failed to append fragment", t);
4620
- });
4621
- });
4622
- p(this, ci, (r) => y(this, [r], function* ({
4622
+ n(this, "onFragment", ({
4623
4623
  fragment: e,
4624
4624
  mimeType: t,
4625
- codec: s
4626
- }) {
4627
- const o = e.mediaType();
4628
- if (!o)
4625
+ codec: s,
4626
+ channelId: r,
4627
+ renditionId: o
4628
+ }) => {
4629
+ const a = e.mediaType(), c = e.rawBytes(), h = e.header().rawBytes(), u = e.baseMediaDecodeTime(), l = e.timescale(), m = e.duration(), g = a === "video" ? e.startsWithKeyframe() : !0, p = e.compositionTimeOffset(0);
4630
+ if (a === "text") {
4631
+ this.logger.warn("Skipping unexpected text fragment");
4629
4632
  return;
4630
- const a = this.trackContexts.get(o);
4631
- if (!a)
4632
- throw _t(o);
4633
- if (!this.mediaSource.isClosed()) {
4634
- if (a.state === "uninitialized")
4635
- throw As(o);
4636
- s && t && a.codec !== s && (yield a.sourceBuffer.changeType(t), a.codec = s, a.mimeType = t), yield a.sourceBuffer.appendBuffer(e.rawBytes(), e.header().rawBytes());
4637
4633
  }
4638
- }));
4634
+ if (!s) {
4635
+ this.logger.warn("Skipping fragment with no codec");
4636
+ return;
4637
+ }
4638
+ const y = this.trackContexts.get(a);
4639
+ if (!y)
4640
+ throw _t(a);
4641
+ y.state === "initialized" && t && (y.mimeType = t, y.initSegments.set(r, o, h));
4642
+ const U = {
4643
+ fragmented: !0,
4644
+ type: a,
4645
+ data: c,
4646
+ initData: h,
4647
+ timestamp: u,
4648
+ duration: m,
4649
+ timescale: l,
4650
+ channelId: r,
4651
+ renditionId: o,
4652
+ isSync: g,
4653
+ codec: s,
4654
+ fragment: e,
4655
+ compositionTimeOffset: p
4656
+ };
4657
+ this.onCodedSample(U);
4658
+ });
4639
4659
  n(this, "onCodedSample", (e) => {
4640
4660
  if (e.duration === 0)
4641
4661
  return;
@@ -4646,17 +4666,17 @@ const di = class di {
4646
4666
  if (this.hasAddedInitialPosterFrame && e.isSync && e.type === "video") {
4647
4667
  this.hasAddedInitialPosterFrame = !1;
4648
4668
  const s = A({}, e);
4649
- s.timestamp = 0, t.pendingSamples.push(s);
4669
+ "fragment" in s ? (s.fragment = s.fragment.clone(), s.fragment.updateBaseMediaDecodeTime(0), s.data = s.fragment.rawBytes()) : s.timestamp = 0, t.pendingSamples.push(s);
4650
4670
  }
4651
4671
  t.hasFirstSync = !0, t.pendingSamples.push(e), t.state !== "uninitialized" && (t.isWorkingOnPendingSamples || Oa(t, this.append, this.maxChunkSize).catch((s) => {
4652
4672
  if (t.isWorkingOnPendingSamples = !1, s instanceof Error) {
4653
4673
  if (this.logger.error("append failed", { message: s.message, name: s.name }), s instanceof DOMException && s.code === DOMException.QUOTA_EXCEEDED_ERR) {
4654
4674
  if (t.consecutiveQuotaExceededErrorCount >= this.minConsecutiveErrorsBeforeEmit) {
4655
- const r = fs(!1, s, t.consecutiveQuotaExceededErrorCount, e.type);
4675
+ const r = ms(!1, s, t.consecutiveQuotaExceededErrorCount, e.type);
4656
4676
  this.emitter.emit("error", r);
4657
4677
  }
4658
4678
  } else {
4659
- const r = fs(!1, s, t.consecutiveQuotaExceededErrorCount, e.type);
4679
+ const r = ms(!1, s, t.consecutiveQuotaExceededErrorCount, e.type);
4660
4680
  this.emitter.emit("error", r);
4661
4681
  }
4662
4682
  this.mediaElement.error && this.onSourceEnded();
@@ -4670,7 +4690,7 @@ const di = class di {
4670
4690
  n(this, "onSourceEnded", () => {
4671
4691
  const { error: e } = this.mediaElement;
4672
4692
  if (e) {
4673
- const t = /AUDIO_RENDERER/.test(e.message) || !this.autoRecoverFromMediaErrors, s = hr(t, e);
4693
+ const t = /AUDIO_RENDERER/.test(e.message) || !this.autoRecoverFromMediaErrors, s = cr(t, e);
4674
4694
  if (this.logger.error("MediaElement error", { error: s }), this.emitter.emit("error", s), !s.isFatal()) {
4675
4695
  this.logger.info("Re-opening MediaSource"), this.emitter.emit("recovered from media error", { error: s, count: this.recoveredFromErrorCount }), this.recoveredFromErrorCount++;
4676
4696
  const r = !this.mediaElement.paused, o = [];
@@ -4684,17 +4704,17 @@ const di = class di {
4684
4704
  this.logger = e, this.mediaElement = s, this.emitter = t;
4685
4705
  }
4686
4706
  };
4687
- ci = new WeakMap(), n(di, "create", (e, t, s) => {
4688
- const r = new di(e, t, s);
4707
+ n(ci, "create", (e, t, s) => {
4708
+ const r = new ci(e, t, s);
4689
4709
  return r.setTrackContexts(), r.mediaSource.on("source ended", r.onSourceEnded), r.mediaSource.on("source open", r.onSourceOpen), r.mediaSource.attach(s), r;
4690
4710
  });
4691
- let Ji = di;
4692
- const _s = (i, e) => {
4711
+ let Zi = ci;
4712
+ const Ms = (i, e) => {
4693
4713
  var c;
4694
- const t = i.renditionId !== e.renditionId, s = i.channelId !== e.channelId, r = ((c = i.timestamp) != null ? c : 0) > e.timestamp, o = i.type === "video" && e.type === "video" && i.levelIdc !== e.levelIdc;
4714
+ const t = i.renditionId !== e.renditionId, s = i.channelId !== e.channelId, r = ((c = i.timestamp) != null ? c : 0) > e.timestamp, o = i.type === "video" && e.type === "video" && "levelIdc" in i && "levelIdc" in e && i.levelIdc !== e.levelIdc;
4695
4715
  let a = !1;
4696
- return i.type === "video" && e.type === "video" && (a = e.width !== i.width || e.height !== i.height), s || t || r || a || o;
4697
- }, Oa = (i, e, t) => y(void 0, null, function* () {
4716
+ return i.type === "video" && e.type === "video" && "width" in i && "width" in e && (a = e.width !== i.width || e.height !== i.height), s || t || r || a || o;
4717
+ }, Oa = (i, e, t) => E(void 0, null, function* () {
4698
4718
  for (i.isWorkingOnPendingSamples = !0; i.pendingSamples.length > 0; ) {
4699
4719
  const s = [];
4700
4720
  let r = 0;
@@ -4702,7 +4722,7 @@ const _s = (i, e) => {
4702
4722
  r = c;
4703
4723
  const h = i.pendingSamples[c], u = i.pendingSamples[c + 1];
4704
4724
  if (h && (s.push(h), u)) {
4705
- if (_s(h, u))
4725
+ if (Ms(h, u))
4706
4726
  break;
4707
4727
  const l = (h.timestamp + h.duration) / h.timescale;
4708
4728
  if (u.timestamp / u.timescale - l > 0.1)
@@ -4714,11 +4734,11 @@ const _s = (i, e) => {
4714
4734
  const o = s[0];
4715
4735
  if (!o)
4716
4736
  break;
4717
- const a = i.previousSample ? _s(i.previousSample, o) : !0;
4737
+ const a = i.previousSample ? Ms(i.previousSample, o) : !0;
4718
4738
  yield e(s, a), i.pendingSamples = i.pendingSamples.slice(r + 1), i.previousSample = s[s.length - 1];
4719
4739
  }
4720
4740
  i.isWorkingOnPendingSamples = !1;
4721
- }), hi = class hi {
4741
+ }), di = class di {
4722
4742
  constructor(e, t) {
4723
4743
  n(this, "logger");
4724
4744
  n(this, "emitter");
@@ -4743,16 +4763,16 @@ const _s = (i, e) => {
4743
4763
  isPictureInPictureActive: this.isPictureInPictureActive()
4744
4764
  }));
4745
4765
  /* eslint-disable @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-call */
4746
- n(this, "requestStandardPictureInPicture", () => y(this, null, function* () {
4766
+ n(this, "requestStandardPictureInPicture", () => E(this, null, function* () {
4747
4767
  return yield this.element.requestPictureInPicture();
4748
4768
  }));
4749
- n(this, "exitStandardPictureInPicture", () => y(this, null, function* () {
4769
+ n(this, "exitStandardPictureInPicture", () => E(this, null, function* () {
4750
4770
  return yield document.exitPictureInPicture();
4751
4771
  }));
4752
4772
  n(this, "isStandardPictureInPictureSupported", () => !!this.element && !!this.element.requestPictureInPicture && !!document.pictureInPictureEnabled);
4753
4773
  n(this, "isStandardPictureInPictureActive", () => !!this.element && !!document.pictureInPictureElement);
4754
4774
  n(this, "isWebkitPresentationModeActive", () => !!this.element && this.element.webkitPresentationMode === "picture-in-picture");
4755
- n(this, "requestWebkitPresentationMode", (e) => y(this, null, function* () {
4775
+ n(this, "requestWebkitPresentationMode", (e) => E(this, null, function* () {
4756
4776
  return this.element.webkitSetPresentationMode(e), Promise.resolve();
4757
4777
  }));
4758
4778
  n(this, "isWebkitPresentationModeSupported", () => !!this.element && !!this.element.webkitSetPresentationMode);
@@ -4760,9 +4780,9 @@ const _s = (i, e) => {
4760
4780
  }
4761
4781
  /* eslint-enable @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-call */
4762
4782
  };
4763
- n(hi, "create", (e, t) => new hi(e, t));
4764
- let Yi = hi;
4765
- const ui = class ui {
4783
+ n(di, "create", (e, t) => new di(e, t));
4784
+ let Ji = di;
4785
+ const hi = class hi {
4766
4786
  constructor(e, t, s, r) {
4767
4787
  n(this, "emitter");
4768
4788
  n(this, "logger");
@@ -4799,27 +4819,27 @@ const ui = class ui {
4799
4819
  this.emitter = e, this.logger = t, this.clockSource = s, this.targetBufferTime = r, this.emitter.on("buffer state", this.onBufferedStateChanged), this.emitter.on("needs user input", this.onNeedsUserInput);
4800
4820
  }
4801
4821
  };
4802
- n(ui, "create", (e, t, s, r) => new ui(e, t, s, r));
4803
- let Ki = ui;
4804
- const $i = () => ({
4822
+ n(hi, "create", (e, t, s, r) => new hi(e, t, s, r));
4823
+ let Yi = hi;
4824
+ const Ki = () => ({
4805
4825
  upgradesFromLevel: [],
4806
4826
  downgradesFromLevel: [],
4807
4827
  bufferingRanges: [],
4808
4828
  activeRanges: [],
4809
4829
  decodeRate: Number.MAX_SAFE_INTEGER
4810
- }), Na = () => ({
4830
+ }), Fa = () => ({
4811
4831
  levels: {},
4812
4832
  levelDowngrades: [],
4813
4833
  levelUpgrades: [],
4814
4834
  bufferFullness: 0,
4815
- general: $i()
4816
- }), li = class li {
4835
+ general: Ki()
4836
+ }), ui = class ui {
4817
4837
  constructor(e, t) {
4818
4838
  n(this, "minBufferFullnessLengthForRegression", 6);
4819
4839
  n(this, "logger");
4820
4840
  n(this, "emitter");
4821
4841
  n(this, "timers", q.create());
4822
- n(this, "metrics", Na());
4842
+ n(this, "metrics", Fa());
4823
4843
  n(this, "bufferFullness", new J(30));
4824
4844
  n(this, "bufferFullnessRegression");
4825
4845
  n(this, "currentLevel");
@@ -4882,15 +4902,15 @@ const $i = () => ({
4882
4902
  return e;
4883
4903
  });
4884
4904
  n(this, "bufferingEventsLast", (e) => this.metrics.general.bufferingRanges.filter((t) => t.start >= Date.now() - e).length);
4885
- n(this, "timeSpentBufferingLast", (e) => us(this.metrics.general.bufferingRanges, e));
4886
- n(this, "timeSpentActiveLast", (e) => us(this.metrics.general.activeRanges, e));
4905
+ n(this, "timeSpentBufferingLast", (e) => hs(this.metrics.general.bufferingRanges, e));
4906
+ n(this, "timeSpentActiveLast", (e) => hs(this.metrics.general.activeRanges, e));
4887
4907
  n(this, "timeSpentPlayingInAtLeastLevelRatio", (e) => {
4888
4908
  var h, u, l, m;
4889
4909
  const t = this.timeSpentBuffering(), s = this.timeActive(), r = this.bufferingRatios(), o = this.activeRatios(), a = ((u = (h = e.video) == null ? void 0 : h.bitRate) != null ? u : 0) + ((m = (l = e.audio) == null ? void 0 : l.bitRate) != null ? m : 0), c = t / s;
4890
4910
  return Object.keys(this.metrics.levels).map((g) => parseInt(g, 10)).filter((g) => g >= a).reduce(
4891
- (g, w) => {
4892
- var E, M;
4893
- return ((E = o.get(w.toString())) != null ? E : 0) - ((M = r.get(w.toString())) != null ? M : 0) * c + g;
4911
+ (g, p) => {
4912
+ var y, U;
4913
+ return ((y = o.get(p.toString())) != null ? y : 0) - ((U = r.get(p.toString())) != null ? U : 0) * c + g;
4894
4914
  },
4895
4915
  0
4896
4916
  );
@@ -4904,18 +4924,18 @@ const $i = () => ({
4904
4924
  fatalQosCount: this.fatalQosCount
4905
4925
  }));
4906
4926
  n(this, "onRenditionLevelChanged", (e) => {
4907
- var o, a, c, h, u, l, m, g, w, E, M, N, G, L;
4908
- const t = ((c = (a = (o = e.from) == null ? void 0 : o.video) == null ? void 0 : a.bitRate) != null ? c : 0) + ((l = (u = (h = e.from) == null ? void 0 : h.audio) == null ? void 0 : u.bitRate) != null ? l : 0), s = ((w = (g = (m = e.to) == null ? void 0 : m.video) == null ? void 0 : g.bitRate) != null ? w : 0) + ((N = (M = (E = e.to) == null ? void 0 : E.audio) == null ? void 0 : M.bitRate) != null ? N : 0);
4927
+ var o, a, c, h, u, l, m, g, p, y, U, N, X, L;
4928
+ const t = ((c = (a = (o = e.from) == null ? void 0 : o.video) == null ? void 0 : a.bitRate) != null ? c : 0) + ((l = (u = (h = e.from) == null ? void 0 : h.audio) == null ? void 0 : u.bitRate) != null ? l : 0), s = ((p = (g = (m = e.to) == null ? void 0 : m.video) == null ? void 0 : g.bitRate) != null ? p : 0) + ((N = (U = (y = e.to) == null ? void 0 : y.audio) == null ? void 0 : U.bitRate) != null ? N : 0);
4909
4929
  this.logger.info("rendition level changed", { fromLevel: t, toLevel: s }), this.metrics.general.activeRanges.length === 0 && this.setActive(), e.from && e.to && (t < s ? this.metrics.general.upgradesFromLevel.push(Date.now()) : this.metrics.general.downgradesFromLevel.push(Date.now()));
4910
4930
  let r = !1;
4911
4931
  if (e.from) {
4912
- const _ = (G = this.metrics.levels[t]) != null ? G : $i();
4932
+ const _ = (X = this.metrics.levels[t]) != null ? X : Ki();
4913
4933
  t < s ? _.upgradesFromLevel.push(Date.now()) : _.downgradesFromLevel.push(Date.now()), Le(_.activeRanges);
4914
4934
  const Z = _.bufferingRanges[_.bufferingRanges.length - 1];
4915
4935
  r = !!Z && !Z.end, Le(_.bufferingRanges), this.metrics.levels[t] = _;
4916
4936
  }
4917
4937
  if (e.to) {
4918
- const _ = (L = this.metrics.levels[s]) != null ? L : $i();
4938
+ const _ = (L = this.metrics.levels[s]) != null ? L : Ki();
4919
4939
  Ze(_.activeRanges), r && Ze(_.bufferingRanges), this.metrics.levels[s] = _, this.currentLevel = s;
4920
4940
  }
4921
4941
  });
@@ -4939,7 +4959,7 @@ const $i = () => ({
4939
4959
  const t = this.metrics.levels[(s = this.currentLevel) != null ? s : 0];
4940
4960
  t && (t.decodeRate = e);
4941
4961
  });
4942
- n(this, "calculateLinearRegression", () => Vn(
4962
+ n(this, "calculateLinearRegression", () => Fn(
4943
4963
  this.bufferFullness.items().map((e, t) => ({
4944
4964
  x: t,
4945
4965
  y: e
@@ -4979,9 +4999,9 @@ const $i = () => ({
4979
4999
  Ze(this.metrics.general.activeRanges);
4980
5000
  }
4981
5001
  };
4982
- n(li, "create", (e, t) => new li(e, t));
4983
- let es = li;
4984
- const mi = class mi {
5002
+ n(ui, "create", (e, t) => new ui(e, t));
5003
+ let $i = ui;
5004
+ const li = class li {
4985
5005
  constructor(e, t) {
4986
5006
  n(this, "renditions", /* @__PURE__ */ new Map());
4987
5007
  n(this, "renditionLevels", []);
@@ -5068,9 +5088,9 @@ const mi = class mi {
5068
5088
  var l;
5069
5089
  const { video: t, audio: s, channelId: r } = e, o = (l = this.renditions.get(r)) != null ? l : [], a = o.filter(st).filter((m) => t && m.codec === t.codec), c = o.filter(nt).filter((m) => s && m.codec === s.codec && m.language === s.language), h = Math.max(a.length, c.length), u = [];
5070
5090
  for (let m = 0; m < h; m++) {
5071
- const g = a[Math.min(a.length - 1, m)], w = c[Math.min(c.length - 1, m)];
5091
+ const g = a[Math.min(a.length - 1, m)], p = c[Math.min(c.length - 1, m)];
5072
5092
  u.push({
5073
- audio: w,
5093
+ audio: p,
5074
5094
  video: g
5075
5095
  });
5076
5096
  }
@@ -5080,9 +5100,9 @@ const mi = class mi {
5080
5100
  this.subscriptionSource = t, this.emitter = e, this.emitter.on("renditions", this.onRenditions), this.emitter.on("subscription changed", this.onSubscriptionChanged);
5081
5101
  }
5082
5102
  };
5083
- n(mi, "create", (e, t) => new mi(e, t));
5084
- let ts = mi;
5085
- const At = (i) => JSON.parse(JSON.stringify(i)), Va = 1e4, fi = class fi {
5103
+ n(li, "create", (e, t) => new li(e, t));
5104
+ let es = li;
5105
+ const At = (i) => JSON.parse(JSON.stringify(i)), Na = 1e4, mi = class mi {
5086
5106
  constructor(e, t, s) {
5087
5107
  n(this, "logger");
5088
5108
  n(this, "timers", new q());
@@ -5133,7 +5153,7 @@ const At = (i) => JSON.parse(JSON.stringify(i)), Va = 1e4, fi = class fi {
5133
5153
  });
5134
5154
  n(this, "isNewSubscription", () => {
5135
5155
  const e = ["burstMs", "meta", "initiator", "channelGroupId"];
5136
- return !je(hs(this.currentSubscription, e), hs(this.targetSubscription, e));
5156
+ return !je(ds(this.currentSubscription, e), ds(this.targetSubscription, e));
5137
5157
  });
5138
5158
  n(this, "onSubscriptionChanged", ({ to: e, reset: t }) => {
5139
5159
  this.logger.debug("onSubscriptionChanged", { to: e, reset: t }), t ? this.targetSubscription = At(this.currentSubscription) : this.currentSubscription = At(e), this._isSwitchingSubscription = this.isNewSubscription();
@@ -5143,7 +5163,7 @@ const At = (i) => JSON.parse(JSON.stringify(i)), Va = 1e4, fi = class fi {
5143
5163
  const e = this.currentSubscription.channelId, t = this.targetSubscription.channelId, s = e !== t;
5144
5164
  this._isSwitchingSubscription && (s && this.burstMs ? this.setBurst(this.burstMs) : this.setBurst(0), this.pendingSubscriptionTimeoutId && (this.timers.clearTimeout(this.pendingSubscriptionTimeoutId), this.pendingSubscriptionTimeoutId = void 0), s && this.timers.setTimeout(() => {
5145
5165
  this.currentSubscription.channelId === e && this.targetSubscription.channelId === t && (this.logger.warn("Channel switch timeout", t), this.targetSubscription = At(this.currentSubscription), this.emitter.emit("channel switch timeout", t));
5146
- }, Va), this.pendingSubscriptionTimeoutId = this.timers.setTimeout(
5166
+ }, Na), this.pendingSubscriptionTimeoutId = this.timers.setTimeout(
5147
5167
  () => this.emitter.emit("send signal", {
5148
5168
  type: "subscribe",
5149
5169
  subscription: this.getTargetSubscription()
@@ -5154,9 +5174,9 @@ const At = (i) => JSON.parse(JSON.stringify(i)), Va = 1e4, fi = class fi {
5154
5174
  this.logger = e, this.targetSubscription = t, this.currentSubscription = At(t), this.emitter = s, this.emitter.on("subscription changed", this.onSubscriptionChanged);
5155
5175
  }
5156
5176
  };
5157
- n(fi, "create", (e, t, s) => new fi(e, s, t));
5158
- let is = fi;
5159
- const Ds = 5e3, za = () => zs() || wi() || Ln(), Fs = () => za() ? 100 : 0, Os = (i) => (e) => e > i, Ai = class Ai {
5177
+ n(mi, "create", (e, t, s) => new mi(e, s, t));
5178
+ let ts = mi;
5179
+ const Ls = 5e3, Va = () => Ns() || pi() || Un(), _s = () => Va() ? 100 : 0, Ds = (i) => (e) => e > i, fi = class fi {
5160
5180
  constructor(e, t, s, r, o) {
5161
5181
  n(this, "emitter");
5162
5182
  n(this, "logger");
@@ -5188,8 +5208,8 @@ const Ds = 5e3, za = () => zs() || wi() || Ln(), Fs = () => za() ? 100 : 0, Os =
5188
5208
  maxBehind: 50,
5189
5209
  multiplier: 1,
5190
5210
  maxBehindAllowed: 600,
5191
- overshoot: Fs(),
5192
- minOvershootAllowed: Fs(),
5211
+ overshoot: _s(),
5212
+ minOvershootAllowed: _s(),
5193
5213
  maxOvershootAllowed: 500
5194
5214
  });
5195
5215
  /**
@@ -5285,7 +5305,7 @@ const Ds = 5e3, za = () => zs() || wi() || Ln(), Fs = () => za() ? 100 : 0, Os =
5285
5305
  var r;
5286
5306
  if (!e.channelId)
5287
5307
  throw new Error("Sample must be assigned to a channel");
5288
- this.currentChannelId || (this.currentChannelId = e.channelId), this.timestampOffset || (this.timestampOffset = e.timestamp / e.timescale * 1e3 - Ds);
5308
+ this.currentChannelId || (this.currentChannelId = e.channelId), this.timestampOffset || (this.timestampOffset = e.timestamp / e.timescale * 1e3 - Ls);
5289
5309
  const t = e.type === "video" && e.isSync;
5290
5310
  if (this.currentChannelId !== e.channelId) {
5291
5311
  let o = Number.MAX_SAFE_INTEGER;
@@ -5308,7 +5328,7 @@ const Ds = 5e3, za = () => zs() || wi() || Ln(), Fs = () => za() ? 100 : 0, Os =
5308
5328
  const s = t.mediaType();
5309
5329
  if (!s)
5310
5330
  throw new Error("Fragment must have a media type");
5311
- this.timestampOffset || (this.timestampOffset = t.baseMediaDecodeTime() / t.timescale() * 1e3 - Ds);
5331
+ this.timestampOffset || (this.timestampOffset = t.baseMediaDecodeTime() / t.timescale() * 1e3 - Ls);
5312
5332
  const r = t.mediaType() === "video" && t.startsWithKeyframe();
5313
5333
  this.currentChannelId !== e ? (console.assert(this.highestSeenTimestamps.size !== 0, "no known timestamps"), this.highestSeenTimestamps.forEach((c) => {
5314
5334
  }), this.currentChannelId = e) : (r || this.timeshiftOnAudio) && this.tryTimeshiftSync();
@@ -5354,7 +5374,7 @@ const Ds = 5e3, za = () => zs() || wi() || Ln(), Fs = () => za() ? 100 : 0, Os =
5354
5374
  }
5355
5375
  if (!this.timestampOffset)
5356
5376
  return;
5357
- const t = Date.now() - this.seekTimeoutTime * this.timeshiftSync.multiplier, s = this.timeShiftAdjustments.filter(Os(t)).length;
5377
+ const t = Date.now() - this.seekTimeoutTime * this.timeshiftSync.multiplier, s = this.timeShiftAdjustments.filter(Ds(t)).length;
5358
5378
  if (s && this.timeshiftSync.multiplier > 2)
5359
5379
  return this.logger.debug("Too many diff timeShifts within sliding window", {
5360
5380
  timeShiftsCooldownMs: t,
@@ -5382,7 +5402,7 @@ const Ds = 5e3, za = () => zs() || wi() || Ln(), Fs = () => za() ? 100 : 0, Os =
5382
5402
  const e = (c = this.drift) != null ? c : 0;
5383
5403
  if (e < 0 && -e < this.currentSyncMaxAhead() || e > 0 && e < this.currentSyncMaxBehind() || Math.abs(e) < 1 || !this.isSeekCooldownExpired())
5384
5404
  return;
5385
- const t = Date.now() - this.seekTimeoutTime * this.syncMaxBehindMultiplier, s = this.driftAdjustments.filter(Os(t)).length;
5405
+ const t = Date.now() - this.seekTimeoutTime * this.syncMaxBehindMultiplier, s = this.driftAdjustments.filter(Ds(t)).length;
5386
5406
  if (s && this.syncMaxBehindMultiplier > 2)
5387
5407
  return this.logger.debug("Too many diff adjustments within sliding window", {
5388
5408
  adjustmentsCooldownMs: t,
@@ -5465,9 +5485,9 @@ const Ds = 5e3, za = () => zs() || wi() || Ln(), Fs = () => za() ? 100 : 0, Os =
5465
5485
  return this.serverCurrentTime - this.playbackSource.currentTime;
5466
5486
  }
5467
5487
  };
5468
- n(Ai, "create", (e, t, s, r, o) => new Ai(e, t, s, r, o));
5469
- let ss = Ai;
5470
- const Ha = {
5488
+ n(fi, "create", (e, t, s, r, o) => new fi(e, t, s, r, o));
5489
+ let is = fi;
5490
+ const za = {
5471
5491
  enabled: !0,
5472
5492
  interval: 3e4,
5473
5493
  includeErrors: !0,
@@ -5476,7 +5496,7 @@ const Ha = {
5476
5496
  maxRetries: 10,
5477
5497
  maxErrorReports: 50,
5478
5498
  maxEvents: 50
5479
- }, Ui = (i, e) => R(A({}, e), { type: i, timestamp: (/* @__PURE__ */ new Date()).toISOString(), discriminator: "web" }), gi = class gi {
5499
+ }, xi = (i, e) => R(A({}, e), { type: i, timestamp: (/* @__PURE__ */ new Date()).toISOString(), discriminator: "web" }), Ai = class Ai {
5480
5500
  constructor(e, t, s, r) {
5481
5501
  n(this, "logger");
5482
5502
  n(this, "timers", new q());
@@ -5499,19 +5519,19 @@ const Ha = {
5499
5519
  n(this, "addStats", ({ isFinal: e, initiator: t } = { isFinal: !1, initiator: "interval" }, s = {}) => {
5500
5520
  if (!this.options.includeStats)
5501
5521
  return;
5502
- const r = this.parentContext.getStatistics(), o = Ui("stats", R(A(A({}, s), r), { isFinal: e, initiator: t, count: this.statsCount++ }));
5522
+ const r = this.parentContext.getStatistics(), o = xi("stats", R(A(A({}, s), r), { isFinal: e, initiator: t, count: this.statsCount++ }));
5503
5523
  this.unsentLines.push(o);
5504
5524
  });
5505
5525
  n(this, "addEvent", (e) => {
5506
5526
  if (!this.options.includeEvents || this.eventCount > this.options.maxEvents)
5507
5527
  return;
5508
- const t = this.parentContext.getStatistics(), s = Ui("event", A(A({}, t), e));
5528
+ const t = this.parentContext.getStatistics(), s = xi("event", A(A({}, t), e));
5509
5529
  this.eventCount++, this.unsentLines.push(s);
5510
5530
  });
5511
5531
  n(this, "getStatistics", () => ({
5512
5532
  errorCount: this.errorCount
5513
5533
  }));
5514
- n(this, "send", (e) => y(this, null, function* () {
5534
+ n(this, "send", (e) => E(this, null, function* () {
5515
5535
  if (this.options.enabled && !(this.retries >= this.options.maxRetries) && !this.unsentLines.isEmpty()) {
5516
5536
  this.logger.debug("Sending telemetry", { lines: this.unsentLines.items() });
5517
5537
  try {
@@ -5526,7 +5546,7 @@ const Ha = {
5526
5546
  this.parentContext.connectionState === "connected" ? this.emitter.emit("send signal", {
5527
5547
  type: "telemetry",
5528
5548
  body: t
5529
- }) : yield Bn(new URL(this.options.url), { body: t, headers: { "Content-Type": "text/plain" } });
5549
+ }) : yield Cn(new URL(this.options.url), { body: t, headers: { "Content-Type": "text/plain" } });
5530
5550
  break;
5531
5551
  }
5532
5552
  this.retries = 0, this.unsentLines.clear();
@@ -5550,16 +5570,16 @@ const Ha = {
5550
5570
  return;
5551
5571
  const r = this.parentContext.getStatistics();
5552
5572
  this.unsentLines.push(
5553
- Ui("error", A(A({}, r), e.toStringifiable()))
5573
+ xi("error", A(A({}, r), e.toStringifiable()))
5554
5574
  );
5555
5575
  }
5556
5576
  });
5557
- this.logger = e, this.emitter = t, this.options = A(A({}, Ha), s), this.parentContext = r;
5577
+ this.logger = e, this.emitter = t, this.options = A(A({}, za), s), this.parentContext = r;
5558
5578
  }
5559
5579
  };
5560
- n(gi, "create", (e, t, s, r) => new gi(e, t, s, r));
5561
- let Xt = gi;
5562
- const pi = class pi {
5580
+ n(Ai, "create", (e, t, s, r) => new Ai(e, t, s, r));
5581
+ let Wt = Ai;
5582
+ const gi = class gi {
5563
5583
  constructor(e, t, s) {
5564
5584
  n(this, "logger");
5565
5585
  n(this, "element");
@@ -5574,40 +5594,40 @@ const pi = class pi {
5574
5594
  this.logger = e, this.element = t, this.documentState = s, this.timers.setInterval(this.unpause, 100);
5575
5595
  }
5576
5596
  };
5577
- n(pi, "create", (e, t, s) => new pi(e, t, s));
5578
- let Gt = pi;
5579
- const Qa = 6, Xa = (i) => {
5597
+ n(gi, "create", (e, t, s) => new gi(e, t, s));
5598
+ let Xt = gi;
5599
+ const Ha = 6, Qa = (i) => {
5580
5600
  let e = [i], t = 0, s = 0, r = !1;
5581
5601
  const o = (c, h) => {
5582
- var N, G, L;
5583
- c.flags && pt(c.flags) && (t = (N = c.compositionTimeOffset) != null ? N : 0), c.timestamp += t, c.compositionTimeOffset = ((G = c.compositionTimeOffset) != null ? G : 0) - t;
5584
- const u = c.timestamp / c.timescale, m = h.flags && pt(h.flags) ? (L = h.compositionTimeOffset) != null ? L : 0 : t, w = (h.timestamp + m) / h.timescale, E = Math.max(0, Math.round((w - u) * c.timescale));
5585
- return E > 0 && (s = E), R(A({}, c), {
5602
+ var N, X, L;
5603
+ c.flags && pt(c.flags) && (t = (N = c.compositionTimeOffset) != null ? N : 0), c.timestamp += t, c.compositionTimeOffset = ((X = c.compositionTimeOffset) != null ? X : 0) - t;
5604
+ const u = c.timestamp / c.timescale, m = h.flags && pt(h.flags) ? (L = h.compositionTimeOffset) != null ? L : 0 : t, p = (h.timestamp + m) / h.timescale, y = Math.max(0, Math.round((p - u) * c.timescale));
5605
+ return y > 0 && (s = y), R(A({}, c), {
5586
5606
  /*
5587
5607
  During resync timeshifts we may end up with negative durations (normalized to 0 above) which is not allowed in mse (the MseModule
5588
5608
  drops the frame) so we use the last known duration instead. This is not ideal but it's better than dropping the frame.
5589
5609
  */
5590
- duration: E > 0 ? E : s
5610
+ duration: y > 0 ? y : s
5591
5611
  });
5592
5612
  };
5593
5613
  return (c, h = !1) => {
5594
- if (c.flags && pt(c.flags) && h && (r = !r), !(h && e.length < Qa && r) && e.length > 0) {
5614
+ if (c.flags && pt(c.flags) && h && (r = !r), !(h && e.length < Ha && r) && e.length > 0) {
5595
5615
  r = !1;
5596
5616
  let l = c;
5597
5617
  for (let g = e.length - 1; g > 0; g--) {
5598
- const w = e[g];
5599
- if (!w || !l)
5618
+ const p = e[g];
5619
+ if (!p || !l)
5600
5620
  break;
5601
- w.timestamp >= l.timestamp ? e.splice(g, 1) : l = w;
5621
+ p.timestamp >= l.timestamp ? e.splice(g, 1) : l = p;
5602
5622
  }
5603
5623
  const m = e.map(
5604
- (g, w) => o(g, e[w + 1] || c)
5624
+ (g, p) => o(g, e[p + 1] || c)
5605
5625
  );
5606
5626
  return e = [c], m;
5607
5627
  }
5608
5628
  return e.push(c), [];
5609
5629
  };
5610
- }, Ga = (i, e, t) => {
5630
+ }, Wa = (i, e, t) => {
5611
5631
  if (st(e))
5612
5632
  return A(R(A({}, i), {
5613
5633
  type: "video",
@@ -5631,7 +5651,7 @@ const Qa = 6, Xa = (i) => {
5631
5651
  duration: 0
5632
5652
  });
5633
5653
  };
5634
- class Wa {
5654
+ class Xa {
5635
5655
  constructor() {
5636
5656
  n(this, "highEntropyValues");
5637
5657
  var e;
@@ -5651,22 +5671,22 @@ class Wa {
5651
5671
  if (self.navigator.userAgentData && this.highEntropyValues) {
5652
5672
  const m = "1", g = [...(a = this.highEntropyValues.brands) != null ? a : []];
5653
5673
  g.sort((L, _) => L.brand.localeCompare(_.brand));
5654
- const w = [...(c = this.highEntropyValues.fullVersionList) != null ? c : []];
5655
- w.sort((L, _) => L.brand.localeCompare(_.brand));
5656
- const E = w.map((L) => L.version), M = g.map((L) => L.brand), N = g.map((L) => L.version), G = parseInt((u = (h = this.highEntropyValues.platformVersion) == null ? void 0 : h.split(".")[0]) != null ? u : m);
5674
+ const p = [...(c = this.highEntropyValues.fullVersionList) != null ? c : []];
5675
+ p.sort((L, _) => L.brand.localeCompare(_.brand));
5676
+ const y = p.map((L) => L.version), U = g.map((L) => L.brand), N = g.map((L) => L.version), X = parseInt((u = (h = this.highEntropyValues.platformVersion) == null ? void 0 : h.split(".")[0]) != null ? u : m);
5657
5677
  return A({
5658
5678
  userAgentLegacy: window.navigator.userAgent,
5659
5679
  ua: {
5660
5680
  browser: {
5661
- brands: M,
5662
- fullVersionBrands: E,
5681
+ brands: U,
5682
+ fullVersionBrands: y,
5663
5683
  majorVersions: N
5664
5684
  },
5665
5685
  device: this.highEntropyValues.model || "Other",
5666
5686
  os: {
5667
5687
  family: this.highEntropyValues.platform || "Other",
5668
5688
  version: (l = this.highEntropyValues.platformVersion) != null ? l : m,
5669
- major_version: Number.isFinite(G) ? G : 0
5689
+ major_version: Number.isFinite(X) ? X : 0
5670
5690
  }
5671
5691
  }
5672
5692
  }, r);
@@ -5676,7 +5696,7 @@ class Wa {
5676
5696
  }, r);
5677
5697
  }
5678
5698
  }
5679
- const ja = (i) => {
5699
+ const Ga = (i) => {
5680
5700
  if (typeof i != "object" || i === null)
5681
5701
  throw new Error("not an object");
5682
5702
  if (!("video" in i))
@@ -5687,7 +5707,7 @@ const ja = (i) => {
5687
5707
  throw new Error("missing channelId");
5688
5708
  return !0;
5689
5709
  };
5690
- var Qe, Y, Xe;
5710
+ var Qe, Y, We;
5691
5711
  const $ = class $ extends Pe {
5692
5712
  constructor(t) {
5693
5713
  var xe, Ue;
@@ -5697,7 +5717,7 @@ const $ = class $ extends Pe {
5697
5717
  * Picture in picture
5698
5718
  */
5699
5719
  n(this, "pictureInPicture");
5700
- n(this, "browser", On());
5720
+ n(this, "browser", Dn());
5701
5721
  n(this, "options");
5702
5722
  n(this, "element");
5703
5723
  n(this, "playbackSource");
@@ -5706,22 +5726,22 @@ const $ = class $ extends Pe {
5706
5726
  n(this, "modules");
5707
5727
  n(this, "clientIp");
5708
5728
  n(this, "sessionId");
5709
- n(this, "clientId", ls());
5729
+ n(this, "clientId", us());
5710
5730
  n(this, "_channels", []);
5711
5731
  n(this, "createdAt", Date.now());
5712
5732
  n(this, "hasCalledConnect", !1);
5713
5733
  n(this, "latestEmittedLanguages", []);
5714
5734
  n(this, "wakeLock");
5715
- n(this, "pool", new as($.MAX_POOL_SIZE));
5716
- n(this, "userAgentInformation", new Wa());
5735
+ n(this, "pool", new os($.MAX_POOL_SIZE));
5736
+ n(this, "userAgentInformation", new Xa());
5717
5737
  n(this, "encryptedMediaExtensions");
5718
- p(this, Qe, 0);
5719
- p(this, Y, []);
5738
+ w(this, Qe, 0);
5739
+ w(this, Y, []);
5720
5740
  n(this, "sampleProcessingSesssions", /* @__PURE__ */ new Map());
5721
5741
  n(this, "sizes", /* @__PURE__ */ new Map());
5722
5742
  n(this, "isSuspended", !0);
5723
5743
  n(this, "disconnectTimeout");
5724
- p(this, Xe);
5744
+ w(this, We);
5725
5745
  /**
5726
5746
  * Attaches the video view to a DOM element. The Vindral video view will be sized to fill this element while
5727
5747
  * maintaining the correct aspect ratio.
@@ -5766,7 +5786,7 @@ const $ = class $ extends Pe {
5766
5786
  var t, s;
5767
5787
  this.hasCalledConnect || (this.hasCalledConnect = !0, Object.values(this.modules).forEach((r) => {
5768
5788
  r && "load" in r && r.load();
5769
- }), this.unsuspend(), this.playbackSource instanceof Di && ((s = (t = this.playbackSource).load) == null || s.call(t)), this.modules.connection.connect());
5789
+ }), this.unsuspend(), this.playbackSource instanceof _i && ((s = (t = this.playbackSource).load) == null || s.call(t)), this.modules.connection.connect());
5770
5790
  });
5771
5791
  /**
5772
5792
  * Get options that can be used for CastSender
@@ -5785,16 +5805,16 @@ const $ = class $ extends Pe {
5785
5805
  media: this.options.get("media"),
5786
5806
  drm: this.options.get("drm")
5787
5807
  }));
5788
- n(this, "onConnectInfo", (t) => y(this, null, function* () {
5808
+ n(this, "onConnectInfo", (t) => E(this, null, function* () {
5789
5809
  var u;
5790
- this.sessionId = ls();
5810
+ this.sessionId = us();
5791
5811
  const s = this.modules.subscription.getTargetSubscription(), r = t.channels.find((l) => l.channelId === s.channelId);
5792
5812
  if (this.emitter.emit("connect info", t), this._channels = t.channels, this.updateTextTracks((u = r == null ? void 0 : r.renditions) != null ? u : []), !this.textTrack && this.options.get("textTrack") && (this.textTrack = this.options.get("textTrack")), yield Promise.all(
5793
- t.channels.map((l) => y(this, null, function* () {
5813
+ t.channels.map((l) => E(this, null, function* () {
5794
5814
  l.overrides && this.options.addOverrides(l.channelId, l.overrides), l.renditions = yield this.filterRenditions(l.renditions), this.modules.renditions.setRenditions(l.channelId, l.renditions);
5795
5815
  }))
5796
5816
  ), !r)
5797
- throw Xs("external");
5817
+ throw Hs("external");
5798
5818
  const o = this.options.getOverride(
5799
5819
  "sizeBasedResolutionCapEnabled",
5800
5820
  this.channelId
@@ -5856,19 +5876,19 @@ const $ = class $ extends Pe {
5856
5876
  r.endTime * 1e3 < t - 2e3 && s.removeCue(r);
5857
5877
  });
5858
5878
  });
5859
- n(this, "filterRenditions", (t) => y(this, null, function* () {
5879
+ n(this, "filterRenditions", (t) => E(this, null, function* () {
5860
5880
  const s = yield Promise.all(
5861
- t.map((c) => y(this, null, function* () {
5881
+ t.map((c) => E(this, null, function* () {
5862
5882
  var l, m, g;
5863
5883
  if (nt(c))
5864
5884
  return !0;
5865
5885
  if (!st(c) || !this.isSupportedVideoCodecProfile(c.codec, c.codecString))
5866
5886
  return !1;
5867
5887
  if (!this.willUseMediaSource()) {
5868
- const w = this.options.get("advanced"), E = (l = w.wasmDecodingConstraint.bitRate) != null ? l : Number.MAX_SAFE_INTEGER, M = (m = w.wasmDecodingConstraint.width) != null ? m : Number.MAX_SAFE_INTEGER, N = (g = w.wasmDecodingConstraint.height) != null ? g : Number.MAX_SAFE_INTEGER;
5869
- return c.bitRate <= E && c.width <= M && c.height <= N;
5888
+ const p = this.options.get("advanced"), y = (l = p.wasmDecodingConstraint.bitRate) != null ? l : Number.MAX_SAFE_INTEGER, U = (m = p.wasmDecodingConstraint.width) != null ? m : Number.MAX_SAFE_INTEGER, N = (g = p.wasmDecodingConstraint.height) != null ? g : Number.MAX_SAFE_INTEGER;
5889
+ return c.bitRate <= y && c.width <= U && c.height <= N;
5870
5890
  }
5871
- const h = yield ha(c);
5891
+ const h = yield da(c);
5872
5892
  if (!h.supported || c.codec == "av1" && !h.smooth && !h.powerEfficient)
5873
5893
  return !1;
5874
5894
  const u = this.options.getOverride("maxVideoBitRate", this.channelId);
@@ -5894,22 +5914,22 @@ const $ = class $ extends Pe {
5894
5914
  $.INITIAL_MAX_BIT_RATE,
5895
5915
  s,
5896
5916
  this.targetSubscription.audio.bitRate
5897
- ), a = this.options.get("media") === "audio" ? [] : this.options.get("videoCodecs", this.channelId), c = this.supportedAudioCodecs(), h = t.renditions.filter(nt), u = t.renditions.filter(st), l = c.find((E) => h.find((M) => M.codec === E) !== void 0), m = a.find((E) => u.find((M) => M.codec === E) !== void 0), g = h.map((E) => E.language);
5917
+ ), a = this.options.get("media") === "audio" ? [] : this.options.get("videoCodecs", this.channelId), c = this.supportedAudioCodecs(), h = t.renditions.filter(nt), u = t.renditions.filter(st), l = c.find((y) => h.find((U) => U.codec === y) !== void 0), m = a.find((y) => u.find((U) => U.codec === y) !== void 0), g = h.map((y) => y.language);
5898
5918
  if (this.logger.debug("supported and selected codecs", { audioCodecs: c, videoCodecs: a, audioCodec: l, videoCodec: m }), m) {
5899
- const E = this.options.get("maxSize");
5919
+ const y = this.options.get("maxSize");
5900
5920
  this.modules.subscription.setVideoConstraint(A({
5901
5921
  codec: m,
5902
5922
  bitRate: this.abrEnabled ? r : this.options.get("maxVideoBitRate")
5903
- }, E));
5923
+ }, y));
5904
5924
  }
5905
5925
  l && (this.modules.subscription.setAudioConstraint({
5906
5926
  codec: l,
5907
5927
  bitRate: this.abrEnabled ? o : this.options.get("maxAudioBitRate"),
5908
5928
  language: this.options.get("language")
5909
5929
  }), (!g.includes(this.options.get("language")) || this.language === void 0) && this.modules.subscription.setLanguage(g[0])), this.alignSizeAndBitRate(this.targetSubscription);
5910
- const w = this.modules.subscription.getTargetSubscription();
5930
+ const p = this.modules.subscription.getTargetSubscription();
5911
5931
  this.emitter.emit("subscription changed", {
5912
- to: w,
5932
+ to: p,
5913
5933
  from: this.modules.subscription.getCurrentSubscription()
5914
5934
  });
5915
5935
  });
@@ -5930,7 +5950,7 @@ const $ = class $ extends Pe {
5930
5950
  const t = [];
5931
5951
  return (this.browser.supportsMp4Opus && this.options.get("mseOpusEnabled") || !this.willUseMediaSource()) && t.push("opus"), this.willUseMediaSource() && t.push("aac"), t;
5932
5952
  });
5933
- n(this, "initializeDecodingModule", () => y(this, null, function* () {
5953
+ n(this, "initializeDecodingModule", () => E(this, null, function* () {
5934
5954
  var r, o;
5935
5955
  const t = this.currentRenditionLevel, s = [];
5936
5956
  if (!t)
@@ -5948,7 +5968,7 @@ const $ = class $ extends Pe {
5948
5968
  if (this.willUseMediaSource() && this.element instanceof HTMLMediaElement)
5949
5969
  this.emitter.emit("flush buffers"), yield (r = this.modules.mseModule) == null ? void 0 : r.setSourceBuffers(s);
5950
5970
  else {
5951
- const a = yield ns.create(
5971
+ const a = yield ss.create(
5952
5972
  this.emitter,
5953
5973
  this.logger.createContext("DecoderModule"),
5954
5974
  s,
@@ -5962,9 +5982,9 @@ const $ = class $ extends Pe {
5962
5982
  * Fully unloads the instance. This disconnects the clients and stops any background tasks.
5963
5983
  * This client instance can not be used after this has been called.
5964
5984
  */
5965
- n(this, "unload", () => y(this, null, function* () {
5985
+ n(this, "unload", () => E(this, null, function* () {
5966
5986
  var t, s, r;
5967
- this.logger.debug("Unloading modules..."), yield Promise.all(Object.values(this.modules).map((o) => o == null ? void 0 : o.unload())), (t = this.wakeLock) == null || t.unload(), this.pool = new as($.MAX_POOL_SIZE), (r = (s = this.playbackSource).unload) == null || r.call(s), this.element.remove(), this.emitter.reset(), this.encryptedMediaExtensions.unload(), this.reset(), this.logger.debug("Unloaded modules");
5987
+ this.logger.debug("Unloading modules..."), yield Promise.all(Object.values(this.modules).map((o) => o == null ? void 0 : o.unload())), (t = this.wakeLock) == null || t.unload(), this.pool = new os($.MAX_POOL_SIZE), (r = (s = this.playbackSource).unload) == null || r.call(s), this.element.remove(), this.emitter.reset(), this.encryptedMediaExtensions.unload(), this.reset(), this.logger.debug("Unloaded modules");
5968
5988
  }));
5969
5989
  /**
5970
5990
  * @deprecated since 3.0.0 Use play instead.
@@ -5990,7 +6010,7 @@ const $ = class $ extends Pe {
5990
6010
  this.options.get("pauseSupportEnabled") && this.playbackState !== "paused" && (this.playbackSource.pause(), this.hasCalledConnect && this.suspend());
5991
6011
  });
5992
6012
  n(this, "registerDebugInstance", () => {
5993
- da(this);
6013
+ ca(this);
5994
6014
  });
5995
6015
  /**
5996
6016
  *
@@ -6032,7 +6052,7 @@ const $ = class $ extends Pe {
6032
6052
  const t = this.modules.canvasModule ? this.options.get("iosMediaElementEnabled") : void 0;
6033
6053
  return A({
6034
6054
  uptime: Date.now() - this.createdAt,
6035
- version: "4.0.0-109-gc46e6fa9",
6055
+ version: "4.0.0-110-ge5c8e532",
6036
6056
  clientId: this.clientId,
6037
6057
  sessionId: this.sessionId,
6038
6058
  channelId: this.channelId,
@@ -6064,7 +6084,7 @@ const $ = class $ extends Pe {
6064
6084
  if (s && t)
6065
6085
  return t - s;
6066
6086
  });
6067
- this.options = new ca(A(A({}, Wn), vr(t)));
6087
+ this.options = new aa(A(A({}, Wn), Sr(t)));
6068
6088
  const s = ["localhost", "127.0.0.1"];
6069
6089
  t.telemetryEnabled === void 0 && s.includes(location.hostname) && this.options.set("telemetryEnabled", !1);
6070
6090
  const r = {
@@ -6080,45 +6100,45 @@ const $ = class $ extends Pe {
6080
6100
  }
6081
6101
  }, o = Nt.get();
6082
6102
  o.setLevel(this.options.get("logLevel")), o.setDebug(!1), this.logger = o;
6083
- const a = Yi.create(
6103
+ const a = Ji.create(
6084
6104
  this.emitter,
6085
6105
  this.logger.createContext("PictureInPictureModule")
6086
- ), c = q.create(), h = Vi.create(this.emitter, this.logger.createContext("ConnectionModule"), {
6106
+ ), c = q.create(), h = Ni.create(this.emitter, this.logger.createContext("ConnectionModule"), {
6087
6107
  reconnectHandler: this.options.get("reconnectHandler"),
6088
6108
  options: this.options,
6089
6109
  onConnectInfo: this.onConnectInfo
6090
- }), u = is.create(
6110
+ }), u = ts.create(
6091
6111
  this.logger.createContext("SubscriptionModule"),
6092
6112
  this.emitter,
6093
6113
  r
6094
- ), l = ts.create(this.emitter, u), m = es.create(
6114
+ ), l = es.create(this.emitter, u), m = $i.create(
6095
6115
  this.emitter,
6096
6116
  this.logger.createContext("QualityOfServiceModule")
6097
- ), g = Ki.create(
6117
+ ), g = Yi.create(
6098
6118
  this.emitter,
6099
6119
  this.logger.createContext("PlaybackModule"),
6100
6120
  this,
6101
6121
  this.options.get("minBufferTime")
6102
6122
  );
6103
- this.encryptedMediaExtensions = new vs(
6123
+ this.encryptedMediaExtensions = new ws(
6104
6124
  this.emitter,
6105
6125
  this.logger.createContext("EncryptedMediaExtensions"),
6106
6126
  (xe = t.drm) == null ? void 0 : xe.headers,
6107
6127
  (Ue = t.drm) == null ? void 0 : Ue.queryParams
6108
6128
  );
6109
- const w = Hi.create(this.emitter), E = this.options.get("poster"), M = E === !0 ? this.getThumbnailUrl() : E || void 0;
6110
- let N, G, L;
6129
+ const p = zi.create(this.emitter), y = this.options.get("poster"), U = y === !0 ? this.getThumbnailUrl() : y || void 0;
6130
+ let N, X, L;
6111
6131
  if (this.willUseMediaSource()) {
6112
- const f = new Di({
6132
+ const f = new _i({
6113
6133
  type: this.options.get("media") == "audio" ? "audio" : "video",
6114
6134
  autoplay: !1,
6115
6135
  muted: this.options.get("muted") || this.options.get("media") === "video",
6116
6136
  logger: this.logger.createContext("MediaElement"),
6117
- poster: M
6137
+ poster: U
6118
6138
  });
6119
- f.on("buffer state", (v) => this.emitter.emit("buffer state", v)), f.on("needs user input", (v) => this.emitter.emit("needs user input", v)), f.on("volume state", (v) => this.emit("volume state", v)), f.on("media element state", (v) => this.onMediaElementState(v)), this.element = f.element, this.playbackSource = f, vs.isSupported() && this.encryptedMediaExtensions.attach(f.element), N = Ji.create(this.logger.createContext("MseModule"), this.emitter, this.element), this.options.get("pauseSupportEnabled") || (G = Gt.create(this.logger.createContext("UnpauseModule"), f, w)), this.options.get("pictureInPictureEnabled") && this.emitter.emit("add picture in picture listener", { element: f.element });
6139
+ f.on("buffer state", (v) => this.emitter.emit("buffer state", v)), f.on("needs user input", (v) => this.emitter.emit("needs user input", v)), f.on("volume state", (v) => this.emit("volume state", v)), f.on("media element state", (v) => this.onMediaElementState(v)), this.element = f.element, this.playbackSource = f, ws.isSupported() && this.encryptedMediaExtensions.attach(f.element), N = Zi.create(this.logger.createContext("MseModule"), this.emitter, this.element), this.options.get("pauseSupportEnabled") || (X = Xt.create(this.logger.createContext("UnpauseModule"), f, p)), this.options.get("pictureInPictureEnabled") && this.emitter.emit("add picture in picture listener", { element: f.element });
6120
6140
  } else if (this.browser.platform.iosVersion >= 15 && this.options.get("iosMediaElementEnabled")) {
6121
- const f = Zi.create(
6141
+ const f = qi.create(
6122
6142
  this.emitter,
6123
6143
  this.logger.createContext("ModernCanvasModule"),
6124
6144
  this.pool,
@@ -6126,19 +6146,19 @@ const $ = class $ extends Pe {
6126
6146
  {
6127
6147
  type: this.options.get("media") == "audio" ? "audio" : "video",
6128
6148
  muted: this.options.get("muted") || this.options.get("media") === "video",
6129
- poster: M
6149
+ poster: U
6130
6150
  }
6131
6151
  ), v = f.element();
6132
- this.element = v.element, this.playbackSource = f, L = f, this.options.get("pictureInPictureEnabled") && this.browser.platform.iosVersion > 15 && this.emitter.emit("add picture in picture listener", { element: this.element }), this.options.get("pauseSupportEnabled") || (G = Gt.create(this.logger.createContext("UnpauseModule"), v, w));
6152
+ this.element = v.element, this.playbackSource = f, L = f, this.options.get("pictureInPictureEnabled") && this.browser.platform.iosVersion > 15 && this.emitter.emit("add picture in picture listener", { element: this.element }), this.options.get("pauseSupportEnabled") || (X = Xt.create(this.logger.createContext("UnpauseModule"), v, p));
6133
6153
  } else {
6134
- const f = qi.create(
6154
+ const f = ji.create(
6135
6155
  this.emitter,
6136
6156
  this.logger.createContext("LegacyCanvasModule"),
6137
6157
  this.pool,
6138
6158
  this,
6139
6159
  this.options.get("muted") || this.options.get("media") === "video"
6140
6160
  );
6141
- this.element = f.element(), this.playbackSource = f, L = f, this.options.get("iosWakeLockEnabled") && (this.wakeLock = new sa());
6161
+ this.element = f.element(), this.playbackSource = f, L = f, this.options.get("iosWakeLockEnabled") && (this.wakeLock = new ia());
6142
6162
  }
6143
6163
  this.emitter.on("channel reset", this.resetModules), this.emitter.on("no data timeout", this.resetModules), this.emitter.on("media element state", (f) => this.onMediaElementState(f)), this.emitter.on("volume state", (f) => this.emit("volume state", f)), this.options.get("pauseSupportEnabled") || this.emitter.on("exit picture in picture", () => c.setTimeout(() => this.play(), 0)), this.emitter.on("constraint cap changed", (f) => {
6144
6164
  this.logger.info("new cap set", { cap: f }), this.alignSizeAndBitRate(this.targetSubscription);
@@ -6151,13 +6171,13 @@ const $ = class $ extends Pe {
6151
6171
  if (f.type() === "external" && this.emit("error", f), f.isFatal())
6152
6172
  return () => void this.unload();
6153
6173
  });
6154
- const _ = this.browser.platform.isIOS && !this.browser.platform.isIpadOS, Z = ss.create(
6174
+ const _ = this.browser.platform.isIOS && !this.browser.platform.isIpadOS, Z = is.create(
6155
6175
  this.emitter,
6156
6176
  this.logger.createContext("SyncModule"),
6157
6177
  this.playbackSource,
6158
6178
  g,
6159
6179
  this.willUseMediaSource() && !_
6160
- ), te = (this.options.get("edgeUrl") || this.options.get("url")).replace("wss://", "https://").replace("ws://", "http://").replace("//lb.", "//errors."), me = new URL("/telemetry", te).toString(), Mt = Xt.create(
6180
+ ), te = (this.options.get("edgeUrl") || this.options.get("url")).replace("wss://", "https://").replace("ws://", "http://").replace("//lb.", "//errors."), me = new URL("/telemetry", te).toString(), Mt = Wt.create(
6161
6181
  this.logger.createContext("TelemetryModule"),
6162
6182
  this.emitter,
6163
6183
  {
@@ -6180,8 +6200,8 @@ const $ = class $ extends Pe {
6180
6200
  minBufferTime: this.options.get("minBufferTime")
6181
6201
  }
6182
6202
  ),
6183
- incomingData: Xi.create(this.emitter),
6184
- adaptivity: Fi.create(
6203
+ incomingData: Qi.create(this.emitter),
6204
+ adaptivity: Di.create(
6185
6205
  this.emitter,
6186
6206
  this.logger.createContext("AdaptivityModule"),
6187
6207
  m,
@@ -6189,15 +6209,15 @@ const $ = class $ extends Pe {
6189
6209
  cooldownTime: Math.max(this.options.get("minBufferTime"), 2e3)
6190
6210
  }
6191
6211
  ),
6192
- constraintCap: zi.create(
6212
+ constraintCap: Vi.create(
6193
6213
  this.emitter,
6194
6214
  this.element,
6195
6215
  l,
6196
6216
  this.options.get("abrEnabled") ? this.options.get("sizeBasedResolutionCapEnabled") : !1
6197
6217
  ),
6198
- event: Qi.create(this.emitter, this.logger.createContext("EventModule"), Z),
6218
+ event: Hi.create(this.emitter, this.logger.createContext("EventModule"), Z),
6199
6219
  sync: Z,
6200
- documentState: w,
6220
+ documentState: p,
6201
6221
  connection: h,
6202
6222
  playback: g,
6203
6223
  pictureInPicture: a,
@@ -6206,13 +6226,13 @@ const $ = class $ extends Pe {
6206
6226
  renditions: l,
6207
6227
  qualityOfService: m,
6208
6228
  mseModule: N,
6209
- unpause: G,
6229
+ unpause: X,
6210
6230
  canvasModule: L
6211
6231
  }, this.modules.adaptivity.isEnabled = this.options.get("abrEnabled"), this.emitter.on("page active", (f) => {
6212
6232
  var v;
6213
6233
  f && typeof this.disconnectTimeout == "number" && (this.modules.timer.clearInterval(this.disconnectTimeout), this.disconnectTimeout = void 0), f ? this.playbackSource.isPaused || (this.logger.debug("Unsuspending"), this.unsuspend()) : (this.logger.debug("Suspending"), this.suspend(), this.modules.decoder ? this.options.get("iosBackgroundPlayEnabled") ? (this.modules.decoder.unsuspend(), (v = this.modules.canvasModule) == null || v.unsuspend()) : this.modules.connection.disconnect() : (this.disconnectTimeout && this.modules.timer.clearInterval(this.disconnectTimeout), this.disconnectTimeout = this.modules.timer.setInterval(() => {
6214
- const U = this.playbackState === "paused" || this.muted;
6215
- this.connectionState === "connected" && U && (this.emitter.emit("flush buffers"), this.modules.connection.disconnect("Page inactive timeout"));
6234
+ const M = this.playbackState === "paused" || this.muted;
6235
+ this.connectionState === "connected" && M && (this.emitter.emit("flush buffers"), this.modules.connection.disconnect("Page inactive timeout"));
6216
6236
  }, $.DISCONNECT_TIMEOUT)));
6217
6237
  });
6218
6238
  let fe;
@@ -6239,86 +6259,86 @@ const $ = class $ extends Pe {
6239
6259
  }), this.emitter.on("recovered from media error", () => {
6240
6260
  this.modules.adaptivity.reset(this.targetBufferTime * 2);
6241
6261
  }), this.emitter.once("connect info", (f) => {
6242
- var x, B, C;
6243
- const U = ((B = (x = f.telemetry) == null ? void 0 : x.probability) != null ? B : 1) >= Math.random();
6244
- f.telemetry && ((C = this.modules.telemetry) == null || C.unload(), this.modules.telemetry = Xt.create(
6262
+ var P, C, I;
6263
+ const M = ((C = (P = f.telemetry) == null ? void 0 : P.probability) != null ? C : 1) >= Math.random();
6264
+ f.telemetry && ((I = this.modules.telemetry) == null || I.unload(), this.modules.telemetry = Wt.create(
6245
6265
  this.logger.createContext("TelemetryModule"),
6246
6266
  this.emitter,
6247
6267
  R(A({}, f.telemetry), {
6248
- enabled: this.options.get("telemetryEnabled") && U
6268
+ enabled: this.options.get("telemetryEnabled") && M
6249
6269
  }),
6250
6270
  this
6251
6271
  ), this.modules.telemetry.load());
6252
6272
  }), this.emitter.on("adapt level", (f) => {
6253
- var ie, F, Q, re, se;
6273
+ var ie, O, Q, re, se;
6254
6274
  this.logger.debug("adapt level", { direction: f });
6255
- const v = this.modules.renditions.getRenditionLevels(), U = this.modules.renditions.getRenditionLevel(), x = v.findIndex((V) => V === U), B = v.length - 1;
6256
- let C = x;
6275
+ const v = this.modules.renditions.getRenditionLevels(), M = this.modules.renditions.getRenditionLevel(), P = v.findIndex((V) => V === M), C = v.length - 1;
6276
+ let I = P;
6257
6277
  switch (f) {
6258
6278
  case "upgrade":
6259
6279
  {
6260
- const V = Math.min(x + 1, B), oe = v[V], gn = (ie = this.modules.connection.estimatedBandwidth) != null ? ie : ke(), pn = ((Q = (F = oe == null ? void 0 : oe.audio) == null ? void 0 : F.bitRate) != null ? Q : 0) + ((se = (re = oe == null ? void 0 : oe.video) == null ? void 0 : re.bitRate) != null ? se : 0), wn = gn * 2 > pn;
6261
- oe && wn && this.modules.adaptivity.isQoSOk(oe) && (C = V);
6280
+ const V = Math.min(P + 1, C), oe = v[V], fn = (ie = this.modules.connection.estimatedBandwidth) != null ? ie : ke(), An = ((Q = (O = oe == null ? void 0 : oe.audio) == null ? void 0 : O.bitRate) != null ? Q : 0) + ((se = (re = oe == null ? void 0 : oe.video) == null ? void 0 : re.bitRate) != null ? se : 0), gn = fn * 2 > An;
6281
+ oe && gn && this.modules.adaptivity.isQoSOk(oe) && (I = V);
6262
6282
  }
6263
6283
  break;
6264
6284
  case "downgrade":
6265
- C = Math.max(x - 1, 0);
6285
+ I = Math.max(P - 1, 0);
6266
6286
  break;
6267
6287
  case "double downgrade":
6268
- C = Math.max(x - 2, 0);
6288
+ I = Math.max(P - 2, 0);
6269
6289
  break;
6270
6290
  case "reconnect":
6271
- if (x === 0 || this.modules.qualityOfService.timeSpentBufferingLast(6e3) > 5e3) {
6291
+ if (P === 0 || this.modules.qualityOfService.timeSpentBufferingLast(6e3) > 5e3) {
6272
6292
  if (!this.modules.connection.lastConnectionTime || Date.now() - this.modules.connection.lastConnectionTime < this.modules.qualityOfService.fatalQosGraceTime() || this.modules.connection.getState() !== "connected")
6273
6293
  return;
6274
6294
  this.modules.qualityOfService.incrementFatalQosCount(), this.logger.info("Reconnecting due to poor qos"), this.modules.connection.reconnect("Fatal QOS"), this.emitter.emit("adapted level");
6275
6295
  return;
6276
6296
  } else
6277
- C = 0;
6297
+ I = 0;
6278
6298
  }
6279
- if (C === x)
6299
+ if (I === P)
6280
6300
  return;
6281
- const D = v[C];
6301
+ const D = v[I];
6282
6302
  this.alignSizeAndBitRate(R(A({}, this.targetSubscription), {
6283
6303
  video: A(A({}, this.targetSubscription.video), D == null ? void 0 : D.video),
6284
6304
  audio: A(A({}, this.targetSubscription.audio), D == null ? void 0 : D.audio)
6285
6305
  })), this.emitter.emit("adapted level");
6286
6306
  }), this.emitter.on("text track data", (f) => {
6287
- const v = d(this, Y).find((C) => C.language === f.language), x = this.modules.sync.getTimeshiftOffset() / 1e3, B = x - d(this, Qe);
6288
- if (S(this, Qe, x), v) {
6307
+ const v = d(this, Y).find((I) => I.language === f.language), P = this.modules.sync.getTimeshiftOffset() / 1e3, C = P - d(this, Qe);
6308
+ if (S(this, Qe, P), v) {
6289
6309
  if (v.cues)
6290
- for (const C of v.cues)
6291
- C.startTime -= B, C.endTime -= B;
6292
- for (const C of f.cues) {
6293
- const D = new VTTCue(C.startTime - x, C.endTime - x, C.text);
6310
+ for (const I of v.cues)
6311
+ I.startTime -= C, I.endTime -= C;
6312
+ for (const I of f.cues) {
6313
+ const D = new VTTCue(I.startTime - P, I.endTime - P, I.text);
6294
6314
  v.addCue(D);
6295
6315
  }
6296
6316
  }
6297
6317
  }), this.emitter.on("received signal", (f) => {
6298
- var x;
6299
- const v = f, U = this.modules.subscription.getCurrentSubscription();
6318
+ var P;
6319
+ const v = f, M = this.modules.subscription.getCurrentSubscription();
6300
6320
  switch (this.logger.debug("received", A({}, v)), v.type) {
6301
6321
  case "client ip":
6302
6322
  this.clientIp = v.ip;
6303
6323
  break;
6304
6324
  case "renditions":
6305
- this.updateTextTracks(v.renditions), S(this, Xe, this.filterRenditions(v.renditions).then((B) => {
6325
+ this.updateTextTracks(v.renditions), S(this, We, this.filterRenditions(v.renditions).then((C) => {
6306
6326
  this.emitter.emit("renditions", {
6307
- renditions: B,
6327
+ renditions: C,
6308
6328
  channelId: this.currentSubscription.channelId
6309
6329
  }), this.emit("rendition levels", this.modules.renditions.getRenditionLevels()), this.emitLanguagesIfChanged();
6310
6330
  }).finally(() => {
6311
- S(this, Xe, void 0);
6331
+ S(this, We, void 0);
6312
6332
  }));
6313
6333
  break;
6314
6334
  case "subscription changed":
6315
6335
  try {
6316
- ja(v.subscription);
6317
- } catch (B) {
6336
+ Ga(v.subscription);
6337
+ } catch (C) {
6318
6338
  this.emitter.emit(
6319
6339
  "error",
6320
6340
  new T("Subscription failed validation", {
6321
- source: B instanceof Error ? B : void 0,
6341
+ source: C instanceof Error ? C : void 0,
6322
6342
  isFatal: !1,
6323
6343
  code: "subscription_failed_validation"
6324
6344
  })
@@ -6328,44 +6348,52 @@ const $ = class $ extends Pe {
6328
6348
  reset: v.reset,
6329
6349
  to: v.subscription,
6330
6350
  from: this.modules.subscription.getCurrentSubscription()
6331
- }), v.reset && U.channelId !== v.subscription.channelId && (this.emit("error", ps(v.subscription.channelId)), this.emit("channel switch failed", { channelId: U.channelId })), this.modules.sync.timeshiftOnAudio = !((x = v.subscription.video) != null && x.codec), this.modules.adaptivity.reset();
6351
+ }), v.reset && M.channelId !== v.subscription.channelId && (this.emit("error", As(v.subscription.channelId)), this.emit("channel switch failed", { channelId: M.channelId })), this.modules.sync.timeshiftOnAudio = !((P = v.subscription.video) != null && P.codec), this.modules.adaptivity.reset();
6332
6352
  break;
6333
6353
  case "timing info":
6334
6354
  this.modules.sync.updateChannelSyncInfo(v.timingInfo.channelId, v.timingInfo), this.emit("server wallclock time", v.timingInfo.wallclockTime);
6335
6355
  break;
6336
6356
  }
6337
6357
  }), this.emitter.on("channel switch timeout", (f) => {
6338
- this.emit("error", ps(f)), this.emit("channel switch failed", { channelId: this.currentSubscription.channelId });
6358
+ this.emit("error", As(f)), this.emit("channel switch failed", { channelId: this.currentSubscription.channelId });
6339
6359
  }), this.emitter.on("received data", (f) => {
6340
- const v = this.modules.subscription.getCurrentSubscription(), U = ta(f);
6360
+ const v = this.modules.subscription.getCurrentSubscription(), M = ea(f);
6341
6361
  if (!v) {
6342
- this.logger.warn("Received unwanted message", A({}, U));
6362
+ this.logger.warn("Received unwanted message", A({}, M));
6343
6363
  return;
6344
6364
  }
6345
- Lt(R(A({}, U), { channelId: v.channelId }));
6365
+ Lt(R(A({}, M), { channelId: v.channelId }));
6346
6366
  }), this.emitter.on("received moq data", (f) => {
6347
- var C, D, ie;
6348
- const v = f.payload.mediaType(), U = f.channelId, x = f.renditionId, B = this.modules.sync.processFragment(U, f.payload);
6349
- if (this.modules.incomingData.add(v, f.payload.rawBytes().byteLength), B.fragment().emsgs.forEach((F) => {
6350
- if (!F.presentationTime)
6367
+ var I, D, ie;
6368
+ const v = f.payload.mediaType(), M = f.channelId, P = f.renditionId, C = this.modules.sync.processFragment(M, f.payload);
6369
+ if (f.switchInfo.channelId && this.modules.event.addEvent({
6370
+ type: "channel switch",
6371
+ channelId: f.switchInfo.channelId,
6372
+ timestamp: C.baseMediaDecodeTime() / C.timescale() * 1e3
6373
+ }), f.switchInfo.language && this.modules.event.addEvent({
6374
+ type: "language switch",
6375
+ language: f.switchInfo.language,
6376
+ timestamp: C.baseMediaDecodeTime() / C.timescale() * 1e3
6377
+ }), this.modules.incomingData.add(v, f.payload.rawBytes().byteLength), C.fragment().emsgs.forEach((O) => {
6378
+ if (!O.presentationTime)
6351
6379
  return;
6352
- const Q = zr(F.data);
6380
+ const Q = Vr(O.data);
6353
6381
  Q && this.modules.event.addEvent({
6354
- id: F.id,
6355
- timestamp: F.presentationTime / F.timescale * 1e3 - this.modules.sync.getTimeshiftOffset(),
6382
+ id: O.id,
6383
+ timestamp: O.presentationTime / O.timescale * 1e3 - this.modules.sync.getTimeshiftOffset(),
6356
6384
  content: Q.txx.value,
6357
6385
  type: "metadata"
6358
6386
  });
6359
6387
  }), this.modules.decoder) {
6360
- const F = (C = B.header().init().moov.traks[0]) == null ? void 0 : C.mdia.minf.stbl.stsd, Q = (D = F == null ? void 0 : F.avc1) == null ? void 0 : D.avcC.bytes, re = (ie = F == null ? void 0 : F.codec) != null ? ie : "h264";
6388
+ const O = (I = C.header().init().moov.traks[0]) == null ? void 0 : I.mdia.minf.stbl.stsd, Q = (D = O == null ? void 0 : O.avc1) == null ? void 0 : D.avcC.bytes, re = (ie = O == null ? void 0 : O.codec) != null ? ie : "h264";
6361
6389
  if (Q) {
6362
6390
  const se = Q.buffer.slice(Q.byteOffset, Q.byteOffset + Q.byteLength);
6363
6391
  if (v === "text")
6364
6392
  throw new Error("Subtitles are not supported");
6365
6393
  this.emitter.emit("init segment", {
6366
6394
  initSegment: {
6367
- channelId: U,
6368
- renditionId: x,
6395
+ channelId: M,
6396
+ renditionId: P,
6369
6397
  data: se,
6370
6398
  timescale: 1e3,
6371
6399
  type: v,
@@ -6375,35 +6403,35 @@ const $ = class $ extends Pe {
6375
6403
  // mediaType !== mimeType - but the sw decoder doesn't care
6376
6404
  });
6377
6405
  }
6378
- for (let se = 0; se < B.samplesCount(); se++) {
6379
- const V = B.sample(se);
6406
+ for (let se = 0; se < C.samplesCount(); se++) {
6407
+ const V = C.sample(se);
6380
6408
  V && this.emitter.emit("coded sample", R(A({}, V), {
6381
- renditionId: x,
6382
- channelId: U,
6409
+ renditionId: P,
6410
+ channelId: M,
6383
6411
  data: V.data.buffer.slice(V.data.byteOffset, V.data.byteOffset + V.data.byteLength)
6384
6412
  }));
6385
6413
  }
6386
6414
  } else
6387
- this.emitter.emit("fragment", { mimeType: f.mimeType, codec: f.codec, fragment: B, channelId: U });
6415
+ this.emitter.emit("fragment", { mimeType: f.mimeType, codec: f.codec, fragment: C, channelId: M, renditionId: P });
6388
6416
  });
6389
6417
  const lt = this.options.get("container");
6390
6418
  lt && this.attach(lt), this.logger.info("Created Vindral instance", { options: this.options });
6391
- const Lt = (f) => y(this, null, function* () {
6419
+ const Lt = (f) => E(this, null, function* () {
6392
6420
  const v = f.channelId;
6393
- d(this, Xe) && (yield d(this, Xe));
6394
- const U = this.modules.renditions.getRendition(f.renditionId, v);
6395
- if (!Ko(f.flags)) {
6396
- if ($o(f.flags)) {
6397
- const B = new TextDecoder().decode(f.payload), C = this.modules.sync.getTimeshiftOffset();
6421
+ d(this, We) && (yield d(this, We));
6422
+ const M = this.modules.renditions.getRendition(f.renditionId, v);
6423
+ if (!Yo(f.flags)) {
6424
+ if (Ko(f.flags)) {
6425
+ const C = new TextDecoder().decode(f.payload), I = this.modules.sync.getTimeshiftOffset();
6398
6426
  if (f.renditionId !== 0) {
6399
- const D = Rn(B);
6427
+ const D = In(C);
6400
6428
  if (D && D.language !== void 0) {
6401
- const F = new ra().parse(D.content || ""), Q = C / 1e3, re = d(this, Y).find((V) => V.language === D.language), se = Q - d(this, Qe);
6429
+ const O = new na().parse(D.content || ""), Q = I / 1e3, re = d(this, Y).find((V) => V.language === D.language), se = Q - d(this, Qe);
6402
6430
  if (S(this, Qe, Q), re) {
6403
6431
  if (re.cues)
6404
6432
  for (const V of re.cues)
6405
6433
  V.startTime -= se, V.endTime -= se;
6406
- for (const V of F) {
6434
+ for (const V of O) {
6407
6435
  const oe = new VTTCue(V.startTime - Q, V.endTime - Q, V.text);
6408
6436
  re.addCue(oe);
6409
6437
  }
@@ -6412,39 +6440,39 @@ const $ = class $ extends Pe {
6412
6440
  } else
6413
6441
  this.modules.event.addEvent({
6414
6442
  timestamp: f.timestamp / f.timescale * 1e3 - this.modules.sync.getTimeshiftOffset(),
6415
- content: B,
6443
+ content: C,
6416
6444
  type: "metadata"
6417
6445
  });
6418
- } else if (U != null && U.codec) {
6419
- const x = kn(U.codec);
6420
- if (x === "text")
6446
+ } else if (M != null && M.codec) {
6447
+ const P = Bn(M.codec);
6448
+ if (P === "text")
6421
6449
  throw new Error("Subtitles are not supported");
6422
- if (this.modules.incomingData.add(x, f.payload.byteLength), Yo(f.flags)) {
6423
- const B = R(A({
6424
- type: x,
6450
+ if (this.modules.incomingData.add(P, f.payload.byteLength), Jo(f.flags)) {
6451
+ const C = R(A({
6452
+ type: P,
6425
6453
  data: f.payload,
6426
- codec: U.codec
6454
+ codec: M.codec
6427
6455
  }, f), {
6428
6456
  channelId: v
6429
- }), C = Go(B.codec, B.payload);
6430
- C && this.sizes.set(B.renditionId, C);
6431
- const D = $e({ codec: U.codec, codecString: U.codecString });
6432
- this.emitter.emit("init segment", { initSegment: B, mimeType: D }), this.emit("initialized media");
6457
+ }), I = Wo(C.codec, C.payload);
6458
+ I && this.sizes.set(C.renditionId, I);
6459
+ const D = $e({ codec: M.codec, codecString: M.codecString });
6460
+ this.emitter.emit("init segment", { initSegment: C, mimeType: D }), this.emit("initialized media");
6433
6461
  } else {
6434
- const B = Ga(f, U, this.sizes.get(f.renditionId));
6435
- let C = this.sampleProcessingSesssions.get(x);
6436
- if (!C)
6437
- C = Xa(
6438
- this.modules.sync.processSample(B)
6439
- ), this.sampleProcessingSesssions.set(x, C);
6462
+ const C = Wa(f, M, this.sizes.get(f.renditionId));
6463
+ let I = this.sampleProcessingSesssions.get(P);
6464
+ if (!I)
6465
+ I = Qa(
6466
+ this.modules.sync.processSample(C)
6467
+ ), this.sampleProcessingSesssions.set(P, I);
6440
6468
  else {
6441
- const D = C(
6442
- this.modules.sync.processSample(B),
6443
- this.isSwitchingRenditionLevel && B.type === "video"
6469
+ const D = I(
6470
+ this.modules.sync.processSample(C),
6471
+ this.isSwitchingRenditionLevel && C.type === "video"
6444
6472
  );
6445
- let ie = B;
6446
- D.forEach((F) => {
6447
- this.modules.event.extractEvent(F, ie), this.emitter.emit("coded sample", F), ie = F;
6473
+ let ie = C;
6474
+ D.forEach((O) => {
6475
+ this.modules.event.extractEvent(O, ie), this.emitter.emit("coded sample", O), ie = O;
6448
6476
  });
6449
6477
  }
6450
6478
  }
@@ -6857,36 +6885,36 @@ const $ = class $ extends Pe {
6857
6885
  return this.browser.supportsMediaSource && this.options.get("mseEnabled");
6858
6886
  }
6859
6887
  };
6860
- Qe = new WeakMap(), Y = new WeakMap(), Xe = new WeakMap(), n($, "MAX_POOL_SIZE", 10), n($, "INITIAL_MAX_BIT_RATE", 2.5 * 1e3 * 1e3), n($, "DISCONNECT_TIMEOUT", 15 * 1e3), n($, "REMOVE_CUE_THRESHOLD", 1e3 * 10);
6861
- let Ns = $;
6888
+ Qe = new WeakMap(), Y = new WeakMap(), We = new WeakMap(), n($, "MAX_POOL_SIZE", 10), n($, "INITIAL_MAX_BIT_RATE", 2.5 * 1e3 * 1e3), n($, "DISCONNECT_TIMEOUT", 15 * 1e3), n($, "REMOVE_CUE_THRESHOLD", 1e3 * 10);
6889
+ let Os = $;
6862
6890
  export {
6863
- cr as A,
6864
- cs as B,
6865
- jn as C,
6891
+ or as A,
6892
+ as as B,
6893
+ Xn as C,
6866
6894
  St as D,
6867
6895
  J as F,
6868
- $n as I,
6896
+ Yn as I,
6869
6897
  Nt as L,
6870
- Kn as N,
6871
- Ns as V,
6872
- ra as W,
6898
+ Jn as N,
6899
+ Os as V,
6900
+ na as W,
6873
6901
  Ut as a,
6874
- Hs as b,
6902
+ Vs as b,
6875
6903
  nt as c,
6876
- ur as d,
6904
+ dr as d,
6877
6905
  st as e,
6878
- Ka as f,
6906
+ Ya as f,
6879
6907
  $e as g,
6880
- Ya as h,
6881
- $a as i,
6882
- Jn as j,
6883
- Zn as k,
6884
- Yn as l,
6908
+ Ja as h,
6909
+ Ka as i,
6910
+ qn as j,
6911
+ jn as k,
6912
+ Zn as l,
6885
6913
  Ye as m,
6886
6914
  le as n,
6887
- qn as o,
6888
- sr as p,
6915
+ Gn as o,
6916
+ tr as p,
6889
6917
  T as q,
6890
- Qn as t,
6891
- Mi as w
6918
+ zn as t,
6919
+ Ui as w
6892
6920
  };