@hadoku/watchparty-ui 0.45.118 → 0.45.120

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,22 +1,22 @@
1
1
  import { jsx as l, jsxs as w, Fragment as te } from "react/jsx-runtime";
2
- import Ke, { useState as N, useRef as $, useMemo as F, useCallback as M, useEffect as P, createContext as wt, useContext as ba, useSyncExternalStore as ya, useLayoutEffect as $t, useId as Ft, useEffectEvent as _a } from "react";
2
+ import Ke, { useState as N, useRef as U, useMemo as F, useCallback as D, useEffect as M, createContext as kt, useContext as ba, useSyncExternalStore as ya, useLayoutEffect as ut, useId as Ft, useEffectEvent as _a } from "react";
3
3
  import { themePrefs as pe, Icon as jn, THEMES as Rn, useHadokuThemeOptional as Pn } from "@wolffm/themes";
4
- import { createCdnClient as Mn, kindOfType as Dn, MAX_BYTES as Ln, measureImage as On, filesFromClipboard as qn, filesFromDrop as Hn, CdnError as ut } from "@wolffm/cdn-client";
4
+ import { createCdnClient as Mn, kindOfType as Dn, MAX_BYTES as Ln, measureImage as On, filesFromClipboard as qn, filesFromDrop as Hn, CdnError as mt } from "@wolffm/cdn-client";
5
5
  import { ensureCosmeticsStyles as Un, cleanWorn as $n, readPictureColour as Fn, onPictureColour as zn, pictureColour as Wn, decorHtml as Bn, messageHtml as wa, nameHtml as ka, finishReveal as Gn } from "@wolffm/prefs-client/cosmetics";
6
6
  import { create as Kn } from "zustand";
7
7
  import { avatarPortraitPath as Vn, pickAvatar as va, applyReaction as Yn, mintTabId as Jn, resolveIdentityReassert as Xn } from "@wolffm/rooms-protocol";
8
8
  import { z as i } from "zod";
9
9
  import { createPrefsClient as Qn, getDeviceId as Zn, DEVICE_ID_KEY as eo } from "@wolffm/prefs-client";
10
- import { io as mt } from "socket.io-client";
10
+ import { io as gt } from "socket.io-client";
11
11
  import { fetchCharacter as to, characterOf as ao, onAvatarChange as no } from "@wolffm/prefs-client/avatar";
12
12
  import { relayIdentityChanges as oo } from "@wolffm/task-ui-components/identity-relay";
13
13
  import { createPortal as xa } from "react-dom";
14
14
  import { useCatalogueSearch as ro } from "@wolffm/cdn-client/react";
15
15
  const Sa = "https://cdn.hadoku.me", Ta = /^[0-9a-f]{64}\.(?:png|jpe?g|gif|webp|avif)$/;
