@hadoku/watchparty-ui 0.45.9 → 0.45.11

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.
Files changed (27) hide show
  1. package/dist/chunks/{AdminPanel-BAux2Z40.js → AdminPanel-NqY9bqdB.js} +14 -14
  2. package/dist/chunks/{AdminPanel-BAux2Z40.js.map → AdminPanel-NqY9bqdB.js.map} +1 -1
  3. package/dist/chunks/MediaDrawer-DnJ2bjL7.js +710 -0
  4. package/dist/chunks/MediaDrawer-DnJ2bjL7.js.map +1 -0
  5. package/dist/chunks/{PlaylistPanel-BoleB5vk.js → PlaylistPanel-DKjA4zxR.js} +32 -32
  6. package/dist/chunks/{PlaylistPanel-BoleB5vk.js.map → PlaylistPanel-DKjA4zxR.js.map} +1 -1
  7. package/dist/chunks/{Room-Bnjk24LE.js → Room-H5597D2i.js} +303 -304
  8. package/dist/chunks/Room-H5597D2i.js.map +1 -0
  9. package/dist/chunks/{index-d21ofwW2.js → index-BLeEknCO.js} +3138 -3301
  10. package/dist/chunks/index-BLeEknCO.js.map +1 -0
  11. package/dist/chunks/{submissionsApi-BdWmV6DO.js → submissionsApi-CL9vNf_o.js} +28 -28
  12. package/dist/chunks/{submissionsApi-BdWmV6DO.js.map → submissionsApi-CL9vNf_o.js.map} +1 -1
  13. package/dist/index.js +1 -1
  14. package/dist/room-chrome.js +1003 -1093
  15. package/dist/room-chrome.js.map +1 -1
  16. package/dist/watchparty-ui.css +1 -1
  17. package/package.json +3 -3
  18. package/dist/chunks/GameModule-CPrQCsQN.js +0 -1512
  19. package/dist/chunks/GameModule-CPrQCsQN.js.map +0 -1
  20. package/dist/chunks/MapEditor-DfGyp-bV.js +0 -733
  21. package/dist/chunks/MapEditor-DfGyp-bV.js.map +0 -1
  22. package/dist/chunks/MediaDrawer-Dx5XhHiF.js +0 -711
  23. package/dist/chunks/MediaDrawer-Dx5XhHiF.js.map +0 -1
  24. package/dist/chunks/Room-Bnjk24LE.js.map +0 -1
  25. package/dist/chunks/cover-AUIrlUMF.js +0 -5
  26. package/dist/chunks/cover-AUIrlUMF.js.map +0 -1
  27. package/dist/chunks/index-d21ofwW2.js.map +0 -1
@@ -1,14 +1,14 @@
1
1
  import { jsx as d, jsxs as A, Fragment as Se } from "react/jsx-runtime";
2
- import et, { useState as $, useRef as P, useEffect as L, useCallback as U, useMemo as Ce, Component as Gr, useContext as Wr, createContext as Kr, useId as Vr, useEffectEvent as fe } from "react";
3
- import { k as zr, M as Jr, m as Qr, f as qr, a as Yr, b as dt, c as Jt, i as Xr, S as Zr, r as bt, d as E, e as ee, h as x, j as Ke, A as Qt, D as it, w as C, l as es, n as ts, o as Dn, p as On, q as Hn, t as ns, L as rs, v as ss, x as as, y as vt, z as is, B as os, E as cs, F as ls, G as Un, H as qt, I as jn, J as Gn, K as ds, N as us, O as Yt, s as Xt, P as Ie, Q as hn, T as At, R as fs, U as Wn, V as hs, W as ps, X as Kn, Y, g as ms, Z as Vn, _ as zn, $ as Xe, a0 as gs, a1 as bs, a2 as ys, a3 as vs, a4 as Ss, a5 as pn, a6 as ze, a7 as ws, a8 as mn, a9 as xs, aa as Es, ab as gn, ac as Ms, ad as ks, ae as _s, af as As, ag as Ts, ah as bn, ai as yn, aj as Is, ak as Jn, al as vn, am as Cs, an as pt, ao as Fs, ap as Rs, aq as Ns, ar as Ls, as as $s, at as Ps, au as Bs, av as Ds, aw as Os, ax as Hs } from "./index-d21ofwW2.js";
4
- import { createPortal as St } from "react-dom";
2
+ import lt, { useState as $, useRef as P, useEffect as L, useCallback as U, useMemo as Ce, Component as Gr, useContext as Wr, createContext as Kr, useId as Vr, useEffectEvent as fe } from "react";
3
+ import { k as zr, M as Jr, m as Qr, f as qr, a as Yr, C as dt, g as Vt, i as Xr, S as Zr, r as bt, d as E, e as ee, u as x, c as Ke, A as zt, D as at, w as C, b as es, h as ts, s as Bn, j as Dn, l as On, n as ns, L as rs, o as ss, p as as, q as Jt, t as is, v as os, x as cs, y as ls, z as Hn, B as Qt, E as Un, F as jn, G as ds, H as us, I as qt, J as Yt, K as Ie, N as fn, T as _t, O as fs, P as Gn, Q as hs, R as ps, U as Wn, V as Y, W as ms, X as Kn, Y as Vn, Z as Xe, _ as gs, $ as bs, a0 as ys, a1 as vs, a2 as Ss, a3 as hn, a4 as ze, a5 as ws, a6 as pn, a7 as xs, a8 as Es, a9 as mn, aa as Ms, ab as ks, ac as _s, ad as As, ae as Ts, af as gn, ag as bn, ah as Is, ai as zn, aj as yn, ak as Cs, al as pt, am as Fs, an as Rs, ao as Ns, ap as Ls, aq as $s, ar as Ps, as as Bs, at as Ds, au as Os, av as Hs } from "./index-BLeEknCO.js";
4
+ import { createPortal as vt } from "react-dom";
5
5
  import { Icon as ut, THEMES as Us, useHadokuThemeOptional as js } from "@wolffm/themes";
6
6
  import { HadokuThemePicker as Gs, ConnectedSettings as Ws } from "@wolffm/task-ui-components";
7
7
  import { createRoot as Ks } from "react-dom/client";
8
8
  function Vs(t) {
9
9
  return t.kind === "file";
10
10
  }
