@vindral/web-sdk 4.1.8 → 4.1.9

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.
@@ -231,21 +231,21 @@ function su(s) {
231
231
  const e = new _c(s);
232
232
  return [e, e];
233
233
  }
234
- var Mt, Xs, Ye, Lr;
234
+ var xt, Xs, Ye, Lr;
235
235
  class _c {
236
236
  constructor(e) {
237
237
  /// The internal queue
238
- d(this, Mt);
238
+ d(this, xt);
239
239
  /// Slows down push when the queue is full
240
240
  d(this, Xs, new z());
241
241
  /// Slows down pop when the queue is empty
242
242
  d(this, Ye);
243
243
  /// The channel is closed
244
244
  d(this, Lr, !1);
245
- m(this, Mt, new ee(e));
245
+ m(this, xt, new ee(e));
246
246
  }
247
247
  isFull() {
248
- return a(this, Mt).isFull();
248
+ return a(this, xt).isFull();
249
249
  }
250
250
  close() {
251
251
  var e;
@@ -258,14 +258,14 @@ class _c {
258
258
  push(e) {
259
259
  return f(this, null, function* () {
260
260
  var t;
261
- a(this, Mt).isFull() && (yield a(this, Xs).promise), a(this, Mt).push(e), (t = a(this, Ye)) == null || t.resolve(), m(this, Ye, new z());
261
+ a(this, xt).isFull() && (yield a(this, Xs).promise), a(this, xt).push(e), (t = a(this, Ye)) == null || t.resolve(), m(this, Ye, new z());
262
262
  });
263
263
  }
264
264
  pop() {
265
265
  return f(this, null, function* () {
266
266
  var e;
267
- for (; !(a(this, Lr) && a(this, Mt).isEmpty()); ) {
268
- const t = a(this, Mt).pop();
267
+ for (; !(a(this, Lr) && a(this, xt).isEmpty()); ) {
268
+ const t = a(this, xt).pop();
269
269
  if (t)
270
270
  return a(this, Xs).resolve(), m(this, Xs, new z()), t;
271
271
  a(this, Ye) || m(this, Ye, new z()), yield (e = a(this, Ye)) == null ? void 0 : e.promise;
@@ -297,8 +297,8 @@ class _c {
297
297
  return this;
298
298
  }
299
299
  }
300
- Mt = new WeakMap(), Xs = new WeakMap(), Ye = new WeakMap(), Lr = new WeakMap();
301
- function M(s) {
300
+ xt = new WeakMap(), Xs = new WeakMap(), Ye = new WeakMap(), Lr = new WeakMap();
301
+ function x(s) {
302
302
  return typeof BigInt == "function" ? BigInt(s) : s;
303
303
  }
304
304
  var Dr, ft, Ke;
@@ -356,25 +356,25 @@ const nu = (s, e, t) => {
356
356
  i = i * 256 + s[n];
357
357
  return i;
358
358
  };
359
- var ne, xt, ti;
359
+ var ne, Mt, ti;
360
360
  class Zn {
361
361
  constructor(e) {
362
362
  d(this, ne);
363
- d(this, xt);
363
+ d(this, Mt);
364
364
  d(this, ti);
365
- m(this, xt, e), m(this, ti, new DataView(e.buffer, e.byteOffset, e.byteLength)), m(this, ne, 0);
365
+ m(this, Mt, e), m(this, ti, new DataView(e.buffer, e.byteOffset, e.byteLength)), m(this, ne, 0);
366
366
  }
367
367
  position() {
368
368
  return a(this, ne);
369
369
  }
370
370
  byteOffset() {
371
- return a(this, xt).byteOffset + a(this, ne);
371
+ return a(this, Mt).byteOffset + a(this, ne);
372
372
  }
373
373
  buffer() {
374
- return a(this, xt);
374
+ return a(this, Mt);
375
375
  }
376
376
  remaining() {
377
- return a(this, xt).length - a(this, ne);
377
+ return a(this, Mt).length - a(this, ne);
378
378
  }
379
379
  readUint8() {
380
380
  const e = a(this, ti).getUint8(a(this, ne));
@@ -393,11 +393,11 @@ class Zn {
393
393
  return m(this, ne, a(this, ne) + 4), e;
394
394
  }
395
395
  readUint64() {
396
- const e = nu(a(this, xt), a(this, ne), a(this, ne) + 7);
396
+ const e = nu(a(this, Mt), a(this, ne), a(this, ne) + 7);
397
397
  return m(this, ne, a(this, ne) + 8), e;
398
398
  }
399
399
  readBytes(e) {
400
- const t = a(this, xt).subarray(a(this, ne), a(this, ne) + e);
400
+ const t = a(this, Mt).subarray(a(this, ne), a(this, ne) + e);
401
401
  return m(this, ne, a(this, ne) + e), t;
402
402
  }
403
403
  readRemaining() {
@@ -411,7 +411,7 @@ class Zn {
411
411
  return new TextDecoder().decode(new Uint8Array(e));
412
412
  }
413
413
  }
414
- ne = new WeakMap(), xt = new WeakMap(), ti = new WeakMap();
414
+ ne = new WeakMap(), Mt = new WeakMap(), ti = new WeakMap();
415
415
  class bm {
416
416
  constructor(e = 100, t = 100) {
417
417
  r(this, "resizeSteps");
@@ -508,7 +508,7 @@ const ym = /(android|bbd+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal
508
508
  }, Em = () => Te.indexOf("CrKey") !== -1, km = () => navigator.platform === "MacIntel" && navigator.maxTouchPoints === 0, Nc = () => navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, Id = () => Cd() || Nc() ? !0 : /AppleWebKit/i.test(navigator.userAgent) && !/Chrome|Chromium|Edg|OPR|Opera/i.test(navigator.userAgent), Cd = () => Te.indexOf("iphone") >= 0 && Te.indexOf("like iphone") < 0 || Te.indexOf("ipad") >= 0 && Te.indexOf("like ipad") < 0 || Te.indexOf("ipod") >= 0 && Te.indexOf("like ipod") < 0 || Nc(), Im = () => {
509
509
  var s, e;
510
510
  return Nc() ? !1 : (e = (s = Jn()) == null ? void 0 : s.isTypeSupported('audio/mp4; codecs="opus"')) != null ? e : !1;
511
- }, bw = () => "ontouchstart" in window || navigator.maxTouchPoints > 0, Cm = () => /^(?!.*chrome).*safari/i.test(Te);
511
+ }, yw = () => "ontouchstart" in window || navigator.maxTouchPoints > 0, Cm = () => /^(?!.*chrome).*safari/i.test(Te);
512
512
  function Rm() {
513
513
  var s, e;
514
514
  if (/(iPhone|iPod|iPad)/i.test(Te))
@@ -601,7 +601,7 @@ const Cs = (s, e) => {
601
601
  for (const n in e)
602
602
  if (i += 1, !(n in s) || !Cs(s[n], e[n])) return !1;
603
603
  return t == i;
604
- }, ku = ["off", "error", "warn", "info", "debug", "trace"], Mm = {
604
+ }, ku = ["off", "error", "warn", "info", "debug", "trace"], xm = {
605
605
  OFF: "off"
606
606
  };
607
607
  var Oi, Or, Fi, qs, Zs;
@@ -692,7 +692,7 @@ function Bd() {
692
692
  return typeof Symbol.dispose != "symbol" && Object.defineProperty(Symbol, "dispose", { value: /* @__PURE__ */ Symbol.for("dispose") }), Symbol.dispose;
693
693
  }
694
694
  var Fr, hh;
695
- class xm {
695
+ class Mm {
696
696
  constructor(e, t) {
697
697
  d(this, Fr);
698
698
  r(this, "value");
@@ -733,7 +733,7 @@ class Lm {
733
733
  m(this, _i, i);
734
734
  }).catch(D);
735
735
  const t = a(this, Ni).promise.then(() => e);
736
- return m(this, Ni, e), yield t, new xm(a(this, _i), e);
736
+ return m(this, Ni, e), yield t, new Mm(a(this, _i), e);
737
737
  });
738
738
  }
739
739
  }
@@ -883,7 +883,7 @@ const Ru = () => {
883
883
  width: Number.MAX_SAFE_INTEGER,
884
884
  height: Number.MAX_SAFE_INTEGER
885
885
  }), Bu = (s) => !(typeof s != "object" || s === null || !("type" in s)), Om = "connection_failed", Fm = "connection_failed_will_not_attempt_again", _m = "authentication_error", Nm = "authentication_expired", Vm = "channel_not_found", Gm = "no_incoming_data_error", jm = "connection_inactivity", Wm = "missing_init_segment", zm = "no_track_context", Hm = "invalid_track_context_state", Qm = "disconnected_by_edge", Xm = "decoder_error", qm = "audio_player_error", Zm = "media_source_error", Jm = "webgl_context_lost_error", $m = "access_forbidden", Ym = "channel_switch_failed", Km = "drm_error";
886
- class x extends Error {
886
+ class M extends Error {
887
887
  constructor(t, i, n = {}) {
888
888
  super(t);
889
889
  r(this, "props");
@@ -925,42 +925,42 @@ class x extends Error {
925
925
  this.props = i, this.extra = n, Object.setPrototypeOf(this, new.target.prototype);
926
926
  }
927
927
  }
928
- const ef = (s, e) => new x(
928
+ const ef = (s, e) => new M(
929
929
  "MediaElement Error",
930
930
  { isFatal: s, code: "media_element_error", source: e },
931
931
  { mediaErrorCode: e.code }
932
- ), tf = (s, e) => new x("Decoder Error", { isFatal: s, code: Xm, source: e, type: "internal" }), Pd = (s, e) => new x("Audio Player Error", { isFatal: s, code: qm, source: e, type: "internal" }), sf = (s, e) => new x(`No init segment for rendition id ${s} for channel ${e}`, {
932
+ ), tf = (s, e) => new M("Decoder Error", { isFatal: s, code: Xm, source: e, type: "internal" }), Pd = (s, e) => new M("Audio Player Error", { isFatal: s, code: qm, source: e, type: "internal" }), sf = (s, e) => new M(`No init segment for rendition id ${s} for channel ${e}`, {
933
933
  isFatal: !1,
934
934
  code: Wm,
935
935
  type: "internal"
936
- }), Uu = (s, e, t, i) => new x(
936
+ }), Uu = (s, e, t, i) => new M(
937
937
  "MediaSource Error",
938
938
  { isFatal: s, code: Zm, source: e, type: "internal" },
939
939
  { type: i, consecutiveErrorsCount: t }
940
- ), Ka = (s, e) => new x(`No track context for ${s}${e ? `, rendition id ${e}` : ""}`, {
940
+ ), Ka = (s, e) => new M(`No track context for ${s}${e ? `, rendition id ${e}` : ""}`, {
941
941
  isFatal: !1,
942
942
  code: zm,
943
943
  type: "internal"
944
- }), nf = (s, e) => new x(
944
+ }), nf = (s, e) => new M(
945
945
  `Track context is in an invalid state for ${s}${e ? `, rendition id ${e}` : ""}`,
946
946
  {
947
947
  isFatal: !1,
948
948
  code: Hm,
949
949
  type: "internal"
950
950
  }
951
- ), rf = () => new x("Web Audio Context resume timeout", { isFatal: !1, code: "web_audio_context_resume_timeout" }), tr = (s) => new x("Disconnected From Edge Server", {
951
+ ), rf = () => new M("Web Audio Context resume timeout", { isFatal: !1, code: "web_audio_context_resume_timeout" }), tr = (s) => new M("Disconnected From Edge Server", {
952
952
  type: "external",
953
953
  source: s,
954
954
  isFatal: !1,
955
955
  code: Qm
956
- }), po = (s) => new x("Authentication Failed", { isFatal: !0, code: _m, source: s }), af = (s) => new x("Authentication Expired", { isFatal: !0, code: Nm, source: s }), of = (s, e) => new x("Connection closed due to inactivity", { isFatal: !1, code: jm, source: e, type: s }), Md = (s, e) => new x("Channel not found", { isFatal: !1, code: Vm, source: e, type: s }), cf = (s) => new x("No Incoming Data", { isFatal: !1, code: Gm, source: s }), hf = (s) => new x("Connection attempt failed", {
956
+ }), po = (s) => new M("Authentication Failed", { isFatal: !0, code: _m, source: s }), af = (s) => new M("Authentication Expired", { isFatal: !0, code: Nm, source: s }), of = (s, e) => new M("Connection closed due to inactivity", { isFatal: !1, code: jm, source: e, type: s }), xd = (s, e) => new M("Channel not found", { isFatal: !1, code: Vm, source: e, type: s }), cf = (s) => new M("No Incoming Data", { isFatal: !1, code: Gm, source: s }), hf = (s) => new M("Connection attempt failed", {
957
957
  isFatal: !1,
958
958
  code: Om,
959
959
  source: s
960
- }), xd = () => new x("Connection failed - no more reconnect attempts", {
960
+ }), Md = () => new M("Connection failed - no more reconnect attempts", {
961
961
  isFatal: !0,
962
962
  code: Fm
963
- }), uf = (s) => new x("WebGL Context Lost", { isFatal: !1, code: Jm, source: s, type: "internal" }), Pu = (s) => new x(s, { isFatal: !0, code: $m }), Mu = (s) => new x(`Channel switch to '${s}' failed`, { isFatal: !1, code: Ym }), Ld = (s, e = !1, t) => new x(s, { isFatal: e, code: Km, source: t }), df = {
963
+ }), uf = (s) => new M("WebGL Context Lost", { isFatal: !1, code: Jm, source: s, type: "internal" }), Pu = (s) => new M(s, { isFatal: !0, code: $m }), xu = (s) => new M(`Channel switch to '${s}' failed`, { isFatal: !1, code: Ym }), Ld = (s, e = !1, t) => new M(s, { isFatal: e, code: Km, source: t }), df = {
964
964
  sizeBasedResolutionCapEnabled: !0,
965
965
  pictureInPictureEnabled: !0,
966
966
  abrEnabled: !0,
@@ -971,7 +971,7 @@ const ef = (s, e) => new x(
971
971
  volume: 1,
972
972
  minBufferTime: 1500,
973
973
  maxBufferTime: 1500,
974
- logLevel: Mm.OFF,
974
+ logLevel: xm.OFF,
975
975
  maxSize: fo(),
976
976
  maxVideoBitRate: Ti(),
977
977
  maxAudioBitRate: Ti(),
@@ -1088,7 +1088,7 @@ class ff extends Vc {
1088
1088
  }
1089
1089
  }
1090
1090
  _r = new WeakMap();
1091
- const xu = {
1091
+ const Mu = {
1092
1092
  playready: ["150", "2000", "3000"],
1093
1093
  widevine: ["SW_SECURE_CRYPTO", "SW_SECURE_DECODE", "HW_SECURE_CRYPTO", "HW_SECURE_DECODE", "HW_SECURE_ALL"],
1094
1094
  fairplay: [""],
@@ -1148,7 +1148,7 @@ const xu = {
1148
1148
  }
1149
1149
  return c;
1150
1150
  }), gf = (s, e, t, i) => f(null, null, function* () {
1151
- const { keySystem: n, supportedConfig: o } = pf[s], { initDataTypes: c, videoCapabilities: h, audioCapabilities: u } = o, l = i == null ? void 0 : i[s], p = (l == null ? void 0 : l.videoRobustness) || xu[s], g = (l == null ? void 0 : l.audioRobustness) || xu[s], [w, b] = yield Promise.all([
1151
+ const { keySystem: n, supportedConfig: o } = pf[s], { initDataTypes: c, videoCapabilities: h, audioCapabilities: u } = o, l = i == null ? void 0 : i[s], p = (l == null ? void 0 : l.videoRobustness) || Mu[s], g = (l == null ? void 0 : l.audioRobustness) || Mu[s], [w, b] = yield Promise.all([
1152
1152
  Lu(
1153
1153
  n,
1154
1154
  c,
@@ -1540,8 +1540,8 @@ const Tf = 7, Ef = 8, kf = (s) => {
1540
1540
  { numerator: 3, denumerator: 2 },
1541
1541
  { numerator: 2, denumerator: 1 }
1542
1542
  ], Pf = 184549376;
1543
- function Mf(s) {
1544
- const e = new Zn(s), t = xf(e);
1543
+ function xf(s) {
1544
+ const e = new Zn(s), t = Mf(e);
1545
1545
  (t.flags & Pf) !== 0 && Lf(e);
1546
1546
  const i = Df(e);
1547
1547
  if (String.fromCharCode(...i.frameId) === "TXXX") {
@@ -1552,7 +1552,7 @@ function Mf(s) {
1552
1552
  };
1553
1553
  }
1554
1554
  }
1555
- function xf(s) {
1555
+ function Mf(s) {
1556
1556
  const e = s.readBytes(3), t = s.readUint8(), i = s.readUint8(), n = s.readUint8(), o = s.readUint32();
1557
1557
  return {
1558
1558
  id: e,
@@ -2132,7 +2132,7 @@ const Ns = class Ns {
2132
2132
  }
2133
2133
  };
2134
2134
  r(Ns, "type", "prft");
2135
- let Mo = Ns;
2135
+ let xo = Ns;
2136
2136
  var Gr, jr;
2137
2137
  class Wf {
2138
2138
  constructor(e, t) {
@@ -2165,7 +2165,7 @@ const zf = {
2165
2165
  stbl: Io,
2166
2166
  mdhd: Eo,
2167
2167
  stsd: ko,
2168
- prft: Mo,
2168
+ prft: xo,
2169
2169
  avc1: dh,
2170
2170
  avcC: uh,
2171
2171
  Opus: mh,
@@ -2211,7 +2211,7 @@ function Qf(s) {
2211
2211
  throw new Error("moof atom not found");
2212
2212
  if (!o || !(o instanceof Ao))
2213
2213
  throw new Error("mdat atom not found");
2214
- if (c && !(c instanceof Mo))
2214
+ if (c && !(c instanceof xo))
2215
2215
  throw new Error("invalid prft found");
2216
2216
  return {
2217
2217
  moof: n,
@@ -2420,8 +2420,8 @@ const j = {
2420
2420
  prft: R("prft"),
2421
2421
  dOps: R("dOps"),
2422
2422
  emsg: R("emsg")
2423
- }, qf = 1e3, Mr = R("iso6"), _u = new Uint8Array([0, 0, 2, 0]), Zf = [
2424
- Mr,
2423
+ }, qf = 1e3, xr = R("iso6"), _u = new Uint8Array([0, 0, 2, 0]), Zf = [
2424
+ xr,
2425
2425
  new Uint8Array([105, 115, 111, 109]),
2426
2426
  // isom
2427
2427
  new Uint8Array([105, 115, 111, 50]),
@@ -2431,7 +2431,7 @@ const j = {
2431
2431
  new Uint8Array([109, 112, 52, 49])
2432
2432
  // mp41
2433
2433
  ], Jf = [
2434
- Mr,
2434
+ xr,
2435
2435
  new Uint8Array([105, 115, 111, 109]),
2436
2436
  // isom
2437
2437
  new Uint8Array([105, 115, 111, 50]),
@@ -2441,7 +2441,7 @@ const j = {
2441
2441
  new Uint8Array([109, 112, 52, 49])
2442
2442
  // mp41
2443
2443
  ], $f = [
2444
- Mr,
2444
+ xr,
2445
2445
  new Uint8Array([105, 115, 111, 109]),
2446
2446
  // isom
2447
2447
  new Uint8Array([105, 115, 111, 50]),
@@ -2463,8 +2463,8 @@ const re = (s, e, t) => {
2463
2463
  re(
2464
2464
  s,
2465
2465
  j.ftyp,
2466
- Mr.byteLength + _u.byteLength + e.reduce((t, i) => t + i.byteLength, 0)
2467
- ), s.writer.writeBytes(Mr), s.writer.writeBytes(_u), e.forEach((t) => s.writer.writeBytes(t));
2466
+ xr.byteLength + _u.byteLength + e.reduce((t, i) => t + i.byteLength, 0)
2467
+ ), s.writer.writeBytes(xr), s.writer.writeBytes(_u), e.forEach((t) => s.writer.writeBytes(t));
2468
2468
  }, Yf = 2 ** 32, Kf = 2208988800, ep = (s, e, t, i) => {
2469
2469
  oe(s, j.prft, 20, 1, 0);
2470
2470
  const o = t / 1e3, c = Math.floor(o), u = (o - c) * 1e3 * 1e3 * Yf / 1e6;
@@ -2782,7 +2782,7 @@ const re = (s, e, t) => {
2782
2782
  duration: 0,
2783
2783
  sampleRate: 48e3
2784
2784
  }
2785
- ]), Mp = (s, e) => {
2785
+ ]), xp = (s, e) => {
2786
2786
  const t = s.map((c) => O(S({}, c), {
2787
2787
  data: new Uint8Array(c.data)
2788
2788
  }));
@@ -2801,7 +2801,7 @@ const re = (s, e, t) => {
2801
2801
  }, Zd = (s) => {
2802
2802
  const e = new Ed(s);
2803
2803
  return e.peekBit() === 1 && e.readBits(32), Dp(e), Wp(e);
2804
- }, xp = (s) => {
2804
+ }, Mp = (s) => {
2805
2805
  let e = 0, t = 0;
2806
2806
  for (let i = 0; i < 8; i++) {
2807
2807
  const n = s.readBits(8);
@@ -2820,7 +2820,7 @@ const re = (s, e, t) => {
2820
2820
  return;
2821
2821
  const n = t >> 3 & 15, o = t >> 2 & 1, c = t >> 1 & 1;
2822
2822
  o == 1 && s.readBits(8);
2823
- const [h, u] = c ? xp(s) : [0, e];
2823
+ const [h, u] = c ? Mp(s) : [0, e];
2824
2824
  return {
2825
2825
  headerLength: 1 + o + h,
2826
2826
  type: n,
@@ -2846,7 +2846,7 @@ const re = (s, e, t) => {
2846
2846
  throw new Error("Not implemented");
2847
2847
  u = s.readBit() !== 0;
2848
2848
  const Z = s.readBits(5) + 1;
2849
- for (let Me = 0; Me < Z; Me++) {
2849
+ for (let xe = 0; xe < Z; xe++) {
2850
2850
  const J = s.readBits(12), ce = s.readBits(5);
2851
2851
  let Ne = 0;
2852
2852
  if (ce > 7 && (Ne = s.readBit()), c)
@@ -3014,7 +3014,7 @@ const re = (s, e, t) => {
3014
3014
  case "h264":
3015
3015
  return Bp(s, e);
3016
3016
  case "opus":
3017
- return Mp(s, e);
3017
+ return xp(s, e);
3018
3018
  case "aac":
3019
3019
  return Cp(s, e);
3020
3020
  case "av1":
@@ -3236,7 +3236,7 @@ class Ah extends Ei {
3236
3236
  r(this, "play", () => {
3237
3237
  this.element.muted = this._userProvidedMuted, this._play().catch((t) => {
3238
3238
  if (t instanceof Error) {
3239
- const i = new x("Media Play Error", { source: t, isFatal: !1, code: "media_play_error" });
3239
+ const i = new M("Media Play Error", { source: t, isFatal: !1, code: "media_play_error" });
3240
3240
  this.emit("error", i);
3241
3241
  }
3242
3242
  });
@@ -3525,7 +3525,7 @@ const gg = {
3525
3525
  };
3526
3526
  r(Yt, "BUFFER_TIME_STEP_SIZE", 500), r(Yt, "BUFFER_TIME_MAX_STEPS", 3), r(Yt, "create", (e, t, i, n, o = {}) => new Yt(e, t, i, n, o));
3527
3527
  let bh = Yt;
3528
- var xo = /* @__PURE__ */ ((s) => (s[s.StreamHeaderGroup = 4] = "StreamHeaderGroup", s[s.FetchHeader = 5] = "FetchHeader", s[s.StreamHeaderTrack = 60] = "StreamHeaderTrack", s))(xo || {});
3528
+ var Mo = /* @__PURE__ */ ((s) => (s[s.StreamHeaderGroup = 4] = "StreamHeaderGroup", s[s.FetchHeader = 5] = "FetchHeader", s[s.StreamHeaderTrack = 60] = "StreamHeaderTrack", s))(Mo || {});
3529
3529
  const Ee = {
3530
3530
  Normal: 0,
3531
3531
  ObjectDoesNotExist: 1,
@@ -3580,7 +3580,7 @@ class Ag {
3580
3580
  subscribeId: a(this, Ks),
3581
3581
  trackAlias: a(this, Hr),
3582
3582
  groupId: e,
3583
- subGroupId: M(0),
3583
+ subGroupId: x(0),
3584
3584
  objectId: t,
3585
3585
  subscriberPriority: a(this, Qr),
3586
3586
  streamId: a(this, qr),
@@ -3749,11 +3749,11 @@ function tl(s, e) {
3749
3749
  return f(this, null, function* () {
3750
3750
  const t = yield s.readVarInt();
3751
3751
  switch (t) {
3752
- case xo.StreamHeaderGroup: {
3752
+ case Mo.StreamHeaderGroup: {
3753
3753
  const i = yield s.readBigVarInt(), n = yield s.readBigVarInt(), o = yield s.readBigVarInt(), c = yield s.readBigVarInt(), h = yield s.readUnsigned8();
3754
3754
  return new bg(s, i, n, o, c, h, e);
3755
3755
  }
3756
- case xo.StreamHeaderTrack: {
3756
+ case Mo.StreamHeaderTrack: {
3757
3757
  const i = yield s.readBigVarInt(), n = yield s.readBigVarInt(), o = yield s.readUnsigned8();
3758
3758
  return new wg(s, i, n, o, e);
3759
3759
  }
@@ -3807,7 +3807,7 @@ class Sg {
3807
3807
  }
3808
3808
  }
3809
3809
  wt = new WeakMap(), Wi = new WeakMap(), zi = new WeakMap(), Hi = new WeakMap();
3810
- var bt, ia, Qi, yt, Yo, W, rr, no, Mi, ro, Jt;
3810
+ var bt, ia, Qi, yt, Yo, W, rr, no, xi, ro, Jt;
3811
3811
  class Lo {
3812
3812
  constructor(e, t) {
3813
3813
  d(this, W);
@@ -3820,7 +3820,7 @@ class Lo {
3820
3820
  }
3821
3821
  readUnsigned8() {
3822
3822
  return f(this, null, function* () {
3823
- return yield A(this, W, Mi).call(this, 1), A(this, W, Jt).call(this, 1)[0];
3823
+ return yield A(this, W, xi).call(this, 1), A(this, W, Jt).call(this, 1)[0];
3824
3824
  });
3825
3825
  }
3826
3826
  readString() {
@@ -3839,28 +3839,28 @@ class Lo {
3839
3839
  }
3840
3840
  readBigVarInt() {
3841
3841
  return f(this, null, function* () {
3842
- yield A(this, W, Mi).call(this, 1);
3842
+ yield A(this, W, xi).call(this, 1);
3843
3843
  const e = (A(this, W, ro).call(this, 1)[0] & 192) >> 6;
3844
3844
  switch (a(this, bt)[a(this, yt)] = A(this, W, ro).call(this, 1)[0] & 63, e) {
3845
3845
  case 0:
3846
- return M(A(this, W, Jt).call(this, 1)[0]);
3846
+ return x(A(this, W, Jt).call(this, 1)[0]);
3847
3847
  case 1: {
3848
- yield A(this, W, Mi).call(this, 2);
3848
+ yield A(this, W, xi).call(this, 2);
3849
3849
  const t = A(this, W, Jt).call(this, 2), i = new DataView(t.buffer, t.byteOffset, t.byteLength);
3850
- return M(i.getUint16(0));
3850
+ return x(i.getUint16(0));
3851
3851
  }
3852
3852
  case 2: {
3853
- yield A(this, W, Mi).call(this, 4);
3853
+ yield A(this, W, xi).call(this, 4);
3854
3854
  const t = A(this, W, Jt).call(this, 4), i = new DataView(t.buffer, t.byteOffset, t.byteLength);
3855
- return M(i.getUint32(0));
3855
+ return x(i.getUint32(0));
3856
3856
  }
3857
3857
  case 3: {
3858
- yield A(this, W, Mi).call(this, 8);
3858
+ yield A(this, W, xi).call(this, 8);
3859
3859
  const t = A(this, W, Jt).call(this, 8), i = new DataView(t.buffer, t.byteOffset, t.byteLength);
3860
3860
  if (typeof i.getBigUint64 != "undefined")
3861
- return M(i.getBigUint64(0));
3861
+ return x(i.getBigUint64(0));
3862
3862
  const n = nu(t, 0, 7);
3863
- return M(n);
3863
+ return x(n);
3864
3864
  }
3865
3865
  default:
3866
3866
  throw new Error("Invalid VarInt size");
@@ -3869,7 +3869,7 @@ class Lo {
3869
3869
  }
3870
3870
  read(e) {
3871
3871
  return f(this, null, function* () {
3872
- return yield A(this, W, Mi).call(this, e), A(this, W, Jt).call(this, e);
3872
+ return yield A(this, W, xi).call(this, e), A(this, W, Jt).call(this, e);
3873
3873
  });
3874
3874
  }
3875
3875
  readAll() {
@@ -3910,7 +3910,7 @@ bt = new WeakMap(), ia = new WeakMap(), Qi = new WeakMap(), yt = new WeakMap(),
3910
3910
  }
3911
3911
  return m(this, yt, 0), Promise.resolve(e.length);
3912
3912
  });
3913
- }, Mi = function(e) {
3913
+ }, xi = function(e) {
3914
3914
  return f(this, null, function* () {
3915
3915
  for (; A(this, W, rr).call(this) < e; )
3916
3916
  if ((yield A(this, W, no).call(this)) === 0)
@@ -3963,11 +3963,11 @@ on = new WeakMap(), cn = new WeakMap(), Ot = new WeakMap(), Ko = new WeakMap();
3963
3963
  const sl = {
3964
3964
  OPEN: 1
3965
3965
  };
3966
- var Ue, xe, Xi, ec;
3966
+ var Ue, Me, Xi, ec;
3967
3967
  const Br = class Br {
3968
3968
  constructor(e) {
3969
3969
  d(this, Ue, 0);
3970
- d(this, xe, new Uint8Array(Br.DEFAULT_BUFFER_SIZE));
3970
+ d(this, Me, new Uint8Array(Br.DEFAULT_BUFFER_SIZE));
3971
3971
  d(this, Xi);
3972
3972
  d(this, ec, new TextEncoder());
3973
3973
  m(this, Xi, e);
@@ -3979,39 +3979,39 @@ const Br = class Br {
3979
3979
  });
3980
3980
  }
3981
3981
  ensureBufferSpace(e) {
3982
- if (a(this, xe).length - a(this, Ue) >= e)
3982
+ if (a(this, Me).length - a(this, Ue) >= e)
3983
3983
  return;
3984
- const t = new Uint8Array(a(this, xe).length + e);
3985
- t.set(a(this, xe)), m(this, xe, t);
3984
+ const t = new Uint8Array(a(this, Me).length + e);
3985
+ t.set(a(this, Me)), m(this, Me, t);
3986
3986
  }
3987
3987
  write(e) {
3988
- return this.ensureBufferSpace(e.length), a(this, xe).set(e, a(this, Ue)), m(this, Ue, a(this, Ue) + e.byteLength), Promise.resolve();
3988
+ return this.ensureBufferSpace(e.length), a(this, Me).set(e, a(this, Ue)), m(this, Ue, a(this, Ue) + e.byteLength), Promise.resolve();
3989
3989
  }
3990
3990
  writeUnsigned8(e) {
3991
- return this.ensureBufferSpace(1), Wc(e, a(this, xe).subarray(a(this, Ue))), m(this, Ue, a(this, Ue) + 1), Promise.resolve();
3991
+ return this.ensureBufferSpace(1), Wc(e, a(this, Me).subarray(a(this, Ue))), m(this, Ue, a(this, Ue) + 1), Promise.resolve();
3992
3992
  }
3993
3993
  writeVarInt(e) {
3994
3994
  if (e < 0)
3995
3995
  throw new Error(`VarInt can not be negative: ${e}`);
3996
- return this.ensureBufferSpace(8), m(this, Ue, a(this, Ue) + dl(e, a(this, xe).subarray(a(this, Ue))).byteLength), Promise.resolve();
3996
+ return this.ensureBufferSpace(8), m(this, Ue, a(this, Ue) + dl(e, a(this, Me).subarray(a(this, Ue))).byteLength), Promise.resolve();
3997
3997
  }
3998
3998
  writeBigVarInt(e) {
3999
3999
  if (e < 0)
4000
4000
  throw new Error(`VarInt can not be negative: ${e}`);
4001
- return this.ensureBufferSpace(8), m(this, Ue, a(this, Ue) + ll(e, a(this, xe).subarray(a(this, Ue))).byteLength), Promise.resolve();
4001
+ return this.ensureBufferSpace(8), m(this, Ue, a(this, Ue) + ll(e, a(this, Me).subarray(a(this, Ue))).byteLength), Promise.resolve();
4002
4002
  }
4003
4003
  flush() {
4004
4004
  if (a(this, Xi).readyState !== sl.OPEN)
4005
4005
  throw new Error("Writer is not open");
4006
- return a(this, Xi).send(a(this, xe).subarray(0, a(this, Ue))), m(this, Ue, 0), m(this, xe, new Uint8Array(Br.DEFAULT_BUFFER_SIZE)), Promise.resolve();
4006
+ return a(this, Xi).send(a(this, Me).subarray(0, a(this, Ue))), m(this, Ue, 0), m(this, Me, new Uint8Array(Br.DEFAULT_BUFFER_SIZE)), Promise.resolve();
4007
4007
  }
4008
4008
  close() {
4009
4009
  return a(this, Xi).close(), Promise.resolve();
4010
4010
  }
4011
4011
  };
4012
- Ue = new WeakMap(), xe = new WeakMap(), Xi = new WeakMap(), ec = new WeakMap(), r(Br, "DEFAULT_BUFFER_SIZE", 1024);
4013
- let xr = Br;
4014
- const nl = 2 ** 6 - 1, rl = 2 ** 14 - 1, al = 2 ** 30 - 1, vg = Number.MAX_SAFE_INTEGER, Tg = typeof BigInt == "function" ? M(2) ** M(62) - M(1) : M(Number.MAX_SAFE_INTEGER);
4012
+ Ue = new WeakMap(), Me = new WeakMap(), Xi = new WeakMap(), ec = new WeakMap(), r(Br, "DEFAULT_BUFFER_SIZE", 1024);
4013
+ let Mr = Br;
4014
+ const nl = 2 ** 6 - 1, rl = 2 ** 14 - 1, al = 2 ** 30 - 1, vg = Number.MAX_SAFE_INTEGER, Tg = typeof BigInt == "function" ? x(2) ** x(62) - x(1) : x(Number.MAX_SAFE_INTEGER);
4015
4015
  function Wc(s, e) {
4016
4016
  return e[0] = s, e.subarray(0, 1);
4017
4017
  }
@@ -4072,7 +4072,7 @@ function au(s, e) {
4072
4072
  yield s.writeString(t);
4073
4073
  });
4074
4074
  }
4075
- const Do = M(2);
4075
+ const Do = x(2);
4076
4076
  function Yn(s) {
4077
4077
  return f(this, null, function* () {
4078
4078
  const e = yield s.readVarInt(), t = /* @__PURE__ */ new Map();
@@ -4225,7 +4225,7 @@ function Pg(s) {
4225
4225
  };
4226
4226
  });
4227
4227
  }
4228
- function Mg(s, e) {
4228
+ function xg(s, e) {
4229
4229
  return f(this, null, function* () {
4230
4230
  yield s.writeBigVarInt(e.id), yield s.writeBigVarInt(e.trackAlias), yield au(s, e.namespace), yield s.writeString(e.name), yield s.writeUnsigned8(e.subscriberPriority), yield fl(s, e.groupOrder), yield Ug(s, e.filterType), yield Kn(s, e.params);
4231
4231
  });
@@ -4234,7 +4234,7 @@ const vh = {
4234
4234
  TrackEnded: 3,
4235
4235
  Expired: 6
4236
4236
  };
4237
- function xg(s) {
4237
+ function Mg(s) {
4238
4238
  return f(this, null, function* () {
4239
4239
  const e = yield s.readBigVarInt(), t = yield s.readVarInt(), i = yield s.readString(), n = (yield s.readUnsigned8()) == 1;
4240
4240
  let o;
@@ -4320,7 +4320,7 @@ function Vg(s, e) {
4320
4320
  const Gg = {
4321
4321
  Subscriber: 2
4322
4322
  }, Oo = {
4323
- Role: M(0)
4323
+ Role: x(0)
4324
4324
  }, pl = {
4325
4325
  Draft07: 4278190087
4326
4326
  };
@@ -4399,7 +4399,7 @@ class Al {
4399
4399
  write(e) {
4400
4400
  return f(this, null, function* () {
4401
4401
  yield a(this, Ft).writeVarInt(e.type);
4402
- const t = new xr({
4402
+ const t = new Mr({
4403
4403
  close: () => {
4404
4404
  },
4405
4405
  readyState: sl.OPEN,
@@ -4460,7 +4460,7 @@ Ft = new WeakMap(), hn = new WeakMap(), te = new WeakSet(), wl = function(e, t)
4460
4460
  });
4461
4461
  }, yl = function(e, t) {
4462
4462
  return f(this, null, function* () {
4463
- yield Mg(e, t);
4463
+ yield xg(e, t);
4464
4464
  });
4465
4465
  }, Sl = function(e, t) {
4466
4466
  return f(this, null, function* () {
@@ -4509,7 +4509,12 @@ class qg {
4509
4509
  }
4510
4510
  }
4511
4511
  un = new WeakMap(), sa = new WeakMap(), na = new WeakMap();
4512
- function Zg(s) {
4512
+ class Zg extends Error {
4513
+ constructor(e, t) {
4514
+ super(e), this.errorCode = t;
4515
+ }
4516
+ }
4517
+ function Jg(s) {
4513
4518
  return f(this, null, function* () {
4514
4519
  return {
4515
4520
  type: C.AnnounceError,
@@ -4519,7 +4524,7 @@ function Zg(s) {
4519
4524
  };
4520
4525
  });
4521
4526
  }
4522
- function Jg(s, e, t) {
4527
+ function $g(s, e, t) {
4523
4528
  return f(this, null, function* () {
4524
4529
  return {
4525
4530
  type: C.Unknown,
@@ -4550,7 +4555,7 @@ class Wu {
4550
4555
  case C.SubscribeOk:
4551
4556
  return Fg(a(this, he));
4552
4557
  case C.SubscribeDone:
4553
- return xg(a(this, he));
4558
+ return Mg(a(this, he));
4554
4559
  case C.SubscribeError:
4555
4560
  return Dg(a(this, he));
4556
4561
  case C.SubscribeUpdate:
@@ -4562,9 +4567,9 @@ class Wu {
4562
4567
  case C.AnnounceOk:
4563
4568
  return Ig(a(this, he));
4564
4569
  case C.AnnounceError:
4565
- return Zg(a(this, he));
4570
+ return Jg(a(this, he));
4566
4571
  }
4567
- return Jg(a(this, he), M(e), t);
4572
+ return $g(a(this, he), x(e), t);
4568
4573
  });
4569
4574
  }
4570
4575
  }
@@ -4607,7 +4612,7 @@ const Vs = class Vs {
4607
4612
  static wrapWebsocket(e) {
4608
4613
  const t = new ReadableStream(
4609
4614
  new yg(e, a(Vs, ic))
4610
- ), i = new Wu(new Lo(new Uint8Array([]), t)), n = new qg(new xr(e), new Uint8Array([0]));
4615
+ ), i = new Wu(new Lo(new Uint8Array([]), t)), n = new qg(new Mr(e), new Uint8Array([0]));
4611
4616
  return new Vs(n, i);
4612
4617
  }
4613
4618
  static wrapWebTransport(e) {
@@ -4638,7 +4643,7 @@ function Bl(s, e) {
4638
4643
  });
4639
4644
  }
4640
4645
  var mn;
4641
- class $g {
4646
+ class Yg {
4642
4647
  constructor(e) {
4643
4648
  r(this, "announce");
4644
4649
  d(this, mn, new z());
@@ -4648,7 +4653,7 @@ class $g {
4648
4653
  a(this, mn).resolve(e);
4649
4654
  }
4650
4655
  onError(e) {
4651
- const t = new Error(e.reason);
4656
+ const t = new Zg(e.reason, e.errorCode);
4652
4657
  return a(this, mn).reject(t), t;
4653
4658
  }
4654
4659
  ok() {
@@ -4656,11 +4661,11 @@ class $g {
4656
4661
  }
4657
4662
  }
4658
4663
  mn = new WeakMap();
4659
- function Yg(s) {
4660
- const e = new $g(s);
4661
- return new Kg(e);
4664
+ function Kg(s) {
4665
+ const e = new Yg(s);
4666
+ return new eA(e);
4662
4667
  }
4663
- class Kg {
4668
+ class eA {
4664
4669
  constructor(e) {
4665
4670
  r(this, "state");
4666
4671
  this.state = e;
@@ -4686,14 +4691,14 @@ const Gs = class Gs {
4686
4691
  }
4687
4692
  }
4688
4693
  onUpdate(e) {
4689
- m(this, st, { startGroup: e.start.group }), e.end.group > M(0) && (a(this, st).endGroup = e.end.group - M(1));
4694
+ m(this, st, { startGroup: e.start.group }), e.end.group > x(0) && (a(this, st).endGroup = e.end.group - x(1));
4690
4695
  }
4691
4696
  onError(e) {
4692
4697
  const t = new Error(e.reason);
4693
4698
  return a(this, fn).reject(t), a(this, ai).reject(t), t;
4694
4699
  }
4695
4700
  onDone(e) {
4696
- e.finalInfo && (a(this, st) || m(this, st, { startGroup: M(0) }), a(this, st).endGroup = e.finalInfo.group), a(this, ai).resolve(e);
4701
+ e.finalInfo && (a(this, st) || m(this, st, { startGroup: x(0) }), a(this, st).endGroup = e.finalInfo.group), a(this, ai).resolve(e);
4697
4702
  }
4698
4703
  onUnsubscribe(e) {
4699
4704
  a(this, qi).resolve(e);
@@ -4739,7 +4744,7 @@ const Gs = class Gs {
4739
4744
  fn = new WeakMap(), ai = new WeakMap(), qi = new WeakMap(), sc = new WeakMap(), Zi = new WeakMap(), st = new WeakMap(), r(Gs, "maxGraceTime", 15e3), r(Gs, "minGraceTime", 3e3);
4740
4745
  let _o = Gs;
4741
4746
  var we, oa;
4742
- class eA {
4747
+ class tA {
4743
4748
  constructor(e) {
4744
4749
  d(this, we);
4745
4750
  d(this, oa, !1);
@@ -4747,7 +4752,7 @@ class eA {
4747
4752
  }
4748
4753
  write(e) {
4749
4754
  return f(this, null, function* () {
4750
- a(this, oa) || (yield a(this, we).writeVarInt(xo.StreamHeaderGroup), yield a(this, we).writeBigVarInt(e.subscribeId), yield a(this, we).writeBigVarInt(e.trackAlias), yield a(this, we).writeBigVarInt(e.groupId), yield a(this, we).writeBigVarInt(e.subGroupId), yield a(this, we).writeUnsigned8(e.subscriberPriority), m(this, oa, !0)), yield a(this, we).writeBigVarInt(e.objectId), yield a(this, we).writeVarInt(e.payload.length), e.payload.length > 0 ? yield a(this, we).write(e.payload) : yield a(this, we).writeVarInt(e.objectStatus), yield a(this, we).flush();
4755
+ a(this, oa) || (yield a(this, we).writeVarInt(Mo.StreamHeaderGroup), yield a(this, we).writeBigVarInt(e.subscribeId), yield a(this, we).writeBigVarInt(e.trackAlias), yield a(this, we).writeBigVarInt(e.groupId), yield a(this, we).writeBigVarInt(e.subGroupId), yield a(this, we).writeUnsigned8(e.subscriberPriority), m(this, oa, !0)), yield a(this, we).writeBigVarInt(e.objectId), yield a(this, we).writeVarInt(e.payload.length), e.payload.length > 0 ? yield a(this, we).write(e.payload) : yield a(this, we).writeVarInt(e.objectStatus), yield a(this, we).flush();
4751
4756
  });
4752
4757
  }
4753
4758
  close() {
@@ -4758,7 +4763,7 @@ class eA {
4758
4763
  }
4759
4764
  we = new WeakMap(), oa = new WeakMap();
4760
4765
  var ca, He, ha, ua, pn, da, nc, Ul;
4761
- class tA {
4766
+ class iA {
4762
4767
  constructor(e, t, i, n) {
4763
4768
  d(this, nc);
4764
4769
  d(this, ca);
@@ -4814,8 +4819,8 @@ ca = new WeakMap(), He = new WeakMap(), ha = new WeakMap(), ua = new WeakMap(),
4814
4819
  if (g && (g.startGroup > p.id || g.endGroup && g.endGroup < p.id))
4815
4820
  break;
4816
4821
  const w = yield a(this, ha).openSendStream();
4817
- const b = new eA(w);
4818
- const v = je(e, new iA(b, p.consume(), a(this, He)), !0);
4822
+ const b = new tA(w);
4823
+ const v = je(e, new sA(b, p.consume(), a(this, He)), !0);
4819
4824
  yield v.run();
4820
4825
  m(this, pn, v.finalGroup());
4821
4826
  } catch (t) {
@@ -4838,7 +4843,7 @@ ca = new WeakMap(), He = new WeakMap(), ha = new WeakMap(), ua = new WeakMap(),
4838
4843
  });
4839
4844
  };
4840
4845
  var Ji, la, gn, ma, An;
4841
- class iA {
4846
+ class sA {
4842
4847
  constructor(e, t, i) {
4843
4848
  d(this, Ji);
4844
4849
  d(this, la);
@@ -4859,7 +4864,7 @@ class iA {
4859
4864
  yield a(this, Ji).write({
4860
4865
  subscribeId: a(this, gn).subscribe.id,
4861
4866
  trackAlias: a(this, gn).subscribe.trackAlias,
4862
- subGroupId: M(0),
4867
+ subGroupId: x(0),
4863
4868
  subscriberPriority: 0,
4864
4869
  groupId: o.groupId,
4865
4870
  objectId: o.objectId,
@@ -4888,8 +4893,8 @@ class iA {
4888
4893
  }
4889
4894
  }
4890
4895
  Ji = new WeakMap(), la = new WeakMap(), gn = new WeakMap(), ma = new WeakMap(), An = new WeakMap();
4891
- var fa, $i, oi, xs;
4892
- class sA {
4896
+ var fa, $i, oi, Ms;
4897
+ class nA {
4893
4898
  constructor(e, t, i) {
4894
4899
  d(this, oi);
4895
4900
  r(this, "state");
@@ -4905,31 +4910,31 @@ class sA {
4905
4910
  ok(e) {
4906
4911
  return f(this, null, function* () {
4907
4912
  var u, l, p;
4908
- const t = (u = this.state.range()) == null ? void 0 : u.startGroup, i = e.latest(), n = i == null ? void 0 : i.id, o = (p = (l = i == null ? void 0 : i.latest()) == null ? void 0 : l.objectId) != null ? p : M(0), c = e.consume(t != null ? t : n), h = {
4913
+ const t = (u = this.state.range()) == null ? void 0 : u.startGroup, i = e.latest(), n = i == null ? void 0 : i.id, o = (p = (l = i == null ? void 0 : i.latest()) == null ? void 0 : l.objectId) != null ? p : x(0), c = e.consume(t != null ? t : n), h = {
4909
4914
  type: C.SubscribeOk,
4910
4915
  id: this.state.subscribe.id,
4911
- expires: M(0),
4916
+ expires: x(0),
4912
4917
  groupOrder: "ascending",
4913
4918
  params: /* @__PURE__ */ new Map(),
4914
4919
  largestInfo: n ? { group: n, object: o } : void 0
4915
4920
  };
4916
- return yield a(this, $i).push(h), new tA(this.state, c, a(this, fa), a(this, $i));
4921
+ return yield a(this, $i).push(h), new iA(this.state, c, a(this, fa), a(this, $i));
4917
4922
  });
4918
4923
  }
4919
4924
  invalidRange() {
4920
- return A(this, oi, xs).call(this, M(1), "Invalid range");
4925
+ return A(this, oi, Ms).call(this, x(1), "Invalid range");
4921
4926
  }
4922
4927
  retryTrackAlias() {
4923
- return A(this, oi, xs).call(this, M(2), "Retry track alias");
4928
+ return A(this, oi, Ms).call(this, x(2), "Retry track alias");
4924
4929
  }
4925
4930
  trackDoesNotExist() {
4926
- return A(this, oi, xs).call(this, M(3), "Track does not exist");
4931
+ return A(this, oi, Ms).call(this, x(3), "Track does not exist");
4927
4932
  }
4928
4933
  unauthorized() {
4929
- return A(this, oi, xs).call(this, M(4), "Unauthorized");
4934
+ return A(this, oi, Ms).call(this, x(4), "Unauthorized");
4930
4935
  }
4931
4936
  timeout() {
4932
- return A(this, oi, xs).call(this, M(5), "Timeout");
4937
+ return A(this, oi, Ms).call(this, x(5), "Timeout");
4933
4938
  }
4934
4939
  [Rt()]() {
4935
4940
  return this.trackDoesNotExist();
@@ -4938,7 +4943,7 @@ class sA {
4938
4943
  return this.trackDoesNotExist();
4939
4944
  }
4940
4945
  }
4941
- fa = new WeakMap(), $i = new WeakMap(), oi = new WeakSet(), xs = function(e, t) {
4946
+ fa = new WeakMap(), $i = new WeakMap(), oi = new WeakSet(), Ms = function(e, t) {
4942
4947
  const i = {
4943
4948
  type: C.SubscribeError,
4944
4949
  id: this.state.subscribe.id,
@@ -4972,7 +4977,7 @@ class Th {
4972
4977
  type: C.Announce,
4973
4978
  namespace: e,
4974
4979
  params: t
4975
- }, o = Yg(n);
4980
+ }, o = Kg(n);
4976
4981
  if (a(this, ci).update((h) => h.set(n.namespace.join("/"), o)), yield a(this, bn).push(n), !(yield Promise.race([o.state.ok(), a(this, wn).closed()])))
4977
4982
  throw new Error("Session closed");
4978
4983
  });
@@ -4994,7 +4999,7 @@ class Th {
4994
4999
  yield i == null ? void 0 : i.timeout();
4995
5000
  }
4996
5001
  yield a(this, ui).push(
4997
- new sA(t, a(this, pa), a(this, bn))
5002
+ new nA(t, a(this, pa), a(this, bn))
4998
5003
  );
4999
5004
  }
5000
5005
  break;
@@ -5027,12 +5032,12 @@ class Th {
5027
5032
  }
5028
5033
  }
5029
5034
  ah = Ci(null), wn = new WeakMap(), pa = new WeakMap(), bn = new WeakMap(), Yi = new WeakMap(), ci = new WeakMap(), hi = new WeakMap(), ui = new WeakMap(), ye(ah, 1, "announce", cd, Th), Zt(ah, Th);
5030
- function nA(s, e) {
5031
- const t = new _o(e), [i, n] = su(100), o = new rA(t, i), c = new Pl(s, t, n);
5035
+ function rA(s, e) {
5036
+ const t = new _o(e), [i, n] = su(100), o = new aA(t, i), c = new Pl(s, t, n);
5032
5037
  return [o, c];
5033
5038
  }
5034
5039
  var Ki;
5035
- class rA {
5040
+ class aA {
5036
5041
  constructor(e, t) {
5037
5042
  r(this, "state");
5038
5043
  d(this, Ki);
@@ -5092,8 +5097,8 @@ class Pl {
5092
5097
  const i = {
5093
5098
  type: C.SubscribeUpdate,
5094
5099
  id: a(this, le).subscribe.id,
5095
- start: { group: e, object: M(0) },
5096
- end: { group: t + M(1), object: M(0) },
5100
+ start: { group: e, object: x(0) },
5101
+ end: { group: t + x(1), object: x(0) },
5097
5102
  params: /* @__PURE__ */ new Map(),
5098
5103
  subscriberPriority: 0
5099
5104
  };
@@ -5231,7 +5236,7 @@ oh = Ci(null), yn = new WeakMap(), le = new WeakMap(), Sn = new WeakMap(), vn =
5231
5236
  return yield this.close(), this.unsubscribe();
5232
5237
  });
5233
5238
  }, ar = ye(oh, 17, "#dispose", hd, Tn, ar), Zt(oh, Pl);
5234
- const aA = 2e3;
5239
+ const oA = 2e3;
5235
5240
  var ud, dd, ld, md, _t, Le, es, ts, Ps, Ct, oo, Ls;
5236
5241
  md = [Pe({ context: "Session", return: "debug" })], ld = [Pe({ context: "Session", enter: "info", error: "error" })], dd = [Pe({ context: "Session", enter: "debug" })], ud = [Pe({ context: "Session", enter: "debug" })];
5237
5242
  class ao {
@@ -5241,7 +5246,7 @@ class ao {
5241
5246
  // The owner session of the subscriber
5242
5247
  d(this, _t);
5243
5248
  // The next subscribe id
5244
- r(this, "nextSubscribeId", M(0));
5249
+ r(this, "nextSubscribeId", x(0));
5245
5250
  // The active subscriptions
5246
5251
  d(this, Le, new ke(/* @__PURE__ */ new Map()));
5247
5252
  d(this, es);
@@ -5262,10 +5267,10 @@ class ao {
5262
5267
  subscriberPriority: t.priority,
5263
5268
  filterType: t.filterType,
5264
5269
  params: i
5265
- }, [l, p] = nA(a(this, es), u);
5270
+ }, [l, p] = rA(a(this, es), u);
5266
5271
  if (a(this, Le).update((w) => w.set(c, l)), yield a(this, es).push(u), !(yield Promise.race([l.state.ok(), a(this, _t).closed()])))
5267
5272
  throw new Error("Session closed");
5268
- return p.closed().then(() => Promise.race([ki(aA), this.closed()])).then(() => A(this, Ct, Ls).call(this, p.id)).catch(() => A(this, Ct, Ls).call(this, p.id)), p;
5273
+ return p.closed().then(() => Promise.race([ki(oA), this.closed()])).then(() => A(this, Ct, Ls).call(this, p.id)).catch(() => A(this, Ct, Ls).call(this, p.id)), p;
5269
5274
  });
5270
5275
  }
5271
5276
  closed() {
@@ -5343,10 +5348,10 @@ Ps = Ci(null), _t = new WeakMap(), Le = new WeakMap(), es = new WeakMap(), ts =
5343
5348
  }, Ls = function(e) {
5344
5349
  a(this, Le).isClosed() || a(this, Le).update((t) => (t.delete(e), t));
5345
5350
  }, oo = ye(Ps, 17, "#observeChanges", md, Ct, oo), ye(Ps, 1, "subscribe", ld, ao), ye(Ps, 1, "close", dd, ao), Ls = ye(Ps, 17, "#deleteSubscription", ud, Ct, Ls), Zt(Ps, ao);
5346
- var fd, pd, gd, Ad, nt, ga, is, En, kn, ue, Ml, xl, Ms, co, ho, uo, or;
5351
+ var fd, pd, gd, Ad, nt, ga, is, En, kn, ue, xl, Ml, xs, co, ho, uo, or;
5347
5352
  class ou {
5348
5353
  constructor(e, t) {
5349
- Ri(Ms, 5, this);
5354
+ Ri(xs, 5, this);
5350
5355
  d(this, ue);
5351
5356
  // The underlying transport implementation
5352
5357
  d(this, nt);
@@ -5359,7 +5364,7 @@ class ou {
5359
5364
  r(this, "publisher");
5360
5365
  d(this, kn);
5361
5366
  const [i, n] = su(100);
5362
- m(this, nt, e), m(this, is, n), this.subscriber = new ao(this, i), this.publisher = new Th(this, e, i), m(this, ga, A(this, ue, xl).call(this)), m(this, kn, new ke(t)), this.closed().then(() => this.close()).catch(D);
5367
+ m(this, nt, e), m(this, is, n), this.subscriber = new ao(this, i), this.publisher = new Th(this, e, i), m(this, ga, A(this, ue, Ml).call(this)), m(this, kn, new ke(t)), this.closed().then(() => this.close()).catch(D);
5363
5368
  }
5364
5369
  updateAuthToken(e) {
5365
5370
  a(this, kn).update(e);
@@ -5390,12 +5395,12 @@ class ou {
5390
5395
  A(this, ue, or).call(this);
5391
5396
  }
5392
5397
  }
5393
- Ms = Ci(null), nt = new WeakMap(), ga = new WeakMap(), is = new WeakMap(), En = new WeakMap(), kn = new WeakMap(), ue = new WeakSet(), Ml = function(e) {
5398
+ xs = Ci(null), nt = new WeakMap(), ga = new WeakMap(), is = new WeakMap(), En = new WeakMap(), kn = new WeakMap(), ue = new WeakSet(), xl = function(e) {
5394
5399
  return f(this, null, function* () {
5395
5400
  var t, i;
5396
5401
  a(this, En).debug("received message", e), yield (t = this.subscriber) == null ? void 0 : t.onMessage(e), yield (i = this.publisher) == null ? void 0 : i.onMessage(e), e.type, C.Goaway;
5397
5402
  });
5398
- }, xl = function() {
5403
+ }, Ml = function() {
5399
5404
  return f(this, null, function* () {
5400
5405
  return (yield Promise.all([A(this, ue, ho).call(this), A(this, ue, uo).call(this), A(this, ue, co).call(this)])).find((t) => t instanceof Error);
5401
5406
  });
@@ -5429,7 +5434,7 @@ Ms = Ci(null), nt = new WeakMap(), ga = new WeakMap(), is = new WeakMap(), En =
5429
5434
  });
5430
5435
  if (!e)
5431
5436
  break;
5432
- yield A(this, ue, Ml).call(this, e);
5437
+ yield A(this, ue, xl).call(this, e);
5433
5438
  }
5434
5439
  } catch (e) {
5435
5440
  return e;
@@ -5453,10 +5458,10 @@ Ms = Ci(null), nt = new WeakMap(), ga = new WeakMap(), is = new WeakMap(), En =
5453
5458
  });
5454
5459
  }, or = function() {
5455
5460
  this.close();
5456
- }, co = ye(Ms, 17, "#runOutgoingMessages", Ad, ue, co), ho = ye(Ms, 17, "#runControl", gd, ue, ho), uo = ye(Ms, 17, "#runObjects", pd, ue, uo), or = ye(Ms, 17, "#dispose", fd, ue, or), Zt(Ms, ou);
5457
- const oA = 128;
5458
- var Qe, Aa, ss, In, wa, be, xi, Li;
5459
- class cA {
5461
+ }, co = ye(xs, 17, "#runOutgoingMessages", Ad, ue, co), ho = ye(xs, 17, "#runControl", gd, ue, ho), uo = ye(xs, 17, "#runObjects", pd, ue, uo), or = ye(xs, 17, "#dispose", fd, ue, or), Zt(xs, ou);
5462
+ const cA = 128;
5463
+ var Qe, Aa, ss, In, wa, be, Mi, Li;
5464
+ class hA {
5460
5465
  constructor(e, t, i) {
5461
5466
  d(this, be);
5462
5467
  d(this, Qe);
@@ -5468,32 +5473,32 @@ class cA {
5468
5473
  }
5469
5474
  writeUnsigned8(e) {
5470
5475
  return f(this, null, function* () {
5471
- return A(this, be, xi).call(this), yield A(this, be, Li).call(this), a(this, Qe).writeUnsigned8(e);
5476
+ return A(this, be, Mi).call(this), yield A(this, be, Li).call(this), a(this, Qe).writeUnsigned8(e);
5472
5477
  });
5473
5478
  }
5474
5479
  writeVarInt(e) {
5475
5480
  return f(this, null, function* () {
5476
- return A(this, be, xi).call(this), yield A(this, be, Li).call(this), a(this, Qe).writeVarInt(e);
5481
+ return A(this, be, Mi).call(this), yield A(this, be, Li).call(this), a(this, Qe).writeVarInt(e);
5477
5482
  });
5478
5483
  }
5479
5484
  writeBigVarInt(e) {
5480
5485
  return f(this, null, function* () {
5481
- return A(this, be, xi).call(this), yield A(this, be, Li).call(this), a(this, Qe).writeBigVarInt(e);
5486
+ return A(this, be, Mi).call(this), yield A(this, be, Li).call(this), a(this, Qe).writeBigVarInt(e);
5482
5487
  });
5483
5488
  }
5484
5489
  write(e) {
5485
5490
  return f(this, null, function* () {
5486
- return A(this, be, xi).call(this), yield A(this, be, Li).call(this), a(this, Qe).write(e);
5491
+ return A(this, be, Mi).call(this), yield A(this, be, Li).call(this), a(this, Qe).write(e);
5487
5492
  });
5488
5493
  }
5489
5494
  writeString(e) {
5490
5495
  return f(this, null, function* () {
5491
- return A(this, be, xi).call(this), yield A(this, be, Li).call(this), a(this, Qe).writeString(e);
5496
+ return A(this, be, Mi).call(this), yield A(this, be, Li).call(this), a(this, Qe).writeString(e);
5492
5497
  });
5493
5498
  }
5494
5499
  flush() {
5495
5500
  return f(this, null, function* () {
5496
- A(this, be, xi).call(this), m(this, ss, !0), yield a(this, Qe).flush();
5501
+ A(this, be, Mi).call(this), m(this, ss, !0), yield a(this, Qe).flush();
5497
5502
  });
5498
5503
  }
5499
5504
  close() {
@@ -5502,15 +5507,15 @@ class cA {
5502
5507
  });
5503
5508
  }
5504
5509
  }
5505
- Qe = new WeakMap(), Aa = new WeakMap(), ss = new WeakMap(), In = new WeakMap(), wa = new WeakMap(), be = new WeakSet(), xi = function() {
5510
+ Qe = new WeakMap(), Aa = new WeakMap(), ss = new WeakMap(), In = new WeakMap(), wa = new WeakMap(), be = new WeakSet(), Mi = function() {
5506
5511
  if (a(this, In))
5507
5512
  throw new Error("Stream is closed");
5508
5513
  }, Li = function(e = !0) {
5509
5514
  if (a(this, ss))
5510
- return m(this, ss, !1), a(this, Qe).writeUnsigned8(a(this, Aa) | (e ? oA : 0));
5515
+ return m(this, ss, !1), a(this, Qe).writeUnsigned8(a(this, Aa) | (e ? cA : 0));
5511
5516
  };
5512
5517
  var di, Nt, Cn, ns, Vt, Rn, Bn, rc, Ll;
5513
- class hA {
5518
+ class uA {
5514
5519
  constructor(e, t) {
5515
5520
  d(this, rc);
5516
5521
  d(this, di);
@@ -5529,7 +5534,7 @@ class hA {
5529
5534
  if (!e)
5530
5535
  throw new Error("No stream IDs available");
5531
5536
  return a(this, Bn).delete(e), Promise.resolve(
5532
- new cA(new xr(a(this, di)), e, () => A(this, rc, Ll).call(this, e))
5537
+ new hA(new Mr(a(this, di)), e, () => A(this, rc, Ll).call(this, e))
5533
5538
  );
5534
5539
  }
5535
5540
  transportType() {
@@ -5551,11 +5556,11 @@ class hA {
5551
5556
  if (i)
5552
5557
  return;
5553
5558
  const [n, o, c] = t;
5554
- if (a(this, Vt).has(M(o))) {
5555
- const h = a(this, Vt).get(M(o));
5559
+ if (a(this, Vt).has(x(o))) {
5560
+ const h = a(this, Vt).get(x(o));
5556
5561
  if (!h)
5557
5562
  throw new Error("Stream not found");
5558
- c.length > 0 && (yield h.push(c)), n || (a(this, Rn).debug("Closing stream", { streamId: o }), h.close(), a(this, Vt).delete(M(o)));
5563
+ c.length > 0 && (yield h.push(c)), n || (a(this, Rn).debug("Closing stream", { streamId: o }), h.close(), a(this, Vt).delete(x(o)));
5559
5564
  } else {
5560
5565
  let p;
5561
5566
  a(this, Rn).debug("Creating new stream", { streamId: o });
@@ -5567,7 +5572,7 @@ class hA {
5567
5572
  });
5568
5573
  }
5569
5574
  });
5570
- if (a(this, Vt).set(M(o), h), n || (a(this, Rn).debug("Closing new stream", { streamId: o }), yield l.cancel(), a(this, Vt).delete(M(o))), c.length > 0)
5575
+ if (a(this, Vt).set(x(o), h), n || (a(this, Rn).debug("Closing new stream", { streamId: o }), yield l.cancel(), a(this, Vt).delete(x(o))), c.length > 0)
5571
5576
  return yield tl(new Lo(c, l), o);
5572
5577
  }
5573
5578
  } finally {
@@ -5602,7 +5607,7 @@ Ll = function(e) {
5602
5607
  a(this, Bn).add(e);
5603
5608
  };
5604
5609
  var Gt, jt, li, ba, ya, ac, oc, Dl;
5605
- class uA {
5610
+ class dA {
5606
5611
  constructor(e, t, i) {
5607
5612
  d(this, oc);
5608
5613
  d(this, Gt);
@@ -5680,11 +5685,11 @@ function eh(s) {
5680
5685
  Bl(t, s.role).catch(() => {
5681
5686
  e.close();
5682
5687
  });
5683
- const i = new hA(e, t);
5688
+ const i = new uA(e, t);
5684
5689
  return new ou(i, s.authToken);
5685
5690
  });
5686
5691
  }
5687
- function dA(s) {
5692
+ function lA(s) {
5688
5693
  return f(this, null, function* () {
5689
5694
  const e = "60b82e8021689e163c1041b4475ef9c86e7565bc45d1a0aa43f5148769f461c7", t = new Uint8Array(e.length / 2);
5690
5695
  for (let u = 0; u < t.length; u += 1)
@@ -5698,14 +5703,14 @@ function dA(s) {
5698
5703
  Bl(o, s.role).catch(() => {
5699
5704
  i.close();
5700
5705
  });
5701
- const c = new uA(i, o, s.url.toString());
5706
+ const c = new dA(i, o, s.url.toString());
5702
5707
  return new ou(c, s.authToken);
5703
5708
  });
5704
5709
  }
5705
- function lA(s) {
5710
+ function mA(s) {
5706
5711
  return f(this, null, function* () {
5707
5712
  if (self.WebTransport && (s == null ? void 0 : s.preferredTransport) !== "websocket" && s.url.protocol.startsWith("https")) {
5708
- const e = dA(s).catch(() => eh(s)), t = yield Promise.race([e, ki(s.websocketFallbackTimeoutMs)]);
5713
+ const e = lA(s).catch(() => eh(s)), t = yield Promise.race([e, ki(s.websocketFallbackTimeoutMs)]);
5709
5714
  return t || eh(s);
5710
5715
  }
5711
5716
  return eh(s);
@@ -5737,14 +5742,14 @@ class Xt {
5737
5742
  startGroup(e) {
5738
5743
  return a(this, Wt).filterType = {
5739
5744
  type: "absolute-start",
5740
- start: { group: e, object: M(0) }
5745
+ start: { group: e, object: x(0) }
5741
5746
  }, this;
5742
5747
  }
5743
5748
  range(e, t) {
5744
5749
  return a(this, Wt).filterType = {
5745
5750
  type: "absolute-range",
5746
- start: { group: e, object: M(0) },
5747
- end: { group: t, object: M(0) }
5751
+ start: { group: e, object: x(0) },
5752
+ end: { group: t, object: x(0) }
5748
5753
  }, this;
5749
5754
  }
5750
5755
  build() {
@@ -5770,7 +5775,7 @@ class Ol {
5770
5775
  }
5771
5776
  }
5772
5777
  Un = new WeakMap(), Sa = new WeakMap();
5773
- function mA(s, e) {
5778
+ function fA(s, e) {
5774
5779
  return ["com.vindral.moq", s];
5775
5780
  }
5776
5781
  function Bi(s) {
@@ -5779,10 +5784,10 @@ function Bi(s) {
5779
5784
  throw new Error("namespace must contain a channel ID");
5780
5785
  return e;
5781
5786
  }
5782
- function fA(s) {
5787
+ function pA(s) {
5783
5788
  return "tracks" in s;
5784
5789
  }
5785
- function pA(s) {
5790
+ function gA(s) {
5786
5791
  const e = new TextDecoder().decode(s);
5787
5792
  return JSON.parse(e);
5788
5793
  }
@@ -5906,7 +5911,7 @@ const mu = class mu {
5906
5911
  case "absolute-start":
5907
5912
  case "latest-group":
5908
5913
  case "latest-object":
5909
- c && h.startGroup(o + M(1));
5914
+ c && h.startGroup(o + x(1));
5910
5915
  break;
5911
5916
  }
5912
5917
  const u = h.build();
@@ -6060,10 +6065,10 @@ rt = new WeakMap(), as = new WeakMap(), zt = new WeakMap(), vt = new WeakMap(),
6060
6065
  });
6061
6066
  }, ka = new WeakMap();
6062
6067
  let Ii = mu;
6063
- const gA = "catalog";
6068
+ const AA = "catalog";
6064
6069
  function zu(s) {
6065
- const e = pA(s.payload);
6066
- if (!fA(e))
6070
+ const e = gA(s.payload);
6071
+ if (!pA(e))
6067
6072
  throw new Error("unexpected catalog type");
6068
6073
  return e;
6069
6074
  }
@@ -6093,7 +6098,7 @@ const uc = class uc {
6093
6098
  const i = z.fromPromise(
6094
6099
  Ii.subscribe(
6095
6100
  e,
6096
- new Xt().name(t.catalogName || gA).groupOrder("ascending").build()
6101
+ new Xt().name(t.catalogName || AA).groupOrder("ascending").build()
6097
6102
  )
6098
6103
  ), n = z.fromPromise(i.promise.then((u) => u.objects()));
6099
6104
  if (t.catalog)
@@ -6130,21 +6135,21 @@ mi = new WeakMap(), Ia = new WeakMap(), Ca = new WeakMap(), Ra = new WeakMap(),
6130
6135
  });
6131
6136
  };
6132
6137
  let Ih = uc;
6133
- var Ba, Pn, Ua, Mn, Pa, Ch;
6134
- class AA {
6138
+ var Ba, Pn, Ua, xn, Pa, Ch;
6139
+ class wA {
6135
6140
  constructor(e, t, i, n) {
6136
6141
  d(this, Pa);
6137
6142
  d(this, Ba);
6138
6143
  d(this, Pn);
6139
6144
  d(this, Ua);
6140
6145
  r(this, "track");
6141
- d(this, Mn, ge.get().createContext("CmafGroup"));
6146
+ d(this, xn, ge.get().createContext("CmafGroup"));
6142
6147
  this.track = n, m(this, Ba, i), m(this, Pn, e), m(this, Ua, t);
6143
6148
  }
6144
6149
  [Symbol.asyncIterator]() {
6145
6150
  return Ut(this, null, function* () {
6146
6151
  const e = { name: this.track.trackObject.name, namespace: this.track.namespace };
6147
- a(this, Mn).debug("start", S({}, e));
6152
+ a(this, xn).debug("start", S({}, e));
6148
6153
  try {
6149
6154
  for (var t = $(a(this, Pn)), i, n, o; i = !(n = yield new q(t.next())).done; i = !1) {
6150
6155
  const c = n.value;
@@ -6155,7 +6160,7 @@ class AA {
6155
6160
  const b = this.track.timestampRange();
6156
6161
  if (b && l >= b[1])
6157
6162
  break;
6158
- a(this, Mn).debug("fragment", O(S({}, e), {
6163
+ a(this, xn).debug("fragment", O(S({}, e), {
6159
6164
  startTime: l,
6160
6165
  endTime: g,
6161
6166
  subscribeId: c.subscribeId,
@@ -6174,7 +6179,7 @@ class AA {
6174
6179
  throw o[0];
6175
6180
  }
6176
6181
  }
6177
- a(this, Mn).debug("end", S({}, e));
6182
+ a(this, xn).debug("end", S({}, e));
6178
6183
  });
6179
6184
  }
6180
6185
  [Rt()]() {
@@ -6184,24 +6189,24 @@ class AA {
6184
6189
  return A(this, Pa, Ch).call(this);
6185
6190
  }
6186
6191
  }
6187
- Ba = new WeakMap(), Pn = new WeakMap(), Ua = new WeakMap(), Mn = new WeakMap(), Pa = new WeakSet(), Ch = function() {
6192
+ Ba = new WeakMap(), Pn = new WeakMap(), Ua = new WeakMap(), xn = new WeakMap(), Pa = new WeakSet(), Ch = function() {
6188
6193
  return f(this, null, function* () {
6189
6194
  var e, t;
6190
6195
  return yield (t = (e = a(this, Pn)).return) == null ? void 0 : t.call(e), Promise.resolve();
6191
6196
  });
6192
6197
  };
6193
- var Ma, Tt, xa, La, dc, _l;
6198
+ var xa, Tt, Ma, La, dc, _l;
6194
6199
  const js = class js {
6195
6200
  constructor(e, t, i, n, o) {
6196
- d(this, Ma);
6201
+ d(this, xa);
6197
6202
  d(this, Tt);
6198
6203
  // A static offset that will be applied to all fragments
6199
- d(this, xa);
6204
+ d(this, Ma);
6200
6205
  // Stop consuming the track after we have passed thig timestamp
6201
6206
  d(this, La);
6202
6207
  r(this, "trackObject");
6203
6208
  r(this, "namespace");
6204
- this.trackObject = e, this.namespace = t, m(this, Tt, i), m(this, Ma, n), m(this, xa, o);
6209
+ this.trackObject = e, this.namespace = t, m(this, Tt, i), m(this, xa, n), m(this, Ma, o);
6205
6210
  }
6206
6211
  static subscribe(c, h, u) {
6207
6212
  return f(this, arguments, function* (e, t, {
@@ -6218,14 +6223,14 @@ const js = class js {
6218
6223
  if (t.initTrack) {
6219
6224
  const k = new Xt().name(t.initTrack).build(), [I, P] = yield Promise.all([
6220
6225
  A(v = js, dc, _l).call(v, e, k),
6221
- Ii.subscribe(e, p, { params: o, largestGroupId: n ? n - M(1) : void 0 })
6226
+ Ii.subscribe(e, p, { params: o, largestGroupId: n ? n - x(1) : void 0 })
6222
6227
  ]), E = new Fu(I);
6223
6228
  return new js(t, e.namespace(), P, E, i);
6224
6229
  }
6225
6230
  qe(t.initData, "no init data found on track");
6226
6231
  const g = kd(t.initData), w = new Fu(new Uint8Array(g)), b = yield Ii.subscribe(e, p, {
6227
6232
  params: o,
6228
- largestGroupId: n ? n - M(1) : void 0
6233
+ largestGroupId: n ? n - x(1) : void 0
6229
6234
  });
6230
6235
  return new js(t, e.namespace(), b, w, i);
6231
6236
  });
@@ -6255,7 +6260,7 @@ const js = class js {
6255
6260
  const e = yield a(this, Tt).next();
6256
6261
  return e.done ? e : {
6257
6262
  done: !1,
6258
- value: new AA(e.value, a(this, Ma), a(this, xa), this)
6263
+ value: new wA(e.value, a(this, xa), a(this, Ma), this)
6259
6264
  };
6260
6265
  });
6261
6266
  }
@@ -6276,7 +6281,7 @@ const js = class js {
6276
6281
  });
6277
6282
  }
6278
6283
  };
6279
- Ma = new WeakMap(), Tt = new WeakMap(), xa = new WeakMap(), La = new WeakMap(), dc = new WeakSet(), _l = function(e, t) {
6284
+ xa = new WeakMap(), Tt = new WeakMap(), Ma = new WeakMap(), La = new WeakMap(), dc = new WeakSet(), _l = function(e, t) {
6280
6285
  return f(this, null, function* () {
6281
6286
  var o = [];
6282
6287
  try {
@@ -6295,7 +6300,7 @@ Ma = new WeakMap(), Tt = new WeakMap(), xa = new WeakMap(), La = new WeakMap(),
6295
6300
  });
6296
6301
  }, d(js, dc);
6297
6302
  let Rh = js;
6298
- const Hu = 1e4, wA = 3e4;
6303
+ const Hu = 1e4, bA = 3e4;
6299
6304
  var lc, fi, os, Da, Oa, Fa, Is, Uh, Nl;
6300
6305
  const fu = class fu {
6301
6306
  constructor(e, t, i) {
@@ -6361,13 +6366,13 @@ lc = new WeakMap(), fi = new WeakMap(), os = new WeakMap(), Da = new WeakMap(),
6361
6366
  const E = o.value;
6362
6367
  if (E.objectStatus !== Ee.Normal)
6363
6368
  continue;
6364
- const U = bA(E.payload);
6369
+ const U = yA(E.payload);
6365
6370
  a(this, fi).update((B) => {
6366
6371
  var X, Q;
6367
- for (B.push(...U), B.sort((_e, ie) => _e.wallclock - ie.wallclock); B[0] && ((Q = (X = B[B.length - 1]) == null ? void 0 : X.wallclock) != null ? Q : 0) - B[0].wallclock > wA; )
6372
+ for (B.push(...U), B.sort((_e, ie) => _e.wallclock - ie.wallclock); B[0] && ((Q = (X = B[B.length - 1]) == null ? void 0 : X.wallclock) != null ? Q : 0) - B[0].wallclock > bA; )
6368
6373
  B.shift();
6369
6374
  return B;
6370
- }), t === a(this, os).resolved && E.groupId > M(0) && E.objectId == M(0) && A(this, Is, Nl).call(this, E.groupId).catch((B) => {
6375
+ }), t === a(this, os).resolved && E.groupId > x(0) && E.objectId == x(0) && A(this, Is, Nl).call(this, E.groupId).catch((B) => {
6371
6376
  a(this, lc).warn("backfill failed", B);
6372
6377
  });
6373
6378
  }
@@ -6401,7 +6406,7 @@ lc = new WeakMap(), fi = new WeakMap(), os = new WeakMap(), Da = new WeakMap(),
6401
6406
  });
6402
6407
  }, Nl = function(e) {
6403
6408
  return f(this, null, function* () {
6404
- const t = e - M(1), i = this.timeline(), n = i[0], o = i[i.length - 1];
6409
+ const t = e - x(1), i = this.timeline(), n = i[0], o = i[i.length - 1];
6405
6410
  if (!n || !o || o.wallclock - n.wallclock > Hu)
6406
6411
  return;
6407
6412
  const c = z.fromPromise(
@@ -6414,7 +6419,7 @@ lc = new WeakMap(), fi = new WeakMap(), os = new WeakMap(), Da = new WeakMap(),
6414
6419
  });
6415
6420
  };
6416
6421
  let Bh = fu;
6417
- function bA(s) {
6422
+ function yA(s) {
6418
6423
  var t;
6419
6424
  const e = new TextDecoder("utf-8").decode(s).split(`
6420
6425
  `);
@@ -6431,23 +6436,23 @@ function bA(s) {
6431
6436
  };
6432
6437
  });
6433
6438
  }
6434
- function yA(s) {
6439
+ function SA(s) {
6435
6440
  return typeof s.language == "string";
6436
6441
  }
6437
- var mc, _a, pi, xn;
6442
+ var mc, _a, pi, Mn;
6438
6443
  const pu = class pu {
6439
6444
  constructor(e, t, i, n, o) {
6440
6445
  d(this, mc, new Jd());
6441
6446
  d(this, _a);
6442
6447
  d(this, pi);
6443
- d(this, xn, 0);
6448
+ d(this, Mn, 0);
6444
6449
  r(this, "trackObject");
6445
6450
  r(this, "namespace");
6446
- m(this, pi, e), m(this, _a, t), this.trackObject = i, this.namespace = n, m(this, xn, o);
6451
+ m(this, pi, e), m(this, _a, t), this.trackObject = i, this.namespace = n, m(this, Mn, o);
6447
6452
  }
6448
6453
  static subscribe(e, t, i) {
6449
6454
  return f(this, null, function* () {
6450
- if (!yA(t))
6455
+ if (!SA(t))
6451
6456
  throw new Error("track object language is required");
6452
6457
  const n = new Xt().name(t.name).build(), o = yield Ii.subscribe(e, n), c = o.objects();
6453
6458
  return new pu(o, c, t, e.namespace(), i);
@@ -6470,7 +6475,7 @@ const pu = class pu {
6470
6475
  return e;
6471
6476
  if (e.value.objectStatus !== Ee.Normal)
6472
6477
  continue;
6473
- const t = new TextDecoder().decode(e.value.payload), i = a(this, mc).parse(t).map((o) => (o.startTime -= a(this, xn) / 1e3, o.endTime -= a(this, xn) / 1e3, o));
6478
+ const t = new TextDecoder().decode(e.value.payload), i = a(this, mc).parse(t).map((o) => (o.startTime -= a(this, Mn) / 1e3, o.endTime -= a(this, Mn) / 1e3, o));
6474
6479
  return {
6475
6480
  done: !1,
6476
6481
  value: { language: this.trackObject.language, cues: i }
@@ -6493,7 +6498,7 @@ const pu = class pu {
6493
6498
  return this.unsubscribe();
6494
6499
  }
6495
6500
  };
6496
- mc = new WeakMap(), _a = new WeakMap(), pi = new WeakMap(), xn = new WeakMap();
6501
+ mc = new WeakMap(), _a = new WeakMap(), pi = new WeakMap(), Mn = new WeakMap();
6497
6502
  let Ph = pu;
6498
6503
  var wd, cs, hs, us, gi, ch, Ln, lo;
6499
6504
  wd = [Pe({ context: "Channel", enter: "info" })];
@@ -6568,12 +6573,12 @@ ch = Ci(null), cs = new WeakMap(), hs = new WeakMap(), us = new WeakMap(), gi =
6568
6573
  });
6569
6574
  }, ye(ch, 9, "start", wd, Ws), Zt(ch, Ws), Ri(ch, 3, Ws);
6570
6575
  let Vo = Ws;
6571
- const SA = M(8);
6572
- function vA(s) {
6576
+ const vA = x(8);
6577
+ function TA(s) {
6573
6578
  if (s < 0 || s > 65535)
6574
6579
  throw new RangeError("burstMs must be between 0 and 65535 inclusive");
6575
6580
  const e = new Uint8Array([s >> 8 & 255, s & 255]);
6576
- return { type: SA, payload: e };
6581
+ return { type: vA, payload: e };
6577
6582
  }
6578
6583
  var ds, Na, fc, Vl;
6579
6584
  const gu = class gu {
@@ -6625,27 +6630,27 @@ ds = new WeakMap(), Na = new WeakMap(), fc = new WeakSet(), Vl = function(e) {
6625
6630
  }
6626
6631
  });
6627
6632
  };
6628
- let Mh = gu;
6633
+ let xh = gu;
6629
6634
  function io(s) {
6630
6635
  return typeof s == "string" || s === null || s === void 0;
6631
6636
  }
6632
- function TA(s) {
6637
+ function EA(s) {
6633
6638
  return "provider" in s && typeof s.provider == "string" && (!("widevineLicenseUrl" in s) || io(s.widevineLicenseUrl)) && (!("playreadyLicenseUrl" in s) || io(s.playreadyLicenseUrl)) && (!("fairplayLicenseUrl" in s) || io(s.fairplayLicenseUrl)) && (!("fairplayCertificate" in s) || io(s.fairplayCertificate));
6634
6639
  }
6635
- function EA(s) {
6640
+ function kA(s) {
6636
6641
  try {
6637
6642
  return kd(s);
6638
6643
  } catch (e) {
6639
6644
  throw new Error("Failed to convert fairplayCertificate");
6640
6645
  }
6641
6646
  }
6642
- function kA(s) {
6647
+ function IA(s) {
6643
6648
  const e = new TextDecoder().decode(s), t = JSON.parse(e);
6644
- if (!TA(t))
6649
+ if (!EA(t))
6645
6650
  throw new Error("Invalid drm object");
6646
6651
  const o = t, { fairplayCertificate: i } = o, n = vu(o, ["fairplayCertificate"]);
6647
6652
  return O(S({}, n), {
6648
- fairplayCertificate: i ? EA(i) : void 0
6653
+ fairplayCertificate: i ? kA(i) : void 0
6649
6654
  });
6650
6655
  }
6651
6656
  class cu {
@@ -6662,7 +6667,7 @@ class cu {
6662
6667
  const c = yield o.next();
6663
6668
  if (c.done)
6664
6669
  throw new Error("No drm object received");
6665
- const h = kA(c.value.payload);
6670
+ const h = IA(c.value.payload);
6666
6671
  return new cu(O(S({}, h), { videoCodec: t, audioCodec: i }));
6667
6672
  } catch (l) {
6668
6673
  var p = l, g = !0;
@@ -6673,16 +6678,16 @@ class cu {
6673
6678
  });
6674
6679
  }
6675
6680
  }
6676
- function IA(s) {
6681
+ function CA(s) {
6677
6682
  return "rtt" in s && typeof s.rtt == "number" && "ntpTimestamp" in s && typeof s.ntpTimestamp == "number" && "estimatedBandwidth" in s && typeof s.estimatedBandwidth == "number";
6678
6683
  }
6679
6684
  function Qu(s) {
6680
6685
  const e = new TextDecoder().decode(s), t = JSON.parse(e);
6681
- if (!IA(t))
6686
+ if (!CA(t))
6682
6687
  throw new Error("Invalid stats object");
6683
6688
  return t;
6684
6689
  }
6685
- const CA = 1e4;
6690
+ const RA = 1e4;
6686
6691
  var Va, pc, Gl;
6687
6692
  const Au = class Au {
6688
6693
  constructor(e, t, i) {
@@ -6700,7 +6705,7 @@ const Au = class Au {
6700
6705
  for (; ; ) {
6701
6706
  const [e, t] = this.value.value();
6702
6707
  try {
6703
- yield Promise.race([ru(CA, new Error("Idle timeout")), t]);
6708
+ yield Promise.race([ru(RA, new Error("Idle timeout")), t]);
6704
6709
  } catch (i) {
6705
6710
  return i;
6706
6711
  }
@@ -6741,9 +6746,9 @@ Va = new WeakMap(), pc = new WeakSet(), Gl = function(e) {
6741
6746
  }
6742
6747
  });
6743
6748
  };
6744
- let xh = Au;
6749
+ let Mh = Au;
6745
6750
  var gc, Dn;
6746
- class RA {
6751
+ class BA {
6747
6752
  constructor(e) {
6748
6753
  d(this, gc, ge.get().createContext("UpstreamWatcher"));
6749
6754
  d(this, Dn);
@@ -6828,7 +6833,7 @@ const zs = class zs {
6828
6833
  r(this, "subtitles", new th(a(this, Ai), "subtitles"));
6829
6834
  r(this, "video", new th(a(this, ot), "video"));
6830
6835
  r(this, "audio", new th(a(this, at), "audio"));
6831
- m(this, Fn, e), m(this, _n, Mh.start(i)), m(this, ls, i), m(this, fe, new ke(t)), m(this, Nn, new RA(t)), m(this, Wa, Promise.race([i.idleTimeout(), A(this, Ie, jl).call(this), a(this, Nn).closed()])), a(this, Fn).closed().then(() => this.close()).catch(D);
6836
+ m(this, Fn, e), m(this, _n, xh.start(i)), m(this, ls, i), m(this, fe, new ke(t)), m(this, Nn, new BA(t)), m(this, Wa, Promise.race([i.idleTimeout(), A(this, Ie, jl).call(this), a(this, Nn).closed()])), a(this, Fn).closed().then(() => this.close()).catch(D);
6832
6837
  }
6833
6838
  closed() {
6834
6839
  return a(this, Wa);
@@ -6837,16 +6842,16 @@ const zs = class zs {
6837
6842
  return f(this, null, function* () {
6838
6843
  const i = /* @__PURE__ */ new Map();
6839
6844
  if (t.burstMs !== void 0) {
6840
- const p = vA(t.burstMs);
6845
+ const p = TA(t.burstMs);
6841
6846
  i.set(p.type, p);
6842
6847
  }
6843
- const n = new Ol(e, { namespace: mA("auxiliary") }), [[o, c, h], u] = yield Promise.all([
6848
+ const n = new Ol(e, { namespace: fA("auxiliary") }), [[o, c, h], u] = yield Promise.all([
6844
6849
  Vo.start(e, t).then((p) => Promise.all([
6845
6850
  Promise.resolve(p),
6846
6851
  t.videoTrack ? p.subscribeCmafTrack(t.videoTrack, { params: i }) : void 0,
6847
6852
  t.audioTrack ? p.subscribeCmafTrack(t.audioTrack, { params: i }) : void 0
6848
6853
  ])),
6849
- xh.start(n)
6854
+ Mh.start(n)
6850
6855
  ]), l = new zs(e, o, u);
6851
6856
  return h && a(l, at).update(h), c && a(l, ot).update(c), l;
6852
6857
  });
@@ -6905,7 +6910,7 @@ const zs = class zs {
6905
6910
  a(this, Nn).update(i), yield a(this, fe).current().close();
6906
6911
  const u = h.toReversed().find((I) => I.wallclock <= n), l = u != null && u.mediaPts ? u.mediaPts - o.timestampOffsetMs() : void 0, w = i.timestampWallclockOffset() - c + o.timestampOffsetMs();
6907
6912
  i.setTimestampOffsetMs(w);
6908
- const b = u != null && u.groupId ? M(u.groupId) : void 0;
6913
+ const b = u != null && u.groupId ? x(u.groupId) : void 0;
6909
6914
  l && ((v = a(this, ot).current()) == null || v.stopAfterTimestampReached(l), (k = a(this, at).current()) == null || k.stopAfterTimestampReached(l)), a(this, fe).update(i), yield Promise.all([
6910
6915
  e.videoTrack ? this.setVideoTrack(e.videoTrack, b) : void 0,
6911
6916
  e.audioTrack ? this.setAudioTrack(e.audioTrack, b) : void 0
@@ -6946,7 +6951,7 @@ sr = Ci(null), Fn = new WeakMap(), _n = new WeakMap(), ls = new WeakMap(), fe =
6946
6951
  return f(this, null, function* () {
6947
6952
  const o = i == null ? void 0 : i.largestGroupId(), [c, h] = yield Promise.all([
6948
6953
  e.subscribeCmafTrack(t, {
6949
- startGroup: n || (o ? o + M(1) : void 0)
6954
+ startGroup: n || (o ? o + x(1) : void 0)
6950
6955
  }),
6951
6956
  o ? i == null ? void 0 : i.update(o, o) : i == null ? void 0 : i.unsubscribe()
6952
6957
  ]);
@@ -7007,7 +7012,7 @@ function ih(s, e, t) {
7007
7012
  const i = new URL("/voq/subscribe", s);
7008
7013
  return i.searchParams.set("sessionId", e.sessionId), i.searchParams.set("clientId", e.clientId), i.searchParams.set("channelId", e.channelId), t && i.searchParams.set("authToken", t), i;
7009
7014
  }
7010
- const BA = 1e4;
7015
+ const UA = 1e4;
7011
7016
  var me, ve, Oe, ms, K, wi, za, Vn, Ha, Gn, Ce, Wl, jn, Qa, Wn, zl, Hl, Ql, Xl, Fh;
7012
7017
  const wu = class wu {
7013
7018
  constructor(e, t, i, n, o, c, h) {
@@ -7094,7 +7099,7 @@ const wu = class wu {
7094
7099
  typeof n.edgeUrl === "string" ? l = ih(n.edgeUrl, h, u) : (l = ih(n.edgeUrl.moqUrl || n.edgeUrl.moqWsUrl, h, u), p = ih(n.edgeUrl.moqWsUrl, h, u));
7095
7100
  const g = (E = n.connectInfo.channels.find((Q) => Q.channelId === h.channelId)) == null ? void 0 : E.catalog;
7096
7101
  t.debug("Resolved edge url", { edgeUrl: l, edgeWsUrl: p }), qe(g, "no catalog found");
7097
- const w = (U = c.get(Bi(g.namespace))) == null ? void 0 : U.getVideoTrack(h.video), b = (B = c.get(Bi(g.namespace))) == null ? void 0 : B.getAudioTrack(h.audio), v = yield lA({
7102
+ const w = (U = c.get(Bi(g.namespace))) == null ? void 0 : U.getVideoTrack(h.video), b = (B = c.get(Bi(g.namespace))) == null ? void 0 : B.getAudioTrack(h.audio), v = yield mA({
7098
7103
  url: l,
7099
7104
  wsUrl: p,
7100
7105
  authToken: n.options.get("authenticationToken"),
@@ -7109,7 +7114,7 @@ const wu = class wu {
7109
7114
  audioTrack: b == null ? void 0 : b.track,
7110
7115
  burstMs: h.burstMs || 0
7111
7116
  }),
7112
- ru(BA, new Error("Timeout waiting for player to start")),
7117
+ ru(UA, new Error("Timeout waiting for player to start")),
7113
7118
  Dm(v.closed(), "Session closed before player started")
7114
7119
  ]), I = new sh(k.catalog());
7115
7120
  c.set(Bi(g.namespace), I), e.emit("received signal", {
@@ -7276,7 +7281,7 @@ me = new WeakMap(), ve = new WeakMap(), Oe = new WeakMap(), ms = new WeakMap(),
7276
7281
  codec: U,
7277
7282
  switchInfo: ut,
7278
7283
  // FIXME: We should replace this with something better than hashing the track name
7279
- renditionId: UA(I.track.trackObject.name)
7284
+ renditionId: PA(I.track.trackObject.name)
7280
7285
  });
7281
7286
  }
7282
7287
  } catch (p) {
@@ -7303,7 +7308,7 @@ me = new WeakMap(), ve = new WeakMap(), Oe = new WeakMap(), ms = new WeakMap(),
7303
7308
  });
7304
7309
  };
7305
7310
  let Oh = wu;
7306
- function UA(s) {
7311
+ function PA(s) {
7307
7312
  return s.split("").reduce(
7308
7313
  (t, i) => t = i.charCodeAt(0) + (t << 6) + (t << 16) - t,
7309
7314
  0
@@ -7349,7 +7354,7 @@ Ht = new WeakMap(), fs = new WeakMap(), Ac = new WeakSet(), ql = function() {
7349
7354
  const [e, t] = a(this, Ht).value();
7350
7355
  return fm(e);
7351
7356
  };
7352
- const PA = (s, e) => {
7357
+ const xA = (s, e) => {
7353
7358
  const t = new URL("/subscribe", s);
7354
7359
  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();
7355
7360
  };
@@ -7402,7 +7407,7 @@ class MA extends Ei {
7402
7407
  this.websockets.length !== 0 && this.options.onMessage(t, i.data);
7403
7408
  });
7404
7409
  r(this, "onError", () => {
7405
- this.logger.info("On error", S({}, this.options)), this.close("one websocket had an error"), this.emit("error", new x("WebSocket error", { code: "websocket_error", isFatal: !1 }));
7410
+ this.logger.info("On error", S({}, this.options)), this.close("one websocket had an error"), this.emit("error", new M("WebSocket error", { code: "websocket_error", isFatal: !1 }));
7406
7411
  });
7407
7412
  r(this, "onClose", (t) => {
7408
7413
  switch (this.logger.info("Closed", O(S({}, this.options), {
@@ -7420,7 +7425,7 @@ class MA extends Ei {
7420
7425
  this.emit("error", af(tr()));
7421
7426
  break;
7422
7427
  case 4003:
7423
- this.emit("error", Md("internal", tr()));
7428
+ this.emit("error", xd("internal", tr()));
7424
7429
  break;
7425
7430
  case 4010:
7426
7431
  this.emit("error", of("internal", tr()));
@@ -7444,7 +7449,7 @@ class MA extends Ei {
7444
7449
  this.logger.info("Waiting for reconnect delay", S({}, this.options)), yield ki(this.options.reconnectDelay);
7445
7450
  const i = yield this.options.reconnectHandler(this.reconnectState);
7446
7451
  if (this.reconnectState.reconnectRetries++, !i)
7447
- return this._isConnectInProgress = !1, this.emit("error", xd()), !1;
7452
+ return this._isConnectInProgress = !1, this.emit("error", Md()), !1;
7448
7453
  }
7449
7454
  this._connectionAttemptCount++;
7450
7455
  try {
@@ -7460,9 +7465,9 @@ class MA extends Ei {
7460
7465
  }
7461
7466
  return !0;
7462
7467
  } catch (i) {
7463
- return this._isConnectInProgress = !1, i instanceof x && (this.logger.error("Failed to connect", i.toStringifiable()), i.isFatal()) || this.shouldContinueConnecting && (this.logger.info("Connection aborted", { error: i }), this.emit(
7468
+ return this._isConnectInProgress = !1, i instanceof M && (this.logger.error("Failed to connect", i.toStringifiable()), i.isFatal()) || this.shouldContinueConnecting && (this.logger.info("Connection aborted", { error: i }), this.emit(
7464
7469
  "error",
7465
- new x("Failed to connect", {
7470
+ new M("Failed to connect", {
7466
7471
  code: "failed_to_connect",
7467
7472
  isFatal: !1,
7468
7473
  source: i,
@@ -7486,9 +7491,9 @@ class MA extends Ei {
7486
7491
  return this._connectTime;
7487
7492
  }
7488
7493
  }
7489
- const xA = 65536 * 8, LA = 0.9, DA = 40, OA = (s) => {
7490
- const e = s || DA;
7491
- return xA * LA * 1e3 / e;
7494
+ const LA = 65536 * 8, DA = 0.9, OA = 40, FA = (s) => {
7495
+ const e = s || OA;
7496
+ return LA * DA * 1e3 / e;
7492
7497
  }, mt = class mt {
7493
7498
  constructor(e, t, i, n) {
7494
7499
  r(this, "emitter");
@@ -7564,7 +7569,7 @@ const xA = 65536 * 8, LA = 0.9, DA = 40, OA = (s) => {
7564
7569
  ), n = this.config.options.get("media") === "audio+video";
7565
7570
  let o = 1;
7566
7571
  n && (o = i !== !1 ? 2 : 1);
7567
- const c = PA(this.config.edgeUrl, {
7572
+ const c = xA(this.config.edgeUrl, {
7568
7573
  video: t.video,
7569
7574
  audio: t.audio,
7570
7575
  burstMs: t.burstMs,
@@ -7651,7 +7656,7 @@ r(mt, "PING_INTERVAL", 5e3), r(mt, "MAX_MISSED_PINGS", 4), r(mt, "TLS_ROUNDTRIPS
7651
7656
  }));
7652
7657
  let _h = mt;
7653
7658
  var zn, bi, Hn;
7654
- class FA {
7659
+ class _A {
7655
7660
  constructor(e) {
7656
7661
  d(this, zn);
7657
7662
  d(this, bi, []);
@@ -7782,7 +7787,7 @@ const Hs = class Hs {
7782
7787
  return a(this, Et).items().length > 0 ? ct(a(this, Et).items()) : 0;
7783
7788
  }
7784
7789
  get estimatedBandwidth() {
7785
- return this.connectionImpl && "estimatedBandwidth" in this.connectionImpl && this.connectionImpl.estimatedBandwidth ? this.connectionImpl.estimatedBandwidth : OA(this.rtt);
7790
+ return this.connectionImpl && "estimatedBandwidth" in this.connectionImpl && this.connectionImpl.estimatedBandwidth ? this.connectionImpl.estimatedBandwidth : FA(this.rtt);
7786
7791
  }
7787
7792
  /**
7788
7793
  * The timestamp when the first connection was made
@@ -7800,7 +7805,7 @@ const Hs = class Hs {
7800
7805
  Et = new WeakMap(), kt = new WeakMap(), Qn = new WeakMap(), ps = new WeakMap(), yi = new WeakMap(), gs = new WeakMap(), Xn = new WeakMap(), qn = new WeakMap(), wc = new WeakMap(), bc = new WeakMap(), yc = new WeakSet(), Zl = function() {
7801
7806
  return f(this, null, function* () {
7802
7807
  var t;
7803
- const e = new FA({ edgeUrl: this.config.options.get("edgeUrl") });
7808
+ const e = new _A({ edgeUrl: this.config.options.get("edgeUrl") });
7804
7809
  for (m(this, ps, 0); ; ) {
7805
7810
  Ge(this, ps)._++, Ge(this, yi)._++;
7806
7811
  try {
@@ -7809,7 +7814,7 @@ Et = new WeakMap(), kt = new WeakMap(), Qn = new WeakMap(), ps = new WeakMap(),
7809
7814
  break;
7810
7815
  const h = e.select(n.edges);
7811
7816
  if (!h)
7812
- throw new x("Failed to resolve edge url", { isFatal: !0, code: "failed_to_resolve_edge_url" });
7817
+ throw new M("Failed to resolve edge url", { isFatal: !0, code: "failed_to_resolve_edge_url" });
7813
7818
  Td(n) ? this.connectionImpl = yield Oh.start(
7814
7819
  this.emitter,
7815
7820
  this.logger,
@@ -7834,14 +7839,14 @@ Et = new WeakMap(), kt = new WeakMap(), Qn = new WeakMap(), ps = new WeakMap(),
7834
7839
  o && this.emitter.emit("telemetry event", {
7835
7840
  code: "shifted_edge",
7836
7841
  edgeUrl: typeof o == "string" ? o : o.moqUrl || o.moqWsUrl
7837
- }), n instanceof x ? this.emitter.emit("error", n) : n instanceof Error && this.emitter.emit("error", new x(n.message, { code: "start_failed", isFatal: !1 }));
7842
+ }), n instanceof M ? this.emitter.emit("error", n) : n instanceof Error && this.emitter.emit("error", new M(n.message, { code: "start_failed", isFatal: !1 }));
7838
7843
  }
7839
7844
  if ((t = this.connectionImpl) == null || t.unload(), this.connectionImpl = void 0, !a(this, kt))
7840
7845
  break;
7841
7846
  if (!(yield this.config.reconnectHandler({
7842
7847
  reconnectRetries: a(this, ps)
7843
7848
  }))) {
7844
- this.emitter.emit("error", xd());
7849
+ this.emitter.emit("error", Md());
7845
7850
  break;
7846
7851
  }
7847
7852
  if (yield ki(1e3), !a(this, kt))
@@ -7858,7 +7863,7 @@ const nh = () => ({
7858
7863
  audio: {
7859
7864
  bitRate: Ti()
7860
7865
  }
7861
- }), _A = () => ({
7866
+ }), NA = () => ({
7862
7867
  width: window.innerWidth,
7863
7868
  height: window.innerHeight,
7864
7869
  bitRate: Ti()
@@ -7916,7 +7921,7 @@ const nh = () => ({
7916
7921
  });
7917
7922
  r(this, "evaluateConstraintCap", () => {
7918
7923
  var c, h, u, l, p;
7919
- const e = this.sizeBasedResolutionCapEnabled ? O(S({}, nh()), { video: _A() }) : nh();
7924
+ const e = this.sizeBasedResolutionCapEnabled ? O(S({}, nh()), { video: NA() }) : nh();
7920
7925
  if (!this.resizeObserver) {
7921
7926
  const g = this.element.getBoundingClientRect();
7922
7927
  this.elementSize = { width: g.width, height: g.height };
@@ -7954,7 +7959,7 @@ const nh = () => ({
7954
7959
  };
7955
7960
  r(Qs, "CHECK_SIZE_INTERVAL", 1e3), r(Qs, "create", (e, t, i, n) => new Qs(e, t, i, n));
7956
7961
  let Vh = Qs;
7957
- const NA = 5, VA = 100, GA = 1e3;
7962
+ const VA = 5, GA = 100, jA = 1e3;
7958
7963
  class hu {
7959
7964
  constructor(e, t, i, n) {
7960
7965
  r(this, "timers", Ae.create());
@@ -7964,7 +7969,7 @@ class hu {
7964
7969
  r(this, "playbackSource");
7965
7970
  r(this, "isSuspended", !1);
7966
7971
  r(this, "load", () => {
7967
- this.timers.setInterval(this.emitDecodedFrames, VA), this.timers.setInterval(this.emitDecodeRate, GA), this.emitter.on("init segment", this.onInitSegment), this.emitter.on("coded sample", this.decode);
7972
+ this.timers.setInterval(this.emitDecodedFrames, GA), this.timers.setInterval(this.emitDecodeRate, jA), this.emitter.on("init segment", this.onInitSegment), this.emitter.on("coded sample", this.decode);
7968
7973
  });
7969
7974
  r(this, "unload", () => {
7970
7975
  this.trackContexts.forEach(({ decoderContext: e }) => e.unload()), this.timers.unload(), this.emitter.off("init segment", this.onInitSegment), this.emitter.off("coded sample", this.decode);
@@ -7998,7 +8003,7 @@ class hu {
7998
8003
  var i;
7999
8004
  const t = (i = this.trackContexts.get(e.type)) == null ? void 0 : i.decoderContext;
8000
8005
  if (!t)
8001
- throw new x("No known decoder context", {
8006
+ throw new M("No known decoder context", {
8002
8007
  code: "no_known_decoder_context",
8003
8008
  isFatal: !1
8004
8009
  });
@@ -8007,7 +8012,7 @@ class hu {
8007
8012
  r(this, "decode", (e) => {
8008
8013
  const t = this.trackContexts.get(e.type);
8009
8014
  if (!t)
8010
- throw new x("No known decoder context", {
8015
+ throw new M("No known decoder context", {
8011
8016
  code: "no_known_decoder_context",
8012
8017
  isFatal: !1
8013
8018
  });
@@ -8015,7 +8020,7 @@ class hu {
8015
8020
  return;
8016
8021
  t.sampleDuration = e.duration / e.timescale * 1e3;
8017
8022
  const i = e.compositionTimeOffset || 0, { decoderContext: n, buffer: o } = t, c = (e.timestamp + i) / e.timescale * 1e3, h = e.duration / e.timescale * 1e3, u = o[o.length - 1];
8018
- !u || c - NA > u.end ? o.push({ start: c, end: c + h }) : c + h * 5 < u.end ? t.buffer = [{ start: c, end: c + h }] : u.end = c + h, n.enqueue(e), this.emitDecodedFrames();
8023
+ !u || c - VA > u.end ? o.push({ start: c, end: c + h }) : c + h * 5 < u.end ? t.buffer = [{ start: c, end: c + h }] : u.end = c + h, n.enqueue(e), this.emitDecodedFrames();
8019
8024
  });
8020
8025
  r(this, "emitDecodedFrames", () => {
8021
8026
  let e;
@@ -8036,19 +8041,25 @@ class hu {
8036
8041
  this.emitter.emit("video decode rate", this.videoDecodeRate());
8037
8042
  });
8038
8043
  r(this, "updateBufferState", () => {
8039
- var o, c;
8040
8044
  let e;
8041
- if (this.trackContexts.forEach((h) => {
8042
- var u, l, p, g;
8045
+ if (this.trackContexts.forEach((o) => {
8046
+ var c, h, u, l;
8043
8047
  if (!e)
8044
- e = h.buffer;
8048
+ e = o.buffer;
8045
8049
  else {
8046
- const w = (l = (u = h.buffer[h.buffer.length - 1]) == null ? void 0 : u.end) != null ? l : 0;
8047
- ((g = (p = e[e.length - 1]) == null ? void 0 : p.end) != null ? g : 0) > w && (e = h.buffer);
8050
+ const p = (h = (c = o.buffer[o.buffer.length - 1]) == null ? void 0 : c.end) != null ? h : 0;
8051
+ ((l = (u = e[e.length - 1]) == null ? void 0 : u.end) != null ? l : 0) > p && (e = o.buffer);
8048
8052
  }
8049
8053
  }), !e)
8050
8054
  return;
8051
- const t = this.playbackSource.currentTime, i = (c = (o = e[e.length - 1]) == null ? void 0 : o.end) != null ? c : 0, n = t < i ? "playing" : "buffering";
8055
+ const t = this.playbackSource.currentTime;
8056
+ let i = !0;
8057
+ this.trackContexts.forEach((o) => {
8058
+ o.buffer.some(
8059
+ (h) => h.start <= t && t < h.end
8060
+ ) || (i = !1);
8061
+ });
8062
+ const n = i ? "playing" : "buffering";
8052
8063
  this.emitter.emit("buffer state", {
8053
8064
  buffered: e,
8054
8065
  currentTime: this.playbackSource.currentTime,
@@ -8064,7 +8075,7 @@ class hu {
8064
8075
  for (const h of i)
8065
8076
  switch (h.type) {
8066
8077
  case "audio": {
8067
- const { OpusDecoderContext: u } = yield import("./Bfrv5P6J.js");
8078
+ const { OpusDecoderContext: u } = yield import("./P1jYqh_I.js");
8068
8079
  c.set(h.type, {
8069
8080
  buffer: [],
8070
8081
  decoderContext: yield u.create(48e3, 2),
@@ -8075,7 +8086,7 @@ class hu {
8075
8086
  break;
8076
8087
  }
8077
8088
  case "video": {
8078
- const { H264DecoderWorkerContext: u } = yield import("./C7zQi7LX.js");
8089
+ const { H264DecoderWorkerContext: u } = yield import("./D7TmsvJG.js");
8079
8090
  c.set(h.type, {
8080
8091
  buffer: [],
8081
8092
  decoderContext: yield u.create(o),
@@ -8142,12 +8153,12 @@ const Sc = class Sc {
8142
8153
  };
8143
8154
  r(Sc, "create", (e) => new Sc(e));
8144
8155
  let Gh = Sc;
8145
- const jA = (s) => (e, t, i) => e.timestamp <= t || e.timestampAdded <= i - s, Kt = class Kt {
8156
+ const WA = (s) => (e, t, i) => e.timestamp <= t || e.timestampAdded <= i - s, Kt = class Kt {
8146
8157
  constructor(e, t, i) {
8147
8158
  r(this, "logger");
8148
8159
  r(this, "emitter");
8149
8160
  r(this, "waitingEvents", []);
8150
- r(this, "isTriggered", jA(Kt.EVENT_TIMEOUT));
8161
+ r(this, "isTriggered", WA(Kt.EVENT_TIMEOUT));
8151
8162
  r(this, "timeSource");
8152
8163
  r(this, "timers", new Ae());
8153
8164
  r(this, "load", () => {
@@ -8347,11 +8358,11 @@ class uu {
8347
8358
  };
8348
8359
  }
8349
8360
  }
8350
- const WA = () => window.AudioContext || window.webkitAudioContext, vc = class vc extends Ei {
8361
+ const zA = () => window.AudioContext || window.webkitAudioContext, vc = class vc extends Ei {
8351
8362
  constructor() {
8352
8363
  super();
8353
8364
  // TODO: Checkout what happens when limit is reached
8354
- r(this, "context", new (WA())());
8365
+ r(this, "context", new (zA())());
8355
8366
  r(this, "timers", Ae.create());
8356
8367
  r(this, "previousCurrentTime", 0);
8357
8368
  r(this, "_isStuck", !1);
@@ -8441,7 +8452,7 @@ const Tc = class Tc extends Ei {
8441
8452
  });
8442
8453
  r(this, "flush", () => {
8443
8454
  if (!this.audio || !this.gainNode)
8444
- throw new x("AudioContext must be initialized to flush", {
8455
+ throw new M("AudioContext must be initialized to flush", {
8445
8456
  isFatal: !1,
8446
8457
  code: "audiocontext_must_be_initialized"
8447
8458
  });
@@ -8571,7 +8582,7 @@ const Tc = class Tc extends Ei {
8571
8582
  r(Tc, "create", (t, i, n) => new Tc(t, i, n));
8572
8583
  let Go = Tc;
8573
8584
  var Xa, It, pe, As, Ze, Jl, Ds, $l;
8574
- class zA {
8585
+ class HA {
8575
8586
  constructor() {
8576
8587
  d(this, Ze);
8577
8588
  d(this, Xa, []);
@@ -8636,7 +8647,7 @@ Xa = new WeakMap(), It = new WeakMap(), pe = new WeakMap(), As = new WeakMap(),
8636
8647
  }
8637
8648
  return i;
8638
8649
  };
8639
- const HA = `
8650
+ const QA = `
8640
8651
  precision mediump float;
8641
8652
  uniform sampler2D texture;
8642
8653
 
@@ -8648,7 +8659,7 @@ void main() {
8648
8659
 
8649
8660
  gl_FragColor = vec4(y, y, y, a);
8650
8661
  }
8651
- `, QA = `
8662
+ `, XA = `
8652
8663
  attribute vec2 position;
8653
8664
  varying vec2 texture_coordinate;
8654
8665
  uniform mat4 model;
@@ -8660,7 +8671,7 @@ void main() {
8660
8671
  `, Zu = (s, e) => {
8661
8672
  let t = s.getContext("webgl", e);
8662
8673
  if (t || (t = s.getContext("experimental-webgl", e)), !t)
8663
- throw new x("Failed to create webgl context", {
8674
+ throw new M("Failed to create webgl context", {
8664
8675
  isFatal: !0,
8665
8676
  code: "failed_to_create_web_gl_context"
8666
8677
  });
@@ -8668,10 +8679,10 @@ void main() {
8668
8679
  }, Os = (s, e, t) => {
8669
8680
  const i = s.createShader(e);
8670
8681
  if (!i)
8671
- throw new x("Failed to create shader", { isFatal: !0, code: "failed_to_create_shader" });
8682
+ throw new M("Failed to create shader", { isFatal: !0, code: "failed_to_create_shader" });
8672
8683
  if (s.shaderSource(i, t), s.compileShader(i), !s.getShaderParameter(i, s.COMPILE_STATUS)) {
8673
8684
  const n = s.getShaderInfoLog(i);
8674
- throw new x(`Failed to compile shader: ${n != null ? n : ""}`, {
8685
+ throw new M(`Failed to compile shader: ${n != null ? n : ""}`, {
8675
8686
  isFatal: !0,
8676
8687
  code: "failed_to_compile_shader"
8677
8688
  });
@@ -8680,7 +8691,7 @@ void main() {
8680
8691
  }, Di = (s) => {
8681
8692
  const e = s.createTexture();
8682
8693
  if (!e)
8683
- throw new x("Failed to create texture", {
8694
+ throw new M("Failed to create texture", {
8684
8695
  isFatal: !0,
8685
8696
  code: "failed_to_create_texture"
8686
8697
  });
@@ -8688,7 +8699,7 @@ void main() {
8688
8699
  }, Ju = (s, e) => {
8689
8700
  const t = s.createBuffer();
8690
8701
  if (!t)
8691
- throw new x("Failed to create buffer", {
8702
+ throw new M("Failed to create buffer", {
8692
8703
  isFatal: !0,
8693
8704
  code: "failed_to_create_buffer"
8694
8705
  });
@@ -8696,13 +8707,13 @@ void main() {
8696
8707
  }, Hh = (s, e, t) => {
8697
8708
  const i = s.createProgram();
8698
8709
  if (!i)
8699
- throw new x("Failed to create program", {
8710
+ throw new M("Failed to create program", {
8700
8711
  isFatal: !0,
8701
8712
  code: "failed_to_create_program"
8702
8713
  });
8703
8714
  if (s.attachShader(i, t), s.attachShader(i, e), s.linkProgram(i), !s.getProgramParameter(i, s.LINK_STATUS)) {
8704
8715
  const n = s.getShaderInfoLog(i);
8705
- throw new x(`Failed to link program: ${n != null ? n : ""}`, {
8716
+ throw new M(`Failed to link program: ${n != null ? n : ""}`, {
8706
8717
  isFatal: !0,
8707
8718
  code: "failed_to_link_program"
8708
8719
  });
@@ -8710,7 +8721,7 @@ void main() {
8710
8721
  return i;
8711
8722
  };
8712
8723
  var Ec, _, qa, Za, Ja, Si, $n, Yl, Kl, kc;
8713
- class XA {
8724
+ class qA {
8714
8725
  constructor(e) {
8715
8726
  d(this, $n);
8716
8727
  d(this, Ec, 96);
@@ -8719,7 +8730,7 @@ class XA {
8719
8730
  d(this, Za);
8720
8731
  d(this, Ja);
8721
8732
  d(this, Si);
8722
- r(this, "subtitleRenderer", new zA());
8733
+ r(this, "subtitleRenderer", new HA());
8723
8734
  // biome-ignore format: special formatting
8724
8735
  d(this, kc, (e, t, i, n) => [
8725
8736
  e,
@@ -8739,7 +8750,7 @@ class XA {
8739
8750
  0,
8740
8751
  1
8741
8752
  ]);
8742
- m(this, _, e), m(this, qa, Di(e)), m(this, Za, Os(e, e.FRAGMENT_SHADER, HA)), m(this, Ja, Os(e, e.VERTEX_SHADER, QA)), m(this, Si, Hh(e, a(this, Ja), a(this, Za))), this.subtitleRenderer.config.fontSize = "64px";
8753
+ m(this, _, e), m(this, qa, Di(e)), m(this, Za, Os(e, e.FRAGMENT_SHADER, QA)), m(this, Ja, Os(e, e.VERTEX_SHADER, XA)), m(this, Si, Hh(e, a(this, Ja), a(this, Za))), this.subtitleRenderer.config.fontSize = "64px";
8743
8754
  }
8744
8755
  setActiveCues(e, t) {
8745
8756
  this.subtitleRenderer.setActiveCues(e), this.subtitleRenderer.render(t);
@@ -8851,7 +8862,7 @@ void main() {
8851
8862
  codedWidth: t.codedWidth,
8852
8863
  codedHeight: t.codedHeight
8853
8864
  }), this.setConversionMatrix(this.rec709()), this.setModelMatrix(this.size.width / this.size.codedWidth, this.size.height / this.size.codedHeight), this.context.activeTexture(this.context.TEXTURE0), this.updateTexture(this.textures.y, this.size.codedWidth, this.size.codedHeight, t.data[0]), this.context.activeTexture(this.context.TEXTURE1), this.updateTexture(this.textures.u, this.size.codedWidth / 2, this.size.codedHeight / 2, t.data[1]), this.context.activeTexture(this.context.TEXTURE2), this.updateTexture(this.textures.v, this.size.codedWidth / 2, this.size.codedHeight / 2, t.data[2]), this.context.drawArrays(this.context.TRIANGLE_STRIP, 0, 4), this.textRenderer) {
8854
- const n = i.style.getPropertyValue("--vindral-control-bar-offset"), o = parseInt(n || "0", 10), c = Number.isNaN(o) ? 0 : -o;
8865
+ const n = i.style.getPropertyValue("--vindral-subtitle-offset") || i.style.getPropertyValue("--vindral-control-bar-offset"), o = parseInt(n || "0", 10), c = Number.isNaN(o) ? 0 : -o;
8855
8866
  this.textRenderer.render({
8856
8867
  width: Math.max(i.clientWidth, 960) * window.devicePixelRatio,
8857
8868
  height: Math.max(i.clientHeight, 540) * window.devicePixelRatio,
@@ -8938,7 +8949,7 @@ void main() {
8938
8949
  this.canvas.addEventListener("webglcontextlost", this.onContextLost), this.canvas.addEventListener("webglcontextrestored", this.onContextRestored, !1), this.canvas.style.width = "100%", this.canvas.style.position = "relative";
8939
8950
  }
8940
8951
  getTextRenderer() {
8941
- return this.textRenderer || (this.textRenderer = new XA(this.context)), this.textRenderer;
8952
+ return this.textRenderer || (this.textRenderer = new qA(this.context)), this.textRenderer;
8942
8953
  }
8943
8954
  };
8944
8955
  r(Ur, "SQUARE_VERTICES", new Float32Array([0, 0, 0, 1, 1, 0, 1, 1]));
@@ -9054,7 +9065,7 @@ const Ui = (s, e) => {
9054
9065
  for (t = e; s > 1; s--) t += e;
9055
9066
  return t;
9056
9067
  };
9057
- class qA {
9068
+ class ZA {
9058
9069
  constructor() {
9059
9070
  r(this, "audio");
9060
9071
  r(this, "unmute", () => this.audio.play().catch(D));
@@ -9074,7 +9085,7 @@ const Cc = class Cc {
9074
9085
  r(this, "audioPlayer");
9075
9086
  r(this, "videoPlayer");
9076
9087
  r(this, "pool");
9077
- r(this, "unmuter", new qA());
9088
+ r(this, "unmuter", new ZA());
9078
9089
  r(this, "_isPaused", !1);
9079
9090
  r(this, "isDisconnected", !1);
9080
9091
  r(this, "timers", new Ae());
@@ -9334,8 +9345,8 @@ const Rc = class Rc {
9334
9345
  };
9335
9346
  r(Rc, "create", (e, t, i, n, o) => new Rc(e, t, i, n, o));
9336
9347
  let qh = Rc;
9337
- const ZA = () => (s) => tm(s.buffered.start(0), s.buffered.end(s.buffered.length - 1)), tm = (s, e) => (t) => t.remove(Math.max(0, s), Math.min(Number.POSITIVE_INFINITY, e)), td = (s) => (e) => e.appendBuffer(s), JA = (s) => (e) => e.changeType(s), $A = (s) => (e) => s(e);
9338
- class YA {
9348
+ const JA = () => (s) => tm(s.buffered.start(0), s.buffered.end(s.buffered.length - 1)), tm = (s, e) => (t) => t.remove(Math.max(0, s), Math.min(Number.POSITIVE_INFINITY, e)), td = (s) => (e) => e.appendBuffer(s), $A = (s) => (e) => e.changeType(s), YA = (s) => (e) => s(e);
9349
+ class KA {
9339
9350
  constructor(e) {
9340
9351
  r(this, "commandQueue", []);
9341
9352
  r(this, "sourceBuffer");
@@ -9353,7 +9364,7 @@ class YA {
9353
9364
  this.commandQueue.push(o), this.handleQueue();
9354
9365
  }));
9355
9366
  r(this, "execute", (e) => new Promise((t, i) => {
9356
- const n = new Rs($A(e), t, i);
9367
+ const n = new Rs(YA(e), t, i);
9357
9368
  this.commandQueue.push(n), this.handleQueue();
9358
9369
  }));
9359
9370
  r(this, "buffered", () => this.sourceBuffer.buffered);
@@ -9361,7 +9372,7 @@ class YA {
9361
9372
  e.removeSourceBuffer(this.sourceBuffer);
9362
9373
  });
9363
9374
  r(this, "changeType", (e) => new Promise((t, i) => {
9364
- const n = new Rs(JA(e), t, i);
9375
+ const n = new Rs($A(e), t, i);
9365
9376
  this.commandQueue.push(n), this.handleQueue();
9366
9377
  }));
9367
9378
  r(this, "removeBuffer", (e, t) => new Promise((i, n) => {
@@ -9369,7 +9380,7 @@ class YA {
9369
9380
  this.commandQueue.push(o), this.handleQueue();
9370
9381
  }));
9371
9382
  r(this, "flush", () => new Promise((e, t) => {
9372
- const i = new Rs(ZA, e, t);
9383
+ const i = new Rs(JA, e, t);
9373
9384
  this.commandQueue.push(i), this.handleQueue();
9374
9385
  }));
9375
9386
  this.sourceBuffer = e, this.sourceBuffer.addEventListener("updateend", this.handleQueue);
@@ -9407,7 +9418,7 @@ class im extends Ei {
9407
9418
  });
9408
9419
  r(this, "addSourceBuffer", (t) => {
9409
9420
  const i = this.mediaSource.addSourceBuffer(t);
9410
- return new YA(i);
9421
+ return new KA(i);
9411
9422
  });
9412
9423
  r(this, "removeSourceBuffer", (t) => {
9413
9424
  t.removeFromMediaSource(this.mediaSource);
@@ -9451,7 +9462,7 @@ class sm {
9451
9462
  });
9452
9463
  }
9453
9464
  }
9454
- function KA(s, { mediaSource: e, mimeType: t, codec: i }) {
9465
+ function ew(s, { mediaSource: e, mimeType: t, codec: i }) {
9455
9466
  return O(S({}, s), {
9456
9467
  state: "initialized",
9457
9468
  mimeType: t,
@@ -9552,7 +9563,7 @@ const Bc = class Bc {
9552
9563
  let n = this.trackContexts.get(i.type);
9553
9564
  n || (n = id({ pendingSamples: [], initSegments: new sm() }), this.trackContexts.set(i.type, n)), n.state === "initialized" ? i.mimeType !== n.mimeType && (yield n.sourceBuffer.changeType(i.mimeType)) : this.trackContexts.set(
9554
9565
  i.type,
9555
- KA(n, {
9566
+ ew(n, {
9556
9567
  mimeType: i.mimeType,
9557
9568
  mediaSource: this.mediaSource,
9558
9569
  codec: i.codec
@@ -9681,7 +9692,7 @@ const Bc = class Bc {
9681
9692
  const i = S({}, e);
9682
9693
  "fragment" in i ? (i.fragment = i.fragment.clone(), i.fragment.updateBaseMediaDecodeTime(0), i.data = i.fragment.rawBytes()) : i.timestamp = 0, t.pendingSamples.push(i);
9683
9694
  }
9684
- t.hasFirstSync = !0, t.pendingSamples.push(e), t.state !== "uninitialized" && (t.isWorkingOnPendingSamples || ew(t, this.append, this.maxChunkSize).catch((i) => {
9695
+ t.hasFirstSync = !0, t.pendingSamples.push(e), t.state !== "uninitialized" && (t.isWorkingOnPendingSamples || tw(t, this.append, this.maxChunkSize).catch((i) => {
9685
9696
  if (t.isWorkingOnPendingSamples = !1, i instanceof Error) {
9686
9697
  if (this.logger.error("append failed", { message: i.message, name: i.name }), i instanceof DOMException && i.code === DOMException.QUOTA_EXCEEDED_ERR) {
9687
9698
  if (t.consecutiveQuotaExceededErrorCount >= this.minConsecutiveErrorsBeforeEmit) {
@@ -9727,7 +9738,7 @@ const sd = (s, e) => {
9727
9738
  const t = s.renditionId !== e.renditionId, i = s.channelId !== e.channelId, n = ((h = s.timestamp) != null ? h : 0) > e.timestamp, o = s.type === "video" && e.type === "video" && "levelIdc" in s && "levelIdc" in e && s.levelIdc !== e.levelIdc;
9728
9739
  let c = !1;
9729
9740
  return s.type === "video" && e.type === "video" && "width" in s && "width" in e && (c = e.width !== s.width || e.height !== s.height), i || t || n || c || o;
9730
- }, ew = (s, e, t) => f(null, null, function* () {
9741
+ }, tw = (s, e, t) => f(null, null, function* () {
9731
9742
  for (s.isWorkingOnPendingSamples = !0; s.pendingSamples.length > 0; ) {
9732
9743
  const i = [];
9733
9744
  let n = 0;
@@ -9822,9 +9833,11 @@ const Pc = class Pc {
9822
9833
  needsInputForAudioCount: this.needsInputForAudioCount,
9823
9834
  needsInputForVideoCount: this.needsInputForVideoCount
9824
9835
  }));
9825
- r(this, "onBufferedStateChanged", ({ buffered: e, isPaused: t }) => {
9826
- const i = this.clockSource.currentTime, n = e.some((p) => p.start < i && i < p.end), o = e[e.length - 1], c = o ? o.end - o.start >= this.targetBufferTime : !1, h = o ? Math.max(0, o.end - i) / this.targetBufferTime : 0, u = t ? "paused" : n ? "playing" : "buffering", l = this.state;
9827
- this.currentTimeIsInRange !== n && !n ? (this.lastBufferStateEvent = "drained", this.emitter.emit("buffer state event", this.lastBufferStateEvent)) : n && c && this.lastBufferStateEvent === "drained" && (this.lastBufferStateEvent = "filled", this.emitter.emit("buffer state event", this.lastBufferStateEvent)), u === "playing" && !this.firstFrameTime && (this.firstFrameTime = Date.now()), this.currentTimeIsInRange = n, this.state = u, this.bufferFullness = n ? h : 0, l !== u && this.emitter.emit("playback state", u), this.emitter.emit("buffer fullness", this.bufferFullness);
9836
+ r(this, "onBufferedStateChanged", ({ buffered: e, isPaused: t, playbackState: i }) => {
9837
+ const n = this.clockSource.currentTime, o = e.some((g) => g.start <= n && n < g.end), c = e[e.length - 1], h = c ? c.end - c.start >= this.targetBufferTime : !1, u = c ? Math.max(0, c.end - n) / this.targetBufferTime : 0;
9838
+ let l = t ? "paused" : i;
9839
+ const p = this.state;
9840
+ this.currentTimeIsInRange !== o && !o ? (this.lastBufferStateEvent = "drained", this.emitter.emit("buffer state event", this.lastBufferStateEvent)) : o && h && this.lastBufferStateEvent === "drained" && (this.lastBufferStateEvent = "filled", this.emitter.emit("buffer state event", this.lastBufferStateEvent)), l === "playing" && !this.firstFrameTime && (this.firstFrameTime = Date.now()), this.currentTimeIsInRange = o, this.state = l, this.bufferFullness = o ? u : 0, p !== l && this.emitter.emit("playback state", l), this.emitter.emit("buffer fullness", this.bufferFullness);
9828
9841
  });
9829
9842
  r(this, "onNeedsUserInput", ({ forAudio: e, forVideo: t }) => {
9830
9843
  e && this.needsInputForAudioCount++, t && this.needsInputForVideoCount++;
@@ -9840,19 +9853,19 @@ const Yh = () => ({
9840
9853
  bufferingRanges: [],
9841
9854
  activeRanges: [],
9842
9855
  decodeRate: Number.MAX_SAFE_INTEGER
9843
- }), tw = () => ({
9856
+ }), iw = () => ({
9844
9857
  levels: {},
9845
9858
  levelDowngrades: [],
9846
9859
  levelUpgrades: [],
9847
9860
  bufferFullness: 0,
9848
9861
  general: Yh()
9849
- }), Mc = class Mc {
9862
+ }), xc = class xc {
9850
9863
  constructor(e, t, i) {
9851
9864
  r(this, "minBufferFullnessLengthForRegression", 6);
9852
9865
  r(this, "logger");
9853
9866
  r(this, "emitter");
9854
9867
  r(this, "timers", Ae.create());
9855
- r(this, "metrics", tw());
9868
+ r(this, "metrics", iw());
9856
9869
  r(this, "bufferFullness", new ee(30));
9857
9870
  r(this, "bufferFullnessRegression");
9858
9871
  r(this, "currentLevel");
@@ -10042,9 +10055,9 @@ const Yh = () => ({
10042
10055
  Bs(this.metrics.general.activeRanges);
10043
10056
  }
10044
10057
  };
10045
- r(Mc, "create", (e, t, i) => new Mc(e, t, i));
10046
- let Kh = Mc;
10047
- const xc = class xc {
10058
+ r(xc, "create", (e, t, i) => new xc(e, t, i));
10059
+ let Kh = xc;
10060
+ const Mc = class Mc {
10048
10061
  constructor(e, t) {
10049
10062
  r(this, "renditions", /* @__PURE__ */ new Map());
10050
10063
  r(this, "renditionLevels", []);
@@ -10143,9 +10156,9 @@ const xc = class xc {
10143
10156
  this.subscriptionSource = t, this.emitter = e, this.emitter.on("renditions", this.onRenditions), this.emitter.on("subscription changed", this.onSubscriptionChanged);
10144
10157
  }
10145
10158
  };
10146
- r(xc, "create", (e, t) => new xc(e, t));
10147
- let eu = xc;
10148
- const ir = (s) => JSON.parse(JSON.stringify(s)), iw = 1e4, Lc = class Lc {
10159
+ r(Mc, "create", (e, t) => new Mc(e, t));
10160
+ let eu = Mc;
10161
+ const ir = (s) => JSON.parse(JSON.stringify(s)), sw = 1e4, Lc = class Lc {
10149
10162
  constructor(e, t, i) {
10150
10163
  r(this, "logger");
10151
10164
  r(this, "timers", new Ae());
@@ -10206,7 +10219,7 @@ const ir = (s) => JSON.parse(JSON.stringify(s)), iw = 1e4, Lc = class Lc {
10206
10219
  const e = this.currentSubscription.channelId, t = this.targetSubscription.channelId, i = e !== t;
10207
10220
  this._isSwitchingSubscription && (i && this.burstMs ? this.setBurst(this.burstMs) : this.setBurst(0), this.pendingSubscriptionTimeoutId && (this.timers.clearTimeout(this.pendingSubscriptionTimeoutId), this.pendingSubscriptionTimeoutId = void 0), i && this.timers.setTimeout(() => {
10208
10221
  this.currentSubscription.channelId === e && this.targetSubscription.channelId === t && (this.logger.warn("Channel switch timeout", t), this.targetSubscription = ir(this.currentSubscription), this.emitter.emit("channel switch timeout", t));
10209
- }, iw), this.pendingSubscriptionTimeoutId = this.timers.setTimeout(
10222
+ }, sw), this.pendingSubscriptionTimeoutId = this.timers.setTimeout(
10210
10223
  () => this.emitter.emit("send signal", {
10211
10224
  type: "subscribe",
10212
10225
  subscription: this.getTargetSubscription()
@@ -10219,7 +10232,7 @@ const ir = (s) => JSON.parse(JSON.stringify(s)), iw = 1e4, Lc = class Lc {
10219
10232
  };
10220
10233
  r(Lc, "create", (e, t, i) => new Lc(e, i, t));
10221
10234
  let tu = Lc;
10222
- const nd = 5e3, sw = () => Id() || Em(), nw = () => sw() ? 100 : 0, rd = (s) => (e) => e > s, so = {
10235
+ const nd = 5e3, nw = () => Id() || Em(), rw = () => nw() ? 100 : 0, rd = (s) => (e) => e > s, so = {
10223
10236
  seek: {
10224
10237
  toleranceMs: 200,
10225
10238
  toleranceMaxMs: 2500,
@@ -10279,7 +10292,7 @@ const nd = 5e3, sw = () => Id() || Em(), nw = () => sw() ? 100 : 0, rd = (s) =>
10279
10292
  /** Max difference tolerated between server sync info and local estimation */
10280
10293
  r(this, "syncInfoToleranceMaxMs", 150);
10281
10294
  r(this, "syncInfoToleranceStep", 20);
10282
- r(this, "seekOvershoot", nw());
10295
+ r(this, "seekOvershoot", rw());
10283
10296
  // ─────────────────────────────────────────────────────────────────────────────
10284
10297
  // Runtime State
10285
10298
  // ─────────────────────────────────────────────────────────────────────────────
@@ -10735,7 +10748,7 @@ const nd = 5e3, sw = () => Id() || Em(), nw = () => sw() ? 100 : 0, rd = (s) =>
10735
10748
  };
10736
10749
  r(Dc, "create", (e, t, i, n, o) => new Dc(e, t, i, n, o));
10737
10750
  let iu = Dc;
10738
- const rw = {
10751
+ const aw = {
10739
10752
  enabled: !0,
10740
10753
  interval: 3e4,
10741
10754
  includeErrors: !0,
@@ -10804,7 +10817,7 @@ const rw = {
10804
10817
  r(this, "onError", (e) => this.addError(e.error));
10805
10818
  r(this, "addError", (e) => {
10806
10819
  const { includeErrors: t, maxErrorReports: i } = this.options;
10807
- if (t && e instanceof x) {
10820
+ if (t && e instanceof M) {
10808
10821
  if (this.errorCount++, this.errorCount > i)
10809
10822
  return;
10810
10823
  const n = this.parentContext.getStatistics();
@@ -10813,7 +10826,7 @@ const rw = {
10813
10826
  );
10814
10827
  }
10815
10828
  });
10816
- this.logger = e, this.emitter = t, this.options = S(S({}, rw), i), this.parentContext = n;
10829
+ this.logger = e, this.emitter = t, this.options = S(S({}, aw), i), this.parentContext = n;
10817
10830
  }
10818
10831
  };
10819
10832
  r(Oc, "create", (e, t, i, n) => new Oc(e, t, i, n));
@@ -10835,7 +10848,7 @@ const Fc = class Fc {
10835
10848
  };
10836
10849
  r(Fc, "create", (e, t, i) => new Fc(e, t, i));
10837
10850
  let zo = Fc;
10838
- const aw = [
10851
+ const ow = [
10839
10852
  "minBufferTime",
10840
10853
  "maxBufferTime",
10841
10854
  "burstEnabled",
@@ -10843,10 +10856,10 @@ const aw = [
10843
10856
  "separateVideoSocketEnabled",
10844
10857
  "videoCodecs"
10845
10858
  ];
10846
- function ow(s) {
10847
- return aw.includes(s);
10859
+ function cw(s) {
10860
+ return ow.includes(s);
10848
10861
  }
10849
- class cw {
10862
+ class hw {
10850
10863
  constructor(e) {
10851
10864
  r(this, "options");
10852
10865
  r(this, "overrides", /* @__PURE__ */ new Map());
@@ -10884,7 +10897,7 @@ class cw {
10884
10897
  */
10885
10898
  get(e, t) {
10886
10899
  var i;
10887
- if (t && ow(e)) {
10900
+ if (t && cw(e)) {
10888
10901
  const n = (i = this.overrides.get(t)) == null ? void 0 : i[e];
10889
10902
  if (typeof n != "undefined")
10890
10903
  return n;
@@ -10902,7 +10915,7 @@ class cw {
10902
10915
  return (i = this.overrides.get(t)) == null ? void 0 : i[e];
10903
10916
  }
10904
10917
  }
10905
- const hw = 6, uw = (s) => {
10918
+ const uw = 6, dw = (s) => {
10906
10919
  let e = [s], t = 0, i = 0, n = !1;
10907
10920
  const o = (h, u) => {
10908
10921
  var I, P, E;
@@ -10917,7 +10930,7 @@ const hw = 6, uw = (s) => {
10917
10930
  });
10918
10931
  };
10919
10932
  return (h, u = !1) => {
10920
- if (h.flags && ur(h.flags) && u && (n = !n), !(u && e.length < hw && n) && e.length > 0) {
10933
+ if (h.flags && ur(h.flags) && u && (n = !n), !(u && e.length < uw && n) && e.length > 0) {
10921
10934
  n = !1;
10922
10935
  let p = h;
10923
10936
  for (let w = e.length - 1; w > 0; w--) {
@@ -10933,7 +10946,7 @@ const hw = 6, uw = (s) => {
10933
10946
  }
10934
10947
  return e.push(h), [];
10935
10948
  };
10936
- }, dw = (s, e, t) => {
10949
+ }, lw = (s, e, t) => {
10937
10950
  if (ys(e))
10938
10951
  return S(O(S({}, s), {
10939
10952
  type: "video",
@@ -10957,7 +10970,7 @@ const hw = 6, uw = (s) => {
10957
10970
  duration: 0
10958
10971
  });
10959
10972
  };
10960
- class lw {
10973
+ class mw {
10961
10974
  constructor() {
10962
10975
  r(this, "highEntropyValues");
10963
10976
  var e;
@@ -11002,15 +11015,15 @@ class lw {
11002
11015
  }, n);
11003
11016
  }
11004
11017
  }
11005
- const ad = (s, e) => s && typeof s == "object" && e in s, mw = (s) => !(typeof s != "object" || !ad(s, "channelId") || typeof s.channelId != "string" || !ad(s, "url") || typeof s.url != "string" || s.channelId.length === 0 || s.url.length === 0), fw = (s) => {
11006
- if (!mw(s))
11007
- throw new x("Invalid options", { isFatal: !0, code: "invalid_options" });
11018
+ const ad = (s, e) => s && typeof s == "object" && e in s, fw = (s) => !(typeof s != "object" || !ad(s, "channelId") || typeof s.channelId != "string" || !ad(s, "url") || typeof s.url != "string" || s.channelId.length === 0 || s.url.length === 0), pw = (s) => {
11019
+ if (!fw(s))
11020
+ throw new M("Invalid options", { isFatal: !0, code: "invalid_options" });
11008
11021
  const e = S({}, s);
11009
11022
  return Object.keys(e).forEach((t) => {
11010
11023
  const i = e;
11011
11024
  typeof i[t] == "undefined" && delete i[t];
11012
11025
  }), e;
11013
- }, pw = (s) => {
11026
+ }, gw = (s) => {
11014
11027
  if (typeof s != "object" || s === null)
11015
11028
  throw new Error("not an object");
11016
11029
  if (!("video" in s))
@@ -11047,7 +11060,7 @@ const Pt = class Pt extends Ei {
11047
11060
  r(this, "latestEmittedLanguages", []);
11048
11061
  r(this, "wakeLock");
11049
11062
  r(this, "pool", new Eu(Pt.MAX_POOL_SIZE));
11050
- r(this, "userAgentInformation", new lw());
11063
+ r(this, "userAgentInformation", new mw());
11051
11064
  r(this, "encryptedMediaExtensions");
11052
11065
  d(this, ws, 0);
11053
11066
  d(this, Fe, []);
@@ -11130,7 +11143,7 @@ const Pt = class Pt extends Ei {
11130
11143
  p.overrides && this.options.addOverrides(p.channelId, p.overrides), p.renditions = yield this.filterRenditions(p.renditions), this.modules.renditions.setRenditions(p.channelId, p.renditions);
11131
11144
  }))
11132
11145
  ), !n)
11133
- throw Md("external");
11146
+ throw xd("external");
11134
11147
  const o = this.options.getOverride(
11135
11148
  "sizeBasedResolutionCapEnabled",
11136
11149
  this.channelId
@@ -11270,7 +11283,7 @@ const Pt = class Pt extends Ei {
11270
11283
  var n, o;
11271
11284
  const t = this.currentRenditionLevel, i = [];
11272
11285
  if (!t)
11273
- throw new x("No currentRenditionLevel", { code: "no_current_rendition_level", isFatal: !1 });
11286
+ throw new M("No currentRenditionLevel", { code: "no_current_rendition_level", isFatal: !1 });
11274
11287
  if (t != null && t.video && i.push({
11275
11288
  type: "video",
11276
11289
  mimeType: ei(t.video),
@@ -11280,7 +11293,7 @@ const Pt = class Pt extends Ei {
11280
11293
  codec: t.audio.codec,
11281
11294
  mimeType: ei(t.audio)
11282
11295
  }), i.length === 0)
11283
- throw new x("Can't initialize decoding module without tracks", { code: "no_tracks", isFatal: !1 });
11296
+ throw new M("Can't initialize decoding module without tracks", { code: "no_tracks", isFatal: !1 });
11284
11297
  if (this.willUseMediaSource() && this.element instanceof HTMLMediaElement)
11285
11298
  this.emitter.emit("flush buffers"), yield (n = this.modules.mseModule) == null ? void 0 : n.setSourceBuffers(i);
11286
11299
  else {
@@ -11378,7 +11391,7 @@ const Pt = class Pt extends Ei {
11378
11391
  const t = this.modules.canvasModule ? this.options.get("iosMediaElementEnabled") : void 0;
11379
11392
  return S({
11380
11393
  uptime: Date.now() - this.createdAt,
11381
- version: "4.1.8",
11394
+ version: "4.1.9",
11382
11395
  clientId: this.clientId,
11383
11396
  sessionId: this.sessionId,
11384
11397
  channelId: this.channelId,
@@ -11410,7 +11423,7 @@ const Pt = class Pt extends Ei {
11410
11423
  if (i && t)
11411
11424
  return t - i;
11412
11425
  });
11413
- this.options = new cw(S(S({}, df), fw(t)));
11426
+ this.options = new hw(S(S({}, df), pw(t)));
11414
11427
  const i = ["localhost", "127.0.0.1"];
11415
11428
  t.telemetryEnabled === void 0 && i.includes(location.hostname) && this.options.set("telemetryEnabled", !1);
11416
11429
  const n = {
@@ -11609,14 +11622,14 @@ const Pt = class Pt extends Ei {
11609
11622
  this
11610
11623
  ), this.modules.telemetry.load());
11611
11624
  }), this.emitter.on("adapt level", (y) => {
11612
- var Me, J, ce, Ne, Ve;
11625
+ var xe, J, ce, Ne, Ve;
11613
11626
  this.logger.debug("adapt level", { direction: y });
11614
11627
  const T = this.modules.renditions.getRenditionLevels(), F = this.modules.renditions.getRenditionLevel(), G = T.findIndex((se) => se === F), L = T.length - 1;
11615
11628
  let N = G;
11616
11629
  switch (y) {
11617
11630
  case "upgrade":
11618
11631
  {
11619
- const se = Math.min(G + 1, L), dt = T[se], nm = (Me = this.modules.connection.estimatedBandwidth) != null ? Me : Ti(), rm = ((ce = (J = dt == null ? void 0 : dt.audio) == null ? void 0 : J.bitRate) != null ? ce : 0) + ((Ve = (Ne = dt == null ? void 0 : dt.video) == null ? void 0 : Ne.bitRate) != null ? Ve : 0), am = nm * 2 > rm;
11632
+ const se = Math.min(G + 1, L), dt = T[se], nm = (xe = this.modules.connection.estimatedBandwidth) != null ? xe : Ti(), rm = ((ce = (J = dt == null ? void 0 : dt.audio) == null ? void 0 : J.bitRate) != null ? ce : 0) + ((Ve = (Ne = dt == null ? void 0 : dt.video) == null ? void 0 : Ne.bitRate) != null ? Ve : 0), am = nm * 2 > rm;
11620
11633
  dt && am && this.modules.adaptivity.isQoSOk(dt) && (N = se);
11621
11634
  }
11622
11635
  break;
@@ -11672,11 +11685,11 @@ const Pt = class Pt extends Ei {
11672
11685
  break;
11673
11686
  case "subscription changed":
11674
11687
  try {
11675
- pw(T.subscription);
11688
+ gw(T.subscription);
11676
11689
  } catch (L) {
11677
11690
  this.emitter.emit(
11678
11691
  "error",
11679
- new x("Subscription failed validation", {
11692
+ new M("Subscription failed validation", {
11680
11693
  source: L instanceof Error ? L : void 0,
11681
11694
  isFatal: !1,
11682
11695
  code: "subscription_failed_validation"
@@ -11687,14 +11700,14 @@ const Pt = class Pt extends Ei {
11687
11700
  reset: T.reset,
11688
11701
  to: T.subscription,
11689
11702
  from: this.modules.subscription.getCurrentSubscription()
11690
- }), T.reset && F.channelId !== T.subscription.channelId && (this.emit("error", Mu(T.subscription.channelId)), this.emit("channel switch failed", { channelId: F.channelId })), this.modules.sync.allowTimeshiftOnAudio = !((G = T.subscription.video) != null && G.codec), this.modules.adaptivity.reset();
11703
+ }), T.reset && F.channelId !== T.subscription.channelId && (this.emit("error", xu(T.subscription.channelId)), this.emit("channel switch failed", { channelId: F.channelId })), this.modules.sync.allowTimeshiftOnAudio = !((G = T.subscription.video) != null && G.codec), this.modules.adaptivity.reset();
11691
11704
  break;
11692
11705
  case "timing info":
11693
11706
  this.modules.sync.updateChannelSyncInfo(T.timingInfo.channelId, T.timingInfo), this.emit("server wallclock time", T.timingInfo.wallclockTime);
11694
11707
  break;
11695
11708
  }
11696
11709
  }), this.emitter.on("channel switch timeout", (y) => {
11697
- this.emit("error", Mu(y)), this.emit("channel switch failed", { channelId: this.currentSubscription.channelId });
11710
+ this.emit("error", xu(y)), this.emit("channel switch failed", { channelId: this.currentSubscription.channelId });
11698
11711
  }), this.emitter.on("received data", (y) => {
11699
11712
  const T = this.modules.subscription.getCurrentSubscription(), F = rg(y);
11700
11713
  if (!T) {
@@ -11703,7 +11716,7 @@ const Pt = class Pt extends Ei {
11703
11716
  }
11704
11717
  Re(O(S({}, F), { channelId: T.channelId }));
11705
11718
  }), this.emitter.on("received moq data", (y) => {
11706
- var N, Z, Me;
11719
+ var N, Z, xe;
11707
11720
  const T = y.payload.mediaType(), F = y.channelId, G = y.renditionId, L = this.modules.sync.processFragment(F, y.payload);
11708
11721
  if (T !== "text" && this.modules.jitter.recordSample({
11709
11722
  type: T,
@@ -11721,7 +11734,7 @@ const Pt = class Pt extends Ei {
11721
11734
  }), this.modules.incomingData.add(T, y.payload.rawBytes().byteLength), L.fragment().emsgs.forEach((J) => {
11722
11735
  if (!J.presentationTime)
11723
11736
  return;
11724
- const ce = Mf(J.data);
11737
+ const ce = xf(J.data);
11725
11738
  ce && this.modules.event.addEvent({
11726
11739
  id: J.id,
11727
11740
  timestamp: J.presentationTime / J.timescale * 1e3 - this.modules.sync.getTimeshiftOffset(),
@@ -11729,7 +11742,7 @@ const Pt = class Pt extends Ei {
11729
11742
  type: "metadata"
11730
11743
  });
11731
11744
  }), this.modules.decoder) {
11732
- const J = (N = L.header().init().moov.traks[0]) == null ? void 0 : N.mdia.minf.stbl.stsd, ce = (Z = J == null ? void 0 : J.avc1) == null ? void 0 : Z.avcC.bytes, Ne = (Me = J == null ? void 0 : J.codec) != null ? Me : "h264";
11745
+ const J = (N = L.header().init().moov.traks[0]) == null ? void 0 : N.mdia.minf.stbl.stsd, ce = (Z = J == null ? void 0 : J.avc1) == null ? void 0 : Z.avcC.bytes, Ne = (xe = J == null ? void 0 : J.codec) != null ? xe : "h264";
11733
11746
  if (ce) {
11734
11747
  const Ve = ce.buffer.slice(ce.byteOffset, ce.byteOffset + ce.byteLength);
11735
11748
  if (T === "text")
@@ -11803,11 +11816,11 @@ const Pt = class Pt extends Ei {
11803
11816
  const Z = ei({ codec: F.codec, codecString: F.codecString });
11804
11817
  this.emitter.emit("init segment", { initSegment: L, mimeType: Z }), this.emit("initialized media");
11805
11818
  } else {
11806
- const L = dw(y, F, this.sizes.get(y.renditionId));
11819
+ const L = lw(y, F, this.sizes.get(y.renditionId));
11807
11820
  this.modules.jitter.recordSample(L);
11808
11821
  let N = this.sampleProcessingSesssions.get(G);
11809
11822
  if (!N)
11810
- N = uw(
11823
+ N = dw(
11811
11824
  this.modules.sync.processSample(L)
11812
11825
  ), this.sampleProcessingSesssions.set(G, N);
11813
11826
  else {
@@ -11815,9 +11828,9 @@ const Pt = class Pt extends Ei {
11815
11828
  this.modules.sync.processSample(L),
11816
11829
  this.isSwitchingRenditionLevel && L.type === "video"
11817
11830
  );
11818
- let Me = L;
11831
+ let xe = L;
11819
11832
  Z.forEach((J) => {
11820
- this.modules.event.extractEvent(J, Me), this.emitter.emit("coded sample", J), Me = J;
11833
+ this.modules.event.extractEvent(J, xe), this.emitter.emit("coded sample", J), xe = J;
11821
11834
  });
11822
11835
  }
11823
11836
  }
@@ -12030,9 +12043,16 @@ const Pt = class Pt extends Ei {
12030
12043
  * Set the active text track
12031
12044
  */
12032
12045
  set textTrack(t) {
12033
- a(this, Fe).forEach((i) => {
12034
- i.label === t ? i.mode = "showing" : i.mode = "hidden";
12035
- }), this.emitter.emit("text track", t);
12046
+ t !== this.textTrack && (a(this, Fe).forEach((i) => {
12047
+ if (i.label === t)
12048
+ i.mode = "showing";
12049
+ else {
12050
+ if (i.mode === "showing" && i.cues)
12051
+ for (const n of [...i.cues])
12052
+ i.removeCue(n);
12053
+ i.mode = "hidden";
12054
+ }
12055
+ }), this.emitter.emit("text track", t));
12036
12056
  }
12037
12057
  /**
12038
12058
  * Get the available text tracks
@@ -12258,12 +12278,12 @@ export {
12258
12278
  Gm as N,
12259
12279
  od as V,
12260
12280
  Fm as a,
12261
- bw as b,
12281
+ yw as b,
12262
12282
  Nm as c,
12263
12283
  tf as d,
12264
12284
  _m as e,
12265
12285
  Vm as f,
12266
- x as g,
12286
+ M as g,
12267
12287
  Cm as i,
12268
12288
  D as n
12269
12289
  };