@hadoku/watchparty-ui 0.44.16 → 0.44.19
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-CJtacvRu.js → AdminPanel-x_k_Hefb.js} +12 -12
- package/dist/chunks/{AdminPanel-CJtacvRu.js.map → AdminPanel-x_k_Hefb.js.map} +1 -1
- package/dist/chunks/{GameModule-BvqNQcVk.js → GameModule-D71uhFdW.js} +19 -19
- package/dist/chunks/{GameModule-BvqNQcVk.js.map → GameModule-D71uhFdW.js.map} +1 -1
- package/dist/chunks/{MapEditor-Bc0_hjZQ.js → MapEditor-gB0UYuFm.js} +2 -2
- package/dist/chunks/{MapEditor-Bc0_hjZQ.js.map → MapEditor-gB0UYuFm.js.map} +1 -1
- package/dist/chunks/{MediaDrawer-CgoGUHwV.js → MediaDrawer-DYNPH01V.js} +51 -51
- package/dist/chunks/{MediaDrawer-CgoGUHwV.js.map → MediaDrawer-DYNPH01V.js.map} +1 -1
- package/dist/chunks/{PlaylistPanel-BmKnGMqa.js → PlaylistPanel-CYNImBh_.js} +20 -20
- package/dist/chunks/{PlaylistPanel-BmKnGMqa.js.map → PlaylistPanel-CYNImBh_.js.map} +1 -1
- package/dist/chunks/{Room-CoE8L9aw.js → Room-C1DWAuT8.js} +464 -459
- package/dist/chunks/Room-C1DWAuT8.js.map +1 -0
- package/dist/chunks/{index-Buah62TP.js → index-DWgUNApo.js} +1295 -1319
- package/dist/chunks/index-DWgUNApo.js.map +1 -0
- package/dist/chunks/{submissionsApi-DXsG0ItW.js → submissionsApi-D9R81t17.js} +21 -21
- package/dist/chunks/{submissionsApi-DXsG0ItW.js.map → submissionsApi-D9R81t17.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/room-chrome.css +1 -1
- package/dist/room-chrome.js +644 -658
- package/dist/room-chrome.js.map +1 -1
- package/package.json +4 -4
- package/dist/chunks/Room-CoE8L9aw.js.map +0 -1
- package/dist/chunks/index-Buah62TP.js.map +0 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as l, jsxs as k, Fragment as be } from "react/jsx-runtime";
|
|
2
2
|
import Ke, { useState as B, useRef as L, useEffect as N, useCallback as O, useMemo as ke, Component as Br, useContext as Dr, createContext as Pr, useId as Or, useEffectEvent as dt } from "react";
|
|
3
|
-
import { k as
|
|
3
|
+
import { k as Ur, M as Hr, m as jr, f as Gr, a as Wr, b as st, c as jt, i as Vr, S as Kr, r as ft, d as w, e as ue, h as S, j as De, A as Gt, D as et, w as A, l as zr, n as Jr, o as Ln, p as $n, q as Bn, t as Qr, L as qr, v as Xr, x as Yr, y as pt, z as Zr, B as es, E as ts, F as ns, G as Dn, H as Wt, I as Pn, J as On, K as rs, N as ss, O as Me, P as Vt, s as Kt, Q as dn, T as xt, R as as, U as Un, V as is, W as os, X as Hn, Y as Se, g as cs, Z as jn, _ as Gn, $ as We, a0 as ls, a1 as ds, a2 as us, a3 as fs, a4 as hs, a5 as un, a6 as Oe, a7 as ps, a8 as fn, a9 as ms, aa as gs, ab as hn, ac as bs, ad as ys, ae as vs, af as Ss, ag as ws, ah as pn, ai as mn, aj as Wn, ak as Vn, al as gn, am as xs, an as ct, ao as Es, ap as Ms, aq as ks, ar as _s, as as As, at as Ts, au as Cs, av as Is, aw as Rs, ax as Fs } from "./index-DWgUNApo.js";
|
|
4
4
|
import { createPortal as mt } from "react-dom";
|
|
5
|
-
import { Icon as at, THEMES as
|
|
6
|
-
import { HadokuThemePicker as
|
|
7
|
-
import { createRoot as
|
|
8
|
-
function
|
|
5
|
+
import { Icon as at, THEMES as Ns, useHadokuThemeOptional as Ls } from "@wolffm/themes";
|
|
6
|
+
import { HadokuThemePicker as $s, ConnectedSettings as Bs } from "@wolffm/task-ui-components";
|
|
7
|
+
import { createRoot as Ds } from "react-dom/client";
|
|
8
|
+
function Ps(n) {
|
|
9
9
|
return n.kind === "file";
|
|
10
10
|
}
|
|
11
|
-
class
|
|
11
|
+
class Kn extends Error {
|
|
12
12
|
constructor(e) {
|
|
13
13
|
super(e), this.name = "ChatImageUploadError";
|
|
14
14
|
}
|
|
@@ -33,42 +33,42 @@ function ut(n) {
|
|
|
33
33
|
return "Image upload failed";
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
return n instanceof st ? ut(n.reason) : n instanceof
|
|
36
|
+
function Os(n) {
|
|
37
|
+
return n instanceof st ? ut(n.reason) : n instanceof Kn ? n.message : "Image upload failed";
|
|
38
38
|
}
|
|
39
39
|
function Us(n) {
|
|
40
40
|
const e = n.type.toLowerCase().split(";")[0].trim();
|
|
41
|
-
return e &&
|
|
41
|
+
return e && Ur(e) !== "image" ? ut("unsupported-type") : n.size > Hr.image ? ut("too-large") : n.size === 0 ? ut("invalid") : null;
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function Hs(n) {
|
|
44
44
|
return Gr(n);
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function js(n) {
|
|
47
47
|
return Wr(n);
|
|
48
48
|
}
|
|
49
|
-
async function
|
|
49
|
+
async function Gs(n) {
|
|
50
50
|
const e = await jr(n);
|
|
51
51
|
return { w: e?.width ?? 0, h: e?.height ?? 0 };
|
|
52
52
|
}
|
|
53
|
-
async function
|
|
53
|
+
async function Ws(n, e = {}) {
|
|
54
54
|
const t = await jt().upload(n, { signal: e.signal });
|
|
55
55
|
if (!Vr(t.key))
|
|
56
|
-
throw new
|
|
56
|
+
throw new Kn("Image upload returned an unusable key");
|
|
57
57
|
return { key: t.key, deduplicated: t.deduplicated === !0 };
|
|
58
58
|
}
|
|
59
|
-
async function
|
|
59
|
+
async function Vs(n, e = {}) {
|
|
60
60
|
const t = [];
|
|
61
61
|
for (const r of n) {
|
|
62
62
|
if (r.kind === "remote") {
|
|
63
63
|
t.push({ key: r.key, w: r.w, h: r.h, ...r.title ? { title: r.title } : {} });
|
|
64
64
|
continue;
|
|
65
65
|
}
|
|
66
|
-
const { key: s } = await
|
|
66
|
+
const { key: s } = await Ws(r.file, e);
|
|
67
67
|
t.push({ key: s, w: r.w, h: r.h });
|
|
68
68
|
}
|
|
69
69
|
return t;
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function Ks(n) {
|
|
72
72
|
return {
|
|
73
73
|
error: n instanceof Error ? n.message : String(n),
|
|
74
74
|
name: n instanceof Error ? n.name : typeof n,
|
|
@@ -76,14 +76,14 @@ function zs(n) {
|
|
|
76
76
|
status: n instanceof st ? n.status : void 0
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function zs(n) {
|
|
80
80
|
const e = L(n);
|
|
81
81
|
return N(() => {
|
|
82
82
|
e.current = n;
|
|
83
83
|
}), [e, `${n.cdnBase}|${n.uploadPath}`];
|
|
84
84
|
}
|
|
85
|
-
function
|
|
86
|
-
const { limit: s, debounceMs: i = Kr } = r, [a, d] =
|
|
85
|
+
function Js(n, e, t, r = {}) {
|
|
86
|
+
const { limit: s, debounceMs: i = Kr } = r, [a, d] = zs(n), [c, o] = B([]), [u, f] = B(null), [h, v] = B(!1), [y, p] = B(null), [g, C] = B(0), b = L(null);
|
|
87
87
|
N(() => {
|
|
88
88
|
C(0), f(null);
|
|
89
89
|
}, [t, e]), N(() => {
|
|
@@ -127,19 +127,19 @@ function Qs(n, e, t, r = {}) {
|
|
|
127
127
|
}, [h, u]);
|
|
128
128
|
return { items: c, loading: h, error: y, hasMore: u !== null, loadMore: M };
|
|
129
129
|
}
|
|
130
|
-
const Bt = 240, Ne = 8,
|
|
131
|
-
function
|
|
130
|
+
const Bt = 240, Ne = 8, Qs = 28, zn = 240;
|
|
131
|
+
function qs(n, e, t) {
|
|
132
132
|
let r = e.left - Bt - Ne;
|
|
133
133
|
r < Ne && (r = e.right + Ne), r = Math.min(r, t.width - Bt - Ne), r = Math.max(Ne, r);
|
|
134
|
-
const s =
|
|
134
|
+
const s = zn + Qs;
|
|
135
135
|
let i = n.top + n.height / 2 - s / 2;
|
|
136
136
|
return i = Math.min(i, t.height - s - Ne), i = Math.max(Ne, i), { left: r, top: i };
|
|
137
137
|
}
|
|
138
|
-
const
|
|
139
|
-
function
|
|
140
|
-
const [r, s] = B(""), i = L(null), a = L(null), d = jt(), { items: c, loading: o, error: u, hasMore: f, loadMore: h } =
|
|
138
|
+
const Jn = "/dataplatform/api/memes", Xs = 120;
|
|
139
|
+
function Ys({ onClose: n, onPick: e, onUnavailable: t }) {
|
|
140
|
+
const [r, s] = B(""), i = L(null), a = L(null), d = jt(), { items: c, loading: o, error: u, hasMore: f, loadMore: h } = Js(
|
|
141
141
|
d,
|
|
142
|
-
|
|
142
|
+
Jn,
|
|
143
143
|
r.trim()
|
|
144
144
|
), v = u?.reason ?? null, y = ke(() => {
|
|
145
145
|
const m = /* @__PURE__ */ new Set();
|
|
@@ -154,12 +154,12 @@ function Zs({ onClose: n, onPick: e, onUnavailable: t }) {
|
|
|
154
154
|
if (!G) return;
|
|
155
155
|
const P = () => g({
|
|
156
156
|
item: m,
|
|
157
|
-
...
|
|
157
|
+
...qs(_.getBoundingClientRect(), G.getBoundingClientRect(), {
|
|
158
158
|
width: window.innerWidth,
|
|
159
159
|
height: window.innerHeight
|
|
160
160
|
})
|
|
161
161
|
});
|
|
162
|
-
b(), T ? P() : C.current = window.setTimeout(P,
|
|
162
|
+
b(), T ? P() : C.current = window.setTimeout(P, Xs);
|
|
163
163
|
},
|
|
164
164
|
[b]
|
|
165
165
|
);
|
|
@@ -288,7 +288,7 @@ function Zs({ onClose: n, onPick: e, onUnavailable: t }) {
|
|
|
288
288
|
src: ft(p.item.key) ?? void 0,
|
|
289
289
|
alt: "",
|
|
290
290
|
className: "block w-full rounded bg-bg object-contain",
|
|
291
|
-
style: { height: "auto", maxHeight:
|
|
291
|
+
style: { height: "auto", maxHeight: zn }
|
|
292
292
|
}
|
|
293
293
|
),
|
|
294
294
|
p.item.title && /* One line. A long title must not change the box height, because
|
|
@@ -301,20 +301,20 @@ function Zs({ onClose: n, onPick: e, onUnavailable: t }) {
|
|
|
301
301
|
}
|
|
302
302
|
);
|
|
303
303
|
}
|
|
304
|
-
function
|
|
305
|
-
return n ? /* @__PURE__ */ l(
|
|
304
|
+
function Qn({ open: n, ...e }) {
|
|
305
|
+
return n ? /* @__PURE__ */ l(Ys, { ...e }) : null;
|
|
306
306
|
}
|
|
307
|
-
function
|
|
307
|
+
function Zs(n) {
|
|
308
308
|
return typeof n == "object" && n !== null && typeof n.mount == "function";
|
|
309
309
|
}
|
|
310
|
-
function
|
|
310
|
+
function ea(n) {
|
|
311
311
|
if (typeof n != "object" || n === null)
|
|
312
312
|
return !1;
|
|
313
313
|
const e = n;
|
|
314
314
|
return typeof e.unmount == "function" && typeof e.update == "function" && (e.mountSettings === void 0 || typeof e.mountSettings == "function");
|
|
315
315
|
}
|
|
316
316
|
const Dt = "watchparty:open-media-drawer";
|
|
317
|
-
function
|
|
317
|
+
function qn(n) {
|
|
318
318
|
w("navigation", `Select Media clicked (${n})`), window.dispatchEvent(new CustomEvent(Dt));
|
|
319
319
|
}
|
|
320
320
|
class Pt extends Br {
|
|
@@ -354,21 +354,27 @@ function Jt(n) {
|
|
|
354
354
|
function Qt(n) {
|
|
355
355
|
return n.isLeader ? Jt(n) ? n.gameOverlay && !n.isFullscreen ? "room-corner" : "control-bar" : "chat-toolbar" : "none";
|
|
356
356
|
}
|
|
357
|
-
function
|
|
357
|
+
function Xn(n, e) {
|
|
358
|
+
if (e) {
|
|
359
|
+
for (const t of Object.values(n))
|
|
360
|
+
if (t.author === e && t.avatarUrl) return t.avatarUrl;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
function ta(n) {
|
|
358
364
|
return !(n.button !== 0 || n.ctrlKey || n.metaKey || n.shiftKey || n.altKey);
|
|
359
365
|
}
|
|
360
|
-
const
|
|
361
|
-
function
|
|
362
|
-
return Dr(
|
|
366
|
+
const na = Pr(null);
|
|
367
|
+
function ra() {
|
|
368
|
+
return Dr(na);
|
|
363
369
|
}
|
|
364
|
-
function
|
|
370
|
+
function sa({ src: n, title: e, onClose: t }) {
|
|
365
371
|
N(() => {
|
|
366
372
|
const i = (a) => {
|
|
367
373
|
a.key === "Escape" && (a.stopPropagation(), t());
|
|
368
374
|
};
|
|
369
375
|
return document.addEventListener("keydown", i, !0), () => document.removeEventListener("keydown", i, !0);
|
|
370
376
|
}, [t]);
|
|
371
|
-
const r =
|
|
377
|
+
const r = ra(), s = typeof document > "u" ? null : document.fullscreenElement ?? r ?? document.body;
|
|
372
378
|
return s ? mt(
|
|
373
379
|
/* @__PURE__ */ k(
|
|
374
380
|
"div",
|
|
@@ -407,11 +413,11 @@ function aa({ src: n, title: e, onClose: t }) {
|
|
|
407
413
|
s
|
|
408
414
|
) : null;
|
|
409
415
|
}
|
|
410
|
-
const Et = 240,
|
|
411
|
-
function
|
|
416
|
+
const Et = 240, aa = 320;
|
|
417
|
+
function ia({ image: n }) {
|
|
412
418
|
const [e, t] = B(!1), r = ft(n.key);
|
|
413
419
|
if (!r) return null;
|
|
414
|
-
const s = n.w > 0 && n.h > 0, i = s ? Math.min(1,
|
|
420
|
+
const s = n.w > 0 && n.h > 0, i = s ? Math.min(1, aa / n.w, Et / n.h) : 1;
|
|
415
421
|
return /* @__PURE__ */ k(be, { children: [
|
|
416
422
|
/* @__PURE__ */ l(
|
|
417
423
|
"a",
|
|
@@ -422,7 +428,7 @@ function oa({ image: n }) {
|
|
|
422
428
|
className: "block max-w-full cursor-zoom-in",
|
|
423
429
|
"data-testid": "chat-image",
|
|
424
430
|
onClick: (a) => {
|
|
425
|
-
|
|
431
|
+
ta(a) && (a.preventDefault(), t(!0));
|
|
426
432
|
},
|
|
427
433
|
children: /* @__PURE__ */ l(
|
|
428
434
|
"img",
|
|
@@ -440,7 +446,7 @@ function oa({ image: n }) {
|
|
|
440
446
|
}
|
|
441
447
|
),
|
|
442
448
|
e && /* @__PURE__ */ l(
|
|
443
|
-
|
|
449
|
+
sa,
|
|
444
450
|
{
|
|
445
451
|
src: r,
|
|
446
452
|
title: n.title,
|
|
@@ -450,16 +456,16 @@ function oa({ image: n }) {
|
|
|
450
456
|
] });
|
|
451
457
|
}
|
|
452
458
|
function Yn({ images: n }) {
|
|
453
|
-
return n?.length ? /* @__PURE__ */ l("div", { className: "flex flex-wrap gap-1 mt-1", "data-testid": "chat-images", children: n.map((e, t) => /* @__PURE__ */ l(
|
|
459
|
+
return n?.length ? /* @__PURE__ */ l("div", { className: "flex flex-wrap gap-1 mt-1", "data-testid": "chat-images", children: n.map((e, t) => /* @__PURE__ */ l(ia, { image: e }, `${e.key}-${t}`)) }) : null;
|
|
454
460
|
}
|
|
455
|
-
function
|
|
461
|
+
function oa(n, e) {
|
|
456
462
|
return n.author && e.author ? n.author === e.author : !!e.clientId && n.clientId === e.clientId;
|
|
457
463
|
}
|
|
458
464
|
function Mt(n) {
|
|
459
465
|
return new Date(n).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
460
466
|
}
|
|
461
|
-
const
|
|
462
|
-
const t = S((d) => d.me.clientId), r = S((d) => d.me.clientId ? d.roster[d.me.clientId]?.author : void 0), s =
|
|
467
|
+
const ca = Ke.memo(function({ message: e }) {
|
|
468
|
+
const t = S((d) => d.me.clientId), r = S((d) => d.me.clientId ? d.roster[d.me.clientId]?.author : void 0), s = oa(e, { clientId: t, author: r }), i = S((d) => Xn(d.roster, e.author));
|
|
463
469
|
if (e.isSystem && e.systemType === "recap")
|
|
464
470
|
return /* @__PURE__ */ l("div", { className: "px-2 py-1.5", children: /* @__PURE__ */ k("div", { className: "border-l-2 border-border-light pl-2.5 py-0.5", children: [
|
|
465
471
|
/* @__PURE__ */ k("div", { className: "text-[10px] uppercase tracking-wide text-text-muted mb-0.5", children: [
|
|
@@ -493,7 +499,7 @@ const la = Ke.memo(function({ message: e }) {
|
|
|
493
499
|
] })
|
|
494
500
|
] });
|
|
495
501
|
});
|
|
496
|
-
function
|
|
502
|
+
function la() {
|
|
497
503
|
const n = S((s) => s.chat), e = L(null), t = L(!1), r = O(() => {
|
|
498
504
|
const s = e.current;
|
|
499
505
|
if (!s) return;
|
|
@@ -517,7 +523,7 @@ function da() {
|
|
|
517
523
|
/* @__PURE__ */ l("span", { className: "text-[10px] text-text-muted whitespace-nowrap", children: new Date(s.ts).toLocaleDateString([], { weekday: "short", month: "short", day: "numeric" }) }),
|
|
518
524
|
/* @__PURE__ */ l("div", { className: "flex-1 h-px bg-border" })
|
|
519
525
|
] }),
|
|
520
|
-
/* @__PURE__ */ l(
|
|
526
|
+
/* @__PURE__ */ l(ca, { message: s })
|
|
521
527
|
] }, s.id);
|
|
522
528
|
}) })
|
|
523
529
|
}
|
|
@@ -544,12 +550,12 @@ const qt = [
|
|
|
544
550
|
scope: "local"
|
|
545
551
|
}
|
|
546
552
|
], ze = "/";
|
|
547
|
-
function
|
|
553
|
+
function da(n) {
|
|
548
554
|
if (!n.startsWith(ze)) return null;
|
|
549
555
|
const e = n.slice(ze.length);
|
|
550
556
|
return /\s/.test(e) ? null : e.toLowerCase();
|
|
551
557
|
}
|
|
552
|
-
function
|
|
558
|
+
function ua(n, e = qt) {
|
|
553
559
|
const t = n.toLowerCase();
|
|
554
560
|
if (!t) return [...e].sort((s, i) => s.name.localeCompare(i.name));
|
|
555
561
|
const r = [];
|
|
@@ -559,23 +565,23 @@ function fa(n, e = qt) {
|
|
|
559
565
|
}
|
|
560
566
|
return r.sort((s, i) => s.rank - i.rank || s.cmd.name.localeCompare(i.cmd.name)).map((s) => s.cmd);
|
|
561
567
|
}
|
|
562
|
-
function
|
|
568
|
+
function fa(n) {
|
|
563
569
|
return `${ze}${n.name} `;
|
|
564
570
|
}
|
|
565
571
|
function kt(n, e) {
|
|
566
572
|
return e <= 0 ? 0 : (n % e + e) % e;
|
|
567
573
|
}
|
|
568
|
-
function
|
|
574
|
+
function ha(n, e = qt) {
|
|
569
575
|
const t = n.trim();
|
|
570
576
|
if (!t) return null;
|
|
571
577
|
if (!t.startsWith(ze)) return { kind: "chat", text: t };
|
|
572
578
|
const r = t.slice(ze.length), s = r.search(/\s/), i = (s === -1 ? r : r.slice(0, s)).toLowerCase(), a = s === -1 ? "" : r.slice(s).trim(), d = e.find((c) => c.name.toLowerCase() === i);
|
|
573
579
|
return d ? { kind: "command", command: d, args: a } : { kind: "chat", text: t };
|
|
574
580
|
}
|
|
575
|
-
function
|
|
581
|
+
function pa(n, e) {
|
|
576
582
|
return n.requiresMedia && !e.hasMedia ? `${ze}${n.name} needs an episode loaded.` : null;
|
|
577
583
|
}
|
|
578
|
-
function
|
|
584
|
+
function ma({
|
|
579
585
|
commands: n,
|
|
580
586
|
activeIndex: e,
|
|
581
587
|
hasMedia: t,
|
|
@@ -651,7 +657,7 @@ function er() {
|
|
|
651
657
|
i.current.clear();
|
|
652
658
|
}, []);
|
|
653
659
|
const a = O((p) => {
|
|
654
|
-
|
|
660
|
+
Ps(p) && (URL.revokeObjectURL(p.previewUrl), i.current.delete(p.previewUrl));
|
|
655
661
|
}, []), d = O(async (p) => {
|
|
656
662
|
if (!p.length) return;
|
|
657
663
|
const g = [];
|
|
@@ -661,7 +667,7 @@ function er() {
|
|
|
661
667
|
s("error", b);
|
|
662
668
|
continue;
|
|
663
669
|
}
|
|
664
|
-
const { w: M, h: x } = await
|
|
670
|
+
const { w: M, h: x } = await Gs(C), F = URL.createObjectURL(C);
|
|
665
671
|
i.current.add(F), g.push({
|
|
666
672
|
kind: "file",
|
|
667
673
|
id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
@@ -696,7 +702,7 @@ function er() {
|
|
|
696
702
|
w: p.width ?? 0,
|
|
697
703
|
h: p.height ?? 0,
|
|
698
704
|
title: p.title || void 0
|
|
699
|
-
}]), jt().catalogue(
|
|
705
|
+
}]), jt().catalogue(Jn).recordUse(p.key));
|
|
700
706
|
}, [s]), o = O((p) => {
|
|
701
707
|
e((g) => {
|
|
702
708
|
const C = g.find((b) => b.id === p);
|
|
@@ -708,10 +714,10 @@ function er() {
|
|
|
708
714
|
return [];
|
|
709
715
|
});
|
|
710
716
|
}, [a]), f = O((p) => {
|
|
711
|
-
const g =
|
|
717
|
+
const g = Hs(p.clipboardData);
|
|
712
718
|
g.length && (p.preventDefault(), d(g));
|
|
713
719
|
}, [d]), h = O((p) => {
|
|
714
|
-
const g =
|
|
720
|
+
const g = js(p.dataTransfer);
|
|
715
721
|
g.length && (p.preventDefault(), d(g));
|
|
716
722
|
}, [d]), v = O((p) => {
|
|
717
723
|
p.dataTransfer?.types?.includes("Files") && p.preventDefault();
|
|
@@ -719,9 +725,9 @@ function er() {
|
|
|
719
725
|
if (!n.length) return [];
|
|
720
726
|
r(!0);
|
|
721
727
|
try {
|
|
722
|
-
return await
|
|
728
|
+
return await Vs(n);
|
|
723
729
|
} catch (p) {
|
|
724
|
-
return A("chat", "Image upload failed",
|
|
730
|
+
return A("chat", "Image upload failed", Ks(p)), s("error", Os(p)), null;
|
|
725
731
|
} finally {
|
|
726
732
|
r(!1);
|
|
727
733
|
}
|
|
@@ -739,18 +745,18 @@ function er() {
|
|
|
739
745
|
onDragOver: v
|
|
740
746
|
};
|
|
741
747
|
}
|
|
742
|
-
const bn =
|
|
743
|
-
function
|
|
744
|
-
const [e, t] = B(""), [r, s] = B(!1), [i, a] = B({ q: null, i: 0 }), [d, c] = B(!1), o = L(null), u = Or(), [f, h] = B(!1), [v, y] = B(!1), p = er(), g = S((R) => R.snapshot.mediaId), C = S((R) => R.pushToast), b = S((R) => R.setTierlistOpen), M = !!g, x =
|
|
745
|
-
() => x === null ? [] :
|
|
748
|
+
const bn = Bn, ga = $n;
|
|
749
|
+
function ba({ commands: n = qt }) {
|
|
750
|
+
const [e, t] = B(""), [r, s] = B(!1), [i, a] = B({ q: null, i: 0 }), [d, c] = B(!1), o = L(null), u = Or(), [f, h] = B(!1), [v, y] = B(!1), p = er(), g = S((R) => R.snapshot.mediaId), C = S((R) => R.pushToast), b = S((R) => R.setTierlistOpen), M = !!g, x = da(e), F = ke(
|
|
751
|
+
() => x === null ? [] : ua(x, n),
|
|
746
752
|
[x, n]
|
|
747
753
|
), I = x !== null && !d && F.length > 0, $ = i.q === x ? kt(i.i, F.length) : 0, m = O(
|
|
748
754
|
(R) => a({ q: x, i: R }),
|
|
749
755
|
[x]
|
|
750
756
|
), _ = O((R, V) => {
|
|
751
|
-
const
|
|
752
|
-
if (
|
|
753
|
-
C("info",
|
|
757
|
+
const H = pa(R, { hasMedia: M });
|
|
758
|
+
if (H) {
|
|
759
|
+
C("info", H);
|
|
754
760
|
return;
|
|
755
761
|
}
|
|
756
762
|
switch (R.name) {
|
|
@@ -767,10 +773,10 @@ function ya({ commands: n = qt }) {
|
|
|
767
773
|
C("info", `${R.usage} is not implemented yet.`);
|
|
768
774
|
}
|
|
769
775
|
}, [M, C, n, b]), T = O((R) => {
|
|
770
|
-
t(
|
|
776
|
+
t(fa(R)), c(!1), o.current?.focus();
|
|
771
777
|
}, []), G = O(async (R) => {
|
|
772
778
|
if (R.preventDefault(), r || p.uploading) return;
|
|
773
|
-
const V =
|
|
779
|
+
const V = ha(e, n);
|
|
774
780
|
if (!V && !p.pending.length) return;
|
|
775
781
|
if (V?.kind === "command" && p.pending.length) {
|
|
776
782
|
C("info", "Send images on their own, not with a command.");
|
|
@@ -780,8 +786,8 @@ function ya({ commands: n = qt }) {
|
|
|
780
786
|
_(V.command, V.args), t(""), !document.hidden && document.hasFocus() && o.current?.focus();
|
|
781
787
|
return;
|
|
782
788
|
}
|
|
783
|
-
const
|
|
784
|
-
|
|
789
|
+
const H = await p.uploadPending();
|
|
790
|
+
H !== null && (Ln(V?.text ?? "", H), t(""), p.clear(), s(!0), setTimeout(() => s(!1), ga), !document.hidden && document.hasFocus() && o.current?.focus());
|
|
785
791
|
}, [e, r, _, p, C, n]), P = O((R) => {
|
|
786
792
|
if (R.key === "Escape" && I) {
|
|
787
793
|
R.preventDefault(), c(!0);
|
|
@@ -809,7 +815,7 @@ function ya({ commands: n = qt }) {
|
|
|
809
815
|
};
|
|
810
816
|
return window.addEventListener("watchparty:focus-chat-input", R), () => window.removeEventListener("watchparty:focus-chat-input", R);
|
|
811
817
|
}, []);
|
|
812
|
-
const
|
|
818
|
+
const U = bn - e.length, X = U <= 100, ce = I ? F[$] : void 0;
|
|
813
819
|
return /* @__PURE__ */ k(
|
|
814
820
|
"form",
|
|
815
821
|
{
|
|
@@ -824,7 +830,7 @@ function ya({ commands: n = qt }) {
|
|
|
824
830
|
/* @__PURE__ */ l(Zn, { pending: p.pending, uploading: p.uploading, onRemove: p.remove }),
|
|
825
831
|
/* @__PURE__ */ k("div", { className: "relative", children: [
|
|
826
832
|
I && /* @__PURE__ */ l(
|
|
827
|
-
|
|
833
|
+
ma,
|
|
828
834
|
{
|
|
829
835
|
commands: F,
|
|
830
836
|
activeIndex: $,
|
|
@@ -835,7 +841,7 @@ function ya({ commands: n = qt }) {
|
|
|
835
841
|
}
|
|
836
842
|
),
|
|
837
843
|
/* @__PURE__ */ l(
|
|
838
|
-
|
|
844
|
+
Qn,
|
|
839
845
|
{
|
|
840
846
|
open: f,
|
|
841
847
|
onClose: () => h(!1),
|
|
@@ -867,7 +873,7 @@ function ya({ commands: n = qt }) {
|
|
|
867
873
|
className: `w-full bg-bg-card border border-border-light rounded px-3 py-1.5 text-sm focus:outline-none focus:border-text-muted ${X ? "pr-12" : ""}`
|
|
868
874
|
}
|
|
869
875
|
),
|
|
870
|
-
/* @__PURE__ */ l("span", { className: `absolute right-2 top-1/2 -translate-y-1/2 text-[10px] ${
|
|
876
|
+
/* @__PURE__ */ l("span", { className: `absolute right-2 top-1/2 -translate-y-1/2 text-[10px] ${U <= 50 ? U <= 0 ? "bg-danger-bg text-on-danger-bg px-1 rounded" : "bg-primary-bg text-on-primary-bg px-1 rounded" : "text-text-muted"}`, children: X && U })
|
|
871
877
|
] }),
|
|
872
878
|
!v && /* @__PURE__ */ l(
|
|
873
879
|
"button",
|
|
@@ -888,7 +894,7 @@ function ya({ commands: n = qt }) {
|
|
|
888
894
|
}
|
|
889
895
|
);
|
|
890
896
|
}
|
|
891
|
-
function
|
|
897
|
+
function ya() {
|
|
892
898
|
const n = S((t) => t.roster), e = Object.values(n);
|
|
893
899
|
return e.length ? /* @__PURE__ */ l("div", { className: "flex flex-col gap-1", children: e.map((t) => {
|
|
894
900
|
const r = De(t.sprite);
|
|
@@ -908,7 +914,7 @@ function va() {
|
|
|
908
914
|
] }, t.clientId);
|
|
909
915
|
}) }) : /* @__PURE__ */ l("div", { className: "text-xs text-text-muted", children: "No users online" });
|
|
910
916
|
}
|
|
911
|
-
function
|
|
917
|
+
function va() {
|
|
912
918
|
const n = S((s) => Object.keys(s.roster).length), [e, t] = B(!1), r = L(null);
|
|
913
919
|
return N(() => {
|
|
914
920
|
if (!e) return;
|
|
@@ -936,20 +942,20 @@ function Sa() {
|
|
|
936
942
|
n,
|
|
937
943
|
" online"
|
|
938
944
|
] }),
|
|
939
|
-
/* @__PURE__ */ l(
|
|
945
|
+
/* @__PURE__ */ l(ya, {})
|
|
940
946
|
] })
|
|
941
947
|
] });
|
|
942
948
|
}
|
|
943
|
-
function
|
|
949
|
+
function Sa({ leaderId: n, clientId: e, keyType: t }) {
|
|
944
950
|
return n !== null ? n === e : t === "leader";
|
|
945
951
|
}
|
|
946
|
-
const
|
|
947
|
-
function
|
|
948
|
-
return n &&
|
|
952
|
+
const wa = /-[0-9a-fA-F]{16}$/;
|
|
953
|
+
function xa(n) {
|
|
954
|
+
return n && wa.test(n) ? "leader" : null;
|
|
949
955
|
}
|
|
950
|
-
const
|
|
951
|
-
function
|
|
952
|
-
const e = n ?
|
|
956
|
+
const Ea = /\/room\/([^/]+)\/?$/;
|
|
957
|
+
function Ma(n) {
|
|
958
|
+
const e = n ? Ea.exec(n) : null;
|
|
953
959
|
if (!e) return null;
|
|
954
960
|
try {
|
|
955
961
|
return decodeURIComponent(e[1]);
|
|
@@ -957,8 +963,8 @@ function ka(n) {
|
|
|
957
963
|
return e[1];
|
|
958
964
|
}
|
|
959
965
|
}
|
|
960
|
-
function
|
|
961
|
-
return n && e?.roomKey === n ? e.type :
|
|
966
|
+
function ka(n, e) {
|
|
967
|
+
return n && e?.roomKey === n ? e.type : xa(n);
|
|
962
968
|
}
|
|
963
969
|
function Je() {
|
|
964
970
|
return S((n) => !!n.snapshot.leaderId && n.snapshot.leaderId === n.me.clientId);
|
|
@@ -968,28 +974,28 @@ function gt() {
|
|
|
968
974
|
return n ? e.find((t) => t.id === n) ?? null : null;
|
|
969
975
|
}
|
|
970
976
|
function Xt() {
|
|
971
|
-
return S((n) =>
|
|
977
|
+
return S((n) => Sa({
|
|
972
978
|
leaderId: n.snapshot.leaderId,
|
|
973
979
|
clientId: n.me.clientId,
|
|
974
|
-
keyType:
|
|
980
|
+
keyType: ka(Ma(globalThis.location?.pathname), n.roomKeyType)
|
|
975
981
|
}));
|
|
976
982
|
}
|
|
977
983
|
function tr() {
|
|
978
984
|
return S((n) => n.readiness);
|
|
979
985
|
}
|
|
980
|
-
function
|
|
986
|
+
function _a() {
|
|
981
987
|
return S((n) => n.snapshot);
|
|
982
988
|
}
|
|
983
|
-
const
|
|
989
|
+
const Aa = 3e4;
|
|
984
990
|
function nr() {
|
|
985
991
|
const n = tr(), [e, t] = B(!1);
|
|
986
992
|
return N(() => {
|
|
987
993
|
if (t(!1), n.ready) return;
|
|
988
|
-
const r = setTimeout(() => t(!0),
|
|
994
|
+
const r = setTimeout(() => t(!0), Aa);
|
|
989
995
|
return () => clearTimeout(r);
|
|
990
996
|
}, [n.mediaId, n.ready]), e;
|
|
991
997
|
}
|
|
992
|
-
function
|
|
998
|
+
function Ta({ draw: n }) {
|
|
993
999
|
const e = L(null);
|
|
994
1000
|
return N(() => {
|
|
995
1001
|
const t = e.current;
|
|
@@ -997,8 +1003,8 @@ function Ca({ draw: n }) {
|
|
|
997
1003
|
return n(t) ?? void 0;
|
|
998
1004
|
}, [n]), /* @__PURE__ */ l("div", { ref: e, "data-testid": "game-settings" });
|
|
999
1005
|
}
|
|
1000
|
-
const
|
|
1001
|
-
function
|
|
1006
|
+
const Ca = pt(() => import("./AdminPanel-x_k_Hefb.js")), Ia = pt(() => import("./PlaylistPanel-CYNImBh_.js"));
|
|
1007
|
+
function Ra() {
|
|
1002
1008
|
const n = S((h) => h.chatCollapsed), e = zt(), t = S((h) => h.sidebarTab), r = S((h) => h.setSidebarTab), s = S((h) => h.healthSnapshot?.clients.length ?? 0), i = S((h) => !!h.playlist), a = Je(), d = Xt(), c = S((h) => h.gameSettings), o = S((h) => h.snapshot.mediaId), u = gt() !== null;
|
|
1003
1009
|
if (Jt({ hasMedia: !!o, chatCollapsed: n, isFullscreen: e }))
|
|
1004
1010
|
return null;
|
|
@@ -1021,18 +1027,18 @@ function Fa() {
|
|
|
1021
1027
|
Qt({ isLeader: d, hasMedia: !!o, chatCollapsed: n, isFullscreen: e, gameOverlay: u }) === "chat-toolbar" && /* @__PURE__ */ l(
|
|
1022
1028
|
"button",
|
|
1023
1029
|
{
|
|
1024
|
-
onClick: () =>
|
|
1030
|
+
onClick: () => qn("chat toolbar"),
|
|
1025
1031
|
className: "p-1.5 rounded text-text-secondary hover:text-white hover:bg-bg-alt transition-colors cursor-pointer",
|
|
1026
1032
|
title: "Select Media",
|
|
1027
1033
|
"aria-label": "Select Media",
|
|
1028
1034
|
children: /* @__PURE__ */ l("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M7 4v16M17 4v16M3 8h4m10 0h4M3 12h18M3 16h4m10 0h4M4 4h16a1 1 0 011 1v14a1 1 0 01-1 1H4a1 1 0 01-1-1V5a1 1 0 011-1z" }) })
|
|
1029
1035
|
}
|
|
1030
1036
|
),
|
|
1031
|
-
/* @__PURE__ */ l(
|
|
1032
|
-
/* @__PURE__ */ l(
|
|
1037
|
+
/* @__PURE__ */ l($s, {}),
|
|
1038
|
+
/* @__PURE__ */ l(Bs, { onNameChange: (h) => {
|
|
1033
1039
|
h && S.getState().me.clientId && Yr(h);
|
|
1034
|
-
}, children: c ? /* @__PURE__ */ l(
|
|
1035
|
-
/* @__PURE__ */ l(
|
|
1040
|
+
}, children: c ? /* @__PURE__ */ l(Ta, { draw: c }) : null }),
|
|
1041
|
+
/* @__PURE__ */ l(va, {})
|
|
1036
1042
|
] }),
|
|
1037
1043
|
(a || i) && /* @__PURE__ */ k("div", { className: "flex border-b border-border shrink-0", children: [
|
|
1038
1044
|
/* @__PURE__ */ l(
|
|
@@ -1063,38 +1069,37 @@ function Fa() {
|
|
|
1063
1069
|
}
|
|
1064
1070
|
)
|
|
1065
1071
|
] }),
|
|
1066
|
-
f === "health" ? /* @__PURE__ */ l(Ke.Suspense, { fallback: /* @__PURE__ */ l("div", { className: "p-4 text-xs text-text-muted", children: "Loading..." }), children: /* @__PURE__ */ l(
|
|
1067
|
-
/* @__PURE__ */ l(
|
|
1068
|
-
/* @__PURE__ */ l(
|
|
1069
|
-
/* @__PURE__ */ l(ya, {})
|
|
1072
|
+
f === "health" ? /* @__PURE__ */ l(Ke.Suspense, { fallback: /* @__PURE__ */ l("div", { className: "p-4 text-xs text-text-muted", children: "Loading..." }), children: /* @__PURE__ */ l(Ca, {}) }) : f === "playlist" ? /* @__PURE__ */ l(Ke.Suspense, { fallback: /* @__PURE__ */ l("div", { className: "p-4 text-xs text-text-muted", children: "Loading..." }), children: /* @__PURE__ */ l(Ia, {}) }) : /* @__PURE__ */ k(be, { children: [
|
|
1073
|
+
/* @__PURE__ */ l(la, {}),
|
|
1074
|
+
/* @__PURE__ */ l(ba, {})
|
|
1070
1075
|
] })
|
|
1071
1076
|
] });
|
|
1072
1077
|
}
|
|
1073
|
-
const yn = (n) => typeof n == "string" &&
|
|
1074
|
-
function
|
|
1078
|
+
const yn = (n) => typeof n == "string" && Ns.includes(n);
|
|
1079
|
+
function Fa(n, e, t) {
|
|
1075
1080
|
return yn(e) ? e : yn(t) ? t : "dark";
|
|
1076
1081
|
}
|
|
1077
|
-
function
|
|
1078
|
-
if (!
|
|
1082
|
+
function Na(n, e) {
|
|
1083
|
+
if (!Zr(n)) return null;
|
|
1079
1084
|
const t = new URL(n, e);
|
|
1080
1085
|
return t.origin === e ? t.href : null;
|
|
1081
1086
|
}
|
|
1082
|
-
function
|
|
1083
|
-
const t =
|
|
1087
|
+
function La(n, e) {
|
|
1088
|
+
const t = Na(n.url, e);
|
|
1084
1089
|
return { id: n.id, name: n.name, load: t ? () => import(
|
|
1085
1090
|
/* @vite-ignore */
|
|
1086
1091
|
t
|
|
1087
1092
|
) : null };
|
|
1088
1093
|
}
|
|
1089
|
-
const
|
|
1090
|
-
function
|
|
1094
|
+
const Ue = (n) => n instanceof Error ? n.message : String(n);
|
|
1095
|
+
function $a(n) {
|
|
1091
1096
|
let e = n.ctx, t = null, r = !1, s = !1;
|
|
1092
1097
|
const i = /* @__PURE__ */ new Set(), a = (h, v) => n.onSettingsError?.(h, v), d = (h) => {
|
|
1093
1098
|
if (i.delete(h))
|
|
1094
1099
|
try {
|
|
1095
1100
|
h.cleanup();
|
|
1096
1101
|
} catch (v) {
|
|
1097
|
-
a(`the game's settings failed to close: ${
|
|
1102
|
+
a(`the game's settings failed to close: ${Ue(v)}`, v);
|
|
1098
1103
|
}
|
|
1099
1104
|
}, c = (h) => {
|
|
1100
1105
|
for (const v of [...i]) d(v);
|
|
@@ -1104,7 +1109,7 @@ function Ba(n) {
|
|
|
1104
1109
|
try {
|
|
1105
1110
|
h.unmount();
|
|
1106
1111
|
} catch (v) {
|
|
1107
|
-
s || n.onError(`unmount threw: ${
|
|
1112
|
+
s || n.onError(`unmount threw: ${Ue(v)}`, v);
|
|
1108
1113
|
}
|
|
1109
1114
|
}, u = (h, v) => {
|
|
1110
1115
|
if (s || r) return;
|
|
@@ -1116,7 +1121,7 @@ function Ba(n) {
|
|
|
1116
1121
|
try {
|
|
1117
1122
|
t.update(h);
|
|
1118
1123
|
} catch (v) {
|
|
1119
|
-
u(`the game failed to update: ${
|
|
1124
|
+
u(`the game failed to update: ${Ue(v)}`, v);
|
|
1120
1125
|
}
|
|
1121
1126
|
};
|
|
1122
1127
|
return (async () => {
|
|
@@ -1124,11 +1129,11 @@ function Ba(n) {
|
|
|
1124
1129
|
try {
|
|
1125
1130
|
h = await n.load();
|
|
1126
1131
|
} catch (p) {
|
|
1127
|
-
u(`could not load the game: ${
|
|
1132
|
+
u(`could not load the game: ${Ue(p)}`, p);
|
|
1128
1133
|
return;
|
|
1129
1134
|
}
|
|
1130
1135
|
if (r) return;
|
|
1131
|
-
if (!
|
|
1136
|
+
if (!Zs(h)) {
|
|
1132
1137
|
u("the game module does not export mount()");
|
|
1133
1138
|
return;
|
|
1134
1139
|
}
|
|
@@ -1137,10 +1142,10 @@ function Ba(n) {
|
|
|
1137
1142
|
try {
|
|
1138
1143
|
y = await h.mount(n.el, v);
|
|
1139
1144
|
} catch (p) {
|
|
1140
|
-
u(`the game failed to start: ${
|
|
1145
|
+
u(`the game failed to start: ${Ue(p)}`, p);
|
|
1141
1146
|
return;
|
|
1142
1147
|
}
|
|
1143
|
-
if (!
|
|
1148
|
+
if (!ea(y)) {
|
|
1144
1149
|
u("the game's mount() did not return { unmount, update }");
|
|
1145
1150
|
return;
|
|
1146
1151
|
}
|
|
@@ -1161,7 +1166,7 @@ function Ba(n) {
|
|
|
1161
1166
|
try {
|
|
1162
1167
|
y = v.mountSettings(h);
|
|
1163
1168
|
} catch (g) {
|
|
1164
|
-
return a(`the game's settings failed to open: ${
|
|
1169
|
+
return a(`the game's settings failed to open: ${Ue(g)}`, g), null;
|
|
1165
1170
|
}
|
|
1166
1171
|
if (typeof y != "function")
|
|
1167
1172
|
return a("the game's mountSettings() did not return a cleanup function"), null;
|
|
@@ -1171,18 +1176,18 @@ function Ba(n) {
|
|
|
1171
1176
|
};
|
|
1172
1177
|
}
|
|
1173
1178
|
function vn({ activity: n, roomKey: e, layer: t }) {
|
|
1174
|
-
const r = L(null), s = L(null), [i, a] = B(null), [d, c] = B(!1), o = S((x) => x.snapshot.leaderId), u = S((x) => x.me.clientId), f = !!o && o === u, h = S((x) => x.name), v =
|
|
1179
|
+
const r = L(null), s = L(null), [i, a] = B(null), [d, c] = B(!1), o = S((x) => x.snapshot.leaderId), u = S((x) => x.me.clientId), f = !!o && o === u, h = S((x) => x.name), v = Ls()?.theme, y = Fa(void 0, v, es().theme), p = ke(() => ({
|
|
1175
1180
|
roomKey: e,
|
|
1176
1181
|
identity: {
|
|
1177
1182
|
// The registry userId — what RoomChrome's `userId` prop is.
|
|
1178
|
-
userId:
|
|
1179
|
-
userType:
|
|
1183
|
+
userId: ns(),
|
|
1184
|
+
userType: ts(),
|
|
1180
1185
|
name: h || null
|
|
1181
1186
|
},
|
|
1182
1187
|
theme: y,
|
|
1183
1188
|
isLeader: f,
|
|
1184
1189
|
close: () => {
|
|
1185
|
-
w("game", "bundle close", { gameId: n.id, isLeader: f, layer: t }), t !== "base" && (f ?
|
|
1190
|
+
w("game", "bundle close", { gameId: n.id, isLeader: f, layer: t }), t !== "base" && (f ? Dn(null) : c(!0));
|
|
1186
1191
|
}
|
|
1187
1192
|
}), [e, h, y, f, n.id, t]), g = dt(() => p), C = dt((x, F) => {
|
|
1188
1193
|
A("game", "bundle failed", { gameId: n.id, message: x, cause: String(F) }), a(x);
|
|
@@ -1193,7 +1198,7 @@ function vn({ activity: n, roomKey: e, layer: t }) {
|
|
|
1193
1198
|
const x = r.current, F = n.load;
|
|
1194
1199
|
if (!x || !F || d) return;
|
|
1195
1200
|
w("game", "bundle mount", { gameId: n.id });
|
|
1196
|
-
const { setGameSettings: I } = S.getState(), $ = (_) => m.mountSettings(_), m =
|
|
1201
|
+
const { setGameSettings: I } = S.getState(), $ = (_) => m.mountSettings(_), m = $a({
|
|
1197
1202
|
load: F,
|
|
1198
1203
|
el: x,
|
|
1199
1204
|
ctx: g(),
|
|
@@ -1231,8 +1236,8 @@ function vn({ activity: n, roomKey: e, layer: t }) {
|
|
|
1231
1236
|
}
|
|
1232
1237
|
);
|
|
1233
1238
|
}
|
|
1234
|
-
const
|
|
1235
|
-
function
|
|
1239
|
+
const Ba = "drawer-btn";
|
|
1240
|
+
function Da({ open: n, onClose: e, header: t, footer: r, children: s }) {
|
|
1236
1241
|
return N(() => {
|
|
1237
1242
|
if (!n) return;
|
|
1238
1243
|
function i(a) {
|
|
@@ -1246,7 +1251,7 @@ function Pa({ open: n, onClose: e, header: t, footer: r, children: s }) {
|
|
|
1246
1251
|
onClick: (i) => i.stopPropagation(),
|
|
1247
1252
|
children: [
|
|
1248
1253
|
/* @__PURE__ */ k("div", { className: "p-3 border-b border-border flex items-center gap-2 text-sm", children: [
|
|
1249
|
-
/* @__PURE__ */ l("button", { onClick: e, className:
|
|
1254
|
+
/* @__PURE__ */ l("button", { onClick: e, className: Ba, children: "Close" }),
|
|
1250
1255
|
t
|
|
1251
1256
|
] }),
|
|
1252
1257
|
s,
|
|
@@ -1255,10 +1260,10 @@ function Pa({ open: n, onClose: e, header: t, footer: r, children: s }) {
|
|
|
1255
1260
|
}
|
|
1256
1261
|
) }) : null;
|
|
1257
1262
|
}
|
|
1258
|
-
function
|
|
1259
|
-
return /* @__PURE__ */ l(
|
|
1263
|
+
function Pa({ open: n, onClose: e }) {
|
|
1264
|
+
return /* @__PURE__ */ l(Da, { open: n, onClose: e, children: /* @__PURE__ */ l("div", { className: "px-4 py-3 text-xs text-text-muted", children: "Loading…" }) });
|
|
1260
1265
|
}
|
|
1261
|
-
const rr = 9e3, Sn = 1500,
|
|
1266
|
+
const rr = 9e3, Sn = 1500, Oa = {
|
|
1262
1267
|
classic: "[text-shadow:_-1px_-1px_0_#000,_1px_-1px_0_#000,_-1px_1px_0_#000,_1px_1px_0_#000,_0_-1px_0_#000,_0_1px_0_#000,_-1px_0_0_#000,_1px_0_0_#000]",
|
|
1263
1268
|
cinema: "drop-shadow-[0_2px_4px_rgba(0,0,0,0.9)]",
|
|
1264
1269
|
minimal: "drop-shadow-[0_2px_4px_rgba(0,0,0,0.9)] drop-shadow-[0_0_8px_rgba(0,0,0,0.7)]",
|
|
@@ -1268,7 +1273,7 @@ function Ua({ message: n, age: e, ccStyle: t }) {
|
|
|
1268
1273
|
const r = rr - Sn;
|
|
1269
1274
|
let s = 1;
|
|
1270
1275
|
e > r && (s = Math.max(0, 1 - (e - r) / Sn));
|
|
1271
|
-
const i =
|
|
1276
|
+
const i = Oa[t], a = De(n.sprite), d = S((c) => Xn(c.roster, n.author));
|
|
1272
1277
|
return /* @__PURE__ */ k(
|
|
1273
1278
|
"div",
|
|
1274
1279
|
{
|
|
@@ -1293,7 +1298,7 @@ function Ua({ message: n, age: e, ccStyle: t }) {
|
|
|
1293
1298
|
}
|
|
1294
1299
|
);
|
|
1295
1300
|
}
|
|
1296
|
-
function
|
|
1301
|
+
function Ha() {
|
|
1297
1302
|
const n = S((f) => f.chat), e = S((f) => f.chatCollapsed), t = S((f) => f.floatingChatEnabled), r = S((f) => f.mediaPrefs.subtitleStyle), [s, i] = B(!1), [a, d] = B(Date.now());
|
|
1298
1303
|
N(() => {
|
|
1299
1304
|
const f = () => {
|
|
@@ -1329,18 +1334,18 @@ function ja() {
|
|
|
1329
1334
|
}
|
|
1330
1335
|
);
|
|
1331
1336
|
}
|
|
1332
|
-
const
|
|
1337
|
+
const ja = 2;
|
|
1333
1338
|
function sr(n) {
|
|
1334
1339
|
return n.duration_ms > 0 && n.duration_ms - n.playhead_ms <= Wt;
|
|
1335
1340
|
}
|
|
1336
1341
|
function ar(n) {
|
|
1337
1342
|
const e = n.video_ready_state ?? -1;
|
|
1338
|
-
return e < 0 ? !0 : !(e <=
|
|
1343
|
+
return e < 0 ? !0 : !(e <= ja && n.buffered_ahead_ms > Wt);
|
|
1339
1344
|
}
|
|
1340
|
-
function
|
|
1341
|
-
return n.playhead_ms === 0 && !n.is_buffering && n.buffered_ahead_ms === 0 ? "idle" : n.is_buffering ? "buffering" : sr(n) ? "healthy" : !ar(n) || n.buffered_ahead_ms <=
|
|
1345
|
+
function tc(n) {
|
|
1346
|
+
return n.playhead_ms === 0 && !n.is_buffering && n.buffered_ahead_ms === 0 ? "idle" : n.is_buffering ? "buffering" : sr(n) ? "healthy" : !ar(n) || n.buffered_ahead_ms <= Pn ? "critical" : n.buffered_ahead_ms <= Wt ? "warning" : "healthy";
|
|
1342
1347
|
}
|
|
1343
|
-
const
|
|
1348
|
+
const nc = {
|
|
1344
1349
|
idle: "Idle",
|
|
1345
1350
|
buffering: "Buffering",
|
|
1346
1351
|
critical: "Critical",
|
|
@@ -1390,14 +1395,14 @@ function ur() {
|
|
|
1390
1395
|
function fr() {
|
|
1391
1396
|
_t(587, 1174, 3, 320, 0.12, 0), _t(880, 1760, 3, 320, 0.12, 0.06), _t(884, 1768, 3, 320, 0.08, 0.06);
|
|
1392
1397
|
}
|
|
1393
|
-
|
|
1398
|
+
On("__WP_SOUNDS__", {
|
|
1394
1399
|
start: lr,
|
|
1395
1400
|
finish: fr,
|
|
1396
1401
|
on: dr,
|
|
1397
1402
|
off: ur
|
|
1398
1403
|
});
|
|
1399
1404
|
const wn = { on: 0, off: 0 };
|
|
1400
|
-
function
|
|
1405
|
+
function Ga(n, e, t, r) {
|
|
1401
1406
|
if (!t || !r) return wn;
|
|
1402
1407
|
const s = new Set(n), i = new Set(e);
|
|
1403
1408
|
let a = 0;
|
|
@@ -1406,15 +1411,15 @@ function Wa(n, e, t, r) {
|
|
|
1406
1411
|
for (const c of s) i.has(c) || d++;
|
|
1407
1412
|
return a === 0 && d === 0 ? wn : { on: a, off: d };
|
|
1408
1413
|
}
|
|
1409
|
-
const
|
|
1410
|
-
function
|
|
1414
|
+
const Wa = 1200, he = 52, ht = 4, Ot = (he - ht) / 2, xn = 2 * Math.PI * Ot, Te = he - ht * 2 - 4;
|
|
1415
|
+
function Va(n) {
|
|
1411
1416
|
return sr(n) ? !0 : ar(n) ? n.buffered_ahead_ms >= Me : !1;
|
|
1412
1417
|
}
|
|
1413
|
-
function
|
|
1418
|
+
function Ka(n) {
|
|
1414
1419
|
return `hsl(${Math.round(n * 120)}, 90%, 55%)`;
|
|
1415
1420
|
}
|
|
1416
|
-
function
|
|
1417
|
-
const r = Math.min(1, n.buffered_ahead_ms / Me), s = xn * (1 - r), i =
|
|
1421
|
+
function za({ client: n, fading: e, onFadeEnd: t }) {
|
|
1422
|
+
const r = Math.min(1, n.buffered_ahead_ms / Me), s = xn * (1 - r), i = Ka(r), a = De(n.sprite_id);
|
|
1418
1423
|
return /* @__PURE__ */ k(
|
|
1419
1424
|
"div",
|
|
1420
1425
|
{
|
|
@@ -1422,7 +1427,7 @@ function Ja({ client: n, fading: e, onFadeEnd: t }) {
|
|
|
1422
1427
|
"data-client-id": n.client_id,
|
|
1423
1428
|
className: "flex flex-col items-center gap-1",
|
|
1424
1429
|
style: e ? {
|
|
1425
|
-
animation: `bufferFadeOut ${
|
|
1430
|
+
animation: `bufferFadeOut ${Wa}ms ease forwards`
|
|
1426
1431
|
} : void 0,
|
|
1427
1432
|
onAnimationEnd: e ? t : void 0,
|
|
1428
1433
|
children: [
|
|
@@ -1500,7 +1505,7 @@ function Ja({ client: n, fading: e, onFadeEnd: t }) {
|
|
|
1500
1505
|
}
|
|
1501
1506
|
);
|
|
1502
1507
|
}
|
|
1503
|
-
function
|
|
1508
|
+
function Ja({ clientId: n, sprite: e, name: t, isReady: r, isSelf: s, onToggle: i }) {
|
|
1504
1509
|
const a = De(e || ""), d = r ? "rgba(34,197,94,0.92)" : "rgba(120,120,120,0.85)", c = r ? /* @__PURE__ */ l(at, { name: "tick" }) : /* @__PURE__ */ l(at, { name: "hourglass" });
|
|
1505
1510
|
return /* @__PURE__ */ k(
|
|
1506
1511
|
"button",
|
|
@@ -1571,7 +1576,7 @@ function Qa({ clientId: n, sprite: e, name: t, isReady: r, isSelf: s, onToggle:
|
|
|
1571
1576
|
}
|
|
1572
1577
|
);
|
|
1573
1578
|
}
|
|
1574
|
-
function
|
|
1579
|
+
function Qa() {
|
|
1575
1580
|
const n = S((I) => I.bufferStatus), e = S((I) => I.readyCheck), t = S((I) => I.roster), r = S((I) => I.me.clientId), s = S((I) => I.snapshot.playing), i = Je(), [a, d] = B([]), c = L(/* @__PURE__ */ new Map()), o = L(/* @__PURE__ */ new Set());
|
|
1576
1581
|
N(() => {
|
|
1577
1582
|
if (!n || n.clients.length === 0) {
|
|
@@ -1580,7 +1585,7 @@ function qa() {
|
|
|
1580
1585
|
}
|
|
1581
1586
|
const I = Date.now(), $ = [];
|
|
1582
1587
|
for (const m of n.clients) {
|
|
1583
|
-
const _ =
|
|
1588
|
+
const _ = Va(m), T = c.current.get(m.client_id) ?? null, G = o.current.has(m.client_id);
|
|
1584
1589
|
_ ? G && T === null ? (c.current.set(m.client_id, I), $.push({ client: m, completedAt: I })) : T !== null && $.push({ client: m, completedAt: T }) : (T !== null && c.current.delete(m.client_id), o.current.add(m.client_id), $.push({ client: m, completedAt: null }));
|
|
1585
1590
|
}
|
|
1586
1591
|
d($);
|
|
@@ -1595,7 +1600,7 @@ function qa() {
|
|
|
1595
1600
|
}, [y]);
|
|
1596
1601
|
const C = L(e.ready), b = L(e.active);
|
|
1597
1602
|
N(() => {
|
|
1598
|
-
const { on: I, off: $ } =
|
|
1603
|
+
const { on: I, off: $ } = Ga(
|
|
1599
1604
|
C.current,
|
|
1600
1605
|
e.ready,
|
|
1601
1606
|
b.current,
|
|
@@ -1634,20 +1639,20 @@ function qa() {
|
|
|
1634
1639
|
}
|
|
1635
1640
|
),
|
|
1636
1641
|
/* @__PURE__ */ l("div", { className: "flex flex-col gap-3", children: h.map((I) => /* @__PURE__ */ l(
|
|
1637
|
-
|
|
1642
|
+
Ja,
|
|
1638
1643
|
{
|
|
1639
1644
|
clientId: I.clientId,
|
|
1640
1645
|
sprite: I.sprite,
|
|
1641
1646
|
name: I.name || "Anon",
|
|
1642
1647
|
isReady: f.has(I.clientId),
|
|
1643
1648
|
isSelf: I.clientId === r,
|
|
1644
|
-
onToggle: () =>
|
|
1649
|
+
onToggle: () => rs(!v)
|
|
1645
1650
|
},
|
|
1646
1651
|
I.clientId
|
|
1647
1652
|
)) })
|
|
1648
1653
|
] }),
|
|
1649
1654
|
x && a.map(({ client: I, completedAt: $ }) => /* @__PURE__ */ l(
|
|
1650
|
-
|
|
1655
|
+
za,
|
|
1651
1656
|
{
|
|
1652
1657
|
client: I,
|
|
1653
1658
|
fading: $ !== null,
|
|
@@ -1660,7 +1665,7 @@ function qa() {
|
|
|
1660
1665
|
{
|
|
1661
1666
|
type: "button",
|
|
1662
1667
|
"data-testid": "start-ready-check",
|
|
1663
|
-
onClick: () =>
|
|
1668
|
+
onClick: () => ss(),
|
|
1664
1669
|
className: "px-2.5 py-1 rounded bg-black/55 text-xs font-semibold tracking-wide hover:bg-black/75 transition-colors",
|
|
1665
1670
|
style: { color: "#fff", pointerEvents: "auto" },
|
|
1666
1671
|
title: "Ask everyone if they're ready",
|
|
@@ -1672,7 +1677,7 @@ function qa() {
|
|
|
1672
1677
|
)
|
|
1673
1678
|
] });
|
|
1674
1679
|
}
|
|
1675
|
-
const
|
|
1680
|
+
const Ut = {
|
|
1676
1681
|
S: "var(--color-tier-s)",
|
|
1677
1682
|
A: "var(--color-tier-a)",
|
|
1678
1683
|
B: "var(--color-tier-b)",
|
|
@@ -1730,7 +1735,7 @@ function En({
|
|
|
1730
1735
|
}
|
|
1731
1736
|
);
|
|
1732
1737
|
}
|
|
1733
|
-
function
|
|
1738
|
+
function qa({
|
|
1734
1739
|
anchor: n,
|
|
1735
1740
|
itemId: e,
|
|
1736
1741
|
snap: t
|
|
@@ -1773,7 +1778,7 @@ function Xa({
|
|
|
1773
1778
|
"span",
|
|
1774
1779
|
{
|
|
1775
1780
|
className: "w-5 h-4 grid place-items-center rounded text-[10px] font-bold shrink-0",
|
|
1776
|
-
style: { background:
|
|
1781
|
+
style: { background: Ut[o], color: "var(--color-tier-ink)" },
|
|
1777
1782
|
children: o
|
|
1778
1783
|
}
|
|
1779
1784
|
)
|
|
@@ -1785,7 +1790,7 @@ function Xa({
|
|
|
1785
1790
|
document.body
|
|
1786
1791
|
);
|
|
1787
1792
|
}
|
|
1788
|
-
function
|
|
1793
|
+
function Xa() {
|
|
1789
1794
|
const n = S((m) => m.tierlistOpen), e = S((m) => m.setTierlistOpen), t = S((m) => m.tierlist), r = S((m) => m.tierlistDraft), s = S((m) => m.tierlistSaving), i = S((m) => m.moveTierlistItem), [a, d] = B(null), [c, o] = B(null), [u, f] = B(null), [h, v] = B(null), [y, p] = B("mine");
|
|
1790
1795
|
N(() => {
|
|
1791
1796
|
dn(!0);
|
|
@@ -1808,10 +1813,10 @@ function Ya() {
|
|
|
1808
1813
|
for (const T of g.values()) _.has(T.id) || m[Le].push(T);
|
|
1809
1814
|
return m;
|
|
1810
1815
|
}, [r, g]), b = (m, _, T) => {
|
|
1811
|
-
const G = [...m.querySelectorAll("article[data-item-id]")].filter((
|
|
1816
|
+
const G = [...m.querySelectorAll("article[data-item-id]")].filter((U) => U.dataset.itemId !== T);
|
|
1812
1817
|
let P = 0;
|
|
1813
|
-
for (const
|
|
1814
|
-
const X =
|
|
1818
|
+
for (const U of G) {
|
|
1819
|
+
const X = U.getBoundingClientRect();
|
|
1815
1820
|
_ > X.left + X.width / 2 && P++;
|
|
1816
1821
|
}
|
|
1817
1822
|
return P;
|
|
@@ -1829,7 +1834,7 @@ function Ya() {
|
|
|
1829
1834
|
a && (i(a, m === Le ? null : m), d(null));
|
|
1830
1835
|
}
|
|
1831
1836
|
}), x = O(async () => {
|
|
1832
|
-
await
|
|
1837
|
+
await as(S.getState().tierlistDraft) && v(Date.now());
|
|
1833
1838
|
}, []);
|
|
1834
1839
|
if (N(() => {
|
|
1835
1840
|
if (h === null) return;
|
|
@@ -1881,7 +1886,7 @@ function Ya() {
|
|
|
1881
1886
|
"div",
|
|
1882
1887
|
{
|
|
1883
1888
|
className: "grid place-items-center select-none cursor-pointer",
|
|
1884
|
-
style: { background:
|
|
1889
|
+
style: { background: Ut[m], color: "var(--color-tier-ink)" },
|
|
1885
1890
|
onClick: () => {
|
|
1886
1891
|
a && (i(a, m), d(null));
|
|
1887
1892
|
},
|
|
@@ -1934,7 +1939,7 @@ function Ya() {
|
|
|
1934
1939
|
"div",
|
|
1935
1940
|
{
|
|
1936
1941
|
className: "grid place-items-center select-none",
|
|
1937
|
-
style: { background:
|
|
1942
|
+
style: { background: Ut[m], color: "var(--color-tier-ink)" },
|
|
1938
1943
|
children: /* @__PURE__ */ l("span", { className: "text-2xl font-bold leading-none", children: m })
|
|
1939
1944
|
}
|
|
1940
1945
|
),
|
|
@@ -1948,7 +1953,7 @@ function Ya() {
|
|
|
1948
1953
|
onMouseLeave: () => f(null),
|
|
1949
1954
|
onFocus: (P) => f({ anchor: P.currentTarget.getBoundingClientRect(), itemId: T.mediaId }),
|
|
1950
1955
|
onBlur: () => f(null),
|
|
1951
|
-
"aria-label": `${G?.displayName ?? T.mediaId} — score ${T.score.toFixed(2)}. ${Object.entries(T.votes).map(([P,
|
|
1956
|
+
"aria-label": `${G?.displayName ?? T.mediaId} — score ${T.score.toFixed(2)}. ${Object.entries(T.votes).map(([P, U]) => `${t.names[P] ?? "viewer"} ${U}`).join(", ")}`,
|
|
1952
1957
|
className: "w-[124px] shrink-0 rounded-md overflow-hidden bg-bg-alt border border-border hover:border-primary transition-colors",
|
|
1953
1958
|
children: [
|
|
1954
1959
|
/* @__PURE__ */ l(
|
|
@@ -1984,96 +1989,96 @@ function Ya() {
|
|
|
1984
1989
|
]
|
|
1985
1990
|
}
|
|
1986
1991
|
),
|
|
1987
|
-
u && t && /* @__PURE__ */ l(
|
|
1992
|
+
u && t && /* @__PURE__ */ l(qa, { anchor: u.anchor, itemId: u.itemId, snap: t })
|
|
1988
1993
|
]
|
|
1989
1994
|
}
|
|
1990
1995
|
),
|
|
1991
1996
|
document.body
|
|
1992
1997
|
);
|
|
1993
1998
|
}
|
|
1994
|
-
function
|
|
1999
|
+
function Ya({ children: n }) {
|
|
1995
2000
|
const [e, t] = B(null);
|
|
1996
2001
|
return N(() => {
|
|
1997
2002
|
const r = () => t(document.fullscreenElement);
|
|
1998
2003
|
return r(), document.addEventListener("fullscreenchange", r), () => document.removeEventListener("fullscreenchange", r);
|
|
1999
2004
|
}, []), e ? mt(n, e) : /* @__PURE__ */ l(be, { children: n });
|
|
2000
2005
|
}
|
|
2001
|
-
function
|
|
2006
|
+
function rc({ className: n = "w-5 h-5" }) {
|
|
2002
2007
|
return /* @__PURE__ */ l("svg", { className: n, fill: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ l("path", { d: "M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z" }) });
|
|
2003
2008
|
}
|
|
2004
|
-
function
|
|
2009
|
+
function Za({ className: n = "w-5 h-5" }) {
|
|
2005
2010
|
return /* @__PURE__ */ l("svg", { className: n, viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ l("path", { d: "M8 5v14l11-7z" }) });
|
|
2006
2011
|
}
|
|
2007
|
-
function
|
|
2012
|
+
function ei({ className: n = "w-5 h-5" }) {
|
|
2008
2013
|
return /* @__PURE__ */ l("svg", { className: n, viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ l("path", { d: "M6 19h4V5H6v14zm8-14v14h4V5h-4z" }) });
|
|
2009
2014
|
}
|
|
2010
|
-
function
|
|
2015
|
+
function ti({ className: n = "w-5 h-5" }) {
|
|
2011
2016
|
return /* @__PURE__ */ k("svg", { className: n, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
|
|
2012
2017
|
/* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z" }),
|
|
2013
2018
|
/* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M17 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2" })
|
|
2014
2019
|
] });
|
|
2015
2020
|
}
|
|
2016
|
-
function
|
|
2021
|
+
function ni({ className: n = "w-5 h-5" }) {
|
|
2017
2022
|
return /* @__PURE__ */ k("svg", { className: n, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
|
|
2018
2023
|
/* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z" }),
|
|
2019
2024
|
/* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15.536 8.464a5 5 0 010 7.072" })
|
|
2020
2025
|
] });
|
|
2021
2026
|
}
|
|
2022
|
-
function
|
|
2027
|
+
function ri({ className: n = "w-5 h-5" }) {
|
|
2023
2028
|
return /* @__PURE__ */ k("svg", { className: n, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
|
|
2024
2029
|
/* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z" }),
|
|
2025
2030
|
/* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15.536 8.464a5 5 0 010 7.072M18.364 5.636a9 9 0 010 12.728" })
|
|
2026
2031
|
] });
|
|
2027
2032
|
}
|
|
2028
|
-
function
|
|
2033
|
+
function si({ className: n = "w-5 h-5" }) {
|
|
2029
2034
|
return /* @__PURE__ */ l("svg", { className: n, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4" }) });
|
|
2030
2035
|
}
|
|
2031
|
-
function
|
|
2036
|
+
function ai({ className: n = "w-5 h-5" }) {
|
|
2032
2037
|
return /* @__PURE__ */ l("svg", { className: n, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 9V4H4m0 0l5 5M9 15v5H4m0 0l5-5M15 9V4h5m0 0l-5 5M15 15v5h5m0 0l-5-5" }) });
|
|
2033
2038
|
}
|
|
2034
|
-
function
|
|
2039
|
+
function ii({ className: n = "w-5 h-5" }) {
|
|
2035
2040
|
return /* @__PURE__ */ l("svg", { className: n, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.5, children: /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15 19l-7-7 7-7" }) });
|
|
2036
2041
|
}
|
|
2037
|
-
function
|
|
2042
|
+
function oi({ className: n = "w-5 h-5" }) {
|
|
2038
2043
|
return /* @__PURE__ */ l("svg", { className: n, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.5, children: /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 5l7 7-7 7" }) });
|
|
2039
2044
|
}
|
|
2040
|
-
function
|
|
2045
|
+
function ci({ className: n = "w-4 h-4" }) {
|
|
2041
2046
|
return /* @__PURE__ */ k("svg", { className: n, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
|
|
2042
2047
|
/* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 4v16" }),
|
|
2043
2048
|
/* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15 12l-5 4v-8l5 4z" })
|
|
2044
2049
|
] });
|
|
2045
2050
|
}
|
|
2046
|
-
function
|
|
2051
|
+
function li({ className: n = "w-4 h-4" }) {
|
|
2047
2052
|
return /* @__PURE__ */ k("svg", { className: n, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
|
|
2048
2053
|
/* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M20 4v16" }),
|
|
2049
2054
|
/* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 12l5 4v-8l-5 4z" })
|
|
2050
2055
|
] });
|
|
2051
2056
|
}
|
|
2052
|
-
function
|
|
2057
|
+
function di({ className: n = "w-5 h-5" }) {
|
|
2053
2058
|
return /* @__PURE__ */ l("svg", { className: n, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 6l12 12M18 6L6 18" }) });
|
|
2054
2059
|
}
|
|
2055
|
-
function
|
|
2060
|
+
function ui({ className: n = "w-5 h-5" }) {
|
|
2056
2061
|
return /* @__PURE__ */ k("svg", { className: n, viewBox: "0 0 24 24", fill: "currentColor", children: [
|
|
2057
2062
|
/* @__PURE__ */ l("path", { d: "M12 5l8 11H4z" }),
|
|
2058
2063
|
/* @__PURE__ */ l("rect", { x: "4", y: "17", width: "16", height: "3", rx: "0.5" })
|
|
2059
2064
|
] });
|
|
2060
2065
|
}
|
|
2061
|
-
function
|
|
2066
|
+
function fi({ className: n = "w-5 h-5" }) {
|
|
2062
2067
|
return /* @__PURE__ */ l("svg", { className: n, fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M7 4v16M17 4v16M3 8h4m10 0h4M3 12h18M3 16h4m10 0h4M4 4h16a1 1 0 011 1v14a1 1 0 01-1 1H4a1 1 0 01-1-1V5a1 1 0 011-1z" }) });
|
|
2063
2068
|
}
|
|
2064
2069
|
function pr({ site: n = "control bar", className: e = "ctr-btn" }) {
|
|
2065
2070
|
return /* @__PURE__ */ l(
|
|
2066
2071
|
"button",
|
|
2067
2072
|
{
|
|
2068
|
-
onClick: () =>
|
|
2073
|
+
onClick: () => qn(n),
|
|
2069
2074
|
className: e,
|
|
2070
2075
|
title: "Select Media",
|
|
2071
2076
|
"aria-label": "Select Media",
|
|
2072
|
-
children: /* @__PURE__ */ l(
|
|
2077
|
+
children: /* @__PURE__ */ l(fi, {})
|
|
2073
2078
|
}
|
|
2074
2079
|
);
|
|
2075
2080
|
}
|
|
2076
|
-
function
|
|
2081
|
+
function hi() {
|
|
2077
2082
|
const n = S((h) => h.chatCollapsed), e = S((h) => h.toggleChatCollapsed), t = S((h) => !!h.snapshot.mediaId), r = zt(), s = gt(), i = Je(), a = Xt(), d = Qt({
|
|
2078
2083
|
isLeader: a,
|
|
2079
2084
|
hasMedia: t,
|
|
@@ -2084,8 +2089,8 @@ function pi() {
|
|
|
2084
2089
|
return !d && !c && !t ? null : /* @__PURE__ */ k("div", { className: "absolute top-2 right-2 z-40 flex items-center gap-2", "data-testid": "room-corner-controls", children: [
|
|
2085
2090
|
d && /* @__PURE__ */ l(pr, { site: "room corner", className: "corner-btn" }),
|
|
2086
2091
|
c && /* @__PURE__ */ l("button", { type: "button", onClick: () => {
|
|
2087
|
-
w("game", "game_select", { gameId: null, source: "room corner" }),
|
|
2088
|
-
}, className: "corner-btn", title: "Stop game", "aria-label": "Stop game", children: /* @__PURE__ */ l(
|
|
2092
|
+
w("game", "game_select", { gameId: null, source: "room corner" }), Dn(null);
|
|
2093
|
+
}, className: "corner-btn", title: "Stop game", "aria-label": "Stop game", children: /* @__PURE__ */ l(di, {}) }),
|
|
2089
2094
|
t && /* @__PURE__ */ l(
|
|
2090
2095
|
"button",
|
|
2091
2096
|
{
|
|
@@ -2103,22 +2108,22 @@ function pi() {
|
|
|
2103
2108
|
title: o ? "Show chat" : "Hide chat",
|
|
2104
2109
|
"aria-label": o ? "Show chat" : "Hide chat",
|
|
2105
2110
|
"aria-expanded": !o,
|
|
2106
|
-
children: o ? /* @__PURE__ */ l(
|
|
2111
|
+
children: o ? /* @__PURE__ */ l(li, { className: "w-5 h-5" }) : /* @__PURE__ */ l(ci, { className: "w-5 h-5" })
|
|
2107
2112
|
}
|
|
2108
2113
|
)
|
|
2109
2114
|
] });
|
|
2110
2115
|
}
|
|
2111
|
-
function
|
|
2112
|
-
N(() =>
|
|
2113
|
-
const e =
|
|
2114
|
-
w("avatar", "Avatar changed in the settings popout", { sprite: e, source: n.avatar?.source }),
|
|
2116
|
+
function pi() {
|
|
2117
|
+
N(() => is((n) => {
|
|
2118
|
+
const e = os(n);
|
|
2119
|
+
w("avatar", "Avatar changed in the settings popout", { sprite: e, source: n.avatar?.source }), Hn(e);
|
|
2115
2120
|
}), []);
|
|
2116
2121
|
}
|
|
2117
2122
|
const mr = [];
|
|
2118
2123
|
function Mn(n) {
|
|
2119
2124
|
mr.push(n);
|
|
2120
2125
|
}
|
|
2121
|
-
function
|
|
2126
|
+
function He() {
|
|
2122
2127
|
const n = mr.splice(0);
|
|
2123
2128
|
for (const e of n)
|
|
2124
2129
|
try {
|
|
@@ -2128,32 +2133,32 @@ function Ue() {
|
|
|
2128
2133
|
}
|
|
2129
2134
|
}
|
|
2130
2135
|
let At = !1;
|
|
2131
|
-
function
|
|
2136
|
+
function mi() {
|
|
2132
2137
|
return At ? () => {
|
|
2133
|
-
} : (At = !0, document.addEventListener("click",
|
|
2134
|
-
document.removeEventListener("click",
|
|
2138
|
+
} : (At = !0, document.addEventListener("click", He, { capture: !0, passive: !0 }), document.addEventListener("touchend", He, { capture: !0, passive: !0 }), document.addEventListener("keydown", He, { capture: !0, passive: !0 }), () => {
|
|
2139
|
+
document.removeEventListener("click", He, { capture: !0 }), document.removeEventListener("touchend", He, { capture: !0 }), document.removeEventListener("keydown", He, { capture: !0 }), At = !1;
|
|
2135
2140
|
});
|
|
2136
2141
|
}
|
|
2137
|
-
const
|
|
2138
|
-
function
|
|
2142
|
+
const gi = 400;
|
|
2143
|
+
function bi(n) {
|
|
2139
2144
|
return n === "leader" || n === "viewer" ? n : null;
|
|
2140
2145
|
}
|
|
2141
|
-
async function
|
|
2142
|
-
const e =
|
|
2146
|
+
async function yi(n) {
|
|
2147
|
+
const e = cs(), t = await fetch(`${e}/api/rooms/validate/${encodeURIComponent(n)}`);
|
|
2143
2148
|
if (t.status === 404) return null;
|
|
2144
2149
|
if (!t.ok) throw new Error(`validate returned ${t.status}`);
|
|
2145
2150
|
const r = await t.json();
|
|
2146
|
-
return
|
|
2151
|
+
return bi(r?.type);
|
|
2147
2152
|
}
|
|
2148
|
-
async function
|
|
2153
|
+
async function vi(n) {
|
|
2149
2154
|
for (let e = 0; e < 2; e++)
|
|
2150
2155
|
try {
|
|
2151
|
-
const t = await
|
|
2156
|
+
const t = await yi(n);
|
|
2152
2157
|
S.getState().setRoomKeyType({ roomKey: n, type: t }), w("room", "Room key type probed", { roomKey: n, type: t });
|
|
2153
2158
|
return;
|
|
2154
2159
|
} catch (t) {
|
|
2155
2160
|
if (e === 0) {
|
|
2156
|
-
await new Promise((r) => setTimeout(r,
|
|
2161
|
+
await new Promise((r) => setTimeout(r, gi));
|
|
2157
2162
|
continue;
|
|
2158
2163
|
}
|
|
2159
2164
|
A("room", "Room key type probe failed, falling back to socket truth", Se(t));
|
|
@@ -2161,16 +2166,16 @@ async function Si(n) {
|
|
|
2161
2166
|
}
|
|
2162
2167
|
function Ce(n, e) {
|
|
2163
2168
|
const r = S.getState().allocateClientSeq(), s = { kind: n, client_seq: r, ...e || {} };
|
|
2164
|
-
return
|
|
2169
|
+
return jn().emit(Gn.CONTROL, s), r;
|
|
2165
2170
|
}
|
|
2166
|
-
function
|
|
2171
|
+
function sc(n) {
|
|
2167
2172
|
return Ce("load", { media_id: n });
|
|
2168
2173
|
}
|
|
2169
|
-
function
|
|
2174
|
+
function Si() {
|
|
2170
2175
|
return Ce("home");
|
|
2171
2176
|
}
|
|
2172
|
-
function
|
|
2173
|
-
const n =
|
|
2177
|
+
function wi() {
|
|
2178
|
+
const n = _a(), e = tr(), t = Je(), r = nr(), s = t && r && !e.ready, i = !e.ready && !s;
|
|
2174
2179
|
return /* @__PURE__ */ l(
|
|
2175
2180
|
"button",
|
|
2176
2181
|
{
|
|
@@ -2190,13 +2195,13 @@ function xi() {
|
|
|
2190
2195
|
className: "ctr-btn",
|
|
2191
2196
|
title: s ? "Some viewers still loading — play anyway" : i ? "Waiting for sync..." : t ? n.playing ? "Pause" : "Play" : "Only the leader can control playback",
|
|
2192
2197
|
"data-active": !i && t && n.playing ? "1" : "0",
|
|
2193
|
-
children: n.playing ? /* @__PURE__ */ l(
|
|
2198
|
+
children: n.playing ? /* @__PURE__ */ l(ei, {}) : /* @__PURE__ */ l(Za, {})
|
|
2194
2199
|
}
|
|
2195
2200
|
);
|
|
2196
2201
|
}
|
|
2197
|
-
function
|
|
2202
|
+
function xi() {
|
|
2198
2203
|
function n() {
|
|
2199
|
-
w("controls", "Unload episode clicked"),
|
|
2204
|
+
w("controls", "Unload episode clicked"), Si();
|
|
2200
2205
|
}
|
|
2201
2206
|
return /* @__PURE__ */ l(
|
|
2202
2207
|
"button",
|
|
@@ -2205,31 +2210,31 @@ function Ei() {
|
|
|
2205
2210
|
className: "ctr-btn",
|
|
2206
2211
|
title: "Unload episode (return to lobby)",
|
|
2207
2212
|
"aria-label": "Unload episode",
|
|
2208
|
-
children: /* @__PURE__ */ l(
|
|
2213
|
+
children: /* @__PURE__ */ l(ui, {})
|
|
2209
2214
|
}
|
|
2210
2215
|
);
|
|
2211
2216
|
}
|
|
2212
|
-
function
|
|
2217
|
+
function Ei(n) {
|
|
2213
2218
|
return !n.isLeader || n.durationMs === 0 ? !0 : !n.ready && !n.canOverride;
|
|
2214
2219
|
}
|
|
2215
|
-
function
|
|
2220
|
+
function Mi(n) {
|
|
2216
2221
|
return n.localValue !== null ? n.localValue : n.displayPlayheadMs ?? n.snapshotPlayheadMs;
|
|
2217
2222
|
}
|
|
2218
|
-
function
|
|
2223
|
+
function ki(n, e) {
|
|
2219
2224
|
return e <= 0 ? 0 : n / e;
|
|
2220
2225
|
}
|
|
2221
2226
|
function Tt(n) {
|
|
2222
2227
|
const e = Math.floor(n / 1e3), t = Math.floor(e / 3600), r = Math.floor(e % 3600 / 60), s = e % 60;
|
|
2223
2228
|
return t > 0 ? `${t}:${r.toString().padStart(2, "0")}:${s.toString().padStart(2, "0")}` : `${r}:${s.toString().padStart(2, "0")}`;
|
|
2224
2229
|
}
|
|
2225
|
-
function
|
|
2226
|
-
const t = S((I) => I.snapshot), r = S((I) => I.readiness), s = Je(), i = nr(), a = s && i && !r.ready, d = L(null), [c, o] = B(null), [u, f] = B(0), [h, v] = B(!1), [y, p] = B(null), g = L(0), C = n || 0, b =
|
|
2230
|
+
function _i({ durationMs: n, displayPlayheadMs: e }) {
|
|
2231
|
+
const t = S((I) => I.snapshot), r = S((I) => I.readiness), s = Je(), i = nr(), a = s && i && !r.ready, d = L(null), [c, o] = B(null), [u, f] = B(0), [h, v] = B(!1), [y, p] = B(null), g = L(0), C = n || 0, b = Mi({ localValue: y, displayPlayheadMs: e, snapshotPlayheadMs: t.playheadMs }), M = L(0);
|
|
2227
2232
|
N(() => {
|
|
2228
2233
|
p(null), v(!1), M.current = 0;
|
|
2229
2234
|
}, [t.mediaId]), N(() => {
|
|
2230
2235
|
if (h || y === null) return;
|
|
2231
2236
|
const I = e ?? t.playheadMs, $ = Math.abs(I - y);
|
|
2232
|
-
if ($ <
|
|
2237
|
+
if ($ < Pn) {
|
|
2233
2238
|
p(null);
|
|
2234
2239
|
return;
|
|
2235
2240
|
}
|
|
@@ -2266,8 +2271,8 @@ function Ai({ durationMs: n, displayPlayheadMs: e }) {
|
|
|
2266
2271
|
min: 0,
|
|
2267
2272
|
max: C,
|
|
2268
2273
|
value: b,
|
|
2269
|
-
disabled:
|
|
2270
|
-
style: { "--progress": `${
|
|
2274
|
+
disabled: Ei({ isLeader: s, ready: r.ready, canOverride: a, durationMs: C }),
|
|
2275
|
+
style: { "--progress": `${ki(b, C) * 100}%` },
|
|
2271
2276
|
onChange: (I) => {
|
|
2272
2277
|
const $ = Number(I.target.value);
|
|
2273
2278
|
p($), M.current = Date.now();
|
|
@@ -2299,7 +2304,7 @@ function Ai({ durationMs: n, displayPlayheadMs: e }) {
|
|
|
2299
2304
|
/* @__PURE__ */ l("span", { className: "text-[11px] font-mono text-text-muted w-[45px] text-left shrink-0", children: Tt(C) })
|
|
2300
2305
|
] });
|
|
2301
2306
|
}
|
|
2302
|
-
function
|
|
2307
|
+
function Ai({ videoRef: n }) {
|
|
2303
2308
|
const e = S((u) => u.mediaPrefs.volume), t = S((u) => u.mediaPrefs.muted), r = S((u) => u.setVolume), s = S((u) => u.setMuted);
|
|
2304
2309
|
N(() => {
|
|
2305
2310
|
const u = n.current;
|
|
@@ -2310,7 +2315,7 @@ function Ti({ videoRef: n }) {
|
|
|
2310
2315
|
r(f), f > 0 && t && s(!1);
|
|
2311
2316
|
}, a = () => {
|
|
2312
2317
|
s(!t);
|
|
2313
|
-
}, d = () => t || e === 0 ? /* @__PURE__ */ l(
|
|
2318
|
+
}, d = () => t || e === 0 ? /* @__PURE__ */ l(ti, {}) : e < 0.5 ? /* @__PURE__ */ l(ni, {}) : /* @__PURE__ */ l(ri, {}), c = t ? 0 : e, o = Math.round(c * 100);
|
|
2314
2319
|
return /* @__PURE__ */ k("div", { className: "flex items-center gap-2", children: [
|
|
2315
2320
|
/* @__PURE__ */ l(
|
|
2316
2321
|
"button",
|
|
@@ -2343,7 +2348,7 @@ function Ti({ videoRef: n }) {
|
|
|
2343
2348
|
] })
|
|
2344
2349
|
] });
|
|
2345
2350
|
}
|
|
2346
|
-
function
|
|
2351
|
+
function Ti({
|
|
2347
2352
|
tracks: n,
|
|
2348
2353
|
selectedIndex: e,
|
|
2349
2354
|
onSelect: t
|
|
@@ -2367,7 +2372,7 @@ function Ci({
|
|
|
2367
2372
|
)
|
|
2368
2373
|
] });
|
|
2369
2374
|
}
|
|
2370
|
-
function
|
|
2375
|
+
function Ci({
|
|
2371
2376
|
tracks: n,
|
|
2372
2377
|
selectedIndex: e,
|
|
2373
2378
|
onSelect: t,
|
|
@@ -2404,13 +2409,13 @@ function Ii({
|
|
|
2404
2409
|
)
|
|
2405
2410
|
] });
|
|
2406
2411
|
}
|
|
2407
|
-
const
|
|
2412
|
+
const Ii = [
|
|
2408
2413
|
{ value: "classic", label: "Classic" },
|
|
2409
2414
|
{ value: "cinema", label: "Cinema" },
|
|
2410
2415
|
{ value: "minimal", label: "Minimal" },
|
|
2411
2416
|
{ value: "contrast", label: "High Contrast" }
|
|
2412
2417
|
];
|
|
2413
|
-
function
|
|
2418
|
+
function Ri({ style: n, onStyleChange: e, enabled: t }) {
|
|
2414
2419
|
return t ? /* @__PURE__ */ k("div", { className: "flex items-center gap-2", children: [
|
|
2415
2420
|
/* @__PURE__ */ l("span", { className: "text-[10px] opacity-60 uppercase tracking-wide", children: "Style" }),
|
|
2416
2421
|
/* @__PURE__ */ l(
|
|
@@ -2421,12 +2426,12 @@ function Fi({ style: n, onStyleChange: e, enabled: t }) {
|
|
|
2421
2426
|
className: "text-xs rounded px-2 py-1 cursor-pointer",
|
|
2422
2427
|
title: "Select subtitle style",
|
|
2423
2428
|
"aria-label": "Subtitle style selection",
|
|
2424
|
-
children:
|
|
2429
|
+
children: Ii.map((r) => /* @__PURE__ */ l("option", { value: r.value, children: r.label }, r.value))
|
|
2425
2430
|
}
|
|
2426
2431
|
)
|
|
2427
2432
|
] }) : null;
|
|
2428
2433
|
}
|
|
2429
|
-
function
|
|
2434
|
+
function Fi({ videoRef: n }) {
|
|
2430
2435
|
const [e, t] = B(!1);
|
|
2431
2436
|
return N(() => {
|
|
2432
2437
|
const s = () => {
|
|
@@ -2452,11 +2457,11 @@ function Ni({ videoRef: n }) {
|
|
|
2452
2457
|
},
|
|
2453
2458
|
className: "ctr-btn",
|
|
2454
2459
|
title: e ? "Exit Fullscreen" : "Enter Fullscreen",
|
|
2455
|
-
children: e ? /* @__PURE__ */ l(
|
|
2460
|
+
children: e ? /* @__PURE__ */ l(ai, {}) : /* @__PURE__ */ l(si, {})
|
|
2456
2461
|
}
|
|
2457
2462
|
);
|
|
2458
2463
|
}
|
|
2459
|
-
function
|
|
2464
|
+
function Ni({
|
|
2460
2465
|
videoRef: n,
|
|
2461
2466
|
mediaId: e,
|
|
2462
2467
|
durationMs: t,
|
|
@@ -2481,19 +2486,19 @@ function Li({
|
|
|
2481
2486
|
chatCollapsed: b,
|
|
2482
2487
|
isFullscreen: M,
|
|
2483
2488
|
gameOverlay: F
|
|
2484
|
-
}) === "control-bar", $ = S((W) => W.floatingChatEnabled), m = L(null), _ = L(null), [T, G] = B(!1), [P,
|
|
2489
|
+
}) === "control-bar", $ = S((W) => W.floatingChatEnabled), m = L(null), _ = L(null), [T, G] = B(!1), [P, U] = B(!1), [X, ce] = B(""), [R, V] = B(!1), H = er(), [ne, re] = B(!1), [we, Qe] = B(!1), bt = O(async (W) => {
|
|
2485
2490
|
if (W.key !== "Enter") return;
|
|
2486
2491
|
const de = X.trim();
|
|
2487
|
-
if (!de && !
|
|
2488
|
-
const xe = await
|
|
2489
|
-
xe !== null && (
|
|
2490
|
-
}, [X, R,
|
|
2492
|
+
if (!de && !H.pending.length || R || H.uploading) return;
|
|
2493
|
+
const xe = await H.uploadPending();
|
|
2494
|
+
xe !== null && (Ln(de, xe), ce(""), H.clear(), V(!0), setTimeout(() => V(!1), $n), !document.hidden && document.hasFocus() && _.current?.focus());
|
|
2495
|
+
}, [X, R, H]);
|
|
2491
2496
|
N(() => () => g?.(!1), [e, g]);
|
|
2492
2497
|
const Ie = r ?? !0, pe = O(() => {
|
|
2493
2498
|
const W = m.current;
|
|
2494
2499
|
if (!W) return;
|
|
2495
2500
|
const { scrollLeft: de, scrollWidth: xe, clientWidth: yt } = W;
|
|
2496
|
-
G(de > 5),
|
|
2501
|
+
G(de > 5), U(de + yt < xe - 5);
|
|
2497
2502
|
}, []);
|
|
2498
2503
|
N(() => {
|
|
2499
2504
|
const W = m.current;
|
|
@@ -2531,18 +2536,18 @@ function Li({
|
|
|
2531
2536
|
children: [
|
|
2532
2537
|
/* @__PURE__ */ k("div", { ref: m, className: ye, children: [
|
|
2533
2538
|
C && /* @__PURE__ */ k("div", { className: "cluster", children: [
|
|
2534
|
-
/* @__PURE__ */ l(
|
|
2539
|
+
/* @__PURE__ */ l(wi, {}),
|
|
2535
2540
|
I && /* @__PURE__ */ l(pr, {}),
|
|
2536
|
-
/* @__PURE__ */ l(
|
|
2541
|
+
/* @__PURE__ */ l(xi, {})
|
|
2537
2542
|
] }),
|
|
2538
|
-
/* @__PURE__ */ l("div", { className: "cluster-seek", children: /* @__PURE__ */ l(
|
|
2543
|
+
/* @__PURE__ */ l("div", { className: "cluster-seek", children: /* @__PURE__ */ l(_i, { durationMs: t, displayPlayheadMs: y }) }),
|
|
2539
2544
|
/* @__PURE__ */ k("div", { className: "cluster", children: [
|
|
2540
|
-
/* @__PURE__ */ l(
|
|
2545
|
+
/* @__PURE__ */ l(Ai, { videoRef: n }),
|
|
2541
2546
|
s.length > 1 && /* @__PURE__ */ k(be, { children: [
|
|
2542
2547
|
/* @__PURE__ */ l("div", { className: "w-px h-5 bg-white/20" }),
|
|
2543
2548
|
" ",
|
|
2544
2549
|
/* @__PURE__ */ l(
|
|
2545
|
-
|
|
2550
|
+
Ti,
|
|
2546
2551
|
{
|
|
2547
2552
|
tracks: s,
|
|
2548
2553
|
selectedIndex: i,
|
|
@@ -2553,7 +2558,7 @@ function Li({
|
|
|
2553
2558
|
] }),
|
|
2554
2559
|
d.length > 0 && /* @__PURE__ */ k("div", { className: "cluster", children: [
|
|
2555
2560
|
/* @__PURE__ */ l(
|
|
2556
|
-
|
|
2561
|
+
Ci,
|
|
2557
2562
|
{
|
|
2558
2563
|
tracks: d,
|
|
2559
2564
|
selectedIndex: c,
|
|
@@ -2563,7 +2568,7 @@ function Li({
|
|
|
2563
2568
|
}
|
|
2564
2569
|
),
|
|
2565
2570
|
/* @__PURE__ */ l(
|
|
2566
|
-
|
|
2571
|
+
Ri,
|
|
2567
2572
|
{
|
|
2568
2573
|
style: h,
|
|
2569
2574
|
onStyleChange: v,
|
|
@@ -2575,17 +2580,17 @@ function Li({
|
|
|
2575
2580
|
"div",
|
|
2576
2581
|
{
|
|
2577
2582
|
className: "cluster px-2 relative",
|
|
2578
|
-
onPaste:
|
|
2579
|
-
onDrop:
|
|
2580
|
-
onDragOver:
|
|
2583
|
+
onPaste: H.onPaste,
|
|
2584
|
+
onDrop: H.onDrop,
|
|
2585
|
+
onDragOver: H.onDragOver,
|
|
2581
2586
|
children: [
|
|
2582
|
-
/* @__PURE__ */ l(Zn, { pending:
|
|
2587
|
+
/* @__PURE__ */ l(Zn, { pending: H.pending, uploading: H.uploading, onRemove: H.remove }),
|
|
2583
2588
|
/* @__PURE__ */ l(
|
|
2584
|
-
|
|
2589
|
+
Qn,
|
|
2585
2590
|
{
|
|
2586
2591
|
open: ne,
|
|
2587
2592
|
onClose: () => re(!1),
|
|
2588
|
-
onPick:
|
|
2593
|
+
onPick: H.addMeme,
|
|
2589
2594
|
onUnavailable: () => {
|
|
2590
2595
|
Qe(!0), re(!1);
|
|
2591
2596
|
}
|
|
@@ -2598,7 +2603,7 @@ function Li({
|
|
|
2598
2603
|
type: "text",
|
|
2599
2604
|
value: X,
|
|
2600
2605
|
onChange: (W) => {
|
|
2601
|
-
ce(W.target.value.slice(0,
|
|
2606
|
+
ce(W.target.value.slice(0, Bn)), p?.();
|
|
2602
2607
|
},
|
|
2603
2608
|
onKeyDown: (W) => {
|
|
2604
2609
|
bt(W);
|
|
@@ -2624,7 +2629,7 @@ function Li({
|
|
|
2624
2629
|
]
|
|
2625
2630
|
}
|
|
2626
2631
|
),
|
|
2627
|
-
/* @__PURE__ */ l("div", { className: "cluster cluster-tight", children: /* @__PURE__ */ l(
|
|
2632
|
+
/* @__PURE__ */ l("div", { className: "cluster cluster-tight", children: /* @__PURE__ */ l(Fi, { videoRef: n }) })
|
|
2628
2633
|
] }),
|
|
2629
2634
|
qe && /* @__PURE__ */ k("div", { className: "ctr-scroll-group", children: [
|
|
2630
2635
|
/* @__PURE__ */ l(
|
|
@@ -2633,7 +2638,7 @@ function Li({
|
|
|
2633
2638
|
className: `ctr-scroll-btn ${T ? "visible" : ""}`,
|
|
2634
2639
|
onClick: () => Re("left"),
|
|
2635
2640
|
"aria-label": "Scroll left",
|
|
2636
|
-
children: /* @__PURE__ */ l(
|
|
2641
|
+
children: /* @__PURE__ */ l(ii, {})
|
|
2637
2642
|
}
|
|
2638
2643
|
),
|
|
2639
2644
|
/* @__PURE__ */ l(
|
|
@@ -2642,7 +2647,7 @@ function Li({
|
|
|
2642
2647
|
className: `ctr-scroll-btn ${P ? "visible" : ""}`,
|
|
2643
2648
|
onClick: () => Re("right"),
|
|
2644
2649
|
"aria-label": "Scroll right",
|
|
2645
|
-
children: /* @__PURE__ */ l(
|
|
2650
|
+
children: /* @__PURE__ */ l(oi, {})
|
|
2646
2651
|
}
|
|
2647
2652
|
)
|
|
2648
2653
|
] })
|
|
@@ -2650,43 +2655,43 @@ function Li({
|
|
|
2650
2655
|
}
|
|
2651
2656
|
);
|
|
2652
2657
|
}
|
|
2653
|
-
const
|
|
2654
|
-
function
|
|
2655
|
-
return n.hidden && n.roomPlaying && !n.seekInFlight && !n.ended && !n.localPause && n.sinceUserPauseMs >=
|
|
2658
|
+
const Li = 1e3;
|
|
2659
|
+
function $i(n) {
|
|
2660
|
+
return n.hidden && n.roomPlaying && !n.seekInFlight && !n.ended && !n.localPause && n.sinceUserPauseMs >= Li;
|
|
2656
2661
|
}
|
|
2657
|
-
function
|
|
2662
|
+
function Bi(n, e) {
|
|
2658
2663
|
return e.isLeader ? n === "play" && e.roomPlaying ? { kind: "resync" } : n === "pause" && !e.roomPlaying ? { kind: "none" } : { kind: "control", control: n } : n === "pause" ? { kind: "local-pause" } : e.roomPlaying ? { kind: "resync" } : { kind: "none" };
|
|
2659
2664
|
}
|
|
2660
|
-
function
|
|
2665
|
+
function Di(n) {
|
|
2661
2666
|
if (!n.roomPlaying || n.seekInFlight) return { kind: "none" };
|
|
2662
2667
|
const e = n.durationMs > 0 ? Math.min(n.roomMs, n.durationMs) : n.roomMs;
|
|
2663
2668
|
return Math.abs(e - n.elementMs) > n.driftToleranceMs ? { kind: "seek", targetMs: Math.round(e) } : n.elementPaused ? { kind: "resume" } : { kind: "none" };
|
|
2664
2669
|
}
|
|
2665
|
-
function
|
|
2670
|
+
function Pi(n, e, t) {
|
|
2666
2671
|
return n.playheadMs + (n.playing ? Math.max(0, t - e) : 0);
|
|
2667
2672
|
}
|
|
2668
2673
|
function gr(n) {
|
|
2669
2674
|
const e = n.split("/").filter(Boolean);
|
|
2670
2675
|
return e.length >= 2 ? e.slice(-2).join(" ") : e[e.length - 1] || n;
|
|
2671
2676
|
}
|
|
2672
|
-
function
|
|
2677
|
+
function Oi(n) {
|
|
2673
2678
|
const e = n.split("/").filter(Boolean), t = [`${e.join("/")}/poster.jpg`];
|
|
2674
2679
|
return e.length >= 2 && t.push(`${e.slice(0, -1).join("/")}/poster.jpg`), t;
|
|
2675
2680
|
}
|
|
2676
2681
|
function Ui({ mediaId: n, visible: e }) {
|
|
2677
2682
|
return n ? /* @__PURE__ */ l("div", { className: `media-title ${e ? "show" : ""}`, children: gr(n) }) : null;
|
|
2678
2683
|
}
|
|
2679
|
-
const je = 3,
|
|
2684
|
+
const je = 3, Hi = 1e3, ji = 15e3, Z = {
|
|
2680
2685
|
EQUAL: 1e-3,
|
|
2681
2686
|
POINT: 0.05,
|
|
2682
2687
|
RANGE: 0.1,
|
|
2683
2688
|
FALLBACK: 1
|
|
2684
2689
|
}, Ct = 0.5, It = 3e3;
|
|
2685
2690
|
function nt(n, e = {}) {
|
|
2686
|
-
const { baseMs: t =
|
|
2691
|
+
const { baseMs: t = Hi, capMs: r = ji, jitter: s = 0.25 } = e, i = Math.min(t * Math.pow(2, n - 1), r), a = s > 0 ? Math.round(i * Math.random() * s) : 0;
|
|
2687
2692
|
return i + a;
|
|
2688
2693
|
}
|
|
2689
|
-
const kn = 15,
|
|
2694
|
+
const kn = 15, Gi = 35e3, Wi = 2e3, Rt = 10;
|
|
2690
2695
|
function Ee(n, e) {
|
|
2691
2696
|
if (n.length === 0) return 0;
|
|
2692
2697
|
if (e >= n[n.length - 1].end_ms) return n.length - 1;
|
|
@@ -2720,15 +2725,15 @@ function Ft(n, e, t, r = Z.RANGE) {
|
|
|
2720
2725
|
function fe(n) {
|
|
2721
2726
|
return n ? Array.from({ length: n.length }, (e, t) => `${n.start(t).toFixed(2)}-${n.end(t).toFixed(2)}`) : [];
|
|
2722
2727
|
}
|
|
2723
|
-
function
|
|
2728
|
+
function Vi(n) {
|
|
2724
2729
|
if (n.length === 0) return 0;
|
|
2725
2730
|
const e = n.reduce((r, s) => r + s.bytes, 0), t = n.reduce((r, s) => r + s.durationMs, 0);
|
|
2726
2731
|
return t === 0 ? 0 : e / t * 1e3;
|
|
2727
2732
|
}
|
|
2728
|
-
const
|
|
2733
|
+
const Ki = 8e5, zi = 4;
|
|
2729
2734
|
function tt(n) {
|
|
2730
2735
|
if (n === 0) return 6e4;
|
|
2731
|
-
const e =
|
|
2736
|
+
const e = Ki / n * 1e3 * zi;
|
|
2732
2737
|
return Math.max(3e4, Math.min(12e4, Math.round(e)));
|
|
2733
2738
|
}
|
|
2734
2739
|
function _n(n, e) {
|
|
@@ -2736,7 +2741,7 @@ function _n(n, e) {
|
|
|
2736
2741
|
if (n[t]?.keyframe) return t;
|
|
2737
2742
|
return -1;
|
|
2738
2743
|
}
|
|
2739
|
-
function
|
|
2744
|
+
function Ji(n, e, t, r) {
|
|
2740
2745
|
const s = n * 1e3 - 100, i = e * 1e3 + 100;
|
|
2741
2746
|
for (const a of r) {
|
|
2742
2747
|
const d = t[a];
|
|
@@ -2745,7 +2750,7 @@ function Qi(n, e, t, r) {
|
|
|
2745
2750
|
}
|
|
2746
2751
|
return !1;
|
|
2747
2752
|
}
|
|
2748
|
-
function
|
|
2753
|
+
function Qi(n) {
|
|
2749
2754
|
const e = [], t = n.replace(/\r\n/g, `
|
|
2750
2755
|
`).split(`
|
|
2751
2756
|
`);
|
|
@@ -2800,10 +2805,10 @@ function An(n) {
|
|
|
2800
2805
|
let t = 0, r, s;
|
|
2801
2806
|
return e.length === 3 ? (t = parseInt(e[0], 10), r = parseInt(e[1], 10), s = parseFloat(e[2])) : (r = parseInt(e[0], 10), s = parseFloat(e[1])), isNaN(t) || isNaN(r) || isNaN(s) ? null : t * 3600 + r * 60 + s;
|
|
2802
2807
|
}
|
|
2803
|
-
function
|
|
2808
|
+
function qi(n) {
|
|
2804
2809
|
return n.replace(/<\/?[^>]+(>|$)/g, "").replace(/\{[^}]+\}/g, "").replace(/\\N/g, " ").replace(/\s*\n\s*/g, " ").replace(/\s{2,}/g, " ").trim();
|
|
2805
2810
|
}
|
|
2806
|
-
const
|
|
2811
|
+
const Xi = {
|
|
2807
2812
|
// Standard CC look: white text with thick black outline stroke
|
|
2808
2813
|
classic: "text-white [text-shadow:_-2px_-2px_0_#000,_2px_-2px_0_#000,_-2px_2px_0_#000,_2px_2px_0_#000,_0_-2px_0_#000,_0_2px_0_#000,_-2px_0_0_#000,_2px_0_0_#000]",
|
|
2809
2814
|
// DVD/theater style: yellow text on dark translucent box
|
|
@@ -2813,7 +2818,7 @@ const Yi = {
|
|
|
2813
2818
|
// Accessibility-focused: bold white text on solid black box
|
|
2814
2819
|
contrast: "text-white font-bold bg-black px-3 py-1"
|
|
2815
2820
|
};
|
|
2816
|
-
function
|
|
2821
|
+
function Yi({ subtitleUrl: n, videoRef: e, style: t, enabled: r }) {
|
|
2817
2822
|
const [s, i] = B([]), [a, d] = B([]), c = L(null), [o, u] = B(40), [f, h] = B(18);
|
|
2818
2823
|
N(() => {
|
|
2819
2824
|
if (!n) {
|
|
@@ -2830,7 +2835,7 @@ function Zi({ subtitleUrl: n, videoRef: e, style: t, enabled: r }) {
|
|
|
2830
2835
|
if (!F.ok) throw new Error(`Failed to fetch subtitles (status ${F.status})`);
|
|
2831
2836
|
const I = await F.text();
|
|
2832
2837
|
if (b) return;
|
|
2833
|
-
const $ =
|
|
2838
|
+
const $ = Qi(I);
|
|
2834
2839
|
i($);
|
|
2835
2840
|
return;
|
|
2836
2841
|
} catch (F) {
|
|
@@ -2868,8 +2873,8 @@ function Zi({ subtitleUrl: n, videoRef: e, style: t, enabled: r }) {
|
|
|
2868
2873
|
const b = e.current, M = c.current?.parentElement;
|
|
2869
2874
|
if (!b || !M) return;
|
|
2870
2875
|
const x = () => {
|
|
2871
|
-
const F = M.clientHeight, I = M.clientWidth, $ = b.videoWidth || 1920, m = b.videoHeight || 1080, _ = Math.min(I / $, F / m), T = m * _, G = (F - T) / 2, P = Math.max(16, T * 0.035),
|
|
2872
|
-
u(Math.max(G +
|
|
2876
|
+
const F = M.clientHeight, I = M.clientWidth, $ = b.videoWidth || 1920, m = b.videoHeight || 1080, _ = Math.min(I / $, F / m), T = m * _, G = (F - T) / 2, P = Math.max(16, T * 0.035), U = Math.max(P * 0.8, T * 0.055);
|
|
2877
|
+
u(Math.max(G + U, 40)), h(P);
|
|
2873
2878
|
};
|
|
2874
2879
|
return x(), window.addEventListener("resize", x), b.addEventListener("loadedmetadata", x), () => {
|
|
2875
2880
|
window.removeEventListener("resize", x), b.removeEventListener("loadedmetadata", x);
|
|
@@ -2898,8 +2903,8 @@ function Zi({ subtitleUrl: n, videoRef: e, style: t, enabled: r }) {
|
|
|
2898
2903
|
children: /* @__PURE__ */ l(
|
|
2899
2904
|
"div",
|
|
2900
2905
|
{
|
|
2901
|
-
className: `${x} font-medium max-w-[95%] inline-block antialiased ${
|
|
2902
|
-
children:
|
|
2906
|
+
className: `${x} font-medium max-w-[95%] inline-block antialiased ${Xi[t]}`,
|
|
2907
|
+
children: qi(F.text)
|
|
2903
2908
|
}
|
|
2904
2909
|
)
|
|
2905
2910
|
},
|
|
@@ -2936,7 +2941,7 @@ function Zi({ subtitleUrl: n, videoRef: e, style: t, enabled: r }) {
|
|
|
2936
2941
|
C(p.bl, p.bc, p.br, { bottom: `${o}px` }, c)
|
|
2937
2942
|
] });
|
|
2938
2943
|
}
|
|
2939
|
-
const
|
|
2944
|
+
const Zi = 300, eo = 50, to = 100, no = 100, ro = 100, so = 100;
|
|
2940
2945
|
function Nt(n, e) {
|
|
2941
2946
|
if (n.length === 0) return 0;
|
|
2942
2947
|
const t = Math.min(Math.floor(e / 100 * n.length), n.length - 1);
|
|
@@ -2954,10 +2959,10 @@ function _e(n) {
|
|
|
2954
2959
|
max: Math.round(e[e.length - 1])
|
|
2955
2960
|
};
|
|
2956
2961
|
}
|
|
2957
|
-
function Ae(n, e =
|
|
2962
|
+
function Ae(n, e = Zi) {
|
|
2958
2963
|
n.length > e && n.splice(0, n.length - e);
|
|
2959
2964
|
}
|
|
2960
|
-
class
|
|
2965
|
+
class ao {
|
|
2961
2966
|
// Fetch
|
|
2962
2967
|
_fetches = [];
|
|
2963
2968
|
_fetchTimeoutCount = 0;
|
|
@@ -3015,11 +3020,11 @@ class io {
|
|
|
3015
3020
|
}
|
|
3016
3021
|
/** Called when waitForAppend times out. */
|
|
3017
3022
|
recordAppendTimeout(e, t, r) {
|
|
3018
|
-
this._appendTimeouts.push({ index: e, timeoutMs: t, queueDepth: r, ts: performance.now() }), Ae(this._appendTimeouts,
|
|
3023
|
+
this._appendTimeouts.push({ index: e, timeoutMs: t, queueDepth: r, ts: performance.now() }), Ae(this._appendTimeouts, eo);
|
|
3019
3024
|
}
|
|
3020
3025
|
/** Called when a seek completes (COMPLETED path in _execute). */
|
|
3021
3026
|
recordSeekCompleted(e, t, r) {
|
|
3022
|
-
this._seeks.push({ caller: e, targetMs: t, durationMs: r, ts: performance.now() }), Ae(this._seeks,
|
|
3027
|
+
this._seeks.push({ caller: e, targetMs: t, durationMs: r, ts: performance.now() }), Ae(this._seeks, to);
|
|
3023
3028
|
}
|
|
3024
3029
|
/** Called when waitForSeeked resolves via timeout rather than the 'seeked' event. */
|
|
3025
3030
|
recordWaitForSeekedTimeout() {
|
|
@@ -3041,11 +3046,11 @@ class io {
|
|
|
3041
3046
|
this._stallStart && (this._stalls.push({
|
|
3042
3047
|
...this._stallStart,
|
|
3043
3048
|
durationMs: Math.round(performance.now() - this._stallStart.ts)
|
|
3044
|
-
}), Ae(this._stalls,
|
|
3049
|
+
}), Ae(this._stalls, no), this._stallStart = null);
|
|
3045
3050
|
}
|
|
3046
3051
|
/** Called from _doEvict with the reason tag passed by the caller. */
|
|
3047
3052
|
recordEvict(e, t, r) {
|
|
3048
|
-
this._evictCounts[e] = (this._evictCounts[e] ?? 0) + 1, this._evicts.push({ reason: e, start: t, end: r, ts: performance.now() }), Ae(this._evicts,
|
|
3053
|
+
this._evictCounts[e] = (this._evictCounts[e] ?? 0) + 1, this._evicts.push({ reason: e, start: t, end: r, ts: performance.now() }), Ae(this._evicts, ro);
|
|
3049
3054
|
}
|
|
3050
3055
|
/** Called from FragmentManager.reconcileLoadedStates() when the browser's
|
|
3051
3056
|
* own silent quota eviction is detected (fragments 'loaded' but gone from
|
|
@@ -3087,7 +3092,7 @@ class io {
|
|
|
3087
3092
|
},
|
|
3088
3093
|
audio: {
|
|
3089
3094
|
driftMs: _e(this._audioDrifts),
|
|
3090
|
-
highDriftCount: this._audioDrifts.filter((o) => o >
|
|
3095
|
+
highDriftCount: this._audioDrifts.filter((o) => o > so).length,
|
|
3091
3096
|
samples: this._audioDrifts.slice(-20).map((o) => Math.round(o))
|
|
3092
3097
|
},
|
|
3093
3098
|
stalls: {
|
|
@@ -3136,9 +3141,9 @@ class io {
|
|
|
3136
3141
|
this._fetches = [], this._fetchTimeoutCount = 0, this._fetchErrorCount = 0, this._appends = [], this._appendStarts.clear(), this._appendTimeouts = [], this._seeks = [], this._waitForSeekedTimeouts = 0, this._audioDrifts = [], this._stalls = [], this._stallStart = null, this._evictCounts = {}, this._evicts = [], this._browserEvictions = [];
|
|
3137
3142
|
}
|
|
3138
3143
|
}
|
|
3139
|
-
const oe = new
|
|
3140
|
-
|
|
3141
|
-
class
|
|
3144
|
+
const oe = new ao();
|
|
3145
|
+
On("__WP_PERF__", oe);
|
|
3146
|
+
class io {
|
|
3142
3147
|
cache = /* @__PURE__ */ new Map();
|
|
3143
3148
|
getOrCreate(e) {
|
|
3144
3149
|
let t = this.cache.get(e);
|
|
@@ -3177,8 +3182,8 @@ class oo {
|
|
|
3177
3182
|
this.cache.clear();
|
|
3178
3183
|
}
|
|
3179
3184
|
}
|
|
3180
|
-
const ge = new
|
|
3181
|
-
class
|
|
3185
|
+
const ge = new io(), Tn = 60, oo = 5e3;
|
|
3186
|
+
class co {
|
|
3182
3187
|
constructor(e) {
|
|
3183
3188
|
this.deps = e;
|
|
3184
3189
|
}
|
|
@@ -3258,7 +3263,7 @@ class lo {
|
|
|
3258
3263
|
if (this.evictStartedAt === 0)
|
|
3259
3264
|
return this.evictStartedAt = Date.now(), !0;
|
|
3260
3265
|
const e = Date.now() - this.evictStartedAt;
|
|
3261
|
-
return e <
|
|
3266
|
+
return e < oo ? !0 : (A("buffer", `EVICT-STUCK isEvicting held ${e}ms — clearing; a remove() updateend was lost, eviction was disabled`), oe.recordEvict("stuck-recovered", 0, 0), this._isEvicting = !1, this.evictStartedAt = 0, !1);
|
|
3262
3267
|
}
|
|
3263
3268
|
/** Called on dispose, on SourceBuffer error, and on media change
|
|
3264
3269
|
* (FragmentManager.setIndex) — see the note at that call site. */
|
|
@@ -3423,13 +3428,13 @@ class Ve {
|
|
|
3423
3428
|
* hold began. Lets processAppendQueue bound a hold that would otherwise
|
|
3424
3429
|
* never end — see APPEND_HOLD_MAX_MS. */
|
|
3425
3430
|
appendHold = null;
|
|
3426
|
-
eviction = new
|
|
3431
|
+
eviction = new co({
|
|
3427
3432
|
getFragments: () => this.fragments,
|
|
3428
3433
|
getSourceBuffer: () => this.sourceBuffer,
|
|
3429
3434
|
getMediaSource: () => this.mediaSource,
|
|
3430
3435
|
isDisposed: () => this.disposed,
|
|
3431
3436
|
fragmentStates: this.fragmentStates,
|
|
3432
|
-
getPendingSeekTargetMs: () => this.pendingSeekTargetMs !== null && Date.now() - this.pendingSeekSetAtMs >
|
|
3437
|
+
getPendingSeekTargetMs: () => this.pendingSeekTargetMs !== null && Date.now() - this.pendingSeekSetAtMs > Gi ? null : this.pendingSeekTargetMs
|
|
3433
3438
|
});
|
|
3434
3439
|
lastGapWarnMs = 0;
|
|
3435
3440
|
stableGapSignature = null;
|
|
@@ -3455,7 +3460,7 @@ class Ve {
|
|
|
3455
3460
|
// timing, and APPEND-HOLD reason counts. Read by emitInitDigest() which warns
|
|
3456
3461
|
// once at gate-pass time so the load shape is visible in session logs without
|
|
3457
3462
|
// wp:reportLogs=true.
|
|
3458
|
-
static INIT_TRACK_FRAGS =
|
|
3463
|
+
static INIT_TRACK_FRAGS = ls;
|
|
3459
3464
|
loadStartTs = 0;
|
|
3460
3465
|
initFetchStart = 0;
|
|
3461
3466
|
initFetchEnd = 0;
|
|
@@ -3530,8 +3535,8 @@ class Ve {
|
|
|
3530
3535
|
* `fragment-route.realmedia.test.ts`; this is the client-side backstop.
|
|
3531
3536
|
*/
|
|
3532
3537
|
async tryFragmentRoute(e, t, r) {
|
|
3533
|
-
if (this.fragmentRouteDisabled || !this.delivery || !
|
|
3534
|
-
const s =
|
|
3538
|
+
if (this.fragmentRouteDisabled || !this.delivery || !ds()) return null;
|
|
3539
|
+
const s = us(this.delivery, e);
|
|
3535
3540
|
if (!s)
|
|
3536
3541
|
return this.disableFragmentRoute(e, "could not build a URL for this config"), null;
|
|
3537
3542
|
try {
|
|
@@ -3658,12 +3663,12 @@ class Ve {
|
|
|
3658
3663
|
}
|
|
3659
3664
|
this.initAppendDone = performance.now(), this.initState = "loaded", this.initRetryCount = 0, w("buffer", `INIT-LOADED sbRanges=[${fe(this.sourceBuffer?.buffered).join(", ")}]`), this.processAppendQueue();
|
|
3660
3665
|
} catch (d) {
|
|
3661
|
-
ue("buffer", "Init segment fetch/append failed", { error: d.message }), a() || (this.initState = "pending", this.initRetryCount += 1, this.initRetryCount >=
|
|
3666
|
+
ue("buffer", "Init segment fetch/append failed", { error: d.message }), a() || (this.initState = "pending", this.initRetryCount += 1, this.initRetryCount >= fs ? (this.initFailed = !0, A("buffer", "INIT-GIVE-UP — init segment failed repeatedly; rejecting waiters for fast recovery", {
|
|
3662
3667
|
attempts: this.initRetryCount,
|
|
3663
3668
|
error: d.message
|
|
3664
3669
|
}), this.rejectAllWaiters(new Error("init segment failed after repeated retries"))) : this.disposed || setTimeout(() => {
|
|
3665
3670
|
!this.disposed && this.initState === "pending" && this.fetchInit();
|
|
3666
|
-
},
|
|
3671
|
+
}, hs));
|
|
3667
3672
|
}
|
|
3668
3673
|
}
|
|
3669
3674
|
/** Runs inside updateend after an append completes. Decides whether MSE
|
|
@@ -3751,7 +3756,7 @@ class Ve {
|
|
|
3751
3756
|
]), r = [], s = this.currentPlayheadMs / 1e3;
|
|
3752
3757
|
for (let d = 1; d < e.buffered.length; d++) {
|
|
3753
3758
|
const c = e.buffered.end(d - 1), o = e.buffered.start(d);
|
|
3754
|
-
o <= s ||
|
|
3759
|
+
o <= s || Ji(c, o, this.fragments, t) || r.push(`${c.toFixed(2)}-${o.toFixed(2)}`);
|
|
3755
3760
|
}
|
|
3756
3761
|
if (r.length === 0) {
|
|
3757
3762
|
this.stableGapSignature = null, this.stableGapSince = 0;
|
|
@@ -4191,7 +4196,7 @@ class Ve {
|
|
|
4191
4196
|
if (this.appendHold?.index !== e)
|
|
4192
4197
|
return this.appendHold = { index: e, since: r }, !1;
|
|
4193
4198
|
const s = r - this.appendHold.since;
|
|
4194
|
-
if (s <
|
|
4199
|
+
if (s < ps) return !1;
|
|
4195
4200
|
A("buffer", `APPEND-HOLD-BREAK #${e} held ${s}ms behind ${t.length} pending fetch(es) — declaring them dead so the queue can drain`, {
|
|
4196
4201
|
headIndex: e,
|
|
4197
4202
|
heldMs: s,
|
|
@@ -4255,7 +4260,7 @@ class Ve {
|
|
|
4255
4260
|
if (this.disposed || !this.sourceBuffer || (this.currentPlayheadMs = e, this.currentJobs.size >= Oe)) return;
|
|
4256
4261
|
const t = Ee(this.fragments, e), r = Math.min(this.fragments.length - 1, Ee(this.fragments, e + We)), s = Date.now();
|
|
4257
4262
|
for (let a = t; a <= r; a++)
|
|
4258
|
-
this.fragmentStates.get(a) === "error" && s - (this.errorTimestamps.get(a) ?? 0) >=
|
|
4263
|
+
this.fragmentStates.get(a) === "error" && s - (this.errorTimestamps.get(a) ?? 0) >= ms && ((this.fetchErrorCycles.get(a) ?? 0) >= fn ? w("buffer", `PREFETCH-DEAD #${a} cycles=${this.fetchErrorCycles.get(a)} not resetting`) : (this.fragmentStates.set(a, "pending"), this.errorTimestamps.delete(a)));
|
|
4259
4264
|
let i = 0;
|
|
4260
4265
|
for (let a = t; a <= r && i < Oe - this.currentJobs.size; a++) {
|
|
4261
4266
|
const d = this.fragmentStates.get(a);
|
|
@@ -4286,7 +4291,7 @@ class Ve {
|
|
|
4286
4291
|
/** Public eviction entry point used by MediaPlayer / prefetch. Delegates
|
|
4287
4292
|
* to the strategy which owns the isEvicting state + range choice logic. */
|
|
4288
4293
|
evictBefore(e) {
|
|
4289
|
-
this.pendingSeekTargetMs !== null && Math.abs(e - this.pendingSeekTargetMs) <=
|
|
4294
|
+
this.pendingSeekTargetMs !== null && Math.abs(e - this.pendingSeekTargetMs) <= Wi && (this.pendingSeekTargetMs = null), this.eviction.evictBefore(e);
|
|
4290
4295
|
}
|
|
4291
4296
|
// Public entry point for socket reconnect scenarios. Clears stale in-flight
|
|
4292
4297
|
// fetches and their pendingFetchIndices entries so the queue is unblocked on
|
|
@@ -4434,7 +4439,7 @@ class Ve {
|
|
|
4434
4439
|
return { ranges: e, gaps: e.length > 1, fragmentStates: t };
|
|
4435
4440
|
}
|
|
4436
4441
|
getAverageDownloadRate() {
|
|
4437
|
-
return
|
|
4442
|
+
return Vi(this.downloadSamples);
|
|
4438
4443
|
}
|
|
4439
4444
|
/** Nominal media end time (ms) = last fragment's end. 0 if no index loaded.
|
|
4440
4445
|
* Reported in health so the leader's status card can tell "near end-of-stream,
|
|
@@ -4508,7 +4513,7 @@ class Ve {
|
|
|
4508
4513
|
if (this.eosRetryTimer) return;
|
|
4509
4514
|
this.eosRetryTimer = setTimeout(() => {
|
|
4510
4515
|
this.eosRetryTimer = null, this.tryEndOfStream();
|
|
4511
|
-
},
|
|
4516
|
+
}, gs);
|
|
4512
4517
|
return;
|
|
4513
4518
|
}
|
|
4514
4519
|
try {
|
|
@@ -4521,14 +4526,14 @@ class Ve {
|
|
|
4521
4526
|
this.disposed = !0, this.eosRetryTimer && (clearTimeout(this.eosRetryTimer), this.eosRetryTimer = null), this.pendingEndOfStream = !1, this.abortAllJobs("dispose"), this.rejectAllWaiters(new Error("FragmentManager disposed")), this.appendQueue = [], this.isAppending = !1, this.eviction.reset(), this.appendingIndex = null, this.fragmentStates.clear(), this.errorTimestamps.clear(), this.discardCounts.clear(), this.fetchErrorCycles.clear(), this.downloadSamples = [], this.preAppendRanges = [], this.sourceBuffer = null, this.mediaSource = null, this.initState = "pending", this.initRange = null;
|
|
4522
4527
|
}
|
|
4523
4528
|
}
|
|
4524
|
-
function
|
|
4529
|
+
function lo(n, e) {
|
|
4525
4530
|
return !!n && n !== "eng" && e;
|
|
4526
4531
|
}
|
|
4527
|
-
function
|
|
4528
|
-
return n.override !== null ? n.override : n.globalEnabled ||
|
|
4532
|
+
function uo(n) {
|
|
4533
|
+
return n.override !== null ? n.override : n.globalEnabled || lo(n.selectedAudioLang, n.hasEngSub);
|
|
4529
4534
|
}
|
|
4530
4535
|
const br = "wp_reload_history", Zt = "wp_phantom_reload", yr = 5 * 6e4, Cn = 3;
|
|
4531
|
-
function
|
|
4536
|
+
function fo() {
|
|
4532
4537
|
try {
|
|
4533
4538
|
const n = sessionStorage.getItem(br);
|
|
4534
4539
|
return (n ? JSON.parse(n) : []).filter((t) => Date.now() - t < yr);
|
|
@@ -4536,8 +4541,8 @@ function ho() {
|
|
|
4536
4541
|
return [];
|
|
4537
4542
|
}
|
|
4538
4543
|
}
|
|
4539
|
-
function
|
|
4540
|
-
const t =
|
|
4544
|
+
function Ht(n, e) {
|
|
4545
|
+
const t = fo();
|
|
4541
4546
|
if (t.length >= Cn) {
|
|
4542
4547
|
hn(
|
|
4543
4548
|
"error",
|
|
@@ -4573,13 +4578,13 @@ function In() {
|
|
|
4573
4578
|
return null;
|
|
4574
4579
|
}
|
|
4575
4580
|
}
|
|
4576
|
-
function
|
|
4581
|
+
function ho() {
|
|
4577
4582
|
try {
|
|
4578
4583
|
sessionStorage.removeItem(Zt);
|
|
4579
4584
|
} catch {
|
|
4580
4585
|
}
|
|
4581
4586
|
}
|
|
4582
|
-
function
|
|
4587
|
+
function po() {
|
|
4583
4588
|
const n = navigator;
|
|
4584
4589
|
try {
|
|
4585
4590
|
return typeof n.getAutoplayPolicy == "function" ? n.getAutoplayPolicy("mediaelement") : void 0;
|
|
@@ -4587,11 +4592,11 @@ function mo() {
|
|
|
4587
4592
|
return;
|
|
4588
4593
|
}
|
|
4589
4594
|
}
|
|
4590
|
-
function
|
|
4595
|
+
function mo(n, e) {
|
|
4591
4596
|
return n === "disallowed" ? "deferred" : e ? "user-muted" : n === "allowed-muted" ? "muted-bridge" : "audible";
|
|
4592
4597
|
}
|
|
4593
4598
|
function vr(n, e) {
|
|
4594
|
-
const t =
|
|
4599
|
+
const t = po(), r = mo(t, e.userWantsMuted);
|
|
4595
4600
|
w(e.label, "autoplay plan", { policy: t ?? "unknown", plan: r, userWantsMuted: e.userWantsMuted });
|
|
4596
4601
|
const s = () => {
|
|
4597
4602
|
n.muted = !0, n.play().then(() => {
|
|
@@ -4631,7 +4636,7 @@ function Sr(n, e = 3e3) {
|
|
|
4631
4636
|
n.addEventListener("seeked", s, { once: !0 });
|
|
4632
4637
|
});
|
|
4633
4638
|
}
|
|
4634
|
-
class
|
|
4639
|
+
class go {
|
|
4635
4640
|
// ── State ──
|
|
4636
4641
|
_seekInFlight = !1;
|
|
4637
4642
|
/** Route taken by the in-flight seek (buffered/loading/nearby-pending/far) —
|
|
@@ -4823,14 +4828,14 @@ class bo {
|
|
|
4823
4828
|
}
|
|
4824
4829
|
}
|
|
4825
4830
|
let rt = null;
|
|
4826
|
-
function
|
|
4827
|
-
rt === null && (w("health", "Starting health reporting"), Rn(), rt = window.setInterval(Rn,
|
|
4831
|
+
function bo() {
|
|
4832
|
+
rt === null && (w("health", "Starting health reporting"), Rn(), rt = window.setInterval(Rn, bs));
|
|
4828
4833
|
}
|
|
4829
|
-
function
|
|
4834
|
+
function yo() {
|
|
4830
4835
|
rt !== null && (w("health", "Stopping health reporting"), window.clearInterval(rt), rt = null);
|
|
4831
4836
|
}
|
|
4832
4837
|
function Rn() {
|
|
4833
|
-
const n =
|
|
4838
|
+
const n = jn();
|
|
4834
4839
|
if (!n.connected) return;
|
|
4835
4840
|
const e = S.getState();
|
|
4836
4841
|
if (!e.snapshot.mediaId) return;
|
|
@@ -4848,7 +4853,7 @@ function Rn() {
|
|
|
4848
4853
|
(c < 0 || v < c) && (c = v);
|
|
4849
4854
|
}
|
|
4850
4855
|
const o = Math.max(0, a - s), u = c < 0 ? o : Math.min(o, c), f = e.drift.rtts.length > 0 ? e.drift.rtts.reduce((h, v) => h + v, 0) / e.drift.rtts.length : 0;
|
|
4851
|
-
n.emit(
|
|
4856
|
+
n.emit(Gn.HEALTH_REPORT, {
|
|
4852
4857
|
avg_download_rate_bps: t.getAverageDownloadRate(),
|
|
4853
4858
|
buffered_ahead_ms: u,
|
|
4854
4859
|
audio_buffered_ahead_ms: c < 0 ? -1 : Math.round(c),
|
|
@@ -4860,13 +4865,13 @@ function Rn() {
|
|
|
4860
4865
|
fragments_error: i.fragmentStates.error || 0,
|
|
4861
4866
|
video_ready_state: r?.readyState ?? -1,
|
|
4862
4867
|
duration_ms: t.getMediaEndMs(),
|
|
4863
|
-
delivery_arm:
|
|
4864
|
-
...
|
|
4865
|
-
pong_age_ms:
|
|
4868
|
+
delivery_arm: vs(),
|
|
4869
|
+
...vo(r),
|
|
4870
|
+
pong_age_ms: ys(),
|
|
4866
4871
|
reported_at: Date.now()
|
|
4867
4872
|
});
|
|
4868
4873
|
}
|
|
4869
|
-
function
|
|
4874
|
+
function vo(n) {
|
|
4870
4875
|
const e = typeof navigator > "u" ? void 0 : navigator, t = e?.connection;
|
|
4871
4876
|
return {
|
|
4872
4877
|
page_visible: typeof document.visibilityState == "string" ? document.visibilityState === "visible" : void 0,
|
|
@@ -4878,8 +4883,8 @@ function So(n) {
|
|
|
4878
4883
|
net_downlink_mbps: typeof t?.downlink == "number" && t.downlink >= 0 ? t.downlink : void 0
|
|
4879
4884
|
};
|
|
4880
4885
|
}
|
|
4881
|
-
const
|
|
4882
|
-
function
|
|
4886
|
+
const So = 3e3;
|
|
4887
|
+
function wo() {
|
|
4883
4888
|
const [n, e] = B(!1), t = L(null), r = L(!1), s = () => {
|
|
4884
4889
|
t.current && (clearTimeout(t.current), t.current = null);
|
|
4885
4890
|
}, i = O((c = 3e3) => {
|
|
@@ -4889,7 +4894,7 @@ function xo() {
|
|
|
4889
4894
|
}, []), a = O(() => {
|
|
4890
4895
|
r.current || (s(), e(!1));
|
|
4891
4896
|
}, []), d = O((c) => {
|
|
4892
|
-
r.current !== c && (r.current = c, c ? (s(), e(!0)) : i(
|
|
4897
|
+
r.current !== c && (r.current = c, c ? (s(), e(!0)) : i(So));
|
|
4893
4898
|
}, [i]);
|
|
4894
4899
|
return N(() => {
|
|
4895
4900
|
const c = () => {
|
|
@@ -4900,7 +4905,7 @@ function xo() {
|
|
|
4900
4905
|
};
|
|
4901
4906
|
}, [i]), { controlsVisible: n, showControls: i, hideControls: a, setControlsHeld: d };
|
|
4902
4907
|
}
|
|
4903
|
-
const wr = [], xr = [],
|
|
4908
|
+
const wr = [], xr = [], xo = {
|
|
4904
4909
|
fragments: wr,
|
|
4905
4910
|
durationMs: null,
|
|
4906
4911
|
mseCodec: null,
|
|
@@ -4908,8 +4913,8 @@ const wr = [], xr = [], Eo = {
|
|
|
4908
4913
|
audioTracks: xr,
|
|
4909
4914
|
contentToken: null
|
|
4910
4915
|
};
|
|
4911
|
-
function
|
|
4912
|
-
if (!n || n.url !== e) return
|
|
4916
|
+
function Eo(n, e) {
|
|
4917
|
+
if (!n || n.url !== e) return xo;
|
|
4913
4918
|
const t = n.data;
|
|
4914
4919
|
return {
|
|
4915
4920
|
fragments: t.fragments || wr,
|
|
@@ -4938,7 +4943,7 @@ function Fn(n) {
|
|
|
4938
4943
|
return null;
|
|
4939
4944
|
}
|
|
4940
4945
|
}
|
|
4941
|
-
function
|
|
4946
|
+
function Mo(n) {
|
|
4942
4947
|
const [e, t] = B(null);
|
|
4943
4948
|
return N(() => {
|
|
4944
4949
|
const r = new AbortController();
|
|
@@ -4991,7 +4996,7 @@ function ko(n) {
|
|
|
4991
4996
|
return s(), () => {
|
|
4992
4997
|
r.abort();
|
|
4993
4998
|
};
|
|
4994
|
-
}, [n]), ke(() =>
|
|
4999
|
+
}, [n]), ke(() => Eo(e, n), [e, n]);
|
|
4995
5000
|
}
|
|
4996
5001
|
const Lt = {
|
|
4997
5002
|
audioTracks: [],
|
|
@@ -4999,12 +5004,12 @@ const Lt = {
|
|
|
4999
5004
|
selectedAudioIndex: 0,
|
|
5000
5005
|
selectedSubtitleIndex: 0
|
|
5001
5006
|
};
|
|
5002
|
-
function
|
|
5003
|
-
const [e, t] = B(Lt), r =
|
|
5007
|
+
function ko(n) {
|
|
5008
|
+
const [e, t] = B(Lt), r = Ss(), s = S((d) => d.mediaPrefs.preferredAudioLang);
|
|
5004
5009
|
N(() => {
|
|
5005
5010
|
if (!n) return;
|
|
5006
5011
|
t(Lt);
|
|
5007
|
-
const d = new AbortController(), c =
|
|
5012
|
+
const d = new AbortController(), c = ws(r);
|
|
5008
5013
|
let o;
|
|
5009
5014
|
return (async () => {
|
|
5010
5015
|
try {
|
|
@@ -5034,12 +5039,12 @@ function _o(n) {
|
|
|
5034
5039
|
setSelectedSubtitleIndex: a
|
|
5035
5040
|
};
|
|
5036
5041
|
}
|
|
5037
|
-
const
|
|
5038
|
-
function
|
|
5039
|
-
return !n.roomPlaying || n.videoPaused ? "not-playing" : n.seekInFlight ? "seeking" : n.advancedMs >
|
|
5042
|
+
const _o = 100;
|
|
5043
|
+
function Ao(n) {
|
|
5044
|
+
return !n.roomPlaying || n.videoPaused ? "not-playing" : n.seekInFlight ? "seeking" : n.advancedMs > _o ? "advancing" : "stalled";
|
|
5040
5045
|
}
|
|
5041
|
-
const $t = 4e4,
|
|
5042
|
-
function
|
|
5046
|
+
const $t = 4e4, To = 3e3;
|
|
5047
|
+
function Co(n, e, t, r, s, i) {
|
|
5043
5048
|
const a = (g) => {
|
|
5044
5049
|
const C = {};
|
|
5045
5050
|
return (i?.current ?? []).forEach((M, x) => {
|
|
@@ -5064,13 +5069,13 @@ function Io(n, e, t, r, s, i) {
|
|
|
5064
5069
|
function b() {
|
|
5065
5070
|
C();
|
|
5066
5071
|
const m = n.current;
|
|
5067
|
-
m && (y.current = m.currentTime, v.current = setTimeout(M,
|
|
5072
|
+
m && (y.current = m.currentTime, v.current = setTimeout(M, To));
|
|
5068
5073
|
}
|
|
5069
5074
|
function M() {
|
|
5070
5075
|
v.current = null;
|
|
5071
5076
|
const m = n.current;
|
|
5072
5077
|
if (!m) return;
|
|
5073
|
-
const _ = S.getState(), T = t.current, G =
|
|
5078
|
+
const _ = S.getState(), T = t.current, G = Ao({
|
|
5074
5079
|
roomPlaying: _.snapshot.playing,
|
|
5075
5080
|
videoPaused: m.paused,
|
|
5076
5081
|
seekInFlight: !!T?.seekInFlight,
|
|
@@ -5080,7 +5085,7 @@ function Io(n, e, t, r, s, i) {
|
|
|
5080
5085
|
p.current = null, G !== "not-playing" && b();
|
|
5081
5086
|
return;
|
|
5082
5087
|
}
|
|
5083
|
-
const P = m.currentTime * 1e3,
|
|
5088
|
+
const P = m.currentTime * 1e3, U = e.current, X = Date.now();
|
|
5084
5089
|
p.current === null && (p.current = X);
|
|
5085
5090
|
const ce = X - p.current;
|
|
5086
5091
|
if (A("sync", "SILENT-STALL playhead frozen with no `waiting` event", {
|
|
@@ -5088,16 +5093,16 @@ function Io(n, e, t, r, s, i) {
|
|
|
5088
5093
|
readyState: m.readyState,
|
|
5089
5094
|
frozenMs: ce,
|
|
5090
5095
|
// Reported for correlation only — see comment above; may look healthy.
|
|
5091
|
-
reportedBufferedAheadMs: Math.round(
|
|
5096
|
+
reportedBufferedAheadMs: Math.round(U?.getBufferedAheadMs(P) ?? -1),
|
|
5092
5097
|
// Per-track geometry. `reportedBufferedAheadMs` above is VIDEO's and read
|
|
5093
5098
|
// a healthy 30s through the entire cedar-ridge 2026-08-25 freeze; the
|
|
5094
5099
|
// starved track only shows up here. A track whose `bufferedEndMs` equals
|
|
5095
5100
|
// the playhead is the one that stopped the playhead.
|
|
5096
|
-
video:
|
|
5101
|
+
video: U?.getTrackDiag(P),
|
|
5097
5102
|
...a(P)
|
|
5098
|
-
}), d(P, "silent-stall"),
|
|
5099
|
-
|
|
5100
|
-
const R =
|
|
5103
|
+
}), d(P, "silent-stall"), U) {
|
|
5104
|
+
U.reconcileLoadedStates();
|
|
5105
|
+
const R = U.findNextRangeStart(P, It);
|
|
5101
5106
|
R !== null && T ? (A("sync", "SILENT-STALL gap-skip", {
|
|
5102
5107
|
currentMs: Math.round(P),
|
|
5103
5108
|
gapSkipTarget: Math.round(R)
|
|
@@ -5106,7 +5111,7 @@ function Io(n, e, t, r, s, i) {
|
|
|
5106
5111
|
priority: it.VIEWER_CORRECTION,
|
|
5107
5112
|
caller: "silent-stall-gap-skip",
|
|
5108
5113
|
pauseSeekResume: !1
|
|
5109
|
-
})) :
|
|
5114
|
+
})) : U.fetchNearby(P).catch((V) => {
|
|
5110
5115
|
V?.name !== "AbortError" && A("sync", "SILENT-STALL fetchNearby failed", {
|
|
5111
5116
|
currentMs: Math.round(P),
|
|
5112
5117
|
error: V?.message
|
|
@@ -5114,11 +5119,11 @@ function Io(n, e, t, r, s, i) {
|
|
|
5114
5119
|
});
|
|
5115
5120
|
}
|
|
5116
5121
|
if (ce >= $t) {
|
|
5117
|
-
|
|
5122
|
+
U?.dumpBufferDiagnostics(P, "silent-stall-reload"), Ht("silent-stall", {
|
|
5118
5123
|
frozenMs: ce,
|
|
5119
5124
|
currentTime: +m.currentTime.toFixed(2),
|
|
5120
5125
|
readyState: m.readyState,
|
|
5121
|
-
loaded:
|
|
5126
|
+
loaded: U?.getLoadedCount?.() ?? -1
|
|
5122
5127
|
}), p.current = null;
|
|
5123
5128
|
return;
|
|
5124
5129
|
}
|
|
@@ -5138,8 +5143,8 @@ function Io(n, e, t, r, s, i) {
|
|
|
5138
5143
|
isLeader: G,
|
|
5139
5144
|
serverMsAtStall: Math.round(P)
|
|
5140
5145
|
}), oe.recordStallStart(m, e.current?.getBufferedAheadMs(m) ?? -1);
|
|
5141
|
-
const
|
|
5142
|
-
if (
|
|
5146
|
+
const U = e.current, X = t.current, ce = U?.getBufferedAheadMs(m) ?? 0;
|
|
5147
|
+
if (U && ce < 1e3 && U.dumpBufferDiagnostics(m, "stall-onset"), T && ce >= 1e3) {
|
|
5143
5148
|
const R = a(m);
|
|
5144
5149
|
Object.keys(R).length > 0 && A("sync", "STALL-TRACKS video buffer healthy at stall — per-track geometry", {
|
|
5145
5150
|
currentMs: Math.round(m),
|
|
@@ -5147,9 +5152,9 @@ function Io(n, e, t, r, s, i) {
|
|
|
5147
5152
|
...R
|
|
5148
5153
|
});
|
|
5149
5154
|
}
|
|
5150
|
-
if (T && !X?.seekInFlight && m > 0 && d(m, "waiting"), T &&
|
|
5151
|
-
|
|
5152
|
-
const R =
|
|
5155
|
+
if (T && !X?.seekInFlight && m > 0 && d(m, "waiting"), T && U && !X?.seekInFlight && m > 0) {
|
|
5156
|
+
U.reconcileLoadedStates();
|
|
5157
|
+
const R = U.getBufferedAheadMs(m), V = U.findNextRangeStart(m, It);
|
|
5153
5158
|
if (V !== null && X)
|
|
5154
5159
|
A("sync", "GAP-SKIP seeking over late-IDR gap", {
|
|
5155
5160
|
currentMs: Math.round(m),
|
|
@@ -5161,15 +5166,15 @@ function Io(n, e, t, r, s, i) {
|
|
|
5161
5166
|
pauseSeekResume: !1
|
|
5162
5167
|
});
|
|
5163
5168
|
else if (R < 500) {
|
|
5164
|
-
const
|
|
5165
|
-
|
|
5169
|
+
const H = U.getForwardGapDiag(m);
|
|
5170
|
+
H && H.nextRangeStartMs !== null && A("sync", "STALL-GAP not skipped", {
|
|
5166
5171
|
currentMs: Math.round(m),
|
|
5167
|
-
atEdge:
|
|
5168
|
-
aheadInRangeMs: Math.round(
|
|
5169
|
-
nextRangeStartMs: Math.round(
|
|
5170
|
-
gapMs:
|
|
5172
|
+
atEdge: H.atEdge,
|
|
5173
|
+
aheadInRangeMs: Math.round(H.aheadInRangeMs),
|
|
5174
|
+
nextRangeStartMs: Math.round(H.nextRangeStartMs),
|
|
5175
|
+
gapMs: H.gapMs !== null ? Math.round(H.gapMs) : null,
|
|
5171
5176
|
windowMs: It
|
|
5172
|
-
}),
|
|
5177
|
+
}), U.fetchNearby(m).catch((ne) => {
|
|
5173
5178
|
ne?.name !== "AbortError" && A("sync", "Stall recovery fetchNearby failed", {
|
|
5174
5179
|
currentMs: Math.round(m),
|
|
5175
5180
|
error: ne?.message
|
|
@@ -5179,23 +5184,23 @@ function Io(n, e, t, r, s, i) {
|
|
|
5179
5184
|
}
|
|
5180
5185
|
G && T && !c.current && (c.current = setTimeout(() => {
|
|
5181
5186
|
c.current = null;
|
|
5182
|
-
const R = S.getState(), V = !!R.snapshot.leaderId && R.snapshot.leaderId === R.me.clientId,
|
|
5183
|
-
V && !g.paused && g.readyState < 3 && !
|
|
5187
|
+
const R = S.getState(), V = !!R.snapshot.leaderId && R.snapshot.leaderId === R.me.clientId, H = !!t.current?.seekInFlight;
|
|
5188
|
+
V && !g.paused && g.readyState < 3 && !H && (A("sync", "Leader stall threshold reached — pausing room", { stallMs: pn }), o.current = !0, Ce("pause"));
|
|
5184
5189
|
}, pn)), T && !f.current && (h.current = g.currentTime, f.current = setTimeout(() => {
|
|
5185
5190
|
f.current = null;
|
|
5186
5191
|
const R = n.current;
|
|
5187
5192
|
if (!R) return;
|
|
5188
|
-
const
|
|
5189
|
-
if (!(
|
|
5193
|
+
const H = S.getState().snapshot.playing, ne = e.current, re = ne?.getBufferedAheadMs(R.currentTime * 1e3) ?? -1, we = R.currentTime - h.current;
|
|
5194
|
+
if (!(H && we < 0.5 && R.readyState < 3 && re < 1e3)) {
|
|
5190
5195
|
w("sync", "STUCK-CHECK cleared — playback progressed, no reload", {
|
|
5191
5196
|
advancedSec: +we.toFixed(2),
|
|
5192
5197
|
readyState: R.readyState,
|
|
5193
5198
|
bufferedAheadMs: Math.round(re),
|
|
5194
|
-
playing:
|
|
5199
|
+
playing: H
|
|
5195
5200
|
});
|
|
5196
5201
|
return;
|
|
5197
5202
|
}
|
|
5198
|
-
ne?.dumpBufferDiagnostics(R.currentTime * 1e3, "stuck-reload"),
|
|
5203
|
+
ne?.dumpBufferDiagnostics(R.currentTime * 1e3, "stuck-reload"), Ht("stuck-watchdog", {
|
|
5199
5204
|
stuckMs: $t,
|
|
5200
5205
|
advancedSec: +we.toFixed(2),
|
|
5201
5206
|
currentTime: +R.currentTime.toFixed(2),
|
|
@@ -5211,13 +5216,13 @@ function Io(n, e, t, r, s, i) {
|
|
|
5211
5216
|
!_ && !g.paused && s(g), T && o.current && !_ && (o.current = !1, A("sync", "Leader stall recovered — resuming room", { currentTime: g.currentTime.toFixed(2) }), Ce("play"));
|
|
5212
5217
|
const G = u.current !== null ? Date.now() - u.current : null;
|
|
5213
5218
|
u.current = null;
|
|
5214
|
-
const P = S.getState(),
|
|
5219
|
+
const P = S.getState(), U = P.snapshot.playheadMs + (P.snapshot.playing ? Date.now() - P.snapshotReceivedAt : 0), X = g.currentTime * 1e3;
|
|
5215
5220
|
w("sync", "VIDEO playing event", {
|
|
5216
5221
|
currentTime: g.currentTime.toFixed(2),
|
|
5217
5222
|
shouldPlay: _,
|
|
5218
5223
|
stallDurationMs: G,
|
|
5219
5224
|
// Positive = viewer is behind server; negative = viewer is ahead.
|
|
5220
|
-
driftMs: G !== null ? Math.round(
|
|
5225
|
+
driftMs: G !== null ? Math.round(U - X) : null
|
|
5221
5226
|
});
|
|
5222
5227
|
}
|
|
5223
5228
|
function $() {
|
|
@@ -5228,8 +5233,8 @@ function Io(n, e, t, r, s, i) {
|
|
|
5228
5233
|
};
|
|
5229
5234
|
}, [r]);
|
|
5230
5235
|
}
|
|
5231
|
-
const
|
|
5232
|
-
function
|
|
5236
|
+
const Io = 1.5;
|
|
5237
|
+
function Ro(n, e, t, r, s, i) {
|
|
5233
5238
|
const a = L(null), d = L(null), c = O(() => {
|
|
5234
5239
|
a.current && (clearInterval(a.current), a.current = null), d.current?.(), d.current = null;
|
|
5235
5240
|
}, []);
|
|
@@ -5258,7 +5263,7 @@ function Fo(n, e, t, r, s, i) {
|
|
|
5258
5263
|
};
|
|
5259
5264
|
a.current = setInterval(v, mn);
|
|
5260
5265
|
const y = () => {
|
|
5261
|
-
performance.now() - h >= mn *
|
|
5266
|
+
performance.now() - h >= mn * Io && v();
|
|
5262
5267
|
};
|
|
5263
5268
|
if (o && (o.addEventListener("timeupdate", y), d.current = () => o.removeEventListener("timeupdate", y)), o && !t.current?.seekInFlight) {
|
|
5264
5269
|
h = performance.now();
|
|
@@ -5268,13 +5273,13 @@ function Fo(n, e, t, r, s, i) {
|
|
|
5268
5273
|
return c;
|
|
5269
5274
|
}, [r, s]), { stopPrefetch: c };
|
|
5270
5275
|
}
|
|
5271
|
-
function
|
|
5276
|
+
function Fo(n, e, t, r, s, i) {
|
|
5272
5277
|
const a = S((o) => o.snapshot), d = S((o) => o.loadGeneration), c = L(d);
|
|
5273
5278
|
N(() => {
|
|
5274
5279
|
const o = n.current;
|
|
5275
5280
|
if (!o || !r) return;
|
|
5276
5281
|
const u = a.playheadMs, f = t.current, h = d !== c.current;
|
|
5277
|
-
c.current = d, !(!h && Math.abs(u - f) <=
|
|
5282
|
+
c.current = d, !(!h && Math.abs(u - f) <= Wn) && (w("buffer", "Seek triggered", {
|
|
5278
5283
|
targetMs: u,
|
|
5279
5284
|
lastApplied: f,
|
|
5280
5285
|
delta: Math.round(u - f),
|
|
@@ -5300,7 +5305,7 @@ function Nn(n, e) {
|
|
|
5300
5305
|
}, { once: !0 });
|
|
5301
5306
|
});
|
|
5302
5307
|
}
|
|
5303
|
-
function
|
|
5308
|
+
function No(n) {
|
|
5304
5309
|
const e = S((s) => s.playlist), t = S((s) => s.activePlaylistIndex), r = S((s) => s.snapshot.mediaId);
|
|
5305
5310
|
N(() => {
|
|
5306
5311
|
if (!e || !e.videos.some((i) => i.mediaId === r)) return;
|
|
@@ -5309,7 +5314,7 @@ function Lo(n) {
|
|
|
5309
5314
|
for (let i = 0; i < e.videos.length; i++) {
|
|
5310
5315
|
if (s.signal.aborted) return;
|
|
5311
5316
|
if (i === t) continue;
|
|
5312
|
-
const a = e.videos[i], { mediaUrl: d, indexUrl: c } =
|
|
5317
|
+
const a = e.videos[i], { mediaUrl: d, indexUrl: c } = Vn(a.mediaId), o = 3e3, u = async () => {
|
|
5313
5318
|
for (; !s.signal.aborted && (n.current?.getPendingCount() ?? 0) !== 0; )
|
|
5314
5319
|
try {
|
|
5315
5320
|
await Nn(2e3, s.signal);
|
|
@@ -5398,11 +5403,11 @@ function Lo(n) {
|
|
|
5398
5403
|
}, [e?.id, t, r]);
|
|
5399
5404
|
}
|
|
5400
5405
|
const $e = "bg-play";
|
|
5401
|
-
function
|
|
5406
|
+
function Lo() {
|
|
5402
5407
|
const n = S.getState();
|
|
5403
5408
|
return !!n.snapshot.leaderId && n.snapshot.leaderId === n.me.clientId;
|
|
5404
5409
|
}
|
|
5405
|
-
function
|
|
5410
|
+
function $o(n) {
|
|
5406
5411
|
return typeof Image > "u" ? Promise.resolve(null) : n.reduce(
|
|
5407
5412
|
(e, t) => e.then((r) => r ?? new Promise((s) => {
|
|
5408
5413
|
const i = new Image();
|
|
@@ -5411,18 +5416,18 @@ function Bo(n) {
|
|
|
5411
5416
|
Promise.resolve(null)
|
|
5412
5417
|
);
|
|
5413
5418
|
}
|
|
5414
|
-
function
|
|
5419
|
+
function Bo(n, e, t, r, s, i) {
|
|
5415
5420
|
const a = L(!1), d = L(0), c = dt((o) => {
|
|
5416
5421
|
const u = n.current, f = e.current;
|
|
5417
5422
|
if (!u || !s) return;
|
|
5418
|
-
const h = S.getState(), v =
|
|
5423
|
+
const h = S.getState(), v = Di({
|
|
5419
5424
|
roomPlaying: h.snapshot.playing,
|
|
5420
5425
|
seekInFlight: !!f?.seekInFlight,
|
|
5421
5426
|
elementPaused: u.paused,
|
|
5422
5427
|
elementMs: u.currentTime * 1e3,
|
|
5423
|
-
roomMs:
|
|
5428
|
+
roomMs: Pi(h.snapshot, h.snapshotReceivedAt, Date.now()),
|
|
5424
5429
|
durationMs: r,
|
|
5425
|
-
driftToleranceMs:
|
|
5430
|
+
driftToleranceMs: Wn
|
|
5426
5431
|
});
|
|
5427
5432
|
v.kind !== "none" && (w($e, "resync", { reason: o, plan: v.kind, elementMs: Math.round(u.currentTime * 1e3) }), v.kind === "resume" ? i(u) : f && f.submit({ targetMs: v.targetMs, priority: it.SEEK_EFFECT, caller: `bg-resync:${o}` }));
|
|
5428
5433
|
});
|
|
@@ -5431,7 +5436,7 @@ function Do(n, e, t, r, s, i) {
|
|
|
5431
5436
|
if (!o || !s) return;
|
|
5432
5437
|
const u = () => {
|
|
5433
5438
|
const h = S.getState();
|
|
5434
|
-
|
|
5439
|
+
$i({
|
|
5435
5440
|
hidden: document.visibilityState === "hidden",
|
|
5436
5441
|
roomPlaying: h.snapshot.playing,
|
|
5437
5442
|
seekInFlight: !!e.current?.seekInFlight,
|
|
@@ -5457,9 +5462,9 @@ function Do(n, e, t, r, s, i) {
|
|
|
5457
5462
|
artwork: M ? [{ src: M }] : []
|
|
5458
5463
|
}));
|
|
5459
5464
|
};
|
|
5460
|
-
v(null),
|
|
5465
|
+
v(null), $o(Oi(t).map(xs)).then(v);
|
|
5461
5466
|
const y = (M) => () => {
|
|
5462
|
-
const x = S.getState(), F =
|
|
5467
|
+
const x = S.getState(), F = Bi(M, { isLeader: Lo(), roomPlaying: x.snapshot.playing });
|
|
5463
5468
|
switch (w($e, "media session press", { action: M, result: F.kind }), M === "pause" && (d.current = Date.now()), F.kind) {
|
|
5464
5469
|
case "control":
|
|
5465
5470
|
Ce(F.control), F.control === "pause" && o.pause();
|
|
@@ -5532,9 +5537,9 @@ function Do(n, e, t, r, s, i) {
|
|
|
5532
5537
|
};
|
|
5533
5538
|
}, []);
|
|
5534
5539
|
}
|
|
5535
|
-
const
|
|
5540
|
+
const Do = 3e5, Po = 1, Oo = 1;
|
|
5536
5541
|
function Uo({ mediaUrl: n, indexUrl: e, mediaId: t }) {
|
|
5537
|
-
const r = L(null), [s, i] = B(!1), [a, d] = B(!1), { controlsVisible: c, showControls: o, hideControls: u, setControlsHeld: f } =
|
|
5542
|
+
const r = L(null), [s, i] = B(!1), [a, d] = B(!1), { controlsVisible: c, showControls: o, hideControls: u, setControlsHeld: f } = wo();
|
|
5538
5543
|
N(() => {
|
|
5539
5544
|
const E = () => d(!!document.fullscreenElement);
|
|
5540
5545
|
return document.addEventListener("fullscreenchange", E), () => document.removeEventListener("fullscreenchange", E);
|
|
@@ -5546,22 +5551,22 @@ function Uo({ mediaUrl: n, indexUrl: e, mediaId: t }) {
|
|
|
5546
5551
|
initSegment: p,
|
|
5547
5552
|
audioTracks: g,
|
|
5548
5553
|
contentToken: C
|
|
5549
|
-
} =
|
|
5554
|
+
} = Mo(e), b = O((E) => {
|
|
5550
5555
|
if (!C) return null;
|
|
5551
5556
|
const D = n.replace(new RegExp(`/${ct.replace(/\./g, "\\.")}$`), "");
|
|
5552
5557
|
return D === n ? null : { baseUrl: D, token: C, trackId: E };
|
|
5553
|
-
}, [C, n]), x = y !== null && g.length > 0, F = S((E) => E.readiness), I = L(!1), $ = L(!1), m = L(null), _ = L(null), T = L(null), G = L(0), P = L(0),
|
|
5558
|
+
}, [C, n]), x = y !== null && g.length > 0, F = S((E) => E.readiness), I = L(!1), $ = L(!1), m = L(null), _ = L(null), T = L(null), G = L(0), P = L(0), U = L(null), [X, ce] = B(0), R = L([]), V = L([]), H = L(-1), ne = L(!1), re = L(null), we = L(0), Qe = L(null), bt = S((E) => E.bufferState), Ie = S((E) => E.setBufferState), {
|
|
5554
5559
|
audioTracks: pe,
|
|
5555
5560
|
subtitleTracks: Re,
|
|
5556
5561
|
selectedAudioIndex: ye,
|
|
5557
5562
|
setSelectedAudioIndex: qe,
|
|
5558
5563
|
selectedSubtitleIndex: W,
|
|
5559
5564
|
setSelectedSubtitleIndex: de
|
|
5560
|
-
} =
|
|
5565
|
+
} = ko(t), xe = S((E) => E.mediaPrefs), yt = S((E) => E.mutedForAutoplay), Er = S((E) => E.setMutedForAutoplay), en = S((E) => E.setSubtitlesEnabled), Mr = S((E) => E.setSubtitleStyle), vt = S((E) => E.setPreferredAudioLang), kr = xe.subtitlesEnabled, tn = xe.subtitleStyle, _r = pe[ye]?.lang, Ar = Re.some((E) => E.lang === "eng"), [Tr, nn] = B(null);
|
|
5561
5566
|
N(() => {
|
|
5562
5567
|
nn(null);
|
|
5563
5568
|
}, [t]);
|
|
5564
|
-
const Xe =
|
|
5569
|
+
const Xe = uo({
|
|
5565
5570
|
override: Tr,
|
|
5566
5571
|
globalEnabled: kr,
|
|
5567
5572
|
selectedAudioLang: _r,
|
|
@@ -5595,7 +5600,7 @@ function Uo({ mediaUrl: n, indexUrl: e, mediaId: t }) {
|
|
|
5595
5600
|
}, [Ie]);
|
|
5596
5601
|
N(() => {
|
|
5597
5602
|
if (!y) return;
|
|
5598
|
-
|
|
5603
|
+
U.current !== t && (U.current = t, P.current = 0, G.current = 0);
|
|
5599
5604
|
const E = In();
|
|
5600
5605
|
E && A("buffer", "POST-AUTO-RELOAD — this load follows an auto-reload recovery", {
|
|
5601
5606
|
reloadAtMs: E,
|
|
@@ -5609,12 +5614,12 @@ function Uo({ mediaUrl: n, indexUrl: e, mediaId: t }) {
|
|
|
5609
5614
|
T.current = j;
|
|
5610
5615
|
const le = ++St.current;
|
|
5611
5616
|
window.__FRAGMENT_MANAGER__ = j, window.__AUDIO_FRAGMENT_MANAGERS__ = R.current;
|
|
5612
|
-
const ee = new
|
|
5617
|
+
const ee = new go({
|
|
5613
5618
|
videoRef: r,
|
|
5614
5619
|
fragmentManagerRef: T,
|
|
5615
5620
|
audioFragmentManagersRef: R
|
|
5616
5621
|
});
|
|
5617
|
-
re.current = ee, window.__SEEK_COORDINATOR__ = ee,
|
|
5622
|
+
re.current = ee, window.__SEEK_COORDINATOR__ = ee, bo();
|
|
5618
5623
|
const K = r.current, te = () => {
|
|
5619
5624
|
const Q = K?.error;
|
|
5620
5625
|
Q && (ue("video", `Media error code=${Q.code}: ${Q.message}`, {
|
|
@@ -5652,7 +5657,7 @@ function Uo({ mediaUrl: n, indexUrl: e, mediaId: t }) {
|
|
|
5652
5657
|
Ye,
|
|
5653
5658
|
{ suppressEndOfStream: !0, label: `audio:${ae.track_id}` }
|
|
5654
5659
|
);
|
|
5655
|
-
ie.setSourceBuffer(J, q), R.current.push(ie), V.current.push(J),
|
|
5660
|
+
ie.setSourceBuffer(J, q), R.current.push(ie), V.current.push(J), H.current = Y, w("mse", `Audio SB added: codec=${z} track=${ae.track_id} lang=${ae.lang} idx=${Y}`);
|
|
5656
5661
|
} catch (J) {
|
|
5657
5662
|
A("mse", `Audio SB creation failed for track ${ae.track_id}`, { error: J?.message });
|
|
5658
5663
|
}
|
|
@@ -5661,7 +5666,7 @@ function Uo({ mediaUrl: n, indexUrl: e, mediaId: t }) {
|
|
|
5661
5666
|
}
|
|
5662
5667
|
if (h.length) {
|
|
5663
5668
|
if (j.setIndex(h, n, p, t, b()), j.epoch = le, x) {
|
|
5664
|
-
const Y =
|
|
5669
|
+
const Y = H.current, ae = R.current[0], z = Y >= 0 ? g[Y] : void 0;
|
|
5665
5670
|
if (ae && z) {
|
|
5666
5671
|
const me = `${se}/${z.path}`.replace(/\\/g, "/");
|
|
5667
5672
|
ae.setIndex(
|
|
@@ -5680,7 +5685,7 @@ function Uo({ mediaUrl: n, indexUrl: e, mediaId: t }) {
|
|
|
5680
5685
|
}
|
|
5681
5686
|
};
|
|
5682
5687
|
return K && (q.addEventListener("sourceopen", Pe), D = URL.createObjectURL(q), K.src = D, K.addEventListener("error", te)), () => {
|
|
5683
|
-
r.current?.pause(), K && K.removeEventListener("error", te), q.removeEventListener("sourceopen", Pe),
|
|
5688
|
+
r.current?.pause(), K && K.removeEventListener("error", te), q.removeEventListener("sourceopen", Pe), yo(), ee.dispose(), re.current = null, j.dispose(), T.current = null, window.__FRAGMENT_MANAGER__ = null, window.__AUDIO_FRAGMENT_MANAGERS__ = null;
|
|
5684
5689
|
for (const Q of R.current) Q.dispose();
|
|
5685
5690
|
if (R.current = [], q.readyState === "open") {
|
|
5686
5691
|
for (const Q of [m.current, ...V.current])
|
|
@@ -5704,7 +5709,7 @@ function Uo({ mediaUrl: n, indexUrl: e, mediaId: t }) {
|
|
|
5704
5709
|
if (_.current?.readyState === "open" && m.current && h.length && E) {
|
|
5705
5710
|
if (E.hasIndex && E.epoch === D) return;
|
|
5706
5711
|
if (E.setIndex(h, n, p, t, b()), E.epoch = D, x) {
|
|
5707
|
-
const q = n.replace(new RegExp(`/${ct.replace(/\./g, "\\.")}$`), ""), j =
|
|
5712
|
+
const q = n.replace(new RegExp(`/${ct.replace(/\./g, "\\.")}$`), ""), j = H.current, le = R.current[0], ee = j >= 0 ? g[j] : void 0;
|
|
5708
5713
|
if (le && ee && !(le.hasIndex && le.epoch === D)) {
|
|
5709
5714
|
const K = `${q}/${ee.path}`.replace(/\\/g, "/");
|
|
5710
5715
|
le.setIndex(
|
|
@@ -5731,7 +5736,7 @@ function Uo({ mediaUrl: n, indexUrl: e, mediaId: t }) {
|
|
|
5731
5736
|
}, () => {
|
|
5732
5737
|
window.__AUDIO_SELECT__ = null;
|
|
5733
5738
|
}), [pe, qe, vt]), N(() => {
|
|
5734
|
-
if (!x || !s || ye < 0 || ye >= g.length || ye ===
|
|
5739
|
+
if (!x || !s || ye < 0 || ye >= g.length || ye === H.current) return;
|
|
5735
5740
|
if (ne.current) {
|
|
5736
5741
|
w("audio", "MSE audio swap requested while another in flight — deferring");
|
|
5737
5742
|
return;
|
|
@@ -5746,7 +5751,7 @@ function Uo({ mediaUrl: n, indexUrl: e, mediaId: t }) {
|
|
|
5746
5751
|
const q = ye, j = g[q], le = St.current;
|
|
5747
5752
|
ne.current = !0;
|
|
5748
5753
|
const ee = Math.round(D.currentTime * 1e3);
|
|
5749
|
-
w("audio", `MSE audio swap START idx=${
|
|
5754
|
+
w("audio", `MSE audio swap START idx=${H.current}→${q} lang=${j.lang} playheadMs=${ee}`), (async () => {
|
|
5750
5755
|
try {
|
|
5751
5756
|
const K = R.current[0], te = V.current[0];
|
|
5752
5757
|
if (!te) {
|
|
@@ -5783,7 +5788,7 @@ function Uo({ mediaUrl: n, indexUrl: e, mediaId: t }) {
|
|
|
5783
5788
|
j.init_segment,
|
|
5784
5789
|
`${t}::audio::${j.track_id}`,
|
|
5785
5790
|
b(j.track_id)
|
|
5786
|
-
), se.epoch = le, R.current.length = 0, R.current.push(se),
|
|
5791
|
+
), se.epoch = le, R.current.length = 0, R.current.push(se), H.current = q;
|
|
5787
5792
|
const ve = re.current?.inFlightTargetMs ?? Math.round(D.currentTime * 1e3), Y = new AbortController();
|
|
5788
5793
|
se.setPlayhead(ve);
|
|
5789
5794
|
const ae = se.ensureBuffered(ve, "audio-swap", Y.signal);
|
|
@@ -5797,8 +5802,8 @@ function Uo({ mediaUrl: n, indexUrl: e, mediaId: t }) {
|
|
|
5797
5802
|
})();
|
|
5798
5803
|
}, [x, s, ye, g, t, n, Ye]);
|
|
5799
5804
|
const an = O((E) => {
|
|
5800
|
-
if (P.current >=
|
|
5801
|
-
|
|
5805
|
+
if (P.current >= Oo) {
|
|
5806
|
+
Ht("phantom-recreate-exhausted", { reason: E, recreates: P.current, mediaId: t });
|
|
5802
5807
|
return;
|
|
5803
5808
|
}
|
|
5804
5809
|
P.current += 1, G.current = 0, A("buffer", "MSE-RECREATE — rebuilding MediaSource to clear corrupt buffer", {
|
|
@@ -5821,7 +5826,7 @@ function Uo({ mediaUrl: n, indexUrl: e, mediaId: t }) {
|
|
|
5821
5826
|
})
|
|
5822
5827
|
);
|
|
5823
5828
|
if (await E.ensureBuffered(j, "initial"), E.isDisposed) return;
|
|
5824
|
-
const te =
|
|
5829
|
+
const te = Es;
|
|
5825
5830
|
await Promise.allSettled(K);
|
|
5826
5831
|
const se = ee.map(
|
|
5827
5832
|
(J) => J.waitForBuffered(j + Me, te)
|
|
@@ -5831,7 +5836,7 @@ function Uo({ mediaUrl: n, indexUrl: e, mediaId: t }) {
|
|
|
5831
5836
|
aheadMs: Math.round(E.getBufferedAheadMs(j)),
|
|
5832
5837
|
targetMs: Me
|
|
5833
5838
|
}), E.isDisposed) return;
|
|
5834
|
-
if (E.getBufferedAheadMs(j) >
|
|
5839
|
+
if (E.getBufferedAheadMs(j) > Do && E.getLoadedCount() === 0) {
|
|
5835
5840
|
E.dumpBufferDiagnostics(j, "phantom-detected"), A("buffer", "PHANTOM-BUFFER detected at gate — recreating MediaSource", {
|
|
5836
5841
|
gateAheadMs: Math.round(E.getBufferedAheadMs(j)),
|
|
5837
5842
|
loaded: E.getLoadedCount(),
|
|
@@ -5847,7 +5852,7 @@ function Uo({ mediaUrl: n, indexUrl: e, mediaId: t }) {
|
|
|
5847
5852
|
totalMs: Q
|
|
5848
5853
|
});
|
|
5849
5854
|
const ve = Pe ? "gate-pass" : "gate-timeout";
|
|
5850
|
-
E.emitInitDigest("video", ve), ee.forEach((J, ie) => J.emitInitDigest(`audio:${ie}`, ve)), I.current || (I.current = !0,
|
|
5855
|
+
E.emitInitDigest("video", ve), ee.forEach((J, ie) => J.emitInitDigest(`audio:${ie}`, ve)), I.current || (I.current = !0, Ms(t));
|
|
5851
5856
|
let Y = j;
|
|
5852
5857
|
if (D && Y > 0) {
|
|
5853
5858
|
const J = D.buffered;
|
|
@@ -5857,7 +5862,7 @@ function Uo({ mediaUrl: n, indexUrl: e, mediaId: t }) {
|
|
|
5857
5862
|
}
|
|
5858
5863
|
D.currentTime = Y / 1e3, await Sr(D, 3e3);
|
|
5859
5864
|
}
|
|
5860
|
-
we.current = Y, i(!0), $.current = !0, G.current = 0, In() && A("buffer", "RECOVERY-SUCCESS — playback initialized after an auto-reload", { mediaId: t }),
|
|
5865
|
+
we.current = Y, i(!0), $.current = !0, G.current = 0, In() && A("buffer", "RECOVERY-SUCCESS — playback initialized after an auto-reload", { mediaId: t }), ho(), w("buffer", "initializePlayback complete", {
|
|
5861
5866
|
mediaId: t,
|
|
5862
5867
|
startMs: j,
|
|
5863
5868
|
seekMs: Y,
|
|
@@ -5922,7 +5927,7 @@ function Uo({ mediaUrl: n, indexUrl: e, mediaId: t }) {
|
|
|
5922
5927
|
return;
|
|
5923
5928
|
}
|
|
5924
5929
|
const te = K.includes("SourceBuffer is full"), se = K.includes("init segment failed");
|
|
5925
|
-
G.current += 1, te || se || G.current >
|
|
5930
|
+
G.current += 1, te || se || G.current > Po ? (ue("buffer", "Initialize playback failed — recreating MediaSource", {
|
|
5926
5931
|
error: K,
|
|
5927
5932
|
mediaId: t,
|
|
5928
5933
|
attempt: G.current,
|
|
@@ -5938,9 +5943,9 @@ function Uo({ mediaUrl: n, indexUrl: e, mediaId: t }) {
|
|
|
5938
5943
|
}
|
|
5939
5944
|
}
|
|
5940
5945
|
}
|
|
5941
|
-
|
|
5942
|
-
const { stopPrefetch: Rr } =
|
|
5943
|
-
|
|
5946
|
+
Fo(re, r, we, s, ot, rn), Co(r, T, re, s, rn, R), Bo(r, re, t, v ?? 0, s, ot);
|
|
5947
|
+
const { stopPrefetch: Rr } = Ro(r, T, re, s, Ie, R);
|
|
5948
|
+
No(T), Qe.current = Rr;
|
|
5944
5949
|
const Fr = O(() => {
|
|
5945
5950
|
const E = r.current?.parentElement;
|
|
5946
5951
|
E && (document.fullscreenElement ? document.exitFullscreen().catch((D) => A("ui", "exitFullscreen failed", { error: D?.message, name: D?.name })) : E.requestFullscreen().catch((D) => A("ui", "requestFullscreen failed", { error: D?.message, name: D?.name })));
|
|
@@ -5966,7 +5971,7 @@ function Uo({ mediaUrl: n, indexUrl: e, mediaId: t }) {
|
|
|
5966
5971
|
}
|
|
5967
5972
|
),
|
|
5968
5973
|
/* @__PURE__ */ l(
|
|
5969
|
-
|
|
5974
|
+
Yi,
|
|
5970
5975
|
{
|
|
5971
5976
|
subtitleUrl: Lr,
|
|
5972
5977
|
videoRef: r,
|
|
@@ -5976,7 +5981,7 @@ function Uo({ mediaUrl: n, indexUrl: e, mediaId: t }) {
|
|
|
5976
5981
|
),
|
|
5977
5982
|
/* @__PURE__ */ l(Ui, { mediaId: t, visible: c }),
|
|
5978
5983
|
/* @__PURE__ */ l(
|
|
5979
|
-
|
|
5984
|
+
Ni,
|
|
5980
5985
|
{
|
|
5981
5986
|
videoRef: r,
|
|
5982
5987
|
mediaId: t,
|
|
@@ -6024,14 +6029,14 @@ function Uo({ mediaUrl: n, indexUrl: e, mediaId: t }) {
|
|
|
6024
6029
|
}
|
|
6025
6030
|
);
|
|
6026
6031
|
}
|
|
6027
|
-
function
|
|
6028
|
-
const n = S((t) => t.snapshot.mediaId), e = ke(() => n ? { mediaId: n, ...
|
|
6029
|
-
return e ? /* @__PURE__ */ l(Pt, { children: /* @__PURE__ */ l(Uo, { mediaUrl: e.mediaUrl, indexUrl: e.indexUrl, mediaId: e.mediaId }) }) : /* @__PURE__ */ l(
|
|
6032
|
+
function Ho() {
|
|
6033
|
+
const n = S((t) => t.snapshot.mediaId), e = ke(() => n ? { mediaId: n, ...Vn(n) } : null, [n]);
|
|
6034
|
+
return e ? /* @__PURE__ */ l(Pt, { children: /* @__PURE__ */ l(Uo, { mediaUrl: e.mediaUrl, indexUrl: e.indexUrl, mediaId: e.mediaId }) }) : /* @__PURE__ */ l(As, {});
|
|
6030
6035
|
}
|
|
6031
|
-
const
|
|
6032
|
-
const e =
|
|
6036
|
+
const jo = (n) => {
|
|
6037
|
+
const e = Ds(n);
|
|
6033
6038
|
return e.render(
|
|
6034
|
-
/* @__PURE__ */ l(
|
|
6039
|
+
/* @__PURE__ */ l(ks.Provider, { value: _s(), children: /* @__PURE__ */ l(Ho, {}) })
|
|
6035
6040
|
), {
|
|
6036
6041
|
update() {
|
|
6037
6042
|
},
|
|
@@ -6042,21 +6047,21 @@ const Go = (n) => {
|
|
|
6042
6047
|
queueMicrotask(() => e.unmount());
|
|
6043
6048
|
}
|
|
6044
6049
|
};
|
|
6045
|
-
},
|
|
6050
|
+
}, Go = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6046
6051
|
__proto__: null,
|
|
6047
|
-
mount:
|
|
6048
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
6052
|
+
mount: jo
|
|
6053
|
+
}, Symbol.toStringTag, { value: "Module" })), Wo = {
|
|
6049
6054
|
id: "player",
|
|
6050
6055
|
name: "Media player",
|
|
6051
|
-
load: () => Promise.resolve(
|
|
6052
|
-
},
|
|
6053
|
-
function
|
|
6056
|
+
load: () => Promise.resolve(Go)
|
|
6057
|
+
}, Vo = pt(() => import("./MediaDrawer-DYNPH01V.js")), Ko = pt(() => import("./GameModule-D71uhFdW.js"));
|
|
6058
|
+
function zo() {
|
|
6054
6059
|
const n = S((u) => u.snapshot), e = S((u) => u.ensureAutoIdentity), t = gt(), r = ke(
|
|
6055
|
-
() => t?.kind === "module" ?
|
|
6060
|
+
() => t?.kind === "module" ? La(t, window.location.origin) : null,
|
|
6056
6061
|
[t]
|
|
6057
|
-
), s =
|
|
6058
|
-
|
|
6059
|
-
c &&
|
|
6062
|
+
), s = Ts(), i = L(!1), [a, d] = B(!1), c = s.roomKey || null;
|
|
6063
|
+
pi(), N(() => mi(), []), N(() => {
|
|
6064
|
+
c && vi(c);
|
|
6060
6065
|
}, [c]), N(() => {
|
|
6061
6066
|
const u = () => d(!0);
|
|
6062
6067
|
return window.addEventListener(Dt, u), () => window.removeEventListener(Dt, u);
|
|
@@ -6068,9 +6073,9 @@ function Jo() {
|
|
|
6068
6073
|
try {
|
|
6069
6074
|
await Promise.race([
|
|
6070
6075
|
Promise.all([
|
|
6076
|
+
Cs(),
|
|
6071
6077
|
Is(),
|
|
6072
|
-
Rs()
|
|
6073
|
-
Fs().then(jn)
|
|
6078
|
+
Rs().then(Hn)
|
|
6074
6079
|
]),
|
|
6075
6080
|
new Promise((y) => setTimeout(y, f))
|
|
6076
6081
|
]);
|
|
@@ -6081,7 +6086,7 @@ function Jo() {
|
|
|
6081
6086
|
const h = S.getState();
|
|
6082
6087
|
w("room", "Joining room", { roomKey: c, name: h.name, sprite: h.sprite }), e();
|
|
6083
6088
|
const v = S.getState();
|
|
6084
|
-
|
|
6089
|
+
Fs({
|
|
6085
6090
|
room_key: c,
|
|
6086
6091
|
name: v.name || void 0,
|
|
6087
6092
|
sprite: v.sprite || void 0
|
|
@@ -6095,38 +6100,38 @@ function Jo() {
|
|
|
6095
6100
|
}
|
|
6096
6101
|
return c ? /* @__PURE__ */ k("div", { className: "relative flex-1 flex overflow-hidden min-h-0", children: [
|
|
6097
6102
|
/* @__PURE__ */ k("div", { className: "flex-1 relative bg-black overflow-hidden min-w-0", children: [
|
|
6098
|
-
/* @__PURE__ */ l(vn, { activity:
|
|
6099
|
-
t?.kind === "iframe" && /* @__PURE__ */ l(Pt, { children: /* @__PURE__ */ l(Ke.Suspense, { fallback: null, children: /* @__PURE__ */ l(
|
|
6103
|
+
/* @__PURE__ */ l(vn, { activity: Wo, roomKey: n.roomId ?? "", layer: "base" }),
|
|
6104
|
+
t?.kind === "iframe" && /* @__PURE__ */ l(Pt, { children: /* @__PURE__ */ l(Ke.Suspense, { fallback: null, children: /* @__PURE__ */ l(Ko, {}) }) }),
|
|
6100
6105
|
r && n.roomId && /* @__PURE__ */ l(Pt, { children: /* @__PURE__ */ l(vn, { activity: r, roomKey: n.roomId, layer: "overlay" }, r.id) }),
|
|
6101
|
-
/* @__PURE__ */ k(
|
|
6102
|
-
/* @__PURE__ */ l(
|
|
6103
|
-
/* @__PURE__ */ l(
|
|
6104
|
-
/* @__PURE__ */ l(
|
|
6105
|
-
/* @__PURE__ */ l(
|
|
6106
|
+
/* @__PURE__ */ k(Ya, { children: [
|
|
6107
|
+
/* @__PURE__ */ l(Ha, {}),
|
|
6108
|
+
/* @__PURE__ */ l(Qa, {}),
|
|
6109
|
+
/* @__PURE__ */ l(hi, {}),
|
|
6110
|
+
/* @__PURE__ */ l(Xa, {})
|
|
6106
6111
|
] })
|
|
6107
6112
|
] }),
|
|
6108
|
-
/* @__PURE__ */ l(
|
|
6109
|
-
/* @__PURE__ */ l(Ke.Suspense, { fallback: /* @__PURE__ */ l(
|
|
6113
|
+
/* @__PURE__ */ l(Ra, {}),
|
|
6114
|
+
/* @__PURE__ */ l(Ke.Suspense, { fallback: /* @__PURE__ */ l(Pa, { open: a, onClose: o }), children: /* @__PURE__ */ l(Vo, { open: a, onClose: o }) })
|
|
6110
6115
|
] }) : (A("room", "No room key provided"), /* @__PURE__ */ l("div", { className: "flex-1 flex items-center justify-center p-6", children: /* @__PURE__ */ k("div", { className: "text-text-secondary", children: [
|
|
6111
6116
|
"No room key provided. Go to the ",
|
|
6112
6117
|
/* @__PURE__ */ l("a", { href: "/", className: "underline", children: "home page" }),
|
|
6113
6118
|
" to select a room."
|
|
6114
6119
|
] }) }));
|
|
6115
6120
|
}
|
|
6116
|
-
const
|
|
6121
|
+
const ac = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6117
6122
|
__proto__: null,
|
|
6118
|
-
default:
|
|
6123
|
+
default: zo
|
|
6119
6124
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
6120
6125
|
export {
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6126
|
+
nc as B,
|
|
6127
|
+
Da as D,
|
|
6128
|
+
ac as R,
|
|
6129
|
+
rc as S,
|
|
6130
|
+
Ba as a,
|
|
6131
|
+
Si as b,
|
|
6132
|
+
tc as c,
|
|
6128
6133
|
Je as d,
|
|
6129
|
-
|
|
6134
|
+
sc as s,
|
|
6130
6135
|
Xt as u
|
|
6131
6136
|
};
|
|
6132
|
-
//# sourceMappingURL=Room-
|
|
6137
|
+
//# sourceMappingURL=Room-C1DWAuT8.js.map
|