@hadoku/watchparty-ui 0.45.114 → 0.45.116

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
- import { jsx as S, Fragment as ei, jsxs as J } from "react/jsx-runtime";
1
+ import { jsx as S, Fragment as Zr, jsxs as J } from "react/jsx-runtime";
2
2
  import * as p from "react";
3
- import ye, { createContext as jo, useContext as Ho, useSyncExternalStore as Mt, useEffect as he, useRef as we, useState as ti, useMemo as qo } from "react";
3
+ import ye, { createContext as jo, useContext as Ho, useSyncExternalStore as Mt, useEffect as he, useRef as we, useState as ei, useMemo as qo } from "react";
4
4
  import { createRoot as Vo } from "react-dom/client";
5
5
  import { themePrefs as He, HadokuThemeRoot as zo, THEMES as Wo, saveTheme as Go } from "@wolffm/themes";
6
6
  import { z as l } from "zod";
7
7
  import { createPrefsClient as Ko, getDeviceId as Yo, DEVICE_ID_KEY as Jo } from "@wolffm/prefs-client";
8
- var sr = "popstate";
8
+ var or = "popstate";
9
9
  function Xo(e = {}) {
10
10
  function t(r, i) {
11
11
  let { pathname: o, search: s, hash: a } = r.location;
@@ -43,7 +43,7 @@ function re(e, t) {
43
43
  function Qo() {
44
44
  return Math.random().toString(36).substring(2, 10);
45
45
  }
46
- function ar(e, t) {
46
+ function sr(e, t) {
47
47
  return {
48
48
  usr: e.state,
49
49
  key: e.key,
@@ -96,7 +96,7 @@ function Zo(e, t, n, r = {}) {
96
96
  a = "PUSH";
97
97
  let y = ln(w.location, f, _);
98
98
  u = d() + 1;
99
- let k = ar(y, u), C = w.createHref(y);
99
+ let k = sr(y, u), C = w.createHref(y);
100
100
  try {
101
101
  s.pushState(k, "", C);
102
102
  } catch (g) {
@@ -110,7 +110,7 @@ function Zo(e, t, n, r = {}) {
110
110
  a = "REPLACE";
111
111
  let y = ln(w.location, f, _);
112
112
  u = d();
113
- let k = ar(y, u), C = w.createHref(y);
113
+ let k = sr(y, u), C = w.createHref(y);
114
114
  s.replaceState(k, "", C), o && c && c({ action: a, location: w.location, delta: 0 });
115
115
  }
116
116
  function E(f) {
@@ -126,8 +126,8 @@ function Zo(e, t, n, r = {}) {
126
126
  listen(f) {
127
127
  if (c)
128
128
  throw new Error("A history only accepts one active listener");
129
- return i.addEventListener(sr, h), c = f, () => {
130
- i.removeEventListener(sr, h), c = null;
129
+ return i.addEventListener(or, h), c = f, () => {
130
+ i.removeEventListener(or, h), c = null;
131
131
  };
132
132
  },
133
133
  createHref(f) {
@@ -156,14 +156,14 @@ function es(e, t = !1) {
156
156
  let r = typeof e == "string" ? e : Ke(e);
157
157
  return r = r.replace(/ $/, "%20"), !t && r.startsWith("//") && (r = n + r), new URL(r, n);
158
158
  }
159
- function ni(e, t, n = "/") {
159
+ function ti(e, t, n = "/") {
160
160
  return ts(e, t, n, !1);
161
161
  }
162
162
  function ts(e, t, n, r) {
163
163
  let i = typeof t == "string" ? Pe(t) : t, o = ge(i.pathname || "/", n);
164
164
  if (o == null)
165
165
  return null;
166
- let s = ri(e);
166
+ let s = ni(e);
167
167
  ns(s);
168
168
  let a = null;
169
169
  for (let c = 0; a == null && c < s.length; ++c) {
@@ -176,7 +176,7 @@ function ts(e, t, n, r) {
176
176
  }
177
177
  return a;
178
178
  }
179
- function ri(e, t = [], n = [], r = "", i = !1) {
179
+ function ni(e, t = [], n = [], r = "", i = !1) {
180
180
  let o = (s, a, c = i, u) => {
181
181
  let d = {
182
182
  relativePath: u === void 0 ? s.path || "" : u,
@@ -198,7 +198,7 @@ function ri(e, t = [], n = [], r = "", i = !1) {
198
198
  // @ts-expect-error
199
199
  s.index !== !0,
200
200
  `Index routes must not have child routes. Please remove all child routes from route path "${h}".`
201
- ), ri(
201
+ ), ni(
202
202
  s.children,
203
203
  t,
204
204
  v,
@@ -214,17 +214,17 @@ function ri(e, t = [], n = [], r = "", i = !1) {
214
214
  if (s.path === "" || !s.path?.includes("?"))
215
215
  o(s, a);
216
216
  else
217
- for (let c of ii(s.path))
217
+ for (let c of ri(s.path))
218
218
  o(s, a, !0, c);
219
219
  }), t;
220
220
  }
221
- function ii(e) {
221
+ function ri(e) {
222
222
  let t = e.split("/");
223
223
  if (t.length === 0) return [];
224
224
  let [n, ...r] = t, i = n.endsWith("?"), o = n.replace(/\?$/, "");
225
225
  if (r.length === 0)
226
226
  return i ? [o, ""] : [o];
227
- let s = ii(r.join("/")), a = [];
227
+ let s = ri(r.join("/")), a = [];
228
228
  return a.push(
229
229
  ...s.map(
230
230
  (c) => c === "" ? o : [o, c].join("/")
@@ -241,10 +241,10 @@ function ns(e) {
241
241
  )
242
242
  );
243
243
  }
244
- var rs = /^:[\w-]+$/, is = 3, os = 2, ss = 1, as = 10, cs = -2, cr = (e) => e === "*";
244
+ var rs = /^:[\w-]+$/, is = 3, os = 2, ss = 1, as = 10, cs = -2, ar = (e) => e === "*";
245
245
  function ls(e, t) {
246
246
  let n = e.split("/"), r = n.length;
247
- return n.some(cr) && (r += cs), t && (r += os), n.filter((i) => !cr(i)).reduce(
247
+ return n.some(ar) && (r += cs), t && (r += os), n.filter((i) => !ar(i)).reduce(
248
248
  (i, o) => i + (rs.test(o) ? is : o === "" ? ss : as),
249
249
  r
250
250
  );
@@ -344,7 +344,7 @@ function ge(e, t) {
344
344
  let n = t.endsWith("/") ? t.length - 1 : t.length, r = e.charAt(n);
345
345
  return r && r !== "/" ? null : e.slice(n) || "/";
346
346
  }
347
- var oi = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i, ps = (e) => oi.test(e);
347
+ var ii = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i, ps = (e) => ii.test(e);
348
348
  function ms(e, t = "/") {
349
349
  let {
350
350
  pathname: n,
@@ -362,7 +362,7 @@ function ms(e, t = "/") {
362
362
  `Pathnames cannot have embedded double slashes - normalizing ${s} -> ${n}`
363
363
  );
364
364
  }
365
- n.startsWith("/") ? o = lr(n.substring(1), "/") : o = lr(n, t);
365
+ n.startsWith("/") ? o = cr(n.substring(1), "/") : o = cr(n, t);
366
366
  }
367
367
  else
368
368
  o = t;
@@ -372,7 +372,7 @@ function ms(e, t = "/") {
372
372
  hash: bs(i)
373
373
  };
374
374
  }
375
- function lr(e, t) {
375
+ function cr(e, t) {
376
376
  let n = t.replace(/\/+$/, "").split("/");
377
377
  return e.split("/").forEach((i) => {
378
378
  i === ".." ? n.length > 1 && n.pop() : i !== "." && n.push(i);
@@ -388,13 +388,13 @@ function gs(e) {
388
388
  (t, n) => n === 0 || t.route.path && t.route.path.length > 0
389
389
  );
390
390
  }
391
- function si(e) {
391
+ function oi(e) {
392
392
  let t = gs(e);
393
393
  return t.map(
394
394
  (n, r) => r === t.length - 1 ? n.pathname : n.pathnameBase
395
395
  );
396
396
  }
397
- function ai(e, t, n, r = !1) {
397
+ function si(e, t, n, r = !1) {
398
398
  let i;
399
399
  typeof e == "string" ? i = Pe(e) : (i = { ...e }, B(
400
400
  !i.pathname || !i.pathname.includes("?"),
@@ -433,17 +433,17 @@ function _s(e) {
433
433
  function Es(e) {
434
434
  return e.map((t) => t.route.path).filter(Boolean).join("/").replace(/\/\/*/g, "/") || "/";
435
435
  }
436
- var ci = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
437
- function li(e, t) {
436
+ var ai = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
437
+ function ci(e, t) {
438
438
  let n = e;
439
- if (typeof n != "string" || !oi.test(n))
439
+ if (typeof n != "string" || !ii.test(n))
440
440
  return {
441
441
  absoluteURL: void 0,
442
442
  isExternal: !1,
443
443
  to: n
444
444
  };
445
445
  let r = n, i = !1;
446
- if (ci)
446
+ if (ai)
447
447
  try {
448
448
  let o = new URL(window.location.href), s = n.startsWith("//") ? new URL(o.protocol + n) : new URL(n), a = ge(s.pathname, t);
449
449
  s.origin === o.origin && a != null ? n = a + s.search + s.hash : i = !0;
@@ -460,28 +460,28 @@ function li(e, t) {
460
460
  };
461
461
  }
462
462
  Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
463
- var ui = [
463
+ var li = [
464
464
  "POST",
465
465
  "PUT",
466
466
  "PATCH",
467
467
  "DELETE"
468
468
  ];
469
469
  new Set(
470
- ui
470
+ li
471
471
  );
472
472
  var Ss = [
473
473
  "GET",
474
- ...ui
474
+ ...li
475
475
  ];
476
476
  new Set(Ss);
477
477
  var Oe = p.createContext(null);
478
478
  Oe.displayName = "DataRouter";
479
479
  var Nt = p.createContext(null);
480
480
  Nt.displayName = "DataRouterState";
481
- var Ts = p.createContext(!1), di = p.createContext({
481
+ var Ts = p.createContext(!1), ui = p.createContext({
482
482
  isTransitioning: !1
483
483
  });
484
- di.displayName = "ViewTransition";
484
+ ui.displayName = "ViewTransition";
485
485
  var ks = p.createContext(
486
486
  /* @__PURE__ */ new Map()
487
487
  );
@@ -504,9 +504,9 @@ var ae = p.createContext({
504
504
  ae.displayName = "Route";
505
505
  var kn = p.createContext(null);
506
506
  kn.displayName = "RouteError";
507
- var hi = "REACT_ROUTER_ERROR", xs = "REDIRECT", Cs = "ROUTE_ERROR_RESPONSE";
507
+ var di = "REACT_ROUTER_ERROR", xs = "REDIRECT", Cs = "ROUTE_ERROR_RESPONSE";
508
508
  function As(e) {
509
- if (e.startsWith(`${hi}:${xs}:{`))
509
+ if (e.startsWith(`${di}:${xs}:{`))
510
510
  try {
511
511
  let t = JSON.parse(e.slice(28));
512
512
  if (typeof t == "object" && t && typeof t.status == "number" && typeof t.statusText == "string" && typeof t.location == "string" && typeof t.reloadDocument == "boolean" && typeof t.replace == "boolean")
@@ -516,7 +516,7 @@ function As(e) {
516
516
  }
517
517
  function Is(e) {
518
518
  if (e.startsWith(
519
- `${hi}:${Cs}:{`
519
+ `${di}:${Cs}:{`
520
520
  ))
521
521
  try {
522
522
  let t = JSON.parse(e.slice(40));
@@ -550,8 +550,8 @@ function be() {
550
550
  "useLocation() may be used only in the context of a <Router> component."
551
551
  ), p.useContext(et).location;
552
552
  }
553
- var fi = "You should call navigate() in a React.useEffect(), not when your component is first rendered.";
554
- function pi(e) {
553
+ var hi = "You should call navigate() in a React.useEffect(), not when your component is first rendered.";
554
+ function fi(e) {
555
555
  p.useContext(Q).static || p.useLayoutEffect(e);
556
556
  }
557
557
  function Os() {
@@ -565,17 +565,17 @@ function Ls() {
565
565
  // router loaded. We can help them understand how to avoid that.
566
566
  "useNavigate() may be used only in the context of a <Router> component."
567
567
  );
568
- let e = p.useContext(Oe), { basename: t, navigator: n } = p.useContext(Q), { matches: r } = p.useContext(ae), { pathname: i } = be(), o = JSON.stringify(si(r)), s = p.useRef(!1);
569
- return pi(() => {
568
+ let e = p.useContext(Oe), { basename: t, navigator: n } = p.useContext(Q), { matches: r } = p.useContext(ae), { pathname: i } = be(), o = JSON.stringify(oi(r)), s = p.useRef(!1);
569
+ return fi(() => {
570
570
  s.current = !0;
571
571
  }), p.useCallback(
572
572
  (c, u = {}) => {
573
- if (re(s.current, fi), !s.current) return;
573
+ if (re(s.current, hi), !s.current) return;
574
574
  if (typeof c == "number") {
575
575
  n.go(c);
576
576
  return;
577
577
  }
578
- let d = ai(
578
+ let d = si(
579
579
  c,
580
580
  JSON.parse(o),
581
581
  i,
@@ -602,9 +602,9 @@ function Ms() {
602
602
  return t ? t.params : {};
603
603
  }
604
604
  function nt(e, { relative: t } = {}) {
605
- let { matches: n } = p.useContext(ae), { pathname: r } = be(), i = JSON.stringify(si(n));
605
+ let { matches: n } = p.useContext(ae), { pathname: r } = be(), i = JSON.stringify(oi(n));
606
606
  return p.useMemo(
607
- () => ai(
607
+ () => si(
608
608
  e,
609
609
  JSON.parse(i),
610
610
  r,
@@ -614,9 +614,9 @@ function nt(e, { relative: t } = {}) {
614
614
  );
615
615
  }
616
616
  function Ns(e, t) {
617
- return mi(e, t);
617
+ return pi(e, t);
618
618
  }
619
- function mi(e, t, n, r, i) {
619
+ function pi(e, t, n, r, i) {
620
620
  B(
621
621
  tt(),
622
622
  // TODO: This error is probably because they somehow have 2 versions of the
@@ -626,7 +626,7 @@ function mi(e, t, n, r, i) {
626
626
  let { navigator: o } = p.useContext(Q), { matches: s } = p.useContext(ae), a = s[s.length - 1], c = a ? a.params : {}, u = a ? a.pathname : "/", d = a ? a.pathnameBase : "/", h = a && a.route;
627
627
  {
628
628
  let y = h && h.path || "";
629
- yi(
629
+ gi(
630
630
  u,
631
631
  !h || y.endsWith("*") || y.endsWith("*?"),
632
632
  `You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${y}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
@@ -648,7 +648,7 @@ Please change the parent <Route path="${y}"> to <Route path="${y === "/" ? "*" :
648
648
  let y = d.replace(/^\//, "").split("/");
649
649
  w = "/" + E.replace(/^\//, "").split("/").slice(y.length).join("/");
650
650
  }
651
- let f = ni(e, { pathname: w });
651
+ let f = ti(e, { pathname: w });
652
652
  re(
653
653
  h || f != null,
654
654
  `No routes matched location "${b.pathname}${b.search}${b.hash}" `
@@ -713,7 +713,7 @@ function Ds() {
713
713
  e
714
714
  ), s = /* @__PURE__ */ p.createElement(p.Fragment, null, /* @__PURE__ */ p.createElement("p", null, "💿 Hey developer 👋"), /* @__PURE__ */ p.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /* @__PURE__ */ p.createElement("code", { style: o }, "ErrorBoundary"), " or", " ", /* @__PURE__ */ p.createElement("code", { style: o }, "errorElement"), " prop on your route.")), /* @__PURE__ */ p.createElement(p.Fragment, null, /* @__PURE__ */ p.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ p.createElement("h3", { style: { fontStyle: "italic" } }, t), n ? /* @__PURE__ */ p.createElement("pre", { style: i }, n) : null, s);
715
715
  }
716
- var $s = /* @__PURE__ */ p.createElement(Ds, null), gi = class extends p.Component {
716
+ var $s = /* @__PURE__ */ p.createElement(Ds, null), mi = class extends p.Component {
717
717
  constructor(e) {
718
718
  super(e), this.state = {
719
719
  location: e.location,
@@ -757,7 +757,7 @@ var $s = /* @__PURE__ */ p.createElement(Ds, null), gi = class extends p.Compone
757
757
  return this.context ? /* @__PURE__ */ p.createElement(Bs, { error: e }, t) : t;
758
758
  }
759
759
  };
760
- gi.contextType = Ts;
760
+ mi.contextType = Ts;
761
761
  var Jt = /* @__PURE__ */ new WeakMap();
762
762
  function Bs({
763
763
  children: e,
@@ -769,8 +769,8 @@ function Bs({
769
769
  if (r) {
770
770
  let i = Jt.get(t);
771
771
  if (i) throw i;
772
- let o = li(r.location, n);
773
- if (ci && !Jt.get(t))
772
+ let o = ci(r.location, n);
773
+ if (ai && !Jt.get(t))
774
774
  if (o.isExternal || r.reloadDocument)
775
775
  window.location.href = o.absoluteURL || o.to;
776
776
  else {
@@ -845,7 +845,7 @@ function Us(e, t = [], n = null, r = null, i = null) {
845
845
  return o.reduceRight(
846
846
  (d, h, v) => {
847
847
  let b, E = !1, w = null, f = null;
848
- n && (b = s && h.route.id ? s[h.route.id] : void 0, w = h.route.errorElement || $s, a && (c < 0 && v === 0 ? (yi(
848
+ n && (b = s && h.route.id ? s[h.route.id] : void 0, w = h.route.errorElement || $s, a && (c < 0 && v === 0 ? (gi(
849
849
  "route-fallback",
850
850
  !1,
851
851
  "No `HydrateFallback` element provided to render during initial hydration"
@@ -866,7 +866,7 @@ function Us(e, t = [], n = null, r = null, i = null) {
866
866
  );
867
867
  };
868
868
  return n && (h.route.ErrorBoundary || h.route.errorElement || v === 0) ? /* @__PURE__ */ p.createElement(
869
- gi,
869
+ mi,
870
870
  {
871
871
  location: n.location,
872
872
  revalidation: n.revalidation,
@@ -927,18 +927,18 @@ function Ws() {
927
927
  "useNavigate"
928
928
  /* UseNavigateStable */
929
929
  ), n = p.useRef(!1);
930
- return pi(() => {
930
+ return fi(() => {
931
931
  n.current = !0;
932
932
  }), p.useCallback(
933
933
  async (i, o = {}) => {
934
- re(n.current, fi), n.current && (typeof i == "number" ? await e.navigate(i) : await e.navigate(i, { fromRouteId: t, ...o }));
934
+ re(n.current, hi), n.current && (typeof i == "number" ? await e.navigate(i) : await e.navigate(i, { fromRouteId: t, ...o }));
935
935
  },
936
936
  [e, t]
937
937
  );
938
938
  }
939
- var ur = {};
940
- function yi(e, t, n) {
941
- !t && !ur[e] && (ur[e] = !0, re(!1, n));
939
+ var lr = {};
940
+ function gi(e, t, n) {
941
+ !t && !lr[e] && (lr[e] = !0, re(!1, n));
942
942
  }
943
943
  p.memo(Gs);
944
944
  function Gs({
@@ -947,7 +947,7 @@ function Gs({
947
947
  state: n,
948
948
  onError: r
949
949
  }) {
950
- return mi(e, void 0, n, r, t);
950
+ return pi(e, void 0, n, r, t);
951
951
  }
952
952
  function mt(e) {
953
953
  B(
@@ -1179,7 +1179,7 @@ async function aa(e, t, n) {
1179
1179
  )
1180
1180
  );
1181
1181
  }
1182
- function dr(e, t, n, r, i, o) {
1182
+ function ur(e, t, n, r, i, o) {
1183
1183
  let s = (c, u) => n[u] ? c.route.id !== n[u].route.id : !0, a = (c, u) => (
1184
1184
  // param change, /users/123 -> /users/456
1185
1185
  n[u].pathname !== c.pathname || // splat param changed, which is not present in match.path
@@ -1237,7 +1237,7 @@ function da(e, t) {
1237
1237
  return n.has(o) || (n.add(o), r.push({ key: o, link: i })), r;
1238
1238
  }, []);
1239
1239
  }
1240
- function vi() {
1240
+ function yi() {
1241
1241
  let e = p.useContext(Oe);
1242
1242
  return Cn(
1243
1243
  e,
@@ -1253,7 +1253,7 @@ function ha() {
1253
1253
  }
1254
1254
  var An = p.createContext(void 0);
1255
1255
  An.displayName = "FrameworkContext";
1256
- function bi() {
1256
+ function vi() {
1257
1257
  let e = p.useContext(An);
1258
1258
  return Cn(
1259
1259
  e,
@@ -1306,14 +1306,14 @@ function $e(e, t) {
1306
1306
  };
1307
1307
  }
1308
1308
  function pa({ page: e, ...t }) {
1309
- let { router: n } = vi(), r = p.useMemo(
1310
- () => ni(n.routes, e, n.basename),
1309
+ let { router: n } = yi(), r = p.useMemo(
1310
+ () => ti(n.routes, e, n.basename),
1311
1311
  [n.routes, e, n.basename]
1312
1312
  );
1313
1313
  return r ? /* @__PURE__ */ p.createElement(ga, { page: e, matches: r, ...t }) : null;
1314
1314
  }
1315
1315
  function ma(e) {
1316
- let { manifest: t, routeModules: n } = bi(), [r, i] = p.useState([]);
1316
+ let { manifest: t, routeModules: n } = vi(), [r, i] = p.useState([]);
1317
1317
  return p.useEffect(() => {
1318
1318
  let o = !1;
1319
1319
  return aa(e, t, n).then(
@@ -1330,8 +1330,8 @@ function ga({
1330
1330
  matches: t,
1331
1331
  ...n
1332
1332
  }) {
1333
- let r = be(), { future: i, manifest: o, routeModules: s } = bi(), { basename: a } = vi(), { loaderData: c, matches: u } = ha(), d = p.useMemo(
1334
- () => dr(
1333
+ let r = be(), { future: i, manifest: o, routeModules: s } = vi(), { basename: a } = yi(), { loaderData: c, matches: u } = ha(), d = p.useMemo(
1334
+ () => ur(
1335
1335
  e,
1336
1336
  t,
1337
1337
  u,
@@ -1341,7 +1341,7 @@ function ga({
1341
1341
  ),
1342
1342
  [e, t, u, o, r]
1343
1343
  ), h = p.useMemo(
1344
- () => dr(
1344
+ () => ur(
1345
1345
  e,
1346
1346
  t,
1347
1347
  u,
@@ -1431,7 +1431,7 @@ function ba({
1431
1431
  }
1432
1432
  );
1433
1433
  }
1434
- var wi = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i, At = p.forwardRef(
1434
+ var bi = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i, At = p.forwardRef(
1435
1435
  function({
1436
1436
  onClick: t,
1437
1437
  discover: n = "render",
@@ -1447,7 +1447,7 @@ var wi = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i, At = p.forwardRef(
1447
1447
  unstable_defaultShouldRevalidate: v,
1448
1448
  ...b
1449
1449
  }, E) {
1450
- let { basename: w, unstable_useTransitions: f } = p.useContext(Q), _ = typeof u == "string" && wi.test(u), y = li(u, w);
1450
+ let { basename: w, unstable_useTransitions: f } = p.useContext(Q), _ = typeof u == "string" && bi.test(u), y = ci(u, w);
1451
1451
  u = y.to;
1452
1452
  let k = Ps(u, { relative: i }), [C, g, M] = fa(
1453
1453
  r,
@@ -1546,7 +1546,7 @@ var _a = p.forwardRef(
1546
1546
  unstable_defaultShouldRevalidate: v,
1547
1547
  ...b
1548
1548
  }, E) => {
1549
- let { unstable_useTransitions: w } = p.useContext(Q), f = Ra(), _ = xa(a, { relative: u }), y = s.toLowerCase() === "get" ? "get" : "post", k = typeof a == "string" && wi.test(a), C = (g) => {
1549
+ let { unstable_useTransitions: w } = p.useContext(Q), f = Ra(), _ = xa(a, { relative: u }), y = s.toLowerCase() === "get" ? "get" : "post", k = typeof a == "string" && bi.test(a), C = (g) => {
1550
1550
  if (c && c(g), g.defaultPrevented) return;
1551
1551
  g.preventDefault();
1552
1552
  let M = g.nativeEvent.submitter, R = M?.getAttribute("formmethod") || s, N = () => f(M || g.currentTarget, {
@@ -1579,7 +1579,7 @@ _a.displayName = "Form";
1579
1579
  function Ea(e) {
1580
1580
  return `${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
1581
1581
  }
1582
- function _i(e) {
1582
+ function wi(e) {
1583
1583
  let t = p.useContext(Oe);
1584
1584
  return B(t, Ea(e)), t;
1585
1585
  }
@@ -1627,7 +1627,7 @@ function Sa(e, {
1627
1627
  }
1628
1628
  var Ta = 0, ka = () => `__${String(++Ta)}__`;
1629
1629
  function Ra() {
1630
- let { router: e } = _i(
1630
+ let { router: e } = wi(
1631
1631
  "useSubmit"
1632
1632
  /* UseSubmit */
1633
1633
  ), { basename: t } = p.useContext(Q), n = Vs(), r = e.fetch, i = e.navigate;
@@ -1682,12 +1682,12 @@ function xa(e, { relative: t } = {}) {
1682
1682
  return (!e || e === ".") && i.route.index && (o.search = o.search ? o.search.replace(/^\?/, "?index&") : "?index"), n !== "/" && (o.pathname = o.pathname === "/" ? n : fe([n, o.pathname])), Ke(o);
1683
1683
  }
1684
1684
  function Ca(e, { relative: t } = {}) {
1685
- let n = p.useContext(di);
1685
+ let n = p.useContext(ui);
1686
1686
  B(
1687
1687
  n != null,
1688
1688
  "`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
1689
1689
  );
1690
- let { basename: r } = _i(
1690
+ let { basename: r } = wi(
1691
1691
  "useViewTransitionState"
1692
1692
  /* useViewTransitionState */
1693
1693
  ), i = nt(e, { relative: t });
@@ -1696,7 +1696,7 @@ function Ca(e, { relative: t } = {}) {
1696
1696
  let o = ge(n.currentLocation.pathname, r) || n.currentLocation.pathname, s = ge(n.nextLocation.pathname, r) || n.nextLocation.pathname;
1697
1697
  return Ct(i.pathname, s) != null || Ct(i.pathname, o) != null;
1698
1698
  }
1699
- const hr = (e) => {
1699
+ const dr = (e) => {
1700
1700
  let t;
1701
1701
  const n = /* @__PURE__ */ new Set(), r = (u, d) => {
1702
1702
  const h = typeof u == "function" ? u(t) : u;
@@ -1706,7 +1706,7 @@ const hr = (e) => {
1706
1706
  }
1707
1707
  }, i = () => t, a = { setState: r, getState: i, getInitialState: () => c, subscribe: (u) => (n.add(u), () => n.delete(u)) }, c = t = e(r, i, a);
1708
1708
  return a;
1709
- }, Aa = ((e) => e ? hr(e) : hr), Ia = (e) => e;
1709
+ }, Aa = ((e) => e ? dr(e) : dr), Ia = (e) => e;
1710
1710
  function Pa(e, t = Ia) {
1711
1711
  const n = ye.useSyncExternalStore(
1712
1712
  e.subscribe,
@@ -1715,17 +1715,17 @@ function Pa(e, t = Ia) {
1715
1715
  );
1716
1716
  return ye.useDebugValue(n), n;
1717
1717
  }
1718
- const fr = (e) => {
1718
+ const hr = (e) => {
1719
1719
  const t = Aa(e), n = (r) => Pa(t, r);
1720
1720
  return Object.assign(n, t), n;
1721
- }, Oa = ((e) => e ? fr(e) : fr), Ei = "https://cdn.hadoku.me", Si = /^[0-9a-f]{64}\.(?:png|jpe?g|gif|webp|avif)$/;
1722
- function Ti(e) {
1723
- return typeof e == "string" && Si.test(e);
1724
- }
1725
- const rt = 8080, $t = 5173, Ch = 80, ki = "/watchparty/ws", La = 500, Ah = 1e3, In = 4, Ih = 3e3, Ri = typeof process < "u" && process.env ? process.env : {};
1726
- Ri.PRODUCTION_UI_URL;
1727
- Ri.PRODUCTION_SERVER_URL;
1728
- const vt = l.enum(["S", "A", "B", "C", "D", "F"]), Ph = ["S", "A", "B", "C", "D", "F"], pr = 2e4, Ma = 300;
1721
+ }, Oa = ((e) => e ? hr(e) : hr), _i = "https://cdn.hadoku.me", Ei = /^[0-9a-f]{64}\.(?:png|jpe?g|gif|webp|avif)$/;
1722
+ function Si(e) {
1723
+ return typeof e == "string" && Ei.test(e);
1724
+ }
1725
+ const rt = 8080, $t = 5173, Ch = 80, Ti = "/watchparty/ws", La = 500, Ah = 1e3, In = 4, Ih = 3e3, ki = typeof process < "u" && process.env ? process.env : {};
1726
+ ki.PRODUCTION_UI_URL;
1727
+ ki.PRODUCTION_SERVER_URL;
1728
+ const vt = l.enum(["S", "A", "B", "C", "D", "F"]), Ph = ["S", "A", "B", "C", "D", "F"], fr = 2e4, Ma = 300;
1729
1729
  l.object({
1730
1730
  name: l.string().min(1).max(32).optional(),
1731
1731
  sprite: l.string().min(1).max(32).optional(),
@@ -1821,8 +1821,8 @@ l.object({
1821
1821
  media_id: l.string().optional()
1822
1822
  // leader_id removed - not needed since set_leader control was removed
1823
1823
  });
1824
- const xi = l.object({
1825
- key: l.string().regex(Si, "not a CDN image key"),
1824
+ const Ri = l.object({
1825
+ key: l.string().regex(Ei, "not a CDN image key"),
1826
1826
  /**
1827
1827
  * Intrinsic pixels, or **0 meaning "unknown"**.
1828
1828
  *
@@ -1835,8 +1835,8 @@ const xi = l.object({
1835
1835
  * text went with it, with nothing said. Widening is backward compatible —
1836
1836
  * every message already in history carries positive dimensions.
1837
1837
  */
1838
- w: l.number().int().nonnegative().max(pr),
1839
- h: l.number().int().nonnegative().max(pr),
1838
+ w: l.number().int().nonnegative().max(fr),
1839
+ h: l.number().int().nonnegative().max(fr),
1840
1840
  /**
1841
1841
  * Human-readable description, rendered as the `alt` text.
1842
1842
  *
@@ -1851,13 +1851,13 @@ const xi = l.object({
1851
1851
  * paragraph; the library's own titles run well under this.
1852
1852
  */
1853
1853
  title: l.string().max(Ma).optional()
1854
- }), Ci = /^[A-Za-z0-9_.:-]{1,64}$/;
1854
+ }), xi = /^[A-Za-z0-9_.:-]{1,64}$/;
1855
1855
  l.object({
1856
1856
  text: l.string().max(La),
1857
1857
  style: l.string().max(64).optional(),
1858
- images: l.array(xi).max(In).optional(),
1858
+ images: l.array(Ri).max(In).optional(),
1859
1859
  /** The message this one replies to. Optional: older clients never send it. */
1860
- reply_to: l.string().regex(Ci).optional()
1860
+ reply_to: l.string().regex(xi).optional()
1861
1861
  }).refine((e) => e.text.length > 0 || (e.images?.length ?? 0) > 0, { message: "message must carry text or at least one image" });
1862
1862
  const $a = l.enum(["join", "leave", "media_change", "identity_change", "recap"]);
1863
1863
  l.object({
@@ -1872,7 +1872,7 @@ l.object({
1872
1872
  ts: l.number(),
1873
1873
  // Optional so a client on an older bundle still validates a message that
1874
1874
  // has none, and so system messages (which never carry images) stay unchanged.
1875
- images: l.array(xi).max(In).optional(),
1875
+ images: l.array(Ri).max(In).optional(),
1876
1876
  /** The id of the message this one answers (resolved by the client from
1877
1877
  * what it holds; the original may have rolled out of history). */
1878
1878
  reply_to: l.string().optional(),
@@ -1978,7 +1978,7 @@ const Pn = l.enum(["super_upvote", "upvote", "mid", "downvote"]), Ha = l.object(
1978
1978
  durationMs: l.number().optional(),
1979
1979
  uploadDate: l.string().optional()
1980
1980
  // YouTube upload date 'YYYY-MM-DD'; drives playlist order
1981
- }), qa = l.enum(["basic", "vote"]), Ai = l.object({
1981
+ }), qa = l.enum(["basic", "vote"]), Ci = l.object({
1982
1982
  id: l.string(),
1983
1983
  name: l.string(),
1984
1984
  type: qa.default("vote"),
@@ -1996,7 +1996,7 @@ l.object({
1996
1996
  l.object({ voterKey: l.string().min(1).max(128) });
1997
1997
  l.object({ playlistId: l.string(), mediaIds: l.array(l.string()) });
1998
1998
  l.object({
1999
- playlist: Ai.nullable(),
1999
+ playlist: Ci.nullable(),
2000
2000
  activeIndex: l.number().int().nullable(),
2001
2001
  myVotes: l.record(l.string(), Pn)
2002
2002
  // mediaId -> VoteValue
@@ -2011,7 +2011,7 @@ l.object({
2011
2011
  progress: l.array(Va)
2012
2012
  });
2013
2013
  l.object({
2014
- playlist: Ai,
2014
+ playlist: Ci,
2015
2015
  votes: l.record(l.string(), l.record(l.string(), Pn)),
2016
2016
  // votes[clientId][mediaId]
2017
2017
  names: l.record(l.string(), l.string()),
@@ -2043,16 +2043,16 @@ const de = {
2043
2043
  VOTE_REMOVE: "playlist_vote_remove",
2044
2044
  /** Server -> the removed voter: forget the ballot you hold in localStorage. */
2045
2045
  VOTES_CLEARED: "playlist_votes_cleared"
2046
- }, Ii = l.object({
2046
+ }, Ai = l.object({
2047
2047
  id: l.string(),
2048
2048
  displayName: l.string(),
2049
2049
  thumbnail: l.string().optional()
2050
2050
  });
2051
2051
  l.object({
2052
- items: l.array(Ii)
2052
+ items: l.array(Ai)
2053
2053
  });
2054
- const Pi = l.partialRecord(vt, l.array(l.string()));
2055
- l.object({ board: Pi });
2054
+ const Ii = l.partialRecord(vt, l.array(l.string()));
2055
+ l.object({ board: Ii });
2056
2056
  const za = l.object({
2057
2057
  mediaId: l.string(),
2058
2058
  tier: vt,
@@ -2066,7 +2066,7 @@ const za = l.object({
2066
2066
  // opaque voterId -> the letter they gave
2067
2067
  });
2068
2068
  l.object({
2069
- items: l.array(Ii),
2069
+ items: l.array(Ai),
2070
2070
  placed: l.array(za),
2071
2071
  unrated: l.array(l.string()),
2072
2072
  spread: l.number(),
@@ -2077,7 +2077,7 @@ l.object({
2077
2077
  * browser on a newer bundle still reads an older server's board. */
2078
2078
  pictures: l.record(l.string(), l.string()).optional(),
2079
2079
  voterCount: l.number().int().nonnegative(),
2080
- myBoard: Pi
2080
+ myBoard: Ii
2081
2081
  });
2082
2082
  const Wa = {
2083
2083
  /** Broadcast to EVERY connected socket when anyone saves. Carries no board —
@@ -2130,7 +2130,7 @@ const Ga = [
2130
2130
  characters: [
2131
2131
  { id: "gunner", color: "#b6a472" },
2132
2132
  { id: "chief", color: "#a47e4d" },
2133
- { id: "walker", color: "#e0443a", rev: 2 },
2133
+ { id: "walker", color: "#e0443a" },
2134
2134
  { id: "operative", color: "#347cae" }
2135
2135
  ]
2136
2136
  },
@@ -2141,7 +2141,7 @@ const Ga = [
2141
2141
  { id: "recluse", color: "#6d6880" },
2142
2142
  { id: "phantom", color: "#a4a3ae" },
2143
2143
  { id: "harlequin", color: "#e5d5c5" },
2144
- { id: "doll", color: "#a02633", rev: 2 },
2144
+ { id: "doll", color: "#a02633" },
2145
2145
  { id: "imp", color: "#b398cb" }
2146
2146
  ]
2147
2147
  },
@@ -2155,55 +2155,130 @@ const Ga = [
2155
2155
  { id: "mentor", color: "#e1e0dc" }
2156
2156
  ]
2157
2157
  }
2158
- ], Mn = Ga.flatMap((e) => e.characters), Ae = Mn.map((e) => e.id), Ka = Object.fromEntries(Mn.map((e) => [e.id, e.color])), Ya = Object.fromEntries(Mn.map((e) => [e.id, "rev" in e ? e.rev : 1]));
2159
- function Ja(e) {
2160
- const t = Ya[e];
2161
- return `/media/sprites/square_${e}.png${t > 1 ? `?v=${t}` : ""}`;
2162
- }
2158
+ ], Pi = Ga.flatMap((e) => e.characters), Ae = Pi.map((e) => e.id), Ka = Object.fromEntries(Pi.map((e) => [e.id, e.color]));
2163
2159
  function Bt(e) {
2164
2160
  return !!e && Ae.includes(e);
2165
2161
  }
2166
- const Oh = 4, Lh = 3e4, Mh = 5e3, Nh = 2e3, Dh = 5e3, $h = 2e3, Bh = 5e3, Fh = 2e3, Uh = 1e4, jh = 10, Hh = 2e3, qh = 3, Vh = 50, zh = 3, Wh = 3e4, Gh = 2e4, Kh = 99999, Xa = 5e3, Qa = "output_frag.mp4", mr = "/healthz", Oi = { mode: "off", percent: 0 }, Za = ["off", "on", "ab"];
2167
- function ec(e) {
2168
- return typeof e == "string" && Za.includes(e);
2162
+ const Oh = 4, Lh = 3e4, Mh = 5e3, Nh = 2e3, Dh = 5e3, $h = 2e3, Bh = 5e3, Fh = 2e3, Uh = 1e4, jh = 10, Hh = 2e3, qh = 3, Vh = 50, zh = 3, Wh = 3e4, Gh = 2e4, Kh = 99999, Ya = 5e3, Ja = "output_frag.mp4", pr = "/healthz", Oi = { mode: "off", percent: 0 }, Xa = ["off", "on", "ab"];
2163
+ function Qa(e) {
2164
+ return typeof e == "string" && Xa.includes(e);
2169
2165
  }
2170
2166
  function Li(e) {
2171
- const t = e && typeof e == "object" ? e : {}, n = ec(t.mode) ? t.mode : Oi.mode, r = Number(t.percent), i = Number.isFinite(r) ? Math.min(100, Math.max(0, Math.round(r))) : 0;
2167
+ const t = e && typeof e == "object" ? e : {}, n = Qa(t.mode) ? t.mode : Oi.mode, r = Number(t.percent), i = Number.isFinite(r) ? Math.min(100, Math.max(0, Math.round(r))) : 0;
2172
2168
  return { mode: n, percent: i };
2173
2169
  }
2174
- function tc(e) {
2170
+ function Za(e) {
2175
2171
  let t = 2166136261;
2176
2172
  for (let n = 0; n < e.length; n++)
2177
2173
  t ^= e.charCodeAt(n), t = Math.imul(t, 16777619) >>> 0;
2178
2174
  return t >>> 0;
2179
2175
  }
2180
- function nc(e, t, n) {
2176
+ function ec(e, t, n) {
2181
2177
  if (n === !0)
2182
2178
  return "fragment";
2183
2179
  if (n === !1)
2184
2180
  return "range";
2185
2181
  const r = Li(e);
2186
- return r.mode === "on" ? "fragment" : r.mode === "off" || r.percent <= 0 ? "range" : r.percent >= 100 || t && tc(t) % 100 < r.percent ? "fragment" : "range";
2182
+ return r.mode === "on" ? "fragment" : r.mode === "off" || r.percent <= 0 ? "range" : r.percent >= 100 || t && Za(t) % 100 < r.percent ? "fragment" : "range";
2187
2183
  }
2188
- const rc = /^[a-z0-9][a-z0-9-]{0,31}$/, gr = "https://game-catalog.invalid";
2189
- function ic(e) {
2184
+ const tc = /^[a-z0-9][a-z0-9-]{0,31}$/, mr = "https://game-catalog.invalid";
2185
+ function nc(e) {
2190
2186
  if (!e.startsWith("/") || e.startsWith("//") || /[\\\s]/.test(e) || [...e].some((t) => t.charCodeAt(0) < 32 || t.charCodeAt(0) === 127))
2191
2187
  return !1;
2192
2188
  try {
2193
- return new URL(e, gr).origin === gr;
2189
+ return new URL(e, mr).origin === mr;
2194
2190
  } catch {
2195
2191
  return !1;
2196
2192
  }
2197
2193
  }
2198
- const Mi = l.string().min(2).max(512).refine(ic, {
2194
+ const Mi = l.string().min(2).max(512).refine(nc, {
2199
2195
  message: "must be a root-relative path on the page origin (e.g. /cardtable/embed/x.js)"
2200
- }), oc = {
2201
- id: l.string().regex(rc),
2196
+ }), rc = {
2197
+ id: l.string().regex(tc),
2202
2198
  name: l.string().min(1).max(64),
2203
2199
  cover: Mi.optional()
2204
- }, sc = l.object({ ...oc, kind: l.literal("module"), url: Mi }).strict(), ac = l.array(sc).max(32).refine((e) => new Set(e.map((t) => t.id)).size === e.length, { message: "game ids must be unique" }), cc = [
2200
+ }, ic = l.object({ ...rc, kind: l.literal("module"), url: Mi }).strict(), oc = l.array(ic).max(32).refine((e) => new Set(e.map((t) => t.id)).size === e.length, { message: "game ids must be unique" }), sc = [
2205
2201
  { id: "bomberman", name: "Bomberman", kind: "module", url: "/bomberman/embed/bomberman-embed.js" }
2206
2202
  ];
2203
+ function ac(e, t, n) {
2204
+ const r = !!e.name && !n(e.name) && (!t || n(t.name || "")), i = !!e.avatarId && (!t || t.avatarId !== e.avatarId);
2205
+ if (!r && !i)
2206
+ return null;
2207
+ const o = {};
2208
+ return r && (o.name = e.name), i && (o.avatarId = e.avatarId), o;
2209
+ }
2210
+ const cc = [
2211
+ "sage",
2212
+ "herald",
2213
+ "cleric",
2214
+ "knight",
2215
+ "mage",
2216
+ "brawler",
2217
+ "wanderer",
2218
+ "rogue",
2219
+ "gunner",
2220
+ "chief",
2221
+ "walker",
2222
+ "operative",
2223
+ "idol",
2224
+ "recluse",
2225
+ "phantom",
2226
+ "harlequin",
2227
+ "doll",
2228
+ "imp",
2229
+ "apprentice",
2230
+ "prodigy",
2231
+ "dreamer",
2232
+ "sunny",
2233
+ "mentor"
2234
+ ], lc = {
2235
+ walker: 2,
2236
+ doll: 2
2237
+ };
2238
+ function uc(e) {
2239
+ const t = lc[e] ?? 1;
2240
+ return `/media/sprites/square_${encodeURIComponent(e)}.png${t > 1 ? `?v=${t}` : ""}`;
2241
+ }
2242
+ function Ni(e, t, n = cc, r = Math.random) {
2243
+ const i = /* @__PURE__ */ new Set();
2244
+ for (const s of e)
2245
+ s && i.add(s);
2246
+ const o = n.filter((s) => !i.has(s));
2247
+ return o.length ? o[Math.floor(r() * o.length)] : void 0;
2248
+ }
2249
+ function dc() {
2250
+ return Array.from(globalThis.crypto.getRandomValues(new Uint8Array(16)), (e) => e.toString(16).padStart(2, "0")).join("");
2251
+ }
2252
+ const hc = {
2253
+ /** client → server, with an ack. Payload: `RoomWatch`. */
2254
+ watch: "room-feed:watch",
2255
+ /** server → client. Payload: `RoomChanged`. */
2256
+ changed: "room-feed:changed"
2257
+ };
2258
+ function fc(e) {
2259
+ if (typeof e != "object" || e === null || Array.isArray(e))
2260
+ return null;
2261
+ const t = e;
2262
+ if ("room" in t) {
2263
+ const { room: n, ...r } = t;
2264
+ return Object.keys(r).length > 0 ? null : typeof n == "string" && n.length > 0 ? { room: n } : null;
2265
+ }
2266
+ if ("list" in t) {
2267
+ const { list: n, ...r } = t;
2268
+ return Object.keys(r).length > 0 ? null : n === !0 ? { list: !0 } : null;
2269
+ }
2270
+ return null;
2271
+ }
2272
+ const pc = 20;
2273
+ function mc(e, t, n, r) {
2274
+ const i = e ?? [], o = i.findIndex((a) => a.emoji === t);
2275
+ if (r)
2276
+ return o >= 0 ? i[o].by.includes(n) ? null : i.map((a, c) => c === o ? { emoji: t, by: [...a.by, n] } : a) : i.length >= pc ? null : [...i, { emoji: t, by: [n] }];
2277
+ if (o < 0 || !i[o].by.includes(n))
2278
+ return null;
2279
+ const s = i[o].by.filter((a) => a !== n);
2280
+ return s.length ? i.map((a, c) => c === o ? { emoji: t, by: s } : a) : i.filter((a, c) => c !== o);
2281
+ }
2207
2282
  var Qt = {
2208
2283
  image: 10 * 1024 * 1024,
2209
2284
  audio: 50 * 1024 * 1024
@@ -2214,12 +2289,12 @@ function q(e, t, n) {
2214
2289
  function z(e) {
2215
2290
  return [...e].map((t) => t.charCodeAt(0));
2216
2291
  }
2217
- function lc(e) {
2292
+ function gc(e) {
2218
2293
  if (e.length < 3 || e[0] !== 255) return !1;
2219
2294
  const t = e[1] ?? 0, n = e[2] ?? 0, r = (t & 224) === 224, i = t >> 3 & 3, o = t >> 1 & 3, s = n >> 4, a = n >> 2 & 3;
2220
2295
  return r && i !== 1 && o === 1 && s !== 0 && s !== 15 && a !== 3;
2221
2296
  }
2222
- var Ni = [
2297
+ var Di = [
2223
2298
  {
2224
2299
  contentType: "image/png",
2225
2300
  extension: ".png",
@@ -2265,7 +2340,7 @@ var Ni = [
2265
2340
  kind: "audio",
2266
2341
  // Either an ID3v2 tag ("ID3" + a major version of 2–4 + a minor that is
2267
2342
  // never 0xFF) or a bare Layer III frame. Most real mp3s carry the tag.
2268
- matches: (e) => q(e, 0, z("ID3")) && (e[3] ?? 0) >= 2 && (e[3] ?? 0) <= 4 && e[4] !== 255 || lc(e)
2343
+ matches: (e) => q(e, 0, z("ID3")) && (e[3] ?? 0) >= 2 && (e[3] ?? 0) <= 4 && e[4] !== 255 || gc(e)
2269
2344
  },
2270
2345
  {
2271
2346
  contentType: "audio/flac",
@@ -2305,13 +2380,13 @@ var Ni = [
2305
2380
  // client's accepted-type unions are derived from this list rather than
2306
2381
  // restated; `satisfies` still holds every entry to the MediaFormat shape.
2307
2382
  ];
2308
- function Di(e) {
2309
- return Ni.filter((t) => t.kind === e).map(
2383
+ function $i(e) {
2384
+ return Di.filter((t) => t.kind === e).map(
2310
2385
  (t) => t.contentType
2311
2386
  );
2312
2387
  }
2313
- Ni.map((e) => e.contentType).join(", ");
2314
- var uc = Di("image"), dc = Di("audio"), hc = {
2388
+ Di.map((e) => e.contentType).join(", ");
2389
+ var yc = $i("image"), vc = $i("audio"), bc = {
2315
2390
  "audio/mp3": "audio/mpeg",
2316
2391
  "audio/x-mp3": "audio/mpeg",
2317
2392
  "audio/x-mpeg": "audio/mpeg",
@@ -2323,11 +2398,11 @@ var uc = Di("image"), dc = Di("audio"), hc = {
2323
2398
  "audio/wave": "audio/wav",
2324
2399
  "audio/vnd.wave": "audio/wav"
2325
2400
  };
2326
- function $i(e) {
2401
+ function Bi(e) {
2327
2402
  const t = e.toLowerCase();
2328
- return uc.includes(t) ? "image" : dc.includes(t) || t in hc ? "audio" : null;
2403
+ return yc.includes(t) ? "image" : vc.includes(t) || t in bc ? "audio" : null;
2329
2404
  }
2330
- var fc = 24, Yh = 250, qe = class extends Error {
2405
+ var wc = 24, Yh = 250, qe = class extends Error {
2331
2406
  reason;
2332
2407
  /** HTTP status, when there was a response. */
2333
2408
  status;
@@ -2344,7 +2419,7 @@ var fc = 24, Yh = 250, qe = class extends Error {
2344
2419
  super(t), this.name = "CdnError", this.reason = e, this.status = n, this.retryAfterSeconds = r;
2345
2420
  }
2346
2421
  };
2347
- function pc(e, t = Date.now()) {
2422
+ function _c(e, t = Date.now()) {
2348
2423
  if (!e) return null;
2349
2424
  const n = e.trim();
2350
2425
  if (!n) return null;
@@ -2353,7 +2428,7 @@ function pc(e, t = Date.now()) {
2353
2428
  const i = Date.parse(n);
2354
2429
  return Number.isNaN(i) ? null : Math.max(0, Math.ceil((i - t) / 1e3));
2355
2430
  }
2356
- function mc(e) {
2431
+ function Ec(e) {
2357
2432
  switch (e) {
2358
2433
  case 401:
2359
2434
  return "unauthenticated";
@@ -2376,8 +2451,8 @@ function mc(e) {
2376
2451
  return "unknown";
2377
2452
  }
2378
2453
  }
2379
- async function gc(e) {
2380
- const t = mc(e.status);
2454
+ async function Sc(e) {
2455
+ const t = Ec(e.status);
2381
2456
  let n = `CDN request failed (${e.status})`;
2382
2457
  try {
2383
2458
  const r = await e.json();
@@ -2388,21 +2463,21 @@ async function gc(e) {
2388
2463
  t,
2389
2464
  n,
2390
2465
  e.status,
2391
- t === "rate-limited" ? pc(e.headers.get("Retry-After")) : null
2466
+ t === "rate-limited" ? _c(e.headers.get("Retry-After")) : null
2392
2467
  );
2393
2468
  }
2394
- var yc = "/cdn/api/upload", vc = /^[0-9a-f]{64}\.[a-z0-9]{1,8}$/;
2395
- function bc(e) {
2469
+ var Tc = "/cdn/api/upload", kc = /^[0-9a-f]{64}\.[a-z0-9]{1,8}$/;
2470
+ function Rc(e) {
2396
2471
  if (e.size === 0)
2397
2472
  throw new qe("invalid", "File is empty");
2398
- const t = e.type ? $i(e.type) : null;
2473
+ const t = e.type ? Bi(e.type) : null;
2399
2474
  if (e.type && !t)
2400
2475
  throw new qe("unsupported-type", `${e.type} is not an accepted image or audio format`);
2401
2476
  const n = t ? Qt[t] : Math.max(Qt.image, Qt.audio);
2402
2477
  if (e.size > n)
2403
2478
  throw new qe("too-large", `File is ${e.size} bytes; the maximum is ${n}`);
2404
2479
  }
2405
- function wc(e) {
2480
+ function xc(e) {
2406
2481
  if (typeof e != "object" || e === null) return null;
2407
2482
  const t = e;
2408
2483
  return typeof t.key != "string" || !t.key ? null : {
@@ -2414,8 +2489,8 @@ function wc(e) {
2414
2489
  contentType: typeof t.contentType == "string" ? t.contentType : "image/*"
2415
2490
  };
2416
2491
  }
2417
- function _c(e) {
2418
- const t = e.cdnBase.replace(/\/+$/, ""), n = e.uploadPath ?? yc, r = e.fetch ?? globalThis.fetch.bind(globalThis);
2492
+ function Cc(e) {
2493
+ const t = e.cdnBase.replace(/\/+$/, ""), n = e.uploadPath ?? Tc, r = e.fetch ?? globalThis.fetch.bind(globalThis);
2419
2494
  async function i(o, s) {
2420
2495
  let a;
2421
2496
  try {
@@ -2423,14 +2498,14 @@ function _c(e) {
2423
2498
  } catch (c) {
2424
2499
  throw c instanceof Error && c.name === "AbortError" ? c : new qe("network", c instanceof Error ? c.message : "Request failed");
2425
2500
  }
2426
- if (!a.ok) throw await gc(a);
2501
+ if (!a.ok) throw await Sc(a);
2427
2502
  return a;
2428
2503
  }
2429
2504
  return {
2430
2505
  cdnBase: t,
2431
2506
  uploadPath: n,
2432
2507
  async upload(o, s) {
2433
- return bc(o), await (await i(n, {
2508
+ return Rc(o), await (await i(n, {
2434
2509
  method: "POST",
2435
2510
  body: o,
2436
2511
  signal: s?.signal,
@@ -2443,21 +2518,21 @@ function _c(e) {
2443
2518
  return `${t}/${o.replace(/^\/+/, "")}`;
2444
2519
  },
2445
2520
  isKey(o) {
2446
- return vc.test(o);
2521
+ return kc.test(o);
2447
2522
  },
2448
2523
  catalogue(o, s) {
2449
2524
  const a = o.replace(/\/+$/, ""), c = s?.surface;
2450
2525
  return {
2451
2526
  async search(u = {}) {
2452
2527
  const d = new URLSearchParams(), h = u.query?.trim();
2453
- h && d.set("q", h), d.set("limit", String(u.limit ?? fc)), u.cursor && d.set("cursor", u.cursor);
2528
+ h && d.set("q", h), d.set("limit", String(u.limit ?? wc)), u.cursor && d.set("cursor", u.cursor);
2454
2529
  const b = await (await i(`${a}?${d.toString()}`, {
2455
2530
  method: "GET",
2456
2531
  signal: u.signal,
2457
2532
  credentials: "same-origin"
2458
2533
  })).json();
2459
2534
  return {
2460
- results: (Array.isArray(b.results) ? b.results : []).map(wc).filter((w) => w !== null),
2535
+ results: (Array.isArray(b.results) ? b.results : []).map(xc).filter((w) => w !== null),
2461
2536
  next: typeof b.next == "string" && b.next ? b.next : null
2462
2537
  };
2463
2538
  },
@@ -2475,15 +2550,15 @@ function _c(e) {
2475
2550
  }
2476
2551
  function Jh(e, t = ["image"]) {
2477
2552
  if (!e) return [];
2478
- const n = (o) => Bi(o, t), r = e.files ? Array.from(e.files) : [];
2553
+ const n = (o) => Fi(o, t), r = e.files ? Array.from(e.files) : [];
2479
2554
  return r.length > 0 ? r.filter(n) : (e.items ? Array.from(e.items) : []).filter((o) => o.kind === "file").map((o) => o.getAsFile()).filter((o) => o !== null).filter(n);
2480
2555
  }
2481
2556
  function Xh(e, t = ["image"]) {
2482
- return e?.files ? Array.from(e.files).filter((n) => Bi(n, t)) : [];
2557
+ return e?.files ? Array.from(e.files).filter((n) => Fi(n, t)) : [];
2483
2558
  }
2484
- function Bi(e, t) {
2559
+ function Fi(e, t) {
2485
2560
  if (!e.type) return !0;
2486
- const n = $i(e.type);
2561
+ const n = Bi(e.type);
2487
2562
  return n !== null && t.includes(n);
2488
2563
  }
2489
2564
  async function Qh(e) {
@@ -2496,28 +2571,28 @@ async function Qh(e) {
2496
2571
  return null;
2497
2572
  }
2498
2573
  }
2499
- let st = null, Fi = Ei;
2500
- function Ec(e) {
2501
- e.cdnBase && (Fi = e.cdnBase);
2574
+ let st = null, Ui = _i;
2575
+ function Ac(e) {
2576
+ e.cdnBase && (Ui = e.cdnBase);
2502
2577
  }
2503
- function Ui() {
2504
- return Fi.replace(/\/+$/, "");
2578
+ function ji() {
2579
+ return Ui.replace(/\/+$/, "");
2505
2580
  }
2506
- function Sc() {
2507
- const e = Ui();
2508
- return (!st || st.base !== e) && (st = { base: e, client: _c({ cdnBase: e }) }), st.client;
2581
+ function Ic() {
2582
+ const e = ji();
2583
+ return (!st || st.base !== e) && (st = { base: e, client: Cc({ cdnBase: e }) }), st.client;
2509
2584
  }
2510
2585
  function Zh(e) {
2511
- return !Ti(e) || !Ui() ? null : Sc().urlFor(e);
2586
+ return !Si(e) || !ji() ? null : Ic().urlFor(e);
2512
2587
  }
2513
- function Tc(e) {
2588
+ function Pc(e) {
2514
2589
  return `/tv?return=${encodeURIComponent(e.pathname + e.search)}`;
2515
2590
  }
2516
- function kc({ className: e }) {
2591
+ function Oc({ className: e }) {
2517
2592
  return /* @__PURE__ */ S(
2518
2593
  "a",
2519
2594
  {
2520
- href: Tc(window.location),
2595
+ href: Pc(window.location),
2521
2596
  className: e,
2522
2597
  "data-testid": "sign-in-with-code",
2523
2598
  children: "Sign in with a code"
@@ -2527,27 +2602,27 @@ function kc({ className: e }) {
2527
2602
  const Ve = {
2528
2603
  serverOrigin: `http://localhost:${rt}`,
2529
2604
  defaultRoomKey: "dev-room",
2530
- cdnBase: Ei
2605
+ cdnBase: _i
2531
2606
  };
2532
2607
  let bt = { ...Ve };
2533
- function Rc(e) {
2608
+ function Lc(e) {
2534
2609
  const t = Object.fromEntries(
2535
2610
  Object.entries(e).filter(([n, r]) => r !== void 0)
2536
2611
  );
2537
- bt = { ...bt, ...t }, Ec({ cdnBase: bt.cdnBase });
2612
+ bt = { ...bt, ...t }, Ac({ cdnBase: bt.cdnBase });
2538
2613
  }
2539
2614
  function Se() {
2540
2615
  return bt;
2541
2616
  }
2542
- const ji = jo(Ve);
2543
- function xc() {
2544
- return Ho(ji);
2617
+ const Hi = jo(Ve);
2618
+ function Mc() {
2619
+ return Ho(Hi);
2545
2620
  }
2546
- function Hi(e) {
2621
+ function qi(e) {
2547
2622
  return e.serverOrigin?.replace(/\/$/, "") || "";
2548
2623
  }
2549
2624
  function Ft() {
2550
- return Hi(Se());
2625
+ return qi(Se());
2551
2626
  }
2552
2627
  const Le = {
2553
2628
  ANON_KEY: "watchparty_preferences",
@@ -2571,7 +2646,7 @@ function ie(e) {
2571
2646
  return null;
2572
2647
  }
2573
2648
  }
2574
- function Nn(e, t) {
2649
+ function Mn(e, t) {
2575
2650
  try {
2576
2651
  const n = Ut();
2577
2652
  return n ? (n.setItem(e, t), !0) : !1;
@@ -2579,7 +2654,7 @@ function Nn(e, t) {
2579
2654
  return !1;
2580
2655
  }
2581
2656
  }
2582
- function Cc() {
2657
+ function Nc() {
2583
2658
  try {
2584
2659
  const e = Ut();
2585
2660
  if (!e) return [];
@@ -2599,45 +2674,45 @@ function It(e) {
2599
2674
  } catch {
2600
2675
  }
2601
2676
  }
2602
- function Ac(e) {
2677
+ function Dc(e) {
2603
2678
  const t = ie(e);
2604
2679
  return t === null ? null : t === "true" ? !0 : t === "false" ? !1 : null;
2605
2680
  }
2606
- const qi = /* @__PURE__ */ new Map();
2607
- let Vi = !1;
2681
+ const Vi = /* @__PURE__ */ new Map();
2682
+ let zi = !1;
2608
2683
  function jt(e, t) {
2609
- qi.set(e, t), Vi && zi(e, t);
2684
+ Vi.set(e, t), zi && Wi(e, t);
2610
2685
  }
2611
- function Ic() {
2612
- Vi = !0;
2613
- for (const [e, t] of qi) zi(e, t);
2686
+ function $c() {
2687
+ zi = !0;
2688
+ for (const [e, t] of Vi) Wi(e, t);
2614
2689
  }
2615
- function zi(e, t) {
2690
+ function Wi(e, t) {
2616
2691
  typeof window > "u" || (window[e] = t);
2617
2692
  }
2618
- const ze = [], Pc = 500;
2693
+ const ze = [], Bc = 500;
2619
2694
  let wt = [], dn = null;
2620
- const Oc = 1e3, Lc = 200;
2695
+ const Fc = 1e3, Uc = 200;
2621
2696
  let Ye = null;
2622
- function Wi(e) {
2697
+ function Gi(e) {
2623
2698
  Ye = e;
2624
2699
  }
2625
- function Gi() {
2700
+ function Ki() {
2626
2701
  return ie(Le.REPORT_LOGS_FLAG) === "true";
2627
2702
  }
2628
- function Ki() {
2703
+ function Yi() {
2629
2704
  if (typeof window > "u") return !1;
2630
2705
  if (window.__WP_DEBUG__ || new URLSearchParams(window.location.search).get("debug") === "true") return !0;
2631
2706
  const t = ie(Le.DEBUG_FLAG);
2632
2707
  return t !== null && t !== "false";
2633
2708
  }
2634
- function Mc() {
2709
+ function jc() {
2635
2710
  const e = ie(Le.DEBUG_FLAG);
2636
2711
  if (!e || e === "true") return null;
2637
2712
  const t = e.split(",").map((n) => n.trim().toLowerCase()).filter(Boolean);
2638
2713
  return t.length > 0 ? new Set(t) : null;
2639
2714
  }
2640
- function Nc() {
2715
+ function Hc() {
2641
2716
  return (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", {
2642
2717
  hour12: !1,
2643
2718
  hour: "2-digit",
@@ -2646,8 +2721,8 @@ function Nc() {
2646
2721
  fractionalSecondDigits: 3
2647
2722
  });
2648
2723
  }
2649
- function Dc(e) {
2650
- ze.push(e), ze.length > Pc && ze.shift();
2724
+ function qc(e) {
2725
+ ze.push(e), ze.length > Bc && ze.shift();
2651
2726
  }
2652
2727
  const Zt = {
2653
2728
  debug: "color: #64748b; font-weight: normal;",
@@ -2656,14 +2731,14 @@ const Zt = {
2656
2731
  category: "color: #3b82f6; font-weight: bold;",
2657
2732
  time: "color: #6b7280; font-weight: normal;"
2658
2733
  };
2659
- function $c(e) {
2734
+ function Vc(e) {
2660
2735
  try {
2661
2736
  return JSON.stringify(e);
2662
2737
  } catch {
2663
2738
  return "[unserializable]";
2664
2739
  }
2665
2740
  }
2666
- function Dn(e, t, n, r, i, o, s) {
2741
+ function Nn(e, t, n, r, i, o, s) {
2667
2742
  const a = {
2668
2743
  level: e,
2669
2744
  category: i,
@@ -2671,12 +2746,12 @@ function Dn(e, t, n, r, i, o, s) {
2671
2746
  data: s,
2672
2747
  timestamp: Date.now()
2673
2748
  };
2674
- if (Dc(a), (n || Gi()) && yr(a), !r) {
2675
- if (!Ki()) return;
2676
- const d = Mc();
2749
+ if (qc(a), (n || Ki()) && gr(a), !r) {
2750
+ if (!Yi()) return;
2751
+ const d = jc();
2677
2752
  if (d && !d.has(i.toLowerCase())) return;
2678
2753
  }
2679
- const c = Nc(), u = s !== void 0 ? " " + $c(s) : "";
2754
+ const c = Hc(), u = s !== void 0 ? " " + Vc(s) : "";
2680
2755
  t(
2681
2756
  `%c[${c}]%c [${i}]%c ${o}${u}`,
2682
2757
  Zt.time,
@@ -2685,33 +2760,33 @@ function Dn(e, t, n, r, i, o, s) {
2685
2760
  );
2686
2761
  }
2687
2762
  function m(e, t, n) {
2688
- Dn("debug", console.log, !1, !1, e, t, n);
2763
+ Nn("debug", console.log, !1, !1, e, t, n);
2689
2764
  }
2690
2765
  function L(e, t, n) {
2691
- Dn("warn", console.warn, !0, !1, e, t, n);
2766
+ Nn("warn", console.warn, !0, !1, e, t, n);
2692
2767
  }
2693
2768
  function pe(e, t, n) {
2694
- Dn("error", console.error, !0, !0, e, t, n);
2769
+ Nn("error", console.error, !0, !0, e, t, n);
2695
2770
  }
2696
- function Bc() {
2771
+ function zc() {
2697
2772
  return [...ze];
2698
2773
  }
2699
- function Fc() {
2774
+ function Wc() {
2700
2775
  ze.length = 0;
2701
2776
  }
2702
- function Uc(e) {
2777
+ function Gc(e) {
2703
2778
  const t = e && e.length > 0 ? e.join(",") : "true";
2704
- Nn(Le.DEBUG_FLAG, t), console.log("[wp] Debug mode enabled");
2779
+ Mn(Le.DEBUG_FLAG, t), console.log("[wp] Debug mode enabled");
2705
2780
  }
2706
- function jc() {
2781
+ function Kc() {
2707
2782
  It(Le.DEBUG_FLAG), console.log("[wp] Debug mode disabled");
2708
2783
  }
2709
- const Hc = 1024, qc = 5e4;
2710
- function Yi(e) {
2784
+ const Yc = 1024, Jc = 5e4;
2785
+ function Ji(e) {
2711
2786
  if (e == null) return e;
2712
2787
  try {
2713
2788
  const t = JSON.stringify(e);
2714
- if (t.length <= Hc) return e;
2789
+ if (t.length <= Yc) return e;
2715
2790
  if (typeof e == "object" && !Array.isArray(e)) {
2716
2791
  const n = {};
2717
2792
  for (const [r, i] of Object.entries(e)) {
@@ -2741,7 +2816,7 @@ function ef(e, t, n, r) {
2741
2816
  level: e,
2742
2817
  category: t,
2743
2818
  message: n,
2744
- data: Yi(r),
2819
+ data: Ji(r),
2745
2820
  timestamp: Date.now(),
2746
2821
  url: typeof window < "u" ? window.location.href : void 0,
2747
2822
  userAgent: typeof navigator < "u" ? navigator.userAgent : void 0,
@@ -2752,7 +2827,7 @@ function ef(e, t, n, r) {
2752
2827
  } catch {
2753
2828
  }
2754
2829
  }
2755
- async function Vc() {
2830
+ async function Xc() {
2756
2831
  if (wt.length === 0) return;
2757
2832
  const e = wt;
2758
2833
  wt = [], dn = null;
@@ -2766,7 +2841,7 @@ async function Vc() {
2766
2841
  level: a.level,
2767
2842
  category: a.category,
2768
2843
  message: a.message,
2769
- data: Yi(a.data),
2844
+ data: Ji(a.data),
2770
2845
  timestamp: a.timestamp,
2771
2846
  url: typeof window < "u" ? window.location.href : void 0,
2772
2847
  userAgent: typeof navigator < "u" ? navigator.userAgent : void 0,
@@ -2776,7 +2851,7 @@ async function Vc() {
2776
2851
  let o = [], s = 0;
2777
2852
  for (const a of i) {
2778
2853
  const c = JSON.stringify(a).length + 1;
2779
- s + c > qc && o.length > 0 && (await fetch(r, {
2854
+ s + c > Jc && o.length > 0 && (await fetch(r, {
2780
2855
  method: "POST",
2781
2856
  headers: { "Content-Type": "application/json" },
2782
2857
  body: JSON.stringify({ logs: o })
@@ -2791,11 +2866,11 @@ async function Vc() {
2791
2866
  console.warn("[wp] log flush failed (client logs may be lost):", te(t).error);
2792
2867
  }
2793
2868
  }
2794
- function yr(e) {
2869
+ function gr(e) {
2795
2870
  if (wt.push(e), !dn) {
2796
- const t = Gi() ? Lc : Oc;
2871
+ const t = Ki() ? Uc : Fc;
2797
2872
  dn = setTimeout(() => {
2798
- Vc();
2873
+ Xc();
2799
2874
  }, t);
2800
2875
  }
2801
2876
  }
@@ -2803,19 +2878,19 @@ function te(e) {
2803
2878
  return e instanceof Error ? { error: e.message, name: e.name } : { error: String(e), name: typeof e };
2804
2879
  }
2805
2880
  jt("__wpDebug", {
2806
- enable: Uc,
2807
- disable: jc,
2808
- history: Bc,
2809
- clear: Fc
2881
+ enable: Gc,
2882
+ disable: Kc,
2883
+ history: zc,
2884
+ clear: Wc
2810
2885
  });
2811
- function Ji(e) {
2886
+ function Xi(e) {
2812
2887
  return Bt(e) ? Ka[e] : "var(--color-neutral-bg)";
2813
2888
  }
2814
- function Xi(e) {
2815
- return Bt(e) ? `${Se().serverOrigin.replace(/\/$/, "")}${Ja(e)}` : void 0;
2889
+ function Qi(e) {
2890
+ return Bt(e) ? `${Se().serverOrigin.replace(/\/$/, "")}${uc(e)}` : void 0;
2816
2891
  }
2817
2892
  let Je = null, at = null;
2818
- function zc() {
2893
+ function Qc() {
2819
2894
  return Je ? Promise.resolve() : at || (at = (async () => {
2820
2895
  try {
2821
2896
  const e = Se().serverOrigin.replace(/\/$/, ""), t = await fetch(`${e}/media/sprites/names.json`, { cache: "no-cache" });
@@ -2834,80 +2909,11 @@ function Ee(e) {
2834
2909
  const t = e.toLowerCase();
2835
2910
  return Ae.some((n) => n === t) ? !0 : Je ? Object.values(Je).some((n) => n.toLowerCase() === t) : !1;
2836
2911
  }
2837
- function Wc(e, t, n) {
2838
- const r = !!e.name && !n(e.name) && (!t || n(t.name || "")), i = !!e.avatarId && (!t || t.avatarId !== e.avatarId);
2839
- if (!r && !i)
2840
- return null;
2841
- const o = {};
2842
- return r && (o.name = e.name), i && (o.avatarId = e.avatarId), o;
2843
- }
2844
- const Gc = [
2845
- "sage",
2846
- "herald",
2847
- "cleric",
2848
- "knight",
2849
- "mage",
2850
- "brawler",
2851
- "wanderer",
2852
- "rogue",
2853
- "gunner",
2854
- "chief",
2855
- "walker",
2856
- "operative",
2857
- "idol",
2858
- "recluse",
2859
- "phantom",
2860
- "harlequin",
2861
- "doll",
2862
- "imp",
2863
- "apprentice",
2864
- "prodigy",
2865
- "dreamer",
2866
- "sunny",
2867
- "mentor"
2868
- ];
2869
- function Qi(e, t, n = Gc, r = Math.random) {
2870
- const i = /* @__PURE__ */ new Set();
2871
- for (const s of e)
2872
- s && i.add(s);
2873
- const o = n.filter((s) => !i.has(s));
2874
- return o.length ? o[Math.floor(r() * o.length)] : void 0;
2875
- }
2876
- const Kc = {
2877
- /** client → server, with an ack. Payload: `RoomWatch`. */
2878
- watch: "room-feed:watch",
2879
- /** server → client. Payload: `RoomChanged`. */
2880
- changed: "room-feed:changed"
2881
- };
2882
- function Yc(e) {
2883
- if (typeof e != "object" || e === null || Array.isArray(e))
2884
- return null;
2885
- const t = e;
2886
- if ("room" in t) {
2887
- const { room: n, ...r } = t;
2888
- return Object.keys(r).length > 0 ? null : typeof n == "string" && n.length > 0 ? { room: n } : null;
2889
- }
2890
- if ("list" in t) {
2891
- const { list: n, ...r } = t;
2892
- return Object.keys(r).length > 0 ? null : n === !0 ? { list: !0 } : null;
2893
- }
2894
- return null;
2912
+ const Zc = 1280;
2913
+ function el(e) {
2914
+ return e.screenWidth < Zc ? !1 : e.noHoverNoPointer || e.anyHoverNone && e.maxTouchPoints === 0;
2895
2915
  }
2896
- const Jc = 20;
2897
- function Xc(e, t, n, r) {
2898
- const i = e ?? [], o = i.findIndex((a) => a.emoji === t);
2899
- if (r)
2900
- return o >= 0 ? i[o].by.includes(n) ? null : i.map((a, c) => c === o ? { emoji: t, by: [...a.by, n] } : a) : i.length >= Jc ? null : [...i, { emoji: t, by: [n] }];
2901
- if (o < 0 || !i[o].by.includes(n))
2902
- return null;
2903
- const s = i[o].by.filter((a) => a !== n);
2904
- return s.length ? i.map((a, c) => c === o ? { emoji: t, by: s } : a) : i.filter((a, c) => c !== o);
2905
- }
2906
- const Qc = 1280;
2907
- function Zc(e) {
2908
- return e.screenWidth < Qc ? !1 : e.noHoverNoPointer || e.anyHoverNone && e.maxTouchPoints === 0;
2909
- }
2910
- function el() {
2916
+ function tl() {
2911
2917
  const e = (t) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(t).matches;
2912
2918
  return {
2913
2919
  noHoverNoPointer: e("(hover: none) and (pointer: none)"),
@@ -2916,15 +2922,15 @@ function el() {
2916
2922
  screenWidth: typeof screen < "u" ? screen.width : 0
2917
2923
  };
2918
2924
  }
2919
- let hn = !1, vr = null;
2925
+ let hn = !1, yr = null;
2920
2926
  const fn = /* @__PURE__ */ new Set();
2921
- function tl() {
2922
- return vr ??= Zc(el()), vr;
2927
+ function nl() {
2928
+ return yr ??= el(tl()), yr;
2923
2929
  }
2924
2930
  function Ie() {
2925
- return hn || tl();
2931
+ return hn || nl();
2926
2932
  }
2927
- function nl(e) {
2933
+ function rl(e) {
2928
2934
  const t = e === !0;
2929
2935
  if (t === hn) return;
2930
2936
  const n = Ie();
@@ -2947,36 +2953,37 @@ const H = {
2947
2953
  function Ht() {
2948
2954
  return H.accountId ? H.accountId : H.resolved && H.userType === "public" ? "anon" : null;
2949
2955
  }
2950
- function rl(e) {
2956
+ function il(e) {
2951
2957
  H.resolved = !0, e.userType && (H.userType = e.userType), e.userId !== void 0 && (H.accountId = e.userId && e.userId !== "public" ? e.userId : null);
2952
2958
  }
2953
- function br() {
2959
+ function vr() {
2954
2960
  return H.userType;
2955
2961
  }
2956
- function il() {
2962
+ function ol() {
2957
2963
  return H.resolved && H.userType === "public";
2958
2964
  }
2959
- const wr = {
2965
+ const br = {
2960
2966
  public: 0,
2961
- member: 1,
2962
- friend: 2,
2963
- service: 3,
2964
- wife: 4,
2965
- admin: 5
2967
+ guest: 1,
2968
+ member: 2,
2969
+ friend: 3,
2970
+ service: 4,
2971
+ wife: 5,
2972
+ admin: 6
2966
2973
  };
2967
- function ol(e, t) {
2968
- return (wr[e] ?? -1) >= wr[t];
2974
+ function sl(e, t) {
2975
+ return (br[e] ?? -1) >= br[t];
2969
2976
  }
2970
2977
  function tf() {
2971
- return ol(H.userType, "service");
2978
+ return sl(H.userType, "service");
2972
2979
  }
2973
2980
  function qt() {
2974
2981
  return H.accountId ?? "public";
2975
2982
  }
2976
- function sl() {
2983
+ function al() {
2977
2984
  return Ht() ?? "unscoped";
2978
2985
  }
2979
- async function al() {
2986
+ async function cl() {
2980
2987
  if (H.name) return H.name;
2981
2988
  try {
2982
2989
  const e = await fetch("/session/whoami", {
@@ -2986,7 +2993,7 @@ async function al() {
2986
2993
  if (!e.ok || !(e.headers.get("content-type") ?? "").includes("json"))
2987
2994
  return m("auth", "whoami unavailable", { status: e.status }), null;
2988
2995
  const t = await e.json();
2989
- if (nl(t.tv), H.userType === "public") return null;
2996
+ if (rl(t.tv), H.userType === "public") return null;
2990
2997
  if (t.valid && (H.accountId = typeof t.userId == "string" && t.userId ? t.userId : null), t.valid && typeof t.name == "string")
2991
2998
  return H.name = t.name, t.name;
2992
2999
  } catch (e) {
@@ -2994,7 +3001,7 @@ async function al() {
2994
3001
  }
2995
3002
  return null;
2996
3003
  }
2997
- const cl = l.object({
3004
+ const ll = l.object({
2998
3005
  // Identity. There is deliberately NO `name`: a person's name is their
2999
3006
  // hadoku key-registry name, resolved by the server from whoami and renamed
3000
3007
  // through hadoku_site's POST /session/name (operator decision 2026-10-08).
@@ -3021,16 +3028,16 @@ const cl = l.object({
3021
3028
  subtitleStyle: l.string().optional()
3022
3029
  }), We = Ko({
3023
3030
  appId: "watchparty",
3024
- schema: cl
3025
- }), ll = /* @__PURE__ */ new Set(["theme", "themeMode"]);
3031
+ schema: ll
3032
+ }), ul = /* @__PURE__ */ new Set(["theme", "themeMode"]);
3026
3033
  function Pt(e) {
3027
3034
  const t = Ht();
3028
3035
  return t ? `prefs-cache:${t}:${e}` : null;
3029
3036
  }
3030
- function ul() {
3037
+ function dl() {
3031
3038
  return Ht() === null;
3032
3039
  }
3033
- function _r(e) {
3040
+ function wr(e) {
3034
3041
  const t = Pt(e);
3035
3042
  if (!t) return {};
3036
3043
  const n = ie(t);
@@ -3041,9 +3048,9 @@ function _r(e) {
3041
3048
  return {};
3042
3049
  }
3043
3050
  }
3044
- function dl() {
3051
+ function hl() {
3045
3052
  let e = 0;
3046
- for (const t of Cc()) {
3053
+ for (const t of Nc()) {
3047
3054
  const n = t.startsWith("prefs-cache:") && t.endsWith(":watchparty"), r = t === Ot || t.startsWith(`${Ot}:`) && !t.endsWith(":_serverSynced_v1");
3048
3055
  if (!n && !r) continue;
3049
3056
  const i = ie(t);
@@ -3057,17 +3064,17 @@ function dl() {
3057
3064
  const s = n ? o?.blob : o;
3058
3065
  if (!s || typeof s != "object" || !("name" in s)) continue;
3059
3066
  const { name: a, ...c } = s, u = n ? { ...o, blob: c } : c;
3060
- Nn(t, JSON.stringify(u)) && e++;
3067
+ Mn(t, JSON.stringify(u)) && e++;
3061
3068
  }
3062
3069
  return e > 0 && m("preferences", "Stripped retired name from cached prefs rows", { rewritten: e }), e;
3063
3070
  }
3064
3071
  let to = null, no = null;
3065
- const Er = /* @__PURE__ */ new Set();
3066
- function $n() {
3067
- if (ul())
3072
+ const _r = /* @__PURE__ */ new Set();
3073
+ function Dn() {
3074
+ if (dl())
3068
3075
  return m("preferences", "Boot read deferred — session pending, identity unresolved"), {};
3069
- const e = _r("portfolio"), t = _r("watchparty"), n = Object.keys(e).length > 0 ? e : to ?? {}, r = Object.keys(t).length > 0 ? t : no ?? {}, i = qt() || "public";
3070
- if (Er.has(i))
3076
+ const e = wr("portfolio"), t = wr("watchparty"), n = Object.keys(e).length > 0 ? e : to ?? {}, r = Object.keys(t).length > 0 ? t : no ?? {}, i = qt() || "public";
3077
+ if (_r.has(i))
3071
3078
  return m("preferences", "Loaded (sync, SDK-only after first read)", {
3072
3079
  uid: i,
3073
3080
  sdkThemeKeys: Object.keys(n).length,
@@ -3077,7 +3084,7 @@ function $n() {
3077
3084
  themeSource: Object.keys(e).length > 0 ? "cache" : "mem",
3078
3085
  appSource: Object.keys(t).length > 0 ? "cache" : "mem"
3079
3086
  }), { ...r, ...n };
3080
- Er.add(i);
3087
+ _r.add(i);
3081
3088
  const o = io() ?? {}, s = { ...o, ...r, ...n };
3082
3089
  return m("preferences", "Loaded (sync, first read — legacy + SDK)", {
3083
3090
  uid: i,
@@ -3089,22 +3096,22 @@ function $n() {
3089
3096
  }), s;
3090
3097
  }
3091
3098
  let ro = !1;
3092
- function hl() {
3099
+ function fl() {
3093
3100
  const e = qt();
3094
3101
  return !e || e === "public";
3095
3102
  }
3096
3103
  function le(e, t) {
3097
- hl() && (ro = !0), ll.has(e) ? He.save({ [e]: t }, { scope: "device" }).catch((n) => L("preferences", "themePrefs.save failed", { key: e, err: n?.message })) : We.save({ [e]: t }).catch((n) => L("preferences", "watchpartyPrefs.save failed", { key: e, err: n?.message })), m("preferences", "Saved (via SDK)", { key: e, value: t });
3104
+ fl() && (ro = !0), ul.has(e) ? He.save({ [e]: t }, { scope: "device" }).catch((n) => L("preferences", "themePrefs.save failed", { key: e, err: n?.message })) : We.save({ [e]: t }).catch((n) => L("preferences", "watchpartyPrefs.save failed", { key: e, err: n?.message })), m("preferences", "Saved (via SDK)", { key: e, value: t });
3098
3105
  }
3099
- let ct = null, Sr = !1;
3100
- function fl() {
3106
+ let ct = null, Er = !1;
3107
+ function pl() {
3101
3108
  return ct || (ct = (async () => {
3102
3109
  if (typeof window > "u") return !1;
3103
3110
  try {
3104
- Sr || (Sr = !0, He.subscribe((s) => {
3105
- to = s, Rr("portfolio", s), xr("theme");
3111
+ Er || (Er = !0, He.subscribe((s) => {
3112
+ to = s, kr("portfolio", s), Rr("theme");
3106
3113
  }), We.subscribe((s) => {
3107
- no = s, Rr("watchparty", s), xr("watchparty");
3114
+ no = s, kr("watchparty", s), Rr("watchparty");
3108
3115
  }));
3109
3116
  const [e, t] = await Promise.all([
3110
3117
  He.read(),
@@ -3123,7 +3130,7 @@ function fl() {
3123
3130
  // Post-fetch cache state: should be non-zero if SDK wrote it.
3124
3131
  sdkThemeBytesPost: i?.length ?? 0,
3125
3132
  sdkAppBytesPost: o?.length ?? 0
3126
- }), await pl(e, t), ro ? (m("preferences", "Promoting this load's pre-auth picks to the signed-in user"), await Promise.all([
3133
+ }), await ml(e, t), ro ? (m("preferences", "Promoting this load's pre-auth picks to the signed-in user"), await Promise.all([
3127
3134
  He.promoteAnonPrefsToUser().catch(() => {
3128
3135
  }),
3129
3136
  We.promoteAnonPrefsToUser().catch(() => {
@@ -3135,7 +3142,7 @@ function fl() {
3135
3142
  })(), ct);
3136
3143
  }
3137
3144
  const Ot = "watchparty_preferences";
3138
- dl();
3145
+ hl();
3139
3146
  function pn() {
3140
3147
  const e = qt();
3141
3148
  return !e || e === "public" ? Ot : `${Ot}:${e}`;
@@ -3150,10 +3157,10 @@ function io() {
3150
3157
  return null;
3151
3158
  }
3152
3159
  }
3153
- function Tr() {
3160
+ function Sr() {
3154
3161
  It(pn()), It(`${pn()}:_serverSynced_v1`);
3155
3162
  }
3156
- async function pl(e, t) {
3163
+ async function ml(e, t) {
3157
3164
  const n = io();
3158
3165
  if (!n || Object.keys(n).length === 0) return;
3159
3166
  const r = Object.keys(e ?? {}).length > 0, i = Object.keys(t ?? {}).length > 0, o = {}, s = {};
@@ -3161,7 +3168,7 @@ async function pl(e, t) {
3161
3168
  r || (u === "theme" && typeof d == "string" ? o.theme = d : u === "themeMode" && (d === "simple" || d === "advanced") && (o.themeMode = d)), i || (u === "chatCollapsed" && typeof d == "boolean" ? s.chatCollapsed = d : u === "floatingChatEnabled" && typeof d == "boolean" ? s.floatingChatEnabled = d : u === "volume" && typeof d == "number" && d >= 0 && d <= 1 ? s.volume = d : u === "muted" && typeof d == "boolean" ? s.muted = d : u === "preferredAudioLang" && typeof d == "string" ? s.preferredAudioLang = d : u === "subtitlesEnabled" && typeof d == "boolean" ? s.subtitlesEnabled = d : u === "subtitleStyle" && typeof d == "string" && (s.subtitleStyle = d));
3162
3169
  const a = Object.keys(o), c = Object.keys(s);
3163
3170
  if (a.length === 0 && c.length === 0) {
3164
- Tr();
3171
+ Sr();
3165
3172
  return;
3166
3173
  }
3167
3174
  m("preferences", "Migrating legacy localStorage prefs to SDK", {
@@ -3174,15 +3181,15 @@ async function pl(e, t) {
3174
3181
  await Promise.all([
3175
3182
  a.length > 0 ? He.save(o, { scope: "device" }) : Promise.resolve(),
3176
3183
  c.length > 0 ? We.save(s) : Promise.resolve()
3177
- ]), Tr(), m("preferences", "Legacy migration complete");
3184
+ ]), Sr(), m("preferences", "Legacy migration complete");
3178
3185
  } catch (u) {
3179
3186
  L("preferences", "Legacy migration save failed — will retry next load", {
3180
3187
  err: u?.message
3181
3188
  });
3182
3189
  }
3183
3190
  }
3184
- let kr = !1;
3185
- function Rr(e, t) {
3191
+ let Tr = !1;
3192
+ function kr(e, t) {
3186
3193
  const n = Pt(e);
3187
3194
  if (n)
3188
3195
  try {
@@ -3194,14 +3201,14 @@ function Rr(e, t) {
3194
3201
  };
3195
3202
  localStorage.setItem(n, JSON.stringify(r));
3196
3203
  } catch (r) {
3197
- kr || (kr = !0, L("preferences", "writeThrough localStorage failed (in-memory backstop only)", {
3204
+ Tr || (Tr = !0, L("preferences", "writeThrough localStorage failed (in-memory backstop only)", {
3198
3205
  appId: e,
3199
3206
  err: r?.message,
3200
3207
  name: r?.name
3201
3208
  }));
3202
3209
  }
3203
3210
  }
3204
- function xr(e) {
3211
+ function Rr(e) {
3205
3212
  Promise.resolve().then(() => co).then(({ useAppStore: t }) => {
3206
3213
  try {
3207
3214
  t.getState().rehydrateFromPrefs();
@@ -3210,17 +3217,17 @@ function xr(e) {
3210
3217
  }
3211
3218
  }).catch((t) => L("preferences", "store import failed", { reason: e, err: t?.message }));
3212
3219
  }
3213
- const oo = 320, Cr = 240, ml = 640;
3220
+ const oo = 320, xr = 240, gl = 640;
3214
3221
  function en(e, t) {
3215
3222
  if (!Number.isFinite(e)) return oo;
3216
- let n = ml;
3217
- return n = Math.max(n, Cr), Math.round(Math.min(n, Math.max(Cr, e)));
3223
+ let n = gl;
3224
+ return n = Math.max(n, xr), Math.round(Math.min(n, Math.max(xr, e)));
3218
3225
  }
3219
3226
  function so(e, t) {
3220
3227
  const n = new Set(t.map((o) => o.id)), r = t.reduce((o, s) => Math.max(o, s.ts), -1 / 0), i = e.filter((o) => !n.has(o.id) && o.ts > r);
3221
3228
  return i.length ? [...t, ...i] : t;
3222
3229
  }
3223
- const ao = 6e3, ue = $n(), T = Oa((e, t) => ({
3230
+ const ao = 6e3, ue = Dn(), T = Oa((e, t) => ({
3224
3231
  ready: !1,
3225
3232
  name: "",
3226
3233
  sprite: null,
@@ -3280,7 +3287,7 @@ const ao = 6e3, ue = $n(), T = Oa((e, t) => ({
3280
3287
  const o = Xe(n.sprite);
3281
3288
  return m("store", "Auto-identity: deriving name from the requested sprite", { name: o, sprite: n.sprite }), { name: o };
3282
3289
  }
3283
- const r = Object.values(n.roster).map((o) => o.sprite), i = Qi(r, void 0, Ae);
3290
+ const r = Object.values(n.roster).map((o) => o.sprite), i = Ni(r, void 0, Ae);
3284
3291
  if (i) {
3285
3292
  const o = Xe(i);
3286
3293
  return m("store", "Auto-identity assigned", { name: o, sprite: i }), { name: o, sprite: i };
@@ -3456,7 +3463,7 @@ const ao = 6e3, ue = $n(), T = Oa((e, t) => ({
3456
3463
  setGameSettings: (n) => e({ gameSettings: n }),
3457
3464
  setRoomKeyType: (n) => e({ roomKeyType: n }),
3458
3465
  rehydrateFromPrefs: () => e((n) => {
3459
- const r = $n(), i = {};
3466
+ const r = Dn(), i = {};
3460
3467
  if (r.chatCollapsed !== void 0 && !Ie() && (i.chatCollapsed = r.chatCollapsed), r.chromeChatCollapsed !== void 0 && (i.chromeChatCollapsed = r.chromeChatCollapsed), r.chromeChatWidth !== void 0 && (i.chromeChatWidth = en(r.chromeChatWidth)), ["volume", "muted", "preferredAudioLang", "subtitlesEnabled", "subtitleStyle"].some((a) => r[a] !== void 0)) {
3461
3468
  const a = { ...n.mediaPrefs };
3462
3469
  r.volume !== void 0 && (a.volume = r.volume), r.muted !== void 0 && (a.muted = r.muted), r.preferredAudioLang !== void 0 && (a.preferredAudioLang = r.preferredAudioLang), r.subtitlesEnabled !== void 0 && (a.subtitlesEnabled = r.subtitlesEnabled), r.subtitleStyle !== void 0 && ["classic", "cinema", "minimal", "contrast"].includes(r.subtitleStyle) && (a.subtitleStyle = r.subtitleStyle), i.mediaPrefs = a;
@@ -3472,7 +3479,7 @@ const co = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3472
3479
  mergeHistory: so,
3473
3480
  useAppStore: T
3474
3481
  }, Symbol.toStringTag, { value: "Module" }));
3475
- function gl({ className: e = "fixed bottom-4 left-1/2 -translate-x-1/2" }) {
3482
+ function yl({ className: e = "fixed bottom-4 left-1/2 -translate-x-1/2" }) {
3476
3483
  const t = T((r) => r.toasts), n = T((r) => r.popToast);
3477
3484
  return he(() => {
3478
3485
  const r = t.map((i) => setTimeout(() => n(i.id), 4e3));
@@ -3481,14 +3488,14 @@ function gl({ className: e = "fixed bottom-4 left-1/2 -translate-x-1/2" }) {
3481
3488
  };
3482
3489
  }, [t, n]), /* @__PURE__ */ S("div", { className: `${e} flex flex-col gap-2 z-50`, children: t.map((r) => /* @__PURE__ */ S("div", { className: `px-3 py-2 rounded text-sm shadow font-medium border ${r.kind === "error" ? "bg-danger-bg text-on-danger-bg border-danger" : "bg-bg-card border-border-light text-text"}`, children: r.msg }, r.id)) });
3483
3490
  }
3484
- function yl() {
3491
+ function vl() {
3485
3492
  try {
3486
3493
  return typeof document > "u" ? !0 : !document.hidden;
3487
3494
  } catch {
3488
3495
  return !0;
3489
3496
  }
3490
3497
  }
3491
- function vl(e) {
3498
+ function bl(e) {
3492
3499
  if (typeof document > "u" || typeof document.addEventListener != "function")
3493
3500
  return () => {
3494
3501
  };
@@ -3497,9 +3504,9 @@ function vl(e) {
3497
3504
  };
3498
3505
  return document.addEventListener("visibilitychange", t), () => document.removeEventListener("visibilitychange", t);
3499
3506
  }
3500
- const bl = 3e4;
3501
- function wl(e, t) {
3502
- const n = t.isVisible ?? yl, r = t.setInterval ?? ((E, w) => setInterval(E, w)), i = t.clearInterval ?? ((E) => clearInterval(E));
3507
+ const wl = 3e4;
3508
+ function _l(e, t) {
3509
+ const n = t.isVisible ?? vl, r = t.setInterval ?? ((E, w) => setInterval(E, w)), i = t.clearInterval ?? ((E) => clearInterval(E));
3503
3510
  let o = { list: null, loading: !0, error: null };
3504
3511
  const s = /* @__PURE__ */ new Set();
3505
3512
  let a = null, c = !1;
@@ -3524,9 +3531,9 @@ function wl(e, t) {
3524
3531
  d();
3525
3532
  const h = t.pings.subscribe(e, () => {
3526
3533
  n() && d();
3527
- }), v = (t.onVisible ?? vl)(() => d()), b = r(() => {
3534
+ }), v = (t.onVisible ?? bl)(() => d()), b = r(() => {
3528
3535
  n() && d();
3529
- }, t.fallbackMs ?? bl);
3536
+ }, t.fallbackMs ?? wl);
3530
3537
  return {
3531
3538
  getState() {
3532
3539
  return o;
@@ -3540,21 +3547,21 @@ function wl(e, t) {
3540
3547
  }
3541
3548
  };
3542
3549
  }
3543
- function _l(e) {
3550
+ function El(e) {
3544
3551
  return "list";
3545
3552
  }
3546
- const El = { list: null, loading: !0, error: null };
3547
- function Sl() {
3553
+ const Sl = { list: null, loading: !0, error: null };
3554
+ function Tl() {
3548
3555
  return () => {
3549
3556
  };
3550
3557
  }
3551
- function Tl(e, t) {
3552
- const n = _l(), r = we(t);
3558
+ function kl(e, t) {
3559
+ const n = El(), r = we(t);
3553
3560
  r.current = t;
3554
3561
  const i = we(null);
3555
3562
  (i.current === null || i.current.key !== n) && (i.current?.client.close(), i.current = {
3556
3563
  key: n,
3557
- client: wl(e, {
3564
+ client: _l(e, {
3558
3565
  pings: r.current.pings,
3559
3566
  fetchList: (c) => r.current.fetchList(c),
3560
3567
  fallbackMs: r.current.fallbackMs,
@@ -3569,9 +3576,9 @@ function Tl(e, t) {
3569
3576
  s.current = setTimeout(() => {
3570
3577
  s.current = null, i.current?.client === o && o.close();
3571
3578
  }, 0);
3572
- }), [o]), { ...Mt(o ? o.subscribe : Sl, () => o ? o.getState() : El), refresh: () => o.refresh() };
3579
+ }), [o]), { ...Mt(o ? o.subscribe : Tl, () => o ? o.getState() : Sl), refresh: () => o.refresh() };
3573
3580
  }
3574
- const kl = 400;
3581
+ const Rl = 400;
3575
3582
  function lo() {
3576
3583
  const e = we(null), t = we([]);
3577
3584
  return he(() => {
@@ -3604,9 +3611,9 @@ function lo() {
3604
3611
  const $ = N;
3605
3612
  let O;
3606
3613
  R ? O = 0.92 + Math.random() * 0.08 : N ? O = 0.85 + Math.random() * 0.15 : O = 0.05 + Math.random() ** 2.2 * 0.75;
3607
- const D = (or, Bo) => {
3614
+ const D = (ir, Bo) => {
3608
3615
  const Fo = Math.random(), Uo = Math.random();
3609
- return or + (Fo + Uo) / 2 * (Bo - or);
3616
+ return ir + (Fo + Uo) / 2 * (Bo - ir);
3610
3617
  };
3611
3618
  let G = D(0.9, 1.4) + O ** 1.2 * (R ? 5.5 : N ? 4 : 3.2);
3612
3619
  const K = D(0.85, 1.25);
@@ -3619,16 +3626,16 @@ function lo() {
3619
3626
  y && M.scale < 1 && (ce *= M.scale);
3620
3627
  const Gt = Math.min(1, U), Te = Math.min(1, (F - 1) / 4.5);
3621
3628
  ce *= 1 + 0.18 * Math.max(Gt, Te), R && ce < 1.25 && (ce = 1.25 + Math.random() * 0.4);
3622
- const Lo = n.width, Qn = n.height, Zn = 0.18 + Math.random() * 0.28, Mo = R || Math.random() < 0.18, Ne = R ? 0.55 : $ ? 0.38 : Math.max(0.1, 0.28 - Zn * 0.25), er = U * (Ne + Math.random() * (1 - Ne)), No = U * (Ne + Math.random() * (1 - Ne)), Do = (R ? 130 : $ ? 160 : 120) + Math.random() * (R ? 140 : 150), tr = Math.min(1, ce / 2.5), Kt = 10, nr = 120 - Kt;
3629
+ const Lo = n.width, Xn = n.height, Qn = 0.18 + Math.random() * 0.28, Mo = R || Math.random() < 0.18, Ne = R ? 0.55 : $ ? 0.38 : Math.max(0.1, 0.28 - Qn * 0.25), Zn = U * (Ne + Math.random() * (1 - Ne)), No = U * (Ne + Math.random() * (1 - Ne)), Do = (R ? 130 : $ ? 160 : 120) + Math.random() * (R ? 140 : 150), er = Math.min(1, ce / 2.5), Kt = 10, tr = 120 - Kt;
3623
3630
  let De = Math.random();
3624
- const $o = 0.8 + tr * 1.4;
3631
+ const $o = 0.8 + er * 1.4;
3625
3632
  De = Math.pow(De, $o);
3626
- const rr = (1 - tr) * ((40 - Kt) / nr);
3627
- De = De * (1 - rr) + rr;
3628
- const ir = (Kt + De * nr) * 1e3;
3633
+ const nr = (1 - er) * ((40 - Kt) / tr);
3634
+ De = De * (1 - nr) + nr;
3635
+ const rr = (Kt + De * tr) * 1e3;
3629
3636
  return {
3630
3637
  x: f ?? Math.random() * Lo,
3631
- y: _ ?? (y ? Math.random() * Qn : -Math.random() * Qn),
3638
+ y: _ ?? (y ? Math.random() * Xn : -Math.random() * Xn),
3632
3639
  z: O,
3633
3640
  speed: ce,
3634
3641
  size: F,
@@ -3637,10 +3644,10 @@ function lo() {
3637
3644
  colorPhase: Math.random() * Math.PI * 2,
3638
3645
  colorSpeed: 0.01 + Math.random() * 0.02,
3639
3646
  colorMode: Math.random() < 0.5 ? 0 : 1,
3640
- twinkleAmount: Zn,
3647
+ twinkleAmount: Qn,
3641
3648
  twinkleEnabled: Mo,
3642
3649
  dimFloor: Ne,
3643
- twinkleStart: er,
3650
+ twinkleStart: Zn,
3644
3651
  twinkleTarget: No,
3645
3652
  twinkleT: 0,
3646
3653
  twinkleDuration: Do,
@@ -3648,13 +3655,13 @@ function lo() {
3648
3655
  microSpeed: (R ? 0.18 : 0.1) + Math.random() * 0.05,
3649
3656
  ultraRare: R,
3650
3657
  trail: R ? [] : void 0,
3651
- currentAlpha: er,
3652
- lifeMsRemaining: ir,
3653
- lifeMsTotal: ir
3658
+ currentAlpha: Zn,
3659
+ lifeMsRemaining: rr,
3660
+ lifeMsTotal: rr
3654
3661
  };
3655
3662
  }
3656
3663
  if (!t.current.length)
3657
- for (let f = 0; f < kl; f++) t.current.push(c(void 0, void 0, !0, f));
3664
+ for (let f = 0; f < Rl; f++) t.current.push(c(void 0, void 0, !0, f));
3658
3665
  let u, d = performance.now();
3659
3666
  const h = 50;
3660
3667
  function v(f, _, y, k) {
@@ -3784,37 +3791,37 @@ const _t = /* @__PURE__ */ Object.create(null);
3784
3791
  Object.keys(se).forEach((e) => {
3785
3792
  _t[se[e]] = e;
3786
3793
  });
3787
- const mn = { type: "error", data: "parser error" }, uo = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", ho = typeof ArrayBuffer == "function", fo = (e) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(e) : e && e.buffer instanceof ArrayBuffer, Bn = ({ type: e, data: t }, n, r) => uo && t instanceof Blob ? n ? r(t) : Ar(t, r) : ho && (t instanceof ArrayBuffer || fo(t)) ? n ? r(t) : Ar(new Blob([t]), r) : r(se[e] + (t || "")), Ar = (e, t) => {
3794
+ const mn = { type: "error", data: "parser error" }, uo = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", ho = typeof ArrayBuffer == "function", fo = (e) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(e) : e && e.buffer instanceof ArrayBuffer, $n = ({ type: e, data: t }, n, r) => uo && t instanceof Blob ? n ? r(t) : Cr(t, r) : ho && (t instanceof ArrayBuffer || fo(t)) ? n ? r(t) : Cr(new Blob([t]), r) : r(se[e] + (t || "")), Cr = (e, t) => {
3788
3795
  const n = new FileReader();
3789
3796
  return n.onload = function() {
3790
3797
  const r = n.result.split(",")[1];
3791
3798
  t("b" + (r || ""));
3792
3799
  }, n.readAsDataURL(e);
3793
3800
  };
3794
- function Ir(e) {
3801
+ function Ar(e) {
3795
3802
  return e instanceof Uint8Array ? e : e instanceof ArrayBuffer ? new Uint8Array(e) : new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
3796
3803
  }
3797
3804
  let tn;
3798
- function Rl(e, t) {
3805
+ function xl(e, t) {
3799
3806
  if (uo && e.data instanceof Blob)
3800
- return e.data.arrayBuffer().then(Ir).then(t);
3807
+ return e.data.arrayBuffer().then(Ar).then(t);
3801
3808
  if (ho && (e.data instanceof ArrayBuffer || fo(e.data)))
3802
- return t(Ir(e.data));
3803
- Bn(e, !1, (n) => {
3809
+ return t(Ar(e.data));
3810
+ $n(e, !1, (n) => {
3804
3811
  tn || (tn = new TextEncoder()), t(tn.encode(n));
3805
3812
  });
3806
3813
  }
3807
- const Pr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Ue = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
3808
- for (let e = 0; e < Pr.length; e++)
3809
- Ue[Pr.charCodeAt(e)] = e;
3810
- const xl = (e) => {
3814
+ const Ir = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Ue = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
3815
+ for (let e = 0; e < Ir.length; e++)
3816
+ Ue[Ir.charCodeAt(e)] = e;
3817
+ const Cl = (e) => {
3811
3818
  let t = e.length * 0.75, n = e.length, r, i = 0, o, s, a, c;
3812
3819
  e[e.length - 1] === "=" && (t--, e[e.length - 2] === "=" && t--);
3813
3820
  const u = new ArrayBuffer(t), d = new Uint8Array(u);
3814
3821
  for (r = 0; r < n; r += 4)
3815
3822
  o = Ue[e.charCodeAt(r)], s = Ue[e.charCodeAt(r + 1)], a = Ue[e.charCodeAt(r + 2)], c = Ue[e.charCodeAt(r + 3)], d[i++] = o << 2 | s >> 4, d[i++] = (s & 15) << 4 | a >> 2, d[i++] = (a & 3) << 6 | c & 63;
3816
3823
  return u;
3817
- }, Cl = typeof ArrayBuffer == "function", Fn = (e, t) => {
3824
+ }, Al = typeof ArrayBuffer == "function", Bn = (e, t) => {
3818
3825
  if (typeof e != "string")
3819
3826
  return {
3820
3827
  type: "message",
@@ -3823,40 +3830,40 @@ const xl = (e) => {
3823
3830
  const n = e.charAt(0);
3824
3831
  return n === "b" ? {
3825
3832
  type: "message",
3826
- data: Al(e.substring(1), t)
3833
+ data: Il(e.substring(1), t)
3827
3834
  } : _t[n] ? e.length > 1 ? {
3828
3835
  type: _t[n],
3829
3836
  data: e.substring(1)
3830
3837
  } : {
3831
3838
  type: _t[n]
3832
3839
  } : mn;
3833
- }, Al = (e, t) => {
3834
- if (Cl) {
3835
- const n = xl(e);
3840
+ }, Il = (e, t) => {
3841
+ if (Al) {
3842
+ const n = Cl(e);
3836
3843
  return po(n, t);
3837
3844
  } else
3838
3845
  return { base64: !0, data: e };
3839
- }, po = (e, t) => t === "blob" ? e instanceof Blob ? e : new Blob([e]) : e instanceof ArrayBuffer ? e : e.buffer, mo = "", Il = (e, t) => {
3846
+ }, po = (e, t) => t === "blob" ? e instanceof Blob ? e : new Blob([e]) : e instanceof ArrayBuffer ? e : e.buffer, mo = "", Pl = (e, t) => {
3840
3847
  const n = e.length, r = new Array(n);
3841
3848
  let i = 0;
3842
3849
  e.forEach((o, s) => {
3843
- Bn(o, !1, (a) => {
3850
+ $n(o, !1, (a) => {
3844
3851
  r[s] = a, ++i === n && t(r.join(mo));
3845
3852
  });
3846
3853
  });
3847
- }, Pl = (e, t) => {
3854
+ }, Ol = (e, t) => {
3848
3855
  const n = e.split(mo), r = [];
3849
3856
  for (let i = 0; i < n.length; i++) {
3850
- const o = Fn(n[i], t);
3857
+ const o = Bn(n[i], t);
3851
3858
  if (r.push(o), o.type === "error")
3852
3859
  break;
3853
3860
  }
3854
3861
  return r;
3855
3862
  };
3856
- function Ol() {
3863
+ function Ll() {
3857
3864
  return new TransformStream({
3858
3865
  transform(e, t) {
3859
- Rl(e, (n) => {
3866
+ xl(e, (n) => {
3860
3867
  const r = n.length;
3861
3868
  let i;
3862
3869
  if (r < 126)
@@ -3888,7 +3895,7 @@ function ut(e, t) {
3888
3895
  n[i] = e[0][r++], r === e[0].length && (e.shift(), r = 0);
3889
3896
  return e.length && r < e[0].length && (e[0] = e[0].slice(r)), n;
3890
3897
  }
3891
- function Ll(e, t) {
3898
+ function Ml(e, t) {
3892
3899
  nn || (nn = new TextDecoder());
3893
3900
  const n = [];
3894
3901
  let r = 0, i = -1, o = !1;
@@ -3918,7 +3925,7 @@ function Ll(e, t) {
3918
3925
  if (lt(n) < i)
3919
3926
  break;
3920
3927
  const c = ut(n, i);
3921
- a.enqueue(Fn(o ? c : nn.decode(c), t)), r = 0;
3928
+ a.enqueue(Bn(o ? c : nn.decode(c), t)), r = 0;
3922
3929
  }
3923
3930
  if (i === 0 || i > e) {
3924
3931
  a.enqueue(mn);
@@ -3930,9 +3937,9 @@ function Ll(e, t) {
3930
3937
  }
3931
3938
  const go = 4;
3932
3939
  function j(e) {
3933
- if (e) return Ml(e);
3940
+ if (e) return Nl(e);
3934
3941
  }
3935
- function Ml(e) {
3942
+ function Nl(e) {
3936
3943
  for (var t in j.prototype)
3937
3944
  e[t] = j.prototype[t];
3938
3945
  return e;
@@ -3978,19 +3985,19 @@ j.prototype.listeners = function(e) {
3978
3985
  j.prototype.hasListeners = function(e) {
3979
3986
  return !!this.listeners(e).length;
3980
3987
  };
3981
- const Vt = typeof Promise == "function" && typeof Promise.resolve == "function" ? (t) => Promise.resolve().then(t) : (t, n) => n(t, 0), X = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), Nl = "arraybuffer";
3988
+ const Vt = typeof Promise == "function" && typeof Promise.resolve == "function" ? (t) => Promise.resolve().then(t) : (t, n) => n(t, 0), X = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), Dl = "arraybuffer";
3982
3989
  function yo(e, ...t) {
3983
3990
  return t.reduce((n, r) => (e.hasOwnProperty(r) && (n[r] = e[r]), n), {});
3984
3991
  }
3985
- const Dl = X.setTimeout, $l = X.clearTimeout;
3992
+ const $l = X.setTimeout, Bl = X.clearTimeout;
3986
3993
  function zt(e, t) {
3987
- t.useNativeTimers ? (e.setTimeoutFn = Dl.bind(X), e.clearTimeoutFn = $l.bind(X)) : (e.setTimeoutFn = X.setTimeout.bind(X), e.clearTimeoutFn = X.clearTimeout.bind(X));
3988
- }
3989
- const Bl = 1.33;
3990
- function Fl(e) {
3991
- return typeof e == "string" ? Ul(e) : Math.ceil((e.byteLength || e.size) * Bl);
3994
+ t.useNativeTimers ? (e.setTimeoutFn = $l.bind(X), e.clearTimeoutFn = Bl.bind(X)) : (e.setTimeoutFn = X.setTimeout.bind(X), e.clearTimeoutFn = X.clearTimeout.bind(X));
3992
3995
  }
3996
+ const Fl = 1.33;
3993
3997
  function Ul(e) {
3998
+ return typeof e == "string" ? jl(e) : Math.ceil((e.byteLength || e.size) * Fl);
3999
+ }
4000
+ function jl(e) {
3994
4001
  let t = 0, n = 0;
3995
4002
  for (let r = 0, i = e.length; r < i; r++)
3996
4003
  t = e.charCodeAt(r), t < 128 ? n += 1 : t < 2048 ? n += 2 : t < 55296 || t >= 57344 ? n += 3 : (r++, n += 4);
@@ -3999,13 +4006,13 @@ function Ul(e) {
3999
4006
  function vo() {
4000
4007
  return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
4001
4008
  }
4002
- function jl(e) {
4009
+ function Hl(e) {
4003
4010
  let t = "";
4004
4011
  for (let n in e)
4005
4012
  e.hasOwnProperty(n) && (t.length && (t += "&"), t += encodeURIComponent(n) + "=" + encodeURIComponent(e[n]));
4006
4013
  return t;
4007
4014
  }
4008
- function Hl(e) {
4015
+ function ql(e) {
4009
4016
  let t = {}, n = e.split("&");
4010
4017
  for (let r = 0, i = n.length; r < i; r++) {
4011
4018
  let o = n[r].split("=");
@@ -4013,12 +4020,12 @@ function Hl(e) {
4013
4020
  }
4014
4021
  return t;
4015
4022
  }
4016
- class ql extends Error {
4023
+ class Vl extends Error {
4017
4024
  constructor(t, n, r) {
4018
4025
  super(t), this.description = n, this.context = r, this.type = "TransportError";
4019
4026
  }
4020
4027
  }
4021
- class Un extends j {
4028
+ class Fn extends j {
4022
4029
  /**
4023
4030
  * Transport abstract constructor.
4024
4031
  *
@@ -4038,7 +4045,7 @@ class Un extends j {
4038
4045
  * @protected
4039
4046
  */
4040
4047
  onError(t, n, r) {
4041
- return super.emitReserved("error", new ql(t, n, r)), this;
4048
+ return super.emitReserved("error", new Vl(t, n, r)), this;
4042
4049
  }
4043
4050
  /**
4044
4051
  * Opens the transport.
@@ -4075,7 +4082,7 @@ class Un extends j {
4075
4082
  * @protected
4076
4083
  */
4077
4084
  onData(t) {
4078
- const n = Fn(t, this.socket.binaryType);
4085
+ const n = Bn(t, this.socket.binaryType);
4079
4086
  this.onPacket(n);
4080
4087
  }
4081
4088
  /**
@@ -4112,11 +4119,11 @@ class Un extends j {
4112
4119
  return this.opts.port && (this.opts.secure && +(this.opts.port !== 443) || !this.opts.secure && Number(this.opts.port) !== 80) ? ":" + this.opts.port : "";
4113
4120
  }
4114
4121
  _query(t) {
4115
- const n = jl(t);
4122
+ const n = Hl(t);
4116
4123
  return n.length ? "?" + n : "";
4117
4124
  }
4118
4125
  }
4119
- class Vl extends Un {
4126
+ class zl extends Fn {
4120
4127
  constructor() {
4121
4128
  super(...arguments), this._polling = !1;
4122
4129
  }
@@ -4172,7 +4179,7 @@ class Vl extends Un {
4172
4179
  return this.onClose({ description: "transport closed by the server" }), !1;
4173
4180
  this.onPacket(r);
4174
4181
  };
4175
- Pl(t, this.socket.binaryType).forEach(n), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
4182
+ Ol(t, this.socket.binaryType).forEach(n), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
4176
4183
  }
4177
4184
  /**
4178
4185
  * For polling, send a close packet.
@@ -4192,7 +4199,7 @@ class Vl extends Un {
4192
4199
  * @protected
4193
4200
  */
4194
4201
  write(t) {
4195
- this.writable = !1, Il(t, (n) => {
4202
+ this.writable = !1, Pl(t, (n) => {
4196
4203
  this.doWrite(n, () => {
4197
4204
  this.writable = !0, this.emitReserved("drain");
4198
4205
  });
@@ -4213,10 +4220,10 @@ try {
4213
4220
  bo = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
4214
4221
  } catch {
4215
4222
  }
4216
- const zl = bo;
4217
- function Wl() {
4223
+ const Wl = bo;
4224
+ function Gl() {
4218
4225
  }
4219
- class Gl extends Vl {
4226
+ class Kl extends zl {
4220
4227
  /**
4221
4228
  * XHR Polling constructor.
4222
4229
  *
@@ -4329,7 +4336,7 @@ class oe extends j {
4329
4336
  */
4330
4337
  _cleanup(t) {
4331
4338
  if (!(typeof this._xhr > "u" || this._xhr === null)) {
4332
- if (this._xhr.onreadystatechange = Wl, t)
4339
+ if (this._xhr.onreadystatechange = Gl, t)
4333
4340
  try {
4334
4341
  this._xhr.abort();
4335
4342
  } catch {
@@ -4359,27 +4366,27 @@ oe.requestsCount = 0;
4359
4366
  oe.requests = {};
4360
4367
  if (typeof document < "u") {
4361
4368
  if (typeof attachEvent == "function")
4362
- attachEvent("onunload", Or);
4369
+ attachEvent("onunload", Pr);
4363
4370
  else if (typeof addEventListener == "function") {
4364
4371
  const e = "onpagehide" in X ? "pagehide" : "unload";
4365
- addEventListener(e, Or, !1);
4372
+ addEventListener(e, Pr, !1);
4366
4373
  }
4367
4374
  }
4368
- function Or() {
4375
+ function Pr() {
4369
4376
  for (let e in oe.requests)
4370
4377
  oe.requests.hasOwnProperty(e) && oe.requests[e].abort();
4371
4378
  }
4372
- const Kl = (function() {
4379
+ const Yl = (function() {
4373
4380
  const e = wo({
4374
4381
  xdomain: !1
4375
4382
  });
4376
4383
  return e && e.responseType !== null;
4377
4384
  })();
4378
- class Yl extends Gl {
4385
+ class Jl extends Kl {
4379
4386
  constructor(t) {
4380
4387
  super(t);
4381
4388
  const n = t && t.forceBase64;
4382
- this.supportsBinary = Kl && !n;
4389
+ this.supportsBinary = Yl && !n;
4383
4390
  }
4384
4391
  request(t = {}) {
4385
4392
  return Object.assign(t, { xd: this.xd }, this.opts), new oe(wo, this.uri(), t);
@@ -4388,7 +4395,7 @@ class Yl extends Gl {
4388
4395
  function wo(e) {
4389
4396
  const t = e.xdomain;
4390
4397
  try {
4391
- if (typeof XMLHttpRequest < "u" && (!t || zl))
4398
+ if (typeof XMLHttpRequest < "u" && (!t || Wl))
4392
4399
  return new XMLHttpRequest();
4393
4400
  } catch {
4394
4401
  }
@@ -4399,7 +4406,7 @@ function wo(e) {
4399
4406
  }
4400
4407
  }
4401
4408
  const _o = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
4402
- class Jl extends Un {
4409
+ class Xl extends Fn {
4403
4410
  get name() {
4404
4411
  return "websocket";
4405
4412
  }
@@ -4430,7 +4437,7 @@ class Jl extends Un {
4430
4437
  this.writable = !1;
4431
4438
  for (let n = 0; n < t.length; n++) {
4432
4439
  const r = t[n], i = n === t.length - 1;
4433
- Bn(r, this.supportsBinary, (o) => {
4440
+ $n(r, this.supportsBinary, (o) => {
4434
4441
  try {
4435
4442
  this.doWrite(r, o);
4436
4443
  } catch {
@@ -4456,7 +4463,7 @@ class Jl extends Un {
4456
4463
  }
4457
4464
  }
4458
4465
  const rn = X.WebSocket || X.MozWebSocket;
4459
- class Xl extends Jl {
4466
+ class Ql extends Xl {
4460
4467
  createSocket(t, n, r) {
4461
4468
  return _o ? new rn(t, n, r) : n ? new rn(t, n) : new rn(t);
4462
4469
  }
@@ -4464,7 +4471,7 @@ class Xl extends Jl {
4464
4471
  this.ws.send(n);
4465
4472
  }
4466
4473
  }
4467
- class Ql extends Un {
4474
+ class Zl extends Fn {
4468
4475
  get name() {
4469
4476
  return "webtransport";
4470
4477
  }
@@ -4480,7 +4487,7 @@ class Ql extends Un {
4480
4487
  this.onError("webtransport error", t);
4481
4488
  }), this._transport.ready.then(() => {
4482
4489
  this._transport.createBidirectionalStream().then((t) => {
4483
- const n = Ll(Number.MAX_SAFE_INTEGER, this.socket.binaryType), r = t.readable.pipeThrough(n).getReader(), i = Ol();
4490
+ const n = Ml(Number.MAX_SAFE_INTEGER, this.socket.binaryType), r = t.readable.pipeThrough(n).getReader(), i = Ll();
4484
4491
  i.readable.pipeTo(t.writable), this._writer = i.writable.getWriter();
4485
4492
  const o = () => {
4486
4493
  r.read().then(({ done: a, value: c }) => {
@@ -4510,11 +4517,11 @@ class Ql extends Un {
4510
4517
  (t = this._transport) === null || t === void 0 || t.close();
4511
4518
  }
4512
4519
  }
4513
- const Zl = {
4514
- websocket: Xl,
4515
- webtransport: Ql,
4516
- polling: Yl
4517
- }, eu = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, tu = [
4520
+ const eu = {
4521
+ websocket: Ql,
4522
+ webtransport: Zl,
4523
+ polling: Jl
4524
+ }, tu = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, nu = [
4518
4525
  "source",
4519
4526
  "protocol",
4520
4527
  "authority",
@@ -4535,16 +4542,16 @@ function gn(e) {
4535
4542
  throw "URI too long";
4536
4543
  const t = e, n = e.indexOf("["), r = e.indexOf("]");
4537
4544
  n != -1 && r != -1 && (e = e.substring(0, n) + e.substring(n, r).replace(/:/g, ";") + e.substring(r, e.length));
4538
- let i = eu.exec(e || ""), o = {}, s = 14;
4545
+ let i = tu.exec(e || ""), o = {}, s = 14;
4539
4546
  for (; s--; )
4540
- o[tu[s]] = i[s] || "";
4541
- return n != -1 && r != -1 && (o.source = t, o.host = o.host.substring(1, o.host.length - 1).replace(/;/g, ":"), o.authority = o.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), o.ipv6uri = !0), o.pathNames = nu(o, o.path), o.queryKey = ru(o, o.query), o;
4547
+ o[nu[s]] = i[s] || "";
4548
+ return n != -1 && r != -1 && (o.source = t, o.host = o.host.substring(1, o.host.length - 1).replace(/;/g, ":"), o.authority = o.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), o.ipv6uri = !0), o.pathNames = ru(o, o.path), o.queryKey = iu(o, o.query), o;
4542
4549
  }
4543
- function nu(e, t) {
4550
+ function ru(e, t) {
4544
4551
  const n = /\/{2,9}/g, r = t.replace(n, "/").split("/");
4545
4552
  return (t.slice(0, 1) == "/" || t.length === 0) && r.splice(0, 1), t.slice(-1) == "/" && r.splice(r.length - 1, 1), r;
4546
4553
  }
4547
- function ru(e, t) {
4554
+ function iu(e, t) {
4548
4555
  const n = {};
4549
4556
  return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(r, i, o) {
4550
4557
  i && (n[i] = o);
@@ -4562,7 +4569,7 @@ class ve extends j {
4562
4569
  * @param {Object} opts - options
4563
4570
  */
4564
4571
  constructor(t, n) {
4565
- if (super(), this.binaryType = Nl, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = 1 / 0, t && typeof t == "object" && (n = t, t = null), t) {
4572
+ if (super(), this.binaryType = Dl, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = 1 / 0, t && typeof t == "object" && (n = t, t = null), t) {
4566
4573
  const r = gn(t);
4567
4574
  n.hostname = r.host, n.secure = r.protocol === "https" || r.protocol === "wss", n.port = r.port, r.query && (n.query = r.query);
4568
4575
  } else n.host && (n.hostname = gn(n.host).host);
@@ -4583,7 +4590,7 @@ class ve extends j {
4583
4590
  },
4584
4591
  transportOptions: {},
4585
4592
  closeOnBeforeunload: !1
4586
- }, n), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = Hl(this.opts.query)), yn && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
4593
+ }, n), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = ql(this.opts.query)), yn && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
4587
4594
  this.transport && (this.transport.removeAllListeners(), this.transport.close());
4588
4595
  }, addEventListener("beforeunload", this._beforeunloadEventListener, !1)), this.hostname !== "localhost" && (this._offlineEventListener = () => {
4589
4596
  this._onClose("transport close", {
@@ -4718,7 +4725,7 @@ class ve extends j {
4718
4725
  let n = 1;
4719
4726
  for (let r = 0; r < this.writeBuffer.length; r++) {
4720
4727
  const i = this.writeBuffer[r].data;
4721
- if (i && (n += Fl(i)), r > 0 && n > this._maxPayload)
4728
+ if (i && (n += Ul(i)), r > 0 && n > this._maxPayload)
4722
4729
  return this.writeBuffer.slice(0, r);
4723
4730
  n += 2;
4724
4731
  }
@@ -4825,7 +4832,7 @@ class ve extends j {
4825
4832
  }
4826
4833
  }
4827
4834
  ve.protocol = go;
4828
- class iu extends ve {
4835
+ class ou extends ve {
4829
4836
  constructor() {
4830
4837
  super(...arguments), this._upgrades = [];
4831
4838
  }
@@ -4897,21 +4904,21 @@ class iu extends ve {
4897
4904
  return n;
4898
4905
  }
4899
4906
  }
4900
- let ou = class extends iu {
4907
+ let su = class extends ou {
4901
4908
  constructor(t, n = {}) {
4902
4909
  const r = typeof t == "object" ? t : n;
4903
- (!r.transports || r.transports && typeof r.transports[0] == "string") && (r.transports = (r.transports || ["polling", "websocket", "webtransport"]).map((i) => Zl[i]).filter((i) => !!i)), super(t, r);
4910
+ (!r.transports || r.transports && typeof r.transports[0] == "string") && (r.transports = (r.transports || ["polling", "websocket", "webtransport"]).map((i) => eu[i]).filter((i) => !!i)), super(t, r);
4904
4911
  }
4905
4912
  };
4906
- function su(e, t = "", n) {
4913
+ function au(e, t = "", n) {
4907
4914
  let r = e;
4908
4915
  n = n || typeof location < "u" && location, e == null && (e = n.protocol + "//" + n.host), typeof e == "string" && (e.charAt(0) === "/" && (e.charAt(1) === "/" ? e = n.protocol + e : e = n.host + e), /^(https?|wss?):\/\//.test(e) || (typeof n < "u" ? e = n.protocol + "//" + e : e = "https://" + e), r = gn(e)), r.port || (/^(http|ws)$/.test(r.protocol) ? r.port = "80" : /^(http|ws)s$/.test(r.protocol) && (r.port = "443")), r.path = r.path || "/";
4909
4916
  const o = r.host.indexOf(":") !== -1 ? "[" + r.host + "]" : r.host;
4910
4917
  return r.id = r.protocol + "://" + o + ":" + r.port + t, r.href = r.protocol + "://" + o + (n && n.port === r.port ? "" : ":" + r.port), r;
4911
4918
  }
4912
- const au = typeof ArrayBuffer == "function", cu = (e) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(e) : e.buffer instanceof ArrayBuffer, Eo = Object.prototype.toString, lu = typeof Blob == "function" || typeof Blob < "u" && Eo.call(Blob) === "[object BlobConstructor]", uu = typeof File == "function" || typeof File < "u" && Eo.call(File) === "[object FileConstructor]";
4913
- function jn(e) {
4914
- return au && (e instanceof ArrayBuffer || cu(e)) || lu && e instanceof Blob || uu && e instanceof File;
4919
+ const cu = typeof ArrayBuffer == "function", lu = (e) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(e) : e.buffer instanceof ArrayBuffer, Eo = Object.prototype.toString, uu = typeof Blob == "function" || typeof Blob < "u" && Eo.call(Blob) === "[object BlobConstructor]", du = typeof File == "function" || typeof File < "u" && Eo.call(File) === "[object FileConstructor]";
4920
+ function Un(e) {
4921
+ return cu && (e instanceof ArrayBuffer || lu(e)) || uu && e instanceof Blob || du && e instanceof File;
4915
4922
  }
4916
4923
  function St(e, t) {
4917
4924
  if (!e || typeof e != "object")
@@ -4922,7 +4929,7 @@ function St(e, t) {
4922
4929
  return !0;
4923
4930
  return !1;
4924
4931
  }
4925
- if (jn(e))
4932
+ if (Un(e))
4926
4933
  return !0;
4927
4934
  if (e.toJSON && typeof e.toJSON == "function" && arguments.length === 1)
4928
4935
  return St(e.toJSON(), !0);
@@ -4931,14 +4938,14 @@ function St(e, t) {
4931
4938
  return !0;
4932
4939
  return !1;
4933
4940
  }
4934
- function du(e) {
4941
+ function hu(e) {
4935
4942
  const t = [], n = e.data, r = e;
4936
4943
  return r.data = vn(n, t), r.attachments = t.length, { packet: r, buffers: t };
4937
4944
  }
4938
4945
  function vn(e, t) {
4939
4946
  if (!e)
4940
4947
  return e;
4941
- if (jn(e)) {
4948
+ if (Un(e)) {
4942
4949
  const n = { _placeholder: !0, num: t.length };
4943
4950
  return t.push(e), n;
4944
4951
  } else if (Array.isArray(e)) {
@@ -4954,7 +4961,7 @@ function vn(e, t) {
4954
4961
  }
4955
4962
  return e;
4956
4963
  }
4957
- function hu(e, t) {
4964
+ function fu(e, t) {
4958
4965
  return e.data = bn(e.data, t), delete e.attachments, e;
4959
4966
  }
4960
4967
  function bn(e, t) {
@@ -4972,7 +4979,7 @@ function bn(e, t) {
4972
4979
  Object.prototype.hasOwnProperty.call(e, n) && (e[n] = bn(e[n], t));
4973
4980
  return e;
4974
4981
  }
4975
- const fu = [
4982
+ const pu = [
4976
4983
  "connect",
4977
4984
  "connect_error",
4978
4985
  "disconnect",
@@ -4980,12 +4987,12 @@ const fu = [
4980
4987
  "newListener",
4981
4988
  "removeListener"
4982
4989
  // used by the Node.js EventEmitter
4983
- ], pu = 5;
4990
+ ], mu = 5;
4984
4991
  var I;
4985
4992
  (function(e) {
4986
4993
  e[e.CONNECT = 0] = "CONNECT", e[e.DISCONNECT = 1] = "DISCONNECT", e[e.EVENT = 2] = "EVENT", e[e.ACK = 3] = "ACK", e[e.CONNECT_ERROR = 4] = "CONNECT_ERROR", e[e.BINARY_EVENT = 5] = "BINARY_EVENT", e[e.BINARY_ACK = 6] = "BINARY_ACK";
4987
4994
  })(I || (I = {}));
4988
- class mu {
4995
+ class gu {
4989
4996
  /**
4990
4997
  * Encoder constructor
4991
4998
  *
@@ -5021,14 +5028,14 @@ class mu {
5021
5028
  * a list of buffers.
5022
5029
  */
5023
5030
  encodeAsBinary(t) {
5024
- const n = du(t), r = this.encodeAsString(n.packet), i = n.buffers;
5031
+ const n = hu(t), r = this.encodeAsString(n.packet), i = n.buffers;
5025
5032
  return i.unshift(r), i;
5026
5033
  }
5027
5034
  }
5028
- function Lr(e) {
5035
+ function Or(e) {
5029
5036
  return Object.prototype.toString.call(e) === "[object Object]";
5030
5037
  }
5031
- class Hn extends j {
5038
+ class jn extends j {
5032
5039
  /**
5033
5040
  * Decoder constructor
5034
5041
  *
@@ -5049,8 +5056,8 @@ class Hn extends j {
5049
5056
  throw new Error("got plaintext data when reconstructing a packet");
5050
5057
  n = this.decodeString(t);
5051
5058
  const r = n.type === I.BINARY_EVENT;
5052
- r || n.type === I.BINARY_ACK ? (n.type = r ? I.EVENT : I.ACK, this.reconstructor = new gu(n), n.attachments === 0 && super.emitReserved("decoded", n)) : super.emitReserved("decoded", n);
5053
- } else if (jn(t) || t.base64)
5059
+ r || n.type === I.BINARY_ACK ? (n.type = r ? I.EVENT : I.ACK, this.reconstructor = new yu(n), n.attachments === 0 && super.emitReserved("decoded", n)) : super.emitReserved("decoded", n);
5060
+ } else if (Un(t) || t.base64)
5054
5061
  if (this.reconstructor)
5055
5062
  n = this.reconstructor.takeBinaryData(t), n && (this.reconstructor = null, super.emitReserved("decoded", n));
5056
5063
  else
@@ -5103,7 +5110,7 @@ class Hn extends j {
5103
5110
  }
5104
5111
  if (t.charAt(++n)) {
5105
5112
  const o = this.tryParse(t.substr(n));
5106
- if (Hn.isPayloadValid(r.type, o))
5113
+ if (jn.isPayloadValid(r.type, o))
5107
5114
  r.data = o;
5108
5115
  else
5109
5116
  throw new Error("invalid payload");
@@ -5120,14 +5127,14 @@ class Hn extends j {
5120
5127
  static isPayloadValid(t, n) {
5121
5128
  switch (t) {
5122
5129
  case I.CONNECT:
5123
- return Lr(n);
5130
+ return Or(n);
5124
5131
  case I.DISCONNECT:
5125
5132
  return n === void 0;
5126
5133
  case I.CONNECT_ERROR:
5127
- return typeof n == "string" || Lr(n);
5134
+ return typeof n == "string" || Or(n);
5128
5135
  case I.EVENT:
5129
5136
  case I.BINARY_EVENT:
5130
- return Array.isArray(n) && (typeof n[0] == "number" || typeof n[0] == "string" && fu.indexOf(n[0]) === -1);
5137
+ return Array.isArray(n) && (typeof n[0] == "number" || typeof n[0] == "string" && pu.indexOf(n[0]) === -1);
5131
5138
  case I.ACK:
5132
5139
  case I.BINARY_ACK:
5133
5140
  return Array.isArray(n);
@@ -5140,7 +5147,7 @@ class Hn extends j {
5140
5147
  this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null);
5141
5148
  }
5142
5149
  }
5143
- class gu {
5150
+ class yu {
5144
5151
  constructor(t) {
5145
5152
  this.packet = t, this.buffers = [], this.reconPack = t;
5146
5153
  }
@@ -5154,7 +5161,7 @@ class gu {
5154
5161
  */
5155
5162
  takeBinaryData(t) {
5156
5163
  if (this.buffers.push(t), this.buffers.length === this.reconPack.attachments) {
5157
- const n = hu(this.reconPack, this.buffers);
5164
+ const n = fu(this.reconPack, this.buffers);
5158
5165
  return this.finishedReconstruction(), n;
5159
5166
  }
5160
5167
  return null;
@@ -5166,21 +5173,21 @@ class gu {
5166
5173
  this.reconPack = null, this.buffers = [];
5167
5174
  }
5168
5175
  }
5169
- const yu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5176
+ const vu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5170
5177
  __proto__: null,
5171
- Decoder: Hn,
5172
- Encoder: mu,
5178
+ Decoder: jn,
5179
+ Encoder: gu,
5173
5180
  get PacketType() {
5174
5181
  return I;
5175
5182
  },
5176
- protocol: pu
5183
+ protocol: mu
5177
5184
  }, Symbol.toStringTag, { value: "Module" }));
5178
5185
  function Z(e, t, n) {
5179
5186
  return e.on(t, n), function() {
5180
5187
  e.off(t, n);
5181
5188
  };
5182
5189
  }
5183
- const vu = Object.freeze({
5190
+ const bu = Object.freeze({
5184
5191
  connect: 1,
5185
5192
  connect_error: 1,
5186
5193
  disconnect: 1,
@@ -5305,7 +5312,7 @@ class So extends j {
5305
5312
  */
5306
5313
  emit(t, ...n) {
5307
5314
  var r, i, o;
5308
- if (vu.hasOwnProperty(t))
5315
+ if (bu.hasOwnProperty(t))
5309
5316
  throw new Error('"' + t.toString() + '" is a reserved event name');
5310
5317
  if (n.unshift(t), this._opts.retries && !this.flags.fromQueue && !this.flags.volatile)
5311
5318
  return this._addToQueue(n), this;
@@ -5812,7 +5819,7 @@ class wn extends j {
5812
5819
  max: this.reconnectionDelayMax(),
5813
5820
  jitter: this.randomizationFactor()
5814
5821
  }), this.timeout(n.timeout == null ? 2e4 : n.timeout), this._readyState = "closed", this.uri = t;
5815
- const i = n.parser || yu;
5822
+ const i = n.parser || vu;
5816
5823
  this.encoder = new i.Encoder(), this.decoder = new i.Decoder(), this._autoConnect = n.autoConnect !== !1, this._autoConnect && this.open();
5817
5824
  }
5818
5825
  reconnection(t) {
@@ -5855,7 +5862,7 @@ class wn extends j {
5855
5862
  open(t) {
5856
5863
  if (~this._readyState.indexOf("open"))
5857
5864
  return this;
5858
- this.engine = new ou(this.uri, this.opts);
5865
+ this.engine = new su(this.uri, this.opts);
5859
5866
  const n = this.engine, r = this;
5860
5867
  this._readyState = "opening", this.skipReconnect = !1;
5861
5868
  const i = Z(n, "open", function() {
@@ -6045,7 +6052,7 @@ class wn extends j {
6045
6052
  const Be = {};
6046
6053
  function Re(e, t) {
6047
6054
  typeof e == "object" && (t = e, e = void 0), t = t || {};
6048
- const n = su(e, t.path || "/socket.io"), r = n.source, i = n.id, o = n.path, s = Be[i] && o in Be[i].nsps, a = t.forceNew || t["force new connection"] || t.multiplex === !1 || s;
6055
+ const n = au(e, t.path || "/socket.io"), r = n.source, i = n.id, o = n.path, s = Be[i] && o in Be[i].nsps, a = t.forceNew || t["force new connection"] || t.multiplex === !1 || s;
6049
6056
  let c;
6050
6057
  return a ? c = new wn(r, t) : (Be[i] || (Be[i] = new wn(r, t)), c = Be[i]), n.query && !t.query && (t.query = n.queryKey), c.socket(n.path, t);
6051
6058
  }
@@ -6055,7 +6062,7 @@ Object.assign(Re, {
6055
6062
  io: Re,
6056
6063
  connect: Re
6057
6064
  });
6058
- function bu(e) {
6065
+ function wu(e) {
6059
6066
  const t = /* @__PURE__ */ new Map();
6060
6067
  let n = 0, r = null;
6061
6068
  const i = () => {
@@ -6103,7 +6110,7 @@ function bu(e) {
6103
6110
  }
6104
6111
  };
6105
6112
  }
6106
- function Mr() {
6113
+ function Lr() {
6107
6114
  let t = Se().serverOrigin || "/";
6108
6115
  if (t === "/" && typeof window < "u") {
6109
6116
  const n = window.location;
@@ -6111,17 +6118,17 @@ function Mr() {
6111
6118
  }
6112
6119
  return new URL(t.startsWith("http") ? t : `${window.location.origin}${t}`).origin;
6113
6120
  }
6114
- let Nr;
6115
- function wu() {
6116
- return Nr ??= bu({
6117
- wire: { channel: Kc, parseChanged: Yc },
6121
+ let Mr;
6122
+ function _u() {
6123
+ return Mr ??= wu({
6124
+ wire: { channel: hc, parseChanged: fc },
6118
6125
  connect: () => {
6119
- const e = Re(Mr(), { path: ki, transports: ["websocket", "polling"] });
6120
- return m("room-feed", "feed socket opened", { origin: Mr() }), e;
6126
+ const e = Re(Lr(), { path: Ti, transports: ["websocket", "polling"] });
6127
+ return m("room-feed", "feed socket opened", { origin: Lr() }), e;
6121
6128
  }
6122
- }), Nr;
6129
+ }), Mr;
6123
6130
  }
6124
- var _u = ["effect", "gradient", "font", "overlay", "message"], x = (e, t, n, r = {}) => ({ id: `${e}.${t}`, slot: e, label: n, ...r }), V = { hidden: !0 }, qn = [
6131
+ var Eu = ["effect", "gradient", "font", "overlay", "message"], x = (e, t, n, r = {}) => ({ id: `${e}.${t}`, slot: e, label: n, ...r }), V = { hidden: !0 }, Hn = [
6125
6132
  x("effect", "glint", "Glint"),
6126
6133
  x("effect", "aura", "Aura"),
6127
6134
  x("effect", "hop", "Hop", V),
@@ -6200,9 +6207,9 @@ var _u = ["effect", "gradient", "font", "overlay", "message"], x = (e, t, n, r =
6200
6207
  x("message", "bubble", "Bubble", V),
6201
6208
  x("message", "drift", "Drift")
6202
6209
  ], _n = new Map(
6203
- qn.map((e) => [e.id, e])
6210
+ Hn.map((e) => [e.id, e])
6204
6211
  );
6205
- qn.filter(
6212
+ Hn.filter(
6206
6213
  (e) => e.earn !== void 0 && !e.hidden
6207
6214
  );
6208
6215
  var To = { x: 0, y: 0, r: 0, s: 100, flip: !1, back: !1 }, Fe = {
@@ -6229,13 +6236,13 @@ function En(e, t) {
6229
6236
  bottom: Math.max(...k)
6230
6237
  };
6231
6238
  }
6232
- var Eu = qn.filter((e) => !!e.art), Su = {
6239
+ var Su = Hn.filter((e) => !!e.art), Tu = {
6233
6240
  left: -25,
6234
- top: Math.floor(Math.min(...Eu.map((e) => En(e.art, To).top))),
6241
+ top: Math.floor(Math.min(...Su.map((e) => En(e.art, To).top))),
6235
6242
  right: 125,
6236
6243
  bottom: 110
6237
6244
  }, dt = (e, [t, n]) => Math.min(n, Math.max(t, e));
6238
- function Tu(e, t) {
6245
+ function ku(e, t) {
6239
6246
  const n = (a, c) => typeof a == "number" && Number.isFinite(a) ? a : c, r = {
6240
6247
  x: Math.round(dt(n(t.x, 0), Fe.x)),
6241
6248
  y: Math.round(dt(n(t.y, 0), Fe.y)),
@@ -6243,7 +6250,7 @@ function Tu(e, t) {
6243
6250
  s: Math.round(dt(n(t.s, 100), Fe.s)),
6244
6251
  flip: t.flip === !0,
6245
6252
  back: t.back === !0
6246
- }, i = Su;
6253
+ }, i = Tu;
6247
6254
  let o = En(e, r);
6248
6255
  const s = Math.min(
6249
6256
  (i.right - i.left - 2) / (o.right - o.left),
@@ -6251,62 +6258,62 @@ function Tu(e, t) {
6251
6258
  );
6252
6259
  return s < 1 && (r.s = Math.max(Fe.s[0], Math.floor(r.s * s)), o = En(e, r)), r.x += Math.ceil(Math.max(0, i.left - o.left)) - Math.ceil(Math.max(0, o.right - i.right)), r.y += Math.ceil(Math.max(0, i.top - o.top)) - Math.ceil(Math.max(0, o.bottom - i.bottom)), r;
6253
6260
  }
6254
- function ku(e) {
6261
+ function Ru(e) {
6255
6262
  if (!e || typeof e != "object") return;
6256
6263
  const t = e, n = {};
6257
- for (const i of _u) {
6264
+ for (const i of Eu) {
6258
6265
  const o = t[i], s = typeof o == "string" ? _n.get(o) : void 0;
6259
6266
  s && !s.hidden && s.slot === i && (n[i] = s.id);
6260
6267
  }
6261
6268
  const r = n.overlay ? _n.get(n.overlay)?.art : void 0;
6262
- return r && t.placement && typeof t.placement == "object" && (n.placement = Tu(r, t.placement)), Object.keys(n).length ? n : void 0;
6269
+ return r && t.placement && typeof t.placement == "object" && (n.placement = ku(r, t.placement)), Object.keys(n).length ? n : void 0;
6263
6270
  }
6264
- var Ru = 0.3, xu = 0.82, ke = 24, Cu = 32;
6265
- function Au(e) {
6271
+ var xu = 0.3, Cu = 0.82, ke = 24, Au = 32;
6272
+ function Iu(e) {
6266
6273
  let t = 0, n = 0, r = 0, i = 0;
6267
6274
  for (let o = 0; o + 3 < e.length; o += 4) {
6268
6275
  const s = e[o + 3];
6269
- s < Cu || (t += e[o] * s, n += e[o + 1] * s, r += e[o + 2] * s, i += s);
6276
+ s < Au || (t += e[o] * s, n += e[o + 1] * s, r += e[o + 2] * s, i += s);
6270
6277
  }
6271
- return i === 0 ? null : Iu(t / i, n / i, r / i);
6278
+ return i === 0 ? null : Pu(t / i, n / i, r / i);
6272
6279
  }
6273
- function Iu(e, t, n) {
6274
- const [r, i, o] = Pu(e / 255, t / 255, n / 255), s = Math.min(xu, Math.max(Ru, o)), [a, c, u] = Ou(r, i, s), d = (h) => Math.round(h * 255).toString(16).padStart(2, "0");
6280
+ function Pu(e, t, n) {
6281
+ const [r, i, o] = Ou(e / 255, t / 255, n / 255), s = Math.min(Cu, Math.max(xu, o)), [a, c, u] = Lu(r, i, s), d = (h) => Math.round(h * 255).toString(16).padStart(2, "0");
6275
6282
  return `#${d(a)}${d(c)}${d(u)}`;
6276
6283
  }
6277
- function Pu(e, t, n) {
6284
+ function Ou(e, t, n) {
6278
6285
  const r = Math.max(e, t, n), i = Math.min(e, t, n), o = (r + i) / 2;
6279
6286
  if (r === i) return [0, 0, o];
6280
6287
  const s = r - i, a = o > 0.5 ? s / (2 - r - i) : s / (r + i);
6281
6288
  let c;
6282
6289
  return r === e ? c = (t - n) / s + (t < n ? 6 : 0) : r === t ? c = (n - e) / s + 2 : c = (e - t) / s + 4, [c / 6, a, o];
6283
6290
  }
6284
- function Ou(e, t, n) {
6291
+ function Lu(e, t, n) {
6285
6292
  if (t === 0) return [n, n, n];
6286
6293
  const r = n < 0.5 ? n * (1 + t) : n + t - n * t, i = 2 * n - r, o = (s) => (s < 0 && (s += 1), s > 1 && (s -= 1), s < 1 / 6 ? i + (r - i) * 6 * s : s < 1 / 2 ? r : s < 2 / 3 ? i + (r - i) * (2 / 3 - s) * 6 : i);
6287
6294
  return [o(e + 1 / 3), o(e), o(e - 1 / 3)];
6288
6295
  }
6289
6296
  var Tt = /* @__PURE__ */ new Map(), on = /* @__PURE__ */ new Map(), Sn = /* @__PURE__ */ new Set();
6290
- function Lu(e) {
6297
+ function Mu(e) {
6291
6298
  return Tt.get(e);
6292
6299
  }
6293
- function Mu(e) {
6300
+ function Nu(e) {
6294
6301
  return Sn.add(e), () => {
6295
6302
  Sn.delete(e);
6296
6303
  };
6297
6304
  }
6298
- function Nu(e) {
6305
+ function Du(e) {
6299
6306
  if (Tt.has(e)) return Promise.resolve(Tt.get(e) ?? null);
6300
6307
  const t = on.get(e);
6301
6308
  if (t) return t;
6302
- const n = Du(e).then((r) => {
6309
+ const n = $u(e).then((r) => {
6303
6310
  on.delete(e), Tt.set(e, r);
6304
6311
  for (const i of Sn) i();
6305
6312
  return r;
6306
6313
  });
6307
6314
  return on.set(e, n), n;
6308
6315
  }
6309
- function Du(e) {
6316
+ function $u(e) {
6310
6317
  return typeof Image > "u" || typeof document > "u" ? Promise.resolve(null) : new Promise((t) => {
6311
6318
  const n = new Image();
6312
6319
  n.crossOrigin = "anonymous", n.referrerPolicy = "no-referrer", n.onload = () => {
@@ -6319,24 +6326,24 @@ function Du(e) {
6319
6326
  }
6320
6327
  i.drawImage(n, 0, 0, ke, ke);
6321
6328
  try {
6322
- t(Au(i.getImageData(0, 0, ke, ke).data));
6329
+ t(Iu(i.getImageData(0, 0, ke, ke).data));
6323
6330
  } catch (o) {
6324
6331
  console.debug("[prefs-client] picture colour unreadable", e, o), t(null);
6325
6332
  }
6326
6333
  }, n.onerror = () => t(null), n.src = e;
6327
6334
  });
6328
6335
  }
6329
- var Vn = "/cosmetics", Dr = "hadoku-cosmetics", Y = (e) => e.replace(
6336
+ var qn = "/cosmetics", Nr = "hadoku-cosmetics", Y = (e) => e.replace(
6330
6337
  /[&<>"']/g,
6331
6338
  (t) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[t]
6332
6339
  ), Ge = (e) => e ? e.slice(e.indexOf(".") + 1) : "none";
6333
- function $u(e) {
6340
+ function Bu(e) {
6334
6341
  const t = e.s / 100 * (e.flip ? -1 : 1);
6335
6342
  return `translate(calc(var(--hc-sz) * ${(e.x / 100).toFixed(3)}),calc(var(--hc-sz) * ${(e.y / 100).toFixed(3)})) rotate(${e.r}deg) scale(${t.toFixed(3)},${(e.s / 100).toFixed(3)})`;
6336
6343
  }
6337
- var Bu = /* @__PURE__ */ new Set(["hop"]);
6344
+ var Fu = /* @__PURE__ */ new Set(["hop"]);
6338
6345
  function rf(e, t, n = {}) {
6339
- const r = Ge(t?.effect), i = Ge(t?.gradient), o = Ge(t?.font), s = Y(e), a = Bu.has(r), c = a ? `<span class="hc-tx">${[...e].map(
6346
+ const r = Ge(t?.effect), i = Ge(t?.gradient), o = Ge(t?.font), s = Y(e), a = Fu.has(r), c = a ? `<span class="hc-tx">${[...e].map(
6340
6347
  (b, E) => `<span class="hc-ch" style="--hc-i:${E}"><span class="hc-c">${b === " " ? "&nbsp;" : Y(b)}</span></span>`
6341
6348
  ).join("")}</span>` : `<span class="hc-tx">${s}</span>`, u = (b) => `<span class="hc-lyr${b}" aria-hidden="true">${s}</span>`;
6342
6349
  let d = "", h = "";
@@ -6348,23 +6355,23 @@ function rf(e, t, n = {}) {
6348
6355
  ([b, E, w]) => `<i class="hc-tw" aria-hidden="true" style="left:${b}%;top:${E}%;animation-delay:${w}s"></i>`
6349
6356
  ).join("")), `<span class="${`hc-name hc-fx-${r} hc-gr-${i} hc-font-${o}${a ? " hc-split" : ""}${n.large ? " hc-large" : ""}`}">${d}${c}${h}</span>`;
6350
6357
  }
6351
- var Fu = (() => {
6358
+ var Uu = (() => {
6352
6359
  let e = "";
6353
6360
  for (let t = 0; t < 12; t++)
6354
6361
  e += `<g transform="rotate(${t * 30} 50 50)"><path d="M50 3 l2.5 4 -2.5 4 -2.5 -4z" fill="currentColor" opacity="${t % 3 ? 0.55 : 1}"/></g>`;
6355
6362
  return `<svg viewBox="0 0 100 100" aria-hidden="true"><circle cx="50" cy="50" r="44" fill="none" stroke="currentColor" stroke-width="1" stroke-dasharray="3 5" opacity=".7"/>${e}</svg>`;
6356
6363
  })();
6357
- function of(e, t = Vn) {
6364
+ function of(e, t = qn) {
6358
6365
  const n = e?.overlay;
6359
6366
  if (!n) return "";
6360
6367
  const r = _n.get(n)?.art;
6361
6368
  if (r) {
6362
6369
  const i = e?.placement ?? To;
6363
- return `<span class="hc-ol hc-art${r.pixel ? " hc-px" : ""}" data-hc-art="${Y(n)}" style="left:${50 - r.width / 2}%;top:${r.top}%;width:${r.width}%;z-index:${i.back ? 0 : 3}"><span class="hc-adj" style="transform:${$u(i)}"><img alt="" draggable="false" style="--hc-tilt:${r.tilt}deg" src="${Y(`${t}/art/${r.file}`)}"></span></span>`;
6370
+ return `<span class="hc-ol hc-art${r.pixel ? " hc-px" : ""}" data-hc-art="${Y(n)}" style="left:${50 - r.width / 2}%;top:${r.top}%;width:${r.width}%;z-index:${i.back ? 0 : 3}"><span class="hc-adj" style="transform:${Bu(i)}"><img alt="" draggable="false" style="--hc-tilt:${r.tilt}deg" src="${Y(`${t}/art/${r.file}`)}"></span></span>`;
6364
6371
  }
6365
6372
  switch (Ge(n)) {
6366
6373
  case "runes":
6367
- return `<span class="hc-ol hc-runes">${Fu}</span>`;
6374
+ return `<span class="hc-ol hc-runes">${Uu}</span>`;
6368
6375
  case "comet":
6369
6376
  return '<span class="hc-ol hc-comet"></span>';
6370
6377
  case "shine":
@@ -6379,18 +6386,18 @@ function of(e, t = Vn) {
6379
6386
  return "";
6380
6387
  }
6381
6388
  }
6382
- var $r = "!<>-_/[]{}=+*^?#%&01", Br = /* @__PURE__ */ new Set(["type", "decode", "cascade"]), Fr = 1400, Uu = 160;
6389
+ var Dr = "!<>-_/[]{}=+*^?#%&01", $r = /* @__PURE__ */ new Set(["type", "decode", "cascade"]), Br = 1400, ju = 160;
6383
6390
  function sf(e, t, n = {}) {
6384
6391
  let r = Ge(t?.message);
6385
6392
  if (r === "none") return `<span class="hc-msg">${Y(e)}</span>`;
6386
6393
  const i = e.split(/\s+/).filter(Boolean);
6387
- Br.has(r) && e.length > Uu && (r = "words");
6394
+ $r.has(r) && e.length > ju && (r = "words");
6388
6395
  const o = n.keep ? " data-hc-keep" : "";
6389
6396
  let s, a;
6390
- if (Br.has(r)) {
6391
- a = Math.min(38, Fr / Math.max(1, e.length));
6397
+ if ($r.has(r)) {
6398
+ a = Math.min(38, Br / Math.max(1, e.length));
6392
6399
  let c = 0;
6393
- const u = () => $r[Math.floor(Math.random() * $r.length)];
6400
+ const u = () => Dr[Math.floor(Math.random() * Dr.length)];
6394
6401
  s = i.map(
6395
6402
  (v) => `<span class="hc-w">${[...v].map((b) => {
6396
6403
  const E = c++;
@@ -6400,18 +6407,18 @@ function sf(e, t, n = {}) {
6400
6407
  const d = r === "type" ? "hc-caret" : r === "decode" ? "hc-r" : "hc-ch", h = s.lastIndexOf(`<span class="${d}"`);
6401
6408
  s = `${s.slice(0, h)}<span data-hc-last class="${d}"${s.slice(h + `<span class="${d}"`.length)}`;
6402
6409
  } else
6403
- a = Math.min(90, Fr / Math.max(1, i.length)), s = i.map(
6410
+ a = Math.min(90, Br / Math.max(1, i.length)), s = i.map(
6404
6411
  (c, u) => `<span class="hc-w" style="--hc-i:${u}"${u === i.length - 1 ? " data-hc-last" : ""}>${Y(c)}</span>`
6405
6412
  ).join(" ");
6406
6413
  return `<span class="hc-msg hc-mt-${r}" style="--hc-step:${a.toFixed(1)}ms" data-text="${Y(e)}"${o}><span class="hc-sr">${Y(e)}</span><span aria-hidden="true">${s}</span></span>`;
6407
6414
  }
6408
- function ju(e) {
6415
+ function Hu(e) {
6409
6416
  const t = e.target;
6410
6417
  if (e.pseudoElement || !t?.hasAttribute?.("data-hc-last")) return;
6411
6418
  const n = t.closest(".hc-msg");
6412
6419
  !n || n.hasAttribute("data-hc-keep") || (n.className = "hc-msg", n.removeAttribute("style"), n.textContent = n.getAttribute("data-text") ?? "");
6413
6420
  }
6414
- var Ur = {
6421
+ var Fr = {
6415
6422
  script: {
6416
6423
  file: "caveat",
6417
6424
  family: "Caveat",
@@ -6475,11 +6482,11 @@ var Ur = {
6475
6482
  css: "font-weight:400;font-size:.62em;line-height:1.6"
6476
6483
  }
6477
6484
  };
6478
- function Hu(e = Vn) {
6479
- const t = Object.entries(Ur).map(
6485
+ function qu(e = qn) {
6486
+ const t = Object.entries(Fr).map(
6480
6487
  ([r, i]) => `@font-face{font-family:"hc-${r}";src:url("${e}/fonts/${i.file}.woff2") format("woff2");font-display:swap}`
6481
6488
  ).join(`
6482
- `), n = Object.entries(Ur).map(([r, i]) => `.hc-font-${r}{font-family:"hc-${r}","${i.family}",${i.generic};${i.css}}`).join(`
6489
+ `), n = Object.entries(Fr).map(([r, i]) => `.hc-font-${r}{font-family:"hc-${r}","${i.family}",${i.generic};${i.css}}`).join(`
6483
6490
  `);
6484
6491
  return `${t}
6485
6492
  /* Colours: everything derives from the character colour. */
@@ -6570,21 +6577,21 @@ ${n}
6570
6577
  @media (prefers-reduced-motion:reduce){.hc-name *,.hc-av *,.hc-av *::after,.hc-msg *,.hc-msg *::before,.hc-msg *::after{animation:none!important}}
6571
6578
  `;
6572
6579
  }
6573
- function af(e = document, t = Vn) {
6574
- if (e.getElementById(Dr)) return;
6580
+ function af(e = document, t = qn) {
6581
+ if (e.getElementById(Nr)) return;
6575
6582
  const n = e.createElement("style");
6576
- n.id = Dr, n.textContent = Hu(t), e.head.appendChild(n), e.addEventListener("animationend", ju);
6577
- }
6578
- function qu(e, t) {
6579
- return (t ? Lu(t) : null) ?? Ji(e);
6583
+ n.id = Nr, n.textContent = qu(t), e.head.appendChild(n), e.addEventListener("animationend", Hu);
6580
6584
  }
6581
6585
  function Vu(e, t) {
6586
+ return (t ? Mu(t) : null) ?? Xi(e);
6587
+ }
6588
+ function zu(e, t) {
6582
6589
  return he(() => {
6583
- t && Nu(t);
6584
- }, [t]), Mt(Mu, () => qu(e, t), () => Ji(e));
6590
+ t && Du(t);
6591
+ }, [t]), Mt(Nu, () => Vu(e, t), () => Xi(e));
6585
6592
  }
6586
- function zu({ sprite: e, url: t, alt: n = "", className: r, style: i, fallback: o }) {
6587
- const [s, a] = ti(null);
6593
+ function Wu({ sprite: e, url: t, alt: n = "", className: r, style: i, fallback: o }) {
6594
+ const [s, a] = ei(null);
6588
6595
  if (t && t !== s)
6589
6596
  return /* @__PURE__ */ S(
6590
6597
  "img",
@@ -6598,14 +6605,14 @@ function zu({ sprite: e, url: t, alt: n = "", className: r, style: i, fallback:
6598
6605
  onError: () => a(t)
6599
6606
  }
6600
6607
  );
6601
- const c = Xi(e);
6602
- return c ? /* @__PURE__ */ S("img", { src: c, alt: n, crossOrigin: "anonymous", className: r, style: i, draggable: !1 }) : /* @__PURE__ */ S(ei, { children: o });
6608
+ const c = Qi(e);
6609
+ return c ? /* @__PURE__ */ S("img", { src: c, alt: n, crossOrigin: "anonymous", className: r, style: i, draggable: !1 }) : /* @__PURE__ */ S(Zr, { children: o });
6603
6610
  }
6604
- const Wu = "hadoku://library";
6605
- function Gu(e = typeof navigator < "u" ? navigator.userAgent : void 0) {
6611
+ const Gu = "hadoku://library";
6612
+ function Ku(e = typeof navigator < "u" ? navigator.userAgent : void 0) {
6606
6613
  return e !== void 0 && /(^|\s)HadokuApp\/\S/.test(e);
6607
6614
  }
6608
- function Ku(e) {
6615
+ function Yu(e) {
6609
6616
  return e.slice().sort(
6610
6617
  (t, n) => (n.users?.length ?? 0) - (t.users?.length ?? 0) || t.room_id.localeCompare(n.room_id)
6611
6618
  );
@@ -6614,10 +6621,10 @@ async function ko(e, t = 1) {
6614
6621
  const n = Ft(), r = Date.now();
6615
6622
  m("home", "rooms-fetch: start", { attempt: t });
6616
6623
  try {
6617
- const i = await fetch(`${n}/api/rooms${Ki() ? "?debug=1" : ""}`, { cache: "no-store", signal: e });
6624
+ const i = await fetch(`${n}/api/rooms${Yi() ? "?debug=1" : ""}`, { cache: "no-store", signal: e });
6618
6625
  if (!i.ok) throw new Error(`HTTP ${i.status}`);
6619
6626
  const o = await i.json();
6620
- return m("home", "rooms-fetch: success", { attempt: t, elapsedMs: Date.now() - r, roomCount: (o.rooms ?? []).length }), Ku(o.rooms || []);
6627
+ return m("home", "rooms-fetch: success", { attempt: t, elapsedMs: Date.now() - r, roomCount: (o.rooms ?? []).length }), Yu(o.rooms || []);
6621
6628
  } catch (i) {
6622
6629
  if (i instanceof Error && i.name === "AbortError") throw i;
6623
6630
  const o = i instanceof Error ? i.message : void 0;
@@ -6626,11 +6633,11 @@ async function ko(e, t = 1) {
6626
6633
  throw pe("app", "Failed to load rooms list", { elapsedMs: Date.now() - r, error: o }), i;
6627
6634
  }
6628
6635
  }
6629
- function Yu(e) {
6636
+ function Ju(e) {
6630
6637
  return e.room_id.split("-").map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join(" ");
6631
6638
  }
6632
- function Ju({ user: e }) {
6633
- const t = Vu(e.sprite_id, e.avatar_url);
6639
+ function Xu({ user: e }) {
6640
+ const t = zu(e.sprite_id, e.avatar_url);
6634
6641
  return /* @__PURE__ */ J("span", { className: "relative -ml-2 first:ml-0 group/av", children: [
6635
6642
  /* @__PURE__ */ S(
6636
6643
  "span",
@@ -6638,7 +6645,7 @@ function Ju({ user: e }) {
6638
6645
  className: "block h-10 w-10 rounded-full border-2 overflow-hidden bg-bg-card transition-transform duration-150 group-hover/av:scale-110 group-hover/av:z-10 shadow-md",
6639
6646
  style: { borderColor: t },
6640
6647
  children: /* @__PURE__ */ S(
6641
- zu,
6648
+ Wu,
6642
6649
  {
6643
6650
  sprite: e.sprite_id,
6644
6651
  url: e.avatar_url,
@@ -6659,7 +6666,7 @@ function Ju({ user: e }) {
6659
6666
  )
6660
6667
  ] });
6661
6668
  }
6662
- function Xu({ room: e }) {
6669
+ function Qu({ room: e }) {
6663
6670
  const t = e.users ?? [], n = t.length;
6664
6671
  return /* @__PURE__ */ J("li", { className: "flex items-stretch gap-2", children: [
6665
6672
  /* @__PURE__ */ S(
@@ -6668,8 +6675,8 @@ function Xu({ room: e }) {
6668
6675
  to: `/room/${encodeURIComponent(e.viewer_key)}`,
6669
6676
  className: "flex-1 block no-underline rounded-lg border border-border bg-bg-card/40 backdrop-blur-sm px-5 py-4 transition-all duration-150 hover:border-border-light hover:-translate-y-px hover:bg-bg-card/55 focus:outline-none focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-primary/40",
6670
6677
  children: /* @__PURE__ */ J("div", { className: "flex items-center justify-between gap-4", children: [
6671
- /* @__PURE__ */ S("div", { className: "text-xl font-medium tracking-wide text-text no-underline", children: Yu(e) }),
6672
- n > 0 && /* @__PURE__ */ S("div", { className: "flex shrink-0", children: t.map((r, i) => /* @__PURE__ */ S(Ju, { user: r }, `${r.name}-${i}`)) })
6678
+ /* @__PURE__ */ S("div", { className: "text-xl font-medium tracking-wide text-text no-underline", children: Ju(e) }),
6679
+ n > 0 && /* @__PURE__ */ S("div", { className: "flex shrink-0", children: t.map((r, i) => /* @__PURE__ */ S(Xu, { user: r }, `${r.name}-${i}`)) })
6673
6680
  ] })
6674
6681
  }
6675
6682
  ),
@@ -6684,9 +6691,9 @@ function Xu({ room: e }) {
6684
6691
  )
6685
6692
  ] });
6686
6693
  }
6687
- function Qu() {
6688
- const e = xc(), { list: t, loading: n, error: r, refresh: i } = Tl("list", {
6689
- pings: wu(),
6694
+ function Zu() {
6695
+ const e = Mc(), { list: t, loading: n, error: r, refresh: i } = kl("list", {
6696
+ pings: _u(),
6690
6697
  fetchList: (h) => ko(h)
6691
6698
  }), o = qo(() => t ?? [], [t]), s = t === null ? r : null, a = eo(), c = we(null);
6692
6699
  he(() => {
@@ -6715,15 +6722,15 @@ function Qu() {
6715
6722
  children: "Retry"
6716
6723
  }
6717
6724
  )
6718
- ] }) : o.length === 0 ? /* @__PURE__ */ S("div", { className: "text-text-secondary text-sm px-1 py-3", children: "No rooms available." }) : /* @__PURE__ */ S(ei, { children: /* @__PURE__ */ S("ul", { ref: c, className: "list-none p-0 m-0 space-y-2", children: o.map((h) => /* @__PURE__ */ S(Xu, { room: h }, h.viewer_key)) }) })
6725
+ ] }) : o.length === 0 ? /* @__PURE__ */ S("div", { className: "text-text-secondary text-sm px-1 py-3", children: "No rooms available." }) : /* @__PURE__ */ S(Zr, { children: /* @__PURE__ */ S("ul", { ref: c, className: "list-none p-0 m-0 space-y-2", children: o.map((h) => /* @__PURE__ */ S(Qu, { room: h }, h.viewer_key)) }) })
6719
6726
  ] }),
6720
- il() && /* @__PURE__ */ S("div", { className: "w-full max-w-md z-10", children: /* @__PURE__ */ S(kc, { className: "block no-underline rounded-lg border border-border bg-bg-card/40 backdrop-blur-sm px-5 py-4 text-xl font-medium tracking-wide text-text transition-all duration-150 hover:border-border-light hover:-translate-y-px hover:bg-bg-card/55 focus:outline-none focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-primary/40" }) }),
6721
- Gu() && /* @__PURE__ */ J("div", { className: "w-full max-w-md z-10", children: [
6727
+ ol() && /* @__PURE__ */ S("div", { className: "w-full max-w-md z-10", children: /* @__PURE__ */ S(Oc, { className: "block no-underline rounded-lg border border-border bg-bg-card/40 backdrop-blur-sm px-5 py-4 text-xl font-medium tracking-wide text-text transition-all duration-150 hover:border-border-light hover:-translate-y-px hover:bg-bg-card/55 focus:outline-none focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-primary/40" }) }),
6728
+ Ku() && /* @__PURE__ */ J("div", { className: "w-full max-w-md z-10", children: [
6722
6729
  /* @__PURE__ */ S("h2", { className: "text-xs uppercase tracking-[0.2em] text-text-muted/70 mb-3 px-1", children: "On this phone" }),
6723
6730
  /* @__PURE__ */ J(
6724
6731
  "a",
6725
6732
  {
6726
- href: Wu,
6733
+ href: Gu,
6727
6734
  className: "block no-underline rounded-lg border border-border bg-bg-card/40 backdrop-blur-sm px-5 py-4 transition-all duration-150 hover:border-border-light hover:-translate-y-px hover:bg-bg-card/55 focus:outline-none focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-primary/40",
6728
6735
  children: [
6729
6736
  /* @__PURE__ */ S("div", { className: "text-xl font-medium tracking-wide text-text", children: "Library" }),
@@ -6734,18 +6741,18 @@ function Qu() {
6734
6741
  ] })
6735
6742
  ] });
6736
6743
  }
6737
- function Zu() {
6744
+ function ed() {
6738
6745
  return /* @__PURE__ */ J("div", { className: "fixed inset-0 bg-black", children: [
6739
6746
  /* @__PURE__ */ S(lo, {}),
6740
6747
  /* @__PURE__ */ S("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ S("div", { className: "text-center", children: /* @__PURE__ */ S("h1", { className: "text-4xl font-bold text-white mb-4", children: "API is sleeping..." }) }) })
6741
6748
  ] });
6742
6749
  }
6743
- const ed = "watchparty_fragment_delivery", td = /^[0-9a-f]{64}$/, nd = /^[A-Za-z0-9_.-]+$/;
6744
- function rd(e) {
6745
- return !(!e || !e.baseUrl || e.baseUrl.endsWith("/") || !td.test(e.token) || e.trackId !== void 0 && !nd.test(e.trackId));
6750
+ const td = "watchparty_fragment_delivery", nd = /^[0-9a-f]{64}$/, rd = /^[A-Za-z0-9_.-]+$/;
6751
+ function id(e) {
6752
+ return !(!e || !e.baseUrl || e.baseUrl.endsWith("/") || !nd.test(e.token) || e.trackId !== void 0 && !rd.test(e.trackId));
6746
6753
  }
6747
6754
  function cf(e, t) {
6748
- if (!rd(e)) return null;
6755
+ if (!id(e)) return null;
6749
6756
  let n;
6750
6757
  if (t === "init")
6751
6758
  n = "init";
@@ -6756,7 +6763,7 @@ function cf(e, t) {
6756
6763
  const r = e.trackId ? `audio/${e.trackId}/` : "";
6757
6764
  return `${e.baseUrl}/v/${e.token}/${r}${n}`;
6758
6765
  }
6759
- function id() {
6766
+ function od() {
6760
6767
  if (typeof window > "u") return null;
6761
6768
  try {
6762
6769
  const e = new URLSearchParams(window.location.search).get("fragmentDelivery");
@@ -6764,35 +6771,35 @@ function id() {
6764
6771
  if (e === "0" || e === "false") return !1;
6765
6772
  } catch {
6766
6773
  }
6767
- return Ac(ed);
6774
+ return Dc(td);
6768
6775
  }
6769
- let zn = { ...Oi }, kt = null, Ro = !1;
6770
- const jr = "watchparty_delivery_client_id";
6771
- function od() {
6772
- const e = ie(jr);
6776
+ let Vn = { ...Oi }, kt = null, Ro = !1;
6777
+ const Ur = "watchparty_delivery_client_id";
6778
+ function sd() {
6779
+ const e = ie(Ur);
6773
6780
  if (e) return e;
6774
6781
  const t = globalThis.crypto?.randomUUID?.() ?? `d${Math.random().toString(36).slice(2)}`;
6775
- return Nn(jr, t) ? t : "";
6782
+ return Mn(Ur, t) ? t : "";
6776
6783
  }
6777
- function sd(e) {
6778
- zn = Li(e), Ro || (kt = null);
6784
+ function ad(e) {
6785
+ Vn = Li(e), Ro || (kt = null);
6779
6786
  }
6780
- function ad() {
6781
- return { ...zn };
6787
+ function cd() {
6788
+ return { ...Vn };
6782
6789
  }
6783
6790
  function xo() {
6784
- return kt === null && (kt = nc(zn, od(), id())), kt;
6791
+ return kt === null && (kt = ec(Vn, sd(), od())), kt;
6785
6792
  }
6786
- let Hr = !1;
6787
- async function cd(e) {
6788
- if (!Hr) {
6789
- Hr = !0;
6793
+ let jr = !1;
6794
+ async function ld(e) {
6795
+ if (!jr) {
6796
+ jr = !0;
6790
6797
  for (let t = 0; t < 2; t++) {
6791
6798
  try {
6792
6799
  const n = await fetch(`${e}/api/flags`, { cache: "no-store" });
6793
6800
  if (n.ok) {
6794
6801
  const r = await n.json();
6795
- sd(r?.fragment_delivery), m("app", "Delivery flag loaded", { ...ad(), attempt: t });
6802
+ ad(r?.fragment_delivery), m("app", "Delivery flag loaded", { ...cd(), attempt: t });
6796
6803
  return;
6797
6804
  }
6798
6805
  } catch {
@@ -6802,54 +6809,54 @@ async function cd(e) {
6802
6809
  L("app", "Delivery flag fetch failed; staying on the default delivery path");
6803
6810
  }
6804
6811
  }
6805
- function ld() {
6812
+ function ud() {
6806
6813
  return xo();
6807
6814
  }
6808
6815
  function lf() {
6809
6816
  const e = xo();
6810
6817
  return Ro = !0, e === "fragment";
6811
6818
  }
6812
- let Wn = cc;
6819
+ let zn = sc;
6813
6820
  const Tn = /* @__PURE__ */ new Set();
6814
- function ud(e) {
6815
- Wn = e;
6821
+ function dd(e) {
6822
+ zn = e;
6816
6823
  for (const t of Tn) t();
6817
6824
  }
6818
- function dd(e) {
6819
- const t = ac.safeParse(e?.games);
6825
+ function hd(e) {
6826
+ const t = oc.safeParse(e?.games);
6820
6827
  if (!t.success)
6821
6828
  return L("game", "Game catalog rejected; keeping the current list", { issues: t.error.issues.length }), !1;
6822
6829
  const n = t.data;
6823
- return ud(n), !0;
6830
+ return dd(n), !0;
6824
6831
  }
6825
- let qr = !1;
6826
- async function hd(e) {
6827
- if (!qr) {
6828
- qr = !0;
6832
+ let Hr = !1;
6833
+ async function fd(e) {
6834
+ if (!Hr) {
6835
+ Hr = !0;
6829
6836
  try {
6830
6837
  const t = await fetch(`${e}/api/games`, { cache: "no-store" });
6831
6838
  if (!t.ok) {
6832
6839
  L("game", "Game catalog fetch failed; using the default list", { status: t.status });
6833
6840
  return;
6834
6841
  }
6835
- dd(await t.json()) && m("game", "Game catalog loaded", { games: Wn.map((n) => n.id) });
6842
+ hd(await t.json()) && m("game", "Game catalog loaded", { games: zn.map((n) => n.id) });
6836
6843
  } catch (t) {
6837
6844
  L("game", "Game catalog fetch failed; using the default list", te(t));
6838
6845
  }
6839
6846
  }
6840
6847
  }
6841
- function fd() {
6842
- return Wn;
6848
+ function pd() {
6849
+ return zn;
6843
6850
  }
6844
- function pd(e) {
6851
+ function md(e) {
6845
6852
  return Tn.add(e), () => {
6846
6853
  Tn.delete(e);
6847
6854
  };
6848
6855
  }
6849
6856
  function uf() {
6850
- return Mt(pd, fd);
6857
+ return Mt(md, pd);
6851
6858
  }
6852
- function md(e) {
6859
+ function gd(e) {
6853
6860
  return ye.lazy(async () => {
6854
6861
  try {
6855
6862
  return await e();
@@ -6863,44 +6870,44 @@ function md(e) {
6863
6870
  }
6864
6871
  });
6865
6872
  }
6866
- const gd = ["demo-room"];
6867
- function yd(e) {
6868
- return e ? gd.some((t) => e === t || e.startsWith(t + "-")) : !1;
6869
- }
6873
+ const yd = ["demo-room"];
6870
6874
  function vd(e) {
6875
+ return e ? yd.some((t) => e === t || e.startsWith(t + "-")) : !1;
6876
+ }
6877
+ function bd(e) {
6871
6878
  if (!(e.hostname === "hadoku.me")) return null;
6872
6879
  if (e.requireAuth) {
6873
- if (br() !== "public") return null;
6880
+ if (vr() !== "public") return null;
6874
6881
  const r = e.pathname + (e.search || "");
6875
6882
  return `/auth?return=${encodeURIComponent(r)}`;
6876
6883
  }
6877
- if (!e.roomKey || yd(e.roomKey) || br() !== "public") return null;
6884
+ if (!e.roomKey || vd(e.roomKey) || vr() !== "public") return null;
6878
6885
  const n = e.pathname + (e.search || "");
6879
6886
  return `/auth?return=${encodeURIComponent(n)}`;
6880
6887
  }
6881
- const Vr = md(() => import("./Room-DU5VG_Ve.js").then((e) => e.R));
6882
- function zr() {
6888
+ const qr = gd(() => import("./Room-BF09Vy23.js").then((e) => e.R));
6889
+ function Vr() {
6883
6890
  return /* @__PURE__ */ S("div", { className: "flex-1 flex items-center justify-center bg-black", children: /* @__PURE__ */ S("div", { className: "text-text-secondary text-sm", children: "Loading room..." }) });
6884
6891
  }
6885
- function bd() {
6886
- const e = be(), t = Ms(), n = vd({
6892
+ function wd() {
6893
+ const e = be(), t = Ms(), n = bd({
6887
6894
  roomKey: t.roomKey,
6888
6895
  hostname: window.location.hostname,
6889
6896
  pathname: window.location.pathname,
6890
6897
  search: window.location.search
6891
6898
  });
6892
- return n ? (window.location.replace(n), null) : t.roomKey ? /* @__PURE__ */ S(ye.Suspense, { fallback: /* @__PURE__ */ S(zr, {}), children: /* @__PURE__ */ S(Vr, {}) }) : e.pathname === "/" || e.pathname === "" ? /* @__PURE__ */ S(Qu, {}) : e.pathname.startsWith("/room") ? /* @__PURE__ */ S(ye.Suspense, { fallback: /* @__PURE__ */ S(zr, {}), children: /* @__PURE__ */ S(Vr, {}) }) : /* @__PURE__ */ S("div", { className: "p-6", children: "Not Found" });
6899
+ return n ? (window.location.replace(n), null) : t.roomKey ? /* @__PURE__ */ S(ye.Suspense, { fallback: /* @__PURE__ */ S(Vr, {}), children: /* @__PURE__ */ S(qr, {}) }) : e.pathname === "/" || e.pathname === "" ? /* @__PURE__ */ S(Zu, {}) : e.pathname.startsWith("/room") ? /* @__PURE__ */ S(ye.Suspense, { fallback: /* @__PURE__ */ S(Vr, {}), children: /* @__PURE__ */ S(qr, {}) }) : /* @__PURE__ */ S("div", { className: "p-6", children: "Not Found" });
6893
6900
  }
6894
6901
  function sn(e) {
6895
- const [t, n] = ti(!1), r = eo(), i = {
6902
+ const [t, n] = ei(!1), r = eo(), i = {
6896
6903
  serverOrigin: e.serverOrigin || Ve.serverOrigin,
6897
6904
  defaultRoomKey: e.defaultRoomKey || Ve.defaultRoomKey,
6898
6905
  cdnBase: e.cdnBase || Ve.cdnBase
6899
- }, o = Hi(i);
6906
+ }, o = qi(i);
6900
6907
  return he(() => {
6901
6908
  const s = new AbortController();
6902
6909
  async function a() {
6903
- const c = o + mr;
6910
+ const c = o + pr;
6904
6911
  m("app", "Checking API health", { url: c });
6905
6912
  try {
6906
6913
  const u = await fetch(c, {
@@ -6908,7 +6915,7 @@ function sn(e) {
6908
6915
  signal: s.signal
6909
6916
  });
6910
6917
  if (s.signal.aborted) return;
6911
- u.ok ? (m("app", "API health check passed"), cd(o), hd(o)) : (pe("app", "API health check failed", { status: u.status }), n(!0));
6918
+ u.ok ? (m("app", "API health check passed"), ld(o), fd(o)) : (pe("app", "API health check failed", { status: u.status }), n(!0));
6912
6919
  } catch (u) {
6913
6920
  if (u?.name === "AbortError") return;
6914
6921
  pe("app", "API unreachable", { url: c, error: u }), n(!0);
@@ -6918,7 +6925,7 @@ function sn(e) {
6918
6925
  }, [o]), he(() => {
6919
6926
  if (!t) return;
6920
6927
  async function s() {
6921
- const c = o + mr;
6928
+ const c = o + pr;
6922
6929
  try {
6923
6930
  (await fetch(c, {
6924
6931
  cache: "no-store",
@@ -6936,7 +6943,7 @@ function sn(e) {
6936
6943
  function s() {
6937
6944
  m("app", "Preloading character sprites", { count: Ae.length });
6938
6945
  for (const c of Ae) {
6939
- const u = Xi(c);
6946
+ const u = Qi(c);
6940
6947
  if (!u) continue;
6941
6948
  const d = new Image();
6942
6949
  d.crossOrigin = "anonymous", d.decoding = "async", d.loading = "eager", d.src = u;
@@ -6946,19 +6953,19 @@ function sn(e) {
6946
6953
  "requestIdleCallback" in window ? window.requestIdleCallback(s, { timeout: 2e3 }) : setTimeout(s, 600);
6947
6954
  }
6948
6955
  document.readyState === "complete" ? a() : window.addEventListener("load", a, { once: !0 });
6949
- }, []), t ? /* @__PURE__ */ S(Zu, {}) : (
6956
+ }, []), t ? /* @__PURE__ */ S(ed, {}) : (
6950
6957
  // HadokuThemeRoot must sit above everything that reads the theme —
6951
6958
  // <HadokuThemePicker> in ChatPanel throws without it, by design, so a
6952
6959
  // missing provider is a mount-time error rather than a silently wrong
6953
6960
  // theme. It also applies data-theme, which this app previously did through
6954
6961
  // its own useTheme() call.
6955
- /* @__PURE__ */ S(zo, { children: /* @__PURE__ */ S(ji.Provider, { value: i, children: /* @__PURE__ */ J("div", { className: "h-screen flex flex-col bg-bg", "data-tv": r ? "" : void 0, children: [
6956
- /* @__PURE__ */ S("main", { className: "flex-1 w-full overflow-hidden min-h-0 flex flex-col", children: /* @__PURE__ */ S(bd, {}) }),
6957
- /* @__PURE__ */ S(gl, {})
6962
+ /* @__PURE__ */ S(zo, { children: /* @__PURE__ */ S(Hi.Provider, { value: i, children: /* @__PURE__ */ J("div", { className: "h-screen flex flex-col bg-bg", "data-tv": r ? "" : void 0, children: [
6963
+ /* @__PURE__ */ S("main", { className: "flex-1 w-full overflow-hidden min-h-0 flex flex-col", children: /* @__PURE__ */ S(wd, {}) }),
6964
+ /* @__PURE__ */ S(yl, {})
6958
6965
  ] }) }) })
6959
6966
  );
6960
6967
  }
6961
- function wd({ basename: e = "/watchparty", appProps: t = {} }) {
6968
+ function _d({ basename: e = "/watchparty", appProps: t = {} }) {
6962
6969
  return /* @__PURE__ */ S(ba, { basename: e, children: /* @__PURE__ */ J(Ys, { children: [
6963
6970
  /* @__PURE__ */ S(mt, { path: "/", element: /* @__PURE__ */ S(sn, { ...t }) }),
6964
6971
  /* @__PURE__ */ S(mt, { path: "/room/:roomKey", element: /* @__PURE__ */ S(sn, { ...t }) }),
@@ -6969,7 +6976,7 @@ let Rt;
6969
6976
  function Co() {
6970
6977
  return ie(Jo) || void 0;
6971
6978
  }
6972
- function _d() {
6979
+ function Ed() {
6973
6980
  if (Rt) return;
6974
6981
  const e = Co();
6975
6982
  if (e) {
@@ -6982,52 +6989,52 @@ function _d() {
6982
6989
  m("identity", "device id unavailable — joining without one");
6983
6990
  });
6984
6991
  }
6985
- function Ed() {
6992
+ function Sd() {
6986
6993
  return Rt ??= Co();
6987
6994
  }
6988
- const Sd = 5e3;
6989
- function Td(e, t, n) {
6995
+ const Td = 5e3;
6996
+ function kd(e, t, n) {
6990
6997
  return !!e?.some((r) => r.emoji === t && r.by.includes(n));
6991
6998
  }
6992
- function kd(e, t, n) {
6999
+ function Rd(e, t, n) {
6993
7000
  let r = e ?? [];
6994
- for (const [i, o] of t) r = Xc(r, i, n, o.on) ?? r;
7001
+ for (const [i, o] of t) r = mc(r, i, n, o.on) ?? r;
6995
7002
  return r;
6996
7003
  }
6997
- function Rd(e, t, n, r) {
7004
+ function xd(e, t, n, r) {
6998
7005
  const i = /* @__PURE__ */ new Map();
6999
7006
  for (const [o, s] of t)
7000
- s.expires <= r || Td(e, o, n) !== s.on && i.set(o, s);
7007
+ s.expires <= r || kd(e, o, n) !== s.on && i.set(o, s);
7001
7008
  return i;
7002
7009
  }
7003
7010
  const Qe = /* @__PURE__ */ new Map();
7004
- function Gn(e, t) {
7005
- if (t.intents = Rd(t.confirmed, t.intents, t.handle, Date.now()), T.getState().setReactions(e, kd(t.confirmed, t.intents, t.handle)), t.timer && clearTimeout(t.timer), t.timer = null, t.intents.size === 0) {
7011
+ function Wn(e, t) {
7012
+ if (t.intents = xd(t.confirmed, t.intents, t.handle, Date.now()), T.getState().setReactions(e, Rd(t.confirmed, t.intents, t.handle)), t.timer && clearTimeout(t.timer), t.timer = null, t.intents.size === 0) {
7006
7013
  Qe.delete(e);
7007
7014
  return;
7008
7015
  }
7009
7016
  const n = Math.min(...[...t.intents.values()].map((r) => r.expires));
7010
7017
  t.timer = setTimeout(() => {
7011
- Qe.get(e) === t && Gn(e, t);
7018
+ Qe.get(e) === t && Wn(e, t);
7012
7019
  }, Math.max(0, n - Date.now()));
7013
7020
  }
7014
7021
  function df(e, t, n, r) {
7015
7022
  let i = Qe.get(e);
7016
- i || (i = { confirmed: T.getState().chat.find((s) => s.id === e)?.reactions, intents: /* @__PURE__ */ new Map(), handle: r, timer: null }, Qe.set(e, i)), i.handle = r, i.intents.delete(t), i.intents.set(t, { on: n, expires: Date.now() + Sd }), Gn(e, i);
7023
+ i || (i = { confirmed: T.getState().chat.find((s) => s.id === e)?.reactions, intents: /* @__PURE__ */ new Map(), handle: r, timer: null }, Qe.set(e, i)), i.handle = r, i.intents.delete(t), i.intents.set(t, { on: n, expires: Date.now() + Td }), Wn(e, i);
7017
7024
  }
7018
- function xd(e, t) {
7025
+ function Cd(e, t) {
7019
7026
  const n = Qe.get(e);
7020
7027
  if (!n) {
7021
7028
  T.getState().setReactions(e, t);
7022
7029
  return;
7023
7030
  }
7024
- n.confirmed = t, Gn(e, n);
7031
+ n.confirmed = t, Wn(e, n);
7025
7032
  }
7026
- function Cd(e) {
7033
+ function Ad(e) {
7027
7034
  const t = typeof window < "u" ? window.location.href : "http://localhost/", n = new URL(e, t).pathname;
7028
7035
  return `${n.endsWith("/") ? n : `${n}/`}socket.io/`;
7029
7036
  }
7030
- function Wr(e, t) {
7037
+ function zr(e, t) {
7031
7038
  return {
7032
7039
  id: String(e.id ?? e.server_seq ?? t ?? `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`),
7033
7040
  clientId: e.client_id,
@@ -7039,11 +7046,11 @@ function Wr(e, t) {
7039
7046
  // Attachments arrive from other clients, so the key shape is re-checked
7040
7047
  // here at the boundary rather than trusted at render time. A malformed
7041
7048
  // entry is dropped, not rendered and not allowed near an <img src>.
7042
- images: Array.isArray(e.images) ? e.images.filter((n) => !!n && Ti(n.key)).slice(0, In) : void 0,
7049
+ images: Array.isArray(e.images) ? e.images.filter((n) => !!n && Si(n.key)).slice(0, In) : void 0,
7043
7050
  isSystem: e.isSystem || !1,
7044
7051
  systemType: e.systemType,
7045
7052
  template: e.isSystem && typeof e.template == "string" && e.template.includes(Ba) ? e.template : void 0,
7046
- replyTo: typeof e.reply_to == "string" && Ci.test(e.reply_to) ? e.reply_to : void 0,
7053
+ replyTo: typeof e.reply_to == "string" && xi.test(e.reply_to) ? e.reply_to : void 0,
7047
7054
  reactions: Ao(e.reactions)
7048
7055
  };
7049
7056
  }
@@ -7055,44 +7062,44 @@ function Ao(e) {
7055
7062
  });
7056
7063
  return t.length ? t : void 0;
7057
7064
  }
7058
- function Ad(e, t = () => !0) {
7065
+ function Id(e, t = () => !0) {
7059
7066
  e.on(P.CHAT_BROADCAST, (n) => {
7060
7067
  if (!t()) return;
7061
- const r = { ...Wr(n, n.server_seq), live: !0 };
7068
+ const r = { ...zr(n, n.server_seq), live: !0 };
7062
7069
  T.getState().appendChat(r), m("chat", "Message received", r);
7063
7070
  }), e.on(P.CHAT_HISTORY, (n) => {
7064
7071
  if (!t() || !n?.messages || !Array.isArray(n.messages)) return;
7065
- const r = n.messages.map((i) => Wr(i));
7072
+ const r = n.messages.map((i) => zr(i));
7066
7073
  T.getState().setChat(r), m("chat", "History loaded", { count: r.length });
7067
7074
  }), e.on(P.CHAT_REACTION, (n) => {
7068
- t() && (!n || typeof n.id != "string" || xd(n.id, Ao(n.reactions) ?? []));
7075
+ t() && (!n || typeof n.id != "string" || Cd(n.id, Ao(n.reactions) ?? []));
7069
7076
  }), e.on(P.CHAT_TYPING, (n) => {
7070
7077
  t() && (!n || typeof n.client_id != "string" || typeof n.typing != "boolean" || T.getState().setTyping(n.client_id, n.typing));
7071
7078
  });
7072
7079
  }
7073
- let Id = null;
7074
- function Pd(e = Id) {
7080
+ let Pd = null;
7081
+ function Od(e = Pd) {
7075
7082
  if (!e) return null;
7076
7083
  const t = typeof window < "u" ? window.location.href : "http://localhost/", n = e.namespace ?? "/room";
7077
7084
  return {
7078
7085
  url: `${new URL(e.origin, t).origin}${n.startsWith("/") ? n : `/${n}`}`,
7079
- path: e.path ?? Cd(e.origin)
7086
+ path: e.path ?? Ad(e.origin)
7080
7087
  };
7081
7088
  }
7082
7089
  function hf(e) {
7083
7090
  const n = `${Ft()}/media/${e}`.replace(/\\/g, "/");
7084
- return { mediaUrl: `${n}/${Qa}`, indexUrl: `${n}/index.json` };
7091
+ return { mediaUrl: `${n}/${Ja}`, indexUrl: `${n}/index.json` };
7085
7092
  }
7086
- function Od(e) {
7093
+ function Ld(e) {
7087
7094
  return `${Ft()}/media/${e}`.replace(/\\/g, "/");
7088
7095
  }
7089
- function Ld(e, t) {
7090
- return Od(t ?? `${e}/poster.jpg`);
7096
+ function Md(e, t) {
7097
+ return Ld(t ?? `${e}/poster.jpg`);
7091
7098
  }
7092
7099
  function Io(e) {
7093
7100
  return `${Ft()}${e}`.replace(/\\/g, "/");
7094
7101
  }
7095
- async function Md(e) {
7102
+ async function Nd(e) {
7096
7103
  try {
7097
7104
  const t = await fetch(Io("/api/tierlist"));
7098
7105
  if (!t.ok)
@@ -7107,15 +7114,15 @@ async function Md(e) {
7107
7114
  return L("tierlist", "Board fetch threw", te(t)), null;
7108
7115
  }
7109
7116
  }
7110
- let Gr = !1;
7117
+ let Wr = !1;
7111
7118
  function ff() {
7112
- if (Gr || typeof Image > "u") return;
7119
+ if (Wr || typeof Image > "u") return;
7113
7120
  const e = T.getState().tierlist;
7114
7121
  if (!(!e || e.items.length === 0)) {
7115
- Gr = !0;
7122
+ Wr = !0;
7116
7123
  for (const t of e.items) {
7117
7124
  const n = new Image();
7118
- n.decoding = "async", n.src = Ld(t.id, t.thumbnail);
7125
+ n.decoding = "async", n.src = Md(t.id, t.thumbnail);
7119
7126
  }
7120
7127
  m("tierlist", "Warming posters", { count: e.items.length });
7121
7128
  }
@@ -7138,21 +7145,21 @@ async function pf(e) {
7138
7145
  T.getState().setTierlistSaving(!1);
7139
7146
  }
7140
7147
  }
7141
- function Nd() {
7142
- const e = T.getState(), t = Qi(Object.values(e.roster).map((i) => i.sprite), void 0, Ae);
7148
+ function Dd() {
7149
+ const e = T.getState(), t = Ni(Object.values(e.roster).map((i) => i.sprite), void 0, Ae);
7143
7150
  if (!t)
7144
7151
  return L("socket", "sprite_taken: no available sprites to retry with"), null;
7145
7152
  const n = !!e.name && !Ee(e.name), r = n ? e.name : Xe(t);
7146
7153
  return m("socket", "sprite_taken: retrying with a free character", { from: e.sprite, to: t, name: r, keptCustomName: n }), e.setSessionIdentity(r, t), { name: r, sprite: t };
7147
7154
  }
7148
- function Dd(e) {
7155
+ function $d(e) {
7149
7156
  const t = T.getState(), n = e ? t.roster[e] : void 0;
7150
7157
  return !n || !!n.sprite && n.sprite === t.sprite;
7151
7158
  }
7152
- var $d = "https://hadoku.me/prefs", Kr = "hadoku-avatar-link", Bd = "hadoku-avatar-link", Yr = "hadoku-avatar-link-popup";
7153
- function Jr(e) {
7159
+ var Bd = "https://hadoku.me/prefs", Gr = "hadoku-avatar-link", Fd = "hadoku-avatar-link", Kr = "hadoku-avatar-link-popup";
7160
+ function Yr(e) {
7154
7161
  try {
7155
- e ? sessionStorage.setItem(Yr, "1") : sessionStorage.removeItem(Yr);
7162
+ e ? sessionStorage.setItem(Kr, "1") : sessionStorage.removeItem(Kr);
7156
7163
  } catch {
7157
7164
  }
7158
7165
  }
@@ -7162,22 +7169,22 @@ var Lt = class extends Error {
7162
7169
  }
7163
7170
  status;
7164
7171
  };
7165
- async function Fd(e) {
7172
+ async function Ud(e) {
7166
7173
  if (!e.ok) {
7167
7174
  const t = await e.json().catch(() => null);
7168
7175
  throw new Lt(e.status, t?.message ?? `HTTP ${e.status}`);
7169
7176
  }
7170
7177
  return await e.json();
7171
7178
  }
7172
- function Ud(e = {}) {
7173
- const t = `${e.baseUrl ?? $d}/api/v1/_avatar`, n = e.fetch ?? fetch, r = (a, c = {}) => n(`${t}${a}`, { credentials: "include", ...c }).then(Fd), i = (a, c, u) => r(a, {
7179
+ function jd(e = {}) {
7180
+ const t = `${e.baseUrl ?? Bd}/api/v1/_avatar`, n = e.fetch ?? fetch, r = (a, c = {}) => n(`${t}${a}`, { credentials: "include", ...c }).then(Ud), i = (a, c, u) => r(a, {
7174
7181
  method: c,
7175
7182
  ...u === void 0 ? {} : { headers: { "Content-Type": "application/json" }, body: JSON.stringify(u) }
7176
7183
  }), o = () => r("");
7177
7184
  async function s(a) {
7178
- Jr(!0);
7179
- const c = window.open("about:blank", Bd, "popup,width=520,height=760");
7180
- if (Jr(!1), !c)
7185
+ Yr(!0);
7186
+ const c = window.open("about:blank", Fd, "popup,width=520,height=760");
7187
+ if (Yr(!1), !c)
7181
7188
  throw new Lt(0, "The sign-in window was blocked: allow pop-ups for hadoku.me");
7182
7189
  let u;
7183
7190
  try {
@@ -7186,13 +7193,13 @@ function Ud(e = {}) {
7186
7193
  throw c.close(), d;
7187
7194
  }
7188
7195
  return c.location.href = u, new Promise((d, h) => {
7189
- const v = new BroadcastChannel(Kr);
7196
+ const v = new BroadcastChannel(Gr);
7190
7197
  let b = !1;
7191
7198
  const E = (_) => {
7192
7199
  b || (b = !0, v.close(), clearInterval(w), clearTimeout(f), _ ? h(new Lt(400, _)) : o().then(d, h));
7193
7200
  };
7194
7201
  v.onmessage = (_) => {
7195
- _.data?.type === Kr && E(_.data.ok ? void 0 : _.data.error);
7202
+ _.data?.type === Gr && E(_.data.ok ? void 0 : _.data.error);
7196
7203
  };
7197
7204
  const w = setInterval(() => {
7198
7205
  c.closed && (clearInterval(w), setTimeout(() => E(), 1500));
@@ -7237,15 +7244,15 @@ function Ud(e = {}) {
7237
7244
  setCosmetics: (a) => i("/cosmetics", "PUT", a)
7238
7245
  };
7239
7246
  }
7240
- var Xr = "hadoku:avatar";
7241
- function Kn(e) {
7247
+ var Jr = "hadoku:avatar";
7248
+ function Gn(e) {
7242
7249
  return e?.sprite ?? e?.avatar?.sprite ?? null;
7243
7250
  }
7244
- async function jd(e = {}) {
7251
+ async function Hd(e = {}) {
7245
7252
  const t = typeof location > "u" ? void 0 : location.origin, n = e.baseUrl ?? (t ? `${t}/prefs` : void 0);
7246
7253
  if (!n) return null;
7247
7254
  try {
7248
- return Kn(await Ud({ baseUrl: n, fetch: e.fetch }).get());
7255
+ return Gn(await jd({ baseUrl: n, fetch: e.fetch }).get());
7249
7256
  } catch (r) {
7250
7257
  return r instanceof Lt && [401, 403, 404].includes(r.status) || (e.onError ?? ((i) => console.warn("[prefs-client] avatar settings unreadable", i)))(r), null;
7251
7258
  }
@@ -7255,30 +7262,30 @@ function mf(e) {
7255
7262
  };
7256
7263
  const t = (n) => {
7257
7264
  const r = n.detail;
7258
- r && e(Kn(r), r);
7265
+ r && e(Gn(r), r);
7259
7266
  };
7260
- return window.addEventListener(Xr, t), () => window.removeEventListener(Xr, t);
7267
+ return window.addEventListener(Jr, t), () => window.removeEventListener(Jr, t);
7261
7268
  }
7262
- const Hd = "hadoku:name";
7269
+ const qd = "hadoku:name";
7263
7270
  function gf(e) {
7264
- const t = Kn(e);
7271
+ const t = Gn(e);
7265
7272
  return Bt(t) ? t : null;
7266
7273
  }
7267
7274
  async function yf(e = {}) {
7268
- const t = await jd({
7275
+ const t = await Hd({
7269
7276
  ...e,
7270
7277
  onError: (r) => L("avatar", "Avatar settings read failed — keeping the auto-assigned character", te(r))
7271
7278
  }), n = Bt(t) ? t : null;
7272
7279
  return m("avatar", "Requested character from prefs-api", { sprite: n }), n;
7273
7280
  }
7274
- function Qr(e) {
7281
+ function Xr(e) {
7275
7282
  if (!e) return !1;
7276
7283
  const t = T.getState();
7277
7284
  if (t.sprite === e) return !1;
7278
7285
  const r = !!(t.me.clientId && t.roster[t.me.clientId]?.registryName) || !t.name || !Ee(t.name) ? t.name : Xe(e);
7279
7286
  return t.setSessionIdentity(r, e), !0;
7280
7287
  }
7281
- function qd(e, t, n) {
7288
+ function Vd(e, t, n) {
7282
7289
  if (!n) return () => {
7283
7290
  };
7284
7291
  const r = (i) => {
@@ -7287,25 +7294,25 @@ function qd(e, t, n) {
7287
7294
  };
7288
7295
  return n.addEventListener(e, r), () => n.removeEventListener(e, r);
7289
7296
  }
7290
- const Vd = () => typeof window > "u" ? void 0 : window;
7291
- function vf(e, t = Vd()) {
7292
- return qd(Hd, (n) => {
7297
+ const zd = () => typeof window > "u" ? void 0 : window;
7298
+ function vf(e, t = zd()) {
7299
+ return Vd(qd, (n) => {
7293
7300
  typeof n.name == "string" && n.name.trim() && e(n.name);
7294
7301
  }, t);
7295
7302
  }
7296
- const zd = 10;
7297
- function Wd(e = typeof window < "u" ? window : void 0) {
7303
+ const Wd = 10;
7304
+ function Gd(e = typeof window < "u" ? window : void 0) {
7298
7305
  if (!e) return { framed: !1, depth: 0 };
7299
7306
  try {
7300
7307
  let t = 0, n = e;
7301
- for (; n !== n.parent && t < zd; )
7308
+ for (; n !== n.parent && t < Wd; )
7302
7309
  t++, n = n.parent;
7303
7310
  return { framed: e.top ? e.top !== e.self : t > 0, depth: t };
7304
7311
  } catch {
7305
7312
  return { framed: !1, depth: 0 };
7306
7313
  }
7307
7314
  }
7308
- function Gd(e, t) {
7315
+ function Kd(e, t) {
7309
7316
  let n = 0;
7310
7317
  for (const r of e.videos) {
7311
7318
  const i = Le.voteKey(t, e.id, r.mediaId);
@@ -7313,56 +7320,48 @@ function Gd(e, t) {
7313
7320
  }
7314
7321
  return n;
7315
7322
  }
7316
- const Kd = 2e4, Yd = 1e4;
7317
- function Jd() {
7323
+ const Yd = 2e4, Jd = 1e4;
7324
+ function Xd() {
7318
7325
  return { unansweredSince: null, lastPongAt: null, lastTickAt: null };
7319
7326
  }
7320
- function Xd(e, t) {
7327
+ function Qd(e, t) {
7321
7328
  e.lastPongAt = t, e.unansweredSince = null;
7322
7329
  }
7323
- function Qd(e, t, n) {
7324
- const r = e.lastTickAt !== null && t - e.lastTickAt > Yd;
7325
- return e.lastTickAt = t, n ? r || e.unansweredSince === null ? (e.unansweredSince = t, !1) : t - e.unansweredSince > Kd : (e.unansweredSince = null, !1);
7330
+ function Zd(e, t, n) {
7331
+ const r = e.lastTickAt !== null && t - e.lastTickAt > Jd;
7332
+ return e.lastTickAt = t, n ? r || e.unansweredSince === null ? (e.unansweredSince = t, !1) : t - e.unansweredSince > Yd : (e.unansweredSince = null, !1);
7326
7333
  }
7327
7334
  function Po(e, t) {
7328
7335
  return e.lastPongAt === null ? void 0 : Math.max(0, t - e.lastPongAt);
7329
7336
  }
7330
7337
  let A = null, ee = null, xt = null, ne = null, me = null;
7331
- const Zd = th(), _e = Jd();
7332
- let ht = null, an = null, Zr = 0, Yn = null, Ze = !1, Jn = !1, je = !1, Xn = null;
7338
+ const eh = dc(), _e = Xd();
7339
+ let ht = null, an = null, Qr = 0, Kn = null, Ze = !1, Yn = !1, je = !1, Jn = null;
7333
7340
  function bf(e) {
7334
7341
  const t = W(), n = T.getState();
7335
7342
  if (n.me.clientId && n.roster[n.me.clientId])
7336
7343
  return (e.name || e.sprite) && (m("socket", "Identity update (already joined)", { name: e.name, sprite: e.sprite }), t.emit(P.IDENTITY_UPDATE, { name: e.name, sprite: e.sprite })), t;
7337
- const r = eh(e);
7338
- return me = r, Yn = { name: r.name, sprite: r.sprite }, t.connected ? (m("socket", "Emitting join", r), t.emit(P.JOIN, r)) : t.once("connect", () => {
7344
+ const r = th(e);
7345
+ return me = r, Kn = { name: r.name, sprite: r.sprite }, t.connected ? (m("socket", "Emitting join", r), t.emit(P.JOIN, r)) : t.once("connect", () => {
7339
7346
  m("socket", "Emitting join", r), t.emit(P.JOIN, r);
7340
7347
  }), t;
7341
7348
  }
7342
- function eh(e) {
7349
+ function th(e) {
7343
7350
  return {
7344
7351
  room_key: e.room_key,
7345
7352
  name: e.name,
7346
7353
  sprite: e.sprite,
7347
7354
  // Entry-path telemetry — see lib/embedContext.ts. Sent on every join AND
7348
7355
  // rejoin (lastJoinPayload carries it), so a reconnect keeps the attribution.
7349
- embed: Wd(),
7350
- delivery_arm: ld(),
7356
+ embed: Gd(),
7357
+ delivery_arm: ud(),
7351
7358
  // Identity tier input — see lib/deviceId.ts. Sent on every join AND rejoin
7352
7359
  // (lastJoinPayload carries it) so a reconnect lands on the same
7353
7360
  // ParticipantId rather than minting a new person.
7354
- device_id: Ed(),
7355
- tab_id: Zd
7361
+ device_id: Sd(),
7362
+ tab_id: eh
7356
7363
  };
7357
7364
  }
7358
- function th() {
7359
- const e = globalThis.crypto;
7360
- if (e && typeof e.randomUUID == "function") return e.randomUUID();
7361
- const t = new Uint8Array(16);
7362
- if (e && typeof e.getRandomValues == "function") e.getRandomValues(t);
7363
- else for (let n = 0; n < t.length; n++) t[n] = Math.floor(Math.random() * 256);
7364
- return Array.from(t, (n) => n.toString(16).padStart(2, "0")).join("");
7365
- }
7366
7365
  function wf() {
7367
7366
  return Po(_e, Date.now());
7368
7367
  }
@@ -7373,15 +7372,15 @@ function W() {
7373
7372
  const r = window.location;
7374
7373
  (r.hostname === "localhost" || r.hostname === "127.0.0.1") && r.port === String($t) && (t = `${r.protocol}//${r.hostname}:${rt}`, m("socket", "Using dev fallback origin", { origin: t }));
7375
7374
  }
7376
- const n = Pd();
7375
+ const n = Od();
7377
7376
  if (n)
7378
7377
  A = Re(n.url, { path: n.path, transports: ["websocket", "polling"] }), m("socket", "Socket initialized on the room origin", n);
7379
7378
  else {
7380
7379
  const r = new URL(t.startsWith("http") ? t : `${window.location.origin}${t}`).origin;
7381
- A = Re(r, { path: ki, transports: ["websocket", "polling"] }), m("socket", "Socket initialized", { origin: t });
7380
+ A = Re(r, { path: Ti, transports: ["websocket", "polling"] }), m("socket", "Socket initialized", { origin: t });
7382
7381
  }
7383
7382
  jt("__SOCKET__", A), ne && (clearTimeout(ne), ne = null), ee = null, xt = setInterval(() => {
7384
- if (Qd(_e, Date.now(), !!A?.connected)) {
7383
+ if (Zd(_e, Date.now(), !!A?.connected)) {
7385
7384
  L("socket", "PONG-WATCHDOG no time_pong for 20s — replacing the connection", {
7386
7385
  sid: A?.id,
7387
7386
  lastPongAgeMs: Po(_e, Date.now()) ?? null
@@ -7389,8 +7388,8 @@ function W() {
7389
7388
  return;
7390
7389
  }
7391
7390
  dh();
7392
- }, Xa), A.on("connect", () => {
7393
- Jn = !1;
7391
+ }, Ya), A.on("connect", () => {
7392
+ Yn = !1;
7394
7393
  const r = A?.id;
7395
7394
  if (m("socket", "Connected", { id: r, isReconnect: je }), r)
7396
7395
  try {
@@ -7400,17 +7399,17 @@ function W() {
7400
7399
  }
7401
7400
  if (je && me) {
7402
7401
  const i = T.getState();
7403
- Zr += 1;
7402
+ Qr += 1;
7404
7403
  const o = {
7405
7404
  ...me,
7406
7405
  name: i.name,
7407
7406
  sprite: i.sprite,
7408
7407
  reconnect: {
7409
- count: Zr,
7408
+ count: Qr,
7410
7409
  reason: (ht?.reason ?? "unknown").slice(0, 64),
7411
7410
  offline_ms: ht ? Math.max(0, Date.now() - ht.at) : 0
7412
7411
  }
7413
- }, s = Xn;
7412
+ }, s = Jn;
7414
7413
  if (m("socket", "Re-emitting join after reconnect", { room_key: o.room_key, name: o.name, sprite: o.sprite }), s) {
7415
7414
  let a = !1;
7416
7415
  const c = () => {
@@ -7420,11 +7419,11 @@ function W() {
7420
7419
  a || (a = !0, A.off(P.SNAPSHOT, c), L("socket", "client_ready re-emit timed out waiting for snapshot", { mediaId: s }));
7421
7420
  }, 1e4);
7422
7421
  }
7423
- Yn = { name: o.name, sprite: o.sprite }, A.emit(P.JOIN, o), window.dispatchEvent(new CustomEvent("watchparty:socket-reconnect"));
7422
+ Kn = { name: o.name, sprite: o.sprite }, A.emit(P.JOIN, o), window.dispatchEvent(new CustomEvent("watchparty:socket-reconnect"));
7424
7423
  } else je && L("socket", "Reconnected — no join payload, not re-joining any room");
7425
7424
  je = !0;
7426
7425
  }), A.on("disconnect", (r) => {
7427
- Wi(null), ht = { reason: an ?? r, at: Date.now() }, an = null, m("socket", "Disconnected", { reason: r });
7426
+ Gi(null), ht = { reason: an ?? r, at: Date.now() }, an = null, m("socket", "Disconnected", { reason: r });
7428
7427
  }), A.on("connect_error", (r) => pe("socket", "Connection error", { message: r?.message })), A.on("reconnect_attempt", (r) => L("socket", "Reconnect attempt", { attempt: r })), A.on("reconnect_failed", () => pe("socket", "Reconnect failed")), uh(A);
7429
7428
  }
7430
7429
  return A;
@@ -7442,7 +7441,7 @@ function nh(e) {
7442
7441
  serverSeq: t.server_seq || 0,
7443
7442
  leaderId: t.leader_id || null
7444
7443
  }), T.getState().name || m("socket", "Deferring identity to presence event (snapshot carries no roster)");
7445
- const n = T.getState(), r = A?.id, o = (r ? n.roster[r] : void 0) ?? Yn, s = Wc(
7444
+ const n = T.getState(), r = A?.id, o = (r ? n.roster[r] : void 0) ?? Kn, s = ac(
7446
7445
  { name: n.name, avatarId: n.sprite },
7447
7446
  o ? { name: o.name, avatarId: o.sprite ?? null } : void 0,
7448
7447
  // A join that carried no name counts as a default one, so a name that
@@ -7452,7 +7451,7 @@ function nh(e) {
7452
7451
  if (s) {
7453
7452
  const a = {
7454
7453
  ...s.name !== void 0 ? { name: s.name } : {},
7455
- ...s.avatarId !== void 0 && !Jn ? { sprite: s.avatarId } : {}
7454
+ ...s.avatarId !== void 0 && !Yn ? { sprite: s.avatarId } : {}
7456
7455
  };
7457
7456
  Object.keys(a).length > 0 && (m("socket", "Identity update on snapshot", a), e.emit(P.IDENTITY_UPDATE, a));
7458
7457
  }
@@ -7463,7 +7462,7 @@ function nh(e) {
7463
7462
  leaderId: t.leader_id || null,
7464
7463
  serverSeq: t.server_seq || 0,
7465
7464
  rosterSize: Object.keys(n.roster).length
7466
- }), me?.room_key && A?.id && Wi({ room_key: me.room_key, client_id: A.id });
7465
+ }), me?.room_key && A?.id && Gi({ room_key: me.room_key, client_id: A.id });
7467
7466
  }), e.on(P.CONTROL_BROADCAST, (t) => {
7468
7467
  const n = T.getState();
7469
7468
  if (Object.prototype.hasOwnProperty.call(t, "media_id")) {
@@ -7485,7 +7484,7 @@ function nh(e) {
7485
7484
  }), e.on(P.CONTROL_ACK, (t) => {
7486
7485
  typeof t?.client_seq == "number" && typeof t?.server_seq == "number" && m("socket", "Control ack received", t);
7487
7486
  }), e.on(P.TIME_PONG, (t) => {
7488
- if (Xd(_e, Date.now()), ee && ee.ts) {
7487
+ if (Qd(_e, Date.now()), ee && ee.ts) {
7489
7488
  const n = Date.now() - ee.ts;
7490
7489
  T.getState().addRttSample(n, t?.server_ts, ee.ts), ee = null, ne && (clearTimeout(ne), ne = null), m("socket", "Time sync RTT", { rtt: n, offset: T.getState().drift.offsetMs });
7491
7490
  }
@@ -7496,7 +7495,7 @@ function nh(e) {
7496
7495
  });
7497
7496
  }
7498
7497
  function rh(e) {
7499
- const t = ku(e);
7498
+ const t = Ru(e);
7500
7499
  return t ? { cosmetics: t } : {};
7501
7500
  }
7502
7501
  function ih(e) {
@@ -7548,16 +7547,16 @@ function oh(e) {
7548
7547
  T.getState().setPlaylistResults(t ?? null), m("playlist", "Results received", { playlistId: t?.playlist?.id, update: t?.update === !0 });
7549
7548
  }), e.on(de.VOTES_CLEARED, (t) => {
7550
7549
  if (!t?.playlistId || !Array.isArray(t.mediaIds)) return;
7551
- const n = Gd(
7550
+ const n = Kd(
7552
7551
  { id: t.playlistId, videos: t.mediaIds.map((i) => ({ mediaId: i })) },
7553
- sl()
7552
+ al()
7554
7553
  ), r = T.getState();
7555
7554
  r.playlist?.id === t.playlistId && r.applyPlaylistState({ playlist: r.playlist, activeIndex: r.activePlaylistIndex, myVotes: {} }), m("playlist", "Votes cleared by leader", { playlistId: t.playlistId, removed: n });
7556
7555
  });
7557
7556
  }
7558
7557
  function sh(e) {
7559
7558
  e.on(Wa.UPDATED, () => {
7560
- m("tierlist", "Someone saved — refreshing the board"), Md(!1);
7559
+ m("tierlist", "Someone saved — refreshing the board"), Nd(!1);
7561
7560
  });
7562
7561
  }
7563
7562
  function ah(e) {
@@ -7590,21 +7589,21 @@ function lh(e) {
7590
7589
  });
7591
7590
  }
7592
7591
  function uh(e) {
7593
- nh(e), ih(e), Ad(e, () => !0), lh(e), oh(e), sh(e), ah(e), ch(e), e.on(P.ERROR, (t) => {
7592
+ nh(e), ih(e), Id(e, () => !0), lh(e), oh(e), sh(e), ah(e), ch(e), e.on(P.ERROR, (t) => {
7594
7593
  const n = t?.code || "error/unknown";
7595
7594
  if (n === "conflict" && t?.message === "sprite_held_by_you") {
7596
- Jn = !0, m("socket", "sprite held by this account's other connection: keeping the server-assigned sprite");
7595
+ Yn = !0, m("socket", "sprite held by this account's other connection: keeping the server-assigned sprite");
7597
7596
  return;
7598
7597
  }
7599
7598
  if (n === "conflict" && t?.message === "sprite_taken") {
7600
- if (Dd(A?.id)) {
7599
+ if ($d(A?.id)) {
7601
7600
  m("socket", "sprite_taken: stale, the server already has our sprite");
7602
7601
  return;
7603
7602
  }
7604
7603
  Ze = !0;
7605
7604
  let s;
7606
7605
  try {
7607
- s = Nd();
7606
+ s = Dd();
7608
7607
  } finally {
7609
7608
  Ze = !1;
7610
7609
  }
@@ -7659,12 +7658,12 @@ function dh() {
7659
7658
  function xf(e) {
7660
7659
  const t = T.getState(), n = t.me.clientId;
7661
7660
  if (!n || !t.roster[n]) {
7662
- Qr(e), m("socket", "Avatar change before join: the join will carry it", { sprite: e });
7661
+ Xr(e), m("socket", "Avatar change before join: the join will carry it", { sprite: e });
7663
7662
  return;
7664
7663
  }
7665
7664
  Ze = !0;
7666
7665
  try {
7667
- Qr(e);
7666
+ Xr(e);
7668
7667
  } finally {
7669
7668
  Ze = !1;
7670
7669
  }
@@ -7694,7 +7693,7 @@ function fh() {
7694
7693
  xt && (clearInterval(xt), xt = null), ne && (clearTimeout(ne), ne = null), ee = null, _e.unansweredSince = null, _e.lastTickAt = null;
7695
7694
  }
7696
7695
  function ph() {
7697
- m("socket", "clearJoinState called", { hadPayload: me !== null, room_key: me?.room_key }), me = null, je = !1, Xn = null;
7696
+ m("socket", "clearJoinState called", { hadPayload: me !== null, room_key: me?.room_key }), me = null, je = !1, Jn = null;
7698
7697
  }
7699
7698
  function mh() {
7700
7699
  m("socket", "leaveRoom called", { room_key: me?.room_key }), ph(), fh(), A && (A.disconnect(), A = null), T.setState({
@@ -7734,7 +7733,7 @@ function Mf(e) {
7734
7733
  m("playlist", "Emitting playlist_vote_remove", { voterKey: e }), W().emit(de.VOTE_REMOVE, { voterKey: e });
7735
7734
  }
7736
7735
  function Nf(e) {
7737
- Xn = e, W().emit(P.CLIENT_READY, { media_id: e }), m("socket", "client_ready emitted", { mediaId: e });
7736
+ Jn = e, W().emit(P.CLIENT_READY, { media_id: e }), m("socket", "client_ready emitted", { mediaId: e });
7738
7737
  }
7739
7738
  function gh(e) {
7740
7739
  if (!e || e === "/" || document.querySelector(`link[rel="preconnect"][href="${e}"]`)) return;
@@ -7763,11 +7762,11 @@ function bh(e) {
7763
7762
  }
7764
7763
  function Df(e, t = {}) {
7765
7764
  const { basename: n, strictMode: r = !1, ...i } = t;
7766
- Ic(), Rc({
7765
+ $c(), Lc({
7767
7766
  serverOrigin: i.serverOrigin,
7768
7767
  defaultRoomKey: i.defaultRoomKey,
7769
7768
  cdnBase: i.cdnBase
7770
- }), _d(), rl({
7769
+ }), Ed(), il({
7771
7770
  userType: i.userType,
7772
7771
  userId: i.userId
7773
7772
  }), T.getState().rehydrateFromPrefs(), vh();
@@ -7786,7 +7785,7 @@ function Df(e, t = {}) {
7786
7785
  } catch (c) {
7787
7786
  L("boot", "prefs.beacon.threw", { err: c?.message });
7788
7787
  }
7789
- al().catch((c) => L("boot", "whoami threw", te(c))), fl().then((c) => {
7788
+ cl().catch((c) => L("boot", "whoami threw", te(c))), pl().then((c) => {
7790
7789
  c && T.getState().rehydrateFromPrefs();
7791
7790
  }).catch((c) => L("boot", "prefs sync threw", te(c))), xe || (xe = (c) => {
7792
7791
  pe("app", "Unhandled promise rejection", { reason: String(c.reason) });
@@ -7797,9 +7796,9 @@ function Df(e, t = {}) {
7797
7796
  stack: c.error instanceof Error ? c.error.stack?.slice(0, 1500) : void 0
7798
7797
  });
7799
7798
  }, window.addEventListener("error", Ce)), i.serverOrigin && gh(i.serverOrigin);
7800
- const o = $n().theme;
7801
- o && Wo.includes(o) && Go(o), zc().catch((c) => L("boot", "display names load threw", te(c))), e.__watchparty?.root.unmount();
7802
- const a = { root: yh(e, /* @__PURE__ */ S(wd, { basename: n, appProps: i }), r) };
7799
+ const o = Dn().theme;
7800
+ o && Wo.includes(o) && Go(o), Qc().catch((c) => L("boot", "display names load threw", te(c))), e.__watchparty?.root.unmount();
7801
+ const a = { root: yh(e, /* @__PURE__ */ S(_d, { basename: n, appProps: i }), r) };
7803
7802
  e.__watchparty = a;
7804
7803
  }
7805
7804
  function $f(e) {
@@ -7808,7 +7807,7 @@ function $f(e) {
7808
7807
  }
7809
7808
  export {
7810
7809
  vf as $,
7811
- zu as A,
7810
+ Wu as A,
7812
7811
  Tf as B,
7813
7812
  qe as C,
7814
7813
  In as D,
@@ -7816,9 +7815,9 @@ export {
7816
7815
  La as F,
7817
7816
  uf as G,
7818
7817
  mh as H,
7819
- md as I,
7820
- $n as J,
7821
- br as K,
7818
+ gd as I,
7819
+ Dn as J,
7820
+ vr as K,
7822
7821
  At as L,
7823
7822
  Qt as M,
7824
7823
  qt as N,
@@ -7830,10 +7829,10 @@ export {
7830
7829
  Ef as T,
7831
7830
  _f as U,
7832
7831
  Mh as V,
7833
- Md as W,
7832
+ Nd as W,
7834
7833
  Ph as X,
7835
7834
  pf as Y,
7836
- Ld as Z,
7835
+ Md as Z,
7837
7836
  mf as _,
7838
7837
  Xh as a,
7839
7838
  gf as a0,
@@ -7849,17 +7848,17 @@ export {
7849
7848
  Se as aA,
7850
7849
  lo as aB,
7851
7850
  Ms as aC,
7852
- zc as aD,
7853
- fl as aE,
7851
+ Qc as aD,
7852
+ pl as aE,
7854
7853
  yf as aF,
7855
7854
  bf as aG,
7856
- Ki as aH,
7857
- ol as aI,
7855
+ Yi as aH,
7856
+ sl as aI,
7858
7857
  Af as aJ,
7859
7858
  tf as aK,
7860
7859
  Bt as aL,
7861
7860
  Mf as aM,
7862
- sl as aN,
7861
+ al as aN,
7863
7862
  Pf as aO,
7864
7863
  Lf as aP,
7865
7864
  If as aQ,
@@ -7877,34 +7876,34 @@ export {
7877
7876
  ef as aj,
7878
7877
  Ih as ak,
7879
7878
  wf as al,
7880
- ld as am,
7881
- xc as an,
7882
- Hi as ao,
7879
+ ud as am,
7880
+ Mc as an,
7881
+ qi as ao,
7883
7882
  $h as ap,
7884
7883
  Fh as aq,
7885
7884
  Ch as ar,
7886
7885
  hf as as,
7887
7886
  Kh as at,
7888
- Od as au,
7889
- Qa as av,
7887
+ Ld as au,
7888
+ Ja as av,
7890
7889
  eo as aw,
7891
7890
  Uh as ax,
7892
7891
  Nf as ay,
7893
- ji as az,
7894
- kc as b,
7892
+ Hi as az,
7893
+ Oc as b,
7895
7894
  Ba as c,
7896
7895
  m as d,
7897
7896
  pe as e,
7898
7897
  Jh as f,
7899
- Sc as g,
7898
+ Ic as g,
7900
7899
  af as h,
7901
- Ti as i,
7900
+ Si as i,
7902
7901
  of as j,
7903
- $i as k,
7902
+ Bi as k,
7904
7903
  ie as l,
7905
7904
  Qh as m,
7906
7905
  Le as n,
7907
- Vu as o,
7906
+ zu as o,
7908
7907
  sf as p,
7909
7908
  rf as q,
7910
7909
  Zh as r,
@@ -7912,9 +7911,9 @@ export {
7912
7911
  kf as t,
7913
7912
  T as u,
7914
7913
  L as v,
7915
- Nn as w,
7914
+ Mn as w,
7916
7915
  Rf as x,
7917
7916
  ff as y,
7918
7917
  Of as z
7919
7918
  };
7920
- //# sourceMappingURL=index-DKRsAAOT.js.map
7919
+ //# sourceMappingURL=index-DjODfCTv.js.map