@nivaro/react 0.3.113 → 0.3.115

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 (285) 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 +1727 -19
  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 +4088 -3592
  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 +544 -504
  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/PageRenderer.js +636 -599
  39. package/dist/shared/components/PresenceDot.js +21 -0
  40. package/dist/shared/components/ProfileView.js +656 -536
  41. package/dist/shared/components/RealtimeStatusBanner.js +25 -25
  42. package/dist/shared/components/RecentRecordsRail.js +51 -48
  43. package/dist/shared/components/RecordCompare.js +241 -150
  44. package/dist/shared/components/RecordDrilldownSheet.js +66 -64
  45. package/dist/shared/components/RecordGridEditor.js +350 -311
  46. package/dist/shared/components/RecordHoverCard.js +147 -0
  47. package/dist/shared/components/RecordPeekHost.js +111 -0
  48. package/dist/shared/components/RecordReadView.js +414 -412
  49. package/dist/shared/components/RelativeTime.js +16 -0
  50. package/dist/shared/components/ReportView.js +1396 -1304
  51. package/dist/shared/components/ScreenRefreshButton.js +77 -0
  52. package/dist/shared/components/TabCountHost.js +10 -0
  53. package/dist/shared/components/TickerNumber.js +19 -18
  54. package/dist/shared/components/TipLayer.js +70 -58
  55. package/dist/shared/components/WidgetImageMenu.js +59 -0
  56. package/dist/shared/components/WidgetSlot.js +571 -524
  57. package/dist/shared/components/activity/RecordActivityStream.js +317 -0
  58. package/dist/shared/components/bulk/BulkSelectionNotices.js +220 -0
  59. package/dist/shared/components/cbv/approval-changed.js +20 -0
  60. package/dist/shared/components/cbv/changed-by-others.js +251 -0
  61. package/dist/shared/components/cbv/column-totals.js +75 -67
  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/api.js +161 -117
  79. package/dist/shared/components/integrations/console/tone.js +15 -12
  80. package/dist/shared/components/item-edit/CatalogPickerField.js +1353 -1245
  81. package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +162 -0
  82. package/dist/shared/components/item-edit/CloneDialog.js +208 -206
  83. package/dist/shared/components/item-edit/DerivedCauseNote.js +57 -0
  84. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +81 -70
  85. package/dist/shared/components/item-edit/DuplicateNotice.js +169 -101
  86. package/dist/shared/components/item-edit/FieldAffordances.js +294 -385
  87. package/dist/shared/components/item-edit/FieldComments.js +159 -116
  88. package/dist/shared/components/item-edit/FieldPointer.js +132 -0
  89. package/dist/shared/components/item-edit/FieldRenderer.js +277 -273
  90. package/dist/shared/components/item-edit/FieldRow.js +519 -439
  91. package/dist/shared/components/item-edit/FieldSourceBadge.js +88 -0
  92. package/dist/shared/components/item-edit/FilePickerField.js +454 -369
  93. package/dist/shared/components/item-edit/GroupSection.js +618 -567
  94. package/dist/shared/components/item-edit/HeldEditsChip.js +113 -0
  95. package/dist/shared/components/item-edit/InlineTableField.js +2891 -2723
  96. package/dist/shared/components/item-edit/ListNeighborNav.js +79 -0
  97. package/dist/shared/components/item-edit/LiveTraceSheet.js +26 -0
  98. package/dist/shared/components/item-edit/M2MCombobox.js +284 -273
  99. package/dist/shared/components/item-edit/OutboxReviewTray.js +313 -0
  100. package/dist/shared/components/item-edit/PickerBadges.js +52 -0
  101. package/dist/shared/components/item-edit/PlanGrid.js +434 -439
  102. package/dist/shared/components/item-edit/RecalcValue.js +55 -0
  103. package/dist/shared/components/item-edit/RecordChatActions.js +76 -64
  104. package/dist/shared/components/item-edit/RecordChatMentionsChip.js +103 -0
  105. package/dist/shared/components/item-edit/RecordGrantTools.js +87 -86
  106. package/dist/shared/components/item-edit/RecordHelpChip.js +70 -0
  107. package/dist/shared/components/item-edit/RecordLiveSync.js +230 -217
  108. package/dist/shared/components/item-edit/RecordOutbox.js +53 -52
  109. package/dist/shared/components/item-edit/RecordRecapStrip.js +109 -36
  110. package/dist/shared/components/item-edit/RelationCombobox.js +229 -217
  111. package/dist/shared/components/item-edit/RelationGroupedCombobox.js +105 -100
  112. package/dist/shared/components/item-edit/RemoteChangeUi.js +454 -0
  113. package/dist/shared/components/item-edit/RemoteUploads.js +55 -0
  114. package/dist/shared/components/item-edit/RemovedLineNote.js +92 -0
  115. package/dist/shared/components/item-edit/RichTextEditorImpl.js +298 -223
  116. package/dist/shared/components/item-edit/ScheduledChangeChip.js +244 -0
  117. package/dist/shared/components/item-edit/SectionPresence.js +78 -0
  118. package/dist/shared/components/item-edit/SplitLinesButton.js +166 -0
  119. package/dist/shared/components/item-edit/catalog-line-watch.js +94 -0
  120. package/dist/shared/components/item-edit/coedit/collab.js +84 -0
  121. package/dist/shared/components/item-edit/coedit/context.js +24 -0
  122. package/dist/shared/components/item-edit/coedit/cursors.js +103 -0
  123. package/dist/shared/components/item-edit/coedit/safe-link.js +15 -0
  124. package/dist/shared/components/item-edit/coedit/session.js +382 -0
  125. package/dist/shared/components/item-edit/coedit/useCoedit.js +49 -0
  126. package/dist/shared/components/item-edit/file-live.js +77 -0
  127. package/dist/shared/components/item-edit/file-processing.js +87 -0
  128. package/dist/shared/components/item-edit/layout-switch.js +148 -0
  129. package/dist/shared/components/item-edit/live-related.js +23 -0
  130. package/dist/shared/components/item-edit/live-title.js +66 -0
  131. package/dist/shared/components/item-edit/partner-needs.js +142 -0
  132. package/dist/shared/components/item-edit/removed-line.js +58 -0
  133. package/dist/shared/components/item-edit/render-stability.js +70 -59
  134. package/dist/shared/components/layout-editor/ChangeNote.js +36 -34
  135. package/dist/shared/components/layout-editor/CollabParts.js +72 -70
  136. package/dist/shared/components/layout-editor/LayoutEditor.js +306 -303
  137. package/dist/shared/components/list/InlineEdit.js +504 -208
  138. package/dist/shared/components/list/ListViewers.js +81 -0
  139. package/dist/shared/components/merge/MergeRecordsDialog.js +1227 -0
  140. package/dist/shared/components/merge/MergeWithFlow.js +290 -0
  141. package/dist/shared/components/merge/merge-values.js +110 -0
  142. package/dist/shared/components/monitoring/InactiveUserLinksView.js +285 -258
  143. package/dist/shared/components/notifications/NotificationCenterView.js +388 -321
  144. package/dist/shared/components/notifications/NotificationDetailBits.js +205 -130
  145. package/dist/shared/components/notifications/NotificationRulesEditor.js +72 -52
  146. package/dist/shared/components/notifications/bundles.js +21 -19
  147. package/dist/shared/components/notifications/resolved-line.js +25 -0
  148. package/dist/shared/components/ops/OpsTasksView.js +45 -44
  149. package/dist/shared/components/panels/AccessGrantedNote.js +85 -0
  150. package/dist/shared/components/panels/AlertBanners.js +132 -0
  151. package/dist/shared/components/panels/AsyncUserPicker.js +54 -45
  152. package/dist/shared/components/panels/BranchLanes.js +82 -54
  153. package/dist/shared/components/panels/CommentAwareness.js +332 -0
  154. package/dist/shared/components/panels/CommentImages.js +219 -0
  155. package/dist/shared/components/panels/CommentPanel.js +649 -530
  156. package/dist/shared/components/panels/ExternalRequestsChip.js +98 -80
  157. package/dist/shared/components/panels/NewSinceChip.js +16 -0
  158. package/dist/shared/components/panels/OwnerOpenedLine.js +85 -0
  159. package/dist/shared/components/panels/PipelinePanel.js +1644 -1494
  160. package/dist/shared/components/panels/ResubmissionDiff.js +293 -0
  161. package/dist/shared/components/panels/SlaBreachBanner.js +30 -29
  162. package/dist/shared/components/panels/SlaClock.js +130 -99
  163. package/dist/shared/components/panels/TaskPanel.js +308 -287
  164. package/dist/shared/components/panels/unseen-move-check.js +101 -0
  165. package/dist/shared/components/pipeline/OwnerMatrix.js +80 -71
  166. package/dist/shared/components/pipeline/OwnerMatrixSheet.js +495 -0
  167. package/dist/shared/components/pipeline/PipelineEditorView.js +1855 -1771
  168. package/dist/shared/components/profile/AgentNameField.js +141 -0
  169. package/dist/shared/components/profile/AgentsPanel.js +55 -46
  170. package/dist/shared/components/profile/PersonAccess.js +398 -330
  171. package/dist/shared/components/profile/PersonAdminTools.js +127 -113
  172. package/dist/shared/components/profile/PersonProfile.js +81 -73
  173. package/dist/shared/components/profile/SignInTroubleshooter.js +361 -0
  174. package/dist/shared/components/queue/QueueBulkBar.js +101 -84
  175. package/dist/shared/components/queue/QueueItemSheet.js +66 -66
  176. package/dist/shared/components/queue/QueueTeamStrip.js +279 -0
  177. package/dist/shared/components/queue/QueueWorklist.js +2076 -1686
  178. package/dist/shared/components/queue/queue-totals.js +92 -0
  179. package/dist/shared/components/queue/worklist-helpers.js +18 -14
  180. package/dist/shared/components/send-view/SendViewButton.js +136 -0
  181. package/dist/shared/components/send-view/SentViewCards.js +147 -0
  182. package/dist/shared/components/support/ReportProblem.js +1 -0
  183. package/dist/shared/components/support/ScreenShare.js +554 -0
  184. package/dist/shared/components/support/SupportView.js +160 -129
  185. package/dist/shared/components/support/TicketDetailSheet.js +101 -89
  186. package/dist/shared/components/watch-list/WatchDock.js +1044 -0
  187. package/dist/shared/components/watch-list/WatchExtras.js +723 -0
  188. package/dist/shared/components/watch-list/WatchListButton.js +46 -0
  189. package/dist/shared/components/watch-list/WatchPinButton.js +67 -0
  190. package/dist/shared/components/watch-list/WatchRows.js +348 -0
  191. package/dist/shared/lib/activity-sentence.js +87 -75
  192. package/dist/shared/lib/agent-presence.js +46 -0
  193. package/dist/shared/lib/approval-progress.js +49 -0
  194. package/dist/shared/lib/attention-prefs.js +27 -0
  195. package/dist/shared/lib/cell-locks.js +56 -0
  196. package/dist/shared/lib/co-edit.js +166 -0
  197. package/dist/shared/lib/coedit-registry.js +44 -0
  198. package/dist/shared/lib/comment-awareness.js +124 -0
  199. package/dist/shared/lib/comment-images.js +45 -0
  200. package/dist/shared/lib/config-watch.js +94 -0
  201. package/dist/shared/lib/copy-rules.js +65 -0
  202. package/dist/shared/lib/count-step.js +30 -0
  203. package/dist/shared/lib/deadline-ticker.js +68 -0
  204. package/dist/shared/lib/derived-causes.js +115 -0
  205. package/dist/shared/lib/draft-store.js +114 -85
  206. package/dist/shared/lib/error-hints.js +1 -0
  207. package/dist/shared/lib/field-merge.js +126 -0
  208. package/dist/shared/lib/filter-sentence.js +10 -10
  209. package/dist/shared/lib/focus-mode.js +16 -12
  210. package/dist/shared/lib/grid-cursors.js +77 -0
  211. package/dist/shared/lib/grid-presence.js +182 -0
  212. package/dist/shared/lib/idle-reload.js +100 -73
  213. package/dist/shared/lib/in-step.js +45 -0
  214. package/dist/shared/lib/integration-chip.js +19 -18
  215. package/dist/shared/lib/line-locks.js +141 -0
  216. package/dist/shared/lib/line-split.js +41 -0
  217. package/dist/shared/lib/linked-changes.js +150 -0
  218. package/dist/shared/lib/list-link.js +56 -50
  219. package/dist/shared/lib/list-return.js +231 -0
  220. package/dist/shared/lib/list-viewers.js +52 -0
  221. package/dist/shared/lib/live-announcer.js +86 -0
  222. package/dist/shared/lib/live-counts.js +85 -0
  223. package/dist/shared/lib/live-data-changed.js +108 -0
  224. package/dist/shared/lib/live-deltas.js +81 -0
  225. package/dist/shared/lib/live-findings.js +113 -0
  226. package/dist/shared/lib/live-groups.js +122 -0
  227. package/dist/shared/lib/live-link-labels.js +162 -0
  228. package/dist/shared/lib/live-list-flow.js +334 -0
  229. package/dist/shared/lib/live-list.js +143 -129
  230. package/dist/shared/lib/live-moves.js +51 -0
  231. package/dist/shared/lib/live-ops.js +26 -26
  232. package/dist/shared/lib/live-pickers.js +7 -0
  233. package/dist/shared/lib/live-preference.js +184 -0
  234. package/dist/shared/lib/live-queries.js +226 -181
  235. package/dist/shared/lib/live-screen.js +333 -0
  236. package/dist/shared/lib/live-search.js +108 -0
  237. package/dist/shared/lib/live-seen.js +35 -0
  238. package/dist/shared/lib/live-views.js +100 -0
  239. package/dist/shared/lib/live.js +159 -133
  240. package/dist/shared/lib/missed-updates.js +198 -0
  241. package/dist/shared/lib/newer-file.js +56 -0
  242. package/dist/shared/lib/notification-sound.js +42 -20
  243. package/dist/shared/lib/own-writes.js +59 -41
  244. package/dist/shared/lib/picker-badges.js +94 -0
  245. package/dist/shared/lib/presence-signals.js +131 -84
  246. package/dist/shared/lib/realtime.js +49 -24
  247. package/dist/shared/lib/record-gaps.js +85 -0
  248. package/dist/shared/lib/record-outbox.js +369 -222
  249. package/dist/shared/lib/record-peek.js +75 -0
  250. package/dist/shared/lib/record-tabs.js +92 -72
  251. package/dist/shared/lib/relative-ticker.js +42 -0
  252. package/dist/shared/lib/request-gate.js +119 -119
  253. package/dist/shared/lib/rollup-recalc.js +107 -0
  254. package/dist/shared/lib/room-gaps.js +40 -36
  255. package/dist/shared/lib/rum.js +137 -87
  256. package/dist/shared/lib/save-progress.js +20 -0
  257. package/dist/shared/lib/scheduled-countdown.js +67 -0
  258. package/dist/shared/lib/screen-refresh.js +160 -0
  259. package/dist/shared/lib/screen-share.js +234 -0
  260. package/dist/shared/lib/seen-since.js +74 -0
  261. package/dist/shared/lib/selection-watch.js +205 -0
  262. package/dist/shared/lib/send-status.js +132 -0
  263. package/dist/shared/lib/send-view.js +23 -0
  264. package/dist/shared/lib/socket-liveness.js +155 -0
  265. package/dist/shared/lib/socket-realtime.js +168 -140
  266. package/dist/shared/lib/state-census.js +53 -0
  267. package/dist/shared/lib/summary-mode.js +61 -39
  268. package/dist/shared/lib/tab-attention.js +143 -32
  269. package/dist/shared/lib/table-density.js +64 -0
  270. package/dist/shared/lib/track-travel.js +40 -0
  271. package/dist/shared/lib/unseen-changes.js +68 -0
  272. package/dist/shared/lib/upload-file.js +33 -0
  273. package/dist/shared/lib/upload-presence.js +127 -0
  274. package/dist/shared/lib/urgent-chime.js +65 -0
  275. package/dist/shared/lib/use-online-users.js +32 -11
  276. package/dist/shared/lib/user-sync.js +155 -39
  277. package/dist/shared/lib/waiting-count.js +44 -0
  278. package/dist/shared/lib/watch-desktop.js +83 -0
  279. package/dist/shared/lib/watch-list.js +447 -0
  280. package/dist/shared/lib/widget-image-render.js +64 -0
  281. package/dist/shared/lib/widget-image.js +111 -0
  282. package/dist/shared/lib/worker-socket.js +130 -104
  283. package/dist/shared/lib/write-to-screen.js +133 -0
  284. package/package.json +1 -1
  285. package/styles.css +49 -1
