@nivaro/react 0.3.46 → 0.3.47

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 (57) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +248 -16
  4. package/dist/index.js +679 -659
  5. package/dist/shared/components/CollectionBrowserView.js +813 -826
  6. package/dist/shared/components/ErrorNotice.js +169 -0
  7. package/dist/shared/components/ErrorSurface.js +23 -17
  8. package/dist/shared/components/ListLoadError.js +8 -29
  9. package/dist/shared/components/LoadErrorNote.js +38 -21
  10. package/dist/shared/components/QueryErrorState.js +8 -11
  11. package/dist/shared/components/ReportView.js +1320 -1291
  12. package/dist/shared/components/chat/ChannelArchive.js +60 -60
  13. package/dist/shared/components/chat/ChannelExtras.js +74 -74
  14. package/dist/shared/components/chat/ChatPanel.js +368 -367
  15. package/dist/shared/components/command-center/PeekPanel.js +33 -32
  16. package/dist/shared/components/command-center/panels/BoardSettings.js +41 -40
  17. package/dist/shared/components/command-center/panels/PeoplePanel.js +32 -31
  18. package/dist/shared/components/help-videos/editor/ClipsPanel.js +49 -48
  19. package/dist/shared/components/help-videos/editor/PublishButton.js +37 -36
  20. package/dist/shared/components/help-videos/editor/StatsTab.js +45 -44
  21. package/dist/shared/components/help-videos/editor/VersionsTab.js +29 -28
  22. package/dist/shared/components/help-videos/library/AuthorRolesButton.js +19 -18
  23. package/dist/shared/components/help-videos/library/HelpVideoLibrary.js +132 -129
  24. package/dist/shared/components/help-videos/library/LearningPathsPanel.js +42 -41
  25. package/dist/shared/components/help-videos/settings/HouseStyleButton.js +21 -20
  26. package/dist/shared/components/help-videos/settings/RenderSettingsButton.js +22 -21
  27. package/dist/shared/components/import/DocumentAutofillButton.js +24 -20
  28. package/dist/shared/components/import/ImportFromFileButton.js +61 -60
  29. package/dist/shared/components/imports/ImportStalenessControl.js +20 -21
  30. package/dist/shared/components/imports/NewImportDialog.js +29 -28
  31. package/dist/shared/components/imports/RunDetailSheet.js +63 -63
  32. package/dist/shared/components/item-edit/FieldRow.js +329 -329
  33. package/dist/shared/components/item-edit/InlineTableField.js +898 -898
  34. package/dist/shared/components/item-edit/PersonalDefaultControl.js +57 -56
  35. package/dist/shared/components/item-edit/PlanGrid.js +220 -221
  36. package/dist/shared/components/item-edit/RecordGrantTools.js +49 -48
  37. package/dist/shared/components/item-edit/placement-behaviour.js +68 -67
  38. package/dist/shared/components/layout-editor/inspector/ColumnFit.js +24 -23
  39. package/dist/shared/components/layout-editor/inspector/PickerPreview.js +17 -16
  40. package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +41 -41
  41. package/dist/shared/components/layout-editor/outputs/output-api.js +33 -31
  42. package/dist/shared/components/layout-editor/overview/overview-api.js +84 -83
  43. package/dist/shared/components/layout-editor/useLayoutDraft.js +47 -42
  44. package/dist/shared/components/monitoring/InactiveUserLinksView.js +10 -9
  45. package/dist/shared/components/panels/SlaClock.js +35 -36
  46. package/dist/shared/components/pipeline/PipelineEditorView.js +311 -312
  47. package/dist/shared/components/pipeline/TeamSuggestions.js +31 -30
  48. package/dist/shared/components/profile/AgentsPanel.js +73 -72
  49. package/dist/shared/components/profile/MailSuppressedPill.js +22 -21
  50. package/dist/shared/components/support/SupportRequestDialog.js +85 -81
  51. package/dist/shared/components/support/SupportView.js +94 -87
  52. package/dist/shared/lib/autofill-poll.js +21 -18
  53. package/dist/shared/lib/error-actions.js +85 -0
  54. package/dist/shared/lib/error-message.js +223 -82
  55. package/dist/shared/lib/error-toast.js +71 -13
  56. package/dist/shared/lib/safe-error.js +136 -38
  57. package/package.json +1 -1
@@ -3,12 +3,13 @@ import { useMutation as R } from "@tanstack/react-query";
3
3
  import { Search as te, FileSpreadsheet as re, X as ae, Upload as se, Loader2 as M, AlertTriangle as H, Check as ne, ArrowRight as le } from "lucide-react";
4
4
  import { useRef as oe, useState as w, useMemo as J } from "react";
5
5
  import { useApiFetchConfig as de } from "../../context.js";
6
- import { formatFileSize as ie, cn as D, formatNumber as g } from "../../lib/utils.js";
7
- import { Button as O } from "../ui/button.js";
8
- import { Dialog as ce, DialogContent as me, DialogHeader as pe, DialogTitle as ue, DialogDescription as xe, DialogBody as he, DialogFooter as ge } from "../ui/dialog.js";
6
+ import { userErrorMessage as ie } from "../../lib/safe-error.js";
7
+ import { formatFileSize as ce, cn as D, formatNumber as g } from "../../lib/utils.js";
8
+ import { Button as E } from "../ui/button.js";
9
+ import { Dialog as me, DialogContent as pe, DialogHeader as ue, DialogTitle as xe, DialogDescription as he, DialogBody as ge, DialogFooter as fe } from "../ui/dialog.js";
9
10
  import { Input as U } from "../ui/input.js";
