@hadoku/watchparty-ui 0.45.86 → 0.45.88
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-kFbHj3aw.js → AdminPanel-DaNzsx9K.js} +4 -4
- package/dist/chunks/{AdminPanel-kFbHj3aw.js.map → AdminPanel-DaNzsx9K.js.map} +1 -1
- package/dist/chunks/{MediaDrawer-CCyexft2.js → MediaDrawer-DyRYA0AN.js} +4 -4
- package/dist/chunks/{MediaDrawer-CCyexft2.js.map → MediaDrawer-DyRYA0AN.js.map} +1 -1
- package/dist/chunks/{PlaylistPanel-DdbO3yhW.js → PlaylistPanel-BbVs2gV8.js} +3 -3
- package/dist/chunks/{PlaylistPanel-DdbO3yhW.js.map → PlaylistPanel-BbVs2gV8.js.map} +1 -1
- package/dist/chunks/{Room-BsKYk_Fn.js → Room-D30OEvyK.js} +179 -179
- package/dist/chunks/Room-D30OEvyK.js.map +1 -0
- package/dist/chunks/{index-C0nyEdu4.js → index-CuuTdsvJ.js} +1064 -1051
- package/dist/chunks/{index-C0nyEdu4.js.map → index-CuuTdsvJ.js.map} +1 -1
- package/dist/chunks/{submissionsApi-Cs6H5zkX.js → submissionsApi-BS3GXz4T.js} +2 -2
- package/dist/chunks/{submissionsApi-Cs6H5zkX.js.map → submissionsApi-BS3GXz4T.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/room-chrome.js +625 -634
- package/dist/room-chrome.js.map +1 -1
- package/package.json +5 -5
- package/dist/chunks/Room-BsKYk_Fn.js.map +0 -1
package/dist/room-chrome.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { jsx as c, jsxs as _, Fragment as le } from "react/jsx-runtime";
|
|
2
|
-
import Le, { useState as k, useRef as W, useMemo as ee, useCallback as A, useEffect as E, createContext as
|
|
3
|
-
import { themePrefs as fe, Icon as
|
|
2
|
+
import Le, { useState as k, useRef as W, useMemo as ee, useCallback as A, useEffect as E, createContext as it, useContext as Zt, useSyncExternalStore as nr, useId as rr, useEffectEvent as en } from "react";
|
|
3
|
+
import { themePrefs as fe, Icon as or, THEMES as ar, useHadokuThemeOptional as ir } from "@wolffm/themes";
|
|
4
4
|
import { z as o } from "zod";
|
|
5
|
-
import { createCdnClient as
|
|
6
|
-
import { ensureCosmeticsStyles as
|
|
7
|
-
import { create as
|
|
8
|
-
import { pickAvatar as
|
|
9
|
-
import { createPrefsClient as
|
|
10
|
-
import { io as
|
|
11
|
-
import {
|
|
12
|
-
import { relayIdentityChanges as
|
|
13
|
-
import { createPortal as
|
|
14
|
-
import { useCatalogueSearch as
|
|
15
|
-
const
|
|
16
|
-
function
|
|
17
|
-
return typeof e == "string" &&
|
|
18
|
-
}
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const Ee = o.enum(["S", "A", "B", "C", "D", "F"]),
|
|
5
|
+
import { createCdnClient as sr, kindOfType as lr, MAX_BYTES as cr, measureImage as dr, filesFromClipboard as ur, filesFromDrop as mr, CdnError as et } from "@wolffm/cdn-client";
|
|
6
|
+
import { ensureCosmeticsStyles as fr, cleanWorn as pr, readPictureColour as hr, onPictureColour as gr, pictureColour as yr, decorHtml as br, messageHtml as tn, nameHtml as nn, finishReveal as vr } from "@wolffm/prefs-client/cosmetics";
|
|
7
|
+
import { create as _r } from "zustand";
|
|
8
|
+
import { pickAvatar as rn, resolveIdentityReassert as wr } from "@wolffm/rooms-protocol";
|
|
9
|
+
import { createPrefsClient as Sr, getDeviceId as xr, DEVICE_ID_KEY as Cr } from "@wolffm/prefs-client";
|
|
10
|
+
import { io as tt } from "socket.io-client";
|
|
11
|
+
import { fetchCharacter as Ir, characterOf as Tr, onAvatarChange as kr } from "@wolffm/prefs-client/avatar";
|
|
12
|
+
import { relayIdentityChanges as Er } from "@wolffm/task-ui-components/identity-relay";
|
|
13
|
+
import { createPortal as Ar } from "react-dom";
|
|
14
|
+
import { useCatalogueSearch as Nr } from "@wolffm/cdn-client/react";
|
|
15
|
+
const on = "https://cdn.hadoku.me", an = /^[0-9a-f]{64}\.(?:png|jpe?g|gif|webp|avif)$/;
|
|
16
|
+
function st(e) {
|
|
17
|
+
return typeof e == "string" && an.test(e);
|
|
18
|
+
}
|
|
19
|
+
const lt = 8080, sn = 5173, Pr = "/watchparty/ws", ln = 500, Rr = 1e3, J = 4, cn = typeof process < "u" && process.env ? process.env : {};
|
|
20
|
+
cn.PRODUCTION_UI_URL;
|
|
21
|
+
cn.PRODUCTION_SERVER_URL;
|
|
22
|
+
const Ee = o.enum(["S", "A", "B", "C", "D", "F"]), It = 2e4, Dr = 300;
|
|
23
23
|
o.object({
|
|
24
24
|
name: o.string().min(1).max(32).optional(),
|
|
25
25
|
sprite: o.string().min(1).max(32).optional(),
|
|
@@ -46,7 +46,7 @@ const v = {
|
|
|
46
46
|
// 'ready_state' here = playback-readiness gate (distinct from READY_EVENTS.STATE = "ready check" UX feature)
|
|
47
47
|
READY_STATE: "ready_state",
|
|
48
48
|
ERROR: "error"
|
|
49
|
-
},
|
|
49
|
+
}, Or = o.enum(["play", "pause", "seek", "load", "home"]), Mr = o.object({
|
|
50
50
|
framed: o.boolean(),
|
|
51
51
|
depth: o.number().int().nonnegative().max(10)
|
|
52
52
|
});
|
|
@@ -54,7 +54,7 @@ o.object({
|
|
|
54
54
|
room_key: o.string(),
|
|
55
55
|
name: o.string().min(1).max(32).optional(),
|
|
56
56
|
sprite: o.string().min(1).max(32).optional(),
|
|
57
|
-
embed:
|
|
57
|
+
embed: Mr.optional(),
|
|
58
58
|
/** Which media-delivery path this client resolved to ('range' | 'fragment').
|
|
59
59
|
* Optional so older clients still validate. Reported so a party's logs can be split by
|
|
60
60
|
* arm — without it an A/B rollout is unmeasurable, exactly as entry path was before
|
|
@@ -102,13 +102,13 @@ o.object({
|
|
|
102
102
|
});
|
|
103
103
|
o.object({
|
|
104
104
|
client_seq: o.number().int().positive(),
|
|
105
|
-
kind:
|
|
105
|
+
kind: Or,
|
|
106
106
|
to_ms: o.number().int().nonnegative().optional(),
|
|
107
107
|
media_id: o.string().optional()
|
|
108
108
|
// leader_id removed - not needed since set_leader control was removed
|
|
109
109
|
});
|
|
110
|
-
const
|
|
111
|
-
key: o.string().regex(
|
|
110
|
+
const dn = o.object({
|
|
111
|
+
key: o.string().regex(an, "not a CDN image key"),
|
|
112
112
|
/**
|
|
113
113
|
* Intrinsic pixels, or **0 meaning "unknown"**.
|
|
114
114
|
*
|
|
@@ -121,8 +121,8 @@ const un = o.object({
|
|
|
121
121
|
* text went with it, with nothing said. Widening is backward compatible —
|
|
122
122
|
* every message already in history carries positive dimensions.
|
|
123
123
|
*/
|
|
124
|
-
w: o.number().int().nonnegative().max(
|
|
125
|
-
h: o.number().int().nonnegative().max(
|
|
124
|
+
w: o.number().int().nonnegative().max(It),
|
|
125
|
+
h: o.number().int().nonnegative().max(It),
|
|
126
126
|
/**
|
|
127
127
|
* Human-readable description, rendered as the `alt` text.
|
|
128
128
|
*
|
|
@@ -136,14 +136,14 @@ const un = o.object({
|
|
|
136
136
|
* value only, never as markup. Bounded so one message cannot carry a
|
|
137
137
|
* paragraph; the library's own titles run well under this.
|
|
138
138
|
*/
|
|
139
|
-
title: o.string().max(
|
|
139
|
+
title: o.string().max(Dr).optional()
|
|
140
140
|
});
|
|
141
141
|
o.object({
|
|
142
|
-
text: o.string().max(
|
|
142
|
+
text: o.string().max(ln),
|
|
143
143
|
style: o.string().max(64).optional(),
|
|
144
|
-
images: o.array(
|
|
144
|
+
images: o.array(dn).max(J).optional()
|
|
145
145
|
}).refine((e) => e.text.length > 0 || (e.images?.length ?? 0) > 0, { message: "message must carry text or at least one image" });
|
|
146
|
-
const
|
|
146
|
+
const Lr = o.enum(["join", "leave", "media_change", "identity_change", "recap"]);
|
|
147
147
|
o.object({
|
|
148
148
|
id: o.string(),
|
|
149
149
|
client_id: o.string(),
|
|
@@ -156,16 +156,16 @@ o.object({
|
|
|
156
156
|
ts: o.number(),
|
|
157
157
|
// Optional so a client on an older bundle still validates a message that
|
|
158
158
|
// has none, and so system messages (which never carry images) stay unchanged.
|
|
159
|
-
images: o.array(
|
|
159
|
+
images: o.array(dn).max(J).optional(),
|
|
160
160
|
isSystem: o.boolean().optional(),
|
|
161
|
-
systemType:
|
|
161
|
+
systemType: Lr.optional(),
|
|
162
162
|
/** A system line about a person: its text with `CHAT_NAME_TOKEN` where their
|
|
163
163
|
* name goes. `text` is that template filled when sent; a client fills it
|
|
164
164
|
* again with the person's CURRENT name (found by `author`) while they are
|
|
165
165
|
* here, so a rename reaches lines already on screen. */
|
|
166
166
|
template: o.string().optional()
|
|
167
167
|
});
|
|
168
|
-
const
|
|
168
|
+
const un = "{name}", jr = o.object({
|
|
169
169
|
avg_download_rate_bps: o.number().nonnegative(),
|
|
170
170
|
buffered_ahead_ms: o.number().nonnegative(),
|
|
171
171
|
rtt_ms: o.number().nonnegative(),
|
|
@@ -207,7 +207,7 @@ const mn = "{name}", Fr = o.object({
|
|
|
207
207
|
* socket shows here as a growing number while everything else looks fine. */
|
|
208
208
|
pong_age_ms: o.number().int().nonnegative().optional(),
|
|
209
209
|
reported_at: o.number().int().nonnegative()
|
|
210
|
-
}),
|
|
210
|
+
}), Ur = jr.extend({
|
|
211
211
|
client_id: o.string(),
|
|
212
212
|
name: o.string(),
|
|
213
213
|
sprite_id: o.string().nullable(),
|
|
@@ -218,10 +218,10 @@ const mn = "{name}", Fr = o.object({
|
|
|
218
218
|
stale_ms: o.number().int().nonnegative().optional()
|
|
219
219
|
});
|
|
220
220
|
o.object({
|
|
221
|
-
clients: o.array(
|
|
221
|
+
clients: o.array(Ur),
|
|
222
222
|
server_ts: o.number().int().nonnegative()
|
|
223
223
|
});
|
|
224
|
-
const
|
|
224
|
+
const Hr = o.object({
|
|
225
225
|
client_id: o.string(),
|
|
226
226
|
sprite_id: o.string().nullable(),
|
|
227
227
|
name: o.string(),
|
|
@@ -239,13 +239,13 @@ const $r = o.object({
|
|
|
239
239
|
video_ready_state: o.number().int().default(-1)
|
|
240
240
|
});
|
|
241
241
|
o.object({
|
|
242
|
-
clients: o.array(
|
|
242
|
+
clients: o.array(Hr),
|
|
243
243
|
server_ts: o.number().int().nonnegative()
|
|
244
244
|
});
|
|
245
245
|
o.object({
|
|
246
246
|
media_id: o.string()
|
|
247
247
|
});
|
|
248
|
-
const
|
|
248
|
+
const ct = o.enum(["super_upvote", "upvote", "mid", "downvote"]), Fr = o.object({
|
|
249
249
|
mediaId: o.string(),
|
|
250
250
|
displayName: o.string(),
|
|
251
251
|
// Enrichment fields — present for flat-playlist ingest output, absent for
|
|
@@ -256,11 +256,11 @@ const lt = o.enum(["super_upvote", "upvote", "mid", "downvote"]), Br = o.object(
|
|
|
256
256
|
durationMs: o.number().optional(),
|
|
257
257
|
uploadDate: o.string().optional()
|
|
258
258
|
// YouTube upload date 'YYYY-MM-DD'; drives playlist order
|
|
259
|
-
}),
|
|
259
|
+
}), $r = o.enum(["basic", "vote"]), mn = o.object({
|
|
260
260
|
id: o.string(),
|
|
261
261
|
name: o.string(),
|
|
262
|
-
type:
|
|
263
|
-
videos: o.array(
|
|
262
|
+
type: $r.default("vote"),
|
|
263
|
+
videos: o.array(Fr),
|
|
264
264
|
cover: o.string().optional()
|
|
265
265
|
// media-relative path to the playlist cover image
|
|
266
266
|
});
|
|
@@ -269,28 +269,28 @@ o.object({ index: o.number().int().min(0) });
|
|
|
269
269
|
o.object({
|
|
270
270
|
playlistId: o.string(),
|
|
271
271
|
mediaId: o.string(),
|
|
272
|
-
vote:
|
|
272
|
+
vote: ct
|
|
273
273
|
});
|
|
274
274
|
o.object({ voterKey: o.string().min(1).max(128) });
|
|
275
275
|
o.object({ playlistId: o.string(), mediaIds: o.array(o.string()) });
|
|
276
276
|
o.object({
|
|
277
|
-
playlist:
|
|
277
|
+
playlist: mn.nullable(),
|
|
278
278
|
activeIndex: o.number().int().nullable(),
|
|
279
|
-
myVotes: o.record(o.string(),
|
|
279
|
+
myVotes: o.record(o.string(), ct)
|
|
280
280
|
// mediaId -> VoteValue
|
|
281
281
|
});
|
|
282
|
-
const
|
|
282
|
+
const Br = o.object({
|
|
283
283
|
clientId: o.string(),
|
|
284
284
|
name: o.string(),
|
|
285
285
|
votedCount: o.number().int().nonnegative(),
|
|
286
286
|
totalVideos: o.number().int().nonnegative()
|
|
287
287
|
});
|
|
288
288
|
o.object({
|
|
289
|
-
progress: o.array(
|
|
289
|
+
progress: o.array(Br)
|
|
290
290
|
});
|
|
291
291
|
o.object({
|
|
292
|
-
playlist:
|
|
293
|
-
votes: o.record(o.string(), o.record(o.string(),
|
|
292
|
+
playlist: mn,
|
|
293
|
+
votes: o.record(o.string(), o.record(o.string(), ct)),
|
|
294
294
|
// votes[clientId][mediaId]
|
|
295
295
|
names: o.record(o.string(), o.string()),
|
|
296
296
|
// clientId -> display name
|
|
@@ -315,17 +315,17 @@ const Se = {
|
|
|
315
315
|
RESULTS: "playlist_results",
|
|
316
316
|
/** Server -> the removed voter: forget the ballot you hold in localStorage. */
|
|
317
317
|
VOTES_CLEARED: "playlist_votes_cleared"
|
|
318
|
-
},
|
|
318
|
+
}, fn = o.object({
|
|
319
319
|
id: o.string(),
|
|
320
320
|
displayName: o.string(),
|
|
321
321
|
thumbnail: o.string().optional()
|
|
322
322
|
});
|
|
323
323
|
o.object({
|
|
324
|
-
items: o.array(
|
|
324
|
+
items: o.array(fn)
|
|
325
325
|
});
|
|
326
|
-
const
|
|
327
|
-
o.object({ board:
|
|
328
|
-
const
|
|
326
|
+
const pn = o.partialRecord(Ee, o.array(o.string()));
|
|
327
|
+
o.object({ board: pn });
|
|
328
|
+
const Gr = o.object({
|
|
329
329
|
mediaId: o.string(),
|
|
330
330
|
tier: Ee,
|
|
331
331
|
absoluteTier: Ee,
|
|
@@ -338,8 +338,8 @@ const Vr = o.object({
|
|
|
338
338
|
// opaque voterId -> the letter they gave
|
|
339
339
|
});
|
|
340
340
|
o.object({
|
|
341
|
-
items: o.array(
|
|
342
|
-
placed: o.array(
|
|
341
|
+
items: o.array(fn),
|
|
342
|
+
placed: o.array(Gr),
|
|
343
343
|
unrated: o.array(o.string()),
|
|
344
344
|
spread: o.number(),
|
|
345
345
|
nudged: o.boolean(),
|
|
@@ -349,9 +349,9 @@ o.object({
|
|
|
349
349
|
* browser on a newer bundle still reads an older server's board. */
|
|
350
350
|
pictures: o.record(o.string(), o.string()).optional(),
|
|
351
351
|
voterCount: o.number().int().nonnegative(),
|
|
352
|
-
myBoard:
|
|
352
|
+
myBoard: pn
|
|
353
353
|
});
|
|
354
|
-
const
|
|
354
|
+
const Wr = {
|
|
355
355
|
/** Broadcast to EVERY connected socket when anyone saves. Carries no board —
|
|
356
356
|
* it is a "re-fetch" ping, because the shared result is identical for all
|
|
357
357
|
* viewers but `myBoard` is not, and one payload cannot serve both. */
|
|
@@ -364,10 +364,10 @@ o.object({
|
|
|
364
364
|
ready: o.array(o.string())
|
|
365
365
|
// clientIds who have flagged ready
|
|
366
366
|
});
|
|
367
|
-
const
|
|
367
|
+
const qr = {
|
|
368
368
|
STATE: "ready_check_state"
|
|
369
369
|
// distinct from buffer-readiness 'ready_state'
|
|
370
|
-
},
|
|
370
|
+
}, hn = {
|
|
371
371
|
ACTIVE: "game_active",
|
|
372
372
|
// server -> room (the open game id; null = none)
|
|
373
373
|
SYNC: "game_sync"
|
|
@@ -379,7 +379,7 @@ o.object({
|
|
|
379
379
|
o.object({
|
|
380
380
|
gameId: o.string().nullable()
|
|
381
381
|
});
|
|
382
|
-
const
|
|
382
|
+
const Vr = [
|
|
383
383
|
{
|
|
384
384
|
id: "fantasy",
|
|
385
385
|
characters: [
|
|
@@ -423,37 +423,37 @@ const Yr = [
|
|
|
423
423
|
{ id: "mentor", color: "#e1e0dc" }
|
|
424
424
|
]
|
|
425
425
|
}
|
|
426
|
-
],
|
|
427
|
-
function
|
|
428
|
-
const t =
|
|
426
|
+
], dt = Vr.flatMap((e) => e.characters), Be = dt.map((e) => e.id), Kr = Object.fromEntries(dt.map((e) => [e.id, e.color])), Yr = Object.fromEntries(dt.map((e) => [e.id, "rev" in e ? e.rev : 1]));
|
|
427
|
+
function zr(e) {
|
|
428
|
+
const t = Yr[e];
|
|
429
429
|
return `/media/sprites/square_${e}.png${t > 1 ? `?v=${t}` : ""}`;
|
|
430
430
|
}
|
|
431
|
-
function
|
|
431
|
+
function Ge(e) {
|
|
432
432
|
return !!e && Be.includes(e);
|
|
433
433
|
}
|
|
434
|
-
const
|
|
435
|
-
function
|
|
436
|
-
return typeof e == "string" &&
|
|
434
|
+
const Xr = 5e3, gn = { mode: "off", percent: 0 }, Jr = ["off", "on", "ab"];
|
|
435
|
+
function Qr(e) {
|
|
436
|
+
return typeof e == "string" && Jr.includes(e);
|
|
437
437
|
}
|
|
438
|
-
function
|
|
439
|
-
const t = e && typeof e == "object" ? e : {}, n =
|
|
438
|
+
function Zr(e) {
|
|
439
|
+
const t = e && typeof e == "object" ? e : {}, n = Qr(t.mode) ? t.mode : gn.mode, r = Number(t.percent), a = Number.isFinite(r) ? Math.min(100, Math.max(0, Math.round(r))) : 0;
|
|
440
440
|
return { mode: n, percent: a };
|
|
441
441
|
}
|
|
442
|
-
function
|
|
442
|
+
function eo(e) {
|
|
443
443
|
let t = 2166136261;
|
|
444
444
|
for (let n = 0; n < e.length; n++)
|
|
445
445
|
t ^= e.charCodeAt(n), t = Math.imul(t, 16777619) >>> 0;
|
|
446
446
|
return t >>> 0;
|
|
447
447
|
}
|
|
448
|
-
function
|
|
448
|
+
function to(e, t, n) {
|
|
449
449
|
if (n === !0)
|
|
450
450
|
return "fragment";
|
|
451
451
|
if (n === !1)
|
|
452
452
|
return "range";
|
|
453
|
-
const r =
|
|
454
|
-
return r.mode === "on" ? "fragment" : r.mode === "off" || r.percent <= 0 ? "range" : r.percent >= 100 || t &&
|
|
453
|
+
const r = Zr(e);
|
|
454
|
+
return r.mode === "on" ? "fragment" : r.mode === "off" || r.percent <= 0 ? "range" : r.percent >= 100 || t && eo(t) % 100 < r.percent ? "fragment" : "range";
|
|
455
455
|
}
|
|
456
|
-
const
|
|
456
|
+
const yn = o.enum(["url", "magnet", "upload"]), no = o.enum([
|
|
457
457
|
"pending",
|
|
458
458
|
"approved",
|
|
459
459
|
"fetching",
|
|
@@ -461,7 +461,7 @@ const bn = o.enum(["url", "magnet", "upload"]), oo = o.enum([
|
|
|
461
461
|
"ready",
|
|
462
462
|
"rejected",
|
|
463
463
|
"failed"
|
|
464
|
-
]),
|
|
464
|
+
]), Tt = {
|
|
465
465
|
pending: ["approved", "rejected"],
|
|
466
466
|
approved: ["fetching", "rejected", "failed"],
|
|
467
467
|
fetching: ["ingesting", "failed"],
|
|
@@ -470,12 +470,12 @@ const bn = o.enum(["url", "magnet", "upload"]), oo = o.enum([
|
|
|
470
470
|
rejected: [],
|
|
471
471
|
failed: ["approved"]
|
|
472
472
|
};
|
|
473
|
-
Object.keys(
|
|
474
|
-
const
|
|
473
|
+
Object.keys(Tt).filter((e) => Tt[e].length === 0);
|
|
474
|
+
const ro = o.object({
|
|
475
475
|
id: o.string().min(1),
|
|
476
476
|
/** Stable userId from whoami. Never the raw `X-User-Key`. */
|
|
477
477
|
ownerUserId: o.string().min(1),
|
|
478
|
-
kind:
|
|
478
|
+
kind: yn,
|
|
479
479
|
/** The magnet URI, the https URL, or the filetransfer binding id. */
|
|
480
480
|
source: o.string().min(1),
|
|
481
481
|
title: o.string().optional(),
|
|
@@ -490,7 +490,7 @@ const ao = o.object({
|
|
|
490
490
|
* misroute the copy.
|
|
491
491
|
*/
|
|
492
492
|
series: o.string().optional(),
|
|
493
|
-
state:
|
|
493
|
+
state: no,
|
|
494
494
|
createdAt: o.number().int().nonnegative(),
|
|
495
495
|
updatedAt: o.number().int().nonnegative(),
|
|
496
496
|
/** Why it failed, or why an operator rejected it. */
|
|
@@ -498,19 +498,19 @@ const ao = o.object({
|
|
|
498
498
|
/** Size once known. 0 means "known to be empty"; absent means "not yet known" —
|
|
499
499
|
* the same distinction `chatImages` draws for image dimensions. */
|
|
500
500
|
bytes: o.number().int().nonnegative().optional()
|
|
501
|
-
}),
|
|
501
|
+
}), oo = 4096, bn = 300, ao = 100;
|
|
502
502
|
o.object({
|
|
503
|
-
kind:
|
|
504
|
-
source: o.string().min(1).max(
|
|
505
|
-
title: o.string().min(1).max(
|
|
503
|
+
kind: yn,
|
|
504
|
+
source: o.string().min(1).max(oo),
|
|
505
|
+
title: o.string().min(1).max(bn).optional(),
|
|
506
506
|
/** Required for `kind: 'magnet'` by `checkSource`; ignored for `url`/`upload`. */
|
|
507
|
-
series: o.string().min(1).max(
|
|
507
|
+
series: o.string().min(1).max(ao).optional()
|
|
508
508
|
});
|
|
509
509
|
o.object({
|
|
510
|
-
reason: o.string().min(1).max(
|
|
510
|
+
reason: o.string().min(1).max(bn).optional()
|
|
511
511
|
});
|
|
512
512
|
o.object({
|
|
513
|
-
submissions: o.array(
|
|
513
|
+
submissions: o.array(ro)
|
|
514
514
|
});
|
|
515
515
|
o.object({
|
|
516
516
|
error: o.literal("submissions/quota_exceeded"),
|
|
@@ -519,25 +519,25 @@ o.object({
|
|
|
519
519
|
/** The cap that was applied, from the server's config. */
|
|
520
520
|
capBytes: o.number().int().nonnegative()
|
|
521
521
|
});
|
|
522
|
-
const
|
|
523
|
-
function
|
|
522
|
+
const io = /^[a-z0-9][a-z0-9-]{0,31}$/, kt = "https://game-catalog.invalid";
|
|
523
|
+
function so(e) {
|
|
524
524
|
if (!e.startsWith("/") || e.startsWith("//") || /[\\\s]/.test(e) || [...e].some((t) => t.charCodeAt(0) < 32 || t.charCodeAt(0) === 127))
|
|
525
525
|
return !1;
|
|
526
526
|
try {
|
|
527
|
-
return new URL(e,
|
|
527
|
+
return new URL(e, kt).origin === kt;
|
|
528
528
|
} catch {
|
|
529
529
|
return !1;
|
|
530
530
|
}
|
|
531
531
|
}
|
|
532
|
-
const
|
|
532
|
+
const vn = o.string().min(2).max(512).refine(so, {
|
|
533
533
|
message: "must be a root-relative path on the page origin (e.g. /cardtable/embed/x.js)"
|
|
534
|
-
}),
|
|
535
|
-
id: o.string().regex(
|
|
534
|
+
}), lo = {
|
|
535
|
+
id: o.string().regex(io),
|
|
536
536
|
name: o.string().min(1).max(64),
|
|
537
|
-
cover:
|
|
538
|
-
},
|
|
539
|
-
o.array(
|
|
540
|
-
const ut = o.enum(["anilist", "tmdb"]),
|
|
537
|
+
cover: vn.optional()
|
|
538
|
+
}, co = o.object({ ...lo, kind: o.literal("module"), url: vn }).strict();
|
|
539
|
+
o.array(co).max(32).refine((e) => new Set(e.map((t) => t.id)).size === e.length, { message: "game ids must be unique" });
|
|
540
|
+
const ut = o.enum(["anilist", "tmdb"]), uo = o.object({
|
|
541
541
|
source: ut,
|
|
542
542
|
/** The provider's own id, as a string (AniList and TMDB both use integers). */
|
|
543
543
|
id: o.string(),
|
|
@@ -559,11 +559,11 @@ const ut = o.enum(["anilist", "tmdb"]), fo = o.object({
|
|
|
559
559
|
addable: o.boolean()
|
|
560
560
|
});
|
|
561
561
|
o.object({
|
|
562
|
-
results: o.array(
|
|
562
|
+
results: o.array(uo),
|
|
563
563
|
/** Providers that answered. TMDB is absent when no token is configured. */
|
|
564
564
|
sources: o.array(ut)
|
|
565
565
|
});
|
|
566
|
-
const
|
|
566
|
+
const mo = o.object({
|
|
567
567
|
id: o.string(),
|
|
568
568
|
url: o.string(),
|
|
569
569
|
title: o.string(),
|
|
@@ -571,30 +571,30 @@ const po = o.object({
|
|
|
571
571
|
durationS: o.number().nullable(),
|
|
572
572
|
thumb: o.string().nullable()
|
|
573
573
|
});
|
|
574
|
-
o.object({ results: o.array(
|
|
574
|
+
o.object({ results: o.array(mo) });
|
|
575
575
|
o.object({
|
|
576
576
|
source: ut,
|
|
577
577
|
id: o.string().regex(/^\d{1,12}$/)
|
|
578
578
|
});
|
|
579
579
|
o.object({ series: o.string(), title: o.string() });
|
|
580
|
-
let xe = null,
|
|
581
|
-
function
|
|
582
|
-
e.cdnBase && (
|
|
580
|
+
let xe = null, _n = on;
|
|
581
|
+
function fo(e) {
|
|
582
|
+
e.cdnBase && (_n = e.cdnBase);
|
|
583
583
|
}
|
|
584
|
-
function
|
|
585
|
-
return
|
|
584
|
+
function wn() {
|
|
585
|
+
return _n.replace(/\/+$/, "");
|
|
586
586
|
}
|
|
587
|
-
function
|
|
588
|
-
const e =
|
|
589
|
-
return (!xe || xe.base !== e) && (xe = { base: e, client:
|
|
587
|
+
function We() {
|
|
588
|
+
const e = wn();
|
|
589
|
+
return (!xe || xe.base !== e) && (xe = { base: e, client: sr({ cdnBase: e }) }), xe.client;
|
|
590
590
|
}
|
|
591
591
|
function je(e) {
|
|
592
|
-
return !
|
|
592
|
+
return !st(e) || !wn() ? null : We().urlFor(e);
|
|
593
593
|
}
|
|
594
|
-
function
|
|
594
|
+
function po(e) {
|
|
595
595
|
return e.kind === "file";
|
|
596
596
|
}
|
|
597
|
-
class
|
|
597
|
+
class Sn extends Error {
|
|
598
598
|
constructor(t) {
|
|
599
599
|
super(t), this.name = "ChatImageUploadError";
|
|
600
600
|
}
|
|
@@ -619,81 +619,81 @@ function Ae(e) {
|
|
|
619
619
|
return "Image upload failed";
|
|
620
620
|
}
|
|
621
621
|
}
|
|
622
|
-
function
|
|
623
|
-
return e instanceof
|
|
622
|
+
function ho(e) {
|
|
623
|
+
return e instanceof et ? Ae(e.reason) : e instanceof Sn ? e.message : "Image upload failed";
|
|
624
624
|
}
|
|
625
|
-
function
|
|
625
|
+
function go(e) {
|
|
626
626
|
const t = e.type.toLowerCase().split(";")[0].trim();
|
|
627
|
-
return t &&
|
|
627
|
+
return t && lr(t) !== "image" ? Ae("unsupported-type") : e.size > cr.image ? Ae("too-large") : e.size === 0 ? Ae("invalid") : null;
|
|
628
628
|
}
|
|
629
|
-
function
|
|
630
|
-
return
|
|
629
|
+
function yo(e) {
|
|
630
|
+
return ur(e);
|
|
631
631
|
}
|
|
632
|
-
function
|
|
633
|
-
return
|
|
632
|
+
function bo(e) {
|
|
633
|
+
return mr(e);
|
|
634
634
|
}
|
|
635
|
-
async function
|
|
636
|
-
const t = await
|
|
635
|
+
async function vo(e) {
|
|
636
|
+
const t = await dr(e);
|
|
637
637
|
return { w: t?.width ?? 0, h: t?.height ?? 0 };
|
|
638
638
|
}
|
|
639
|
-
async function
|
|
640
|
-
const n = await
|
|
641
|
-
if (!
|
|
642
|
-
throw new
|
|
639
|
+
async function _o(e, t = {}) {
|
|
640
|
+
const n = await We().upload(e, { signal: t.signal });
|
|
641
|
+
if (!st(n.key))
|
|
642
|
+
throw new Sn("Image upload returned an unusable key");
|
|
643
643
|
return { key: n.key, deduplicated: n.deduplicated === !0 };
|
|
644
644
|
}
|
|
645
|
-
async function
|
|
645
|
+
async function wo(e, t = {}) {
|
|
646
646
|
const n = [];
|
|
647
647
|
for (const r of e) {
|
|
648
648
|
if (r.kind === "remote") {
|
|
649
649
|
n.push({ key: r.key, w: r.w, h: r.h, ...r.title ? { title: r.title } : {} });
|
|
650
650
|
continue;
|
|
651
651
|
}
|
|
652
|
-
const { key: a } = await
|
|
652
|
+
const { key: a } = await _o(r.file, t);
|
|
653
653
|
n.push({ key: a, w: r.w, h: r.h });
|
|
654
654
|
}
|
|
655
655
|
return n;
|
|
656
656
|
}
|
|
657
|
-
function
|
|
657
|
+
function So(e) {
|
|
658
658
|
return {
|
|
659
659
|
error: e instanceof Error ? e.message : String(e),
|
|
660
660
|
name: e instanceof Error ? e.name : typeof e,
|
|
661
|
-
reason: e instanceof
|
|
662
|
-
status: e instanceof
|
|
661
|
+
reason: e instanceof et ? e.reason : void 0,
|
|
662
|
+
status: e instanceof et ? e.status : void 0
|
|
663
663
|
};
|
|
664
664
|
}
|
|
665
665
|
function mt(e) {
|
|
666
666
|
return e.key === "Escape" || e.key === "GoBack" || e.key === "BrowserBack" || e.key === "XF86Back" || e.keyCode === 461 || e.keyCode === 10009;
|
|
667
667
|
}
|
|
668
|
-
function
|
|
668
|
+
function xo(e) {
|
|
669
669
|
return `/tv?return=${encodeURIComponent(e.pathname + e.search)}`;
|
|
670
670
|
}
|
|
671
|
-
function
|
|
671
|
+
function Co({ className: e }) {
|
|
672
672
|
return /* @__PURE__ */ c(
|
|
673
673
|
"a",
|
|
674
674
|
{
|
|
675
|
-
href:
|
|
675
|
+
href: xo(window.location),
|
|
676
676
|
className: e,
|
|
677
677
|
"data-testid": "sign-in-with-code",
|
|
678
678
|
children: "Sign in with a code"
|
|
679
679
|
}
|
|
680
680
|
);
|
|
681
681
|
}
|
|
682
|
-
const
|
|
683
|
-
function
|
|
684
|
-
let r = t.left -
|
|
685
|
-
r < ne && (r = t.right + ne), r = Math.min(r, n.width -
|
|
686
|
-
const a =
|
|
682
|
+
const nt = 240, ne = 8, Io = 28, xn = 240;
|
|
683
|
+
function To(e, t, n) {
|
|
684
|
+
let r = t.left - nt - ne;
|
|
685
|
+
r < ne && (r = t.right + ne), r = Math.min(r, n.width - nt - ne), r = Math.max(ne, r);
|
|
686
|
+
const a = xn + Io;
|
|
687
687
|
let i = e.top + e.height / 2 - a / 2;
|
|
688
688
|
return i = Math.min(i, n.height - a - ne), i = Math.max(ne, i), { left: r, top: i };
|
|
689
689
|
}
|
|
690
|
-
const
|
|
691
|
-
function
|
|
692
|
-
const [r, a] = k(""), i = W(null), s = W(null), l =
|
|
690
|
+
const Cn = "/dataplatform/api/memes", ko = 120;
|
|
691
|
+
function Eo({ onClose: e, onPick: t, onUnavailable: n }) {
|
|
692
|
+
const [r, a] = k(""), i = W(null), s = W(null), l = We(), { items: d, loading: h, error: f, hasMore: M, loadMore: R } = Nr(
|
|
693
693
|
l,
|
|
694
|
-
|
|
694
|
+
Cn,
|
|
695
695
|
r.trim()
|
|
696
|
-
), D = f?.reason ?? null,
|
|
696
|
+
), D = f?.reason ?? null, H = ee(() => {
|
|
697
697
|
const C = /* @__PURE__ */ new Set();
|
|
698
698
|
return d.filter((O) => C.has(O.key) ? !1 : (C.add(O.key), !0));
|
|
699
699
|
}, [d]), [p, x] = k(null), w = W(null), y = A(() => {
|
|
@@ -702,16 +702,16 @@ function No({ onClose: e, onPick: t, onUnavailable: n }) {
|
|
|
702
702
|
y(), x(null);
|
|
703
703
|
}, [y]), T = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(hover: hover)").matches, N = A(
|
|
704
704
|
(C, O, P = !1) => {
|
|
705
|
-
const
|
|
706
|
-
if (!
|
|
705
|
+
const F = i.current;
|
|
706
|
+
if (!F) return;
|
|
707
707
|
const ae = () => x({
|
|
708
708
|
item: C,
|
|
709
|
-
...
|
|
709
|
+
...To(O.getBoundingClientRect(), F.getBoundingClientRect(), {
|
|
710
710
|
width: window.innerWidth,
|
|
711
711
|
height: window.innerHeight
|
|
712
712
|
})
|
|
713
713
|
});
|
|
714
|
-
y(), P ? ae() : w.current = window.setTimeout(ae,
|
|
714
|
+
y(), P ? ae() : w.current = window.setTimeout(ae, ko);
|
|
715
715
|
},
|
|
716
716
|
[y]
|
|
717
717
|
);
|
|
@@ -731,7 +731,7 @@ function No({ onClose: e, onPick: t, onUnavailable: n }) {
|
|
|
731
731
|
}, [e]);
|
|
732
732
|
const j = A((C) => {
|
|
733
733
|
t(C), e();
|
|
734
|
-
}, [t, e]), U = !h && !f &&
|
|
734
|
+
}, [t, e]), U = !h && !f && H.length === 0;
|
|
735
735
|
return /* @__PURE__ */ _(
|
|
736
736
|
"div",
|
|
737
737
|
{
|
|
@@ -769,12 +769,12 @@ function No({ onClose: e, onPick: t, onUnavailable: n }) {
|
|
|
769
769
|
"data-reason": D,
|
|
770
770
|
children: D === "unauthenticated" ? /* @__PURE__ */ _(le, { children: [
|
|
771
771
|
"Sign in to browse memes · ",
|
|
772
|
-
/* @__PURE__ */ c(
|
|
772
|
+
/* @__PURE__ */ c(Co, { className: "underline text-on-danger-bg" })
|
|
773
773
|
] }) : D === "forbidden" ? "Your account can't browse the meme library" : "Meme library is unavailable"
|
|
774
774
|
}
|
|
775
775
|
),
|
|
776
776
|
U && /* @__PURE__ */ c("p", { className: "p-4 text-center text-sm text-text-secondary", children: r.trim() ? `No memes match "${r.trim()}"` : "The meme library is empty" }),
|
|
777
|
-
|
|
777
|
+
H.length > 0 && /* @__PURE__ */ c("div", { className: "grid grid-cols-3 gap-1.5 sm:grid-cols-4", children: H.map((C) => {
|
|
778
778
|
const O = je(C.key);
|
|
779
779
|
return O ? /* @__PURE__ */ c(
|
|
780
780
|
"button",
|
|
@@ -826,7 +826,7 @@ function No({ onClose: e, onPick: t, onUnavailable: n }) {
|
|
|
826
826
|
style: {
|
|
827
827
|
left: p.left,
|
|
828
828
|
top: p.top,
|
|
829
|
-
width:
|
|
829
|
+
width: nt,
|
|
830
830
|
/* The placement maths reserves exactly PREVIEW_PX of width.
|
|
831
831
|
Without border-box the padding and border sit OUTSIDE that
|
|
832
832
|
number and the box laps over the panel it is meant to sit
|
|
@@ -843,7 +843,7 @@ function No({ onClose: e, onPick: t, onUnavailable: n }) {
|
|
|
843
843
|
src: je(p.item.key) ?? void 0,
|
|
844
844
|
alt: "",
|
|
845
845
|
className: "block w-full rounded bg-bg object-contain",
|
|
846
|
-
style: { height: "auto", maxHeight:
|
|
846
|
+
style: { height: "auto", maxHeight: xn }
|
|
847
847
|
}
|
|
848
848
|
),
|
|
849
849
|
p.item.title && /* One line. A long title must not change the box height, because
|
|
@@ -856,43 +856,43 @@ function No({ onClose: e, onPick: t, onUnavailable: n }) {
|
|
|
856
856
|
}
|
|
857
857
|
);
|
|
858
858
|
}
|
|
859
|
-
function
|
|
860
|
-
return e ? /* @__PURE__ */ c(
|
|
859
|
+
function Ao({ open: e, ...t }) {
|
|
860
|
+
return e ? /* @__PURE__ */ c(Eo, { ...t }) : null;
|
|
861
861
|
}
|
|
862
862
|
const ft = {
|
|
863
|
-
serverOrigin: `http://localhost:${
|
|
863
|
+
serverOrigin: `http://localhost:${lt}`,
|
|
864
864
|
defaultRoomKey: "dev-room",
|
|
865
|
-
cdnBase:
|
|
865
|
+
cdnBase: on
|
|
866
866
|
};
|
|
867
867
|
let Ne = { ...ft };
|
|
868
|
-
function
|
|
868
|
+
function No(e) {
|
|
869
869
|
const t = Object.fromEntries(
|
|
870
870
|
Object.entries(e).filter(([n, r]) => r !== void 0)
|
|
871
871
|
);
|
|
872
|
-
Ne = { ...Ne, ...t },
|
|
872
|
+
Ne = { ...Ne, ...t }, fo({ cdnBase: Ne.cdnBase });
|
|
873
873
|
}
|
|
874
874
|
function _e() {
|
|
875
875
|
return Ne;
|
|
876
876
|
}
|
|
877
|
-
const
|
|
878
|
-
function
|
|
877
|
+
const Po = it(ft);
|
|
878
|
+
function Ro(e) {
|
|
879
879
|
return e.serverOrigin?.replace(/\/$/, "") || "";
|
|
880
880
|
}
|
|
881
|
-
function
|
|
882
|
-
return
|
|
881
|
+
function In() {
|
|
882
|
+
return Ro(_e());
|
|
883
883
|
}
|
|
884
|
-
const
|
|
885
|
-
function
|
|
886
|
-
return
|
|
884
|
+
const Tn = it(null);
|
|
885
|
+
function Do() {
|
|
886
|
+
return Zt(Tn);
|
|
887
887
|
}
|
|
888
|
-
const
|
|
889
|
-
function
|
|
890
|
-
const e =
|
|
888
|
+
const kn = it(!0);
|
|
889
|
+
function En() {
|
|
890
|
+
const e = Zt(kn);
|
|
891
891
|
E(() => {
|
|
892
|
-
e &&
|
|
892
|
+
e && fr();
|
|
893
893
|
}, [e]);
|
|
894
894
|
}
|
|
895
|
-
function
|
|
895
|
+
function An(e) {
|
|
896
896
|
return e ? { "--hc-base": e } : {};
|
|
897
897
|
}
|
|
898
898
|
const ge = Le.memo(
|
|
@@ -901,7 +901,7 @@ const ge = Le.memo(
|
|
|
901
901
|
},
|
|
902
902
|
(e, t) => e.html === t.html && e.as === t.as && e.className === t.className && JSON.stringify(e.style) === JSON.stringify(t.style)
|
|
903
903
|
);
|
|
904
|
-
function
|
|
904
|
+
function Oo(e, t) {
|
|
905
905
|
E(() => {
|
|
906
906
|
const n = e.current;
|
|
907
907
|
if (!n || !t || typeof IntersectionObserver > "u") return;
|
|
@@ -919,7 +919,7 @@ const de = {
|
|
|
919
919
|
REPORT_LOGS_FLAG: "wp:reportLogs",
|
|
920
920
|
voteKey: (e, t, n) => `watchparty_vote:${e}:${t}:${n}`
|
|
921
921
|
};
|
|
922
|
-
function
|
|
922
|
+
function qe() {
|
|
923
923
|
try {
|
|
924
924
|
return globalThis.localStorage ?? null;
|
|
925
925
|
} catch {
|
|
@@ -928,22 +928,22 @@ function We() {
|
|
|
928
928
|
}
|
|
929
929
|
function G(e) {
|
|
930
930
|
try {
|
|
931
|
-
return
|
|
931
|
+
return qe()?.getItem(e) ?? null;
|
|
932
932
|
} catch {
|
|
933
933
|
return null;
|
|
934
934
|
}
|
|
935
935
|
}
|
|
936
936
|
function pt(e, t) {
|
|
937
937
|
try {
|
|
938
|
-
const n =
|
|
938
|
+
const n = qe();
|
|
939
939
|
return n ? (n.setItem(e, t), !0) : !1;
|
|
940
940
|
} catch {
|
|
941
941
|
return !1;
|
|
942
942
|
}
|
|
943
943
|
}
|
|
944
|
-
function
|
|
944
|
+
function Mo() {
|
|
945
945
|
try {
|
|
946
|
-
const e =
|
|
946
|
+
const e = qe();
|
|
947
947
|
if (!e) return [];
|
|
948
948
|
const t = [];
|
|
949
949
|
for (let n = 0; n < e.length; n++) {
|
|
@@ -957,49 +957,49 @@ function jo() {
|
|
|
957
957
|
}
|
|
958
958
|
function Ue(e) {
|
|
959
959
|
try {
|
|
960
|
-
|
|
960
|
+
qe()?.removeItem(e);
|
|
961
961
|
} catch {
|
|
962
962
|
}
|
|
963
963
|
}
|
|
964
|
-
function
|
|
964
|
+
function Lo(e) {
|
|
965
965
|
const t = G(e);
|
|
966
966
|
return t === null ? null : t === "true" ? !0 : t === "false" ? !1 : null;
|
|
967
967
|
}
|
|
968
|
-
const
|
|
969
|
-
let
|
|
968
|
+
const Nn = /* @__PURE__ */ new Map();
|
|
969
|
+
let Pn = !1;
|
|
970
970
|
function Ve(e, t) {
|
|
971
|
-
|
|
971
|
+
Nn.set(e, t), Pn && Rn(e, t);
|
|
972
972
|
}
|
|
973
|
-
function
|
|
974
|
-
|
|
975
|
-
for (const [e, t] of
|
|
973
|
+
function jo() {
|
|
974
|
+
Pn = !0;
|
|
975
|
+
for (const [e, t] of Nn) Rn(e, t);
|
|
976
976
|
}
|
|
977
|
-
function
|
|
977
|
+
function Rn(e, t) {
|
|
978
978
|
typeof window > "u" || (window[e] = t);
|
|
979
979
|
}
|
|
980
|
-
const pe = [],
|
|
981
|
-
let Pe = [],
|
|
982
|
-
const
|
|
983
|
-
let
|
|
984
|
-
function
|
|
985
|
-
|
|
980
|
+
const pe = [], Uo = 500;
|
|
981
|
+
let Pe = [], rt = null;
|
|
982
|
+
const Ho = 1e3, Fo = 200;
|
|
983
|
+
let ot = null;
|
|
984
|
+
function Dn(e) {
|
|
985
|
+
ot = e;
|
|
986
986
|
}
|
|
987
|
-
function
|
|
987
|
+
function On() {
|
|
988
988
|
return G(de.REPORT_LOGS_FLAG) === "true";
|
|
989
989
|
}
|
|
990
|
-
function
|
|
990
|
+
function $o() {
|
|
991
991
|
if (typeof window > "u") return !1;
|
|
992
992
|
if (window.__WP_DEBUG__ || new URLSearchParams(window.location.search).get("debug") === "true") return !0;
|
|
993
993
|
const t = G(de.DEBUG_FLAG);
|
|
994
994
|
return t !== null && t !== "false";
|
|
995
995
|
}
|
|
996
|
-
function
|
|
996
|
+
function Bo() {
|
|
997
997
|
const e = G(de.DEBUG_FLAG);
|
|
998
998
|
if (!e || e === "true") return null;
|
|
999
999
|
const t = e.split(",").map((n) => n.trim().toLowerCase()).filter(Boolean);
|
|
1000
1000
|
return t.length > 0 ? new Set(t) : null;
|
|
1001
1001
|
}
|
|
1002
|
-
function
|
|
1002
|
+
function Go() {
|
|
1003
1003
|
return (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", {
|
|
1004
1004
|
hour12: !1,
|
|
1005
1005
|
hour: "2-digit",
|
|
@@ -1008,17 +1008,17 @@ function Vo() {
|
|
|
1008
1008
|
fractionalSecondDigits: 3
|
|
1009
1009
|
});
|
|
1010
1010
|
}
|
|
1011
|
-
function
|
|
1012
|
-
pe.push(e), pe.length >
|
|
1011
|
+
function Wo(e) {
|
|
1012
|
+
pe.push(e), pe.length > Uo && pe.shift();
|
|
1013
1013
|
}
|
|
1014
|
-
const
|
|
1014
|
+
const Ke = {
|
|
1015
1015
|
debug: "color: #64748b; font-weight: normal;",
|
|
1016
1016
|
warn: "color: #f59e0b; font-weight: bold;",
|
|
1017
1017
|
error: "color: #ef4444; font-weight: bold;",
|
|
1018
1018
|
category: "color: #3b82f6; font-weight: bold;",
|
|
1019
1019
|
time: "color: #6b7280; font-weight: normal;"
|
|
1020
1020
|
};
|
|
1021
|
-
function
|
|
1021
|
+
function qo(e) {
|
|
1022
1022
|
try {
|
|
1023
1023
|
return JSON.stringify(e);
|
|
1024
1024
|
} catch {
|
|
@@ -1033,17 +1033,17 @@ function ht(e, t, n, r, a, i, s) {
|
|
|
1033
1033
|
data: s,
|
|
1034
1034
|
timestamp: Date.now()
|
|
1035
1035
|
};
|
|
1036
|
-
if (
|
|
1037
|
-
if (
|
|
1038
|
-
const f =
|
|
1036
|
+
if (Wo(l), (n || On()) && Et(l), !r) {
|
|
1037
|
+
if (!$o()) return;
|
|
1038
|
+
const f = Bo();
|
|
1039
1039
|
if (f && !f.has(a.toLowerCase())) return;
|
|
1040
1040
|
}
|
|
1041
|
-
const d =
|
|
1041
|
+
const d = Go(), h = s !== void 0 ? " " + qo(s) : "";
|
|
1042
1042
|
t(
|
|
1043
1043
|
`%c[${d}]%c [${a}]%c ${i}${h}`,
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1044
|
+
Ke.time,
|
|
1045
|
+
Ke.category,
|
|
1046
|
+
Ke[e]
|
|
1047
1047
|
);
|
|
1048
1048
|
}
|
|
1049
1049
|
function u(e, t, n) {
|
|
@@ -1055,25 +1055,25 @@ function I(e, t, n) {
|
|
|
1055
1055
|
function Re(e, t, n) {
|
|
1056
1056
|
ht("error", console.error, !0, !0, e, t, n);
|
|
1057
1057
|
}
|
|
1058
|
-
function
|
|
1058
|
+
function Vo() {
|
|
1059
1059
|
return [...pe];
|
|
1060
1060
|
}
|
|
1061
|
-
function
|
|
1061
|
+
function Ko() {
|
|
1062
1062
|
pe.length = 0;
|
|
1063
1063
|
}
|
|
1064
|
-
function
|
|
1064
|
+
function Yo(e) {
|
|
1065
1065
|
const t = e && e.length > 0 ? e.join(",") : "true";
|
|
1066
1066
|
pt(de.DEBUG_FLAG, t), console.log("[wp] Debug mode enabled");
|
|
1067
1067
|
}
|
|
1068
|
-
function
|
|
1068
|
+
function zo() {
|
|
1069
1069
|
Ue(de.DEBUG_FLAG), console.log("[wp] Debug mode disabled");
|
|
1070
1070
|
}
|
|
1071
|
-
const
|
|
1072
|
-
function
|
|
1071
|
+
const Xo = 1024, Jo = 5e4;
|
|
1072
|
+
function Qo(e) {
|
|
1073
1073
|
if (e == null) return e;
|
|
1074
1074
|
try {
|
|
1075
1075
|
const t = JSON.stringify(e);
|
|
1076
|
-
if (t.length <=
|
|
1076
|
+
if (t.length <= Xo) return e;
|
|
1077
1077
|
if (typeof e == "object" && !Array.isArray(e)) {
|
|
1078
1078
|
const n = {};
|
|
1079
1079
|
for (const [r, a] of Object.entries(e)) {
|
|
@@ -1087,31 +1087,31 @@ function ea(e) {
|
|
|
1087
1087
|
return "[unserializable]";
|
|
1088
1088
|
}
|
|
1089
1089
|
}
|
|
1090
|
-
async function
|
|
1090
|
+
async function Zo() {
|
|
1091
1091
|
if (Pe.length === 0) return;
|
|
1092
1092
|
const e = Pe;
|
|
1093
|
-
Pe = [],
|
|
1093
|
+
Pe = [], rt = null;
|
|
1094
1094
|
try {
|
|
1095
1095
|
let n = _e().serverOrigin || "";
|
|
1096
1096
|
if ((n === "/" || !n) && typeof window < "u") {
|
|
1097
1097
|
const l = window.location;
|
|
1098
|
-
(l.hostname === "localhost" || l.hostname === "127.0.0.1") && l.port === String(
|
|
1098
|
+
(l.hostname === "localhost" || l.hostname === "127.0.0.1") && l.port === String(sn) ? n = `${l.protocol}//${l.hostname}:${lt}` : n = l.origin;
|
|
1099
1099
|
}
|
|
1100
1100
|
const r = `${n.replace(/\/$/, "")}/api/client-log`, a = e.map((l) => ({
|
|
1101
1101
|
level: l.level,
|
|
1102
1102
|
category: l.category,
|
|
1103
1103
|
message: l.message,
|
|
1104
|
-
data:
|
|
1104
|
+
data: Qo(l.data),
|
|
1105
1105
|
timestamp: l.timestamp,
|
|
1106
1106
|
url: typeof window < "u" ? window.location.href : void 0,
|
|
1107
1107
|
userAgent: typeof navigator < "u" ? navigator.userAgent : void 0,
|
|
1108
|
-
room_key:
|
|
1109
|
-
client_id:
|
|
1108
|
+
room_key: ot?.room_key,
|
|
1109
|
+
client_id: ot?.client_id
|
|
1110
1110
|
}));
|
|
1111
1111
|
let i = [], s = 0;
|
|
1112
1112
|
for (const l of a) {
|
|
1113
1113
|
const d = JSON.stringify(l).length + 1;
|
|
1114
|
-
s + d >
|
|
1114
|
+
s + d > Jo && i.length > 0 && (await fetch(r, {
|
|
1115
1115
|
method: "POST",
|
|
1116
1116
|
headers: { "Content-Type": "application/json" },
|
|
1117
1117
|
body: JSON.stringify({ logs: i })
|
|
@@ -1126,11 +1126,11 @@ async function ta() {
|
|
|
1126
1126
|
console.warn("[wp] log flush failed (client logs may be lost):", we(t).error);
|
|
1127
1127
|
}
|
|
1128
1128
|
}
|
|
1129
|
-
function
|
|
1130
|
-
if (Pe.push(e), !
|
|
1131
|
-
const t =
|
|
1132
|
-
|
|
1133
|
-
|
|
1129
|
+
function Et(e) {
|
|
1130
|
+
if (Pe.push(e), !rt) {
|
|
1131
|
+
const t = On() ? Fo : Ho;
|
|
1132
|
+
rt = setTimeout(() => {
|
|
1133
|
+
Zo();
|
|
1134
1134
|
}, t);
|
|
1135
1135
|
}
|
|
1136
1136
|
}
|
|
@@ -1138,16 +1138,16 @@ function we(e) {
|
|
|
1138
1138
|
return e instanceof Error ? { error: e.message, name: e.name } : { error: String(e), name: typeof e };
|
|
1139
1139
|
}
|
|
1140
1140
|
Ve("__wpDebug", {
|
|
1141
|
-
enable:
|
|
1142
|
-
disable:
|
|
1143
|
-
history:
|
|
1144
|
-
clear:
|
|
1141
|
+
enable: Yo,
|
|
1142
|
+
disable: zo,
|
|
1143
|
+
history: Vo,
|
|
1144
|
+
clear: Ko
|
|
1145
1145
|
});
|
|
1146
|
-
const
|
|
1147
|
-
function
|
|
1148
|
-
return e.screenWidth <
|
|
1146
|
+
const ea = 1280;
|
|
1147
|
+
function ta(e) {
|
|
1148
|
+
return e.screenWidth < ea ? !1 : e.noHoverNoPointer || e.anyHoverNone && e.maxTouchPoints === 0;
|
|
1149
1149
|
}
|
|
1150
|
-
function
|
|
1150
|
+
function na() {
|
|
1151
1151
|
const e = (t) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(t).matches;
|
|
1152
1152
|
return {
|
|
1153
1153
|
noHoverNoPointer: e("(hover: none) and (pointer: none)"),
|
|
@@ -1156,12 +1156,12 @@ function oa() {
|
|
|
1156
1156
|
screenWidth: typeof screen < "u" ? screen.width : 0
|
|
1157
1157
|
};
|
|
1158
1158
|
}
|
|
1159
|
-
let
|
|
1160
|
-
function
|
|
1161
|
-
return
|
|
1159
|
+
let At = null;
|
|
1160
|
+
function ra() {
|
|
1161
|
+
return At ??= ta(na()), At;
|
|
1162
1162
|
}
|
|
1163
|
-
function
|
|
1164
|
-
return
|
|
1163
|
+
function Nt() {
|
|
1164
|
+
return ra();
|
|
1165
1165
|
}
|
|
1166
1166
|
const Q = {
|
|
1167
1167
|
resolved: !1,
|
|
@@ -1171,23 +1171,23 @@ const Q = {
|
|
|
1171
1171
|
function gt() {
|
|
1172
1172
|
return Q.accountId ? Q.accountId : Q.resolved && Q.userType === "public" ? "anon" : null;
|
|
1173
1173
|
}
|
|
1174
|
-
function
|
|
1174
|
+
function oa(e) {
|
|
1175
1175
|
Q.resolved = !0, e.userType && (Q.userType = e.userType), e.userId !== void 0 && (Q.accountId = e.userId && e.userId !== "public" ? e.userId : null);
|
|
1176
1176
|
}
|
|
1177
1177
|
function yt() {
|
|
1178
1178
|
return Q.accountId ?? "public";
|
|
1179
1179
|
}
|
|
1180
|
-
function
|
|
1180
|
+
function aa() {
|
|
1181
1181
|
return gt() ?? "unscoped";
|
|
1182
1182
|
}
|
|
1183
|
-
function
|
|
1184
|
-
return
|
|
1183
|
+
function Mn(e) {
|
|
1184
|
+
return Ge(e) ? Kr[e] : "var(--color-neutral-bg)";
|
|
1185
1185
|
}
|
|
1186
|
-
function
|
|
1187
|
-
return
|
|
1186
|
+
function ia(e) {
|
|
1187
|
+
return Ge(e) ? `${_e().serverOrigin.replace(/\/$/, "")}${zr(e)}` : void 0;
|
|
1188
1188
|
}
|
|
1189
1189
|
let ye = null, Ce = null;
|
|
1190
|
-
function
|
|
1190
|
+
function sa() {
|
|
1191
1191
|
return ye ? Promise.resolve() : Ce || (Ce = (async () => {
|
|
1192
1192
|
try {
|
|
1193
1193
|
const e = _e().serverOrigin.replace(/\/$/, ""), t = await fetch(`${e}/media/sprites/names.json`, { cache: "no-cache" });
|
|
@@ -1206,7 +1206,7 @@ function re(e) {
|
|
|
1206
1206
|
const t = e.toLowerCase();
|
|
1207
1207
|
return Be.some((n) => n === t) ? !0 : ye ? Object.values(ye).some((n) => n.toLowerCase() === t) : !1;
|
|
1208
1208
|
}
|
|
1209
|
-
const
|
|
1209
|
+
const la = o.object({
|
|
1210
1210
|
// Identity. There is deliberately NO `name`: a person's name is their
|
|
1211
1211
|
// hadoku key-registry name, resolved by the server from whoami and renamed
|
|
1212
1212
|
// through hadoku_site's POST /session/name (operator decision 2026-10-08).
|
|
@@ -1231,19 +1231,19 @@ const da = o.object({
|
|
|
1231
1231
|
preferredAudioLang: o.string().optional(),
|
|
1232
1232
|
subtitlesEnabled: o.boolean().optional(),
|
|
1233
1233
|
subtitleStyle: o.string().optional()
|
|
1234
|
-
}), he =
|
|
1234
|
+
}), he = Sr({
|
|
1235
1235
|
appId: "watchparty",
|
|
1236
|
-
schema:
|
|
1237
|
-
}),
|
|
1238
|
-
function
|
|
1236
|
+
schema: la
|
|
1237
|
+
}), ca = /* @__PURE__ */ new Set(["theme", "themeMode"]);
|
|
1238
|
+
function He(e) {
|
|
1239
1239
|
const t = gt();
|
|
1240
1240
|
return t ? `prefs-cache:${t}:${e}` : null;
|
|
1241
1241
|
}
|
|
1242
|
-
function
|
|
1242
|
+
function da() {
|
|
1243
1243
|
return gt() === null;
|
|
1244
1244
|
}
|
|
1245
|
-
function
|
|
1246
|
-
const t =
|
|
1245
|
+
function Pt(e) {
|
|
1246
|
+
const t = He(e);
|
|
1247
1247
|
if (!t) return {};
|
|
1248
1248
|
const n = G(t);
|
|
1249
1249
|
if (!n) return {};
|
|
@@ -1253,10 +1253,10 @@ function Rt(e) {
|
|
|
1253
1253
|
return {};
|
|
1254
1254
|
}
|
|
1255
1255
|
}
|
|
1256
|
-
function
|
|
1256
|
+
function ua() {
|
|
1257
1257
|
let e = 0;
|
|
1258
|
-
for (const t of
|
|
1259
|
-
const n = t.startsWith("prefs-cache:") && t.endsWith(":watchparty"), r = t ===
|
|
1258
|
+
for (const t of Mo()) {
|
|
1259
|
+
const n = t.startsWith("prefs-cache:") && t.endsWith(":watchparty"), r = t === Fe || t.startsWith(`${Fe}:`) && !t.endsWith(":_serverSynced_v1");
|
|
1260
1260
|
if (!n && !r) continue;
|
|
1261
1261
|
const a = G(t);
|
|
1262
1262
|
if (!a) continue;
|
|
@@ -1273,13 +1273,13 @@ function fa() {
|
|
|
1273
1273
|
}
|
|
1274
1274
|
return e > 0 && u("preferences", "Stripped retired name from cached prefs rows", { rewritten: e }), e;
|
|
1275
1275
|
}
|
|
1276
|
-
let
|
|
1277
|
-
const
|
|
1276
|
+
let Ln = null, jn = null;
|
|
1277
|
+
const Rt = /* @__PURE__ */ new Set();
|
|
1278
1278
|
function bt() {
|
|
1279
|
-
if (
|
|
1279
|
+
if (da())
|
|
1280
1280
|
return u("preferences", "Boot read deferred — session pending, identity unresolved"), {};
|
|
1281
|
-
const e =
|
|
1282
|
-
if (
|
|
1281
|
+
const e = Pt("portfolio"), t = Pt("watchparty"), n = Object.keys(e).length > 0 ? e : Ln ?? {}, r = Object.keys(t).length > 0 ? t : jn ?? {}, a = yt() || "public";
|
|
1282
|
+
if (Rt.has(a))
|
|
1283
1283
|
return u("preferences", "Loaded (sync, SDK-only after first read)", {
|
|
1284
1284
|
uid: a,
|
|
1285
1285
|
sdkThemeKeys: Object.keys(n).length,
|
|
@@ -1289,7 +1289,7 @@ function bt() {
|
|
|
1289
1289
|
themeSource: Object.keys(e).length > 0 ? "cache" : "mem",
|
|
1290
1290
|
appSource: Object.keys(t).length > 0 ? "cache" : "mem"
|
|
1291
1291
|
}), { ...r, ...n };
|
|
1292
|
-
|
|
1292
|
+
Rt.add(a);
|
|
1293
1293
|
const i = Hn() ?? {}, s = { ...i, ...r, ...n };
|
|
1294
1294
|
return u("preferences", "Loaded (sync, first read — legacy + SDK)", {
|
|
1295
1295
|
uid: a,
|
|
@@ -1300,42 +1300,42 @@ function bt() {
|
|
|
1300
1300
|
appSource: Object.keys(t).length > 0 ? "cache" : "mem"
|
|
1301
1301
|
}), s;
|
|
1302
1302
|
}
|
|
1303
|
-
let
|
|
1304
|
-
function
|
|
1303
|
+
let Un = !1;
|
|
1304
|
+
function ma() {
|
|
1305
1305
|
const e = yt();
|
|
1306
1306
|
return !e || e === "public";
|
|
1307
1307
|
}
|
|
1308
|
-
function
|
|
1309
|
-
|
|
1308
|
+
function q(e, t) {
|
|
1309
|
+
ma() && (Un = !0), ca.has(e) ? fe.save({ [e]: t }, { scope: "device" }).catch((n) => I("preferences", "themePrefs.save failed", { key: e, err: n?.message })) : he.save({ [e]: t }).catch((n) => I("preferences", "watchpartyPrefs.save failed", { key: e, err: n?.message })), u("preferences", "Saved (via SDK)", { key: e, value: t });
|
|
1310
1310
|
}
|
|
1311
|
-
let Ie = null,
|
|
1312
|
-
function
|
|
1311
|
+
let Ie = null, Dt = !1;
|
|
1312
|
+
function fa() {
|
|
1313
1313
|
return Ie || (Ie = (async () => {
|
|
1314
1314
|
if (typeof window > "u") return !1;
|
|
1315
1315
|
try {
|
|
1316
|
-
|
|
1317
|
-
|
|
1316
|
+
Dt || (Dt = !0, fe.subscribe((s) => {
|
|
1317
|
+
Ln = s, Lt("portfolio", s), jt("theme");
|
|
1318
1318
|
}), he.subscribe((s) => {
|
|
1319
|
-
|
|
1319
|
+
jn = s, Lt("watchparty", s), jt("watchparty");
|
|
1320
1320
|
}));
|
|
1321
1321
|
const [e, t] = await Promise.all([
|
|
1322
1322
|
fe.read(),
|
|
1323
1323
|
he.read()
|
|
1324
1324
|
]);
|
|
1325
1325
|
try {
|
|
1326
|
-
const { useAppStore: s } = await Promise.resolve().then(() =>
|
|
1326
|
+
const { useAppStore: s } = await Promise.resolve().then(() => Bn);
|
|
1327
1327
|
s.getState().rehydrateFromPrefs();
|
|
1328
1328
|
} catch (s) {
|
|
1329
1329
|
I("preferences", "inline rehydrate after SDK read failed", { err: s?.message });
|
|
1330
1330
|
}
|
|
1331
|
-
const n =
|
|
1331
|
+
const n = He("portfolio"), r = He("watchparty"), a = n ? G(n) : null, i = r ? G(r) : null;
|
|
1332
1332
|
return u("preferences", "sdk.read", {
|
|
1333
1333
|
themeKeys: Object.keys(e ?? {}),
|
|
1334
1334
|
appKeys: Object.keys(t ?? {}),
|
|
1335
1335
|
// Post-fetch cache state: should be non-zero if SDK wrote it.
|
|
1336
1336
|
sdkThemeBytesPost: a?.length ?? 0,
|
|
1337
1337
|
sdkAppBytesPost: i?.length ?? 0
|
|
1338
|
-
}), await
|
|
1338
|
+
}), await pa(e, t), Un ? (u("preferences", "Promoting this load's pre-auth picks to the signed-in user"), await Promise.all([
|
|
1339
1339
|
fe.promoteAnonPrefsToUser().catch(() => {
|
|
1340
1340
|
}),
|
|
1341
1341
|
he.promoteAnonPrefsToUser().catch(() => {
|
|
@@ -1346,14 +1346,14 @@ function ha() {
|
|
|
1346
1346
|
}
|
|
1347
1347
|
})(), Ie);
|
|
1348
1348
|
}
|
|
1349
|
-
const
|
|
1350
|
-
|
|
1351
|
-
function
|
|
1349
|
+
const Fe = "watchparty_preferences";
|
|
1350
|
+
ua();
|
|
1351
|
+
function at() {
|
|
1352
1352
|
const e = yt();
|
|
1353
|
-
return !e || e === "public" ?
|
|
1353
|
+
return !e || e === "public" ? Fe : `${Fe}:${e}`;
|
|
1354
1354
|
}
|
|
1355
1355
|
function Hn() {
|
|
1356
|
-
const e = G(
|
|
1356
|
+
const e = G(at());
|
|
1357
1357
|
if (!e) return null;
|
|
1358
1358
|
try {
|
|
1359
1359
|
const t = JSON.parse(e);
|
|
@@ -1362,10 +1362,10 @@ function Hn() {
|
|
|
1362
1362
|
return null;
|
|
1363
1363
|
}
|
|
1364
1364
|
}
|
|
1365
|
-
function
|
|
1366
|
-
Ue(
|
|
1365
|
+
function Ot() {
|
|
1366
|
+
Ue(at()), Ue(`${at()}:_serverSynced_v1`);
|
|
1367
1367
|
}
|
|
1368
|
-
async function
|
|
1368
|
+
async function pa(e, t) {
|
|
1369
1369
|
const n = Hn();
|
|
1370
1370
|
if (!n || Object.keys(n).length === 0) return;
|
|
1371
1371
|
const r = Object.keys(e ?? {}).length > 0, a = Object.keys(t ?? {}).length > 0, i = {}, s = {};
|
|
@@ -1373,7 +1373,7 @@ async function ga(e, t) {
|
|
|
1373
1373
|
r || (h === "theme" && typeof f == "string" ? i.theme = f : h === "themeMode" && (f === "simple" || f === "advanced") && (i.themeMode = f)), a || (h === "chatCollapsed" && typeof f == "boolean" ? s.chatCollapsed = f : h === "floatingChatEnabled" && typeof f == "boolean" ? s.floatingChatEnabled = f : h === "volume" && typeof f == "number" && f >= 0 && f <= 1 ? s.volume = f : h === "muted" && typeof f == "boolean" ? s.muted = f : h === "preferredAudioLang" && typeof f == "string" ? s.preferredAudioLang = f : h === "subtitlesEnabled" && typeof f == "boolean" ? s.subtitlesEnabled = f : h === "subtitleStyle" && typeof f == "string" && (s.subtitleStyle = f));
|
|
1374
1374
|
const l = Object.keys(i), d = Object.keys(s);
|
|
1375
1375
|
if (l.length === 0 && d.length === 0) {
|
|
1376
|
-
|
|
1376
|
+
Ot();
|
|
1377
1377
|
return;
|
|
1378
1378
|
}
|
|
1379
1379
|
u("preferences", "Migrating legacy localStorage prefs to SDK", {
|
|
@@ -1386,16 +1386,16 @@ async function ga(e, t) {
|
|
|
1386
1386
|
await Promise.all([
|
|
1387
1387
|
l.length > 0 ? fe.save(i, { scope: "device" }) : Promise.resolve(),
|
|
1388
1388
|
d.length > 0 ? he.save(s) : Promise.resolve()
|
|
1389
|
-
]),
|
|
1389
|
+
]), Ot(), u("preferences", "Legacy migration complete");
|
|
1390
1390
|
} catch (h) {
|
|
1391
1391
|
I("preferences", "Legacy migration save failed — will retry next load", {
|
|
1392
1392
|
err: h?.message
|
|
1393
1393
|
});
|
|
1394
1394
|
}
|
|
1395
1395
|
}
|
|
1396
|
-
let
|
|
1397
|
-
function
|
|
1398
|
-
const n =
|
|
1396
|
+
let Mt = !1;
|
|
1397
|
+
function Lt(e, t) {
|
|
1398
|
+
const n = He(e);
|
|
1399
1399
|
if (n)
|
|
1400
1400
|
try {
|
|
1401
1401
|
const r = {
|
|
@@ -1406,15 +1406,15 @@ function jt(e, t) {
|
|
|
1406
1406
|
};
|
|
1407
1407
|
localStorage.setItem(n, JSON.stringify(r));
|
|
1408
1408
|
} catch (r) {
|
|
1409
|
-
|
|
1409
|
+
Mt || (Mt = !0, I("preferences", "writeThrough localStorage failed (in-memory backstop only)", {
|
|
1410
1410
|
appId: e,
|
|
1411
1411
|
err: r?.message,
|
|
1412
1412
|
name: r?.name
|
|
1413
1413
|
}));
|
|
1414
1414
|
}
|
|
1415
1415
|
}
|
|
1416
|
-
function
|
|
1417
|
-
Promise.resolve().then(() =>
|
|
1416
|
+
function jt(e) {
|
|
1417
|
+
Promise.resolve().then(() => Bn).then(({ useAppStore: t }) => {
|
|
1418
1418
|
try {
|
|
1419
1419
|
t.getState().rehydrateFromPrefs();
|
|
1420
1420
|
} catch (n) {
|
|
@@ -1422,21 +1422,21 @@ function Ut(e) {
|
|
|
1422
1422
|
}
|
|
1423
1423
|
}).catch((t) => I("preferences", "store import failed", { reason: e, err: t?.message }));
|
|
1424
1424
|
}
|
|
1425
|
-
const
|
|
1425
|
+
const Fn = 320, $e = 240, vt = 640, ha = 320, ga = 36, Ut = 16;
|
|
1426
1426
|
function Y(e, t) {
|
|
1427
|
-
if (!Number.isFinite(e)) return
|
|
1427
|
+
if (!Number.isFinite(e)) return Fn;
|
|
1428
1428
|
let n = vt;
|
|
1429
|
-
return t !== void 0 && Number.isFinite(t) && t > 0 && (n = Math.min(n, t -
|
|
1429
|
+
return t !== void 0 && Number.isFinite(t) && t > 0 && (n = Math.min(n, t - ha)), n = Math.max(n, $e), Math.round(Math.min(n, Math.max($e, e)));
|
|
1430
1430
|
}
|
|
1431
1431
|
function Ht(e, t, n, r) {
|
|
1432
1432
|
return Y(e + (t - n), r);
|
|
1433
1433
|
}
|
|
1434
|
-
function
|
|
1434
|
+
function ya(e, t, n) {
|
|
1435
1435
|
switch (t) {
|
|
1436
1436
|
case "ArrowLeft":
|
|
1437
|
-
return Y(e +
|
|
1437
|
+
return Y(e + Ut, n);
|
|
1438
1438
|
case "ArrowRight":
|
|
1439
|
-
return Y(e -
|
|
1439
|
+
return Y(e - Ut, n);
|
|
1440
1440
|
case "Home":
|
|
1441
1441
|
return Y($e, n);
|
|
1442
1442
|
case "End":
|
|
@@ -1445,14 +1445,14 @@ function va(e, t, n) {
|
|
|
1445
1445
|
return null;
|
|
1446
1446
|
}
|
|
1447
1447
|
}
|
|
1448
|
-
function
|
|
1449
|
-
return { collapsed: e, width: e ?
|
|
1448
|
+
function ba(e, t) {
|
|
1449
|
+
return { collapsed: e, width: e ? ga : t };
|
|
1450
1450
|
}
|
|
1451
|
-
function
|
|
1451
|
+
function $n(e, t) {
|
|
1452
1452
|
const n = new Set(t.map((i) => i.id)), r = t.reduce((i, s) => Math.max(i, s.ts), -1 / 0), a = e.filter((i) => !n.has(i.id) && i.ts > r);
|
|
1453
1453
|
return a.length ? [...t, ...a] : t;
|
|
1454
1454
|
}
|
|
1455
|
-
const
|
|
1455
|
+
const V = bt(), m = _r((e, t) => ({
|
|
1456
1456
|
ready: !1,
|
|
1457
1457
|
name: "",
|
|
1458
1458
|
sprite: null,
|
|
@@ -1460,9 +1460,9 @@ const q = bt(), m = Cr((e, t) => ({
|
|
|
1460
1460
|
snapshot: { roomId: null, mediaId: null, playheadMs: 0, playing: !1, serverSeq: 0, leaderId: null },
|
|
1461
1461
|
roster: {},
|
|
1462
1462
|
chat: [],
|
|
1463
|
-
chatCollapsed:
|
|
1464
|
-
chromeChatCollapsed:
|
|
1465
|
-
chromeChatWidth: Y(
|
|
1463
|
+
chatCollapsed: V.chatCollapsed ?? !1,
|
|
1464
|
+
chromeChatCollapsed: V.chromeChatCollapsed ?? !1,
|
|
1465
|
+
chromeChatWidth: Y(V.chromeChatWidth ?? Fn),
|
|
1466
1466
|
// Hardcoded on for everyone — the per-user toggle was removed from the
|
|
1467
1467
|
// control bar; FloatingChat + toggleFloatingChat code is kept for future
|
|
1468
1468
|
// re-enablement but the value is no longer user-controllable.
|
|
@@ -1474,11 +1474,11 @@ const q = bt(), m = Cr((e, t) => ({
|
|
|
1474
1474
|
bufferState: { isBuffering: !1, bufferedEndMs: 0 },
|
|
1475
1475
|
toasts: [],
|
|
1476
1476
|
mediaPrefs: {
|
|
1477
|
-
volume:
|
|
1478
|
-
muted:
|
|
1479
|
-
preferredAudioLang:
|
|
1480
|
-
subtitlesEnabled:
|
|
1481
|
-
subtitleStyle: ["classic", "cinema", "minimal", "contrast"].includes(
|
|
1477
|
+
volume: V.volume ?? 1,
|
|
1478
|
+
muted: V.muted ?? !1,
|
|
1479
|
+
preferredAudioLang: V.preferredAudioLang || "jpn",
|
|
1480
|
+
subtitlesEnabled: V.subtitlesEnabled ?? !0,
|
|
1481
|
+
subtitleStyle: ["classic", "cinema", "minimal", "contrast"].includes(V.subtitleStyle) ? V.subtitleStyle : "classic"
|
|
1482
1482
|
},
|
|
1483
1483
|
healthSnapshot: null,
|
|
1484
1484
|
sidebarTab: "chat",
|
|
@@ -1509,7 +1509,7 @@ const q = bt(), m = Cr((e, t) => ({
|
|
|
1509
1509
|
const i = be(n.sprite);
|
|
1510
1510
|
return u("store", "Auto-identity: deriving name from the requested sprite", { name: i, sprite: n.sprite }), { name: i };
|
|
1511
1511
|
}
|
|
1512
|
-
const r = Object.values(n.roster).map((i) => i.sprite), a =
|
|
1512
|
+
const r = Object.values(n.roster).map((i) => i.sprite), a = rn(r, void 0, Be);
|
|
1513
1513
|
if (a) {
|
|
1514
1514
|
const i = be(a);
|
|
1515
1515
|
return u("store", "Auto-identity assigned", { name: i, sprite: a }), { name: i, sprite: a };
|
|
@@ -1560,23 +1560,23 @@ const q = bt(), m = Cr((e, t) => ({
|
|
|
1560
1560
|
appendChat: (n) => {
|
|
1561
1561
|
u("chat", "Message appended", { id: n.id, from: n.name, isSystem: n.isSystem }), e((r) => ({ chat: [...r.chat, n].slice(-500) }));
|
|
1562
1562
|
},
|
|
1563
|
-
setChat: (n) => e((r) => ({ chat:
|
|
1563
|
+
setChat: (n) => e((r) => ({ chat: $n(r.chat, n).slice(-500) })),
|
|
1564
1564
|
toggleChatCollapsed: () => e((n) => {
|
|
1565
1565
|
const r = !n.chatCollapsed;
|
|
1566
|
-
return
|
|
1566
|
+
return Nt() || q("chatCollapsed", r), { chatCollapsed: r };
|
|
1567
1567
|
}),
|
|
1568
1568
|
applyTvDefaults: () => e(() => ({ chatCollapsed: !0 })),
|
|
1569
1569
|
toggleChromeChatCollapsed: () => e((n) => {
|
|
1570
1570
|
const r = !n.chromeChatCollapsed;
|
|
1571
|
-
return
|
|
1571
|
+
return q("chromeChatCollapsed", r), { chromeChatCollapsed: r };
|
|
1572
1572
|
}),
|
|
1573
1573
|
setChromeChatWidth: (n) => e(() => {
|
|
1574
1574
|
const r = Y(n);
|
|
1575
|
-
return
|
|
1575
|
+
return q("chromeChatWidth", r), { chromeChatWidth: r };
|
|
1576
1576
|
}),
|
|
1577
1577
|
toggleFloatingChat: () => e((n) => {
|
|
1578
1578
|
const r = !n.floatingChatEnabled;
|
|
1579
|
-
return
|
|
1579
|
+
return q("floatingChatEnabled", r), { floatingChatEnabled: r };
|
|
1580
1580
|
}),
|
|
1581
1581
|
allocateClientSeq: () => {
|
|
1582
1582
|
const n = t().me.nextClientSeq;
|
|
@@ -1611,11 +1611,11 @@ const q = bt(), m = Cr((e, t) => ({
|
|
|
1611
1611
|
setBufferState: (n) => e((r) => ({ bufferState: { ...r.bufferState, ...n } })),
|
|
1612
1612
|
setMutedForAutoplay: (n) => e({ mutedForAutoplay: n }),
|
|
1613
1613
|
// Media preference actions
|
|
1614
|
-
setVolume: (n) => e((r) => (
|
|
1615
|
-
setMuted: (n) => e((r) => (
|
|
1616
|
-
setPreferredAudioLang: (n) => e((r) => (
|
|
1617
|
-
setSubtitlesEnabled: (n) => e((r) => (
|
|
1618
|
-
setSubtitleStyle: (n) => e((r) => (
|
|
1614
|
+
setVolume: (n) => e((r) => (q("volume", n), { mediaPrefs: { ...r.mediaPrefs, volume: n } })),
|
|
1615
|
+
setMuted: (n) => e((r) => (q("muted", n), { mediaPrefs: { ...r.mediaPrefs, muted: n } })),
|
|
1616
|
+
setPreferredAudioLang: (n) => e((r) => (q("preferredAudioLang", n), { mediaPrefs: { ...r.mediaPrefs, preferredAudioLang: n } })),
|
|
1617
|
+
setSubtitlesEnabled: (n) => e((r) => (q("subtitlesEnabled", n), { mediaPrefs: { ...r.mediaPrefs, subtitlesEnabled: n } })),
|
|
1618
|
+
setSubtitleStyle: (n) => e((r) => (q("subtitleStyle", n), { mediaPrefs: { ...r.mediaPrefs, subtitleStyle: n } })),
|
|
1619
1619
|
setHealthSnapshot: (n) => e({ healthSnapshot: n }),
|
|
1620
1620
|
setBufferStatus: (n) => e({ bufferStatus: n }),
|
|
1621
1621
|
applyPlaylistState: (n) => e({
|
|
@@ -1669,7 +1669,7 @@ const q = bt(), m = Cr((e, t) => ({
|
|
|
1669
1669
|
setRoomKeyType: (n) => e({ roomKeyType: n }),
|
|
1670
1670
|
rehydrateFromPrefs: () => e((n) => {
|
|
1671
1671
|
const r = bt(), a = {};
|
|
1672
|
-
if (r.chatCollapsed !== void 0 && !
|
|
1672
|
+
if (r.chatCollapsed !== void 0 && !Nt() && (a.chatCollapsed = r.chatCollapsed), r.chromeChatCollapsed !== void 0 && (a.chromeChatCollapsed = r.chromeChatCollapsed), r.chromeChatWidth !== void 0 && (a.chromeChatWidth = Y(r.chromeChatWidth)), ["volume", "muted", "preferredAudioLang", "subtitlesEnabled", "subtitleStyle"].some((l) => r[l] !== void 0)) {
|
|
1673
1673
|
const l = { ...n.mediaPrefs };
|
|
1674
1674
|
r.volume !== void 0 && (l.volume = r.volume), r.muted !== void 0 && (l.muted = r.muted), r.preferredAudioLang !== void 0 && (l.preferredAudioLang = r.preferredAudioLang), r.subtitlesEnabled !== void 0 && (l.subtitlesEnabled = r.subtitlesEnabled), r.subtitleStyle !== void 0 && ["classic", "cinema", "minimal", "contrast"].includes(r.subtitleStyle) && (l.subtitleStyle = r.subtitleStyle), a.mediaPrefs = l;
|
|
1675
1675
|
}
|
|
@@ -1678,35 +1678,35 @@ const q = bt(), m = Cr((e, t) => ({
|
|
|
1678
1678
|
setSidebarTab: (n) => e((r) => r.sidebarTab === n && n !== "chat" ? { sidebarTab: "chat" } : { sidebarTab: n, chatCollapsed: !1 })
|
|
1679
1679
|
}));
|
|
1680
1680
|
Ve("__ZUSTAND_STORE__", m);
|
|
1681
|
-
const
|
|
1681
|
+
const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1682
1682
|
__proto__: null,
|
|
1683
|
-
mergeHistory:
|
|
1683
|
+
mergeHistory: $n,
|
|
1684
1684
|
useAppStore: m
|
|
1685
1685
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1686
|
-
function
|
|
1686
|
+
function Gn(e) {
|
|
1687
1687
|
const t = typeof window < "u" ? window.location.href : "http://localhost/", n = new URL(e, t).pathname;
|
|
1688
1688
|
return `${n.endsWith("/") ? n : `${n}/`}socket.io/`;
|
|
1689
1689
|
}
|
|
1690
|
-
function
|
|
1690
|
+
function va(e) {
|
|
1691
1691
|
const t = typeof window < "u" ? window.location.href : "http://localhost/", n = e.namespace ?? "/chat";
|
|
1692
1692
|
return {
|
|
1693
1693
|
url: `${new URL(e.origin, t).origin}${n.startsWith("/") ? n : `/${n}`}`,
|
|
1694
|
-
path: e.path ??
|
|
1694
|
+
path: e.path ?? Gn(e.origin)
|
|
1695
1695
|
};
|
|
1696
1696
|
}
|
|
1697
1697
|
let K = null, Z = null, De = null;
|
|
1698
|
-
function
|
|
1699
|
-
e && K && e.origin === K.origin && e.path === K.path && e.namespace === K.namespace || !e && !K || (
|
|
1698
|
+
function Ft(e) {
|
|
1699
|
+
e && K && e.origin === K.origin && e.path === K.path && e.namespace === K.namespace || !e && !K || (Wn(), K = e);
|
|
1700
1700
|
}
|
|
1701
1701
|
function _t() {
|
|
1702
1702
|
return K !== null;
|
|
1703
1703
|
}
|
|
1704
|
-
function
|
|
1704
|
+
function _a(e) {
|
|
1705
1705
|
if (K)
|
|
1706
1706
|
if (De = e, Z)
|
|
1707
1707
|
Z.connected && Z.emit(v.JOIN, e);
|
|
1708
1708
|
else {
|
|
1709
|
-
const { url: t, path: n } =
|
|
1709
|
+
const { url: t, path: n } = va(K), r = tt(t, { path: n, transports: ["websocket", "polling"] });
|
|
1710
1710
|
Z = r, u("chat", "External chat socket", { url: t, path: n }), qn(r), r.on(v.ERROR, (a) => {
|
|
1711
1711
|
const i = a?.message || a?.code || "chat error";
|
|
1712
1712
|
I("chat", `Chat server error: ${i}`, { code: a?.code }), m.getState().pushToast("error", i);
|
|
@@ -1715,13 +1715,13 @@ function Sa(e) {
|
|
|
1715
1715
|
}), r.on("connect_error", (a) => I("chat", "Chat connection error", { message: a?.message }));
|
|
1716
1716
|
}
|
|
1717
1717
|
}
|
|
1718
|
-
function
|
|
1718
|
+
function wa(e) {
|
|
1719
1719
|
Z?.emit(v.CHAT_SEND, e);
|
|
1720
1720
|
}
|
|
1721
|
-
function
|
|
1721
|
+
function Wn() {
|
|
1722
1722
|
De = null, Z && (Z.disconnect(), Z = null);
|
|
1723
1723
|
}
|
|
1724
|
-
function
|
|
1724
|
+
function $t(e, t) {
|
|
1725
1725
|
return {
|
|
1726
1726
|
id: String(e.id ?? e.server_seq ?? t ?? `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`),
|
|
1727
1727
|
clientId: e.client_id,
|
|
@@ -1733,47 +1733,47 @@ function Bt(e, t) {
|
|
|
1733
1733
|
// Attachments arrive from other clients, so the key shape is re-checked
|
|
1734
1734
|
// here at the boundary rather than trusted at render time. A malformed
|
|
1735
1735
|
// entry is dropped, not rendered and not allowed near an <img src>.
|
|
1736
|
-
images: Array.isArray(e.images) ? e.images.filter((n) => !!n &&
|
|
1736
|
+
images: Array.isArray(e.images) ? e.images.filter((n) => !!n && st(n.key)).slice(0, J) : void 0,
|
|
1737
1737
|
isSystem: e.isSystem || !1,
|
|
1738
1738
|
systemType: e.systemType,
|
|
1739
|
-
template: e.isSystem && typeof e.template == "string" && e.template.includes(
|
|
1739
|
+
template: e.isSystem && typeof e.template == "string" && e.template.includes(un) ? e.template : void 0
|
|
1740
1740
|
};
|
|
1741
1741
|
}
|
|
1742
1742
|
function qn(e, t = () => !0) {
|
|
1743
1743
|
e.on(v.CHAT_BROADCAST, (n) => {
|
|
1744
1744
|
if (!t()) return;
|
|
1745
|
-
const r = {
|
|
1745
|
+
const r = { ...$t(n, n.server_seq), live: !0 };
|
|
1746
1746
|
m.getState().appendChat(r), u("chat", "Message received", r);
|
|
1747
1747
|
}), e.on(v.CHAT_HISTORY, (n) => {
|
|
1748
1748
|
if (!t() || !n?.messages || !Array.isArray(n.messages)) return;
|
|
1749
|
-
const r = n.messages.map((a) =>
|
|
1749
|
+
const r = n.messages.map((a) => $t(a));
|
|
1750
1750
|
m.getState().setChat(r), u("chat", "History loaded", { count: r.length });
|
|
1751
1751
|
});
|
|
1752
1752
|
}
|
|
1753
|
-
let
|
|
1754
|
-
function
|
|
1755
|
-
|
|
1753
|
+
let Vn = null;
|
|
1754
|
+
function Sa(e) {
|
|
1755
|
+
Vn = e;
|
|
1756
1756
|
}
|
|
1757
|
-
function
|
|
1757
|
+
function xa(e = Vn) {
|
|
1758
1758
|
if (!e) return null;
|
|
1759
1759
|
const t = typeof window < "u" ? window.location.href : "http://localhost/", n = e.namespace ?? "/room";
|
|
1760
1760
|
return {
|
|
1761
1761
|
url: `${new URL(e.origin, t).origin}${n.startsWith("/") ? n : `/${n}`}`,
|
|
1762
|
-
path: e.path ??
|
|
1762
|
+
path: e.path ?? Gn(e.origin)
|
|
1763
1763
|
};
|
|
1764
1764
|
}
|
|
1765
|
-
function
|
|
1766
|
-
return `${
|
|
1765
|
+
function Ca(e) {
|
|
1766
|
+
return `${In()}/media/${e}`.replace(/\\/g, "/");
|
|
1767
1767
|
}
|
|
1768
|
-
function
|
|
1769
|
-
return
|
|
1768
|
+
function Ia(e, t) {
|
|
1769
|
+
return Ca(t ?? `${e}/poster.jpg`);
|
|
1770
1770
|
}
|
|
1771
|
-
function
|
|
1772
|
-
return `${
|
|
1771
|
+
function Ta(e) {
|
|
1772
|
+
return `${In()}${e}`.replace(/\\/g, "/");
|
|
1773
1773
|
}
|
|
1774
|
-
async function
|
|
1774
|
+
async function ka(e) {
|
|
1775
1775
|
try {
|
|
1776
|
-
const t = await fetch(
|
|
1776
|
+
const t = await fetch(Ta("/api/tierlist"));
|
|
1777
1777
|
if (!t.ok)
|
|
1778
1778
|
return I("tierlist", "Board fetch failed", { status: t.status }), null;
|
|
1779
1779
|
const n = await t.json();
|
|
@@ -1786,56 +1786,50 @@ async function Aa(e) {
|
|
|
1786
1786
|
return I("tierlist", "Board fetch threw", we(t)), null;
|
|
1787
1787
|
}
|
|
1788
1788
|
}
|
|
1789
|
-
let
|
|
1790
|
-
function
|
|
1791
|
-
if (
|
|
1789
|
+
let Bt = !1;
|
|
1790
|
+
function Ea() {
|
|
1791
|
+
if (Bt || typeof Image > "u") return;
|
|
1792
1792
|
const e = m.getState().tierlist;
|
|
1793
1793
|
if (!(!e || e.items.length === 0)) {
|
|
1794
|
-
|
|
1794
|
+
Bt = !0;
|
|
1795
1795
|
for (const t of e.items) {
|
|
1796
1796
|
const n = new Image();
|
|
1797
|
-
n.decoding = "async", n.src =
|
|
1797
|
+
n.decoding = "async", n.src = Ia(t.id, t.thumbnail);
|
|
1798
1798
|
}
|
|
1799
1799
|
u("tierlist", "Warming posters", { count: e.items.length });
|
|
1800
1800
|
}
|
|
1801
1801
|
}
|
|
1802
|
-
function
|
|
1803
|
-
const e = m.getState(), t =
|
|
1802
|
+
function Aa() {
|
|
1803
|
+
const e = m.getState(), t = rn(Object.values(e.roster).map((a) => a.sprite), void 0, Be);
|
|
1804
1804
|
if (!t)
|
|
1805
1805
|
return I("socket", "sprite_taken: no available sprites to retry with"), null;
|
|
1806
1806
|
const n = !!e.name && !re(e.name), r = n ? e.name : be(t);
|
|
1807
1807
|
return u("socket", "sprite_taken: retrying with a free character", { from: e.sprite, to: t, name: r, keptCustomName: n }), e.setSessionIdentity(r, t), { name: r, sprite: t };
|
|
1808
1808
|
}
|
|
1809
|
-
function
|
|
1809
|
+
function Na(e) {
|
|
1810
1810
|
const t = m.getState(), n = e ? t.roster[e] : void 0;
|
|
1811
1811
|
return !n || !!n.sprite && n.sprite === t.sprite;
|
|
1812
1812
|
}
|
|
1813
|
-
const
|
|
1814
|
-
function
|
|
1815
|
-
const t = e
|
|
1816
|
-
return
|
|
1813
|
+
const Pa = "hadoku:name";
|
|
1814
|
+
function Ra(e) {
|
|
1815
|
+
const t = Tr(e);
|
|
1816
|
+
return Ge(t) ? t : null;
|
|
1817
1817
|
}
|
|
1818
|
-
async function
|
|
1819
|
-
const t =
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
} catch (a) {
|
|
1825
|
-
return a instanceof It && (a.status === 401 || a.status === 403 || a.status === 404) ? u("avatar", "No avatar settings here (signed out, or no prefs-api on this origin)", { status: a.status }) : I("avatar", "Avatar settings read failed — keeping the auto-assigned character", {
|
|
1826
|
-
status: a instanceof It ? a.status : void 0,
|
|
1827
|
-
...we(a)
|
|
1828
|
-
}), null;
|
|
1829
|
-
}
|
|
1818
|
+
async function Da(e = {}) {
|
|
1819
|
+
const t = await Ir({
|
|
1820
|
+
...e,
|
|
1821
|
+
onError: (r) => I("avatar", "Avatar settings read failed — keeping the auto-assigned character", we(r))
|
|
1822
|
+
}), n = Ge(t) ? t : null;
|
|
1823
|
+
return u("avatar", "Requested character from prefs-api", { sprite: n }), n;
|
|
1830
1824
|
}
|
|
1831
|
-
function
|
|
1825
|
+
function Gt(e) {
|
|
1832
1826
|
if (!e) return !1;
|
|
1833
1827
|
const t = m.getState();
|
|
1834
1828
|
if (t.sprite === e) return !1;
|
|
1835
1829
|
const r = !!(t.me.clientId && t.roster[t.me.clientId]?.registryName) || !t.name || !re(t.name) ? t.name : be(e);
|
|
1836
1830
|
return t.setSessionIdentity(r, e), !0;
|
|
1837
1831
|
}
|
|
1838
|
-
function
|
|
1832
|
+
function Oa(e, t, n) {
|
|
1839
1833
|
if (!n) return () => {
|
|
1840
1834
|
};
|
|
1841
1835
|
const r = (a) => {
|
|
@@ -1844,21 +1838,18 @@ function zn(e, t, n) {
|
|
|
1844
1838
|
};
|
|
1845
1839
|
return n.addEventListener(e, r), () => n.removeEventListener(e, r);
|
|
1846
1840
|
}
|
|
1847
|
-
const
|
|
1848
|
-
function La(e, t =
|
|
1849
|
-
return
|
|
1850
|
-
}
|
|
1851
|
-
function ja(e, t = Xn()) {
|
|
1852
|
-
return zn(Oa, (n) => {
|
|
1841
|
+
const Ma = () => typeof window > "u" ? void 0 : window;
|
|
1842
|
+
function La(e, t = Ma()) {
|
|
1843
|
+
return Oa(Pa, (n) => {
|
|
1853
1844
|
typeof n.name == "string" && n.name.trim() && e(n.name);
|
|
1854
1845
|
}, t);
|
|
1855
1846
|
}
|
|
1856
|
-
const
|
|
1857
|
-
function
|
|
1847
|
+
const ja = 10;
|
|
1848
|
+
function Ua(e = typeof window < "u" ? window : void 0) {
|
|
1858
1849
|
if (!e) return { framed: !1, depth: 0 };
|
|
1859
1850
|
try {
|
|
1860
1851
|
let t = 0, n = e;
|
|
1861
|
-
for (; n !== n.parent && t <
|
|
1852
|
+
for (; n !== n.parent && t < ja; )
|
|
1862
1853
|
t++, n = n.parent;
|
|
1863
1854
|
return { framed: e.top ? e.top !== e.self : t > 0, depth: t };
|
|
1864
1855
|
} catch {
|
|
@@ -1866,7 +1857,7 @@ function Fa(e = typeof window < "u" ? window : void 0) {
|
|
|
1866
1857
|
}
|
|
1867
1858
|
}
|
|
1868
1859
|
const Ha = "watchparty_fragment_delivery";
|
|
1869
|
-
function
|
|
1860
|
+
function Fa() {
|
|
1870
1861
|
if (typeof window > "u") return null;
|
|
1871
1862
|
try {
|
|
1872
1863
|
const e = new URLSearchParams(window.location.search).get("fragmentDelivery");
|
|
@@ -1874,43 +1865,43 @@ function $a() {
|
|
|
1874
1865
|
if (e === "0" || e === "false") return !1;
|
|
1875
1866
|
} catch {
|
|
1876
1867
|
}
|
|
1877
|
-
return
|
|
1868
|
+
return Lo(Ha);
|
|
1878
1869
|
}
|
|
1879
|
-
let
|
|
1880
|
-
const
|
|
1881
|
-
function
|
|
1882
|
-
const e = G(
|
|
1870
|
+
let $a = { ...gn }, Ye = null;
|
|
1871
|
+
const Wt = "watchparty_delivery_client_id";
|
|
1872
|
+
function Ba() {
|
|
1873
|
+
const e = G(Wt);
|
|
1883
1874
|
if (e) return e;
|
|
1884
1875
|
const t = globalThis.crypto?.randomUUID?.() ?? `d${Math.random().toString(36).slice(2)}`;
|
|
1885
|
-
return pt(
|
|
1876
|
+
return pt(Wt, t) ? t : "";
|
|
1886
1877
|
}
|
|
1887
|
-
function
|
|
1888
|
-
return
|
|
1878
|
+
function Ga() {
|
|
1879
|
+
return Ye === null && (Ye = to($a, Ba(), Fa())), Ye;
|
|
1889
1880
|
}
|
|
1890
|
-
function
|
|
1891
|
-
return
|
|
1881
|
+
function Wa() {
|
|
1882
|
+
return Ga();
|
|
1892
1883
|
}
|
|
1893
1884
|
let Oe;
|
|
1894
|
-
function
|
|
1895
|
-
return G(
|
|
1885
|
+
function Kn() {
|
|
1886
|
+
return G(Cr) || void 0;
|
|
1896
1887
|
}
|
|
1897
1888
|
function qa() {
|
|
1898
1889
|
if (Oe) return;
|
|
1899
|
-
const e =
|
|
1890
|
+
const e = Kn();
|
|
1900
1891
|
if (e) {
|
|
1901
1892
|
Oe = e;
|
|
1902
1893
|
return;
|
|
1903
1894
|
}
|
|
1904
|
-
|
|
1895
|
+
xr().then((t) => {
|
|
1905
1896
|
t && (Oe = t);
|
|
1906
1897
|
}).catch(() => {
|
|
1907
1898
|
u("identity", "device id unavailable — joining without one");
|
|
1908
1899
|
});
|
|
1909
1900
|
}
|
|
1910
|
-
function
|
|
1911
|
-
return Oe ??=
|
|
1901
|
+
function Va() {
|
|
1902
|
+
return Oe ??= Kn();
|
|
1912
1903
|
}
|
|
1913
|
-
function
|
|
1904
|
+
function Ka(e, t) {
|
|
1914
1905
|
let n = 0;
|
|
1915
1906
|
for (const r of e.videos) {
|
|
1916
1907
|
const a = de.voteKey(t, e.id, r.mediaId);
|
|
@@ -1918,49 +1909,49 @@ function Ya(e, t) {
|
|
|
1918
1909
|
}
|
|
1919
1910
|
return n;
|
|
1920
1911
|
}
|
|
1921
|
-
const
|
|
1922
|
-
function
|
|
1912
|
+
const Ya = 2e4, za = 1e4;
|
|
1913
|
+
function Xa() {
|
|
1923
1914
|
return { unansweredSince: null, lastPongAt: null, lastTickAt: null };
|
|
1924
1915
|
}
|
|
1925
|
-
function
|
|
1916
|
+
function Ja(e, t) {
|
|
1926
1917
|
e.lastPongAt = t, e.unansweredSince = null;
|
|
1927
1918
|
}
|
|
1928
|
-
function
|
|
1929
|
-
const r = e.lastTickAt !== null && t - e.lastTickAt >
|
|
1930
|
-
return e.lastTickAt = t, n ? r || e.unansweredSince === null ? (e.unansweredSince = t, !1) : t - e.unansweredSince >
|
|
1919
|
+
function Qa(e, t, n) {
|
|
1920
|
+
const r = e.lastTickAt !== null && t - e.lastTickAt > za;
|
|
1921
|
+
return e.lastTickAt = t, n ? r || e.unansweredSince === null ? (e.unansweredSince = t, !1) : t - e.unansweredSince > Ya : (e.unansweredSince = null, !1);
|
|
1931
1922
|
}
|
|
1932
|
-
function
|
|
1923
|
+
function Za(e, t) {
|
|
1933
1924
|
return e.lastPongAt === null ? void 0 : Math.max(0, t - e.lastPongAt);
|
|
1934
1925
|
}
|
|
1935
1926
|
let S = null, $ = null, Me = null, B = null, z = null;
|
|
1936
|
-
const
|
|
1937
|
-
let Te = null,
|
|
1938
|
-
function
|
|
1927
|
+
const ei = ri(), se = Xa();
|
|
1928
|
+
let Te = null, ze = null, qt = 0, wt = null, ve = !1, St = !1, me = !1, Yn = null;
|
|
1929
|
+
function ti(e) {
|
|
1939
1930
|
const t = oe(), n = m.getState();
|
|
1940
1931
|
if (n.me.clientId && n.roster[n.me.clientId])
|
|
1941
1932
|
return (e.name || e.sprite) && (u("socket", "Identity update (already joined)", { name: e.name, sprite: e.sprite }), t.emit(v.IDENTITY_UPDATE, { name: e.name, sprite: e.sprite })), t;
|
|
1942
|
-
const r =
|
|
1943
|
-
return z = r, wt = { name: r.name, sprite: r.sprite }, _t() &&
|
|
1933
|
+
const r = ni(e);
|
|
1934
|
+
return z = r, wt = { name: r.name, sprite: r.sprite }, _t() && _a(r), t.connected ? (u("socket", "Emitting join", r), t.emit(v.JOIN, r)) : t.once("connect", () => {
|
|
1944
1935
|
u("socket", "Emitting join", r), t.emit(v.JOIN, r);
|
|
1945
1936
|
}), t;
|
|
1946
1937
|
}
|
|
1947
|
-
function
|
|
1938
|
+
function ni(e) {
|
|
1948
1939
|
return {
|
|
1949
1940
|
room_key: e.room_key,
|
|
1950
1941
|
name: e.name,
|
|
1951
1942
|
sprite: e.sprite,
|
|
1952
1943
|
// Entry-path telemetry — see lib/embedContext.ts. Sent on every join AND
|
|
1953
1944
|
// rejoin (lastJoinPayload carries it), so a reconnect keeps the attribution.
|
|
1954
|
-
embed:
|
|
1955
|
-
delivery_arm:
|
|
1945
|
+
embed: Ua(),
|
|
1946
|
+
delivery_arm: Wa(),
|
|
1956
1947
|
// Identity tier input — see lib/deviceId.ts. Sent on every join AND rejoin
|
|
1957
1948
|
// (lastJoinPayload carries it) so a reconnect lands on the same
|
|
1958
1949
|
// ParticipantId rather than minting a new person.
|
|
1959
|
-
device_id:
|
|
1960
|
-
tab_id:
|
|
1950
|
+
device_id: Va(),
|
|
1951
|
+
tab_id: ei
|
|
1961
1952
|
};
|
|
1962
1953
|
}
|
|
1963
|
-
function
|
|
1954
|
+
function ri() {
|
|
1964
1955
|
const e = globalThis.crypto;
|
|
1965
1956
|
if (e && typeof e.randomUUID == "function") return e.randomUUID();
|
|
1966
1957
|
const t = new Uint8Array(16);
|
|
@@ -1973,25 +1964,25 @@ function oe() {
|
|
|
1973
1964
|
let t = _e().serverOrigin || "/";
|
|
1974
1965
|
if (t === "/" && typeof window < "u") {
|
|
1975
1966
|
const r = window.location;
|
|
1976
|
-
(r.hostname === "localhost" || r.hostname === "127.0.0.1") && r.port === String(
|
|
1967
|
+
(r.hostname === "localhost" || r.hostname === "127.0.0.1") && r.port === String(sn) && (t = `${r.protocol}//${r.hostname}:${lt}`, u("socket", "Using dev fallback origin", { origin: t }));
|
|
1977
1968
|
}
|
|
1978
|
-
const n =
|
|
1969
|
+
const n = xa();
|
|
1979
1970
|
if (n)
|
|
1980
|
-
S =
|
|
1971
|
+
S = tt(n.url, { path: n.path, transports: ["websocket", "polling"] }), u("socket", "Socket initialized on the room origin", n);
|
|
1981
1972
|
else {
|
|
1982
1973
|
const r = new URL(t.startsWith("http") ? t : `${window.location.origin}${t}`).origin;
|
|
1983
|
-
S =
|
|
1974
|
+
S = tt(r, { path: Pr, transports: ["websocket", "polling"] }), u("socket", "Socket initialized", { origin: t });
|
|
1984
1975
|
}
|
|
1985
1976
|
Ve("__SOCKET__", S), B && (clearTimeout(B), B = null), $ = null, Me = setInterval(() => {
|
|
1986
|
-
if (
|
|
1977
|
+
if (Qa(se, Date.now(), !!S?.connected)) {
|
|
1987
1978
|
I("socket", "PONG-WATCHDOG no time_pong for 20s — replacing the connection", {
|
|
1988
1979
|
sid: S?.id,
|
|
1989
|
-
lastPongAgeMs:
|
|
1990
|
-
}),
|
|
1980
|
+
lastPongAgeMs: Za(se, Date.now()) ?? null
|
|
1981
|
+
}), ze = "pong-watchdog", se.unansweredSince = null, S?.io.engine?.close();
|
|
1991
1982
|
return;
|
|
1992
1983
|
}
|
|
1993
|
-
|
|
1994
|
-
},
|
|
1984
|
+
pi();
|
|
1985
|
+
}, Xr), S.on("connect", () => {
|
|
1995
1986
|
St = !1;
|
|
1996
1987
|
const r = S?.id;
|
|
1997
1988
|
if (u("socket", "Connected", { id: r, isReconnect: me }), r)
|
|
@@ -2012,7 +2003,7 @@ function oe() {
|
|
|
2012
2003
|
reason: (Te?.reason ?? "unknown").slice(0, 64),
|
|
2013
2004
|
offline_ms: Te ? Math.max(0, Date.now() - Te.at) : 0
|
|
2014
2005
|
}
|
|
2015
|
-
}, s =
|
|
2006
|
+
}, s = Yn;
|
|
2016
2007
|
if (u("socket", "Re-emitting join after reconnect", { room_key: i.room_key, name: i.name, sprite: i.sprite }), s) {
|
|
2017
2008
|
let l = !1;
|
|
2018
2009
|
const d = () => {
|
|
@@ -2026,25 +2017,25 @@ function oe() {
|
|
|
2026
2017
|
} else me && I("socket", "Reconnected — no join payload, not re-joining any room");
|
|
2027
2018
|
me = !0;
|
|
2028
2019
|
}), S.on("disconnect", (r) => {
|
|
2029
|
-
|
|
2030
|
-
}), S.on("connect_error", (r) => Re("socket", "Connection error", { message: r?.message })), S.on("reconnect_attempt", (r) => I("socket", "Reconnect attempt", { attempt: r })), S.on("reconnect_failed", () => Re("socket", "Reconnect failed")),
|
|
2020
|
+
Dn(null), Te = { reason: ze ?? r, at: Date.now() }, ze = null, u("socket", "Disconnected", { reason: r });
|
|
2021
|
+
}), S.on("connect_error", (r) => Re("socket", "Connection error", { message: r?.message })), S.on("reconnect_attempt", (r) => I("socket", "Reconnect attempt", { attempt: r })), S.on("reconnect_failed", () => Re("socket", "Reconnect failed")), mi(S);
|
|
2031
2022
|
}
|
|
2032
2023
|
return S;
|
|
2033
2024
|
}
|
|
2034
|
-
function
|
|
2025
|
+
function Xe(e) {
|
|
2035
2026
|
return e.play_state === "playing" || e.playing === !0;
|
|
2036
2027
|
}
|
|
2037
|
-
function
|
|
2028
|
+
function oi(e) {
|
|
2038
2029
|
e.on(v.SNAPSHOT, (t) => {
|
|
2039
|
-
e.emit(
|
|
2030
|
+
e.emit(hn.SYNC), m.getState().applySnapshot({
|
|
2040
2031
|
roomId: t.room_id ?? null,
|
|
2041
2032
|
mediaId: t.media_id ?? null,
|
|
2042
2033
|
playheadMs: t.playhead_ms || 0,
|
|
2043
|
-
playing:
|
|
2034
|
+
playing: Xe(t),
|
|
2044
2035
|
serverSeq: t.server_seq || 0,
|
|
2045
2036
|
leaderId: t.leader_id || null
|
|
2046
2037
|
}), m.getState().name || u("socket", "Deferring identity to presence event (snapshot carries no roster)");
|
|
2047
|
-
const n = m.getState(), r = S?.id, i = (r ? n.roster[r] : void 0) ?? wt, s =
|
|
2038
|
+
const n = m.getState(), r = S?.id, i = (r ? n.roster[r] : void 0) ?? wt, s = wr(
|
|
2048
2039
|
{ name: n.name, avatarId: n.sprite },
|
|
2049
2040
|
i ? { name: i.name, avatarId: i.sprite ?? null } : void 0,
|
|
2050
2041
|
// A join that carried no name counts as a default one, so a name that
|
|
@@ -2061,11 +2052,11 @@ function ai(e) {
|
|
|
2061
2052
|
u("socket", "Received snapshot", {
|
|
2062
2053
|
mediaId: t.media_id ?? null,
|
|
2063
2054
|
playheadMs: t.playhead_ms || 0,
|
|
2064
|
-
playing:
|
|
2055
|
+
playing: Xe(t),
|
|
2065
2056
|
leaderId: t.leader_id || null,
|
|
2066
2057
|
serverSeq: t.server_seq || 0,
|
|
2067
2058
|
rosterSize: Object.keys(n.roster).length
|
|
2068
|
-
}), z?.room_key && S?.id &&
|
|
2059
|
+
}), z?.room_key && S?.id && Dn({ room_key: z.room_key, client_id: S.id });
|
|
2069
2060
|
}), e.on(v.CONTROL_BROADCAST, (t) => {
|
|
2070
2061
|
const n = m.getState();
|
|
2071
2062
|
if (Object.prototype.hasOwnProperty.call(t, "media_id")) {
|
|
@@ -2074,7 +2065,7 @@ function ai(e) {
|
|
|
2074
2065
|
}
|
|
2075
2066
|
n.updateControlState({
|
|
2076
2067
|
playheadMs: t.playhead_ms,
|
|
2077
|
-
playing:
|
|
2068
|
+
playing: Xe(t),
|
|
2078
2069
|
serverSeq: t.server_seq,
|
|
2079
2070
|
leaderId: t.leader_id ?? n.snapshot.leaderId
|
|
2080
2071
|
}), u("socket", "Control broadcast received", {
|
|
@@ -2087,7 +2078,7 @@ function ai(e) {
|
|
|
2087
2078
|
}), e.on(v.CONTROL_ACK, (t) => {
|
|
2088
2079
|
typeof t?.client_seq == "number" && typeof t?.server_seq == "number" && u("socket", "Control ack received", t);
|
|
2089
2080
|
}), e.on(v.TIME_PONG, (t) => {
|
|
2090
|
-
if (
|
|
2081
|
+
if (Ja(se, Date.now()), $ && $.ts) {
|
|
2091
2082
|
const n = Date.now() - $.ts;
|
|
2092
2083
|
m.getState().addRttSample(n, t?.server_ts, $.ts), $ = null, B && (clearTimeout(B), B = null), u("socket", "Time sync RTT", { rtt: n, offset: m.getState().drift.offsetMs });
|
|
2093
2084
|
}
|
|
@@ -2097,11 +2088,11 @@ function ai(e) {
|
|
|
2097
2088
|
m.getState().setReadiness({ mediaId: n, ready: i, readyCount: r, total: a }), u("socket", "Ready state received", { mediaId: n, readyCount: r, total: a, ready: i });
|
|
2098
2089
|
});
|
|
2099
2090
|
}
|
|
2100
|
-
function
|
|
2101
|
-
const t =
|
|
2091
|
+
function ai(e) {
|
|
2092
|
+
const t = pr(e);
|
|
2102
2093
|
return t ? { cosmetics: t } : {};
|
|
2103
2094
|
}
|
|
2104
|
-
function
|
|
2095
|
+
function ii(e) {
|
|
2105
2096
|
e.on(v.PRESENCE, (t) => {
|
|
2106
2097
|
if (!t) return;
|
|
2107
2098
|
if (Array.isArray(t.users)) {
|
|
@@ -2115,7 +2106,7 @@ function si(e) {
|
|
|
2115
2106
|
isLeader: l.is_leader,
|
|
2116
2107
|
...l.registry_name ? { registryName: !0 } : {},
|
|
2117
2108
|
...l.avatar_url ? { avatarUrl: l.avatar_url } : {},
|
|
2118
|
-
...
|
|
2109
|
+
...ai(l.cosmetics)
|
|
2119
2110
|
};
|
|
2120
2111
|
const a = m.getState(), i = S?.id, s = i ? r[i] : void 0;
|
|
2121
2112
|
if (s?.registryName)
|
|
@@ -2137,7 +2128,7 @@ function si(e) {
|
|
|
2137
2128
|
}
|
|
2138
2129
|
});
|
|
2139
2130
|
}
|
|
2140
|
-
function
|
|
2131
|
+
function si(e) {
|
|
2141
2132
|
e.on(Se.STATE, (t) => {
|
|
2142
2133
|
m.getState().applyPlaylistState({
|
|
2143
2134
|
playlist: t?.playlist ?? null,
|
|
@@ -2150,54 +2141,54 @@ function li(e) {
|
|
|
2150
2141
|
m.getState().setPlaylistResults(t ?? null), u("playlist", "Results received", { playlistId: t?.playlist?.id, update: t?.update === !0 });
|
|
2151
2142
|
}), e.on(Se.VOTES_CLEARED, (t) => {
|
|
2152
2143
|
if (!t?.playlistId || !Array.isArray(t.mediaIds)) return;
|
|
2153
|
-
const n =
|
|
2144
|
+
const n = Ka(
|
|
2154
2145
|
{ id: t.playlistId, videos: t.mediaIds.map((a) => ({ mediaId: a })) },
|
|
2155
|
-
|
|
2146
|
+
aa()
|
|
2156
2147
|
), r = m.getState();
|
|
2157
2148
|
r.playlist?.id === t.playlistId && r.applyPlaylistState({ playlist: r.playlist, activeIndex: r.activePlaylistIndex, myVotes: {} }), u("playlist", "Votes cleared by leader", { playlistId: t.playlistId, removed: n });
|
|
2158
2149
|
});
|
|
2159
2150
|
}
|
|
2160
|
-
function
|
|
2161
|
-
e.on(
|
|
2162
|
-
u("tierlist", "Someone saved — refreshing the board"),
|
|
2151
|
+
function li(e) {
|
|
2152
|
+
e.on(Wr.UPDATED, () => {
|
|
2153
|
+
u("tierlist", "Someone saved — refreshing the board"), ka(!1);
|
|
2163
2154
|
});
|
|
2164
2155
|
}
|
|
2165
|
-
function
|
|
2166
|
-
e.on(
|
|
2156
|
+
function ci(e) {
|
|
2157
|
+
e.on(qr.STATE, (t) => {
|
|
2167
2158
|
if (!t || typeof t.active != "boolean") return;
|
|
2168
2159
|
const n = Array.isArray(t.ready) ? t.ready.filter((r) => typeof r == "string") : [];
|
|
2169
2160
|
m.getState().setReadyCheckState({ active: t.active, ready: n }), u("ready-check", "State received", { active: t.active, readyCount: n.length });
|
|
2170
2161
|
});
|
|
2171
2162
|
}
|
|
2172
|
-
function
|
|
2173
|
-
e.on(
|
|
2163
|
+
function di(e) {
|
|
2164
|
+
e.on(hn.ACTIVE, (t) => {
|
|
2174
2165
|
const n = typeof t?.gameId == "string" ? t.gameId : null;
|
|
2175
2166
|
m.getState().setActiveGameId(n), u("game", "game_active", { gameId: n });
|
|
2176
2167
|
});
|
|
2177
2168
|
}
|
|
2178
|
-
function
|
|
2169
|
+
function ui(e) {
|
|
2179
2170
|
e.on(v.HEALTH_SNAPSHOT, (t) => {
|
|
2180
2171
|
m.getState().setHealthSnapshot(t);
|
|
2181
2172
|
}), e.on(v.BUFFER_STATUS, (t) => {
|
|
2182
2173
|
m.getState().setBufferStatus(t);
|
|
2183
2174
|
});
|
|
2184
2175
|
}
|
|
2185
|
-
function
|
|
2186
|
-
|
|
2176
|
+
function mi(e) {
|
|
2177
|
+
oi(e), ii(e), qn(e, () => !_t()), ui(e), si(e), li(e), ci(e), di(e), e.on(v.ERROR, (t) => {
|
|
2187
2178
|
const n = t?.code || "error/unknown";
|
|
2188
2179
|
if (n === "conflict" && t?.message === "sprite_held_by_you") {
|
|
2189
2180
|
St = !0, u("socket", "sprite held by this account's other connection: keeping the server-assigned sprite");
|
|
2190
2181
|
return;
|
|
2191
2182
|
}
|
|
2192
2183
|
if (n === "conflict" && t?.message === "sprite_taken") {
|
|
2193
|
-
if (
|
|
2184
|
+
if (Na(S?.id)) {
|
|
2194
2185
|
u("socket", "sprite_taken: stale, the server already has our sprite");
|
|
2195
2186
|
return;
|
|
2196
2187
|
}
|
|
2197
2188
|
ve = !0;
|
|
2198
2189
|
let s;
|
|
2199
2190
|
try {
|
|
2200
|
-
s =
|
|
2191
|
+
s = Aa();
|
|
2201
2192
|
} finally {
|
|
2202
2193
|
ve = !1;
|
|
2203
2194
|
}
|
|
@@ -2228,34 +2219,34 @@ function fi(e) {
|
|
|
2228
2219
|
(n.startsWith("auth/") ? I : Re)("socket", `Server error: ${a}`, { code: n, raw: t }), m.getState().pushToast("error", a);
|
|
2229
2220
|
});
|
|
2230
2221
|
}
|
|
2231
|
-
function
|
|
2222
|
+
function fi(e, t) {
|
|
2232
2223
|
const n = t?.length ? { text: e, images: t } : { text: e };
|
|
2233
|
-
_t() ?
|
|
2224
|
+
_t() ? wa(n) : oe().emit(v.CHAT_SEND, n);
|
|
2234
2225
|
}
|
|
2235
|
-
function
|
|
2226
|
+
function pi() {
|
|
2236
2227
|
$ || ($ = { ts: Date.now() }, oe().emit(v.TIME_PING, {}), B = setTimeout(() => {
|
|
2237
2228
|
$ && (u("socket", "Time ping timed out after 10s, clearing inflight"), $ = null), B = null;
|
|
2238
2229
|
}, 1e4));
|
|
2239
2230
|
}
|
|
2240
|
-
function
|
|
2231
|
+
function zn(e) {
|
|
2241
2232
|
const t = m.getState(), n = t.me.clientId;
|
|
2242
2233
|
if (!n || !t.roster[n]) {
|
|
2243
|
-
|
|
2234
|
+
Gt(e), u("socket", "Avatar change before join: the join will carry it", { sprite: e });
|
|
2244
2235
|
return;
|
|
2245
2236
|
}
|
|
2246
2237
|
ve = !0;
|
|
2247
2238
|
try {
|
|
2248
|
-
|
|
2239
|
+
Gt(e);
|
|
2249
2240
|
} finally {
|
|
2250
2241
|
ve = !1;
|
|
2251
2242
|
}
|
|
2252
2243
|
const r = m.getState(), a = { avatar: !0 };
|
|
2253
2244
|
r.sprite && r.sprite !== t.sprite && (a.sprite = r.sprite), r.name && r.name !== t.name && (a.name = r.name), u("socket", "Sending avatar change", a), oe().emit(v.IDENTITY_UPDATE, a);
|
|
2254
2245
|
}
|
|
2255
|
-
function
|
|
2256
|
-
m.getState().me.clientId &&
|
|
2246
|
+
function hi(e) {
|
|
2247
|
+
m.getState().me.clientId && gi(e);
|
|
2257
2248
|
}
|
|
2258
|
-
function
|
|
2249
|
+
function gi(e, t) {
|
|
2259
2250
|
const n = {};
|
|
2260
2251
|
e && (n.name = e), !(!n.name && !n.sprite) && (u("socket", "Sending identity update", n), oe().emit(v.IDENTITY_UPDATE, n));
|
|
2261
2252
|
}
|
|
@@ -2271,14 +2262,14 @@ m.subscribe((e, t) => {
|
|
|
2271
2262
|
const s = {};
|
|
2272
2263
|
a && (s.name = e.name, ke.name = e.name), i && (s.sprite = e.sprite, ke.sprite = e.sprite), u("socket", "Identity reassert (store change)", s), S?.connected ? S.emit(v.IDENTITY_UPDATE, s) : oe().emit(v.IDENTITY_UPDATE, s);
|
|
2273
2264
|
});
|
|
2274
|
-
function
|
|
2265
|
+
function yi() {
|
|
2275
2266
|
Me && (clearInterval(Me), Me = null), B && (clearTimeout(B), B = null), $ = null, se.unansweredSince = null, se.lastTickAt = null;
|
|
2276
2267
|
}
|
|
2277
|
-
function
|
|
2278
|
-
u("socket", "clearJoinState called", { hadPayload: z !== null, room_key: z?.room_key }), z = null, me = !1,
|
|
2268
|
+
function bi() {
|
|
2269
|
+
u("socket", "clearJoinState called", { hadPayload: z !== null, room_key: z?.room_key }), z = null, me = !1, Yn = null;
|
|
2279
2270
|
}
|
|
2280
|
-
function
|
|
2281
|
-
u("socket", "leaveRoom called", { room_key: z?.room_key }),
|
|
2271
|
+
function Vt() {
|
|
2272
|
+
u("socket", "leaveRoom called", { room_key: z?.room_key }), bi(), yi(), Wn(), S && (S.disconnect(), S = null), m.setState({
|
|
2282
2273
|
me: { clientId: null, nextClientSeq: 1 },
|
|
2283
2274
|
roster: {},
|
|
2284
2275
|
snapshot: { roomId: null, mediaId: null, playheadMs: 0, playing: !1, serverSeq: 0, leaderId: null },
|
|
@@ -2293,31 +2284,31 @@ function Kt() {
|
|
|
2293
2284
|
activeGameId: null
|
|
2294
2285
|
});
|
|
2295
2286
|
}
|
|
2296
|
-
function
|
|
2287
|
+
function vi() {
|
|
2297
2288
|
u("chat", "Emitting recap_request"), oe().emit("recap_request");
|
|
2298
2289
|
}
|
|
2299
|
-
function
|
|
2290
|
+
function _i() {
|
|
2300
2291
|
E(() => {
|
|
2301
|
-
const e =
|
|
2302
|
-
const
|
|
2303
|
-
u("avatar", "Avatar changed in the settings popout", { sprite:
|
|
2304
|
-
}), n =
|
|
2305
|
-
u("avatar", "Renamed in the settings popout", { name: r }),
|
|
2292
|
+
const e = Er(), t = kr((r, a) => {
|
|
2293
|
+
const i = Ra(a);
|
|
2294
|
+
u("avatar", "Avatar changed in the settings popout", { sprite: i, source: a.avatar?.source }), zn(i);
|
|
2295
|
+
}), n = La((r) => {
|
|
2296
|
+
u("avatar", "Renamed in the settings popout", { name: r }), hi(r);
|
|
2306
2297
|
});
|
|
2307
2298
|
return () => {
|
|
2308
2299
|
t(), n(), e();
|
|
2309
2300
|
};
|
|
2310
2301
|
}, []);
|
|
2311
2302
|
}
|
|
2312
|
-
function
|
|
2313
|
-
return (t ?
|
|
2303
|
+
function wi(e, t) {
|
|
2304
|
+
return (t ? yr(t) : null) ?? Mn(e);
|
|
2314
2305
|
}
|
|
2315
2306
|
function xt(e, t) {
|
|
2316
2307
|
return E(() => {
|
|
2317
|
-
t &&
|
|
2318
|
-
}, [t]),
|
|
2308
|
+
t && hr(t);
|
|
2309
|
+
}, [t]), nr(gr, () => wi(e, t), () => Mn(e));
|
|
2319
2310
|
}
|
|
2320
|
-
function
|
|
2311
|
+
function Si(e, t) {
|
|
2321
2312
|
if (t.clientId) {
|
|
2322
2313
|
const n = e[t.clientId];
|
|
2323
2314
|
if (n && (!t.author || !n.author || n.author === t.author)) return n;
|
|
@@ -2326,8 +2317,8 @@ function xi(e, t) {
|
|
|
2326
2317
|
for (const n of Object.values(e)) if (n.author === t.author) return n;
|
|
2327
2318
|
}
|
|
2328
2319
|
}
|
|
2329
|
-
function
|
|
2330
|
-
const r =
|
|
2320
|
+
function xi(e, t, n) {
|
|
2321
|
+
const r = Si(e, t);
|
|
2331
2322
|
return r ? {
|
|
2332
2323
|
name: r.name || n.name,
|
|
2333
2324
|
// A connection briefly without a character (a reconnect waiting for one to
|
|
@@ -2338,14 +2329,14 @@ function Ci(e, t, n) {
|
|
|
2338
2329
|
here: !0
|
|
2339
2330
|
} : { name: n.name, sprite: n.sprite, pictureUrl: n.pictureUrl, here: !1 };
|
|
2340
2331
|
}
|
|
2341
|
-
function
|
|
2342
|
-
return !t || !n.here ? e : t.split(
|
|
2332
|
+
function Ci(e, t, n) {
|
|
2333
|
+
return !t || !n.here ? e : t.split(un).join(n.name);
|
|
2343
2334
|
}
|
|
2344
|
-
function
|
|
2345
|
-
const n = m((r) => JSON.stringify(
|
|
2335
|
+
function Xn(e, t) {
|
|
2336
|
+
const n = m((r) => JSON.stringify(xi(r.roster, e, t)));
|
|
2346
2337
|
return ee(() => JSON.parse(n), [n]);
|
|
2347
2338
|
}
|
|
2348
|
-
function
|
|
2339
|
+
function Jn({ sprite: e, url: t, alt: n = "", className: r, style: a, fallback: i }) {
|
|
2349
2340
|
const [s, l] = k(null);
|
|
2350
2341
|
if (t && t !== s)
|
|
2351
2342
|
return /* @__PURE__ */ c(
|
|
@@ -2360,13 +2351,13 @@ function tr({ sprite: e, url: t, alt: n = "", className: r, style: a, fallback:
|
|
|
2360
2351
|
onError: () => l(t)
|
|
2361
2352
|
}
|
|
2362
2353
|
);
|
|
2363
|
-
const d =
|
|
2354
|
+
const d = ia(e);
|
|
2364
2355
|
return d ? /* @__PURE__ */ c("img", { src: d, alt: n, crossOrigin: "anonymous", className: r, style: a, draggable: !1 }) : /* @__PURE__ */ c(le, { children: i });
|
|
2365
2356
|
}
|
|
2366
|
-
function
|
|
2357
|
+
function Qn({ sprite: e, url: t, alt: n, worn: r }) {
|
|
2367
2358
|
return /* @__PURE__ */ _("span", { className: "hc-av", style: { "--hc-sz": "32px" }, children: [
|
|
2368
2359
|
/* @__PURE__ */ c("span", { className: "hc-pic", children: /* @__PURE__ */ c(
|
|
2369
|
-
|
|
2360
|
+
Jn,
|
|
2370
2361
|
{
|
|
2371
2362
|
sprite: e,
|
|
2372
2363
|
url: t,
|
|
@@ -2375,21 +2366,21 @@ function nr({ sprite: e, url: t, alt: n, worn: r }) {
|
|
|
2375
2366
|
fallback: /* @__PURE__ */ c("span", { className: "inline-block w-8 h-8 bg-bg-alt/50 rounded-full flex-shrink-0" })
|
|
2376
2367
|
}
|
|
2377
2368
|
) }),
|
|
2378
|
-
r?.overlay && /* @__PURE__ */ c(ge, { html:
|
|
2369
|
+
r?.overlay && /* @__PURE__ */ c(ge, { html: br(r), style: { display: "contents" } })
|
|
2379
2370
|
] });
|
|
2380
2371
|
}
|
|
2381
|
-
function
|
|
2372
|
+
function Ii(e) {
|
|
2382
2373
|
return !(e.button !== 0 || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey);
|
|
2383
2374
|
}
|
|
2384
|
-
function
|
|
2375
|
+
function Ti({ src: e, title: t, onClose: n }) {
|
|
2385
2376
|
E(() => {
|
|
2386
2377
|
const i = (s) => {
|
|
2387
2378
|
mt(s) && (s.stopPropagation(), n());
|
|
2388
2379
|
};
|
|
2389
2380
|
return document.addEventListener("keydown", i, !0), () => document.removeEventListener("keydown", i, !0);
|
|
2390
2381
|
}, [n]);
|
|
2391
|
-
const r =
|
|
2392
|
-
return a ?
|
|
2382
|
+
const r = Do(), a = typeof document > "u" ? null : document.fullscreenElement ?? r ?? document.body;
|
|
2383
|
+
return a ? Ar(
|
|
2393
2384
|
/* @__PURE__ */ _(
|
|
2394
2385
|
"div",
|
|
2395
2386
|
{
|
|
@@ -2427,11 +2418,11 @@ function ki({ src: e, title: t, onClose: n }) {
|
|
|
2427
2418
|
a
|
|
2428
2419
|
) : null;
|
|
2429
2420
|
}
|
|
2430
|
-
const
|
|
2431
|
-
function
|
|
2421
|
+
const Je = 240, ki = 320;
|
|
2422
|
+
function Ei({ image: e }) {
|
|
2432
2423
|
const [t, n] = k(!1), r = je(e.key);
|
|
2433
2424
|
if (!r) return null;
|
|
2434
|
-
const a = e.w > 0 && e.h > 0, i = a ? Math.min(1,
|
|
2425
|
+
const a = e.w > 0 && e.h > 0, i = a ? Math.min(1, ki / e.w, Je / e.h) : 1;
|
|
2435
2426
|
return /* @__PURE__ */ _(le, { children: [
|
|
2436
2427
|
/* @__PURE__ */ c(
|
|
2437
2428
|
"a",
|
|
@@ -2442,7 +2433,7 @@ function Ai({ image: e }) {
|
|
|
2442
2433
|
className: "block max-w-full cursor-zoom-in",
|
|
2443
2434
|
"data-testid": "chat-image",
|
|
2444
2435
|
onClick: (s) => {
|
|
2445
|
-
|
|
2436
|
+
Ii(s) && (s.preventDefault(), n(!0));
|
|
2446
2437
|
},
|
|
2447
2438
|
children: /* @__PURE__ */ c(
|
|
2448
2439
|
"img",
|
|
@@ -2454,13 +2445,13 @@ function Ai({ image: e }) {
|
|
|
2454
2445
|
width: a ? Math.round(e.w * i) : void 0,
|
|
2455
2446
|
height: a ? Math.round(e.h * i) : void 0,
|
|
2456
2447
|
className: "rounded border border-border-light object-contain bg-bg-alt/30",
|
|
2457
|
-
style: a ? { aspectRatio: `${e.w} / ${e.h}`, maxWidth: "100%", maxHeight:
|
|
2448
|
+
style: a ? { aspectRatio: `${e.w} / ${e.h}`, maxWidth: "100%", maxHeight: Je } : { maxWidth: "100%", maxHeight: Je }
|
|
2458
2449
|
}
|
|
2459
2450
|
)
|
|
2460
2451
|
}
|
|
2461
2452
|
),
|
|
2462
2453
|
t && /* @__PURE__ */ c(
|
|
2463
|
-
|
|
2454
|
+
Ti,
|
|
2464
2455
|
{
|
|
2465
2456
|
src: r,
|
|
2466
2457
|
title: e.title,
|
|
@@ -2469,45 +2460,45 @@ function Ai({ image: e }) {
|
|
|
2469
2460
|
)
|
|
2470
2461
|
] });
|
|
2471
2462
|
}
|
|
2472
|
-
function
|
|
2473
|
-
return e?.length ? /* @__PURE__ */ c("div", { className: "flex flex-wrap gap-1 mt-1", "data-testid": "chat-images", children: e.map((t, n) => /* @__PURE__ */ c(
|
|
2463
|
+
function Zn({ images: e }) {
|
|
2464
|
+
return e?.length ? /* @__PURE__ */ c("div", { className: "flex flex-wrap gap-1 mt-1", "data-testid": "chat-images", children: e.map((t, n) => /* @__PURE__ */ c(Ei, { image: t }, `${t.key}-${n}`)) }) : null;
|
|
2474
2465
|
}
|
|
2475
|
-
function
|
|
2466
|
+
function Ai(e, t) {
|
|
2476
2467
|
return e.author && t.author ? e.author === t.author : !!t.clientId && e.clientId === t.clientId;
|
|
2477
2468
|
}
|
|
2478
|
-
function
|
|
2469
|
+
function Qe(e) {
|
|
2479
2470
|
return new Date(e).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
2480
2471
|
}
|
|
2481
|
-
const
|
|
2482
|
-
const n = m((f) => f.me.clientId), r = m((f) => f.me.clientId ? f.roster[f.me.clientId]?.author : void 0), a =
|
|
2472
|
+
const Ni = Le.memo(function({ message: t }) {
|
|
2473
|
+
const n = m((f) => f.me.clientId), r = m((f) => f.me.clientId ? f.roster[f.me.clientId]?.author : void 0), a = Ai(t, { clientId: n, author: r }), i = Xn(
|
|
2483
2474
|
{ clientId: t.clientId, author: t.author },
|
|
2484
2475
|
{ name: t.name, sprite: t.sprite }
|
|
2485
2476
|
), s = xt(i.sprite, i.pictureUrl), l = t.isSystem ? void 0 : i.cosmetics, d = W(null);
|
|
2486
|
-
|
|
2477
|
+
Oo(d, !!l);
|
|
2487
2478
|
const [h] = k(
|
|
2488
|
-
() => t.live && t.text ?
|
|
2479
|
+
() => t.live && t.text ? tn(t.text, l) : null
|
|
2489
2480
|
);
|
|
2490
2481
|
return t.isSystem && t.systemType === "recap" ? /* @__PURE__ */ c("div", { className: "px-2 py-1.5", children: /* @__PURE__ */ _("div", { className: "border-l-2 border-border-light pl-2.5 py-0.5", children: [
|
|
2491
2482
|
/* @__PURE__ */ _("div", { className: "text-[10px] uppercase tracking-wide text-text-muted mb-0.5", children: [
|
|
2492
2483
|
"Recap",
|
|
2493
|
-
/* @__PURE__ */ c("span", { className: "ml-1.5 normal-case tracking-normal opacity-60", children:
|
|
2484
|
+
/* @__PURE__ */ c("span", { className: "ml-1.5 normal-case tracking-normal opacity-60", children: Qe(t.ts) })
|
|
2494
2485
|
] }),
|
|
2495
2486
|
/* @__PURE__ */ c("p", { className: "text-[13px] text-text-secondary leading-relaxed whitespace-pre-wrap break-words", children: t.text })
|
|
2496
2487
|
] }) }) : t.isSystem ? /* @__PURE__ */ _("div", { className: "px-2 py-0.5 text-[11px] text-text-muted italic text-center leading-tight", children: [
|
|
2497
|
-
|
|
2498
|
-
/* @__PURE__ */ c("span", { className: "ml-1 text-[10px] opacity-50", children:
|
|
2499
|
-
] }) : /* @__PURE__ */ _("div", { ref: d, style:
|
|
2500
|
-
/* @__PURE__ */ c(
|
|
2488
|
+
Ci(t.text, t.template, i),
|
|
2489
|
+
/* @__PURE__ */ c("span", { className: "ml-1 text-[10px] opacity-50", children: Qe(t.ts) })
|
|
2490
|
+
] }) : /* @__PURE__ */ _("div", { ref: d, style: An(s), className: `flex items-start gap-2 px-2 py-1 hover:bg-bg-card/20 ${a ? "bg-bg-card/30" : ""}`, children: [
|
|
2491
|
+
/* @__PURE__ */ c(Qn, { sprite: i.sprite, url: i.pictureUrl, alt: i.name, worn: l }),
|
|
2501
2492
|
/* @__PURE__ */ _("div", { className: "flex-1 min-w-0 -mt-0.5", children: [
|
|
2502
|
-
l ? /* @__PURE__ */ c(ge, { html:
|
|
2503
|
-
/* @__PURE__ */ c("span", { className: "text-[10px] text-text-muted opacity-60 ml-1.5", children:
|
|
2493
|
+
l ? /* @__PURE__ */ c(ge, { html: nn(i.name, l), className: "text-[13px]", style: { color: s } }) : /* @__PURE__ */ c("span", { className: "font-medium text-[13px]", style: { color: s }, children: i.name }),
|
|
2494
|
+
/* @__PURE__ */ c("span", { className: "text-[10px] text-text-muted opacity-60 ml-1.5", children: Qe(t.ts) }),
|
|
2504
2495
|
t.text && (h ? /* @__PURE__ */ c(ge, { as: "p", html: h, className: "text-[13px] text-text break-words leading-snug m-0" }) : /* @__PURE__ */ c("p", { className: "text-[13px] text-text break-words leading-snug m-0", children: t.text })),
|
|
2505
|
-
/* @__PURE__ */ c(
|
|
2496
|
+
/* @__PURE__ */ c(Zn, { images: t.images })
|
|
2506
2497
|
] })
|
|
2507
2498
|
] });
|
|
2508
2499
|
});
|
|
2509
|
-
function
|
|
2510
|
-
|
|
2500
|
+
function Pi() {
|
|
2501
|
+
En();
|
|
2511
2502
|
const e = m((a) => a.chat), t = W(null), n = W(!1), r = A(() => {
|
|
2512
2503
|
const a = t.current;
|
|
2513
2504
|
if (!a) return;
|
|
@@ -2531,7 +2522,7 @@ function Ri() {
|
|
|
2531
2522
|
/* @__PURE__ */ c("span", { className: "text-[10px] text-text-muted whitespace-nowrap", children: new Date(a.ts).toLocaleDateString([], { weekday: "short", month: "short", day: "numeric" }) }),
|
|
2532
2523
|
/* @__PURE__ */ c("div", { className: "flex-1 h-px bg-border" })
|
|
2533
2524
|
] }),
|
|
2534
|
-
/* @__PURE__ */ c(
|
|
2525
|
+
/* @__PURE__ */ c(Ni, { message: a })
|
|
2535
2526
|
] }, a.id);
|
|
2536
2527
|
}) })
|
|
2537
2528
|
}
|
|
@@ -2558,12 +2549,12 @@ const Ct = [
|
|
|
2558
2549
|
scope: "local"
|
|
2559
2550
|
}
|
|
2560
2551
|
], ce = "/";
|
|
2561
|
-
function
|
|
2552
|
+
function Ri(e) {
|
|
2562
2553
|
if (!e.startsWith(ce)) return null;
|
|
2563
2554
|
const t = e.slice(ce.length);
|
|
2564
2555
|
return /\s/.test(t) ? null : t.toLowerCase();
|
|
2565
2556
|
}
|
|
2566
|
-
function
|
|
2557
|
+
function Di(e, t = Ct) {
|
|
2567
2558
|
const n = e.toLowerCase();
|
|
2568
2559
|
if (!n) return [...t].sort((a, i) => a.name.localeCompare(i.name));
|
|
2569
2560
|
const r = [];
|
|
@@ -2573,23 +2564,23 @@ function Oi(e, t = Ct) {
|
|
|
2573
2564
|
}
|
|
2574
2565
|
return r.sort((a, i) => a.rank - i.rank || a.cmd.name.localeCompare(i.cmd.name)).map((a) => a.cmd);
|
|
2575
2566
|
}
|
|
2576
|
-
function
|
|
2567
|
+
function Oi(e) {
|
|
2577
2568
|
return `${ce}${e.name} `;
|
|
2578
2569
|
}
|
|
2579
|
-
function
|
|
2570
|
+
function Ze(e, t) {
|
|
2580
2571
|
return t <= 0 ? 0 : (e % t + t) % t;
|
|
2581
2572
|
}
|
|
2582
|
-
function
|
|
2573
|
+
function Mi(e, t = Ct) {
|
|
2583
2574
|
const n = e.trim();
|
|
2584
2575
|
if (!n) return null;
|
|
2585
2576
|
if (!n.startsWith(ce)) return { kind: "chat", text: n };
|
|
2586
2577
|
const r = n.slice(ce.length), a = r.search(/\s/), i = (a === -1 ? r : r.slice(0, a)).toLowerCase(), s = a === -1 ? "" : r.slice(a).trim(), l = t.find((d) => d.name.toLowerCase() === i);
|
|
2587
2578
|
return l ? { kind: "command", command: l, args: s } : { kind: "chat", text: n };
|
|
2588
2579
|
}
|
|
2589
|
-
function
|
|
2580
|
+
function Li(e, t) {
|
|
2590
2581
|
return e.requiresMedia && !t.hasMedia ? `${ce}${e.name} needs an episode loaded.` : null;
|
|
2591
2582
|
}
|
|
2592
|
-
function
|
|
2583
|
+
function ji({
|
|
2593
2584
|
commands: e,
|
|
2594
2585
|
activeIndex: t,
|
|
2595
2586
|
hasMedia: n,
|
|
@@ -2631,7 +2622,7 @@ function Ui({
|
|
|
2631
2622
|
}
|
|
2632
2623
|
);
|
|
2633
2624
|
}
|
|
2634
|
-
function
|
|
2625
|
+
function Ui({
|
|
2635
2626
|
pending: e,
|
|
2636
2627
|
uploading: t,
|
|
2637
2628
|
onRemove: n
|
|
@@ -2665,17 +2656,17 @@ function Hi() {
|
|
|
2665
2656
|
i.current.clear();
|
|
2666
2657
|
}, []);
|
|
2667
2658
|
const s = A((p) => {
|
|
2668
|
-
|
|
2659
|
+
po(p) && (URL.revokeObjectURL(p.previewUrl), i.current.delete(p.previewUrl));
|
|
2669
2660
|
}, []), l = A(async (p) => {
|
|
2670
2661
|
if (!p.length) return;
|
|
2671
2662
|
const x = [];
|
|
2672
2663
|
for (const w of p) {
|
|
2673
|
-
const y =
|
|
2664
|
+
const y = go(w);
|
|
2674
2665
|
if (y) {
|
|
2675
2666
|
a("error", y);
|
|
2676
2667
|
continue;
|
|
2677
2668
|
}
|
|
2678
|
-
const { w: g, h: T } = await
|
|
2669
|
+
const { w: g, h: T } = await vo(w), N = URL.createObjectURL(w);
|
|
2679
2670
|
i.current.add(N), x.push({
|
|
2680
2671
|
kind: "file",
|
|
2681
2672
|
id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
@@ -2710,7 +2701,7 @@ function Hi() {
|
|
|
2710
2701
|
w: p.width ?? 0,
|
|
2711
2702
|
h: p.height ?? 0,
|
|
2712
2703
|
title: p.title || void 0
|
|
2713
|
-
}]),
|
|
2704
|
+
}]), We().catalogue(Cn).recordUse(p.key));
|
|
2714
2705
|
}, [a]), h = A((p) => {
|
|
2715
2706
|
t((x) => {
|
|
2716
2707
|
const w = x.find((y) => y.id === p);
|
|
@@ -2722,20 +2713,20 @@ function Hi() {
|
|
|
2722
2713
|
return [];
|
|
2723
2714
|
});
|
|
2724
2715
|
}, [s]), M = A((p) => {
|
|
2725
|
-
const x =
|
|
2716
|
+
const x = yo(p.clipboardData);
|
|
2726
2717
|
x.length && (p.preventDefault(), l(x));
|
|
2727
2718
|
}, [l]), R = A((p) => {
|
|
2728
|
-
const x =
|
|
2719
|
+
const x = bo(p.dataTransfer);
|
|
2729
2720
|
x.length && (p.preventDefault(), l(x));
|
|
2730
2721
|
}, [l]), D = A((p) => {
|
|
2731
2722
|
p.dataTransfer?.types?.includes("Files") && p.preventDefault();
|
|
2732
|
-
}, []),
|
|
2723
|
+
}, []), H = A(async () => {
|
|
2733
2724
|
if (!e.length) return [];
|
|
2734
2725
|
r(!0);
|
|
2735
2726
|
try {
|
|
2736
|
-
return await
|
|
2727
|
+
return await wo(e);
|
|
2737
2728
|
} catch (p) {
|
|
2738
|
-
return I("chat", "Image upload failed",
|
|
2729
|
+
return I("chat", "Image upload failed", So(p)), a("error", ho(p)), null;
|
|
2739
2730
|
} finally {
|
|
2740
2731
|
r(!1);
|
|
2741
2732
|
}
|
|
@@ -2747,44 +2738,44 @@ function Hi() {
|
|
|
2747
2738
|
addMeme: d,
|
|
2748
2739
|
remove: h,
|
|
2749
2740
|
clear: f,
|
|
2750
|
-
uploadPending:
|
|
2741
|
+
uploadPending: H,
|
|
2751
2742
|
onPaste: M,
|
|
2752
2743
|
onDrop: R,
|
|
2753
2744
|
onDragOver: D
|
|
2754
2745
|
};
|
|
2755
2746
|
}
|
|
2756
|
-
const
|
|
2757
|
-
function
|
|
2758
|
-
const [t, n] = k(""), [r, a] = k(!1), [i, s] = k({ q: null, i: 0 }), [l, d] = k(!1), h = W(null), f =
|
|
2759
|
-
() => T === null ? [] :
|
|
2747
|
+
const Kt = ln, Fi = Rr;
|
|
2748
|
+
function $i({ commands: e = Ct }) {
|
|
2749
|
+
const [t, n] = k(""), [r, a] = k(!1), [i, s] = k({ q: null, i: 0 }), [l, d] = k(!1), h = W(null), f = rr(), [M, R] = k(!1), [D, H] = k(!1), p = Hi(), x = m((b) => b.snapshot.mediaId), w = m((b) => b.pushToast), y = m((b) => b.setTierlistOpen), g = !!x, T = Ri(t), N = ee(
|
|
2750
|
+
() => T === null ? [] : Di(T, e),
|
|
2760
2751
|
[T, e]
|
|
2761
|
-
), j = T !== null && !l && N.length > 0, U = i.q === T ?
|
|
2752
|
+
), j = T !== null && !l && N.length > 0, U = i.q === T ? Ze(i.i, N.length) : 0, C = A(
|
|
2762
2753
|
(b) => s({ q: T, i: b }),
|
|
2763
2754
|
[T]
|
|
2764
2755
|
), O = A((b, L) => {
|
|
2765
|
-
const ue =
|
|
2756
|
+
const ue = Li(b, { hasMedia: g });
|
|
2766
2757
|
if (ue) {
|
|
2767
2758
|
w("info", ue);
|
|
2768
2759
|
return;
|
|
2769
2760
|
}
|
|
2770
2761
|
switch (b.name) {
|
|
2771
2762
|
case "help":
|
|
2772
|
-
w("info", e.map((
|
|
2763
|
+
w("info", e.map((tr) => tr.usage).join(" "));
|
|
2773
2764
|
break;
|
|
2774
2765
|
case "recap":
|
|
2775
|
-
|
|
2766
|
+
vi();
|
|
2776
2767
|
break;
|
|
2777
2768
|
case "tierlist":
|
|
2778
|
-
|
|
2769
|
+
Ea(), y(!0);
|
|
2779
2770
|
break;
|
|
2780
2771
|
default:
|
|
2781
2772
|
w("info", `${b.usage} is not implemented yet.`);
|
|
2782
2773
|
}
|
|
2783
2774
|
}, [g, w, e, y]), P = A((b) => {
|
|
2784
|
-
n(
|
|
2785
|
-
}, []),
|
|
2775
|
+
n(Oi(b)), d(!1), h.current?.focus();
|
|
2776
|
+
}, []), F = A(async (b) => {
|
|
2786
2777
|
if (b.preventDefault(), r || p.uploading) return;
|
|
2787
|
-
const L =
|
|
2778
|
+
const L = Mi(t, e);
|
|
2788
2779
|
if (!L && !p.pending.length) return;
|
|
2789
2780
|
if (L?.kind === "command" && p.pending.length) {
|
|
2790
2781
|
w("info", "Send images on their own, not with a command.");
|
|
@@ -2795,7 +2786,7 @@ function Bi({ commands: e = Ct }) {
|
|
|
2795
2786
|
return;
|
|
2796
2787
|
}
|
|
2797
2788
|
const ue = await p.uploadPending();
|
|
2798
|
-
ue !== null && (
|
|
2789
|
+
ue !== null && (fi(L?.text ?? "", ue), n(""), p.clear(), a(!0), setTimeout(() => a(!1), Fi), !document.hidden && document.hasFocus() && h.current?.focus());
|
|
2799
2790
|
}, [t, r, O, p, w, e]), ae = A((b) => {
|
|
2800
2791
|
if (b.key === "Escape" && j) {
|
|
2801
2792
|
b.preventDefault(), d(!0);
|
|
@@ -2803,9 +2794,9 @@ function Bi({ commands: e = Ct }) {
|
|
|
2803
2794
|
}
|
|
2804
2795
|
if (j) {
|
|
2805
2796
|
if (b.key === "ArrowDown")
|
|
2806
|
-
b.preventDefault(), C(
|
|
2797
|
+
b.preventDefault(), C(Ze(U + 1, N.length));
|
|
2807
2798
|
else if (b.key === "ArrowUp")
|
|
2808
|
-
b.preventDefault(), C(
|
|
2799
|
+
b.preventDefault(), C(Ze(U - 1, N.length));
|
|
2809
2800
|
else if (b.key === "Tab") {
|
|
2810
2801
|
b.preventDefault();
|
|
2811
2802
|
const L = N[U];
|
|
@@ -2823,22 +2814,22 @@ function Bi({ commands: e = Ct }) {
|
|
|
2823
2814
|
};
|
|
2824
2815
|
return window.addEventListener("watchparty:focus-chat-input", b), () => window.removeEventListener("watchparty:focus-chat-input", b);
|
|
2825
2816
|
}, []);
|
|
2826
|
-
const ie =
|
|
2817
|
+
const ie = Kt - t.length, te = ie <= 100, X = j ? N[U] : void 0;
|
|
2827
2818
|
return /* @__PURE__ */ _(
|
|
2828
2819
|
"form",
|
|
2829
2820
|
{
|
|
2830
2821
|
onSubmit: (b) => {
|
|
2831
|
-
|
|
2822
|
+
F(b);
|
|
2832
2823
|
},
|
|
2833
2824
|
onPaste: p.onPaste,
|
|
2834
2825
|
onDrop: p.onDrop,
|
|
2835
2826
|
onDragOver: p.onDragOver,
|
|
2836
2827
|
className: "p-2 border-t border-border",
|
|
2837
2828
|
children: [
|
|
2838
|
-
/* @__PURE__ */ c(
|
|
2829
|
+
/* @__PURE__ */ c(Ui, { pending: p.pending, uploading: p.uploading, onRemove: p.remove }),
|
|
2839
2830
|
/* @__PURE__ */ _("div", { className: "relative", children: [
|
|
2840
2831
|
j && /* @__PURE__ */ c(
|
|
2841
|
-
|
|
2832
|
+
ji,
|
|
2842
2833
|
{
|
|
2843
2834
|
commands: N,
|
|
2844
2835
|
activeIndex: U,
|
|
@@ -2849,13 +2840,13 @@ function Bi({ commands: e = Ct }) {
|
|
|
2849
2840
|
}
|
|
2850
2841
|
),
|
|
2851
2842
|
/* @__PURE__ */ c(
|
|
2852
|
-
|
|
2843
|
+
Ao,
|
|
2853
2844
|
{
|
|
2854
2845
|
open: M,
|
|
2855
2846
|
onClose: () => R(!1),
|
|
2856
2847
|
onPick: p.addMeme,
|
|
2857
2848
|
onUnavailable: () => {
|
|
2858
|
-
|
|
2849
|
+
H(!0), R(!1);
|
|
2859
2850
|
}
|
|
2860
2851
|
}
|
|
2861
2852
|
),
|
|
@@ -2871,7 +2862,7 @@ function Bi({ commands: e = Ct }) {
|
|
|
2871
2862
|
n(b.target.value), d(!1);
|
|
2872
2863
|
},
|
|
2873
2864
|
onKeyDown: ae,
|
|
2874
|
-
maxLength:
|
|
2865
|
+
maxLength: Kt,
|
|
2875
2866
|
placeholder: "Send a message",
|
|
2876
2867
|
role: "combobox",
|
|
2877
2868
|
"aria-expanded": j,
|
|
@@ -2893,7 +2884,7 @@ function Bi({ commands: e = Ct }) {
|
|
|
2893
2884
|
title: "Add a meme",
|
|
2894
2885
|
"data-testid": "meme-button",
|
|
2895
2886
|
className: `shrink-0 rounded border border-border-light px-2 py-1.5 text-sm hover:border-primary ${M ? "text-text border-primary" : "text-text-secondary"}`,
|
|
2896
|
-
children: /* @__PURE__ */ c(
|
|
2887
|
+
children: /* @__PURE__ */ c(or, { name: "image" })
|
|
2897
2888
|
}
|
|
2898
2889
|
)
|
|
2899
2890
|
] })
|
|
@@ -2902,15 +2893,15 @@ function Bi({ commands: e = Ct }) {
|
|
|
2902
2893
|
}
|
|
2903
2894
|
);
|
|
2904
2895
|
}
|
|
2905
|
-
function
|
|
2896
|
+
function Bi() {
|
|
2906
2897
|
const e = m((n) => n.roster), t = Object.values(e);
|
|
2907
|
-
return t.length ? /* @__PURE__ */ c("div", { className: "flex flex-col gap-1", children: t.map((n) => /* @__PURE__ */ c(
|
|
2898
|
+
return t.length ? /* @__PURE__ */ c("div", { className: "flex flex-col gap-1", children: t.map((n) => /* @__PURE__ */ c(Gi, { u: n }, n.clientId)) }) : /* @__PURE__ */ c("div", { className: "text-xs text-text-muted", children: "No users online" });
|
|
2908
2899
|
}
|
|
2909
|
-
function
|
|
2900
|
+
function Gi({ u: e }) {
|
|
2910
2901
|
const t = xt(e.sprite, e.avatarUrl);
|
|
2911
2902
|
return /* @__PURE__ */ _("div", { className: "flex items-center gap-2 py-0.5", children: [
|
|
2912
2903
|
/* @__PURE__ */ c(
|
|
2913
|
-
|
|
2904
|
+
Jn,
|
|
2914
2905
|
{
|
|
2915
2906
|
sprite: e.sprite,
|
|
2916
2907
|
url: e.avatarUrl,
|
|
@@ -2923,7 +2914,7 @@ function Wi({ u: e }) {
|
|
|
2923
2914
|
e.isLeader && /* @__PURE__ */ c("span", { className: "ml-auto px-1.5 py-0.5 rounded text-[9px] font-medium bg-success/20 text-success", children: "Leader" })
|
|
2924
2915
|
] });
|
|
2925
2916
|
}
|
|
2926
|
-
function
|
|
2917
|
+
function Wi() {
|
|
2927
2918
|
const e = m((i) => Object.keys(i.roster).length), [t, n] = k(!1), r = W(null), a = W(null);
|
|
2928
2919
|
return E(() => {
|
|
2929
2920
|
if (!t) return;
|
|
@@ -2959,11 +2950,11 @@ function Vi() {
|
|
|
2959
2950
|
e,
|
|
2960
2951
|
" online"
|
|
2961
2952
|
] }),
|
|
2962
|
-
/* @__PURE__ */ c(
|
|
2953
|
+
/* @__PURE__ */ c(Bi, {})
|
|
2963
2954
|
] })
|
|
2964
2955
|
] });
|
|
2965
2956
|
}
|
|
2966
|
-
function
|
|
2957
|
+
function Yt({ className: e = "fixed bottom-4 left-1/2 -translate-x-1/2" }) {
|
|
2967
2958
|
const t = m((r) => r.toasts), n = m((r) => r.popToast);
|
|
2968
2959
|
return E(() => {
|
|
2969
2960
|
const r = t.map((a) => setTimeout(() => n(a.id), 4e3));
|
|
@@ -2972,43 +2963,43 @@ function zt({ className: e = "fixed bottom-4 left-1/2 -translate-x-1/2" }) {
|
|
|
2972
2963
|
};
|
|
2973
2964
|
}, [t, n]), /* @__PURE__ */ c("div", { className: `${e} flex flex-col gap-2 z-50`, children: t.map((r) => /* @__PURE__ */ c("div", { className: `px-3 py-2 rounded text-sm shadow font-medium border ${r.kind === "error" ? "bg-danger-bg text-on-danger-bg border-danger" : "bg-bg-card border-border-light text-text"}`, children: r.msg }, r.id)) });
|
|
2974
2965
|
}
|
|
2975
|
-
const
|
|
2966
|
+
const er = 9e3, zt = 1500, qi = {
|
|
2976
2967
|
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]",
|
|
2977
2968
|
cinema: "drop-shadow-[0_2px_4px_rgba(0,0,0,0.9)]",
|
|
2978
2969
|
minimal: "drop-shadow-[0_2px_4px_rgba(0,0,0,0.9)] drop-shadow-[0_0_8px_rgba(0,0,0,0.7)]",
|
|
2979
2970
|
contrast: "bg-black/70 px-2 py-0.5 rounded"
|
|
2980
|
-
},
|
|
2971
|
+
}, Xt = { WebkitTextStroke: "0.5px black", paintOrder: "stroke fill" }, Jt = {
|
|
2981
2972
|
textShadow: "none",
|
|
2982
2973
|
filter: "drop-shadow(0 0 1px black) drop-shadow(0 0 1px black)"
|
|
2983
2974
|
};
|
|
2984
|
-
function
|
|
2985
|
-
const r =
|
|
2975
|
+
function Vi({ message: e, age: t, ccStyle: n }) {
|
|
2976
|
+
const r = er - zt;
|
|
2986
2977
|
let a = 1;
|
|
2987
|
-
t > r && (a = Math.max(0, 1 - (t - r) /
|
|
2988
|
-
const i = qi[n], s =
|
|
2978
|
+
t > r && (a = Math.max(0, 1 - (t - r) / zt));
|
|
2979
|
+
const i = qi[n], s = Xn(
|
|
2989
2980
|
{ clientId: e.clientId, author: e.author },
|
|
2990
2981
|
{ name: e.name, sprite: e.sprite }
|
|
2991
2982
|
), l = xt(s.sprite, s.pictureUrl), d = s.cosmetics, [h] = k(
|
|
2992
|
-
() => e.live && e.text ?
|
|
2983
|
+
() => e.live && e.text ? tn(e.text, d) : null
|
|
2993
2984
|
);
|
|
2994
2985
|
return /* @__PURE__ */ _(
|
|
2995
2986
|
"div",
|
|
2996
2987
|
{
|
|
2997
2988
|
className: `flex items-start gap-2 py-1 ${i}`,
|
|
2998
|
-
style: { opacity: a, transition: "opacity 0.15s ease-out", ...
|
|
2989
|
+
style: { opacity: a, transition: "opacity 0.15s ease-out", ...An(l) },
|
|
2999
2990
|
children: [
|
|
3000
|
-
/* @__PURE__ */ c(
|
|
2991
|
+
/* @__PURE__ */ c(Qn, { sprite: s.sprite, url: s.pictureUrl, worn: d }),
|
|
3001
2992
|
/* @__PURE__ */ _("div", { className: "min-w-0 flex-1", children: [
|
|
3002
|
-
d ? /* @__PURE__ */ c(ge, { html:
|
|
3003
|
-
h ? /* @__PURE__ */ c(ge, { html: h, className: "text-sm text-white break-words", style:
|
|
3004
|
-
/* @__PURE__ */ c(
|
|
2993
|
+
d ? /* @__PURE__ */ c(ge, { html: nn(s.name, d), className: "text-sm mr-2", style: { color: l, ...Jt } }) : /* @__PURE__ */ c("span", { className: "font-medium text-sm mr-2", style: { color: l, ...Xt }, children: s.name }),
|
|
2994
|
+
h ? /* @__PURE__ */ c(ge, { html: h, className: "text-sm text-white break-words", style: Jt }) : /* @__PURE__ */ c("span", { className: "text-sm text-white break-words", style: Xt, children: e.text }),
|
|
2995
|
+
/* @__PURE__ */ c(Zn, { images: e.images })
|
|
3005
2996
|
] })
|
|
3006
2997
|
]
|
|
3007
2998
|
}
|
|
3008
2999
|
);
|
|
3009
3000
|
}
|
|
3010
|
-
function
|
|
3011
|
-
|
|
3001
|
+
function Ki({ shown: e, className: t }) {
|
|
3002
|
+
En();
|
|
3012
3003
|
const n = m((d) => d.chat), r = m((d) => d.mediaPrefs.subtitleStyle), [a, i] = k(() => Date.now()), s = n.length > 0;
|
|
3013
3004
|
E(() => {
|
|
3014
3005
|
const d = setInterval(() => {
|
|
@@ -3017,7 +3008,7 @@ function Yi({ shown: e, className: t }) {
|
|
|
3017
3008
|
return () => clearInterval(d);
|
|
3018
3009
|
}, [s]);
|
|
3019
3010
|
const l = ee(() => {
|
|
3020
|
-
const d = a -
|
|
3011
|
+
const d = a - er;
|
|
3021
3012
|
return n.filter((h) => !h.isSystem && h.ts > d).slice(-12);
|
|
3022
3013
|
}, [n, a]);
|
|
3023
3014
|
return !e || l.length === 0 ? null : /* @__PURE__ */ c(
|
|
@@ -3026,7 +3017,7 @@ function Yi({ shown: e, className: t }) {
|
|
|
3026
3017
|
className: `wp-floating-chat pointer-events-none flex flex-col ${t}`,
|
|
3027
3018
|
"data-testid": "floating-chat",
|
|
3028
3019
|
children: l.map((d) => /* @__PURE__ */ c(
|
|
3029
|
-
|
|
3020
|
+
Vi,
|
|
3030
3021
|
{
|
|
3031
3022
|
message: d,
|
|
3032
3023
|
age: a - d.ts,
|
|
@@ -3037,39 +3028,39 @@ function Yi({ shown: e, className: t }) {
|
|
|
3037
3028
|
}
|
|
3038
3029
|
);
|
|
3039
3030
|
}
|
|
3040
|
-
const
|
|
3041
|
-
function
|
|
3042
|
-
return e || (
|
|
3031
|
+
const Qt = (e) => typeof e == "string" && ar.includes(e);
|
|
3032
|
+
function Yi(e, t, n) {
|
|
3033
|
+
return e || (Qt(t) ? t : Qt(n) ? n : "dark");
|
|
3043
3034
|
}
|
|
3044
|
-
function
|
|
3035
|
+
function zi(e, t) {
|
|
3045
3036
|
if (t(e.clientWidth), typeof ResizeObserver > "u") return () => {
|
|
3046
3037
|
};
|
|
3047
3038
|
const n = new ResizeObserver(() => t(e.clientWidth));
|
|
3048
3039
|
return n.observe(e), () => n.disconnect();
|
|
3049
3040
|
}
|
|
3050
|
-
function
|
|
3041
|
+
function Xi(e) {
|
|
3051
3042
|
const t = e?.trim() ?? "";
|
|
3052
3043
|
return t ? { source: "host", name: t } : { source: "auto" };
|
|
3053
3044
|
}
|
|
3054
|
-
function
|
|
3045
|
+
function Ji(e) {
|
|
3055
3046
|
if (e.source !== "host") return;
|
|
3056
3047
|
const { setSessionIdentity: t, sprite: n } = m.getState();
|
|
3057
3048
|
t(e.name, n);
|
|
3058
3049
|
}
|
|
3059
|
-
function
|
|
3050
|
+
function Qi({ className: e = "w-4 h-4" }) {
|
|
3060
3051
|
return /* @__PURE__ */ _("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
|
|
3061
3052
|
/* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 4v16" }),
|
|
3062
3053
|
/* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15 12l-5 4v-8l5 4z" })
|
|
3063
3054
|
] });
|
|
3064
3055
|
}
|
|
3065
|
-
function
|
|
3056
|
+
function Zi({ className: e = "w-4 h-4" }) {
|
|
3066
3057
|
return /* @__PURE__ */ _("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
|
|
3067
3058
|
/* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M20 4v16" }),
|
|
3068
3059
|
/* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 12l5 4v-8l-5 4z" })
|
|
3069
3060
|
] });
|
|
3070
3061
|
}
|
|
3071
|
-
const
|
|
3072
|
-
function
|
|
3062
|
+
const es = 1500;
|
|
3063
|
+
function gs({
|
|
3073
3064
|
roomKey: e,
|
|
3074
3065
|
serverOrigin: t,
|
|
3075
3066
|
roomOrigin: n,
|
|
@@ -3084,10 +3075,10 @@ function ys({
|
|
|
3084
3075
|
onLayoutChange: M,
|
|
3085
3076
|
collapsible: R = !0,
|
|
3086
3077
|
debug: D,
|
|
3087
|
-
children:
|
|
3078
|
+
children: H
|
|
3088
3079
|
}) {
|
|
3089
|
-
const [p, x] = k(null), { setFrame: w, ...y } =
|
|
3090
|
-
() =>
|
|
3080
|
+
const [p, x] = k(null), { setFrame: w, ...y } = ts(M, R), g = m((F) => F.floatingChatEnabled), T = en(() => h), N = ee(() => (oa({ userType: s, userId: l ?? null }), bt().theme), [s, l]), j = ir(), U = j?.theme, C = ee(
|
|
3081
|
+
() => Yi(d, U, N),
|
|
3091
3082
|
[d, U, N]
|
|
3092
3083
|
);
|
|
3093
3084
|
E(() => {
|
|
@@ -3097,37 +3088,37 @@ function ys({
|
|
|
3097
3088
|
[t, e]
|
|
3098
3089
|
);
|
|
3099
3090
|
return E(() => {
|
|
3100
|
-
D &&
|
|
3101
|
-
}, [D]),
|
|
3102
|
-
|
|
3103
|
-
let
|
|
3104
|
-
const ae =
|
|
3091
|
+
D && jo();
|
|
3092
|
+
}, [D]), _i(), E(() => {
|
|
3093
|
+
No({ serverOrigin: t, defaultRoomKey: e }), Sa(n ? { origin: n, path: r } : null), Ft(a && !n ? { origin: a, path: i } : null), m.getState().rehydrateFromPrefs(), qa();
|
|
3094
|
+
let F = !1;
|
|
3095
|
+
const ae = sa();
|
|
3105
3096
|
return (async () => {
|
|
3106
3097
|
try {
|
|
3107
3098
|
await Promise.race([
|
|
3108
3099
|
Promise.all([
|
|
3109
3100
|
ae,
|
|
3110
|
-
|
|
3101
|
+
fa().then((X) => {
|
|
3111
3102
|
X && m.getState().rehydrateFromPrefs();
|
|
3112
3103
|
}),
|
|
3113
3104
|
// The character chosen in the settings popout (lib/avatar.ts).
|
|
3114
|
-
|
|
3105
|
+
Da().then(zn)
|
|
3115
3106
|
]),
|
|
3116
|
-
new Promise((X) => setTimeout(X,
|
|
3107
|
+
new Promise((X) => setTimeout(X, es))
|
|
3117
3108
|
]);
|
|
3118
3109
|
} catch (X) {
|
|
3119
3110
|
I("room-chrome", "pre-join wait threw, proceeding anyway", we(X));
|
|
3120
3111
|
}
|
|
3121
|
-
if (
|
|
3122
|
-
const ie =
|
|
3123
|
-
m.getState().ensureAutoIdentity(),
|
|
3112
|
+
if (F) return;
|
|
3113
|
+
const ie = Xi(T());
|
|
3114
|
+
m.getState().ensureAutoIdentity(), Ji(ie);
|
|
3124
3115
|
const te = m.getState();
|
|
3125
|
-
u("room-chrome", "Joining room", { roomKey: e, name: te.name, sprite: te.sprite }),
|
|
3116
|
+
u("room-chrome", "Joining room", { roomKey: e, name: te.name, sprite: te.sprite }), ti({ room_key: e, name: te.name || void 0, sprite: te.sprite || void 0 });
|
|
3126
3117
|
})(), () => {
|
|
3127
|
-
|
|
3118
|
+
F = !0, Vt(), Ft(null);
|
|
3128
3119
|
};
|
|
3129
|
-
}, [e, t, n, r, a, i, s, l]), /* @__PURE__ */ c(
|
|
3130
|
-
/* @__PURE__ */ c("div", { className: "wp-room-chrome-frame__content", children:
|
|
3120
|
+
}, [e, t, n, r, a, i, s, l]), /* @__PURE__ */ c(Po.Provider, { value: P, children: /* @__PURE__ */ c(kn.Provider, { value: !1, children: /* @__PURE__ */ c(Tn.Provider, { value: p, children: /* @__PURE__ */ _("div", { ref: w, className: "wp-room-chrome-frame", children: [
|
|
3121
|
+
/* @__PURE__ */ c("div", { className: "wp-room-chrome-frame__content", children: H }),
|
|
3131
3122
|
/* @__PURE__ */ c(
|
|
3132
3123
|
"aside",
|
|
3133
3124
|
{
|
|
@@ -3136,7 +3127,7 @@ function ys({
|
|
|
3136
3127
|
"data-theme": C,
|
|
3137
3128
|
"data-collapsed": y.collapsed ? "1" : "0",
|
|
3138
3129
|
style: { "--wp-room-chrome-width": `${y.state.width}px` },
|
|
3139
|
-
onAnimationEnd: (
|
|
3130
|
+
onAnimationEnd: (F) => vr(F.nativeEvent),
|
|
3140
3131
|
children: y.collapsed ? /* @__PURE__ */ _(le, { children: [
|
|
3141
3132
|
/* @__PURE__ */ c(
|
|
3142
3133
|
"button",
|
|
@@ -3146,11 +3137,11 @@ function ys({
|
|
|
3146
3137
|
title: "Show chat",
|
|
3147
3138
|
"aria-label": "Show chat",
|
|
3148
3139
|
"aria-expanded": !1,
|
|
3149
|
-
children: /* @__PURE__ */ c(
|
|
3140
|
+
children: /* @__PURE__ */ c(Zi, {})
|
|
3150
3141
|
}
|
|
3151
3142
|
),
|
|
3152
|
-
/* @__PURE__ */ c(
|
|
3153
|
-
/* @__PURE__ */ c(
|
|
3143
|
+
/* @__PURE__ */ c(Yt, { className: "absolute bottom-2 right-full mr-2 w-72" }),
|
|
3144
|
+
/* @__PURE__ */ c(Ki, { shown: g, className: "wp-room-chrome__floating" })
|
|
3154
3145
|
] }) : /* @__PURE__ */ _(le, { children: [
|
|
3155
3146
|
/* @__PURE__ */ c(
|
|
3156
3147
|
"div",
|
|
@@ -3172,13 +3163,13 @@ function ys({
|
|
|
3172
3163
|
}
|
|
3173
3164
|
),
|
|
3174
3165
|
/* @__PURE__ */ _("div", { className: "flex items-center gap-1 px-2 py-1.5 border-b border-border", children: [
|
|
3175
|
-
/* @__PURE__ */ c(
|
|
3166
|
+
/* @__PURE__ */ c(Wi, {}),
|
|
3176
3167
|
/* @__PURE__ */ c("div", { className: "flex-1" }),
|
|
3177
3168
|
f && /* @__PURE__ */ c(
|
|
3178
3169
|
"button",
|
|
3179
3170
|
{
|
|
3180
3171
|
onClick: () => {
|
|
3181
|
-
|
|
3172
|
+
Vt(), f();
|
|
3182
3173
|
},
|
|
3183
3174
|
className: "wp-room-chrome__leave",
|
|
3184
3175
|
title: "Leave room",
|
|
@@ -3194,27 +3185,27 @@ function ys({
|
|
|
3194
3185
|
title: "Hide chat",
|
|
3195
3186
|
"aria-label": "Hide chat",
|
|
3196
3187
|
"aria-expanded": !0,
|
|
3197
|
-
children: /* @__PURE__ */ c(
|
|
3188
|
+
children: /* @__PURE__ */ c(Qi, {})
|
|
3198
3189
|
}
|
|
3199
3190
|
)
|
|
3200
3191
|
] }),
|
|
3201
|
-
/* @__PURE__ */ c(
|
|
3202
|
-
/* @__PURE__ */ c(
|
|
3203
|
-
/* @__PURE__ */ c(
|
|
3192
|
+
/* @__PURE__ */ c(Pi, {}),
|
|
3193
|
+
/* @__PURE__ */ c($i, { commands: [] }),
|
|
3194
|
+
/* @__PURE__ */ c(Yt, { className: "absolute bottom-14 left-2 right-2" })
|
|
3204
3195
|
] })
|
|
3205
3196
|
}
|
|
3206
3197
|
)
|
|
3207
3198
|
] }) }) }) });
|
|
3208
3199
|
}
|
|
3209
|
-
function
|
|
3200
|
+
function ts(e, t) {
|
|
3210
3201
|
const n = m((g) => g.chromeChatCollapsed) && t, r = m((g) => g.chromeChatWidth), a = m((g) => g.toggleChromeChatCollapsed), i = m((g) => g.setChromeChatWidth), [s, l] = k(null), [d, h] = k(void 0), [f, M] = k(null);
|
|
3211
3202
|
E(() => {
|
|
3212
3203
|
if (s)
|
|
3213
|
-
return
|
|
3204
|
+
return zi(s, h);
|
|
3214
3205
|
}, [s]);
|
|
3215
|
-
const R = Y(f?.current ?? r, d), D = ee(() =>
|
|
3206
|
+
const R = Y(f?.current ?? r, d), D = ee(() => ba(n, R), [n, R]), H = en((g) => e?.(g));
|
|
3216
3207
|
return E(() => {
|
|
3217
|
-
|
|
3208
|
+
H(D);
|
|
3218
3209
|
}, [D]), {
|
|
3219
3210
|
setFrame: l,
|
|
3220
3211
|
collapsed: n,
|
|
@@ -3233,12 +3224,12 @@ function ns(e, t) {
|
|
|
3233
3224
|
M(null), T !== r && i(T);
|
|
3234
3225
|
},
|
|
3235
3226
|
onKeyDown: (g) => {
|
|
3236
|
-
const T =
|
|
3227
|
+
const T = ya(R, g.key, d);
|
|
3237
3228
|
T !== null && (g.preventDefault(), T !== r && i(T));
|
|
3238
3229
|
}
|
|
3239
3230
|
};
|
|
3240
3231
|
}
|
|
3241
3232
|
export {
|
|
3242
|
-
|
|
3233
|
+
gs as RoomChrome
|
|
3243
3234
|
};
|
|
3244
3235
|
//# sourceMappingURL=room-chrome.js.map
|