@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.
Files changed (150) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +99 -98
  3. package/dist/index.d.ts +339 -2
  4. package/dist/index.js +644 -618
  5. package/dist/layout-editor.d.ts +4 -0
  6. package/dist/shared/components/BackgroundRunOffer.js +117 -0
  7. package/dist/shared/components/BroadcastView.js +214 -213
  8. package/dist/shared/components/CollectionBrowserView.js +2592 -2695
  9. package/dist/shared/components/ItemEditForm.js +4066 -3832
  10. package/dist/shared/components/JobsTray.js +100 -55
  11. package/dist/shared/components/MyWorkView.js +91 -89
  12. package/dist/shared/components/NotificationBell.js +80 -79
  13. package/dist/shared/components/ProfileView.js +568 -520
  14. package/dist/shared/components/RecordCompare.js +254 -0
  15. package/dist/shared/components/RecordReadView.js +599 -552
  16. package/dist/shared/components/ReportView.js +578 -543
  17. package/dist/shared/components/RowPresence.js +91 -0
  18. package/dist/shared/components/WidgetSlot.js +474 -458
  19. package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
  20. package/dist/shared/components/ai/AskPanel.js +139 -119
  21. package/dist/shared/components/ai/FirstWeekCard.js +126 -0
  22. package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
  23. package/dist/shared/components/bulk/bulk-field-options.js +45 -0
  24. package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
  25. package/dist/shared/components/chat/ChannelArchive.js +326 -0
  26. package/dist/shared/components/chat/ChannelExtras.js +141 -121
  27. package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
  28. package/dist/shared/components/chat/ChatPanel.js +1695 -1733
  29. package/dist/shared/components/chat/Composer.js +357 -303
  30. package/dist/shared/components/chat/MessageActions.js +92 -0
  31. package/dist/shared/components/chat/MessageFormat.js +290 -264
  32. package/dist/shared/components/chat/OutboxBubbles.js +146 -0
  33. package/dist/shared/components/chat/RequestIdCard.js +135 -0
  34. package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
  35. package/dist/shared/components/chat/RoomParts.js +213 -274
  36. package/dist/shared/components/chat/ScreenClip.js +184 -0
  37. package/dist/shared/components/chat/chat-core.js +402 -483
  38. package/dist/shared/components/chat/chat-drafts.js +59 -0
  39. package/dist/shared/components/chat/chat-emoji.js +348 -0
  40. package/dist/shared/components/chat/chat-local-time.js +41 -0
  41. package/dist/shared/components/chat/chat-outbox.js +303 -0
  42. package/dist/shared/components/chat/chat-window.js +163 -0
  43. package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
  44. package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
  45. package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
  46. package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
  47. package/dist/shared/components/help-videos/api.js +76 -73
  48. package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
  49. package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
  50. package/dist/shared/components/item-edit/FieldAffordances.js +2 -2
  51. package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
  52. package/dist/shared/components/item-edit/FieldRow.js +292 -279
  53. package/dist/shared/components/item-edit/GroupSection.js +698 -574
  54. package/dist/shared/components/item-edit/InlineTableField.js +3 -1
  55. package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
  56. package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
  57. package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
  58. package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
  59. package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
  60. package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
  61. package/dist/shared/components/item-edit/lazy-sections.js +36 -0
  62. package/dist/shared/components/item-edit/lock-why.js +39 -32
  63. package/dist/shared/components/item-edit/picker-miss.js +26 -0
  64. package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
  65. package/dist/shared/components/item-edit/useFormUsageBeacon.js +51 -45
  66. package/dist/shared/components/layout-editor/AddPanel.js +134 -117
  67. package/dist/shared/components/layout-editor/ChangeNote.js +25 -24
  68. package/dist/shared/components/layout-editor/CollabParts.js +80 -75
  69. package/dist/shared/components/layout-editor/DesignNode.js +126 -120
  70. package/dist/shared/components/layout-editor/EditorCanvas.js +30 -27
  71. package/dist/shared/components/layout-editor/EditorTopBar.js +203 -192
  72. package/dist/shared/components/layout-editor/HistoryPanel.js +120 -104
  73. package/dist/shared/components/layout-editor/LayoutEditor.js +768 -671
  74. package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
  75. package/dist/shared/components/layout-editor/StagedChip.js +22 -0
  76. package/dist/shared/components/layout-editor/StructureMenu.js +237 -186
  77. package/dist/shared/components/layout-editor/collab/FormFollowShare.js +149 -103
  78. package/dist/shared/components/layout-editor/collab/collab-api.js +29 -26
  79. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +81 -80
  80. package/dist/shared/components/layout-editor/dnd/node.js +69 -57
  81. package/dist/shared/components/layout-editor/draft-recovery.js +113 -43
  82. package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
  83. package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
  84. package/dist/shared/components/layout-editor/entry/presets.js +71 -0
  85. package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
  86. package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
  87. package/dist/shared/components/layout-editor/grid-guides.js +142 -0
  88. package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
  89. package/dist/shared/components/layout-editor/inspector/BulkInspector.js +61 -57
  90. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +247 -151
  91. package/dist/shared/components/layout-editor/inspector/Inspector.js +176 -155
  92. package/dist/shared/components/layout-editor/inspector/LookTab.js +167 -116
  93. package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
  94. package/dist/shared/components/layout-editor/inspector/PickerTab.js +84 -82
  95. package/dist/shared/components/layout-editor/inspector/RulesTab.js +66 -62
  96. package/dist/shared/components/layout-editor/inspector/kit.js +69 -68
  97. package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
  98. package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
  99. package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
  100. package/dist/shared/components/layout-editor/overview/describe-conditions.js +6 -0
  101. package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
  102. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  103. package/dist/shared/components/layout-editor/restore-piece.js +192 -0
  104. package/dist/shared/components/layout-editor/section-structure.js +241 -0
  105. package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
  106. package/dist/shared/components/layout-editor/settings/FormSettings.js +41 -39
  107. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
  108. package/dist/shared/components/layout-editor/settings/ToolsSection.js +147 -111
  109. package/dist/shared/components/layout-editor/settings/WhoSection.js +29 -26
  110. package/dist/shared/components/layout-editor/settings/settings-registry.js +114 -17
  111. package/dist/shared/components/layout-editor/staged-api.js +64 -0
  112. package/dist/shared/components/layout-editor/structure-ops.js +81 -77
  113. package/dist/shared/components/layout-editor/testing/TestingPanels.js +65 -60
  114. package/dist/shared/components/layout-editor/testing/testing-model.js +198 -185
  115. package/dist/shared/components/layout-editor/toolbar-kit.js +11 -11
  116. package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
  117. package/dist/shared/components/layout-editor/usage/UsagePanel.js +144 -70
  118. package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
  119. package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
  120. package/dist/shared/components/layout-editor/useLayoutDraft.js +25 -24
  121. package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
  122. package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
  123. package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
  124. package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
  125. package/dist/shared/components/profile/AgentsPanel.js +479 -0
  126. package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
  127. package/dist/shared/components/support/SupportAnalytics.js +171 -0
  128. package/dist/shared/components/support/SupportView.js +75 -73
  129. package/dist/shared/lib/background-runs.js +150 -0
  130. package/dist/shared/lib/delivery-ack.js +9 -0
  131. package/dist/shared/lib/entry-badge-style.js +13 -0
  132. package/dist/shared/lib/entry-config.js +71 -0
  133. package/dist/shared/lib/form-sections.js +64 -0
  134. package/dist/shared/lib/form-structure.js +99 -0
  135. package/dist/shared/lib/form-usage-beacon.js +101 -52
  136. package/dist/shared/lib/jobs-tray.js +25 -23
  137. package/dist/shared/lib/keyset-pager.js +37 -0
  138. package/dist/shared/lib/layout-ops.js +84 -82
  139. package/dist/shared/lib/layout-resolve.js +113 -0
  140. package/dist/shared/lib/placement-behaviour.js +144 -0
  141. package/dist/shared/lib/prefetch.js +149 -0
  142. package/dist/shared/lib/presence-hooks.js +199 -0
  143. package/dist/shared/lib/record-outbox.js +82 -81
  144. package/dist/shared/lib/replay-socket.js +93 -0
  145. package/dist/shared/lib/request-gate.js +51 -50
  146. package/dist/shared/lib/room-gaps.js +96 -0
  147. package/dist/shared/lib/search-log.js +27 -0
  148. package/dist/shared/lib/socket-realtime.js +101 -80
  149. package/dist/shared/lib/worker-socket.js +200 -0
  150. package/package.json +1 -1
