@vindral/web-sdk 4.8.2-22-g9f9a67a7 → 4.8.2-24-g6a89da20e

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.
@@ -8895,10 +8895,10 @@ function yb() {
8895
8895
  return f(e);
8896
8896
  }
8897
8897
  // ../../libs/web-sdk/src/transports/WebSocket.ts
8898
- var bb = class extends s {
8898
+ var bb = 1e3, xb = class extends s {
8899
8899
  constructor(n, r) {
8900
8900
  var i;
8901
- super(), i = 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", () => {
8901
+ super(), i = 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, "openedAt", void 0), e(this, "erroredAt", void 0), e(this, "closeAfterErrorTimeout", void 0), e(this, "shouldContinueConnecting", !1), e(this, "_isConnectInProgress", !1), e(this, "readyState", () => {
8902
8902
  var e, t;
8903
8903
  return (e = (t = this.websocket) == null ? void 0 : t.readyState) == null ? WebSocket.CLOSED : e;
8904
8904
  }), e(this, "url", () => {
@@ -8910,9 +8910,11 @@ var bb = class extends s {
8910
8910
  }), e(this, "closeSocket", (e, t) => {
8911
8911
  e.onmessage = b, e.removeEventListener("error", this.onError), e.removeEventListener("close", this.onClose), e.removeEventListener("open", this.onOpen), e.close(1e3, t);
8912
8912
  }), e(this, "close", (e) => {
8913
- this.clearConnectTimeout();
8913
+ this.clearConnectTimeout(), clearTimeout(this.closeAfterErrorTimeout), this.closeAfterErrorTimeout = void 0, this.openedAt = void 0, this.erroredAt = void 0;
8914
8914
  let t = this.websocket;
8915
8915
  return t && this.closeSocket(t, e), this.websocket = void 0, this.shouldContinueConnecting = !1, this._isConnectInProgress = !1, this.logger.info("Closed websocket", { reason: e }), !!t;
8916
+ }), e(this, "finishPendingDrop", () => {
8917
+ this.erroredAt !== void 0 && this.handleClose();
8916
8918
  }), e(this, "suspend", () => {
8917
8919
  this.isSuspended = !0;
8918
8920
  }), e(this, "unsuspend", () => {
@@ -8920,39 +8922,47 @@ var bb = class extends s {
8920
8922
  }), e(this, "onMessage", (e) => {
8921
8923
  this.options.onMessage(e.data);
8922
8924
  }), e(this, "onError", () => {
8923
- this.logger.warn("On error", p({}, this.options)), this.close("websocket had an error"), this.emit("error", new M("WebSocket error", {
8925
+ this.logger.warn("On error", p({}, this.options)), this.openedAt === void 0 ? (this.close("websocket had an error"), this.emit("error", new M("WebSocket error", {
8924
8926
  code: "websocket_error",
8925
8927
  isFatal: !1
8926
- }));
8928
+ }))) : (this.erroredAt != null || (this.erroredAt = performance.now()), this.closeAfterErrorTimeout != null || (this.closeAfterErrorTimeout = setTimeout(() => this.handleClose(), bb)));
8927
8929
  }), e(this, "onClose", (e) => {
8928
- let t = this._isConnectInProgress;
8930
+ this.handleClose(e);
8931
+ }), e(this, "handleClose", (e) => {
8932
+ let t = this._isConnectInProgress, n = this.openedAt, r = this.erroredAt, i = r !== void 0;
8929
8933
  this.logger.info("Closed", p(p({}, this.options), {}, {
8930
- reason: e.reason,
8931
- code: e.code,
8934
+ reason: e == null ? void 0 : e.reason,
8935
+ code: e == null ? void 0 : e.code,
8936
+ hadError: i,
8932
8937
  isSuspended: this.isSuspended
8933
8938
  })), this.close("websocket was closed");
8934
- let n;
8935
- switch (e.code) {
8939
+ let a;
8940
+ switch (e == null ? void 0 : e.code) {
8936
8941
  case 4e3:
8937
- n = Wn(Un());
8942
+ a = Wn(Un());
8938
8943
  break;
8939
8944
  case 4001:
8940
- n = Wn(Un());
8945
+ a = Wn(Un());
8941
8946
  break;
8942
8947
  case 4002:
8943
- n = Gn(Un());
8948
+ a = Gn(Un());
8944
8949
  break;
8945
8950
  case 4003:
8946
- n = qn("internal", Un());
8951
+ a = qn("internal", Un());
8947
8952
  break;
8948
8953
  case 4010:
8949
- n = Kn("internal", Un());
8954
+ a = Kn("internal", Un());
8950
8955
  break;
8951
- default: t && (n = Xn(/* @__PURE__ */ Error("WebSocket closed before open")));
8952
- }
8953
- n && this.emit("error", n), this.emit("close", this);
8956
+ default: t && (a = Xn(/* @__PURE__ */ Error("WebSocket closed before open")));
8957
+ }
8958
+ a && this.emit("error", a), n !== void 0 && this.emit("drop", {
8959
+ closeCode: e == null ? void 0 : e.code,
8960
+ wasClean: e == null ? void 0 : e.wasClean,
8961
+ hadError: i,
8962
+ openMs: Math.round((r == null ? performance.now() : r) - n)
8963
+ }), this.emit("close", this);
8954
8964
  }), e(this, "onOpen", () => {
8955
- this.logger.info("Opened", p({}, this.options)), this.readyState() === WebSocket.OPEN && (this.clearConnectTimeout(), this._connectTime = performance.now() - this.connectStartTime, this.reconnectState.reconnectRetries = 0, this._isConnectInProgress = !1, this.emit("open", this));
8965
+ this.logger.info("Opened", p({}, this.options)), this.readyState() === WebSocket.OPEN && (this.openedAt = performance.now(), this.clearConnectTimeout(), this._connectTime = performance.now() - this.connectStartTime, this.reconnectState.reconnectRetries = 0, this._isConnectInProgress = !1, this.emit("open", this));
8956
8966
  }), e(this, "clearConnectTimeout", () => {
8957
8967
  this.connectTimeout && (clearTimeout(this.connectTimeout), this.connectTimeout = void 0);
8958
8968
  }), e(this, "startConnectTimeout", () => {
@@ -8962,7 +8972,8 @@ var bb = class extends s {
8962
8972
  }), e(this, "connect", t(function* (e = !1) {
8963
8973
  if (i.isConnectInProgress) return i.logger.info("Connect already in progress"), !1;
8964
8974
  if (i.isSuspended) return !1;
8965
- if (i.readyState() !== WebSocket.CLOSED && i.close("new connection in progress"), i.shouldContinueConnecting = !0, i._isConnectInProgress = !0, e && i.options.reconnectDelay > 0) {
8975
+ if (i.erroredAt !== void 0) return i.logger.info("Connect skipped, waiting for the dropped socket's close event"), !1;
8976
+ if (i.websocket && i.close("new connection in progress"), i.shouldContinueConnecting = !0, i._isConnectInProgress = !0, e && i.options.reconnectDelay > 0) {
8966
8977
  i.logger.info("Waiting for reconnect delay", p({}, i.options)), yield on(i.options.reconnectDelay);
8967
8978
  let e = yield i.options.reconnectHandler(i.reconnectState);
8968
8979
  if (i.reconnectState.reconnectRetries++, !e) return i._isConnectInProgress = !1, i.emit("error", Zn()), !1;
@@ -8996,7 +9007,7 @@ var bb = class extends s {
8996
9007
  get connectTime() {
8997
9008
  return this._connectTime;
8998
9009
  }
8999
- }, xb, Sb = 524288, Cb = .9, wb = 40, Tb = (e) => Sb * Cb * 1e3 / (e || wb), Eb = class n {
9010
+ }, Sb, Cb = 524288, wb = .9, Tb = 40, Eb = (e) => Cb * wb * 1e3 / (e || Tb), Db = class n {
9000
9011
  constructor(r, i, a, o) {
9001
9012
  var s = this;
9002
9013
  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, "lastSignalSentTime", performance.now()), e(this, "connectCount", 0), e(this, "missedPings", 0), e(this, "closedForBacklog", !1), e(this, "isContextSwitchInProgress", !1), e(this, "signalBuffer", []), e(this, "dataBuffer", []), e(this, "disconnected", new x()), e(this, "linkQueue", new jy()), e(this, "clockCorrection", 0), e(this, "backlogBreaker", new ly(this.linkQueue, () => this.getState() === "connected", (e) => {
@@ -9081,15 +9092,19 @@ var bb = class extends s {
9081
9092
  }
9082
9093
  }
9083
9094
  }), e(this, "connectWebSocketTransport", () => {
9084
- let e = new bb({
9095
+ let e = new xb({
9085
9096
  reconnectDelay: 1e3,
9086
9097
  onMessage: this.onMessage,
9087
9098
  reconnectHandler: this.config.reconnectHandler,
9088
9099
  connectHandler: this.resolveEdgeUrl
9089
9100
  }, this.logger.createContext("Transport"));
9090
- return e.on("open", this.onTransportChange), e.on("close", this.onTransportChange), e.on("error", (e) => this.disconnected.reject(e)), e.connect(), e;
9101
+ return e.on("open", this.onTransportChange), e.on("close", this.onTransportChange), e.on("error", (e) => this.disconnected.reject(e)), e.on("drop", this.onTransportDrop), e.connect(), e;
9102
+ }), e(this, "onTransportDrop", (e) => {
9103
+ this.emitter.emit("telemetry event", p({ code: "connection_dropped" }, e));
9104
+ }), e(this, "finishPendingDrop", () => {
9105
+ this.transport.finishPendingDrop();
9091
9106
  }), e(this, "close", (e = "Disconnect Requested") => {
9092
- this.backlogBreaker.stop(), this.isContextSwitchInProgress = !1, this.signalBuffer = [], this.dataBuffer = [], this.resetPingState(), this.disconnected.resolve(), this.transport.close(e);
9107
+ this.finishPendingDrop(), this.backlogBreaker.stop(), this.isContextSwitchInProgress = !1, this.signalBuffer = [], this.dataBuffer = [], this.resetPingState(), this.disconnected.resolve(), this.transport.close(e);
9093
9108
  }), e(this, "onTransportChange", () => {
9094
9109
  switch (this.getState()) {
9095
9110
  case "connected":
@@ -9134,66 +9149,68 @@ var bb = class extends s {
9134
9149
  return this.disconnected.promise;
9135
9150
  }
9136
9151
  };
9137
- xb = Eb, e(Eb, "PING_INTERVAL", 5e3), e(Eb, "PING_TIMEOUT", 15e3), e(Eb, "MAX_MISSED_PINGS", 4), e(Eb, "TLS_ROUNDTRIPS", 3), e(Eb, "start", (e, t, n, r) => new Promise((i, a) => {
9138
- let o = new xb(e, t, n, r);
9152
+ Sb = Db, e(Db, "PING_INTERVAL", 5e3), e(Db, "PING_TIMEOUT", 15e3), e(Db, "MAX_MISSED_PINGS", 4), e(Db, "TLS_ROUNDTRIPS", 3), e(Db, "start", (e, t, n, r) => new Promise((i, a) => {
9153
+ let o = new Sb(e, t, n, r);
9139
9154
  o.transport.once("error", (e) => a(e)), o.transport.once("open", () => {
9140
9155
  var e;
9141
9156
  (e = n.onTransportConnected) == null || e.call(n), i(o);
9142
9157
  });
9143
9158
  }));
9144
9159
  // ../../libs/web-sdk/src/EdgeSelector.ts
9145
- var Db = (e) => {
9160
+ var Ob = (e) => {
9146
9161
  var t;
9147
9162
  return typeof e == "string" ? e : `${e.moqWsUrl}|${(t = e.moqUrl) == null ? "" : t}`;
9148
- }, Ob = (e) => typeof e == "string" ? e : e.moqUrl || e.moqWsUrl, kb = /* @__PURE__ */ new WeakMap(), Ab = /* @__PURE__ */ new WeakMap(), jb = /* @__PURE__ */ new WeakMap(), Mb = /* @__PURE__ */ new WeakMap(), Nb = class {
9163
+ }, kb = (e) => typeof e == "string" ? e : e.moqUrl || e.moqWsUrl, Ab = /* @__PURE__ */ new WeakMap(), jb = /* @__PURE__ */ new WeakMap(), Mb = /* @__PURE__ */ new WeakMap(), Nb = /* @__PURE__ */ new WeakMap(), Pb = class {
9149
9164
  constructor(e) {
9150
- c(this, kb, void 0), c(this, Ab, []), c(this, jb, /* @__PURE__ */ new Set()), c(this, Mb, void 0), n(kb, this, e);
9165
+ c(this, Ab, void 0), c(this, jb, []), c(this, Mb, /* @__PURE__ */ new Set()), c(this, Nb, void 0), n(Ab, this, e);
9151
9166
  }
9152
9167
  select(e) {
9153
- if (i(kb, this).edgeUrl) return i(kb, this).edgeUrl;
9168
+ if (i(Ab, this).edgeUrl) return i(Ab, this).edgeUrl;
9154
9169
  if (e.length > 0) {
9155
- n(Ab, this, [...e]);
9156
- let t = new Set(i(Ab, this).map((e) => Db(e)));
9157
- for (let e of i(jb, this)) t.has(e) || i(jb, this).delete(e);
9170
+ n(jb, this, [...e]);
9171
+ let t = new Set(i(jb, this).map((e) => Ob(e)));
9172
+ for (let e of i(Mb, this)) t.has(e) || i(Mb, this).delete(e);
9158
9173
  }
9159
- if (i(Ab, this).length === 0) return;
9160
- let t = i(Ab, this).filter((e) => !i(jb, this).has(Db(e)));
9161
- t.length === 0 && (i(jb, this).clear(), t = i(Ab, this));
9174
+ if (i(jb, this).length === 0) return;
9175
+ let t = i(jb, this).filter((e) => !i(Mb, this).has(Ob(e)));
9176
+ t.length === 0 && (i(Mb, this).clear(), t = i(jb, this));
9162
9177
  let r = t[0];
9163
- if (r) return i(jb, this).add(Db(r)), n(Mb, this, r), r;
9178
+ if (r) return i(Mb, this).add(Ob(r)), n(Nb, this, r), r;
9164
9179
  }
9165
9180
  shiftedEdge() {
9166
- return i(Mb, this);
9181
+ return i(Nb, this);
9167
9182
  }
9168
9183
  hasRemainingEdges() {
9169
- return i(Ab, this).some((e) => !i(jb, this).has(Db(e)));
9184
+ return i(jb, this).some((e) => !i(Mb, this).has(Ob(e)));
9170
9185
  }
9171
9186
  reset() {
9172
- n(Mb, this, void 0), n(Ab, this, []), i(jb, this).clear();
9187
+ n(Nb, this, void 0), n(jb, this, []), i(Mb, this).clear();
9173
9188
  }
9174
- }, Pb, Fb = (e) => {
9189
+ }, Fb, Ib = (e) => {
9175
9190
  if (e instanceof M && (e.code() === "channel_not_live" || e.code() === "channel_not_found")) return !0;
9176
9191
  let t = e instanceof M ? e.source() : e;
9177
9192
  if (!(t instanceof Error) || !m(t)) return !1;
9178
9193
  let { status: n } = t;
9179
9194
  return n >= 400 && n < 500 && n !== 408 && n !== 429;
9180
- }, Ib = 3e4, Lb = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakMap(), Rb = /* @__PURE__ */ new WeakMap(), zb = /* @__PURE__ */ new WeakMap(), Bb = /* @__PURE__ */ new WeakMap(), Vb = /* @__PURE__ */ new WeakMap(), Hb = /* @__PURE__ */ new WeakMap(), Ub = /* @__PURE__ */ new WeakMap(), Wb = /* @__PURE__ */ new WeakMap(), Gb = /* @__PURE__ */ new WeakMap(), Kb = /* @__PURE__ */ new WeakMap(), qb = /* @__PURE__ */ new WeakMap(), Jb = /* @__PURE__ */ new WeakMap(), Yb = /* @__PURE__ */ new WeakMap(), Xb = /* @__PURE__ */ new WeakMap(), Zb = /* @__PURE__ */ new WeakMap(), Qb = /* @__PURE__ */ new WeakMap(), $b = /* @__PURE__ */ new WeakMap(), ex = /* @__PURE__ */ new WeakMap(), tx = /* @__PURE__ */ new WeakMap(), nx = /* @__PURE__ */ new WeakMap(), rx = /* @__PURE__ */ new WeakMap(), ix = /* @__PURE__ */ new WeakMap(), ax = /* @__PURE__ */ new WeakSet(), ox = /* @__PURE__ */ new WeakMap(), sx = /* @__PURE__ */ new WeakMap(), cx = /* @__PURE__ */ new WeakMap(), lx = /* @__PURE__ */ new WeakMap(), ux = /* @__PURE__ */ new WeakMap(), dx = /* @__PURE__ */ new WeakMap(), fx = /* @__PURE__ */ new WeakMap(), px = /* @__PURE__ */ new WeakMap(), mx = /* @__PURE__ */ new WeakMap(), hx = class r {
9195
+ }, Lb = 3e4, Rb = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakMap(), zb = /* @__PURE__ */ new WeakMap(), Bb = /* @__PURE__ */ new WeakMap(), Vb = /* @__PURE__ */ new WeakMap(), Hb = /* @__PURE__ */ new WeakMap(), Ub = /* @__PURE__ */ new WeakMap(), Wb = /* @__PURE__ */ new WeakMap(), Gb = /* @__PURE__ */ new WeakMap(), Kb = /* @__PURE__ */ new WeakMap(), qb = /* @__PURE__ */ new WeakMap(), Jb = /* @__PURE__ */ new WeakMap(), Yb = /* @__PURE__ */ new WeakMap(), Xb = /* @__PURE__ */ new WeakMap(), Zb = /* @__PURE__ */ new WeakMap(), Qb = /* @__PURE__ */ new WeakMap(), $b = /* @__PURE__ */ new WeakMap(), ex = /* @__PURE__ */ new WeakMap(), tx = /* @__PURE__ */ new WeakMap(), nx = /* @__PURE__ */ new WeakMap(), rx = /* @__PURE__ */ new WeakMap(), ix = /* @__PURE__ */ new WeakMap(), ax = /* @__PURE__ */ new WeakMap(), ox = /* @__PURE__ */ new WeakSet(), sx = /* @__PURE__ */ new WeakMap(), cx = /* @__PURE__ */ new WeakMap(), lx = /* @__PURE__ */ new WeakMap(), ux = /* @__PURE__ */ new WeakMap(), dx = /* @__PURE__ */ new WeakMap(), fx = /* @__PURE__ */ new WeakMap(), px = /* @__PURE__ */ new WeakMap(), mx = /* @__PURE__ */ new WeakMap(), hx = /* @__PURE__ */ new WeakMap(), gx = class r {
9181
9196
  constructor(a, s, l) {
9182
9197
  var u = this;
9183
- k(this, ax), 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), c(this, Lb, new S(10)), c(this, $, !0), c(this, Rb, void 0), c(this, zb, 0), c(this, Bb, 0), c(this, Vb, void 0), c(this, Hb, !1), c(this, Ub, 0), c(this, Wb, 0), c(this, Gb, 0), c(this, Kb, void 0), c(this, qb, void 0), c(this, Jb, void 0), c(this, Yb, void 0), c(this, Xb, void 0), c(this, Zb, void 0), c(this, Qb, void 0), c(this, $b, []), c(this, ex, void 0), e(this, "unload", () => {
9198
+ k(this, ox), 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), c(this, Rb, new S(10)), c(this, $, !0), c(this, zb, void 0), c(this, Bb, 0), c(this, Vb, 0), c(this, Hb, void 0), c(this, Ub, !1), c(this, Wb, 0), c(this, Gb, 0), c(this, Kb, 0), c(this, qb, void 0), c(this, Jb, void 0), c(this, Yb, void 0), c(this, Xb, void 0), c(this, Zb, void 0), c(this, Qb, void 0), c(this, $b, void 0), c(this, ex, []), c(this, tx, void 0), e(this, "unload", () => {
9184
9199
  var e;
9185
- this.logger.debug("Unloading module..."), this.emitter.off("page active", i(ux, this)), this.emitter.off("network online", i(dx, this)), this.disconnect("Unloading"), (e = this.connectionImpl) == null || e.unload(), n(Qb, this, void 0), this.logger.debug("Unloaded module");
9200
+ this.logger.debug("Unloading module..."), this.emitter.off("page active", i(dx, this)), this.emitter.off("network online", i(fx, this)), this.disconnect("Unloading"), (e = this.connectionImpl) == null || e.unload(), n($b, this, void 0), this.logger.debug("Unloaded module");
9201
+ }), e(this, "finishPendingDrop", () => {
9202
+ this.connectionImpl instanceof Db && this.connectionImpl.finishPendingDrop();
9186
9203
  }), e(this, "suspend", () => {
9187
9204
  var e;
9188
- n($, this, !1), i(lx, this).call(this), (e = this.connectionImpl) == null || e.suspend();
9205
+ n($, this, !1), i(ux, this).call(this), (e = this.connectionImpl) == null || e.suspend();
9189
9206
  }), e(this, "unsuspend", () => {
9190
9207
  var e;
9191
9208
  n($, this, !0), (e = this.connectionImpl) == null || e.unsuspend(), this.connect();
9192
9209
  }), e(this, "getState", () => this.connectionImpl ? this.connectionImpl.getState() : "disconnected"), e(this, "getStatistics", () => {
9193
9210
  var e;
9194
- let t = i(Ub, this) > 0 ? i(Wb, this) / i(Ub, this) : 0;
9211
+ let t = i(Wb, this) > 0 ? i(Gb, this) / i(Wb, this) : 0;
9195
9212
  if (!this.connectionImpl) {
9196
- let e = i(tx, this).call(this);
9213
+ let e = i(nx, this).call(this);
9197
9214
  return {
9198
9215
  rtt: {
9199
9216
  min: 0,
@@ -9202,17 +9219,17 @@ var Db = (e) => {
9202
9219
  last: 0
9203
9220
  },
9204
9221
  estimatedBandwidth: 0,
9205
- connectCount: i(Wb, this),
9206
- backlogReconnectCount: i(Gb, this),
9207
- connectionAttemptCount: i(Ub, this),
9222
+ connectCount: i(Gb, this),
9223
+ backlogReconnectCount: i(Kb, this),
9224
+ connectionAttemptCount: i(Wb, this),
9208
9225
  connectionSuccessRatio: t,
9209
- timeToConnected: i(Yb, this),
9226
+ timeToConnected: i(Xb, this),
9210
9227
  edgeUrl: e == null ? void 0 : e.edgeUrl,
9211
9228
  connectionProtocol: e == null ? void 0 : e.connectionProtocol,
9212
9229
  transportSelectionReason: e == null ? void 0 : e.transportSelectionReason
9213
9230
  };
9214
9231
  }
9215
- let n = this.connectionImpl.getStatistics(), r = (e = this.linkQueue) == null ? void 0 : e.summary(Ib);
9232
+ let n = this.connectionImpl.getStatistics(), r = (e = this.linkQueue) == null ? void 0 : e.summary(Lb);
9216
9233
  return p(p({}, n), {}, {
9217
9234
  linkQueue: r && {
9218
9235
  last: Math.round(r.last),
@@ -9220,29 +9237,29 @@ var Db = (e) => {
9220
9237
  max: Math.round(r.max),
9221
9238
  min: Math.round(r.min)
9222
9239
  },
9223
- rtt: gt(i(Lb, this).items()),
9240
+ rtt: gt(i(Rb, this).items()),
9224
9241
  estimatedBandwidth: this.estimatedBandwidth,
9225
- connectCount: i(Wb, this),
9226
- backlogReconnectCount: i(Gb, this),
9227
- connectionAttemptCount: i(Ub, this),
9242
+ connectCount: i(Gb, this),
9243
+ backlogReconnectCount: i(Kb, this),
9244
+ connectionAttemptCount: i(Wb, this),
9228
9245
  connectionSuccessRatio: t,
9229
- timeToConnected: i(Yb, this)
9246
+ timeToConnected: i(Xb, this)
9230
9247
  });
9231
- }), c(this, tx, () => i($, this) && i(Zb, this) ? i(Zb, this) : i(Xb, this)), e(this, "connect", () => {
9232
- if (n($, this, !0), i(Rb, this)) {
9233
- i(lx, this).call(this);
9248
+ }), c(this, nx, () => i($, this) && i(Qb, this) ? i(Qb, this) : i(Zb, this)), e(this, "connect", () => {
9249
+ if (n($, this, !0), i(zb, this)) {
9250
+ i(ux, this).call(this);
9234
9251
  return;
9235
9252
  }
9236
9253
  let e = performance.now();
9237
- i(Yb, this) === void 0 && n(Kb, this, e), i(qb, this) === void 0 && n(qb, this, e), n(Rb, this, o(ax, this, gx).call(this));
9238
- }), c(this, nx, () => {
9239
- i(Yb, this) === void 0 && i(Kb, this) !== void 0 && i($, this) && (n(Yb, this, performance.now() - i(Kb, this)), n(Kb, this, void 0));
9254
+ i(Xb, this) === void 0 && n(qb, this, e), i(Jb, this) === void 0 && n(Jb, this, e), n(zb, this, o(ox, this, _x).call(this));
9255
+ }), c(this, rx, () => {
9256
+ i(Xb, this) === void 0 && i(qb, this) !== void 0 && i($, this) && (n(Xb, this, performance.now() - i(qb, this)), n(qb, this, void 0));
9240
9257
  }), e(this, "disconnect", (e = "Disconnect Requested") => {
9241
9258
  var t;
9242
- n($, this, !1), i(lx, this).call(this), i(sx, this).call(this), (t = this.connectionImpl) == null || t.close(e);
9259
+ n($, this, !1), i(ux, this).call(this), i(cx, this).call(this), (t = this.connectionImpl) == null || t.close(e);
9243
9260
  }), e(this, "reconnect", (e) => {
9244
9261
  this.disconnect(e), this.connect();
9245
- }), c(this, rx, t(function* () {
9262
+ }), c(this, ix, t(function* () {
9246
9263
  try {
9247
9264
  return yield u.apiClient.connect(u.config.options.getOptions());
9248
9265
  } catch (e) {
@@ -9252,7 +9269,7 @@ var Db = (e) => {
9252
9269
  }
9253
9270
  throw Xn(e instanceof Error ? e : void 0);
9254
9271
  }
9255
- })), c(this, ix, () => new Promise((e) => {
9272
+ })), c(this, ax, () => new Promise((e) => {
9256
9273
  let t = performance.now(), n = () => e(performance.now() - t), i = () => e(void 0);
9257
9274
  try {
9258
9275
  let e = new XMLHttpRequest();
@@ -9260,67 +9277,67 @@ var Db = (e) => {
9260
9277
  } catch (e) {
9261
9278
  i();
9262
9279
  }
9263
- })), c(this, ox, () => {
9264
- i(sx, this).call(this), n(ex, this, setTimeout(() => {
9280
+ })), c(this, sx, () => {
9281
+ i(cx, this).call(this), n(tx, this, setTimeout(() => {
9265
9282
  var e;
9266
- i(Qb, this) && ((e = this.connectionImpl) == null ? void 0 : e.getState()) === "connected" && (this.logger.debug("Connection remained stable for long enough, clearing cached fallback edges"), i(Qb, this).reset(), n(ex, this, void 0));
9283
+ i($b, this) && ((e = this.connectionImpl) == null ? void 0 : e.getState()) === "connected" && (this.logger.debug("Connection remained stable for long enough, clearing cached fallback edges"), i($b, this).reset(), n(tx, this, void 0));
9267
9284
  }, r.EDGE_SELECTOR_RESET_TIMEOUT));
9268
- }), c(this, sx, () => {
9269
- i(ex, this) !== void 0 && (clearTimeout(i(ex, this)), n(ex, this, void 0));
9270
- }), c(this, cx, function() {
9285
+ }), c(this, cx, () => {
9286
+ i(tx, this) !== void 0 && (clearTimeout(i(tx, this)), n(tx, this, void 0));
9287
+ }), c(this, lx, function() {
9271
9288
  var e = t(function* (e) {
9272
- n(Hb, u, !1);
9289
+ n(Ub, u, !1);
9273
9290
  try {
9274
- let o = yield u.config.reconnectHandler({ reconnectRetries: i(zb, u) });
9291
+ let o = yield u.config.reconnectHandler({ reconnectRetries: i(Bb, u) });
9275
9292
  if (!i($, u)) return !1;
9276
9293
  if (!o) return n($, u, !1), u.emitter.emit("error", Zn()), !1;
9277
9294
  let { isVisible: s, isOnline: c } = u.config.documentState;
9278
9295
  if (!s || !c) {
9279
- if (i(Hb, u)) return i($, u);
9296
+ if (i(Ub, u)) return i($, u);
9280
9297
  let e = r.OFFLINE_RETRY_MS;
9281
9298
  if (!c) u.logger.info("Browser offline, waiting for the network before retrying", { delay: e });
9282
9299
  else {
9283
9300
  var t, a;
9284
- let o = r.HIDDEN_BACKOFF_BASE_MS * 2 ** (n(Bb, u, (t = i(Bb, u), a = t++, t)), a);
9301
+ let o = r.HIDDEN_BACKOFF_BASE_MS * 2 ** (n(Vb, u, (t = i(Vb, u), a = t++, t)), a);
9285
9302
  e = Math.min(r.HIDDEN_BACKOFF_MAX_MS, o), u.logger.info("Page hidden, backing off before retrying", { delay: e });
9286
9303
  }
9287
9304
  return yield new Promise((t) => {
9288
9305
  let r = setTimeout(t, e);
9289
- n(Vb, u, () => {
9306
+ n(Hb, u, () => {
9290
9307
  clearTimeout(r), t();
9291
9308
  });
9292
9309
  }), i($, u);
9293
9310
  }
9294
- return n(Bb, u, 0), i(px, u).call(u) ? (u.logger.info("Reconnect burst detected, applying backoff before retrying"), yield on(r.RECONNECT_BACKOFF_MS)) : u.logger.info(e === "cached_edge" ? "Retrying with next cached edge without backoff" : "Retrying without backoff"), i($, u);
9311
+ return n(Vb, u, 0), i(mx, u).call(u) ? (u.logger.info("Reconnect burst detected, applying backoff before retrying"), yield on(r.RECONNECT_BACKOFF_MS)) : u.logger.info(e === "cached_edge" ? "Retrying with next cached edge without backoff" : "Retrying without backoff"), i($, u);
9295
9312
  } finally {
9296
- n(Vb, u, void 0);
9313
+ n(Hb, u, void 0);
9297
9314
  }
9298
9315
  });
9299
9316
  return function(t) {
9300
9317
  return e.apply(this, arguments);
9301
9318
  };
9302
- }()), c(this, lx, () => {
9319
+ }()), c(this, ux, () => {
9303
9320
  var e;
9304
- n(Hb, this, !0), (e = i(Vb, this)) == null || e.call(this);
9305
- }), c(this, ux, (e) => {
9306
- e && i(lx, this).call(this);
9307
- }), c(this, dx, () => {
9308
- i(lx, this).call(this);
9309
- }), c(this, fx, (e = performance.now()) => {
9310
- i(mx, this).call(this, e), i($b, this).push(e);
9311
- }), c(this, px, (e = performance.now()) => (i(mx, this).call(this, e), i($b, this).length >= r.RECONNECT_BACKOFF_BURST_THRESHOLD)), c(this, mx, (e) => {
9312
- for (; i($b, this).length > 0;) {
9313
- let t = i($b, this)[0];
9321
+ n(Ub, this, !0), (e = i(Hb, this)) == null || e.call(this);
9322
+ }), c(this, dx, (e) => {
9323
+ e && i(ux, this).call(this);
9324
+ }), c(this, fx, () => {
9325
+ i(ux, this).call(this);
9326
+ }), c(this, px, (e = performance.now()) => {
9327
+ i(hx, this).call(this, e), i(ex, this).push(e);
9328
+ }), c(this, mx, (e = performance.now()) => (i(hx, this).call(this, e), i(ex, this).length >= r.RECONNECT_BACKOFF_BURST_THRESHOLD)), c(this, hx, (e) => {
9329
+ for (; i(ex, this).length > 0;) {
9330
+ let t = i(ex, this)[0];
9314
9331
  if (t === void 0 || t > e - r.RECONNECT_BACKOFF_BURST_WINDOW_MS) return;
9315
- i($b, this).shift();
9332
+ i(ex, this).shift();
9316
9333
  }
9317
9334
  }), this.logger = s, this.emitter = a, this.config = l, this.apiClient = new _({
9318
9335
  publicEndpoint: this.config.options.get("url").toString(),
9319
9336
  tokenFactory: () => this.config.options.get("authenticationToken")
9320
- }), this.emitter.on("page active", i(ux, this)), this.emitter.on("network online", i(dx, this));
9337
+ }), this.emitter.on("page active", i(dx, this)), this.emitter.on("network online", i(fx, this));
9321
9338
  }
9322
9339
  get rtt() {
9323
- return i(Lb, this).items().length > 0 ? pt(i(Lb, this).items()) : 0;
9340
+ return i(Rb, this).items().length > 0 ? pt(i(Rb, this).items()) : 0;
9324
9341
  }
9325
9342
  get isMoq() {
9326
9343
  return this.connectionImpl instanceof ib;
@@ -9330,91 +9347,91 @@ var Db = (e) => {
9330
9347
  let e = this.connectionImpl.estimatedBandwidth;
9331
9348
  if (e && Number.isFinite(e)) return e;
9332
9349
  }
9333
- return Tb(this.rtt);
9350
+ return Eb(this.rtt);
9334
9351
  }
9335
9352
  get linkQueue() {
9336
9353
  var e;
9337
9354
  return (e = this.connectionImpl) == null ? void 0 : e.linkQueue;
9338
9355
  }
9339
9356
  get firstConnectStartTime() {
9340
- return i(qb, this);
9357
+ return i(Jb, this);
9341
9358
  }
9342
9359
  get lastConnectionTime() {
9343
- return i(Jb, this);
9360
+ return i(Yb, this);
9344
9361
  }
9345
9362
  };
9346
- Pb = hx;
9347
- function gx() {
9363
+ Fb = gx;
9364
+ function _x() {
9348
9365
  var e = this;
9349
9366
  return t(function* () {
9350
- let t = new Nb({ edgeUrl: e.config.options.get("edgeUrl") });
9351
- for (n(Qb, e, t), i(sx, e).call(e), n(zb, e, 0), n(Bb, e, 0), n($b, e, []);;) {
9367
+ let t = new Pb({ edgeUrl: e.config.options.get("edgeUrl") });
9368
+ for (n($b, e, t), i(cx, e).call(e), n(Bb, e, 0), n(Vb, e, 0), n(ex, e, []);;) {
9352
9369
  var r, a;
9353
9370
  let l = "standard";
9354
- n(Ub, e, (r = i(Ub, e), r++, r)), i(fx, e).call(e);
9371
+ n(Wb, e, (r = i(Wb, e), r++, r)), i(px, e).call(e);
9355
9372
  let d = !1;
9356
- n(Zb, e, {});
9373
+ n(Qb, e, {});
9357
9374
  try {
9358
9375
  var o, s;
9359
- let [r, a] = yield Promise.all([i(rx, e).call(e), i(ix, e).call(e)]);
9360
- if (i(Lb, e).clear(), a !== void 0 && i(Lb, e).push(a / 2), !i($, e)) break;
9376
+ let [r, a] = yield Promise.all([i(ix, e).call(e), i(ax, e).call(e)]);
9377
+ if (i(Rb, e).clear(), a !== void 0 && i(Rb, e).push(a / 2), !i($, e)) break;
9361
9378
  let c = t.select(r.edges);
9362
9379
  if (!c) throw new M("Failed to resolve edge url", {
9363
9380
  isFatal: !0,
9364
9381
  code: "failed_to_resolve_edge_url"
9365
9382
  });
9366
- n(Zb, e, { edgeUrl: Yv(Ob(c)) });
9383
+ n(Qb, e, { edgeUrl: Yv(kb(c)) });
9367
9384
  try {
9368
9385
  u(r) ? e.connectionImpl = yield ib.start(e.emitter, e.logger, e.apiClient, p(p({}, e.config), {}, {
9369
9386
  connectInfo: r,
9370
9387
  edgeUrl: c,
9371
- onTransportConnected: i(nx, e)
9372
- }), i(Lb, e)) : (v(typeof c == "string", "Edge URL is expected to be a string"), e.connectionImpl = yield Eb.start(e.emitter, e.logger, p(p({}, e.config), {}, {
9388
+ onTransportConnected: i(rx, e)
9389
+ }), i(Rb, e)) : (v(typeof c == "string", "Edge URL is expected to be a string"), e.connectionImpl = yield Db.start(e.emitter, e.logger, p(p({}, e.config), {}, {
9373
9390
  connectInfo: r,
9374
9391
  edgeUrl: c,
9375
- onTransportConnected: i(nx, e)
9376
- }), i(Lb, e)));
9392
+ onTransportConnected: i(rx, e)
9393
+ }), i(Rb, e)));
9377
9394
  } catch (e) {
9378
9395
  throw l = "cached_edge", e;
9379
9396
  }
9380
- n(Xb, e, e.connectionImpl.getStatistics()), n(Zb, e, void 0), i($, e) || e.connectionImpl.close("Disconnected during connect"), i(ox, e).call(e), n(Wb, e, (o = i(Wb, e), o++, o)), n(zb, e, 0), n(Bb, e, 0), n(Jb, e, performance.now()), i(nx, e).call(e);
9397
+ n(Zb, e, e.connectionImpl.getStatistics()), n(Qb, e, void 0), i($, e) || e.connectionImpl.close("Disconnected during connect"), i(sx, e).call(e), n(Gb, e, (o = i(Gb, e), o++, o)), n(Bb, e, 0), n(Vb, e, 0), n(Yb, e, performance.now()), i(rx, e).call(e);
9381
9398
  let d = yield e.connectionImpl.closed();
9382
- e.connectionImpl.closedForBacklog && n(Gb, e, (s = i(Gb, e), s++, s)), e.logger.info("Connection closed", { reason: d instanceof Error ? d.message : d }), l = "cached_edge";
9399
+ e.connectionImpl.closedForBacklog && n(Kb, e, (s = i(Kb, e), s++, s)), e.logger.info("Connection closed", { reason: d instanceof Error ? d.message : d }), l = "cached_edge";
9383
9400
  } catch (r) {
9384
9401
  e.logger.warn("Failed to connect", r);
9385
9402
  let { isVisible: a, isOnline: o } = e.config.documentState;
9386
- if (!e.connectionImpl && (a && o || Fb(r))) {
9403
+ if (!e.connectionImpl && (a && o || Ib(r))) {
9387
9404
  var c;
9388
- n(zb, e, (c = i(zb, e), c++, c));
9405
+ n(Bb, e, (c = i(Bb, e), c++, c));
9389
9406
  }
9390
9407
  let s = t.shiftedEdge();
9391
9408
  s && e.emitter.emit("telemetry event", {
9392
9409
  code: "shifted_edge",
9393
- edgeUrl: Ob(s)
9410
+ edgeUrl: kb(s)
9394
9411
  }), r instanceof M ? (e.emitter.emit("error", r), d = r.isFatal()) : r instanceof Error && e.emitter.emit("error", new M(r.message, {
9395
9412
  code: "start_failed",
9396
9413
  isFatal: !1
9397
9414
  }));
9398
9415
  }
9399
- if ((a = e.connectionImpl) == null || a.unload(), e.connectionImpl = void 0, i(sx, e).call(e), d) {
9416
+ if ((a = e.connectionImpl) == null || a.unload(), e.connectionImpl = void 0, i(cx, e).call(e), d) {
9400
9417
  n($, e, !1);
9401
9418
  break;
9402
9419
  }
9403
- if (!i($, e) || !(yield i(cx, e).call(e, l === "cached_edge" && t.hasRemainingEdges() ? "cached_edge" : "standard"))) break;
9420
+ if (!i($, e) || !(yield i(lx, e).call(e, l === "cached_edge" && t.hasRemainingEdges() ? "cached_edge" : "standard"))) break;
9404
9421
  }
9405
- n(Zb, e, void 0), n(Qb, e, void 0), i(sx, e).call(e), n(Rb, e, void 0), i($, e) && e.connect();
9422
+ n(Qb, e, void 0), n($b, e, void 0), i(cx, e).call(e), n(zb, e, void 0), i($, e) && e.connect();
9406
9423
  })();
9407
9424
  }
9408
- e(hx, "PING_TIMEOUT", 1e3), e(hx, "RECONNECT_BACKOFF_MS", 1e3), e(hx, "RECONNECT_BACKOFF_BURST_WINDOW_MS", 5e3), e(hx, "RECONNECT_BACKOFF_BURST_THRESHOLD", 3), e(hx, "EDGE_SELECTOR_RESET_TIMEOUT", 6e4), e(hx, "HIDDEN_BACKOFF_BASE_MS", 1e3), e(hx, "HIDDEN_BACKOFF_MAX_MS", 3e4), e(hx, "OFFLINE_RETRY_MS", 3e4), e(hx, "create", (e, t, n) => new Pb(e, t, n));
9425
+ e(gx, "PING_TIMEOUT", 1e3), e(gx, "RECONNECT_BACKOFF_MS", 1e3), e(gx, "RECONNECT_BACKOFF_BURST_WINDOW_MS", 5e3), e(gx, "RECONNECT_BACKOFF_BURST_THRESHOLD", 3), e(gx, "EDGE_SELECTOR_RESET_TIMEOUT", 6e4), e(gx, "HIDDEN_BACKOFF_BASE_MS", 1e3), e(gx, "HIDDEN_BACKOFF_MAX_MS", 3e4), e(gx, "OFFLINE_RETRY_MS", 3e4), e(gx, "create", (e, t, n) => new Fb(e, t, n));
9409
9426
  // ../../libs/web-sdk/src/modules/ConstraintCapModule.ts
9410
- var _x, vx = () => ({
9427
+ var vx, yx = () => ({
9411
9428
  video: p(p({}, fn()), {}, { bitRate: dn() }),
9412
9429
  audio: { bitRate: dn() }
9413
- }), yx = () => ({
9430
+ }), bx = () => ({
9414
9431
  width: window.innerWidth,
9415
9432
  height: window.innerHeight,
9416
9433
  bitRate: dn()
9417
- }), bx = class t {
9434
+ }), xx = class t {
9418
9435
  constructor(n, r, i, a) {
9419
9436
  e(this, "emitter", void 0), e(this, "timers", new j()), 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", () => {
9420
9437
  var e;
@@ -9436,7 +9453,7 @@ var _x, vx = () => ({
9436
9453
  this.timers.unload();
9437
9454
  }), e(this, "setUserSpecifiedCap", (e) => {
9438
9455
  var t;
9439
- let n = (t = this.getUserSpecifiedCap()) == null ? vx() : t;
9456
+ let n = (t = this.getUserSpecifiedCap()) == null ? yx() : t;
9440
9457
  this.userSpecifiedCap = p(p({}, n), {}, {
9441
9458
  video: p(p({}, n.video), e.video),
9442
9459
  audio: p(p({}, n.audio), e.audio)
@@ -9460,7 +9477,7 @@ var _x, vx = () => ({
9460
9477
  });
9461
9478
  }), e(this, "evaluateConstraintCap", () => {
9462
9479
  var e, t, n, r;
9463
- let i = this.sizeBasedResolutionCapEnabled ? p(p({}, vx()), {}, { video: yx() }) : vx();
9480
+ let i = this.sizeBasedResolutionCapEnabled ? p(p({}, yx()), {}, { video: bx() }) : yx();
9464
9481
  if (!this.resizeObserver) {
9465
9482
  let e = this.element.getBoundingClientRect();
9466
9483
  this.elementSize = {
@@ -9497,19 +9514,19 @@ var _x, vx = () => ({
9497
9514
  this._sizeBasedResolutionCapEnabled = e, this.evaluateConstraintCap();
9498
9515
  }
9499
9516
  };
9500
- _x = bx, e(bx, "CHECK_SIZE_INTERVAL", 1e3), e(bx, "create", (e, t, n, r) => new _x(e, t, n, r));
9517
+ vx = xx, e(xx, "CHECK_SIZE_INTERVAL", 1e3), e(xx, "create", (e, t, n, r) => new vx(e, t, n, r));
9501
9518
  // ../../libs/web-sdk/src/renditionKey.ts
9502
- var xx = (e, t) => `${e}\u0000${t == null ? "" : t}`, Sx = (e, t, n, r) => e === n && t === r, Cx = class {
9519
+ var Sx = (e, t) => `${e}\u0000${t == null ? "" : t}`, Cx = (e, t, n, r) => e === n && t === r, wx = class {
9503
9520
  constructor() {
9504
9521
  e(this, "lastKey", void 0), e(this, "shouldNotify", (e, t) => {
9505
- let n = xx(e, t);
9522
+ let n = Sx(e, t);
9506
9523
  return this.lastKey !== n && (this.lastKey = n, !0);
9507
9524
  });
9508
9525
  }
9509
- }, wx = 5, Tx = 40, Ex = 1, Dx = 3e4, Ox = 5, kx = (e) => {
9526
+ }, Tx = 5, Ex = 40, Dx = 1, Ox = 3e4, kx = 5, Ax = (e) => {
9510
9527
  var t, n;
9511
9528
  return ((t = e.maxCompositionOffsetMs) == null ? 0 : t) - ((n = e.minCompositionOffsetMs) == null ? 0 : n);
9512
- }, Ax = (e, t, n) => {
9529
+ }, jx = (e, t, n) => {
9513
9530
  let r = [];
9514
9531
  for (let i of e) {
9515
9532
  let e = r[r.length - 1];
@@ -9519,10 +9536,10 @@ var xx = (e, t) => `${e}\u0000${t == null ? "" : t}`, Sx = (e, t, n, r) => e ===
9519
9536
  });
9520
9537
  }
9521
9538
  return r;
9522
- }, jx = (e, t) => {
9539
+ }, Mx = (e, t) => {
9523
9540
  let n = e[e.length - 1];
9524
9541
  n && n.end > t && n.start < t && (n.end = t);
9525
- }, Mx = 100, Nx = 1e3, Px = class n {
9542
+ }, Nx = 100, Px = 1e3, Fx = class n {
9526
9543
  constructor(t, n, r, i, a = !1, o = !1, s = !1) {
9527
9544
  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", () => {
9528
9545
  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);
@@ -9540,8 +9557,8 @@ var xx = (e, t) => `${e}\u0000${t == null ? "" : t}`, Sx = (e, t, n, r) => e ===
9540
9557
  }), e(this, "unsuspend", () => {
9541
9558
  this.isSuspended = !1, this.emitDecodedFrames(), this._audioWebCodecsInUse && this.scheduleAudioEmitRetry();
9542
9559
  }), e(this, "armTimers", () => {
9543
- let e = this._audioWebCodecsInUse ? 20 : Mx;
9544
- this.timers.setInterval(this.emitDecodedFrames, e), this.timers.setInterval(this.emitDecodeRate, Nx);
9560
+ let e = this._audioWebCodecsInUse ? 20 : Nx;
9561
+ this.timers.setInterval(this.emitDecodedFrames, e), this.timers.setInterval(this.emitDecodeRate, Px);
9545
9562
  }), e(this, "replaceTimers", () => {
9546
9563
  let e = this.isAudioEmitRetryScheduled;
9547
9564
  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());
@@ -9610,27 +9627,27 @@ var xx = (e, t) => `${e}\u0000${t == null ? "" : t}`, Sx = (e, t, n, r) => e ===
9610
9627
  i.stream = `${e.channelId}/${e.renditionId}`;
9611
9628
  let c = (e.timestamp + a) / e.timescale * 1e3, l = e.duration / e.timescale * 1e3;
9612
9629
  l > 0 && (i.sampleDuration = l);
9613
- let u = i.sampleDuration || Tx, d = e.timestamp / e.timescale * 1e3, f = a / e.timescale * 1e3, p = kx(i), m = (t = s[s.length - 1]) == null ? void 0 : t.end, h = Math.max(u * Ox, p + ((n = i.frontierSampleDurationMs) == null ? u : n)), g = m !== void 0 && c + h < m;
9630
+ let u = i.sampleDuration || Ex, d = e.timestamp / e.timescale * 1e3, f = a / e.timescale * 1e3, p = Ax(i), m = (t = s[s.length - 1]) == null ? void 0 : t.end, h = Math.max(u * kx, p + ((n = i.frontierSampleDurationMs) == null ? u : n)), g = m !== void 0 && c + h < m;
9614
9631
  i.lastDecodeTimestampMs = g ? d : Math.max((r = i.lastDecodeTimestampMs) == null ? d : r, d);
9615
- let ee = i.channelId !== void 0 && !Sx(i.channelId, i.renditionId, e.channelId, e.renditionId);
9632
+ let ee = i.channelId !== void 0 && !Cx(i.channelId, i.renditionId, e.channelId, e.renditionId);
9616
9633
  i.channelId = e.channelId, i.renditionId = e.renditionId, (g || ee) && (i.minCompositionOffsetMs = void 0, i.maxCompositionOffsetMs = void 0, i.hasAnchoredGop = !1, i.isReorderStructureStale = !0);
9617
9634
  let _ = i.hasAnchoredGop === !0;
9618
9635
  if (e.isSync && (i.hasAnchoredGop = !0), !g && i.hasAnchoredGop) {
9619
9636
  var v, y;
9620
9637
  i.minCompositionOffsetMs = Math.min((v = i.minCompositionOffsetMs) == null ? f : v, f), i.maxCompositionOffsetMs = Math.max((y = i.maxCompositionOffsetMs) == null ? f : y, f), _ && (i.isReorderStructureStale = !1);
9621
9638
  }
9622
- let b = kx(i) > 0;
9639
+ let b = Ax(i) > 0;
9623
9640
  if (g) i.buffer = [{
9624
9641
  start: c,
9625
9642
  end: c + u
9626
9643
  }], i.frontierSampleDurationMs = u, e.type === "video" && (this.videoKeyframeTimestamps = []);
9627
9644
  else {
9628
9645
  var x;
9629
- !b && !i.isReorderStructureStale && jx(s, c + u);
9646
+ !b && !i.isReorderStructureStale && Mx(s, c + u);
9630
9647
  let e = (x = s[s.length - 1]) == null ? void 0 : x.end;
9631
- (e === void 0 || c + u >= e) && (i.frontierSampleDurationMs = u), $t(s, c, c + u, wx);
9648
+ (e === void 0 || c + u >= e) && (i.frontierSampleDurationMs = u), $t(s, c, c + u, Tx);
9632
9649
  }
9633
- if (tn(i.buffer, this.playbackSource.currentTime - Dx), i.playableRangesCache = void 0, e.type === "video" && e.isSync) {
9650
+ if (tn(i.buffer, this.playbackSource.currentTime - Ox), i.playableRangesCache = void 0, e.type === "video" && e.isSync) {
9634
9651
  let e = this.videoKeyframeTimestamps[this.videoKeyframeTimestamps.length - 1];
9635
9652
  e !== void 0 && c < e && (this.videoKeyframeTimestamps = []), this.videoKeyframeTimestamps.push(c), this.videoKeyframeTimestamps.length > 20 && (this.videoKeyframeTimestamps = this.videoKeyframeTimestamps.slice(-20));
9636
9653
  }
@@ -9663,11 +9680,11 @@ var xx = (e, t) => `${e}\u0000${t == null ? "" : t}`, Sx = (e, t, n, r) => e ===
9663
9680
  }), e(this, "emitDecodeRate", () => {
9664
9681
  this.decodeRateGraceIntervals > 0 ? this.decodeRateGraceIntervals-- : (this.currentVideoDecodeRate = this.calculateVideoDecodeRate(), this.emitter.emit("video decode rate", this.currentVideoDecodeRate));
9665
9682
  }), e(this, "playableRanges", (e) => {
9666
- let t = kx(e);
9683
+ let t = Ax(e);
9667
9684
  if (t <= 0) return e.buffer;
9668
9685
  if (e.playableRangesCache === void 0) {
9669
9686
  var n, r;
9670
- e.playableRangesCache = Ax(e.buffer, ((n = e.lastDecodeTimestampMs) == null ? Infinity : n) - Math.max(0, -((r = e.minCompositionOffsetMs) == null ? 0 : r)) - Ex, t + (e.sampleDuration || Tx) + Ex);
9687
+ e.playableRangesCache = jx(e.buffer, ((n = e.lastDecodeTimestampMs) == null ? Infinity : n) - Math.max(0, -((r = e.minCompositionOffsetMs) == null ? 0 : r)) - Dx, t + (e.sampleDuration || Ex) + Dx);
9671
9688
  }
9672
9689
  return e.playableRangesCache;
9673
9690
  }), e(this, "updateBufferState", () => {
@@ -9702,7 +9719,7 @@ var xx = (e, t) => `${e}\u0000${t == null ? "" : t}`, Sx = (e, t, n, r) => e ===
9702
9719
  case "audio": {
9703
9720
  let n, i, a = !1;
9704
9721
  if (c) {
9705
- let { WebCodecsAudioDecoderContext: t } = yield import("./DRf60TGJ.js");
9722
+ let { WebCodecsAudioDecoderContext: t } = yield import("./C-2YQ1DN.js");
9706
9723
  if (a = t.isSupported(), a) try {
9707
9724
  n = yield t.create(r.createContext("WebCodecsAudio")), h = !0;
9708
9725
  } catch (t) {
@@ -9714,7 +9731,7 @@ var xx = (e, t) => `${e}\u0000${t == null ? "" : t}`, Sx = (e, t, n, r) => e ===
9714
9731
  }
9715
9732
  if (!n) {
9716
9733
  if (e.codec === "opus") {
9717
- let { OpusDecoderContext: t } = yield import("./panCdu28.js");
9734
+ let { OpusDecoderContext: t } = yield import("./B5RavaT7.js");
9718
9735
  n = yield t.create(e.sampleRate || 48e3, e.channels || 2);
9719
9736
  } else {
9720
9737
  let t = c ? i ? `WebCodecs audio decoder initialization failed: ${i.message}` : a ? "WebCodecs audio decoder could not be initialized." : "WebCodecs AudioDecoder API is not supported in this environment." : "WebCodecs audio decoding is disabled.";
@@ -9731,7 +9748,7 @@ var xx = (e, t) => `${e}\u0000${t == null ? "" : t}`, Sx = (e, t, n, r) => e ===
9731
9748
  break;
9732
9749
  }
9733
9750
  case "video": {
9734
- let { VideoDecoderWorkerContext: n } = yield import("./DFRSBWmV.js"), a = yield n.create(r.createContext("VideoDecoderWorker"), i, s, c, l, u, () => o.currentTime, d, f);
9751
+ let { VideoDecoderWorkerContext: n } = yield import("./DGcm5Ovk.js"), a = yield n.create(r.createContext("VideoDecoderWorker"), i, s, c, l, u, () => o.currentTime, d, f);
9735
9752
  m = a.isWebCodecs, g = a.usingOffscreenCanvas, t.set(e.type, {
9736
9753
  buffer: [],
9737
9754
  decoderContext: a,
@@ -9750,7 +9767,7 @@ var xx = (e, t) => `${e}\u0000${t == null ? "" : t}`, Sx = (e, t, n, r) => e ===
9750
9767
  var e;
9751
9768
  if (this._offscreenCanvasInUse) return (e = this.trackContexts.get("video")) == null ? void 0 : e.decoderContext.videoTrack;
9752
9769
  }
9753
- }, Fx, Ix = class {
9770
+ }, Ix, Lx = class {
9754
9771
  constructor(t) {
9755
9772
  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", () => {
9756
9773
  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);
@@ -9782,11 +9799,11 @@ var xx = (e, t) => `${e}\u0000${t == null ? "" : t}`, Sx = (e, t, n, r) => e ===
9782
9799
  return document.visibilityState === "visible" && !this.isBehindAnotherApp;
9783
9800
  }
9784
9801
  };
9785
- Fx = Ix, e(Ix, "create", (e) => new Fx(e));
9802
+ Ix = Lx, e(Lx, "create", (e) => new Ix(e));
9786
9803
  // ../../libs/web-sdk/src/modules/EventModule.ts
9787
- var Lx, Rx = (e) => (t, n, r) => t.timestamp <= n || t.timestampAdded <= r - e, zx = class t {
9804
+ var Rx, zx = (e) => (t, n, r) => t.timestamp <= n || t.timestampAdded <= r - e, Bx = class t {
9788
9805
  constructor(n, r, i) {
9789
- e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "waitingEvents", []), e(this, "isTriggered", Rx(t.EVENT_TIMEOUT)), e(this, "timeSource", void 0), e(this, "timers", new j()), e(this, "load", () => {
9806
+ e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "waitingEvents", []), e(this, "isTriggered", zx(t.EVENT_TIMEOUT)), e(this, "timeSource", void 0), e(this, "timers", new j()), e(this, "load", () => {
9790
9807
  this.timers.setInterval(this.onBufferedStateChanged, t.EVENT_CHECK_INTERVAL), this.emitter.on("add event", this.addEvent);
9791
9808
  }), e(this, "unload", () => {
9792
9809
  this.timers.unload(), this.emitter.off("add event", this.addEvent);
@@ -9813,9 +9830,9 @@ var Lx, Rx = (e) => (t, n, r) => t.timestamp <= n || t.timestampAdded <= r - e,
9813
9830
  }), this.logger = r, this.emitter = n, this.timeSource = i;
9814
9831
  }
9815
9832
  };
9816
- Lx = zx, e(zx, "EVENT_TIMEOUT", 5e3), e(zx, "EVENT_CHECK_INTERVAL", 20), e(zx, "create", (e, t, n) => new Lx(e, t, n));
9833
+ Rx = Bx, e(Bx, "EVENT_TIMEOUT", 5e3), e(Bx, "EVENT_CHECK_INTERVAL", 20), e(Bx, "create", (e, t, n) => new Rx(e, t, n));
9817
9834
  // ../../libs/web-sdk/src/modules/JitterModule.ts
9818
- var Bx = 1e3, Vx = 50, Hx = class t {
9835
+ var Vx = 1e3, Hx = 50, Ux = class t {
9819
9836
  constructor(t) {
9820
9837
  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", () => {
9821
9838
  this.logger.debug("JitterModule loaded");
@@ -9836,9 +9853,9 @@ var Bx = 1e3, Vx = 50, Hx = class t {
9836
9853
  this.trackingState.set(n, {
9837
9854
  lastArrivalTime: r,
9838
9855
  lastTimestampMs: i,
9839
- jitterSamples: new S(Bx),
9840
- interArrivalTimes: new S(Bx)
9841
- }), this.runningJitter.set(n, 0), this.recentJitterSamples.set(n, new S(Vx));
9856
+ jitterSamples: new S(Vx),
9857
+ interArrivalTimes: new S(Vx)
9858
+ }), this.runningJitter.set(n, 0), this.recentJitterSamples.set(n, new S(Hx));
9842
9859
  return;
9843
9860
  }
9844
9861
  let o = i - a.lastTimestampMs;
@@ -9851,7 +9868,7 @@ var Bx = 1e3, Vx = 50, Hx = class t {
9851
9868
  let l = (t = this.runningJitter.get(n)) == null ? 0 : t, u = l + (c - l) / 16;
9852
9869
  this.runningJitter.set(n, u);
9853
9870
  let d = this.recentJitterSamples.get(n);
9854
- d || (d = new S(Vx), this.recentJitterSamples.set(n, d)), d.push(c), a.lastArrivalTime = r, a.lastTimestampMs = i;
9871
+ d || (d = new S(Hx), this.recentJitterSamples.set(n, d)), d.push(c), a.lastArrivalTime = r, a.lastTimestampMs = i;
9855
9872
  }
9856
9873
  getJitterForType(e) {
9857
9874
  for (let [i, a] of this.trackingState) if (i.startsWith(e)) {
@@ -9882,10 +9899,10 @@ var Bx = 1e3, Vx = 50, Hx = class t {
9882
9899
  videoJitter: this.getJitterForType("video")
9883
9900
  };
9884
9901
  }
9885
- }, Ux = () => window.AudioContext || window.webkitAudioContext, Wx = class n extends s {
9902
+ }, Wx = () => window.AudioContext || window.webkitAudioContext, Gx = class n extends s {
9886
9903
  constructor() {
9887
9904
  var r;
9888
- super(), r = this, e(this, "context", new (Ux())()), e(this, "timers", j.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* () {
9905
+ super(), r = this, e(this, "context", new (Wx())()), e(this, "timers", j.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* () {
9889
9906
  let e = !0, t = r.context.resume();
9890
9907
  t.then(() => {
9891
9908
  e = !1;
@@ -9920,9 +9937,9 @@ var Bx = 1e3, Vx = 50, Hx = class t {
9920
9937
  return this.context.state;
9921
9938
  }
9922
9939
  };
9923
- e(Wx, "CHECK_INTERVAL", 1e3);
9940
+ e(Gx, "CHECK_INTERVAL", 1e3);
9924
9941
  // ../../libs/web-audio-player/src/AudioPlayer.ts
9925
- var Gx, Kx = 150, qx = 400, Jx = (e) => e === void 0 ? 5 : e <= Kx ? 1 : e <= qx ? 2 : 5, Yx = class extends s {
9942
+ var Kx, qx = 150, Jx = 400, Yx = (e) => e === void 0 ? 5 : e <= qx ? 1 : e <= Jx ? 2 : 5, Xx = class extends s {
9926
9943
  get isContextRunning() {
9927
9944
  var e;
9928
9945
  return ((e = this.audio) == null ? void 0 : e.state) === "running";
@@ -9969,7 +9986,7 @@ var Gx, Kx = 150, qx = 400, Jx = (e) => e === void 0 ? 5 : e <= Kx ? 1 : e <= qx
9969
9986
  return this._bufferTime;
9970
9987
  }
9971
9988
  set bufferTime(e) {
9972
- this._bufferTime = e, this.audioBufferMultiplier = Jx(e);
9989
+ this._bufferTime = e, this.audioBufferMultiplier = Yx(e);
9973
9990
  }
9974
9991
  get sinkPaused() {
9975
9992
  return this._sinkPaused;
@@ -10071,14 +10088,14 @@ var Gx, Kx = 150, qx = 400, Jx = (e) => e === void 0 ? 5 : e <= Kx ? 1 : e <= qx
10071
10088
  this.ignoreSuspendCalls = !1, this.emit("state change", "suspended");
10072
10089
  }), e(this, "getAudioContext", () => this.audio ? this.audio : this.setupContext()), e(this, "setupContext", () => {
10073
10090
  var e, t, n;
10074
- return (e = this.audio) == null || e.unload(), this.audio = new Wx(), this.audio.on("state", (e) => {
10091
+ return (e = this.audio) == null || e.unload(), this.audio = new Gx(), this.audio.on("state", (e) => {
10075
10092
  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);
10076
10093
  }), this.audio.on("stuck", () => {
10077
10094
  this.reInitWhenStuck ? (this.logger.info("Re-init audio context"), this.setupContext(), this.resume().catch(b), this.emit("stuck")) : this.restartContext();
10078
10095
  }), (t = this.gainNode) == null || t.disconnect(), this.gainNode = this.audio.createGain(), this.setGain(this._volume), this.startTime = this.audio.currentTime, (n = this.splitter) == null || n.disconnect(), this.splitter = this.audio.createSplitter(), this.audio;
10079
10096
  }), e(this, "setGain", (e) => {
10080
10097
  this.gainNode && (this.gainNode.gain.value = this._muted ? 0 : e);
10081
- }), this._muted = i, this._userProvidedMuted = i, this.logger = n, this.clockSource = r, this.reInitWhenStuck = a, this._bufferTime = o, this.audioBufferMultiplier = Jx(o);
10098
+ }), this._muted = i, this._userProvidedMuted = i, this.logger = n, this.clockSource = r, this.reInitWhenStuck = a, this._bufferTime = o, this.audioBufferMultiplier = Yx(o);
10082
10099
  }
10083
10100
  useMediaStreamDestination() {
10084
10101
  var e;
@@ -10091,9 +10108,9 @@ var Gx, Kx = 150, qx = 400, Jx = (e) => e === void 0 ? 5 : e <= Kx ? 1 : e <= qx
10091
10108
  return (e = this.gainNode) == null || e.connect(t), t;
10092
10109
  }
10093
10110
  };
10094
- Gx = Yx, e(Yx, "create", (e, t, n) => new Gx(e, t, n));
10111
+ Kx = Xx, e(Xx, "create", (e, t, n) => new Kx(e, t, n));
10095
10112
  // ../../libs/web-sdk/src/players/VideoPlayer.ts
10096
- var Xx, Zx = class {
10113
+ var Zx, Qx = class {
10097
10114
  constructor(t, n, r, i, a, o) {
10098
10115
  e(this, "staleFrameThresholdMs", 400), e(this, "pool", void 0), e(this, "logger", void 0), e(this, "videoRenderer", new zr()), 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", () => {
10099
10116
  this.videoRenderer.load(), this.subscribeToContextLost(this.videoRenderer);
@@ -10185,11 +10202,11 @@ var Xx, Zx = class {
10185
10202
  }), this.logger = t, this.clockSource = n, this.pool = r, this.renderTargetSize = i || this.videoRenderer.canvas, this.onCanvasChangeCallback = a, this.onRendererErrorCallback = o;
10186
10203
  }
10187
10204
  };
10188
- Xx = Zx, e(Zx, "create", (e, t, n, r, i, a) => new Xx(e, t, n, r, i, a));
10205
+ Zx = Qx, e(Qx, "create", (e, t, n, r, i, a) => new Zx(e, t, n, r, i, a));
10189
10206
  // ../../libs/web-sdk/src/TextTracks.ts
10190
- var Qx = /* @__PURE__ */ new WeakMap(), $x = class {
10207
+ var $x = /* @__PURE__ */ new WeakMap(), eS = class {
10191
10208
  constructor() {
10192
- c(this, Qx, []), n(Qx, this, []);
10209
+ c(this, $x, []), n($x, this, []);
10193
10210
  }
10194
10211
  addTextTrack(e, t, n) {
10195
10212
  let r = [], a = {
@@ -10206,43 +10223,43 @@ var Qx = /* @__PURE__ */ new WeakMap(), $x = class {
10206
10223
  t !== -1 && r.splice(t, 1);
10207
10224
  }
10208
10225
  };
10209
- return i(Qx, this).push(a), a;
10226
+ return i($x, this).push(a), a;
10210
10227
  }
10211
10228
  set language(e) {
10212
- i(Qx, this).forEach((t) => {
10229
+ i($x, this).forEach((t) => {
10213
10230
  t.mode = t.language === e ? "showing" : "hidden";
10214
10231
  });
10215
10232
  }
10216
10233
  get language() {
10217
10234
  var e;
10218
- return (e = i(Qx, this).find((e) => e.mode === "showing")) == null ? void 0 : e.language;
10235
+ return (e = i($x, this).find((e) => e.mode === "showing")) == null ? void 0 : e.language;
10219
10236
  }
10220
10237
  get tracks() {
10221
- return i(Qx, this);
10238
+ return i($x, this);
10222
10239
  }
10223
10240
  get activeTrack() {
10224
- return i(Qx, this).find((e) => e.mode === "showing");
10241
+ return i($x, this).find((e) => e.mode === "showing");
10225
10242
  }
10226
10243
  getActiveCues(e) {
10227
- let t = i(Qx, this).find((e) => e.mode === "showing");
10244
+ let t = i($x, this).find((e) => e.mode === "showing");
10228
10245
  return t ? t.cues.filter(({ startTime: t, endTime: n }) => e >= t && e < n) : [];
10229
10246
  }
10230
- }, eS = (e, t) => {
10247
+ }, tS = (e, t) => {
10231
10248
  let n;
10232
10249
  for (n = t; e > 1; e--) n += t;
10233
10250
  return n;
10234
- }, tS = class {
10251
+ }, nS = class {
10235
10252
  constructor() {
10236
10253
  e(this, "audio", void 0), e(this, "unmute", () => this.audio.play().catch(b));
10237
10254
  let t = document.createElement("div");
10238
10255
  t.innerHTML = "<audio x-webkit-airplay='deny'></audio>";
10239
10256
  let n = t.children.item(0);
10240
- if (n instanceof HTMLAudioElement) this.audio = n, this.audio.controls = !1, this.audio.disableRemotePlayback = !0, this.audio.preload = "auto", this.audio.src = "data:audio/mpeg;base64,//uQx" + eS(23, "A") + "WGluZwAAAA8AAAACAAACcQCA" + eS(16, "gICA") + eS(66, "/") + "8AAABhTEFNRTMuMTAwA8MAAAAAAAAAABQgJAUHQQAB9AAAAnGMHkkI" + eS(320, "A") + "//sQxAADgnABGiAAQBCqgCRMAAgEAH" + eS(15, "/") + "7+n/9FTuQsQH//////2NG0jWUGlio5gLQTOtIoeR2WX////X4s9Atb/JRVCbBUpeRUq" + eS(18, "/") + "9RUi0f2jn/+xDECgPCjAEQAABN4AAANIAAAAQVTEFNRTMuMTAw" + eS(97, "V") + "Q==", this.audio.loop = !1, this.audio.load();
10257
+ if (n instanceof HTMLAudioElement) this.audio = n, this.audio.controls = !1, this.audio.disableRemotePlayback = !0, this.audio.preload = "auto", this.audio.src = "data:audio/mpeg;base64,//uQx" + tS(23, "A") + "WGluZwAAAA8AAAACAAACcQCA" + tS(16, "gICA") + tS(66, "/") + "8AAABhTEFNRTMuMTAwA8MAAAAAAAAAABQgJAUHQQAB9AAAAnGMHkkI" + tS(320, "A") + "//sQxAADgnABGiAAQBCqgCRMAAgEAH" + tS(15, "/") + "7+n/9FTuQsQH//////2NG0jWUGlio5gLQTOtIoeR2WX////X4s9Atb/JRVCbBUpeRUq" + tS(18, "/") + "9RUi0f2jn/+xDECgPCjAEQAABN4AAANIAAAAQVTEFNRTMuMTAw" + tS(97, "V") + "Q==", this.audio.loop = !1, this.audio.load();
10241
10258
  else throw Error("Failed to create audio tag");
10242
10259
  }
10243
- }, nS, rS = class {
10260
+ }, rS, iS = class {
10244
10261
  constructor(t, n, r, i, a, o, s, c) {
10245
- 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 tS()), e(this, "_isPaused", !1), e(this, "isDisconnected", !1), e(this, "timers", new j()), 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 $x()), e(this, "playbackRate", void 0), e(this, "emitVolumeState", () => {
10262
+ 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 nS()), e(this, "_isPaused", !1), e(this, "isDisconnected", !1), e(this, "timers", new j()), 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 eS()), e(this, "playbackRate", void 0), e(this, "emitVolumeState", () => {
10246
10263
  let e = {
10247
10264
  volume: this.volume,
10248
10265
  isMuted: this.userMuted
@@ -10278,13 +10295,13 @@ var Qx = /* @__PURE__ */ new WeakMap(), $x = class {
10278
10295
  e instanceof Error && this.emitter.emit("error", Ln(!1, e));
10279
10296
  }
10280
10297
  this.isVideoRenderingEnabled && this.videoPlayer.onDecodedFrame(e);
10281
- }), this.logger = n, this.emitter = t, this.pool = r, this.emitter.on("target buffer time", this.onTargetBufferTime), this.audioPlayer = Yx.create(this.logger.createContext("AudioPlayerModule"), i, {
10298
+ }), this.logger = n, this.emitter = t, this.pool = r, this.emitter.on("target buffer time", this.onTargetBufferTime), this.audioPlayer = Xx.create(this.logger.createContext("AudioPlayerModule"), i, {
10282
10299
  muted: a,
10283
10300
  reInitWhenStuck: !0,
10284
10301
  bufferTime: c
10285
10302
  }), o !== void 0 && (this.audioPlayer.volume = o), this.audioPlayer.on("stuck", () => {
10286
10303
  this.isDisconnected = !0;
10287
- }), this.audioPlayer.on("state change", this.emitVolumeState), this.videoPlayer = Zx.create(this.logger.createContext("VideoPlayerModule"), this.audioPlayer, this.pool, void 0, s);
10304
+ }), this.audioPlayer.on("state change", this.emitVolumeState), this.videoPlayer = Qx.create(this.logger.createContext("VideoPlayerModule"), this.audioPlayer, this.pool, void 0, s);
10288
10305
  }
10289
10306
  get volume() {
10290
10307
  return this.audioPlayer.volume;
@@ -10343,28 +10360,28 @@ var Qx = /* @__PURE__ */ new WeakMap(), $x = class {
10343
10360
  this._isPaused = !0, this.audioPlayer.pause(), this.emitter.emit("media element state", "paused");
10344
10361
  }
10345
10362
  };
10346
- nS = rS, e(rS, "create", (e, t, n, r, i, a, o, s) => new nS(e, t, n, r, i, a, o, s));
10363
+ rS = iS, e(iS, "create", (e, t, n, r, i, a, o, s) => new rS(e, t, n, r, i, a, o, s));
10347
10364
  // ../../libs/web-sdk/src/modules/MediaSessionModule.ts
10348
- var iS, aS = [
10365
+ var aS, oS = [
10349
10366
  "play",
10350
10367
  "pause",
10351
10368
  "stop"
10352
- ], oS, sS = /* @__PURE__ */ new Set(), cS = class t {
10369
+ ], sS, cS = /* @__PURE__ */ new Set(), lS = class t {
10353
10370
  constructor(n, r, i) {
10354
10371
  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", () => {
10355
- !this.isLoaded && t.isSupported() && (this.isLoaded = !0, sS.add(this), this.emitter.on("playback state", this.onPlaybackState), this.emitter.on("volume state", this.update));
10372
+ !this.isLoaded && t.isSupported() && (this.isLoaded = !0, cS.add(this), this.emitter.on("playback state", this.onPlaybackState), this.emitter.on("volume state", this.update));
10356
10373
  }), e(this, "unload", () => {
10357
10374
  var e;
10358
- this.isLoaded && (this.isLoaded = !1, sS.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());
10375
+ this.isLoaded && (this.isLoaded = !1, cS.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());
10359
10376
  }), e(this, "stop", () => {
10360
10377
  var e;
10361
- this.playbackState = void 0, (e = this.options.decoy) == null || e.unload(), oS === this && this.handOverOwnership("on stop");
10378
+ this.playbackState = void 0, (e = this.options.decoy) == null || e.unload(), sS === this && this.handOverOwnership("on stop");
10362
10379
  }), e(this, "getStatistics", () => {
10363
10380
  var e;
10364
10381
  return {
10365
10382
  mediaSessionSupported: t.isSupported(),
10366
- mediaSessionOwner: oS === this,
10367
- mediaSessionPlaybackState: oS === this ? this.isPaused ? "paused" : "playing" : "none",
10383
+ mediaSessionOwner: sS === this,
10384
+ mediaSessionPlaybackState: sS === this ? this.isPaused ? "paused" : "playing" : "none",
10368
10385
  decoyState: (e = this.options.decoy) == null ? void 0 : e.getStatistics().decoyState
10369
10386
  };
10370
10387
  }), e(this, "onPlaybackState", (e) => {
@@ -10372,18 +10389,18 @@ var iS, aS = [
10372
10389
  }), e(this, "refresh", () => {
10373
10390
  this.update();
10374
10391
  }), e(this, "update", () => {
10375
- this.isLoaded && (this.isEligibleToOwn && oS !== this ? this.claimOwnership() : this.sync());
10392
+ this.isLoaded && (this.isEligibleToOwn && sS !== this ? this.claimOwnership() : this.sync());
10376
10393
  }), e(this, "handOverOwnership", (e) => {
10377
- if (oS === this) {
10394
+ if (sS === this) {
10378
10395
  this.logger.debug(`Handing over the media session ${e}`), this.releaseOwnership();
10379
- for (let e of sS) if (e !== this && e.isEligibleToOwn) {
10396
+ for (let e of cS) if (e !== this && e.isEligibleToOwn) {
10380
10397
  e.claimOwnership();
10381
10398
  return;
10382
10399
  }
10383
10400
  }
10384
10401
  }), e(this, "sync", () => {
10385
10402
  var e, t, n, r, i, a;
10386
- if (oS !== this) return;
10403
+ if (sS !== this) return;
10387
10404
  if ((e = (t = this.options).isSuppressed) != null && e.call(t)) {
10388
10405
  var o;
10389
10406
  (o = this.options.decoy) == null || o.unload(), this.handOverOwnership("as suppressed");
@@ -10416,8 +10433,8 @@ var iS, aS = [
10416
10433
  (f = this.options.decoy) == null || f.play();
10417
10434
  }
10418
10435
  }), e(this, "claimOwnership", () => {
10419
- oS == null || oS.releaseOwnership(), oS = this, this.pageMetadata = navigator.mediaSession.metadata, this.applyMetadata();
10420
- for (let e of aS) this.safely(e, () => navigator.mediaSession.setActionHandler(e, this.onAction[e]));
10436
+ sS == null || sS.releaseOwnership(), sS = this, this.pageMetadata = navigator.mediaSession.metadata, this.applyMetadata();
10437
+ for (let e of oS) this.safely(e, () => navigator.mediaSession.setActionHandler(e, this.onAction[e]));
10421
10438
  this.safely("position state", () => {
10422
10439
  var e, t;
10423
10440
  return (e = (t = navigator.mediaSession).setPositionState) == null ? void 0 : e.call(t, {
@@ -10433,9 +10450,9 @@ var iS, aS = [
10433
10450
  });
10434
10451
  }), e(this, "releaseOwnership", () => {
10435
10452
  var e;
10436
- if (oS === this) {
10437
- oS = void 0, (e = this.options.decoy) == null || e.pause();
10438
- for (let e of aS) this.safely(e, () => navigator.mediaSession.setActionHandler(e, null));
10453
+ if (sS === this) {
10454
+ sS = void 0, (e = this.options.decoy) == null || e.pause();
10455
+ for (let e of oS) this.safely(e, () => navigator.mediaSession.setActionHandler(e, null));
10439
10456
  this.options.metadata && this.safely("metadata restore", () => {
10440
10457
  navigator.mediaSession.metadata = this.pageMetadata;
10441
10458
  }), this.safely("release", () => {
@@ -10469,14 +10486,14 @@ var iS, aS = [
10469
10486
  return this.playbackState !== void 0 && !this.isPaused && !this.options.isMuted() && ((e = (t = this.options).isSuppressed) == null ? void 0 : e.call(t)) !== !0;
10470
10487
  }
10471
10488
  };
10472
- iS = cS, e(cS, "create", (e, t, n) => new iS(e, t, n)), e(cS, "isSupported", () => typeof navigator < "u" && "mediaSession" in navigator && typeof MediaMetadata < "u");
10489
+ aS = lS, e(lS, "create", (e, t, n) => new aS(e, t, n)), e(lS, "isSupported", () => typeof navigator < "u" && "mediaSession" in navigator && typeof MediaMetadata < "u");
10473
10490
  // ../../libs/web-sdk/src/modules/ModernCanvasModule.ts
10474
- var lS, uS = class {
10491
+ var uS, dS = class {
10475
10492
  constructor(t, n, r, i, { muted: a, volume: o, type: s, poster: c, offscreenCanvas: l, bufferTime: u, backgroundPlaybackEnabled: d, splitAudio: f }) {
10476
10493
  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 j()), 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", (() => {
10477
10494
  let e = He().platform;
10478
10495
  return e.isIOS && e.iosVersion <= 16;
10479
- })()), e(this, "volumeState", void 0), e(this, "textTracks", new $x()), e(this, "reset", () => {}), e(this, "load", () => {
10496
+ })()), e(this, "volumeState", void 0), e(this, "textTracks", new eS()), e(this, "reset", () => {}), e(this, "load", () => {
10480
10497
  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);
10481
10498
  }), e(this, "unload", () => {
10482
10499
  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);
@@ -10619,13 +10636,13 @@ var lS, uS = class {
10619
10636
  }), this.soundElement.on("media element state", (e) => {
10620
10637
  e === "paused" && this.audioPlayer.flushBuffer(), this.audioPlayer.sinkPaused = e === "paused", this.emitPlaybackState();
10621
10638
  }), 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));
10622
- this.audioPlayer = Yx.create(this.logger.createContext("AudioPlayerModule"), i, {
10639
+ this.audioPlayer = Xx.create(this.logger.createContext("AudioPlayerModule"), i, {
10623
10640
  muted: !1,
10624
10641
  reInitWhenStuck: !1,
10625
10642
  bufferTime: u
10626
10643
  }), this.audioPlayer.on("state change", (e) => {
10627
10644
  e === "suspended" || e === "interrupted" ? this.soundElement.muted = !0 : e === "running" && this.applyVisibilityMutePolicy(), this.updateVolumeState();
10628
- }), this.videoPlayer = Zx.create(this.logger.createContext("VideoPlayerModule"), this.audioPlayer, this.pool, this.mediaElement.element, () => this.reconnectCanvasStream(), this.onVideoPlayerError);
10645
+ }), this.videoPlayer = Qx.create(this.logger.createContext("VideoPlayerModule"), this.audioPlayer, this.pool, this.mediaElement.element, () => this.reconnectCanvasStream(), this.onVideoPlayerError);
10629
10646
  }
10630
10647
  get volume() {
10631
10648
  return this.soundElement.volume;
@@ -10697,9 +10714,9 @@ var lS, uS = class {
10697
10714
  return this.renderCanvasSubtitlesInNativeFullscreen && !this.offscreenCanvas;
10698
10715
  }
10699
10716
  };
10700
- lS = uS, e(uS, "create", (e, t, n, r, i) => new lS(e, t, n, r, i));
10717
+ uS = dS, e(dS, "create", (e, t, n, r, i) => new uS(e, t, n, r, i));
10701
10718
  // ../../libs/web-sdk/src/modules/MseModule.ts
10702
- var dS, fS = class {
10719
+ var fS, pS = class {
10703
10720
  constructor() {
10704
10721
  e(this, "initSegments", /* @__PURE__ */ new Map()), e(this, "set", (e, t, n) => {
10705
10722
  var r;
@@ -10711,7 +10728,7 @@ var dS, fS = class {
10711
10728
  });
10712
10729
  }
10713
10730
  };
10714
- function pS(e, { mediaSource: t, mimeType: n, codec: r }) {
10731
+ function mS(e, { mediaSource: t, mimeType: n, codec: r }) {
10715
10732
  return p(p({}, e), {}, {
10716
10733
  state: "initialized",
10717
10734
  mimeType: n,
@@ -10723,10 +10740,10 @@ function pS(e, { mediaSource: t, mimeType: n, codec: r }) {
10723
10740
  lastBufferCleanupTime: performance.now()
10724
10741
  });
10725
10742
  }
10726
- function mS({ initSegments: e, pendingSamples: t }) {
10743
+ function hS({ initSegments: e, pendingSamples: t }) {
10727
10744
  return {
10728
10745
  state: "uninitialized",
10729
- initSegments: e == null ? new fS() : e,
10746
+ initSegments: e == null ? new pS() : e,
10730
10747
  sequenceNumber: 0,
10731
10748
  isWorkingOnPendingSamples: !1,
10732
10749
  hasFirstSync: t.some((e) => e.isSync),
@@ -10736,7 +10753,7 @@ function mS({ initSegments: e, pendingSamples: t }) {
10736
10753
  successfulAppendCalls: 0
10737
10754
  };
10738
10755
  }
10739
- var hS = class {
10756
+ var gS = class {
10740
10757
  constructor(n, r, i) {
10741
10758
  var a = this;
10742
10759
  e(this, "maxChunkSize", 20), e(this, "minConsecutiveErrorsBeforeEmit", 5), e(this, "maxSecondsInBuffer", 60), e(this, "logger", void 0), e(this, "timers", j.create()), e(this, "emitter", void 0), e(this, "mediaElement", void 0), e(this, "mediaSource", new rc()), 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", () => {
@@ -10782,7 +10799,7 @@ var hS = class {
10782
10799
  var n, r, i;
10783
10800
  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;
10784
10801
  for (; c < o.length && !((i = o[c]) != null && i.isSync);) c++;
10785
- let l = mS({
10802
+ let l = hS({
10786
10803
  pendingSamples: o,
10787
10804
  initSegments: s
10788
10805
  });
@@ -10793,14 +10810,14 @@ var hS = class {
10793
10810
  this.trackContexts.forEach((e, n) => {
10794
10811
  if (t.has(n)) return;
10795
10812
  e.state === "initialized" && this.mediaSource.isOpen() && this.mediaSource.removeSourceBuffer(e.sourceBuffer);
10796
- let r = mS({
10813
+ let r = hS({
10797
10814
  pendingSamples: [],
10798
10815
  initSegments: e.initSegments
10799
10816
  });
10800
10817
  this.trackContexts.set(n, r);
10801
10818
  });
10802
10819
  }), e(this, "isCurrentTrackContext", (e, t) => this.trackContexts.get(e) === t), e(this, "initializeSourceBuffer", (e, t) => {
10803
- let n = pS(e, {
10820
+ let n = mS(e, {
10804
10821
  mimeType: t.mimeType,
10805
10822
  mediaSource: this.mediaSource,
10806
10823
  codec: t.codec
@@ -10824,9 +10841,9 @@ var hS = class {
10824
10841
  if (t) a.logger.debug("Already setup with the correct mime types");
10825
10842
  else for (let t of e) {
10826
10843
  let n = a.trackContexts.get(t.type);
10827
- if (n || (n = mS({
10844
+ if (n || (n = hS({
10828
10845
  pendingSamples: [],
10829
- initSegments: new fS()
10846
+ initSegments: new pS()
10830
10847
  }), a.trackContexts.set(t.type, n)), n.state === "initialized") {
10831
10848
  if (t.mimeType !== n.sourceBufferMimeType) try {
10832
10849
  yield n.sourceBuffer.changeType(t.mimeType), n.sourceBufferMimeType = t.mimeType;
@@ -10843,7 +10860,7 @@ var hS = class {
10843
10860
  a.logger.warn("removeSourceBuffer failed", { removeError: t }), a.reopenMediaSource("changeType recovery failed"), a.pendingTracksToAddSourceBuffers = e;
10844
10861
  return;
10845
10862
  }
10846
- let i = mS({
10863
+ let i = hS({
10847
10864
  pendingSamples: n.pendingSamples,
10848
10865
  initSegments: n.initSegments
10849
10866
  });
@@ -10867,7 +10884,7 @@ var hS = class {
10867
10884
  };
10868
10885
  }), e(this, "getNextBufferedRangeStart", (e) => {
10869
10886
  let t = this.getCommonBufferedRangesForCurrentTracks();
10870
- if (t) return gS(e, t);
10887
+ if (t) return _S(e, t);
10871
10888
  }), e(this, "getBufferedEndAt", (e) => {
10872
10889
  var t;
10873
10890
  let n = this.getCommonBufferedRangesForCurrentTracks();
@@ -10917,9 +10934,9 @@ var hS = class {
10917
10934
  s > 0 && performance.now() - r.lastBufferCleanupTime > 1e4 && (r.lastBufferCleanupTime = performance.now(), yield r.sourceBuffer.removeBuffer(0, s + 10));
10918
10935
  try {
10919
10936
  let t = r.sequenceNumber;
10920
- if ("fragmented" in n) for (let t of xS(e)) {
10937
+ if ("fragmented" in n) for (let t of SS(e)) {
10921
10938
  var c;
10922
- yield r.sourceBuffer.appendBuffer(SS(t.map((e) => e.data)), (c = t[0]) == null ? void 0 : c.initData);
10939
+ yield r.sourceBuffer.appendBuffer(CS(t.map((e) => e.data)), (c = t[0]) == null ? void 0 : c.initData);
10923
10940
  }
10924
10941
  else {
10925
10942
  let n = Hs(e, t++);
@@ -10967,7 +10984,7 @@ var hS = class {
10967
10984
  let t = this.trackContexts.get(e.type);
10968
10985
  if (!t) throw Bn(e.type, e.renditionId);
10969
10986
  let n = t.pendingSamples.length - t.pendingSamplesOffset;
10970
- if (t.state === "uninitialized" && n >= vS && (e.isSync || n >= 2 * vS) && (t.pendingSamples = [], t.pendingSamplesOffset = 0, t.hasFirstSync = !1), t.hasFirstSync || e.isSync) {
10987
+ if (t.state === "uninitialized" && n >= yS && (e.isSync || n >= 2 * yS) && (t.pendingSamples = [], t.pendingSamplesOffset = 0, t.hasFirstSync = !1), t.hasFirstSync || e.isSync) {
10971
10988
  if (this.hasAddedInitialPosterFrame && e.isSync && e.type === "video") {
10972
10989
  this.hasAddedInitialPosterFrame = !1;
10973
10990
  let n = p({}, e);
@@ -10978,7 +10995,7 @@ var hS = class {
10978
10995
  let t = (e.timestamp + ((r = e.compositionTimeOffset) == null ? 0 : r)) / e.timescale * 1e3, n = this.videoKeyframeTimestamps[this.videoKeyframeTimestamps.length - 1];
10979
10996
  n !== void 0 && t < n && (this.videoKeyframeTimestamps = []), this.videoKeyframeTimestamps.push(t), this.videoKeyframeTimestamps.length > 20 && (this.videoKeyframeTimestamps = this.videoKeyframeTimestamps.slice(-20));
10980
10997
  }
10981
- t.state !== "uninitialized" && (t.isWorkingOnPendingSamples || wS(t, this.append, this.maxChunkSize).catch((n) => {
10998
+ t.state !== "uninitialized" && (t.isWorkingOnPendingSamples || TS(t, this.append, this.maxChunkSize).catch((n) => {
10982
10999
  if (t.isWorkingOnPendingSamples = !1, !this.isReopening) {
10983
11000
  if (!this.isCurrentTrackContext(e.type, t)) this.logger.debug("Suppressing append error from stale track context", { type: e.type });
10984
11001
  else if (n instanceof tc) this.logger.debug("Suppressing append error from a disposed source buffer", { type: e.type });
@@ -11091,14 +11108,14 @@ var hS = class {
11091
11108
  if (this.mediaSource.isClosed()) return;
11092
11109
  let e = this.getInitializedTrackBuffers();
11093
11110
  if (e.length !== 0) return this.getCommonBufferedRanges(e);
11094
- }), e(this, "getCommonBufferedRanges", (e) => e.slice(1).reduce((e, t) => bS(e, t), e[0] ? Array.from(e[0]) : [])), e(this, "getPlaybackStateForBufferedRanges", (e, t) => en(t, e) ? "playing" : "buffering"), this.logger = n, this.mediaElement = i, this.emitter = r;
11111
+ }), e(this, "getCommonBufferedRanges", (e) => e.slice(1).reduce((e, t) => xS(e, t), e[0] ? Array.from(e[0]) : [])), e(this, "getPlaybackStateForBufferedRanges", (e, t) => en(t, e) ? "playing" : "buffering"), this.logger = n, this.mediaElement = i, this.emitter = r;
11095
11112
  }
11096
11113
  };
11097
- dS = hS, e(hS, "create", (e, t, n) => {
11098
- let r = new dS(e, t, n);
11114
+ fS = gS, e(gS, "create", (e, t, n) => {
11115
+ let r = new fS(e, t, n);
11099
11116
  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;
11100
11117
  });
11101
- var gS = (e, t) => {
11118
+ var _S = (e, t) => {
11102
11119
  for (let r = 0; r < t.length; r++) {
11103
11120
  let i = t[r];
11104
11121
  if (i) {
@@ -11109,11 +11126,11 @@ var gS = (e, t) => {
11109
11126
  }
11110
11127
  }
11111
11128
  }
11112
- }, _S = (e, t) => {
11129
+ }, vS = (e, t) => {
11113
11130
  var n;
11114
11131
  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;
11115
11132
  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;
11116
- }, vS = 1e3, yS = 32, bS = (e, t) => {
11133
+ }, yS = 1e3, bS = 32, xS = (e, t) => {
11117
11134
  let n = [], r = 0, i = 0;
11118
11135
  for (; r < e.length && i < t.length;) {
11119
11136
  let a = e[r], o = t[i];
@@ -11125,7 +11142,7 @@ var gS = (e, t) => {
11125
11142
  }), a.end <= o.end ? r++ : i++;
11126
11143
  }
11127
11144
  return n;
11128
- }, xS = (e) => {
11145
+ }, SS = (e) => {
11129
11146
  let t = [];
11130
11147
  for (let r of e) {
11131
11148
  var n;
@@ -11134,15 +11151,15 @@ var gS = (e, t) => {
11134
11151
  (e == null || (n = e[0]) == null ? void 0 : n.initData) === r.initData ? e.push(r) : t.push([r]);
11135
11152
  }
11136
11153
  return t;
11137
- }, SS = (e) => {
11154
+ }, CS = (e) => {
11138
11155
  if (e.length === 1 && e[0]) return e[0];
11139
11156
  let t = new Uint8Array(e.reduce((e, t) => e + t.byteLength, 0)), n = 0;
11140
11157
  for (let r of e) t.set(r, n), n += r.byteLength;
11141
11158
  return t;
11142
- }, CS = (e) => {
11159
+ }, wS = (e) => {
11143
11160
  let t = e.pendingSamplesOffset;
11144
- t !== 0 && (t >= e.pendingSamples.length ? (e.pendingSamples = [], e.pendingSamplesOffset = 0) : t < yS || t * 2 < e.pendingSamples.length || (e.pendingSamples = e.pendingSamples.slice(t), e.pendingSamplesOffset = 0));
11145
- }, wS = function() {
11161
+ t !== 0 && (t >= e.pendingSamples.length ? (e.pendingSamples = [], e.pendingSamplesOffset = 0) : t < bS || t * 2 < e.pendingSamples.length || (e.pendingSamples = e.pendingSamples.slice(t), e.pendingSamplesOffset = 0));
11162
+ }, TS = function() {
11146
11163
  var e = t(function* (e, t, n) {
11147
11164
  for (e.isWorkingOnPendingSamples = !0; e.pendingSamplesOffset < e.pendingSamples.length;) {
11148
11165
  let r = [], i = e.pendingSamplesOffset;
@@ -11150,7 +11167,7 @@ var gS = (e, t) => {
11150
11167
  i = t;
11151
11168
  let a = e.pendingSamples[t], o = e.pendingSamples[t + 1];
11152
11169
  if (a && (r.push(a), o)) {
11153
- if (_S(a, o)) break;
11170
+ if (vS(a, o)) break;
11154
11171
  let e = (a.timestamp + a.duration) / a.timescale;
11155
11172
  if (o.timestamp / o.timescale - e > .1) break;
11156
11173
  }
@@ -11158,14 +11175,14 @@ var gS = (e, t) => {
11158
11175
  }
11159
11176
  let a = r[0];
11160
11177
  if (!a) break;
11161
- yield t(r, !e.previousSample || _S(e.previousSample, a)), e.pendingSamplesOffset = i + 1, e.previousSample = r[r.length - 1], CS(e);
11178
+ yield t(r, !e.previousSample || vS(e.previousSample, a)), e.pendingSamplesOffset = i + 1, e.previousSample = r[r.length - 1], wS(e);
11162
11179
  }
11163
11180
  e.isWorkingOnPendingSamples = !1;
11164
11181
  });
11165
11182
  return function(t, n, r) {
11166
11183
  return e.apply(this, arguments);
11167
11184
  };
11168
- }(), TS, ES = class {
11185
+ }(), ES, DS = class {
11169
11186
  constructor(n, r) {
11170
11187
  var i = this;
11171
11188
  e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "element", void 0), e(this, "pictureInPictureWindow", void 0), e(this, "unload", () => {
@@ -11197,9 +11214,9 @@ var gS = (e, t) => {
11197
11214
  }()), e(this, "isWebkitPresentationModeSupported", () => !!this.element && ot(this.element)), this.emitter = n, this.logger = r, this.emitter.on("add picture in picture listener", this.onEnablePictureInPicture);
11198
11215
  }
11199
11216
  };
11200
- TS = ES, e(ES, "create", (e, t) => new TS(e, t));
11217
+ ES = DS, e(DS, "create", (e, t) => new ES(e, t));
11201
11218
  // ../../libs/web-sdk/src/modules/PlaybackModule.ts
11202
- var DS, OS = class {
11219
+ var OS, kS = class {
11203
11220
  constructor(t, n, r, i) {
11204
11221
  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", () => {
11205
11222
  this.emitter.off("buffer state", this.onBufferedStateChanged), this.emitter.off("needs user input", this.onNeedsUserInput);
@@ -11217,23 +11234,23 @@ var DS, OS = class {
11217
11234
  }), 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);
11218
11235
  }
11219
11236
  };
11220
- DS = OS, e(OS, "create", (e, t, n, r) => new DS(e, t, n, r));
11237
+ OS = kS, e(kS, "create", (e, t, n, r) => new OS(e, t, n, r));
11221
11238
  // ../../libs/web-sdk/src/modules/QualityOfServiceModule.ts
11222
- var kS, AS = 6e4, jS = () => ({
11239
+ var AS, jS = 6e4, MS = () => ({
11223
11240
  upgradesFromLevel: [],
11224
11241
  downgradesFromLevel: [],
11225
11242
  bufferingRanges: [],
11226
11243
  activeRanges: [],
11227
11244
  decodeRate: 2 ** 53 - 1
11228
- }), MS = () => ({
11245
+ }), NS = () => ({
11229
11246
  levels: {},
11230
11247
  levelDowngrades: [],
11231
11248
  levelUpgrades: [],
11232
11249
  bufferFullness: 0,
11233
- general: jS()
11234
- }), NS = 100, PS = 3600, FS = 1e3, IS = class {
11250
+ general: MS()
11251
+ }), PS = 100, FS = 3600, IS = 1e3, LS = class {
11235
11252
  constructor(t, n, r, i) {
11236
- e(this, "minBufferFullnessLengthForRegression", 6), e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "timers", j.create()), e(this, "metrics", MS()), e(this, "bufferFullness", new S(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, "recentFatalQosCount", 0), e(this, "healthyPlaybackMs", 0), e(this, "healthyPlaybackStartedAt", void 0), e(this, "playbackIsPlaying", !1), e(this, "stallClockStart", 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", () => {
11253
+ e(this, "minBufferFullnessLengthForRegression", 6), e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "timers", j.create()), e(this, "metrics", NS()), e(this, "bufferFullness", new S(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, "recentFatalQosCount", 0), e(this, "healthyPlaybackMs", 0), e(this, "healthyPlaybackStartedAt", void 0), e(this, "playbackIsPlaying", !1), e(this, "stallClockStart", 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", () => {
11237
11254
  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), this.emitter.on("subscription changed", this.onSubscriptionChanged), this.emitter.on("pagehide", this.onPageHide);
11238
11255
  }), e(this, "unload", () => {
11239
11256
  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.emitter.off("subscription changed", this.onSubscriptionChanged), this.emitter.off("pagehide", this.onPageHide), this.suspend();
@@ -11251,7 +11268,7 @@ var kS, AS = 6e4, jS = () => ({
11251
11268
  return this.metrics.levels[a];
11252
11269
  }), e(this, "getBufferFullnessRegression", (e = !1) => {
11253
11270
  if (!e) return this.bufferFullnessRegression;
11254
- if (performance.now() - this.lastDeliveryResumeTime < FS) return;
11271
+ if (performance.now() - this.lastDeliveryResumeTime < IS) return;
11255
11272
  let t = this.bufferFullness.items().filter(({ time: e }) => e >= this.lastDeliveryResumeTime);
11256
11273
  return t.length >= this.minBufferFullnessLengthForRegression ? this.calculateLinearRegression(t) : void 0;
11257
11274
  }), e(this, "getTargetBufferTime", () => {
@@ -11316,21 +11333,21 @@ var kS, AS = 6e4, jS = () => ({
11316
11333
  let d = !1;
11317
11334
  if (e.from) {
11318
11335
  var f;
11319
- let e = (f = this.metrics.levels[l]) == null ? jS() : f;
11336
+ let e = (f = this.metrics.levels[l]) == null ? MS() : f;
11320
11337
  l < u ? e.upgradesFromLevel.push(performance.now()) : e.downgradesFromLevel.push(performance.now()), Jt(e.activeRanges);
11321
11338
  let t = e.bufferingRanges[e.bufferingRanges.length - 1];
11322
11339
  d = !!t && !t.end, Jt(e.bufferingRanges), this.metrics.levels[l] = e;
11323
11340
  }
11324
11341
  if (e.to) {
11325
11342
  var p;
11326
- let e = (p = this.metrics.levels[u]) == null ? jS() : p;
11343
+ let e = (p = this.metrics.levels[u]) == null ? MS() : p;
11327
11344
  Yt(e.activeRanges), d && Yt(e.bufferingRanges), this.metrics.levels[u] = e, this.currentLevel = u;
11328
11345
  }
11329
11346
  }), e(this, "onMediaDeliveryResumed", () => {
11330
11347
  this.lastDeliveryResumeTime = performance.now();
11331
11348
  }), e(this, "onBufferFullness", (e) => {
11332
11349
  if (this.metrics.bufferFullness = e, this.isSuspended) return;
11333
- let t = performance.now(), n = this.bufferFullness.peekLast(), r = (e) => Math.floor(e / NS);
11350
+ let t = performance.now(), n = this.bufferFullness.peekLast(), r = (e) => Math.floor(e / PS);
11334
11351
  if (n && r(n.time) === r(t)) n.time = t, n.value = e;
11335
11352
  else {
11336
11353
  var i, a;
@@ -11338,7 +11355,7 @@ var kS, AS = 6e4, jS = () => ({
11338
11355
  time: t,
11339
11356
  value: e
11340
11357
  });
11341
- 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 - PS, r);
11358
+ 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 - FS, r);
11342
11359
  this.bufferFullness.filterPop(({ time: e }) => e >= o);
11343
11360
  }
11344
11361
  this.bufferFullnessRegression = this.bufferFullness.items().length >= this.minBufferFullnessLengthForRegression ? this.calculateLinearRegression() : void 0;
@@ -11353,7 +11370,7 @@ var kS, AS = 6e4, jS = () => ({
11353
11370
  case "paused":
11354
11371
  this.playbackIsPlaying = !1, this.hasPlayedInSession || this.stopHealthyPlayback();
11355
11372
  break;
11356
- case "buffering": this.stopHealthyPlayback(), this.playbackIsPlaying = !1, this.healthyPlaybackMs >= AS && (this.recentFatalQosCount = 0), !this.isSuspended && this.hasPlayedInSession ? (this.healthyPlaybackMs = 0, this.startBuffering()) : this.isSuspended && (this.healthyPlaybackMs = 0);
11373
+ case "buffering": this.stopHealthyPlayback(), this.playbackIsPlaying = !1, this.healthyPlaybackMs >= jS && (this.recentFatalQosCount = 0), !this.isSuspended && this.hasPlayedInSession ? (this.healthyPlaybackMs = 0, this.startBuffering()) : this.isSuspended && (this.healthyPlaybackMs = 0);
11357
11374
  }
11358
11375
  }), e(this, "onPageHide", ({ persisted: e }) => {
11359
11376
  e && (this.suspend(), this.playbackIsPlaying = !1);
@@ -11418,9 +11435,9 @@ var kS, AS = 6e4, jS = () => ({
11418
11435
  Yt(this.metrics.general.activeRanges);
11419
11436
  }
11420
11437
  };
11421
- kS = IS, e(IS, "create", (e, t, n, r) => new kS(e, t, n, r));
11438
+ AS = LS, e(LS, "create", (e, t, n, r) => new AS(e, t, n, r));
11422
11439
  // ../../libs/web-sdk/src/modules/RenditionsModule.ts
11423
- var LS, RS = class {
11440
+ var RS, zS = class {
11424
11441
  constructor(t, n) {
11425
11442
  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", () => {
11426
11443
  this.emitter.off("renditions", this.onRenditions), this.emitter.off("subscription changed", this.onSubscriptionChanged);
@@ -11495,9 +11512,9 @@ var LS, RS = class {
11495
11512
  }), 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);
11496
11513
  }
11497
11514
  };
11498
- LS = RS, e(RS, "create", (e, t) => new LS(e, t));
11515
+ RS = zS, e(zS, "create", (e, t) => new RS(e, t));
11499
11516
  // ../../libs/web-sdk/src/BFrameTracker.ts
11500
- var zS = class t {
11517
+ var BS = class t {
11501
11518
  constructor() {
11502
11519
  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 St(t.MAX_REMEMBERED_RENDITIONS));
11503
11520
  }
@@ -11533,7 +11550,7 @@ var zS = class t {
11533
11550
  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;
11534
11551
  }
11535
11552
  remember(e) {
11536
- this.channelId !== void 0 && this.rememberedRenditions.set(xx(this.channelId, this.renditionId), e);
11553
+ this.channelId !== void 0 && this.rememberedRenditions.set(Sx(this.channelId, this.renditionId), e);
11537
11554
  }
11538
11555
  latchBFrames() {
11539
11556
  this.hasBFramesValue = !0, this.hasObservedReordering = !0, this.isAwaitingAssessment = !1, this.remember(!0);
@@ -11545,17 +11562,17 @@ var zS = class t {
11545
11562
  this.hasSeenKeyframe && !this.hasObservedReordering && (this.remember(!1), this.hasBFramesValue = !1), this.hasSeenKeyframe = !0, this.omittedBoundaryCrossings = 0;
11546
11563
  }
11547
11564
  resetOnSwitch(e, t) {
11548
- if (!Sx(e, t, this.channelId, this.renditionId)) {
11565
+ if (!Cx(e, t, this.channelId, this.renditionId)) {
11549
11566
  let n = this.channelId !== void 0;
11550
11567
  this.channelId = e, this.renditionId = t, this.anchorCts = void 0, this.zeroOffsetSamples = 0, this.omittedBoundaryCrossings = 0, this.hasSeenKeyframe = !1, this.hasObservedReordering = !1;
11551
- let r = this.rememberedRenditions.get(xx(e, t));
11568
+ let r = this.rememberedRenditions.get(Sx(e, t));
11552
11569
  this.hasBFramesValue = r != null && r, n && (this.isAwaitingAssessment = r === void 0);
11553
11570
  }
11554
11571
  }
11555
11572
  };
11556
- e(zS, "MAX_REMEMBERED_RENDITIONS", 32);
11573
+ e(BS, "MAX_REMEMBERED_RENDITIONS", 32);
11557
11574
  // ../../libs/web-sdk/src/modules/SyncModule.ts
11558
- var BS, VS = 5e3, HS = .5, US = 3e3, WS = () => Ae() || De(), GS = (e) => e && WS() ? 100 : 0, KS = (e) => (t) => t > e, qS = 100, JS = 1e3, YS = 1e3, XS = 1e3, ZS = 100, QS = 50, $S = {
11575
+ var VS, HS = 5e3, US = .5, WS = 3e3, GS = () => Ae() || De(), KS = (e) => e && GS() ? 100 : 0, qS = (e) => (t) => t > e, JS = 100, YS = 1e3, XS = 1e3, ZS = 1e3, QS = 100, $S = 50, eC = {
11559
11576
  seek: {
11560
11577
  toleranceMs: 200,
11561
11578
  toleranceMaxMs: 2500,
@@ -11587,7 +11604,7 @@ var BS, VS = 5e3, HS = .5, US = 3e3, WS = () => Ae() || De(), GS = (e) => e && W
11587
11604
  decayCooldownMultiplier: 3,
11588
11605
  decayCheckInterval: 15e3
11589
11606
  }
11590
- }, eC = class {
11607
+ }, tC = class {
11591
11608
  get driftSamplesToCollect() {
11592
11609
  return this._driftSamplesToCollect;
11593
11610
  }
@@ -11595,8 +11612,8 @@ var BS, VS = 5e3, HS = .5, US = 3e3, WS = () => Ae() || De(), GS = (e) => e && W
11595
11612
  this._driftSamplesToCollect = e, this.driftSamples = new S(e);
11596
11613
  }
11597
11614
  constructor(t, n, r, i, a, o = !0) {
11598
- e(this, "emitter", void 0), e(this, "logger", void 0), e(this, "playbackSource", void 0), e(this, "bufferSource", void 0), e(this, "keyframeTimestamps", new S(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", qS), 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", j.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 S(this._driftSamplesToCollect)), e(this, "timestampOffset", void 0), e(this, "hasObservedBFrames", !1), e(this, "bFrameDetector", new zS()), 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", () => {
11599
- this.emitter.on("page active", this.onPageActive), this.emitter.on("pageshow", this.onPageShow), this.setSyncInterval(document.visibilityState === "hidden" ? JS : qS);
11615
+ e(this, "emitter", void 0), e(this, "logger", void 0), e(this, "playbackSource", void 0), e(this, "bufferSource", void 0), e(this, "keyframeTimestamps", new S(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", JS), 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", j.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 S(this._driftSamplesToCollect)), e(this, "timestampOffset", void 0), e(this, "hasObservedBFrames", !1), e(this, "bFrameDetector", new BS()), 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", () => {
11616
+ this.emitter.on("page active", this.onPageActive), this.emitter.on("pageshow", this.onPageShow), this.setSyncInterval(document.visibilityState === "hidden" ? YS : JS);
11600
11617
  }), e(this, "unload", () => {
11601
11618
  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");
11602
11619
  }), e(this, "suspend", () => {
@@ -11638,7 +11655,7 @@ var BS, VS = 5e3, HS = .5, US = 3e3, WS = () => Ae() || De(), GS = (e) => e && W
11638
11655
  }), e(this, "processSample", (e) => {
11639
11656
  var t;
11640
11657
  if (!e.channelId) throw Error("Sample must be assigned to a channel");
11641
- this.currentChannelId || (this.currentChannelId = e.channelId), this.timestampOffset || (this.timestampOffset = e.timestamp / e.timescale * 1e3 - VS);
11658
+ this.currentChannelId || (this.currentChannelId = e.channelId), this.timestampOffset || (this.timestampOffset = e.timestamp / e.timescale * 1e3 - HS);
11642
11659
  let n = e.type === "video" && e.isSync;
11643
11660
  if (this.bFrameDetector.update(e), this.latchBFramesIfDetected(), this.currentChannelId !== e.channelId) {
11644
11661
  let t = 2 ** 53 - 1;
@@ -11655,7 +11672,7 @@ var BS, VS = 5e3, HS = .5, US = 3e3, WS = () => Ae() || De(), GS = (e) => e && W
11655
11672
  this.currentChannelId || (this.currentChannelId = e);
11656
11673
  let i = t.mediaType();
11657
11674
  if (!i) throw Error("Fragment must have a media type");
11658
- this.timestampOffset || (this.timestampOffset = t.baseMediaDecodeTime() / t.timescale() * 1e3 - VS);
11675
+ this.timestampOffset || (this.timestampOffset = t.baseMediaDecodeTime() / t.timescale() * 1e3 - HS);
11659
11676
  let a = i === "video" && t.startsWithKeyframe();
11660
11677
  if (i === "video" && (this.bFrameDetector.updateFromFragment({
11661
11678
  type: i,
@@ -11780,7 +11797,7 @@ var BS, VS = 5e3, HS = .5, US = 3e3, WS = () => Ae() || De(), GS = (e) => e && W
11780
11797
  this.timeshiftDeferralStartedAt = void 0;
11781
11798
  return;
11782
11799
  }
11783
- let i = performance.now() - this.config.seek.timeoutMs * this.state.timeshiftToleranceMultiplier, a = this.timeshiftAdjustmentTimestamps.filter(KS(i)).length;
11800
+ let i = performance.now() - this.config.seek.timeoutMs * this.state.timeshiftToleranceMultiplier, a = this.timeshiftAdjustmentTimestamps.filter(qS(i)).length;
11784
11801
  if (a && this.state.timeshiftToleranceMultiplier > 2) this.logger.debug("Too many timeshifts within sliding window", {
11785
11802
  timeshiftCooldownThreshold: i,
11786
11803
  recentTimeshiftCount: a
@@ -11789,12 +11806,12 @@ var BS, VS = 5e3, HS = .5, US = 3e3, WS = () => Ae() || De(), GS = (e) => e && W
11789
11806
  if (e) {
11790
11807
  var o, s;
11791
11808
  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);
11792
- if (n - r < this.bufferSource.getTargetBufferTime() * HS) {
11809
+ if (n - r < this.bufferSource.getTargetBufferTime() * US) {
11793
11810
  let e = performance.now();
11794
11811
  if (this.timeshiftDeferralStartedAt === void 0 && (this.timeshiftDeferralStartedAt = e, this.logger.debug("Deferring timeshift while buffered ahead is thin", {
11795
11812
  drift: r,
11796
11813
  bufferedAhead: n
11797
- })), e - this.timeshiftDeferralStartedAt < US) return;
11814
+ })), e - this.timeshiftDeferralStartedAt < WS) return;
11798
11815
  }
11799
11816
  this.timeshiftDeferralStartedAt !== void 0 && this.logger.debug("Releasing timeshift deferral", { deferredMs: performance.now() - this.timeshiftDeferralStartedAt });
11800
11817
  }
@@ -11815,20 +11832,20 @@ var BS, VS = 5e3, HS = .5, US = 3e3, WS = () => Ae() || De(), GS = (e) => e && W
11815
11832
  let n = (e = (t = this.bufferSource).getNextBufferedRangeStart) == null ? void 0 : e.call(t, this.playbackSource.currentTime);
11816
11833
  return this.shouldSeekAfterBuffering = n !== void 0, n;
11817
11834
  }), e(this, "observePlayheadProgress", () => {
11818
- let e = this.playbackSource.currentTime, t = e !== this.lastPlayheadPosition, n = t && (this.positionSetBySeek === void 0 || e - this.positionSetBySeek > QS);
11835
+ let e = this.playbackSource.currentTime, t = e !== this.lastPlayheadPosition, n = t && (this.positionSetBySeek === void 0 || e - this.positionSetBySeek > $S);
11819
11836
  this.positionSetBySeek = void 0, (n || this.playbackSource.isPaused) && (this.hasPerformedStuckSeekInCurrentStillness = !1), (t || this.playbackSource.isPaused || this.isSeeking()) && (this.lastPlayheadPosition = e, this.lastPlayheadProgressAt = performance.now());
11820
11837
  }), e(this, "isPlayheadStuckInBuffer", () => {
11821
11838
  var e, t;
11822
- if (performance.now() - this.lastPlayheadProgressAt < YS) return !1;
11839
+ if (performance.now() - this.lastPlayheadProgressAt < XS) return !1;
11823
11840
  let n = this.playbackSource.currentTime, r = (e = (t = this.bufferSource).getBufferedEndAt) == null ? void 0 : e.call(t, n);
11824
- return r !== void 0 && r - n >= XS;
11841
+ return r !== void 0 && r - n >= ZS;
11825
11842
  }), e(this, "getRecoverySeekReason", () => {
11826
11843
  if (this.needsMediaSourceRecovery) return "media source reopen";
11827
11844
  if (this.shouldSeekWhileStuck) return "stuck in buffer";
11828
11845
  if (this.shouldSeekAfterBuffering) return "buffering";
11829
11846
  }), e(this, "shouldSkipNormalSeek", (e) => e < 0 && -e < this.currentAheadToleranceMs() || e > 0 && e < this.currentSeekToleranceMs() || Math.abs(e) < 1 || !this.isAllowedToSync()), e(this, "shouldDeferRecoverySeek", (e, t) => t !== void 0 && t > e), e(this, "buildStuckInBufferSeekPlan", () => {
11830
11847
  var e, t;
11831
- let n = this.playbackSource.currentTime, r = (e = (t = this.bufferSource).getBufferedEndAt) == null ? void 0 : e.call(t, n), i = n + Math.max(this.seekOvershoot, ZS);
11848
+ let n = this.playbackSource.currentTime, r = (e = (t = this.bufferSource).getBufferedEndAt) == null ? void 0 : e.call(t, n), i = n + Math.max(this.seekOvershoot, QS);
11832
11849
  if (r === void 0 || i >= r) return;
11833
11850
  let a = this.findKeyframeCloseToTimestamp(i);
11834
11851
  return {
@@ -11909,7 +11926,7 @@ var BS, VS = 5e3, HS = .5, US = 3e3, WS = () => Ae() || De(), GS = (e) => e && W
11909
11926
  if (r && (this.isSeeking() || !this.currentChannelId || this.isSuspended || this.playbackSource.isPaused) || (this.driftSamples.push(t), ht(this.driftSamples.items()) < this.currentTimeshiftToleranceMs() && (this.timeshiftDeferralStartedAt = void 0), !this.isSeekCooldownExpired()) || !r && this.driftSamples.items().length < this.driftSamplesToCollect && Math.abs(t) < 2e3) return;
11910
11927
  let i = r ? t : ht(this.driftSamples.items());
11911
11928
  if (!r && this.tryPlaybackRateSync(i) || !r && this.shouldSkipNormalSeek(i)) return;
11912
- let a = performance.now() - this.config.seek.timeoutMs * this.state.seekToleranceMultiplier, o = this.seekAdjustmentTimestamps.filter(KS(a)).length, s = this.currentEmergencySeekToleranceMs(), c = i > 0 && i >= s;
11929
+ let a = performance.now() - this.config.seek.timeoutMs * this.state.seekToleranceMultiplier, o = this.seekAdjustmentTimestamps.filter(qS(a)).length, s = this.currentEmergencySeekToleranceMs(), c = i > 0 && i >= s;
11913
11930
  o && this.state.seekToleranceMultiplier > 2 && !r && !c ? this.logger.debug("Too many seek adjustments within sliding window", {
11914
11931
  seekCooldownThreshold: a,
11915
11932
  recentSeekCount: o
@@ -11927,9 +11944,9 @@ var BS, VS = 5e3, HS = .5, US = 3e3, WS = () => Ae() || De(), GS = (e) => e && W
11927
11944
  let t = this.playbackState === "buffering";
11928
11945
  this.playbackState = e, e === "buffering" ? (t || (this.hasPerformedRecoverySeekInCurrentRecoveryState = !1), (this.refreshRecoverySeekState() !== void 0 || this.shouldSeekWhileStuck) && this.onSync()) : (this.hasPerformedRecoverySeekInCurrentRecoveryState = !1, this.hasPerformedStuckSeekInCurrentStillness = !1, this.clearRecoverySeekFlags());
11929
11946
  }), e(this, "onPageActive", (e) => {
11930
- this.setSyncInterval(e ? qS : JS), e && this.onSync();
11947
+ this.setSyncInterval(e ? JS : YS), e && this.onSync();
11931
11948
  }), e(this, "onPageShow", (e) => {
11932
- e.persisted && (this.setSyncInterval(document.visibilityState === "hidden" ? JS : qS), this.onSync());
11949
+ e.persisted && (this.setSyncInterval(document.visibilityState === "hidden" ? YS : JS), this.onSync());
11933
11950
  }), e(this, "setSyncInterval", (e) => {
11934
11951
  (this.syncInterval === void 0 || this.currentSyncIntervalMs !== e) && (this.clearSyncInterval(), this.currentSyncIntervalMs = e, this.syncInterval = this.timers.setInterval(this.onSync, e));
11935
11952
  }), e(this, "clearSyncInterval", () => {
@@ -11940,11 +11957,11 @@ var BS, VS = 5e3, HS = .5, US = 3e3, WS = () => Ae() || De(), GS = (e) => e && W
11940
11957
  let t = n >= e - this.config.seek.keyframeSearchBeforeMs, r = n <= e + this.config.seek.keyframeSearchAfterMs;
11941
11958
  if (t && r) return n;
11942
11959
  }
11943
- }), this.logger = n, this.emitter = t, this.playbackSource = r, this.bufferSource = i, this.usesMse = o, this.seekOvershoot = GS(o), this.config = {
11944
- seek: p({}, $S.seek),
11945
- timeshift: p({}, $S.timeshift),
11946
- playbackRate: p({}, $S.playbackRate),
11947
- backoff: p({}, $S.backoff)
11960
+ }), this.logger = n, this.emitter = t, this.playbackSource = r, this.bufferSource = i, this.usesMse = o, this.seekOvershoot = KS(o), this.config = {
11961
+ seek: p({}, eC.seek),
11962
+ timeshift: p({}, eC.timeshift),
11963
+ playbackRate: p({}, eC.playbackRate),
11964
+ backoff: p({}, eC.backoff)
11948
11965
  }, this.config.timeshift.enabled = a, o || (this.config.seek.toleranceMs = 50, this.config.timeshift.toleranceMs = 20, this.config.seek.aheadToleranceMs = 40), this.state = {
11949
11966
  seekToleranceMultiplier: 1,
11950
11967
  timeshiftToleranceMultiplier: 1
@@ -12002,9 +12019,9 @@ var BS, VS = 5e3, HS = .5, US = 3e3, WS = () => Ae() || De(), GS = (e) => e && W
12002
12019
  return this.serverCurrentTime - this.playbackSource.currentTime;
12003
12020
  }
12004
12021
  };
12005
- BS = eC, e(eC, "create", (e, t, n, r, i, a = !0) => new BS(e, t, n, r, i, a));
12022
+ VS = tC, e(tC, "create", (e, t, n, r, i, a = !0) => new VS(e, t, n, r, i, a));
12006
12023
  // ../../libs/web-sdk/src/modules/TelemetryModule.ts
12007
- var tC, nC = {
12024
+ var nC, rC = {
12008
12025
  enabled: !0,
12009
12026
  interval: 3e4,
12010
12027
  includeErrors: !0,
@@ -12013,11 +12030,11 @@ var tC, nC = {
12013
12030
  maxRetries: 10,
12014
12031
  maxErrorReports: 50,
12015
12032
  maxEvents: 50
12016
- }, rC = (e, t) => p(p({}, t), {}, {
12033
+ }, iC = (e, t) => p(p({}, t), {}, {
12017
12034
  type: e,
12018
12035
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
12019
12036
  discriminator: "web"
12020
- }), iC = class {
12037
+ }), aC = class {
12021
12038
  constructor(n, r, i, a) {
12022
12039
  var o = this;
12023
12040
  e(this, "logger", void 0), e(this, "timers", new j()), e(this, "emitter", void 0), e(this, "options", void 0), e(this, "parentContext", void 0), e(this, "unsentLines", new S(100)), e(this, "retries", 0), e(this, "errorCount", 0), e(this, "eventCount", 0), e(this, "statsCount", 0), e(this, "unload", () => {
@@ -12034,7 +12051,7 @@ var tC, nC = {
12034
12051
  initiator: "interval"
12035
12052
  }, n = {}) => {
12036
12053
  if (!this.options.includeStats) return;
12037
- let r = this.parentContext.getStatistics(), i = rC("stats", p(p(p({}, n), r), {}, {
12054
+ let r = this.parentContext.getStatistics(), i = iC("stats", p(p(p({}, n), r), {}, {
12038
12055
  isFinal: e,
12039
12056
  initiator: t,
12040
12057
  count: this.statsCount++
@@ -12042,7 +12059,7 @@ var tC, nC = {
12042
12059
  this.unsentLines.push(i);
12043
12060
  }), e(this, "addEvent", (e) => {
12044
12061
  if (!this.options.includeEvents || this.eventCount > this.options.maxEvents) return;
12045
- let t = this.parentContext.getStatistics(), n = rC("event", p(p({}, t), e));
12062
+ let t = this.parentContext.getStatistics(), n = iC("event", p(p({}, t), e));
12046
12063
  this.eventCount++, this.unsentLines.push(n);
12047
12064
  }), e(this, "getStatistics", () => ({ errorCount: this.errorCount })), e(this, "send", function() {
12048
12065
  var e = t(function* (e) {
@@ -12085,13 +12102,13 @@ var tC, nC = {
12085
12102
  let { includeErrors: t, maxErrorReports: n } = this.options;
12086
12103
  if (!(e instanceof M) || e.code() === "channel_not_live" || !t || (this.errorCount++, this.errorCount > n)) return;
12087
12104
  let r = this.parentContext.getStatistics();
12088
- this.unsentLines.push(rC("error", p(p({}, r), e.toStringifiable())));
12089
- }), this.logger = n, this.emitter = r, this.options = p(p({}, nC), i), this.parentContext = a;
12105
+ this.unsentLines.push(iC("error", p(p({}, r), e.toStringifiable())));
12106
+ }), this.logger = n, this.emitter = r, this.options = p(p({}, rC), i), this.parentContext = a;
12090
12107
  }
12091
12108
  };
12092
- tC = iC, e(iC, "create", (e, t, n, r) => new tC(e, t, n, r));
12109
+ nC = aC, e(aC, "create", (e, t, n, r) => new nC(e, t, n, r));
12093
12110
  // ../../libs/web-sdk/src/modules/UnpauseModule.ts
12094
- var aC, oC = class {
12111
+ var oC, sC = class {
12095
12112
  constructor(t, n, r) {
12096
12113
  e(this, "logger", void 0), e(this, "elements", void 0), e(this, "documentState", void 0), e(this, "timers", new j()), e(this, "unload", () => {
12097
12114
  this.timers.unload();
@@ -12100,9 +12117,9 @@ var aC, oC = class {
12100
12117
  }), this.logger = t, this.elements = n, this.documentState = r, this.timers.setInterval(this.unpause, 100);
12101
12118
  }
12102
12119
  };
12103
- aC = oC, e(oC, "create", (e, t, n) => new aC(e, t, n));
12120
+ oC = sC, e(sC, "create", (e, t, n) => new oC(e, t, n));
12104
12121
  // ../../libs/web-sdk/src/OptionsProvider.ts
12105
- var sC = [
12122
+ var cC = [
12106
12123
  "minBufferTime",
12107
12124
  "maxBufferTime",
12108
12125
  "burstEnabled",
@@ -12111,10 +12128,10 @@ var sC = [
12111
12128
  "offscreenCanvasEnabled",
12112
12129
  "videoCodecs"
12113
12130
  ];
12114
- function cC(e) {
12115
- return sC.includes(e);
12131
+ function lC(e) {
12132
+ return cC.includes(e);
12116
12133
  }
12117
- var lC = class {
12134
+ var uC = class {
12118
12135
  constructor(t) {
12119
12136
  e(this, "options", void 0), e(this, "overrides", /* @__PURE__ */ new Map()), this.options = t;
12120
12137
  }
@@ -12128,7 +12145,7 @@ var lC = class {
12128
12145
  this.options[e] = t;
12129
12146
  }
12130
12147
  get(e, t) {
12131
- if (t && cC(e)) {
12148
+ if (t && lC(e)) {
12132
12149
  var n;
12133
12150
  let r = (n = this.overrides.get(t)) == null ? void 0 : n[e];
12134
12151
  if (r !== void 0) return r;
@@ -12139,7 +12156,7 @@ var lC = class {
12139
12156
  var n;
12140
12157
  return (n = this.overrides.get(t)) == null ? void 0 : n[e];
12141
12158
  }
12142
- }, uC = 6, dC = (e) => {
12159
+ }, dC = 6, fC = (e) => {
12143
12160
  let t = [e], n = 0, r = 0, i = !1, a = (e, t) => {
12144
12161
  var i, a;
12145
12162
  if (e.flags && Gs(e.flags)) {
@@ -12151,7 +12168,7 @@ var lC = class {
12151
12168
  return u > 0 && (r = u), p(p({}, e), {}, { duration: u > 0 ? u : r });
12152
12169
  };
12153
12170
  return (e, n = !1) => {
12154
- if (e.flags && Gs(e.flags) && n && (i = !i), !(n && t.length < uC && i) && t.length > 0) {
12171
+ if (e.flags && Gs(e.flags) && n && (i = !i), !(n && t.length < dC && i) && t.length > 0) {
12155
12172
  i = !1;
12156
12173
  let n = e;
12157
12174
  for (let e = t.length - 1; e > 0; e--) {
@@ -12164,13 +12181,13 @@ var lC = class {
12164
12181
  }
12165
12182
  return t.push(e), [];
12166
12183
  };
12167
- }, fC = ["mse", "wasm"], pC = (e) => e == null ? fC : e, mC = (e) => {
12184
+ }, pC = ["mse", "wasm"], mC = (e) => e == null ? pC : e, hC = (e) => {
12168
12185
  if (!e) return !1;
12169
12186
  let t = e.headers && Object.keys(e.headers).length > 0, n = e.queryParams && Object.keys(e.queryParams).length > 0;
12170
12187
  return !!(t || n);
12171
- }, hC = (e, t, n) => {
12172
- if (mC(n)) return "mse";
12173
- let r = pC(e);
12188
+ }, gC = (e, t, n) => {
12189
+ if (hC(n)) return "mse";
12190
+ let r = mC(e);
12174
12191
  for (let e of r) switch (e) {
12175
12192
  case "mse":
12176
12193
  if (t) return "mse";
@@ -12181,7 +12198,7 @@ var lC = class {
12181
12198
  case "wasm": return "wasm";
12182
12199
  }
12183
12200
  return "wasm";
12184
- }, gC = (e, t, n) => {
12201
+ }, _C = (e, t, n) => {
12185
12202
  if (cn(t)) return p(p({}, e), {}, {
12186
12203
  type: "video",
12187
12204
  codec: t.codec,
@@ -12202,12 +12219,12 @@ var lC = class {
12202
12219
  data: e.payload,
12203
12220
  duration: 0
12204
12221
  });
12205
- }, _C = ({ average: e, last: t, max: n, min: r }) => ({
12222
+ }, vC = ({ average: e, last: t, max: n, min: r }) => ({
12206
12223
  average: Math.round(e),
12207
12224
  last: Math.round(t),
12208
12225
  max: Math.round(n),
12209
12226
  min: Math.round(r)
12210
- }), vC = [
12227
+ }), yC = [
12211
12228
  "timeSpentBuffering",
12212
12229
  "timePerBufferingEvent",
12213
12230
  "drift",
@@ -12219,24 +12236,24 @@ var lC = class {
12219
12236
  "videoKeyframeIntervalMs",
12220
12237
  "timeToConnected",
12221
12238
  "mediaSourceOpenTime"
12222
- ], yC = [
12239
+ ], bC = [
12223
12240
  "videoDecodeTime",
12224
12241
  "audioDecodeTime",
12225
12242
  "videoTransportTime",
12226
12243
  "rtt"
12227
- ], bC = (e) => typeof e == "object" && !!e && "min" in e && "max" in e && "average" in e && "last" in e, xC = (e) => {
12244
+ ], xC = (e) => typeof e == "object" && !!e && "min" in e && "max" in e && "average" in e && "last" in e, SC = (e) => {
12228
12245
  let t = p({}, e);
12229
- for (let e of vC) {
12246
+ for (let e of yC) {
12230
12247
  let n = t[e];
12231
12248
  typeof n == "number" && (t[e] = Math.round(n));
12232
12249
  }
12233
- for (let e of yC) {
12250
+ for (let e of bC) {
12234
12251
  let n = t[e];
12235
- bC(n) && (t[e] = _C(n));
12252
+ xC(n) && (t[e] = vC(n));
12236
12253
  }
12237
12254
  return t;
12238
- }, SC = (e, t) => e && typeof e == "object" && t in e, CC = (e) => !(typeof e != "object" || !SC(e, "channelId") || typeof e.channelId != "string" || !SC(e, "url") || typeof e.url != "string" || e.channelId.length === 0 || e.url.length === 0), wC = (e) => {
12239
- if (!CC(e)) throw new M("Invalid options", {
12255
+ }, CC = (e, t) => e && typeof e == "object" && t in e, wC = (e) => !(typeof e != "object" || !CC(e, "channelId") || typeof e.channelId != "string" || !CC(e, "url") || typeof e.url != "string" || e.channelId.length === 0 || e.url.length === 0), TC = (e) => {
12256
+ if (!wC(e)) throw new M("Invalid options", {
12240
12257
  isFatal: !0,
12241
12258
  code: "invalid_options"
12242
12259
  });
@@ -12245,20 +12262,20 @@ var lC = class {
12245
12262
  let n = t;
12246
12263
  n[e] === void 0 && delete n[e];
12247
12264
  }), t;
12248
- }, TC = (e) => {
12265
+ }, EC = (e) => {
12249
12266
  if (typeof e != "object" || !e) throw Error("not an object");
12250
12267
  if (!("video" in e)) throw Error("missing video in subscription");
12251
12268
  if (!("audio" in e)) throw Error("missing audio in subscription");
12252
12269
  if (!("channelId" in e)) throw Error("missing channelId");
12253
12270
  return !0;
12254
- }, EC = (e) => {
12271
+ }, DC = (e) => {
12255
12272
  switch (e) {
12256
12273
  case "opus": return "opus";
12257
12274
  case "aac": return "mp4a.40.2";
12258
12275
  case "mp3": return "mp3";
12259
12276
  default: throw Error(`Unsupported audio codec: ${e}`);
12260
12277
  }
12261
- }, DC = class {
12278
+ }, OC = class {
12262
12279
  constructor(n) {
12263
12280
  var r = this;
12264
12281
  e(this, "logger", void 0), e(this, "cache", /* @__PURE__ */ new Map()), e(this, "inFlight", /* @__PURE__ */ new Map()), e(this, "checkVideoSupport", function() {
@@ -12289,7 +12306,7 @@ var lC = class {
12289
12306
  if (typeof AudioDecoder > "u") return !1;
12290
12307
  let n = AudioDecoder.isConfigSupported;
12291
12308
  if (typeof n != "function") return !0;
12292
- let i = (t = e.codecString) == null ? EC(e.codec) : t, a = `audio|${i}|${e.sampleRate}|${e.channels}`, o = e.codec === "aac" ? Ai(e.channels, e.sampleRate) : e.codec === "opus" ? Ws(e.channels, e.sampleRate) : void 0;
12309
+ let i = (t = e.codecString) == null ? DC(e.codec) : t, a = `audio|${i}|${e.sampleRate}|${e.channels}`, o = e.codec === "aac" ? Ai(e.channels, e.sampleRate) : e.codec === "opus" ? Ws(e.channels, e.sampleRate) : void 0;
12293
12310
  return r.check(a, () => n({
12294
12311
  codec: i,
12295
12312
  sampleRate: e.sampleRate,
@@ -12319,7 +12336,7 @@ var lC = class {
12319
12336
  return this.inFlight.set(e, o), o;
12320
12337
  }), this.logger = n;
12321
12338
  }
12322
- }, OC = 1e4, kC = 300, AC = 3e3, jC = 1e4, MC = 250, NC = 921600, PC = /* @__PURE__ */ new WeakMap(), FC = /* @__PURE__ */ new WeakMap(), IC = /* @__PURE__ */ new WeakMap(), LC = /* @__PURE__ */ new WeakMap(), RC = class r extends s {
12339
+ }, kC = 1e4, AC = 300, jC = 3e3, MC = 1e4, NC = 250, PC = 921600, FC = /* @__PURE__ */ new WeakMap(), IC = /* @__PURE__ */ new WeakMap(), LC = /* @__PURE__ */ new WeakMap(), RC = /* @__PURE__ */ new WeakMap(), zC = class r extends s {
12323
12340
  handleListenerError(e, t) {
12324
12341
  let n = Object.assign(/* @__PURE__ */ Error(`Listener for "${String(t)}" threw`), { cause: e });
12325
12342
  setTimeout(() => {
@@ -12328,7 +12345,7 @@ var lC = class {
12328
12345
  }
12329
12346
  constructor(o) {
12330
12347
  var l, u, f;
12331
- super(), l = this, e(this, "pictureInPicture", void 0), e(this, "drm", void 0), e(this, "browser", He()), e(this, "options", void 0), e(this, "element", void 0), e(this, "playbackSource", void 0), e(this, "emitter", new s()), e(this, "logger", void 0), e(this, "modules", void 0), e(this, "clientIp", void 0), e(this, "sessionId", void 0), e(this, "clientId", an()), e(this, "_channels", []), e(this, "createdAt", performance.now()), e(this, "offscreenCanvasElement", void 0), e(this, "webCodecsRenditionSupport", void 0), e(this, "hasCalledConnect", !1), e(this, "shortBurstRejoin", !1), e(this, "upgradeHeld", !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 y(r.MAX_POOL_SIZE)), e(this, "userAgentInformation", new rn()), e(this, "encryptedMediaExtensions", void 0), c(this, PC, 0), c(this, FC, []), e(this, "sampleProcessingSesssions", /* @__PURE__ */ new Map()), e(this, "unbackedSamplesWarned", new Cx()), e(this, "unextractableSamplesWarned", new Cx()), 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), c(this, IC, void 0), c(this, LC, void 0), e(this, "attach", (e) => {
12348
+ super(), l = this, e(this, "pictureInPicture", void 0), e(this, "drm", void 0), e(this, "browser", He()), e(this, "options", void 0), e(this, "element", void 0), e(this, "playbackSource", void 0), e(this, "emitter", new s()), e(this, "logger", void 0), e(this, "modules", void 0), e(this, "clientIp", void 0), e(this, "sessionId", void 0), e(this, "clientId", an()), e(this, "_channels", []), e(this, "createdAt", performance.now()), e(this, "offscreenCanvasElement", void 0), e(this, "webCodecsRenditionSupport", void 0), e(this, "hasCalledConnect", !1), e(this, "shortBurstRejoin", !1), e(this, "upgradeHeld", !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 y(r.MAX_POOL_SIZE)), e(this, "userAgentInformation", new rn()), e(this, "encryptedMediaExtensions", void 0), c(this, FC, 0), c(this, IC, []), e(this, "sampleProcessingSesssions", /* @__PURE__ */ new Map()), e(this, "unbackedSamplesWarned", new wx()), e(this, "unextractableSamplesWarned", new wx()), 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), c(this, LC, void 0), c(this, RC, void 0), e(this, "attach", (e) => {
12332
12349
  var t;
12333
12350
  (t = this.wakeLock) == null || t.attach(e), e.appendChild(this.element);
12334
12351
  }), e(this, "setElement", (e) => {
@@ -12420,7 +12437,7 @@ var lC = class {
12420
12437
  video: p(p({}, t.video), n.video),
12421
12438
  audio: p(p({}, t.audio), n.audio)
12422
12439
  })), n.audio && this.modules.subscription.setAudioBitRate(n.audio.bitRate), !0);
12423
- }), e(this, "joinBurstMs", (e) => this.options.get("burstEnabled", this.channelId) ? !this.shortBurstRejoin && this.burstFits(e) ? this.targetBufferTime : Math.min(MC, this.targetBufferTime) : 0), e(this, "onPingTimeout", () => {
12440
+ }), e(this, "joinBurstMs", (e) => this.options.get("burstEnabled", this.channelId) ? !this.shortBurstRejoin && this.burstFits(e) ? this.targetBufferTime : Math.min(NC, this.targetBufferTime) : 0), e(this, "onPingTimeout", () => {
12424
12441
  this.shortBurstRejoin = !0, this.lowerTargetForRejoin() && this.emitter.emit("adapted level");
12425
12442
  }), e(this, "emitLanguagesIfChanged", () => {
12426
12443
  let e = this.modules.renditions.getLanguages(), t = this.latestEmittedLanguages;
@@ -12428,20 +12445,20 @@ var lC = class {
12428
12445
  }), e(this, "updateTextTracks", (e) => {
12429
12446
  let t = e.filter((e) => e.codec === "webvtt");
12430
12447
  t.forEach((e) => {
12431
- if (!i(FC, this).find((t) => t.language === e.language)) {
12448
+ if (!i(IC, this).find((t) => t.language === e.language)) {
12432
12449
  if (this.modules.canvasModule) {
12433
12450
  let t = this.modules.canvasModule.textTracks.addTextTrack(e.kind, e.label || e.language || "", e.language || "");
12434
- i(FC, this).push(t);
12451
+ i(IC, this).push(t);
12435
12452
  } else if (this.mediaElement instanceof HTMLVideoElement) {
12436
12453
  let t = this.mediaElement.addTextTrack(e.kind, e.label || e.language, e.language);
12437
- i(FC, this).push(t);
12454
+ i(IC, this).push(t);
12438
12455
  }
12439
12456
  }
12440
12457
  });
12441
- for (let e of i(FC, this)) t.find((t) => t.language === e.language) ? e.mode === "disabled" && (e.mode = "hidden") : e.mode = "disabled";
12458
+ for (let e of i(IC, this)) t.find((t) => t.language === e.language) ? e.mode === "disabled" && (e.mode = "hidden") : e.mode = "disabled";
12442
12459
  this.emit("text tracks", this.textTracks);
12443
12460
  }), e(this, "cleanupTextTracks", (e = this.currentTime - 2e4) => {
12444
- i(FC, this).forEach((t) => {
12461
+ i(IC, this).forEach((t) => {
12445
12462
  if (t.cues) for (let n of Array.from(t.cues)) n.endTime * 1e3 < e - 2e3 && t.removeCue(n);
12446
12463
  });
12447
12464
  }), e(this, "filterRenditions", function() {
@@ -12510,7 +12527,7 @@ var lC = class {
12510
12527
  var e;
12511
12528
  let t = this.modules.connection.linkQueue;
12512
12529
  if (!t) return !1;
12513
- let n = Math.max(this.targetBufferTime, AC), r = t.peak(n), i = performance.now() - ((e = this.modules.connection.lastConnectionTime) == null ? performance.now() : e), a = r === void 0 ? i < jC : !(r < kC);
12530
+ let n = Math.max(this.targetBufferTime, jC), r = t.peak(n), i = performance.now() - ((e = this.modules.connection.lastConnectionTime) == null ? performance.now() : e), a = r === void 0 ? i < MC : !(r < AC);
12514
12531
  return a && !this.upgradeHeld && this.logger.debug("Holding the upgrade while the link queues", {
12515
12532
  linkQueuePeakMs: r === void 0 ? void 0 : Math.round(r),
12516
12533
  windowMs: n
@@ -12615,8 +12632,8 @@ var lC = class {
12615
12632
  u = void 0, d = void 0, l.logger.warn("Failed to enable OffscreenCanvas; falling back to main thread rendering", { error: e });
12616
12633
  }
12617
12634
  else o && l.logger.warn("OffscreenCanvas requested but not supported; falling back to main thread rendering");
12618
- let f = l.capturesCanvasOnWebKit(u), p = yield Px.create(l.emitter, l.logger.createContext("DecoderModule"), l.options.get("logLevel"), n, l.playbackSource, l.pool, i, a, u, f), { videoRenderer: m } = p.getStatistics(), h = l.modules.canvasModule;
12619
- if (h instanceof rS) {
12635
+ let f = l.capturesCanvasOnWebKit(u), p = yield Fx.create(l.emitter, l.logger.createContext("DecoderModule"), l.options.get("logLevel"), n, l.playbackSource, l.pool, i, a, u, f), { videoRenderer: m } = p.getStatistics(), h = l.modules.canvasModule;
12636
+ if (h instanceof iS) {
12620
12637
  if (m === "OffscreenCanvas" && d) {
12621
12638
  h.setVideoRenderingEnabled(!1);
12622
12639
  let e = l.element;
@@ -12629,11 +12646,11 @@ var lC = class {
12629
12646
  t.parentElement && t.parentElement.replaceChild(e, t), l.setElement(e);
12630
12647
  }
12631
12648
  }
12632
- } else h instanceof uS && (h.setBackgroundPlaybackEnabled(l.isBackgroundPlayEnabled(l.channelId)), m === "OffscreenCanvas" && d ? (h.setOffscreenCanvas(d), l.offscreenCanvasElement = d, f && l.connectWebKitVideoOutput(p, h)) : (h.setVideoTrack(void 0), h.setOffscreenCanvas(void 0), l.offscreenCanvasElement = void 0));
12649
+ } else h instanceof dS && (h.setBackgroundPlaybackEnabled(l.isBackgroundPlayEnabled(l.channelId)), m === "OffscreenCanvas" && d ? (h.setOffscreenCanvas(d), l.offscreenCanvasElement = d, f && l.connectWebKitVideoOutput(p, h)) : (h.setVideoTrack(void 0), h.setOffscreenCanvas(void 0), l.offscreenCanvasElement = void 0));
12633
12650
  (e = l.modules.decoder) == null || e.unload(), l.modules.decoder = p, l.isHiddenWithBackgroundPlayback() && l.modules.decoder.enableBackgroundTimers(), l.modules.decoder.setVideoRenderingEnabled(l.isVideoOnScreen()), l.modules.decoder.load(), l.setupOffscreenSubtitleRouting();
12634
- })), e(this, "capturesCanvasOnWebKit", (e) => !!e && this.browser.platform.isWebKit && this.modules.canvasModule instanceof uS), e(this, "connectWebKitVideoOutput", (e, t) => {
12651
+ })), e(this, "capturesCanvasOnWebKit", (e) => !!e && this.browser.platform.isWebKit && this.modules.canvasModule instanceof dS), e(this, "connectWebKitVideoOutput", (e, t) => {
12635
12652
  let n = () => {
12636
- t.setVideoTrack(void 0), this.browser.platform.isIOS && e.setMaxVideoCanvasPixels(NC);
12653
+ t.setVideoTrack(void 0), this.browser.platform.isIOS && e.setMaxVideoCanvasPixels(PC);
12637
12654
  };
12638
12655
  e.onVideoTrackLost((e) => {
12639
12656
  this.logger.warn("Worker video track lost, falling back to canvas capture", { error: e }), n();
@@ -12641,7 +12658,7 @@ var lC = class {
12641
12658
  let r = e.videoTrack;
12642
12659
  r ? t.setVideoTrack(r) : n();
12643
12660
  }), e(this, "setupOffscreenSubtitleRouting", () => {
12644
- if (this.offscreenSubtitleInterval !== void 0 && (clearInterval(this.offscreenSubtitleInterval), this.offscreenSubtitleInterval = void 0), !this.offscreenCanvasElement || !this.modules.decoder || this.modules.canvasModule instanceof uS) return;
12661
+ if (this.offscreenSubtitleInterval !== void 0 && (clearInterval(this.offscreenSubtitleInterval), this.offscreenSubtitleInterval = void 0), !this.offscreenCanvasElement || !this.modules.decoder || this.modules.canvasModule instanceof dS) return;
12645
12662
  let e = this.modules.decoder, t = this.modules.canvasModule;
12646
12663
  if (!t) return;
12647
12664
  let n = !1;
@@ -12657,7 +12674,7 @@ var lC = class {
12657
12674
  }, 100);
12658
12675
  }), e(this, "unload", t(function* () {
12659
12676
  var e, t, n;
12660
- l.logger.debug("Unloading modules..."), l.offscreenSubtitleInterval !== void 0 && (clearInterval(l.offscreenSubtitleInterval), l.offscreenSubtitleInterval = void 0), yield Promise.all(Object.values(l.modules).map((e) => e == null ? void 0 : e.unload())), (e = l.wakeLock) == null || e.unload(), l.pool = new y(r.MAX_POOL_SIZE), (t = (n = l.playbackSource).unload) == null || t.call(n), l.element.remove(), l.emitter.reset(), l.encryptedMediaExtensions.unload(), l.reset(), l.logger.debug("Unloaded modules");
12677
+ l.logger.debug("Unloading modules..."), l.offscreenSubtitleInterval !== void 0 && (clearInterval(l.offscreenSubtitleInterval), l.offscreenSubtitleInterval = void 0), l.modules.connection.finishPendingDrop(), yield Promise.all(Object.values(l.modules).map((e) => e == null ? void 0 : e.unload())), (e = l.wakeLock) == null || e.unload(), l.pool = new y(r.MAX_POOL_SIZE), (t = (n = l.playbackSource).unload) == null || t.call(n), l.element.remove(), l.emitter.reset(), l.encryptedMediaExtensions.unload(), l.reset(), l.logger.debug("Unloaded modules");
12661
12678
  })), e(this, "userInput", () => {
12662
12679
  this.play();
12663
12680
  }), e(this, "pause", () => {
@@ -12679,7 +12696,7 @@ var lC = class {
12679
12696
  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(), r.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();
12680
12697
  }), e(this, "getStatistics", () => {
12681
12698
  let e = Object.values(this.modules).reduce((e, t) => t && "getStatistics" in t ? p(p({}, 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;
12682
- return xC(p(p({}, e), {}, {
12699
+ return SC(p(p({}, e), {}, {
12683
12700
  averageBitRate: t,
12684
12701
  reconnectsPerHour: i,
12685
12702
  seekAdjustmentsPerMinute: s,
@@ -12688,7 +12705,7 @@ var lC = class {
12688
12705
  }), e(this, "resetModules", () => {
12689
12706
  Object.values(this.modules).forEach((e) => {
12690
12707
  e && "reset" in e && e.reset();
12691
- }), this.playbackSource instanceof yc && this.modules.adaptivity.holdReconnect(OC), this.sampleProcessingSesssions.clear(), this.cleanupTextTracks(Infinity), this.playbackSource.currentTime = 0, this.playbackSource.isActivated = !1;
12708
+ }), this.playbackSource instanceof yc && this.modules.adaptivity.holdReconnect(kC), this.sampleProcessingSesssions.clear(), this.cleanupTextTracks(Infinity), this.playbackSource.currentTime = 0, this.playbackSource.isActivated = !1;
12692
12709
  }), e(this, "disconnectForInactivePage", (e) => {
12693
12710
  if (this.clearInactivityDisconnect(), this.emitter.emit("flush buffers"), !this.isBackgroundPlayEnabled(this.channelId)) {
12694
12711
  var t;
@@ -12715,10 +12732,10 @@ var lC = class {
12715
12732
  e && "unsuspend" in e && e.unsuspend();
12716
12733
  });
12717
12734
  }), e(this, "getRuntimeInfo", () => {
12718
- let e = this.modules.canvasModule instanceof uS || void 0;
12735
+ let e = this.modules.canvasModule instanceof dS || void 0;
12719
12736
  return p({
12720
12737
  uptime: this.uptime,
12721
- version: "4.8.2-22-g9f9a67a7",
12738
+ version: "4.8.2-24-g6a89da20e",
12722
12739
  clientId: this.clientId,
12723
12740
  sessionId: this.sessionId,
12724
12741
  channelId: this.channelId,
@@ -12765,7 +12782,7 @@ var lC = class {
12765
12782
  if (this.browser.platform.isWebKit || !this.browser.isMobile) return !1;
12766
12783
  let t = (e = this.modules) == null ? void 0 : e.decoder;
12767
12784
  return t ? t.audioWebCodecsInUse : this.isWebCodecsAudioAvailable(this.channelId);
12768
- }), this.options = new lC(p(p({}, nr), wC(o))), o.telemetryEnabled === void 0 && ["localhost", "127.0.0.1"].includes(location.hostname) && this.options.set("telemetryEnabled", !1);
12785
+ }), this.options = new uC(p(p({}, nr), TC(o))), o.telemetryEnabled === void 0 && ["localhost", "127.0.0.1"].includes(location.hostname) && this.options.set("telemetryEnabled", !1);
12769
12786
  let m = {
12770
12787
  channelId: this.options.get("channelId"),
12771
12788
  audio: {
@@ -12778,14 +12795,14 @@ var lC = class {
12778
12795
  height: this.options.get("maxSize").height
12779
12796
  }
12780
12797
  }, h = a.get();
12781
- h.setLevel(this.options.get("logLevel")), h.setDebug(!1), this.logger = h, this.webCodecsRenditionSupport = new DC(h), o.iosMediaElementEnabled !== void 0 && this.logger.warn("Option iosMediaElementEnabled is deprecated and will be removed in a future release. Use streamToMediaElementEnabled instead.");
12798
+ h.setLevel(this.options.get("logLevel")), h.setDebug(!1), this.logger = h, this.webCodecsRenditionSupport = new OC(h), o.iosMediaElementEnabled !== void 0 && this.logger.warn("Option iosMediaElementEnabled is deprecated and will be removed in a future release. Use streamToMediaElementEnabled instead.");
12782
12799
  let g = (u = o.streamToMediaElementEnabled) == null ? o.iosMediaElementEnabled : u;
12783
12800
  g !== void 0 && (this.options.set("streamToMediaElementEnabled", g), this.options.set("iosMediaElementEnabled", g)), o.iosBackgroundPlayEnabled !== void 0 && this.logger.warn("Option iosBackgroundPlayEnabled is deprecated and will be removed in a future release. Use backgroundPlayEnabled instead.");
12784
12801
  let _ = (f = o.backgroundPlayEnabled) == null ? o.iosBackgroundPlayEnabled : f;
12785
12802
  _ !== void 0 && (this.options.set("backgroundPlayEnabled", _), this.options.set("iosBackgroundPlayEnabled", _));
12786
12803
  let v = o.mseEnabled !== void 0, b = o.decoders !== void 0;
12787
12804
  v && this.logger.warn("Option mseEnabled is deprecated and will be removed in a future release. Use decoders instead (e.g. decoders: [\"wasm\"])."), v && !b && o.mseEnabled === !1 && this.options.set("decoders", ["wasm"]);
12788
- let x = ES.create(this.emitter, this.logger.createContext("PictureInPictureModule")), S = this.options.get("mediaSessionEnabled") ? cS.create(this.emitter, this.logger.createContext("MediaSessionModule"), {
12805
+ let x = DS.create(this.emitter, this.logger.createContext("PictureInPictureModule")), S = this.options.get("mediaSessionEnabled") ? lS.create(this.emitter, this.logger.createContext("MediaSessionModule"), {
12789
12806
  metadata: this.options.get("mediaSessionMetadata"),
12790
12807
  decoy: this.willUseMediaSource() || this.usesSplitCanvasAudio() ? void 0 : Hc.create(this.logger.createContext("AudioFocusDecoy"), this.yieldToInterruption),
12791
12808
  isMuted: () => this.playbackSource.userMuted,
@@ -12796,12 +12813,12 @@ var lC = class {
12796
12813
  holdDecoyWhilePaused: this.holdsDecoyWhilePaused(),
12797
12814
  keepDecoyWhenMuted: this.isWebKitCanvasPath(),
12798
12815
  pauseMeansMute: !this.options.get("pauseSupportEnabled")
12799
- }) : void 0, C = j.create(), te = Ix.create(this.emitter), ne = hx.create(this.emitter, this.logger.createContext("ConnectionModule"), {
12816
+ }) : void 0, C = j.create(), te = Lx.create(this.emitter), ne = gx.create(this.emitter, this.logger.createContext("ConnectionModule"), {
12800
12817
  reconnectHandler: this.options.get("reconnectHandler"),
12801
12818
  options: this.options,
12802
12819
  onConnectInfo: this.onConnectInfo,
12803
12820
  documentState: te
12804
- }), w = qv.create(this.logger.createContext("SubscriptionModule"), this.emitter, m), T = RS.create(this.emitter, w), re = OS.create(this.emitter, this.logger.createContext("PlaybackModule"), this, this.options.get("minBufferTime")), ie = IS.create(this.emitter, this.logger.createContext("QualityOfServiceModule"), T, re);
12821
+ }), w = qv.create(this.logger.createContext("SubscriptionModule"), this.emitter, m), T = zS.create(this.emitter, w), re = kS.create(this.emitter, this.logger.createContext("PlaybackModule"), this, this.options.get("minBufferTime")), ie = LS.create(this.emitter, this.logger.createContext("QualityOfServiceModule"), T, re);
12805
12822
  this.encryptedMediaExtensions = new bi(this.emitter, this.logger.createContext("EncryptedMediaExtensions"), o.drm), this.drm = {
12806
12823
  setHeaders: (e) => {
12807
12824
  this.encryptedMediaExtensions.headers = e;
@@ -12820,9 +12837,9 @@ var lC = class {
12820
12837
  logger: this.logger.createContext("MediaElement"),
12821
12838
  poster: ae
12822
12839
  });
12823
- e.on("buffer state", (e) => this.onMediaElementBufferState(e, oe)), 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, bi.isSupported() && this.encryptedMediaExtensions.attach(e.element), oe = hS.create(this.logger.createContext("MseModule"), this.emitter, this.element), this.options.get("pauseSupportEnabled") || (se = oC.create(this.logger.createContext("UnpauseModule"), [e], te)), this.options.get("pictureInPictureEnabled") && this.emitter.emit("add picture in picture listener", { element: e.element });
12840
+ e.on("buffer state", (e) => this.onMediaElementBufferState(e, oe)), 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, bi.isSupported() && this.encryptedMediaExtensions.attach(e.element), oe = gS.create(this.logger.createContext("MseModule"), this.emitter, this.element), this.options.get("pauseSupportEnabled") || (se = sC.create(this.logger.createContext("UnpauseModule"), [e], te)), this.options.get("pictureInPictureEnabled") && this.emitter.emit("add picture in picture listener", { element: e.element });
12824
12841
  } else if (this.streamsToMediaElement()) {
12825
- let e = uS.create(this.emitter, this.logger.createContext("ModernCanvasModule"), this.pool, this, {
12842
+ let e = dS.create(this.emitter, this.logger.createContext("ModernCanvasModule"), this.pool, this, {
12826
12843
  type: this.options.get("media") === "audio" ? "audio" : "video",
12827
12844
  muted: this.options.get("muted") || this.options.get("media") === "video",
12828
12845
  volume: this.options.get("volume"),
@@ -12834,10 +12851,10 @@ var lC = class {
12834
12851
  }), t = e.element();
12835
12852
  this.element = t.element, this.playbackSource = e, ce = e;
12836
12853
  let n = this.browser.platform.isIOS && this.browser.platform.iosVersion <= 15;
12837
- this.options.get("pictureInPictureEnabled") && !n && this.emitter.emit("add picture in picture listener", { element: this.element }), this.options.get("pauseSupportEnabled") || (se = oC.create(this.logger.createContext("UnpauseModule"), e.elements(), te));
12854
+ this.options.get("pictureInPictureEnabled") && !n && this.emitter.emit("add picture in picture listener", { element: this.element }), this.options.get("pauseSupportEnabled") || (se = sC.create(this.logger.createContext("UnpauseModule"), e.elements(), te));
12838
12855
  } else {
12839
12856
  let e;
12840
- e = rS.create(this.emitter, this.logger.createContext("LegacyCanvasModule"), this.pool, this, this.options.get("muted") || this.options.get("media") === "video", this.options.get("volume"), () => {
12857
+ e = iS.create(this.emitter, this.logger.createContext("LegacyCanvasModule"), this.pool, this, this.options.get("muted") || this.options.get("media") === "video", this.options.get("volume"), () => {
12841
12858
  this.setElement(e.element());
12842
12859
  }, this.options.get("minBufferTime")), this.element = e.element(), this.playbackSource = e, ce = e, this.options.get("iosWakeLockEnabled") && (this.wakeLock = new oc());
12843
12860
  }
@@ -12855,7 +12872,7 @@ var lC = class {
12855
12872
  getTargetBufferTime: () => re.getTargetBufferTime(),
12856
12873
  getNextBufferedRangeStart: oe ? (e) => oe.getNextBufferedRangeStart(e) : void 0,
12857
12874
  getBufferedEndAt: oe ? (e) => oe.getBufferedEndAt(e) : void 0
12858
- }, de = eC.create(this.emitter, this.logger.createContext("SyncModule"), this.playbackSource, D, ue, le), fe = Hx.create(this.logger.createContext("JitterModule")), pe = Tc.create(this.emitter), me = (this.options.get("edgeUrl") || this.options.get("url")).replace("wss://", "https://").replace("ws://", "http://").replace("//lb.", "//errors."), he = new URL("/telemetry", me).toString(), O = iC.create(this.logger.createContext("TelemetryModule"), this.emitter, {
12875
+ }, de = tC.create(this.emitter, this.logger.createContext("SyncModule"), this.playbackSource, D, ue, le), fe = Ux.create(this.logger.createContext("JitterModule")), pe = Tc.create(this.emitter), me = (this.options.get("edgeUrl") || this.options.get("url")).replace("wss://", "https://").replace("ws://", "http://").replace("//lb.", "//errors."), he = new URL("/telemetry", me).toString(), O = aC.create(this.logger.createContext("TelemetryModule"), this.emitter, {
12859
12876
  url: he,
12860
12877
  enabled: this.options.get("telemetryEnabled"),
12861
12878
  includeStats: !1,
@@ -12869,8 +12886,8 @@ var lC = class {
12869
12886
  }),
12870
12887
  incomingData: pe,
12871
12888
  adaptivity: Ic.create(this.emitter, this.logger.createContext("AdaptivityModule"), ie, pe, { cooldownTime: Math.max(this.options.get("minBufferTime"), 2e3) }),
12872
- constraintCap: bx.create(this.emitter, this.element, T, this.options.get("abrEnabled") ? this.options.get("sizeBasedResolutionCapEnabled") : !1),
12873
- event: zx.create(this.emitter, this.logger.createContext("EventModule"), de),
12889
+ constraintCap: xx.create(this.emitter, this.element, T, this.options.get("abrEnabled") ? this.options.get("sizeBasedResolutionCapEnabled") : !1),
12890
+ event: Bx.create(this.emitter, this.logger.createContext("EventModule"), de),
12874
12891
  sync: de,
12875
12892
  jitter: fe,
12876
12893
  documentState: te,
@@ -12939,7 +12956,7 @@ var lC = class {
12939
12956
  let r = ((t = (n = e.telemetry) == null ? void 0 : n.probability) == null ? 1 : t) >= Math.random();
12940
12957
  if (e.telemetry) {
12941
12958
  var i;
12942
- (i = this.modules.telemetry) == null || i.unload(), this.modules.telemetry = iC.create(this.logger.createContext("TelemetryModule"), this.emitter, p(p({}, e.telemetry), {}, { enabled: this.options.get("telemetryEnabled") && r }), this), this.modules.telemetry.load();
12959
+ (i = this.modules.telemetry) == null || i.unload(), this.modules.telemetry = aC.create(this.logger.createContext("TelemetryModule"), this.emitter, p(p({}, e.telemetry), {}, { enabled: this.options.get("telemetryEnabled") && r }), this), this.modules.telemetry.load();
12943
12960
  }
12944
12961
  }), this.emitter.on("adapt level", (e) => {
12945
12962
  let t = this.modules.renditions.getRenditionLevels(), n = this.modules.renditions.getRenditionLevel(), r = t.findIndex((e) => e === n), i = t.length - 1, a = r;
@@ -12982,8 +12999,8 @@ var lC = class {
12982
12999
  audio: p(p({}, this.targetSubscription.audio), f == null ? void 0 : f.audio)
12983
13000
  })), this.emitter.emit("adapted level");
12984
13001
  }), this.emitter.on("ping timeout", this.onPingTimeout), this.emitter.on("text track data", (e) => {
12985
- let t = i(FC, this).find((t) => t.language === e.language), r = this.modules.sync.getTimeshiftOffset() / 1e3, a = r - i(PC, this);
12986
- if (n(PC, this, r), t) {
13002
+ let t = i(IC, this).find((t) => t.language === e.language), r = this.modules.sync.getTimeshiftOffset() / 1e3, a = r - i(FC, this);
13003
+ if (n(FC, this, r), t) {
12987
13004
  if (t.cues) for (let e of t.cues) e.startTime -= a, e.endTime -= a;
12988
13005
  for (let n of e.cues) {
12989
13006
  let e = new VTTCue(n.startTime - r, n.endTime - r, n.text);
@@ -13001,7 +13018,7 @@ var lC = class {
13001
13018
  case "renditions": {
13002
13019
  var o;
13003
13020
  this.updateTextTracks(t.renditions);
13004
- let e = r.channelId, s = JSON.stringify(t.renditions), c = ((o = i(IC, this)) == null ? void 0 : o.sessionId) === a ? i(IC, this) : void 0, l = i(LC, this);
13021
+ let e = r.channelId, s = JSON.stringify(t.renditions), c = ((o = i(LC, this)) == null ? void 0 : o.sessionId) === a ? i(LC, this) : void 0, l = i(RC, this);
13005
13022
  if (!c && l && l.sessionId === a && l.channelId === e && l.table === s) {
13006
13023
  this.emit("rendition levels", this.modules.renditions.getRenditionLevels());
13007
13024
  break;
@@ -13010,16 +13027,16 @@ var lC = class {
13010
13027
  a === this.sessionId && ("error" in t ? this.logger.warn("Failed to filter renditions, keeping the current ones", { error: t.error }) : (this.emitter.emit("renditions", {
13011
13028
  renditions: t.renditions,
13012
13029
  channelId: e
13013
- }), n(LC, this, t.allProbesAnswered ? {
13030
+ }), n(RC, this, t.allProbesAnswered ? {
13014
13031
  sessionId: a,
13015
13032
  channelId: e,
13016
13033
  table: s
13017
13034
  } : void 0), this.emit("rendition levels", this.modules.renditions.getRenditionLevels()), this.emitLanguagesIfChanged()));
13018
13035
  }).finally(() => {
13019
13036
  var e;
13020
- ((e = i(IC, this)) == null ? void 0 : e.promise) === u && n(IC, this, void 0);
13037
+ ((e = i(LC, this)) == null ? void 0 : e.promise) === u && n(LC, this, void 0);
13021
13038
  });
13022
- n(IC, this, {
13039
+ n(LC, this, {
13023
13040
  sessionId: a,
13024
13041
  promise: u
13025
13042
  });
@@ -13028,7 +13045,7 @@ var lC = class {
13028
13045
  case "subscription changed":
13029
13046
  var s;
13030
13047
  try {
13031
- TC(t.subscription);
13048
+ EC(t.subscription);
13032
13049
  } catch (e) {
13033
13050
  this.emitter.emit("error", new M("Subscription failed validation", {
13034
13051
  source: e instanceof Error ? e : void 0,
@@ -13148,7 +13165,7 @@ var lC = class {
13148
13165
  _e && this.attach(_e), this.logger.info("Created Vindral instance", { options: this.options });
13149
13166
  let ve = function() {
13150
13167
  var e = t(function* (e) {
13151
- let t = e.channelId, r = l.sessionId, a = i(IC, l);
13168
+ let t = e.channelId, r = l.sessionId, a = i(LC, l);
13152
13169
  if (a && a.sessionId === r && (yield a.promise, r !== l.sessionId)) return;
13153
13170
  let o = l.modules.renditions.getRendition(e.renditionId, t);
13154
13171
  if (!qs(e.flags)) {
@@ -13163,8 +13180,8 @@ var lC = class {
13163
13180
  } catch (e) {
13164
13181
  l.logger.warn("failed to parse WebVTT segment, dropping it", e);
13165
13182
  }
13166
- let o = r / 1e3, s = i(FC, l).find((t) => t.language === e.language), c = o - i(PC, l);
13167
- if (n(PC, l, o), s) {
13183
+ let o = r / 1e3, s = i(IC, l).find((t) => t.language === e.language), c = o - i(FC, l);
13184
+ if (n(FC, l, o), s) {
13168
13185
  if (s.cues) for (let e of s.cues) e.startTime -= c, e.endTime -= c;
13169
13186
  for (let e of a) {
13170
13187
  let t = new VTTCue(e.startTime - o, e.endTime - o, e.text);
@@ -13200,10 +13217,10 @@ var lC = class {
13200
13217
  mimeType: a
13201
13218
  }), l.emit("initialized media");
13202
13219
  } else {
13203
- let t = gC(e, o, l.sizes.get(e.renditionId));
13220
+ let t = _C(e, o, l.sizes.get(e.renditionId));
13204
13221
  l.modules.jitter.recordSample(t);
13205
13222
  let r = l.sampleProcessingSesssions.get(n);
13206
- if (!r) r = dC(l.modules.sync.processSample(t)), l.sampleProcessingSesssions.set(n, r);
13223
+ if (!r) r = fC(l.modules.sync.processSample(t)), l.sampleProcessingSesssions.set(n, r);
13207
13224
  else {
13208
13225
  let e = l.willUseMediaSource() && l.isSwitchingRenditionLevel && t.type === "video", n = r(l.modules.sync.processSample(t), e), i = t;
13209
13226
  n.forEach((e) => {
@@ -13306,7 +13323,7 @@ var lC = class {
13306
13323
  e !== void 0 && t.length > 0 && !t.includes(e) ? this.logger.warn(`Language "${e}" is not available. Available languages: ${t.join(", ")}`) : (this.modules.subscription.setLanguage(e), this.modules.qualityOfService.restartStallClock(), this.alignSizeAndBitRate(this.targetSubscription));
13307
13324
  }
13308
13325
  set textTrack(e) {
13309
- e !== this.textTrack && (i(FC, this).forEach((t) => {
13326
+ e !== this.textTrack && (i(IC, this).forEach((t) => {
13310
13327
  if (t.label === e) t.mode = "showing";
13311
13328
  else {
13312
13329
  if (t.mode === "showing" && t.cues) for (let e of [...t.cues]) t.removeCue(e);
@@ -13315,11 +13332,11 @@ var lC = class {
13315
13332
  }), this.emitter.emit("text track", e));
13316
13333
  }
13317
13334
  get textTracks() {
13318
- return i(FC, this).filter((e) => e.mode !== "disabled").map((e) => e.label);
13335
+ return i(IC, this).filter((e) => e.mode !== "disabled").map((e) => e.label);
13319
13336
  }
13320
13337
  get textTrack() {
13321
13338
  var e;
13322
- return (e = i(FC, this).find((e) => e.mode === "showing")) == null ? void 0 : e.label;
13339
+ return (e = i(IC, this).find((e) => e.mode === "showing")) == null ? void 0 : e.label;
13323
13340
  }
13324
13341
  get channelId() {
13325
13342
  var e, t;
@@ -13451,7 +13468,7 @@ var lC = class {
13451
13468
  return this.modules.subscription.getTargetSubscription();
13452
13469
  }
13453
13470
  resolvedDecoder(e) {
13454
- return hC(this.options.get("decoders", e), this.browser.supportsMediaSource, this.options.get("drm"));
13471
+ return gC(this.options.get("decoders", e), this.browser.supportsMediaSource, this.options.get("drm"));
13455
13472
  }
13456
13473
  usesSplitCanvasAudio() {
13457
13474
  return !this.willUseMediaSource() && this.options.get("streamToMediaElementEnabled") && dt(this.browser) && this.options.get("media") !== "audio" && this.options.get("media") !== "video" && this.browser.platform.isIOS;
@@ -13491,5 +13508,5 @@ var lC = class {
13491
13508
  return this.hasCalledConnect && this.isBackgroundPlayEnabled(e) && !this.isUserPaused;
13492
13509
  }
13493
13510
  };
13494
- e(RC, "MAX_POOL_SIZE", 10), e(RC, "REMOVE_CUE_THRESHOLD", 1e4), e(RC, "BACKGROUND_INACTIVITY_DISCONNECT_TIMEOUT", 15e3), e(RC, "VISIBLE_PAUSE_DISCONNECT_DELAY", 1e3);
13495
- export { ot as A, Je as C, st as D, lt as E, b as F, Ie as M, Fe as N, at as O, S as P, it as S, tt as T, k as _, jn as a, Ye as b, vn as c, mn as d, Tn as f, Wt as g, M as h, Ai as i, ut as j, nt as k, yn as l, bn as m, EC as n, _n as o, xn as p, Ws as r, gn as s, RC as t, hn as u, Xe as v, Ze as w, Qe as x, $e as y };
13511
+ e(zC, "MAX_POOL_SIZE", 10), e(zC, "REMOVE_CUE_THRESHOLD", 1e4), e(zC, "BACKGROUND_INACTIVITY_DISCONNECT_TIMEOUT", 15e3), e(zC, "VISIBLE_PAUSE_DISCONNECT_DELAY", 1e3);
13512
+ export { ot as A, Je as C, st as D, lt as E, b as F, Ie as M, Fe as N, at as O, S as P, it as S, tt as T, k as _, jn as a, Ye as b, vn as c, mn as d, Tn as f, Wt as g, M as h, Ai as i, ut as j, nt as k, yn as l, bn as m, DC as n, _n as o, xn as p, Ws as r, gn as s, zC as t, hn as u, Xe as v, Ze as w, Qe as x, $e as y };