11
- class Qn extends Error {
11
+ class Jn extends Error {
12
12
  constructor(e) {
13
13
  super(e), this.name = "ChatImageUploadError";
14
14
  }
@@ -34,7 +34,7 @@ function gt(t) {
34
34
  }
35
35
  }
36
36
  function zs(t) {
37
- return t instanceof dt ? gt(t.reason) : t instanceof Qn ? t.message : "Image upload failed";
37
+ return t instanceof dt ? gt(t.reason) : t instanceof Jn ? t.message : "Image upload failed";
38
38
  }
39
39
  function Js(t) {
40
40
  const e = t.type.toLowerCase().split(";")[0].trim();
@@ -51,9 +51,9 @@ async function Ys(t) {
51
51
  return { w: e?.width ?? 0, h: e?.height ?? 0 };
52
52
  }
53
53
  async function Xs(t, e = {}) {
54
- const n = await Jt().upload(t, { signal: e.signal });
54
+ const n = await Vt().upload(t, { signal: e.signal });
55
55
  if (!Xr(n.key))
56
- throw new Qn("Image upload returned an unusable key");
56
+ throw new Jn("Image upload returned an unusable key");
57
57
  return { key: n.key, deduplicated: n.deduplicated === !0 };
58
58
  }
59
59
  async function Zs(t, e = {}) {
@@ -127,19 +127,19 @@ function na(t, e, n, r = {}) {
127
127
  }, [p, u]);
128
128
  return { items: o, loading: p, error: m, hasMore: u !== null, loadMore: R };
129
129
  }
130
- const jt = 240, je = 8, ra = 28, qn = 240;
130
+ const Ut = 240, je = 8, ra = 28, Qn = 240;
131
131
  function sa(t, e, n) {
132
- let r = e.left - jt - je;
133
- r < je && (r = e.right + je), r = Math.min(r, n.width - jt - je), r = Math.max(je, r);
134
- const s = qn + ra;
132
+ let r = e.left - Ut - je;
133
+ r < je && (r = e.right + je), r = Math.min(r, n.width - Ut - je), r = Math.max(je, r);
134
+ const s = Qn + ra;
135
135
  let i = t.top + t.height / 2 - s / 2;
136
136
  return i = Math.min(i, n.height - s - je), i = Math.max(je, i), { left: r, top: i };
137
137
  }
138
- const Yn = "/dataplatform/api/memes", aa = 120;
138
+ const qn = "/dataplatform/api/memes", aa = 120;
139
139
  function ia({ onClose: t, onPick: e, onUnavailable: n }) {
140
- const [r, s] = $(""), i = P(null), a = P(null), l = Jt(), { items: o, loading: c, error: u, hasMore: f, loadMore: p } = na(
140
+ const [r, s] = $(""), i = P(null), a = P(null), l = Vt(), { items: o, loading: c, error: u, hasMore: f, loadMore: p } = na(
141
141
  l,
142
- Yn,
142
+ qn,
143
143
  r.trim()
144
144
  ), v = u?.reason ?? null, m = Ce(() => {
145
145
  const b = /* @__PURE__ */ new Set();
@@ -271,7 +271,7 @@ function ia({ onClose: t, onPick: e, onUnavailable: n }) {
271
271
  style: {
272
272
  left: h.left,
273
273
  top: h.top,
274
- width: jt,
274
+ width: Ut,
275
275
  /* The placement maths reserves exactly PREVIEW_PX of width.
276
276
  Without border-box the padding and border sit OUTSIDE that
277
277
  number and the box laps over the panel it is meant to sit
@@ -288,7 +288,7 @@ function ia({ onClose: t, onPick: e, onUnavailable: n }) {
288
288
  src: bt(h.item.key) ?? void 0,
289
289
  alt: "",
290
290
  className: "block w-full rounded bg-bg object-contain",
291
- style: { height: "auto", maxHeight: qn }
291
+ style: { height: "auto", maxHeight: Qn }
292
292
  }
293
293
  ),
294
294
  h.item.title && /* One line. A long title must not change the box height, because
@@ -301,7 +301,7 @@ function ia({ onClose: t, onPick: e, onUnavailable: n }) {
301
301
  }
302
302
  );
303
303
  }
304
- function Xn({ open: t, ...e }) {
304
+ function Yn({ open: t, ...e }) {
305
305
  return t ? /* @__PURE__ */ d(ia, { ...e }) : null;
306
306
  }
307
307
  function oa(t) {
@@ -313,11 +313,11 @@ function ca(t) {
313
313
  const e = t;
314
314
  return typeof e.unmount == "function" && typeof e.update == "function" && (e.mountSettings === void 0 || typeof e.mountSettings == "function");
315
315
  }
316
- const Gt = "watchparty:open-media-drawer";
317
- function Zn(t) {
318
- E("navigation", `Select Media clicked (${t})`), window.dispatchEvent(new CustomEvent(Gt));
316
+ const jt = "watchparty:open-media-drawer";
317
+ function Xn(t) {
318
+ E("navigation", `Select Media clicked (${t})`), window.dispatchEvent(new CustomEvent(jt));
319
319
  }
320
- class Wt extends Gr {
320
+ class Zn extends Gr {
321
321
  state = { hasError: !1 };
322
322
  static getDerivedStateFromError() {
323
323
  return { hasError: !0 };
@@ -339,7 +339,7 @@ class Wt extends Gr {
339
339
  ] }) : this.props.children;
340
340
  }
341
341
  }
342
- function wt() {
342
+ function St() {
343
343
  const [t, e] = $(
344
344
  () => typeof document < "u" && !!document.fullscreenElement
345
345
  );
@@ -348,11 +348,11 @@ function wt() {
348
348
  return n(), document.addEventListener("fullscreenchange", n), () => document.removeEventListener("fullscreenchange", n);
349
349
  }, []), t;
350
350
  }
351
- function Zt(t) {
351
+ function Xt(t) {
352
352
  return t.hasMedia && (t.chatCollapsed || t.isFullscreen);
353
353
  }
354
- function en(t) {
355
- return t.isLeader ? Zt(t) ? t.gameOverlay && !t.isFullscreen ? "room-corner" : "control-bar" : "chat-toolbar" : "none";
354
+ function Zt(t) {
355
+ return t.isLeader ? Xt(t) ? t.gameOverlay && !t.isFullscreen ? "room-corner" : "control-bar" : "chat-toolbar" : "none";
356
356
  }
357
357
  function er(t) {
358
358
  return t.hasMedia ? t.gameOverlay && !t.isFullscreen ? "room-corner" : "control-bar" : "none";
@@ -378,7 +378,7 @@ function fa({ src: t, title: e, onClose: n }) {
378
378
  return document.addEventListener("keydown", i, !0), () => document.removeEventListener("keydown", i, !0);
379
379
  }, [n]);
380
380
  const r = ua(), s = typeof document > "u" ? null : document.fullscreenElement ?? r ?? document.body;
381
- return s ? St(
381
+ return s ? vt(
382
382
  /* @__PURE__ */ A(
383
383
  "div",
384
384
  {
@@ -416,11 +416,11 @@ function fa({ src: t, title: e, onClose: n }) {
416
416
  s
417
417
  ) : null;
418
418
  }
419
- const Tt = 240, ha = 320;
419
+ const At = 240, ha = 320;
420
420
  function pa({ image: t }) {
421
421
  const [e, n] = $(!1), r = bt(t.key);
422
422
  if (!r) return null;
423
- const s = t.w > 0 && t.h > 0, i = s ? Math.min(1, ha / t.w, Tt / t.h) : 1;
423
+ const s = t.w > 0 && t.h > 0, i = s ? Math.min(1, ha / t.w, At / t.h) : 1;
424
424
  return /* @__PURE__ */ A(Se, { children: [
425
425
  /* @__PURE__ */ d(
426
426
  "a",
@@ -443,7 +443,7 @@ function pa({ image: t }) {
443
443
  width: s ? Math.round(t.w * i) : void 0,
444
444
  height: s ? Math.round(t.h * i) : void 0,
445
445
  className: "rounded border border-border-light object-contain bg-bg-alt/30",
446
- style: s ? { aspectRatio: `${t.w} / ${t.h}`, maxWidth: "100%", maxHeight: Tt } : { maxWidth: "100%", maxHeight: Tt }
446
+ style: s ? { aspectRatio: `${t.w} / ${t.h}`, maxWidth: "100%", maxHeight: At } : { maxWidth: "100%", maxHeight: At }
447
447
  }
448
448
  )
449
449
  }
@@ -464,28 +464,28 @@ function nr({ images: t }) {
464
464
  function ma(t, e) {
465
465
  return t.author && e.author ? t.author === e.author : !!e.clientId && t.clientId === e.clientId;
466
466
  }
467
- function It(t) {
467
+ function Tt(t) {
468
468
  return new Date(t).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
469
469
  }
470
- const ga = et.memo(function({ message: e }) {
470
+ const ga = lt.memo(function({ message: e }) {
471
471
  const n = x((l) => l.me.clientId), r = x((l) => l.me.clientId ? l.roster[l.me.clientId]?.author : void 0), s = ma(e, { clientId: n, author: r }), i = x((l) => tr(l.roster, e.author));
472
472
  if (e.isSystem && e.systemType === "recap")
473
473
  return /* @__PURE__ */ d("div", { className: "px-2 py-1.5", children: /* @__PURE__ */ A("div", { className: "border-l-2 border-border-light pl-2.5 py-0.5", children: [
474
474
  /* @__PURE__ */ A("div", { className: "text-[10px] uppercase tracking-wide text-text-muted mb-0.5", children: [
475
475
  "Recap",
476
- /* @__PURE__ */ d("span", { className: "ml-1.5 normal-case tracking-normal opacity-60", children: It(e.ts) })
476
+ /* @__PURE__ */ d("span", { className: "ml-1.5 normal-case tracking-normal opacity-60", children: Tt(e.ts) })
477
477
  ] }),
478
478
  /* @__PURE__ */ d("p", { className: "text-[13px] text-text-secondary leading-relaxed whitespace-pre-wrap break-words", children: e.text })
479
479
  ] }) });
480
480
  if (e.isSystem)
481
481
  return /* @__PURE__ */ A("div", { className: "px-2 py-0.5 text-[11px] text-text-muted italic text-center leading-tight", children: [
482
482
  e.text,
483
- /* @__PURE__ */ d("span", { className: "ml-1 text-[10px] opacity-50", children: It(e.ts) })
483
+ /* @__PURE__ */ d("span", { className: "ml-1 text-[10px] opacity-50", children: Tt(e.ts) })
484
484
  ] });
485
485
  const a = Ke(e.sprite);
486
486
  return /* @__PURE__ */ A("div", { className: `flex items-start gap-2 px-2 py-1 hover:bg-bg-card/20 ${s ? "bg-bg-card/30" : ""}`, children: [
487
487
  /* @__PURE__ */ d(
488
- Qt,
488
+ zt,
489
489
  {
490
490
  sprite: e.sprite,
491
491
  url: i,
@@ -496,7 +496,7 @@ const ga = et.memo(function({ message: e }) {
496
496
  ),
497
497
  /* @__PURE__ */ A("div", { className: "flex-1 min-w-0 -mt-0.5", children: [
498
498
  /* @__PURE__ */ d("span", { className: "font-medium text-[13px]", style: { color: a }, children: e.name }),
499
- /* @__PURE__ */ d("span", { className: "text-[10px] text-text-muted opacity-60 ml-1.5", children: It(e.ts) }),
499
+ /* @__PURE__ */ d("span", { className: "text-[10px] text-text-muted opacity-60 ml-1.5", children: Tt(e.ts) }),
500
500
  e.text && /* @__PURE__ */ d("p", { className: "text-[13px] text-text break-words leading-snug m-0", children: e.text }),
501
501
  /* @__PURE__ */ d(nr, { images: e.images })
502
502
  ] })
@@ -520,7 +520,7 @@ function ba() {
520
520
  className: "flex-1 overflow-y-auto overflow-x-hidden chat-messages",
521
521
  children: t.length === 0 ? /* @__PURE__ */ d("div", { className: "p-4 text-xs text-text-muted text-center", children: "No messages yet. Be the first to say something!" }) : /* @__PURE__ */ d(Se, { children: t.map((s, i) => {
522
522
  const a = i > 0 ? t[i - 1] : null, l = a && s.ts - a.ts > 1440 * 60 * 1e3;
523
- return /* @__PURE__ */ A(et.Fragment, { children: [
523
+ return /* @__PURE__ */ A(lt.Fragment, { children: [
524
524
  l && /* @__PURE__ */ A("div", { className: "flex items-center gap-2 px-4 py-2 my-1", children: [
525
525
  /* @__PURE__ */ d("div", { className: "flex-1 h-px bg-border" }),
526
526
  /* @__PURE__ */ d("span", { className: "text-[10px] text-text-muted whitespace-nowrap", children: new Date(s.ts).toLocaleDateString([], { weekday: "short", month: "short", day: "numeric" }) }),
@@ -532,7 +532,7 @@ function ba() {
532
532
  }
533
533
  );
534
534
  }
535
- const tn = [
535
+ const en = [
536
536
  {
537
537
  name: "recap",
538
538
  description: "Summarise the previous episode of what is loaded",
@@ -552,13 +552,13 @@ const tn = [
552
552
  usage: "/help",
553
553
  scope: "local"
554
554
  }
555
- ], tt = "/";
555
+ ], et = "/";
556
556
  function ya(t) {
557
- if (!t.startsWith(tt)) return null;
558
- const e = t.slice(tt.length);
557
+ if (!t.startsWith(et)) return null;
558
+ const e = t.slice(et.length);
559
559
  return /\s/.test(e) ? null : e.toLowerCase();
560
560
  }
561
- function va(t, e = tn) {
561
+ function va(t, e = en) {
562
562
  const n = t.toLowerCase();
563
563
  if (!n) return [...e].sort((s, i) => s.name.localeCompare(i.name));
564
564
  const r = [];
@@ -569,20 +569,20 @@ function va(t, e = tn) {
569
569
  return r.sort((s, i) => s.rank - i.rank || s.cmd.name.localeCompare(i.cmd.name)).map((s) => s.cmd);
570
570
  }
571
571
  function Sa(t) {
572
- return `${tt}${t.name} `;
572
+ return `${et}${t.name} `;
573
573
  }
574
- function Ct(t, e) {
574
+ function It(t, e) {
575
575
  return e <= 0 ? 0 : (t % e + e) % e;
576
576
  }
577
- function wa(t, e = tn) {
577
+ function wa(t, e = en) {
578
578
  const n = t.trim();
579
579
  if (!n) return null;
580
- if (!n.startsWith(tt)) return { kind: "chat", text: n };
581
- const r = n.slice(tt.length), s = r.search(/\s/), i = (s === -1 ? r : r.slice(0, s)).toLowerCase(), a = s === -1 ? "" : r.slice(s).trim(), l = e.find((o) => o.name.toLowerCase() === i);
580
+ if (!n.startsWith(et)) return { kind: "chat", text: n };
581
+ const r = n.slice(et.length), s = r.search(/\s/), i = (s === -1 ? r : r.slice(0, s)).toLowerCase(), a = s === -1 ? "" : r.slice(s).trim(), l = e.find((o) => o.name.toLowerCase() === i);
582
582
  return l ? { kind: "command", command: l, args: a } : { kind: "chat", text: n };
583
583
  }
584
584
  function xa(t, e) {
585
- return t.requiresMedia && !e.hasMedia ? `${tt}${t.name} needs an episode loaded.` : null;
585
+ return t.requiresMedia && !e.hasMedia ? `${et}${t.name} needs an episode loaded.` : null;
586
586
  }
587
587
  function Ea({
588
588
  commands: t,
@@ -681,21 +681,21 @@ function sr() {
681
681
  });
682
682
  }
683
683
  y.length && e((w) => {
684
- const _ = it - w.length;
684
+ const _ = at - w.length;
685
685
  if (_ <= 0) {
686
- s("info", `Up to ${it} images per message`);
686
+ s("info", `Up to ${at} images per message`);
687
687
  for (const R of y) a(R);
688
688
  return w;
689
689
  }
690
690
  if (y.length > _) {
691
- s("info", `Up to ${it} images per message`);
691
+ s("info", `Up to ${at} images per message`);
692
692
  for (const R of y.slice(_)) a(R);
693
693
  }
694
694
  return [...w, ...y.slice(0, _)];
695
695
  });
696
696
  }, [s, a]), o = U((h) => {
697
697
  const y = bt(h.key);
698
- y && (e((w) => w.length >= it ? (s("info", `Up to ${it} images per message`), w) : [...w, {
698
+ y && (e((w) => w.length >= at ? (s("info", `Up to ${at} images per message`), w) : [...w, {
699
699
  kind: "remote",
700
700
  id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
701
701
  key: h.key,
@@ -705,7 +705,7 @@ function sr() {
705
705
  w: h.width ?? 0,
706
706
  h: h.height ?? 0,
707
707
  title: h.title || void 0
708
- }]), Jt().catalogue(Yn).recordUse(h.key));
708
+ }]), Vt().catalogue(qn).recordUse(h.key));
709
709
  }, [s]), c = U((h) => {
710
710
  e((y) => {
711
711
  const w = y.find((_) => _.id === h);
@@ -748,12 +748,12 @@ function sr() {
748
748
  onDragOver: v
749
749
  };
750
750
  }
751
- const Sn = Hn, Ma = On;
752
- function ka({ commands: t = tn }) {
751
+ const vn = On, Ma = Dn;
752
+ function ka({ commands: t = en }) {
753
753
  const [e, n] = $(""), [r, s] = $(!1), [i, a] = $({ q: null, i: 0 }), [l, o] = $(!1), c = P(null), u = Vr(), [f, p] = $(!1), [v, m] = $(!1), h = sr(), y = x((N) => N.snapshot.mediaId), w = x((N) => N.pushToast), _ = x((N) => N.setTierlistOpen), R = !!y, k = ya(e), g = Ce(
754
754
  () => k === null ? [] : va(k, t),
755
755
  [k, t]
756
- ), T = k !== null && !l && g.length > 0, F = i.q === k ? Ct(i.i, g.length) : 0, b = U(
756
+ ), T = k !== null && !l && g.length > 0, F = i.q === k ? It(i.i, g.length) : 0, b = U(
757
757
  (N) => a({ q: k, i: N }),
758
758
  [k]
759
759
  ), S = U((N, O) => {
@@ -790,7 +790,7 @@ function ka({ commands: t = tn }) {
790
790
  return;
791
791
  }
792
792
  const Q = await h.uploadPending();
793
- Q !== null && (Dn(O?.text ?? "", Q), n(""), h.clear(), s(!0), setTimeout(() => s(!1), Ma), !document.hidden && document.hasFocus() && c.current?.focus());
793
+ Q !== null && (Bn(O?.text ?? "", Q), n(""), h.clear(), s(!0), setTimeout(() => s(!1), Ma), !document.hidden && document.hasFocus() && c.current?.focus());
794
794
  }, [e, r, S, h, w, t]), H = U((N) => {
795
795
  if (N.key === "Escape" && T) {
796
796
  N.preventDefault(), o(!0);
@@ -798,9 +798,9 @@ function ka({ commands: t = tn }) {
798
798
  }
799
799
  if (T) {
800
800
  if (N.key === "ArrowDown")
801
- N.preventDefault(), b(Ct(F + 1, g.length));
801
+ N.preventDefault(), b(It(F + 1, g.length));
802
802
  else if (N.key === "ArrowUp")
803
- N.preventDefault(), b(Ct(F - 1, g.length));
803
+ N.preventDefault(), b(It(F - 1, g.length));
804
804
  else if (N.key === "Tab") {
805
805
  N.preventDefault();
806
806
  const O = g[F];
@@ -818,7 +818,7 @@ function ka({ commands: t = tn }) {
818
818
  };
819
819
  return window.addEventListener("watchparty:focus-chat-input", N), () => window.removeEventListener("watchparty:focus-chat-input", N);
820
820
  }, []);
821
- const j = Sn - e.length, V = j <= 100, X = T ? g[F] : void 0;
821
+ const j = vn - e.length, V = j <= 100, X = T ? g[F] : void 0;
822
822
  return /* @__PURE__ */ A(
823
823
  "form",
824
824
  {
@@ -844,7 +844,7 @@ function ka({ commands: t = tn }) {
844
844
  }
845
845
  ),
846
846
  /* @__PURE__ */ d(
847
- Xn,
847
+ Yn,
848
848
  {
849
849
  open: f,
850
850
  onClose: () => p(!1),
@@ -866,7 +866,7 @@ function ka({ commands: t = tn }) {
866
866
  n(N.target.value), o(!1);
867
867
  },
868
868
  onKeyDown: H,
869
- maxLength: Sn,
869
+ maxLength: vn,
870
870
  placeholder: "Send a message",
871
871
  role: "combobox",
872
872
  "aria-expanded": T,
@@ -903,7 +903,7 @@ function _a() {
903
903
  const r = Ke(n.sprite);
904
904
  return /* @__PURE__ */ A("div", { className: "flex items-center gap-2 py-0.5", children: [
905
905
  /* @__PURE__ */ d(
906
- Qt,
906
+ zt,
907
907
  {
908
908
  sprite: n.sprite,
909
909
  url: n.avatarUrl,
@@ -969,14 +969,14 @@ function Ra(t) {
969
969
  function Na(t, e) {
970
970
  return t && e?.roomKey === t ? e.type : Ca(t);
971
971
  }
972
- function nt() {
972
+ function tt() {
973
973
  return x((t) => !!t.snapshot.leaderId && t.snapshot.leaderId === t.me.clientId);
974
974
  }
975
- function xt() {
975
+ function wt() {
976
976
  const t = x((n) => n.activeGameId), e = ns();
977
977
  return t ? e.find((n) => n.id === t) ?? null : null;
978
978
  }
979
- function nn() {
979
+ function tn() {
980
980
  return x((t) => Ta({
981
981
  leaderId: t.snapshot.leaderId,
982
982
  clientId: t.me.clientId,
@@ -1006,10 +1006,10 @@ function Pa({ draw: t }) {
1006
1006
  return t(n) ?? void 0;
1007
1007
  }, [t]), /* @__PURE__ */ d("div", { ref: e, "data-testid": "game-settings" });
1008
1008
  }
1009
- const Ba = vt(() => import("./AdminPanel-BAux2Z40.js")), Da = vt(() => import("./PlaylistPanel-BoleB5vk.js"));
1009
+ const Ba = Jt(() => import("./AdminPanel-NqY9bqdB.js")), Da = Jt(() => import("./PlaylistPanel-DKjA4zxR.js"));
1010
1010
  function Oa() {
1011
- const t = x((p) => p.chatCollapsed), e = wt(), n = x((p) => p.sidebarTab), r = x((p) => p.setSidebarTab), s = x((p) => p.healthSnapshot?.clients.length ?? 0), i = x((p) => !!p.playlist), a = nt(), l = nn(), o = x((p) => p.gameSettings), c = x((p) => p.snapshot.mediaId), u = xt() !== null;
1012
- if (Zt({ hasMedia: !!c, chatCollapsed: t, isFullscreen: e }))
1011
+ const t = x((p) => p.chatCollapsed), e = St(), n = x((p) => p.sidebarTab), r = x((p) => p.setSidebarTab), s = x((p) => p.healthSnapshot?.clients.length ?? 0), i = x((p) => !!p.playlist), a = tt(), l = tn(), o = x((p) => p.gameSettings), c = x((p) => p.snapshot.mediaId), u = wt() !== null;
1012
+ if (Xt({ hasMedia: !!c, chatCollapsed: t, isFullscreen: e }))
1013
1013
  return null;
1014
1014
  const f = n === "health" && !a || n === "playlist" && !i ? "chat" : n;
1015
1015
  return /* @__PURE__ */ A("aside", { className: "w-80 self-stretch border-l border-border flex flex-col bg-bg relative z-10", children: [
@@ -1027,10 +1027,10 @@ function Oa() {
1027
1027
  children: /* @__PURE__ */ d("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ d("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" }) })
1028
1028
  }
1029
1029
  ),
1030
- en({ isLeader: l, hasMedia: !!c, chatCollapsed: t, isFullscreen: e, gameOverlay: u }) === "chat-toolbar" && /* @__PURE__ */ d(
1030
+ Zt({ isLeader: l, hasMedia: !!c, chatCollapsed: t, isFullscreen: e, gameOverlay: u }) === "chat-toolbar" && /* @__PURE__ */ d(
1031
1031
  "button",
1032
1032
  {
1033
- onClick: () => Zn("chat toolbar"),
1033
+ onClick: () => Xn("chat toolbar"),
1034
1034
  className: "p-1.5 rounded text-text-secondary hover:text-white hover:bg-bg-alt transition-colors cursor-pointer",
1035
1035
  title: "Select Media",
1036
1036
  "aria-label": "Select Media",
@@ -1072,15 +1072,15 @@ function Oa() {
1072
1072
  }
1073
1073
  )
1074
1074
  ] }),
1075
- f === "health" ? /* @__PURE__ */ d(et.Suspense, { fallback: /* @__PURE__ */ d("div", { className: "p-4 text-xs text-text-muted", children: "Loading..." }), children: /* @__PURE__ */ d(Ba, {}) }) : f === "playlist" ? /* @__PURE__ */ d(et.Suspense, { fallback: /* @__PURE__ */ d("div", { className: "p-4 text-xs text-text-muted", children: "Loading..." }), children: /* @__PURE__ */ d(Da, {}) }) : /* @__PURE__ */ A(Se, { children: [
1075
+ f === "health" ? /* @__PURE__ */ d(lt.Suspense, { fallback: /* @__PURE__ */ d("div", { className: "p-4 text-xs text-text-muted", children: "Loading..." }), children: /* @__PURE__ */ d(Ba, {}) }) : f === "playlist" ? /* @__PURE__ */ d(lt.Suspense, { fallback: /* @__PURE__ */ d("div", { className: "p-4 text-xs text-text-muted", children: "Loading..." }), children: /* @__PURE__ */ d(Da, {}) }) : /* @__PURE__ */ A(Se, { children: [
1076
1076
  /* @__PURE__ */ d(ba, {}),
1077
1077
  /* @__PURE__ */ d(ka, {})
1078
1078
  ] })
1079
1079
  ] });
1080
1080
  }
1081
- const wn = (t) => typeof t == "string" && Us.includes(t);
1081
+ const Sn = (t) => typeof t == "string" && Us.includes(t);
1082
1082
  function Ha(t, e, n) {
1083
- return wn(e) ? e : wn(n) ? n : "dark";
1083
+ return Sn(e) ? e : Sn(n) ? n : "dark";
1084
1084
  }
1085
1085
  function Ua(t, e) {
1086
1086
  if (!is(t)) return null;
@@ -1178,7 +1178,7 @@ function Ga(t) {
1178
1178
  }
1179
1179
  };
1180
1180
  }
1181
- function xn({ activity: t, roomKey: e, layer: n }) {
1181
+ function wn({ activity: t, roomKey: e, layer: n }) {
1182
1182
  const r = P(null), s = P(null), [i, a] = $(null), [l, o] = $(!1), c = x((k) => k.snapshot.leaderId), u = x((k) => k.me.clientId), f = !!c && c === u, p = x((k) => k.name), v = js()?.theme, m = Ha(void 0, v, os().theme), h = Ce(() => ({
1183
1183
  roomKey: e,
1184
1184
  identity: {
@@ -1190,7 +1190,7 @@ function xn({ activity: t, roomKey: e, layer: n }) {
1190
1190
  theme: m,
1191
1191
  isLeader: f,
1192
1192
  close: () => {
1193
- E("game", "bundle close", { gameId: t.id, isLeader: f, layer: n }), n !== "base" && (f ? Un(null) : o(!0));
1193
+ E("game", "bundle close", { gameId: t.id, isLeader: f, layer: n }), n !== "base" && (f ? Hn(null) : o(!0));
1194
1194
  }
1195
1195
  }), [e, p, m, f, t.id, n]), y = fe(() => h), w = fe((k, g) => {
1196
1196
  C("game", "bundle failed", { gameId: t.id, message: k, cause: String(g) }), a(k);
@@ -1266,16 +1266,16 @@ function Ka({ open: t, onClose: e, header: n, footer: r, children: s }) {
1266
1266
  function Va({ open: t, onClose: e }) {
1267
1267
  return /* @__PURE__ */ d(Ka, { open: t, onClose: e, children: /* @__PURE__ */ d("div", { className: "px-4 py-3 text-xs text-text-muted", children: "Loading…" }) });
1268
1268
  }
1269
- const or = 9e3, En = 1500, za = {
1269
+ const or = 9e3, xn = 1500, za = {
1270
1270
  classic: "[text-shadow:_-1px_-1px_0_#000,_1px_-1px_0_#000,_-1px_1px_0_#000,_1px_1px_0_#000,_0_-1px_0_#000,_0_1px_0_#000,_-1px_0_0_#000,_1px_0_0_#000]",
1271
1271
  cinema: "drop-shadow-[0_2px_4px_rgba(0,0,0,0.9)]",
1272
1272
  minimal: "drop-shadow-[0_2px_4px_rgba(0,0,0,0.9)] drop-shadow-[0_0_8px_rgba(0,0,0,0.7)]",
1273
1273
  contrast: "bg-black/70 px-2 py-0.5 rounded"
1274
1274
  };
1275
1275
  function Ja({ message: t, age: e, ccStyle: n }) {
1276
- const r = or - En;
1276
+ const r = or - xn;
1277
1277
  let s = 1;
1278
- e > r && (s = Math.max(0, 1 - (e - r) / En));
1278
+ e > r && (s = Math.max(0, 1 - (e - r) / xn));
1279
1279
  const i = za[n], a = Ke(t.sprite), l = x((o) => tr(o.roster, t.author));
1280
1280
  return /* @__PURE__ */ A(
1281
1281
  "div",
@@ -1284,7 +1284,7 @@ function Ja({ message: t, age: e, ccStyle: n }) {
1284
1284
  style: { opacity: s, transition: "opacity 0.15s ease-out" },
1285
1285
  children: [
1286
1286
  /* @__PURE__ */ d(
1287
- Qt,
1287
+ zt,
1288
1288
  {
1289
1289
  sprite: t.sprite,
1290
1290
  url: l,
@@ -1339,16 +1339,16 @@ function Qa() {
1339
1339
  }
1340
1340
  const qa = 2;
1341
1341
  function cr(t) {
1342
- return t.duration_ms > 0 && t.duration_ms - t.playhead_ms <= qt;
1342
+ return t.duration_ms > 0 && t.duration_ms - t.playhead_ms <= Qt;
1343
1343
  }
1344
1344
  function lr(t) {
1345
1345
  const e = t.video_ready_state ?? -1;
1346
- return e < 0 ? !0 : !(e <= qa && t.buffered_ahead_ms > qt);
1346
+ return e < 0 ? !0 : !(e <= qa && t.buffered_ahead_ms > Qt);
1347
1347
  }
1348
- function fc(t) {
1349
- return t.playhead_ms === 0 && !t.is_buffering && t.buffered_ahead_ms === 0 ? "idle" : t.is_buffering ? "buffering" : cr(t) ? "healthy" : !lr(t) || t.buffered_ahead_ms <= jn ? "critical" : t.buffered_ahead_ms <= qt ? "warning" : "healthy";
1348
+ function uc(t) {
1349
+ return t.playhead_ms === 0 && !t.is_buffering && t.buffered_ahead_ms === 0 ? "idle" : t.is_buffering ? "buffering" : cr(t) ? "healthy" : !lr(t) || t.buffered_ahead_ms <= Un ? "critical" : t.buffered_ahead_ms <= Qt ? "warning" : "healthy";
1350
1350
  }
1351
- const hc = {
1351
+ const fc = {
1352
1352
  idle: "Idle",
1353
1353
  buffering: "Buffering",
1354
1354
  critical: "Critical",
@@ -1379,7 +1379,7 @@ function We(t, e, n = 0.15, r = 0) {
1379
1379
  const i = s.currentTime + r, a = s.createOscillator(), l = s.createGain();
1380
1380
  a.type = "sine", a.frequency.value = t, fr(l, i, n, e / 1e3), a.connect(l).connect(s.destination), a.start(i), a.stop(i + e / 1e3 + 0.05);
1381
1381
  }
1382
- function Ft(t, e, n, r, s = 0.15, i = 0) {
1382
+ function Ct(t, e, n, r, s = 0.15, i = 0) {
1383
1383
  const a = dr();
1384
1384
  if (!a) return;
1385
1385
  ur(a);
@@ -1396,25 +1396,25 @@ function mr() {
1396
1396
  We(659, 45, 0.06, 0), We(494, 70, 0.06, 0.045);
1397
1397
  }
1398
1398
  function gr() {
1399
- Ft(587, 1174, 3, 320, 0.12, 0), Ft(880, 1760, 3, 320, 0.12, 0.06), Ft(884, 1768, 3, 320, 0.08, 0.06);
1399
+ Ct(587, 1174, 3, 320, 0.12, 0), Ct(880, 1760, 3, 320, 0.12, 0.06), Ct(884, 1768, 3, 320, 0.08, 0.06);
1400
1400
  }
1401
- Gn("__WP_SOUNDS__", {
1401
+ jn("__WP_SOUNDS__", {
1402
1402
  start: hr,
1403
1403
  finish: gr,
1404
1404
  on: pr,
1405
1405
  off: mr
1406
1406
  });
1407
- const Mn = { on: 0, off: 0 };
1407
+ const En = { on: 0, off: 0 };
1408
1408
  function Ya(t, e, n, r) {
1409
- if (!n || !r) return Mn;
1409
+ if (!n || !r) return En;
1410
1410
  const s = new Set(t), i = new Set(e);
1411
1411
  let a = 0;
1412
1412
  for (const o of i) s.has(o) || a++;
1413
1413
  let l = 0;
1414
1414
  for (const o of s) i.has(o) || l++;
1415
- return a === 0 && l === 0 ? Mn : { on: a, off: l };
1415
+ return a === 0 && l === 0 ? En : { on: a, off: l };
1416
1416
  }
1417
- const Xa = 1200, be = 52, yt = 4, Kt = (be - yt) / 2, kn = 2 * Math.PI * Kt, $e = be - yt * 2 - 4;
1417
+ const Xa = 1200, be = 52, yt = 4, Gt = (be - yt) / 2, Mn = 2 * Math.PI * Gt, $e = be - yt * 2 - 4;
1418
1418
  function Za(t) {
1419
1419
  return cr(t) ? !0 : lr(t) ? t.buffered_ahead_ms >= Ie : !1;
1420
1420
  }
@@ -1422,7 +1422,7 @@ function ei(t) {
1422
1422
  return `hsl(${Math.round(t * 120)}, 90%, 55%)`;
1423
1423
  }
1424
1424
  function ti({ client: t, fading: e, onFadeEnd: n }) {
1425
- const r = Math.min(1, t.buffered_ahead_ms / Ie), s = kn * (1 - r), i = ei(r), a = Ke(t.sprite_id);
1425
+ const r = Math.min(1, t.buffered_ahead_ms / Ie), s = Mn * (1 - r), i = ei(r), a = Ke(t.sprite_id);
1426
1426
  return /* @__PURE__ */ A(
1427
1427
  "div",
1428
1428
  {
@@ -1448,7 +1448,7 @@ function ti({ client: t, fading: e, onFadeEnd: n }) {
1448
1448
  {
1449
1449
  cx: be / 2,
1450
1450
  cy: be / 2,
1451
- r: Kt,
1451
+ r: Gt,
1452
1452
  fill: "none",
1453
1453
  stroke: "rgba(255,255,255,0.15)",
1454
1454
  strokeWidth: yt
@@ -1459,12 +1459,12 @@ function ti({ client: t, fading: e, onFadeEnd: n }) {
1459
1459
  {
1460
1460
  cx: be / 2,
1461
1461
  cy: be / 2,
1462
- r: Kt,
1462
+ r: Gt,
1463
1463
  fill: "none",
1464
1464
  stroke: i,
1465
1465
  strokeWidth: yt,
1466
1466
  strokeLinecap: "round",
1467
- strokeDasharray: kn,
1467
+ strokeDasharray: Mn,
1468
1468
  strokeDashoffset: s,
1469
1469
  style: { transition: "stroke-dashoffset 0.4s ease, stroke 0.4s ease" }
1470
1470
  }
@@ -1472,10 +1472,10 @@ function ti({ client: t, fading: e, onFadeEnd: n }) {
1472
1472
  ]
1473
1473
  }
1474
1474
  ),
1475
- Yt(t.sprite_id) ? /* @__PURE__ */ d(
1475
+ qt(t.sprite_id) ? /* @__PURE__ */ d(
1476
1476
  "img",
1477
1477
  {
1478
- src: Xt(t.sprite_id),
1478
+ src: Yt(t.sprite_id),
1479
1479
  alt: t.name,
1480
1480
  crossOrigin: "anonymous",
1481
1481
  className: "rounded-full object-cover flex-shrink-0",
@@ -1525,10 +1525,10 @@ function ni({ clientId: t, sprite: e, name: n, isReady: r, isSelf: s, onToggle:
1525
1525
  style: { pointerEvents: "auto" },
1526
1526
  children: [
1527
1527
  /* @__PURE__ */ A("div", { className: "relative flex items-center justify-center", style: { width: be, height: be }, children: [
1528
- Yt(e) ? /* @__PURE__ */ d(
1528
+ qt(e) ? /* @__PURE__ */ d(
1529
1529
  "img",
1530
1530
  {
1531
- src: Xt(e),
1531
+ src: Yt(e),
1532
1532
  alt: n,
1533
1533
  crossOrigin: "anonymous",
1534
1534
  className: "rounded-full object-cover flex-shrink-0",
@@ -1580,7 +1580,7 @@ function ni({ clientId: t, sprite: e, name: n, isReady: r, isSelf: s, onToggle:
1580
1580
  );
1581
1581
  }
1582
1582
  const ri = { status: null, entries: [], completed: /* @__PURE__ */ new Set(), below: /* @__PURE__ */ new Set() };
1583
- function _n(t, e) {
1583
+ function kn(t, e) {
1584
1584
  if (!e || e.clients.length === 0) return { ...t, status: e, entries: [] };
1585
1585
  const n = new Set(t.completed), r = new Set(t.below), s = [];
1586
1586
  for (const i of e.clients) {
@@ -1590,8 +1590,8 @@ function _n(t, e) {
1590
1590
  return { status: e, entries: s, completed: n, below: r };
1591
1591
  }
1592
1592
  function si() {
1593
- const t = x((g) => g.bufferStatus), e = x((g) => g.readyCheck), n = x((g) => g.roster), r = x((g) => g.me.clientId), s = x((g) => g.snapshot.playing), i = nt(), [a, l] = $(() => _n(ri, t));
1594
- a.status !== t && l(_n(a, t));
1593
+ const t = x((g) => g.bufferStatus), e = x((g) => g.readyCheck), n = x((g) => g.roster), r = x((g) => g.me.clientId), s = x((g) => g.snapshot.playing), i = tt(), [a, l] = $(() => kn(ri, t));
1594
+ a.status !== t && l(kn(a, t));
1595
1595
  const o = a.entries, c = (g) => {
1596
1596
  l((T) => {
1597
1597
  const F = new Set(T.completed), b = new Set(T.below);
@@ -1682,7 +1682,7 @@ function si() {
1682
1682
  )
1683
1683
  ] });
1684
1684
  }
1685
- const Vt = {
1685
+ const Wt = {
1686
1686
  S: "var(--color-tier-s)",
1687
1687
  A: "var(--color-tier-a)",
1688
1688
  B: "var(--color-tier-b)",
@@ -1693,7 +1693,7 @@ const Vt = {
1693
1693
  function br(t) {
1694
1694
  t?.complete && t.naturalWidth > 0 && (t.dataset.loaded = "true");
1695
1695
  }
1696
- function An({
1696
+ function _n({
1697
1697
  entry: t,
1698
1698
  draggable: e,
1699
1699
  picked: n,
@@ -1720,7 +1720,7 @@ function An({
1720
1720
  /* @__PURE__ */ d(
1721
1721
  "img",
1722
1722
  {
1723
- src: Wn(t.id, t.thumbnail),
1723
+ src: Gn(t.id, t.thumbnail),
1724
1724
  alt: "",
1725
1725
  loading: "eager",
1726
1726
  decoding: "async",
@@ -1756,7 +1756,7 @@ function ai({
1756
1756
  f < 8 && (f = t.bottom + 8), i({ left: Math.round(u), top: Math.round(f) });
1757
1757
  }, [t, e]), !a) return null;
1758
1758
  const l = n.items.find((o) => o.id === e)?.displayName ?? e;
1759
- return St(
1759
+ return vt(
1760
1760
  /* @__PURE__ */ A(
1761
1761
  "div",
1762
1762
  {
@@ -1769,10 +1769,10 @@ function ai({
1769
1769
  Object.entries(a.votes).map(([o, c]) => {
1770
1770
  const u = n.sprites[o];
1771
1771
  return /* @__PURE__ */ A("div", { className: "flex items-center gap-2 py-0.5", children: [
1772
- Yt(u) ? /* @__PURE__ */ d(
1772
+ qt(u) ? /* @__PURE__ */ d(
1773
1773
  "img",
1774
1774
  {
1775
- src: Xt(u),
1775
+ src: Yt(u),
1776
1776
  alt: "",
1777
1777
  className: "w-5 h-5 rounded-full shrink-0 object-cover",
1778
1778
  style: { background: Ke(u) }
@@ -1783,7 +1783,7 @@ function ai({
1783
1783
  "span",
1784
1784
  {
1785
1785
  className: "w-5 h-4 grid place-items-center rounded text-[10px] font-bold shrink-0",
1786
- style: { background: Vt[c], color: "var(--color-tier-ink)" },
1786
+ style: { background: Wt[c], color: "var(--color-tier-ink)" },
1787
1787
  children: c
1788
1788
  }
1789
1789
  )
@@ -1798,9 +1798,9 @@ function ai({
1798
1798
  function ii() {
1799
1799
  const t = x((b) => b.tierlistOpen), e = x((b) => b.setTierlistOpen), n = x((b) => b.tierlist), r = x((b) => b.tierlistDraft), s = x((b) => b.tierlistSaving), i = x((b) => b.moveTierlistItem), [a, l] = $(null), [o, c] = $(null), [u, f] = $(null), [p, v] = $(null), [m, h] = $("mine");
1800
1800
  L(() => {
1801
- hn(!0);
1801
+ fn(!0);
1802
1802
  }, []), L(() => {
1803
- t && hn(!0);
1803
+ t && fn(!0);
1804
1804
  }, [t]), L(() => {
1805
1805
  if (!t) return;
1806
1806
  const b = (S) => {
@@ -1810,7 +1810,7 @@ function ii() {
1810
1810
  }, [t, e]);
1811
1811
  const y = Ce(() => new Map((n?.items ?? []).map((b) => [b.id, b])), [n]), w = Ce(() => {
1812
1812
  const b = { S: [], A: [], B: [], C: [], D: [], F: [], [Ge]: [] }, S = /* @__PURE__ */ new Set();
1813
- for (const I of At)
1813
+ for (const I of _t)
1814
1814
  for (const D of r[I] ?? []) {
1815
1815
  const H = y.get(D);
1816
1816
  H && (b[I].push(H), S.add(D));
@@ -1847,7 +1847,7 @@ function ii() {
1847
1847
  return () => clearTimeout(b);
1848
1848
  }, [p]), !t) return null;
1849
1849
  const g = JSON.stringify(r) !== JSON.stringify(n?.myBoard ?? {}), T = Object.values(n?.myBoard ?? {}).some((b) => (b?.length ?? 0) > 0), F = T ? m : "mine";
1850
- return St(
1850
+ return vt(
1851
1851
  /* @__PURE__ */ A(
1852
1852
  "div",
1853
1853
  {
@@ -1886,12 +1886,12 @@ function ii() {
1886
1886
  ] }),
1887
1887
  /* @__PURE__ */ A("div", { className: "flex-1 overflow-y-auto", children: [
1888
1888
  F === "mine" && /* @__PURE__ */ A(Se, { children: [
1889
- At.map((b) => /* @__PURE__ */ A("div", { className: "grid grid-cols-[56px_1fr] border-b border-border/50 min-h-[86px]", children: [
1889
+ _t.map((b) => /* @__PURE__ */ A("div", { className: "grid grid-cols-[56px_1fr] border-b border-border/50 min-h-[86px]", children: [
1890
1890
  /* @__PURE__ */ d(
1891
1891
  "div",
1892
1892
  {
1893
1893
  className: "grid place-items-center select-none cursor-pointer",
1894
- style: { background: Vt[b], color: "var(--color-tier-ink)" },
1894
+ style: { background: Wt[b], color: "var(--color-tier-ink)" },
1895
1895
  onClick: () => {
1896
1896
  a && (i(a, b), l(null));
1897
1897
  },
@@ -1905,7 +1905,7 @@ function ii() {
1905
1905
  ...R(b),
1906
1906
  className: `flex items-center gap-2 p-2 overflow-x-auto transition-colors ${o === b ? "bg-primary/15 ring-1 ring-inset ring-primary" : "bg-bg-card"}`,
1907
1907
  children: w[b].map((S) => /* @__PURE__ */ d(
1908
- An,
1908
+ _n,
1909
1909
  {
1910
1910
  entry: S,
1911
1911
  draggable: !0,
@@ -1924,7 +1924,7 @@ function ii() {
1924
1924
  ...R(Ge),
1925
1925
  className: `flex items-center gap-2 p-2 overflow-x-auto min-h-[96px] border-t border-dashed border-border transition-colors ${o === Ge ? "bg-primary/15 ring-1 ring-inset ring-primary" : "bg-bg"}`,
1926
1926
  children: w[Ge].map((b) => /* @__PURE__ */ d(
1927
- An,
1927
+ _n,
1928
1928
  {
1929
1929
  entry: b,
1930
1930
  draggable: !0,
@@ -1937,14 +1937,14 @@ function ii() {
1937
1937
  }
1938
1938
  )
1939
1939
  ] }),
1940
- F === "everyone" && n && /* @__PURE__ */ d(Se, { children: At.map((b) => {
1940
+ F === "everyone" && n && /* @__PURE__ */ d(Se, { children: _t.map((b) => {
1941
1941
  const S = n.placed.filter((I) => I.tier === b);
1942
1942
  return /* @__PURE__ */ A("div", { className: "grid grid-cols-[56px_1fr] border-b border-border/50 min-h-[86px]", children: [
1943
1943
  /* @__PURE__ */ d(
1944
1944
  "div",
1945
1945
  {
1946
1946
  className: "grid place-items-center select-none",
1947
- style: { background: Vt[b], color: "var(--color-tier-ink)" },
1947
+ style: { background: Wt[b], color: "var(--color-tier-ink)" },
1948
1948
  children: /* @__PURE__ */ d("span", { className: "text-2xl font-bold leading-none", children: b })
1949
1949
  }
1950
1950
  ),
@@ -1964,7 +1964,7 @@ function ii() {
1964
1964
  /* @__PURE__ */ d(
1965
1965
  "img",
1966
1966
  {
1967
- src: Wn(I.mediaId, D?.thumbnail),
1967
+ src: Gn(I.mediaId, D?.thumbnail),
1968
1968
  alt: "",
1969
1969
  loading: "eager",
1970
1970
  decoding: "async",
@@ -2006,9 +2006,9 @@ function oi({ children: t }) {
2006
2006
  return L(() => {
2007
2007
  const r = () => n(document.fullscreenElement);
2008
2008
  return r(), document.addEventListener("fullscreenchange", r), () => document.removeEventListener("fullscreenchange", r);
2009
- }, []), e ? St(t, e) : /* @__PURE__ */ d(Se, { children: t });
2009
+ }, []), e ? vt(t, e) : /* @__PURE__ */ d(Se, { children: t });
2010
2010
  }
2011
- function pc({ className: t = "w-5 h-5" }) {
2011
+ function hc({ className: t = "w-5 h-5" }) {
2012
2012
  return /* @__PURE__ */ d("svg", { className: t, fill: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ d("path", { d: "M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z" }) });
2013
2013
  }
2014
2014
  function ci({ className: t = "w-5 h-5" }) {
@@ -2075,7 +2075,7 @@ function yr({ site: t = "control bar", className: e = "ctr-btn" }) {
2075
2075
  return /* @__PURE__ */ d(
2076
2076
  "button",
2077
2077
  {
2078
- onClick: () => Zn(t),
2078
+ onClick: () => Xn(t),
2079
2079
  className: e,
2080
2080
  title: "Select Media",
2081
2081
  "aria-label": "Select Media",
@@ -2084,7 +2084,7 @@ function yr({ site: t = "control bar", className: e = "ctr-btn" }) {
2084
2084
  );
2085
2085
  }
2086
2086
  function xi() {
2087
- const t = x((a) => a.chatCollapsed), e = x((a) => a.toggleChatCollapsed), n = x((a) => !!a.snapshot.mediaId), r = wt(), s = Zt({ hasMedia: n, chatCollapsed: t, isFullscreen: r });
2087
+ const t = x((a) => a.chatCollapsed), e = x((a) => a.toggleChatCollapsed), n = x((a) => !!a.snapshot.mediaId), r = St(), s = Xt({ hasMedia: n, chatCollapsed: t, isFullscreen: r });
2088
2088
  return { panelHidden: s, toggle: () => {
2089
2089
  if (E("chat", s ? "Show chat" : "Hide chat", { isFullscreen: r, chatCollapsed: t }), !s) {
2090
2090
  e();
@@ -2111,17 +2111,17 @@ function vr({ className: t }) {
2111
2111
  );
2112
2112
  }
2113
2113
  function Ei() {
2114
- const t = x((u) => u.chatCollapsed), e = x((u) => !!u.snapshot.mediaId), n = wt(), r = xt(), s = nt(), i = nn(), a = en({
2114
+ const t = x((u) => u.chatCollapsed), e = x((u) => !!u.snapshot.mediaId), n = St(), r = wt(), s = tt(), i = tn(), a = Zt({
2115
2115
  isLeader: i,
2116
2116
  hasMedia: e,
2117
2117
  chatCollapsed: t,
2118
2118
  isFullscreen: n,
2119
2119
  gameOverlay: r !== null
2120
- }) === "room-corner", l = s && r?.kind === "module" && !n, o = er({ hasMedia: e, isFullscreen: n, gameOverlay: r !== null }) === "room-corner";
2120
+ }) === "room-corner", l = s && r !== null && !n, o = er({ hasMedia: e, isFullscreen: n, gameOverlay: r !== null }) === "room-corner";
2121
2121
  return !a && !l && !o ? null : /* @__PURE__ */ A("div", { className: "absolute top-2 right-2 z-40 flex items-center gap-2", "data-testid": "room-corner-controls", children: [
2122
2122
  a && /* @__PURE__ */ d(yr, { site: "room corner", className: "corner-btn" }),
2123
2123
  l && /* @__PURE__ */ d("button", { type: "button", onClick: () => {
2124
- E("game", "game_select", { gameId: null, source: "room corner" }), Un(null);
2124
+ E("game", "game_select", { gameId: null, source: "room corner" }), Hn(null);
2125
2125
  }, className: "corner-btn", title: "Stop game", "aria-label": "Stop game", children: /* @__PURE__ */ d(vi, {}) }),
2126
2126
  o && /* @__PURE__ */ d(vr, { className: "corner-btn" })
2127
2127
  ] });
@@ -2129,11 +2129,11 @@ function Ei() {
2129
2129
  function Mi() {
2130
2130
  L(() => hs((t) => {
2131
2131
  const e = ps(t);
2132
- E("avatar", "Avatar changed in the settings popout", { sprite: e, source: t.avatar?.source }), Kn(e);
2132
+ E("avatar", "Avatar changed in the settings popout", { sprite: e, source: t.avatar?.source }), Wn(e);
2133
2133
  }), []);
2134
2134
  }
2135
2135
  const Sr = [];
2136
- function Tn(t) {
2136
+ function An(t) {
2137
2137
  Sr.push(t);
2138
2138
  }
2139
2139
  function Qe() {
@@ -2145,11 +2145,11 @@ function Qe() {
2145
2145
  C("audio", "audio-unlock callback threw", Y(n));
2146
2146
  }
2147
2147
  }
2148
- let Rt = !1;
2148
+ let Ft = !1;
2149
2149
  function ki() {
2150
- return Rt ? () => {
2151
- } : (Rt = !0, document.addEventListener("click", Qe, { capture: !0, passive: !0 }), document.addEventListener("touchend", Qe, { capture: !0, passive: !0 }), document.addEventListener("keydown", Qe, { capture: !0, passive: !0 }), () => {
2152
- document.removeEventListener("click", Qe, { capture: !0 }), document.removeEventListener("touchend", Qe, { capture: !0 }), document.removeEventListener("keydown", Qe, { capture: !0 }), Rt = !1;
2150
+ return Ft ? () => {
2151
+ } : (Ft = !0, document.addEventListener("click", Qe, { capture: !0, passive: !0 }), document.addEventListener("touchend", Qe, { capture: !0, passive: !0 }), document.addEventListener("keydown", Qe, { capture: !0, passive: !0 }), () => {
2152
+ document.removeEventListener("click", Qe, { capture: !0 }), document.removeEventListener("touchend", Qe, { capture: !0 }), document.removeEventListener("keydown", Qe, { capture: !0 }), Ft = !1;
2153
2153
  });
2154
2154
  }
2155
2155
  const _i = 400;
@@ -2179,16 +2179,16 @@ async function Ii(t) {
2179
2179
  }
2180
2180
  function Pe(t, e) {
2181
2181
  const r = x.getState().allocateClientSeq(), s = { kind: t, client_seq: r, ...e || {} };
2182
- return Vn().emit(zn.CONTROL, s), r;
2182
+ return Kn().emit(Vn.CONTROL, s), r;
2183
2183
  }
2184
- function mc(t) {
2184
+ function pc(t) {
2185
2185
  return Pe("load", { media_id: t });
2186
2186
  }
2187
2187
  function Ci() {
2188
2188
  return Pe("home");
2189
2189
  }
2190
2190
  function Fi() {
2191
- const t = La(), e = ar(), n = nt(), r = ir(), s = n && r && !e.ready, i = !e.ready && !s;
2191
+ const t = La(), e = ar(), n = tt(), r = ir(), s = n && r && !e.ready, i = !e.ready && !s;
2192
2192
  return /* @__PURE__ */ d(
2193
2193
  "button",
2194
2194
  {
@@ -2236,15 +2236,15 @@ function Li(t) {
2236
2236
  function $i(t, e) {
2237
2237
  return e <= 0 ? 0 : t / e;
2238
2238
  }
2239
- function Nt(t) {
2239
+ function Rt(t) {
2240
2240
  const e = Math.floor(t / 1e3), n = Math.floor(e / 3600), r = Math.floor(e % 3600 / 60), s = e % 60;
2241
2241
  return n > 0 ? `${n}:${r.toString().padStart(2, "0")}:${s.toString().padStart(2, "0")}` : `${r}:${s.toString().padStart(2, "0")}`;
2242
2242
  }
2243
2243
  function Pi({ durationMs: t, displayPlayheadMs: e }) {
2244
- const n = x((S) => S.snapshot), r = x((S) => S.readiness), s = nt(), i = ir(), a = s && i && !r.ready, l = P(null), [o, c] = $(null), [u, f] = $(0), [p, v] = $(!1), [m, h] = $(null), y = P(0), [w, _] = $(n.mediaId);
2244
+ const n = x((S) => S.snapshot), r = x((S) => S.readiness), s = tt(), i = ir(), a = s && i && !r.ready, l = P(null), [o, c] = $(null), [u, f] = $(0), [p, v] = $(!1), [m, h] = $(null), y = P(0), [w, _] = $(n.mediaId);
2245
2245
  w !== n.mediaId && (_(n.mediaId), h(null), v(!1));
2246
2246
  const R = e ?? n.playheadMs;
2247
- !p && m !== null && Math.abs(R - m) < jn && h(null);
2247
+ !p && m !== null && Math.abs(R - m) < Un && h(null);
2248
2248
  const k = t || 0, g = Li({ localValue: m, displayPlayheadMs: e, snapshotPlayheadMs: n.playheadMs }), T = P(0);
2249
2249
  L(() => {
2250
2250
  if (p || m === null) return;
@@ -2264,7 +2264,7 @@ function Pi({ durationMs: t, displayPlayheadMs: e }) {
2264
2264
  c(null);
2265
2265
  }, []);
2266
2266
  return /* @__PURE__ */ A("div", { className: "flex items-center gap-2 flex-1", children: [
2267
- /* @__PURE__ */ d("span", { className: "text-[11px] font-mono text-text-secondary w-[45px] text-right shrink-0", children: Nt(g) }),
2267
+ /* @__PURE__ */ d("span", { className: "text-[11px] font-mono text-text-secondary w-[45px] text-right shrink-0", children: Rt(g) }),
2268
2268
  /* @__PURE__ */ A("div", { className: "flex-1 relative", children: [
2269
2269
  /* @__PURE__ */ d(
2270
2270
  "input",
@@ -2299,11 +2299,11 @@ function Pi({ durationMs: t, displayPlayheadMs: e }) {
2299
2299
  {
2300
2300
  className: "absolute bottom-full mb-2 px-2 py-1 bg-bg-card text-white text-xs rounded pointer-events-none transform -translate-x-1/2 whitespace-nowrap",
2301
2301
  style: { left: o },
2302
- children: Nt(u)
2302
+ children: Rt(u)
2303
2303
  }
2304
2304
  )
2305
2305
  ] }),
2306
- /* @__PURE__ */ d("span", { className: "text-[11px] font-mono text-text-muted w-[45px] text-left shrink-0", children: Nt(k) })
2306
+ /* @__PURE__ */ d("span", { className: "text-[11px] font-mono text-text-muted w-[45px] text-left shrink-0", children: Rt(k) })
2307
2307
  ] });
2308
2308
  }
2309
2309
  function Bi({ videoRef: t }) {
@@ -2486,25 +2486,25 @@ function Gi({
2486
2486
  onChatActivity: h,
2487
2487
  onMenuHeld: y
2488
2488
  }) {
2489
- const w = nt(), _ = x((z) => z.chatCollapsed), R = wt(), k = nn(), g = xt() !== null, T = en({
2489
+ const w = tt(), _ = x((z) => z.chatCollapsed), R = St(), k = tn(), g = wt() !== null, T = Zt({
2490
2490
  isLeader: k,
2491
2491
  hasMedia: !0,
2492
2492
  chatCollapsed: _,
2493
2493
  isFullscreen: R,
2494
2494
  gameOverlay: g
2495
- }) === "control-bar", F = er({ hasMedia: !0, isFullscreen: R, gameOverlay: g }) === "control-bar", b = x((z) => z.floatingChatEnabled), S = P(null), I = P(null), [D, H] = $(!1), [j, V] = $(!1), [X, N] = $(""), [O, Q] = $(!1), W = sr(), [re, le] = $(!1), [Fe, Ve] = $(!1), Et = U(async (z) => {
2495
+ }) === "control-bar", F = er({ hasMedia: !0, isFullscreen: R, gameOverlay: g }) === "control-bar", b = x((z) => z.floatingChatEnabled), S = P(null), I = P(null), [D, H] = $(!1), [j, V] = $(!1), [X, N] = $(""), [O, Q] = $(!1), W = sr(), [re, le] = $(!1), [Fe, Ve] = $(!1), xt = U(async (z) => {
2496
2496
  if (z.key !== "Enter") return;
2497
2497
  const he = X.trim();
2498
2498
  if (!he && !W.pending.length || O || W.uploading) return;
2499
2499
  const Ee = await W.uploadPending();
2500
- Ee !== null && (Dn(he, Ee), N(""), W.clear(), Q(!0), setTimeout(() => Q(!1), On), !document.hidden && document.hasFocus() && I.current?.focus());
2500
+ Ee !== null && (Bn(he, Ee), N(""), W.clear(), Q(!0), setTimeout(() => Q(!1), Dn), !document.hidden && document.hasFocus() && I.current?.focus());
2501
2501
  }, [X, O, W]);
2502
2502
  L(() => () => y?.(!1), [e, y]);
2503
2503
  const Be = r ?? !0, ye = U(() => {
2504
2504
  const z = S.current;
2505
2505
  if (!z) return;
2506
- const { scrollLeft: he, scrollWidth: Ee, clientWidth: Mt } = z;
2507
- H(he > 5), V(he + Mt < Ee - 5);
2506
+ const { scrollLeft: he, scrollWidth: Ee, clientWidth: Et } = z;
2507
+ H(he > 5), V(he + Et < Ee - 5);
2508
2508
  }, []);
2509
2509
  L(() => {
2510
2510
  const z = S.current;
@@ -2525,7 +2525,7 @@ function Gi({
2525
2525
  const we = [
2526
2526
  "ctr-bar",
2527
2527
  Be && "show"
2528
- ].filter(Boolean).join(" "), rt = D || j;
2528
+ ].filter(Boolean).join(" "), nt = D || j;
2529
2529
  return /* @__PURE__ */ A(
2530
2530
  "div",
2531
2531
  {
@@ -2592,7 +2592,7 @@ function Gi({
2592
2592
  children: [
2593
2593
  /* @__PURE__ */ d(rr, { pending: W.pending, uploading: W.uploading, onRemove: W.remove }),
2594
2594
  /* @__PURE__ */ d(
2595
- Xn,
2595
+ Yn,
2596
2596
  {
2597
2597
  open: re,
2598
2598
  onClose: () => le(!1),
@@ -2609,10 +2609,10 @@ function Gi({
2609
2609
  type: "text",
2610
2610
  value: X,
2611
2611
  onChange: (z) => {
2612
- N(z.target.value.slice(0, Hn)), h?.();
2612
+ N(z.target.value.slice(0, On)), h?.();
2613
2613
  },
2614
2614
  onKeyDown: (z) => {
2615
- Et(z);
2615
+ xt(z);
2616
2616
  },
2617
2617
  placeholder: "Message...",
2618
2618
  className: "bg-transparent border-none outline-none text-sm max-w-[240px] w-48 h-7 px-2",
@@ -2640,7 +2640,7 @@ function Gi({
2640
2640
  /* @__PURE__ */ d(ji, { videoRef: t })
2641
2641
  ] })
2642
2642
  ] }),
2643
- rt && /* @__PURE__ */ A("div", { className: "ctr-scroll-group", children: [
2643
+ nt && /* @__PURE__ */ A("div", { className: "ctr-scroll-group", children: [
2644
2644
  /* @__PURE__ */ d(
2645
2645
  "button",
2646
2646
  {
@@ -2696,12 +2696,12 @@ const qe = 3, Xi = 1e3, Zi = 15e3, Z = {
2696
2696
  POINT: 0.05,
2697
2697
  RANGE: 0.1,
2698
2698
  FALLBACK: 1
2699
- }, Lt = 0.5, $t = 3e3;
2700
- function ct(t, e = {}) {
2699
+ }, Nt = 0.5, Lt = 3e3;
2700
+ function ot(t, e = {}) {
2701
2701
  const { baseMs: n = Xi, capMs: r = Zi, jitter: s = 0.25 } = e, i = Math.min(n * Math.pow(2, t - 1), r), a = s > 0 ? Math.round(i * Math.random() * s) : 0;
2702
2702
  return i + a;
2703
2703
  }
2704
- const In = 15, eo = 35e3, to = 2e3, Pt = 10;
2704
+ const Tn = 15, eo = 35e3, to = 2e3, $t = 10;
2705
2705
  function Te(t, e) {
2706
2706
  if (t.length === 0) return 0;
2707
2707
  if (e >= t[t.length - 1].end_ms) return t.length - 1;
@@ -2712,7 +2712,7 @@ function Te(t, e) {
2712
2712
  }
2713
2713
  return n;
2714
2714
  }
2715
- function rn(t, e) {
2715
+ function nn(t, e) {
2716
2716
  const n = Te(t, e);
2717
2717
  if (t.length === 0 || t[0].keyframe === void 0) return n;
2718
2718
  for (let r = n; r >= 0; r--)
@@ -2726,7 +2726,7 @@ function Ye(t, e, n = Z.POINT) {
2726
2726
  if (e >= t.start(r) - n && e <= t.end(r)) return r;
2727
2727
  return -1;
2728
2728
  }
2729
- function Bt(t, e, n, r = Z.RANGE) {
2729
+ function Pt(t, e, n, r = Z.RANGE) {
2730
2730
  const s = e / 1e3, i = n / 1e3;
2731
2731
  for (let a = 0; a < t.length; a++)
2732
2732
  if (t.start(a) < i + r && t.end(a) > s - r) return !0;
@@ -2741,12 +2741,12 @@ function no(t) {
2741
2741
  return n === 0 ? 0 : e / n * 1e3;
2742
2742
  }
2743
2743
  const ro = 8e5, so = 4;
2744
- function ot(t) {
2744
+ function it(t) {
2745
2745
  if (t === 0) return 6e4;
2746
2746
  const e = ro / t * 1e3 * so;
2747
2747
  return Math.max(3e4, Math.min(12e4, Math.round(e)));
2748
2748
  }
2749
- function Cn(t, e) {
2749
+ function In(t, e) {
2750
2750
  for (let n = e; n >= 0; n--)
2751
2751
  if (t[n]?.keyframe) return n;
2752
2752
  return -1;
@@ -2770,7 +2770,7 @@ function io(t) {
2770
2770
  for (; r < n.length; ) {
2771
2771
  const s = n[r].trim();
2772
2772
  if (s.includes("-->")) {
2773
- const i = s.split("-->"), a = Fn(i[0].trim()), l = i[1].trim().split(/\s+/), o = Fn(l[0]);
2773
+ const i = s.split("-->"), a = Cn(i[0].trim()), l = i[1].trim().split(/\s+/), o = Cn(l[0]);
2774
2774
  let c, u, f;
2775
2775
  for (let v = 1; v < l.length; v++) {
2776
2776
  const m = l[v];
@@ -2809,7 +2809,7 @@ function io(t) {
2809
2809
  }
2810
2810
  return e;
2811
2811
  }
2812
- function Fn(t) {
2812
+ function Cn(t) {
2813
2813
  const e = t.split(":");
2814
2814
  if (e.length < 2) return null;
2815
2815
  let n = 0, r, s;
@@ -2848,7 +2848,7 @@ function lo({ subtitleUrl: t, videoRef: e, style: n, enabled: r }) {
2848
2848
  } catch (b) {
2849
2849
  if (g) return;
2850
2850
  if (F < T) {
2851
- const S = ct(F + 1, { baseMs: 1e3, capMs: 2e3, jitter: 0 });
2851
+ const S = ot(F + 1, { baseMs: 1e3, capMs: 2e3, jitter: 0 });
2852
2852
  C("subtitles", `Fetch failed, retrying in ${S}ms (attempt ${F + 1}/${T + 1})`, { error: b?.message }), await new Promise((I) => setTimeout(I, S));
2853
2853
  } else
2854
2854
  C("subtitles", "All fetch attempts failed", { error: b?.message }), i([]);
@@ -2951,7 +2951,7 @@ function lo({ subtitleUrl: t, videoRef: e, style: n, enabled: r }) {
2951
2951
  ] });
2952
2952
  }
2953
2953
  const uo = 300, fo = 50, ho = 100, po = 100, mo = 100, go = 100;
2954
- function Dt(t, e) {
2954
+ function Bt(t, e) {
2955
2955
  if (t.length === 0) return 0;
2956
2956
  const n = Math.min(Math.floor(e / 100 * t.length), t.length - 1);
2957
2957
  return t[n];
@@ -2962,9 +2962,9 @@ function Ne(t) {
2962
2962
  return {
2963
2963
  count: e.length,
2964
2964
  mean: Math.round(n / e.length),
2965
- p50: Math.round(Dt(e, 50)),
2966
- p90: Math.round(Dt(e, 90)),
2967
- p99: Math.round(Dt(e, 99)),
2965
+ p50: Math.round(Bt(e, 50)),
2966
+ p90: Math.round(Bt(e, 90)),
2967
+ p99: Math.round(Bt(e, 99)),
2968
2968
  max: Math.round(e[e.length - 1])
2969
2969
  };
2970
2970
  }
@@ -3151,7 +3151,7 @@ class bo {
3151
3151
  }
3152
3152
  }
3153
3153
  const oe = new bo();
3154
- Gn("__WP_PERF__", oe);
3154
+ jn("__WP_PERF__", oe);
3155
3155
  class yo {
3156
3156
  cache = /* @__PURE__ */ new Map();
3157
3157
  getOrCreate(e) {
@@ -3181,7 +3181,7 @@ class yo {
3181
3181
  if (n.length === 0) return 0;
3182
3182
  const r = this.cache.get(e);
3183
3183
  if (!r) return 0;
3184
- const s = rn(n, 0);
3184
+ const s = nn(n, 0);
3185
3185
  let i = 0;
3186
3186
  for (let a = s; a < n.length && r.fragments.has(a); a++)
3187
3187
  i = n[a].end_ms;
@@ -3191,7 +3191,7 @@ class yo {
3191
3191
  this.cache.clear();
3192
3192
  }
3193
3193
  }
3194
- const ve = new yo(), Rn = 60, vo = 5e3;
3194
+ const ve = new yo(), Fn = 60, vo = 5e3;
3195
3195
  class So {
3196
3196
  constructor(e) {
3197
3197
  this.deps = e;
@@ -3315,8 +3315,8 @@ class So {
3315
3315
  const s = e / 1e3, i = n.buffered, a = this.deps.getPendingSeekTargetMs(), l = a === null ? null : a / 1e3;
3316
3316
  for (let o = 0; o < i.length; o++) {
3317
3317
  const c = i.start(o), u = i.end(o);
3318
- if (c < s - Rn && u > s) {
3319
- const y = s - Rn;
3318
+ if (c < s - Fn && u > s) {
3319
+ const y = s - Fn;
3320
3320
  E("buffer", `EVICT-START [behind-tail-trim] range=${c.toFixed(2)}-${u.toFixed(2)} → trim [${c.toFixed(2)}-${y.toFixed(2)}] playhead=${s.toFixed(2)}`), this._doEvict(c, y, "behind-tail-trim");
3321
3321
  return;
3322
3322
  }
@@ -3625,7 +3625,7 @@ class Ze {
3625
3625
  const c = await this.tryFragmentRoute(
3626
3626
  "init",
3627
3627
  n - e + 1,
3628
- AbortSignal.timeout(ot(this.getAverageDownloadRate()))
3628
+ AbortSignal.timeout(it(this.getAverageDownloadRate()))
3629
3629
  );
3630
3630
  if (c) {
3631
3631
  if (this.initTtfbMs = c.ttfbMs, this.initCfStatus = c.cfStatus, l = c.buf, a()) {
@@ -3639,7 +3639,7 @@ class Ze {
3639
3639
  } else {
3640
3640
  const u = performance.now(), f = await fetch(s, {
3641
3641
  headers: { Range: `bytes=${e}-${n}` },
3642
- signal: AbortSignal.timeout(ot(this.getAverageDownloadRate()))
3642
+ signal: AbortSignal.timeout(it(this.getAverageDownloadRate()))
3643
3643
  });
3644
3644
  if (this.initTtfbMs = Math.round(performance.now() - u), this.initCfStatus = f.headers.get("cf-cache-status") || f.headers.get("x-cache") || "", !f.ok) throw new Error(`HTTP ${f.status}`);
3645
3645
  if (f.status !== 206)
@@ -3774,7 +3774,7 @@ class Ze {
3774
3774
  return;
3775
3775
  }
3776
3776
  const i = r.join("|"), a = Date.now();
3777
- this.stableGapSignature !== i ? (this.stableGapSignature = i, this.stableGapSince = a) : a - this.stableGapSince >= pn && a - this.lastGapWarnMs > pn && (this.lastGapWarnMs = a, C("buffer", `SB has ${e.buffered.length} ranges with ${r.length} stable unfillable gap(s) ${JSON.stringify({
3777
+ this.stableGapSignature !== i ? (this.stableGapSignature = i, this.stableGapSince = a) : a - this.stableGapSince >= hn && a - this.lastGapWarnMs > hn && (this.lastGapWarnMs = a, C("buffer", `SB has ${e.buffered.length} ranges with ${r.length} stable unfillable gap(s) ${JSON.stringify({
3778
3778
  ranges: ge(e.buffered),
3779
3779
  unfillableGaps: r,
3780
3780
  stableForMs: a - this.stableGapSince,
@@ -3798,7 +3798,7 @@ class Ze {
3798
3798
  if (this.disposed) return Promise.reject(new Error("FragmentManager disposed"));
3799
3799
  if (this.initFailed) return Promise.reject(new Error("init segment failed after repeated retries"));
3800
3800
  if (this.fragmentStates.get(e) === "loaded") return Promise.resolve();
3801
- const r = n ?? ot(this.getAverageDownloadRate());
3801
+ const r = n ?? it(this.getAverageDownloadRate());
3802
3802
  return new Promise((s, i) => {
3803
3803
  const a = setTimeout(() => {
3804
3804
  this.appendWaiters = this.appendWaiters.filter((l) => l.index !== e), oe.recordAppendTimeout(e, r, this.appendQueue.length), C("buffer", "waitForAppend timeout", {
@@ -3833,7 +3833,7 @@ class Ze {
3833
3833
  hasDataAhead(e) {
3834
3834
  if (!this.sourceBuffer?.buffered || this.mediaSource?.readyState !== "open") return !1;
3835
3835
  const n = this.sourceBuffer.buffered, r = e / 1e3, s = Ye(n, r, Z.RANGE);
3836
- return s >= 0 && n.end(s) - r > Lt;
3836
+ return s >= 0 && n.end(s) - r > Nt;
3837
3837
  }
3838
3838
  /** Wait for a specific time position to be buffered in the SourceBuffer.
3839
3839
  * Event-driven: resolves on updateend when the position enters a buffered range. */
@@ -3921,7 +3921,7 @@ class Ze {
3921
3921
  for (const [s, i] of this.fragmentStates) {
3922
3922
  if (i !== "loaded") continue;
3923
3923
  const a = this.fragments[s];
3924
- a && (Bt(e, a.start_ms, a.end_ms) || (this.fragmentStates.set(s, "pending"), n.push(s)));
3924
+ a && (Pt(e, a.start_ms, a.end_ms) || (this.fragmentStates.set(s, "pending"), n.push(s)));
3925
3925
  }
3926
3926
  if (n.length === 0) return;
3927
3927
  const r = ge(e).join(", ") || "(none)";
@@ -3940,7 +3940,7 @@ class Ze {
3940
3940
  if (this.isBuffered(e)) return { status: "buffered", fragmentIndex: n };
3941
3941
  const r = this.currentJobs.get(n);
3942
3942
  if (r) return { status: "loading", fragmentIndex: n, existingPromise: r.promise };
3943
- const s = Math.max(0, n - In), i = Math.min(this.fragments.length - 1, n + In);
3943
+ const s = Math.max(0, n - Tn), i = Math.min(this.fragments.length - 1, n + Tn);
3944
3944
  for (let a = s; a <= i; a++) {
3945
3945
  const l = this.fragmentStates.get(a);
3946
3946
  if (l === "loaded" || l === "loading") return { status: "nearby-pending", fragmentIndex: n };
@@ -3969,7 +3969,7 @@ class Ze {
3969
3969
  for (let y = l; y <= h; y++)
3970
3970
  this.discardCounts.delete(y), this.fetchErrorCycles.delete(y);
3971
3971
  }
3972
- const o = rn(this.fragments, e), c = this.fragments[o], u = c && this.sourceBuffer?.buffered && Bt(this.sourceBuffer.buffered, c.start_ms, c.end_ms), f = u ? l : o, p = s ? Math.min(this.fragments.length - 1, l + 1) : Te(this.fragments, e + Ie);
3972
+ const o = nn(this.fragments, e), c = this.fragments[o], u = c && this.sourceBuffer?.buffered && Pt(this.sourceBuffer.buffered, c.start_ms, c.end_ms), f = u ? l : o, p = s ? Math.min(this.fragments.length - 1, l + 1) : Te(this.fragments, e + Ie);
3973
3973
  this.initRange && this.initState !== "loaded" && await this.fetchInit();
3974
3974
  const v = [], m = [];
3975
3975
  for (let h = f; h <= p; h++) {
@@ -4077,7 +4077,7 @@ class Ze {
4077
4077
  bytes: p.buf.byteLength,
4078
4078
  ttfbMs: p.ttfbMs,
4079
4079
  cf: p.cfStatus
4080
- }), E("buffer", `FETCH-OK #${e} [${i}] ${p.buf.byteLength}B in ${Math.round(k)}ms via=frag-route (ttfb=${p.ttfbMs}ms cf=${p.cfStatus || "-"})`), k > 0 && (this.downloadSamples.push({ bytes: p.buf.byteLength, durationMs: k }), this.downloadSamples.length > Pt && this.downloadSamples.shift(), oe.recordFetch(e, p.buf.byteLength, k)), this.disposed || this.mediaUrl !== f) {
4080
+ }), E("buffer", `FETCH-OK #${e} [${i}] ${p.buf.byteLength}B in ${Math.round(k)}ms via=frag-route (ttfb=${p.ttfbMs}ms cf=${p.cfStatus || "-"})`), k > 0 && (this.downloadSamples.push({ bytes: p.buf.byteLength, durationMs: k }), this.downloadSamples.length > $t && this.downloadSamples.shift(), oe.recordFetch(e, p.buf.byteLength, k)), this.disposed || this.mediaUrl !== f) {
4081
4081
  E("buffer", `FETCH-STALE #${e} discarding frag-route bytes (mediaUrl changed)`);
4082
4082
  return;
4083
4083
  }
@@ -4089,7 +4089,7 @@ class Ze {
4089
4089
  Range: `bytes=${n.start_byte}-${n.end_byte}`,
4090
4090
  "X-Buffer-Ahead-Ms": String(Math.round(this.getBufferedAheadMs(this.currentPlayheadMs)))
4091
4091
  },
4092
- signal: AbortSignal.any([s.signal, AbortSignal.timeout(ot(this.getAverageDownloadRate()))])
4092
+ signal: AbortSignal.any([s.signal, AbortSignal.timeout(it(this.getAverageDownloadRate()))])
4093
4093
  }), h = Math.round(performance.now() - c), y = m.headers.get("cf-cache-status") || m.headers.get("x-cache") || "";
4094
4094
  if (!m.ok) throw new Error(`HTTP ${m.status}`);
4095
4095
  const w = n.end_byte - n.start_byte + 1;
@@ -4101,7 +4101,7 @@ class Ze {
4101
4101
  cfCacheStatus: y,
4102
4102
  expectedBytes: w
4103
4103
  }), this.fragmentStates.set(e, "pending"), o < qe) {
4104
- await new Promise((k) => setTimeout(k, ct(o)));
4104
+ await new Promise((k) => setTimeout(k, ot(o)));
4105
4105
  continue;
4106
4106
  }
4107
4107
  throw new Error(`fragment expected 206, got ${m.status}`);
@@ -4113,14 +4113,14 @@ class Ze {
4113
4113
  actualBytes: _.byteLength
4114
4114
  }), _.byteLength === 0 || _.byteLength !== w) {
4115
4115
  if (this.fragmentStates.set(e, "pending"), o < qe) {
4116
- await new Promise((k) => setTimeout(k, ct(o)));
4116
+ await new Promise((k) => setTimeout(k, ot(o)));
4117
4117
  continue;
4118
4118
  }
4119
4119
  ee("buffer", `Fragment #${e} bad response after ${qe} retries`, { expected: w, actual: _.byteLength }), this.fragmentStates.set(e, "error"), this.errorTimestamps.set(e, Date.now()), this.fetchErrorCycles.set(e, (this.fetchErrorCycles.get(e) ?? 0) + 1), oe.recordFetchError(e);
4120
4120
  return;
4121
4121
  }
4122
4122
  const R = performance.now() - c;
4123
- if (this.isInInitPhase() && this.recordInitFragEvent(e, { fetchEnd: performance.now(), bytes: _.byteLength, ttfbMs: h, cf: y }), E("buffer", `FETCH-OK #${e} [${i}] ${_.byteLength}B in ${Math.round(R)}ms (ttfb=${h}ms cf=${y || "-"}) (${(_.byteLength / R * 1e3 / 1024).toFixed(0)} KB/s)`), R > 0 && (this.downloadSamples.push({ bytes: _.byteLength, durationMs: R }), this.downloadSamples.length > Pt && this.downloadSamples.shift(), oe.recordFetch(e, _.byteLength, R)), this.disposed || this.mediaUrl !== v) {
4123
+ if (this.isInInitPhase() && this.recordInitFragEvent(e, { fetchEnd: performance.now(), bytes: _.byteLength, ttfbMs: h, cf: y }), E("buffer", `FETCH-OK #${e} [${i}] ${_.byteLength}B in ${Math.round(R)}ms (ttfb=${h}ms cf=${y || "-"}) (${(_.byteLength / R * 1e3 / 1024).toFixed(0)} KB/s)`), R > 0 && (this.downloadSamples.push({ bytes: _.byteLength, durationMs: R }), this.downloadSamples.length > $t && this.downloadSamples.shift(), oe.recordFetch(e, _.byteLength, R)), this.disposed || this.mediaUrl !== v) {
4124
4124
  E("buffer", `FETCH-STALE #${e} discarding (mediaUrl changed)`);
4125
4125
  return;
4126
4126
  }
@@ -4132,12 +4132,12 @@ class Ze {
4132
4132
  return;
4133
4133
  }
4134
4134
  if ((c.name === "TimeoutError" || c.message?.includes("signal timed out") || c.message?.includes("The operation was aborted")) && c.name !== "AbortError") {
4135
- const f = ot(this.getAverageDownloadRate());
4136
- this.downloadSamples.push({ bytes: 0, durationMs: f }), this.downloadSamples.length > Pt && this.downloadSamples.shift(), oe.recordFetchTimeout(e), C("buffer", `FETCH-ERR #${e} [${i}] attempt=${o} timeout=${f}ms avgRate=${Math.round(this.getAverageDownloadRate())}Bps error=${c.message}`);
4135
+ const f = it(this.getAverageDownloadRate());
4136
+ this.downloadSamples.push({ bytes: 0, durationMs: f }), this.downloadSamples.length > $t && this.downloadSamples.shift(), oe.recordFetchTimeout(e), C("buffer", `FETCH-ERR #${e} [${i}] attempt=${o} timeout=${f}ms avgRate=${Math.round(this.getAverageDownloadRate())}Bps error=${c.message}`);
4137
4137
  } else
4138
4138
  C("buffer", `FETCH-ERR #${e} [${i}] attempt=${o} error=${c.message}`);
4139
4139
  if (this.isInInitPhase() && this.recordInitFragEvent(e, { err: (c.name === "TimeoutError" ? "timeout" : c.message?.slice(0, 40)) || "err" }), this.fragmentStates.set(e, "pending"), o < qe) {
4140
- await new Promise((f) => setTimeout(f, ct(o)));
4140
+ await new Promise((f) => setTimeout(f, ot(o)));
4141
4141
  continue;
4142
4142
  }
4143
4143
  throw ee("buffer", `Fragment #${e} failed after ${qe} retries`, { error: c.message }), this.fragmentStates.set(e, "error"), this.errorTimestamps.set(e, Date.now()), this.fetchErrorCycles.set(e, (this.fetchErrorCycles.get(e) ?? 0) + 1), oe.recordFetchError(e), c;
@@ -4165,10 +4165,10 @@ class Ze {
4165
4165
  if (e <= 0 || this.fragments.length === 0 || this.fragments[0].keyframe === void 0) return !1;
4166
4166
  const n = this.fragments[e];
4167
4167
  if (!n || n.keyframe) return !1;
4168
- const r = Cn(this.fragments, e - 1);
4168
+ const r = In(this.fragments, e - 1);
4169
4169
  if (r < 0 || this.fragmentStates.get(r) !== "error") return !1;
4170
4170
  const s = this.fragments[r];
4171
- if (this.sourceBuffer ? Bt(this.sourceBuffer.buffered, s.start_ms, s.end_ms) : !1) return !1;
4171
+ if (this.sourceBuffer ? Pt(this.sourceBuffer.buffered, s.start_ms, s.end_ms) : !1) return !1;
4172
4172
  const a = [], l = [];
4173
4173
  for (const o of this.appendQueue) {
4174
4174
  const c = this.fragments[o.index];
@@ -4176,7 +4176,7 @@ class Ze {
4176
4176
  l.push(o);
4177
4177
  continue;
4178
4178
  }
4179
- Cn(this.fragments, o.index - 1) === r ? (a.push(o.index), this.fragmentStates.set(o.index, "pending")) : l.push(o);
4179
+ In(this.fragments, o.index - 1) === r ? (a.push(o.index), this.fragmentStates.set(o.index, "pending")) : l.push(o);
4180
4180
  }
4181
4181
  return a.length === 0 ? !1 : (this.appendQueue = l, C("buffer", `APPEND-DROP-DEPENDENT [${a.join(",")}] — keyframe #${r} in error, not in SB`, {
4182
4182
  kfIdx: r,
@@ -4216,7 +4216,7 @@ class Ze {
4216
4216
  liveJobs: Array.from(this.currentJobs.keys()).sort((i, a) => i - a)
4217
4217
  });
4218
4218
  for (const i of n)
4219
- this.currentJobs.get(i)?.abortController.abort(), this.currentJobs.delete(i), this.pendingFetchIndices.delete(i), this.fragmentStates.set(i, "error"), this.errorTimestamps.set(i, r), this.fetchErrorCycles.set(i, mn);
4219
+ this.currentJobs.get(i)?.abortController.abort(), this.currentJobs.delete(i), this.pendingFetchIndices.delete(i), this.fragmentStates.set(i, "error"), this.errorTimestamps.set(i, r), this.fetchErrorCycles.set(i, pn);
4220
4220
  return this.appendHold = null, !0;
4221
4221
  }
4222
4222
  processAppendQueue() {
@@ -4271,7 +4271,7 @@ class Ze {
4271
4271
  if (this.disposed || !this.sourceBuffer || (this.currentPlayheadMs = e, this.currentJobs.size >= ze)) return;
4272
4272
  const n = Te(this.fragments, e), r = Math.min(this.fragments.length - 1, Te(this.fragments, e + Xe)), s = Date.now();
4273
4273
  for (let a = n; a <= r; a++)
4274
- this.fragmentStates.get(a) === "error" && s - (this.errorTimestamps.get(a) ?? 0) >= xs && ((this.fetchErrorCycles.get(a) ?? 0) >= mn ? E("buffer", `PREFETCH-DEAD #${a} cycles=${this.fetchErrorCycles.get(a)} not resetting`) : (this.fragmentStates.set(a, "pending"), this.errorTimestamps.delete(a)));
4274
+ this.fragmentStates.get(a) === "error" && s - (this.errorTimestamps.get(a) ?? 0) >= xs && ((this.fetchErrorCycles.get(a) ?? 0) >= pn ? E("buffer", `PREFETCH-DEAD #${a} cycles=${this.fetchErrorCycles.get(a)} not resetting`) : (this.fragmentStates.set(a, "pending"), this.errorTimestamps.delete(a)));
4275
4275
  let i = 0;
4276
4276
  for (let a = n; a <= r && i < ze - this.currentJobs.size; a++) {
4277
4277
  const l = this.fragmentStates.get(a);
@@ -4466,7 +4466,7 @@ class Ze {
4466
4466
  findNextRangeStart(e, n) {
4467
4467
  if (!this.sourceBuffer?.buffered || this.mediaSource?.readyState !== "open") return null;
4468
4468
  const r = e / 1e3, s = this.sourceBuffer.buffered, i = Ye(s, r, Z.RANGE);
4469
- if (i >= 0 && s.end(i) - r > Lt) return null;
4469
+ if (i >= 0 && s.end(i) - r > Nt) return null;
4470
4470
  const a = i >= 0 ? Math.max(r, s.end(i)) : r;
4471
4471
  for (let l = 0; l < s.length; l++) {
4472
4472
  const o = s.start(l);
@@ -4494,7 +4494,7 @@ class Ze {
4494
4494
  break;
4495
4495
  }
4496
4496
  return {
4497
- atEdge: s >= 0 && i <= Lt,
4497
+ atEdge: s >= 0 && i <= Nt,
4498
4498
  aheadInRangeMs: i * 1e3,
4499
4499
  nextRangeStartMs: l !== null ? l * 1e3 : null,
4500
4500
  gapMs: l !== null ? (l - a) * 1e3 : null
@@ -4543,7 +4543,7 @@ function wo(t, e) {
4543
4543
  function xo(t) {
4544
4544
  return t.override !== null ? t.override : t.globalEnabled || wo(t.selectedAudioLang, t.hasEngSub);
4545
4545
  }
4546
- const xr = "wp_reload_history", sn = "wp_phantom_reload", Er = 5 * 6e4, Nn = 3;
4546
+ const xr = "wp_reload_history", rn = "wp_phantom_reload", Er = 5 * 6e4, Rn = 3;
4547
4547
  function Eo() {
4548
4548
  try {
4549
4549
  const t = sessionStorage.getItem(xr);
@@ -4552,10 +4552,10 @@ function Eo() {
4552
4552
  return [];
4553
4553
  }
4554
4554
  }
4555
- function zt(t, e) {
4555
+ function Kt(t, e) {
4556
4556
  const n = Eo();
4557
- if (n.length >= Nn) {
4558
- gn(
4557
+ if (n.length >= Rn) {
4558
+ mn(
4559
4559
  "error",
4560
4560
  "buffer",
4561
4561
  `AUTO-RELOAD SUPPRESSED reason=${t} — ${n.length} reloads in ${Er / 6e4}m, giving up (connection looks unstable)`,
@@ -4571,19 +4571,19 @@ function zt(t, e) {
4571
4571
  return !1;
4572
4572
  }
4573
4573
  try {
4574
- n.push(Date.now()), sessionStorage.setItem(xr, JSON.stringify(n)), sessionStorage.setItem(sn, String(Date.now()));
4574
+ n.push(Date.now()), sessionStorage.setItem(xr, JSON.stringify(n)), sessionStorage.setItem(rn, String(Date.now()));
4575
4575
  } catch {
4576
4576
  }
4577
- gn("error", "buffer", `AUTO-RELOAD reason=${t} attempt=${n.length}/${Nn}`, e);
4577
+ mn("error", "buffer", `AUTO-RELOAD reason=${t} attempt=${n.length}/${Rn}`, e);
4578
4578
  try {
4579
4579
  window.location.reload();
4580
4580
  } catch {
4581
4581
  }
4582
4582
  return !0;
4583
4583
  }
4584
- function Ln() {
4584
+ function Nn() {
4585
4585
  try {
4586
- const t = sessionStorage.getItem(sn);
4586
+ const t = sessionStorage.getItem(rn);
4587
4587
  return t ? Number(t) : null;
4588
4588
  } catch {
4589
4589
  return null;
@@ -4591,7 +4591,7 @@ function Ln() {
4591
4591
  }
4592
4592
  function Mo() {
4593
4593
  try {
4594
- sessionStorage.removeItem(sn);
4594
+ sessionStorage.removeItem(rn);
4595
4595
  } catch {
4596
4596
  }
4597
4597
  }
@@ -4611,12 +4611,12 @@ function Mr(t, e) {
4611
4611
  E(e.label, "autoplay plan", { policy: n ?? "unknown", plan: r, userWantsMuted: e.userWantsMuted });
4612
4612
  const s = () => {
4613
4613
  t.muted = !0, t.play().then(() => {
4614
- e.onMutedBridge?.(), Tn(() => {
4614
+ e.onMutedBridge?.(), An(() => {
4615
4615
  e.userWantsMuted || (t.muted = !1, e.onUnmuted?.(), E(e.label, "autoplay bridge unmuted on interaction"));
4616
4616
  });
4617
4617
  }).catch((i) => C(e.label, "muted-bridge play failed", { error: i?.name }));
4618
4618
  };
4619
- return r === "deferred" ? (Tn(() => {
4619
+ return r === "deferred" ? (An(() => {
4620
4620
  t.play().catch((i) => C(e.label, "deferred play retry failed", { error: i?.name }));
4621
4621
  }), r) : r === "muted-bridge" ? (s(), r) : (t.muted = e.userWantsMuted, t.play().catch((i) => {
4622
4622
  i?.name === "NotAllowedError" && !e.userWantsMuted ? s() : i?.name !== "AbortError" && C(e.label, "video.play() failed", { error: i?.name, message: i?.message });
@@ -4838,15 +4838,15 @@ class Ao {
4838
4838
  });
4839
4839
  }
4840
4840
  }
4841
- let lt = null;
4841
+ let ct = null;
4842
4842
  function To() {
4843
- lt === null && (E("health", "Starting health reporting"), $n(), lt = window.setInterval($n, Ms));
4843
+ ct === null && (E("health", "Starting health reporting"), Ln(), ct = window.setInterval(Ln, Ms));
4844
4844
  }
4845
4845
  function Io() {
4846
- lt !== null && (E("health", "Stopping health reporting"), window.clearInterval(lt), lt = null);
4846
+ ct !== null && (E("health", "Stopping health reporting"), window.clearInterval(ct), ct = null);
4847
4847
  }
4848
- function $n() {
4849
- const t = Vn();
4848
+ function Ln() {
4849
+ const t = Kn();
4850
4850
  if (!t.connected) return;
4851
4851
  const e = x.getState();
4852
4852
  if (!e.snapshot.mediaId) return;
@@ -4864,7 +4864,7 @@ function $n() {
4864
4864
  (o < 0 || v < o) && (o = v);
4865
4865
  }
4866
4866
  const c = Math.max(0, a - s), u = o < 0 ? c : Math.min(c, o), f = e.drift.rtts.length > 0 ? e.drift.rtts.reduce((p, v) => p + v, 0) / e.drift.rtts.length : 0;
4867
- t.emit(zn.HEALTH_REPORT, {
4867
+ t.emit(Vn.HEALTH_REPORT, {
4868
4868
  avg_download_rate_bps: n.getAverageDownloadRate(),
4869
4869
  buffered_ahead_ms: u,
4870
4870
  audio_buffered_ahead_ms: o < 0 ? -1 : Math.round(o),
@@ -4936,7 +4936,7 @@ function Lo(t, e) {
4936
4936
  contentToken: n.content_token || null
4937
4937
  };
4938
4938
  }
4939
- function Pn(t) {
4939
+ function $n(t) {
4940
4940
  try {
4941
4941
  const e = performance.getEntriesByName(t, "resource");
4942
4942
  if (!e.length) return null;
@@ -4975,7 +4975,7 @@ function $o(t) {
4975
4975
  const u = await o.text(), f = Math.round(performance.now() - l) - c, p = JSON.parse(u), v = Math.round(performance.now() - l) - c - f, m = c + f + v;
4976
4976
  if (r.signal.aborted) return;
4977
4977
  n({ url: t, data: p });
4978
- const h = Pn(t);
4978
+ const h = $n(t);
4979
4979
  E("mse", "Index loaded", {
4980
4980
  attempt: i + 1,
4981
4981
  headerMs: c,
@@ -4993,13 +4993,13 @@ function $o(t) {
4993
4993
  } catch (o) {
4994
4994
  if (r.signal.aborted) return;
4995
4995
  i++;
4996
- const c = Math.round(performance.now() - l), u = Pn(t);
4996
+ const c = Math.round(performance.now() - l), u = $n(t);
4997
4997
  C("mse", `Index fetch attempt ${i} failed (${c}ms)`, {
4998
4998
  error: o?.message,
4999
4999
  elapsedMs: c,
5000
5000
  ...u && { timing: u }
5001
5001
  });
5002
- const f = i <= 1 ? 0 : ct(i - 1, { baseMs: 500, capMs: a, jitter: 0 });
5002
+ const f = i <= 1 ? 0 : ot(i - 1, { baseMs: 500, capMs: a, jitter: 0 });
5003
5003
  f > 0 && await new Promise((p) => setTimeout(p, f));
5004
5004
  }
5005
5005
  }
@@ -5009,15 +5009,15 @@ function $o(t) {
5009
5009
  };
5010
5010
  }, [t]), Ce(() => Lo(e, t), [e, t]);
5011
5011
  }
5012
- const Ot = {
5012
+ const Dt = {
5013
5013
  audioTracks: [],
5014
5014
  subtitleTracks: [],
5015
5015
  selectedAudioIndex: 0,
5016
5016
  selectedSubtitleIndex: 0
5017
5017
  };
5018
5018
  function Po(t) {
5019
- const [e, n] = $(Ot), r = As(), s = x((u) => u.mediaPrefs.preferredAudioLang), [i, a] = $(t);
5020
- i !== t && (a(t), t && n(Ot));
5019
+ const [e, n] = $(Dt), r = As(), s = x((u) => u.mediaPrefs.preferredAudioLang), [i, a] = $(t);
5020
+ i !== t && (a(t), t && n(Dt));
5021
5021
  const l = fe(() => ({ origin: Ts(r), preferredAudioLang: s }));
5022
5022
  L(() => {
5023
5023
  if (!t) return;
@@ -5031,7 +5031,7 @@ function Po(t) {
5031
5031
  } catch (m) {
5032
5032
  const h = Y(m);
5033
5033
  if (h.name === "AbortError") return;
5034
- C("mse", "Tracks fetch error", { mediaId: t, status: v?.status, ...h }), n(Ot);
5034
+ C("mse", "Tracks fetch error", { mediaId: t, status: v?.status, ...h }), n(Dt);
5035
5035
  }
5036
5036
  })().catch((m) => ee("mse", "Tracks load threw", { mediaId: t, ...Y(m) })), () => {
5037
5037
  u.abort();
@@ -5055,7 +5055,7 @@ const Bo = 100;
5055
5055
  function Do(t) {
5056
5056
  return !t.roomPlaying || t.videoPaused ? "not-playing" : t.seekInFlight ? "seeking" : t.advancedMs > Bo ? "advancing" : "stalled";
5057
5057
  }
5058
- const Ht = 4e4, Oo = 3e3;
5058
+ const Ot = 4e4, Oo = 3e3;
5059
5059
  function Ho(t, e, n, r, s, i) {
5060
5060
  const a = fe((w) => {
5061
5061
  const _ = {};
@@ -5114,7 +5114,7 @@ function Ho(t, e, n, r, s, i) {
5114
5114
  ...a(j)
5115
5115
  }), l(j, "silent-stall"), V) {
5116
5116
  V.reconcileLoadedStates();
5117
- const O = V.findNextRangeStart(j, $t);
5117
+ const O = V.findNextRangeStart(j, Lt);
5118
5118
  O !== null && D ? (C("sync", "SILENT-STALL gap-skip", {
5119
5119
  currentMs: Math.round(j),
5120
5120
  gapSkipTarget: Math.round(O)
@@ -5131,8 +5131,8 @@ function Ho(t, e, n, r, s, i) {
5131
5131
  });
5132
5132
  });
5133
5133
  }
5134
- if (N >= Ht) {
5135
- V?.dumpBufferDiagnostics(j, "silent-stall-reload"), zt("silent-stall", {
5134
+ if (N >= Ot) {
5135
+ V?.dumpBufferDiagnostics(j, "silent-stall-reload"), Kt("silent-stall", {
5136
5136
  frozenMs: N,
5137
5137
  currentTime: +S.currentTime.toFixed(2),
5138
5138
  readyState: S.readyState,
@@ -5167,7 +5167,7 @@ function Ho(t, e, n, r, s, i) {
5167
5167
  }
5168
5168
  if (D && !X?.seekInFlight && S > 0 && l(S, "waiting"), D && V && !X?.seekInFlight && S > 0) {
5169
5169
  V.reconcileLoadedStates();
5170
- const O = V.getBufferedAheadMs(S), Q = V.findNextRangeStart(S, $t);
5170
+ const O = V.getBufferedAheadMs(S), Q = V.findNextRangeStart(S, Lt);
5171
5171
  if (Q !== null && X)
5172
5172
  C("sync", "GAP-SKIP seeking over late-IDR gap", {
5173
5173
  currentMs: Math.round(S),
@@ -5186,7 +5186,7 @@ function Ho(t, e, n, r, s, i) {
5186
5186
  aheadInRangeMs: Math.round(W.aheadInRangeMs),
5187
5187
  nextRangeStartMs: Math.round(W.nextRangeStartMs),
5188
5188
  gapMs: W.gapMs !== null ? Math.round(W.gapMs) : null,
5189
- windowMs: $t
5189
+ windowMs: Lt
5190
5190
  }), V.fetchNearby(S).catch((re) => {
5191
5191
  const le = Y(re);
5192
5192
  le.name !== "AbortError" && C("sync", "Stall recovery fetchNearby failed", {
@@ -5199,8 +5199,8 @@ function Ho(t, e, n, r, s, i) {
5199
5199
  H && D && !c.current && (c.current = setTimeout(() => {
5200
5200
  c.current = null;
5201
5201
  const O = x.getState(), Q = !!O.snapshot.leaderId && O.snapshot.leaderId === O.me.clientId, W = !!n.current?.seekInFlight;
5202
- Q && !w.paused && w.readyState < 3 && !W && (C("sync", "Leader stall threshold reached — pausing room", { stallMs: bn }), u.current = !0, Pe("pause"));
5203
- }, bn)), D && !p.current && (v.current = w.currentTime, p.current = setTimeout(() => {
5202
+ Q && !w.paused && w.readyState < 3 && !W && (C("sync", "Leader stall threshold reached — pausing room", { stallMs: gn }), u.current = !0, Pe("pause"));
5203
+ }, gn)), D && !p.current && (v.current = w.currentTime, p.current = setTimeout(() => {
5204
5204
  p.current = null;
5205
5205
  const O = t.current;
5206
5206
  if (!O) return;
@@ -5214,15 +5214,15 @@ function Ho(t, e, n, r, s, i) {
5214
5214
  });
5215
5215
  return;
5216
5216
  }
5217
- re?.dumpBufferDiagnostics(O.currentTime * 1e3, "stuck-reload"), zt("stuck-watchdog", {
5218
- stuckMs: Ht,
5217
+ re?.dumpBufferDiagnostics(O.currentTime * 1e3, "stuck-reload"), Kt("stuck-watchdog", {
5218
+ stuckMs: Ot,
5219
5219
  advancedSec: +Fe.toFixed(2),
5220
5220
  currentTime: +O.currentTime.toFixed(2),
5221
5221
  readyState: O.readyState,
5222
5222
  bufferedAheadMs: Math.round(le),
5223
5223
  loaded: re?.getLoadedCount?.() ?? -1
5224
5224
  });
5225
- }, Ht));
5225
+ }, Ot));
5226
5226
  }
5227
5227
  function F() {
5228
5228
  oe.recordStallEnd(), c.current && (clearTimeout(c.current), c.current = null), p.current && (clearTimeout(p.current), p.current = null), y.current = null, R();
@@ -5275,9 +5275,9 @@ function jo(t, e, n, r, s, i) {
5275
5275
  s({ bufferedEndMs: y });
5276
5276
  }
5277
5277
  };
5278
- a.current = setInterval(v, yn);
5278
+ a.current = setInterval(v, bn);
5279
5279
  const m = () => {
5280
- performance.now() - p >= yn * Uo && v();
5280
+ performance.now() - p >= bn * Uo && v();
5281
5281
  };
5282
5282
  if (c && (c.addEventListener("timeupdate", m), l.current = () => c.removeEventListener("timeupdate", m)), c && !n.current?.seekInFlight) {
5283
5283
  p = performance.now();
@@ -5311,7 +5311,7 @@ function Go(t, e, n, r, s, i) {
5311
5311
  p && v ? (E("sync", "Play/pause sync", { playing: p, videoPaused: v, currentTime: Math.round(f.currentTime * 1e3) }), c(f)) : !p && !v && (E("sync", "Play/pause sync", { playing: p, videoPaused: v, currentTime: Math.round(f.currentTime * 1e3) }), u(f));
5312
5312
  }, [a.playing, r, t, e]);
5313
5313
  }
5314
- function Bn(t, e) {
5314
+ function Pn(t, e) {
5315
5315
  return new Promise((n, r) => {
5316
5316
  const s = setTimeout(n, t);
5317
5317
  e.addEventListener("abort", () => {
@@ -5329,16 +5329,16 @@ function Wo(t) {
5329
5329
  for (let o = 0; o < a.videos.length; o++) {
5330
5330
  if (l.signal.aborted) return;
5331
5331
  if (o === n) continue;
5332
- const c = a.videos[o], { mediaUrl: u, indexUrl: f } = Jn(c.mediaId), p = 3e3, v = async () => {
5332
+ const c = a.videos[o], { mediaUrl: u, indexUrl: f } = zn(c.mediaId), p = 3e3, v = async () => {
5333
5333
  for (; !l.signal.aborted && (t.current?.getPendingCount() ?? 0) !== 0; )
5334
5334
  try {
5335
- await Bn(2e3, l.signal);
5335
+ await Pn(2e3, l.signal);
5336
5336
  } catch {
5337
5337
  return !1;
5338
5338
  }
5339
5339
  if (l.signal.aborted) return !1;
5340
5340
  try {
5341
- await Bn(p, l.signal);
5341
+ await Pn(p, l.signal);
5342
5342
  } catch {
5343
5343
  return !1;
5344
5344
  }
@@ -5360,7 +5360,7 @@ function Wo(t) {
5360
5360
  }
5361
5361
  const { fragments: h, init_segment: y } = m;
5362
5362
  if (!h?.length) continue;
5363
- const w = rn(h, 0), _ = Te(h, Ie), R = ve.getInit(c.mediaId) !== void 0, k = ve.getBufferedMs(c.mediaId, h) >= Ie;
5363
+ const w = nn(h, 0), _ = Te(h, Ie), R = ve.getInit(c.mediaId) !== void 0, k = ve.getBufferedMs(c.mediaId, h) >= Ie;
5364
5364
  if (R && k) {
5365
5365
  E("prebuffer", `${c.mediaId} already fully pre-buffered, skipping`);
5366
5366
  continue;
@@ -5371,7 +5371,7 @@ function Wo(t) {
5371
5371
  const g = await fetch(u, {
5372
5372
  headers: {
5373
5373
  Range: `bytes=${y.start_byte}-${y.end_byte}`,
5374
- "X-Buffer-Ahead-Ms": String(vn)
5374
+ "X-Buffer-Ahead-Ms": String(yn)
5375
5375
  // background fetch — low priority
5376
5376
  },
5377
5377
  signal: l.signal
@@ -5394,7 +5394,7 @@ function Wo(t) {
5394
5394
  const F = await fetch(u, {
5395
5395
  headers: {
5396
5396
  Range: `bytes=${T.start_byte}-${T.end_byte}`,
5397
- "X-Buffer-Ahead-Ms": String(vn)
5397
+ "X-Buffer-Ahead-Ms": String(yn)
5398
5398
  },
5399
5399
  signal: l.signal
5400
5400
  });
@@ -5557,7 +5557,7 @@ function zo(t, e, n, r, s, i) {
5557
5557
  }, [t]);
5558
5558
  }
5559
5559
  const Jo = 3e5, Qo = 1, qo = 1;
5560
- function Ut(t) {
5560
+ function Ht(t) {
5561
5561
  ee("buffer", "initializePlayback threw", Y(t));
5562
5562
  }
5563
5563
  function Yo({ mediaUrl: t, indexUrl: e, mediaId: n }) {
@@ -5577,22 +5577,22 @@ function Yo({ mediaUrl: t, indexUrl: e, mediaId: n }) {
5577
5577
  if (!w) return null;
5578
5578
  const B = t.replace(new RegExp(`/${pt.replace(/\./g, "\\.")}$`), "");
5579
5579
  return B === t ? null : { baseUrl: B, token: w, trackId: M };
5580
- }, [w, t]), k = m !== null && y.length > 0, g = x((M) => M.readiness), T = P(!1), F = P(!1), b = P(null), S = P(null), I = P(null), D = P(0), H = P(0), j = P(null), [V, X] = $(0), N = P([]), O = P([]), Q = P(-1), W = P(!1), re = P(null), le = P(0), Fe = P(null), Ve = P(0), Et = x((M) => M.bufferState), Be = x((M) => M.setBufferState), {
5580
+ }, [w, t]), k = m !== null && y.length > 0, g = x((M) => M.readiness), T = P(!1), F = P(!1), b = P(null), S = P(null), I = P(null), D = P(0), H = P(0), j = P(null), [V, X] = $(0), N = P([]), O = P([]), Q = P(-1), W = P(!1), re = P(null), le = P(0), Fe = P(null), Ve = P(0), xt = x((M) => M.bufferState), Be = x((M) => M.setBufferState), {
5581
5581
  audioTracks: ye,
5582
5582
  subtitleTracks: De,
5583
5583
  selectedAudioIndex: we,
5584
- setSelectedAudioIndex: rt,
5584
+ setSelectedAudioIndex: nt,
5585
5585
  selectedSubtitleIndex: z,
5586
5586
  setSelectedSubtitleIndex: he
5587
- } = Po(n), Ee = x((M) => M.mediaPrefs), Mt = x((M) => M.mutedForAutoplay), Tr = x((M) => M.setMutedForAutoplay), an = x((M) => M.setSubtitlesEnabled), Ir = x((M) => M.setSubtitleStyle), kt = x((M) => M.setPreferredAudioLang), Cr = Ee.subtitlesEnabled, on = Ee.subtitleStyle, Fr = ye[we]?.lang, Rr = De.some((M) => M.lang === "eng"), [Nr, cn] = $(null), st = xo({
5587
+ } = Po(n), Ee = x((M) => M.mediaPrefs), Et = x((M) => M.mutedForAutoplay), Tr = x((M) => M.setMutedForAutoplay), sn = x((M) => M.setSubtitlesEnabled), Ir = x((M) => M.setSubtitleStyle), Mt = x((M) => M.setPreferredAudioLang), Cr = Ee.subtitlesEnabled, an = Ee.subtitleStyle, Fr = ye[we]?.lang, Rr = De.some((M) => M.lang === "eng"), [Nr, on] = $(null), rt = xo({
5588
5588
  override: Nr,
5589
5589
  globalEnabled: Cr,
5590
5590
  selectedAudioLang: Fr,
5591
5591
  hasEngSub: Rr
5592
5592
  }), Lr = U(() => {
5593
- const M = !st;
5594
- cn(M), an(M);
5595
- }, [st, an]), ht = U((M) => {
5593
+ const M = !rt;
5594
+ on(M), sn(M);
5595
+ }, [rt, sn]), ht = U((M) => {
5596
5596
  const B = x.getState();
5597
5597
  Mr(M, {
5598
5598
  userWantsMuted: B.mediaPrefs.muted,
@@ -5600,22 +5600,22 @@ function Yo({ mediaUrl: t, indexUrl: e, mediaId: n }) {
5600
5600
  onUnmuted: () => B.setMutedForAutoplay(!1),
5601
5601
  label: "video"
5602
5602
  });
5603
- }, []), ln = U((M) => {
5603
+ }, []), cn = U((M) => {
5604
5604
  M.pause();
5605
- }, []), [$r, dn] = $(0), [Pr, Br] = $(n);
5606
- Pr !== n && (Br(n), cn(null), dn(0)), L(() => {
5605
+ }, []), [$r, ln] = $(0), [Pr, Br] = $(n);
5606
+ Pr !== n && (Br(n), on(null), ln(0)), L(() => {
5607
5607
  const M = r.current;
5608
5608
  if (!M) return;
5609
5609
  const B = () => {
5610
- dn(Math.round(M.currentTime * 1e3));
5610
+ ln(Math.round(M.currentTime * 1e3));
5611
5611
  };
5612
5612
  return M.addEventListener("timeupdate", B), () => M.removeEventListener("timeupdate", B);
5613
5613
  }, []);
5614
- const at = U((M) => {
5614
+ const st = U((M) => {
5615
5615
  Be({ isBuffering: M });
5616
- }, [Be]), un = U((M) => {
5616
+ }, [Be]), dn = U((M) => {
5617
5617
  if (H.current >= qo) {
5618
- zt("phantom-recreate-exhausted", { reason: M, recreates: H.current, mediaId: n });
5618
+ Kt("phantom-recreate-exhausted", { reason: M, recreates: H.current, mediaId: n });
5619
5619
  return;
5620
5620
  }
5621
5621
  H.current += 1, D.current = 0, C("buffer", "MSE-RECREATE — rebuilding MediaSource to clear corrupt buffer", {
@@ -5623,7 +5623,7 @@ function Yo({ mediaUrl: t, indexUrl: e, mediaId: n }) {
5623
5623
  attempt: H.current
5624
5624
  }), X((B) => B + 1);
5625
5625
  }, [n]);
5626
- async function _t() {
5626
+ async function kt() {
5627
5627
  const M = I.current, B = r.current;
5628
5628
  if (!M || !p.length || F.current) return;
5629
5629
  const pe = x.getState().snapshot, K = pe.playheadMs || 0;
@@ -5655,7 +5655,7 @@ function Yo({ mediaUrl: t, indexUrl: e, mediaId: n }) {
5655
5655
  startMs: Math.round(K),
5656
5656
  recreateAttempt: H.current,
5657
5657
  mediaId: n
5658
- }), un("phantom-buffer");
5658
+ }), dn("phantom-buffer");
5659
5659
  return;
5660
5660
  }
5661
5661
  const Oe = Math.round(performance.now() - de);
@@ -5674,7 +5674,7 @@ function Yo({ mediaUrl: t, indexUrl: e, mediaId: n }) {
5674
5674
  }
5675
5675
  B.currentTime = q / 1e3, await kr(B, 3e3);
5676
5676
  }
5677
- le.current = q, i(!0), F.current = !0, D.current = 0, Ln() && C("buffer", "RECOVERY-SUCCESS — playback initialized after an auto-reload", { mediaId: n }), Mo(), E("buffer", "initializePlayback complete", {
5677
+ le.current = q, i(!0), F.current = !0, D.current = 0, Nn() && C("buffer", "RECOVERY-SUCCESS — playback initialized after an auto-reload", { mediaId: n }), Mo(), E("buffer", "initializePlayback complete", {
5678
5678
  mediaId: n,
5679
5679
  startMs: K,
5680
5680
  seekMs: q,
@@ -5745,12 +5745,12 @@ function Yo({ mediaUrl: t, indexUrl: e, mediaId: n }) {
5745
5745
  attempt: D.current,
5746
5746
  sbFull: ne,
5747
5747
  initFailed: J
5748
- }), un(ne ? "sourcebuffer-full" : J ? "init-failed" : "init-retry-cap")) : (ee("buffer", "Initialize playback error — will retry in 3s", {
5748
+ }), dn(ne ? "sourcebuffer-full" : J ? "init-failed" : "init-retry-cap")) : (ee("buffer", "Initialize playback error — will retry in 3s", {
5749
5749
  error: te,
5750
5750
  mediaId: n,
5751
5751
  attempt: D.current
5752
5752
  }), setTimeout(() => {
5753
- I.current && !M.isDisposed && !F.current && (E("buffer", "Retrying initializePlayback"), _t().catch(Ut));
5753
+ I.current && !M.isDisposed && !F.current && (E("buffer", "Retrying initializePlayback"), kt().catch(Ht));
5754
5754
  }, 3e3));
5755
5755
  }
5756
5756
  }
@@ -5761,7 +5761,7 @@ function Yo({ mediaUrl: t, indexUrl: e, mediaId: n }) {
5761
5761
  mseAudioTracks: y,
5762
5762
  fragments: p,
5763
5763
  deliveryFor: _,
5764
- initializePlayback: _t
5764
+ initializePlayback: kt
5765
5765
  }));
5766
5766
  L(() => {
5767
5767
  if (!m) return;
@@ -5774,7 +5774,7 @@ function Yo({ mediaUrl: t, indexUrl: e, mediaId: n }) {
5774
5774
  initializePlayback: ie
5775
5775
  } = Dr();
5776
5776
  j.current !== n && (j.current = n, H.current = 0, D.current = 0);
5777
- const te = Ln();
5777
+ const te = Nn();
5778
5778
  te && C("buffer", "POST-AUTO-RELOAD — this load follows an auto-reload recovery", {
5779
5779
  reloadAtMs: te,
5780
5780
  sinceReloadMs: Date.now() - te,
@@ -5783,7 +5783,7 @@ function Yo({ mediaUrl: t, indexUrl: e, mediaId: n }) {
5783
5783
  let ne = null;
5784
5784
  const J = new MediaSource();
5785
5785
  S.current = J;
5786
- const xe = new Ze(at);
5786
+ const xe = new Ze(st);
5787
5787
  I.current = xe;
5788
5788
  const Oe = ++Ve.current;
5789
5789
  window.__FRAGMENT_MANAGER__ = xe, window.__AUDIO_FRAGMENT_MANAGERS__ = N.current;
@@ -5827,7 +5827,7 @@ function Yo({ mediaUrl: t, indexUrl: e, mediaId: n }) {
5827
5827
  });
5828
5828
  });
5829
5829
  const Re = new Ze(
5830
- at,
5830
+ st,
5831
5831
  { suppressEndOfStream: !0, label: `audio:${ue.track_id}` }
5832
5832
  );
5833
5833
  Re.setSourceBuffer(_e, J), N.current.push(Re), O.current.push(_e), Q.current = ae, E("mse", `Audio SB added: codec=${me} track=${ue.track_id} lang=${ue.lang} idx=${ae}`);
@@ -5851,7 +5851,7 @@ function Yo({ mediaUrl: t, indexUrl: e, mediaId: n }) {
5851
5851
  ), ue.epoch = Oe;
5852
5852
  }
5853
5853
  }
5854
- ie().catch(Ut);
5854
+ ie().catch(Ht);
5855
5855
  }
5856
5856
  } catch (G) {
5857
5857
  C("buffer", "MSE source error", { error: G?.message });
@@ -5875,7 +5875,7 @@ function Yo({ mediaUrl: t, indexUrl: e, mediaId: n }) {
5875
5875
  }
5876
5876
  Fe.current?.(), F.current = !1, T.current = !1, b.current = null, i(!1);
5877
5877
  };
5878
- }, [t, n, m, h, at, V]);
5878
+ }, [t, n, m, h, st, V]);
5879
5879
  const Or = fe(() => {
5880
5880
  const M = I.current, B = Ve.current;
5881
5881
  if (S.current?.readyState === "open" && b.current && p.length && M) {
@@ -5893,7 +5893,7 @@ function Yo({ mediaUrl: t, indexUrl: e, mediaId: n }) {
5893
5893
  ), de.epoch = B;
5894
5894
  }
5895
5895
  }
5896
- F.current || _t().catch(Ut);
5896
+ F.current || kt().catch(Ht);
5897
5897
  }
5898
5898
  });
5899
5899
  L(() => {
@@ -5905,12 +5905,12 @@ function Yo({ mediaUrl: t, indexUrl: e, mediaId: n }) {
5905
5905
  };
5906
5906
  return window.addEventListener("watchparty:socket-reconnect", M), () => window.removeEventListener("watchparty:socket-reconnect", M);
5907
5907
  }, []), L(() => (window.__AUDIO_SELECT__ = (M) => {
5908
- rt(M);
5908
+ nt(M);
5909
5909
  const B = ye[M];
5910
- B?.lang && kt(B.lang);
5910
+ B?.lang && Mt(B.lang);
5911
5911
  }, () => {
5912
5912
  window.__AUDIO_SELECT__ = null;
5913
- }), [ye, rt, kt]), L(() => {
5913
+ }), [ye, nt, Mt]), L(() => {
5914
5914
  if (!k || !s || we < 0 || we >= y.length || we === Q.current) return;
5915
5915
  if (W.current) {
5916
5916
  E("audio", "MSE audio swap requested while another in flight — deferring");
@@ -5952,7 +5952,7 @@ function Yo({ mediaUrl: t, indexUrl: e, mediaId: n }) {
5952
5952
  return;
5953
5953
  }
5954
5954
  const J = new Ze(
5955
- at,
5955
+ st,
5956
5956
  { suppressEndOfStream: !0, label: `audio:${K.track_id}` }
5957
5957
  );
5958
5958
  J.setSourceBuffer(ne, M);
@@ -5975,17 +5975,17 @@ function Yo({ mediaUrl: t, indexUrl: e, mediaId: n }) {
5975
5975
  W.current = !1;
5976
5976
  }
5977
5977
  })().catch((te) => ee("audio", "MSE audio swap failed", Y(te)));
5978
- }, [k, s, we, y, n, t, at, _]), Go(re, r, le, s, ht, ln), Ho(r, I, re, s, ln, N), zo(r, re, n, v ?? 0, s, ht);
5979
- const { stopPrefetch: fn } = jo(r, I, re, s, Be, N);
5978
+ }, [k, s, we, y, n, t, st, _]), Go(re, r, le, s, ht, cn), Ho(r, I, re, s, cn, N), zo(r, re, n, v ?? 0, s, ht);
5979
+ const { stopPrefetch: un } = jo(r, I, re, s, Be, N);
5980
5980
  Wo(I), L(() => {
5981
- Fe.current = fn;
5982
- }, [fn]);
5981
+ Fe.current = un;
5982
+ }, [un]);
5983
5983
  const Hr = U(() => {
5984
5984
  const M = r.current?.parentElement;
5985
5985
  M && (document.fullscreenElement ? document.exitFullscreen().catch((B) => C("ui", "exitFullscreen failed", Y(B))) : M.requestFullscreen().catch((B) => C("ui", "requestFullscreen failed", Y(B))));
5986
5986
  }, []), Ur = U((M) => {
5987
5987
  M.preventDefault();
5988
- }, []), jr = st && De[z] ? De[z].url : null;
5988
+ }, []), jr = rt && De[z] ? De[z].url : null;
5989
5989
  return /* @__PURE__ */ A(
5990
5990
  "div",
5991
5991
  {
@@ -6009,8 +6009,8 @@ function Yo({ mediaUrl: t, indexUrl: e, mediaId: n }) {
6009
6009
  {
6010
6010
  subtitleUrl: jr,
6011
6011
  videoRef: r,
6012
- style: on,
6013
- enabled: st
6012
+ style: an,
6013
+ enabled: rt
6014
6014
  }
6015
6015
  ),
6016
6016
  /* @__PURE__ */ d(Yi, { mediaId: n, visible: o }),
@@ -6025,22 +6025,22 @@ function Yo({ mediaUrl: t, indexUrl: e, mediaId: n }) {
6025
6025
  audioTracks: ye,
6026
6026
  selectedAudioIndex: we,
6027
6027
  onAudioSelect: (M) => {
6028
- rt(M);
6028
+ nt(M);
6029
6029
  const B = ye[M];
6030
- B?.lang && kt(B.lang);
6030
+ B?.lang && Mt(B.lang);
6031
6031
  },
6032
6032
  subtitleTracks: De,
6033
6033
  selectedSubtitleIndex: z,
6034
6034
  onSubtitleSelect: he,
6035
- subtitlesEnabled: st,
6035
+ subtitlesEnabled: rt,
6036
6036
  onSubtitlesToggle: Lr,
6037
- subtitleStyle: on,
6037
+ subtitleStyle: an,
6038
6038
  onSubtitleStyleChange: Ir,
6039
6039
  onChatActivity: () => c(5e3),
6040
6040
  onMenuHeld: f
6041
6041
  }
6042
6042
  ),
6043
- Mt && /* @__PURE__ */ A(
6043
+ Et && /* @__PURE__ */ A(
6044
6044
  "button",
6045
6045
  {
6046
6046
  type: "button",
@@ -6055,7 +6055,7 @@ function Yo({ mediaUrl: t, indexUrl: e, mediaId: n }) {
6055
6055
  ]
6056
6056
  }
6057
6057
  ),
6058
- Et.isBuffering && g.ready && /* @__PURE__ */ d("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none", children: /* @__PURE__ */ A("div", { className: "flex flex-col items-center gap-2", children: [
6058
+ xt.isBuffering && g.ready && /* @__PURE__ */ d("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none", children: /* @__PURE__ */ A("div", { className: "flex flex-col items-center gap-2", children: [
6059
6059
  /* @__PURE__ */ d("div", { className: "w-8 h-8 border-2 border-text border-t-transparent rounded-full animate-spin" }),
6060
6060
  /* @__PURE__ */ d("div", { className: "px-4 py-2 rounded bg-wp-surface-2/80 text-xs font-medium", children: "Buffering…" })
6061
6061
  ] }) })
@@ -6064,8 +6064,8 @@ function Yo({ mediaUrl: t, indexUrl: e, mediaId: n }) {
6064
6064
  );
6065
6065
  }
6066
6066
  function Xo() {
6067
- const t = x((n) => n.snapshot.mediaId), e = Ce(() => t ? { mediaId: t, ...Jn(t) } : null, [t]);
6068
- return e ? /* @__PURE__ */ d(Wt, { children: /* @__PURE__ */ d(Yo, { mediaUrl: e.mediaUrl, indexUrl: e.indexUrl, mediaId: e.mediaId }) }) : /* @__PURE__ */ d($s, {});
6067
+ const t = x((n) => n.snapshot.mediaId), e = Ce(() => t ? { mediaId: t, ...zn(t) } : null, [t]);
6068
+ return e ? /* @__PURE__ */ d(Zn, { children: /* @__PURE__ */ d(Yo, { mediaUrl: e.mediaUrl, indexUrl: e.indexUrl, mediaId: e.mediaId }) }) : /* @__PURE__ */ d($s, {});
6069
6069
  }
6070
6070
  const Zo = (t) => {
6071
6071
  const e = Ks(t);
@@ -6088,17 +6088,17 @@ const Zo = (t) => {
6088
6088
  id: "player",
6089
6089
  name: "Media player",
6090
6090
  load: () => Promise.resolve(ec)
6091
- }, nc = vt(() => import("./MediaDrawer-Dx5XhHiF.js")), rc = vt(() => import("./GameModule-CPrQCsQN.js"));
6092
- function sc() {
6093
- const t = x((u) => u.snapshot), e = x((u) => u.ensureAutoIdentity), n = xt(), r = Ce(
6094
- () => n?.kind === "module" ? ja(n, window.location.origin) : null,
6091
+ }, nc = Jt(() => import("./MediaDrawer-DnJ2bjL7.js"));
6092
+ function rc() {
6093
+ const t = x((u) => u.snapshot), e = x((u) => u.ensureAutoIdentity), n = wt(), r = Ce(
6094
+ () => n ? ja(n, window.location.origin) : null,
6095
6095
  [n]
6096
6096
  ), s = Ps(), i = P(!1), [a, l] = $(!1), o = s.roomKey || null;
6097
6097
  Mi(), L(() => ki(), []), L(() => {
6098
6098
  o && Ii(o);
6099
6099
  }, [o]), L(() => {
6100
6100
  const u = () => l(!0);
6101
- return window.addEventListener(Gt, u), () => window.removeEventListener(Gt, u);
6101
+ return window.addEventListener(jt, u), () => window.removeEventListener(jt, u);
6102
6102
  }, []), L(() => {
6103
6103
  if (!o || i.current) return;
6104
6104
  let u = !1;
@@ -6109,7 +6109,7 @@ function sc() {
6109
6109
  Promise.all([
6110
6110
  Bs(),
6111
6111
  Ds(),
6112
- Os().then(Kn)
6112
+ Os().then(Wn)
6113
6113
  ]),
6114
6114
  new Promise((m) => setTimeout(m, f))
6115
6115
  ]);
@@ -6134,9 +6134,8 @@ function sc() {
6134
6134
  }
6135
6135
  return o ? /* @__PURE__ */ A("div", { className: "relative flex-1 flex overflow-hidden min-h-0", children: [
6136
6136
  /* @__PURE__ */ A("div", { className: "flex-1 relative bg-black overflow-hidden min-w-0", children: [
6137
- /* @__PURE__ */ d(xn, { activity: tc, roomKey: t.roomId ?? "", layer: "base" }),
6138
- n?.kind === "iframe" && /* @__PURE__ */ d(Wt, { children: /* @__PURE__ */ d(et.Suspense, { fallback: null, children: /* @__PURE__ */ d(rc, {}) }) }),
6139
- r && t.roomId && /* @__PURE__ */ d(Wt, { children: /* @__PURE__ */ d(xn, { activity: r, roomKey: t.roomId, layer: "overlay" }, r.id) }),
6137
+ /* @__PURE__ */ d(wn, { activity: tc, roomKey: t.roomId ?? "", layer: "base" }),
6138
+ r && t.roomId && /* @__PURE__ */ d(Zn, { children: /* @__PURE__ */ d(wn, { activity: r, roomKey: t.roomId, layer: "overlay" }, r.id) }),
6140
6139
  /* @__PURE__ */ A(oi, { children: [
6141
6140
  /* @__PURE__ */ d(Qa, {}),
6142
6141
  /* @__PURE__ */ d(si, {}),
@@ -6145,27 +6144,27 @@ function sc() {
6145
6144
  ] })
6146
6145
  ] }),
6147
6146
  /* @__PURE__ */ d(Oa, {}),
6148
- /* @__PURE__ */ d(et.Suspense, { fallback: /* @__PURE__ */ d(Va, { open: a, onClose: c }), children: /* @__PURE__ */ d(nc, { open: a, onClose: c }) })
6147
+ /* @__PURE__ */ d(lt.Suspense, { fallback: /* @__PURE__ */ d(Va, { open: a, onClose: c }), children: /* @__PURE__ */ d(nc, { open: a, onClose: c }) })
6149
6148
  ] }) : (C("room", "No room key provided"), /* @__PURE__ */ d("div", { className: "flex-1 flex items-center justify-center p-6", children: /* @__PURE__ */ A("div", { className: "text-text-secondary", children: [
6150
6149
  "No room key provided. Go to the ",
6151
6150
  /* @__PURE__ */ d("a", { href: "/", className: "underline", children: "home page" }),
6152
6151
  " to select a room."
6153
6152
  ] }) }));
6154
6153
  }
6155
- const gc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6154
+ const mc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6156
6155
  __proto__: null,
6157
- default: sc
6156
+ default: rc
6158
6157
  }, Symbol.toStringTag, { value: "Module" }));
6159
6158
  export {
6160
- hc as B,
6159
+ fc as B,
6161
6160
  Ka as D,
6162
- gc as R,
6163
- pc as S,
6161
+ mc as R,
6162
+ hc as S,
6164
6163
  Wa as a,
6165
6164
  Ci as b,
6166
- fc as c,
6167
- nt as d,
6168
- mc as s,
6169
- nn as u
6165
+ uc as c,
6166
+ tt as d,
6167
+ pc as s,
6168
+ tn as u
6170
6169
  };
6171
- //# sourceMappingURL=Room-Bnjk24LE.js.map
6170
+ //# sourceMappingURL=Room-H5597D2i.js.map