@hadoku/watchparty-ui 0.45.79 → 0.45.81

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.
@@ -1,11 +1,11 @@
1
1
  import { jsx as d, jsxs as k, Fragment as ye } from "react/jsx-runtime";
2
2
  import Ke, { useState as $, useRef as N, useEffect as F, useCallback as j, useMemo as Me, Component as vs, useContext as Zn, createContext as er, useId as Ss, useEffectEvent as ue } from "react";
3
- import { k as ws, M as Es, m as xs, f as Ms, a as ks, C as mt, g as rn, i as _s, S as As, b as Ts, r as _t, d as E, e as ee, u as x, c as Is, h as Cs, A as vt, j as Rs, l as st, n as tr, o as nr, D as dt, w as I, p as Fs, q as Ls, s as rr, t as sr, v as ar, x as Ns, L as $s, y as Ps, z as sn, B as Ds, E as Bs, F as Os, G as Hs, H as ir, I as an, J as or, K as cr, N as Us, O as js, P as Fe, Q as Sn, T as Nt, R as Gs, U as lr, V as Ws, W as Ks, X as Vs, Y as dr, Z as zs, _ as Y, $ as Js, a0 as ur, a1 as fr, a2 as tt, a3 as Qs, a4 as qs, a5 as Ys, a6 as Xs, a7 as Zs, a8 as wn, a9 as Qe, aa as ea, ab as En, ac as ta, ad as na, ae as xn, af as ra, ag as sa, ah as aa, ai as ia, aj as oa, ak as Mn, al as kn, am as ca, an as hr, ao as _n, ap as la, aq as Et, ar as da, as as ua, at as fa, au as ha, av as pa, aw as ma, ax as ga, ay as ba, az as ya, aA as va, aB as Sa } from "./index-CHLN_zOS.js";
3
+ import { k as ws, M as Es, m as xs, f as Ms, a as ks, C as mt, g as rn, i as _s, S as As, b as Ts, r as _t, d as E, e as ee, u as x, c as Is, h as Cs, A as vt, j as Rs, l as st, n as tr, o as nr, D as dt, w as I, p as Fs, q as Ls, s as rr, t as sr, v as ar, x as Ns, L as $s, y as Ps, z as sn, B as Ds, E as Bs, F as Os, G as ir, H as an, I as or, J as cr, K as Hs, N as Us, O as Fe, P as Sn, T as Nt, Q as js, R as lr, U as Gs, V as Ws, W as Ks, X as dr, Y as Vs, Z as Y, _ as zs, $ as ur, a0 as fr, a1 as tt, a2 as Js, a3 as Qs, a4 as qs, a5 as Ys, a6 as Xs, a7 as wn, a8 as Qe, a9 as Zs, aa as En, ab as ea, ac as ta, ad as xn, ae as na, af as ra, ag as sa, ah as aa, ai as ia, aj as Mn, ak as kn, al as oa, am as hr, an as _n, ao as ca, ap as Et, aq as la, ar as da, as as ua, at as fa, au as ha, av as pa, aw as ma, ax as ga, ay as ba, az as ya, aA as va } from "./index-C1isVbwB.js";
4
4
  import { createPortal as Tt } from "react-dom";
