@nivaro/react 0.3.139 → 0.3.140

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 (87) hide show
  1. package/dist/components/InlineGridField.js +95 -92
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +36 -2
  4. package/dist/shared/components/AudienceConfirmPanel.js +19 -19
  5. package/dist/shared/components/BroadcastView.js +213 -211
  6. package/dist/shared/components/CollectionBrowserView.js +2677 -2658
  7. package/dist/shared/components/ConfigHistory.js +45 -45
  8. package/dist/shared/components/ConformanceView.js +110 -110
  9. package/dist/shared/components/DataTable.js +51 -51
  10. package/dist/shared/components/FilePreviewLightbox.js +26 -25
  11. package/dist/shared/components/ItemEditForm.js +3038 -3027
  12. package/dist/shared/components/LiveCount.js +27 -23
  13. package/dist/shared/components/LiveTraceView.js +62 -61
  14. package/dist/shared/components/PageRenderer.js +422 -410
  15. package/dist/shared/components/ProfileView.js +199 -199
  16. package/dist/shared/components/QualityRulesView.js +70 -70
  17. package/dist/shared/components/QueryTable.js +131 -130
  18. package/dist/shared/components/RecordGraph.js +98 -98
  19. package/dist/shared/components/RecordReadView.js +287 -288
  20. package/dist/shared/components/ReportView.js +1279 -1259
  21. package/dist/shared/components/SlaRulesView.js +73 -74
  22. package/dist/shared/components/WidgetSlot.js +73 -73
  23. package/dist/shared/components/ai/AiChart.js +36 -32
  24. package/dist/shared/components/ai/AiMarkdown.js +136 -129
  25. package/dist/shared/components/ai/TaskDo.js +87 -87
  26. package/dist/shared/components/ai/answer-formats.js +37 -30
  27. package/dist/shared/components/ai/call-log/format.js +17 -16
  28. package/dist/shared/components/bulk/BulkActionButtons.js +66 -66
  29. package/dist/shared/components/bulk/BulkFieldUpdate.js +59 -59
  30. package/dist/shared/components/bulk/BulkSelectionNotices.js +34 -34
  31. package/dist/shared/components/bulk/MessageStakeholders.js +31 -29
  32. package/dist/shared/components/bulk/PushBulkButtons.js +83 -82
  33. package/dist/shared/components/bulk/bulk-field-options.js +10 -10
  34. package/dist/shared/components/cbv/column-totals.js +53 -51
  35. package/dist/shared/components/chat/ChatAnalyticsView.js +87 -87
  36. package/dist/shared/components/collections-directory/CollectionsToolbar.js +18 -18
  37. package/dist/shared/components/command-center/announce.js +7 -6
  38. package/dist/shared/components/command-center/panels/AttentionPanel.js +32 -31
  39. package/dist/shared/components/command-center/panels/FlowPanel.js +29 -28
  40. package/dist/shared/components/command-center/panels/PeoplePanel.js +39 -39
  41. package/dist/shared/components/delegation/DelegationConsoleView.js +27 -27
  42. package/dist/shared/components/imports/RunDetailSheet.js +1 -1
  43. package/dist/shared/components/integrations/IntegrationObligationsView.js +119 -119
  44. package/dist/shared/components/integrations/console/EventsView.js +35 -35
  45. package/dist/shared/components/integrations/console/FirefightView.js +15 -14
  46. package/dist/shared/components/integrations/console/PartnerDetail.js +78 -78
  47. package/dist/shared/components/integrations/console/ReadyToSendView.js +103 -103
  48. package/dist/shared/components/integrations/console/SignalCard.js +67 -67
  49. package/dist/shared/components/item-edit/CatalogPickerField.js +536 -527
  50. package/dist/shared/components/item-edit/ChangesTray.js +88 -74
  51. package/dist/shared/components/item-edit/FilePickerField.js +123 -123
  52. package/dist/shared/components/item-edit/GroupSection.js +301 -292
  53. package/dist/shared/components/item-edit/HeaderSummaryChip.js +54 -54
  54. package/dist/shared/components/item-edit/InlineGridField.js +45 -36
  55. package/dist/shared/components/item-edit/InlineTableField.js +1167 -1153
  56. package/dist/shared/components/item-edit/NestedRelationEditor.js +106 -99
  57. package/dist/shared/components/item-edit/RecordChatMentionsChip.js +11 -11
  58. package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +43 -44
  59. package/dist/shared/components/monitoring/ApiRequestLog.js +35 -35
  60. package/dist/shared/components/notifications/NotificationCenterView.js +268 -268
  61. package/dist/shared/components/ops-report/format.js +37 -36
  62. package/dist/shared/components/panels/ReferencedByPanel.js +21 -20
  63. package/dist/shared/components/panels/RevisionsPanel.js +306 -305
  64. package/dist/shared/components/pipeline/OwnerMatrixVersionsCard.js +12 -12
  65. package/dist/shared/components/pipeline/PipelineEditorView.js +483 -482
  66. package/dist/shared/components/pipeline/PipelineHealthCards.js +33 -32
  67. package/dist/shared/components/pipeline/TeamsView.js +189 -130
  68. package/dist/shared/components/profile/AgentsPanel.js +6 -6
  69. package/dist/shared/components/profile/DelegationCard.js +13 -12
  70. package/dist/shared/components/profile/PersonActivity.js +48 -48
  71. package/dist/shared/components/profile/PersonExtras.js +107 -107
  72. package/dist/shared/components/profile/PersonWeek.js +9 -9
  73. package/dist/shared/components/queue/QueueBulkBar.js +19 -18
  74. package/dist/shared/components/queue/QueueBulkMove.js +21 -20
  75. package/dist/shared/components/queue/QueueItemSheet.js +136 -131
  76. package/dist/shared/components/queue/QueueWorklist.js +671 -670
  77. package/dist/shared/components/queue/worklist-helpers.js +36 -21
  78. package/dist/shared/components/support/RequestList.js +121 -121
  79. package/dist/shared/components/support/SupportAnalytics.js +29 -29
  80. package/dist/shared/lib/activity-sentence.js +251 -229
  81. package/dist/shared/lib/format-value.js +5 -4
  82. package/dist/shared/lib/number-format.js +87 -0
  83. package/dist/shared/lib/number-kind.js +133 -0
  84. package/dist/shared/lib/utils.js +24 -20
  85. package/dist/shared/lib/watch-list.js +1 -1
  86. package/dist/shared/lib/widget-value-format.js +26 -12
  87. package/package.json +1 -1
