@nivaro/react 0.3.139 → 0.3.141

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 (100) hide show
  1. package/dist/components/InlineGridField.js +95 -92
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +39 -2
  5. package/dist/shared/components/AudienceConfirmPanel.js +19 -19
  6. package/dist/shared/components/BroadcastView.js +213 -211
  7. package/dist/shared/components/CollectionBrowserView.js +2702 -2671
  8. package/dist/shared/components/ConfigHistory.js +45 -45
  9. package/dist/shared/components/ConformanceView.js +110 -110
  10. package/dist/shared/components/DataTable.js +51 -51
  11. package/dist/shared/components/FilePreviewLightbox.js +26 -25
  12. package/dist/shared/components/ItemEditForm.js +3475 -3458
  13. package/dist/shared/components/LiveCount.js +27 -23
  14. package/dist/shared/components/LiveTraceView.js +62 -61
  15. package/dist/shared/components/PageRenderer.js +422 -410
  16. package/dist/shared/components/ProfileView.js +199 -199
  17. package/dist/shared/components/QualityRulesView.js +70 -70
  18. package/dist/shared/components/QueryTable.js +131 -130
  19. package/dist/shared/components/RecordGraph.js +98 -98
  20. package/dist/shared/components/RecordReadView.js +287 -288
  21. package/dist/shared/components/ReportView.js +1279 -1259
  22. package/dist/shared/components/RowPresence.js +83 -76
  23. package/dist/shared/components/SlaRulesView.js +73 -74
  24. package/dist/shared/components/UnseenDot.js +183 -22
  25. package/dist/shared/components/WidgetSlot.js +73 -73
  26. package/dist/shared/components/ai/AiChart.js +36 -32
  27. package/dist/shared/components/ai/AiMarkdown.js +136 -129
  28. package/dist/shared/components/ai/TaskDo.js +87 -87
  29. package/dist/shared/components/ai/answer-formats.js +37 -30
  30. package/dist/shared/components/ai/call-log/format.js +17 -16
  31. package/dist/shared/components/bulk/BulkActionButtons.js +66 -66
  32. package/dist/shared/components/bulk/BulkFieldUpdate.js +59 -59
  33. package/dist/shared/components/bulk/BulkSelectionNotices.js +34 -34
  34. package/dist/shared/components/bulk/MessageStakeholders.js +31 -29
  35. package/dist/shared/components/bulk/PushBulkButtons.js +83 -82
  36. package/dist/shared/components/bulk/bulk-field-options.js +10 -10
  37. package/dist/shared/components/cbv/column-totals.js +53 -51
  38. package/dist/shared/components/chat/ChatAnalyticsView.js +87 -87
  39. package/dist/shared/components/collections-directory/CollectionsToolbar.js +18 -18
  40. package/dist/shared/components/command-center/announce.js +7 -6
  41. package/dist/shared/components/command-center/panels/AttentionPanel.js +32 -31
  42. package/dist/shared/components/command-center/panels/FlowPanel.js +29 -28
  43. package/dist/shared/components/command-center/panels/PeoplePanel.js +39 -39
  44. package/dist/shared/components/delegation/DelegationConsoleView.js +27 -27
  45. package/dist/shared/components/delivery-analytics/drill.js +32 -32
  46. package/dist/shared/components/imports/RunDetailSheet.js +1 -1
  47. package/dist/shared/components/integrations/IntegrationObligationsView.js +119 -119
  48. package/dist/shared/components/integrations/console/EventsView.js +35 -35
  49. package/dist/shared/components/integrations/console/FirefightView.js +15 -14
  50. package/dist/shared/components/integrations/console/PartnerDetail.js +78 -78
  51. package/dist/shared/components/integrations/console/ReadyToSendView.js +103 -103
  52. package/dist/shared/components/integrations/console/SignalCard.js +67 -67
  53. package/dist/shared/components/item-edit/CatalogPickerField.js +536 -527
  54. package/dist/shared/components/item-edit/ChangesTray.js +88 -74
  55. package/dist/shared/components/item-edit/FilePickerField.js +123 -123
  56. package/dist/shared/components/item-edit/GroupSection.js +301 -292
  57. package/dist/shared/components/item-edit/HeaderSummaryChip.js +54 -54
  58. package/dist/shared/components/item-edit/InlineGridField.js +45 -36
  59. package/dist/shared/components/item-edit/InlineTableField.js +1390 -1376
  60. package/dist/shared/components/item-edit/NestedRelationEditor.js +106 -99
  61. package/dist/shared/components/item-edit/RecordChatMentionsChip.js +11 -11
  62. package/dist/shared/components/item-edit/RecordRecapChanges.js +116 -74
  63. package/dist/shared/components/item-edit/RecordRecapStrip.js +148 -160
  64. package/dist/shared/components/item-edit/summary-layout-request.js +15 -0
  65. package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +43 -44
  66. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  67. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +226 -157
  68. package/dist/shared/components/layout-editor/settings/WhoSection.js +53 -52
  69. package/dist/shared/components/layout-editor/settings/controls.js +98 -90
  70. package/dist/shared/components/layout-editor/settings/settings-registry.js +8 -0
  71. package/dist/shared/components/monitoring/ApiRequestLog.js +35 -35
  72. package/dist/shared/components/notifications/NotificationCenterView.js +268 -268
  73. package/dist/shared/components/ops-report/format.js +37 -36
  74. package/dist/shared/components/panels/ReferencedByPanel.js +21 -20
  75. package/dist/shared/components/panels/RevisionsPanel.js +306 -305
  76. package/dist/shared/components/pipeline/OwnerMatrixVersionsCard.js +12 -12
  77. package/dist/shared/components/pipeline/PipelineEditorView.js +483 -482
  78. package/dist/shared/components/pipeline/PipelineHealthCards.js +33 -32
  79. package/dist/shared/components/pipeline/TeamsView.js +189 -130
  80. package/dist/shared/components/profile/AgentsPanel.js +6 -6
  81. package/dist/shared/components/profile/DelegationCard.js +13 -12
  82. package/dist/shared/components/profile/PersonActivity.js +48 -48
  83. package/dist/shared/components/profile/PersonExtras.js +107 -107
  84. package/dist/shared/components/profile/PersonWeek.js +9 -9
  85. package/dist/shared/components/queue/QueueBulkBar.js +19 -18
  86. package/dist/shared/components/queue/QueueBulkMove.js +21 -20
  87. package/dist/shared/components/queue/QueueItemSheet.js +136 -131
  88. package/dist/shared/components/queue/QueueWorklist.js +884 -872
  89. package/dist/shared/components/queue/worklist-helpers.js +36 -21
  90. package/dist/shared/components/support/RequestList.js +123 -123
  91. package/dist/shared/components/support/SupportAnalytics.js +29 -29
  92. package/dist/shared/lib/activity-sentence.js +251 -229
  93. package/dist/shared/lib/format-value.js +5 -4
  94. package/dist/shared/lib/layout-resolve.js +64 -48
  95. package/dist/shared/lib/number-format.js +87 -0
  96. package/dist/shared/lib/number-kind.js +133 -0
  97. package/dist/shared/lib/utils.js +24 -20
  98. package/dist/shared/lib/watch-list.js +1 -1
  99. package/dist/shared/lib/widget-value-format.js +26 -12
  100. package/package.json +1 -1
