@vindral/web-sdk 4.7.2-17-g3c99bc71 → 4.7.2-18-g998978f5

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.
@@ -7996,42 +7996,42 @@ function J_(e) {
7996
7996
  return n;
7997
7997
  }
7998
7998
  var Y_ = /* @__PURE__ */ new WeakMap(), X_ = /* @__PURE__ */ new WeakSet(), Z_ = class r {
7999
- constructor(t, r, s) {
8000
- x(this, X_), e(this, "ip", void 0), e(this, "value", void 0), i(this, Y_, void 0), this.ip = s, this.value = new D(r), a(Y_, this, o(X_, this, Q_).call(this, t)), this.closed().catch(n);
7999
+ constructor(t, r, s, c) {
8000
+ x(this, X_), e(this, "ip", void 0), e(this, "value", void 0), i(this, Y_, void 0), this.ip = s, this.value = new D(r), a(Y_, this, o(X_, this, Q_).call(this, t, c)), this.closed().catch(n);
8001
8001
  }
8002
8002
  closed() {
8003
8003
  return s(Y_, this);
8004
8004
  }
8005
- static start(e) {
8005
+ static start(e, n) {
8006
8006
  return t(function* () {
8007
- let t = (yield e.subscribe(new xh().name("stats").groupOrder("ascending").build())).objects(), n = yield t.next();
8008
- if (n.done) throw Error("No stats object received");
8009
- let i = J_(n.value.payload);
8010
- if (!i.ip) throw Error("Expected IP in initial stats object");
8011
- return new r(t, i, i.ip);
8007
+ let t = (yield e.subscribe(new xh().name("stats").groupOrder("ascending").build())).objects(), i = yield t.next(), a = performance.now();
8008
+ if (i.done) throw Error("No stats object received");
8009
+ let o = J_(i.value.payload);
8010
+ if (!o.ip) throw Error("Expected IP in initial stats object");
8011
+ return n == null || n(o, a), new r(t, o, o.ip, n);
8012
8012
  })();
8013
8013
  }
8014
8014
  };
8015
- function Q_(e) {
8016
- var n = this;
8015
+ function Q_(e, n) {
8016
+ var r = this;
8017
8017
  return t(function* () {
8018
- var t = !1, r = !1, i;
8018
+ var t = !1, i = !1, a;
8019
8019
  try {
8020
- for (var a = V(e), o; t = !(o = yield a.next()).done; t = !1) {
8021
- let e = o.value;
8020
+ for (var o = V(e), s; t = !(s = yield o.next()).done; t = !1) {
8021
+ let e = s.value;
8022
8022
  {
8023
8023
  if (e.objectStatus !== B.Normal) continue;
8024
- let t = J_(e.payload);
8025
- n.value.update(t);
8024
+ let t = performance.now(), i = J_(e.payload);
8025
+ n == null || n(i, t), r.value.update(i);
8026
8026
  }
8027
8027
  }
8028
8028
  } catch (e) {
8029
- r = !0, i = e;
8029
+ i = !0, a = e;
8030
8030
  } finally {
8031
8031
  try {
8032
- t && a.return != null && (yield a.return());
8032
+ t && o.return != null && (yield o.return());
8033
8033
  } finally {
8034
- if (r) throw i;
8034
+ if (i) throw a;
8035
8035
  }
8036
8036
  }
8037
8037
  })();
@@ -8118,7 +8118,7 @@ var sv = class {
8118
8118
  Promise.resolve(e),
8119
8119
  n.videoTrack ? e.subscribeCmafTrack(n.videoTrack, { params: t }) : void 0,
8120
8120
  n.audioTrack ? e.subscribeCmafTrack(n.audioTrack, { params: t }) : void 0
8121
- ])), Z_.start(i)]), u = new r(e, a, l);
8121
+ ])), Z_.start(i, n.onStats)]), u = new r(e, a, l);
8122
8122
  return c && s(pv, u).update(c), o && s(mv, u).update(o), u;
8123
8123
  })();
8124
8124
  }
@@ -8380,14 +8380,65 @@ var Mv = (e, t) => {
8380
8380
  } catch (e) {
8381
8381
  return;
8382
8382
  }
8383
+ }, Pv = 3e5, Fv = 3, Iv = 1e4, Lv = 1e3, Rv = 250, zv = 200, Bv = /* @__PURE__ */ new WeakMap(), Vv = /* @__PURE__ */ new WeakMap(), Hv = /* @__PURE__ */ new WeakMap(), Uv = /* @__PURE__ */ new WeakMap(), Wv = /* @__PURE__ */ new WeakMap(), Gv = /* @__PURE__ */ new WeakMap(), Kv = /* @__PURE__ */ new WeakMap(), qv = /* @__PURE__ */ new WeakMap(), Jv = /* @__PURE__ */ new WeakSet(), Yv = class {
8384
+ constructor(e = () => performance.timeOrigin + performance.now()) {
8385
+ x(this, Jv), i(this, Bv, void 0), i(this, Vv, []), i(this, Hv, 0), i(this, Uv, void 0), i(this, Wv, void 0), i(this, Gv, void 0), i(this, Kv, 0), i(this, qv, []), a(Bv, this, e);
8386
+ }
8387
+ sample(e, t) {
8388
+ var n;
8389
+ if (!Number.isFinite(e) || !Number.isFinite(t)) return;
8390
+ let r = t - e;
8391
+ if (s(Uv, this) !== void 0) {
8392
+ var i, c;
8393
+ let t = e - s(Uv, this), n = s(qv, this).length >= 2 && r < o(Jv, this, Xv).call(this) - Lv && t > ((i = ey(s(qv, this))) == null ? 0 : i) + Lv, l = ey(s(qv, this)), u = l === void 0 ? 0 : l - t;
8394
+ t < -Lv || u > Lv && r - ((c = s(Gv, this)) == null ? r : c) > u - Rv || n ? (a(Vv, this, []), a(Hv, this, 0), a(qv, this, [])) : t >= zv && a(qv, this, [...s(qv, this).slice(-4), t]);
8395
+ }
8396
+ a(Uv, this, e), a(Wv, this, t), a(Gv, this, r), a(Hv, this, (n = s(Hv, this), n++, n)), a(Vv, this, s(Vv, this).filter((e) => e.arrivedAt > t - Pv)), s(Vv, this).push({
8397
+ arrivedAt: t,
8398
+ delay: r
8399
+ }), a(Kv, this, r - o(Jv, this, Xv).call(this));
8400
+ }
8401
+ level(e = s(Bv, this).call(this)) {
8402
+ if (s(Hv, this) < Fv || s(Wv, this) === void 0) return;
8403
+ let t = o(Jv, this, Zv).call(this, e);
8404
+ if (!(t <= 0 && e - s(Wv, this) > Iv)) return Math.max(s(Kv, this), t);
8405
+ }
8406
+ peak(e, t = s(Bv, this).call(this)) {
8407
+ var n;
8408
+ return (n = this.summary(e, t)) == null ? void 0 : n.max;
8409
+ }
8410
+ summary(e, t = s(Bv, this).call(this)) {
8411
+ let n = this.level(t);
8412
+ if (n === void 0) return;
8413
+ let r = o(Jv, this, Xv).call(this);
8414
+ return xt([...s(Vv, this).filter((n) => n.arrivedAt >= t - e).map((e) => e.delay - r), n]);
8415
+ }
8416
+ };
8417
+ function Xv() {
8418
+ return s(Vv, this).reduce((e, t) => Math.min(e, t.delay), Infinity);
8419
+ }
8420
+ function Zv(e) {
8421
+ let t = ey(s(qv, this));
8422
+ return t === void 0 || s(Wv, this) === void 0 ? 0 : e - (s(Wv, this) - s(Kv, this) + t);
8423
+ }
8424
+ var Qv = 3e3, $v = (e, t) => {
8425
+ let n = t.summary(Qv);
8426
+ n !== void 0 && e.debug("Link queue", {
8427
+ levelMs: Math.round(n.last),
8428
+ peak3sMs: Math.round(n.max)
8429
+ });
8430
+ }, ey = (e) => {
8431
+ if (e.length === 0) return;
8432
+ let t = [...e].sort((e, t) => e - t);
8433
+ return t[Math.floor(t.length / 2)];
8383
8434
  };
8384
8435
  //#endregion
8385
8436
  //#region ../../libs/web-sdk/src/adapters/MoqConnectionAdapter.ts