16
- function kt(e) {
16
+ function vt(e) {
17
17
  return typeof e == "string" && Ta.test(e);
18
18
  }
19
- const vt = 8080, Ca = 5173, io = "/watchparty/ws", Ea = 500, fo = 1e3, ae = 4, Ia = typeof process < "u" && process.env ? process.env : {};
19
+ const xt = 8080, Ca = 5173, io = "/watchparty/ws", Ea = 500, fo = 1e3, ae = 4, Ia = typeof process < "u" && process.env ? process.env : {};
20
20
  Ia.PRODUCTION_UI_URL;
21
21
  Ia.PRODUCTION_SERVER_URL;
22
22
  const He = i.enum(["S", "A", "B", "C", "D", "F"]), zt = 2e4, so = 300;
@@ -28,7 +28,7 @@ i.object({
28
28
  * resolves it from prefs-api by registry userId, never from the client. */
29
29
  avatar: i.literal(!0).optional()
30
30
  });
31
- const S = {
31
+ const T = {
32
32
  JOIN: "join",
33
33
  SNAPSHOT: "snapshot",
34
34
  CONTROL_ACK: "control_ack",
@@ -179,7 +179,7 @@ i.object({
179
179
  * here, so a rename reaches lines already on screen. */
180
180
  template: i.string().optional()
181
181
  });
182
- const xt = "{name}", mo = i.object({
182
+ const St = "{name}", mo = i.object({
183
183
  avg_download_rate_bps: i.number().nonnegative(),
184
184
  buffered_ahead_ms: i.number().nonnegative(),
185
185
  rtt_ms: i.number().nonnegative(),
@@ -259,7 +259,7 @@ i.object({
259
259
  i.object({
260
260
  media_id: i.string()
261
261
  });
262
- const St = i.enum(["super_upvote", "upvote", "mid", "downvote"]), po = i.object({
262
+ const Tt = i.enum(["super_upvote", "upvote", "mid", "downvote"]), po = i.object({
263
263
  mediaId: i.string(),
264
264
  displayName: i.string(),
265
265
  // Enrichment fields — present for flat-playlist ingest output, absent for
@@ -283,14 +283,14 @@ i.object({ index: i.number().int().min(0) });
283
283
  i.object({
284
284
  playlistId: i.string(),
285
285
  mediaId: i.string(),
286
- vote: St
286
+ vote: Tt
287
287
  });
288
288
  i.object({ voterKey: i.string().min(1).max(128) });
289
289
  i.object({ playlistId: i.string(), mediaIds: i.array(i.string()) });
290
290
  i.object({
291
291
  playlist: ja.nullable(),
292
292
  activeIndex: i.number().int().nullable(),
293
- myVotes: i.record(i.string(), St)
293
+ myVotes: i.record(i.string(), Tt)
294
294
  // mediaId -> VoteValue
295
295
  });
296
296
  const yo = i.object({
@@ -304,7 +304,7 @@ i.object({
304
304
  });
305
305
  i.object({
306
306
  playlist: ja,
307
- votes: i.record(i.string(), i.record(i.string(), St)),
307
+ votes: i.record(i.string(), i.record(i.string(), Tt)),
308
308
  // votes[clientId][mediaId]
309
309
  names: i.record(i.string(), i.string()),
310
310
  // clientId -> display name
@@ -475,7 +475,7 @@ function tt() {
475
475
  return (!Me || Me.base !== e) && (Me = { base: e, client: Mn({ cdnBase: e }) }), Me.client;
476
476
  }
477
477
  function Ve(e) {
478
- return !kt(e) || !qa() ? null : tt().urlFor(e);
478
+ return !vt(e) || !qa() ? null : tt().urlFor(e);
479
479
  }
480
480
  function jo(e) {
481
481
  return e.kind === "file";
@@ -506,7 +506,7 @@ function Ue(e) {
506
506
  }
507
507
  }
508
508
  function Ro(e) {
509
- return e instanceof ut ? Ue(e.reason) : e instanceof Ha ? e.message : "Image upload failed";
509
+ return e instanceof mt ? Ue(e.reason) : e instanceof Ha ? e.message : "Image upload failed";
510
510
  }
511
511
  function Po(e) {
512
512
  const t = e.type.toLowerCase().split(";")[0].trim();
@@ -524,7 +524,7 @@ async function Lo(e) {
524
524
  }
525
525
  async function Oo(e, t = {}) {
526
526
  const a = await tt().upload(e, { signal: t.signal });
527
- if (!kt(a.key))
527
+ if (!vt(a.key))
528
528
  throw new Ha("Image upload returned an unusable key");
529
529
  return { key: a.key, deduplicated: a.deduplicated === !0 };
530
530
  }
@@ -544,8 +544,8 @@ function Ho(e) {
544
544
  return {
545
545
  error: e instanceof Error ? e.message : String(e),
546
546
  name: e instanceof Error ? e.name : typeof e,
547
- reason: e instanceof ut ? e.reason : void 0,
548
- status: e instanceof ut ? e.status : void 0
547
+ reason: e instanceof mt ? e.reason : void 0,
548
+ status: e instanceof mt ? e.status : void 0
549
549
  };
550
550
  }
551
551
  function at(e) {
@@ -565,47 +565,47 @@ function $o({ className: e }) {
565
565
  }
566
566
  );
567
567
  }
568
- const gt = 240, fe = 8, Fo = 28, Ua = 240;
568
+ const ht = 240, fe = 8, Fo = 28, Ua = 240;
569
569
  function zo(e, t, a) {
570
- let n = t.left - gt - fe;
571
- n < fe && (n = t.right + fe), n = Math.min(n, a.width - gt - fe), n = Math.max(fe, n);
570
+ let n = t.left - ht - fe;
571
+ n < fe && (n = t.right + fe), n = Math.min(n, a.width - ht - fe), n = Math.max(fe, n);
572
572
  const o = Ua + Fo;
573
573
  let r = e.top + e.height / 2 - o / 2;
574
574
  return r = Math.min(r, a.height - o - fe), r = Math.max(fe, r), { left: n, top: r };
575
575
  }
576
576
  const $a = "/dataplatform/api/memes", Wo = 120;
577
577
  function Bo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
578
- const [o, r] = N(""), f = $(null), s = $(null), c = tt(), { items: g, loading: u, error: v, hasMore: x, loadMore: I } = ro(
578
+ const [o, r] = N(""), f = U(null), s = U(null), c = tt(), { items: g, loading: u, error: x, hasMore: S, loadMore: I } = ro(
579
579
  c,
580
580
  $a,
581
581
  o.trim()
582
- ), R = v?.reason ?? null, _ = F(() => {
582
+ ), R = x?.reason ?? null, y = F(() => {
583
583
  const E = /* @__PURE__ */ new Set();
584
584
  return g.filter((j) => E.has(j.key) ? !1 : (E.add(j.key), !0));
585
- }, [g]), [d, y] = N(null), h = $(null), b = M(() => {
585
+ }, [g]), [d, b] = N(null), h = U(null), _ = D(() => {
586
586
  h.current !== null && (window.clearTimeout(h.current), h.current = null);
587
- }, []), T = M(() => {
588
- b(), y(null);
589
- }, [b]), L = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(hover: hover)").matches, O = M(
587
+ }, []), k = D(() => {
588
+ _(), b(null);
589
+ }, [_]), P = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(hover: hover)").matches, O = D(
590
590
  (E, j, A = !1) => {
591
591
  const q = f.current;
592
592
  if (!q) return;
593
- const H = () => y({
593
+ const H = () => b({
594
594
  item: E,
595
595
  ...zo(j.getBoundingClientRect(), q.getBoundingClientRect(), {
596
596
  width: window.innerWidth,
597
597
  height: window.innerHeight
598
598
  })
599
599
  });
600
- b(), A ? H() : h.current = window.setTimeout(H, Wo);
600
+ _(), A ? H() : h.current = window.setTimeout(H, Wo);
601
601
  },
602
- [b]
602
+ [_]
603
603
  );
604
- P(() => () => b(), [b]), P(() => {
604
+ M(() => () => _(), [_]), M(() => {
605
605
  R === "unavailable" && a?.();
606
- }, [R, a]), P(() => {
606
+ }, [R, a]), M(() => {
607
607
  s.current?.focus();
608
- }, []), P(() => {
608
+ }, []), M(() => {
609
609
  const E = (A) => {
610
610
  at(A) && (A.stopPropagation(), e());
611
611
  }, j = (A) => {
@@ -616,9 +616,9 @@ function Bo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
616
616
  document.removeEventListener("keydown", E), document.removeEventListener("mousedown", j);
617
617
  };
618
618
  }, [e, n]);
619
- const z = M((E) => {
619
+ const z = D((E) => {
620
620
  t(E), e();
621
- }, [t, e]), W = !u && !v && _.length === 0;
621
+ }, [t, e]), W = !u && !x && y.length === 0;
622
622
  return /* @__PURE__ */ w(
623
623
  "div",
624
624
  {
@@ -645,10 +645,10 @@ function Bo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
645
645
  "div",
646
646
  {
647
647
  className: "flex-1 overflow-y-auto p-2",
648
- onScroll: T,
649
- onMouseLeave: T,
648
+ onScroll: k,
649
+ onMouseLeave: k,
650
650
  children: [
651
- v && /* @__PURE__ */ l(
651
+ x && /* @__PURE__ */ l(
652
652
  "p",
653
653
  {
654
654
  className: "m-2 p-2 text-center text-sm bg-danger-bg text-on-danger-bg rounded",
@@ -661,7 +661,7 @@ function Bo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
661
661
  }
662
662
  ),
663
663
  W && /* @__PURE__ */ l("p", { className: "p-4 text-center text-sm text-text-secondary", children: o.trim() ? `No memes match "${o.trim()}"` : "The meme library is empty" }),
664
- _.length > 0 && /* @__PURE__ */ l("div", { className: "grid grid-cols-3 gap-1.5 sm:grid-cols-4", children: _.map((E) => {
664
+ y.length > 0 && /* @__PURE__ */ l("div", { className: "grid grid-cols-3 gap-1.5 sm:grid-cols-4", children: y.map((E) => {
665
665
  const j = Ve(E.key);
666
666
  return j ? /* @__PURE__ */ l(
667
667
  "button",
@@ -671,11 +671,11 @@ function Bo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
671
671
  title: E.title,
672
672
  "data-testid": "meme-result",
673
673
  onMouseEnter: (A) => {
674
- L && O(E, A.currentTarget);
674
+ P && O(E, A.currentTarget);
675
675
  },
676
- onMouseLeave: T,
676
+ onMouseLeave: k,
677
677
  onFocus: (A) => O(E, A.currentTarget, !0),
678
- onBlur: T,
678
+ onBlur: k,
679
679
  className: "group relative aspect-square overflow-hidden rounded border border-border-light bg-bg-alt focus:outline-none focus:border-primary hover:border-primary",
680
680
  children: /* @__PURE__ */ l(
681
681
  "img",
@@ -692,7 +692,7 @@ function Bo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
692
692
  ) : null;
693
693
  }) }),
694
694
  u && /* @__PURE__ */ l("p", { className: "p-2 text-center text-xs text-text-secondary", children: "Loading…" }),
695
- x && !u && /* @__PURE__ */ l(
695
+ S && !u && /* @__PURE__ */ l(
696
696
  "button",
697
697
  {
698
698
  type: "button",
@@ -713,7 +713,7 @@ function Bo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
713
713
  style: {
714
714
  left: d.left,
715
715
  top: d.top,
716
- width: gt,
716
+ width: ht,
717
717
  /* The placement maths reserves exactly PREVIEW_PX of width.
718
718
  Without border-box the padding and border sit OUTSIDE that
719
719
  number and the box laps over the panel it is meant to sit
@@ -746,12 +746,12 @@ function Bo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
746
746
  function Go({ open: e, ...t }) {
747
747
  return e ? /* @__PURE__ */ l(Bo, { ...t }) : null;
748
748
  }
749
- const Tt = {
750
- serverOrigin: `http://localhost:${vt}`,
749
+ const Ct = {
750
+ serverOrigin: `http://localhost:${xt}`,
751
751
  defaultRoomKey: "dev-room",
752
752
  cdnBase: Sa
753
753
  };
754
- let $e = { ...Tt };
754
+ let $e = { ...Ct };
755
755
  function Ko(e) {
756
756
  const t = Object.fromEntries(
757
757
  Object.entries(e).filter(([a, n]) => n !== void 0)
@@ -761,21 +761,21 @@ function Ko(e) {
761
761
  function Ce() {
762
762
  return $e;
763
763
  }
764
- const Vo = wt(Tt);
764
+ const Vo = kt(Ct);
765
765
  function Yo(e) {
766
766
  return e.serverOrigin?.replace(/\/$/, "") || "";
767
767
  }
768
768
  function Fa() {
769
769
  return Yo(Ce());
770
770
  }
771
- const za = wt(null);
771
+ const za = kt(null);
772
772
  function Wa() {
773
773
  return ba(za);
774
774
  }
775
- const Ba = wt(!0);
775
+ const Ba = kt(!0);
776
776
  function Ga() {
777
777
  const e = ba(Ba);
778
- P(() => {
778
+ M(() => {
779
779
  e && Un();
780
780
  }, [e]);
781
781
  }
@@ -789,7 +789,7 @@ const we = Ke.memo(
789
789
  (e, t) => e.html === t.html && e.as === t.as && e.className === t.className && JSON.stringify(e.style) === JSON.stringify(t.style)
790
790
  );
791
791
  function Jo(e, t) {
792
- P(() => {
792
+ M(() => {
793
793
  const a = e.current;
794
794
  if (!a || !t || typeof IntersectionObserver > "u") return;
795
795
  const n = new IntersectionObserver(([o]) => {
@@ -822,7 +822,7 @@ function B(e) {
822
822
  return null;
823
823
  }
824
824
  }
825
- function Ct(e, t) {
825
+ function Et(e, t) {
826
826
  try {
827
827
  const a = nt();
828
828
  return a ? (a.setItem(e, t), !0) : !1;
@@ -867,11 +867,11 @@ function Ja(e, t) {
867
867
  typeof window > "u" || (window[e] = t);
868
868
  }
869
869
  const be = [], er = 500;
870
- let Fe = [], ht = null;
870
+ let Fe = [], pt = null;
871
871
  const tr = 1e3, ar = 200;
872
- let pt = null;
872
+ let bt = null;
873
873
  function Xa(e) {
874
- pt = e;
874
+ bt = e;
875
875
  }
876
876
  function Qa() {
877
877
  return B(oe.REPORT_LOGS_FLAG) === "true";
@@ -914,7 +914,7 @@ function fr(e) {
914
914
  return "[unserializable]";
915
915
  }
916
916
  }
917
- function Et(e, t, a, n, o, r, f) {
917
+ function It(e, t, a, n, o, r, f) {
918
918
  const s = {
919
919
  level: e,
920
920
  category: o,
@@ -936,13 +936,13 @@ function Et(e, t, a, n, o, r, f) {
936
936
  );
937
937
  }
938
938
  function p(e, t, a) {
939
- Et("debug", console.log, !1, !1, e, t, a);
939
+ It("debug", console.log, !1, !1, e, t, a);
940
940
  }
941
- function D(e, t, a) {
942
- Et("warn", console.warn, !0, !1, e, t, a);
941
+ function L(e, t, a) {
942
+ It("warn", console.warn, !0, !1, e, t, a);
943
943
  }
944
944
  function ze(e, t, a) {
945
- Et("error", console.error, !0, !0, e, t, a);
945
+ It("error", console.error, !0, !0, e, t, a);
946
946
  }
947
947
  function sr() {
948
948
  return [...be];
@@ -952,7 +952,7 @@ function lr() {
952
952
  }
953
953
  function cr(e) {
954
954
  const t = e && e.length > 0 ? e.join(",") : "true";
955
- Ct(oe.DEBUG_FLAG, t), console.log("[wp] Debug mode enabled");
955
+ Et(oe.DEBUG_FLAG, t), console.log("[wp] Debug mode enabled");
956
956
  }
957
957
  function dr() {
958
958
  ke(oe.DEBUG_FLAG), console.log("[wp] Debug mode disabled");
@@ -979,12 +979,12 @@ function gr(e) {
979
979
  async function hr() {
980
980
  if (Fe.length === 0) return;
981
981
  const e = Fe;
982
- Fe = [], ht = null;
982
+ Fe = [], pt = null;
983
983
  try {
984
984
  let a = Ce().serverOrigin || "";
985
985
  if ((a === "/" || !a) && typeof window < "u") {
986
986
  const s = window.location;
987
- (s.hostname === "localhost" || s.hostname === "127.0.0.1") && s.port === String(Ca) ? a = `${s.protocol}//${s.hostname}:${vt}` : a = s.origin;
987
+ (s.hostname === "localhost" || s.hostname === "127.0.0.1") && s.port === String(Ca) ? a = `${s.protocol}//${s.hostname}:${xt}` : a = s.origin;
988
988
  }
989
989
  const n = `${a.replace(/\/$/, "")}/api/client-log`, o = e.map((s) => ({
990
990
  level: s.level,
@@ -994,8 +994,8 @@ async function hr() {
994
994
  timestamp: s.timestamp,
995
995
  url: typeof window < "u" ? window.location.href : void 0,
996
996
  userAgent: typeof navigator < "u" ? navigator.userAgent : void 0,
997
- room_key: pt?.room_key,
998
- client_id: pt?.client_id
997
+ room_key: bt?.room_key,
998
+ client_id: bt?.client_id
999
999
  }));
1000
1000
  let r = [], f = 0;
1001
1001
  for (const s of o) {
@@ -1016,9 +1016,9 @@ async function hr() {
1016
1016
  }
1017
1017
  }
1018
1018
  function Wt(e) {
1019
- if (Fe.push(e), !ht) {
1019
+ if (Fe.push(e), !pt) {
1020
1020
  const t = Qa() ? ar : tr;
1021
- ht = setTimeout(() => {
1021
+ pt = setTimeout(() => {
1022
1022
  hr();
1023
1023
  }, t);
1024
1024
  }
@@ -1057,17 +1057,17 @@ const ne = {
1057
1057
  userType: "public",
1058
1058
  accountId: null
1059
1059
  };
1060
- function It() {
1060
+ function At() {
1061
1061
  return ne.accountId ? ne.accountId : ne.resolved && ne.userType === "public" ? "anon" : null;
1062
1062
  }
1063
1063
  function wr(e) {
1064
1064
  ne.resolved = !0, e.userType && (ne.userType = e.userType), e.userId !== void 0 && (ne.accountId = e.userId && e.userId !== "public" ? e.userId : null);
1065
1065
  }
1066
- function At() {
1066
+ function Nt() {
1067
1067
  return ne.accountId ?? "public";
1068
1068
  }
1069
1069
  function kr() {
1070
- return It() ?? "unscoped";
1070
+ return At() ?? "unscoped";
1071
1071
  }
1072
1072
  function Za(e) {
1073
1073
  return et(e) ? xo[e] : "var(--color-neutral-bg)";
@@ -1129,11 +1129,11 @@ const Sr = i.object({
1129
1129
  schema: Sr
1130
1130
  }), Tr = /* @__PURE__ */ new Set(["theme", "themeMode"]);
1131
1131
  function Ye(e) {
1132
- const t = It();
1132
+ const t = At();
1133
1133
  return t ? `prefs-cache:${t}:${e}` : null;
1134
1134
  }
1135
1135
  function Cr() {
1136
- return It() === null;
1136
+ return At() === null;
1137
1137
  }
1138
1138
  function Kt(e) {
1139
1139
  const t = Ye(e);
@@ -1162,16 +1162,16 @@ function Er() {
1162
1162
  const f = a ? r?.blob : r;
1163
1163
  if (!f || typeof f != "object" || !("name" in f)) continue;
1164
1164
  const { name: s, ...c } = f, g = a ? { ...r, blob: c } : c;
1165
- Ct(t, JSON.stringify(g)) && e++;
1165
+ Et(t, JSON.stringify(g)) && e++;
1166
1166
  }
1167
1167
  return e > 0 && p("preferences", "Stripped retired name from cached prefs rows", { rewritten: e }), e;
1168
1168
  }
1169
1169
  let en = null, tn = null;
1170
1170
  const Vt = /* @__PURE__ */ new Set();
1171
- function Nt() {
1171
+ function jt() {
1172
1172
  if (Cr())
1173
1173
  return p("preferences", "Boot read deferred — session pending, identity unresolved"), {};
1174
- const e = Kt("portfolio"), t = Kt("watchparty"), a = Object.keys(e).length > 0 ? e : en ?? {}, n = Object.keys(t).length > 0 ? t : tn ?? {}, o = At() || "public";
1174
+ const e = Kt("portfolio"), t = Kt("watchparty"), a = Object.keys(e).length > 0 ? e : en ?? {}, n = Object.keys(t).length > 0 ? t : tn ?? {}, o = Nt() || "public";
1175
1175
  if (Vt.has(o))
1176
1176
  return p("preferences", "Loaded (sync, SDK-only after first read)", {
1177
1177
  uid: o,
@@ -1195,11 +1195,11 @@ function Nt() {
1195
1195
  }
1196
1196
  let an = !1;
1197
1197
  function Ir() {
1198
- const e = At();
1198
+ const e = Nt();
1199
1199
  return !e || e === "public";
1200
1200
  }
1201
1201
  function J(e, t) {
1202
- Ir() && (an = !0), Tr.has(e) ? pe.save({ [e]: t }, { scope: "device" }).catch((a) => D("preferences", "themePrefs.save failed", { key: e, err: a?.message })) : ye.save({ [e]: t }).catch((a) => D("preferences", "watchpartyPrefs.save failed", { key: e, err: a?.message })), p("preferences", "Saved (via SDK)", { key: e, value: t });
1202
+ Ir() && (an = !0), Tr.has(e) ? pe.save({ [e]: t }, { scope: "device" }).catch((a) => L("preferences", "themePrefs.save failed", { key: e, err: a?.message })) : ye.save({ [e]: t }).catch((a) => L("preferences", "watchpartyPrefs.save failed", { key: e, err: a?.message })), p("preferences", "Saved (via SDK)", { key: e, value: t });
1203
1203
  }
1204
1204
  let Le = null, Yt = !1;
1205
1205
  function Ar() {
@@ -1219,7 +1219,7 @@ function Ar() {
1219
1219
  const { useAppStore: f } = await Promise.resolve().then(() => ln);
1220
1220
  f.getState().rehydrateFromPrefs();
1221
1221
  } catch (f) {
1222
- D("preferences", "inline rehydrate after SDK read failed", { err: f?.message });
1222
+ L("preferences", "inline rehydrate after SDK read failed", { err: f?.message });
1223
1223
  }
1224
1224
  const a = Ye("portfolio"), n = Ye("watchparty"), o = a ? B(a) : null, r = n ? B(n) : null;
1225
1225
  return p("preferences", "sdk.read", {
@@ -1235,18 +1235,18 @@ function Ar() {
1235
1235
  })
1236
1236
  ])) : p("preferences", "Skipping anon promotion — no pre-auth writes this load"), p("preferences", "First-load SDK sync complete"), !0;
1237
1237
  } catch (e) {
1238
- return D("preferences", "First-load SDK sync failed (non-fatal)", { err: e?.message }), !1;
1238
+ return L("preferences", "First-load SDK sync failed (non-fatal)", { err: e?.message }), !1;
1239
1239
  }
1240
1240
  })(), Le);
1241
1241
  }
1242
1242
  const Je = "watchparty_preferences";
1243
1243
  Er();
1244
- function bt() {
1245
- const e = At();
1244
+ function yt() {
1245
+ const e = Nt();
1246
1246
  return !e || e === "public" ? Je : `${Je}:${e}`;
1247
1247
  }
1248
1248
  function nn() {
1249
- const e = B(bt());
1249
+ const e = B(yt());
1250
1250
  if (!e) return null;
1251
1251
  try {
1252
1252
  const t = JSON.parse(e);
@@ -1256,7 +1256,7 @@ function nn() {
1256
1256
  }
1257
1257
  }
1258
1258
  function Jt() {
1259
- ke(bt()), ke(`${bt()}:_serverSynced_v1`);
1259
+ ke(yt()), ke(`${yt()}:_serverSynced_v1`);
1260
1260
  }
1261
1261
  async function Nr(e, t) {
1262
1262
  const a = nn();
@@ -1281,7 +1281,7 @@ async function Nr(e, t) {
1281
1281
  c.length > 0 ? ye.save(f) : Promise.resolve()
1282
1282
  ]), Jt(), p("preferences", "Legacy migration complete");
1283
1283
  } catch (g) {
1284
- D("preferences", "Legacy migration save failed — will retry next load", {
1284
+ L("preferences", "Legacy migration save failed — will retry next load", {
1285
1285
  err: g?.message
1286
1286
  });
1287
1287
  }
@@ -1299,7 +1299,7 @@ function Qt(e, t) {
1299
1299
  };
1300
1300
  localStorage.setItem(a, JSON.stringify(n));
1301
1301
  } catch (n) {
1302
- Xt || (Xt = !0, D("preferences", "writeThrough localStorage failed (in-memory backstop only)", {
1302
+ Xt || (Xt = !0, L("preferences", "writeThrough localStorage failed (in-memory backstop only)", {
1303
1303
  appId: e,
1304
1304
  err: n?.message,
1305
1305
  name: n?.name
@@ -1311,12 +1311,12 @@ function Zt(e) {
1311
1311
  try {
1312
1312
  t.getState().rehydrateFromPrefs();
1313
1313
  } catch (a) {
1314
- D("preferences", "rehydrateFromPrefs threw", { reason: e, err: a?.message });
1314
+ L("preferences", "rehydrateFromPrefs threw", { reason: e, err: a?.message });
1315
1315
  }
1316
- }).catch((t) => D("preferences", "store import failed", { reason: e, err: t?.message }));
1316
+ }).catch((t) => L("preferences", "store import failed", { reason: e, err: t?.message }));
1317
1317
  }
1318
1318
  const on = 24;
1319
- function yt(e) {
1319
+ function _t(e) {
1320
1320
  if (!Array.isArray(e)) return [];
1321
1321
  const t = [];
1322
1322
  for (const a of e)
@@ -1330,7 +1330,7 @@ function Rr() {
1330
1330
  const e = B(oe.RECENT_EMOJI);
1331
1331
  if (!e) return [];
1332
1332
  try {
1333
- return yt(JSON.parse(e));
1333
+ return _t(JSON.parse(e));
1334
1334
  } catch {
1335
1335
  return [];
1336
1336
  }
@@ -1338,10 +1338,10 @@ function Rr() {
1338
1338
  function Pr() {
1339
1339
  ke(oe.RECENT_EMOJI);
1340
1340
  }
1341
- const rn = 320, Xe = 240, jt = 640, Mr = 320, Dr = 36, ea = 16;
1341
+ const rn = 320, Xe = 240, Rt = 640, Mr = 320, Dr = 36, ea = 16;
1342
1342
  function Z(e, t) {
1343
1343
  if (!Number.isFinite(e)) return rn;
1344
- let a = jt;
1344
+ let a = Rt;
1345
1345
  return t !== void 0 && Number.isFinite(t) && t > 0 && (a = Math.min(a, t - Mr)), a = Math.max(a, Xe), Math.round(Math.min(a, Math.max(Xe, e)));
1346
1346
  }
1347
1347
  function ta(e, t, a, n) {
@@ -1356,7 +1356,7 @@ function Lr(e, t, a) {
1356
1356
  case "Home":
1357
1357
  return Z(Xe, a);
1358
1358
  case "End":
1359
- return Z(jt, a);
1359
+ return Z(Rt, a);
1360
1360
  default:
1361
1361
  return null;
1362
1362
  }
@@ -1368,7 +1368,7 @@ function fn(e, t) {
1368
1368
  const a = new Set(t.map((r) => r.id)), n = t.reduce((r, f) => Math.max(r, f.ts), -1 / 0), o = e.filter((r) => !a.has(r.id) && r.ts > n);
1369
1369
  return o.length ? [...t, ...o] : t;
1370
1370
  }
1371
- const sn = 6e3, G = Nt(), m = Kn((e, t) => ({
1371
+ const sn = 6e3, G = jt(), m = Kn((e, t) => ({
1372
1372
  ready: !1,
1373
1373
  name: "",
1374
1374
  sprite: null,
@@ -1383,7 +1383,7 @@ const sn = 6e3, G = Nt(), m = Kn((e, t) => ({
1383
1383
  chromeChatCollapsed: G.chromeChatCollapsed ?? !1,
1384
1384
  chromeChatWidth: Z(G.chromeChatWidth ?? rn),
1385
1385
  // The account's list, else what this browser kept before it moved to prefs.
1386
- recentEmoji: G.recentEmoji !== void 0 ? yt(G.recentEmoji) : Rr(),
1386
+ recentEmoji: G.recentEmoji !== void 0 ? _t(G.recentEmoji) : Rr(),
1387
1387
  // Hardcoded on for everyone — the per-user toggle was removed from the
1388
1388
  // control bar; FloatingChat + toggleFloatingChat code is kept for future
1389
1389
  // re-enablement but the value is no longer user-controllable.
@@ -1435,7 +1435,7 @@ const sn = 6e3, G = Nt(), m = Kn((e, t) => ({
1435
1435
  const r = xe(o);
1436
1436
  return p("store", "Auto-identity assigned", { name: r, sprite: o }), { name: r, sprite: o };
1437
1437
  }
1438
- return D("store", "All characters taken, leaving identity unset"), {};
1438
+ return L("store", "All characters taken, leaving identity unset"), {};
1439
1439
  }),
1440
1440
  ensureMe: (a) => {
1441
1441
  p("store", "Client ID set", { clientId: a }), e((n) => ({ me: { ...n.me, clientId: a } }));
@@ -1610,8 +1610,8 @@ const sn = 6e3, G = Nt(), m = Kn((e, t) => ({
1610
1610
  setGameSettings: (a) => e({ gameSettings: a }),
1611
1611
  setRoomKeyType: (a) => e({ roomKeyType: a }),
1612
1612
  rehydrateFromPrefs: () => e((a) => {
1613
- const n = Nt(), o = {};
1614
- if (n.chatCollapsed !== void 0 && !Gt() && (o.chatCollapsed = n.chatCollapsed), n.chromeChatCollapsed !== void 0 && (o.chromeChatCollapsed = n.chromeChatCollapsed), n.chromeChatWidth !== void 0 && (o.chromeChatWidth = Z(n.chromeChatWidth)), n.recentEmoji !== void 0 && (o.recentEmoji = yt(n.recentEmoji)), ["volume", "muted", "preferredAudioLang", "subtitlesEnabled", "subtitleStyle"].some((s) => n[s] !== void 0)) {
1613
+ const n = jt(), o = {};
1614
+ if (n.chatCollapsed !== void 0 && !Gt() && (o.chatCollapsed = n.chatCollapsed), n.chromeChatCollapsed !== void 0 && (o.chromeChatCollapsed = n.chromeChatCollapsed), n.chromeChatWidth !== void 0 && (o.chromeChatWidth = Z(n.chromeChatWidth)), n.recentEmoji !== void 0 && (o.recentEmoji = _t(n.recentEmoji)), ["volume", "muted", "preferredAudioLang", "subtitlesEnabled", "subtitleStyle"].some((s) => n[s] !== void 0)) {
1615
1615
  const s = { ...a.mediaPrefs };
1616
1616
  n.volume !== void 0 && (s.volume = n.volume), n.muted !== void 0 && (s.muted = n.muted), n.preferredAudioLang !== void 0 && (s.preferredAudioLang = n.preferredAudioLang), n.subtitlesEnabled !== void 0 && (s.subtitlesEnabled = n.subtitlesEnabled), n.subtitleStyle !== void 0 && ["classic", "cinema", "minimal", "contrast"].includes(n.subtitleStyle) && (s.subtitleStyle = n.subtitleStyle), o.mediaPrefs = s;
1617
1617
  }
@@ -1641,19 +1641,19 @@ function $r(e, t, a, n) {
1641
1641
  return o;
1642
1642
  }
1643
1643
  const Se = /* @__PURE__ */ new Map();
1644
- function Rt(e, t) {
1644
+ function Pt(e, t) {
1645
1645
  if (t.intents = $r(t.confirmed, t.intents, t.handle, Date.now()), m.getState().setReactions(e, Ur(t.confirmed, t.intents, t.handle)), t.timer && clearTimeout(t.timer), t.timer = null, t.intents.size === 0) {
1646
1646
  Se.delete(e);
1647
1647
  return;
1648
1648
  }
1649
1649
  const a = Math.min(...[...t.intents.values()].map((n) => n.expires));
1650
1650
  t.timer = setTimeout(() => {
1651
- Se.get(e) === t && Rt(e, t);
1651
+ Se.get(e) === t && Pt(e, t);
1652
1652
  }, Math.max(0, a - Date.now()));
1653
1653
  }
1654
1654
  function Fr(e, t, a, n) {
1655
1655
  let o = Se.get(e);
1656
- o || (o = { confirmed: m.getState().chat.find((f) => f.id === e)?.reactions, intents: /* @__PURE__ */ new Map(), handle: n, timer: null }, Se.set(e, o)), o.handle = n, o.intents.delete(t), o.intents.set(t, { on: a, expires: Date.now() + qr }), Rt(e, o);
1656
+ o || (o = { confirmed: m.getState().chat.find((f) => f.id === e)?.reactions, intents: /* @__PURE__ */ new Map(), handle: n, timer: null }, Se.set(e, o)), o.handle = n, o.intents.delete(t), o.intents.set(t, { on: a, expires: Date.now() + qr }), Pt(e, o);
1657
1657
  }
1658
1658
  function zr(e, t) {
1659
1659
  const a = Se.get(e);
@@ -1661,7 +1661,7 @@ function zr(e, t) {
1661
1661
  m.getState().setReactions(e, t);
1662
1662
  return;
1663
1663
  }
1664
- a.confirmed = t, Rt(e, a);
1664
+ a.confirmed = t, Pt(e, a);
1665
1665
  }
1666
1666
  function cn(e) {
1667
1667
  const t = typeof window < "u" ? window.location.href : "http://localhost/", a = new URL(e, t).pathname;
@@ -1684,19 +1684,19 @@ function Ie() {
1684
1684
  function Br(e) {
1685
1685
  if (Q)
1686
1686
  if (We = e, X)
1687
- X.connected && X.emit(S.JOIN, e);
1687
+ X.connected && X.emit(T.JOIN, e);
1688
1688
  else {
1689
- const { url: t, path: a } = Wr(Q), n = mt(t, { path: a, transports: ["websocket", "polling"] });
1690
- X = n, p("chat", "External chat socket", { url: t, path: a }), gn(n), n.on(S.ERROR, (o) => {
1689
+ const { url: t, path: a } = Wr(Q), n = gt(t, { path: a, transports: ["websocket", "polling"] });
1690
+ X = n, p("chat", "External chat socket", { url: t, path: a }), gn(n), n.on(T.ERROR, (o) => {
1691
1691
  const r = o?.message || o?.code || "chat error";
1692
- D("chat", `Chat server error: ${r}`, { code: o?.code }), m.getState().pushToast("error", r);
1692
+ L("chat", `Chat server error: ${r}`, { code: o?.code }), m.getState().pushToast("error", r);
1693
1693
  }), n.on("connect", () => {
1694
- We && n.emit(S.JOIN, We);
1695
- }), n.on("connect_error", (o) => D("chat", "Chat connection error", { message: o?.message }));
1694
+ We && n.emit(T.JOIN, We);
1695
+ }), n.on("connect_error", (o) => L("chat", "Chat connection error", { message: o?.message }));
1696
1696
  }
1697
1697
  }
1698
1698
  function Gr(e) {
1699
- X?.emit(S.CHAT_SEND, e);
1699
+ X?.emit(T.CHAT_SEND, e);
1700
1700
  }
1701
1701
  function dn(e, t) {
1702
1702
  X?.connected && X.emit(e, t);
@@ -1716,10 +1716,10 @@ function na(e, t) {
1716
1716
  // Attachments arrive from other clients, so the key shape is re-checked
1717
1717
  // here at the boundary rather than trusted at render time. A malformed
1718
1718
  // entry is dropped, not rendered and not allowed near an <img src>.
1719
- images: Array.isArray(e.images) ? e.images.filter((a) => !!a && kt(a.key)).slice(0, ae) : void 0,
1719
+ images: Array.isArray(e.images) ? e.images.filter((a) => !!a && vt(a.key)).slice(0, ae) : void 0,
1720
1720
  isSystem: e.isSystem || !1,
1721
1721
  systemType: e.systemType,
1722
- template: e.isSystem && typeof e.template == "string" && e.template.includes(xt) ? e.template : void 0,
1722
+ template: e.isSystem && typeof e.template == "string" && e.template.includes(St) ? e.template : void 0,
1723
1723
  replyTo: typeof e.reply_to == "string" && Na.test(e.reply_to) ? e.reply_to : void 0,
1724
1724
  reactions: mn(e.reactions)
1725
1725
  };
@@ -1733,17 +1733,17 @@ function mn(e) {
1733
1733
  return t.length ? t : void 0;
1734
1734
  }
1735
1735
  function gn(e, t = () => !0) {
1736
- e.on(S.CHAT_BROADCAST, (a) => {
1736
+ e.on(T.CHAT_BROADCAST, (a) => {
1737
1737
  if (!t()) return;
1738
1738
  const n = { ...na(a, a.server_seq), live: !0 };
1739
1739
  m.getState().appendChat(n), p("chat", "Message received", n);
1740
- }), e.on(S.CHAT_HISTORY, (a) => {
1740
+ }), e.on(T.CHAT_HISTORY, (a) => {
1741
1741
  if (!t() || !a?.messages || !Array.isArray(a.messages)) return;
1742
1742
  const n = a.messages.map((o) => na(o));
1743
1743
  m.getState().setChat(n), p("chat", "History loaded", { count: n.length });
1744
- }), e.on(S.CHAT_REACTION, (a) => {
1744
+ }), e.on(T.CHAT_REACTION, (a) => {
1745
1745
  t() && (!a || typeof a.id != "string" || zr(a.id, mn(a.reactions) ?? []));
1746
- }), e.on(S.CHAT_TYPING, (a) => {
1746
+ }), e.on(T.CHAT_TYPING, (a) => {
1747
1747
  t() && (!a || typeof a.client_id != "string" || typeof a.typing != "boolean" || m.getState().setTyping(a.client_id, a.typing));
1748
1748
  });
1749
1749
  }
@@ -1772,7 +1772,7 @@ async function Qr(e) {
1772
1772
  try {
1773
1773
  const t = await fetch(Xr("/api/tierlist"));
1774
1774
  if (!t.ok)
1775
- return D("tierlist", "Board fetch failed", { status: t.status }), null;
1775
+ return L("tierlist", "Board fetch failed", { status: t.status }), null;
1776
1776
  const a = await t.json();
1777
1777
  return m.getState().setTierlistSnapshot(a, e), p("tierlist", "Board loaded", {
1778
1778
  items: a.items.length,
@@ -1780,7 +1780,7 @@ async function Qr(e) {
1780
1780
  placed: a.placed.length
1781
1781
  }), a;
1782
1782
  } catch (t) {
1783
- return D("tierlist", "Board fetch threw", Ee(t)), null;
1783
+ return L("tierlist", "Board fetch threw", Ee(t)), null;
1784
1784
  }
1785
1785
  }
1786
1786
  let oa = !1;
@@ -1799,7 +1799,7 @@ function Zr() {
1799
1799
  function ei() {
1800
1800
  const e = m.getState(), t = va(Object.values(e.roster).map((o) => o.sprite), void 0, Ze);
1801
1801
  if (!t)
1802
- return D("socket", "sprite_taken: no available sprites to retry with"), null;
1802
+ return L("socket", "sprite_taken: no available sprites to retry with"), null;
1803
1803
  const a = !!e.name && !le(e.name), n = a ? e.name : xe(t);
1804
1804
  return p("socket", "sprite_taken: retrying with a free character", { from: e.sprite, to: t, name: n, keptCustomName: a }), e.setSessionIdentity(n, t), { name: n, sprite: t };
1805
1805
  }
@@ -1815,7 +1815,7 @@ function ni(e) {
1815
1815
  async function oi(e = {}) {
1816
1816
  const t = await to({
1817
1817
  ...e,
1818
- onError: (n) => D("avatar", "Avatar settings read failed — keeping the auto-assigned character", Ee(n))
1818
+ onError: (n) => L("avatar", "Avatar settings read failed — keeping the auto-assigned character", Ee(n))
1819
1819
  }), a = et(t) ? t : null;
1820
1820
  return p("avatar", "Requested character from prefs-api", { sprite: a }), a;
1821
1821
  }
@@ -1870,7 +1870,7 @@ function mi() {
1870
1870
  const e = B(ia);
1871
1871
  if (e) return e;
1872
1872
  const t = globalThis.crypto?.randomUUID?.() ?? `d${Math.random().toString(36).slice(2)}`;
1873
- return Ct(ia, t) ? t : "";
1873
+ return Et(ia, t) ? t : "";
1874
1874
  }
1875
1875
  function gi() {
1876
1876
  return ft === null && (ft = Ao(ui, mi(), di())), ft;
@@ -1922,14 +1922,14 @@ function Si(e, t) {
1922
1922
  }
1923
1923
  let C = null, K = null, Ge = null, V = null, ee = null;
1924
1924
  const Ti = Jn(), de = ki();
1925
- let Oe = null, st = null, fa = 0, Pt = null, Te = !1, Mt = !1, he = !1, bn = null;
1925
+ let Oe = null, st = null, fa = 0, Mt = null, Te = !1, Dt = !1, he = !1, bn = null;
1926
1926
  function Ci(e) {
1927
1927
  const t = re(), a = m.getState();
1928
1928
  if (a.me.clientId && a.roster[a.me.clientId])
1929
- return (e.name || e.sprite) && (p("socket", "Identity update (already joined)", { name: e.name, sprite: e.sprite }), t.emit(S.IDENTITY_UPDATE, { name: e.name, sprite: e.sprite })), t;
1929
+ return (e.name || e.sprite) && (p("socket", "Identity update (already joined)", { name: e.name, sprite: e.sprite }), t.emit(T.IDENTITY_UPDATE, { name: e.name, sprite: e.sprite })), t;
1930
1930
  const n = Ei(e);
1931
- return ee = n, Pt = { name: n.name, sprite: n.sprite }, Ie() && Br(n), t.connected ? (p("socket", "Emitting join", n), t.emit(S.JOIN, n)) : t.once("connect", () => {
1932
- p("socket", "Emitting join", n), t.emit(S.JOIN, n);
1931
+ return ee = n, Mt = { name: n.name, sprite: n.sprite }, Ie() && Br(n), t.connected ? (p("socket", "Emitting join", n), t.emit(T.JOIN, n)) : t.once("connect", () => {
1932
+ p("socket", "Emitting join", n), t.emit(T.JOIN, n);
1933
1933
  }), t;
1934
1934
  }
1935
1935
  function Ei(e) {
@@ -1953,18 +1953,18 @@ function re() {
1953
1953
  let t = Ce().serverOrigin || "/";
1954
1954
  if (t === "/" && typeof window < "u") {
1955
1955
  const n = window.location;
1956
- (n.hostname === "localhost" || n.hostname === "127.0.0.1") && n.port === String(Ca) && (t = `${n.protocol}//${n.hostname}:${vt}`, p("socket", "Using dev fallback origin", { origin: t }));
1956
+ (n.hostname === "localhost" || n.hostname === "127.0.0.1") && n.port === String(Ca) && (t = `${n.protocol}//${n.hostname}:${xt}`, p("socket", "Using dev fallback origin", { origin: t }));
1957
1957
  }
1958
1958
  const a = Vr();
1959
1959
  if (a)
1960
- C = mt(a.url, { path: a.path, transports: ["websocket", "polling"] }), p("socket", "Socket initialized on the room origin", a);
1960
+ C = gt(a.url, { path: a.path, transports: ["websocket", "polling"] }), p("socket", "Socket initialized on the room origin", a);
1961
1961
  else {
1962
1962
  const n = new URL(t.startsWith("http") ? t : `${window.location.origin}${t}`).origin;
1963
- C = mt(n, { path: io, transports: ["websocket", "polling"] }), p("socket", "Socket initialized", { origin: t });
1963
+ C = gt(n, { path: io, transports: ["websocket", "polling"] }), p("socket", "Socket initialized", { origin: t });
1964
1964
  }
1965
1965
  ot("__SOCKET__", C), V && (clearTimeout(V), V = null), K = null, Ge = setInterval(() => {
1966
1966
  if (xi(de, Date.now(), !!C?.connected)) {
1967
- D("socket", "PONG-WATCHDOG no time_pong for 20s — replacing the connection", {
1967
+ L("socket", "PONG-WATCHDOG no time_pong for 20s — replacing the connection", {
1968
1968
  sid: C?.id,
1969
1969
  lastPongAgeMs: Si(de, Date.now()) ?? null
1970
1970
  }), st = "pong-watchdog", de.unansweredSince = null, C?.io.engine?.close();
@@ -1972,7 +1972,7 @@ function re() {
1972
1972
  }
1973
1973
  Ui();
1974
1974
  }, So), C.on("connect", () => {
1975
- Mt = !1;
1975
+ Dt = !1;
1976
1976
  const n = C?.id;
1977
1977
  if (p("socket", "Connected", { id: n, isReconnect: he }), n)
1978
1978
  try {
@@ -1996,18 +1996,18 @@ function re() {
1996
1996
  if (p("socket", "Re-emitting join after reconnect", { room_key: r.room_key, name: r.name, sprite: r.sprite }), f) {
1997
1997
  let s = !1;
1998
1998
  const c = () => {
1999
- s || (s = !0, C.off(S.SNAPSHOT, c), C.emit(S.CLIENT_READY, { media_id: f }), p("socket", "Re-emitted client_ready after reconnect snapshot", { mediaId: f }));
1999
+ s || (s = !0, C.off(T.SNAPSHOT, c), C.emit(T.CLIENT_READY, { media_id: f }), p("socket", "Re-emitted client_ready after reconnect snapshot", { mediaId: f }));
2000
2000
  };
2001
- C.on(S.SNAPSHOT, c), setTimeout(() => {
2002
- s || (s = !0, C.off(S.SNAPSHOT, c), D("socket", "client_ready re-emit timed out waiting for snapshot", { mediaId: f }));
2001
+ C.on(T.SNAPSHOT, c), setTimeout(() => {
2002
+ s || (s = !0, C.off(T.SNAPSHOT, c), L("socket", "client_ready re-emit timed out waiting for snapshot", { mediaId: f }));
2003
2003
  }, 1e4);
2004
2004
  }
2005
- Pt = { name: r.name, sprite: r.sprite }, C.emit(S.JOIN, r), window.dispatchEvent(new CustomEvent("watchparty:socket-reconnect"));
2006
- } else he && D("socket", "Reconnected — no join payload, not re-joining any room");
2005
+ Mt = { name: r.name, sprite: r.sprite }, C.emit(T.JOIN, r), window.dispatchEvent(new CustomEvent("watchparty:socket-reconnect"));
2006
+ } else he && L("socket", "Reconnected — no join payload, not re-joining any room");
2007
2007
  he = !0;
2008
2008
  }), C.on("disconnect", (n) => {
2009
2009
  Xa(null), Oe = { reason: st ?? n, at: Date.now() }, st = null, p("socket", "Disconnected", { reason: n });
2010
- }), C.on("connect_error", (n) => ze("socket", "Connection error", { message: n?.message })), C.on("reconnect_attempt", (n) => D("socket", "Reconnect attempt", { attempt: n })), C.on("reconnect_failed", () => ze("socket", "Reconnect failed")), Li(C);
2010
+ }), C.on("connect_error", (n) => ze("socket", "Connection error", { message: n?.message })), C.on("reconnect_attempt", (n) => L("socket", "Reconnect attempt", { attempt: n })), C.on("reconnect_failed", () => ze("socket", "Reconnect failed")), Li(C);
2011
2011
  }
2012
2012
  return C;
2013
2013
  }
@@ -2015,7 +2015,7 @@ function lt(e) {
2015
2015
  return e.play_state === "playing" || e.playing === !0;
2016
2016
  }
2017
2017
  function Ii(e) {
2018
- e.on(S.SNAPSHOT, (t) => {
2018
+ e.on(T.SNAPSHOT, (t) => {
2019
2019
  e.emit(Ma.SYNC), m.getState().applySnapshot({
2020
2020
  roomId: t.room_id ?? null,
2021
2021
  mediaId: t.media_id ?? null,
@@ -2024,7 +2024,7 @@ function Ii(e) {
2024
2024
  serverSeq: t.server_seq || 0,
2025
2025
  leaderId: t.leader_id || null
2026
2026
  }), m.getState().name || p("socket", "Deferring identity to presence event (snapshot carries no roster)");
2027
- const a = m.getState(), n = C?.id, r = (n ? a.roster[n] : void 0) ?? Pt, f = Xn(
2027
+ const a = m.getState(), n = C?.id, r = (n ? a.roster[n] : void 0) ?? Mt, f = Xn(
2028
2028
  { name: a.name, avatarId: a.sprite },
2029
2029
  r ? { name: r.name, avatarId: r.sprite ?? null } : void 0,
2030
2030
  // A join that carried no name counts as a default one, so a name that
@@ -2034,9 +2034,9 @@ function Ii(e) {
2034
2034
  if (f) {
2035
2035
  const s = {
2036
2036
  ...f.name !== void 0 ? { name: f.name } : {},
2037
- ...f.avatarId !== void 0 && !Mt ? { sprite: f.avatarId } : {}
2037
+ ...f.avatarId !== void 0 && !Dt ? { sprite: f.avatarId } : {}
2038
2038
  };
2039
- Object.keys(s).length > 0 && (p("socket", "Identity update on snapshot", s), e.emit(S.IDENTITY_UPDATE, s));
2039
+ Object.keys(s).length > 0 && (p("socket", "Identity update on snapshot", s), e.emit(T.IDENTITY_UPDATE, s));
2040
2040
  }
2041
2041
  p("socket", "Received snapshot", {
2042
2042
  mediaId: t.media_id ?? null,
@@ -2046,7 +2046,7 @@ function Ii(e) {
2046
2046
  serverSeq: t.server_seq || 0,
2047
2047
  rosterSize: Object.keys(a.roster).length
2048
2048
  }), ee?.room_key && C?.id && Xa({ room_key: ee.room_key, client_id: C.id });
2049
- }), e.on(S.CONTROL_BROADCAST, (t) => {
2049
+ }), e.on(T.CONTROL_BROADCAST, (t) => {
2050
2050
  const a = m.getState();
2051
2051
  if (Object.prototype.hasOwnProperty.call(t, "media_id")) {
2052
2052
  const n = t.media_id ?? null;
@@ -2064,14 +2064,14 @@ function Ii(e) {
2064
2064
  playState: t.play_state,
2065
2065
  mediaId: t.media_id
2066
2066
  });
2067
- }), e.on(S.CONTROL_ACK, (t) => {
2067
+ }), e.on(T.CONTROL_ACK, (t) => {
2068
2068
  typeof t?.client_seq == "number" && typeof t?.server_seq == "number" && p("socket", "Control ack received", t);
2069
- }), e.on(S.TIME_PONG, (t) => {
2069
+ }), e.on(T.TIME_PONG, (t) => {
2070
2070
  if (vi(de, Date.now()), K && K.ts) {
2071
2071
  const a = Date.now() - K.ts;
2072
2072
  m.getState().addRttSample(a, t?.server_ts, K.ts), K = null, V && (clearTimeout(V), V = null), p("socket", "Time sync RTT", { rtt: a, offset: m.getState().drift.offsetMs });
2073
2073
  }
2074
- }), e.on(S.READY_STATE, (t) => {
2074
+ }), e.on(T.READY_STATE, (t) => {
2075
2075
  if (!t) return;
2076
2076
  const a = t.media_id ?? null, n = typeof t.ready_count == "number" ? t.ready_count : 0, o = typeof t.total == "number" ? t.total : 0, r = t.ready === !0;
2077
2077
  m.getState().setReadiness({ mediaId: a, ready: r, readyCount: n, total: o }), p("socket", "Ready state received", { mediaId: a, readyCount: n, total: o, ready: r });
@@ -2082,7 +2082,7 @@ function Ai(e) {
2082
2082
  return t ? { cosmetics: t } : {};
2083
2083
  }
2084
2084
  function Ni(e) {
2085
- e.on(S.PRESENCE, (t) => {
2085
+ e.on(T.PRESENCE, (t) => {
2086
2086
  if (!t) return;
2087
2087
  if (Array.isArray(t.users)) {
2088
2088
  const n = {};
@@ -2104,7 +2104,7 @@ function Ni(e) {
2104
2104
  const s = n[r].name, c = n[r].sprite;
2105
2105
  if (o.name && !le(o.name) && (n[r].name = o.name), m.setState({ roster: n }), c && c !== o.sprite) {
2106
2106
  const g = o.name && !le(o.name), u = g ? o.name : xe(c);
2107
- p("socket", "Server reassigned sprite", { from: o.sprite, to: c, newName: u, preservingCustomName: g }), m.getState().setSessionIdentity(u, c), u !== s && e.emit(S.IDENTITY_UPDATE, { name: u });
2107
+ p("socket", "Server reassigned sprite", { from: o.sprite, to: c, newName: u, preservingCustomName: g }), m.getState().setSessionIdentity(u, c), u !== s && e.emit(T.IDENTITY_UPDATE, { name: u });
2108
2108
  }
2109
2109
  }
2110
2110
  }
@@ -2113,7 +2113,7 @@ function Ni(e) {
2113
2113
  if (!a.name) {
2114
2114
  a.ensureAutoIdentity?.();
2115
2115
  const n = m.getState();
2116
- n.name && (p("socket", "Auto-assigned identity on presence", { name: n.name, sprite: n.sprite }), e.emit(S.IDENTITY_UPDATE, { name: n.name, sprite: n.sprite || void 0 }));
2116
+ n.name && (p("socket", "Auto-assigned identity on presence", { name: n.name, sprite: n.sprite }), e.emit(T.IDENTITY_UPDATE, { name: n.name, sprite: n.sprite || void 0 }));
2117
2117
  }
2118
2118
  });
2119
2119
  }
@@ -2156,17 +2156,17 @@ function Mi(e) {
2156
2156
  });
2157
2157
  }
2158
2158
  function Di(e) {
2159
- e.on(S.HEALTH_SNAPSHOT, (t) => {
2159
+ e.on(T.HEALTH_SNAPSHOT, (t) => {
2160
2160
  m.getState().setHealthSnapshot(t);
2161
- }), e.on(S.BUFFER_STATUS, (t) => {
2161
+ }), e.on(T.BUFFER_STATUS, (t) => {
2162
2162
  m.getState().setBufferStatus(t);
2163
2163
  });
2164
2164
  }
2165
2165
  function Li(e) {
2166
- Ii(e), Ni(e), gn(e, () => !Ie()), Di(e), ji(e), Ri(e), Pi(e), Mi(e), e.on(S.ERROR, (t) => {
2166
+ Ii(e), Ni(e), gn(e, () => !Ie()), Di(e), ji(e), Ri(e), Pi(e), Mi(e), e.on(T.ERROR, (t) => {
2167
2167
  const a = t?.code || "error/unknown";
2168
2168
  if (a === "conflict" && t?.message === "sprite_held_by_you") {
2169
- Mt = !0, p("socket", "sprite held by this account's other connection: keeping the server-assigned sprite");
2169
+ Dt = !0, p("socket", "sprite held by this account's other connection: keeping the server-assigned sprite");
2170
2170
  return;
2171
2171
  }
2172
2172
  if (a === "conflict" && t?.message === "sprite_taken") {
@@ -2181,7 +2181,7 @@ function Li(e) {
2181
2181
  } finally {
2182
2182
  Te = !1;
2183
2183
  }
2184
- f && e.emit(S.IDENTITY_UPDATE, f);
2184
+ f && e.emit(T.IDENTITY_UPDATE, f);
2185
2185
  return;
2186
2186
  }
2187
2187
  const o = {
@@ -2205,7 +2205,7 @@ function Li(e) {
2205
2205
  p("socket", `recap unavailable: ${o}`, { code: a }), m.getState().pushToast("info", o);
2206
2206
  return;
2207
2207
  }
2208
- (a.startsWith("auth/") ? D : ze)("socket", `Server error: ${o}`, { code: a, raw: t }), m.getState().pushToast("error", o);
2208
+ (a.startsWith("auth/") ? L : ze)("socket", `Server error: ${o}`, { code: a, raw: t }), m.getState().pushToast("error", o);
2209
2209
  });
2210
2210
  }
2211
2211
  function Oi(e, t, a) {
@@ -2214,18 +2214,18 @@ function Oi(e, t, a) {
2214
2214
  ...t?.length ? { images: t } : {},
2215
2215
  ...a ? { reply_to: a } : {}
2216
2216
  };
2217
- Ie() ? Gr(n) : re().emit(S.CHAT_SEND, n);
2217
+ Ie() ? Gr(n) : re().emit(T.CHAT_SEND, n);
2218
2218
  }
2219
2219
  function qi(e, t, a) {
2220
2220
  const n = { id: e, emoji: t, on: a };
2221
- Ie() ? dn(S.CHAT_REACT, n) : re().emit(S.CHAT_REACT, n);
2221
+ Ie() ? dn(T.CHAT_REACT, n) : re().emit(T.CHAT_REACT, n);
2222
2222
  }
2223
2223
  function Hi(e) {
2224
2224
  const t = { typing: e };
2225
- Ie() ? dn(S.CHAT_TYPING, t) : C?.connected && C.emit(S.CHAT_TYPING, t);
2225
+ Ie() ? dn(T.CHAT_TYPING, t) : C?.connected && C.emit(T.CHAT_TYPING, t);
2226
2226
  }
2227
2227
  function Ui() {
2228
- K || (K = { ts: Date.now() }, re().emit(S.TIME_PING, {}), V = setTimeout(() => {
2228
+ K || (K = { ts: Date.now() }, re().emit(T.TIME_PING, {}), V = setTimeout(() => {
2229
2229
  K && (p("socket", "Time ping timed out after 10s, clearing inflight"), K = null), V = null;
2230
2230
  }, 1e4));
2231
2231
  }
@@ -2242,14 +2242,14 @@ function yn(e) {
2242
2242
  Te = !1;
2243
2243
  }
2244
2244
  const n = m.getState(), o = { avatar: !0 };
2245
- n.sprite && n.sprite !== t.sprite && (o.sprite = n.sprite), n.name && n.name !== t.name && (o.name = n.name), p("socket", "Sending avatar change", o), re().emit(S.IDENTITY_UPDATE, o);
2245
+ n.sprite && n.sprite !== t.sprite && (o.sprite = n.sprite), n.name && n.name !== t.name && (o.name = n.name), p("socket", "Sending avatar change", o), re().emit(T.IDENTITY_UPDATE, o);
2246
2246
  }
2247
2247
  function $i(e) {
2248
2248
  m.getState().me.clientId && Fi(e);
2249
2249
  }
2250
2250
  function Fi(e, t) {
2251
2251
  const a = {};
2252
- e && (a.name = e), !(!a.name && !a.sprite) && (p("socket", "Sending identity update", a), re().emit(S.IDENTITY_UPDATE, a));
2252
+ e && (a.name = e), !(!a.name && !a.sprite) && (p("socket", "Sending identity update", a), re().emit(T.IDENTITY_UPDATE, a));
2253
2253
  }
2254
2254
  let qe = { name: "", sprite: "" };
2255
2255
  m.subscribe((e, t) => {
@@ -2261,7 +2261,7 @@ m.subscribe((e, t) => {
2261
2261
  const o = !!e.name && !le(e.name) && e.name !== qe.name && (le(n.name || "") || n.name !== e.name), r = !!e.sprite && e.sprite !== qe.sprite && n.sprite !== e.sprite;
2262
2262
  if (!o && !r) return;
2263
2263
  const f = {};
2264
- o && (f.name = e.name, qe.name = e.name), r && (f.sprite = e.sprite, qe.sprite = e.sprite), p("socket", "Identity reassert (store change)", f), C?.connected ? C.emit(S.IDENTITY_UPDATE, f) : re().emit(S.IDENTITY_UPDATE, f);
2264
+ o && (f.name = e.name, qe.name = e.name), r && (f.sprite = e.sprite, qe.sprite = e.sprite), p("socket", "Identity reassert (store change)", f), C?.connected ? C.emit(T.IDENTITY_UPDATE, f) : re().emit(T.IDENTITY_UPDATE, f);
2265
2265
  });
2266
2266
  function zi() {
2267
2267
  Ge && (clearInterval(Ge), Ge = null), V && (clearTimeout(V), V = null), K = null, de.unansweredSince = null, de.lastTickAt = null;
@@ -2292,7 +2292,7 @@ function Bi() {
2292
2292
  p("chat", "Emitting recap_request"), re().emit("recap_request");
2293
2293
  }
2294
2294
  function Gi() {
2295
- P(() => {
2295
+ M(() => {
2296
2296
  const e = oo(), t = no((n, o) => {
2297
2297
  const r = ni(o);
2298
2298
  p("avatar", "Avatar changed in the settings popout", { sprite: r, source: o.avatar?.source }), yn(r);
@@ -2308,7 +2308,7 @@ function Ki(e, t) {
2308
2308
  return (t ? Wn(t) : null) ?? Za(e);
2309
2309
  }
2310
2310
  function Ae(e, t) {
2311
- return P(() => {
2311
+ return M(() => {
2312
2312
  t && Fn(t);
2313
2313
  }, [t]), ya(zn, () => Ki(e, t), () => Za(e));
2314
2314
  }
@@ -2334,13 +2334,13 @@ function Yi(e, t, a) {
2334
2334
  } : { name: a.name, sprite: a.sprite, pictureUrl: a.pictureUrl, here: !1 };
2335
2335
  }
2336
2336
  function Ji(e, t, a) {
2337
- return !t || !a.here ? e : t.split(xt).join(a.name);
2337
+ return !t || !a.here ? e : t.split(St).join(a.name);
2338
2338
  }
2339
2339
  function rt(e, t) {
2340
2340
  const a = m((n) => JSON.stringify(Yi(n.roster, e, t)));
2341
2341
  return F(() => JSON.parse(a), [a]);
2342
2342
  }
2343
- function Dt({ sprite: e, url: t, alt: a = "", className: n, style: o, fallback: r }) {
2343
+ function Lt({ sprite: e, url: t, alt: a = "", className: n, style: o, fallback: r }) {
2344
2344
  const [f, s] = N(null);
2345
2345
  if (t && t !== f)
2346
2346
  return /* @__PURE__ */ l(
@@ -2361,7 +2361,7 @@ function Dt({ sprite: e, url: t, alt: a = "", className: n, style: o, fallback:
2361
2361
  function _n({ sprite: e, url: t, alt: a, worn: n }) {
2362
2362
  return /* @__PURE__ */ w("span", { className: "hc-av", style: { "--hc-sz": "32px" }, children: [
2363
2363
  /* @__PURE__ */ l("span", { className: "hc-pic", children: /* @__PURE__ */ l(
2364
- Dt,
2364
+ Lt,
2365
2365
  {
2366
2366
  sprite: e,
2367
2367
  url: t,
@@ -2377,7 +2377,7 @@ function Xi(e) {
2377
2377
  return !(e.button !== 0 || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey);
2378
2378
  }
2379
2379
  function Qi({ src: e, title: t, onClose: a }) {
2380
- P(() => {
2380
+ M(() => {
2381
2381
  const r = (f) => {
2382
2382
  at(f) && (f.stopPropagation(), a());
2383
2383
  };
@@ -2558,14 +2558,14 @@ function sf(e, t = 8) {
2558
2558
  const a = e.toLowerCase();
2559
2559
  if (!a) return [];
2560
2560
  const n = /* @__PURE__ */ new Map();
2561
- for (const s of [...Lt(), ...ff()]) n.has(s) || n.set(s, n.size);
2561
+ for (const s of [...Ot(), ...ff()]) n.has(s) || n.set(s, n.size);
2562
2562
  const o = (s) => n.get(s.char) ?? n.size, r = [];
2563
2563
  let f = 0;
2564
2564
  for (const s of Ne().flatMap((c) => c.emoji)) {
2565
2565
  f += 1;
2566
2566
  let c = null;
2567
2567
  for (const g of s.shortcodes) {
2568
- const u = g === a ? 0 : g.startsWith(a) ? 1 : g.split("_").some((v) => v.startsWith(a)) ? 2 : g.includes(a) ? 3 : -1;
2568
+ const u = g === a ? 0 : g.startsWith(a) ? 1 : g.split("_").some((x) => x.startsWith(a)) ? 2 : g.includes(a) ? 3 : -1;
2569
2569
  u < 0 || (!c || u < c.rank) && (c = { code: g, rank: u });
2570
2570
  }
2571
2571
  c && r.push({ emoji: s, code: c.code, rank: c.rank, order: o(s) * 1e4 + f });
@@ -2577,7 +2577,7 @@ function lf(e, t = 120) {
2577
2577
  if (!a.length) return [];
2578
2578
  const n = Ne().flatMap((c) => c.emoji), o = a.join("_").replace(/^:|:$/g, ""), r = n.filter((c) => {
2579
2579
  const g = c.name.split(/[\s-]+/);
2580
- return a.every((u) => g.some((v) => v.startsWith(u))) || c.shortcodes.some((u) => u.startsWith(o));
2580
+ return a.every((u) => g.some((x) => x.startsWith(u))) || c.shortcodes.some((u) => u.startsWith(o));
2581
2581
  }), f = a.join(" "), s = (c) => {
2582
2582
  if (c.name === f || c.shortcodes.includes(o)) return 0;
2583
2583
  const g = c.name.split(/[\s-]+/);
@@ -2593,13 +2593,13 @@ const cf = [
2593
2593
  [128546],
2594
2594
  [128293]
2595
2595
  ].map((e) => String.fromCodePoint(...e));
2596
- function Lt() {
2596
+ function Ot() {
2597
2597
  return m.getState().recentEmoji;
2598
2598
  }
2599
2599
  function vn(e) {
2600
2600
  m.getState().noteRecentEmoji(e);
2601
2601
  }
2602
- function df(e = 3, t = Lt()) {
2602
+ function df(e = 3, t = Ot()) {
2603
2603
  const a = [];
2604
2604
  for (const n of [...t, ...cf])
2605
2605
  if (a.includes(n) || a.push(n), a.length === e) break;
@@ -2648,33 +2648,33 @@ function pf({
2648
2648
  testId: g,
2649
2649
  children: u
2650
2650
  }) {
2651
- const v = hf(), x = $(null), [I, R] = N(null), _ = M(() => {
2652
- const d = x.current;
2651
+ const x = hf(), S = U(null), [I, R] = N(null), y = D(() => {
2652
+ const d = S.current;
2653
2653
  if (!e || !d) return;
2654
- const y = e.getBoundingClientRect(), h = window.innerWidth, b = window.innerHeight, T = Math.min(a, h - ce * 2), L = Math.min(Math.max(ce, o ? y.right - T : y.left), h - T - ce), O = d.offsetHeight, z = y.top - r - ce, W = b - y.bottom - r - ce, E = n === "top" ? O <= z || z >= W : !(O <= W || W >= z), j = Math.max(120, E ? z : W), A = Math.min(O, j), q = E ? y.top - r - A : y.bottom + r;
2655
- R((H) => H && H.left === L && H.top === q && H.maxHeight === j ? H : { left: L, top: q, maxHeight: j });
2654
+ const b = e.getBoundingClientRect(), h = window.innerWidth, _ = window.innerHeight, k = Math.min(a, h - ce * 2), P = Math.min(Math.max(ce, o ? b.right - k : b.left), h - k - ce), O = d.offsetHeight, z = b.top - r - ce, W = _ - b.bottom - r - ce, E = n === "top" ? O <= z || z >= W : !(O <= W || W >= z), j = Math.max(120, E ? z : W), A = Math.min(O, j), q = E ? b.top - r - A : b.bottom + r;
2655
+ R((H) => H && H.left === P && H.top === q && H.maxHeight === j ? H : { left: P, top: q, maxHeight: j });
2656
2656
  }, [e, a, o, r, n]);
2657
- return $t(() => {
2658
- _();
2659
- const d = x.current, y = typeof ResizeObserver > "u" || !d ? null : new ResizeObserver(() => _());
2660
- return y && d && y.observe(d), window.addEventListener("resize", _), window.addEventListener("scroll", _, !0), () => {
2661
- y?.disconnect(), window.removeEventListener("resize", _), window.removeEventListener("scroll", _, !0);
2657
+ return ut(() => {
2658
+ y();
2659
+ const d = S.current, b = typeof ResizeObserver > "u" || !d ? null : new ResizeObserver(() => y());
2660
+ return b && d && b.observe(d), window.addEventListener("resize", y), window.addEventListener("scroll", y, !0), () => {
2661
+ b?.disconnect(), window.removeEventListener("resize", y), window.removeEventListener("scroll", y, !0);
2662
2662
  };
2663
- }, [_]), $t(() => {
2663
+ }, [y]), ut(() => {
2664
2664
  const d = (h) => {
2665
2665
  at(h) && (h.stopPropagation(), t(), e?.focus({ preventScroll: !0 }));
2666
- }, y = (h) => {
2667
- const b = h.target;
2668
- x.current?.contains(b) || e?.contains(b) || t();
2666
+ }, b = (h) => {
2667
+ const _ = h.target;
2668
+ S.current?.contains(_) || e?.contains(_) || t();
2669
2669
  };
2670
- return document.addEventListener("keydown", d), document.addEventListener("pointerdown", y, !0), () => {
2671
- document.removeEventListener("keydown", d), document.removeEventListener("pointerdown", y, !0);
2670
+ return document.addEventListener("keydown", d), document.addEventListener("pointerdown", b, !0), () => {
2671
+ document.removeEventListener("keydown", d), document.removeEventListener("pointerdown", b, !0);
2672
2672
  };
2673
2673
  }, [t, e]), xa(
2674
2674
  /* @__PURE__ */ l(
2675
2675
  "div",
2676
2676
  {
2677
- ref: x,
2677
+ ref: S,
2678
2678
  role: s,
2679
2679
  "aria-label": c,
2680
2680
  "data-testid": g,
@@ -2695,24 +2695,24 @@ function pf({
2695
2695
  children: u
2696
2696
  }
2697
2697
  ),
2698
- v
2698
+ x
2699
2699
  );
2700
2700
  }
2701
2701
  const bf = 340;
2702
2702
  function yf({ anchor: e, onPick: t, onClose: a }) {
2703
- const [n, o] = N(""), [r, f] = N(null), s = $(null), c = $(null), g = F(() => Ne(), []), u = F(
2704
- () => Lt().map((d) => Qe(d) ?? { char: d, name: "", shortcodes: [] }).slice(0, 16),
2703
+ const [n, o] = N(""), [r, f] = N(null), s = U(null), c = U(null), g = F(() => Ne(), []), u = F(
2704
+ () => Ot().map((d) => Qe(d) ?? { char: d, name: "", shortcodes: [] }).slice(0, 16),
2705
2705
  []
2706
- ), v = F(() => lf(n), [n]), x = n.trim().length > 0;
2707
- P(() => {
2706
+ ), x = F(() => lf(n), [n]), S = n.trim().length > 0;
2707
+ M(() => {
2708
2708
  s.current?.focus({ preventScroll: !0 });
2709
2709
  }, []);
2710
- const I = (d, y) => {
2711
- t(y.char), d.shiftKey || a();
2710
+ const I = (d, b) => {
2711
+ t(b.char), d.shiftKey || a();
2712
2712
  }, R = (d) => {
2713
- const y = c.current, h = y?.querySelector(`[data-emoji-group="${d}"]`);
2714
- y && h && (y.scrollTop = h.offsetTop - y.offsetTop);
2715
- }, _ = (d, y) => /* @__PURE__ */ l(
2713
+ const b = c.current, h = b?.querySelector(`[data-emoji-group="${d}"]`);
2714
+ b && h && (b.scrollTop = h.offsetTop - b.offsetTop);
2715
+ }, y = (d, b) => /* @__PURE__ */ l(
2716
2716
  "button",
2717
2717
  {
2718
2718
  type: "button",
@@ -2724,7 +2724,7 @@ function yf({ anchor: e, onPick: t, onClose: a }) {
2724
2724
  "data-emoji": d.char,
2725
2725
  children: d.char
2726
2726
  },
2727
- y
2727
+ b
2728
2728
  );
2729
2729
  return /* @__PURE__ */ w(pf, { anchor: e, onClose: a, width: bf, className: "emoji-picker", ariaLabel: "Emoji picker", testId: "emoji-picker", children: [
2730
2730
  /* @__PURE__ */ l("div", { className: "emoji-picker-search", children: /* @__PURE__ */ l(
@@ -2739,22 +2739,22 @@ function yf({ anchor: e, onPick: t, onClose: a }) {
2739
2739
  "data-testid": "emoji-search"
2740
2740
  }
2741
2741
  ) }),
2742
- !x && /* @__PURE__ */ w("div", { className: "emoji-picker-tabs", role: "tablist", "aria-label": "Emoji categories", children: [
2742
+ !S && /* @__PURE__ */ w("div", { className: "emoji-picker-tabs", role: "tablist", "aria-label": "Emoji categories", children: [
2743
2743
  u.length > 0 && /* @__PURE__ */ l("button", { type: "button", className: "emoji-tab", onClick: () => R("recent"), title: "Frequently used", "aria-label": "Frequently used", children: u[0].char }),
2744
2744
  g.map((d) => /* @__PURE__ */ l("button", { type: "button", className: "emoji-tab", onClick: () => R(d.id), title: d.label, "aria-label": d.label, children: d.emoji[0].char }, d.id))
2745
2745
  ] }),
2746
- /* @__PURE__ */ l("div", { ref: c, className: "emoji-picker-body", onMouseLeave: () => f(null), children: x ? v.length ? /* @__PURE__ */ l("div", { className: "emoji-grid", children: v.map((d) => _(d, d.char)) }) : /* @__PURE__ */ w("p", { className: "emoji-picker-empty", children: [
2746
+ /* @__PURE__ */ l("div", { ref: c, className: "emoji-picker-body", onMouseLeave: () => f(null), children: S ? x.length ? /* @__PURE__ */ l("div", { className: "emoji-grid", children: x.map((d) => y(d, d.char)) }) : /* @__PURE__ */ w("p", { className: "emoji-picker-empty", children: [
2747
2747
  "No emoji match “",
2748
2748
  n.trim(),
2749
2749
  "”"
2750
2750
  ] }) : /* @__PURE__ */ w(te, { children: [
2751
2751
  u.length > 0 && /* @__PURE__ */ w("section", { "data-emoji-group": "recent", children: [
2752
2752
  /* @__PURE__ */ l("h4", { className: "emoji-section-label", children: "Frequently used" }),
2753
- /* @__PURE__ */ l("div", { className: "emoji-grid", children: u.map((d) => _(d, `r-${d.char}`)) })
2753
+ /* @__PURE__ */ l("div", { className: "emoji-grid", children: u.map((d) => y(d, `r-${d.char}`)) })
2754
2754
  ] }),
2755
2755
  g.map((d) => /* @__PURE__ */ w("section", { "data-emoji-group": d.id, className: "emoji-section", children: [
2756
2756
  /* @__PURE__ */ l("h4", { className: "emoji-section-label", children: d.label }),
2757
- /* @__PURE__ */ l("div", { className: "emoji-grid", children: d.emoji.map((y) => _(y, y.char)) })
2757
+ /* @__PURE__ */ l("div", { className: "emoji-grid", children: d.emoji.map((b) => y(b, b.char)) })
2758
2758
  ] }, d.id))
2759
2759
  ] }) }),
2760
2760
  /* @__PURE__ */ l("div", { className: "emoji-picker-footer", "aria-hidden": "true", children: r ? /* @__PURE__ */ w(te, { children: [
@@ -2803,11 +2803,11 @@ const xf = Ke.memo(function({ message: t }) {
2803
2803
  const a = m((h) => h.me.clientId), n = m((h) => h.me.clientId ? h.roster[h.me.clientId]?.author : void 0), o = tf(t, { clientId: a, author: n }), r = rt(
2804
2804
  { clientId: t.clientId, author: t.author },
2805
2805
  { name: t.name, sprite: t.sprite }
2806
- ), f = Ae(r.sprite, r.pictureUrl), s = t.isSystem ? void 0 : r.cosmetics, c = $(null);
2806
+ ), f = Ae(r.sprite, r.pictureUrl), s = t.isSystem ? void 0 : r.cosmetics, c = U(null);
2807
2807
  Jo(c, !!s);
2808
2808
  const [g] = N(
2809
2809
  () => t.live && t.text ? wa(t.text, s) : null
2810
- ), [u, v] = N(!1), [x, I] = N(null), R = m((h) => h.setReplyingTo), _ = m((h) => h.recentEmoji);
2810
+ ), [u, x] = N(!1), [S, I] = N(null), R = m((h) => h.setReplyingTo), y = m((h) => h.recentEmoji);
2811
2811
  if (t.isSystem && t.systemType === "recap")
2812
2812
  return /* @__PURE__ */ l("div", { className: "px-2 py-1.5", children: /* @__PURE__ */ w("div", { className: "border-l-2 border-border-light pl-2.5 py-0.5", children: [
2813
2813
  /* @__PURE__ */ w("div", { className: "text-[10px] uppercase tracking-wide text-text-muted mb-0.5", children: [
@@ -2821,11 +2821,11 @@ const xf = Ke.memo(function({ message: t }) {
2821
2821
  Ji(t.text, t.template, r),
2822
2822
  /* @__PURE__ */ l("span", { className: "ml-1 text-[10px] opacity-50", children: dt(t.ts) })
2823
2823
  ] });
2824
- const d = { clientId: a, author: n }, y = (h) => {
2825
- const b = t.reactions?.find((O) => O.emoji === h), T = !(b && xn(b, d));
2826
- T && vn(h);
2827
- const L = n ?? a;
2828
- L && Fr(t.id, h, T, L), qi(t.id, h, T);
2824
+ const d = { clientId: a, author: n }, b = (h) => {
2825
+ const _ = t.reactions?.find((O) => O.emoji === h), k = !(_ && xn(_, d));
2826
+ k && vn(h);
2827
+ const P = n ?? a;
2828
+ P && Fr(t.id, h, k, P), qi(t.id, h, k);
2829
2829
  };
2830
2830
  return /* @__PURE__ */ w(
2831
2831
  "div",
@@ -2834,13 +2834,13 @@ const xf = Ke.memo(function({ message: t }) {
2834
2834
  style: Ka(f),
2835
2835
  "data-msg-id": t.id,
2836
2836
  className: `chat-msg px-2 py-1 ${o ? "chat-msg-own" : ""}`,
2837
- onMouseEnter: () => v(!0),
2838
- onMouseLeave: () => v(!1),
2839
- onFocus: () => v(!0),
2837
+ onMouseEnter: () => x(!0),
2838
+ onMouseLeave: () => x(!1),
2839
+ onFocus: () => x(!0),
2840
2840
  onBlur: (h) => {
2841
- h.currentTarget.contains(h.relatedTarget) || v(!1);
2841
+ h.currentTarget.contains(h.relatedTarget) || x(!1);
2842
2842
  },
2843
- "data-active": u || x ? "true" : void 0,
2843
+ "data-active": u || S ? "true" : void 0,
2844
2844
  children: [
2845
2845
  t.replyTo && /* @__PURE__ */ l(Sf, { replyTo: t.replyTo }),
2846
2846
  /* @__PURE__ */ w("div", { className: "flex items-start gap-2", children: [
@@ -2850,27 +2850,27 @@ const xf = Ke.memo(function({ message: t }) {
2850
2850
  /* @__PURE__ */ l("span", { className: "text-[10px] text-text-muted opacity-60 ml-1.5", children: dt(t.ts) }),
2851
2851
  t.text && (g ? /* @__PURE__ */ l(we, { as: "p", html: g, className: "text-[13px] text-text break-words leading-snug m-0" }) : /* @__PURE__ */ l("p", { className: "text-[13px] text-text break-words leading-snug m-0", children: t.text })),
2852
2852
  /* @__PURE__ */ l(wn, { images: t.images }),
2853
- t.reactions && t.reactions.length > 0 && /* @__PURE__ */ l(Tf, { reactions: t.reactions, me: d, onToggle: y, onAdd: I })
2853
+ t.reactions && t.reactions.length > 0 && /* @__PURE__ */ l(Tf, { reactions: t.reactions, me: d, onToggle: b, onAdd: I })
2854
2854
  ] })
2855
2855
  ] }),
2856
- (u || x) && /* @__PURE__ */ w("div", { className: "chat-msg-actions", role: "toolbar", "aria-label": "Message actions", "data-testid": "chat-msg-actions", children: [
2857
- df(3, _).map((h) => /* @__PURE__ */ l("button", { type: "button", className: "chat-action-btn chat-action-emoji", onClick: () => y(h), "aria-label": `React with ${Qe(h)?.name ?? h}`, title: Qe(h)?.name, children: h }, h)),
2856
+ (u || S) && /* @__PURE__ */ w("div", { className: "chat-msg-actions", role: "toolbar", "aria-label": "Message actions", "data-testid": "chat-msg-actions", children: [
2857
+ df(3, y).map((h) => /* @__PURE__ */ l("button", { type: "button", className: "chat-action-btn chat-action-emoji", onClick: () => b(h), "aria-label": `React with ${Qe(h)?.name ?? h}`, title: Qe(h)?.name, children: h }, h)),
2858
2858
  /* @__PURE__ */ l(
2859
2859
  "button",
2860
2860
  {
2861
2861
  type: "button",
2862
2862
  className: "chat-action-btn",
2863
- onClick: (h) => I(x ? null : h.currentTarget),
2863
+ onClick: (h) => I(S ? null : h.currentTarget),
2864
2864
  "aria-label": "Add reaction",
2865
2865
  title: "Add reaction",
2866
- "aria-expanded": !!x,
2866
+ "aria-expanded": !!S,
2867
2867
  children: /* @__PURE__ */ l(Sn, {})
2868
2868
  }
2869
2869
  ),
2870
2870
  /* @__PURE__ */ l("button", { type: "button", className: "chat-action-btn", onClick: () => R(t.id), "aria-label": "Reply", title: "Reply", children: /* @__PURE__ */ l(vf, {}) })
2871
2871
  ] }),
2872
- x && /* @__PURE__ */ l(yf, { anchor: x, onPick: y, onClose: () => {
2873
- I(null), v(!1);
2872
+ S && /* @__PURE__ */ l(yf, { anchor: S, onPick: b, onClose: () => {
2873
+ I(null), x(!1);
2874
2874
  } })
2875
2875
  ]
2876
2876
  }
@@ -2886,7 +2886,7 @@ function Sf({ replyTo: e }) {
2886
2886
  /* @__PURE__ */ l("span", { className: "chat-reply-spine", "aria-hidden": "true" }),
2887
2887
  /* @__PURE__ */ l("span", { className: "chat-reply-text italic", children: "Original message unavailable" })
2888
2888
  ] });
2889
- const r = t.isSystem ? (t.template ?? t.text).split(xt).join(n.name) : t.text || (t.images?.length ? "Image" : "");
2889
+ const r = t.isSystem ? (t.template ?? t.text).split(St).join(n.name) : t.text || (t.images?.length ? "Image" : "");
2890
2890
  return /* @__PURE__ */ w(
2891
2891
  "button",
2892
2892
  {
@@ -2898,7 +2898,7 @@ function Sf({ replyTo: e }) {
2898
2898
  children: [
2899
2899
  /* @__PURE__ */ l("span", { className: "chat-reply-spine", "aria-hidden": "true" }),
2900
2900
  /* @__PURE__ */ l(
2901
- Dt,
2901
+ Lt,
2902
2902
  {
2903
2903
  sprite: n.sprite,
2904
2904
  url: n.pictureUrl,
@@ -2941,18 +2941,18 @@ function Tf({ reactions: e, me: t, onToggle: a, onAdd: n }) {
2941
2941
  }
2942
2942
  function Cf() {
2943
2943
  Ga();
2944
- const e = m((r) => r.chat), t = $(null), a = $(!1), n = M(() => {
2944
+ const e = m((r) => r.chat), t = U(null), a = U(!1), n = D(() => {
2945
2945
  const r = t.current;
2946
2946
  if (!r) return;
2947
2947
  const { scrollHeight: f, scrollTop: s, clientHeight: c } = r, g = f - s - c;
2948
2948
  a.current = g > 40;
2949
2949
  }, []);
2950
- P(() => {
2950
+ M(() => {
2951
2951
  const r = t.current;
2952
2952
  !r || a.current || (typeof r.scrollTo == "function" ? r.scrollTo({ top: r.scrollHeight, behavior: "smooth" }) : r.scrollTop = r.scrollHeight);
2953
2953
  }, [e.length]);
2954
2954
  const o = m((r) => r.chatJump);
2955
- return P(() => {
2955
+ return M(() => {
2956
2956
  const r = t.current;
2957
2957
  if (!o || !r) return;
2958
2958
  const f = r.querySelector(`[data-msg-id="${o.id}"]`);
@@ -2981,7 +2981,7 @@ function Cf() {
2981
2981
  }
2982
2982
  );
2983
2983
  }
2984
- const Ot = [
2984
+ const qt = [
2985
2985
  {
2986
2986
  name: "recap",
2987
2987
  description: "Summarise the previous episode of what is loaded",
@@ -3007,7 +3007,7 @@ function Ef(e) {
3007
3007
  const t = e.slice(ue.length);
3008
3008
  return /\s/.test(t) ? null : t.toLowerCase();
3009
3009
  }
3010
- function If(e, t = Ot) {
3010
+ function If(e, t = qt) {
3011
3011
  const a = e.toLowerCase();
3012
3012
  if (!a) return [...t].sort((o, r) => o.name.localeCompare(r.name));
3013
3013
  const n = [];
@@ -3023,7 +3023,7 @@ function Af(e) {
3023
3023
  function _e(e, t) {
3024
3024
  return t <= 0 ? 0 : (e % t + t) % t;
3025
3025
  }
3026
- function Nf(e, t = Ot) {
3026
+ function Nf(e, t = qt) {
3027
3027
  const a = e.trim();
3028
3028
  if (!a) return null;
3029
3029
  if (!a.startsWith(ue)) return { kind: "chat", text: a };
@@ -3135,24 +3135,27 @@ function qf(e) {
3135
3135
  });
3136
3136
  }
3137
3137
  function Hf(e, t, a) {
3138
- const [n, o] = N(0), [r, f] = N({ q: null, i: 0 }), [s, c] = N(null), g = Lf(e, Math.min(n, e.length)), u = g?.query ?? null, v = F(() => u ? sf(u) : [], [u]), x = g ? `${g.start}:${u}` : null, I = v.length > 0 && s !== x, R = r.q === x ? _e(r.i, v.length) : 0, _ = M((b) => f({ q: x, i: b }), [x]), d = M((b) => o(b.selectionStart ?? b.value.length), []), y = M((b) => {
3138
+ const [n, o] = N(0), [r, f] = N({ q: null, i: 0 }), [s, c] = N(null), g = Lf(e, Math.min(n, e.length)), u = g?.query ?? null, x = F(() => u ? sf(u) : [], [u]), S = g ? `${g.start}:${u}` : null, I = x.length > 0 && s !== S, R = r.q === S ? _e(r.i, x.length) : 0, y = D((k) => f({ q: S, i: k }), [S]), d = U(null);
3139
+ ut(() => {
3140
+ const k = d.current, P = a.current;
3141
+ k === null || !P || (d.current = null, P.setSelectionRange(k, k));
3142
+ }, [e, a]);
3143
+ const b = D((k) => o(k.selectionStart ?? k.value.length), []), h = D((k) => {
3139
3144
  if (!g) return;
3140
- const T = Of(e, g.start, Math.min(n, e.length), b.emoji.char);
3141
- t(T.text), o(T.caret), vn(b.emoji.char);
3142
- const L = a.current;
3143
- L && (L.focus(), requestAnimationFrame(() => L.setSelectionRange(T.caret, T.caret)));
3144
- }, [g, e, n, t, a]), h = M((b) => {
3145
+ const P = Of(e, g.start, Math.min(n, e.length), k.emoji.char);
3146
+ t(P.text), o(P.caret), vn(k.emoji.char), d.current = P.caret, a.current?.focus();
3147
+ }, [g, e, n, t, a]), _ = D((k) => {
3145
3148
  if (!I) return !1;
3146
- if (b.key === "ArrowDown" || b.key === "ArrowUp")
3147
- return b.preventDefault(), _(_e(R + (b.key === "ArrowDown" ? 1 : -1), v.length)), !0;
3148
- if (b.key === "Tab" || b.key === "Enter") {
3149
- b.preventDefault();
3150
- const T = v[R];
3151
- return T && y(T), !0;
3149
+ if (k.key === "ArrowDown" || k.key === "ArrowUp")
3150
+ return k.preventDefault(), y(_e(R + (k.key === "ArrowDown" ? 1 : -1), x.length)), !0;
3151
+ if (k.key === "Tab" || k.key === "Enter") {
3152
+ k.preventDefault();
3153
+ const P = x[R];
3154
+ return P && h(P), !0;
3152
3155
  }
3153
- return b.key === "Escape" ? (b.preventDefault(), c(x), !0) : !1;
3154
- }, [I, v, R, y, _, x]);
3155
- return { open: I, matches: v, activeIndex: R, setActiveIndex: _, pick: y, onKeyDown: h, trackCaret: d };
3156
+ return k.key === "Escape" ? (k.preventDefault(), c(S), !0) : !1;
3157
+ }, [I, x, R, h, y, S]);
3158
+ return { open: I, matches: x, activeIndex: R, setActiveIndex: y, pick: h, onKeyDown: _, trackCaret: b };
3156
3159
  }
3157
3160
  function Uf({
3158
3161
  pending: e,
@@ -3182,83 +3185,83 @@ function Uf({
3182
3185
  ] }, n.id)) }) : null;
3183
3186
  }
3184
3187
  function $f() {
3185
- const [e, t] = N([]), [a, n] = N(!1), o = m((_) => _.pushToast), r = $(/* @__PURE__ */ new Set());
3186
- P(() => () => {
3187
- for (const _ of r.current) URL.revokeObjectURL(_);
3188
+ const [e, t] = N([]), [a, n] = N(!1), o = m((y) => y.pushToast), r = U(/* @__PURE__ */ new Set());
3189
+ M(() => () => {
3190
+ for (const y of r.current) URL.revokeObjectURL(y);
3188
3191
  r.current.clear();
3189
3192
  }, []);
3190
- const f = M((_) => {
3191
- jo(_) && (URL.revokeObjectURL(_.previewUrl), r.current.delete(_.previewUrl));
3192
- }, []), s = M(async (_) => {
3193
- if (!_.length) return;
3193
+ const f = D((y) => {
3194
+ jo(y) && (URL.revokeObjectURL(y.previewUrl), r.current.delete(y.previewUrl));
3195
+ }, []), s = D(async (y) => {
3196
+ if (!y.length) return;
3194
3197
  const d = [];
3195
- for (const y of _) {
3196
- const h = Po(y);
3198
+ for (const b of y) {
3199
+ const h = Po(b);
3197
3200
  if (h) {
3198
3201
  o("error", h);
3199
3202
  continue;
3200
3203
  }
3201
- const { w: b, h: T } = await Lo(y), L = URL.createObjectURL(y);
3202
- r.current.add(L), d.push({
3204
+ const { w: _, h: k } = await Lo(b), P = URL.createObjectURL(b);
3205
+ r.current.add(P), d.push({
3203
3206
  kind: "file",
3204
3207
  id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
3205
- file: y,
3206
- previewUrl: L,
3207
- w: b,
3208
- h: T
3208
+ file: b,
3209
+ previewUrl: P,
3210
+ w: _,
3211
+ h: k
3209
3212
  });
3210
3213
  }
3211
- d.length && t((y) => {
3212
- const h = ae - y.length;
3214
+ d.length && t((b) => {
3215
+ const h = ae - b.length;
3213
3216
  if (h <= 0) {
3214
3217
  o("info", `Up to ${ae} images per message`);
3215
- for (const b of d) f(b);
3216
- return y;
3218
+ for (const _ of d) f(_);
3219
+ return b;
3217
3220
  }
3218
3221
  if (d.length > h) {
3219
3222
  o("info", `Up to ${ae} images per message`);
3220
- for (const b of d.slice(h)) f(b);
3223
+ for (const _ of d.slice(h)) f(_);
3221
3224
  }
3222
- return [...y, ...d.slice(0, h)];
3225
+ return [...b, ...d.slice(0, h)];
3223
3226
  });
3224
- }, [o, f]), c = M((_) => {
3225
- const d = Ve(_.key);
3226
- d && (t((y) => y.length >= ae ? (o("info", `Up to ${ae} images per message`), y) : [...y, {
3227
+ }, [o, f]), c = D((y) => {
3228
+ const d = Ve(y.key);
3229
+ d && (t((b) => b.length >= ae ? (o("info", `Up to ${ae} images per message`), b) : [...b, {
3227
3230
  kind: "remote",
3228
3231
  id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
3229
- key: _.key,
3232
+ key: y.key,
3230
3233
  previewUrl: d,
3231
3234
  // The catalogue spells "unknown" as null; the wire schema spells it
3232
3235
  // as 0, and the renderer falls back to natural flow on that.
3233
- w: _.width ?? 0,
3234
- h: _.height ?? 0,
3235
- title: _.title || void 0
3236
- }]), tt().catalogue($a).recordUse(_.key));
3237
- }, [o]), g = M((_) => {
3236
+ w: y.width ?? 0,
3237
+ h: y.height ?? 0,
3238
+ title: y.title || void 0
3239
+ }]), tt().catalogue($a).recordUse(y.key));
3240
+ }, [o]), g = D((y) => {
3238
3241
  t((d) => {
3239
- const y = d.find((h) => h.id === _);
3240
- return y && f(y), d.filter((h) => h.id !== _);
3242
+ const b = d.find((h) => h.id === y);
3243
+ return b && f(b), d.filter((h) => h.id !== y);
3241
3244
  });
3242
- }, [f]), u = M(() => {
3243
- t((_) => {
3244
- for (const d of _) f(d);
3245
+ }, [f]), u = D(() => {
3246
+ t((y) => {
3247
+ for (const d of y) f(d);
3245
3248
  return [];
3246
3249
  });
3247
- }, [f]), v = M((_) => {
3248
- const d = Mo(_.clipboardData);
3249
- d.length && (_.preventDefault(), s(d));
3250
- }, [s]), x = M((_) => {
3251
- const d = Do(_.dataTransfer);
3252
- d.length && (_.preventDefault(), s(d));
3253
- }, [s]), I = M((_) => {
3254
- _.dataTransfer?.types?.includes("Files") && _.preventDefault();
3255
- }, []), R = M(async () => {
3250
+ }, [f]), x = D((y) => {
3251
+ const d = Mo(y.clipboardData);
3252
+ d.length && (y.preventDefault(), s(d));
3253
+ }, [s]), S = D((y) => {
3254
+ const d = Do(y.dataTransfer);
3255
+ d.length && (y.preventDefault(), s(d));
3256
+ }, [s]), I = D((y) => {
3257
+ y.dataTransfer?.types?.includes("Files") && y.preventDefault();
3258
+ }, []), R = D(async () => {
3256
3259
  if (!e.length) return [];
3257
3260
  n(!0);
3258
3261
  try {
3259
3262
  return await qo(e);
3260
- } catch (_) {
3261
- return D("chat", "Image upload failed", Ho(_)), o("error", Ro(_)), null;
3263
+ } catch (y) {
3264
+ return L("chat", "Image upload failed", Ho(y)), o("error", Ro(y)), null;
3262
3265
  } finally {
3263
3266
  n(!1);
3264
3267
  }
@@ -3271,8 +3274,8 @@ function $f() {
3271
3274
  remove: g,
3272
3275
  clear: u,
3273
3276
  uploadPending: R,
3274
- onPaste: v,
3275
- onDrop: x,
3277
+ onPaste: x,
3278
+ onDrop: S,
3276
3279
  onDragOver: I
3277
3280
  };
3278
3281
  }
@@ -3300,7 +3303,7 @@ class Wf {
3300
3303
  }
3301
3304
  function Bf() {
3302
3305
  const [e] = N(() => new Wf(Hi));
3303
- return P(() => () => e.stop(), [e]), e;
3306
+ return M(() => () => e.stop(), [e]), e;
3304
3307
  }
3305
3308
  function Gf(e) {
3306
3309
  return e.length === 0 ? null : e.length === 1 ? `${e[0]} is typing…` : e.length === 2 ? `${e[0]} and ${e[1]} are typing…` : e.length === 3 ? `${e[0]}, ${e[1]} and ${e[2]} are typing…` : "Several people are typing…";
@@ -3321,7 +3324,7 @@ function Kf({ replyTo: e, onCancel: t }) {
3321
3324
  function Cn(e, t) {
3322
3325
  const a = /* @__PURE__ */ new Map();
3323
3326
  for (const n of Object.values(e)) {
3324
- const o = _t(n), r = a.get(o);
3327
+ const o = wt(n), r = a.get(o);
3325
3328
  if (!r) {
3326
3329
  a.set(o, n);
3327
3330
  continue;
@@ -3331,25 +3334,25 @@ function Cn(e, t) {
3331
3334
  }
3332
3335
  return [...a.values()];
3333
3336
  }
3334
- function _t(e) {
3337
+ function wt(e) {
3335
3338
  return e.author ? `author:${e.author}` : `client:${e.clientId}`;
3336
3339
  }
3337
3340
  function Vf() {
3338
3341
  const e = m((c) => c.typing), t = m((c) => c.roster), a = m((c) => c.me.clientId), n = m((c) => c.setTyping);
3339
- P(() => {
3342
+ M(() => {
3340
3343
  const c = Object.keys(e);
3341
3344
  if (c.length === 0) return;
3342
- const g = Math.min(...c.map((v) => e[v])), u = setTimeout(() => {
3343
- const v = Date.now();
3344
- for (const x of c) e[x] <= v && n(x, !1);
3345
+ const g = Math.min(...c.map((x) => e[x])), u = setTimeout(() => {
3346
+ const x = Date.now();
3347
+ for (const S of c) e[S] <= x && n(S, !1);
3345
3348
  }, Math.max(0, g - Date.now()) + 50);
3346
3349
  return () => clearTimeout(u);
3347
3350
  }, [e, n]);
3348
- const o = a && t[a] ? _t(t[a]) : null, r = /* @__PURE__ */ new Map();
3351
+ const o = a && t[a] ? wt(t[a]) : null, r = /* @__PURE__ */ new Map();
3349
3352
  for (const c of Object.keys(e)) {
3350
3353
  const g = t[c];
3351
3354
  if (!g || c === a) continue;
3352
- const u = _t(g);
3355
+ const u = wt(g);
3353
3356
  u !== o && !r.has(u) && r.set(u, g.name || "Someone");
3354
3357
  }
3355
3358
  const f = [...r.values()].sort((c, g) => c.localeCompare(g)), s = Gf(f);
@@ -3363,24 +3366,24 @@ function Vf() {
3363
3366
  ] }) });
3364
3367
  }
3365
3368
  const da = Ea, Yf = fo;
3366
- function Jf({ commands: e = Ot }) {
3367
- const [t, a] = N(""), [n, o] = N(!1), [r, f] = N({ q: null, i: 0 }), [s, c] = N(!1), g = $(null), u = Ft(), v = Ft(), [x, I] = N(!1), [R, _] = N(!1), d = Hf(t, a, g), y = $f(), h = Bf(), b = m((k) => k.replyingTo), T = m((k) => k.setReplyingTo);
3368
- P(() => {
3369
- b && !document.hidden && g.current?.focus({ preventScroll: !0 });
3370
- }, [b]);
3371
- const L = m((k) => k.snapshot.mediaId), O = m((k) => k.pushToast), z = m((k) => k.setTierlistOpen), W = !!L, E = Ef(t), j = F(
3369
+ function Jf({ commands: e = qt }) {
3370
+ const [t, a] = N(""), [n, o] = N(!1), [r, f] = N({ q: null, i: 0 }), [s, c] = N(!1), g = U(null), u = Ft(), x = Ft(), [S, I] = N(!1), [R, y] = N(!1), d = Hf(t, a, g), b = $f(), h = Bf(), _ = m((v) => v.replyingTo), k = m((v) => v.setReplyingTo);
3371
+ M(() => {
3372
+ _ && !document.hidden && g.current?.focus({ preventScroll: !0 });
3373
+ }, [_]);
3374
+ const P = m((v) => v.snapshot.mediaId), O = m((v) => v.pushToast), z = m((v) => v.setTierlistOpen), W = !!P, E = Ef(t), j = F(
3372
3375
  () => E === null ? [] : If(E, e),
3373
3376
  [E, e]
3374
- ), A = E !== null && !s && j.length > 0, q = r.q === E ? _e(r.i, j.length) : 0, H = M(
3375
- (k) => f({ q: E, i: k }),
3377
+ ), A = E !== null && !s && j.length > 0, q = r.q === E ? _e(r.i, j.length) : 0, H = D(
3378
+ (v) => f({ q: E, i: v }),
3376
3379
  [E]
3377
- ), ie = M((k, U) => {
3378
- const me = jf(k, { hasMedia: W });
3380
+ ), ie = D((v, $) => {
3381
+ const me = jf(v, { hasMedia: W });
3379
3382
  if (me) {
3380
3383
  O("info", me);
3381
3384
  return;
3382
3385
  }
3383
- switch (k.name) {
3386
+ switch (v.name) {
3384
3387
  case "help":
3385
3388
  O("info", e.map((Nn) => Nn.usage).join(" "));
3386
3389
  break;
@@ -3391,71 +3394,71 @@ function Jf({ commands: e = Ot }) {
3391
3394
  Zr(), z(!0);
3392
3395
  break;
3393
3396
  default:
3394
- O("info", `${k.usage} is not implemented yet.`);
3397
+ O("info", `${v.usage} is not implemented yet.`);
3395
3398
  }
3396
- }, [W, O, e, z]), Y = M((k) => {
3397
- a(Af(k)), c(!1), g.current?.focus();
3398
- }, []), In = M(async (k) => {
3399
- if (k.preventDefault(), n || y.uploading) return;
3400
- const U = Nf(t, e);
3401
- if (!U && !y.pending.length) return;
3402
- if (U?.kind === "command" && y.pending.length) {
3399
+ }, [W, O, e, z]), Y = D((v) => {
3400
+ a(Af(v)), c(!1), g.current?.focus();
3401
+ }, []), In = D(async (v) => {
3402
+ if (v.preventDefault(), n || b.uploading) return;
3403
+ const $ = Nf(t, e);
3404
+ if (!$ && !b.pending.length) return;
3405
+ if ($?.kind === "command" && b.pending.length) {
3403
3406
  O("info", "Send images on their own, not with a command.");
3404
3407
  return;
3405
3408
  }
3406
- if (U?.kind === "command") {
3407
- ie(U.command, U.args), a(""), h.stop(), !document.hidden && document.hasFocus() && g.current?.focus();
3409
+ if ($?.kind === "command") {
3410
+ ie($.command, $.args), a(""), h.stop(), !document.hidden && document.hasFocus() && g.current?.focus();
3408
3411
  return;
3409
3412
  }
3410
- const me = await y.uploadPending();
3411
- me !== null && (Oi(qf(U?.text ?? ""), me, b), a(""), h.stop(), T(null), y.clear(), o(!0), setTimeout(() => o(!1), Yf), !document.hidden && document.hasFocus() && g.current?.focus());
3412
- }, [t, n, ie, y, O, e, b, T, h]), An = M((k) => {
3413
- if (!(!A && d.onKeyDown(k))) {
3414
- if (k.key === "Escape" && A) {
3415
- k.preventDefault(), c(!0);
3413
+ const me = await b.uploadPending();
3414
+ me !== null && (Oi(qf($?.text ?? ""), me, _), a(""), h.stop(), k(null), b.clear(), o(!0), setTimeout(() => o(!1), Yf), !document.hidden && document.hasFocus() && g.current?.focus());
3415
+ }, [t, n, ie, b, O, e, _, k, h]), An = D((v) => {
3416
+ if (!(!A && d.onKeyDown(v))) {
3417
+ if (v.key === "Escape" && A) {
3418
+ v.preventDefault(), c(!0);
3416
3419
  return;
3417
3420
  }
3418
- if (k.key === "Escape" && b) {
3419
- k.preventDefault(), T(null);
3421
+ if (v.key === "Escape" && _) {
3422
+ v.preventDefault(), k(null);
3420
3423
  return;
3421
3424
  }
3422
3425
  if (A) {
3423
- if (k.key === "ArrowDown")
3424
- k.preventDefault(), H(_e(q + 1, j.length));
3425
- else if (k.key === "ArrowUp")
3426
- k.preventDefault(), H(_e(q - 1, j.length));
3427
- else if (k.key === "Tab") {
3428
- k.preventDefault();
3429
- const U = j[q];
3430
- U && Y(U);
3431
- } else if (k.key === "Enter") {
3432
- k.preventDefault();
3433
- const U = j[q];
3434
- U && Y(U);
3426
+ if (v.key === "ArrowDown")
3427
+ v.preventDefault(), H(_e(q + 1, j.length));
3428
+ else if (v.key === "ArrowUp")
3429
+ v.preventDefault(), H(_e(q - 1, j.length));
3430
+ else if (v.key === "Tab") {
3431
+ v.preventDefault();
3432
+ const $ = j[q];
3433
+ $ && Y($);
3434
+ } else if (v.key === "Enter") {
3435
+ v.preventDefault();
3436
+ const $ = j[q];
3437
+ $ && Y($);
3435
3438
  }
3436
3439
  }
3437
3440
  }
3438
- }, [A, j, q, Y, H, b, T, d]);
3439
- P(() => {
3440
- const k = () => {
3441
+ }, [A, j, q, Y, H, _, k, d]);
3442
+ M(() => {
3443
+ const v = () => {
3441
3444
  document.hidden || !document.hasFocus() || (g.current?.focus(), g.current?.scrollIntoView({ block: "nearest" }));
3442
3445
  };
3443
- return window.addEventListener("watchparty:focus-chat-input", k), () => window.removeEventListener("watchparty:focus-chat-input", k);
3446
+ return window.addEventListener("watchparty:focus-chat-input", v), () => window.removeEventListener("watchparty:focus-chat-input", v);
3444
3447
  }, []);
3445
- const je = da - t.length, qt = je <= 100, Ht = A ? j[q] : void 0, Re = !A && d.open, Ut = Re ? d.matches[d.activeIndex] : void 0;
3448
+ const je = da - t.length, Ht = je <= 100, Ut = A ? j[q] : void 0, Re = !A && d.open, $t = Re ? d.matches[d.activeIndex] : void 0;
3446
3449
  return /* @__PURE__ */ w(
3447
3450
  "form",
3448
3451
  {
3449
- onSubmit: (k) => {
3450
- In(k);
3452
+ onSubmit: (v) => {
3453
+ In(v);
3451
3454
  },
3452
- onPaste: y.onPaste,
3453
- onDrop: y.onDrop,
3454
- onDragOver: y.onDragOver,
3455
+ onPaste: b.onPaste,
3456
+ onDrop: b.onDrop,
3457
+ onDragOver: b.onDragOver,
3455
3458
  className: "p-2 border-t border-border",
3456
3459
  children: [
3457
- b && /* @__PURE__ */ l(Kf, { replyTo: b, onCancel: () => T(null) }),
3458
- /* @__PURE__ */ l(Uf, { pending: y.pending, uploading: y.uploading, onRemove: y.remove }),
3460
+ _ && /* @__PURE__ */ l(Kf, { replyTo: _, onCancel: () => k(null) }),
3461
+ /* @__PURE__ */ l(Uf, { pending: b.pending, uploading: b.uploading, onRemove: b.remove }),
3459
3462
  /* @__PURE__ */ w("div", { className: "relative", children: [
3460
3463
  A && /* @__PURE__ */ l(
3461
3464
  Rf,
@@ -3475,17 +3478,17 @@ function Jf({ commands: e = Ot }) {
3475
3478
  activeIndex: d.activeIndex,
3476
3479
  onPick: d.pick,
3477
3480
  onHover: d.setActiveIndex,
3478
- listboxId: v
3481
+ listboxId: x
3479
3482
  }
3480
3483
  ),
3481
3484
  /* @__PURE__ */ l(
3482
3485
  Go,
3483
3486
  {
3484
- open: x,
3487
+ open: S,
3485
3488
  onClose: () => I(!1),
3486
- onPick: y.addMeme,
3489
+ onPick: b.addMeme,
3487
3490
  onUnavailable: () => {
3488
- _(!0), I(!1);
3491
+ y(!0), I(!1);
3489
3492
  }
3490
3493
  }
3491
3494
  ),
@@ -3497,33 +3500,33 @@ function Jf({ commands: e = Ot }) {
3497
3500
  ref: g,
3498
3501
  type: "text",
3499
3502
  value: t,
3500
- onChange: (k) => {
3501
- a(k.target.value), d.trackCaret(k.target), c(!1), k.target.value.startsWith("/") ? h.stop() : h.input(k.target.value);
3503
+ onChange: (v) => {
3504
+ a(v.target.value), d.trackCaret(v.target), c(!1), v.target.value.startsWith("/") ? h.stop() : h.input(v.target.value);
3502
3505
  },
3503
3506
  onKeyDown: An,
3504
- onSelect: (k) => d.trackCaret(k.currentTarget),
3507
+ onSelect: (v) => d.trackCaret(v.currentTarget),
3505
3508
  maxLength: da,
3506
3509
  placeholder: "Send a message",
3507
3510
  role: "combobox",
3508
3511
  "aria-expanded": A || Re,
3509
- "aria-controls": A ? u : Re ? v : void 0,
3510
- "aria-activedescendant": Ht ? `${u}-opt-${Ht.name}` : Ut ? Tn(v, Ut) : void 0,
3512
+ "aria-controls": A ? u : Re ? x : void 0,
3513
+ "aria-activedescendant": Ut ? `${u}-opt-${Ut.name}` : $t ? Tn(x, $t) : void 0,
3511
3514
  "aria-autocomplete": "list",
3512
- 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 ${qt ? "pr-12" : ""}`
3515
+ 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 ${Ht ? "pr-12" : ""}`
3513
3516
  }
3514
3517
  ),
3515
- /* @__PURE__ */ l("span", { className: `absolute right-2 top-1/2 -translate-y-1/2 text-[10px] ${je <= 50 ? je <= 0 ? "bg-danger-bg text-on-danger-bg px-1 rounded" : "bg-primary-bg text-on-primary-bg px-1 rounded" : "text-text-muted"}`, children: qt && je })
3518
+ /* @__PURE__ */ l("span", { className: `absolute right-2 top-1/2 -translate-y-1/2 text-[10px] ${je <= 50 ? je <= 0 ? "bg-danger-bg text-on-danger-bg px-1 rounded" : "bg-primary-bg text-on-primary-bg px-1 rounded" : "text-text-muted"}`, children: Ht && je })
3516
3519
  ] }),
3517
3520
  !R && /* @__PURE__ */ l(
3518
3521
  "button",
3519
3522
  {
3520
3523
  type: "button",
3521
- onClick: () => I((k) => !k),
3524
+ onClick: () => I((v) => !v),
3522
3525
  "aria-label": "Add a meme",
3523
- "aria-expanded": x,
3526
+ "aria-expanded": S,
3524
3527
  title: "Add a meme",
3525
3528
  "data-testid": "meme-button",
3526
- className: `shrink-0 rounded border border-border-light px-2 py-1.5 text-sm hover:border-primary ${x ? "text-text border-primary" : "text-text-secondary"}`,
3529
+ className: `shrink-0 rounded border border-border-light px-2 py-1.5 text-sm hover:border-primary ${S ? "text-text border-primary" : "text-text-secondary"}`,
3527
3530
  children: /* @__PURE__ */ l(jn, { name: "image" })
3528
3531
  }
3529
3532
  )
@@ -3542,7 +3545,7 @@ function Qf({ u: e }) {
3542
3545
  const t = Ae(e.sprite, e.avatarUrl);
3543
3546
  return /* @__PURE__ */ w("div", { className: "flex items-center gap-2 py-0.5", children: [
3544
3547
  /* @__PURE__ */ l(
3545
- Dt,
3548
+ Lt,
3546
3549
  {
3547
3550
  sprite: e.sprite,
3548
3551
  url: e.avatarUrl,
@@ -3556,8 +3559,8 @@ function Qf({ u: e }) {
3556
3559
  ] });
3557
3560
  }
3558
3561
  function Zf() {
3559
- const e = m((r) => Cn(r.roster).length), [t, a] = N(!1), n = $(null), o = $(null);
3560
- return P(() => {
3562
+ const e = m((r) => Cn(r.roster).length), [t, a] = N(!1), n = U(null), o = U(null);
3563
+ return M(() => {
3561
3564
  if (!t) return;
3562
3565
  function r(s) {
3563
3566
  n.current && !n.current.contains(s.target) && a(!1);
@@ -3597,7 +3600,7 @@ function Zf() {
3597
3600
  }
3598
3601
  function ua({ className: e = "fixed bottom-4 left-1/2 -translate-x-1/2" }) {
3599
3602
  const t = m((n) => n.toasts), a = m((n) => n.popToast);
3600
- return P(() => {
3603
+ return M(() => {
3601
3604
  const n = t.map((o) => setTimeout(() => a(o.id), 4e3));
3602
3605
  return () => {
3603
3606
  n.forEach(clearTimeout);
@@ -3642,7 +3645,7 @@ function ts({ message: e, age: t, ccStyle: a }) {
3642
3645
  function as({ shown: e, className: t }) {
3643
3646
  Ga();
3644
3647
  const a = m((c) => c.chat), n = m((c) => c.mediaPrefs.subtitleStyle), [o, r] = N(() => Date.now()), f = a.length > 0;
3645
- P(() => {
3648
+ M(() => {
3646
3649
  const c = setInterval(() => {
3647
3650
  f && r(Date.now());
3648
3651
  }, 200);
@@ -3701,24 +3704,24 @@ function xs({
3701
3704
  theme: c,
3702
3705
  name: g,
3703
3706
  onLeave: u,
3704
- onLayoutChange: v,
3705
- collapsible: x = !0,
3707
+ onLayoutChange: x,
3708
+ collapsible: S = !0,
3706
3709
  debug: I,
3707
3710
  children: R
3708
3711
  }) {
3709
- const [_, d] = N(null), { setFrame: y, ...h } = ss(v, x), b = m((A) => A.floatingChatEnabled), T = _a(() => g), L = F(() => (wr({ userType: f, userId: s ?? null }), Nt().theme), [f, s]), O = Pn(), z = O?.theme, W = F(
3710
- () => ns(c, z, L),
3711
- [c, z, L]
3712
+ const [y, d] = N(null), { setFrame: b, ...h } = ss(x, S), _ = m((A) => A.floatingChatEnabled), k = _a(() => g), P = F(() => (wr({ userType: f, userId: s ?? null }), jt().theme), [f, s]), O = Pn(), z = O?.theme, W = F(
3713
+ () => ns(c, z, P),
3714
+ [c, z, P]
3712
3715
  );
3713
- P(() => {
3716
+ M(() => {
3714
3717
  }, [c, O !== null]);
3715
3718
  const j = F(
3716
- () => ({ ...Tt, serverOrigin: t, defaultRoomKey: e }),
3719
+ () => ({ ...Ct, serverOrigin: t, defaultRoomKey: e }),
3717
3720
  [t, e]
3718
3721
  );
3719
- return P(() => {
3722
+ return M(() => {
3720
3723
  I && Zo();
3721
- }, [I]), Gi(), P(() => {
3724
+ }, [I]), Gi(), M(() => {
3722
3725
  Ko({ serverOrigin: t, defaultRoomKey: e }), Kr(a ? { origin: a, path: n } : null), aa(o && !a ? { origin: o, path: r } : null), m.getState().rehydrateFromPrefs(), pi();
3723
3726
  let A = !1;
3724
3727
  const q = xr();
@@ -3736,17 +3739,17 @@ function xs({
3736
3739
  new Promise((Y) => setTimeout(Y, fs))
3737
3740
  ]);
3738
3741
  } catch (Y) {
3739
- D("room-chrome", "pre-join wait threw, proceeding anyway", Ee(Y));
3742
+ L("room-chrome", "pre-join wait threw, proceeding anyway", Ee(Y));
3740
3743
  }
3741
3744
  if (A) return;
3742
- const H = rs(T());
3745
+ const H = rs(k());
3743
3746
  m.getState().ensureAutoIdentity(), is(H);
3744
3747
  const ie = m.getState();
3745
3748
  p("room-chrome", "Joining room", { roomKey: e, name: ie.name, sprite: ie.sprite }), Ci({ room_key: e, name: ie.name || void 0, sprite: ie.sprite || void 0 });
3746
3749
  })(), () => {
3747
3750
  A = !0, sa(), aa(null);
3748
3751
  };
3749
- }, [e, t, a, n, o, r, f, s]), /* @__PURE__ */ l(Vo.Provider, { value: j, children: /* @__PURE__ */ l(Ba.Provider, { value: !1, children: /* @__PURE__ */ l(za.Provider, { value: _, children: /* @__PURE__ */ w("div", { ref: y, className: "wp-room-chrome-frame", children: [
3752
+ }, [e, t, a, n, o, r, f, s]), /* @__PURE__ */ l(Vo.Provider, { value: j, children: /* @__PURE__ */ l(Ba.Provider, { value: !1, children: /* @__PURE__ */ l(za.Provider, { value: y, children: /* @__PURE__ */ w("div", { ref: b, className: "wp-room-chrome-frame", children: [
3750
3753
  /* @__PURE__ */ l("div", { className: "wp-room-chrome-frame__content", children: R }),
3751
3754
  /* @__PURE__ */ l(
3752
3755
  "aside",
@@ -3770,7 +3773,7 @@ function xs({
3770
3773
  }
3771
3774
  ),
3772
3775
  /* @__PURE__ */ l(ua, { className: "absolute bottom-2 right-full mr-2 w-72" }),
3773
- /* @__PURE__ */ l(as, { shown: b, className: "wp-room-chrome__floating" })
3776
+ /* @__PURE__ */ l(as, { shown: _, className: "wp-room-chrome__floating" })
3774
3777
  ] }) : /* @__PURE__ */ w(te, { children: [
3775
3778
  /* @__PURE__ */ l(
3776
3779
  "div",
@@ -3779,7 +3782,7 @@ function xs({
3779
3782
  "aria-orientation": "vertical",
3780
3783
  "aria-label": "Resize chat",
3781
3784
  "aria-valuemin": Xe,
3782
- "aria-valuemax": jt,
3785
+ "aria-valuemax": Rt,
3783
3786
  "aria-valuenow": h.state.width,
3784
3787
  tabIndex: 0,
3785
3788
  className: "wp-room-chrome__resize",
@@ -3806,7 +3809,7 @@ function xs({
3806
3809
  children: "Leave"
3807
3810
  }
3808
3811
  ),
3809
- x && /* @__PURE__ */ l(
3812
+ S && /* @__PURE__ */ l(
3810
3813
  "button",
3811
3814
  {
3812
3815
  onClick: h.toggleCollapsed,
@@ -3827,13 +3830,13 @@ function xs({
3827
3830
  ] }) }) }) });
3828
3831
  }
3829
3832
  function ss(e, t) {
3830
- const a = m((b) => b.chromeChatCollapsed) && t, n = m((b) => b.chromeChatWidth), o = m((b) => b.toggleChromeChatCollapsed), r = m((b) => b.setChromeChatWidth), [f, s] = N(null), [c, g] = N(void 0), [u, v] = N(null);
3831
- P(() => {
3833
+ const a = m((_) => _.chromeChatCollapsed) && t, n = m((_) => _.chromeChatWidth), o = m((_) => _.toggleChromeChatCollapsed), r = m((_) => _.setChromeChatWidth), [f, s] = N(null), [c, g] = N(void 0), [u, x] = N(null);
3834
+ M(() => {
3832
3835
  if (f)
3833
3836
  return os(f, g);
3834
3837
  }, [f]);
3835
- const x = Z(u?.current ?? n, c), I = F(() => Or(a, x), [a, x]), R = _a((b) => e?.(b));
3836
- return P(() => {
3838
+ const S = Z(u?.current ?? n, c), I = F(() => Or(a, S), [a, S]), R = _a((_) => e?.(_));
3839
+ return M(() => {
3837
3840
  R(I);
3838
3841
  }, [I]), {
3839
3842
  setFrame: s,
@@ -3841,20 +3844,20 @@ function ss(e, t) {
3841
3844
  state: I,
3842
3845
  dragging: u !== null,
3843
3846
  toggleCollapsed: o,
3844
- onPointerDown: (b) => {
3845
- b.button === 0 && (b.preventDefault(), b.currentTarget.setPointerCapture(b.pointerId), v({ pointerId: b.pointerId, startX: b.clientX, startWidth: x, current: x }));
3847
+ onPointerDown: (_) => {
3848
+ _.button === 0 && (_.preventDefault(), _.currentTarget.setPointerCapture(_.pointerId), x({ pointerId: _.pointerId, startX: _.clientX, startWidth: S, current: S }));
3846
3849
  },
3847
- onPointerMove: (b) => {
3848
- !u || u.pointerId !== b.pointerId || v({ ...u, current: ta(u.startWidth, u.startX, b.clientX, c) });
3850
+ onPointerMove: (_) => {
3851
+ !u || u.pointerId !== _.pointerId || x({ ...u, current: ta(u.startWidth, u.startX, _.clientX, c) });
3849
3852
  },
3850
- onPointerEnd: (b) => {
3851
- if (!u || u.pointerId !== b.pointerId) return;
3852
- const T = ta(u.startWidth, u.startX, b.clientX, c);
3853
- v(null), T !== n && r(T);
3853
+ onPointerEnd: (_) => {
3854
+ if (!u || u.pointerId !== _.pointerId) return;
3855
+ const k = ta(u.startWidth, u.startX, _.clientX, c);
3856
+ x(null), k !== n && r(k);
3854
3857
  },
3855
- onKeyDown: (b) => {
3856
- const T = Lr(x, b.key, c);
3857
- T !== null && (b.preventDefault(), T !== n && r(T));
3858
+ onKeyDown: (_) => {
3859
+ const k = Lr(S, _.key, c);
3860
+ k !== null && (_.preventDefault(), k !== n && r(k));
3858
3861
  }
3859
3862
  };
3860
3863
  }