@hadoku/watchparty-ui 0.44.7 → 0.44.9
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.
- package/dist/chunks/{AdminPanel-qTuUmikH.js → AdminPanel-CfOBoGAb.js} +6 -6
- package/dist/chunks/{AdminPanel-qTuUmikH.js.map → AdminPanel-CfOBoGAb.js.map} +1 -1
- package/dist/chunks/{CharacterModal-CVRsPyBj.js → CharacterModal-B6cG2NmX.js} +4 -4
- package/dist/chunks/{CharacterModal-CVRsPyBj.js.map → CharacterModal-B6cG2NmX.js.map} +1 -1
- package/dist/chunks/{GameModule-DblyKpY-.js → GameModule-CrRHc04o.js} +4 -4
- package/dist/chunks/{GameModule-DblyKpY-.js.map → GameModule-CrRHc04o.js.map} +1 -1
- package/dist/chunks/{MapEditor-D7snRTNa.js → MapEditor-Bvr-tvKQ.js} +2 -2
- package/dist/chunks/{MapEditor-D7snRTNa.js.map → MapEditor-Bvr-tvKQ.js.map} +1 -1
- package/dist/chunks/{MediaDrawer-J06JYmWp.js → MediaDrawer-CY__KXu5.js} +24 -24
- package/dist/chunks/{MediaDrawer-J06JYmWp.js.map → MediaDrawer-CY__KXu5.js.map} +1 -1
- package/dist/chunks/{PlaylistPanel-BuynCwSB.js → PlaylistPanel-hV9B8oQl.js} +16 -16
- package/dist/chunks/{PlaylistPanel-BuynCwSB.js.map → PlaylistPanel-hV9B8oQl.js.map} +1 -1
- package/dist/chunks/{Room-CsUbXKFq.js → Room-B6ODdfkE.js} +1695 -1649
- package/dist/chunks/Room-B6ODdfkE.js.map +1 -0
- package/dist/chunks/{index-Cr81q-86.js → index-CFH_9amZ.js} +438 -434
- package/dist/chunks/index-CFH_9amZ.js.map +1 -0
- package/dist/chunks/{submissionsApi-DgAuxW7y.js → submissionsApi-BsiozhpM.js} +9 -9
- package/dist/chunks/{submissionsApi-DgAuxW7y.js.map → submissionsApi-BsiozhpM.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/room-chrome.js +317 -313
- package/dist/room-chrome.js.map +1 -1
- package/dist/watchparty-ui.css +1 -1
- package/package.json +2 -2
- package/dist/chunks/Room-CsUbXKFq.js.map +0 -1
- package/dist/chunks/index-Cr81q-86.js.map +0 -1
package/dist/room-chrome.js
CHANGED
|
@@ -484,15 +484,19 @@ const nn = [
|
|
|
484
484
|
]
|
|
485
485
|
}
|
|
486
486
|
], yt = 8, rt = nn.flatMap((e) => e.characters), Le = rt.map((e) => e.id), fr = Object.fromEntries(rt.map((e) => [e.id, e.color])), hr = Object.fromEntries(rt.map((e) => [e.id, "rev" in e ? e.rev : 1]));
|
|
487
|
+
function gr(e) {
|
|
488
|
+
const t = hr[e];
|
|
489
|
+
return `/media/sprites/square_${e}.png${t > 1 ? `?v=${t}` : ""}`;
|
|
490
|
+
}
|
|
487
491
|
function fe(e) {
|
|
488
492
|
return !!e && Le.includes(e);
|
|
489
493
|
}
|
|
490
|
-
const
|
|
491
|
-
function yr(e) {
|
|
492
|
-
return typeof e == "string" && br.includes(e);
|
|
493
|
-
}
|
|
494
|
+
const br = 5e3, rn = { mode: "off", percent: 0 }, yr = ["off", "on", "ab"];
|
|
494
495
|
function vr(e) {
|
|
495
|
-
|
|
496
|
+
return typeof e == "string" && yr.includes(e);
|
|
497
|
+
}
|
|
498
|
+
function Sr(e) {
|
|
499
|
+
const t = e && typeof e == "object" ? e : {}, n = vr(t.mode) ? t.mode : rn.mode, o = Number(t.percent), i = Number.isFinite(o) ? Math.min(100, Math.max(0, Math.round(o))) : 0;
|
|
496
500
|
return { mode: n, percent: i };
|
|
497
501
|
}
|
|
498
502
|
function wr(e) {
|
|
@@ -501,15 +505,15 @@ function wr(e) {
|
|
|
501
505
|
t ^= e.charCodeAt(n), t = Math.imul(t, 16777619) >>> 0;
|
|
502
506
|
return t >>> 0;
|
|
503
507
|
}
|
|
504
|
-
function
|
|
508
|
+
function _r(e, t, n) {
|
|
505
509
|
if (n === !0)
|
|
506
510
|
return "fragment";
|
|
507
511
|
if (n === !1)
|
|
508
512
|
return "range";
|
|
509
|
-
const o =
|
|
513
|
+
const o = Sr(e);
|
|
510
514
|
return o.mode === "on" ? "fragment" : o.mode === "off" || o.percent <= 0 ? "range" : o.percent >= 100 || t && wr(t) % 100 < o.percent ? "fragment" : "range";
|
|
511
515
|
}
|
|
512
|
-
const on = r.enum(["url", "magnet", "upload"]),
|
|
516
|
+
const on = r.enum(["url", "magnet", "upload"]), xr = r.enum([
|
|
513
517
|
"pending",
|
|
514
518
|
"approved",
|
|
515
519
|
"fetching",
|
|
@@ -527,7 +531,7 @@ const on = r.enum(["url", "magnet", "upload"]), _r = r.enum([
|
|
|
527
531
|
failed: ["approved"]
|
|
528
532
|
};
|
|
529
533
|
Object.keys(vt).filter((e) => vt[e].length === 0);
|
|
530
|
-
const
|
|
534
|
+
const Cr = r.object({
|
|
531
535
|
id: r.string().min(1),
|
|
532
536
|
/** Stable userId from whoami. Never the raw `X-User-Key`. */
|
|
533
537
|
ownerUserId: r.string().min(1),
|
|
@@ -546,7 +550,7 @@ const xr = r.object({
|
|
|
546
550
|
* misroute the copy.
|
|
547
551
|
*/
|
|
548
552
|
series: r.string().optional(),
|
|
549
|
-
state:
|
|
553
|
+
state: xr,
|
|
550
554
|
createdAt: r.number().int().nonnegative(),
|
|
551
555
|
updatedAt: r.number().int().nonnegative(),
|
|
552
556
|
/** Why it failed, or why an operator rejected it. */
|
|
@@ -554,19 +558,19 @@ const xr = r.object({
|
|
|
554
558
|
/** Size once known. 0 means "known to be empty"; absent means "not yet known" —
|
|
555
559
|
* the same distinction `chatImages` draws for image dimensions. */
|
|
556
560
|
bytes: r.number().int().nonnegative().optional()
|
|
557
|
-
}),
|
|
561
|
+
}), kr = 4096, an = 300, Ir = 100;
|
|
558
562
|
r.object({
|
|
559
563
|
kind: on,
|
|
560
|
-
source: r.string().min(1).max(
|
|
564
|
+
source: r.string().min(1).max(kr),
|
|
561
565
|
title: r.string().min(1).max(an).optional(),
|
|
562
566
|
/** Required for `kind: 'magnet'` by `checkSource`; ignored for `url`/`upload`. */
|
|
563
|
-
series: r.string().min(1).max(
|
|
567
|
+
series: r.string().min(1).max(Ir).optional()
|
|
564
568
|
});
|
|
565
569
|
r.object({
|
|
566
570
|
reason: r.string().min(1).max(an).optional()
|
|
567
571
|
});
|
|
568
572
|
r.object({
|
|
569
|
-
submissions: r.array(
|
|
573
|
+
submissions: r.array(Cr)
|
|
570
574
|
});
|
|
571
575
|
r.object({
|
|
572
576
|
error: r.literal("submissions/quota_exceeded"),
|
|
@@ -575,28 +579,28 @@ r.object({
|
|
|
575
579
|
/** The cap that was applied, from the server's config. */
|
|
576
580
|
capBytes: r.number().int().nonnegative()
|
|
577
581
|
});
|
|
578
|
-
const
|
|
579
|
-
function
|
|
582
|
+
const Tr = /^[a-z0-9][a-z0-9-]{0,31}$/, St = "https://game-catalog.invalid";
|
|
583
|
+
function Er(e) {
|
|
580
584
|
if (!e.startsWith("/") || e.startsWith("//") || /[\\\s]/.test(e) || [...e].some((t) => t.charCodeAt(0) < 32 || t.charCodeAt(0) === 127))
|
|
581
585
|
return !1;
|
|
582
586
|
try {
|
|
583
|
-
return new URL(e,
|
|
587
|
+
return new URL(e, St).origin === St;
|
|
584
588
|
} catch {
|
|
585
589
|
return !1;
|
|
586
590
|
}
|
|
587
591
|
}
|
|
588
|
-
const sn = r.string().min(2).max(512).refine(
|
|
592
|
+
const sn = r.string().min(2).max(512).refine(Er, {
|
|
589
593
|
message: "must be a root-relative path on the page origin (e.g. /cardtable/embed/x.js)"
|
|
590
|
-
}),
|
|
591
|
-
id: r.string().regex(
|
|
594
|
+
}), wt = {
|
|
595
|
+
id: r.string().regex(Tr),
|
|
592
596
|
name: r.string().min(1).max(64),
|
|
593
597
|
cover: sn.optional()
|
|
594
|
-
},
|
|
595
|
-
r.object({ ...
|
|
596
|
-
r.object({ ...
|
|
598
|
+
}, Ar = r.discriminatedUnion("kind", [
|
|
599
|
+
r.object({ ...wt, kind: r.literal("iframe") }).strict(),
|
|
600
|
+
r.object({ ...wt, kind: r.literal("module"), url: sn }).strict()
|
|
597
601
|
]);
|
|
598
|
-
r.array(
|
|
599
|
-
const ot = r.enum(["anilist", "tmdb"]),
|
|
602
|
+
r.array(Ar).max(32).refine((e) => new Set(e.map((t) => t.id)).size === e.length, { message: "game ids must be unique" });
|
|
603
|
+
const ot = r.enum(["anilist", "tmdb"]), Nr = r.object({
|
|
600
604
|
source: ot,
|
|
601
605
|
/** The provider's own id, as a string (AniList and TMDB both use integers). */
|
|
602
606
|
id: r.string(),
|
|
@@ -618,11 +622,11 @@ const ot = r.enum(["anilist", "tmdb"]), Ar = r.object({
|
|
|
618
622
|
addable: r.boolean()
|
|
619
623
|
});
|
|
620
624
|
r.object({
|
|
621
|
-
results: r.array(
|
|
625
|
+
results: r.array(Nr),
|
|
622
626
|
/** Providers that answered. TMDB is absent when no token is configured. */
|
|
623
627
|
sources: r.array(ot)
|
|
624
628
|
});
|
|
625
|
-
const
|
|
629
|
+
const Pr = r.object({
|
|
626
630
|
id: r.string(),
|
|
627
631
|
url: r.string(),
|
|
628
632
|
title: r.string(),
|
|
@@ -630,14 +634,14 @@ const Nr = r.object({
|
|
|
630
634
|
durationS: r.number().nullable(),
|
|
631
635
|
thumb: r.string().nullable()
|
|
632
636
|
});
|
|
633
|
-
r.object({ results: r.array(
|
|
637
|
+
r.object({ results: r.array(Pr) });
|
|
634
638
|
r.object({
|
|
635
639
|
source: ot,
|
|
636
640
|
id: r.string().regex(/^\d{1,12}$/)
|
|
637
641
|
});
|
|
638
642
|
r.object({ series: r.string(), title: r.string() });
|
|
639
643
|
let ve = null, ln = qt;
|
|
640
|
-
function
|
|
644
|
+
function Mr(e) {
|
|
641
645
|
e.cdnBase && (ln = e.cdnBase);
|
|
642
646
|
}
|
|
643
647
|
function cn() {
|
|
@@ -650,7 +654,7 @@ function je() {
|
|
|
650
654
|
function Pe(e) {
|
|
651
655
|
return !et(e) || !cn() ? null : je().urlFor(e);
|
|
652
656
|
}
|
|
653
|
-
function
|
|
657
|
+
function Or(e) {
|
|
654
658
|
return e.kind === "file";
|
|
655
659
|
}
|
|
656
660
|
class dn extends Error {
|
|
@@ -678,42 +682,42 @@ function ke(e) {
|
|
|
678
682
|
return "Image upload failed";
|
|
679
683
|
}
|
|
680
684
|
}
|
|
681
|
-
function
|
|
685
|
+
function Rr(e) {
|
|
682
686
|
return e instanceof ze ? ke(e.reason) : e instanceof dn ? e.message : "Image upload failed";
|
|
683
687
|
}
|
|
684
|
-
function
|
|
688
|
+
function Dr(e) {
|
|
685
689
|
const t = e.type.toLowerCase().split(";")[0].trim();
|
|
686
690
|
return t && Un(t) !== "image" ? ke("unsupported-type") : e.size > Fn.image ? ke("too-large") : e.size === 0 ? ke("invalid") : null;
|
|
687
691
|
}
|
|
688
|
-
function
|
|
692
|
+
function Lr(e) {
|
|
689
693
|
return $n(e);
|
|
690
694
|
}
|
|
691
|
-
function
|
|
695
|
+
function jr(e) {
|
|
692
696
|
return Bn(e);
|
|
693
697
|
}
|
|
694
|
-
async function
|
|
698
|
+
async function Ur(e) {
|
|
695
699
|
const t = await Hn(e);
|
|
696
700
|
return { w: t?.width ?? 0, h: t?.height ?? 0 };
|
|
697
701
|
}
|
|
698
|
-
async function
|
|
702
|
+
async function Fr(e, t = {}) {
|
|
699
703
|
const n = await je().upload(e, { signal: t.signal });
|
|
700
704
|
if (!et(n.key))
|
|
701
705
|
throw new dn("Image upload returned an unusable key");
|
|
702
706
|
return { key: n.key, deduplicated: n.deduplicated === !0 };
|
|
703
707
|
}
|
|
704
|
-
async function
|
|
708
|
+
async function Hr(e, t = {}) {
|
|
705
709
|
const n = [];
|
|
706
710
|
for (const o of e) {
|
|
707
711
|
if (o.kind === "remote") {
|
|
708
712
|
n.push({ key: o.key, w: o.w, h: o.h, ...o.title ? { title: o.title } : {} });
|
|
709
713
|
continue;
|
|
710
714
|
}
|
|
711
|
-
const { key: i } = await
|
|
715
|
+
const { key: i } = await Fr(o.file, t);
|
|
712
716
|
n.push({ key: i, w: o.w, h: o.h });
|
|
713
717
|
}
|
|
714
718
|
return n;
|
|
715
719
|
}
|
|
716
|
-
function
|
|
720
|
+
function $r(e) {
|
|
717
721
|
return {
|
|
718
722
|
error: e instanceof Error ? e.message : String(e),
|
|
719
723
|
name: e instanceof Error ? e.name : typeof e,
|
|
@@ -721,39 +725,39 @@ function Hr(e) {
|
|
|
721
725
|
status: e instanceof ze ? e.status : void 0
|
|
722
726
|
};
|
|
723
727
|
}
|
|
724
|
-
const Ye = 240, Z = 8,
|
|
725
|
-
function
|
|
728
|
+
const Ye = 240, Z = 8, Br = 28, un = 240;
|
|
729
|
+
function Gr(e, t, n) {
|
|
726
730
|
let o = t.left - Ye - Z;
|
|
727
731
|
o < Z && (o = t.right + Z), o = Math.min(o, n.width - Ye - Z), o = Math.max(Z, o);
|
|
728
|
-
const i = un +
|
|
732
|
+
const i = un + Br;
|
|
729
733
|
let s = e.top + e.height / 2 - i / 2;
|
|
730
734
|
return s = Math.min(s, n.height - i - Z), s = Math.max(Z, s), { left: o, top: s };
|
|
731
735
|
}
|
|
732
|
-
const mn = "/dataplatform/api/memes",
|
|
733
|
-
function
|
|
736
|
+
const mn = "/dataplatform/api/memes", Wr = 120;
|
|
737
|
+
function Kr({ onClose: e, onPick: t, onUnavailable: n }) {
|
|
734
738
|
const [o, i] = P(""), s = J(null), a = J(null), c = je(), { items: f, loading: g, error: p, hasMore: D, loadMore: M } = Xn(
|
|
735
739
|
c,
|
|
736
740
|
mn,
|
|
737
741
|
o.trim()
|
|
738
742
|
), T = p?.reason ?? null, C = Q(() => {
|
|
739
|
-
const
|
|
740
|
-
return f.filter((R) =>
|
|
741
|
-
}, [f]), [h, _] = P(null),
|
|
742
|
-
|
|
743
|
+
const S = /* @__PURE__ */ new Set();
|
|
744
|
+
return f.filter((R) => S.has(R.key) ? !1 : (S.add(R.key), !0));
|
|
745
|
+
}, [f]), [h, _] = P(null), w = J(null), k = N(() => {
|
|
746
|
+
w.current !== null && (window.clearTimeout(w.current), w.current = null);
|
|
743
747
|
}, []), u = N(() => {
|
|
744
748
|
k(), _(null);
|
|
745
749
|
}, [k]), v = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(hover: hover)").matches, E = N(
|
|
746
|
-
(
|
|
750
|
+
(S, R, L = !1) => {
|
|
747
751
|
const F = s.current;
|
|
748
752
|
if (!F) return;
|
|
749
753
|
const W = () => _({
|
|
750
|
-
item:
|
|
751
|
-
...
|
|
754
|
+
item: S,
|
|
755
|
+
...Gr(R.getBoundingClientRect(), F.getBoundingClientRect(), {
|
|
752
756
|
width: window.innerWidth,
|
|
753
757
|
height: window.innerHeight
|
|
754
758
|
})
|
|
755
759
|
});
|
|
756
|
-
k(), L ? W() :
|
|
760
|
+
k(), L ? W() : w.current = window.setTimeout(W, Wr);
|
|
757
761
|
},
|
|
758
762
|
[k]
|
|
759
763
|
);
|
|
@@ -762,17 +766,17 @@ function Wr({ onClose: e, onPick: t, onUnavailable: n }) {
|
|
|
762
766
|
}, [T, n]), O(() => {
|
|
763
767
|
a.current?.focus();
|
|
764
768
|
}, []), O(() => {
|
|
765
|
-
const
|
|
769
|
+
const S = (L) => {
|
|
766
770
|
L.key === "Escape" && (L.stopPropagation(), e());
|
|
767
771
|
}, R = (L) => {
|
|
768
772
|
s.current && !s.current.contains(L.target) && e();
|
|
769
773
|
};
|
|
770
|
-
return document.addEventListener("keydown",
|
|
771
|
-
document.removeEventListener("keydown",
|
|
774
|
+
return document.addEventListener("keydown", S), document.addEventListener("mousedown", R), () => {
|
|
775
|
+
document.removeEventListener("keydown", S), document.removeEventListener("mousedown", R);
|
|
772
776
|
};
|
|
773
777
|
}, [e]);
|
|
774
|
-
const U = N((
|
|
775
|
-
t(
|
|
778
|
+
const U = N((S) => {
|
|
779
|
+
t(S), e();
|
|
776
780
|
}, [t, e]), H = !g && !p && C.length === 0;
|
|
777
781
|
return /* @__PURE__ */ b(
|
|
778
782
|
"div",
|
|
@@ -789,7 +793,7 @@ function Wr({ onClose: e, onPick: t, onUnavailable: n }) {
|
|
|
789
793
|
ref: a,
|
|
790
794
|
type: "text",
|
|
791
795
|
value: o,
|
|
792
|
-
onChange: (
|
|
796
|
+
onChange: (S) => i(S.target.value),
|
|
793
797
|
placeholder: "Search memes...",
|
|
794
798
|
"aria-label": "Search memes",
|
|
795
799
|
"data-testid": "meme-search",
|
|
@@ -813,34 +817,34 @@ function Wr({ onClose: e, onPick: t, onUnavailable: n }) {
|
|
|
813
817
|
}
|
|
814
818
|
),
|
|
815
819
|
H && /* @__PURE__ */ l("p", { className: "p-4 text-center text-sm text-text-secondary", children: o.trim() ? `No memes match "${o.trim()}"` : "The meme library is empty" }),
|
|
816
|
-
C.length > 0 && /* @__PURE__ */ l("div", { className: "grid grid-cols-3 gap-1.5 sm:grid-cols-4", children: C.map((
|
|
817
|
-
const R = Pe(
|
|
820
|
+
C.length > 0 && /* @__PURE__ */ l("div", { className: "grid grid-cols-3 gap-1.5 sm:grid-cols-4", children: C.map((S) => {
|
|
821
|
+
const R = Pe(S.key);
|
|
818
822
|
return R ? /* @__PURE__ */ l(
|
|
819
823
|
"button",
|
|
820
824
|
{
|
|
821
825
|
type: "button",
|
|
822
|
-
onClick: () => U(
|
|
823
|
-
title:
|
|
826
|
+
onClick: () => U(S),
|
|
827
|
+
title: S.title,
|
|
824
828
|
"data-testid": "meme-result",
|
|
825
829
|
onMouseEnter: (L) => {
|
|
826
|
-
v && E(
|
|
830
|
+
v && E(S, L.currentTarget);
|
|
827
831
|
},
|
|
828
832
|
onMouseLeave: u,
|
|
829
|
-
onFocus: (L) => E(
|
|
833
|
+
onFocus: (L) => E(S, L.currentTarget, !0),
|
|
830
834
|
onBlur: u,
|
|
831
835
|
className: "group relative aspect-square overflow-hidden rounded border border-border-light bg-bg-alt focus:outline-none focus:border-primary hover:border-primary",
|
|
832
836
|
children: /* @__PURE__ */ l(
|
|
833
837
|
"img",
|
|
834
838
|
{
|
|
835
839
|
src: R,
|
|
836
|
-
alt:
|
|
840
|
+
alt: S.title || "Meme",
|
|
837
841
|
loading: "lazy",
|
|
838
842
|
decoding: "async",
|
|
839
843
|
className: "h-full w-full object-cover"
|
|
840
844
|
}
|
|
841
845
|
)
|
|
842
846
|
},
|
|
843
|
-
|
|
847
|
+
S.key
|
|
844
848
|
) : null;
|
|
845
849
|
}) }),
|
|
846
850
|
g && /* @__PURE__ */ l("p", { className: "p-2 text-center text-xs text-text-secondary", children: "Loading…" }),
|
|
@@ -895,8 +899,8 @@ function Wr({ onClose: e, onPick: t, onUnavailable: n }) {
|
|
|
895
899
|
}
|
|
896
900
|
);
|
|
897
901
|
}
|
|
898
|
-
function
|
|
899
|
-
return e ? /* @__PURE__ */ l(
|
|
902
|
+
function qr({ open: e, ...t }) {
|
|
903
|
+
return e ? /* @__PURE__ */ l(Kr, { ...t }) : null;
|
|
900
904
|
}
|
|
901
905
|
const it = {
|
|
902
906
|
serverOrigin: `http://localhost:${tt}`,
|
|
@@ -904,17 +908,17 @@ const it = {
|
|
|
904
908
|
cdnBase: qt
|
|
905
909
|
};
|
|
906
910
|
let Ie = { ...it };
|
|
907
|
-
function
|
|
911
|
+
function Vr(e) {
|
|
908
912
|
const t = Object.fromEntries(
|
|
909
913
|
Object.entries(e).filter(([n, o]) => o !== void 0)
|
|
910
914
|
);
|
|
911
|
-
Ie = { ...Ie, ...t },
|
|
915
|
+
Ie = { ...Ie, ...t }, Mr({ cdnBase: Ie.cdnBase });
|
|
912
916
|
}
|
|
913
917
|
function he() {
|
|
914
918
|
return Ie;
|
|
915
919
|
}
|
|
916
920
|
const pn = Gt(it);
|
|
917
|
-
function
|
|
921
|
+
function zr() {
|
|
918
922
|
return Wt(pn);
|
|
919
923
|
}
|
|
920
924
|
function fn(e) {
|
|
@@ -924,7 +928,7 @@ function hn() {
|
|
|
924
928
|
return fn(he());
|
|
925
929
|
}
|
|
926
930
|
const gn = Gt(null);
|
|
927
|
-
function
|
|
931
|
+
function Yr() {
|
|
928
932
|
return Wt(gn);
|
|
929
933
|
}
|
|
930
934
|
const oe = {
|
|
@@ -955,7 +959,7 @@ function at(e, t) {
|
|
|
955
959
|
return !1;
|
|
956
960
|
}
|
|
957
961
|
}
|
|
958
|
-
function
|
|
962
|
+
function Xr() {
|
|
959
963
|
try {
|
|
960
964
|
const e = Ue();
|
|
961
965
|
if (!e) return [];
|
|
@@ -975,7 +979,7 @@ function Me(e) {
|
|
|
975
979
|
} catch {
|
|
976
980
|
}
|
|
977
981
|
}
|
|
978
|
-
function
|
|
982
|
+
function Jr(e) {
|
|
979
983
|
const t = G(e);
|
|
980
984
|
return t === null ? null : t === "true" ? !0 : t === "false" ? !1 : null;
|
|
981
985
|
}
|
|
@@ -984,36 +988,36 @@ let yn = !1;
|
|
|
984
988
|
function Fe(e, t) {
|
|
985
989
|
bn.set(e, t), yn && vn(e, t);
|
|
986
990
|
}
|
|
987
|
-
function
|
|
991
|
+
function Zr() {
|
|
988
992
|
yn = !0;
|
|
989
993
|
for (const [e, t] of bn) vn(e, t);
|
|
990
994
|
}
|
|
991
995
|
function vn(e, t) {
|
|
992
996
|
typeof window > "u" || (window[e] = t);
|
|
993
997
|
}
|
|
994
|
-
const de = [],
|
|
998
|
+
const de = [], Qr = 500;
|
|
995
999
|
let Te = [], Xe = null;
|
|
996
|
-
const
|
|
1000
|
+
const eo = 1e3, to = 200;
|
|
997
1001
|
let Je = null;
|
|
998
|
-
function
|
|
1002
|
+
function Sn(e) {
|
|
999
1003
|
Je = e;
|
|
1000
1004
|
}
|
|
1001
|
-
function
|
|
1005
|
+
function wn() {
|
|
1002
1006
|
return G(oe.REPORT_LOGS_FLAG) === "true";
|
|
1003
1007
|
}
|
|
1004
|
-
function
|
|
1008
|
+
function no() {
|
|
1005
1009
|
if (typeof window > "u") return !1;
|
|
1006
1010
|
if (window.__WP_DEBUG__ || new URLSearchParams(window.location.search).get("debug") === "true") return !0;
|
|
1007
1011
|
const t = G(oe.DEBUG_FLAG);
|
|
1008
1012
|
return t !== null && t !== "false";
|
|
1009
1013
|
}
|
|
1010
|
-
function
|
|
1014
|
+
function ro() {
|
|
1011
1015
|
const e = G(oe.DEBUG_FLAG);
|
|
1012
1016
|
if (!e || e === "true") return null;
|
|
1013
1017
|
const t = e.split(",").map((n) => n.trim().toLowerCase()).filter(Boolean);
|
|
1014
1018
|
return t.length > 0 ? new Set(t) : null;
|
|
1015
1019
|
}
|
|
1016
|
-
function
|
|
1020
|
+
function oo() {
|
|
1017
1021
|
return (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", {
|
|
1018
1022
|
hour12: !1,
|
|
1019
1023
|
hour: "2-digit",
|
|
@@ -1022,8 +1026,8 @@ function ro() {
|
|
|
1022
1026
|
fractionalSecondDigits: 3
|
|
1023
1027
|
});
|
|
1024
1028
|
}
|
|
1025
|
-
function
|
|
1026
|
-
de.push(e), de.length >
|
|
1029
|
+
function io(e) {
|
|
1030
|
+
de.push(e), de.length > Qr && de.shift();
|
|
1027
1031
|
}
|
|
1028
1032
|
const $e = {
|
|
1029
1033
|
debug: "color: #64748b; font-weight: normal;",
|
|
@@ -1032,7 +1036,7 @@ const $e = {
|
|
|
1032
1036
|
category: "color: #3b82f6; font-weight: bold;",
|
|
1033
1037
|
time: "color: #6b7280; font-weight: normal;"
|
|
1034
1038
|
};
|
|
1035
|
-
function
|
|
1039
|
+
function ao(e) {
|
|
1036
1040
|
try {
|
|
1037
1041
|
return JSON.stringify(e);
|
|
1038
1042
|
} catch {
|
|
@@ -1047,12 +1051,12 @@ function st(e, t, n, o, i, s, a) {
|
|
|
1047
1051
|
data: a,
|
|
1048
1052
|
timestamp: Date.now()
|
|
1049
1053
|
};
|
|
1050
|
-
if (
|
|
1051
|
-
if (!
|
|
1052
|
-
const p =
|
|
1054
|
+
if (io(c), (n || wn()) && _t(c), !o) {
|
|
1055
|
+
if (!no()) return;
|
|
1056
|
+
const p = ro();
|
|
1053
1057
|
if (p && !p.has(i.toLowerCase())) return;
|
|
1054
1058
|
}
|
|
1055
|
-
const f =
|
|
1059
|
+
const f = oo(), g = a !== void 0 ? " " + ao(a) : "";
|
|
1056
1060
|
t(
|
|
1057
1061
|
`%c[${f}]%c [${i}]%c ${s}${g}`,
|
|
1058
1062
|
$e.time,
|
|
@@ -1069,25 +1073,25 @@ function A(e, t, n) {
|
|
|
1069
1073
|
function ue(e, t, n) {
|
|
1070
1074
|
st("error", console.error, !0, !0, e, t, n);
|
|
1071
1075
|
}
|
|
1072
|
-
function
|
|
1076
|
+
function so() {
|
|
1073
1077
|
return [...de];
|
|
1074
1078
|
}
|
|
1075
|
-
function
|
|
1079
|
+
function lo() {
|
|
1076
1080
|
de.length = 0;
|
|
1077
1081
|
}
|
|
1078
|
-
function
|
|
1082
|
+
function co(e) {
|
|
1079
1083
|
const t = e && e.length > 0 ? e.join(",") : "true";
|
|
1080
1084
|
at(oe.DEBUG_FLAG, t), console.log("[wp] Debug mode enabled");
|
|
1081
1085
|
}
|
|
1082
|
-
function
|
|
1086
|
+
function uo() {
|
|
1083
1087
|
Me(oe.DEBUG_FLAG), console.log("[wp] Debug mode disabled");
|
|
1084
1088
|
}
|
|
1085
|
-
const
|
|
1086
|
-
function
|
|
1089
|
+
const mo = 1024, po = 5e4;
|
|
1090
|
+
function fo(e) {
|
|
1087
1091
|
if (e == null) return e;
|
|
1088
1092
|
try {
|
|
1089
1093
|
const t = JSON.stringify(e);
|
|
1090
|
-
if (t.length <=
|
|
1094
|
+
if (t.length <= mo) return e;
|
|
1091
1095
|
if (typeof e == "object" && !Array.isArray(e)) {
|
|
1092
1096
|
const n = {};
|
|
1093
1097
|
for (const [o, i] of Object.entries(e)) {
|
|
@@ -1101,7 +1105,7 @@ function po(e) {
|
|
|
1101
1105
|
return "[unserializable]";
|
|
1102
1106
|
}
|
|
1103
1107
|
}
|
|
1104
|
-
async function
|
|
1108
|
+
async function ho() {
|
|
1105
1109
|
if (Te.length === 0) return;
|
|
1106
1110
|
const e = Te;
|
|
1107
1111
|
Te = [], Xe = null;
|
|
@@ -1115,7 +1119,7 @@ async function fo() {
|
|
|
1115
1119
|
level: c.level,
|
|
1116
1120
|
category: c.category,
|
|
1117
1121
|
message: c.message,
|
|
1118
|
-
data:
|
|
1122
|
+
data: fo(c.data),
|
|
1119
1123
|
timestamp: c.timestamp,
|
|
1120
1124
|
url: typeof window < "u" ? window.location.href : void 0,
|
|
1121
1125
|
userAgent: typeof navigator < "u" ? navigator.userAgent : void 0,
|
|
@@ -1125,7 +1129,7 @@ async function fo() {
|
|
|
1125
1129
|
let s = [], a = 0;
|
|
1126
1130
|
for (const c of i) {
|
|
1127
1131
|
const f = JSON.stringify(c).length + 1;
|
|
1128
|
-
a + f >
|
|
1132
|
+
a + f > po && s.length > 0 && (await fetch(o, {
|
|
1129
1133
|
method: "POST",
|
|
1130
1134
|
headers: { "Content-Type": "application/json" },
|
|
1131
1135
|
body: JSON.stringify({ logs: s })
|
|
@@ -1142,18 +1146,18 @@ async function fo() {
|
|
|
1142
1146
|
}
|
|
1143
1147
|
function _t(e) {
|
|
1144
1148
|
if (Te.push(e), !Xe) {
|
|
1145
|
-
const t =
|
|
1146
|
-
Xe = setTimeout(
|
|
1149
|
+
const t = wn() ? to : eo;
|
|
1150
|
+
Xe = setTimeout(ho, t);
|
|
1147
1151
|
}
|
|
1148
1152
|
}
|
|
1149
1153
|
function ge(e) {
|
|
1150
1154
|
return e instanceof Error ? { error: e.message, name: e.name } : { error: String(e), name: typeof e };
|
|
1151
1155
|
}
|
|
1152
1156
|
Fe("__wpDebug", {
|
|
1153
|
-
enable:
|
|
1154
|
-
disable:
|
|
1155
|
-
history:
|
|
1156
|
-
clear:
|
|
1157
|
+
enable: co,
|
|
1158
|
+
disable: uo,
|
|
1159
|
+
history: so,
|
|
1160
|
+
clear: lo
|
|
1157
1161
|
});
|
|
1158
1162
|
const X = {
|
|
1159
1163
|
resolved: !1,
|
|
@@ -1163,16 +1167,16 @@ const X = {
|
|
|
1163
1167
|
function lt() {
|
|
1164
1168
|
return X.accountId ? X.accountId : X.resolved && X.userType === "public" ? "anon" : null;
|
|
1165
1169
|
}
|
|
1166
|
-
function
|
|
1170
|
+
function go(e) {
|
|
1167
1171
|
X.resolved = !0, e.userType && (X.userType = e.userType), e.userId !== void 0 && (X.accountId = e.userId && e.userId !== "public" ? e.userId : null);
|
|
1168
1172
|
}
|
|
1169
1173
|
function ct() {
|
|
1170
1174
|
return X.accountId ?? "public";
|
|
1171
1175
|
}
|
|
1172
|
-
function
|
|
1176
|
+
function bo() {
|
|
1173
1177
|
return lt() ?? "unscoped";
|
|
1174
1178
|
}
|
|
1175
|
-
function
|
|
1179
|
+
function yo() {
|
|
1176
1180
|
return nn.flatMap((e) => {
|
|
1177
1181
|
const t = e.characters.map((o) => o.id), n = [];
|
|
1178
1182
|
for (let o = 0; o < t.length; o += yt)
|
|
@@ -1188,13 +1192,11 @@ function _n(e) {
|
|
|
1188
1192
|
return fe(e) ? fr[e] : "var(--color-neutral-bg)";
|
|
1189
1193
|
}
|
|
1190
1194
|
function He(e) {
|
|
1191
|
-
|
|
1192
|
-
const t = he().serverOrigin.replace(/\/$/, ""), n = hr[e];
|
|
1193
|
-
return `${t}/media/sprites/square_${e}.png${n > 1 ? `?v=${n}` : ""}`;
|
|
1195
|
+
return fe(e) ? `${he().serverOrigin.replace(/\/$/, "")}${gr(e)}` : void 0;
|
|
1194
1196
|
}
|
|
1195
|
-
let pe = null,
|
|
1196
|
-
function
|
|
1197
|
-
return pe ? Promise.resolve() :
|
|
1197
|
+
let pe = null, Se = null;
|
|
1198
|
+
function vo() {
|
|
1199
|
+
return pe ? Promise.resolve() : Se || (Se = (async () => {
|
|
1198
1200
|
try {
|
|
1199
1201
|
const e = he().serverOrigin.replace(/\/$/, ""), t = await fetch(`${e}/media/sprites/names.json`, { cache: "no-cache" });
|
|
1200
1202
|
if (!t.ok) return;
|
|
@@ -1203,7 +1205,7 @@ function yo() {
|
|
|
1203
1205
|
} catch (e) {
|
|
1204
1206
|
d("characters", "display names fetch failed (degrading to sprite IDs)", ge(e));
|
|
1205
1207
|
}
|
|
1206
|
-
})(),
|
|
1208
|
+
})(), Se);
|
|
1207
1209
|
}
|
|
1208
1210
|
function te(e) {
|
|
1209
1211
|
return pe?.[e] || e.charAt(0).toUpperCase() + e.slice(1);
|
|
@@ -1212,7 +1214,7 @@ function ne(e) {
|
|
|
1212
1214
|
const t = e.toLowerCase();
|
|
1213
1215
|
return Le.some((n) => n === t) ? !0 : pe ? Object.values(pe).some((n) => n.toLowerCase() === t) : !1;
|
|
1214
1216
|
}
|
|
1215
|
-
const
|
|
1217
|
+
const So = r.object({
|
|
1216
1218
|
// Identity. There is deliberately NO `name`: a person's name is their
|
|
1217
1219
|
// hadoku key-registry name, resolved by the server from whoami and renamed
|
|
1218
1220
|
// through hadoku_site's POST /session/name (operator decision 2026-10-08).
|
|
@@ -1233,13 +1235,13 @@ const vo = r.object({
|
|
|
1233
1235
|
subtitleStyle: r.string().optional()
|
|
1234
1236
|
}), me = Wn({
|
|
1235
1237
|
appId: "watchparty",
|
|
1236
|
-
schema:
|
|
1238
|
+
schema: So
|
|
1237
1239
|
}), wo = /* @__PURE__ */ new Set(["theme", "themeMode"]);
|
|
1238
1240
|
function Oe(e) {
|
|
1239
1241
|
const t = lt();
|
|
1240
1242
|
return t ? `prefs-cache:${t}:${e}` : null;
|
|
1241
1243
|
}
|
|
1242
|
-
function
|
|
1244
|
+
function _o() {
|
|
1243
1245
|
return lt() === null;
|
|
1244
1246
|
}
|
|
1245
1247
|
function Ct(e) {
|
|
@@ -1253,9 +1255,9 @@ function Ct(e) {
|
|
|
1253
1255
|
return {};
|
|
1254
1256
|
}
|
|
1255
1257
|
}
|
|
1256
|
-
function
|
|
1258
|
+
function xo() {
|
|
1257
1259
|
let e = 0;
|
|
1258
|
-
for (const t of
|
|
1260
|
+
for (const t of Xr()) {
|
|
1259
1261
|
const n = t.startsWith("prefs-cache:") && t.endsWith(":watchparty"), o = t === Re || t.startsWith(`${Re}:`) && !t.endsWith(":_serverSynced_v1");
|
|
1260
1262
|
if (!n && !o) continue;
|
|
1261
1263
|
const i = G(t);
|
|
@@ -1276,7 +1278,7 @@ function _o() {
|
|
|
1276
1278
|
let xn = null, Cn = null;
|
|
1277
1279
|
const kt = /* @__PURE__ */ new Set();
|
|
1278
1280
|
function dt() {
|
|
1279
|
-
if (
|
|
1281
|
+
if (_o())
|
|
1280
1282
|
return d("preferences", "Boot read deferred — session pending, identity unresolved"), {};
|
|
1281
1283
|
const e = Ct("portfolio"), t = Ct("watchparty"), n = Object.keys(e).length > 0 ? e : xn ?? {}, o = Object.keys(t).length > 0 ? t : Cn ?? {}, i = ct() || "public";
|
|
1282
1284
|
if (kt.has(i))
|
|
@@ -1301,16 +1303,16 @@ function dt() {
|
|
|
1301
1303
|
}), a;
|
|
1302
1304
|
}
|
|
1303
1305
|
let kn = !1;
|
|
1304
|
-
function
|
|
1306
|
+
function Co() {
|
|
1305
1307
|
const e = ct();
|
|
1306
1308
|
return !e || e === "public";
|
|
1307
1309
|
}
|
|
1308
1310
|
function K(e, t) {
|
|
1309
|
-
|
|
1311
|
+
Co() && (kn = !0), wo.has(e) ? ce.save({ [e]: t }, { scope: "device" }).catch((n) => A("preferences", "themePrefs.save failed", { key: e, err: n?.message })) : me.save({ [e]: t }).catch((n) => A("preferences", "watchpartyPrefs.save failed", { key: e, err: n?.message })), d("preferences", "Saved (via SDK)", { key: e, value: t });
|
|
1310
1312
|
}
|
|
1311
|
-
let
|
|
1312
|
-
function
|
|
1313
|
-
return
|
|
1313
|
+
let we = null, It = !1;
|
|
1314
|
+
function ko() {
|
|
1315
|
+
return we || (we = (async () => {
|
|
1314
1316
|
if (typeof window > "u") return !1;
|
|
1315
1317
|
try {
|
|
1316
1318
|
It || (It = !0, ce.subscribe((a) => {
|
|
@@ -1337,7 +1339,7 @@ function Co() {
|
|
|
1337
1339
|
// Post-fetch cache state: should be non-zero if SDK wrote it.
|
|
1338
1340
|
sdkThemeBytesPost: i?.length ?? 0,
|
|
1339
1341
|
sdkAppBytesPost: s?.length ?? 0
|
|
1340
|
-
}), await
|
|
1342
|
+
}), await Io(e, t), kn ? (d("preferences", "Promoting this load's pre-auth picks to the signed-in user"), await Promise.all([
|
|
1341
1343
|
ce.promoteAnonPrefsToUser().catch(() => {
|
|
1342
1344
|
}),
|
|
1343
1345
|
me.promoteAnonPrefsToUser().catch(() => {
|
|
@@ -1346,10 +1348,10 @@ function Co() {
|
|
|
1346
1348
|
} catch (e) {
|
|
1347
1349
|
return A("preferences", "First-load SDK sync failed (non-fatal)", { err: e?.message }), !1;
|
|
1348
1350
|
}
|
|
1349
|
-
})(),
|
|
1351
|
+
})(), we);
|
|
1350
1352
|
}
|
|
1351
1353
|
const Re = "watchparty_preferences";
|
|
1352
|
-
|
|
1354
|
+
xo();
|
|
1353
1355
|
function Ze() {
|
|
1354
1356
|
const e = ct();
|
|
1355
1357
|
return !e || e === "public" ? Re : `${Re}:${e}`;
|
|
@@ -1367,7 +1369,7 @@ function In() {
|
|
|
1367
1369
|
function Tt() {
|
|
1368
1370
|
Me(Ze()), Me(`${Ze()}:_serverSynced_v1`);
|
|
1369
1371
|
}
|
|
1370
|
-
async function
|
|
1372
|
+
async function Io(e, t) {
|
|
1371
1373
|
const n = In();
|
|
1372
1374
|
if (!n || Object.keys(n).length === 0) return;
|
|
1373
1375
|
const o = Object.keys(e ?? {}).length > 0, i = Object.keys(t ?? {}).length > 0, s = {}, a = {};
|
|
@@ -1424,16 +1426,16 @@ function Nt(e) {
|
|
|
1424
1426
|
}
|
|
1425
1427
|
}).catch((t) => A("preferences", "store import failed", { reason: e, err: t?.message }));
|
|
1426
1428
|
}
|
|
1427
|
-
const Tn = 320, De = 240, ut = 640,
|
|
1429
|
+
const Tn = 320, De = 240, ut = 640, To = 320, Eo = 36, Pt = 16;
|
|
1428
1430
|
function V(e, t) {
|
|
1429
1431
|
if (!Number.isFinite(e)) return Tn;
|
|
1430
1432
|
let n = ut;
|
|
1431
|
-
return t !== void 0 && Number.isFinite(t) && t > 0 && (n = Math.min(n, t -
|
|
1433
|
+
return t !== void 0 && Number.isFinite(t) && t > 0 && (n = Math.min(n, t - To)), n = Math.max(n, De), Math.round(Math.min(n, Math.max(De, e)));
|
|
1432
1434
|
}
|
|
1433
1435
|
function Mt(e, t, n, o) {
|
|
1434
1436
|
return V(e + (t - n), o);
|
|
1435
1437
|
}
|
|
1436
|
-
function
|
|
1438
|
+
function Ao(e, t, n) {
|
|
1437
1439
|
switch (t) {
|
|
1438
1440
|
case "ArrowLeft":
|
|
1439
1441
|
return V(e + Pt, n);
|
|
@@ -1447,8 +1449,8 @@ function Eo(e, t, n) {
|
|
|
1447
1449
|
return null;
|
|
1448
1450
|
}
|
|
1449
1451
|
}
|
|
1450
|
-
function
|
|
1451
|
-
return { collapsed: e, width: e ?
|
|
1452
|
+
function No(e, t) {
|
|
1453
|
+
return { collapsed: e, width: e ? Eo : t };
|
|
1452
1454
|
}
|
|
1453
1455
|
const q = dt(), m = Gn((e, t) => ({
|
|
1454
1456
|
ready: !1,
|
|
@@ -1494,6 +1496,7 @@ const q = dt(), m = Gn((e, t) => ({
|
|
|
1494
1496
|
tierlistSaving: !1,
|
|
1495
1497
|
readyCheck: { active: !1, ready: [] },
|
|
1496
1498
|
activeGameId: null,
|
|
1499
|
+
gameSettings: null,
|
|
1497
1500
|
roomKeyType: null,
|
|
1498
1501
|
gameSessionWins: {},
|
|
1499
1502
|
gameBotCount: 0,
|
|
@@ -1673,6 +1676,7 @@ const q = dt(), m = Gn((e, t) => ({
|
|
|
1673
1676
|
}),
|
|
1674
1677
|
setReadyCheckState: (n) => e({ readyCheck: n }),
|
|
1675
1678
|
setActiveGameId: (n) => e({ activeGameId: n }),
|
|
1679
|
+
setGameSettings: (n) => e({ gameSettings: n }),
|
|
1676
1680
|
setRoomKeyType: (n) => e({ roomKeyType: n }),
|
|
1677
1681
|
setGameSessionWins: (n) => e({ gameSessionWins: { ...n } }),
|
|
1678
1682
|
setGameBotCount: (n) => e({ gameBotCount: Math.max(0, Math.floor(n)) }),
|
|
@@ -1691,18 +1695,18 @@ const En = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1691
1695
|
__proto__: null,
|
|
1692
1696
|
useAppStore: m
|
|
1693
1697
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1694
|
-
function
|
|
1698
|
+
function Po(e) {
|
|
1695
1699
|
return `${hn()}/media/${e}`.replace(/\\/g, "/");
|
|
1696
1700
|
}
|
|
1697
|
-
function
|
|
1698
|
-
return
|
|
1701
|
+
function Mo(e, t) {
|
|
1702
|
+
return Po(t ?? `${e}/poster.jpg`);
|
|
1699
1703
|
}
|
|
1700
|
-
function
|
|
1704
|
+
function Oo(e) {
|
|
1701
1705
|
return `${hn()}${e}`.replace(/\\/g, "/");
|
|
1702
1706
|
}
|
|
1703
|
-
async function
|
|
1707
|
+
async function Ro(e) {
|
|
1704
1708
|
try {
|
|
1705
|
-
const t = await fetch(
|
|
1709
|
+
const t = await fetch(Oo("/api/tierlist"));
|
|
1706
1710
|
if (!t.ok)
|
|
1707
1711
|
return A("tierlist", "Board fetch failed", { status: t.status }), null;
|
|
1708
1712
|
const n = await t.json();
|
|
@@ -1716,43 +1720,43 @@ async function Oo(e) {
|
|
|
1716
1720
|
}
|
|
1717
1721
|
}
|
|
1718
1722
|
let Ot = !1;
|
|
1719
|
-
function
|
|
1723
|
+
function Do() {
|
|
1720
1724
|
if (Ot || typeof Image > "u") return;
|
|
1721
1725
|
const e = m.getState().tierlist;
|
|
1722
1726
|
if (!(!e || e.items.length === 0)) {
|
|
1723
1727
|
Ot = !0;
|
|
1724
1728
|
for (const t of e.items) {
|
|
1725
1729
|
const n = new Image();
|
|
1726
|
-
n.decoding = "async", n.src =
|
|
1730
|
+
n.decoding = "async", n.src = Mo(t.id, t.thumbnail);
|
|
1727
1731
|
}
|
|
1728
1732
|
d("tierlist", "Warming posters", { count: e.items.length });
|
|
1729
1733
|
}
|
|
1730
1734
|
}
|
|
1731
|
-
function
|
|
1735
|
+
function Lo() {
|
|
1732
1736
|
const e = m.getState(), t = new Set(Object.values(e.roster).map((s) => s.sprite).filter(Boolean)), n = Le.find((s) => !t.has(s));
|
|
1733
1737
|
if (!n)
|
|
1734
1738
|
return A("socket", "sprite_taken: no available sprites to retry with"), null;
|
|
1735
1739
|
const o = !!e.name && !ne(e.name), i = o ? e.name : te(n);
|
|
1736
1740
|
return d("socket", "sprite_taken: retrying with next available", { from: e.sprite, to: n, name: i, keptCustomName: o }), e.setSessionIdentity(i, n), { name: i, sprite: n };
|
|
1737
1741
|
}
|
|
1738
|
-
function
|
|
1742
|
+
function jo(e) {
|
|
1739
1743
|
const t = m.getState(), n = e ? t.roster[e] : void 0;
|
|
1740
1744
|
return !n || !!n.sprite && n.sprite === t.sprite;
|
|
1741
1745
|
}
|
|
1742
|
-
const
|
|
1743
|
-
function
|
|
1746
|
+
const Uo = 10;
|
|
1747
|
+
function Fo(e = typeof window < "u" ? window : void 0) {
|
|
1744
1748
|
if (!e) return { framed: !1, depth: 0 };
|
|
1745
1749
|
try {
|
|
1746
1750
|
let t = 0, n = e;
|
|
1747
|
-
for (; n !== n.parent && t <
|
|
1751
|
+
for (; n !== n.parent && t < Uo; )
|
|
1748
1752
|
t++, n = n.parent;
|
|
1749
1753
|
return { framed: e.top ? e.top !== e.self : t > 0, depth: t };
|
|
1750
1754
|
} catch {
|
|
1751
1755
|
return { framed: !1, depth: 0 };
|
|
1752
1756
|
}
|
|
1753
1757
|
}
|
|
1754
|
-
const
|
|
1755
|
-
function
|
|
1758
|
+
const Ho = "watchparty_fragment_delivery";
|
|
1759
|
+
function $o() {
|
|
1756
1760
|
if (typeof window > "u") return null;
|
|
1757
1761
|
try {
|
|
1758
1762
|
const e = new URLSearchParams(window.location.search).get("fragmentDelivery");
|
|
@@ -1760,27 +1764,27 @@ function Ho() {
|
|
|
1760
1764
|
if (e === "0" || e === "false") return !1;
|
|
1761
1765
|
} catch {
|
|
1762
1766
|
}
|
|
1763
|
-
return
|
|
1767
|
+
return Jr(Ho);
|
|
1764
1768
|
}
|
|
1765
|
-
let
|
|
1769
|
+
let Bo = { ...rn }, Be = null;
|
|
1766
1770
|
const Rt = "watchparty_delivery_client_id";
|
|
1767
|
-
function
|
|
1771
|
+
function Go() {
|
|
1768
1772
|
const e = G(Rt);
|
|
1769
1773
|
if (e) return e;
|
|
1770
1774
|
const t = globalThis.crypto?.randomUUID?.() ?? `d${Math.random().toString(36).slice(2)}`;
|
|
1771
1775
|
return at(Rt, t) ? t : "";
|
|
1772
1776
|
}
|
|
1773
|
-
function Go() {
|
|
1774
|
-
return Be === null && (Be = Sr($o, Bo(), Ho())), Be;
|
|
1775
|
-
}
|
|
1776
1777
|
function Wo() {
|
|
1777
|
-
return Go();
|
|
1778
|
+
return Be === null && (Be = _r(Bo, Go(), $o())), Be;
|
|
1779
|
+
}
|
|
1780
|
+
function Ko() {
|
|
1781
|
+
return Wo();
|
|
1778
1782
|
}
|
|
1779
1783
|
let Ee;
|
|
1780
1784
|
function An() {
|
|
1781
1785
|
return G(qn) || void 0;
|
|
1782
1786
|
}
|
|
1783
|
-
function
|
|
1787
|
+
function qo() {
|
|
1784
1788
|
if (Ee) return;
|
|
1785
1789
|
const e = An();
|
|
1786
1790
|
if (e) {
|
|
@@ -1793,10 +1797,10 @@ function Ko() {
|
|
|
1793
1797
|
d("identity", "device id unavailable — joining without one");
|
|
1794
1798
|
});
|
|
1795
1799
|
}
|
|
1796
|
-
function
|
|
1800
|
+
function Vo() {
|
|
1797
1801
|
return Ee ??= An();
|
|
1798
1802
|
}
|
|
1799
|
-
function
|
|
1803
|
+
function zo(e, t) {
|
|
1800
1804
|
let n = 0;
|
|
1801
1805
|
for (const o of e.videos) {
|
|
1802
1806
|
const i = oe.voteKey(t, e.id, o.mediaId);
|
|
@@ -1804,49 +1808,49 @@ function Vo(e, t) {
|
|
|
1804
1808
|
}
|
|
1805
1809
|
return n;
|
|
1806
1810
|
}
|
|
1807
|
-
const
|
|
1808
|
-
function
|
|
1811
|
+
const Yo = 2e4, Xo = 1e4;
|
|
1812
|
+
function Jo() {
|
|
1809
1813
|
return { unansweredSince: null, lastPongAt: null, lastTickAt: null };
|
|
1810
1814
|
}
|
|
1811
|
-
function
|
|
1815
|
+
function Zo(e, t) {
|
|
1812
1816
|
e.lastPongAt = t, e.unansweredSince = null;
|
|
1813
1817
|
}
|
|
1814
|
-
function
|
|
1815
|
-
const o = e.lastTickAt !== null && t - e.lastTickAt >
|
|
1816
|
-
return e.lastTickAt = t, n ? o || e.unansweredSince === null ? (e.unansweredSince = t, !1) : t - e.unansweredSince >
|
|
1818
|
+
function Qo(e, t, n) {
|
|
1819
|
+
const o = e.lastTickAt !== null && t - e.lastTickAt > Xo;
|
|
1820
|
+
return e.lastTickAt = t, n ? o || e.unansweredSince === null ? (e.unansweredSince = t, !1) : t - e.unansweredSince > Yo : (e.unansweredSince = null, !1);
|
|
1817
1821
|
}
|
|
1818
|
-
function
|
|
1822
|
+
function ei(e, t) {
|
|
1819
1823
|
return e.lastPongAt === null ? void 0 : Math.max(0, t - e.lastPongAt);
|
|
1820
1824
|
}
|
|
1821
1825
|
let x = null, $ = null, Ae = null, B = null, z = null;
|
|
1822
|
-
const
|
|
1826
|
+
const ti = oi(), ee = Jo();
|
|
1823
1827
|
let _e = null, Ge = null, Dt = 0, mt = null, Qe = !1, pt = !1, le = !1, Nn = null;
|
|
1824
|
-
function
|
|
1828
|
+
function ni(e) {
|
|
1825
1829
|
const t = ie(), n = m.getState();
|
|
1826
1830
|
if (n.me.clientId && n.roster[n.me.clientId])
|
|
1827
1831
|
return (e.name || e.sprite) && (d("socket", "Identity update (already joined)", { name: e.name, sprite: e.sprite }), t.emit(I.IDENTITY_UPDATE, { name: e.name, sprite: e.sprite })), t;
|
|
1828
|
-
const o =
|
|
1832
|
+
const o = ri(e);
|
|
1829
1833
|
return z = o, mt = { name: o.name, sprite: o.sprite }, t.connected ? (d("socket", "Emitting join", o), t.emit(I.JOIN, o)) : t.once("connect", () => {
|
|
1830
1834
|
d("socket", "Emitting join", o), t.emit(I.JOIN, o);
|
|
1831
1835
|
}), t;
|
|
1832
1836
|
}
|
|
1833
|
-
function
|
|
1837
|
+
function ri(e) {
|
|
1834
1838
|
return {
|
|
1835
1839
|
room_key: e.room_key,
|
|
1836
1840
|
name: e.name,
|
|
1837
1841
|
sprite: e.sprite,
|
|
1838
1842
|
// Entry-path telemetry — see lib/embedContext.ts. Sent on every join AND
|
|
1839
1843
|
// rejoin (lastJoinPayload carries it), so a reconnect keeps the attribution.
|
|
1840
|
-
embed:
|
|
1841
|
-
delivery_arm:
|
|
1844
|
+
embed: Fo(),
|
|
1845
|
+
delivery_arm: Ko(),
|
|
1842
1846
|
// Identity tier input — see lib/deviceId.ts. Sent on every join AND rejoin
|
|
1843
1847
|
// (lastJoinPayload carries it) so a reconnect lands on the same
|
|
1844
1848
|
// ParticipantId rather than minting a new person.
|
|
1845
|
-
device_id:
|
|
1846
|
-
tab_id:
|
|
1849
|
+
device_id: Vo(),
|
|
1850
|
+
tab_id: ti
|
|
1847
1851
|
};
|
|
1848
1852
|
}
|
|
1849
|
-
function
|
|
1853
|
+
function oi() {
|
|
1850
1854
|
const e = globalThis.crypto;
|
|
1851
1855
|
if (e && typeof e.randomUUID == "function") return e.randomUUID();
|
|
1852
1856
|
const t = new Uint8Array(16);
|
|
@@ -1863,15 +1867,15 @@ function ie() {
|
|
|
1863
1867
|
}
|
|
1864
1868
|
const n = new URL(t.startsWith("http") ? t : `${window.location.origin}${t}`).origin;
|
|
1865
1869
|
x = Vn(n, { path: Jn, transports: ["websocket", "polling"] }), d("socket", "Socket initialized", { origin: t }), Fe("__SOCKET__", x), B && (clearTimeout(B), B = null), $ = null, Ae = setInterval(() => {
|
|
1866
|
-
if (
|
|
1870
|
+
if (Qo(ee, Date.now(), !!x?.connected)) {
|
|
1867
1871
|
A("socket", "PONG-WATCHDOG no time_pong for 20s — replacing the connection", {
|
|
1868
1872
|
sid: x?.id,
|
|
1869
|
-
lastPongAgeMs:
|
|
1873
|
+
lastPongAgeMs: ei(ee, Date.now()) ?? null
|
|
1870
1874
|
}), Ge = "pong-watchdog", ee.unansweredSince = null, x?.io.engine?.close();
|
|
1871
1875
|
return;
|
|
1872
1876
|
}
|
|
1873
|
-
|
|
1874
|
-
},
|
|
1877
|
+
hi();
|
|
1878
|
+
}, br), x.on("connect", () => {
|
|
1875
1879
|
pt = !1;
|
|
1876
1880
|
const o = x?.id;
|
|
1877
1881
|
if (d("socket", "Connected", { id: o, isReconnect: le }), o)
|
|
@@ -1906,8 +1910,8 @@ function ie() {
|
|
|
1906
1910
|
} else le && A("socket", "Reconnected — no join payload, not re-joining any room");
|
|
1907
1911
|
le = !0;
|
|
1908
1912
|
}), x.on("disconnect", (o) => {
|
|
1909
|
-
|
|
1910
|
-
}), x.on("connect_error", (o) => ue("socket", "Connection error", { message: o?.message })), x.on("reconnect_attempt", (o) => A("socket", "Reconnect attempt", { attempt: o })), x.on("reconnect_failed", () => ue("socket", "Reconnect failed")),
|
|
1913
|
+
Sn(null), _e = { reason: Ge ?? o, at: Date.now() }, Ge = null, d("socket", "Disconnected", { reason: o });
|
|
1914
|
+
}), x.on("connect_error", (o) => ue("socket", "Connection error", { message: o?.message })), x.on("reconnect_attempt", (o) => A("socket", "Reconnect attempt", { attempt: o })), x.on("reconnect_failed", () => ue("socket", "Reconnect failed")), pi(x);
|
|
1911
1915
|
}
|
|
1912
1916
|
return x;
|
|
1913
1917
|
}
|
|
@@ -1931,7 +1935,7 @@ function Lt(e, t) {
|
|
|
1931
1935
|
systemType: e.systemType
|
|
1932
1936
|
};
|
|
1933
1937
|
}
|
|
1934
|
-
function
|
|
1938
|
+
function ii(e) {
|
|
1935
1939
|
e.on(I.SNAPSHOT, (t) => {
|
|
1936
1940
|
e.emit(tn.SYNC), m.getState().applySnapshot({
|
|
1937
1941
|
roomId: t.room_id ?? null,
|
|
@@ -1962,7 +1966,7 @@ function oi(e) {
|
|
|
1962
1966
|
leaderId: t.leader_id || null,
|
|
1963
1967
|
serverSeq: t.server_seq || 0,
|
|
1964
1968
|
rosterSize: Object.keys(n.roster).length
|
|
1965
|
-
}), z?.room_key && x?.id &&
|
|
1969
|
+
}), z?.room_key && x?.id && Sn({ room_key: z.room_key, client_id: x.id });
|
|
1966
1970
|
}), e.on(I.CONTROL_BROADCAST, (t) => {
|
|
1967
1971
|
const n = m.getState();
|
|
1968
1972
|
if (Object.prototype.hasOwnProperty.call(t, "media_id")) {
|
|
@@ -1984,7 +1988,7 @@ function oi(e) {
|
|
|
1984
1988
|
}), e.on(I.CONTROL_ACK, (t) => {
|
|
1985
1989
|
typeof t?.client_seq == "number" && typeof t?.server_seq == "number" && d("socket", "Control ack received", t);
|
|
1986
1990
|
}), e.on(I.TIME_PONG, (t) => {
|
|
1987
|
-
if (
|
|
1991
|
+
if (Zo(ee, Date.now()), $ && $.ts) {
|
|
1988
1992
|
const n = Date.now() - $.ts;
|
|
1989
1993
|
m.getState().addRttSample(n, t?.server_ts, $.ts), $ = null, B && (clearTimeout(B), B = null), d("socket", "Time sync RTT", { rtt: n, offset: m.getState().drift.offsetMs });
|
|
1990
1994
|
}
|
|
@@ -1994,7 +1998,7 @@ function oi(e) {
|
|
|
1994
1998
|
m.getState().setReadiness({ mediaId: n, ready: s, readyCount: o, total: i }), d("socket", "Ready state received", { mediaId: n, readyCount: o, total: i, ready: s });
|
|
1995
1999
|
});
|
|
1996
2000
|
}
|
|
1997
|
-
function
|
|
2001
|
+
function ai(e) {
|
|
1998
2002
|
e.on(I.PRESENCE, (t) => {
|
|
1999
2003
|
if (!t) return;
|
|
2000
2004
|
if (Array.isArray(t.users)) {
|
|
@@ -2028,7 +2032,7 @@ function ii(e) {
|
|
|
2028
2032
|
}
|
|
2029
2033
|
});
|
|
2030
2034
|
}
|
|
2031
|
-
function
|
|
2035
|
+
function si(e) {
|
|
2032
2036
|
e.on(I.CHAT_BROADCAST, (t) => {
|
|
2033
2037
|
const n = Lt(t, t.server_seq);
|
|
2034
2038
|
m.getState().appendChat(n), d("chat", "Message received", n);
|
|
@@ -2038,7 +2042,7 @@ function ai(e) {
|
|
|
2038
2042
|
m.getState().setChat(n), d("chat", "History loaded", { count: n.length });
|
|
2039
2043
|
});
|
|
2040
2044
|
}
|
|
2041
|
-
function
|
|
2045
|
+
function li(e) {
|
|
2042
2046
|
e.on(ye.STATE, (t) => {
|
|
2043
2047
|
m.getState().applyPlaylistState({
|
|
2044
2048
|
playlist: t?.playlist ?? null,
|
|
@@ -2051,54 +2055,54 @@ function si(e) {
|
|
|
2051
2055
|
m.getState().setPlaylistResults(t ?? null), d("playlist", "Results received", { playlistId: t?.playlist?.id, update: t?.update === !0 });
|
|
2052
2056
|
}), e.on(ye.VOTES_CLEARED, (t) => {
|
|
2053
2057
|
if (!t?.playlistId || !Array.isArray(t.mediaIds)) return;
|
|
2054
|
-
const n =
|
|
2058
|
+
const n = zo(
|
|
2055
2059
|
{ id: t.playlistId, videos: t.mediaIds.map((i) => ({ mediaId: i })) },
|
|
2056
|
-
|
|
2060
|
+
bo()
|
|
2057
2061
|
), o = m.getState();
|
|
2058
2062
|
o.playlist?.id === t.playlistId && o.applyPlaylistState({ playlist: o.playlist, activeIndex: o.activePlaylistIndex, myVotes: {} }), d("playlist", "Votes cleared by leader", { playlistId: t.playlistId, removed: n });
|
|
2059
2063
|
});
|
|
2060
2064
|
}
|
|
2061
|
-
function
|
|
2065
|
+
function ci(e) {
|
|
2062
2066
|
e.on(dr.UPDATED, () => {
|
|
2063
|
-
d("tierlist", "Someone saved — refreshing the board"),
|
|
2067
|
+
d("tierlist", "Someone saved — refreshing the board"), Ro(!1);
|
|
2064
2068
|
});
|
|
2065
2069
|
}
|
|
2066
|
-
function
|
|
2070
|
+
function di(e) {
|
|
2067
2071
|
e.on(ur.STATE, (t) => {
|
|
2068
2072
|
if (!t || typeof t.active != "boolean") return;
|
|
2069
2073
|
const n = Array.isArray(t.ready) ? t.ready.filter((o) => typeof o == "string") : [];
|
|
2070
2074
|
m.getState().setReadyCheckState({ active: t.active, ready: n }), d("ready-check", "State received", { active: t.active, readyCount: n.length });
|
|
2071
2075
|
});
|
|
2072
2076
|
}
|
|
2073
|
-
function
|
|
2077
|
+
function ui(e) {
|
|
2074
2078
|
e.on(tn.ACTIVE, (t) => {
|
|
2075
2079
|
const n = typeof t?.gameId == "string" ? t.gameId : null;
|
|
2076
2080
|
m.getState().setActiveGameId(n), t?.sessionWins && typeof t.sessionWins == "object" ? m.getState().setGameSessionWins(t.sessionWins) : n === null && m.getState().setGameSessionWins({}), typeof t?.botCount == "number" ? m.getState().setGameBotCount(t.botCount) : n === null && m.getState().setGameBotCount(0), d("game", "game_active", { gameId: n, sessionWins: t?.sessionWins, botCount: t?.botCount });
|
|
2077
2081
|
});
|
|
2078
2082
|
}
|
|
2079
|
-
function
|
|
2083
|
+
function mi(e) {
|
|
2080
2084
|
e.on(I.HEALTH_SNAPSHOT, (t) => {
|
|
2081
2085
|
m.getState().setHealthSnapshot(t);
|
|
2082
2086
|
}), e.on(I.BUFFER_STATUS, (t) => {
|
|
2083
2087
|
m.getState().setBufferStatus(t);
|
|
2084
2088
|
});
|
|
2085
2089
|
}
|
|
2086
|
-
function
|
|
2087
|
-
|
|
2090
|
+
function pi(e) {
|
|
2091
|
+
ii(e), ai(e), si(e), mi(e), li(e), ci(e), di(e), ui(e), e.on(I.ERROR, (t) => {
|
|
2088
2092
|
const n = t?.code || "error/unknown";
|
|
2089
2093
|
if (n === "conflict" && t?.message === "sprite_held_by_you") {
|
|
2090
2094
|
pt = !0, d("socket", "sprite held by this account's other connection: keeping the server-assigned sprite");
|
|
2091
2095
|
return;
|
|
2092
2096
|
}
|
|
2093
2097
|
if (n === "conflict" && t?.message === "sprite_taken") {
|
|
2094
|
-
if (
|
|
2098
|
+
if (jo(x?.id)) {
|
|
2095
2099
|
d("socket", "sprite_taken: stale, the server already has our sprite");
|
|
2096
2100
|
return;
|
|
2097
2101
|
}
|
|
2098
2102
|
Qe = !0;
|
|
2099
2103
|
let a;
|
|
2100
2104
|
try {
|
|
2101
|
-
a =
|
|
2105
|
+
a = Lo();
|
|
2102
2106
|
} finally {
|
|
2103
2107
|
Qe = !1;
|
|
2104
2108
|
}
|
|
@@ -2129,15 +2133,15 @@ function mi(e) {
|
|
|
2129
2133
|
(n.startsWith("auth/") ? A : ue)("socket", `Server error: ${i}`, { code: n, raw: t }), m.getState().pushToast("error", i);
|
|
2130
2134
|
});
|
|
2131
2135
|
}
|
|
2132
|
-
function
|
|
2136
|
+
function fi(e, t) {
|
|
2133
2137
|
ie().emit(I.CHAT_SEND, t?.length ? { text: e, images: t } : { text: e });
|
|
2134
2138
|
}
|
|
2135
|
-
function
|
|
2139
|
+
function hi() {
|
|
2136
2140
|
$ || ($ = { ts: Date.now() }, ie().emit(I.TIME_PING, {}), B = setTimeout(() => {
|
|
2137
2141
|
$ && (d("socket", "Time ping timed out after 10s, clearing inflight"), $ = null), B = null;
|
|
2138
2142
|
}, 1e4));
|
|
2139
2143
|
}
|
|
2140
|
-
function
|
|
2144
|
+
function gi(e, t) {
|
|
2141
2145
|
const n = {};
|
|
2142
2146
|
e && (n.name = e), t && (n.sprite = t), !(!n.name && !n.sprite) && (d("socket", "Sending identity update", n), ie().emit(I.IDENTITY_UPDATE, n));
|
|
2143
2147
|
}
|
|
@@ -2153,14 +2157,14 @@ m.subscribe((e, t) => {
|
|
|
2153
2157
|
const a = {};
|
|
2154
2158
|
i && (a.name = e.name, xe.name = e.name), s && (a.sprite = e.sprite, xe.sprite = e.sprite), d("socket", "Identity reassert (store change)", a), x?.connected ? x.emit(I.IDENTITY_UPDATE, a) : ie().emit(I.IDENTITY_UPDATE, a);
|
|
2155
2159
|
});
|
|
2156
|
-
function
|
|
2160
|
+
function bi() {
|
|
2157
2161
|
Ae && (clearInterval(Ae), Ae = null), B && (clearTimeout(B), B = null), $ = null, ee.unansweredSince = null, ee.lastTickAt = null;
|
|
2158
2162
|
}
|
|
2159
|
-
function
|
|
2163
|
+
function yi() {
|
|
2160
2164
|
d("socket", "clearJoinState called", { hadPayload: z !== null, room_key: z?.room_key }), z = null, le = !1, Nn = null;
|
|
2161
2165
|
}
|
|
2162
2166
|
function jt() {
|
|
2163
|
-
d("socket", "leaveRoom called", { room_key: z?.room_key }),
|
|
2167
|
+
d("socket", "leaveRoom called", { room_key: z?.room_key }), yi(), bi(), x && (x.disconnect(), x = null), m.setState({
|
|
2164
2168
|
me: { clientId: null, nextClientSeq: 1 },
|
|
2165
2169
|
roster: {},
|
|
2166
2170
|
snapshot: { roomId: null, mediaId: null, playheadMs: 0, playing: !1, serverSeq: 0, leaderId: null },
|
|
@@ -2176,10 +2180,10 @@ function jt() {
|
|
|
2176
2180
|
gameSessionWins: {}
|
|
2177
2181
|
});
|
|
2178
2182
|
}
|
|
2179
|
-
function
|
|
2183
|
+
function vi() {
|
|
2180
2184
|
d("chat", "Emitting recap_request"), ie().emit("recap_request");
|
|
2181
2185
|
}
|
|
2182
|
-
function
|
|
2186
|
+
function Si(e) {
|
|
2183
2187
|
return !(e.button !== 0 || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey);
|
|
2184
2188
|
}
|
|
2185
2189
|
function wi({ src: e, title: t, onClose: n }) {
|
|
@@ -2189,7 +2193,7 @@ function wi({ src: e, title: t, onClose: n }) {
|
|
|
2189
2193
|
};
|
|
2190
2194
|
return document.addEventListener("keydown", s, !0), () => document.removeEventListener("keydown", s, !0);
|
|
2191
2195
|
}, [n]);
|
|
2192
|
-
const o =
|
|
2196
|
+
const o = Yr(), i = typeof document > "u" ? null : document.fullscreenElement ?? o ?? document.body;
|
|
2193
2197
|
return i ? Yn(
|
|
2194
2198
|
/* @__PURE__ */ b(
|
|
2195
2199
|
"div",
|
|
@@ -2228,11 +2232,11 @@ function wi({ src: e, title: t, onClose: n }) {
|
|
|
2228
2232
|
i
|
|
2229
2233
|
) : null;
|
|
2230
2234
|
}
|
|
2231
|
-
const Ke = 240,
|
|
2232
|
-
function
|
|
2235
|
+
const Ke = 240, _i = 320;
|
|
2236
|
+
function xi({ image: e }) {
|
|
2233
2237
|
const [t, n] = P(!1), o = Pe(e.key);
|
|
2234
2238
|
if (!o) return null;
|
|
2235
|
-
const i = e.w > 0 && e.h > 0, s = i ? Math.min(1,
|
|
2239
|
+
const i = e.w > 0 && e.h > 0, s = i ? Math.min(1, _i / e.w, Ke / e.h) : 1;
|
|
2236
2240
|
return /* @__PURE__ */ b(Ne, { children: [
|
|
2237
2241
|
/* @__PURE__ */ l(
|
|
2238
2242
|
"a",
|
|
@@ -2243,7 +2247,7 @@ function _i({ image: e }) {
|
|
|
2243
2247
|
className: "block max-w-full cursor-zoom-in",
|
|
2244
2248
|
"data-testid": "chat-image",
|
|
2245
2249
|
onClick: (a) => {
|
|
2246
|
-
|
|
2250
|
+
Si(a) && (a.preventDefault(), n(!0));
|
|
2247
2251
|
},
|
|
2248
2252
|
children: /* @__PURE__ */ l(
|
|
2249
2253
|
"img",
|
|
@@ -2270,17 +2274,17 @@ function _i({ image: e }) {
|
|
|
2270
2274
|
)
|
|
2271
2275
|
] });
|
|
2272
2276
|
}
|
|
2273
|
-
function
|
|
2274
|
-
return e?.length ? /* @__PURE__ */ l("div", { className: "flex flex-wrap gap-1 mt-1", "data-testid": "chat-images", children: e.map((t, n) => /* @__PURE__ */ l(
|
|
2277
|
+
function Ci({ images: e }) {
|
|
2278
|
+
return e?.length ? /* @__PURE__ */ l("div", { className: "flex flex-wrap gap-1 mt-1", "data-testid": "chat-images", children: e.map((t, n) => /* @__PURE__ */ l(xi, { image: t }, `${t.key}-${n}`)) }) : null;
|
|
2275
2279
|
}
|
|
2276
|
-
function
|
|
2280
|
+
function ki(e, t) {
|
|
2277
2281
|
return e.author && t.author ? e.author === t.author : !!t.clientId && e.clientId === t.clientId;
|
|
2278
2282
|
}
|
|
2279
2283
|
function qe(e) {
|
|
2280
2284
|
return new Date(e).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
2281
2285
|
}
|
|
2282
|
-
const
|
|
2283
|
-
const n = m((a) => a.me.clientId), o = m((a) => a.me.clientId ? a.roster[a.me.clientId]?.author : void 0), i =
|
|
2286
|
+
const Ii = Bt.memo(function({ message: t }) {
|
|
2287
|
+
const n = m((a) => a.me.clientId), o = m((a) => a.me.clientId ? a.roster[a.me.clientId]?.author : void 0), i = ki(t, { clientId: n, author: o });
|
|
2284
2288
|
if (t.isSystem && t.systemType === "recap")
|
|
2285
2289
|
return /* @__PURE__ */ l("div", { className: "px-2 py-1.5", children: /* @__PURE__ */ b("div", { className: "border-l-2 border-border-light pl-2.5 py-0.5", children: [
|
|
2286
2290
|
/* @__PURE__ */ b("div", { className: "text-[10px] uppercase tracking-wide text-text-muted mb-0.5", children: [
|
|
@@ -2309,11 +2313,11 @@ const ki = Bt.memo(function({ message: t }) {
|
|
|
2309
2313
|
/* @__PURE__ */ l("span", { className: "font-medium text-[13px]", style: { color: s }, children: t.name }),
|
|
2310
2314
|
/* @__PURE__ */ l("span", { className: "text-[10px] text-text-muted opacity-60 ml-1.5", children: qe(t.ts) }),
|
|
2311
2315
|
t.text && /* @__PURE__ */ l("p", { className: "text-[13px] text-text break-words leading-snug m-0", children: t.text }),
|
|
2312
|
-
/* @__PURE__ */ l(
|
|
2316
|
+
/* @__PURE__ */ l(Ci, { images: t.images })
|
|
2313
2317
|
] })
|
|
2314
2318
|
] });
|
|
2315
2319
|
});
|
|
2316
|
-
function
|
|
2320
|
+
function Ti() {
|
|
2317
2321
|
const e = m((i) => i.chat), t = J(null), n = J(!1), o = N(() => {
|
|
2318
2322
|
const i = t.current;
|
|
2319
2323
|
if (!i) return;
|
|
@@ -2337,7 +2341,7 @@ function Ii() {
|
|
|
2337
2341
|
/* @__PURE__ */ l("span", { className: "text-[10px] text-text-muted whitespace-nowrap", children: new Date(i.ts).toLocaleDateString([], { weekday: "short", month: "short", day: "numeric" }) }),
|
|
2338
2342
|
/* @__PURE__ */ l("div", { className: "flex-1 h-px bg-border" })
|
|
2339
2343
|
] }),
|
|
2340
|
-
/* @__PURE__ */ l(
|
|
2344
|
+
/* @__PURE__ */ l(Ii, { message: i })
|
|
2341
2345
|
] }, i.id);
|
|
2342
2346
|
}) })
|
|
2343
2347
|
}
|
|
@@ -2370,12 +2374,12 @@ const ft = [
|
|
|
2370
2374
|
scope: "local"
|
|
2371
2375
|
}
|
|
2372
2376
|
], re = "/";
|
|
2373
|
-
function
|
|
2377
|
+
function Ei(e) {
|
|
2374
2378
|
if (!e.startsWith(re)) return null;
|
|
2375
2379
|
const t = e.slice(re.length);
|
|
2376
2380
|
return /\s/.test(t) ? null : t.toLowerCase();
|
|
2377
2381
|
}
|
|
2378
|
-
function
|
|
2382
|
+
function Ai(e, t = ft) {
|
|
2379
2383
|
const n = e.toLowerCase();
|
|
2380
2384
|
if (!n) return [...t].sort((i, s) => i.name.localeCompare(s.name));
|
|
2381
2385
|
const o = [];
|
|
@@ -2385,23 +2389,23 @@ function Ei(e, t = ft) {
|
|
|
2385
2389
|
}
|
|
2386
2390
|
return o.sort((i, s) => i.rank - s.rank || i.cmd.name.localeCompare(s.cmd.name)).map((i) => i.cmd);
|
|
2387
2391
|
}
|
|
2388
|
-
function
|
|
2392
|
+
function Ni(e) {
|
|
2389
2393
|
return `${re}${e.name} `;
|
|
2390
2394
|
}
|
|
2391
2395
|
function Ve(e, t) {
|
|
2392
2396
|
return t <= 0 ? 0 : (e % t + t) % t;
|
|
2393
2397
|
}
|
|
2394
|
-
function
|
|
2398
|
+
function Pi(e, t = ft) {
|
|
2395
2399
|
const n = e.trim();
|
|
2396
2400
|
if (!n) return null;
|
|
2397
2401
|
if (!n.startsWith(re)) return { kind: "chat", text: n };
|
|
2398
2402
|
const o = n.slice(re.length), i = o.search(/\s/), s = (i === -1 ? o : o.slice(0, i)).toLowerCase(), a = i === -1 ? "" : o.slice(i).trim(), c = t.find((f) => f.name.toLowerCase() === s);
|
|
2399
2403
|
return c ? { kind: "command", command: c, args: a } : { kind: "chat", text: n };
|
|
2400
2404
|
}
|
|
2401
|
-
function
|
|
2405
|
+
function Mi(e, t) {
|
|
2402
2406
|
return e.requiresMedia && !t.hasMedia ? `${re}${e.name} needs an episode loaded.` : null;
|
|
2403
2407
|
}
|
|
2404
|
-
function
|
|
2408
|
+
function Oi({
|
|
2405
2409
|
commands: e,
|
|
2406
2410
|
activeIndex: t,
|
|
2407
2411
|
hasMedia: n,
|
|
@@ -2443,7 +2447,7 @@ function Mi({
|
|
|
2443
2447
|
}
|
|
2444
2448
|
);
|
|
2445
2449
|
}
|
|
2446
|
-
function
|
|
2450
|
+
function Ri({
|
|
2447
2451
|
pending: e,
|
|
2448
2452
|
uploading: t,
|
|
2449
2453
|
onRemove: n
|
|
@@ -2470,49 +2474,49 @@ function Oi({
|
|
|
2470
2474
|
)
|
|
2471
2475
|
] }, o.id)) }) : null;
|
|
2472
2476
|
}
|
|
2473
|
-
function
|
|
2477
|
+
function Di() {
|
|
2474
2478
|
const [e, t] = P([]), [n, o] = P(!1), i = m((h) => h.pushToast), s = J(/* @__PURE__ */ new Set());
|
|
2475
2479
|
O(() => () => {
|
|
2476
2480
|
for (const h of s.current) URL.revokeObjectURL(h);
|
|
2477
2481
|
s.current.clear();
|
|
2478
2482
|
}, []);
|
|
2479
2483
|
const a = N((h) => {
|
|
2480
|
-
|
|
2484
|
+
Or(h) && (URL.revokeObjectURL(h.previewUrl), s.current.delete(h.previewUrl));
|
|
2481
2485
|
}, []), c = N(async (h) => {
|
|
2482
2486
|
if (!h.length) return;
|
|
2483
2487
|
const _ = [];
|
|
2484
|
-
for (const
|
|
2485
|
-
const k =
|
|
2488
|
+
for (const w of h) {
|
|
2489
|
+
const k = Dr(w);
|
|
2486
2490
|
if (k) {
|
|
2487
2491
|
i("error", k);
|
|
2488
2492
|
continue;
|
|
2489
2493
|
}
|
|
2490
|
-
const { w: u, h: v } = await
|
|
2494
|
+
const { w: u, h: v } = await Ur(w), E = URL.createObjectURL(w);
|
|
2491
2495
|
s.current.add(E), _.push({
|
|
2492
2496
|
kind: "file",
|
|
2493
2497
|
id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
2494
|
-
file:
|
|
2498
|
+
file: w,
|
|
2495
2499
|
previewUrl: E,
|
|
2496
2500
|
w: u,
|
|
2497
2501
|
h: v
|
|
2498
2502
|
});
|
|
2499
2503
|
}
|
|
2500
|
-
_.length && t((
|
|
2501
|
-
const k = Y -
|
|
2504
|
+
_.length && t((w) => {
|
|
2505
|
+
const k = Y - w.length;
|
|
2502
2506
|
if (k <= 0) {
|
|
2503
2507
|
i("info", `Up to ${Y} images per message`);
|
|
2504
2508
|
for (const u of _) a(u);
|
|
2505
|
-
return
|
|
2509
|
+
return w;
|
|
2506
2510
|
}
|
|
2507
2511
|
if (_.length > k) {
|
|
2508
2512
|
i("info", `Up to ${Y} images per message`);
|
|
2509
2513
|
for (const u of _.slice(k)) a(u);
|
|
2510
2514
|
}
|
|
2511
|
-
return [...
|
|
2515
|
+
return [...w, ..._.slice(0, k)];
|
|
2512
2516
|
});
|
|
2513
2517
|
}, [i, a]), f = N((h) => {
|
|
2514
2518
|
const _ = Pe(h.key);
|
|
2515
|
-
_ && (t((
|
|
2519
|
+
_ && (t((w) => w.length >= Y ? (i("info", `Up to ${Y} images per message`), w) : [...w, {
|
|
2516
2520
|
kind: "remote",
|
|
2517
2521
|
id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
2518
2522
|
key: h.key,
|
|
@@ -2525,8 +2529,8 @@ function Ri() {
|
|
|
2525
2529
|
}]), je().catalogue(mn).recordUse(h.key));
|
|
2526
2530
|
}, [i]), g = N((h) => {
|
|
2527
2531
|
t((_) => {
|
|
2528
|
-
const
|
|
2529
|
-
return
|
|
2532
|
+
const w = _.find((k) => k.id === h);
|
|
2533
|
+
return w && a(w), _.filter((k) => k.id !== h);
|
|
2530
2534
|
});
|
|
2531
2535
|
}, [a]), p = N(() => {
|
|
2532
2536
|
t((h) => {
|
|
@@ -2534,10 +2538,10 @@ function Ri() {
|
|
|
2534
2538
|
return [];
|
|
2535
2539
|
});
|
|
2536
2540
|
}, [a]), D = N((h) => {
|
|
2537
|
-
const _ =
|
|
2541
|
+
const _ = Lr(h.clipboardData);
|
|
2538
2542
|
_.length && (h.preventDefault(), c(_));
|
|
2539
2543
|
}, [c]), M = N((h) => {
|
|
2540
|
-
const _ =
|
|
2544
|
+
const _ = jr(h.dataTransfer);
|
|
2541
2545
|
_.length && (h.preventDefault(), c(_));
|
|
2542
2546
|
}, [c]), T = N((h) => {
|
|
2543
2547
|
h.dataTransfer?.types?.includes("Files") && h.preventDefault();
|
|
@@ -2545,9 +2549,9 @@ function Ri() {
|
|
|
2545
2549
|
if (!e.length) return [];
|
|
2546
2550
|
o(!0);
|
|
2547
2551
|
try {
|
|
2548
|
-
return await
|
|
2552
|
+
return await Hr(e);
|
|
2549
2553
|
} catch (h) {
|
|
2550
|
-
return A("chat", "Image upload failed",
|
|
2554
|
+
return A("chat", "Image upload failed", $r(h)), i("error", Rr(h)), null;
|
|
2551
2555
|
} finally {
|
|
2552
2556
|
o(!1);
|
|
2553
2557
|
}
|
|
@@ -2565,44 +2569,44 @@ function Ri() {
|
|
|
2565
2569
|
onDragOver: T
|
|
2566
2570
|
};
|
|
2567
2571
|
}
|
|
2568
|
-
const Ut = Yt,
|
|
2569
|
-
function
|
|
2570
|
-
const [t, n] = P(""), [o, i] = P(!1), [s, a] = P({ q: null, i: 0 }), [c, f] = P(!1), g = J(null), p = On(), [D, M] = P(!1), [T, C] = P(!1), h =
|
|
2571
|
-
() => E === null ? [] :
|
|
2572
|
+
const Ut = Yt, Li = Zn;
|
|
2573
|
+
function ji({ commands: e = ft }) {
|
|
2574
|
+
const [t, n] = P(""), [o, i] = P(!1), [s, a] = P({ q: null, i: 0 }), [c, f] = P(!1), g = J(null), p = On(), [D, M] = P(!1), [T, C] = P(!1), h = Di(), _ = m((y) => y.snapshot.mediaId), w = m((y) => y.pushToast), k = m((y) => y.setTierlistOpen), u = m((y) => y.setCharacterModalOpen), v = !!_, E = Ei(t), U = Q(
|
|
2575
|
+
() => E === null ? [] : Ai(E, e),
|
|
2572
2576
|
[E, e]
|
|
2573
|
-
), H = E !== null && !c && U.length > 0,
|
|
2577
|
+
), H = E !== null && !c && U.length > 0, S = s.q === E ? Ve(s.i, U.length) : 0, R = N(
|
|
2574
2578
|
(y) => a({ q: E, i: y }),
|
|
2575
2579
|
[E]
|
|
2576
2580
|
), L = N((y, j) => {
|
|
2577
|
-
const ae =
|
|
2581
|
+
const ae = Mi(y, { hasMedia: v });
|
|
2578
2582
|
if (ae) {
|
|
2579
|
-
|
|
2583
|
+
w("info", ae);
|
|
2580
2584
|
return;
|
|
2581
2585
|
}
|
|
2582
2586
|
switch (y.name) {
|
|
2583
2587
|
case "help":
|
|
2584
|
-
|
|
2588
|
+
w("info", e.map((Mn) => Mn.usage).join(" "));
|
|
2585
2589
|
break;
|
|
2586
2590
|
case "recap":
|
|
2587
|
-
|
|
2591
|
+
vi();
|
|
2588
2592
|
break;
|
|
2589
2593
|
case "tierlist":
|
|
2590
|
-
|
|
2594
|
+
Do(), k(!0);
|
|
2591
2595
|
break;
|
|
2592
2596
|
case "character":
|
|
2593
2597
|
u(!0);
|
|
2594
2598
|
break;
|
|
2595
2599
|
default:
|
|
2596
|
-
|
|
2600
|
+
w("info", `${y.usage} is not implemented yet.`);
|
|
2597
2601
|
}
|
|
2598
|
-
}, [v,
|
|
2599
|
-
n(
|
|
2602
|
+
}, [v, w, e, k, u]), F = N((y) => {
|
|
2603
|
+
n(Ni(y)), f(!1), g.current?.focus();
|
|
2600
2604
|
}, []), W = N(async (y) => {
|
|
2601
2605
|
if (y.preventDefault(), o || h.uploading) return;
|
|
2602
|
-
const j =
|
|
2606
|
+
const j = Pi(t, e);
|
|
2603
2607
|
if (!j && !h.pending.length) return;
|
|
2604
2608
|
if (j?.kind === "command" && h.pending.length) {
|
|
2605
|
-
|
|
2609
|
+
w("info", "Send images on their own, not with a command.");
|
|
2606
2610
|
return;
|
|
2607
2611
|
}
|
|
2608
2612
|
if (j?.kind === "command") {
|
|
@@ -2610,35 +2614,35 @@ function Li({ commands: e = ft }) {
|
|
|
2610
2614
|
return;
|
|
2611
2615
|
}
|
|
2612
2616
|
const ae = await h.uploadPending();
|
|
2613
|
-
ae !== null && (
|
|
2614
|
-
}, [t, o, L, h,
|
|
2617
|
+
ae !== null && (fi(j?.text ?? "", ae), n(""), h.clear(), i(!0), setTimeout(() => i(!1), Li), !document.hidden && document.hasFocus() && g.current?.focus());
|
|
2618
|
+
}, [t, o, L, h, w, e]), Pn = N((y) => {
|
|
2615
2619
|
if (y.key === "Escape" && H) {
|
|
2616
2620
|
y.preventDefault(), f(!0);
|
|
2617
2621
|
return;
|
|
2618
2622
|
}
|
|
2619
2623
|
if (H) {
|
|
2620
2624
|
if (y.key === "ArrowDown")
|
|
2621
|
-
y.preventDefault(), R(Ve(
|
|
2625
|
+
y.preventDefault(), R(Ve(S + 1, U.length));
|
|
2622
2626
|
else if (y.key === "ArrowUp")
|
|
2623
|
-
y.preventDefault(), R(Ve(
|
|
2627
|
+
y.preventDefault(), R(Ve(S - 1, U.length));
|
|
2624
2628
|
else if (y.key === "Tab") {
|
|
2625
2629
|
y.preventDefault();
|
|
2626
|
-
const j = U[
|
|
2630
|
+
const j = U[S];
|
|
2627
2631
|
j && F(j);
|
|
2628
2632
|
} else if (y.key === "Enter") {
|
|
2629
2633
|
y.preventDefault();
|
|
2630
|
-
const j = U[
|
|
2634
|
+
const j = U[S];
|
|
2631
2635
|
j && F(j);
|
|
2632
2636
|
}
|
|
2633
2637
|
}
|
|
2634
|
-
}, [H, U,
|
|
2638
|
+
}, [H, U, S, F, R]);
|
|
2635
2639
|
O(() => {
|
|
2636
2640
|
const y = () => {
|
|
2637
2641
|
document.hidden || !document.hasFocus() || (g.current?.focus(), g.current?.scrollIntoView({ block: "nearest" }));
|
|
2638
2642
|
};
|
|
2639
2643
|
return window.addEventListener("watchparty:focus-chat-input", y), () => window.removeEventListener("watchparty:focus-chat-input", y);
|
|
2640
2644
|
}, []);
|
|
2641
|
-
const be = Ut - t.length, ht = be <= 100, gt = H ? U[
|
|
2645
|
+
const be = Ut - t.length, ht = be <= 100, gt = H ? U[S] : void 0;
|
|
2642
2646
|
return /* @__PURE__ */ b(
|
|
2643
2647
|
"form",
|
|
2644
2648
|
{
|
|
@@ -2650,13 +2654,13 @@ function Li({ commands: e = ft }) {
|
|
|
2650
2654
|
onDragOver: h.onDragOver,
|
|
2651
2655
|
className: "p-2 border-t border-border",
|
|
2652
2656
|
children: [
|
|
2653
|
-
/* @__PURE__ */ l(
|
|
2657
|
+
/* @__PURE__ */ l(Ri, { pending: h.pending, uploading: h.uploading, onRemove: h.remove }),
|
|
2654
2658
|
/* @__PURE__ */ b("div", { className: "relative", children: [
|
|
2655
2659
|
H && /* @__PURE__ */ l(
|
|
2656
|
-
|
|
2660
|
+
Oi,
|
|
2657
2661
|
{
|
|
2658
2662
|
commands: U,
|
|
2659
|
-
activeIndex:
|
|
2663
|
+
activeIndex: S,
|
|
2660
2664
|
hasMedia: v,
|
|
2661
2665
|
onPick: F,
|
|
2662
2666
|
onHover: R,
|
|
@@ -2664,7 +2668,7 @@ function Li({ commands: e = ft }) {
|
|
|
2664
2668
|
}
|
|
2665
2669
|
),
|
|
2666
2670
|
/* @__PURE__ */ l(
|
|
2667
|
-
|
|
2671
|
+
qr,
|
|
2668
2672
|
{
|
|
2669
2673
|
open: D,
|
|
2670
2674
|
onClose: () => M(!1),
|
|
@@ -2717,7 +2721,7 @@ function Li({ commands: e = ft }) {
|
|
|
2717
2721
|
}
|
|
2718
2722
|
);
|
|
2719
2723
|
}
|
|
2720
|
-
function
|
|
2724
|
+
function Ui() {
|
|
2721
2725
|
const e = m((n) => n.roster), t = Object.values(e);
|
|
2722
2726
|
return t.length ? /* @__PURE__ */ l("div", { className: "flex flex-col gap-1", children: t.map((n) => {
|
|
2723
2727
|
const o = _n(n.sprite);
|
|
@@ -2736,7 +2740,7 @@ function ji() {
|
|
|
2736
2740
|
] }, n.clientId);
|
|
2737
2741
|
}) }) : /* @__PURE__ */ l("div", { className: "text-xs text-text-muted", children: "No users online" });
|
|
2738
2742
|
}
|
|
2739
|
-
function
|
|
2743
|
+
function Fi() {
|
|
2740
2744
|
const e = m((i) => Object.keys(i.roster).length), [t, n] = P(!1), o = J(null);
|
|
2741
2745
|
return O(() => {
|
|
2742
2746
|
if (!t) return;
|
|
@@ -2764,11 +2768,11 @@ function Ui() {
|
|
|
2764
2768
|
e,
|
|
2765
2769
|
" online"
|
|
2766
2770
|
] }),
|
|
2767
|
-
/* @__PURE__ */ l(
|
|
2771
|
+
/* @__PURE__ */ l(Ui, {})
|
|
2768
2772
|
] })
|
|
2769
2773
|
] });
|
|
2770
2774
|
}
|
|
2771
|
-
function
|
|
2775
|
+
function Hi() {
|
|
2772
2776
|
const e = m((n) => n.sprite), t = m((n) => n.setCharacterModalOpen);
|
|
2773
2777
|
return /* @__PURE__ */ l(
|
|
2774
2778
|
"button",
|
|
@@ -2791,9 +2795,9 @@ function Fi() {
|
|
|
2791
2795
|
}
|
|
2792
2796
|
);
|
|
2793
2797
|
}
|
|
2794
|
-
const se =
|
|
2795
|
-
function
|
|
2796
|
-
const i =
|
|
2798
|
+
const se = yo();
|
|
2799
|
+
function $i({ open: e, onClose: t, roomKey: n, tierlist: o }) {
|
|
2800
|
+
const i = zr(), { name: s, sprite: a, setIdentity: c } = m(), f = m((u) => !!(u.me.clientId && u.roster[u.me.clientId]?.registryName)), [g, p] = P(a), [D, M] = P(/* @__PURE__ */ new Set()), [T, C] = P(() => xt(se, a));
|
|
2797
2801
|
O(() => {
|
|
2798
2802
|
e && (p(a), C(xt(se, a)));
|
|
2799
2803
|
}, [e, a]), O(() => {
|
|
@@ -2805,8 +2809,8 @@ function Hi({ open: e, onClose: t, roomKey: n, tierlist: o }) {
|
|
|
2805
2809
|
}, [e, n]);
|
|
2806
2810
|
const h = () => {
|
|
2807
2811
|
const u = f || !g ? s : te(g);
|
|
2808
|
-
d("character", "Updating identity", { name: u, sprite: g }), c(u, g),
|
|
2809
|
-
}, _ = (u) => u === a ? !0 : !D.has(u),
|
|
2812
|
+
d("character", "Updating identity", { name: u, sprite: g }), c(u, g), gi(u, g || void 0), t();
|
|
2813
|
+
}, _ = (u) => u === a ? !0 : !D.has(u), w = (u) => {
|
|
2810
2814
|
u.target === u.currentTarget && t();
|
|
2811
2815
|
};
|
|
2812
2816
|
O(() => {
|
|
@@ -2821,7 +2825,7 @@ function Hi({ open: e, onClose: t, roomKey: n, tierlist: o }) {
|
|
|
2821
2825
|
"div",
|
|
2822
2826
|
{
|
|
2823
2827
|
className: "fixed inset-0 bg-black/70 flex items-center justify-center z-50",
|
|
2824
|
-
onMouseDown:
|
|
2828
|
+
onMouseDown: w,
|
|
2825
2829
|
role: "dialog",
|
|
2826
2830
|
"aria-modal": "true",
|
|
2827
2831
|
"aria-label": "Change character",
|
|
@@ -2952,38 +2956,38 @@ function Ht({ className: e = "fixed bottom-4 left-1/2 -translate-x-1/2" }) {
|
|
|
2952
2956
|
}, [t, n]), /* @__PURE__ */ l("div", { className: `${e} flex flex-col gap-2 z-50`, children: t.map((o) => /* @__PURE__ */ l("div", { className: `px-3 py-2 rounded text-sm shadow font-medium border ${o.kind === "error" ? "bg-danger-bg text-on-danger-bg border-danger" : "bg-bg-card border-border-light text-text"}`, children: o.msg }, o.id)) });
|
|
2953
2957
|
}
|
|
2954
2958
|
const $t = (e) => typeof e == "string" && Dn.includes(e);
|
|
2955
|
-
function
|
|
2959
|
+
function Bi(e, t, n) {
|
|
2956
2960
|
return e || ($t(t) ? t : $t(n) ? n : "dark");
|
|
2957
2961
|
}
|
|
2958
|
-
function
|
|
2962
|
+
function Gi(e, t) {
|
|
2959
2963
|
if (t(e.clientWidth), typeof ResizeObserver > "u") return () => {
|
|
2960
2964
|
};
|
|
2961
2965
|
const n = new ResizeObserver(() => t(e.clientWidth));
|
|
2962
2966
|
return n.observe(e), () => n.disconnect();
|
|
2963
2967
|
}
|
|
2964
|
-
function
|
|
2968
|
+
function Wi(e) {
|
|
2965
2969
|
const t = e?.trim() ?? "";
|
|
2966
2970
|
return t ? { source: "host", name: t } : { source: "auto" };
|
|
2967
2971
|
}
|
|
2968
|
-
function
|
|
2972
|
+
function Ki(e) {
|
|
2969
2973
|
if (e.source !== "host") return;
|
|
2970
2974
|
const { setSessionIdentity: t, sprite: n } = m.getState();
|
|
2971
2975
|
t(e.name, n);
|
|
2972
2976
|
}
|
|
2973
|
-
function
|
|
2977
|
+
function qi({ className: e = "w-4 h-4" }) {
|
|
2974
2978
|
return /* @__PURE__ */ b("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
|
|
2975
2979
|
/* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 4v16" }),
|
|
2976
2980
|
/* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15 12l-5 4v-8l5 4z" })
|
|
2977
2981
|
] });
|
|
2978
2982
|
}
|
|
2979
|
-
function
|
|
2983
|
+
function Vi({ className: e = "w-4 h-4" }) {
|
|
2980
2984
|
return /* @__PURE__ */ b("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
|
|
2981
2985
|
/* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M20 4v16" }),
|
|
2982
2986
|
/* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 12l5 4v-8l-5 4z" })
|
|
2983
2987
|
] });
|
|
2984
2988
|
}
|
|
2985
|
-
const
|
|
2986
|
-
function
|
|
2989
|
+
const zi = 1500;
|
|
2990
|
+
function sa({
|
|
2987
2991
|
roomKey: e,
|
|
2988
2992
|
serverOrigin: t,
|
|
2989
2993
|
userType: n,
|
|
@@ -2996,8 +3000,8 @@ function aa({
|
|
|
2996
3000
|
debug: g,
|
|
2997
3001
|
children: p
|
|
2998
3002
|
}) {
|
|
2999
|
-
const [D, M] = P(null), { setFrame: T, ...C } =
|
|
3000
|
-
() =>
|
|
3003
|
+
const [D, M] = P(null), { setFrame: T, ...C } = Yi(c, f), h = m((S) => S.characterModalOpen), _ = m((S) => S.setCharacterModalOpen), w = Kt(() => s), k = Q(() => (go({ userType: n, userId: o ?? null }), dt().theme), [n, o]), u = Ln(), v = u?.theme, E = Q(
|
|
3004
|
+
() => Bi(i, v, k),
|
|
3001
3005
|
[i, v, k]
|
|
3002
3006
|
);
|
|
3003
3007
|
O(() => {
|
|
@@ -3007,32 +3011,32 @@ function aa({
|
|
|
3007
3011
|
[t, e]
|
|
3008
3012
|
);
|
|
3009
3013
|
return O(() => {
|
|
3010
|
-
g &&
|
|
3014
|
+
g && Zr();
|
|
3011
3015
|
}, [g]), O(() => {
|
|
3012
|
-
|
|
3013
|
-
let
|
|
3014
|
-
const R =
|
|
3016
|
+
Vr({ serverOrigin: t, defaultRoomKey: e }), m.getState().rehydrateFromPrefs(), qo();
|
|
3017
|
+
let S = !1;
|
|
3018
|
+
const R = vo();
|
|
3015
3019
|
return (async () => {
|
|
3016
3020
|
try {
|
|
3017
3021
|
await Promise.race([
|
|
3018
3022
|
Promise.all([
|
|
3019
3023
|
R,
|
|
3020
|
-
|
|
3024
|
+
ko().then((W) => {
|
|
3021
3025
|
W && m.getState().rehydrateFromPrefs();
|
|
3022
3026
|
})
|
|
3023
3027
|
]),
|
|
3024
|
-
new Promise((W) => setTimeout(W,
|
|
3028
|
+
new Promise((W) => setTimeout(W, zi))
|
|
3025
3029
|
]);
|
|
3026
3030
|
} catch (W) {
|
|
3027
3031
|
A("room-chrome", "pre-join wait threw, proceeding anyway", ge(W));
|
|
3028
3032
|
}
|
|
3029
|
-
if (
|
|
3030
|
-
const L =
|
|
3031
|
-
m.getState().ensureAutoIdentity(),
|
|
3033
|
+
if (S) return;
|
|
3034
|
+
const L = Wi(w());
|
|
3035
|
+
m.getState().ensureAutoIdentity(), Ki(L);
|
|
3032
3036
|
const F = m.getState();
|
|
3033
|
-
d("room-chrome", "Joining room", { roomKey: e, name: F.name, sprite: F.sprite }),
|
|
3037
|
+
d("room-chrome", "Joining room", { roomKey: e, name: F.name, sprite: F.sprite }), ni({ room_key: e, name: F.name || void 0, sprite: F.sprite || void 0 });
|
|
3034
3038
|
})(), () => {
|
|
3035
|
-
|
|
3039
|
+
S = !0, jt();
|
|
3036
3040
|
};
|
|
3037
3041
|
}, [e, t, n, o]), /* @__PURE__ */ l(pn.Provider, { value: H, children: /* @__PURE__ */ l(gn.Provider, { value: D, children: /* @__PURE__ */ b("div", { ref: T, className: "wp-room-chrome-frame", children: [
|
|
3038
3042
|
/* @__PURE__ */ l("div", { className: "wp-room-chrome-frame__content", children: p }),
|
|
@@ -3054,7 +3058,7 @@ function aa({
|
|
|
3054
3058
|
title: "Show chat",
|
|
3055
3059
|
"aria-label": "Show chat",
|
|
3056
3060
|
"aria-expanded": !1,
|
|
3057
|
-
children: /* @__PURE__ */ l(
|
|
3061
|
+
children: /* @__PURE__ */ l(Vi, {})
|
|
3058
3062
|
}
|
|
3059
3063
|
),
|
|
3060
3064
|
/* @__PURE__ */ l(Ht, { className: "absolute bottom-2 right-full mr-2 w-72" })
|
|
@@ -3079,8 +3083,8 @@ function aa({
|
|
|
3079
3083
|
}
|
|
3080
3084
|
),
|
|
3081
3085
|
/* @__PURE__ */ b("div", { className: "flex items-center gap-1 px-2 py-1.5 border-b border-border", children: [
|
|
3082
|
-
/* @__PURE__ */ l(Ui, {}),
|
|
3083
3086
|
/* @__PURE__ */ l(Fi, {}),
|
|
3087
|
+
/* @__PURE__ */ l(Hi, {}),
|
|
3084
3088
|
/* @__PURE__ */ l("div", { className: "flex-1" }),
|
|
3085
3089
|
a && /* @__PURE__ */ l(
|
|
3086
3090
|
"button",
|
|
@@ -3102,27 +3106,27 @@ function aa({
|
|
|
3102
3106
|
title: "Hide chat",
|
|
3103
3107
|
"aria-label": "Hide chat",
|
|
3104
3108
|
"aria-expanded": !0,
|
|
3105
|
-
children: /* @__PURE__ */ l(
|
|
3109
|
+
children: /* @__PURE__ */ l(qi, {})
|
|
3106
3110
|
}
|
|
3107
3111
|
)
|
|
3108
3112
|
] }),
|
|
3109
|
-
/* @__PURE__ */ l(
|
|
3110
|
-
/* @__PURE__ */ l(
|
|
3113
|
+
/* @__PURE__ */ l(Ti, {}),
|
|
3114
|
+
/* @__PURE__ */ l(ji, { commands: [] }),
|
|
3111
3115
|
/* @__PURE__ */ l(Ht, { className: "absolute bottom-14 left-2 right-2" })
|
|
3112
3116
|
] }),
|
|
3113
|
-
h && /* @__PURE__ */ l(
|
|
3117
|
+
h && /* @__PURE__ */ l($i, { open: !0, onClose: () => _(!1), roomKey: e })
|
|
3114
3118
|
]
|
|
3115
3119
|
}
|
|
3116
3120
|
)
|
|
3117
3121
|
] }) }) });
|
|
3118
3122
|
}
|
|
3119
|
-
function
|
|
3123
|
+
function Yi(e, t) {
|
|
3120
3124
|
const n = m((u) => u.chromeChatCollapsed) && t, o = m((u) => u.chromeChatWidth), i = m((u) => u.toggleChromeChatCollapsed), s = m((u) => u.setChromeChatWidth), [a, c] = P(null), [f, g] = P(void 0), [p, D] = P(null);
|
|
3121
3125
|
O(() => {
|
|
3122
3126
|
if (a)
|
|
3123
|
-
return
|
|
3127
|
+
return Gi(a, g);
|
|
3124
3128
|
}, [a]);
|
|
3125
|
-
const M = V(p?.current ?? o, f), T = Q(() =>
|
|
3129
|
+
const M = V(p?.current ?? o, f), T = Q(() => No(n, M), [n, M]), C = Kt((u) => e?.(u));
|
|
3126
3130
|
return O(() => {
|
|
3127
3131
|
C(T);
|
|
3128
3132
|
}, [T]), {
|
|
@@ -3143,12 +3147,12 @@ function zi(e, t) {
|
|
|
3143
3147
|
D(null), v !== o && s(v);
|
|
3144
3148
|
},
|
|
3145
3149
|
onKeyDown: (u) => {
|
|
3146
|
-
const v =
|
|
3150
|
+
const v = Ao(M, u.key, f);
|
|
3147
3151
|
v !== null && (u.preventDefault(), v !== o && s(v));
|
|
3148
3152
|
}
|
|
3149
3153
|
};
|
|
3150
3154
|
}
|
|
3151
3155
|
export {
|
|
3152
|
-
|
|
3156
|
+
sa as RoomChrome
|
|
3153
3157
|
};
|
|
3154
3158
|
//# sourceMappingURL=room-chrome.js.map
|