@nivaro/react 0.2.55 → 0.3.0
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/components/slots/TasksSlot.js +31 -29
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +101 -1
- package/dist/index.js +538 -525
- package/dist/shared/components/ItemEditForm.js +666 -658
- package/dist/shared/components/MyWorkView.js +47 -37
- package/dist/shared/components/ProfileView.js +163 -144
- package/dist/shared/components/ai/AiPlanCard.js +427 -0
- package/dist/shared/components/ai/AiPlanChanges.js +117 -0
- package/dist/shared/components/ai/TaskDo.js +1022 -0
- package/dist/shared/components/chat/ChatAnalyticsView.js +19 -17
- package/dist/shared/components/chat/ChatPanel.js +1356 -1317
- package/dist/shared/components/chat/HuddleAnalyticsTab.js +198 -0
- package/dist/shared/components/chat/RoomHeaderMenu.js +78 -65
- package/dist/shared/components/chat/chat-core.js +273 -264
- package/dist/shared/components/chat/huddle/HuddleAudioUi.js +397 -0
- package/dist/shared/components/chat/huddle/HuddleCallBar.js +296 -0
- package/dist/shared/components/chat/huddle/HuddleCallLayer.js +180 -0
- package/dist/shared/components/chat/huddle/HuddleCamera.js +124 -0
- package/dist/shared/components/chat/huddle/HuddleCollab.js +320 -0
- package/dist/shared/components/chat/huddle/HuddleControls.js +82 -121
- package/dist/shared/components/chat/huddle/HuddleDraw.js +231 -0
- package/dist/shared/components/chat/huddle/HuddleLiveBadge.js +52 -0
- package/dist/shared/components/chat/huddle/HuddlePeoplePicker.js +143 -0
- package/dist/shared/components/chat/huddle/HuddleScheduleCard.js +190 -0
- package/dist/shared/components/chat/huddle/HuddleScheduleForm.js +188 -0
- package/dist/shared/components/chat/huddle/HuddleStage.js +184 -89
- package/dist/shared/components/chat/huddle/HuddleStageTools.js +197 -0
- package/dist/shared/components/chat/huddle/huddle-audio-logic.js +156 -0
- package/dist/shared/components/chat/huddle/huddle-audio.js +69 -0
- package/dist/shared/components/chat/huddle/huddle-calls.js +129 -0
- package/dist/shared/components/chat/huddle/huddle-camera.js +143 -0
- package/dist/shared/components/chat/huddle/huddle-collab-store.js +391 -0
- package/dist/shared/components/chat/huddle/huddle-device-prefs.js +55 -0
- package/dist/shared/components/chat/huddle/huddle-devices.js +99 -0
- package/dist/shared/components/chat/huddle/huddle-draw.js +226 -0
- package/dist/shared/components/chat/huddle/huddle-follow-bus.js +96 -0
- package/dist/shared/components/chat/huddle/huddle-hold.js +62 -0
- package/dist/shared/components/chat/huddle/huddle-link-quality.js +159 -0
- package/dist/shared/components/chat/huddle/huddle-live.js +82 -0
- package/dist/shared/components/chat/huddle/huddle-pip.js +343 -0
- package/dist/shared/components/chat/huddle/huddle-quality.js +22 -0
- package/dist/shared/components/chat/huddle/huddle-reactions.js +71 -0
- package/dist/shared/components/chat/huddle/huddle-ring-refused.js +34 -0
- package/dist/shared/components/chat/huddle/huddle-schedule.js +102 -0
- package/dist/shared/components/chat/huddle/huddle-sfu.js +176 -0
- package/dist/shared/components/chat/huddle/huddle-shortcuts.js +91 -0
- package/dist/shared/components/chat/huddle/huddle-speaking.js +100 -0
- package/dist/shared/components/chat/huddle/huddle-store.js +431 -157
- package/dist/shared/components/chat/huddle/useHuddle.js +46 -38
- package/dist/shared/components/chat/huddle/useHuddleAudio.js +35 -0
- package/dist/shared/components/item-edit/GroupSection.js +1 -0
- package/dist/shared/components/item-edit/RecordChatActions.js +68 -59
- package/dist/shared/components/item-edit/UserChip.js +145 -142
- package/dist/shared/components/panels/TaskPanel.js +51 -49
- package/dist/shared/components/support/TicketDetailSheet.js +57 -42
- package/dist/shared/lib/notification-sound.js +25 -16
- package/dist/shared/lib/stale-chunk.js +60 -0
- package/package.json +2 -1
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
import { readItems as J } from "@nivaro/sdk";
|
|
2
2
|
import { useQueryClient as v, useMutation as h, useQuery as y } from "@tanstack/react-query";
|
|
3
|
-
import { useContext as Z, useState as
|
|
3
|
+
import { useContext as Z, useState as L, useEffect as $, useMemo as k, useCallback as M, useRef as U, createContext as X } from "react";
|
|
4
4
|
import { toast as ee } from "sonner";
|
|
5
5
|
import { useNivaroClient as m } from "../../context.js";
|
|
6
|
-
import { get as g, patch as C, post as K, del as
|
|
6
|
+
import { get as g, patch as C, post as K, del as A } from "../../lib/commands.js";
|
|
7
7
|
import { isDndActive as te } from "../../lib/dnd.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
import { huddleHolds as ne, holdNotification as se } from "./huddle/huddle-hold.js";
|
|
9
|
+
import { playNotificationSound as re } from "../../lib/notification-sound.js";
|
|
10
|
+
import { announceLocalPrefs as oe } from "../../lib/user-sync.js";
|
|
11
|
+
import { bindChatOutbox as ae, enqueueChatOutbox as ie } from "./chat-outbox.js";
|
|
12
|
+
import { discardOutbox as _t, editOutbox as Ct, holdOutbox as Rt, nudgeChatOutbox as wt, retryOutbox as Tt, useOutbox as St } from "./chat-outbox.js";
|
|
13
|
+
const Me = ["👍", "✅", "👀", "🎉", "❤️", "😂"], ce = X(null);
|
|
14
|
+
function b() {
|
|
15
|
+
const e = Z(ce);
|
|
15
16
|
if (!e) throw new Error("Chat components must be wrapped in <ChatProvider>");
|
|
16
17
|
return e;
|
|
17
18
|
}
|
|
18
|
-
const
|
|
19
|
+
const Ie = 0, ke = {
|
|
19
20
|
collections: { messages: "chat_messages", reads: "chat_last_read", presence: "user_presence" },
|
|
20
21
|
globalRoom: "global",
|
|
21
22
|
globalLabel: "General",
|
|
22
23
|
entityPattern: String.raw`\b([A-Za-z]{2,4}\d{2}(?:INV)?-\d+)\b`
|
|
23
24
|
};
|
|
24
|
-
function
|
|
25
|
+
function xe(e, t) {
|
|
25
26
|
return `dm:${[e.toUpperCase(), t.toUpperCase()].sort().join(":")}`;
|
|
26
27
|
}
|
|
27
28
|
function B(e, t) {
|
|
@@ -29,8 +30,8 @@ function B(e, t) {
|
|
|
29
30
|
const s = e.slice(3);
|
|
30
31
|
return [s.slice(0, 36), s.slice(37)].find((o) => o.toLowerCase() !== t.toLowerCase()) ?? null;
|
|
31
32
|
}
|
|
32
|
-
function
|
|
33
|
-
const s =
|
|
33
|
+
function O(e, t) {
|
|
34
|
+
const s = b(), n = v(), o = (t ?? []).join("|");
|
|
34
35
|
$(() => {
|
|
35
36
|
const r = () => {
|
|
36
37
|
for (const a of e) n.invalidateQueries({ queryKey: a });
|
|
@@ -39,8 +40,8 @@ function F(e, t) {
|
|
|
39
40
|
if (s.realtime) return s.realtime(s.collections.messages, r);
|
|
40
41
|
}, [s.subscribeRooms, s.realtime, o, n]);
|
|
41
42
|
}
|
|
42
|
-
function
|
|
43
|
-
const s =
|
|
43
|
+
function ue(e, t) {
|
|
44
|
+
const s = b(), n = v();
|
|
44
45
|
$(() => {
|
|
45
46
|
if (s.realtime)
|
|
46
47
|
return s.realtime(e, () => {
|
|
@@ -48,9 +49,9 @@ function ie(e, t) {
|
|
|
48
49
|
});
|
|
49
50
|
}, [s.realtime, e, n]);
|
|
50
51
|
}
|
|
51
|
-
function
|
|
52
|
-
var
|
|
53
|
-
const s =
|
|
52
|
+
function Le(e, t = null) {
|
|
53
|
+
var D, N, E;
|
|
54
|
+
const s = b(), n = m(), o = t ? "around" in t ? `around:${t.around}` : `date:${t.date}` : "latest", { data: r, isLoading: a } = y({
|
|
54
55
|
queryKey: ["nvr-chat", e, o],
|
|
55
56
|
queryFn: async () => {
|
|
56
57
|
const _ = { room: e, limit: 80 };
|
|
@@ -62,43 +63,43 @@ function Me(e, t = null) {
|
|
|
62
63
|
staleTime: 5e3,
|
|
63
64
|
refetchInterval: s.realtime || s.subscribeRooms ? void 0 : 1e4
|
|
64
65
|
});
|
|
65
|
-
|
|
66
|
-
const [
|
|
66
|
+
O([["nvr-chat"], ["nvr-chat-rooms"], ["nvr-chat-thread"]], e ? [e] : []);
|
|
67
|
+
const [i, c] = L([]), [f, u] = L(null), [l, d] = L(!1);
|
|
67
68
|
$(() => {
|
|
68
|
-
|
|
69
|
+
c([]), u(null);
|
|
69
70
|
}, [e, o]);
|
|
70
|
-
const
|
|
71
|
-
if (
|
|
72
|
-
const _ = new Set(
|
|
73
|
-
return [...
|
|
74
|
-
}, [
|
|
71
|
+
const q = (r == null ? void 0 : r.data) ?? [], p = k(() => {
|
|
72
|
+
if (i.length === 0) return q;
|
|
73
|
+
const _ = new Set(q.map((R) => R.id));
|
|
74
|
+
return [...i.filter((R) => !_.has(R.id)), ...q];
|
|
75
|
+
}, [i, q]), F = M(async () => {
|
|
75
76
|
var R;
|
|
76
|
-
if (!e ||
|
|
77
|
-
const _ =
|
|
77
|
+
if (!e || l) return;
|
|
78
|
+
const _ = p[0];
|
|
78
79
|
if (_) {
|
|
79
|
-
|
|
80
|
+
d(!0);
|
|
80
81
|
try {
|
|
81
|
-
const
|
|
82
|
+
const P = await n.request(
|
|
82
83
|
g("/chat/messages", { room: e, limit: 60, before: _.id })
|
|
83
84
|
);
|
|
84
|
-
|
|
85
|
+
c((Y) => [...P.data ?? [], ...Y]), u(!!((R = P.meta) != null && R.has_older));
|
|
85
86
|
} finally {
|
|
86
|
-
|
|
87
|
+
d(!1);
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
|
-
}, [e,
|
|
90
|
+
}, [e, p, n, l]);
|
|
90
91
|
return {
|
|
91
|
-
messages:
|
|
92
|
+
messages: p,
|
|
92
93
|
loading: a,
|
|
93
|
-
hasOlder:
|
|
94
|
-
hasNewer: !!((
|
|
95
|
-
anchorId: ((
|
|
96
|
-
loadOlder:
|
|
97
|
-
loadingOlder:
|
|
94
|
+
hasOlder: f ?? !!((D = r == null ? void 0 : r.meta) != null && D.has_older),
|
|
95
|
+
hasNewer: !!((N = r == null ? void 0 : r.meta) != null && N.has_newer),
|
|
96
|
+
anchorId: ((E = r == null ? void 0 : r.meta) == null ? void 0 : E.anchor) ?? null,
|
|
97
|
+
loadOlder: F,
|
|
98
|
+
loadingOlder: l
|
|
98
99
|
};
|
|
99
100
|
}
|
|
100
|
-
function
|
|
101
|
-
const s =
|
|
101
|
+
function Qe(e, t) {
|
|
102
|
+
const s = b(), n = m(), { data: o, isLoading: r } = y({
|
|
102
103
|
queryKey: ["nvr-chat-thread", e, t],
|
|
103
104
|
queryFn: async () => (await n.request(
|
|
104
105
|
g("/chat/messages", { room: e, thread: t, limit: 300 })
|
|
@@ -107,39 +108,39 @@ function Ie(e, t) {
|
|
|
107
108
|
staleTime: 5e3,
|
|
108
109
|
refetchInterval: s.realtime || s.subscribeRooms ? void 0 : 1e4
|
|
109
110
|
});
|
|
110
|
-
|
|
111
|
+
O([["nvr-chat-thread"]], e ? [e] : []);
|
|
111
112
|
const a = o ?? [];
|
|
112
113
|
return {
|
|
113
|
-
root: a.find((
|
|
114
|
-
replies: a.filter((
|
|
114
|
+
root: a.find((i) => i.id === t) ?? null,
|
|
115
|
+
replies: a.filter((i) => i.id !== t),
|
|
115
116
|
loading: r
|
|
116
117
|
};
|
|
117
118
|
}
|
|
118
|
-
function
|
|
119
|
-
var r, a,
|
|
120
|
-
const t = m(), s = v(), n =
|
|
121
|
-
return
|
|
122
|
-
(
|
|
123
|
-
var
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
client_id:
|
|
119
|
+
function Ue(e) {
|
|
120
|
+
var r, a, i;
|
|
121
|
+
const t = m(), s = v(), n = b();
|
|
122
|
+
return ae(t, s, ((r = n.me) == null ? void 0 : r.id) ?? null), { mutate: M(
|
|
123
|
+
(c) => {
|
|
124
|
+
var u, l;
|
|
125
|
+
const f = typeof c == "string" ? { text: c } : c;
|
|
126
|
+
ie({
|
|
127
|
+
client_id: le(),
|
|
127
128
|
room: e,
|
|
128
|
-
text:
|
|
129
|
-
mentions:
|
|
130
|
-
attachments:
|
|
131
|
-
parent_id:
|
|
132
|
-
quote_id:
|
|
133
|
-
urgent: !!
|
|
129
|
+
text: f.text,
|
|
130
|
+
mentions: f.mentions ?? [],
|
|
131
|
+
attachments: f.attachments ?? [],
|
|
132
|
+
parent_id: f.parentId ?? null,
|
|
133
|
+
quote_id: f.quoteId ?? null,
|
|
134
|
+
urgent: !!f.urgent,
|
|
134
135
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
135
|
-
sender: ((
|
|
136
|
-
sender_name: ((
|
|
136
|
+
sender: ((u = n.me) == null ? void 0 : u.id) ?? "",
|
|
137
|
+
sender_name: ((l = n.me) == null ? void 0 : l.name) ?? null
|
|
137
138
|
});
|
|
138
139
|
},
|
|
139
|
-
[e, (a = n.me) == null ? void 0 : a.id, (
|
|
140
|
+
[e, (a = n.me) == null ? void 0 : a.id, (i = n.me) == null ? void 0 : i.name]
|
|
140
141
|
), isPending: !1 };
|
|
141
142
|
}
|
|
142
|
-
function
|
|
143
|
+
function le() {
|
|
143
144
|
var t;
|
|
144
145
|
const e = globalThis.crypto;
|
|
145
146
|
return ((t = e == null ? void 0 : e.randomUUID) == null ? void 0 : t.call(e)) ?? `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
|
|
@@ -147,18 +148,18 @@ function ce() {
|
|
|
147
148
|
function G(e, t, s) {
|
|
148
149
|
const n = (t == null ? void 0 : t.toLowerCase()) ?? "";
|
|
149
150
|
return e.map((r) => {
|
|
150
|
-
var
|
|
151
|
-
const a = r.kind === "unknown" ? "entity" : r.kind,
|
|
151
|
+
var c, f, u, l, d;
|
|
152
|
+
const a = r.kind === "unknown" ? "entity" : r.kind, i = a === "global" ? (
|
|
152
153
|
// The server names General only when an admin renamed it.
|
|
153
154
|
r.label ?? s.globalLabel
|
|
154
155
|
) : a === "dm" ? (
|
|
155
156
|
// The server resolves the peer's name from the user table; the
|
|
156
157
|
// message sender is only a fallback for hosts that don't send one.
|
|
157
|
-
r.label ?? (((
|
|
158
|
-
) : r.label ?? ((
|
|
158
|
+
r.label ?? (((f = (c = r.last_message) == null ? void 0 : c.sender) == null ? void 0 : f.toLowerCase()) !== n ? ((u = r.last_message) == null ? void 0 : u.sender_name) ?? null : null) ?? `User ${((l = B(r.room, n)) == null ? void 0 : l.slice(0, 8)) ?? ""}`
|
|
159
|
+
) : r.label ?? ((d = s.roomLabel) == null ? void 0 : d.call(s, r.room)) ?? r.room.toUpperCase();
|
|
159
160
|
return {
|
|
160
161
|
room: r.room,
|
|
161
|
-
label:
|
|
162
|
+
label: i,
|
|
162
163
|
kind: a,
|
|
163
164
|
lastMessage: r.last_message,
|
|
164
165
|
unread: r.unread,
|
|
@@ -174,35 +175,35 @@ function G(e, t, s) {
|
|
|
174
175
|
}).sort((r, a) => {
|
|
175
176
|
if (r.kind === "global") return -1;
|
|
176
177
|
if (a.kind === "global") return 1;
|
|
177
|
-
const
|
|
178
|
-
return (a.lastMessage ? new Date(a.lastMessage.date_created).getTime() : 0) -
|
|
178
|
+
const i = r.lastMessage ? new Date(r.lastMessage.date_created).getTime() : 0;
|
|
179
|
+
return (a.lastMessage ? new Date(a.lastMessage.date_created).getTime() : 0) - i;
|
|
179
180
|
});
|
|
180
181
|
}
|
|
181
|
-
function
|
|
182
|
-
const e =
|
|
182
|
+
function Ae() {
|
|
183
|
+
const e = b(), t = m(), s = e.me, n = y({
|
|
183
184
|
queryKey: ["nvr-chat-rooms", s == null ? void 0 : s.id],
|
|
184
185
|
queryFn: async () => (await t.request(g("/chat/rooms"))).data ?? [],
|
|
185
186
|
enabled: !!s,
|
|
186
187
|
refetchInterval: 45e3,
|
|
187
188
|
staleTime: 1e4
|
|
188
189
|
});
|
|
189
|
-
|
|
190
|
-
const o =
|
|
190
|
+
O([["nvr-chat-rooms"]]);
|
|
191
|
+
const o = k(
|
|
191
192
|
() => G(n.data ?? [], s == null ? void 0 : s.id, e),
|
|
192
193
|
[n.data, s == null ? void 0 : s.id, e]
|
|
193
|
-
), r =
|
|
194
|
-
var
|
|
195
|
-
if (
|
|
194
|
+
), r = x().chat_badge_mode, a = o.reduce((i, c) => {
|
|
195
|
+
var f;
|
|
196
|
+
if (c.muted) return i;
|
|
196
197
|
if (r === "conversations") {
|
|
197
|
-
const
|
|
198
|
-
return
|
|
198
|
+
const u = c.kind === "dm" || c.kind === "channel" && !!((f = c.channel) != null && f.is_direct);
|
|
199
|
+
return i + (u ? c.unread : c.mentions ?? 0);
|
|
199
200
|
}
|
|
200
|
-
return
|
|
201
|
+
return i + c.unread;
|
|
201
202
|
}, 0);
|
|
202
203
|
return { rooms: o, totalUnread: a, loading: n.isLoading };
|
|
203
204
|
}
|
|
204
|
-
function
|
|
205
|
-
const t =
|
|
205
|
+
function De(e) {
|
|
206
|
+
const t = b(), s = m(), n = t.me, o = y({
|
|
206
207
|
queryKey: ["nvr-chat-rooms", n == null ? void 0 : n.id, "archived"],
|
|
207
208
|
queryFn: async () => (await s.request(
|
|
208
209
|
g("/chat/rooms", { archived: "1" })
|
|
@@ -210,9 +211,9 @@ function Qe(e) {
|
|
|
210
211
|
enabled: !!n && e,
|
|
211
212
|
staleTime: 1e4
|
|
212
213
|
});
|
|
213
|
-
return { rooms:
|
|
214
|
+
return { rooms: k(() => G(o.data ?? [], n == null ? void 0 : n.id, t), [o.data, n == null ? void 0 : n.id, t]), loading: o.isLoading };
|
|
214
215
|
}
|
|
215
|
-
function
|
|
216
|
+
function Ne(e) {
|
|
216
217
|
const t = m(), { data: s, isLoading: n } = y({
|
|
217
218
|
queryKey: ["nvr-chat-directory", e],
|
|
218
219
|
queryFn: async () => (await t.request(
|
|
@@ -222,38 +223,38 @@ function xe(e) {
|
|
|
222
223
|
});
|
|
223
224
|
return { channels: s ?? [], loading: n };
|
|
224
225
|
}
|
|
225
|
-
function
|
|
226
|
+
function Ee() {
|
|
226
227
|
const e = m(), t = v(), s = () => {
|
|
227
228
|
t.invalidateQueries({ queryKey: ["nvr-chat-rooms"] }), t.invalidateQueries({ queryKey: ["nvr-chat-directory"] });
|
|
228
229
|
}, n = h({
|
|
229
|
-
mutationFn: (
|
|
230
|
+
mutationFn: (u) => e.request(K(`/chat/rooms/${encodeURIComponent(u)}/join`)),
|
|
230
231
|
onSuccess: s
|
|
231
232
|
}), o = h({
|
|
232
|
-
mutationFn: (
|
|
233
|
+
mutationFn: (u) => e.request(A(`/chat/rooms/${encodeURIComponent(u)}/join`)),
|
|
233
234
|
onSuccess: s
|
|
234
235
|
}), r = h({
|
|
235
|
-
mutationFn: ({ room:
|
|
236
|
+
mutationFn: ({ room: u, muted: l }) => e.request(C(`/chat/rooms/${encodeURIComponent(u)}`, { muted: l })),
|
|
236
237
|
onSuccess: s
|
|
237
238
|
}), a = h({
|
|
238
|
-
mutationFn: ({ room:
|
|
239
|
-
C(`/chat/rooms/${encodeURIComponent(
|
|
240
|
-
notify_mode:
|
|
239
|
+
mutationFn: ({ room: u, mode: l }) => e.request(
|
|
240
|
+
C(`/chat/rooms/${encodeURIComponent(u)}`, {
|
|
241
|
+
notify_mode: l === "mentions" ? "mentions" : null
|
|
241
242
|
})
|
|
242
243
|
),
|
|
243
244
|
onSuccess: s
|
|
244
|
-
}),
|
|
245
|
-
mutationFn: ({ room:
|
|
245
|
+
}), i = h({
|
|
246
|
+
mutationFn: ({ room: u, archived: l }) => e.request(C(`/chat/rooms/${encodeURIComponent(u)}`, { archived: l })),
|
|
246
247
|
onSuccess: s
|
|
247
|
-
}),
|
|
248
|
-
mutationFn: ({ room:
|
|
248
|
+
}), c = h({
|
|
249
|
+
mutationFn: ({ room: u, starred: l }) => e.request(C(`/chat/rooms/${encodeURIComponent(u)}`, { starred: l })),
|
|
249
250
|
onSuccess: s
|
|
250
|
-
}),
|
|
251
|
-
mutationFn: (
|
|
251
|
+
}), f = h({
|
|
252
|
+
mutationFn: (u) => e.request(C(`/chat/rooms/${encodeURIComponent(u)}`, { welcome_seen: !0 })),
|
|
252
253
|
onSuccess: s
|
|
253
254
|
});
|
|
254
|
-
return { join: n, leave: o, setMuted: r, setNotifyMode: a, setArchived:
|
|
255
|
+
return { join: n, leave: o, setMuted: r, setNotifyMode: a, setArchived: i, setStarred: c, dismissWelcome: f };
|
|
255
256
|
}
|
|
256
|
-
function
|
|
257
|
+
function Pe(e) {
|
|
257
258
|
const t = m(), { data: s, isLoading: n } = y({
|
|
258
259
|
queryKey: ["nvr-chat-members", e],
|
|
259
260
|
queryFn: async () => (await t.request(
|
|
@@ -264,22 +265,22 @@ function De(e) {
|
|
|
264
265
|
});
|
|
265
266
|
return { members: s ?? [], loading: n };
|
|
266
267
|
}
|
|
267
|
-
function
|
|
268
|
+
function je(e) {
|
|
268
269
|
const t = m(), s = v(), n = () => {
|
|
269
270
|
s.invalidateQueries({ queryKey: ["nvr-chat-members", e] }), s.invalidateQueries({ queryKey: ["nvr-chat-rooms"] }), s.invalidateQueries({ queryKey: ["nvr-chat-directory"] });
|
|
270
271
|
}, o = h({
|
|
271
|
-
mutationFn: (
|
|
272
|
+
mutationFn: (i) => t.request(C(`/chat/channels/${e}`, i)),
|
|
272
273
|
onSuccess: n
|
|
273
274
|
}), r = h({
|
|
274
|
-
mutationFn: (
|
|
275
|
+
mutationFn: (i) => t.request(K(`/chat/channels/${e}/members`, { user_id: i })),
|
|
275
276
|
onSuccess: n
|
|
276
277
|
}), a = h({
|
|
277
|
-
mutationFn: (
|
|
278
|
+
mutationFn: (i) => t.request(A(`/chat/channels/${e}/members/${i}`)),
|
|
278
279
|
onSuccess: n
|
|
279
280
|
});
|
|
280
281
|
return { update: o, addMember: r, removeMember: a };
|
|
281
282
|
}
|
|
282
|
-
function
|
|
283
|
+
function ze() {
|
|
283
284
|
const e = m(), { data: t } = y({
|
|
284
285
|
queryKey: ["nvr-chat-roles"],
|
|
285
286
|
queryFn: async () => (await e.request(
|
|
@@ -289,7 +290,7 @@ function Ee() {
|
|
|
289
290
|
});
|
|
290
291
|
return t ?? [];
|
|
291
292
|
}
|
|
292
|
-
function
|
|
293
|
+
function He(e, t) {
|
|
293
294
|
const s = m(), { data: n, isLoading: o } = y({
|
|
294
295
|
queryKey: ["nvr-chat-user-search", e],
|
|
295
296
|
queryFn: async () => (await s.request(
|
|
@@ -300,7 +301,7 @@ function Ne(e, t) {
|
|
|
300
301
|
});
|
|
301
302
|
return { users: n ?? [], loading: o };
|
|
302
303
|
}
|
|
303
|
-
function
|
|
304
|
+
function Be() {
|
|
304
305
|
const e = m(), t = v();
|
|
305
306
|
return h({
|
|
306
307
|
mutationFn: (s) => e.request(K("/chat/channels", s)),
|
|
@@ -309,14 +310,14 @@ function Pe() {
|
|
|
309
310
|
}
|
|
310
311
|
});
|
|
311
312
|
}
|
|
312
|
-
let
|
|
313
|
-
const
|
|
314
|
-
function
|
|
313
|
+
let j = 0;
|
|
314
|
+
const Q = /* @__PURE__ */ new Map();
|
|
315
|
+
function z(e) {
|
|
315
316
|
var t;
|
|
316
317
|
return e.kind === "dm" || e.kind === "channel" && !!((t = e.channel) != null && t.is_direct);
|
|
317
318
|
}
|
|
318
319
|
const w = /* @__PURE__ */ new Map();
|
|
319
|
-
function
|
|
320
|
+
function Ge(e) {
|
|
320
321
|
$(() => {
|
|
321
322
|
if (e)
|
|
322
323
|
return w.set(e, (w.get(e) ?? 0) + 1), () => {
|
|
@@ -325,17 +326,17 @@ function je(e) {
|
|
|
325
326
|
};
|
|
326
327
|
}, [e]);
|
|
327
328
|
}
|
|
328
|
-
function
|
|
329
|
+
function de() {
|
|
329
330
|
return typeof document > "u" || document.visibilityState === "visible";
|
|
330
331
|
}
|
|
331
|
-
function
|
|
332
|
-
return w.has(e) &&
|
|
332
|
+
function H(e) {
|
|
333
|
+
return w.has(e) && de();
|
|
333
334
|
}
|
|
334
|
-
function
|
|
335
|
-
const e =
|
|
335
|
+
function me() {
|
|
336
|
+
const e = x().notification_sound;
|
|
336
337
|
return typeof e == "string" ? e : "off";
|
|
337
338
|
}
|
|
338
|
-
function
|
|
339
|
+
function x() {
|
|
339
340
|
const e = m(), { data: t } = y({
|
|
340
341
|
queryKey: ["nvr-profile-prefs"],
|
|
341
342
|
queryFn: () => e.request(g("/users/me")).then((s) => {
|
|
@@ -346,7 +347,7 @@ function I() {
|
|
|
346
347
|
});
|
|
347
348
|
return t ?? {};
|
|
348
349
|
}
|
|
349
|
-
function
|
|
350
|
+
function fe() {
|
|
350
351
|
const e = m(), t = v();
|
|
351
352
|
return h({
|
|
352
353
|
mutationFn: (s) => e.request(C("/users/me/preferences", s)),
|
|
@@ -357,14 +358,14 @@ function de() {
|
|
|
357
358
|
onError: (s, n, o) => {
|
|
358
359
|
o != null && o.prev && t.setQueryData(["nvr-profile-prefs"], o.prev);
|
|
359
360
|
},
|
|
360
|
-
onSuccess: (s, n) =>
|
|
361
|
+
onSuccess: (s, n) => oe(Object.keys(n)),
|
|
361
362
|
onSettled: () => {
|
|
362
363
|
t.invalidateQueries({ queryKey: ["nvr-profile-prefs"] }), t.invalidateQueries({ queryKey: ["presence-online"] });
|
|
363
364
|
}
|
|
364
365
|
});
|
|
365
366
|
}
|
|
366
|
-
function
|
|
367
|
-
const e =
|
|
367
|
+
function Ve() {
|
|
368
|
+
const e = x(), t = fe(), s = Object.keys(e).length > 0;
|
|
368
369
|
$(() => {
|
|
369
370
|
if (!s) return;
|
|
370
371
|
let n = "";
|
|
@@ -383,53 +384,53 @@ function ze() {
|
|
|
383
384
|
}
|
|
384
385
|
}, [s, e.browser_timezone]);
|
|
385
386
|
}
|
|
386
|
-
function
|
|
387
|
-
const s =
|
|
387
|
+
function We(e, t) {
|
|
388
|
+
const s = b(), n = me(), o = x(), r = U(o);
|
|
388
389
|
r.current = o, $(() => {
|
|
389
|
-
const a = t ? t.filter((
|
|
390
|
-
if (s.sound &&
|
|
391
|
-
const
|
|
392
|
-
for (const
|
|
393
|
-
const
|
|
394
|
-
if (
|
|
395
|
-
const
|
|
390
|
+
const a = t ? t.filter((u) => z(u) && !H(u.room)).reduce((u, l) => u + l.unread, 0) : e, i = a > j, c = ne(r.current), f = te(r.current) || c;
|
|
391
|
+
if (s.sound && i && !f && re(n), s.sound && i && c && se({ kind: "chat", title: "New message" }), t) {
|
|
392
|
+
const u = Q.size > 0, l = w.size > 0;
|
|
393
|
+
for (const d of t) {
|
|
394
|
+
const q = Q.get(d.room) ?? 0;
|
|
395
|
+
if (u && !f && !d.muted && z(d) && d.unread > q && !H(d.room)) {
|
|
396
|
+
const p = d.lastMessage, F = p != null && p.sender_name ? String(p.sender_name).trim() : null;
|
|
396
397
|
ee(
|
|
397
|
-
|
|
398
|
+
d.kind === "dm" ? `New message from ${F || d.label}` : `New message in ${d.label}${F ? ` — ${F}` : ""}`,
|
|
398
399
|
{
|
|
399
|
-
description:
|
|
400
|
+
description: p != null && p.message ? String(p.message).replace(/<[^>]*>/g, "").slice(0, 90) : void 0,
|
|
400
401
|
duration: 4e3,
|
|
401
402
|
...l ? { position: "top-center" } : {},
|
|
402
403
|
// Reading the message is the whole reason the toast exists, so
|
|
403
404
|
// it opens the conversation — only when a host has somewhere to
|
|
404
405
|
// open it, otherwise the click would do nothing.
|
|
405
|
-
...
|
|
406
|
+
...qe() ? {
|
|
406
407
|
className: "cursor-pointer",
|
|
407
408
|
onDismiss: void 0,
|
|
408
409
|
action: {
|
|
409
410
|
label: "Open",
|
|
410
|
-
onClick: () =>
|
|
411
|
+
onClick: () => W(d.room, d.label)
|
|
411
412
|
}
|
|
412
413
|
} : {}
|
|
413
414
|
}
|
|
414
415
|
);
|
|
415
416
|
}
|
|
416
|
-
|
|
417
|
+
Q.set(d.room, d.unread);
|
|
417
418
|
}
|
|
418
419
|
}
|
|
419
|
-
|
|
420
|
+
j = a;
|
|
420
421
|
}, [e, s.sound, t, n]);
|
|
421
422
|
}
|
|
422
|
-
function
|
|
423
|
+
function Ye() {
|
|
423
424
|
const e = m(), t = v();
|
|
424
425
|
return h({
|
|
425
426
|
mutationFn: (s) => e.request(K(`/chat/rooms/${encodeURIComponent(s)}/read`)),
|
|
426
427
|
onSuccess: () => void t.invalidateQueries({ queryKey: ["nvr-chat-rooms"] })
|
|
427
428
|
});
|
|
428
429
|
}
|
|
429
|
-
const
|
|
430
|
-
function
|
|
430
|
+
const he = ["nvr-chat-room-types"];
|
|
431
|
+
function V(e) {
|
|
431
432
|
return {
|
|
432
|
-
queryKey:
|
|
433
|
+
queryKey: he,
|
|
433
434
|
queryFn: async () => {
|
|
434
435
|
const t = await e.request(g("/chat/room-types"));
|
|
435
436
|
return ((t == null ? void 0 : t.data) ?? []).filter((s) => s.is_active);
|
|
@@ -437,69 +438,69 @@ function H(e) {
|
|
|
437
438
|
staleTime: 5 * 6e4
|
|
438
439
|
};
|
|
439
440
|
}
|
|
440
|
-
function
|
|
441
|
-
const t =
|
|
442
|
-
queryKey: ["nvr-chat-entity-record",
|
|
441
|
+
function Je(e) {
|
|
442
|
+
const t = b(), s = m(), n = (e == null ? void 0 : e.indexOf(":")) ?? -1, o = e && n > 0 ? e.slice(0, n) : null, r = e && n > 0 ? e.slice(n + 1) : null, a = !!e && !!o && !!r && e !== t.globalRoom && o !== "dm" && o !== "ch", { data: i } = y({ ...V(s), enabled: a }), c = a ? i == null ? void 0 : i.find((l) => l.is_active && l.prefix === o) : void 0, { data: f } = y({
|
|
443
|
+
queryKey: ["nvr-chat-entity-record", c == null ? void 0 : c.collection, c == null ? void 0 : c.match_field, r],
|
|
443
444
|
queryFn: async () => {
|
|
444
|
-
var
|
|
445
|
-
return
|
|
446
|
-
g(`/items/${
|
|
445
|
+
var d, q;
|
|
446
|
+
return c.match_field === "id" ? r : ((q = (d = (await s.request(
|
|
447
|
+
g(`/items/${c.collection}`, {
|
|
447
448
|
limit: 1,
|
|
448
449
|
fields: "id",
|
|
449
|
-
filter: JSON.stringify({ [
|
|
450
|
+
filter: JSON.stringify({ [c.match_field]: { _eq: r } })
|
|
450
451
|
})
|
|
451
|
-
)).data) == null ? void 0 :
|
|
452
|
+
)).data) == null ? void 0 : d[0]) == null ? void 0 : q.id) ?? null;
|
|
452
453
|
},
|
|
453
|
-
enabled: !!
|
|
454
|
+
enabled: !!c && !!r,
|
|
454
455
|
staleTime: 5 * 6e4
|
|
455
456
|
});
|
|
456
|
-
return !
|
|
457
|
+
return !c || f == null ? null : (t.recordUrl ?? ((l, d) => `/collections/${l}/${d}`))(c.collection, f);
|
|
457
458
|
}
|
|
458
|
-
const
|
|
459
|
-
function
|
|
459
|
+
const ye = /@\[([^\]]+)\](?:\([^)]*\))?/g;
|
|
460
|
+
function Ze(e, t) {
|
|
460
461
|
const s = new RegExp(t, "gi"), n = [];
|
|
461
|
-
for (const a of e.matchAll(
|
|
462
|
+
for (const a of e.matchAll(ye))
|
|
462
463
|
n.push({
|
|
463
464
|
start: a.index,
|
|
464
465
|
end: a.index + a[0].length,
|
|
465
466
|
token: { text: `@${a[1]}`, mention: a[1] }
|
|
466
467
|
});
|
|
467
468
|
for (const a of e.matchAll(s))
|
|
468
|
-
n.some((
|
|
469
|
+
n.some((i) => a.index >= i.start && a.index < i.end) || n.push({
|
|
469
470
|
start: a.index,
|
|
470
471
|
end: a.index + a[0].length,
|
|
471
472
|
token: { text: a[0], entity: a[0].toUpperCase() }
|
|
472
473
|
});
|
|
473
|
-
n.sort((a,
|
|
474
|
+
n.sort((a, i) => a.start - i.start);
|
|
474
475
|
const o = [];
|
|
475
476
|
let r = 0;
|
|
476
477
|
for (const a of n)
|
|
477
478
|
a.start > r && o.push({ text: e.slice(r, a.start) }), o.push(a.token), r = a.end;
|
|
478
479
|
return r < e.length && o.push({ text: e.slice(r) }), o;
|
|
479
480
|
}
|
|
480
|
-
function
|
|
481
|
+
function Xe(e, t) {
|
|
481
482
|
const n = e.slice(0, t).match(/@([^@\n\r]*)$/);
|
|
482
483
|
return n ? n[1] : null;
|
|
483
484
|
}
|
|
484
|
-
const
|
|
485
|
-
function
|
|
486
|
-
const t =
|
|
485
|
+
const ge = 3e3;
|
|
486
|
+
function et(e) {
|
|
487
|
+
const t = b(), s = m();
|
|
487
488
|
v();
|
|
488
|
-
const n =
|
|
489
|
+
const n = U(!1), o = U(null), r = t.me, a = M(() => {
|
|
489
490
|
o.current && clearTimeout(o.current), o.current = null, n.current && r && t.setTypingRoom && (n.current = !1, t.setTypingRoom(r.id, null));
|
|
490
|
-
}, [r, t]),
|
|
491
|
-
!r || !e || !t.setTypingRoom || (n.current || (n.current = !0, t.setTypingRoom(r.id, e)), o.current && clearTimeout(o.current), o.current = setTimeout(a,
|
|
491
|
+
}, [r, t]), i = M(() => {
|
|
492
|
+
!r || !e || !t.setTypingRoom || (n.current || (n.current = !0, t.setTypingRoom(r.id, e)), o.current && clearTimeout(o.current), o.current = setTimeout(a, ge));
|
|
492
493
|
}, [r, e, t, a]);
|
|
493
494
|
$(() => a, [a]);
|
|
494
|
-
const { data:
|
|
495
|
+
const { data: c } = y({
|
|
495
496
|
queryKey: ["nvr-chat-typing", e],
|
|
496
497
|
queryFn: async () => {
|
|
497
|
-
const
|
|
498
|
+
const u = new Date(Date.now() - 6e4).toISOString();
|
|
498
499
|
return (await s.request(
|
|
499
500
|
J(t.collections.presence, {
|
|
500
501
|
limit: 10,
|
|
501
502
|
fields: ["user_id", "display_name", "typing_room", "last_seen"],
|
|
502
|
-
filter: { typing_room: { _eq: e }, last_seen: { _gte:
|
|
503
|
+
filter: { typing_room: { _eq: e }, last_seen: { _gte: u } }
|
|
503
504
|
})
|
|
504
505
|
)).data ?? [];
|
|
505
506
|
},
|
|
@@ -507,58 +508,58 @@ function Ye(e) {
|
|
|
507
508
|
refetchInterval: 6e3,
|
|
508
509
|
staleTime: 2e3
|
|
509
510
|
});
|
|
510
|
-
|
|
511
|
-
const
|
|
512
|
-
var
|
|
513
|
-
const
|
|
514
|
-
var
|
|
515
|
-
return ((
|
|
516
|
-
}).map((
|
|
517
|
-
return
|
|
518
|
-
}, [
|
|
519
|
-
return { onType:
|
|
520
|
-
}
|
|
521
|
-
function
|
|
522
|
-
const t =
|
|
511
|
+
ue(t.collections.presence, [["nvr-chat-typing"]]);
|
|
512
|
+
const f = k(() => {
|
|
513
|
+
var d;
|
|
514
|
+
const u = (d = r == null ? void 0 : r.id) == null ? void 0 : d.toLowerCase(), l = (c ?? []).filter((q) => {
|
|
515
|
+
var p;
|
|
516
|
+
return ((p = q.user_id) == null ? void 0 : p.toLowerCase()) !== u;
|
|
517
|
+
}).map((q) => q.display_name ?? "Someone");
|
|
518
|
+
return l.length === 0 ? null : l.length === 1 ? `${l[0]} is typing…` : l.length === 2 ? `${l[0]} and ${l[1]} are typing…` : `${l.length} people are typing…`;
|
|
519
|
+
}, [c, r == null ? void 0 : r.id]);
|
|
520
|
+
return { onType: i, clearTyping: a, typingText: f };
|
|
521
|
+
}
|
|
522
|
+
function tt(e) {
|
|
523
|
+
const t = b(), s = m(), n = t.me, o = e && n ? B(e, n.id) : null, { data: r } = y({
|
|
523
524
|
queryKey: ["nvr-chat-peer-read", e],
|
|
524
525
|
queryFn: async () => {
|
|
525
|
-
var
|
|
526
|
-
return ((
|
|
526
|
+
var i;
|
|
527
|
+
return ((i = (await s.request(
|
|
527
528
|
g(
|
|
528
529
|
`/chat/rooms/${encodeURIComponent(e)}/peer-read`
|
|
529
530
|
)
|
|
530
|
-
)).data) == null ? void 0 :
|
|
531
|
+
)).data) == null ? void 0 : i.last_read_at) ?? null;
|
|
531
532
|
},
|
|
532
533
|
enabled: !!o && !!e,
|
|
533
534
|
refetchInterval: 3e4,
|
|
534
535
|
staleTime: 5e3
|
|
535
536
|
});
|
|
536
|
-
return
|
|
537
|
+
return O([["nvr-chat-peer-read"]], e ? [e] : []), r ?? null;
|
|
537
538
|
}
|
|
538
|
-
function
|
|
539
|
+
function nt(e) {
|
|
539
540
|
const t = m(), s = v();
|
|
540
541
|
return h({
|
|
541
542
|
mutationFn: ({ messageId: n, emoji: o }) => t.request(K(`/chat/messages/${n}/reactions`, { emoji: o })),
|
|
542
543
|
onSuccess: () => void s.invalidateQueries({ queryKey: ["nvr-chat", e] })
|
|
543
544
|
});
|
|
544
545
|
}
|
|
545
|
-
function
|
|
546
|
+
function st(e) {
|
|
546
547
|
const t = m(), s = v();
|
|
547
548
|
return h({
|
|
548
549
|
mutationFn: ({ messageId: n, text: o }) => t.request(C(`/chat/messages/${n}`, { message: o })),
|
|
549
550
|
onSuccess: () => void s.invalidateQueries({ queryKey: ["nvr-chat", e] })
|
|
550
551
|
});
|
|
551
552
|
}
|
|
552
|
-
function
|
|
553
|
+
function rt(e) {
|
|
553
554
|
const t = m(), s = v();
|
|
554
555
|
return h({
|
|
555
|
-
mutationFn: (n) => t.request(
|
|
556
|
+
mutationFn: (n) => t.request(A(`/chat/messages/${n}`)),
|
|
556
557
|
onSuccess: () => {
|
|
557
558
|
s.invalidateQueries({ queryKey: ["nvr-chat", e] }), s.invalidateQueries({ queryKey: ["nvr-chat-rooms"] });
|
|
558
559
|
}
|
|
559
560
|
});
|
|
560
561
|
}
|
|
561
|
-
function
|
|
562
|
+
function ot(e, t = {}) {
|
|
562
563
|
const s = m(), n = { q: e };
|
|
563
564
|
t.sender && (n.sender = t.sender), t.room && (n.room = t.room), t.from && (n.from = t.from), t.to && (n.to = t.to), t.has_attachment && (n.has_attachment = "1"), t.mentions_me && (n.mentions_me = "1");
|
|
564
565
|
const o = Object.keys(n).length > 1, { data: r, isLoading: a } = y({
|
|
@@ -571,14 +572,14 @@ function tt(e, t = {}) {
|
|
|
571
572
|
});
|
|
572
573
|
return { hits: r ?? [], loading: a };
|
|
573
574
|
}
|
|
574
|
-
function
|
|
575
|
+
function at() {
|
|
575
576
|
const e = m(), t = v();
|
|
576
577
|
return h({
|
|
577
578
|
mutationFn: async (s) => (await e.request(K("/chat/group-dm", s))).data,
|
|
578
579
|
onSuccess: () => void t.invalidateQueries({ queryKey: ["nvr-chat-rooms"] })
|
|
579
580
|
});
|
|
580
581
|
}
|
|
581
|
-
function
|
|
582
|
+
function pe() {
|
|
582
583
|
const e = m(), { data: t } = y({
|
|
583
584
|
queryKey: ["nvr-chat-config"],
|
|
584
585
|
queryFn: async () => (await e.request(g("/chat/config"))).data ?? { bot_name: null, bot_user_id: null },
|
|
@@ -586,10 +587,10 @@ function ye() {
|
|
|
586
587
|
});
|
|
587
588
|
return t ?? { bot_name: null, bot_user_id: null };
|
|
588
589
|
}
|
|
589
|
-
function
|
|
590
|
-
return
|
|
590
|
+
function it() {
|
|
591
|
+
return pe().bot_name;
|
|
591
592
|
}
|
|
592
|
-
function
|
|
593
|
+
function ct(e) {
|
|
593
594
|
const t = m(), { data: s } = y({
|
|
594
595
|
queryKey: ["nvr-chat-pins", e],
|
|
595
596
|
queryFn: async () => (await t.request(
|
|
@@ -598,16 +599,16 @@ function rt(e) {
|
|
|
598
599
|
enabled: !!e,
|
|
599
600
|
staleTime: 15e3
|
|
600
601
|
});
|
|
601
|
-
return
|
|
602
|
+
return O([["nvr-chat-pins"]], e ? [e] : []), s ?? [];
|
|
602
603
|
}
|
|
603
|
-
function
|
|
604
|
+
function ut(e) {
|
|
604
605
|
const t = m(), s = v();
|
|
605
606
|
return h({
|
|
606
607
|
mutationFn: (n) => t.request(K(`/chat/messages/${n}/pin`)),
|
|
607
608
|
onSuccess: () => void s.invalidateQueries({ queryKey: ["nvr-chat-pins", e] })
|
|
608
609
|
});
|
|
609
610
|
}
|
|
610
|
-
const
|
|
611
|
+
const I = [
|
|
611
612
|
"#7dd3fc",
|
|
612
613
|
"#86efac",
|
|
613
614
|
"#fcd34d",
|
|
@@ -617,111 +618,119 @@ const z = [
|
|
|
617
618
|
"#99f6e4",
|
|
618
619
|
"#00ceff"
|
|
619
620
|
];
|
|
620
|
-
function
|
|
621
|
+
function lt(e) {
|
|
622
|
+
return I[ve(e)];
|
|
623
|
+
}
|
|
624
|
+
function ve(e) {
|
|
621
625
|
let t = 0;
|
|
622
626
|
for (const s of e) t = t * 31 + s.charCodeAt(0) | 0;
|
|
623
|
-
return
|
|
627
|
+
return Math.abs(t) % I.length;
|
|
624
628
|
}
|
|
625
|
-
function
|
|
629
|
+
function dt(e) {
|
|
630
|
+
return Number.isInteger(e) && e >= 0 && e < I.length ? I[e] : null;
|
|
631
|
+
}
|
|
632
|
+
function mt(e) {
|
|
626
633
|
var s, n;
|
|
627
634
|
if (!e) return "?";
|
|
628
635
|
const t = e.trim().split(/\s+/);
|
|
629
636
|
return ((((s = t[0]) == null ? void 0 : s[0]) ?? "") + (((n = t[1]) == null ? void 0 : n[0]) ?? "")).toUpperCase() || "?";
|
|
630
637
|
}
|
|
631
638
|
let T = null;
|
|
632
|
-
function
|
|
639
|
+
function ft(e) {
|
|
633
640
|
return T = e, () => {
|
|
634
641
|
T === e && (T = null);
|
|
635
642
|
};
|
|
636
643
|
}
|
|
637
|
-
function
|
|
644
|
+
function ht() {
|
|
638
645
|
return T !== null;
|
|
639
646
|
}
|
|
640
|
-
function
|
|
647
|
+
function yt(e, t) {
|
|
641
648
|
T == null || T(e, t);
|
|
642
649
|
}
|
|
643
650
|
let S = null;
|
|
644
|
-
function
|
|
651
|
+
function gt(e) {
|
|
645
652
|
return S = e, () => {
|
|
646
653
|
S === e && (S = null);
|
|
647
654
|
};
|
|
648
655
|
}
|
|
649
|
-
function
|
|
656
|
+
function qe() {
|
|
650
657
|
return S !== null;
|
|
651
658
|
}
|
|
652
|
-
function
|
|
659
|
+
function W(e, t) {
|
|
653
660
|
S == null || S(e, t);
|
|
654
661
|
}
|
|
655
|
-
function
|
|
656
|
-
const t = m(), { data: s } = y({ ...
|
|
662
|
+
function pt(e = !0) {
|
|
663
|
+
const t = m(), { data: s } = y({ ...V(t), enabled: e });
|
|
657
664
|
return s;
|
|
658
665
|
}
|
|
659
|
-
async function
|
|
666
|
+
async function vt(e, t, s) {
|
|
660
667
|
var r;
|
|
661
668
|
const n = await e.request(
|
|
662
669
|
g("/chat/record-room", { collection: t, item: s })
|
|
663
670
|
);
|
|
664
671
|
if (!((r = n.data) != null && r.room)) return !1;
|
|
665
672
|
const o = n.data.room.slice(n.data.room.indexOf(":") + 1);
|
|
666
|
-
return
|
|
673
|
+
return W(n.data.room, o), !0;
|
|
667
674
|
}
|
|
668
675
|
export {
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
676
|
+
ke as CHAT_DEFAULTS,
|
|
677
|
+
he as CHAT_ROOM_TYPES_KEY,
|
|
678
|
+
ce as ChatConfigContext,
|
|
679
|
+
Ie as GENERAL_CHANNEL_ID,
|
|
680
|
+
Me as REACTION_EMOJI,
|
|
681
|
+
qe as canOpenChatRoom,
|
|
682
|
+
ht as canOpenDm,
|
|
683
|
+
lt as chatAvatarColor,
|
|
684
|
+
dt as chatAvatarColorAt,
|
|
685
|
+
ve as chatAvatarColorIndex,
|
|
686
|
+
mt as chatInitials,
|
|
687
|
+
V as chatRoomTypesQuery,
|
|
688
|
+
_t as discardOutbox,
|
|
689
|
+
vt as discussRecord,
|
|
681
690
|
B as dmPeer,
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
691
|
+
xe as dmRoom,
|
|
692
|
+
Ct as editOutbox,
|
|
693
|
+
Xe as getMentionQuery,
|
|
694
|
+
Rt as holdOutbox,
|
|
695
|
+
wt as nudgeChatOutbox,
|
|
696
|
+
W as openChatRoom,
|
|
697
|
+
yt as openDmWith,
|
|
698
|
+
ft as registerDmOpener,
|
|
699
|
+
gt as registerRoomOpener,
|
|
700
|
+
Tt as retryOutbox,
|
|
701
|
+
Ze as splitMessageTokens,
|
|
702
|
+
De as useArchivedRooms,
|
|
703
|
+
je as useChannelAdmin,
|
|
704
|
+
Ne as useChannelDirectory,
|
|
705
|
+
Pe as useChannelMembers,
|
|
706
|
+
pe as useChatBotInfo,
|
|
707
|
+
it as useChatBotName,
|
|
708
|
+
b as useChatConfig,
|
|
709
|
+
Le as useChatMessages,
|
|
710
|
+
ze as useChatRoles,
|
|
711
|
+
Ae as useChatRooms,
|
|
712
|
+
ot as useChatSearch,
|
|
713
|
+
Qe as useChatThread,
|
|
714
|
+
Be as useCreateChannel,
|
|
715
|
+
at as useCreateGroupDm,
|
|
716
|
+
rt as useDeleteMessage,
|
|
717
|
+
st as useEditMessage,
|
|
718
|
+
Je as useEntityRoomLink,
|
|
719
|
+
Ye as useMarkRoomRead,
|
|
720
|
+
x as useMyPreferences,
|
|
721
|
+
me as useNotificationSoundPreference,
|
|
722
|
+
Ge as useOpenRoomRegistration,
|
|
723
|
+
St as useOutbox,
|
|
724
|
+
tt as usePeerReadAt,
|
|
725
|
+
Ve as useRecordBrowserTimezone,
|
|
726
|
+
pt as useRecordRoomTypes,
|
|
727
|
+
Ee as useRoomMembership,
|
|
728
|
+
ct as useRoomPins,
|
|
729
|
+
Ue as useSendChatMessage,
|
|
730
|
+
fe as useSetMyPreferences,
|
|
731
|
+
ut as useTogglePin,
|
|
732
|
+
nt as useToggleReaction,
|
|
733
|
+
et as useTypingIndicator,
|
|
734
|
+
We as useUnreadChirp,
|
|
735
|
+
He as useUserSearch
|
|
727
736
|
};
|