10
- import { definitionTitle as E, importMode as G } from "./types.js";
11
- function fe() {
11
+ import { definitionTitle as O, importMode as G } from "./types.js";
12
+ function be() {
12
13
  const { apiBase: s, authHeaders: i, credentials: d } = de();
13
14
  return async function(l, o) {
14
15
  const u = await fetch(`${s}${l}`, {
@@ -32,7 +33,7 @@ function V(s) {
32
33
  }
33
34
  return ".csv,.xlsx,.xls";
34
35
  }
35
- function be({ def: s }) {
36
+ function ke({ def: s }) {
36
37
  const i = s.staging_table || `staging_${s.key}`, d = G(s);
37
38
  return d === "processor" || d === "service" ? /* @__PURE__ */ r(
38
39
  "span",
@@ -72,14 +73,14 @@ function X({
72
73
  children: [
73
74
  /* @__PURE__ */ r("span", { className: "flex items-center gap-1.5 text-[12.5px] font-medium text-slate-900 dark:text-foreground", children: [
74
75
  i && /* @__PURE__ */ e(ne, { className: "h-3.5 w-3.5 shrink-0 text-nvr-cyan" }),
75
- /* @__PURE__ */ e("span", { className: "truncate", children: E(s) })
76
+ /* @__PURE__ */ e("span", { className: "truncate", children: O(s) })
76
77
  ] }),
77
- /* @__PURE__ */ e(be, { def: s })
78
+ /* @__PURE__ */ e(ke, { def: s })
78
79
  ]
79
80
  }
80
81
  );
81
82
  }
82
- function Te({
83
+ function qe({
83
84
  open: s,
84
85
  onOpenChange: i,
85
86
  definitions: d,
@@ -87,13 +88,13 @@ function Te({
87
88
  onQueued: l
88
89
  }) {
89
90
  var W, Q;
90
- const o = fe(), u = oe(null), [a, m] = w(""), [f, $] = w(null), [h, A] = w(null), [I, L] = w("1000"), [Y, F] = w(!1), [z, _] = w(null), p = d.find((t) => t.key === f) ?? null, C = J(() => {
91
+ const o = be(), u = oe(null), [a, m] = w(""), [f, $] = w(null), [h, A] = w(null), [I, L] = w("1000"), [Y, F] = w(!1), [z, _] = w(null), p = d.find((t) => t.key === f) ?? null, C = J(() => {
91
92
  const t = a.trim().toLowerCase();
92
93
  return t ? d.filter(
93
94
  (c) => [c.key, c.label, c.staging_table, c.procedure, c.description].filter(Boolean).some((b) => String(b).toLowerCase().includes(t))
94
95
  ) : d;
95
96
  }, [d, a]), S = J(() => {
96
- const t = [...C].sort((N, P) => E(N).localeCompare(E(P)));
97
+ const t = [...C].sort((N, P) => O(N).localeCompare(O(P)));
97
98
  if (a.trim()) return { frequent: [], rest: t };
98
99
  const c = [...C].filter((N) => (x[N.key] ?? 0) > 0).sort((N, P) => (x[P.key] ?? 0) - (x[N.key] ?? 0)).slice(0, 5), b = new Set(c.map((N) => N.key));
99
100
  return { frequent: c, rest: t.filter((N) => !b.has(N.key)) };
@@ -128,18 +129,18 @@ function Te({
128
129
  }
129
130
  const n = k.data, v = p ? G(p) : null, ee = !!n && (n.unknown_columns.length > 0 || n.missing_columns.length > 0);
130
131
  return /* @__PURE__ */ e(
131
- ce,
132
+ me,
132
133
  {
133
134
  open: s,
134
135
  onOpenChange: (t) => {
135
136
  t || B(), i(t);
136
137
  },
137
- children: /* @__PURE__ */ r(me, { className: "flex max-h-[88vh] w-[min(920px,94vw)] max-w-none flex-col overflow-hidden dark:bg-card", children: [
138
- /* @__PURE__ */ r(pe, { className: "shrink-0", children: [
139
- /* @__PURE__ */ e(ue, { className: "text-[17px] dark:text-foreground", children: "New import" }),
140
- /* @__PURE__ */ e(xe, { className: "text-[12.5px]", children: "Choose an import and a file. The file is checked first, and nothing is queued until you confirm." })
138
+ children: /* @__PURE__ */ r(pe, { className: "flex max-h-[88vh] w-[min(920px,94vw)] max-w-none flex-col overflow-hidden dark:bg-card", children: [
139
+ /* @__PURE__ */ r(ue, { className: "shrink-0", children: [
140
+ /* @__PURE__ */ e(xe, { className: "text-[17px] dark:text-foreground", children: "New import" }),
141
+ /* @__PURE__ */ e(he, { className: "text-[12.5px]", children: "Choose an import and a file. The file is checked first, and nothing is queued until you confirm." })
141
142
  ] }),
142
- /* @__PURE__ */ e(he, { className: "min-h-0 flex-1 overflow-y-auto", children: /* @__PURE__ */ r("div", { className: "grid grid-cols-1 gap-5 lg:grid-cols-[300px_1fr]", children: [
143
+ /* @__PURE__ */ e(ge, { className: "min-h-0 flex-1 overflow-y-auto", children: /* @__PURE__ */ r("div", { className: "grid grid-cols-1 gap-5 lg:grid-cols-[300px_1fr]", children: [
143
144
  /* @__PURE__ */ r("section", { className: "flex min-h-0 flex-col", children: [
144
145
  /* @__PURE__ */ e("h3", { className: "mb-2 text-[12px] font-semibold text-slate-900 dark:text-foreground", children: "1 · Which import" }),
145
146
  /* @__PURE__ */ r("div", { className: "relative mb-2", children: [
@@ -202,7 +203,7 @@ function Te({
202
203
  /* @__PURE__ */ e(re, { className: "h-4 w-4 shrink-0 text-slate-400" }),
203
204
  /* @__PURE__ */ r("div", { className: "min-w-0 flex-1", children: [
204
205
  /* @__PURE__ */ e("p", { className: "truncate font-mono text-[12px] text-slate-900 dark:text-foreground", children: h.name }),
205
- /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-500 dark:text-muted-foreground", children: ie(h.size) })
206
+ /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-500 dark:text-muted-foreground", children: ce(h.size) })
206
207
  ] }),
207
208
  /* @__PURE__ */ e(
208
209
  "button",
@@ -281,9 +282,9 @@ function Te({
281
282
  ")"
282
283
  ] })
283
284
  ] }, t.code + t.message)) }),
284
- n.dry_run && /* @__PURE__ */ e(Ne, { run: n.dry_run }),
285
+ n.dry_run && /* @__PURE__ */ e(we, { run: n.dry_run }),
285
286
  !n.dry_run && p && h && v === "procedure" && /* @__PURE__ */ e(
286
- ke,
287
+ Ne,
287
288
  {
288
289
  importKey: p.key,
289
290
  procedure: p.procedure ?? "",
@@ -365,7 +366,7 @@ function Te({
365
366
  ] })
366
367
  ] })
367
368
  ] }) }),
368
- /* @__PURE__ */ r(ge, { className: "shrink-0 flex-wrap gap-x-4 gap-y-2 dark:border-border", children: [
369
+ /* @__PURE__ */ r(fe, { className: "shrink-0 flex-wrap gap-x-4 gap-y-2 dark:border-border", children: [
369
370
  /* @__PURE__ */ r("div", { className: "mr-auto flex min-w-0 flex-wrap items-center gap-x-4 gap-y-1", children: [
370
371
  /* @__PURE__ */ r("label", { className: "flex items-center gap-2 text-[12px] text-slate-600 dark:text-muted-foreground", children: [
371
372
  "Priority",
@@ -399,9 +400,9 @@ function Te({
399
400
  ] }) })
400
401
  ] }),
401
402
  z && /* @__PURE__ */ e("p", { className: "w-full text-[12px] text-red-600 dark:text-red-400 sm:w-auto", children: z }),
402
- /* @__PURE__ */ e(O, { variant: "ghost", size: "sm", onClick: () => i(!1), children: "Cancel" }),
403
+ /* @__PURE__ */ e(E, { variant: "ghost", size: "sm", onClick: () => i(!1), children: "Cancel" }),
403
404
  /* @__PURE__ */ e(
404
- O,
405
+ E,
405
406
  {
406
407
  size: "sm",
407
408
  disabled: !p || !h || j.isPending || k.isPending || (((Q = (W = k.data) == null ? void 0 : W.validation) == null ? void 0 : Q.errors.length) ?? 0) > 0,
@@ -418,7 +419,7 @@ function Te({
418
419
  );
419
420
  }
420
421
  const q = (s) => s == null || s === "" ? "—" : typeof s == "object" ? JSON.stringify(s) : String(s);
421
- function ke({
422
+ function Ne({
422
423
  importKey: s,
423
424
  procedure: i,
424
425
  file: d,
@@ -443,7 +444,7 @@ function ke({
443
444
  ": load this file and run the procedure inside a transaction, count what it changes, then roll everything back. Other writers to those tables wait while it runs."
444
445
  ] }),
445
446
  /* @__PURE__ */ r(
446
- O,
447
+ E,
447
448
  {
448
449
  size: "sm",
449
450
  variant: "outline",
@@ -458,7 +459,7 @@ function ke({
458
459
  }
459
460
  )
460
461
  ] }),
461
- l.isError && /* @__PURE__ */ e("p", { className: "text-[11.5px] text-red-700 dark:text-red-300", children: l.error.message }),
462
+ l.isError && /* @__PURE__ */ e("p", { className: "text-[11.5px] text-red-700 dark:text-red-300", children: ie(l.error, "The import could not run") }),
462
463
  (o == null ? void 0 : o.refused) && /* @__PURE__ */ e(
463
464
  "p",
464
465
  {
@@ -521,7 +522,7 @@ function ke({
521
522
  }
522
523
  );
523
524
  }
524
- function Ne({ run: s }) {
525
+ function we({ run: s }) {
525
526
  const [i, d] = w(null), x = Object.values(s.skipped).reduce((a, m) => a + m, 0), l = s.samples, o = (a) => d((m) => m === a ? null : a), u = (a, m, f, $) => /* @__PURE__ */ r(
526
527
  "button",
527
528
  {
@@ -638,5 +639,5 @@ function Ne({ run: s }) {
638
639
  );
639
640
  }
640
641
  export {
641
- Te as NewImportDialog
642
+ qe as NewImportDialog
642
643
  };
@@ -5,16 +5,16 @@ import { useState as k, useEffect as he, useMemo as pe } from "react";
5
5
  import { useNivaroClient as te, useApiFetchConfig as Re, useItemNavigation as Se } from "../../context.js";
6
6
  import { useDebounced as Te } from "../../hooks/useDebounced.js";
7
7
  import { get as xe, post as J } from "../../lib/commands.js";
8
- import { errorSentence as ae } from "../../lib/error-message.js";
9
- import { parseImportLog as Le } from "../../lib/import-log.js";
10
- import { formatDateTime as se, formatNumber as h, cn as b, formatFileSize as qe, titleCase as Ee } from "../../lib/utils.js";
11
- import { ExplainButton as Fe } from "../ai/ExplainButton.js";
8
+ import { errorSentence as ae, rowErrorSentence as Le } from "../../lib/error-message.js";
9
+ import { parseImportLog as Ee } from "../../lib/import-log.js";
10
+ import { formatDateTime as se, formatNumber as h, cn as b, formatFileSize as qe, titleCase as Fe } from "../../lib/utils.js";
11
+ import { ExplainButton as Ke } from "../ai/ExplainButton.js";
12
12
  import { Button as T } from "../ui/button.js";
13
- import { Input as Ke } from "../ui/input.js";
14
- import { Sheet as Pe, SheetContent as De, SheetTitle as je, SheetDescription as Me } from "../ui/sheet.js";
13
+ import { Input as Pe } from "../ui/input.js";
14
+ import { Sheet as De, SheetContent as je, SheetTitle as Me, SheetDescription as Oe } from "../ui/sheet.js";
15
15
  import { Skeleton as G } from "../ui/skeleton.js";
16
- import { LIVE_POLL_MS as fe, useElapsed as Oe, StatusPill as Ue } from "./run-parts.js";
17
- import { runMode as be, runnerName as ze, formatDuration as ne } from "./types.js";
16
+ import { LIVE_POLL_MS as fe, useElapsed as Ue, StatusPill as ze } from "./run-parts.js";
17
+ import { runMode as be, runnerName as Be, formatDuration as ne } from "./types.js";
18
18
  const B = 50, P = {
19
19
  created: {
20
20
  label: "Created",
@@ -58,7 +58,7 @@ const B = 50, P = {
58
58
  bar: "bg-[#ef4444]",
59
59
  dot: "bg-[#ef4444]"
60
60
  }
61
- }, w = "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#0ea5e9]/60 focus-visible:ring-offset-0", ge = (t) => Ee(
61
+ }, w = "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#0ea5e9]/60 focus-visible:ring-offset-0", ge = (t) => Fe(
62
62
  String(t ?? "").replace(/_junction$/i, " links").replace(/_/g, " ")
63
63
  );
64
64
  function de(t) {
@@ -114,7 +114,7 @@ function D({
114
114
  }
115
115
  );
116
116
  }
117
- function Be({
117
+ function Qe({
118
118
  report: t,
119
119
  kind: n,
120
120
  onKind: o
@@ -198,7 +198,7 @@ function Be({
198
198
  ))
199
199
  ] });
200
200
  }
201
- function Qe({ u: t, runId: n }) {
201
+ function Ve({ u: t, runId: n }) {
202
202
  const [o, d] = k(!1), [i, c] = k(!1), p = t.distinct - t.values.length;
203
203
  return /* @__PURE__ */ a("li", { className: "border-b border-slate-100 last:border-b-0 dark:border-border/60", children: [
204
204
  /* @__PURE__ */ a(
@@ -272,7 +272,7 @@ function Qe({ u: t, runId: n }) {
272
272
  ] })
273
273
  ] });
274
274
  }
275
- function Ve({
275
+ function We({
276
276
  report: t,
277
277
  runId: n,
278
278
  isAdmin: o,
@@ -351,11 +351,11 @@ function Ve({
351
351
  },
352
352
  u
353
353
  )),
354
- t.unmatched.map((u) => /* @__PURE__ */ e(Qe, { u, runId: n }, u.column))
354
+ t.unmatched.map((u) => /* @__PURE__ */ e(Ve, { u, runId: n }, u.column))
355
355
  ] })
356
356
  ] });
357
357
  }
358
- function We({ item: t }) {
358
+ function Ae({ item: t }) {
359
359
  if (t.changes.length === 0) return null;
360
360
  const n = t.kind === "created", o = t.changes.some((d) => d.from_known);
361
361
  return /* @__PURE__ */ a("table", { className: "w-full border-collapse text-[12px]", "data-run-changes": !0, children: [
@@ -372,7 +372,7 @@ function We({ item: t }) {
372
372
  !n && !o && /* @__PURE__ */ e("caption", { className: "caption-bottom pt-1.5 text-left text-[11px] text-slate-500 dark:text-muted-foreground", children: "This run was read back from recorded changes, which keep the new value only." })
373
373
  ] });
374
374
  }
375
- function Ae({
375
+ function Ie({
376
376
  item: t,
377
377
  manyCollections: n,
378
378
  isAdmin: o,
@@ -441,7 +441,7 @@ function Ae({
441
441
  children: t.message
442
442
  }
443
443
  ),
444
- /* @__PURE__ */ e(We, { item: t }),
444
+ /* @__PURE__ */ e(Ae, { item: t }),
445
445
  t.revert_note && /* @__PURE__ */ a("p", { className: "text-[11.5px] text-slate-600 dark:text-muted-foreground", children: [
446
446
  "Revert: ",
447
447
  t.revert_note
@@ -489,7 +489,7 @@ function Ae({
489
489
  }
490
490
  );
491
491
  }
492
- function Ie({
492
+ function Ge({
493
493
  runId: t,
494
494
  report: n,
495
495
  kind: o,
@@ -498,8 +498,8 @@ function Ie({
498
498
  live: c
499
499
  }) {
500
500
  var U, z, v;
501
- const p = te(), u = oe(), { download: s, busy: g, error: r } = ke(), [x, f] = k(""), [m, Q] = k(null), [y, q] = k(1), [E, j] = k(null), $ = Te(x, 300);
502
- he(() => q(1), [o, m, $, t]);
501
+ const p = te(), u = oe(), { download: s, busy: g, error: r } = ke(), [x, f] = k(""), [m, Q] = k(null), [y, E] = k(1), [q, j] = k(null), $ = Te(x, 300);
502
+ he(() => E(1), [o, m, $, t]);
503
503
  const _ = { kind: o ?? "", collection: m ?? "", search: $, page: y, limit: B }, C = X({
504
504
  queryKey: ["staged-import-run-items", t, _],
505
505
  queryFn: () => p.request(
@@ -607,7 +607,7 @@ function Ie({
607
607
  /* @__PURE__ */ a("div", { className: "relative ml-auto w-[220px] max-w-full", children: [
608
608
  /* @__PURE__ */ e($e, { className: "pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
609
609
  /* @__PURE__ */ e(
610
- Ke,
610
+ Pe,
611
611
  {
612
612
  value: x,
613
613
  onChange: (l) => f(l.target.value),
@@ -619,12 +619,12 @@ function Ie({
619
619
  )
620
620
  ] })
621
621
  ] }),
622
- (E || r) && /* @__PURE__ */ e(
622
+ (q || r) && /* @__PURE__ */ e(
623
623
  "p",
624
624
  {
625
625
  role: "status",
626
626
  className: "mb-2 rounded-md border border-slate-200 bg-slate-50 px-3 py-1.5 text-[12px] text-slate-700 dark:border-border dark:bg-muted/40 dark:text-foreground",
627
- children: E ?? r
627
+ children: q ?? r
628
628
  }
629
629
  ),
630
630
  /* @__PURE__ */ e(
@@ -637,7 +637,7 @@ function Ie({
637
637
  children: C.isLoading ? /* @__PURE__ */ e("div", { className: "space-y-1.5 p-3", children: [0, 1, 2, 3, 4, 5].map((l) => /* @__PURE__ */ e(G, { className: "h-5 w-full" }, l)) }) : O.length === 0 ? /* @__PURE__ */ e("p", { className: "px-3 py-6 text-center text-[12.5px] text-slate-600 dark:text-muted-foreground", children: $ ? `Nothing in this run matches “${$}”.` : "Nothing to show for this choice." }) : /* @__PURE__ */ e("ul", { children: O.map((l) => {
638
638
  var N;
639
639
  return /* @__PURE__ */ e(
640
- Ae,
640
+ Ie,
641
641
  {
642
642
  item: l,
643
643
  manyCollections: M.length > 1,
@@ -669,7 +669,7 @@ function Ie({
669
669
  size: "sm",
670
670
  className: "h-6 px-2 text-[11.5px]",
671
671
  disabled: y <= 1,
672
- onClick: () => q((l) => l - 1),
672
+ onClick: () => E((l) => l - 1),
673
673
  children: "Previous"
674
674
  }
675
675
  ),
@@ -680,7 +680,7 @@ function Ie({
680
680
  size: "sm",
681
681
  className: "h-6 px-2 text-[11.5px]",
682
682
  disabled: y * B >= R,
683
- onClick: () => q((l) => l + 1),
683
+ onClick: () => E((l) => l + 1),
684
684
  children: "Next"
685
685
  }
686
686
  )
@@ -694,7 +694,7 @@ function Ie({
694
694
  ] })
695
695
  ] });
696
696
  }
697
- function Ge({ report: t }) {
697
+ function He({ report: t }) {
698
698
  const n = t.phases.filter((i) => i.ms > 0 || (i.count ?? 0) > 0);
699
699
  if (n.length === 0) return null;
700
700
  const o = Math.max(...n.map((i) => i.ms), 1), d = n.reduce((i, c) => i + c.ms, 0);
@@ -750,7 +750,7 @@ function Ge({ report: t }) {
750
750
  )) })
751
751
  ] });
752
752
  }
753
- function He({
753
+ function Je({
754
754
  runId: t,
755
755
  onDone: n,
756
756
  onClose: o
@@ -851,7 +851,7 @@ function He({
851
851
  }
852
852
  );
853
853
  }
854
- function Je({ run: t }) {
854
+ function Xe({ run: t }) {
855
855
  const { mode: n, name: o } = be(t);
856
856
  return n === "processor" || n === "service" ? /* @__PURE__ */ a("span", { "data-run-mode": n, children: [
857
857
  "Items service",
@@ -880,7 +880,7 @@ function I({ label: t, children: n }) {
880
880
  /* @__PURE__ */ e("dd", { className: "truncate text-[12.5px] text-slate-900 dark:text-foreground", children: n })
881
881
  ] });
882
882
  }
883
- function vt({
883
+ function wt({
884
884
  run: t,
885
885
  runId: n,
886
886
  stage: o,
@@ -898,9 +898,9 @@ function vt({
898
898
  var l, N, A, re;
899
899
  return ((N = (l = v.state.data) == null ? void 0 : l.data) == null ? void 0 : N.status) === "running" || ((re = (A = v.state.data) == null ? void 0 : A.data) == null ? void 0 : re.status) === "queued" ? fe : !1;
900
900
  }
901
- }), r = ((O = g.data) == null ? void 0 : O.data) ?? t, x = ((W = (V = g.data) == null ? void 0 : V.data) == null ? void 0 : W.report) ?? null, f = Oe((r == null ? void 0 : r.started_at) ?? (r == null ? void 0 : r.created_at), (r == null ? void 0 : r.status) === "running"), m = r != null && r.file ? u.fileUrl(r.file) : null, [Q, y] = k(null), [q, E] = k(!1), [j, $] = k(!1);
901
+ }), r = ((O = g.data) == null ? void 0 : O.data) ?? t, x = ((W = (V = g.data) == null ? void 0 : V.data) == null ? void 0 : W.report) ?? null, f = Ue((r == null ? void 0 : r.started_at) ?? (r == null ? void 0 : r.created_at), (r == null ? void 0 : r.status) === "running"), m = r != null && r.file ? u.fileUrl(r.file) : null, [Q, y] = k(null), [E, q] = k(!1), [j, $] = k(!1);
902
902
  he(() => {
903
- y(null), E(!1), $(!1);
903
+ y(null), q(!1), $(!1);
904
904
  }, [n]);
905
905
  const _ = Y({
906
906
  mutationFn: () => u.request(
@@ -908,23 +908,23 @@ function vt({
908
908
  ),
909
909
  onSuccess: () => void s.invalidateQueries({ queryKey: ["staged-import-run", n] })
910
910
  }), C = r ? be(r).mode : null, F = (r == null ? void 0 : r.status) === "completed" || (r == null ? void 0 : r.status) === "error", K = d && !!x && F && (x.counts.created > 0 || x.counts.updated > 0), M = !!x, R = pe(() => r ? /* @__PURE__ */ a("dl", { className: "mt-3 grid grid-cols-2 gap-x-5 gap-y-2 sm:grid-cols-4", children: [
911
- /* @__PURE__ */ e(I, { label: "Queued by", children: ze(r) ?? "—" }),
911
+ /* @__PURE__ */ e(I, { label: "Queued by", children: Be(r) ?? "—" }),
912
912
  /* @__PURE__ */ e(I, { label: r.finished_at ? "Finished" : r.started_at ? "Started" : "Queued", children: se(r.finished_at ?? r.started_at ?? r.created_at ?? /* @__PURE__ */ new Date()) }),
913
913
  /* @__PURE__ */ e(I, { label: "Took", children: /* @__PURE__ */ e("span", { className: "tabular-nums", children: ne(r.duration) }) }),
914
914
  /* @__PURE__ */ e(I, { label: "Rows in the file", children: /* @__PURE__ */ e("span", { className: "tabular-nums", children: r.row_count == null ? "—" : h(r.row_count) }) })
915
915
  ] }) : null, [r]);
916
- return /* @__PURE__ */ e(Pe, { open: n != null, onOpenChange: (v) => !v && i(), children: /* @__PURE__ */ a(
917
- De,
916
+ return /* @__PURE__ */ e(De, { open: n != null, onOpenChange: (v) => !v && i(), children: /* @__PURE__ */ a(
917
+ je,
918
918
  {
919
919
  side: "right",
920
920
  className: b("p-0 sm:max-w-none", M ? "w-[min(860px,96vw)]" : "w-[min(560px,94vw)]"),
921
921
  children: [
922
- /* @__PURE__ */ e(je, { className: "sr-only", children: r ? `Import run ${r.id}: ${((U = r.definition_label) == null ? void 0 : U.trim()) || r.import_key}` : "Import run" }),
923
- /* @__PURE__ */ e(Me, { className: "sr-only", children: "What the run did, what needs a look, the records it touched and its log." }),
922
+ /* @__PURE__ */ e(Me, { className: "sr-only", children: r ? `Import run ${r.id}: ${((U = r.definition_label) == null ? void 0 : U.trim()) || r.import_key}` : "Import run" }),
923
+ /* @__PURE__ */ e(Oe, { className: "sr-only", children: "What the run did, what needs a look, the records it touched and its log." }),
924
924
  r ? /* @__PURE__ */ a("div", { className: "flex h-full flex-col", "data-run-sheet": r.id, children: [
925
925
  /* @__PURE__ */ a("header", { className: "shrink-0 border-b border-slate-200 px-5 py-4 pr-12 dark:border-border", children: [
926
926
  /* @__PURE__ */ a("div", { className: "flex flex-wrap items-center gap-2.5", children: [
927
- /* @__PURE__ */ e(Ue, { status: r.status }),
927
+ /* @__PURE__ */ e(ze, { status: r.status }),
928
928
  /* @__PURE__ */ a("span", { className: "font-mono text-[12px] text-slate-500 dark:text-muted-foreground", children: [
929
929
  "#",
930
930
  r.id
@@ -942,7 +942,7 @@ function vt({
942
942
  )
943
943
  ] }),
944
944
  /* @__PURE__ */ e("h2", { className: "mt-1.5 text-[16px] font-semibold text-slate-900 dark:text-foreground", children: ((z = r.definition_label) == null ? void 0 : z.trim()) || r.import_key }),
945
- /* @__PURE__ */ e("p", { className: "mt-0.5 text-[12px] text-slate-600 dark:text-muted-foreground", children: /* @__PURE__ */ e(Je, { run: r }) }),
945
+ /* @__PURE__ */ e("p", { className: "mt-0.5 text-[12px] text-slate-600 dark:text-muted-foreground", children: /* @__PURE__ */ e(Xe, { run: r }) }),
946
946
  o && r.status === "running" && /* @__PURE__ */ a("p", { className: "mt-2 text-[12px] text-[#0284a8] dark:text-nvr-cyan", children: [
947
947
  o,
948
948
  f != null && ` · ${ne(f)} elapsed`
@@ -951,9 +951,9 @@ function vt({
951
951
  ] }),
952
952
  /* @__PURE__ */ a("div", { className: "min-h-0 flex-1 space-y-6 overflow-y-auto px-5 py-4", children: [
953
953
  x ? /* @__PURE__ */ a(S, { children: [
954
- /* @__PURE__ */ e(Be, { report: x, kind: Q, onKind: y }),
954
+ /* @__PURE__ */ e(Qe, { report: x, kind: Q, onKind: y }),
955
955
  /* @__PURE__ */ e(
956
- Ve,
956
+ We,
957
957
  {
958
958
  report: x,
959
959
  runId: r.id,
@@ -965,7 +965,7 @@ function vt({
965
965
  }
966
966
  ),
967
967
  /* @__PURE__ */ e(
968
- Ie,
968
+ Ge,
969
969
  {
970
970
  runId: r.id,
971
971
  report: x,
@@ -975,7 +975,7 @@ function vt({
975
975
  live: j
976
976
  }
977
977
  ),
978
- /* @__PURE__ */ e(Ge, { report: x }),
978
+ /* @__PURE__ */ e(He, { report: x }),
979
979
  x.notes.length > 0 && /* @__PURE__ */ a("section", { "data-run-notes": !0, children: [
980
980
  /* @__PURE__ */ e(L, { children: "Worth knowing" }),
981
981
  /* @__PURE__ */ e("ul", { className: "max-w-[78ch] space-y-1.5 text-[12px] leading-relaxed text-slate-700 dark:text-foreground", children: x.notes.map((v) => /* @__PURE__ */ e("li", { children: v }, v)) })
@@ -1028,8 +1028,8 @@ function vt({
1028
1028
  )
1029
1029
  ] }) : /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-600 dark:text-muted-foreground", children: "No file is attached, so this run cannot be queued again." })
1030
1030
  ] }),
1031
- d && r.status !== "running" && (r.status === "error" || (r.duration ?? 0) >= Ye) && /* @__PURE__ */ e("section", { "data-run-explain": !0, children: /* @__PURE__ */ e(
1032
- Fe,
1031
+ d && r.status !== "running" && (r.status === "error" || (r.duration ?? 0) >= Ze) && /* @__PURE__ */ e("section", { "data-run-explain": !0, children: /* @__PURE__ */ e(
1032
+ Ke,
1033
1033
  {
1034
1034
  kind: "import-run",
1035
1035
  params: { id: r.id },
@@ -1044,11 +1044,11 @@ function vt({
1044
1044
  /* @__PURE__ */ e(le, { run: r })
1045
1045
  ] }) })
1046
1046
  ] }),
1047
- q && K && /* @__PURE__ */ e(
1048
- He,
1047
+ E && K && /* @__PURE__ */ e(
1048
+ Je,
1049
1049
  {
1050
1050
  runId: r.id,
1051
- onClose: () => E(!1),
1051
+ onClose: () => q(!1),
1052
1052
  onDone: () => {
1053
1053
  $(!0), s.invalidateQueries({ queryKey: ["staged-import-run", r.id] }), s.invalidateQueries({ queryKey: ["staged-import-run-items", r.id] });
1054
1054
  }
@@ -1068,13 +1068,13 @@ function vt({
1068
1068
  ]
1069
1069
  }
1070
1070
  ),
1071
- K && !q && /* @__PURE__ */ a(
1071
+ K && !E && /* @__PURE__ */ a(
1072
1072
  T,
1073
1073
  {
1074
1074
  variant: "outline",
1075
1075
  size: "sm",
1076
1076
  "data-run-revert-open": !0,
1077
- onClick: () => E(!0),
1077
+ onClick: () => q(!0),
1078
1078
  children: [
1079
1079
  /* @__PURE__ */ e(ee, { className: "h-3.5 w-3.5" }),
1080
1080
  " Revert…"
@@ -1095,8 +1095,8 @@ function vt({
1095
1095
  }
1096
1096
  ) });
1097
1097
  }
1098
- const Xe = 40, Ye = 120, Ze = "rounded border border-slate-200 bg-slate-50 px-1.5 py-0.5 font-mono text-[11px] text-slate-700 dark:border-border dark:bg-muted/40 dark:text-foreground";
1099
- function et({ text: t }) {
1098
+ const Ye = 40, Ze = 120, et = "rounded border border-slate-200 bg-slate-50 px-1.5 py-0.5 font-mono text-[11px] text-slate-700 dark:border-border dark:bg-muted/40 dark:text-foreground";
1099
+ function tt({ text: t }) {
1100
1100
  const [n, o] = k(!1);
1101
1101
  return /* @__PURE__ */ a(
1102
1102
  D,
@@ -1115,7 +1115,7 @@ function et({ text: t }) {
1115
1115
  }
1116
1116
  );
1117
1117
  }
1118
- function tt({ line: t }) {
1118
+ function at({ line: t }) {
1119
1119
  return /* @__PURE__ */ a(
1120
1120
  "li",
1121
1121
  {
@@ -1145,11 +1145,11 @@ function tt({ line: t }) {
1145
1145
  ]
1146
1146
  }
1147
1147
  ),
1148
- t.note && /* @__PURE__ */ e("p", { className: "mt-0.5 max-w-[70ch] text-[11.5px] leading-snug text-slate-600 dark:text-muted-foreground", children: at(t.note) }),
1148
+ t.note && /* @__PURE__ */ e("p", { className: "mt-0.5 max-w-[70ch] text-[11.5px] leading-snug text-slate-600 dark:text-muted-foreground", children: rt(t.note) }),
1149
1149
  t.values.length > 0 && /* @__PURE__ */ a("ul", { "data-run-log-values": !0, className: "mt-1.5 flex flex-wrap gap-1", children: [
1150
1150
  t.values.map((n, o) => (
1151
1151
  // biome-ignore lint/suspicious/noArrayIndexKey: a log may list a value twice and the list never reorders
1152
- /* @__PURE__ */ e("li", { className: Ze, children: n }, `${n}-${o}`)
1152
+ /* @__PURE__ */ e("li", { className: et, children: n }, `${n}-${o}`)
1153
1153
  )),
1154
1154
  t.more != null && /* @__PURE__ */ e("li", { className: "px-1 py-0.5 text-[11px] text-slate-600 dark:text-muted-foreground", children: t.more === "some" ? "and more" : `and ${h(t.more)} more` })
1155
1155
  ] })
@@ -1166,9 +1166,9 @@ function tt({ line: t }) {
1166
1166
  }
1167
1167
  );
1168
1168
  }
1169
- const at = (t) => t && t.charAt(0).toUpperCase() + t.slice(1);
1170
- function rt({ error: t }) {
1171
- const [n, o] = k(!1), d = n ? t.values : t.values.slice(0, Xe), i = t.values.reduce((c, p) => c + p.count, 0);
1169
+ const rt = (t) => t && t.charAt(0).toUpperCase() + t.slice(1);
1170
+ function st({ error: t }) {
1171
+ const [n, o] = k(!1), d = n ? t.values : t.values.slice(0, Ye), i = t.values.reduce((c, p) => c + p.count, 0);
1172
1172
  return /* @__PURE__ */ a(
1173
1173
  "div",
1174
1174
  {
@@ -1186,7 +1186,7 @@ function rt({ error: t }) {
1186
1186
  "max-w-[75ch] break-words text-[12.5px] leading-relaxed text-[#7f1d1d] dark:text-[#fee2e2]",
1187
1187
  t.source && "mt-1"
1188
1188
  ),
1189
- children: t.message
1189
+ children: Le(t.message)
1190
1190
  }
1191
1191
  ) : t.values.length === 0 ? /* @__PURE__ */ e(
1192
1192
  "p",
@@ -1259,7 +1259,7 @@ function rt({ error: t }) {
1259
1259
  }
1260
1260
  function le({ run: t }) {
1261
1261
  const [n, o] = k(!1), d = pe(
1262
- () => Le(t.logs, t.status === "error"),
1262
+ () => Ee(t.logs, t.status === "error"),
1263
1263
  [t.logs, t.status]
1264
1264
  );
1265
1265
  if (!t.logs)
@@ -1275,7 +1275,7 @@ function le({ run: t }) {
1275
1275
  ),
1276
1276
  children: t.logs
1277
1277
  }
1278
- ) : d.error ? /* @__PURE__ */ e(rt, { error: d.error }) : /* @__PURE__ */ a("div", { className: "overflow-hidden rounded-md border border-slate-200 dark:border-border", children: [
1278
+ ) : d.error ? /* @__PURE__ */ e(st, { error: d.error }) : /* @__PURE__ */ a("div", { className: "overflow-hidden rounded-md border border-slate-200 dark:border-border", children: [
1279
1279
  /* @__PURE__ */ a(
1280
1280
  "div",
1281
1281
  {
@@ -1315,16 +1315,16 @@ function le({ run: t }) {
1315
1315
  ),
1316
1316
  d.lines.length > 0 && /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 border-t border-slate-200 dark:divide-border/60 dark:border-border", children: d.lines.map((c, p) => (
1317
1317
  // biome-ignore lint/suspicious/noArrayIndexKey: two lines may read the same and the log never reorders
1318
- /* @__PURE__ */ e(tt, { line: c }, `${c.label}-${p}`)
1318
+ /* @__PURE__ */ e(at, { line: c }, `${c.label}-${p}`)
1319
1319
  )) })
1320
1320
  ] }),
1321
1321
  /* @__PURE__ */ a("div", { className: "mt-1.5 flex items-center gap-1", children: [
1322
- /* @__PURE__ */ e(et, { text: t.logs }),
1322
+ /* @__PURE__ */ e(tt, { text: t.logs }),
1323
1323
  /* @__PURE__ */ e(D, { "data-run-log-plain": !0, onClick: () => o((c) => !c), children: n ? "Show as a list" : "Show as written" })
1324
1324
  ] })
1325
1325
  ] });
1326
1326
  }
1327
1327
  export {
1328
- vt as RunDetailSheet,
1328
+ wt as RunDetailSheet,
1329
1329
  ke as useDownload
1330
1330
  };