@nivaro/react 0.3.114 → 0.3.116

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 (293) hide show
  1. package/dist/components/ScreenShareHost.js +24 -0
  2. package/dist/full.css +50 -2
  3. package/dist/hooks/useSessionRecorder.js +61 -60
  4. package/dist/index.d.ts +1728 -22
  5. package/dist/index.js +1091 -950
  6. package/dist/shared/components/ActivityEntry.js +209 -97
  7. package/dist/shared/components/AgentPresenceChip.js +51 -0
  8. package/dist/shared/components/AnnouncementBanner.js +56 -41
  9. package/dist/shared/components/AutolinkedText.js +98 -85
  10. package/dist/shared/components/BroadcastView.js +149 -141
  11. package/dist/shared/components/CacheStamp.js +78 -30
  12. package/dist/shared/components/CollectionBrowserView.js +4909 -4182
  13. package/dist/shared/components/ConfigChangeStrip.js +63 -0
  14. package/dist/shared/components/ConfigReachNote.js +107 -0
  15. package/dist/shared/components/ConformanceView.js +389 -319
  16. package/dist/shared/components/DataTable.js +612 -551
  17. package/dist/shared/components/DelegateCoverLine.js +164 -0
  18. package/dist/shared/components/EnvironmentNotice.js +56 -65
  19. package/dist/shared/components/FilePreviewLightbox.js +89 -43
  20. package/dist/shared/components/FindingFixedMark.js +23 -0
  21. package/dist/shared/components/GridPresenceLine.js +100 -0
  22. package/dist/shared/components/IdleReloadWatcher.js +82 -43
  23. package/dist/shared/components/InStep.js +46 -0
  24. package/dist/shared/components/ItemEditForm.js +5504 -4889
  25. package/dist/shared/components/LiveAnnouncer.js +62 -0
  26. package/dist/shared/components/LiveCount.js +54 -0
  27. package/dist/shared/components/LiveFigure.js +28 -0
  28. package/dist/shared/components/LiveListControls.js +114 -0
  29. package/dist/shared/components/LiveNewMatchesPill.js +25 -0
  30. package/dist/shared/components/LiveOffNote.js +44 -0
  31. package/dist/shared/components/LivePreferenceHost.js +42 -0
  32. package/dist/shared/components/LiveRowMark.js +25 -20
  33. package/dist/shared/components/LiveTraceView.js +257 -0
  34. package/dist/shared/components/MapView.js +30 -29
  35. package/dist/shared/components/MatrixEditor.js +497 -462
  36. package/dist/shared/components/MyWorkView.js +346 -272
  37. package/dist/shared/components/NotificationBell.js +215 -201
  38. package/dist/shared/components/OverflowRail.js +326 -0
  39. package/dist/shared/components/PageRenderer.js +636 -599
  40. package/dist/shared/components/PresenceDot.js +21 -0
  41. package/dist/shared/components/ProfileView.js +656 -536
  42. package/dist/shared/components/RealtimeStatusBanner.js +25 -25
  43. package/dist/shared/components/RecentRecordsRail.js +51 -48
  44. package/dist/shared/components/RecordCompare.js +241 -150
  45. package/dist/shared/components/RecordDrilldownSheet.js +66 -64
  46. package/dist/shared/components/RecordGridEditor.js +350 -311
  47. package/dist/shared/components/RecordHoverCard.js +147 -0
  48. package/dist/shared/components/RecordPeekHost.js +111 -0
  49. package/dist/shared/components/RecordReadView.js +414 -412
  50. package/dist/shared/components/RelativeTime.js +16 -0
  51. package/dist/shared/components/ReportView.js +1396 -1304
  52. package/dist/shared/components/ScreenRefreshButton.js +77 -0
  53. package/dist/shared/components/TabCountHost.js +10 -0
  54. package/dist/shared/components/TickerNumber.js +19 -18
  55. package/dist/shared/components/TipLayer.js +70 -58
  56. package/dist/shared/components/WidgetImageMenu.js +59 -0
  57. package/dist/shared/components/WidgetSlot.js +571 -524
  58. package/dist/shared/components/activity/RecordActivityStream.js +317 -0
  59. package/dist/shared/components/bulk/BulkSelectionNotices.js +220 -0
  60. package/dist/shared/components/cbv/approval-changed.js +20 -0
  61. package/dist/shared/components/cbv/changed-by-others.js +251 -0
  62. package/dist/shared/components/change-proposals/ChangeProposalsPanel.js +320 -0
  63. package/dist/shared/components/change-proposals/ProposalValue.js +28 -0
  64. package/dist/shared/components/change-proposals/ProposeChangeButton.js +44 -0
  65. package/dist/shared/components/change-proposals/ProposeChangeDialog.js +359 -0
  66. package/dist/shared/components/change-proposals/types.js +4 -0
  67. package/dist/shared/components/chat/ChatPanel.js +1571 -1528
  68. package/dist/shared/components/chat/Composer.js +276 -298
  69. package/dist/shared/components/chat/room-due.js +13 -0
  70. package/dist/shared/components/collections-directory/CollectionRow.js +76 -75
  71. package/dist/shared/components/collections-directory/CollectionsDirectory.js +415 -395
  72. package/dist/shared/components/collections-directory/directory-data.js +75 -63
  73. package/dist/shared/components/imports/ImportConsole.js +159 -155
  74. package/dist/shared/components/imports/ImportDuplicatesNotice.js +46 -31
  75. package/dist/shared/components/integrations/SendStatus.js +202 -0
  76. package/dist/shared/components/integrations/console/IntegrationsConsole.js +45 -36
  77. package/dist/shared/components/integrations/console/ReadyToSendView.js +453 -0
  78. package/dist/shared/components/integrations/console/SignalCard.js +84 -77
  79. package/dist/shared/components/integrations/console/api.js +161 -117
  80. package/dist/shared/components/integrations/console/tone.js +15 -12
  81. package/dist/shared/components/item-edit/CatalogPickerField.js +1353 -1245
  82. package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +162 -0
  83. package/dist/shared/components/item-edit/CloneDialog.js +208 -206
  84. package/dist/shared/components/item-edit/DerivedCauseNote.js +57 -0
  85. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +81 -70
  86. package/dist/shared/components/item-edit/DuplicateNotice.js +169 -101
  87. package/dist/shared/components/item-edit/FieldAffordances.js +294 -385
  88. package/dist/shared/components/item-edit/FieldComments.js +159 -116
  89. package/dist/shared/components/item-edit/FieldPointer.js +132 -0
  90. package/dist/shared/components/item-edit/FieldRenderer.js +277 -273
  91. package/dist/shared/components/item-edit/FieldRow.js +519 -439
  92. package/dist/shared/components/item-edit/FieldSourceBadge.js +88 -0
  93. package/dist/shared/components/item-edit/FilePickerField.js +454 -369
  94. package/dist/shared/components/item-edit/GroupSection.js +618 -567
  95. package/dist/shared/components/item-edit/HeldEditsChip.js +113 -0
  96. package/dist/shared/components/item-edit/InlineTableField.js +2891 -2723
  97. package/dist/shared/components/item-edit/ListNeighborNav.js +79 -0
  98. package/dist/shared/components/item-edit/LiveTraceSheet.js +26 -0
  99. package/dist/shared/components/item-edit/M2MCombobox.js +284 -273
  100. package/dist/shared/components/item-edit/OutboxReviewTray.js +313 -0
  101. package/dist/shared/components/item-edit/PickerBadges.js +52 -0
  102. package/dist/shared/components/item-edit/PlanGrid.js +434 -439
  103. package/dist/shared/components/item-edit/RecalcValue.js +55 -0
  104. package/dist/shared/components/item-edit/RecordChatActions.js +76 -64
  105. package/dist/shared/components/item-edit/RecordChatMentionsChip.js +103 -0
  106. package/dist/shared/components/item-edit/RecordGrantTools.js +87 -86
  107. package/dist/shared/components/item-edit/RecordHelpChip.js +70 -0
  108. package/dist/shared/components/item-edit/RecordLiveSync.js +230 -217
  109. package/dist/shared/components/item-edit/RecordOutbox.js +53 -52
  110. package/dist/shared/components/item-edit/RecordRecapStrip.js +109 -36
  111. package/dist/shared/components/item-edit/RelationCombobox.js +229 -217
  112. package/dist/shared/components/item-edit/RelationGroupedCombobox.js +105 -100
  113. package/dist/shared/components/item-edit/RemoteChangeUi.js +454 -0
  114. package/dist/shared/components/item-edit/RemoteUploads.js +55 -0
  115. package/dist/shared/components/item-edit/RemovedLineNote.js +92 -0
  116. package/dist/shared/components/item-edit/RichTextEditorImpl.js +298 -223
  117. package/dist/shared/components/item-edit/ScheduledChangeChip.js +244 -0
  118. package/dist/shared/components/item-edit/SectionPresence.js +78 -0
  119. package/dist/shared/components/item-edit/SplitLinesButton.js +166 -0
  120. package/dist/shared/components/item-edit/catalog-line-watch.js +94 -0
  121. package/dist/shared/components/item-edit/coedit/collab.js +84 -0
  122. package/dist/shared/components/item-edit/coedit/context.js +24 -0
  123. package/dist/shared/components/item-edit/coedit/cursors.js +103 -0
  124. package/dist/shared/components/item-edit/coedit/safe-link.js +15 -0
  125. package/dist/shared/components/item-edit/coedit/session.js +382 -0
  126. package/dist/shared/components/item-edit/coedit/useCoedit.js +49 -0
  127. package/dist/shared/components/item-edit/file-live.js +77 -0
  128. package/dist/shared/components/item-edit/file-processing.js +87 -0
  129. package/dist/shared/components/item-edit/layout-switch.js +148 -0
  130. package/dist/shared/components/item-edit/live-related.js +23 -0
  131. package/dist/shared/components/item-edit/live-title.js +66 -0
  132. package/dist/shared/components/item-edit/partner-needs.js +142 -0
  133. package/dist/shared/components/item-edit/removed-line.js +58 -0
  134. package/dist/shared/components/item-edit/render-stability.js +70 -59
  135. package/dist/shared/components/layout-editor/ChangeNote.js +36 -34
  136. package/dist/shared/components/layout-editor/CollabParts.js +72 -70
  137. package/dist/shared/components/layout-editor/LayoutEditor.js +306 -303
  138. package/dist/shared/components/list/InlineEdit.js +504 -208
  139. package/dist/shared/components/list/ListViewers.js +81 -0
  140. package/dist/shared/components/list/PhonePager.js +50 -0
  141. package/dist/shared/components/merge/MergeRecordsDialog.js +1227 -0
  142. package/dist/shared/components/merge/MergeWithFlow.js +290 -0
  143. package/dist/shared/components/merge/merge-values.js +110 -0
  144. package/dist/shared/components/monitoring/InactiveUserLinksView.js +285 -258
  145. package/dist/shared/components/notifications/NotificationCenterView.js +389 -323
  146. package/dist/shared/components/notifications/NotificationDetailBits.js +205 -130
  147. package/dist/shared/components/notifications/NotificationRulesEditor.js +72 -52
  148. package/dist/shared/components/notifications/bundles.js +21 -19
  149. package/dist/shared/components/notifications/resolved-line.js +25 -0
  150. package/dist/shared/components/ops/OpsTasksView.js +45 -44
  151. package/dist/shared/components/panels/AccessGrantedNote.js +85 -0
  152. package/dist/shared/components/panels/AlertBanners.js +132 -0
  153. package/dist/shared/components/panels/AsyncUserPicker.js +54 -45
  154. package/dist/shared/components/panels/BranchLanes.js +82 -54
  155. package/dist/shared/components/panels/CommentAwareness.js +332 -0
  156. package/dist/shared/components/panels/CommentImages.js +219 -0
  157. package/dist/shared/components/panels/CommentPanel.js +649 -530
  158. package/dist/shared/components/panels/ExternalRequestsChip.js +98 -80
  159. package/dist/shared/components/panels/NewSinceChip.js +16 -0
  160. package/dist/shared/components/panels/OwnerOpenedLine.js +85 -0
  161. package/dist/shared/components/panels/PipelinePanel.js +1644 -1494
  162. package/dist/shared/components/panels/ResubmissionDiff.js +293 -0
  163. package/dist/shared/components/panels/SlaBreachBanner.js +30 -29
  164. package/dist/shared/components/panels/SlaClock.js +130 -99
  165. package/dist/shared/components/panels/TaskPanel.js +308 -287
  166. package/dist/shared/components/panels/unseen-move-check.js +101 -0
  167. package/dist/shared/components/pipeline/OwnerMatrix.js +80 -71
  168. package/dist/shared/components/pipeline/OwnerMatrixSheet.js +495 -0
  169. package/dist/shared/components/pipeline/PipelineEditorView.js +2050 -1942
  170. package/dist/shared/components/profile/AgentNameField.js +141 -0
  171. package/dist/shared/components/profile/AgentsPanel.js +55 -46
  172. package/dist/shared/components/profile/PersonAccess.js +398 -330
  173. package/dist/shared/components/profile/PersonAdminTools.js +127 -113
  174. package/dist/shared/components/profile/PersonProfile.js +81 -73
  175. package/dist/shared/components/profile/SignInTroubleshooter.js +361 -0
  176. package/dist/shared/components/queue/OwnerAvatars.js +9 -9
  177. package/dist/shared/components/queue/QueueBulkBar.js +101 -84
  178. package/dist/shared/components/queue/QueueItemSheet.js +66 -66
  179. package/dist/shared/components/queue/QueueTeamStrip.js +279 -0
  180. package/dist/shared/components/queue/QueueWorklist.js +2407 -1950
  181. package/dist/shared/components/queue/worklist-helpers.js +10 -6
  182. package/dist/shared/components/send-view/SendViewButton.js +136 -0
  183. package/dist/shared/components/send-view/SentViewCards.js +147 -0
  184. package/dist/shared/components/support/ReportProblem.js +1 -0
  185. package/dist/shared/components/support/ScreenShare.js +554 -0
  186. package/dist/shared/components/support/SupportView.js +160 -129
  187. package/dist/shared/components/support/TicketDetailSheet.js +101 -89
  188. package/dist/shared/components/ui/popover.js +53 -29
  189. package/dist/shared/components/watch-list/WatchDock.js +1044 -0
  190. package/dist/shared/components/watch-list/WatchExtras.js +723 -0
  191. package/dist/shared/components/watch-list/WatchListButton.js +46 -0
  192. package/dist/shared/components/watch-list/WatchPinButton.js +67 -0
  193. package/dist/shared/components/watch-list/WatchRows.js +348 -0
  194. package/dist/shared/lib/activity-sentence.js +87 -75
  195. package/dist/shared/lib/agent-presence.js +46 -0
  196. package/dist/shared/lib/approval-progress.js +49 -0
  197. package/dist/shared/lib/attention-prefs.js +27 -0
  198. package/dist/shared/lib/cell-locks.js +56 -0
  199. package/dist/shared/lib/co-edit.js +166 -0
  200. package/dist/shared/lib/coedit-registry.js +44 -0
  201. package/dist/shared/lib/comment-awareness.js +124 -0
  202. package/dist/shared/lib/comment-images.js +45 -0
  203. package/dist/shared/lib/config-watch.js +94 -0
  204. package/dist/shared/lib/copy-rules.js +65 -0
  205. package/dist/shared/lib/count-step.js +30 -0
  206. package/dist/shared/lib/deadline-ticker.js +68 -0
  207. package/dist/shared/lib/derived-causes.js +115 -0
  208. package/dist/shared/lib/draft-store.js +114 -85
  209. package/dist/shared/lib/error-hints.js +1 -0
  210. package/dist/shared/lib/field-merge.js +126 -0
  211. package/dist/shared/lib/filter-sentence.js +10 -10
  212. package/dist/shared/lib/focus-mode.js +16 -12
  213. package/dist/shared/lib/grid-cursors.js +77 -0
  214. package/dist/shared/lib/grid-presence.js +182 -0
  215. package/dist/shared/lib/idle-reload.js +100 -73
  216. package/dist/shared/lib/in-step.js +45 -0
  217. package/dist/shared/lib/integration-chip.js +19 -18
  218. package/dist/shared/lib/keep-row-focus.js +43 -0
  219. package/dist/shared/lib/line-locks.js +141 -0
  220. package/dist/shared/lib/line-split.js +41 -0
  221. package/dist/shared/lib/linked-changes.js +150 -0
  222. package/dist/shared/lib/list-return.js +231 -0
  223. package/dist/shared/lib/list-viewers.js +52 -0
  224. package/dist/shared/lib/live-announcer.js +86 -0
  225. package/dist/shared/lib/live-counts.js +85 -0
  226. package/dist/shared/lib/live-data-changed.js +108 -0
  227. package/dist/shared/lib/live-deltas.js +81 -0
  228. package/dist/shared/lib/live-findings.js +113 -0
  229. package/dist/shared/lib/live-groups.js +122 -0
  230. package/dist/shared/lib/live-link-labels.js +162 -0
  231. package/dist/shared/lib/live-list-flow.js +334 -0
  232. package/dist/shared/lib/live-list.js +143 -129
  233. package/dist/shared/lib/live-moves.js +51 -0
  234. package/dist/shared/lib/live-ops.js +26 -26
  235. package/dist/shared/lib/live-pickers.js +7 -0
  236. package/dist/shared/lib/live-preference.js +184 -0
  237. package/dist/shared/lib/live-queries.js +226 -181
  238. package/dist/shared/lib/live-screen.js +333 -0
  239. package/dist/shared/lib/live-search.js +108 -0
  240. package/dist/shared/lib/live-seen.js +35 -0
  241. package/dist/shared/lib/live-views.js +100 -0
  242. package/dist/shared/lib/live.js +159 -133
  243. package/dist/shared/lib/missed-updates.js +198 -0
  244. package/dist/shared/lib/newer-file.js +56 -0
  245. package/dist/shared/lib/notification-sound.js +42 -20
  246. package/dist/shared/lib/obligation-banner.js +17 -17
  247. package/dist/shared/lib/own-writes.js +59 -41
  248. package/dist/shared/lib/picker-badges.js +94 -0
  249. package/dist/shared/lib/presence-signals.js +131 -84
  250. package/dist/shared/lib/rail-menu-context.js +9 -0
  251. package/dist/shared/lib/realtime.js +49 -24
  252. package/dist/shared/lib/record-gaps.js +85 -0
  253. package/dist/shared/lib/record-outbox.js +369 -222
  254. package/dist/shared/lib/record-peek.js +75 -0
  255. package/dist/shared/lib/record-tabs.js +92 -72
  256. package/dist/shared/lib/relative-ticker.js +42 -0
  257. package/dist/shared/lib/request-gate.js +119 -119
  258. package/dist/shared/lib/rollup-recalc.js +107 -0
  259. package/dist/shared/lib/room-gaps.js +40 -36
  260. package/dist/shared/lib/row-surface.js +7 -0
  261. package/dist/shared/lib/rum.js +137 -87
  262. package/dist/shared/lib/save-progress.js +20 -0
  263. package/dist/shared/lib/scheduled-countdown.js +67 -0
  264. package/dist/shared/lib/screen-refresh.js +160 -0
  265. package/dist/shared/lib/screen-share.js +234 -0
  266. package/dist/shared/lib/seen-since.js +74 -0
  267. package/dist/shared/lib/selection-watch.js +205 -0
  268. package/dist/shared/lib/send-status.js +132 -0
  269. package/dist/shared/lib/send-view.js +23 -0
  270. package/dist/shared/lib/socket-liveness.js +155 -0
  271. package/dist/shared/lib/socket-realtime.js +168 -140
  272. package/dist/shared/lib/state-census.js +53 -0
  273. package/dist/shared/lib/summary-mode.js +61 -39
  274. package/dist/shared/lib/tab-attention.js +143 -32
  275. package/dist/shared/lib/table-density.js +64 -0
  276. package/dist/shared/lib/table-pins.js +20 -18
  277. package/dist/shared/lib/track-travel.js +40 -0
  278. package/dist/shared/lib/unseen-changes.js +68 -0
  279. package/dist/shared/lib/upload-file.js +62 -0
  280. package/dist/shared/lib/upload-presence.js +127 -0
  281. package/dist/shared/lib/urgent-chime.js +65 -0
  282. package/dist/shared/lib/use-below-md.js +29 -0
  283. package/dist/shared/lib/use-online-users.js +32 -11
  284. package/dist/shared/lib/user-sync.js +155 -39
  285. package/dist/shared/lib/waiting-count.js +44 -0
  286. package/dist/shared/lib/watch-desktop.js +83 -0
  287. package/dist/shared/lib/watch-list.js +447 -0
  288. package/dist/shared/lib/widget-image-render.js +64 -0
  289. package/dist/shared/lib/widget-image.js +111 -0
  290. package/dist/shared/lib/worker-socket.js +130 -104
  291. package/dist/shared/lib/write-to-screen.js +133 -0
  292. package/package.json +1 -1
  293. package/styles.css +49 -1
