@hadoku/watchparty-ui 0.45.123 → 0.45.125

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,25 +1,28 @@
1
- import { jsx as l, jsxs as w, Fragment as te } from "react/jsx-runtime";
2
- import Ke, { useState as N, useRef as U, useMemo as F, useCallback as D, useEffect as M, createContext as xt, useContext as ya, useSyncExternalStore as _a, useLayoutEffect as ut, useId as zt, useEffectEvent as wa } from "react";
3
- import { themePrefs as pe, Icon as Pn, THEMES as Mn, useHadokuThemeOptional as Dn } from "@wolffm/themes";
4
- import { createCdnClient as Ln, kindOfType as On, MAX_BYTES as qn, measureImage as Hn, filesFromClipboard as Un, filesFromDrop as $n, CdnError as mt } from "@wolffm/cdn-client";
5
- import { ensureCosmeticsStyles as Fn, cleanWorn as zn, readPictureColour as Wn, onPictureColour as Bn, pictureColour as Gn, decorHtml as Kn, messageHtml as va, nameHtml as ka, finishReveal as Vn } from "@wolffm/prefs-client/cosmetics";
6
- import { createPrefsClient as Yn, getDeviceId as Jn, DEVICE_ID_KEY as Xn } from "@wolffm/prefs-client";
7
- import { create as Qn } from "zustand";
8
- import { avatarPortraitPath as Zn, AVATAR_COLORS as eo, pickAvatar as xa, applyReaction as to, createTabIdentity as ao, resolveIdentityReassert as no } from "@wolffm/rooms-protocol";
1
+ import { jsx as s, jsxs as w, Fragment as X } from "react/jsx-runtime";
2
+ import Ye, { useState as A, useRef as U, useMemo as z, useCallback as D, useEffect as R, createContext as Ct, useContext as va, useSyncExternalStore as ka, useLayoutEffect as ht, useId as Gt, useEffectEvent as xa } from "react";
3
+ import { themePrefs as be, Icon as Ln, useHadokuThemeOptional as Sa, THEMES as On } from "@wolffm/themes";
4
+ import { createCdnClient as Hn, kindOfType as qn, MAX_BYTES as Un, measureImage as $n, filesFromClipboard as Fn, filesFromDrop as zn, CdnError as pt } from "@wolffm/cdn-client";
5
+ import { ensureCosmeticsStyles as Wn, cleanWorn as Bn, readPictureColour as Gn, onPictureColour as Kn, pictureColour as Vn, decorHtml as Yn, messageHtml as Ta, nameHtml as Ca, finishReveal as Jn } from "@wolffm/prefs-client/cosmetics";
6
+ import { createPrefsClient as Xn, getDeviceId as Qn, DEVICE_ID_KEY as Zn } from "@wolffm/prefs-client";
7
+ import { create as eo } from "zustand";
8
+ import { avatarPortraitPath as to, AVATAR_COLORS as ao, pickAvatar as Ea, applyReaction as no, createTabIdentity as oo, resolveIdentityReassert as ro } from "@wolffm/rooms-protocol";
9
9
  import { z as i } from "zod";
10
- import { io as gt } from "socket.io-client";
11
- import { fetchCharacter as oo, characterOf as ro, onAvatarChange as io } from "@wolffm/prefs-client/avatar";
12
- import { relayIdentityChanges as fo } from "@wolffm/task-ui-components/identity-relay";
13
- import { createPortal as Sa } from "react-dom";
14
- import { useCatalogueSearch as so } from "@wolffm/cdn-client/react";
15
- const Ta = "https://cdn.hadoku.me", Ca = /^[0-9a-f]{64}\.(?:png|jpe?g|gif|webp|avif)$/;
16
- function St(e) {
17
- return typeof e == "string" && Ca.test(e);
18
- }
19
- const Ea = 8080, lo = 5173, co = "/watchparty/ws", Ia = 500, uo = 1e3, ae = 4, Aa = typeof process < "u" && process.env ? process.env : {};
20
- Aa.PRODUCTION_UI_URL;
21
- Aa.PRODUCTION_SERVER_URL;
22
- const He = i.enum(["S", "A", "B", "C", "D", "F"]), Wt = 2e4, mo = 300;
10
+ import { io as bt } from "socket.io-client";
11
+ import { fetchCharacter as io, characterOf as fo, onAvatarChange as so } from "@wolffm/prefs-client/avatar";
12
+ import { relayIdentityChanges as lo } from "@wolffm/task-ui-components/identity-relay";
13
+ import { createPortal as Ia } from "react-dom";
14
+ import { useCatalogueSearch as co } from "@wolffm/cdn-client/react";
15
+ import { HadokuThemePicker as uo, ConnectedSettings as mo } from "@wolffm/task-ui-components";
16
+ import "@wolffm/task-ui-components/theme-picker.css";
17
+ import "@wolffm/task-ui-components/app-header.css";
18
+ const Aa = "https://cdn.hadoku.me", Na = /^[0-9a-f]{64}\.(?:png|jpe?g|gif|webp|avif)$/;
19
+ function Et(e) {
20
+ return typeof e == "string" && Na.test(e);
21
+ }
22
+ const ja = 8080, go = 5173, ho = "/watchparty/ws", Ra = 500, po = 1e3, te = 4, Pa = typeof process < "u" && process.env ? process.env : {};
23
+ Pa.PRODUCTION_UI_URL;
24
+ Pa.PRODUCTION_SERVER_URL;
25
+ const $e = i.enum(["S", "A", "B", "C", "D", "F"]), Kt = 2e4, bo = 300;
23
26
  i.object({
24
27
  name: i.string().min(1).max(32).optional(),
25
28
  sprite: i.string().min(1).max(32).optional(),
@@ -52,7 +55,7 @@ const T = {
52
55
  // 'ready_state' here = playback-readiness gate (distinct from READY_EVENTS.STATE = "ready check" UX feature)
53
56
  READY_STATE: "ready_state",
54
57
  ERROR: "error"
55
- }, go = i.enum(["play", "pause", "seek", "load", "home"]), ho = i.object({
58
+ }, yo = i.enum(["play", "pause", "seek", "load", "home"]), _o = i.object({
56
59
  framed: i.boolean(),
57
60
  depth: i.number().int().nonnegative().max(10)
58
61
  });
@@ -60,7 +63,7 @@ i.object({
60
63
  room_key: i.string(),
61
64
  name: i.string().min(1).max(32).optional(),
62
65
  sprite: i.string().min(1).max(32).optional(),
63
- embed: ho.optional(),
66
+ embed: _o.optional(),
64
67
  /** Which media-delivery path this client resolved to ('range' | 'fragment').
65
68
  * Optional so older clients still validate. Reported so a party's logs can be split by
66
69
  * arm — without it an A/B rollout is unmeasurable, exactly as entry path was before
@@ -108,13 +111,13 @@ i.object({
108
111
  });
109
112
  i.object({
110
113
  client_seq: i.number().int().positive(),
111
- kind: go,
114
+ kind: yo,
112
115
  to_ms: i.number().int().nonnegative().optional(),
113
116
  media_id: i.string().optional()
114
117
  // leader_id removed - not needed since set_leader control was removed
115
118
  });
116
- const Na = i.object({
117
- key: i.string().regex(Ca, "not a CDN image key"),
119
+ const Ma = i.object({
120
+ key: i.string().regex(Na, "not a CDN image key"),
118
121
  /**
119
122
  * Intrinsic pixels, or **0 meaning "unknown"**.
120
123
  *
@@ -127,8 +130,8 @@ const Na = i.object({
127
130
  * text went with it, with nothing said. Widening is backward compatible —
128
131
  * every message already in history carries positive dimensions.
129
132
  */
130
- w: i.number().int().nonnegative().max(Wt),
131
- h: i.number().int().nonnegative().max(Wt),
133
+ w: i.number().int().nonnegative().max(Kt),
134
+ h: i.number().int().nonnegative().max(Kt),
132
135
  /**
133
136
  * Human-readable description, rendered as the `alt` text.
134
137
  *
@@ -142,16 +145,16 @@ const Na = i.object({
142
145
  * value only, never as markup. Bounded so one message cannot carry a
143
146
  * paragraph; the library's own titles run well under this.
144
147
  */
145
- title: i.string().max(mo).optional()
146
- }), ja = /^[A-Za-z0-9_.:-]{1,64}$/;
148
+ title: i.string().max(bo).optional()
149
+ }), Da = /^[A-Za-z0-9_.:-]{1,64}$/;
147
150
  i.object({
148
- text: i.string().max(Ia),
151
+ text: i.string().max(Ra),
149
152
  style: i.string().max(64).optional(),
150
- images: i.array(Na).max(ae).optional(),
153
+ images: i.array(Ma).max(te).optional(),
151
154
  /** The message this one replies to. Optional: older clients never send it. */
152
- reply_to: i.string().regex(ja).optional()
155
+ reply_to: i.string().regex(Da).optional()
153
156
  }).refine((e) => e.text.length > 0 || (e.images?.length ?? 0) > 0, { message: "message must carry text or at least one image" });
154
- const po = i.enum(["join", "leave", "media_change", "identity_change", "recap"]);
157
+ const wo = i.enum(["join", "leave", "media_change", "identity_change", "recap"]);
155
158
  i.object({
156
159
  id: i.string(),
157
160
  client_id: i.string(),
@@ -164,7 +167,7 @@ i.object({
164
167
  ts: i.number(),
165
168
  // Optional so a client on an older bundle still validates a message that
166
169
  // has none, and so system messages (which never carry images) stay unchanged.
167
- images: i.array(Na).max(ae).optional(),
170
+ images: i.array(Ma).max(te).optional(),
168
171
  /** The id of the message this one answers (resolved by the client from
169
172
  * what it holds; the original may have rolled out of history). */
170
173
  reply_to: i.string().optional(),
@@ -172,14 +175,14 @@ i.object({
172
175
  * ids `author` carries). Absent when there are none. */
173
176
  reactions: i.array(i.object({ emoji: i.string(), by: i.array(i.string()) })).optional(),
174
177
  isSystem: i.boolean().optional(),
175
- systemType: po.optional(),
178
+ systemType: wo.optional(),
176
179
  /** A system line about a person: its text with `CHAT_NAME_TOKEN` where their
177
180
  * name goes. `text` is that template filled when sent; a client fills it
178
181
  * again with the person's CURRENT name (found by `author`) while they are
179
182
  * here, so a rename reaches lines already on screen. */
180
183
  template: i.string().optional()
181
184
  });
182
- const Tt = "{name}", bo = i.object({
185
+ const It = "{name}", vo = i.object({
183
186
  avg_download_rate_bps: i.number().nonnegative(),
184
187
  buffered_ahead_ms: i.number().nonnegative(),
185
188
  rtt_ms: i.number().nonnegative(),
@@ -221,7 +224,7 @@ const Tt = "{name}", bo = i.object({
221
224
  * socket shows here as a growing number while everything else looks fine. */
222
225
  pong_age_ms: i.number().int().nonnegative().optional(),
223
226
  reported_at: i.number().int().nonnegative()
224
- }), yo = bo.extend({
227
+ }), ko = vo.extend({
225
228
  client_id: i.string(),
226
229
  name: i.string(),
227
230
  sprite_id: i.string().nullable(),
@@ -232,10 +235,10 @@ const Tt = "{name}", bo = i.object({
232
235
  stale_ms: i.number().int().nonnegative().optional()
233
236
  });
234
237
  i.object({
235
- clients: i.array(yo),
238
+ clients: i.array(ko),
236
239
  server_ts: i.number().int().nonnegative()
237
240
  });
238
- const _o = i.object({
241
+ const xo = i.object({
239
242
  client_id: i.string(),
240
243
  sprite_id: i.string().nullable(),
241
244
  name: i.string(),
@@ -253,13 +256,13 @@ const _o = i.object({
253
256
  video_ready_state: i.number().int().default(-1)
254
257
  });
255
258
  i.object({
256
- clients: i.array(_o),
259
+ clients: i.array(xo),
257
260
  server_ts: i.number().int().nonnegative()
258
261
  });
259
262
  i.object({
260
263
  media_id: i.string()
261
264
  });
262
- const Ct = i.enum(["super_upvote", "upvote", "mid", "downvote"]), wo = i.object({
265
+ const At = i.enum(["super_upvote", "upvote", "mid", "downvote"]), So = i.object({
263
266
  mediaId: i.string(),
264
267
  displayName: i.string(),
265
268
  // Enrichment fields — present for flat-playlist ingest output, absent for
@@ -270,11 +273,11 @@ const Ct = i.enum(["super_upvote", "upvote", "mid", "downvote"]), wo = i.object(
270
273
  durationMs: i.number().optional(),
271
274
  uploadDate: i.string().optional()
272
275
  // YouTube upload date 'YYYY-MM-DD'; drives playlist order
273
- }), vo = i.enum(["basic", "vote"]), Ra = i.object({
276
+ }), To = i.enum(["basic", "vote"]), La = i.object({
274
277
  id: i.string(),
275
278
  name: i.string(),
276
- type: vo.default("vote"),
277
- videos: i.array(wo),
279
+ type: To.default("vote"),
280
+ videos: i.array(So),
278
281
  cover: i.string().optional()
279
282
  // media-relative path to the playlist cover image
280
283
  });
@@ -283,28 +286,28 @@ i.object({ index: i.number().int().min(0) });
283
286
  i.object({
284
287
  playlistId: i.string(),
285
288
  mediaId: i.string(),
286
- vote: Ct
289
+ vote: At
287
290
  });
288
291
  i.object({ voterKey: i.string().min(1).max(128) });
289
292
  i.object({ playlistId: i.string(), mediaIds: i.array(i.string()) });
290
293
  i.object({
291
- playlist: Ra.nullable(),
294
+ playlist: La.nullable(),
292
295
  activeIndex: i.number().int().nullable(),
293
- myVotes: i.record(i.string(), Ct)
296
+ myVotes: i.record(i.string(), At)
294
297
  // mediaId -> VoteValue
295
298
  });
296
- const ko = i.object({
299
+ const Co = i.object({
297
300
  clientId: i.string(),
298
301
  name: i.string(),
299
302
  votedCount: i.number().int().nonnegative(),
300
303
  totalVideos: i.number().int().nonnegative()
301
304
  });
302
305
  i.object({
303
- progress: i.array(ko)
306
+ progress: i.array(Co)
304
307
  });
305
308
  i.object({
306
- playlist: Ra,
307
- votes: i.record(i.string(), i.record(i.string(), Ct)),
309
+ playlist: La,
310
+ votes: i.record(i.string(), i.record(i.string(), At)),
308
311
  // votes[clientId][mediaId]
309
312
  names: i.record(i.string(), i.string()),
310
313
  // clientId -> display name
@@ -323,37 +326,37 @@ i.object({
323
326
  * reveal is closed ignores it, rather than having the popup reappear. */
324
327
  update: i.boolean().optional()
325
328
  });
326
- const Pe = {
329
+ const De = {
327
330
  STATE: "playlist_state",
328
331
  VOTE_PROGRESS: "playlist_vote_progress",
329
332
  RESULTS: "playlist_results",
330
333
  /** Server -> the removed voter: forget the ballot you hold in localStorage. */
331
334
  VOTES_CLEARED: "playlist_votes_cleared"
332
- }, Pa = i.object({
335
+ }, Oa = i.object({
333
336
  id: i.string(),
334
337
  displayName: i.string(),
335
338
  thumbnail: i.string().optional()
336
339
  });
337
340
  i.object({
338
- items: i.array(Pa)
341
+ items: i.array(Oa)
339
342
  });
340
- const Ma = i.partialRecord(He, i.array(i.string()));
341
- i.object({ board: Ma });
342
- const xo = i.object({
343
+ const Ha = i.partialRecord($e, i.array(i.string()));
344
+ i.object({ board: Ha });
345
+ const Eo = i.object({
343
346
  mediaId: i.string(),
344
- tier: He,
345
- absoluteTier: He,
347
+ tier: $e,
348
+ absoluteTier: $e,
346
349
  /** Tier level + within-row position. Integer part is the tier. */
347
350
  score: i.number(),
348
351
  /** The consensus mean that decided the tier. Never the displayed number. */
349
352
  placementScore: i.number(),
350
353
  subRankOffset: i.number(),
351
- votes: i.record(i.string(), He)
354
+ votes: i.record(i.string(), $e)
352
355
  // opaque voterId -> the letter they gave
353
356
  });
354
357
  i.object({
355
- items: i.array(Pa),
356
- placed: i.array(xo),
358
+ items: i.array(Oa),
359
+ placed: i.array(Eo),
357
360
  unrated: i.array(i.string()),
358
361
  spread: i.number(),
359
362
  nudged: i.boolean(),
@@ -363,9 +366,9 @@ i.object({
363
366
  * browser on a newer bundle still reads an older server's board. */
364
367
  pictures: i.record(i.string(), i.string()).optional(),
365
368
  voterCount: i.number().int().nonnegative(),
366
- myBoard: Ma
369
+ myBoard: Ha
367
370
  });
368
- const So = {
371
+ const Io = {
369
372
  /** Broadcast to EVERY connected socket when anyone saves. Carries no board —
370
373
  * it is a "re-fetch" ping, because the shared result is identical for all
371
374
  * viewers but `myBoard` is not, and one payload cannot serve both. */
@@ -378,10 +381,10 @@ i.object({
378
381
  ready: i.array(i.string())
379
382
  // clientIds who have flagged ready
380
383
  });
381
- const To = {
384
+ const Ao = {
382
385
  STATE: "ready_check_state"
383
386
  // distinct from buffer-readiness 'ready_state'
384
- }, Da = {
387
+ }, qa = {
385
388
  ACTIVE: "game_active",
386
389
  // server -> room (the open game id; null = none)
387
390
  SYNC: "game_sync"
@@ -393,7 +396,7 @@ i.object({
393
396
  i.object({
394
397
  gameId: i.string().nullable()
395
398
  });
396
- const Co = [
399
+ const No = [
397
400
  {
398
401
  id: "fantasy",
399
402
  characters: [
@@ -437,55 +440,55 @@ const Co = [
437
440
  { id: "mentor" }
438
441
  ]
439
442
  }
440
- ], Eo = Co.flatMap((e) => e.characters), Ze = Eo.map((e) => e.id);
441
- function et(e) {
442
- return !!e && Ze.includes(e);
443
+ ], jo = No.flatMap((e) => e.characters), tt = jo.map((e) => e.id);
444
+ function at(e) {
445
+ return !!e && tt.includes(e);
443
446
  }
444
- const Io = 5e3, La = { mode: "off", percent: 0 }, Ao = ["off", "on", "ab"];
445
- function No(e) {
446
- return typeof e == "string" && Ao.includes(e);
447
+ const Ro = 5e3, Ua = { mode: "off", percent: 0 }, Po = ["off", "on", "ab"];
448
+ function Mo(e) {
449
+ return typeof e == "string" && Po.includes(e);
447
450
  }
448
- function jo(e) {
449
- const t = e && typeof e == "object" ? e : {}, a = No(t.mode) ? t.mode : La.mode, n = Number(t.percent), o = Number.isFinite(n) ? Math.min(100, Math.max(0, Math.round(n))) : 0;
451
+ function Do(e) {
452
+ const t = e && typeof e == "object" ? e : {}, a = Mo(t.mode) ? t.mode : Ua.mode, n = Number(t.percent), o = Number.isFinite(n) ? Math.min(100, Math.max(0, Math.round(n))) : 0;
450
453
  return { mode: a, percent: o };
451
454
  }
452
- function Ro(e) {
455
+ function Lo(e) {
453
456
  let t = 2166136261;
454
457
  for (let a = 0; a < e.length; a++)
455
458
  t ^= e.charCodeAt(a), t = Math.imul(t, 16777619) >>> 0;
456
459
  return t >>> 0;
457
460
  }
458
- function Po(e, t, a) {
461
+ function Oo(e, t, a) {
459
462
  if (a === !0)
460
463
  return "fragment";
461
464
  if (a === !1)
462
465
  return "range";
463
- const n = jo(e);
464
- return n.mode === "on" ? "fragment" : n.mode === "off" || n.percent <= 0 ? "range" : n.percent >= 100 || t && Ro(t) % 100 < n.percent ? "fragment" : "range";
466
+ const n = Do(e);
467
+ return n.mode === "on" ? "fragment" : n.mode === "off" || n.percent <= 0 ? "range" : n.percent >= 100 || t && Lo(t) % 100 < n.percent ? "fragment" : "range";
465
468
  }
466
- let Me = null, Oa = Ta;
467
- function Mo(e) {
468
- e.cdnBase && (Oa = e.cdnBase);
469
+ let Le = null, $a = Aa;
470
+ function Ho(e) {
471
+ e.cdnBase && ($a = e.cdnBase);
469
472
  }
470
- function qa() {
471
- return Oa.replace(/\/+$/, "");
473
+ function Fa() {
474
+ return $a.replace(/\/+$/, "");
472
475
  }
473
- function tt() {
474
- const e = qa();
475
- return (!Me || Me.base !== e) && (Me = { base: e, client: Ln({ cdnBase: e }) }), Me.client;
476
+ function nt() {
477
+ const e = Fa();
478
+ return (!Le || Le.base !== e) && (Le = { base: e, client: Hn({ cdnBase: e }) }), Le.client;
476
479
  }
477
- function Ve(e) {
478
- return !St(e) || !qa() ? null : tt().urlFor(e);
480
+ function Je(e) {
481
+ return !Et(e) || !Fa() ? null : nt().urlFor(e);
479
482
  }
480
- function Do(e) {
483
+ function qo(e) {
481
484
  return e.kind === "file";
482
485
  }
483
- class Ha extends Error {
486
+ class za extends Error {
484
487
  constructor(t) {
485
488
  super(t), this.name = "ChatImageUploadError";
486
489
  }
487
490
  }
488
- function Ue(e) {
491
+ function Fe(e) {
489
492
  switch (e) {
490
493
  case "unauthenticated":
491
494
  return "Sign in to paste images";
@@ -505,120 +508,120 @@ function Ue(e) {
505
508
  return "Image upload failed";
506
509
  }
507
510
  }
508
- function Lo(e) {
509
- return e instanceof mt ? Ue(e.reason) : e instanceof Ha ? e.message : "Image upload failed";
511
+ function Uo(e) {
512
+ return e instanceof pt ? Fe(e.reason) : e instanceof za ? e.message : "Image upload failed";
510
513
  }
511
- function Oo(e) {
514
+ function $o(e) {
512
515
  const t = e.type.toLowerCase().split(";")[0].trim();
513
- return t && On(t) !== "image" ? Ue("unsupported-type") : e.size > qn.image ? Ue("too-large") : e.size === 0 ? Ue("invalid") : null;
516
+ return t && qn(t) !== "image" ? Fe("unsupported-type") : e.size > Un.image ? Fe("too-large") : e.size === 0 ? Fe("invalid") : null;
514
517
  }
515
- function qo(e) {
516
- return Un(e);
518
+ function Fo(e) {
519
+ return Fn(e);
517
520
  }
518
- function Ho(e) {
519
- return $n(e);
521
+ function zo(e) {
522
+ return zn(e);
520
523
  }
521
- async function Uo(e) {
522
- const t = await Hn(e);
524
+ async function Wo(e) {
525
+ const t = await $n(e);
523
526
  return { w: t?.width ?? 0, h: t?.height ?? 0 };
524
527
  }
525
- async function $o(e, t = {}) {
526
- const a = await tt().upload(e, { signal: t.signal });
527
- if (!St(a.key))
528
- throw new Ha("Image upload returned an unusable key");
528
+ async function Bo(e, t = {}) {
529
+ const a = await nt().upload(e, { signal: t.signal });
530
+ if (!Et(a.key))
531
+ throw new za("Image upload returned an unusable key");
529
532
  return { key: a.key, deduplicated: a.deduplicated === !0 };
530
533
  }
531
- async function Fo(e, t = {}) {
534
+ async function Go(e, t = {}) {
532
535
  const a = [];
533
536
  for (const n of e) {
534
537
  if (n.kind === "remote") {
535
538
  a.push({ key: n.key, w: n.w, h: n.h, ...n.title ? { title: n.title } : {} });
536
539
  continue;
537
540
  }
538
- const { key: o } = await $o(n.file, t);
541
+ const { key: o } = await Bo(n.file, t);
539
542
  a.push({ key: o, w: n.w, h: n.h });
540
543
  }
541
544
  return a;
542
545
  }
543
- function zo(e) {
546
+ function Ko(e) {
544
547
  return {
545
548
  error: e instanceof Error ? e.message : String(e),
546
549
  name: e instanceof Error ? e.name : typeof e,
547
- reason: e instanceof mt ? e.reason : void 0,
548
- status: e instanceof mt ? e.status : void 0
550
+ reason: e instanceof pt ? e.reason : void 0,
551
+ status: e instanceof pt ? e.status : void 0
549
552
  };
550
553
  }
551
- function at(e) {
554
+ function ot(e) {
552
555
  return e.key === "Escape" || e.key === "GoBack" || e.key === "BrowserBack" || e.key === "XF86Back" || e.keyCode === 461 || e.keyCode === 10009;
553
556
  }
554
- function Wo(e) {
557
+ function Vo(e) {
555
558
  return `/tv?return=${encodeURIComponent(e.pathname + e.search)}`;
556
559
  }
557
- function Bo({ className: e }) {
558
- return /* @__PURE__ */ l(
560
+ function Yo({ className: e }) {
561
+ return /* @__PURE__ */ s(
559
562
  "a",
560
563
  {
561
- href: Wo(window.location),
564
+ href: Vo(window.location),
562
565
  className: e,
563
566
  "data-testid": "sign-in-with-code",
564
567
  children: "Sign in with a code"
565
568
  }
566
569
  );
567
570
  }
568
- const ht = 240, fe = 8, Go = 28, Ua = 240;
569
- function Ko(e, t, a) {
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
- const o = Ua + Go;
571
+ const yt = 240, ie = 8, Jo = 28, Wa = 240;
572
+ function Xo(e, t, a) {
573
+ let n = t.left - yt - ie;
574
+ n < ie && (n = t.right + ie), n = Math.min(n, a.width - yt - ie), n = Math.max(ie, n);
575
+ const o = Wa + Jo;
573
576
  let r = e.top + e.height / 2 - o / 2;
574
- return r = Math.min(r, a.height - o - fe), r = Math.max(fe, r), { left: n, top: r };
577
+ return r = Math.min(r, a.height - o - ie), r = Math.max(ie, r), { left: n, top: r };
575
578
  }
576
- const $a = "/dataplatform/api/memes", Vo = 120;
577
- function Yo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
578
- const [o, r] = N(""), f = U(null), s = U(null), c = tt(), { items: u, loading: m, error: x, hasMore: S, loadMore: I } = so(
579
+ const Ba = "/dataplatform/api/memes", Qo = 120;
580
+ function Zo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
581
+ const [o, r] = A(""), f = U(null), l = U(null), c = nt(), { items: u, loading: m, error: x, hasMore: S, loadMore: C } = co(
579
582
  c,
580
- $a,
583
+ Ba,
581
584
  o.trim()
582
- ), R = x?.reason ?? null, y = F(() => {
585
+ ), N = x?.reason ?? null, _ = z(() => {
583
586
  const E = /* @__PURE__ */ new Set();
584
587
  return u.filter((j) => E.has(j.key) ? !1 : (E.add(j.key), !0));
585
- }, [u]), [d, b] = N(null), h = U(null), _ = D(() => {
586
- h.current !== null && (window.clearTimeout(h.current), h.current = null);
588
+ }, [u]), [d, y] = A(null), b = U(null), p = D(() => {
589
+ b.current !== null && (window.clearTimeout(b.current), b.current = null);
587
590
  }, []), v = D(() => {
588
- _(), b(null);
589
- }, [_]), P = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(hover: hover)").matches, O = D(
590
- (E, j, A = !1) => {
591
- const q = f.current;
592
- if (!q) return;
593
- const H = () => b({
591
+ p(), y(null);
592
+ }, [p]), P = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(hover: hover)").matches, q = D(
593
+ (E, j, M = !1) => {
594
+ const H = f.current;
595
+ if (!H) return;
596
+ const O = () => y({
594
597
  item: E,
595
- ...Ko(j.getBoundingClientRect(), q.getBoundingClientRect(), {
598
+ ...Xo(j.getBoundingClientRect(), H.getBoundingClientRect(), {
596
599
  width: window.innerWidth,
597
600
  height: window.innerHeight
598
601
  })
599
602
  });
600
- _(), A ? H() : h.current = window.setTimeout(H, Vo);
603
+ p(), M ? O() : b.current = window.setTimeout(O, Qo);
601
604
  },
602
- [_]
605
+ [p]
603
606
  );
604
- M(() => () => _(), [_]), M(() => {
605
- R === "unavailable" && a?.();
606
- }, [R, a]), M(() => {
607
- s.current?.focus();
608
- }, []), M(() => {
609
- const E = (A) => {
610
- at(A) && (A.stopPropagation(), e());
611
- }, j = (A) => {
612
- const q = A.target;
613
- f.current && !f.current.contains(q) && !n?.contains(q) && e();
607
+ R(() => () => p(), [p]), R(() => {
608
+ N === "unavailable" && a?.();
609
+ }, [N, a]), R(() => {
610
+ l.current?.focus();
611
+ }, []), R(() => {
612
+ const E = (M) => {
613
+ ot(M) && (M.stopPropagation(), e());
614
+ }, j = (M) => {
615
+ const H = M.target;
616
+ f.current && !f.current.contains(H) && !n?.contains(H) && e();
614
617
  };
615
618
  return document.addEventListener("keydown", E), document.addEventListener("mousedown", j), () => {
616
619
  document.removeEventListener("keydown", E), document.removeEventListener("mousedown", j);
617
620
  };
618
621
  }, [e, n]);
619
- const z = D((E) => {
622
+ const W = D((E) => {
620
623
  t(E), e();
621
- }, [t, e]), W = !m && !x && y.length === 0;
624
+ }, [t, e]), $ = !m && !x && _.length === 0;
622
625
  return /* @__PURE__ */ w(
623
626
  "div",
624
627
  {
@@ -628,10 +631,10 @@ function Yo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
628
631
  "data-testid": "meme-picker",
629
632
  className: "absolute bottom-full left-0 right-0 mb-2 z-30 flex max-h-80 flex-col rounded border border-border bg-bg-card shadow-lg",
630
633
  children: [
631
- /* @__PURE__ */ l("div", { className: "border-b border-border-light p-2", children: /* @__PURE__ */ l(
634
+ /* @__PURE__ */ s("div", { className: "border-b border-border-light p-2", children: /* @__PURE__ */ s(
632
635
  "input",
633
636
  {
634
- ref: s,
637
+ ref: l,
635
638
  type: "text",
636
639
  value: o,
637
640
  onChange: (E) => r(E.target.value),
@@ -648,36 +651,36 @@ function Yo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
648
651
  onScroll: v,
649
652
  onMouseLeave: v,
650
653
  children: [
651
- x && /* @__PURE__ */ l(
654
+ x && /* @__PURE__ */ s(
652
655
  "p",
653
656
  {
654
657
  className: "m-2 p-2 text-center text-sm bg-danger-bg text-on-danger-bg rounded",
655
658
  role: "alert",
656
- "data-reason": R,
657
- children: R === "unauthenticated" ? /* @__PURE__ */ w(te, { children: [
659
+ "data-reason": N,
660
+ children: N === "unauthenticated" ? /* @__PURE__ */ w(X, { children: [
658
661
  "Sign in to browse memes · ",
659
- /* @__PURE__ */ l(Bo, { className: "underline text-on-danger-bg" })
660
- ] }) : R === "forbidden" ? "Your account can't browse the meme library" : "Meme library is unavailable"
662
+ /* @__PURE__ */ s(Yo, { className: "underline text-on-danger-bg" })
663
+ ] }) : N === "forbidden" ? "Your account can't browse the meme library" : "Meme library is unavailable"
661
664
  }
662
665
  ),
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
- y.length > 0 && /* @__PURE__ */ l("div", { className: "grid grid-cols-3 gap-1.5 sm:grid-cols-4", children: y.map((E) => {
665
- const j = Ve(E.key);
666
- return j ? /* @__PURE__ */ l(
666
+ $ && /* @__PURE__ */ s("p", { className: "p-4 text-center text-sm text-text-secondary", children: o.trim() ? `No memes match "${o.trim()}"` : "The meme library is empty" }),
667
+ _.length > 0 && /* @__PURE__ */ s("div", { className: "grid grid-cols-3 gap-1.5 sm:grid-cols-4", children: _.map((E) => {
668
+ const j = Je(E.key);
669
+ return j ? /* @__PURE__ */ s(
667
670
  "button",
668
671
  {
669
672
  type: "button",
670
- onClick: () => z(E),
673
+ onClick: () => W(E),
671
674
  title: E.title,
672
675
  "data-testid": "meme-result",
673
- onMouseEnter: (A) => {
674
- P && O(E, A.currentTarget);
676
+ onMouseEnter: (M) => {
677
+ P && q(E, M.currentTarget);
675
678
  },
676
679
  onMouseLeave: v,
677
- onFocus: (A) => O(E, A.currentTarget, !0),
680
+ onFocus: (M) => q(E, M.currentTarget, !0),
678
681
  onBlur: v,
679
682
  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
- children: /* @__PURE__ */ l(
683
+ children: /* @__PURE__ */ s(
681
684
  "img",
682
685
  {
683
686
  src: j,
@@ -691,12 +694,12 @@ function Yo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
691
694
  E.key
692
695
  ) : null;
693
696
  }) }),
694
- m && /* @__PURE__ */ l("p", { className: "p-2 text-center text-xs text-text-secondary", children: "Loading…" }),
695
- S && !m && /* @__PURE__ */ l(
697
+ m && /* @__PURE__ */ s("p", { className: "p-2 text-center text-xs text-text-secondary", children: "Loading…" }),
698
+ S && !m && /* @__PURE__ */ s(
696
699
  "button",
697
700
  {
698
701
  type: "button",
699
- onClick: I,
702
+ onClick: C,
700
703
  "data-testid": "meme-load-more",
701
704
  className: "mt-2 w-full rounded border border-border-light py-1 text-xs text-text-secondary hover:text-text hover:border-primary",
702
705
  children: "Load more"
@@ -713,7 +716,7 @@ function Yo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
713
716
  style: {
714
717
  left: d.left,
715
718
  top: d.top,
716
- width: ht,
719
+ width: yt,
717
720
  /* The placement maths reserves exactly PREVIEW_PX of width.
718
721
  Without border-box the padding and border sit OUTSIDE that
719
722
  number and the box laps over the panel it is meant to sit
@@ -724,18 +727,18 @@ function Yo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
724
727
  },
725
728
  "aria-hidden": "true",
726
729
  children: [
727
- /* @__PURE__ */ l(
730
+ /* @__PURE__ */ s(
728
731
  "img",
729
732
  {
730
- src: Ve(d.item.key) ?? void 0,
733
+ src: Je(d.item.key) ?? void 0,
731
734
  alt: "",
732
735
  className: "block w-full rounded bg-bg object-contain",
733
- style: { height: "auto", maxHeight: Ua }
736
+ style: { height: "auto", maxHeight: Wa }
734
737
  }
735
738
  ),
736
739
  d.item.title && /* One line. A long title must not change the box height, because
737
740
  the box height is what the placement maths clamped against. */
738
- /* @__PURE__ */ l("span", { className: "overflow-hidden text-ellipsis whitespace-nowrap text-center text-[10px] text-text-secondary", children: d.item.title })
741
+ /* @__PURE__ */ s("span", { className: "overflow-hidden text-ellipsis whitespace-nowrap text-center text-[10px] text-text-secondary", children: d.item.title })
739
742
  ]
740
743
  }
741
744
  )
@@ -743,53 +746,53 @@ function Yo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
743
746
  }
744
747
  );
745
748
  }
746
- function Jo({ open: e, ...t }) {
747
- return e ? /* @__PURE__ */ l(Yo, { ...t }) : null;
749
+ function er({ open: e, ...t }) {
750
+ return e ? /* @__PURE__ */ s(Zo, { ...t }) : null;
748
751
  }
749
- const Et = {
750
- serverOrigin: `http://localhost:${Ea}`,
752
+ const Nt = {
753
+ serverOrigin: `http://localhost:${ja}`,
751
754
  defaultRoomKey: "dev-room",
752
- cdnBase: Ta
755
+ cdnBase: Aa
753
756
  };
754
- let $e = { ...Et };
755
- function Xo(e) {
757
+ let ze = { ...Nt };
758
+ function tr(e) {
756
759
  const t = Object.fromEntries(
757
760
  Object.entries(e).filter(([a, n]) => n !== void 0)
758
761
  );
759
- $e = { ...$e, ...t }, Mo({ cdnBase: $e.cdnBase });
762
+ ze = { ...ze, ...t }, Ho({ cdnBase: ze.cdnBase });
760
763
  }
761
- function Ce() {
762
- return $e;
764
+ function Ee() {
765
+ return ze;
763
766
  }
764
- const Qo = xt(Et);
765
- function Zo(e) {
767
+ const ar = Ct(Nt);
768
+ function nr(e) {
766
769
  return e.serverOrigin?.replace(/\/$/, "") || "";
767
770
  }
768
- function Fa() {
769
- return Zo(Ce());
771
+ function Ga() {
772
+ return nr(Ee());
770
773
  }
771
- const za = xt(null);
772
- function Wa() {
773
- return ya(za);
774
+ const Ka = Ct(null);
775
+ function Va() {
776
+ return va(Ka);
774
777
  }
775
- const Ba = xt(!0);
776
- function Ga() {
777
- const e = ya(Ba);
778
- M(() => {
779
- e && Fn();
778
+ const Ya = Ct(!0);
779
+ function Ja() {
780
+ const e = va(Ya);
781
+ R(() => {
782
+ e && Wn();
780
783
  }, [e]);
781
784
  }
782
- function Ka(e) {
785
+ function Xa(e) {
783
786
  return e ? { "--hc-base": e } : {};
784
787
  }
785
- const we = Ke.memo(
788
+ const ve = Ye.memo(
786
789
  function({ html: t, as: a = "span", className: n, style: o }) {
787
- return Ke.createElement(a, { className: n, style: o, dangerouslySetInnerHTML: { __html: t } });
790
+ return Ye.createElement(a, { className: n, style: o, dangerouslySetInnerHTML: { __html: t } });
788
791
  },
789
792
  (e, t) => e.html === t.html && e.as === t.as && e.className === t.className && JSON.stringify(e.style) === JSON.stringify(t.style)
790
793
  );
791
- function er(e, t) {
792
- M(() => {
794
+ function or(e, t) {
795
+ R(() => {
793
796
  const a = e.current;
794
797
  if (!a || !t || typeof IntersectionObserver > "u") return;
795
798
  const n = new IntersectionObserver(([o]) => {
@@ -800,12 +803,12 @@ function er(e, t) {
800
803
  };
801
804
  }, [e, t]);
802
805
  }
803
- function Va() {
806
+ function Qa() {
804
807
  if (typeof window > "u") return null;
805
808
  const e = window.location;
806
- return (e.hostname === "localhost" || e.hostname === "127.0.0.1") && e.port === String(lo) ? `${e.protocol}//${e.hostname}:${Ea}` : null;
809
+ return (e.hostname === "localhost" || e.hostname === "127.0.0.1") && e.port === String(go) ? `${e.protocol}//${e.hostname}:${ja}` : null;
807
810
  }
808
- const oe = {
811
+ const ne = {
809
812
  ANON_KEY: "watchparty_preferences",
810
813
  DEBUG_FLAG: "wp:debug",
811
814
  REPORT_LOGS_FLAG: "wp:reportLogs",
@@ -813,7 +816,7 @@ const oe = {
813
816
  RECENT_EMOJI: "wp:recentEmoji",
814
817
  voteKey: (e, t, a) => `watchparty_vote:${e}:${t}:${a}`
815
818
  };
816
- function nt() {
819
+ function rt() {
817
820
  try {
818
821
  return globalThis.localStorage ?? null;
819
822
  } catch {
@@ -822,22 +825,22 @@ function nt() {
822
825
  }
823
826
  function B(e) {
824
827
  try {
825
- return nt()?.getItem(e) ?? null;
828
+ return rt()?.getItem(e) ?? null;
826
829
  } catch {
827
830
  return null;
828
831
  }
829
832
  }
830
- function It(e, t) {
833
+ function jt(e, t) {
831
834
  try {
832
- const a = nt();
835
+ const a = rt();
833
836
  return a ? (a.setItem(e, t), !0) : !1;
834
837
  } catch {
835
838
  return !1;
836
839
  }
837
840
  }
838
- function tr() {
841
+ function rr() {
839
842
  try {
840
- const e = nt();
843
+ const e = rt();
841
844
  if (!e) return [];
842
845
  const t = [];
843
846
  for (let a = 0; a < e.length; a++) {
@@ -849,51 +852,51 @@ function tr() {
849
852
  return [];
850
853
  }
851
854
  }
852
- function ve(e) {
855
+ function ke(e) {
853
856
  try {
854
- nt()?.removeItem(e);
857
+ rt()?.removeItem(e);
855
858
  } catch {
856
859
  }
857
860
  }
858
- function ar(e) {
861
+ function ir(e) {
859
862
  const t = B(e);
860
863
  return t === null ? null : t === "true" ? !0 : t === "false" ? !1 : null;
861
864
  }
862
- const Ya = /* @__PURE__ */ new Map();
863
- let Ja = !1;
864
- function ot(e, t) {
865
- Ya.set(e, t), Ja && Xa(e, t);
865
+ const Za = /* @__PURE__ */ new Map();
866
+ let en = !1;
867
+ function it(e, t) {
868
+ Za.set(e, t), en && tn(e, t);
866
869
  }
867
- function nr() {
868
- Ja = !0;
869
- for (const [e, t] of Ya) Xa(e, t);
870
+ function fr() {
871
+ en = !0;
872
+ for (const [e, t] of Za) tn(e, t);
870
873
  }
871
- function Xa(e, t) {
874
+ function tn(e, t) {
872
875
  typeof window > "u" || (window[e] = t);
873
876
  }
874
- const be = [], or = 500;
875
- let Fe = [], pt = null;
876
- const rr = 1e3, ir = 200;
877
- let bt = null;
878
- function Qa(e) {
879
- bt = e;
877
+ const ye = [], sr = 500;
878
+ let We = [], _t = null;
879
+ const lr = 1e3, cr = 200;
880
+ let wt = null;
881
+ function an(e) {
882
+ wt = e;
880
883
  }
881
- function Za() {
882
- return B(oe.REPORT_LOGS_FLAG) === "true";
884
+ function nn() {
885
+ return B(ne.REPORT_LOGS_FLAG) === "true";
883
886
  }
884
- function fr() {
887
+ function dr() {
885
888
  if (typeof window > "u") return !1;
886
889
  if (window.__WP_DEBUG__ || new URLSearchParams(window.location.search).get("debug") === "true") return !0;
887
- const t = B(oe.DEBUG_FLAG);
890
+ const t = B(ne.DEBUG_FLAG);
888
891
  return t !== null && t !== "false";
889
892
  }
890
- function sr() {
891
- const e = B(oe.DEBUG_FLAG);
893
+ function ur() {
894
+ const e = B(ne.DEBUG_FLAG);
892
895
  if (!e || e === "true") return null;
893
896
  const t = e.split(",").map((a) => a.trim().toLowerCase()).filter(Boolean);
894
897
  return t.length > 0 ? new Set(t) : null;
895
898
  }
896
- function lr() {
899
+ function mr() {
897
900
  return (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", {
898
901
  hour12: !1,
899
902
  hour: "2-digit",
@@ -902,72 +905,72 @@ function lr() {
902
905
  fractionalSecondDigits: 3
903
906
  });
904
907
  }
905
- function cr(e) {
906
- be.push(e), be.length > or && be.shift();
908
+ function gr(e) {
909
+ ye.push(e), ye.length > sr && ye.shift();
907
910
  }
908
- const it = {
911
+ const st = {
909
912
  debug: "color: #64748b; font-weight: normal;",
910
913
  warn: "color: #f59e0b; font-weight: bold;",
911
914
  error: "color: #ef4444; font-weight: bold;",
912
915
  category: "color: #3b82f6; font-weight: bold;",
913
916
  time: "color: #6b7280; font-weight: normal;"
914
917
  };
915
- function dr(e) {
918
+ function hr(e) {
916
919
  try {
917
920
  return JSON.stringify(e);
918
921
  } catch {
919
922
  return "[unserializable]";
920
923
  }
921
924
  }
922
- function At(e, t, a, n, o, r, f) {
923
- const s = {
925
+ function Rt(e, t, a, n, o, r, f) {
926
+ const l = {
924
927
  level: e,
925
928
  category: o,
926
929
  message: r,
927
930
  data: f,
928
931
  timestamp: Date.now()
929
932
  };
930
- if (cr(s), (a || Za()) && Bt(s), !n) {
931
- if (!fr()) return;
932
- const m = sr();
933
+ if (gr(l), (a || nn()) && Vt(l), !n) {
934
+ if (!dr()) return;
935
+ const m = ur();
933
936
  if (m && !m.has(o.toLowerCase())) return;
934
937
  }
935
- const c = lr(), u = f !== void 0 ? " " + dr(f) : "";
938
+ const c = mr(), u = f !== void 0 ? " " + hr(f) : "";
936
939
  t(
937
940
  `%c[${c}]%c [${o}]%c ${r}${u}`,
938
- it.time,
939
- it.category,
940
- it[e]
941
+ st.time,
942
+ st.category,
943
+ st[e]
941
944
  );
942
945
  }
943
- function p(e, t, a) {
944
- At("debug", console.log, !1, !1, e, t, a);
946
+ function h(e, t, a) {
947
+ Rt("debug", console.log, !1, !1, e, t, a);
945
948
  }
946
949
  function L(e, t, a) {
947
- At("warn", console.warn, !0, !1, e, t, a);
950
+ Rt("warn", console.warn, !0, !1, e, t, a);
948
951
  }
949
- function ze(e, t, a) {
950
- At("error", console.error, !0, !0, e, t, a);
952
+ function Be(e, t, a) {
953
+ Rt("error", console.error, !0, !0, e, t, a);
951
954
  }
952
- function ur() {
953
- return [...be];
955
+ function pr() {
956
+ return [...ye];
954
957
  }
955
- function mr() {
956
- be.length = 0;
958
+ function br() {
959
+ ye.length = 0;
957
960
  }
958
- function gr(e) {
961
+ function yr(e) {
959
962
  const t = e && e.length > 0 ? e.join(",") : "true";
960
- It(oe.DEBUG_FLAG, t), console.log("[wp] Debug mode enabled");
963
+ jt(ne.DEBUG_FLAG, t), console.log("[wp] Debug mode enabled");
961
964
  }
962
- function hr() {
963
- ve(oe.DEBUG_FLAG), console.log("[wp] Debug mode disabled");
965
+ function _r() {
966
+ ke(ne.DEBUG_FLAG), console.log("[wp] Debug mode disabled");
964
967
  }
965
- const pr = 1024, br = 5e4;
966
- function yr(e) {
968
+ const wr = 1024, vr = 5e4;
969
+ function kr(e) {
967
970
  if (e == null) return e;
968
971
  try {
969
972
  const t = JSON.stringify(e);
970
- if (t.length <= pr) return e;
973
+ if (t.length <= wr) return e;
971
974
  if (typeof e == "object" && !Array.isArray(e)) {
972
975
  const a = {};
973
976
  for (const [n, o] of Object.entries(e)) {
@@ -981,32 +984,32 @@ function yr(e) {
981
984
  return "[unserializable]";
982
985
  }
983
986
  }
984
- async function _r() {
985
- if (Fe.length === 0) return;
986
- const e = Fe;
987
- Fe = [], pt = null;
987
+ async function xr() {
988
+ if (We.length === 0) return;
989
+ const e = We;
990
+ We = [], _t = null;
988
991
  try {
989
- let a = Ce().serverOrigin || "";
990
- (a === "/" || !a) && typeof window < "u" && (a = Va() ?? window.location.origin);
991
- const n = `${a.replace(/\/$/, "")}/api/client-log`, o = e.map((s) => ({
992
- level: s.level,
993
- category: s.category,
994
- message: s.message,
995
- data: yr(s.data),
996
- timestamp: s.timestamp,
992
+ let a = Ee().serverOrigin || "";
993
+ (a === "/" || !a) && typeof window < "u" && (a = Qa() ?? window.location.origin);
994
+ const n = `${a.replace(/\/$/, "")}/api/client-log`, o = e.map((l) => ({
995
+ level: l.level,
996
+ category: l.category,
997
+ message: l.message,
998
+ data: kr(l.data),
999
+ timestamp: l.timestamp,
997
1000
  url: typeof window < "u" ? window.location.href : void 0,
998
1001
  userAgent: typeof navigator < "u" ? navigator.userAgent : void 0,
999
- room_key: bt?.room_key,
1000
- client_id: bt?.client_id
1002
+ room_key: wt?.room_key,
1003
+ client_id: wt?.client_id
1001
1004
  }));
1002
1005
  let r = [], f = 0;
1003
- for (const s of o) {
1004
- const c = JSON.stringify(s).length + 1;
1005
- f + c > br && r.length > 0 && (await fetch(n, {
1006
+ for (const l of o) {
1007
+ const c = JSON.stringify(l).length + 1;
1008
+ f + c > vr && r.length > 0 && (await fetch(n, {
1006
1009
  method: "POST",
1007
1010
  headers: { "Content-Type": "application/json" },
1008
1011
  body: JSON.stringify({ logs: r })
1009
- }), r = [], f = 0), r.push(s), f += c;
1012
+ }), r = [], f = 0), r.push(l), f += c;
1010
1013
  }
1011
1014
  r.length > 0 && await fetch(n, {
1012
1015
  method: "POST",
@@ -1014,31 +1017,31 @@ async function _r() {
1014
1017
  body: JSON.stringify({ logs: r })
1015
1018
  });
1016
1019
  } catch (t) {
1017
- console.warn("[wp] log flush failed (client logs may be lost):", Ee(t).error);
1020
+ console.warn("[wp] log flush failed (client logs may be lost):", Ie(t).error);
1018
1021
  }
1019
1022
  }
1020
- function Bt(e) {
1021
- if (Fe.push(e), !pt) {
1022
- const t = Za() ? ir : rr;
1023
- pt = setTimeout(() => {
1024
- _r();
1023
+ function Vt(e) {
1024
+ if (We.push(e), !_t) {
1025
+ const t = nn() ? cr : lr;
1026
+ _t = setTimeout(() => {
1027
+ xr();
1025
1028
  }, t);
1026
1029
  }
1027
1030
  }
1028
- function Ee(e) {
1031
+ function Ie(e) {
1029
1032
  return e instanceof Error ? { error: e.message, name: e.name } : { error: String(e), name: typeof e };
1030
1033
  }
1031
- ot("__wpDebug", {
1032
- enable: gr,
1033
- disable: hr,
1034
- history: ur,
1035
- clear: mr
1034
+ it("__wpDebug", {
1035
+ enable: yr,
1036
+ disable: _r,
1037
+ history: pr,
1038
+ clear: br
1036
1039
  });
1037
- const wr = 1280;
1038
- function vr(e) {
1039
- return e.screenWidth < wr ? !1 : e.noHoverNoPointer || e.anyHoverNone && e.maxTouchPoints === 0;
1040
+ const Sr = 1280;
1041
+ function Tr(e) {
1042
+ return e.screenWidth < Sr ? !1 : e.noHoverNoPointer || e.anyHoverNone && e.maxTouchPoints === 0;
1040
1043
  }
1041
- function kr() {
1044
+ function Cr() {
1042
1045
  const e = (t) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(t).matches;
1043
1046
  return {
1044
1047
  noHoverNoPointer: e("(hover: none) and (pointer: none)"),
@@ -1047,57 +1050,57 @@ function kr() {
1047
1050
  screenWidth: typeof screen < "u" ? screen.width : 0
1048
1051
  };
1049
1052
  }
1050
- let Gt = null;
1051
- function xr() {
1052
- return Gt ??= vr(kr()), Gt;
1053
+ let Yt = null;
1054
+ function Er() {
1055
+ return Yt ??= Tr(Cr()), Yt;
1053
1056
  }
1054
- function Kt() {
1055
- return xr();
1057
+ function Jt() {
1058
+ return Er();
1056
1059
  }
1057
- const ne = {
1060
+ const ae = {
1058
1061
  resolved: !1,
1059
1062
  userType: "public",
1060
1063
  accountId: null
1061
1064
  };
1062
- function Nt() {
1063
- return ne.accountId ? ne.accountId : ne.resolved && ne.userType === "public" ? "anon" : null;
1065
+ function Pt() {
1066
+ return ae.accountId ? ae.accountId : ae.resolved && ae.userType === "public" ? "anon" : null;
1064
1067
  }
1065
- function Sr(e) {
1066
- ne.resolved = !0, e.userType && (ne.userType = e.userType), e.userId !== void 0 && (ne.accountId = e.userId && e.userId !== "public" ? e.userId : null);
1068
+ function Ir(e) {
1069
+ ae.resolved = !0, e.userType && (ae.userType = e.userType), e.userId !== void 0 && (ae.accountId = e.userId && e.userId !== "public" ? e.userId : null);
1067
1070
  }
1068
- function jt() {
1069
- return ne.accountId ?? "public";
1071
+ function Mt() {
1072
+ return ae.accountId ?? "public";
1070
1073
  }
1071
- function Tr() {
1072
- return Nt() ?? "unscoped";
1074
+ function Ar() {
1075
+ return Pt() ?? "unscoped";
1073
1076
  }
1074
- function en(e) {
1075
- return et(e) ? eo[e] : "var(--color-neutral-bg)";
1077
+ function on(e) {
1078
+ return at(e) ? ao[e] : "var(--color-neutral-bg)";
1076
1079
  }
1077
- function Cr(e) {
1078
- return et(e) ? `${Ce().serverOrigin.replace(/\/$/, "")}${Zn(e)}` : void 0;
1080
+ function Nr(e) {
1081
+ return at(e) ? `${Ee().serverOrigin.replace(/\/$/, "")}${to(e)}` : void 0;
1079
1082
  }
1080
- let ke = null, De = null;
1081
- function Er() {
1082
- return ke ? Promise.resolve() : De || (De = (async () => {
1083
+ let xe = null, Oe = null;
1084
+ function jr() {
1085
+ return xe ? Promise.resolve() : Oe || (Oe = (async () => {
1083
1086
  try {
1084
- const e = Ce().serverOrigin.replace(/\/$/, ""), t = await fetch(`${e}/media/sprites/names.json`, { cache: "no-cache" });
1087
+ const e = Ee().serverOrigin.replace(/\/$/, ""), t = await fetch(`${e}/media/sprites/names.json`, { cache: "no-cache" });
1085
1088
  if (!t.ok) return;
1086
1089
  const a = await t.json();
1087
- ke = a, ot("__DISPLAY_NAMES__", a), p("characters", "Loaded display names", a);
1090
+ xe = a, it("__DISPLAY_NAMES__", a), h("characters", "Loaded display names", a);
1088
1091
  } catch (e) {
1089
- p("characters", "display names fetch failed (degrading to sprite IDs)", Ee(e));
1092
+ h("characters", "display names fetch failed (degrading to sprite IDs)", Ie(e));
1090
1093
  }
1091
- })(), De);
1094
+ })(), Oe);
1092
1095
  }
1093
- function xe(e) {
1094
- return ke?.[e] || e.charAt(0).toUpperCase() + e.slice(1);
1096
+ function Se(e) {
1097
+ return xe?.[e] || e.charAt(0).toUpperCase() + e.slice(1);
1095
1098
  }
1096
- function le(e) {
1099
+ function se(e) {
1097
1100
  const t = e.toLowerCase();
1098
- return Ze.some((a) => a === t) ? !0 : ke ? Object.values(ke).some((a) => a.toLowerCase() === t) : !1;
1101
+ return tt.some((a) => a === t) ? !0 : xe ? Object.values(xe).some((a) => a.toLowerCase() === t) : !1;
1099
1102
  }
1100
- const Ir = i.object({
1103
+ const Rr = i.object({
1101
1104
  // Identity. There is deliberately NO `name`: a person's name is their
1102
1105
  // hadoku key-registry name, resolved by the server from whoami and renamed
1103
1106
  // through hadoku_site's POST /session/name (operator decision 2026-10-08).
@@ -1126,19 +1129,19 @@ const Ir = i.object({
1126
1129
  preferredAudioLang: i.string().optional(),
1127
1130
  subtitlesEnabled: i.boolean().optional(),
1128
1131
  subtitleStyle: i.string().optional()
1129
- }), ye = Yn({
1132
+ }), _e = Xn({
1130
1133
  appId: "watchparty",
1131
- schema: Ir
1132
- }), Ar = /* @__PURE__ */ new Set(["theme", "themeMode"]);
1133
- function Ye(e) {
1134
- const t = Nt();
1134
+ schema: Rr
1135
+ }), Pr = /* @__PURE__ */ new Set(["theme", "themeMode"]);
1136
+ function Xe(e) {
1137
+ const t = Pt();
1135
1138
  return t ? `prefs-cache:${t}:${e}` : null;
1136
1139
  }
1137
- function Nr() {
1138
- return Nt() === null;
1140
+ function Mr() {
1141
+ return Pt() === null;
1139
1142
  }
1140
- function Vt(e) {
1141
- const t = Ye(e);
1143
+ function Xt(e) {
1144
+ const t = Xe(e);
1142
1145
  if (!t) return {};
1143
1146
  const a = B(t);
1144
1147
  if (!a) return {};
@@ -1148,10 +1151,10 @@ function Vt(e) {
1148
1151
  return {};
1149
1152
  }
1150
1153
  }
1151
- function jr() {
1154
+ function Dr() {
1152
1155
  let e = 0;
1153
- for (const t of tr()) {
1154
- const a = t.startsWith("prefs-cache:") && t.endsWith(":watchparty"), n = t === Je || t.startsWith(`${Je}:`) && !t.endsWith(":_serverSynced_v1");
1156
+ for (const t of rr()) {
1157
+ const a = t.startsWith("prefs-cache:") && t.endsWith(":watchparty"), n = t === Qe || t.startsWith(`${Qe}:`) && !t.endsWith(":_serverSynced_v1");
1155
1158
  if (!a && !n) continue;
1156
1159
  const o = B(t);
1157
1160
  if (!o) continue;
@@ -1163,19 +1166,19 @@ function jr() {
1163
1166
  }
1164
1167
  const f = a ? r?.blob : r;
1165
1168
  if (!f || typeof f != "object" || !("name" in f)) continue;
1166
- const { name: s, ...c } = f, u = a ? { ...r, blob: c } : c;
1167
- It(t, JSON.stringify(u)) && e++;
1169
+ const { name: l, ...c } = f, u = a ? { ...r, blob: c } : c;
1170
+ jt(t, JSON.stringify(u)) && e++;
1168
1171
  }
1169
- return e > 0 && p("preferences", "Stripped retired name from cached prefs rows", { rewritten: e }), e;
1170
- }
1171
- let tn = null, an = null;
1172
- const Yt = /* @__PURE__ */ new Set();
1173
- function Rt() {
1174
- if (Nr())
1175
- return p("preferences", "Boot read deferred — session pending, identity unresolved"), {};
1176
- const e = Vt("portfolio"), t = Vt("watchparty"), a = Object.keys(e).length > 0 ? e : tn ?? {}, n = Object.keys(t).length > 0 ? t : an ?? {}, o = jt() || "public";
1177
- if (Yt.has(o))
1178
- return p("preferences", "Loaded (sync, SDK-only after first read)", {
1172
+ return e > 0 && h("preferences", "Stripped retired name from cached prefs rows", { rewritten: e }), e;
1173
+ }
1174
+ let rn = null, fn = null;
1175
+ const Qt = /* @__PURE__ */ new Set();
1176
+ function Dt() {
1177
+ if (Mr())
1178
+ return h("preferences", "Boot read deferred — session pending, identity unresolved"), {};
1179
+ const e = Xt("portfolio"), t = Xt("watchparty"), a = Object.keys(e).length > 0 ? e : rn ?? {}, n = Object.keys(t).length > 0 ? t : fn ?? {}, o = Mt() || "public";
1180
+ if (Qt.has(o))
1181
+ return h("preferences", "Loaded (sync, SDK-only after first read)", {
1179
1182
  uid: o,
1180
1183
  sdkThemeKeys: Object.keys(a).length,
1181
1184
  sdkAppKeys: Object.keys(n).length,
@@ -1184,9 +1187,9 @@ function Rt() {
1184
1187
  themeSource: Object.keys(e).length > 0 ? "cache" : "mem",
1185
1188
  appSource: Object.keys(t).length > 0 ? "cache" : "mem"
1186
1189
  }), { ...n, ...a };
1187
- Yt.add(o);
1188
- const r = on() ?? {}, f = { ...r, ...n, ...a };
1189
- return p("preferences", "Loaded (sync, first read — legacy + SDK)", {
1190
+ Qt.add(o);
1191
+ const r = ln() ?? {}, f = { ...r, ...n, ...a };
1192
+ return h("preferences", "Loaded (sync, first read — legacy + SDK)", {
1190
1193
  uid: o,
1191
1194
  sdkThemeKeys: Object.keys(a).length,
1192
1195
  sdkAppKeys: Object.keys(n).length,
@@ -1195,60 +1198,60 @@ function Rt() {
1195
1198
  appSource: Object.keys(t).length > 0 ? "cache" : "mem"
1196
1199
  }), f;
1197
1200
  }
1198
- let nn = !1;
1199
- function Rr() {
1200
- const e = jt();
1201
+ let sn = !1;
1202
+ function Lr() {
1203
+ const e = Mt();
1201
1204
  return !e || e === "public";
1202
1205
  }
1203
- function J(e, t) {
1204
- Rr() && (nn = !0), Ar.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 });
1206
+ function Y(e, t) {
1207
+ Lr() && (sn = !0), Pr.has(e) ? be.save({ [e]: t }, { scope: "device" }).catch((a) => L("preferences", "themePrefs.save failed", { key: e, err: a?.message })) : _e.save({ [e]: t }).catch((a) => L("preferences", "watchpartyPrefs.save failed", { key: e, err: a?.message })), h("preferences", "Saved (via SDK)", { key: e, value: t });
1205
1208
  }
1206
- let Le = null, Jt = !1;
1207
- function Pr() {
1208
- return Le || (Le = (async () => {
1209
+ let He = null, Zt = !1;
1210
+ function Or() {
1211
+ return He || (He = (async () => {
1209
1212
  if (typeof window > "u") return !1;
1210
1213
  try {
1211
- Jt || (Jt = !0, pe.subscribe((f) => {
1212
- tn = f, Zt("portfolio", f), ea("theme");
1213
- }), ye.subscribe((f) => {
1214
- an = f, Zt("watchparty", f), ea("watchparty");
1214
+ Zt || (Zt = !0, be.subscribe((f) => {
1215
+ rn = f, aa("portfolio", f), na("theme");
1216
+ }), _e.subscribe((f) => {
1217
+ fn = f, aa("watchparty", f), na("watchparty");
1215
1218
  }));
1216
1219
  const [e, t] = await Promise.all([
1217
- pe.read(),
1218
- ye.read()
1220
+ be.read(),
1221
+ _e.read()
1219
1222
  ]);
1220
1223
  try {
1221
- const { useAppStore: f } = await Promise.resolve().then(() => cn);
1224
+ const { useAppStore: f } = await Promise.resolve().then(() => gn);
1222
1225
  f.getState().rehydrateFromPrefs();
1223
1226
  } catch (f) {
1224
1227
  L("preferences", "inline rehydrate after SDK read failed", { err: f?.message });
1225
1228
  }
1226
- const a = Ye("portfolio"), n = Ye("watchparty"), o = a ? B(a) : null, r = n ? B(n) : null;
1227
- return p("preferences", "sdk.read", {
1229
+ const a = Xe("portfolio"), n = Xe("watchparty"), o = a ? B(a) : null, r = n ? B(n) : null;
1230
+ return h("preferences", "sdk.read", {
1228
1231
  themeKeys: Object.keys(e ?? {}),
1229
1232
  appKeys: Object.keys(t ?? {}),
1230
1233
  // Post-fetch cache state: should be non-zero if SDK wrote it.
1231
1234
  sdkThemeBytesPost: o?.length ?? 0,
1232
1235
  sdkAppBytesPost: r?.length ?? 0
1233
- }), await Mr(e, t), nn ? (p("preferences", "Promoting this load's pre-auth picks to the signed-in user"), await Promise.all([
1234
- pe.promoteAnonPrefsToUser().catch(() => {
1236
+ }), await Hr(e, t), sn ? (h("preferences", "Promoting this load's pre-auth picks to the signed-in user"), await Promise.all([
1237
+ be.promoteAnonPrefsToUser().catch(() => {
1235
1238
  }),
1236
- ye.promoteAnonPrefsToUser().catch(() => {
1239
+ _e.promoteAnonPrefsToUser().catch(() => {
1237
1240
  })
1238
- ])) : p("preferences", "Skipping anon promotion — no pre-auth writes this load"), p("preferences", "First-load SDK sync complete"), !0;
1241
+ ])) : h("preferences", "Skipping anon promotion — no pre-auth writes this load"), h("preferences", "First-load SDK sync complete"), !0;
1239
1242
  } catch (e) {
1240
1243
  return L("preferences", "First-load SDK sync failed (non-fatal)", { err: e?.message }), !1;
1241
1244
  }
1242
- })(), Le);
1245
+ })(), He);
1243
1246
  }
1244
- const Je = "watchparty_preferences";
1245
- jr();
1246
- function yt() {
1247
- const e = jt();
1248
- return !e || e === "public" ? Je : `${Je}:${e}`;
1247
+ const Qe = "watchparty_preferences";
1248
+ Dr();
1249
+ function vt() {
1250
+ const e = Mt();
1251
+ return !e || e === "public" ? Qe : `${Qe}:${e}`;
1249
1252
  }
1250
- function on() {
1251
- const e = B(yt());
1253
+ function ln() {
1254
+ const e = B(vt());
1252
1255
  if (!e) return null;
1253
1256
  try {
1254
1257
  const t = JSON.parse(e);
@@ -1257,40 +1260,40 @@ function on() {
1257
1260
  return null;
1258
1261
  }
1259
1262
  }
1260
- function Xt() {
1261
- ve(yt()), ve(`${yt()}:_serverSynced_v1`);
1263
+ function ea() {
1264
+ ke(vt()), ke(`${vt()}:_serverSynced_v1`);
1262
1265
  }
1263
- async function Mr(e, t) {
1264
- const a = on();
1266
+ async function Hr(e, t) {
1267
+ const a = ln();
1265
1268
  if (!a || Object.keys(a).length === 0) return;
1266
1269
  const n = Object.keys(e ?? {}).length > 0, o = Object.keys(t ?? {}).length > 0, r = {}, f = {};
1267
1270
  for (const [u, m] of Object.entries(a))
1268
1271
  n || (u === "theme" && typeof m == "string" ? r.theme = m : u === "themeMode" && (m === "simple" || m === "advanced") && (r.themeMode = m)), o || (u === "chatCollapsed" && typeof m == "boolean" ? f.chatCollapsed = m : u === "floatingChatEnabled" && typeof m == "boolean" ? f.floatingChatEnabled = m : u === "volume" && typeof m == "number" && m >= 0 && m <= 1 ? f.volume = m : u === "muted" && typeof m == "boolean" ? f.muted = m : u === "preferredAudioLang" && typeof m == "string" ? f.preferredAudioLang = m : u === "subtitlesEnabled" && typeof m == "boolean" ? f.subtitlesEnabled = m : u === "subtitleStyle" && typeof m == "string" && (f.subtitleStyle = m));
1269
- const s = Object.keys(r), c = Object.keys(f);
1270
- if (s.length === 0 && c.length === 0) {
1271
- Xt();
1272
+ const l = Object.keys(r), c = Object.keys(f);
1273
+ if (l.length === 0 && c.length === 0) {
1274
+ ea();
1272
1275
  return;
1273
1276
  }
1274
- p("preferences", "Migrating legacy localStorage prefs to SDK", {
1275
- themeKeys: s,
1277
+ h("preferences", "Migrating legacy localStorage prefs to SDK", {
1278
+ themeKeys: l,
1276
1279
  appKeys: c,
1277
1280
  sdkHasTheme: n,
1278
1281
  sdkHasApp: o
1279
1282
  });
1280
1283
  try {
1281
1284
  await Promise.all([
1282
- s.length > 0 ? pe.save(r, { scope: "device" }) : Promise.resolve(),
1283
- c.length > 0 ? ye.save(f) : Promise.resolve()
1284
- ]), Xt(), p("preferences", "Legacy migration complete");
1285
+ l.length > 0 ? be.save(r, { scope: "device" }) : Promise.resolve(),
1286
+ c.length > 0 ? _e.save(f) : Promise.resolve()
1287
+ ]), ea(), h("preferences", "Legacy migration complete");
1285
1288
  } catch (u) {
1286
1289
  L("preferences", "Legacy migration save failed — will retry next load", {
1287
1290
  err: u?.message
1288
1291
  });
1289
1292
  }
1290
1293
  }
1291
- let Qt = !1;
1292
- function Zt(e, t) {
1293
- const a = Ye(e);
1294
+ let ta = !1;
1295
+ function aa(e, t) {
1296
+ const a = Xe(e);
1294
1297
  if (a)
1295
1298
  try {
1296
1299
  const n = {
@@ -1301,15 +1304,15 @@ function Zt(e, t) {
1301
1304
  };
1302
1305
  localStorage.setItem(a, JSON.stringify(n));
1303
1306
  } catch (n) {
1304
- Qt || (Qt = !0, L("preferences", "writeThrough localStorage failed (in-memory backstop only)", {
1307
+ ta || (ta = !0, L("preferences", "writeThrough localStorage failed (in-memory backstop only)", {
1305
1308
  appId: e,
1306
1309
  err: n?.message,
1307
1310
  name: n?.name
1308
1311
  }));
1309
1312
  }
1310
1313
  }
1311
- function ea(e) {
1312
- Promise.resolve().then(() => cn).then(({ useAppStore: t }) => {
1314
+ function na(e) {
1315
+ Promise.resolve().then(() => gn).then(({ useAppStore: t }) => {
1313
1316
  try {
1314
1317
  t.getState().rehydrateFromPrefs();
1315
1318
  } catch (a) {
@@ -1317,60 +1320,60 @@ function ea(e) {
1317
1320
  }
1318
1321
  }).catch((t) => L("preferences", "store import failed", { reason: e, err: t?.message }));
1319
1322
  }
1320
- const rn = 24;
1321
- function _t(e) {
1323
+ const cn = 24;
1324
+ function kt(e) {
1322
1325
  if (!Array.isArray(e)) return [];
1323
1326
  const t = [];
1324
1327
  for (const a of e)
1325
- if (typeof a == "string" && a && a.length <= 32 && !t.includes(a) && t.push(a), t.length === rn) break;
1328
+ if (typeof a == "string" && a && a.length <= 32 && !t.includes(a) && t.push(a), t.length === cn) break;
1326
1329
  return t;
1327
1330
  }
1328
- function Dr(e, t) {
1329
- return [t, ...e.filter((a) => a !== t)].slice(0, rn);
1331
+ function qr(e, t) {
1332
+ return [t, ...e.filter((a) => a !== t)].slice(0, cn);
1330
1333
  }
1331
- function Lr() {
1332
- const e = B(oe.RECENT_EMOJI);
1334
+ function Ur() {
1335
+ const e = B(ne.RECENT_EMOJI);
1333
1336
  if (!e) return [];
1334
1337
  try {
1335
- return _t(JSON.parse(e));
1338
+ return kt(JSON.parse(e));
1336
1339
  } catch {
1337
1340
  return [];
1338
1341
  }
1339
1342
  }
1340
- function Or() {
1341
- ve(oe.RECENT_EMOJI);
1343
+ function $r() {
1344
+ ke(ne.RECENT_EMOJI);
1342
1345
  }
1343
- const fn = 320, Xe = 240, Pt = 640, qr = 320, Hr = 36, ta = 16;
1346
+ const dn = 320, Ze = 240, Lt = 640, Fr = 320, zr = 36, oa = 16;
1344
1347
  function Z(e, t) {
1345
- if (!Number.isFinite(e)) return fn;
1346
- let a = Pt;
1347
- return t !== void 0 && Number.isFinite(t) && t > 0 && (a = Math.min(a, t - qr)), a = Math.max(a, Xe), Math.round(Math.min(a, Math.max(Xe, e)));
1348
+ if (!Number.isFinite(e)) return dn;
1349
+ let a = Lt;
1350
+ return t !== void 0 && Number.isFinite(t) && t > 0 && (a = Math.min(a, t - Fr)), a = Math.max(a, Ze), Math.round(Math.min(a, Math.max(Ze, e)));
1348
1351
  }
1349
- function aa(e, t, a, n) {
1352
+ function ra(e, t, a, n) {
1350
1353
  return Z(e + (t - a), n);
1351
1354
  }
1352
- function Ur(e, t, a) {
1355
+ function Wr(e, t, a) {
1353
1356
  switch (t) {
1354
1357
  case "ArrowLeft":
1355
- return Z(e + ta, a);
1358
+ return Z(e + oa, a);
1356
1359
  case "ArrowRight":
1357
- return Z(e - ta, a);
1360
+ return Z(e - oa, a);
1358
1361
  case "Home":
1359
- return Z(Xe, a);
1362
+ return Z(Ze, a);
1360
1363
  case "End":
1361
- return Z(Pt, a);
1364
+ return Z(Lt, a);
1362
1365
  default:
1363
1366
  return null;
1364
1367
  }
1365
1368
  }
1366
- function $r(e, t) {
1367
- return { collapsed: e, width: e ? Hr : t };
1369
+ function Br(e, t) {
1370
+ return { collapsed: e, width: e ? zr : t };
1368
1371
  }
1369
- function sn(e, t) {
1372
+ function un(e, t) {
1370
1373
  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);
1371
1374
  return o.length ? [...t, ...o] : t;
1372
1375
  }
1373
- const ln = 6e3, G = Rt(), g = Qn((e, t) => ({
1376
+ const mn = 6e3, G = Dt(), g = eo((e, t) => ({
1374
1377
  ready: !1,
1375
1378
  name: "",
1376
1379
  sprite: null,
@@ -1383,9 +1386,9 @@ const ln = 6e3, G = Rt(), g = Qn((e, t) => ({
1383
1386
  chatJump: null,
1384
1387
  chatCollapsed: G.chatCollapsed ?? !1,
1385
1388
  chromeChatCollapsed: G.chromeChatCollapsed ?? !1,
1386
- chromeChatWidth: Z(G.chromeChatWidth ?? fn),
1389
+ chromeChatWidth: Z(G.chromeChatWidth ?? dn),
1387
1390
  // The account's list, else what this browser kept before it moved to prefs.
1388
- recentEmoji: G.recentEmoji !== void 0 ? _t(G.recentEmoji) : Lr(),
1391
+ recentEmoji: G.recentEmoji !== void 0 ? kt(G.recentEmoji) : Ur(),
1389
1392
  // Hardcoded on for everyone — the per-user toggle was removed from the
1390
1393
  // control bar; FloatingChat + toggleFloatingChat code is kept for future
1391
1394
  // re-enablement but the value is no longer user-controllable.
@@ -1421,44 +1424,44 @@ const ln = 6e3, G = Rt(), g = Qn((e, t) => ({
1421
1424
  gameSettings: null,
1422
1425
  roomKeyType: null,
1423
1426
  setReady: () => {
1424
- p("store", "App ready"), e({ ready: !0 });
1427
+ h("store", "App ready"), e({ ready: !0 });
1425
1428
  },
1426
1429
  setSessionIdentity: (a, n) => {
1427
- p("store", "Session identity set (not persisted)", { name: a, sprite: n }), e({ name: a, sprite: n });
1430
+ h("store", "Session identity set (not persisted)", { name: a, sprite: n }), e({ name: a, sprite: n });
1428
1431
  },
1429
1432
  ensureAutoIdentity: () => e((a) => {
1430
1433
  if (a.name) return {};
1431
1434
  if (a.sprite) {
1432
- const r = xe(a.sprite);
1433
- return p("store", "Auto-identity: deriving name from the requested sprite", { name: r, sprite: a.sprite }), { name: r };
1435
+ const r = Se(a.sprite);
1436
+ return h("store", "Auto-identity: deriving name from the requested sprite", { name: r, sprite: a.sprite }), { name: r };
1434
1437
  }
1435
- const n = Object.values(a.roster).map((r) => r.sprite), o = xa(n, void 0, Ze);
1438
+ const n = Object.values(a.roster).map((r) => r.sprite), o = Ea(n, void 0, tt);
1436
1439
  if (o) {
1437
- const r = xe(o);
1438
- return p("store", "Auto-identity assigned", { name: r, sprite: o }), { name: r, sprite: o };
1440
+ const r = Se(o);
1441
+ return h("store", "Auto-identity assigned", { name: r, sprite: o }), { name: r, sprite: o };
1439
1442
  }
1440
1443
  return L("store", "All characters taken, leaving identity unset"), {};
1441
1444
  }),
1442
1445
  ensureMe: (a) => {
1443
- p("store", "Client ID set", { clientId: a }), e((n) => ({ me: { ...n.me, clientId: a } }));
1446
+ h("store", "Client ID set", { clientId: a }), e((n) => ({ me: { ...n.me, clientId: a } }));
1444
1447
  },
1445
1448
  applySnapshot: (a) => e((n) => {
1446
1449
  const o = { ...n.roster };
1447
1450
  if (a.users)
1448
1451
  for (const c of a.users) o[c.clientId] = c;
1449
1452
  const r = a.mediaId !== void 0 ? a.mediaId : n.snapshot.mediaId, f = a.leaderId !== void 0 ? a.leaderId : n.snapshot.leaderId;
1450
- p("store", "Snapshot applied", {
1453
+ h("store", "Snapshot applied", {
1451
1454
  mediaId: r,
1452
1455
  playing: a.playing ?? n.snapshot.playing,
1453
1456
  serverSeq: a.serverSeq ?? n.snapshot.serverSeq,
1454
1457
  userCount: a.users?.length ?? 0
1455
1458
  });
1456
- const s = a.playheadMs ?? n.snapshot.playheadMs;
1459
+ const l = a.playheadMs ?? n.snapshot.playheadMs;
1457
1460
  return {
1458
1461
  snapshot: {
1459
1462
  roomId: a.roomId !== void 0 ? a.roomId : n.snapshot.roomId,
1460
1463
  mediaId: r,
1461
- playheadMs: s,
1464
+ playheadMs: l,
1462
1465
  playing: a.playing ?? n.snapshot.playing,
1463
1466
  serverSeq: a.serverSeq ?? n.snapshot.serverSeq,
1464
1467
  leaderId: f
@@ -1472,25 +1475,25 @@ const ln = 6e3, G = Rt(), g = Qn((e, t) => ({
1472
1475
  };
1473
1476
  }),
1474
1477
  upsertUser: (a) => {
1475
- p("store", "User upserted", { clientId: a.clientId, name: a.name, isLeader: a.isLeader }), e((n) => ({ roster: { ...n.roster, [a.clientId]: a } }));
1478
+ h("store", "User upserted", { clientId: a.clientId, name: a.name, isLeader: a.isLeader }), e((n) => ({ roster: { ...n.roster, [a.clientId]: a } }));
1476
1479
  },
1477
1480
  removeUser: (a) => {
1478
- p("store", "User removed", { clientId: a }), e((n) => {
1481
+ h("store", "User removed", { clientId: a }), e((n) => {
1479
1482
  const o = { ...n.roster };
1480
1483
  return delete o[a], { roster: o };
1481
1484
  });
1482
1485
  },
1483
1486
  appendChat: (a) => {
1484
- p("chat", "Message appended", { id: a.id, from: a.name, isSystem: a.isSystem }), e((n) => {
1487
+ h("chat", "Message appended", { id: a.id, from: a.name, isSystem: a.isSystem }), e((n) => {
1485
1488
  if (a.isSystem || !(a.clientId in n.typing)) return { chat: [...n.chat, a].slice(-500) };
1486
1489
  const o = { ...n.typing };
1487
1490
  return delete o[a.clientId], { chat: [...n.chat, a].slice(-500), typing: o };
1488
1491
  });
1489
1492
  },
1490
- setChat: (a) => e((n) => ({ chat: sn(n.chat, a).slice(-500) })),
1493
+ setChat: (a) => e((n) => ({ chat: un(n.chat, a).slice(-500) })),
1491
1494
  setReplyingTo: (a) => e(() => ({ replyingTo: a })),
1492
1495
  setReactions: (a, n) => e((o) => {
1493
- const r = o.chat.findIndex((s) => s.id === a);
1496
+ const r = o.chat.findIndex((l) => l.id === a);
1494
1497
  if (r < 0) return {};
1495
1498
  const f = o.chat.slice();
1496
1499
  return f[r] = { ...f[r], reactions: n.length ? n : void 0 }, { chat: f };
@@ -1498,29 +1501,29 @@ const ln = 6e3, G = Rt(), g = Qn((e, t) => ({
1498
1501
  setTyping: (a, n) => e((o) => {
1499
1502
  if (!n && !(a in o.typing)) return {};
1500
1503
  const r = { ...o.typing };
1501
- return n ? r[a] = Date.now() + ln : delete r[a], { typing: r };
1504
+ return n ? r[a] = Date.now() + mn : delete r[a], { typing: r };
1502
1505
  }),
1503
1506
  jumpToMessage: (a) => e(() => ({ chatJump: { id: a, at: Date.now() } })),
1504
1507
  toggleChatCollapsed: () => e((a) => {
1505
1508
  const n = !a.chatCollapsed;
1506
- return Kt() || J("chatCollapsed", n), { chatCollapsed: n };
1509
+ return Jt() || Y("chatCollapsed", n), { chatCollapsed: n };
1507
1510
  }),
1508
1511
  applyTvDefaults: () => e(() => ({ chatCollapsed: !0 })),
1509
1512
  toggleChromeChatCollapsed: () => e((a) => {
1510
1513
  const n = !a.chromeChatCollapsed;
1511
- return J("chromeChatCollapsed", n), { chromeChatCollapsed: n };
1514
+ return Y("chromeChatCollapsed", n), { chromeChatCollapsed: n };
1512
1515
  }),
1513
1516
  setChromeChatWidth: (a) => e(() => {
1514
1517
  const n = Z(a);
1515
- return J("chromeChatWidth", n), { chromeChatWidth: n };
1518
+ return Y("chromeChatWidth", n), { chromeChatWidth: n };
1516
1519
  }),
1517
1520
  noteRecentEmoji: (a) => e((n) => {
1518
- const o = Dr(n.recentEmoji, a);
1519
- return J("recentEmoji", o), Or(), { recentEmoji: o };
1521
+ const o = qr(n.recentEmoji, a);
1522
+ return Y("recentEmoji", o), $r(), { recentEmoji: o };
1520
1523
  }),
1521
1524
  toggleFloatingChat: () => e((a) => {
1522
1525
  const n = !a.floatingChatEnabled;
1523
- return J("floatingChatEnabled", n), { floatingChatEnabled: n };
1526
+ return Y("floatingChatEnabled", n), { floatingChatEnabled: n };
1524
1527
  }),
1525
1528
  allocateClientSeq: () => {
1526
1529
  const a = t().me.nextClientSeq;
@@ -1528,7 +1531,7 @@ const ln = 6e3, G = Rt(), g = Qn((e, t) => ({
1528
1531
  },
1529
1532
  bumpLoadGeneration: () => e((a) => ({ loadGeneration: a.loadGeneration + 1 })),
1530
1533
  updateControlState: (a) => {
1531
- p("store", "updateControlState called", a), e((n) => ({
1534
+ h("store", "updateControlState called", a), e((n) => ({
1532
1535
  snapshot: { ...n.snapshot, ...a },
1533
1536
  // Always update snapshotReceivedAt — any control_broadcast from the
1534
1537
  // server resets the elapsed-time calculation. The old condition
@@ -1540,26 +1543,26 @@ const ln = 6e3, G = Rt(), g = Qn((e, t) => ({
1540
1543
  },
1541
1544
  addRttSample: (a, n, o) => e((r) => {
1542
1545
  const f = [...r.drift.rtts, a].slice(-5);
1543
- let s = r.drift.offsetMs;
1546
+ let l = r.drift.offsetMs;
1544
1547
  if (n && o) {
1545
1548
  const c = o + a / 2;
1546
- s = n - c;
1549
+ l = n - c;
1547
1550
  }
1548
- return { drift: { rtts: f, offsetMs: s } };
1551
+ return { drift: { rtts: f, offsetMs: l } };
1549
1552
  }),
1550
1553
  pushToast: (a, n) => {
1551
- p("store", "Toast pushed", { kind: a, msg: n }), e((o) => ({ toasts: [...o.toasts, { id: Math.random().toString(36).slice(2), kind: a, msg: n, ts: Date.now() }].slice(-5) }));
1554
+ h("store", "Toast pushed", { kind: a, msg: n }), e((o) => ({ toasts: [...o.toasts, { id: Math.random().toString(36).slice(2), kind: a, msg: n, ts: Date.now() }].slice(-5) }));
1552
1555
  },
1553
1556
  popToast: (a) => e((n) => ({ toasts: n.toasts.filter((o) => o.id !== a) })),
1554
1557
  setReadiness: (a) => e({ readiness: { mediaId: a.mediaId, ready: a.ready, readyCount: a.readyCount, total: a.total } }),
1555
1558
  setBufferState: (a) => e((n) => ({ bufferState: { ...n.bufferState, ...a } })),
1556
1559
  setMutedForAutoplay: (a) => e({ mutedForAutoplay: a }),
1557
1560
  // Media preference actions
1558
- setVolume: (a) => e((n) => (J("volume", a), { mediaPrefs: { ...n.mediaPrefs, volume: a } })),
1559
- setMuted: (a) => e((n) => (J("muted", a), { mediaPrefs: { ...n.mediaPrefs, muted: a } })),
1560
- setPreferredAudioLang: (a) => e((n) => (J("preferredAudioLang", a), { mediaPrefs: { ...n.mediaPrefs, preferredAudioLang: a } })),
1561
- setSubtitlesEnabled: (a) => e((n) => (J("subtitlesEnabled", a), { mediaPrefs: { ...n.mediaPrefs, subtitlesEnabled: a } })),
1562
- setSubtitleStyle: (a) => e((n) => (J("subtitleStyle", a), { mediaPrefs: { ...n.mediaPrefs, subtitleStyle: a } })),
1561
+ setVolume: (a) => e((n) => (Y("volume", a), { mediaPrefs: { ...n.mediaPrefs, volume: a } })),
1562
+ setMuted: (a) => e((n) => (Y("muted", a), { mediaPrefs: { ...n.mediaPrefs, muted: a } })),
1563
+ setPreferredAudioLang: (a) => e((n) => (Y("preferredAudioLang", a), { mediaPrefs: { ...n.mediaPrefs, preferredAudioLang: a } })),
1564
+ setSubtitlesEnabled: (a) => e((n) => (Y("subtitlesEnabled", a), { mediaPrefs: { ...n.mediaPrefs, subtitlesEnabled: a } })),
1565
+ setSubtitleStyle: (a) => e((n) => (Y("subtitleStyle", a), { mediaPrefs: { ...n.mediaPrefs, subtitleStyle: a } })),
1563
1566
  setHealthSnapshot: (a) => e({ healthSnapshot: a }),
1564
1567
  setBufferStatus: (a) => e({ bufferStatus: a }),
1565
1568
  applyPlaylistState: (a) => e({
@@ -1597,13 +1600,13 @@ const ln = 6e3, G = Rt(), g = Qn((e, t) => ({
1597
1600
  */
1598
1601
  moveTierlistItem: (a, n, o) => e((r) => {
1599
1602
  const f = {};
1600
- for (const [s, c] of Object.entries(r.tierlistDraft)) {
1603
+ for (const [l, c] of Object.entries(r.tierlistDraft)) {
1601
1604
  const u = (c ?? []).filter((m) => m !== a);
1602
- u.length > 0 && (f[s] = u);
1605
+ u.length > 0 && (f[l] = u);
1603
1606
  }
1604
1607
  if (n !== null) {
1605
- const s = f[n] ?? [], c = Math.max(0, Math.min(o ?? s.length, s.length));
1606
- s.splice(c, 0, a), f[n] = s;
1608
+ const l = f[n] ?? [], c = Math.max(0, Math.min(o ?? l.length, l.length));
1609
+ l.splice(c, 0, a), f[n] = l;
1607
1610
  }
1608
1611
  return { tierlistDraft: f };
1609
1612
  }),
@@ -1612,111 +1615,111 @@ const ln = 6e3, G = Rt(), g = Qn((e, t) => ({
1612
1615
  setGameSettings: (a) => e({ gameSettings: a }),
1613
1616
  setRoomKeyType: (a) => e({ roomKeyType: a }),
1614
1617
  rehydrateFromPrefs: () => e((a) => {
1615
- const n = Rt(), o = {};
1616
- if (n.chatCollapsed !== void 0 && !Kt() && (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)) {
1617
- const s = { ...a.mediaPrefs };
1618
- 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;
1618
+ const n = Dt(), o = {};
1619
+ if (n.chatCollapsed !== void 0 && !Jt() && (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 = kt(n.recentEmoji)), ["volume", "muted", "preferredAudioLang", "subtitlesEnabled", "subtitleStyle"].some((l) => n[l] !== void 0)) {
1620
+ const l = { ...a.mediaPrefs };
1621
+ n.volume !== void 0 && (l.volume = n.volume), n.muted !== void 0 && (l.muted = n.muted), n.preferredAudioLang !== void 0 && (l.preferredAudioLang = n.preferredAudioLang), n.subtitlesEnabled !== void 0 && (l.subtitlesEnabled = n.subtitlesEnabled), n.subtitleStyle !== void 0 && ["classic", "cinema", "minimal", "contrast"].includes(n.subtitleStyle) && (l.subtitleStyle = n.subtitleStyle), o.mediaPrefs = l;
1619
1622
  }
1620
1623
  return o;
1621
1624
  }),
1622
1625
  setSidebarTab: (a) => e((n) => n.sidebarTab === a && a !== "chat" ? { sidebarTab: "chat" } : { sidebarTab: a, chatCollapsed: !1 })
1623
1626
  }));
1624
- ot("__ZUSTAND_STORE__", g);
1625
- const cn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1627
+ it("__ZUSTAND_STORE__", g);
1628
+ const gn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1626
1629
  __proto__: null,
1627
- TYPING_EXPIRE_MS: ln,
1628
- mergeHistory: sn,
1630
+ TYPING_EXPIRE_MS: mn,
1631
+ mergeHistory: un,
1629
1632
  useAppStore: g
1630
- }, Symbol.toStringTag, { value: "Module" })), Fr = 250, zr = 1e3;
1631
- function wt(e) {
1633
+ }, Symbol.toStringTag, { value: "Module" })), Gr = 250, Kr = 1e3;
1634
+ function xt(e) {
1632
1635
  return {
1633
1636
  path: e,
1634
1637
  transports: ["websocket", "polling"],
1635
1638
  tryAllTransports: !0,
1636
- reconnectionDelay: Fr,
1637
- reconnectionDelayMax: zr
1639
+ reconnectionDelay: Gr,
1640
+ reconnectionDelayMax: Kr
1638
1641
  };
1639
1642
  }
1640
- const Wr = 5e3;
1641
- function Br(e, t, a) {
1643
+ const Vr = 5e3;
1644
+ function Yr(e, t, a) {
1642
1645
  return !!e?.some((n) => n.emoji === t && n.by.includes(a));
1643
1646
  }
1644
- function Gr(e, t, a) {
1647
+ function Jr(e, t, a) {
1645
1648
  let n = e ?? [];
1646
- for (const [o, r] of t) n = to(n, o, a, r.on) ?? n;
1649
+ for (const [o, r] of t) n = no(n, o, a, r.on) ?? n;
1647
1650
  return n;
1648
1651
  }
1649
- function Kr(e, t, a, n) {
1652
+ function Xr(e, t, a, n) {
1650
1653
  const o = /* @__PURE__ */ new Map();
1651
1654
  for (const [r, f] of t)
1652
- f.expires <= n || Br(e, r, a) !== f.on && o.set(r, f);
1655
+ f.expires <= n || Yr(e, r, a) !== f.on && o.set(r, f);
1653
1656
  return o;
1654
1657
  }
1655
- const Se = /* @__PURE__ */ new Map();
1656
- function Mt(e, t) {
1657
- if (t.intents = Kr(t.confirmed, t.intents, t.handle, Date.now()), g.getState().setReactions(e, Gr(t.confirmed, t.intents, t.handle)), t.timer && clearTimeout(t.timer), t.timer = null, t.intents.size === 0) {
1658
- Se.delete(e);
1658
+ const Te = /* @__PURE__ */ new Map();
1659
+ function Ot(e, t) {
1660
+ if (t.intents = Xr(t.confirmed, t.intents, t.handle, Date.now()), g.getState().setReactions(e, Jr(t.confirmed, t.intents, t.handle)), t.timer && clearTimeout(t.timer), t.timer = null, t.intents.size === 0) {
1661
+ Te.delete(e);
1659
1662
  return;
1660
1663
  }
1661
1664
  const a = Math.min(...[...t.intents.values()].map((n) => n.expires));
1662
1665
  t.timer = setTimeout(() => {
1663
- Se.get(e) === t && Mt(e, t);
1666
+ Te.get(e) === t && Ot(e, t);
1664
1667
  }, Math.max(0, a - Date.now()));
1665
1668
  }
1666
- function Vr(e, t, a, n) {
1667
- let o = Se.get(e);
1668
- o || (o = { confirmed: g.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() + Wr }), Mt(e, o);
1669
+ function Qr(e, t, a, n) {
1670
+ let o = Te.get(e);
1671
+ o || (o = { confirmed: g.getState().chat.find((f) => f.id === e)?.reactions, intents: /* @__PURE__ */ new Map(), handle: n, timer: null }, Te.set(e, o)), o.handle = n, o.intents.delete(t), o.intents.set(t, { on: a, expires: Date.now() + Vr }), Ot(e, o);
1669
1672
  }
1670
- function Yr(e, t) {
1671
- const a = Se.get(e);
1673
+ function Zr(e, t) {
1674
+ const a = Te.get(e);
1672
1675
  if (!a) {
1673
1676
  g.getState().setReactions(e, t);
1674
1677
  return;
1675
1678
  }
1676
- a.confirmed = t, Mt(e, a);
1679
+ a.confirmed = t, Ot(e, a);
1677
1680
  }
1678
- function dn(e) {
1681
+ function hn(e) {
1679
1682
  const t = typeof window < "u" ? window.location.href : "http://localhost/", a = new URL(e, t).pathname;
1680
1683
  return `${a.endsWith("/") ? a : `${a}/`}socket.io/`;
1681
1684
  }
1682
- function Jr(e) {
1685
+ function ei(e) {
1683
1686
  const t = typeof window < "u" ? window.location.href : "http://localhost/", a = e.namespace ?? "/chat";
1684
1687
  return {
1685
1688
  url: `${new URL(e.origin, t).origin}${a.startsWith("/") ? a : `/${a}`}`,
1686
- path: e.path ?? dn(e.origin)
1689
+ path: e.path ?? hn(e.origin)
1687
1690
  };
1688
1691
  }
1689
- let Q = null, X = null, We = null;
1690
- function na(e) {
1691
- e && Q && e.origin === Q.origin && e.path === Q.path && e.namespace === Q.namespace || !e && !Q || (mn(), Q = e);
1692
+ let Q = null, J = null, Ge = null;
1693
+ function ia(e) {
1694
+ e && Q && e.origin === Q.origin && e.path === Q.path && e.namespace === Q.namespace || !e && !Q || (bn(), Q = e);
1692
1695
  }
1693
- function Ie() {
1696
+ function Ae() {
1694
1697
  return Q !== null;
1695
1698
  }
1696
- function Xr(e) {
1699
+ function ti(e) {
1697
1700
  if (Q)
1698
- if (We = e, X)
1699
- X.connected && X.emit(T.JOIN, e);
1701
+ if (Ge = e, J)
1702
+ J.connected && J.emit(T.JOIN, e);
1700
1703
  else {
1701
- const { url: t, path: a } = Jr(Q), n = gt(t, wt(a));
1702
- X = n, p("chat", "External chat socket", { url: t, path: a }), hn(n), n.on(T.ERROR, (o) => {
1704
+ const { url: t, path: a } = ei(Q), n = bt(t, xt(a));
1705
+ J = n, h("chat", "External chat socket", { url: t, path: a }), _n(n), n.on(T.ERROR, (o) => {
1703
1706
  const r = o?.message || o?.code || "chat error";
1704
1707
  L("chat", `Chat server error: ${r}`, { code: o?.code }), g.getState().pushToast("error", r);
1705
1708
  }), n.on("connect", () => {
1706
- We && n.emit(T.JOIN, We);
1709
+ Ge && n.emit(T.JOIN, Ge);
1707
1710
  }), n.on("connect_error", (o) => L("chat", "Chat connection error", { message: o?.message }));
1708
1711
  }
1709
1712
  }
1710
- function Qr(e) {
1711
- X?.emit(T.CHAT_SEND, e);
1713
+ function ai(e) {
1714
+ J?.emit(T.CHAT_SEND, e);
1712
1715
  }
1713
- function un(e, t) {
1714
- X?.connected && X.emit(e, t);
1716
+ function pn(e, t) {
1717
+ J?.connected && J.emit(e, t);
1715
1718
  }
1716
- function mn() {
1717
- We = null, X && (X.disconnect(), X = null);
1719
+ function bn() {
1720
+ Ge = null, J && (J.disconnect(), J = null);
1718
1721
  }
1719
- function oa(e, t) {
1722
+ function fa(e, t) {
1720
1723
  return {
1721
1724
  id: String(e.id ?? e.server_seq ?? t ?? `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`),
1722
1725
  clientId: e.client_id,
@@ -1728,15 +1731,15 @@ function oa(e, t) {
1728
1731
  // Attachments arrive from other clients, so the key shape is re-checked
1729
1732
  // here at the boundary rather than trusted at render time. A malformed
1730
1733
  // entry is dropped, not rendered and not allowed near an <img src>.
1731
- images: Array.isArray(e.images) ? e.images.filter((a) => !!a && St(a.key)).slice(0, ae) : void 0,
1734
+ images: Array.isArray(e.images) ? e.images.filter((a) => !!a && Et(a.key)).slice(0, te) : void 0,
1732
1735
  isSystem: e.isSystem || !1,
1733
1736
  systemType: e.systemType,
1734
- template: e.isSystem && typeof e.template == "string" && e.template.includes(Tt) ? e.template : void 0,
1735
- replyTo: typeof e.reply_to == "string" && ja.test(e.reply_to) ? e.reply_to : void 0,
1736
- reactions: gn(e.reactions)
1737
+ template: e.isSystem && typeof e.template == "string" && e.template.includes(It) ? e.template : void 0,
1738
+ replyTo: typeof e.reply_to == "string" && Da.test(e.reply_to) ? e.reply_to : void 0,
1739
+ reactions: yn(e.reactions)
1737
1740
  };
1738
1741
  }
1739
- function gn(e) {
1742
+ function yn(e) {
1740
1743
  if (!Array.isArray(e)) return;
1741
1744
  const t = e.filter((a) => {
1742
1745
  const n = a;
@@ -1744,101 +1747,101 @@ function gn(e) {
1744
1747
  });
1745
1748
  return t.length ? t : void 0;
1746
1749
  }
1747
- function hn(e, t = () => !0) {
1750
+ function _n(e, t = () => !0) {
1748
1751
  e.on(T.CHAT_BROADCAST, (a) => {
1749
1752
  if (!t()) return;
1750
- const n = { ...oa(a, a.server_seq), live: !0 };
1751
- g.getState().appendChat(n), p("chat", "Message received", n);
1753
+ const n = { ...fa(a, a.server_seq), live: !0 };
1754
+ g.getState().appendChat(n), h("chat", "Message received", n);
1752
1755
  }), e.on(T.CHAT_HISTORY, (a) => {
1753
1756
  if (!t() || !a?.messages || !Array.isArray(a.messages)) return;
1754
- const n = a.messages.map((o) => oa(o));
1755
- g.getState().setChat(n), p("chat", "History loaded", { count: n.length });
1757
+ const n = a.messages.map((o) => fa(o));
1758
+ g.getState().setChat(n), h("chat", "History loaded", { count: n.length });
1756
1759
  }), e.on(T.CHAT_REACTION, (a) => {
1757
- t() && (!a || typeof a.id != "string" || Yr(a.id, gn(a.reactions) ?? []));
1760
+ t() && (!a || typeof a.id != "string" || Zr(a.id, yn(a.reactions) ?? []));
1758
1761
  }), e.on(T.CHAT_TYPING, (a) => {
1759
1762
  t() && (!a || typeof a.client_id != "string" || typeof a.typing != "boolean" || g.getState().setTyping(a.client_id, a.typing));
1760
1763
  });
1761
1764
  }
1762
- let pn = null;
1763
- function Zr(e) {
1764
- pn = e;
1765
+ let wn = null;
1766
+ function ni(e) {
1767
+ wn = e;
1765
1768
  }
1766
- function ei(e = pn) {
1769
+ function oi(e = wn) {
1767
1770
  if (!e) return null;
1768
1771
  const t = typeof window < "u" ? window.location.href : "http://localhost/", a = e.namespace ?? "/room";
1769
1772
  return {
1770
1773
  url: `${new URL(e.origin, t).origin}${a.startsWith("/") ? a : `/${a}`}`,
1771
- path: e.path ?? dn(e.origin)
1774
+ path: e.path ?? hn(e.origin)
1772
1775
  };
1773
1776
  }
1774
- function ti(e) {
1775
- return `${Fa()}/media/${e}`.replace(/\\/g, "/");
1777
+ function ri(e) {
1778
+ return `${Ga()}/media/${e}`.replace(/\\/g, "/");
1776
1779
  }
1777
- function ai(e, t) {
1778
- return ti(t ?? `${e}/poster.jpg`);
1780
+ function ii(e, t) {
1781
+ return ri(t ?? `${e}/poster.jpg`);
1779
1782
  }
1780
- function ni(e) {
1781
- return `${Fa()}${e}`.replace(/\\/g, "/");
1783
+ function fi(e) {
1784
+ return `${Ga()}${e}`.replace(/\\/g, "/");
1782
1785
  }
1783
- async function oi(e) {
1786
+ async function si(e) {
1784
1787
  try {
1785
- const t = await fetch(ni("/api/tierlist"));
1788
+ const t = await fetch(fi("/api/tierlist"));
1786
1789
  if (!t.ok)
1787
1790
  return L("tierlist", "Board fetch failed", { status: t.status }), null;
1788
1791
  const a = await t.json();
1789
- return g.getState().setTierlistSnapshot(a, e), p("tierlist", "Board loaded", {
1792
+ return g.getState().setTierlistSnapshot(a, e), h("tierlist", "Board loaded", {
1790
1793
  items: a.items.length,
1791
1794
  voters: a.voterCount,
1792
1795
  placed: a.placed.length
1793
1796
  }), a;
1794
1797
  } catch (t) {
1795
- return L("tierlist", "Board fetch threw", Ee(t)), null;
1798
+ return L("tierlist", "Board fetch threw", Ie(t)), null;
1796
1799
  }
1797
1800
  }
1798
- let ra = !1;
1799
- function ri() {
1800
- if (ra || typeof Image > "u") return;
1801
+ let sa = !1;
1802
+ function li() {
1803
+ if (sa || typeof Image > "u") return;
1801
1804
  const e = g.getState().tierlist;
1802
1805
  if (!(!e || e.items.length === 0)) {
1803
- ra = !0;
1806
+ sa = !0;
1804
1807
  for (const t of e.items) {
1805
1808
  const a = new Image();
1806
- a.decoding = "async", a.src = ai(t.id, t.thumbnail);
1809
+ a.decoding = "async", a.src = ii(t.id, t.thumbnail);
1807
1810
  }
1808
- p("tierlist", "Warming posters", { count: e.items.length });
1811
+ h("tierlist", "Warming posters", { count: e.items.length });
1809
1812
  }
1810
1813
  }
1811
- function ii() {
1812
- const e = g.getState(), t = xa(Object.values(e.roster).map((o) => o.sprite), void 0, Ze);
1814
+ function ci() {
1815
+ const e = g.getState(), t = Ea(Object.values(e.roster).map((o) => o.sprite), void 0, tt);
1813
1816
  if (!t)
1814
1817
  return L("socket", "sprite_taken: no available sprites to retry with"), null;
1815
- const a = !!e.name && !le(e.name), n = a ? e.name : xe(t);
1816
- 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 };
1818
+ const a = !!e.name && !se(e.name), n = a ? e.name : Se(t);
1819
+ return h("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 };
1817
1820
  }
1818
- function fi(e) {
1821
+ function di(e) {
1819
1822
  const t = g.getState(), a = e ? t.roster[e] : void 0;
1820
1823
  return !a || !!a.sprite && a.sprite === t.sprite;
1821
1824
  }
1822
- const si = "hadoku:name";
1823
- function li(e) {
1824
- const t = ro(e);
1825
- return et(t) ? t : null;
1825
+ const ui = "hadoku:name";
1826
+ function mi(e) {
1827
+ const t = fo(e);
1828
+ return at(t) ? t : null;
1826
1829
  }
1827
- async function ci(e = {}) {
1828
- const t = await oo({
1830
+ async function gi(e = {}) {
1831
+ const t = await io({
1829
1832
  ...e,
1830
- onError: (n) => L("avatar", "Avatar settings read failed — keeping the auto-assigned character", Ee(n))
1831
- }), a = et(t) ? t : null;
1832
- return p("avatar", "Requested character from prefs-api", { sprite: a }), a;
1833
+ onError: (n) => L("avatar", "Avatar settings read failed — keeping the auto-assigned character", Ie(n))
1834
+ }), a = at(t) ? t : null;
1835
+ return h("avatar", "Requested character from prefs-api", { sprite: a }), a;
1833
1836
  }
1834
- function ia(e) {
1837
+ function la(e) {
1835
1838
  if (!e) return !1;
1836
1839
  const t = g.getState();
1837
1840
  if (t.sprite === e) return !1;
1838
- const n = !!(t.me.clientId && t.roster[t.me.clientId]?.registryName) || !t.name || !le(t.name) ? t.name : xe(e);
1841
+ const n = !!(t.me.clientId && t.roster[t.me.clientId]?.registryName) || !t.name || !se(t.name) ? t.name : Se(e);
1839
1842
  return t.setSessionIdentity(n, e), !0;
1840
1843
  }
1841
- function di(e, t, a) {
1844
+ function hi(e, t, a) {
1842
1845
  if (!a) return () => {
1843
1846
  };
1844
1847
  const n = (o) => {
@@ -1847,26 +1850,26 @@ function di(e, t, a) {
1847
1850
  };
1848
1851
  return a.addEventListener(e, n), () => a.removeEventListener(e, n);
1849
1852
  }
1850
- const ui = () => typeof window > "u" ? void 0 : window;
1851
- function mi(e, t = ui()) {
1852
- return di(si, (a) => {
1853
+ const pi = () => typeof window > "u" ? void 0 : window;
1854
+ function bi(e, t = pi()) {
1855
+ return hi(ui, (a) => {
1853
1856
  typeof a.name == "string" && a.name.trim() && e(a.name);
1854
1857
  }, t);
1855
1858
  }
1856
- const gi = 10;
1857
- function hi(e = typeof window < "u" ? window : void 0) {
1859
+ const yi = 10;
1860
+ function _i(e = typeof window < "u" ? window : void 0) {
1858
1861
  if (!e) return { framed: !1, depth: 0 };
1859
1862
  try {
1860
1863
  let t = 0, a = e;
1861
- for (; a !== a.parent && t < gi; )
1864
+ for (; a !== a.parent && t < yi; )
1862
1865
  t++, a = a.parent;
1863
1866
  return { framed: e.top ? e.top !== e.self : t > 0, depth: t };
1864
1867
  } catch {
1865
1868
  return { framed: !1, depth: 0 };
1866
1869
  }
1867
1870
  }
1868
- const pi = "watchparty_fragment_delivery";
1869
- function bi() {
1871
+ const wi = "watchparty_fragment_delivery";
1872
+ function vi() {
1870
1873
  if (typeof window > "u") return null;
1871
1874
  try {
1872
1875
  const e = new URLSearchParams(window.location.search).get("fragmentDelivery");
@@ -1874,195 +1877,195 @@ function bi() {
1874
1877
  if (e === "0" || e === "false") return !1;
1875
1878
  } catch {
1876
1879
  }
1877
- return ar(pi);
1880
+ return ir(wi);
1878
1881
  }
1879
- let yi = { ...La }, ft = null;
1880
- const fa = "watchparty_delivery_client_id";
1881
- function _i() {
1882
- const e = B(fa);
1882
+ let ki = { ...Ua }, lt = null;
1883
+ const ca = "watchparty_delivery_client_id";
1884
+ function xi() {
1885
+ const e = B(ca);
1883
1886
  if (e) return e;
1884
1887
  const t = globalThis.crypto?.randomUUID?.() ?? `d${Math.random().toString(36).slice(2)}`;
1885
- return It(fa, t) ? t : "";
1888
+ return jt(ca, t) ? t : "";
1886
1889
  }
1887
- function wi() {
1888
- return ft === null && (ft = Po(yi, _i(), bi())), ft;
1890
+ function Si() {
1891
+ return lt === null && (lt = Oo(ki, xi(), vi())), lt;
1889
1892
  }
1890
- function vi() {
1891
- return wi();
1893
+ function Ti() {
1894
+ return Si();
1892
1895
  }
1893
- let Be;
1894
- function bn() {
1895
- return B(Xn) || void 0;
1896
+ let Ke;
1897
+ function vn() {
1898
+ return B(Zn) || void 0;
1896
1899
  }
1897
- function ki() {
1898
- if (Be) return;
1899
- const e = bn();
1900
+ function Ci() {
1901
+ if (Ke) return;
1902
+ const e = vn();
1900
1903
  if (e) {
1901
- Be = e;
1904
+ Ke = e;
1902
1905
  return;
1903
1906
  }
1904
- Jn().then((t) => {
1905
- t && (Be = t);
1907
+ Qn().then((t) => {
1908
+ t && (Ke = t);
1906
1909
  }).catch(() => {
1907
- p("identity", "device id unavailable — joining without one");
1910
+ h("identity", "device id unavailable — joining without one");
1908
1911
  });
1909
1912
  }
1910
- function xi() {
1911
- return Be ??= bn();
1913
+ function Ei() {
1914
+ return Ke ??= vn();
1912
1915
  }
1913
- function Si(e, t) {
1916
+ function Ii(e, t) {
1914
1917
  let a = 0;
1915
1918
  for (const n of e.videos) {
1916
- const o = oe.voteKey(t, e.id, n.mediaId);
1917
- globalThis.localStorage?.getItem(o) != null && a++, ve(o);
1919
+ const o = ne.voteKey(t, e.id, n.mediaId);
1920
+ globalThis.localStorage?.getItem(o) != null && a++, ke(o);
1918
1921
  }
1919
1922
  return a;
1920
1923
  }
1921
- const Ti = 2e4, Ci = 1e4;
1922
- function Ei() {
1924
+ const Ai = 2e4, Ni = 1e4;
1925
+ function ji() {
1923
1926
  return { unansweredSince: null, lastPongAt: null, lastTickAt: null };
1924
1927
  }
1925
- function Ii(e, t) {
1928
+ function Ri(e, t) {
1926
1929
  e.lastPongAt = t, e.unansweredSince = null;
1927
1930
  }
1928
- function Ai(e, t, a) {
1929
- const n = e.lastTickAt !== null && t - e.lastTickAt > Ci;
1930
- return e.lastTickAt = t, a ? n || e.unansweredSince === null ? (e.unansweredSince = t, !1) : t - e.unansweredSince > Ti : (e.unansweredSince = null, !1);
1931
+ function Pi(e, t, a) {
1932
+ const n = e.lastTickAt !== null && t - e.lastTickAt > Ni;
1933
+ return e.lastTickAt = t, a ? n || e.unansweredSince === null ? (e.unansweredSince = t, !1) : t - e.unansweredSince > Ai : (e.unansweredSince = null, !1);
1931
1934
  }
1932
- function Ni(e, t) {
1935
+ function Mi(e, t) {
1933
1936
  return e.lastPongAt === null ? void 0 : Math.max(0, t - e.lastPongAt);
1934
1937
  }
1935
- let C = null, K = null, Ge = null, V = null, ee = null;
1936
- const yn = ao({ storageKey: "watchparty:tab-id" });
1937
- yn.settledTabId();
1938
- let vt = 0;
1939
- const de = Ei();
1940
- let Oe = null, st = null, sa = 0, Dt = null, Te = !1, Lt = !1, he = !1, _n = null;
1941
- function ji(e) {
1942
- const t = re(), a = g.getState();
1938
+ let I = null, K = null, Ve = null, V = null, ee = null;
1939
+ const kn = oo({ storageKey: "watchparty:tab-id" });
1940
+ kn.settledTabId();
1941
+ let St = 0;
1942
+ const ue = ji();
1943
+ let qe = null, ct = null, da = 0, Ht = null, Ce = !1, qt = !1, pe = !1, xn = null;
1944
+ function Di(e) {
1945
+ const t = oe(), a = g.getState();
1943
1946
  if (a.me.clientId && a.roster[a.me.clientId])
1944
- 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;
1945
- const n = ++vt;
1946
- return yn.withSettledTabId((o) => {
1947
- if (n !== vt) return;
1948
- const r = Ri(e, o);
1949
- ee = r, Dt = { name: r.name, sprite: r.sprite }, Ie() && Xr(r), t.connected ? (p("socket", "Emitting join", r), t.emit(T.JOIN, r)) : t.once("connect", () => {
1950
- p("socket", "Emitting join", r), t.emit(T.JOIN, r);
1947
+ return (e.name || e.sprite) && (h("socket", "Identity update (already joined)", { name: e.name, sprite: e.sprite }), t.emit(T.IDENTITY_UPDATE, { name: e.name, sprite: e.sprite })), t;
1948
+ const n = ++St;
1949
+ return kn.withSettledTabId((o) => {
1950
+ if (n !== St) return;
1951
+ const r = Li(e, o);
1952
+ ee = r, Ht = { name: r.name, sprite: r.sprite }, Ae() && ti(r), t.connected ? (h("socket", "Emitting join", r), t.emit(T.JOIN, r)) : t.once("connect", () => {
1953
+ h("socket", "Emitting join", r), t.emit(T.JOIN, r);
1951
1954
  });
1952
1955
  }), t;
1953
1956
  }
1954
- function Ri(e, t) {
1957
+ function Li(e, t) {
1955
1958
  return {
1956
1959
  room_key: e.room_key,
1957
1960
  name: e.name,
1958
1961
  sprite: e.sprite,
1959
1962
  // Entry-path telemetry — see lib/embedContext.ts. Sent on every join AND
1960
1963
  // rejoin (lastJoinPayload carries it), so a reconnect keeps the attribution.
1961
- embed: hi(),
1962
- delivery_arm: vi(),
1964
+ embed: _i(),
1965
+ delivery_arm: Ti(),
1963
1966
  // Identity tier input — see lib/deviceId.ts. Sent on every join AND rejoin
1964
1967
  // (lastJoinPayload carries it) so a reconnect lands on the same
1965
1968
  // ParticipantId rather than minting a new person.
1966
- device_id: xi(),
1969
+ device_id: Ei(),
1967
1970
  tab_id: t
1968
1971
  };
1969
1972
  }
1970
- function re() {
1971
- if (!C) {
1972
- let t = Ce().serverOrigin || "/";
1973
- const a = t === "/" ? Va() : null;
1974
- a !== null && (t = a, p("socket", "Using dev fallback origin", { origin: t }));
1975
- const n = ei();
1973
+ function oe() {
1974
+ if (!I) {
1975
+ let t = Ee().serverOrigin || "/";
1976
+ const a = t === "/" ? Qa() : null;
1977
+ a !== null && (t = a, h("socket", "Using dev fallback origin", { origin: t }));
1978
+ const n = oi();
1976
1979
  if (n)
1977
- C = gt(n.url, wt(n.path)), p("socket", "Socket initialized on the room origin", n);
1980
+ I = bt(n.url, xt(n.path)), h("socket", "Socket initialized on the room origin", n);
1978
1981
  else {
1979
1982
  const o = new URL(t.startsWith("http") ? t : `${window.location.origin}${t}`).origin;
1980
- C = gt(o, wt(co)), p("socket", "Socket initialized", { origin: t });
1983
+ I = bt(o, xt(ho)), h("socket", "Socket initialized", { origin: t });
1981
1984
  }
1982
- ot("__SOCKET__", C), V && (clearTimeout(V), V = null), K = null, Ge = setInterval(() => {
1983
- if (Ai(de, Date.now(), !!C?.connected)) {
1985
+ it("__SOCKET__", I), V && (clearTimeout(V), V = null), K = null, Ve = setInterval(() => {
1986
+ if (Pi(ue, Date.now(), !!I?.connected)) {
1984
1987
  L("socket", "PONG-WATCHDOG no time_pong for 20s — replacing the connection", {
1985
- sid: C?.id,
1986
- lastPongAgeMs: Ni(de, Date.now()) ?? null
1987
- }), st = "pong-watchdog", de.unansweredSince = null, C?.io.engine?.close();
1988
+ sid: I?.id,
1989
+ lastPongAgeMs: Mi(ue, Date.now()) ?? null
1990
+ }), ct = "pong-watchdog", ue.unansweredSince = null, I?.io.engine?.close();
1988
1991
  return;
1989
1992
  }
1990
- Bi();
1991
- }, Io), C.on("connect", () => {
1992
- Lt = !1;
1993
- const o = C?.id;
1994
- if (p("socket", "Connected", { id: o, isReconnect: he }), o)
1993
+ Yi();
1994
+ }, Ro), I.on("connect", () => {
1995
+ qt = !1;
1996
+ const o = I?.id;
1997
+ if (h("socket", "Connected", { id: o, isReconnect: pe }), o)
1995
1998
  try {
1996
- g.getState().ensureMe(o), g.setState((r) => ({ me: { ...r.me, nextClientSeq: 1 } })), p("socket", "Reset client sequence for new connection");
1999
+ g.getState().ensureMe(o), g.setState((r) => ({ me: { ...r.me, nextClientSeq: 1 } })), h("socket", "Reset client sequence for new connection");
1997
2000
  } catch (r) {
1998
- ze("socket", "Failed to initialize store on connect", { error: r.message, sid: o });
2001
+ Be("socket", "Failed to initialize store on connect", { error: r.message, sid: o });
1999
2002
  }
2000
- if (he && ee) {
2003
+ if (pe && ee) {
2001
2004
  const r = g.getState();
2002
- sa += 1;
2005
+ da += 1;
2003
2006
  const f = {
2004
2007
  ...ee,
2005
2008
  name: r.name,
2006
2009
  sprite: r.sprite,
2007
2010
  reconnect: {
2008
- count: sa,
2009
- reason: (Oe?.reason ?? "unknown").slice(0, 64),
2010
- offline_ms: Oe ? Math.max(0, Date.now() - Oe.at) : 0
2011
+ count: da,
2012
+ reason: (qe?.reason ?? "unknown").slice(0, 64),
2013
+ offline_ms: qe ? Math.max(0, Date.now() - qe.at) : 0
2011
2014
  }
2012
- }, s = _n;
2013
- if (p("socket", "Re-emitting join after reconnect", { room_key: f.room_key, name: f.name, sprite: f.sprite }), s) {
2015
+ }, l = xn;
2016
+ if (h("socket", "Re-emitting join after reconnect", { room_key: f.room_key, name: f.name, sprite: f.sprite }), l) {
2014
2017
  let c = !1;
2015
2018
  const u = () => {
2016
- c || (c = !0, C.off(T.SNAPSHOT, u), C.emit(T.CLIENT_READY, { media_id: s }), p("socket", "Re-emitted client_ready after reconnect snapshot", { mediaId: s }));
2019
+ c || (c = !0, I.off(T.SNAPSHOT, u), I.emit(T.CLIENT_READY, { media_id: l }), h("socket", "Re-emitted client_ready after reconnect snapshot", { mediaId: l }));
2017
2020
  };
2018
- C.on(T.SNAPSHOT, u), setTimeout(() => {
2019
- c || (c = !0, C.off(T.SNAPSHOT, u), L("socket", "client_ready re-emit timed out waiting for snapshot", { mediaId: s }));
2021
+ I.on(T.SNAPSHOT, u), setTimeout(() => {
2022
+ c || (c = !0, I.off(T.SNAPSHOT, u), L("socket", "client_ready re-emit timed out waiting for snapshot", { mediaId: l }));
2020
2023
  }, 1e4);
2021
2024
  }
2022
- Dt = { name: f.name, sprite: f.sprite }, C.emit(T.JOIN, f), window.dispatchEvent(new CustomEvent("watchparty:socket-reconnect"));
2023
- } else he && L("socket", "Reconnected — no join payload, not re-joining any room");
2024
- he = !0;
2025
- }), C.on("disconnect", (o) => {
2026
- Qa(null), Oe = { reason: st ?? o, at: Date.now() }, st = null, p("socket", "Disconnected", { reason: o });
2027
- }), C.on("connect_error", (o) => ze("socket", "Connection error", { message: o?.message })), C.on("reconnect_attempt", (o) => L("socket", "Reconnect attempt", { attempt: o })), C.on("reconnect_failed", () => ze("socket", "Reconnect failed")), $i(C);
2025
+ Ht = { name: f.name, sprite: f.sprite }, I.emit(T.JOIN, f), window.dispatchEvent(new CustomEvent("watchparty:socket-reconnect"));
2026
+ } else pe && L("socket", "Reconnected — no join payload, not re-joining any room");
2027
+ pe = !0;
2028
+ }), I.on("disconnect", (o) => {
2029
+ an(null), qe = { reason: ct ?? o, at: Date.now() }, ct = null, h("socket", "Disconnected", { reason: o });
2030
+ }), I.on("connect_error", (o) => Be("socket", "Connection error", { message: o?.message })), I.on("reconnect_attempt", (o) => L("socket", "Reconnect attempt", { attempt: o })), I.on("reconnect_failed", () => Be("socket", "Reconnect failed")), Bi(I);
2028
2031
  }
2029
- return C;
2032
+ return I;
2030
2033
  }
2031
- function lt(e) {
2034
+ function dt(e) {
2032
2035
  return e.play_state === "playing" || e.playing === !0;
2033
2036
  }
2034
- function Pi(e) {
2037
+ function Oi(e) {
2035
2038
  e.on(T.SNAPSHOT, (t) => {
2036
- e.emit(Da.SYNC), g.getState().applySnapshot({
2039
+ e.emit(qa.SYNC), g.getState().applySnapshot({
2037
2040
  roomId: t.room_id ?? null,
2038
2041
  mediaId: t.media_id ?? null,
2039
2042
  playheadMs: t.playhead_ms || 0,
2040
- playing: lt(t),
2043
+ playing: dt(t),
2041
2044
  serverSeq: t.server_seq || 0,
2042
2045
  leaderId: t.leader_id || null
2043
- }), g.getState().name || p("socket", "Deferring identity to presence event (snapshot carries no roster)");
2044
- const a = g.getState(), n = C?.id, r = (n ? a.roster[n] : void 0) ?? Dt, f = no(
2046
+ }), g.getState().name || h("socket", "Deferring identity to presence event (snapshot carries no roster)");
2047
+ const a = g.getState(), n = I?.id, r = (n ? a.roster[n] : void 0) ?? Ht, f = ro(
2045
2048
  { name: a.name, avatarId: a.sprite },
2046
2049
  r ? { name: r.name, avatarId: r.sprite ?? null } : void 0,
2047
2050
  // A join that carried no name counts as a default one, so a name that
2048
2051
  // landed after the join (prefs) is still asserted.
2049
- (s) => s === "" || le(s)
2052
+ (l) => l === "" || se(l)
2050
2053
  );
2051
2054
  if (f) {
2052
- const s = {
2055
+ const l = {
2053
2056
  ...f.name !== void 0 ? { name: f.name } : {},
2054
- ...f.avatarId !== void 0 && !Lt ? { sprite: f.avatarId } : {}
2057
+ ...f.avatarId !== void 0 && !qt ? { sprite: f.avatarId } : {}
2055
2058
  };
2056
- Object.keys(s).length > 0 && (p("socket", "Identity update on snapshot", s), e.emit(T.IDENTITY_UPDATE, s));
2059
+ Object.keys(l).length > 0 && (h("socket", "Identity update on snapshot", l), e.emit(T.IDENTITY_UPDATE, l));
2057
2060
  }
2058
- p("socket", "Received snapshot", {
2061
+ h("socket", "Received snapshot", {
2059
2062
  mediaId: t.media_id ?? null,
2060
2063
  playheadMs: t.playhead_ms || 0,
2061
- playing: lt(t),
2064
+ playing: dt(t),
2062
2065
  leaderId: t.leader_id || null,
2063
2066
  serverSeq: t.server_seq || 0,
2064
2067
  rosterSize: Object.keys(a.roster).length
2065
- }), ee?.room_key && C?.id && Qa({ room_key: ee.room_key, client_id: C.id });
2068
+ }), ee?.room_key && I?.id && an({ room_key: ee.room_key, client_id: I.id });
2066
2069
  }), e.on(T.CONTROL_BROADCAST, (t) => {
2067
2070
  const a = g.getState();
2068
2071
  if (Object.prototype.hasOwnProperty.call(t, "media_id")) {
@@ -2071,10 +2074,10 @@ function Pi(e) {
2071
2074
  }
2072
2075
  a.updateControlState({
2073
2076
  playheadMs: t.playhead_ms,
2074
- playing: lt(t),
2077
+ playing: dt(t),
2075
2078
  serverSeq: t.server_seq,
2076
2079
  leaderId: t.leader_id ?? a.snapshot.leaderId
2077
- }), p("socket", "Control broadcast received", {
2080
+ }), h("socket", "Control broadcast received", {
2078
2081
  kind: t.kind,
2079
2082
  serverSeq: t.server_seq,
2080
2083
  playheadMs: t.playhead_ms,
@@ -2082,121 +2085,121 @@ function Pi(e) {
2082
2085
  mediaId: t.media_id
2083
2086
  });
2084
2087
  }), e.on(T.CONTROL_ACK, (t) => {
2085
- typeof t?.client_seq == "number" && typeof t?.server_seq == "number" && p("socket", "Control ack received", t);
2088
+ typeof t?.client_seq == "number" && typeof t?.server_seq == "number" && h("socket", "Control ack received", t);
2086
2089
  }), e.on(T.TIME_PONG, (t) => {
2087
- if (Ii(de, Date.now()), K && K.ts) {
2090
+ if (Ri(ue, Date.now()), K && K.ts) {
2088
2091
  const a = Date.now() - K.ts;
2089
- g.getState().addRttSample(a, t?.server_ts, K.ts), K = null, V && (clearTimeout(V), V = null), p("socket", "Time sync RTT", { rtt: a, offset: g.getState().drift.offsetMs });
2092
+ g.getState().addRttSample(a, t?.server_ts, K.ts), K = null, V && (clearTimeout(V), V = null), h("socket", "Time sync RTT", { rtt: a, offset: g.getState().drift.offsetMs });
2090
2093
  }
2091
2094
  }), e.on(T.READY_STATE, (t) => {
2092
2095
  if (!t) return;
2093
2096
  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;
2094
- g.getState().setReadiness({ mediaId: a, ready: r, readyCount: n, total: o }), p("socket", "Ready state received", { mediaId: a, readyCount: n, total: o, ready: r });
2097
+ g.getState().setReadiness({ mediaId: a, ready: r, readyCount: n, total: o }), h("socket", "Ready state received", { mediaId: a, readyCount: n, total: o, ready: r });
2095
2098
  });
2096
2099
  }
2097
- function Mi(e) {
2098
- const t = zn(e);
2100
+ function Hi(e) {
2101
+ const t = Bn(e);
2099
2102
  return t ? { cosmetics: t } : {};
2100
2103
  }
2101
- function Di(e) {
2104
+ function qi(e) {
2102
2105
  e.on(T.PRESENCE, (t) => {
2103
2106
  if (!t) return;
2104
2107
  if (Array.isArray(t.users)) {
2105
2108
  const n = {};
2106
- for (const s of t.users)
2107
- n[s.client_id] = {
2108
- clientId: s.client_id,
2109
- ...s.author ? { author: s.author } : {},
2110
- name: s.name || "Anon",
2111
- sprite: s.sprite_id ?? s.sprite ?? null,
2112
- isLeader: s.is_leader,
2113
- ...s.registry_name ? { registryName: !0 } : {},
2114
- ...s.avatar_url ? { avatarUrl: s.avatar_url } : {},
2115
- ...Mi(s.cosmetics)
2109
+ for (const l of t.users)
2110
+ n[l.client_id] = {
2111
+ clientId: l.client_id,
2112
+ ...l.author ? { author: l.author } : {},
2113
+ name: l.name || "Anon",
2114
+ sprite: l.sprite_id ?? l.sprite ?? null,
2115
+ isLeader: l.is_leader,
2116
+ ...l.registry_name ? { registryName: !0 } : {},
2117
+ ...l.avatar_url ? { avatarUrl: l.avatar_url } : {},
2118
+ ...Hi(l.cosmetics)
2116
2119
  };
2117
- const o = g.getState(), r = C?.id, f = r ? n[r] : void 0;
2120
+ const o = g.getState(), r = I?.id, f = r ? n[r] : void 0;
2118
2121
  if (f?.registryName)
2119
- g.setState({ roster: n }), (f.name !== o.name || f.sprite && f.sprite !== o.sprite) && (p("socket", "Adopting registry name", { from: o.name, to: f.name }), g.getState().setSessionIdentity(f.name, f.sprite ?? o.sprite));
2122
+ g.setState({ roster: n }), (f.name !== o.name || f.sprite && f.sprite !== o.sprite) && (h("socket", "Adopting registry name", { from: o.name, to: f.name }), g.getState().setSessionIdentity(f.name, f.sprite ?? o.sprite));
2120
2123
  else if (r && n[r]) {
2121
- const s = n[r].name, c = n[r].sprite;
2122
- if (o.name && !le(o.name) && (n[r].name = o.name), g.setState({ roster: n }), c && c !== o.sprite) {
2123
- const u = o.name && !le(o.name), m = u ? o.name : xe(c);
2124
- p("socket", "Server reassigned sprite", { from: o.sprite, to: c, newName: m, preservingCustomName: u }), g.getState().setSessionIdentity(m, c), m !== s && e.emit(T.IDENTITY_UPDATE, { name: m });
2124
+ const l = n[r].name, c = n[r].sprite;
2125
+ if (o.name && !se(o.name) && (n[r].name = o.name), g.setState({ roster: n }), c && c !== o.sprite) {
2126
+ const u = o.name && !se(o.name), m = u ? o.name : Se(c);
2127
+ h("socket", "Server reassigned sprite", { from: o.sprite, to: c, newName: m, preservingCustomName: u }), g.getState().setSessionIdentity(m, c), m !== l && e.emit(T.IDENTITY_UPDATE, { name: m });
2125
2128
  }
2126
2129
  }
2127
2130
  }
2128
- p("socket", "Received presence update", t);
2131
+ h("socket", "Received presence update", t);
2129
2132
  const a = g.getState();
2130
2133
  if (!a.name) {
2131
2134
  a.ensureAutoIdentity?.();
2132
2135
  const n = g.getState();
2133
- 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 }));
2136
+ n.name && (h("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 }));
2134
2137
  }
2135
2138
  });
2136
2139
  }
2137
- function Li(e) {
2138
- e.on(Pe.STATE, (t) => {
2140
+ function Ui(e) {
2141
+ e.on(De.STATE, (t) => {
2139
2142
  g.getState().applyPlaylistState({
2140
2143
  playlist: t?.playlist ?? null,
2141
2144
  activeIndex: t?.activeIndex ?? null,
2142
2145
  myVotes: t?.myVotes ?? {}
2143
- }), p("playlist", "Playlist state received", { playlistId: t?.playlist?.id ?? null, activeIndex: t?.activeIndex, myVoteCount: Object.keys(t?.myVotes || {}).length });
2144
- }), e.on(Pe.VOTE_PROGRESS, (t) => {
2145
- g.getState().setVoteProgress(t?.progress ?? []), p("playlist", "Vote progress", { progressCount: t?.progress?.length });
2146
- }), e.on(Pe.RESULTS, (t) => {
2147
- g.getState().setPlaylistResults(t ?? null), p("playlist", "Results received", { playlistId: t?.playlist?.id, update: t?.update === !0 });
2148
- }), e.on(Pe.VOTES_CLEARED, (t) => {
2146
+ }), h("playlist", "Playlist state received", { playlistId: t?.playlist?.id ?? null, activeIndex: t?.activeIndex, myVoteCount: Object.keys(t?.myVotes || {}).length });
2147
+ }), e.on(De.VOTE_PROGRESS, (t) => {
2148
+ g.getState().setVoteProgress(t?.progress ?? []), h("playlist", "Vote progress", { progressCount: t?.progress?.length });
2149
+ }), e.on(De.RESULTS, (t) => {
2150
+ g.getState().setPlaylistResults(t ?? null), h("playlist", "Results received", { playlistId: t?.playlist?.id, update: t?.update === !0 });
2151
+ }), e.on(De.VOTES_CLEARED, (t) => {
2149
2152
  if (!t?.playlistId || !Array.isArray(t.mediaIds)) return;
2150
- const a = Si(
2153
+ const a = Ii(
2151
2154
  { id: t.playlistId, videos: t.mediaIds.map((o) => ({ mediaId: o })) },
2152
- Tr()
2155
+ Ar()
2153
2156
  ), n = g.getState();
2154
- n.playlist?.id === t.playlistId && n.applyPlaylistState({ playlist: n.playlist, activeIndex: n.activePlaylistIndex, myVotes: {} }), p("playlist", "Votes cleared by leader", { playlistId: t.playlistId, removed: a });
2157
+ n.playlist?.id === t.playlistId && n.applyPlaylistState({ playlist: n.playlist, activeIndex: n.activePlaylistIndex, myVotes: {} }), h("playlist", "Votes cleared by leader", { playlistId: t.playlistId, removed: a });
2155
2158
  });
2156
2159
  }
2157
- function Oi(e) {
2158
- e.on(So.UPDATED, () => {
2159
- p("tierlist", "Someone saved — refreshing the board"), oi(!1);
2160
+ function $i(e) {
2161
+ e.on(Io.UPDATED, () => {
2162
+ h("tierlist", "Someone saved — refreshing the board"), si(!1);
2160
2163
  });
2161
2164
  }
2162
- function qi(e) {
2163
- e.on(To.STATE, (t) => {
2165
+ function Fi(e) {
2166
+ e.on(Ao.STATE, (t) => {
2164
2167
  if (!t || typeof t.active != "boolean") return;
2165
2168
  const a = Array.isArray(t.ready) ? t.ready.filter((n) => typeof n == "string") : [];
2166
- g.getState().setReadyCheckState({ active: t.active, ready: a }), p("ready-check", "State received", { active: t.active, readyCount: a.length });
2169
+ g.getState().setReadyCheckState({ active: t.active, ready: a }), h("ready-check", "State received", { active: t.active, readyCount: a.length });
2167
2170
  });
2168
2171
  }
2169
- function Hi(e) {
2170
- e.on(Da.ACTIVE, (t) => {
2172
+ function zi(e) {
2173
+ e.on(qa.ACTIVE, (t) => {
2171
2174
  const a = typeof t?.gameId == "string" ? t.gameId : null;
2172
- g.getState().setActiveGameId(a), p("game", "game_active", { gameId: a });
2175
+ g.getState().setActiveGameId(a), h("game", "game_active", { gameId: a });
2173
2176
  });
2174
2177
  }
2175
- function Ui(e) {
2178
+ function Wi(e) {
2176
2179
  e.on(T.HEALTH_SNAPSHOT, (t) => {
2177
2180
  g.getState().setHealthSnapshot(t);
2178
2181
  }), e.on(T.BUFFER_STATUS, (t) => {
2179
2182
  g.getState().setBufferStatus(t);
2180
2183
  });
2181
2184
  }
2182
- function $i(e) {
2183
- Pi(e), Di(e), hn(e, () => !Ie()), Ui(e), Li(e), Oi(e), qi(e), Hi(e), e.on(T.ERROR, (t) => {
2185
+ function Bi(e) {
2186
+ Oi(e), qi(e), _n(e, () => !Ae()), Wi(e), Ui(e), $i(e), Fi(e), zi(e), e.on(T.ERROR, (t) => {
2184
2187
  const a = t?.code || "error/unknown";
2185
2188
  if (a === "conflict" && t?.message === "sprite_held_by_you") {
2186
- Lt = !0, p("socket", "sprite held by this account's other connection: keeping the server-assigned sprite");
2189
+ qt = !0, h("socket", "sprite held by this account's other connection: keeping the server-assigned sprite");
2187
2190
  return;
2188
2191
  }
2189
2192
  if (a === "conflict" && t?.message === "sprite_taken") {
2190
- if (fi(C?.id)) {
2191
- p("socket", "sprite_taken: stale, the server already has our sprite");
2193
+ if (di(I?.id)) {
2194
+ h("socket", "sprite_taken: stale, the server already has our sprite");
2192
2195
  return;
2193
2196
  }
2194
- Te = !0;
2197
+ Ce = !0;
2195
2198
  let f;
2196
2199
  try {
2197
- f = ii();
2200
+ f = ci();
2198
2201
  } finally {
2199
- Te = !1;
2202
+ Ce = !1;
2200
2203
  }
2201
2204
  f && e.emit(T.IDENTITY_UPDATE, f);
2202
2205
  return;
@@ -2219,75 +2222,75 @@ function $i(e) {
2219
2222
  "recap/not_found": "No recap available for the previous episode."
2220
2223
  }[a] || a;
2221
2224
  if (a.startsWith("recap/")) {
2222
- p("socket", `recap unavailable: ${o}`, { code: a }), g.getState().pushToast("info", o);
2225
+ h("socket", `recap unavailable: ${o}`, { code: a }), g.getState().pushToast("info", o);
2223
2226
  return;
2224
2227
  }
2225
- (a.startsWith("auth/") ? L : ze)("socket", `Server error: ${o}`, { code: a, raw: t }), g.getState().pushToast("error", o);
2228
+ (a.startsWith("auth/") ? L : Be)("socket", `Server error: ${o}`, { code: a, raw: t }), g.getState().pushToast("error", o);
2226
2229
  });
2227
2230
  }
2228
- function Fi(e, t, a) {
2231
+ function Gi(e, t, a) {
2229
2232
  const n = {
2230
2233
  text: e,
2231
2234
  ...t?.length ? { images: t } : {},
2232
2235
  ...a ? { reply_to: a } : {}
2233
2236
  };
2234
- Ie() ? Qr(n) : re().emit(T.CHAT_SEND, n);
2237
+ Ae() ? ai(n) : oe().emit(T.CHAT_SEND, n);
2235
2238
  }
2236
- function zi(e, t, a) {
2239
+ function Ki(e, t, a) {
2237
2240
  const n = { id: e, emoji: t, on: a };
2238
- Ie() ? un(T.CHAT_REACT, n) : re().emit(T.CHAT_REACT, n);
2241
+ Ae() ? pn(T.CHAT_REACT, n) : oe().emit(T.CHAT_REACT, n);
2239
2242
  }
2240
- function Wi(e) {
2243
+ function Vi(e) {
2241
2244
  const t = { typing: e };
2242
- Ie() ? un(T.CHAT_TYPING, t) : C?.connected && C.emit(T.CHAT_TYPING, t);
2245
+ Ae() ? pn(T.CHAT_TYPING, t) : I?.connected && I.emit(T.CHAT_TYPING, t);
2243
2246
  }
2244
- function Bi() {
2245
- K || (K = { ts: Date.now() }, re().emit(T.TIME_PING, {}), V = setTimeout(() => {
2246
- K && (p("socket", "Time ping timed out after 10s, clearing inflight"), K = null), V = null;
2247
+ function Yi() {
2248
+ K || (K = { ts: Date.now() }, oe().emit(T.TIME_PING, {}), V = setTimeout(() => {
2249
+ K && (h("socket", "Time ping timed out after 10s, clearing inflight"), K = null), V = null;
2247
2250
  }, 1e4));
2248
2251
  }
2249
- function wn(e) {
2252
+ function Sn(e) {
2250
2253
  const t = g.getState(), a = t.me.clientId;
2251
2254
  if (!a || !t.roster[a]) {
2252
- ia(e), p("socket", "Avatar change before join: the join will carry it", { sprite: e });
2255
+ la(e), h("socket", "Avatar change before join: the join will carry it", { sprite: e });
2253
2256
  return;
2254
2257
  }
2255
- Te = !0;
2258
+ Ce = !0;
2256
2259
  try {
2257
- ia(e);
2260
+ la(e);
2258
2261
  } finally {
2259
- Te = !1;
2262
+ Ce = !1;
2260
2263
  }
2261
2264
  const n = g.getState(), o = { avatar: !0 };
2262
- 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);
2265
+ n.sprite && n.sprite !== t.sprite && (o.sprite = n.sprite), n.name && n.name !== t.name && (o.name = n.name), h("socket", "Sending avatar change", o), oe().emit(T.IDENTITY_UPDATE, o);
2263
2266
  }
2264
- function Gi(e) {
2265
- g.getState().me.clientId && Ki(e);
2267
+ function Ji(e) {
2268
+ g.getState().me.clientId && Xi(e);
2266
2269
  }
2267
- function Ki(e, t) {
2270
+ function Xi(e, t) {
2268
2271
  const a = {};
2269
- e && (a.name = e), !(!a.name && !a.sprite) && (p("socket", "Sending identity update", a), re().emit(T.IDENTITY_UPDATE, a));
2272
+ e && (a.name = e), !(!a.name && !a.sprite) && (h("socket", "Sending identity update", a), oe().emit(T.IDENTITY_UPDATE, a));
2270
2273
  }
2271
- let qe = { name: "", sprite: "" };
2274
+ let Ue = { name: "", sprite: "" };
2272
2275
  g.subscribe((e, t) => {
2273
- if (e.name === t.name && e.sprite === t.sprite || Te) return;
2276
+ if (e.name === t.name && e.sprite === t.sprite || Ce) return;
2274
2277
  const a = e.me.clientId;
2275
2278
  if (!a) return;
2276
2279
  const n = e.roster[a];
2277
2280
  if (!n) return;
2278
- 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;
2281
+ const o = !!e.name && !se(e.name) && e.name !== Ue.name && (se(n.name || "") || n.name !== e.name), r = !!e.sprite && e.sprite !== Ue.sprite && n.sprite !== e.sprite;
2279
2282
  if (!o && !r) return;
2280
2283
  const f = {};
2281
- 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);
2284
+ o && (f.name = e.name, Ue.name = e.name), r && (f.sprite = e.sprite, Ue.sprite = e.sprite), h("socket", "Identity reassert (store change)", f), I?.connected ? I.emit(T.IDENTITY_UPDATE, f) : oe().emit(T.IDENTITY_UPDATE, f);
2282
2285
  });
2283
- function Vi() {
2284
- Ge && (clearInterval(Ge), Ge = null), V && (clearTimeout(V), V = null), K = null, de.unansweredSince = null, de.lastTickAt = null;
2286
+ function Qi() {
2287
+ Ve && (clearInterval(Ve), Ve = null), V && (clearTimeout(V), V = null), K = null, ue.unansweredSince = null, ue.lastTickAt = null;
2285
2288
  }
2286
- function Yi() {
2287
- p("socket", "clearJoinState called", { hadPayload: ee !== null, room_key: ee?.room_key }), ee = null, vt += 1, he = !1, _n = null;
2289
+ function Zi() {
2290
+ h("socket", "clearJoinState called", { hadPayload: ee !== null, room_key: ee?.room_key }), ee = null, St += 1, pe = !1, xn = null;
2288
2291
  }
2289
- function la() {
2290
- p("socket", "leaveRoom called", { room_key: ee?.room_key }), Yi(), Vi(), mn(), C && (C.disconnect(), C = null), g.setState({
2292
+ function ua() {
2293
+ h("socket", "leaveRoom called", { room_key: ee?.room_key }), Zi(), Qi(), bn(), I && (I.disconnect(), I = null), g.setState({
2291
2294
  me: { clientId: null, nextClientSeq: 1 },
2292
2295
  roster: {},
2293
2296
  snapshot: { roomId: null, mediaId: null, playheadMs: 0, playing: !1, serverSeq: 0, leaderId: null },
@@ -2305,31 +2308,31 @@ function la() {
2305
2308
  activeGameId: null
2306
2309
  });
2307
2310
  }
2308
- function Ji() {
2309
- p("chat", "Emitting recap_request"), re().emit("recap_request");
2311
+ function ef() {
2312
+ h("chat", "Emitting recap_request"), oe().emit("recap_request");
2310
2313
  }
2311
- function Xi() {
2312
- M(() => {
2313
- const e = fo(), t = io((n, o) => {
2314
- const r = li(o);
2315
- p("avatar", "Avatar changed in the settings popout", { sprite: r, source: o.avatar?.source }), wn(r);
2316
- }), a = mi((n) => {
2317
- p("avatar", "Renamed in the settings popout", { name: n }), Gi(n);
2314
+ function tf() {
2315
+ R(() => {
2316
+ const e = lo(), t = so((n, o) => {
2317
+ const r = mi(o);
2318
+ h("avatar", "Avatar changed in the settings popout", { sprite: r, source: o.avatar?.source }), Sn(r);
2319
+ }), a = bi((n) => {
2320
+ h("avatar", "Renamed in the settings popout", { name: n }), Ji(n);
2318
2321
  });
2319
2322
  return () => {
2320
2323
  t(), a(), e();
2321
2324
  };
2322
2325
  }, []);
2323
2326
  }
2324
- function Qi(e, t) {
2325
- return (t ? Gn(t) : null) ?? en(e);
2327
+ function af(e, t) {
2328
+ return (t ? Vn(t) : null) ?? on(e);
2326
2329
  }
2327
- function Ae(e, t) {
2328
- return M(() => {
2329
- t && Wn(t);
2330
- }, [t]), _a(Bn, () => Qi(e, t), () => en(e));
2330
+ function Ne(e, t) {
2331
+ return R(() => {
2332
+ t && Gn(t);
2333
+ }, [t]), ka(Kn, () => af(e, t), () => on(e));
2331
2334
  }
2332
- function Zi(e, t) {
2335
+ function nf(e, t) {
2333
2336
  if (t.clientId) {
2334
2337
  const a = e[t.clientId];
2335
2338
  if (a && (!t.author || !a.author || a.author === t.author)) return a;
@@ -2338,8 +2341,8 @@ function Zi(e, t) {
2338
2341
  for (const a of Object.values(e)) if (a.author === t.author) return a;
2339
2342
  }
2340
2343
  }
2341
- function ef(e, t, a) {
2342
- const n = Zi(e, t);
2344
+ function of(e, t, a) {
2345
+ const n = nf(e, t);
2343
2346
  return n ? {
2344
2347
  name: n.name || a.name,
2345
2348
  // A connection briefly without a character (a reconnect waiting for one to
@@ -2350,17 +2353,17 @@ function ef(e, t, a) {
2350
2353
  here: !0
2351
2354
  } : { name: a.name, sprite: a.sprite, pictureUrl: a.pictureUrl, here: !1 };
2352
2355
  }
2353
- function tf(e, t, a) {
2354
- return !t || !a.here ? e : t.split(Tt).join(a.name);
2356
+ function rf(e, t, a) {
2357
+ return !t || !a.here ? e : t.split(It).join(a.name);
2355
2358
  }
2356
- function rt(e, t) {
2357
- const a = g((n) => JSON.stringify(ef(n.roster, e, t)));
2358
- return F(() => JSON.parse(a), [a]);
2359
+ function ft(e, t) {
2360
+ const a = g((n) => JSON.stringify(of(n.roster, e, t)));
2361
+ return z(() => JSON.parse(a), [a]);
2359
2362
  }
2360
- function Ot({ sprite: e, url: t, alt: a = "", className: n, style: o, fallback: r }) {
2361
- const [f, s] = N(null);
2363
+ function Ut({ sprite: e, url: t, alt: a = "", className: n, style: o, fallback: r }) {
2364
+ const [f, l] = A(null);
2362
2365
  if (t && t !== f)
2363
- return /* @__PURE__ */ l(
2366
+ return /* @__PURE__ */ s(
2364
2367
  "img",
2365
2368
  {
2366
2369
  src: t,
@@ -2369,39 +2372,39 @@ function Ot({ sprite: e, url: t, alt: a = "", className: n, style: o, fallback:
2369
2372
  className: n,
2370
2373
  style: o,
2371
2374
  draggable: !1,
2372
- onError: () => s(t)
2375
+ onError: () => l(t)
2373
2376
  }
2374
2377
  );
2375
- const c = Cr(e);
2376
- return c ? /* @__PURE__ */ l("img", { src: c, alt: a, crossOrigin: "anonymous", className: n, style: o, draggable: !1 }) : /* @__PURE__ */ l(te, { children: r });
2378
+ const c = Nr(e);
2379
+ return c ? /* @__PURE__ */ s("img", { src: c, alt: a, crossOrigin: "anonymous", className: n, style: o, draggable: !1 }) : /* @__PURE__ */ s(X, { children: r });
2377
2380
  }
2378
- function vn({ sprite: e, url: t, alt: a, worn: n }) {
2381
+ function Tn({ sprite: e, url: t, alt: a, worn: n }) {
2379
2382
  return /* @__PURE__ */ w("span", { className: "hc-av", style: { "--hc-sz": "32px" }, children: [
2380
- /* @__PURE__ */ l("span", { className: "hc-pic", children: /* @__PURE__ */ l(
2381
- Ot,
2383
+ /* @__PURE__ */ s("span", { className: "hc-pic", children: /* @__PURE__ */ s(
2384
+ Ut,
2382
2385
  {
2383
2386
  sprite: e,
2384
2387
  url: t,
2385
2388
  alt: a,
2386
2389
  className: "w-8 h-8 rounded-full object-cover flex-shrink-0",
2387
- fallback: /* @__PURE__ */ l("span", { className: "inline-block w-8 h-8 bg-bg-alt/50 rounded-full flex-shrink-0" })
2390
+ fallback: /* @__PURE__ */ s("span", { className: "inline-block w-8 h-8 bg-bg-alt/50 rounded-full flex-shrink-0" })
2388
2391
  }
2389
2392
  ) }),
2390
- n?.overlay && /* @__PURE__ */ l(we, { html: Kn(n), style: { display: "contents" } })
2393
+ n?.overlay && /* @__PURE__ */ s(ve, { html: Yn(n), style: { display: "contents" } })
2391
2394
  ] });
2392
2395
  }
2393
- function af(e) {
2396
+ function ff(e) {
2394
2397
  return !(e.button !== 0 || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey);
2395
2398
  }
2396
- function nf({ src: e, title: t, onClose: a }) {
2397
- M(() => {
2399
+ function sf({ src: e, title: t, onClose: a }) {
2400
+ R(() => {
2398
2401
  const r = (f) => {
2399
- at(f) && (f.stopPropagation(), a());
2402
+ ot(f) && (f.stopPropagation(), a());
2400
2403
  };
2401
2404
  return document.addEventListener("keydown", r, !0), () => document.removeEventListener("keydown", r, !0);
2402
2405
  }, [a]);
2403
- const n = Wa(), o = typeof document > "u" ? null : document.fullscreenElement ?? n ?? document.body;
2404
- return o ? Sa(
2406
+ const n = Va(), o = typeof document > "u" ? null : document.fullscreenElement ?? n ?? document.body;
2407
+ return o ? Ia(
2405
2408
  /* @__PURE__ */ w(
2406
2409
  "div",
2407
2410
  {
@@ -2412,7 +2415,7 @@ function nf({ src: e, title: t, onClose: a }) {
2412
2415
  "aria-modal": "true",
2413
2416
  "aria-label": t || "Image",
2414
2417
  children: [
2415
- /* @__PURE__ */ l(
2418
+ /* @__PURE__ */ s(
2416
2419
  "img",
2417
2420
  {
2418
2421
  src: e,
@@ -2422,8 +2425,8 @@ function nf({ src: e, title: t, onClose: a }) {
2422
2425
  "data-testid": "chat-image-lightbox-img"
2423
2426
  }
2424
2427
  ),
2425
- t && /* @__PURE__ */ l("p", { className: "mt-3 max-w-full truncate text-center text-sm text-white/80", children: t }),
2426
- /* @__PURE__ */ l(
2428
+ t && /* @__PURE__ */ s("p", { className: "mt-3 max-w-full truncate text-center text-sm text-white/80", children: t }),
2429
+ /* @__PURE__ */ s(
2427
2430
  "button",
2428
2431
  {
2429
2432
  type: "button",
@@ -2439,13 +2442,13 @@ function nf({ src: e, title: t, onClose: a }) {
2439
2442
  o
2440
2443
  ) : null;
2441
2444
  }
2442
- const ct = 240, of = 320;
2443
- function rf({ image: e }) {
2444
- const [t, a] = N(!1), n = Ve(e.key);
2445
+ const ut = 240, lf = 320;
2446
+ function cf({ image: e }) {
2447
+ const [t, a] = A(!1), n = Je(e.key);
2445
2448
  if (!n) return null;
2446
- const o = e.w > 0 && e.h > 0, r = o ? Math.min(1, of / e.w, ct / e.h) : 1;
2447
- return /* @__PURE__ */ w(te, { children: [
2448
- /* @__PURE__ */ l(
2449
+ const o = e.w > 0 && e.h > 0, r = o ? Math.min(1, lf / e.w, ut / e.h) : 1;
2450
+ return /* @__PURE__ */ w(X, { children: [
2451
+ /* @__PURE__ */ s(
2449
2452
  "a",
2450
2453
  {
2451
2454
  href: n,
@@ -2454,9 +2457,9 @@ function rf({ image: e }) {
2454
2457
  className: "block max-w-full cursor-zoom-in",
2455
2458
  "data-testid": "chat-image",
2456
2459
  onClick: (f) => {
2457
- af(f) && (f.preventDefault(), a(!0));
2460
+ ff(f) && (f.preventDefault(), a(!0));
2458
2461
  },
2459
- children: /* @__PURE__ */ l(
2462
+ children: /* @__PURE__ */ s(
2460
2463
  "img",
2461
2464
  {
2462
2465
  src: n,
@@ -2466,13 +2469,13 @@ function rf({ image: e }) {
2466
2469
  width: o ? Math.round(e.w * r) : void 0,
2467
2470
  height: o ? Math.round(e.h * r) : void 0,
2468
2471
  className: "rounded border border-border-light object-contain bg-bg-alt/30",
2469
- style: o ? { aspectRatio: `${e.w} / ${e.h}`, maxWidth: "100%", maxHeight: ct } : { maxWidth: "100%", maxHeight: ct }
2472
+ style: o ? { aspectRatio: `${e.w} / ${e.h}`, maxWidth: "100%", maxHeight: ut } : { maxWidth: "100%", maxHeight: ut }
2470
2473
  }
2471
2474
  )
2472
2475
  }
2473
2476
  ),
2474
- t && /* @__PURE__ */ l(
2475
- nf,
2477
+ t && /* @__PURE__ */ s(
2478
+ sf,
2476
2479
  {
2477
2480
  src: n,
2478
2481
  title: e.title,
@@ -2481,13 +2484,13 @@ function rf({ image: e }) {
2481
2484
  )
2482
2485
  ] });
2483
2486
  }
2484
- function kn({ images: e }) {
2485
- return e?.length ? /* @__PURE__ */ l("div", { className: "flex flex-wrap gap-1 mt-1", "data-testid": "chat-images", children: e.map((t, a) => /* @__PURE__ */ l(rf, { image: t }, `${t.key}-${a}`)) }) : null;
2487
+ function Cn({ images: e }) {
2488
+ return e?.length ? /* @__PURE__ */ s("div", { className: "flex flex-wrap gap-1 mt-1", "data-testid": "chat-images", children: e.map((t, a) => /* @__PURE__ */ s(cf, { image: t }, `${t.key}-${a}`)) }) : null;
2486
2489
  }
2487
- function ff(e, t) {
2490
+ function df(e, t) {
2488
2491
  return e.author && t.author ? e.author === t.author : !!t.clientId && e.clientId === t.clientId;
2489
2492
  }
2490
- const sf = [
2493
+ const uf = [
2491
2494
  { id: "smileys", label: "Smileys & Emotion", data: "1f600:grinning face:grinning|1f603:grinning face with big eyes:smiley|1f604:grinning face with smiling eyes:smile|1f601:beaming face with smiling eyes:grin|1f606:grinning squinting face:laughing,satisfied|1f605:grinning face with sweat:sweat_smile|1f923:rolling on the floor laughing:rofl|1f602:face with tears of joy:joy|1f642:slightly smiling face:slight_smile|1f643:upside-down face:upside_down|1fae0:melting face|1f609:winking face:wink|1f60a:smiling face with smiling eyes:blush|1f607:smiling face with halo:innocent|1f970:smiling face with hearts:smiling_face_with_3_hearts|1f60d:smiling face with heart-eyes:heart_eyes|1f929:star-struck|1f618:face blowing a kiss:kissing_heart|1f617:kissing face:kissing|263a-fe0f:smiling face:relaxed|1f61a:kissing face with closed eyes:kissing_closed_eyes|1f619:kissing face with smiling eyes:kissing_smiling_eyes|1f972:smiling face with tear|1f60b:face savoring food:yum|1f61b:face with tongue:stuck_out_tongue|1f61c:winking face with tongue:stuck_out_tongue_winking_eye|1f92a:zany face|1f61d:squinting face with tongue:stuck_out_tongue_closed_eyes|1f911:money-mouth face:money_mouth|1f917:smiling face with open hands:hugging,hugging_face|1f92d:face with hand over mouth|1fae2:face with open eyes and hand over mouth|1fae3:face with peeking eye|1f92b:shushing face|1f914:thinking face:thinking|1fae1:saluting face|1f910:zipper-mouth face:zipper_mouth|1f928:face with raised eyebrow|1f610:neutral face|1f611:expressionless face:expressionless|1f636:face without mouth:no_mouth|1fae5:dotted line face|1f636-200d-1f32b-fe0f:face in clouds|1f60f:smirking face:smirk|1f612:unamused face:unamused|1f644:face with rolling eyes:rolling_eyes|1f62c:grimacing face:grimacing|1f62e-200d-1f4a8:face exhaling|1f925:lying face:liar|1fae8:shaking face|1f60c:relieved face:relieved|1f614:pensive face:pensive|1f62a:sleepy face:sleepy|1f924:drooling face:drool|1f634:sleeping face:sleeping|1f637:face with medical mask:mask|1f912:face with thermometer:thermometer_face|1f915:face with head-bandage:head_bandage|1f922:nauseated face:sick|1f92e:face vomiting|1f927:sneezing face:sneeze|1f975:hot face|1f976:cold face|1f974:woozy face|1f635:face with crossed-out eyes:dizzy_face|1f635-200d-1f4ab:face with spiral eyes|1f92f:exploding head|1f920:cowboy hat face:cowboy,face_with_cowboy_hat|1f973:partying face|1f978:disguised face|1f60e:smiling face with sunglasses:sunglasses|1f913:nerd face:nerd|1f9d0:face with monocle|1f615:confused face:confused|1fae4:face with diagonal mouth|1f61f:worried face:worried|1f641:slightly frowning face:slight_frown|2639-fe0f:frowning face:frowning2,white_frowning_face|1f62e:face with open mouth:open_mouth|1f62f:hushed face:hushed|1f632:astonished face:astonished|1f633:flushed face:flushed|1f97a:pleading face|1f979:face holding back tears|1f626:frowning face with open mouth:frowning|1f627:anguished face:anguished|1f628:fearful face:fearful|1f630:anxious face with sweat:cold_sweat|1f625:sad but relieved face:disappointed_relieved|1f622:crying face:cry|1f62d:loudly crying face:sob|1f631:face screaming in fear:scream|1f616:confounded face:confounded|1f623:persevering face:persevere|1f61e:disappointed face:disappointed|1f613:downcast face with sweat:sweat|1f629:weary face:weary|1f62b:tired face|1f971:yawning face|1f624:face with steam from nose:triumph|1f621:enraged face:rage,pouting_face|1f620:angry face:angry|1f92c:face with symbols on mouth:face_with_symbols_over_mouth|1f608:smiling face with horns:smiling_imp|1f47f:angry face with horns:imp|1f480:skull:skeleton|2620-fe0f:skull and crossbones:skull_crossbones|1f4a9:pile of poo:poop,shit,hankey,poo|1f921:clown face:clown|1f479:ogre:japanese_ogre|1f47a:goblin:japanese_goblin|1f47b:ghost|1f47d:alien|1f47e:alien monster:space_invader|1f916:robot:robot_face|1f63a:grinning cat:smiley_cat|1f638:grinning cat with smiling eyes:smile_cat|1f639:cat with tears of joy:joy_cat|1f63b:smiling cat with heart-eyes:heart_eyes_cat|1f63c:cat with wry smile:smirk_cat|1f63d:kissing cat|1f640:weary cat:scream_cat|1f63f:crying cat:crying_cat_face|1f63e:pouting cat|1f648:see-no-evil monkey:see_no_evil|1f649:hear-no-evil monkey:hear_no_evil|1f64a:speak-no-evil monkey:speak_no_evil|1f48c:love letter|1f498:heart with arrow:cupid|1f49d:heart with ribbon:gift_heart|1f496:sparkling heart|1f497:growing heart:heartpulse|1f493:beating heart:heartbeat|1f49e:revolving hearts|1f495:two hearts|1f49f:heart decoration|2763-fe0f:heart exclamation:heavy_heart_exclamation_mark_ornament|1f494:broken heart|2764-fe0f-200d-1f525:heart on fire|2764-fe0f-200d-1fa79:mending heart|2764-fe0f:red heart:heart|1fa77:pink heart|1f9e1:orange heart|1f49b:yellow heart|1f49a:green heart|1f499:blue heart|1fa75:light blue heart|1f49c:purple heart|1f90e:brown heart|1f5a4:black heart|1fa76:grey heart|1f90d:white heart|1f48b:kiss mark:kiss|1f4af:hundred points:100|1f4a2:anger symbol:anger|1f4a5:collision:boom|1f4ab:dizzy|1f4a6:sweat droplets:sweat_drops|1f4a8:dashing away:dash|1f573-fe0f:hole|1f4ac:speech balloon|1f441-fe0f-200d-1f5e8-fe0f:eye in speech bubble|1f5e8-fe0f:left speech bubble:speech_left|1f5ef-fe0f:right anger bubble:anger_right|1f4ad:thought balloon|1f4a4:zzz" },
2492
2495
  { id: "people", label: "People & Body", data: "1f44b:waving hand:wave|1f91a:raised back of hand:back_of_hand|1f590-fe0f:hand with fingers splayed:hand_splayed,raised_hand_with_fingers_splayed|270b:raised hand|1f596:vulcan salute:vulcan,raised_hand_with_part_between_middle_and_ring_fingers|1faf1:rightwards hand|1faf2:leftwards hand|1faf3:palm down hand|1faf4:palm up hand|1faf7:leftwards pushing hand|1faf8:rightwards pushing hand|1f44c:ok hand|1f90c:pinched fingers|1f90f:pinching hand|270c-fe0f:victory hand:v|1f91e:crossed fingers:fingers_crossed,hand_with_index_and_middle_finger_crossed|1faf0:hand with index finger and thumb crossed|1f91f:love-you gesture|1f918:sign of the horns:metal|1f919:call me hand:call_me|1f448:backhand index pointing left:point_left|1f449:backhand index pointing right:point_right|1f446:backhand index pointing up:point_up_2|1f595:middle finger:reversed_hand_with_middle_finger_extended|1f447:backhand index pointing down:point_down|261d-fe0f:index pointing up:point_up|1faf5:index pointing at the viewer|1f44d:thumbs up:thumbsup,+1,thumbup|1f44e:thumbs down:thumbsdown,-1,thumbdown|270a:raised fist:fist|1f44a:oncoming fist:punch|1f91b:left-facing fist:left_fist|1f91c:right-facing fist:right_fist|1f44f:clapping hands:clap|1f64c:raising hands:raised_hands|1faf6:heart hands|1f450:open hands|1f932:palms up together|1f91d:handshake:shaking_hands|1f64f:folded hands:pray|270d-fe0f:writing hand|1f485:nail polish:nail_care|1f933:selfie|1f4aa:flexed biceps:muscle|1f9be:mechanical arm|1f9bf:mechanical leg|1f9b5:leg|1f9b6:foot|1f442:ear|1f9bb:ear with hearing aid|1f443:nose|1f9e0:brain|1fac0:anatomical heart|1fac1:lungs|1f9b7:tooth|1f9b4:bone|1f440:eyes|1f441-fe0f:eye|1f445:tongue|1f444:mouth:lips|1fae6:biting lip|1f476:baby|1f9d2:child|1f466:boy|1f467:girl|1f9d1:person:adult|1f471:person blond hair:blond_haired_person,person_with_blond_hair|1f468:man|1f9d4:person beard:bearded_person|1f9d4-200d-2642-fe0f:man beard|1f9d4-200d-2640-fe0f:woman beard|1f468-200d-1f9b0:man red hair:man_red_haired|1f468-200d-1f9b1:man curly hair:man_curly_haired|1f468-200d-1f9b3:man white hair:man_white_haired|1f468-200d-1f9b2:man bald|1f469:woman|1f469-200d-1f9b0:woman red hair:woman_red_haired|1f9d1-200d-1f9b0:person red hair|1f469-200d-1f9b1:woman curly hair:woman_curly_haired|1f9d1-200d-1f9b1:person curly hair|1f469-200d-1f9b3:woman white hair:woman_white_haired|1f9d1-200d-1f9b3:person white hair|1f469-200d-1f9b2:woman bald|1f9d1-200d-1f9b2:person bald|1f471-200d-2640-fe0f:woman blond hair|1f471-200d-2642-fe0f:man blond hair|1f9d3:older person:older_adult|1f474:old man:older_man|1f475:old woman:older_woman,grandma|1f64d:person frowning|1f64d-200d-2642-fe0f:man frowning|1f64d-200d-2640-fe0f:woman frowning|1f64e:person pouting:person_with_pouting_face|1f64e-200d-2642-fe0f:man pouting|1f64e-200d-2640-fe0f:woman pouting|1f645:person gesturing no:no_good|1f645-200d-2642-fe0f:man gesturing no|1f645-200d-2640-fe0f:woman gesturing no|1f646:person gesturing ok:ok_woman|1f646-200d-2642-fe0f:man gesturing ok|1f646-200d-2640-fe0f:woman gesturing ok|1f481:person tipping hand:information_desk_person|1f481-200d-2642-fe0f:man tipping hand|1f481-200d-2640-fe0f:woman tipping hand|1f64b:person raising hand:raising_hand|1f64b-200d-2642-fe0f:man raising hand|1f64b-200d-2640-fe0f:woman raising hand|1f9cf:deaf person|1f9cf-200d-2642-fe0f:deaf man|1f9cf-200d-2640-fe0f:deaf woman|1f647:person bowing:bow|1f647-200d-2642-fe0f:man bowing|1f647-200d-2640-fe0f:woman bowing|1f926:person facepalming:face_palm,facepalm|1f926-200d-2642-fe0f:man facepalming|1f926-200d-2640-fe0f:woman facepalming|1f937:person shrugging:shrug|1f937-200d-2642-fe0f:man shrugging|1f937-200d-2640-fe0f:woman shrugging|1f9d1-200d-2695-fe0f:health worker|1f468-200d-2695-fe0f:man health worker|1f469-200d-2695-fe0f:woman health worker|1f9d1-200d-1f393:student|1f468-200d-1f393:man student|1f469-200d-1f393:woman student|1f9d1-200d-1f3eb:teacher|1f468-200d-1f3eb:man teacher|1f469-200d-1f3eb:woman teacher|1f9d1-200d-2696-fe0f:judge|1f468-200d-2696-fe0f:man judge|1f469-200d-2696-fe0f:woman judge|1f9d1-200d-1f33e:farmer|1f468-200d-1f33e:man farmer|1f469-200d-1f33e:woman farmer|1f9d1-200d-1f373:cook|1f468-200d-1f373:man cook|1f469-200d-1f373:woman cook|1f9d1-200d-1f527:mechanic|1f468-200d-1f527:man mechanic|1f469-200d-1f527:woman mechanic|1f9d1-200d-1f3ed:factory worker|1f468-200d-1f3ed:man factory worker|1f469-200d-1f3ed:woman factory worker|1f9d1-200d-1f4bc:office worker|1f468-200d-1f4bc:man office worker|1f469-200d-1f4bc:woman office worker|1f9d1-200d-1f52c:scientist|1f468-200d-1f52c:man scientist|1f469-200d-1f52c:woman scientist|1f9d1-200d-1f4bb:technologist|1f468-200d-1f4bb:man technologist|1f469-200d-1f4bb:woman technologist|1f9d1-200d-1f3a4:singer|1f468-200d-1f3a4:man singer|1f469-200d-1f3a4:woman singer|1f9d1-200d-1f3a8:artist|1f468-200d-1f3a8:man artist|1f469-200d-1f3a8:woman artist|1f9d1-200d-2708-fe0f:pilot|1f468-200d-2708-fe0f:man pilot|1f469-200d-2708-fe0f:woman pilot|1f9d1-200d-1f680:astronaut|1f468-200d-1f680:man astronaut|1f469-200d-1f680:woman astronaut|1f9d1-200d-1f692:firefighter|1f468-200d-1f692:man firefighter|1f469-200d-1f692:woman firefighter|1f46e:police officer:cop|1f46e-200d-2642-fe0f:man police officer|1f46e-200d-2640-fe0f:woman police officer|1f575-fe0f:detective:spy,sleuth_or_spy|1f575-fe0f-200d-2642-fe0f:man detective|1f575-fe0f-200d-2640-fe0f:woman detective|1f482:guard:guardsman|1f482-200d-2642-fe0f:man guard|1f482-200d-2640-fe0f:woman guard|1f977:ninja|1f477:construction worker|1f477-200d-2642-fe0f:man construction worker|1f477-200d-2640-fe0f:woman construction worker|1fac5:person with crown|1f934:prince|1f478:princess|1f473:person wearing turban:man_with_turban|1f473-200d-2642-fe0f:man wearing turban|1f473-200d-2640-fe0f:woman wearing turban|1f472:person with skullcap:man_with_chinese_cap,man_with_gua_pi_mao|1f9d5:woman with headscarf|1f935:person in tuxedo|1f935-200d-2642-fe0f:man in tuxedo|1f935-200d-2640-fe0f:woman in tuxedo|1f470:person with veil|1f470-200d-2642-fe0f:man with veil|1f470-200d-2640-fe0f:woman with veil|1f930:pregnant woman:expecting_woman|1fac3:pregnant man|1fac4:pregnant person|1f931:breast-feeding|1f469-200d-1f37c:woman feeding baby|1f468-200d-1f37c:man feeding baby|1f9d1-200d-1f37c:person feeding baby|1f47c:baby angel:angel|1f385:santa claus:santa|1f936:mrs. claus:mother_christmas|1f9d1-200d-1f384:mx claus|1f9b8:superhero|1f9b8-200d-2642-fe0f:man superhero|1f9b8-200d-2640-fe0f:woman superhero|1f9b9:supervillain|1f9b9-200d-2642-fe0f:man supervillain|1f9b9-200d-2640-fe0f:woman supervillain|1f9d9:mage|1f9d9-200d-2642-fe0f:man mage|1f9d9-200d-2640-fe0f:woman mage|1f9da:fairy|1f9da-200d-2642-fe0f:man fairy|1f9da-200d-2640-fe0f:woman fairy|1f9db:vampire|1f9db-200d-2642-fe0f:man vampire|1f9db-200d-2640-fe0f:woman vampire|1f9dc:merperson|1f9dc-200d-2642-fe0f:merman|1f9dc-200d-2640-fe0f:mermaid|1f9dd:elf|1f9dd-200d-2642-fe0f:man elf|1f9dd-200d-2640-fe0f:woman elf|1f9de:genie|1f9de-200d-2642-fe0f:man genie|1f9de-200d-2640-fe0f:woman genie|1f9df:zombie|1f9df-200d-2642-fe0f:man zombie|1f9df-200d-2640-fe0f:woman zombie|1f9cc:troll|1f486:person getting massage:massage|1f486-200d-2642-fe0f:man getting massage|1f486-200d-2640-fe0f:woman getting massage|1f487:person getting haircut:haircut|1f487-200d-2642-fe0f:man getting haircut|1f487-200d-2640-fe0f:woman getting haircut|1f6b6:person walking:walking|1f6b6-200d-2642-fe0f:man walking|1f6b6-200d-2640-fe0f:woman walking|1f9cd:person standing|1f9cd-200d-2642-fe0f:man standing|1f9cd-200d-2640-fe0f:woman standing|1f9ce:person kneeling|1f9ce-200d-2642-fe0f:man kneeling|1f9ce-200d-2640-fe0f:woman kneeling|1f9d1-200d-1f9af:person with white cane:person_with_probing_cane|1f468-200d-1f9af:man with white cane:man_with_probing_cane|1f469-200d-1f9af:woman with white cane:woman_with_probing_cane|1f9d1-200d-1f9bc:person in motorized wheelchair|1f468-200d-1f9bc:man in motorized wheelchair|1f469-200d-1f9bc:woman in motorized wheelchair|1f9d1-200d-1f9bd:person in manual wheelchair|1f468-200d-1f9bd:man in manual wheelchair|1f469-200d-1f9bd:woman in manual wheelchair|1f3c3:person running:runner|1f3c3-200d-2642-fe0f:man running|1f3c3-200d-2640-fe0f:woman running|1f483:woman dancing:dancer|1f57a:man dancing:male_dancer|1f574-fe0f:person in suit levitating:levitate,man_in_business_suit_levitating|1f46f:people with bunny ears:people_with_bunny_ears_partying,dancers|1f46f-200d-2642-fe0f:men with bunny ears|1f46f-200d-2640-fe0f:women with bunny ears|1f9d6:person in steamy room|1f9d6-200d-2642-fe0f:man in steamy room|1f9d6-200d-2640-fe0f:woman in steamy room|1f9d7:person climbing|1f9d7-200d-2642-fe0f:man climbing|1f9d7-200d-2640-fe0f:woman climbing|1f93a:person fencing:fencer,fencing|1f3c7:horse racing|26f7-fe0f:skier|1f3c2:snowboarder|1f3cc-fe0f:person golfing:golfer|1f3cc-fe0f-200d-2642-fe0f:man golfing|1f3cc-fe0f-200d-2640-fe0f:woman golfing|1f3c4:person surfing:surfer|1f3c4-200d-2642-fe0f:man surfing|1f3c4-200d-2640-fe0f:woman surfing|1f6a3:person rowing boat:rowboat|1f6a3-200d-2642-fe0f:man rowing boat|1f6a3-200d-2640-fe0f:woman rowing boat|1f3ca:person swimming:swimmer|1f3ca-200d-2642-fe0f:man swimming|1f3ca-200d-2640-fe0f:woman swimming|26f9-fe0f:person bouncing ball:basketball_player,person_with_ball|26f9-fe0f-200d-2642-fe0f:man bouncing ball|26f9-fe0f-200d-2640-fe0f:woman bouncing ball|1f3cb-fe0f:person lifting weights:lifter,weight_lifter|1f3cb-fe0f-200d-2642-fe0f:man lifting weights|1f3cb-fe0f-200d-2640-fe0f:woman lifting weights|1f6b4:person biking:bicyclist|1f6b4-200d-2642-fe0f:man biking|1f6b4-200d-2640-fe0f:woman biking|1f6b5:person mountain biking:mountain_bicyclist|1f6b5-200d-2642-fe0f:man mountain biking|1f6b5-200d-2640-fe0f:woman mountain biking|1f938:person cartwheeling:person_doing_cartwheel,cartwheel|1f938-200d-2642-fe0f:man cartwheeling|1f938-200d-2640-fe0f:woman cartwheeling|1f93c:people wrestling:wrestlers,wrestling|1f93c-200d-2642-fe0f:men wrestling|1f93c-200d-2640-fe0f:women wrestling|1f93d:person playing water polo:water_polo|1f93d-200d-2642-fe0f:man playing water polo|1f93d-200d-2640-fe0f:woman playing water polo|1f93e:person playing handball:handball|1f93e-200d-2642-fe0f:man playing handball|1f93e-200d-2640-fe0f:woman playing handball|1f939:person juggling:juggling,juggler|1f939-200d-2642-fe0f:man juggling|1f939-200d-2640-fe0f:woman juggling|1f9d8:person in lotus position|1f9d8-200d-2642-fe0f:man in lotus position|1f9d8-200d-2640-fe0f:woman in lotus position|1f6c0:person taking bath:bath|1f6cc:person in bed:sleeping_accommodation|1f9d1-200d-1f91d-200d-1f9d1:people holding hands|1f46d:women holding hands:two_women_holding_hands|1f46b:woman and man holding hands:couple|1f46c:men holding hands:two_men_holding_hands|1f48f:kiss:couplekiss|1f469-200d-2764-fe0f-200d-1f48b-200d-1f468:kiss woman, man|1f468-200d-2764-fe0f-200d-1f48b-200d-1f468:kiss man, man|1f469-200d-2764-fe0f-200d-1f48b-200d-1f469:kiss woman, woman|1f491:couple with heart|1f469-200d-2764-fe0f-200d-1f468:couple with heart woman, man|1f468-200d-2764-fe0f-200d-1f468:couple with heart man, man|1f469-200d-2764-fe0f-200d-1f469:couple with heart woman, woman|1f468-200d-1f469-200d-1f466:family man, woman, boy|1f468-200d-1f469-200d-1f467:family man, woman, girl:family_mwg|1f468-200d-1f469-200d-1f467-200d-1f466:family man, woman, girl, boy:family_mwgb|1f468-200d-1f469-200d-1f466-200d-1f466:family man, woman, boy, boy:family_mwbb|1f468-200d-1f469-200d-1f467-200d-1f467:family man, woman, girl, girl:family_mwgg|1f468-200d-1f468-200d-1f466:family man, man, boy:family_mmb|1f468-200d-1f468-200d-1f467:family man, man, girl:family_mmg|1f468-200d-1f468-200d-1f467-200d-1f466:family man, man, girl, boy:family_mmgb|1f468-200d-1f468-200d-1f466-200d-1f466:family man, man, boy, boy:family_mmbb|1f468-200d-1f468-200d-1f467-200d-1f467:family man, man, girl, girl:family_mmgg|1f469-200d-1f469-200d-1f466:family woman, woman, boy:family_wwb|1f469-200d-1f469-200d-1f467:family woman, woman, girl:family_wwg|1f469-200d-1f469-200d-1f467-200d-1f466:family woman, woman, girl, boy:family_wwgb|1f469-200d-1f469-200d-1f466-200d-1f466:family woman, woman, boy, boy:family_wwbb|1f469-200d-1f469-200d-1f467-200d-1f467:family woman, woman, girl, girl:family_wwgg|1f468-200d-1f466:family man, boy|1f468-200d-1f466-200d-1f466:family man, boy, boy|1f468-200d-1f467:family man, girl|1f468-200d-1f467-200d-1f466:family man, girl, boy|1f468-200d-1f467-200d-1f467:family man, girl, girl|1f469-200d-1f466:family woman, boy|1f469-200d-1f466-200d-1f466:family woman, boy, boy|1f469-200d-1f467:family woman, girl|1f469-200d-1f467-200d-1f466:family woman, girl, boy|1f469-200d-1f467-200d-1f467:family woman, girl, girl|1f5e3-fe0f:speaking head:speaking_head_in_silhouette|1f464:bust in silhouette|1f465:busts in silhouette|1fac2:people hugging|1f46a:family|1f463:footprints" },
2493
2496
  { id: "nature", label: "Animals & Nature", data: "1f435:monkey face|1f412:monkey|1f98d:gorilla|1f9a7:orangutan|1f436:dog face:dog|1f415:dog:dog2|1f9ae:guide dog|1f415-200d-1f9ba:service dog|1f429:poodle|1f43a:wolf|1f98a:fox:fox_face|1f99d:raccoon|1f431:cat face:cat|1f408:cat:cat2|1f408-200d-2b1b:black cat|1f981:lion:lion_face|1f42f:tiger face:tiger|1f405:tiger:tiger2|1f406:leopard|1f434:horse face:horse|1face:moose|1facf:donkey|1f40e:horse:racehorse|1f984:unicorn:unicorn_face|1f993:zebra|1f98c:deer|1f9ac:bison|1f42e:cow face:cow|1f402:ox|1f403:water buffalo|1f404:cow:cow2|1f437:pig face:pig|1f416:pig:pig2|1f417:boar|1f43d:pig nose|1f40f:ram|1f411:ewe:sheep|1f410:goat|1f42a:camel:dromedary_camel|1f42b:two-hump camel:camel|1f999:llama|1f992:giraffe|1f418:elephant|1f9a3:mammoth|1f98f:rhinoceros:rhino|1f99b:hippopotamus|1f42d:mouse face:mouse|1f401:mouse:mouse2|1f400:rat|1f439:hamster|1f430:rabbit face:rabbit|1f407:rabbit:rabbit2|1f43f-fe0f:chipmunk|1f9ab:beaver|1f994:hedgehog|1f987:bat|1f43b:bear|1f43b-200d-2744-fe0f:polar bear|1f428:koala|1f43c:panda:panda_face|1f9a5:sloth|1f9a6:otter|1f9a8:skunk|1f998:kangaroo|1f9a1:badger|1f43e:paw prints:feet|1f983:turkey|1f414:chicken|1f413:rooster|1f423:hatching chick|1f424:baby chick|1f425:front-facing baby chick:hatched_chick|1f426:bird|1f427:penguin|1f54a-fe0f:dove:dove_of_peace|1f985:eagle|1f986:duck|1f9a2:swan|1f989:owl|1f9a4:dodo|1fab6:feather|1f9a9:flamingo|1f99a:peacock|1f99c:parrot|1fabd:wing|1f426-200d-2b1b:black bird|1fabf:goose|1f438:frog|1f40a:crocodile|1f422:turtle|1f98e:lizard|1f40d:snake|1f432:dragon face|1f409:dragon|1f995:sauropod|1f996:t-rex|1f433:spouting whale:whale|1f40b:whale:whale2|1f42c:dolphin|1f9ad:seal|1f41f:fish|1f420:tropical fish|1f421:blowfish|1f988:shark|1f419:octopus|1f41a:spiral shell:shell|1fab8:coral|1fabc:jellyfish|1f980:crab|1f99e:lobster|1f990:shrimp|1f991:squid|1f9aa:oyster|1f40c:snail|1f98b:butterfly|1f41b:bug|1f41c:ant|1f41d:honeybee:bee|1fab2:beetle|1f41e:lady beetle|1f997:cricket|1fab3:cockroach|1f577-fe0f:spider|1f578-fe0f:spider web|1f982:scorpion|1f99f:mosquito|1fab0:fly|1fab1:worm|1f9a0:microbe|1f490:bouquet|1f338:cherry blossom|1f4ae:white flower|1fab7:lotus|1f3f5-fe0f:rosette|1f339:rose|1f940:wilted flower:wilted_rose|1f33a:hibiscus|1f33b:sunflower|1f33c:blossom|1f337:tulip|1fabb:hyacinth|1f331:seedling|1fab4:potted plant|1f332:evergreen tree|1f333:deciduous tree|1f334:palm tree|1f335:cactus|1f33e:sheaf of rice:ear_of_rice|1f33f:herb|2618-fe0f:shamrock|1f340:four leaf clover|1f341:maple leaf|1f342:fallen leaf|1f343:leaf fluttering in wind:leaves|1fab9:empty nest|1faba:nest with eggs|1f344:mushroom" },
@@ -2498,30 +2501,30 @@ const sf = [
2498
2501
  { id: "symbols", label: "Symbols", data: "1f3e7:atm sign:atm|1f6ae:litter in bin sign:put_litter_in_its_place|1f6b0:potable water|267f:wheelchair symbol:wheelchair|1f6b9:men’s room:mens,mens_room|1f6ba:women’s room:womens,womens_room|1f6bb:restroom|1f6bc:baby symbol|1f6be:water closet:wc|1f6c2:passport control|1f6c3:customs|1f6c4:baggage claim|1f6c5:left luggage|26a0-fe0f:warning|1f6b8:children crossing|26d4:no entry|1f6ab:prohibited:no_entry_sign|1f6b3:no bicycles|1f6ad:no smoking|1f6af:no littering:do_not_litter|1f6b1:non-potable water:non-potable_water|1f6b7:no pedestrians|1f4f5:no mobile phones|1f51e:no one under eighteen:underage|2622-fe0f:radioactive:radioactive_sign|2623-fe0f:biohazard:biohazard_sign|2b06-fe0f:up arrow:arrow_up|2197-fe0f:up-right arrow:arrow_upper_right|27a1-fe0f:right arrow:arrow_right|2198-fe0f:down-right arrow:arrow_lower_right|2b07-fe0f:down arrow:arrow_down|2199-fe0f:down-left arrow:arrow_lower_left|2b05-fe0f:left arrow:arrow_left|2196-fe0f:up-left arrow:arrow_upper_left|2195-fe0f:up-down arrow:arrow_up_down|2194-fe0f:left-right arrow|21a9-fe0f:right arrow curving left:leftwards_arrow_with_hook|21aa-fe0f:left arrow curving right:arrow_right_hook|2934-fe0f:right arrow curving up:arrow_heading_up|2935-fe0f:right arrow curving down:arrow_heading_down|1f503:clockwise vertical arrows:arrows_clockwise|1f504:counterclockwise arrows button:arrows_counterclockwise|1f519:back arrow:back|1f51a:end arrow:end|1f51b:on! arrow:on|1f51c:soon arrow:soon|1f51d:top arrow:top|1f6d0:place of worship:worship_symbol|269b-fe0f:atom symbol:atom|1f549-fe0f:om:om_symbol|2721-fe0f:star of david|2638-fe0f:wheel of dharma|262f-fe0f:yin yang|271d-fe0f:latin cross:cross|2626-fe0f:orthodox cross|262a-fe0f:star and crescent|262e-fe0f:peace symbol:peace|1f54e:menorah|1f52f:dotted six-pointed star:six_pointed_star|1faaf:khanda|2648:aries|2649:taurus|264a:gemini|264b:cancer|264c:leo|264d:virgo|264e:libra|264f:scorpio:scorpius|2650:sagittarius|2651:capricorn|2652:aquarius|2653:pisces|26ce:ophiuchus|1f500:shuffle tracks button:twisted_rightwards_arrows|1f501:repeat button:repeat|1f502:repeat single button:repeat_one|25b6-fe0f:play button:arrow_forward|23e9:fast-forward button:fast_forward|23ed-fe0f:next track button:track_next,next_track|23ef-fe0f:play or pause button:play_pause|25c0-fe0f:reverse button:arrow_backward|23ea:fast reverse button:rewind|23ee-fe0f:last track button:track_previous,previous_track|1f53c:upwards button:arrow_up_small|23eb:fast up button:arrow_double_up|1f53d:downwards button:arrow_down_small|23ec:fast down button:arrow_double_down|23f8-fe0f:pause button:double_vertical_bar|23f9-fe0f:stop button|23fa-fe0f:record button|23cf-fe0f:eject button:eject,eject_symbol|1f3a6:cinema|1f505:dim button:low_brightness|1f506:bright button:high_brightness|1f4f6:antenna bars:signal_strength|1f6dc:wireless|1f4f3:vibration mode|1f4f4:mobile phone off|2640-fe0f:female sign|2642-fe0f:male sign|26a7-fe0f:transgender symbol|2716-fe0f:multiply:heavy_multiplication_x|2795:plus:heavy_plus_sign|2796:minus:heavy_minus_sign|2797:divide:heavy_division_sign|1f7f0:heavy equals sign|267e-fe0f:infinity|203c-fe0f:double exclamation mark:bangbang|2049-fe0f:exclamation question mark:interrobang|2753:red question mark:question,question_mark|2754:white question mark:grey_question|2755:white exclamation mark:grey_exclamation|2757:red exclamation mark:exclamation|3030-fe0f:wavy dash|1f4b1:currency exchange|1f4b2:heavy dollar sign|2695-fe0f:medical symbol|267b-fe0f:recycling symbol:recycle|269c-fe0f:fleur-de-lis:fleur-de-lis|1f531:trident emblem:trident|1f4db:name badge|1f530:japanese symbol for beginner:beginner|2b55:hollow red circle:o|2705:check mark button:white_check_mark|2611-fe0f:check box with check:ballot_box_with_check|2714-fe0f:check mark:heavy_check_mark|274c:cross mark:x|274e:cross mark button:negative_squared_cross_mark|27b0:curly loop|27bf:double curly loop:loop|303d-fe0f:part alternation mark|2733-fe0f:eight-spoked asterisk|2734-fe0f:eight-pointed star:eight_pointed_black_star|2747-fe0f:sparkle|00a9-fe0f:copyright|00ae-fe0f:registered|2122-fe0f:trade mark:tm|0023-fe0f-20e3:keycap #|002a-fe0f-20e3:keycap *|0030-fe0f-20e3:keycap 0|0031-fe0f-20e3:keycap 1|0032-fe0f-20e3:keycap 2|0033-fe0f-20e3:keycap 3|0034-fe0f-20e3:keycap 4|0035-fe0f-20e3:keycap 5|0036-fe0f-20e3:keycap 6|0037-fe0f-20e3:keycap 7|0038-fe0f-20e3:keycap 8|0039-fe0f-20e3:keycap 9|1f51f:keycap 10:keycap_ten|1f520:input latin uppercase:capital_abcd|1f521:input latin lowercase:abcd|1f522:input numbers:1234|1f523:input symbols:symbols|1f524:input latin letters:abc|1f170-fe0f:a button (blood type):a|1f18e:ab button (blood type):ab|1f171-fe0f:b button (blood type):b|1f191:cl button:cl|1f192:cool button:cool|1f193:free button:free|2139-fe0f:information:information_source|1f194:id button:id|24c2-fe0f:circled m:m|1f195:new button:new|1f196:ng button:ng|1f17e-fe0f:o button (blood type):o2|1f197:ok button:ok|1f17f-fe0f:p button:parking|1f198:sos button:sos|1f199:up! button:up|1f19a:vs button:vs|1f201:japanese “here” button:koko|1f202-fe0f:japanese “service charge” button:sa|1f237-fe0f:japanese “monthly amount” button:u6708|1f236:japanese “not free of charge” button:u6709|1f22f:japanese “reserved” button:u6307|1f250:japanese “bargain” button:ideograph_advantage|1f239:japanese “discount” button:u5272|1f21a:japanese “free of charge” button:u7121|1f232:japanese “prohibited” button:u7981|1f251:japanese “acceptable” button:accept|1f238:japanese “application” button:u7533|1f234:japanese “passing grade” button:u5408|1f233:japanese “vacancy” button:u7a7a|3297-fe0f:japanese “congratulations” button:congratulations|3299-fe0f:japanese “secret” button:secret|1f23a:japanese “open for business” button:u55b6|1f235:japanese “no vacancy” button:u6e80|1f534:red circle|1f7e0:orange circle|1f7e1:yellow circle|1f7e2:green circle|1f535:blue circle|1f7e3:purple circle|1f7e4:brown circle|26ab:black circle|26aa:white circle|1f7e5:red square|1f7e7:orange square|1f7e8:yellow square|1f7e9:green square|1f7e6:blue square|1f7ea:purple square|1f7eb:brown square|2b1b:black large square|2b1c:white large square|25fc-fe0f:black medium square|25fb-fe0f:white medium square|25fe:black medium-small square|25fd:white medium-small square|25aa-fe0f:black small square|25ab-fe0f:white small square|1f536:large orange diamond|1f537:large blue diamond|1f538:small orange diamond|1f539:small blue diamond|1f53a:red triangle pointed up:small_red_triangle|1f53b:red triangle pointed down:small_red_triangle_down|1f4a0:diamond with a dot:diamond_shape_with_a_dot_inside|1f518:radio button|1f533:white square button|1f532:black square button" },
2499
2502
  { id: "flags", label: "Flags", data: "1f3c1:chequered flag:checkered_flag|1f6a9:triangular flag:triangular_flag_on_post|1f38c:crossed flags|1f3f4:black flag:flag_black,waving_black_flag|1f3f3-fe0f:white flag:flag_white,waving_white_flag|1f3f3-fe0f-200d-1f308:rainbow flag|1f3f3-fe0f-200d-26a7-fe0f:transgender flag|1f3f4-200d-2620-fe0f:pirate flag|1f1e6-1f1e8:flag ascension island:flag_ac|1f1e6-1f1e9:flag andorra:flag_ad|1f1e6-1f1ea:flag united arab emirates:flag_ae|1f1e6-1f1eb:flag afghanistan:flag_af|1f1e6-1f1ec:flag antigua & barbuda:flag_ag|1f1e6-1f1ee:flag anguilla:flag_ai|1f1e6-1f1f1:flag albania:flag_al|1f1e6-1f1f2:flag armenia:flag_am|1f1e6-1f1f4:flag angola:flag_ao|1f1e6-1f1f6:flag antarctica:flag_aq|1f1e6-1f1f7:flag argentina:flag_ar|1f1e6-1f1f8:flag american samoa:flag_as|1f1e6-1f1f9:flag austria:flag_at|1f1e6-1f1fa:flag australia:flag_au|1f1e6-1f1fc:flag aruba:flag_aw|1f1e6-1f1fd:flag åland islands:flag_ax|1f1e6-1f1ff:flag azerbaijan:flag_az|1f1e7-1f1e6:flag bosnia & herzegovina:flag_ba|1f1e7-1f1e7:flag barbados:flag_bb|1f1e7-1f1e9:flag bangladesh:flag_bd|1f1e7-1f1ea:flag belgium:flag_be|1f1e7-1f1eb:flag burkina faso:flag_bf|1f1e7-1f1ec:flag bulgaria:flag_bg|1f1e7-1f1ed:flag bahrain:flag_bh|1f1e7-1f1ee:flag burundi:flag_bi|1f1e7-1f1ef:flag benin:flag_bj|1f1e7-1f1f1:flag st. barthélemy:flag_bl|1f1e7-1f1f2:flag bermuda:flag_bm|1f1e7-1f1f3:flag brunei:flag_bn|1f1e7-1f1f4:flag bolivia:flag_bo|1f1e7-1f1f6:flag caribbean netherlands:flag_bq|1f1e7-1f1f7:flag brazil:flag_br|1f1e7-1f1f8:flag bahamas:flag_bs|1f1e7-1f1f9:flag bhutan:flag_bt|1f1e7-1f1fb:flag bouvet island:flag_bv|1f1e7-1f1fc:flag botswana:flag_bw|1f1e7-1f1fe:flag belarus:flag_by|1f1e7-1f1ff:flag belize:flag_bz|1f1e8-1f1e6:flag canada:flag_ca|1f1e8-1f1e8:flag cocos (keeling) islands:flag_cc|1f1e8-1f1e9:flag congo - kinshasa:flag_cd,congo|1f1e8-1f1eb:flag central african republic:flag_cf|1f1e8-1f1ec:flag congo - brazzaville:flag_cg|1f1e8-1f1ed:flag switzerland:flag_ch|1f1e8-1f1ee:flag côte d’ivoire:flag_ci|1f1e8-1f1f0:flag cook islands:flag_ck|1f1e8-1f1f1:flag chile:flag_cl,chile|1f1e8-1f1f2:flag cameroon:flag_cm|1f1e8-1f1f3:flag china:flag_cn|1f1e8-1f1f4:flag colombia:flag_co|1f1e8-1f1f5:flag clipperton island:flag_cp|1f1e8-1f1f7:flag costa rica:flag_cr|1f1e8-1f1fa:flag cuba:flag_cu|1f1e8-1f1fb:flag cape verde:flag_cv|1f1e8-1f1fc:flag curaçao:flag_cw|1f1e8-1f1fd:flag christmas island:flag_cx|1f1e8-1f1fe:flag cyprus:flag_cy|1f1e8-1f1ff:flag czechia:flag_cz|1f1e9-1f1ea:flag germany:flag_de|1f1e9-1f1ec:flag diego garcia:flag_dg|1f1e9-1f1ef:flag djibouti:flag_dj|1f1e9-1f1f0:flag denmark:flag_dk|1f1e9-1f1f2:flag dominica:flag_dm|1f1e9-1f1f4:flag dominican republic:flag_do|1f1e9-1f1ff:flag algeria:flag_dz|1f1ea-1f1e6:flag ceuta & melilla:flag_ea|1f1ea-1f1e8:flag ecuador:flag_ec|1f1ea-1f1ea:flag estonia:flag_ee|1f1ea-1f1ec:flag egypt:flag_eg|1f1ea-1f1ed:flag western sahara:flag_eh|1f1ea-1f1f7:flag eritrea:flag_er|1f1ea-1f1f8:flag spain:flag_es|1f1ea-1f1f9:flag ethiopia:flag_et|1f1ea-1f1fa:flag european union:flag_eu|1f1eb-1f1ee:flag finland:flag_fi|1f1eb-1f1ef:flag fiji:flag_fj|1f1eb-1f1f0:flag falkland islands:flag_fk|1f1eb-1f1f2:flag micronesia:flag_fm|1f1eb-1f1f4:flag faroe islands:flag_fo|1f1eb-1f1f7:flag france:flag_fr|1f1ec-1f1e6:flag gabon:flag_ga|1f1ec-1f1e7:flag united kingdom:flag_gb|1f1ec-1f1e9:flag grenada:flag_gd|1f1ec-1f1ea:flag georgia:flag_ge|1f1ec-1f1eb:flag french guiana:flag_gf|1f1ec-1f1ec:flag guernsey:flag_gg|1f1ec-1f1ed:flag ghana:flag_gh|1f1ec-1f1ee:flag gibraltar:flag_gi|1f1ec-1f1f1:flag greenland:flag_gl|1f1ec-1f1f2:flag gambia:flag_gm|1f1ec-1f1f3:flag guinea:flag_gn|1f1ec-1f1f5:flag guadeloupe:flag_gp|1f1ec-1f1f6:flag equatorial guinea:flag_gq|1f1ec-1f1f7:flag greece:flag_gr|1f1ec-1f1f8:flag south georgia & south sandwich islands:flag_gs|1f1ec-1f1f9:flag guatemala:flag_gt|1f1ec-1f1fa:flag guam:flag_gu|1f1ec-1f1fc:flag guinea-bissau:flag_gw|1f1ec-1f1fe:flag guyana:flag_gy|1f1ed-1f1f0:flag hong kong sar china:flag_hk|1f1ed-1f1f2:flag heard island & mcdonald islands:flag_hm|1f1ed-1f1f3:flag honduras:flag_hn|1f1ed-1f1f7:flag croatia:flag_hr|1f1ed-1f1f9:flag haiti:flag_ht|1f1ed-1f1fa:flag hungary:flag_hu|1f1ee-1f1e8:flag canary islands:flag_ic|1f1ee-1f1e9:flag indonesia:flag_id,indonesia|1f1ee-1f1ea:flag ireland:flag_ie|1f1ee-1f1f1:flag israel:flag_il|1f1ee-1f1f2:flag isle of man:flag_im|1f1ee-1f1f3:flag india:flag_in|1f1ee-1f1f4:flag british indian ocean territory:flag_io|1f1ee-1f1f6:flag iraq:flag_iq|1f1ee-1f1f7:flag iran:flag_ir|1f1ee-1f1f8:flag iceland:flag_is|1f1ee-1f1f9:flag italy:flag_it|1f1ef-1f1ea:flag jersey:flag_je|1f1ef-1f1f2:flag jamaica:flag_jm|1f1ef-1f1f4:flag jordan:flag_jo|1f1ef-1f1f5:flag japan:flag_jp|1f1f0-1f1ea:flag kenya:flag_ke|1f1f0-1f1ec:flag kyrgyzstan:flag_kg|1f1f0-1f1ed:flag cambodia:flag_kh|1f1f0-1f1ee:flag kiribati:flag_ki|1f1f0-1f1f2:flag comoros:flag_km|1f1f0-1f1f3:flag st. kitts & nevis:flag_kn|1f1f0-1f1f5:flag north korea:flag_kp|1f1f0-1f1f7:flag south korea:flag_kr|1f1f0-1f1fc:flag kuwait:flag_kw|1f1f0-1f1fe:flag cayman islands:flag_ky|1f1f0-1f1ff:flag kazakhstan:flag_kz|1f1f1-1f1e6:flag laos:flag_la|1f1f1-1f1e7:flag lebanon:flag_lb|1f1f1-1f1e8:flag st. lucia:flag_lc|1f1f1-1f1ee:flag liechtenstein:flag_li|1f1f1-1f1f0:flag sri lanka:flag_lk|1f1f1-1f1f7:flag liberia:flag_lr|1f1f1-1f1f8:flag lesotho:flag_ls|1f1f1-1f1f9:flag lithuania:flag_lt|1f1f1-1f1fa:flag luxembourg:flag_lu|1f1f1-1f1fb:flag latvia:flag_lv|1f1f1-1f1fe:flag libya:flag_ly|1f1f2-1f1e6:flag morocco:flag_ma|1f1f2-1f1e8:flag monaco:flag_mc|1f1f2-1f1e9:flag moldova:flag_md|1f1f2-1f1ea:flag montenegro:flag_me|1f1f2-1f1eb:flag st. martin:flag_mf|1f1f2-1f1ec:flag madagascar:flag_mg|1f1f2-1f1ed:flag marshall islands:flag_mh|1f1f2-1f1f0:flag north macedonia:flag_mk|1f1f2-1f1f1:flag mali:flag_ml|1f1f2-1f1f2:flag myanmar (burma):flag_mm|1f1f2-1f1f3:flag mongolia:flag_mn|1f1f2-1f1f4:flag macao sar china:flag_mo|1f1f2-1f1f5:flag northern mariana islands:flag_mp|1f1f2-1f1f6:flag martinique:flag_mq|1f1f2-1f1f7:flag mauritania:flag_mr|1f1f2-1f1f8:flag montserrat:flag_ms|1f1f2-1f1f9:flag malta:flag_mt|1f1f2-1f1fa:flag mauritius:flag_mu|1f1f2-1f1fb:flag maldives:flag_mv|1f1f2-1f1fc:flag malawi:flag_mw|1f1f2-1f1fd:flag mexico:flag_mx|1f1f2-1f1fe:flag malaysia:flag_my|1f1f2-1f1ff:flag mozambique:flag_mz|1f1f3-1f1e6:flag namibia:flag_na|1f1f3-1f1e8:flag new caledonia:flag_nc|1f1f3-1f1ea:flag niger:flag_ne|1f1f3-1f1eb:flag norfolk island:flag_nf|1f1f3-1f1ec:flag nigeria:flag_ng,nigeria|1f1f3-1f1ee:flag nicaragua:flag_ni|1f1f3-1f1f1:flag netherlands:flag_nl|1f1f3-1f1f4:flag norway:flag_no|1f1f3-1f1f5:flag nepal:flag_np|1f1f3-1f1f7:flag nauru:flag_nr|1f1f3-1f1fa:flag niue:flag_nu|1f1f3-1f1ff:flag new zealand:flag_nz|1f1f4-1f1f2:flag oman:flag_om|1f1f5-1f1e6:flag panama:flag_pa|1f1f5-1f1ea:flag peru:flag_pe|1f1f5-1f1eb:flag french polynesia:flag_pf|1f1f5-1f1ec:flag papua new guinea:flag_pg|1f1f5-1f1ed:flag philippines:flag_ph|1f1f5-1f1f0:flag pakistan:flag_pk|1f1f5-1f1f1:flag poland:flag_pl|1f1f5-1f1f2:flag st. pierre & miquelon:flag_pm|1f1f5-1f1f3:flag pitcairn islands:flag_pn|1f1f5-1f1f7:flag puerto rico:flag_pr|1f1f5-1f1f8:flag palestinian territories:flag_ps|1f1f5-1f1f9:flag portugal:flag_pt|1f1f5-1f1fc:flag palau:flag_pw|1f1f5-1f1fe:flag paraguay:flag_py|1f1f6-1f1e6:flag qatar:flag_qa|1f1f7-1f1ea:flag réunion:flag_re|1f1f7-1f1f4:flag romania:flag_ro|1f1f7-1f1f8:flag serbia:flag_rs|1f1f7-1f1fa:flag russia:flag_ru|1f1f7-1f1fc:flag rwanda:flag_rw|1f1f8-1f1e6:flag saudi arabia:flag_sa,saudiarabia,saudi|1f1f8-1f1e7:flag solomon islands:flag_sb|1f1f8-1f1e8:flag seychelles:flag_sc|1f1f8-1f1e9:flag sudan:flag_sd|1f1f8-1f1ea:flag sweden:flag_se|1f1f8-1f1ec:flag singapore:flag_sg|1f1f8-1f1ed:flag st. helena, ascension & tristan da cunha:flag_sh|1f1f8-1f1ee:flag slovenia:flag_si|1f1f8-1f1ef:flag svalbard & jan mayen:flag_sj|1f1f8-1f1f0:flag slovakia:flag_sk|1f1f8-1f1f1:flag sierra leone:flag_sl|1f1f8-1f1f2:flag san marino:flag_sm|1f1f8-1f1f3:flag senegal:flag_sn|1f1f8-1f1f4:flag somalia:flag_so|1f1f8-1f1f7:flag suriname:flag_sr|1f1f8-1f1f8:flag south sudan:flag_ss|1f1f8-1f1f9:flag são tomé & príncipe:flag_st|1f1f8-1f1fb:flag el salvador:flag_sv|1f1f8-1f1fd:flag sint maarten:flag_sx|1f1f8-1f1fe:flag syria:flag_sy|1f1f8-1f1ff:flag eswatini:flag_sz|1f1f9-1f1e6:flag tristan da cunha:flag_ta|1f1f9-1f1e8:flag turks & caicos islands:flag_tc|1f1f9-1f1e9:flag chad:flag_td|1f1f9-1f1eb:flag french southern and antarctic lands:flag_tf|1f1f9-1f1ec:flag togo:flag_tg|1f1f9-1f1ed:flag thailand:flag_th|1f1f9-1f1ef:flag tajikistan:flag_tj|1f1f9-1f1f0:flag tokelau:flag_tk|1f1f9-1f1f1:flag timor-leste:flag_tl|1f1f9-1f1f2:flag turkmenistan:flag_tm,turkmenistan|1f1f9-1f1f3:flag tunisia:flag_tn|1f1f9-1f1f4:flag tonga:flag_to|1f1f9-1f1f7:flag türkiye:flag_tr|1f1f9-1f1f9:flag trinidad & tobago:flag_tt|1f1f9-1f1fb:flag tuvalu:flag_tv,tuvalu|1f1f9-1f1fc:flag taiwan:flag_tw|1f1f9-1f1ff:flag tanzania:flag_tz|1f1fa-1f1e6:flag ukraine:flag_ua|1f1fa-1f1ec:flag uganda:flag_ug|1f1fa-1f1f2:flag u.s. outlying islands:flag_um|1f1fa-1f1f3:flag united nations:united_nations|1f1fa-1f1f8:flag united states:flag_us|1f1fa-1f1fe:flag uruguay:flag_uy|1f1fa-1f1ff:flag uzbekistan:flag_uz|1f1fb-1f1e6:flag vatican city:flag_va|1f1fb-1f1e8:flag st. vincent & grenadines:flag_vc|1f1fb-1f1ea:flag venezuela:flag_ve|1f1fb-1f1ec:flag british virgin islands:flag_vg|1f1fb-1f1ee:flag u.s. virgin islands:flag_vi|1f1fb-1f1f3:flag vietnam:flag_vn|1f1fb-1f1fa:flag vanuatu:flag_vu|1f1fc-1f1eb:flag wallis & futuna:flag_wf|1f1fc-1f1f8:flag samoa:flag_ws|1f1fd-1f1f0:flag kosovo:flag_xk|1f1fe-1f1ea:flag yemen:flag_ye|1f1fe-1f1f9:flag mayotte:flag_yt|1f1ff-1f1e6:flag south africa:flag_za|1f1ff-1f1f2:flag zambia:flag_zm|1f1ff-1f1fc:flag zimbabwe:flag_zw|1f3f4-e0067-e0062-e0065-e006e-e0067-e007f:flag england:england|1f3f4-e0067-e0062-e0073-e0063-e0074-e007f:flag scotland:scotland|1f3f4-e0067-e0062-e0077-e006c-e0073-e007f:flag wales:wales" }
2500
2503
  ];
2501
- function lf(e) {
2504
+ function mf(e) {
2502
2505
  return e.replace(/[^a-z0-9+]+/g, "_").replace(/^_|_$/g, "");
2503
2506
  }
2504
- function cf(e) {
2505
- const [t = "", a = "", n = ""] = e.split(":"), o = lf(a), r = n ? n.split(",") : [];
2507
+ function gf(e) {
2508
+ const [t = "", a = "", n = ""] = e.split(":"), o = mf(a), r = n ? n.split(",") : [];
2506
2509
  return o && !r.includes(o) && r.push(o), { char: String.fromCodePoint(...t.split("-").map((f) => parseInt(f, 16))), name: a, shortcodes: r };
2507
2510
  }
2508
- let ca = null;
2509
- function Ne() {
2510
- return ca ??= sf.map((e) => ({ id: e.id, label: e.label, emoji: e.data.split("|").map(cf) })), ca;
2511
+ let ma = null;
2512
+ function je() {
2513
+ return ma ??= uf.map((e) => ({ id: e.id, label: e.label, emoji: e.data.split("|").map(gf) })), ma;
2511
2514
  }
2512
- let se = null;
2513
- function Qe(e) {
2514
- if (!se) {
2515
- se = /* @__PURE__ */ new Map();
2516
- for (const t of Ne().flatMap((a) => a.emoji)) {
2517
- se.set(t.char, t);
2515
+ let fe = null;
2516
+ function et(e) {
2517
+ if (!fe) {
2518
+ fe = /* @__PURE__ */ new Map();
2519
+ for (const t of je().flatMap((a) => a.emoji)) {
2520
+ fe.set(t.char, t);
2518
2521
  const a = t.char.replace(/\ufe0f/g, "");
2519
- se.has(a) || se.set(a, t);
2522
+ fe.has(a) || fe.set(a, t);
2520
2523
  }
2521
2524
  }
2522
- return se.get(e) ?? se.get(e.replace(/\ufe0f/g, ""));
2525
+ return fe.get(e) ?? fe.get(e.replace(/\ufe0f/g, ""));
2523
2526
  }
2524
- const df = [
2527
+ const hf = [
2525
2528
  "joy",
2526
2529
  "heart",
2527
2530
  "thumbsup",
@@ -2558,51 +2561,51 @@ const df = [
2558
2561
  "x",
2559
2562
  "pensive"
2560
2563
  ];
2561
- let da = null;
2562
- function uf() {
2563
- return da ??= df.flatMap((e) => xn(e)?.char ?? []), da;
2564
- }
2565
- let ge = null;
2566
- function xn(e) {
2567
- if (!ge) {
2568
- ge = /* @__PURE__ */ new Map();
2569
- for (const t of Ne().flatMap((a) => a.emoji))
2570
- for (const a of t.shortcodes) ge.has(a) || ge.set(a, t);
2564
+ let ga = null;
2565
+ function pf() {
2566
+ return ga ??= hf.flatMap((e) => En(e)?.char ?? []), ga;
2567
+ }
2568
+ let he = null;
2569
+ function En(e) {
2570
+ if (!he) {
2571
+ he = /* @__PURE__ */ new Map();
2572
+ for (const t of je().flatMap((a) => a.emoji))
2573
+ for (const a of t.shortcodes) he.has(a) || he.set(a, t);
2571
2574
  }
2572
- return ge.get(e.toLowerCase());
2575
+ return he.get(e.toLowerCase());
2573
2576
  }
2574
- function mf(e, t = 8) {
2577
+ function bf(e, t = 8) {
2575
2578
  const a = e.toLowerCase();
2576
2579
  if (!a) return [];
2577
2580
  const n = /* @__PURE__ */ new Map();
2578
- for (const s of [...qt(), ...uf()]) n.has(s) || n.set(s, n.size);
2579
- const o = (s) => n.get(s.char) ?? n.size, r = [];
2581
+ for (const l of [...$t(), ...pf()]) n.has(l) || n.set(l, n.size);
2582
+ const o = (l) => n.get(l.char) ?? n.size, r = [];
2580
2583
  let f = 0;
2581
- for (const s of Ne().flatMap((c) => c.emoji)) {
2584
+ for (const l of je().flatMap((c) => c.emoji)) {
2582
2585
  f += 1;
2583
2586
  let c = null;
2584
- for (const u of s.shortcodes) {
2587
+ for (const u of l.shortcodes) {
2585
2588
  const m = u === a ? 0 : u.startsWith(a) ? 1 : u.split("_").some((x) => x.startsWith(a)) ? 2 : u.includes(a) ? 3 : -1;
2586
2589
  m < 0 || (!c || m < c.rank) && (c = { code: u, rank: m });
2587
2590
  }
2588
- c && r.push({ emoji: s, code: c.code, rank: c.rank, order: o(s) * 1e4 + f });
2591
+ c && r.push({ emoji: l, code: c.code, rank: c.rank, order: o(l) * 1e4 + f });
2589
2592
  }
2590
- return r.sort((s, c) => s.rank - c.rank || s.order - c.order), r.slice(0, t).map(({ emoji: s, code: c }) => ({ emoji: s, code: c }));
2593
+ return r.sort((l, c) => l.rank - c.rank || l.order - c.order), r.slice(0, t).map(({ emoji: l, code: c }) => ({ emoji: l, code: c }));
2591
2594
  }
2592
- function gf(e, t = 120) {
2595
+ function yf(e, t = 120) {
2593
2596
  const a = e.toLowerCase().trim().split(/\s+/).filter(Boolean);
2594
2597
  if (!a.length) return [];
2595
- const n = Ne().flatMap((c) => c.emoji), o = a.join("_").replace(/^:|:$/g, ""), r = n.filter((c) => {
2598
+ const n = je().flatMap((c) => c.emoji), o = a.join("_").replace(/^:|:$/g, ""), r = n.filter((c) => {
2596
2599
  const u = c.name.split(/[\s-]+/);
2597
2600
  return a.every((m) => u.some((x) => x.startsWith(m))) || c.shortcodes.some((m) => m.startsWith(o));
2598
- }), f = a.join(" "), s = (c) => {
2601
+ }), f = a.join(" "), l = (c) => {
2599
2602
  if (c.name === f || c.shortcodes.includes(o)) return 0;
2600
2603
  const u = c.name.split(/[\s-]+/);
2601
2604
  return a.every((m) => u.includes(m)) ? 1 : 2;
2602
2605
  };
2603
- return r.sort((c, u) => s(c) - s(u)), r.slice(0, t);
2606
+ return r.sort((c, u) => l(c) - l(u)), r.slice(0, t);
2604
2607
  }
2605
- const hf = [
2608
+ const _f = [
2606
2609
  [128077],
2607
2610
  [10084, 65039],
2608
2611
  [128514],
@@ -2610,49 +2613,49 @@ const hf = [
2610
2613
  [128546],
2611
2614
  [128293]
2612
2615
  ].map((e) => String.fromCodePoint(...e));
2613
- function qt() {
2616
+ function $t() {
2614
2617
  return g.getState().recentEmoji;
2615
2618
  }
2616
- function Sn(e) {
2619
+ function In(e) {
2617
2620
  g.getState().noteRecentEmoji(e);
2618
2621
  }
2619
- function pf(e = 3, t = qt()) {
2622
+ function wf(e = 3, t = $t()) {
2620
2623
  const a = [];
2621
- for (const n of [...t, ...hf])
2624
+ for (const n of [...t, ..._f])
2622
2625
  if (a.includes(n) || a.push(n), a.length === e) break;
2623
2626
  return a;
2624
2627
  }
2625
- function Tn(e, t) {
2628
+ function An(e, t) {
2626
2629
  return e.by.some((a) => a === t.author || !!t.clientId && a === t.clientId);
2627
2630
  }
2628
- function bf(e, t, a) {
2631
+ function vf(e, t, a) {
2629
2632
  const n = /* @__PURE__ */ new Map();
2630
- for (const s of Object.values(t))
2631
- s.author && n.set(s.author, s.name), n.set(s.clientId, s.name);
2633
+ for (const l of Object.values(t))
2634
+ l.author && n.set(l.author, l.name), n.set(l.clientId, l.name);
2632
2635
  const o = [];
2633
2636
  let r = !1, f = 0;
2634
- for (const s of e.by) {
2635
- if (s === a.author || a.clientId && s === a.clientId) {
2637
+ for (const l of e.by) {
2638
+ if (l === a.author || a.clientId && l === a.clientId) {
2636
2639
  r = !0;
2637
2640
  continue;
2638
2641
  }
2639
- const c = n.get(s);
2642
+ const c = n.get(l);
2640
2643
  c ? o.push(c) : f += 1;
2641
2644
  }
2642
2645
  return r && o.unshift("You"), f && o.push(f === 1 ? "1 other" : `${f} others`), o;
2643
2646
  }
2644
- function yf(e, t) {
2647
+ function kf(e, t) {
2645
2648
  return `${e.length <= 1 ? e[0] ?? "Someone" : `${e.slice(0, -1).join(", ")} and ${e[e.length - 1]}`} reacted with ${t ? `:${t.replace(/\s+/g, "_")}:` : "this"}`;
2646
2649
  }
2647
- const ce = 8;
2648
- function _f(e) {
2650
+ const de = 8;
2651
+ function xf(e) {
2649
2652
  return document.addEventListener("fullscreenchange", e), () => document.removeEventListener("fullscreenchange", e);
2650
2653
  }
2651
- function wf() {
2652
- const e = Wa();
2653
- return _a(_f, () => document.fullscreenElement, () => null) ?? e ?? document.body;
2654
+ function Sf() {
2655
+ const e = Va();
2656
+ return ka(xf, () => document.fullscreenElement, () => null) ?? e ?? document.body;
2654
2657
  }
2655
- function vf({
2658
+ function Tf({
2656
2659
  anchor: e,
2657
2660
  onClose: t,
2658
2661
  width: a,
@@ -2660,54 +2663,54 @@ function vf({
2660
2663
  alignEnd: o = !1,
2661
2664
  gap: r = 6,
2662
2665
  className: f = "",
2663
- role: s = "dialog",
2666
+ role: l = "dialog",
2664
2667
  ariaLabel: c,
2665
2668
  testId: u,
2666
2669
  children: m
2667
2670
  }) {
2668
- const x = wf(), S = U(null), [I, R] = N(null), y = D(() => {
2671
+ const x = Sf(), S = U(null), [C, N] = A(null), _ = D(() => {
2669
2672
  const d = S.current;
2670
2673
  if (!e || !d) return;
2671
- const b = e.getBoundingClientRect(), h = window.innerWidth, _ = window.innerHeight, v = Math.min(a, h - ce * 2), P = Math.min(Math.max(ce, o ? b.right - v : b.left), h - v - 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;
2672
- R((H) => H && H.left === P && H.top === q && H.maxHeight === j ? H : { left: P, top: q, maxHeight: j });
2674
+ const y = e.getBoundingClientRect(), b = window.innerWidth, p = window.innerHeight, v = Math.min(a, b - de * 2), P = Math.min(Math.max(de, o ? y.right - v : y.left), b - v - de), q = d.offsetHeight, W = y.top - r - de, $ = p - y.bottom - r - de, E = n === "top" ? q <= W || W >= $ : !(q <= $ || $ >= W), j = Math.max(120, E ? W : $), M = Math.min(q, j), H = E ? y.top - r - M : y.bottom + r;
2675
+ N((O) => O && O.left === P && O.top === H && O.maxHeight === j ? O : { left: P, top: H, maxHeight: j });
2673
2676
  }, [e, a, o, r, n]);
2674
- return ut(() => {
2675
- y();
2676
- const d = S.current, b = typeof ResizeObserver > "u" || !d ? null : new ResizeObserver(() => y());
2677
- return b && d && b.observe(d), window.addEventListener("resize", y), window.addEventListener("scroll", y, !0), () => {
2678
- b?.disconnect(), window.removeEventListener("resize", y), window.removeEventListener("scroll", y, !0);
2677
+ return ht(() => {
2678
+ _();
2679
+ const d = S.current, y = typeof ResizeObserver > "u" || !d ? null : new ResizeObserver(() => _());
2680
+ return y && d && y.observe(d), window.addEventListener("resize", _), window.addEventListener("scroll", _, !0), () => {
2681
+ y?.disconnect(), window.removeEventListener("resize", _), window.removeEventListener("scroll", _, !0);
2679
2682
  };
2680
- }, [y]), ut(() => {
2681
- const d = (h) => {
2682
- at(h) && (h.stopPropagation(), t(), e?.focus({ preventScroll: !0 }));
2683
- }, b = (h) => {
2684
- const _ = h.target;
2685
- S.current?.contains(_) || e?.contains(_) || t();
2683
+ }, [_]), ht(() => {
2684
+ const d = (b) => {
2685
+ ot(b) && (b.stopPropagation(), t(), e?.focus({ preventScroll: !0 }));
2686
+ }, y = (b) => {
2687
+ const p = b.target;
2688
+ S.current?.contains(p) || e?.contains(p) || t();
2686
2689
  };
2687
- return document.addEventListener("keydown", d), document.addEventListener("pointerdown", b, !0), () => {
2688
- document.removeEventListener("keydown", d), document.removeEventListener("pointerdown", b, !0);
2690
+ return document.addEventListener("keydown", d), document.addEventListener("pointerdown", y, !0), () => {
2691
+ document.removeEventListener("keydown", d), document.removeEventListener("pointerdown", y, !0);
2689
2692
  };
2690
- }, [t, e]), Sa(
2691
- /* @__PURE__ */ l(
2693
+ }, [t, e]), Ia(
2694
+ /* @__PURE__ */ s(
2692
2695
  "div",
2693
2696
  {
2694
2697
  ref: S,
2695
- role: s,
2698
+ role: l,
2696
2699
  "aria-label": c,
2697
2700
  "data-testid": u,
2698
2701
  className: `floating-panel ${f}`,
2699
2702
  style: {
2700
2703
  position: "fixed",
2701
- left: I?.left ?? 0,
2702
- top: I?.top ?? 0,
2704
+ left: C?.left ?? 0,
2705
+ top: C?.top ?? 0,
2703
2706
  width: a,
2704
- maxWidth: `calc(100vw - ${ce * 2}px)`,
2705
- maxHeight: I?.maxHeight,
2707
+ maxWidth: `calc(100vw - ${de * 2}px)`,
2708
+ maxHeight: C?.maxHeight,
2706
2709
  // Measured before it is shown, so it never flashes at 0,0. Opacity,
2707
2710
  // not visibility: a hidden element cannot take focus, and the panel's
2708
2711
  // content focuses itself on mount (the emoji search, a menu option).
2709
- opacity: I ? 1 : 0,
2710
- pointerEvents: I ? void 0 : "none"
2712
+ opacity: C ? 1 : 0,
2713
+ pointerEvents: C ? void 0 : "none"
2711
2714
  },
2712
2715
  children: m
2713
2716
  }
@@ -2715,39 +2718,39 @@ function vf({
2715
2718
  x
2716
2719
  );
2717
2720
  }
2718
- const kf = 340;
2719
- function xf({ anchor: e, onPick: t, onClose: a }) {
2720
- const [n, o] = N(""), [r, f] = N(null), s = U(null), c = U(null), u = F(() => Ne(), []), m = F(
2721
- () => qt().map((d) => Qe(d) ?? { char: d, name: "", shortcodes: [] }).slice(0, 16),
2721
+ const Cf = 340;
2722
+ function Ef({ anchor: e, onPick: t, onClose: a }) {
2723
+ const [n, o] = A(""), [r, f] = A(null), l = U(null), c = U(null), u = z(() => je(), []), m = z(
2724
+ () => $t().map((d) => et(d) ?? { char: d, name: "", shortcodes: [] }).slice(0, 16),
2722
2725
  []
2723
- ), x = F(() => gf(n), [n]), S = n.trim().length > 0;
2724
- M(() => {
2725
- s.current?.focus({ preventScroll: !0 });
2726
+ ), x = z(() => yf(n), [n]), S = n.trim().length > 0;
2727
+ R(() => {
2728
+ l.current?.focus({ preventScroll: !0 });
2726
2729
  }, []);
2727
- const I = (d, b) => {
2728
- t(b.char), d.shiftKey || a();
2729
- }, R = (d) => {
2730
- const b = c.current, h = b?.querySelector(`[data-emoji-group="${d}"]`);
2731
- b && h && (b.scrollTop = h.offsetTop - b.offsetTop);
2732
- }, y = (d, b) => /* @__PURE__ */ l(
2730
+ const C = (d, y) => {
2731
+ t(y.char), d.shiftKey || a();
2732
+ }, N = (d) => {
2733
+ const y = c.current, b = y?.querySelector(`[data-emoji-group="${d}"]`);
2734
+ y && b && (y.scrollTop = b.offsetTop - y.offsetTop);
2735
+ }, _ = (d, y) => /* @__PURE__ */ s(
2733
2736
  "button",
2734
2737
  {
2735
2738
  type: "button",
2736
2739
  className: "emoji-cell",
2737
- onClick: (h) => I(h, d),
2740
+ onClick: (b) => C(b, d),
2738
2741
  onMouseEnter: () => f(d),
2739
2742
  onFocus: () => f(d),
2740
2743
  "aria-label": d.name || d.char,
2741
2744
  "data-emoji": d.char,
2742
2745
  children: d.char
2743
2746
  },
2744
- b
2747
+ y
2745
2748
  );
2746
- return /* @__PURE__ */ w(vf, { anchor: e, onClose: a, width: kf, className: "emoji-picker", ariaLabel: "Emoji picker", testId: "emoji-picker", children: [
2747
- /* @__PURE__ */ l("div", { className: "emoji-picker-search", children: /* @__PURE__ */ l(
2749
+ return /* @__PURE__ */ w(Tf, { anchor: e, onClose: a, width: Cf, className: "emoji-picker", ariaLabel: "Emoji picker", testId: "emoji-picker", children: [
2750
+ /* @__PURE__ */ s("div", { className: "emoji-picker-search", children: /* @__PURE__ */ s(
2748
2751
  "input",
2749
2752
  {
2750
- ref: s,
2753
+ ref: l,
2751
2754
  type: "text",
2752
2755
  value: n,
2753
2756
  onChange: (d) => o(d.target.value),
@@ -2757,25 +2760,25 @@ function xf({ anchor: e, onPick: t, onClose: a }) {
2757
2760
  }
2758
2761
  ) }),
2759
2762
  !S && /* @__PURE__ */ w("div", { className: "emoji-picker-tabs", role: "tablist", "aria-label": "Emoji categories", children: [
2760
- m.length > 0 && /* @__PURE__ */ l("button", { type: "button", className: "emoji-tab", onClick: () => R("recent"), title: "Frequently used", "aria-label": "Frequently used", children: m[0].char }),
2761
- u.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))
2763
+ m.length > 0 && /* @__PURE__ */ s("button", { type: "button", className: "emoji-tab", onClick: () => N("recent"), title: "Frequently used", "aria-label": "Frequently used", children: m[0].char }),
2764
+ u.map((d) => /* @__PURE__ */ s("button", { type: "button", className: "emoji-tab", onClick: () => N(d.id), title: d.label, "aria-label": d.label, children: d.emoji[0].char }, d.id))
2762
2765
  ] }),
2763
- /* @__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: [
2766
+ /* @__PURE__ */ s("div", { ref: c, className: "emoji-picker-body", onMouseLeave: () => f(null), children: S ? x.length ? /* @__PURE__ */ s("div", { className: "emoji-grid", children: x.map((d) => _(d, d.char)) }) : /* @__PURE__ */ w("p", { className: "emoji-picker-empty", children: [
2764
2767
  "No emoji match “",
2765
2768
  n.trim(),
2766
2769
  "”"
2767
- ] }) : /* @__PURE__ */ w(te, { children: [
2770
+ ] }) : /* @__PURE__ */ w(X, { children: [
2768
2771
  m.length > 0 && /* @__PURE__ */ w("section", { "data-emoji-group": "recent", children: [
2769
- /* @__PURE__ */ l("h4", { className: "emoji-section-label", children: "Frequently used" }),
2770
- /* @__PURE__ */ l("div", { className: "emoji-grid", children: m.map((d) => y(d, `r-${d.char}`)) })
2772
+ /* @__PURE__ */ s("h4", { className: "emoji-section-label", children: "Frequently used" }),
2773
+ /* @__PURE__ */ s("div", { className: "emoji-grid", children: m.map((d) => _(d, `r-${d.char}`)) })
2771
2774
  ] }),
2772
2775
  u.map((d) => /* @__PURE__ */ w("section", { "data-emoji-group": d.id, className: "emoji-section", children: [
2773
- /* @__PURE__ */ l("h4", { className: "emoji-section-label", children: d.label }),
2774
- /* @__PURE__ */ l("div", { className: "emoji-grid", children: d.emoji.map((b) => y(b, b.char)) })
2776
+ /* @__PURE__ */ s("h4", { className: "emoji-section-label", children: d.label }),
2777
+ /* @__PURE__ */ s("div", { className: "emoji-grid", children: d.emoji.map((y) => _(y, y.char)) })
2775
2778
  ] }, d.id))
2776
2779
  ] }) }),
2777
- /* @__PURE__ */ l("div", { className: "emoji-picker-footer", "aria-hidden": "true", children: r ? /* @__PURE__ */ w(te, { children: [
2778
- /* @__PURE__ */ l("span", { className: "emoji-picker-footer-char", children: r.char }),
2780
+ /* @__PURE__ */ s("div", { className: "emoji-picker-footer", "aria-hidden": "true", children: r ? /* @__PURE__ */ w(X, { children: [
2781
+ /* @__PURE__ */ s("span", { className: "emoji-picker-footer-char", children: r.char }),
2779
2782
  /* @__PURE__ */ w("span", { className: "emoji-picker-footer-name", children: [
2780
2783
  ":",
2781
2784
  r.shortcodes[0] ?? r.name.replace(/\s+/g, "_"),
@@ -2784,126 +2787,126 @@ function xf({ anchor: e, onPick: t, onClose: a }) {
2784
2787
  ] }) : null })
2785
2788
  ] });
2786
2789
  }
2787
- function Sf({ className: e = "w-4 h-4" }) {
2790
+ function If({ className: e = "w-4 h-4" }) {
2788
2791
  return /* @__PURE__ */ w("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
2789
- /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 4v16" }),
2790
- /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15 12l-5 4v-8l5 4z" })
2792
+ /* @__PURE__ */ s("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 4v16" }),
2793
+ /* @__PURE__ */ s("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15 12l-5 4v-8l5 4z" })
2791
2794
  ] });
2792
2795
  }
2793
- function Tf({ className: e = "w-4 h-4" }) {
2796
+ function Af({ className: e = "w-4 h-4" }) {
2794
2797
  return /* @__PURE__ */ w("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
2795
- /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M20 4v16" }),
2796
- /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 12l5 4v-8l-5 4z" })
2798
+ /* @__PURE__ */ s("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M20 4v16" }),
2799
+ /* @__PURE__ */ s("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 12l5 4v-8l-5 4z" })
2797
2800
  ] });
2798
2801
  }
2799
- function Cf({ className: e = "w-5 h-5" }) {
2800
- return /* @__PURE__ */ l("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 6l12 12M18 6L6 18" }) });
2802
+ function Nf({ className: e = "w-5 h-5" }) {
2803
+ return /* @__PURE__ */ s("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ s("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 6l12 12M18 6L6 18" }) });
2801
2804
  }
2802
- function Cn({ className: e = "w-4 h-4" }) {
2805
+ function Nn({ className: e = "w-4 h-4" }) {
2803
2806
  return /* @__PURE__ */ w("svg", { className: e, fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: [
2804
- /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M20.5 12.5A8.5 8.5 0 1111.5 3.5" }),
2805
- /* @__PURE__ */ l("path", { strokeLinecap: "round", d: "M8.5 14.5a4 4 0 007 0" }),
2806
- /* @__PURE__ */ l("path", { strokeLinecap: "round", d: "M9 9.5h.01M14 9.5h.01", strokeWidth: 2.6 }),
2807
- /* @__PURE__ */ l("path", { strokeLinecap: "round", d: "M19 2v6M16 5h6" })
2807
+ /* @__PURE__ */ s("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M20.5 12.5A8.5 8.5 0 1111.5 3.5" }),
2808
+ /* @__PURE__ */ s("path", { strokeLinecap: "round", d: "M8.5 14.5a4 4 0 007 0" }),
2809
+ /* @__PURE__ */ s("path", { strokeLinecap: "round", d: "M9 9.5h.01M14 9.5h.01", strokeWidth: 2.6 }),
2810
+ /* @__PURE__ */ s("path", { strokeLinecap: "round", d: "M19 2v6M16 5h6" })
2808
2811
  ] });
2809
2812
  }
2810
- function Ef({ className: e = "w-4 h-4" }) {
2813
+ function jf({ className: e = "w-4 h-4" }) {
2811
2814
  return /* @__PURE__ */ w("svg", { className: e, fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: [
2812
- /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M10 7L4 12l6 5" }),
2813
- /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 12h9a7 7 0 017 7" })
2815
+ /* @__PURE__ */ s("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M10 7L4 12l6 5" }),
2816
+ /* @__PURE__ */ s("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 12h9a7 7 0 017 7" })
2814
2817
  ] });
2815
2818
  }
2816
- function dt(e) {
2819
+ function mt(e) {
2817
2820
  return new Date(e).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
2818
2821
  }
2819
- const If = Ke.memo(function({ message: t }) {
2820
- const a = g((h) => h.me.clientId), n = g((h) => h.me.clientId ? h.roster[h.me.clientId]?.author : void 0), o = ff(t, { clientId: a, author: n }), r = rt(
2822
+ const Rf = Ye.memo(function({ message: t }) {
2823
+ const a = g((b) => b.me.clientId), n = g((b) => b.me.clientId ? b.roster[b.me.clientId]?.author : void 0), o = df(t, { clientId: a, author: n }), r = ft(
2821
2824
  { clientId: t.clientId, author: t.author },
2822
2825
  { name: t.name, sprite: t.sprite }
2823
- ), f = Ae(r.sprite, r.pictureUrl), s = t.isSystem ? void 0 : r.cosmetics, c = U(null);
2824
- er(c, !!s);
2825
- const [u] = N(
2826
- () => t.live && t.text ? va(t.text, s) : null
2827
- ), [m, x] = N(!1), [S, I] = N(null), R = g((h) => h.setReplyingTo), y = g((h) => h.recentEmoji);
2826
+ ), f = Ne(r.sprite, r.pictureUrl), l = t.isSystem ? void 0 : r.cosmetics, c = U(null);
2827
+ or(c, !!l);
2828
+ const [u] = A(
2829
+ () => t.live && t.text ? Ta(t.text, l) : null
2830
+ ), [m, x] = A(!1), [S, C] = A(null), N = g((b) => b.setReplyingTo), _ = g((b) => b.recentEmoji);
2828
2831
  if (t.isSystem && t.systemType === "recap")
2829
- 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: [
2832
+ return /* @__PURE__ */ s("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: [
2830
2833
  /* @__PURE__ */ w("div", { className: "text-[10px] uppercase tracking-wide text-text-muted mb-0.5", children: [
2831
2834
  "Recap",
2832
- /* @__PURE__ */ l("span", { className: "ml-1.5 normal-case tracking-normal opacity-60", children: dt(t.ts) })
2835
+ /* @__PURE__ */ s("span", { className: "ml-1.5 normal-case tracking-normal opacity-60", children: mt(t.ts) })
2833
2836
  ] }),
2834
- /* @__PURE__ */ l("p", { className: "text-[13px] text-text-secondary leading-relaxed whitespace-pre-wrap break-words", children: t.text })
2837
+ /* @__PURE__ */ s("p", { className: "text-[13px] text-text-secondary leading-relaxed whitespace-pre-wrap break-words", children: t.text })
2835
2838
  ] }) });
2836
2839
  if (t.isSystem)
2837
2840
  return /* @__PURE__ */ w("div", { className: "px-2 py-0.5 text-[11px] text-text-muted italic text-center leading-tight", children: [
2838
- tf(t.text, t.template, r),
2839
- /* @__PURE__ */ l("span", { className: "ml-1 text-[10px] opacity-50", children: dt(t.ts) })
2841
+ rf(t.text, t.template, r),
2842
+ /* @__PURE__ */ s("span", { className: "ml-1 text-[10px] opacity-50", children: mt(t.ts) })
2840
2843
  ] });
2841
- const d = { clientId: a, author: n }, b = (h) => {
2842
- const _ = t.reactions?.find((O) => O.emoji === h), v = !(_ && Tn(_, d));
2843
- v && Sn(h);
2844
+ const d = { clientId: a, author: n }, y = (b) => {
2845
+ const p = t.reactions?.find((q) => q.emoji === b), v = !(p && An(p, d));
2846
+ v && In(b);
2844
2847
  const P = n ?? a;
2845
- P && Vr(t.id, h, v, P), zi(t.id, h, v);
2848
+ P && Qr(t.id, b, v, P), Ki(t.id, b, v);
2846
2849
  };
2847
2850
  return /* @__PURE__ */ w(
2848
2851
  "div",
2849
2852
  {
2850
2853
  ref: c,
2851
- style: Ka(f),
2854
+ style: Xa(f),
2852
2855
  "data-msg-id": t.id,
2853
2856
  className: `chat-msg px-2 py-1 ${o ? "chat-msg-own" : ""}`,
2854
2857
  onMouseEnter: () => x(!0),
2855
2858
  onMouseLeave: () => x(!1),
2856
2859
  onFocus: () => x(!0),
2857
- onBlur: (h) => {
2858
- h.currentTarget.contains(h.relatedTarget) || x(!1);
2860
+ onBlur: (b) => {
2861
+ b.currentTarget.contains(b.relatedTarget) || x(!1);
2859
2862
  },
2860
2863
  "data-active": m || S ? "true" : void 0,
2861
2864
  children: [
2862
- t.replyTo && /* @__PURE__ */ l(Af, { replyTo: t.replyTo }),
2865
+ t.replyTo && /* @__PURE__ */ s(Pf, { replyTo: t.replyTo }),
2863
2866
  /* @__PURE__ */ w("div", { className: "flex items-start gap-2", children: [
2864
- /* @__PURE__ */ l(vn, { sprite: r.sprite, url: r.pictureUrl, alt: r.name, worn: s }),
2867
+ /* @__PURE__ */ s(Tn, { sprite: r.sprite, url: r.pictureUrl, alt: r.name, worn: l }),
2865
2868
  /* @__PURE__ */ w("div", { className: "flex-1 min-w-0 -mt-0.5", children: [
2866
- s ? /* @__PURE__ */ l(we, { html: ka(r.name, s), className: "text-[13px]", style: { color: f } }) : /* @__PURE__ */ l("span", { className: "font-medium text-[13px]", style: { color: f }, children: r.name }),
2867
- /* @__PURE__ */ l("span", { className: "text-[10px] text-text-muted opacity-60 ml-1.5", children: dt(t.ts) }),
2868
- t.text && (u ? /* @__PURE__ */ l(we, { as: "p", html: u, 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 })),
2869
- /* @__PURE__ */ l(kn, { images: t.images }),
2870
- t.reactions && t.reactions.length > 0 && /* @__PURE__ */ l(Nf, { reactions: t.reactions, me: d, onToggle: b, onAdd: I })
2869
+ l ? /* @__PURE__ */ s(ve, { html: Ca(r.name, l), className: "text-[13px]", style: { color: f } }) : /* @__PURE__ */ s("span", { className: "font-medium text-[13px]", style: { color: f }, children: r.name }),
2870
+ /* @__PURE__ */ s("span", { className: "text-[10px] text-text-muted opacity-60 ml-1.5", children: mt(t.ts) }),
2871
+ t.text && (u ? /* @__PURE__ */ s(ve, { as: "p", html: u, className: "text-[13px] text-text break-words leading-snug m-0" }) : /* @__PURE__ */ s("p", { className: "text-[13px] text-text break-words leading-snug m-0", children: t.text })),
2872
+ /* @__PURE__ */ s(Cn, { images: t.images }),
2873
+ t.reactions && t.reactions.length > 0 && /* @__PURE__ */ s(Mf, { reactions: t.reactions, me: d, onToggle: y, onAdd: C })
2871
2874
  ] })
2872
2875
  ] }),
2873
2876
  (m || S) && /* @__PURE__ */ w("div", { className: "chat-msg-actions", role: "toolbar", "aria-label": "Message actions", "data-testid": "chat-msg-actions", children: [
2874
- pf(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)),
2875
- /* @__PURE__ */ l(
2877
+ wf(3, _).map((b) => /* @__PURE__ */ s("button", { type: "button", className: "chat-action-btn chat-action-emoji", onClick: () => y(b), "aria-label": `React with ${et(b)?.name ?? b}`, title: et(b)?.name, children: b }, b)),
2878
+ /* @__PURE__ */ s(
2876
2879
  "button",
2877
2880
  {
2878
2881
  type: "button",
2879
2882
  className: "chat-action-btn",
2880
- onClick: (h) => I(S ? null : h.currentTarget),
2883
+ onClick: (b) => C(S ? null : b.currentTarget),
2881
2884
  "aria-label": "Add reaction",
2882
2885
  title: "Add reaction",
2883
2886
  "aria-expanded": !!S,
2884
- children: /* @__PURE__ */ l(Cn, {})
2887
+ children: /* @__PURE__ */ s(Nn, {})
2885
2888
  }
2886
2889
  ),
2887
- /* @__PURE__ */ l("button", { type: "button", className: "chat-action-btn", onClick: () => R(t.id), "aria-label": "Reply", title: "Reply", children: /* @__PURE__ */ l(Ef, {}) })
2890
+ /* @__PURE__ */ s("button", { type: "button", className: "chat-action-btn", onClick: () => N(t.id), "aria-label": "Reply", title: "Reply", children: /* @__PURE__ */ s(jf, {}) })
2888
2891
  ] }),
2889
- S && /* @__PURE__ */ l(xf, { anchor: S, onPick: b, onClose: () => {
2890
- I(null), x(!1);
2892
+ S && /* @__PURE__ */ s(Ef, { anchor: S, onPick: y, onClose: () => {
2893
+ C(null), x(!1);
2891
2894
  } })
2892
2895
  ]
2893
2896
  }
2894
2897
  );
2895
2898
  });
2896
- function Af({ replyTo: e }) {
2897
- const t = g((f) => f.chat.find((s) => s.id === e)), a = g((f) => f.jumpToMessage), n = rt(
2899
+ function Pf({ replyTo: e }) {
2900
+ const t = g((f) => f.chat.find((l) => l.id === e)), a = g((f) => f.jumpToMessage), n = ft(
2898
2901
  { clientId: t?.clientId ?? "", author: t?.author },
2899
2902
  { name: t?.name ?? "", sprite: t?.sprite ?? null }
2900
- ), o = Ae(n.sprite, n.pictureUrl);
2903
+ ), o = Ne(n.sprite, n.pictureUrl);
2901
2904
  if (!t)
2902
2905
  return /* @__PURE__ */ w("div", { className: "chat-reply-quote", "data-testid": "chat-reply-quote", "data-missing": "true", children: [
2903
- /* @__PURE__ */ l("span", { className: "chat-reply-spine", "aria-hidden": "true" }),
2904
- /* @__PURE__ */ l("span", { className: "chat-reply-text italic", children: "Original message unavailable" })
2906
+ /* @__PURE__ */ s("span", { className: "chat-reply-spine", "aria-hidden": "true" }),
2907
+ /* @__PURE__ */ s("span", { className: "chat-reply-text italic", children: "Original message unavailable" })
2905
2908
  ] });
2906
- const r = t.isSystem ? (t.template ?? t.text).split(Tt).join(n.name) : t.text || (t.images?.length ? "Image" : "");
2909
+ const r = t.isSystem ? (t.template ?? t.text).split(It).join(n.name) : t.text || (t.images?.length ? "Image" : "");
2907
2910
  return /* @__PURE__ */ w(
2908
2911
  "button",
2909
2912
  {
@@ -2913,28 +2916,28 @@ function Af({ replyTo: e }) {
2913
2916
  onClick: () => a(e),
2914
2917
  title: "Jump to message",
2915
2918
  children: [
2916
- /* @__PURE__ */ l("span", { className: "chat-reply-spine", "aria-hidden": "true" }),
2917
- /* @__PURE__ */ l(
2918
- Ot,
2919
+ /* @__PURE__ */ s("span", { className: "chat-reply-spine", "aria-hidden": "true" }),
2920
+ /* @__PURE__ */ s(
2921
+ Ut,
2919
2922
  {
2920
2923
  sprite: n.sprite,
2921
2924
  url: n.pictureUrl,
2922
2925
  alt: "",
2923
2926
  className: "w-4 h-4 rounded-full object-cover flex-shrink-0",
2924
- fallback: /* @__PURE__ */ l("span", { className: "inline-block w-4 h-4 bg-bg-alt/50 rounded-full flex-shrink-0" })
2927
+ fallback: /* @__PURE__ */ s("span", { className: "inline-block w-4 h-4 bg-bg-alt/50 rounded-full flex-shrink-0" })
2925
2928
  }
2926
2929
  ),
2927
- /* @__PURE__ */ l("span", { className: "chat-reply-name", style: { color: o }, children: n.name }),
2928
- /* @__PURE__ */ l("span", { className: "chat-reply-text", children: r })
2930
+ /* @__PURE__ */ s("span", { className: "chat-reply-name", style: { color: o }, children: n.name }),
2931
+ /* @__PURE__ */ s("span", { className: "chat-reply-text", children: r })
2929
2932
  ]
2930
2933
  }
2931
2934
  );
2932
2935
  }
2933
- function Nf({ reactions: e, me: t, onToggle: a, onAdd: n }) {
2936
+ function Mf({ reactions: e, me: t, onToggle: a, onAdd: n }) {
2934
2937
  const o = g((r) => r.roster);
2935
2938
  return /* @__PURE__ */ w("div", { className: "chat-reactions", "data-testid": "chat-reactions", children: [
2936
2939
  e.map((r) => {
2937
- const f = Tn(r, t);
2940
+ const f = An(r, t);
2938
2941
  return /* @__PURE__ */ w(
2939
2942
  "button",
2940
2943
  {
@@ -2943,62 +2946,62 @@ function Nf({ reactions: e, me: t, onToggle: a, onAdd: n }) {
2943
2946
  "data-mine": f ? "true" : void 0,
2944
2947
  "aria-pressed": f,
2945
2948
  onClick: () => a(r.emoji),
2946
- title: yf(bf(r, o, t), Qe(r.emoji)?.name),
2949
+ title: kf(vf(r, o, t), et(r.emoji)?.name),
2947
2950
  "data-emoji": r.emoji,
2948
2951
  children: [
2949
- /* @__PURE__ */ l("span", { className: "chat-reaction-emoji", children: r.emoji }),
2950
- /* @__PURE__ */ l("span", { className: "chat-reaction-count", children: r.by.length })
2952
+ /* @__PURE__ */ s("span", { className: "chat-reaction-emoji", children: r.emoji }),
2953
+ /* @__PURE__ */ s("span", { className: "chat-reaction-count", children: r.by.length })
2951
2954
  ]
2952
2955
  },
2953
2956
  r.emoji
2954
2957
  );
2955
2958
  }),
2956
- /* @__PURE__ */ l("button", { type: "button", className: "chat-reaction chat-reaction-add", onClick: (r) => n(r.currentTarget), "aria-label": "Add reaction", title: "Add reaction", children: /* @__PURE__ */ l(Cn, {}) })
2959
+ /* @__PURE__ */ s("button", { type: "button", className: "chat-reaction chat-reaction-add", onClick: (r) => n(r.currentTarget), "aria-label": "Add reaction", title: "Add reaction", children: /* @__PURE__ */ s(Nn, {}) })
2957
2960
  ] });
2958
2961
  }
2959
- function jf() {
2960
- Ga();
2962
+ function Df() {
2963
+ Ja();
2961
2964
  const e = g((r) => r.chat), t = U(null), a = U(!1), n = D(() => {
2962
2965
  const r = t.current;
2963
2966
  if (!r) return;
2964
- const { scrollHeight: f, scrollTop: s, clientHeight: c } = r, u = f - s - c;
2967
+ const { scrollHeight: f, scrollTop: l, clientHeight: c } = r, u = f - l - c;
2965
2968
  a.current = u > 40;
2966
2969
  }, []);
2967
- M(() => {
2970
+ R(() => {
2968
2971
  const r = t.current;
2969
2972
  !r || a.current || (typeof r.scrollTo == "function" ? r.scrollTo({ top: r.scrollHeight, behavior: "smooth" }) : r.scrollTop = r.scrollHeight);
2970
2973
  }, [e.length]);
2971
2974
  const o = g((r) => r.chatJump);
2972
- return M(() => {
2975
+ return R(() => {
2973
2976
  const r = t.current;
2974
2977
  if (!o || !r) return;
2975
2978
  const f = r.querySelector(`[data-msg-id="${o.id}"]`);
2976
2979
  if (!f) return;
2977
- const s = f.offsetTop - (r.clientHeight - f.offsetHeight) / 2;
2978
- typeof r.scrollTo == "function" ? r.scrollTo({ top: s, behavior: "smooth" }) : r.scrollTop = s, f.removeAttribute("data-flash"), f.offsetWidth, f.setAttribute("data-flash", "true");
2980
+ const l = f.offsetTop - (r.clientHeight - f.offsetHeight) / 2;
2981
+ typeof r.scrollTo == "function" ? r.scrollTo({ top: l, behavior: "smooth" }) : r.scrollTop = l, f.removeAttribute("data-flash"), f.offsetWidth, f.setAttribute("data-flash", "true");
2979
2982
  const c = setTimeout(() => f.removeAttribute("data-flash"), 2e3);
2980
2983
  return () => clearTimeout(c);
2981
- }, [o]), /* @__PURE__ */ l(
2984
+ }, [o]), /* @__PURE__ */ s(
2982
2985
  "div",
2983
2986
  {
2984
2987
  ref: t,
2985
2988
  onScroll: n,
2986
2989
  className: "relative flex-1 overflow-y-auto overflow-x-hidden chat-messages pt-3",
2987
- children: e.length === 0 ? /* @__PURE__ */ l("div", { className: "p-4 text-xs text-text-muted text-center", children: "No messages yet. Be the first to say something!" }) : /* @__PURE__ */ l(te, { children: e.map((r, f) => {
2988
- const s = f > 0 ? e[f - 1] : null, c = s && r.ts - s.ts > 1440 * 60 * 1e3;
2989
- return /* @__PURE__ */ w(Ke.Fragment, { children: [
2990
+ children: e.length === 0 ? /* @__PURE__ */ s("div", { className: "p-4 text-xs text-text-muted text-center", children: "No messages yet. Be the first to say something!" }) : /* @__PURE__ */ s(X, { children: e.map((r, f) => {
2991
+ const l = f > 0 ? e[f - 1] : null, c = l && r.ts - l.ts > 1440 * 60 * 1e3;
2992
+ return /* @__PURE__ */ w(Ye.Fragment, { children: [
2990
2993
  c && /* @__PURE__ */ w("div", { className: "flex items-center gap-2 px-4 py-2 my-1", children: [
2991
- /* @__PURE__ */ l("div", { className: "flex-1 h-px bg-border" }),
2992
- /* @__PURE__ */ l("span", { className: "text-[10px] text-text-muted whitespace-nowrap", children: new Date(r.ts).toLocaleDateString([], { weekday: "short", month: "short", day: "numeric" }) }),
2993
- /* @__PURE__ */ l("div", { className: "flex-1 h-px bg-border" })
2994
+ /* @__PURE__ */ s("div", { className: "flex-1 h-px bg-border" }),
2995
+ /* @__PURE__ */ s("span", { className: "text-[10px] text-text-muted whitespace-nowrap", children: new Date(r.ts).toLocaleDateString([], { weekday: "short", month: "short", day: "numeric" }) }),
2996
+ /* @__PURE__ */ s("div", { className: "flex-1 h-px bg-border" })
2994
2997
  ] }),
2995
- /* @__PURE__ */ l(If, { message: r })
2998
+ /* @__PURE__ */ s(Rf, { message: r })
2996
2999
  ] }, r.id);
2997
3000
  }) })
2998
3001
  }
2999
3002
  );
3000
3003
  }
3001
- const Ht = [
3004
+ const Ft = [
3002
3005
  {
3003
3006
  name: "recap",
3004
3007
  description: "Summarise the previous episode of what is loaded",
@@ -3018,13 +3021,13 @@ const Ht = [
3018
3021
  usage: "/help",
3019
3022
  scope: "local"
3020
3023
  }
3021
- ], ue = "/";
3022
- function Rf(e) {
3023
- if (!e.startsWith(ue)) return null;
3024
- const t = e.slice(ue.length);
3024
+ ], me = "/";
3025
+ function Lf(e) {
3026
+ if (!e.startsWith(me)) return null;
3027
+ const t = e.slice(me.length);
3025
3028
  return /\s/.test(t) ? null : t.toLowerCase();
3026
3029
  }
3027
- function Pf(e, t = Ht) {
3030
+ function Of(e, t = Ft) {
3028
3031
  const a = e.toLowerCase();
3029
3032
  if (!a) return [...t].sort((o, r) => o.name.localeCompare(r.name));
3030
3033
  const n = [];
@@ -3034,23 +3037,23 @@ function Pf(e, t = Ht) {
3034
3037
  }
3035
3038
  return n.sort((o, r) => o.rank - r.rank || o.cmd.name.localeCompare(r.cmd.name)).map((o) => o.cmd);
3036
3039
  }
3037
- function Mf(e) {
3038
- return `${ue}${e.name} `;
3040
+ function Hf(e) {
3041
+ return `${me}${e.name} `;
3039
3042
  }
3040
- function _e(e, t) {
3043
+ function we(e, t) {
3041
3044
  return t <= 0 ? 0 : (e % t + t) % t;
3042
3045
  }
3043
- function Df(e, t = Ht) {
3046
+ function qf(e, t = Ft) {
3044
3047
  const a = e.trim();
3045
3048
  if (!a) return null;
3046
- if (!a.startsWith(ue)) return { kind: "chat", text: a };
3047
- const n = a.slice(ue.length), o = n.search(/\s/), r = (o === -1 ? n : n.slice(0, o)).toLowerCase(), f = o === -1 ? "" : n.slice(o).trim(), s = t.find((c) => c.name.toLowerCase() === r);
3048
- return s ? { kind: "command", command: s, args: f } : { kind: "chat", text: a };
3049
+ if (!a.startsWith(me)) return { kind: "chat", text: a };
3050
+ const n = a.slice(me.length), o = n.search(/\s/), r = (o === -1 ? n : n.slice(0, o)).toLowerCase(), f = o === -1 ? "" : n.slice(o).trim(), l = t.find((c) => c.name.toLowerCase() === r);
3051
+ return l ? { kind: "command", command: l, args: f } : { kind: "chat", text: a };
3049
3052
  }
3050
- function Lf(e, t) {
3051
- return e.requiresMedia && !t.hasMedia ? `${ue}${e.name} needs an episode loaded.` : null;
3053
+ function Uf(e, t) {
3054
+ return e.requiresMedia && !t.hasMedia ? `${me}${e.name} needs an episode loaded.` : null;
3052
3055
  }
3053
- function Of({
3056
+ function $f({
3054
3057
  commands: e,
3055
3058
  activeIndex: t,
3056
3059
  hasMedia: a,
@@ -3058,7 +3061,7 @@ function Of({
3058
3061
  onHover: o,
3059
3062
  listboxId: r
3060
3063
  }) {
3061
- return e.length === 0 ? null : /* @__PURE__ */ l(
3064
+ return e.length === 0 ? null : /* @__PURE__ */ s(
3062
3065
  "ul",
3063
3066
  {
3064
3067
  id: r,
@@ -3067,8 +3070,8 @@ function Of({
3067
3070
  className: `absolute bottom-full left-0 right-0 z-30 max-h-56 overflow-y-auto
3068
3071
  bg-bg-card border border-border-light rounded shadow-lg
3069
3072
  list-none m-0 p-0 py-1 mb-1`,
3070
- children: e.map((f, s) => {
3071
- const c = !!f.requiresMedia && !a, u = s === t;
3073
+ children: e.map((f, l) => {
3074
+ const c = !!f.requiresMedia && !a, u = l === t;
3072
3075
  return /* @__PURE__ */ w(
3073
3076
  "li",
3074
3077
  {
@@ -3079,11 +3082,11 @@ function Of({
3079
3082
  onMouseDown: (m) => {
3080
3083
  m.preventDefault(), n(f);
3081
3084
  },
3082
- onMouseEnter: () => o(s),
3085
+ onMouseEnter: () => o(l),
3083
3086
  className: `px-3 py-1.5 cursor-pointer flex items-baseline gap-2 ${u ? "bg-bg-alt" : ""} ${c ? "opacity-50" : ""}`,
3084
3087
  children: [
3085
- /* @__PURE__ */ l("span", { className: "text-sm font-semibold text-text shrink-0", children: f.usage }),
3086
- /* @__PURE__ */ l("span", { className: "text-xs text-text-secondary truncate", children: c ? "needs an episode loaded" : f.description })
3088
+ /* @__PURE__ */ s("span", { className: "text-sm font-semibold text-text shrink-0", children: f.usage }),
3089
+ /* @__PURE__ */ s("span", { className: "text-xs text-text-secondary truncate", children: c ? "needs an episode loaded" : f.description })
3087
3090
  ]
3088
3091
  },
3089
3092
  f.name
@@ -3092,9 +3095,9 @@ function Of({
3092
3095
  }
3093
3096
  );
3094
3097
  }
3095
- const En = (e, t) => `${e}-emoji-${t.code}`;
3096
- function qf({ matches: e, activeIndex: t, onPick: a, onHover: n, listboxId: o }) {
3097
- return e.length === 0 ? null : /* @__PURE__ */ l(
3098
+ const jn = (e, t) => `${e}-emoji-${t.code}`;
3099
+ function Ff({ matches: e, activeIndex: t, onPick: a, onHover: n, listboxId: o }) {
3100
+ return e.length === 0 ? null : /* @__PURE__ */ s(
3098
3101
  "ul",
3099
3102
  {
3100
3103
  id: o,
@@ -3107,16 +3110,16 @@ function qf({ matches: e, activeIndex: t, onPick: a, onHover: n, listboxId: o })
3107
3110
  children: e.map((r, f) => /* @__PURE__ */ w(
3108
3111
  "li",
3109
3112
  {
3110
- id: En(o, r),
3113
+ id: jn(o, r),
3111
3114
  role: "option",
3112
3115
  "aria-selected": f === t,
3113
- onMouseDown: (s) => {
3114
- s.preventDefault(), a(r);
3116
+ onMouseDown: (l) => {
3117
+ l.preventDefault(), a(r);
3115
3118
  },
3116
3119
  onMouseEnter: () => n(f),
3117
3120
  className: `px-3 py-1 cursor-pointer flex items-center gap-2 ${f === t ? "bg-bg-alt" : ""}`,
3118
3121
  children: [
3119
- /* @__PURE__ */ l("span", { className: "text-lg leading-none shrink-0", "aria-hidden": "true", children: r.emoji.char }),
3122
+ /* @__PURE__ */ s("span", { className: "text-lg leading-none shrink-0", "aria-hidden": "true", children: r.emoji.char }),
3120
3123
  /* @__PURE__ */ w("span", { className: "text-sm text-text truncate", children: [
3121
3124
  ":",
3122
3125
  r.code,
@@ -3129,58 +3132,58 @@ function qf({ matches: e, activeIndex: t, onPick: a, onHover: n, listboxId: o })
3129
3132
  }
3130
3133
  );
3131
3134
  }
3132
- const Hf = 2, Uf = /^[a-z0-9_+-]*$/i;
3133
- function $f(e, t) {
3135
+ const zf = 2, Wf = /^[a-z0-9_+-]*$/i;
3136
+ function Bf(e, t) {
3134
3137
  const a = e.slice(0, t), n = a.lastIndexOf(":");
3135
3138
  if (n < 0) return null;
3136
3139
  const o = n === 0 ? "" : a[n - 1];
3137
3140
  if (o && !/[\s([{]/.test(o)) return null;
3138
3141
  const r = a.slice(n + 1);
3139
- return r.length < Hf || !Uf.test(r) ? null : { query: r.toLowerCase(), start: n };
3142
+ return r.length < zf || !Wf.test(r) ? null : { query: r.toLowerCase(), start: n };
3140
3143
  }
3141
- function Ff(e, t, a, n) {
3144
+ function Gf(e, t, a, n) {
3142
3145
  const o = e.slice(a), r = o.startsWith(" ") ? n : `${n} `;
3143
3146
  return { text: e.slice(0, t) + r + o, caret: t + r.length };
3144
3147
  }
3145
- function zf(e) {
3148
+ function Kf(e) {
3146
3149
  let t = -1;
3147
3150
  return e.replace(/:([a-z0-9_+-]+):/gi, (a, n, o) => {
3148
3151
  const r = o === 0 ? "" : e[o - 1];
3149
3152
  if (r && !/[\s([{]/.test(r) && o !== t) return a;
3150
- const f = xn(n);
3153
+ const f = En(n);
3151
3154
  return f ? (t = o + a.length, f.char) : a;
3152
3155
  });
3153
3156
  }
3154
- function Wf(e, t, a) {
3155
- const [n, o] = N(0), [r, f] = N({ q: null, i: 0 }), [s, c] = N(null), u = $f(e, Math.min(n, e.length)), m = u?.query ?? null, x = F(() => m ? mf(m) : [], [m]), S = u ? `${u.start}:${m}` : null, I = x.length > 0 && s !== S, R = r.q === S ? _e(r.i, x.length) : 0, y = D((v) => f({ q: S, i: v }), [S]), d = U(null);
3156
- ut(() => {
3157
+ function Vf(e, t, a) {
3158
+ const [n, o] = A(0), [r, f] = A({ q: null, i: 0 }), [l, c] = A(null), u = Bf(e, Math.min(n, e.length)), m = u?.query ?? null, x = z(() => m ? bf(m) : [], [m]), S = u ? `${u.start}:${m}` : null, C = x.length > 0 && l !== S, N = r.q === S ? we(r.i, x.length) : 0, _ = D((v) => f({ q: S, i: v }), [S]), d = U(null);
3159
+ ht(() => {
3157
3160
  const v = d.current, P = a.current;
3158
3161
  v === null || !P || (d.current = null, P.setSelectionRange(v, v));
3159
3162
  }, [e, a]);
3160
- const b = D((v) => o(v.selectionStart ?? v.value.length), []), h = D((v) => {
3163
+ const y = D((v) => o(v.selectionStart ?? v.value.length), []), b = D((v) => {
3161
3164
  if (!u) return;
3162
- const P = Ff(e, u.start, Math.min(n, e.length), v.emoji.char);
3163
- t(P.text), o(P.caret), Sn(v.emoji.char), d.current = P.caret, a.current?.focus();
3164
- }, [u, e, n, t, a]), _ = D((v) => {
3165
- if (!I) return !1;
3165
+ const P = Gf(e, u.start, Math.min(n, e.length), v.emoji.char);
3166
+ t(P.text), o(P.caret), In(v.emoji.char), d.current = P.caret, a.current?.focus();
3167
+ }, [u, e, n, t, a]), p = D((v) => {
3168
+ if (!C) return !1;
3166
3169
  if (v.key === "ArrowDown" || v.key === "ArrowUp")
3167
- return v.preventDefault(), y(_e(R + (v.key === "ArrowDown" ? 1 : -1), x.length)), !0;
3170
+ return v.preventDefault(), _(we(N + (v.key === "ArrowDown" ? 1 : -1), x.length)), !0;
3168
3171
  if (v.key === "Tab" || v.key === "Enter") {
3169
3172
  v.preventDefault();
3170
- const P = x[R];
3171
- return P && h(P), !0;
3173
+ const P = x[N];
3174
+ return P && b(P), !0;
3172
3175
  }
3173
3176
  return v.key === "Escape" ? (v.preventDefault(), c(S), !0) : !1;
3174
- }, [I, x, R, h, y, S]);
3175
- return { open: I, matches: x, activeIndex: R, setActiveIndex: y, pick: h, onKeyDown: _, trackCaret: b };
3177
+ }, [C, x, N, b, _, S]);
3178
+ return { open: C, matches: x, activeIndex: N, setActiveIndex: _, pick: b, onKeyDown: p, trackCaret: y };
3176
3179
  }
3177
- function Bf({
3180
+ function Yf({
3178
3181
  pending: e,
3179
3182
  uploading: t,
3180
3183
  onRemove: a
3181
3184
  }) {
3182
- return e.length ? /* @__PURE__ */ l("div", { className: "flex flex-wrap gap-1.5 pb-1.5", "data-testid": "chat-attachment-strip", children: e.map((n) => /* @__PURE__ */ w("div", { className: "relative", children: [
3183
- /* @__PURE__ */ l(
3185
+ return e.length ? /* @__PURE__ */ s("div", { className: "flex flex-wrap gap-1.5 pb-1.5", "data-testid": "chat-attachment-strip", children: e.map((n) => /* @__PURE__ */ w("div", { className: "relative", children: [
3186
+ /* @__PURE__ */ s(
3184
3187
  "img",
3185
3188
  {
3186
3189
  src: n.previewUrl,
@@ -3188,7 +3191,7 @@ function Bf({
3188
3191
  className: `h-14 w-14 rounded border border-border-light object-cover ${t ? "opacity-50" : ""}`
3189
3192
  }
3190
3193
  ),
3191
- /* @__PURE__ */ l(
3194
+ /* @__PURE__ */ s(
3192
3195
  "button",
3193
3196
  {
3194
3197
  type: "button",
@@ -3201,84 +3204,84 @@ function Bf({
3201
3204
  )
3202
3205
  ] }, n.id)) }) : null;
3203
3206
  }
3204
- function Gf() {
3205
- const [e, t] = N([]), [a, n] = N(!1), o = g((y) => y.pushToast), r = U(/* @__PURE__ */ new Set());
3206
- M(() => () => {
3207
- for (const y of r.current) URL.revokeObjectURL(y);
3207
+ function Jf() {
3208
+ const [e, t] = A([]), [a, n] = A(!1), o = g((_) => _.pushToast), r = U(/* @__PURE__ */ new Set());
3209
+ R(() => () => {
3210
+ for (const _ of r.current) URL.revokeObjectURL(_);
3208
3211
  r.current.clear();
3209
3212
  }, []);
3210
- const f = D((y) => {
3211
- Do(y) && (URL.revokeObjectURL(y.previewUrl), r.current.delete(y.previewUrl));
3212
- }, []), s = D(async (y) => {
3213
- if (!y.length) return;
3213
+ const f = D((_) => {
3214
+ qo(_) && (URL.revokeObjectURL(_.previewUrl), r.current.delete(_.previewUrl));
3215
+ }, []), l = D(async (_) => {
3216
+ if (!_.length) return;
3214
3217
  const d = [];
3215
- for (const b of y) {
3216
- const h = Oo(b);
3217
- if (h) {
3218
- o("error", h);
3218
+ for (const y of _) {
3219
+ const b = $o(y);
3220
+ if (b) {
3221
+ o("error", b);
3219
3222
  continue;
3220
3223
  }
3221
- const { w: _, h: v } = await Uo(b), P = URL.createObjectURL(b);
3224
+ const { w: p, h: v } = await Wo(y), P = URL.createObjectURL(y);
3222
3225
  r.current.add(P), d.push({
3223
3226
  kind: "file",
3224
3227
  id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
3225
- file: b,
3228
+ file: y,
3226
3229
  previewUrl: P,
3227
- w: _,
3230
+ w: p,
3228
3231
  h: v
3229
3232
  });
3230
3233
  }
3231
- d.length && t((b) => {
3232
- const h = ae - b.length;
3233
- if (h <= 0) {
3234
- o("info", `Up to ${ae} images per message`);
3235
- for (const _ of d) f(_);
3236
- return b;
3234
+ d.length && t((y) => {
3235
+ const b = te - y.length;
3236
+ if (b <= 0) {
3237
+ o("info", `Up to ${te} images per message`);
3238
+ for (const p of d) f(p);
3239
+ return y;
3237
3240
  }
3238
- if (d.length > h) {
3239
- o("info", `Up to ${ae} images per message`);
3240
- for (const _ of d.slice(h)) f(_);
3241
+ if (d.length > b) {
3242
+ o("info", `Up to ${te} images per message`);
3243
+ for (const p of d.slice(b)) f(p);
3241
3244
  }
3242
- return [...b, ...d.slice(0, h)];
3245
+ return [...y, ...d.slice(0, b)];
3243
3246
  });
3244
- }, [o, f]), c = D((y) => {
3245
- const d = Ve(y.key);
3246
- d && (t((b) => b.length >= ae ? (o("info", `Up to ${ae} images per message`), b) : [...b, {
3247
+ }, [o, f]), c = D((_) => {
3248
+ const d = Je(_.key);
3249
+ d && (t((y) => y.length >= te ? (o("info", `Up to ${te} images per message`), y) : [...y, {
3247
3250
  kind: "remote",
3248
3251
  id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
3249
- key: y.key,
3252
+ key: _.key,
3250
3253
  previewUrl: d,
3251
3254
  // The catalogue spells "unknown" as null; the wire schema spells it
3252
3255
  // as 0, and the renderer falls back to natural flow on that.
3253
- w: y.width ?? 0,
3254
- h: y.height ?? 0,
3255
- title: y.title || void 0
3256
- }]), tt().catalogue($a).recordUse(y.key));
3257
- }, [o]), u = D((y) => {
3256
+ w: _.width ?? 0,
3257
+ h: _.height ?? 0,
3258
+ title: _.title || void 0
3259
+ }]), nt().catalogue(Ba).recordUse(_.key));
3260
+ }, [o]), u = D((_) => {
3258
3261
  t((d) => {
3259
- const b = d.find((h) => h.id === y);
3260
- return b && f(b), d.filter((h) => h.id !== y);
3262
+ const y = d.find((b) => b.id === _);
3263
+ return y && f(y), d.filter((b) => b.id !== _);
3261
3264
  });
3262
3265
  }, [f]), m = D(() => {
3263
- t((y) => {
3264
- for (const d of y) f(d);
3266
+ t((_) => {
3267
+ for (const d of _) f(d);
3265
3268
  return [];
3266
3269
  });
3267
- }, [f]), x = D((y) => {
3268
- const d = qo(y.clipboardData);
3269
- d.length && (y.preventDefault(), s(d));
3270
- }, [s]), S = D((y) => {
3271
- const d = Ho(y.dataTransfer);
3272
- d.length && (y.preventDefault(), s(d));
3273
- }, [s]), I = D((y) => {
3274
- y.dataTransfer?.types?.includes("Files") && y.preventDefault();
3275
- }, []), R = D(async () => {
3270
+ }, [f]), x = D((_) => {
3271
+ const d = Fo(_.clipboardData);
3272
+ d.length && (_.preventDefault(), l(d));
3273
+ }, [l]), S = D((_) => {
3274
+ const d = zo(_.dataTransfer);
3275
+ d.length && (_.preventDefault(), l(d));
3276
+ }, [l]), C = D((_) => {
3277
+ _.dataTransfer?.types?.includes("Files") && _.preventDefault();
3278
+ }, []), N = D(async () => {
3276
3279
  if (!e.length) return [];
3277
3280
  n(!0);
3278
3281
  try {
3279
- return await Fo(e);
3280
- } catch (y) {
3281
- return L("chat", "Image upload failed", zo(y)), o("error", Lo(y)), null;
3282
+ return await Go(e);
3283
+ } catch (_) {
3284
+ return L("chat", "Image upload failed", Ko(_)), o("error", Uo(_)), null;
3282
3285
  } finally {
3283
3286
  n(!1);
3284
3287
  }
@@ -3286,18 +3289,18 @@ function Gf() {
3286
3289
  return {
3287
3290
  pending: e,
3288
3291
  uploading: a,
3289
- addFiles: s,
3292
+ addFiles: l,
3290
3293
  addMeme: c,
3291
3294
  remove: u,
3292
3295
  clear: m,
3293
- uploadPending: R,
3296
+ uploadPending: N,
3294
3297
  onPaste: x,
3295
3298
  onDrop: S,
3296
- onDragOver: I
3299
+ onDragOver: C
3297
3300
  };
3298
3301
  }
3299
- const Kf = 2500, Vf = 5e3;
3300
- class Yf {
3302
+ const Xf = 2500, Qf = 5e3;
3303
+ class Zf {
3301
3304
  constructor(t, a = Date.now) {
3302
3305
  this.send = t, this.now = a;
3303
3306
  }
@@ -3312,51 +3315,51 @@ class Yf {
3312
3315
  return;
3313
3316
  }
3314
3317
  const a = this.now();
3315
- (!this.typing || a - this.lastSent >= Kf) && (this.typing = !0, this.lastSent = a, this.send(!0)), this.idle && clearTimeout(this.idle), this.idle = setTimeout(() => this.stop(), Vf);
3318
+ (!this.typing || a - this.lastSent >= Xf) && (this.typing = !0, this.lastSent = a, this.send(!0)), this.idle && clearTimeout(this.idle), this.idle = setTimeout(() => this.stop(), Qf);
3316
3319
  }
3317
3320
  stop() {
3318
3321
  this.idle && (clearTimeout(this.idle), this.idle = null), this.typing && (this.typing = !1, this.send(!1));
3319
3322
  }
3320
3323
  }
3321
- function Jf() {
3322
- const [e] = N(() => new Yf(Wi));
3323
- return M(() => () => e.stop(), [e]), e;
3324
+ function es() {
3325
+ const [e] = A(() => new Zf(Vi));
3326
+ return R(() => () => e.stop(), [e]), e;
3324
3327
  }
3325
- function Xf(e) {
3328
+ function ts(e) {
3326
3329
  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…";
3327
3330
  }
3328
- function Qf({ replyTo: e, onCancel: t }) {
3329
- const a = g((r) => r.chat.find((f) => f.id === e)), n = rt(
3331
+ function as({ replyTo: e, onCancel: t }) {
3332
+ const a = g((r) => r.chat.find((f) => f.id === e)), n = ft(
3330
3333
  { clientId: a?.clientId ?? "", author: a?.author },
3331
3334
  { name: a?.name ?? "a message", sprite: a?.sprite ?? null }
3332
- ), o = Ae(n.sprite, n.pictureUrl);
3335
+ ), o = Ne(n.sprite, n.pictureUrl);
3333
3336
  return /* @__PURE__ */ w("div", { className: "chat-reply-bar", "data-testid": "chat-reply-bar", children: [
3334
3337
  /* @__PURE__ */ w("span", { className: "min-w-0 truncate", children: [
3335
3338
  "Replying to ",
3336
- /* @__PURE__ */ l("span", { className: "font-semibold", style: { color: o }, children: n.name })
3339
+ /* @__PURE__ */ s("span", { className: "font-semibold", style: { color: o }, children: n.name })
3337
3340
  ] }),
3338
- /* @__PURE__ */ l("button", { type: "button", className: "chat-reply-cancel", onClick: t, "aria-label": "Cancel reply", title: "Cancel reply", children: /* @__PURE__ */ l(Cf, { className: "w-3.5 h-3.5" }) })
3341
+ /* @__PURE__ */ s("button", { type: "button", className: "chat-reply-cancel", onClick: t, "aria-label": "Cancel reply", title: "Cancel reply", children: /* @__PURE__ */ s(Nf, { className: "w-3.5 h-3.5" }) })
3339
3342
  ] });
3340
3343
  }
3341
- function In(e, t) {
3344
+ function Rn(e, t) {
3342
3345
  const a = /* @__PURE__ */ new Map();
3343
3346
  for (const n of Object.values(e)) {
3344
- const o = kt(n), r = a.get(o);
3347
+ const o = Tt(n), r = a.get(o);
3345
3348
  if (!r) {
3346
3349
  a.set(o, n);
3347
3350
  continue;
3348
3351
  }
3349
- const f = n.clientId === t ? n : r, s = !!(r.isLeader || n.isLeader);
3350
- a.set(o, s && !f.isLeader ? { ...f, isLeader: !0 } : f);
3352
+ const f = n.clientId === t ? n : r, l = !!(r.isLeader || n.isLeader);
3353
+ a.set(o, l && !f.isLeader ? { ...f, isLeader: !0 } : f);
3351
3354
  }
3352
3355
  return [...a.values()];
3353
3356
  }
3354
- function kt(e) {
3357
+ function Tt(e) {
3355
3358
  return e.author ? `author:${e.author}` : `client:${e.clientId}`;
3356
3359
  }
3357
- function Zf() {
3360
+ function ns() {
3358
3361
  const e = g((c) => c.typing), t = g((c) => c.roster), a = g((c) => c.me.clientId), n = g((c) => c.setTyping);
3359
- M(() => {
3362
+ R(() => {
3360
3363
  const c = Object.keys(e);
3361
3364
  if (c.length === 0) return;
3362
3365
  const u = Math.min(...c.map((x) => e[x])), m = setTimeout(() => {
@@ -3365,131 +3368,131 @@ function Zf() {
3365
3368
  }, Math.max(0, u - Date.now()) + 50);
3366
3369
  return () => clearTimeout(m);
3367
3370
  }, [e, n]);
3368
- const o = a && t[a] ? kt(t[a]) : null, r = /* @__PURE__ */ new Map();
3371
+ const o = a && t[a] ? Tt(t[a]) : null, r = /* @__PURE__ */ new Map();
3369
3372
  for (const c of Object.keys(e)) {
3370
3373
  const u = t[c];
3371
3374
  if (!u || c === a) continue;
3372
- const m = kt(u);
3375
+ const m = Tt(u);
3373
3376
  m !== o && !r.has(m) && r.set(m, u.name || "Someone");
3374
3377
  }
3375
- const f = [...r.values()].sort((c, u) => c.localeCompare(u)), s = Xf(f);
3376
- return /* @__PURE__ */ l("div", { className: "chat-typing", "aria-live": "polite", "data-testid": "chat-typing", children: s && /* @__PURE__ */ w(te, { children: [
3378
+ const f = [...r.values()].sort((c, u) => c.localeCompare(u)), l = ts(f);
3379
+ return /* @__PURE__ */ s("div", { className: "chat-typing", "aria-live": "polite", "data-testid": "chat-typing", children: l && /* @__PURE__ */ w(X, { children: [
3377
3380
  /* @__PURE__ */ w("span", { className: "chat-typing-dots", "aria-hidden": "true", children: [
3378
- /* @__PURE__ */ l("i", {}),
3379
- /* @__PURE__ */ l("i", {}),
3380
- /* @__PURE__ */ l("i", {})
3381
+ /* @__PURE__ */ s("i", {}),
3382
+ /* @__PURE__ */ s("i", {}),
3383
+ /* @__PURE__ */ s("i", {})
3381
3384
  ] }),
3382
- /* @__PURE__ */ l("span", { className: "truncate", children: s })
3385
+ /* @__PURE__ */ s("span", { className: "truncate", children: l })
3383
3386
  ] }) });
3384
3387
  }
3385
- const ua = Ia, es = uo;
3386
- function ts({ commands: e = Ht }) {
3387
- const [t, a] = N(""), [n, o] = N(!1), [r, f] = N({ q: null, i: 0 }), [s, c] = N(!1), u = U(null), m = zt(), x = zt(), [S, I] = N(!1), [R, y] = N(!1), d = Wf(t, a, u), b = Gf(), h = Jf(), _ = g((k) => k.replyingTo), v = g((k) => k.setReplyingTo);
3388
- M(() => {
3389
- _ && !document.hidden && u.current?.focus({ preventScroll: !0 });
3390
- }, [_]);
3391
- const P = g((k) => k.snapshot.mediaId), O = g((k) => k.pushToast), z = g((k) => k.setTierlistOpen), W = !!P, E = Rf(t), j = F(
3392
- () => E === null ? [] : Pf(E, e),
3388
+ const ha = Ra, os = po;
3389
+ function rs({ commands: e = Ft }) {
3390
+ const [t, a] = A(""), [n, o] = A(!1), [r, f] = A({ q: null, i: 0 }), [l, c] = A(!1), u = U(null), m = Gt(), x = Gt(), [S, C] = A(!1), [N, _] = A(!1), d = Vf(t, a, u), y = Jf(), b = es(), p = g((k) => k.replyingTo), v = g((k) => k.setReplyingTo);
3391
+ R(() => {
3392
+ p && !document.hidden && u.current?.focus({ preventScroll: !0 });
3393
+ }, [p]);
3394
+ const P = g((k) => k.snapshot.mediaId), q = g((k) => k.pushToast), W = g((k) => k.setTierlistOpen), $ = !!P, E = Lf(t), j = z(
3395
+ () => E === null ? [] : Of(E, e),
3393
3396
  [E, e]
3394
- ), A = E !== null && !s && j.length > 0, q = r.q === E ? _e(r.i, j.length) : 0, H = D(
3397
+ ), M = E !== null && !l && j.length > 0, H = r.q === E ? we(r.i, j.length) : 0, O = D(
3395
3398
  (k) => f({ q: E, i: k }),
3396
3399
  [E]
3397
- ), ie = D((k, $) => {
3398
- const me = Lf(k, { hasMedia: W });
3399
- if (me) {
3400
- O("info", me);
3400
+ ), Re = D((k, F) => {
3401
+ const ge = Uf(k, { hasMedia: $ });
3402
+ if (ge) {
3403
+ q("info", ge);
3401
3404
  return;
3402
3405
  }
3403
3406
  switch (k.name) {
3404
3407
  case "help":
3405
- O("info", e.map((Rn) => Rn.usage).join(" "));
3408
+ q("info", e.map((Dn) => Dn.usage).join(" "));
3406
3409
  break;
3407
3410
  case "recap":
3408
- Ji();
3411
+ ef();
3409
3412
  break;
3410
3413
  case "tierlist":
3411
- ri(), z(!0);
3414
+ li(), W(!0);
3412
3415
  break;
3413
3416
  default:
3414
- O("info", `${k.usage} is not implemented yet.`);
3417
+ q("info", `${k.usage} is not implemented yet.`);
3415
3418
  }
3416
- }, [W, O, e, z]), Y = D((k) => {
3417
- a(Mf(k)), c(!1), u.current?.focus();
3418
- }, []), Nn = D(async (k) => {
3419
- if (k.preventDefault(), n || b.uploading) return;
3420
- const $ = Df(t, e);
3421
- if (!$ && !b.pending.length) return;
3422
- if ($?.kind === "command" && b.pending.length) {
3423
- O("info", "Send images on their own, not with a command.");
3419
+ }, [$, q, e, W]), le = D((k) => {
3420
+ a(Hf(k)), c(!1), u.current?.focus();
3421
+ }, []), ce = D(async (k) => {
3422
+ if (k.preventDefault(), n || y.uploading) return;
3423
+ const F = qf(t, e);
3424
+ if (!F && !y.pending.length) return;
3425
+ if (F?.kind === "command" && y.pending.length) {
3426
+ q("info", "Send images on their own, not with a command.");
3424
3427
  return;
3425
3428
  }
3426
- if ($?.kind === "command") {
3427
- ie($.command, $.args), a(""), h.stop(), !document.hidden && document.hasFocus() && u.current?.focus();
3429
+ if (F?.kind === "command") {
3430
+ Re(F.command, F.args), a(""), b.stop(), !document.hidden && document.hasFocus() && u.current?.focus();
3428
3431
  return;
3429
3432
  }
3430
- const me = await b.uploadPending();
3431
- me !== null && (Fi(zf($?.text ?? ""), me, _), a(""), h.stop(), v(null), b.clear(), o(!0), setTimeout(() => o(!1), es), !document.hidden && document.hasFocus() && u.current?.focus());
3432
- }, [t, n, ie, b, O, e, _, v, h]), jn = D((k) => {
3433
- if (!(!A && d.onKeyDown(k))) {
3434
- if (k.key === "Escape" && A) {
3433
+ const ge = await y.uploadPending();
3434
+ ge !== null && (Gi(Kf(F?.text ?? ""), ge, p), a(""), b.stop(), v(null), y.clear(), o(!0), setTimeout(() => o(!1), os), !document.hidden && document.hasFocus() && u.current?.focus());
3435
+ }, [t, n, Re, y, q, e, p, v, b]), re = D((k) => {
3436
+ if (!(!M && d.onKeyDown(k))) {
3437
+ if (k.key === "Escape" && M) {
3435
3438
  k.preventDefault(), c(!0);
3436
3439
  return;
3437
3440
  }
3438
- if (k.key === "Escape" && _) {
3441
+ if (k.key === "Escape" && p) {
3439
3442
  k.preventDefault(), v(null);
3440
3443
  return;
3441
3444
  }
3442
- if (A) {
3445
+ if (M) {
3443
3446
  if (k.key === "ArrowDown")
3444
- k.preventDefault(), H(_e(q + 1, j.length));
3447
+ k.preventDefault(), O(we(H + 1, j.length));
3445
3448
  else if (k.key === "ArrowUp")
3446
- k.preventDefault(), H(_e(q - 1, j.length));
3449
+ k.preventDefault(), O(we(H - 1, j.length));
3447
3450
  else if (k.key === "Tab") {
3448
3451
  k.preventDefault();
3449
- const $ = j[q];
3450
- $ && Y($);
3452
+ const F = j[H];
3453
+ F && le(F);
3451
3454
  } else if (k.key === "Enter") {
3452
3455
  k.preventDefault();
3453
- const $ = j[q];
3454
- $ && Y($);
3456
+ const F = j[H];
3457
+ F && le(F);
3455
3458
  }
3456
3459
  }
3457
3460
  }
3458
- }, [A, j, q, Y, H, _, v, d]);
3459
- M(() => {
3461
+ }, [M, j, H, le, O, p, v, d]);
3462
+ R(() => {
3460
3463
  const k = () => {
3461
3464
  document.hidden || !document.hasFocus() || (u.current?.focus(), u.current?.scrollIntoView({ block: "nearest" }));
3462
3465
  };
3463
3466
  return window.addEventListener("watchparty:focus-chat-input", k), () => window.removeEventListener("watchparty:focus-chat-input", k);
3464
3467
  }, []);
3465
- const je = ua - t.length, Ut = je <= 100, $t = A ? j[q] : void 0, Re = !A && d.open, Ft = Re ? d.matches[d.activeIndex] : void 0;
3468
+ const Pe = ha - t.length, zt = Pe <= 100, Wt = M ? j[H] : void 0, Me = !M && d.open, Bt = Me ? d.matches[d.activeIndex] : void 0;
3466
3469
  return /* @__PURE__ */ w(
3467
3470
  "form",
3468
3471
  {
3469
3472
  onSubmit: (k) => {
3470
- Nn(k);
3473
+ ce(k);
3471
3474
  },
3472
- onPaste: b.onPaste,
3473
- onDrop: b.onDrop,
3474
- onDragOver: b.onDragOver,
3475
+ onPaste: y.onPaste,
3476
+ onDrop: y.onDrop,
3477
+ onDragOver: y.onDragOver,
3475
3478
  className: "p-2 border-t border-border",
3476
3479
  children: [
3477
- _ && /* @__PURE__ */ l(Qf, { replyTo: _, onCancel: () => v(null) }),
3478
- /* @__PURE__ */ l(Bf, { pending: b.pending, uploading: b.uploading, onRemove: b.remove }),
3480
+ p && /* @__PURE__ */ s(as, { replyTo: p, onCancel: () => v(null) }),
3481
+ /* @__PURE__ */ s(Yf, { pending: y.pending, uploading: y.uploading, onRemove: y.remove }),
3479
3482
  /* @__PURE__ */ w("div", { className: "relative", children: [
3480
- A && /* @__PURE__ */ l(
3481
- Of,
3483
+ M && /* @__PURE__ */ s(
3484
+ $f,
3482
3485
  {
3483
3486
  commands: j,
3484
- activeIndex: q,
3485
- hasMedia: W,
3486
- onPick: Y,
3487
- onHover: H,
3487
+ activeIndex: H,
3488
+ hasMedia: $,
3489
+ onPick: le,
3490
+ onHover: O,
3488
3491
  listboxId: m
3489
3492
  }
3490
3493
  ),
3491
- Re && /* @__PURE__ */ l(
3492
- qf,
3494
+ Me && /* @__PURE__ */ s(
3495
+ Ff,
3493
3496
  {
3494
3497
  matches: d.matches,
3495
3498
  activeIndex: d.activeIndex,
@@ -3498,92 +3501,92 @@ function ts({ commands: e = Ht }) {
3498
3501
  listboxId: x
3499
3502
  }
3500
3503
  ),
3501
- /* @__PURE__ */ l(
3502
- Jo,
3504
+ /* @__PURE__ */ s(
3505
+ er,
3503
3506
  {
3504
3507
  open: S,
3505
- onClose: () => I(!1),
3506
- onPick: b.addMeme,
3508
+ onClose: () => C(!1),
3509
+ onPick: y.addMeme,
3507
3510
  onUnavailable: () => {
3508
- y(!0), I(!1);
3511
+ _(!0), C(!1);
3509
3512
  }
3510
3513
  }
3511
3514
  ),
3512
3515
  /* @__PURE__ */ w("div", { className: "flex items-center gap-1.5", children: [
3513
3516
  /* @__PURE__ */ w("div", { className: "relative flex-1", children: [
3514
- /* @__PURE__ */ l(
3517
+ /* @__PURE__ */ s(
3515
3518
  "input",
3516
3519
  {
3517
3520
  ref: u,
3518
3521
  type: "text",
3519
3522
  value: t,
3520
3523
  onChange: (k) => {
3521
- a(k.target.value), d.trackCaret(k.target), c(!1), k.target.value.startsWith("/") ? h.stop() : h.input(k.target.value);
3524
+ a(k.target.value), d.trackCaret(k.target), c(!1), k.target.value.startsWith("/") ? b.stop() : b.input(k.target.value);
3522
3525
  },
3523
- onKeyDown: jn,
3526
+ onKeyDown: re,
3524
3527
  onSelect: (k) => d.trackCaret(k.currentTarget),
3525
- maxLength: ua,
3528
+ maxLength: ha,
3526
3529
  placeholder: "Send a message",
3527
3530
  role: "combobox",
3528
- "aria-expanded": A || Re,
3529
- "aria-controls": A ? m : Re ? x : void 0,
3530
- "aria-activedescendant": $t ? `${m}-opt-${$t.name}` : Ft ? En(x, Ft) : void 0,
3531
+ "aria-expanded": M || Me,
3532
+ "aria-controls": M ? m : Me ? x : void 0,
3533
+ "aria-activedescendant": Wt ? `${m}-opt-${Wt.name}` : Bt ? jn(x, Bt) : void 0,
3531
3534
  "aria-autocomplete": "list",
3532
- 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 ${Ut ? "pr-12" : ""}`
3535
+ 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 ${zt ? "pr-12" : ""}`
3533
3536
  }
3534
3537
  ),
3535
- /* @__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: Ut && je })
3538
+ /* @__PURE__ */ s("span", { className: `absolute right-2 top-1/2 -translate-y-1/2 text-[10px] ${Pe <= 50 ? Pe <= 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: zt && Pe })
3536
3539
  ] }),
3537
- !R && /* @__PURE__ */ l(
3540
+ !N && /* @__PURE__ */ s(
3538
3541
  "button",
3539
3542
  {
3540
3543
  type: "button",
3541
- onClick: () => I((k) => !k),
3544
+ onClick: () => C((k) => !k),
3542
3545
  "aria-label": "Add a meme",
3543
3546
  "aria-expanded": S,
3544
3547
  title: "Add a meme",
3545
3548
  "data-testid": "meme-button",
3546
3549
  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"}`,
3547
- children: /* @__PURE__ */ l(Pn, { name: "image" })
3550
+ children: /* @__PURE__ */ s(Ln, { name: "image" })
3548
3551
  }
3549
3552
  )
3550
3553
  ] })
3551
3554
  ] }),
3552
- /* @__PURE__ */ l(Zf, {})
3555
+ /* @__PURE__ */ s(ns, {})
3553
3556
  ]
3554
3557
  }
3555
3558
  );
3556
3559
  }
3557
- function as() {
3558
- const e = g((n) => n.roster), t = g((n) => n.me.clientId), a = F(() => In(e, t), [e, t]);
3559
- return a.length ? /* @__PURE__ */ l("div", { className: "flex flex-col gap-1", children: a.map((n) => /* @__PURE__ */ l(ns, { u: n }, n.clientId)) }) : /* @__PURE__ */ l("div", { className: "text-xs text-text-muted", children: "No users online" });
3560
+ function is() {
3561
+ const e = g((n) => n.roster), t = g((n) => n.me.clientId), a = z(() => Rn(e, t), [e, t]);
3562
+ return a.length ? /* @__PURE__ */ s("div", { className: "flex flex-col gap-1", children: a.map((n) => /* @__PURE__ */ s(fs, { u: n }, n.clientId)) }) : /* @__PURE__ */ s("div", { className: "text-xs text-text-muted", children: "No users online" });
3560
3563
  }
3561
- function ns({ u: e }) {
3562
- const t = Ae(e.sprite, e.avatarUrl);
3564
+ function fs({ u: e }) {
3565
+ const t = Ne(e.sprite, e.avatarUrl);
3563
3566
  return /* @__PURE__ */ w("div", { className: "flex items-center gap-2 py-0.5", children: [
3564
- /* @__PURE__ */ l(
3565
- Ot,
3567
+ /* @__PURE__ */ s(
3568
+ Ut,
3566
3569
  {
3567
3570
  sprite: e.sprite,
3568
3571
  url: e.avatarUrl,
3569
3572
  alt: e.name || "Anon",
3570
3573
  className: "w-6 h-6 rounded-full object-cover flex-shrink-0",
3571
- fallback: /* @__PURE__ */ l("span", { className: "w-6 h-6 bg-bg-alt rounded-full flex-shrink-0" })
3574
+ fallback: /* @__PURE__ */ s("span", { className: "w-6 h-6 bg-bg-alt rounded-full flex-shrink-0" })
3572
3575
  }
3573
3576
  ),
3574
- /* @__PURE__ */ l("span", { className: "text-xs font-medium truncate", style: { color: t }, children: e.name || "Anon" }),
3575
- e.isLeader && /* @__PURE__ */ l("span", { className: "ml-auto px-1.5 py-0.5 rounded text-[9px] font-medium bg-success/20 text-success", children: "Leader" })
3577
+ /* @__PURE__ */ s("span", { className: "text-xs font-medium truncate", style: { color: t }, children: e.name || "Anon" }),
3578
+ e.isLeader && /* @__PURE__ */ s("span", { className: "ml-auto px-1.5 py-0.5 rounded text-[9px] font-medium bg-success/20 text-success", children: "Leader" })
3576
3579
  ] });
3577
3580
  }
3578
- function os() {
3579
- const e = g((r) => In(r.roster).length), [t, a] = N(!1), n = U(null), o = U(null);
3580
- return M(() => {
3581
+ function Pn() {
3582
+ const e = g((r) => Rn(r.roster).length), [t, a] = A(!1), n = U(null), o = U(null);
3583
+ return R(() => {
3581
3584
  if (!t) return;
3582
- function r(s) {
3583
- n.current && !n.current.contains(s.target) && a(!1);
3585
+ function r(l) {
3586
+ n.current && !n.current.contains(l.target) && a(!1);
3584
3587
  }
3585
- function f(s) {
3586
- at(s) && (s.stopPropagation(), a(!1), o.current?.focus());
3588
+ function f(l) {
3589
+ ot(l) && (l.stopPropagation(), a(!1), o.current?.focus());
3587
3590
  }
3588
3591
  return document.addEventListener("mousedown", r), document.addEventListener("keydown", f, !0), () => {
3589
3592
  document.removeEventListener("mousedown", r), document.removeEventListener("keydown", f, !0);
@@ -3596,13 +3599,13 @@ function os() {
3596
3599
  "aria-expanded": t,
3597
3600
  "aria-label": `Users (${e})`,
3598
3601
  onClick: () => {
3599
- p("chat", "User list toggled", { open: !t, userCount: e }), a(!t);
3602
+ h("chat", "User list toggled", { open: !t, userCount: e }), a(!t);
3600
3603
  },
3601
3604
  className: "p-1.5 rounded text-text-secondary hover:text-white hover:bg-bg-alt transition-colors flex items-center gap-1 cursor-pointer",
3602
3605
  title: "Users",
3603
3606
  children: [
3604
- /* @__PURE__ */ l("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z" }) }),
3605
- /* @__PURE__ */ l("span", { className: "text-xs", children: e })
3607
+ /* @__PURE__ */ s("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ s("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z" }) }),
3608
+ /* @__PURE__ */ s("span", { className: "text-xs", children: e })
3606
3609
  ]
3607
3610
  }
3608
3611
  ),
@@ -3611,74 +3614,105 @@ function os() {
3611
3614
  e,
3612
3615
  " online"
3613
3616
  ] }),
3614
- /* @__PURE__ */ l(as, {})
3617
+ /* @__PURE__ */ s(is, {})
3615
3618
  ] })
3616
3619
  ] });
3617
3620
  }
3618
- function ma({ className: e = "fixed bottom-4 left-1/2 -translate-x-1/2" }) {
3621
+ const ss = /* @__PURE__ */ s("svg", { fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ s("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" }) });
3622
+ function ls(e) {
3623
+ return e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey;
3624
+ }
3625
+ function gt({ label: e, icon: t, href: a, onPress: n, inPage: o = !1 }) {
3626
+ return a && o ? /* @__PURE__ */ s(
3627
+ "a",
3628
+ {
3629
+ href: a,
3630
+ className: "chat-toolbar__btn",
3631
+ title: e,
3632
+ "aria-label": e,
3633
+ onClick: (r) => {
3634
+ !n || !ls(r) || (r.preventDefault(), n());
3635
+ },
3636
+ children: t
3637
+ }
3638
+ ) : a ? /* @__PURE__ */ s("a", { href: a, target: "_blank", rel: "noopener noreferrer", className: "chat-toolbar__btn", title: e, "aria-label": e, children: t }) : /* @__PURE__ */ s("button", { type: "button", onClick: n, className: "chat-toolbar__btn", title: e, "aria-label": e, children: t });
3639
+ }
3640
+ function cs({ home: e, lead: t, theme: a = !0, settings: n = !0, settingsSection: o, extra: r, children: f }) {
3641
+ const l = Sa() !== null;
3642
+ return /* @__PURE__ */ w("div", { className: "chat-toolbar", children: [
3643
+ e && /* @__PURE__ */ s(gt, { label: "Home", icon: ss, href: e.href, onPress: e.onPress, inPage: !0 }),
3644
+ t?.map((c) => /* @__PURE__ */ s(gt, { ...c }, c.id)),
3645
+ a && l && /* @__PURE__ */ s(uo, {}),
3646
+ n && /* @__PURE__ */ s(mo, { children: o ?? null }),
3647
+ r?.map((c) => /* @__PURE__ */ s(gt, { ...c }, c.id)),
3648
+ /* @__PURE__ */ s(Pn, {}),
3649
+ f
3650
+ ] });
3651
+ }
3652
+ function pa({ className: e = "fixed bottom-4 left-1/2 -translate-x-1/2" }) {
3619
3653
  const t = g((n) => n.toasts), a = g((n) => n.popToast);
3620
- return M(() => {
3654
+ return R(() => {
3621
3655
  const n = t.map((o) => setTimeout(() => a(o.id), 4e3));
3622
3656
  return () => {
3623
3657
  n.forEach(clearTimeout);
3624
3658
  };
3625
- }, [t, a]), /* @__PURE__ */ l("div", { className: `${e} flex flex-col gap-2 z-50`, children: t.map((n) => /* @__PURE__ */ l("div", { className: `px-3 py-2 rounded text-sm shadow font-medium border ${n.kind === "error" ? "bg-danger-bg text-on-danger-bg border-danger" : "bg-bg-card border-border-light text-text"}`, children: n.msg }, n.id)) });
3659
+ }, [t, a]), /* @__PURE__ */ s("div", { className: `${e} flex flex-col gap-2 z-50`, children: t.map((n) => /* @__PURE__ */ s("div", { className: `px-3 py-2 rounded text-sm shadow font-medium border ${n.kind === "error" ? "bg-danger-bg text-on-danger-bg border-danger" : "bg-bg-card border-border-light text-text"}`, children: n.msg }, n.id)) });
3626
3660
  }
3627
- const An = 9e3, ga = 1500, rs = {
3661
+ const Mn = 9e3, ba = 1500, ds = {
3628
3662
  classic: "[text-shadow:_-1px_-1px_0_#000,_1px_-1px_0_#000,_-1px_1px_0_#000,_1px_1px_0_#000,_0_-1px_0_#000,_0_1px_0_#000,_-1px_0_0_#000,_1px_0_0_#000]",
3629
3663
  cinema: "drop-shadow-[0_2px_4px_rgba(0,0,0,0.9)]",
3630
3664
  minimal: "drop-shadow-[0_2px_4px_rgba(0,0,0,0.9)] drop-shadow-[0_0_8px_rgba(0,0,0,0.7)]",
3631
3665
  contrast: "bg-black/70 px-2 py-0.5 rounded"
3632
- }, ha = { WebkitTextStroke: "0.5px black", paintOrder: "stroke fill" }, pa = {
3666
+ }, ya = { WebkitTextStroke: "0.5px black", paintOrder: "stroke fill" }, _a = {
3633
3667
  textShadow: "none",
3634
3668
  filter: "drop-shadow(0 0 1px black) drop-shadow(0 0 1px black)"
3635
3669
  };
3636
- function is({ message: e, age: t, ccStyle: a }) {
3637
- const n = An - ga;
3670
+ function us({ message: e, age: t, ccStyle: a }) {
3671
+ const n = Mn - ba;
3638
3672
  let o = 1;
3639
- t > n && (o = Math.max(0, 1 - (t - n) / ga));
3640
- const r = rs[a], f = rt(
3673
+ t > n && (o = Math.max(0, 1 - (t - n) / ba));
3674
+ const r = ds[a], f = ft(
3641
3675
  { clientId: e.clientId, author: e.author },
3642
3676
  { name: e.name, sprite: e.sprite }
3643
- ), s = Ae(f.sprite, f.pictureUrl), c = f.cosmetics, [u] = N(
3644
- () => e.live && e.text ? va(e.text, c) : null
3677
+ ), l = Ne(f.sprite, f.pictureUrl), c = f.cosmetics, [u] = A(
3678
+ () => e.live && e.text ? Ta(e.text, c) : null
3645
3679
  );
3646
3680
  return /* @__PURE__ */ w(
3647
3681
  "div",
3648
3682
  {
3649
3683
  className: `flex items-start gap-2 py-1 ${r}`,
3650
- style: { opacity: o, transition: "opacity 0.15s ease-out", ...Ka(s) },
3684
+ style: { opacity: o, transition: "opacity 0.15s ease-out", ...Xa(l) },
3651
3685
  children: [
3652
- /* @__PURE__ */ l(vn, { sprite: f.sprite, url: f.pictureUrl, worn: c }),
3686
+ /* @__PURE__ */ s(Tn, { sprite: f.sprite, url: f.pictureUrl, worn: c }),
3653
3687
  /* @__PURE__ */ w("div", { className: "min-w-0 flex-1", children: [
3654
- c ? /* @__PURE__ */ l(we, { html: ka(f.name, c), className: "text-sm mr-2", style: { color: s, ...pa } }) : /* @__PURE__ */ l("span", { className: "font-medium text-sm mr-2", style: { color: s, ...ha }, children: f.name }),
3655
- u ? /* @__PURE__ */ l(we, { html: u, className: "text-sm text-white break-words", style: pa }) : /* @__PURE__ */ l("span", { className: "text-sm text-white break-words", style: ha, children: e.text }),
3656
- /* @__PURE__ */ l(kn, { images: e.images })
3688
+ c ? /* @__PURE__ */ s(ve, { html: Ca(f.name, c), className: "text-sm mr-2", style: { color: l, ..._a } }) : /* @__PURE__ */ s("span", { className: "font-medium text-sm mr-2", style: { color: l, ...ya }, children: f.name }),
3689
+ u ? /* @__PURE__ */ s(ve, { html: u, className: "text-sm text-white break-words", style: _a }) : /* @__PURE__ */ s("span", { className: "text-sm text-white break-words", style: ya, children: e.text }),
3690
+ /* @__PURE__ */ s(Cn, { images: e.images })
3657
3691
  ] })
3658
3692
  ]
3659
3693
  }
3660
3694
  );
3661
3695
  }
3662
- function fs({ shown: e, className: t }) {
3663
- Ga();
3664
- const a = g((c) => c.chat), n = g((c) => c.mediaPrefs.subtitleStyle), [o, r] = N(() => Date.now()), f = a.length > 0;
3665
- M(() => {
3696
+ function ms({ shown: e, className: t }) {
3697
+ Ja();
3698
+ const a = g((c) => c.chat), n = g((c) => c.mediaPrefs.subtitleStyle), [o, r] = A(() => Date.now()), f = a.length > 0;
3699
+ R(() => {
3666
3700
  const c = setInterval(() => {
3667
3701
  f && r(Date.now());
3668
3702
  }, 200);
3669
3703
  return () => clearInterval(c);
3670
3704
  }, [f]);
3671
- const s = F(() => {
3672
- const c = o - An;
3705
+ const l = z(() => {
3706
+ const c = o - Mn;
3673
3707
  return a.filter((u) => !u.isSystem && u.ts > c).slice(-12);
3674
3708
  }, [a, o]);
3675
- return !e || s.length === 0 ? null : /* @__PURE__ */ l(
3709
+ return !e || l.length === 0 ? null : /* @__PURE__ */ s(
3676
3710
  "div",
3677
3711
  {
3678
3712
  className: `wp-floating-chat pointer-events-none flex flex-col ${t}`,
3679
3713
  "data-testid": "floating-chat",
3680
- children: s.map((c) => /* @__PURE__ */ l(
3681
- is,
3714
+ children: l.map((c) => /* @__PURE__ */ s(
3715
+ us,
3682
3716
  {
3683
3717
  message: c,
3684
3718
  age: o - c.ts,
@@ -3689,27 +3723,27 @@ function fs({ shown: e, className: t }) {
3689
3723
  }
3690
3724
  );
3691
3725
  }
3692
- const ba = (e) => typeof e == "string" && Mn.includes(e);
3693
- function ss(e, t, a) {
3694
- return e || (ba(t) ? t : ba(a) ? a : "dark");
3726
+ const wa = (e) => typeof e == "string" && On.includes(e);
3727
+ function gs(e, t, a) {
3728
+ return e || (wa(t) ? t : wa(a) ? a : "dark");
3695
3729
  }
3696
- function ls(e, t) {
3730
+ function hs(e, t) {
3697
3731
  if (t(e.clientWidth), typeof ResizeObserver > "u") return () => {
3698
3732
  };
3699
3733
  const a = new ResizeObserver(() => t(e.clientWidth));
3700
3734
  return a.observe(e), () => a.disconnect();
3701
3735
  }
3702
- function cs(e) {
3736
+ function ps(e) {
3703
3737
  const t = e?.trim() ?? "";
3704
3738
  return t ? { source: "host", name: t } : { source: "auto" };
3705
3739
  }
3706
- function ds(e) {
3740
+ function bs(e) {
3707
3741
  if (e.source !== "host") return;
3708
3742
  const { setSessionIdentity: t, sprite: a } = g.getState();
3709
3743
  t(e.name, a);
3710
3744
  }
3711
- const us = 1500;
3712
- function Is({
3745
+ const ys = 1500;
3746
+ function Os({
3713
3747
  roomKey: e,
3714
3748
  serverOrigin: t,
3715
3749
  roomOrigin: a,
@@ -3717,168 +3751,183 @@ function Is({
3717
3751
  chatOrigin: o,
3718
3752
  chatSocketPath: r,
3719
3753
  userType: f,
3720
- userId: s,
3754
+ userId: l,
3721
3755
  theme: c,
3722
3756
  name: u,
3723
3757
  onLeave: m,
3724
3758
  onLayoutChange: x,
3725
3759
  collapsible: S = !0,
3726
- debug: I,
3727
- children: R
3760
+ toolbar: C,
3761
+ debug: N,
3762
+ children: _
3728
3763
  }) {
3729
- const [y, d] = N(null), { setFrame: b, ...h } = ms(x, S), _ = g((A) => A.floatingChatEnabled), v = wa(() => u), P = F(() => (Sr({ userType: f, userId: s ?? null }), Rt().theme), [f, s]), O = Dn(), z = O?.theme, W = F(
3730
- () => ss(c, z, P),
3731
- [c, z, P]
3764
+ const [d, y] = A(null), { setFrame: b, ...p } = _s(x, S), v = g((O) => O.floatingChatEnabled), P = xa(() => u), q = z(() => (Ir({ userType: f, userId: l ?? null }), Dt().theme), [f, l]), W = Sa(), $ = W?.theme, E = z(
3765
+ () => gs(c, $, q),
3766
+ [c, $, q]
3732
3767
  );
3733
- M(() => {
3734
- }, [c, O !== null]);
3735
- const j = F(
3736
- () => ({ ...Et, serverOrigin: t, defaultRoomKey: e }),
3768
+ R(() => {
3769
+ }, [c, W !== null]);
3770
+ const M = z(
3771
+ () => ({ ...Nt, serverOrigin: t, defaultRoomKey: e }),
3737
3772
  [t, e]
3738
3773
  );
3739
- return M(() => {
3740
- I && nr();
3741
- }, [I]), Xi(), M(() => {
3742
- Xo({ serverOrigin: t, defaultRoomKey: e }), Zr(a ? { origin: a, path: n } : null), na(o && !a ? { origin: o, path: r } : null), g.getState().rehydrateFromPrefs(), ki();
3743
- let A = !1;
3744
- const q = Er();
3774
+ R(() => {
3775
+ N && fr();
3776
+ }, [N]), tf(), R(() => {
3777
+ tr({ serverOrigin: t, defaultRoomKey: e }), ni(a ? { origin: a, path: n } : null), ia(o && !a ? { origin: o, path: r } : null), g.getState().rehydrateFromPrefs(), Ci();
3778
+ let O = !1;
3779
+ const Re = jr();
3745
3780
  return (async () => {
3746
3781
  try {
3747
3782
  await Promise.race([
3748
3783
  Promise.all([
3749
- q,
3750
- Pr().then((Y) => {
3751
- Y && g.getState().rehydrateFromPrefs();
3784
+ Re,
3785
+ Or().then((re) => {
3786
+ re && g.getState().rehydrateFromPrefs();
3752
3787
  }),
3753
3788
  // The character chosen in the settings popout (lib/avatar.ts).
3754
- ci().then(wn)
3789
+ gi().then(Sn)
3755
3790
  ]),
3756
- new Promise((Y) => setTimeout(Y, us))
3791
+ new Promise((re) => setTimeout(re, ys))
3757
3792
  ]);
3758
- } catch (Y) {
3759
- L("room-chrome", "pre-join wait threw, proceeding anyway", Ee(Y));
3793
+ } catch (re) {
3794
+ L("room-chrome", "pre-join wait threw, proceeding anyway", Ie(re));
3760
3795
  }
3761
- if (A) return;
3762
- const H = cs(v());
3763
- g.getState().ensureAutoIdentity(), ds(H);
3764
- const ie = g.getState();
3765
- p("room-chrome", "Joining room", { roomKey: e, name: ie.name, sprite: ie.sprite }), ji({ room_key: e, name: ie.name || void 0, sprite: ie.sprite || void 0 });
3796
+ if (O) return;
3797
+ const le = ps(P());
3798
+ g.getState().ensureAutoIdentity(), bs(le);
3799
+ const ce = g.getState();
3800
+ h("room-chrome", "Joining room", { roomKey: e, name: ce.name, sprite: ce.sprite }), Di({ room_key: e, name: ce.name || void 0, sprite: ce.sprite || void 0 });
3766
3801
  })(), () => {
3767
- A = !0, la(), na(null);
3802
+ O = !0, ua(), ia(null);
3768
3803
  };
3769
- }, [e, t, a, n, o, r, f, s]), /* @__PURE__ */ l(Qo.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: [
3770
- /* @__PURE__ */ l("div", { className: "wp-room-chrome-frame__content", children: R }),
3771
- /* @__PURE__ */ l(
3804
+ }, [e, t, a, n, o, r, f, l]);
3805
+ const H = /* @__PURE__ */ w(X, { children: [
3806
+ /* @__PURE__ */ s("div", { className: "flex-1" }),
3807
+ m && /* @__PURE__ */ s(
3808
+ "button",
3809
+ {
3810
+ onClick: () => {
3811
+ ua(), m();
3812
+ },
3813
+ className: "wp-room-chrome__leave",
3814
+ title: "Leave room",
3815
+ "aria-label": "Leave room",
3816
+ children: "Leave"
3817
+ }
3818
+ ),
3819
+ S && /* @__PURE__ */ s(
3820
+ "button",
3821
+ {
3822
+ onClick: p.toggleCollapsed,
3823
+ className: "wp-room-chrome__icon-btn",
3824
+ title: "Hide chat",
3825
+ "aria-label": "Hide chat",
3826
+ "aria-expanded": !0,
3827
+ children: /* @__PURE__ */ s(If, {})
3828
+ }
3829
+ )
3830
+ ] });
3831
+ return /* @__PURE__ */ s(ar.Provider, { value: M, children: /* @__PURE__ */ s(Ya.Provider, { value: !1, children: /* @__PURE__ */ s(Ka.Provider, { value: d, children: /* @__PURE__ */ w("div", { ref: b, className: "wp-room-chrome-frame", children: [
3832
+ /* @__PURE__ */ s("div", { className: "wp-room-chrome-frame__content", children: _ }),
3833
+ /* @__PURE__ */ s(
3772
3834
  "aside",
3773
3835
  {
3774
- ref: d,
3836
+ ref: y,
3775
3837
  className: "wp-room-chrome",
3776
- "data-theme": W,
3777
- "data-collapsed": h.collapsed ? "1" : "0",
3778
- style: { "--wp-room-chrome-width": `${h.state.width}px` },
3779
- onAnimationEnd: (A) => Vn(A.nativeEvent),
3780
- children: h.collapsed ? /* @__PURE__ */ w(te, { children: [
3781
- /* @__PURE__ */ l(
3838
+ "data-theme": E,
3839
+ "data-collapsed": p.collapsed ? "1" : "0",
3840
+ style: { "--wp-room-chrome-width": `${p.state.width}px` },
3841
+ onAnimationEnd: (O) => Jn(O.nativeEvent),
3842
+ children: p.collapsed ? /* @__PURE__ */ w(X, { children: [
3843
+ /* @__PURE__ */ s(
3782
3844
  "button",
3783
3845
  {
3784
- onClick: h.toggleCollapsed,
3846
+ onClick: p.toggleCollapsed,
3785
3847
  className: "wp-room-chrome__icon-btn",
3786
3848
  title: "Show chat",
3787
3849
  "aria-label": "Show chat",
3788
3850
  "aria-expanded": !1,
3789
- children: /* @__PURE__ */ l(Tf, {})
3851
+ children: /* @__PURE__ */ s(Af, {})
3790
3852
  }
3791
3853
  ),
3792
- /* @__PURE__ */ l(ma, { className: "absolute bottom-2 right-full mr-2 w-72" }),
3793
- /* @__PURE__ */ l(fs, { shown: _, className: "wp-room-chrome__floating" })
3794
- ] }) : /* @__PURE__ */ w(te, { children: [
3795
- /* @__PURE__ */ l(
3854
+ /* @__PURE__ */ s(pa, { className: "absolute bottom-2 right-full mr-2 w-72" }),
3855
+ /* @__PURE__ */ s(ms, { shown: v, className: "wp-room-chrome__floating" })
3856
+ ] }) : /* @__PURE__ */ w(X, { children: [
3857
+ /* @__PURE__ */ s(
3796
3858
  "div",
3797
3859
  {
3798
3860
  role: "separator",
3799
3861
  "aria-orientation": "vertical",
3800
3862
  "aria-label": "Resize chat",
3801
- "aria-valuemin": Xe,
3802
- "aria-valuemax": Pt,
3803
- "aria-valuenow": h.state.width,
3863
+ "aria-valuemin": Ze,
3864
+ "aria-valuemax": Lt,
3865
+ "aria-valuenow": p.state.width,
3804
3866
  tabIndex: 0,
3805
3867
  className: "wp-room-chrome__resize",
3806
- "data-dragging": h.dragging ? "1" : "0",
3807
- onPointerDown: h.onPointerDown,
3808
- onPointerMove: h.onPointerMove,
3809
- onPointerUp: h.onPointerEnd,
3810
- onPointerCancel: h.onPointerEnd,
3811
- onKeyDown: h.onKeyDown
3868
+ "data-dragging": p.dragging ? "1" : "0",
3869
+ onPointerDown: p.onPointerDown,
3870
+ onPointerMove: p.onPointerMove,
3871
+ onPointerUp: p.onPointerEnd,
3872
+ onPointerCancel: p.onPointerEnd,
3873
+ onKeyDown: p.onKeyDown
3812
3874
  }
3813
3875
  ),
3814
- /* @__PURE__ */ w("div", { className: "flex items-center gap-1 px-2 py-1.5 border-b border-border", children: [
3815
- /* @__PURE__ */ l(os, {}),
3816
- /* @__PURE__ */ l("div", { className: "flex-1" }),
3817
- m && /* @__PURE__ */ l(
3818
- "button",
3819
- {
3820
- onClick: () => {
3821
- la(), m();
3822
- },
3823
- className: "wp-room-chrome__leave",
3824
- title: "Leave room",
3825
- "aria-label": "Leave room",
3826
- children: "Leave"
3827
- }
3828
- ),
3829
- S && /* @__PURE__ */ l(
3830
- "button",
3831
- {
3832
- onClick: h.toggleCollapsed,
3833
- className: "wp-room-chrome__icon-btn",
3834
- title: "Hide chat",
3835
- "aria-label": "Hide chat",
3836
- "aria-expanded": !0,
3837
- children: /* @__PURE__ */ l(Sf, {})
3838
- }
3839
- )
3876
+ C ? /* @__PURE__ */ s(
3877
+ cs,
3878
+ {
3879
+ home: C.onHome ? { onPress: C.onHome } : void 0,
3880
+ theme: C.theme ?? !0,
3881
+ settings: C.settings !== !1,
3882
+ settingsSection: typeof C.settings == "object" ? C.settings.section : void 0,
3883
+ extra: C.extra,
3884
+ children: H
3885
+ }
3886
+ ) : /* @__PURE__ */ w("div", { className: "flex items-center gap-1 px-2 py-1.5 border-b border-border", children: [
3887
+ /* @__PURE__ */ s(Pn, {}),
3888
+ H
3840
3889
  ] }),
3841
- /* @__PURE__ */ l(jf, {}),
3842
- /* @__PURE__ */ l(ts, { commands: [] }),
3843
- /* @__PURE__ */ l(ma, { className: "absolute bottom-14 left-2 right-2" })
3890
+ /* @__PURE__ */ s(Df, {}),
3891
+ /* @__PURE__ */ s(rs, { commands: [] }),
3892
+ /* @__PURE__ */ s(pa, { className: "absolute bottom-14 left-2 right-2" })
3844
3893
  ] })
3845
3894
  }
3846
3895
  )
3847
3896
  ] }) }) }) });
3848
3897
  }
3849
- function ms(e, t) {
3850
- const a = g((_) => _.chromeChatCollapsed) && t, n = g((_) => _.chromeChatWidth), o = g((_) => _.toggleChromeChatCollapsed), r = g((_) => _.setChromeChatWidth), [f, s] = N(null), [c, u] = N(void 0), [m, x] = N(null);
3851
- M(() => {
3898
+ function _s(e, t) {
3899
+ const a = g((p) => p.chromeChatCollapsed) && t, n = g((p) => p.chromeChatWidth), o = g((p) => p.toggleChromeChatCollapsed), r = g((p) => p.setChromeChatWidth), [f, l] = A(null), [c, u] = A(void 0), [m, x] = A(null);
3900
+ R(() => {
3852
3901
  if (f)
3853
- return ls(f, u);
3902
+ return hs(f, u);
3854
3903
  }, [f]);
3855
- const S = Z(m?.current ?? n, c), I = F(() => $r(a, S), [a, S]), R = wa((_) => e?.(_));
3856
- return M(() => {
3857
- R(I);
3858
- }, [I]), {
3859
- setFrame: s,
3904
+ const S = Z(m?.current ?? n, c), C = z(() => Br(a, S), [a, S]), N = xa((p) => e?.(p));
3905
+ return R(() => {
3906
+ N(C);
3907
+ }, [C]), {
3908
+ setFrame: l,
3860
3909
  collapsed: a,
3861
- state: I,
3910
+ state: C,
3862
3911
  dragging: m !== null,
3863
3912
  toggleCollapsed: o,
3864
- onPointerDown: (_) => {
3865
- _.button === 0 && (_.preventDefault(), _.currentTarget.setPointerCapture(_.pointerId), x({ pointerId: _.pointerId, startX: _.clientX, startWidth: S, current: S }));
3913
+ onPointerDown: (p) => {
3914
+ p.button === 0 && (p.preventDefault(), p.currentTarget.setPointerCapture(p.pointerId), x({ pointerId: p.pointerId, startX: p.clientX, startWidth: S, current: S }));
3866
3915
  },
3867
- onPointerMove: (_) => {
3868
- !m || m.pointerId !== _.pointerId || x({ ...m, current: aa(m.startWidth, m.startX, _.clientX, c) });
3916
+ onPointerMove: (p) => {
3917
+ !m || m.pointerId !== p.pointerId || x({ ...m, current: ra(m.startWidth, m.startX, p.clientX, c) });
3869
3918
  },
3870
- onPointerEnd: (_) => {
3871
- if (!m || m.pointerId !== _.pointerId) return;
3872
- const v = aa(m.startWidth, m.startX, _.clientX, c);
3919
+ onPointerEnd: (p) => {
3920
+ if (!m || m.pointerId !== p.pointerId) return;
3921
+ const v = ra(m.startWidth, m.startX, p.clientX, c);
3873
3922
  x(null), v !== n && r(v);
3874
3923
  },
3875
- onKeyDown: (_) => {
3876
- const v = Ur(S, _.key, c);
3877
- v !== null && (_.preventDefault(), v !== n && r(v));
3924
+ onKeyDown: (p) => {
3925
+ const v = Wr(S, p.key, c);
3926
+ v !== null && (p.preventDefault(), v !== n && r(v));
3878
3927
  }
3879
3928
  };
3880
3929
  }
3881
3930
  export {
3882
- Is as RoomChrome
3931
+ Os as RoomChrome
3883
3932
  };
3884
3933
  //# sourceMappingURL=room-chrome.js.map