@hadoku/watchparty-ui 0.45.91 → 0.45.92

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,5 +1,5 @@
1
1
  import { jsx as c, jsxs as _, Fragment as le } from "react/jsx-runtime";
2
- import Le, { useState as k, useRef as W, useMemo as ee, useCallback as A, useEffect as E, createContext as it, useContext as Zt, useSyncExternalStore as nr, useId as rr, useEffectEvent as en } from "react";
2
+ import Le, { useState as k, useRef as G, useMemo as ee, useCallback as A, useEffect as E, createContext as it, useContext as Zt, useSyncExternalStore as nr, useId as rr, useEffectEvent as en } from "react";
3
3
  import { themePrefs as fe, Icon as or, THEMES as ar, useHadokuThemeOptional as ir } from "@wolffm/themes";
4
4
  import { z as o } from "zod";
5
5
  import { createCdnClient as sr, kindOfType as lr, MAX_BYTES as cr, measureImage as dr, filesFromClipboard as ur, filesFromDrop as mr, CdnError as et } from "@wolffm/cdn-client";
@@ -325,7 +325,7 @@ o.object({
325
325
  });
326
326
  const pn = o.partialRecord(Ee, o.array(o.string()));
327
327
  o.object({ board: pn });
328
- const Gr = o.object({
328
+ const Wr = o.object({
329
329
  mediaId: o.string(),
330
330
  tier: Ee,
331
331
  absoluteTier: Ee,
@@ -339,7 +339,7 @@ const Gr = o.object({
339
339
  });
340
340
  o.object({
341
341
  items: o.array(fn),
342
- placed: o.array(Gr),
342
+ placed: o.array(Wr),
343
343
  unrated: o.array(o.string()),
344
344
  spread: o.number(),
345
345
  nudged: o.boolean(),
@@ -351,7 +351,7 @@ o.object({
351
351
  voterCount: o.number().int().nonnegative(),
352
352
  myBoard: pn
353
353
  });
354
- const Wr = {
354
+ const Gr = {
355
355
  /** Broadcast to EVERY connected socket when anyone saves. Carries no board —
356
356
  * it is a "re-fetch" ping, because the shared result is identical for all
357
357
  * viewers but `myBoard` is not, and one payload cannot serve both. */
@@ -424,14 +424,14 @@ const Vr = [
424
424
  ]
425
425
  }
426
426
  ], dt = Vr.flatMap((e) => e.characters), Be = dt.map((e) => e.id), Kr = Object.fromEntries(dt.map((e) => [e.id, e.color])), Yr = Object.fromEntries(dt.map((e) => [e.id, "rev" in e ? e.rev : 1]));
427
- function zr(e) {
427
+ function Xr(e) {
428
428
  const t = Yr[e];
429
429
  return `/media/sprites/square_${e}.png${t > 1 ? `?v=${t}` : ""}`;
430
430
  }
431
- function Ge(e) {
431
+ function We(e) {
432
432
  return !!e && Be.includes(e);
433
433
  }
434
- const Xr = 5e3, gn = { mode: "off", percent: 0 }, Jr = ["off", "on", "ab"];
434
+ const zr = 5e3, gn = { mode: "off", percent: 0 }, Jr = ["off", "on", "ab"];
435
435
  function Qr(e) {
436
436
  return typeof e == "string" && Jr.includes(e);
437
437
  }
@@ -550,7 +550,9 @@ const ut = o.enum(["anilist", "tmdb"]), uo = o.object({
550
550
  poster: o.string().nullable(),
551
551
  /** The folder this show would land in — `SousouNoFrieren`. */
552
552
  series: o.string(),
553
- /** On the scraper's watch list already (by series). */
553
+ /** On the scraper's watch list already: an entry for this exact show (same
554
+ * provider id), not merely the same series folder — Season 2 of a show
555
+ * whose Season 1 is listed is NOT on the list. */
554
556
  onWatchlist: o.boolean(),
555
557
  /**
556
558
  * Not addable: a movie, or a title with no usable Latin-script name. The
@@ -576,22 +578,54 @@ o.object({
576
578
  source: ut,
577
579
  id: o.string().regex(/^\d{1,12}$/)
578
580
  });
579
- o.object({ series: o.string(), title: o.string() });
581
+ o.object({
582
+ series: o.string(),
583
+ title: o.string(),
584
+ /** The season the scraper recorded (it derives one from AniList's prequel
585
+ * chain), or null when it could not tell. */
586
+ season: o.number().int().nullable()
587
+ });
588
+ const fo = 99, po = o.object({
589
+ id: o.number().int(),
590
+ series: o.string(),
591
+ season: o.number().int().nullable(),
592
+ title: o.string(),
593
+ source: o.string().nullable(),
594
+ sourceId: o.string().nullable(),
595
+ createdAt: o.string().nullable(),
596
+ retiredAt: o.string().nullable(),
597
+ retiredReason: o.string().nullable(),
598
+ /** `you` — added for the caller; `other` — for someone else; `none` — no
599
+ * one (the scraper's committed list, an operator's add). */
600
+ owner: o.enum(["you", "other", "none"]),
601
+ /** The caller may change or remove it: their own row, or any row for an admin. */
602
+ editable: o.boolean(),
603
+ /** Episodes of this season the library holds: `ready` to play, and
604
+ * `downloaded` (in the input tree, ingested or not). Null when the season
605
+ * is unknown. */
606
+ episodes: o.object({ ready: o.number().int(), downloaded: o.number().int() }).nullable()
607
+ });
608
+ o.object({ entries: o.array(po) });
609
+ o.object({
610
+ season: o.number().int().min(1).max(fo).nullable().optional(),
611
+ title: o.string().trim().min(1).max(200).optional(),
612
+ retired: o.boolean().optional()
613
+ }).strict().refine((e) => e.season !== void 0 || e.title !== void 0 || e.retired !== void 0, { message: "nothing to change" });
580
614
  let xe = null, _n = on;
581
- function fo(e) {
615
+ function ho(e) {
582
616
  e.cdnBase && (_n = e.cdnBase);
583
617
  }
584
618
  function wn() {
585
619
  return _n.replace(/\/+$/, "");
586
620
  }
587
- function We() {
621
+ function Ge() {
588
622
  const e = wn();
589
623
  return (!xe || xe.base !== e) && (xe = { base: e, client: sr({ cdnBase: e }) }), xe.client;
590
624
  }
591
625
  function je(e) {
592
- return !st(e) || !wn() ? null : We().urlFor(e);
626
+ return !st(e) || !wn() ? null : Ge().urlFor(e);
593
627
  }
594
- function po(e) {
628
+ function go(e) {
595
629
  return e.kind === "file";
596
630
  }
597
631
  class Sn extends Error {
@@ -619,42 +653,42 @@ function Ae(e) {
619
653
  return "Image upload failed";
620
654
  }
621
655
  }
622
- function ho(e) {
656
+ function yo(e) {
623
657
  return e instanceof et ? Ae(e.reason) : e instanceof Sn ? e.message : "Image upload failed";
624
658
  }
625
- function go(e) {
659
+ function bo(e) {
626
660
  const t = e.type.toLowerCase().split(";")[0].trim();
627
661
  return t && lr(t) !== "image" ? Ae("unsupported-type") : e.size > cr.image ? Ae("too-large") : e.size === 0 ? Ae("invalid") : null;
628
662
  }
629
- function yo(e) {
663
+ function vo(e) {
630
664
  return ur(e);
631
665
  }
632
- function bo(e) {
666
+ function _o(e) {
633
667
  return mr(e);
634
668
  }
635
- async function vo(e) {
669
+ async function wo(e) {
636
670
  const t = await dr(e);
637
671
  return { w: t?.width ?? 0, h: t?.height ?? 0 };
638
672
  }
639
- async function _o(e, t = {}) {
640
- const n = await We().upload(e, { signal: t.signal });
673
+ async function So(e, t = {}) {
674
+ const n = await Ge().upload(e, { signal: t.signal });
641
675
  if (!st(n.key))
642
676
  throw new Sn("Image upload returned an unusable key");
643
677
  return { key: n.key, deduplicated: n.deduplicated === !0 };
644
678
  }
645
- async function wo(e, t = {}) {
679
+ async function xo(e, t = {}) {
646
680
  const n = [];
647
681
  for (const r of e) {
648
682
  if (r.kind === "remote") {
649
683
  n.push({ key: r.key, w: r.w, h: r.h, ...r.title ? { title: r.title } : {} });
650
684
  continue;
651
685
  }
652
- const { key: a } = await _o(r.file, t);
686
+ const { key: a } = await So(r.file, t);
653
687
  n.push({ key: a, w: r.w, h: r.h });
654
688
  }
655
689
  return n;
656
690
  }
657
- function So(e) {
691
+ function Co(e) {
658
692
  return {
659
693
  error: e instanceof Error ? e.message : String(e),
660
694
  name: e instanceof Error ? e.name : typeof e,
@@ -665,38 +699,38 @@ function So(e) {
665
699
  function mt(e) {
666
700
  return e.key === "Escape" || e.key === "GoBack" || e.key === "BrowserBack" || e.key === "XF86Back" || e.keyCode === 461 || e.keyCode === 10009;
667
701
  }
668
- function xo(e) {
702
+ function Io(e) {
669
703
  return `/tv?return=${encodeURIComponent(e.pathname + e.search)}`;
670
704
  }
671
- function Co({ className: e }) {
705
+ function To({ className: e }) {
672
706
  return /* @__PURE__ */ c(
673
707
  "a",
674
708
  {
675
- href: xo(window.location),
709
+ href: Io(window.location),
676
710
  className: e,
677
711
  "data-testid": "sign-in-with-code",
678
712
  children: "Sign in with a code"
679
713
  }
680
714
  );
681
715
  }
682
- const nt = 240, ne = 8, Io = 28, xn = 240;
683
- function To(e, t, n) {
716
+ const nt = 240, ne = 8, ko = 28, xn = 240;
717
+ function Eo(e, t, n) {
684
718
  let r = t.left - nt - ne;
685
719
  r < ne && (r = t.right + ne), r = Math.min(r, n.width - nt - ne), r = Math.max(ne, r);
686
- const a = xn + Io;
720
+ const a = xn + ko;
687
721
  let i = e.top + e.height / 2 - a / 2;
688
722
  return i = Math.min(i, n.height - a - ne), i = Math.max(ne, i), { left: r, top: i };
689
723
  }
690
- const Cn = "/dataplatform/api/memes", ko = 120;
691
- function Eo({ onClose: e, onPick: t, onUnavailable: n }) {
692
- const [r, a] = k(""), i = W(null), s = W(null), l = We(), { items: d, loading: h, error: f, hasMore: M, loadMore: R } = Nr(
724
+ const Cn = "/dataplatform/api/memes", Ao = 120;
725
+ function No({ onClose: e, onPick: t, onUnavailable: n }) {
726
+ const [r, a] = k(""), i = G(null), s = G(null), l = Ge(), { items: d, loading: h, error: f, hasMore: M, loadMore: R } = Nr(
693
727
  l,
694
728
  Cn,
695
729
  r.trim()
696
730
  ), D = f?.reason ?? null, H = ee(() => {
697
731
  const C = /* @__PURE__ */ new Set();
698
732
  return d.filter((O) => C.has(O.key) ? !1 : (C.add(O.key), !0));
699
- }, [d]), [p, x] = k(null), w = W(null), y = A(() => {
733
+ }, [d]), [p, x] = k(null), w = G(null), y = A(() => {
700
734
  w.current !== null && (window.clearTimeout(w.current), w.current = null);
701
735
  }, []), g = A(() => {
702
736
  y(), x(null);
@@ -706,12 +740,12 @@ function Eo({ onClose: e, onPick: t, onUnavailable: n }) {
706
740
  if (!F) return;
707
741
  const ae = () => x({
708
742
  item: C,
709
- ...To(O.getBoundingClientRect(), F.getBoundingClientRect(), {
743
+ ...Eo(O.getBoundingClientRect(), F.getBoundingClientRect(), {
710
744
  width: window.innerWidth,
711
745
  height: window.innerHeight
712
746
  })
713
747
  });
714
- y(), P ? ae() : w.current = window.setTimeout(ae, ko);
748
+ y(), P ? ae() : w.current = window.setTimeout(ae, Ao);
715
749
  },
716
750
  [y]
717
751
  );
@@ -769,7 +803,7 @@ function Eo({ onClose: e, onPick: t, onUnavailable: n }) {
769
803
  "data-reason": D,
770
804
  children: D === "unauthenticated" ? /* @__PURE__ */ _(le, { children: [
771
805
  "Sign in to browse memes · ",
772
- /* @__PURE__ */ c(Co, { className: "underline text-on-danger-bg" })
806
+ /* @__PURE__ */ c(To, { className: "underline text-on-danger-bg" })
773
807
  ] }) : D === "forbidden" ? "Your account can't browse the meme library" : "Meme library is unavailable"
774
808
  }
775
809
  ),
@@ -856,8 +890,8 @@ function Eo({ onClose: e, onPick: t, onUnavailable: n }) {
856
890
  }
857
891
  );
858
892
  }
859
- function Ao({ open: e, ...t }) {
860
- return e ? /* @__PURE__ */ c(Eo, { ...t }) : null;
893
+ function Po({ open: e, ...t }) {
894
+ return e ? /* @__PURE__ */ c(No, { ...t }) : null;
861
895
  }
862
896
  const ft = {
863
897
  serverOrigin: `http://localhost:${lt}`,
@@ -865,24 +899,24 @@ const ft = {
865
899
  cdnBase: on
866
900
  };
867
901
  let Ne = { ...ft };
868
- function No(e) {
902
+ function Ro(e) {
869
903
  const t = Object.fromEntries(
870
904
  Object.entries(e).filter(([n, r]) => r !== void 0)
871
905
  );
872
- Ne = { ...Ne, ...t }, fo({ cdnBase: Ne.cdnBase });
906
+ Ne = { ...Ne, ...t }, ho({ cdnBase: Ne.cdnBase });
873
907
  }
874
908
  function _e() {
875
909
  return Ne;
876
910
  }
877
- const Po = it(ft);
878
- function Ro(e) {
911
+ const Do = it(ft);
912
+ function Oo(e) {
879
913
  return e.serverOrigin?.replace(/\/$/, "") || "";
880
914
  }
881
915
  function In() {
882
- return Ro(_e());
916
+ return Oo(_e());
883
917
  }
884
918
  const Tn = it(null);
885
- function Do() {
919
+ function Mo() {
886
920
  return Zt(Tn);
887
921
  }
888
922
  const kn = it(!0);
@@ -901,7 +935,7 @@ const ge = Le.memo(
901
935
  },
902
936
  (e, t) => e.html === t.html && e.as === t.as && e.className === t.className && JSON.stringify(e.style) === JSON.stringify(t.style)
903
937
  );
904
- function Oo(e, t) {
938
+ function Lo(e, t) {
905
939
  E(() => {
906
940
  const n = e.current;
907
941
  if (!n || !t || typeof IntersectionObserver > "u") return;
@@ -926,7 +960,7 @@ function qe() {
926
960
  return null;
927
961
  }
928
962
  }
929
- function G(e) {
963
+ function W(e) {
930
964
  try {
931
965
  return qe()?.getItem(e) ?? null;
932
966
  } catch {
@@ -941,7 +975,7 @@ function pt(e, t) {
941
975
  return !1;
942
976
  }
943
977
  }
944
- function Mo() {
978
+ function jo() {
945
979
  try {
946
980
  const e = qe();
947
981
  if (!e) return [];
@@ -961,8 +995,8 @@ function Ue(e) {
961
995
  } catch {
962
996
  }
963
997
  }
964
- function Lo(e) {
965
- const t = G(e);
998
+ function Uo(e) {
999
+ const t = W(e);
966
1000
  return t === null ? null : t === "true" ? !0 : t === "false" ? !1 : null;
967
1001
  }
968
1002
  const Nn = /* @__PURE__ */ new Map();
@@ -970,36 +1004,36 @@ let Pn = !1;
970
1004
  function Ve(e, t) {
971
1005
  Nn.set(e, t), Pn && Rn(e, t);
972
1006
  }
973
- function jo() {
1007
+ function Ho() {
974
1008
  Pn = !0;
975
1009
  for (const [e, t] of Nn) Rn(e, t);
976
1010
  }
977
1011
  function Rn(e, t) {
978
1012
  typeof window > "u" || (window[e] = t);
979
1013
  }
980
- const pe = [], Uo = 500;
1014
+ const pe = [], Fo = 500;
981
1015
  let Pe = [], rt = null;
982
- const Ho = 1e3, Fo = 200;
1016
+ const $o = 1e3, Bo = 200;
983
1017
  let ot = null;
984
1018
  function Dn(e) {
985
1019
  ot = e;
986
1020
  }
987
1021
  function On() {
988
- return G(de.REPORT_LOGS_FLAG) === "true";
1022
+ return W(de.REPORT_LOGS_FLAG) === "true";
989
1023
  }
990
- function $o() {
1024
+ function Wo() {
991
1025
  if (typeof window > "u") return !1;
992
1026
  if (window.__WP_DEBUG__ || new URLSearchParams(window.location.search).get("debug") === "true") return !0;
993
- const t = G(de.DEBUG_FLAG);
1027
+ const t = W(de.DEBUG_FLAG);
994
1028
  return t !== null && t !== "false";
995
1029
  }
996
- function Bo() {
997
- const e = G(de.DEBUG_FLAG);
1030
+ function Go() {
1031
+ const e = W(de.DEBUG_FLAG);
998
1032
  if (!e || e === "true") return null;
999
1033
  const t = e.split(",").map((n) => n.trim().toLowerCase()).filter(Boolean);
1000
1034
  return t.length > 0 ? new Set(t) : null;
1001
1035
  }
1002
- function Go() {
1036
+ function qo() {
1003
1037
  return (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", {
1004
1038
  hour12: !1,
1005
1039
  hour: "2-digit",
@@ -1008,8 +1042,8 @@ function Go() {
1008
1042
  fractionalSecondDigits: 3
1009
1043
  });
1010
1044
  }
1011
- function Wo(e) {
1012
- pe.push(e), pe.length > Uo && pe.shift();
1045
+ function Vo(e) {
1046
+ pe.push(e), pe.length > Fo && pe.shift();
1013
1047
  }
1014
1048
  const Ke = {
1015
1049
  debug: "color: #64748b; font-weight: normal;",
@@ -1018,7 +1052,7 @@ const Ke = {
1018
1052
  category: "color: #3b82f6; font-weight: bold;",
1019
1053
  time: "color: #6b7280; font-weight: normal;"
1020
1054
  };
1021
- function qo(e) {
1055
+ function Ko(e) {
1022
1056
  try {
1023
1057
  return JSON.stringify(e);
1024
1058
  } catch {
@@ -1033,12 +1067,12 @@ function ht(e, t, n, r, a, i, s) {
1033
1067
  data: s,
1034
1068
  timestamp: Date.now()
1035
1069
  };
1036
- if (Wo(l), (n || On()) && Et(l), !r) {
1037
- if (!$o()) return;
1038
- const f = Bo();
1070
+ if (Vo(l), (n || On()) && Et(l), !r) {
1071
+ if (!Wo()) return;
1072
+ const f = Go();
1039
1073
  if (f && !f.has(a.toLowerCase())) return;
1040
1074
  }
1041
- const d = Go(), h = s !== void 0 ? " " + qo(s) : "";
1075
+ const d = qo(), h = s !== void 0 ? " " + Ko(s) : "";
1042
1076
  t(
1043
1077
  `%c[${d}]%c [${a}]%c ${i}${h}`,
1044
1078
  Ke.time,
@@ -1055,25 +1089,25 @@ function I(e, t, n) {
1055
1089
  function Re(e, t, n) {
1056
1090
  ht("error", console.error, !0, !0, e, t, n);
1057
1091
  }
1058
- function Vo() {
1092
+ function Yo() {
1059
1093
  return [...pe];
1060
1094
  }
1061
- function Ko() {
1095
+ function Xo() {
1062
1096
  pe.length = 0;
1063
1097
  }
1064
- function Yo(e) {
1098
+ function zo(e) {
1065
1099
  const t = e && e.length > 0 ? e.join(",") : "true";
1066
1100
  pt(de.DEBUG_FLAG, t), console.log("[wp] Debug mode enabled");
1067
1101
  }
1068
- function zo() {
1102
+ function Jo() {
1069
1103
  Ue(de.DEBUG_FLAG), console.log("[wp] Debug mode disabled");
1070
1104
  }
1071
- const Xo = 1024, Jo = 5e4;
1072
- function Qo(e) {
1105
+ const Qo = 1024, Zo = 5e4;
1106
+ function ea(e) {
1073
1107
  if (e == null) return e;
1074
1108
  try {
1075
1109
  const t = JSON.stringify(e);
1076
- if (t.length <= Xo) return e;
1110
+ if (t.length <= Qo) return e;
1077
1111
  if (typeof e == "object" && !Array.isArray(e)) {
1078
1112
  const n = {};
1079
1113
  for (const [r, a] of Object.entries(e)) {
@@ -1087,7 +1121,7 @@ function Qo(e) {
1087
1121
  return "[unserializable]";
1088
1122
  }
1089
1123
  }
1090
- async function Zo() {
1124
+ async function ta() {
1091
1125
  if (Pe.length === 0) return;
1092
1126
  const e = Pe;
1093
1127
  Pe = [], rt = null;
@@ -1101,7 +1135,7 @@ async function Zo() {
1101
1135
  level: l.level,
1102
1136
  category: l.category,
1103
1137
  message: l.message,
1104
- data: Qo(l.data),
1138
+ data: ea(l.data),
1105
1139
  timestamp: l.timestamp,
1106
1140
  url: typeof window < "u" ? window.location.href : void 0,
1107
1141
  userAgent: typeof navigator < "u" ? navigator.userAgent : void 0,
@@ -1111,7 +1145,7 @@ async function Zo() {
1111
1145
  let i = [], s = 0;
1112
1146
  for (const l of a) {
1113
1147
  const d = JSON.stringify(l).length + 1;
1114
- s + d > Jo && i.length > 0 && (await fetch(r, {
1148
+ s + d > Zo && i.length > 0 && (await fetch(r, {
1115
1149
  method: "POST",
1116
1150
  headers: { "Content-Type": "application/json" },
1117
1151
  body: JSON.stringify({ logs: i })
@@ -1128,9 +1162,9 @@ async function Zo() {
1128
1162
  }
1129
1163
  function Et(e) {
1130
1164
  if (Pe.push(e), !rt) {
1131
- const t = On() ? Fo : Ho;
1165
+ const t = On() ? Bo : $o;
1132
1166
  rt = setTimeout(() => {
1133
- Zo();
1167
+ ta();
1134
1168
  }, t);
1135
1169
  }
1136
1170
  }
@@ -1138,16 +1172,16 @@ function we(e) {
1138
1172
  return e instanceof Error ? { error: e.message, name: e.name } : { error: String(e), name: typeof e };
1139
1173
  }
1140
1174
  Ve("__wpDebug", {
1141
- enable: Yo,
1142
- disable: zo,
1143
- history: Vo,
1144
- clear: Ko
1175
+ enable: zo,
1176
+ disable: Jo,
1177
+ history: Yo,
1178
+ clear: Xo
1145
1179
  });
1146
- const ea = 1280;
1147
- function ta(e) {
1148
- return e.screenWidth < ea ? !1 : e.noHoverNoPointer || e.anyHoverNone && e.maxTouchPoints === 0;
1180
+ const na = 1280;
1181
+ function ra(e) {
1182
+ return e.screenWidth < na ? !1 : e.noHoverNoPointer || e.anyHoverNone && e.maxTouchPoints === 0;
1149
1183
  }
1150
- function na() {
1184
+ function oa() {
1151
1185
  const e = (t) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(t).matches;
1152
1186
  return {
1153
1187
  noHoverNoPointer: e("(hover: none) and (pointer: none)"),
@@ -1157,11 +1191,11 @@ function na() {
1157
1191
  };
1158
1192
  }
1159
1193
  let At = null;
1160
- function ra() {
1161
- return At ??= ta(na()), At;
1194
+ function aa() {
1195
+ return At ??= ra(oa()), At;
1162
1196
  }
1163
1197
  function Nt() {
1164
- return ra();
1198
+ return aa();
1165
1199
  }
1166
1200
  const Q = {
1167
1201
  resolved: !1,
@@ -1171,23 +1205,23 @@ const Q = {
1171
1205
  function gt() {
1172
1206
  return Q.accountId ? Q.accountId : Q.resolved && Q.userType === "public" ? "anon" : null;
1173
1207
  }
1174
- function oa(e) {
1208
+ function ia(e) {
1175
1209
  Q.resolved = !0, e.userType && (Q.userType = e.userType), e.userId !== void 0 && (Q.accountId = e.userId && e.userId !== "public" ? e.userId : null);
1176
1210
  }
1177
1211
  function yt() {
1178
1212
  return Q.accountId ?? "public";
1179
1213
  }
1180
- function aa() {
1214
+ function sa() {
1181
1215
  return gt() ?? "unscoped";
1182
1216
  }
1183
1217
  function Mn(e) {
1184
- return Ge(e) ? Kr[e] : "var(--color-neutral-bg)";
1218
+ return We(e) ? Kr[e] : "var(--color-neutral-bg)";
1185
1219
  }
1186
- function ia(e) {
1187
- return Ge(e) ? `${_e().serverOrigin.replace(/\/$/, "")}${zr(e)}` : void 0;
1220
+ function la(e) {
1221
+ return We(e) ? `${_e().serverOrigin.replace(/\/$/, "")}${Xr(e)}` : void 0;
1188
1222
  }
1189
1223
  let ye = null, Ce = null;
1190
- function sa() {
1224
+ function ca() {
1191
1225
  return ye ? Promise.resolve() : Ce || (Ce = (async () => {
1192
1226
  try {
1193
1227
  const e = _e().serverOrigin.replace(/\/$/, ""), t = await fetch(`${e}/media/sprites/names.json`, { cache: "no-cache" });
@@ -1206,7 +1240,7 @@ function re(e) {
1206
1240
  const t = e.toLowerCase();
1207
1241
  return Be.some((n) => n === t) ? !0 : ye ? Object.values(ye).some((n) => n.toLowerCase() === t) : !1;
1208
1242
  }
1209
- const la = o.object({
1243
+ const da = o.object({
1210
1244
  // Identity. There is deliberately NO `name`: a person's name is their
1211
1245
  // hadoku key-registry name, resolved by the server from whoami and renamed
1212
1246
  // through hadoku_site's POST /session/name (operator decision 2026-10-08).
@@ -1233,19 +1267,19 @@ const la = o.object({
1233
1267
  subtitleStyle: o.string().optional()
1234
1268
  }), he = Sr({
1235
1269
  appId: "watchparty",
1236
- schema: la
1237
- }), ca = /* @__PURE__ */ new Set(["theme", "themeMode"]);
1270
+ schema: da
1271
+ }), ua = /* @__PURE__ */ new Set(["theme", "themeMode"]);
1238
1272
  function He(e) {
1239
1273
  const t = gt();
1240
1274
  return t ? `prefs-cache:${t}:${e}` : null;
1241
1275
  }
1242
- function da() {
1276
+ function ma() {
1243
1277
  return gt() === null;
1244
1278
  }
1245
1279
  function Pt(e) {
1246
1280
  const t = He(e);
1247
1281
  if (!t) return {};
1248
- const n = G(t);
1282
+ const n = W(t);
1249
1283
  if (!n) return {};
1250
1284
  try {
1251
1285
  return JSON.parse(n)?.blob ?? {};
@@ -1253,12 +1287,12 @@ function Pt(e) {
1253
1287
  return {};
1254
1288
  }
1255
1289
  }
1256
- function ua() {
1290
+ function fa() {
1257
1291
  let e = 0;
1258
- for (const t of Mo()) {
1292
+ for (const t of jo()) {
1259
1293
  const n = t.startsWith("prefs-cache:") && t.endsWith(":watchparty"), r = t === Fe || t.startsWith(`${Fe}:`) && !t.endsWith(":_serverSynced_v1");
1260
1294
  if (!n && !r) continue;
1261
- const a = G(t);
1295
+ const a = W(t);
1262
1296
  if (!a) continue;
1263
1297
  let i;
1264
1298
  try {
@@ -1276,7 +1310,7 @@ function ua() {
1276
1310
  let Ln = null, jn = null;
1277
1311
  const Rt = /* @__PURE__ */ new Set();
1278
1312
  function bt() {
1279
- if (da())
1313
+ if (ma())
1280
1314
  return u("preferences", "Boot read deferred — session pending, identity unresolved"), {};
1281
1315
  const e = Pt("portfolio"), t = Pt("watchparty"), n = Object.keys(e).length > 0 ? e : Ln ?? {}, r = Object.keys(t).length > 0 ? t : jn ?? {}, a = yt() || "public";
1282
1316
  if (Rt.has(a))
@@ -1301,15 +1335,15 @@ function bt() {
1301
1335
  }), s;
1302
1336
  }
1303
1337
  let Un = !1;
1304
- function ma() {
1338
+ function pa() {
1305
1339
  const e = yt();
1306
1340
  return !e || e === "public";
1307
1341
  }
1308
1342
  function q(e, t) {
1309
- ma() && (Un = !0), ca.has(e) ? fe.save({ [e]: t }, { scope: "device" }).catch((n) => I("preferences", "themePrefs.save failed", { key: e, err: n?.message })) : he.save({ [e]: t }).catch((n) => I("preferences", "watchpartyPrefs.save failed", { key: e, err: n?.message })), u("preferences", "Saved (via SDK)", { key: e, value: t });
1343
+ pa() && (Un = !0), ua.has(e) ? fe.save({ [e]: t }, { scope: "device" }).catch((n) => I("preferences", "themePrefs.save failed", { key: e, err: n?.message })) : he.save({ [e]: t }).catch((n) => I("preferences", "watchpartyPrefs.save failed", { key: e, err: n?.message })), u("preferences", "Saved (via SDK)", { key: e, value: t });
1310
1344
  }
1311
1345
  let Ie = null, Dt = !1;
1312
- function fa() {
1346
+ function ha() {
1313
1347
  return Ie || (Ie = (async () => {
1314
1348
  if (typeof window > "u") return !1;
1315
1349
  try {
@@ -1328,14 +1362,14 @@ function fa() {
1328
1362
  } catch (s) {
1329
1363
  I("preferences", "inline rehydrate after SDK read failed", { err: s?.message });
1330
1364
  }
1331
- const n = He("portfolio"), r = He("watchparty"), a = n ? G(n) : null, i = r ? G(r) : null;
1365
+ const n = He("portfolio"), r = He("watchparty"), a = n ? W(n) : null, i = r ? W(r) : null;
1332
1366
  return u("preferences", "sdk.read", {
1333
1367
  themeKeys: Object.keys(e ?? {}),
1334
1368
  appKeys: Object.keys(t ?? {}),
1335
1369
  // Post-fetch cache state: should be non-zero if SDK wrote it.
1336
1370
  sdkThemeBytesPost: a?.length ?? 0,
1337
1371
  sdkAppBytesPost: i?.length ?? 0
1338
- }), await pa(e, t), Un ? (u("preferences", "Promoting this load's pre-auth picks to the signed-in user"), await Promise.all([
1372
+ }), await ga(e, t), Un ? (u("preferences", "Promoting this load's pre-auth picks to the signed-in user"), await Promise.all([
1339
1373
  fe.promoteAnonPrefsToUser().catch(() => {
1340
1374
  }),
1341
1375
  he.promoteAnonPrefsToUser().catch(() => {
@@ -1347,13 +1381,13 @@ function fa() {
1347
1381
  })(), Ie);
1348
1382
  }
1349
1383
  const Fe = "watchparty_preferences";
1350
- ua();
1384
+ fa();
1351
1385
  function at() {
1352
1386
  const e = yt();
1353
1387
  return !e || e === "public" ? Fe : `${Fe}:${e}`;
1354
1388
  }
1355
1389
  function Hn() {
1356
- const e = G(at());
1390
+ const e = W(at());
1357
1391
  if (!e) return null;
1358
1392
  try {
1359
1393
  const t = JSON.parse(e);
@@ -1365,7 +1399,7 @@ function Hn() {
1365
1399
  function Ot() {
1366
1400
  Ue(at()), Ue(`${at()}:_serverSynced_v1`);
1367
1401
  }
1368
- async function pa(e, t) {
1402
+ async function ga(e, t) {
1369
1403
  const n = Hn();
1370
1404
  if (!n || Object.keys(n).length === 0) return;
1371
1405
  const r = Object.keys(e ?? {}).length > 0, a = Object.keys(t ?? {}).length > 0, i = {}, s = {};
@@ -1422,16 +1456,16 @@ function jt(e) {
1422
1456
  }
1423
1457
  }).catch((t) => I("preferences", "store import failed", { reason: e, err: t?.message }));
1424
1458
  }
1425
- const Fn = 320, $e = 240, vt = 640, ha = 320, ga = 36, Ut = 16;
1459
+ const Fn = 320, $e = 240, vt = 640, ya = 320, ba = 36, Ut = 16;
1426
1460
  function Y(e, t) {
1427
1461
  if (!Number.isFinite(e)) return Fn;
1428
1462
  let n = vt;
1429
- return t !== void 0 && Number.isFinite(t) && t > 0 && (n = Math.min(n, t - ha)), n = Math.max(n, $e), Math.round(Math.min(n, Math.max($e, e)));
1463
+ return t !== void 0 && Number.isFinite(t) && t > 0 && (n = Math.min(n, t - ya)), n = Math.max(n, $e), Math.round(Math.min(n, Math.max($e, e)));
1430
1464
  }
1431
1465
  function Ht(e, t, n, r) {
1432
1466
  return Y(e + (t - n), r);
1433
1467
  }
1434
- function ya(e, t, n) {
1468
+ function va(e, t, n) {
1435
1469
  switch (t) {
1436
1470
  case "ArrowLeft":
1437
1471
  return Y(e + Ut, n);
@@ -1445,8 +1479,8 @@ function ya(e, t, n) {
1445
1479
  return null;
1446
1480
  }
1447
1481
  }
1448
- function ba(e, t) {
1449
- return { collapsed: e, width: e ? ga : t };
1482
+ function _a(e, t) {
1483
+ return { collapsed: e, width: e ? ba : t };
1450
1484
  }
1451
1485
  function $n(e, t) {
1452
1486
  const n = new Set(t.map((i) => i.id)), r = t.reduce((i, s) => Math.max(i, s.ts), -1 / 0), a = e.filter((i) => !n.has(i.id) && i.ts > r);
@@ -1683,30 +1717,30 @@ const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1683
1717
  mergeHistory: $n,
1684
1718
  useAppStore: m
1685
1719
  }, Symbol.toStringTag, { value: "Module" }));
1686
- function Gn(e) {
1720
+ function Wn(e) {
1687
1721
  const t = typeof window < "u" ? window.location.href : "http://localhost/", n = new URL(e, t).pathname;
1688
1722
  return `${n.endsWith("/") ? n : `${n}/`}socket.io/`;
1689
1723
  }
1690
- function va(e) {
1724
+ function wa(e) {
1691
1725
  const t = typeof window < "u" ? window.location.href : "http://localhost/", n = e.namespace ?? "/chat";
1692
1726
  return {
1693
1727
  url: `${new URL(e.origin, t).origin}${n.startsWith("/") ? n : `/${n}`}`,
1694
- path: e.path ?? Gn(e.origin)
1728
+ path: e.path ?? Wn(e.origin)
1695
1729
  };
1696
1730
  }
1697
1731
  let K = null, Z = null, De = null;
1698
1732
  function Ft(e) {
1699
- e && K && e.origin === K.origin && e.path === K.path && e.namespace === K.namespace || !e && !K || (Wn(), K = e);
1733
+ e && K && e.origin === K.origin && e.path === K.path && e.namespace === K.namespace || !e && !K || (Gn(), K = e);
1700
1734
  }
1701
1735
  function _t() {
1702
1736
  return K !== null;
1703
1737
  }
1704
- function _a(e) {
1738
+ function Sa(e) {
1705
1739
  if (K)
1706
1740
  if (De = e, Z)
1707
1741
  Z.connected && Z.emit(v.JOIN, e);
1708
1742
  else {
1709
- const { url: t, path: n } = va(K), r = tt(t, { path: n, transports: ["websocket", "polling"] });
1743
+ const { url: t, path: n } = wa(K), r = tt(t, { path: n, transports: ["websocket", "polling"] });
1710
1744
  Z = r, u("chat", "External chat socket", { url: t, path: n }), qn(r), r.on(v.ERROR, (a) => {
1711
1745
  const i = a?.message || a?.code || "chat error";
1712
1746
  I("chat", `Chat server error: ${i}`, { code: a?.code }), m.getState().pushToast("error", i);
@@ -1715,10 +1749,10 @@ function _a(e) {
1715
1749
  }), r.on("connect_error", (a) => I("chat", "Chat connection error", { message: a?.message }));
1716
1750
  }
1717
1751
  }
1718
- function wa(e) {
1752
+ function xa(e) {
1719
1753
  Z?.emit(v.CHAT_SEND, e);
1720
1754
  }
1721
- function Wn() {
1755
+ function Gn() {
1722
1756
  De = null, Z && (Z.disconnect(), Z = null);
1723
1757
  }
1724
1758
  function $t(e, t) {
@@ -1751,29 +1785,29 @@ function qn(e, t = () => !0) {
1751
1785
  });
1752
1786
  }
1753
1787
  let Vn = null;
1754
- function Sa(e) {
1788
+ function Ca(e) {
1755
1789
  Vn = e;
1756
1790
  }
1757
- function xa(e = Vn) {
1791
+ function Ia(e = Vn) {
1758
1792
  if (!e) return null;
1759
1793
  const t = typeof window < "u" ? window.location.href : "http://localhost/", n = e.namespace ?? "/room";
1760
1794
  return {
1761
1795
  url: `${new URL(e.origin, t).origin}${n.startsWith("/") ? n : `/${n}`}`,
1762
- path: e.path ?? Gn(e.origin)
1796
+ path: e.path ?? Wn(e.origin)
1763
1797
  };
1764
1798
  }
1765
- function Ca(e) {
1799
+ function Ta(e) {
1766
1800
  return `${In()}/media/${e}`.replace(/\\/g, "/");
1767
1801
  }
1768
- function Ia(e, t) {
1769
- return Ca(t ?? `${e}/poster.jpg`);
1802
+ function ka(e, t) {
1803
+ return Ta(t ?? `${e}/poster.jpg`);
1770
1804
  }
1771
- function Ta(e) {
1805
+ function Ea(e) {
1772
1806
  return `${In()}${e}`.replace(/\\/g, "/");
1773
1807
  }
1774
- async function ka(e) {
1808
+ async function Aa(e) {
1775
1809
  try {
1776
- const t = await fetch(Ta("/api/tierlist"));
1810
+ const t = await fetch(Ea("/api/tierlist"));
1777
1811
  if (!t.ok)
1778
1812
  return I("tierlist", "Board fetch failed", { status: t.status }), null;
1779
1813
  const n = await t.json();
@@ -1787,49 +1821,49 @@ async function ka(e) {
1787
1821
  }
1788
1822
  }
1789
1823
  let Bt = !1;
1790
- function Ea() {
1824
+ function Na() {
1791
1825
  if (Bt || typeof Image > "u") return;
1792
1826
  const e = m.getState().tierlist;
1793
1827
  if (!(!e || e.items.length === 0)) {
1794
1828
  Bt = !0;
1795
1829
  for (const t of e.items) {
1796
1830
  const n = new Image();
1797
- n.decoding = "async", n.src = Ia(t.id, t.thumbnail);
1831
+ n.decoding = "async", n.src = ka(t.id, t.thumbnail);
1798
1832
  }
1799
1833
  u("tierlist", "Warming posters", { count: e.items.length });
1800
1834
  }
1801
1835
  }
1802
- function Aa() {
1836
+ function Pa() {
1803
1837
  const e = m.getState(), t = rn(Object.values(e.roster).map((a) => a.sprite), void 0, Be);
1804
1838
  if (!t)
1805
1839
  return I("socket", "sprite_taken: no available sprites to retry with"), null;
1806
1840
  const n = !!e.name && !re(e.name), r = n ? e.name : be(t);
1807
1841
  return u("socket", "sprite_taken: retrying with a free character", { from: e.sprite, to: t, name: r, keptCustomName: n }), e.setSessionIdentity(r, t), { name: r, sprite: t };
1808
1842
  }
1809
- function Na(e) {
1843
+ function Ra(e) {
1810
1844
  const t = m.getState(), n = e ? t.roster[e] : void 0;
1811
1845
  return !n || !!n.sprite && n.sprite === t.sprite;
1812
1846
  }
1813
- const Pa = "hadoku:name";
1814
- function Ra(e) {
1847
+ const Da = "hadoku:name";
1848
+ function Oa(e) {
1815
1849
  const t = Tr(e);
1816
- return Ge(t) ? t : null;
1850
+ return We(t) ? t : null;
1817
1851
  }
1818
- async function Da(e = {}) {
1852
+ async function Ma(e = {}) {
1819
1853
  const t = await Ir({
1820
1854
  ...e,
1821
1855
  onError: (r) => I("avatar", "Avatar settings read failed — keeping the auto-assigned character", we(r))
1822
- }), n = Ge(t) ? t : null;
1856
+ }), n = We(t) ? t : null;
1823
1857
  return u("avatar", "Requested character from prefs-api", { sprite: n }), n;
1824
1858
  }
1825
- function Gt(e) {
1859
+ function Wt(e) {
1826
1860
  if (!e) return !1;
1827
1861
  const t = m.getState();
1828
1862
  if (t.sprite === e) return !1;
1829
1863
  const r = !!(t.me.clientId && t.roster[t.me.clientId]?.registryName) || !t.name || !re(t.name) ? t.name : be(e);
1830
1864
  return t.setSessionIdentity(r, e), !0;
1831
1865
  }
1832
- function Oa(e, t, n) {
1866
+ function La(e, t, n) {
1833
1867
  if (!n) return () => {
1834
1868
  };
1835
1869
  const r = (a) => {
@@ -1838,26 +1872,26 @@ function Oa(e, t, n) {
1838
1872
  };
1839
1873
  return n.addEventListener(e, r), () => n.removeEventListener(e, r);
1840
1874
  }
1841
- const Ma = () => typeof window > "u" ? void 0 : window;
1842
- function La(e, t = Ma()) {
1843
- return Oa(Pa, (n) => {
1875
+ const ja = () => typeof window > "u" ? void 0 : window;
1876
+ function Ua(e, t = ja()) {
1877
+ return La(Da, (n) => {
1844
1878
  typeof n.name == "string" && n.name.trim() && e(n.name);
1845
1879
  }, t);
1846
1880
  }
1847
- const ja = 10;
1848
- function Ua(e = typeof window < "u" ? window : void 0) {
1881
+ const Ha = 10;
1882
+ function Fa(e = typeof window < "u" ? window : void 0) {
1849
1883
  if (!e) return { framed: !1, depth: 0 };
1850
1884
  try {
1851
1885
  let t = 0, n = e;
1852
- for (; n !== n.parent && t < ja; )
1886
+ for (; n !== n.parent && t < Ha; )
1853
1887
  t++, n = n.parent;
1854
1888
  return { framed: e.top ? e.top !== e.self : t > 0, depth: t };
1855
1889
  } catch {
1856
1890
  return { framed: !1, depth: 0 };
1857
1891
  }
1858
1892
  }
1859
- const Ha = "watchparty_fragment_delivery";
1860
- function Fa() {
1893
+ const $a = "watchparty_fragment_delivery";
1894
+ function Ba() {
1861
1895
  if (typeof window > "u") return null;
1862
1896
  try {
1863
1897
  const e = new URLSearchParams(window.location.search).get("fragmentDelivery");
@@ -1865,27 +1899,27 @@ function Fa() {
1865
1899
  if (e === "0" || e === "false") return !1;
1866
1900
  } catch {
1867
1901
  }
1868
- return Lo(Ha);
1902
+ return Uo($a);
1869
1903
  }
1870
- let $a = { ...gn }, Ye = null;
1871
- const Wt = "watchparty_delivery_client_id";
1872
- function Ba() {
1873
- const e = G(Wt);
1904
+ let Wa = { ...gn }, Ye = null;
1905
+ const Gt = "watchparty_delivery_client_id";
1906
+ function Ga() {
1907
+ const e = W(Gt);
1874
1908
  if (e) return e;
1875
1909
  const t = globalThis.crypto?.randomUUID?.() ?? `d${Math.random().toString(36).slice(2)}`;
1876
- return pt(Wt, t) ? t : "";
1910
+ return pt(Gt, t) ? t : "";
1877
1911
  }
1878
- function Ga() {
1879
- return Ye === null && (Ye = to($a, Ba(), Fa())), Ye;
1912
+ function qa() {
1913
+ return Ye === null && (Ye = to(Wa, Ga(), Ba())), Ye;
1880
1914
  }
1881
- function Wa() {
1882
- return Ga();
1915
+ function Va() {
1916
+ return qa();
1883
1917
  }
1884
1918
  let Oe;
1885
1919
  function Kn() {
1886
- return G(Cr) || void 0;
1920
+ return W(Cr) || void 0;
1887
1921
  }
1888
- function qa() {
1922
+ function Ka() {
1889
1923
  if (Oe) return;
1890
1924
  const e = Kn();
1891
1925
  if (e) {
@@ -1898,10 +1932,10 @@ function qa() {
1898
1932
  u("identity", "device id unavailable — joining without one");
1899
1933
  });
1900
1934
  }
1901
- function Va() {
1935
+ function Ya() {
1902
1936
  return Oe ??= Kn();
1903
1937
  }
1904
- function Ka(e, t) {
1938
+ function Xa(e, t) {
1905
1939
  let n = 0;
1906
1940
  for (const r of e.videos) {
1907
1941
  const a = de.voteKey(t, e.id, r.mediaId);
@@ -1909,49 +1943,49 @@ function Ka(e, t) {
1909
1943
  }
1910
1944
  return n;
1911
1945
  }
1912
- const Ya = 2e4, za = 1e4;
1913
- function Xa() {
1946
+ const za = 2e4, Ja = 1e4;
1947
+ function Qa() {
1914
1948
  return { unansweredSince: null, lastPongAt: null, lastTickAt: null };
1915
1949
  }
1916
- function Ja(e, t) {
1950
+ function Za(e, t) {
1917
1951
  e.lastPongAt = t, e.unansweredSince = null;
1918
1952
  }
1919
- function Qa(e, t, n) {
1920
- const r = e.lastTickAt !== null && t - e.lastTickAt > za;
1921
- return e.lastTickAt = t, n ? r || e.unansweredSince === null ? (e.unansweredSince = t, !1) : t - e.unansweredSince > Ya : (e.unansweredSince = null, !1);
1953
+ function ei(e, t, n) {
1954
+ const r = e.lastTickAt !== null && t - e.lastTickAt > Ja;
1955
+ return e.lastTickAt = t, n ? r || e.unansweredSince === null ? (e.unansweredSince = t, !1) : t - e.unansweredSince > za : (e.unansweredSince = null, !1);
1922
1956
  }
1923
- function Za(e, t) {
1957
+ function ti(e, t) {
1924
1958
  return e.lastPongAt === null ? void 0 : Math.max(0, t - e.lastPongAt);
1925
1959
  }
1926
- let S = null, $ = null, Me = null, B = null, z = null;
1927
- const ei = ri(), se = Xa();
1928
- let Te = null, ze = null, qt = 0, wt = null, ve = !1, St = !1, me = !1, Yn = null;
1929
- function ti(e) {
1960
+ let S = null, $ = null, Me = null, B = null, X = null;
1961
+ const ni = ai(), se = Qa();
1962
+ let Te = null, Xe = null, qt = 0, wt = null, ve = !1, St = !1, me = !1, Yn = null;
1963
+ function ri(e) {
1930
1964
  const t = oe(), n = m.getState();
1931
1965
  if (n.me.clientId && n.roster[n.me.clientId])
1932
1966
  return (e.name || e.sprite) && (u("socket", "Identity update (already joined)", { name: e.name, sprite: e.sprite }), t.emit(v.IDENTITY_UPDATE, { name: e.name, sprite: e.sprite })), t;
1933
- const r = ni(e);
1934
- return z = r, wt = { name: r.name, sprite: r.sprite }, _t() && _a(r), t.connected ? (u("socket", "Emitting join", r), t.emit(v.JOIN, r)) : t.once("connect", () => {
1967
+ const r = oi(e);
1968
+ return X = r, wt = { name: r.name, sprite: r.sprite }, _t() && Sa(r), t.connected ? (u("socket", "Emitting join", r), t.emit(v.JOIN, r)) : t.once("connect", () => {
1935
1969
  u("socket", "Emitting join", r), t.emit(v.JOIN, r);
1936
1970
  }), t;
1937
1971
  }
1938
- function ni(e) {
1972
+ function oi(e) {
1939
1973
  return {
1940
1974
  room_key: e.room_key,
1941
1975
  name: e.name,
1942
1976
  sprite: e.sprite,
1943
1977
  // Entry-path telemetry — see lib/embedContext.ts. Sent on every join AND
1944
1978
  // rejoin (lastJoinPayload carries it), so a reconnect keeps the attribution.
1945
- embed: Ua(),
1946
- delivery_arm: Wa(),
1979
+ embed: Fa(),
1980
+ delivery_arm: Va(),
1947
1981
  // Identity tier input — see lib/deviceId.ts. Sent on every join AND rejoin
1948
1982
  // (lastJoinPayload carries it) so a reconnect lands on the same
1949
1983
  // ParticipantId rather than minting a new person.
1950
- device_id: Va(),
1951
- tab_id: ei
1984
+ device_id: Ya(),
1985
+ tab_id: ni
1952
1986
  };
1953
1987
  }
1954
- function ri() {
1988
+ function ai() {
1955
1989
  const e = globalThis.crypto;
1956
1990
  if (e && typeof e.randomUUID == "function") return e.randomUUID();
1957
1991
  const t = new Uint8Array(16);
@@ -1966,7 +2000,7 @@ function oe() {
1966
2000
  const r = window.location;
1967
2001
  (r.hostname === "localhost" || r.hostname === "127.0.0.1") && r.port === String(sn) && (t = `${r.protocol}//${r.hostname}:${lt}`, u("socket", "Using dev fallback origin", { origin: t }));
1968
2002
  }
1969
- const n = xa();
2003
+ const n = Ia();
1970
2004
  if (n)
1971
2005
  S = tt(n.url, { path: n.path, transports: ["websocket", "polling"] }), u("socket", "Socket initialized on the room origin", n);
1972
2006
  else {
@@ -1974,15 +2008,15 @@ function oe() {
1974
2008
  S = tt(r, { path: Pr, transports: ["websocket", "polling"] }), u("socket", "Socket initialized", { origin: t });
1975
2009
  }
1976
2010
  Ve("__SOCKET__", S), B && (clearTimeout(B), B = null), $ = null, Me = setInterval(() => {
1977
- if (Qa(se, Date.now(), !!S?.connected)) {
2011
+ if (ei(se, Date.now(), !!S?.connected)) {
1978
2012
  I("socket", "PONG-WATCHDOG no time_pong for 20s — replacing the connection", {
1979
2013
  sid: S?.id,
1980
- lastPongAgeMs: Za(se, Date.now()) ?? null
1981
- }), ze = "pong-watchdog", se.unansweredSince = null, S?.io.engine?.close();
2014
+ lastPongAgeMs: ti(se, Date.now()) ?? null
2015
+ }), Xe = "pong-watchdog", se.unansweredSince = null, S?.io.engine?.close();
1982
2016
  return;
1983
2017
  }
1984
- pi();
1985
- }, Xr), S.on("connect", () => {
2018
+ gi();
2019
+ }, zr), S.on("connect", () => {
1986
2020
  St = !1;
1987
2021
  const r = S?.id;
1988
2022
  if (u("socket", "Connected", { id: r, isReconnect: me }), r)
@@ -1991,11 +2025,11 @@ function oe() {
1991
2025
  } catch (a) {
1992
2026
  Re("socket", "Failed to initialize store on connect", { error: a.message, sid: r });
1993
2027
  }
1994
- if (me && z) {
2028
+ if (me && X) {
1995
2029
  const a = m.getState();
1996
2030
  qt += 1;
1997
2031
  const i = {
1998
- ...z,
2032
+ ...X,
1999
2033
  name: a.name,
2000
2034
  sprite: a.sprite,
2001
2035
  reconnect: {
@@ -2017,21 +2051,21 @@ function oe() {
2017
2051
  } else me && I("socket", "Reconnected — no join payload, not re-joining any room");
2018
2052
  me = !0;
2019
2053
  }), S.on("disconnect", (r) => {
2020
- Dn(null), Te = { reason: ze ?? r, at: Date.now() }, ze = null, u("socket", "Disconnected", { reason: r });
2021
- }), S.on("connect_error", (r) => Re("socket", "Connection error", { message: r?.message })), S.on("reconnect_attempt", (r) => I("socket", "Reconnect attempt", { attempt: r })), S.on("reconnect_failed", () => Re("socket", "Reconnect failed")), mi(S);
2054
+ Dn(null), Te = { reason: Xe ?? r, at: Date.now() }, Xe = null, u("socket", "Disconnected", { reason: r });
2055
+ }), S.on("connect_error", (r) => Re("socket", "Connection error", { message: r?.message })), S.on("reconnect_attempt", (r) => I("socket", "Reconnect attempt", { attempt: r })), S.on("reconnect_failed", () => Re("socket", "Reconnect failed")), pi(S);
2022
2056
  }
2023
2057
  return S;
2024
2058
  }
2025
- function Xe(e) {
2059
+ function ze(e) {
2026
2060
  return e.play_state === "playing" || e.playing === !0;
2027
2061
  }
2028
- function oi(e) {
2062
+ function ii(e) {
2029
2063
  e.on(v.SNAPSHOT, (t) => {
2030
2064
  e.emit(hn.SYNC), m.getState().applySnapshot({
2031
2065
  roomId: t.room_id ?? null,
2032
2066
  mediaId: t.media_id ?? null,
2033
2067
  playheadMs: t.playhead_ms || 0,
2034
- playing: Xe(t),
2068
+ playing: ze(t),
2035
2069
  serverSeq: t.server_seq || 0,
2036
2070
  leaderId: t.leader_id || null
2037
2071
  }), m.getState().name || u("socket", "Deferring identity to presence event (snapshot carries no roster)");
@@ -2052,11 +2086,11 @@ function oi(e) {
2052
2086
  u("socket", "Received snapshot", {
2053
2087
  mediaId: t.media_id ?? null,
2054
2088
  playheadMs: t.playhead_ms || 0,
2055
- playing: Xe(t),
2089
+ playing: ze(t),
2056
2090
  leaderId: t.leader_id || null,
2057
2091
  serverSeq: t.server_seq || 0,
2058
2092
  rosterSize: Object.keys(n.roster).length
2059
- }), z?.room_key && S?.id && Dn({ room_key: z.room_key, client_id: S.id });
2093
+ }), X?.room_key && S?.id && Dn({ room_key: X.room_key, client_id: S.id });
2060
2094
  }), e.on(v.CONTROL_BROADCAST, (t) => {
2061
2095
  const n = m.getState();
2062
2096
  if (Object.prototype.hasOwnProperty.call(t, "media_id")) {
@@ -2065,7 +2099,7 @@ function oi(e) {
2065
2099
  }
2066
2100
  n.updateControlState({
2067
2101
  playheadMs: t.playhead_ms,
2068
- playing: Xe(t),
2102
+ playing: ze(t),
2069
2103
  serverSeq: t.server_seq,
2070
2104
  leaderId: t.leader_id ?? n.snapshot.leaderId
2071
2105
  }), u("socket", "Control broadcast received", {
@@ -2078,7 +2112,7 @@ function oi(e) {
2078
2112
  }), e.on(v.CONTROL_ACK, (t) => {
2079
2113
  typeof t?.client_seq == "number" && typeof t?.server_seq == "number" && u("socket", "Control ack received", t);
2080
2114
  }), e.on(v.TIME_PONG, (t) => {
2081
- if (Ja(se, Date.now()), $ && $.ts) {
2115
+ if (Za(se, Date.now()), $ && $.ts) {
2082
2116
  const n = Date.now() - $.ts;
2083
2117
  m.getState().addRttSample(n, t?.server_ts, $.ts), $ = null, B && (clearTimeout(B), B = null), u("socket", "Time sync RTT", { rtt: n, offset: m.getState().drift.offsetMs });
2084
2118
  }
@@ -2088,11 +2122,11 @@ function oi(e) {
2088
2122
  m.getState().setReadiness({ mediaId: n, ready: i, readyCount: r, total: a }), u("socket", "Ready state received", { mediaId: n, readyCount: r, total: a, ready: i });
2089
2123
  });
2090
2124
  }
2091
- function ai(e) {
2125
+ function si(e) {
2092
2126
  const t = pr(e);
2093
2127
  return t ? { cosmetics: t } : {};
2094
2128
  }
2095
- function ii(e) {
2129
+ function li(e) {
2096
2130
  e.on(v.PRESENCE, (t) => {
2097
2131
  if (!t) return;
2098
2132
  if (Array.isArray(t.users)) {
@@ -2106,7 +2140,7 @@ function ii(e) {
2106
2140
  isLeader: l.is_leader,
2107
2141
  ...l.registry_name ? { registryName: !0 } : {},
2108
2142
  ...l.avatar_url ? { avatarUrl: l.avatar_url } : {},
2109
- ...ai(l.cosmetics)
2143
+ ...si(l.cosmetics)
2110
2144
  };
2111
2145
  const a = m.getState(), i = S?.id, s = i ? r[i] : void 0;
2112
2146
  if (s?.registryName)
@@ -2128,7 +2162,7 @@ function ii(e) {
2128
2162
  }
2129
2163
  });
2130
2164
  }
2131
- function si(e) {
2165
+ function ci(e) {
2132
2166
  e.on(Se.STATE, (t) => {
2133
2167
  m.getState().applyPlaylistState({
2134
2168
  playlist: t?.playlist ?? null,
@@ -2141,54 +2175,54 @@ function si(e) {
2141
2175
  m.getState().setPlaylistResults(t ?? null), u("playlist", "Results received", { playlistId: t?.playlist?.id, update: t?.update === !0 });
2142
2176
  }), e.on(Se.VOTES_CLEARED, (t) => {
2143
2177
  if (!t?.playlistId || !Array.isArray(t.mediaIds)) return;
2144
- const n = Ka(
2178
+ const n = Xa(
2145
2179
  { id: t.playlistId, videos: t.mediaIds.map((a) => ({ mediaId: a })) },
2146
- aa()
2180
+ sa()
2147
2181
  ), r = m.getState();
2148
2182
  r.playlist?.id === t.playlistId && r.applyPlaylistState({ playlist: r.playlist, activeIndex: r.activePlaylistIndex, myVotes: {} }), u("playlist", "Votes cleared by leader", { playlistId: t.playlistId, removed: n });
2149
2183
  });
2150
2184
  }
2151
- function li(e) {
2152
- e.on(Wr.UPDATED, () => {
2153
- u("tierlist", "Someone saved — refreshing the board"), ka(!1);
2185
+ function di(e) {
2186
+ e.on(Gr.UPDATED, () => {
2187
+ u("tierlist", "Someone saved — refreshing the board"), Aa(!1);
2154
2188
  });
2155
2189
  }
2156
- function ci(e) {
2190
+ function ui(e) {
2157
2191
  e.on(qr.STATE, (t) => {
2158
2192
  if (!t || typeof t.active != "boolean") return;
2159
2193
  const n = Array.isArray(t.ready) ? t.ready.filter((r) => typeof r == "string") : [];
2160
2194
  m.getState().setReadyCheckState({ active: t.active, ready: n }), u("ready-check", "State received", { active: t.active, readyCount: n.length });
2161
2195
  });
2162
2196
  }
2163
- function di(e) {
2197
+ function mi(e) {
2164
2198
  e.on(hn.ACTIVE, (t) => {
2165
2199
  const n = typeof t?.gameId == "string" ? t.gameId : null;
2166
2200
  m.getState().setActiveGameId(n), u("game", "game_active", { gameId: n });
2167
2201
  });
2168
2202
  }
2169
- function ui(e) {
2203
+ function fi(e) {
2170
2204
  e.on(v.HEALTH_SNAPSHOT, (t) => {
2171
2205
  m.getState().setHealthSnapshot(t);
2172
2206
  }), e.on(v.BUFFER_STATUS, (t) => {
2173
2207
  m.getState().setBufferStatus(t);
2174
2208
  });
2175
2209
  }
2176
- function mi(e) {
2177
- oi(e), ii(e), qn(e, () => !_t()), ui(e), si(e), li(e), ci(e), di(e), e.on(v.ERROR, (t) => {
2210
+ function pi(e) {
2211
+ ii(e), li(e), qn(e, () => !_t()), fi(e), ci(e), di(e), ui(e), mi(e), e.on(v.ERROR, (t) => {
2178
2212
  const n = t?.code || "error/unknown";
2179
2213
  if (n === "conflict" && t?.message === "sprite_held_by_you") {
2180
2214
  St = !0, u("socket", "sprite held by this account's other connection: keeping the server-assigned sprite");
2181
2215
  return;
2182
2216
  }
2183
2217
  if (n === "conflict" && t?.message === "sprite_taken") {
2184
- if (Na(S?.id)) {
2218
+ if (Ra(S?.id)) {
2185
2219
  u("socket", "sprite_taken: stale, the server already has our sprite");
2186
2220
  return;
2187
2221
  }
2188
2222
  ve = !0;
2189
2223
  let s;
2190
2224
  try {
2191
- s = Aa();
2225
+ s = Pa();
2192
2226
  } finally {
2193
2227
  ve = !1;
2194
2228
  }
@@ -2219,34 +2253,34 @@ function mi(e) {
2219
2253
  (n.startsWith("auth/") ? I : Re)("socket", `Server error: ${a}`, { code: n, raw: t }), m.getState().pushToast("error", a);
2220
2254
  });
2221
2255
  }
2222
- function fi(e, t) {
2256
+ function hi(e, t) {
2223
2257
  const n = t?.length ? { text: e, images: t } : { text: e };
2224
- _t() ? wa(n) : oe().emit(v.CHAT_SEND, n);
2258
+ _t() ? xa(n) : oe().emit(v.CHAT_SEND, n);
2225
2259
  }
2226
- function pi() {
2260
+ function gi() {
2227
2261
  $ || ($ = { ts: Date.now() }, oe().emit(v.TIME_PING, {}), B = setTimeout(() => {
2228
2262
  $ && (u("socket", "Time ping timed out after 10s, clearing inflight"), $ = null), B = null;
2229
2263
  }, 1e4));
2230
2264
  }
2231
- function zn(e) {
2265
+ function Xn(e) {
2232
2266
  const t = m.getState(), n = t.me.clientId;
2233
2267
  if (!n || !t.roster[n]) {
2234
- Gt(e), u("socket", "Avatar change before join: the join will carry it", { sprite: e });
2268
+ Wt(e), u("socket", "Avatar change before join: the join will carry it", { sprite: e });
2235
2269
  return;
2236
2270
  }
2237
2271
  ve = !0;
2238
2272
  try {
2239
- Gt(e);
2273
+ Wt(e);
2240
2274
  } finally {
2241
2275
  ve = !1;
2242
2276
  }
2243
2277
  const r = m.getState(), a = { avatar: !0 };
2244
2278
  r.sprite && r.sprite !== t.sprite && (a.sprite = r.sprite), r.name && r.name !== t.name && (a.name = r.name), u("socket", "Sending avatar change", a), oe().emit(v.IDENTITY_UPDATE, a);
2245
2279
  }
2246
- function hi(e) {
2247
- m.getState().me.clientId && gi(e);
2280
+ function yi(e) {
2281
+ m.getState().me.clientId && bi(e);
2248
2282
  }
2249
- function gi(e, t) {
2283
+ function bi(e, t) {
2250
2284
  const n = {};
2251
2285
  e && (n.name = e), !(!n.name && !n.sprite) && (u("socket", "Sending identity update", n), oe().emit(v.IDENTITY_UPDATE, n));
2252
2286
  }
@@ -2262,14 +2296,14 @@ m.subscribe((e, t) => {
2262
2296
  const s = {};
2263
2297
  a && (s.name = e.name, ke.name = e.name), i && (s.sprite = e.sprite, ke.sprite = e.sprite), u("socket", "Identity reassert (store change)", s), S?.connected ? S.emit(v.IDENTITY_UPDATE, s) : oe().emit(v.IDENTITY_UPDATE, s);
2264
2298
  });
2265
- function yi() {
2299
+ function vi() {
2266
2300
  Me && (clearInterval(Me), Me = null), B && (clearTimeout(B), B = null), $ = null, se.unansweredSince = null, se.lastTickAt = null;
2267
2301
  }
2268
- function bi() {
2269
- u("socket", "clearJoinState called", { hadPayload: z !== null, room_key: z?.room_key }), z = null, me = !1, Yn = null;
2302
+ function _i() {
2303
+ u("socket", "clearJoinState called", { hadPayload: X !== null, room_key: X?.room_key }), X = null, me = !1, Yn = null;
2270
2304
  }
2271
2305
  function Vt() {
2272
- u("socket", "leaveRoom called", { room_key: z?.room_key }), bi(), yi(), Wn(), S && (S.disconnect(), S = null), m.setState({
2306
+ u("socket", "leaveRoom called", { room_key: X?.room_key }), _i(), vi(), Gn(), S && (S.disconnect(), S = null), m.setState({
2273
2307
  me: { clientId: null, nextClientSeq: 1 },
2274
2308
  roster: {},
2275
2309
  snapshot: { roomId: null, mediaId: null, playheadMs: 0, playing: !1, serverSeq: 0, leaderId: null },
@@ -2284,31 +2318,31 @@ function Vt() {
2284
2318
  activeGameId: null
2285
2319
  });
2286
2320
  }
2287
- function vi() {
2321
+ function wi() {
2288
2322
  u("chat", "Emitting recap_request"), oe().emit("recap_request");
2289
2323
  }
2290
- function _i() {
2324
+ function Si() {
2291
2325
  E(() => {
2292
2326
  const e = Er(), t = kr((r, a) => {
2293
- const i = Ra(a);
2294
- u("avatar", "Avatar changed in the settings popout", { sprite: i, source: a.avatar?.source }), zn(i);
2295
- }), n = La((r) => {
2296
- u("avatar", "Renamed in the settings popout", { name: r }), hi(r);
2327
+ const i = Oa(a);
2328
+ u("avatar", "Avatar changed in the settings popout", { sprite: i, source: a.avatar?.source }), Xn(i);
2329
+ }), n = Ua((r) => {
2330
+ u("avatar", "Renamed in the settings popout", { name: r }), yi(r);
2297
2331
  });
2298
2332
  return () => {
2299
2333
  t(), n(), e();
2300
2334
  };
2301
2335
  }, []);
2302
2336
  }
2303
- function wi(e, t) {
2337
+ function xi(e, t) {
2304
2338
  return (t ? yr(t) : null) ?? Mn(e);
2305
2339
  }
2306
2340
  function xt(e, t) {
2307
2341
  return E(() => {
2308
2342
  t && hr(t);
2309
- }, [t]), nr(gr, () => wi(e, t), () => Mn(e));
2343
+ }, [t]), nr(gr, () => xi(e, t), () => Mn(e));
2310
2344
  }
2311
- function Si(e, t) {
2345
+ function Ci(e, t) {
2312
2346
  if (t.clientId) {
2313
2347
  const n = e[t.clientId];
2314
2348
  if (n && (!t.author || !n.author || n.author === t.author)) return n;
@@ -2317,8 +2351,8 @@ function Si(e, t) {
2317
2351
  for (const n of Object.values(e)) if (n.author === t.author) return n;
2318
2352
  }
2319
2353
  }
2320
- function xi(e, t, n) {
2321
- const r = Si(e, t);
2354
+ function Ii(e, t, n) {
2355
+ const r = Ci(e, t);
2322
2356
  return r ? {
2323
2357
  name: r.name || n.name,
2324
2358
  // A connection briefly without a character (a reconnect waiting for one to
@@ -2329,11 +2363,11 @@ function xi(e, t, n) {
2329
2363
  here: !0
2330
2364
  } : { name: n.name, sprite: n.sprite, pictureUrl: n.pictureUrl, here: !1 };
2331
2365
  }
2332
- function Ci(e, t, n) {
2366
+ function Ti(e, t, n) {
2333
2367
  return !t || !n.here ? e : t.split(un).join(n.name);
2334
2368
  }
2335
- function Xn(e, t) {
2336
- const n = m((r) => JSON.stringify(xi(r.roster, e, t)));
2369
+ function zn(e, t) {
2370
+ const n = m((r) => JSON.stringify(Ii(r.roster, e, t)));
2337
2371
  return ee(() => JSON.parse(n), [n]);
2338
2372
  }
2339
2373
  function Jn({ sprite: e, url: t, alt: n = "", className: r, style: a, fallback: i }) {
@@ -2351,7 +2385,7 @@ function Jn({ sprite: e, url: t, alt: n = "", className: r, style: a, fallback:
2351
2385
  onError: () => l(t)
2352
2386
  }
2353
2387
  );
2354
- const d = ia(e);
2388
+ const d = la(e);
2355
2389
  return d ? /* @__PURE__ */ c("img", { src: d, alt: n, crossOrigin: "anonymous", className: r, style: a, draggable: !1 }) : /* @__PURE__ */ c(le, { children: i });
2356
2390
  }
2357
2391
  function Qn({ sprite: e, url: t, alt: n, worn: r }) {
@@ -2369,17 +2403,17 @@ function Qn({ sprite: e, url: t, alt: n, worn: r }) {
2369
2403
  r?.overlay && /* @__PURE__ */ c(ge, { html: br(r), style: { display: "contents" } })
2370
2404
  ] });
2371
2405
  }
2372
- function Ii(e) {
2406
+ function ki(e) {
2373
2407
  return !(e.button !== 0 || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey);
2374
2408
  }
2375
- function Ti({ src: e, title: t, onClose: n }) {
2409
+ function Ei({ src: e, title: t, onClose: n }) {
2376
2410
  E(() => {
2377
2411
  const i = (s) => {
2378
2412
  mt(s) && (s.stopPropagation(), n());
2379
2413
  };
2380
2414
  return document.addEventListener("keydown", i, !0), () => document.removeEventListener("keydown", i, !0);
2381
2415
  }, [n]);
2382
- const r = Do(), a = typeof document > "u" ? null : document.fullscreenElement ?? r ?? document.body;
2416
+ const r = Mo(), a = typeof document > "u" ? null : document.fullscreenElement ?? r ?? document.body;
2383
2417
  return a ? Ar(
2384
2418
  /* @__PURE__ */ _(
2385
2419
  "div",
@@ -2418,11 +2452,11 @@ function Ti({ src: e, title: t, onClose: n }) {
2418
2452
  a
2419
2453
  ) : null;
2420
2454
  }
2421
- const Je = 240, ki = 320;
2422
- function Ei({ image: e }) {
2455
+ const Je = 240, Ai = 320;
2456
+ function Ni({ image: e }) {
2423
2457
  const [t, n] = k(!1), r = je(e.key);
2424
2458
  if (!r) return null;
2425
- const a = e.w > 0 && e.h > 0, i = a ? Math.min(1, ki / e.w, Je / e.h) : 1;
2459
+ const a = e.w > 0 && e.h > 0, i = a ? Math.min(1, Ai / e.w, Je / e.h) : 1;
2426
2460
  return /* @__PURE__ */ _(le, { children: [
2427
2461
  /* @__PURE__ */ c(
2428
2462
  "a",
@@ -2433,7 +2467,7 @@ function Ei({ image: e }) {
2433
2467
  className: "block max-w-full cursor-zoom-in",
2434
2468
  "data-testid": "chat-image",
2435
2469
  onClick: (s) => {
2436
- Ii(s) && (s.preventDefault(), n(!0));
2470
+ ki(s) && (s.preventDefault(), n(!0));
2437
2471
  },
2438
2472
  children: /* @__PURE__ */ c(
2439
2473
  "img",
@@ -2451,7 +2485,7 @@ function Ei({ image: e }) {
2451
2485
  }
2452
2486
  ),
2453
2487
  t && /* @__PURE__ */ c(
2454
- Ti,
2488
+ Ei,
2455
2489
  {
2456
2490
  src: r,
2457
2491
  title: e.title,
@@ -2461,20 +2495,20 @@ function Ei({ image: e }) {
2461
2495
  ] });
2462
2496
  }
2463
2497
  function Zn({ images: e }) {
2464
- return e?.length ? /* @__PURE__ */ c("div", { className: "flex flex-wrap gap-1 mt-1", "data-testid": "chat-images", children: e.map((t, n) => /* @__PURE__ */ c(Ei, { image: t }, `${t.key}-${n}`)) }) : null;
2498
+ return e?.length ? /* @__PURE__ */ c("div", { className: "flex flex-wrap gap-1 mt-1", "data-testid": "chat-images", children: e.map((t, n) => /* @__PURE__ */ c(Ni, { image: t }, `${t.key}-${n}`)) }) : null;
2465
2499
  }
2466
- function Ai(e, t) {
2500
+ function Pi(e, t) {
2467
2501
  return e.author && t.author ? e.author === t.author : !!t.clientId && e.clientId === t.clientId;
2468
2502
  }
2469
2503
  function Qe(e) {
2470
2504
  return new Date(e).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
2471
2505
  }
2472
- const Ni = Le.memo(function({ message: t }) {
2473
- const n = m((f) => f.me.clientId), r = m((f) => f.me.clientId ? f.roster[f.me.clientId]?.author : void 0), a = Ai(t, { clientId: n, author: r }), i = Xn(
2506
+ const Ri = Le.memo(function({ message: t }) {
2507
+ const n = m((f) => f.me.clientId), r = m((f) => f.me.clientId ? f.roster[f.me.clientId]?.author : void 0), a = Pi(t, { clientId: n, author: r }), i = zn(
2474
2508
  { clientId: t.clientId, author: t.author },
2475
2509
  { name: t.name, sprite: t.sprite }
2476
- ), s = xt(i.sprite, i.pictureUrl), l = t.isSystem ? void 0 : i.cosmetics, d = W(null);
2477
- Oo(d, !!l);
2510
+ ), s = xt(i.sprite, i.pictureUrl), l = t.isSystem ? void 0 : i.cosmetics, d = G(null);
2511
+ Lo(d, !!l);
2478
2512
  const [h] = k(
2479
2513
  () => t.live && t.text ? tn(t.text, l) : null
2480
2514
  );
@@ -2485,7 +2519,7 @@ const Ni = Le.memo(function({ message: t }) {
2485
2519
  ] }),
2486
2520
  /* @__PURE__ */ c("p", { className: "text-[13px] text-text-secondary leading-relaxed whitespace-pre-wrap break-words", children: t.text })
2487
2521
  ] }) }) : t.isSystem ? /* @__PURE__ */ _("div", { className: "px-2 py-0.5 text-[11px] text-text-muted italic text-center leading-tight", children: [
2488
- Ci(t.text, t.template, i),
2522
+ Ti(t.text, t.template, i),
2489
2523
  /* @__PURE__ */ c("span", { className: "ml-1 text-[10px] opacity-50", children: Qe(t.ts) })
2490
2524
  ] }) : /* @__PURE__ */ _("div", { ref: d, style: An(s), className: `flex items-start gap-2 px-2 py-1 hover:bg-bg-card/20 ${a ? "bg-bg-card/30" : ""}`, children: [
2491
2525
  /* @__PURE__ */ c(Qn, { sprite: i.sprite, url: i.pictureUrl, alt: i.name, worn: l }),
@@ -2497,9 +2531,9 @@ const Ni = Le.memo(function({ message: t }) {
2497
2531
  ] })
2498
2532
  ] });
2499
2533
  });
2500
- function Pi() {
2534
+ function Di() {
2501
2535
  En();
2502
- const e = m((a) => a.chat), t = W(null), n = W(!1), r = A(() => {
2536
+ const e = m((a) => a.chat), t = G(null), n = G(!1), r = A(() => {
2503
2537
  const a = t.current;
2504
2538
  if (!a) return;
2505
2539
  const { scrollHeight: i, scrollTop: s, clientHeight: l } = a, d = i - s - l;
@@ -2522,7 +2556,7 @@ function Pi() {
2522
2556
  /* @__PURE__ */ c("span", { className: "text-[10px] text-text-muted whitespace-nowrap", children: new Date(a.ts).toLocaleDateString([], { weekday: "short", month: "short", day: "numeric" }) }),
2523
2557
  /* @__PURE__ */ c("div", { className: "flex-1 h-px bg-border" })
2524
2558
  ] }),
2525
- /* @__PURE__ */ c(Ni, { message: a })
2559
+ /* @__PURE__ */ c(Ri, { message: a })
2526
2560
  ] }, a.id);
2527
2561
  }) })
2528
2562
  }
@@ -2549,12 +2583,12 @@ const Ct = [
2549
2583
  scope: "local"
2550
2584
  }
2551
2585
  ], ce = "/";
2552
- function Ri(e) {
2586
+ function Oi(e) {
2553
2587
  if (!e.startsWith(ce)) return null;
2554
2588
  const t = e.slice(ce.length);
2555
2589
  return /\s/.test(t) ? null : t.toLowerCase();
2556
2590
  }
2557
- function Di(e, t = Ct) {
2591
+ function Mi(e, t = Ct) {
2558
2592
  const n = e.toLowerCase();
2559
2593
  if (!n) return [...t].sort((a, i) => a.name.localeCompare(i.name));
2560
2594
  const r = [];
@@ -2564,23 +2598,23 @@ function Di(e, t = Ct) {
2564
2598
  }
2565
2599
  return r.sort((a, i) => a.rank - i.rank || a.cmd.name.localeCompare(i.cmd.name)).map((a) => a.cmd);
2566
2600
  }
2567
- function Oi(e) {
2601
+ function Li(e) {
2568
2602
  return `${ce}${e.name} `;
2569
2603
  }
2570
2604
  function Ze(e, t) {
2571
2605
  return t <= 0 ? 0 : (e % t + t) % t;
2572
2606
  }
2573
- function Mi(e, t = Ct) {
2607
+ function ji(e, t = Ct) {
2574
2608
  const n = e.trim();
2575
2609
  if (!n) return null;
2576
2610
  if (!n.startsWith(ce)) return { kind: "chat", text: n };
2577
2611
  const r = n.slice(ce.length), a = r.search(/\s/), i = (a === -1 ? r : r.slice(0, a)).toLowerCase(), s = a === -1 ? "" : r.slice(a).trim(), l = t.find((d) => d.name.toLowerCase() === i);
2578
2612
  return l ? { kind: "command", command: l, args: s } : { kind: "chat", text: n };
2579
2613
  }
2580
- function Li(e, t) {
2614
+ function Ui(e, t) {
2581
2615
  return e.requiresMedia && !t.hasMedia ? `${ce}${e.name} needs an episode loaded.` : null;
2582
2616
  }
2583
- function ji({
2617
+ function Hi({
2584
2618
  commands: e,
2585
2619
  activeIndex: t,
2586
2620
  hasMedia: n,
@@ -2622,7 +2656,7 @@ function ji({
2622
2656
  }
2623
2657
  );
2624
2658
  }
2625
- function Ui({
2659
+ function Fi({
2626
2660
  pending: e,
2627
2661
  uploading: t,
2628
2662
  onRemove: n
@@ -2649,24 +2683,24 @@ function Ui({
2649
2683
  )
2650
2684
  ] }, r.id)) }) : null;
2651
2685
  }
2652
- function Hi() {
2653
- const [e, t] = k([]), [n, r] = k(!1), a = m((p) => p.pushToast), i = W(/* @__PURE__ */ new Set());
2686
+ function $i() {
2687
+ const [e, t] = k([]), [n, r] = k(!1), a = m((p) => p.pushToast), i = G(/* @__PURE__ */ new Set());
2654
2688
  E(() => () => {
2655
2689
  for (const p of i.current) URL.revokeObjectURL(p);
2656
2690
  i.current.clear();
2657
2691
  }, []);
2658
2692
  const s = A((p) => {
2659
- po(p) && (URL.revokeObjectURL(p.previewUrl), i.current.delete(p.previewUrl));
2693
+ go(p) && (URL.revokeObjectURL(p.previewUrl), i.current.delete(p.previewUrl));
2660
2694
  }, []), l = A(async (p) => {
2661
2695
  if (!p.length) return;
2662
2696
  const x = [];
2663
2697
  for (const w of p) {
2664
- const y = go(w);
2698
+ const y = bo(w);
2665
2699
  if (y) {
2666
2700
  a("error", y);
2667
2701
  continue;
2668
2702
  }
2669
- const { w: g, h: T } = await vo(w), N = URL.createObjectURL(w);
2703
+ const { w: g, h: T } = await wo(w), N = URL.createObjectURL(w);
2670
2704
  i.current.add(N), x.push({
2671
2705
  kind: "file",
2672
2706
  id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
@@ -2701,7 +2735,7 @@ function Hi() {
2701
2735
  w: p.width ?? 0,
2702
2736
  h: p.height ?? 0,
2703
2737
  title: p.title || void 0
2704
- }]), We().catalogue(Cn).recordUse(p.key));
2738
+ }]), Ge().catalogue(Cn).recordUse(p.key));
2705
2739
  }, [a]), h = A((p) => {
2706
2740
  t((x) => {
2707
2741
  const w = x.find((y) => y.id === p);
@@ -2713,10 +2747,10 @@ function Hi() {
2713
2747
  return [];
2714
2748
  });
2715
2749
  }, [s]), M = A((p) => {
2716
- const x = yo(p.clipboardData);
2750
+ const x = vo(p.clipboardData);
2717
2751
  x.length && (p.preventDefault(), l(x));
2718
2752
  }, [l]), R = A((p) => {
2719
- const x = bo(p.dataTransfer);
2753
+ const x = _o(p.dataTransfer);
2720
2754
  x.length && (p.preventDefault(), l(x));
2721
2755
  }, [l]), D = A((p) => {
2722
2756
  p.dataTransfer?.types?.includes("Files") && p.preventDefault();
@@ -2724,9 +2758,9 @@ function Hi() {
2724
2758
  if (!e.length) return [];
2725
2759
  r(!0);
2726
2760
  try {
2727
- return await wo(e);
2761
+ return await xo(e);
2728
2762
  } catch (p) {
2729
- return I("chat", "Image upload failed", So(p)), a("error", ho(p)), null;
2763
+ return I("chat", "Image upload failed", Co(p)), a("error", yo(p)), null;
2730
2764
  } finally {
2731
2765
  r(!1);
2732
2766
  }
@@ -2744,16 +2778,16 @@ function Hi() {
2744
2778
  onDragOver: D
2745
2779
  };
2746
2780
  }
2747
- const Kt = ln, Fi = Rr;
2748
- function $i({ commands: e = Ct }) {
2749
- const [t, n] = k(""), [r, a] = k(!1), [i, s] = k({ q: null, i: 0 }), [l, d] = k(!1), h = W(null), f = rr(), [M, R] = k(!1), [D, H] = k(!1), p = Hi(), x = m((b) => b.snapshot.mediaId), w = m((b) => b.pushToast), y = m((b) => b.setTierlistOpen), g = !!x, T = Ri(t), N = ee(
2750
- () => T === null ? [] : Di(T, e),
2781
+ const Kt = ln, Bi = Rr;
2782
+ function Wi({ commands: e = Ct }) {
2783
+ const [t, n] = k(""), [r, a] = k(!1), [i, s] = k({ q: null, i: 0 }), [l, d] = k(!1), h = G(null), f = rr(), [M, R] = k(!1), [D, H] = k(!1), p = $i(), x = m((b) => b.snapshot.mediaId), w = m((b) => b.pushToast), y = m((b) => b.setTierlistOpen), g = !!x, T = Oi(t), N = ee(
2784
+ () => T === null ? [] : Mi(T, e),
2751
2785
  [T, e]
2752
2786
  ), j = T !== null && !l && N.length > 0, U = i.q === T ? Ze(i.i, N.length) : 0, C = A(
2753
2787
  (b) => s({ q: T, i: b }),
2754
2788
  [T]
2755
2789
  ), O = A((b, L) => {
2756
- const ue = Li(b, { hasMedia: g });
2790
+ const ue = Ui(b, { hasMedia: g });
2757
2791
  if (ue) {
2758
2792
  w("info", ue);
2759
2793
  return;
@@ -2763,19 +2797,19 @@ function $i({ commands: e = Ct }) {
2763
2797
  w("info", e.map((tr) => tr.usage).join(" "));
2764
2798
  break;
2765
2799
  case "recap":
2766
- vi();
2800
+ wi();
2767
2801
  break;
2768
2802
  case "tierlist":
2769
- Ea(), y(!0);
2803
+ Na(), y(!0);
2770
2804
  break;
2771
2805
  default:
2772
2806
  w("info", `${b.usage} is not implemented yet.`);
2773
2807
  }
2774
2808
  }, [g, w, e, y]), P = A((b) => {
2775
- n(Oi(b)), d(!1), h.current?.focus();
2809
+ n(Li(b)), d(!1), h.current?.focus();
2776
2810
  }, []), F = A(async (b) => {
2777
2811
  if (b.preventDefault(), r || p.uploading) return;
2778
- const L = Mi(t, e);
2812
+ const L = ji(t, e);
2779
2813
  if (!L && !p.pending.length) return;
2780
2814
  if (L?.kind === "command" && p.pending.length) {
2781
2815
  w("info", "Send images on their own, not with a command.");
@@ -2786,7 +2820,7 @@ function $i({ commands: e = Ct }) {
2786
2820
  return;
2787
2821
  }
2788
2822
  const ue = await p.uploadPending();
2789
- ue !== null && (fi(L?.text ?? "", ue), n(""), p.clear(), a(!0), setTimeout(() => a(!1), Fi), !document.hidden && document.hasFocus() && h.current?.focus());
2823
+ ue !== null && (hi(L?.text ?? "", ue), n(""), p.clear(), a(!0), setTimeout(() => a(!1), Bi), !document.hidden && document.hasFocus() && h.current?.focus());
2790
2824
  }, [t, r, O, p, w, e]), ae = A((b) => {
2791
2825
  if (b.key === "Escape" && j) {
2792
2826
  b.preventDefault(), d(!0);
@@ -2814,7 +2848,7 @@ function $i({ commands: e = Ct }) {
2814
2848
  };
2815
2849
  return window.addEventListener("watchparty:focus-chat-input", b), () => window.removeEventListener("watchparty:focus-chat-input", b);
2816
2850
  }, []);
2817
- const ie = Kt - t.length, te = ie <= 100, X = j ? N[U] : void 0;
2851
+ const ie = Kt - t.length, te = ie <= 100, z = j ? N[U] : void 0;
2818
2852
  return /* @__PURE__ */ _(
2819
2853
  "form",
2820
2854
  {
@@ -2826,10 +2860,10 @@ function $i({ commands: e = Ct }) {
2826
2860
  onDragOver: p.onDragOver,
2827
2861
  className: "p-2 border-t border-border",
2828
2862
  children: [
2829
- /* @__PURE__ */ c(Ui, { pending: p.pending, uploading: p.uploading, onRemove: p.remove }),
2863
+ /* @__PURE__ */ c(Fi, { pending: p.pending, uploading: p.uploading, onRemove: p.remove }),
2830
2864
  /* @__PURE__ */ _("div", { className: "relative", children: [
2831
2865
  j && /* @__PURE__ */ c(
2832
- ji,
2866
+ Hi,
2833
2867
  {
2834
2868
  commands: N,
2835
2869
  activeIndex: U,
@@ -2840,7 +2874,7 @@ function $i({ commands: e = Ct }) {
2840
2874
  }
2841
2875
  ),
2842
2876
  /* @__PURE__ */ c(
2843
- Ao,
2877
+ Po,
2844
2878
  {
2845
2879
  open: M,
2846
2880
  onClose: () => R(!1),
@@ -2867,7 +2901,7 @@ function $i({ commands: e = Ct }) {
2867
2901
  role: "combobox",
2868
2902
  "aria-expanded": j,
2869
2903
  "aria-controls": j ? f : void 0,
2870
- "aria-activedescendant": X ? `${f}-opt-${X.name}` : void 0,
2904
+ "aria-activedescendant": z ? `${f}-opt-${z.name}` : void 0,
2871
2905
  "aria-autocomplete": "list",
2872
2906
  className: `w-full bg-bg-card border border-border-light rounded px-3 py-1.5 text-sm focus:outline-none focus:border-text-muted ${te ? "pr-12" : ""}`
2873
2907
  }
@@ -2893,11 +2927,11 @@ function $i({ commands: e = Ct }) {
2893
2927
  }
2894
2928
  );
2895
2929
  }
2896
- function Bi() {
2930
+ function Gi() {
2897
2931
  const e = m((n) => n.roster), t = Object.values(e);
2898
- return t.length ? /* @__PURE__ */ c("div", { className: "flex flex-col gap-1", children: t.map((n) => /* @__PURE__ */ c(Gi, { u: n }, n.clientId)) }) : /* @__PURE__ */ c("div", { className: "text-xs text-text-muted", children: "No users online" });
2932
+ return t.length ? /* @__PURE__ */ c("div", { className: "flex flex-col gap-1", children: t.map((n) => /* @__PURE__ */ c(qi, { u: n }, n.clientId)) }) : /* @__PURE__ */ c("div", { className: "text-xs text-text-muted", children: "No users online" });
2899
2933
  }
2900
- function Gi({ u: e }) {
2934
+ function qi({ u: e }) {
2901
2935
  const t = xt(e.sprite, e.avatarUrl);
2902
2936
  return /* @__PURE__ */ _("div", { className: "flex items-center gap-2 py-0.5", children: [
2903
2937
  /* @__PURE__ */ c(
@@ -2914,8 +2948,8 @@ function Gi({ u: e }) {
2914
2948
  e.isLeader && /* @__PURE__ */ c("span", { className: "ml-auto px-1.5 py-0.5 rounded text-[9px] font-medium bg-success/20 text-success", children: "Leader" })
2915
2949
  ] });
2916
2950
  }
2917
- function Wi() {
2918
- const e = m((i) => Object.keys(i.roster).length), [t, n] = k(!1), r = W(null), a = W(null);
2951
+ function Vi() {
2952
+ const e = m((i) => Object.keys(i.roster).length), [t, n] = k(!1), r = G(null), a = G(null);
2919
2953
  return E(() => {
2920
2954
  if (!t) return;
2921
2955
  function i(l) {
@@ -2950,7 +2984,7 @@ function Wi() {
2950
2984
  e,
2951
2985
  " online"
2952
2986
  ] }),
2953
- /* @__PURE__ */ c(Bi, {})
2987
+ /* @__PURE__ */ c(Gi, {})
2954
2988
  ] })
2955
2989
  ] });
2956
2990
  }
@@ -2963,20 +2997,20 @@ function Yt({ className: e = "fixed bottom-4 left-1/2 -translate-x-1/2" }) {
2963
2997
  };
2964
2998
  }, [t, n]), /* @__PURE__ */ c("div", { className: `${e} flex flex-col gap-2 z-50`, children: t.map((r) => /* @__PURE__ */ c("div", { className: `px-3 py-2 rounded text-sm shadow font-medium border ${r.kind === "error" ? "bg-danger-bg text-on-danger-bg border-danger" : "bg-bg-card border-border-light text-text"}`, children: r.msg }, r.id)) });
2965
2999
  }
2966
- const er = 9e3, zt = 1500, qi = {
3000
+ const er = 9e3, Xt = 1500, Ki = {
2967
3001
  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]",
2968
3002
  cinema: "drop-shadow-[0_2px_4px_rgba(0,0,0,0.9)]",
2969
3003
  minimal: "drop-shadow-[0_2px_4px_rgba(0,0,0,0.9)] drop-shadow-[0_0_8px_rgba(0,0,0,0.7)]",
2970
3004
  contrast: "bg-black/70 px-2 py-0.5 rounded"
2971
- }, Xt = { WebkitTextStroke: "0.5px black", paintOrder: "stroke fill" }, Jt = {
3005
+ }, zt = { WebkitTextStroke: "0.5px black", paintOrder: "stroke fill" }, Jt = {
2972
3006
  textShadow: "none",
2973
3007
  filter: "drop-shadow(0 0 1px black) drop-shadow(0 0 1px black)"
2974
3008
  };
2975
- function Vi({ message: e, age: t, ccStyle: n }) {
2976
- const r = er - zt;
3009
+ function Yi({ message: e, age: t, ccStyle: n }) {
3010
+ const r = er - Xt;
2977
3011
  let a = 1;
2978
- t > r && (a = Math.max(0, 1 - (t - r) / zt));
2979
- const i = qi[n], s = Xn(
3012
+ t > r && (a = Math.max(0, 1 - (t - r) / Xt));
3013
+ const i = Ki[n], s = zn(
2980
3014
  { clientId: e.clientId, author: e.author },
2981
3015
  { name: e.name, sprite: e.sprite }
2982
3016
  ), l = xt(s.sprite, s.pictureUrl), d = s.cosmetics, [h] = k(
@@ -2990,15 +3024,15 @@ function Vi({ message: e, age: t, ccStyle: n }) {
2990
3024
  children: [
2991
3025
  /* @__PURE__ */ c(Qn, { sprite: s.sprite, url: s.pictureUrl, worn: d }),
2992
3026
  /* @__PURE__ */ _("div", { className: "min-w-0 flex-1", children: [
2993
- d ? /* @__PURE__ */ c(ge, { html: nn(s.name, d), className: "text-sm mr-2", style: { color: l, ...Jt } }) : /* @__PURE__ */ c("span", { className: "font-medium text-sm mr-2", style: { color: l, ...Xt }, children: s.name }),
2994
- h ? /* @__PURE__ */ c(ge, { html: h, className: "text-sm text-white break-words", style: Jt }) : /* @__PURE__ */ c("span", { className: "text-sm text-white break-words", style: Xt, children: e.text }),
3027
+ d ? /* @__PURE__ */ c(ge, { html: nn(s.name, d), className: "text-sm mr-2", style: { color: l, ...Jt } }) : /* @__PURE__ */ c("span", { className: "font-medium text-sm mr-2", style: { color: l, ...zt }, children: s.name }),
3028
+ h ? /* @__PURE__ */ c(ge, { html: h, className: "text-sm text-white break-words", style: Jt }) : /* @__PURE__ */ c("span", { className: "text-sm text-white break-words", style: zt, children: e.text }),
2995
3029
  /* @__PURE__ */ c(Zn, { images: e.images })
2996
3030
  ] })
2997
3031
  ]
2998
3032
  }
2999
3033
  );
3000
3034
  }
3001
- function Ki({ shown: e, className: t }) {
3035
+ function Xi({ shown: e, className: t }) {
3002
3036
  En();
3003
3037
  const n = m((d) => d.chat), r = m((d) => d.mediaPrefs.subtitleStyle), [a, i] = k(() => Date.now()), s = n.length > 0;
3004
3038
  E(() => {
@@ -3017,7 +3051,7 @@ function Ki({ shown: e, className: t }) {
3017
3051
  className: `wp-floating-chat pointer-events-none flex flex-col ${t}`,
3018
3052
  "data-testid": "floating-chat",
3019
3053
  children: l.map((d) => /* @__PURE__ */ c(
3020
- Vi,
3054
+ Yi,
3021
3055
  {
3022
3056
  message: d,
3023
3057
  age: a - d.ts,
@@ -3029,38 +3063,38 @@ function Ki({ shown: e, className: t }) {
3029
3063
  );
3030
3064
  }
3031
3065
  const Qt = (e) => typeof e == "string" && ar.includes(e);
3032
- function Yi(e, t, n) {
3066
+ function zi(e, t, n) {
3033
3067
  return e || (Qt(t) ? t : Qt(n) ? n : "dark");
3034
3068
  }
3035
- function zi(e, t) {
3069
+ function Ji(e, t) {
3036
3070
  if (t(e.clientWidth), typeof ResizeObserver > "u") return () => {
3037
3071
  };
3038
3072
  const n = new ResizeObserver(() => t(e.clientWidth));
3039
3073
  return n.observe(e), () => n.disconnect();
3040
3074
  }
3041
- function Xi(e) {
3075
+ function Qi(e) {
3042
3076
  const t = e?.trim() ?? "";
3043
3077
  return t ? { source: "host", name: t } : { source: "auto" };
3044
3078
  }
3045
- function Ji(e) {
3079
+ function Zi(e) {
3046
3080
  if (e.source !== "host") return;
3047
3081
  const { setSessionIdentity: t, sprite: n } = m.getState();
3048
3082
  t(e.name, n);
3049
3083
  }
3050
- function Qi({ className: e = "w-4 h-4" }) {
3084
+ function es({ className: e = "w-4 h-4" }) {
3051
3085
  return /* @__PURE__ */ _("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
3052
3086
  /* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 4v16" }),
3053
3087
  /* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15 12l-5 4v-8l5 4z" })
3054
3088
  ] });
3055
3089
  }
3056
- function Zi({ className: e = "w-4 h-4" }) {
3090
+ function ts({ className: e = "w-4 h-4" }) {
3057
3091
  return /* @__PURE__ */ _("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
3058
3092
  /* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M20 4v16" }),
3059
3093
  /* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 12l5 4v-8l-5 4z" })
3060
3094
  ] });
3061
3095
  }
3062
- const es = 1500;
3063
- function gs({
3096
+ const ns = 1500;
3097
+ function bs({
3064
3098
  roomKey: e,
3065
3099
  serverOrigin: t,
3066
3100
  roomOrigin: n,
@@ -3077,8 +3111,8 @@ function gs({
3077
3111
  debug: D,
3078
3112
  children: H
3079
3113
  }) {
3080
- const [p, x] = k(null), { setFrame: w, ...y } = ts(M, R), g = m((F) => F.floatingChatEnabled), T = en(() => h), N = ee(() => (oa({ userType: s, userId: l ?? null }), bt().theme), [s, l]), j = ir(), U = j?.theme, C = ee(
3081
- () => Yi(d, U, N),
3114
+ const [p, x] = k(null), { setFrame: w, ...y } = rs(M, R), g = m((F) => F.floatingChatEnabled), T = en(() => h), N = ee(() => (ia({ userType: s, userId: l ?? null }), bt().theme), [s, l]), j = ir(), U = j?.theme, C = ee(
3115
+ () => zi(d, U, N),
3082
3116
  [d, U, N]
3083
3117
  );
3084
3118
  E(() => {
@@ -3088,36 +3122,36 @@ function gs({
3088
3122
  [t, e]
3089
3123
  );
3090
3124
  return E(() => {
3091
- D && jo();
3092
- }, [D]), _i(), E(() => {
3093
- No({ serverOrigin: t, defaultRoomKey: e }), Sa(n ? { origin: n, path: r } : null), Ft(a && !n ? { origin: a, path: i } : null), m.getState().rehydrateFromPrefs(), qa();
3125
+ D && Ho();
3126
+ }, [D]), Si(), E(() => {
3127
+ Ro({ serverOrigin: t, defaultRoomKey: e }), Ca(n ? { origin: n, path: r } : null), Ft(a && !n ? { origin: a, path: i } : null), m.getState().rehydrateFromPrefs(), Ka();
3094
3128
  let F = !1;
3095
- const ae = sa();
3129
+ const ae = ca();
3096
3130
  return (async () => {
3097
3131
  try {
3098
3132
  await Promise.race([
3099
3133
  Promise.all([
3100
3134
  ae,
3101
- fa().then((X) => {
3102
- X && m.getState().rehydrateFromPrefs();
3135
+ ha().then((z) => {
3136
+ z && m.getState().rehydrateFromPrefs();
3103
3137
  }),
3104
3138
  // The character chosen in the settings popout (lib/avatar.ts).
3105
- Da().then(zn)
3139
+ Ma().then(Xn)
3106
3140
  ]),
3107
- new Promise((X) => setTimeout(X, es))
3141
+ new Promise((z) => setTimeout(z, ns))
3108
3142
  ]);
3109
- } catch (X) {
3110
- I("room-chrome", "pre-join wait threw, proceeding anyway", we(X));
3143
+ } catch (z) {
3144
+ I("room-chrome", "pre-join wait threw, proceeding anyway", we(z));
3111
3145
  }
3112
3146
  if (F) return;
3113
- const ie = Xi(T());
3114
- m.getState().ensureAutoIdentity(), Ji(ie);
3147
+ const ie = Qi(T());
3148
+ m.getState().ensureAutoIdentity(), Zi(ie);
3115
3149
  const te = m.getState();
3116
- u("room-chrome", "Joining room", { roomKey: e, name: te.name, sprite: te.sprite }), ti({ room_key: e, name: te.name || void 0, sprite: te.sprite || void 0 });
3150
+ u("room-chrome", "Joining room", { roomKey: e, name: te.name, sprite: te.sprite }), ri({ room_key: e, name: te.name || void 0, sprite: te.sprite || void 0 });
3117
3151
  })(), () => {
3118
3152
  F = !0, Vt(), Ft(null);
3119
3153
  };
3120
- }, [e, t, n, r, a, i, s, l]), /* @__PURE__ */ c(Po.Provider, { value: P, children: /* @__PURE__ */ c(kn.Provider, { value: !1, children: /* @__PURE__ */ c(Tn.Provider, { value: p, children: /* @__PURE__ */ _("div", { ref: w, className: "wp-room-chrome-frame", children: [
3154
+ }, [e, t, n, r, a, i, s, l]), /* @__PURE__ */ c(Do.Provider, { value: P, children: /* @__PURE__ */ c(kn.Provider, { value: !1, children: /* @__PURE__ */ c(Tn.Provider, { value: p, children: /* @__PURE__ */ _("div", { ref: w, className: "wp-room-chrome-frame", children: [
3121
3155
  /* @__PURE__ */ c("div", { className: "wp-room-chrome-frame__content", children: H }),
3122
3156
  /* @__PURE__ */ c(
3123
3157
  "aside",
@@ -3137,11 +3171,11 @@ function gs({
3137
3171
  title: "Show chat",
3138
3172
  "aria-label": "Show chat",
3139
3173
  "aria-expanded": !1,
3140
- children: /* @__PURE__ */ c(Zi, {})
3174
+ children: /* @__PURE__ */ c(ts, {})
3141
3175
  }
3142
3176
  ),
3143
3177
  /* @__PURE__ */ c(Yt, { className: "absolute bottom-2 right-full mr-2 w-72" }),
3144
- /* @__PURE__ */ c(Ki, { shown: g, className: "wp-room-chrome__floating" })
3178
+ /* @__PURE__ */ c(Xi, { shown: g, className: "wp-room-chrome__floating" })
3145
3179
  ] }) : /* @__PURE__ */ _(le, { children: [
3146
3180
  /* @__PURE__ */ c(
3147
3181
  "div",
@@ -3163,7 +3197,7 @@ function gs({
3163
3197
  }
3164
3198
  ),
3165
3199
  /* @__PURE__ */ _("div", { className: "flex items-center gap-1 px-2 py-1.5 border-b border-border", children: [
3166
- /* @__PURE__ */ c(Wi, {}),
3200
+ /* @__PURE__ */ c(Vi, {}),
3167
3201
  /* @__PURE__ */ c("div", { className: "flex-1" }),
3168
3202
  f && /* @__PURE__ */ c(
3169
3203
  "button",
@@ -3185,25 +3219,25 @@ function gs({
3185
3219
  title: "Hide chat",
3186
3220
  "aria-label": "Hide chat",
3187
3221
  "aria-expanded": !0,
3188
- children: /* @__PURE__ */ c(Qi, {})
3222
+ children: /* @__PURE__ */ c(es, {})
3189
3223
  }
3190
3224
  )
3191
3225
  ] }),
3192
- /* @__PURE__ */ c(Pi, {}),
3193
- /* @__PURE__ */ c($i, { commands: [] }),
3226
+ /* @__PURE__ */ c(Di, {}),
3227
+ /* @__PURE__ */ c(Wi, { commands: [] }),
3194
3228
  /* @__PURE__ */ c(Yt, { className: "absolute bottom-14 left-2 right-2" })
3195
3229
  ] })
3196
3230
  }
3197
3231
  )
3198
3232
  ] }) }) }) });
3199
3233
  }
3200
- function ts(e, t) {
3234
+ function rs(e, t) {
3201
3235
  const n = m((g) => g.chromeChatCollapsed) && t, r = m((g) => g.chromeChatWidth), a = m((g) => g.toggleChromeChatCollapsed), i = m((g) => g.setChromeChatWidth), [s, l] = k(null), [d, h] = k(void 0), [f, M] = k(null);
3202
3236
  E(() => {
3203
3237
  if (s)
3204
- return zi(s, h);
3238
+ return Ji(s, h);
3205
3239
  }, [s]);
3206
- const R = Y(f?.current ?? r, d), D = ee(() => ba(n, R), [n, R]), H = en((g) => e?.(g));
3240
+ const R = Y(f?.current ?? r, d), D = ee(() => _a(n, R), [n, R]), H = en((g) => e?.(g));
3207
3241
  return E(() => {
3208
3242
  H(D);
3209
3243
  }, [D]), {
@@ -3224,12 +3258,12 @@ function ts(e, t) {
3224
3258
  M(null), T !== r && i(T);
3225
3259
  },
3226
3260
  onKeyDown: (g) => {
3227
- const T = ya(R, g.key, d);
3261
+ const T = va(R, g.key, d);
3228
3262
  T !== null && (g.preventDefault(), T !== r && i(T));
3229
3263
  }
3230
3264
  };
3231
3265
  }
3232
3266
  export {
3233
- gs as RoomChrome
3267
+ bs as RoomChrome
3234
3268
  };
3235
3269
  //# sourceMappingURL=room-chrome.js.map