@hadoku/watchparty-ui 0.45.102 → 0.45.104
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-BG3WWWkO.js → AdminPanel-DcGc-1vo.js} +8 -8
- package/dist/chunks/{AdminPanel-BG3WWWkO.js.map → AdminPanel-DcGc-1vo.js.map} +1 -1
- package/dist/chunks/{MediaDrawer-DhGwMKkY.js → MediaDrawer-BUvcV9QZ.js} +747 -627
- package/dist/chunks/MediaDrawer-BUvcV9QZ.js.map +1 -0
- package/dist/chunks/{PlaylistPanel-C5OQMAqg.js → PlaylistPanel-CTgSeMHH.js} +17 -17
- package/dist/chunks/{PlaylistPanel-C5OQMAqg.js.map → PlaylistPanel-CTgSeMHH.js.map} +1 -1
- package/dist/chunks/{Room-BYlcg8RE.js → Room-HSQO8Lrm.js} +419 -408
- package/dist/chunks/Room-HSQO8Lrm.js.map +1 -0
- package/dist/chunks/{index-a5Hs7VOW.js → index-DlwQHczp.js} +1831 -1992
- package/dist/chunks/index-DlwQHczp.js.map +1 -0
- package/dist/chunks/{submissionsApi-DZC1qevi.js → submissionsApi-C70dUl1g.js} +19 -19
- package/dist/chunks/{submissionsApi-DZC1qevi.js.map → submissionsApi-C70dUl1g.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/room-chrome.js +1067 -1244
- package/dist/room-chrome.js.map +1 -1
- package/dist/watchparty-ui.css +1 -1
- package/package.json +3 -3
- package/dist/chunks/MediaDrawer-DhGwMKkY.js.map +0 -1
- package/dist/chunks/Room-BYlcg8RE.js.map +0 -1
- package/dist/chunks/index-a5Hs7VOW.js.map +0 -1
package/dist/room-chrome.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { jsx as l, jsxs as y, Fragment as ee } from "react/jsx-runtime";
|
|
2
|
-
import $e, { useState as E, useRef as z, useMemo as G, useCallback as D, useEffect as A, createContext as pt, useContext as
|
|
3
|
-
import { themePrefs as pe, Icon as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { createPrefsClient as
|
|
2
|
+
import $e, { useState as E, useRef as z, useMemo as G, useCallback as D, useEffect as A, createContext as pt, useContext as cn, useSyncExternalStore as dn, useLayoutEffect as Dt, useId as ha, useEffectEvent as un } from "react";
|
|
3
|
+
import { themePrefs as pe, Icon as ba, THEMES as ya, useHadokuThemeOptional as wa } from "@wolffm/themes";
|
|
4
|
+
import { createCdnClient as va, kindOfType as ka, MAX_BYTES as _a, measureImage as xa, filesFromClipboard as Sa, filesFromDrop as Ta, CdnError as lt } from "@wolffm/cdn-client";
|
|
5
|
+
import { ensureCosmeticsStyles as Ca, cleanWorn as Ia, readPictureColour as Ea, onPictureColour as Aa, pictureColour as Na, decorHtml as ja, messageHtml as mn, nameHtml as gn, finishReveal as Pa } from "@wolffm/prefs-client/cosmetics";
|
|
6
|
+
import { create as Ra } from "zustand";
|
|
7
|
+
import { pickAvatar as pn, resolveIdentityReassert as Ma } from "@wolffm/rooms-protocol";
|
|
8
|
+
import { z as f } from "zod";
|
|
9
|
+
import { createPrefsClient as Da, getDeviceId as La, DEVICE_ID_KEY as Oa } from "@wolffm/prefs-client";
|
|
10
10
|
import { io as ct } from "socket.io-client";
|
|
11
|
-
import { fetchCharacter as
|
|
12
|
-
import { relayIdentityChanges as
|
|
13
|
-
import { createPortal as
|
|
14
|
-
import { useCatalogueSearch as
|
|
15
|
-
const
|
|
11
|
+
import { fetchCharacter as Ha, characterOf as Ua, onAvatarChange as Fa } from "@wolffm/prefs-client/avatar";
|
|
12
|
+
import { relayIdentityChanges as $a } from "@wolffm/task-ui-components/identity-relay";
|
|
13
|
+
import { createPortal as hn } from "react-dom";
|
|
14
|
+
import { useCatalogueSearch as qa } from "@wolffm/cdn-client/react";
|
|
15
|
+
const bn = "https://cdn.hadoku.me", yn = /^[0-9a-f]{64}\.(?:png|jpe?g|gif|webp|avif)$/;
|
|
16
16
|
function ht(e) {
|
|
17
|
-
return typeof e == "string" &&
|
|
18
|
-
}
|
|
19
|
-
const bt = 8080,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
name:
|
|
25
|
-
sprite:
|
|
17
|
+
return typeof e == "string" && yn.test(e);
|
|
18
|
+
}
|
|
19
|
+
const bt = 8080, wn = 5173, za = "/watchparty/ws", vn = 500, Ba = 1e3, te = 4, kn = typeof process < "u" && process.env ? process.env : {};
|
|
20
|
+
kn.PRODUCTION_UI_URL;
|
|
21
|
+
kn.PRODUCTION_SERVER_URL;
|
|
22
|
+
const Re = f.enum(["S", "A", "B", "C", "D", "F"]), Lt = 2e4, Wa = 300;
|
|
23
|
+
f.object({
|
|
24
|
+
name: f.string().min(1).max(32).optional(),
|
|
25
|
+
sprite: f.string().min(1).max(32).optional(),
|
|
26
26
|
/** "My avatar settings just changed — re-read my picture" (the fleet
|
|
27
27
|
* settings popout's `hadoku:avatar` event). Carries no picture: the server
|
|
28
28
|
* resolves it from prefs-api by registry userId, never from the client. */
|
|
29
|
-
avatar:
|
|
29
|
+
avatar: f.literal(!0).optional()
|
|
30
30
|
});
|
|
31
31
|
const _ = {
|
|
32
32
|
JOIN: "join",
|
|
@@ -52,20 +52,20 @@ const _ = {
|
|
|
52
52
|
// 'ready_state' here = playback-readiness gate (distinct from READY_EVENTS.STATE = "ready check" UX feature)
|
|
53
53
|
READY_STATE: "ready_state",
|
|
54
54
|
ERROR: "error"
|
|
55
|
-
},
|
|
56
|
-
framed:
|
|
57
|
-
depth:
|
|
55
|
+
}, Ga = f.enum(["play", "pause", "seek", "load", "home"]), Va = f.object({
|
|
56
|
+
framed: f.boolean(),
|
|
57
|
+
depth: f.number().int().nonnegative().max(10)
|
|
58
58
|
});
|
|
59
|
-
|
|
60
|
-
room_key:
|
|
61
|
-
name:
|
|
62
|
-
sprite:
|
|
63
|
-
embed:
|
|
59
|
+
f.object({
|
|
60
|
+
room_key: f.string(),
|
|
61
|
+
name: f.string().min(1).max(32).optional(),
|
|
62
|
+
sprite: f.string().min(1).max(32).optional(),
|
|
63
|
+
embed: Va.optional(),
|
|
64
64
|
/** Which media-delivery path this client resolved to ('range' | 'fragment').
|
|
65
65
|
* Optional so older clients still validate. Reported so a party's logs can be split by
|
|
66
66
|
* arm — without it an A/B rollout is unmeasurable, exactly as entry path was before
|
|
67
67
|
* `embed` existed. */
|
|
68
|
-
delivery_arm:
|
|
68
|
+
delivery_arm: f.enum(["range", "fragment"]).optional(),
|
|
69
69
|
/** Browser-persisted device id (`hadoku_device_id`, owned by
|
|
70
70
|
* @wolffm/prefs-client). Lets the server derive a `dev:`-tier
|
|
71
71
|
* ParticipantId for a client with no friend key, so an anonymous viewer
|
|
@@ -77,44 +77,44 @@ r.object({
|
|
|
77
77
|
*
|
|
78
78
|
* CLIENT-ASSERTED — nothing proves it, so it must never gate a capability.
|
|
79
79
|
* See `isAuthenticatedTier` in @wolffm/rooms-protocol. */
|
|
80
|
-
device_id:
|
|
80
|
+
device_id: f.string().min(1).max(128).optional(),
|
|
81
81
|
/** Random per PAGE LOAD, carried on every rejoin from that page. A join whose
|
|
82
82
|
* tab id matches a live connection of the same participant is that tab
|
|
83
83
|
* reconnecting, so the server retires the old connection at once instead of
|
|
84
84
|
* showing it as a second row until the heartbeat reaps it (mistral-bluff
|
|
85
85
|
* 2026-10-20). Never broadcast: it is what lets a rejoin evict a connection.
|
|
86
86
|
* CLIENT-ASSERTED, so it never gates a capability. */
|
|
87
|
-
tab_id:
|
|
87
|
+
tab_id: f.string().min(8).max(64).optional(),
|
|
88
88
|
/** Present on a rejoin only: why this page's previous connection ended, as the
|
|
89
89
|
* BROWSER saw it, and for how long it was gone. The server cannot know either
|
|
90
90
|
* — a connection cut upstream never reaches it as a close. */
|
|
91
|
-
reconnect:
|
|
92
|
-
count:
|
|
93
|
-
reason:
|
|
94
|
-
offline_ms:
|
|
91
|
+
reconnect: f.object({
|
|
92
|
+
count: f.number().int().nonnegative(),
|
|
93
|
+
reason: f.string().max(64),
|
|
94
|
+
offline_ms: f.number().int().nonnegative()
|
|
95
95
|
}).optional()
|
|
96
96
|
});
|
|
97
|
-
|
|
97
|
+
f.object({
|
|
98
98
|
// The room's id — the same for every participant, unlike the key each one
|
|
99
99
|
// joined with (a leader key is a credential). What a game bundle is told
|
|
100
100
|
// its room is (GameBundleSlot).
|
|
101
|
-
room_id:
|
|
102
|
-
play_state:
|
|
103
|
-
playhead_ms:
|
|
104
|
-
leader_id:
|
|
105
|
-
media_id:
|
|
106
|
-
server_seq:
|
|
107
|
-
server_ts:
|
|
101
|
+
room_id: f.string(),
|
|
102
|
+
play_state: f.enum(["idle", "playing", "paused", "ended"]),
|
|
103
|
+
playhead_ms: f.number().int().nonnegative(),
|
|
104
|
+
leader_id: f.string().nullable(),
|
|
105
|
+
media_id: f.string().nullable(),
|
|
106
|
+
server_seq: f.number().int().nonnegative(),
|
|
107
|
+
server_ts: f.number().int().nonnegative()
|
|
108
108
|
});
|
|
109
|
-
|
|
110
|
-
client_seq:
|
|
111
|
-
kind:
|
|
112
|
-
to_ms:
|
|
113
|
-
media_id:
|
|
109
|
+
f.object({
|
|
110
|
+
client_seq: f.number().int().positive(),
|
|
111
|
+
kind: Ga,
|
|
112
|
+
to_ms: f.number().int().nonnegative().optional(),
|
|
113
|
+
media_id: f.string().optional()
|
|
114
114
|
// leader_id removed - not needed since set_leader control was removed
|
|
115
115
|
});
|
|
116
|
-
const
|
|
117
|
-
key:
|
|
116
|
+
const _n = f.object({
|
|
117
|
+
key: f.string().regex(yn, "not a CDN image key"),
|
|
118
118
|
/**
|
|
119
119
|
* Intrinsic pixels, or **0 meaning "unknown"**.
|
|
120
120
|
*
|
|
@@ -127,8 +127,8 @@ const Tn = r.object({
|
|
|
127
127
|
* text went with it, with nothing said. Widening is backward compatible —
|
|
128
128
|
* every message already in history carries positive dimensions.
|
|
129
129
|
*/
|
|
130
|
-
w:
|
|
131
|
-
h:
|
|
130
|
+
w: f.number().int().nonnegative().max(Lt),
|
|
131
|
+
h: f.number().int().nonnegative().max(Lt),
|
|
132
132
|
/**
|
|
133
133
|
* Human-readable description, rendered as the `alt` text.
|
|
134
134
|
*
|
|
@@ -142,186 +142,186 @@ const Tn = r.object({
|
|
|
142
142
|
* value only, never as markup. Bounded so one message cannot carry a
|
|
143
143
|
* paragraph; the library's own titles run well under this.
|
|
144
144
|
*/
|
|
145
|
-
title:
|
|
146
|
-
}),
|
|
147
|
-
|
|
148
|
-
text:
|
|
149
|
-
style:
|
|
150
|
-
images:
|
|
145
|
+
title: f.string().max(Wa).optional()
|
|
146
|
+
}), xn = /^[A-Za-z0-9_.:-]{1,64}$/;
|
|
147
|
+
f.object({
|
|
148
|
+
text: f.string().max(vn),
|
|
149
|
+
style: f.string().max(64).optional(),
|
|
150
|
+
images: f.array(_n).max(te).optional(),
|
|
151
151
|
/** The message this one replies to. Optional: older clients never send it. */
|
|
152
|
-
reply_to:
|
|
152
|
+
reply_to: f.string().regex(xn).optional()
|
|
153
153
|
}).refine((e) => e.text.length > 0 || (e.images?.length ?? 0) > 0, { message: "message must carry text or at least one image" });
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
id:
|
|
157
|
-
client_id:
|
|
154
|
+
const Ka = f.enum(["join", "leave", "media_change", "identity_change", "recap"]);
|
|
155
|
+
f.object({
|
|
156
|
+
id: f.string(),
|
|
157
|
+
client_id: f.string(),
|
|
158
158
|
// The sender's participant handle — stable across their reconnects, unlike
|
|
159
159
|
// `client_id`. Optional: system messages and pre-existing history have none.
|
|
160
|
-
author:
|
|
161
|
-
name:
|
|
162
|
-
sprite:
|
|
163
|
-
text:
|
|
164
|
-
ts:
|
|
160
|
+
author: f.string().optional(),
|
|
161
|
+
name: f.string(),
|
|
162
|
+
sprite: f.string().nullable(),
|
|
163
|
+
text: f.string(),
|
|
164
|
+
ts: f.number(),
|
|
165
165
|
// Optional so a client on an older bundle still validates a message that
|
|
166
166
|
// has none, and so system messages (which never carry images) stay unchanged.
|
|
167
|
-
images:
|
|
167
|
+
images: f.array(_n).max(te).optional(),
|
|
168
168
|
/** The id of the message this one answers (resolved by the client from
|
|
169
169
|
* what it holds; the original may have rolled out of history). */
|
|
170
|
-
reply_to:
|
|
170
|
+
reply_to: f.string().optional(),
|
|
171
171
|
/** Reactions in first-reacted order; `by` holds reactor handles (the same
|
|
172
172
|
* ids `author` carries). Absent when there are none. */
|
|
173
|
-
reactions:
|
|
174
|
-
isSystem:
|
|
175
|
-
systemType:
|
|
173
|
+
reactions: f.array(f.object({ emoji: f.string(), by: f.array(f.string()) })).optional(),
|
|
174
|
+
isSystem: f.boolean().optional(),
|
|
175
|
+
systemType: Ka.optional(),
|
|
176
176
|
/** A system line about a person: its text with `CHAT_NAME_TOKEN` where their
|
|
177
177
|
* name goes. `text` is that template filled when sent; a client fills it
|
|
178
178
|
* again with the person's CURRENT name (found by `author`) while they are
|
|
179
179
|
* here, so a rename reaches lines already on screen. */
|
|
180
|
-
template:
|
|
180
|
+
template: f.string().optional()
|
|
181
181
|
});
|
|
182
|
-
const yt = "{name}",
|
|
183
|
-
avg_download_rate_bps:
|
|
184
|
-
buffered_ahead_ms:
|
|
185
|
-
rtt_ms:
|
|
186
|
-
playhead_ms:
|
|
187
|
-
is_buffering:
|
|
188
|
-
fragments_loaded:
|
|
189
|
-
fragments_pending:
|
|
190
|
-
fragments_error:
|
|
191
|
-
video_ready_state:
|
|
182
|
+
const yt = "{name}", Ya = f.object({
|
|
183
|
+
avg_download_rate_bps: f.number().nonnegative(),
|
|
184
|
+
buffered_ahead_ms: f.number().nonnegative(),
|
|
185
|
+
rtt_ms: f.number().nonnegative(),
|
|
186
|
+
playhead_ms: f.number().nonnegative(),
|
|
187
|
+
is_buffering: f.boolean(),
|
|
188
|
+
fragments_loaded: f.number().int().nonnegative(),
|
|
189
|
+
fragments_pending: f.number().int().nonnegative(),
|
|
190
|
+
fragments_error: f.number().int().nonnegative(),
|
|
191
|
+
video_ready_state: f.number().int().optional(),
|
|
192
192
|
/** Buffered-ahead of the WORST AUDIO track, ms. `buffered_ahead_ms` above is
|
|
193
193
|
* already the min across video and audio; this is reported separately so the
|
|
194
194
|
* health card (and any later analysis) can say WHICH track is starving.
|
|
195
195
|
* -1 means "no audio FragmentManager" (media still loading, or audio not yet
|
|
196
196
|
* attached) and must never be treated as a zero-length buffer. Defaults to
|
|
197
197
|
* -1 so older clients, which never send it, are read as "unknown". */
|
|
198
|
-
audio_buffered_ahead_ms:
|
|
198
|
+
audio_buffered_ahead_ms: f.number().default(-1),
|
|
199
199
|
// Nominal media duration (ms) = last fragment's end. Lets the leader's health
|
|
200
200
|
// card distinguish "near end-of-stream, little buffer ahead is expected" from
|
|
201
201
|
// a real low-buffer stall. Defaults to 0 so older clients still validate.
|
|
202
|
-
duration_ms:
|
|
202
|
+
duration_ms: f.number().nonnegative().default(0),
|
|
203
203
|
/** Media delivery path this client is actually using. Reported HERE and not only at
|
|
204
204
|
* join because the join-time value is provisional — /api/flags lands after the socket
|
|
205
205
|
* connects, so the arm is not final until FragmentManager first reads it. Optional so
|
|
206
206
|
* older clients still validate. */
|
|
207
|
-
delivery_arm:
|
|
207
|
+
delivery_arm: f.enum(["range", "fragment"]).optional(),
|
|
208
208
|
/** Page state, so a stall can be read against what the viewer could see.
|
|
209
209
|
* Without it "he says he saw nothing" and "his player froze for 55s" could
|
|
210
210
|
* not be reconciled (mistral-bluff 2026-10-20). All optional: older
|
|
211
211
|
* clients omit them, and `net_*` exist only where the browser exposes
|
|
212
212
|
* navigator.connection (Chromium). */
|
|
213
|
-
page_visible:
|
|
214
|
-
page_focused:
|
|
215
|
-
muted:
|
|
216
|
-
online:
|
|
217
|
-
net_type:
|
|
218
|
-
net_rtt_ms:
|
|
219
|
-
net_downlink_mbps:
|
|
213
|
+
page_visible: f.boolean().optional(),
|
|
214
|
+
page_focused: f.boolean().optional(),
|
|
215
|
+
muted: f.boolean().optional(),
|
|
216
|
+
online: f.boolean().optional(),
|
|
217
|
+
net_type: f.string().max(16).optional(),
|
|
218
|
+
net_rtt_ms: f.number().nonnegative().optional(),
|
|
219
|
+
net_downlink_mbps: f.number().nonnegative().optional(),
|
|
220
220
|
/** ms since this connection last received a time_pong — a half-open
|
|
221
221
|
* socket shows here as a growing number while everything else looks fine. */
|
|
222
|
-
pong_age_ms:
|
|
223
|
-
reported_at:
|
|
224
|
-
}),
|
|
225
|
-
client_id:
|
|
226
|
-
name:
|
|
227
|
-
sprite_id:
|
|
222
|
+
pong_age_ms: f.number().int().nonnegative().optional(),
|
|
223
|
+
reported_at: f.number().int().nonnegative()
|
|
224
|
+
}), Ja = Ya.extend({
|
|
225
|
+
client_id: f.string(),
|
|
226
|
+
name: f.string(),
|
|
227
|
+
sprite_id: f.string().nullable(),
|
|
228
228
|
/** Set when this connected client's last report is older than the freshness
|
|
229
229
|
* window: how old it is, ms. The card then shows the client as silent
|
|
230
230
|
* rather than dropping it — a viewer whose reports cannot get through is the
|
|
231
231
|
* one the leader most needs to see. */
|
|
232
|
-
stale_ms:
|
|
232
|
+
stale_ms: f.number().int().nonnegative().optional()
|
|
233
233
|
});
|
|
234
|
-
|
|
235
|
-
clients:
|
|
236
|
-
server_ts:
|
|
234
|
+
f.object({
|
|
235
|
+
clients: f.array(Ja),
|
|
236
|
+
server_ts: f.number().int().nonnegative()
|
|
237
237
|
});
|
|
238
|
-
const
|
|
239
|
-
client_id:
|
|
240
|
-
sprite_id:
|
|
241
|
-
name:
|
|
242
|
-
buffered_ahead_ms:
|
|
238
|
+
const Xa = f.object({
|
|
239
|
+
client_id: f.string(),
|
|
240
|
+
sprite_id: f.string().nullable(),
|
|
241
|
+
name: f.string(),
|
|
242
|
+
buffered_ahead_ms: f.number().nonnegative(),
|
|
243
243
|
// playhead + duration let the viewer buffer ring apply the same near-end
|
|
244
244
|
// exemption the leader's health card uses: near end-of-stream there is
|
|
245
245
|
// legitimately little buffer ahead, so a low buffered_ahead_ms there must NOT
|
|
246
246
|
// render "critical" red. Default 0 so older clients still validate.
|
|
247
|
-
playhead_ms:
|
|
248
|
-
duration_ms:
|
|
247
|
+
playhead_ms: f.number().nonnegative().default(0),
|
|
248
|
+
duration_ms: f.number().nonnegative().default(0),
|
|
249
249
|
/** The video element's readyState, forwarded so the viewer buffer ring can
|
|
250
250
|
* apply the same "plenty buffered but the element cannot advance" rule the
|
|
251
251
|
* leader's card uses (see components/bufferHealth.ts). -1 = unknown/older
|
|
252
252
|
* client, which must never trip the rule. */
|
|
253
|
-
video_ready_state:
|
|
253
|
+
video_ready_state: f.number().int().default(-1)
|
|
254
254
|
});
|
|
255
|
-
|
|
256
|
-
clients:
|
|
257
|
-
server_ts:
|
|
255
|
+
f.object({
|
|
256
|
+
clients: f.array(Xa),
|
|
257
|
+
server_ts: f.number().int().nonnegative()
|
|
258
258
|
});
|
|
259
|
-
|
|
260
|
-
media_id:
|
|
259
|
+
f.object({
|
|
260
|
+
media_id: f.string()
|
|
261
261
|
});
|
|
262
|
-
const wt =
|
|
263
|
-
mediaId:
|
|
264
|
-
displayName:
|
|
262
|
+
const wt = f.enum(["super_upvote", "upvote", "mid", "downvote"]), Qa = f.object({
|
|
263
|
+
mediaId: f.string(),
|
|
264
|
+
displayName: f.string(),
|
|
265
265
|
// Enrichment fields — present for flat-playlist ingest output, absent for
|
|
266
266
|
// subfolder-layout playlist clips. All optional so old playlist.json stays valid.
|
|
267
|
-
description:
|
|
268
|
-
thumbnail:
|
|
267
|
+
description: f.string().optional(),
|
|
268
|
+
thumbnail: f.string().optional(),
|
|
269
269
|
// media-relative path, e.g. output/fmp4/.../poster.jpg
|
|
270
|
-
durationMs:
|
|
271
|
-
uploadDate:
|
|
270
|
+
durationMs: f.number().optional(),
|
|
271
|
+
uploadDate: f.string().optional()
|
|
272
272
|
// YouTube upload date 'YYYY-MM-DD'; drives playlist order
|
|
273
|
-
}),
|
|
274
|
-
id:
|
|
275
|
-
name:
|
|
276
|
-
type:
|
|
277
|
-
videos:
|
|
278
|
-
cover:
|
|
273
|
+
}), Za = f.enum(["basic", "vote"]), Sn = f.object({
|
|
274
|
+
id: f.string(),
|
|
275
|
+
name: f.string(),
|
|
276
|
+
type: Za.default("vote"),
|
|
277
|
+
videos: f.array(Qa),
|
|
278
|
+
cover: f.string().optional()
|
|
279
279
|
// media-relative path to the playlist cover image
|
|
280
280
|
});
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
playlistId:
|
|
285
|
-
mediaId:
|
|
281
|
+
f.object({ playlistId: f.string() });
|
|
282
|
+
f.object({ index: f.number().int().min(0) });
|
|
283
|
+
f.object({
|
|
284
|
+
playlistId: f.string(),
|
|
285
|
+
mediaId: f.string(),
|
|
286
286
|
vote: wt
|
|
287
287
|
});
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
playlist:
|
|
292
|
-
activeIndex:
|
|
293
|
-
myVotes:
|
|
288
|
+
f.object({ voterKey: f.string().min(1).max(128) });
|
|
289
|
+
f.object({ playlistId: f.string(), mediaIds: f.array(f.string()) });
|
|
290
|
+
f.object({
|
|
291
|
+
playlist: Sn.nullable(),
|
|
292
|
+
activeIndex: f.number().int().nullable(),
|
|
293
|
+
myVotes: f.record(f.string(), wt)
|
|
294
294
|
// mediaId -> VoteValue
|
|
295
295
|
});
|
|
296
|
-
const
|
|
297
|
-
clientId:
|
|
298
|
-
name:
|
|
299
|
-
votedCount:
|
|
300
|
-
totalVideos:
|
|
296
|
+
const er = f.object({
|
|
297
|
+
clientId: f.string(),
|
|
298
|
+
name: f.string(),
|
|
299
|
+
votedCount: f.number().int().nonnegative(),
|
|
300
|
+
totalVideos: f.number().int().nonnegative()
|
|
301
301
|
});
|
|
302
|
-
|
|
303
|
-
progress:
|
|
302
|
+
f.object({
|
|
303
|
+
progress: f.array(er)
|
|
304
304
|
});
|
|
305
|
-
|
|
306
|
-
playlist:
|
|
307
|
-
votes:
|
|
305
|
+
f.object({
|
|
306
|
+
playlist: Sn,
|
|
307
|
+
votes: f.record(f.string(), f.record(f.string(), wt)),
|
|
308
308
|
// votes[clientId][mediaId]
|
|
309
|
-
names:
|
|
309
|
+
names: f.record(f.string(), f.string()),
|
|
310
310
|
// clientId -> display name
|
|
311
311
|
/** clientId -> sprite id, frozen at reveal, so a voter who has since LEFT
|
|
312
312
|
* (and so is gone from the live roster) still renders. Optional: older
|
|
313
313
|
* servers omit it and clients fall back to the roster. */
|
|
314
|
-
sprites:
|
|
314
|
+
sprites: f.record(f.string(), f.string()).optional(),
|
|
315
315
|
/** clientId -> avatar picture URL, frozen at reveal like `sprites`. Only
|
|
316
316
|
* people who have a picture; everyone else shows their character. */
|
|
317
|
-
pictures:
|
|
317
|
+
pictures: f.record(f.string(), f.string()).optional(),
|
|
318
318
|
/** clientId -> the voter's participant handle (`PresenceUser.author`), so a
|
|
319
319
|
* voter still here is drawn as they look NOW, across a reconnect that gave
|
|
320
320
|
* them a new clientId. The frozen fields above are for voters who left. */
|
|
321
|
-
authors:
|
|
321
|
+
authors: f.record(f.string(), f.string()).optional(),
|
|
322
322
|
/** True when this re-sends results after a voter was removed. A client whose
|
|
323
323
|
* reveal is closed ignores it, rather than having the popup reappear. */
|
|
324
|
-
update:
|
|
324
|
+
update: f.boolean().optional()
|
|
325
325
|
});
|
|
326
326
|
const Ie = {
|
|
327
327
|
STATE: "playlist_state",
|
|
@@ -329,71 +329,71 @@ const Ie = {
|
|
|
329
329
|
RESULTS: "playlist_results",
|
|
330
330
|
/** Server -> the removed voter: forget the ballot you hold in localStorage. */
|
|
331
331
|
VOTES_CLEARED: "playlist_votes_cleared"
|
|
332
|
-
},
|
|
333
|
-
id:
|
|
334
|
-
displayName:
|
|
335
|
-
thumbnail:
|
|
332
|
+
}, Tn = f.object({
|
|
333
|
+
id: f.string(),
|
|
334
|
+
displayName: f.string(),
|
|
335
|
+
thumbnail: f.string().optional()
|
|
336
336
|
});
|
|
337
|
-
|
|
338
|
-
items:
|
|
337
|
+
f.object({
|
|
338
|
+
items: f.array(Tn)
|
|
339
339
|
});
|
|
340
|
-
const
|
|
341
|
-
|
|
342
|
-
const
|
|
343
|
-
mediaId:
|
|
344
|
-
tier:
|
|
345
|
-
absoluteTier:
|
|
340
|
+
const Cn = f.partialRecord(Re, f.array(f.string()));
|
|
341
|
+
f.object({ board: Cn });
|
|
342
|
+
const tr = f.object({
|
|
343
|
+
mediaId: f.string(),
|
|
344
|
+
tier: Re,
|
|
345
|
+
absoluteTier: Re,
|
|
346
346
|
/** Tier level + within-row position. Integer part is the tier. */
|
|
347
|
-
score:
|
|
347
|
+
score: f.number(),
|
|
348
348
|
/** The consensus mean that decided the tier. Never the displayed number. */
|
|
349
|
-
placementScore:
|
|
350
|
-
subRankOffset:
|
|
351
|
-
votes:
|
|
349
|
+
placementScore: f.number(),
|
|
350
|
+
subRankOffset: f.number(),
|
|
351
|
+
votes: f.record(f.string(), Re)
|
|
352
352
|
// opaque voterId -> the letter they gave
|
|
353
353
|
});
|
|
354
|
-
|
|
355
|
-
items:
|
|
356
|
-
placed:
|
|
357
|
-
unrated:
|
|
358
|
-
spread:
|
|
359
|
-
nudged:
|
|
360
|
-
names:
|
|
361
|
-
sprites:
|
|
354
|
+
f.object({
|
|
355
|
+
items: f.array(Tn),
|
|
356
|
+
placed: f.array(tr),
|
|
357
|
+
unrated: f.array(f.string()),
|
|
358
|
+
spread: f.number(),
|
|
359
|
+
nudged: f.boolean(),
|
|
360
|
+
names: f.record(f.string(), f.string()),
|
|
361
|
+
sprites: f.record(f.string(), f.string()),
|
|
362
362
|
/** Voter id -> avatar picture URL, for voters who have one. Optional so a
|
|
363
363
|
* browser on a newer bundle still reads an older server's board. */
|
|
364
|
-
pictures:
|
|
365
|
-
voterCount:
|
|
366
|
-
myBoard:
|
|
364
|
+
pictures: f.record(f.string(), f.string()).optional(),
|
|
365
|
+
voterCount: f.number().int().nonnegative(),
|
|
366
|
+
myBoard: Cn
|
|
367
367
|
});
|
|
368
|
-
const
|
|
368
|
+
const nr = {
|
|
369
369
|
/** Broadcast to EVERY connected socket when anyone saves. Carries no board —
|
|
370
370
|
* it is a "re-fetch" ping, because the shared result is identical for all
|
|
371
371
|
* viewers but `myBoard` is not, and one payload cannot serve both. */
|
|
372
372
|
UPDATED: "tierlist_updated"
|
|
373
373
|
};
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
active:
|
|
378
|
-
ready:
|
|
374
|
+
f.object({});
|
|
375
|
+
f.object({ ready: f.boolean() });
|
|
376
|
+
f.object({
|
|
377
|
+
active: f.boolean(),
|
|
378
|
+
ready: f.array(f.string())
|
|
379
379
|
// clientIds who have flagged ready
|
|
380
380
|
});
|
|
381
|
-
const
|
|
381
|
+
const ar = {
|
|
382
382
|
STATE: "ready_check_state"
|
|
383
383
|
// distinct from buffer-readiness 'ready_state'
|
|
384
|
-
},
|
|
384
|
+
}, In = {
|
|
385
385
|
ACTIVE: "game_active",
|
|
386
386
|
// server -> room (the open game id; null = none)
|
|
387
387
|
SYNC: "game_sync"
|
|
388
388
|
// client -> server (which game is open? on mount/reconnect)
|
|
389
389
|
};
|
|
390
|
-
|
|
391
|
-
gameId:
|
|
390
|
+
f.object({
|
|
391
|
+
gameId: f.string().min(1).max(32).nullable()
|
|
392
392
|
});
|
|
393
|
-
|
|
394
|
-
gameId:
|
|
393
|
+
f.object({
|
|
394
|
+
gameId: f.string().nullable()
|
|
395
395
|
});
|
|
396
|
-
const
|
|
396
|
+
const rr = [
|
|
397
397
|
{
|
|
398
398
|
id: "fantasy",
|
|
399
399
|
characters: [
|
|
@@ -437,231 +437,54 @@ const cr = [
|
|
|
437
437
|
{ id: "mentor", color: "#e1e0dc" }
|
|
438
438
|
]
|
|
439
439
|
}
|
|
440
|
-
], vt =
|
|
441
|
-
function
|
|
442
|
-
const t =
|
|
440
|
+
], vt = rr.flatMap((e) => e.characters), Ke = vt.map((e) => e.id), or = Object.fromEntries(vt.map((e) => [e.id, e.color])), fr = Object.fromEntries(vt.map((e) => [e.id, "rev" in e ? e.rev : 1]));
|
|
441
|
+
function ir(e) {
|
|
442
|
+
const t = fr[e];
|
|
443
443
|
return `/media/sprites/square_${e}.png${t > 1 ? `?v=${t}` : ""}`;
|
|
444
444
|
}
|
|
445
445
|
function Ye(e) {
|
|
446
446
|
return !!e && Ke.includes(e);
|
|
447
447
|
}
|
|
448
|
-
const
|
|
449
|
-
function
|
|
450
|
-
return typeof e == "string" &&
|
|
448
|
+
const sr = 5e3, En = { mode: "off", percent: 0 }, lr = ["off", "on", "ab"];
|
|
449
|
+
function cr(e) {
|
|
450
|
+
return typeof e == "string" && lr.includes(e);
|
|
451
451
|
}
|
|
452
|
-
function
|
|
453
|
-
const t = e && typeof e == "object" ? e : {}, n =
|
|
454
|
-
return { mode: n, percent:
|
|
452
|
+
function dr(e) {
|
|
453
|
+
const t = e && typeof e == "object" ? e : {}, n = cr(t.mode) ? t.mode : En.mode, a = Number(t.percent), r = Number.isFinite(a) ? Math.min(100, Math.max(0, Math.round(a))) : 0;
|
|
454
|
+
return { mode: n, percent: r };
|
|
455
455
|
}
|
|
456
|
-
function
|
|
456
|
+
function ur(e) {
|
|
457
457
|
let t = 2166136261;
|
|
458
458
|
for (let n = 0; n < e.length; n++)
|
|
459
459
|
t ^= e.charCodeAt(n), t = Math.imul(t, 16777619) >>> 0;
|
|
460
460
|
return t >>> 0;
|
|
461
461
|
}
|
|
462
|
-
function
|
|
462
|
+
function mr(e, t, n) {
|
|
463
463
|
if (n === !0)
|
|
464
464
|
return "fragment";
|
|
465
465
|
if (n === !1)
|
|
466
466
|
return "range";
|
|
467
|
-
const a =
|
|
468
|
-
return a.mode === "on" ? "fragment" : a.mode === "off" || a.percent <= 0 ? "range" : a.percent >= 100 || t &&
|
|
469
|
-
}
|
|
470
|
-
const Rn = r.enum(["url", "magnet", "upload"]), vr = r.enum([
|
|
471
|
-
"pending",
|
|
472
|
-
"approved",
|
|
473
|
-
"fetching",
|
|
474
|
-
"ingesting",
|
|
475
|
-
"ready",
|
|
476
|
-
"rejected",
|
|
477
|
-
"failed"
|
|
478
|
-
]), Ut = {
|
|
479
|
-
pending: ["approved", "rejected"],
|
|
480
|
-
approved: ["fetching", "rejected", "failed"],
|
|
481
|
-
fetching: ["ingesting", "failed"],
|
|
482
|
-
ingesting: ["ready", "failed"],
|
|
483
|
-
ready: [],
|
|
484
|
-
rejected: [],
|
|
485
|
-
failed: ["approved"]
|
|
486
|
-
};
|
|
487
|
-
Object.keys(Ut).filter((e) => Ut[e].length === 0);
|
|
488
|
-
const kr = r.object({
|
|
489
|
-
id: r.string().min(1),
|
|
490
|
-
/** Stable userId from whoami. Never the raw `X-User-Key`. */
|
|
491
|
-
ownerUserId: r.string().min(1),
|
|
492
|
-
kind: Rn,
|
|
493
|
-
/** The magnet URI, the https URL, or the filetransfer binding id. */
|
|
494
|
-
source: r.string().min(1),
|
|
495
|
-
title: r.string().optional(),
|
|
496
|
-
/**
|
|
497
|
-
* The anime series folder (PascalCase, e.g. `SparksOfTomorrow`) a `magnet`
|
|
498
|
-
* submission belongs to — wave 4 (2026-10-01: "magnets are in scope, and
|
|
499
|
-
* user content is NOT restricted to the playlist tree"). `undefined` for
|
|
500
|
-
* `url`/`upload`, which always land in the playlist tree regardless of
|
|
501
|
-
* title. The scraper derives its own destination from this same string, so
|
|
502
|
-
* it is stored verbatim rather than normalized — a normalization that
|
|
503
|
-
* disagreed with the scraper's own folder-name assumption would silently
|
|
504
|
-
* misroute the copy.
|
|
505
|
-
*/
|
|
506
|
-
series: r.string().optional(),
|
|
507
|
-
state: vr,
|
|
508
|
-
createdAt: r.number().int().nonnegative(),
|
|
509
|
-
updatedAt: r.number().int().nonnegative(),
|
|
510
|
-
/** Why it failed, or why an operator rejected it. */
|
|
511
|
-
error: r.string().optional(),
|
|
512
|
-
/** Size once known. 0 means "known to be empty"; absent means "not yet known" —
|
|
513
|
-
* the same distinction `chatImages` draws for image dimensions. */
|
|
514
|
-
bytes: r.number().int().nonnegative().optional()
|
|
515
|
-
}), _r = 4096, Pn = 300, Sr = 100;
|
|
516
|
-
r.object({
|
|
517
|
-
kind: Rn,
|
|
518
|
-
source: r.string().min(1).max(_r),
|
|
519
|
-
title: r.string().min(1).max(Pn).optional(),
|
|
520
|
-
/** Required for `kind: 'magnet'` by `checkSource`; ignored for `url`/`upload`. */
|
|
521
|
-
series: r.string().min(1).max(Sr).optional()
|
|
522
|
-
});
|
|
523
|
-
r.object({
|
|
524
|
-
reason: r.string().min(1).max(Pn).optional()
|
|
525
|
-
});
|
|
526
|
-
r.object({
|
|
527
|
-
submissions: r.array(kr)
|
|
528
|
-
});
|
|
529
|
-
r.object({
|
|
530
|
-
error: r.literal("submissions/quota_exceeded"),
|
|
531
|
-
/** The caller's measured bytes in non-terminal submissions, right now. */
|
|
532
|
-
pendingBytes: r.number().int().nonnegative(),
|
|
533
|
-
/** The cap that was applied, from the server's config. */
|
|
534
|
-
capBytes: r.number().int().nonnegative()
|
|
535
|
-
});
|
|
536
|
-
const xr = /^[a-z0-9][a-z0-9-]{0,31}$/, Ht = "https://game-catalog.invalid";
|
|
537
|
-
function Tr(e) {
|
|
538
|
-
if (!e.startsWith("/") || e.startsWith("//") || /[\\\s]/.test(e) || [...e].some((t) => t.charCodeAt(0) < 32 || t.charCodeAt(0) === 127))
|
|
539
|
-
return !1;
|
|
540
|
-
try {
|
|
541
|
-
return new URL(e, Ht).origin === Ht;
|
|
542
|
-
} catch {
|
|
543
|
-
return !1;
|
|
544
|
-
}
|
|
467
|
+
const a = dr(e);
|
|
468
|
+
return a.mode === "on" ? "fragment" : a.mode === "off" || a.percent <= 0 ? "range" : a.percent >= 100 || t && ur(t) % 100 < a.percent ? "fragment" : "range";
|
|
545
469
|
}
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
id: r.string().regex(xr),
|
|
550
|
-
name: r.string().min(1).max(64),
|
|
551
|
-
cover: Mn.optional()
|
|
552
|
-
}, Ir = r.object({ ...Cr, kind: r.literal("module"), url: Mn }).strict();
|
|
553
|
-
r.array(Ir).max(32).refine((e) => new Set(e.map((t) => t.id)).size === e.length, { message: "game ids must be unique" });
|
|
554
|
-
const kt = r.enum(["anilist", "tmdb"]), Er = r.object({
|
|
555
|
-
source: kt,
|
|
556
|
-
/** The provider's own id, as a string (AniList and TMDB both use integers). */
|
|
557
|
-
id: r.string(),
|
|
558
|
-
title: r.string(),
|
|
559
|
-
year: r.number().int().nullable(),
|
|
560
|
-
/** AniList `format` (TV, ONA, MOVIE…) or `TV` for TMDB. */
|
|
561
|
-
format: r.string().nullable(),
|
|
562
|
-
episodes: r.number().int().nullable(),
|
|
563
|
-
/** Same-origin proxied poster (`/api/search/thumb?u=…`), or null. */
|
|
564
|
-
poster: r.string().nullable(),
|
|
565
|
-
/** The folder this show would land in — `SousouNoFrieren`. */
|
|
566
|
-
series: r.string(),
|
|
567
|
-
/** On the scraper's watch list already: an entry for this exact show (same
|
|
568
|
-
* provider id), not merely the same series folder — Season 2 of a show
|
|
569
|
-
* whose Season 1 is listed is NOT on the list. */
|
|
570
|
-
onWatchlist: r.boolean(),
|
|
571
|
-
/**
|
|
572
|
-
* Not addable: a movie, or a title with no usable Latin-script name. The
|
|
573
|
-
* scraper matches releases by `SxxExx`, so a film can never arrive through it.
|
|
574
|
-
*/
|
|
575
|
-
addable: r.boolean(),
|
|
576
|
-
/** AniList links this entry to another season (a PREQUEL or SEQUEL), so the
|
|
577
|
-
* drawer offers its season list (`GET /api/search/seasons`). */
|
|
578
|
-
hasSeasons: r.boolean()
|
|
579
|
-
});
|
|
580
|
-
r.object({
|
|
581
|
-
results: r.array(Er),
|
|
582
|
-
/** Providers that answered. TMDB is absent when no token is configured. */
|
|
583
|
-
sources: r.array(kt)
|
|
584
|
-
});
|
|
585
|
-
const Ar = r.object({
|
|
586
|
-
id: r.string(),
|
|
587
|
-
url: r.string(),
|
|
588
|
-
title: r.string(),
|
|
589
|
-
channel: r.string().nullable(),
|
|
590
|
-
durationS: r.number().nullable(),
|
|
591
|
-
thumb: r.string().nullable()
|
|
592
|
-
});
|
|
593
|
-
r.object({ results: r.array(Ar) });
|
|
594
|
-
const Nr = r.object({
|
|
595
|
-
id: r.string(),
|
|
596
|
-
title: r.string(),
|
|
597
|
-
/** 1-based position in the chain. */
|
|
598
|
-
number: r.number().int(),
|
|
599
|
-
/** When it first aired; either may be null for an unannounced season. */
|
|
600
|
-
year: r.number().int().nullable(),
|
|
601
|
-
month: r.number().int().min(1).max(12).nullable(),
|
|
602
|
-
episodes: r.number().int().nullable(),
|
|
603
|
-
format: r.string().nullable(),
|
|
604
|
-
onWatchlist: r.boolean()
|
|
605
|
-
});
|
|
606
|
-
r.object({
|
|
607
|
-
/** Requested id → its show's seasons. An id AniList does not know is absent. */
|
|
608
|
-
chains: r.record(r.string(), r.array(Nr))
|
|
609
|
-
});
|
|
610
|
-
r.object({
|
|
611
|
-
source: kt,
|
|
612
|
-
id: r.string().regex(/^\d{1,12}$/)
|
|
613
|
-
});
|
|
614
|
-
r.object({
|
|
615
|
-
series: r.string(),
|
|
616
|
-
title: r.string(),
|
|
617
|
-
/** The season the scraper recorded (it derives one from AniList's prequel
|
|
618
|
-
* chain), or null when it could not tell. */
|
|
619
|
-
season: r.number().int().nullable()
|
|
620
|
-
});
|
|
621
|
-
const jr = 99, Rr = r.object({
|
|
622
|
-
id: r.number().int(),
|
|
623
|
-
series: r.string(),
|
|
624
|
-
season: r.number().int().nullable(),
|
|
625
|
-
title: r.string(),
|
|
626
|
-
source: r.string().nullable(),
|
|
627
|
-
sourceId: r.string().nullable(),
|
|
628
|
-
createdAt: r.string().nullable(),
|
|
629
|
-
retiredAt: r.string().nullable(),
|
|
630
|
-
retiredReason: r.string().nullable(),
|
|
631
|
-
/** `you` — added for the caller; `other` — for someone else; `none` — no
|
|
632
|
-
* one (the scraper's committed list, an operator's add). */
|
|
633
|
-
owner: r.enum(["you", "other", "none"]),
|
|
634
|
-
/** The caller may change or remove it: their own row, or any row for an admin. */
|
|
635
|
-
editable: r.boolean(),
|
|
636
|
-
/** Episodes of this season the library holds: `ready` to play, and
|
|
637
|
-
* `downloaded` (in the input tree, ingested or not). Null when the season
|
|
638
|
-
* is unknown. */
|
|
639
|
-
episodes: r.object({ ready: r.number().int(), downloaded: r.number().int() }).nullable()
|
|
640
|
-
});
|
|
641
|
-
r.object({ entries: r.array(Rr) });
|
|
642
|
-
r.object({
|
|
643
|
-
season: r.number().int().min(1).max(jr).nullable().optional(),
|
|
644
|
-
title: r.string().trim().min(1).max(200).optional(),
|
|
645
|
-
retired: r.boolean().optional()
|
|
646
|
-
}).strict().refine((e) => e.season !== void 0 || e.title !== void 0 || e.retired !== void 0, { message: "nothing to change" });
|
|
647
|
-
let Ee = null, Dn = vn;
|
|
648
|
-
function Pr(e) {
|
|
649
|
-
e.cdnBase && (Dn = e.cdnBase);
|
|
470
|
+
let Ee = null, An = bn;
|
|
471
|
+
function gr(e) {
|
|
472
|
+
e.cdnBase && (An = e.cdnBase);
|
|
650
473
|
}
|
|
651
|
-
function
|
|
652
|
-
return
|
|
474
|
+
function Nn() {
|
|
475
|
+
return An.replace(/\/+$/, "");
|
|
653
476
|
}
|
|
654
477
|
function Je() {
|
|
655
|
-
const e =
|
|
656
|
-
return (!Ee || Ee.base !== e) && (Ee = { base: e, client:
|
|
478
|
+
const e = Nn();
|
|
479
|
+
return (!Ee || Ee.base !== e) && (Ee = { base: e, client: va({ cdnBase: e }) }), Ee.client;
|
|
657
480
|
}
|
|
658
481
|
function qe(e) {
|
|
659
|
-
return !ht(e) || !
|
|
482
|
+
return !ht(e) || !Nn() ? null : Je().urlFor(e);
|
|
660
483
|
}
|
|
661
|
-
function
|
|
484
|
+
function pr(e) {
|
|
662
485
|
return e.kind === "file";
|
|
663
486
|
}
|
|
664
|
-
class
|
|
487
|
+
class jn extends Error {
|
|
665
488
|
constructor(t) {
|
|
666
489
|
super(t), this.name = "ChatImageUploadError";
|
|
667
490
|
}
|
|
@@ -686,42 +509,42 @@ function Me(e) {
|
|
|
686
509
|
return "Image upload failed";
|
|
687
510
|
}
|
|
688
511
|
}
|
|
689
|
-
function
|
|
690
|
-
return e instanceof lt ? Me(e.reason) : e instanceof
|
|
512
|
+
function hr(e) {
|
|
513
|
+
return e instanceof lt ? Me(e.reason) : e instanceof jn ? e.message : "Image upload failed";
|
|
691
514
|
}
|
|
692
|
-
function
|
|
515
|
+
function br(e) {
|
|
693
516
|
const t = e.type.toLowerCase().split(";")[0].trim();
|
|
694
|
-
return t &&
|
|
517
|
+
return t && ka(t) !== "image" ? Me("unsupported-type") : e.size > _a.image ? Me("too-large") : e.size === 0 ? Me("invalid") : null;
|
|
695
518
|
}
|
|
696
|
-
function
|
|
697
|
-
return
|
|
519
|
+
function yr(e) {
|
|
520
|
+
return Sa(e);
|
|
698
521
|
}
|
|
699
|
-
function
|
|
700
|
-
return
|
|
522
|
+
function wr(e) {
|
|
523
|
+
return Ta(e);
|
|
701
524
|
}
|
|
702
|
-
async function
|
|
703
|
-
const t = await
|
|
525
|
+
async function vr(e) {
|
|
526
|
+
const t = await xa(e);
|
|
704
527
|
return { w: t?.width ?? 0, h: t?.height ?? 0 };
|
|
705
528
|
}
|
|
706
|
-
async function
|
|
529
|
+
async function kr(e, t = {}) {
|
|
707
530
|
const n = await Je().upload(e, { signal: t.signal });
|
|
708
531
|
if (!ht(n.key))
|
|
709
|
-
throw new
|
|
532
|
+
throw new jn("Image upload returned an unusable key");
|
|
710
533
|
return { key: n.key, deduplicated: n.deduplicated === !0 };
|
|
711
534
|
}
|
|
712
|
-
async function
|
|
535
|
+
async function _r(e, t = {}) {
|
|
713
536
|
const n = [];
|
|
714
537
|
for (const a of e) {
|
|
715
538
|
if (a.kind === "remote") {
|
|
716
539
|
n.push({ key: a.key, w: a.w, h: a.h, ...a.title ? { title: a.title } : {} });
|
|
717
540
|
continue;
|
|
718
541
|
}
|
|
719
|
-
const { key:
|
|
720
|
-
n.push({ key:
|
|
542
|
+
const { key: r } = await kr(a.file, t);
|
|
543
|
+
n.push({ key: r, w: a.w, h: a.h });
|
|
721
544
|
}
|
|
722
545
|
return n;
|
|
723
546
|
}
|
|
724
|
-
function
|
|
547
|
+
function xr(e) {
|
|
725
548
|
return {
|
|
726
549
|
error: e instanceof Error ? e.message : String(e),
|
|
727
550
|
name: e instanceof Error ? e.name : typeof e,
|
|
@@ -732,34 +555,34 @@ function qr(e) {
|
|
|
732
555
|
function Xe(e) {
|
|
733
556
|
return e.key === "Escape" || e.key === "GoBack" || e.key === "BrowserBack" || e.key === "XF86Back" || e.keyCode === 461 || e.keyCode === 10009;
|
|
734
557
|
}
|
|
735
|
-
function
|
|
558
|
+
function Sr(e) {
|
|
736
559
|
return `/tv?return=${encodeURIComponent(e.pathname + e.search)}`;
|
|
737
560
|
}
|
|
738
|
-
function
|
|
561
|
+
function Tr({ className: e }) {
|
|
739
562
|
return /* @__PURE__ */ l(
|
|
740
563
|
"a",
|
|
741
564
|
{
|
|
742
|
-
href:
|
|
565
|
+
href: Sr(window.location),
|
|
743
566
|
className: e,
|
|
744
567
|
"data-testid": "sign-in-with-code",
|
|
745
568
|
children: "Sign in with a code"
|
|
746
569
|
}
|
|
747
570
|
);
|
|
748
571
|
}
|
|
749
|
-
const dt = 240, fe = 8,
|
|
750
|
-
function
|
|
572
|
+
const dt = 240, fe = 8, Cr = 28, Pn = 240;
|
|
573
|
+
function Ir(e, t, n) {
|
|
751
574
|
let a = t.left - dt - fe;
|
|
752
575
|
a < fe && (a = t.right + fe), a = Math.min(a, n.width - dt - fe), a = Math.max(fe, a);
|
|
753
|
-
const
|
|
754
|
-
let
|
|
755
|
-
return
|
|
576
|
+
const r = Pn + Cr;
|
|
577
|
+
let o = e.top + e.height / 2 - r / 2;
|
|
578
|
+
return o = Math.min(o, n.height - r - fe), o = Math.max(fe, o), { left: a, top: o };
|
|
756
579
|
}
|
|
757
|
-
const
|
|
758
|
-
function
|
|
759
|
-
const [
|
|
580
|
+
const Rn = "/dataplatform/api/memes", Er = 120;
|
|
581
|
+
function Ar({ onClose: e, onPick: t, onUnavailable: n, toggle: a }) {
|
|
582
|
+
const [r, o] = E(""), i = z(null), s = z(null), c = Je(), { items: b, loading: p, error: I, hasMore: S, loadMore: N } = qa(
|
|
760
583
|
c,
|
|
761
|
-
|
|
762
|
-
|
|
584
|
+
Rn,
|
|
585
|
+
r.trim()
|
|
763
586
|
), M = I?.reason ?? null, h = G(() => {
|
|
764
587
|
const T = /* @__PURE__ */ new Set();
|
|
765
588
|
return b.filter((j) => T.has(j.key) ? !1 : (T.add(j.key), !0));
|
|
@@ -767,18 +590,18 @@ function Kr({ onClose: e, onPick: t, onUnavailable: n, toggle: a }) {
|
|
|
767
590
|
w.current !== null && (window.clearTimeout(w.current), w.current = null);
|
|
768
591
|
}, []), C = D(() => {
|
|
769
592
|
v(), m(null);
|
|
770
|
-
}, [v]),
|
|
771
|
-
(T, j,
|
|
593
|
+
}, [v]), U = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(hover: hover)").matches, F = D(
|
|
594
|
+
(T, j, P = !1) => {
|
|
772
595
|
const $ = i.current;
|
|
773
596
|
if (!$) return;
|
|
774
|
-
const
|
|
597
|
+
const H = () => m({
|
|
775
598
|
item: T,
|
|
776
|
-
...
|
|
599
|
+
...Ir(j.getBoundingClientRect(), $.getBoundingClientRect(), {
|
|
777
600
|
width: window.innerWidth,
|
|
778
601
|
height: window.innerHeight
|
|
779
602
|
})
|
|
780
603
|
});
|
|
781
|
-
v(),
|
|
604
|
+
v(), P ? H() : w.current = window.setTimeout(H, Er);
|
|
782
605
|
},
|
|
783
606
|
[v]
|
|
784
607
|
);
|
|
@@ -787,10 +610,10 @@ function Kr({ onClose: e, onPick: t, onUnavailable: n, toggle: a }) {
|
|
|
787
610
|
}, [M, n]), A(() => {
|
|
788
611
|
s.current?.focus();
|
|
789
612
|
}, []), A(() => {
|
|
790
|
-
const T = (
|
|
791
|
-
Xe(
|
|
792
|
-
}, j = (
|
|
793
|
-
const $ =
|
|
613
|
+
const T = (P) => {
|
|
614
|
+
Xe(P) && (P.stopPropagation(), e());
|
|
615
|
+
}, j = (P) => {
|
|
616
|
+
const $ = P.target;
|
|
794
617
|
i.current && !i.current.contains($) && !a?.contains($) && e();
|
|
795
618
|
};
|
|
796
619
|
return document.addEventListener("keydown", T), document.addEventListener("mousedown", j), () => {
|
|
@@ -814,8 +637,8 @@ function Kr({ onClose: e, onPick: t, onUnavailable: n, toggle: a }) {
|
|
|
814
637
|
{
|
|
815
638
|
ref: s,
|
|
816
639
|
type: "text",
|
|
817
|
-
value:
|
|
818
|
-
onChange: (T) =>
|
|
640
|
+
value: r,
|
|
641
|
+
onChange: (T) => o(T.target.value),
|
|
819
642
|
placeholder: "Search memes...",
|
|
820
643
|
"aria-label": "Search memes",
|
|
821
644
|
"data-testid": "meme-search",
|
|
@@ -837,11 +660,11 @@ function Kr({ onClose: e, onPick: t, onUnavailable: n, toggle: a }) {
|
|
|
837
660
|
"data-reason": M,
|
|
838
661
|
children: M === "unauthenticated" ? /* @__PURE__ */ y(ee, { children: [
|
|
839
662
|
"Sign in to browse memes · ",
|
|
840
|
-
/* @__PURE__ */ l(
|
|
663
|
+
/* @__PURE__ */ l(Tr, { className: "underline text-on-danger-bg" })
|
|
841
664
|
] }) : M === "forbidden" ? "Your account can't browse the meme library" : "Meme library is unavailable"
|
|
842
665
|
}
|
|
843
666
|
),
|
|
844
|
-
L && /* @__PURE__ */ l("p", { className: "p-4 text-center text-sm text-text-secondary", children:
|
|
667
|
+
L && /* @__PURE__ */ l("p", { className: "p-4 text-center text-sm text-text-secondary", children: r.trim() ? `No memes match "${r.trim()}"` : "The meme library is empty" }),
|
|
845
668
|
h.length > 0 && /* @__PURE__ */ l("div", { className: "grid grid-cols-3 gap-1.5 sm:grid-cols-4", children: h.map((T) => {
|
|
846
669
|
const j = qe(T.key);
|
|
847
670
|
return j ? /* @__PURE__ */ l(
|
|
@@ -851,11 +674,11 @@ function Kr({ onClose: e, onPick: t, onUnavailable: n, toggle: a }) {
|
|
|
851
674
|
onClick: () => O(T),
|
|
852
675
|
title: T.title,
|
|
853
676
|
"data-testid": "meme-result",
|
|
854
|
-
onMouseEnter: (
|
|
855
|
-
|
|
677
|
+
onMouseEnter: (P) => {
|
|
678
|
+
U && F(T, P.currentTarget);
|
|
856
679
|
},
|
|
857
680
|
onMouseLeave: C,
|
|
858
|
-
onFocus: (
|
|
681
|
+
onFocus: (P) => F(T, P.currentTarget, !0),
|
|
859
682
|
onBlur: C,
|
|
860
683
|
className: "group relative aspect-square overflow-hidden rounded border border-border-light bg-bg-alt focus:outline-none focus:border-primary hover:border-primary",
|
|
861
684
|
children: /* @__PURE__ */ l(
|
|
@@ -873,7 +696,7 @@ function Kr({ onClose: e, onPick: t, onUnavailable: n, toggle: a }) {
|
|
|
873
696
|
) : null;
|
|
874
697
|
}) }),
|
|
875
698
|
p && /* @__PURE__ */ l("p", { className: "p-2 text-center text-xs text-text-secondary", children: "Loading…" }),
|
|
876
|
-
|
|
699
|
+
S && !p && /* @__PURE__ */ l(
|
|
877
700
|
"button",
|
|
878
701
|
{
|
|
879
702
|
type: "button",
|
|
@@ -911,7 +734,7 @@ function Kr({ onClose: e, onPick: t, onUnavailable: n, toggle: a }) {
|
|
|
911
734
|
src: qe(d.item.key) ?? void 0,
|
|
912
735
|
alt: "",
|
|
913
736
|
className: "block w-full rounded bg-bg object-contain",
|
|
914
|
-
style: { height: "auto", maxHeight:
|
|
737
|
+
style: { height: "auto", maxHeight: Pn }
|
|
915
738
|
}
|
|
916
739
|
),
|
|
917
740
|
d.item.title && /* One line. A long title must not change the box height, because
|
|
@@ -924,57 +747,57 @@ function Kr({ onClose: e, onPick: t, onUnavailable: n, toggle: a }) {
|
|
|
924
747
|
}
|
|
925
748
|
);
|
|
926
749
|
}
|
|
927
|
-
function
|
|
928
|
-
return e ? /* @__PURE__ */ l(
|
|
750
|
+
function Nr({ open: e, ...t }) {
|
|
751
|
+
return e ? /* @__PURE__ */ l(Ar, { ...t }) : null;
|
|
929
752
|
}
|
|
930
|
-
const
|
|
753
|
+
const kt = {
|
|
931
754
|
serverOrigin: `http://localhost:${bt}`,
|
|
932
755
|
defaultRoomKey: "dev-room",
|
|
933
|
-
cdnBase:
|
|
756
|
+
cdnBase: bn
|
|
934
757
|
};
|
|
935
|
-
let De = { ...
|
|
936
|
-
function
|
|
758
|
+
let De = { ...kt };
|
|
759
|
+
function jr(e) {
|
|
937
760
|
const t = Object.fromEntries(
|
|
938
761
|
Object.entries(e).filter(([n, a]) => a !== void 0)
|
|
939
762
|
);
|
|
940
|
-
De = { ...De, ...t },
|
|
763
|
+
De = { ...De, ...t }, gr({ cdnBase: De.cdnBase });
|
|
941
764
|
}
|
|
942
765
|
function _e() {
|
|
943
766
|
return De;
|
|
944
767
|
}
|
|
945
|
-
const
|
|
946
|
-
function
|
|
768
|
+
const Pr = pt(kt);
|
|
769
|
+
function Rr(e) {
|
|
947
770
|
return e.serverOrigin?.replace(/\/$/, "") || "";
|
|
948
771
|
}
|
|
949
|
-
function
|
|
950
|
-
return
|
|
772
|
+
function Mn() {
|
|
773
|
+
return Rr(_e());
|
|
951
774
|
}
|
|
952
|
-
const
|
|
953
|
-
function
|
|
954
|
-
return
|
|
775
|
+
const Dn = pt(null);
|
|
776
|
+
function Ln() {
|
|
777
|
+
return cn(Dn);
|
|
955
778
|
}
|
|
956
|
-
const
|
|
957
|
-
function
|
|
958
|
-
const e =
|
|
779
|
+
const On = pt(!0);
|
|
780
|
+
function Hn() {
|
|
781
|
+
const e = cn(On);
|
|
959
782
|
A(() => {
|
|
960
|
-
e &&
|
|
783
|
+
e && Ca();
|
|
961
784
|
}, [e]);
|
|
962
785
|
}
|
|
963
|
-
function
|
|
786
|
+
function Un(e) {
|
|
964
787
|
return e ? { "--hc-base": e } : {};
|
|
965
788
|
}
|
|
966
789
|
const ye = $e.memo(
|
|
967
|
-
function({ html: t, as: n = "span", className: a, style:
|
|
968
|
-
return $e.createElement(n, { className: a, style:
|
|
790
|
+
function({ html: t, as: n = "span", className: a, style: r }) {
|
|
791
|
+
return $e.createElement(n, { className: a, style: r, dangerouslySetInnerHTML: { __html: t } });
|
|
969
792
|
},
|
|
970
793
|
(e, t) => e.html === t.html && e.as === t.as && e.className === t.className && JSON.stringify(e.style) === JSON.stringify(t.style)
|
|
971
794
|
);
|
|
972
|
-
function
|
|
795
|
+
function Mr(e, t) {
|
|
973
796
|
A(() => {
|
|
974
797
|
const n = e.current;
|
|
975
798
|
if (!n || !t || typeof IntersectionObserver > "u") return;
|
|
976
|
-
const a = new IntersectionObserver(([
|
|
977
|
-
n.classList.toggle("hc-idle", !
|
|
799
|
+
const a = new IntersectionObserver(([r]) => {
|
|
800
|
+
n.classList.toggle("hc-idle", !r?.isIntersecting);
|
|
978
801
|
}, { rootMargin: "64px" });
|
|
979
802
|
return a.observe(n), () => {
|
|
980
803
|
a.disconnect(), n.classList.remove("hc-idle");
|
|
@@ -1011,7 +834,7 @@ function Ze(e, t) {
|
|
|
1011
834
|
return !1;
|
|
1012
835
|
}
|
|
1013
836
|
}
|
|
1014
|
-
function
|
|
837
|
+
function Dr() {
|
|
1015
838
|
try {
|
|
1016
839
|
const e = Qe();
|
|
1017
840
|
if (!e) return [];
|
|
@@ -1031,45 +854,45 @@ function ze(e) {
|
|
|
1031
854
|
} catch {
|
|
1032
855
|
}
|
|
1033
856
|
}
|
|
1034
|
-
function
|
|
857
|
+
function Lr(e) {
|
|
1035
858
|
const t = B(e);
|
|
1036
859
|
return t === null ? null : t === "true" ? !0 : t === "false" ? !1 : null;
|
|
1037
860
|
}
|
|
1038
|
-
const
|
|
1039
|
-
let
|
|
861
|
+
const Fn = /* @__PURE__ */ new Map();
|
|
862
|
+
let $n = !1;
|
|
1040
863
|
function et(e, t) {
|
|
1041
|
-
|
|
864
|
+
Fn.set(e, t), $n && qn(e, t);
|
|
1042
865
|
}
|
|
1043
|
-
function
|
|
1044
|
-
|
|
1045
|
-
for (const [e, t] of
|
|
866
|
+
function Or() {
|
|
867
|
+
$n = !0;
|
|
868
|
+
for (const [e, t] of Fn) qn(e, t);
|
|
1046
869
|
}
|
|
1047
|
-
function
|
|
870
|
+
function qn(e, t) {
|
|
1048
871
|
typeof window > "u" || (window[e] = t);
|
|
1049
872
|
}
|
|
1050
|
-
const he = [],
|
|
873
|
+
const he = [], Hr = 500;
|
|
1051
874
|
let Le = [], ut = null;
|
|
1052
|
-
const
|
|
875
|
+
const Ur = 1e3, Fr = 200;
|
|
1053
876
|
let mt = null;
|
|
1054
|
-
function
|
|
877
|
+
function zn(e) {
|
|
1055
878
|
mt = e;
|
|
1056
879
|
}
|
|
1057
|
-
function
|
|
880
|
+
function Bn() {
|
|
1058
881
|
return B(ae.REPORT_LOGS_FLAG) === "true";
|
|
1059
882
|
}
|
|
1060
|
-
function
|
|
883
|
+
function $r() {
|
|
1061
884
|
if (typeof window > "u") return !1;
|
|
1062
885
|
if (window.__WP_DEBUG__ || new URLSearchParams(window.location.search).get("debug") === "true") return !0;
|
|
1063
886
|
const t = B(ae.DEBUG_FLAG);
|
|
1064
887
|
return t !== null && t !== "false";
|
|
1065
888
|
}
|
|
1066
|
-
function
|
|
889
|
+
function qr() {
|
|
1067
890
|
const e = B(ae.DEBUG_FLAG);
|
|
1068
891
|
if (!e || e === "true") return null;
|
|
1069
892
|
const t = e.split(",").map((n) => n.trim().toLowerCase()).filter(Boolean);
|
|
1070
893
|
return t.length > 0 ? new Set(t) : null;
|
|
1071
894
|
}
|
|
1072
|
-
function
|
|
895
|
+
function zr() {
|
|
1073
896
|
return (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", {
|
|
1074
897
|
hour12: !1,
|
|
1075
898
|
hour: "2-digit",
|
|
@@ -1078,8 +901,8 @@ function so() {
|
|
|
1078
901
|
fractionalSecondDigits: 3
|
|
1079
902
|
});
|
|
1080
903
|
}
|
|
1081
|
-
function
|
|
1082
|
-
he.push(e), he.length >
|
|
904
|
+
function Br(e) {
|
|
905
|
+
he.push(e), he.length > Hr && he.shift();
|
|
1083
906
|
}
|
|
1084
907
|
const nt = {
|
|
1085
908
|
debug: "color: #64748b; font-weight: normal;",
|
|
@@ -1088,67 +911,67 @@ const nt = {
|
|
|
1088
911
|
category: "color: #3b82f6; font-weight: bold;",
|
|
1089
912
|
time: "color: #6b7280; font-weight: normal;"
|
|
1090
913
|
};
|
|
1091
|
-
function
|
|
914
|
+
function Wr(e) {
|
|
1092
915
|
try {
|
|
1093
916
|
return JSON.stringify(e);
|
|
1094
917
|
} catch {
|
|
1095
918
|
return "[unserializable]";
|
|
1096
919
|
}
|
|
1097
920
|
}
|
|
1098
|
-
function
|
|
921
|
+
function _t(e, t, n, a, r, o, i) {
|
|
1099
922
|
const s = {
|
|
1100
923
|
level: e,
|
|
1101
|
-
category:
|
|
1102
|
-
message:
|
|
924
|
+
category: r,
|
|
925
|
+
message: o,
|
|
1103
926
|
data: i,
|
|
1104
927
|
timestamp: Date.now()
|
|
1105
928
|
};
|
|
1106
|
-
if (
|
|
1107
|
-
if (
|
|
1108
|
-
const p =
|
|
1109
|
-
if (p && !p.has(
|
|
929
|
+
if (Br(s), (n || Bn()) && Ot(s), !a) {
|
|
930
|
+
if (!$r()) return;
|
|
931
|
+
const p = qr();
|
|
932
|
+
if (p && !p.has(r.toLowerCase())) return;
|
|
1110
933
|
}
|
|
1111
|
-
const c =
|
|
934
|
+
const c = zr(), b = i !== void 0 ? " " + Wr(i) : "";
|
|
1112
935
|
t(
|
|
1113
|
-
`%c[${c}]%c [${
|
|
936
|
+
`%c[${c}]%c [${r}]%c ${o}${b}`,
|
|
1114
937
|
nt.time,
|
|
1115
938
|
nt.category,
|
|
1116
939
|
nt[e]
|
|
1117
940
|
);
|
|
1118
941
|
}
|
|
1119
942
|
function g(e, t, n) {
|
|
1120
|
-
|
|
943
|
+
_t("debug", console.log, !1, !1, e, t, n);
|
|
1121
944
|
}
|
|
1122
|
-
function
|
|
1123
|
-
|
|
945
|
+
function R(e, t, n) {
|
|
946
|
+
_t("warn", console.warn, !0, !1, e, t, n);
|
|
1124
947
|
}
|
|
1125
948
|
function Oe(e, t, n) {
|
|
1126
|
-
|
|
949
|
+
_t("error", console.error, !0, !0, e, t, n);
|
|
1127
950
|
}
|
|
1128
|
-
function
|
|
951
|
+
function Gr() {
|
|
1129
952
|
return [...he];
|
|
1130
953
|
}
|
|
1131
|
-
function
|
|
954
|
+
function Vr() {
|
|
1132
955
|
he.length = 0;
|
|
1133
956
|
}
|
|
1134
|
-
function
|
|
957
|
+
function Kr(e) {
|
|
1135
958
|
const t = e && e.length > 0 ? e.join(",") : "true";
|
|
1136
959
|
Ze(ae.DEBUG_FLAG, t), console.log("[wp] Debug mode enabled");
|
|
1137
960
|
}
|
|
1138
|
-
function
|
|
961
|
+
function Yr() {
|
|
1139
962
|
ze(ae.DEBUG_FLAG), console.log("[wp] Debug mode disabled");
|
|
1140
963
|
}
|
|
1141
|
-
const
|
|
1142
|
-
function
|
|
964
|
+
const Jr = 1024, Xr = 5e4;
|
|
965
|
+
function Qr(e) {
|
|
1143
966
|
if (e == null) return e;
|
|
1144
967
|
try {
|
|
1145
968
|
const t = JSON.stringify(e);
|
|
1146
|
-
if (t.length <=
|
|
969
|
+
if (t.length <= Jr) return e;
|
|
1147
970
|
if (typeof e == "object" && !Array.isArray(e)) {
|
|
1148
971
|
const n = {};
|
|
1149
|
-
for (const [a,
|
|
1150
|
-
const
|
|
1151
|
-
n[a] =
|
|
972
|
+
for (const [a, r] of Object.entries(e)) {
|
|
973
|
+
const o = JSON.stringify(r);
|
|
974
|
+
n[a] = o && o.length > 200 ? `[truncated ${o.length} chars]` : r;
|
|
1152
975
|
}
|
|
1153
976
|
return n;
|
|
1154
977
|
}
|
|
@@ -1157,7 +980,7 @@ function yo(e) {
|
|
|
1157
980
|
return "[unserializable]";
|
|
1158
981
|
}
|
|
1159
982
|
}
|
|
1160
|
-
async function
|
|
983
|
+
async function Zr() {
|
|
1161
984
|
if (Le.length === 0) return;
|
|
1162
985
|
const e = Le;
|
|
1163
986
|
Le = [], ut = null;
|
|
@@ -1165,59 +988,59 @@ async function wo() {
|
|
|
1165
988
|
let n = _e().serverOrigin || "";
|
|
1166
989
|
if ((n === "/" || !n) && typeof window < "u") {
|
|
1167
990
|
const s = window.location;
|
|
1168
|
-
(s.hostname === "localhost" || s.hostname === "127.0.0.1") && s.port === String(
|
|
991
|
+
(s.hostname === "localhost" || s.hostname === "127.0.0.1") && s.port === String(wn) ? n = `${s.protocol}//${s.hostname}:${bt}` : n = s.origin;
|
|
1169
992
|
}
|
|
1170
|
-
const a = `${n.replace(/\/$/, "")}/api/client-log`,
|
|
993
|
+
const a = `${n.replace(/\/$/, "")}/api/client-log`, r = e.map((s) => ({
|
|
1171
994
|
level: s.level,
|
|
1172
995
|
category: s.category,
|
|
1173
996
|
message: s.message,
|
|
1174
|
-
data:
|
|
997
|
+
data: Qr(s.data),
|
|
1175
998
|
timestamp: s.timestamp,
|
|
1176
999
|
url: typeof window < "u" ? window.location.href : void 0,
|
|
1177
1000
|
userAgent: typeof navigator < "u" ? navigator.userAgent : void 0,
|
|
1178
1001
|
room_key: mt?.room_key,
|
|
1179
1002
|
client_id: mt?.client_id
|
|
1180
1003
|
}));
|
|
1181
|
-
let
|
|
1182
|
-
for (const s of
|
|
1004
|
+
let o = [], i = 0;
|
|
1005
|
+
for (const s of r) {
|
|
1183
1006
|
const c = JSON.stringify(s).length + 1;
|
|
1184
|
-
i + c >
|
|
1007
|
+
i + c > Xr && o.length > 0 && (await fetch(a, {
|
|
1185
1008
|
method: "POST",
|
|
1186
1009
|
headers: { "Content-Type": "application/json" },
|
|
1187
|
-
body: JSON.stringify({ logs:
|
|
1188
|
-
}),
|
|
1010
|
+
body: JSON.stringify({ logs: o })
|
|
1011
|
+
}), o = [], i = 0), o.push(s), i += c;
|
|
1189
1012
|
}
|
|
1190
|
-
|
|
1013
|
+
o.length > 0 && await fetch(a, {
|
|
1191
1014
|
method: "POST",
|
|
1192
1015
|
headers: { "Content-Type": "application/json" },
|
|
1193
|
-
body: JSON.stringify({ logs:
|
|
1016
|
+
body: JSON.stringify({ logs: o })
|
|
1194
1017
|
});
|
|
1195
1018
|
} catch (t) {
|
|
1196
|
-
console.warn("[wp] log flush failed (client logs may be lost):",
|
|
1019
|
+
console.warn("[wp] log flush failed (client logs may be lost):", xe(t).error);
|
|
1197
1020
|
}
|
|
1198
1021
|
}
|
|
1199
|
-
function
|
|
1022
|
+
function Ot(e) {
|
|
1200
1023
|
if (Le.push(e), !ut) {
|
|
1201
|
-
const t =
|
|
1024
|
+
const t = Bn() ? Fr : Ur;
|
|
1202
1025
|
ut = setTimeout(() => {
|
|
1203
|
-
|
|
1026
|
+
Zr();
|
|
1204
1027
|
}, t);
|
|
1205
1028
|
}
|
|
1206
1029
|
}
|
|
1207
|
-
function
|
|
1030
|
+
function xe(e) {
|
|
1208
1031
|
return e instanceof Error ? { error: e.message, name: e.name } : { error: String(e), name: typeof e };
|
|
1209
1032
|
}
|
|
1210
1033
|
et("__wpDebug", {
|
|
1211
|
-
enable:
|
|
1212
|
-
disable:
|
|
1213
|
-
history:
|
|
1214
|
-
clear:
|
|
1034
|
+
enable: Kr,
|
|
1035
|
+
disable: Yr,
|
|
1036
|
+
history: Gr,
|
|
1037
|
+
clear: Vr
|
|
1215
1038
|
});
|
|
1216
|
-
const
|
|
1217
|
-
function
|
|
1218
|
-
return e.screenWidth <
|
|
1039
|
+
const eo = 1280;
|
|
1040
|
+
function to(e) {
|
|
1041
|
+
return e.screenWidth < eo ? !1 : e.noHoverNoPointer || e.anyHoverNone && e.maxTouchPoints === 0;
|
|
1219
1042
|
}
|
|
1220
|
-
function
|
|
1043
|
+
function no() {
|
|
1221
1044
|
const e = (t) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(t).matches;
|
|
1222
1045
|
return {
|
|
1223
1046
|
noHoverNoPointer: e("(hover: none) and (pointer: none)"),
|
|
@@ -1226,12 +1049,12 @@ function _o() {
|
|
|
1226
1049
|
screenWidth: typeof screen < "u" ? screen.width : 0
|
|
1227
1050
|
};
|
|
1228
1051
|
}
|
|
1229
|
-
let
|
|
1230
|
-
function
|
|
1231
|
-
return
|
|
1052
|
+
let Ht = null;
|
|
1053
|
+
function ao() {
|
|
1054
|
+
return Ht ??= to(no()), Ht;
|
|
1232
1055
|
}
|
|
1233
|
-
function
|
|
1234
|
-
return
|
|
1056
|
+
function Ut() {
|
|
1057
|
+
return ao();
|
|
1235
1058
|
}
|
|
1236
1059
|
const ne = {
|
|
1237
1060
|
resolved: !1,
|
|
@@ -1241,23 +1064,23 @@ const ne = {
|
|
|
1241
1064
|
function xt() {
|
|
1242
1065
|
return ne.accountId ? ne.accountId : ne.resolved && ne.userType === "public" ? "anon" : null;
|
|
1243
1066
|
}
|
|
1244
|
-
function
|
|
1067
|
+
function ro(e) {
|
|
1245
1068
|
ne.resolved = !0, e.userType && (ne.userType = e.userType), e.userId !== void 0 && (ne.accountId = e.userId && e.userId !== "public" ? e.userId : null);
|
|
1246
1069
|
}
|
|
1247
|
-
function
|
|
1070
|
+
function St() {
|
|
1248
1071
|
return ne.accountId ?? "public";
|
|
1249
1072
|
}
|
|
1250
|
-
function
|
|
1073
|
+
function oo() {
|
|
1251
1074
|
return xt() ?? "unscoped";
|
|
1252
1075
|
}
|
|
1253
|
-
function
|
|
1254
|
-
return Ye(e) ?
|
|
1076
|
+
function Wn(e) {
|
|
1077
|
+
return Ye(e) ? or[e] : "var(--color-neutral-bg)";
|
|
1255
1078
|
}
|
|
1256
|
-
function
|
|
1257
|
-
return Ye(e) ? `${_e().serverOrigin.replace(/\/$/, "")}${
|
|
1079
|
+
function fo(e) {
|
|
1080
|
+
return Ye(e) ? `${_e().serverOrigin.replace(/\/$/, "")}${ir(e)}` : void 0;
|
|
1258
1081
|
}
|
|
1259
1082
|
let we = null, Ae = null;
|
|
1260
|
-
function
|
|
1083
|
+
function io() {
|
|
1261
1084
|
return we ? Promise.resolve() : Ae || (Ae = (async () => {
|
|
1262
1085
|
try {
|
|
1263
1086
|
const e = _e().serverOrigin.replace(/\/$/, ""), t = await fetch(`${e}/media/sprites/names.json`, { cache: "no-cache" });
|
|
@@ -1265,7 +1088,7 @@ function Io() {
|
|
|
1265
1088
|
const n = await t.json();
|
|
1266
1089
|
we = n, et("__DISPLAY_NAMES__", n), g("characters", "Loaded display names", n);
|
|
1267
1090
|
} catch (e) {
|
|
1268
|
-
g("characters", "display names fetch failed (degrading to sprite IDs)",
|
|
1091
|
+
g("characters", "display names fetch failed (degrading to sprite IDs)", xe(e));
|
|
1269
1092
|
}
|
|
1270
1093
|
})(), Ae);
|
|
1271
1094
|
}
|
|
@@ -1276,7 +1099,7 @@ function se(e) {
|
|
|
1276
1099
|
const t = e.toLowerCase();
|
|
1277
1100
|
return Ke.some((n) => n === t) ? !0 : we ? Object.values(we).some((n) => n.toLowerCase() === t) : !1;
|
|
1278
1101
|
}
|
|
1279
|
-
const
|
|
1102
|
+
const so = f.object({
|
|
1280
1103
|
// Identity. There is deliberately NO `name`: a person's name is their
|
|
1281
1104
|
// hadoku key-registry name, resolved by the server from whoami and renamed
|
|
1282
1105
|
// through hadoku_site's POST /session/name (operator decision 2026-10-08).
|
|
@@ -1287,32 +1110,32 @@ const Eo = r.object({
|
|
|
1287
1110
|
// (lib/avatar.ts). It stays in the schema because prefs-api still reads it:
|
|
1288
1111
|
// it is the fallback character for a person who never chose one at the
|
|
1289
1112
|
// top level (operator decision 2026-10-31).
|
|
1290
|
-
sprite:
|
|
1113
|
+
sprite: f.string().optional(),
|
|
1291
1114
|
// Chat settings
|
|
1292
|
-
chatCollapsed:
|
|
1293
|
-
floatingChatEnabled:
|
|
1115
|
+
chatCollapsed: f.boolean().optional(),
|
|
1116
|
+
floatingChatEnabled: f.boolean().optional(),
|
|
1294
1117
|
// RoomChrome's chat column (roomChrome/chatLayout.ts) — separate from the
|
|
1295
1118
|
// app's chatCollapsed on purpose.
|
|
1296
|
-
chromeChatCollapsed:
|
|
1297
|
-
chromeChatWidth:
|
|
1119
|
+
chromeChatCollapsed: f.boolean().optional(),
|
|
1120
|
+
chromeChatWidth: f.number().optional(),
|
|
1298
1121
|
// Media settings
|
|
1299
|
-
volume:
|
|
1300
|
-
muted:
|
|
1301
|
-
preferredAudioLang:
|
|
1302
|
-
subtitlesEnabled:
|
|
1303
|
-
subtitleStyle:
|
|
1304
|
-
}), be =
|
|
1122
|
+
volume: f.number().min(0).max(1).optional(),
|
|
1123
|
+
muted: f.boolean().optional(),
|
|
1124
|
+
preferredAudioLang: f.string().optional(),
|
|
1125
|
+
subtitlesEnabled: f.boolean().optional(),
|
|
1126
|
+
subtitleStyle: f.string().optional()
|
|
1127
|
+
}), be = Da({
|
|
1305
1128
|
appId: "watchparty",
|
|
1306
|
-
schema:
|
|
1307
|
-
}),
|
|
1129
|
+
schema: so
|
|
1130
|
+
}), lo = /* @__PURE__ */ new Set(["theme", "themeMode"]);
|
|
1308
1131
|
function Be(e) {
|
|
1309
1132
|
const t = xt();
|
|
1310
1133
|
return t ? `prefs-cache:${t}:${e}` : null;
|
|
1311
1134
|
}
|
|
1312
|
-
function
|
|
1135
|
+
function co() {
|
|
1313
1136
|
return xt() === null;
|
|
1314
1137
|
}
|
|
1315
|
-
function
|
|
1138
|
+
function Ft(e) {
|
|
1316
1139
|
const t = Be(e);
|
|
1317
1140
|
if (!t) return {};
|
|
1318
1141
|
const n = B(t);
|
|
@@ -1323,35 +1146,35 @@ function zt(e) {
|
|
|
1323
1146
|
return {};
|
|
1324
1147
|
}
|
|
1325
1148
|
}
|
|
1326
|
-
function
|
|
1149
|
+
function uo() {
|
|
1327
1150
|
let e = 0;
|
|
1328
|
-
for (const t of
|
|
1151
|
+
for (const t of Dr()) {
|
|
1329
1152
|
const n = t.startsWith("prefs-cache:") && t.endsWith(":watchparty"), a = t === We || t.startsWith(`${We}:`) && !t.endsWith(":_serverSynced_v1");
|
|
1330
1153
|
if (!n && !a) continue;
|
|
1331
|
-
const
|
|
1332
|
-
if (!
|
|
1333
|
-
let
|
|
1154
|
+
const r = B(t);
|
|
1155
|
+
if (!r) continue;
|
|
1156
|
+
let o;
|
|
1334
1157
|
try {
|
|
1335
|
-
|
|
1158
|
+
o = JSON.parse(r);
|
|
1336
1159
|
} catch {
|
|
1337
1160
|
continue;
|
|
1338
1161
|
}
|
|
1339
|
-
const i = n ?
|
|
1162
|
+
const i = n ? o?.blob : o;
|
|
1340
1163
|
if (!i || typeof i != "object" || !("name" in i)) continue;
|
|
1341
|
-
const { name: s, ...c } = i, b = n ? { ...
|
|
1164
|
+
const { name: s, ...c } = i, b = n ? { ...o, blob: c } : c;
|
|
1342
1165
|
Ze(t, JSON.stringify(b)) && e++;
|
|
1343
1166
|
}
|
|
1344
1167
|
return e > 0 && g("preferences", "Stripped retired name from cached prefs rows", { rewritten: e }), e;
|
|
1345
1168
|
}
|
|
1346
|
-
let
|
|
1347
|
-
const
|
|
1348
|
-
function
|
|
1349
|
-
if (
|
|
1169
|
+
let Gn = null, Vn = null;
|
|
1170
|
+
const $t = /* @__PURE__ */ new Set();
|
|
1171
|
+
function Tt() {
|
|
1172
|
+
if (co())
|
|
1350
1173
|
return g("preferences", "Boot read deferred — session pending, identity unresolved"), {};
|
|
1351
|
-
const e =
|
|
1352
|
-
if (
|
|
1174
|
+
const e = Ft("portfolio"), t = Ft("watchparty"), n = Object.keys(e).length > 0 ? e : Gn ?? {}, a = Object.keys(t).length > 0 ? t : Vn ?? {}, r = St() || "public";
|
|
1175
|
+
if ($t.has(r))
|
|
1353
1176
|
return g("preferences", "Loaded (sync, SDK-only after first read)", {
|
|
1354
|
-
uid:
|
|
1177
|
+
uid: r,
|
|
1355
1178
|
sdkThemeKeys: Object.keys(n).length,
|
|
1356
1179
|
sdkAppKeys: Object.keys(a).length,
|
|
1357
1180
|
// 'mem' indicates in-memory backstop fired (cache was empty,
|
|
@@ -1359,70 +1182,70 @@ function Ct() {
|
|
|
1359
1182
|
themeSource: Object.keys(e).length > 0 ? "cache" : "mem",
|
|
1360
1183
|
appSource: Object.keys(t).length > 0 ? "cache" : "mem"
|
|
1361
1184
|
}), { ...a, ...n };
|
|
1362
|
-
|
|
1363
|
-
const
|
|
1185
|
+
$t.add(r);
|
|
1186
|
+
const o = Yn() ?? {}, i = { ...o, ...a, ...n };
|
|
1364
1187
|
return g("preferences", "Loaded (sync, first read — legacy + SDK)", {
|
|
1365
|
-
uid:
|
|
1188
|
+
uid: r,
|
|
1366
1189
|
sdkThemeKeys: Object.keys(n).length,
|
|
1367
1190
|
sdkAppKeys: Object.keys(a).length,
|
|
1368
|
-
legacyKeys: Object.keys(
|
|
1191
|
+
legacyKeys: Object.keys(o).length,
|
|
1369
1192
|
themeSource: Object.keys(e).length > 0 ? "cache" : "mem",
|
|
1370
1193
|
appSource: Object.keys(t).length > 0 ? "cache" : "mem"
|
|
1371
1194
|
}), i;
|
|
1372
1195
|
}
|
|
1373
|
-
let
|
|
1374
|
-
function
|
|
1375
|
-
const e =
|
|
1196
|
+
let Kn = !1;
|
|
1197
|
+
function mo() {
|
|
1198
|
+
const e = St();
|
|
1376
1199
|
return !e || e === "public";
|
|
1377
1200
|
}
|
|
1378
1201
|
function Y(e, t) {
|
|
1379
|
-
|
|
1202
|
+
mo() && (Kn = !0), lo.has(e) ? pe.save({ [e]: t }, { scope: "device" }).catch((n) => R("preferences", "themePrefs.save failed", { key: e, err: n?.message })) : be.save({ [e]: t }).catch((n) => R("preferences", "watchpartyPrefs.save failed", { key: e, err: n?.message })), g("preferences", "Saved (via SDK)", { key: e, value: t });
|
|
1380
1203
|
}
|
|
1381
|
-
let Ne = null,
|
|
1382
|
-
function
|
|
1204
|
+
let Ne = null, qt = !1;
|
|
1205
|
+
function go() {
|
|
1383
1206
|
return Ne || (Ne = (async () => {
|
|
1384
1207
|
if (typeof window > "u") return !1;
|
|
1385
1208
|
try {
|
|
1386
|
-
|
|
1387
|
-
|
|
1209
|
+
qt || (qt = !0, pe.subscribe((i) => {
|
|
1210
|
+
Gn = i, Wt("portfolio", i), Gt("theme");
|
|
1388
1211
|
}), be.subscribe((i) => {
|
|
1389
|
-
|
|
1212
|
+
Vn = i, Wt("watchparty", i), Gt("watchparty");
|
|
1390
1213
|
}));
|
|
1391
1214
|
const [e, t] = await Promise.all([
|
|
1392
1215
|
pe.read(),
|
|
1393
1216
|
be.read()
|
|
1394
1217
|
]);
|
|
1395
1218
|
try {
|
|
1396
|
-
const { useAppStore: i } = await Promise.resolve().then(() =>
|
|
1219
|
+
const { useAppStore: i } = await Promise.resolve().then(() => Zn);
|
|
1397
1220
|
i.getState().rehydrateFromPrefs();
|
|
1398
1221
|
} catch (i) {
|
|
1399
|
-
|
|
1222
|
+
R("preferences", "inline rehydrate after SDK read failed", { err: i?.message });
|
|
1400
1223
|
}
|
|
1401
|
-
const n = Be("portfolio"), a = Be("watchparty"),
|
|
1224
|
+
const n = Be("portfolio"), a = Be("watchparty"), r = n ? B(n) : null, o = a ? B(a) : null;
|
|
1402
1225
|
return g("preferences", "sdk.read", {
|
|
1403
1226
|
themeKeys: Object.keys(e ?? {}),
|
|
1404
1227
|
appKeys: Object.keys(t ?? {}),
|
|
1405
1228
|
// Post-fetch cache state: should be non-zero if SDK wrote it.
|
|
1406
|
-
sdkThemeBytesPost:
|
|
1407
|
-
sdkAppBytesPost:
|
|
1408
|
-
}), await
|
|
1229
|
+
sdkThemeBytesPost: r?.length ?? 0,
|
|
1230
|
+
sdkAppBytesPost: o?.length ?? 0
|
|
1231
|
+
}), await po(e, t), Kn ? (g("preferences", "Promoting this load's pre-auth picks to the signed-in user"), await Promise.all([
|
|
1409
1232
|
pe.promoteAnonPrefsToUser().catch(() => {
|
|
1410
1233
|
}),
|
|
1411
1234
|
be.promoteAnonPrefsToUser().catch(() => {
|
|
1412
1235
|
})
|
|
1413
1236
|
])) : g("preferences", "Skipping anon promotion — no pre-auth writes this load"), g("preferences", "First-load SDK sync complete"), !0;
|
|
1414
1237
|
} catch (e) {
|
|
1415
|
-
return
|
|
1238
|
+
return R("preferences", "First-load SDK sync failed (non-fatal)", { err: e?.message }), !1;
|
|
1416
1239
|
}
|
|
1417
1240
|
})(), Ne);
|
|
1418
1241
|
}
|
|
1419
1242
|
const We = "watchparty_preferences";
|
|
1420
|
-
|
|
1243
|
+
uo();
|
|
1421
1244
|
function gt() {
|
|
1422
|
-
const e =
|
|
1245
|
+
const e = St();
|
|
1423
1246
|
return !e || e === "public" ? We : `${We}:${e}`;
|
|
1424
1247
|
}
|
|
1425
|
-
function
|
|
1248
|
+
function Yn() {
|
|
1426
1249
|
const e = B(gt());
|
|
1427
1250
|
if (!e) return null;
|
|
1428
1251
|
try {
|
|
@@ -1432,39 +1255,39 @@ function ta() {
|
|
|
1432
1255
|
return null;
|
|
1433
1256
|
}
|
|
1434
1257
|
}
|
|
1435
|
-
function
|
|
1258
|
+
function zt() {
|
|
1436
1259
|
ze(gt()), ze(`${gt()}:_serverSynced_v1`);
|
|
1437
1260
|
}
|
|
1438
|
-
async function
|
|
1439
|
-
const n =
|
|
1261
|
+
async function po(e, t) {
|
|
1262
|
+
const n = Yn();
|
|
1440
1263
|
if (!n || Object.keys(n).length === 0) return;
|
|
1441
|
-
const a = Object.keys(e ?? {}).length > 0,
|
|
1264
|
+
const a = Object.keys(e ?? {}).length > 0, r = Object.keys(t ?? {}).length > 0, o = {}, i = {};
|
|
1442
1265
|
for (const [b, p] of Object.entries(n))
|
|
1443
|
-
a || (b === "theme" && typeof p == "string" ?
|
|
1444
|
-
const s = Object.keys(
|
|
1266
|
+
a || (b === "theme" && typeof p == "string" ? o.theme = p : b === "themeMode" && (p === "simple" || p === "advanced") && (o.themeMode = p)), r || (b === "chatCollapsed" && typeof p == "boolean" ? i.chatCollapsed = p : b === "floatingChatEnabled" && typeof p == "boolean" ? i.floatingChatEnabled = p : b === "volume" && typeof p == "number" && p >= 0 && p <= 1 ? i.volume = p : b === "muted" && typeof p == "boolean" ? i.muted = p : b === "preferredAudioLang" && typeof p == "string" ? i.preferredAudioLang = p : b === "subtitlesEnabled" && typeof p == "boolean" ? i.subtitlesEnabled = p : b === "subtitleStyle" && typeof p == "string" && (i.subtitleStyle = p));
|
|
1267
|
+
const s = Object.keys(o), c = Object.keys(i);
|
|
1445
1268
|
if (s.length === 0 && c.length === 0) {
|
|
1446
|
-
|
|
1269
|
+
zt();
|
|
1447
1270
|
return;
|
|
1448
1271
|
}
|
|
1449
1272
|
g("preferences", "Migrating legacy localStorage prefs to SDK", {
|
|
1450
1273
|
themeKeys: s,
|
|
1451
1274
|
appKeys: c,
|
|
1452
1275
|
sdkHasTheme: a,
|
|
1453
|
-
sdkHasApp:
|
|
1276
|
+
sdkHasApp: r
|
|
1454
1277
|
});
|
|
1455
1278
|
try {
|
|
1456
1279
|
await Promise.all([
|
|
1457
|
-
s.length > 0 ? pe.save(
|
|
1280
|
+
s.length > 0 ? pe.save(o, { scope: "device" }) : Promise.resolve(),
|
|
1458
1281
|
c.length > 0 ? be.save(i) : Promise.resolve()
|
|
1459
|
-
]),
|
|
1282
|
+
]), zt(), g("preferences", "Legacy migration complete");
|
|
1460
1283
|
} catch (b) {
|
|
1461
|
-
|
|
1284
|
+
R("preferences", "Legacy migration save failed — will retry next load", {
|
|
1462
1285
|
err: b?.message
|
|
1463
1286
|
});
|
|
1464
1287
|
}
|
|
1465
1288
|
}
|
|
1466
|
-
let
|
|
1467
|
-
function
|
|
1289
|
+
let Bt = !1;
|
|
1290
|
+
function Wt(e, t) {
|
|
1468
1291
|
const n = Be(e);
|
|
1469
1292
|
if (n)
|
|
1470
1293
|
try {
|
|
@@ -1476,53 +1299,53 @@ function Kt(e, t) {
|
|
|
1476
1299
|
};
|
|
1477
1300
|
localStorage.setItem(n, JSON.stringify(a));
|
|
1478
1301
|
} catch (a) {
|
|
1479
|
-
|
|
1302
|
+
Bt || (Bt = !0, R("preferences", "writeThrough localStorage failed (in-memory backstop only)", {
|
|
1480
1303
|
appId: e,
|
|
1481
1304
|
err: a?.message,
|
|
1482
1305
|
name: a?.name
|
|
1483
1306
|
}));
|
|
1484
1307
|
}
|
|
1485
1308
|
}
|
|
1486
|
-
function
|
|
1487
|
-
Promise.resolve().then(() =>
|
|
1309
|
+
function Gt(e) {
|
|
1310
|
+
Promise.resolve().then(() => Zn).then(({ useAppStore: t }) => {
|
|
1488
1311
|
try {
|
|
1489
1312
|
t.getState().rehydrateFromPrefs();
|
|
1490
1313
|
} catch (n) {
|
|
1491
|
-
|
|
1314
|
+
R("preferences", "rehydrateFromPrefs threw", { reason: e, err: n?.message });
|
|
1492
1315
|
}
|
|
1493
|
-
}).catch((t) =>
|
|
1316
|
+
}).catch((t) => R("preferences", "store import failed", { reason: e, err: t?.message }));
|
|
1494
1317
|
}
|
|
1495
|
-
const
|
|
1318
|
+
const Jn = 320, Ge = 240, Ct = 640, ho = 320, bo = 36, Vt = 16;
|
|
1496
1319
|
function Q(e, t) {
|
|
1497
|
-
if (!Number.isFinite(e)) return
|
|
1498
|
-
let n =
|
|
1499
|
-
return t !== void 0 && Number.isFinite(t) && t > 0 && (n = Math.min(n, t -
|
|
1320
|
+
if (!Number.isFinite(e)) return Jn;
|
|
1321
|
+
let n = Ct;
|
|
1322
|
+
return t !== void 0 && Number.isFinite(t) && t > 0 && (n = Math.min(n, t - ho)), n = Math.max(n, Ge), Math.round(Math.min(n, Math.max(Ge, e)));
|
|
1500
1323
|
}
|
|
1501
|
-
function
|
|
1324
|
+
function Kt(e, t, n, a) {
|
|
1502
1325
|
return Q(e + (t - n), a);
|
|
1503
1326
|
}
|
|
1504
|
-
function
|
|
1327
|
+
function yo(e, t, n) {
|
|
1505
1328
|
switch (t) {
|
|
1506
1329
|
case "ArrowLeft":
|
|
1507
|
-
return Q(e +
|
|
1330
|
+
return Q(e + Vt, n);
|
|
1508
1331
|
case "ArrowRight":
|
|
1509
|
-
return Q(e -
|
|
1332
|
+
return Q(e - Vt, n);
|
|
1510
1333
|
case "Home":
|
|
1511
1334
|
return Q(Ge, n);
|
|
1512
1335
|
case "End":
|
|
1513
|
-
return Q(
|
|
1336
|
+
return Q(Ct, n);
|
|
1514
1337
|
default:
|
|
1515
1338
|
return null;
|
|
1516
1339
|
}
|
|
1517
1340
|
}
|
|
1518
|
-
function
|
|
1519
|
-
return { collapsed: e, width: e ?
|
|
1341
|
+
function wo(e, t) {
|
|
1342
|
+
return { collapsed: e, width: e ? bo : t };
|
|
1520
1343
|
}
|
|
1521
|
-
function
|
|
1522
|
-
const n = new Set(t.map((
|
|
1523
|
-
return
|
|
1344
|
+
function Xn(e, t) {
|
|
1345
|
+
const n = new Set(t.map((o) => o.id)), a = t.reduce((o, i) => Math.max(o, i.ts), -1 / 0), r = e.filter((o) => !n.has(o.id) && o.ts > a);
|
|
1346
|
+
return r.length ? [...t, ...r] : t;
|
|
1524
1347
|
}
|
|
1525
|
-
const
|
|
1348
|
+
const Qn = 6e3, J = Tt(), u = Ra((e, t) => ({
|
|
1526
1349
|
ready: !1,
|
|
1527
1350
|
name: "",
|
|
1528
1351
|
sprite: null,
|
|
@@ -1535,7 +1358,7 @@ const ra = 6e3, J = Ct(), u = Ha((e, t) => ({
|
|
|
1535
1358
|
chatJump: null,
|
|
1536
1359
|
chatCollapsed: J.chatCollapsed ?? !1,
|
|
1537
1360
|
chromeChatCollapsed: J.chromeChatCollapsed ?? !1,
|
|
1538
|
-
chromeChatWidth: Q(J.chromeChatWidth ??
|
|
1361
|
+
chromeChatWidth: Q(J.chromeChatWidth ?? Jn),
|
|
1539
1362
|
// Hardcoded on for everyone — the per-user toggle was removed from the
|
|
1540
1363
|
// control bar; FloatingChat + toggleFloatingChat code is kept for future
|
|
1541
1364
|
// re-enablement but the value is no longer user-controllable.
|
|
@@ -1579,26 +1402,26 @@ const ra = 6e3, J = Ct(), u = Ha((e, t) => ({
|
|
|
1579
1402
|
ensureAutoIdentity: () => e((n) => {
|
|
1580
1403
|
if (n.name) return {};
|
|
1581
1404
|
if (n.sprite) {
|
|
1582
|
-
const
|
|
1583
|
-
return g("store", "Auto-identity: deriving name from the requested sprite", { name:
|
|
1405
|
+
const o = ve(n.sprite);
|
|
1406
|
+
return g("store", "Auto-identity: deriving name from the requested sprite", { name: o, sprite: n.sprite }), { name: o };
|
|
1584
1407
|
}
|
|
1585
|
-
const a = Object.values(n.roster).map((
|
|
1586
|
-
if (
|
|
1587
|
-
const
|
|
1588
|
-
return g("store", "Auto-identity assigned", { name:
|
|
1408
|
+
const a = Object.values(n.roster).map((o) => o.sprite), r = pn(a, void 0, Ke);
|
|
1409
|
+
if (r) {
|
|
1410
|
+
const o = ve(r);
|
|
1411
|
+
return g("store", "Auto-identity assigned", { name: o, sprite: r }), { name: o, sprite: r };
|
|
1589
1412
|
}
|
|
1590
|
-
return
|
|
1413
|
+
return R("store", "All characters taken, leaving identity unset"), {};
|
|
1591
1414
|
}),
|
|
1592
1415
|
ensureMe: (n) => {
|
|
1593
1416
|
g("store", "Client ID set", { clientId: n }), e((a) => ({ me: { ...a.me, clientId: n } }));
|
|
1594
1417
|
},
|
|
1595
1418
|
applySnapshot: (n) => e((a) => {
|
|
1596
|
-
const
|
|
1419
|
+
const r = { ...a.roster };
|
|
1597
1420
|
if (n.users)
|
|
1598
|
-
for (const c of n.users)
|
|
1599
|
-
const
|
|
1421
|
+
for (const c of n.users) r[c.clientId] = c;
|
|
1422
|
+
const o = n.mediaId !== void 0 ? n.mediaId : a.snapshot.mediaId, i = n.leaderId !== void 0 ? n.leaderId : a.snapshot.leaderId;
|
|
1600
1423
|
g("store", "Snapshot applied", {
|
|
1601
|
-
mediaId:
|
|
1424
|
+
mediaId: o,
|
|
1602
1425
|
playing: n.playing ?? a.snapshot.playing,
|
|
1603
1426
|
serverSeq: n.serverSeq ?? a.snapshot.serverSeq,
|
|
1604
1427
|
userCount: n.users?.length ?? 0
|
|
@@ -1607,13 +1430,13 @@ const ra = 6e3, J = Ct(), u = Ha((e, t) => ({
|
|
|
1607
1430
|
return {
|
|
1608
1431
|
snapshot: {
|
|
1609
1432
|
roomId: n.roomId !== void 0 ? n.roomId : a.snapshot.roomId,
|
|
1610
|
-
mediaId:
|
|
1433
|
+
mediaId: o,
|
|
1611
1434
|
playheadMs: s,
|
|
1612
1435
|
playing: n.playing ?? a.snapshot.playing,
|
|
1613
1436
|
serverSeq: n.serverSeq ?? a.snapshot.serverSeq,
|
|
1614
1437
|
leaderId: i
|
|
1615
1438
|
},
|
|
1616
|
-
roster:
|
|
1439
|
+
roster: r,
|
|
1617
1440
|
// Always update — initial snapshot on join often has playheadMs=0
|
|
1618
1441
|
// matching the store default, so the old playheadChanged guard left
|
|
1619
1442
|
// snapshotReceivedAt at page-load time. This inflated viewer correction
|
|
@@ -1626,34 +1449,34 @@ const ra = 6e3, J = Ct(), u = Ha((e, t) => ({
|
|
|
1626
1449
|
},
|
|
1627
1450
|
removeUser: (n) => {
|
|
1628
1451
|
g("store", "User removed", { clientId: n }), e((a) => {
|
|
1629
|
-
const
|
|
1630
|
-
return delete
|
|
1452
|
+
const r = { ...a.roster };
|
|
1453
|
+
return delete r[n], { roster: r };
|
|
1631
1454
|
});
|
|
1632
1455
|
},
|
|
1633
1456
|
appendChat: (n) => {
|
|
1634
1457
|
g("chat", "Message appended", { id: n.id, from: n.name, isSystem: n.isSystem }), e((a) => {
|
|
1635
1458
|
if (n.isSystem || !(n.clientId in a.typing)) return { chat: [...a.chat, n].slice(-500) };
|
|
1636
|
-
const
|
|
1637
|
-
return delete
|
|
1459
|
+
const r = { ...a.typing };
|
|
1460
|
+
return delete r[n.clientId], { chat: [...a.chat, n].slice(-500), typing: r };
|
|
1638
1461
|
});
|
|
1639
1462
|
},
|
|
1640
|
-
setChat: (n) => e((a) => ({ chat:
|
|
1463
|
+
setChat: (n) => e((a) => ({ chat: Xn(a.chat, n).slice(-500) })),
|
|
1641
1464
|
setReplyingTo: (n) => e(() => ({ replyingTo: n })),
|
|
1642
|
-
setReactions: (n, a) => e((
|
|
1643
|
-
const
|
|
1644
|
-
if (
|
|
1645
|
-
const i =
|
|
1646
|
-
return i[
|
|
1465
|
+
setReactions: (n, a) => e((r) => {
|
|
1466
|
+
const o = r.chat.findIndex((s) => s.id === n);
|
|
1467
|
+
if (o < 0) return {};
|
|
1468
|
+
const i = r.chat.slice();
|
|
1469
|
+
return i[o] = { ...i[o], reactions: a.length ? a : void 0 }, { chat: i };
|
|
1647
1470
|
}),
|
|
1648
|
-
setTyping: (n, a) => e((
|
|
1649
|
-
if (!a && !(n in
|
|
1650
|
-
const
|
|
1651
|
-
return a ?
|
|
1471
|
+
setTyping: (n, a) => e((r) => {
|
|
1472
|
+
if (!a && !(n in r.typing)) return {};
|
|
1473
|
+
const o = { ...r.typing };
|
|
1474
|
+
return a ? o[n] = Date.now() + Qn : delete o[n], { typing: o };
|
|
1652
1475
|
}),
|
|
1653
1476
|
jumpToMessage: (n) => e(() => ({ chatJump: { id: n, at: Date.now() } })),
|
|
1654
1477
|
toggleChatCollapsed: () => e((n) => {
|
|
1655
1478
|
const a = !n.chatCollapsed;
|
|
1656
|
-
return
|
|
1479
|
+
return Ut() || Y("chatCollapsed", a), { chatCollapsed: a };
|
|
1657
1480
|
}),
|
|
1658
1481
|
applyTvDefaults: () => e(() => ({ chatCollapsed: !0 })),
|
|
1659
1482
|
toggleChromeChatCollapsed: () => e((n) => {
|
|
@@ -1684,19 +1507,19 @@ const ra = 6e3, J = Ct(), u = Ha((e, t) => ({
|
|
|
1684
1507
|
snapshotReceivedAt: Date.now()
|
|
1685
1508
|
}));
|
|
1686
1509
|
},
|
|
1687
|
-
addRttSample: (n, a,
|
|
1688
|
-
const i = [...
|
|
1689
|
-
let s =
|
|
1690
|
-
if (a &&
|
|
1691
|
-
const c =
|
|
1510
|
+
addRttSample: (n, a, r) => e((o) => {
|
|
1511
|
+
const i = [...o.drift.rtts, n].slice(-5);
|
|
1512
|
+
let s = o.drift.offsetMs;
|
|
1513
|
+
if (a && r) {
|
|
1514
|
+
const c = r + n / 2;
|
|
1692
1515
|
s = a - c;
|
|
1693
1516
|
}
|
|
1694
1517
|
return { drift: { rtts: i, offsetMs: s } };
|
|
1695
1518
|
}),
|
|
1696
1519
|
pushToast: (n, a) => {
|
|
1697
|
-
g("store", "Toast pushed", { kind: n, msg: a }), e((
|
|
1520
|
+
g("store", "Toast pushed", { kind: n, msg: a }), e((r) => ({ toasts: [...r.toasts, { id: Math.random().toString(36).slice(2), kind: n, msg: a, ts: Date.now() }].slice(-5) }));
|
|
1698
1521
|
},
|
|
1699
|
-
popToast: (n) => e((a) => ({ toasts: a.toasts.filter((
|
|
1522
|
+
popToast: (n) => e((a) => ({ toasts: a.toasts.filter((r) => r.id !== n) })),
|
|
1700
1523
|
setReadiness: (n) => e({ readiness: { mediaId: n.mediaId, ready: n.ready, readyCount: n.readyCount, total: n.total } }),
|
|
1701
1524
|
setBufferState: (n) => e((a) => ({ bufferState: { ...a.bufferState, ...n } })),
|
|
1702
1525
|
setMutedForAutoplay: (n) => e({ mutedForAutoplay: n }),
|
|
@@ -1728,9 +1551,9 @@ const ra = 6e3, J = Ct(), u = Ha((e, t) => ({
|
|
|
1728
1551
|
* board or saves its own, which are the two moments its draft is not ahead of
|
|
1729
1552
|
* the server.
|
|
1730
1553
|
*/
|
|
1731
|
-
setTierlistSnapshot: (n, a) => e((
|
|
1554
|
+
setTierlistSnapshot: (n, a) => e((r) => ({
|
|
1732
1555
|
tierlist: n,
|
|
1733
|
-
tierlistDraft: a ? { ...n.myBoard } :
|
|
1556
|
+
tierlistDraft: a ? { ...n.myBoard } : r.tierlistDraft
|
|
1734
1557
|
})),
|
|
1735
1558
|
/**
|
|
1736
1559
|
* Move one item on the draft board. Local only — nothing reaches the server
|
|
@@ -1741,14 +1564,14 @@ const ra = 6e3, J = Ct(), u = Ha((e, t) => ({
|
|
|
1741
1564
|
* present-with-a-low-value — is what keeps "not rated" distinguishable from
|
|
1742
1565
|
* "rated F" in placeTierlist.
|
|
1743
1566
|
*/
|
|
1744
|
-
moveTierlistItem: (n, a,
|
|
1567
|
+
moveTierlistItem: (n, a, r) => e((o) => {
|
|
1745
1568
|
const i = {};
|
|
1746
|
-
for (const [s, c] of Object.entries(
|
|
1569
|
+
for (const [s, c] of Object.entries(o.tierlistDraft)) {
|
|
1747
1570
|
const b = (c ?? []).filter((p) => p !== n);
|
|
1748
1571
|
b.length > 0 && (i[s] = b);
|
|
1749
1572
|
}
|
|
1750
1573
|
if (a !== null) {
|
|
1751
|
-
const s = i[a] ?? [], c = Math.max(0, Math.min(
|
|
1574
|
+
const s = i[a] ?? [], c = Math.max(0, Math.min(r ?? s.length, s.length));
|
|
1752
1575
|
s.splice(c, 0, n), i[a] = s;
|
|
1753
1576
|
}
|
|
1754
1577
|
return { tierlistDraft: i };
|
|
@@ -1758,64 +1581,64 @@ const ra = 6e3, J = Ct(), u = Ha((e, t) => ({
|
|
|
1758
1581
|
setGameSettings: (n) => e({ gameSettings: n }),
|
|
1759
1582
|
setRoomKeyType: (n) => e({ roomKeyType: n }),
|
|
1760
1583
|
rehydrateFromPrefs: () => e((n) => {
|
|
1761
|
-
const a =
|
|
1762
|
-
if (a.chatCollapsed !== void 0 && !
|
|
1584
|
+
const a = Tt(), r = {};
|
|
1585
|
+
if (a.chatCollapsed !== void 0 && !Ut() && (r.chatCollapsed = a.chatCollapsed), a.chromeChatCollapsed !== void 0 && (r.chromeChatCollapsed = a.chromeChatCollapsed), a.chromeChatWidth !== void 0 && (r.chromeChatWidth = Q(a.chromeChatWidth)), ["volume", "muted", "preferredAudioLang", "subtitlesEnabled", "subtitleStyle"].some((s) => a[s] !== void 0)) {
|
|
1763
1586
|
const s = { ...n.mediaPrefs };
|
|
1764
|
-
a.volume !== void 0 && (s.volume = a.volume), a.muted !== void 0 && (s.muted = a.muted), a.preferredAudioLang !== void 0 && (s.preferredAudioLang = a.preferredAudioLang), a.subtitlesEnabled !== void 0 && (s.subtitlesEnabled = a.subtitlesEnabled), a.subtitleStyle !== void 0 && ["classic", "cinema", "minimal", "contrast"].includes(a.subtitleStyle) && (s.subtitleStyle = a.subtitleStyle),
|
|
1587
|
+
a.volume !== void 0 && (s.volume = a.volume), a.muted !== void 0 && (s.muted = a.muted), a.preferredAudioLang !== void 0 && (s.preferredAudioLang = a.preferredAudioLang), a.subtitlesEnabled !== void 0 && (s.subtitlesEnabled = a.subtitlesEnabled), a.subtitleStyle !== void 0 && ["classic", "cinema", "minimal", "contrast"].includes(a.subtitleStyle) && (s.subtitleStyle = a.subtitleStyle), r.mediaPrefs = s;
|
|
1765
1588
|
}
|
|
1766
|
-
return
|
|
1589
|
+
return r;
|
|
1767
1590
|
}),
|
|
1768
1591
|
setSidebarTab: (n) => e((a) => a.sidebarTab === n && n !== "chat" ? { sidebarTab: "chat" } : { sidebarTab: n, chatCollapsed: !1 })
|
|
1769
1592
|
}));
|
|
1770
1593
|
et("__ZUSTAND_STORE__", u);
|
|
1771
|
-
const
|
|
1594
|
+
const Zn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1772
1595
|
__proto__: null,
|
|
1773
|
-
TYPING_EXPIRE_MS:
|
|
1774
|
-
mergeHistory:
|
|
1596
|
+
TYPING_EXPIRE_MS: Qn,
|
|
1597
|
+
mergeHistory: Xn,
|
|
1775
1598
|
useAppStore: u
|
|
1776
1599
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1777
|
-
function
|
|
1600
|
+
function ea(e) {
|
|
1778
1601
|
const t = typeof window < "u" ? window.location.href : "http://localhost/", n = new URL(e, t).pathname;
|
|
1779
1602
|
return `${n.endsWith("/") ? n : `${n}/`}socket.io/`;
|
|
1780
1603
|
}
|
|
1781
|
-
function
|
|
1604
|
+
function vo(e) {
|
|
1782
1605
|
const t = typeof window < "u" ? window.location.href : "http://localhost/", n = e.namespace ?? "/chat";
|
|
1783
1606
|
return {
|
|
1784
1607
|
url: `${new URL(e.origin, t).origin}${n.startsWith("/") ? n : `/${n}`}`,
|
|
1785
|
-
path: e.path ??
|
|
1608
|
+
path: e.path ?? ea(e.origin)
|
|
1786
1609
|
};
|
|
1787
1610
|
}
|
|
1788
|
-
let X = null, K = null,
|
|
1789
|
-
function
|
|
1790
|
-
e && X && e.origin === X.origin && e.path === X.path && e.namespace === X.namespace || !e && !X || (
|
|
1611
|
+
let X = null, K = null, He = null;
|
|
1612
|
+
function Yt(e) {
|
|
1613
|
+
e && X && e.origin === X.origin && e.path === X.path && e.namespace === X.namespace || !e && !X || (na(), X = e);
|
|
1791
1614
|
}
|
|
1792
|
-
function
|
|
1615
|
+
function Se() {
|
|
1793
1616
|
return X !== null;
|
|
1794
1617
|
}
|
|
1795
|
-
function
|
|
1618
|
+
function ko(e) {
|
|
1796
1619
|
if (X)
|
|
1797
|
-
if (
|
|
1620
|
+
if (He = e, K)
|
|
1798
1621
|
K.connected && K.emit(_.JOIN, e);
|
|
1799
1622
|
else {
|
|
1800
|
-
const { url: t, path: n } =
|
|
1801
|
-
K = a, g("chat", "External chat socket", { url: t, path: n }),
|
|
1802
|
-
const
|
|
1803
|
-
|
|
1623
|
+
const { url: t, path: n } = vo(X), a = ct(t, { path: n, transports: ["websocket", "polling"] });
|
|
1624
|
+
K = a, g("chat", "External chat socket", { url: t, path: n }), ra(a), a.on(_.ERROR, (r) => {
|
|
1625
|
+
const o = r?.message || r?.code || "chat error";
|
|
1626
|
+
R("chat", `Chat server error: ${o}`, { code: r?.code }), u.getState().pushToast("error", o);
|
|
1804
1627
|
}), a.on("connect", () => {
|
|
1805
|
-
|
|
1806
|
-
}), a.on("connect_error", (
|
|
1628
|
+
He && a.emit(_.JOIN, He);
|
|
1629
|
+
}), a.on("connect_error", (r) => R("chat", "Chat connection error", { message: r?.message }));
|
|
1807
1630
|
}
|
|
1808
1631
|
}
|
|
1809
|
-
function
|
|
1632
|
+
function _o(e) {
|
|
1810
1633
|
K?.emit(_.CHAT_SEND, e);
|
|
1811
1634
|
}
|
|
1812
|
-
function
|
|
1635
|
+
function ta(e, t) {
|
|
1813
1636
|
K?.connected && K.emit(e, t);
|
|
1814
1637
|
}
|
|
1815
|
-
function
|
|
1816
|
-
|
|
1638
|
+
function na() {
|
|
1639
|
+
He = null, K && (K.disconnect(), K = null);
|
|
1817
1640
|
}
|
|
1818
|
-
function
|
|
1641
|
+
function Jt(e, t) {
|
|
1819
1642
|
return {
|
|
1820
1643
|
id: String(e.id ?? e.server_seq ?? t ?? `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`),
|
|
1821
1644
|
clientId: e.client_id,
|
|
@@ -1831,59 +1654,59 @@ function Zt(e, t) {
|
|
|
1831
1654
|
isSystem: e.isSystem || !1,
|
|
1832
1655
|
systemType: e.systemType,
|
|
1833
1656
|
template: e.isSystem && typeof e.template == "string" && e.template.includes(yt) ? e.template : void 0,
|
|
1834
|
-
replyTo: typeof e.reply_to == "string" &&
|
|
1835
|
-
reactions:
|
|
1657
|
+
replyTo: typeof e.reply_to == "string" && xn.test(e.reply_to) ? e.reply_to : void 0,
|
|
1658
|
+
reactions: aa(e.reactions)
|
|
1836
1659
|
};
|
|
1837
1660
|
}
|
|
1838
|
-
function
|
|
1661
|
+
function aa(e) {
|
|
1839
1662
|
if (!Array.isArray(e)) return;
|
|
1840
1663
|
const t = e.filter((n) => {
|
|
1841
1664
|
const a = n;
|
|
1842
|
-
return !!a && typeof a.emoji == "string" && a.emoji.length > 0 && a.emoji.length <= 48 && Array.isArray(a.by) && a.by.length > 0 && a.by.every((
|
|
1665
|
+
return !!a && typeof a.emoji == "string" && a.emoji.length > 0 && a.emoji.length <= 48 && Array.isArray(a.by) && a.by.length > 0 && a.by.every((r) => typeof r == "string");
|
|
1843
1666
|
});
|
|
1844
1667
|
return t.length ? t : void 0;
|
|
1845
1668
|
}
|
|
1846
|
-
function
|
|
1669
|
+
function ra(e, t = () => !0) {
|
|
1847
1670
|
e.on(_.CHAT_BROADCAST, (n) => {
|
|
1848
1671
|
if (!t()) return;
|
|
1849
|
-
const a = { ...
|
|
1672
|
+
const a = { ...Jt(n, n.server_seq), live: !0 };
|
|
1850
1673
|
u.getState().appendChat(a), g("chat", "Message received", a);
|
|
1851
1674
|
}), e.on(_.CHAT_HISTORY, (n) => {
|
|
1852
1675
|
if (!t() || !n?.messages || !Array.isArray(n.messages)) return;
|
|
1853
|
-
const a = n.messages.map((
|
|
1676
|
+
const a = n.messages.map((r) => Jt(r));
|
|
1854
1677
|
u.getState().setChat(a), g("chat", "History loaded", { count: a.length });
|
|
1855
1678
|
}), e.on(_.CHAT_REACTION, (n) => {
|
|
1856
|
-
t() && (!n || typeof n.id != "string" || u.getState().setReactions(n.id,
|
|
1679
|
+
t() && (!n || typeof n.id != "string" || u.getState().setReactions(n.id, aa(n.reactions) ?? []));
|
|
1857
1680
|
}), e.on(_.CHAT_TYPING, (n) => {
|
|
1858
1681
|
t() && (!n || typeof n.client_id != "string" || typeof n.typing != "boolean" || u.getState().setTyping(n.client_id, n.typing));
|
|
1859
1682
|
});
|
|
1860
1683
|
}
|
|
1861
|
-
let
|
|
1862
|
-
function
|
|
1863
|
-
|
|
1684
|
+
let oa = null;
|
|
1685
|
+
function xo(e) {
|
|
1686
|
+
oa = e;
|
|
1864
1687
|
}
|
|
1865
|
-
function
|
|
1688
|
+
function So(e = oa) {
|
|
1866
1689
|
if (!e) return null;
|
|
1867
1690
|
const t = typeof window < "u" ? window.location.href : "http://localhost/", n = e.namespace ?? "/room";
|
|
1868
1691
|
return {
|
|
1869
1692
|
url: `${new URL(e.origin, t).origin}${n.startsWith("/") ? n : `/${n}`}`,
|
|
1870
|
-
path: e.path ??
|
|
1693
|
+
path: e.path ?? ea(e.origin)
|
|
1871
1694
|
};
|
|
1872
1695
|
}
|
|
1873
|
-
function
|
|
1874
|
-
return `${
|
|
1696
|
+
function To(e) {
|
|
1697
|
+
return `${Mn()}/media/${e}`.replace(/\\/g, "/");
|
|
1875
1698
|
}
|
|
1876
|
-
function
|
|
1877
|
-
return
|
|
1699
|
+
function Co(e, t) {
|
|
1700
|
+
return To(t ?? `${e}/poster.jpg`);
|
|
1878
1701
|
}
|
|
1879
|
-
function
|
|
1880
|
-
return `${
|
|
1702
|
+
function Io(e) {
|
|
1703
|
+
return `${Mn()}${e}`.replace(/\\/g, "/");
|
|
1881
1704
|
}
|
|
1882
|
-
async function
|
|
1705
|
+
async function Eo(e) {
|
|
1883
1706
|
try {
|
|
1884
|
-
const t = await fetch(
|
|
1707
|
+
const t = await fetch(Io("/api/tierlist"));
|
|
1885
1708
|
if (!t.ok)
|
|
1886
|
-
return
|
|
1709
|
+
return R("tierlist", "Board fetch failed", { status: t.status }), null;
|
|
1887
1710
|
const n = await t.json();
|
|
1888
1711
|
return u.getState().setTierlistSnapshot(n, e), g("tierlist", "Board loaded", {
|
|
1889
1712
|
items: n.items.length,
|
|
@@ -1891,81 +1714,81 @@ async function Vo(e) {
|
|
|
1891
1714
|
placed: n.placed.length
|
|
1892
1715
|
}), n;
|
|
1893
1716
|
} catch (t) {
|
|
1894
|
-
return
|
|
1717
|
+
return R("tierlist", "Board fetch threw", xe(t)), null;
|
|
1895
1718
|
}
|
|
1896
1719
|
}
|
|
1897
|
-
let
|
|
1898
|
-
function
|
|
1899
|
-
if (
|
|
1720
|
+
let Xt = !1;
|
|
1721
|
+
function Ao() {
|
|
1722
|
+
if (Xt || typeof Image > "u") return;
|
|
1900
1723
|
const e = u.getState().tierlist;
|
|
1901
1724
|
if (!(!e || e.items.length === 0)) {
|
|
1902
|
-
|
|
1725
|
+
Xt = !0;
|
|
1903
1726
|
for (const t of e.items) {
|
|
1904
1727
|
const n = new Image();
|
|
1905
|
-
n.decoding = "async", n.src =
|
|
1728
|
+
n.decoding = "async", n.src = Co(t.id, t.thumbnail);
|
|
1906
1729
|
}
|
|
1907
1730
|
g("tierlist", "Warming posters", { count: e.items.length });
|
|
1908
1731
|
}
|
|
1909
1732
|
}
|
|
1910
|
-
function
|
|
1911
|
-
const e = u.getState(), t =
|
|
1733
|
+
function No() {
|
|
1734
|
+
const e = u.getState(), t = pn(Object.values(e.roster).map((r) => r.sprite), void 0, Ke);
|
|
1912
1735
|
if (!t)
|
|
1913
|
-
return
|
|
1736
|
+
return R("socket", "sprite_taken: no available sprites to retry with"), null;
|
|
1914
1737
|
const n = !!e.name && !se(e.name), a = n ? e.name : ve(t);
|
|
1915
1738
|
return g("socket", "sprite_taken: retrying with a free character", { from: e.sprite, to: t, name: a, keptCustomName: n }), e.setSessionIdentity(a, t), { name: a, sprite: t };
|
|
1916
1739
|
}
|
|
1917
|
-
function
|
|
1740
|
+
function jo(e) {
|
|
1918
1741
|
const t = u.getState(), n = e ? t.roster[e] : void 0;
|
|
1919
1742
|
return !n || !!n.sprite && n.sprite === t.sprite;
|
|
1920
1743
|
}
|
|
1921
|
-
const
|
|
1922
|
-
function
|
|
1923
|
-
const t =
|
|
1744
|
+
const Po = "hadoku:name";
|
|
1745
|
+
function Ro(e) {
|
|
1746
|
+
const t = Ua(e);
|
|
1924
1747
|
return Ye(t) ? t : null;
|
|
1925
1748
|
}
|
|
1926
|
-
async function
|
|
1927
|
-
const t = await
|
|
1749
|
+
async function Mo(e = {}) {
|
|
1750
|
+
const t = await Ha({
|
|
1928
1751
|
...e,
|
|
1929
|
-
onError: (a) =>
|
|
1752
|
+
onError: (a) => R("avatar", "Avatar settings read failed — keeping the auto-assigned character", xe(a))
|
|
1930
1753
|
}), n = Ye(t) ? t : null;
|
|
1931
1754
|
return g("avatar", "Requested character from prefs-api", { sprite: n }), n;
|
|
1932
1755
|
}
|
|
1933
|
-
function
|
|
1756
|
+
function Qt(e) {
|
|
1934
1757
|
if (!e) return !1;
|
|
1935
1758
|
const t = u.getState();
|
|
1936
1759
|
if (t.sprite === e) return !1;
|
|
1937
1760
|
const a = !!(t.me.clientId && t.roster[t.me.clientId]?.registryName) || !t.name || !se(t.name) ? t.name : ve(e);
|
|
1938
1761
|
return t.setSessionIdentity(a, e), !0;
|
|
1939
1762
|
}
|
|
1940
|
-
function
|
|
1763
|
+
function Do(e, t, n) {
|
|
1941
1764
|
if (!n) return () => {
|
|
1942
1765
|
};
|
|
1943
|
-
const a = (
|
|
1944
|
-
const
|
|
1945
|
-
!
|
|
1766
|
+
const a = (r) => {
|
|
1767
|
+
const o = r.detail;
|
|
1768
|
+
!o || typeof o != "object" || t(o);
|
|
1946
1769
|
};
|
|
1947
1770
|
return n.addEventListener(e, a), () => n.removeEventListener(e, a);
|
|
1948
1771
|
}
|
|
1949
|
-
const
|
|
1950
|
-
function
|
|
1951
|
-
return
|
|
1772
|
+
const Lo = () => typeof window > "u" ? void 0 : window;
|
|
1773
|
+
function Oo(e, t = Lo()) {
|
|
1774
|
+
return Do(Po, (n) => {
|
|
1952
1775
|
typeof n.name == "string" && n.name.trim() && e(n.name);
|
|
1953
1776
|
}, t);
|
|
1954
1777
|
}
|
|
1955
|
-
const
|
|
1956
|
-
function
|
|
1778
|
+
const Ho = 10;
|
|
1779
|
+
function Uo(e = typeof window < "u" ? window : void 0) {
|
|
1957
1780
|
if (!e) return { framed: !1, depth: 0 };
|
|
1958
1781
|
try {
|
|
1959
1782
|
let t = 0, n = e;
|
|
1960
|
-
for (; n !== n.parent && t <
|
|
1783
|
+
for (; n !== n.parent && t < Ho; )
|
|
1961
1784
|
t++, n = n.parent;
|
|
1962
1785
|
return { framed: e.top ? e.top !== e.self : t > 0, depth: t };
|
|
1963
1786
|
} catch {
|
|
1964
1787
|
return { framed: !1, depth: 0 };
|
|
1965
1788
|
}
|
|
1966
1789
|
}
|
|
1967
|
-
const
|
|
1968
|
-
function
|
|
1790
|
+
const Fo = "watchparty_fragment_delivery";
|
|
1791
|
+
function $o() {
|
|
1969
1792
|
if (typeof window > "u") return null;
|
|
1970
1793
|
try {
|
|
1971
1794
|
const e = new URLSearchParams(window.location.search).get("fragmentDelivery");
|
|
@@ -1973,93 +1796,93 @@ function ff() {
|
|
|
1973
1796
|
if (e === "0" || e === "false") return !1;
|
|
1974
1797
|
} catch {
|
|
1975
1798
|
}
|
|
1976
|
-
return
|
|
1799
|
+
return Lr(Fo);
|
|
1977
1800
|
}
|
|
1978
|
-
let
|
|
1979
|
-
const
|
|
1980
|
-
function
|
|
1981
|
-
const e = B(
|
|
1801
|
+
let qo = { ...En }, at = null;
|
|
1802
|
+
const Zt = "watchparty_delivery_client_id";
|
|
1803
|
+
function zo() {
|
|
1804
|
+
const e = B(Zt);
|
|
1982
1805
|
if (e) return e;
|
|
1983
1806
|
const t = globalThis.crypto?.randomUUID?.() ?? `d${Math.random().toString(36).slice(2)}`;
|
|
1984
|
-
return Ze(
|
|
1807
|
+
return Ze(Zt, t) ? t : "";
|
|
1985
1808
|
}
|
|
1986
|
-
function
|
|
1987
|
-
return at === null && (at =
|
|
1809
|
+
function Bo() {
|
|
1810
|
+
return at === null && (at = mr(qo, zo(), $o())), at;
|
|
1988
1811
|
}
|
|
1989
|
-
function
|
|
1990
|
-
return
|
|
1812
|
+
function Wo() {
|
|
1813
|
+
return Bo();
|
|
1991
1814
|
}
|
|
1992
|
-
let
|
|
1993
|
-
function
|
|
1994
|
-
return B(
|
|
1815
|
+
let Ue;
|
|
1816
|
+
function fa() {
|
|
1817
|
+
return B(Oa) || void 0;
|
|
1995
1818
|
}
|
|
1996
|
-
function
|
|
1997
|
-
if (
|
|
1998
|
-
const e =
|
|
1819
|
+
function Go() {
|
|
1820
|
+
if (Ue) return;
|
|
1821
|
+
const e = fa();
|
|
1999
1822
|
if (e) {
|
|
2000
|
-
|
|
1823
|
+
Ue = e;
|
|
2001
1824
|
return;
|
|
2002
1825
|
}
|
|
2003
|
-
|
|
2004
|
-
t && (
|
|
1826
|
+
La().then((t) => {
|
|
1827
|
+
t && (Ue = t);
|
|
2005
1828
|
}).catch(() => {
|
|
2006
1829
|
g("identity", "device id unavailable — joining without one");
|
|
2007
1830
|
});
|
|
2008
1831
|
}
|
|
2009
|
-
function
|
|
2010
|
-
return
|
|
1832
|
+
function Vo() {
|
|
1833
|
+
return Ue ??= fa();
|
|
2011
1834
|
}
|
|
2012
|
-
function
|
|
1835
|
+
function Ko(e, t) {
|
|
2013
1836
|
let n = 0;
|
|
2014
1837
|
for (const a of e.videos) {
|
|
2015
|
-
const
|
|
2016
|
-
globalThis.localStorage?.getItem(
|
|
1838
|
+
const r = ae.voteKey(t, e.id, a.mediaId);
|
|
1839
|
+
globalThis.localStorage?.getItem(r) != null && n++, ze(r);
|
|
2017
1840
|
}
|
|
2018
1841
|
return n;
|
|
2019
1842
|
}
|
|
2020
|
-
const
|
|
2021
|
-
function
|
|
1843
|
+
const Yo = 2e4, Jo = 1e4;
|
|
1844
|
+
function Xo() {
|
|
2022
1845
|
return { unansweredSince: null, lastPongAt: null, lastTickAt: null };
|
|
2023
1846
|
}
|
|
2024
|
-
function
|
|
1847
|
+
function Qo(e, t) {
|
|
2025
1848
|
e.lastPongAt = t, e.unansweredSince = null;
|
|
2026
1849
|
}
|
|
2027
|
-
function
|
|
2028
|
-
const a = e.lastTickAt !== null && t - e.lastTickAt >
|
|
2029
|
-
return e.lastTickAt = t, n ? a || e.unansweredSince === null ? (e.unansweredSince = t, !1) : t - e.unansweredSince >
|
|
1850
|
+
function Zo(e, t, n) {
|
|
1851
|
+
const a = e.lastTickAt !== null && t - e.lastTickAt > Jo;
|
|
1852
|
+
return e.lastTickAt = t, n ? a || e.unansweredSince === null ? (e.unansweredSince = t, !1) : t - e.unansweredSince > Yo : (e.unansweredSince = null, !1);
|
|
2030
1853
|
}
|
|
2031
|
-
function
|
|
1854
|
+
function ef(e, t) {
|
|
2032
1855
|
return e.lastPongAt === null ? void 0 : Math.max(0, t - e.lastPongAt);
|
|
2033
1856
|
}
|
|
2034
|
-
let
|
|
2035
|
-
const
|
|
2036
|
-
let je = null, rt = null,
|
|
2037
|
-
function
|
|
1857
|
+
let x = null, W = null, Fe = null, V = null, Z = null;
|
|
1858
|
+
const tf = rf(), de = Xo();
|
|
1859
|
+
let je = null, rt = null, en = 0, It = null, ke = !1, Et = !1, ge = !1, ia = null;
|
|
1860
|
+
function nf(e) {
|
|
2038
1861
|
const t = re(), n = u.getState();
|
|
2039
1862
|
if (n.me.clientId && n.roster[n.me.clientId])
|
|
2040
1863
|
return (e.name || e.sprite) && (g("socket", "Identity update (already joined)", { name: e.name, sprite: e.sprite }), t.emit(_.IDENTITY_UPDATE, { name: e.name, sprite: e.sprite })), t;
|
|
2041
|
-
const a =
|
|
2042
|
-
return Z = a,
|
|
1864
|
+
const a = af(e);
|
|
1865
|
+
return Z = a, It = { name: a.name, sprite: a.sprite }, Se() && ko(a), t.connected ? (g("socket", "Emitting join", a), t.emit(_.JOIN, a)) : t.once("connect", () => {
|
|
2043
1866
|
g("socket", "Emitting join", a), t.emit(_.JOIN, a);
|
|
2044
1867
|
}), t;
|
|
2045
1868
|
}
|
|
2046
|
-
function
|
|
1869
|
+
function af(e) {
|
|
2047
1870
|
return {
|
|
2048
1871
|
room_key: e.room_key,
|
|
2049
1872
|
name: e.name,
|
|
2050
1873
|
sprite: e.sprite,
|
|
2051
1874
|
// Entry-path telemetry — see lib/embedContext.ts. Sent on every join AND
|
|
2052
1875
|
// rejoin (lastJoinPayload carries it), so a reconnect keeps the attribution.
|
|
2053
|
-
embed:
|
|
2054
|
-
delivery_arm:
|
|
1876
|
+
embed: Uo(),
|
|
1877
|
+
delivery_arm: Wo(),
|
|
2055
1878
|
// Identity tier input — see lib/deviceId.ts. Sent on every join AND rejoin
|
|
2056
1879
|
// (lastJoinPayload carries it) so a reconnect lands on the same
|
|
2057
1880
|
// ParticipantId rather than minting a new person.
|
|
2058
|
-
device_id:
|
|
2059
|
-
tab_id:
|
|
1881
|
+
device_id: Vo(),
|
|
1882
|
+
tab_id: tf
|
|
2060
1883
|
};
|
|
2061
1884
|
}
|
|
2062
|
-
function
|
|
1885
|
+
function rf() {
|
|
2063
1886
|
const e = globalThis.crypto;
|
|
2064
1887
|
if (e && typeof e.randomUUID == "function") return e.randomUUID();
|
|
2065
1888
|
const t = new Uint8Array(16);
|
|
@@ -2068,74 +1891,74 @@ function xf() {
|
|
|
2068
1891
|
return Array.from(t, (n) => n.toString(16).padStart(2, "0")).join("");
|
|
2069
1892
|
}
|
|
2070
1893
|
function re() {
|
|
2071
|
-
if (!
|
|
1894
|
+
if (!x) {
|
|
2072
1895
|
let t = _e().serverOrigin || "/";
|
|
2073
1896
|
if (t === "/" && typeof window < "u") {
|
|
2074
1897
|
const a = window.location;
|
|
2075
|
-
(a.hostname === "localhost" || a.hostname === "127.0.0.1") && a.port === String(
|
|
1898
|
+
(a.hostname === "localhost" || a.hostname === "127.0.0.1") && a.port === String(wn) && (t = `${a.protocol}//${a.hostname}:${bt}`, g("socket", "Using dev fallback origin", { origin: t }));
|
|
2076
1899
|
}
|
|
2077
|
-
const n =
|
|
1900
|
+
const n = So();
|
|
2078
1901
|
if (n)
|
|
2079
|
-
|
|
1902
|
+
x = ct(n.url, { path: n.path, transports: ["websocket", "polling"] }), g("socket", "Socket initialized on the room origin", n);
|
|
2080
1903
|
else {
|
|
2081
1904
|
const a = new URL(t.startsWith("http") ? t : `${window.location.origin}${t}`).origin;
|
|
2082
|
-
|
|
1905
|
+
x = ct(a, { path: za, transports: ["websocket", "polling"] }), g("socket", "Socket initialized", { origin: t });
|
|
2083
1906
|
}
|
|
2084
|
-
et("__SOCKET__",
|
|
2085
|
-
if (
|
|
2086
|
-
|
|
2087
|
-
sid:
|
|
2088
|
-
lastPongAgeMs:
|
|
2089
|
-
}), rt = "pong-watchdog", de.unansweredSince = null,
|
|
1907
|
+
et("__SOCKET__", x), V && (clearTimeout(V), V = null), W = null, Fe = setInterval(() => {
|
|
1908
|
+
if (Zo(de, Date.now(), !!x?.connected)) {
|
|
1909
|
+
R("socket", "PONG-WATCHDOG no time_pong for 20s — replacing the connection", {
|
|
1910
|
+
sid: x?.id,
|
|
1911
|
+
lastPongAgeMs: ef(de, Date.now()) ?? null
|
|
1912
|
+
}), rt = "pong-watchdog", de.unansweredSince = null, x?.io.engine?.close();
|
|
2090
1913
|
return;
|
|
2091
1914
|
}
|
|
2092
|
-
|
|
2093
|
-
},
|
|
2094
|
-
|
|
2095
|
-
const a =
|
|
1915
|
+
yf();
|
|
1916
|
+
}, sr), x.on("connect", () => {
|
|
1917
|
+
Et = !1;
|
|
1918
|
+
const a = x?.id;
|
|
2096
1919
|
if (g("socket", "Connected", { id: a, isReconnect: ge }), a)
|
|
2097
1920
|
try {
|
|
2098
|
-
u.getState().ensureMe(a), u.setState((
|
|
2099
|
-
} catch (
|
|
2100
|
-
Oe("socket", "Failed to initialize store on connect", { error:
|
|
1921
|
+
u.getState().ensureMe(a), u.setState((r) => ({ me: { ...r.me, nextClientSeq: 1 } })), g("socket", "Reset client sequence for new connection");
|
|
1922
|
+
} catch (r) {
|
|
1923
|
+
Oe("socket", "Failed to initialize store on connect", { error: r.message, sid: a });
|
|
2101
1924
|
}
|
|
2102
1925
|
if (ge && Z) {
|
|
2103
|
-
const
|
|
2104
|
-
|
|
2105
|
-
const
|
|
1926
|
+
const r = u.getState();
|
|
1927
|
+
en += 1;
|
|
1928
|
+
const o = {
|
|
2106
1929
|
...Z,
|
|
2107
|
-
name:
|
|
2108
|
-
sprite:
|
|
1930
|
+
name: r.name,
|
|
1931
|
+
sprite: r.sprite,
|
|
2109
1932
|
reconnect: {
|
|
2110
|
-
count:
|
|
1933
|
+
count: en,
|
|
2111
1934
|
reason: (je?.reason ?? "unknown").slice(0, 64),
|
|
2112
1935
|
offline_ms: je ? Math.max(0, Date.now() - je.at) : 0
|
|
2113
1936
|
}
|
|
2114
|
-
}, i =
|
|
2115
|
-
if (g("socket", "Re-emitting join after reconnect", { room_key:
|
|
1937
|
+
}, i = ia;
|
|
1938
|
+
if (g("socket", "Re-emitting join after reconnect", { room_key: o.room_key, name: o.name, sprite: o.sprite }), i) {
|
|
2116
1939
|
let s = !1;
|
|
2117
1940
|
const c = () => {
|
|
2118
|
-
s || (s = !0,
|
|
1941
|
+
s || (s = !0, x.off(_.SNAPSHOT, c), x.emit(_.CLIENT_READY, { media_id: i }), g("socket", "Re-emitted client_ready after reconnect snapshot", { mediaId: i }));
|
|
2119
1942
|
};
|
|
2120
|
-
|
|
2121
|
-
s || (s = !0,
|
|
1943
|
+
x.on(_.SNAPSHOT, c), setTimeout(() => {
|
|
1944
|
+
s || (s = !0, x.off(_.SNAPSHOT, c), R("socket", "client_ready re-emit timed out waiting for snapshot", { mediaId: i }));
|
|
2122
1945
|
}, 1e4);
|
|
2123
1946
|
}
|
|
2124
|
-
|
|
2125
|
-
} else ge &&
|
|
1947
|
+
It = { name: o.name, sprite: o.sprite }, x.emit(_.JOIN, o), window.dispatchEvent(new CustomEvent("watchparty:socket-reconnect"));
|
|
1948
|
+
} else ge && R("socket", "Reconnected — no join payload, not re-joining any room");
|
|
2126
1949
|
ge = !0;
|
|
2127
|
-
}),
|
|
2128
|
-
|
|
2129
|
-
}),
|
|
1950
|
+
}), x.on("disconnect", (a) => {
|
|
1951
|
+
zn(null), je = { reason: rt ?? a, at: Date.now() }, rt = null, g("socket", "Disconnected", { reason: a });
|
|
1952
|
+
}), x.on("connect_error", (a) => Oe("socket", "Connection error", { message: a?.message })), x.on("reconnect_attempt", (a) => R("socket", "Reconnect attempt", { attempt: a })), x.on("reconnect_failed", () => Oe("socket", "Reconnect failed")), gf(x);
|
|
2130
1953
|
}
|
|
2131
|
-
return
|
|
1954
|
+
return x;
|
|
2132
1955
|
}
|
|
2133
1956
|
function ot(e) {
|
|
2134
1957
|
return e.play_state === "playing" || e.playing === !0;
|
|
2135
1958
|
}
|
|
2136
|
-
function
|
|
1959
|
+
function of(e) {
|
|
2137
1960
|
e.on(_.SNAPSHOT, (t) => {
|
|
2138
|
-
e.emit(
|
|
1961
|
+
e.emit(In.SYNC), u.getState().applySnapshot({
|
|
2139
1962
|
roomId: t.room_id ?? null,
|
|
2140
1963
|
mediaId: t.media_id ?? null,
|
|
2141
1964
|
playheadMs: t.playhead_ms || 0,
|
|
@@ -2143,9 +1966,9 @@ function Tf(e) {
|
|
|
2143
1966
|
serverSeq: t.server_seq || 0,
|
|
2144
1967
|
leaderId: t.leader_id || null
|
|
2145
1968
|
}), u.getState().name || g("socket", "Deferring identity to presence event (snapshot carries no roster)");
|
|
2146
|
-
const n = u.getState(), a =
|
|
1969
|
+
const n = u.getState(), a = x?.id, o = (a ? n.roster[a] : void 0) ?? It, i = Ma(
|
|
2147
1970
|
{ name: n.name, avatarId: n.sprite },
|
|
2148
|
-
|
|
1971
|
+
o ? { name: o.name, avatarId: o.sprite ?? null } : void 0,
|
|
2149
1972
|
// A join that carried no name counts as a default one, so a name that
|
|
2150
1973
|
// landed after the join (prefs) is still asserted.
|
|
2151
1974
|
(s) => s === "" || se(s)
|
|
@@ -2153,7 +1976,7 @@ function Tf(e) {
|
|
|
2153
1976
|
if (i) {
|
|
2154
1977
|
const s = {
|
|
2155
1978
|
...i.name !== void 0 ? { name: i.name } : {},
|
|
2156
|
-
...i.avatarId !== void 0 && !
|
|
1979
|
+
...i.avatarId !== void 0 && !Et ? { sprite: i.avatarId } : {}
|
|
2157
1980
|
};
|
|
2158
1981
|
Object.keys(s).length > 0 && (g("socket", "Identity update on snapshot", s), e.emit(_.IDENTITY_UPDATE, s));
|
|
2159
1982
|
}
|
|
@@ -2164,7 +1987,7 @@ function Tf(e) {
|
|
|
2164
1987
|
leaderId: t.leader_id || null,
|
|
2165
1988
|
serverSeq: t.server_seq || 0,
|
|
2166
1989
|
rosterSize: Object.keys(n.roster).length
|
|
2167
|
-
}), Z?.room_key &&
|
|
1990
|
+
}), Z?.room_key && x?.id && zn({ room_key: Z.room_key, client_id: x.id });
|
|
2168
1991
|
}), e.on(_.CONTROL_BROADCAST, (t) => {
|
|
2169
1992
|
const n = u.getState();
|
|
2170
1993
|
if (Object.prototype.hasOwnProperty.call(t, "media_id")) {
|
|
@@ -2186,21 +2009,21 @@ function Tf(e) {
|
|
|
2186
2009
|
}), e.on(_.CONTROL_ACK, (t) => {
|
|
2187
2010
|
typeof t?.client_seq == "number" && typeof t?.server_seq == "number" && g("socket", "Control ack received", t);
|
|
2188
2011
|
}), e.on(_.TIME_PONG, (t) => {
|
|
2189
|
-
if (
|
|
2012
|
+
if (Qo(de, Date.now()), W && W.ts) {
|
|
2190
2013
|
const n = Date.now() - W.ts;
|
|
2191
2014
|
u.getState().addRttSample(n, t?.server_ts, W.ts), W = null, V && (clearTimeout(V), V = null), g("socket", "Time sync RTT", { rtt: n, offset: u.getState().drift.offsetMs });
|
|
2192
2015
|
}
|
|
2193
2016
|
}), e.on(_.READY_STATE, (t) => {
|
|
2194
2017
|
if (!t) return;
|
|
2195
|
-
const n = t.media_id ?? null, a = typeof t.ready_count == "number" ? t.ready_count : 0,
|
|
2196
|
-
u.getState().setReadiness({ mediaId: n, ready:
|
|
2018
|
+
const n = t.media_id ?? null, a = typeof t.ready_count == "number" ? t.ready_count : 0, r = typeof t.total == "number" ? t.total : 0, o = t.ready === !0;
|
|
2019
|
+
u.getState().setReadiness({ mediaId: n, ready: o, readyCount: a, total: r }), g("socket", "Ready state received", { mediaId: n, readyCount: a, total: r, ready: o });
|
|
2197
2020
|
});
|
|
2198
2021
|
}
|
|
2199
|
-
function
|
|
2200
|
-
const t =
|
|
2022
|
+
function ff(e) {
|
|
2023
|
+
const t = Ia(e);
|
|
2201
2024
|
return t ? { cosmetics: t } : {};
|
|
2202
2025
|
}
|
|
2203
|
-
function
|
|
2026
|
+
function sf(e) {
|
|
2204
2027
|
e.on(_.PRESENCE, (t) => {
|
|
2205
2028
|
if (!t) return;
|
|
2206
2029
|
if (Array.isArray(t.users)) {
|
|
@@ -2214,16 +2037,16 @@ function If(e) {
|
|
|
2214
2037
|
isLeader: s.is_leader,
|
|
2215
2038
|
...s.registry_name ? { registryName: !0 } : {},
|
|
2216
2039
|
...s.avatar_url ? { avatarUrl: s.avatar_url } : {},
|
|
2217
|
-
...
|
|
2040
|
+
...ff(s.cosmetics)
|
|
2218
2041
|
};
|
|
2219
|
-
const
|
|
2042
|
+
const r = u.getState(), o = x?.id, i = o ? a[o] : void 0;
|
|
2220
2043
|
if (i?.registryName)
|
|
2221
|
-
u.setState({ roster: a }), (i.name !==
|
|
2222
|
-
else if (
|
|
2223
|
-
const s = a[
|
|
2224
|
-
if (
|
|
2225
|
-
const b =
|
|
2226
|
-
g("socket", "Server reassigned sprite", { from:
|
|
2044
|
+
u.setState({ roster: a }), (i.name !== r.name || i.sprite && i.sprite !== r.sprite) && (g("socket", "Adopting registry name", { from: r.name, to: i.name }), u.getState().setSessionIdentity(i.name, i.sprite ?? r.sprite));
|
|
2045
|
+
else if (o && a[o]) {
|
|
2046
|
+
const s = a[o].name, c = a[o].sprite;
|
|
2047
|
+
if (r.name && !se(r.name) && (a[o].name = r.name), u.setState({ roster: a }), c && c !== r.sprite) {
|
|
2048
|
+
const b = r.name && !se(r.name), p = b ? r.name : ve(c);
|
|
2049
|
+
g("socket", "Server reassigned sprite", { from: r.sprite, to: c, newName: p, preservingCustomName: b }), u.getState().setSessionIdentity(p, c), p !== s && e.emit(_.IDENTITY_UPDATE, { name: p });
|
|
2227
2050
|
}
|
|
2228
2051
|
}
|
|
2229
2052
|
}
|
|
@@ -2236,7 +2059,7 @@ function If(e) {
|
|
|
2236
2059
|
}
|
|
2237
2060
|
});
|
|
2238
2061
|
}
|
|
2239
|
-
function
|
|
2062
|
+
function lf(e) {
|
|
2240
2063
|
e.on(Ie.STATE, (t) => {
|
|
2241
2064
|
u.getState().applyPlaylistState({
|
|
2242
2065
|
playlist: t?.playlist ?? null,
|
|
@@ -2249,61 +2072,61 @@ function Ef(e) {
|
|
|
2249
2072
|
u.getState().setPlaylistResults(t ?? null), g("playlist", "Results received", { playlistId: t?.playlist?.id, update: t?.update === !0 });
|
|
2250
2073
|
}), e.on(Ie.VOTES_CLEARED, (t) => {
|
|
2251
2074
|
if (!t?.playlistId || !Array.isArray(t.mediaIds)) return;
|
|
2252
|
-
const n =
|
|
2253
|
-
{ id: t.playlistId, videos: t.mediaIds.map((
|
|
2254
|
-
|
|
2075
|
+
const n = Ko(
|
|
2076
|
+
{ id: t.playlistId, videos: t.mediaIds.map((r) => ({ mediaId: r })) },
|
|
2077
|
+
oo()
|
|
2255
2078
|
), a = u.getState();
|
|
2256
2079
|
a.playlist?.id === t.playlistId && a.applyPlaylistState({ playlist: a.playlist, activeIndex: a.activePlaylistIndex, myVotes: {} }), g("playlist", "Votes cleared by leader", { playlistId: t.playlistId, removed: n });
|
|
2257
2080
|
});
|
|
2258
2081
|
}
|
|
2259
|
-
function
|
|
2260
|
-
e.on(
|
|
2261
|
-
g("tierlist", "Someone saved — refreshing the board"),
|
|
2082
|
+
function cf(e) {
|
|
2083
|
+
e.on(nr.UPDATED, () => {
|
|
2084
|
+
g("tierlist", "Someone saved — refreshing the board"), Eo(!1);
|
|
2262
2085
|
});
|
|
2263
2086
|
}
|
|
2264
|
-
function
|
|
2265
|
-
e.on(
|
|
2087
|
+
function df(e) {
|
|
2088
|
+
e.on(ar.STATE, (t) => {
|
|
2266
2089
|
if (!t || typeof t.active != "boolean") return;
|
|
2267
2090
|
const n = Array.isArray(t.ready) ? t.ready.filter((a) => typeof a == "string") : [];
|
|
2268
2091
|
u.getState().setReadyCheckState({ active: t.active, ready: n }), g("ready-check", "State received", { active: t.active, readyCount: n.length });
|
|
2269
2092
|
});
|
|
2270
2093
|
}
|
|
2271
|
-
function
|
|
2272
|
-
e.on(
|
|
2094
|
+
function uf(e) {
|
|
2095
|
+
e.on(In.ACTIVE, (t) => {
|
|
2273
2096
|
const n = typeof t?.gameId == "string" ? t.gameId : null;
|
|
2274
2097
|
u.getState().setActiveGameId(n), g("game", "game_active", { gameId: n });
|
|
2275
2098
|
});
|
|
2276
2099
|
}
|
|
2277
|
-
function
|
|
2100
|
+
function mf(e) {
|
|
2278
2101
|
e.on(_.HEALTH_SNAPSHOT, (t) => {
|
|
2279
2102
|
u.getState().setHealthSnapshot(t);
|
|
2280
2103
|
}), e.on(_.BUFFER_STATUS, (t) => {
|
|
2281
2104
|
u.getState().setBufferStatus(t);
|
|
2282
2105
|
});
|
|
2283
2106
|
}
|
|
2284
|
-
function
|
|
2285
|
-
|
|
2107
|
+
function gf(e) {
|
|
2108
|
+
of(e), sf(e), ra(e, () => !Se()), mf(e), lf(e), cf(e), df(e), uf(e), e.on(_.ERROR, (t) => {
|
|
2286
2109
|
const n = t?.code || "error/unknown";
|
|
2287
2110
|
if (n === "conflict" && t?.message === "sprite_held_by_you") {
|
|
2288
|
-
|
|
2111
|
+
Et = !0, g("socket", "sprite held by this account's other connection: keeping the server-assigned sprite");
|
|
2289
2112
|
return;
|
|
2290
2113
|
}
|
|
2291
2114
|
if (n === "conflict" && t?.message === "sprite_taken") {
|
|
2292
|
-
if (
|
|
2115
|
+
if (jo(x?.id)) {
|
|
2293
2116
|
g("socket", "sprite_taken: stale, the server already has our sprite");
|
|
2294
2117
|
return;
|
|
2295
2118
|
}
|
|
2296
2119
|
ke = !0;
|
|
2297
2120
|
let i;
|
|
2298
2121
|
try {
|
|
2299
|
-
i =
|
|
2122
|
+
i = No();
|
|
2300
2123
|
} finally {
|
|
2301
2124
|
ke = !1;
|
|
2302
2125
|
}
|
|
2303
2126
|
i && e.emit(_.IDENTITY_UPDATE, i);
|
|
2304
2127
|
return;
|
|
2305
2128
|
}
|
|
2306
|
-
const
|
|
2129
|
+
const r = {
|
|
2307
2130
|
"control/forbidden": "You are not the leader.",
|
|
2308
2131
|
"control/stale_seq": "Stale control sequence.",
|
|
2309
2132
|
"control/seq_gap": "Control sequence gap detected.",
|
|
@@ -2321,75 +2144,75 @@ function Pf(e) {
|
|
|
2321
2144
|
"recap/not_found": "No recap available for the previous episode."
|
|
2322
2145
|
}[n] || n;
|
|
2323
2146
|
if (n.startsWith("recap/")) {
|
|
2324
|
-
g("socket", `recap unavailable: ${
|
|
2147
|
+
g("socket", `recap unavailable: ${r}`, { code: n }), u.getState().pushToast("info", r);
|
|
2325
2148
|
return;
|
|
2326
2149
|
}
|
|
2327
|
-
(n.startsWith("auth/") ?
|
|
2150
|
+
(n.startsWith("auth/") ? R : Oe)("socket", `Server error: ${r}`, { code: n, raw: t }), u.getState().pushToast("error", r);
|
|
2328
2151
|
});
|
|
2329
2152
|
}
|
|
2330
|
-
function
|
|
2153
|
+
function pf(e, t, n) {
|
|
2331
2154
|
const a = {
|
|
2332
2155
|
text: e,
|
|
2333
2156
|
...t?.length ? { images: t } : {},
|
|
2334
2157
|
...n ? { reply_to: n } : {}
|
|
2335
2158
|
};
|
|
2336
|
-
|
|
2159
|
+
Se() ? _o(a) : re().emit(_.CHAT_SEND, a);
|
|
2337
2160
|
}
|
|
2338
|
-
function
|
|
2161
|
+
function hf(e, t, n) {
|
|
2339
2162
|
const a = { id: e, emoji: t, on: n };
|
|
2340
|
-
|
|
2163
|
+
Se() ? ta(_.CHAT_REACT, a) : re().emit(_.CHAT_REACT, a);
|
|
2341
2164
|
}
|
|
2342
|
-
function
|
|
2165
|
+
function bf(e) {
|
|
2343
2166
|
const t = { typing: e };
|
|
2344
|
-
|
|
2167
|
+
Se() ? ta(_.CHAT_TYPING, t) : x?.connected && x.emit(_.CHAT_TYPING, t);
|
|
2345
2168
|
}
|
|
2346
|
-
function
|
|
2169
|
+
function yf() {
|
|
2347
2170
|
W || (W = { ts: Date.now() }, re().emit(_.TIME_PING, {}), V = setTimeout(() => {
|
|
2348
2171
|
W && (g("socket", "Time ping timed out after 10s, clearing inflight"), W = null), V = null;
|
|
2349
2172
|
}, 1e4));
|
|
2350
2173
|
}
|
|
2351
|
-
function
|
|
2174
|
+
function sa(e) {
|
|
2352
2175
|
const t = u.getState(), n = t.me.clientId;
|
|
2353
2176
|
if (!n || !t.roster[n]) {
|
|
2354
|
-
|
|
2177
|
+
Qt(e), g("socket", "Avatar change before join: the join will carry it", { sprite: e });
|
|
2355
2178
|
return;
|
|
2356
2179
|
}
|
|
2357
2180
|
ke = !0;
|
|
2358
2181
|
try {
|
|
2359
|
-
|
|
2182
|
+
Qt(e);
|
|
2360
2183
|
} finally {
|
|
2361
2184
|
ke = !1;
|
|
2362
2185
|
}
|
|
2363
|
-
const a = u.getState(),
|
|
2364
|
-
a.sprite && a.sprite !== t.sprite && (
|
|
2186
|
+
const a = u.getState(), r = { avatar: !0 };
|
|
2187
|
+
a.sprite && a.sprite !== t.sprite && (r.sprite = a.sprite), a.name && a.name !== t.name && (r.name = a.name), g("socket", "Sending avatar change", r), re().emit(_.IDENTITY_UPDATE, r);
|
|
2365
2188
|
}
|
|
2366
|
-
function
|
|
2367
|
-
u.getState().me.clientId &&
|
|
2189
|
+
function wf(e) {
|
|
2190
|
+
u.getState().me.clientId && vf(e);
|
|
2368
2191
|
}
|
|
2369
|
-
function
|
|
2192
|
+
function vf(e, t) {
|
|
2370
2193
|
const n = {};
|
|
2371
2194
|
e && (n.name = e), !(!n.name && !n.sprite) && (g("socket", "Sending identity update", n), re().emit(_.IDENTITY_UPDATE, n));
|
|
2372
2195
|
}
|
|
2373
|
-
let
|
|
2196
|
+
let Pe = { name: "", sprite: "" };
|
|
2374
2197
|
u.subscribe((e, t) => {
|
|
2375
2198
|
if (e.name === t.name && e.sprite === t.sprite || ke) return;
|
|
2376
2199
|
const n = e.me.clientId;
|
|
2377
2200
|
if (!n) return;
|
|
2378
2201
|
const a = e.roster[n];
|
|
2379
2202
|
if (!a) return;
|
|
2380
|
-
const
|
|
2381
|
-
if (!
|
|
2203
|
+
const r = !!e.name && !se(e.name) && e.name !== Pe.name && (se(a.name || "") || a.name !== e.name), o = !!e.sprite && e.sprite !== Pe.sprite && a.sprite !== e.sprite;
|
|
2204
|
+
if (!r && !o) return;
|
|
2382
2205
|
const i = {};
|
|
2383
|
-
|
|
2206
|
+
r && (i.name = e.name, Pe.name = e.name), o && (i.sprite = e.sprite, Pe.sprite = e.sprite), g("socket", "Identity reassert (store change)", i), x?.connected ? x.emit(_.IDENTITY_UPDATE, i) : re().emit(_.IDENTITY_UPDATE, i);
|
|
2384
2207
|
});
|
|
2385
|
-
function
|
|
2208
|
+
function kf() {
|
|
2386
2209
|
Fe && (clearInterval(Fe), Fe = null), V && (clearTimeout(V), V = null), W = null, de.unansweredSince = null, de.lastTickAt = null;
|
|
2387
2210
|
}
|
|
2388
|
-
function
|
|
2389
|
-
g("socket", "clearJoinState called", { hadPayload: Z !== null, room_key: Z?.room_key }), Z = null, ge = !1,
|
|
2211
|
+
function _f() {
|
|
2212
|
+
g("socket", "clearJoinState called", { hadPayload: Z !== null, room_key: Z?.room_key }), Z = null, ge = !1, ia = null;
|
|
2390
2213
|
}
|
|
2391
|
-
function
|
|
2392
|
-
g("socket", "leaveRoom called", { room_key: Z?.room_key }),
|
|
2214
|
+
function tn() {
|
|
2215
|
+
g("socket", "leaveRoom called", { room_key: Z?.room_key }), _f(), kf(), na(), x && (x.disconnect(), x = null), u.setState({
|
|
2393
2216
|
me: { clientId: null, nextClientSeq: 1 },
|
|
2394
2217
|
roster: {},
|
|
2395
2218
|
snapshot: { roomId: null, mediaId: null, playheadMs: 0, playing: !1, serverSeq: 0, leaderId: null },
|
|
@@ -2407,31 +2230,31 @@ function rn() {
|
|
|
2407
2230
|
activeGameId: null
|
|
2408
2231
|
});
|
|
2409
2232
|
}
|
|
2410
|
-
function
|
|
2233
|
+
function xf() {
|
|
2411
2234
|
g("chat", "Emitting recap_request"), re().emit("recap_request");
|
|
2412
2235
|
}
|
|
2413
|
-
function
|
|
2236
|
+
function Sf() {
|
|
2414
2237
|
A(() => {
|
|
2415
|
-
const e =
|
|
2416
|
-
const
|
|
2417
|
-
g("avatar", "Avatar changed in the settings popout", { sprite:
|
|
2418
|
-
}), n =
|
|
2419
|
-
g("avatar", "Renamed in the settings popout", { name: a }),
|
|
2238
|
+
const e = $a(), t = Fa((a, r) => {
|
|
2239
|
+
const o = Ro(r);
|
|
2240
|
+
g("avatar", "Avatar changed in the settings popout", { sprite: o, source: r.avatar?.source }), sa(o);
|
|
2241
|
+
}), n = Oo((a) => {
|
|
2242
|
+
g("avatar", "Renamed in the settings popout", { name: a }), wf(a);
|
|
2420
2243
|
});
|
|
2421
2244
|
return () => {
|
|
2422
2245
|
t(), n(), e();
|
|
2423
2246
|
};
|
|
2424
2247
|
}, []);
|
|
2425
2248
|
}
|
|
2426
|
-
function
|
|
2427
|
-
return (t ?
|
|
2249
|
+
function Tf(e, t) {
|
|
2250
|
+
return (t ? Na(t) : null) ?? Wn(e);
|
|
2428
2251
|
}
|
|
2429
2252
|
function Te(e, t) {
|
|
2430
2253
|
return A(() => {
|
|
2431
|
-
t &&
|
|
2432
|
-
}, [t]),
|
|
2254
|
+
t && Ea(t);
|
|
2255
|
+
}, [t]), dn(Aa, () => Tf(e, t), () => Wn(e));
|
|
2433
2256
|
}
|
|
2434
|
-
function
|
|
2257
|
+
function Cf(e, t) {
|
|
2435
2258
|
if (t.clientId) {
|
|
2436
2259
|
const n = e[t.clientId];
|
|
2437
2260
|
if (n && (!t.author || !n.author || n.author === t.author)) return n;
|
|
@@ -2440,8 +2263,8 @@ function Wf(e, t) {
|
|
|
2440
2263
|
for (const n of Object.values(e)) if (n.author === t.author) return n;
|
|
2441
2264
|
}
|
|
2442
2265
|
}
|
|
2443
|
-
function
|
|
2444
|
-
const a =
|
|
2266
|
+
function If(e, t, n) {
|
|
2267
|
+
const a = Cf(e, t);
|
|
2445
2268
|
return a ? {
|
|
2446
2269
|
name: a.name || n.name,
|
|
2447
2270
|
// A connection briefly without a character (a reconnect waiting for one to
|
|
@@ -2452,14 +2275,14 @@ function Gf(e, t, n) {
|
|
|
2452
2275
|
here: !0
|
|
2453
2276
|
} : { name: n.name, sprite: n.sprite, pictureUrl: n.pictureUrl, here: !1 };
|
|
2454
2277
|
}
|
|
2455
|
-
function
|
|
2278
|
+
function Ef(e, t, n) {
|
|
2456
2279
|
return !t || !n.here ? e : t.split(yt).join(n.name);
|
|
2457
2280
|
}
|
|
2458
2281
|
function tt(e, t) {
|
|
2459
|
-
const n = u((a) => JSON.stringify(
|
|
2282
|
+
const n = u((a) => JSON.stringify(If(a.roster, e, t)));
|
|
2460
2283
|
return G(() => JSON.parse(n), [n]);
|
|
2461
2284
|
}
|
|
2462
|
-
function
|
|
2285
|
+
function At({ sprite: e, url: t, alt: n = "", className: a, style: r, fallback: o }) {
|
|
2463
2286
|
const [i, s] = E(null);
|
|
2464
2287
|
if (t && t !== i)
|
|
2465
2288
|
return /* @__PURE__ */ l(
|
|
@@ -2469,18 +2292,18 @@ function Nt({ sprite: e, url: t, alt: n = "", className: a, style: o, fallback:
|
|
|
2469
2292
|
alt: n,
|
|
2470
2293
|
referrerPolicy: "no-referrer",
|
|
2471
2294
|
className: a,
|
|
2472
|
-
style:
|
|
2295
|
+
style: r,
|
|
2473
2296
|
draggable: !1,
|
|
2474
2297
|
onError: () => s(t)
|
|
2475
2298
|
}
|
|
2476
2299
|
);
|
|
2477
|
-
const c =
|
|
2478
|
-
return c ? /* @__PURE__ */ l("img", { src: c, alt: n, crossOrigin: "anonymous", className: a, style:
|
|
2300
|
+
const c = fo(e);
|
|
2301
|
+
return c ? /* @__PURE__ */ l("img", { src: c, alt: n, crossOrigin: "anonymous", className: a, style: r, draggable: !1 }) : /* @__PURE__ */ l(ee, { children: o });
|
|
2479
2302
|
}
|
|
2480
|
-
function
|
|
2303
|
+
function la({ sprite: e, url: t, alt: n, worn: a }) {
|
|
2481
2304
|
return /* @__PURE__ */ y("span", { className: "hc-av", style: { "--hc-sz": "32px" }, children: [
|
|
2482
2305
|
/* @__PURE__ */ l("span", { className: "hc-pic", children: /* @__PURE__ */ l(
|
|
2483
|
-
|
|
2306
|
+
At,
|
|
2484
2307
|
{
|
|
2485
2308
|
sprite: e,
|
|
2486
2309
|
url: t,
|
|
@@ -2489,21 +2312,21 @@ function pa({ sprite: e, url: t, alt: n, worn: a }) {
|
|
|
2489
2312
|
fallback: /* @__PURE__ */ l("span", { className: "inline-block w-8 h-8 bg-bg-alt/50 rounded-full flex-shrink-0" })
|
|
2490
2313
|
}
|
|
2491
2314
|
) }),
|
|
2492
|
-
a?.overlay && /* @__PURE__ */ l(ye, { html:
|
|
2315
|
+
a?.overlay && /* @__PURE__ */ l(ye, { html: ja(a), style: { display: "contents" } })
|
|
2493
2316
|
] });
|
|
2494
2317
|
}
|
|
2495
|
-
function
|
|
2318
|
+
function Af(e) {
|
|
2496
2319
|
return !(e.button !== 0 || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey);
|
|
2497
2320
|
}
|
|
2498
|
-
function
|
|
2321
|
+
function Nf({ src: e, title: t, onClose: n }) {
|
|
2499
2322
|
A(() => {
|
|
2500
|
-
const
|
|
2323
|
+
const o = (i) => {
|
|
2501
2324
|
Xe(i) && (i.stopPropagation(), n());
|
|
2502
2325
|
};
|
|
2503
|
-
return document.addEventListener("keydown",
|
|
2326
|
+
return document.addEventListener("keydown", o, !0), () => document.removeEventListener("keydown", o, !0);
|
|
2504
2327
|
}, [n]);
|
|
2505
|
-
const a =
|
|
2506
|
-
return
|
|
2328
|
+
const a = Ln(), r = typeof document > "u" ? null : document.fullscreenElement ?? a ?? document.body;
|
|
2329
|
+
return r ? hn(
|
|
2507
2330
|
/* @__PURE__ */ y(
|
|
2508
2331
|
"div",
|
|
2509
2332
|
{
|
|
@@ -2519,7 +2342,7 @@ function Yf({ src: e, title: t, onClose: n }) {
|
|
|
2519
2342
|
{
|
|
2520
2343
|
src: e,
|
|
2521
2344
|
alt: t ?? "",
|
|
2522
|
-
onClick: (
|
|
2345
|
+
onClick: (o) => o.stopPropagation(),
|
|
2523
2346
|
className: "max-h-full max-w-full rounded object-contain shadow-2xl",
|
|
2524
2347
|
"data-testid": "chat-image-lightbox-img"
|
|
2525
2348
|
}
|
|
@@ -2538,14 +2361,14 @@ function Yf({ src: e, title: t, onClose: n }) {
|
|
|
2538
2361
|
]
|
|
2539
2362
|
}
|
|
2540
2363
|
),
|
|
2541
|
-
|
|
2364
|
+
r
|
|
2542
2365
|
) : null;
|
|
2543
2366
|
}
|
|
2544
|
-
const ft = 240,
|
|
2545
|
-
function
|
|
2367
|
+
const ft = 240, jf = 320;
|
|
2368
|
+
function Pf({ image: e }) {
|
|
2546
2369
|
const [t, n] = E(!1), a = qe(e.key);
|
|
2547
2370
|
if (!a) return null;
|
|
2548
|
-
const
|
|
2371
|
+
const r = e.w > 0 && e.h > 0, o = r ? Math.min(1, jf / e.w, ft / e.h) : 1;
|
|
2549
2372
|
return /* @__PURE__ */ y(ee, { children: [
|
|
2550
2373
|
/* @__PURE__ */ l(
|
|
2551
2374
|
"a",
|
|
@@ -2556,7 +2379,7 @@ function Xf({ image: e }) {
|
|
|
2556
2379
|
className: "block max-w-full cursor-zoom-in",
|
|
2557
2380
|
"data-testid": "chat-image",
|
|
2558
2381
|
onClick: (i) => {
|
|
2559
|
-
|
|
2382
|
+
Af(i) && (i.preventDefault(), n(!0));
|
|
2560
2383
|
},
|
|
2561
2384
|
children: /* @__PURE__ */ l(
|
|
2562
2385
|
"img",
|
|
@@ -2565,16 +2388,16 @@ function Xf({ image: e }) {
|
|
|
2565
2388
|
alt: e.title ?? "",
|
|
2566
2389
|
loading: "lazy",
|
|
2567
2390
|
decoding: "async",
|
|
2568
|
-
width:
|
|
2569
|
-
height:
|
|
2391
|
+
width: r ? Math.round(e.w * o) : void 0,
|
|
2392
|
+
height: r ? Math.round(e.h * o) : void 0,
|
|
2570
2393
|
className: "rounded border border-border-light object-contain bg-bg-alt/30",
|
|
2571
|
-
style:
|
|
2394
|
+
style: r ? { aspectRatio: `${e.w} / ${e.h}`, maxWidth: "100%", maxHeight: ft } : { maxWidth: "100%", maxHeight: ft }
|
|
2572
2395
|
}
|
|
2573
2396
|
)
|
|
2574
2397
|
}
|
|
2575
2398
|
),
|
|
2576
2399
|
t && /* @__PURE__ */ l(
|
|
2577
|
-
|
|
2400
|
+
Nf,
|
|
2578
2401
|
{
|
|
2579
2402
|
src: a,
|
|
2580
2403
|
title: e.title,
|
|
@@ -2583,13 +2406,13 @@ function Xf({ image: e }) {
|
|
|
2583
2406
|
)
|
|
2584
2407
|
] });
|
|
2585
2408
|
}
|
|
2586
|
-
function
|
|
2587
|
-
return e?.length ? /* @__PURE__ */ l("div", { className: "flex flex-wrap gap-1 mt-1", "data-testid": "chat-images", children: e.map((t, n) => /* @__PURE__ */ l(
|
|
2409
|
+
function ca({ images: e }) {
|
|
2410
|
+
return e?.length ? /* @__PURE__ */ l("div", { className: "flex flex-wrap gap-1 mt-1", "data-testid": "chat-images", children: e.map((t, n) => /* @__PURE__ */ l(Pf, { image: t }, `${t.key}-${n}`)) }) : null;
|
|
2588
2411
|
}
|
|
2589
|
-
function
|
|
2412
|
+
function Rf(e, t) {
|
|
2590
2413
|
return e.author && t.author ? e.author === t.author : !!t.clientId && e.clientId === t.clientId;
|
|
2591
2414
|
}
|
|
2592
|
-
const
|
|
2415
|
+
const Mf = [
|
|
2593
2416
|
{ id: "smileys", label: "Smileys & Emotion", data: "1f600:grinning face|1f603:grinning face with big eyes|1f604:grinning face with smiling eyes|1f601:beaming face with smiling eyes|1f606:grinning squinting face|1f605:grinning face with sweat|1f923:rolling on the floor laughing|1f602:face with tears of joy|1f642:slightly smiling face|1f643:upside-down face|1fae0:melting face|1f609:winking face|1f60a:smiling face with smiling eyes|1f607:smiling face with halo|1f970:smiling face with hearts|1f60d:smiling face with heart-eyes|1f929:star-struck|1f618:face blowing a kiss|1f617:kissing face|263a-fe0f:smiling face|1f61a:kissing face with closed eyes|1f619:kissing face with smiling eyes|1f972:smiling face with tear|1f60b:face savoring food|1f61b:face with tongue|1f61c:winking face with tongue|1f92a:zany face|1f61d:squinting face with tongue|1f911:money-mouth face|1f917:smiling face with open hands|1f92d:face with hand over mouth|1fae2:face with open eyes and hand over mouth|1fae3:face with peeking eye|1f92b:shushing face|1f914:thinking face|1fae1:saluting face|1f910:zipper-mouth face|1f928:face with raised eyebrow|1f610:neutral face|1f611:expressionless face|1f636:face without mouth|1fae5:dotted line face|1f636-200d-1f32b-fe0f:face in clouds|1f60f:smirking face|1f612:unamused face|1f644:face with rolling eyes|1f62c:grimacing face|1f62e-200d-1f4a8:face exhaling|1f925:lying face|1fae8:shaking face|1f60c:relieved face|1f614:pensive face|1f62a:sleepy face|1f924:drooling face|1f634:sleeping face|1f637:face with medical mask|1f912:face with thermometer|1f915:face with head-bandage|1f922:nauseated face|1f92e:face vomiting|1f927:sneezing face|1f975:hot face|1f976:cold face|1f974:woozy face|1f635:face with crossed-out eyes|1f635-200d-1f4ab:face with spiral eyes|1f92f:exploding head|1f920:cowboy hat face|1f973:partying face|1f978:disguised face|1f60e:smiling face with sunglasses|1f913:nerd face|1f9d0:face with monocle|1f615:confused face|1fae4:face with diagonal mouth|1f61f:worried face|1f641:slightly frowning face|2639-fe0f:frowning face|1f62e:face with open mouth|1f62f:hushed face|1f632:astonished face|1f633:flushed face|1f97a:pleading face|1f979:face holding back tears|1f626:frowning face with open mouth|1f627:anguished face|1f628:fearful face|1f630:anxious face with sweat|1f625:sad but relieved face|1f622:crying face|1f62d:loudly crying face|1f631:face screaming in fear|1f616:confounded face|1f623:persevering face|1f61e:disappointed face|1f613:downcast face with sweat|1f629:weary face|1f62b:tired face|1f971:yawning face|1f624:face with steam from nose|1f621:enraged face|1f620:angry face|1f92c:face with symbols on mouth|1f608:smiling face with horns|1f47f:angry face with horns|1f480:skull|2620-fe0f:skull and crossbones|1f4a9:pile of poo|1f921:clown face|1f479:ogre|1f47a:goblin|1f47b:ghost|1f47d:alien|1f47e:alien monster|1f916:robot|1f63a:grinning cat|1f638:grinning cat with smiling eyes|1f639:cat with tears of joy|1f63b:smiling cat with heart-eyes|1f63c:cat with wry smile|1f63d:kissing cat|1f640:weary cat|1f63f:crying cat|1f63e:pouting cat|1f648:see-no-evil monkey|1f649:hear-no-evil monkey|1f64a:speak-no-evil monkey|1f48c:love letter|1f498:heart with arrow|1f49d:heart with ribbon|1f496:sparkling heart|1f497:growing heart|1f493:beating heart|1f49e:revolving hearts|1f495:two hearts|1f49f:heart decoration|2763-fe0f:heart exclamation|1f494:broken heart|2764-fe0f-200d-1f525:heart on fire|2764-fe0f-200d-1fa79:mending heart|2764-fe0f:red heart|1fa77:pink heart|1f9e1:orange heart|1f49b:yellow heart|1f49a:green heart|1f499:blue heart|1fa75:light blue heart|1f49c:purple heart|1f90e:brown heart|1f5a4:black heart|1fa76:grey heart|1f90d:white heart|1f48b:kiss mark|1f4af:hundred points|1f4a2:anger symbol|1f4a5:collision|1f4ab:dizzy|1f4a6:sweat droplets|1f4a8:dashing away|1f573-fe0f:hole|1f4ac:speech balloon|1f441-fe0f-200d-1f5e8-fe0f:eye in speech bubble|1f5e8-fe0f:left speech bubble|1f5ef-fe0f:right anger bubble|1f4ad:thought balloon|1f4a4:zzz" },
|
|
2594
2417
|
{ id: "people", label: "People & Body", data: "1f44b:waving hand|1f91a:raised back of hand|1f590-fe0f:hand with fingers splayed|270b:raised hand|1f596:vulcan salute|1faf1:rightwards hand|1faf2:leftwards hand|1faf3:palm down hand|1faf4:palm up hand|1faf7:leftwards pushing hand|1faf8:rightwards pushing hand|1f44c:ok hand|1f90c:pinched fingers|1f90f:pinching hand|270c-fe0f:victory hand|1f91e:crossed fingers|1faf0:hand with index finger and thumb crossed|1f91f:love-you gesture|1f918:sign of the horns|1f919:call me hand|1f448:backhand index pointing left|1f449:backhand index pointing right|1f446:backhand index pointing up|1f595:middle finger|1f447:backhand index pointing down|261d-fe0f:index pointing up|1faf5:index pointing at the viewer|1f44d:thumbs up|1f44e:thumbs down|270a:raised fist|1f44a:oncoming fist|1f91b:left-facing fist|1f91c:right-facing fist|1f44f:clapping hands|1f64c:raising hands|1faf6:heart hands|1f450:open hands|1f932:palms up together|1f91d:handshake|1f64f:folded hands|270d-fe0f:writing hand|1f485:nail polish|1f933:selfie|1f4aa:flexed biceps|1f9be:mechanical arm|1f9bf:mechanical leg|1f9b5:leg|1f9b6:foot|1f442:ear|1f9bb:ear with hearing aid|1f443:nose|1f9e0:brain|1fac0:anatomical heart|1fac1:lungs|1f9b7:tooth|1f9b4:bone|1f440:eyes|1f441-fe0f:eye|1f445:tongue|1f444:mouth|1fae6:biting lip|1f476:baby|1f9d2:child|1f466:boy|1f467:girl|1f9d1:person|1f471:person blond hair|1f468:man|1f9d4:person beard|1f9d4-200d-2642-fe0f:man beard|1f9d4-200d-2640-fe0f:woman beard|1f468-200d-1f9b0:man red hair|1f468-200d-1f9b1:man curly hair|1f468-200d-1f9b3:man white hair|1f468-200d-1f9b2:man bald|1f469:woman|1f469-200d-1f9b0:woman red hair|1f9d1-200d-1f9b0:person red hair|1f469-200d-1f9b1:woman curly hair|1f9d1-200d-1f9b1:person curly hair|1f469-200d-1f9b3:woman white hair|1f9d1-200d-1f9b3:person white hair|1f469-200d-1f9b2:woman bald|1f9d1-200d-1f9b2:person bald|1f471-200d-2640-fe0f:woman blond hair|1f471-200d-2642-fe0f:man blond hair|1f9d3:older person|1f474:old man|1f475:old woman|1f64d:person frowning|1f64d-200d-2642-fe0f:man frowning|1f64d-200d-2640-fe0f:woman frowning|1f64e:person pouting|1f64e-200d-2642-fe0f:man pouting|1f64e-200d-2640-fe0f:woman pouting|1f645:person gesturing no|1f645-200d-2642-fe0f:man gesturing no|1f645-200d-2640-fe0f:woman gesturing no|1f646:person gesturing ok|1f646-200d-2642-fe0f:man gesturing ok|1f646-200d-2640-fe0f:woman gesturing ok|1f481:person tipping hand|1f481-200d-2642-fe0f:man tipping hand|1f481-200d-2640-fe0f:woman tipping hand|1f64b:person raising hand|1f64b-200d-2642-fe0f:man raising hand|1f64b-200d-2640-fe0f:woman raising hand|1f9cf:deaf person|1f9cf-200d-2642-fe0f:deaf man|1f9cf-200d-2640-fe0f:deaf woman|1f647:person bowing|1f647-200d-2642-fe0f:man bowing|1f647-200d-2640-fe0f:woman bowing|1f926:person facepalming|1f926-200d-2642-fe0f:man facepalming|1f926-200d-2640-fe0f:woman facepalming|1f937:person shrugging|1f937-200d-2642-fe0f:man shrugging|1f937-200d-2640-fe0f:woman shrugging|1f9d1-200d-2695-fe0f:health worker|1f468-200d-2695-fe0f:man health worker|1f469-200d-2695-fe0f:woman health worker|1f9d1-200d-1f393:student|1f468-200d-1f393:man student|1f469-200d-1f393:woman student|1f9d1-200d-1f3eb:teacher|1f468-200d-1f3eb:man teacher|1f469-200d-1f3eb:woman teacher|1f9d1-200d-2696-fe0f:judge|1f468-200d-2696-fe0f:man judge|1f469-200d-2696-fe0f:woman judge|1f9d1-200d-1f33e:farmer|1f468-200d-1f33e:man farmer|1f469-200d-1f33e:woman farmer|1f9d1-200d-1f373:cook|1f468-200d-1f373:man cook|1f469-200d-1f373:woman cook|1f9d1-200d-1f527:mechanic|1f468-200d-1f527:man mechanic|1f469-200d-1f527:woman mechanic|1f9d1-200d-1f3ed:factory worker|1f468-200d-1f3ed:man factory worker|1f469-200d-1f3ed:woman factory worker|1f9d1-200d-1f4bc:office worker|1f468-200d-1f4bc:man office worker|1f469-200d-1f4bc:woman office worker|1f9d1-200d-1f52c:scientist|1f468-200d-1f52c:man scientist|1f469-200d-1f52c:woman scientist|1f9d1-200d-1f4bb:technologist|1f468-200d-1f4bb:man technologist|1f469-200d-1f4bb:woman technologist|1f9d1-200d-1f3a4:singer|1f468-200d-1f3a4:man singer|1f469-200d-1f3a4:woman singer|1f9d1-200d-1f3a8:artist|1f468-200d-1f3a8:man artist|1f469-200d-1f3a8:woman artist|1f9d1-200d-2708-fe0f:pilot|1f468-200d-2708-fe0f:man pilot|1f469-200d-2708-fe0f:woman pilot|1f9d1-200d-1f680:astronaut|1f468-200d-1f680:man astronaut|1f469-200d-1f680:woman astronaut|1f9d1-200d-1f692:firefighter|1f468-200d-1f692:man firefighter|1f469-200d-1f692:woman firefighter|1f46e:police officer|1f46e-200d-2642-fe0f:man police officer|1f46e-200d-2640-fe0f:woman police officer|1f575-fe0f:detective|1f575-fe0f-200d-2642-fe0f:man detective|1f575-fe0f-200d-2640-fe0f:woman detective|1f482:guard|1f482-200d-2642-fe0f:man guard|1f482-200d-2640-fe0f:woman guard|1f977:ninja|1f477:construction worker|1f477-200d-2642-fe0f:man construction worker|1f477-200d-2640-fe0f:woman construction worker|1fac5:person with crown|1f934:prince|1f478:princess|1f473:person wearing turban|1f473-200d-2642-fe0f:man wearing turban|1f473-200d-2640-fe0f:woman wearing turban|1f472:person with skullcap|1f9d5:woman with headscarf|1f935:person in tuxedo|1f935-200d-2642-fe0f:man in tuxedo|1f935-200d-2640-fe0f:woman in tuxedo|1f470:person with veil|1f470-200d-2642-fe0f:man with veil|1f470-200d-2640-fe0f:woman with veil|1f930:pregnant woman|1fac3:pregnant man|1fac4:pregnant person|1f931:breast-feeding|1f469-200d-1f37c:woman feeding baby|1f468-200d-1f37c:man feeding baby|1f9d1-200d-1f37c:person feeding baby|1f47c:baby angel|1f385:santa claus|1f936:mrs. claus|1f9d1-200d-1f384:mx claus|1f9b8:superhero|1f9b8-200d-2642-fe0f:man superhero|1f9b8-200d-2640-fe0f:woman superhero|1f9b9:supervillain|1f9b9-200d-2642-fe0f:man supervillain|1f9b9-200d-2640-fe0f:woman supervillain|1f9d9:mage|1f9d9-200d-2642-fe0f:man mage|1f9d9-200d-2640-fe0f:woman mage|1f9da:fairy|1f9da-200d-2642-fe0f:man fairy|1f9da-200d-2640-fe0f:woman fairy|1f9db:vampire|1f9db-200d-2642-fe0f:man vampire|1f9db-200d-2640-fe0f:woman vampire|1f9dc:merperson|1f9dc-200d-2642-fe0f:merman|1f9dc-200d-2640-fe0f:mermaid|1f9dd:elf|1f9dd-200d-2642-fe0f:man elf|1f9dd-200d-2640-fe0f:woman elf|1f9de:genie|1f9de-200d-2642-fe0f:man genie|1f9de-200d-2640-fe0f:woman genie|1f9df:zombie|1f9df-200d-2642-fe0f:man zombie|1f9df-200d-2640-fe0f:woman zombie|1f9cc:troll|1f486:person getting massage|1f486-200d-2642-fe0f:man getting massage|1f486-200d-2640-fe0f:woman getting massage|1f487:person getting haircut|1f487-200d-2642-fe0f:man getting haircut|1f487-200d-2640-fe0f:woman getting haircut|1f6b6:person walking|1f6b6-200d-2642-fe0f:man walking|1f6b6-200d-2640-fe0f:woman walking|1f9cd:person standing|1f9cd-200d-2642-fe0f:man standing|1f9cd-200d-2640-fe0f:woman standing|1f9ce:person kneeling|1f9ce-200d-2642-fe0f:man kneeling|1f9ce-200d-2640-fe0f:woman kneeling|1f9d1-200d-1f9af:person with white cane|1f468-200d-1f9af:man with white cane|1f469-200d-1f9af:woman with white cane|1f9d1-200d-1f9bc:person in motorized wheelchair|1f468-200d-1f9bc:man in motorized wheelchair|1f469-200d-1f9bc:woman in motorized wheelchair|1f9d1-200d-1f9bd:person in manual wheelchair|1f468-200d-1f9bd:man in manual wheelchair|1f469-200d-1f9bd:woman in manual wheelchair|1f3c3:person running|1f3c3-200d-2642-fe0f:man running|1f3c3-200d-2640-fe0f:woman running|1f483:woman dancing|1f57a:man dancing|1f574-fe0f:person in suit levitating|1f46f:people with bunny ears|1f46f-200d-2642-fe0f:men with bunny ears|1f46f-200d-2640-fe0f:women with bunny ears|1f9d6:person in steamy room|1f9d6-200d-2642-fe0f:man in steamy room|1f9d6-200d-2640-fe0f:woman in steamy room|1f9d7:person climbing|1f9d7-200d-2642-fe0f:man climbing|1f9d7-200d-2640-fe0f:woman climbing|1f93a:person fencing|1f3c7:horse racing|26f7-fe0f:skier|1f3c2:snowboarder|1f3cc-fe0f:person golfing|1f3cc-fe0f-200d-2642-fe0f:man golfing|1f3cc-fe0f-200d-2640-fe0f:woman golfing|1f3c4:person surfing|1f3c4-200d-2642-fe0f:man surfing|1f3c4-200d-2640-fe0f:woman surfing|1f6a3:person rowing boat|1f6a3-200d-2642-fe0f:man rowing boat|1f6a3-200d-2640-fe0f:woman rowing boat|1f3ca:person swimming|1f3ca-200d-2642-fe0f:man swimming|1f3ca-200d-2640-fe0f:woman swimming|26f9-fe0f:person bouncing ball|26f9-fe0f-200d-2642-fe0f:man bouncing ball|26f9-fe0f-200d-2640-fe0f:woman bouncing ball|1f3cb-fe0f:person lifting weights|1f3cb-fe0f-200d-2642-fe0f:man lifting weights|1f3cb-fe0f-200d-2640-fe0f:woman lifting weights|1f6b4:person biking|1f6b4-200d-2642-fe0f:man biking|1f6b4-200d-2640-fe0f:woman biking|1f6b5:person mountain biking|1f6b5-200d-2642-fe0f:man mountain biking|1f6b5-200d-2640-fe0f:woman mountain biking|1f938:person cartwheeling|1f938-200d-2642-fe0f:man cartwheeling|1f938-200d-2640-fe0f:woman cartwheeling|1f93c:people wrestling|1f93c-200d-2642-fe0f:men wrestling|1f93c-200d-2640-fe0f:women wrestling|1f93d:person playing water polo|1f93d-200d-2642-fe0f:man playing water polo|1f93d-200d-2640-fe0f:woman playing water polo|1f93e:person playing handball|1f93e-200d-2642-fe0f:man playing handball|1f93e-200d-2640-fe0f:woman playing handball|1f939:person juggling|1f939-200d-2642-fe0f:man juggling|1f939-200d-2640-fe0f:woman juggling|1f9d8:person in lotus position|1f9d8-200d-2642-fe0f:man in lotus position|1f9d8-200d-2640-fe0f:woman in lotus position|1f6c0:person taking bath|1f6cc:person in bed|1f9d1-200d-1f91d-200d-1f9d1:people holding hands|1f46d:women holding hands|1f46b:woman and man holding hands|1f46c:men holding hands|1f48f:kiss|1f469-200d-2764-fe0f-200d-1f48b-200d-1f468:kiss woman, man|1f468-200d-2764-fe0f-200d-1f48b-200d-1f468:kiss man, man|1f469-200d-2764-fe0f-200d-1f48b-200d-1f469:kiss woman, woman|1f491:couple with heart|1f469-200d-2764-fe0f-200d-1f468:couple with heart woman, man|1f468-200d-2764-fe0f-200d-1f468:couple with heart man, man|1f469-200d-2764-fe0f-200d-1f469:couple with heart woman, woman|1f468-200d-1f469-200d-1f466:family man, woman, boy|1f468-200d-1f469-200d-1f467:family man, woman, girl|1f468-200d-1f469-200d-1f467-200d-1f466:family man, woman, girl, boy|1f468-200d-1f469-200d-1f466-200d-1f466:family man, woman, boy, boy|1f468-200d-1f469-200d-1f467-200d-1f467:family man, woman, girl, girl|1f468-200d-1f468-200d-1f466:family man, man, boy|1f468-200d-1f468-200d-1f467:family man, man, girl|1f468-200d-1f468-200d-1f467-200d-1f466:family man, man, girl, boy|1f468-200d-1f468-200d-1f466-200d-1f466:family man, man, boy, boy|1f468-200d-1f468-200d-1f467-200d-1f467:family man, man, girl, girl|1f469-200d-1f469-200d-1f466:family woman, woman, boy|1f469-200d-1f469-200d-1f467:family woman, woman, girl|1f469-200d-1f469-200d-1f467-200d-1f466:family woman, woman, girl, boy|1f469-200d-1f469-200d-1f466-200d-1f466:family woman, woman, boy, boy|1f469-200d-1f469-200d-1f467-200d-1f467:family woman, woman, girl, girl|1f468-200d-1f466:family man, boy|1f468-200d-1f466-200d-1f466:family man, boy, boy|1f468-200d-1f467:family man, girl|1f468-200d-1f467-200d-1f466:family man, girl, boy|1f468-200d-1f467-200d-1f467:family man, girl, girl|1f469-200d-1f466:family woman, boy|1f469-200d-1f466-200d-1f466:family woman, boy, boy|1f469-200d-1f467:family woman, girl|1f469-200d-1f467-200d-1f466:family woman, girl, boy|1f469-200d-1f467-200d-1f467:family woman, girl, girl|1f5e3-fe0f:speaking head|1f464:bust in silhouette|1f465:busts in silhouette|1fac2:people hugging|1f46a:family|1f463:footprints" },
|
|
2595
2418
|
{ id: "nature", label: "Animals & Nature", data: "1f435:monkey face|1f412:monkey|1f98d:gorilla|1f9a7:orangutan|1f436:dog face|1f415:dog|1f9ae:guide dog|1f415-200d-1f9ba:service dog|1f429:poodle|1f43a:wolf|1f98a:fox|1f99d:raccoon|1f431:cat face|1f408:cat|1f408-200d-2b1b:black cat|1f981:lion|1f42f:tiger face|1f405:tiger|1f406:leopard|1f434:horse face|1face:moose|1facf:donkey|1f40e:horse|1f984:unicorn|1f993:zebra|1f98c:deer|1f9ac:bison|1f42e:cow face|1f402:ox|1f403:water buffalo|1f404:cow|1f437:pig face|1f416:pig|1f417:boar|1f43d:pig nose|1f40f:ram|1f411:ewe|1f410:goat|1f42a:camel|1f42b:two-hump camel|1f999:llama|1f992:giraffe|1f418:elephant|1f9a3:mammoth|1f98f:rhinoceros|1f99b:hippopotamus|1f42d:mouse face|1f401:mouse|1f400:rat|1f439:hamster|1f430:rabbit face|1f407:rabbit|1f43f-fe0f:chipmunk|1f9ab:beaver|1f994:hedgehog|1f987:bat|1f43b:bear|1f43b-200d-2744-fe0f:polar bear|1f428:koala|1f43c:panda|1f9a5:sloth|1f9a6:otter|1f9a8:skunk|1f998:kangaroo|1f9a1:badger|1f43e:paw prints|1f983:turkey|1f414:chicken|1f413:rooster|1f423:hatching chick|1f424:baby chick|1f425:front-facing baby chick|1f426:bird|1f427:penguin|1f54a-fe0f:dove|1f985:eagle|1f986:duck|1f9a2:swan|1f989:owl|1f9a4:dodo|1fab6:feather|1f9a9:flamingo|1f99a:peacock|1f99c:parrot|1fabd:wing|1f426-200d-2b1b:black bird|1fabf:goose|1f438:frog|1f40a:crocodile|1f422:turtle|1f98e:lizard|1f40d:snake|1f432:dragon face|1f409:dragon|1f995:sauropod|1f996:t-rex|1f433:spouting whale|1f40b:whale|1f42c:dolphin|1f9ad:seal|1f41f:fish|1f420:tropical fish|1f421:blowfish|1f988:shark|1f419:octopus|1f41a:spiral shell|1fab8:coral|1fabc:jellyfish|1f980:crab|1f99e:lobster|1f990:shrimp|1f991:squid|1f9aa:oyster|1f40c:snail|1f98b:butterfly|1f41b:bug|1f41c:ant|1f41d:honeybee|1fab2:beetle|1f41e:lady beetle|1f997:cricket|1fab3:cockroach|1f577-fe0f:spider|1f578-fe0f:spider web|1f982:scorpion|1f99f:mosquito|1fab0:fly|1fab1:worm|1f9a0:microbe|1f490:bouquet|1f338:cherry blossom|1f4ae:white flower|1fab7:lotus|1f3f5-fe0f:rosette|1f339:rose|1f940:wilted flower|1f33a:hibiscus|1f33b:sunflower|1f33c:blossom|1f337:tulip|1fabb:hyacinth|1f331:seedling|1fab4:potted plant|1f332:evergreen tree|1f333:deciduous tree|1f334:palm tree|1f335:cactus|1f33e:sheaf of rice|1f33f:herb|2618-fe0f:shamrock|1f340:four leaf clover|1f341:maple leaf|1f342:fallen leaf|1f343:leaf fluttering in wind|1fab9:empty nest|1faba:nest with eggs|1f344:mushroom" },
|
|
@@ -2600,19 +2423,19 @@ const Zf = [
|
|
|
2600
2423
|
{ id: "symbols", label: "Symbols", data: "1f3e7:atm sign|1f6ae:litter in bin sign|1f6b0:potable water|267f:wheelchair symbol|1f6b9:men’s room|1f6ba:women’s room|1f6bb:restroom|1f6bc:baby symbol|1f6be:water closet|1f6c2:passport control|1f6c3:customs|1f6c4:baggage claim|1f6c5:left luggage|26a0-fe0f:warning|1f6b8:children crossing|26d4:no entry|1f6ab:prohibited|1f6b3:no bicycles|1f6ad:no smoking|1f6af:no littering|1f6b1:non-potable water|1f6b7:no pedestrians|1f4f5:no mobile phones|1f51e:no one under eighteen|2622-fe0f:radioactive|2623-fe0f:biohazard|2b06-fe0f:up arrow|2197-fe0f:up-right arrow|27a1-fe0f:right arrow|2198-fe0f:down-right arrow|2b07-fe0f:down arrow|2199-fe0f:down-left arrow|2b05-fe0f:left arrow|2196-fe0f:up-left arrow|2195-fe0f:up-down arrow|2194-fe0f:left-right arrow|21a9-fe0f:right arrow curving left|21aa-fe0f:left arrow curving right|2934-fe0f:right arrow curving up|2935-fe0f:right arrow curving down|1f503:clockwise vertical arrows|1f504:counterclockwise arrows button|1f519:back arrow|1f51a:end arrow|1f51b:on! arrow|1f51c:soon arrow|1f51d:top arrow|1f6d0:place of worship|269b-fe0f:atom symbol|1f549-fe0f:om|2721-fe0f:star of david|2638-fe0f:wheel of dharma|262f-fe0f:yin yang|271d-fe0f:latin cross|2626-fe0f:orthodox cross|262a-fe0f:star and crescent|262e-fe0f:peace symbol|1f54e:menorah|1f52f:dotted six-pointed star|1faaf:khanda|2648:aries|2649:taurus|264a:gemini|264b:cancer|264c:leo|264d:virgo|264e:libra|264f:scorpio|2650:sagittarius|2651:capricorn|2652:aquarius|2653:pisces|26ce:ophiuchus|1f500:shuffle tracks button|1f501:repeat button|1f502:repeat single button|25b6-fe0f:play button|23e9:fast-forward button|23ed-fe0f:next track button|23ef-fe0f:play or pause button|25c0-fe0f:reverse button|23ea:fast reverse button|23ee-fe0f:last track button|1f53c:upwards button|23eb:fast up button|1f53d:downwards button|23ec:fast down button|23f8-fe0f:pause button|23f9-fe0f:stop button|23fa-fe0f:record button|23cf-fe0f:eject button|1f3a6:cinema|1f505:dim button|1f506:bright button|1f4f6:antenna bars|1f6dc:wireless|1f4f3:vibration mode|1f4f4:mobile phone off|2640-fe0f:female sign|2642-fe0f:male sign|26a7-fe0f:transgender symbol|2716-fe0f:multiply|2795:plus|2796:minus|2797:divide|1f7f0:heavy equals sign|267e-fe0f:infinity|203c-fe0f:double exclamation mark|2049-fe0f:exclamation question mark|2753:red question mark|2754:white question mark|2755:white exclamation mark|2757:red exclamation mark|3030-fe0f:wavy dash|1f4b1:currency exchange|1f4b2:heavy dollar sign|2695-fe0f:medical symbol|267b-fe0f:recycling symbol|269c-fe0f:fleur-de-lis|1f531:trident emblem|1f4db:name badge|1f530:japanese symbol for beginner|2b55:hollow red circle|2705:check mark button|2611-fe0f:check box with check|2714-fe0f:check mark|274c:cross mark|274e:cross mark button|27b0:curly loop|27bf:double curly loop|303d-fe0f:part alternation mark|2733-fe0f:eight-spoked asterisk|2734-fe0f:eight-pointed star|2747-fe0f:sparkle|00a9-fe0f:copyright|00ae-fe0f:registered|2122-fe0f:trade mark|0023-fe0f-20e3:keycap #|002a-fe0f-20e3:keycap *|0030-fe0f-20e3:keycap 0|0031-fe0f-20e3:keycap 1|0032-fe0f-20e3:keycap 2|0033-fe0f-20e3:keycap 3|0034-fe0f-20e3:keycap 4|0035-fe0f-20e3:keycap 5|0036-fe0f-20e3:keycap 6|0037-fe0f-20e3:keycap 7|0038-fe0f-20e3:keycap 8|0039-fe0f-20e3:keycap 9|1f51f:keycap 10|1f520:input latin uppercase|1f521:input latin lowercase|1f522:input numbers|1f523:input symbols|1f524:input latin letters|1f170-fe0f:a button (blood type)|1f18e:ab button (blood type)|1f171-fe0f:b button (blood type)|1f191:cl button|1f192:cool button|1f193:free button|2139-fe0f:information|1f194:id button|24c2-fe0f:circled m|1f195:new button|1f196:ng button|1f17e-fe0f:o button (blood type)|1f197:ok button|1f17f-fe0f:p button|1f198:sos button|1f199:up! button|1f19a:vs button|1f201:japanese “here” button|1f202-fe0f:japanese “service charge” button|1f237-fe0f:japanese “monthly amount” button|1f236:japanese “not free of charge” button|1f22f:japanese “reserved” button|1f250:japanese “bargain” button|1f239:japanese “discount” button|1f21a:japanese “free of charge” button|1f232:japanese “prohibited” button|1f251:japanese “acceptable” button|1f238:japanese “application” button|1f234:japanese “passing grade” button|1f233:japanese “vacancy” button|3297-fe0f:japanese “congratulations” button|3299-fe0f:japanese “secret” button|1f23a:japanese “open for business” button|1f235:japanese “no vacancy” button|1f534:red circle|1f7e0:orange circle|1f7e1:yellow circle|1f7e2:green circle|1f535:blue circle|1f7e3:purple circle|1f7e4:brown circle|26ab:black circle|26aa:white circle|1f7e5:red square|1f7e7:orange square|1f7e8:yellow square|1f7e9:green square|1f7e6:blue square|1f7ea:purple square|1f7eb:brown square|2b1b:black large square|2b1c:white large square|25fc-fe0f:black medium square|25fb-fe0f:white medium square|25fe:black medium-small square|25fd:white medium-small square|25aa-fe0f:black small square|25ab-fe0f:white small square|1f536:large orange diamond|1f537:large blue diamond|1f538:small orange diamond|1f539:small blue diamond|1f53a:red triangle pointed up|1f53b:red triangle pointed down|1f4a0:diamond with a dot|1f518:radio button|1f533:white square button|1f532:black square button" },
|
|
2601
2424
|
{ id: "flags", label: "Flags", data: "1f3c1:chequered flag|1f6a9:triangular flag|1f38c:crossed flags|1f3f4:black flag|1f3f3-fe0f:white flag|1f3f3-fe0f-200d-1f308:rainbow flag|1f3f3-fe0f-200d-26a7-fe0f:transgender flag|1f3f4-200d-2620-fe0f:pirate flag|1f1e6-1f1e8:flag ascension island|1f1e6-1f1e9:flag andorra|1f1e6-1f1ea:flag united arab emirates|1f1e6-1f1eb:flag afghanistan|1f1e6-1f1ec:flag antigua & barbuda|1f1e6-1f1ee:flag anguilla|1f1e6-1f1f1:flag albania|1f1e6-1f1f2:flag armenia|1f1e6-1f1f4:flag angola|1f1e6-1f1f6:flag antarctica|1f1e6-1f1f7:flag argentina|1f1e6-1f1f8:flag american samoa|1f1e6-1f1f9:flag austria|1f1e6-1f1fa:flag australia|1f1e6-1f1fc:flag aruba|1f1e6-1f1fd:flag åland islands|1f1e6-1f1ff:flag azerbaijan|1f1e7-1f1e6:flag bosnia & herzegovina|1f1e7-1f1e7:flag barbados|1f1e7-1f1e9:flag bangladesh|1f1e7-1f1ea:flag belgium|1f1e7-1f1eb:flag burkina faso|1f1e7-1f1ec:flag bulgaria|1f1e7-1f1ed:flag bahrain|1f1e7-1f1ee:flag burundi|1f1e7-1f1ef:flag benin|1f1e7-1f1f1:flag st. barthélemy|1f1e7-1f1f2:flag bermuda|1f1e7-1f1f3:flag brunei|1f1e7-1f1f4:flag bolivia|1f1e7-1f1f6:flag caribbean netherlands|1f1e7-1f1f7:flag brazil|1f1e7-1f1f8:flag bahamas|1f1e7-1f1f9:flag bhutan|1f1e7-1f1fb:flag bouvet island|1f1e7-1f1fc:flag botswana|1f1e7-1f1fe:flag belarus|1f1e7-1f1ff:flag belize|1f1e8-1f1e6:flag canada|1f1e8-1f1e8:flag cocos (keeling) islands|1f1e8-1f1e9:flag congo - kinshasa|1f1e8-1f1eb:flag central african republic|1f1e8-1f1ec:flag congo - brazzaville|1f1e8-1f1ed:flag switzerland|1f1e8-1f1ee:flag côte d’ivoire|1f1e8-1f1f0:flag cook islands|1f1e8-1f1f1:flag chile|1f1e8-1f1f2:flag cameroon|1f1e8-1f1f3:flag china|1f1e8-1f1f4:flag colombia|1f1e8-1f1f5:flag clipperton island|1f1e8-1f1f7:flag costa rica|1f1e8-1f1fa:flag cuba|1f1e8-1f1fb:flag cape verde|1f1e8-1f1fc:flag curaçao|1f1e8-1f1fd:flag christmas island|1f1e8-1f1fe:flag cyprus|1f1e8-1f1ff:flag czechia|1f1e9-1f1ea:flag germany|1f1e9-1f1ec:flag diego garcia|1f1e9-1f1ef:flag djibouti|1f1e9-1f1f0:flag denmark|1f1e9-1f1f2:flag dominica|1f1e9-1f1f4:flag dominican republic|1f1e9-1f1ff:flag algeria|1f1ea-1f1e6:flag ceuta & melilla|1f1ea-1f1e8:flag ecuador|1f1ea-1f1ea:flag estonia|1f1ea-1f1ec:flag egypt|1f1ea-1f1ed:flag western sahara|1f1ea-1f1f7:flag eritrea|1f1ea-1f1f8:flag spain|1f1ea-1f1f9:flag ethiopia|1f1ea-1f1fa:flag european union|1f1eb-1f1ee:flag finland|1f1eb-1f1ef:flag fiji|1f1eb-1f1f0:flag falkland islands|1f1eb-1f1f2:flag micronesia|1f1eb-1f1f4:flag faroe islands|1f1eb-1f1f7:flag france|1f1ec-1f1e6:flag gabon|1f1ec-1f1e7:flag united kingdom|1f1ec-1f1e9:flag grenada|1f1ec-1f1ea:flag georgia|1f1ec-1f1eb:flag french guiana|1f1ec-1f1ec:flag guernsey|1f1ec-1f1ed:flag ghana|1f1ec-1f1ee:flag gibraltar|1f1ec-1f1f1:flag greenland|1f1ec-1f1f2:flag gambia|1f1ec-1f1f3:flag guinea|1f1ec-1f1f5:flag guadeloupe|1f1ec-1f1f6:flag equatorial guinea|1f1ec-1f1f7:flag greece|1f1ec-1f1f8:flag south georgia & south sandwich islands|1f1ec-1f1f9:flag guatemala|1f1ec-1f1fa:flag guam|1f1ec-1f1fc:flag guinea-bissau|1f1ec-1f1fe:flag guyana|1f1ed-1f1f0:flag hong kong sar china|1f1ed-1f1f2:flag heard island & mcdonald islands|1f1ed-1f1f3:flag honduras|1f1ed-1f1f7:flag croatia|1f1ed-1f1f9:flag haiti|1f1ed-1f1fa:flag hungary|1f1ee-1f1e8:flag canary islands|1f1ee-1f1e9:flag indonesia|1f1ee-1f1ea:flag ireland|1f1ee-1f1f1:flag israel|1f1ee-1f1f2:flag isle of man|1f1ee-1f1f3:flag india|1f1ee-1f1f4:flag british indian ocean territory|1f1ee-1f1f6:flag iraq|1f1ee-1f1f7:flag iran|1f1ee-1f1f8:flag iceland|1f1ee-1f1f9:flag italy|1f1ef-1f1ea:flag jersey|1f1ef-1f1f2:flag jamaica|1f1ef-1f1f4:flag jordan|1f1ef-1f1f5:flag japan|1f1f0-1f1ea:flag kenya|1f1f0-1f1ec:flag kyrgyzstan|1f1f0-1f1ed:flag cambodia|1f1f0-1f1ee:flag kiribati|1f1f0-1f1f2:flag comoros|1f1f0-1f1f3:flag st. kitts & nevis|1f1f0-1f1f5:flag north korea|1f1f0-1f1f7:flag south korea|1f1f0-1f1fc:flag kuwait|1f1f0-1f1fe:flag cayman islands|1f1f0-1f1ff:flag kazakhstan|1f1f1-1f1e6:flag laos|1f1f1-1f1e7:flag lebanon|1f1f1-1f1e8:flag st. lucia|1f1f1-1f1ee:flag liechtenstein|1f1f1-1f1f0:flag sri lanka|1f1f1-1f1f7:flag liberia|1f1f1-1f1f8:flag lesotho|1f1f1-1f1f9:flag lithuania|1f1f1-1f1fa:flag luxembourg|1f1f1-1f1fb:flag latvia|1f1f1-1f1fe:flag libya|1f1f2-1f1e6:flag morocco|1f1f2-1f1e8:flag monaco|1f1f2-1f1e9:flag moldova|1f1f2-1f1ea:flag montenegro|1f1f2-1f1eb:flag st. martin|1f1f2-1f1ec:flag madagascar|1f1f2-1f1ed:flag marshall islands|1f1f2-1f1f0:flag north macedonia|1f1f2-1f1f1:flag mali|1f1f2-1f1f2:flag myanmar (burma)|1f1f2-1f1f3:flag mongolia|1f1f2-1f1f4:flag macao sar china|1f1f2-1f1f5:flag northern mariana islands|1f1f2-1f1f6:flag martinique|1f1f2-1f1f7:flag mauritania|1f1f2-1f1f8:flag montserrat|1f1f2-1f1f9:flag malta|1f1f2-1f1fa:flag mauritius|1f1f2-1f1fb:flag maldives|1f1f2-1f1fc:flag malawi|1f1f2-1f1fd:flag mexico|1f1f2-1f1fe:flag malaysia|1f1f2-1f1ff:flag mozambique|1f1f3-1f1e6:flag namibia|1f1f3-1f1e8:flag new caledonia|1f1f3-1f1ea:flag niger|1f1f3-1f1eb:flag norfolk island|1f1f3-1f1ec:flag nigeria|1f1f3-1f1ee:flag nicaragua|1f1f3-1f1f1:flag netherlands|1f1f3-1f1f4:flag norway|1f1f3-1f1f5:flag nepal|1f1f3-1f1f7:flag nauru|1f1f3-1f1fa:flag niue|1f1f3-1f1ff:flag new zealand|1f1f4-1f1f2:flag oman|1f1f5-1f1e6:flag panama|1f1f5-1f1ea:flag peru|1f1f5-1f1eb:flag french polynesia|1f1f5-1f1ec:flag papua new guinea|1f1f5-1f1ed:flag philippines|1f1f5-1f1f0:flag pakistan|1f1f5-1f1f1:flag poland|1f1f5-1f1f2:flag st. pierre & miquelon|1f1f5-1f1f3:flag pitcairn islands|1f1f5-1f1f7:flag puerto rico|1f1f5-1f1f8:flag palestinian territories|1f1f5-1f1f9:flag portugal|1f1f5-1f1fc:flag palau|1f1f5-1f1fe:flag paraguay|1f1f6-1f1e6:flag qatar|1f1f7-1f1ea:flag réunion|1f1f7-1f1f4:flag romania|1f1f7-1f1f8:flag serbia|1f1f7-1f1fa:flag russia|1f1f7-1f1fc:flag rwanda|1f1f8-1f1e6:flag saudi arabia|1f1f8-1f1e7:flag solomon islands|1f1f8-1f1e8:flag seychelles|1f1f8-1f1e9:flag sudan|1f1f8-1f1ea:flag sweden|1f1f8-1f1ec:flag singapore|1f1f8-1f1ed:flag st. helena, ascension & tristan da cunha|1f1f8-1f1ee:flag slovenia|1f1f8-1f1ef:flag svalbard & jan mayen|1f1f8-1f1f0:flag slovakia|1f1f8-1f1f1:flag sierra leone|1f1f8-1f1f2:flag san marino|1f1f8-1f1f3:flag senegal|1f1f8-1f1f4:flag somalia|1f1f8-1f1f7:flag suriname|1f1f8-1f1f8:flag south sudan|1f1f8-1f1f9:flag são tomé & príncipe|1f1f8-1f1fb:flag el salvador|1f1f8-1f1fd:flag sint maarten|1f1f8-1f1fe:flag syria|1f1f8-1f1ff:flag eswatini|1f1f9-1f1e6:flag tristan da cunha|1f1f9-1f1e8:flag turks & caicos islands|1f1f9-1f1e9:flag chad|1f1f9-1f1eb:flag french southern and antarctic lands|1f1f9-1f1ec:flag togo|1f1f9-1f1ed:flag thailand|1f1f9-1f1ef:flag tajikistan|1f1f9-1f1f0:flag tokelau|1f1f9-1f1f1:flag timor-leste|1f1f9-1f1f2:flag turkmenistan|1f1f9-1f1f3:flag tunisia|1f1f9-1f1f4:flag tonga|1f1f9-1f1f7:flag türkiye|1f1f9-1f1f9:flag trinidad & tobago|1f1f9-1f1fb:flag tuvalu|1f1f9-1f1fc:flag taiwan|1f1f9-1f1ff:flag tanzania|1f1fa-1f1e6:flag ukraine|1f1fa-1f1ec:flag uganda|1f1fa-1f1f2:flag u.s. outlying islands|1f1fa-1f1f3:flag united nations|1f1fa-1f1f8:flag united states|1f1fa-1f1fe:flag uruguay|1f1fa-1f1ff:flag uzbekistan|1f1fb-1f1e6:flag vatican city|1f1fb-1f1e8:flag st. vincent & grenadines|1f1fb-1f1ea:flag venezuela|1f1fb-1f1ec:flag british virgin islands|1f1fb-1f1ee:flag u.s. virgin islands|1f1fb-1f1f3:flag vietnam|1f1fb-1f1fa:flag vanuatu|1f1fc-1f1eb:flag wallis & futuna|1f1fc-1f1f8:flag samoa|1f1fd-1f1f0:flag kosovo|1f1fe-1f1ea:flag yemen|1f1fe-1f1f9:flag mayotte|1f1ff-1f1e6:flag south africa|1f1ff-1f1f2:flag zambia|1f1ff-1f1fc:flag zimbabwe|1f3f4-e0067-e0062-e0065-e006e-e0067-e007f:flag england|1f3f4-e0067-e0062-e0073-e0063-e0074-e007f:flag scotland|1f3f4-e0067-e0062-e0077-e006c-e0073-e007f:flag wales" }
|
|
2602
2425
|
];
|
|
2603
|
-
function
|
|
2426
|
+
function Df(e) {
|
|
2604
2427
|
const t = e.indexOf(":"), n = e.slice(0, t);
|
|
2605
2428
|
return { char: String.fromCodePoint(...n.split("-").map((a) => parseInt(a, 16))), name: e.slice(t + 1) };
|
|
2606
2429
|
}
|
|
2607
|
-
let
|
|
2608
|
-
function
|
|
2609
|
-
return
|
|
2430
|
+
let nn = null;
|
|
2431
|
+
function Nt() {
|
|
2432
|
+
return nn ??= Mf.map((e) => ({ id: e.id, label: e.label, emoji: e.data.split("|").map(Df) })), nn;
|
|
2610
2433
|
}
|
|
2611
2434
|
let ie = null;
|
|
2612
2435
|
function Ve(e) {
|
|
2613
2436
|
if (!ie) {
|
|
2614
2437
|
ie = /* @__PURE__ */ new Map();
|
|
2615
|
-
for (const t of
|
|
2438
|
+
for (const t of Nt().flatMap((n) => n.emoji)) {
|
|
2616
2439
|
ie.set(t.char, t);
|
|
2617
2440
|
const n = t.char.replace(/\ufe0f/g, "");
|
|
2618
2441
|
ie.has(n) || ie.set(n, t);
|
|
@@ -2620,117 +2443,117 @@ function Ve(e) {
|
|
|
2620
2443
|
}
|
|
2621
2444
|
return ie.get(e) ?? ie.get(e.replace(/\ufe0f/g, ""));
|
|
2622
2445
|
}
|
|
2623
|
-
function
|
|
2446
|
+
function Lf(e, t = 120) {
|
|
2624
2447
|
const n = e.toLowerCase().trim().split(/\s+/).filter(Boolean);
|
|
2625
2448
|
if (!n.length) return [];
|
|
2626
|
-
const
|
|
2449
|
+
const r = Nt().flatMap((s) => s.emoji).filter((s) => {
|
|
2627
2450
|
const c = s.name.split(/[\s-]+/);
|
|
2628
2451
|
return n.every((b) => c.some((p) => p.startsWith(b)));
|
|
2629
|
-
}),
|
|
2630
|
-
if (s.name ===
|
|
2452
|
+
}), o = n.join(" "), i = (s) => {
|
|
2453
|
+
if (s.name === o) return 0;
|
|
2631
2454
|
const c = s.name.split(/[\s-]+/);
|
|
2632
2455
|
return n.every((b) => c.includes(b)) ? 1 : 2;
|
|
2633
2456
|
};
|
|
2634
|
-
return
|
|
2457
|
+
return r.sort((s, c) => i(s) - i(c)), r.slice(0, t);
|
|
2635
2458
|
}
|
|
2636
|
-
const
|
|
2459
|
+
const Of = [
|
|
2637
2460
|
[128077],
|
|
2638
2461
|
[10084, 65039],
|
|
2639
2462
|
[128514],
|
|
2640
2463
|
[128558],
|
|
2641
2464
|
[128546],
|
|
2642
2465
|
[128293]
|
|
2643
|
-
].map((e) => String.fromCodePoint(...e)),
|
|
2644
|
-
function
|
|
2466
|
+
].map((e) => String.fromCodePoint(...e)), da = 24;
|
|
2467
|
+
function jt() {
|
|
2645
2468
|
const e = B(ae.RECENT_EMOJI);
|
|
2646
2469
|
if (!e) return [];
|
|
2647
2470
|
try {
|
|
2648
2471
|
const t = JSON.parse(e);
|
|
2649
|
-
return Array.isArray(t) ? t.filter((n) => typeof n == "string").slice(0,
|
|
2472
|
+
return Array.isArray(t) ? t.filter((n) => typeof n == "string").slice(0, da) : [];
|
|
2650
2473
|
} catch {
|
|
2651
2474
|
return [];
|
|
2652
2475
|
}
|
|
2653
2476
|
}
|
|
2654
|
-
function
|
|
2655
|
-
const t = [e, ...
|
|
2477
|
+
function Hf(e) {
|
|
2478
|
+
const t = [e, ...jt().filter((n) => n !== e)].slice(0, da);
|
|
2656
2479
|
Ze(ae.RECENT_EMOJI, JSON.stringify(t));
|
|
2657
2480
|
}
|
|
2658
|
-
function
|
|
2481
|
+
function Uf(e = 3) {
|
|
2659
2482
|
const t = [];
|
|
2660
|
-
for (const n of [...
|
|
2483
|
+
for (const n of [...jt(), ...Of])
|
|
2661
2484
|
if (t.includes(n) || t.push(n), t.length === e) break;
|
|
2662
2485
|
return t;
|
|
2663
2486
|
}
|
|
2664
|
-
function
|
|
2487
|
+
function ua(e, t) {
|
|
2665
2488
|
return e.by.some((n) => n === t.author || !!t.clientId && n === t.clientId);
|
|
2666
2489
|
}
|
|
2667
|
-
function
|
|
2490
|
+
function Ff(e, t, n) {
|
|
2668
2491
|
const a = /* @__PURE__ */ new Map();
|
|
2669
2492
|
for (const s of Object.values(t))
|
|
2670
2493
|
s.author && a.set(s.author, s.name), a.set(s.clientId, s.name);
|
|
2671
|
-
const
|
|
2672
|
-
let
|
|
2494
|
+
const r = [];
|
|
2495
|
+
let o = !1, i = 0;
|
|
2673
2496
|
for (const s of e.by) {
|
|
2674
2497
|
if (s === n.author || n.clientId && s === n.clientId) {
|
|
2675
|
-
|
|
2498
|
+
o = !0;
|
|
2676
2499
|
continue;
|
|
2677
2500
|
}
|
|
2678
2501
|
const c = a.get(s);
|
|
2679
|
-
c ?
|
|
2502
|
+
c ? r.push(c) : i += 1;
|
|
2680
2503
|
}
|
|
2681
|
-
return
|
|
2504
|
+
return o && r.unshift("You"), i && r.push(i === 1 ? "1 other" : `${i} others`), r;
|
|
2682
2505
|
}
|
|
2683
|
-
function
|
|
2506
|
+
function $f(e, t) {
|
|
2684
2507
|
return `${e.length <= 1 ? e[0] ?? "Someone" : `${e.slice(0, -1).join(", ")} and ${e[e.length - 1]}`} reacted with ${t ? `:${t.replace(/\s+/g, "_")}:` : "this"}`;
|
|
2685
2508
|
}
|
|
2686
2509
|
const ce = 8;
|
|
2687
|
-
function
|
|
2510
|
+
function qf(e) {
|
|
2688
2511
|
return document.addEventListener("fullscreenchange", e), () => document.removeEventListener("fullscreenchange", e);
|
|
2689
2512
|
}
|
|
2690
|
-
function
|
|
2691
|
-
const e =
|
|
2692
|
-
return
|
|
2513
|
+
function zf() {
|
|
2514
|
+
const e = Ln();
|
|
2515
|
+
return dn(qf, () => document.fullscreenElement, () => null) ?? e ?? document.body;
|
|
2693
2516
|
}
|
|
2694
|
-
function
|
|
2517
|
+
function Bf({
|
|
2695
2518
|
anchor: e,
|
|
2696
2519
|
onClose: t,
|
|
2697
2520
|
width: n,
|
|
2698
2521
|
placement: a = "top",
|
|
2699
|
-
alignEnd:
|
|
2700
|
-
gap:
|
|
2522
|
+
alignEnd: r = !1,
|
|
2523
|
+
gap: o = 6,
|
|
2701
2524
|
className: i = "",
|
|
2702
2525
|
role: s = "dialog",
|
|
2703
2526
|
ariaLabel: c,
|
|
2704
2527
|
testId: b,
|
|
2705
2528
|
children: p
|
|
2706
2529
|
}) {
|
|
2707
|
-
const I =
|
|
2708
|
-
const d =
|
|
2530
|
+
const I = zf(), S = z(null), [N, M] = E(null), h = D(() => {
|
|
2531
|
+
const d = S.current;
|
|
2709
2532
|
if (!e || !d) return;
|
|
2710
|
-
const m = e.getBoundingClientRect(), w = window.innerWidth, v = window.innerHeight, C = Math.min(n, w - ce * 2),
|
|
2711
|
-
M((
|
|
2712
|
-
}, [e, n,
|
|
2713
|
-
return
|
|
2533
|
+
const m = e.getBoundingClientRect(), w = window.innerWidth, v = window.innerHeight, C = Math.min(n, w - ce * 2), U = Math.min(Math.max(ce, r ? m.right - C : m.left), w - C - ce), F = d.offsetHeight, O = m.top - o - ce, L = v - m.bottom - o - ce, T = a === "top" ? F <= O || O >= L : !(F <= L || L >= O), j = Math.max(120, T ? O : L), P = Math.min(F, j), $ = T ? m.top - o - P : m.bottom + o;
|
|
2534
|
+
M((H) => H && H.left === U && H.top === $ && H.maxHeight === j ? H : { left: U, top: $, maxHeight: j });
|
|
2535
|
+
}, [e, n, r, o, a]);
|
|
2536
|
+
return Dt(() => {
|
|
2714
2537
|
h();
|
|
2715
|
-
const d =
|
|
2538
|
+
const d = S.current, m = typeof ResizeObserver > "u" || !d ? null : new ResizeObserver(() => h());
|
|
2716
2539
|
return m && d && m.observe(d), window.addEventListener("resize", h), window.addEventListener("scroll", h, !0), () => {
|
|
2717
2540
|
m?.disconnect(), window.removeEventListener("resize", h), window.removeEventListener("scroll", h, !0);
|
|
2718
2541
|
};
|
|
2719
|
-
}, [h]),
|
|
2542
|
+
}, [h]), Dt(() => {
|
|
2720
2543
|
const d = (w) => {
|
|
2721
2544
|
Xe(w) && (w.stopPropagation(), t(), e?.focus({ preventScroll: !0 }));
|
|
2722
2545
|
}, m = (w) => {
|
|
2723
2546
|
const v = w.target;
|
|
2724
|
-
|
|
2547
|
+
S.current?.contains(v) || e?.contains(v) || t();
|
|
2725
2548
|
};
|
|
2726
2549
|
return document.addEventListener("keydown", d), document.addEventListener("pointerdown", m, !0), () => {
|
|
2727
2550
|
document.removeEventListener("keydown", d), document.removeEventListener("pointerdown", m, !0);
|
|
2728
2551
|
};
|
|
2729
|
-
}, [t, e]),
|
|
2552
|
+
}, [t, e]), hn(
|
|
2730
2553
|
/* @__PURE__ */ l(
|
|
2731
2554
|
"div",
|
|
2732
2555
|
{
|
|
2733
|
-
ref:
|
|
2556
|
+
ref: S,
|
|
2734
2557
|
role: s,
|
|
2735
2558
|
"aria-label": c,
|
|
2736
2559
|
"data-testid": b,
|
|
@@ -2754,12 +2577,12 @@ function li({
|
|
|
2754
2577
|
I
|
|
2755
2578
|
);
|
|
2756
2579
|
}
|
|
2757
|
-
const
|
|
2758
|
-
function
|
|
2759
|
-
const [a,
|
|
2760
|
-
() =>
|
|
2580
|
+
const Wf = 340;
|
|
2581
|
+
function Gf({ anchor: e, onPick: t, onClose: n }) {
|
|
2582
|
+
const [a, r] = E(""), [o, i] = E(null), s = z(null), c = z(null), b = G(() => Nt(), []), p = G(
|
|
2583
|
+
() => jt().map((d) => Ve(d) ?? { char: d, name: "" }).slice(0, 16),
|
|
2761
2584
|
[]
|
|
2762
|
-
), I = G(() =>
|
|
2585
|
+
), I = G(() => Lf(a), [a]), S = a.trim().length > 0;
|
|
2763
2586
|
A(() => {
|
|
2764
2587
|
s.current?.focus({ preventScroll: !0 });
|
|
2765
2588
|
}, []);
|
|
@@ -2782,24 +2605,24 @@ function di({ anchor: e, onPick: t, onClose: n }) {
|
|
|
2782
2605
|
},
|
|
2783
2606
|
m
|
|
2784
2607
|
);
|
|
2785
|
-
return /* @__PURE__ */ y(
|
|
2608
|
+
return /* @__PURE__ */ y(Bf, { anchor: e, onClose: n, width: Wf, className: "emoji-picker", ariaLabel: "Emoji picker", testId: "emoji-picker", children: [
|
|
2786
2609
|
/* @__PURE__ */ l("div", { className: "emoji-picker-search", children: /* @__PURE__ */ l(
|
|
2787
2610
|
"input",
|
|
2788
2611
|
{
|
|
2789
2612
|
ref: s,
|
|
2790
2613
|
type: "text",
|
|
2791
2614
|
value: a,
|
|
2792
|
-
onChange: (d) =>
|
|
2615
|
+
onChange: (d) => r(d.target.value),
|
|
2793
2616
|
placeholder: "Search emoji",
|
|
2794
2617
|
"aria-label": "Search emoji",
|
|
2795
2618
|
"data-testid": "emoji-search"
|
|
2796
2619
|
}
|
|
2797
2620
|
) }),
|
|
2798
|
-
!
|
|
2621
|
+
!S && /* @__PURE__ */ y("div", { className: "emoji-picker-tabs", role: "tablist", "aria-label": "Emoji categories", children: [
|
|
2799
2622
|
p.length > 0 && /* @__PURE__ */ l("button", { type: "button", className: "emoji-tab", onClick: () => M("recent"), title: "Frequently used", "aria-label": "Frequently used", children: p[0].char }),
|
|
2800
2623
|
b.map((d) => /* @__PURE__ */ l("button", { type: "button", className: "emoji-tab", onClick: () => M(d.id), title: d.label, "aria-label": d.label, children: d.emoji[0].char }, d.id))
|
|
2801
2624
|
] }),
|
|
2802
|
-
/* @__PURE__ */ l("div", { ref: c, className: "emoji-picker-body", onMouseLeave: () => i(null), children:
|
|
2625
|
+
/* @__PURE__ */ l("div", { ref: c, className: "emoji-picker-body", onMouseLeave: () => i(null), children: S ? I.length ? /* @__PURE__ */ l("div", { className: "emoji-grid", children: I.map((d) => h(d, d.char)) }) : /* @__PURE__ */ y("p", { className: "emoji-picker-empty", children: [
|
|
2803
2626
|
"No emoji match “",
|
|
2804
2627
|
a.trim(),
|
|
2805
2628
|
"”"
|
|
@@ -2813,32 +2636,32 @@ function di({ anchor: e, onPick: t, onClose: n }) {
|
|
|
2813
2636
|
/* @__PURE__ */ l("div", { className: "emoji-grid", children: d.emoji.map((m) => h(m, m.char)) })
|
|
2814
2637
|
] }, d.id))
|
|
2815
2638
|
] }) }),
|
|
2816
|
-
/* @__PURE__ */ l("div", { className: "emoji-picker-footer", "aria-hidden": "true", children:
|
|
2817
|
-
/* @__PURE__ */ l("span", { className: "emoji-picker-footer-char", children:
|
|
2639
|
+
/* @__PURE__ */ l("div", { className: "emoji-picker-footer", "aria-hidden": "true", children: o ? /* @__PURE__ */ y(ee, { children: [
|
|
2640
|
+
/* @__PURE__ */ l("span", { className: "emoji-picker-footer-char", children: o.char }),
|
|
2818
2641
|
/* @__PURE__ */ y("span", { className: "emoji-picker-footer-name", children: [
|
|
2819
2642
|
":",
|
|
2820
|
-
|
|
2643
|
+
o.name.replace(/\s+/g, "_"),
|
|
2821
2644
|
":"
|
|
2822
2645
|
] })
|
|
2823
2646
|
] }) : null })
|
|
2824
2647
|
] });
|
|
2825
2648
|
}
|
|
2826
|
-
function
|
|
2649
|
+
function Vf({ className: e = "w-4 h-4" }) {
|
|
2827
2650
|
return /* @__PURE__ */ y("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
|
|
2828
2651
|
/* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 4v16" }),
|
|
2829
2652
|
/* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15 12l-5 4v-8l5 4z" })
|
|
2830
2653
|
] });
|
|
2831
2654
|
}
|
|
2832
|
-
function
|
|
2655
|
+
function Kf({ className: e = "w-4 h-4" }) {
|
|
2833
2656
|
return /* @__PURE__ */ y("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
|
|
2834
2657
|
/* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M20 4v16" }),
|
|
2835
2658
|
/* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 12l5 4v-8l-5 4z" })
|
|
2836
2659
|
] });
|
|
2837
2660
|
}
|
|
2838
|
-
function
|
|
2661
|
+
function Yf({ className: e = "w-5 h-5" }) {
|
|
2839
2662
|
return /* @__PURE__ */ l("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 6l12 12M18 6L6 18" }) });
|
|
2840
2663
|
}
|
|
2841
|
-
function
|
|
2664
|
+
function ma({ className: e = "w-4 h-4" }) {
|
|
2842
2665
|
return /* @__PURE__ */ y("svg", { className: e, fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: [
|
|
2843
2666
|
/* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M20.5 12.5A8.5 8.5 0 1111.5 3.5" }),
|
|
2844
2667
|
/* @__PURE__ */ l("path", { strokeLinecap: "round", d: "M8.5 14.5a4 4 0 007 0" }),
|
|
@@ -2846,7 +2669,7 @@ function wa({ className: e = "w-4 h-4" }) {
|
|
|
2846
2669
|
/* @__PURE__ */ l("path", { strokeLinecap: "round", d: "M19 2v6M16 5h6" })
|
|
2847
2670
|
] });
|
|
2848
2671
|
}
|
|
2849
|
-
function
|
|
2672
|
+
function Jf({ className: e = "w-4 h-4" }) {
|
|
2850
2673
|
return /* @__PURE__ */ y("svg", { className: e, fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: [
|
|
2851
2674
|
/* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M10 7L4 12l6 5" }),
|
|
2852
2675
|
/* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 12h9a7 7 0 017 7" })
|
|
@@ -2855,15 +2678,15 @@ function pi({ className: e = "w-4 h-4" }) {
|
|
|
2855
2678
|
function it(e) {
|
|
2856
2679
|
return new Date(e).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
2857
2680
|
}
|
|
2858
|
-
const
|
|
2859
|
-
const n = u((m) => m.me.clientId), a = u((m) => m.me.clientId ? m.roster[m.me.clientId]?.author : void 0),
|
|
2681
|
+
const Xf = $e.memo(function({ message: t }) {
|
|
2682
|
+
const n = u((m) => m.me.clientId), a = u((m) => m.me.clientId ? m.roster[m.me.clientId]?.author : void 0), r = Rf(t, { clientId: n, author: a }), o = tt(
|
|
2860
2683
|
{ clientId: t.clientId, author: t.author },
|
|
2861
2684
|
{ name: t.name, sprite: t.sprite }
|
|
2862
|
-
), i = Te(
|
|
2863
|
-
|
|
2685
|
+
), i = Te(o.sprite, o.pictureUrl), s = t.isSystem ? void 0 : o.cosmetics, c = z(null);
|
|
2686
|
+
Mr(c, !!s);
|
|
2864
2687
|
const [b] = E(
|
|
2865
|
-
() => t.live && t.text ?
|
|
2866
|
-
), [p, I] = E(!1), [
|
|
2688
|
+
() => t.live && t.text ? mn(t.text, s) : null
|
|
2689
|
+
), [p, I] = E(!1), [S, N] = E(null), M = u((m) => m.setReplyingTo);
|
|
2867
2690
|
if (t.isSystem && t.systemType === "recap")
|
|
2868
2691
|
return /* @__PURE__ */ l("div", { className: "px-2 py-1.5", children: /* @__PURE__ */ y("div", { className: "border-l-2 border-border-light pl-2.5 py-0.5", children: [
|
|
2869
2692
|
/* @__PURE__ */ y("div", { className: "text-[10px] uppercase tracking-wide text-text-muted mb-0.5", children: [
|
|
@@ -2874,73 +2697,73 @@ const hi = $e.memo(function({ message: t }) {
|
|
|
2874
2697
|
] }) });
|
|
2875
2698
|
if (t.isSystem)
|
|
2876
2699
|
return /* @__PURE__ */ y("div", { className: "px-2 py-0.5 text-[11px] text-text-muted italic text-center leading-tight", children: [
|
|
2877
|
-
|
|
2700
|
+
Ef(t.text, t.template, o),
|
|
2878
2701
|
/* @__PURE__ */ l("span", { className: "ml-1 text-[10px] opacity-50", children: it(t.ts) })
|
|
2879
2702
|
] });
|
|
2880
2703
|
const h = { clientId: n, author: a }, d = (m) => {
|
|
2881
|
-
const w = t.reactions?.find((C) => C.emoji === m), v = !(w &&
|
|
2882
|
-
v &&
|
|
2704
|
+
const w = t.reactions?.find((C) => C.emoji === m), v = !(w && ua(w, h));
|
|
2705
|
+
v && Hf(m), hf(t.id, m, v);
|
|
2883
2706
|
};
|
|
2884
2707
|
return /* @__PURE__ */ y(
|
|
2885
2708
|
"div",
|
|
2886
2709
|
{
|
|
2887
2710
|
ref: c,
|
|
2888
|
-
style:
|
|
2711
|
+
style: Un(i),
|
|
2889
2712
|
"data-msg-id": t.id,
|
|
2890
|
-
className: `chat-msg px-2 py-1 ${
|
|
2713
|
+
className: `chat-msg px-2 py-1 ${r ? "chat-msg-own" : ""}`,
|
|
2891
2714
|
onMouseEnter: () => I(!0),
|
|
2892
2715
|
onMouseLeave: () => I(!1),
|
|
2893
2716
|
onFocus: () => I(!0),
|
|
2894
2717
|
onBlur: (m) => {
|
|
2895
2718
|
m.currentTarget.contains(m.relatedTarget) || I(!1);
|
|
2896
2719
|
},
|
|
2897
|
-
"data-active": p ||
|
|
2720
|
+
"data-active": p || S ? "true" : void 0,
|
|
2898
2721
|
children: [
|
|
2899
|
-
t.replyTo && /* @__PURE__ */ l(
|
|
2722
|
+
t.replyTo && /* @__PURE__ */ l(Qf, { replyTo: t.replyTo }),
|
|
2900
2723
|
/* @__PURE__ */ y("div", { className: "flex items-start gap-2", children: [
|
|
2901
|
-
/* @__PURE__ */ l(
|
|
2724
|
+
/* @__PURE__ */ l(la, { sprite: o.sprite, url: o.pictureUrl, alt: o.name, worn: s }),
|
|
2902
2725
|
/* @__PURE__ */ y("div", { className: "flex-1 min-w-0 -mt-0.5", children: [
|
|
2903
|
-
s ? /* @__PURE__ */ l(ye, { html:
|
|
2726
|
+
s ? /* @__PURE__ */ l(ye, { html: gn(o.name, s), className: "text-[13px]", style: { color: i } }) : /* @__PURE__ */ l("span", { className: "font-medium text-[13px]", style: { color: i }, children: o.name }),
|
|
2904
2727
|
/* @__PURE__ */ l("span", { className: "text-[10px] text-text-muted opacity-60 ml-1.5", children: it(t.ts) }),
|
|
2905
2728
|
t.text && (b ? /* @__PURE__ */ l(ye, { as: "p", html: b, className: "text-[13px] text-text break-words leading-snug m-0" }) : /* @__PURE__ */ l("p", { className: "text-[13px] text-text break-words leading-snug m-0", children: t.text })),
|
|
2906
|
-
/* @__PURE__ */ l(
|
|
2907
|
-
t.reactions && t.reactions.length > 0 && /* @__PURE__ */ l(
|
|
2729
|
+
/* @__PURE__ */ l(ca, { images: t.images }),
|
|
2730
|
+
t.reactions && t.reactions.length > 0 && /* @__PURE__ */ l(Zf, { reactions: t.reactions, me: h, onToggle: d, onAdd: N })
|
|
2908
2731
|
] })
|
|
2909
2732
|
] }),
|
|
2910
|
-
(p ||
|
|
2911
|
-
|
|
2733
|
+
(p || S) && /* @__PURE__ */ y("div", { className: "chat-msg-actions", role: "toolbar", "aria-label": "Message actions", "data-testid": "chat-msg-actions", children: [
|
|
2734
|
+
Uf().map((m) => /* @__PURE__ */ l("button", { type: "button", className: "chat-action-btn chat-action-emoji", onClick: () => d(m), "aria-label": `React with ${Ve(m)?.name ?? m}`, title: Ve(m)?.name, children: m }, m)),
|
|
2912
2735
|
/* @__PURE__ */ l(
|
|
2913
2736
|
"button",
|
|
2914
2737
|
{
|
|
2915
2738
|
type: "button",
|
|
2916
2739
|
className: "chat-action-btn",
|
|
2917
|
-
onClick: (m) => N(
|
|
2740
|
+
onClick: (m) => N(S ? null : m.currentTarget),
|
|
2918
2741
|
"aria-label": "Add reaction",
|
|
2919
2742
|
title: "Add reaction",
|
|
2920
|
-
"aria-expanded": !!
|
|
2921
|
-
children: /* @__PURE__ */ l(
|
|
2743
|
+
"aria-expanded": !!S,
|
|
2744
|
+
children: /* @__PURE__ */ l(ma, {})
|
|
2922
2745
|
}
|
|
2923
2746
|
),
|
|
2924
|
-
!
|
|
2747
|
+
!r && /* @__PURE__ */ l("button", { type: "button", className: "chat-action-btn", onClick: () => M(t.id), "aria-label": "Reply", title: "Reply", children: /* @__PURE__ */ l(Jf, {}) })
|
|
2925
2748
|
] }),
|
|
2926
|
-
|
|
2749
|
+
S && /* @__PURE__ */ l(Gf, { anchor: S, onPick: d, onClose: () => {
|
|
2927
2750
|
N(null), I(!1);
|
|
2928
2751
|
} })
|
|
2929
2752
|
]
|
|
2930
2753
|
}
|
|
2931
2754
|
);
|
|
2932
2755
|
});
|
|
2933
|
-
function
|
|
2756
|
+
function Qf({ replyTo: e }) {
|
|
2934
2757
|
const t = u((i) => i.chat.find((s) => s.id === e)), n = u((i) => i.jumpToMessage), a = tt(
|
|
2935
2758
|
{ clientId: t?.clientId ?? "", author: t?.author },
|
|
2936
2759
|
{ name: t?.name ?? "", sprite: t?.sprite ?? null }
|
|
2937
|
-
),
|
|
2760
|
+
), r = Te(a.sprite, a.pictureUrl);
|
|
2938
2761
|
if (!t)
|
|
2939
2762
|
return /* @__PURE__ */ y("div", { className: "chat-reply-quote", "data-testid": "chat-reply-quote", "data-missing": "true", children: [
|
|
2940
2763
|
/* @__PURE__ */ l("span", { className: "chat-reply-spine", "aria-hidden": "true" }),
|
|
2941
2764
|
/* @__PURE__ */ l("span", { className: "chat-reply-text italic", children: "Original message unavailable" })
|
|
2942
2765
|
] });
|
|
2943
|
-
const
|
|
2766
|
+
const o = t.isSystem ? (t.template ?? t.text).split(yt).join(a.name) : t.text || (t.images?.length ? "Image" : "");
|
|
2944
2767
|
return /* @__PURE__ */ y(
|
|
2945
2768
|
"button",
|
|
2946
2769
|
{
|
|
@@ -2952,7 +2775,7 @@ function bi({ replyTo: e }) {
|
|
|
2952
2775
|
children: [
|
|
2953
2776
|
/* @__PURE__ */ l("span", { className: "chat-reply-spine", "aria-hidden": "true" }),
|
|
2954
2777
|
/* @__PURE__ */ l(
|
|
2955
|
-
|
|
2778
|
+
At,
|
|
2956
2779
|
{
|
|
2957
2780
|
sprite: a.sprite,
|
|
2958
2781
|
url: a.pictureUrl,
|
|
@@ -2961,17 +2784,17 @@ function bi({ replyTo: e }) {
|
|
|
2961
2784
|
fallback: /* @__PURE__ */ l("span", { className: "inline-block w-4 h-4 bg-bg-alt/50 rounded-full flex-shrink-0" })
|
|
2962
2785
|
}
|
|
2963
2786
|
),
|
|
2964
|
-
/* @__PURE__ */ l("span", { className: "chat-reply-name", style: { color:
|
|
2965
|
-
/* @__PURE__ */ l("span", { className: "chat-reply-text", children:
|
|
2787
|
+
/* @__PURE__ */ l("span", { className: "chat-reply-name", style: { color: r }, children: a.name }),
|
|
2788
|
+
/* @__PURE__ */ l("span", { className: "chat-reply-text", children: o })
|
|
2966
2789
|
]
|
|
2967
2790
|
}
|
|
2968
2791
|
);
|
|
2969
2792
|
}
|
|
2970
|
-
function
|
|
2971
|
-
const
|
|
2793
|
+
function Zf({ reactions: e, me: t, onToggle: n, onAdd: a }) {
|
|
2794
|
+
const r = u((o) => o.roster);
|
|
2972
2795
|
return /* @__PURE__ */ y("div", { className: "chat-reactions", "data-testid": "chat-reactions", children: [
|
|
2973
|
-
e.map((
|
|
2974
|
-
const i =
|
|
2796
|
+
e.map((o) => {
|
|
2797
|
+
const i = ua(o, t);
|
|
2975
2798
|
return /* @__PURE__ */ y(
|
|
2976
2799
|
"button",
|
|
2977
2800
|
{
|
|
@@ -2979,58 +2802,58 @@ function yi({ reactions: e, me: t, onToggle: n, onAdd: a }) {
|
|
|
2979
2802
|
className: "chat-reaction",
|
|
2980
2803
|
"data-mine": i ? "true" : void 0,
|
|
2981
2804
|
"aria-pressed": i,
|
|
2982
|
-
onClick: () => n(
|
|
2983
|
-
title:
|
|
2984
|
-
"data-emoji":
|
|
2805
|
+
onClick: () => n(o.emoji),
|
|
2806
|
+
title: $f(Ff(o, r, t), Ve(o.emoji)?.name),
|
|
2807
|
+
"data-emoji": o.emoji,
|
|
2985
2808
|
children: [
|
|
2986
|
-
/* @__PURE__ */ l("span", { className: "chat-reaction-emoji", children:
|
|
2987
|
-
/* @__PURE__ */ l("span", { className: "chat-reaction-count", children:
|
|
2809
|
+
/* @__PURE__ */ l("span", { className: "chat-reaction-emoji", children: o.emoji }),
|
|
2810
|
+
/* @__PURE__ */ l("span", { className: "chat-reaction-count", children: o.by.length })
|
|
2988
2811
|
]
|
|
2989
2812
|
},
|
|
2990
|
-
|
|
2813
|
+
o.emoji
|
|
2991
2814
|
);
|
|
2992
2815
|
}),
|
|
2993
|
-
/* @__PURE__ */ l("button", { type: "button", className: "chat-reaction chat-reaction-add", onClick: (
|
|
2816
|
+
/* @__PURE__ */ l("button", { type: "button", className: "chat-reaction chat-reaction-add", onClick: (o) => a(o.currentTarget), "aria-label": "Add reaction", title: "Add reaction", children: /* @__PURE__ */ l(ma, {}) })
|
|
2994
2817
|
] });
|
|
2995
2818
|
}
|
|
2996
|
-
function
|
|
2997
|
-
|
|
2998
|
-
const e = u((
|
|
2999
|
-
const
|
|
3000
|
-
if (!
|
|
3001
|
-
const { scrollHeight: i, scrollTop: s, clientHeight: c } =
|
|
2819
|
+
function ei() {
|
|
2820
|
+
Hn();
|
|
2821
|
+
const e = u((o) => o.chat), t = z(null), n = z(!1), a = D(() => {
|
|
2822
|
+
const o = t.current;
|
|
2823
|
+
if (!o) return;
|
|
2824
|
+
const { scrollHeight: i, scrollTop: s, clientHeight: c } = o, b = i - s - c;
|
|
3002
2825
|
n.current = b > 40;
|
|
3003
2826
|
}, []);
|
|
3004
2827
|
A(() => {
|
|
3005
|
-
const
|
|
3006
|
-
!
|
|
2828
|
+
const o = t.current;
|
|
2829
|
+
!o || n.current || (typeof o.scrollTo == "function" ? o.scrollTo({ top: o.scrollHeight, behavior: "smooth" }) : o.scrollTop = o.scrollHeight);
|
|
3007
2830
|
}, [e.length]);
|
|
3008
|
-
const
|
|
2831
|
+
const r = u((o) => o.chatJump);
|
|
3009
2832
|
return A(() => {
|
|
3010
|
-
const
|
|
3011
|
-
if (!
|
|
3012
|
-
const i =
|
|
2833
|
+
const o = t.current;
|
|
2834
|
+
if (!r || !o) return;
|
|
2835
|
+
const i = o.querySelector(`[data-msg-id="${r.id}"]`);
|
|
3013
2836
|
if (!i) return;
|
|
3014
|
-
const s = i.offsetTop - (
|
|
3015
|
-
typeof
|
|
2837
|
+
const s = i.offsetTop - (o.clientHeight - i.offsetHeight) / 2;
|
|
2838
|
+
typeof o.scrollTo == "function" ? o.scrollTo({ top: s, behavior: "smooth" }) : o.scrollTop = s, i.removeAttribute("data-flash"), i.offsetWidth, i.setAttribute("data-flash", "true");
|
|
3016
2839
|
const c = setTimeout(() => i.removeAttribute("data-flash"), 2e3);
|
|
3017
2840
|
return () => clearTimeout(c);
|
|
3018
|
-
}, [
|
|
2841
|
+
}, [r]), /* @__PURE__ */ l(
|
|
3019
2842
|
"div",
|
|
3020
2843
|
{
|
|
3021
2844
|
ref: t,
|
|
3022
2845
|
onScroll: a,
|
|
3023
2846
|
className: "relative flex-1 overflow-y-auto overflow-x-hidden chat-messages pt-3",
|
|
3024
|
-
children: e.length === 0 ? /* @__PURE__ */ l("div", { className: "p-4 text-xs text-text-muted text-center", children: "No messages yet. Be the first to say something!" }) : /* @__PURE__ */ l(ee, { children: e.map((
|
|
3025
|
-
const s = i > 0 ? e[i - 1] : null, c = s &&
|
|
2847
|
+
children: e.length === 0 ? /* @__PURE__ */ l("div", { className: "p-4 text-xs text-text-muted text-center", children: "No messages yet. Be the first to say something!" }) : /* @__PURE__ */ l(ee, { children: e.map((o, i) => {
|
|
2848
|
+
const s = i > 0 ? e[i - 1] : null, c = s && o.ts - s.ts > 1440 * 60 * 1e3;
|
|
3026
2849
|
return /* @__PURE__ */ y($e.Fragment, { children: [
|
|
3027
2850
|
c && /* @__PURE__ */ y("div", { className: "flex items-center gap-2 px-4 py-2 my-1", children: [
|
|
3028
2851
|
/* @__PURE__ */ l("div", { className: "flex-1 h-px bg-border" }),
|
|
3029
|
-
/* @__PURE__ */ l("span", { className: "text-[10px] text-text-muted whitespace-nowrap", children: new Date(
|
|
2852
|
+
/* @__PURE__ */ l("span", { className: "text-[10px] text-text-muted whitespace-nowrap", children: new Date(o.ts).toLocaleDateString([], { weekday: "short", month: "short", day: "numeric" }) }),
|
|
3030
2853
|
/* @__PURE__ */ l("div", { className: "flex-1 h-px bg-border" })
|
|
3031
2854
|
] }),
|
|
3032
|
-
/* @__PURE__ */ l(
|
|
3033
|
-
] },
|
|
2855
|
+
/* @__PURE__ */ l(Xf, { message: o })
|
|
2856
|
+
] }, o.id);
|
|
3034
2857
|
}) })
|
|
3035
2858
|
}
|
|
3036
2859
|
);
|
|
@@ -3056,49 +2879,49 @@ const Pt = [
|
|
|
3056
2879
|
scope: "local"
|
|
3057
2880
|
}
|
|
3058
2881
|
], ue = "/";
|
|
3059
|
-
function
|
|
2882
|
+
function ti(e) {
|
|
3060
2883
|
if (!e.startsWith(ue)) return null;
|
|
3061
2884
|
const t = e.slice(ue.length);
|
|
3062
2885
|
return /\s/.test(t) ? null : t.toLowerCase();
|
|
3063
2886
|
}
|
|
3064
|
-
function
|
|
2887
|
+
function ni(e, t = Pt) {
|
|
3065
2888
|
const n = e.toLowerCase();
|
|
3066
|
-
if (!n) return [...t].sort((
|
|
2889
|
+
if (!n) return [...t].sort((r, o) => r.name.localeCompare(o.name));
|
|
3067
2890
|
const a = [];
|
|
3068
|
-
for (const
|
|
3069
|
-
const
|
|
3070
|
-
|
|
2891
|
+
for (const r of t) {
|
|
2892
|
+
const o = r.name.toLowerCase();
|
|
2893
|
+
o.startsWith(n) ? a.push({ cmd: r, rank: 0 }) : o.includes(n) && a.push({ cmd: r, rank: 1 });
|
|
3071
2894
|
}
|
|
3072
|
-
return a.sort((
|
|
2895
|
+
return a.sort((r, o) => r.rank - o.rank || r.cmd.name.localeCompare(o.cmd.name)).map((r) => r.cmd);
|
|
3073
2896
|
}
|
|
3074
|
-
function
|
|
2897
|
+
function ai(e) {
|
|
3075
2898
|
return `${ue}${e.name} `;
|
|
3076
2899
|
}
|
|
3077
2900
|
function st(e, t) {
|
|
3078
2901
|
return t <= 0 ? 0 : (e % t + t) % t;
|
|
3079
2902
|
}
|
|
3080
|
-
function
|
|
2903
|
+
function ri(e, t = Pt) {
|
|
3081
2904
|
const n = e.trim();
|
|
3082
2905
|
if (!n) return null;
|
|
3083
2906
|
if (!n.startsWith(ue)) return { kind: "chat", text: n };
|
|
3084
|
-
const a = n.slice(ue.length),
|
|
2907
|
+
const a = n.slice(ue.length), r = a.search(/\s/), o = (r === -1 ? a : a.slice(0, r)).toLowerCase(), i = r === -1 ? "" : a.slice(r).trim(), s = t.find((c) => c.name.toLowerCase() === o);
|
|
3085
2908
|
return s ? { kind: "command", command: s, args: i } : { kind: "chat", text: n };
|
|
3086
2909
|
}
|
|
3087
|
-
function
|
|
2910
|
+
function oi(e, t) {
|
|
3088
2911
|
return e.requiresMedia && !t.hasMedia ? `${ue}${e.name} needs an episode loaded.` : null;
|
|
3089
2912
|
}
|
|
3090
|
-
function
|
|
2913
|
+
function fi({
|
|
3091
2914
|
commands: e,
|
|
3092
2915
|
activeIndex: t,
|
|
3093
2916
|
hasMedia: n,
|
|
3094
2917
|
onPick: a,
|
|
3095
|
-
onHover:
|
|
3096
|
-
listboxId:
|
|
2918
|
+
onHover: r,
|
|
2919
|
+
listboxId: o
|
|
3097
2920
|
}) {
|
|
3098
2921
|
return e.length === 0 ? null : /* @__PURE__ */ l(
|
|
3099
2922
|
"ul",
|
|
3100
2923
|
{
|
|
3101
|
-
id:
|
|
2924
|
+
id: o,
|
|
3102
2925
|
role: "listbox",
|
|
3103
2926
|
"aria-label": "Slash commands",
|
|
3104
2927
|
className: `absolute bottom-full left-0 right-0 z-30 max-h-56 overflow-y-auto
|
|
@@ -3109,14 +2932,14 @@ function Ti({
|
|
|
3109
2932
|
return /* @__PURE__ */ y(
|
|
3110
2933
|
"li",
|
|
3111
2934
|
{
|
|
3112
|
-
id: `${
|
|
2935
|
+
id: `${o}-opt-${i.name}`,
|
|
3113
2936
|
role: "option",
|
|
3114
2937
|
"aria-selected": b,
|
|
3115
2938
|
"aria-disabled": c,
|
|
3116
2939
|
onMouseDown: (p) => {
|
|
3117
2940
|
p.preventDefault(), a(i);
|
|
3118
2941
|
},
|
|
3119
|
-
onMouseEnter: () =>
|
|
2942
|
+
onMouseEnter: () => r(s),
|
|
3120
2943
|
className: `px-3 py-1.5 cursor-pointer flex items-baseline gap-2 ${b ? "bg-bg-alt" : ""} ${c ? "opacity-50" : ""}`,
|
|
3121
2944
|
children: [
|
|
3122
2945
|
/* @__PURE__ */ l("span", { className: "text-sm font-semibold text-text shrink-0", children: i.usage }),
|
|
@@ -3129,7 +2952,7 @@ function Ti({
|
|
|
3129
2952
|
}
|
|
3130
2953
|
);
|
|
3131
2954
|
}
|
|
3132
|
-
function
|
|
2955
|
+
function ii({
|
|
3133
2956
|
pending: e,
|
|
3134
2957
|
uploading: t,
|
|
3135
2958
|
onRemove: n
|
|
@@ -3156,29 +2979,29 @@ function Ci({
|
|
|
3156
2979
|
)
|
|
3157
2980
|
] }, a.id)) }) : null;
|
|
3158
2981
|
}
|
|
3159
|
-
function
|
|
3160
|
-
const [e, t] = E([]), [n, a] = E(!1),
|
|
2982
|
+
function si() {
|
|
2983
|
+
const [e, t] = E([]), [n, a] = E(!1), r = u((h) => h.pushToast), o = z(/* @__PURE__ */ new Set());
|
|
3161
2984
|
A(() => () => {
|
|
3162
|
-
for (const h of
|
|
3163
|
-
|
|
2985
|
+
for (const h of o.current) URL.revokeObjectURL(h);
|
|
2986
|
+
o.current.clear();
|
|
3164
2987
|
}, []);
|
|
3165
2988
|
const i = D((h) => {
|
|
3166
|
-
|
|
2989
|
+
pr(h) && (URL.revokeObjectURL(h.previewUrl), o.current.delete(h.previewUrl));
|
|
3167
2990
|
}, []), s = D(async (h) => {
|
|
3168
2991
|
if (!h.length) return;
|
|
3169
2992
|
const d = [];
|
|
3170
2993
|
for (const m of h) {
|
|
3171
|
-
const w =
|
|
2994
|
+
const w = br(m);
|
|
3172
2995
|
if (w) {
|
|
3173
|
-
|
|
2996
|
+
r("error", w);
|
|
3174
2997
|
continue;
|
|
3175
2998
|
}
|
|
3176
|
-
const { w: v, h: C } = await
|
|
3177
|
-
|
|
2999
|
+
const { w: v, h: C } = await vr(m), U = URL.createObjectURL(m);
|
|
3000
|
+
o.current.add(U), d.push({
|
|
3178
3001
|
kind: "file",
|
|
3179
3002
|
id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
3180
3003
|
file: m,
|
|
3181
|
-
previewUrl:
|
|
3004
|
+
previewUrl: U,
|
|
3182
3005
|
w: v,
|
|
3183
3006
|
h: C
|
|
3184
3007
|
});
|
|
@@ -3186,19 +3009,19 @@ function Ii() {
|
|
|
3186
3009
|
d.length && t((m) => {
|
|
3187
3010
|
const w = te - m.length;
|
|
3188
3011
|
if (w <= 0) {
|
|
3189
|
-
|
|
3012
|
+
r("info", `Up to ${te} images per message`);
|
|
3190
3013
|
for (const v of d) i(v);
|
|
3191
3014
|
return m;
|
|
3192
3015
|
}
|
|
3193
3016
|
if (d.length > w) {
|
|
3194
|
-
|
|
3017
|
+
r("info", `Up to ${te} images per message`);
|
|
3195
3018
|
for (const v of d.slice(w)) i(v);
|
|
3196
3019
|
}
|
|
3197
3020
|
return [...m, ...d.slice(0, w)];
|
|
3198
3021
|
});
|
|
3199
|
-
}, [
|
|
3022
|
+
}, [r, i]), c = D((h) => {
|
|
3200
3023
|
const d = qe(h.key);
|
|
3201
|
-
d && (t((m) => m.length >= te ? (
|
|
3024
|
+
d && (t((m) => m.length >= te ? (r("info", `Up to ${te} images per message`), m) : [...m, {
|
|
3202
3025
|
kind: "remote",
|
|
3203
3026
|
id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
3204
3027
|
key: h.key,
|
|
@@ -3208,8 +3031,8 @@ function Ii() {
|
|
|
3208
3031
|
w: h.width ?? 0,
|
|
3209
3032
|
h: h.height ?? 0,
|
|
3210
3033
|
title: h.title || void 0
|
|
3211
|
-
}]), Je().catalogue(
|
|
3212
|
-
}, [
|
|
3034
|
+
}]), Je().catalogue(Rn).recordUse(h.key));
|
|
3035
|
+
}, [r]), b = D((h) => {
|
|
3213
3036
|
t((d) => {
|
|
3214
3037
|
const m = d.find((w) => w.id === h);
|
|
3215
3038
|
return m && i(m), d.filter((w) => w.id !== h);
|
|
@@ -3220,10 +3043,10 @@ function Ii() {
|
|
|
3220
3043
|
return [];
|
|
3221
3044
|
});
|
|
3222
3045
|
}, [i]), I = D((h) => {
|
|
3223
|
-
const d =
|
|
3046
|
+
const d = yr(h.clipboardData);
|
|
3224
3047
|
d.length && (h.preventDefault(), s(d));
|
|
3225
|
-
}, [s]),
|
|
3226
|
-
const d =
|
|
3048
|
+
}, [s]), S = D((h) => {
|
|
3049
|
+
const d = wr(h.dataTransfer);
|
|
3227
3050
|
d.length && (h.preventDefault(), s(d));
|
|
3228
3051
|
}, [s]), N = D((h) => {
|
|
3229
3052
|
h.dataTransfer?.types?.includes("Files") && h.preventDefault();
|
|
@@ -3231,13 +3054,13 @@ function Ii() {
|
|
|
3231
3054
|
if (!e.length) return [];
|
|
3232
3055
|
a(!0);
|
|
3233
3056
|
try {
|
|
3234
|
-
return await
|
|
3057
|
+
return await _r(e);
|
|
3235
3058
|
} catch (h) {
|
|
3236
|
-
return
|
|
3059
|
+
return R("chat", "Image upload failed", xr(h)), r("error", hr(h)), null;
|
|
3237
3060
|
} finally {
|
|
3238
3061
|
a(!1);
|
|
3239
3062
|
}
|
|
3240
|
-
}, [e,
|
|
3063
|
+
}, [e, r]);
|
|
3241
3064
|
return {
|
|
3242
3065
|
pending: e,
|
|
3243
3066
|
uploading: n,
|
|
@@ -3247,12 +3070,12 @@ function Ii() {
|
|
|
3247
3070
|
clear: p,
|
|
3248
3071
|
uploadPending: M,
|
|
3249
3072
|
onPaste: I,
|
|
3250
|
-
onDrop:
|
|
3073
|
+
onDrop: S,
|
|
3251
3074
|
onDragOver: N
|
|
3252
3075
|
};
|
|
3253
3076
|
}
|
|
3254
|
-
const
|
|
3255
|
-
class
|
|
3077
|
+
const li = 2500, ci = 5e3;
|
|
3078
|
+
class di {
|
|
3256
3079
|
constructor(t, n = Date.now) {
|
|
3257
3080
|
this.send = t, this.now = n;
|
|
3258
3081
|
}
|
|
@@ -3267,33 +3090,33 @@ class Ni {
|
|
|
3267
3090
|
return;
|
|
3268
3091
|
}
|
|
3269
3092
|
const n = this.now();
|
|
3270
|
-
(!this.typing || n - this.lastSent >=
|
|
3093
|
+
(!this.typing || n - this.lastSent >= li) && (this.typing = !0, this.lastSent = n, this.send(!0)), this.idle && clearTimeout(this.idle), this.idle = setTimeout(() => this.stop(), ci);
|
|
3271
3094
|
}
|
|
3272
3095
|
stop() {
|
|
3273
3096
|
this.idle && (clearTimeout(this.idle), this.idle = null), this.typing && (this.typing = !1, this.send(!1));
|
|
3274
3097
|
}
|
|
3275
3098
|
}
|
|
3276
|
-
function
|
|
3277
|
-
const [e] = E(() => new
|
|
3099
|
+
function ui() {
|
|
3100
|
+
const [e] = E(() => new di(bf));
|
|
3278
3101
|
return A(() => () => e.stop(), [e]), e;
|
|
3279
3102
|
}
|
|
3280
|
-
function
|
|
3103
|
+
function mi(e) {
|
|
3281
3104
|
return e.length === 0 ? null : e.length === 1 ? `${e[0]} is typing…` : e.length === 2 ? `${e[0]} and ${e[1]} are typing…` : e.length === 3 ? `${e[0]}, ${e[1]} and ${e[2]} are typing…` : "Several people are typing…";
|
|
3282
3105
|
}
|
|
3283
|
-
function
|
|
3284
|
-
const n = u((
|
|
3106
|
+
function gi({ replyTo: e, onCancel: t }) {
|
|
3107
|
+
const n = u((o) => o.chat.find((i) => i.id === e)), a = tt(
|
|
3285
3108
|
{ clientId: n?.clientId ?? "", author: n?.author },
|
|
3286
3109
|
{ name: n?.name ?? "a message", sprite: n?.sprite ?? null }
|
|
3287
|
-
),
|
|
3110
|
+
), r = Te(a.sprite, a.pictureUrl);
|
|
3288
3111
|
return /* @__PURE__ */ y("div", { className: "chat-reply-bar", "data-testid": "chat-reply-bar", children: [
|
|
3289
3112
|
/* @__PURE__ */ y("span", { className: "min-w-0 truncate", children: [
|
|
3290
3113
|
"Replying to ",
|
|
3291
|
-
/* @__PURE__ */ l("span", { className: "font-semibold", style: { color:
|
|
3114
|
+
/* @__PURE__ */ l("span", { className: "font-semibold", style: { color: r }, children: a.name })
|
|
3292
3115
|
] }),
|
|
3293
|
-
/* @__PURE__ */ l("button", { type: "button", className: "chat-reply-cancel", onClick: t, "aria-label": "Cancel reply", title: "Cancel reply", children: /* @__PURE__ */ l(
|
|
3116
|
+
/* @__PURE__ */ l("button", { type: "button", className: "chat-reply-cancel", onClick: t, "aria-label": "Cancel reply", title: "Cancel reply", children: /* @__PURE__ */ l(Yf, { className: "w-3.5 h-3.5" }) })
|
|
3294
3117
|
] });
|
|
3295
3118
|
}
|
|
3296
|
-
function
|
|
3119
|
+
function pi() {
|
|
3297
3120
|
const e = u((i) => i.typing), t = u((i) => i.roster), n = u((i) => i.me.clientId), a = u((i) => i.setTyping);
|
|
3298
3121
|
A(() => {
|
|
3299
3122
|
const i = Object.keys(e);
|
|
@@ -3304,52 +3127,52 @@ function Mi() {
|
|
|
3304
3127
|
}, Math.max(0, s - Date.now()) + 50);
|
|
3305
3128
|
return () => clearTimeout(c);
|
|
3306
3129
|
}, [e, a]);
|
|
3307
|
-
const
|
|
3308
|
-
return /* @__PURE__ */ l("div", { className: "chat-typing", "aria-live": "polite", "data-testid": "chat-typing", children:
|
|
3130
|
+
const r = Object.keys(e).filter((i) => i !== n && t[i]).map((i) => t[i].name || "Someone").sort((i, s) => i.localeCompare(s)), o = mi(r);
|
|
3131
|
+
return /* @__PURE__ */ l("div", { className: "chat-typing", "aria-live": "polite", "data-testid": "chat-typing", children: o && /* @__PURE__ */ y(ee, { children: [
|
|
3309
3132
|
/* @__PURE__ */ y("span", { className: "chat-typing-dots", "aria-hidden": "true", children: [
|
|
3310
3133
|
/* @__PURE__ */ l("i", {}),
|
|
3311
3134
|
/* @__PURE__ */ l("i", {}),
|
|
3312
3135
|
/* @__PURE__ */ l("i", {})
|
|
3313
3136
|
] }),
|
|
3314
|
-
/* @__PURE__ */ l("span", { className: "truncate", children:
|
|
3137
|
+
/* @__PURE__ */ l("span", { className: "truncate", children: o })
|
|
3315
3138
|
] }) });
|
|
3316
3139
|
}
|
|
3317
|
-
const
|
|
3318
|
-
function
|
|
3319
|
-
const [t, n] = E(""), [a,
|
|
3140
|
+
const an = vn, hi = Ba;
|
|
3141
|
+
function bi({ commands: e = Pt }) {
|
|
3142
|
+
const [t, n] = E(""), [a, r] = E(!1), [o, i] = E({ q: null, i: 0 }), [s, c] = E(!1), b = z(null), p = ha(), [I, S] = E(!1), [N, M] = E(!1), h = si(), d = ui(), m = u((k) => k.replyingTo), w = u((k) => k.setReplyingTo);
|
|
3320
3143
|
A(() => {
|
|
3321
3144
|
m && !document.hidden && b.current?.focus({ preventScroll: !0 });
|
|
3322
3145
|
}, [m]);
|
|
3323
|
-
const v = u((k) => k.snapshot.mediaId), C = u((k) => k.pushToast),
|
|
3324
|
-
() => O === null ? [] :
|
|
3146
|
+
const v = u((k) => k.snapshot.mediaId), C = u((k) => k.pushToast), U = u((k) => k.setTierlistOpen), F = !!v, O = ti(t), L = G(
|
|
3147
|
+
() => O === null ? [] : ni(O, e),
|
|
3325
3148
|
[O, e]
|
|
3326
|
-
), T = O !== null && !s && L.length > 0, j =
|
|
3149
|
+
), T = O !== null && !s && L.length > 0, j = o.q === O ? st(o.i, L.length) : 0, P = D(
|
|
3327
3150
|
(k) => i({ q: O, i: k }),
|
|
3328
3151
|
[O]
|
|
3329
3152
|
), $ = D((k, q) => {
|
|
3330
|
-
const me =
|
|
3153
|
+
const me = oi(k, { hasMedia: F });
|
|
3331
3154
|
if (me) {
|
|
3332
3155
|
C("info", me);
|
|
3333
3156
|
return;
|
|
3334
3157
|
}
|
|
3335
3158
|
switch (k.name) {
|
|
3336
3159
|
case "help":
|
|
3337
|
-
C("info", e.map((
|
|
3160
|
+
C("info", e.map((pa) => pa.usage).join(" "));
|
|
3338
3161
|
break;
|
|
3339
3162
|
case "recap":
|
|
3340
|
-
|
|
3163
|
+
xf();
|
|
3341
3164
|
break;
|
|
3342
3165
|
case "tierlist":
|
|
3343
|
-
|
|
3166
|
+
Ao(), U(!0);
|
|
3344
3167
|
break;
|
|
3345
3168
|
default:
|
|
3346
3169
|
C("info", `${k.usage} is not implemented yet.`);
|
|
3347
3170
|
}
|
|
3348
|
-
}, [F, C, e,
|
|
3349
|
-
n(
|
|
3171
|
+
}, [F, C, e, U]), H = D((k) => {
|
|
3172
|
+
n(ai(k)), c(!1), b.current?.focus();
|
|
3350
3173
|
}, []), le = D(async (k) => {
|
|
3351
3174
|
if (k.preventDefault(), a || h.uploading) return;
|
|
3352
|
-
const q =
|
|
3175
|
+
const q = ri(t, e);
|
|
3353
3176
|
if (!q && !h.pending.length) return;
|
|
3354
3177
|
if (q?.kind === "command" && h.pending.length) {
|
|
3355
3178
|
C("info", "Send images on their own, not with a command.");
|
|
@@ -3360,7 +3183,7 @@ function Li({ commands: e = Pt }) {
|
|
|
3360
3183
|
return;
|
|
3361
3184
|
}
|
|
3362
3185
|
const me = await h.uploadPending();
|
|
3363
|
-
me !== null && (
|
|
3186
|
+
me !== null && (pf(q?.text ?? "", me, m), n(""), d.stop(), w(null), h.clear(), r(!0), setTimeout(() => r(!1), hi), !document.hidden && document.hasFocus() && b.current?.focus());
|
|
3364
3187
|
}, [t, a, $, h, C, e, m, w, d]), oe = D((k) => {
|
|
3365
3188
|
if (k.key === "Escape" && T) {
|
|
3366
3189
|
k.preventDefault(), c(!0);
|
|
@@ -3372,27 +3195,27 @@ function Li({ commands: e = Pt }) {
|
|
|
3372
3195
|
}
|
|
3373
3196
|
if (T) {
|
|
3374
3197
|
if (k.key === "ArrowDown")
|
|
3375
|
-
k.preventDefault(),
|
|
3198
|
+
k.preventDefault(), P(st(j + 1, L.length));
|
|
3376
3199
|
else if (k.key === "ArrowUp")
|
|
3377
|
-
k.preventDefault(),
|
|
3200
|
+
k.preventDefault(), P(st(j - 1, L.length));
|
|
3378
3201
|
else if (k.key === "Tab") {
|
|
3379
3202
|
k.preventDefault();
|
|
3380
3203
|
const q = L[j];
|
|
3381
|
-
q &&
|
|
3204
|
+
q && H(q);
|
|
3382
3205
|
} else if (k.key === "Enter") {
|
|
3383
3206
|
k.preventDefault();
|
|
3384
3207
|
const q = L[j];
|
|
3385
|
-
q &&
|
|
3208
|
+
q && H(q);
|
|
3386
3209
|
}
|
|
3387
3210
|
}
|
|
3388
|
-
}, [T, L, j,
|
|
3211
|
+
}, [T, L, j, H, P, m, w]);
|
|
3389
3212
|
A(() => {
|
|
3390
3213
|
const k = () => {
|
|
3391
3214
|
document.hidden || !document.hasFocus() || (b.current?.focus(), b.current?.scrollIntoView({ block: "nearest" }));
|
|
3392
3215
|
};
|
|
3393
3216
|
return window.addEventListener("watchparty:focus-chat-input", k), () => window.removeEventListener("watchparty:focus-chat-input", k);
|
|
3394
3217
|
}, []);
|
|
3395
|
-
const Ce =
|
|
3218
|
+
const Ce = an - t.length, Rt = Ce <= 100, Mt = T ? L[j] : void 0;
|
|
3396
3219
|
return /* @__PURE__ */ y(
|
|
3397
3220
|
"form",
|
|
3398
3221
|
{
|
|
@@ -3404,28 +3227,28 @@ function Li({ commands: e = Pt }) {
|
|
|
3404
3227
|
onDragOver: h.onDragOver,
|
|
3405
3228
|
className: "p-2 border-t border-border",
|
|
3406
3229
|
children: [
|
|
3407
|
-
m && /* @__PURE__ */ l(
|
|
3408
|
-
/* @__PURE__ */ l(
|
|
3230
|
+
m && /* @__PURE__ */ l(gi, { replyTo: m, onCancel: () => w(null) }),
|
|
3231
|
+
/* @__PURE__ */ l(ii, { pending: h.pending, uploading: h.uploading, onRemove: h.remove }),
|
|
3409
3232
|
/* @__PURE__ */ y("div", { className: "relative", children: [
|
|
3410
3233
|
T && /* @__PURE__ */ l(
|
|
3411
|
-
|
|
3234
|
+
fi,
|
|
3412
3235
|
{
|
|
3413
3236
|
commands: L,
|
|
3414
3237
|
activeIndex: j,
|
|
3415
3238
|
hasMedia: F,
|
|
3416
|
-
onPick:
|
|
3417
|
-
onHover:
|
|
3239
|
+
onPick: H,
|
|
3240
|
+
onHover: P,
|
|
3418
3241
|
listboxId: p
|
|
3419
3242
|
}
|
|
3420
3243
|
),
|
|
3421
3244
|
/* @__PURE__ */ l(
|
|
3422
|
-
|
|
3245
|
+
Nr,
|
|
3423
3246
|
{
|
|
3424
3247
|
open: I,
|
|
3425
|
-
onClose: () =>
|
|
3248
|
+
onClose: () => S(!1),
|
|
3426
3249
|
onPick: h.addMeme,
|
|
3427
3250
|
onUnavailable: () => {
|
|
3428
|
-
M(!0),
|
|
3251
|
+
M(!0), S(!1);
|
|
3429
3252
|
}
|
|
3430
3253
|
}
|
|
3431
3254
|
),
|
|
@@ -3441,47 +3264,47 @@ function Li({ commands: e = Pt }) {
|
|
|
3441
3264
|
n(k.target.value), c(!1), k.target.value.startsWith("/") ? d.stop() : d.input(k.target.value);
|
|
3442
3265
|
},
|
|
3443
3266
|
onKeyDown: oe,
|
|
3444
|
-
maxLength:
|
|
3267
|
+
maxLength: an,
|
|
3445
3268
|
placeholder: "Send a message",
|
|
3446
3269
|
role: "combobox",
|
|
3447
3270
|
"aria-expanded": T,
|
|
3448
3271
|
"aria-controls": T ? p : void 0,
|
|
3449
|
-
"aria-activedescendant":
|
|
3272
|
+
"aria-activedescendant": Mt ? `${p}-opt-${Mt.name}` : void 0,
|
|
3450
3273
|
"aria-autocomplete": "list",
|
|
3451
|
-
className: `w-full bg-bg-card border border-border-light rounded px-3 py-1.5 text-sm focus:outline-none focus:border-text-muted ${
|
|
3274
|
+
className: `w-full bg-bg-card border border-border-light rounded px-3 py-1.5 text-sm focus:outline-none focus:border-text-muted ${Rt ? "pr-12" : ""}`
|
|
3452
3275
|
}
|
|
3453
3276
|
),
|
|
3454
|
-
/* @__PURE__ */ l("span", { className: `absolute right-2 top-1/2 -translate-y-1/2 text-[10px] ${Ce <= 50 ? Ce <= 0 ? "bg-danger-bg text-on-danger-bg px-1 rounded" : "bg-primary-bg text-on-primary-bg px-1 rounded" : "text-text-muted"}`, children:
|
|
3277
|
+
/* @__PURE__ */ l("span", { className: `absolute right-2 top-1/2 -translate-y-1/2 text-[10px] ${Ce <= 50 ? Ce <= 0 ? "bg-danger-bg text-on-danger-bg px-1 rounded" : "bg-primary-bg text-on-primary-bg px-1 rounded" : "text-text-muted"}`, children: Rt && Ce })
|
|
3455
3278
|
] }),
|
|
3456
3279
|
!N && /* @__PURE__ */ l(
|
|
3457
3280
|
"button",
|
|
3458
3281
|
{
|
|
3459
3282
|
type: "button",
|
|
3460
|
-
onClick: () =>
|
|
3283
|
+
onClick: () => S((k) => !k),
|
|
3461
3284
|
"aria-label": "Add a meme",
|
|
3462
3285
|
"aria-expanded": I,
|
|
3463
3286
|
title: "Add a meme",
|
|
3464
3287
|
"data-testid": "meme-button",
|
|
3465
3288
|
className: `shrink-0 rounded border border-border-light px-2 py-1.5 text-sm hover:border-primary ${I ? "text-text border-primary" : "text-text-secondary"}`,
|
|
3466
|
-
children: /* @__PURE__ */ l(
|
|
3289
|
+
children: /* @__PURE__ */ l(ba, { name: "image" })
|
|
3467
3290
|
}
|
|
3468
3291
|
)
|
|
3469
3292
|
] })
|
|
3470
3293
|
] }),
|
|
3471
|
-
/* @__PURE__ */ l(
|
|
3294
|
+
/* @__PURE__ */ l(pi, {})
|
|
3472
3295
|
]
|
|
3473
3296
|
}
|
|
3474
3297
|
);
|
|
3475
3298
|
}
|
|
3476
|
-
function
|
|
3299
|
+
function yi() {
|
|
3477
3300
|
const e = u((n) => n.roster), t = Object.values(e);
|
|
3478
|
-
return t.length ? /* @__PURE__ */ l("div", { className: "flex flex-col gap-1", children: t.map((n) => /* @__PURE__ */ l(
|
|
3301
|
+
return t.length ? /* @__PURE__ */ l("div", { className: "flex flex-col gap-1", children: t.map((n) => /* @__PURE__ */ l(wi, { u: n }, n.clientId)) }) : /* @__PURE__ */ l("div", { className: "text-xs text-text-muted", children: "No users online" });
|
|
3479
3302
|
}
|
|
3480
|
-
function
|
|
3303
|
+
function wi({ u: e }) {
|
|
3481
3304
|
const t = Te(e.sprite, e.avatarUrl);
|
|
3482
3305
|
return /* @__PURE__ */ y("div", { className: "flex items-center gap-2 py-0.5", children: [
|
|
3483
3306
|
/* @__PURE__ */ l(
|
|
3484
|
-
|
|
3307
|
+
At,
|
|
3485
3308
|
{
|
|
3486
3309
|
sprite: e.sprite,
|
|
3487
3310
|
url: e.avatarUrl,
|
|
@@ -3494,24 +3317,24 @@ function Ui({ u: e }) {
|
|
|
3494
3317
|
e.isLeader && /* @__PURE__ */ l("span", { className: "ml-auto px-1.5 py-0.5 rounded text-[9px] font-medium bg-success/20 text-success", children: "Leader" })
|
|
3495
3318
|
] });
|
|
3496
3319
|
}
|
|
3497
|
-
function
|
|
3498
|
-
const e = u((
|
|
3320
|
+
function vi() {
|
|
3321
|
+
const e = u((o) => Object.keys(o.roster).length), [t, n] = E(!1), a = z(null), r = z(null);
|
|
3499
3322
|
return A(() => {
|
|
3500
3323
|
if (!t) return;
|
|
3501
|
-
function
|
|
3324
|
+
function o(s) {
|
|
3502
3325
|
a.current && !a.current.contains(s.target) && n(!1);
|
|
3503
3326
|
}
|
|
3504
3327
|
function i(s) {
|
|
3505
|
-
Xe(s) && (s.stopPropagation(), n(!1),
|
|
3328
|
+
Xe(s) && (s.stopPropagation(), n(!1), r.current?.focus());
|
|
3506
3329
|
}
|
|
3507
|
-
return document.addEventListener("mousedown",
|
|
3508
|
-
document.removeEventListener("mousedown",
|
|
3330
|
+
return document.addEventListener("mousedown", o), document.addEventListener("keydown", i, !0), () => {
|
|
3331
|
+
document.removeEventListener("mousedown", o), document.removeEventListener("keydown", i, !0);
|
|
3509
3332
|
};
|
|
3510
3333
|
}, [t]), /* @__PURE__ */ y("div", { className: "relative", ref: a, children: [
|
|
3511
3334
|
/* @__PURE__ */ y(
|
|
3512
3335
|
"button",
|
|
3513
3336
|
{
|
|
3514
|
-
ref:
|
|
3337
|
+
ref: r,
|
|
3515
3338
|
"aria-expanded": t,
|
|
3516
3339
|
"aria-label": `Users (${e})`,
|
|
3517
3340
|
onClick: () => {
|
|
@@ -3530,77 +3353,77 @@ function Hi() {
|
|
|
3530
3353
|
e,
|
|
3531
3354
|
" online"
|
|
3532
3355
|
] }),
|
|
3533
|
-
/* @__PURE__ */ l(
|
|
3356
|
+
/* @__PURE__ */ l(yi, {})
|
|
3534
3357
|
] })
|
|
3535
3358
|
] });
|
|
3536
3359
|
}
|
|
3537
|
-
function
|
|
3360
|
+
function rn({ className: e = "fixed bottom-4 left-1/2 -translate-x-1/2" }) {
|
|
3538
3361
|
const t = u((a) => a.toasts), n = u((a) => a.popToast);
|
|
3539
3362
|
return A(() => {
|
|
3540
|
-
const a = t.map((
|
|
3363
|
+
const a = t.map((r) => setTimeout(() => n(r.id), 4e3));
|
|
3541
3364
|
return () => {
|
|
3542
3365
|
a.forEach(clearTimeout);
|
|
3543
3366
|
};
|
|
3544
3367
|
}, [t, n]), /* @__PURE__ */ l("div", { className: `${e} flex flex-col gap-2 z-50`, children: t.map((a) => /* @__PURE__ */ l("div", { className: `px-3 py-2 rounded text-sm shadow font-medium border ${a.kind === "error" ? "bg-danger-bg text-on-danger-bg border-danger" : "bg-bg-card border-border-light text-text"}`, children: a.msg }, a.id)) });
|
|
3545
3368
|
}
|
|
3546
|
-
const
|
|
3369
|
+
const ga = 9e3, on = 1500, ki = {
|
|
3547
3370
|
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]",
|
|
3548
3371
|
cinema: "drop-shadow-[0_2px_4px_rgba(0,0,0,0.9)]",
|
|
3549
3372
|
minimal: "drop-shadow-[0_2px_4px_rgba(0,0,0,0.9)] drop-shadow-[0_0_8px_rgba(0,0,0,0.7)]",
|
|
3550
3373
|
contrast: "bg-black/70 px-2 py-0.5 rounded"
|
|
3551
|
-
},
|
|
3374
|
+
}, fn = { WebkitTextStroke: "0.5px black", paintOrder: "stroke fill" }, sn = {
|
|
3552
3375
|
textShadow: "none",
|
|
3553
3376
|
filter: "drop-shadow(0 0 1px black) drop-shadow(0 0 1px black)"
|
|
3554
3377
|
};
|
|
3555
|
-
function
|
|
3556
|
-
const a =
|
|
3557
|
-
let
|
|
3558
|
-
t > a && (
|
|
3559
|
-
const
|
|
3378
|
+
function _i({ message: e, age: t, ccStyle: n }) {
|
|
3379
|
+
const a = ga - on;
|
|
3380
|
+
let r = 1;
|
|
3381
|
+
t > a && (r = Math.max(0, 1 - (t - a) / on));
|
|
3382
|
+
const o = ki[n], i = tt(
|
|
3560
3383
|
{ clientId: e.clientId, author: e.author },
|
|
3561
3384
|
{ name: e.name, sprite: e.sprite }
|
|
3562
3385
|
), s = Te(i.sprite, i.pictureUrl), c = i.cosmetics, [b] = E(
|
|
3563
|
-
() => e.live && e.text ?
|
|
3386
|
+
() => e.live && e.text ? mn(e.text, c) : null
|
|
3564
3387
|
);
|
|
3565
3388
|
return /* @__PURE__ */ y(
|
|
3566
3389
|
"div",
|
|
3567
3390
|
{
|
|
3568
|
-
className: `flex items-start gap-2 py-1 ${
|
|
3569
|
-
style: { opacity:
|
|
3391
|
+
className: `flex items-start gap-2 py-1 ${o}`,
|
|
3392
|
+
style: { opacity: r, transition: "opacity 0.15s ease-out", ...Un(s) },
|
|
3570
3393
|
children: [
|
|
3571
|
-
/* @__PURE__ */ l(
|
|
3394
|
+
/* @__PURE__ */ l(la, { sprite: i.sprite, url: i.pictureUrl, worn: c }),
|
|
3572
3395
|
/* @__PURE__ */ y("div", { className: "min-w-0 flex-1", children: [
|
|
3573
|
-
c ? /* @__PURE__ */ l(ye, { html:
|
|
3574
|
-
b ? /* @__PURE__ */ l(ye, { html: b, className: "text-sm text-white break-words", style:
|
|
3575
|
-
/* @__PURE__ */ l(
|
|
3396
|
+
c ? /* @__PURE__ */ l(ye, { html: gn(i.name, c), className: "text-sm mr-2", style: { color: s, ...sn } }) : /* @__PURE__ */ l("span", { className: "font-medium text-sm mr-2", style: { color: s, ...fn }, children: i.name }),
|
|
3397
|
+
b ? /* @__PURE__ */ l(ye, { html: b, className: "text-sm text-white break-words", style: sn }) : /* @__PURE__ */ l("span", { className: "text-sm text-white break-words", style: fn, children: e.text }),
|
|
3398
|
+
/* @__PURE__ */ l(ca, { images: e.images })
|
|
3576
3399
|
] })
|
|
3577
3400
|
]
|
|
3578
3401
|
}
|
|
3579
3402
|
);
|
|
3580
3403
|
}
|
|
3581
|
-
function
|
|
3582
|
-
|
|
3583
|
-
const n = u((c) => c.chat), a = u((c) => c.mediaPrefs.subtitleStyle), [
|
|
3404
|
+
function xi({ shown: e, className: t }) {
|
|
3405
|
+
Hn();
|
|
3406
|
+
const n = u((c) => c.chat), a = u((c) => c.mediaPrefs.subtitleStyle), [r, o] = E(() => Date.now()), i = n.length > 0;
|
|
3584
3407
|
A(() => {
|
|
3585
3408
|
const c = setInterval(() => {
|
|
3586
|
-
i &&
|
|
3409
|
+
i && o(Date.now());
|
|
3587
3410
|
}, 200);
|
|
3588
3411
|
return () => clearInterval(c);
|
|
3589
3412
|
}, [i]);
|
|
3590
3413
|
const s = G(() => {
|
|
3591
|
-
const c =
|
|
3414
|
+
const c = r - ga;
|
|
3592
3415
|
return n.filter((b) => !b.isSystem && b.ts > c).slice(-12);
|
|
3593
|
-
}, [n,
|
|
3416
|
+
}, [n, r]);
|
|
3594
3417
|
return !e || s.length === 0 ? null : /* @__PURE__ */ l(
|
|
3595
3418
|
"div",
|
|
3596
3419
|
{
|
|
3597
3420
|
className: `wp-floating-chat pointer-events-none flex flex-col ${t}`,
|
|
3598
3421
|
"data-testid": "floating-chat",
|
|
3599
3422
|
children: s.map((c) => /* @__PURE__ */ l(
|
|
3600
|
-
|
|
3423
|
+
_i,
|
|
3601
3424
|
{
|
|
3602
3425
|
message: c,
|
|
3603
|
-
age:
|
|
3426
|
+
age: r - c.ts,
|
|
3604
3427
|
ccStyle: a
|
|
3605
3428
|
},
|
|
3606
3429
|
c.id
|
|
@@ -3608,84 +3431,84 @@ function qi({ shown: e, className: t }) {
|
|
|
3608
3431
|
}
|
|
3609
3432
|
);
|
|
3610
3433
|
}
|
|
3611
|
-
const
|
|
3612
|
-
function
|
|
3613
|
-
return e || (
|
|
3434
|
+
const ln = (e) => typeof e == "string" && ya.includes(e);
|
|
3435
|
+
function Si(e, t, n) {
|
|
3436
|
+
return e || (ln(t) ? t : ln(n) ? n : "dark");
|
|
3614
3437
|
}
|
|
3615
|
-
function
|
|
3438
|
+
function Ti(e, t) {
|
|
3616
3439
|
if (t(e.clientWidth), typeof ResizeObserver > "u") return () => {
|
|
3617
3440
|
};
|
|
3618
3441
|
const n = new ResizeObserver(() => t(e.clientWidth));
|
|
3619
3442
|
return n.observe(e), () => n.disconnect();
|
|
3620
3443
|
}
|
|
3621
|
-
function
|
|
3444
|
+
function Ci(e) {
|
|
3622
3445
|
const t = e?.trim() ?? "";
|
|
3623
3446
|
return t ? { source: "host", name: t } : { source: "auto" };
|
|
3624
3447
|
}
|
|
3625
|
-
function
|
|
3448
|
+
function Ii(e) {
|
|
3626
3449
|
if (e.source !== "host") return;
|
|
3627
3450
|
const { setSessionIdentity: t, sprite: n } = u.getState();
|
|
3628
3451
|
t(e.name, n);
|
|
3629
3452
|
}
|
|
3630
|
-
const
|
|
3631
|
-
function
|
|
3453
|
+
const Ei = 1500;
|
|
3454
|
+
function Bi({
|
|
3632
3455
|
roomKey: e,
|
|
3633
3456
|
serverOrigin: t,
|
|
3634
3457
|
roomOrigin: n,
|
|
3635
3458
|
roomSocketPath: a,
|
|
3636
|
-
chatOrigin:
|
|
3637
|
-
chatSocketPath:
|
|
3459
|
+
chatOrigin: r,
|
|
3460
|
+
chatSocketPath: o,
|
|
3638
3461
|
userType: i,
|
|
3639
3462
|
userId: s,
|
|
3640
3463
|
theme: c,
|
|
3641
3464
|
name: b,
|
|
3642
3465
|
onLeave: p,
|
|
3643
3466
|
onLayoutChange: I,
|
|
3644
|
-
collapsible:
|
|
3467
|
+
collapsible: S = !0,
|
|
3645
3468
|
debug: N,
|
|
3646
3469
|
children: M
|
|
3647
3470
|
}) {
|
|
3648
|
-
const [h, d] = E(null), { setFrame: m, ...w } =
|
|
3649
|
-
() =>
|
|
3650
|
-
[c, O,
|
|
3471
|
+
const [h, d] = E(null), { setFrame: m, ...w } = Ai(I, S), v = u((P) => P.floatingChatEnabled), C = un(() => b), U = G(() => (ro({ userType: i, userId: s ?? null }), Tt().theme), [i, s]), F = wa(), O = F?.theme, L = G(
|
|
3472
|
+
() => Si(c, O, U),
|
|
3473
|
+
[c, O, U]
|
|
3651
3474
|
);
|
|
3652
3475
|
A(() => {
|
|
3653
3476
|
}, [c, F !== null]);
|
|
3654
3477
|
const j = G(
|
|
3655
|
-
() => ({ ...
|
|
3478
|
+
() => ({ ...kt, serverOrigin: t, defaultRoomKey: e }),
|
|
3656
3479
|
[t, e]
|
|
3657
3480
|
);
|
|
3658
3481
|
return A(() => {
|
|
3659
|
-
N &&
|
|
3660
|
-
}, [N]),
|
|
3661
|
-
|
|
3662
|
-
let
|
|
3663
|
-
const $ =
|
|
3482
|
+
N && Or();
|
|
3483
|
+
}, [N]), Sf(), A(() => {
|
|
3484
|
+
jr({ serverOrigin: t, defaultRoomKey: e }), xo(n ? { origin: n, path: a } : null), Yt(r && !n ? { origin: r, path: o } : null), u.getState().rehydrateFromPrefs(), Go();
|
|
3485
|
+
let P = !1;
|
|
3486
|
+
const $ = io();
|
|
3664
3487
|
return (async () => {
|
|
3665
3488
|
try {
|
|
3666
3489
|
await Promise.race([
|
|
3667
3490
|
Promise.all([
|
|
3668
3491
|
$,
|
|
3669
|
-
|
|
3492
|
+
go().then((oe) => {
|
|
3670
3493
|
oe && u.getState().rehydrateFromPrefs();
|
|
3671
3494
|
}),
|
|
3672
3495
|
// The character chosen in the settings popout (lib/avatar.ts).
|
|
3673
|
-
|
|
3496
|
+
Mo().then(sa)
|
|
3674
3497
|
]),
|
|
3675
|
-
new Promise((oe) => setTimeout(oe,
|
|
3498
|
+
new Promise((oe) => setTimeout(oe, Ei))
|
|
3676
3499
|
]);
|
|
3677
3500
|
} catch (oe) {
|
|
3678
|
-
|
|
3501
|
+
R("room-chrome", "pre-join wait threw, proceeding anyway", xe(oe));
|
|
3679
3502
|
}
|
|
3680
|
-
if (
|
|
3681
|
-
const
|
|
3682
|
-
u.getState().ensureAutoIdentity(),
|
|
3503
|
+
if (P) return;
|
|
3504
|
+
const H = Ci(C());
|
|
3505
|
+
u.getState().ensureAutoIdentity(), Ii(H);
|
|
3683
3506
|
const le = u.getState();
|
|
3684
|
-
g("room-chrome", "Joining room", { roomKey: e, name: le.name, sprite: le.sprite }),
|
|
3507
|
+
g("room-chrome", "Joining room", { roomKey: e, name: le.name, sprite: le.sprite }), nf({ room_key: e, name: le.name || void 0, sprite: le.sprite || void 0 });
|
|
3685
3508
|
})(), () => {
|
|
3686
|
-
|
|
3509
|
+
P = !0, tn(), Yt(null);
|
|
3687
3510
|
};
|
|
3688
|
-
}, [e, t, n, a,
|
|
3511
|
+
}, [e, t, n, a, r, o, i, s]), /* @__PURE__ */ l(Pr.Provider, { value: j, children: /* @__PURE__ */ l(On.Provider, { value: !1, children: /* @__PURE__ */ l(Dn.Provider, { value: h, children: /* @__PURE__ */ y("div", { ref: m, className: "wp-room-chrome-frame", children: [
|
|
3689
3512
|
/* @__PURE__ */ l("div", { className: "wp-room-chrome-frame__content", children: M }),
|
|
3690
3513
|
/* @__PURE__ */ l(
|
|
3691
3514
|
"aside",
|
|
@@ -3695,7 +3518,7 @@ function ls({
|
|
|
3695
3518
|
"data-theme": L,
|
|
3696
3519
|
"data-collapsed": w.collapsed ? "1" : "0",
|
|
3697
3520
|
style: { "--wp-room-chrome-width": `${w.state.width}px` },
|
|
3698
|
-
onAnimationEnd: (
|
|
3521
|
+
onAnimationEnd: (P) => Pa(P.nativeEvent),
|
|
3699
3522
|
children: w.collapsed ? /* @__PURE__ */ y(ee, { children: [
|
|
3700
3523
|
/* @__PURE__ */ l(
|
|
3701
3524
|
"button",
|
|
@@ -3705,11 +3528,11 @@ function ls({
|
|
|
3705
3528
|
title: "Show chat",
|
|
3706
3529
|
"aria-label": "Show chat",
|
|
3707
3530
|
"aria-expanded": !1,
|
|
3708
|
-
children: /* @__PURE__ */ l(
|
|
3531
|
+
children: /* @__PURE__ */ l(Kf, {})
|
|
3709
3532
|
}
|
|
3710
3533
|
),
|
|
3711
|
-
/* @__PURE__ */ l(
|
|
3712
|
-
/* @__PURE__ */ l(
|
|
3534
|
+
/* @__PURE__ */ l(rn, { className: "absolute bottom-2 right-full mr-2 w-72" }),
|
|
3535
|
+
/* @__PURE__ */ l(xi, { shown: v, className: "wp-room-chrome__floating" })
|
|
3713
3536
|
] }) : /* @__PURE__ */ y(ee, { children: [
|
|
3714
3537
|
/* @__PURE__ */ l(
|
|
3715
3538
|
"div",
|
|
@@ -3718,7 +3541,7 @@ function ls({
|
|
|
3718
3541
|
"aria-orientation": "vertical",
|
|
3719
3542
|
"aria-label": "Resize chat",
|
|
3720
3543
|
"aria-valuemin": Ge,
|
|
3721
|
-
"aria-valuemax":
|
|
3544
|
+
"aria-valuemax": Ct,
|
|
3722
3545
|
"aria-valuenow": w.state.width,
|
|
3723
3546
|
tabIndex: 0,
|
|
3724
3547
|
className: "wp-room-chrome__resize",
|
|
@@ -3731,13 +3554,13 @@ function ls({
|
|
|
3731
3554
|
}
|
|
3732
3555
|
),
|
|
3733
3556
|
/* @__PURE__ */ y("div", { className: "flex items-center gap-1 px-2 py-1.5 border-b border-border", children: [
|
|
3734
|
-
/* @__PURE__ */ l(
|
|
3557
|
+
/* @__PURE__ */ l(vi, {}),
|
|
3735
3558
|
/* @__PURE__ */ l("div", { className: "flex-1" }),
|
|
3736
3559
|
p && /* @__PURE__ */ l(
|
|
3737
3560
|
"button",
|
|
3738
3561
|
{
|
|
3739
3562
|
onClick: () => {
|
|
3740
|
-
|
|
3563
|
+
tn(), p();
|
|
3741
3564
|
},
|
|
3742
3565
|
className: "wp-room-chrome__leave",
|
|
3743
3566
|
title: "Leave room",
|
|
@@ -3745,7 +3568,7 @@ function ls({
|
|
|
3745
3568
|
children: "Leave"
|
|
3746
3569
|
}
|
|
3747
3570
|
),
|
|
3748
|
-
|
|
3571
|
+
S && /* @__PURE__ */ l(
|
|
3749
3572
|
"button",
|
|
3750
3573
|
{
|
|
3751
3574
|
onClick: w.toggleCollapsed,
|
|
@@ -3753,25 +3576,25 @@ function ls({
|
|
|
3753
3576
|
title: "Hide chat",
|
|
3754
3577
|
"aria-label": "Hide chat",
|
|
3755
3578
|
"aria-expanded": !0,
|
|
3756
|
-
children: /* @__PURE__ */ l(
|
|
3579
|
+
children: /* @__PURE__ */ l(Vf, {})
|
|
3757
3580
|
}
|
|
3758
3581
|
)
|
|
3759
3582
|
] }),
|
|
3760
|
-
/* @__PURE__ */ l(
|
|
3761
|
-
/* @__PURE__ */ l(
|
|
3762
|
-
/* @__PURE__ */ l(
|
|
3583
|
+
/* @__PURE__ */ l(ei, {}),
|
|
3584
|
+
/* @__PURE__ */ l(bi, { commands: [] }),
|
|
3585
|
+
/* @__PURE__ */ l(rn, { className: "absolute bottom-14 left-2 right-2" })
|
|
3763
3586
|
] })
|
|
3764
3587
|
}
|
|
3765
3588
|
)
|
|
3766
3589
|
] }) }) }) });
|
|
3767
3590
|
}
|
|
3768
|
-
function
|
|
3769
|
-
const n = u((v) => v.chromeChatCollapsed) && t, a = u((v) => v.chromeChatWidth),
|
|
3591
|
+
function Ai(e, t) {
|
|
3592
|
+
const n = u((v) => v.chromeChatCollapsed) && t, a = u((v) => v.chromeChatWidth), r = u((v) => v.toggleChromeChatCollapsed), o = u((v) => v.setChromeChatWidth), [i, s] = E(null), [c, b] = E(void 0), [p, I] = E(null);
|
|
3770
3593
|
A(() => {
|
|
3771
3594
|
if (i)
|
|
3772
|
-
return
|
|
3595
|
+
return Ti(i, b);
|
|
3773
3596
|
}, [i]);
|
|
3774
|
-
const
|
|
3597
|
+
const S = Q(p?.current ?? a, c), N = G(() => wo(n, S), [n, S]), M = un((v) => e?.(v));
|
|
3775
3598
|
return A(() => {
|
|
3776
3599
|
M(N);
|
|
3777
3600
|
}, [N]), {
|
|
@@ -3779,25 +3602,25 @@ function Ki(e, t) {
|
|
|
3779
3602
|
collapsed: n,
|
|
3780
3603
|
state: N,
|
|
3781
3604
|
dragging: p !== null,
|
|
3782
|
-
toggleCollapsed:
|
|
3605
|
+
toggleCollapsed: r,
|
|
3783
3606
|
onPointerDown: (v) => {
|
|
3784
|
-
v.button === 0 && (v.preventDefault(), v.currentTarget.setPointerCapture(v.pointerId), I({ pointerId: v.pointerId, startX: v.clientX, startWidth:
|
|
3607
|
+
v.button === 0 && (v.preventDefault(), v.currentTarget.setPointerCapture(v.pointerId), I({ pointerId: v.pointerId, startX: v.clientX, startWidth: S, current: S }));
|
|
3785
3608
|
},
|
|
3786
3609
|
onPointerMove: (v) => {
|
|
3787
|
-
!p || p.pointerId !== v.pointerId || I({ ...p, current:
|
|
3610
|
+
!p || p.pointerId !== v.pointerId || I({ ...p, current: Kt(p.startWidth, p.startX, v.clientX, c) });
|
|
3788
3611
|
},
|
|
3789
3612
|
onPointerEnd: (v) => {
|
|
3790
3613
|
if (!p || p.pointerId !== v.pointerId) return;
|
|
3791
|
-
const C =
|
|
3792
|
-
I(null), C !== a &&
|
|
3614
|
+
const C = Kt(p.startWidth, p.startX, v.clientX, c);
|
|
3615
|
+
I(null), C !== a && o(C);
|
|
3793
3616
|
},
|
|
3794
3617
|
onKeyDown: (v) => {
|
|
3795
|
-
const C =
|
|
3796
|
-
C !== null && (v.preventDefault(), C !== a &&
|
|
3618
|
+
const C = yo(S, v.key, c);
|
|
3619
|
+
C !== null && (v.preventDefault(), C !== a && o(C));
|
|
3797
3620
|
}
|
|
3798
3621
|
};
|
|
3799
3622
|
}
|
|
3800
3623
|
export {
|
|
3801
|
-
|
|
3624
|
+
Bi as RoomChrome
|
|
3802
3625
|
};
|
|
3803
3626
|
//# sourceMappingURL=room-chrome.js.map
|