@@ -0,0 +1,1044 @@
1
+ import { jsx as e, jsxs as u, Fragment as P } from "react/jsx-runtime";
2
+ import { useQueryClient as fe, useQuery as O } from "@tanstack/react-query";
3
+ import { CheckCheck as ne, Minus as Ne, X as Se, Users as ee, Binoculars as Ce, AtSign as ge, ArrowDownUp as $e, Check as De, Pin as Te, Hourglass as _e, ChevronRight as Re, CircleCheck as Le, Undo2 as Me, MoreHorizontal as We, UserCheck as qe, Pencil as Ke, LogOut as Ee, Trash2 as Ae } from "lucide-react";
4
+ import { useEffect as N, useMemo as D, useRef as y, useState as q } from "react";
5
+ import { useOptionalNivaroClient as V } from "../../context.js";
6
+ import { get as W, post as oe } from "../../lib/commands.js";
7
+ import { describeError as Oe } from "../../lib/error-message.js";
8
+ import { useLiveCollection as Z, useLiveEvent as le } from "../../lib/live.js";
9
+ import { usePeekOrOpen as be } from "../../lib/record-peek.js";
10
+ import { desktopPermission as Pe, pageOutOfSight as Ue, keysToNotify as Ie, claimBurst as ze, showDesktop as je, desktopText as Fe } from "../../lib/watch-desktop.js";
11
+ import { useWatchUi as xe, useWatchActions as Qe, useWatchPrefs as He, watchUi as $, withLocalSeen as we, changedKeys as Be, pinsSignature as ce, watchKeys as C, typingTarget as Ye, WATCH_WIDTH_MAX as de, WATCH_WIDTH_MIN as he, sortWatchRows as Ve, withCompleted as ke } from "../../lib/watch-list.js";
12
+ import { ConfirmButton as ue } from "../profile/primitives.js";
13
+ import { Popover as Xe, PopoverTrigger as Ge, PopoverContent as Je } from "../ui/popover.js";
14
+ import { Sheet as Ze, SheetContent as et, SheetTitle as tt, SheetDescription as nt } from "../ui/sheet.js";
15
+ import { Skeleton as me } from "../ui/skeleton.js";
16
+ import { WatchSettingsMenu as at, TeamEditor as rt, AlertButton as st } from "./WatchExtras.js";
17
+ import { WatchRowList as ye, StepChip as it, agoText as ae } from "./WatchRows.js";
18
+ const A = {
19
+ mine: "My order",
20
+ changed: "Last change",
21
+ due: "Due soonest"
22
+ }, ot = /* @__PURE__ */ new Set(["$lock", "$sla"]);
23
+ function lt(t, n, o) {
24
+ var g;
25
+ const i = V(), a = ce(t.pins), r = t.pins.length > 0, l = O({
26
+ queryKey: C.rows(a),
27
+ queryFn: () => i.request(W("/watch-list")).then((f) => f.data),
28
+ enabled: !!i && r && n,
29
+ staleTime: 6e4,
30
+ placeholderData: (f) => f
31
+ }), s = (g = l.data) != null && g.pins ? ce(l.data.pins) : null, p = y("");
32
+ N(() => {
33
+ if (!s || s === a || l.isFetching || l.isPlaceholderData) return;
34
+ const f = `${a}#${l.dataUpdatedAt}`;
35
+ p.current !== f && (p.current = f, l.refetch());
36
+ }, [s, a, l.isFetching, l.isPlaceholderData, l.dataUpdatedAt, l.refetch]);
37
+ const m = O({
38
+ queryKey: C.summary(a),
39
+ queryFn: () => i.request(W("/watch-list", { summary: "1" })).then((f) => f.data),
40
+ enabled: !!i && r && !n,
41
+ staleTime: Number.POSITIVE_INFINITY
42
+ }), b = O({
43
+ queryKey: C.waiting,
44
+ queryFn: () => i.request(W("/watch-list/waiting")).then((f) => f.data.rows),
45
+ enabled: !!i && n,
46
+ staleTime: 3e4
47
+ }), h = O({
48
+ queryKey: C.mentions,
49
+ queryFn: () => i.request(
50
+ W("/watch-list/mentions")
51
+ ).then((f) => f.data),
52
+ enabled: !!i,
53
+ staleTime: 6e4
54
+ });
55
+ return { rows: l, summary: m, waiting: b, mentions: h, tab: o };
56
+ }
57
+ const ve = "nvr-watch-dock-state";
58
+ function ct() {
59
+ try {
60
+ const t = localStorage.getItem(ve);
61
+ return t === "open" || t === "minimized" ? t : "closed";
62
+ } catch {
63
+ return "closed";
64
+ }
65
+ }
66
+ function dt(t) {
67
+ try {
68
+ localStorage.setItem(ve, t);
69
+ } catch {
70
+ }
71
+ }
72
+ function Ot() {
73
+ var se, ie;
74
+ const t = xe(), n = fe(), o = V(), i = Qe(), { prefs: a } = i, { ready: r } = He(), l = a.dock;
75
+ N(() => {
76
+ r && dt(l.state);
77
+ }, [r, l.state]);
78
+ const s = r ? l.state : ct(), p = t.wide ? s : t.sheet ? "sheet" : "hidden", m = p === "open" || p === "sheet", b = lt(a, m, l.tab);
79
+ N(() => ($.setMounted(!0), () => $.setMounted(!1)), []);
80
+ const h = D(() => new Set(a.pins.map((c) => c.key)), [a.pins]), g = D(() => [...new Set(a.pins.map((c) => c.collection))], [a.pins]), f = y(m);
81
+ f.current = m;
82
+ const _ = y(/* @__PURE__ */ new Map()), z = y(a.settings.desktop);
83
+ z.current = a.settings.desktop;
84
+ const R = (c) => {
85
+ !o || !z.current || c.length === 0 || Pe() !== "granted" || !Ue() || o.request(W("/watch-list", { summary: "1" })).then((x) => {
86
+ var T;
87
+ const w = Ie(c, x.data.others ?? {}, _.current, Date.now());
88
+ if (w.length === 0 || !ze(w)) return;
89
+ for (const v of w) _.current.set(v, ((T = x.data.others) == null ? void 0 : T[v]) ?? "");
90
+ const S = {};
91
+ for (const [, v] of n.getQueriesData({ queryKey: ["watch-list", "rows"] }))
92
+ for (const J of (v == null ? void 0 : v.rows) ?? []) J.title && (S[J.key] = J.title);
93
+ je(Fe(w, S), () => {
94
+ $.openSheet(), i.setDock({ state: "open", tab: "watching" });
95
+ });
96
+ }).catch(() => {
97
+ });
98
+ }, j = y(R);
99
+ j.current = R, Z(
100
+ g,
101
+ (c) => {
102
+ const x = /* @__PURE__ */ new Set();
103
+ for (const w of c.events) {
104
+ if (w.item === "*") {
105
+ for (const v of a.pins) v.collection === w.collection && x.add(v.key);
106
+ continue;
107
+ }
108
+ const S = `${w.collection}:${w.item}`;
109
+ if (!h.has(S)) continue;
110
+ const T = w.changed_fields;
111
+ if (T && T.length > 0 && T.every((v) => ot.has(v))) {
112
+ f.current && x.add(`~${S}`);
113
+ continue;
114
+ }
115
+ x.add(S);
116
+ }
117
+ x.size !== 0 && (j.current([...x].filter((w) => !w.startsWith("~"))), f.current ? (n.invalidateQueries({ queryKey: ["watch-list", "rows"] }), n.invalidateQueries({ queryKey: C.waiting })) : $.markLocal([...x].filter((w) => !w.startsWith("~"))));
118
+ },
119
+ {
120
+ debounceMs: 1e3,
121
+ match: (c) => c.item === "*" || h.has(`${c.collection}:${c.item}`)
122
+ }
123
+ );
124
+ const G = D(
125
+ () => [...new Set((b.waiting.data ?? []).map((c) => c.collection))],
126
+ [b.waiting.data]
127
+ ), F = D(
128
+ () => new Set((b.waiting.data ?? []).map((c) => c.key)),
129
+ [b.waiting.data]
130
+ );
131
+ Z(
132
+ m ? G : null,
133
+ () => void n.invalidateQueries({ queryKey: C.waiting }),
134
+ {
135
+ debounceMs: 1500,
136
+ match: (c) => F.has(`${c.collection}:${c.item}`)
137
+ }
138
+ );
139
+ const Q = D(
140
+ () => new Set(a.teams.flatMap((c) => c.pins.map((x) => x.key))),
141
+ [a.teams]
142
+ ), H = D(
143
+ () => [...new Set(a.teams.flatMap((c) => c.pins.map((x) => x.collection)))],
144
+ [a.teams]
145
+ );
146
+ Z(
147
+ m ? H : null,
148
+ () => void n.invalidateQueries({ queryKey: ["watch-list", "team"] }),
149
+ {
150
+ debounceMs: 1e3,
151
+ match: (c) => c.item === "*" || Q.has(`${c.collection}:${c.item}`)
152
+ }
153
+ ), le(
154
+ ["notification:new", "read:changed"],
155
+ () => void n.invalidateQueries({ queryKey: C.mentions }),
156
+ { debounceMs: 1500, includeOwn: !0 }
157
+ ), le(
158
+ "prefs:changed",
159
+ (c) => {
160
+ const x = Array.isArray(c == null ? void 0 : c.keys) ? c.keys : null;
161
+ (!x || x.includes("watch_list")) && n.invalidateQueries({ queryKey: C.prefs });
162
+ },
163
+ { includeOwn: !0, debounceMs: 300 }
164
+ );
165
+ const L = y(/* @__PURE__ */ new Set());
166
+ N(() => {
167
+ if (m)
168
+ for (const c of a.pins) c.done_at && L.current.add(c.key);
169
+ }, [m, a.pins]);
170
+ const d = y(m), k = y(i.markSeen);
171
+ k.current = i.markSeen, N(() => {
172
+ const c = () => {
173
+ const w = [...L.current].filter((S) => a.pins.some((T) => T.key === S));
174
+ L.current.clear(), w.length > 0 && k.current(w);
175
+ };
176
+ d.current && !m && c(), d.current = m;
177
+ const x = () => document.visibilityState === "hidden" && c();
178
+ return document.addEventListener("visibilitychange", x), () => document.removeEventListener("visibilitychange", x);
179
+ }, [m, a.pins]);
180
+ const B = D(
181
+ () => {
182
+ var c;
183
+ return we(((c = b.rows.data) == null ? void 0 : c.rows) ?? [], t.seenLocal);
184
+ },
185
+ [b.rows.data, t.seenLocal]
186
+ ), M = m ? b.rows.data ? B.filter((c) => {
187
+ var x;
188
+ return (x = c.change) == null ? void 0 : x.changed;
189
+ }).map((c) => c.key) : void 0 : (se = b.summary.data) == null ? void 0 : se.changed.filter((c) => !t.seenLocal.has(c));
190
+ N(() => {
191
+ m && b.rows.isSuccess && !b.rows.isFetching && $.clearLocal();
192
+ }, [m, b.rows.isSuccess, b.rows.isFetching]);
193
+ const K = Be(M, m ? /* @__PURE__ */ new Set() : t.localChanged, h), E = ((ie = b.mentions.data) == null ? void 0 : ie.unread) ?? 0;
194
+ N(() => {
195
+ $.publish({ changed: K.length, unreadMentions: E });
196
+ }, [K.length, E]);
197
+ const re = y({ mode: p, setDock: i.setDock });
198
+ return re.current = { mode: p, setDock: i.setDock }, N(() => {
199
+ const c = (x) => {
200
+ if (!x.shiftKey || x.metaKey || x.ctrlKey || x.altKey || x.key.toLowerCase() !== "w" || Ye(x.target)) return;
201
+ x.preventDefault();
202
+ const { mode: w, setDock: S } = re.current;
203
+ w === "sheet" ? $.closeSheet() : w === "hidden" ? $.openSheet() : S({ state: w === "open" ? "closed" : "open" });
204
+ };
205
+ return window.addEventListener("keydown", c), () => window.removeEventListener("keydown", c);
206
+ }, []), o ? p === "sheet" || p === "hidden" ? /* @__PURE__ */ e(Ze, { open: p === "sheet", onOpenChange: (c) => !c && $.closeSheet(), children: /* @__PURE__ */ u(
207
+ et,
208
+ {
209
+ side: "right",
210
+ className: "flex w-full flex-col gap-0 p-0 sm:max-w-[400px]",
211
+ "data-watch-dock": "sheet",
212
+ children: [
213
+ /* @__PURE__ */ e(tt, { className: "sr-only", children: "Watch list" }),
214
+ /* @__PURE__ */ e(nt, { className: "sr-only", children: "Records you pinned, records waiting on others, and mentions of you." }),
215
+ /* @__PURE__ */ e(
216
+ pe,
217
+ {
218
+ actions: i,
219
+ data: b,
220
+ changed: K,
221
+ unreadMentions: E,
222
+ inSheet: !0
223
+ }
224
+ )
225
+ ]
226
+ }
227
+ ) }) : p === "closed" ? null : p === "minimized" ? /* @__PURE__ */ e(
228
+ ht,
229
+ {
230
+ count: a.pins.length,
231
+ changed: K.length,
232
+ mentions: E,
233
+ onOpen: () => i.setDock({ state: "open" })
234
+ }
235
+ ) : /* @__PURE__ */ e(ut, { width: l.width, onWidth: (c) => i.setDock({ width: c }), children: /* @__PURE__ */ e(pe, { actions: i, data: b, changed: K, unreadMentions: E }) }) : null;
236
+ }
237
+ function ht({
238
+ count: t,
239
+ changed: n,
240
+ mentions: o,
241
+ onOpen: i
242
+ }) {
243
+ const a = [
244
+ `${t} pinned`,
245
+ n > 0 ? `${n} changed` : "",
246
+ o > 0 ? `${o} new mention${o === 1 ? "" : "s"}` : ""
247
+ ].filter(Boolean).join(", ");
248
+ return /* @__PURE__ */ e(
249
+ "aside",
250
+ {
251
+ className: "flex w-10 shrink-0 flex-col border-l border-border bg-card",
252
+ "data-watch-dock": "minimized",
253
+ "aria-label": "Watch list",
254
+ children: /* @__PURE__ */ u(
255
+ "button",
256
+ {
257
+ type: "button",
258
+ onClick: i,
259
+ "aria-label": `Show watch list: ${a}`,
260
+ "data-tip": `Watch list · ${a}`,
261
+ className: "group flex flex-1 flex-col items-center gap-2 pt-3 text-slate-500 transition-colors hover:bg-slate-50 hover:text-slate-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-nvr-cyan/60 dark:text-slate-400 dark:hover:bg-white/[0.03] dark:hover:text-slate-100",
262
+ children: [
263
+ /* @__PURE__ */ e(Ce, { className: "h-4 w-4" }),
264
+ /* @__PURE__ */ u(
265
+ "span",
266
+ {
267
+ className: "flex flex-col items-center leading-none",
268
+ "data-tip": `${t} pinned`,
269
+ "data-rail-count": !0,
270
+ children: [
271
+ /* @__PURE__ */ e("span", { className: "text-[12px] font-semibold tabular-nums text-slate-700 dark:text-slate-200", children: t }),
272
+ /* @__PURE__ */ e("span", { className: "mt-0.5 text-[9.5px] font-medium text-slate-500 dark:text-slate-400", children: "pinned" })
273
+ ]
274
+ }
275
+ ),
276
+ n > 0 && /* @__PURE__ */ u(
277
+ "span",
278
+ {
279
+ className: "flex flex-col items-center gap-0.5 leading-none",
280
+ "data-tip": `${n} changed since you looked`,
281
+ "data-rail-changed": !0,
282
+ children: [
283
+ /* @__PURE__ */ u("span", { className: "flex items-center gap-1 rounded-full bg-sky-100 px-1.5 py-0.5 text-[10.5px] font-semibold tabular-nums text-sky-800 dark:bg-nvr-cyan/20 dark:text-nvr-cyan", children: [
284
+ /* @__PURE__ */ e("span", { "aria-hidden": !0, className: "h-1.5 w-1.5 rounded-full bg-nvr-cyan" }),
285
+ n
286
+ ] }),
287
+ /* @__PURE__ */ e("span", { className: "text-[9.5px] font-medium text-slate-500 dark:text-slate-400", children: "new" })
288
+ ]
289
+ }
290
+ ),
291
+ o > 0 && /* @__PURE__ */ u(
292
+ "span",
293
+ {
294
+ className: "flex items-center gap-0.5 text-[10.5px] font-semibold tabular-nums text-slate-600 dark:text-slate-300",
295
+ "data-tip": `${o} new mention${o === 1 ? "" : "s"}`,
296
+ children: [
297
+ /* @__PURE__ */ e(ge, { "aria-hidden": !0, className: "h-3 w-3" }),
298
+ o
299
+ ]
300
+ }
301
+ ),
302
+ /* @__PURE__ */ e(
303
+ "span",
304
+ {
305
+ "aria-hidden": !0,
306
+ className: "mt-2 rotate-180 text-[11px] font-medium text-slate-600 [writing-mode:vertical-rl] group-hover:text-slate-800 dark:text-slate-300 dark:group-hover:text-slate-100",
307
+ children: "Watch list"
308
+ }
309
+ )
310
+ ]
311
+ }
312
+ )
313
+ }
314
+ );
315
+ }
316
+ function ut({
317
+ width: t,
318
+ onWidth: n,
319
+ children: o
320
+ }) {
321
+ const [i, a] = q(null), r = y(null), l = i ?? t, s = (g) => Math.round(Math.min(de, Math.max(he, g))), p = (g) => {
322
+ r.current = { x: g.clientX, w: l }, g.currentTarget.setPointerCapture(g.pointerId);
323
+ }, m = (g) => {
324
+ r.current && a(s(r.current.w + (r.current.x - g.clientX)));
325
+ }, b = () => {
326
+ r.current && (r.current = null, i != null && i !== t && n(i), a(null));
327
+ };
328
+ return /* @__PURE__ */ u(
329
+ "aside",
330
+ {
331
+ className: "relative flex shrink-0 flex-col border-l border-border bg-card",
332
+ style: { width: l },
333
+ "data-watch-dock": "open",
334
+ "aria-label": "Watch list",
335
+ children: [
336
+ /* @__PURE__ */ e(
337
+ "div",
338
+ {
339
+ role: "separator",
340
+ "aria-orientation": "vertical",
341
+ "aria-label": "Resize watch list",
342
+ "aria-valuemin": he,
343
+ "aria-valuemax": de,
344
+ "aria-valuenow": l,
345
+ tabIndex: 0,
346
+ onPointerDown: p,
347
+ onPointerMove: m,
348
+ onPointerUp: b,
349
+ onPointerCancel: b,
350
+ onKeyDown: (g) => {
351
+ g.key !== "ArrowLeft" && g.key !== "ArrowRight" || (g.preventDefault(), n(s(t + (g.key === "ArrowLeft" ? 16 : -16))));
352
+ },
353
+ className: "absolute inset-y-0 -left-1 z-10 w-2 cursor-col-resize touch-none outline-none after:absolute after:inset-y-0 after:left-[3px] after:w-px after:bg-transparent after:transition-colors hover:after:bg-nvr-cyan/50 focus-visible:after:bg-nvr-cyan"
354
+ }
355
+ ),
356
+ o
357
+ ]
358
+ }
359
+ );
360
+ }
361
+ function Y({
362
+ label: t,
363
+ onClick: n,
364
+ children: o,
365
+ pressed: i
366
+ }) {
367
+ return /* @__PURE__ */ e(
368
+ "button",
369
+ {
370
+ type: "button",
371
+ "aria-label": t,
372
+ "aria-pressed": i,
373
+ "data-tip": t,
374
+ onClick: n,
375
+ className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/60 dark:text-slate-500 dark:hover:bg-white/[0.06] dark:hover:text-slate-200",
376
+ children: o
377
+ }
378
+ );
379
+ }
380
+ function mt({ sort: t, onSort: n }) {
381
+ const [o, i] = q(!1), a = y(null);
382
+ return N(() => {
383
+ if (!o) return;
384
+ const r = (s) => {
385
+ var p;
386
+ (p = a.current) != null && p.contains(s.target) || i(!1);
387
+ }, l = (s) => s.key === "Escape" && i(!1);
388
+ return document.addEventListener("pointerdown", r), document.addEventListener("keydown", l), () => {
389
+ document.removeEventListener("pointerdown", r), document.removeEventListener("keydown", l);
390
+ };
391
+ }, [o]), /* @__PURE__ */ u("div", { ref: a, className: "relative", children: [
392
+ /* @__PURE__ */ u(
393
+ "button",
394
+ {
395
+ type: "button",
396
+ "aria-haspopup": "menu",
397
+ "aria-expanded": o,
398
+ "aria-label": `Sort: ${A[t]}`,
399
+ "data-tip": `Sort: ${A[t]}`,
400
+ onClick: () => i((r) => !r),
401
+ className: "flex h-7 items-center gap-1 rounded-md px-1.5 text-[11px] font-medium text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/60 dark:text-slate-400 dark:hover:bg-white/[0.06] dark:hover:text-slate-200",
402
+ children: [
403
+ /* @__PURE__ */ e($e, { className: "h-3.5 w-3.5" }),
404
+ /* @__PURE__ */ e("span", { className: "hidden min-[340px]:inline", children: A[t] })
405
+ ]
406
+ }
407
+ ),
408
+ o && /* @__PURE__ */ e(
409
+ "div",
410
+ {
411
+ role: "menu",
412
+ className: "absolute right-0 top-8 z-20 w-40 rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md",
413
+ children: Object.keys(A).map((r) => /* @__PURE__ */ u(
414
+ "button",
415
+ {
416
+ type: "button",
417
+ role: "menuitemradio",
418
+ "aria-checked": r === t,
419
+ onClick: () => {
420
+ n(r), i(!1);
421
+ },
422
+ className: "flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-[12px] text-slate-700 hover:bg-muted dark:text-slate-200",
423
+ children: [
424
+ /* @__PURE__ */ e(De, { className: `h-3 w-3 ${r === t ? "opacity-100" : "opacity-0"}` }),
425
+ A[r]
426
+ ]
427
+ },
428
+ r
429
+ ))
430
+ }
431
+ )
432
+ ] });
433
+ }
434
+ function pe({
435
+ actions: t,
436
+ data: n,
437
+ changed: o,
438
+ unreadMentions: i,
439
+ inSheet: a = !1
440
+ }) {
441
+ var F, Q, H, L;
442
+ const { prefs: r } = t, l = r.dock.tab.startsWith("team:") ? r.teams.find((d) => `team:${d.id}` === r.dock.tab) ?? null : null, s = r.dock.tab.startsWith("team:") && !l ? "watching" : r.dock.tab, p = r.dock.sort, m = (F = n.waiting.data) == null ? void 0 : F.length, [b, h] = q(null), g = [
443
+ { key: "watching", label: "Watching", count: r.pins.length, dot: o.length > 0 },
444
+ ...r.teams.map((d) => ({
445
+ key: `team:${d.id}`,
446
+ label: d.name,
447
+ count: d.pins.length || null,
448
+ dot: !1,
449
+ team: !0
450
+ })),
451
+ { key: "waiting", label: "Waiting", count: m ?? null, dot: !1 },
452
+ { key: "mentions", label: "Mentions", count: i || null, dot: i > 0 }
453
+ ], f = y(null), [_, z] = q(!1), R = () => {
454
+ const d = f.current;
455
+ d && z(d.scrollWidth - d.scrollLeft - d.clientWidth > 2);
456
+ }, j = g.map((d) => `${d.key}:${d.count ?? ""}`).join("|");
457
+ N(() => {
458
+ R();
459
+ const d = f.current;
460
+ if (!d || typeof ResizeObserver > "u") return;
461
+ const k = new ResizeObserver(R);
462
+ return k.observe(d), () => k.disconnect();
463
+ }, [j]), N(() => {
464
+ var k;
465
+ const d = (k = f.current) == null ? void 0 : k.querySelector(`[data-tab="${CSS.escape(s)}"]`);
466
+ d && typeof d.scrollIntoView == "function" && d.scrollIntoView({ block: "nearest", inline: "nearest" });
467
+ }, [s]);
468
+ const G = (d) => {
469
+ if (d.key !== "ArrowRight" && d.key !== "ArrowLeft") return;
470
+ const k = g.findIndex((M) => M.key === s), B = g[(k + (d.key === "ArrowRight" ? 1 : g.length - 1)) % g.length];
471
+ t.setDock({ tab: B.key }), requestAnimationFrame(
472
+ () => {
473
+ var M;
474
+ return (M = d.currentTarget.querySelector(`[data-tab="${B.key}"]`)) == null ? void 0 : M.focus();
475
+ }
476
+ );
477
+ };
478
+ return /* @__PURE__ */ u("div", { className: "flex min-h-0 flex-1 flex-col", children: [
479
+ /* @__PURE__ */ u("div", { className: `flex h-11 shrink-0 items-center gap-1 pl-4 ${a ? "pr-11" : "pr-2"}`, children: [
480
+ /* @__PURE__ */ e("h2", { className: "flex-1 truncate text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: "Watch list" }),
481
+ s === "watching" && r.pins.length > 1 && /* @__PURE__ */ e(mt, { sort: p, onSort: (d) => t.setDock({ sort: d }) }),
482
+ s === "watching" && r.pins.length > 0 && /* @__PURE__ */ e(
483
+ "span",
484
+ {
485
+ className: o.length > 0 ? "contents" : "invisible",
486
+ "aria-hidden": o.length === 0 || void 0,
487
+ children: /* @__PURE__ */ e(Y, { label: "Mark all as seen", onClick: () => t.markSeen(), children: /* @__PURE__ */ e(ne, { className: "h-3.5 w-3.5" }) })
488
+ }
489
+ ),
490
+ /* @__PURE__ */ e(
491
+ at,
492
+ {
493
+ actions: t,
494
+ onOpenTeam: (d) => {
495
+ h(null), t.setDock({ tab: `team:${d}` });
496
+ },
497
+ onNewTeam: () => h("new")
498
+ }
499
+ ),
500
+ !a && /* @__PURE__ */ u(P, { children: [
501
+ /* @__PURE__ */ e(Y, { label: "Minimize", onClick: () => t.setDock({ state: "minimized" }), children: /* @__PURE__ */ e(Ne, { className: "h-3.5 w-3.5" }) }),
502
+ /* @__PURE__ */ e(
503
+ Y,
504
+ {
505
+ label: "Close (the icon reopens it)",
506
+ onClick: () => t.setDock({ state: "closed" }),
507
+ children: /* @__PURE__ */ e(Se, { className: "h-3.5 w-3.5" })
508
+ }
509
+ )
510
+ ] })
511
+ ] }),
512
+ /* @__PURE__ */ e(
513
+ "div",
514
+ {
515
+ role: "tablist",
516
+ "aria-label": "Watch list views",
517
+ onKeyDown: G,
518
+ ref: f,
519
+ onScroll: R,
520
+ className: `flex shrink-0 overflow-x-auto border-b border-border px-4 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden ${r.teams.length > 0 ? "gap-3" : "gap-4"} ${_ ? "[mask-image:linear-gradient(to_right,#000_calc(100%_-_28px),transparent)]" : ""}`,
521
+ children: g.map((d) => {
522
+ const k = d.key === s;
523
+ return /* @__PURE__ */ u(
524
+ "button",
525
+ {
526
+ type: "button",
527
+ role: "tab",
528
+ "data-tab": d.key,
529
+ "aria-selected": k,
530
+ tabIndex: k ? 0 : -1,
531
+ onClick: () => {
532
+ h(null), t.setDock({ tab: d.key });
533
+ },
534
+ "data-tip": d.team ? `Shared list · ${d.label}` : void 0,
535
+ className: `relative -mb-px flex shrink-0 items-center gap-1.5 border-b-2 pb-2 pt-0.5 text-[12px] font-medium transition-colors rounded-t-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/60 ${k ? "border-nvr-cyan text-slate-900 dark:text-slate-50" : "border-transparent text-slate-500 hover:text-slate-800 dark:text-slate-400 dark:hover:text-slate-200"}`,
536
+ children: [
537
+ d.team && /* @__PURE__ */ e(ee, { "aria-hidden": !0, className: "h-3 w-3 shrink-0 opacity-70" }),
538
+ /* @__PURE__ */ e("span", { className: d.team ? "max-w-[96px] truncate" : void 0, children: d.label }),
539
+ d.count != null && d.count > 0 && /* @__PURE__ */ e(
540
+ "span",
541
+ {
542
+ className: `rounded-full px-1.5 text-[10.5px] font-semibold tabular-nums ${d.dot ? "bg-sky-100 text-sky-800 dark:bg-nvr-cyan/15 dark:text-nvr-cyan" : "bg-slate-100 text-slate-500 dark:bg-white/[0.07] dark:text-slate-400"}`,
543
+ children: d.count
544
+ }
545
+ ),
546
+ d.dot && d.key === "watching" && /* @__PURE__ */ u("span", { className: "sr-only", children: [
547
+ ", ",
548
+ o.length,
549
+ " changed"
550
+ ] })
551
+ ]
552
+ },
553
+ d.key
554
+ );
555
+ })
556
+ }
557
+ ),
558
+ /* @__PURE__ */ e(
559
+ "div",
560
+ {
561
+ className: "min-h-0 flex-1 overflow-y-auto",
562
+ role: "tabpanel",
563
+ "aria-label": l ? l.name : s,
564
+ children: b ? /* @__PURE__ */ e(
565
+ rt,
566
+ {
567
+ actions: t,
568
+ team: b === "new" ? null : b,
569
+ meId: ((Q = r.me) == null ? void 0 : Q.id) ?? null,
570
+ meName: ((H = r.me) == null ? void 0 : H.name) ?? "",
571
+ onClose: () => h(null),
572
+ onCreated: (d) => {
573
+ h(null), t.setDock({ tab: `team:${d}` });
574
+ }
575
+ },
576
+ b === "new" ? "new" : b.id
577
+ ) : /* @__PURE__ */ u(P, { children: [
578
+ s === "watching" && /* @__PURE__ */ e(ft, { actions: t, data: n }),
579
+ l && /* @__PURE__ */ e(
580
+ xt,
581
+ {
582
+ actions: t,
583
+ team: l,
584
+ meId: ((L = r.me) == null ? void 0 : L.id) ?? null,
585
+ onEdit: () => h(l)
586
+ }
587
+ ),
588
+ s === "waiting" && /* @__PURE__ */ e(wt, { data: n }),
589
+ s === "mentions" && /* @__PURE__ */ e(kt, { data: n })
590
+ ] })
591
+ }
592
+ )
593
+ ] });
594
+ }
595
+ function U({ n: t = 4 }) {
596
+ return /* @__PURE__ */ e("div", { className: "space-y-4 px-4 py-3", "aria-busy": !0, children: Array.from({ length: t }, (n, o) => (
597
+ // biome-ignore lint/suspicious/noArrayIndexKey: placeholders
598
+ /* @__PURE__ */ u("div", { className: "space-y-1.5", children: [
599
+ /* @__PURE__ */ e(me, { className: "h-3.5 w-3/4" }),
600
+ /* @__PURE__ */ e(me, { className: "h-3 w-1/2" })
601
+ ] }, o)
602
+ )) });
603
+ }
604
+ function I({
605
+ icon: t,
606
+ title: n,
607
+ children: o
608
+ }) {
609
+ return /* @__PURE__ */ u("div", { className: "flex flex-col items-start gap-2 px-4 py-6", "data-watch-empty": !0, children: [
610
+ /* @__PURE__ */ e("span", { className: "flex h-8 w-8 items-center justify-center rounded-full bg-slate-100 text-slate-500 dark:bg-white/[0.06] dark:text-slate-400", children: t }),
611
+ /* @__PURE__ */ e("p", { className: "text-[12.5px] font-medium text-slate-700 dark:text-slate-200", children: n }),
612
+ o && /* @__PURE__ */ e("div", { className: "text-[12px] leading-relaxed text-slate-500 dark:text-slate-400", children: o })
613
+ ] });
614
+ }
615
+ function X({ error: t, onRetry: n }) {
616
+ const o = Oe(t, "The list could not load");
617
+ return /* @__PURE__ */ u("div", { className: "px-4 py-5", children: [
618
+ /* @__PURE__ */ e("p", { className: "text-[12.5px] font-medium text-slate-700 dark:text-slate-200", children: o.title }),
619
+ o.hint && /* @__PURE__ */ e("p", { className: "mt-1 text-[12px] text-slate-500 dark:text-slate-400", children: o.hint }),
620
+ /* @__PURE__ */ e(
621
+ "button",
622
+ {
623
+ type: "button",
624
+ onClick: n,
625
+ className: "mt-2 rounded-md border border-border px-2.5 py-1 text-[12px] font-medium text-slate-700 hover:bg-muted dark:text-slate-200",
626
+ children: "Try again"
627
+ }
628
+ )
629
+ ] });
630
+ }
631
+ function pt({ children: t }) {
632
+ return /* @__PURE__ */ e("kbd", { className: "rounded border border-slate-200 bg-slate-50 px-1 font-sans text-[10.5px] font-medium text-slate-600 dark:border-white/10 dark:bg-white/[0.06] dark:text-slate-300", children: t });
633
+ }
634
+ function ft({
635
+ actions: t,
636
+ data: n
637
+ }) {
638
+ const { prefs: o } = t, i = n.rows.data, { seenLocal: a } = xe(), r = D(() => {
639
+ const s = new Map(we((i == null ? void 0 : i.rows) ?? [], a).map((m) => [m.key, m])), p = o.pins.map((m) => s.get(m.key)).filter((m) => !!m);
640
+ return Ve(ke(p, o.pins), o.dock.sort);
641
+ }, [i, o.pins, o.dock.sort, a]);
642
+ if (o.pins.length === 0)
643
+ return /* @__PURE__ */ u(P, { children: [
644
+ /* @__PURE__ */ e(I, { icon: /* @__PURE__ */ e(Te, { className: "h-4 w-4" }), title: "Nothing on your watch list yet", children: /* @__PURE__ */ u("p", { children: [
645
+ "Pin a record to follow it here, live, on every page: use the pin beside a record’s title, ",
646
+ /* @__PURE__ */ e("span", { className: "whitespace-nowrap", children: "a list row’s menu," }),
647
+ " or press",
648
+ " ",
649
+ /* @__PURE__ */ e(pt, { children: "W" }),
650
+ " on a record."
651
+ ] }) }),
652
+ /* @__PURE__ */ e(
653
+ te,
654
+ {
655
+ removed: o.removed,
656
+ onUndo: (s) => void t.restoreRemoved(s.collection, s.id).catch(() => {
657
+ })
658
+ }
659
+ )
660
+ ] });
661
+ if (n.rows.isError && !i)
662
+ return /* @__PURE__ */ e(X, { error: n.rows.error, onRetry: () => void n.rows.refetch() });
663
+ if (!i) return /* @__PURE__ */ e(U, { n: Math.min(5, o.pins.length) });
664
+ const l = o.pins.length - r.length;
665
+ return /* @__PURE__ */ u(P, { children: [
666
+ /* @__PURE__ */ e(
667
+ ye,
668
+ {
669
+ rows: r,
670
+ sortable: o.dock.sort === "mine" && r.length > 1,
671
+ onReorder: t.reorder,
672
+ onUnpin: (s) => void t.unpin(s.collection, s.id).catch(() => {
673
+ }),
674
+ onSeen: (s) => {
675
+ var m;
676
+ const p = r.find((b) => b.key === s);
677
+ ((m = p == null ? void 0 : p.change) != null && m.changed || p != null && p.completed_at) && t.markSeen([s]);
678
+ },
679
+ rowActions: (s) => /* @__PURE__ */ e(st, { row: s, actions: t })
680
+ }
681
+ ),
682
+ l > 0 && /* @__PURE__ */ e(U, { n: Math.min(3, l) }),
683
+ /* @__PURE__ */ u("p", { className: "px-4 py-3 text-[11px] text-slate-500 dark:text-slate-400", children: [
684
+ o.pins.length,
685
+ " of ",
686
+ o.max,
687
+ " pinned"
688
+ ] }),
689
+ /* @__PURE__ */ e(
690
+ te,
691
+ {
692
+ removed: o.removed,
693
+ onUndo: (s) => void t.restoreRemoved(s.collection, s.id).catch(() => {
694
+ })
695
+ }
696
+ )
697
+ ] });
698
+ }
699
+ function gt({
700
+ actions: t,
701
+ team: n,
702
+ isOwner: o,
703
+ onEdit: i
704
+ }) {
705
+ const [a, r] = q(!1), l = "flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-[12.5px] text-slate-700 hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/60 dark:text-slate-200", s = n.can_manage || !!n.can_take_over, p = n.is_member && !o;
706
+ return !n.can_manage && !n.can_take_over && !s && !p ? null : /* @__PURE__ */ u(Xe, { open: a, onOpenChange: r, children: [
707
+ /* @__PURE__ */ e(Ge, { asChild: !0, children: /* @__PURE__ */ e(
708
+ "button",
709
+ {
710
+ type: "button",
711
+ "aria-label": `More for ${n.name}`,
712
+ "data-tip": "More",
713
+ "data-watch-team-menu": !0,
714
+ className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/60 dark:text-slate-400 dark:hover:bg-white/[0.06] dark:hover:text-slate-200",
715
+ children: /* @__PURE__ */ e(We, { className: "h-4 w-4" })
716
+ }
717
+ ) }),
718
+ /* @__PURE__ */ u(Je, { align: "end", className: "w-52 p-1", children: [
719
+ n.can_take_over && /* @__PURE__ */ u(
720
+ "button",
721
+ {
722
+ type: "button",
723
+ className: l,
724
+ onClick: () => {
725
+ r(!1), t.takeOverTeam(n.id).then((m) => m && t.setDock({ tab: `team:${m}` })).catch(() => {
726
+ });
727
+ },
728
+ children: [
729
+ /* @__PURE__ */ e(qe, { "aria-hidden": !0, className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
730
+ "Take ownership"
731
+ ]
732
+ }
733
+ ),
734
+ n.can_manage && /* @__PURE__ */ u(
735
+ "button",
736
+ {
737
+ type: "button",
738
+ className: l,
739
+ onClick: () => {
740
+ r(!1), i();
741
+ },
742
+ children: [
743
+ /* @__PURE__ */ e(Ke, { "aria-hidden": !0, className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
744
+ "Rename or change people"
745
+ ]
746
+ }
747
+ ),
748
+ p && /* @__PURE__ */ u(
749
+ ue,
750
+ {
751
+ onConfirm: () => {
752
+ r(!1), t.setDock({ tab: "watching" }), t.leaveTeam(n.id).catch(() => {
753
+ });
754
+ },
755
+ title: "Leave this shared list",
756
+ confirmLabel: "Leave the list?",
757
+ className: l,
758
+ armedClassName: `${l} bg-amber-50 font-semibold text-amber-800 dark:bg-amber-500/15 dark:text-amber-200`,
759
+ children: [
760
+ /* @__PURE__ */ e(Ee, { "aria-hidden": !0, className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
761
+ "Leave"
762
+ ]
763
+ }
764
+ ),
765
+ s && /* @__PURE__ */ u(
766
+ ue,
767
+ {
768
+ onConfirm: () => {
769
+ r(!1), t.setDock({ tab: "watching" }), t.deleteTeam(n.id).catch(() => {
770
+ });
771
+ },
772
+ title: "Delete this shared list",
773
+ confirmLabel: "Delete it for everyone?",
774
+ className: l,
775
+ armedClassName: `${l} bg-red-50 font-semibold text-red-700 dark:bg-red-500/15 dark:text-red-300`,
776
+ children: [
777
+ /* @__PURE__ */ e(Ae, { "aria-hidden": !0, className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
778
+ "Delete"
779
+ ]
780
+ }
781
+ )
782
+ ] })
783
+ ] });
784
+ }
785
+ function bt(t, n) {
786
+ const o = n == null ? void 0 : n.toLowerCase(), i = t.members.map((a) => a.id.toLowerCase() === o ? "you" : a.name);
787
+ return i.sort((a, r) => a === "you" ? -1 : r === "you" ? 1 : 0), i.length === 0 ? "Nobody else is on it yet" : i.length === 1 ? i[0] === "you" ? "Only you" : `${i[0]}` : i.length <= 3 ? `${i.slice(0, -1).join(", ")} and ${i[i.length - 1]}`.replace(/^you/, "You") : `${i.slice(0, 2).join(", ")} and ${i.length - 2} others`.replace(/^you/, "You");
788
+ }
789
+ function xt({
790
+ actions: t,
791
+ team: n,
792
+ meId: o,
793
+ onEdit: i
794
+ }) {
795
+ const a = V(), r = n.pins.map((h) => h.key).join("|"), l = O({
796
+ queryKey: C.team(n.id, r),
797
+ queryFn: () => a.request(W(`/watch-list/teams/${encodeURIComponent(n.id)}/rows`)).then((h) => h.data),
798
+ enabled: !!a && n.pins.length > 0,
799
+ staleTime: 6e4,
800
+ placeholderData: (h) => h
801
+ }), s = !!o && n.owner.id.toLowerCase() === o.toLowerCase(), p = n.is_member || n.can_manage, m = D(() => {
802
+ var g;
803
+ const h = new Map((((g = l.data) == null ? void 0 : g.rows) ?? []).map((f) => [f.key, f]));
804
+ return ke(
805
+ n.pins.map((f) => h.get(f.key)).filter((f) => !!f),
806
+ n.pins
807
+ );
808
+ }, [l.data, n.pins]), b = m.filter((h) => {
809
+ var g;
810
+ return (g = h.change) == null ? void 0 : g.changed;
811
+ }).map((h) => h.key);
812
+ return /* @__PURE__ */ u("div", { "data-watch-team": n.id, children: [
813
+ /* @__PURE__ */ u("div", { className: "flex items-start gap-2 border-b border-slate-100 px-4 py-2.5 dark:border-white/[0.05]", children: [
814
+ /* @__PURE__ */ u("div", { className: "min-w-0 flex-1", children: [
815
+ /* @__PURE__ */ e("p", { className: "truncate text-[11.5px] text-slate-600 dark:text-slate-300", children: bt(n, o) }),
816
+ /* @__PURE__ */ e("p", { className: "truncate text-[11px] text-slate-500 dark:text-slate-400", children: s && !n.owner_gone ? "Your shared list" : `Made by ${n.owner.name}` })
817
+ ] }),
818
+ /* @__PURE__ */ u("div", { className: "flex shrink-0 items-center gap-0.5", children: [
819
+ b.length > 0 && /* @__PURE__ */ e(Y, { label: "Mark all as seen", onClick: () => t.teamSeen(n.id), children: /* @__PURE__ */ e(ne, { className: "h-3.5 w-3.5" }) }),
820
+ /* @__PURE__ */ e(gt, { actions: t, team: n, isOwner: s, onEdit: i })
821
+ ] })
822
+ ] }),
823
+ n.owner_gone && /* @__PURE__ */ u(
824
+ "p",
825
+ {
826
+ className: "mx-4 mt-2.5 rounded-md bg-amber-50 px-2.5 py-2 text-[11.5px] leading-snug text-amber-900 dark:bg-amber-500/10 dark:text-amber-200",
827
+ "data-watch-team-gone": !0,
828
+ children: [
829
+ n.owner.name,
830
+ " can no longer sign in, so this list is read-only.",
831
+ " ",
832
+ n.can_take_over ? "Take it over from the ⋯ menu to keep it going." : "An administrator can take it over."
833
+ ]
834
+ }
835
+ ),
836
+ n.pins.length === 0 ? /* @__PURE__ */ e(I, { icon: /* @__PURE__ */ e(ee, { className: "h-4 w-4" }), title: "No records on this list yet", children: /* @__PURE__ */ e("p", { children: n.owner_gone ? "Records can be added again once the list has a new owner." : "Add a record from its page: the people icon beside the pin puts it on a shared list. Everyone here sees it, each as far as they can open it." }) }) : l.isError && !l.data ? /* @__PURE__ */ e(X, { error: l.error, onRetry: () => void l.refetch() }) : l.data ? m.length === 0 ? /* @__PURE__ */ e(I, { icon: /* @__PURE__ */ e(ee, { className: "h-4 w-4" }), title: "Nothing here you can open", children: /* @__PURE__ */ e("p", { children: "The records on this list are outside what you can see." }) }) : /* @__PURE__ */ e(
837
+ ye,
838
+ {
839
+ rows: m,
840
+ sortable: !1,
841
+ label: `Records on ${n.name}`,
842
+ onReorder: () => {
843
+ },
844
+ unpinLabel: "Take off this list",
845
+ canRemove: p && !n.owner_gone,
846
+ onUnpin: (h) => p && void t.teamUnpin(n.id, h.collection, h.id).catch(() => {
847
+ }),
848
+ onSeen: (h) => {
849
+ var g, f;
850
+ (f = (g = m.find((_) => _.key === h)) == null ? void 0 : g.change) != null && f.changed && t.teamSeen(n.id, [h]);
851
+ }
852
+ }
853
+ ) : /* @__PURE__ */ e(U, { n: Math.min(5, n.pins.length) }),
854
+ /* @__PURE__ */ e(
855
+ te,
856
+ {
857
+ removed: n.removed ?? [],
858
+ canUndo: p && !n.owner_gone,
859
+ onUndo: (h) => void t.restoreRemoved(h.collection, h.id, n.id).catch(() => {
860
+ })
861
+ }
862
+ )
863
+ ] });
864
+ }
865
+ function te({
866
+ removed: t,
867
+ onUndo: n,
868
+ canUndo: o = !0
869
+ }) {
870
+ const [i, a] = q(!1);
871
+ return t.length === 0 ? null : /* @__PURE__ */ u("section", { className: "border-t border-slate-100 dark:border-white/[0.05]", "data-watch-removed": !0, children: [
872
+ /* @__PURE__ */ u(
873
+ "button",
874
+ {
875
+ type: "button",
876
+ "aria-expanded": i,
877
+ onClick: () => a((r) => !r),
878
+ className: "flex w-full items-center gap-1.5 px-4 py-2.5 text-left text-[11.5px] font-medium text-slate-600 transition-colors hover:bg-slate-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-nvr-cyan/60 dark:text-slate-300 dark:hover:bg-white/[0.03]",
879
+ children: [
880
+ /* @__PURE__ */ e(
881
+ Re,
882
+ {
883
+ "aria-hidden": !0,
884
+ className: `h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform motion-reduce:transition-none ${i ? "rotate-90" : ""}`
885
+ }
886
+ ),
887
+ "Recently removed",
888
+ /* @__PURE__ */ e("span", { className: "rounded-full bg-slate-100 px-1.5 text-[10.5px] font-semibold tabular-nums text-slate-500 dark:bg-white/[0.07] dark:text-slate-400", children: t.length }),
889
+ /* @__PURE__ */ e("span", { className: "ml-auto text-[10.5px] font-normal text-slate-500 dark:text-slate-400", children: "kept 7 days" })
890
+ ]
891
+ }
892
+ ),
893
+ i && /* @__PURE__ */ e("ul", { className: "pb-2", "aria-label": "Recently removed", children: t.map((r) => /* @__PURE__ */ u(
894
+ "li",
895
+ {
896
+ className: "flex items-center gap-2 py-1.5 pl-9 pr-3",
897
+ "data-watch-removed-row": !0,
898
+ children: [
899
+ /* @__PURE__ */ u("div", { className: "min-w-0 flex-1", children: [
900
+ /* @__PURE__ */ e("p", { className: "truncate text-[12px] text-slate-700 dark:text-slate-200", children: r.title ?? `${r.collection} ${r.id}` }),
901
+ /* @__PURE__ */ u("p", { className: "flex items-center gap-1 text-[11px] text-slate-500 dark:text-slate-400", children: [
902
+ /* @__PURE__ */ e(
903
+ Le,
904
+ {
905
+ "aria-hidden": !0,
906
+ className: "h-3 w-3 shrink-0 text-emerald-600 dark:text-emerald-400"
907
+ }
908
+ ),
909
+ "Completed · removed ",
910
+ ae(r.removed_at)
911
+ ] })
912
+ ] }),
913
+ o && /* @__PURE__ */ u(
914
+ "button",
915
+ {
916
+ type: "button",
917
+ onClick: () => n(r),
918
+ "aria-label": `Put ${r.title ?? "this record"} back on the list`,
919
+ className: "inline-flex shrink-0 items-center gap-1 rounded-md border border-slate-200 px-2 py-1 text-[11.5px] font-medium text-slate-700 transition-colors hover:bg-slate-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/60 dark:border-white/[0.12] dark:text-slate-200 dark:hover:bg-white/[0.05]",
920
+ children: [
921
+ /* @__PURE__ */ e(Me, { "aria-hidden": !0, className: "h-3 w-3" }),
922
+ "Undo"
923
+ ]
924
+ }
925
+ )
926
+ ]
927
+ },
928
+ r.key
929
+ )) })
930
+ ] });
931
+ }
932
+ function wt({ data: t }) {
933
+ const n = be();
934
+ if (t.waiting.isError && !t.waiting.data)
935
+ return /* @__PURE__ */ e(X, { error: t.waiting.error, onRetry: () => void t.waiting.refetch() });
936
+ if (!t.waiting.data) return /* @__PURE__ */ e(U, {});
937
+ const o = t.waiting.data;
938
+ if (o.length === 0)
939
+ return /* @__PURE__ */ e(I, { icon: /* @__PURE__ */ e(_e, { className: "h-4 w-4" }), title: "Nothing is waiting on others", children: /* @__PURE__ */ e("p", { children: "Records you raised show here while they sit on someone else’s step." }) });
940
+ const i = o.map((a) => ({ collection: a.collection, itemId: a.id, title: a.title }));
941
+ return /* @__PURE__ */ e(
942
+ "ul",
943
+ {
944
+ className: "divide-y divide-slate-100 dark:divide-white/[0.05]",
945
+ "aria-label": "Waiting on others",
946
+ children: o.map((a) => {
947
+ const r = a.waiting_on.length === 0 ? null : a.waiting_on.length <= 2 ? a.waiting_on.map((l) => l.name).join(" and ") : `${a.waiting_on[0].name} and ${a.waiting_on.length - 1} others`;
948
+ return /* @__PURE__ */ e("li", { "data-waiting-row": !0, children: /* @__PURE__ */ u(
949
+ "button",
950
+ {
951
+ type: "button",
952
+ onClick: (l) => n({ collection: a.collection, itemId: a.id, title: a.title }, l, { list: i }),
953
+ className: "block w-full px-4 py-2.5 text-left transition-colors hover:bg-slate-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-nvr-cyan/60 dark:hover:bg-white/[0.03]",
954
+ children: [
955
+ /* @__PURE__ */ e("span", { className: "block truncate text-[12.5px] font-medium text-slate-800 dark:text-slate-100", children: a.title }),
956
+ /* @__PURE__ */ u("span", { className: "mt-1 flex min-w-0 items-center gap-2", children: [
957
+ /* @__PURE__ */ e(it, { state: a.state }),
958
+ /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[11px] text-slate-500 dark:text-slate-400", children: r ? `With ${r}` : "" }),
959
+ a.since && /* @__PURE__ */ e(
960
+ "span",
961
+ {
962
+ className: "shrink-0 text-[10.5px] tabular-nums text-slate-500 dark:text-slate-400",
963
+ "data-tip": `Waiting since ${new Date(a.since).toLocaleString()}`,
964
+ children: ae(a.since)
965
+ }
966
+ )
967
+ ] })
968
+ ]
969
+ }
970
+ ) }, a.key);
971
+ })
972
+ }
973
+ );
974
+ }
975
+ function kt({ data: t }) {
976
+ const n = V(), o = fe(), i = be(), a = t.mentions.data;
977
+ if (t.mentions.isError && !a)
978
+ return /* @__PURE__ */ e(X, { error: t.mentions.error, onRetry: () => void t.mentions.refetch() });
979
+ if (!a) return /* @__PURE__ */ e(U, {});
980
+ if (a.items.length === 0)
981
+ return /* @__PURE__ */ e(I, { icon: /* @__PURE__ */ e(ge, { className: "h-4 w-4" }), title: "No mentions or replies", children: /* @__PURE__ */ e("p", { children: "When someone mentions you, or answers a comment of yours, it shows here for 30 days." }) });
982
+ const r = (s) => {
983
+ if (!n) return;
984
+ const p = s.filter((h) => h.kind === "mention" && h.unread).map((h) => h.notification_id), m = s.some((h) => h.kind === "reply" && h.unread), b = new Set(s.map((h) => h.key));
985
+ o.setQueryData(C.mentions, (h) => {
986
+ if (!h) return h;
987
+ const g = h.items.map((f) => b.has(f.key) ? { ...f, unread: !1 } : f);
988
+ return { items: g, unread: g.filter((f) => f.unread).length };
989
+ }), p.length > 0 && n.request(oe("/notifications/mark-read", { ids: p })).catch(() => {
990
+ }), m && n.request(oe("/watch-list/replies-seen", {})).catch(() => {
991
+ });
992
+ }, l = a.items.filter((s) => s.unread);
993
+ return /* @__PURE__ */ u(P, { children: [
994
+ l.length > 0 && /* @__PURE__ */ e("div", { className: "flex justify-end px-3 pt-2", children: /* @__PURE__ */ u(
995
+ "button",
996
+ {
997
+ type: "button",
998
+ onClick: () => r(l),
999
+ className: "inline-flex items-center gap-1 rounded-md border border-slate-200 px-2 py-1 text-[11.5px] font-medium text-slate-600 transition-colors hover:bg-slate-50 hover:text-slate-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/60 dark:border-white/[0.12] dark:text-slate-300 dark:hover:bg-white/[0.05] dark:hover:text-slate-100",
1000
+ children: [
1001
+ /* @__PURE__ */ e(ne, { "aria-hidden": !0, className: "h-3 w-3" }),
1002
+ "Mark all read"
1003
+ ]
1004
+ }
1005
+ ) }),
1006
+ /* @__PURE__ */ e(
1007
+ "ul",
1008
+ {
1009
+ className: "divide-y divide-slate-100 dark:divide-white/[0.05]",
1010
+ "aria-label": "Mentions and replies",
1011
+ children: a.items.map((s) => {
1012
+ var p;
1013
+ return /* @__PURE__ */ e("li", { "data-mention-row": s.unread ? "unread" : "read", children: /* @__PURE__ */ u(
1014
+ "button",
1015
+ {
1016
+ type: "button",
1017
+ onClick: (m) => {
1018
+ r([s]), s.collection && s.item && i({ collection: s.collection, itemId: s.item, title: s.title }, m);
1019
+ },
1020
+ className: `block w-full px-4 py-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-nvr-cyan/60 ${s.unread ? "bg-sky-50 hover:bg-sky-100/70 dark:bg-nvr-cyan/[0.07] dark:hover:bg-nvr-cyan/[0.1]" : "hover:bg-slate-50 dark:hover:bg-white/[0.03]"}`,
1021
+ children: [
1022
+ /* @__PURE__ */ u("span", { className: "flex items-center gap-1.5 text-[11.5px]", children: [
1023
+ s.unread && /* @__PURE__ */ e("span", { "aria-hidden": !0, className: "h-1.5 w-1.5 shrink-0 rounded-full bg-nvr-cyan" }),
1024
+ /* @__PURE__ */ u("span", { className: "min-w-0 flex-1 truncate text-slate-600 dark:text-slate-300", children: [
1025
+ /* @__PURE__ */ e("span", { className: "font-medium text-slate-800 dark:text-slate-100", children: ((p = s.by) == null ? void 0 : p.name) ?? "Someone" }),
1026
+ " ",
1027
+ s.kind === "mention" ? "mentioned you" : "replied",
1028
+ s.unread && /* @__PURE__ */ e("span", { className: "sr-only", children: " (new)" })
1029
+ ] }),
1030
+ /* @__PURE__ */ e("span", { className: "shrink-0 tabular-nums text-slate-400 dark:text-slate-500", children: ae(s.at) })
1031
+ ] }),
1032
+ s.title && /* @__PURE__ */ e("span", { className: "mt-0.5 block truncate text-[12px] font-medium text-slate-700 dark:text-slate-200", children: s.title }),
1033
+ s.text && /* @__PURE__ */ e("span", { className: "mt-0.5 line-clamp-2 text-[12px] leading-snug text-slate-500 dark:text-slate-400", children: s.text })
1034
+ ]
1035
+ }
1036
+ ) }, s.key);
1037
+ })
1038
+ }
1039
+ )
1040
+ ] });
1041
+ }
1042
+ export {
1043
+ Ot as WatchDock
1044
+ };