5
- import { Icon as gt, THEMES as wa, useHadokuThemeOptional as Ea } from "@wolffm/themes";
6
- import { HadokuThemePicker as xa, ConnectedSettings as Ma } from "@wolffm/task-ui-components";
7
- import { createRoot as ka } from "react-dom/client";
8
- function _a(t) {
5
+ import { Icon as gt, THEMES as Sa, useHadokuThemeOptional as wa } from "@wolffm/themes";
6
+ import { HadokuThemePicker as Ea, ConnectedSettings as xa } from "@wolffm/task-ui-components";
7
+ import { createRoot as Ma } from "react-dom/client";
8
+ function ka(t) {
9
9
  return t.kind === "file";
10
10
  }
11
11
  class pr extends Error {
@@ -33,42 +33,42 @@ function kt(t) {
33
33
  return "Image upload failed";
34
34
  }
35
35
  }
36
- function Aa(t) {
36
+ function _a(t) {
37
37
  return t instanceof mt ? kt(t.reason) : t instanceof pr ? t.message : "Image upload failed";
38
38
  }
39
- function Ta(t) {
39
+ function Aa(t) {
40
40
  const e = t.type.toLowerCase().split(";")[0].trim();
41
41
  return e && ws(e) !== "image" ? kt("unsupported-type") : t.size > Es.image ? kt("too-large") : t.size === 0 ? kt("invalid") : null;
42
42
  }
43
- function Ia(t) {
43
+ function Ta(t) {
44
44
  return Ms(t);
45
45
  }
46
- function Ca(t) {
46
+ function Ia(t) {
47
47
  return ks(t);
48
48
  }
49
- async function Ra(t) {
49
+ async function Ca(t) {
50
50
  const e = await xs(t);
51
51
  return { w: e?.width ?? 0, h: e?.height ?? 0 };
52
52
  }
53
- async function Fa(t, e = {}) {
53
+ async function Ra(t, e = {}) {
54
54
  const n = await rn().upload(t, { signal: e.signal });
55
55
  if (!_s(n.key))
56
56
  throw new pr("Image upload returned an unusable key");
57
57
  return { key: n.key, deduplicated: n.deduplicated === !0 };
58
58
  }
59
- async function La(t, e = {}) {
59
+ async function Fa(t, e = {}) {
60
60
  const n = [];
61
61
  for (const r of t) {
62
62
  if (r.kind === "remote") {
63
63
  n.push({ key: r.key, w: r.w, h: r.h, ...r.title ? { title: r.title } : {} });
64
64
  continue;
65
65
  }
66
- const { key: s } = await Fa(r.file, e);
66
+ const { key: s } = await Ra(r.file, e);
67
67
  n.push({ key: s, w: r.w, h: r.h });
68
68
  }
69
69
  return n;
70
70
  }
71
- function Na(t) {
71
+ function La(t) {
72
72
  return {
73
73
  error: t instanceof Error ? t.message : String(t),
74
74
  name: t instanceof Error ? t.name : typeof t,
@@ -76,14 +76,14 @@ function Na(t) {
76
76
  status: t instanceof mt ? t.status : void 0
77
77
  };
78
78
  }
79
- function $a(t) {
79
+ function Na(t) {
80
80
  const e = N(t);
81
81
  return F(() => {
82
82
  e.current = t;
83
83
  }), [e, `${t.cdnBase}|${t.uploadPath}`];
84
84
  }
85
- function Pa(t, e, n, r = {}) {
86
- const { limit: s, debounceMs: i = As } = r, [a, c] = $a(t), [l, o] = $([]), [u, f] = $(null), [h, g] = $(!1), [b, p] = $(null), [v, S] = $(0), A = N(null);
85
+ function $a(t, e, n, r = {}) {
86
+ const { limit: s, debounceMs: i = As } = r, [a, c] = Na(t), [l, o] = $([]), [u, f] = $(null), [h, g] = $(!1), [b, p] = $(null), [v, S] = $(0), A = N(null);
87
87
  F(() => {
88
88
  S(0), f(null);
89
89
  }, [n, e]), F(() => {
@@ -130,7 +130,7 @@ function Pa(t, e, n, r = {}) {
130
130
  function Ve(t) {
131
131
  return t.key === "Escape" || t.key === "GoBack" || t.key === "BrowserBack" || t.key === "XF86Back" || t.keyCode === 461 || t.keyCode === 10009;
132
132
  }
133
- const Da = /* @__PURE__ */ new Set([
133
+ const Pa = /* @__PURE__ */ new Set([
134
134
  "Enter",
135
135
  " ",
136
136
  "ArrowLeft",
@@ -140,15 +140,15 @@ const Da = /* @__PURE__ */ new Set([
140
140
  "MediaPlayPause",
141
141
  "Select"
142
142
  ]);
143
- function Ba(t) {
143
+ function Da(t) {
144
144
  const { key: e, back: n, modifier: r, barVisible: s, focus: i } = t;
145
145
  if (r || i === "text") return "ignore";
146
146
  if (i === "elsewhere") return n ? "ignore" : "show";
147
147
  if (n) return i === "bar" && s ? "leave-bar" : "ignore";
148
- const a = Da.has(e);
148
+ const a = Pa.has(e);
149
149
  return i === "bar" ? !s && a ? "wake" : "show" : a ? "enter-bar" : "show";
150
150
  }
151
- function Oa(t, e, n = !1, r = { atStart: !1, atEnd: !1 }) {
151
+ function Ba(t, e, n = !1, r = { atStart: !1, atEnd: !1 }) {
152
152
  const s = t === "ArrowLeft" ? -1 : t === "ArrowRight" ? 1 : null, i = t === "ArrowUp" ? -1 : t === "ArrowDown" ? 1 : null;
153
153
  switch (e) {
154
154
  case "range":
@@ -169,9 +169,9 @@ const et = "data-remote-engaged";
169
169
  function mr(t) {
170
170
  return t instanceof HTMLSelectElement ? "select" : t instanceof HTMLInputElement ? t.type === "range" ? "range" : "text" : t instanceof HTMLTextAreaElement ? "text" : "button";
171
171
  }
172
- const Ha = 'button:not([disabled]), input:not([disabled]), select:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])';
172
+ const Oa = 'button:not([disabled]), input:not([disabled]), select:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])';
173
173
  function gr(t) {
174
- return Array.from(t.querySelectorAll(Ha)).filter((e) => e.tabIndex >= 0 && e.getClientRects().length > 0);
174
+ return Array.from(t.querySelectorAll(Oa)).filter((e) => e.tabIndex >= 0 && e.getClientRects().length > 0);
175
175
  }
176
176
  function br(t) {
177
177
  const e = gr(t);
@@ -180,17 +180,17 @@ function br(t) {
180
180
  function yr(t) {
181
181
  return t ? t instanceof HTMLTextAreaElement ? !0 : t instanceof HTMLInputElement ? !["range", "checkbox", "radio", "button", "submit"].includes(t.type) : t.isContentEditable === !0 : !1;
182
182
  }
183
- const qt = 240, je = 8, Ua = 28, vr = 240;
184
- function ja(t, e, n) {
183
+ const qt = 240, je = 8, Ha = 28, vr = 240;
184
+ function Ua(t, e, n) {
185
185
  let r = e.left - qt - je;
186
186
  r < je && (r = e.right + je), r = Math.min(r, n.width - qt - je), r = Math.max(je, r);
187
- const s = vr + Ua;
187
+ const s = vr + Ha;
188
188
  let i = t.top + t.height / 2 - s / 2;
189
189
  return i = Math.min(i, n.height - s - je), i = Math.max(je, i), { left: r, top: i };
190
190
  }
191
- const Sr = "/dataplatform/api/memes", Ga = 120;
192
- function Wa({ onClose: t, onPick: e, onUnavailable: n }) {
193
- const [r, s] = $(""), i = N(null), a = N(null), c = rn(), { items: l, loading: o, error: u, hasMore: f, loadMore: h } = Pa(
191
+ const Sr = "/dataplatform/api/memes", ja = 120;
192
+ function Ga({ onClose: t, onPick: e, onUnavailable: n }) {
193
+ const [r, s] = $(""), i = N(null), a = N(null), c = rn(), { items: l, loading: o, error: u, hasMore: f, loadMore: h } = $a(
194
194
  c,
195
195
  Sr,
196
196
  r.trim()
@@ -207,12 +207,12 @@ function Wa({ onClose: t, onPick: e, onUnavailable: n }) {
207
207
  if (!P) return;
208
208
  const O = () => v({
209
209
  item: y,
210
- ...ja(w.getBoundingClientRect(), P.getBoundingClientRect(), {
210
+ ...Ua(w.getBoundingClientRect(), P.getBoundingClientRect(), {
211
211
  width: window.innerWidth,
212
212
  height: window.innerHeight
213
213
  })
214
214
  });
215
- A(), C ? O() : S.current = window.setTimeout(O, Ga);
215
+ A(), C ? O() : S.current = window.setTimeout(O, ja);
216
216
  },
217
217
  [A]
218
218
  );
@@ -358,17 +358,127 @@ function Wa({ onClose: t, onPick: e, onUnavailable: n }) {
358
358
  );
359
359
  }
360
360
  function wr({ open: t, ...e }) {
361
- return t ? /* @__PURE__ */ d(Wa, { ...e }) : null;
361
+ return t ? /* @__PURE__ */ d(Ga, { ...e }) : null;
362
362
  }
363
- function Ka(t) {
363
+ function Wa(t) {
364
364
  return typeof t == "object" && t !== null && typeof t.mount == "function";
365
365
  }
366
- function Va(t) {
366
+ function Ka(t) {
367
367
  if (typeof t != "object" || t === null)
368
368
  return !1;
369
369
  const e = t;
370
370
  return typeof e.unmount == "function" && typeof e.update == "function" && (e.mountSettings === void 0 || typeof e.mountSettings == "function");
371
371
  }
372
+ function Va(t) {
373
+ if (!t.startsWith("/") || t.startsWith("//") || /[\\\s]/.test(t) || [...t].some((e) => e.charCodeAt(0) < 32 || e.charCodeAt(0) === 127))
374
+ return !1;
375
+ try {
376
+ return new URL(t, "https://game-catalog.invalid").origin === "https://game-catalog.invalid";
377
+ } catch {
378
+ return !1;
379
+ }
380
+ }
381
+ function za(t, e) {
382
+ if (!Va(t))
383
+ return null;
384
+ const n = new URL(t, e);
385
+ return n.origin === e ? n.href : null;
386
+ }
387
+ function Ja(t, e) {
388
+ const n = za(t.url, e);
389
+ return { id: t.id, name: t.name, load: n ? () => import(
390
+ /* @vite-ignore */
391
+ n
392
+ ) : null };
393
+ }
394
+ const qe = (t) => t instanceof Error ? t.message : String(t);
395
+ function Qa(t) {
396
+ let e = t.ctx, n = null, r = !1, s = !1;
397
+ const i = /* @__PURE__ */ new Set(), a = (h, g) => t.onSettingsError?.(h, g), c = (h) => {
398
+ if (i.delete(h))
399
+ try {
400
+ h.cleanup();
401
+ } catch (g) {
402
+ a(`the game's settings failed to close: ${qe(g)}`, g);
403
+ }
404
+ }, l = (h) => {
405
+ for (const g of [...i])
406
+ c(g);
407
+ h.mountSettings && t.onSettingsAvailable?.(!1);
408
+ }, o = (h) => {
409
+ l(h);
410
+ try {
411
+ h.unmount();
412
+ } catch (g) {
413
+ s || t.onError(`unmount threw: ${qe(g)}`, g);
414
+ }
415
+ }, u = (h, g) => {
416
+ if (s || r)
417
+ return;
418
+ s = !0;
419
+ const b = n;
420
+ n = null, b && o(b), t.onError(h, g);
421
+ }, f = (h) => {
422
+ if (e = h, !(!n || r))
423
+ try {
424
+ n.update(h);
425
+ } catch (g) {
426
+ u(`the game failed to update: ${qe(g)}`, g);
427
+ }
428
+ };
429
+ return (async () => {
430
+ let h;
431
+ try {
432
+ h = await t.load();
433
+ } catch (p) {
434
+ u(`could not load the game: ${qe(p)}`, p);
435
+ return;
436
+ }
437
+ if (r)
438
+ return;
439
+ if (!Wa(h)) {
440
+ u("the game module does not export mount()");
441
+ return;
442
+ }
443
+ const g = e;
444
+ let b;
445
+ try {
446
+ b = await h.mount(t.el, g);
447
+ } catch (p) {
448
+ u(`the game failed to start: ${qe(p)}`, p);
449
+ return;
450
+ }
451
+ if (!Ka(b)) {
452
+ u("the game's mount() did not return { unmount, update }");
453
+ return;
454
+ }
455
+ if (r) {
456
+ o(b);
457
+ return;
458
+ }
459
+ n = b, b.mountSettings && t.onSettingsAvailable?.(!0), e !== g && f(e);
460
+ })(), {
461
+ update: f,
462
+ dispose() {
463
+ r || (r = !0, n && o(n), n = null);
464
+ },
465
+ mountSettings(h) {
466
+ const g = n;
467
+ if (!g?.mountSettings || r)
468
+ return null;
469
+ let b;
470
+ try {
471
+ b = g.mountSettings(h);
472
+ } catch (v) {
473
+ return a(`the game's settings failed to open: ${qe(v)}`, v), null;
474
+ }
475
+ if (typeof b != "function")
476
+ return a("the game's mountSettings() did not return a cleanup function"), null;
477
+ const p = { cleanup: b };
478
+ return i.add(p), () => c(p);
479
+ }
480
+ };
481
+ }
372
482
  const Yt = "watchparty:open-media-drawer";
373
483
  function Er(t) {
374
484
  E("navigation", `Select Media clicked (${t})`), window.dispatchEvent(new CustomEvent(Yt));
@@ -407,7 +517,7 @@ function It() {
407
517
  function Ct(t) {
408
518
  return t.hasMedia && (t.chatCollapsed || t.isFullscreen);
409
519
  }
410
- function za(t, e) {
520
+ function qa(t, e) {
411
521
  return t && Ct(e);
412
522
  }
413
523
  function on(t) {
@@ -416,7 +526,7 @@ function on(t) {
416
526
  function Mr(t) {
417
527
  return t.hasMedia ? t.gameOverlay && !t.isFullscreen ? "room-corner" : "control-bar" : "none";
418
528
  }
419
- function Ja(t, e) {
529
+ function Ya(t, e) {
420
530
  if (e.clientId) {
421
531
  const n = t[e.clientId];
422
532
  if (n && (!e.author || !n.author || n.author === e.author)) return n;
@@ -426,7 +536,7 @@ function Ja(t, e) {
426
536
  }
427
537
  }
428
538
  function kr(t, e, n) {
429
- const r = Ja(t, e);
539
+ const r = Ya(t, e);
430
540
  return r ? {
431
541
  name: r.name || n.name,
432
542
  // A connection briefly without a character (a reconnect waiting for one to
@@ -437,16 +547,16 @@ function kr(t, e, n) {
437
547
  here: !0
438
548
  } : { name: n.name, sprite: n.sprite, pictureUrl: n.pictureUrl, here: !1 };
439
549
  }
440
- function Qa(t, e, n) {
550
+ function Xa(t, e, n) {
441
551
  return !e || !n.here ? t : e.split(Is).join(n.name);
442
552
  }
443
553
  function _r(t, e) {
444
554
  const n = x((r) => JSON.stringify(kr(r.roster, t, e)));
445
555
  return Me(() => JSON.parse(n), [n]);
446
556
  }
447
- const qa = er(!0);
557
+ const Za = er(!0);
448
558
  function Ar() {
449
- const t = Zn(qa);
559
+ const t = Zn(Za);
450
560
  F(() => {
451
561
  t && Cs();
452
562
  }, [t]);
@@ -460,7 +570,7 @@ const bt = Ke.memo(
460
570
  },
461
571
  (t, e) => t.html === e.html && t.as === e.as && t.className === e.className && JSON.stringify(t.style) === JSON.stringify(e.style)
462
572
  );
463
- function Ya(t, e) {
573
+ function ei(t, e) {
464
574
  F(() => {
465
575
  const n = t.current;
466
576
  if (!n || !e || typeof IntersectionObserver > "u") return;
@@ -487,21 +597,21 @@ function Ir({ sprite: t, url: e, alt: n, worn: r }) {
487
597
  r?.overlay && /* @__PURE__ */ d(bt, { html: Rs(r), style: { display: "contents" } })
488
598
  ] });
489
599
  }
490
- function Xa(t) {
600
+ function ti(t) {
491
601
  return !(t.button !== 0 || t.ctrlKey || t.metaKey || t.shiftKey || t.altKey);
492
602
  }
493
- const Za = er(null);
494
- function ei() {
495
- return Zn(Za);
603
+ const ni = er(null);
604
+ function ri() {
605
+ return Zn(ni);
496
606
  }
497
- function ti({ src: t, title: e, onClose: n }) {
607
+ function si({ src: t, title: e, onClose: n }) {
498
608
  F(() => {
499
609
  const i = (a) => {
500
610
  Ve(a) && (a.stopPropagation(), n());
501
611
  };
502
612
  return document.addEventListener("keydown", i, !0), () => document.removeEventListener("keydown", i, !0);
503
613
  }, [n]);
504
- const r = ei(), s = typeof document > "u" ? null : document.fullscreenElement ?? r ?? document.body;
614
+ const r = ri(), s = typeof document > "u" ? null : document.fullscreenElement ?? r ?? document.body;
505
615
  return s ? Tt(
506
616
  /* @__PURE__ */ k(
507
617
  "div",
@@ -540,11 +650,11 @@ function ti({ src: t, title: e, onClose: n }) {
540
650
  s
541
651
  ) : null;
542
652
  }
543
- const $t = 240, ni = 320;
544
- function ri({ image: t }) {
653
+ const $t = 240, ai = 320;
654
+ function ii({ image: t }) {
545
655
  const [e, n] = $(!1), r = _t(t.key);
546
656
  if (!r) return null;
547
- const s = t.w > 0 && t.h > 0, i = s ? Math.min(1, ni / t.w, $t / t.h) : 1;
657
+ const s = t.w > 0 && t.h > 0, i = s ? Math.min(1, ai / t.w, $t / t.h) : 1;
548
658
  return /* @__PURE__ */ k(ye, { children: [
549
659
  /* @__PURE__ */ d(
550
660
  "a",
@@ -555,7 +665,7 @@ function ri({ image: t }) {
555
665
  className: "block max-w-full cursor-zoom-in",
556
666
  "data-testid": "chat-image",
557
667
  onClick: (a) => {
558
- Xa(a) && (a.preventDefault(), n(!0));
668
+ ti(a) && (a.preventDefault(), n(!0));
559
669
  },
560
670
  children: /* @__PURE__ */ d(
561
671
  "img",
@@ -573,7 +683,7 @@ function ri({ image: t }) {
573
683
  }
574
684
  ),
575
685
  e && /* @__PURE__ */ d(
576
- ti,
686
+ si,
577
687
  {
578
688
  src: r,
579
689
  title: t.title,
@@ -583,20 +693,20 @@ function ri({ image: t }) {
583
693
  ] });
584
694
  }
585
695
  function Cr({ images: t }) {
586
- return t?.length ? /* @__PURE__ */ d("div", { className: "flex flex-wrap gap-1 mt-1", "data-testid": "chat-images", children: t.map((e, n) => /* @__PURE__ */ d(ri, { image: e }, `${e.key}-${n}`)) }) : null;
696
+ return t?.length ? /* @__PURE__ */ d("div", { className: "flex flex-wrap gap-1 mt-1", "data-testid": "chat-images", children: t.map((e, n) => /* @__PURE__ */ d(ii, { image: e }, `${e.key}-${n}`)) }) : null;
587
697
  }
588
- function si(t, e) {
698
+ function oi(t, e) {
589
699
  return t.author && e.author ? t.author === e.author : !!e.clientId && t.clientId === e.clientId;
590
700
  }
591
701
  function Pt(t) {
592
702
  return new Date(t).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
593
703
  }
594
- const ai = Ke.memo(function({ message: e }) {
595
- const n = x((u) => u.me.clientId), r = x((u) => u.me.clientId ? u.roster[u.me.clientId]?.author : void 0), s = si(e, { clientId: n, author: r }), i = _r(
704
+ const ci = Ke.memo(function({ message: e }) {
705
+ const n = x((u) => u.me.clientId), r = x((u) => u.me.clientId ? u.roster[u.me.clientId]?.author : void 0), s = oi(e, { clientId: n, author: r }), i = _r(
596
706
  { clientId: e.clientId, author: e.author },
597
707
  { name: e.name, sprite: e.sprite }
598
708
  ), a = st(i.sprite, i.pictureUrl), c = e.isSystem ? void 0 : i.cosmetics, l = N(null);
599
- Ya(l, !!c);
709
+ ei(l, !!c);
600
710
  const [o] = $(
601
711
  () => e.live && e.text ? tr(e.text, c) : null
602
712
  );
@@ -607,7 +717,7 @@ const ai = Ke.memo(function({ message: e }) {
607
717
  ] }),
608
718
  /* @__PURE__ */ d("p", { className: "text-[13px] text-text-secondary leading-relaxed whitespace-pre-wrap break-words", children: e.text })
609
719
  ] }) }) : e.isSystem ? /* @__PURE__ */ k("div", { className: "px-2 py-0.5 text-[11px] text-text-muted italic text-center leading-tight", children: [
610
- Qa(e.text, e.template, i),
720
+ Xa(e.text, e.template, i),
611
721
  /* @__PURE__ */ d("span", { className: "ml-1 text-[10px] opacity-50", children: Pt(e.ts) })
612
722
  ] }) : /* @__PURE__ */ k("div", { ref: l, style: Tr(a), className: `flex items-start gap-2 px-2 py-1 hover:bg-bg-card/20 ${s ? "bg-bg-card/30" : ""}`, children: [
613
723
  /* @__PURE__ */ d(Ir, { sprite: i.sprite, url: i.pictureUrl, alt: i.name, worn: c }),
@@ -619,7 +729,7 @@ const ai = Ke.memo(function({ message: e }) {
619
729
  ] })
620
730
  ] });
621
731
  });
622
- function ii() {
732
+ function li() {
623
733
  Ar();
624
734
  const t = x((s) => s.chat), e = N(null), n = N(!1), r = j(() => {
625
735
  const s = e.current;
@@ -644,7 +754,7 @@ function ii() {
644
754
  /* @__PURE__ */ d("span", { className: "text-[10px] text-text-muted whitespace-nowrap", children: new Date(s.ts).toLocaleDateString([], { weekday: "short", month: "short", day: "numeric" }) }),
645
755
  /* @__PURE__ */ d("div", { className: "flex-1 h-px bg-border" })
646
756
  ] }),
647
- /* @__PURE__ */ d(ai, { message: s })
757
+ /* @__PURE__ */ d(ci, { message: s })
648
758
  ] }, s.id);
649
759
  }) })
650
760
  }
@@ -671,12 +781,12 @@ const cn = [
671
781
  scope: "local"
672
782
  }
673
783
  ], rt = "/";
674
- function oi(t) {
784
+ function di(t) {
675
785
  if (!t.startsWith(rt)) return null;
676
786
  const e = t.slice(rt.length);
677
787
  return /\s/.test(e) ? null : e.toLowerCase();
678
788
  }
679
- function ci(t, e = cn) {
789
+ function ui(t, e = cn) {
680
790
  const n = t.toLowerCase();
681
791
  if (!n) return [...e].sort((s, i) => s.name.localeCompare(i.name));
682
792
  const r = [];
@@ -686,23 +796,23 @@ function ci(t, e = cn) {
686
796
  }
687
797
  return r.sort((s, i) => s.rank - i.rank || s.cmd.name.localeCompare(i.cmd.name)).map((s) => s.cmd);
688
798
  }
689
- function li(t) {
799
+ function fi(t) {
690
800
  return `${rt}${t.name} `;
691
801
  }
692
802
  function Dt(t, e) {
693
803
  return e <= 0 ? 0 : (t % e + e) % e;
694
804
  }
695
- function di(t, e = cn) {
805
+ function hi(t, e = cn) {
696
806
  const n = t.trim();
697
807
  if (!n) return null;
698
808
  if (!n.startsWith(rt)) return { kind: "chat", text: n };
699
809
  const r = n.slice(rt.length), s = r.search(/\s/), i = (s === -1 ? r : r.slice(0, s)).toLowerCase(), a = s === -1 ? "" : r.slice(s).trim(), c = e.find((l) => l.name.toLowerCase() === i);
700
810
  return c ? { kind: "command", command: c, args: a } : { kind: "chat", text: n };
701
811
  }
702
- function ui(t, e) {
812
+ function pi(t, e) {
703
813
  return t.requiresMedia && !e.hasMedia ? `${rt}${t.name} needs an episode loaded.` : null;
704
814
  }
705
- function fi({
815
+ function mi({
706
816
  commands: t,
707
817
  activeIndex: e,
708
818
  hasMedia: n,
@@ -778,17 +888,17 @@ function Fr() {
778
888
  i.current.clear();
779
889
  }, []);
780
890
  const a = j((p) => {
781
- _a(p) && (URL.revokeObjectURL(p.previewUrl), i.current.delete(p.previewUrl));
891
+ ka(p) && (URL.revokeObjectURL(p.previewUrl), i.current.delete(p.previewUrl));
782
892
  }, []), c = j(async (p) => {
783
893
  if (!p.length) return;
784
894
  const v = [];
785
895
  for (const S of p) {
786
- const A = Ta(S);
896
+ const A = Aa(S);
787
897
  if (A) {
788
898
  s("error", A);
789
899
  continue;
790
900
  }
791
- const { w: R, h: _ } = await Ra(S), m = URL.createObjectURL(S);
901
+ const { w: R, h: _ } = await Ca(S), m = URL.createObjectURL(S);
792
902
  i.current.add(m), v.push({
793
903
  kind: "file",
794
904
  id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
@@ -835,10 +945,10 @@ function Fr() {
835
945
  return [];
836
946
  });
837
947
  }, [a]), f = j((p) => {
838
- const v = Ia(p.clipboardData);
948
+ const v = Ta(p.clipboardData);
839
949
  v.length && (p.preventDefault(), c(v));
840
950
  }, [c]), h = j((p) => {
841
- const v = Ca(p.dataTransfer);
951
+ const v = Ia(p.dataTransfer);
842
952
  v.length && (p.preventDefault(), c(v));
843
953
  }, [c]), g = j((p) => {
844
954
  p.dataTransfer?.types?.includes("Files") && p.preventDefault();
@@ -846,9 +956,9 @@ function Fr() {
846
956
  if (!t.length) return [];
847
957
  r(!0);
848
958
  try {
849
- return await La(t);
959
+ return await Fa(t);
850
960
  } catch (p) {
851
- return I("chat", "Image upload failed", Na(p)), s("error", Aa(p)), null;
961
+ return I("chat", "Image upload failed", La(p)), s("error", _a(p)), null;
852
962
  } finally {
853
963
  r(!1);
854
964
  }
@@ -866,16 +976,16 @@ function Fr() {
866
976
  onDragOver: g
867
977
  };
868
978
  }
869
- const An = ar, hi = sr;
870
- function pi({ commands: t = cn }) {
871
- const [e, n] = $(""), [r, s] = $(!1), [i, a] = $({ q: null, i: 0 }), [c, l] = $(!1), o = N(null), u = Ss(), [f, h] = $(!1), [g, b] = $(!1), p = Fr(), v = x((D) => D.snapshot.mediaId), S = x((D) => D.pushToast), A = x((D) => D.setTierlistOpen), R = !!v, _ = oi(e), m = Me(
872
- () => _ === null ? [] : ci(_, t),
979
+ const An = ar, gi = sr;
980
+ function bi({ commands: t = cn }) {
981
+ const [e, n] = $(""), [r, s] = $(!1), [i, a] = $({ q: null, i: 0 }), [c, l] = $(!1), o = N(null), u = Ss(), [f, h] = $(!1), [g, b] = $(!1), p = Fr(), v = x((D) => D.snapshot.mediaId), S = x((D) => D.pushToast), A = x((D) => D.setTierlistOpen), R = !!v, _ = di(e), m = Me(
982
+ () => _ === null ? [] : ui(_, t),
873
983
  [_, t]
874
984
  ), T = _ !== null && !c && m.length > 0, L = i.q === _ ? Dt(i.i, m.length) : 0, y = j(
875
985
  (D) => a({ q: _, i: D }),
876
986
  [_]
877
987
  ), w = j((D, W) => {
878
- const X = ui(D, { hasMedia: R });
988
+ const X = pi(D, { hasMedia: R });
879
989
  if (X) {
880
990
  S("info", X);
881
991
  return;
@@ -894,10 +1004,10 @@ function pi({ commands: t = cn }) {
894
1004
  S("info", `${D.usage} is not implemented yet.`);
895
1005
  }
896
1006
  }, [R, S, t, A]), C = j((D) => {
897
- n(li(D)), l(!1), o.current?.focus();
1007
+ n(fi(D)), l(!1), o.current?.focus();
898
1008
  }, []), P = j(async (D) => {
899
1009
  if (D.preventDefault(), r || p.uploading) return;
900
- const W = di(e, t);
1010
+ const W = hi(e, t);
901
1011
  if (!W && !p.pending.length) return;
902
1012
  if (W?.kind === "command" && p.pending.length) {
903
1013
  S("info", "Send images on their own, not with a command.");
@@ -908,7 +1018,7 @@ function pi({ commands: t = cn }) {
908
1018
  return;
909
1019
  }
910
1020
  const X = await p.uploadPending();
911
- X !== null && (rr(W?.text ?? "", X), n(""), p.clear(), s(!0), setTimeout(() => s(!1), hi), !document.hidden && document.hasFocus() && o.current?.focus());
1021
+ X !== null && (rr(W?.text ?? "", X), n(""), p.clear(), s(!0), setTimeout(() => s(!1), gi), !document.hidden && document.hasFocus() && o.current?.focus());
912
1022
  }, [e, r, w, p, S, t]), O = j((D) => {
913
1023
  if (D.key === "Escape" && T) {
914
1024
  D.preventDefault(), l(!0);
@@ -951,7 +1061,7 @@ function pi({ commands: t = cn }) {
951
1061
  /* @__PURE__ */ d(Rr, { pending: p.pending, uploading: p.uploading, onRemove: p.remove }),
952
1062
  /* @__PURE__ */ k("div", { className: "relative", children: [
953
1063
  T && /* @__PURE__ */ d(
954
- fi,
1064
+ mi,
955
1065
  {
956
1066
  commands: m,
957
1067
  activeIndex: L,
@@ -1015,11 +1125,11 @@ function pi({ commands: t = cn }) {
1015
1125
  }
1016
1126
  );
1017
1127
  }
1018
- function mi() {
1128
+ function yi() {
1019
1129
  const t = x((n) => n.roster), e = Object.values(t);
1020
- return e.length ? /* @__PURE__ */ d("div", { className: "flex flex-col gap-1", children: e.map((n) => /* @__PURE__ */ d(gi, { u: n }, n.clientId)) }) : /* @__PURE__ */ d("div", { className: "text-xs text-text-muted", children: "No users online" });
1130
+ return e.length ? /* @__PURE__ */ d("div", { className: "flex flex-col gap-1", children: e.map((n) => /* @__PURE__ */ d(vi, { u: n }, n.clientId)) }) : /* @__PURE__ */ d("div", { className: "text-xs text-text-muted", children: "No users online" });
1021
1131
  }
1022
- function gi({ u: t }) {
1132
+ function vi({ u: t }) {
1023
1133
  const e = st(t.sprite, t.avatarUrl);
1024
1134
  return /* @__PURE__ */ k("div", { className: "flex items-center gap-2 py-0.5", children: [
1025
1135
  /* @__PURE__ */ d(
@@ -1036,7 +1146,7 @@ function gi({ u: t }) {
1036
1146
  t.isLeader && /* @__PURE__ */ d("span", { className: "ml-auto px-1.5 py-0.5 rounded text-[9px] font-medium bg-success/20 text-success", children: "Leader" })
1037
1147
  ] });
1038
1148
  }
1039
- function bi() {
1149
+ function Si() {
1040
1150
  const t = x((i) => Object.keys(i.roster).length), [e, n] = $(!1), r = N(null), s = N(null);
1041
1151
  return F(() => {
1042
1152
  if (!e) return;
@@ -1072,20 +1182,20 @@ function bi() {
1072
1182
  t,
1073
1183
  " online"
1074
1184
  ] }),
1075
- /* @__PURE__ */ d(mi, {})
1185
+ /* @__PURE__ */ d(yi, {})
1076
1186
  ] })
1077
1187
  ] });
1078
1188
  }
1079
- function yi({ leaderId: t, clientId: e, keyType: n }) {
1189
+ function wi({ leaderId: t, clientId: e, keyType: n }) {
1080
1190
  return t !== null ? t === e : n === "leader";
1081
1191
  }
1082
- const vi = /-[0-9a-fA-F]{16}$/;
1083
- function Si(t) {
1084
- return t && vi.test(t) ? "leader" : null;
1192
+ const Ei = /-[0-9a-fA-F]{16}$/;
1193
+ function xi(t) {
1194
+ return t && Ei.test(t) ? "leader" : null;
1085
1195
  }
1086
- const wi = /\/room\/([^/]+)\/?$/;
1087
- function Ei(t) {
1088
- const e = t ? wi.exec(t) : null;
1196
+ const Mi = /\/room\/([^/]+)\/?$/;
1197
+ function ki(t) {
1198
+ const e = t ? Mi.exec(t) : null;
1089
1199
  if (!e) return null;
1090
1200
  try {
1091
1201
  return decodeURIComponent(e[1]);
@@ -1093,8 +1203,8 @@ function Ei(t) {
1093
1203
  return e[1];
1094
1204
  }
1095
1205
  }
1096
- function xi(t, e) {
1097
- return t && e?.roomKey === t ? e.type : Si(t);
1206
+ function _i(t, e) {
1207
+ return t && e?.roomKey === t ? e.type : xi(t);
1098
1208
  }
1099
1209
  function ze() {
1100
1210
  return x((t) => !!t.snapshot.leaderId && t.snapshot.leaderId === t.me.clientId);
@@ -1104,28 +1214,28 @@ function Rt() {
1104
1214
  return t ? e.find((n) => n.id === t) ?? null : null;
1105
1215
  }
1106
1216
  function ln() {
1107
- return x((t) => yi({
1217
+ return x((t) => wi({
1108
1218
  leaderId: t.snapshot.leaderId,
1109
1219
  clientId: t.me.clientId,
1110
- keyType: xi(Ei(globalThis.location?.pathname), t.roomKeyType)
1220
+ keyType: _i(ki(globalThis.location?.pathname), t.roomKeyType)
1111
1221
  }));
1112
1222
  }
1113
1223
  function Lr() {
1114
1224
  return x((t) => t.readiness);
1115
1225
  }
1116
- function Mi() {
1226
+ function Ai() {
1117
1227
  return x((t) => t.snapshot);
1118
1228
  }
1119
- const ki = 3e4;
1229
+ const Ti = 3e4;
1120
1230
  function Nr() {
1121
1231
  const t = Lr(), [e, n] = $(!1), [r, s] = $({ mediaId: t.mediaId, ready: t.ready });
1122
1232
  return (r.mediaId !== t.mediaId || r.ready !== t.ready) && (s({ mediaId: t.mediaId, ready: t.ready }), n(!1)), F(() => {
1123
1233
  if (t.ready) return;
1124
- const i = setTimeout(() => n(!0), ki);
1234
+ const i = setTimeout(() => n(!0), Ti);
1125
1235
  return () => clearTimeout(i);
1126
1236
  }, [t.mediaId, t.ready]), e;
1127
1237
  }
1128
- function _i({ draw: t }) {
1238
+ function Ii({ draw: t }) {
1129
1239
  const e = N(null);
1130
1240
  return F(() => {
1131
1241
  const n = e.current;
@@ -1133,8 +1243,8 @@ function _i({ draw: t }) {
1133
1243
  return t(n) ?? void 0;
1134
1244
  }, [t]), /* @__PURE__ */ d("div", { ref: e, "data-testid": "game-settings" });
1135
1245
  }
1136
- const Ai = sn(() => import("./AdminPanel-wF52_cKz.js")), Ti = sn(() => import("./PlaylistPanel-V8d0S6LN.js"));
1137
- function Ii() {
1246
+ const Ci = sn(() => import("./AdminPanel-D2kMQb6o.js")), Ri = sn(() => import("./PlaylistPanel-CZOP3b1v.js"));
1247
+ function Fi() {
1138
1248
  const t = x((h) => h.chatCollapsed), e = It(), n = x((h) => h.sidebarTab), r = x((h) => h.setSidebarTab), s = x((h) => h.healthSnapshot?.clients.length ?? 0), i = x((h) => !!h.playlist), a = ze(), c = ln(), l = x((h) => h.gameSettings), o = x((h) => h.snapshot.mediaId), u = Rt() !== null;
1139
1249
  if (Ct({ hasMedia: !!o, chatCollapsed: t, isFullscreen: e }))
1140
1250
  return null;
@@ -1164,9 +1274,9 @@ function Ii() {
1164
1274
  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: "M7 4v16M17 4v16M3 8h4m10 0h4M3 12h18M3 16h4m10 0h4M4 4h16a1 1 0 011 1v14a1 1 0 01-1 1H4a1 1 0 01-1-1V5a1 1 0 011-1z" }) })
1165
1275
  }
1166
1276
  ),
1167
- /* @__PURE__ */ d(xa, {}),
1168
- /* @__PURE__ */ d(Ma, { children: l ? /* @__PURE__ */ d(_i, { draw: l }) : null }),
1169
- /* @__PURE__ */ d(bi, {})
1277
+ /* @__PURE__ */ d(Ea, {}),
1278
+ /* @__PURE__ */ d(xa, { children: l ? /* @__PURE__ */ d(Ii, { draw: l }) : null }),
1279
+ /* @__PURE__ */ d(Si, {})
1170
1280
  ] }),
1171
1281
  (a || i) && /* @__PURE__ */ k("div", { role: "tablist", "aria-label": "Sidebar", className: "flex border-b border-border shrink-0", children: [
1172
1282
  /* @__PURE__ */ d(
@@ -1203,119 +1313,23 @@ function Ii() {
1203
1313
  }
1204
1314
  )
1205
1315
  ] }),
1206
- f === "health" ? /* @__PURE__ */ d(Ke.Suspense, { fallback: /* @__PURE__ */ d("div", { className: "p-4 text-xs text-text-muted", children: "Loading..." }), children: /* @__PURE__ */ d(Ai, {}) }) : f === "playlist" ? /* @__PURE__ */ d(Ke.Suspense, { fallback: /* @__PURE__ */ d("div", { className: "p-4 text-xs text-text-muted", children: "Loading..." }), children: /* @__PURE__ */ d(Ti, {}) }) : /* @__PURE__ */ k(ye, { children: [
1207
- /* @__PURE__ */ d(ii, {}),
1208
- /* @__PURE__ */ d(pi, {})
1316
+ f === "health" ? /* @__PURE__ */ d(Ke.Suspense, { fallback: /* @__PURE__ */ d("div", { className: "p-4 text-xs text-text-muted", children: "Loading..." }), children: /* @__PURE__ */ d(Ci, {}) }) : f === "playlist" ? /* @__PURE__ */ d(Ke.Suspense, { fallback: /* @__PURE__ */ d("div", { className: "p-4 text-xs text-text-muted", children: "Loading..." }), children: /* @__PURE__ */ d(Ri, {}) }) : /* @__PURE__ */ k(ye, { children: [
1317
+ /* @__PURE__ */ d(li, {}),
1318
+ /* @__PURE__ */ d(bi, {})
1209
1319
  ] })
1210
1320
  ] });
1211
1321
  }
1212
- const Tn = (t) => typeof t == "string" && wa.includes(t);
1213
- function Ci(t, e, n) {
1322
+ const Tn = (t) => typeof t == "string" && Sa.includes(t);
1323
+ function Li(t, e, n) {
1214
1324
  return Tn(e) ? e : Tn(n) ? n : "dark";
1215
1325
  }
1216
- function Ri(t, e) {
1217
- if (!Ds(t)) return null;
1218
- const n = new URL(t, e);
1219
- return n.origin === e ? n.href : null;
1220
- }
1221
- function Fi(t, e) {
1222
- const n = Ri(t.url, e);
1223
- return { id: t.id, name: t.name, load: n ? () => import(
1224
- /* @vite-ignore */
1225
- n
1226
- ) : null };
1227
- }
1228
- const qe = (t) => t instanceof Error ? t.message : String(t);
1229
- function Li(t) {
1230
- let e = t.ctx, n = null, r = !1, s = !1;
1231
- const i = /* @__PURE__ */ new Set(), a = (h, g) => t.onSettingsError?.(h, g), c = (h) => {
1232
- if (i.delete(h))
1233
- try {
1234
- h.cleanup();
1235
- } catch (g) {
1236
- a(`the game's settings failed to close: ${qe(g)}`, g);
1237
- }
1238
- }, l = (h) => {
1239
- for (const g of [...i]) c(g);
1240
- h.mountSettings && t.onSettingsAvailable?.(!1);
1241
- }, o = (h) => {
1242
- l(h);
1243
- try {
1244
- h.unmount();
1245
- } catch (g) {
1246
- s || t.onError(`unmount threw: ${qe(g)}`, g);
1247
- }
1248
- }, u = (h, g) => {
1249
- if (s || r) return;
1250
- s = !0;
1251
- const b = n;
1252
- n = null, b && o(b), t.onError(h, g);
1253
- }, f = (h) => {
1254
- if (e = h, !(!n || r))
1255
- try {
1256
- n.update(h);
1257
- } catch (g) {
1258
- u(`the game failed to update: ${qe(g)}`, g);
1259
- }
1260
- };
1261
- return (async () => {
1262
- let h;
1263
- try {
1264
- h = await t.load();
1265
- } catch (p) {
1266
- u(`could not load the game: ${qe(p)}`, p);
1267
- return;
1268
- }
1269
- if (r) return;
1270
- if (!Ka(h)) {
1271
- u("the game module does not export mount()");
1272
- return;
1273
- }
1274
- const g = e;
1275
- let b;
1276
- try {
1277
- b = await h.mount(t.el, g);
1278
- } catch (p) {
1279
- u(`the game failed to start: ${qe(p)}`, p);
1280
- return;
1281
- }
1282
- if (!Va(b)) {
1283
- u("the game's mount() did not return { unmount, update }");
1284
- return;
1285
- }
1286
- if (r) {
1287
- o(b);
1288
- return;
1289
- }
1290
- n = b, b.mountSettings && t.onSettingsAvailable?.(!0), e !== g && f(e);
1291
- })(), {
1292
- update: f,
1293
- dispose() {
1294
- r || (r = !0, n && o(n), n = null);
1295
- },
1296
- mountSettings(h) {
1297
- const g = n;
1298
- if (!g?.mountSettings || r) return null;
1299
- let b;
1300
- try {
1301
- b = g.mountSettings(h);
1302
- } catch (v) {
1303
- return a(`the game's settings failed to open: ${qe(v)}`, v), null;
1304
- }
1305
- if (typeof b != "function")
1306
- return a("the game's mountSettings() did not return a cleanup function"), null;
1307
- const p = { cleanup: b };
1308
- return i.add(p), () => c(p);
1309
- }
1310
- };
1311
- }
1312
1326
  function In({ activity: t, roomKey: e, layer: n }) {
1313
- const r = N(null), s = N(null), [i, a] = $(null), [c, l] = $(!1), o = x((_) => _.snapshot.leaderId), u = x((_) => _.me.clientId), f = !!o && o === u, h = x((_) => _.name), g = Ea()?.theme, b = Ci(void 0, g, Bs().theme), p = Me(() => ({
1327
+ const r = N(null), s = N(null), [i, a] = $(null), [c, l] = $(!1), o = x((_) => _.snapshot.leaderId), u = x((_) => _.me.clientId), f = !!o && o === u, h = x((_) => _.name), g = wa()?.theme, b = Li(void 0, g, Ds().theme), p = Me(() => ({
1314
1328
  roomKey: e,
1315
1329
  identity: {
1316
1330
  // The registry userId — what RoomChrome's `userId` prop is.
1317
- userId: Hs(),
1318
- userType: Os(),
1331
+ userId: Os(),
1332
+ userType: Bs(),
1319
1333
  name: h || null
1320
1334
  },
1321
1335
  theme: b,
@@ -1332,7 +1346,7 @@ function In({ activity: t, roomKey: e, layer: n }) {
1332
1346
  const _ = r.current, m = t.load;
1333
1347
  if (!_ || !m || c) return;
1334
1348
  E("game", "bundle mount", { gameId: t.id });
1335
- const { setGameSettings: T } = x.getState(), L = (w) => y.mountSettings(w), y = Li({
1349
+ const { setGameSettings: T } = x.getState(), L = (w) => y.mountSettings(w), y = Qa({
1336
1350
  load: m,
1337
1351
  el: _,
1338
1352
  ctx: v(),
@@ -1457,7 +1471,7 @@ function Oi() {
1457
1471
  }, 200);
1458
1472
  return () => clearInterval(h);
1459
1473
  }, [o]);
1460
- const u = za(r, { hasMedia: !!n, chatCollapsed: e, isFullscreen: i }), f = Me(() => {
1474
+ const u = qa(r, { hasMedia: !!n, chatCollapsed: e, isFullscreen: i }), f = Me(() => {
1461
1475
  const h = c - $r;
1462
1476
  return t.filter((g) => !g.isSystem && g.ts > h).slice(-12);
1463
1477
  }, [t, c]);
@@ -1796,7 +1810,7 @@ function Ji() {
1796
1810
  name: m.name || "Anon",
1797
1811
  isReady: u.has(m.clientId),
1798
1812
  isSelf: m.clientId === r,
1799
- onToggle: () => Us(!h)
1813
+ onToggle: () => Hs(!h)
1800
1814
  },
1801
1815
  m.clientId
1802
1816
  )) })
@@ -1816,7 +1830,7 @@ function Ji() {
1816
1830
  {
1817
1831
  type: "button",
1818
1832
  "data-testid": "start-ready-check",
1819
- onClick: () => js(),
1833
+ onClick: () => Us(),
1820
1834
  className: "px-2.5 py-1 rounded bg-black/55 text-xs font-semibold tracking-wide hover:bg-black/75 transition-colors",
1821
1835
  style: { color: "#fff", pointerEvents: "auto" },
1822
1836
  title: "Ask everyone if they're ready",
@@ -1987,7 +2001,7 @@ function Yi() {
1987
2001
  a && (i(a, y === Ge ? null : y), c(null));
1988
2002
  }
1989
2003
  }), _ = j(async () => {
1990
- await Gs(x.getState().tierlistDraft) && g(Date.now());
2004
+ await js(x.getState().tierlistDraft) && g(Date.now());
1991
2005
  }, []);
1992
2006
  if (F(() => {
1993
2007
  if (h === null) return;
@@ -2316,11 +2330,11 @@ function vo(t = typeof window > "u" ? void 0 : window, e = bo) {
2316
2330
  }
2317
2331
  function So() {
2318
2332
  F(() => {
2319
- const t = vo(), e = Ws((r) => {
2320
- const s = Vs(r);
2333
+ const t = vo(), e = Gs((r) => {
2334
+ const s = Ks(r);
2321
2335
  E("avatar", "Avatar changed in the settings popout", { sprite: s, source: r.avatar?.source }), dr(s);
2322
- }), n = Ks((r) => {
2323
- E("avatar", "Renamed in the settings popout", { name: r }), zs(r);
2336
+ }), n = Ws((r) => {
2337
+ E("avatar", "Renamed in the settings popout", { name: r }), Vs(r);
2324
2338
  });
2325
2339
  return () => {
2326
2340
  e(), n(), t();
@@ -2366,7 +2380,7 @@ function _o(t) {
2366
2380
  return t === "leader" || t === "viewer" ? t : null;
2367
2381
  }
2368
2382
  async function Ao(t) {
2369
- const e = Js(), n = await fetch(`${e}/api/rooms/validate/${encodeURIComponent(t)}`);
2383
+ const e = zs(), n = await fetch(`${e}/api/rooms/validate/${encodeURIComponent(t)}`);
2370
2384
  if (n.status === 404) return null;
2371
2385
  if (!n.ok) throw new Error(`validate returned ${n.status}`);
2372
2386
  const r = await n.json();
@@ -2397,7 +2411,7 @@ function Io() {
2397
2411
  return Le("home");
2398
2412
  }
2399
2413
  function Co() {
2400
- const t = Mi(), e = Lr(), n = ze(), r = Nr(), s = n && r && !e.ready, i = !e.ready && !s;
2414
+ const t = Ai(), e = Lr(), n = ze(), r = Nr(), s = n && r && !e.ready, i = !e.ready && !s;
2401
2415
  return /* @__PURE__ */ d(
2402
2416
  "button",
2403
2417
  {
@@ -3727,7 +3741,7 @@ class nt {
3727
3741
  // timing, and APPEND-HOLD reason counts. Read by emitInitDigest() which warns
3728
3742
  // once at gate-pass time so the load shape is visible in session logs without
3729
3743
  // wp:reportLogs=true.
3730
- static INIT_TRACK_FRAGS = Qs;
3744
+ static INIT_TRACK_FRAGS = Js;
3731
3745
  loadStartTs = 0;
3732
3746
  initFetchStart = 0;
3733
3747
  initFetchEnd = 0;
@@ -3802,8 +3816,8 @@ class nt {
3802
3816
  * `fragment-route.realmedia.test.ts`; this is the client-side backstop.
3803
3817
  */
3804
3818
  async tryFragmentRoute(e, n, r) {
3805
- if (this.fragmentRouteDisabled || !this.delivery || !qs()) return null;
3806
- const s = Ys(this.delivery, e);
3819
+ if (this.fragmentRouteDisabled || !this.delivery || !Qs()) return null;
3820
+ const s = qs(this.delivery, e);
3807
3821
  if (!s)
3808
3822
  return this.disableFragmentRoute(e, "could not build a URL for this config"), null;
3809
3823
  try {
@@ -3930,14 +3944,14 @@ class nt {
3930
3944
  }
3931
3945
  this.initAppendDone = performance.now(), this.initState = "loaded", this.initRetryCount = 0, E("buffer", `INIT-LOADED sbRanges=[${ge(this.sourceBuffer?.buffered).join(", ")}]`), this.processAppendQueue();
3932
3946
  } catch (c) {
3933
- ee("buffer", "Init segment fetch/append failed", { error: c.message }), a() || (this.initState = "pending", this.initRetryCount += 1, this.initRetryCount >= Xs ? (this.initFailed = !0, I("buffer", "INIT-GIVE-UP — init segment failed repeatedly; rejecting waiters for fast recovery", {
3947
+ ee("buffer", "Init segment fetch/append failed", { error: c.message }), a() || (this.initState = "pending", this.initRetryCount += 1, this.initRetryCount >= Ys ? (this.initFailed = !0, I("buffer", "INIT-GIVE-UP — init segment failed repeatedly; rejecting waiters for fast recovery", {
3934
3948
  attempts: this.initRetryCount,
3935
3949
  error: c.message
3936
3950
  }), this.rejectAllWaiters(new Error("init segment failed after repeated retries"))) : this.disposed || setTimeout(() => {
3937
3951
  !this.disposed && this.initState === "pending" && this.fetchInit().catch((l) => {
3938
3952
  ee("buffer", "INIT-RETRY failed", Y(l));
3939
3953
  });
3940
- }, Zs));
3954
+ }, Xs));
3941
3955
  }
3942
3956
  }
3943
3957
  /** Runs inside updateend after an append completes. Decides whether MSE
@@ -4464,7 +4478,7 @@ class nt {
4464
4478
  if (this.appendHold?.index !== e)
4465
4479
  return this.appendHold = { index: e, since: r }, !1;
4466
4480
  const s = r - this.appendHold.since;
4467
- if (s < ea) return !1;
4481
+ if (s < Zs) return !1;
4468
4482
  I("buffer", `APPEND-HOLD-BREAK #${e} held ${s}ms behind ${n.length} pending fetch(es) — declaring them dead so the queue can drain`, {
4469
4483
  headIndex: e,
4470
4484
  heldMs: s,
@@ -4528,7 +4542,7 @@ class nt {
4528
4542
  if (this.disposed || !this.sourceBuffer || (this.currentPlayheadMs = e, this.currentJobs.size >= Qe)) return;
4529
4543
  const n = Re(this.fragments, e), r = Math.min(this.fragments.length - 1, Re(this.fragments, e + tt)), s = Date.now();
4530
4544
  for (let a = n; a <= r; a++)
4531
- this.fragmentStates.get(a) === "error" && s - (this.errorTimestamps.get(a) ?? 0) >= ta && ((this.fetchErrorCycles.get(a) ?? 0) >= En ? E("buffer", `PREFETCH-DEAD #${a} cycles=${this.fetchErrorCycles.get(a)} not resetting`) : (this.fragmentStates.set(a, "pending"), this.errorTimestamps.delete(a)));
4545
+ this.fragmentStates.get(a) === "error" && s - (this.errorTimestamps.get(a) ?? 0) >= ea && ((this.fetchErrorCycles.get(a) ?? 0) >= En ? E("buffer", `PREFETCH-DEAD #${a} cycles=${this.fetchErrorCycles.get(a)} not resetting`) : (this.fragmentStates.set(a, "pending"), this.errorTimestamps.delete(a)));
4532
4546
  let i = 0;
4533
4547
  for (let a = n; a <= r && i < Qe - this.currentJobs.size; a++) {
4534
4548
  const c = this.fragmentStates.get(a);
@@ -4781,7 +4795,7 @@ class nt {
4781
4795
  if (this.eosRetryTimer) return;
4782
4796
  this.eosRetryTimer = setTimeout(() => {
4783
4797
  this.eosRetryTimer = null, this.tryEndOfStream();
4784
- }, na);
4798
+ }, ta);
4785
4799
  return;
4786
4800
  }
4787
4801
  try {
@@ -5097,7 +5111,7 @@ class Ac {
5097
5111
  }
5098
5112
  let pt = null;
5099
5113
  function Tc() {
5100
- pt === null && (E("health", "Starting health reporting"), Jn(), pt = window.setInterval(Jn, ra));
5114
+ pt === null && (E("health", "Starting health reporting"), Jn(), pt = window.setInterval(Jn, na));
5101
5115
  }
5102
5116
  function Ic() {
5103
5117
  pt !== null && (E("health", "Stopping health reporting"), window.clearInterval(pt), pt = null);
@@ -5133,9 +5147,9 @@ function Jn() {
5133
5147
  fragments_error: i.fragmentStates.error || 0,
5134
5148
  video_ready_state: r?.readyState ?? -1,
5135
5149
  duration_ms: n.getMediaEndMs(),
5136
- delivery_arm: aa(),
5150
+ delivery_arm: sa(),
5137
5151
  ...Cc(r),
5138
- pong_age_ms: sa(),
5152
+ pong_age_ms: ra(),
5139
5153
  reported_at: Date.now()
5140
5154
  });
5141
5155
  }
@@ -5273,9 +5287,9 @@ const zt = {
5273
5287
  selectedSubtitleIndex: 0
5274
5288
  };
5275
5289
  function Pc(t) {
5276
- const [e, n] = $(zt), r = ia(), s = x((u) => u.mediaPrefs.preferredAudioLang), [i, a] = $(t);
5290
+ const [e, n] = $(zt), r = aa(), s = x((u) => u.mediaPrefs.preferredAudioLang), [i, a] = $(t);
5277
5291
  i !== t && (a(t), t && n(zt));
5278
- const c = ue(() => ({ origin: oa(r), preferredAudioLang: s }));
5292
+ const c = ue(() => ({ origin: ia(r), preferredAudioLang: s }));
5279
5293
  F(() => {
5280
5294
  if (!t) return;
5281
5295
  const u = new AbortController(), { origin: f, preferredAudioLang: h } = c();
@@ -5550,7 +5564,7 @@ function Gc(t, e, n, r, s, i) {
5550
5564
  const f = t.current;
5551
5565
  if (!f || !r) return;
5552
5566
  const h = a.playheadMs, g = n.current, b = c !== l.current;
5553
- l.current = c, !(!b && Math.abs(h - g) <= ca) && (E("buffer", "Seek triggered", {
5567
+ l.current = c, !(!b && Math.abs(h - g) <= oa) && (E("buffer", "Seek triggered", {
5554
5568
  targetMs: h,
5555
5569
  lastApplied: g,
5556
5570
  delta: Math.round(h - g),
@@ -5738,7 +5752,7 @@ function zc(t, e, n, r, s, i) {
5738
5752
  artwork: _ ? [{ src: _ }] : []
5739
5753
  }));
5740
5754
  };
5741
- b(null), Vc(Yo(n).map(la)).then(b);
5755
+ b(null), Vc(Yo(n).map(ca)).then(b);
5742
5756
  const p = (_) => () => {
5743
5757
  const m = x.getState(), T = zo(_, { isLeader: Kc(), roomPlaying: m.snapshot.playing });
5744
5758
  switch (E(Ce, "media session press", { action: _, result: T.kind }), _ === "pause" && (c.current = Date.now()), T.kind) {
@@ -5818,7 +5832,7 @@ function Jc(t, e, n, r) {
5818
5832
  const s = ue((a) => {
5819
5833
  const c = t.current;
5820
5834
  if (!c) return;
5821
- const l = c.querySelector(Yn), o = document.activeElement, u = yr(o) ? "text" : l && o && l.contains(o) ? "bar" : !o || o === document.body || o === c ? "idle" : "elsewhere", f = Ba({
5835
+ const l = c.querySelector(Yn), o = document.activeElement, u = yr(o) ? "text" : l && o && l.contains(o) ? "bar" : !o || o === document.body || o === c ? "idle" : "elsewhere", f = Da({
5822
5836
  key: a.key,
5823
5837
  back: Ve(a),
5824
5838
  modifier: a.ctrlKey || a.metaKey || a.altKey,
@@ -5869,7 +5883,7 @@ function Jc(t, e, n, r) {
5869
5883
  }, [t]);
5870
5884
  }
5871
5885
  function Xn(t, e, n) {
5872
- const r = n instanceof HTMLInputElement && n.type !== "range" ? n : null, s = r ? { atStart: (r.selectionEnd ?? 0) === 0, atEnd: (r.selectionStart ?? 0) === r.value.length } : void 0, i = Oa(t.key, mr(n), n.hasAttribute(et), s);
5886
+ const r = n instanceof HTMLInputElement && n.type !== "range" ? n : null, s = r ? { atStart: (r.selectionEnd ?? 0) === 0, atEnd: (r.selectionStart ?? 0) === r.value.length } : void 0, i = Ba(t.key, mr(n), n.hasAttribute(et), s);
5873
5887
  if (i === null) return;
5874
5888
  t.preventDefault();
5875
5889
  const a = gr(e), c = a.indexOf(n);
@@ -5896,7 +5910,7 @@ function Xc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
5896
5910
  if (!A) return null;
5897
5911
  const B = t.replace(new RegExp(`/${Et.replace(/\./g, "\\.")}$`), "");
5898
5912
  return B === t ? null : { baseUrl: B, token: A, trackId: M };
5899
- }, [A, t]), m = p !== null && S.length > 0, T = x((M) => M.readiness), L = da(), y = ze();
5913
+ }, [A, t]), m = p !== null && S.length > 0, T = x((M) => M.readiness), L = la(), y = ze();
5900
5914
  F(() => {
5901
5915
  const M = s.current;
5902
5916
  if (!M) return;
@@ -5966,7 +5980,7 @@ function Xc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
5966
5980
  })
5967
5981
  );
5968
5982
  if (await M.ensureBuffered(V, "initial"), M.isDisposed) return;
5969
- const re = ua;
5983
+ const re = da;
5970
5984
  await Promise.allSettled(ne);
5971
5985
  const Q = le.map(
5972
5986
  (K) => K.waitForBuffered(V + Fe, re)
@@ -5992,7 +6006,7 @@ function Xc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
5992
6006
  totalMs: Oe
5993
6007
  });
5994
6008
  const Ae = Ee ? "gate-pass" : "gate-timeout";
5995
- M.emitInitDigest("video", Ae), le.forEach((K, se) => K.emitInitDigest(`audio:${se}`, Ae)), w.current || (w.current = !0, fa(n));
6009
+ M.emitInitDigest("video", Ae), le.forEach((K, se) => K.emitInitDigest(`audio:${se}`, Ae)), w.current || (w.current = !0, ua(n));
5996
6010
  let q = V;
5997
6011
  if (B && q > 0) {
5998
6012
  const K = B.buffered;
@@ -6396,12 +6410,12 @@ function Xc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
6396
6410
  }
6397
6411
  function Zc() {
6398
6412
  const t = x((n) => n.snapshot.mediaId), e = Me(() => t ? { mediaId: t, ...hr(t) } : null, [t]);
6399
- return e ? /* @__PURE__ */ d(xr, { children: /* @__PURE__ */ d(Xc, { mediaUrl: e.mediaUrl, indexUrl: e.indexUrl, mediaId: e.mediaId }) }) : /* @__PURE__ */ d(ma, {});
6413
+ return e ? /* @__PURE__ */ d(xr, { children: /* @__PURE__ */ d(Xc, { mediaUrl: e.mediaUrl, indexUrl: e.indexUrl, mediaId: e.mediaId }) }) : /* @__PURE__ */ d(pa, {});
6400
6414
  }
6401
6415
  const el = (t) => {
6402
- const e = ka(t);
6416
+ const e = Ma(t);
6403
6417
  return e.render(
6404
- /* @__PURE__ */ d(ha.Provider, { value: pa(), children: /* @__PURE__ */ d(Zc, {}) })
6418
+ /* @__PURE__ */ d(fa.Provider, { value: ha(), children: /* @__PURE__ */ d(Zc, {}) })
6405
6419
  ), {
6406
6420
  update() {
6407
6421
  },
@@ -6419,12 +6433,12 @@ const el = (t) => {
6419
6433
  id: "player",
6420
6434
  name: "Media player",
6421
6435
  load: () => Promise.resolve(tl)
6422
- }, rl = sn(() => import("./MediaDrawer--2fhbPaa.js"));
6436
+ }, rl = sn(() => import("./MediaDrawer-C8HncoC9.js"));
6423
6437
  function sl() {
6424
6438
  const t = x((u) => u.snapshot), e = x((u) => u.ensureAutoIdentity), n = Rt(), r = Me(
6425
- () => n ? Fi(n, window.location.origin) : null,
6439
+ () => n ? Ja(n, window.location.origin) : null,
6426
6440
  [n]
6427
- ), s = ga(), i = N(!1), [a, c] = $(!1), l = s.roomKey || null;
6441
+ ), s = ma(), i = N(!1), [a, c] = $(!1), l = s.roomKey || null;
6428
6442
  So(), F(() => wo(), []), F(() => Mo(), []), F(() => {
6429
6443
  l && To(l);
6430
6444
  }, [l]), F(() => {
@@ -6438,9 +6452,9 @@ function sl() {
6438
6452
  try {
6439
6453
  await Promise.race([
6440
6454
  Promise.all([
6455
+ ga(),
6441
6456
  ba(),
6442
- ya(),
6443
- va().then(dr)
6457
+ ya().then(dr)
6444
6458
  ]),
6445
6459
  new Promise((b) => setTimeout(b, f))
6446
6460
  ]);
@@ -6451,7 +6465,7 @@ function sl() {
6451
6465
  const h = x.getState();
6452
6466
  E("room", "Joining room", { roomKey: l, name: h.name, sprite: h.sprite }), e();
6453
6467
  const g = x.getState();
6454
- Sa({
6468
+ va({
6455
6469
  room_key: l,
6456
6470
  name: g.name || void 0,
6457
6471
  sprite: g.sprite || void 0
@@ -6474,7 +6488,7 @@ function sl() {
6474
6488
  /* @__PURE__ */ d(Yi, {})
6475
6489
  ] })
6476
6490
  ] }),
6477
- /* @__PURE__ */ d(Ii, {}),
6491
+ /* @__PURE__ */ d(Fi, {}),
6478
6492
  /* @__PURE__ */ d(Ke.Suspense, { fallback: /* @__PURE__ */ d(Pi, { open: a, onClose: o }), children: /* @__PURE__ */ d(rl, { open: a, onClose: o }) })
6479
6493
  ] }) : (I("room", "No room key provided"), /* @__PURE__ */ d("div", { className: "flex-1 flex items-center justify-center p-6", children: /* @__PURE__ */ k("div", { className: "text-text-secondary", children: [
6480
6494
  "No room key provided. Go to the ",
@@ -6500,4 +6514,4 @@ export {
6500
6514
  ml as s,
6501
6515
  ln as u
6502
6516
  };
6503
- //# sourceMappingURL=Room-CY05nn0I.js.map
6517
+ //# sourceMappingURL=Room-CqOgWJsa.js.map