@nivaro/react 0.2.54 → 0.2.55
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/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +99 -98
- package/dist/index.d.ts +339 -2
- package/dist/index.js +644 -618
- package/dist/layout-editor.d.ts +4 -0
- package/dist/shared/components/BackgroundRunOffer.js +117 -0
- package/dist/shared/components/BroadcastView.js +214 -213
- package/dist/shared/components/CollectionBrowserView.js +2592 -2695
- package/dist/shared/components/ItemEditForm.js +4066 -3832
- package/dist/shared/components/JobsTray.js +100 -55
- package/dist/shared/components/MyWorkView.js +91 -89
- package/dist/shared/components/NotificationBell.js +80 -79
- package/dist/shared/components/ProfileView.js +568 -520
- package/dist/shared/components/RecordCompare.js +254 -0
- package/dist/shared/components/RecordReadView.js +599 -552
- package/dist/shared/components/ReportView.js +578 -543
- package/dist/shared/components/RowPresence.js +91 -0
- package/dist/shared/components/WidgetSlot.js +474 -458
- package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
- package/dist/shared/components/ai/AskPanel.js +139 -119
- package/dist/shared/components/ai/FirstWeekCard.js +126 -0
- package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
- package/dist/shared/components/bulk/bulk-field-options.js +45 -0
- package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
- package/dist/shared/components/chat/ChannelArchive.js +326 -0
- package/dist/shared/components/chat/ChannelExtras.js +141 -121
- package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
- package/dist/shared/components/chat/ChatPanel.js +1695 -1733
- package/dist/shared/components/chat/Composer.js +357 -303
- package/dist/shared/components/chat/MessageActions.js +92 -0
- package/dist/shared/components/chat/MessageFormat.js +290 -264
- package/dist/shared/components/chat/OutboxBubbles.js +146 -0
- package/dist/shared/components/chat/RequestIdCard.js +135 -0
- package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
- package/dist/shared/components/chat/RoomParts.js +213 -274
- package/dist/shared/components/chat/ScreenClip.js +184 -0
- package/dist/shared/components/chat/chat-core.js +402 -483
- package/dist/shared/components/chat/chat-drafts.js +59 -0
- package/dist/shared/components/chat/chat-emoji.js +348 -0
- package/dist/shared/components/chat/chat-local-time.js +41 -0
- package/dist/shared/components/chat/chat-outbox.js +303 -0
- package/dist/shared/components/chat/chat-window.js +163 -0
- package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
- package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
- package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
- package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
- package/dist/shared/components/help-videos/api.js +76 -73
- package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
- package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
- package/dist/shared/components/item-edit/FieldAffordances.js +2 -2
- package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
- package/dist/shared/components/item-edit/FieldRow.js +292 -279
- package/dist/shared/components/item-edit/GroupSection.js +698 -574
- package/dist/shared/components/item-edit/InlineTableField.js +3 -1
- package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
- package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
- package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
- package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
- package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
- package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
- package/dist/shared/components/item-edit/lazy-sections.js +36 -0
- package/dist/shared/components/item-edit/lock-why.js +39 -32
- package/dist/shared/components/item-edit/picker-miss.js +26 -0
- package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
- package/dist/shared/components/item-edit/useFormUsageBeacon.js +51 -45
- package/dist/shared/components/layout-editor/AddPanel.js +134 -117
- package/dist/shared/components/layout-editor/ChangeNote.js +25 -24
- package/dist/shared/components/layout-editor/CollabParts.js +80 -75
- package/dist/shared/components/layout-editor/DesignNode.js +126 -120
- package/dist/shared/components/layout-editor/EditorCanvas.js +30 -27
- package/dist/shared/components/layout-editor/EditorTopBar.js +203 -192
- package/dist/shared/components/layout-editor/HistoryPanel.js +120 -104
- package/dist/shared/components/layout-editor/LayoutEditor.js +768 -671
- package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
- package/dist/shared/components/layout-editor/StagedChip.js +22 -0
- package/dist/shared/components/layout-editor/StructureMenu.js +237 -186
- package/dist/shared/components/layout-editor/collab/FormFollowShare.js +149 -103
- package/dist/shared/components/layout-editor/collab/collab-api.js +29 -26
- package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +81 -80
- package/dist/shared/components/layout-editor/dnd/node.js +69 -57
- package/dist/shared/components/layout-editor/draft-recovery.js +113 -43
- package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
- package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
- package/dist/shared/components/layout-editor/entry/presets.js +71 -0
- package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
- package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
- package/dist/shared/components/layout-editor/grid-guides.js +142 -0
- package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
- package/dist/shared/components/layout-editor/inspector/BulkInspector.js +61 -57
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +247 -151
- package/dist/shared/components/layout-editor/inspector/Inspector.js +176 -155
- package/dist/shared/components/layout-editor/inspector/LookTab.js +167 -116
- package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
- package/dist/shared/components/layout-editor/inspector/PickerTab.js +84 -82
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +66 -62
- package/dist/shared/components/layout-editor/inspector/kit.js +69 -68
- package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
- package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
- package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
- package/dist/shared/components/layout-editor/overview/describe-conditions.js +6 -0
- package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/layout-editor/restore-piece.js +192 -0
- package/dist/shared/components/layout-editor/section-structure.js +241 -0
- package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
- package/dist/shared/components/layout-editor/settings/FormSettings.js +41 -39
- package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
- package/dist/shared/components/layout-editor/settings/ToolsSection.js +147 -111
- package/dist/shared/components/layout-editor/settings/WhoSection.js +29 -26
- package/dist/shared/components/layout-editor/settings/settings-registry.js +114 -17
- package/dist/shared/components/layout-editor/staged-api.js +64 -0
- package/dist/shared/components/layout-editor/structure-ops.js +81 -77
- package/dist/shared/components/layout-editor/testing/TestingPanels.js +65 -60
- package/dist/shared/components/layout-editor/testing/testing-model.js +198 -185
- package/dist/shared/components/layout-editor/toolbar-kit.js +11 -11
- package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
- package/dist/shared/components/layout-editor/usage/UsagePanel.js +144 -70
- package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
- package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
- package/dist/shared/components/layout-editor/useLayoutDraft.js +25 -24
- package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
- package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
- package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
- package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
- package/dist/shared/components/profile/AgentsPanel.js +479 -0
- package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
- package/dist/shared/components/support/SupportAnalytics.js +171 -0
- package/dist/shared/components/support/SupportView.js +75 -73
- package/dist/shared/lib/background-runs.js +150 -0
- package/dist/shared/lib/delivery-ack.js +9 -0
- package/dist/shared/lib/entry-badge-style.js +13 -0
- package/dist/shared/lib/entry-config.js +71 -0
- package/dist/shared/lib/form-sections.js +64 -0
- package/dist/shared/lib/form-structure.js +99 -0
- package/dist/shared/lib/form-usage-beacon.js +101 -52
- package/dist/shared/lib/jobs-tray.js +25 -23
- package/dist/shared/lib/keyset-pager.js +37 -0
- package/dist/shared/lib/layout-ops.js +84 -82
- package/dist/shared/lib/layout-resolve.js +113 -0
- package/dist/shared/lib/placement-behaviour.js +144 -0
- package/dist/shared/lib/prefetch.js +149 -0
- package/dist/shared/lib/presence-hooks.js +199 -0
- package/dist/shared/lib/record-outbox.js +82 -81
- package/dist/shared/lib/replay-socket.js +93 -0
- package/dist/shared/lib/request-gate.js +51 -50
- package/dist/shared/lib/room-gaps.js +96 -0
- package/dist/shared/lib/search-log.js +27 -0
- package/dist/shared/lib/socket-realtime.js +101 -80
- package/dist/shared/lib/worker-socket.js +200 -0
- package/package.json +1 -1
|
@@ -1,334 +1,372 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import { Quote as
|
|
4
|
-
import { forwardRef as
|
|
5
|
-
import { toast as
|
|
6
|
-
import { useNivaroClient as
|
|
7
|
-
import { get as
|
|
1
|
+
import { jsx as r, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as Te } from "@tanstack/react-query";
|
|
3
|
+
import { Quote as et, X as Ae, Paperclip as Fe, Hash as tt, AlertTriangle as st, AlarmClock as nt, Send as rt, Type as at } from "lucide-react";
|
|
4
|
+
import { forwardRef as lt, useState as b, useMemo as X, useRef as ce, useImperativeHandle as ot, useEffect as Ee } from "react";
|
|
5
|
+
import { toast as U } from "sonner";
|
|
6
|
+
import { useNivaroClient as it, useApiFetchConfig as ct, useItemEditAuth as dt } from "../../context.js";
|
|
7
|
+
import { get as ut, patch as Re, post as pt } from "../../lib/commands.js";
|
|
8
8
|
import { cn as m } from "../../lib/utils.js";
|
|
9
|
-
import { Popover as
|
|
10
|
-
import { useChatConfig as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
9
|
+
import { Popover as Pe, PopoverTrigger as We, PopoverContent as Oe } from "../ui/popover.js";
|
|
10
|
+
import { useChatConfig as ht, useSendChatMessage as mt, useTypingIndicator as ft, useChatBotName as xt, useChatRooms as gt, dmPeer as bt, useUserSearch as kt, chatRoomTypesQuery as yt, getMentionQuery as wt } from "./chat-core.js";
|
|
11
|
+
import { useDraftSync as vt } from "./chat-drafts.js";
|
|
12
|
+
import { EmojiButton as Nt } from "./chat-emoji.js";
|
|
13
|
+
import { useRoomInfo as _t, useScheduledMessages as St } from "./chat-hooks.js";
|
|
14
|
+
import { tsvToTable as Ct } from "./MessageFormat.js";
|
|
15
|
+
import { ScreenClipButton as $t, CLIP_POSTER_TAG as Dt, clipTags as Mt } from "./ScreenClip.js";
|
|
16
|
+
import { useChatCommands as Tt, filterSlash as At, SlashForm as Ft, SlashMenu as Et, slashQuery as Rt, parseSlashLine as Ut } from "./SlashCommands.js";
|
|
17
|
+
const Ue = {
|
|
15
18
|
b: ["**", "**"],
|
|
16
19
|
i: ["_", "_"],
|
|
17
20
|
e: ["`", "`"]
|
|
18
21
|
};
|
|
19
|
-
function
|
|
20
|
-
const
|
|
21
|
-
return
|
|
22
|
+
function Pt(D, d) {
|
|
23
|
+
const f = D.slice(0, d).match(/(?:^|\s)#([A-Za-z0-9-]{1,30})$/);
|
|
24
|
+
return f ? f[1] : null;
|
|
22
25
|
}
|
|
23
|
-
const
|
|
24
|
-
room:
|
|
25
|
-
label:
|
|
26
|
-
parentId:
|
|
27
|
-
quote:
|
|
28
|
-
onClearQuote:
|
|
29
|
-
onSent:
|
|
30
|
-
disabledReason:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
26
|
+
const es = lt(function({
|
|
27
|
+
room: d,
|
|
28
|
+
label: _,
|
|
29
|
+
parentId: f = null,
|
|
30
|
+
quote: k,
|
|
31
|
+
onClearQuote: v,
|
|
32
|
+
onSent: Y,
|
|
33
|
+
disabledReason: P,
|
|
34
|
+
quietNote: de,
|
|
35
|
+
compact: je,
|
|
36
|
+
th: x,
|
|
37
|
+
renderAvatar: He
|
|
38
|
+
}, Be) {
|
|
39
|
+
var Me;
|
|
40
|
+
const W = ht(), M = it(), S = ct(), y = W.me, Le = mt(d), ue = ft(d), T = xt(), { rooms: Z } = gt(), O = _t(d), { create: Ie } = St(!1), [i, p] = b(""), [w, pe] = b(!1);
|
|
41
|
+
vt(d, f == null, i, p);
|
|
42
|
+
const [h, j] = b(null), [A, H] = b(null), [C, G] = b(0), [B, V] = b(null), [ee, te] = b(null), se = Tt(), L = X(
|
|
43
|
+
() => B === null ? [] : At(se, B).slice(0, 8),
|
|
44
|
+
[se, B]
|
|
45
|
+
), [F, I] = b([]), [q, ne] = b(null), [he, me] = b(!1), [re, qe] = b(""), ae = ce(/* @__PURE__ */ new Map()), N = ce(null), fe = ce(null), xe = d.startsWith("ch:") && !d.startsWith("ch:grp-"), { isAdmin: Ke } = dt(), $ = ((Me = Z.find((e) => e.room === d)) == null ? void 0 : Me.channel) ?? null, ge = ($ == null ? void 0 : $.mention_policy) ?? "owner", be = Ke || ge === "members" || ge === "owner" && !!y && String(($ == null ? void 0 : $.created_by) ?? "").toUpperCase() === y.id.toUpperCase();
|
|
46
|
+
ot(Be, () => ({
|
|
47
|
+
addFiles: (e) => Q(e),
|
|
41
48
|
focus: () => {
|
|
42
49
|
var e;
|
|
43
|
-
return (e =
|
|
50
|
+
return (e = N.current) == null ? void 0 : e.focus();
|
|
44
51
|
}
|
|
45
|
-
})),
|
|
46
|
-
const e =
|
|
52
|
+
})), Ee(() => {
|
|
53
|
+
const e = N.current;
|
|
47
54
|
e && (e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, 168)}px`);
|
|
48
|
-
}, [
|
|
55
|
+
}, [i]), Ee(() => {
|
|
49
56
|
var e;
|
|
50
|
-
|
|
51
|
-
}, [
|
|
52
|
-
const
|
|
57
|
+
k && ((e = N.current) == null || e.focus());
|
|
58
|
+
}, [k]);
|
|
59
|
+
const ke = X(() => {
|
|
53
60
|
const e = [];
|
|
54
|
-
if (!
|
|
55
|
-
for (const t of
|
|
61
|
+
if (!y) return e;
|
|
62
|
+
for (const t of Z) {
|
|
56
63
|
if (t.kind !== "dm") continue;
|
|
57
|
-
const
|
|
58
|
-
|
|
64
|
+
const s = bt(t.room, y.id);
|
|
65
|
+
s && e.push({ id: s, name: t.label });
|
|
59
66
|
}
|
|
60
67
|
return e;
|
|
61
|
-
}, [
|
|
62
|
-
if (
|
|
63
|
-
const e =
|
|
64
|
-
const o =
|
|
65
|
-
|
|
68
|
+
}, [Z, y]), { users: ye } = kt(h ?? "", ((h == null ? void 0 : h.length) ?? 0) >= 2), K = X(() => {
|
|
69
|
+
if (h === null) return [];
|
|
70
|
+
const e = h.toLowerCase(), t = (l) => !!l && l.toLowerCase().split(/\s+/).some((o) => o.startsWith(e)), s = /* @__PURE__ */ new Set([String((y == null ? void 0 : y.id) ?? "").toUpperCase()]), n = [], a = (l) => {
|
|
71
|
+
const o = l.user_id.toUpperCase();
|
|
72
|
+
s.has(o) || (s.add(o), n.push(l));
|
|
66
73
|
};
|
|
67
|
-
|
|
74
|
+
xe && be && ("here".startsWith(e) && n.push({
|
|
68
75
|
user_id: "__here__",
|
|
69
76
|
display_name: "here",
|
|
70
77
|
sub: "Everyone online in this room",
|
|
71
78
|
kind: "here"
|
|
72
|
-
}), "channel".startsWith(e) &&
|
|
79
|
+
}), "channel".startsWith(e) && n.push({
|
|
73
80
|
user_id: "__channel__",
|
|
74
81
|
display_name: "channel",
|
|
75
82
|
sub: "Every member of this room",
|
|
76
83
|
kind: "channel"
|
|
77
|
-
})),
|
|
78
|
-
for (const
|
|
79
|
-
t(
|
|
80
|
-
for (const
|
|
81
|
-
t(
|
|
82
|
-
for (const
|
|
83
|
-
t(
|
|
84
|
-
for (const
|
|
85
|
-
const o = [
|
|
86
|
-
(t(o) || (
|
|
84
|
+
})), T && T.toLowerCase().startsWith(e) && n.push({ user_id: "__bot__", display_name: T, sub: "AI assistant", kind: "bot" });
|
|
85
|
+
for (const l of (O == null ? void 0 : O.members) ?? [])
|
|
86
|
+
t(l.name) && a({ user_id: l.id, display_name: l.name, sub: "In this room", kind: "person" });
|
|
87
|
+
for (const l of ke)
|
|
88
|
+
t(l.name) && a({ user_id: l.id, display_name: l.name, sub: "You message them", kind: "person" });
|
|
89
|
+
for (const l of W.onlineUsers)
|
|
90
|
+
t(l.display_name) && a({ user_id: l.user_id, display_name: l.display_name, sub: "Online", kind: "person" });
|
|
91
|
+
for (const l of ye) {
|
|
92
|
+
const o = [l.first_name, l.last_name].filter(Boolean).join(" ") || l.email;
|
|
93
|
+
(t(o) || (l.email ?? "").toLowerCase().startsWith(e)) && a({ user_id: l.id, display_name: o, sub: null, kind: "person" });
|
|
87
94
|
}
|
|
88
|
-
const
|
|
89
|
-
if (
|
|
90
|
-
const o =
|
|
91
|
-
(
|
|
95
|
+
const u = (l) => {
|
|
96
|
+
if (l.kind !== "person") return -1;
|
|
97
|
+
const o = W.onlineUsers.find(
|
|
98
|
+
(R) => String(R.user_id).toUpperCase() === l.user_id.toUpperCase()
|
|
92
99
|
);
|
|
93
100
|
return o ? o.is_idle ? 1 : 0 : 2;
|
|
94
101
|
};
|
|
95
|
-
return
|
|
96
|
-
}, [
|
|
97
|
-
queryKey: ["nvr-chat-record-pick",
|
|
102
|
+
return n.map((l, o) => ({ c: l, i: o, t: u(l) })).sort((l, o) => l.t - o.t || l.i - o.i).map((l) => l.c).slice(0, 8);
|
|
103
|
+
}, [h, O, ke, W.onlineUsers, ye, T, xe, be, y]), { data: z } = Te(yt(M)), { data: J = [] } = Te({
|
|
104
|
+
queryKey: ["nvr-chat-record-pick", A],
|
|
98
105
|
queryFn: async () => {
|
|
99
106
|
const e = [];
|
|
100
|
-
for (const t of
|
|
107
|
+
for (const t of z ?? [])
|
|
101
108
|
try {
|
|
102
|
-
const
|
|
103
|
-
|
|
109
|
+
const s = await M.request(
|
|
110
|
+
ut(`/items/${t.collection}`, {
|
|
104
111
|
limit: 5,
|
|
105
112
|
fields: `id,${t.match_field}`,
|
|
106
|
-
filter: JSON.stringify({ [t.match_field]: { _contains:
|
|
113
|
+
filter: JSON.stringify({ [t.match_field]: { _contains: A } }),
|
|
107
114
|
sort: "-id"
|
|
108
115
|
})
|
|
109
116
|
);
|
|
110
|
-
for (const
|
|
111
|
-
const
|
|
112
|
-
|
|
117
|
+
for (const n of s.data ?? []) {
|
|
118
|
+
const a = String(n[t.match_field] ?? n.id ?? "");
|
|
119
|
+
a && e.push({ token: a, label: a, type: t.label ?? t.collection.replace(/_/g, " ") });
|
|
113
120
|
}
|
|
114
121
|
} catch {
|
|
115
122
|
}
|
|
116
123
|
return e.slice(0, 8);
|
|
117
124
|
},
|
|
118
|
-
enabled:
|
|
125
|
+
enabled: !!A && A.length >= 2 && ((z == null ? void 0 : z.length) ?? 0) > 0,
|
|
119
126
|
staleTime: 3e4
|
|
120
|
-
}),
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
127
|
+
}), E = B !== null && L.length > 0, we = E || h !== null && K.length > 0 || A !== null && J.length > 0, le = (e, t) => {
|
|
128
|
+
const s = N.current, n = (s == null ? void 0 : s.selectionStart) ?? i.length, a = i.slice(0, n).replace(e, t), u = a + i.slice(n);
|
|
129
|
+
p(u), requestAnimationFrame(() => {
|
|
130
|
+
s == null || s.focus(), s == null || s.setSelectionRange(a.length, a.length);
|
|
124
131
|
});
|
|
125
|
-
},
|
|
132
|
+
}, ve = (e) => {
|
|
126
133
|
if (e.kind === "here" || e.kind === "channel")
|
|
127
|
-
|
|
134
|
+
le(/@([^@\n\r]*)$/, `@${e.display_name} `);
|
|
128
135
|
else {
|
|
129
136
|
const t = e.display_name ?? "Unknown";
|
|
130
|
-
|
|
137
|
+
le(/@([^@\n\r]*)$/, `@[${t}] `), e.kind === "person" && ae.current.set(t, e.user_id);
|
|
131
138
|
}
|
|
132
|
-
|
|
133
|
-
},
|
|
134
|
-
|
|
135
|
-
},
|
|
136
|
-
for (const
|
|
137
|
-
const n = `${Date.now()}-${Math.random().toString(36).slice(2)}`,
|
|
139
|
+
j(null);
|
|
140
|
+
}, Ne = (e) => {
|
|
141
|
+
le(/#([A-Za-z0-9-]{1,30})$/, `${e.token} `), H(null);
|
|
142
|
+
}, Q = (e, t) => {
|
|
143
|
+
for (const s of e.slice(0, 10)) {
|
|
144
|
+
const n = `${Date.now()}-${Math.random().toString(36).slice(2)}`, a = new XMLHttpRequest(), u = {
|
|
138
145
|
key: n,
|
|
139
|
-
name:
|
|
140
|
-
type:
|
|
146
|
+
name: s.name,
|
|
147
|
+
type: s.type || null,
|
|
141
148
|
progress: 0,
|
|
142
149
|
id: null,
|
|
143
|
-
xhr:
|
|
150
|
+
xhr: a,
|
|
144
151
|
error: null
|
|
145
152
|
};
|
|
146
|
-
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
},
|
|
151
|
-
if (
|
|
153
|
+
I((o) => [...o, u]);
|
|
154
|
+
const g = (o) => I((R) => R.map((ie) => ie.key === n ? { ...ie, ...o } : ie));
|
|
155
|
+
a.upload.onprogress = (o) => {
|
|
156
|
+
o.lengthComputable && g({ progress: o.loaded / o.total });
|
|
157
|
+
}, a.onload = () => {
|
|
158
|
+
if (a.status >= 200 && a.status < 300)
|
|
152
159
|
try {
|
|
153
|
-
const
|
|
154
|
-
|
|
160
|
+
const o = JSON.parse(a.responseText).data.id;
|
|
161
|
+
t ? t(o).catch(() => null).then(() => g({ id: o, progress: 1, xhr: null })) : g({ id: o, progress: 1, xhr: null });
|
|
155
162
|
} catch {
|
|
156
|
-
|
|
163
|
+
g({ error: "Upload failed", xhr: null });
|
|
157
164
|
}
|
|
158
165
|
else {
|
|
159
|
-
let
|
|
166
|
+
let o = "Upload failed";
|
|
160
167
|
try {
|
|
161
|
-
|
|
168
|
+
o = JSON.parse(a.responseText).error ?? o;
|
|
162
169
|
} catch {
|
|
163
170
|
}
|
|
164
|
-
|
|
171
|
+
g({ error: o, xhr: null });
|
|
165
172
|
}
|
|
166
|
-
},
|
|
167
|
-
for (const [
|
|
168
|
-
|
|
169
|
-
const
|
|
170
|
-
|
|
173
|
+
}, a.onerror = () => g({ error: "Upload failed", xhr: null }), a.open("POST", `${S.apiBase}/files/upload`);
|
|
174
|
+
for (const [o, R] of Object.entries(S.authHeaders)) a.setRequestHeader(o, R);
|
|
175
|
+
a.withCredentials = S.credentials === "include";
|
|
176
|
+
const l = new FormData();
|
|
177
|
+
l.append("file", s), a.send(l);
|
|
171
178
|
}
|
|
172
|
-
},
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
179
|
+
}, ze = async (e) => {
|
|
180
|
+
let t = null;
|
|
181
|
+
if (e.poster)
|
|
182
|
+
try {
|
|
183
|
+
const s = new FormData();
|
|
184
|
+
s.append(
|
|
185
|
+
"file",
|
|
186
|
+
new File([e.poster], e.file.name.replace(/\.webm$/, ".png"), { type: "image/png" })
|
|
187
|
+
);
|
|
188
|
+
const n = await fetch(`${S.apiBase}/files/upload`, {
|
|
189
|
+
method: "POST",
|
|
190
|
+
headers: S.authHeaders,
|
|
191
|
+
credentials: S.credentials,
|
|
192
|
+
body: s
|
|
193
|
+
});
|
|
194
|
+
n.ok && (t = (await n.json()).data.id, M.request(Re(`/files/${t}`, { tags: [Dt], title: "Clip poster" })).catch(() => null));
|
|
195
|
+
} catch {
|
|
196
|
+
}
|
|
197
|
+
Q(
|
|
198
|
+
[e.file],
|
|
199
|
+
(s) => M.request(Re(`/files/${s}`, { tags: Mt(t, e.durationMs) })).then(() => {
|
|
200
|
+
})
|
|
201
|
+
);
|
|
202
|
+
}, Je = (e) => I((t) => {
|
|
203
|
+
var s, n;
|
|
204
|
+
return (n = (s = t.find((a) => a.key === e)) == null ? void 0 : s.xhr) == null || n.abort(), t.filter((a) => a.key !== e);
|
|
205
|
+
}), oe = F.some((e) => !e.id && !e.error), _e = () => {
|
|
206
|
+
const e = i.trim(), t = F.filter((n) => n.id).map((n) => n.id), s = [...ae.current.entries()].filter(([n]) => e.includes(`@[${n}]`)).map(([, n]) => n);
|
|
207
|
+
return { text: e, attachments: t, mentions: s };
|
|
208
|
+
}, Se = () => {
|
|
209
|
+
p(""), I([]), pe(!1), j(null), H(null), ne(null), ae.current.clear(), v == null || v(), ue.clearTyping();
|
|
210
|
+
}, Ce = (e) => {
|
|
211
|
+
V(null), e.builtin ? (te({ kind: e.name, text: "" }), p("")) : (p(`/${e.name} `), requestAnimationFrame(() => {
|
|
182
212
|
var t;
|
|
183
|
-
return (t =
|
|
213
|
+
return (t = N.current) == null ? void 0 : t.focus();
|
|
184
214
|
}));
|
|
185
|
-
},
|
|
186
|
-
const e =
|
|
215
|
+
}, Qe = () => {
|
|
216
|
+
const e = Ut(i.trim());
|
|
187
217
|
if (!e) return !1;
|
|
188
|
-
const t =
|
|
189
|
-
return t ? t.builtin ? (
|
|
190
|
-
|
|
191
|
-
).then((
|
|
192
|
-
var
|
|
193
|
-
(
|
|
218
|
+
const t = se.find((s) => s.name === e.name);
|
|
219
|
+
return t ? t.builtin ? (te({ kind: e.name, text: e.args }), p(""), !0) : (M.request(
|
|
220
|
+
pt(`/chat/commands/${e.name}/run`, { room: d, args: e.args })
|
|
221
|
+
).then((s) => {
|
|
222
|
+
var n;
|
|
223
|
+
(n = s.data) != null && n.reply && U.message(s.data.reply);
|
|
194
224
|
}).catch(
|
|
195
|
-
(
|
|
196
|
-
var
|
|
197
|
-
return
|
|
225
|
+
(s) => {
|
|
226
|
+
var n;
|
|
227
|
+
return U.error(((n = s == null ? void 0 : s.response) == null ? void 0 : n.error) ?? "Command failed");
|
|
198
228
|
}
|
|
199
|
-
),
|
|
200
|
-
},
|
|
201
|
-
if (
|
|
202
|
-
const { text: e, attachments: t, mentions:
|
|
203
|
-
!e && t.length === 0 || (
|
|
204
|
-
},
|
|
205
|
-
const { text: t, attachments:
|
|
206
|
-
if (!t &&
|
|
207
|
-
|
|
229
|
+
), p(""), !0) : !1;
|
|
230
|
+
}, $e = () => {
|
|
231
|
+
if (P || oe || Qe()) return;
|
|
232
|
+
const { text: e, attachments: t, mentions: s } = _e();
|
|
233
|
+
!e && t.length === 0 || (Le.mutate({ text: e, mentions: s, attachments: t, parentId: f, quoteId: (k == null ? void 0 : k.id) ?? null, urgent: w }), Se(), Y == null || Y(e));
|
|
234
|
+
}, De = (e) => {
|
|
235
|
+
const { text: t, attachments: s } = _e();
|
|
236
|
+
if (!t && s.length === 0) {
|
|
237
|
+
U.error("Write the message first");
|
|
208
238
|
return;
|
|
209
239
|
}
|
|
210
|
-
|
|
211
|
-
{ room:
|
|
240
|
+
Ie.mutate(
|
|
241
|
+
{ room: d, message: t, attachments: s, parent_id: f, send_at: e.toISOString() },
|
|
212
242
|
{
|
|
213
243
|
onSuccess: () => {
|
|
214
|
-
|
|
244
|
+
U.success(
|
|
215
245
|
`Scheduled for ${e.toLocaleString(void 0, { weekday: "short", month: "short", day: "numeric", hour: "numeric", minute: "2-digit" })}`,
|
|
216
246
|
{ description: "Find it under Scheduled in the chat panel." }
|
|
217
|
-
),
|
|
247
|
+
), Se(), me(!1);
|
|
218
248
|
},
|
|
219
|
-
onError: (
|
|
220
|
-
var
|
|
221
|
-
return
|
|
222
|
-
((
|
|
249
|
+
onError: (n) => {
|
|
250
|
+
var a;
|
|
251
|
+
return U.error(
|
|
252
|
+
((a = n == null ? void 0 : n.response) == null ? void 0 : a.error) ?? "Could not schedule it"
|
|
223
253
|
);
|
|
224
254
|
}
|
|
225
255
|
}
|
|
226
256
|
);
|
|
227
|
-
},
|
|
228
|
-
const e = /* @__PURE__ */ new Date(), t = new Date(e.getTime() + 60 * 6e4),
|
|
229
|
-
|
|
230
|
-
const
|
|
231
|
-
return
|
|
257
|
+
}, Xe = X(() => {
|
|
258
|
+
const e = /* @__PURE__ */ new Date(), t = new Date(e.getTime() + 60 * 6e4), s = new Date(e);
|
|
259
|
+
s.setDate(e.getDate() + 1), s.setHours(9, 0, 0, 0);
|
|
260
|
+
const n = new Date(e);
|
|
261
|
+
return n.setDate(e.getDate() + ((8 - e.getDay()) % 7 || 7)), n.setHours(9, 0, 0, 0), [
|
|
232
262
|
{ label: "In 1 hour", at: t },
|
|
233
|
-
{ label: "Tomorrow 9:00 AM", at:
|
|
234
|
-
{ label: "Monday 9:00 AM", at:
|
|
263
|
+
{ label: "Tomorrow 9:00 AM", at: s },
|
|
264
|
+
{ label: "Monday 9:00 AM", at: n }
|
|
235
265
|
];
|
|
236
|
-
}, [
|
|
237
|
-
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
const
|
|
241
|
-
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
},
|
|
245
|
-
if (
|
|
246
|
-
const t =
|
|
266
|
+
}, [he]), Ye = (e, t) => {
|
|
267
|
+
p(e), ue.onType();
|
|
268
|
+
const s = wt(e, t);
|
|
269
|
+
j(s);
|
|
270
|
+
const n = s === null ? Pt(e, t) : null;
|
|
271
|
+
H(n);
|
|
272
|
+
const a = s === null && n === null ? Rt(e, t) : null;
|
|
273
|
+
V(a), (s !== null || n !== null || a !== null) && G(0);
|
|
274
|
+
}, Ze = (e) => {
|
|
275
|
+
if (we) {
|
|
276
|
+
const t = E ? L.length : h !== null ? K.length : J.length;
|
|
247
277
|
if (e.key === "ArrowDown") {
|
|
248
|
-
e.preventDefault(),
|
|
278
|
+
e.preventDefault(), G((s) => (s + 1) % t);
|
|
249
279
|
return;
|
|
250
280
|
}
|
|
251
281
|
if (e.key === "ArrowUp") {
|
|
252
|
-
e.preventDefault(),
|
|
282
|
+
e.preventDefault(), G((s) => (s - 1 + t) % t);
|
|
253
283
|
return;
|
|
254
284
|
}
|
|
255
285
|
if (e.key === "Enter" || e.key === "Tab") {
|
|
256
|
-
e.preventDefault(),
|
|
286
|
+
e.preventDefault(), E ? Ce(L[C]) : h !== null ? ve(K[C]) : Ne(J[C]);
|
|
257
287
|
return;
|
|
258
288
|
}
|
|
259
289
|
if (e.key === "Escape") {
|
|
260
|
-
e.preventDefault(),
|
|
290
|
+
e.preventDefault(), j(null), H(null), V(null);
|
|
261
291
|
return;
|
|
262
292
|
}
|
|
263
293
|
}
|
|
264
|
-
if ((e.metaKey || e.ctrlKey) &&
|
|
294
|
+
if ((e.metaKey || e.ctrlKey) && Ue[e.key.toLowerCase()]) {
|
|
265
295
|
e.preventDefault();
|
|
266
|
-
const [t,
|
|
267
|
-
|
|
296
|
+
const [t, s] = Ue[e.key.toLowerCase()], n = e.currentTarget, a = n.selectionStart, u = n.selectionEnd, g = i.slice(0, a) + t + i.slice(a, u) + s + i.slice(u);
|
|
297
|
+
p(g), requestAnimationFrame(() => n.setSelectionRange(a + t.length, u + t.length));
|
|
268
298
|
return;
|
|
269
299
|
}
|
|
270
|
-
e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing && (e.preventDefault(),
|
|
271
|
-
},
|
|
300
|
+
e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing && (e.preventDefault(), $e()), e.key === "Escape" && k && (v == null || v());
|
|
301
|
+
}, Ge = (e) => {
|
|
272
302
|
const t = [...e.clipboardData.files];
|
|
273
303
|
if (t.length > 0) {
|
|
274
|
-
e.preventDefault(),
|
|
304
|
+
e.preventDefault(), Q(t);
|
|
275
305
|
return;
|
|
276
306
|
}
|
|
277
|
-
const
|
|
278
|
-
if (
|
|
307
|
+
const s = e.clipboardData.getData("text/plain"), n = s ? Ct(s) : null;
|
|
308
|
+
if (n) {
|
|
279
309
|
e.preventDefault();
|
|
280
|
-
const
|
|
310
|
+
const a = e.currentTarget, u = a.selectionStart, g = a.selectionEnd, l = i.slice(0, u), o = `${l && !l.endsWith(`
|
|
281
311
|
`) ? `
|
|
282
|
-
` : ""}${
|
|
312
|
+
` : ""}${n}
|
|
283
313
|
`;
|
|
284
|
-
|
|
314
|
+
p(l + o + i.slice(g)), ne({ raw: s, table: o });
|
|
285
315
|
}
|
|
286
|
-
},
|
|
287
|
-
|
|
316
|
+
}, Ve = () => {
|
|
317
|
+
q && (p((e) => e.replace(q.table, q.raw)), ne(null));
|
|
288
318
|
};
|
|
289
|
-
return
|
|
319
|
+
return P ? /* @__PURE__ */ r(
|
|
290
320
|
"div",
|
|
291
321
|
{
|
|
292
322
|
className: m(
|
|
293
323
|
"shrink-0 border-t px-3 py-2.5 text-center text-[11.5px] text-slate-500 dark:text-slate-400",
|
|
294
|
-
|
|
324
|
+
x.divider
|
|
295
325
|
),
|
|
296
326
|
"data-chat-composer-closed": !0,
|
|
297
|
-
children:
|
|
327
|
+
children: P
|
|
298
328
|
}
|
|
299
|
-
) : /* @__PURE__ */
|
|
300
|
-
|
|
301
|
-
|
|
329
|
+
) : /* @__PURE__ */ c("div", { className: m("shrink-0 border-t", x.divider), "data-chat-composer-wrap": !0, children: [
|
|
330
|
+
de && i.trim() && /* @__PURE__ */ r(
|
|
331
|
+
"p",
|
|
302
332
|
{
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
parentId: x,
|
|
307
|
-
onClose: () => G(null),
|
|
308
|
-
th: h
|
|
333
|
+
className: "px-3 pt-1.5 text-[11px] text-slate-500 dark:text-slate-400",
|
|
334
|
+
"data-chat-off-hours-note": !0,
|
|
335
|
+
children: de
|
|
309
336
|
}
|
|
310
337
|
),
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
338
|
+
ee && /* @__PURE__ */ r(
|
|
339
|
+
Ft,
|
|
340
|
+
{
|
|
341
|
+
kind: ee.kind,
|
|
342
|
+
room: d,
|
|
343
|
+
initialText: ee.text,
|
|
344
|
+
parentId: f,
|
|
345
|
+
onClose: () => te(null),
|
|
346
|
+
th: x
|
|
347
|
+
}
|
|
348
|
+
),
|
|
349
|
+
k && /* @__PURE__ */ c("div", { className: "flex items-start gap-2 px-3 pt-2", "data-chat-quote-draft": !0, children: [
|
|
350
|
+
/* @__PURE__ */ r(et, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-slate-400" }),
|
|
351
|
+
/* @__PURE__ */ c("div", { className: "min-w-0 flex-1 text-[11.5px]", children: [
|
|
352
|
+
/* @__PURE__ */ c("span", { className: "font-semibold text-slate-600 dark:text-slate-300", children: [
|
|
315
353
|
"Quoting ",
|
|
316
|
-
|
|
354
|
+
k.sender_name ?? "a message"
|
|
317
355
|
] }),
|
|
318
|
-
/* @__PURE__ */
|
|
356
|
+
/* @__PURE__ */ r("p", { className: "truncate text-slate-500 dark:text-slate-400", children: k.deleted_at ? "Message removed" : k.message || "Attachment" })
|
|
319
357
|
] }),
|
|
320
|
-
/* @__PURE__ */
|
|
358
|
+
/* @__PURE__ */ r(
|
|
321
359
|
"button",
|
|
322
360
|
{
|
|
323
361
|
type: "button",
|
|
324
|
-
onClick:
|
|
362
|
+
onClick: v,
|
|
325
363
|
className: "rounded p-0.5 text-slate-400 hover:text-slate-700 dark:hover:text-slate-100",
|
|
326
364
|
"aria-label": "Stop quoting",
|
|
327
|
-
children: /* @__PURE__ */
|
|
365
|
+
children: /* @__PURE__ */ r(Ae, { className: "h-3.5 w-3.5" })
|
|
328
366
|
}
|
|
329
367
|
)
|
|
330
368
|
] }),
|
|
331
|
-
|
|
369
|
+
F.length > 0 && /* @__PURE__ */ r("div", { className: "flex flex-wrap items-center gap-1.5 px-3 pt-2", children: F.map((e) => /* @__PURE__ */ c(
|
|
332
370
|
"span",
|
|
333
371
|
{
|
|
334
372
|
className: m(
|
|
@@ -338,7 +376,7 @@ const Et = Ze(function({
|
|
|
338
376
|
title: e.error ?? e.name,
|
|
339
377
|
"data-chat-upload": e.id ? "done" : e.error ? "failed" : "uploading",
|
|
340
378
|
children: [
|
|
341
|
-
!e.id && !e.error && /* @__PURE__ */
|
|
379
|
+
!e.id && !e.error && /* @__PURE__ */ r(
|
|
342
380
|
"span",
|
|
343
381
|
{
|
|
344
382
|
className: "absolute inset-y-0 left-0 bg-nvr-cyan/15 transition-[width]",
|
|
@@ -346,28 +384,28 @@ const Et = Ze(function({
|
|
|
346
384
|
"aria-hidden": !0
|
|
347
385
|
}
|
|
348
386
|
),
|
|
349
|
-
/* @__PURE__ */
|
|
350
|
-
/* @__PURE__ */
|
|
351
|
-
!e.id && !e.error && /* @__PURE__ */
|
|
387
|
+
/* @__PURE__ */ r(Fe, { className: "relative h-3 w-3 shrink-0 opacity-60" }),
|
|
388
|
+
/* @__PURE__ */ r("span", { className: "relative truncate", children: e.error ? `${e.name} — ${e.error}` : e.name }),
|
|
389
|
+
!e.id && !e.error && /* @__PURE__ */ c("span", { className: "relative tabular-nums text-slate-500", children: [
|
|
352
390
|
Math.round(e.progress * 100),
|
|
353
391
|
"%"
|
|
354
392
|
] }),
|
|
355
|
-
/* @__PURE__ */
|
|
393
|
+
/* @__PURE__ */ r(
|
|
356
394
|
"button",
|
|
357
395
|
{
|
|
358
396
|
type: "button",
|
|
359
|
-
onClick: () =>
|
|
397
|
+
onClick: () => Je(e.key),
|
|
360
398
|
className: "relative text-slate-400 hover:text-red-500",
|
|
361
399
|
"aria-label": e.id || e.error ? `Remove ${e.name}` : `Cancel ${e.name}`,
|
|
362
400
|
title: e.id || e.error ? "Remove" : "Cancel upload",
|
|
363
|
-
children: /* @__PURE__ */
|
|
401
|
+
children: /* @__PURE__ */ r(Ae, { className: "h-3 w-3" })
|
|
364
402
|
}
|
|
365
403
|
)
|
|
366
404
|
]
|
|
367
405
|
},
|
|
368
406
|
e.key
|
|
369
407
|
)) }),
|
|
370
|
-
|
|
408
|
+
q && /* @__PURE__ */ c(
|
|
371
409
|
"p",
|
|
372
410
|
{
|
|
373
411
|
className: "px-3 pt-1.5 text-[11px] text-slate-500 dark:text-slate-400",
|
|
@@ -375,11 +413,11 @@ const Et = Ze(function({
|
|
|
375
413
|
children: [
|
|
376
414
|
"Pasted as a table.",
|
|
377
415
|
" ",
|
|
378
|
-
/* @__PURE__ */
|
|
416
|
+
/* @__PURE__ */ r(
|
|
379
417
|
"button",
|
|
380
418
|
{
|
|
381
419
|
type: "button",
|
|
382
|
-
onClick:
|
|
420
|
+
onClick: Ve,
|
|
383
421
|
className: "font-medium underline underline-offset-2",
|
|
384
422
|
children: "Paste as plain text instead"
|
|
385
423
|
}
|
|
@@ -387,144 +425,160 @@ const Et = Ze(function({
|
|
|
387
425
|
]
|
|
388
426
|
}
|
|
389
427
|
),
|
|
390
|
-
/* @__PURE__ */
|
|
428
|
+
/* @__PURE__ */ c(
|
|
391
429
|
"form",
|
|
392
430
|
{
|
|
393
|
-
className: m("relative",
|
|
431
|
+
className: m("relative", je ? "p-2" : "p-2.5"),
|
|
394
432
|
onSubmit: (e) => {
|
|
395
|
-
e.preventDefault(),
|
|
433
|
+
e.preventDefault(), $e();
|
|
396
434
|
},
|
|
397
435
|
"data-chat-composer": !0,
|
|
398
436
|
children: [
|
|
399
|
-
|
|
437
|
+
we && /* @__PURE__ */ r(
|
|
400
438
|
"div",
|
|
401
439
|
{
|
|
402
440
|
className: m(
|
|
403
441
|
"absolute bottom-full left-2.5 z-20 mb-1 w-[300px] overflow-hidden rounded-xl border shadow-lg",
|
|
404
|
-
|
|
442
|
+
x.surface,
|
|
405
443
|
"border-slate-200 dark:border-border"
|
|
406
444
|
),
|
|
407
|
-
"data-chat-picker":
|
|
408
|
-
children:
|
|
409
|
-
|
|
445
|
+
"data-chat-picker": E ? "slash" : h !== null ? "mention" : "record",
|
|
446
|
+
children: E ? /* @__PURE__ */ r(
|
|
447
|
+
Et,
|
|
410
448
|
{
|
|
411
|
-
entries:
|
|
412
|
-
index:
|
|
413
|
-
onPick:
|
|
414
|
-
accentSoft:
|
|
449
|
+
entries: L,
|
|
450
|
+
index: C,
|
|
451
|
+
onPick: Ce,
|
|
452
|
+
accentSoft: x.accentSoft
|
|
415
453
|
}
|
|
416
|
-
) :
|
|
454
|
+
) : h !== null ? K.map((e, t) => /* @__PURE__ */ c(
|
|
417
455
|
"button",
|
|
418
456
|
{
|
|
419
457
|
type: "button",
|
|
420
|
-
onMouseDown: (
|
|
421
|
-
|
|
458
|
+
onMouseDown: (s) => {
|
|
459
|
+
s.preventDefault(), ve(e);
|
|
422
460
|
},
|
|
423
461
|
className: m(
|
|
424
462
|
"flex w-full items-center gap-2 px-3 py-1.5 text-left text-[12.5px]",
|
|
425
|
-
t ===
|
|
463
|
+
t === C ? x.accentSoft : "text-slate-700 dark:text-slate-200"
|
|
426
464
|
),
|
|
427
465
|
children: [
|
|
428
|
-
e.kind === "person" || e.kind === "bot" ?
|
|
429
|
-
/* @__PURE__ */
|
|
466
|
+
e.kind === "person" || e.kind === "bot" ? He(e.user_id, e.display_name) : /* @__PURE__ */ r("span", { className: "flex h-[22px] w-[22px] items-center justify-center rounded-full bg-slate-200 text-[11px] font-bold text-slate-600 dark:bg-muted dark:text-slate-300", children: "@" }),
|
|
467
|
+
/* @__PURE__ */ c("span", { className: "min-w-0 flex-1 truncate", children: [
|
|
430
468
|
e.kind === "here" || e.kind === "channel" ? `@${e.display_name}` : e.display_name,
|
|
431
|
-
e.sub && /* @__PURE__ */
|
|
469
|
+
e.sub && /* @__PURE__ */ r("span", { className: "ml-1.5 text-[11px] text-slate-500 dark:text-slate-400", children: e.sub })
|
|
432
470
|
] })
|
|
433
471
|
]
|
|
434
472
|
},
|
|
435
473
|
e.user_id
|
|
436
|
-
)) :
|
|
474
|
+
)) : J.map((e, t) => /* @__PURE__ */ c(
|
|
437
475
|
"button",
|
|
438
476
|
{
|
|
439
477
|
type: "button",
|
|
440
|
-
onMouseDown: (
|
|
441
|
-
|
|
478
|
+
onMouseDown: (s) => {
|
|
479
|
+
s.preventDefault(), Ne(e);
|
|
442
480
|
},
|
|
443
481
|
className: m(
|
|
444
482
|
"flex w-full items-center gap-2 px-3 py-1.5 text-left text-[12.5px]",
|
|
445
|
-
t ===
|
|
483
|
+
t === C ? x.accentSoft : "text-slate-700 dark:text-slate-200"
|
|
446
484
|
),
|
|
447
485
|
children: [
|
|
448
|
-
/* @__PURE__ */
|
|
449
|
-
/* @__PURE__ */
|
|
450
|
-
/* @__PURE__ */
|
|
486
|
+
/* @__PURE__ */ r(tt, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
|
|
487
|
+
/* @__PURE__ */ r("span", { className: "min-w-0 flex-1 truncate font-medium", children: e.label }),
|
|
488
|
+
/* @__PURE__ */ r("span", { className: "shrink-0 text-[10.5px] capitalize text-slate-500 dark:text-slate-400", children: e.type })
|
|
451
489
|
]
|
|
452
490
|
},
|
|
453
491
|
`${e.type}:${e.token}`
|
|
454
492
|
))
|
|
455
493
|
}
|
|
456
494
|
),
|
|
457
|
-
/* @__PURE__ */
|
|
495
|
+
/* @__PURE__ */ c(
|
|
458
496
|
"div",
|
|
459
497
|
{
|
|
460
498
|
className: m(
|
|
461
499
|
"rounded-lg border transition-colors focus-within:border-nvr-cyan",
|
|
462
|
-
|
|
463
|
-
|
|
500
|
+
x.input,
|
|
501
|
+
w && "border-red-400 focus-within:border-red-500 dark:border-red-500"
|
|
464
502
|
),
|
|
465
503
|
"data-chat-composer-box": !0,
|
|
466
504
|
children: [
|
|
467
|
-
/* @__PURE__ */
|
|
505
|
+
/* @__PURE__ */ r(
|
|
468
506
|
"textarea",
|
|
469
507
|
{
|
|
470
|
-
ref:
|
|
508
|
+
ref: N,
|
|
471
509
|
rows: 1,
|
|
472
|
-
value:
|
|
473
|
-
onChange: (e) =>
|
|
474
|
-
onKeyDown:
|
|
475
|
-
onPaste:
|
|
476
|
-
placeholder:
|
|
510
|
+
value: i,
|
|
511
|
+
onChange: (e) => Ye(e.target.value, e.target.selectionStart ?? e.target.value.length),
|
|
512
|
+
onKeyDown: Ze,
|
|
513
|
+
onPaste: Ge,
|
|
514
|
+
placeholder: f ? "Reply in thread…" : `Message ${_}…`,
|
|
477
515
|
className: "block min-h-9 w-full resize-none bg-transparent px-3 pb-1 pt-2 text-[12.5px] leading-[19px] outline-none placeholder:text-slate-500 dark:placeholder:text-slate-400",
|
|
478
|
-
"aria-label":
|
|
516
|
+
"aria-label": f ? "Reply in thread" : `Message ${_}`,
|
|
479
517
|
"data-chat-input": !0
|
|
480
518
|
}
|
|
481
519
|
),
|
|
482
|
-
/* @__PURE__ */
|
|
483
|
-
/* @__PURE__ */
|
|
520
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-0.5 px-1 pb-1", "data-chat-composer-tools": !0, children: [
|
|
521
|
+
/* @__PURE__ */ r(
|
|
484
522
|
"input",
|
|
485
523
|
{
|
|
486
|
-
ref:
|
|
524
|
+
ref: fe,
|
|
487
525
|
type: "file",
|
|
488
526
|
multiple: !0,
|
|
489
527
|
className: "hidden",
|
|
490
528
|
onChange: (e) => {
|
|
491
|
-
|
|
529
|
+
Q([...e.target.files ?? []]), e.target.value = "";
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
),
|
|
533
|
+
/* @__PURE__ */ r(Wt, { botName: T }),
|
|
534
|
+
/* @__PURE__ */ r(
|
|
535
|
+
Nt,
|
|
536
|
+
{
|
|
537
|
+
label: "Emoji",
|
|
538
|
+
className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md p-0 text-slate-500 hover:bg-slate-200/70 hover:text-slate-700 dark:text-slate-400 dark:hover:bg-white/10 dark:hover:text-slate-100 [&>svg]:h-4 [&>svg]:w-4",
|
|
539
|
+
onPick: (e) => {
|
|
540
|
+
const t = N.current, s = (t == null ? void 0 : t.selectionStart) ?? i.length, n = (t == null ? void 0 : t.selectionEnd) ?? i.length, a = e.startsWith(":") && s > 0 && !/\s$/.test(i.slice(0, s)) ? " " : "";
|
|
541
|
+
p(i.slice(0, s) + a + e + i.slice(n)), requestAnimationFrame(() => {
|
|
542
|
+
t == null || t.focus();
|
|
543
|
+
const u = s + a.length + e.length;
|
|
544
|
+
t == null || t.setSelectionRange(u, u);
|
|
545
|
+
});
|
|
492
546
|
}
|
|
493
547
|
}
|
|
494
548
|
),
|
|
495
|
-
/* @__PURE__ */
|
|
496
|
-
/* @__PURE__ */ a(
|
|
549
|
+
/* @__PURE__ */ r(
|
|
497
550
|
"button",
|
|
498
551
|
{
|
|
499
552
|
type: "button",
|
|
500
553
|
onClick: () => {
|
|
501
554
|
var e;
|
|
502
|
-
return (e =
|
|
555
|
+
return (e = fe.current) == null ? void 0 : e.click();
|
|
503
556
|
},
|
|
504
557
|
className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-slate-500 transition-colors hover:bg-slate-200/70 hover:text-slate-700 dark:text-slate-400 dark:hover:bg-white/10 dark:hover:text-slate-100",
|
|
505
558
|
"aria-label": "Attach a file",
|
|
506
559
|
title: "Attach a file (or paste / drop one)",
|
|
507
|
-
children: /* @__PURE__ */
|
|
560
|
+
children: /* @__PURE__ */ r(Fe, { className: "h-4 w-4", strokeWidth: 2 })
|
|
508
561
|
}
|
|
509
562
|
),
|
|
510
|
-
/* @__PURE__ */
|
|
563
|
+
/* @__PURE__ */ r($t, { onClip: (e) => void ze(e), disabled: !!P }),
|
|
564
|
+
/* @__PURE__ */ r(
|
|
511
565
|
"button",
|
|
512
566
|
{
|
|
513
567
|
type: "button",
|
|
514
|
-
onClick: () =>
|
|
568
|
+
onClick: () => pe((e) => !e),
|
|
515
569
|
className: m(
|
|
516
570
|
"flex h-7 w-7 shrink-0 items-center justify-center rounded-md transition-colors",
|
|
517
|
-
|
|
571
|
+
w ? "bg-red-50 text-red-600 dark:bg-red-500/15 dark:text-red-300" : "text-slate-500 hover:bg-slate-200/70 hover:text-slate-700 dark:text-slate-400 dark:hover:bg-white/10 dark:hover:text-slate-100"
|
|
518
572
|
),
|
|
519
|
-
"aria-pressed":
|
|
573
|
+
"aria-pressed": w,
|
|
520
574
|
"aria-label": "Mark urgent",
|
|
521
|
-
title:
|
|
522
|
-
"data-chat-urgent-toggle":
|
|
523
|
-
children: /* @__PURE__ */
|
|
575
|
+
title: w ? "Urgent: reaches people even when they muted the room (5 per hour)" : "Mark urgent — breaks through mute for the people it is addressed to",
|
|
576
|
+
"data-chat-urgent-toggle": w ? "on" : "off",
|
|
577
|
+
children: /* @__PURE__ */ r(st, { className: "h-4 w-4", strokeWidth: 2 })
|
|
524
578
|
}
|
|
525
579
|
),
|
|
526
|
-
/* @__PURE__ */
|
|
527
|
-
/* @__PURE__ */
|
|
580
|
+
/* @__PURE__ */ c(Pe, { open: he, onOpenChange: me, children: [
|
|
581
|
+
/* @__PURE__ */ r(We, { asChild: !0, children: /* @__PURE__ */ r(
|
|
528
582
|
"button",
|
|
529
583
|
{
|
|
530
584
|
type: "button",
|
|
@@ -532,44 +586,44 @@ const Et = Ze(function({
|
|
|
532
586
|
"aria-label": "Send later",
|
|
533
587
|
title: "Send later",
|
|
534
588
|
"data-chat-schedule": !0,
|
|
535
|
-
children: /* @__PURE__ */
|
|
589
|
+
children: /* @__PURE__ */ r(nt, { className: "h-4 w-4", strokeWidth: 2 })
|
|
536
590
|
}
|
|
537
591
|
) }),
|
|
538
|
-
/* @__PURE__ */
|
|
539
|
-
/* @__PURE__ */
|
|
540
|
-
|
|
592
|
+
/* @__PURE__ */ c(Oe, { align: "end", side: "top", className: "w-[240px] p-2", children: [
|
|
593
|
+
/* @__PURE__ */ r("p", { className: "px-1 pb-1.5 text-[12px] font-semibold text-slate-800 dark:text-slate-100", children: "Send this later" }),
|
|
594
|
+
Xe.map((e) => /* @__PURE__ */ r(
|
|
541
595
|
"button",
|
|
542
596
|
{
|
|
543
597
|
type: "button",
|
|
544
|
-
onClick: () =>
|
|
598
|
+
onClick: () => De(e.at),
|
|
545
599
|
className: "flex w-full items-center rounded-md px-2 py-1.5 text-left text-[12px] text-slate-700 hover:bg-muted dark:text-slate-200",
|
|
546
600
|
children: e.label
|
|
547
601
|
},
|
|
548
602
|
e.label
|
|
549
603
|
)),
|
|
550
|
-
/* @__PURE__ */
|
|
551
|
-
/* @__PURE__ */
|
|
604
|
+
/* @__PURE__ */ c("div", { className: "mt-1.5 flex items-center gap-1 border-t border-slate-100 pt-2 dark:border-border", children: [
|
|
605
|
+
/* @__PURE__ */ r(
|
|
552
606
|
"input",
|
|
553
607
|
{
|
|
554
608
|
type: "datetime-local",
|
|
555
|
-
value:
|
|
556
|
-
onChange: (e) =>
|
|
609
|
+
value: re,
|
|
610
|
+
onChange: (e) => qe(e.target.value),
|
|
557
611
|
className: m(
|
|
558
612
|
"h-8 min-w-0 flex-1 rounded-md border px-1.5 text-[11.5px] outline-none",
|
|
559
|
-
|
|
613
|
+
x.input
|
|
560
614
|
),
|
|
561
615
|
"aria-label": "Send at"
|
|
562
616
|
}
|
|
563
617
|
),
|
|
564
|
-
/* @__PURE__ */
|
|
618
|
+
/* @__PURE__ */ r(
|
|
565
619
|
"button",
|
|
566
620
|
{
|
|
567
621
|
type: "button",
|
|
568
|
-
disabled: !
|
|
569
|
-
onClick: () =>
|
|
622
|
+
disabled: !re,
|
|
623
|
+
onClick: () => De(new Date(re)),
|
|
570
624
|
className: m(
|
|
571
625
|
"h-8 rounded-md px-2 text-[11.5px] font-medium disabled:opacity-40",
|
|
572
|
-
|
|
626
|
+
x.action
|
|
573
627
|
),
|
|
574
628
|
children: "Set"
|
|
575
629
|
}
|
|
@@ -577,19 +631,19 @@ const Et = Ze(function({
|
|
|
577
631
|
] })
|
|
578
632
|
] })
|
|
579
633
|
] }),
|
|
580
|
-
/* @__PURE__ */
|
|
634
|
+
/* @__PURE__ */ r(
|
|
581
635
|
"button",
|
|
582
636
|
{
|
|
583
637
|
type: "submit",
|
|
584
|
-
disabled: !
|
|
638
|
+
disabled: !i.trim() && !F.some((e) => e.id) || oe,
|
|
585
639
|
className: m(
|
|
586
640
|
"ml-auto flex h-8 w-8 shrink-0 items-center justify-center rounded-md transition-[filter] hover:brightness-110 disabled:opacity-40",
|
|
587
|
-
|
|
641
|
+
w ? "bg-red-600 text-white" : x.action
|
|
588
642
|
),
|
|
589
|
-
"aria-label":
|
|
590
|
-
title:
|
|
643
|
+
"aria-label": w ? "Send urgent" : "Send",
|
|
644
|
+
title: oe ? "Waiting for the upload to finish" : void 0,
|
|
591
645
|
"data-chat-send": !0,
|
|
592
|
-
children: /* @__PURE__ */
|
|
646
|
+
children: /* @__PURE__ */ r(rt, { className: "h-4 w-4", strokeWidth: 2 })
|
|
593
647
|
}
|
|
594
648
|
)
|
|
595
649
|
] })
|
|
@@ -601,10 +655,10 @@ const Et = Ze(function({
|
|
|
601
655
|
)
|
|
602
656
|
] });
|
|
603
657
|
});
|
|
604
|
-
function
|
|
605
|
-
const
|
|
658
|
+
function Wt({ botName: D }) {
|
|
659
|
+
const d = [
|
|
606
660
|
["@name", "Mention someone"],
|
|
607
|
-
...
|
|
661
|
+
...D ? [[`@${D}`, "Ask the assistant"]] : [],
|
|
608
662
|
["**bold**", "Bold (Ctrl/⌘ B)"],
|
|
609
663
|
["_italic_", "Italic (Ctrl/⌘ I)"],
|
|
610
664
|
["`code`", "Code (Ctrl/⌘ E)"],
|
|
@@ -616,8 +670,8 @@ function vt({ botName: C }) {
|
|
|
616
670
|
["#AB26", "Link a record"],
|
|
617
671
|
["Shift + Enter", "New line"]
|
|
618
672
|
];
|
|
619
|
-
return /* @__PURE__ */
|
|
620
|
-
/* @__PURE__ */
|
|
673
|
+
return /* @__PURE__ */ c(Pe, { children: [
|
|
674
|
+
/* @__PURE__ */ r(We, { asChild: !0, children: /* @__PURE__ */ r(
|
|
621
675
|
"button",
|
|
622
676
|
{
|
|
623
677
|
type: "button",
|
|
@@ -625,18 +679,18 @@ function vt({ botName: C }) {
|
|
|
625
679
|
"aria-label": "Formatting and shortcuts",
|
|
626
680
|
title: "Formatting, @mentions and # records",
|
|
627
681
|
"data-chat-format-hint": !0,
|
|
628
|
-
children: /* @__PURE__ */
|
|
682
|
+
children: /* @__PURE__ */ r(at, { className: "h-4 w-4", strokeWidth: 2 })
|
|
629
683
|
}
|
|
630
684
|
) }),
|
|
631
|
-
/* @__PURE__ */
|
|
632
|
-
/* @__PURE__ */
|
|
633
|
-
/* @__PURE__ */
|
|
634
|
-
/* @__PURE__ */
|
|
635
|
-
/* @__PURE__ */
|
|
636
|
-
] },
|
|
685
|
+
/* @__PURE__ */ c(Oe, { align: "end", side: "top", className: "w-[260px] p-3", children: [
|
|
686
|
+
/* @__PURE__ */ r("p", { className: "pb-2 text-[12px] font-semibold text-slate-800 dark:text-slate-100", children: "Writing a message" }),
|
|
687
|
+
/* @__PURE__ */ r("dl", { className: "grid grid-cols-[96px_1fr] gap-x-2 gap-y-1 text-[11.5px]", children: d.map(([_, f]) => /* @__PURE__ */ c("div", { className: "contents", children: [
|
|
688
|
+
/* @__PURE__ */ r("dt", { children: /* @__PURE__ */ r("code", { className: "rounded bg-slate-100 px-1 text-[11px] dark:bg-muted", children: _ }) }),
|
|
689
|
+
/* @__PURE__ */ r("dd", { className: "text-slate-600 dark:text-slate-300", children: f })
|
|
690
|
+
] }, _)) })
|
|
637
691
|
] })
|
|
638
692
|
] });
|
|
639
693
|
}
|
|
640
694
|
export {
|
|
641
|
-
|
|
695
|
+
es as ChatComposer
|
|
642
696
|
};
|