@@ -1,19 +1,19 @@
1
1
  import { jsxs as i, jsx as e, Fragment as de } from "react/jsx-runtime";
2
2
  import { useQueryClient as Te, useQuery as we } from "@tanstack/react-query";
3
- import { Clock as Oe, Download as ze, Loader2 as ve, Upload as Le, X as ke, Plus as nt, File as Ue, FileVideo as rt, FileAudio as at, FileText as Ce, FileSpreadsheet as it, FileCode as ot } from "lucide-react";
3
+ import { Clock as ze, Download as Oe, Loader2 as ve, Upload as Le, X as ye, Plus as nt, File as $e, FileVideo as rt, FileAudio as at, FileText as Ce, FileSpreadsheet as it, FileCode as ot } from "lucide-react";
4
4
  import { useId as Re, useState as w, useRef as K, useEffect as D } from "react";
5
- import { useNivaroClient as $e, useApiFetchConfig as Ke, useGridFlush as Me, useParentDraft as Ae } from "../../context.js";
5
+ import { useNivaroClient as Ue, useApiFetchConfig as Ke, useGridFlush as Ae, useParentDraft as Me } from "../../context.js";
6
6
  import { useFileHealth as Ee } from "../../hooks/useFileHealth.js";
7
- import { get as ye, post as Se, del as Pe } from "../../lib/commands.js";
7
+ import { get as ke, post as Se, del as Pe } from "../../lib/commands.js";
8
8
  import { trackedUpload as Qe } from "../../lib/upload-presence.js";
9
- import { cn as ce, formatDateTime as dt } from "../../lib/utils.js";
10
- import { useFileDownloadStats as Be, FileDownloadCount as Ve } from "./FileDownloadCount.js";
9
+ import { cn as ce, formatFileSize as dt, formatDateTime as ct } from "../../lib/utils.js";
10
+ import { useFileDownloadStats as Ve, FileDownloadCount as Be } from "./FileDownloadCount.js";
11
11
  import { useOnceVisible as De, useFileUsage as He, FileUsageChip as Je } from "./FileUsage.js";
12
12
  import { useFileDownload as Ge } from "./file-download.js";
13
- import { OWN_FILE_CHANGE_MS as ct, RemovedFileRow as Xe, lastWriterName as Ze, noteOwnFileChange as be, useLiveFileList as ut, REMOVED_SHOW_MS as We, REMOVED_FADE_MS as mt } from "./file-live.js";
14
- import { useFileProcessing as Ye, FileProcessingBadge as Ie, FileProcessingTile as ht, chipThumbUrl as qe } from "./file-processing.js";
15
- import { liveRecordWrite as ft } from "./live-record-marks.js";
16
- import { useM2MStaging as pt } from "./M2MStagingContext.js";
13
+ import { OWN_FILE_CHANGE_MS as ut, RemovedFileRow as Xe, lastWriterName as Ze, noteOwnFileChange as be, useLiveFileList as mt, REMOVED_SHOW_MS as We, REMOVED_FADE_MS as ht } from "./file-live.js";
14
+ import { useFileProcessing as Ye, FileProcessingBadge as Ie, FileProcessingTile as ft, chipThumbUrl as qe } from "./file-processing.js";
15
+ import { liveRecordWrite as pt } from "./live-record-marks.js";
16
+ import { useM2MStaging as xt } from "./M2MStagingContext.js";
17
17
  import { RemoteUploadRows as et } from "./RemoteUploads.js";
