@hadoku/watchparty-ui 0.45.114 → 0.45.115

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,16 +2953,16 @@ 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
2967
  member: 1,
2962
2968
  friend: 2,
@@ -2964,19 +2970,19 @@ const wr = {
2964
2970
  wife: 4,
2965
2971
  admin: 5
2966
2972
  };
2967
- function ol(e, t) {
2968
- return (wr[e] ?? -1) >= wr[t];
2973
+ function sl(e, t) {
2974
+ return (br[e] ?? -1) >= br[t];
2969
2975
  }
2970
2976
  function tf() {
2971
- return ol(H.userType, "service");
2977
+ return sl(H.userType, "service");
2972
2978
  }
2973
2979
  function qt() {
2974
2980
  return H.accountId ?? "public";
2975
2981
  }
2976
- function sl() {
2982
+ function al() {
2977
2983
  return Ht() ?? "unscoped";
2978
2984
  }
2979
- async function al() {
2985
+ async function cl() {
2980
2986
  if (H.name) return H.name;
2981
2987
  try {
2982
2988
  const e = await fetch("/session/whoami", {
@@ -2986,7 +2992,7 @@ async function al() {
2986
2992
  if (!e.ok || !(e.headers.get("content-type") ?? "").includes("json"))
2987
2993
  return m("auth", "whoami unavailable", { status: e.status }), null;
2988
2994
  const t = await e.json();
2989
- if (nl(t.tv), H.userType === "public") return null;
2995
+ if (rl(t.tv), H.userType === "public") return null;
2990
2996
  if (t.valid && (H.accountId = typeof t.userId == "string" && t.userId ? t.userId : null), t.valid && typeof t.name == "string")
2991
2997
  return H.name = t.name, t.name;
2992
2998
  } catch (e) {
@@ -2994,7 +3000,7 @@ async function al() {
2994
3000
  }
2995
3001
  return null;
2996
3002
  }
2997
- const cl = l.object({
3003
+ const ll = l.object({
2998
3004
  // Identity. There is deliberately NO `name`: a person's name is their
2999
3005
  // hadoku key-registry name, resolved by the server from whoami and renamed
3000
3006
  // through hadoku_site's POST /session/name (operator decision 2026-10-08).
@@ -3021,16 +3027,16 @@ const cl = l.object({
3021
3027
  subtitleStyle: l.string().optional()
3022
3028
  }), We = Ko({
3023
3029
  appId: "watchparty",
3024
- schema: cl
3025
- }), ll = /* @__PURE__ */ new Set(["theme", "themeMode"]);
3030
+ schema: ll
3031
+ }), ul = /* @__PURE__ */ new Set(["theme", "themeMode"]);
3026
3032
  function Pt(e) {
3027
3033
  const t = Ht();
3028
3034
  return t ? `prefs-cache:${t}:${e}` : null;
3029
3035
  }
3030
- function ul() {
3036
+ function dl() {
3031
3037
  return Ht() === null;
3032
3038
  }
3033
- function _r(e) {
3039
+ function wr(e) {
3034
3040
  const t = Pt(e);
3035
3041
  if (!t) return {};
3036
3042
  const n = ie(t);
@@ -3041,9 +3047,9 @@ function _r(e) {
3041
3047
  return {};
3042
3048
  }
3043
3049
  }
3044
- function dl() {
3050
+ function hl() {
3045
3051
  let e = 0;
3046
- for (const t of Cc()) {
3052
+ for (const t of Nc()) {
3047
3053
  const n = t.startsWith("prefs-cache:") && t.endsWith(":watchparty"), r = t === Ot || t.startsWith(`${Ot}:`) && !t.endsWith(":_serverSynced_v1");
3048
3054
  if (!n && !r) continue;
3049
3055
  const i = ie(t);
@@ -3057,17 +3063,17 @@ function dl() {
3057
3063
  const s = n ? o?.blob : o;
3058
3064
  if (!s || typeof s != "object" || !("name" in s)) continue;
3059
3065
  const { name: a, ...c } = s, u = n ? { ...o, blob: c } : c;
3060
- Nn(t, JSON.stringify(u)) && e++;
3066
+ Mn(t, JSON.stringify(u)) && e++;
3061
3067
  }
3062
3068
  return e > 0 && m("preferences", "Stripped retired name from cached prefs rows", { rewritten: e }), e;
3063
3069
  }
3064
3070
  let to = null, no = null;
3065
- const Er = /* @__PURE__ */ new Set();
3066
- function $n() {
3067
- if (ul())
3071
+ const _r = /* @__PURE__ */ new Set();
3072
+ function Dn() {
3073
+ if (dl())
3068
3074
  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))
3075
+ 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";
3076
+ if (_r.has(i))
3071
3077
  return m("preferences", "Loaded (sync, SDK-only after first read)", {
3072
3078
  uid: i,
3073
3079
  sdkThemeKeys: Object.keys(n).length,
@@ -3077,7 +3083,7 @@ function $n() {
3077
3083
  themeSource: Object.keys(e).length > 0 ? "cache" : "mem",
3078
3084
  appSource: Object.keys(t).length > 0 ? "cache" : "mem"
3079
3085
  }), { ...r, ...n };
3080
- Er.add(i);
3086
+ _r.add(i);
3081
3087
  const o = io() ?? {}, s = { ...o, ...r, ...n };
3082
3088
  return m("preferences", "Loaded (sync, first read — legacy + SDK)", {
3083
3089
  uid: i,
@@ -3089,22 +3095,22 @@ function $n() {
3089
3095
  }), s;
3090
3096
  }
3091
3097
  let ro = !1;
3092
- function hl() {
3098
+ function fl() {
3093
3099
  const e = qt();
3094
3100
  return !e || e === "public";
3095
3101
  }
3096
3102
  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 });
3103
+ 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
3104
  }
3099
- let ct = null, Sr = !1;
3100
- function fl() {
3105
+ let ct = null, Er = !1;
3106
+ function pl() {
3101
3107
  return ct || (ct = (async () => {
3102
3108
  if (typeof window > "u") return !1;
3103
3109
  try {
3104
- Sr || (Sr = !0, He.subscribe((s) => {
3105
- to = s, Rr("portfolio", s), xr("theme");
3110
+ Er || (Er = !0, He.subscribe((s) => {
3111
+ to = s, kr("portfolio", s), Rr("theme");
3106
3112
  }), We.subscribe((s) => {
3107
- no = s, Rr("watchparty", s), xr("watchparty");
3113
+ no = s, kr("watchparty", s), Rr("watchparty");
3108
3114
  }));
3109
3115
  const [e, t] = await Promise.all([
3110
3116
  He.read(),
@@ -3123,7 +3129,7 @@ function fl() {
3123
3129
  // Post-fetch cache state: should be non-zero if SDK wrote it.
3124
3130
  sdkThemeBytesPost: i?.length ?? 0,
3125
3131
  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([
3132
+ }), await ml(e, t), ro ? (m("preferences", "Promoting this load's pre-auth picks to the signed-in user"), await Promise.all([
3127
3133
  He.promoteAnonPrefsToUser().catch(() => {
3128
3134
  }),
3129
3135
  We.promoteAnonPrefsToUser().catch(() => {
@@ -3135,7 +3141,7 @@ function fl() {
3135
3141
  })(), ct);
3136
3142
  }
3137
3143
  const Ot = "watchparty_preferences";
3138
- dl();
3144
+ hl();
3139
3145
  function pn() {
3140
3146
  const e = qt();
3141
3147
  return !e || e === "public" ? Ot : `${Ot}:${e}`;
@@ -3150,10 +3156,10 @@ function io() {
3150
3156
  return null;
3151
3157
  }
3152
3158
  }
3153
- function Tr() {
3159
+ function Sr() {
3154
3160
  It(pn()), It(`${pn()}:_serverSynced_v1`);
3155
3161
  }
3156
- async function pl(e, t) {
3162
+ async function ml(e, t) {
3157
3163
  const n = io();
3158
3164
  if (!n || Object.keys(n).length === 0) return;
3159
3165
  const r = Object.keys(e ?? {}).length > 0, i = Object.keys(t ?? {}).length > 0, o = {}, s = {};
@@ -3161,7 +3167,7 @@ async function pl(e, t) {
3161
3167
  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
3168
  const a = Object.keys(o), c = Object.keys(s);
3163
3169
  if (a.length === 0 && c.length === 0) {
3164
- Tr();
3170
+ Sr();
3165
3171
  return;
3166
3172
  }
3167
3173
  m("preferences", "Migrating legacy localStorage prefs to SDK", {
@@ -3174,15 +3180,15 @@ async function pl(e, t) {
3174
3180
  await Promise.all([
3175
3181
  a.length > 0 ? He.save(o, { scope: "device" }) : Promise.resolve(),
3176
3182
  c.length > 0 ? We.save(s) : Promise.resolve()
3177
- ]), Tr(), m("preferences", "Legacy migration complete");
3183
+ ]), Sr(), m("preferences", "Legacy migration complete");
3178
3184
  } catch (u) {
3179
3185
  L("preferences", "Legacy migration save failed — will retry next load", {
3180
3186
  err: u?.message
3181
3187
  });
3182
3188
  }
3183
3189
  }
3184
- let kr = !1;
3185
- function Rr(e, t) {
3190
+ let Tr = !1;
3191
+ function kr(e, t) {
3186
3192
  const n = Pt(e);
3187
3193
  if (n)
3188
3194
  try {
@@ -3194,14 +3200,14 @@ function Rr(e, t) {
3194
3200
  };
3195
3201
  localStorage.setItem(n, JSON.stringify(r));
3196
3202
  } catch (r) {
3197
- kr || (kr = !0, L("preferences", "writeThrough localStorage failed (in-memory backstop only)", {
3203
+ Tr || (Tr = !0, L("preferences", "writeThrough localStorage failed (in-memory backstop only)", {
3198
3204
  appId: e,
3199
3205
  err: r?.message,
3200
3206
  name: r?.name
3201
3207
  }));
3202
3208
  }
3203
3209
  }
3204
- function xr(e) {
3210
+ function Rr(e) {
3205
3211
  Promise.resolve().then(() => co).then(({ useAppStore: t }) => {
3206
3212
  try {
3207
3213
  t.getState().rehydrateFromPrefs();
@@ -3210,17 +3216,17 @@ function xr(e) {
3210
3216
  }
3211
3217
  }).catch((t) => L("preferences", "store import failed", { reason: e, err: t?.message }));
3212
3218
  }
3213
- const oo = 320, Cr = 240, ml = 640;
3219
+ const oo = 320, xr = 240, gl = 640;
3214
3220
  function en(e, t) {
3215
3221
  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)));
3222
+ let n = gl;
3223
+ return n = Math.max(n, xr), Math.round(Math.min(n, Math.max(xr, e)));
3218
3224
  }
3219
3225
  function so(e, t) {
3220
3226
  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
3227
  return i.length ? [...t, ...i] : t;
3222
3228
  }
3223
- const ao = 6e3, ue = $n(), T = Oa((e, t) => ({
3229
+ const ao = 6e3, ue = Dn(), T = Oa((e, t) => ({
3224
3230
  ready: !1,
3225
3231
  name: "",
3226
3232
  sprite: null,
@@ -3280,7 +3286,7 @@ const ao = 6e3, ue = $n(), T = Oa((e, t) => ({
3280
3286
  const o = Xe(n.sprite);
3281
3287
  return m("store", "Auto-identity: deriving name from the requested sprite", { name: o, sprite: n.sprite }), { name: o };
3282
3288
  }
3283
- const r = Object.values(n.roster).map((o) => o.sprite), i = Qi(r, void 0, Ae);
3289
+ const r = Object.values(n.roster).map((o) => o.sprite), i = Ni(r, void 0, Ae);
3284
3290
  if (i) {
3285
3291
  const o = Xe(i);
3286
3292
  return m("store", "Auto-identity assigned", { name: o, sprite: i }), { name: o, sprite: i };
@@ -3456,7 +3462,7 @@ const ao = 6e3, ue = $n(), T = Oa((e, t) => ({
3456
3462
  setGameSettings: (n) => e({ gameSettings: n }),
3457
3463
  setRoomKeyType: (n) => e({ roomKeyType: n }),
3458
3464
  rehydrateFromPrefs: () => e((n) => {
3459
- const r = $n(), i = {};
3465
+ const r = Dn(), i = {};
3460
3466
  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
3467
  const a = { ...n.mediaPrefs };
3462
3468
  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 +3478,7 @@ const co = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3472
3478
  mergeHistory: so,
3473
3479
  useAppStore: T
3474
3480
  }, Symbol.toStringTag, { value: "Module" }));
3475
- function gl({ className: e = "fixed bottom-4 left-1/2 -translate-x-1/2" }) {
3481
+ function yl({ className: e = "fixed bottom-4 left-1/2 -translate-x-1/2" }) {
3476
3482
  const t = T((r) => r.toasts), n = T((r) => r.popToast);
3477
3483
  return he(() => {
3478
3484
  const r = t.map((i) => setTimeout(() => n(i.id), 4e3));
@@ -3481,14 +3487,14 @@ function gl({ className: e = "fixed bottom-4 left-1/2 -translate-x-1/2" }) {
3481
3487
  };
3482
3488
  }, [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
3489
  }
3484
- function yl() {
3490
+ function vl() {
3485
3491
  try {
3486
3492
  return typeof document > "u" ? !0 : !document.hidden;
3487
3493
  } catch {
3488
3494
  return !0;
3489
3495
  }
3490
3496
  }
3491
- function vl(e) {
3497
+ function bl(e) {
3492
3498
  if (typeof document > "u" || typeof document.addEventListener != "function")
3493
3499
  return () => {
3494
3500
  };
@@ -3497,9 +3503,9 @@ function vl(e) {
3497
3503
  };
3498
3504
  return document.addEventListener("visibilitychange", t), () => document.removeEventListener("visibilitychange", t);
3499
3505
  }
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));
3506
+ const wl = 3e4;
3507
+ function _l(e, t) {
3508
+ const n = t.isVisible ?? vl, r = t.setInterval ?? ((E, w) => setInterval(E, w)), i = t.clearInterval ?? ((E) => clearInterval(E));
3503
3509
  let o = { list: null, loading: !0, error: null };
3504
3510
  const s = /* @__PURE__ */ new Set();
3505
3511
  let a = null, c = !1;
@@ -3524,9 +3530,9 @@ function wl(e, t) {
3524
3530
  d();
3525
3531
  const h = t.pings.subscribe(e, () => {
3526
3532
  n() && d();
3527
- }), v = (t.onVisible ?? vl)(() => d()), b = r(() => {
3533
+ }), v = (t.onVisible ?? bl)(() => d()), b = r(() => {
3528
3534
  n() && d();
3529
- }, t.fallbackMs ?? bl);
3535
+ }, t.fallbackMs ?? wl);
3530
3536
  return {
3531
3537
  getState() {
3532
3538
  return o;
@@ -3540,21 +3546,21 @@ function wl(e, t) {
3540
3546
  }
3541
3547
  };
3542
3548
  }
3543
- function _l(e) {
3549
+ function El(e) {
3544
3550
  return "list";
3545
3551
  }
3546
- const El = { list: null, loading: !0, error: null };
3547
- function Sl() {
3552
+ const Sl = { list: null, loading: !0, error: null };
3553
+ function Tl() {
3548
3554
  return () => {
3549
3555
  };
3550
3556
  }
3551
- function Tl(e, t) {
3552
- const n = _l(), r = we(t);
3557
+ function kl(e, t) {
3558
+ const n = El(), r = we(t);
3553
3559
  r.current = t;
3554
3560
  const i = we(null);
3555
3561
  (i.current === null || i.current.key !== n) && (i.current?.client.close(), i.current = {
3556
3562
  key: n,
3557
- client: wl(e, {
3563
+ client: _l(e, {
3558
3564
  pings: r.current.pings,
3559
3565
  fetchList: (c) => r.current.fetchList(c),
3560
3566
  fallbackMs: r.current.fallbackMs,
@@ -3569,9 +3575,9 @@ function Tl(e, t) {
3569
3575
  s.current = setTimeout(() => {
3570
3576
  s.current = null, i.current?.client === o && o.close();
3571
3577
  }, 0);
3572
- }), [o]), { ...Mt(o ? o.subscribe : Sl, () => o ? o.getState() : El), refresh: () => o.refresh() };
3578
+ }), [o]), { ...Mt(o ? o.subscribe : Tl, () => o ? o.getState() : Sl), refresh: () => o.refresh() };
3573
3579
  }
3574
- const kl = 400;
3580
+ const Rl = 400;
3575
3581
  function lo() {
3576
3582
  const e = we(null), t = we([]);
3577
3583
  return he(() => {
@@ -3604,9 +3610,9 @@ function lo() {
3604
3610
  const $ = N;
3605
3611
  let O;
3606
3612
  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) => {
3613
+ const D = (ir, Bo) => {
3608
3614
  const Fo = Math.random(), Uo = Math.random();
3609
- return or + (Fo + Uo) / 2 * (Bo - or);
3615
+ return ir + (Fo + Uo) / 2 * (Bo - ir);
3610
3616
  };
3611
3617
  let G = D(0.9, 1.4) + O ** 1.2 * (R ? 5.5 : N ? 4 : 3.2);
3612
3618
  const K = D(0.85, 1.25);
@@ -3619,16 +3625,16 @@ function lo() {
3619
3625
  y && M.scale < 1 && (ce *= M.scale);
3620
3626
  const Gt = Math.min(1, U), Te = Math.min(1, (F - 1) / 4.5);
3621
3627
  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;
3628
+ 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
3629
  let De = Math.random();
3624
- const $o = 0.8 + tr * 1.4;
3630
+ const $o = 0.8 + er * 1.4;
3625
3631
  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;
3632
+ const nr = (1 - er) * ((40 - Kt) / tr);
3633
+ De = De * (1 - nr) + nr;
3634
+ const rr = (Kt + De * tr) * 1e3;
3629
3635
  return {
3630
3636
  x: f ?? Math.random() * Lo,
3631
- y: _ ?? (y ? Math.random() * Qn : -Math.random() * Qn),
3637
+ y: _ ?? (y ? Math.random() * Xn : -Math.random() * Xn),
3632
3638
  z: O,
3633
3639
  speed: ce,
3634
3640
  size: F,
@@ -3637,10 +3643,10 @@ function lo() {
3637
3643
  colorPhase: Math.random() * Math.PI * 2,
3638
3644
  colorSpeed: 0.01 + Math.random() * 0.02,
3639
3645
  colorMode: Math.random() < 0.5 ? 0 : 1,
3640
- twinkleAmount: Zn,
3646
+ twinkleAmount: Qn,
3641
3647
  twinkleEnabled: Mo,
3642
3648
  dimFloor: Ne,
3643
- twinkleStart: er,
3649
+ twinkleStart: Zn,
3644
3650
  twinkleTarget: No,
3645
3651
  twinkleT: 0,
3646
3652
  twinkleDuration: Do,
@@ -3648,13 +3654,13 @@ function lo() {
3648
3654
  microSpeed: (R ? 0.18 : 0.1) + Math.random() * 0.05,
3649
3655
  ultraRare: R,
3650
3656
  trail: R ? [] : void 0,
3651
- currentAlpha: er,
3652
- lifeMsRemaining: ir,
3653
- lifeMsTotal: ir
3657
+ currentAlpha: Zn,
3658
+ lifeMsRemaining: rr,
3659
+ lifeMsTotal: rr
3654
3660
  };
3655
3661
  }
3656
3662
  if (!t.current.length)
3657
- for (let f = 0; f < kl; f++) t.current.push(c(void 0, void 0, !0, f));
3663
+ for (let f = 0; f < Rl; f++) t.current.push(c(void 0, void 0, !0, f));
3658
3664
  let u, d = performance.now();
3659
3665
  const h = 50;
3660
3666
  function v(f, _, y, k) {
@@ -3784,37 +3790,37 @@ const _t = /* @__PURE__ */ Object.create(null);
3784
3790
  Object.keys(se).forEach((e) => {
3785
3791
  _t[se[e]] = e;
3786
3792
  });
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) => {
3793
+ 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
3794
  const n = new FileReader();
3789
3795
  return n.onload = function() {
3790
3796
  const r = n.result.split(",")[1];
3791
3797
  t("b" + (r || ""));
3792
3798
  }, n.readAsDataURL(e);
3793
3799
  };
3794
- function Ir(e) {
3800
+ function Ar(e) {
3795
3801
  return e instanceof Uint8Array ? e : e instanceof ArrayBuffer ? new Uint8Array(e) : new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
3796
3802
  }
3797
3803
  let tn;
3798
- function Rl(e, t) {
3804
+ function xl(e, t) {
3799
3805
  if (uo && e.data instanceof Blob)
3800
- return e.data.arrayBuffer().then(Ir).then(t);
3806
+ return e.data.arrayBuffer().then(Ar).then(t);
3801
3807
  if (ho && (e.data instanceof ArrayBuffer || fo(e.data)))
3802
- return t(Ir(e.data));
3803
- Bn(e, !1, (n) => {
3808
+ return t(Ar(e.data));
3809
+ $n(e, !1, (n) => {
3804
3810
  tn || (tn = new TextEncoder()), t(tn.encode(n));
3805
3811
  });
3806
3812
  }
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) => {
3813
+ const Ir = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Ue = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
3814
+ for (let e = 0; e < Ir.length; e++)
3815
+ Ue[Ir.charCodeAt(e)] = e;
3816
+ const Cl = (e) => {
3811
3817
  let t = e.length * 0.75, n = e.length, r, i = 0, o, s, a, c;
3812
3818
  e[e.length - 1] === "=" && (t--, e[e.length - 2] === "=" && t--);
3813
3819
  const u = new ArrayBuffer(t), d = new Uint8Array(u);
3814
3820
  for (r = 0; r < n; r += 4)
3815
3821
  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
3822
  return u;
3817
- }, Cl = typeof ArrayBuffer == "function", Fn = (e, t) => {
3823
+ }, Al = typeof ArrayBuffer == "function", Bn = (e, t) => {
3818
3824
  if (typeof e != "string")
3819
3825
  return {
3820
3826
  type: "message",
@@ -3823,40 +3829,40 @@ const xl = (e) => {
3823
3829
  const n = e.charAt(0);
3824
3830
  return n === "b" ? {
3825
3831
  type: "message",
3826
- data: Al(e.substring(1), t)
3832
+ data: Il(e.substring(1), t)
3827
3833
  } : _t[n] ? e.length > 1 ? {
3828
3834
  type: _t[n],
3829
3835
  data: e.substring(1)
3830
3836
  } : {
3831
3837
  type: _t[n]
3832
3838
  } : mn;
3833
- }, Al = (e, t) => {
3834
- if (Cl) {
3835
- const n = xl(e);
3839
+ }, Il = (e, t) => {
3840
+ if (Al) {
3841
+ const n = Cl(e);
3836
3842
  return po(n, t);
3837
3843
  } else
3838
3844
  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) => {
3845
+ }, po = (e, t) => t === "blob" ? e instanceof Blob ? e : new Blob([e]) : e instanceof ArrayBuffer ? e : e.buffer, mo = "", Pl = (e, t) => {
3840
3846
  const n = e.length, r = new Array(n);
3841
3847
  let i = 0;
3842
3848
  e.forEach((o, s) => {
3843
- Bn(o, !1, (a) => {
3849
+ $n(o, !1, (a) => {
3844
3850
  r[s] = a, ++i === n && t(r.join(mo));
3845
3851
  });
3846
3852
  });
3847
- }, Pl = (e, t) => {
3853
+ }, Ol = (e, t) => {
3848
3854
  const n = e.split(mo), r = [];
3849
3855
  for (let i = 0; i < n.length; i++) {
3850
- const o = Fn(n[i], t);
3856
+ const o = Bn(n[i], t);
3851
3857
  if (r.push(o), o.type === "error")
3852
3858
  break;
3853
3859
  }
3854
3860
  return r;
3855
3861
  };
3856
- function Ol() {
3862
+ function Ll() {
3857
3863
  return new TransformStream({
3858
3864
  transform(e, t) {
3859
- Rl(e, (n) => {
3865
+ xl(e, (n) => {
3860
3866
  const r = n.length;
3861
3867
  let i;
3862
3868
  if (r < 126)
@@ -3888,7 +3894,7 @@ function ut(e, t) {
3888
3894
  n[i] = e[0][r++], r === e[0].length && (e.shift(), r = 0);
3889
3895
  return e.length && r < e[0].length && (e[0] = e[0].slice(r)), n;
3890
3896
  }
3891
- function Ll(e, t) {
3897
+ function Ml(e, t) {
3892
3898
  nn || (nn = new TextDecoder());
3893
3899
  const n = [];
3894
3900
  let r = 0, i = -1, o = !1;
@@ -3918,7 +3924,7 @@ function Ll(e, t) {
3918
3924
  if (lt(n) < i)
3919
3925
  break;
3920
3926
  const c = ut(n, i);
3921
- a.enqueue(Fn(o ? c : nn.decode(c), t)), r = 0;
3927
+ a.enqueue(Bn(o ? c : nn.decode(c), t)), r = 0;
3922
3928
  }
3923
3929
  if (i === 0 || i > e) {
3924
3930
  a.enqueue(mn);
@@ -3930,9 +3936,9 @@ function Ll(e, t) {
3930
3936
  }
3931
3937
  const go = 4;
3932
3938
  function j(e) {
3933
- if (e) return Ml(e);
3939
+ if (e) return Nl(e);
3934
3940
  }
3935
- function Ml(e) {
3941
+ function Nl(e) {
3936
3942
  for (var t in j.prototype)
3937
3943
  e[t] = j.prototype[t];
3938
3944
  return e;
@@ -3978,19 +3984,19 @@ j.prototype.listeners = function(e) {
3978
3984
  j.prototype.hasListeners = function(e) {
3979
3985
  return !!this.listeners(e).length;
3980
3986
  };
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";
3987
+ 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
3988
  function yo(e, ...t) {
3983
3989
  return t.reduce((n, r) => (e.hasOwnProperty(r) && (n[r] = e[r]), n), {});
3984
3990
  }
3985
- const Dl = X.setTimeout, $l = X.clearTimeout;
3991
+ const $l = X.setTimeout, Bl = X.clearTimeout;
3986
3992
  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);
3993
+ 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
3994
  }
3995
+ const Fl = 1.33;
3993
3996
  function Ul(e) {
3997
+ return typeof e == "string" ? jl(e) : Math.ceil((e.byteLength || e.size) * Fl);
3998
+ }
3999
+ function jl(e) {
3994
4000
  let t = 0, n = 0;
3995
4001
  for (let r = 0, i = e.length; r < i; r++)
3996
4002
  t = e.charCodeAt(r), t < 128 ? n += 1 : t < 2048 ? n += 2 : t < 55296 || t >= 57344 ? n += 3 : (r++, n += 4);
@@ -3999,13 +4005,13 @@ function Ul(e) {
3999
4005
  function vo() {
4000
4006
  return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
4001
4007
  }
4002
- function jl(e) {
4008
+ function Hl(e) {
4003
4009
  let t = "";
4004
4010
  for (let n in e)
4005
4011
  e.hasOwnProperty(n) && (t.length && (t += "&"), t += encodeURIComponent(n) + "=" + encodeURIComponent(e[n]));
4006
4012
  return t;
4007
4013
  }
4008
- function Hl(e) {
4014
+ function ql(e) {
4009
4015
  let t = {}, n = e.split("&");
4010
4016
  for (let r = 0, i = n.length; r < i; r++) {
4011
4017
  let o = n[r].split("=");
@@ -4013,12 +4019,12 @@ function Hl(e) {
4013
4019
  }
4014
4020
  return t;
4015
4021
  }
4016
- class ql extends Error {
4022
+ class Vl extends Error {
4017
4023
  constructor(t, n, r) {
4018
4024
  super(t), this.description = n, this.context = r, this.type = "TransportError";
4019
4025
  }
4020
4026
  }
4021
- class Un extends j {
4027
+ class Fn extends j {
4022
4028
  /**
4023
4029
  * Transport abstract constructor.
4024
4030
  *
@@ -4038,7 +4044,7 @@ class Un extends j {
4038
4044
  * @protected
4039
4045
  */
4040
4046
  onError(t, n, r) {
4041
- return super.emitReserved("error", new ql(t, n, r)), this;
4047
+ return super.emitReserved("error", new Vl(t, n, r)), this;
4042
4048
  }
4043
4049
  /**
4044
4050
  * Opens the transport.
@@ -4075,7 +4081,7 @@ class Un extends j {
4075
4081
  * @protected
4076
4082
  */
4077
4083
  onData(t) {
4078
- const n = Fn(t, this.socket.binaryType);
4084
+ const n = Bn(t, this.socket.binaryType);
4079
4085
  this.onPacket(n);
4080
4086
  }
4081
4087
  /**
@@ -4112,11 +4118,11 @@ class Un extends j {
4112
4118
  return this.opts.port && (this.opts.secure && +(this.opts.port !== 443) || !this.opts.secure && Number(this.opts.port) !== 80) ? ":" + this.opts.port : "";
4113
4119
  }
4114
4120
  _query(t) {
4115
- const n = jl(t);
4121
+ const n = Hl(t);
4116
4122
  return n.length ? "?" + n : "";
4117
4123
  }
4118
4124
  }
4119
- class Vl extends Un {
4125
+ class zl extends Fn {
4120
4126
  constructor() {
4121
4127
  super(...arguments), this._polling = !1;
4122
4128
  }
@@ -4172,7 +4178,7 @@ class Vl extends Un {
4172
4178
  return this.onClose({ description: "transport closed by the server" }), !1;
4173
4179
  this.onPacket(r);
4174
4180
  };
4175
- Pl(t, this.socket.binaryType).forEach(n), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
4181
+ Ol(t, this.socket.binaryType).forEach(n), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
4176
4182
  }
4177
4183
  /**
4178
4184
  * For polling, send a close packet.
@@ -4192,7 +4198,7 @@ class Vl extends Un {
4192
4198
  * @protected
4193
4199
  */
4194
4200
  write(t) {
4195
- this.writable = !1, Il(t, (n) => {
4201
+ this.writable = !1, Pl(t, (n) => {
4196
4202
  this.doWrite(n, () => {
4197
4203
  this.writable = !0, this.emitReserved("drain");
4198
4204
  });
@@ -4213,10 +4219,10 @@ try {
4213
4219
  bo = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
4214
4220
  } catch {
4215
4221
  }
4216
- const zl = bo;
4217
- function Wl() {
4222
+ const Wl = bo;
4223
+ function Gl() {
4218
4224
  }
4219
- class Gl extends Vl {
4225
+ class Kl extends zl {
4220
4226
  /**
4221
4227
  * XHR Polling constructor.
4222
4228
  *
@@ -4329,7 +4335,7 @@ class oe extends j {
4329
4335
  */
4330
4336
  _cleanup(t) {
4331
4337
  if (!(typeof this._xhr > "u" || this._xhr === null)) {
4332
- if (this._xhr.onreadystatechange = Wl, t)
4338
+ if (this._xhr.onreadystatechange = Gl, t)
4333
4339
  try {
4334
4340
  this._xhr.abort();
4335
4341
  } catch {
@@ -4359,27 +4365,27 @@ oe.requestsCount = 0;
4359
4365
  oe.requests = {};
4360
4366
  if (typeof document < "u") {
4361
4367
  if (typeof attachEvent == "function")
4362
- attachEvent("onunload", Or);
4368
+ attachEvent("onunload", Pr);
4363
4369
  else if (typeof addEventListener == "function") {
4364
4370
  const e = "onpagehide" in X ? "pagehide" : "unload";
4365
- addEventListener(e, Or, !1);
4371
+ addEventListener(e, Pr, !1);
4366
4372
  }
4367
4373
  }
4368
- function Or() {
4374
+ function Pr() {
4369
4375
  for (let e in oe.requests)
4370
4376
  oe.requests.hasOwnProperty(e) && oe.requests[e].abort();
4371
4377
  }
4372
- const Kl = (function() {
4378
+ const Yl = (function() {
4373
4379
  const e = wo({
4374
4380
  xdomain: !1
4375
4381
  });
4376
4382
  return e && e.responseType !== null;
4377
4383
  })();
4378
- class Yl extends Gl {
4384
+ class Jl extends Kl {
4379
4385
  constructor(t) {
4380
4386
  super(t);
4381
4387
  const n = t && t.forceBase64;
4382
- this.supportsBinary = Kl && !n;
4388
+ this.supportsBinary = Yl && !n;
4383
4389
  }
4384
4390
  request(t = {}) {
4385
4391
  return Object.assign(t, { xd: this.xd }, this.opts), new oe(wo, this.uri(), t);
@@ -4388,7 +4394,7 @@ class Yl extends Gl {
4388
4394
  function wo(e) {
4389
4395
  const t = e.xdomain;
4390
4396
  try {
4391
- if (typeof XMLHttpRequest < "u" && (!t || zl))
4397
+ if (typeof XMLHttpRequest < "u" && (!t || Wl))
4392
4398
  return new XMLHttpRequest();
4393
4399
  } catch {
4394
4400
  }
@@ -4399,7 +4405,7 @@ function wo(e) {
4399
4405
  }
4400
4406
  }
4401
4407
  const _o = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
4402
- class Jl extends Un {
4408
+ class Xl extends Fn {
4403
4409
  get name() {
4404
4410
  return "websocket";
4405
4411
  }
@@ -4430,7 +4436,7 @@ class Jl extends Un {
4430
4436
  this.writable = !1;
4431
4437
  for (let n = 0; n < t.length; n++) {
4432
4438
  const r = t[n], i = n === t.length - 1;
4433
- Bn(r, this.supportsBinary, (o) => {
4439
+ $n(r, this.supportsBinary, (o) => {
4434
4440
  try {
4435
4441
  this.doWrite(r, o);
4436
4442
  } catch {
@@ -4456,7 +4462,7 @@ class Jl extends Un {
4456
4462
  }
4457
4463
  }
4458
4464
  const rn = X.WebSocket || X.MozWebSocket;
4459
- class Xl extends Jl {
4465
+ class Ql extends Xl {
4460
4466
  createSocket(t, n, r) {
4461
4467
  return _o ? new rn(t, n, r) : n ? new rn(t, n) : new rn(t);
4462
4468
  }
@@ -4464,7 +4470,7 @@ class Xl extends Jl {
4464
4470
  this.ws.send(n);
4465
4471
  }
4466
4472
  }
4467
- class Ql extends Un {
4473
+ class Zl extends Fn {
4468
4474
  get name() {
4469
4475
  return "webtransport";
4470
4476
  }
@@ -4480,7 +4486,7 @@ class Ql extends Un {
4480
4486
  this.onError("webtransport error", t);
4481
4487
  }), this._transport.ready.then(() => {
4482
4488
  this._transport.createBidirectionalStream().then((t) => {
4483
- const n = Ll(Number.MAX_SAFE_INTEGER, this.socket.binaryType), r = t.readable.pipeThrough(n).getReader(), i = Ol();
4489
+ const n = Ml(Number.MAX_SAFE_INTEGER, this.socket.binaryType), r = t.readable.pipeThrough(n).getReader(), i = Ll();
4484
4490
  i.readable.pipeTo(t.writable), this._writer = i.writable.getWriter();
4485
4491
  const o = () => {
4486
4492
  r.read().then(({ done: a, value: c }) => {
@@ -4510,11 +4516,11 @@ class Ql extends Un {
4510
4516
  (t = this._transport) === null || t === void 0 || t.close();
4511
4517
  }
4512
4518
  }
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 = [
4519
+ const eu = {
4520
+ websocket: Ql,
4521
+ webtransport: Zl,
4522
+ polling: Jl
4523
+ }, tu = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, nu = [
4518
4524
  "source",
4519
4525
  "protocol",
4520
4526
  "authority",
@@ -4535,16 +4541,16 @@ function gn(e) {
4535
4541
  throw "URI too long";
4536
4542
  const t = e, n = e.indexOf("["), r = e.indexOf("]");
4537
4543
  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;
4544
+ let i = tu.exec(e || ""), o = {}, s = 14;
4539
4545
  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;
4546
+ o[nu[s]] = i[s] || "";
4547
+ 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
4548
  }
4543
- function nu(e, t) {
4549
+ function ru(e, t) {
4544
4550
  const n = /\/{2,9}/g, r = t.replace(n, "/").split("/");
4545
4551
  return (t.slice(0, 1) == "/" || t.length === 0) && r.splice(0, 1), t.slice(-1) == "/" && r.splice(r.length - 1, 1), r;
4546
4552
  }
4547
- function ru(e, t) {
4553
+ function iu(e, t) {
4548
4554
  const n = {};
4549
4555
  return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(r, i, o) {
4550
4556
  i && (n[i] = o);
@@ -4562,7 +4568,7 @@ class ve extends j {
4562
4568
  * @param {Object} opts - options
4563
4569
  */
4564
4570
  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) {
4571
+ 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
4572
  const r = gn(t);
4567
4573
  n.hostname = r.host, n.secure = r.protocol === "https" || r.protocol === "wss", n.port = r.port, r.query && (n.query = r.query);
4568
4574
  } else n.host && (n.hostname = gn(n.host).host);
@@ -4583,7 +4589,7 @@ class ve extends j {
4583
4589
  },
4584
4590
  transportOptions: {},
4585
4591
  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 = () => {
4592
+ }, 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
4593
  this.transport && (this.transport.removeAllListeners(), this.transport.close());
4588
4594
  }, addEventListener("beforeunload", this._beforeunloadEventListener, !1)), this.hostname !== "localhost" && (this._offlineEventListener = () => {
4589
4595
  this._onClose("transport close", {
@@ -4718,7 +4724,7 @@ class ve extends j {
4718
4724
  let n = 1;
4719
4725
  for (let r = 0; r < this.writeBuffer.length; r++) {
4720
4726
  const i = this.writeBuffer[r].data;
4721
- if (i && (n += Fl(i)), r > 0 && n > this._maxPayload)
4727
+ if (i && (n += Ul(i)), r > 0 && n > this._maxPayload)
4722
4728
  return this.writeBuffer.slice(0, r);
4723
4729
  n += 2;
4724
4730
  }
@@ -4825,7 +4831,7 @@ class ve extends j {
4825
4831
  }
4826
4832
  }
4827
4833
  ve.protocol = go;
4828
- class iu extends ve {
4834
+ class ou extends ve {
4829
4835
  constructor() {
4830
4836
  super(...arguments), this._upgrades = [];
4831
4837
  }
@@ -4897,21 +4903,21 @@ class iu extends ve {
4897
4903
  return n;
4898
4904
  }
4899
4905
  }
4900
- let ou = class extends iu {
4906
+ let su = class extends ou {
4901
4907
  constructor(t, n = {}) {
4902
4908
  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);
4909
+ (!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
4910
  }
4905
4911
  };
4906
- function su(e, t = "", n) {
4912
+ function au(e, t = "", n) {
4907
4913
  let r = e;
4908
4914
  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
4915
  const o = r.host.indexOf(":") !== -1 ? "[" + r.host + "]" : r.host;
4910
4916
  return r.id = r.protocol + "://" + o + ":" + r.port + t, r.href = r.protocol + "://" + o + (n && n.port === r.port ? "" : ":" + r.port), r;
4911
4917
  }
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;
4918
+ 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]";
4919
+ function Un(e) {
4920
+ return cu && (e instanceof ArrayBuffer || lu(e)) || uu && e instanceof Blob || du && e instanceof File;
4915
4921
  }
4916
4922
  function St(e, t) {
4917
4923
  if (!e || typeof e != "object")
@@ -4922,7 +4928,7 @@ function St(e, t) {
4922
4928
  return !0;
4923
4929
  return !1;
4924
4930
  }
4925
- if (jn(e))
4931
+ if (Un(e))
4926
4932
  return !0;
4927
4933
  if (e.toJSON && typeof e.toJSON == "function" && arguments.length === 1)
4928
4934
  return St(e.toJSON(), !0);
@@ -4931,14 +4937,14 @@ function St(e, t) {
4931
4937
  return !0;
4932
4938
  return !1;
4933
4939
  }
4934
- function du(e) {
4940
+ function hu(e) {
4935
4941
  const t = [], n = e.data, r = e;
4936
4942
  return r.data = vn(n, t), r.attachments = t.length, { packet: r, buffers: t };
4937
4943
  }
4938
4944
  function vn(e, t) {
4939
4945
  if (!e)
4940
4946
  return e;
4941
- if (jn(e)) {
4947
+ if (Un(e)) {
4942
4948
  const n = { _placeholder: !0, num: t.length };
4943
4949
  return t.push(e), n;
4944
4950
  } else if (Array.isArray(e)) {
@@ -4954,7 +4960,7 @@ function vn(e, t) {
4954
4960
  }
4955
4961
  return e;
4956
4962
  }
4957
- function hu(e, t) {
4963
+ function fu(e, t) {
4958
4964
  return e.data = bn(e.data, t), delete e.attachments, e;
4959
4965
  }
4960
4966
  function bn(e, t) {
@@ -4972,7 +4978,7 @@ function bn(e, t) {
4972
4978
  Object.prototype.hasOwnProperty.call(e, n) && (e[n] = bn(e[n], t));
4973
4979
  return e;
4974
4980
  }
4975
- const fu = [
4981
+ const pu = [
4976
4982
  "connect",
4977
4983
  "connect_error",
4978
4984
  "disconnect",
@@ -4980,12 +4986,12 @@ const fu = [
4980
4986
  "newListener",
4981
4987
  "removeListener"
4982
4988
  // used by the Node.js EventEmitter
4983
- ], pu = 5;
4989
+ ], mu = 5;
4984
4990
  var I;
4985
4991
  (function(e) {
4986
4992
  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
4993
  })(I || (I = {}));
4988
- class mu {
4994
+ class gu {
4989
4995
  /**
4990
4996
  * Encoder constructor
4991
4997
  *
@@ -5021,14 +5027,14 @@ class mu {
5021
5027
  * a list of buffers.
5022
5028
  */
5023
5029
  encodeAsBinary(t) {
5024
- const n = du(t), r = this.encodeAsString(n.packet), i = n.buffers;
5030
+ const n = hu(t), r = this.encodeAsString(n.packet), i = n.buffers;
5025
5031
  return i.unshift(r), i;
5026
5032
  }
5027
5033
  }
5028
- function Lr(e) {
5034
+ function Or(e) {
5029
5035
  return Object.prototype.toString.call(e) === "[object Object]";
5030
5036
  }
5031
- class Hn extends j {
5037
+ class jn extends j {
5032
5038
  /**
5033
5039
  * Decoder constructor
5034
5040
  *
@@ -5049,8 +5055,8 @@ class Hn extends j {
5049
5055
  throw new Error("got plaintext data when reconstructing a packet");
5050
5056
  n = this.decodeString(t);
5051
5057
  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)
5058
+ 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);
5059
+ } else if (Un(t) || t.base64)
5054
5060
  if (this.reconstructor)
5055
5061
  n = this.reconstructor.takeBinaryData(t), n && (this.reconstructor = null, super.emitReserved("decoded", n));
5056
5062
  else
@@ -5103,7 +5109,7 @@ class Hn extends j {
5103
5109
  }
5104
5110
  if (t.charAt(++n)) {
5105
5111
  const o = this.tryParse(t.substr(n));
5106
- if (Hn.isPayloadValid(r.type, o))
5112
+ if (jn.isPayloadValid(r.type, o))
5107
5113
  r.data = o;
5108
5114
  else
5109
5115
  throw new Error("invalid payload");
@@ -5120,14 +5126,14 @@ class Hn extends j {
5120
5126
  static isPayloadValid(t, n) {
5121
5127
  switch (t) {
5122
5128
  case I.CONNECT:
5123
- return Lr(n);
5129
+ return Or(n);
5124
5130
  case I.DISCONNECT:
5125
5131
  return n === void 0;
5126
5132
  case I.CONNECT_ERROR:
5127
- return typeof n == "string" || Lr(n);
5133
+ return typeof n == "string" || Or(n);
5128
5134
  case I.EVENT:
5129
5135
  case I.BINARY_EVENT:
5130
- return Array.isArray(n) && (typeof n[0] == "number" || typeof n[0] == "string" && fu.indexOf(n[0]) === -1);
5136
+ return Array.isArray(n) && (typeof n[0] == "number" || typeof n[0] == "string" && pu.indexOf(n[0]) === -1);
5131
5137
  case I.ACK:
5132
5138
  case I.BINARY_ACK:
5133
5139
  return Array.isArray(n);
@@ -5140,7 +5146,7 @@ class Hn extends j {
5140
5146
  this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null);
5141
5147
  }
5142
5148
  }
5143
- class gu {
5149
+ class yu {
5144
5150
  constructor(t) {
5145
5151
  this.packet = t, this.buffers = [], this.reconPack = t;
5146
5152
  }
@@ -5154,7 +5160,7 @@ class gu {
5154
5160
  */
5155
5161
  takeBinaryData(t) {
5156
5162
  if (this.buffers.push(t), this.buffers.length === this.reconPack.attachments) {
5157
- const n = hu(this.reconPack, this.buffers);
5163
+ const n = fu(this.reconPack, this.buffers);
5158
5164
  return this.finishedReconstruction(), n;
5159
5165
  }
5160
5166
  return null;
@@ -5166,21 +5172,21 @@ class gu {
5166
5172
  this.reconPack = null, this.buffers = [];
5167
5173
  }
5168
5174
  }
5169
- const yu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5175
+ const vu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5170
5176
  __proto__: null,
5171
- Decoder: Hn,
5172
- Encoder: mu,
5177
+ Decoder: jn,
5178
+ Encoder: gu,
5173
5179
  get PacketType() {
5174
5180
  return I;
5175
5181
  },
5176
- protocol: pu
5182
+ protocol: mu
5177
5183
  }, Symbol.toStringTag, { value: "Module" }));
5178
5184
  function Z(e, t, n) {
5179
5185
  return e.on(t, n), function() {
5180
5186
  e.off(t, n);
5181
5187
  };
5182
5188
  }
5183
- const vu = Object.freeze({
5189
+ const bu = Object.freeze({
5184
5190
  connect: 1,
5185
5191
  connect_error: 1,
5186
5192
  disconnect: 1,
@@ -5305,7 +5311,7 @@ class So extends j {
5305
5311
  */
5306
5312
  emit(t, ...n) {
5307
5313
  var r, i, o;
5308
- if (vu.hasOwnProperty(t))
5314
+ if (bu.hasOwnProperty(t))
5309
5315
  throw new Error('"' + t.toString() + '" is a reserved event name');
5310
5316
  if (n.unshift(t), this._opts.retries && !this.flags.fromQueue && !this.flags.volatile)
5311
5317
  return this._addToQueue(n), this;
@@ -5812,7 +5818,7 @@ class wn extends j {
5812
5818
  max: this.reconnectionDelayMax(),
5813
5819
  jitter: this.randomizationFactor()
5814
5820
  }), this.timeout(n.timeout == null ? 2e4 : n.timeout), this._readyState = "closed", this.uri = t;
5815
- const i = n.parser || yu;
5821
+ const i = n.parser || vu;
5816
5822
  this.encoder = new i.Encoder(), this.decoder = new i.Decoder(), this._autoConnect = n.autoConnect !== !1, this._autoConnect && this.open();
5817
5823
  }
5818
5824
  reconnection(t) {
@@ -5855,7 +5861,7 @@ class wn extends j {
5855
5861
  open(t) {
5856
5862
  if (~this._readyState.indexOf("open"))
5857
5863
  return this;
5858
- this.engine = new ou(this.uri, this.opts);
5864
+ this.engine = new su(this.uri, this.opts);
5859
5865
  const n = this.engine, r = this;
5860
5866
  this._readyState = "opening", this.skipReconnect = !1;
5861
5867
  const i = Z(n, "open", function() {
@@ -6045,7 +6051,7 @@ class wn extends j {
6045
6051
  const Be = {};
6046
6052
  function Re(e, t) {
6047
6053
  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;
6054
+ 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
6055
  let c;
6050
6056
  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
6057
  }
@@ -6055,7 +6061,7 @@ Object.assign(Re, {
6055
6061
  io: Re,
6056
6062
  connect: Re
6057
6063
  });
6058
- function bu(e) {
6064
+ function wu(e) {
6059
6065
  const t = /* @__PURE__ */ new Map();
6060
6066
  let n = 0, r = null;
6061
6067
  const i = () => {
@@ -6103,7 +6109,7 @@ function bu(e) {
6103
6109
  }
6104
6110
  };
6105
6111
  }
6106
- function Mr() {
6112
+ function Lr() {
6107
6113
  let t = Se().serverOrigin || "/";
6108
6114
  if (t === "/" && typeof window < "u") {
6109
6115
  const n = window.location;
@@ -6111,17 +6117,17 @@ function Mr() {
6111
6117
  }
6112
6118
  return new URL(t.startsWith("http") ? t : `${window.location.origin}${t}`).origin;
6113
6119
  }
6114
- let Nr;
6115
- function wu() {
6116
- return Nr ??= bu({
6117
- wire: { channel: Kc, parseChanged: Yc },
6120
+ let Mr;
6121
+ function _u() {
6122
+ return Mr ??= wu({
6123
+ wire: { channel: hc, parseChanged: fc },
6118
6124
  connect: () => {
6119
- const e = Re(Mr(), { path: ki, transports: ["websocket", "polling"] });
6120
- return m("room-feed", "feed socket opened", { origin: Mr() }), e;
6125
+ const e = Re(Lr(), { path: Ti, transports: ["websocket", "polling"] });
6126
+ return m("room-feed", "feed socket opened", { origin: Lr() }), e;
6121
6127
  }
6122
- }), Nr;
6128
+ }), Mr;
6123
6129
  }
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 = [
6130
+ 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
6131
  x("effect", "glint", "Glint"),
6126
6132
  x("effect", "aura", "Aura"),
6127
6133
  x("effect", "hop", "Hop", V),
@@ -6200,9 +6206,9 @@ var _u = ["effect", "gradient", "font", "overlay", "message"], x = (e, t, n, r =
6200
6206
  x("message", "bubble", "Bubble", V),
6201
6207
  x("message", "drift", "Drift")
6202
6208
  ], _n = new Map(
6203
- qn.map((e) => [e.id, e])
6209
+ Hn.map((e) => [e.id, e])
6204
6210
  );
6205
- qn.filter(
6211
+ Hn.filter(
6206
6212
  (e) => e.earn !== void 0 && !e.hidden
6207
6213
  );
6208
6214
  var To = { x: 0, y: 0, r: 0, s: 100, flip: !1, back: !1 }, Fe = {
@@ -6229,13 +6235,13 @@ function En(e, t) {
6229
6235
  bottom: Math.max(...k)
6230
6236
  };
6231
6237
  }
6232
- var Eu = qn.filter((e) => !!e.art), Su = {
6238
+ var Su = Hn.filter((e) => !!e.art), Tu = {
6233
6239
  left: -25,
6234
- top: Math.floor(Math.min(...Eu.map((e) => En(e.art, To).top))),
6240
+ top: Math.floor(Math.min(...Su.map((e) => En(e.art, To).top))),
6235
6241
  right: 125,
6236
6242
  bottom: 110
6237
6243
  }, dt = (e, [t, n]) => Math.min(n, Math.max(t, e));
6238
- function Tu(e, t) {
6244
+ function ku(e, t) {
6239
6245
  const n = (a, c) => typeof a == "number" && Number.isFinite(a) ? a : c, r = {
6240
6246
  x: Math.round(dt(n(t.x, 0), Fe.x)),
6241
6247
  y: Math.round(dt(n(t.y, 0), Fe.y)),
@@ -6243,7 +6249,7 @@ function Tu(e, t) {
6243
6249
  s: Math.round(dt(n(t.s, 100), Fe.s)),
6244
6250
  flip: t.flip === !0,
6245
6251
  back: t.back === !0
6246
- }, i = Su;
6252
+ }, i = Tu;
6247
6253
  let o = En(e, r);
6248
6254
  const s = Math.min(
6249
6255
  (i.right - i.left - 2) / (o.right - o.left),
@@ -6251,62 +6257,62 @@ function Tu(e, t) {
6251
6257
  );
6252
6258
  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
6259
  }
6254
- function ku(e) {
6260
+ function Ru(e) {
6255
6261
  if (!e || typeof e != "object") return;
6256
6262
  const t = e, n = {};
6257
- for (const i of _u) {
6263
+ for (const i of Eu) {
6258
6264
  const o = t[i], s = typeof o == "string" ? _n.get(o) : void 0;
6259
6265
  s && !s.hidden && s.slot === i && (n[i] = s.id);
6260
6266
  }
6261
6267
  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;
6268
+ return r && t.placement && typeof t.placement == "object" && (n.placement = ku(r, t.placement)), Object.keys(n).length ? n : void 0;
6263
6269
  }
6264
- var Ru = 0.3, xu = 0.82, ke = 24, Cu = 32;
6265
- function Au(e) {
6270
+ var xu = 0.3, Cu = 0.82, ke = 24, Au = 32;
6271
+ function Iu(e) {
6266
6272
  let t = 0, n = 0, r = 0, i = 0;
6267
6273
  for (let o = 0; o + 3 < e.length; o += 4) {
6268
6274
  const s = e[o + 3];
6269
- s < Cu || (t += e[o] * s, n += e[o + 1] * s, r += e[o + 2] * s, i += s);
6275
+ s < Au || (t += e[o] * s, n += e[o + 1] * s, r += e[o + 2] * s, i += s);
6270
6276
  }
6271
- return i === 0 ? null : Iu(t / i, n / i, r / i);
6277
+ return i === 0 ? null : Pu(t / i, n / i, r / i);
6272
6278
  }
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");
6279
+ function Pu(e, t, n) {
6280
+ 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
6281
  return `#${d(a)}${d(c)}${d(u)}`;
6276
6282
  }
6277
- function Pu(e, t, n) {
6283
+ function Ou(e, t, n) {
6278
6284
  const r = Math.max(e, t, n), i = Math.min(e, t, n), o = (r + i) / 2;
6279
6285
  if (r === i) return [0, 0, o];
6280
6286
  const s = r - i, a = o > 0.5 ? s / (2 - r - i) : s / (r + i);
6281
6287
  let c;
6282
6288
  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
6289
  }
6284
- function Ou(e, t, n) {
6290
+ function Lu(e, t, n) {
6285
6291
  if (t === 0) return [n, n, n];
6286
6292
  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
6293
  return [o(e + 1 / 3), o(e), o(e - 1 / 3)];
6288
6294
  }
6289
6295
  var Tt = /* @__PURE__ */ new Map(), on = /* @__PURE__ */ new Map(), Sn = /* @__PURE__ */ new Set();
6290
- function Lu(e) {
6296
+ function Mu(e) {
6291
6297
  return Tt.get(e);
6292
6298
  }
6293
- function Mu(e) {
6299
+ function Nu(e) {
6294
6300
  return Sn.add(e), () => {
6295
6301
  Sn.delete(e);
6296
6302
  };
6297
6303
  }
6298
- function Nu(e) {
6304
+ function Du(e) {
6299
6305
  if (Tt.has(e)) return Promise.resolve(Tt.get(e) ?? null);
6300
6306
  const t = on.get(e);
6301
6307
  if (t) return t;
6302
- const n = Du(e).then((r) => {
6308
+ const n = $u(e).then((r) => {
6303
6309
  on.delete(e), Tt.set(e, r);
6304
6310
  for (const i of Sn) i();
6305
6311
  return r;
6306
6312
  });
6307
6313
  return on.set(e, n), n;
6308
6314
  }
6309
- function Du(e) {
6315
+ function $u(e) {
6310
6316
  return typeof Image > "u" || typeof document > "u" ? Promise.resolve(null) : new Promise((t) => {
6311
6317
  const n = new Image();
6312
6318
  n.crossOrigin = "anonymous", n.referrerPolicy = "no-referrer", n.onload = () => {
@@ -6319,24 +6325,24 @@ function Du(e) {
6319
6325
  }
6320
6326
  i.drawImage(n, 0, 0, ke, ke);
6321
6327
  try {
6322
- t(Au(i.getImageData(0, 0, ke, ke).data));
6328
+ t(Iu(i.getImageData(0, 0, ke, ke).data));
6323
6329
  } catch (o) {
6324
6330
  console.debug("[prefs-client] picture colour unreadable", e, o), t(null);
6325
6331
  }
6326
6332
  }, n.onerror = () => t(null), n.src = e;
6327
6333
  });
6328
6334
  }
6329
- var Vn = "/cosmetics", Dr = "hadoku-cosmetics", Y = (e) => e.replace(
6335
+ var qn = "/cosmetics", Nr = "hadoku-cosmetics", Y = (e) => e.replace(
6330
6336
  /[&<>"']/g,
6331
6337
  (t) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[t]
6332
6338
  ), Ge = (e) => e ? e.slice(e.indexOf(".") + 1) : "none";
6333
- function $u(e) {
6339
+ function Bu(e) {
6334
6340
  const t = e.s / 100 * (e.flip ? -1 : 1);
6335
6341
  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
6342
  }
6337
- var Bu = /* @__PURE__ */ new Set(["hop"]);
6343
+ var Fu = /* @__PURE__ */ new Set(["hop"]);
6338
6344
  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(
6345
+ 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
6346
  (b, E) => `<span class="hc-ch" style="--hc-i:${E}"><span class="hc-c">${b === " " ? "&nbsp;" : Y(b)}</span></span>`
6341
6347
  ).join("")}</span>` : `<span class="hc-tx">${s}</span>`, u = (b) => `<span class="hc-lyr${b}" aria-hidden="true">${s}</span>`;
6342
6348
  let d = "", h = "";
@@ -6348,23 +6354,23 @@ function rf(e, t, n = {}) {
6348
6354
  ([b, E, w]) => `<i class="hc-tw" aria-hidden="true" style="left:${b}%;top:${E}%;animation-delay:${w}s"></i>`
6349
6355
  ).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
6356
  }
6351
- var Fu = (() => {
6357
+ var Uu = (() => {
6352
6358
  let e = "";
6353
6359
  for (let t = 0; t < 12; t++)
6354
6360
  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
6361
  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
6362
  })();
6357
- function of(e, t = Vn) {
6363
+ function of(e, t = qn) {
6358
6364
  const n = e?.overlay;
6359
6365
  if (!n) return "";
6360
6366
  const r = _n.get(n)?.art;
6361
6367
  if (r) {
6362
6368
  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>`;
6369
+ 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
6370
  }
6365
6371
  switch (Ge(n)) {
6366
6372
  case "runes":
6367
- return `<span class="hc-ol hc-runes">${Fu}</span>`;
6373
+ return `<span class="hc-ol hc-runes">${Uu}</span>`;
6368
6374
  case "comet":
6369
6375
  return '<span class="hc-ol hc-comet"></span>';
6370
6376
  case "shine":
@@ -6379,18 +6385,18 @@ function of(e, t = Vn) {
6379
6385
  return "";
6380
6386
  }
6381
6387
  }
6382
- var $r = "!<>-_/[]{}=+*^?#%&01", Br = /* @__PURE__ */ new Set(["type", "decode", "cascade"]), Fr = 1400, Uu = 160;
6388
+ var Dr = "!<>-_/[]{}=+*^?#%&01", $r = /* @__PURE__ */ new Set(["type", "decode", "cascade"]), Br = 1400, ju = 160;
6383
6389
  function sf(e, t, n = {}) {
6384
6390
  let r = Ge(t?.message);
6385
6391
  if (r === "none") return `<span class="hc-msg">${Y(e)}</span>`;
6386
6392
  const i = e.split(/\s+/).filter(Boolean);
6387
- Br.has(r) && e.length > Uu && (r = "words");
6393
+ $r.has(r) && e.length > ju && (r = "words");
6388
6394
  const o = n.keep ? " data-hc-keep" : "";
6389
6395
  let s, a;
6390
- if (Br.has(r)) {
6391
- a = Math.min(38, Fr / Math.max(1, e.length));
6396
+ if ($r.has(r)) {
6397
+ a = Math.min(38, Br / Math.max(1, e.length));
6392
6398
  let c = 0;
6393
- const u = () => $r[Math.floor(Math.random() * $r.length)];
6399
+ const u = () => Dr[Math.floor(Math.random() * Dr.length)];
6394
6400
  s = i.map(
6395
6401
  (v) => `<span class="hc-w">${[...v].map((b) => {
6396
6402
  const E = c++;
@@ -6400,18 +6406,18 @@ function sf(e, t, n = {}) {
6400
6406
  const d = r === "type" ? "hc-caret" : r === "decode" ? "hc-r" : "hc-ch", h = s.lastIndexOf(`<span class="${d}"`);
6401
6407
  s = `${s.slice(0, h)}<span data-hc-last class="${d}"${s.slice(h + `<span class="${d}"`.length)}`;
6402
6408
  } else
6403
- a = Math.min(90, Fr / Math.max(1, i.length)), s = i.map(
6409
+ a = Math.min(90, Br / Math.max(1, i.length)), s = i.map(
6404
6410
  (c, u) => `<span class="hc-w" style="--hc-i:${u}"${u === i.length - 1 ? " data-hc-last" : ""}>${Y(c)}</span>`
6405
6411
  ).join(" ");
6406
6412
  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
6413
  }
6408
- function ju(e) {
6414
+ function Hu(e) {
6409
6415
  const t = e.target;
6410
6416
  if (e.pseudoElement || !t?.hasAttribute?.("data-hc-last")) return;
6411
6417
  const n = t.closest(".hc-msg");
6412
6418
  !n || n.hasAttribute("data-hc-keep") || (n.className = "hc-msg", n.removeAttribute("style"), n.textContent = n.getAttribute("data-text") ?? "");
6413
6419
  }
6414
- var Ur = {
6420
+ var Fr = {
6415
6421
  script: {
6416
6422
  file: "caveat",
6417
6423
  family: "Caveat",
@@ -6475,11 +6481,11 @@ var Ur = {
6475
6481
  css: "font-weight:400;font-size:.62em;line-height:1.6"
6476
6482
  }
6477
6483
  };
6478
- function Hu(e = Vn) {
6479
- const t = Object.entries(Ur).map(
6484
+ function qu(e = qn) {
6485
+ const t = Object.entries(Fr).map(
6480
6486
  ([r, i]) => `@font-face{font-family:"hc-${r}";src:url("${e}/fonts/${i.file}.woff2") format("woff2");font-display:swap}`
6481
6487
  ).join(`
6482
- `), n = Object.entries(Ur).map(([r, i]) => `.hc-font-${r}{font-family:"hc-${r}","${i.family}",${i.generic};${i.css}}`).join(`
6488
+ `), n = Object.entries(Fr).map(([r, i]) => `.hc-font-${r}{font-family:"hc-${r}","${i.family}",${i.generic};${i.css}}`).join(`
6483
6489
  `);
6484
6490
  return `${t}
6485
6491
  /* Colours: everything derives from the character colour. */
@@ -6570,21 +6576,21 @@ ${n}
6570
6576
  @media (prefers-reduced-motion:reduce){.hc-name *,.hc-av *,.hc-av *::after,.hc-msg *,.hc-msg *::before,.hc-msg *::after{animation:none!important}}
6571
6577
  `;
6572
6578
  }
6573
- function af(e = document, t = Vn) {
6574
- if (e.getElementById(Dr)) return;
6579
+ function af(e = document, t = qn) {
6580
+ if (e.getElementById(Nr)) return;
6575
6581
  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);
6582
+ n.id = Nr, n.textContent = qu(t), e.head.appendChild(n), e.addEventListener("animationend", Hu);
6580
6583
  }
6581
6584
  function Vu(e, t) {
6585
+ return (t ? Mu(t) : null) ?? Xi(e);
6586
+ }
6587
+ function zu(e, t) {
6582
6588
  return he(() => {
6583
- t && Nu(t);
6584
- }, [t]), Mt(Mu, () => qu(e, t), () => Ji(e));
6589
+ t && Du(t);
6590
+ }, [t]), Mt(Nu, () => Vu(e, t), () => Xi(e));
6585
6591
  }
6586
- function zu({ sprite: e, url: t, alt: n = "", className: r, style: i, fallback: o }) {
6587
- const [s, a] = ti(null);
6592
+ function Wu({ sprite: e, url: t, alt: n = "", className: r, style: i, fallback: o }) {
6593
+ const [s, a] = ei(null);
6588
6594
  if (t && t !== s)
6589
6595
  return /* @__PURE__ */ S(
6590
6596
  "img",
@@ -6598,14 +6604,14 @@ function zu({ sprite: e, url: t, alt: n = "", className: r, style: i, fallback:
6598
6604
  onError: () => a(t)
6599
6605
  }
6600
6606
  );
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 });
6607
+ const c = Qi(e);
6608
+ return c ? /* @__PURE__ */ S("img", { src: c, alt: n, crossOrigin: "anonymous", className: r, style: i, draggable: !1 }) : /* @__PURE__ */ S(Zr, { children: o });
6603
6609
  }
6604
- const Wu = "hadoku://library";
6605
- function Gu(e = typeof navigator < "u" ? navigator.userAgent : void 0) {
6610
+ const Gu = "hadoku://library";
6611
+ function Ku(e = typeof navigator < "u" ? navigator.userAgent : void 0) {
6606
6612
  return e !== void 0 && /(^|\s)HadokuApp\/\S/.test(e);
6607
6613
  }
6608
- function Ku(e) {
6614
+ function Yu(e) {
6609
6615
  return e.slice().sort(
6610
6616
  (t, n) => (n.users?.length ?? 0) - (t.users?.length ?? 0) || t.room_id.localeCompare(n.room_id)
6611
6617
  );
@@ -6614,10 +6620,10 @@ async function ko(e, t = 1) {
6614
6620
  const n = Ft(), r = Date.now();
6615
6621
  m("home", "rooms-fetch: start", { attempt: t });
6616
6622
  try {
6617
- const i = await fetch(`${n}/api/rooms${Ki() ? "?debug=1" : ""}`, { cache: "no-store", signal: e });
6623
+ const i = await fetch(`${n}/api/rooms${Yi() ? "?debug=1" : ""}`, { cache: "no-store", signal: e });
6618
6624
  if (!i.ok) throw new Error(`HTTP ${i.status}`);
6619
6625
  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 || []);
6626
+ return m("home", "rooms-fetch: success", { attempt: t, elapsedMs: Date.now() - r, roomCount: (o.rooms ?? []).length }), Yu(o.rooms || []);
6621
6627
  } catch (i) {
6622
6628
  if (i instanceof Error && i.name === "AbortError") throw i;
6623
6629
  const o = i instanceof Error ? i.message : void 0;
@@ -6626,11 +6632,11 @@ async function ko(e, t = 1) {
6626
6632
  throw pe("app", "Failed to load rooms list", { elapsedMs: Date.now() - r, error: o }), i;
6627
6633
  }
6628
6634
  }
6629
- function Yu(e) {
6635
+ function Ju(e) {
6630
6636
  return e.room_id.split("-").map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join(" ");
6631
6637
  }
6632
- function Ju({ user: e }) {
6633
- const t = Vu(e.sprite_id, e.avatar_url);
6638
+ function Xu({ user: e }) {
6639
+ const t = zu(e.sprite_id, e.avatar_url);
6634
6640
  return /* @__PURE__ */ J("span", { className: "relative -ml-2 first:ml-0 group/av", children: [
6635
6641
  /* @__PURE__ */ S(
6636
6642
  "span",
@@ -6638,7 +6644,7 @@ function Ju({ user: e }) {
6638
6644
  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
6645
  style: { borderColor: t },
6640
6646
  children: /* @__PURE__ */ S(
6641
- zu,
6647
+ Wu,
6642
6648
  {
6643
6649
  sprite: e.sprite_id,
6644
6650
  url: e.avatar_url,
@@ -6659,7 +6665,7 @@ function Ju({ user: e }) {
6659
6665
  )
6660
6666
  ] });
6661
6667
  }
6662
- function Xu({ room: e }) {
6668
+ function Qu({ room: e }) {
6663
6669
  const t = e.users ?? [], n = t.length;
6664
6670
  return /* @__PURE__ */ J("li", { className: "flex items-stretch gap-2", children: [
6665
6671
  /* @__PURE__ */ S(
@@ -6668,8 +6674,8 @@ function Xu({ room: e }) {
6668
6674
  to: `/room/${encodeURIComponent(e.viewer_key)}`,
6669
6675
  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
6676
  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}`)) })
6677
+ /* @__PURE__ */ S("div", { className: "text-xl font-medium tracking-wide text-text no-underline", children: Ju(e) }),
6678
+ n > 0 && /* @__PURE__ */ S("div", { className: "flex shrink-0", children: t.map((r, i) => /* @__PURE__ */ S(Xu, { user: r }, `${r.name}-${i}`)) })
6673
6679
  ] })
6674
6680
  }
6675
6681
  ),
@@ -6684,9 +6690,9 @@ function Xu({ room: e }) {
6684
6690
  )
6685
6691
  ] });
6686
6692
  }
6687
- function Qu() {
6688
- const e = xc(), { list: t, loading: n, error: r, refresh: i } = Tl("list", {
6689
- pings: wu(),
6693
+ function Zu() {
6694
+ const e = Mc(), { list: t, loading: n, error: r, refresh: i } = kl("list", {
6695
+ pings: _u(),
6690
6696
  fetchList: (h) => ko(h)
6691
6697
  }), o = qo(() => t ?? [], [t]), s = t === null ? r : null, a = eo(), c = we(null);
6692
6698
  he(() => {
@@ -6715,15 +6721,15 @@ function Qu() {
6715
6721
  children: "Retry"
6716
6722
  }
6717
6723
  )
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)) }) })
6724
+ ] }) : 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
6725
  ] }),
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: [
6726
+ 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" }) }),
6727
+ Ku() && /* @__PURE__ */ J("div", { className: "w-full max-w-md z-10", children: [
6722
6728
  /* @__PURE__ */ S("h2", { className: "text-xs uppercase tracking-[0.2em] text-text-muted/70 mb-3 px-1", children: "On this phone" }),
6723
6729
  /* @__PURE__ */ J(
6724
6730
  "a",
6725
6731
  {
6726
- href: Wu,
6732
+ href: Gu,
6727
6733
  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
6734
  children: [
6729
6735
  /* @__PURE__ */ S("div", { className: "text-xl font-medium tracking-wide text-text", children: "Library" }),
@@ -6734,18 +6740,18 @@ function Qu() {
6734
6740
  ] })
6735
6741
  ] });
6736
6742
  }
6737
- function Zu() {
6743
+ function ed() {
6738
6744
  return /* @__PURE__ */ J("div", { className: "fixed inset-0 bg-black", children: [
6739
6745
  /* @__PURE__ */ S(lo, {}),
6740
6746
  /* @__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
6747
  ] });
6742
6748
  }
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));
6749
+ const td = "watchparty_fragment_delivery", nd = /^[0-9a-f]{64}$/, rd = /^[A-Za-z0-9_.-]+$/;
6750
+ function id(e) {
6751
+ return !(!e || !e.baseUrl || e.baseUrl.endsWith("/") || !nd.test(e.token) || e.trackId !== void 0 && !rd.test(e.trackId));
6746
6752
  }
6747
6753
  function cf(e, t) {
6748
- if (!rd(e)) return null;
6754
+ if (!id(e)) return null;
6749
6755
  let n;
6750
6756
  if (t === "init")
6751
6757
  n = "init";
@@ -6756,7 +6762,7 @@ function cf(e, t) {
6756
6762
  const r = e.trackId ? `audio/${e.trackId}/` : "";
6757
6763
  return `${e.baseUrl}/v/${e.token}/${r}${n}`;
6758
6764
  }
6759
- function id() {
6765
+ function od() {
6760
6766
  if (typeof window > "u") return null;
6761
6767
  try {
6762
6768
  const e = new URLSearchParams(window.location.search).get("fragmentDelivery");
@@ -6764,35 +6770,35 @@ function id() {
6764
6770
  if (e === "0" || e === "false") return !1;
6765
6771
  } catch {
6766
6772
  }
6767
- return Ac(ed);
6773
+ return Dc(td);
6768
6774
  }
6769
- let zn = { ...Oi }, kt = null, Ro = !1;
6770
- const jr = "watchparty_delivery_client_id";
6771
- function od() {
6772
- const e = ie(jr);
6775
+ let Vn = { ...Oi }, kt = null, Ro = !1;
6776
+ const Ur = "watchparty_delivery_client_id";
6777
+ function sd() {
6778
+ const e = ie(Ur);
6773
6779
  if (e) return e;
6774
6780
  const t = globalThis.crypto?.randomUUID?.() ?? `d${Math.random().toString(36).slice(2)}`;
6775
- return Nn(jr, t) ? t : "";
6781
+ return Mn(Ur, t) ? t : "";
6776
6782
  }
6777
- function sd(e) {
6778
- zn = Li(e), Ro || (kt = null);
6783
+ function ad(e) {
6784
+ Vn = Li(e), Ro || (kt = null);
6779
6785
  }
6780
- function ad() {
6781
- return { ...zn };
6786
+ function cd() {
6787
+ return { ...Vn };
6782
6788
  }
6783
6789
  function xo() {
6784
- return kt === null && (kt = nc(zn, od(), id())), kt;
6790
+ return kt === null && (kt = ec(Vn, sd(), od())), kt;
6785
6791
  }
6786
- let Hr = !1;
6787
- async function cd(e) {
6788
- if (!Hr) {
6789
- Hr = !0;
6792
+ let jr = !1;
6793
+ async function ld(e) {
6794
+ if (!jr) {
6795
+ jr = !0;
6790
6796
  for (let t = 0; t < 2; t++) {
6791
6797
  try {
6792
6798
  const n = await fetch(`${e}/api/flags`, { cache: "no-store" });
6793
6799
  if (n.ok) {
6794
6800
  const r = await n.json();
6795
- sd(r?.fragment_delivery), m("app", "Delivery flag loaded", { ...ad(), attempt: t });
6801
+ ad(r?.fragment_delivery), m("app", "Delivery flag loaded", { ...cd(), attempt: t });
6796
6802
  return;
6797
6803
  }
6798
6804
  } catch {
@@ -6802,54 +6808,54 @@ async function cd(e) {
6802
6808
  L("app", "Delivery flag fetch failed; staying on the default delivery path");
6803
6809
  }
6804
6810
  }
6805
- function ld() {
6811
+ function ud() {
6806
6812
  return xo();
6807
6813
  }
6808
6814
  function lf() {
6809
6815
  const e = xo();
6810
6816
  return Ro = !0, e === "fragment";
6811
6817
  }
6812
- let Wn = cc;
6818
+ let zn = sc;
6813
6819
  const Tn = /* @__PURE__ */ new Set();
6814
- function ud(e) {
6815
- Wn = e;
6820
+ function dd(e) {
6821
+ zn = e;
6816
6822
  for (const t of Tn) t();
6817
6823
  }
6818
- function dd(e) {
6819
- const t = ac.safeParse(e?.games);
6824
+ function hd(e) {
6825
+ const t = oc.safeParse(e?.games);
6820
6826
  if (!t.success)
6821
6827
  return L("game", "Game catalog rejected; keeping the current list", { issues: t.error.issues.length }), !1;
6822
6828
  const n = t.data;
6823
- return ud(n), !0;
6829
+ return dd(n), !0;
6824
6830
  }
6825
- let qr = !1;
6826
- async function hd(e) {
6827
- if (!qr) {
6828
- qr = !0;
6831
+ let Hr = !1;
6832
+ async function fd(e) {
6833
+ if (!Hr) {
6834
+ Hr = !0;
6829
6835
  try {
6830
6836
  const t = await fetch(`${e}/api/games`, { cache: "no-store" });
6831
6837
  if (!t.ok) {
6832
6838
  L("game", "Game catalog fetch failed; using the default list", { status: t.status });
6833
6839
  return;
6834
6840
  }
6835
- dd(await t.json()) && m("game", "Game catalog loaded", { games: Wn.map((n) => n.id) });
6841
+ hd(await t.json()) && m("game", "Game catalog loaded", { games: zn.map((n) => n.id) });
6836
6842
  } catch (t) {
6837
6843
  L("game", "Game catalog fetch failed; using the default list", te(t));
6838
6844
  }
6839
6845
  }
6840
6846
  }
6841
- function fd() {
6842
- return Wn;
6847
+ function pd() {
6848
+ return zn;
6843
6849
  }
6844
- function pd(e) {
6850
+ function md(e) {
6845
6851
  return Tn.add(e), () => {
6846
6852
  Tn.delete(e);
6847
6853
  };
6848
6854
  }
6849
6855
  function uf() {
6850
- return Mt(pd, fd);
6856
+ return Mt(md, pd);
6851
6857
  }
6852
- function md(e) {
6858
+ function gd(e) {
6853
6859
  return ye.lazy(async () => {
6854
6860
  try {
6855
6861
  return await e();
@@ -6863,44 +6869,44 @@ function md(e) {
6863
6869
  }
6864
6870
  });
6865
6871
  }
6866
- const gd = ["demo-room"];
6867
- function yd(e) {
6868
- return e ? gd.some((t) => e === t || e.startsWith(t + "-")) : !1;
6869
- }
6872
+ const yd = ["demo-room"];
6870
6873
  function vd(e) {
6874
+ return e ? yd.some((t) => e === t || e.startsWith(t + "-")) : !1;
6875
+ }
6876
+ function bd(e) {
6871
6877
  if (!(e.hostname === "hadoku.me")) return null;
6872
6878
  if (e.requireAuth) {
6873
- if (br() !== "public") return null;
6879
+ if (vr() !== "public") return null;
6874
6880
  const r = e.pathname + (e.search || "");
6875
6881
  return `/auth?return=${encodeURIComponent(r)}`;
6876
6882
  }
6877
- if (!e.roomKey || yd(e.roomKey) || br() !== "public") return null;
6883
+ if (!e.roomKey || vd(e.roomKey) || vr() !== "public") return null;
6878
6884
  const n = e.pathname + (e.search || "");
6879
6885
  return `/auth?return=${encodeURIComponent(n)}`;
6880
6886
  }
6881
- const Vr = md(() => import("./Room-DU5VG_Ve.js").then((e) => e.R));
6882
- function zr() {
6887
+ const qr = gd(() => import("./Room-DVcOlK8s.js").then((e) => e.R));
6888
+ function Vr() {
6883
6889
  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
6890
  }
6885
- function bd() {
6886
- const e = be(), t = Ms(), n = vd({
6891
+ function wd() {
6892
+ const e = be(), t = Ms(), n = bd({
6887
6893
  roomKey: t.roomKey,
6888
6894
  hostname: window.location.hostname,
6889
6895
  pathname: window.location.pathname,
6890
6896
  search: window.location.search
6891
6897
  });
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" });
6898
+ 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
6899
  }
6894
6900
  function sn(e) {
6895
- const [t, n] = ti(!1), r = eo(), i = {
6901
+ const [t, n] = ei(!1), r = eo(), i = {
6896
6902
  serverOrigin: e.serverOrigin || Ve.serverOrigin,
6897
6903
  defaultRoomKey: e.defaultRoomKey || Ve.defaultRoomKey,
6898
6904
  cdnBase: e.cdnBase || Ve.cdnBase
6899
- }, o = Hi(i);
6905
+ }, o = qi(i);
6900
6906
  return he(() => {
6901
6907
  const s = new AbortController();
6902
6908
  async function a() {
6903
- const c = o + mr;
6909
+ const c = o + pr;
6904
6910
  m("app", "Checking API health", { url: c });
6905
6911
  try {
6906
6912
  const u = await fetch(c, {
@@ -6908,7 +6914,7 @@ function sn(e) {
6908
6914
  signal: s.signal
6909
6915
  });
6910
6916
  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));
6917
+ u.ok ? (m("app", "API health check passed"), ld(o), fd(o)) : (pe("app", "API health check failed", { status: u.status }), n(!0));
6912
6918
  } catch (u) {
6913
6919
  if (u?.name === "AbortError") return;
6914
6920
  pe("app", "API unreachable", { url: c, error: u }), n(!0);
@@ -6918,7 +6924,7 @@ function sn(e) {
6918
6924
  }, [o]), he(() => {
6919
6925
  if (!t) return;
6920
6926
  async function s() {
6921
- const c = o + mr;
6927
+ const c = o + pr;
6922
6928
  try {
6923
6929
  (await fetch(c, {
6924
6930
  cache: "no-store",
@@ -6936,7 +6942,7 @@ function sn(e) {
6936
6942
  function s() {
6937
6943
  m("app", "Preloading character sprites", { count: Ae.length });
6938
6944
  for (const c of Ae) {
6939
- const u = Xi(c);
6945
+ const u = Qi(c);
6940
6946
  if (!u) continue;
6941
6947
  const d = new Image();
6942
6948
  d.crossOrigin = "anonymous", d.decoding = "async", d.loading = "eager", d.src = u;
@@ -6946,19 +6952,19 @@ function sn(e) {
6946
6952
  "requestIdleCallback" in window ? window.requestIdleCallback(s, { timeout: 2e3 }) : setTimeout(s, 600);
6947
6953
  }
6948
6954
  document.readyState === "complete" ? a() : window.addEventListener("load", a, { once: !0 });
6949
- }, []), t ? /* @__PURE__ */ S(Zu, {}) : (
6955
+ }, []), t ? /* @__PURE__ */ S(ed, {}) : (
6950
6956
  // HadokuThemeRoot must sit above everything that reads the theme —
6951
6957
  // <HadokuThemePicker> in ChatPanel throws without it, by design, so a
6952
6958
  // missing provider is a mount-time error rather than a silently wrong
6953
6959
  // theme. It also applies data-theme, which this app previously did through
6954
6960
  // 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, {})
6961
+ /* @__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: [
6962
+ /* @__PURE__ */ S("main", { className: "flex-1 w-full overflow-hidden min-h-0 flex flex-col", children: /* @__PURE__ */ S(wd, {}) }),
6963
+ /* @__PURE__ */ S(yl, {})
6958
6964
  ] }) }) })
6959
6965
  );
6960
6966
  }
6961
- function wd({ basename: e = "/watchparty", appProps: t = {} }) {
6967
+ function _d({ basename: e = "/watchparty", appProps: t = {} }) {
6962
6968
  return /* @__PURE__ */ S(ba, { basename: e, children: /* @__PURE__ */ J(Ys, { children: [
6963
6969
  /* @__PURE__ */ S(mt, { path: "/", element: /* @__PURE__ */ S(sn, { ...t }) }),
6964
6970
  /* @__PURE__ */ S(mt, { path: "/room/:roomKey", element: /* @__PURE__ */ S(sn, { ...t }) }),
@@ -6969,7 +6975,7 @@ let Rt;
6969
6975
  function Co() {
6970
6976
  return ie(Jo) || void 0;
6971
6977
  }
6972
- function _d() {
6978
+ function Ed() {
6973
6979
  if (Rt) return;
6974
6980
  const e = Co();
6975
6981
  if (e) {
@@ -6982,52 +6988,52 @@ function _d() {
6982
6988
  m("identity", "device id unavailable — joining without one");
6983
6989
  });
6984
6990
  }
6985
- function Ed() {
6991
+ function Sd() {
6986
6992
  return Rt ??= Co();
6987
6993
  }
6988
- const Sd = 5e3;
6989
- function Td(e, t, n) {
6994
+ const Td = 5e3;
6995
+ function kd(e, t, n) {
6990
6996
  return !!e?.some((r) => r.emoji === t && r.by.includes(n));
6991
6997
  }
6992
- function kd(e, t, n) {
6998
+ function Rd(e, t, n) {
6993
6999
  let r = e ?? [];
6994
- for (const [i, o] of t) r = Xc(r, i, n, o.on) ?? r;
7000
+ for (const [i, o] of t) r = mc(r, i, n, o.on) ?? r;
6995
7001
  return r;
6996
7002
  }
6997
- function Rd(e, t, n, r) {
7003
+ function xd(e, t, n, r) {
6998
7004
  const i = /* @__PURE__ */ new Map();
6999
7005
  for (const [o, s] of t)
7000
- s.expires <= r || Td(e, o, n) !== s.on && i.set(o, s);
7006
+ s.expires <= r || kd(e, o, n) !== s.on && i.set(o, s);
7001
7007
  return i;
7002
7008
  }
7003
7009
  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) {
7010
+ function Wn(e, t) {
7011
+ 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
7012
  Qe.delete(e);
7007
7013
  return;
7008
7014
  }
7009
7015
  const n = Math.min(...[...t.intents.values()].map((r) => r.expires));
7010
7016
  t.timer = setTimeout(() => {
7011
- Qe.get(e) === t && Gn(e, t);
7017
+ Qe.get(e) === t && Wn(e, t);
7012
7018
  }, Math.max(0, n - Date.now()));
7013
7019
  }
7014
7020
  function df(e, t, n, r) {
7015
7021
  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);
7022
+ 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
7023
  }
7018
- function xd(e, t) {
7024
+ function Cd(e, t) {
7019
7025
  const n = Qe.get(e);
7020
7026
  if (!n) {
7021
7027
  T.getState().setReactions(e, t);
7022
7028
  return;
7023
7029
  }
7024
- n.confirmed = t, Gn(e, n);
7030
+ n.confirmed = t, Wn(e, n);
7025
7031
  }
7026
- function Cd(e) {
7032
+ function Ad(e) {
7027
7033
  const t = typeof window < "u" ? window.location.href : "http://localhost/", n = new URL(e, t).pathname;
7028
7034
  return `${n.endsWith("/") ? n : `${n}/`}socket.io/`;
7029
7035
  }
7030
- function Wr(e, t) {
7036
+ function zr(e, t) {
7031
7037
  return {
7032
7038
  id: String(e.id ?? e.server_seq ?? t ?? `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`),
7033
7039
  clientId: e.client_id,
@@ -7039,11 +7045,11 @@ function Wr(e, t) {
7039
7045
  // Attachments arrive from other clients, so the key shape is re-checked
7040
7046
  // here at the boundary rather than trusted at render time. A malformed
7041
7047
  // 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,
7048
+ images: Array.isArray(e.images) ? e.images.filter((n) => !!n && Si(n.key)).slice(0, In) : void 0,
7043
7049
  isSystem: e.isSystem || !1,
7044
7050
  systemType: e.systemType,
7045
7051
  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,
7052
+ replyTo: typeof e.reply_to == "string" && xi.test(e.reply_to) ? e.reply_to : void 0,
7047
7053
  reactions: Ao(e.reactions)
7048
7054
  };
7049
7055
  }
@@ -7055,44 +7061,44 @@ function Ao(e) {
7055
7061
  });
7056
7062
  return t.length ? t : void 0;
7057
7063
  }
7058
- function Ad(e, t = () => !0) {
7064
+ function Id(e, t = () => !0) {
7059
7065
  e.on(P.CHAT_BROADCAST, (n) => {
7060
7066
  if (!t()) return;
7061
- const r = { ...Wr(n, n.server_seq), live: !0 };
7067
+ const r = { ...zr(n, n.server_seq), live: !0 };
7062
7068
  T.getState().appendChat(r), m("chat", "Message received", r);
7063
7069
  }), e.on(P.CHAT_HISTORY, (n) => {
7064
7070
  if (!t() || !n?.messages || !Array.isArray(n.messages)) return;
7065
- const r = n.messages.map((i) => Wr(i));
7071
+ const r = n.messages.map((i) => zr(i));
7066
7072
  T.getState().setChat(r), m("chat", "History loaded", { count: r.length });
7067
7073
  }), e.on(P.CHAT_REACTION, (n) => {
7068
- t() && (!n || typeof n.id != "string" || xd(n.id, Ao(n.reactions) ?? []));
7074
+ t() && (!n || typeof n.id != "string" || Cd(n.id, Ao(n.reactions) ?? []));
7069
7075
  }), e.on(P.CHAT_TYPING, (n) => {
7070
7076
  t() && (!n || typeof n.client_id != "string" || typeof n.typing != "boolean" || T.getState().setTyping(n.client_id, n.typing));
7071
7077
  });
7072
7078
  }
7073
- let Id = null;
7074
- function Pd(e = Id) {
7079
+ let Pd = null;
7080
+ function Od(e = Pd) {
7075
7081
  if (!e) return null;
7076
7082
  const t = typeof window < "u" ? window.location.href : "http://localhost/", n = e.namespace ?? "/room";
7077
7083
  return {
7078
7084
  url: `${new URL(e.origin, t).origin}${n.startsWith("/") ? n : `/${n}`}`,
7079
- path: e.path ?? Cd(e.origin)
7085
+ path: e.path ?? Ad(e.origin)
7080
7086
  };
7081
7087
  }
7082
7088
  function hf(e) {
7083
7089
  const n = `${Ft()}/media/${e}`.replace(/\\/g, "/");
7084
- return { mediaUrl: `${n}/${Qa}`, indexUrl: `${n}/index.json` };
7090
+ return { mediaUrl: `${n}/${Ja}`, indexUrl: `${n}/index.json` };
7085
7091
  }
7086
- function Od(e) {
7092
+ function Ld(e) {
7087
7093
  return `${Ft()}/media/${e}`.replace(/\\/g, "/");
7088
7094
  }
7089
- function Ld(e, t) {
7090
- return Od(t ?? `${e}/poster.jpg`);
7095
+ function Md(e, t) {
7096
+ return Ld(t ?? `${e}/poster.jpg`);
7091
7097
  }
7092
7098
  function Io(e) {
7093
7099
  return `${Ft()}${e}`.replace(/\\/g, "/");
7094
7100
  }
7095
- async function Md(e) {
7101
+ async function Nd(e) {
7096
7102
  try {
7097
7103
  const t = await fetch(Io("/api/tierlist"));
7098
7104
  if (!t.ok)
@@ -7107,15 +7113,15 @@ async function Md(e) {
7107
7113
  return L("tierlist", "Board fetch threw", te(t)), null;
7108
7114
  }
7109
7115
  }
7110
- let Gr = !1;
7116
+ let Wr = !1;
7111
7117
  function ff() {
7112
- if (Gr || typeof Image > "u") return;
7118
+ if (Wr || typeof Image > "u") return;
7113
7119
  const e = T.getState().tierlist;
7114
7120
  if (!(!e || e.items.length === 0)) {
7115
- Gr = !0;
7121
+ Wr = !0;
7116
7122
  for (const t of e.items) {
7117
7123
  const n = new Image();
7118
- n.decoding = "async", n.src = Ld(t.id, t.thumbnail);
7124
+ n.decoding = "async", n.src = Md(t.id, t.thumbnail);
7119
7125
  }
7120
7126
  m("tierlist", "Warming posters", { count: e.items.length });
7121
7127
  }
@@ -7138,21 +7144,21 @@ async function pf(e) {
7138
7144
  T.getState().setTierlistSaving(!1);
7139
7145
  }
7140
7146
  }
7141
- function Nd() {
7142
- const e = T.getState(), t = Qi(Object.values(e.roster).map((i) => i.sprite), void 0, Ae);
7147
+ function Dd() {
7148
+ const e = T.getState(), t = Ni(Object.values(e.roster).map((i) => i.sprite), void 0, Ae);
7143
7149
  if (!t)
7144
7150
  return L("socket", "sprite_taken: no available sprites to retry with"), null;
7145
7151
  const n = !!e.name && !Ee(e.name), r = n ? e.name : Xe(t);
7146
7152
  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
7153
  }
7148
- function Dd(e) {
7154
+ function $d(e) {
7149
7155
  const t = T.getState(), n = e ? t.roster[e] : void 0;
7150
7156
  return !n || !!n.sprite && n.sprite === t.sprite;
7151
7157
  }
7152
- var $d = "https://hadoku.me/prefs", Kr = "hadoku-avatar-link", Bd = "hadoku-avatar-link", Yr = "hadoku-avatar-link-popup";
7153
- function Jr(e) {
7158
+ var Bd = "https://hadoku.me/prefs", Gr = "hadoku-avatar-link", Fd = "hadoku-avatar-link", Kr = "hadoku-avatar-link-popup";
7159
+ function Yr(e) {
7154
7160
  try {
7155
- e ? sessionStorage.setItem(Yr, "1") : sessionStorage.removeItem(Yr);
7161
+ e ? sessionStorage.setItem(Kr, "1") : sessionStorage.removeItem(Kr);
7156
7162
  } catch {
7157
7163
  }
7158
7164
  }
@@ -7162,22 +7168,22 @@ var Lt = class extends Error {
7162
7168
  }
7163
7169
  status;
7164
7170
  };
7165
- async function Fd(e) {
7171
+ async function Ud(e) {
7166
7172
  if (!e.ok) {
7167
7173
  const t = await e.json().catch(() => null);
7168
7174
  throw new Lt(e.status, t?.message ?? `HTTP ${e.status}`);
7169
7175
  }
7170
7176
  return await e.json();
7171
7177
  }
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, {
7178
+ function jd(e = {}) {
7179
+ 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
7180
  method: c,
7175
7181
  ...u === void 0 ? {} : { headers: { "Content-Type": "application/json" }, body: JSON.stringify(u) }
7176
7182
  }), o = () => r("");
7177
7183
  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)
7184
+ Yr(!0);
7185
+ const c = window.open("about:blank", Fd, "popup,width=520,height=760");
7186
+ if (Yr(!1), !c)
7181
7187
  throw new Lt(0, "The sign-in window was blocked: allow pop-ups for hadoku.me");
7182
7188
  let u;
7183
7189
  try {
@@ -7186,13 +7192,13 @@ function Ud(e = {}) {
7186
7192
  throw c.close(), d;
7187
7193
  }
7188
7194
  return c.location.href = u, new Promise((d, h) => {
7189
- const v = new BroadcastChannel(Kr);
7195
+ const v = new BroadcastChannel(Gr);
7190
7196
  let b = !1;
7191
7197
  const E = (_) => {
7192
7198
  b || (b = !0, v.close(), clearInterval(w), clearTimeout(f), _ ? h(new Lt(400, _)) : o().then(d, h));
7193
7199
  };
7194
7200
  v.onmessage = (_) => {
7195
- _.data?.type === Kr && E(_.data.ok ? void 0 : _.data.error);
7201
+ _.data?.type === Gr && E(_.data.ok ? void 0 : _.data.error);
7196
7202
  };
7197
7203
  const w = setInterval(() => {
7198
7204
  c.closed && (clearInterval(w), setTimeout(() => E(), 1500));
@@ -7237,15 +7243,15 @@ function Ud(e = {}) {
7237
7243
  setCosmetics: (a) => i("/cosmetics", "PUT", a)
7238
7244
  };
7239
7245
  }
7240
- var Xr = "hadoku:avatar";
7241
- function Kn(e) {
7246
+ var Jr = "hadoku:avatar";
7247
+ function Gn(e) {
7242
7248
  return e?.sprite ?? e?.avatar?.sprite ?? null;
7243
7249
  }
7244
- async function jd(e = {}) {
7250
+ async function Hd(e = {}) {
7245
7251
  const t = typeof location > "u" ? void 0 : location.origin, n = e.baseUrl ?? (t ? `${t}/prefs` : void 0);
7246
7252
  if (!n) return null;
7247
7253
  try {
7248
- return Kn(await Ud({ baseUrl: n, fetch: e.fetch }).get());
7254
+ return Gn(await jd({ baseUrl: n, fetch: e.fetch }).get());
7249
7255
  } catch (r) {
7250
7256
  return r instanceof Lt && [401, 403, 404].includes(r.status) || (e.onError ?? ((i) => console.warn("[prefs-client] avatar settings unreadable", i)))(r), null;
7251
7257
  }
@@ -7255,30 +7261,30 @@ function mf(e) {
7255
7261
  };
7256
7262
  const t = (n) => {
7257
7263
  const r = n.detail;
7258
- r && e(Kn(r), r);
7264
+ r && e(Gn(r), r);
7259
7265
  };
7260
- return window.addEventListener(Xr, t), () => window.removeEventListener(Xr, t);
7266
+ return window.addEventListener(Jr, t), () => window.removeEventListener(Jr, t);
7261
7267
  }
7262
- const Hd = "hadoku:name";
7268
+ const qd = "hadoku:name";
7263
7269
  function gf(e) {
7264
- const t = Kn(e);
7270
+ const t = Gn(e);
7265
7271
  return Bt(t) ? t : null;
7266
7272
  }
7267
7273
  async function yf(e = {}) {
7268
- const t = await jd({
7274
+ const t = await Hd({
7269
7275
  ...e,
7270
7276
  onError: (r) => L("avatar", "Avatar settings read failed — keeping the auto-assigned character", te(r))
7271
7277
  }), n = Bt(t) ? t : null;
7272
7278
  return m("avatar", "Requested character from prefs-api", { sprite: n }), n;
7273
7279
  }
7274
- function Qr(e) {
7280
+ function Xr(e) {
7275
7281
  if (!e) return !1;
7276
7282
  const t = T.getState();
7277
7283
  if (t.sprite === e) return !1;
7278
7284
  const r = !!(t.me.clientId && t.roster[t.me.clientId]?.registryName) || !t.name || !Ee(t.name) ? t.name : Xe(e);
7279
7285
  return t.setSessionIdentity(r, e), !0;
7280
7286
  }
7281
- function qd(e, t, n) {
7287
+ function Vd(e, t, n) {
7282
7288
  if (!n) return () => {
7283
7289
  };
7284
7290
  const r = (i) => {
@@ -7287,25 +7293,25 @@ function qd(e, t, n) {
7287
7293
  };
7288
7294
  return n.addEventListener(e, r), () => n.removeEventListener(e, r);
7289
7295
  }
7290
- const Vd = () => typeof window > "u" ? void 0 : window;
7291
- function vf(e, t = Vd()) {
7292
- return qd(Hd, (n) => {
7296
+ const zd = () => typeof window > "u" ? void 0 : window;
7297
+ function vf(e, t = zd()) {
7298
+ return Vd(qd, (n) => {
7293
7299
  typeof n.name == "string" && n.name.trim() && e(n.name);
7294
7300
  }, t);
7295
7301
  }
7296
- const zd = 10;
7297
- function Wd(e = typeof window < "u" ? window : void 0) {
7302
+ const Wd = 10;
7303
+ function Gd(e = typeof window < "u" ? window : void 0) {
7298
7304
  if (!e) return { framed: !1, depth: 0 };
7299
7305
  try {
7300
7306
  let t = 0, n = e;
7301
- for (; n !== n.parent && t < zd; )
7307
+ for (; n !== n.parent && t < Wd; )
7302
7308
  t++, n = n.parent;
7303
7309
  return { framed: e.top ? e.top !== e.self : t > 0, depth: t };
7304
7310
  } catch {
7305
7311
  return { framed: !1, depth: 0 };
7306
7312
  }
7307
7313
  }
7308
- function Gd(e, t) {
7314
+ function Kd(e, t) {
7309
7315
  let n = 0;
7310
7316
  for (const r of e.videos) {
7311
7317
  const i = Le.voteKey(t, e.id, r.mediaId);
@@ -7313,56 +7319,48 @@ function Gd(e, t) {
7313
7319
  }
7314
7320
  return n;
7315
7321
  }
7316
- const Kd = 2e4, Yd = 1e4;
7317
- function Jd() {
7322
+ const Yd = 2e4, Jd = 1e4;
7323
+ function Xd() {
7318
7324
  return { unansweredSince: null, lastPongAt: null, lastTickAt: null };
7319
7325
  }
7320
- function Xd(e, t) {
7326
+ function Qd(e, t) {
7321
7327
  e.lastPongAt = t, e.unansweredSince = null;
7322
7328
  }
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);
7329
+ function Zd(e, t, n) {
7330
+ const r = e.lastTickAt !== null && t - e.lastTickAt > Jd;
7331
+ return e.lastTickAt = t, n ? r || e.unansweredSince === null ? (e.unansweredSince = t, !1) : t - e.unansweredSince > Yd : (e.unansweredSince = null, !1);
7326
7332
  }
7327
7333
  function Po(e, t) {
7328
7334
  return e.lastPongAt === null ? void 0 : Math.max(0, t - e.lastPongAt);
7329
7335
  }
7330
7336
  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;
7337
+ const eh = dc(), _e = Xd();
7338
+ let ht = null, an = null, Qr = 0, Kn = null, Ze = !1, Yn = !1, je = !1, Jn = null;
7333
7339
  function bf(e) {
7334
7340
  const t = W(), n = T.getState();
7335
7341
  if (n.me.clientId && n.roster[n.me.clientId])
7336
7342
  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", () => {
7343
+ const r = th(e);
7344
+ 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
7345
  m("socket", "Emitting join", r), t.emit(P.JOIN, r);
7340
7346
  }), t;
7341
7347
  }
7342
- function eh(e) {
7348
+ function th(e) {
7343
7349
  return {
7344
7350
  room_key: e.room_key,
7345
7351
  name: e.name,
7346
7352
  sprite: e.sprite,
7347
7353
  // Entry-path telemetry — see lib/embedContext.ts. Sent on every join AND
7348
7354
  // rejoin (lastJoinPayload carries it), so a reconnect keeps the attribution.
7349
- embed: Wd(),
7350
- delivery_arm: ld(),
7355
+ embed: Gd(),
7356
+ delivery_arm: ud(),
7351
7357
  // Identity tier input — see lib/deviceId.ts. Sent on every join AND rejoin
7352
7358
  // (lastJoinPayload carries it) so a reconnect lands on the same
7353
7359
  // ParticipantId rather than minting a new person.
7354
- device_id: Ed(),
7355
- tab_id: Zd
7360
+ device_id: Sd(),
7361
+ tab_id: eh
7356
7362
  };
7357
7363
  }
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
7364
  function wf() {
7367
7365
  return Po(_e, Date.now());
7368
7366
  }
@@ -7373,15 +7371,15 @@ function W() {
7373
7371
  const r = window.location;
7374
7372
  (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
7373
  }
7376
- const n = Pd();
7374
+ const n = Od();
7377
7375
  if (n)
7378
7376
  A = Re(n.url, { path: n.path, transports: ["websocket", "polling"] }), m("socket", "Socket initialized on the room origin", n);
7379
7377
  else {
7380
7378
  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 });
7379
+ A = Re(r, { path: Ti, transports: ["websocket", "polling"] }), m("socket", "Socket initialized", { origin: t });
7382
7380
  }
7383
7381
  jt("__SOCKET__", A), ne && (clearTimeout(ne), ne = null), ee = null, xt = setInterval(() => {
7384
- if (Qd(_e, Date.now(), !!A?.connected)) {
7382
+ if (Zd(_e, Date.now(), !!A?.connected)) {
7385
7383
  L("socket", "PONG-WATCHDOG no time_pong for 20s — replacing the connection", {
7386
7384
  sid: A?.id,
7387
7385
  lastPongAgeMs: Po(_e, Date.now()) ?? null
@@ -7389,8 +7387,8 @@ function W() {
7389
7387
  return;
7390
7388
  }
7391
7389
  dh();
7392
- }, Xa), A.on("connect", () => {
7393
- Jn = !1;
7390
+ }, Ya), A.on("connect", () => {
7391
+ Yn = !1;
7394
7392
  const r = A?.id;
7395
7393
  if (m("socket", "Connected", { id: r, isReconnect: je }), r)
7396
7394
  try {
@@ -7400,17 +7398,17 @@ function W() {
7400
7398
  }
7401
7399
  if (je && me) {
7402
7400
  const i = T.getState();
7403
- Zr += 1;
7401
+ Qr += 1;
7404
7402
  const o = {
7405
7403
  ...me,
7406
7404
  name: i.name,
7407
7405
  sprite: i.sprite,
7408
7406
  reconnect: {
7409
- count: Zr,
7407
+ count: Qr,
7410
7408
  reason: (ht?.reason ?? "unknown").slice(0, 64),
7411
7409
  offline_ms: ht ? Math.max(0, Date.now() - ht.at) : 0
7412
7410
  }
7413
- }, s = Xn;
7411
+ }, s = Jn;
7414
7412
  if (m("socket", "Re-emitting join after reconnect", { room_key: o.room_key, name: o.name, sprite: o.sprite }), s) {
7415
7413
  let a = !1;
7416
7414
  const c = () => {
@@ -7420,11 +7418,11 @@ function W() {
7420
7418
  a || (a = !0, A.off(P.SNAPSHOT, c), L("socket", "client_ready re-emit timed out waiting for snapshot", { mediaId: s }));
7421
7419
  }, 1e4);
7422
7420
  }
7423
- Yn = { name: o.name, sprite: o.sprite }, A.emit(P.JOIN, o), window.dispatchEvent(new CustomEvent("watchparty:socket-reconnect"));
7421
+ Kn = { name: o.name, sprite: o.sprite }, A.emit(P.JOIN, o), window.dispatchEvent(new CustomEvent("watchparty:socket-reconnect"));
7424
7422
  } else je && L("socket", "Reconnected — no join payload, not re-joining any room");
7425
7423
  je = !0;
7426
7424
  }), A.on("disconnect", (r) => {
7427
- Wi(null), ht = { reason: an ?? r, at: Date.now() }, an = null, m("socket", "Disconnected", { reason: r });
7425
+ Gi(null), ht = { reason: an ?? r, at: Date.now() }, an = null, m("socket", "Disconnected", { reason: r });
7428
7426
  }), 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
7427
  }
7430
7428
  return A;
@@ -7442,7 +7440,7 @@ function nh(e) {
7442
7440
  serverSeq: t.server_seq || 0,
7443
7441
  leaderId: t.leader_id || null
7444
7442
  }), 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(
7443
+ const n = T.getState(), r = A?.id, o = (r ? n.roster[r] : void 0) ?? Kn, s = ac(
7446
7444
  { name: n.name, avatarId: n.sprite },
7447
7445
  o ? { name: o.name, avatarId: o.sprite ?? null } : void 0,
7448
7446
  // A join that carried no name counts as a default one, so a name that
@@ -7452,7 +7450,7 @@ function nh(e) {
7452
7450
  if (s) {
7453
7451
  const a = {
7454
7452
  ...s.name !== void 0 ? { name: s.name } : {},
7455
- ...s.avatarId !== void 0 && !Jn ? { sprite: s.avatarId } : {}
7453
+ ...s.avatarId !== void 0 && !Yn ? { sprite: s.avatarId } : {}
7456
7454
  };
7457
7455
  Object.keys(a).length > 0 && (m("socket", "Identity update on snapshot", a), e.emit(P.IDENTITY_UPDATE, a));
7458
7456
  }
@@ -7463,7 +7461,7 @@ function nh(e) {
7463
7461
  leaderId: t.leader_id || null,
7464
7462
  serverSeq: t.server_seq || 0,
7465
7463
  rosterSize: Object.keys(n.roster).length
7466
- }), me?.room_key && A?.id && Wi({ room_key: me.room_key, client_id: A.id });
7464
+ }), me?.room_key && A?.id && Gi({ room_key: me.room_key, client_id: A.id });
7467
7465
  }), e.on(P.CONTROL_BROADCAST, (t) => {
7468
7466
  const n = T.getState();
7469
7467
  if (Object.prototype.hasOwnProperty.call(t, "media_id")) {
@@ -7485,7 +7483,7 @@ function nh(e) {
7485
7483
  }), e.on(P.CONTROL_ACK, (t) => {
7486
7484
  typeof t?.client_seq == "number" && typeof t?.server_seq == "number" && m("socket", "Control ack received", t);
7487
7485
  }), e.on(P.TIME_PONG, (t) => {
7488
- if (Xd(_e, Date.now()), ee && ee.ts) {
7486
+ if (Qd(_e, Date.now()), ee && ee.ts) {
7489
7487
  const n = Date.now() - ee.ts;
7490
7488
  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
7489
  }
@@ -7496,7 +7494,7 @@ function nh(e) {
7496
7494
  });
7497
7495
  }
7498
7496
  function rh(e) {
7499
- const t = ku(e);
7497
+ const t = Ru(e);
7500
7498
  return t ? { cosmetics: t } : {};
7501
7499
  }
7502
7500
  function ih(e) {
@@ -7548,16 +7546,16 @@ function oh(e) {
7548
7546
  T.getState().setPlaylistResults(t ?? null), m("playlist", "Results received", { playlistId: t?.playlist?.id, update: t?.update === !0 });
7549
7547
  }), e.on(de.VOTES_CLEARED, (t) => {
7550
7548
  if (!t?.playlistId || !Array.isArray(t.mediaIds)) return;
7551
- const n = Gd(
7549
+ const n = Kd(
7552
7550
  { id: t.playlistId, videos: t.mediaIds.map((i) => ({ mediaId: i })) },
7553
- sl()
7551
+ al()
7554
7552
  ), r = T.getState();
7555
7553
  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
7554
  });
7557
7555
  }
7558
7556
  function sh(e) {
7559
7557
  e.on(Wa.UPDATED, () => {
7560
- m("tierlist", "Someone saved — refreshing the board"), Md(!1);
7558
+ m("tierlist", "Someone saved — refreshing the board"), Nd(!1);
7561
7559
  });
7562
7560
  }
7563
7561
  function ah(e) {
@@ -7590,21 +7588,21 @@ function lh(e) {
7590
7588
  });
7591
7589
  }
7592
7590
  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) => {
7591
+ nh(e), ih(e), Id(e, () => !0), lh(e), oh(e), sh(e), ah(e), ch(e), e.on(P.ERROR, (t) => {
7594
7592
  const n = t?.code || "error/unknown";
7595
7593
  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");
7594
+ Yn = !0, m("socket", "sprite held by this account's other connection: keeping the server-assigned sprite");
7597
7595
  return;
7598
7596
  }
7599
7597
  if (n === "conflict" && t?.message === "sprite_taken") {
7600
- if (Dd(A?.id)) {
7598
+ if ($d(A?.id)) {
7601
7599
  m("socket", "sprite_taken: stale, the server already has our sprite");
7602
7600
  return;
7603
7601
  }
7604
7602
  Ze = !0;
7605
7603
  let s;
7606
7604
  try {
7607
- s = Nd();
7605
+ s = Dd();
7608
7606
  } finally {
7609
7607
  Ze = !1;
7610
7608
  }
@@ -7659,12 +7657,12 @@ function dh() {
7659
7657
  function xf(e) {
7660
7658
  const t = T.getState(), n = t.me.clientId;
7661
7659
  if (!n || !t.roster[n]) {
7662
- Qr(e), m("socket", "Avatar change before join: the join will carry it", { sprite: e });
7660
+ Xr(e), m("socket", "Avatar change before join: the join will carry it", { sprite: e });
7663
7661
  return;
7664
7662
  }
7665
7663
  Ze = !0;
7666
7664
  try {
7667
- Qr(e);
7665
+ Xr(e);
7668
7666
  } finally {
7669
7667
  Ze = !1;
7670
7668
  }
@@ -7694,7 +7692,7 @@ function fh() {
7694
7692
  xt && (clearInterval(xt), xt = null), ne && (clearTimeout(ne), ne = null), ee = null, _e.unansweredSince = null, _e.lastTickAt = null;
7695
7693
  }
7696
7694
  function ph() {
7697
- m("socket", "clearJoinState called", { hadPayload: me !== null, room_key: me?.room_key }), me = null, je = !1, Xn = null;
7695
+ m("socket", "clearJoinState called", { hadPayload: me !== null, room_key: me?.room_key }), me = null, je = !1, Jn = null;
7698
7696
  }
7699
7697
  function mh() {
7700
7698
  m("socket", "leaveRoom called", { room_key: me?.room_key }), ph(), fh(), A && (A.disconnect(), A = null), T.setState({
@@ -7734,7 +7732,7 @@ function Mf(e) {
7734
7732
  m("playlist", "Emitting playlist_vote_remove", { voterKey: e }), W().emit(de.VOTE_REMOVE, { voterKey: e });
7735
7733
  }
7736
7734
  function Nf(e) {
7737
- Xn = e, W().emit(P.CLIENT_READY, { media_id: e }), m("socket", "client_ready emitted", { mediaId: e });
7735
+ Jn = e, W().emit(P.CLIENT_READY, { media_id: e }), m("socket", "client_ready emitted", { mediaId: e });
7738
7736
  }
7739
7737
  function gh(e) {
7740
7738
  if (!e || e === "/" || document.querySelector(`link[rel="preconnect"][href="${e}"]`)) return;
@@ -7763,11 +7761,11 @@ function bh(e) {
7763
7761
  }
7764
7762
  function Df(e, t = {}) {
7765
7763
  const { basename: n, strictMode: r = !1, ...i } = t;
7766
- Ic(), Rc({
7764
+ $c(), Lc({
7767
7765
  serverOrigin: i.serverOrigin,
7768
7766
  defaultRoomKey: i.defaultRoomKey,
7769
7767
  cdnBase: i.cdnBase
7770
- }), _d(), rl({
7768
+ }), Ed(), il({
7771
7769
  userType: i.userType,
7772
7770
  userId: i.userId
7773
7771
  }), T.getState().rehydrateFromPrefs(), vh();
@@ -7786,7 +7784,7 @@ function Df(e, t = {}) {
7786
7784
  } catch (c) {
7787
7785
  L("boot", "prefs.beacon.threw", { err: c?.message });
7788
7786
  }
7789
- al().catch((c) => L("boot", "whoami threw", te(c))), fl().then((c) => {
7787
+ cl().catch((c) => L("boot", "whoami threw", te(c))), pl().then((c) => {
7790
7788
  c && T.getState().rehydrateFromPrefs();
7791
7789
  }).catch((c) => L("boot", "prefs sync threw", te(c))), xe || (xe = (c) => {
7792
7790
  pe("app", "Unhandled promise rejection", { reason: String(c.reason) });
@@ -7797,9 +7795,9 @@ function Df(e, t = {}) {
7797
7795
  stack: c.error instanceof Error ? c.error.stack?.slice(0, 1500) : void 0
7798
7796
  });
7799
7797
  }, 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) };
7798
+ const o = Dn().theme;
7799
+ o && Wo.includes(o) && Go(o), Qc().catch((c) => L("boot", "display names load threw", te(c))), e.__watchparty?.root.unmount();
7800
+ const a = { root: yh(e, /* @__PURE__ */ S(_d, { basename: n, appProps: i }), r) };
7803
7801
  e.__watchparty = a;
7804
7802
  }
7805
7803
  function $f(e) {
@@ -7808,7 +7806,7 @@ function $f(e) {
7808
7806
  }
7809
7807
  export {
7810
7808
  vf as $,
7811
- zu as A,
7809
+ Wu as A,
7812
7810
  Tf as B,
7813
7811
  qe as C,
7814
7812
  In as D,
@@ -7816,9 +7814,9 @@ export {
7816
7814
  La as F,
7817
7815
  uf as G,
7818
7816
  mh as H,
7819
- md as I,
7820
- $n as J,
7821
- br as K,
7817
+ gd as I,
7818
+ Dn as J,
7819
+ vr as K,
7822
7820
  At as L,
7823
7821
  Qt as M,
7824
7822
  qt as N,
@@ -7830,10 +7828,10 @@ export {
7830
7828
  Ef as T,
7831
7829
  _f as U,
7832
7830
  Mh as V,
7833
- Md as W,
7831
+ Nd as W,
7834
7832
  Ph as X,
7835
7833
  pf as Y,
7836
- Ld as Z,
7834
+ Md as Z,
7837
7835
  mf as _,
7838
7836
  Xh as a,
7839
7837
  gf as a0,
@@ -7849,17 +7847,17 @@ export {
7849
7847
  Se as aA,
7850
7848
  lo as aB,
7851
7849
  Ms as aC,
7852
- zc as aD,
7853
- fl as aE,
7850
+ Qc as aD,
7851
+ pl as aE,
7854
7852
  yf as aF,
7855
7853
  bf as aG,
7856
- Ki as aH,
7857
- ol as aI,
7854
+ Yi as aH,
7855
+ sl as aI,
7858
7856
  Af as aJ,
7859
7857
  tf as aK,
7860
7858
  Bt as aL,
7861
7859
  Mf as aM,
7862
- sl as aN,
7860
+ al as aN,
7863
7861
  Pf as aO,
7864
7862
  Lf as aP,
7865
7863
  If as aQ,
@@ -7877,34 +7875,34 @@ export {
7877
7875
  ef as aj,
7878
7876
  Ih as ak,
7879
7877
  wf as al,
7880
- ld as am,
7881
- xc as an,
7882
- Hi as ao,
7878
+ ud as am,
7879
+ Mc as an,
7880
+ qi as ao,
7883
7881
  $h as ap,
7884
7882
  Fh as aq,
7885
7883
  Ch as ar,
7886
7884
  hf as as,
7887
7885
  Kh as at,
7888
- Od as au,
7889
- Qa as av,
7886
+ Ld as au,
7887
+ Ja as av,
7890
7888
  eo as aw,
7891
7889
  Uh as ax,
7892
7890
  Nf as ay,
7893
- ji as az,
7894
- kc as b,
7891
+ Hi as az,
7892
+ Oc as b,
7895
7893
  Ba as c,
7896
7894
  m as d,
7897
7895
  pe as e,
7898
7896
  Jh as f,
7899
- Sc as g,
7897
+ Ic as g,
7900
7898
  af as h,
7901
- Ti as i,
7899
+ Si as i,
7902
7900
  of as j,
7903
- $i as k,
7901
+ Bi as k,
7904
7902
  ie as l,
7905
7903
  Qh as m,
7906
7904
  Le as n,
7907
- Vu as o,
7905
+ zu as o,
7908
7906
  sf as p,
7909
7907
  rf as q,
7910
7908
  Zh as r,
@@ -7912,9 +7910,9 @@ export {
7912
7910
  kf as t,
7913
7911
  T as u,
7914
7912
  L as v,
7915
- Nn as w,
7913
+ Mn as w,
7916
7914
  Rf as x,
7917
7915
  ff as y,
7918
7916
  Of as z
7919
7917
  };
7920
- //# sourceMappingURL=index-DKRsAAOT.js.map
7918
+ //# sourceMappingURL=index-z0IxvHpK.js.map