@@ -1,213 +1,256 @@
1
- import { jsxs as s, jsx as t, Fragment as V } from "react/jsx-runtime";
2
- import { useQueryClient as Ne, useQuery as z, useMutation as j } from "@tanstack/react-query";
3
- import { MessageSquare as Pe, ChevronDown as Fe, ClipboardPlus as Re, Pencil as Me, Trash2 as Ie, Check as Oe, X as je, SmilePlus as we } from "lucide-react";
4
- import { useState as _, useRef as Y, useEffect as Z, useMemo as X } from "react";
5
- import { createPortal as Ae } from "react-dom";
6
- import { toast as I } from "sonner";
7
- import { useNivaroClient as se, useItemEditAuth as Le, useDrilldown as Ke } from "../../context.js";
8
- import { useDebounced as Be } from "../../hooks/useDebounced.js";
9
- import { get as U, post as B, patch as Qe, del as ze } from "../../lib/commands.js";
10
- import { usePresenceOnlinePoll as Ue } from "../../lib/presence-live.js";
11
- import { useRecordSignalPeers as We, useRecordSignalSender as Ge, signalSentence as He } from "../../lib/presence-signals.js";
12
- import { invalidateRecordTasks as Xe } from "../../lib/record-tasks.js";
13
- import { useStartsOpen as Je } from "../../lib/use-starts-open.js";
14
- import { formatRelative as oe, formatDateTime as le, titleCase as Ve } from "../../lib/utils.js";
15
- import { AgentBadge as Ze } from "../AgentBadge.js";
16
- import { AutolinkedText as re } from "../AutolinkedText.js";
17
- import { InboundRequestPopover as Ye } from "../integrations/InboundRequest.js";
18
- import { useFieldComments as et } from "../item-edit/field-comments-context.js";
19
- import { UserAvatar as tt } from "../UserAvatar.js";
20
- import { Avatar as at, AvatarFallback as nt } from "../ui/avatar.js";
21
- import { Button as J } from "../ui/button.js";
22
- import { Separator as ge } from "../ui/separator.js";
23
- import { Textarea as rt } from "../ui/textarea.js";
24
- import { RecordEventPathSheet as st } from "./IntegrationActivitySection.js";
25
- const _e = ["👍", "✅", "👀", "🎉", "❤️", "😂"];
26
- function ot(e) {
27
- var d, u, b, m;
28
- return [(d = e.first_name) == null ? void 0 : d[0], (u = e.last_name) == null ? void 0 : u[0]].filter(Boolean).join("").toUpperCase() || ((m = (b = e.email) == null ? void 0 : b[0]) == null ? void 0 : m.toUpperCase()) || "?";
1
+ import { jsxs as s, jsx as t, Fragment as Y } from "react/jsx-runtime";
2
+ import { useQueryClient as Ee, useQuery as W, useMutation as A } from "@tanstack/react-query";
3
+ import { MessageSquare as Qe, ChevronDown as Ue, ClipboardPlus as ze, Pencil as We, Trash2 as He, Check as $e, X as Ge, SmilePlus as Te, BellOff as Je } from "lucide-react";
4
+ import { useState as C, useRef as ee, useEffect as qe, useMemo as z } from "react";
5
+ import { createPortal as Xe } from "react-dom";
6
+ import { toast as M } from "sonner";
7
+ import { useNivaroClient as le, useItemEditAuth as Ve, useDrilldown as Ze } from "../../context.js";
8
+ import { useDebounced as Ye } from "../../hooks/useDebounced.js";
9
+ import { get as H, post as K, patch as et, del as tt } from "../../lib/commands.js";
10
+ import { useRepliesWhileTyping as at, mentionReceiptLine as nt, mentionReceiptSummary as rt } from "../../lib/comment-awareness.js";
11
+ import { stripCommentImages as st } from "../../lib/comment-images.js";
12
+ import { useLivePreference as ot } from "../../lib/live-preference.js";
13
+ import { usePresenceOnlinePoll as lt } from "../../lib/presence-live.js";
14
+ import { useMyUserId as it, useNoteTypists as dt, useDraftTypingSignal as ct, signalSentence as mt } from "../../lib/presence-signals.js";
15
+ import { invalidateRecordTasks as pt } from "../../lib/record-tasks.js";
16
+ import { useNewSince as ut } from "../../lib/seen-since.js";
17
+ import { useStartsOpen as xt } from "../../lib/use-starts-open.js";
18
+ import { titleCase as ye, formatDateTime as ie, cn as ve, formatRelative as ht } from "../../lib/utils.js";
19
+ import { AgentBadge as bt } from "../AgentBadge.js";
20
+ import { AutolinkedText as De } from "../AutolinkedText.js";
21
+ import { InboundRequestPopover as ft } from "../integrations/InboundRequest.js";
22
+ import { useFieldComments as gt } from "../item-edit/field-comments-context.js";
23
+ import { RelativeTime as Ie } from "../RelativeTime.js";
24
+ import { UserAvatar as yt } from "../UserAvatar.js";
25
+ import { Avatar as vt, AvatarFallback as kt } from "../ui/avatar.js";
26
+ import { Button as Z } from "../ui/button.js";
27
+ import { Separator as ke } from "../ui/separator.js";
28
+ import { Textarea as Nt } from "../ui/textarea.js";
29
+ import { useHoldInPlace as wt, RepliesWhileTyping as _t, jumpToComment as Ct, SeenByLine as St, MentionDeliveryButton as Et } from "./CommentAwareness.js";
30
+ import { useCommentImages as $t, CommentImageStrip as Tt, CommentBody as qt, imageDropProps as Dt } from "./CommentImages.js";
31
+ import { RecordEventPathSheet as It } from "./IntegrationActivitySection.js";
32
+ import { NewSinceChip as Rt } from "./NewSinceChip.js";
33
+ const Re = ["👍", "✅", "👀", "🎉", "❤️", "😂"];
34
+ function Pt(e) {
35
+ var x, b, f, c;
36
+ return [(x = e.first_name) == null ? void 0 : x[0], (b = e.last_name) == null ? void 0 : b[0]].filter(Boolean).join("").toUpperCase() || ((c = (f = e.email) == null ? void 0 : f[0]) == null ? void 0 : c.toUpperCase()) || "?";
29
37
  }
30
- function lt({ comment: e }) {
31
- const l = (e.mentions ?? []).filter(
32
- (d) => {
33
- var u;
34
- return d.id && String(d.id).toUpperCase() !== String(((u = e.user) == null ? void 0 : u.id) ?? "").toUpperCase();
38
+ const Ne = {
39
+ ok: "text-emerald-700 dark:text-emerald-400",
40
+ neutral: "text-slate-500 dark:text-slate-400",
41
+ warn: "text-amber-700 dark:text-amber-400"
42
+ };
43
+ function we({ tone: e }) {
44
+ return e === "ok" ? /* @__PURE__ */ t($e, { "aria-hidden": !0, className: "h-3 w-3 shrink-0" }) : e === "warn" ? /* @__PURE__ */ t(Je, { "aria-hidden": !0, className: "h-3 w-3 shrink-0" }) : null;
45
+ }
46
+ function oe(e) {
47
+ return (e.mentions ?? []).filter(
48
+ (l) => {
49
+ var x;
50
+ return l.id && String(l.id).toUpperCase() !== String(((x = e.user) == null ? void 0 : x.id) ?? "").toUpperCase();
35
51
  }
36
52
  );
37
- return l.length === 0 ? null : /* @__PURE__ */ t(
53
+ }
54
+ function Ft({
55
+ comment: e,
56
+ collection: l,
57
+ item: x
58
+ }) {
59
+ const b = ot(), f = oe(e);
60
+ if (f.length === 0) return null;
61
+ const c = f.map((d) => ({ m: d, ...nt(d, ht) })), m = rt(f);
62
+ return /* @__PURE__ */ s(
38
63
  "p",
39
64
  {
40
65
  className: "mt-1 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-[11px]",
41
66
  "data-mention-receipts": !0,
42
- children: l.map((d) => {
43
- const u = [d.first_name, d.last_name].filter(Boolean).join(" ") || d.email || "Someone";
44
- return /* @__PURE__ */ s(
67
+ children: [
68
+ b.quiet ? (
69
+ // Calm / Off: one summary; the per-person sentences are one hover away.
70
+ /* @__PURE__ */ s(
71
+ "button",
72
+ {
73
+ type: "button",
74
+ "data-mention-receipts-summary": !0,
75
+ "data-tip": c.map((d) => d.text).join(" · "),
76
+ "aria-label": c.map((d) => d.text).join(". "),
77
+ className: ve("inline-flex items-center gap-1 rounded", Ne[m.tone]),
78
+ children: [
79
+ /* @__PURE__ */ t(we, { tone: m.tone }),
80
+ m.text
81
+ ]
82
+ }
83
+ )
84
+ ) : c.map(({ m: d, text: k, tone: N }) => /* @__PURE__ */ s(
45
85
  "span",
46
86
  {
47
- "data-mention-seen": d.seen_at ? "seen" : "unseen",
48
- title: d.seen_at ? `Seen ${le(d.seen_at)}` : "Not seen yet",
49
- className: d.seen_at ? "text-emerald-600 dark:text-emerald-400" : "text-slate-400",
87
+ "data-mention-seen": N === "ok" ? "seen" : "unseen",
88
+ "data-mention-status": d.status ?? void 0,
89
+ "data-tip": d.seen_at ? `Seen ${ie(d.seen_at)}` : void 0,
90
+ className: ve("inline-flex items-center gap-1", Ne[N]),
50
91
  children: [
51
- d.seen_at ? "✓ " : "",
52
- u,
53
- d.seen_at ? ` saw this ${oe(d.seen_at)}` : " has not seen this yet"
92
+ /* @__PURE__ */ t(we, { tone: N }),
93
+ k
54
94
  ]
55
95
  },
56
96
  d.id
57
- );
58
- })
97
+ )),
98
+ e.delivery_visible && /* @__PURE__ */ t(Et, { collection: l, item: x, commentId: e.id })
99
+ ]
59
100
  }
60
101
  );
61
102
  }
62
- function Ce(e) {
103
+ function Pe(e) {
63
104
  return [e.first_name, e.last_name].filter(Boolean).join(" ") || e.email;
64
105
  }
65
- function ye(e) {
66
- var d;
67
- const l = Ce(e.user);
68
- return (d = e.acting_admin) != null && d.name ? `${e.acting_admin.name} as ${l}` : l;
106
+ function re(e) {
107
+ var x;
108
+ const l = Pe(e.user);
109
+ return (x = e.acting_admin) != null && x.name ? `${e.acting_admin.name} as ${l}` : l;
69
110
  }
70
- function it({
111
+ function Mt({
71
112
  field: e,
72
113
  label: l,
73
- resolved: d,
74
- onJump: u
114
+ resolved: x,
115
+ onJump: b
75
116
  }) {
76
- const b = /* @__PURE__ */ s(V, { children: [
117
+ const f = /* @__PURE__ */ s(Y, { children: [
77
118
  "on ",
78
119
  /* @__PURE__ */ t("span", { className: "font-medium", children: l }),
79
- d && /* @__PURE__ */ t("span", { className: "text-slate-400 dark:text-slate-500", children: " · resolved" })
80
- ] }), m = "inline-flex min-w-0 max-w-[220px] items-center gap-1 truncate rounded-full border border-slate-200 bg-slate-50 px-1.5 py-px text-[10.5px] text-slate-600 dark:border-border dark:bg-muted dark:text-slate-300";
81
- return u ? /* @__PURE__ */ t(
120
+ x && /* @__PURE__ */ t("span", { className: "text-slate-400 dark:text-slate-500", children: " · resolved" })
121
+ ] }), c = "inline-flex min-w-0 max-w-[220px] items-center gap-1 truncate rounded-full border border-slate-200 bg-slate-50 px-1.5 py-px text-[10.5px] text-slate-600 dark:border-border dark:bg-muted dark:text-slate-300";
122
+ return b ? /* @__PURE__ */ t(
82
123
  "button",
83
124
  {
84
125
  type: "button",
85
126
  "data-comment-field": e,
86
- onClick: u,
127
+ onClick: b,
87
128
  "data-tip": `Go to ${l}`,
88
- className: `${m} transition-colors hover:border-nvr-cyan/50 hover:text-[#0e7490] dark:hover:text-nvr-cyan`,
89
- children: b
129
+ className: `${c} transition-colors hover:border-nvr-cyan/50 hover:text-[#0e7490] dark:hover:text-nvr-cyan`,
130
+ children: f
90
131
  }
91
- ) : /* @__PURE__ */ t("span", { "data-comment-field": e, className: m, children: b });
132
+ ) : /* @__PURE__ */ t("span", { "data-comment-field": e, className: c, children: f });
92
133
  }
93
- function dt(e, l) {
94
- const u = e.slice(0, l).match(/(^|\s)@([a-zA-Z0-9._-]{2,})$/);
95
- return u ? { start: l - u[2].length - 1, query: u[2] } : null;
134
+ function Ot(e, l) {
135
+ const b = e.slice(0, l).match(/(^|\s)@([a-zA-Z0-9._-]{2,})$/);
136
+ return b ? { start: l - b[2].length - 1, query: b[2] } : null;
96
137
  }
97
- function ve(e) {
138
+ function _e(e) {
98
139
  return e.email.split("@")[0];
99
140
  }
100
- function ne({
141
+ function se({
101
142
  value: e,
102
143
  onChange: l,
103
- ...d
144
+ onImages: x,
145
+ ...b
104
146
  }) {
105
- const u = se(), b = Y(null), [m, C] = _(null), [g, k] = _(0), v = Be((m == null ? void 0 : m.query) ?? "", 200), { data: S = [] } = z({
106
- queryKey: ["users", "mention-search", v],
107
- queryFn: () => u.request(
108
- U("/users", { limit: 8, sort: "first_name", search: v })
109
- ).then((a) => a.data),
110
- enabled: !!m && v.length >= 2,
147
+ const f = le(), c = ee(null), [m, d] = C(null), [k, N] = C(0), y = Ye((m == null ? void 0 : m.query) ?? "", 200), { data: S = [] } = W({
148
+ queryKey: ["users", "mention-search", y],
149
+ queryFn: () => f.request(
150
+ H("/users", { limit: 8, sort: "first_name", search: y })
151
+ ).then((r) => r.data),
152
+ enabled: !!m && y.length >= 2,
111
153
  staleTime: 3e4
112
- }), q = Ue(15e3, !!m), { data: D } = z({
154
+ }), q = lt(15e3, !!m), { data: I } = W({
113
155
  queryKey: ["presence-online"],
114
- queryFn: () => u.request(
115
- U("/presence/online")
156
+ queryFn: () => f.request(
157
+ H("/presence/online")
116
158
  ),
117
159
  enabled: !!m,
118
160
  refetchInterval: q,
119
161
  staleTime: 5e3
120
- }), c = (a) => {
121
- var p;
122
- const i = (p = D == null ? void 0 : D.data) == null ? void 0 : p.find((f) => String(f.user_id).toUpperCase() === a.toUpperCase());
162
+ }), p = (r) => {
163
+ var u;
164
+ const i = (u = I == null ? void 0 : I.data) == null ? void 0 : u.find((g) => String(g.user_id).toUpperCase() === r.toUpperCase());
123
165
  return i ? i.is_idle || i.away ? 1 : 0 : 2;
124
- }, y = [...S].sort((a, i) => c(a.id) - c(i.id)), { data: T = [] } = z({
166
+ }, w = S, { data: T = [] } = W({
125
167
  queryKey: ["mention-roles"],
126
- queryFn: () => u.request(U("/chat/roles")).then((a) => a.data).catch(() => []),
168
+ queryFn: () => f.request(H("/chat/roles")).then((r) => r.data).catch(() => []),
127
169
  enabled: !!m,
128
170
  staleTime: 5 * 6e4
129
- }), $ = m ? T.filter(
130
- (a) => a.name.toLowerCase().replace(/\s+/g, "-").startsWith(v.toLowerCase())
131
- ).slice(0, 3) : [], N = !!m && v.length >= 2 && "owners".startsWith(v.toLowerCase()), P = !!m && v.length >= 2 && (y.length > 0 || N || $.length > 0), o = y.length + (N ? 1 : 0) + $.length, [h, E] = _(null), W = Y(null);
132
- Z(() => {
133
- if (!P || !b.current) {
134
- E(null);
171
+ }), E = m ? T.filter(
172
+ (r) => r.name.toLowerCase().replace(/\s+/g, "-").startsWith(y.toLowerCase())
173
+ ).slice(0, 3) : [], _ = !!m && y.length >= 2 && "owners".startsWith(y.toLowerCase()), o = !!m && y.length >= 2 && (w.length > 0 || _ || E.length > 0), v = w.length + (_ ? 1 : 0) + E.length, [P, G] = C(null), B = ee(null);
174
+ qe(() => {
175
+ if (!o || !c.current) {
176
+ G(null);
135
177
  return;
136
178
  }
137
- const a = b.current.getBoundingClientRect();
138
- E({ top: a.bottom + 4, left: a.left, width: Math.min(a.width, 360) });
139
- const i = (f) => {
140
- var w;
141
- (w = W.current) != null && w.contains(f.target) || C(null);
142
- }, p = () => C(null);
143
- return window.addEventListener("scroll", i, !0), window.addEventListener("resize", p), () => {
144
- window.removeEventListener("scroll", i, !0), window.removeEventListener("resize", p);
179
+ const r = c.current.getBoundingClientRect();
180
+ G({ top: r.bottom + 4, left: r.left, width: Math.min(r.width, 360) });
181
+ const i = (g) => {
182
+ var $;
183
+ ($ = B.current) != null && $.contains(g.target) || d(null);
184
+ }, u = () => d(null);
185
+ return window.addEventListener("scroll", i, !0), window.addEventListener("resize", u), () => {
186
+ window.removeEventListener("scroll", i, !0), window.removeEventListener("resize", u);
145
187
  };
146
- }, [P]);
147
- function A(a) {
148
- const i = dt(a.value, a.selectionStart ?? a.value.length);
149
- C(i), i || k(0);
188
+ }, [o]);
189
+ function Q(r) {
190
+ const i = Ot(r.value, r.selectionStart ?? r.value.length);
191
+ d(i), i || N(0);
150
192
  }
151
- function F(a) {
152
- if (!m || !b.current) return;
153
- const i = b.current.selectionStart ?? e.length, p = a === "__owners__" ? "@owners " : typeof a == "object" && "role" in a ? `@${a.role.toLowerCase().replace(/\s+/g, "-")} ` : `@${ve(a)} `, f = e.slice(0, m.start) + p + e.slice(i);
154
- l(f), C(null), k(0);
155
- const w = m.start + p.length;
193
+ function R(r) {
194
+ if (!m || !c.current) return;
195
+ const i = c.current.selectionStart ?? e.length, u = r === "__owners__" ? "@owners " : typeof r == "object" && "role" in r ? `@${r.role.toLowerCase().replace(/\s+/g, "-")} ` : `@${_e(r)} `, g = e.slice(0, m.start) + u + e.slice(i);
196
+ l(g), d(null), N(0);
197
+ const $ = m.start + u.length;
156
198
  requestAnimationFrame(() => {
157
- var O, L;
158
- (O = b.current) == null || O.focus(), (L = b.current) == null || L.setSelectionRange(w, w);
199
+ var O, j;
200
+ (O = c.current) == null || O.focus(), (j = c.current) == null || j.setSelectionRange($, $);
159
201
  });
160
202
  }
161
- function Q(a) {
162
- if (P)
163
- if (a.key === "ArrowDown")
164
- a.preventDefault(), k((i) => (i + 1) % o);
165
- else if (a.key === "ArrowUp")
166
- a.preventDefault(), k((i) => (i - 1 + o) % o);
167
- else if (a.key === "Enter" || a.key === "Tab") {
168
- a.preventDefault();
169
- const i = Math.min(g, o - 1), p = N ? 1 : 0, f = p + y.length;
170
- if (N && i === 0) F("__owners__");
171
- else if (i >= f) {
172
- const w = $[i - f];
173
- w && F({ role: w.name });
174
- } else F(y[i - p]);
175
- } else a.key === "Escape" && (a.preventDefault(), C(null));
203
+ function U(r) {
204
+ if (o)
205
+ if (r.key === "ArrowDown")
206
+ r.preventDefault(), N((i) => (i + 1) % v);
207
+ else if (r.key === "ArrowUp")
208
+ r.preventDefault(), N((i) => (i - 1 + v) % v);
209
+ else if (r.key === "Enter" || r.key === "Tab") {
210
+ r.preventDefault();
211
+ const i = Math.min(k, v - 1), u = _ ? 1 : 0, g = u + w.length;
212
+ if (_ && i === 0) R("__owners__");
213
+ else if (i >= g) {
214
+ const $ = E[i - g];
215
+ $ && R({ role: $.name });
216
+ } else R(w[i - u]);
217
+ } else r.key === "Escape" && (r.preventDefault(), d(null));
176
218
  }
177
219
  return /* @__PURE__ */ s("div", { className: "relative", children: [
178
220
  /* @__PURE__ */ t(
179
- rt,
221
+ Nt,
180
222
  {
181
- ...d,
182
- ref: b,
223
+ ...b,
224
+ ...x ? Dt(x) : {},
225
+ ref: c,
183
226
  value: e,
184
- onChange: (a) => {
185
- l(a.target.value), A(a.target);
227
+ onChange: (r) => {
228
+ l(r.target.value), Q(r.target);
186
229
  },
187
- onKeyDown: Q,
188
- onClick: (a) => A(a.currentTarget),
189
- onBlur: () => setTimeout(() => C(null), 150)
230
+ onKeyDown: U,
231
+ onClick: (r) => Q(r.currentTarget),
232
+ onBlur: () => setTimeout(() => d(null), 150)
190
233
  }
191
234
  ),
192
- P && h && Ae(
235
+ o && P && Xe(
193
236
  /* @__PURE__ */ s(
194
237
  "div",
195
238
  {
196
- ref: W,
239
+ ref: B,
197
240
  "data-mention-menu": "",
198
241
  className: "fixed z-[110] max-h-60 overflow-y-auto rounded-md border border-slate-200 bg-white shadow-lg dark:border-border dark:bg-popover",
199
- style: { top: h.top, left: h.left, width: h.width },
200
- onMouseDown: (a) => a.preventDefault(),
242
+ style: { top: P.top, left: P.left, width: P.width },
243
+ onMouseDown: (r) => r.preventDefault(),
201
244
  children: [
202
- N && /* @__PURE__ */ s(
245
+ _ && /* @__PURE__ */ s(
203
246
  "button",
204
247
  {
205
248
  type: "button",
206
- onMouseDown: (a) => {
207
- a.preventDefault(), F("__owners__");
249
+ onMouseDown: (r) => {
250
+ r.preventDefault(), R("__owners__");
208
251
  },
209
- onMouseEnter: () => k(0),
210
- className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${g === 0 ? "bg-nvr-cyan/10" : ""}`,
252
+ onMouseEnter: () => N(0),
253
+ className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${k === 0 ? "bg-nvr-cyan/10" : ""}`,
211
254
  children: [
212
255
  /* @__PURE__ */ t("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/15 text-[10px] font-semibold text-nvr-navy/80 dark:text-nvr-cyan", children: "★" }),
213
256
  /* @__PURE__ */ s("span", { className: "min-w-0 flex-1", children: [
@@ -217,70 +260,70 @@ function ne({
217
260
  ]
218
261
  }
219
262
  ),
220
- y.map((a, i) => {
221
- var w, O;
222
- const p = N ? i + 1 : i, f = [a.first_name, a.last_name].filter(Boolean).join(" ") || a.email;
263
+ w.map((r, i) => {
264
+ var $, O;
265
+ const u = _ ? i + 1 : i, g = [r.first_name, r.last_name].filter(Boolean).join(" ") || r.email;
223
266
  return /* @__PURE__ */ s(
224
267
  "button",
225
268
  {
226
269
  type: "button",
227
- onMouseDown: (L) => {
228
- L.preventDefault(), F(a);
270
+ onMouseDown: (j) => {
271
+ j.preventDefault(), R(r);
229
272
  },
230
- onMouseEnter: () => k(p),
231
- className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${p === g ? "bg-nvr-cyan/10" : ""}`,
273
+ onMouseEnter: () => N(u),
274
+ className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${u === k ? "bg-nvr-cyan/10" : ""}`,
232
275
  children: [
233
276
  /* @__PURE__ */ s("span", { className: "relative flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/15 text-[10px] font-semibold text-nvr-navy/80 dark:text-nvr-cyan", children: [
234
- (`${((w = a.first_name) == null ? void 0 : w[0]) ?? ""}${((O = a.last_name) == null ? void 0 : O[0]) ?? ""}`.trim() || a.email[0]).toUpperCase(),
235
- c(a.id) < 2 && /* @__PURE__ */ t(
277
+ (`${(($ = r.first_name) == null ? void 0 : $[0]) ?? ""}${((O = r.last_name) == null ? void 0 : O[0]) ?? ""}`.trim() || r.email[0]).toUpperCase(),
278
+ p(r.id) < 2 && /* @__PURE__ */ t(
236
279
  "span",
237
280
  {
238
- "data-mention-presence": c(a.id) === 0 ? "online" : "idle",
239
- title: c(a.id) === 0 ? "Online" : "Idle",
240
- className: `absolute -bottom-px -right-px h-2 w-2 rounded-full ring-2 ring-white dark:ring-popover ${c(a.id) === 0 ? "bg-emerald-500" : "border border-amber-500 bg-white dark:bg-popover"}`
281
+ "data-mention-presence": p(r.id) === 0 ? "online" : "idle",
282
+ title: p(r.id) === 0 ? "Online" : "Idle",
283
+ className: `absolute -bottom-px -right-px h-2 w-2 rounded-full ring-2 ring-white dark:ring-popover ${p(r.id) === 0 ? "bg-emerald-500" : "border border-amber-500 bg-white dark:bg-popover"}`
241
284
  }
242
285
  )
243
286
  ] }),
244
287
  /* @__PURE__ */ s("span", { className: "min-w-0 flex-1", children: [
245
- /* @__PURE__ */ t("span", { className: "block truncate text-[12px] font-medium text-slate-700 dark:text-slate-200", children: f }),
288
+ /* @__PURE__ */ t("span", { className: "block truncate text-[12px] font-medium text-slate-700 dark:text-slate-200", children: g }),
246
289
  /* @__PURE__ */ s("span", { className: "block truncate text-[11px] text-slate-400", children: [
247
- a.is_out_of_office && /* @__PURE__ */ s("span", { className: "mr-1 rounded bg-amber-100 px-1 py-px text-[9.5px] font-semibold text-amber-700 dark:bg-amber-400/15 dark:text-amber-400", children: [
290
+ r.is_out_of_office && /* @__PURE__ */ s("span", { className: "mr-1 rounded bg-amber-100 px-1 py-px text-[9.5px] font-semibold text-amber-700 dark:bg-amber-400/15 dark:text-amber-400", children: [
248
291
  "OOO",
249
- a.ooo_end ? ` until ${String(a.ooo_end).slice(0, 10)}` : ""
292
+ r.ooo_end ? ` until ${String(r.ooo_end).slice(0, 10)}` : ""
250
293
  ] }),
251
294
  "@",
252
- ve(a),
253
- (a.title || a.department) && /* @__PURE__ */ s("span", { className: "text-slate-400 dark:text-slate-500", children: [
295
+ _e(r),
296
+ (r.title || r.department) && /* @__PURE__ */ s("span", { className: "text-slate-400 dark:text-slate-500", children: [
254
297
  " · ",
255
- [a.title, a.department].filter(Boolean).join(", ")
298
+ [r.title, r.department].filter(Boolean).join(", ")
256
299
  ] })
257
300
  ] })
258
301
  ] })
259
302
  ]
260
303
  },
261
- a.id
304
+ r.id
262
305
  );
263
306
  }),
264
- $.map((a, i) => {
265
- const p = y.length + (N ? 1 : 0) + i;
307
+ E.map((r, i) => {
308
+ const u = w.length + (_ ? 1 : 0) + i;
266
309
  return /* @__PURE__ */ s(
267
310
  "button",
268
311
  {
269
312
  type: "button",
270
- onMouseDown: (f) => {
271
- f.preventDefault(), F({ role: a.name });
313
+ onMouseDown: (g) => {
314
+ g.preventDefault(), R({ role: r.name });
272
315
  },
273
- onMouseEnter: () => k(p),
274
- className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${p === g ? "bg-nvr-cyan/10" : ""}`,
316
+ onMouseEnter: () => N(u),
317
+ className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${u === k ? "bg-nvr-cyan/10" : ""}`,
275
318
  children: [
276
319
  /* @__PURE__ */ t("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-violet-500/15 text-[10px] font-semibold text-violet-600 dark:text-violet-300", children: "R" }),
277
320
  /* @__PURE__ */ s("span", { className: "min-w-0 flex-1", children: [
278
- /* @__PURE__ */ t("span", { className: "block truncate text-[12px] font-medium text-slate-700 dark:text-slate-200", children: a.name }),
321
+ /* @__PURE__ */ t("span", { className: "block truncate text-[12px] font-medium text-slate-700 dark:text-slate-200", children: r.name }),
279
322
  /* @__PURE__ */ t("span", { className: "block text-[11px] text-slate-400", children: "Role — notifies every member" })
280
323
  ] })
281
324
  ]
282
325
  },
283
- `role-${a.id}`
326
+ `role-${r.id}`
284
327
  );
285
328
  })
286
329
  ]
@@ -290,7 +333,7 @@ function ne({
290
333
  )
291
334
  ] });
292
335
  }
293
- function ke(e) {
336
+ function Ce(e) {
294
337
  if (e.kind === "comment") return "people";
295
338
  switch (e.note.source) {
296
339
  case "note":
@@ -302,91 +345,91 @@ function ke(e) {
302
345
  return "system";
303
346
  }
304
347
  }
305
- const ct = {
348
+ const jt = {
306
349
  people: "People",
307
350
  system: "System",
308
351
  integration: "Integration"
309
352
  };
310
- function mt(e) {
353
+ function Se(e) {
311
354
  const l = e.kind === "comment" ? e.comment.text : e.note.text;
312
- return (e.kind === "comment" ? l.replace(/<[^>]*>/g, " ") : l).replace(/@\[([^\]]+)\]/g, "@$1").replace(/\s+/g, " ").trim();
355
+ return (e.kind === "comment" ? st(l).replace(/<[^>]*>/g, " ") : l).replace(/@\[([^\]]+)\]/g, "@$1").replace(/\s+/g, " ").trim();
313
356
  }
314
- const ut = "integrations:";
315
- function pt({
357
+ const Lt = "integrations:";
358
+ function At({
316
359
  note: e,
317
360
  collection: l,
318
- item: d
361
+ item: x
319
362
  }) {
320
- var P;
321
- const u = Ke(), [b, m] = _(!1), C = e.source === "external" && !!e.provider && !e.provider.startsWith(ut), g = se(), k = Ne(), [v, S] = _(!1), q = j({
322
- mutationFn: (o) => g.request(B(`/comments/${e.comment_id}/reactions`, { emoji: o })),
363
+ var _;
364
+ const b = Ze(), [f, c] = C(!1), m = e.source === "external" && !!e.provider && !e.provider.startsWith(Lt), d = le(), k = Ee(), [N, y] = C(!1), S = A({
365
+ mutationFn: (o) => d.request(K(`/comments/${e.comment_id}/reactions`, { emoji: o })),
323
366
  onSuccess: () => {
324
- S(!1), k.invalidateQueries({ queryKey: ["comments-related"] }), k.invalidateQueries({ queryKey: ["row-comment-counts"] });
367
+ y(!1), k.invalidateQueries({ queryKey: ["comments-related"] }), k.invalidateQueries({ queryKey: ["row-comment-counts"] });
325
368
  },
326
- onError: () => I.error("Failed to react")
327
- }), [D, c] = _(!1), y = j({
328
- mutationFn: () => g.request(
329
- B(`/integration-events/${encodeURIComponent(e.provider ?? "")}/replay`, {
369
+ onError: () => M.error("Failed to react")
370
+ }), [q, I] = C(!1), p = A({
371
+ mutationFn: () => d.request(
372
+ K(`/integration-events/${encodeURIComponent(e.provider ?? "")}/replay`, {
330
373
  entry_id: e.id.replace(/^external:/, "")
331
374
  })
332
375
  ),
333
376
  onSuccess: (o) => {
334
- var h;
335
- c(!1), I.success("Event replayed", {
336
- description: (h = o == null ? void 0 : o.data) == null ? void 0 : h.detail
377
+ var v;
378
+ I(!1), M.success("Event replayed", {
379
+ description: (v = o == null ? void 0 : o.data) == null ? void 0 : v.detail
337
380
  }), k.invalidateQueries({ queryKey: ["comments-related"] });
338
381
  },
339
382
  onError: (o) => {
340
- var E;
341
- c(!1);
342
- const h = (E = o == null ? void 0 : o.response) == null ? void 0 : E.error;
343
- I.error(h ?? (o == null ? void 0 : o.message) ?? "Replay failed", { duration: 8e3 });
383
+ var P;
384
+ I(!1);
385
+ const v = (P = o == null ? void 0 : o.response) == null ? void 0 : P.error;
386
+ M.error(v ?? (o == null ? void 0 : o.message) ?? "Replay failed", { duration: 8e3 });
344
387
  }
345
- }), T = e.link ? () => {
388
+ }), w = e.link ? () => {
346
389
  const o = e.link;
347
390
  if (!o) return;
348
- const h = document.querySelector(`[data-o2m-row="${o.collection}:${o.item_id}"]`);
349
- if (h) {
350
- h.scrollIntoView({ behavior: "smooth", block: "center" }), h.classList.add("nvr-row-flash"), setTimeout(() => h.classList.remove("nvr-row-flash"), 2400);
391
+ const v = document.querySelector(`[data-o2m-row="${o.collection}:${o.item_id}"]`);
392
+ if (v) {
393
+ v.scrollIntoView({ behavior: "smooth", block: "center" }), v.classList.add("nvr-row-flash"), setTimeout(() => v.classList.remove("nvr-row-flash"), 2400);
351
394
  return;
352
395
  }
353
- u == null || u.open({ collection: o.collection, itemId: o.item_id });
354
- } : null, $ = e.source === "transition" ? "border-nvr-cyan/30 bg-nvr-cyan/[0.06] text-nvr-navy dark:text-nvr-cyan" : e.source === "addendum" ? "border-amber-200 bg-amber-50/60 text-amber-700 dark:border-amber-900/40 dark:bg-amber-900/10 dark:text-amber-400" : e.source === "external" || e.source === "inbound" ? "border-sky-200 bg-sky-50/70 text-sky-700 dark:border-sky-900/40 dark:bg-sky-900/10 dark:text-sky-300" : e.source === "import" ? "border-emerald-200 bg-emerald-50/70 text-emerald-700 dark:border-emerald-900/40 dark:bg-emerald-900/10 dark:text-emerald-300" : "border-slate-200 bg-slate-50/80 text-slate-600 dark:border-border dark:bg-muted/40 dark:text-slate-300", N = e.source === "import" && ((P = e.import) != null && P.file_id) ? e.import : null;
396
+ b == null || b.open({ collection: o.collection, itemId: o.item_id });
397
+ } : null, T = e.source === "transition" ? "border-nvr-cyan/30 bg-nvr-cyan/[0.06] text-nvr-navy dark:text-nvr-cyan" : e.source === "addendum" ? "border-amber-200 bg-amber-50/60 text-amber-700 dark:border-amber-900/40 dark:bg-amber-900/10 dark:text-amber-400" : e.source === "external" || e.source === "inbound" ? "border-sky-200 bg-sky-50/70 text-sky-700 dark:border-sky-900/40 dark:bg-sky-900/10 dark:text-sky-300" : e.source === "import" ? "border-emerald-200 bg-emerald-50/70 text-emerald-700 dark:border-emerald-900/40 dark:bg-emerald-900/10 dark:text-emerald-300" : "border-slate-200 bg-slate-50/80 text-slate-600 dark:border-border dark:bg-muted/40 dark:text-slate-300", E = e.source === "import" && ((_ = e.import) != null && _.file_id) ? e.import : null;
355
398
  return /* @__PURE__ */ s("div", { className: "flex gap-3", "data-recorded-note": e.source, children: [
356
399
  /* @__PURE__ */ t("div", { className: "mt-1 h-8 w-8 shrink-0", "aria-hidden": !0 }),
357
400
  /* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
358
401
  /* @__PURE__ */ s("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1", children: [
359
- /* @__PURE__ */ t("span", { className: `rounded border px-1.5 py-px text-[10px] font-medium ${$}`, children: e.label }),
402
+ /* @__PURE__ */ t("span", { className: `rounded border px-1.5 py-px text-[10px] font-medium ${T}`, children: e.label }),
360
403
  e.user_name && /* @__PURE__ */ t("span", { className: "text-[12px] font-medium text-slate-700 dark:text-slate-200", children: e.user_name }),
361
- e.context && (T ? /* @__PURE__ */ t(
404
+ e.context && (w ? /* @__PURE__ */ t(
362
405
  "button",
363
406
  {
364
407
  type: "button",
365
- onClick: T,
408
+ onClick: w,
366
409
  className: "truncate text-[11px] text-nvr-navy underline-offset-2 hover:underline dark:text-nvr-cyan",
367
410
  "data-line-comment-link": !0,
368
411
  children: e.context
369
412
  }
370
- ) : N ? /* @__PURE__ */ t(
413
+ ) : E ? /* @__PURE__ */ t(
371
414
  "a",
372
415
  {
373
- href: `/api/files/${N.file_id}?download=1`,
416
+ href: `/api/files/${E.file_id}?download=1`,
374
417
  target: "_blank",
375
418
  rel: "noreferrer",
376
419
  onClick: (o) => o.stopPropagation(),
377
420
  className: "truncate text-[11px] text-nvr-navy underline decoration-dotted underline-offset-2 dark:text-nvr-cyan",
378
- "data-note-import-file": N.file_id ?? void 0,
421
+ "data-note-import-file": E.file_id ?? void 0,
379
422
  children: e.context
380
423
  }
381
424
  ) : /* @__PURE__ */ t("span", { className: "truncate text-[11px] text-slate-400", children: e.context })),
382
- /* @__PURE__ */ t("span", { className: "text-[11px] text-slate-400", "data-tip": le(e.created_at), children: oe(e.created_at) }),
425
+ /* @__PURE__ */ t("span", { className: "text-[11px] text-slate-400", "data-tip": ie(e.created_at), children: /* @__PURE__ */ t(Ie, { value: e.created_at }) }),
383
426
  e.source === "inbound" && e.inbound && /* @__PURE__ */ t(
384
- Ye,
427
+ ft,
385
428
  {
386
429
  activityId: e.inbound.activity_id,
387
430
  callerName: e.label,
388
431
  collection: l,
389
- itemId: d,
432
+ itemId: x,
390
433
  align: "end",
391
434
  children: /* @__PURE__ */ t(
392
435
  "button",
@@ -401,11 +444,11 @@ function pt({
401
444
  }
402
445
  ),
403
446
  e.source === "external" && e.status === "error" && /* @__PURE__ */ t("span", { className: "rounded bg-red-50 px-1 text-[10px] font-medium text-red-700 dark:bg-red-500/10 dark:text-red-400", children: "error" }),
404
- C && /* @__PURE__ */ t(
447
+ m && /* @__PURE__ */ t(
405
448
  "button",
406
449
  {
407
450
  type: "button",
408
- onClick: () => m(!0),
451
+ onClick: () => c(!0),
409
452
  "data-note-show-path": e.id,
410
453
  className: "ml-auto rounded px-1.5 py-px text-[10.5px] font-medium text-sky-700 transition-colors hover:bg-sky-50 dark:text-sky-300 dark:hover:bg-sky-900/20",
411
454
  "data-tip": "Everything this event set off, step by step",
@@ -416,23 +459,23 @@ function pt({
416
459
  "button",
417
460
  {
418
461
  type: "button",
419
- onClick: () => D ? y.mutate() : c(!0),
420
- onBlur: () => c(!1),
421
- disabled: y.isPending,
462
+ onClick: () => q ? p.mutate() : I(!0),
463
+ onBlur: () => I(!1),
464
+ disabled: p.isPending,
422
465
  "data-note-replay": e.id,
423
- className: `rounded px-1.5 py-px text-[10.5px] font-medium transition-colors ${D ? "bg-sky-600 text-white" : "text-sky-700 hover:bg-sky-50 dark:text-sky-300 dark:hover:bg-sky-900/20"}`,
466
+ className: `rounded px-1.5 py-px text-[10.5px] font-medium transition-colors ${q ? "bg-sky-600 text-white" : "text-sky-700 hover:bg-sky-50 dark:text-sky-300 dark:hover:bg-sky-900/20"}`,
424
467
  "data-tip": "Re-apply this event from its stored payload",
425
- children: y.isPending ? "Replaying…" : D ? "Replay this event?" : "Replay"
468
+ children: p.isPending ? "Replaying…" : q ? "Replay this event?" : "Replay"
426
469
  }
427
470
  )
428
471
  ] }),
429
- /* @__PURE__ */ t("p", { className: "mt-1 whitespace-pre-wrap break-words text-[13px] leading-snug text-slate-600 dark:text-slate-300", children: /* @__PURE__ */ t(re, { text: e.text }) }),
472
+ /* @__PURE__ */ t("p", { className: "mt-1 whitespace-pre-wrap break-words text-[13px] leading-snug text-slate-600 dark:text-slate-300", children: /* @__PURE__ */ t(De, { text: e.text }) }),
430
473
  e.comment_id && /* @__PURE__ */ s("div", { className: "mt-1 flex flex-wrap items-center gap-1", children: [
431
474
  (e.reactions ?? []).map((o) => /* @__PURE__ */ s(
432
475
  "button",
433
476
  {
434
477
  type: "button",
435
- onClick: () => q.mutate(o.emoji),
478
+ onClick: () => S.mutate(o.emoji),
436
479
  className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-px text-[11px] transition-colors ${o.mine ? "border-nvr-cyan/40 bg-nvr-cyan/10 text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 bg-slate-50 text-slate-600 hover:border-slate-300 dark:border-border dark:bg-muted dark:text-slate-300"}`,
437
480
  children: [
438
481
  o.emoji,
@@ -446,17 +489,17 @@ function pt({
446
489
  "button",
447
490
  {
448
491
  type: "button",
449
- onClick: () => S((o) => !o),
492
+ onClick: () => y((o) => !o),
450
493
  className: "rounded p-0.5 text-slate-300 transition-colors hover:bg-slate-100 hover:text-slate-500 dark:hover:bg-muted",
451
494
  "aria-label": "Add reaction",
452
- children: /* @__PURE__ */ t(we, { className: "h-3.5 w-3.5" })
495
+ children: /* @__PURE__ */ t(Te, { className: "h-3.5 w-3.5" })
453
496
  }
454
497
  ),
455
- v && /* @__PURE__ */ t("span", { className: "absolute bottom-6 left-0 z-20 flex gap-0.5 rounded-full border border-slate-200 bg-white px-1.5 py-1 shadow-lg dark:border-border dark:bg-popover", children: _e.map((o) => /* @__PURE__ */ t(
498
+ N && /* @__PURE__ */ t("span", { className: "absolute bottom-6 left-0 z-20 flex gap-0.5 rounded-full border border-slate-200 bg-white px-1.5 py-1 shadow-lg dark:border-border dark:bg-popover", children: Re.map((o) => /* @__PURE__ */ t(
456
499
  "button",
457
500
  {
458
501
  type: "button",
459
- onClick: () => q.mutate(o),
502
+ onClick: () => S.mutate(o),
460
503
  className: "rounded-full px-1 text-[14px] hover:bg-muted",
461
504
  children: o
462
505
  },
@@ -465,115 +508,132 @@ function pt({
465
508
  ] })
466
509
  ] })
467
510
  ] }),
468
- C && e.provider && /* @__PURE__ */ t(
469
- st,
511
+ m && e.provider && /* @__PURE__ */ t(
512
+ It,
470
513
  {
471
- target: b ? {
514
+ target: f ? {
472
515
  source: e.provider,
473
516
  id: e.id.replace(/^external:/, ""),
474
- record: { collection: l, item: d }
517
+ record: { collection: l, item: x }
475
518
  } : null,
476
519
  event: { label: e.label },
477
- onClose: () => m(!1)
520
+ onClose: () => c(!1)
478
521
  }
479
522
  )
480
523
  ] });
481
524
  }
482
- function jt({
525
+ function ya({
483
526
  collection: e,
484
527
  item: l,
485
- title: d,
486
- defaultExpanded: u,
487
- queuedComments: b,
488
- onQueueComment: m,
489
- onUnsentDraft: C
528
+ title: x,
529
+ defaultExpanded: b,
530
+ queuedComments: f,
531
+ onQueueComment: c,
532
+ onUnsentDraft: m
490
533
  }) {
491
- const g = se(), { userId: k } = Le(), v = Ne(), S = et(), [q, D] = Je(u, !1), [c, y] = _(""), T = Y(C);
492
- T.current = C, Z(() => {
493
- var r;
494
- (r = T.current) == null || r.call(T, c);
495
- }, [c]);
496
- const [$, N] = _(!1), P = async () => {
497
- var r;
498
- if (!(!c.trim() || $)) {
499
- N(!0);
534
+ const d = le(), { userId: k } = Ve(), N = it(), y = Ee(), S = gt(), [q, I] = xt(b, !1), [p, w] = C(""), T = $t(), E = ee(m);
535
+ E.current = m, qe(() => {
536
+ var a;
537
+ (a = E.current) == null || a.call(E, p);
538
+ }, [p]);
539
+ const [_, o] = C(!1), v = async () => {
540
+ var a;
541
+ if (!(!p.trim() || _)) {
542
+ o(!0);
500
543
  try {
501
- const n = await g.request(
502
- B("/ai/cleanup", { text: c })
544
+ const n = await d.request(
545
+ K("/ai/cleanup", { text: p })
503
546
  );
504
- (r = n.data) != null && r.text && y(n.data.text);
547
+ (a = n.data) != null && a.text && w(n.data.text);
505
548
  } catch {
506
549
  } finally {
507
- N(!1);
550
+ o(!1);
508
551
  }
509
552
  }
510
- }, o = We(e, l, "note"), h = Ge(e, l, "note"), E = Y(0);
511
- Z(() => {
512
- if (!c.trim()) {
513
- E.current && h("stop"), E.current = 0;
514
- return;
515
- }
516
- const r = Date.now();
517
- r - E.current < 2500 || (E.current = r, h("start"));
518
- }, [c, h]), Z(() => () => h("stop"), [h]);
519
- const [W, A] = _(null), [F, Q] = _(null), [a, i] = _(""), p = !l || l === "new", f = ["comments", e, String(l)], { data: w, isLoading: O, isError: L } = z({
520
- queryKey: f,
521
- queryFn: () => g.request(U("/comments", { collection: e, item: l })).then((r) => r.data),
522
- enabled: !p
523
- }), ie = X(() => (w ?? []).filter((r) => !r.deleted), [w]), { data: Se } = z({
553
+ }, P = dt(e, l);
554
+ ct(e, l, p);
555
+ const [G, B] = C(null), [Q, R] = C(null), [U, r] = C(""), i = !l || l === "new", u = ["comments", e, String(l)], { data: g, isLoading: $, isError: O } = W({
556
+ queryKey: u,
557
+ queryFn: () => d.request(H("/comments", { collection: e, item: l })).then((a) => a.data),
558
+ enabled: !i
559
+ }), j = z(() => (g ?? []).filter((a) => !a.deleted), [g]), J = at(p, g, k || N), de = ee(null);
560
+ wt(de, J.replies.length);
561
+ const { data: Fe } = W({
524
562
  queryKey: ["comments-related", e, String(l)],
525
- queryFn: () => g.request(U("/comments/related", { collection: e, item: l })).then((r) => r.data ?? []).catch(() => []),
526
- enabled: !p,
563
+ queryFn: () => d.request(H("/comments/related", { collection: e, item: l })).then((a) => a.data ?? []).catch(() => []),
564
+ enabled: !i,
527
565
  staleTime: 3e4
528
- }), de = Se ?? [], R = X(() => {
529
- const r = ie.map((x) => ({ kind: "comment", at: x.created_at, comment: x })), n = de.map((x) => ({ kind: "related", at: x.created_at, note: x }));
530
- return [...r, ...n].sort((x, K) => new Date(K.at).getTime() - new Date(x.at).getTime());
531
- }, [ie, de]), [G, $e] = _(() => /* @__PURE__ */ new Set()), [H, Ee] = _(""), ce = X(() => {
532
- const r = { people: 0, system: 0, integration: 0 };
533
- for (const n of R) r[ke(n)]++;
534
- return r;
535
- }, [R]), me = p ? (b ?? []).length : ce.people, ee = X(() => {
536
- const r = H.trim().toLowerCase();
537
- return R.filter((n) => G.has(ke(n)) ? !1 : r ? (n.kind === "comment" ? `${n.comment.text} ${Ce(n.comment.user)}` : `${n.note.text} ${n.note.user_name ?? ""} ${n.note.label} ${n.note.context ?? ""} ${n.note.provider ?? ""}`).toLowerCase().includes(r) : !0);
538
- }, [R, G, H]), qe = (r) => $e((n) => {
539
- const x = new Set(n);
540
- return x.has(r) ? x.delete(r) : x.add(r), x;
541
- }), De = G.size > 0 || H.trim() !== "", te = j({
542
- mutationFn: (r) => g.request(B("/comments", { collection: e, item: l, text: r })),
566
+ }), ce = Fe ?? [], F = z(() => {
567
+ const a = j.map((h) => ({ kind: "comment", at: h.created_at, comment: h })), n = ce.map((h) => ({ kind: "related", at: h.created_at, note: h }));
568
+ return [...a, ...n].sort((h, L) => new Date(L.at).getTime() - new Date(h.at).getTime());
569
+ }, [j, ce]), [X, Me] = C(() => /* @__PURE__ */ new Set()), [V, Oe] = C(""), me = z(() => {
570
+ const a = { people: 0, system: 0, integration: 0 };
571
+ for (const n of F) a[Ce(n)]++;
572
+ return a;
573
+ }, [F]), pe = i ? (f ?? []).length : me.people, je = z(
574
+ () => (g ?? []).map((a) => {
575
+ var n;
576
+ return { at: a.created_at, by: ((n = a.user) == null ? void 0 : n.id) ?? null };
577
+ }),
578
+ [g]
579
+ ), Le = ut({
580
+ userId: k,
581
+ collection: e,
582
+ item: l,
583
+ tab: "comments",
584
+ open: q,
585
+ entries: je,
586
+ ready: !i && !!g
587
+ }), te = z(() => {
588
+ const a = V.trim().toLowerCase();
589
+ return F.filter((n) => X.has(Ce(n)) ? !1 : a ? (n.kind === "comment" ? `${n.comment.text} ${Pe(n.comment.user)}` : `${n.note.text} ${n.note.user_name ?? ""} ${n.note.label} ${n.note.context ?? ""} ${n.note.provider ?? ""}`).toLowerCase().includes(a) : !0);
590
+ }, [F, X, V]), Ae = (a) => Me((n) => {
591
+ const h = new Set(n);
592
+ return h.has(a) ? h.delete(a) : h.add(a), h;
593
+ }), Be = X.size > 0 || V.trim() !== "", ae = A({
594
+ mutationFn: (a) => d.request(K("/comments", { collection: e, item: l, text: a })),
543
595
  onSuccess: () => {
544
- v.invalidateQueries({ queryKey: f }), y("");
596
+ y.invalidateQueries({ queryKey: u }), w(""), T.reset();
545
597
  },
546
- onError: () => I.error("Failed to post comment")
547
- }), ue = j({
548
- mutationFn: ({ id: r, text: n }) => g.request(Qe(`/comments/${r}`, { text: n })),
598
+ onError: () => M.error("Failed to post comment")
599
+ }), ue = A({
600
+ mutationFn: ({ id: a, text: n }) => d.request(et(`/comments/${a}`, { text: n })),
549
601
  onSuccess: () => {
550
- v.invalidateQueries({ queryKey: f }), A(null), i("");
602
+ y.invalidateQueries({ queryKey: u }), B(null), r("");
551
603
  },
552
- onError: () => I.error("Failed to update comment")
553
- }), ae = j({
554
- mutationFn: (r) => g.request(ze(`/comments/${r}`)),
555
- onSuccess: () => v.invalidateQueries({ queryKey: f }),
556
- onError: () => I.error("Failed to delete comment")
557
- }), pe = j({
558
- mutationFn: ({ id: r, emoji: n }) => g.request(B(`/comments/${r}/reactions`, { emoji: n })),
559
- onSuccess: () => v.invalidateQueries({ queryKey: f }),
560
- onError: () => I.error("Failed to react")
561
- }), [xe, he] = _(null), Te = j({
562
- mutationFn: (r) => g.request(
563
- B("/tasks", {
604
+ onError: () => M.error("Failed to update comment")
605
+ }), ne = A({
606
+ mutationFn: (a) => d.request(tt(`/comments/${a}`)),
607
+ onSuccess: () => y.invalidateQueries({ queryKey: u }),
608
+ onError: () => M.error("Failed to delete comment")
609
+ }), xe = A({
610
+ mutationFn: ({ id: a, emoji: n }) => d.request(K(`/comments/${a}/reactions`, { emoji: n })),
611
+ onSuccess: () => y.invalidateQueries({ queryKey: u }),
612
+ onError: () => M.error("Failed to react")
613
+ }), [he, be] = C(null), Ke = A({
614
+ mutationFn: (a) => d.request(
615
+ K("/tasks", {
564
616
  collection: e,
565
617
  item: l,
566
- title: r.text.replace(/<[^>]*>/g, "").replace(/@\[([^\]]+)\]/g, "@$1").slice(0, 200),
618
+ title: a.text.replace(/<[^>]*>/g, "").replace(/@\[([^\]]+)\]/g, "@$1").slice(0, 200),
567
619
  assignee: k
568
620
  })
569
621
  ),
570
622
  onSuccess: () => {
571
- Xe(v, e, l), I.success("Task created from comment — assigned to you");
623
+ pt(y, e, l), M.success("Task created from comment — assigned to you");
572
624
  },
573
- onError: () => I.error("Could not create a task")
625
+ onError: () => M.error("Could not create a task")
574
626
  });
575
- function be(r) {
576
- r.preventDefault(), c.trim() && (p && m ? (m(c.trim()), y("")) : te.mutate(c.trim()));
627
+ function fe(a) {
628
+ if (a.preventDefault(), i && c) {
629
+ if (!p.trim()) return;
630
+ c(p.trim()), w("");
631
+ } else {
632
+ if (T.uploading) return;
633
+ const n = T.compose(p);
634
+ if (!n) return;
635
+ ae.mutate(n);
636
+ }
577
637
  }
578
638
  return (
579
639
  // Addressable from elsewhere (the summary panel jumps here), which needs
@@ -590,48 +650,49 @@ function jt({
590
650
  {
591
651
  type: "button",
592
652
  "data-panel-toggle": "notes",
593
- onClick: () => D((r) => !r),
653
+ onClick: () => I((a) => !a),
594
654
  className: "flex w-full flex-col px-5 py-3.5 text-left transition-colors hover:bg-slate-50/50 dark:hover:bg-white/[0.02]",
595
655
  children: [
596
656
  /* @__PURE__ */ s("span", { className: "flex w-full items-center gap-2.5", children: [
597
- /* @__PURE__ */ t(Pe, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
598
- /* @__PURE__ */ t("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: d || "Comments" }),
599
- me > 0 && /* @__PURE__ */ t(
657
+ /* @__PURE__ */ t(Qe, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
658
+ /* @__PURE__ */ t("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: x || "Comments" }),
659
+ pe > 0 && /* @__PURE__ */ t(
600
660
  "span",
601
661
  {
602
662
  className: "rounded-full bg-slate-100 px-1.5 py-px text-[10.5px] font-semibold tabular-nums text-slate-500 dark:bg-muted dark:text-slate-400",
603
663
  "data-notes-badge": !0,
604
- children: me
664
+ children: pe
605
665
  }
606
666
  ),
667
+ /* @__PURE__ */ t(Rt, { count: Le, tab: "comments" }),
607
668
  /* @__PURE__ */ t(
608
- Fe,
669
+ Ue,
609
670
  {
610
671
  className: `ml-auto h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform duration-150${q ? " rotate-180" : ""}`
611
672
  }
612
673
  )
613
674
  ] }),
614
- !q && !p && R.length > 0 && (() => {
615
- const r = R[0], n = r.kind === "comment" ? ye(r.comment) : r.note.user_name ?? "System", x = mt(r);
616
- return x ? /* @__PURE__ */ s("span", { className: "mt-1 w-full truncate pl-6 text-[11.5px] text-slate-400", children: [
675
+ !q && !i && F.length > 0 && (() => {
676
+ const a = F[0], n = a.kind === "comment" ? re(a.comment) : a.note.user_name ?? "System", h = Se(a);
677
+ return h ? /* @__PURE__ */ s("span", { className: "mt-1 w-full truncate pl-6 text-[11.5px] text-slate-400", children: [
617
678
  /* @__PURE__ */ s("span", { className: "font-medium text-slate-500 dark:text-slate-400", children: [
618
679
  n,
619
680
  ":"
620
681
  ] }),
621
682
  " ",
622
- /* @__PURE__ */ t(re, { text: x, plain: !0 })
683
+ /* @__PURE__ */ t(De, { text: h, plain: !0 })
623
684
  ] }) : null;
624
685
  })()
625
686
  ]
626
687
  }
627
688
  ),
628
- q && /* @__PURE__ */ t("div", { className: "border-t border-slate-100 px-5 py-4 dark:border-border/60", children: p ? /* @__PURE__ */ s("div", { className: "space-y-4", children: [
629
- /* @__PURE__ */ s("form", { onSubmit: be, className: "space-y-2", children: [
689
+ q && /* @__PURE__ */ t("div", { className: "border-t border-slate-100 px-5 py-4 dark:border-border/60", children: i ? /* @__PURE__ */ s("div", { className: "space-y-4", children: [
690
+ /* @__PURE__ */ s("form", { onSubmit: fe, className: "space-y-2", children: [
630
691
  /* @__PURE__ */ t(
631
- ne,
692
+ se,
632
693
  {
633
- value: c,
634
- onChange: y,
694
+ value: p,
695
+ onChange: w,
635
696
  placeholder: "Write a comment…",
636
697
  rows: 3,
637
698
  className: "text-[13px]"
@@ -639,35 +700,50 @@ function jt({
639
700
  ),
640
701
  /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
641
702
  /* @__PURE__ */ t("p", { className: "text-[11px] text-slate-400", children: "Comment will be posted after the record is saved." }),
642
- /* @__PURE__ */ t(J, { type: "submit", size: "sm", disabled: !c.trim(), children: "Queue" })
703
+ /* @__PURE__ */ t(Z, { type: "submit", size: "sm", disabled: !p.trim(), children: "Queue" })
643
704
  ] })
644
705
  ] }),
645
- (b ?? []).length > 0 && /* @__PURE__ */ s("div", { className: "space-y-2", children: [
646
- /* @__PURE__ */ t(ge, {}),
647
- (b ?? []).map((r, n) => /* @__PURE__ */ s(
706
+ (f ?? []).length > 0 && /* @__PURE__ */ s("div", { className: "space-y-2", children: [
707
+ /* @__PURE__ */ t(ke, {}),
708
+ (f ?? []).map((a, n) => /* @__PURE__ */ s(
648
709
  "div",
649
710
  {
650
711
  className: "flex items-start gap-2.5 rounded-lg border border-dashed border-amber-200/70 bg-amber-50/40 px-3 py-2 dark:border-amber-500/20 dark:bg-amber-500/5",
651
712
  children: [
652
713
  /* @__PURE__ */ t("span", { className: "mt-0.5 inline-flex shrink-0 items-center rounded-full bg-amber-100 px-1.5 py-0.5 text-[10px] font-medium text-amber-600 dark:bg-amber-500/15 dark:text-amber-400", children: "Pending" }),
653
- /* @__PURE__ */ t("p", { className: "text-[13px] leading-relaxed text-slate-600 dark:text-slate-300", children: r })
714
+ /* @__PURE__ */ t("p", { className: "text-[13px] leading-relaxed text-slate-600 dark:text-slate-300", children: a })
654
715
  ]
655
716
  },
656
717
  n
657
718
  ))
658
719
  ] })
659
- ] }) : /* @__PURE__ */ s(V, { children: [
660
- /* @__PURE__ */ s("form", { onSubmit: be, className: "space-y-2", children: [
720
+ ] }) : /* @__PURE__ */ s(Y, { children: [
721
+ J.replies.length > 0 && /* @__PURE__ */ t("div", { className: "mb-2", children: /* @__PURE__ */ t(
722
+ _t,
723
+ {
724
+ replies: J.replies.map((a) => ({
725
+ id: a.id,
726
+ name: re(a),
727
+ text: Se({ kind: "comment", comment: a }),
728
+ created_at: a.created_at
729
+ })),
730
+ onDismiss: J.dismiss,
731
+ onJump: Ct
732
+ }
733
+ ) }),
734
+ /* @__PURE__ */ s("form", { ref: de, onSubmit: fe, className: "space-y-2", children: [
661
735
  /* @__PURE__ */ t(
662
- ne,
736
+ se,
663
737
  {
664
- value: c,
665
- onChange: y,
666
- placeholder: "Write a comment…",
738
+ value: p,
739
+ onChange: w,
740
+ onImages: T.addFiles,
741
+ placeholder: "Write a comment… paste or drop a screenshot to attach it",
667
742
  rows: 3,
668
743
  className: "text-[13px]"
669
744
  }
670
745
  ),
746
+ /* @__PURE__ */ t(Tt, { images: T }),
671
747
  /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
672
748
  /* @__PURE__ */ t("p", { className: "text-[11px] text-slate-400", children: "Type @ plus two letters to mention a teammate, or @owners to notify everyone currently assigned." }),
673
749
  /* @__PURE__ */ s("span", { className: "flex items-center gap-1.5", children: [
@@ -675,277 +751,320 @@ function jt({
675
751
  "button",
676
752
  {
677
753
  type: "button",
678
- disabled: !c.trim() || $,
679
- onClick: () => void P(),
754
+ disabled: !p.trim() || _,
755
+ onClick: () => void v(),
680
756
  "data-tip": "✨ Fix grammar & clarity (meaning preserved)",
681
757
  className: "rounded-md border border-slate-200 px-2 py-1 text-[11.5px] text-slate-500 hover:bg-muted disabled:opacity-50 dark:border-border",
682
- children: $ ? "…" : "✨ Polish"
758
+ children: _ ? "…" : "✨ Polish"
683
759
  }
684
760
  ),
685
- /* @__PURE__ */ t(J, { type: "submit", size: "sm", disabled: !c.trim() || te.isPending, children: te.isPending ? "Posting…" : "Comment" })
761
+ /* @__PURE__ */ t(
762
+ Z,
763
+ {
764
+ type: "submit",
765
+ size: "sm",
766
+ disabled: !p.trim() && !T.hasReady || T.uploading || ae.isPending,
767
+ children: ae.isPending ? "Posting…" : T.uploading ? "Uploading…" : "Comment"
768
+ }
769
+ )
686
770
  ] })
687
771
  ] })
688
772
  ] }),
689
- o.length > 0 && /* @__PURE__ */ s(
773
+ P.map((a) => /* @__PURE__ */ s(
690
774
  "p",
691
775
  {
692
- className: "flex items-center gap-1.5 text-[11.5px] italic text-slate-400",
693
- "data-note-typing": !0,
776
+ className: "flex items-center gap-1.5 text-[11.5px] italic text-slate-400 dark:text-slate-500",
777
+ "data-note-typing": a.field ?? "",
778
+ "aria-live": "polite",
694
779
  children: [
695
- /* @__PURE__ */ t("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-nvr-cyan" }),
696
- He(o, "writing a note"),
780
+ /* @__PURE__ */ t("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-nvr-cyan motion-reduce:animate-none" }),
781
+ mt(
782
+ a.names,
783
+ a.field ? `replying on ${(S == null ? void 0 : S.labelOf(a.field)) ?? ye(a.field)}` : "replying"
784
+ ),
697
785
  "…"
698
786
  ]
699
- }
700
- ),
701
- /* @__PURE__ */ t(ge, { className: "my-4" }),
702
- R.length > 0 && /* @__PURE__ */ s("div", { className: "mb-3 flex flex-wrap items-center gap-1.5", "data-notes-filters": !0, children: [
703
- ["people", "system", "integration"].map((r) => {
704
- const n = !G.has(r), x = ce[r];
787
+ },
788
+ a.field ?? ""
789
+ )),
790
+ /* @__PURE__ */ t(ke, { className: "my-4" }),
791
+ F.length > 0 && /* @__PURE__ */ s("div", { className: "mb-3 flex flex-wrap items-center gap-1.5", "data-notes-filters": !0, children: [
792
+ ["people", "system", "integration"].map((a) => {
793
+ const n = !X.has(a), h = me[a];
705
794
  return /* @__PURE__ */ s(
706
795
  "button",
707
796
  {
708
797
  type: "button",
709
- onClick: () => qe(r),
798
+ onClick: () => Ae(a),
710
799
  "aria-pressed": n,
711
- "data-notes-filter": r,
712
- disabled: x === 0 && n,
800
+ "data-notes-filter": a,
801
+ disabled: h === 0 && n,
713
802
  className: `inline-flex items-center gap-1 rounded-full border px-2 py-px text-[11px] font-medium transition-colors ${n ? "border-nvr-cyan/40 bg-nvr-cyan/10 text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 text-slate-400 line-through decoration-slate-300 dark:border-border"} disabled:opacity-50`,
714
- title: r === "people" ? "Comments and notes people wrote" : r === "system" ? "State changes, change reasons, addendums and imports" : "Events an integration recorded",
803
+ title: a === "people" ? "Comments and notes people wrote" : a === "system" ? "State changes, change reasons, addendums and imports" : "Events an integration recorded",
715
804
  children: [
716
- ct[r],
717
- /* @__PURE__ */ t("span", { className: "tabular-nums text-[10px] opacity-70", children: x })
805
+ jt[a],
806
+ /* @__PURE__ */ t("span", { className: "tabular-nums text-[10px] opacity-70", children: h })
718
807
  ]
719
808
  },
720
- r
809
+ a
721
810
  );
722
811
  }),
723
812
  /* @__PURE__ */ t(
724
813
  "input",
725
814
  {
726
- value: H,
727
- onChange: (r) => Ee(r.target.value),
815
+ value: V,
816
+ onChange: (a) => Oe(a.target.value),
728
817
  placeholder: "Search notes…",
729
818
  "aria-label": "Search notes",
730
819
  "data-notes-search": !0,
731
820
  className: "ml-auto h-6 w-[150px] rounded-md border border-slate-200 bg-background px-2 text-[11.5px] dark:border-border"
732
821
  }
733
822
  ),
734
- De && /* @__PURE__ */ s("span", { className: "text-[10.5px] tabular-nums text-slate-400", "data-notes-shown": !0, children: [
735
- ee.length,
823
+ Be && /* @__PURE__ */ s("span", { className: "text-[10.5px] tabular-nums text-slate-400", "data-notes-shown": !0, children: [
824
+ te.length,
736
825
  " of ",
737
- R.length
826
+ F.length
738
827
  ] })
739
828
  ] }),
740
- O ? /* @__PURE__ */ t("div", { className: "space-y-4", children: ["a", "b"].map((r) => /* @__PURE__ */ s("div", { className: "flex gap-3", children: [
829
+ $ ? /* @__PURE__ */ t("div", { className: "space-y-4", children: ["a", "b"].map((a) => /* @__PURE__ */ s("div", { className: "flex gap-3", children: [
741
830
  /* @__PURE__ */ t("div", { className: "h-8 w-8 shrink-0 animate-pulse rounded-full bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
742
831
  /* @__PURE__ */ s("div", { className: "flex-1 space-y-1.5", children: [
743
832
  /* @__PURE__ */ t("div", { className: "h-3 w-32 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
744
833
  /* @__PURE__ */ t("div", { className: "h-3 w-full animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
745
834
  ] })
746
- ] }, r)) }) : L ? /* @__PURE__ */ t("p", { className: "py-6 text-center text-[12px] text-red-500", children: "Failed to load comments." }) : R.length === 0 ? /* @__PURE__ */ t("p", { className: "py-6 text-center text-[12px] text-slate-400", children: "No notes yet." }) : ee.length === 0 ? /* @__PURE__ */ t("p", { className: "py-6 text-center text-[12px] text-slate-400", children: "No notes match — clear the search or turn a filter back on." }) : /* @__PURE__ */ t("div", { className: "nvr-stagger-direct space-y-4", children: ee.map((r) => {
747
- var fe;
748
- if (r.kind === "related")
835
+ ] }, a)) }) : O ? /* @__PURE__ */ t("p", { className: "py-6 text-center text-[12px] text-red-500", children: "Failed to load comments." }) : F.length === 0 ? /* @__PURE__ */ t("p", { className: "py-6 text-center text-[12px] text-slate-400", children: "No notes yet." }) : te.length === 0 ? /* @__PURE__ */ t("p", { className: "py-6 text-center text-[12px] text-slate-400", children: "No notes match — clear the search or turn a filter back on." }) : /* @__PURE__ */ t("div", { className: "nvr-stagger-direct space-y-4", children: te.map((a) => {
836
+ var ge;
837
+ if (a.kind === "related")
749
838
  return /* @__PURE__ */ t("div", { className: "nvr-section-enter", children: /* @__PURE__ */ t(
750
- pt,
839
+ At,
751
840
  {
752
- note: r.note,
841
+ note: a.note,
753
842
  collection: e,
754
843
  item: String(l)
755
844
  }
756
- ) }, r.note.id);
757
- const n = r.comment, x = k === n.user.id, K = W === n.id;
758
- return /* @__PURE__ */ s("div", { className: "nvr-section-enter group flex gap-3", children: [
759
- /* @__PURE__ */ t(
760
- tt,
761
- {
762
- userId: n.user.id,
763
- className: "h-8 w-8",
764
- fallback: /* @__PURE__ */ t(at, { className: "h-8 w-8 shrink-0", children: /* @__PURE__ */ t(nt, { className: "bg-nvr-cyan/15 text-[11px] font-bold text-nvr-navy", children: ot(n.user) }) })
765
- }
766
- ),
767
- /* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
768
- /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
769
- /* @__PURE__ */ t(
770
- "span",
771
- {
772
- className: "text-[13px] font-medium text-slate-800",
773
- "data-comment-acting-admin": ((fe = n.acting_admin) == null ? void 0 : fe.id) || void 0,
774
- children: ye(n)
775
- }
776
- ),
777
- /* @__PURE__ */ t(Ze, { label: n.via_agent }),
845
+ ) }, a.note.id);
846
+ const n = a.comment, h = k === n.user.id, L = G === n.id;
847
+ return /* @__PURE__ */ s(
848
+ "div",
849
+ {
850
+ "data-comment-id": n.id,
851
+ className: "nvr-section-enter group flex gap-3 rounded-lg",
852
+ children: [
778
853
  /* @__PURE__ */ t(
779
- "span",
854
+ yt,
780
855
  {
781
- className: "text-[11px] text-slate-400",
782
- "data-tip": le(n.created_at),
783
- children: oe(n.created_at)
856
+ userId: n.user.id,
857
+ className: "h-8 w-8",
858
+ fallback: /* @__PURE__ */ t(vt, { className: "h-8 w-8 shrink-0", children: /* @__PURE__ */ t(kt, { className: "bg-nvr-cyan/15 text-[11px] font-bold text-nvr-navy dark:bg-nvr-cyan/20 dark:text-nvr-cyan", children: Pt(n.user) }) })
784
859
  }
785
860
  ),
786
- n.updated_at && n.updated_at !== n.created_at && /* @__PURE__ */ t("span", { className: "text-[10px] text-slate-300", children: "(edited)" }),
787
- n.field && /* @__PURE__ */ t(
788
- it,
789
- {
790
- field: n.field,
791
- label: (S == null ? void 0 : S.labelOf(n.field)) ?? Ve(n.field),
792
- resolved: !!n.resolved_at,
793
- onJump: S ? () => S.jump(n.field) : void 0
794
- }
795
- ),
796
- !K && /* @__PURE__ */ s(
797
- "div",
798
- {
799
- className: `ml-auto flex items-center gap-1 transition-opacity group-hover:opacity-100 focus-within:opacity-100 ${F === n.id ? "opacity-100" : "opacity-0"}`,
800
- children: [
801
- /* @__PURE__ */ t(
802
- "button",
861
+ /* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
862
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
863
+ /* @__PURE__ */ t(
864
+ "span",
865
+ {
866
+ className: "text-[13px] font-medium text-slate-800",
867
+ "data-comment-acting-admin": ((ge = n.acting_admin) == null ? void 0 : ge.id) || void 0,
868
+ children: re(n)
869
+ }
870
+ ),
871
+ /* @__PURE__ */ t(bt, { label: n.via_agent }),
872
+ /* @__PURE__ */ t(
873
+ "span",
874
+ {
875
+ className: "text-[11px] text-slate-400",
876
+ "data-tip": ie(n.created_at),
877
+ children: /* @__PURE__ */ t(Ie, { value: n.created_at })
878
+ }
879
+ ),
880
+ n.updated_at && n.updated_at !== n.created_at && /* @__PURE__ */ t("span", { className: "text-[10px] text-slate-300", children: "(edited)" }),
881
+ n.field && /* @__PURE__ */ t(
882
+ Mt,
883
+ {
884
+ field: n.field,
885
+ label: (S == null ? void 0 : S.labelOf(n.field)) ?? ye(n.field),
886
+ resolved: !!n.resolved_at,
887
+ onJump: S ? () => S.jump(n.field) : void 0
888
+ }
889
+ ),
890
+ !L && /* @__PURE__ */ s(
891
+ "div",
892
+ {
893
+ className: `ml-auto flex items-center gap-1 transition-opacity group-hover:opacity-100 focus-within:opacity-100 ${Q === n.id ? "opacity-100" : "opacity-0"}`,
894
+ children: [
895
+ /* @__PURE__ */ t(
896
+ "button",
897
+ {
898
+ type: "button",
899
+ title: "Make a task from this comment",
900
+ "aria-label": "Make a task from this comment",
901
+ className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted",
902
+ onClick: () => Ke.mutate(n),
903
+ children: /* @__PURE__ */ t(ze, { className: "h-3 w-3" })
904
+ }
905
+ ),
906
+ h && (Q === n.id ? /* @__PURE__ */ s(Y, { children: [
907
+ /* @__PURE__ */ t(
908
+ "button",
909
+ {
910
+ type: "button",
911
+ autoFocus: !0,
912
+ disabled: ne.isPending,
913
+ "data-comment-delete-confirm": n.id,
914
+ className: "rounded bg-red-600 px-1.5 py-px text-[10.5px] font-medium text-white transition-colors hover:bg-red-700 disabled:opacity-60",
915
+ onClick: () => ne.mutate(n.id, {
916
+ onSettled: () => R(null)
917
+ }),
918
+ children: ne.isPending ? "Deleting…" : "Delete comment?"
919
+ }
920
+ ),
921
+ /* @__PURE__ */ t(
922
+ "button",
923
+ {
924
+ type: "button",
925
+ className: "rounded px-1.5 py-px text-[10.5px] font-medium text-slate-500 transition-colors hover:bg-slate-100 dark:hover:bg-muted",
926
+ onClick: () => R(null),
927
+ children: "Keep"
928
+ }
929
+ )
930
+ ] }) : /* @__PURE__ */ s(Y, { children: [
931
+ /* @__PURE__ */ t(
932
+ "button",
933
+ {
934
+ type: "button",
935
+ title: "Edit comment",
936
+ "aria-label": "Edit comment",
937
+ className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-700",
938
+ onClick: () => {
939
+ B(n.id), r(n.text);
940
+ },
941
+ children: /* @__PURE__ */ t(We, { className: "h-3 w-3" })
942
+ }
943
+ ),
944
+ /* @__PURE__ */ t(
945
+ "button",
946
+ {
947
+ type: "button",
948
+ title: "Delete comment",
949
+ "aria-label": "Delete comment",
950
+ className: "rounded p-1 text-slate-400 transition-colors hover:bg-red-50 hover:text-red-500",
951
+ onClick: () => R(n.id),
952
+ children: /* @__PURE__ */ t(He, { className: "h-3 w-3" })
953
+ }
954
+ )
955
+ ] }))
956
+ ]
957
+ }
958
+ )
959
+ ] }),
960
+ L ? /* @__PURE__ */ s("div", { className: "mt-1.5 space-y-2", children: [
961
+ /* @__PURE__ */ t(
962
+ se,
963
+ {
964
+ value: U,
965
+ onChange: r,
966
+ rows: 3,
967
+ className: "text-[13px]"
968
+ }
969
+ ),
970
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-1.5", children: [
971
+ /* @__PURE__ */ s(
972
+ Z,
803
973
  {
804
- type: "button",
805
- title: "Make a task from this comment",
806
- "aria-label": "Make a task from this comment",
807
- className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted",
808
- onClick: () => Te.mutate(n),
809
- children: /* @__PURE__ */ t(Re, { className: "h-3 w-3" })
974
+ size: "sm",
975
+ className: "h-7 gap-1.5",
976
+ disabled: !U.trim() || ue.isPending,
977
+ onClick: () => ue.mutate({ id: n.id, text: U.trim() }),
978
+ children: [
979
+ /* @__PURE__ */ t($e, { className: "h-3 w-3" }),
980
+ " Save"
981
+ ]
810
982
  }
811
983
  ),
812
- x && (F === n.id ? /* @__PURE__ */ s(V, { children: [
813
- /* @__PURE__ */ t(
814
- "button",
815
- {
816
- type: "button",
817
- autoFocus: !0,
818
- disabled: ae.isPending,
819
- "data-comment-delete-confirm": n.id,
820
- className: "rounded bg-red-600 px-1.5 py-px text-[10.5px] font-medium text-white transition-colors hover:bg-red-700 disabled:opacity-60",
821
- onClick: () => ae.mutate(n.id, {
822
- onSettled: () => Q(null)
823
- }),
824
- children: ae.isPending ? "Deleting…" : "Delete comment?"
825
- }
826
- ),
827
- /* @__PURE__ */ t(
828
- "button",
829
- {
830
- type: "button",
831
- className: "rounded px-1.5 py-px text-[10.5px] font-medium text-slate-500 transition-colors hover:bg-slate-100 dark:hover:bg-muted",
832
- onClick: () => Q(null),
833
- children: "Keep"
834
- }
835
- )
836
- ] }) : /* @__PURE__ */ s(V, { children: [
837
- /* @__PURE__ */ t(
838
- "button",
839
- {
840
- type: "button",
841
- title: "Edit comment",
842
- "aria-label": "Edit comment",
843
- className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-700",
844
- onClick: () => {
845
- A(n.id), i(n.text);
846
- },
847
- children: /* @__PURE__ */ t(Me, { className: "h-3 w-3" })
848
- }
849
- ),
850
- /* @__PURE__ */ t(
851
- "button",
852
- {
853
- type: "button",
854
- title: "Delete comment",
855
- "aria-label": "Delete comment",
856
- className: "rounded p-1 text-slate-400 transition-colors hover:bg-red-50 hover:text-red-500",
857
- onClick: () => Q(n.id),
858
- children: /* @__PURE__ */ t(Ie, { className: "h-3 w-3" })
859
- }
860
- )
861
- ] }))
862
- ]
863
- }
864
- )
865
- ] }),
866
- K ? /* @__PURE__ */ s("div", { className: "mt-1.5 space-y-2", children: [
867
- /* @__PURE__ */ t(
868
- ne,
869
- {
870
- value: a,
871
- onChange: i,
872
- rows: 3,
873
- className: "text-[13px]"
874
- }
875
- ),
876
- /* @__PURE__ */ s("div", { className: "flex items-center gap-1.5", children: [
877
- /* @__PURE__ */ s(
878
- J,
984
+ /* @__PURE__ */ s(
985
+ Z,
986
+ {
987
+ size: "sm",
988
+ variant: "outline",
989
+ className: "h-7 gap-1.5",
990
+ onClick: () => {
991
+ B(null), r("");
992
+ },
993
+ children: [
994
+ /* @__PURE__ */ t(Ge, { className: "h-3 w-3" }),
995
+ " Cancel"
996
+ ]
997
+ }
998
+ )
999
+ ] })
1000
+ ] }) : /* @__PURE__ */ t(
1001
+ qt,
879
1002
  {
880
- size: "sm",
881
- className: "h-7 gap-1.5",
882
- disabled: !a.trim() || ue.isPending,
883
- onClick: () => ue.mutate({ id: n.id, text: a.trim() }),
884
- children: [
885
- /* @__PURE__ */ t(Oe, { className: "h-3 w-3" }),
886
- " Save"
887
- ]
1003
+ text: n.text,
1004
+ record: { collection: e, itemId: l },
1005
+ className: "mt-0.5 whitespace-pre-wrap text-[13px] leading-relaxed text-slate-600"
888
1006
  }
889
1007
  ),
890
- /* @__PURE__ */ s(
891
- J,
1008
+ !L && /* @__PURE__ */ t(
1009
+ Ft,
892
1010
  {
893
- size: "sm",
894
- variant: "outline",
895
- className: "h-7 gap-1.5",
896
- onClick: () => {
897
- A(null), i("");
898
- },
899
- children: [
900
- /* @__PURE__ */ t(je, { className: "h-3 w-3" }),
901
- " Cancel"
902
- ]
1011
+ comment: n,
1012
+ collection: e,
1013
+ item: String(l)
903
1014
  }
904
- )
905
- ] })
906
- ] }) : /* @__PURE__ */ t("p", { className: "mt-0.5 whitespace-pre-wrap text-[13px] leading-relaxed text-slate-600", children: /* @__PURE__ */ t(re, { text: n.text }) }),
907
- !K && /* @__PURE__ */ t(lt, { comment: n }),
908
- !K && /* @__PURE__ */ s("div", { className: "mt-1 flex flex-wrap items-center gap-1", children: [
909
- (n.reactions ?? []).map((M) => /* @__PURE__ */ s(
910
- "button",
911
- {
912
- type: "button",
913
- onClick: () => pe.mutate({ id: n.id, emoji: M.emoji }),
914
- className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-px text-[11px] transition-colors ${M.mine ? "border-nvr-cyan/40 bg-nvr-cyan/10 text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 bg-slate-50 text-slate-600 hover:border-slate-300 dark:border-border dark:bg-muted dark:text-slate-300"}`,
915
- children: [
916
- M.emoji,
917
- /* @__PURE__ */ t("span", { className: "tabular-nums text-[10px] font-semibold", children: M.count })
918
- ]
919
- },
920
- M.emoji
921
- )),
922
- /* @__PURE__ */ s("span", { className: "relative", children: [
923
- /* @__PURE__ */ t(
924
- "button",
1015
+ ),
1016
+ !L && /* @__PURE__ */ t(
1017
+ St,
925
1018
  {
926
- type: "button",
927
- onClick: () => he(xe === n.id ? null : n.id),
928
- className: "rounded p-0.5 text-slate-300 transition-colors hover:bg-slate-100 hover:text-slate-500 dark:hover:bg-muted",
929
- "aria-label": "Add reaction",
930
- children: /* @__PURE__ */ t(we, { className: "h-3.5 w-3.5" })
1019
+ people: n.seen_by,
1020
+ hasMentions: oe(n).length > 0,
1021
+ exclude: new Set(oe(n).map((D) => String(D.id).toUpperCase()))
931
1022
  }
932
1023
  ),
933
- xe === n.id && /* @__PURE__ */ t("span", { className: "absolute bottom-6 left-0 z-20 flex gap-0.5 rounded-full border border-slate-200 bg-white px-1.5 py-1 shadow-lg dark:border-border dark:bg-popover", children: _e.map((M) => /* @__PURE__ */ t(
934
- "button",
935
- {
936
- type: "button",
937
- onClick: () => {
938
- pe.mutate({ id: n.id, emoji: M }), he(null);
1024
+ !L && /* @__PURE__ */ s("div", { className: "mt-1 flex flex-wrap items-center gap-1", children: [
1025
+ (n.reactions ?? []).map((D) => /* @__PURE__ */ s(
1026
+ "button",
1027
+ {
1028
+ type: "button",
1029
+ onClick: () => xe.mutate({ id: n.id, emoji: D.emoji }),
1030
+ className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-px text-[11px] transition-colors ${D.mine ? "border-nvr-cyan/40 bg-nvr-cyan/10 text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 bg-slate-50 text-slate-600 hover:border-slate-300 dark:border-border dark:bg-muted dark:text-slate-300"}`,
1031
+ children: [
1032
+ D.emoji,
1033
+ /* @__PURE__ */ t("span", { className: "tabular-nums text-[10px] font-semibold", children: D.count })
1034
+ ]
939
1035
  },
940
- className: "rounded-full px-1 text-[14px] hover:bg-muted",
941
- children: M
942
- },
943
- M
944
- )) })
1036
+ D.emoji
1037
+ )),
1038
+ /* @__PURE__ */ s("span", { className: "relative", children: [
1039
+ /* @__PURE__ */ t(
1040
+ "button",
1041
+ {
1042
+ type: "button",
1043
+ onClick: () => be(he === n.id ? null : n.id),
1044
+ className: "rounded p-0.5 text-slate-300 transition-colors hover:bg-slate-100 hover:text-slate-500 dark:hover:bg-muted",
1045
+ "aria-label": "Add reaction",
1046
+ children: /* @__PURE__ */ t(Te, { className: "h-3.5 w-3.5" })
1047
+ }
1048
+ ),
1049
+ he === n.id && /* @__PURE__ */ t("span", { className: "absolute bottom-6 left-0 z-20 flex gap-0.5 rounded-full border border-slate-200 bg-white px-1.5 py-1 shadow-lg dark:border-border dark:bg-popover", children: Re.map((D) => /* @__PURE__ */ t(
1050
+ "button",
1051
+ {
1052
+ type: "button",
1053
+ onClick: () => {
1054
+ xe.mutate({ id: n.id, emoji: D }), be(null);
1055
+ },
1056
+ className: "rounded-full px-1 text-[14px] hover:bg-muted",
1057
+ children: D
1058
+ },
1059
+ D
1060
+ )) })
1061
+ ] })
1062
+ ] })
945
1063
  ] })
946
- ] })
947
- ] })
948
- ] }, n.id);
1064
+ ]
1065
+ },
1066
+ n.id
1067
+ );
949
1068
  }) })
950
1069
  ] }) })
951
1070
  ]
@@ -954,7 +1073,7 @@ function jt({
954
1073
  );
955
1074
  }
956
1075
  export {
957
- jt as CommentPanel,
958
- ne as MentionTextarea,
959
- mt as notePreviewText
1076
+ ya as CommentPanel,
1077
+ se as MentionTextarea,
1078
+ Se as notePreviewText
960
1079
  };