18
18
  function ue(s) {
19
19
  var x;
@@ -23,10 +23,10 @@ function ue(s) {
23
23
  return h ? new RegExp(`\\.${h}$`, "i").test(n) ? n : `${n}.${h}` : n;
24
24
  }
25
25
  function Ne(s) {
26
- return s ? s < 1024 ? `${s} B` : s < 1024 * 1024 ? `${(s / 1024).toFixed(1)} KB` : `${(s / (1024 * 1024)).toFixed(1)} MB` : null;
26
+ return s ? dt(s) : null;
27
27
  }
28
28
  function tt(s) {
29
- return s ? dt(s) : null;
29
+ return s ? ct(s) : null;
30
30
  }
31
31
  function je(s) {
32
32
  return !!s && s.startsWith("image/");
@@ -36,12 +36,12 @@ function _e(s, n) {
36
36
  const d = (s ?? "").toLowerCase(), h = ((x = (n ?? "").split(".").pop()) == null ? void 0 : x.toUpperCase()) ?? "";
37
37
  return d === "application/pdf" ? "PDF" : d === "text/csv" ? "CSV" : d.includes("spreadsheet") || d.includes("excel") ? "Spreadsheet" : d.includes("wordprocessing") || d.includes("msword") ? "Word document" : d.includes("presentation") || d.includes("powerpoint") ? "Presentation" : d.startsWith("image/") ? `Image${h && (n != null && n.includes(".")) ? ` (${h})` : ""}` : d.startsWith("video/") ? "Video" : d.startsWith("audio/") ? "Audio" : d.includes("zip") || d.includes("compressed") ? "ZIP archive" : d === "text/plain" ? "Text" : d.includes("json") ? "JSON" : d.includes("xml") ? "XML" : h && h.length <= 5 && (n != null && n.includes(".")) ? h : "File";
38
38
  }
39
- function xt(s) {
39
+ function gt(s) {
40
40
  const n = (s ?? "").toLowerCase();
41
41
  return n === "application/pdf" ? "bg-red-50 text-red-600 dark:bg-red-500/15 dark:text-red-300" : n.includes("spreadsheet") || n.includes("excel") || n === "text/csv" ? "bg-emerald-50 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300" : n.includes("wordprocessing") || n.includes("msword") ? "bg-sky-50 text-sky-700 dark:bg-sky-500/15 dark:text-sky-300" : "bg-slate-100 text-slate-500 dark:bg-muted dark:text-slate-300";
42
42
  }
43
- function gt(s, n) {
44
- return s ? s.startsWith("video/") ? /* @__PURE__ */ e(rt, { className: n, strokeWidth: 1.5 }) : s.startsWith("audio/") ? /* @__PURE__ */ e(at, { className: n, strokeWidth: 1.5 }) : s === "application/pdf" ? /* @__PURE__ */ e(Ce, { className: n, strokeWidth: 1.5 }) : s.startsWith("text/") ? /* @__PURE__ */ e(Ce, { className: n, strokeWidth: 1.5 }) : s.includes("spreadsheet") || s.includes("excel") || s === "text/csv" ? /* @__PURE__ */ e(it, { className: n, strokeWidth: 1.5 }) : s.includes("wordprocessing") || s.includes("msword") ? /* @__PURE__ */ e(Ce, { className: n, strokeWidth: 1.5 }) : s.includes("json") || s.includes("javascript") || s.includes("typescript") || s.includes("xml") ? /* @__PURE__ */ e(ot, { className: n, strokeWidth: 1.5 }) : /* @__PURE__ */ e(Ue, { className: n, strokeWidth: 1.5 }) : /* @__PURE__ */ e(Ue, { className: n, strokeWidth: 1.5 });
43
+ function bt(s, n) {
44
+ return s ? s.startsWith("video/") ? /* @__PURE__ */ e(rt, { className: n, strokeWidth: 1.5 }) : s.startsWith("audio/") ? /* @__PURE__ */ e(at, { className: n, strokeWidth: 1.5 }) : s === "application/pdf" ? /* @__PURE__ */ e(Ce, { className: n, strokeWidth: 1.5 }) : s.startsWith("text/") ? /* @__PURE__ */ e(Ce, { className: n, strokeWidth: 1.5 }) : s.includes("spreadsheet") || s.includes("excel") || s === "text/csv" ? /* @__PURE__ */ e(it, { className: n, strokeWidth: 1.5 }) : s.includes("wordprocessing") || s.includes("msword") ? /* @__PURE__ */ e(Ce, { className: n, strokeWidth: 1.5 }) : s.includes("json") || s.includes("javascript") || s.includes("typescript") || s.includes("xml") ? /* @__PURE__ */ e(ot, { className: n, strokeWidth: 1.5 }) : /* @__PURE__ */ e($e, { className: n, strokeWidth: 1.5 }) : /* @__PURE__ */ e($e, { className: n, strokeWidth: 1.5 });
45
45
  }
46
46
  function me({
47
47
  url: s,
@@ -53,9 +53,9 @@ function me({
53
53
  const P = h === "sm" ? "h-10 w-10" : h === "lg" ? "h-20 w-20" : "h-14 w-14", [g, W] = w(!1), [N, p] = w(!1), [u, f] = w(0), q = K(x);
54
54
  if (D(() => {
55
55
  q.current && !x && (W(!1), p(!1), f(Date.now())), q.current = x;
56
- }, [x]), je(n) && x) return /* @__PURE__ */ e(ht, { className: P });
56
+ }, [x]), je(n) && x) return /* @__PURE__ */ e(ft, { className: P });
57
57
  if (je(n) && !N) {
58
- const z = () => {
58
+ const O = () => {
59
59
  if (!g && qe(s) !== s) {
60
60
  W(!0);
61
61
  return;
@@ -70,9 +70,9 @@ function me({
70
70
  "data-file-thumb": !0,
71
71
  className: ce(P, "object-cover rounded shrink-0"),
72
72
  loading: "lazy",
73
- onError: z,
73
+ onError: O,
74
74
  onLoad: (j) => {
75
- j.currentTarget.naturalWidth === 0 && z();
75
+ j.currentTarget.naturalWidth === 0 && O();
76
76
  }
77
77
  }
78
78
  );
@@ -80,8 +80,8 @@ function me({
80
80
  return /* @__PURE__ */ e(
81
81
  "div",
82
82
  {
83
- className: ce(P, "flex items-center justify-center rounded shrink-0", xt(n)),
84
- children: gt(n, h === "sm" ? "h-4 w-4" : "h-6 w-6")
83
+ className: ce(P, "flex items-center justify-center rounded shrink-0", gt(n)),
84
+ children: bt(n, h === "sm" ? "h-4 w-4" : "h-6 w-6")
85
85
  }
86
86
  );
87
87
  }
@@ -92,10 +92,10 @@ function lt({
92
92
  onClose: h,
93
93
  getUrl: x
94
94
  }) {
95
- const P = $e(), [g, W] = w(""), { data: N = [], isLoading: p } = we({
95
+ const P = Ue(), [g, W] = w(""), { data: N = [], isLoading: p } = we({
96
96
  queryKey: ["file-browser", g],
97
97
  queryFn: () => P.request(
98
- ye("/files", {
98
+ ke("/files", {
99
99
  limit: "60",
100
100
  sort: "-uploaded_on",
101
101
  fields: "id,filename_download,title,type,filesize,width,height,missing_at",
@@ -117,7 +117,7 @@ function lt({
117
117
  "aria-label": "Close",
118
118
  onClick: h,
119
119
  className: "text-slate-400 hover:text-slate-600",
120
- children: /* @__PURE__ */ e(ke, { className: "h-3.5 w-3.5" })
120
+ children: /* @__PURE__ */ e(ye, { className: "h-3.5 w-3.5" })
121
121
  }
122
122
  )
123
123
  ] }),
@@ -192,7 +192,7 @@ function lt({
192
192
  ] })
193
193
  ] });
194
194
  }
195
- function jt({
195
+ function Tt({
196
196
  field: s,
197
197
  value: n,
198
198
  onChange: d,
@@ -203,15 +203,15 @@ function jt({
203
203
  showDownloads: W = !0
204
204
  }) {
205
205
  var ge, ie, oe;
206
- const N = $e(), p = Ke(), u = Te(), f = Me(), q = Re(), [z, v] = w(!1), [j, te] = w(!1), [M, Y] = w(null), [b, H] = w(null), [le, U] = w(null), C = K(null), a = !b && n ? String(n) : null, L = (m) => N.fileUrl(m), I = Ge(), o = Ae(), R = ((ge = o == null ? void 0 : o.draft) == null ? void 0 : ge.id) != null ? String(o.draft.id) : null, A = Ye(a ? [a] : [], {
206
+ const N = Ue(), p = Ke(), u = Te(), f = Ae(), q = Re(), [O, v] = w(!1), [j, te] = w(!1), [A, Y] = w(null), [b, H] = w(null), [le, $] = w(null), C = K(null), a = !b && n ? String(n) : null, L = (m) => N.fileUrl(m), I = Ge(), o = Me(), R = ((ge = o == null ? void 0 : o.draft) == null ? void 0 : ge.id) != null ? String(o.draft.id) : null, M = Ye(a ? [a] : [], {
207
207
  collection: o == null ? void 0 : o.collection,
208
208
  itemId: R
209
- }), [he, T] = De(!!a), O = He(
209
+ }), [he, T] = De(!!a), z = He(
210
210
  o == null ? void 0 : o.collection,
211
211
  R,
212
212
  a ? [a] : [],
213
213
  T && g
214
- ), se = Be(
214
+ ), se = Ve(
215
215
  o == null ? void 0 : o.collection,
216
216
  R,
217
217
  a ? [a] : [],
@@ -219,11 +219,11 @@ function jt({
219
219
  );
220
220
  D(() => {
221
221
  if (!b) {
222
- U(null);
222
+ $(null);
223
223
  return;
224
224
  }
225
225
  const m = URL.createObjectURL(b);
226
- return U(m), () => URL.revokeObjectURL(m);
226
+ return $(m), () => URL.revokeObjectURL(m);
227
227
  }, [b]), D(() => {
228
228
  if (!(!f || !b))
229
229
  return f.register(q, async () => {
@@ -231,24 +231,24 @@ function jt({
231
231
  d(m.id), H(null), u.invalidateQueries({ queryKey: ["file-browser"] });
232
232
  }), () => f.unregister(q);
233
233
  }, [f, b, q, N, d, u]);
234
- const k = Ee([a]), { data: r, isLoading: ne } = we({
234
+ const y = Ee([a]), { data: r, isLoading: ne } = we({
235
235
  queryKey: ["file-meta", a],
236
- queryFn: () => N.request(ye(`/files/${a}/meta`)).then((m) => m.data ?? null),
236
+ queryFn: () => N.request(ke(`/files/${a}/meta`)).then((m) => m.data ?? null),
237
237
  enabled: !!a,
238
238
  staleTime: 6e4
239
- }), E = K(0), fe = K(a), re = K(null), [$, y] = w(!1), [J, Q] = w(null), B = K([]);
239
+ }), E = K(0), fe = K(a), re = K(null), [U, k] = w(!1), [J, Q] = w(null), V = K([]);
240
240
  r && (re.current = ue(r) || re.current), D(() => {
241
241
  const m = fe.current;
242
242
  if (fe.current = a, m === a || b) return;
243
- const S = Date.now() - E.current < ct, G = o == null ? void 0 : o.collection;
244
- if (S || !G || !R || !ft(G, R)) return;
245
- const X = (t, l) => B.current.push(setTimeout(t, l));
246
- a ? (Q(null), y(!0), X(() => y(!1), 2e3)) : m && (Q({ name: re.current ?? "A file", leaving: !1 }), X(
243
+ const S = Date.now() - E.current < ut, G = o == null ? void 0 : o.collection;
244
+ if (S || !G || !R || !pt(G, R)) return;
245
+ const X = (t, l) => V.current.push(setTimeout(t, l));
246
+ a ? (Q(null), k(!0), X(() => k(!1), 2e3)) : m && (Q({ name: re.current ?? "A file", leaving: !1 }), X(
247
247
  () => Q((t) => t && { ...t, leaving: !0 }),
248
- We - mt
248
+ We - ht
249
249
  ), X(() => Q(null), We));
250
250
  }, [a]), D(() => {
251
- const m = B.current;
251
+ const m = V.current;
252
252
  return () => {
253
253
  for (const S of m) clearTimeout(S);
254
254
  };
@@ -299,10 +299,10 @@ function jt({
299
299
  "div",
300
300
  {
301
301
  ref: he,
302
- "data-file-fresh": $ ? "" : void 0,
302
+ "data-file-fresh": U ? "" : void 0,
303
303
  className: ce(
304
304
  "flex items-center gap-2 rounded-lg border border-slate-200 p-2 bg-slate-50 dark:border-border dark:bg-white/[0.03]",
305
- $ && "nvr-row-enter"
305
+ U && "nvr-row-enter"
306
306
  ),
307
307
  children: [
308
308
  _ ? /* @__PURE__ */ e(
@@ -330,7 +330,7 @@ function jt({
330
330
  type: (r == null ? void 0 : r.type) ?? null,
331
331
  filename: (r == null ? void 0 : r.filename_download) ?? "",
332
332
  size: "sm",
333
- processing: !!a && A.isProcessing(a)
333
+ processing: !!a && M.isProcessing(a)
334
334
  }
335
335
  )
336
336
  }
@@ -338,7 +338,7 @@ function jt({
338
338
  ),
339
339
  /* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
340
340
  /* @__PURE__ */ i("div", { className: "flex min-w-0 items-center gap-1.5", children: [
341
- _ && /* @__PURE__ */ e(Oe, { className: "h-3 w-3 text-amber-400 shrink-0" }),
341
+ _ && /* @__PURE__ */ e(ze, { className: "h-3 w-3 text-amber-400 shrink-0" }),
342
342
  /* @__PURE__ */ e(
343
343
  "p",
344
344
  {
@@ -350,8 +350,8 @@ function jt({
350
350
  )
351
351
  }
352
352
  ),
353
- !_ && !!a && A.isProcessing(a) && /* @__PURE__ */ e(Ie, {}),
354
- !_ && (k.verdict(a) ?? !!(r != null && r.missing_at)) && /* @__PURE__ */ e(
353
+ !_ && !!a && M.isProcessing(a) && /* @__PURE__ */ e(Ie, {}),
354
+ !_ && (y.verdict(a) ?? !!(r != null && r.missing_at)) && /* @__PURE__ */ e(
355
355
  "span",
356
356
  {
357
357
  className: "shrink-0 rounded bg-red-500/10 px-1.5 py-0.5 text-[9.5px] font-semibold uppercase tracking-wide text-red-600 dark:text-red-400",
@@ -378,13 +378,13 @@ function jt({
378
378
  Je,
379
379
  {
380
380
  fileId: a,
381
- uses: (ie = O.data) == null ? void 0 : ie[a],
382
- loading: O.isLoading,
381
+ uses: (ie = z.data) == null ? void 0 : ie[a],
382
+ loading: z.isLoading,
383
383
  collection: o == null ? void 0 : o.collection,
384
384
  itemId: R
385
385
  }
386
386
  ),
387
- W && !_ && a && /* @__PURE__ */ e(Ve, { fileId: a, stat: (oe = se.data) == null ? void 0 : oe[a] }),
387
+ W && !_ && a && /* @__PURE__ */ e(Be, { fileId: a, stat: (oe = se.data) == null ? void 0 : oe[a] }),
388
388
  !_ && a && /* @__PURE__ */ e(
389
389
  "a",
390
390
  {
@@ -392,7 +392,7 @@ function jt({
392
392
  onClick: I(`${L(a)}?download=1`, r == null ? void 0 : r.filename_download),
393
393
  title: "Download",
394
394
  className: "shrink-0 text-slate-400 hover:text-nvr-cyan p-0.5",
395
- children: /* @__PURE__ */ e(ze, { className: "h-3.5 w-3.5" })
395
+ children: /* @__PURE__ */ e(Oe, { className: "h-3.5 w-3.5" })
396
396
  }
397
397
  ),
398
398
  !h && /* @__PURE__ */ i("div", { className: "flex items-center gap-1 shrink-0", children: [
@@ -418,7 +418,7 @@ function jt({
418
418
  className: "h-6 px-2 rounded border border-slate-200 text-[11px] text-slate-600 hover:border-slate-400 disabled:opacity-40 flex items-center gap-1",
419
419
  children: [
420
420
  j ? /* @__PURE__ */ e(ve, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ e(Le, { className: "h-3 w-3" }),
421
- /* @__PURE__ */ e("span", { className: "tabular-nums", children: j && M != null ? `${M}%` : "Upload" })
421
+ /* @__PURE__ */ e("span", { className: "tabular-nums", children: j && A != null ? `${A}%` : "Upload" })
422
422
  ]
423
423
  }
424
424
  ),
@@ -431,7 +431,7 @@ function jt({
431
431
  "aria-label": "Remove file",
432
432
  onClick: pe,
433
433
  className: "text-slate-300 hover:text-red-400 p-0.5",
434
- children: /* @__PURE__ */ e(ke, { className: "h-3.5 w-3.5" })
434
+ children: /* @__PURE__ */ e(ye, { className: "h-3.5 w-3.5" })
435
435
  }
436
436
  )
437
437
  ] })
@@ -462,7 +462,7 @@ function jt({
462
462
  className: "flex h-9 items-center gap-1.5 rounded-md border border-dashed border-slate-300 px-3 text-[12px] text-slate-400 hover:border-slate-400 hover:text-slate-600 dark:border-border dark:text-slate-400 dark:hover:border-slate-500 dark:hover:text-slate-200 disabled:opacity-40 transition-colors",
463
463
  children: [
464
464
  j ? /* @__PURE__ */ e(ve, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(Le, { className: "h-3.5 w-3.5" }),
465
- /* @__PURE__ */ e("span", { className: "tabular-nums", children: j && M != null ? `${M}%` : "Upload" })
465
+ /* @__PURE__ */ e("span", { className: "tabular-nums", children: j && A != null ? `${A}%` : "Upload" })
466
466
  ]
467
467
  }
468
468
  ),
@@ -470,7 +470,7 @@ function jt({
470
470
  ] })
471
471
  ] }),
472
472
  /* @__PURE__ */ e(et, { collection: o == null ? void 0 : o.collection, item: R, field: s }),
473
- z && /* @__PURE__ */ e(
473
+ O && /* @__PURE__ */ e(
474
474
  "div",
475
475
  {
476
476
  className: "absolute z-50 mt-1 rounded-lg border border-slate-200 bg-white shadow-lg dark:border-border dark:bg-card",
@@ -489,7 +489,7 @@ function jt({
489
489
  )
490
490
  ] });
491
491
  }
492
- function Tt({
492
+ function zt({
493
493
  relation: s,
494
494
  parentId: n,
495
495
  allRelations: d,
@@ -500,12 +500,12 @@ function Tt({
500
500
  showUsage: W = !0,
501
501
  showDownloads: N = !0
502
502
  }) {
503
- const p = $e(), u = Te(), f = Me(), q = Re(), z = Re(), v = pt(), [j, te] = w(!1), [M, Y] = w(!1), b = Ke(), [H, le] = w(null), [U, C] = w([]), a = K(null), [L, I] = w([]), [o, R] = w(/* @__PURE__ */ new Set()), A = K(/* @__PURE__ */ new Map()), he = K(/* @__PURE__ */ new Map()), T = s.junction_field ?? "", O = s.many_field ?? "", se = s.one_field ?? `${s.many_collection}.${T}`, k = n === "new", r = (t) => p.fileUrl(t), ne = Ge();
503
+ const p = Ue(), u = Te(), f = Ae(), q = Re(), O = Re(), v = xt(), [j, te] = w(!1), [A, Y] = w(!1), b = Ke(), [H, le] = w(null), [$, C] = w([]), a = K(null), [L, I] = w([]), [o, R] = w(/* @__PURE__ */ new Set()), M = K(/* @__PURE__ */ new Map()), he = K(/* @__PURE__ */ new Map()), T = s.junction_field ?? "", z = s.many_field ?? "", se = s.one_field ?? `${s.many_collection}.${T}`, y = n === "new", r = (t) => p.fileUrl(t), ne = Ge();
504
504
  D(() => () => {
505
505
  C((t) => (t.forEach((l) => URL.revokeObjectURL(l.url)), []));
506
506
  }, []), D(() => {
507
- if (!f || !U.length || g) return;
508
- const t = U;
507
+ if (!f || !$.length || g) return;
508
+ const t = $;
509
509
  return f.register(q, async () => {
510
510
  for (const l of t) {
511
511
  const c = await p.upload(l.file);
@@ -513,80 +513,80 @@ function Tt({
513
513
  }
514
514
  C([]), u.invalidateQueries({ queryKey: ["file-browser"] });
515
515
  }), () => f.unregister(q);
516
- }, [f, U, q, g]), D(() => {
516
+ }, [f, $, q, g]), D(() => {
517
517
  if (!f || !g) return;
518
- if (!(L.length > 0 || o.size > 0 || U.length > 0)) {
519
- f.unregister(z);
518
+ if (!(L.length > 0 || o.size > 0 || $.length > 0)) {
519
+ f.unregister(O);
520
520
  return;
521
521
  }
522
- const l = L, c = new Set(o), F = U;
523
- return f.register(z, async () => {
522
+ const l = L, c = new Set(o), F = $;
523
+ return f.register(O, async () => {
524
524
  const Z = [];
525
- for (const V of F) {
526
- const ee = await p.upload(V.file);
527
- URL.revokeObjectURL(V.url), Z.push(ee.id);
525
+ for (const B of F) {
526
+ const ee = await p.upload(B.file);
527
+ URL.revokeObjectURL(B.url), Z.push(ee.id);
528
528
  }
529
- for (const V of [...l, ...Z])
530
- be(A, V), await p.request(
529
+ for (const B of [...l, ...Z])
530
+ be(M, B), await p.request(
531
531
  Se(`/items/${s.many_collection}`, {
532
- [O]: n,
533
- [T]: V
532
+ [z]: n,
533
+ [T]: B
534
534
  })
535
535
  );
536
- for (const V of c) {
537
- be(A, V);
538
- const ee = E.find((st) => String(st[T]) === V);
536
+ for (const B of c) {
537
+ be(M, B);
538
+ const ee = E.find((st) => String(st[T]) === B);
539
539
  ee != null && ee.id && await p.request(Pe(`/items/${s.many_collection}/${ee.id}`));
540
540
  }
541
541
  I([]), R(/* @__PURE__ */ new Set()), C([]), u.invalidateQueries({
542
- queryKey: ["m2m-items", s.many_collection, O, n]
542
+ queryKey: ["m2m-items", s.many_collection, z, n]
543
543
  }), u.invalidateQueries({ queryKey: ["file-browser"] });
544
- }), () => f.unregister(z);
545
- }, [f, g, L, o, U, z]);
544
+ }), () => f.unregister(O);
545
+ }, [f, g, L, o, $, O]);
546
546
  const { data: E = [], isFetched: fe } = we({
547
- queryKey: ["m2m-items", s.many_collection, O, n],
547
+ queryKey: ["m2m-items", s.many_collection, z, n],
548
548
  queryFn: () => p.request(
549
- ye(`/items/${s.many_collection}`, {
550
- filter: JSON.stringify({ [O]: { _eq: n } }),
549
+ ke(`/items/${s.many_collection}`, {
550
+ filter: JSON.stringify({ [z]: { _eq: n } }),
551
551
  limit: "200",
552
552
  fields: `id,${T}`
553
553
  })
554
554
  ).then((t) => t.data ?? []),
555
- enabled: !!n && !k,
555
+ enabled: !!n && !y,
556
556
  staleTime: 3e4
557
- }), re = k && v ? v.getStagedLinks(se) : [], $ = E.map((t) => String(t[T])), y = k ? re : g ? [...$.filter((t) => !o.has(t)), ...L] : $, J = ut(k || !fe ? null : $, A), Q = Ae(), B = (Q == null ? void 0 : Q.collection) ?? s.one_collection ?? null, ae = Ye(k ? [] : $, {
558
- collection: B,
559
- itemId: k ? null : n
560
- }), [Fe, pe] = De($.length > 0), _ = He(
561
- B,
562
- k ? null : n,
563
- $,
557
+ }), re = y && v ? v.getStagedLinks(se) : [], U = E.map((t) => String(t[T])), k = y ? re : g ? [...U.filter((t) => !o.has(t)), ...L] : U, J = mt(y || !fe ? null : U, M), Q = Me(), V = (Q == null ? void 0 : Q.collection) ?? s.one_collection ?? null, ae = Ye(y ? [] : U, {
558
+ collection: V,
559
+ itemId: y ? null : n
560
+ }), [Fe, pe] = De(U.length > 0), _ = He(
561
+ V,
562
+ y ? null : n,
563
+ U,
564
564
  pe && W
565
- ), xe = Be(
566
- B,
567
- k ? null : n,
568
- $,
565
+ ), xe = Ve(
566
+ V,
567
+ y ? null : n,
568
+ U,
569
569
  pe && N
570
- ), ge = Ee(y), { data: ie = {} } = we({
571
- queryKey: ["files-meta", ...y.sort()],
570
+ ), ge = Ee(k), { data: ie = {} } = we({
571
+ queryKey: ["files-meta", ...k.sort()],
572
572
  queryFn: async () => {
573
- if (!y.length) return {};
573
+ if (!k.length) return {};
574
574
  const t = await p.request(
575
- ye("/files", {
576
- filter: JSON.stringify({ id: { _in: y } }),
577
- limit: String(y.length),
575
+ ke("/files", {
576
+ filter: JSON.stringify({ id: { _in: k } }),
577
+ limit: String(k.length),
578
578
  fields: "id,filename_download,title,type,filesize,uploaded_on,uploaded_by_name,missing_at"
579
579
  })
580
580
  ).then((c) => c.data ?? []), l = {};
581
581
  for (const c of t) l[String(c.id).toLowerCase()] = c;
582
582
  return l;
583
583
  },
584
- enabled: y.length > 0,
584
+ enabled: k.length > 0,
585
585
  staleTime: 6e4,
586
586
  // A file linked a moment ago may not read yet: ask again a few times, not for a minute.
587
587
  refetchInterval: (t) => {
588
588
  const l = t.state.data;
589
- return !l || t.state.dataUpdateCount > 8 ? !1 : y.some((c) => !l[c.toLowerCase()]) ? 2e3 : !1;
589
+ return !l || t.state.dataUpdateCount > 8 ? !1 : k.some((c) => !l[c.toLowerCase()]) ? 2e3 : !1;
590
590
  },
591
591
  // A changed id list keeps the names already known on screen while the new read runs.
592
592
  placeholderData: (t) => t
@@ -596,10 +596,10 @@ function Tt({
596
596
  c && he.current.set(t.toLowerCase(), c);
597
597
  }
598
598
  const oe = J.removed.filter(
599
- (t) => !y.some((l) => l.toLowerCase() === t.toLowerCase())
599
+ (t) => !k.some((l) => l.toLowerCase() === t.toLowerCase())
600
600
  );
601
601
  async function m(t) {
602
- if (be(A, t), k && v) {
602
+ if (be(M, t), y && v) {
603
603
  v.unstageLink(se, t);
604
604
  return;
605
605
  }
@@ -608,11 +608,11 @@ function Tt({
608
608
  return;
609
609
  }
610
610
  const l = E.find((c) => String(c[T]) === t);
611
- l != null && l.id && (await p.request(Pe(`/items/${s.many_collection}/${l.id}`)), u.invalidateQueries({ queryKey: ["m2m-items", s.many_collection, O, n] }));
611
+ l != null && l.id && (await p.request(Pe(`/items/${s.many_collection}/${l.id}`)), u.invalidateQueries({ queryKey: ["m2m-items", s.many_collection, z, n] }));
612
612
  }
613
613
  async function S(t) {
614
- if (!y.includes(t)) {
615
- if (be(A, t), k && v) {
614
+ if (!k.includes(t)) {
615
+ if (be(M, t), y && v) {
616
616
  v.stageLink(se, t);
617
617
  return;
618
618
  }
@@ -621,8 +621,8 @@ function Tt({
621
621
  return;
622
622
  }
623
623
  await p.request(
624
- Se(`/items/${s.many_collection}`, { [O]: n, [T]: t })
625
- ), u.invalidateQueries({ queryKey: ["m2m-items", s.many_collection, O, n] });
624
+ Se(`/items/${s.many_collection}`, { [z]: n, [T]: t })
625
+ ), u.invalidateQueries({ queryKey: ["m2m-items", s.many_collection, z, n] });
626
626
  }
627
627
  }
628
628
  function G(t) {
@@ -644,7 +644,7 @@ function Tt({
644
644
  fallback: (Z) => p.upload(Z),
645
645
  field: s.one_field ?? void 0,
646
646
  collection: s.one_collection ?? void 0,
647
- item: k ? void 0 : String(n),
647
+ item: y ? void 0 : String(n),
648
648
  onProgress: le
649
649
  });
650
650
  await S(F.id);
@@ -661,12 +661,12 @@ function Tt({
661
661
  et,
662
662
  {
663
663
  collection: s.one_collection,
664
- item: k ? null : String(n),
664
+ item: y ? null : String(n),
665
665
  field: s.one_field
666
666
  }
667
667
  ),
668
- (y.length > 0 || U.length > 0 || oe.length > 0) && /* @__PURE__ */ i("div", { ref: Fe, className: "flex flex-col gap-1.5", children: [
669
- y.map((t) => {
668
+ (k.length > 0 || $.length > 0 || oe.length > 0) && /* @__PURE__ */ i("div", { ref: Fe, className: "flex flex-col gap-1.5", children: [
669
+ k.map((t) => {
670
670
  var F, Z;
671
671
  const l = ie[t.toLowerCase()], c = J.fresh.has(t);
672
672
  return c && !l ? null : /* @__PURE__ */ i(
@@ -735,17 +735,17 @@ function Tt({
735
735
  children: "file missing"
736
736
  }
737
737
  ),
738
- W && !k && $.includes(t) && /* @__PURE__ */ e(
738
+ W && !y && U.includes(t) && /* @__PURE__ */ e(
739
739
  Je,
740
740
  {
741
741
  fileId: t,
742
742
  uses: (F = _.data) == null ? void 0 : F[t],
743
743
  loading: _.isLoading,
744
- collection: B,
744
+ collection: V,
745
745
  itemId: n
746
746
  }
747
747
  ),
748
- N && !k && $.includes(t) && /* @__PURE__ */ e(Ve, { fileId: t, stat: (Z = xe.data) == null ? void 0 : Z[t] }),
748
+ N && !y && U.includes(t) && /* @__PURE__ */ e(Be, { fileId: t, stat: (Z = xe.data) == null ? void 0 : Z[t] }),
749
749
  /* @__PURE__ */ e(
750
750
  "a",
751
751
  {
@@ -753,7 +753,7 @@ function Tt({
753
753
  onClick: ne(`${r(t)}?download=1`, l == null ? void 0 : l.filename_download),
754
754
  title: "Download",
755
755
  className: "shrink-0 text-slate-400 hover:text-nvr-cyan p-0.5",
756
- children: /* @__PURE__ */ e(ze, { className: "h-3.5 w-3.5" })
756
+ children: /* @__PURE__ */ e(Oe, { className: "h-3.5 w-3.5" })
757
757
  }
758
758
  ),
759
759
  !h && /* @__PURE__ */ e(
@@ -763,7 +763,7 @@ function Tt({
763
763
  "aria-label": "Remove file",
764
764
  onClick: () => m(t),
765
765
  className: "text-slate-300 hover:text-red-400 p-0.5 shrink-0",
766
- children: /* @__PURE__ */ e(ke, { className: "h-3.5 w-3.5" })
766
+ children: /* @__PURE__ */ e(ye, { className: "h-3.5 w-3.5" })
767
767
  }
768
768
  )
769
769
  ]
@@ -777,12 +777,12 @@ function Tt({
777
777
  name: he.current.get(t.toLowerCase()) ?? "A file",
778
778
  leaving: J.leaving.has(t),
779
779
  by: Ze(
780
- u.getQueryData(["last-touch", B, String(n)])
780
+ u.getQueryData(["last-touch", V, String(n)])
781
781
  )
782
782
  },
783
783
  `removed-${t}`
784
784
  )),
785
- U.map((t) => /* @__PURE__ */ i(
785
+ $.map((t) => /* @__PURE__ */ i(
786
786
  "div",
787
787
  {
788
788
  className: "flex items-center gap-2 rounded-lg border border-amber-200 p-2 bg-amber-50/50",
@@ -798,7 +798,7 @@ function Tt({
798
798
  ),
799
799
  /* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
800
800
  /* @__PURE__ */ i("div", { className: "flex items-center gap-1", children: [
801
- /* @__PURE__ */ e(Oe, { className: "h-3 w-3 text-amber-400 shrink-0" }),
801
+ /* @__PURE__ */ e(ze, { className: "h-3 w-3 text-amber-400 shrink-0" }),
802
802
  /* @__PURE__ */ e(
803
803
  "p",
804
804
  {
@@ -821,7 +821,7 @@ function Tt({
821
821
  "aria-label": "Remove file",
822
822
  onClick: () => G(t.url),
823
823
  className: "text-slate-300 hover:text-red-400 p-0.5 shrink-0",
824
- children: /* @__PURE__ */ e(ke, { className: "h-3.5 w-3.5" })
824
+ children: /* @__PURE__ */ e(ye, { className: "h-3.5 w-3.5" })
825
825
  }
826
826
  )
827
827
  ]
@@ -851,7 +851,7 @@ function Tt({
851
851
  children: /* @__PURE__ */ e(
852
852
  lt,
853
853
  {
854
- selected: y,
854
+ selected: k,
855
855
  multi: !0,
856
856
  onSelect: (t) => S(t),
857
857
  onClose: () => te(!1),
@@ -870,11 +870,11 @@ function Tt({
870
870
  var t;
871
871
  return (t = a.current) == null ? void 0 : t.click();
872
872
  },
873
- disabled: M,
873
+ disabled: A,
874
874
  className: "flex h-8 items-center gap-1.5 rounded border border-dashed border-slate-300 px-3 text-[12px] text-slate-400 hover:border-slate-400 hover:text-slate-600 dark:border-border dark:text-slate-400 dark:hover:border-slate-500 dark:hover:text-slate-200 disabled:opacity-40 transition-colors",
875
875
  children: [
876
- M ? /* @__PURE__ */ e(ve, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(Le, { className: "h-3.5 w-3.5" }),
877
- /* @__PURE__ */ e("span", { className: "tabular-nums", children: M && H != null ? `Uploading ${H}%` : "Upload…" })
876
+ A ? /* @__PURE__ */ e(ve, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(Le, { className: "h-3.5 w-3.5" }),
877
+ /* @__PURE__ */ e("span", { className: "tabular-nums", children: A && H != null ? `Uploading ${H}%` : "Upload…" })
878
878
  ]
879
879
  }
880
880
  ),
@@ -893,8 +893,8 @@ function Tt({
893
893
  ] });
894
894
  }
895
895
  export {
896
- Tt as FileM2MField,
897
- jt as FilePickerField,
896
+ zt as FileM2MField,
897
+ Tt as FilePickerField,
898
898
  ue as fileDisplayName,
899
899
  _e as friendlyFileType
900
900
  };