@@ -1,18 +1,18 @@
1
- import { jsxs as a, jsx as t, Fragment as Z } from "react/jsx-runtime";
2
- import { useQueryClient as ae, useQuery as B, useMutation as L } from "@tanstack/react-query";
3
- import { Sparkles as Y, Loader2 as R, CircleSlash as J, RotateCcw as se, Clock as ne, Check as O, MessageSquareText as ue, Undo2 as re, Pencil as me, Trash2 as pe, AlertTriangle as he, ShieldCheck as ie } from "lucide-react";
4
- import { useState as k, useEffect as xe, useMemo as fe } from "react";
5
- import { useOptionalNivaroClient as Q, useItemEditAuth as ge } from "../../context.js";
6
- import { get as V, post as M, patch as ve } from "../../lib/commands.js";
7
- import { cn as U } from "../../lib/utils.js";
1
+ import { jsxs as a, jsx as t, Fragment as ee } from "react/jsx-runtime";
2
+ import { useQueryClient as se, useQuery as B, useMutation as L } from "@tanstack/react-query";
3
+ import { Sparkles as Y, Loader2 as R, CircleSlash as J, RotateCcw as ne, Clock as re, Check as O, MessageSquareText as me, Undo2 as ie, Pencil as pe, Trash2 as he, AlertTriangle as xe, ShieldCheck as oe } from "lucide-react";
4
+ import { useState as k, useEffect as fe, useMemo as ge } from "react";
5
+ import { useOptionalNivaroClient as Q, useItemEditAuth as ve } from "../../context.js";
6
+ import { get as V, post as M, patch as Ne } from "../../lib/commands.js";
7
+ import { cn as U, formatNumber as Z } from "../../lib/utils.js";
8
8
  import { Button as b } from "../ui/button.js";
9
- import { Input as oe } from "../ui/input.js";
10
- import { Popover as Ne, PopoverTrigger as ke, PopoverContent as be } from "../ui/popover.js";
11
- import { SimpleSelect as ye } from "../ui/SimpleSelect.js";
9
+ import { Input as le } from "../ui/input.js";
10
+ import { Popover as ke, PopoverTrigger as be, PopoverContent as ye } from "../ui/popover.js";
11
+ import { SimpleSelect as we } from "../ui/SimpleSelect.js";
12
12
  import { Skeleton as z } from "../ui/skeleton.js";