@@ -1,334 +1,372 @@
1
- import { jsx as a, jsxs as i } from "react/jsx-runtime";
2
- import { useQuery as _e } from "@tanstack/react-query";
3
- import { Quote as Ke, X as Se, Paperclip as Ce, Hash as ze, AlertTriangle as Je, AlarmClock as Qe, Send as Xe, Type as Ye } from "lucide-react";
4
- import { forwardRef as Ze, useState as f, useMemo as q, useRef as le, useImperativeHandle as Ge, useEffect as De } from "react";
5
- import { toast as F } from "sonner";
6
- import { useNivaroClient as Ve, useApiFetchConfig as et } from "../../context.js";
7
- import { get as tt, post as nt } from "../../lib/commands.js";
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 Me, PopoverTrigger as Te, PopoverContent as Ae } from "../ui/popover.js";
10
- import { useChatConfig as st, useSendChatMessage as rt, useTypingIndicator as at, useChatBotName as lt, useChatRooms as ot, dmPeer as it, useUserSearch as dt, chatRoomTypesQuery as ct, getMentionQuery as ut } from "./chat-core.js";
11
- import { useRoomInfo as pt, useScheduledMessages as mt } from "./chat-hooks.js";
12
- import { tsvToTable as ht } from "./MessageFormat.js";
13
- import { useChatCommands as ft, filterSlash as xt, SlashForm as gt, SlashMenu as bt, slashQuery as kt, parseSlashLine as yt } from "./SlashCommands.js";
14
- const $e = {
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 wt(C, u) {
20
- const x = C.slice(0, u).match(/(?:^|\s)#([A-Za-z0-9-]{1,30})$/);
21
- return x ? x[1] : null;
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 Et = Ze(function({
24
- room: u,
25
- label: N,
26
- parentId: x = null,
27
- quote: g,
28
- onClearQuote: y,
29
- onSent: K,
30
- disabledReason: z,
31
- compact: Fe,
32
- th: h,
33
- renderAvatar: Re
34
- }, Ue) {
35
- const R = st(), J = Ve(), Q = et(), w = R.me, We = rt(u), oe = at(u), D = lt(), { rooms: ie } = ot(), U = pt(u), { create: Ee } = mt(!1), [c, b] = f(""), [k, de] = f(!1), [p, W] = f(null), [$, E] = f(null), [_, X] = f(0), [O, Y] = f(null), [Z, G] = f(null), V = ft(), P = q(
36
- () => O === null ? [] : xt(V, O).slice(0, 8),
37
- [V, O]
38
- ), [M, H] = f([]), [L, ee] = f(null), [ce, ue] = f(!1), [te, Oe] = f(""), ne = le(/* @__PURE__ */ new Map()), S = le(null), pe = le(null), me = u.startsWith("ch:") && !u.startsWith("ch:grp-");
39
- Ge(Ue, () => ({
40
- addFiles: (e) => re(e),
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 = S.current) == null ? void 0 : e.focus();
50
+ return (e = N.current) == null ? void 0 : e.focus();
44
51
  }
45
- })), De(() => {
46
- const e = S.current;
52
+ })), Ee(() => {
53
+ const e = N.current;
47
54
  e && (e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, 168)}px`);
48
- }, [c]), De(() => {
55
+ }, [i]), Ee(() => {
49
56
  var e;
50
- g && ((e = S.current) == null || e.focus());
51
- }, [g]);
52
- const he = q(() => {
57
+ k && ((e = N.current) == null || e.focus());
58
+ }, [k]);
59
+ const ke = X(() => {
53
60
  const e = [];
54
- if (!w) return e;
55
- for (const t of ie) {
61
+ if (!y) return e;
62
+ for (const t of Z) {
56
63
  if (t.kind !== "dm") continue;
57
- const n = it(t.room, w.id);
58
- n && e.push({ id: n, name: t.label });
64
+ const s = bt(t.room, y.id);
65
+ s && e.push({ id: s, name: t.label });
59
66
  }
60
67
  return e;
61
- }, [ie, w]), { users: fe } = dt(p ?? "", ((p == null ? void 0 : p.length) ?? 0) >= 2), j = q(() => {
62
- if (p === null) return [];
63
- const e = p.toLowerCase(), t = (r) => !!r && r.toLowerCase().split(/\s+/).some((o) => o.startsWith(e)), n = /* @__PURE__ */ new Set([String((w == null ? void 0 : w.id) ?? "").toUpperCase()]), s = [], l = (r) => {
64
- const o = r.user_id.toUpperCase();
65
- n.has(o) || (n.add(o), s.push(r));
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
- me && ("here".startsWith(e) && s.push({
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) && s.push({
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
- })), D && D.toLowerCase().startsWith(e) && s.push({ user_id: "__bot__", display_name: D, sub: "AI assistant", kind: "bot" });
78
- for (const r of (U == null ? void 0 : U.members) ?? [])
79
- t(r.name) && l({ user_id: r.id, display_name: r.name, sub: "In this room", kind: "person" });
80
- for (const r of he)
81
- t(r.name) && l({ user_id: r.id, display_name: r.name, sub: "You message them", kind: "person" });
82
- for (const r of R.onlineUsers)
83
- t(r.display_name) && l({ user_id: r.user_id, display_name: r.display_name, sub: "Online", kind: "person" });
84
- for (const r of fe) {
85
- const o = [r.first_name, r.last_name].filter(Boolean).join(" ") || r.email;
86
- (t(o) || (r.email ?? "").toLowerCase().startsWith(e)) && l({ user_id: r.id, display_name: o, sub: null, kind: "person" });
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 d = (r) => {
89
- if (r.kind !== "person") return -1;
90
- const o = R.onlineUsers.find(
91
- (A) => String(A.user_id).toUpperCase() === r.user_id.toUpperCase()
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 s.map((r, o) => ({ c: r, i: o, t: d(r) })).sort((r, o) => r.t - o.t || r.i - o.i).map((r) => r.c).slice(0, 8);
96
- }, [p, U, he, R.onlineUsers, fe, D, me, w]), { data: I } = _e(ct(J)), { data: B = [] } = _e({
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 I ?? [])
107
+ for (const t of z ?? [])
101
108
  try {
102
- const n = await J.request(
103
- tt(`/items/${t.collection}`, {
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 s of n.data ?? []) {
111
- const l = String(s[t.match_field] ?? s.id ?? "");
112
- l && e.push({ token: l, label: l, type: t.label ?? t.collection.replace(/_/g, " ") });
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: !!$ && $.length >= 2 && ((I == null ? void 0 : I.length) ?? 0) > 0,
125
+ enabled: !!A && A.length >= 2 && ((z == null ? void 0 : z.length) ?? 0) > 0,
119
126
  staleTime: 3e4
120
- }), T = O !== null && P.length > 0, xe = T || p !== null && j.length > 0 || $ !== null && B.length > 0, se = (e, t) => {
121
- const n = S.current, s = (n == null ? void 0 : n.selectionStart) ?? c.length, l = c.slice(0, s).replace(e, t), d = l + c.slice(s);
122
- b(d), requestAnimationFrame(() => {
123
- n == null || n.focus(), n == null || n.setSelectionRange(l.length, l.length);
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
- }, ge = (e) => {
132
+ }, ve = (e) => {
126
133
  if (e.kind === "here" || e.kind === "channel")
127
- se(/@([^@\n\r]*)$/, `@${e.display_name} `);
134
+ le(/@([^@\n\r]*)$/, `@${e.display_name} `);
128
135
  else {
129
136
  const t = e.display_name ?? "Unknown";
130
- se(/@([^@\n\r]*)$/, `@[${t}] `), e.kind === "person" && ne.current.set(t, e.user_id);
137
+ le(/@([^@\n\r]*)$/, `@[${t}] `), e.kind === "person" && ae.current.set(t, e.user_id);
131
138
  }
132
- W(null);
133
- }, be = (e) => {
134
- se(/#([A-Za-z0-9-]{1,30})$/, `${e.token} `), E(null);
135
- }, re = (e) => {
136
- for (const t of e.slice(0, 10)) {
137
- const n = `${Date.now()}-${Math.random().toString(36).slice(2)}`, s = new XMLHttpRequest(), l = {
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: t.name,
140
- type: t.type || null,
146
+ name: s.name,
147
+ type: s.type || null,
141
148
  progress: 0,
142
149
  id: null,
143
- xhr: s,
150
+ xhr: a,
144
151
  error: null
145
152
  };
146
- H((r) => [...r, l]);
147
- const d = (r) => H((o) => o.map((A) => A.key === n ? { ...A, ...r } : A));
148
- s.upload.onprogress = (r) => {
149
- r.lengthComputable && d({ progress: r.loaded / r.total });
150
- }, s.onload = () => {
151
- if (s.status >= 200 && s.status < 300)
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 r = JSON.parse(s.responseText).data.id;
154
- d({ id: r, progress: 1, xhr: null });
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
- d({ error: "Upload failed", xhr: null });
163
+ g({ error: "Upload failed", xhr: null });
157
164
  }
158
165
  else {
159
- let r = "Upload failed";
166
+ let o = "Upload failed";
160
167
  try {
161
- r = JSON.parse(s.responseText).error ?? r;
168
+ o = JSON.parse(a.responseText).error ?? o;
162
169
  } catch {
163
170
  }
164
- d({ error: r, xhr: null });
171
+ g({ error: o, xhr: null });
165
172
  }
166
- }, s.onerror = () => d({ error: "Upload failed", xhr: null }), s.open("POST", `${Q.apiBase}/files/upload`);
167
- for (const [r, o] of Object.entries(Q.authHeaders)) s.setRequestHeader(r, o);
168
- s.withCredentials = Q.credentials === "include";
169
- const v = new FormData();
170
- v.append("file", t), s.send(v);
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
- }, Pe = (e) => H((t) => {
173
- var n, s;
174
- return (s = (n = t.find((l) => l.key === e)) == null ? void 0 : n.xhr) == null || s.abort(), t.filter((l) => l.key !== e);
175
- }), ae = M.some((e) => !e.id && !e.error), ke = () => {
176
- const e = c.trim(), t = M.filter((s) => s.id).map((s) => s.id), n = [...ne.current.entries()].filter(([s]) => e.includes(`@[${s}]`)).map(([, s]) => s);
177
- return { text: e, attachments: t, mentions: n };
178
- }, ye = () => {
179
- b(""), H([]), de(!1), W(null), E(null), ee(null), ne.current.clear(), y == null || y(), oe.clearTyping();
180
- }, we = (e) => {
181
- Y(null), e.builtin ? (G({ kind: e.name, text: "" }), b("")) : (b(`/${e.name} `), requestAnimationFrame(() => {
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 = S.current) == null ? void 0 : t.focus();
213
+ return (t = N.current) == null ? void 0 : t.focus();
184
214
  }));
185
- }, He = () => {
186
- const e = yt(c.trim());
215
+ }, Qe = () => {
216
+ const e = Ut(i.trim());
187
217
  if (!e) return !1;
188
- const t = V.find((n) => n.name === e.name);
189
- return t ? t.builtin ? (G({ kind: e.name, text: e.args }), b(""), !0) : (J.request(
190
- nt(`/chat/commands/${e.name}/run`, { room: u, args: e.args })
191
- ).then((n) => {
192
- var s;
193
- (s = n.data) != null && s.reply && F.message(n.data.reply);
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
- (n) => {
196
- var s;
197
- return F.error(((s = n == null ? void 0 : n.response) == null ? void 0 : s.error) ?? "Command failed");
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
- ), b(""), !0) : !1;
200
- }, ve = () => {
201
- if (z || ae || He()) return;
202
- const { text: e, attachments: t, mentions: n } = ke();
203
- !e && t.length === 0 || (We.mutate({ text: e, mentions: n, attachments: t, parentId: x, quoteId: (g == null ? void 0 : g.id) ?? null, urgent: k }), ye(), K == null || K(e));
204
- }, Ne = (e) => {
205
- const { text: t, attachments: n } = ke();
206
- if (!t && n.length === 0) {
207
- F.error("Write the message first");
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
- Ee.mutate(
211
- { room: u, message: t, attachments: n, parent_id: x, send_at: e.toISOString() },
240
+ Ie.mutate(
241
+ { room: d, message: t, attachments: s, parent_id: f, send_at: e.toISOString() },
212
242
  {
213
243
  onSuccess: () => {
214
- F.success(
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
- ), ye(), ue(!1);
247
+ ), Se(), me(!1);
218
248
  },
219
- onError: (s) => {
220
- var l;
221
- return F.error(
222
- ((l = s == null ? void 0 : s.response) == null ? void 0 : l.error) ?? "Could not schedule it"
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
- }, Le = q(() => {
228
- const e = /* @__PURE__ */ new Date(), t = new Date(e.getTime() + 60 * 6e4), n = new Date(e);
229
- n.setDate(e.getDate() + 1), n.setHours(9, 0, 0, 0);
230
- const s = new Date(e);
231
- return s.setDate(e.getDate() + ((8 - e.getDay()) % 7 || 7)), s.setHours(9, 0, 0, 0), [
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: n },
234
- { label: "Monday 9:00 AM", at: s }
263
+ { label: "Tomorrow 9:00 AM", at: s },
264
+ { label: "Monday 9:00 AM", at: n }
235
265
  ];
236
- }, [ce]), je = (e, t) => {
237
- b(e), oe.onType();
238
- const n = ut(e, t);
239
- W(n);
240
- const s = n === null ? wt(e, t) : null;
241
- E(s);
242
- const l = n === null && s === null ? kt(e, t) : null;
243
- Y(l), (n !== null || s !== null || l !== null) && X(0);
244
- }, Ie = (e) => {
245
- if (xe) {
246
- const t = T ? P.length : p !== null ? j.length : B.length;
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(), X((n) => (n + 1) % t);
278
+ e.preventDefault(), G((s) => (s + 1) % t);
249
279
  return;
250
280
  }
251
281
  if (e.key === "ArrowUp") {
252
- e.preventDefault(), X((n) => (n - 1 + t) % t);
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(), T ? we(P[_]) : p !== null ? ge(j[_]) : be(B[_]);
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(), W(null), E(null), Y(null);
290
+ e.preventDefault(), j(null), H(null), V(null);
261
291
  return;
262
292
  }
263
293
  }
264
- if ((e.metaKey || e.ctrlKey) && $e[e.key.toLowerCase()]) {
294
+ if ((e.metaKey || e.ctrlKey) && Ue[e.key.toLowerCase()]) {
265
295
  e.preventDefault();
266
- const [t, n] = $e[e.key.toLowerCase()], s = e.currentTarget, l = s.selectionStart, d = s.selectionEnd, v = c.slice(0, l) + t + c.slice(l, d) + n + c.slice(d);
267
- b(v), requestAnimationFrame(() => s.setSelectionRange(l + t.length, d + t.length));
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(), ve()), e.key === "Escape" && g && (y == null || y());
271
- }, Be = (e) => {
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(), re(t);
304
+ e.preventDefault(), Q(t);
275
305
  return;
276
306
  }
277
- const n = e.clipboardData.getData("text/plain"), s = n ? ht(n) : null;
278
- if (s) {
307
+ const s = e.clipboardData.getData("text/plain"), n = s ? Ct(s) : null;
308
+ if (n) {
279
309
  e.preventDefault();
280
- const l = e.currentTarget, d = l.selectionStart, v = l.selectionEnd, r = c.slice(0, d), o = `${r && !r.endsWith(`
310
+ const a = e.currentTarget, u = a.selectionStart, g = a.selectionEnd, l = i.slice(0, u), o = `${l && !l.endsWith(`
281
311
  `) ? `
282
- ` : ""}${s}
312
+ ` : ""}${n}
283
313
  `;
284
- b(r + o + c.slice(v)), ee({ raw: n, table: o });
314
+ p(l + o + i.slice(g)), ne({ raw: s, table: o });
285
315
  }
286
- }, qe = () => {
287
- L && (b((e) => e.replace(L.table, L.raw)), ee(null));
316
+ }, Ve = () => {
317
+ q && (p((e) => e.replace(q.table, q.raw)), ne(null));
288
318
  };
289
- return z ? /* @__PURE__ */ a(
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
- h.divider
324
+ x.divider
295
325
  ),
296
326
  "data-chat-composer-closed": !0,
297
- children: z
327
+ children: P
298
328
  }
299
- ) : /* @__PURE__ */ i("div", { className: m("shrink-0 border-t", h.divider), "data-chat-composer-wrap": !0, children: [
300
- Z && /* @__PURE__ */ a(
301
- gt,
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
- kind: Z.kind,
304
- room: u,
305
- initialText: Z.text,
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
- g && /* @__PURE__ */ i("div", { className: "flex items-start gap-2 px-3 pt-2", "data-chat-quote-draft": !0, children: [
312
- /* @__PURE__ */ a(Ke, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-slate-400" }),
313
- /* @__PURE__ */ i("div", { className: "min-w-0 flex-1 text-[11.5px]", children: [
314
- /* @__PURE__ */ i("span", { className: "font-semibold text-slate-600 dark:text-slate-300", children: [
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
- g.sender_name ?? "a message"
354
+ k.sender_name ?? "a message"
317
355
  ] }),
318
- /* @__PURE__ */ a("p", { className: "truncate text-slate-500 dark:text-slate-400", children: g.deleted_at ? "Message removed" : g.message || "Attachment" })
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__ */ a(
358
+ /* @__PURE__ */ r(
321
359
  "button",
322
360
  {
323
361
  type: "button",
324
- onClick: y,
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__ */ a(Se, { className: "h-3.5 w-3.5" })
365
+ children: /* @__PURE__ */ r(Ae, { className: "h-3.5 w-3.5" })
328
366
  }
329
367
  )
330
368
  ] }),
331
- M.length > 0 && /* @__PURE__ */ a("div", { className: "flex flex-wrap items-center gap-1.5 px-3 pt-2", children: M.map((e) => /* @__PURE__ */ i(
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__ */ a(
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__ */ a(Ce, { className: "relative h-3 w-3 shrink-0 opacity-60" }),
350
- /* @__PURE__ */ a("span", { className: "relative truncate", children: e.error ? `${e.name} — ${e.error}` : e.name }),
351
- !e.id && !e.error && /* @__PURE__ */ i("span", { className: "relative tabular-nums text-slate-500", children: [
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__ */ a(
393
+ /* @__PURE__ */ r(
356
394
  "button",
357
395
  {
358
396
  type: "button",
359
- onClick: () => Pe(e.key),
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__ */ a(Se, { className: "h-3 w-3" })
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
- L && /* @__PURE__ */ i(
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__ */ a(
416
+ /* @__PURE__ */ r(
379
417
  "button",
380
418
  {
381
419
  type: "button",
382
- onClick: qe,
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__ */ i(
428
+ /* @__PURE__ */ c(
391
429
  "form",
392
430
  {
393
- className: m("relative", Fe ? "p-2" : "p-2.5"),
431
+ className: m("relative", je ? "p-2" : "p-2.5"),
394
432
  onSubmit: (e) => {
395
- e.preventDefault(), ve();
433
+ e.preventDefault(), $e();
396
434
  },
397
435
  "data-chat-composer": !0,
398
436
  children: [
399
- xe && /* @__PURE__ */ a(
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
- h.surface,
442
+ x.surface,
405
443
  "border-slate-200 dark:border-border"
406
444
  ),
407
- "data-chat-picker": T ? "slash" : p !== null ? "mention" : "record",
408
- children: T ? /* @__PURE__ */ a(
409
- bt,
445
+ "data-chat-picker": E ? "slash" : h !== null ? "mention" : "record",
446
+ children: E ? /* @__PURE__ */ r(
447
+ Et,
410
448
  {
411
- entries: P,
412
- index: _,
413
- onPick: we,
414
- accentSoft: h.accentSoft
449
+ entries: L,
450
+ index: C,
451
+ onPick: Ce,
452
+ accentSoft: x.accentSoft
415
453
  }
416
- ) : p !== null ? j.map((e, t) => /* @__PURE__ */ i(
454
+ ) : h !== null ? K.map((e, t) => /* @__PURE__ */ c(
417
455
  "button",
418
456
  {
419
457
  type: "button",
420
- onMouseDown: (n) => {
421
- n.preventDefault(), ge(e);
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 === _ ? h.accentSoft : "text-slate-700 dark:text-slate-200"
463
+ t === C ? x.accentSoft : "text-slate-700 dark:text-slate-200"
426
464
  ),
427
465
  children: [
428
- e.kind === "person" || e.kind === "bot" ? Re(e.user_id, e.display_name) : /* @__PURE__ */ a("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: "@" }),
429
- /* @__PURE__ */ i("span", { className: "min-w-0 flex-1 truncate", children: [
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__ */ a("span", { className: "ml-1.5 text-[11px] text-slate-500 dark:text-slate-400", children: e.sub })
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
- )) : B.map((e, t) => /* @__PURE__ */ i(
474
+ )) : J.map((e, t) => /* @__PURE__ */ c(
437
475
  "button",
438
476
  {
439
477
  type: "button",
440
- onMouseDown: (n) => {
441
- n.preventDefault(), be(e);
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 === _ ? h.accentSoft : "text-slate-700 dark:text-slate-200"
483
+ t === C ? x.accentSoft : "text-slate-700 dark:text-slate-200"
446
484
  ),
447
485
  children: [
448
- /* @__PURE__ */ a(ze, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
449
- /* @__PURE__ */ a("span", { className: "min-w-0 flex-1 truncate font-medium", children: e.label }),
450
- /* @__PURE__ */ a("span", { className: "shrink-0 text-[10.5px] capitalize text-slate-500 dark:text-slate-400", children: e.type })
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__ */ i(
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
- h.input,
463
- k && "border-red-400 focus-within:border-red-500 dark:border-red-500"
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__ */ a(
505
+ /* @__PURE__ */ r(
468
506
  "textarea",
469
507
  {
470
- ref: S,
508
+ ref: N,
471
509
  rows: 1,
472
- value: c,
473
- onChange: (e) => je(e.target.value, e.target.selectionStart ?? e.target.value.length),
474
- onKeyDown: Ie,
475
- onPaste: Be,
476
- placeholder: x ? "Reply in thread…" : `Message ${N}…`,
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": x ? "Reply in thread" : `Message ${N}`,
516
+ "aria-label": f ? "Reply in thread" : `Message ${_}`,
479
517
  "data-chat-input": !0
480
518
  }
481
519
  ),
482
- /* @__PURE__ */ i("div", { className: "flex items-center gap-0.5 px-1 pb-1", "data-chat-composer-tools": !0, children: [
483
- /* @__PURE__ */ a(
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: pe,
524
+ ref: fe,
487
525
  type: "file",
488
526
  multiple: !0,
489
527
  className: "hidden",
490
528
  onChange: (e) => {
491
- re([...e.target.files ?? []]), e.target.value = "";
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__ */ a(vt, { botName: D }),
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 = pe.current) == null ? void 0 : e.click();
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__ */ a(Ce, { className: "h-4 w-4", strokeWidth: 2 })
560
+ children: /* @__PURE__ */ r(Fe, { className: "h-4 w-4", strokeWidth: 2 })
508
561
  }
509
562
  ),
510
- /* @__PURE__ */ a(
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: () => de((e) => !e),
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
- k ? "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"
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": k,
573
+ "aria-pressed": w,
520
574
  "aria-label": "Mark urgent",
521
- title: k ? "Urgent: reaches people even when they muted the room (5 per hour)" : "Mark urgent — breaks through mute for the people it is addressed to",
522
- "data-chat-urgent-toggle": k ? "on" : "off",
523
- children: /* @__PURE__ */ a(Je, { className: "h-4 w-4", strokeWidth: 2 })
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__ */ i(Me, { open: ce, onOpenChange: ue, children: [
527
- /* @__PURE__ */ a(Te, { asChild: !0, children: /* @__PURE__ */ a(
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__ */ a(Qe, { className: "h-4 w-4", strokeWidth: 2 })
589
+ children: /* @__PURE__ */ r(nt, { className: "h-4 w-4", strokeWidth: 2 })
536
590
  }
537
591
  ) }),
538
- /* @__PURE__ */ i(Ae, { align: "end", side: "top", className: "w-[240px] p-2", children: [
539
- /* @__PURE__ */ a("p", { className: "px-1 pb-1.5 text-[12px] font-semibold text-slate-800 dark:text-slate-100", children: "Send this later" }),
540
- Le.map((e) => /* @__PURE__ */ a(
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: () => Ne(e.at),
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__ */ i("div", { className: "mt-1.5 flex items-center gap-1 border-t border-slate-100 pt-2 dark:border-border", children: [
551
- /* @__PURE__ */ a(
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: te,
556
- onChange: (e) => Oe(e.target.value),
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
- h.input
613
+ x.input
560
614
  ),
561
615
  "aria-label": "Send at"
562
616
  }
563
617
  ),
564
- /* @__PURE__ */ a(
618
+ /* @__PURE__ */ r(
565
619
  "button",
566
620
  {
567
621
  type: "button",
568
- disabled: !te,
569
- onClick: () => Ne(new Date(te)),
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
- h.action
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__ */ a(
634
+ /* @__PURE__ */ r(
581
635
  "button",
582
636
  {
583
637
  type: "submit",
584
- disabled: !c.trim() && !M.some((e) => e.id) || ae,
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
- k ? "bg-red-600 text-white" : h.action
641
+ w ? "bg-red-600 text-white" : x.action
588
642
  ),
589
- "aria-label": k ? "Send urgent" : "Send",
590
- title: ae ? "Waiting for the upload to finish" : void 0,
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__ */ a(Xe, { className: "h-4 w-4", strokeWidth: 2 })
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 vt({ botName: C }) {
605
- const u = [
658
+ function Wt({ botName: D }) {
659
+ const d = [
606
660
  ["@name", "Mention someone"],
607
- ...C ? [[`@${C}`, "Ask the assistant"]] : [],
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__ */ i(Me, { children: [
620
- /* @__PURE__ */ a(Te, { asChild: !0, children: /* @__PURE__ */ a(
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__ */ a(Ye, { className: "h-4 w-4", strokeWidth: 2 })
682
+ children: /* @__PURE__ */ r(at, { className: "h-4 w-4", strokeWidth: 2 })
629
683
  }
630
684
  ) }),
631
- /* @__PURE__ */ i(Ae, { align: "end", side: "top", className: "w-[260px] p-3", children: [
632
- /* @__PURE__ */ a("p", { className: "pb-2 text-[12px] font-semibold text-slate-800 dark:text-slate-100", children: "Writing a message" }),
633
- /* @__PURE__ */ a("dl", { className: "grid grid-cols-[96px_1fr] gap-x-2 gap-y-1 text-[11.5px]", children: u.map(([N, x]) => /* @__PURE__ */ i("div", { className: "contents", children: [
634
- /* @__PURE__ */ a("dt", { children: /* @__PURE__ */ a("code", { className: "rounded bg-slate-100 px-1 text-[11px] dark:bg-muted", children: N }) }),
635
- /* @__PURE__ */ a("dd", { className: "text-slate-600 dark:text-slate-300", children: x })
636
- ] }, N)) })
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
- Et as ChatComposer
695
+ es as ChatComposer
642
696
  };