8386
- function Pv(e, t, n) {
8437
+ function ty(e, t, n) {
8387
8438
  let r = new URL("/voq/subscribe", e);
8388
8439
  return r.searchParams.set("sessionId", t.sessionId), r.searchParams.set("clientId", t.clientId), r.searchParams.set("channelId", t.channelId), n && r.searchParams.set("authToken", n), r;
8389
8440
  }
8390
- function Fv(e, t) {
8441
+ function ny(e, t) {
8391
8442
  let n = [];
8392
8443
  for (let r of e == null ? [] : e) try {
8393
8444
  n.push({
@@ -8402,75 +8453,75 @@ function Fv(e, t) {
8402
8453
  }
8403
8454
  return n.length > 0 ? n : void 0;
8404
8455
  }
8405
- function Iv(e, t, n) {
8456
+ function ry(e, t, n) {
8406
8457
  return n !== void 0 && e.get("webtransportEnabled") && !e.get("unstableWebtransportEnabled") && !!self.WebTransport && t.protocol.startsWith("https") && Le();
8407
8458
  }
8408
- var Lv = 1e4, Z = /* @__PURE__ */ new WeakMap(), Rv = /* @__PURE__ */ new WeakMap(), zv = /* @__PURE__ */ new WeakMap(), Bv = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new WeakMap(), Vv = /* @__PURE__ */ new WeakMap(), Hv = /* @__PURE__ */ new WeakMap(), Uv = /* @__PURE__ */ new WeakMap(), Wv = /* @__PURE__ */ new WeakMap(), Gv = /* @__PURE__ */ new WeakMap(), Kv = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakSet(), qv = /* @__PURE__ */ new WeakMap(), Jv = /* @__PURE__ */ new WeakMap(), Yv = /* @__PURE__ */ new WeakMap(), Xv = /* @__PURE__ */ new WeakMap(), Zv = /* @__PURE__ */ new WeakMap(), Qv = class r {
8459
+ var iy = 1e4, Z = /* @__PURE__ */ new WeakMap(), ay = /* @__PURE__ */ new WeakMap(), oy = /* @__PURE__ */ new WeakMap(), sy = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new WeakMap(), cy = /* @__PURE__ */ new WeakMap(), ly = /* @__PURE__ */ new WeakMap(), uy = /* @__PURE__ */ new WeakMap(), dy = /* @__PURE__ */ new WeakMap(), fy = /* @__PURE__ */ new WeakMap(), py = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakSet(), my = /* @__PURE__ */ new WeakMap(), hy = /* @__PURE__ */ new WeakMap(), gy = /* @__PURE__ */ new WeakMap(), _y = /* @__PURE__ */ new WeakMap(), vy = /* @__PURE__ */ new WeakMap(), yy = class r {
8409
8460
  get estimatedBandwidth() {
8410
- return s(Wv, this);
8461
+ return s(dy, this);
8411
8462
  }
8412
8463
  unload() {
8413
- s(Z, this).off("send signal", s(Jv, this)), s(Z, this).off("disconnect", this.disconnect), s(Z, this).off("text track", s(qv, this)), this.disconnect();
8464
+ s(Z, this).off("send signal", s(hy, this)), s(Z, this).off("disconnect", this.disconnect), s(Z, this).off("text track", s(my, this)), this.disconnect();
8414
8465
  }
8415
8466
  suspend() {}
8416
8467
  unsuspend() {}
8417
8468
  getStatistics() {
8418
- let e = s(zv, this).transportType() === "webtransport" ? "moq" : "moq_ws";
8469
+ let e = s(oy, this).transportType() === "webtransport" ? "moq" : "moq_ws";
8419
8470
  return {
8420
- edgeUrl: Nv(s(zv, this).url()),
8471
+ edgeUrl: Nv(s(oy, this).url()),
8421
8472
  connectionProtocol: e,
8422
- transportSelectionReason: s(Gv, this)
8473
+ transportSelectionReason: s(fy, this)
8423
8474
  };
8424
8475
  }
8425
- constructor(t, r, c, l, u, d, f, p) {
8426
- x(this, $), i(this, Z, void 0), i(this, Rv, void 0), i(this, zv, void 0), i(this, Bv, "disconnected"), i(this, Q, void 0), i(this, Vv, /* @__PURE__ */ new Map()), i(this, Hv, void 0), i(this, Uv, void 0), i(this, Wv, void 0), i(this, Gv, void 0), i(this, Kv, /* @__PURE__ */ new Map()), i(this, qv, (e) => {
8476
+ constructor(t, r, c, l, u, d, f, p, h) {
8477
+ x(this, $), i(this, Z, void 0), i(this, ay, void 0), i(this, oy, void 0), i(this, sy, "disconnected"), i(this, Q, void 0), i(this, cy, /* @__PURE__ */ new Map()), i(this, ly, void 0), i(this, uy, void 0), i(this, dy, void 0), i(this, fy, void 0), i(this, py, /* @__PURE__ */ new Map()), e(this, "linkQueue", void 0), i(this, my, (e) => {
8427
8478
  if (!e) {
8428
8479
  s(Q, this).setSubtitleTrack(void 0).catch(n);
8429
8480
  return;
8430
8481
  }
8431
- let t = s(Vv, this).get(Eh(s(Q, this).namespace())), r = t == null ? void 0 : t.getTextTrack(e);
8482
+ let t = s(cy, this).get(Eh(s(Q, this).namespace())), r = t == null ? void 0 : t.getTextTrack(e);
8432
8483
  r && s(Q, this).setSubtitleTrack(r).catch(n);
8433
- }), i(this, Jv, (e) => {
8484
+ }), i(this, hy, (e) => {
8434
8485
  switch (e.type) {
8435
8486
  case "subscribe":
8436
8487
  {
8437
- if (s(Yv, this)) return;
8438
- let t = s(Zv, this);
8488
+ if (s(gy, this)) return;
8489
+ let t = s(vy, this);
8439
8490
  if (t) {
8440
8491
  if (kv(t, e.subscription)) {
8441
- a(Xv, this, void 0);
8492
+ a(_y, this, void 0);
8442
8493
  return;
8443
8494
  }
8444
- s(Rv, this).info("Queueing - we are already switching"), a(Xv, this, e.subscription);
8495
+ s(ay, this).info("Queueing - we are already switching"), a(_y, this, e.subscription);
8445
8496
  return;
8446
8497
  }
8447
- o($, this, ty).call(this, e.subscription);
8498
+ o($, this, Sy).call(this, e.subscription);
8448
8499
  }
8449
8500
  break;
8450
8501
  case "telemetry":
8451
- m(new URL("/api/telemetry", s(zv, this).url().replace("wss://", "https://")), {
8502
+ m(new URL("/api/telemetry", s(oy, this).url().replace("wss://", "https://")), {
8452
8503
  body: e.body,
8453
8504
  headers: { "Content-Type": "text/plain" }
8454
8505
  }).catch(n);
8455
8506
  break;
8456
8507
  case "refresh auth":
8457
- s(zv, this).updateAuthToken(e.token);
8508
+ s(oy, this).updateAuthToken(e.token);
8458
8509
  break;
8459
8510
  }
8460
- }), i(this, Yv, !1), i(this, Xv, void 0), i(this, Zv, void 0), e(this, "disconnect", (e = "Disconnect Requested") => {
8461
- s(Rv, this).info("Disconnecting", e), o($, this, ey).call(this), s(zv, this).close(), s(Q, this).close().catch(n), a(Kv, this, /* @__PURE__ */ new Map()), o($, this, iy).call(this, "disconnected");
8462
- }), a(Z, this, t), a(Rv, this, r), a(zv, this, c), a(Q, this, l), a(Vv, this, u), a(Hv, this, d), a(Uv, this, f), a(Gv, this, p), s(Z, this).on("send signal", s(Jv, this)), s(Z, this).on("disconnect", this.disconnect), s(Z, this).on("text track", s(qv, this)), o($, this, $v).call(this).catch(n), o($, this, ay).call(this).catch(n);
8511
+ }), i(this, gy, !1), i(this, _y, void 0), i(this, vy, void 0), e(this, "disconnect", (e = "Disconnect Requested") => {
8512
+ s(ay, this).info("Disconnecting", e), o($, this, xy).call(this), s(oy, this).close(), s(Q, this).close().catch(n), a(py, this, /* @__PURE__ */ new Map()), o($, this, Ty).call(this, "disconnected");
8513
+ }), a(Z, this, t), a(ay, this, r), a(oy, this, c), a(Q, this, l), a(cy, this, u), a(ly, this, d), a(uy, this, f), a(fy, this, p), this.linkQueue = h, s(Z, this).on("send signal", s(hy, this)), s(Z, this).on("disconnect", this.disconnect), s(Z, this).on("text track", s(my, this)), o($, this, by).call(this).catch(n), o($, this, Ey).call(this).catch(n);
8463
8514
  }
8464
8515
  static start(e, n, i, a, o) {
8465
8516
  return t(function* () {
8466
8517
  var t, c, l, u;
8467
- let f = new Map(a.connectInfo.channels.map((e) => [Eh(e.catalog.namespace), new fy(new D(e.catalog))])), p = yield a.onConnectInfo(a.connectInfo), m = a.options.get("authenticationToken"), h, g, ee;
8518
+ let f = new Map(a.connectInfo.channels.map((e) => [Eh(e.catalog.namespace), new Ny(new D(e.catalog))])), p = yield a.onConnectInfo(a.connectInfo), m = a.options.get("authenticationToken"), h, g, ee;
8468
8519
  switch (typeof a.edgeUrl) {
8469
8520
  case "string":
8470
- h = Pv(a.edgeUrl, p, m);
8521
+ h = ty(a.edgeUrl, p, m);
8471
8522
  break;
8472
8523
  default:
8473
- h = Pv(a.edgeUrl.moqUrl || a.edgeUrl.moqWsUrl, p, m), g = Pv(a.edgeUrl.moqWsUrl, p, m), ee = Fv(a.edgeUrl.serverCertificateHashes, n);
8524
+ h = ty(a.edgeUrl.moqUrl || a.edgeUrl.moqWsUrl, p, m), g = ty(a.edgeUrl.moqWsUrl, p, m), ee = ny(a.edgeUrl.serverCertificateHashes, n);
8474
8525
  break;
8475
8526
  }
8476
8527
  let _ = (t = a.connectInfo.channels.find((e) => e.channelId === p.channelId)) == null ? void 0 : t.catalog;
@@ -8478,7 +8529,7 @@ var Lv = 1e4, Z = /* @__PURE__ */ new WeakMap(), Rv = /* @__PURE__ */ new WeakMa
8478
8529
  edgeUrl: h,
8479
8530
  edgeWsUrl: g
8480
8531
  }), d(_, "no catalog found");
8481
- let te = (c = f.get(Eh(_.namespace))) == null ? void 0 : c.getVideoTrack(p.video), v = (l = f.get(Eh(_.namespace))) == null ? void 0 : l.getAudioTrack(p.audio), ne = Iv(a.options, h, g), re;
8532
+ let te = (c = f.get(Eh(_.namespace))) == null ? void 0 : c.getVideoTrack(p.video), v = (l = f.get(Eh(_.namespace))) == null ? void 0 : l.getAudioTrack(p.audio), ne = ry(a.options, h, g), re;
8482
8533
  try {
8483
8534
  re = yield vh({
8484
8535
  url: h,
@@ -8497,54 +8548,57 @@ var Lv = 1e4, Z = /* @__PURE__ */ new WeakMap(), Rv = /* @__PURE__ */ new WeakMa
8497
8548
  (u = a.onTransportConnected) == null || u.call(a);
8498
8549
  let ie = y.closed().then((e) => {
8499
8550
  throw e instanceof Error ? e : Error(e ? `Session closed before player started: ${String(e)}` : "Session closed before player started");
8500
- }), ae;
8551
+ }), ae = y.transportType() === "websocket" ? new Yv() : void 0, x;
8501
8552
  try {
8502
- ae = yield Promise.race([
8553
+ x = yield Promise.race([
8503
8554
  yv.start(y.subscriber, {
8504
8555
  namespace: _.namespace,
8505
8556
  catalog: _,
8506
8557
  videoTrack: te == null ? void 0 : te.track,
8507
8558
  audioTrack: v == null ? void 0 : v.track,
8508
- burstMs: p.burstMs || 0
8559
+ burstMs: p.burstMs || 0,
8560
+ onStats: ae && ((e, t) => {
8561
+ ae.sample(e.ntpTimestamp, performance.timeOrigin + t), $v(n, ae);
8562
+ })
8509
8563
  }),
8510
- un(Lv, /* @__PURE__ */ Error("Timeout waiting for player to start")),
8564
+ un(iy, /* @__PURE__ */ Error("Timeout waiting for player to start")),
8511
8565
  ie
8512
8566
  ]);
8513
8567
  } catch (e) {
8514
8568
  throw y.close(), e;
8515
8569
  }
8516
- let x = new fy(ae.catalog());
8517
- f.set(Eh(_.namespace), x), e.emit("received signal", {
8570
+ let oe = new Ny(x.catalog());
8571
+ f.set(Eh(_.namespace), oe), e.emit("received signal", {
8518
8572
  type: "client ip",
8519
- ip: ae.connectionInfo().ip
8520
- }), ae.drm().then((t) => {
8573
+ ip: x.connectionInfo().ip
8574
+ }), x.drm().then((t) => {
8521
8575
  t && e.emit("received drm data", t.value);
8522
8576
  }).catch((e) => {
8523
8577
  n.error("Error getting DRM data", e);
8524
8578
  });
8525
- let oe = new r(e, n, y, ae, f, i, o, b);
8526
- return p.textTrack && s(qv, oe).call(oe, p.textTrack), oe;
8579
+ let S = new r(e, n, y, x, f, i, o, b, ae);
8580
+ return p.textTrack && s(my, S).call(S, p.textTrack), S;
8527
8581
  })();
8528
8582
  }
8529
8583
  getState() {
8530
- return s(Bv, this);
8584
+ return s(sy, this);
8531
8585
  }
8532
8586
  close() {
8533
- o($, this, ey).call(this), s(zv, this).close();
8587
+ o($, this, xy).call(this), s(oy, this).close();
8534
8588
  }
8535
8589
  closed() {
8536
- return Promise.race([s(zv, this).closed(), s(Q, this).closed()]);
8590
+ return Promise.race([s(oy, this).closed(), s(Q, this).closed()]);
8537
8591
  }
8538
8592
  };
8539
- function $v() {
8593
+ function by() {
8540
8594
  var e = this;
8541
8595
  return t(function* () {
8542
- s(zv, e).transportType() === "websocket" && (yield ln(5e3));
8596
+ s(oy, e).transportType() === "websocket" && (yield ln(5e3));
8543
8597
  var t = !1, n = !1, r;
8544
8598
  try {
8545
8599
  for (var i = V(s(Q, e).stats()), o; t = !(o = yield i.next()).done; t = !1) {
8546
8600
  let { rtt: t, estimatedBandwidth: n } = o.value;
8547
- a(Wv, e, n), s(Uv, e).push(t), s(Z, e).emit("rtt", vt(s(Uv, e).items()));
8601
+ a(dy, e, n), s(uy, e).push(t), s(Z, e).emit("rtt", vt(s(uy, e).items()));
8548
8602
  }
8549
8603
  } catch (e) {
8550
8604
  n = !0, r = e;
@@ -8557,44 +8611,44 @@ function $v() {
8557
8611
  }
8558
8612
  })();
8559
8613
  }
8560
- function ey() {
8561
- a(Yv, this, !0), a(Xv, this, void 0);
8614
+ function xy() {
8615
+ a(gy, this, !0), a(_y, this, void 0);
8562
8616
  }
8563
- function ty(e) {
8564
- a(Zv, this, e), o($, this, ry).call(this, e).catch((t) => {
8565
- s(Rv, this).error("error handling subscription", t);
8566
- let n = s(Xv, this);
8567
- a(Xv, this, void 0), s(Z, this).emit("received signal", {
8617
+ function Sy(e) {
8618
+ a(vy, this, e), o($, this, wy).call(this, e).catch((t) => {
8619
+ s(ay, this).error("error handling subscription", t);
8620
+ let n = s(_y, this);
8621
+ a(_y, this, void 0), s(Z, this).emit("received signal", {
8568
8622
  type: "subscription changed",
8569
8623
  subscription: n == null ? e : n,
8570
8624
  reset: !0
8571
8625
  });
8572
8626
  }).finally(() => {
8573
- a(Zv, this, void 0);
8574
- let e = s(Xv, this);
8575
- a(Xv, this, void 0), e && !s(Yv, this) && o($, this, ty).call(this, e);
8627
+ a(vy, this, void 0);
8628
+ let e = s(_y, this);
8629
+ a(_y, this, void 0), e && !s(gy, this) && o($, this, Sy).call(this, e);
8576
8630
  });
8577
8631
  }
8578
- function ny(e) {
8632
+ function Cy(e) {
8579
8633
  var n = this;
8580
8634
  return t(function* () {
8581
8635
  var t;
8582
- let r = yield s(Hv, n).connect({ channelId: e });
8636
+ let r = yield s(ly, n).connect({ channelId: e });
8583
8637
  if (!c(r)) throw Error("no moq connect info found");
8584
8638
  let i = (t = r.channels.find((t) => t.channelId === e)) == null ? void 0 : t.catalog;
8585
8639
  if (!i) throw Error("no catalog found");
8586
8640
  return i;
8587
8641
  })();
8588
8642
  }
8589
- function ry(e) {
8643
+ function wy(e) {
8590
8644
  var n = this;
8591
8645
  return t(function* () {
8592
8646
  var t, r;
8593
- s(Rv, n).info("handle subscription", e);
8594
- let i = s(Q, n), a = s(Vv, n).get(e.channelId);
8595
- if (a || (a = new fy(new D(yield o($, n, ny).call(n, e.channelId))), s(Vv, n).set(e.channelId, a)), i.namespace().join("/") !== a.namespace().join("/")) {
8647
+ s(ay, n).info("handle subscription", e);
8648
+ let i = s(Q, n), a = s(cy, n).get(e.channelId);
8649
+ if (a || (a = new Ny(new D(yield o($, n, Cy).call(n, e.channelId))), s(cy, n).set(e.channelId, a)), i.namespace().join("/") !== a.namespace().join("/")) {
8596
8650
  var c;
8597
- s(Rv, n).info("changing channel", e.channelId);
8651
+ s(ay, n).info("changing channel", e.channelId);
8598
8652
  let t = a.getVideoTrack(e.video), r = a.getAudioTrack(e.audio);
8599
8653
  if (yield i.zap({
8600
8654
  namespace: a.namespace(),
@@ -8604,8 +8658,8 @@ function ry(e) {
8604
8658
  }, 500), i.drm().then((e) => {
8605
8659
  e && s(Z, n).emit("received drm data", e.value);
8606
8660
  }).catch((e) => {
8607
- s(Rv, n).error("Error getting DRM data", e);
8608
- }), s(Rv, n).info("switched channel", e.channelId), (c = s(Vv, n).get(Eh(i.namespace()))) == null || c.updateCatalog(i.catalog()), s(Yv, n)) return;
8661
+ s(ay, n).error("Error getting DRM data", e);
8662
+ }), s(ay, n).info("switched channel", e.channelId), (c = s(cy, n).get(Eh(i.namespace()))) == null || c.updateCatalog(i.catalog()), s(gy, n)) return;
8609
8663
  s(Z, n).emit("received signal", {
8610
8664
  type: "subscription changed",
8611
8665
  subscription: e
@@ -8613,32 +8667,32 @@ function ry(e) {
8613
8667
  return;
8614
8668
  }
8615
8669
  let l = a.getVideoTrack(e.video), u = a.getAudioTrack(e.audio);
8616
- yield Promise.all([l && l.track.name !== ((t = s(Q, n).videoTrack()) == null ? void 0 : t.name) ? s(Q, n).setVideoTrack(l.track) : void 0, u && u.track.name !== ((r = s(Q, n).audioTrack()) == null ? void 0 : r.name) ? s(Q, n).setAudioTrack(u.track) : void 0]), !s(Yv, n) && s(Z, n).emit("received signal", {
8670
+ yield Promise.all([l && l.track.name !== ((t = s(Q, n).videoTrack()) == null ? void 0 : t.name) ? s(Q, n).setVideoTrack(l.track) : void 0, u && u.track.name !== ((r = s(Q, n).audioTrack()) == null ? void 0 : r.name) ? s(Q, n).setAudioTrack(u.track) : void 0]), !s(gy, n) && s(Z, n).emit("received signal", {
8617
8671
  type: "subscription changed",
8618
8672
  subscription: e
8619
8673
  });
8620
8674
  })();
8621
8675
  }
8622
- function iy(e) {
8623
- a(Bv, this, e), s(Z, this).emit("connection state", e);
8676
+ function Ty(e) {
8677
+ a(sy, this, e), s(Z, this).emit("connection state", e);
8624
8678
  }
8625
- function ay() {
8679
+ function Ey() {
8626
8680
  var e = this;
8627
8681
  return t(function* () {
8628
8682
  try {
8629
- o($, e, iy).call(e, "connecting"), s(Rv, e).info("Connecting..."), o($, e, iy).call(e, "connected"), yield Promise.all([
8630
- o($, e, sy).call(e, s(Q, e).referenceClock(), s(Q, e).audio),
8631
- o($, e, sy).call(e, s(Q, e).referenceClock(), s(Q, e).video),
8632
- o($, e, oy).call(e, s(Q, e).subtitles)
8633
- ]), yield s(Q, e).closed(), s(zv, e).close(), s(Rv, e).info("Session closed");
8683
+ o($, e, Ty).call(e, "connecting"), s(ay, e).info("Connecting..."), o($, e, Ty).call(e, "connected"), yield Promise.all([
8684
+ o($, e, Oy).call(e, s(Q, e).referenceClock(), s(Q, e).audio),
8685
+ o($, e, Oy).call(e, s(Q, e).referenceClock(), s(Q, e).video),
8686
+ o($, e, Dy).call(e, s(Q, e).subtitles)
8687
+ ]), yield s(Q, e).closed(), s(oy, e).close(), s(ay, e).info("Session closed");
8634
8688
  } catch (t) {
8635
- s(Rv, e).warn("Session error", t), s(zv, e).close();
8689
+ s(ay, e).warn("Session error", t), s(oy, e).close();
8636
8690
  } finally {
8637
- o($, e, iy).call(e, "disconnected");
8691
+ o($, e, Ty).call(e, "disconnected");
8638
8692
  }
8639
8693
  })();
8640
8694
  }
8641
- function oy(e) {
8695
+ function Dy(e) {
8642
8696
  var n = this;
8643
8697
  return t(function* () {
8644
8698
  var t = !1, r = !1, i;
@@ -8658,7 +8712,7 @@ function oy(e) {
8658
8712
  }
8659
8713
  })();
8660
8714
  }
8661
- function sy(e, n) {
8715
+ function Oy(e, n) {
8662
8716
  var r = this;
8663
8717
  return t(function* () {
8664
8718
  let t = "", i = "", a, o = s(Q, r).videoTrack() === void 0;
@@ -8683,11 +8737,11 @@ function sy(e, n) {
8683
8737
  drmTransition: a !== void 0 && a !== v
8684
8738
  };
8685
8739
  t = c, i = l, a = v;
8686
- let g = m.producerReferenceTime(), ee = s(Kv, r).get(n.track.namespace), _ = performance.now();
8740
+ let g = m.producerReferenceTime(), ee = s(py, r).get(n.track.namespace), _ = performance.now();
8687
8741
  if (g && (ee === void 0 || _ - ee > 1e3)) {
8688
- s(Kv, r).set(n.track.namespace, _);
8742
+ s(py, r).set(n.track.namespace, _);
8689
8743
  let t = e.wallclock() - g.getTime();
8690
- s(Rv, r).debug("timing-info", {
8744
+ s(ay, r).debug("timing-info", {
8691
8745
  mediaType: m.mediaType(),
8692
8746
  referenceClock: e,
8693
8747
  delta: t,
@@ -8711,7 +8765,7 @@ function sy(e, n) {
8711
8765
  codec: u,
8712
8766
  codecString: d,
8713
8767
  switchInfo: h,
8714
- renditionId: cy(n.track.trackObject.name)
8768
+ renditionId: ky(n.track.trackObject.name)
8715
8769
  });
8716
8770
  }
8717
8771
  }
@@ -8737,48 +8791,48 @@ function sy(e, n) {
8737
8791
  }
8738
8792
  })();
8739
8793
  }
8740
- function cy(e) {
8794
+ function ky(e) {
8741
8795
  return e.split("").reduce((e, t) => e = t.charCodeAt(0) + (e << 6) + (e << 16) - e, 0);
8742
8796
  }
8743
- var ly = /* @__PURE__ */ new WeakMap(), uy = /* @__PURE__ */ new WeakMap(), dy = /* @__PURE__ */ new WeakSet(), fy = class {
8797
+ var Ay = /* @__PURE__ */ new WeakMap(), jy = /* @__PURE__ */ new WeakMap(), My = /* @__PURE__ */ new WeakSet(), Ny = class {
8744
8798
  constructor(e) {
8745
- x(this, dy), i(this, ly, void 0), i(this, uy, void 0), a(ly, this, e), a(uy, this, o(dy, this, py).call(this));
8799
+ x(this, My), i(this, Ay, void 0), i(this, jy, void 0), a(Ay, this, e), a(jy, this, o(My, this, Py).call(this));
8746
8800
  }
8747
8801
  catalog() {
8748
- return s(ly, this).current();
8802
+ return s(Ay, this).current();
8749
8803
  }
8750
8804
  namespace() {
8751
- return s(ly, this).current().namespace;
8805
+ return s(Ay, this).current().namespace;
8752
8806
  }
8753
8807
  updateCatalog(e) {
8754
- a(ly, this, e);
8808
+ a(Ay, this, e);
8755
8809
  }
8756
8810
  getTextTrack(e) {
8757
- return s(ly, this).current().tracks.find((t) => t.label === e);
8811
+ return s(Ay, this).current().tracks.find((t) => t.label === e);
8758
8812
  }
8759
8813
  getAudioTrack(e) {
8760
8814
  if (!e.codec) return;
8761
- let t = s(uy, this).filter((t) => !(!fn(t) || t.bitRate > e.bitRate || e.codec && t.codec !== e.codec || e.language && t.language !== e.language));
8815
+ let t = s(jy, this).filter((t) => !(!fn(t) || t.bitRate > e.bitRate || e.codec && t.codec !== e.codec || e.language && t.language !== e.language));
8762
8816
  return t[t.length - 1];
8763
8817
  }
8764
8818
  getVideoTrack(e) {
8765
8819
  if (!e.codec) return;
8766
- let t = s(uy, this).filter((t) => !(!dn(t) || t.bitRate > e.bitRate || e.codec && t.codec !== e.codec));
8820
+ let t = s(jy, this).filter((t) => !(!dn(t) || t.bitRate > e.bitRate || e.codec && t.codec !== e.codec));
8767
8821
  return t[t.length - 1];
8768
8822
  }
8769
8823
  renditions() {
8770
- return s(uy, this);
8824
+ return s(jy, this);
8771
8825
  }
8772
8826
  };
8773
- function py() {
8774
- let [e, t] = s(ly, this).value();
8827
+ function Py() {
8828
+ let [e, t] = s(Ay, this).value();
8775
8829
  return u(e);
8776
8830
  }
8777
8831
  //#endregion
8778
8832
  //#region ../../libs/web-sdk/src/transports/WebSocket.ts
8779
- var my = /* @__PURE__ */ function(e) {
8833
+ var Fy = /* @__PURE__ */ function(e) {
8780
8834
  return e[e.AuthenticationFailed = 4e3] = "AuthenticationFailed", e[e.AuthenticationRefreshFailed = 4001] = "AuthenticationRefreshFailed", e[e.AuthenticationExpired = 4002] = "AuthenticationExpired", e[e.ChannelNotFound = 4003] = "ChannelNotFound", e[e.Inactivity = 4010] = "Inactivity", e;
8781
- }({}), hy = class extends ie {
8835
+ }({}), Iy = class extends ie {
8782
8836
  constructor(r, i) {
8783
8837
  var a;
8784
8838
  super(), a = this, e(this, "options", void 0), e(this, "websocket", void 0), e(this, "logger", void 0), e(this, "reconnectState", { reconnectRetries: 0 }), e(this, "isSuspended", !1), e(this, "_connectionAttemptCount", 0), e(this, "connectStartTime", 0), e(this, "_connectTime", void 0), e(this, "connectTimeout", void 0), e(this, "shouldContinueConnecting", !1), e(this, "_isConnectInProgress", !1), e(this, "readyState", () => {
@@ -8816,19 +8870,19 @@ var my = /* @__PURE__ */ function(e) {
8816
8870
  })), this.close("websocket was closed");
8817
8871
  let n;
8818
8872
  switch (e.code) {
8819
- case my.AuthenticationFailed:
8873
+ case Fy.AuthenticationFailed:
8820
8874
  n = qn(Kn());
8821
8875
  break;
8822
- case my.AuthenticationRefreshFailed:
8876
+ case Fy.AuthenticationRefreshFailed:
8823
8877
  n = qn(Kn());
8824
8878
  break;
8825
- case my.AuthenticationExpired:
8879
+ case Fy.AuthenticationExpired:
8826
8880
  n = Jn(Kn());
8827
8881
  break;
8828
- case my.ChannelNotFound:
8882
+ case Fy.ChannelNotFound:
8829
8883
  n = Xn("internal", Kn());
8830
8884
  break;
8831
- case my.Inactivity:
8885
+ case Fy.Inactivity:
8832
8886
  n = Yn("internal", Kn());
8833
8887
  break;
8834
8888
  default: t && (n = $n(/* @__PURE__ */ Error("WebSocket closed before open")));
@@ -8879,13 +8933,13 @@ var my = /* @__PURE__ */ function(e) {
8879
8933
  get connectTime() {
8880
8934
  return this._connectTime;
8881
8935
  }
8882
- }, gy, _y = 65536 * 8, vy = .9, yy = 40, by = (e) => {
8883
- let t = e || yy;
8884
- return _y * vy * 1e3 / t;
8885
- }, xy = class r {
8936
+ }, Ly, Ry = 65536 * 8, zy = .9, By = 40, Vy = (e) => {
8937
+ let t = e || By;
8938
+ return Ry * zy * 1e3 / t;
8939
+ }, Hy = class r {
8886
8940
  constructor(i, a, o, s) {
8887
8941
  var c = this;
8888
- e(this, "emitter", void 0), e(this, "transport", void 0), e(this, "logger", void 0), e(this, "config", void 0), e(this, "rtts", void 0), e(this, "lastPingSentTime", performance.now()), e(this, "isPingInFlight", !1), e(this, "connectCount", 0), e(this, "missedPings", 0), e(this, "isContextSwitchInProgress", !1), e(this, "signalBuffer", []), e(this, "dataBuffer", []), e(this, "disconnected", new S()), e(this, "unload", () => {
8942
+ e(this, "emitter", void 0), e(this, "transport", void 0), e(this, "logger", void 0), e(this, "config", void 0), e(this, "rtts", void 0), e(this, "lastPingSentTime", performance.now()), e(this, "isPingInFlight", !1), e(this, "connectCount", 0), e(this, "missedPings", 0), e(this, "isContextSwitchInProgress", !1), e(this, "signalBuffer", []), e(this, "dataBuffer", []), e(this, "disconnected", new S()), e(this, "linkQueue", new Yv()), e(this, "unload", () => {
8889
8943
  this.logger.debug("Unloading module..."), this.close("Unloading"), this.emitter.off("send signal", this.sendSignal), this.emitter.off("disconnect", this.close), this.emitter.off("reconnect", this.reconnect), this.logger.debug("Unloaded module");
8890
8944
  }), e(this, "suspend", () => {
8891
8945
  this.resetPingState(), this.transport.suspend();
@@ -8908,7 +8962,7 @@ var my = /* @__PURE__ */ function(e) {
8908
8962
  connectionProtocol: "vindral_ws",
8909
8963
  transportSelectionReason: void 0
8910
8964
  })), e(this, "onMessage", (e) => {
8911
- this.routeMessage(e), this.pingCooldownExpired() && this.sendPing();
8965
+ typeof e == "string" && this.sampleLinkQueue(e), this.routeMessage(e), this.pingCooldownExpired() && this.sendPing();
8912
8966
  }), e(this, "routeMessage", (e) => {
8913
8967
  if (this.isContextSwitchInProgress) {
8914
8968
  if (e instanceof ArrayBuffer) {
@@ -8968,7 +9022,7 @@ var my = /* @__PURE__ */ function(e) {
8968
9022
  }
8969
9023
  }
8970
9024
  }), e(this, "connectWebSocketTransport", () => {
8971
- let e = new hy({
9025
+ let e = new Iy({
8972
9026
  reconnectDelay: 1e3,
8973
9027
  onMessage: this.onMessage,
8974
9028
  reconnectHandler: this.config.reconnectHandler,
@@ -8989,7 +9043,11 @@ var my = /* @__PURE__ */ function(e) {
8989
9043
  this.emitter.emit("connection state", this.getState());
8990
9044
  }), e(this, "reconnect", (e) => {
8991
9045
  this.closeUnlessConnecting(e);
8992
- }), e(this, "closeUnlessConnecting", (e) => this.transport.isConnectInProgress ? (this.logger.debug("Stopping reconnect, already mid-connection"), !1) : (this.close(e), !0)), e(this, "resetPingState", () => {
9046
+ }), e(this, "closeUnlessConnecting", (e) => this.transport.isConnectInProgress ? (this.logger.debug("Stopping reconnect, already mid-connection"), !1) : (this.close(e), !0)), e(this, "sampleLinkQueue", (e) => {
9047
+ if (this.isContextSwitchInProgress || !e.includes("\"timing info\"")) return;
9048
+ let t = JSON.parse(e);
9049
+ gn(t) && t.type === "timing info" && (this.linkQueue.sample(t.timingInfo.wallclockTime, performance.timeOrigin + performance.now()), $v(this.logger, this.linkQueue));
9050
+ }), e(this, "resetPingState", () => {
8993
9051
  this.missedPings = 0, this.isPingInFlight = !1;
8994
9052
  }), e(this, "pingCooldownExpired", () => performance.now() - this.lastPingSentTime > r.PING_INTERVAL), e(this, "sendPing", () => {
8995
9053
  if (this.isPingInFlight) {
@@ -9003,8 +9061,8 @@ var my = /* @__PURE__ */ function(e) {
9003
9061
  return this.disconnected.promise;
9004
9062
  }
9005
9063
  };
9006
- gy = xy, e(xy, "PING_INTERVAL", 5e3), e(xy, "MAX_MISSED_PINGS", 4), e(xy, "TLS_ROUNDTRIPS", 3), e(xy, "start", (e, t, n, r) => new Promise((i, a) => {
9007
- let o = new gy(e, t, n, r);
9064
+ Ly = Hy, e(Hy, "PING_INTERVAL", 5e3), e(Hy, "MAX_MISSED_PINGS", 4), e(Hy, "TLS_ROUNDTRIPS", 3), e(Hy, "start", (e, t, n, r) => new Promise((i, a) => {
9065
+ let o = new Ly(e, t, n, r);
9008
9066
  o.transport.once("error", (e) => a(e)), o.transport.once("open", () => {
9009
9067
  var e;
9010
9068
  (e = n.onTransportConnected) == null || e.call(n), i(o);
@@ -9012,51 +9070,52 @@ gy = xy, e(xy, "PING_INTERVAL", 5e3), e(xy, "MAX_MISSED_PINGS", 4), e(xy, "TLS_R
9012
9070
  }));
9013
9071
  //#endregion
9014
9072
  //#region ../../libs/web-sdk/src/EdgeSelector.ts
9015
- var Sy = (e) => {
9073
+ var Uy = (e) => {
9016
9074
  var t;
9017
9075
  return typeof e == "string" ? e : `${e.moqWsUrl}|${(t = e.moqUrl) == null ? "" : t}`;
9018
- }, Cy = (e) => typeof e == "string" ? e : e.moqUrl || e.moqWsUrl, wy = /* @__PURE__ */ new WeakMap(), Ty = /* @__PURE__ */ new WeakMap(), Ey = /* @__PURE__ */ new WeakMap(), Dy = /* @__PURE__ */ new WeakMap(), Oy = class {
9076
+ }, Wy = (e) => typeof e == "string" ? e : e.moqUrl || e.moqWsUrl, Gy = /* @__PURE__ */ new WeakMap(), Ky = /* @__PURE__ */ new WeakMap(), qy = /* @__PURE__ */ new WeakMap(), Jy = /* @__PURE__ */ new WeakMap(), Yy = class {
9019
9077
  constructor(e) {
9020
- i(this, wy, void 0), i(this, Ty, []), i(this, Ey, /* @__PURE__ */ new Set()), i(this, Dy, void 0), a(wy, this, e);
9078
+ i(this, Gy, void 0), i(this, Ky, []), i(this, qy, /* @__PURE__ */ new Set()), i(this, Jy, void 0), a(Gy, this, e);
9021
9079
  }
9022
9080
  select(e) {
9023
- if (s(wy, this).edgeUrl) return s(wy, this).edgeUrl;
9081
+ if (s(Gy, this).edgeUrl) return s(Gy, this).edgeUrl;
9024
9082
  if (e.length > 0) {
9025
- a(Ty, this, [...e]);
9026
- let t = new Set(s(Ty, this).map((e) => Sy(e)));
9027
- for (let e of s(Ey, this)) t.has(e) || s(Ey, this).delete(e);
9083
+ a(Ky, this, [...e]);
9084
+ let t = new Set(s(Ky, this).map((e) => Uy(e)));
9085
+ for (let e of s(qy, this)) t.has(e) || s(qy, this).delete(e);
9028
9086
  }
9029
- if (s(Ty, this).length === 0) return;
9030
- let t = s(Ty, this).filter((e) => !s(Ey, this).has(Sy(e)));
9031
- t.length === 0 && (s(Ey, this).clear(), t = s(Ty, this));
9087
+ if (s(Ky, this).length === 0) return;
9088
+ let t = s(Ky, this).filter((e) => !s(qy, this).has(Uy(e)));
9089
+ t.length === 0 && (s(qy, this).clear(), t = s(Ky, this));
9032
9090
  let n = t[0];
9033
- if (n) return s(Ey, this).add(Sy(n)), a(Dy, this, n), n;
9091
+ if (n) return s(qy, this).add(Uy(n)), a(Jy, this, n), n;
9034
9092
  }
9035
9093
  shiftedEdge() {
9036
- return s(Dy, this);
9094
+ return s(Jy, this);
9037
9095
  }
9038
9096
  hasRemainingEdges() {
9039
- return s(Ty, this).some((e) => !s(Ey, this).has(Sy(e)));
9097
+ return s(Ky, this).some((e) => !s(qy, this).has(Uy(e)));
9040
9098
  }
9041
9099
  reset() {
9042
- a(Dy, this, void 0), a(Ty, this, []), s(Ey, this).clear();
9100
+ a(Jy, this, void 0), a(Ky, this, []), s(qy, this).clear();
9043
9101
  }
9044
- }, ky, Ay = /* @__PURE__ */ new WeakMap(), jy = /* @__PURE__ */ new WeakMap(), My = /* @__PURE__ */ new WeakMap(), Ny = /* @__PURE__ */ new WeakMap(), Py = /* @__PURE__ */ new WeakMap(), Fy = /* @__PURE__ */ new WeakMap(), Iy = /* @__PURE__ */ new WeakMap(), Ly = /* @__PURE__ */ new WeakMap(), Ry = /* @__PURE__ */ new WeakMap(), zy = /* @__PURE__ */ new WeakMap(), By = /* @__PURE__ */ new WeakMap(), Vy = /* @__PURE__ */ new WeakMap(), Hy = /* @__PURE__ */ new WeakMap(), Uy = /* @__PURE__ */ new WeakMap(), Wy = /* @__PURE__ */ new WeakMap(), Gy = /* @__PURE__ */ new WeakMap(), Ky = /* @__PURE__ */ new WeakMap(), qy = /* @__PURE__ */ new WeakMap(), Jy = /* @__PURE__ */ new WeakMap(), Yy = /* @__PURE__ */ new WeakSet(), Xy = /* @__PURE__ */ new WeakMap(), Zy = /* @__PURE__ */ new WeakMap(), Qy = /* @__PURE__ */ new WeakMap(), $y = /* @__PURE__ */ new WeakMap(), eb = /* @__PURE__ */ new WeakMap(), tb = /* @__PURE__ */ new WeakMap(), nb = class n {
9102
+ }, Xy, Zy = 3e4, Qy = /* @__PURE__ */ new WeakMap(), $y = /* @__PURE__ */ new WeakMap(), eb = /* @__PURE__ */ new WeakMap(), tb = /* @__PURE__ */ new WeakMap(), nb = /* @__PURE__ */ new WeakMap(), rb = /* @__PURE__ */ new WeakMap(), ib = /* @__PURE__ */ new WeakMap(), ab = /* @__PURE__ */ new WeakMap(), ob = /* @__PURE__ */ new WeakMap(), sb = /* @__PURE__ */ new WeakMap(), cb = /* @__PURE__ */ new WeakMap(), lb = /* @__PURE__ */ new WeakMap(), ub = /* @__PURE__ */ new WeakMap(), db = /* @__PURE__ */ new WeakMap(), fb = /* @__PURE__ */ new WeakMap(), pb = /* @__PURE__ */ new WeakMap(), mb = /* @__PURE__ */ new WeakMap(), hb = /* @__PURE__ */ new WeakMap(), gb = /* @__PURE__ */ new WeakMap(), _b = /* @__PURE__ */ new WeakSet(), vb = /* @__PURE__ */ new WeakMap(), yb = /* @__PURE__ */ new WeakMap(), bb = /* @__PURE__ */ new WeakMap(), xb = /* @__PURE__ */ new WeakMap(), Sb = /* @__PURE__ */ new WeakMap(), Cb = /* @__PURE__ */ new WeakMap(), wb = class n {
9045
9103
  constructor(c, l, u) {
9046
9104
  var d = this;
9047
- x(this, Yy), e(this, "emitter", void 0), e(this, "logger", void 0), e(this, "config", void 0), e(this, "apiClient", void 0), e(this, "connectionImpl", void 0), i(this, Ay, new r(10)), i(this, jy, !0), i(this, My, void 0), i(this, Ny, 0), i(this, Py, 0), i(this, Fy, 0), i(this, Iy, void 0), i(this, Ly, void 0), i(this, Ry, void 0), i(this, zy, void 0), i(this, By, void 0), i(this, Vy, void 0), i(this, Hy, void 0), i(this, Uy, []), i(this, Wy, void 0), e(this, "unload", () => {
9105
+ x(this, _b), e(this, "emitter", void 0), e(this, "logger", void 0), e(this, "config", void 0), e(this, "apiClient", void 0), e(this, "connectionImpl", void 0), i(this, Qy, new r(10)), i(this, $y, !0), i(this, eb, void 0), i(this, tb, 0), i(this, nb, 0), i(this, rb, 0), i(this, ib, void 0), i(this, ab, void 0), i(this, ob, void 0), i(this, sb, void 0), i(this, cb, void 0), i(this, lb, void 0), i(this, ub, void 0), i(this, db, []), i(this, fb, void 0), e(this, "unload", () => {
9048
9106
  var e;
9049
- this.logger.debug("Unloading module..."), this.disconnect("Unloading"), (e = this.connectionImpl) == null || e.unload(), a(Hy, this, void 0), this.logger.debug("Unloaded module");
9107
+ this.logger.debug("Unloading module..."), this.disconnect("Unloading"), (e = this.connectionImpl) == null || e.unload(), a(ub, this, void 0), this.logger.debug("Unloaded module");
9050
9108
  }), e(this, "suspend", () => {
9051
9109
  var e;
9052
- a(jy, this, !1), (e = this.connectionImpl) == null || e.suspend();
9110
+ a($y, this, !1), (e = this.connectionImpl) == null || e.suspend();
9053
9111
  }), e(this, "unsuspend", () => {
9054
9112
  var e;
9055
- a(jy, this, !0), (e = this.connectionImpl) == null || e.unsuspend(), this.connect();
9113
+ a($y, this, !0), (e = this.connectionImpl) == null || e.unsuspend(), this.connect();
9056
9114
  }), e(this, "getState", () => this.connectionImpl ? this.connectionImpl.getState() : "disconnected"), e(this, "getStatistics", () => {
9057
- let e = s(Py, this) > 0 ? s(Fy, this) / s(Py, this) : 0;
9115
+ var e;
9116
+ let t = s(nb, this) > 0 ? s(rb, this) / s(nb, this) : 0;
9058
9117
  if (!this.connectionImpl) {
9059
- let t = s(Gy, this).call(this);
9118
+ let e = s(pb, this).call(this);
9060
9119
  return {
9061
9120
  rtt: {
9062
9121
  min: 0,
@@ -9065,35 +9124,42 @@ var Sy = (e) => {
9065
9124
  last: 0
9066
9125
  },
9067
9126
  estimatedBandwidth: 0,
9068
- connectCount: s(Fy, this),
9069
- connectionAttemptCount: s(Py, this),
9070
- connectionSuccessRatio: e,
9071
- timeToConnected: s(zy, this),
9072
- edgeUrl: t == null ? void 0 : t.edgeUrl,
9073
- connectionProtocol: t == null ? void 0 : t.connectionProtocol,
9074
- transportSelectionReason: t == null ? void 0 : t.transportSelectionReason
9127
+ connectCount: s(rb, this),
9128
+ connectionAttemptCount: s(nb, this),
9129
+ connectionSuccessRatio: t,
9130
+ timeToConnected: s(sb, this),
9131
+ edgeUrl: e == null ? void 0 : e.edgeUrl,
9132
+ connectionProtocol: e == null ? void 0 : e.connectionProtocol,
9133
+ transportSelectionReason: e == null ? void 0 : e.transportSelectionReason
9075
9134
  };
9076
9135
  }
9077
- return y(y({}, this.connectionImpl.getStatistics()), {}, {
9078
- rtt: xt(s(Ay, this).items()),
9136
+ let n = this.connectionImpl.getStatistics(), r = (e = this.connectionImpl.linkQueue) == null ? void 0 : e.summary(Zy);
9137
+ return y(y({}, n), {}, {
9138
+ linkQueue: r && {
9139
+ last: Math.round(r.last),
9140
+ average: Math.round(r.average),
9141
+ max: Math.round(r.max),
9142
+ min: Math.round(r.min)
9143
+ },
9144
+ rtt: xt(s(Qy, this).items()),
9079
9145
  estimatedBandwidth: this.estimatedBandwidth,
9080
- connectCount: s(Fy, this),
9081
- connectionAttemptCount: s(Py, this),
9082
- connectionSuccessRatio: e,
9083
- timeToConnected: s(zy, this)
9146
+ connectCount: s(rb, this),
9147
+ connectionAttemptCount: s(nb, this),
9148
+ connectionSuccessRatio: t,
9149
+ timeToConnected: s(sb, this)
9084
9150
  });
9085
- }), i(this, Gy, () => s(jy, this) && s(Vy, this) ? s(Vy, this) : s(By, this)), e(this, "connect", () => {
9086
- if (a(jy, this, !0), s(My, this)) return;
9151
+ }), i(this, pb, () => s($y, this) && s(lb, this) ? s(lb, this) : s(cb, this)), e(this, "connect", () => {
9152
+ if (a($y, this, !0), s(eb, this)) return;
9087
9153
  let e = performance.now();
9088
- s(zy, this) === void 0 && a(Iy, this, e), s(Ly, this) === void 0 && a(Ly, this, e), a(My, this, o(Yy, this, rb).call(this));
9089
- }), i(this, Ky, () => {
9090
- s(zy, this) !== void 0 || s(Iy, this) === void 0 || !s(jy, this) || (a(zy, this, performance.now() - s(Iy, this)), a(Iy, this, void 0));
9154
+ s(sb, this) === void 0 && a(ib, this, e), s(ab, this) === void 0 && a(ab, this, e), a(eb, this, o(_b, this, Tb).call(this));
9155
+ }), i(this, mb, () => {
9156
+ s(sb, this) !== void 0 || s(ib, this) === void 0 || !s($y, this) || (a(sb, this, performance.now() - s(ib, this)), a(ib, this, void 0));
9091
9157
  }), e(this, "disconnect", (e = "Disconnect Requested") => {
9092
9158
  var t;
9093
- a(jy, this, !1), s(Zy, this).call(this), (t = this.connectionImpl) == null || t.close(e);
9159
+ a($y, this, !1), s(yb, this).call(this), (t = this.connectionImpl) == null || t.close(e);
9094
9160
  }), e(this, "reconnect", (e) => {
9095
9161
  this.disconnect(e), this.connect();
9096
- }), i(this, qy, t(function* () {
9162
+ }), i(this, hb, t(function* () {
9097
9163
  try {
9098
9164
  return yield d.apiClient.connect(d.config.options.getOptions());
9099
9165
  } catch (e) {
@@ -9104,7 +9170,7 @@ var Sy = (e) => {
9104
9170
  }
9105
9171
  throw d.emitter.emit("error", $n(e instanceof Error ? e : void 0)), e;
9106
9172
  }
9107
- })), i(this, Jy, t(function* () {
9173
+ })), i(this, gb, t(function* () {
9108
9174
  let e = performance.now(), t = () => performance.now() - e, r = globalThis.AbortController ? new AbortController() : void 0, i = setTimeout(() => r == null ? void 0 : r.abort(), n.PING_TIMEOUT);
9109
9175
  try {
9110
9176
  return yield fetch(new URL("/api/v4/connect/ping", d.config.options.get("url")).toString(), {
@@ -9116,27 +9182,27 @@ var Sy = (e) => {
9116
9182
  } finally {
9117
9183
  clearTimeout(i);
9118
9184
  }
9119
- })), i(this, Xy, () => {
9120
- s(Zy, this).call(this), a(Wy, this, setTimeout(() => {
9185
+ })), i(this, vb, () => {
9186
+ s(yb, this).call(this), a(fb, this, setTimeout(() => {
9121
9187
  var e;
9122
- !s(Hy, this) || ((e = this.connectionImpl) == null ? void 0 : e.getState()) !== "connected" || (this.logger.debug("Connection remained stable for long enough, clearing cached fallback edges"), s(Hy, this).reset(), a(Wy, this, void 0));
9188
+ !s(ub, this) || ((e = this.connectionImpl) == null ? void 0 : e.getState()) !== "connected" || (this.logger.debug("Connection remained stable for long enough, clearing cached fallback edges"), s(ub, this).reset(), a(fb, this, void 0));
9123
9189
  }, n.EDGE_SELECTOR_RESET_TIMEOUT));
9124
- }), i(this, Zy, () => {
9125
- s(Wy, this) !== void 0 && (clearTimeout(s(Wy, this)), a(Wy, this, void 0));
9126
- }), i(this, Qy, function() {
9190
+ }), i(this, yb, () => {
9191
+ s(fb, this) !== void 0 && (clearTimeout(s(fb, this)), a(fb, this, void 0));
9192
+ }), i(this, bb, function() {
9127
9193
  var e = t(function* (e) {
9128
- return (yield d.config.reconnectHandler({ reconnectRetries: s(Ny, d) })) ? (s(eb, d).call(d) ? (d.logger.info("Reconnect burst detected, applying backoff before retrying"), yield ln(n.RECONNECT_BACKOFF_MS)) : d.logger.info(e === "cached_edge" ? "Retrying with next cached edge without backoff" : "Retrying without backoff"), s(jy, d)) : (a(jy, d, !1), d.emitter.emit("error", er()), !1);
9194
+ return (yield d.config.reconnectHandler({ reconnectRetries: s(tb, d) })) ? (s(Sb, d).call(d) ? (d.logger.info("Reconnect burst detected, applying backoff before retrying"), yield ln(n.RECONNECT_BACKOFF_MS)) : d.logger.info(e === "cached_edge" ? "Retrying with next cached edge without backoff" : "Retrying without backoff"), s($y, d)) : (a($y, d, !1), d.emitter.emit("error", er()), !1);
9129
9195
  });
9130
9196
  return function(t) {
9131
9197
  return e.apply(this, arguments);
9132
9198
  };
9133
- }()), i(this, $y, (e = performance.now()) => {
9134
- s(tb, this).call(this, e), s(Uy, this).push(e);
9135
- }), i(this, eb, (e = performance.now()) => (s(tb, this).call(this, e), s(Uy, this).length >= n.RECONNECT_BACKOFF_BURST_THRESHOLD)), i(this, tb, (e) => {
9136
- for (; s(Uy, this).length > 0;) {
9137
- let t = s(Uy, this)[0];
9199
+ }()), i(this, xb, (e = performance.now()) => {
9200
+ s(Cb, this).call(this, e), s(db, this).push(e);
9201
+ }), i(this, Sb, (e = performance.now()) => (s(Cb, this).call(this, e), s(db, this).length >= n.RECONNECT_BACKOFF_BURST_THRESHOLD)), i(this, Cb, (e) => {
9202
+ for (; s(db, this).length > 0;) {
9203
+ let t = s(db, this)[0];
9138
9204
  if (t === void 0 || t > e - n.RECONNECT_BACKOFF_BURST_WINDOW_MS) return;
9139
- s(Uy, this).shift();
9205
+ s(db, this).shift();
9140
9206
  }
9141
9207
  }), this.logger = l, this.emitter = c, this.config = u, this.apiClient = new g({
9142
9208
  publicEndpoint: this.config.options.get("url").toString(),
@@ -9144,60 +9210,60 @@ var Sy = (e) => {
9144
9210
  });
9145
9211
  }
9146
9212
  get rtt() {
9147
- return s(Ay, this).items().length > 0 ? vt(s(Ay, this).items()) : 0;
9213
+ return s(Qy, this).items().length > 0 ? vt(s(Qy, this).items()) : 0;
9148
9214
  }
9149
9215
  get isMoq() {
9150
- return this.connectionImpl instanceof Qv;
9216
+ return this.connectionImpl instanceof yy;
9151
9217
  }
9152
9218
  get estimatedBandwidth() {
9153
9219
  if (this.connectionImpl && "estimatedBandwidth" in this.connectionImpl) {
9154
9220
  let e = this.connectionImpl.estimatedBandwidth;
9155
9221
  if (e && Number.isFinite(e)) return e;
9156
9222
  }
9157
- return by(this.rtt);
9223
+ return Vy(this.rtt);
9158
9224
  }
9159
9225
  get firstConnectStartTime() {
9160
- return s(Ly, this);
9226
+ return s(ab, this);
9161
9227
  }
9162
9228
  get lastConnectionTime() {
9163
- return s(Ry, this);
9229
+ return s(ob, this);
9164
9230
  }
9165
9231
  };
9166
- ky = nb;
9167
- function rb() {
9232
+ Xy = wb;
9233
+ function Tb() {
9168
9234
  var e = this;
9169
9235
  return t(function* () {
9170
- let t = new Oy({ edgeUrl: e.config.options.get("edgeUrl") });
9171
- for (a(Hy, e, t), s(Zy, e).call(e), a(Ny, e, 0), a(Uy, e, []);;) {
9236
+ let t = new Yy({ edgeUrl: e.config.options.get("edgeUrl") });
9237
+ for (a(ub, e, t), s(yb, e).call(e), a(tb, e, 0), a(db, e, []);;) {
9172
9238
  var n, r, i;
9173
9239
  let l = "standard";
9174
- a(Ny, e, (n = s(Ny, e), n++, n)), a(Py, e, (r = s(Py, e), r++, r)), s($y, e).call(e);
9240
+ a(tb, e, (n = s(tb, e), n++, n)), a(nb, e, (r = s(nb, e), r++, r)), s(xb, e).call(e);
9175
9241
  let u = !1;
9176
- a(Vy, e, {});
9242
+ a(lb, e, {});
9177
9243
  try {
9178
9244
  var o;
9179
- let [n, r] = yield Promise.all([s(qy, e).call(e), s(Jy, e).call(e)]);
9180
- if (s(Ay, e).clear(), r !== void 0 && s(Ay, e).push(r / 2), !s(jy, e)) break;
9245
+ let [n, r] = yield Promise.all([s(hb, e).call(e), s(gb, e).call(e)]);
9246
+ if (s(Qy, e).clear(), r !== void 0 && s(Qy, e).push(r / 2), !s($y, e)) break;
9181
9247
  let i = t.select(n.edges);
9182
9248
  if (!i) throw new k("Failed to resolve edge url", {
9183
9249
  isFatal: !0,
9184
9250
  code: "failed_to_resolve_edge_url"
9185
9251
  });
9186
- a(Vy, e, { edgeUrl: Nv(Cy(i)) });
9252
+ a(lb, e, { edgeUrl: Nv(Wy(i)) });
9187
9253
  try {
9188
- c(n) ? e.connectionImpl = yield Qv.start(e.emitter, e.logger, e.apiClient, y(y({}, e.config), {}, {
9254
+ c(n) ? e.connectionImpl = yield yy.start(e.emitter, e.logger, e.apiClient, y(y({}, e.config), {}, {
9189
9255
  connectInfo: n,
9190
9256
  edgeUrl: i,
9191
- onTransportConnected: s(Ky, e)
9192
- }), s(Ay, e)) : (d(typeof i == "string", "Edge URL is expected to be a string"), e.connectionImpl = yield xy.start(e.emitter, e.logger, y(y({}, e.config), {}, {
9257
+ onTransportConnected: s(mb, e)
9258
+ }), s(Qy, e)) : (d(typeof i == "string", "Edge URL is expected to be a string"), e.connectionImpl = yield Hy.start(e.emitter, e.logger, y(y({}, e.config), {}, {
9193
9259
  connectInfo: n,
9194
9260
  edgeUrl: i,
9195
- onTransportConnected: s(Ky, e)
9196
- }), s(Ay, e)));
9261
+ onTransportConnected: s(mb, e)
9262
+ }), s(Qy, e)));
9197
9263
  } catch (e) {
9198
9264
  throw l = "cached_edge", e;
9199
9265
  }
9200
- a(By, e, e.connectionImpl.getStatistics()), a(Vy, e, void 0), s(jy, e) || e.connectionImpl.close("Disconnected during connect"), s(Xy, e).call(e), a(Fy, e, (o = s(Fy, e), o++, o)), a(Ny, e, 0), a(Ry, e, performance.now()), s(Ky, e).call(e);
9266
+ a(cb, e, e.connectionImpl.getStatistics()), a(lb, e, void 0), s($y, e) || e.connectionImpl.close("Disconnected during connect"), s(vb, e).call(e), a(rb, e, (o = s(rb, e), o++, o)), a(tb, e, 0), a(ob, e, performance.now()), s(mb, e).call(e);
9201
9267
  let u = yield e.connectionImpl.closed();
9202
9268
  e.logger.info("Connection closed", { reason: u instanceof Error ? u.message : u }), l = "cached_edge";
9203
9269
  } catch (n) {
@@ -9205,32 +9271,32 @@ function rb() {
9205
9271
  let r = t.shiftedEdge();
9206
9272
  r && e.emitter.emit("telemetry event", {
9207
9273
  code: "shifted_edge",
9208
- edgeUrl: Cy(r)
9274
+ edgeUrl: Wy(r)
9209
9275
  }), n instanceof k ? (e.emitter.emit("error", n), u = n.isFatal()) : n instanceof Error && e.emitter.emit("error", new k(n.message, {
9210
9276
  code: "start_failed",
9211
9277
  isFatal: !1
9212
9278
  }));
9213
9279
  }
9214
- if ((i = e.connectionImpl) == null || i.unload(), e.connectionImpl = void 0, s(Zy, e).call(e), u) {
9215
- a(jy, e, !1);
9280
+ if ((i = e.connectionImpl) == null || i.unload(), e.connectionImpl = void 0, s(yb, e).call(e), u) {
9281
+ a($y, e, !1);
9216
9282
  break;
9217
9283
  }
9218
- if (!s(jy, e) || !(yield s(Qy, e).call(e, l === "cached_edge" && t.hasRemainingEdges() ? "cached_edge" : "standard"))) break;
9284
+ if (!s($y, e) || !(yield s(bb, e).call(e, l === "cached_edge" && t.hasRemainingEdges() ? "cached_edge" : "standard"))) break;
9219
9285
  }
9220
- a(Vy, e, void 0), a(Hy, e, void 0), s(Zy, e).call(e), a(My, e, void 0);
9286
+ a(lb, e, void 0), a(ub, e, void 0), s(yb, e).call(e), a(eb, e, void 0);
9221
9287
  })();
9222
9288
  }
9223
- e(nb, "PING_TIMEOUT", 1e3), e(nb, "RECONNECT_BACKOFF_MS", 1e3), e(nb, "RECONNECT_BACKOFF_BURST_WINDOW_MS", 5e3), e(nb, "RECONNECT_BACKOFF_BURST_THRESHOLD", 3), e(nb, "EDGE_SELECTOR_RESET_TIMEOUT", 60 * 1e3), e(nb, "create", (e, t, n) => new ky(e, t, n));
9289
+ e(wb, "PING_TIMEOUT", 1e3), e(wb, "RECONNECT_BACKOFF_MS", 1e3), e(wb, "RECONNECT_BACKOFF_BURST_WINDOW_MS", 5e3), e(wb, "RECONNECT_BACKOFF_BURST_THRESHOLD", 3), e(wb, "EDGE_SELECTOR_RESET_TIMEOUT", 60 * 1e3), e(wb, "create", (e, t, n) => new Xy(e, t, n));
9224
9290
  //#endregion
9225
9291
  //#region ../../libs/web-sdk/src/modules/ConstraintCapModule.ts
9226
- var ib, ab = () => ({
9292
+ var Eb, Db = () => ({
9227
9293
  video: y(y({}, hn()), {}, { bitRate: mn() }),
9228
9294
  audio: { bitRate: mn() }
9229
- }), ob = () => ({
9295
+ }), Ob = () => ({
9230
9296
  width: window.innerWidth,
9231
9297
  height: window.innerHeight,
9232
9298
  bitRate: mn()
9233
- }), sb = class t {
9299
+ }), kb = class t {
9234
9300
  constructor(n, r, i, a) {
9235
9301
  e(this, "emitter", void 0), e(this, "timers", new O()), e(this, "pictureInPictureSource", void 0), e(this, "element", void 0), e(this, "currentCap", void 0), e(this, "userSpecifiedCap", void 0), e(this, "renditionLevelSource", void 0), e(this, "resizeObserver", void 0), e(this, "elementSize", void 0), e(this, "_sizeBasedResolutionCapEnabled", void 0), e(this, "unload", () => {
9236
9302
  var e;
@@ -9252,7 +9318,7 @@ var ib, ab = () => ({
9252
9318
  this.timers.unload();
9253
9319
  }), e(this, "setUserSpecifiedCap", (e) => {
9254
9320
  var t;
9255
- let n = (t = this.getUserSpecifiedCap()) == null ? ab() : t;
9321
+ let n = (t = this.getUserSpecifiedCap()) == null ? Db() : t;
9256
9322
  this.userSpecifiedCap = y(y({}, n), {}, {
9257
9323
  video: y(y({}, n.video), e.video),
9258
9324
  audio: y(y({}, n.audio), e.audio)
@@ -9276,7 +9342,7 @@ var ib, ab = () => ({
9276
9342
  });
9277
9343
  }), e(this, "evaluateConstraintCap", () => {
9278
9344
  var e, t, n, r;
9279
- let i = this.sizeBasedResolutionCapEnabled ? y(y({}, ab()), {}, { video: ob() }) : ab();
9345
+ let i = this.sizeBasedResolutionCapEnabled ? y(y({}, Db()), {}, { video: Ob() }) : Db();
9280
9346
  if (!this.resizeObserver) {
9281
9347
  let e = this.element.getBoundingClientRect();
9282
9348
  this.elementSize = {
@@ -9313,20 +9379,20 @@ var ib, ab = () => ({
9313
9379
  this._sizeBasedResolutionCapEnabled = e, this.evaluateConstraintCap();
9314
9380
  }
9315
9381
  };
9316
- ib = sb, e(sb, "CHECK_SIZE_INTERVAL", 1e3), e(sb, "create", (e, t, n, r) => new ib(e, t, n, r));
9382
+ Eb = kb, e(kb, "CHECK_SIZE_INTERVAL", 1e3), e(kb, "create", (e, t, n, r) => new Eb(e, t, n, r));
9317
9383
  //#endregion
9318
9384
  //#region ../../libs/web-sdk/src/renditionKey.ts
9319
- var cb = (e, t) => `${e}\u0000${t == null ? "" : t}`, lb = (e, t, n, r) => e === n && t === r, ub = class {
9385
+ var Ab = (e, t) => `${e}\u0000${t == null ? "" : t}`, jb = (e, t, n, r) => e === n && t === r, Mb = class {
9320
9386
  constructor() {
9321
9387
  e(this, "lastKey", void 0), e(this, "shouldNotify", (e, t) => {
9322
- let n = cb(e, t);
9388
+ let n = Ab(e, t);
9323
9389
  return this.lastKey === n ? !1 : (this.lastKey = n, !0);
9324
9390
  });
9325
9391
  }
9326
- }, db = 5, fb = 40, pb = 1, mb = 3e4, hb = 5, gb = (e) => {
9392
+ }, Nb = 5, Pb = 40, Fb = 1, Ib = 3e4, Lb = 5, Rb = (e) => {
9327
9393
  var t, n;
9328
9394
  return ((t = e.maxCompositionOffsetMs) == null ? 0 : t) - ((n = e.minCompositionOffsetMs) == null ? 0 : n);
9329
- }, _b = (e, t, n) => {
9395
+ }, zb = (e, t, n) => {
9330
9396
  let r = [];
9331
9397
  for (let i of e) {
9332
9398
  let e = r[r.length - 1];
@@ -9340,10 +9406,10 @@ var cb = (e, t) => `${e}\u0000${t == null ? "" : t}`, lb = (e, t, n, r) => e ===
9340
9406
  });
9341
9407
  }
9342
9408
  return r;
9343
- }, vb = (e, t) => {
9409
+ }, Bb = (e, t) => {
9344
9410
  let n = e[e.length - 1];
9345
9411
  n && n.end > t && n.start < t && (n.end = t);
9346
- }, yb = 100, bb = 1e3, xb = class n {
9412
+ }, Vb = 100, Hb = 1e3, Ub = class n {
9347
9413
  constructor(t, n, r, i, a = !1, o = !1, s = !1) {
9348
9414
  e(this, "backgroundTimersEnabled", !1), e(this, "timers", this.createTimers()), e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "trackContexts", void 0), e(this, "playbackSource", void 0), e(this, "isLoaded", !1), e(this, "isSuspended", !1), e(this, "_webCodecsInUse", void 0), e(this, "_audioWebCodecsInUse", void 0), e(this, "_offscreenCanvasInUse", void 0), e(this, "currentVideoDecodeRate", 2), e(this, "decodeRateGraceIntervals", 3), e(this, "isAudioEmitRetryScheduled", !1), e(this, "videoKeyframeTimestamps", []), e(this, "load", () => {
9349
9415
  this.isLoaded = !0, this.armTimers(), this.emitter.on("init segment", this.onInitSegment), this.emitter.on("coded sample", this.decode), this.emitter.on("flush buffers", this.resetContexts);
@@ -9361,8 +9427,8 @@ var cb = (e, t) => `${e}\u0000${t == null ? "" : t}`, lb = (e, t, n, r) => e ===
9361
9427
  }), e(this, "unsuspend", () => {
9362
9428
  this.isSuspended = !1, this.emitDecodedFrames(), this._audioWebCodecsInUse && this.scheduleAudioEmitRetry();
9363
9429
  }), e(this, "armTimers", () => {
9364
- let e = this._audioWebCodecsInUse ? 20 : yb;
9365
- this.timers.setInterval(this.emitDecodedFrames, e), this.timers.setInterval(this.emitDecodeRate, bb);
9430
+ let e = this._audioWebCodecsInUse ? 20 : Vb;
9431
+ this.timers.setInterval(this.emitDecodedFrames, e), this.timers.setInterval(this.emitDecodeRate, Hb);
9366
9432
  }), e(this, "replaceTimers", () => {
9367
9433
  let e = this.isAudioEmitRetryScheduled;
9368
9434
  this.isAudioEmitRetryScheduled = !1, this.timers.unload(), this.timers = this.createTimers(), this.timers.isWorkerBackendUnavailable() && this.logger.warn("Background timer worker is unavailable (likely blocked by CSP or unsupported in this environment). Falling back to main-thread timers; hidden-tab playback may be throttled."), this.isLoaded && (this.armTimers(), e && this.scheduleAudioEmitRetry());
@@ -9431,27 +9497,27 @@ var cb = (e, t) => `${e}\u0000${t == null ? "" : t}`, lb = (e, t, n, r) => e ===
9431
9497
  i.stream = `${e.channelId}/${e.renditionId}`;
9432
9498
  let c = (e.timestamp + a) / e.timescale * 1e3, l = e.duration / e.timescale * 1e3;
9433
9499
  l > 0 && (i.sampleDuration = l);
9434
- let u = i.sampleDuration || fb, d = e.timestamp / e.timescale * 1e3, f = a / e.timescale * 1e3, p = gb(i), m = (t = s[s.length - 1]) == null ? void 0 : t.end, h = Math.max(u * hb, p + ((n = i.frontierSampleDurationMs) == null ? u : n)), g = m !== void 0 && c + h < m;
9500
+ let u = i.sampleDuration || Pb, d = e.timestamp / e.timescale * 1e3, f = a / e.timescale * 1e3, p = Rb(i), m = (t = s[s.length - 1]) == null ? void 0 : t.end, h = Math.max(u * Lb, p + ((n = i.frontierSampleDurationMs) == null ? u : n)), g = m !== void 0 && c + h < m;
9435
9501
  i.lastDecodeTimestampMs = g ? d : Math.max((r = i.lastDecodeTimestampMs) == null ? d : r, d);
9436
- let ee = i.channelId !== void 0 && !lb(i.channelId, i.renditionId, e.channelId, e.renditionId);
9502
+ let ee = i.channelId !== void 0 && !jb(i.channelId, i.renditionId, e.channelId, e.renditionId);
9437
9503
  i.channelId = e.channelId, i.renditionId = e.renditionId, (g || ee) && (i.minCompositionOffsetMs = void 0, i.maxCompositionOffsetMs = void 0, i.hasAnchoredGop = !1, i.isReorderStructureStale = !0);
9438
9504
  let _ = i.hasAnchoredGop === !0;
9439
9505
  if (e.isSync && (i.hasAnchoredGop = !0), !g && i.hasAnchoredGop) {
9440
9506
  var te, v;
9441
9507
  i.minCompositionOffsetMs = Math.min((te = i.minCompositionOffsetMs) == null ? f : te, f), i.maxCompositionOffsetMs = Math.max((v = i.maxCompositionOffsetMs) == null ? f : v, f), _ && (i.isReorderStructureStale = !1);
9442
9508
  }
9443
- let ne = gb(i) > 0;
9509
+ let ne = Rb(i) > 0;
9444
9510
  if (g) i.buffer = [{
9445
9511
  start: c,
9446
9512
  end: c + u
9447
9513
  }], i.frontierSampleDurationMs = u, e.type === "video" && (this.videoKeyframeTimestamps = []);
9448
9514
  else {
9449
9515
  var re;
9450
- !ne && !i.isReorderStructureStale && vb(s, c + u);
9516
+ !ne && !i.isReorderStructureStale && Bb(s, c + u);
9451
9517
  let e = (re = s[s.length - 1]) == null ? void 0 : re.end;
9452
- (e === void 0 || c + u >= e) && (i.frontierSampleDurationMs = u), nn(s, c, c + u, db);
9518
+ (e === void 0 || c + u >= e) && (i.frontierSampleDurationMs = u), nn(s, c, c + u, Nb);
9453
9519
  }
9454
- if (an(i.buffer, this.playbackSource.currentTime - mb), i.playableRangesCache = void 0, e.type === "video" && e.isSync) {
9520
+ if (an(i.buffer, this.playbackSource.currentTime - Ib), i.playableRangesCache = void 0, e.type === "video" && e.isSync) {
9455
9521
  let e = this.videoKeyframeTimestamps[this.videoKeyframeTimestamps.length - 1];
9456
9522
  e !== void 0 && c < e && (this.videoKeyframeTimestamps = []), this.videoKeyframeTimestamps.push(c), this.videoKeyframeTimestamps.length > 20 && (this.videoKeyframeTimestamps = this.videoKeyframeTimestamps.slice(-20));
9457
9523
  }
@@ -9488,11 +9554,11 @@ var cb = (e, t) => `${e}\u0000${t == null ? "" : t}`, lb = (e, t, n, r) => e ===
9488
9554
  }
9489
9555
  this.currentVideoDecodeRate = this.calculateVideoDecodeRate(), this.emitter.emit("video decode rate", this.currentVideoDecodeRate);
9490
9556
  }), e(this, "playableRanges", (e) => {
9491
- let t = gb(e);
9557
+ let t = Rb(e);
9492
9558
  if (t <= 0) return e.buffer;
9493
9559
  if (e.playableRangesCache === void 0) {
9494
9560
  var n, r;
9495
- e.playableRangesCache = _b(e.buffer, ((n = e.lastDecodeTimestampMs) == null ? Infinity : n) - Math.max(0, -((r = e.minCompositionOffsetMs) == null ? 0 : r)) - pb, t + (e.sampleDuration || fb) + pb);
9561
+ e.playableRangesCache = zb(e.buffer, ((n = e.lastDecodeTimestampMs) == null ? Infinity : n) - Math.max(0, -((r = e.minCompositionOffsetMs) == null ? 0 : r)) - Fb, t + (e.sampleDuration || Pb) + Fb);
9496
9562
  }
9497
9563
  return e.playableRangesCache;
9498
9564
  }), e(this, "updateBufferState", () => {
@@ -9579,7 +9645,7 @@ var cb = (e, t) => `${e}\u0000${t == null ? "" : t}`, lb = (e, t, n, r) => e ===
9579
9645
  var e;
9580
9646
  if (this._offscreenCanvasInUse) return (e = this.trackContexts.get("video")) == null ? void 0 : e.decoderContext.videoTrack;
9581
9647
  }
9582
- }, Sb, Cb = class {
9648
+ }, Wb, Gb = class {
9583
9649
  constructor(t) {
9584
9650
  e(this, "emitter", void 0), e(this, "isVisibleCount", 0), e(this, "isHiddenCount", 0), e(this, "isOnlineCount", 0), e(this, "isOfflineCount", 0), e(this, "isActive", document.visibilityState === "visible"), e(this, "isBehindAnotherApp", !1), e(this, "unload", () => {
9585
9651
  this.emitter.off("fullscreen app switch", this.onFullscreenAppSwitch), window.removeEventListener("focus", this.onVisibilityChanged), document.removeEventListener("visibilitychange", this.onVisibilityChanged), window.removeEventListener("pageshow", this.onPageShow), window.removeEventListener("pagehide", this.onPageHide), window.removeEventListener("online", this.onOnline), window.removeEventListener("offline", this.onOffline);
@@ -9609,12 +9675,12 @@ var cb = (e, t) => `${e}\u0000${t == null ? "" : t}`, lb = (e, t, n, r) => e ===
9609
9675
  return document.visibilityState === "visible" && !this.isBehindAnotherApp;
9610
9676
  }
9611
9677
  };
9612
- Sb = Cb, e(Cb, "create", (e) => new Sb(e));
9678
+ Wb = Gb, e(Gb, "create", (e) => new Wb(e));
9613
9679
  //#endregion
9614
9680
  //#region ../../libs/web-sdk/src/modules/EventModule.ts
9615
- var wb, Tb = (e) => (t, n, r) => t.timestamp <= n || t.timestampAdded <= r - e, Eb = class t {
9681
+ var Kb, qb = (e) => (t, n, r) => t.timestamp <= n || t.timestampAdded <= r - e, Jb = class t {
9616
9682
  constructor(n, r, i) {
9617
- e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "waitingEvents", []), e(this, "isTriggered", Tb(t.EVENT_TIMEOUT)), e(this, "timeSource", void 0), e(this, "timers", new O()), e(this, "load", () => {
9683
+ e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "waitingEvents", []), e(this, "isTriggered", qb(t.EVENT_TIMEOUT)), e(this, "timeSource", void 0), e(this, "timers", new O()), e(this, "load", () => {
9618
9684
  this.timers.setInterval(this.onBufferedStateChanged, t.EVENT_CHECK_INTERVAL), this.emitter.on("add event", this.addEvent);
9619
9685
  }), e(this, "unload", () => {
9620
9686
  this.timers.unload(), this.emitter.off("add event", this.addEvent);
@@ -9641,10 +9707,10 @@ var wb, Tb = (e) => (t, n, r) => t.timestamp <= n || t.timestampAdded <= r - e,
9641
9707
  }), this.logger = r, this.emitter = n, this.timeSource = i;
9642
9708
  }
9643
9709
  };
9644
- wb = Eb, e(Eb, "EVENT_TIMEOUT", 5e3), e(Eb, "EVENT_CHECK_INTERVAL", 20), e(Eb, "create", (e, t, n) => new wb(e, t, n));
9710
+ Kb = Jb, e(Jb, "EVENT_TIMEOUT", 5e3), e(Jb, "EVENT_CHECK_INTERVAL", 20), e(Jb, "create", (e, t, n) => new Kb(e, t, n));
9645
9711
  //#endregion
9646
9712
  //#region ../../libs/web-sdk/src/modules/JitterModule.ts
9647
- var Db = 1e3, Ob = 50, kb = class t {
9713
+ var Yb = 1e3, Xb = 50, Zb = class t {
9648
9714
  constructor(t) {
9649
9715
  e(this, "logger", void 0), e(this, "trackingState", /* @__PURE__ */ new Map()), e(this, "runningJitter", /* @__PURE__ */ new Map()), e(this, "recentJitterSamples", /* @__PURE__ */ new Map()), e(this, "load", () => {
9650
9716
  this.logger.debug("JitterModule loaded");
@@ -9665,9 +9731,9 @@ var Db = 1e3, Ob = 50, kb = class t {
9665
9731
  this.trackingState.set(n, {
9666
9732
  lastArrivalTime: i,
9667
9733
  lastTimestampMs: a,
9668
- jitterSamples: new r(Db),
9669
- interArrivalTimes: new r(Db)
9670
- }), this.runningJitter.set(n, 0), this.recentJitterSamples.set(n, new r(Ob));
9734
+ jitterSamples: new r(Yb),
9735
+ interArrivalTimes: new r(Yb)
9736
+ }), this.runningJitter.set(n, 0), this.recentJitterSamples.set(n, new r(Xb));
9671
9737
  return;
9672
9738
  }
9673
9739
  let s = a - o.lastTimestampMs;
@@ -9680,7 +9746,7 @@ var Db = 1e3, Ob = 50, kb = class t {
9680
9746
  let u = (t = this.runningJitter.get(n)) == null ? 0 : t, d = u + (l - u) / 16;
9681
9747
  this.runningJitter.set(n, d);
9682
9748
  let f = this.recentJitterSamples.get(n);
9683
- f || (f = new r(Ob), this.recentJitterSamples.set(n, f)), f.push(l), o.lastArrivalTime = i, o.lastTimestampMs = a;
9749
+ f || (f = new r(Xb), this.recentJitterSamples.set(n, f)), f.push(l), o.lastArrivalTime = i, o.lastTimestampMs = a;
9684
9750
  }
9685
9751
  getJitterForType(e) {
9686
9752
  for (let [i, a] of this.trackingState) if (i.startsWith(e)) {
@@ -9711,10 +9777,10 @@ var Db = 1e3, Ob = 50, kb = class t {
9711
9777
  videoJitter: this.getJitterForType("video")
9712
9778
  };
9713
9779
  }
9714
- }, Ab = () => window.AudioContext || window.webkitAudioContext, jb = class r extends ie {
9780
+ }, Qb = () => window.AudioContext || window.webkitAudioContext, $b = class r extends ie {
9715
9781
  constructor() {
9716
9782
  var i;
9717
- super(), i = this, e(this, "context", new (Ab())()), e(this, "timers", O.create()), e(this, "previousCurrentTime", 0), e(this, "_isStuck", !1), e(this, "mediaStreamDestination", void 0), e(this, "unload", () => (this.timers.unload(), this.context.removeEventListener("statechange", this.onStateChange), this.context.state === "closed" ? Promise.resolve() : this.context.close())), e(this, "createGain", () => this.context.createGain()), e(this, "createBuffer", (e, t, n) => this.context.createBuffer(e, t, n)), e(this, "createBufferSource", () => this.context.createBufferSource()), e(this, "getMediaStreamDestination", () => (this.mediaStreamDestination || (this.mediaStreamDestination = this.context.createMediaStreamDestination()), this.mediaStreamDestination)), e(this, "getDefaultDestination", () => this.context.destination), e(this, "createSplitter", () => this.context.createChannelSplitter(2)), e(this, "resume", t(function* () {
9783
+ super(), i = this, e(this, "context", new (Qb())()), e(this, "timers", O.create()), e(this, "previousCurrentTime", 0), e(this, "_isStuck", !1), e(this, "mediaStreamDestination", void 0), e(this, "unload", () => (this.timers.unload(), this.context.removeEventListener("statechange", this.onStateChange), this.context.state === "closed" ? Promise.resolve() : this.context.close())), e(this, "createGain", () => this.context.createGain()), e(this, "createBuffer", (e, t, n) => this.context.createBuffer(e, t, n)), e(this, "createBufferSource", () => this.context.createBufferSource()), e(this, "getMediaStreamDestination", () => (this.mediaStreamDestination || (this.mediaStreamDestination = this.context.createMediaStreamDestination()), this.mediaStreamDestination)), e(this, "getDefaultDestination", () => this.context.destination), e(this, "createSplitter", () => this.context.createChannelSplitter(2)), e(this, "resume", t(function* () {
9718
9784
  let e = !0, t = i.context.resume();
9719
9785
  t.then(() => {
9720
9786
  e = !1;
@@ -9749,10 +9815,10 @@ var Db = 1e3, Ob = 50, kb = class t {
9749
9815
  return this.context.state;
9750
9816
  }
9751
9817
  };
9752
- e(jb, "CHECK_INTERVAL", 1e3);
9818
+ e($b, "CHECK_INTERVAL", 1e3);
9753
9819
  //#endregion
9754
9820
  //#region ../../libs/web-audio-player/src/AudioPlayer.ts
9755
- var Mb, Nb = 150, Pb = 400, Fb = (e) => e === void 0 ? 5 : e <= Nb ? 1 : e <= Pb ? 2 : 5, Ib = class extends ie {
9821
+ var ex, tx = 150, nx = 400, rx = (e) => e === void 0 ? 5 : e <= tx ? 1 : e <= nx ? 2 : 5, ix = class extends ie {
9756
9822
  get isContextRunning() {
9757
9823
  var e;
9758
9824
  return ((e = this.audio) == null ? void 0 : e.state) === "running";
@@ -9799,7 +9865,7 @@ var Mb, Nb = 150, Pb = 400, Fb = (e) => e === void 0 ? 5 : e <= Nb ? 1 : e <= Pb
9799
9865
  return this._bufferTime;
9800
9866
  }
9801
9867
  set bufferTime(e) {
9802
- this._bufferTime = e, this.audioBufferMultiplier = Fb(e);
9868
+ this._bufferTime = e, this.audioBufferMultiplier = rx(e);
9803
9869
  }
9804
9870
  get sinkPaused() {
9805
9871
  return this._sinkPaused;
@@ -9905,7 +9971,7 @@ var Mb, Nb = 150, Pb = 400, Fb = (e) => e === void 0 ? 5 : e <= Nb ? 1 : e <= Pb
9905
9971
  this.ignoreSuspendCalls = !1, this.emit("state change", "suspended");
9906
9972
  }), e(this, "getAudioContext", () => this.audio ? this.audio : this.setupContext()), e(this, "setupContext", () => {
9907
9973
  var e, t, r;
9908
- return (e = this.audio) == null || e.unload(), this.audio = new jb(), this.audio.on("state", (e) => {
9974
+ return (e = this.audio) == null || e.unload(), this.audio = new $b(), this.audio.on("state", (e) => {
9909
9975
  this.logger.info("AudioContext state change", { state: e }), e === "running" && (this._muted = this._userProvidedMuted, this.setGain(this._volume)), !this.ignoreSuspendCalls && this.emit("state change", e);
9910
9976
  }), this.audio.on("stuck", () => {
9911
9977
  if (!this.reInitWhenStuck) {
@@ -9916,7 +9982,7 @@ var Mb, Nb = 150, Pb = 400, Fb = (e) => e === void 0 ? 5 : e <= Nb ? 1 : e <= Pb
9916
9982
  }), (t = this.gainNode) == null || t.disconnect(), this.gainNode = this.audio.createGain(), this.setGain(this._volume), this.startTime = this.audio.currentTime, (r = this.splitter) == null || r.disconnect(), this.splitter = this.audio.createSplitter(), this.audio;
9917
9983
  }), e(this, "setGain", (e) => {
9918
9984
  this.gainNode && (this.gainNode.gain.value = this._muted ? 0 : e);
9919
- }), this._muted = o, this._userProvidedMuted = o, this.logger = i, this.clockSource = a, this.reInitWhenStuck = s, this._bufferTime = c, this.audioBufferMultiplier = Fb(c);
9985
+ }), this._muted = o, this._userProvidedMuted = o, this.logger = i, this.clockSource = a, this.reInitWhenStuck = s, this._bufferTime = c, this.audioBufferMultiplier = rx(c);
9920
9986
  }
9921
9987
  useMediaStreamDestination() {
9922
9988
  var e;
@@ -9929,10 +9995,10 @@ var Mb, Nb = 150, Pb = 400, Fb = (e) => e === void 0 ? 5 : e <= Nb ? 1 : e <= Pb
9929
9995
  return (e = this.gainNode) == null || e.connect(t), t;
9930
9996
  }
9931
9997
  };
9932
- Mb = Ib, e(Ib, "create", (e, t, n) => new Mb(e, t, n));
9998
+ ex = ix, e(ix, "create", (e, t, n) => new ex(e, t, n));
9933
9999
  //#endregion
9934
10000
  //#region ../../libs/web-sdk/src/players/VideoPlayer.ts
9935
- var Lb, Rb = class {
10001
+ var ax, ox = class {
9936
10002
  constructor(t, n, r, i, a, o) {
9937
10003
  e(this, "staleFrameThresholdMs", 400), e(this, "pool", void 0), e(this, "logger", void 0), e(this, "videoRenderer", new Hr()), e(this, "videoFrameCanvas2DRenderer", null), e(this, "renderQueue", []), e(this, "clockSource", void 0), e(this, "isFirstFrame", !0), e(this, "usingWebCodecs", !1), e(this, "onCanvasChangeCallback", void 0), e(this, "onRendererErrorCallback", void 0), e(this, "animationFrameRequest", void 0), e(this, "firstFrameAnimationFrameRequest", void 0), e(this, "pendingFirstFrameSample", void 0), e(this, "renderedFrameCount", 0), e(this, "rendererDroppedFrameCount", 0), e(this, "renderTargetSize", void 0), e(this, "load", () => {
9938
10004
  this.videoRenderer.load(), this.subscribeToContextLost(this.videoRenderer);
@@ -10022,12 +10088,12 @@ var Lb, Rb = class {
10022
10088
  }), this.logger = t, this.clockSource = n, this.pool = r, this.renderTargetSize = i || this.videoRenderer.canvas, this.onCanvasChangeCallback = a, this.onRendererErrorCallback = o;
10023
10089
  }
10024
10090
  };
10025
- Lb = Rb, e(Rb, "create", (e, t, n, r, i, a) => new Lb(e, t, n, r, i, a));
10091
+ ax = ox, e(ox, "create", (e, t, n, r, i, a) => new ax(e, t, n, r, i, a));
10026
10092
  //#endregion
10027
10093
  //#region ../../libs/web-sdk/src/TextTracks.ts
10028
- var zb = /* @__PURE__ */ new WeakMap(), Bb = class {
10094
+ var sx = /* @__PURE__ */ new WeakMap(), cx = class {
10029
10095
  constructor() {
10030
- i(this, zb, []), a(zb, this, []);
10096
+ i(this, sx, []), a(sx, this, []);
10031
10097
  }
10032
10098
  addTextTrack(e, t, n) {
10033
10099
  let r = [], i = {
@@ -10044,43 +10110,43 @@ var zb = /* @__PURE__ */ new WeakMap(), Bb = class {
10044
10110
  t !== -1 && r.splice(t, 1);
10045
10111
  }
10046
10112
  };
10047
- return s(zb, this).push(i), i;
10113
+ return s(sx, this).push(i), i;
10048
10114
  }
10049
10115
  set language(e) {
10050
- s(zb, this).forEach((t) => {
10116
+ s(sx, this).forEach((t) => {
10051
10117
  t.language === e ? t.mode = "showing" : t.mode = "hidden";
10052
10118
  });
10053
10119
  }
10054
10120
  get language() {
10055
10121
  var e;
10056
- return (e = s(zb, this).find((e) => e.mode === "showing")) == null ? void 0 : e.language;
10122
+ return (e = s(sx, this).find((e) => e.mode === "showing")) == null ? void 0 : e.language;
10057
10123
  }
10058
10124
  get tracks() {
10059
- return s(zb, this);
10125
+ return s(sx, this);
10060
10126
  }
10061
10127
  get activeTrack() {
10062
- return s(zb, this).find((e) => e.mode === "showing");
10128
+ return s(sx, this).find((e) => e.mode === "showing");
10063
10129
  }
10064
10130
  getActiveCues(e) {
10065
- let t = s(zb, this).find((e) => e.mode === "showing");
10131
+ let t = s(sx, this).find((e) => e.mode === "showing");
10066
10132
  return t ? t.cues.filter(({ startTime: t, endTime: n }) => e >= t && e < n) : [];
10067
10133
  }
10068
- }, Vb = (e, t) => {
10134
+ }, lx = (e, t) => {
10069
10135
  let n;
10070
10136
  for (n = t; e > 1; e--) n += t;
10071
10137
  return n;
10072
- }, Hb = class {
10138
+ }, ux = class {
10073
10139
  constructor() {
10074
10140
  e(this, "audio", void 0), e(this, "unmute", () => this.audio.play().catch(n));
10075
10141
  let t = document.createElement("div");
10076
10142
  t.innerHTML = "<audio x-webkit-airplay='deny'></audio>";
10077
10143
  let r = t.children.item(0);
10078
- if (r instanceof HTMLAudioElement) this.audio = r, this.audio.controls = !1, this.audio.disableRemotePlayback = !0, this.audio.preload = "auto", this.audio.src = "data:audio/mpeg;base64,//uQx" + Vb(23, "A") + "WGluZwAAAA8AAAACAAACcQCA" + Vb(16, "gICA") + Vb(66, "/") + "8AAABhTEFNRTMuMTAwA8MAAAAAAAAAABQgJAUHQQAB9AAAAnGMHkkI" + Vb(320, "A") + "//sQxAADgnABGiAAQBCqgCRMAAgEAH" + Vb(15, "/") + "7+n/9FTuQsQH//////2NG0jWUGlio5gLQTOtIoeR2WX////X4s9Atb/JRVCbBUpeRUq" + Vb(18, "/") + "9RUi0f2jn/+xDECgPCjAEQAABN4AAANIAAAAQVTEFNRTMuMTAw" + Vb(97, "V") + "Q==", this.audio.loop = !1, this.audio.load();
10144
+ if (r instanceof HTMLAudioElement) this.audio = r, this.audio.controls = !1, this.audio.disableRemotePlayback = !0, this.audio.preload = "auto", this.audio.src = "data:audio/mpeg;base64,//uQx" + lx(23, "A") + "WGluZwAAAA8AAAACAAACcQCA" + lx(16, "gICA") + lx(66, "/") + "8AAABhTEFNRTMuMTAwA8MAAAAAAAAAABQgJAUHQQAB9AAAAnGMHkkI" + lx(320, "A") + "//sQxAADgnABGiAAQBCqgCRMAAgEAH" + lx(15, "/") + "7+n/9FTuQsQH//////2NG0jWUGlio5gLQTOtIoeR2WX////X4s9Atb/JRVCbBUpeRUq" + lx(18, "/") + "9RUi0f2jn/+xDECgPCjAEQAABN4AAANIAAAAQVTEFNRTMuMTAw" + lx(97, "V") + "Q==", this.audio.loop = !1, this.audio.load();
10079
10145
  else throw Error("Failed to create audio tag");
10080
10146
  }
10081
- }, Ub, Wb = class {
10147
+ }, dx, fx = class {
10082
10148
  constructor(t, n, r, i, a, o, s, c) {
10083
- e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "audioPlayer", void 0), e(this, "videoPlayer", void 0), e(this, "pool", void 0), e(this, "unmuter", new Hb()), e(this, "_isPaused", !1), e(this, "isDisconnected", !1), e(this, "timers", new O()), e(this, "isVideoRenderingEnabled", !0), e(this, "isLoaded", !1), e(this, "isSuspended", !0), e(this, "isVideoPlayerLoaded", !1), e(this, "volumeState", void 0), e(this, "textTracks", new Bb()), e(this, "playbackRate", void 0), e(this, "emitVolumeState", () => {
10149
+ e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "audioPlayer", void 0), e(this, "videoPlayer", void 0), e(this, "pool", void 0), e(this, "unmuter", new ux()), e(this, "_isPaused", !1), e(this, "isDisconnected", !1), e(this, "timers", new O()), e(this, "isVideoRenderingEnabled", !0), e(this, "isLoaded", !1), e(this, "isSuspended", !0), e(this, "isVideoPlayerLoaded", !1), e(this, "volumeState", void 0), e(this, "textTracks", new cx()), e(this, "playbackRate", void 0), e(this, "emitVolumeState", () => {
10084
10150
  let e = {
10085
10151
  volume: this.volume,
10086
10152
  isMuted: this.userMuted
@@ -10122,13 +10188,13 @@ var zb = /* @__PURE__ */ new WeakMap(), Bb = class {
10122
10188
  e instanceof Error && this.emitter.emit("error", Bn(!1, e));
10123
10189
  }
10124
10190
  this.isVideoRenderingEnabled && this.videoPlayer.onDecodedFrame(e);
10125
- }), this.logger = n, this.emitter = t, this.pool = r, this.emitter.on("target buffer time", this.onTargetBufferTime), this.audioPlayer = Ib.create(this.logger.createContext("AudioPlayerModule"), i, {
10191
+ }), this.logger = n, this.emitter = t, this.pool = r, this.emitter.on("target buffer time", this.onTargetBufferTime), this.audioPlayer = ix.create(this.logger.createContext("AudioPlayerModule"), i, {
10126
10192
  muted: a,
10127
10193
  reInitWhenStuck: !0,
10128
10194
  bufferTime: c
10129
10195
  }), o !== void 0 && (this.audioPlayer.volume = o), this.audioPlayer.on("stuck", () => {
10130
10196
  this.isDisconnected = !0;
10131
- }), this.audioPlayer.on("state change", this.emitVolumeState), this.videoPlayer = Rb.create(this.logger.createContext("VideoPlayerModule"), this.audioPlayer, this.pool, void 0, s);
10197
+ }), this.audioPlayer.on("state change", this.emitVolumeState), this.videoPlayer = ox.create(this.logger.createContext("VideoPlayerModule"), this.audioPlayer, this.pool, void 0, s);
10132
10198
  }
10133
10199
  get volume() {
10134
10200
  return this.audioPlayer.volume;
@@ -10187,29 +10253,29 @@ var zb = /* @__PURE__ */ new WeakMap(), Bb = class {
10187
10253
  this._isPaused = !0, this.audioPlayer.pause(), this.emitter.emit("media element state", "paused");
10188
10254
  }
10189
10255
  };
10190
- Ub = Wb, e(Wb, "create", (e, t, n, r, i, a, o, s) => new Ub(e, t, n, r, i, a, o, s));
10256
+ dx = fx, e(fx, "create", (e, t, n, r, i, a, o, s) => new dx(e, t, n, r, i, a, o, s));
10191
10257
  //#endregion
10192
10258
  //#region ../../libs/web-sdk/src/modules/MediaSessionModule.ts
10193
- var Gb, Kb = [
10259
+ var px, mx = [
10194
10260
  "play",
10195
10261
  "pause",
10196
10262
  "stop"
10197
- ], qb, Jb = /* @__PURE__ */ new Set(), Yb = class t {
10263
+ ], hx, gx = /* @__PURE__ */ new Set(), _x = class t {
10198
10264
  constructor(n, r, i) {
10199
10265
  e(this, "emitter", void 0), e(this, "logger", void 0), e(this, "options", void 0), e(this, "isLoaded", !1), e(this, "playbackState", void 0), e(this, "pageMetadata", null), e(this, "load", () => {
10200
- this.isLoaded || !t.isSupported() || (this.isLoaded = !0, Jb.add(this), this.emitter.on("playback state", this.onPlaybackState), this.emitter.on("volume state", this.update));
10266
+ this.isLoaded || !t.isSupported() || (this.isLoaded = !0, gx.add(this), this.emitter.on("playback state", this.onPlaybackState), this.emitter.on("volume state", this.update));
10201
10267
  }), e(this, "unload", () => {
10202
10268
  var e;
10203
- this.isLoaded && (this.isLoaded = !1, Jb.delete(this), this.emitter.off("playback state", this.onPlaybackState), this.emitter.off("volume state", this.update), this.handOverOwnership("on unload"), (e = this.options.decoy) == null || e.unload());
10269
+ this.isLoaded && (this.isLoaded = !1, gx.delete(this), this.emitter.off("playback state", this.onPlaybackState), this.emitter.off("volume state", this.update), this.handOverOwnership("on unload"), (e = this.options.decoy) == null || e.unload());
10204
10270
  }), e(this, "stop", () => {
10205
10271
  var e;
10206
- this.playbackState = void 0, (e = this.options.decoy) == null || e.unload(), qb === this && this.handOverOwnership("on stop");
10272
+ this.playbackState = void 0, (e = this.options.decoy) == null || e.unload(), hx === this && this.handOverOwnership("on stop");
10207
10273
  }), e(this, "getStatistics", () => {
10208
10274
  var e;
10209
10275
  return {
10210
10276
  mediaSessionSupported: t.isSupported(),
10211
- mediaSessionOwner: qb === this,
10212
- mediaSessionPlaybackState: qb === this ? this.isPaused ? "paused" : "playing" : "none",
10277
+ mediaSessionOwner: hx === this,
10278
+ mediaSessionPlaybackState: hx === this ? this.isPaused ? "paused" : "playing" : "none",
10213
10279
  decoyState: (e = this.options.decoy) == null ? void 0 : e.getStatistics().decoyState
10214
10280
  };
10215
10281
  }), e(this, "onPlaybackState", (e) => {
@@ -10218,23 +10284,23 @@ var Gb, Kb = [
10218
10284
  this.update();
10219
10285
  }), e(this, "update", () => {
10220
10286
  if (this.isLoaded) {
10221
- if (this.isEligibleToOwn && qb !== this) {
10287
+ if (this.isEligibleToOwn && hx !== this) {
10222
10288
  this.claimOwnership();
10223
10289
  return;
10224
10290
  }
10225
10291
  this.sync();
10226
10292
  }
10227
10293
  }), e(this, "handOverOwnership", (e) => {
10228
- if (qb === this) {
10294
+ if (hx === this) {
10229
10295
  this.logger.debug(`Handing over the media session ${e}`), this.releaseOwnership();
10230
- for (let e of Jb) if (e !== this && e.isEligibleToOwn) {
10296
+ for (let e of gx) if (e !== this && e.isEligibleToOwn) {
10231
10297
  e.claimOwnership();
10232
10298
  return;
10233
10299
  }
10234
10300
  }
10235
10301
  }), e(this, "sync", () => {
10236
10302
  var e, t, n, r, i, a;
10237
- if (qb !== this) return;
10303
+ if (hx !== this) return;
10238
10304
  if ((e = (t = this.options).isSuppressed) != null && e.call(t)) {
10239
10305
  var o;
10240
10306
  (o = this.options.decoy) == null || o.unload(), this.handOverOwnership("as suppressed");
@@ -10267,8 +10333,8 @@ var Gb, Kb = [
10267
10333
  (f = this.options.decoy) == null || f.play();
10268
10334
  }
10269
10335
  }), e(this, "claimOwnership", () => {
10270
- qb == null || qb.releaseOwnership(), qb = this, this.pageMetadata = navigator.mediaSession.metadata, this.applyMetadata();
10271
- for (let e of Kb) this.safely(e, () => navigator.mediaSession.setActionHandler(e, this.onAction[e]));
10336
+ hx == null || hx.releaseOwnership(), hx = this, this.pageMetadata = navigator.mediaSession.metadata, this.applyMetadata();
10337
+ for (let e of mx) this.safely(e, () => navigator.mediaSession.setActionHandler(e, this.onAction[e]));
10272
10338
  this.safely("position state", () => {
10273
10339
  var e, t;
10274
10340
  return (e = (t = navigator.mediaSession).setPositionState) == null ? void 0 : e.call(t, {
@@ -10284,9 +10350,9 @@ var Gb, Kb = [
10284
10350
  });
10285
10351
  }), e(this, "releaseOwnership", () => {
10286
10352
  var e;
10287
- if (qb === this) {
10288
- qb = void 0, (e = this.options.decoy) == null || e.pause();
10289
- for (let e of Kb) this.safely(e, () => navigator.mediaSession.setActionHandler(e, null));
10353
+ if (hx === this) {
10354
+ hx = void 0, (e = this.options.decoy) == null || e.pause();
10355
+ for (let e of mx) this.safely(e, () => navigator.mediaSession.setActionHandler(e, null));
10290
10356
  this.options.metadata && this.safely("metadata restore", () => {
10291
10357
  navigator.mediaSession.metadata = this.pageMetadata;
10292
10358
  }), this.safely("release", () => {
@@ -10320,15 +10386,15 @@ var Gb, Kb = [
10320
10386
  return this.playbackState !== void 0 && !this.isPaused && !this.options.isMuted() && ((e = (t = this.options).isSuppressed) == null ? void 0 : e.call(t)) !== !0;
10321
10387
  }
10322
10388
  };
10323
- Gb = Yb, e(Yb, "create", (e, t, n) => new Gb(e, t, n)), e(Yb, "isSupported", () => typeof navigator < "u" && "mediaSession" in navigator && typeof MediaMetadata < "u");
10389
+ px = _x, e(_x, "create", (e, t, n) => new px(e, t, n)), e(_x, "isSupported", () => typeof navigator < "u" && "mediaSession" in navigator && typeof MediaMetadata < "u");
10324
10390
  //#endregion
10325
10391
  //#region ../../libs/web-sdk/src/modules/ModernCanvasModule.ts
10326
- var Xb, Zb = class {
10392
+ var vx, yx = class {
10327
10393
  constructor(t, r, i, a, { muted: o, volume: s, type: c, poster: l, offscreenCanvas: u, bufferTime: d, backgroundPlaybackEnabled: f, splitAudio: p }) {
10328
10394
  if (e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "mediaElement", void 0), e(this, "sound", void 0), e(this, "wantsPlay", void 0), e(this, "audioPlayer", void 0), e(this, "videoPlayer", void 0), e(this, "pool", void 0), e(this, "isDisconnected", !0), e(this, "_userProvidedMuted", !1), e(this, "timers", new O()), e(this, "offscreenCanvas", void 0), e(this, "videoTrack", void 0), e(this, "canvasCaptureTracks", []), e(this, "backgroundPlaybackEnabled", void 0), e(this, "nativeTracksByLanguage", /* @__PURE__ */ new Map()), e(this, "nativeCuesByLanguage", /* @__PURE__ */ new Map()), e(this, "lastCanvasCueTexts", []), e(this, "isIOSNativeFullscreen", !1), e(this, "knownNativeLanguage", void 0), e(this, "renderCanvasSubtitlesInNativeFullscreen", (() => {
10329
10395
  let e = qe().platform;
10330
10396
  return e.isIOS && e.iosVersion <= 16;
10331
- })()), e(this, "volumeState", void 0), e(this, "textTracks", new Bb()), e(this, "reset", () => {}), e(this, "load", () => {
10397
+ })()), e(this, "volumeState", void 0), e(this, "textTracks", new cx()), e(this, "reset", () => {}), e(this, "load", () => {
10332
10398
  this.mediaElement.load(), this.sound && (this.sound.load(), document.body.appendChild(this.sound.element), this.mediaElement.element.addEventListener("pause", this.onVideoPause), this.mediaElement.element.addEventListener("play", this.onVideoPlay), window.addEventListener("focus", this.onWindowFocus)), this.emitter.on("decoded frame", this.onDecodedFrame), this.emitter.on("flush buffers", this.flushBuffers), this.emitter.on("ios-hack: reset size", this.resetCanvasSize), this.emitter.on("enter picture in picture", this.onEnterIOSHack), this.emitter.on("exit picture in picture", this.onExitIOSHack), this.element().element.textTracks.addEventListener("change", this.onNativeTextTrackChange), this.element().element.addEventListener("webkitendfullscreen", this.onExitIOSHack), this.element().element.addEventListener("webkitbeginfullscreen", this.onEnterIOSHack), this.videoPlayer.load(), this.timers.setInterval(this.syncNativeTextTracks, 100);
10333
10399
  }), e(this, "unload", () => {
10334
10400
  this.emitter.off("target buffer time", this.onTargetBufferTime), this.emitter.off("decoded frame", this.onDecodedFrame), this.emitter.off("flush buffers", this.flushBuffers), this.emitter.off("ios-hack: reset size", this.resetCanvasSize), this.emitter.off("enter picture in picture", this.onEnterIOSHack), this.emitter.off("exit picture in picture", this.onExitIOSHack), this.element().element.textTracks.removeEventListener("change", this.onNativeTextTrackChange), this.element().element.removeEventListener("webkitendfullscreen", this.onExitIOSHack), this.element().element.removeEventListener("webkitbeginfullscreen", this.onEnterIOSHack);
@@ -10481,13 +10547,13 @@ var Xb, Zb = class {
10481
10547
  }), this.soundElement.on("media element state", (e) => {
10482
10548
  e === "paused" && this.audioPlayer.flushBuffer(), this.audioPlayer.sinkPaused = e === "paused", this.emitPlaybackState();
10483
10549
  }), this.sound) for (let e of this.elements()) e.on("needs user input", (e) => this.emitter.emit("needs user input", e)), e.on("error", (e) => this.emitter.emit("error", e));
10484
- this.audioPlayer = Ib.create(this.logger.createContext("AudioPlayerModule"), a, {
10550
+ this.audioPlayer = ix.create(this.logger.createContext("AudioPlayerModule"), a, {
10485
10551
  muted: !1,
10486
10552
  reInitWhenStuck: !1,
10487
10553
  bufferTime: d
10488
10554
  }), this.audioPlayer.on("state change", (e) => {
10489
10555
  e === "suspended" || e === "interrupted" ? this.soundElement.muted = !0 : e === "running" && this.applyVisibilityMutePolicy(), this.updateVolumeState();
10490
- }), this.videoPlayer = Rb.create(this.logger.createContext("VideoPlayerModule"), this.audioPlayer, this.pool, this.mediaElement.element, () => this.reconnectCanvasStream(), this.onVideoPlayerError);
10556
+ }), this.videoPlayer = ox.create(this.logger.createContext("VideoPlayerModule"), this.audioPlayer, this.pool, this.mediaElement.element, () => this.reconnectCanvasStream(), this.onVideoPlayerError);
10491
10557
  }
10492
10558
  get volume() {
10493
10559
  return this.soundElement.volume;
@@ -10559,10 +10625,10 @@ var Xb, Zb = class {
10559
10625
  return this.renderCanvasSubtitlesInNativeFullscreen && !this.offscreenCanvas;
10560
10626
  }
10561
10627
  };
10562
- Xb = Zb, e(Zb, "create", (e, t, n, r, i) => new Xb(e, t, n, r, i));
10628
+ vx = yx, e(yx, "create", (e, t, n, r, i) => new vx(e, t, n, r, i));
10563
10629
  //#endregion
10564
10630
  //#region ../../libs/web-sdk/src/modules/MseModule.ts
10565
- var Qb, $b = class {
10631
+ var bx, xx = class {
10566
10632
  constructor() {
10567
10633
  e(this, "initSegments", /* @__PURE__ */ new Map()), e(this, "set", (e, t, n) => {
10568
10634
  var r;
@@ -10574,7 +10640,7 @@ var Qb, $b = class {
10574
10640
  });
10575
10641
  }
10576
10642
  };
10577
- function ex(e, { mediaSource: t, mimeType: n, codec: r }) {
10643
+ function Sx(e, { mediaSource: t, mimeType: n, codec: r }) {
10578
10644
  return y(y({}, e), {}, {
10579
10645
  state: "initialized",
10580
10646
  mimeType: n,
@@ -10586,10 +10652,10 @@ function ex(e, { mediaSource: t, mimeType: n, codec: r }) {
10586
10652
  lastBufferCleanupTime: performance.now()
10587
10653
  });
10588
10654
  }
10589
- function tx({ initSegments: e, pendingSamples: t }) {
10655
+ function Cx({ initSegments: e, pendingSamples: t }) {
10590
10656
  return {
10591
10657
  state: "uninitialized",
10592
- initSegments: e == null ? new $b() : e,
10658
+ initSegments: e == null ? new xx() : e,
10593
10659
  sequenceNumber: 0,
10594
10660
  isWorkingOnPendingSamples: !1,
10595
10661
  hasFirstSync: t.some((e) => e.isSync),
@@ -10599,7 +10665,7 @@ function tx({ initSegments: e, pendingSamples: t }) {
10599
10665
  successfulAppendCalls: 0
10600
10666
  };
10601
10667
  }
10602
- var nx = class {
10668
+ var wx = class {
10603
10669
  constructor(r, i, a) {
10604
10670
  var o = this;
10605
10671
  e(this, "maxChunkSize", 20), e(this, "minConsecutiveErrorsBeforeEmit", 5), e(this, "maxSecondsInBuffer", 60), e(this, "logger", void 0), e(this, "timers", O.create()), e(this, "emitter", void 0), e(this, "mediaElement", void 0), e(this, "mediaSource", new Ys()), e(this, "trackContexts", /* @__PURE__ */ new Map()), e(this, "autoRecoverFromMediaErrors", !0), e(this, "quotaErrorCount", 0), e(this, "recoveredFromErrorCount", 0), e(this, "sourceOpenStartTime", performance.now()), e(this, "sourceOpenEndTime", performance.now()), e(this, "pendingTracksToAddSourceBuffers", void 0), e(this, "hasAddedInitialPosterFrame", !0), e(this, "videoKeyframeTimestamps", []), e(this, "isReopening", !1), e(this, "pendingMediaError", void 0), e(this, "isFlushDeferred", !1), e(this, "hasRecoveredSinceShown", !1), e(this, "playbackStallCount", 0), e(this, "hasStartedPlayback", !1), e(this, "isPlaybackStalled", !1), e(this, "load", () => {
@@ -10645,7 +10711,7 @@ var nx = class {
10645
10711
  var n, r, i;
10646
10712
  let a = e.get(t), o = (n = a == null ? void 0 : a.pendingSamples) == null ? [] : n, s = a == null ? void 0 : a.initSegments, c = (r = a == null ? void 0 : a.pendingSamplesOffset) == null ? 0 : r;
10647
10713
  for (; c < o.length && !((i = o[c]) != null && i.isSync);) c++;
10648
- let l = tx({
10714
+ let l = Cx({
10649
10715
  pendingSamples: o,
10650
10716
  initSegments: s
10651
10717
  });
@@ -10656,14 +10722,14 @@ var nx = class {
10656
10722
  this.trackContexts.forEach((e, n) => {
10657
10723
  if (t.has(n)) return;
10658
10724
  e.state === "initialized" && this.mediaSource.isOpen() && this.mediaSource.removeSourceBuffer(e.sourceBuffer);
10659
- let r = tx({
10725
+ let r = Cx({
10660
10726
  pendingSamples: [],
10661
10727
  initSegments: e.initSegments
10662
10728
  });
10663
10729
  this.trackContexts.set(n, r);
10664
10730
  });
10665
10731
  }), e(this, "isCurrentTrackContext", (e, t) => this.trackContexts.get(e) === t), e(this, "initializeSourceBuffer", (e, t) => {
10666
- let n = ex(e, {
10732
+ let n = Sx(e, {
10667
10733
  mimeType: t.mimeType,
10668
10734
  mediaSource: this.mediaSource,
10669
10735
  codec: t.codec
@@ -10690,9 +10756,9 @@ var nx = class {
10690
10756
  }
10691
10757
  for (let t of e) {
10692
10758
  let n = o.trackContexts.get(t.type);
10693
- if (n || (n = tx({
10759
+ if (n || (n = Cx({
10694
10760
  pendingSamples: [],
10695
- initSegments: new $b()
10761
+ initSegments: new xx()
10696
10762
  }), o.trackContexts.set(t.type, n)), n.state === "initialized") {
10697
10763
  if (t.mimeType !== n.sourceBufferMimeType) try {
10698
10764
  yield n.sourceBuffer.changeType(t.mimeType), n.sourceBufferMimeType = t.mimeType;
@@ -10709,7 +10775,7 @@ var nx = class {
10709
10775
  o.logger.warn("removeSourceBuffer failed", { removeError: t }), o.reopenMediaSource("changeType recovery failed"), o.pendingTracksToAddSourceBuffers = e;
10710
10776
  return;
10711
10777
  }
10712
- let i = tx({
10778
+ let i = Cx({
10713
10779
  pendingSamples: n.pendingSamples,
10714
10780
  initSegments: n.initSegments
10715
10781
  });
@@ -10733,7 +10799,7 @@ var nx = class {
10733
10799
  };
10734
10800
  }), e(this, "getNextBufferedRangeStart", (e) => {
10735
10801
  let t = this.getCommonBufferedRangesForCurrentTracks();
10736
- if (t) return rx(e, t);
10802
+ if (t) return Tx(e, t);
10737
10803
  }), e(this, "getBufferedEndAt", (e) => {
10738
10804
  var t;
10739
10805
  let n = this.getCommonBufferedRangesForCurrentTracks();
@@ -10783,9 +10849,9 @@ var nx = class {
10783
10849
  s > 0 && performance.now() - r.lastBufferCleanupTime > 1e4 && (r.lastBufferCleanupTime = performance.now(), yield r.sourceBuffer.removeBuffer(0, s + 10));
10784
10850
  try {
10785
10851
  let t = r.sequenceNumber;
10786
- if ("fragmented" in n) for (let t of cx(e)) {
10852
+ if ("fragmented" in n) for (let t of Ax(e)) {
10787
10853
  var c;
10788
- yield r.sourceBuffer.appendBuffer(lx(t.map((e) => e.data)), (c = t[0]) == null ? void 0 : c.initData);
10854
+ yield r.sourceBuffer.appendBuffer(jx(t.map((e) => e.data)), (c = t[0]) == null ? void 0 : c.initData);
10789
10855
  }
10790
10856
  else {
10791
10857
  let n = Fs(e, t++);
@@ -10833,7 +10899,7 @@ var nx = class {
10833
10899
  let t = this.trackContexts.get(e.type);
10834
10900
  if (!t) throw Un(e.type, e.renditionId);
10835
10901
  let n = t.pendingSamples.length - t.pendingSamplesOffset;
10836
- if (t.state === "uninitialized" && n >= ax && (e.isSync || n >= 2 * ax) && (t.pendingSamples = [], t.pendingSamplesOffset = 0, t.hasFirstSync = !1), !(!t.hasFirstSync && !e.isSync)) {
10902
+ if (t.state === "uninitialized" && n >= Dx && (e.isSync || n >= 2 * Dx) && (t.pendingSamples = [], t.pendingSamplesOffset = 0, t.hasFirstSync = !1), !(!t.hasFirstSync && !e.isSync)) {
10837
10903
  if (this.hasAddedInitialPosterFrame && e.isSync && e.type === "video") {
10838
10904
  this.hasAddedInitialPosterFrame = !1;
10839
10905
  let n = y({}, e);
@@ -10844,7 +10910,7 @@ var nx = class {
10844
10910
  let t = (e.timestamp + ((r = e.compositionTimeOffset) == null ? 0 : r)) / e.timescale * 1e3, n = this.videoKeyframeTimestamps[this.videoKeyframeTimestamps.length - 1];
10845
10911
  n !== void 0 && t < n && (this.videoKeyframeTimestamps = []), this.videoKeyframeTimestamps.push(t), this.videoKeyframeTimestamps.length > 20 && (this.videoKeyframeTimestamps = this.videoKeyframeTimestamps.slice(-20));
10846
10912
  }
10847
- t.state !== "uninitialized" && (t.isWorkingOnPendingSamples || dx(t, this.append, this.maxChunkSize).catch((n) => {
10913
+ t.state !== "uninitialized" && (t.isWorkingOnPendingSamples || Nx(t, this.append, this.maxChunkSize).catch((n) => {
10848
10914
  if (t.isWorkingOnPendingSamples = !1, !this.isReopening) {
10849
10915
  if (!this.isCurrentTrackContext(e.type, t)) {
10850
10916
  this.logger.debug("Suppressing append error from stale track context", { type: e.type });
@@ -10963,14 +11029,14 @@ var nx = class {
10963
11029
  if (this.mediaSource.isClosed()) return;
10964
11030
  let e = this.getInitializedTrackBuffers();
10965
11031
  if (e.length !== 0) return this.getCommonBufferedRanges(e);
10966
- }), e(this, "getCommonBufferedRanges", (e) => e.slice(1).reduce((e, t) => sx(e, t), e[0] ? Array.from(e[0]) : [])), e(this, "getPlaybackStateForBufferedRanges", (e, t) => rn(t, e) ? "playing" : "buffering"), this.logger = r, this.mediaElement = a, this.emitter = i;
11032
+ }), e(this, "getCommonBufferedRanges", (e) => e.slice(1).reduce((e, t) => kx(e, t), e[0] ? Array.from(e[0]) : [])), e(this, "getPlaybackStateForBufferedRanges", (e, t) => rn(t, e) ? "playing" : "buffering"), this.logger = r, this.mediaElement = a, this.emitter = i;
10967
11033
  }
10968
11034
  };
10969
- Qb = nx, e(nx, "create", (e, t, n) => {
10970
- let r = new Qb(e, t, n);
11035
+ bx = wx, e(wx, "create", (e, t, n) => {
11036
+ let r = new bx(e, t, n);
10971
11037
  return r.setTrackContexts(), r.mediaSource.on("source ended", r.onSourceEnded), r.mediaSource.on("source open", r.onSourceOpen), n.addEventListener("error", r.onMediaElementError), n.addEventListener("waiting", r.onPlaybackStall), n.addEventListener("stalled", r.onPlaybackStall), n.addEventListener("playing", r.onPlaybackProgress), n.addEventListener("pause", r.onPlaybackPauseOrSeek), n.addEventListener("play", r.onPlay), n.addEventListener("seeking", r.onPlaybackPauseOrSeek), r.mediaSource.attach(n), r;
10972
11038
  });
10973
- var rx = (e, t) => {
11039
+ var Tx = (e, t) => {
10974
11040
  for (let r = 0; r < t.length; r++) {
10975
11041
  let i = t[r];
10976
11042
  if (i) {
@@ -10981,11 +11047,11 @@ var rx = (e, t) => {
10981
11047
  }
10982
11048
  }
10983
11049
  }
10984
- }, ix = (e, t) => {
11050
+ }, Ex = (e, t) => {
10985
11051
  var n;
10986
11052
  let r = e.renditionId !== t.renditionId, i = e.channelId !== t.channelId, a = ((n = e.timestamp) == null ? 0 : n) > t.timestamp, o = e.type === "video" && t.type === "video" && "levelIdc" in e && "levelIdc" in t && e.levelIdc !== t.levelIdc, s = !1;
10987
11053
  return e.type === "video" && t.type === "video" && "width" in e && "width" in t && (s = t.width !== e.width || t.height !== e.height), i || r || a || s || o;
10988
- }, ax = 1e3, ox = 32, sx = (e, t) => {
11054
+ }, Dx = 1e3, Ox = 32, kx = (e, t) => {
10989
11055
  let n = [], r = 0, i = 0;
10990
11056
  for (; r < e.length && i < t.length;) {
10991
11057
  let a = e[r], o = t[i];
@@ -10997,7 +11063,7 @@ var rx = (e, t) => {
10997
11063
  }), a.end <= o.end ? r++ : i++;
10998
11064
  }
10999
11065
  return n;
11000
- }, cx = (e) => {
11066
+ }, Ax = (e) => {
11001
11067
  let t = [];
11002
11068
  for (let r of e) {
11003
11069
  var n;
@@ -11006,21 +11072,21 @@ var rx = (e, t) => {
11006
11072
  (e == null || (n = e[0]) == null ? void 0 : n.initData) === r.initData ? e.push(r) : t.push([r]);
11007
11073
  }
11008
11074
  return t;
11009
- }, lx = (e) => {
11075
+ }, jx = (e) => {
11010
11076
  if (e.length === 1 && e[0]) return e[0];
11011
11077
  let t = new Uint8Array(e.reduce((e, t) => e + t.byteLength, 0)), n = 0;
11012
11078
  for (let r of e) t.set(r, n), n += r.byteLength;
11013
11079
  return t;
11014
- }, ux = (e) => {
11080
+ }, Mx = (e) => {
11015
11081
  let t = e.pendingSamplesOffset;
11016
11082
  if (t !== 0) {
11017
11083
  if (t >= e.pendingSamples.length) {
11018
11084
  e.pendingSamples = [], e.pendingSamplesOffset = 0;
11019
11085
  return;
11020
11086
  }
11021
- t < ox || t * 2 < e.pendingSamples.length || (e.pendingSamples = e.pendingSamples.slice(t), e.pendingSamplesOffset = 0);
11087
+ t < Ox || t * 2 < e.pendingSamples.length || (e.pendingSamples = e.pendingSamples.slice(t), e.pendingSamplesOffset = 0);
11022
11088
  }
11023
- }, dx = function() {
11089
+ }, Nx = function() {
11024
11090
  var e = t(function* (e, t, n) {
11025
11091
  for (e.isWorkingOnPendingSamples = !0; e.pendingSamplesOffset < e.pendingSamples.length;) {
11026
11092
  let r = [], i = e.pendingSamplesOffset;
@@ -11028,7 +11094,7 @@ var rx = (e, t) => {
11028
11094
  i = t;
11029
11095
  let a = e.pendingSamples[t], o = e.pendingSamples[t + 1];
11030
11096
  if (a && (r.push(a), o)) {
11031
- if (ix(a, o)) break;
11097
+ if (Ex(a, o)) break;
11032
11098
  let e = (a.timestamp + a.duration) / a.timescale;
11033
11099
  if (o.timestamp / o.timescale - e > .1) break;
11034
11100
  }
@@ -11036,14 +11102,14 @@ var rx = (e, t) => {
11036
11102
  }
11037
11103
  let a = r[0];
11038
11104
  if (!a) break;
11039
- yield t(r, e.previousSample ? ix(e.previousSample, a) : !0), e.pendingSamplesOffset = i + 1, e.previousSample = r[r.length - 1], ux(e);
11105
+ yield t(r, e.previousSample ? Ex(e.previousSample, a) : !0), e.pendingSamplesOffset = i + 1, e.previousSample = r[r.length - 1], Mx(e);
11040
11106
  }
11041
11107
  e.isWorkingOnPendingSamples = !1;
11042
11108
  });
11043
11109
  return function(t, n, r) {
11044
11110
  return e.apply(this, arguments);
11045
11111
  };
11046
- }(), fx, px = class {
11112
+ }(), Px, Fx = class {
11047
11113
  constructor(n, r) {
11048
11114
  var i = this;
11049
11115
  e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "element", void 0), e(this, "pictureInPictureWindow", void 0), e(this, "unload", () => {
@@ -11075,10 +11141,10 @@ var rx = (e, t) => {
11075
11141
  }()), e(this, "isWebkitPresentationModeSupported", () => !!this.element && dt(this.element)), this.emitter = n, this.logger = r, this.emitter.on("add picture in picture listener", this.onEnablePictureInPicture);
11076
11142
  }
11077
11143
  };
11078
- fx = px, e(px, "create", (e, t) => new fx(e, t));
11144
+ Px = Fx, e(Fx, "create", (e, t) => new Px(e, t));
11079
11145
  //#endregion
11080
11146
  //#region ../../libs/web-sdk/src/modules/PlaybackModule.ts
11081
- var mx, hx = class {
11147
+ var Ix, Lx = class {
11082
11148
  constructor(t, n, r, i) {
11083
11149
  e(this, "emitter", void 0), e(this, "logger", void 0), e(this, "clockSource", void 0), e(this, "state", "buffering"), e(this, "bufferFullness", 0), e(this, "targetBufferTime", void 0), e(this, "lastBufferStateEvent", "drained"), e(this, "firstFrameTime", void 0), e(this, "currentTimeIsInRange", !1), e(this, "needsInputForAudioCount", 0), e(this, "needsInputForVideoCount", 0), e(this, "unload", () => {
11084
11150
  this.emitter.off("buffer state", this.onBufferedStateChanged), this.emitter.off("needs user input", this.onNeedsUserInput);
@@ -11096,24 +11162,24 @@ var mx, hx = class {
11096
11162
  }), this.emitter = t, this.logger = n, this.clockSource = r, this.targetBufferTime = i, this.emitter.on("buffer state", this.onBufferedStateChanged), this.emitter.on("needs user input", this.onNeedsUserInput), this.emitter.emit("target buffer time", i);
11097
11163
  }
11098
11164
  };
11099
- mx = hx, e(hx, "create", (e, t, n, r) => new mx(e, t, n, r));
11165
+ Ix = Lx, e(Lx, "create", (e, t, n, r) => new Ix(e, t, n, r));
11100
11166
  //#endregion
11101
11167
  //#region ../../libs/web-sdk/src/modules/QualityOfServiceModule.ts
11102
- var gx, _x = () => ({
11168
+ var Rx, zx = () => ({
11103
11169
  upgradesFromLevel: [],
11104
11170
  downgradesFromLevel: [],
11105
11171
  bufferingRanges: [],
11106
11172
  activeRanges: [],
11107
11173
  decodeRate: 2 ** 53 - 1
11108
- }), vx = () => ({
11174
+ }), Bx = () => ({
11109
11175
  levels: {},
11110
11176
  levelDowngrades: [],
11111
11177
  levelUpgrades: [],
11112
11178
  bufferFullness: 0,
11113
- general: _x()
11114
- }), yx = 100, bx = 3600, xx = 1e3, Sx = class {
11179
+ general: zx()
11180
+ }), Vx = 100, Hx = 3600, Ux = 1e3, Wx = class {
11115
11181
  constructor(t, n, i, a) {
11116
- e(this, "minBufferFullnessLengthForRegression", 6), e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "timers", O.create()), e(this, "metrics", vx()), e(this, "bufferFullness", new r(Infinity)), e(this, "bufferFullnessRegression", void 0), e(this, "lastDeliveryResumeTime", -Infinity), e(this, "currentLevel", void 0), e(this, "isSuspended", !1), e(this, "_fatalQosCount", 0), e(this, "renditionLevelSource", void 0), e(this, "targetBufferTimeSource", void 0), e(this, "qualityIndexOrder", []), e(this, "hasPlayedInSession", !1), e(this, "hasAsserted", !1), e(this, "load", () => {
11182
+ e(this, "minBufferFullnessLengthForRegression", 6), e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "timers", O.create()), e(this, "metrics", Bx()), e(this, "bufferFullness", new r(Infinity)), e(this, "bufferFullnessRegression", void 0), e(this, "lastDeliveryResumeTime", -Infinity), e(this, "currentLevel", void 0), e(this, "isSuspended", !1), e(this, "_fatalQosCount", 0), e(this, "renditionLevelSource", void 0), e(this, "targetBufferTimeSource", void 0), e(this, "qualityIndexOrder", []), e(this, "hasPlayedInSession", !1), e(this, "hasAsserted", !1), e(this, "load", () => {
11117
11183
  this.emitter.on("playback state", this.onPlaybackState), this.emitter.on("buffer fullness", this.onBufferFullness), this.emitter.on("media delivery resumed", this.onMediaDeliveryResumed), this.emitter.on("rendition level changed", this.onRenditionLevelChanged), this.emitter.on("video decode rate", this.onVideoDecodeRate), this.emitter.on("connection state", this.onConnectionState);
11118
11184
  }), e(this, "unload", () => {
11119
11185
  this.emitter.off("playback state", this.onPlaybackState), this.emitter.off("buffer fullness", this.onBufferFullness), this.emitter.off("media delivery resumed", this.onMediaDeliveryResumed), this.emitter.off("rendition level changed", this.onRenditionLevelChanged), this.emitter.off("video decode rate", this.onVideoDecodeRate), this.emitter.off("connection state", this.onConnectionState), this.suspend();
@@ -11131,7 +11197,7 @@ var gx, _x = () => ({
11131
11197
  return this.metrics.levels[a];
11132
11198
  }), e(this, "getBufferFullnessRegression", (e = !1) => {
11133
11199
  if (!e) return this.bufferFullnessRegression;
11134
- if (performance.now() - this.lastDeliveryResumeTime < xx) return;
11200
+ if (performance.now() - this.lastDeliveryResumeTime < Ux) return;
11135
11201
  let t = this.bufferFullness.items().filter(({ time: e }) => e >= this.lastDeliveryResumeTime);
11136
11202
  return t.length >= this.minBufferFullnessLengthForRegression ? this.calculateLinearRegression(t) : void 0;
11137
11203
  }), e(this, "getTargetBufferTime", () => {
@@ -11191,21 +11257,21 @@ var gx, _x = () => ({
11191
11257
  let d = !1;
11192
11258
  if (e.from) {
11193
11259
  var f;
11194
- let e = (f = this.metrics.levels[l]) == null ? _x() : f;
11260
+ let e = (f = this.metrics.levels[l]) == null ? zx() : f;
11195
11261
  l < u ? e.upgradesFromLevel.push(performance.now()) : e.downgradesFromLevel.push(performance.now()), Qt(e.activeRanges);
11196
11262
  let t = e.bufferingRanges[e.bufferingRanges.length - 1];
11197
11263
  d = !!t && !t.end, Qt(e.bufferingRanges), this.metrics.levels[l] = e;
11198
11264
  }
11199
11265
  if (e.to) {
11200
11266
  var p;
11201
- let e = (p = this.metrics.levels[u]) == null ? _x() : p;
11267
+ let e = (p = this.metrics.levels[u]) == null ? zx() : p;
11202
11268
  $t(e.activeRanges), d && $t(e.bufferingRanges), this.metrics.levels[u] = e, this.currentLevel = u;
11203
11269
  }
11204
11270
  }), e(this, "onMediaDeliveryResumed", () => {
11205
11271
  this.lastDeliveryResumeTime = performance.now();
11206
11272
  }), e(this, "onBufferFullness", (e) => {
11207
11273
  if (this.metrics.bufferFullness = e, this.isSuspended) return;
11208
- let t = performance.now(), n = this.bufferFullness.peekLast(), r = (e) => Math.floor(e / yx);
11274
+ let t = performance.now(), n = this.bufferFullness.peekLast(), r = (e) => Math.floor(e / Vx);
11209
11275
  if (n && r(n.time) === r(t)) n.time = t, n.value = e;
11210
11276
  else {
11211
11277
  var i, a;
@@ -11213,7 +11279,7 @@ var gx, _x = () => ({
11213
11279
  time: t,
11214
11280
  value: e
11215
11281
  });
11216
- let n = this.bufferFullness.items(), r = (i = (a = n[n.length - this.minBufferFullnessLengthForRegression]) == null ? void 0 : a.time) == null ? -Infinity : i, o = Math.min(t - bx, r);
11282
+ let n = this.bufferFullness.items(), r = (i = (a = n[n.length - this.minBufferFullnessLengthForRegression]) == null ? void 0 : a.time) == null ? -Infinity : i, o = Math.min(t - Hx, r);
11217
11283
  this.bufferFullness.filterPop(({ time: e }) => e >= o);
11218
11284
  }
11219
11285
  this.bufferFullnessRegression = this.bufferFullness.items().length >= this.minBufferFullnessLengthForRegression ? this.calculateLinearRegression() : void 0;
@@ -11285,10 +11351,10 @@ var gx, _x = () => ({
11285
11351
  $t(this.metrics.general.activeRanges);
11286
11352
  }
11287
11353
  };
11288
- gx = Sx, e(Sx, "create", (e, t, n, r) => new gx(e, t, n, r));
11354
+ Rx = Wx, e(Wx, "create", (e, t, n, r) => new Rx(e, t, n, r));
11289
11355
  //#endregion
11290
11356
  //#region ../../libs/web-sdk/src/modules/RenditionsModule.ts
11291
- var Cx, wx = class {
11357
+ var Gx, Kx = class {
11292
11358
  constructor(t, n) {
11293
11359
  e(this, "renditions", /* @__PURE__ */ new Map()), e(this, "renditionLevels", []), e(this, "languages", []), e(this, "emitter", void 0), e(this, "subscriptionSource", void 0), e(this, "renditionLevelChangeCount", 0), e(this, "unload", () => {
11294
11360
  this.emitter.off("renditions", this.onRenditions), this.emitter.off("subscription changed", this.onSubscriptionChanged);
@@ -11363,10 +11429,10 @@ var Cx, wx = class {
11363
11429
  }), e(this, "getCurrentSubscription", () => this.subscriptionSource.getCurrentSubscription()), this.subscriptionSource = n, this.emitter = t, this.emitter.on("renditions", this.onRenditions), this.emitter.on("subscription changed", this.onSubscriptionChanged);
11364
11430
  }
11365
11431
  };
11366
- Cx = wx, e(wx, "create", (e, t) => new Cx(e, t));
11432
+ Gx = Kx, e(Kx, "create", (e, t) => new Gx(e, t));
11367
11433
  //#endregion
11368
11434
  //#region ../../libs/web-sdk/src/BFrameTracker.ts
11369
- var Tx = class t {
11435
+ var qx = class t {
11370
11436
  constructor() {
11371
11437
  e(this, "channelId", void 0), e(this, "renditionId", void 0), e(this, "anchorCts", void 0), e(this, "hasBFramesValue", !1), e(this, "isAwaitingAssessment", !1), e(this, "zeroOffsetSamples", 0), e(this, "omittedBoundaryCrossings", 0), e(this, "hasSeenKeyframe", !1), e(this, "hasObservedReordering", !1), e(this, "rememberedRenditions", new Dt(t.MAX_REMEMBERED_RENDITIONS));
11372
11438
  }
@@ -11402,7 +11468,7 @@ var Tx = class t {
11402
11468
  this.channelId = void 0, this.renditionId = void 0, this.anchorCts = void 0, this.hasBFramesValue = !1, this.zeroOffsetSamples = 0, this.omittedBoundaryCrossings = 0, this.hasSeenKeyframe = !1, this.hasObservedReordering = !1, this.isAwaitingAssessment = !0;
11403
11469
  }
11404
11470
  remember(e) {
11405
- this.channelId !== void 0 && this.rememberedRenditions.set(cb(this.channelId, this.renditionId), e);
11471
+ this.channelId !== void 0 && this.rememberedRenditions.set(Ab(this.channelId, this.renditionId), e);
11406
11472
  }
11407
11473
  latchBFrames() {
11408
11474
  this.hasBFramesValue = !0, this.hasObservedReordering = !0, this.isAwaitingAssessment = !1, this.remember(!0);
@@ -11414,18 +11480,18 @@ var Tx = class t {
11414
11480
  this.hasSeenKeyframe && !this.hasObservedReordering && (this.remember(!1), this.hasBFramesValue = !1), this.hasSeenKeyframe = !0, this.omittedBoundaryCrossings = 0;
11415
11481
  }
11416
11482
  resetOnSwitch(e, t) {
11417
- if (!lb(e, t, this.channelId, this.renditionId)) {
11483
+ if (!jb(e, t, this.channelId, this.renditionId)) {
11418
11484
  let n = this.channelId !== void 0;
11419
11485
  this.channelId = e, this.renditionId = t, this.anchorCts = void 0, this.zeroOffsetSamples = 0, this.omittedBoundaryCrossings = 0, this.hasSeenKeyframe = !1, this.hasObservedReordering = !1;
11420
- let r = this.rememberedRenditions.get(cb(e, t));
11486
+ let r = this.rememberedRenditions.get(Ab(e, t));
11421
11487
  this.hasBFramesValue = r == null ? !1 : r, n && (this.isAwaitingAssessment = r === void 0);
11422
11488
  }
11423
11489
  }
11424
11490
  };
11425
- e(Tx, "MAX_REMEMBERED_RENDITIONS", 32);
11491
+ e(qx, "MAX_REMEMBERED_RENDITIONS", 32);
11426
11492
  //#endregion
11427
11493
  //#region ../../libs/web-sdk/src/modules/SyncModule.ts
11428
- var Ex, Dx = 5e3, Ox = .5, kx = 3e3, Ax = () => Fe() || Me(), jx = (e) => e && Ax() ? 100 : 0, Mx = (e) => (t) => t > e, Nx = 100, Px = 1e3, Fx = 1e3, Ix = 1e3, Lx = 100, Rx = 50, zx = {
11494
+ var Jx, Yx = 5e3, Xx = .5, Zx = 3e3, Qx = () => Fe() || Me(), $x = (e) => e && Qx() ? 100 : 0, eS = (e) => (t) => t > e, tS = 100, nS = 1e3, rS = 1e3, iS = 1e3, aS = 100, oS = 50, sS = {
11429
11495
  seek: {
11430
11496
  toleranceMs: 200,
11431
11497
  toleranceMaxMs: 2500,
@@ -11457,7 +11523,7 @@ var Ex, Dx = 5e3, Ox = .5, kx = 3e3, Ax = () => Fe() || Me(), jx = (e) => e && A
11457
11523
  decayCooldownMultiplier: 3,
11458
11524
  decayCheckInterval: 15e3
11459
11525
  }
11460
- }, Bx = class {
11526
+ }, cS = class {
11461
11527
  get driftSamplesToCollect() {
11462
11528
  return this._driftSamplesToCollect;
11463
11529
  }
@@ -11465,8 +11531,8 @@ var Ex, Dx = 5e3, Ox = .5, kx = 3e3, Ax = () => Fe() || Me(), jx = (e) => e && A
11465
11531
  this._driftSamplesToCollect = e, this.driftSamples = new r(e);
11466
11532
  }
11467
11533
  constructor(t, n, i, a, o, s = !0) {
11468
- e(this, "emitter", void 0), e(this, "logger", void 0), e(this, "playbackSource", void 0), e(this, "bufferSource", void 0), e(this, "keyframeTimestamps", new r(10)), e(this, "lastSeekTime", void 0), e(this, "timeshiftDeferralStartedAt", void 0), e(this, "needsMediaSourceRecovery", !1), e(this, "lastAdjustmentTime", performance.now()), e(this, "lastDecayCheckTime", performance.now()), e(this, "syncInterval", void 0), e(this, "currentSyncIntervalMs", Nx), e(this, "config", void 0), e(this, "state", void 0), e(this, "allowTimeshiftOnAudio", !1), e(this, "syncInfoToleranceMaxMs", 150), e(this, "syncInfoToleranceStep", 20), e(this, "seekOvershoot", void 0), e(this, "timers", O.create()), e(this, "rtt", 0), e(this, "channelSyncInfo", /* @__PURE__ */ new Map()), e(this, "seekAdjustmentCount", 0), e(this, "timeshiftAdjustmentCount", 0), e(this, "syncInfoCorrectionCount", 0), e(this, "playbackRateAdjustmentCount", 0), e(this, "lastPlaybackRateChangeTime", 0), e(this, "seekAdjustmentTimestamps", []), e(this, "timeshiftAdjustmentTimestamps", []), e(this, "_driftSamplesToCollect", 5), e(this, "driftSamples", new r(this._driftSamplesToCollect)), e(this, "timestampOffset", void 0), e(this, "hasObservedBFrames", !1), e(this, "bFrameDetector", new Tx()), e(this, "currentChannelId", void 0), e(this, "highestSeenTimestamps", /* @__PURE__ */ new Map()), e(this, "isSuspended", !1), e(this, "isSyncAdjustmentActivated", !1), e(this, "queuedTimeshift", !1), e(this, "playbackState", void 0), e(this, "hasPerformedRecoverySeekInCurrentRecoveryState", !1), e(this, "shouldSeekAfterBuffering", !1), e(this, "shouldSeekWhileStuck", !1), e(this, "hasPerformedStuckSeekInCurrentStillness", !1), e(this, "positionSetBySeek", void 0), e(this, "lastPlayheadPosition", void 0), e(this, "lastPlayheadProgressAt", performance.now()), e(this, "usesMse", void 0), e(this, "load", () => {
11469
- this.emitter.on("page active", this.onPageActive), this.emitter.on("pageshow", this.onPageShow), this.setSyncInterval(document.visibilityState === "hidden" ? Px : Nx);
11534
+ e(this, "emitter", void 0), e(this, "logger", void 0), e(this, "playbackSource", void 0), e(this, "bufferSource", void 0), e(this, "keyframeTimestamps", new r(10)), e(this, "lastSeekTime", void 0), e(this, "timeshiftDeferralStartedAt", void 0), e(this, "needsMediaSourceRecovery", !1), e(this, "lastAdjustmentTime", performance.now()), e(this, "lastDecayCheckTime", performance.now()), e(this, "syncInterval", void 0), e(this, "currentSyncIntervalMs", tS), e(this, "config", void 0), e(this, "state", void 0), e(this, "allowTimeshiftOnAudio", !1), e(this, "syncInfoToleranceMaxMs", 150), e(this, "syncInfoToleranceStep", 20), e(this, "seekOvershoot", void 0), e(this, "timers", O.create()), e(this, "rtt", 0), e(this, "channelSyncInfo", /* @__PURE__ */ new Map()), e(this, "seekAdjustmentCount", 0), e(this, "timeshiftAdjustmentCount", 0), e(this, "syncInfoCorrectionCount", 0), e(this, "playbackRateAdjustmentCount", 0), e(this, "lastPlaybackRateChangeTime", 0), e(this, "seekAdjustmentTimestamps", []), e(this, "timeshiftAdjustmentTimestamps", []), e(this, "_driftSamplesToCollect", 5), e(this, "driftSamples", new r(this._driftSamplesToCollect)), e(this, "timestampOffset", void 0), e(this, "hasObservedBFrames", !1), e(this, "bFrameDetector", new qx()), e(this, "currentChannelId", void 0), e(this, "highestSeenTimestamps", /* @__PURE__ */ new Map()), e(this, "isSuspended", !1), e(this, "isSyncAdjustmentActivated", !1), e(this, "queuedTimeshift", !1), e(this, "playbackState", void 0), e(this, "hasPerformedRecoverySeekInCurrentRecoveryState", !1), e(this, "shouldSeekAfterBuffering", !1), e(this, "shouldSeekWhileStuck", !1), e(this, "hasPerformedStuckSeekInCurrentStillness", !1), e(this, "positionSetBySeek", void 0), e(this, "lastPlayheadPosition", void 0), e(this, "lastPlayheadProgressAt", performance.now()), e(this, "usesMse", void 0), e(this, "load", () => {
11535
+ this.emitter.on("page active", this.onPageActive), this.emitter.on("pageshow", this.onPageShow), this.setSyncInterval(document.visibilityState === "hidden" ? nS : tS);
11470
11536
  }), e(this, "unload", () => {
11471
11537
  this.logger.debug("Unloading module..."), this.emitter.off("rtt", this.updateRtt), this.emitter.off("playback state", this.onPlaybackState), this.emitter.off("page active", this.onPageActive), this.emitter.off("pageshow", this.onPageShow), this.emitter.off("buffers flushed", this.clearBFrameLatch), this.emitter.off("recovered from media error", this.onMediaSourceRecovered), this.clearSyncInterval(), this.timers.unload(), this.logger.debug("Unloaded module");
11472
11538
  }), e(this, "suspend", () => {
@@ -11508,7 +11574,7 @@ var Ex, Dx = 5e3, Ox = .5, kx = 3e3, Ax = () => Fe() || Me(), jx = (e) => e && A
11508
11574
  }), e(this, "processSample", (e) => {
11509
11575
  var t;
11510
11576
  if (!e.channelId) throw Error("Sample must be assigned to a channel");
11511
- this.currentChannelId || (this.currentChannelId = e.channelId), this.timestampOffset || (this.timestampOffset = e.timestamp / e.timescale * 1e3 - Dx);
11577
+ this.currentChannelId || (this.currentChannelId = e.channelId), this.timestampOffset || (this.timestampOffset = e.timestamp / e.timescale * 1e3 - Yx);
11512
11578
  let n = e.type === "video" && e.isSync;
11513
11579
  if (this.bFrameDetector.update(e), this.latchBFramesIfDetected(), this.currentChannelId !== e.channelId) {
11514
11580
  let t = 2 ** 53 - 1;
@@ -11525,7 +11591,7 @@ var Ex, Dx = 5e3, Ox = .5, kx = 3e3, Ax = () => Fe() || Me(), jx = (e) => e && A
11525
11591
  this.currentChannelId || (this.currentChannelId = e);
11526
11592
  let i = t.mediaType();
11527
11593
  if (!i) throw Error("Fragment must have a media type");
11528
- this.timestampOffset || (this.timestampOffset = t.baseMediaDecodeTime() / t.timescale() * 1e3 - Dx);
11594
+ this.timestampOffset || (this.timestampOffset = t.baseMediaDecodeTime() / t.timescale() * 1e3 - Yx);
11529
11595
  let a = i === "video" && t.startsWithKeyframe();
11530
11596
  if (i === "video" && (this.bFrameDetector.updateFromFragment({
11531
11597
  type: i,
@@ -11650,7 +11716,7 @@ var Ex, Dx = 5e3, Ox = .5, kx = 3e3, Ax = () => Fe() || Me(), jx = (e) => e && A
11650
11716
  this.timeshiftDeferralStartedAt = void 0;
11651
11717
  return;
11652
11718
  }
11653
- let i = performance.now() - this.config.seek.timeoutMs * this.state.timeshiftToleranceMultiplier, a = this.timeshiftAdjustmentTimestamps.filter(Mx(i)).length;
11719
+ let i = performance.now() - this.config.seek.timeoutMs * this.state.timeshiftToleranceMultiplier, a = this.timeshiftAdjustmentTimestamps.filter(eS(i)).length;
11654
11720
  if (a && this.state.timeshiftToleranceMultiplier > 2) {
11655
11721
  this.logger.debug("Too many timeshifts within sliding window", {
11656
11722
  timeshiftCooldownThreshold: i,
@@ -11661,12 +11727,12 @@ var Ex, Dx = 5e3, Ox = .5, kx = 3e3, Ax = () => Fe() || Me(), jx = (e) => e && A
11661
11727
  if (e) {
11662
11728
  var o, s;
11663
11729
  let e = this.playbackSource.currentTime, t = (o = (s = this.bufferSource).getBufferedEndAt) == null ? void 0 : o.call(s, e), n = Math.max(0, (t == null ? e : t) - e);
11664
- if (n - r < this.bufferSource.getTargetBufferTime() * Ox) {
11730
+ if (n - r < this.bufferSource.getTargetBufferTime() * Xx) {
11665
11731
  let e = performance.now();
11666
11732
  if (this.timeshiftDeferralStartedAt === void 0 && (this.timeshiftDeferralStartedAt = e, this.logger.debug("Deferring timeshift while buffered ahead is thin", {
11667
11733
  drift: r,
11668
11734
  bufferedAhead: n
11669
- })), e - this.timeshiftDeferralStartedAt < kx) return;
11735
+ })), e - this.timeshiftDeferralStartedAt < Zx) return;
11670
11736
  }
11671
11737
  this.timeshiftDeferralStartedAt !== void 0 && this.logger.debug("Releasing timeshift deferral", { deferredMs: performance.now() - this.timeshiftDeferralStartedAt });
11672
11738
  }
@@ -11686,20 +11752,20 @@ var Ex, Dx = 5e3, Ox = .5, kx = 3e3, Ax = () => Fe() || Me(), jx = (e) => e && A
11686
11752
  let n = (e = (t = this.bufferSource).getNextBufferedRangeStart) == null ? void 0 : e.call(t, this.playbackSource.currentTime);
11687
11753
  return this.shouldSeekAfterBuffering = n !== void 0, n;
11688
11754
  }), e(this, "observePlayheadProgress", () => {
11689
- let e = this.playbackSource.currentTime, t = e !== this.lastPlayheadPosition, n = t && (this.positionSetBySeek === void 0 || e - this.positionSetBySeek > Rx);
11755
+ let e = this.playbackSource.currentTime, t = e !== this.lastPlayheadPosition, n = t && (this.positionSetBySeek === void 0 || e - this.positionSetBySeek > oS);
11690
11756
  this.positionSetBySeek = void 0, (n || this.playbackSource.isPaused) && (this.hasPerformedStuckSeekInCurrentStillness = !1), (t || this.playbackSource.isPaused || this.isSeeking()) && (this.lastPlayheadPosition = e, this.lastPlayheadProgressAt = performance.now());
11691
11757
  }), e(this, "isPlayheadStuckInBuffer", () => {
11692
11758
  var e, t;
11693
- if (performance.now() - this.lastPlayheadProgressAt < Fx) return !1;
11759
+ if (performance.now() - this.lastPlayheadProgressAt < rS) return !1;
11694
11760
  let n = this.playbackSource.currentTime, r = (e = (t = this.bufferSource).getBufferedEndAt) == null ? void 0 : e.call(t, n);
11695
- return r !== void 0 && r - n >= Ix;
11761
+ return r !== void 0 && r - n >= iS;
11696
11762
  }), e(this, "getRecoverySeekReason", () => {
11697
11763
  if (this.needsMediaSourceRecovery) return "media source reopen";
11698
11764
  if (this.shouldSeekWhileStuck) return "stuck in buffer";
11699
11765
  if (this.shouldSeekAfterBuffering) return "buffering";
11700
11766
  }), e(this, "shouldSkipNormalSeek", (e) => e < 0 && -e < this.currentAheadToleranceMs() || e > 0 && e < this.currentSeekToleranceMs() || Math.abs(e) < 1 ? !0 : !this.isAllowedToSync()), e(this, "shouldDeferRecoverySeek", (e, t) => t !== void 0 && t > e), e(this, "buildStuckInBufferSeekPlan", () => {
11701
11767
  var e, t;
11702
- let n = this.playbackSource.currentTime, r = (e = (t = this.bufferSource).getBufferedEndAt) == null ? void 0 : e.call(t, n), i = n + Math.max(this.seekOvershoot, Lx);
11768
+ let n = this.playbackSource.currentTime, r = (e = (t = this.bufferSource).getBufferedEndAt) == null ? void 0 : e.call(t, n), i = n + Math.max(this.seekOvershoot, aS);
11703
11769
  if (r === void 0 || i >= r) return;
11704
11770
  let a = this.findKeyframeCloseToTimestamp(i);
11705
11771
  return {
@@ -11780,7 +11846,7 @@ var Ex, Dx = 5e3, Ox = .5, kx = 3e3, Ax = () => Fe() || Me(), jx = (e) => e && A
11780
11846
  if (r && (this.isSeeking() || !this.currentChannelId || this.isSuspended || this.playbackSource.isPaused) || (this.driftSamples.push(t), bt(this.driftSamples.items()) < this.currentTimeshiftToleranceMs() && (this.timeshiftDeferralStartedAt = void 0), !this.isSeekCooldownExpired()) || !r && this.driftSamples.items().length < this.driftSamplesToCollect && Math.abs(t) < 2e3) return;
11781
11847
  let i = r ? t : bt(this.driftSamples.items());
11782
11848
  if (!r && this.tryPlaybackRateSync(i) || !r && this.shouldSkipNormalSeek(i)) return;
11783
- let a = performance.now() - this.config.seek.timeoutMs * this.state.seekToleranceMultiplier, o = this.seekAdjustmentTimestamps.filter(Mx(a)).length, s = this.currentEmergencySeekToleranceMs(), c = i > 0 && i >= s;
11849
+ let a = performance.now() - this.config.seek.timeoutMs * this.state.seekToleranceMultiplier, o = this.seekAdjustmentTimestamps.filter(eS(a)).length, s = this.currentEmergencySeekToleranceMs(), c = i > 0 && i >= s;
11784
11850
  if (o && this.state.seekToleranceMultiplier > 2 && !r && !c) {
11785
11851
  this.logger.debug("Too many seek adjustments within sliding window", {
11786
11852
  seekCooldownThreshold: a,
@@ -11809,9 +11875,9 @@ var Ex, Dx = 5e3, Ox = .5, kx = 3e3, Ax = () => Fe() || Me(), jx = (e) => e && A
11809
11875
  return;
11810
11876
  }
11811
11877
  }), e(this, "onPageActive", (e) => {
11812
- this.setSyncInterval(e ? Nx : Px), e && this.onSync();
11878
+ this.setSyncInterval(e ? tS : nS), e && this.onSync();
11813
11879
  }), e(this, "onPageShow", (e) => {
11814
- e.persisted && (this.setSyncInterval(document.visibilityState === "hidden" ? Px : Nx), this.onSync());
11880
+ e.persisted && (this.setSyncInterval(document.visibilityState === "hidden" ? nS : tS), this.onSync());
11815
11881
  }), e(this, "setSyncInterval", (e) => {
11816
11882
  this.syncInterval !== void 0 && this.currentSyncIntervalMs === e || (this.clearSyncInterval(), this.currentSyncIntervalMs = e, this.syncInterval = this.timers.setInterval(this.onSync, e));
11817
11883
  }), e(this, "clearSyncInterval", () => {
@@ -11822,11 +11888,11 @@ var Ex, Dx = 5e3, Ox = .5, kx = 3e3, Ax = () => Fe() || Me(), jx = (e) => e && A
11822
11888
  let t = n >= e - this.config.seek.keyframeSearchBeforeMs, r = n <= e + this.config.seek.keyframeSearchAfterMs;
11823
11889
  if (t && r) return n;
11824
11890
  }
11825
- }), this.logger = n, this.emitter = t, this.playbackSource = i, this.bufferSource = a, this.usesMse = s, this.seekOvershoot = jx(s), this.config = {
11826
- seek: y({}, zx.seek),
11827
- timeshift: y({}, zx.timeshift),
11828
- playbackRate: y({}, zx.playbackRate),
11829
- backoff: y({}, zx.backoff)
11891
+ }), this.logger = n, this.emitter = t, this.playbackSource = i, this.bufferSource = a, this.usesMse = s, this.seekOvershoot = $x(s), this.config = {
11892
+ seek: y({}, sS.seek),
11893
+ timeshift: y({}, sS.timeshift),
11894
+ playbackRate: y({}, sS.playbackRate),
11895
+ backoff: y({}, sS.backoff)
11830
11896
  }, this.config.timeshift.enabled = o, s || (this.config.seek.toleranceMs = 50, this.config.timeshift.toleranceMs = 20, this.config.seek.aheadToleranceMs = 40), this.state = {
11831
11897
  seekToleranceMultiplier: 1,
11832
11898
  timeshiftToleranceMultiplier: 1
@@ -11888,10 +11954,10 @@ var Ex, Dx = 5e3, Ox = .5, kx = 3e3, Ax = () => Fe() || Me(), jx = (e) => e && A
11888
11954
  return this.serverCurrentTime - this.playbackSource.currentTime;
11889
11955
  }
11890
11956
  };
11891
- Ex = Bx, e(Bx, "create", (e, t, n, r, i, a = !0) => new Ex(e, t, n, r, i, a));
11957
+ Jx = cS, e(cS, "create", (e, t, n, r, i, a = !0) => new Jx(e, t, n, r, i, a));
11892
11958
  //#endregion
11893
11959
  //#region ../../libs/web-sdk/src/modules/TelemetryModule.ts
11894
- var Vx, Hx = {
11960
+ var lS, uS = {
11895
11961
  enabled: !0,
11896
11962
  interval: 3e4,
11897
11963
  includeErrors: !0,
@@ -11900,11 +11966,11 @@ var Vx, Hx = {
11900
11966
  maxRetries: 10,
11901
11967
  maxErrorReports: 50,
11902
11968
  maxEvents: 50
11903
- }, Ux = (e, t) => y(y({}, t), {}, {
11969
+ }, dS = (e, t) => y(y({}, t), {}, {
11904
11970
  type: e,
11905
11971
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11906
11972
  discriminator: "web"
11907
- }), Wx = class {
11973
+ }), fS = class {
11908
11974
  constructor(n, i, a, o) {
11909
11975
  var s = this;
11910
11976
  e(this, "logger", void 0), e(this, "timers", new O()), e(this, "emitter", void 0), e(this, "options", void 0), e(this, "parentContext", void 0), e(this, "unsentLines", new r(100)), e(this, "retries", 0), e(this, "errorCount", 0), e(this, "eventCount", 0), e(this, "statsCount", 0), e(this, "unload", () => {
@@ -11921,7 +11987,7 @@ var Vx, Hx = {
11921
11987
  initiator: "interval"
11922
11988
  }, n = {}) => {
11923
11989
  if (!this.options.includeStats) return;
11924
- let r = this.parentContext.getStatistics(), i = Ux("stats", y(y(y({}, n), r), {}, {
11990
+ let r = this.parentContext.getStatistics(), i = dS("stats", y(y(y({}, n), r), {}, {
11925
11991
  isFinal: e,
11926
11992
  initiator: t,
11927
11993
  count: this.statsCount++
@@ -11929,7 +11995,7 @@ var Vx, Hx = {
11929
11995
  this.unsentLines.push(i);
11930
11996
  }), e(this, "addEvent", (e) => {
11931
11997
  if (!this.options.includeEvents || this.eventCount > this.options.maxEvents) return;
11932
- let t = Ux("event", y(y({}, this.parentContext.getStatistics()), e));
11998
+ let t = dS("event", y(y({}, this.parentContext.getStatistics()), e));
11933
11999
  this.eventCount++, this.unsentLines.push(t);
11934
12000
  }), e(this, "getStatistics", () => ({ errorCount: this.errorCount })), e(this, "send", function() {
11935
12001
  var e = t(function* (e) {
@@ -11974,14 +12040,14 @@ var Vx, Hx = {
11974
12040
  let { includeErrors: t, maxErrorReports: n } = this.options;
11975
12041
  if (!(e instanceof k) || e.code() === "channel_not_live" || !t || (this.errorCount++, this.errorCount > n)) return;
11976
12042
  let r = this.parentContext.getStatistics();
11977
- this.unsentLines.push(Ux("error", y(y({}, r), e.toStringifiable())));
11978
- }), this.logger = n, this.emitter = i, this.options = y(y({}, Hx), a), this.parentContext = o;
12043
+ this.unsentLines.push(dS("error", y(y({}, r), e.toStringifiable())));
12044
+ }), this.logger = n, this.emitter = i, this.options = y(y({}, uS), a), this.parentContext = o;
11979
12045
  }
11980
12046
  };
11981
- Vx = Wx, e(Wx, "create", (e, t, n, r) => new Vx(e, t, n, r));
12047
+ lS = fS, e(fS, "create", (e, t, n, r) => new lS(e, t, n, r));
11982
12048
  //#endregion
11983
12049
  //#region ../../libs/web-sdk/src/modules/UnpauseModule.ts
11984
- var Gx, Kx = class {
12050
+ var pS, mS = class {
11985
12051
  constructor(t, n, r) {
11986
12052
  e(this, "logger", void 0), e(this, "elements", void 0), e(this, "documentState", void 0), e(this, "timers", new O()), e(this, "unload", () => {
11987
12053
  this.timers.unload();
@@ -11990,10 +12056,10 @@ var Gx, Kx = class {
11990
12056
  }), this.logger = t, this.elements = n, this.documentState = r, this.timers.setInterval(this.unpause, 100);
11991
12057
  }
11992
12058
  };
11993
- Gx = Kx, e(Kx, "create", (e, t, n) => new Gx(e, t, n));
12059
+ pS = mS, e(mS, "create", (e, t, n) => new pS(e, t, n));
11994
12060
  //#endregion
11995
12061
  //#region ../../libs/web-sdk/src/OptionsProvider.ts
11996
- var qx = [
12062
+ var hS = [
11997
12063
  "minBufferTime",
11998
12064
  "maxBufferTime",
11999
12065
  "burstEnabled",
@@ -12002,10 +12068,10 @@ var qx = [
12002
12068
  "offscreenCanvasEnabled",
12003
12069
  "videoCodecs"
12004
12070
  ];
12005
- function Jx(e) {
12006
- return qx.includes(e);
12071
+ function gS(e) {
12072
+ return hS.includes(e);
12007
12073
  }
12008
- var Yx = class {
12074
+ var _S = class {
12009
12075
  constructor(t) {
12010
12076
  e(this, "options", void 0), e(this, "overrides", /* @__PURE__ */ new Map()), this.options = t;
12011
12077
  }
@@ -12019,7 +12085,7 @@ var Yx = class {
12019
12085
  this.options[e] = t;
12020
12086
  }
12021
12087
  get(e, t) {
12022
- if (t && Jx(e)) {
12088
+ if (t && gS(e)) {
12023
12089
  var n;
12024
12090
  let r = (n = this.overrides.get(t)) == null ? void 0 : n[e];
12025
12091
  if (r !== void 0) return r;
@@ -12030,7 +12096,7 @@ var Yx = class {
12030
12096
  var n;
12031
12097
  return (n = this.overrides.get(t)) == null ? void 0 : n[e];
12032
12098
  }
12033
- }, Xx = 6, Zx = (e) => {
12099
+ }, vS = 6, yS = (e) => {
12034
12100
  let t = [e], n = 0, r = 0, i = !1, a = (e, t) => {
12035
12101
  var i, a;
12036
12102
  if (e.flags && Ls(e.flags)) {
@@ -12042,7 +12108,7 @@ var Yx = class {
12042
12108
  return u > 0 && (r = u), y(y({}, e), {}, { duration: u > 0 ? u : r });
12043
12109
  };
12044
12110
  return (e, n = !1) => {
12045
- if (e.flags && Ls(e.flags) && n && (i = !i), !(n && t.length < Xx && i) && t.length > 0) {
12111
+ if (e.flags && Ls(e.flags) && n && (i = !i), !(n && t.length < vS && i) && t.length > 0) {
12046
12112
  i = !1;
12047
12113
  let n = e;
12048
12114
  for (let e = t.length - 1; e > 0; e--) {
@@ -12055,13 +12121,13 @@ var Yx = class {
12055
12121
  }
12056
12122
  return t.push(e), [];
12057
12123
  };
12058
- }, Qx = ["mse", "wasm"], $x = (e) => e == null ? Qx : e, eS = (e) => {
12124
+ }, bS = ["mse", "wasm"], xS = (e) => e == null ? bS : e, SS = (e) => {
12059
12125
  if (!e) return !1;
12060
12126
  let t = e.headers && Object.keys(e.headers).length > 0, n = e.queryParams && Object.keys(e.queryParams).length > 0;
12061
12127
  return !!(t || n);
12062
- }, tS = (e, t, n) => {
12063
- if (eS(n)) return "mse";
12064
- let r = $x(e);
12128
+ }, CS = (e, t, n) => {
12129
+ if (SS(n)) return "mse";
12130
+ let r = xS(e);
12065
12131
  for (let e of r) switch (e) {
12066
12132
  case "mse":
12067
12133
  if (t) return "mse";
@@ -12072,7 +12138,7 @@ var Yx = class {
12072
12138
  case "wasm": return "wasm";
12073
12139
  }
12074
12140
  return "wasm";
12075
- }, nS = (e, t, n) => {
12141
+ }, wS = (e, t, n) => {
12076
12142
  if (dn(t)) return y(y({}, e), {}, {
12077
12143
  type: "video",
12078
12144
  codec: t.codec,
@@ -12093,12 +12159,12 @@ var Yx = class {
12093
12159
  data: e.payload,
12094
12160
  duration: 0
12095
12161
  });
12096
- }, rS = ({ average: e, last: t, max: n, min: r }) => ({
12162
+ }, TS = ({ average: e, last: t, max: n, min: r }) => ({
12097
12163
  average: Math.round(e),
12098
12164
  last: Math.round(t),
12099
12165
  max: Math.round(n),
12100
12166
  min: Math.round(r)
12101
- }), iS = [
12167
+ }), ES = [
12102
12168
  "timeSpentBuffering",
12103
12169
  "timePerBufferingEvent",
12104
12170
  "drift",
@@ -12110,24 +12176,24 @@ var Yx = class {
12110
12176
  "videoKeyframeIntervalMs",
12111
12177
  "timeToConnected",
12112
12178
  "mediaSourceOpenTime"
12113
- ], aS = [
12179
+ ], DS = [
12114
12180
  "videoDecodeTime",
12115
12181
  "audioDecodeTime",
12116
12182
  "videoTransportTime",
12117
12183
  "rtt"
12118
- ], oS = (e) => typeof e == "object" && !!e && "min" in e && "max" in e && "average" in e && "last" in e, sS = (e) => {
12184
+ ], OS = (e) => typeof e == "object" && !!e && "min" in e && "max" in e && "average" in e && "last" in e, kS = (e) => {
12119
12185
  let t = y({}, e);
12120
- for (let e of iS) {
12186
+ for (let e of ES) {
12121
12187
  let n = t[e];
12122
12188
  typeof n == "number" && (t[e] = Math.round(n));
12123
12189
  }
12124
- for (let e of aS) {
12190
+ for (let e of DS) {
12125
12191
  let n = t[e];
12126
- oS(n) && (t[e] = rS(n));
12192
+ OS(n) && (t[e] = TS(n));
12127
12193
  }
12128
12194
  return t;
12129
- }, cS = (e, t) => e && typeof e == "object" && t in e, lS = (e) => !(typeof e != "object" || !cS(e, "channelId") || typeof e.channelId != "string" || !cS(e, "url") || typeof e.url != "string" || e.channelId.length === 0 || e.url.length === 0), uS = (e) => {
12130
- if (!lS(e)) throw new k("Invalid options", {
12195
+ }, AS = (e, t) => e && typeof e == "object" && t in e, jS = (e) => !(typeof e != "object" || !AS(e, "channelId") || typeof e.channelId != "string" || !AS(e, "url") || typeof e.url != "string" || e.channelId.length === 0 || e.url.length === 0), MS = (e) => {
12196
+ if (!jS(e)) throw new k("Invalid options", {
12131
12197
  isFatal: !0,
12132
12198
  code: "invalid_options"
12133
12199
  });
@@ -12136,13 +12202,13 @@ var Yx = class {
12136
12202
  let n = t;
12137
12203
  n[e] === void 0 && delete n[e];
12138
12204
  }), t;
12139
- }, dS = (e) => {
12205
+ }, NS = (e) => {
12140
12206
  if (typeof e != "object" || !e) throw Error("not an object");
12141
12207
  if (!("video" in e)) throw Error("missing video in subscription");
12142
12208
  if (!("audio" in e)) throw Error("missing audio in subscription");
12143
12209
  if (!("channelId" in e)) throw Error("missing channelId");
12144
12210
  return !0;
12145
- }, fS = class {
12211
+ }, PS = class {
12146
12212
  constructor(n) {
12147
12213
  var r = this;
12148
12214
  e(this, "cache", /* @__PURE__ */ new Map()), e(this, "inFlight", /* @__PURE__ */ new Map()), e(this, "checkVideoSupport", function() {
@@ -12203,10 +12269,10 @@ var Yx = class {
12203
12269
  return this.inFlight.set(e, o), o;
12204
12270
  }), this.logger = n;
12205
12271
  }
12206
- }, pS = 1e4, mS = 1280 * 720, hS = /* @__PURE__ */ new WeakMap(), gS = /* @__PURE__ */ new WeakMap(), _S = /* @__PURE__ */ new WeakMap(), vS = class n extends ie {
12272
+ }, FS = 1e4, IS = 1280 * 720, LS = /* @__PURE__ */ new WeakMap(), RS = /* @__PURE__ */ new WeakMap(), zS = /* @__PURE__ */ new WeakMap(), BS = class n extends ie {
12207
12273
  constructor(r) {
12208
12274
  var o, c, u;
12209
- super(), o = this, e(this, "pictureInPicture", void 0), e(this, "drm", void 0), e(this, "browser", qe()), e(this, "options", void 0), e(this, "element", void 0), e(this, "playbackSource", void 0), e(this, "emitter", new ie()), e(this, "logger", void 0), e(this, "modules", void 0), e(this, "clientIp", void 0), e(this, "sessionId", void 0), e(this, "clientId", cn()), e(this, "_channels", []), e(this, "createdAt", performance.now()), e(this, "offscreenCanvasElement", void 0), e(this, "webCodecsRenditionSupport", void 0), e(this, "hasCalledConnect", !1), e(this, "hasRequestedAudioSession", !1), e(this, "isUserPaused", !1), e(this, "isMediaElementPaused", !1), e(this, "latestEmittedLanguages", []), e(this, "wakeLock", void 0), e(this, "pool", new oe(n.MAX_POOL_SIZE)), e(this, "userAgentInformation", new sn()), e(this, "encryptedMediaExtensions", void 0), i(this, hS, 0), i(this, gS, []), e(this, "sampleProcessingSesssions", /* @__PURE__ */ new Map()), e(this, "unbackedSamplesWarned", new ub()), e(this, "unextractableSamplesWarned", new ub()), e(this, "sizes", /* @__PURE__ */ new Map()), e(this, "isSuspended", !0), e(this, "inactivityDisconnectInterval", void 0), e(this, "visiblePauseTimeout", void 0), e(this, "offscreenSubtitleInterval", void 0), i(this, _S, void 0), e(this, "attach", (e) => {
12275
+ super(), o = this, e(this, "pictureInPicture", void 0), e(this, "drm", void 0), e(this, "browser", qe()), e(this, "options", void 0), e(this, "element", void 0), e(this, "playbackSource", void 0), e(this, "emitter", new ie()), e(this, "logger", void 0), e(this, "modules", void 0), e(this, "clientIp", void 0), e(this, "sessionId", void 0), e(this, "clientId", cn()), e(this, "_channels", []), e(this, "createdAt", performance.now()), e(this, "offscreenCanvasElement", void 0), e(this, "webCodecsRenditionSupport", void 0), e(this, "hasCalledConnect", !1), e(this, "hasRequestedAudioSession", !1), e(this, "isUserPaused", !1), e(this, "isMediaElementPaused", !1), e(this, "latestEmittedLanguages", []), e(this, "wakeLock", void 0), e(this, "pool", new oe(n.MAX_POOL_SIZE)), e(this, "userAgentInformation", new sn()), e(this, "encryptedMediaExtensions", void 0), i(this, LS, 0), i(this, RS, []), e(this, "sampleProcessingSesssions", /* @__PURE__ */ new Map()), e(this, "unbackedSamplesWarned", new Mb()), e(this, "unextractableSamplesWarned", new Mb()), e(this, "sizes", /* @__PURE__ */ new Map()), e(this, "isSuspended", !0), e(this, "inactivityDisconnectInterval", void 0), e(this, "visiblePauseTimeout", void 0), e(this, "offscreenSubtitleInterval", void 0), i(this, zS, void 0), e(this, "attach", (e) => {
12210
12276
  var t;
12211
12277
  (t = this.wakeLock) == null || t.attach(e), e.appendChild(this.element);
12212
12278
  }), e(this, "setElement", (e) => {
@@ -12302,20 +12368,20 @@ var Yx = class {
12302
12368
  }), e(this, "updateTextTracks", (e) => {
12303
12369
  let t = e.filter((e) => e.codec === "webvtt");
12304
12370
  t.forEach((e) => {
12305
- if (!s(gS, this).find((t) => t.language === e.language)) {
12371
+ if (!s(RS, this).find((t) => t.language === e.language)) {
12306
12372
  if (this.modules.canvasModule) {
12307
12373
  let t = this.modules.canvasModule.textTracks.addTextTrack(e.kind, e.label || e.language || "", e.language || "");
12308
- s(gS, this).push(t);
12374
+ s(RS, this).push(t);
12309
12375
  } else if (this.mediaElement instanceof HTMLVideoElement) {
12310
12376
  let t = this.mediaElement.addTextTrack(e.kind, e.label || e.language, e.language);
12311
- s(gS, this).push(t);
12377
+ s(RS, this).push(t);
12312
12378
  }
12313
12379
  }
12314
12380
  });
12315
- for (let e of s(gS, this)) t.find((t) => t.language === e.language) ? e.mode === "disabled" && (e.mode = "hidden") : e.mode = "disabled";
12381
+ for (let e of s(RS, this)) t.find((t) => t.language === e.language) ? e.mode === "disabled" && (e.mode = "hidden") : e.mode = "disabled";
12316
12382
  this.emit("text tracks", this.textTracks);
12317
12383
  }), e(this, "cleanupTextTracks", (e = this.currentTime - 2e4) => {
12318
- s(gS, this).forEach((t) => {
12384
+ s(RS, this).forEach((t) => {
12319
12385
  if (t.cues) for (let n of Array.from(t.cues)) n.endTime * 1e3 < e - 2e3 && t.removeCue(n);
12320
12386
  });
12321
12387
  }), e(this, "filterRenditions", function() {
@@ -12471,8 +12537,8 @@ var Yx = class {
12471
12537
  u = void 0, d = void 0, o.logger.warn("Failed to enable OffscreenCanvas; falling back to main thread rendering", { error: e });
12472
12538
  }
12473
12539
  else s && o.logger.warn("OffscreenCanvas requested but not supported; falling back to main thread rendering");
12474
- let f = o.capturesCanvasOnWebKit(u), p = yield xb.create(o.emitter, o.logger.createContext("DecoderModule"), o.options.get("logLevel"), n, o.playbackSource, o.pool, i, a, u, f), { videoRenderer: m } = p.getStatistics(), h = o.modules.canvasModule;
12475
- if (h instanceof Wb) if (m === "OffscreenCanvas" && d) {
12540
+ let f = o.capturesCanvasOnWebKit(u), p = yield Ub.create(o.emitter, o.logger.createContext("DecoderModule"), o.options.get("logLevel"), n, o.playbackSource, o.pool, i, a, u, f), { videoRenderer: m } = p.getStatistics(), h = o.modules.canvasModule;
12541
+ if (h instanceof fx) if (m === "OffscreenCanvas" && d) {
12476
12542
  h.setVideoRenderingEnabled(!1);
12477
12543
  let e = o.element;
12478
12544
  e.parentElement ? e.parentElement.replaceChild(d, e) : o.logger.warn("OffscreenCanvas rendering is active but the current element is not attached to the DOM. Updating internal element reference only."), o.offscreenCanvasElement = d, o.setElement(d);
@@ -12484,11 +12550,11 @@ var Yx = class {
12484
12550
  t.parentElement && t.parentElement.replaceChild(e, t), o.setElement(e);
12485
12551
  }
12486
12552
  }
12487
- else h instanceof Zb && (h.setBackgroundPlaybackEnabled(o.isBackgroundPlayEnabled(o.channelId)), m === "OffscreenCanvas" && d ? (h.setOffscreenCanvas(d), o.offscreenCanvasElement = d, f && o.connectWebKitVideoOutput(p, h)) : (h.setVideoTrack(void 0), h.setOffscreenCanvas(void 0), o.offscreenCanvasElement = void 0));
12553
+ else h instanceof yx && (h.setBackgroundPlaybackEnabled(o.isBackgroundPlayEnabled(o.channelId)), m === "OffscreenCanvas" && d ? (h.setOffscreenCanvas(d), o.offscreenCanvasElement = d, f && o.connectWebKitVideoOutput(p, h)) : (h.setVideoTrack(void 0), h.setOffscreenCanvas(void 0), o.offscreenCanvasElement = void 0));
12488
12554
  (e = o.modules.decoder) == null || e.unload(), o.modules.decoder = p, o.isHiddenWithBackgroundPlayback() && o.modules.decoder.enableBackgroundTimers(), o.modules.decoder.setVideoRenderingEnabled(o.isVideoOnScreen()), o.modules.decoder.load(), o.setupOffscreenSubtitleRouting();
12489
- })), e(this, "capturesCanvasOnWebKit", (e) => !!e && this.browser.platform.isWebKit && this.modules.canvasModule instanceof Zb), e(this, "connectWebKitVideoOutput", (e, t) => {
12555
+ })), e(this, "capturesCanvasOnWebKit", (e) => !!e && this.browser.platform.isWebKit && this.modules.canvasModule instanceof yx), e(this, "connectWebKitVideoOutput", (e, t) => {
12490
12556
  let n = () => {
12491
- t.setVideoTrack(void 0), this.browser.platform.isIOS && e.setMaxVideoCanvasPixels(mS);
12557
+ t.setVideoTrack(void 0), this.browser.platform.isIOS && e.setMaxVideoCanvasPixels(IS);
12492
12558
  };
12493
12559
  e.onVideoTrackLost((e) => {
12494
12560
  this.logger.warn("Worker video track lost, falling back to canvas capture", { error: e }), n();
@@ -12496,7 +12562,7 @@ var Yx = class {
12496
12562
  let r = e.videoTrack;
12497
12563
  r ? t.setVideoTrack(r) : n();
12498
12564
  }), e(this, "setupOffscreenSubtitleRouting", () => {
12499
- if (this.offscreenSubtitleInterval !== void 0 && (clearInterval(this.offscreenSubtitleInterval), this.offscreenSubtitleInterval = void 0), !this.offscreenCanvasElement || !this.modules.decoder || this.modules.canvasModule instanceof Zb) return;
12565
+ if (this.offscreenSubtitleInterval !== void 0 && (clearInterval(this.offscreenSubtitleInterval), this.offscreenSubtitleInterval = void 0), !this.offscreenCanvasElement || !this.modules.decoder || this.modules.canvasModule instanceof yx) return;
12500
12566
  let e = this.modules.decoder, t = this.modules.canvasModule;
12501
12567
  if (!t) return;
12502
12568
  let n = !1;
@@ -12538,7 +12604,7 @@ var Yx = class {
12538
12604
  this.clearVisiblePauseDisconnect(), this.isUserPaused = !1, this.requestAudioSessionOnce(), this.hasCalledConnect ? this.unsuspend() : this.playbackState !== "playing" && (this._connect(), self.addEventListener("__vindral_register_debug__", this.registerDebugInstance), this.modules.timer.setInterval(() => this.cleanupTextTracks(), n.REMOVE_CUE_THRESHOLD)), (e = this.wakeLock) == null || e.enable(), this.playbackState === "paused" && this.playbackSource.isActivated && (this.resetModules(), this.emitter.emit("flush buffers"), this.cleanupTextTracks(2 ** 53 - 1)), this.playbackSource.play(), this.isHiddenWithBackgroundPlayback() && this.scheduleInactivityDisconnect();
12539
12605
  }), e(this, "getStatistics", () => {
12540
12606
  let e = Object.values(this.modules).reduce((e, t) => t && "getStatistics" in t ? y(y({}, e), t.getStatistics()) : e, this.getRuntimeInfo()), t = Math.round(this.timeActive > 0 ? (e.bytesReceived || 0) * 8 / (this.timeActive / 1e3) : 0), n = this.uptime / 36e5, r = Math.max(0, (e.connectCount || 0) - 1), i = n > 0 ? r / n : 0, a = this.timeActive / 6e4, o = Math.max(a, 1), s = a > 0 ? (e.seekAdjustmentCount || 0) / o : 0, c = a > 0 ? (e.timeshiftAdjustmentCount || 0) / o : 0;
12541
- return sS(y(y({}, e), {}, {
12607
+ return kS(y(y({}, e), {}, {
12542
12608
  averageBitRate: t,
12543
12609
  reconnectsPerHour: i,
12544
12610
  seekAdjustmentsPerMinute: s,
@@ -12547,7 +12613,7 @@ var Yx = class {
12547
12613
  }), e(this, "resetModules", () => {
12548
12614
  Object.values(this.modules).forEach((e) => {
12549
12615
  e && "reset" in e && e.reset();
12550
- }), this.playbackSource instanceof dc && this.modules.adaptivity.holdReconnect(pS), this.sampleProcessingSesssions.clear(), this.cleanupTextTracks(Infinity), this.playbackSource.currentTime = 0, this.playbackSource.isActivated = !1;
12616
+ }), this.playbackSource instanceof dc && this.modules.adaptivity.holdReconnect(FS), this.sampleProcessingSesssions.clear(), this.cleanupTextTracks(Infinity), this.playbackSource.currentTime = 0, this.playbackSource.isActivated = !1;
12551
12617
  }), e(this, "disconnectForInactivePage", (e) => {
12552
12618
  if (this.clearInactivityDisconnect(), this.emitter.emit("flush buffers"), !this.isBackgroundPlayEnabled(this.channelId)) {
12553
12619
  var t;
@@ -12578,10 +12644,10 @@ var Yx = class {
12578
12644
  e && "unsuspend" in e && e.unsuspend();
12579
12645
  });
12580
12646
  }), e(this, "getRuntimeInfo", () => {
12581
- let e = this.modules.canvasModule instanceof Zb ? !0 : void 0;
12647
+ let e = this.modules.canvasModule instanceof yx ? !0 : void 0;
12582
12648
  return y({
12583
12649
  uptime: this.uptime,
12584
- version: "4.7.2-17-g3c99bc71",
12650
+ version: "4.7.2-18-g998978f5",
12585
12651
  clientId: this.clientId,
12586
12652
  sessionId: this.sessionId,
12587
12653
  channelId: this.channelId,
@@ -12626,7 +12692,7 @@ var Yx = class {
12626
12692
  if (this.browser.platform.isWebKit || !this.browser.isMobile) return !1;
12627
12693
  let t = (e = this.modules) == null ? void 0 : e.decoder;
12628
12694
  return t ? t.audioWebCodecsInUse : this.isWebCodecsAudioAvailable(this.channelId);
12629
- }), this.options = new Yx(y(y({}, ar), uS(r))), r.telemetryEnabled === void 0 && ["localhost", "127.0.0.1"].includes(location.hostname) && this.options.set("telemetryEnabled", !1);
12695
+ }), this.options = new _S(y(y({}, ar), MS(r))), r.telemetryEnabled === void 0 && ["localhost", "127.0.0.1"].includes(location.hostname) && this.options.set("telemetryEnabled", !1);
12630
12696
  let d = {
12631
12697
  channelId: this.options.get("channelId"),
12632
12698
  audio: {
@@ -12639,14 +12705,14 @@ var Yx = class {
12639
12705
  height: this.options.get("maxSize").height
12640
12706
  }
12641
12707
  }, f = b.get();
12642
- f.setLevel(this.options.get("logLevel")), f.setDebug(!1), this.logger = f, this.webCodecsRenditionSupport = new fS(f), r.iosMediaElementEnabled !== void 0 && this.logger.warn("Option iosMediaElementEnabled is deprecated and will be removed in a future release. Use streamToMediaElementEnabled instead.");
12708
+ f.setLevel(this.options.get("logLevel")), f.setDebug(!1), this.logger = f, this.webCodecsRenditionSupport = new PS(f), r.iosMediaElementEnabled !== void 0 && this.logger.warn("Option iosMediaElementEnabled is deprecated and will be removed in a future release. Use streamToMediaElementEnabled instead.");
12643
12709
  let p = (c = r.streamToMediaElementEnabled) == null ? r.iosMediaElementEnabled : c;
12644
12710
  p !== void 0 && (this.options.set("streamToMediaElementEnabled", p), this.options.set("iosMediaElementEnabled", p)), r.iosBackgroundPlayEnabled !== void 0 && this.logger.warn("Option iosBackgroundPlayEnabled is deprecated and will be removed in a future release. Use backgroundPlayEnabled instead.");
12645
12711
  let m = (u = r.backgroundPlayEnabled) == null ? r.iosBackgroundPlayEnabled : u;
12646
12712
  m !== void 0 && (this.options.set("backgroundPlayEnabled", m), this.options.set("iosBackgroundPlayEnabled", m));
12647
12713
  let g = r.mseEnabled !== void 0, ee = r.decoders !== void 0;
12648
12714
  g && this.logger.warn("Option mseEnabled is deprecated and will be removed in a future release. Use decoders instead (e.g. decoders: [\"wasm\"])."), g && !ee && r.mseEnabled === !1 && this.options.set("decoders", ["wasm"]);
12649
- let _ = px.create(this.emitter, this.logger.createContext("PictureInPictureModule")), te = this.options.get("mediaSessionEnabled") ? Yb.create(this.emitter, this.logger.createContext("MediaSessionModule"), {
12715
+ let _ = Fx.create(this.emitter, this.logger.createContext("PictureInPictureModule")), te = this.options.get("mediaSessionEnabled") ? _x.create(this.emitter, this.logger.createContext("MediaSessionModule"), {
12650
12716
  metadata: this.options.get("mediaSessionMetadata"),
12651
12717
  decoy: this.willUseMediaSource() || this.usesSplitCanvasAudio() ? void 0 : Ac.create(this.logger.createContext("AudioFocusDecoy"), this.yieldToInterruption),
12652
12718
  isMuted: () => this.playbackSource.userMuted,
@@ -12657,11 +12723,11 @@ var Yx = class {
12657
12723
  holdDecoyWhilePaused: this.holdsDecoyWhilePaused(),
12658
12724
  keepDecoyWhenMuted: this.isWebKitCanvasPath(),
12659
12725
  pauseMeansMute: !this.options.get("pauseSupportEnabled")
12660
- }) : void 0, v = O.create(), re = nb.create(this.emitter, this.logger.createContext("ConnectionModule"), {
12726
+ }) : void 0, v = O.create(), re = wb.create(this.emitter, this.logger.createContext("ConnectionModule"), {
12661
12727
  reconnectHandler: this.options.get("reconnectHandler"),
12662
12728
  options: this.options,
12663
12729
  onConnectInfo: this.onConnectInfo
12664
- }), ae = jv.create(this.logger.createContext("SubscriptionModule"), this.emitter, d), x = wx.create(this.emitter, ae), S = hx.create(this.emitter, this.logger.createContext("PlaybackModule"), this, this.options.get("minBufferTime")), se = Sx.create(this.emitter, this.logger.createContext("QualityOfServiceModule"), x, S);
12730
+ }), ae = jv.create(this.logger.createContext("SubscriptionModule"), this.emitter, d), x = Kx.create(this.emitter, ae), S = Lx.create(this.emitter, this.logger.createContext("PlaybackModule"), this, this.options.get("minBufferTime")), se = Wx.create(this.emitter, this.logger.createContext("QualityOfServiceModule"), x, S);
12665
12731
  this.encryptedMediaExtensions = new Ci(this.emitter, this.logger.createContext("EncryptedMediaExtensions"), r.drm), this.drm = {
12666
12732
  setHeaders: (e) => {
12667
12733
  this.encryptedMediaExtensions.headers = e;
@@ -12670,7 +12736,7 @@ var Yx = class {
12670
12736
  this.encryptedMediaExtensions.queryParams = e;
12671
12737
  }
12672
12738
  };
12673
- let ce = Cb.create(this.emitter), le = this.options.get("poster"), ue = le === !0 ? this.getThumbnailUrl() : le || void 0, C, de, fe;
12739
+ let ce = Gb.create(this.emitter), le = this.options.get("poster"), ue = le === !0 ? this.getThumbnailUrl() : le || void 0, C, de, fe;
12674
12740
  if (this.willUseMediaSource()) {
12675
12741
  let e = new dc({
12676
12742
  type: this.options.get("media") === "audio" ? "audio" : "video",
@@ -12680,9 +12746,9 @@ var Yx = class {
12680
12746
  logger: this.logger.createContext("MediaElement"),
12681
12747
  poster: ue
12682
12748
  });
12683
- e.on("buffer state", (e) => this.onMediaElementBufferState(e, C)), e.on("needs user input", (e) => this.emitter.emit("needs user input", e)), e.on("volume state", (e) => this.emitter.emit("volume state", e)), e.on("media element state", (e) => this.onMediaElementState(e)), this.element = e.element, this.playbackSource = e, Ci.isSupported() && this.encryptedMediaExtensions.attach(e.element), C = nx.create(this.logger.createContext("MseModule"), this.emitter, this.element), this.options.get("pauseSupportEnabled") || (de = Kx.create(this.logger.createContext("UnpauseModule"), [e], ce)), this.options.get("pictureInPictureEnabled") && this.emitter.emit("add picture in picture listener", { element: e.element });
12749
+ e.on("buffer state", (e) => this.onMediaElementBufferState(e, C)), e.on("needs user input", (e) => this.emitter.emit("needs user input", e)), e.on("volume state", (e) => this.emitter.emit("volume state", e)), e.on("media element state", (e) => this.onMediaElementState(e)), this.element = e.element, this.playbackSource = e, Ci.isSupported() && this.encryptedMediaExtensions.attach(e.element), C = wx.create(this.logger.createContext("MseModule"), this.emitter, this.element), this.options.get("pauseSupportEnabled") || (de = mS.create(this.logger.createContext("UnpauseModule"), [e], ce)), this.options.get("pictureInPictureEnabled") && this.emitter.emit("add picture in picture listener", { element: e.element });
12684
12750
  } else if (this.streamsToMediaElement()) {
12685
- let e = Zb.create(this.emitter, this.logger.createContext("ModernCanvasModule"), this.pool, this, {
12751
+ let e = yx.create(this.emitter, this.logger.createContext("ModernCanvasModule"), this.pool, this, {
12686
12752
  type: this.options.get("media") === "audio" ? "audio" : "video",
12687
12753
  muted: this.options.get("muted") || this.options.get("media") === "video",
12688
12754
  volume: this.options.get("volume"),
@@ -12694,10 +12760,10 @@ var Yx = class {
12694
12760
  });
12695
12761
  this.element = e.element().element, this.playbackSource = e, fe = e;
12696
12762
  let t = this.browser.platform.isIOS && this.browser.platform.iosVersion <= 15;
12697
- this.options.get("pictureInPictureEnabled") && !t && this.emitter.emit("add picture in picture listener", { element: this.element }), this.options.get("pauseSupportEnabled") || (de = Kx.create(this.logger.createContext("UnpauseModule"), e.elements(), ce));
12763
+ this.options.get("pictureInPictureEnabled") && !t && this.emitter.emit("add picture in picture listener", { element: this.element }), this.options.get("pauseSupportEnabled") || (de = mS.create(this.logger.createContext("UnpauseModule"), e.elements(), ce));
12698
12764
  } else {
12699
12765
  let e;
12700
- e = Wb.create(this.emitter, this.logger.createContext("LegacyCanvasModule"), this.pool, this, this.options.get("muted") || this.options.get("media") === "video", this.options.get("volume"), () => {
12766
+ e = fx.create(this.emitter, this.logger.createContext("LegacyCanvasModule"), this.pool, this, this.options.get("muted") || this.options.get("media") === "video", this.options.get("volume"), () => {
12701
12767
  this.setElement(e.element());
12702
12768
  }, this.options.get("minBufferTime")), this.element = e.element(), this.playbackSource = e, fe = e, this.options.get("iosWakeLockEnabled") && (this.wakeLock = new Qs());
12703
12769
  }
@@ -12715,9 +12781,9 @@ var Yx = class {
12715
12781
  getTargetBufferTime: () => S.getTargetBufferTime(),
12716
12782
  getNextBufferedRangeStart: C ? (e) => C.getNextBufferedRangeStart(e) : void 0,
12717
12783
  getBufferedEndAt: C ? (e) => C.getBufferedEndAt(e) : void 0
12718
- }, ge = Bx.create(this.emitter, this.logger.createContext("SyncModule"), this.playbackSource, he, me, pe), _e = kb.create(this.logger.createContext("JitterModule")), ve = mc.create(this.emitter), ye = (this.options.get("edgeUrl") || this.options.get("url")).replace("wss://", "https://").replace("ws://", "http://").replace("//lb.", "//errors."), w = new URL("/telemetry", ye).toString();
12784
+ }, ge = cS.create(this.emitter, this.logger.createContext("SyncModule"), this.playbackSource, he, me, pe), _e = Zb.create(this.logger.createContext("JitterModule")), ve = mc.create(this.emitter), ye = (this.options.get("edgeUrl") || this.options.get("url")).replace("wss://", "https://").replace("ws://", "http://").replace("//lb.", "//errors."), w = new URL("/telemetry", ye).toString();
12719
12785
  this.modules = {
12720
- telemetry: Wx.create(this.logger.createContext("TelemetryModule"), this.emitter, {
12786
+ telemetry: fS.create(this.logger.createContext("TelemetryModule"), this.emitter, {
12721
12787
  url: w,
12722
12788
  enabled: this.options.get("telemetryEnabled"),
12723
12789
  includeStats: !1,
@@ -12729,8 +12795,8 @@ var Yx = class {
12729
12795
  }),
12730
12796
  incomingData: ve,
12731
12797
  adaptivity: wc.create(this.emitter, this.logger.createContext("AdaptivityModule"), se, ve, { cooldownTime: Math.max(this.options.get("minBufferTime"), 2e3) }),
12732
- constraintCap: sb.create(this.emitter, this.element, x, this.options.get("abrEnabled") ? this.options.get("sizeBasedResolutionCapEnabled") : !1),
12733
- event: Eb.create(this.emitter, this.logger.createContext("EventModule"), ge),
12798
+ constraintCap: kb.create(this.emitter, this.element, x, this.options.get("abrEnabled") ? this.options.get("sizeBasedResolutionCapEnabled") : !1),
12799
+ event: Jb.create(this.emitter, this.logger.createContext("EventModule"), ge),
12734
12800
  sync: ge,
12735
12801
  jitter: _e,
12736
12802
  documentState: ce,
@@ -12802,7 +12868,7 @@ var Yx = class {
12802
12868
  let r = ((t = (n = e.telemetry) == null ? void 0 : n.probability) == null ? 1 : t) >= Math.random();
12803
12869
  if (e.telemetry) {
12804
12870
  var i;
12805
- (i = this.modules.telemetry) == null || i.unload(), this.modules.telemetry = Wx.create(this.logger.createContext("TelemetryModule"), this.emitter, y(y({}, e.telemetry), {}, { enabled: this.options.get("telemetryEnabled") && r }), this), this.modules.telemetry.load();
12871
+ (i = this.modules.telemetry) == null || i.unload(), this.modules.telemetry = fS.create(this.logger.createContext("TelemetryModule"), this.emitter, y(y({}, e.telemetry), {}, { enabled: this.options.get("telemetryEnabled") && r }), this), this.modules.telemetry.load();
12806
12872
  }
12807
12873
  }), this.emitter.on("adapt level", (e) => {
12808
12874
  let t = this.modules.renditions.getRenditionLevels(), n = this.modules.renditions.getRenditionLevel(), r = t.findIndex((e) => e === n), i = t.length - 1, a = r;
@@ -12844,8 +12910,8 @@ var Yx = class {
12844
12910
  audio: y(y({}, this.targetSubscription.audio), f == null ? void 0 : f.audio)
12845
12911
  })), this.emitter.emit("adapted level");
12846
12912
  }), this.emitter.on("ping timeout", this.stepDownForRejoin), this.emitter.on("text track data", (e) => {
12847
- let t = s(gS, this).find((t) => t.language === e.language), n = this.modules.sync.getTimeshiftOffset() / 1e3, r = n - s(hS, this);
12848
- if (a(hS, this, n), t) {
12913
+ let t = s(RS, this).find((t) => t.language === e.language), n = this.modules.sync.getTimeshiftOffset() / 1e3, r = n - s(LS, this);
12914
+ if (a(LS, this, n), t) {
12849
12915
  if (t.cues) for (let e of t.cues) e.startTime -= r, e.endTime -= r;
12850
12916
  for (let r of e.cues) {
12851
12917
  let e = new VTTCue(r.startTime - n, r.endTime - n, r.text);
@@ -12861,19 +12927,19 @@ var Yx = class {
12861
12927
  this.clientIp = t.ip;
12862
12928
  break;
12863
12929
  case "renditions":
12864
- this.updateTextTracks(t.renditions), a(_S, this, this.filterRenditions(t.renditions, n.channelId).then((e) => {
12930
+ this.updateTextTracks(t.renditions), a(zS, this, this.filterRenditions(t.renditions, n.channelId).then((e) => {
12865
12931
  r === this.sessionId && (this.emitter.emit("renditions", {
12866
12932
  renditions: e,
12867
12933
  channelId: n.channelId
12868
12934
  }), this.emit("rendition levels", this.modules.renditions.getRenditionLevels()), this.emitLanguagesIfChanged());
12869
12935
  }).finally(() => {
12870
- a(_S, this, void 0);
12936
+ a(zS, this, void 0);
12871
12937
  }));
12872
12938
  break;
12873
12939
  case "subscription changed":
12874
12940
  var i;
12875
12941
  try {
12876
- dS(t.subscription);
12942
+ NS(t.subscription);
12877
12943
  } catch (e) {
12878
12944
  this.emitter.emit("error", new k("Subscription failed validation", {
12879
12945
  source: e instanceof Error ? e : void 0,
@@ -13004,7 +13070,7 @@ var Yx = class {
13004
13070
  let xe = function() {
13005
13071
  var e = t(function* (e) {
13006
13072
  let t = e.channelId;
13007
- s(_S, o) && (yield s(_S, o));
13073
+ s(zS, o) && (yield s(zS, o));
13008
13074
  let n = o.modules.renditions.getRendition(e.renditionId, t);
13009
13075
  if (!zs(e.flags)) {
13010
13076
  if (Bs(e.flags)) {
@@ -13018,8 +13084,8 @@ var Yx = class {
13018
13084
  } catch (e) {
13019
13085
  o.logger.warn("failed to parse WebVTT segment, dropping it", e);
13020
13086
  }
13021
- let i = n / 1e3, c = s(gS, o).find((t) => t.language === e.language), l = i - s(hS, o);
13022
- if (a(hS, o, i), c) {
13087
+ let i = n / 1e3, c = s(RS, o).find((t) => t.language === e.language), l = i - s(LS, o);
13088
+ if (a(LS, o, i), c) {
13023
13089
  if (c.cues) for (let e of c.cues) e.startTime -= l, e.endTime -= l;
13024
13090
  for (let e of r) {
13025
13091
  let t = new VTTCue(e.startTime - i, e.endTime - i, e.text);
@@ -13055,10 +13121,10 @@ var Yx = class {
13055
13121
  mimeType: s
13056
13122
  }), o.emit("initialized media");
13057
13123
  } else {
13058
- let t = nS(e, n, o.sizes.get(e.renditionId));
13124
+ let t = wS(e, n, o.sizes.get(e.renditionId));
13059
13125
  o.modules.jitter.recordSample(t);
13060
13126
  let i = o.sampleProcessingSesssions.get(r);
13061
- if (!i) i = Zx(o.modules.sync.processSample(t)), o.sampleProcessingSesssions.set(r, i);
13127
+ if (!i) i = yS(o.modules.sync.processSample(t)), o.sampleProcessingSesssions.set(r, i);
13062
13128
  else {
13063
13129
  let e = o.willUseMediaSource() && o.isSwitchingRenditionLevel && t.type === "video", n = i(o.modules.sync.processSample(t), e), r = t;
13064
13130
  n.forEach((e) => {
@@ -13165,7 +13231,7 @@ var Yx = class {
13165
13231
  this.modules.subscription.setLanguage(e), this.alignSizeAndBitRate(this.targetSubscription);
13166
13232
  }
13167
13233
  set textTrack(e) {
13168
- e !== this.textTrack && (s(gS, this).forEach((t) => {
13234
+ e !== this.textTrack && (s(RS, this).forEach((t) => {
13169
13235
  if (t.label === e) t.mode = "showing";
13170
13236
  else {
13171
13237
  if (t.mode === "showing" && t.cues) for (let e of [...t.cues]) t.removeCue(e);
@@ -13174,11 +13240,11 @@ var Yx = class {
13174
13240
  }), this.emitter.emit("text track", e));
13175
13241
  }
13176
13242
  get textTracks() {
13177
- return s(gS, this).filter((e) => e.mode !== "disabled").map((e) => e.label);
13243
+ return s(RS, this).filter((e) => e.mode !== "disabled").map((e) => e.label);
13178
13244
  }
13179
13245
  get textTrack() {
13180
13246
  var e;
13181
- return (e = s(gS, this).find((e) => e.mode === "showing")) == null ? void 0 : e.label;
13247
+ return (e = s(RS, this).find((e) => e.mode === "showing")) == null ? void 0 : e.label;
13182
13248
  }
13183
13249
  get channelId() {
13184
13250
  var e, t;
@@ -13316,7 +13382,7 @@ var Yx = class {
13316
13382
  return this.modules.subscription.getTargetSubscription();
13317
13383
  }
13318
13384
  resolvedDecoder(e) {
13319
- return tS(this.options.get("decoders", e), this.browser.supportsMediaSource, this.options.get("drm"));
13385
+ return CS(this.options.get("decoders", e), this.browser.supportsMediaSource, this.options.get("drm"));
13320
13386
  }
13321
13387
  usesSplitCanvasAudio() {
13322
13388
  return !this.willUseMediaSource() && this.options.get("streamToMediaElementEnabled") && gt(this.browser) && this.options.get("media") !== "audio" && this.options.get("media") !== "video" && this.browser.platform.isIOS;
@@ -13356,6 +13422,6 @@ var Yx = class {
13356
13422
  return this.hasCalledConnect && this.isBackgroundPlayEnabled(e) && !this.isUserPaused;
13357
13423
  }
13358
13424
  };
13359
- e(vS, "MAX_POOL_SIZE", 10), e(vS, "REMOVE_CUE_THRESHOLD", 1e3 * 10), e(vS, "BACKGROUND_INACTIVITY_DISCONNECT_TIMEOUT", 1e3 * 15), e(vS, "VISIBLE_PAUSE_DISCONNECT_DELAY", 1e3);
13425
+ e(BS, "MAX_POOL_SIZE", 10), e(BS, "REMOVE_CUE_THRESHOLD", 1e3 * 10), e(BS, "BACKGROUND_INACTIVITY_DISCONNECT_TIMEOUT", 1e3 * 15), e(BS, "VISIBLE_PAUSE_DISCONNECT_DELAY", 1e3);
13360
13426
  //#endregion
13361
- export { ft as C, ht as D, dt as E, Ve as O, mt as S, st as T, rt as _, xn as a, nt as b, _n as c, Cn as d, k as f, et as g, it as h, yn as i, Be as k, On as l, tt as m, Pn as n, Sn as o, Jt as p, bn as r, vn as s, vS as t, wn as u, lt as v, ut as w, ot as x, $e as y };
13427
+ export { ft as C, ht as D, dt as E, Ve as O, mt as S, st as T, rt as _, xn as a, nt as b, _n as c, Cn as d, k as f, et as g, it as h, yn as i, Be as k, On as l, tt as m, Pn as n, Sn as o, Jt as p, bn as r, vn as s, BS as t, wn as u, lt as v, ut as w, ot as x, $e as y };