13
- import { Textarea as le } from "../ui/textarea.js";
14
- import { AiPlanCard as we } from "./AiPlanCard.js";
15
- const $e = /* @__PURE__ */ new Set(["proposed", "scheduled", "running", "paused", "failed", "executed"]), _e = {
13
+ import { Textarea as de } from "../ui/textarea.js";
14
+ import { AiPlanCard as $e } from "./AiPlanCard.js";
15
+ const _e = /* @__PURE__ */ new Set(["proposed", "scheduled", "running", "paused", "failed", "executed"]), Ce = {
16
16
  send_message: ["subject", "message"],
17
17
  create_task: ["title", "due_date", "priority"]
18
18
  };
@@ -23,18 +23,18 @@ function q(e) {
23
23
  function H(e) {
24
24
  return e == null || e === "" ? "blank" : typeof e == "object" ? JSON.stringify(e) : String(e);
25
25
  }
26
- function de(e) {
26
+ function ce(e) {
27
27
  const n = e.replace(/_/g, " ").trim();
28
28
  return n ? n[0].toUpperCase() + n.slice(1) : e;
29
29
  }
30
30
  const A = (e, n, o = `${n}s`) => `${e.toLocaleString()} ${e === 1 ? n : o}`;
31
- function Ce(e) {
31
+ function Se(e) {
32
32
  return e < 60 ? `${Math.max(1, Math.round(e))} s` : e < 3600 ? `${Math.round(e / 60)} min` : `${Math.round(e / 360) / 10} h`;
33
33
  }
34
- function Se(e) {
34
+ function Pe(e) {
35
35
  return e < 60 ? `${Math.round(e)} min` : `${Math.round(e / 6) / 10} h`;
36
36
  }
37
- function Pe() {
37
+ function qe() {
38
38
  const e = Q();
39
39
  return B({
40
40
  queryKey: ["task-do", "me"],
@@ -44,12 +44,12 @@ function Pe() {
44
44
  retry: !1
45
45
  }).data ?? null;
46
46
  }
47
- function qe(e, n, o, c) {
47
+ function Re(e, n, o, c) {
48
48
  if (!e || n.status !== "open" && n.status !== "in_progress") return !1;
49
49
  const d = n.kind === "support";
50
50
  return (d ? !e.tickets : !e.tasks) || d && e.ticket_categories.length > 0 && !e.ticket_categories.includes(Number(n.category_id)) ? !1 : c ?? (!!o && !!n.assignee && n.assignee.toUpperCase() === o.toUpperCase());
51
51
  }
52
- function Xe({
52
+ function Ze({
53
53
  task: e,
54
54
  isAssignee: n,
55
55
  subscribe: o,
@@ -57,9 +57,9 @@ function Xe({
57
57
  onTaskChanged: d,
58
58
  className: p
59
59
  }) {
60
- const h = Q(), { userId: u } = ge(), m = Pe(), [x, l] = k(!1);
61
- return !h || !qe(m, e, u, n) ? null : /* @__PURE__ */ a(Ne, { open: x, onOpenChange: l, children: [
62
- /* @__PURE__ */ t(ke, { asChild: !0, children: c ? /* @__PURE__ */ t(
60
+ const h = Q(), { userId: u } = ve(), m = qe(), [x, l] = k(!1);
61
+ return !h || !Re(m, e, u, n) ? null : /* @__PURE__ */ a(ke, { open: x, onOpenChange: l, children: [
62
+ /* @__PURE__ */ t(be, { asChild: !0, children: c ? /* @__PURE__ */ t(
63
63
  "button",
64
64
  {
65
65
  type: "button",
@@ -88,30 +88,30 @@ function Xe({
88
88
  }
89
89
  ) }),
90
90
  /* @__PURE__ */ t(
91
- be,
91
+ ye,
92
92
  {
93
93
  align: "end",
94
94
  collisionPadding: 16,
95
95
  className: "w-[min(540px,calc(100vw-32px))] p-0",
96
96
  onOpenAutoFocus: (f) => f.preventDefault(),
97
- children: /* @__PURE__ */ t(Re, { task: e, subscribe: o, onTaskChanged: d })
97
+ children: /* @__PURE__ */ t(Ae, { task: e, subscribe: o, onTaskChanged: d })
98
98
  }
99
99
  )
100
100
  ] });
101
101
  }
102
- function Re({
102
+ function Ae({
103
103
  task: e,
104
104
  subscribe: n,
105
105
  onTaskChanged: o
106
106
  }) {
107
107
  var W;
108
- const c = Q(), d = ae(), p = e.kind === "support", [h, u] = k(null), [m, x] = k(null), [l, f] = k({}), [g, P] = k(null), [N, i] = k(""), [$, E] = k(!1), [v, T] = k(null), y = B({
108
+ const c = Q(), d = se(), p = e.kind === "support", [h, u] = k(null), [m, x] = k(null), [l, f] = k({}), [g, P] = k(null), [N, i] = k(""), [$, E] = k(!1), [v, T] = k(null), y = B({
109
109
  queryKey: ["task-do", "task", e.id],
110
110
  queryFn: () => c.request(V(`/ai/task-do/tasks/${e.id}`)).then((s) => s.data)
111
111
  });
112
- xe(() => {
112
+ fe(() => {
113
113
  if (h || !y.data) return;
114
- const s = y.data.plans.find((w) => $e.has(w.status));
114
+ const s = y.data.plans.find((w) => _e.has(w.status));
115
115
  s && u(s.plan_id);
116
116
  }, [y.data, h]);
117
117
  const I = B({
@@ -138,13 +138,13 @@ function Re({
138
138
  ] })
139
139
  ] })
140
140
  ] });
141
- if (y.isLoading) return /* @__PURE__ */ t(ee, { text: "Checking…" });
141
+ if (y.isLoading) return /* @__PURE__ */ t(te, { text: "Checking…" });
142
142
  if (!y.data || !y.data.ok && !D) {
143
143
  const s = !y.data;
144
144
  return /* @__PURE__ */ a("div", { className: "p-4", "data-task-do-panel": !0, children: [
145
145
  K,
146
146
  /* @__PURE__ */ t(
147
- te,
147
+ ae,
148
148
  {
149
149
  text: s ? `Could not check whether AI can help with this ${p ? "ticket" : "task"}.` : ((W = y.data) == null ? void 0 : W.reason) ?? "Not available",
150
150
  detail: s ? q(y.error) : null,
@@ -217,7 +217,7 @@ function Re({
217
217
  F
218
218
  )) }) : null,
219
219
  /* @__PURE__ */ t(
220
- oe,
220
+ le,
221
221
  {
222
222
  id: `tdq-${s.id}`,
223
223
  className: "mt-1 h-7 text-[12px]",
@@ -298,11 +298,11 @@ function Re({
298
298
  ),
299
299
  /* @__PURE__ */ t("span", { className: "text-[11px] text-muted-foreground", children: "Takes a few seconds." })
300
300
  ] }),
301
- D && !m && !g && !_.isPending && /* @__PURE__ */ a(Z, { children: [
302
- I.isLoading && /* @__PURE__ */ t(ee, { text: "Loading the plan…" }),
303
- I.isError && /* @__PURE__ */ t(te, { text: q(I.error) }),
301
+ D && !m && !g && !_.isPending && /* @__PURE__ */ a(ee, { children: [
302
+ I.isLoading && /* @__PURE__ */ t(te, { text: "Loading the plan…" }),
303
+ I.isError && /* @__PURE__ */ t(ae, { text: q(I.error) }),
304
304
  C && /* @__PURE__ */ t(
305
- Fe,
305
+ Le,
306
306
  {
307
307
  plan: C,
308
308
  task: e,
@@ -326,7 +326,7 @@ function Re({
326
326
  },
327
327
  children: [
328
328
  /* @__PURE__ */ t(
329
- le,
329
+ de,
330
330
  {
331
331
  autoFocus: !0,
332
332
  "aria-label": g ? "What should it try instead" : "What should be different",
@@ -376,7 +376,7 @@ function Re({
376
376
  }
377
377
  );
378
378
  }
379
- function ee({ text: e }) {
379
+ function te({ text: e }) {
380
380
  return /* @__PURE__ */ a("div", { className: "space-y-2 p-4", "data-task-do-loading": !0, children: [
381
381
  /* @__PURE__ */ a("p", { className: "flex items-center gap-1.5 text-[12px] text-muted-foreground", children: [
382
382
  /* @__PURE__ */ t(R, { className: "h-3 w-3 animate-spin" }),
@@ -387,7 +387,7 @@ function ee({ text: e }) {
387
387
  /* @__PURE__ */ t(z, { className: "h-4 w-full" })
388
388
  ] });
389
389
  }
390
- function te({
390
+ function ae({
391
391
  text: e,
392
392
  detail: n,
393
393
  onRetry: o,
@@ -408,25 +408,25 @@ function te({
408
408
  onClick: o,
409
409
  disabled: c,
410
410
  children: [
411
- c ? /* @__PURE__ */ t(R, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ t(se, { className: "h-3 w-3" }),
411
+ c ? /* @__PURE__ */ t(R, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ t(ne, { className: "h-3 w-3" }),
412
412
  "Try again"
413
413
  ]
414
414
  }
415
415
  )
416
416
  ] });
417
417
  }
418
- const ce = { low: "Low risk", medium: "Medium risk", high: "High risk" };
419
- function Ae({ level: e }) {
418
+ const ue = { low: "Low risk", medium: "Medium risk", high: "High risk" };
419
+ function De({ level: e }) {
420
420
  return /* @__PURE__ */ t(
421
421
  "span",
422
422
  {
423
423
  className: U("rounded px-1.5 py-px text-[11px] font-medium", e === "high" ? "bg-rose-500/10 text-rose-700 dark:text-rose-400" : e === "medium" ? "bg-amber-500/10 text-amber-800 dark:text-amber-300" : "bg-emerald-500/10 text-emerald-700 dark:text-emerald-400"),
424
424
  "data-task-do-risk": e,
425
- children: ce[e]
425
+ children: ue[e]
426
426
  }
427
427
  );
428
428
  }
429
- function De({ plan: e }) {
429
+ function Ee({ plan: e }) {
430
430
  const n = e.review, o = n.risk.irreversible, c = n.risk.reasons.filter(
431
431
  (p) => !(o.length > 0 && /cannot be rolled back/.test(p))
432
432
  ), d = "bg-white px-2.5 py-1.5 dark:bg-card";
@@ -436,23 +436,23 @@ function De({ plan: e }) {
436
436
  /* @__PURE__ */ t("p", { className: "text-[11px] text-muted-foreground", children: "Runs in" }),
437
437
  /* @__PURE__ */ a("p", { className: "text-[13px] font-medium tabular-nums text-foreground", children: [
438
438
  "≈ ",
439
- Ce(n.estimate.run_seconds)
439
+ Se(n.estimate.run_seconds)
440
440
  ] }),
441
441
  /* @__PURE__ */ t("p", { className: "text-[10.5px] text-muted-foreground", children: n.estimate.run_basis === "recent runs" ? "from recent runs" : "typical rate" })
442
442
  ] }),
443
443
  /* @__PURE__ */ a("div", { className: d, children: [
444
444
  /* @__PURE__ */ t("p", { className: "text-[11px] text-muted-foreground", children: "Saves you" }),
445
- /* @__PURE__ */ t("p", { className: "text-[13px] font-medium tabular-nums text-foreground", children: n.estimate.hands_on_minutes != null ? `≈ ${Se(n.estimate.hands_on_minutes)}` : "—" }),
445
+ /* @__PURE__ */ t("p", { className: "text-[13px] font-medium tabular-nums text-foreground", children: n.estimate.hands_on_minutes != null ? `≈ ${Pe(n.estimate.hands_on_minutes)}` : "—" }),
446
446
  /* @__PURE__ */ t("p", { className: "text-[10.5px] text-muted-foreground", children: "AI’s estimate" })
447
447
  ] }),
448
448
  /* @__PURE__ */ a("div", { className: d, children: [
449
449
  /* @__PURE__ */ t("p", { className: "text-[11px] text-muted-foreground", children: "Risk" }),
450
- /* @__PURE__ */ t("p", { className: "mt-0.5", children: /* @__PURE__ */ t(Ae, { level: n.risk.level }) }),
450
+ /* @__PURE__ */ t("p", { className: "mt-0.5", children: /* @__PURE__ */ t(De, { level: n.risk.level }) }),
451
451
  /* @__PURE__ */ t("p", { className: "text-[10.5px] text-muted-foreground", children: A(n.risk.records, "record") })
452
452
  ] })
453
453
  ] }),
454
454
  n.risk.level !== "low" && c.length > 0 && /* @__PURE__ */ a("p", { className: "text-[11.5px] text-muted-foreground", "data-task-do-risk-why": !0, children: [
455
- ce[n.risk.level],
455
+ ue[n.risk.level],
456
456
  ": ",
457
457
  c.join(" · ")
458
458
  ] }),
@@ -463,7 +463,7 @@ function De({ plan: e }) {
463
463
  "data-task-do-irreversible": !0,
464
464
  children: [
465
465
  /* @__PURE__ */ a("p", { className: "flex items-center gap-1.5 font-medium", children: [
466
- /* @__PURE__ */ t(he, { className: "h-3.5 w-3.5 shrink-0" }),
466
+ /* @__PURE__ */ t(xe, { className: "h-3.5 w-3.5 shrink-0" }),
467
467
  o.length === 1 ? "One step can’t be undone once it runs" : `${o.length} steps can’t be undone once they run`
468
468
  ] }),
469
469
  /* @__PURE__ */ t("ul", { className: "mt-0.5 space-y-px pl-5", children: o.map((p) => /* @__PURE__ */ a("li", { children: [
@@ -480,23 +480,23 @@ function De({ plan: e }) {
480
480
  className: "flex items-center gap-1.5 text-[11.5px] text-muted-foreground",
481
481
  "data-task-do-reversible": !0,
482
482
  children: [
483
- /* @__PURE__ */ t(ie, { className: "h-3.5 w-3.5 shrink-0 text-emerald-600 dark:text-emerald-400" }),
483
+ /* @__PURE__ */ t(oe, { className: "h-3.5 w-3.5 shrink-0 text-emerald-600 dark:text-emerald-400" }),
484
484
  "Everything this plan changes can be undone afterwards."
485
485
  ]
486
486
  }
487
487
  )
488
488
  ] });
489
489
  }
490
- function Ee({ step: e, plan: n }) {
490
+ function Ie({ step: e, plan: n }) {
491
491
  var h;
492
492
  const o = n.review.touches.find((u) => u.step_id === e.id), c = (h = e.preview) != null && h.changes && typeof e.preview.changes == "object" ? e.preview.changes : {}, d = new Map(((o == null ? void 0 : o.fields) ?? []).map((u) => [u.field, u])), p = [.../* @__PURE__ */ new Set([...Object.keys(c), ...d.keys()])];
493
493
  return p.length === 0 ? null : /* @__PURE__ */ a("dl", { className: "mt-0.5 space-y-px pl-5", "data-task-do-step-changes": !0, children: [
494
494
  p.slice(0, 6).map((u) => {
495
495
  const m = d.get(u), x = m ? m.to : c[u];
496
496
  return /* @__PURE__ */ a("div", { className: "flex min-w-0 gap-1.5 text-[11px]", children: [
497
- /* @__PURE__ */ t("dt", { className: "shrink-0 text-muted-foreground", children: de(u) }),
497
+ /* @__PURE__ */ t("dt", { className: "shrink-0 text-muted-foreground", children: ce(u) }),
498
498
  /* @__PURE__ */ a("dd", { className: "min-w-0 truncate text-slate-700 dark:text-slate-300", children: [
499
- m && m.from !== void 0 && /* @__PURE__ */ a(Z, { children: [
499
+ m && m.from !== void 0 && /* @__PURE__ */ a(ee, { children: [
500
500
  /* @__PURE__ */ t("span", { className: "text-muted-foreground line-through decoration-slate-300 dark:decoration-slate-600", children: H(m.from) }),
501
501
  " ",
502
502
  "→",
@@ -513,7 +513,7 @@ function Ee({ step: e, plan: n }) {
513
513
  ] })
514
514
  ] });
515
515
  }
516
- function Ie({
516
+ function Fe({
517
517
  step: e,
518
518
  plan: n,
519
519
  onEdit: o,
@@ -524,7 +524,7 @@ function Ie({
524
524
  ...Object.keys(f ?? {}).filter(
525
525
  () => ["bulk_update", "create_record"].includes(e.kind)
526
526
  ),
527
- ..._e[e.kind] ?? []
527
+ ...Ce[e.kind] ?? []
528
528
  ], P = n.status === "proposed", N = [];
529
529
  l && (l.records && N.push(A(l.records, l.collection ?? "record")), l.people && N.push(`tells ${A(l.people, "person", "people")}`), l.external && N.push("calls other systems"), l.email && N.push("may email"));
530
530
  const i = Number(((E = e.preview) == null ? void 0 : E.hidden_fields) ?? 0);
@@ -550,7 +550,7 @@ function Ie({
550
550
  disabled: c,
551
551
  "data-task-do-step-change": !0,
552
552
  children: [
553
- /* @__PURE__ */ t(me, { className: "h-3 w-3" }),
553
+ /* @__PURE__ */ t(pe, { className: "h-3 w-3" }),
554
554
  " Change a value"
555
555
  ]
556
556
  }
@@ -564,7 +564,7 @@ function Ie({
564
564
  disabled: c,
565
565
  "data-task-do-step-remove": !0,
566
566
  children: [
567
- /* @__PURE__ */ t(pe, { className: "h-3 w-3" }),
567
+ /* @__PURE__ */ t(he, { className: "h-3 w-3" }),
568
568
  " Remove step"
569
569
  ]
570
570
  }
@@ -579,19 +579,19 @@ function Ie({
579
579
  },
580
580
  children: [
581
581
  /* @__PURE__ */ t(
582
- ye,
582
+ we,
583
583
  {
584
584
  value: h,
585
585
  onChange: (v) => {
586
586
  u(v), x(f && v in f ? H(f[v]) : "");
587
587
  },
588
- options: g.map((v) => ({ value: v, label: de(v) })),
588
+ options: g.map((v) => ({ value: v, label: ce(v) })),
589
589
  ariaLabel: "Field",
590
590
  className: "h-7 w-[150px] text-[11.5px]"
591
591
  }
592
592
  ),
593
593
  /* @__PURE__ */ t(
594
- oe,
594
+ le,
595
595
  {
596
596
  className: "h-7 w-[180px] text-[11.5px]",
597
597
  value: m,
@@ -620,7 +620,7 @@ function Ie({
620
620
  )
621
621
  ] });
622
622
  }
623
- function Fe({
623
+ function Le({
624
624
  plan: e,
625
625
  task: n,
626
626
  ticket: o,
@@ -629,7 +629,7 @@ function Fe({
629
629
  onPlan: p
630
630
  }) {
631
631
  var s, w;
632
- const h = Q(), u = ae(), [m, x] = k(null), [l, f] = k(null), [g, P] = k(!1), [N, i] = k(!1), [$, E] = k(e), v = ["task-do", "plan", e.plan_id], T = JSON.stringify(e.steps.map((r) => {
632
+ const h = Q(), u = se(), [m, x] = k(null), [l, f] = k(null), [g, P] = k(!1), [N, i] = k(!1), [$, E] = k(e), v = ["task-do", "plan", e.plan_id], T = JSON.stringify(e.steps.map((r) => {
633
633
  var S;
634
634
  return [r.id, ((S = r.preview) == null ? void 0 : S.changes) ?? null];
635
635
  })), y = L({
@@ -646,7 +646,7 @@ function Fe({
646
646
  onSuccess: (r) => u.setQueryData(v, r),
647
647
  onError: (r) => x(q(r))
648
648
  }), _ = L({
649
- mutationFn: () => o ? h.request(ve(`/support/tickets/${n.id}`, { status: "done" })) : h.request(M(`/tasks/${n.id}/complete`)),
649
+ mutationFn: () => o ? h.request(Ne(`/support/tickets/${n.id}`, { status: "done" })) : h.request(M(`/tasks/${n.id}/complete`)),
650
650
  onSuccess: () => {
651
651
  i(!0);
652
652
  for (const r of ["tasks", "my-work", "support-ticket", "support-tickets", "support-summary"])
@@ -669,14 +669,14 @@ function Fe({
669
669
  onError: (r) => x(q(r))
670
670
  }), D = ((s = e.approval) == null ? void 0 : s.required) && !e.approval.approved_by, G = e.status === "executed", K = n.status === "open" || n.status === "in_progress", W = $.status === "proposed" || $.status === "scheduled";
671
671
  return /* @__PURE__ */ a("div", { className: "mt-3", "data-task-do-plan": e.status, children: [
672
- /* @__PURE__ */ t(Le, { plan: $, waiting: !!D }),
672
+ /* @__PURE__ */ t(Me, { plan: $, waiting: !!D }),
673
673
  D && /* @__PURE__ */ a(
674
674
  "div",
675
675
  {
676
676
  className: "flex items-start gap-1.5 rounded-md bg-slate-50 px-2.5 py-1.5 text-[11.5px] text-foreground dark:bg-muted/40",
677
677
  "data-task-do-approval": !0,
678
678
  children: [
679
- /* @__PURE__ */ t(ne, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-slate-400" }),
679
+ /* @__PURE__ */ t(re, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-slate-400" }),
680
680
  /* @__PURE__ */ a("span", { className: "min-w-0 flex-1", children: [
681
681
  /* @__PURE__ */ t("span", { className: "font-medium", children: "Needs a second approval." }),
682
682
  " ",
@@ -690,15 +690,15 @@ function Fe({
690
690
  }
691
691
  ),
692
692
  /* @__PURE__ */ t(
693
- we,
693
+ $e,
694
694
  {
695
695
  plan: e,
696
696
  quiet: !0,
697
697
  subscribe: c,
698
698
  className: "mt-3",
699
- beforeSteps: W ? /* @__PURE__ */ t(De, { plan: e }) : null,
700
- stepChanges: (r) => /* @__PURE__ */ t(Ee, { step: r, plan: e }),
701
- stepExtra: (r) => /* @__PURE__ */ t(Ie, { step: r, plan: e, onEdit: (S) => y.mutate(S), busy: y.isPending }),
699
+ beforeSteps: W ? /* @__PURE__ */ t(Ee, { plan: e }) : null,
700
+ stepChanges: (r) => /* @__PURE__ */ t(Ie, { step: r, plan: e }),
701
+ stepExtra: (r) => /* @__PURE__ */ t(Fe, { step: r, plan: e, onEdit: (S) => y.mutate(S), busy: y.isPending }),
702
702
  runDisabled: D ? e.can_approve ? "Once you approve, the assignee can run it." : "Approve & run opens once a second person approves." : null,
703
703
  onPlan: (r) => {
704
704
  E(r), p(r);
@@ -716,7 +716,7 @@ function Fe({
716
716
  "Approve plan"
717
717
  ]
718
718
  }
719
- ) : r.status === "executed" || e.can_undo ? /* @__PURE__ */ a(Z, { children: [
719
+ ) : r.status === "executed" || e.can_undo ? /* @__PURE__ */ a(ee, { children: [
720
720
  r.status === "executed" && K && !N && /* @__PURE__ */ a(
721
721
  b,
722
722
  {
@@ -744,7 +744,7 @@ function Fe({
744
744
  onClick: () => j.mutate(),
745
745
  "data-task-do-draft-reply": !0,
746
746
  children: [
747
- j.isPending ? /* @__PURE__ */ t(R, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ t(ue, { className: "h-3 w-3" }),
747
+ j.isPending ? /* @__PURE__ */ t(R, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ t(me, { className: "h-3 w-3" }),
748
748
  "Draft reply to requester"
749
749
  ]
750
750
  }
@@ -758,7 +758,7 @@ function Fe({
758
758
  onClick: () => P((S) => !S),
759
759
  "data-task-do-undo-toggle": !0,
760
760
  children: [
761
- /* @__PURE__ */ t(re, { className: "h-3 w-3" }),
761
+ /* @__PURE__ */ t(ie, { className: "h-3 w-3" }),
762
762
  " Undo what AI did"
763
763
  ]
764
764
  }
@@ -792,7 +792,7 @@ function Fe({
792
792
  ),
793
793
  /* @__PURE__ */ t("p", { className: "text-[11.5px] text-muted-foreground", children: "AI drafted this from what the plan did. Edit it, then send — it goes out as your reply. Nothing is sent until you do." }),
794
794
  /* @__PURE__ */ t(
795
- le,
795
+ de,
796
796
  {
797
797
  id: `task-do-reply-${e.plan_id}`,
798
798
  className: "min-h-[96px] text-[12px]",
@@ -830,7 +830,7 @@ function Fe({
830
830
  }
831
831
  ),
832
832
  g && e.can_undo && /* @__PURE__ */ t(
833
- Me,
833
+ ze,
834
834
  {
835
835
  planId: e.plan_id,
836
836
  undoUntil: e.undo_until,
@@ -843,13 +843,13 @@ function Fe({
843
843
  m && /* @__PURE__ */ t("p", { className: "mt-2 text-[11.5px] text-rose-700 dark:text-rose-400", "data-task-do-plan-error": !0, children: m })
844
844
  ] });
845
845
  }
846
- function Le({ plan: e, waiting: n }) {
846
+ function Me({ plan: e, waiting: n }) {
847
847
  const o = e.steps.length, c = e.steps.filter((l) => l.state.status === "done" || l.state.status === "skipped"), d = e.steps.find((l) => l.state.status === "failed"), p = e.records_changed > 0 ? ` · ${A(e.records_changed, "record")} changed` : "";
848
848
  let h = null, u = null, m = "text-foreground";
849
849
  switch (e.status) {
850
850
  case "proposed":
851
851
  if (n) return null;
852
- h = /* @__PURE__ */ t(ie, { className: "h-3.5 w-3.5 text-slate-400" }), u = "Nothing has run yet. Check the steps, then approve — or change or discard them.", m = "text-muted-foreground";
852
+ h = /* @__PURE__ */ t(oe, { className: "h-3.5 w-3.5 text-slate-400" }), u = "Nothing has run yet. Check the steps, then approve — or change or discard them.", m = "text-muted-foreground";
853
853
  break;
854
854
  case "running": {
855
855
  const l = Math.min(o, c.length + 1);
@@ -861,7 +861,7 @@ function Le({ plan: e, waiting: n }) {
861
861
  break;
862
862
  case "failed":
863
863
  case "paused":
864
- h = /* @__PURE__ */ t(ne, { className: "h-3.5 w-3.5 text-amber-600 dark:text-amber-400" }), u = d ? `Paused at step ${d.n} — the reason is under it. Steps after it have not run.` : `Paused after ${A(c.length, "step")}${p}.`;
864
+ h = /* @__PURE__ */ t(re, { className: "h-3.5 w-3.5 text-amber-600 dark:text-amber-400" }), u = d ? `Paused at step ${d.n} — the reason is under it. Steps after it have not run.` : `Paused after ${A(c.length, "step")}${p}.`;
865
865
  break;
866
866
  case "rejected":
867
867
  u = c.length ? "Stopped — the remaining steps did not run." : "Discarded — nothing changed.", m = "text-muted-foreground";
@@ -898,7 +898,7 @@ function Le({ plan: e, waiting: n }) {
898
898
  )
899
899
  ] });
900
900
  }
901
- function Me({
901
+ function ze({
902
902
  planId: e,
903
903
  undoUntil: n,
904
904
  onDone: o
@@ -914,13 +914,13 @@ function Me({
914
914
  ).then((i) => i.data),
915
915
  onSuccess: (i) => {
916
916
  u(
917
- `Restored ${i.undone} record${i.undone === 1 ? "" : "s"}${i.skipped ? `; ${i.skipped} changed since and left alone` : ""}${i.failed ? `; ${i.failed} failed (${i.errors[0] ?? ""})` : ""}.`
917
+ `Restored ${Z(i.undone)} record${i.undone === 1 ? "" : "s"}${i.skipped ? `; ${Z(i.skipped)} changed since and left alone` : ""}${i.failed ? `; ${Z(i.failed)} failed (${i.errors[0] ?? ""})` : ""}.`
918
918
  ), p(!1), m.refetch(), o();
919
919
  },
920
920
  onError: (i) => u(q(i))
921
921
  }), l = m.data ?? [], f = l.reduce((i, $) => i + $.revertible, 0), g = l.flatMap(
922
922
  (i) => i.records.filter(($) => $.status === "changed" || $.status === "gone")
923
- ), P = l.filter((i) => i.not_revertible), N = fe(() => {
923
+ ), P = l.filter((i) => i.not_revertible), N = ge(() => {
924
924
  if (!n) return null;
925
925
  const i = new Date(n);
926
926
  return Number.isNaN(i.getTime()) ? null : i.toLocaleDateString(void 0, { month: "short", day: "numeric" });
@@ -932,7 +932,7 @@ function Me({
932
932
  "data-task-do-undo": !0,
933
933
  children: [
934
934
  /* @__PURE__ */ a("p", { className: "flex items-center gap-1.5 text-[12.5px] font-medium text-foreground", children: [
935
- /* @__PURE__ */ t(re, { className: "h-3.5 w-3.5 text-slate-400" }),
935
+ /* @__PURE__ */ t(ie, { className: "h-3.5 w-3.5 text-slate-400" }),
936
936
  " Undo what AI did",
937
937
  N && /* @__PURE__ */ a("span", { className: "font-normal text-muted-foreground", children: [
938
938
  "· possible until ",
@@ -1001,7 +1001,7 @@ function Me({
1001
1001
  onClick: () => d ? x.mutate() : p(!0),
1002
1002
  "data-task-do-undo-run": !0,
1003
1003
  children: [
1004
- x.isPending ? /* @__PURE__ */ t(R, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ t(se, { className: "h-3 w-3" }),
1004
+ x.isPending ? /* @__PURE__ */ t(R, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ t(ne, { className: "h-3 w-3" }),
1005
1005
  d ? `Yes, restore ${A(f, "record")}` : `Restore ${A(f, "record")}`
1006
1006
  ]
1007
1007
  }
@@ -1013,10 +1013,10 @@ function Me({
1013
1013
  );
1014
1014
  }
1015
1015
  export {
1016
- Xe as TaskDoButton,
1017
- Re as TaskDoPanel,
1018
- Se as humanMinutes,
1019
- Ce as humanSeconds,
1020
- qe as taskDoAllowed,
1021
- Pe as useTaskDoAvailable
1016
+ Ze as TaskDoButton,
1017
+ Ae as TaskDoPanel,
1018
+ Pe as humanMinutes,
1019
+ Se as humanSeconds,
1020
+ Re as taskDoAllowed,
1021
+ qe as useTaskDoAvailable
1022
1022
  };
@@ -1,30 +1,30 @@
1
- function s(e) {
1
+ function i(e) {
2
2
  return e.replace(/\[([^\]]+)\]\([^)]*\)/g, "$1").replace(/[*_`]/g, "").trim();
3
3
  }
4
4
  function a(e) {
5
- let t = s(e).replace(/[\s,$€£¥]/g, "");
5
+ let t = i(e).replace(/[\s,$€£¥]/g, "");
6
6
  if (!t) return null;
7
- let n = 1;
8
- /^\(.*\)$/.test(t) && (n = -1, t = t.slice(1, -1)), t = t.replace(/%$/, "");
7
+ let l = 1;
8
+ /^\(.*\)$/.test(t) && (l = -1, t = t.slice(1, -1)), t = t.replace(/%$/, "");
9
9
  const r = /^(-?\d+(?:\.\d+)?)([kKmMbB]?)$/.exec(t);
10
10
  if (!r) return null;
11
11
  const u = { k: 1e3, m: 1e6, b: 1e9 }[r[2].toLowerCase()] ?? 1;
12
- return n * Number(r[1]) * u;
12
+ return l * Number(r[1]) * u;
13
13
  }
14
- const o = /^(.+?)\s*(?::|—|–|\s-\s)\s*(.+)$/;
14
+ const f = /^(.+?)\s*(?::|—|–|\s-\s)\s*(.+)$/;
15
15
  function c(e) {
16
16
  if (e.kind === "table")
17
17
  return e.rows.length ? { header: e.header, rows: e.rows } : null;
18
18
  if (e.kind === "chart")
19
19
  return {
20
- header: [e.spec.title ? s(e.spec.title) : "Label", "Value"],
20
+ header: [e.spec.title ? i(e.spec.title) : "Label", "Value"],
21
21
  rows: e.spec.data.map((t) => [t.label, String(t.value)])
22
22
  };
23
23
  if (e.kind === "ul" || e.kind === "ol") {
24
24
  if (e.items.length < 2) return null;
25
25
  const t = [];
26
- for (const n of e.items) {
27
- const r = o.exec(n.trim());
26
+ for (const l of e.items) {
27
+ const r = f.exec(l.trim());
28
28
  if (!r || a(r[2]) == null) return null;
29
29
  t.push([r[1].trim(), r[2].trim()]);
30
30
  }
@@ -35,46 +35,53 @@ function c(e) {
35
35
  function h(e) {
36
36
  const t = e.header.length;
37
37
  if (t < 2 || e.rows.length < 2) return null;
38
- const n = (l) => e.rows.every((i) => a(i[l] ?? "") != null);
38
+ const l = (n) => e.rows.every((s) => a(s[n] ?? "") != null);
39
39
  let r = -1;
40
- for (let l = 1; l < t; l++)
41
- if (n(l)) {
42
- r = l;
40
+ for (let n = 1; n < t; n++)
41
+ if (l(n)) {
42
+ r = n;
43
43
  break;
44
44
  }
45
45
  if (r < 0) return null;
46
46
  let u = 0;
47
- for (let l = 0; l < t; l++)
48
- if (l !== r && !n(l)) {
49
- u = l;
47
+ for (let n = 0; n < t; n++)
48
+ if (n !== r && !l(n)) {
49
+ u = n;
50
50
  break;
51
51
  }
52
52
  return { label: u, value: r };
53
53
  }
54
54
  function m(e, t = "bar") {
55
- const n = h(e);
56
- if (!n) return null;
57
- const r = e.rows.map((u) => ({
58
- label: s(u[n.label] ?? ""),
59
- value: a(u[n.value] ?? "")
60
- })).filter((u) => u.label).slice(0, 40);
61
- return r.length < 2 ? null : { type: t, title: s(e.header[n.value] ?? ""), data: r };
55
+ const l = h(e);
56
+ if (!l) return null;
57
+ const r = e.rows.map((n) => ({
58
+ label: i(n[l.label] ?? ""),
59
+ value: a(n[l.value] ?? "")
60
+ })).filter((n) => n.label).slice(0, 40);
61
+ if (r.length < 2) return null;
62
+ const u = e.rows.some((n) => /^\s*-?\$/.test(i(n[l.value] ?? "")));
63
+ return {
64
+ type: t,
65
+ title: i(e.header[l.value] ?? ""),
66
+ data: r,
67
+ ...u ? { unit: "currency" } : {}
68
+ };
62
69
  }
63
70
  function d(e) {
64
71
  return e.rows.map((t) => {
65
- const [n, ...r] = t, u = (n ?? "").replace(/^\*\*(.*)\*\*$/, "$1");
72
+ const [l, ...r] = t, u = (l ?? "").replace(/^\*\*(.*)\*\*$/, "$1");
66
73
  if (e.header.length === 2) return `**${u}** — ${r[0] ?? ""}`;
67
- const l = r.map((i, f) => i ? `${e.header[f + 1] ?? ""}: ${i}` : "").filter(Boolean);
68
- return `**${u}**${l.length ? ` — ${l.join("; ")}` : ""}`;
74
+ const n = r.map((s, o) => s ? `${e.header[o + 1] ?? ""}: ${s}` : "").filter(Boolean);
75
+ return `**${u}**${n.length ? ` — ${n.join("; ")}` : ""}`;
69
76
  });
70
77
  }
71
78
  function p(e) {
72
79
  const t = e.kind === "table" ? "table" : e.kind === "chart" ? "chart" : e.kind === "ul" || e.kind === "ol" ? "list" : null;
73
80
  if (!t) return [];
74
- const n = c(e);
75
- if (!n) return [t];
81
+ const l = c(e);
82
+ if (!l) return [t];
76
83
  const r = [t];
77
- return t !== "table" && r.push("table"), t !== "chart" && m(n) && r.push("chart"), t !== "list" && r.push("list"), r;
84
+ return t !== "table" && r.push("table"), t !== "chart" && m(l) && r.push("chart"), t !== "list" && r.push("list"), r;
78
85
  }
79
86
  export {
80
87
  a as cellNumber,
@@ -82,6 +89,6 @@ export {
82
89
  m as chartOf,
83
90
  p as formatsFor,
84
91
  d as listOf,
85
- s as plainCell,
92
+ i as plainCell,
86
93
  c as rowsOfBlock
87
94
  };