itube-modern-player 0.8.2 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core.js CHANGED
@@ -55,9 +55,9 @@ function J(r) {
55
55
  `).split(/\n\n+/);
56
56
  for (const i of e) {
57
57
  const s = i.split(`
58
- `).filter((f) => f.trim() !== "");
58
+ `).filter((v) => v.trim() !== "");
59
59
  if (s.length === 0) continue;
60
- let n = s.findIndex((f) => f.includes("-->"));
60
+ let n = s.findIndex((v) => v.includes("-->"));
61
61
  if (n === -1) continue;
62
62
  const [o, l] = s[n].split("-->"), h = H(o), c = H((l ?? "").split(" ")[1] ?? l ?? "") ?? H(l ?? "");
63
63
  if (h === null || c === null) continue;
@@ -203,12 +203,12 @@ function ut(r, t = 1, e = 1e3, i = 100) {
203
203
  const s = r.length;
204
204
  if (s === 0) return "";
205
205
  const n = e / (s - 1 || 1), o = Math.max(0, t) / 6, l = (u) => {
206
- const f = Math.min(s - 1, Math.max(0, u));
207
- return [f * n, i - r[f] * i];
206
+ const v = Math.min(s - 1, Math.max(0, u));
207
+ return [v * n, i - r[v] * i];
208
208
  }, [, h] = l(0);
209
209
  let c = `M 0 ${i} L 0 ${h.toFixed(1)}`;
210
210
  for (let u = 0; u < s - 1; u++) {
211
- const [f, p] = l(u - 1), [m, v] = l(u), [y, d] = l(u + 1), [k, C] = l(u + 2), A = m + (y - f) * o, O = Math.min(i, Math.max(0, v + (d - p) * o)), P = y - (k - m) * o, R = Math.min(i, Math.max(0, d - (C - v) * o));
211
+ const [v, p] = l(u - 1), [m, f] = l(u), [y, d] = l(u + 1), [k, C] = l(u + 2), A = m + (y - v) * o, O = Math.min(i, Math.max(0, f + (d - p) * o)), P = y - (k - m) * o, R = Math.min(i, Math.max(0, d - (C - f) * o));
212
212
  c += ` C ${A.toFixed(1)} ${O.toFixed(1)} ${P.toFixed(1)} ${R.toFixed(1)} ${y.toFixed(1)} ${d.toFixed(1)}`;
213
213
  }
214
214
  return c += ` L ${e} ${i} Z`, c;
@@ -230,9 +230,9 @@ async function tt(r, t, e, i, s) {
230
230
  const n = new AbortController(), o = setTimeout(() => n.abort(), e.requestTimeout);
231
231
  let l;
232
232
  try {
233
- const v = await fetch(t, { signal: n.signal, credentials: "omit" });
234
- if (!v.ok) throw new Error(`VAST request failed (${v.status})`);
235
- l = await v.text();
233
+ const f = await fetch(t, { signal: n.signal, credentials: "omit" });
234
+ if (!f.ok) throw new Error(`VAST request failed (${f.status})`);
235
+ l = await f.text();
236
236
  } finally {
237
237
  clearTimeout(o);
238
238
  }
@@ -243,15 +243,15 @@ async function tt(r, t, e, i, s) {
243
243
  mt(c, s);
244
244
  const u = c.querySelector(":scope > Wrapper");
245
245
  if (u) {
246
- const v = S(u.querySelector("VASTAdTagURI"));
247
- if (!v) throw new Error("VAST wrapper without VASTAdTagURI");
248
- return tt(r, v, e, i + 1, s);
246
+ const f = S(u.querySelector("VASTAdTagURI"));
247
+ if (!f) throw new Error("VAST wrapper without VASTAdTagURI");
248
+ return tt(r, f, e, i + 1, s);
249
249
  }
250
- const f = c.querySelector(":scope > InLine");
251
- if (!f) throw new Error("VAST ad has neither InLine nor Wrapper");
252
- const p = f.querySelector("Creatives > Creative > Linear");
250
+ const v = c.querySelector(":scope > InLine");
251
+ if (!v) throw new Error("VAST ad has neither InLine nor Wrapper");
252
+ const p = v.querySelector("Creatives > Creative > Linear");
253
253
  if (!p) throw new Error("VAST ad has no Linear creative");
254
- const m = ft(p);
254
+ const m = vt(p);
255
255
  if (!m) throw new Error("VAST ad has no playable MediaFile");
256
256
  return {
257
257
  roll: r.roll,
@@ -259,13 +259,13 @@ async function tt(r, t, e, i, s) {
259
259
  mediaType: m.type,
260
260
  clickThrough: S(p.querySelector("VideoClicks > ClickThrough")) ?? r.clickUrl,
261
261
  duration: D(S(p.querySelector(":scope > Duration"))),
262
- skipOffset: vt(
262
+ skipOffset: ft(
263
263
  p.getAttribute("skipoffset"),
264
264
  D(S(p.querySelector(":scope > Duration")))
265
265
  ),
266
266
  impressions: s.impressions,
267
267
  tracking: s.tracking,
268
- adTitle: S(f.querySelector(":scope > AdTitle")) ?? void 0
268
+ adTitle: S(v.querySelector(":scope > AdTitle")) ?? void 0
269
269
  };
270
270
  }
271
271
  function mt(r, t) {
@@ -283,7 +283,7 @@ function mt(r, t) {
283
283
  n && ((i = t.tracking).click ?? (i.click = [])).push(n);
284
284
  }
285
285
  }
286
- function ft(r) {
286
+ function vt(r) {
287
287
  const e = [...r.querySelectorAll("MediaFiles > MediaFile")].map((o) => ({
288
288
  url: S(o) ?? "",
289
289
  type: o.getAttribute("type") ?? void 0,
@@ -304,7 +304,7 @@ function D(r) {
304
304
  if (t)
305
305
  return (t[1] ? Number(t[1]) * 3600 : 0) + Number(t[2]) * 60 + Number(t[3]) + (t[4] ? Number(t[4].padEnd(3, "0")) / 1e3 : 0);
306
306
  }
307
- function vt(r, t) {
307
+ function ft(r, t) {
308
308
  if (!r) return;
309
309
  const e = r.trim().match(/^(\d+(?:\.\d+)?)%$/);
310
310
  return e ? t !== void 0 ? Number(e[1]) / 100 * t : void 0 : D(r);
@@ -408,13 +408,13 @@ class gt {
408
408
  n.src = t.mediaUrl, n.muted = this.host.contentVideo.muted, n.volume = this.host.contentVideo.volume;
409
409
  const h = a("div", "imp-spinner imp-ad__spinner"), c = a("div", "imp-ad__hud"), u = a("span", "imp-ad__badge");
410
410
  u.textContent = t.adTitle ? `${i.adLabel} · ${t.adTitle}` : i.adLabel;
411
- const f = a("span", "imp-ad__countdown");
412
- c.append(u, f);
411
+ const v = a("span", "imp-ad__countdown");
412
+ c.append(u, v);
413
413
  const p = a("div", "imp-ad__actions");
414
414
  let m = null;
415
415
  t.clickThrough && (m = a("button", "imp-ad__visit", { type: "button" }), m.textContent = i.visitAdvertiser, p.append(m));
416
- const v = a("button", "imp-ad__skip", { type: "button" });
417
- v.hidden = !0, p.append(v), s.append(n, h, c, p), this.host.container.append(s), this.layer = s;
416
+ const f = a("button", "imp-ad__skip", { type: "button" });
417
+ f.hidden = !0, p.append(f), s.append(n, h, c, p), this.host.container.append(s), this.layer = s;
418
418
  const y = t.skipOffset ?? this.opts.skipDelay, d = /* @__PURE__ */ new Set(), k = (w) => {
419
419
  d.has(w) || (d.add(w), F(t.tracking[w]));
420
420
  };
@@ -445,16 +445,16 @@ class gt {
445
445
  h.hidden = !1;
446
446
  }, { signal: l }), n.addEventListener("timeupdate", () => {
447
447
  const w = n.currentTime, B = n.duration;
448
- if (Number.isFinite(B) && B > 0 && (f.textContent = _(Math.max(0, B - w)), w / B >= 0.25 && k("firstQuartile"), w / B >= 0.5 && k("midpoint"), w / B >= 0.75 && k("thirdQuartile")), y >= 0) {
448
+ if (Number.isFinite(B) && B > 0 && (v.textContent = _(Math.max(0, B - w)), w / B >= 0.25 && k("firstQuartile"), w / B >= 0.5 && k("midpoint"), w / B >= 0.75 && k("thirdQuartile")), y >= 0) {
449
449
  const U = Math.ceil(y - w);
450
- U > 0 ? (v.hidden = !1, v.disabled = !0, v.textContent = `${i.skipAdIn} ${U}`) : (v.hidden = !1, v.disabled = !1, v.textContent = i.skipAd);
450
+ U > 0 ? (f.hidden = !1, f.disabled = !0, f.textContent = `${i.skipAdIn} ${U}`) : (f.hidden = !1, f.disabled = !1, f.textContent = i.skipAd);
451
451
  }
452
452
  }, { signal: l }), n.addEventListener("ended", () => R(!1), { signal: l }), n.addEventListener("error", () => {
453
453
  this.host.emitter.emit("aderror", {
454
454
  roll: { roll: t.roll },
455
455
  error: new Error("Ad media failed to play")
456
456
  }), P();
457
- }, { signal: l }), v.addEventListener("click", () => R(!0));
457
+ }, { signal: l }), f.addEventListener("click", () => R(!0));
458
458
  const z = () => {
459
459
  t.clickThrough && (k("click"), this.host.emitter.emit("adclick", { ad: t }), window.open(t.clickThrough, "_blank", "noopener"), n.pause());
460
460
  };
@@ -555,8 +555,8 @@ function xt(r, t, e, i) {
555
555
  label: c.height ? `${c.height}p` : `${Math.round(c.bitrate / 1e3)} kbps`
556
556
  })).reverse(), i.onLevels(n.levels);
557
557
  }), s.on(r.Events.LEVEL_SWITCHED, (c, u) => {
558
- const f = s.levels[u.level];
559
- f && i.onLevelSwitch(f.height ? `${f.height}p` : `${Math.round(f.bitrate / 1e3)} kbps`);
558
+ const v = s.levels[u.level];
559
+ v && i.onLevelSwitch(v.height ? `${v.height}p` : `${Math.round(v.bitrate / 1e3)} kbps`);
560
560
  });
561
561
  let o = 0, l = 0, h = !1;
562
562
  return s.on(r.Events.FRAG_BUFFERED, () => {
@@ -813,8 +813,8 @@ class Tt {
813
813
  this.rightGroup = l;
814
814
  const h = a("div", "imp-controls__spacer");
815
815
  this.chapterLabel = a("div", "imp-controls__chapter"), n.append(o, h, l), h.append(this.chapterLabel);
816
- const c = typeof s.seekButtons == "object" ? s.seekButtons : {}, u = c.back ?? t.seekStep, f = c.forward ?? t.seekStep;
817
- if (this.seekLabelFn = c.label, s.playlist && t.hasPlaylist && !s.hidePrev && (this.prevBtn = b("imp-btn--prev", e.previous, i.previous), this.prevBtn.addEventListener("click", () => t.previous()), o.append(this.prevBtn)), s.seekButtons && (this.seekBackBtn = b("imp-btn--seek-back", `${e.seekBack} ${u}s`, i.seekBack), this.addStepBadge(this.seekBackBtn, u, "back"), this.seekBackBtn.addEventListener("click", () => t.skip(-u)), o.append(this.seekBackBtn)), s.play && (this.playBtn = b("imp-btn--play", e.play, i.play), this.playBtn.addEventListener("click", () => t.togglePlay()), o.append(this.playBtn)), s.seekButtons && (this.seekFwdBtn = b("imp-btn--seek-forward", `${e.seekForward} ${f}s`, i.seekForward), this.addStepBadge(this.seekFwdBtn, f, "forward"), this.seekFwdBtn.addEventListener("click", () => t.skip(f)), o.append(this.seekFwdBtn)), s.playlist && t.hasPlaylist && !s.hideNext && (this.nextBtn = b("imp-btn--next", e.next, i.next), this.nextBtn.addEventListener("click", () => t.next()), o.append(this.nextBtn)), s.volume) {
816
+ const c = typeof s.seekButtons == "object" ? s.seekButtons : {}, u = c.back ?? t.seekStep, v = c.forward ?? t.seekStep;
817
+ if (this.seekLabelFn = c.label, s.playlist && t.hasPlaylist && !s.hidePrev && (this.prevBtn = b("imp-btn--prev", e.previous, i.previous), this.prevBtn.addEventListener("click", () => t.previous()), o.append(this.prevBtn)), s.seekButtons && (this.seekBackBtn = b("imp-btn--seek-back", `${e.seekBack} ${u}s`, i.seekBack), this.addStepBadge(this.seekBackBtn, u, "back"), this.seekBackBtn.addEventListener("click", () => t.skip(-u)), o.append(this.seekBackBtn)), s.play && (this.playBtn = b("imp-btn--play", e.play, i.play), this.playBtn.addEventListener("click", () => t.togglePlay()), o.append(this.playBtn)), s.seekButtons && (this.seekFwdBtn = b("imp-btn--seek-forward", `${e.seekForward} ${v}s`, i.seekForward), this.addStepBadge(this.seekFwdBtn, v, "forward"), this.seekFwdBtn.addEventListener("click", () => t.skip(v)), o.append(this.seekFwdBtn)), s.playlist && t.hasPlaylist && !s.hideNext && (this.nextBtn = b("imp-btn--next", e.next, i.next), this.nextBtn.addEventListener("click", () => t.next()), o.append(this.nextBtn)), s.volume) {
818
818
  const d = a("div", "imp-volume");
819
819
  this.muteBtn = b("imp-btn--mute", e.mute, i.volumeHigh), this.muteBtn.addEventListener("click", () => t.toggleMute()), this.volumeSlider = a("input", "imp-volume__slider", {
820
820
  type: "range",
@@ -837,8 +837,8 @@ class Tt {
837
837
  section: () => this.simpleSection(`custom:${d.id}`, d.title, d.icon ?? i.more, () => t.emit("customaction", { id: d.id }))
838
838
  });
839
839
  }
840
- const p = (d) => d === !1 ? "off" : d === "bar" ? "bar" : "gear", m = p(s.subtitles), v = p(s.quality), y = p(s.speed);
841
- if (this.gear = { speed: y === "gear", quality: v === "gear", subtitles: m === "gear" }, m === "bar") {
840
+ const p = (d) => d === !1 ? "off" : d === "bar" ? "bar" : "gear", m = p(s.subtitles), f = p(s.quality), y = p(s.speed);
841
+ if (this.gear = { speed: y === "gear", quality: f === "gear", subtitles: m === "gear" }, m === "bar") {
842
842
  this.subtitlesBtn = b("imp-btn--subtitles", e.subtitles, i.subtitles), this.subtitlesMenu = new M(this.subtitlesBtn);
843
843
  const d = a("div", "imp-controls__menu-anchor");
844
844
  d.append(this.subtitlesBtn, this.subtitlesMenu.root), this.subtitlesBtn.addEventListener("click", () => this.toggleSubtitlesMenu()), this.rightItems.set("subtitles", d), this.registerCollapsible({
@@ -849,7 +849,7 @@ class Tt {
849
849
  section: () => this.subtitlesSection()
850
850
  });
851
851
  }
852
- if (v === "bar") {
852
+ if (f === "bar") {
853
853
  this.qualityBtn = b("imp-btn--quality", e.quality, i.settings), this.qualityMenu = new M(this.qualityBtn);
854
854
  const d = a("div", "imp-controls__menu-anchor");
855
855
  d.append(this.qualityBtn, this.qualityMenu.root), this.qualityBtn.addEventListener("click", () => this.toggleQualityMenu()), this.rightItems.set("quality", d), this.registerCollapsible({
@@ -937,7 +937,7 @@ class Tt {
937
937
  el: d,
938
938
  priority: 82,
939
939
  available: () => Number.isFinite(t.duration) && t.duration > 0,
940
- section: () => this.simpleSection("seekFwd", `${e.seekForward} ${f}s`, i.seekForward, () => t.skip(f))
940
+ section: () => this.simpleSection("seekFwd", `${e.seekForward} ${v}s`, i.seekForward, () => t.skip(v))
941
941
  });
942
942
  }
943
943
  if (this.center = a("div", "imp-center-controls"), s.playlist && t.hasPlaylist && (this.centerPrevBtn = this.makeCenterButton("prev", e.previous, i.previous), this.centerPrevBtn.addEventListener("click", () => t.previous()), this.center.append(this.centerPrevBtn)), s.seekButtons) {
@@ -945,8 +945,8 @@ class Tt {
945
945
  this.addStepBadge(d, u, "back"), d.addEventListener("click", () => t.skip(-u)), this.center.append(d);
946
946
  }
947
947
  if (s.play && (this.centerPlayBtn = this.makeCenterButton("play", e.play, i.play), this.centerPlayBtn.addEventListener("click", () => t.togglePlay()), this.center.append(this.centerPlayBtn)), s.seekButtons) {
948
- const d = this.makeCenterButton("seek-forward", `${e.seekForward} ${f}s`, i.seekForward);
949
- this.addStepBadge(d, f, "forward"), d.addEventListener("click", () => t.skip(f)), this.center.append(d);
948
+ const d = this.makeCenterButton("seek-forward", `${e.seekForward} ${v}s`, i.seekForward);
949
+ this.addStepBadge(d, v, "forward"), d.addEventListener("click", () => t.skip(v)), this.center.append(d);
950
950
  }
951
951
  if (s.playlist && t.hasPlaylist && (this.centerNextBtn = this.makeCenterButton("next", e.next, i.next), this.centerNextBtn.addEventListener("click", () => t.next()), this.center.append(this.centerNextBtn)), this.center.style.display = "none", this.setupNextPreview(), this.gear.speed || this.gear.quality || this.gear.subtitles) {
952
952
  this.gearBtn = b("imp-btn--settings", e.settings, i.settings), this.gearMenu = new M(this.gearBtn);
@@ -1088,10 +1088,10 @@ class Tt {
1088
1088
  n.textContent = this.player.labels.next, e.append(n);
1089
1089
  const o = q(s.poster);
1090
1090
  if (i.thumbnail && o) {
1091
- const m = a("div", "imp-next-preview__thumb"), v = T(o);
1092
- if (v.addEventListener("error", () => {
1091
+ const m = a("div", "imp-next-preview__thumb"), f = T(o);
1092
+ if (f.addEventListener("error", () => {
1093
1093
  this.player.markSourceDead(s), this.nextPreviewEl && !this.nextPreviewEl.hidden && this.showNextPreview(t);
1094
- }, { once: !0 }), m.append(v), i.duration && s.duration) {
1094
+ }, { once: !0 }), m.append(f), i.duration && s.duration) {
1095
1095
  const y = a("span", "imp-next-preview__duration");
1096
1096
  y.textContent = _(s.duration), m.append(y);
1097
1097
  }
@@ -1102,7 +1102,7 @@ class Tt {
1102
1102
  m.textContent = s.title, e.append(m);
1103
1103
  }
1104
1104
  i.meta && s.previewMeta?.length && e.append(X(s.previewMeta, "imp-next-preview")), e.hidden = !1;
1105
- const l = this.player.container.getBoundingClientRect(), h = t.getBoundingClientRect(), c = 8, u = e.offsetWidth, f = h.left - l.left + h.width / 2 - u / 2, p = Math.max(c, Math.min(f, l.width - u - c));
1105
+ const l = this.player.container.getBoundingClientRect(), h = t.getBoundingClientRect(), c = 8, u = e.offsetWidth, v = h.left - l.left + h.width / 2 - u / 2, p = Math.max(c, Math.min(v, l.width - u - c));
1106
1106
  e.style.left = `${p}px`, e.style.bottom = `${l.height - (h.top - l.top) + 10}px`;
1107
1107
  }
1108
1108
  hideNextPreview() {
@@ -1644,7 +1644,12 @@ class Ht {
1644
1644
  const y = typeof l.borderRadius == "number" ? `${l.borderRadius}px` : l.borderRadius;
1645
1645
  this.container.style.setProperty("--imp-radius", y);
1646
1646
  }
1647
- l?.playButtonStyle === "inverted" && this.container.classList.add("imp-player--play-inverted"), this.video = e.videoElement ?? a("video", "imp-video"), this.video.classList.add("imp-video"), e.playsInline !== !1 && this.video.setAttribute("playsinline", ""), e.crossOrigin !== void 0 && (this.video.crossOrigin = e.crossOrigin), this.video.preload = "metadata", e.loop && (this.video.loop = !0);
1647
+ if (l?.playButtonStyle === "inverted" && this.container.classList.add("imp-player--play-inverted"), this.video = e.videoElement ?? a("video", "imp-video"), this.video.classList.add("imp-video"), e.videoElement && !e.videoElement.paused)
1648
+ try {
1649
+ e.videoElement.pause();
1650
+ } catch {
1651
+ }
1652
+ e.playsInline !== !1 && this.video.setAttribute("playsinline", ""), e.crossOrigin !== void 0 && (this.video.crossOrigin = e.crossOrigin), this.video.preload = "metadata", e.loop && (this.video.loop = !0);
1648
1653
  const h = this.persistVolume ? o : null;
1649
1654
  this.video.volume = x(h?.volume ?? e.volume ?? 1, 0, 1), (h?.muted ?? e.muted) && (this.video.muted = !0);
1650
1655
  const c = a("div", "imp-layer");
@@ -1653,16 +1658,16 @@ class Ht {
1653
1658
  u.textContent = this.labels.tryAgain, this.retryBtn.append(u, a("span", "imp-error__retry-spinner")), this.retryBtn.addEventListener("click", () => this.retry()), this.errorNextBtn = a("button", "imp-error__next", { type: "button" }), this.errorNextBtn.textContent = this.labels.nextVideo, this.errorNextBtn.addEventListener("click", () => {
1654
1659
  this.clearError(), this.next();
1655
1660
  });
1656
- const f = a("div", "imp-error__actions");
1657
- f.append(this.retryBtn, this.errorNextBtn), this.errorBox.append(this.errorText, f), this.pauseScreen = new Et(this.labels), this.poster = new Bt(this), this.related = new Mt(this), this.related.setOptions(e.related), this.upNext = new Ct(this), this.controls = new Tt(this), this.playlistPanel = new Pt(this, this.playlistOptions.layout, this.playlistOptions.title || void 0), this.scenesPanel = new At(this, e.scenes?.layout ?? "bottom");
1661
+ const v = a("div", "imp-error__actions");
1662
+ v.append(this.retryBtn, this.errorNextBtn), this.errorBox.append(this.errorText, v), this.pauseScreen = new Et(this.labels), this.poster = new Bt(this), this.related = new Mt(this), this.related.setOptions(e.related), this.upNext = new Ct(this), this.controls = new Tt(this), this.playlistPanel = new Pt(this, this.playlistOptions.layout, this.playlistOptions.title || void 0), this.scenesPanel = new At(this, e.scenes?.layout ?? "bottom");
1658
1663
  const p = a("div", "imp-layer__middle");
1659
1664
  p.append(this.spinner, this.errorBox, this.controls.center);
1660
1665
  const m = a("div", "imp-layer__bottom");
1661
1666
  m.append(this.controls.root), c.append(this.pauseScreen.root, this.related.root, this.upNext.root, p, m), this.container.append(this.video, c, this.poster.root, this.playlistPanel.root, this.scenesPanel.root), this.mount.append(this.container), e.pauseScreen instanceof HTMLElement ? this.pauseScreen.setCustomContent(e.pauseScreen) : typeof e.pauseScreen == "function" ? this.pauseScreen.setCustomContent(e.pauseScreen(this)) : e.pauseScreen && typeof e.pauseScreen == "object" && this.pauseScreen.setVisibility(e.pauseScreen);
1662
- const v = e.adConfig ?? e.ads;
1663
- v && v.adList.length > 0 && (this.adManager = new gt(
1667
+ const f = e.adConfig ?? e.ads;
1668
+ f && f.adList.length > 0 && (this.adManager = new gt(
1664
1669
  { container: this.container, contentVideo: this.video, emitter: this.emitter, labels: this.labels, closeIcon: this.icons.close },
1665
- v
1670
+ f
1666
1671
  )), this.emitter.on("error", ({ fatal: y }) => {
1667
1672
  if (!y) return;
1668
1673
  const d = this.lastPlayheadTime || this.video.currentTime;
@@ -2120,15 +2125,15 @@ class Ht {
2120
2125
  }, { once: !0, signal: this.abort.signal });
2121
2126
  else if (n.chapters) {
2122
2127
  const p = (m) => {
2123
- const v = () => {
2128
+ const f = () => {
2124
2129
  s === this.loadToken && (this.chapters = j(m, this.knownDuration), this.controls.progress.setChapters(this.chapters), this.controls.syncFeatureButtons(), this.scenesPanel.visible && this.scenesPanel.rebuild());
2125
2130
  };
2126
- Number.isFinite(this.video.duration) && this.video.duration > 0 ? v() : this.video.addEventListener("loadedmetadata", v, { once: !0, signal: this.abort.signal });
2131
+ Number.isFinite(this.video.duration) && this.video.duration > 0 ? f() : this.video.addEventListener("loadedmetadata", f, { once: !0, signal: this.abort.signal });
2127
2132
  };
2128
2133
  typeof n.chapters == "string" ? yt(n.chapters).then((m) => p(m)).catch((m) => this.emitter.emit("error", { message: "Failed to load chapters track", cause: m })) : p(n.chapters);
2129
2134
  }
2130
- const c = n.heatmap, u = c && !Array.isArray(c), f = u ? c.values.length > 0 : !!(c && c.length > 0);
2131
- if (c && f && this.controlsOptions.heatmap) {
2135
+ const c = n.heatmap, u = c && !Array.isArray(c), v = u ? c.values.length > 0 : !!(c && c.length > 0);
2136
+ if (c && v && this.controlsOptions.heatmap) {
2132
2137
  const p = () => {
2133
2138
  if (s !== this.loadToken) return;
2134
2139
  const m = u ? dt(c.values, c.mode) : ct(c, this.video.duration);